mirror of
https://github.com/fluencelabs/dweb-transports
synced 2025-03-31 09:21:11 +00:00
129 lines
2.7 MiB
129 lines
2.7 MiB
!function(e){var t={};function r(n){if(t[n])return t[n].exports;var i=t[n]={i:n,l:!1,exports:{}};return e[n].call(i.exports,i,i.exports,r),i.l=!0,i.exports}r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)r.d(n,i,function(t){return e[t]}.bind(null,i));return n},r.n=function(e){var t=e&&e.__esModule?function t(){return e.default}:function t(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=613)}([function(e,t,r){"use strict";(function(e){
|
||
/*!
|
||
* The buffer module from node.js, for the browser.
|
||
*
|
||
* @author Feross Aboukhadijeh <feross@feross.org> <http://feross.org>
|
||
* @license MIT
|
||
*/
|
||
var n=r(620),i=r(329),o=r(327);function s(){try{var e=new Uint8Array(1);return e.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===e.foo()&&"function"==typeof e.subarray&&0===e.subarray(1,1).byteLength}catch(e){return!1}}function a(){return c.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function u(e,t){if(a()<t)throw new RangeError("Invalid typed array length");return c.TYPED_ARRAY_SUPPORT?(e=new Uint8Array(t),e.__proto__=c.prototype):(null===e&&(e=new c(t)),e.length=t),e}function c(e,t,r){if(!(c.TYPED_ARRAY_SUPPORT||this instanceof c))return new c(e,t,r);if("number"==typeof e){if("string"==typeof t)throw new Error("If encoding is specified then the first argument must be a string");return p(this,e)}return f(this,e,t,r)}function f(e,t,r,n){if("number"==typeof t)throw new TypeError('"value" argument must not be a number');return"undefined"!=typeof ArrayBuffer&&t instanceof ArrayBuffer?g(e,t,r,n):"string"==typeof t?d(e,t,r):m(e,t)}function l(e){if("number"!=typeof e)throw new TypeError('"size" argument must be a number');if(e<0)throw new RangeError('"size" argument must not be negative')}function h(e,t,r,n){return l(t),t<=0?u(e,t):void 0!==r?"string"==typeof n?u(e,t).fill(r,n):u(e,t).fill(r):u(e,t)}function p(e,t){if(l(t),e=u(e,t<0?0:0|b(t)),!c.TYPED_ARRAY_SUPPORT)for(var r=0;r<t;++r)e[r]=0;return e}function d(e,t,r){if("string"==typeof r&&""!==r||(r="utf8"),!c.isEncoding(r))throw new TypeError('"encoding" must be a valid string encoding');var n=0|_(t,r);e=u(e,n);var i=e.write(t,r);return i!==n&&(e=e.slice(0,i)),e}function y(e,t){var r=t.length<0?0:0|b(t.length);e=u(e,r);for(var n=0;n<r;n+=1)e[n]=255&t[n];return e}function g(e,t,r,n){if(t.byteLength,r<0||t.byteLength<r)throw new RangeError("'offset' is out of bounds");if(t.byteLength<r+(n||0))throw new RangeError("'length' is out of bounds");return t=void 0===r&&void 0===n?new Uint8Array(t):void 0===n?new Uint8Array(t,r):new Uint8Array(t,r,n),c.TYPED_ARRAY_SUPPORT?(e=t,e.__proto__=c.prototype):e=y(e,t),e}function m(e,t){if(c.isBuffer(t)){var r=0|b(t.length);return e=u(e,r),0===e.length?e:(t.copy(e,0,0,r),e)}if(t){if("undefined"!=typeof ArrayBuffer&&t.buffer instanceof ArrayBuffer||"length"in t)return"number"!=typeof t.length||te(t.length)?u(e,0):y(e,t);if("Buffer"===t.type&&o(t.data))return y(e,t.data)}throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}function b(e){if(e>=a())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+a().toString(16)+" bytes");return 0|e}function v(e){return+e!=e&&(e=0),c.alloc(+e)}function _(e,t){if(c.isBuffer(e))return e.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(e)||e instanceof ArrayBuffer))return e.byteLength;"string"!=typeof e&&(e=""+e);var r=e.length;if(0===r)return 0;for(var n=!1;;)switch(t){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":case void 0:return J(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return Q(e).length;default:if(n)return J(e).length;t=(""+t).toLowerCase(),n=!0}}function w(e,t,r){var n=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if(r>>>=0,t>>>=0,r<=t)return"";for(e||(e="utf8");;)switch(e){case"hex":return M(this,t,r);case"utf8":case"utf-8":return O(this,t,r);case"ascii":return L(this,t,r);case"latin1":case"binary":return j(this,t,r);case"base64":return P(this,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return K(this,t,r);default:if(n)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),n=!0}}function S(e,t,r){var n=e[t];e[t]=e[r],e[r]=n}function k(e,t,r,n,i){if(0===e.length)return-1;if("string"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,isNaN(r)&&(r=i?0:e.length-1),r<0&&(r=e.length+r),r>=e.length){if(i)return-1;r=e.length-1}else if(r<0){if(!i)return-1;r=0}if("string"==typeof t&&(t=c.from(t,n)),c.isBuffer(t))return 0===t.length?-1:E(e,t,r,n,i);if("number"==typeof t)return t&=255,c.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(e,t,r):Uint8Array.prototype.lastIndexOf.call(e,t,r):E(e,[t],r,n,i);throw new TypeError("val must be string, number or Buffer")}function E(e,t,r,n,i){var o=1,s=e.length,a=t.length,u;if(void 0!==n&&(n=String(n).toLowerCase(),"ucs2"===n||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(e.length<2||t.length<2)return-1;o=2,s/=2,a/=2,r/=2}function c(e,t){return 1===o?e[t]:e.readUInt16BE(t*o)}if(i){var f=-1;for(u=r;u<s;u++)if(c(e,u)===c(t,-1===f?0:u-f)){if(-1===f&&(f=u),u-f+1===a)return f*o}else-1!==f&&(u-=u-f),f=-1}else for(r+a>s&&(r=s-a),u=r;u>=0;u--){for(var l=!0,h=0;h<a;h++)if(c(e,u+h)!==c(t,h)){l=!1;break}if(l)return u}return-1}function A(e,t,r,n){r=Number(r)||0;var i=e.length-r;n?(n=Number(n),n>i&&(n=i)):n=i;var o=t.length;if(o%2!=0)throw new TypeError("Invalid hex string");n>o/2&&(n=o/2);for(var s=0;s<n;++s){var a=parseInt(t.substr(2*s,2),16);if(isNaN(a))return s;e[r+s]=a}return s}function x(e,t,r,n){return ee(J(t,e.length-r),e,r,n)}function I(e,t,r,n){return ee(X(t),e,r,n)}function T(e,t,r,n){return I(e,t,r,n)}function B(e,t,r,n){return ee(Q(t),e,r,n)}function C(e,t,r,n){return ee(Z(t,e.length-r),e,r,n)}function P(e,t,r){return 0===t&&r===e.length?n.fromByteArray(e):n.fromByteArray(e.slice(t,r))}function O(e,t,r){r=Math.min(e.length,r);for(var n=[],i=t;i<r;){var o=e[i],s=null,a=o>239?4:o>223?3:o>191?2:1,u,c,f,l;if(i+a<=r)switch(a){case 1:o<128&&(s=o);break;case 2:u=e[i+1],128==(192&u)&&(l=(31&o)<<6|63&u,l>127&&(s=l));break;case 3:u=e[i+1],c=e[i+2],128==(192&u)&&128==(192&c)&&(l=(15&o)<<12|(63&u)<<6|63&c,l>2047&&(l<55296||l>57343)&&(s=l));break;case 4:u=e[i+1],c=e[i+2],f=e[i+3],128==(192&u)&&128==(192&c)&&128==(192&f)&&(l=(15&o)<<18|(63&u)<<12|(63&c)<<6|63&f,l>65535&&l<1114112&&(s=l))}null===s?(s=65533,a=1):s>65535&&(s-=65536,n.push(s>>>10&1023|55296),s=56320|1023&s),n.push(s),i+=a}return N(n)}t.Buffer=c,t.SlowBuffer=v,t.INSPECT_MAX_BYTES=50,c.TYPED_ARRAY_SUPPORT=void 0!==e.TYPED_ARRAY_SUPPORT?e.TYPED_ARRAY_SUPPORT:s(),t.kMaxLength=a(),c.poolSize=8192,c._augment=function(e){return e.__proto__=c.prototype,e},c.from=function(e,t,r){return f(null,e,t,r)},c.TYPED_ARRAY_SUPPORT&&(c.prototype.__proto__=Uint8Array.prototype,c.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&c[Symbol.species]===c&&Object.defineProperty(c,Symbol.species,{value:null,configurable:!0})),c.alloc=function(e,t,r){return h(null,e,t,r)},c.allocUnsafe=function(e){return p(null,e)},c.allocUnsafeSlow=function(e){return p(null,e)},c.isBuffer=function e(t){return!(null==t||!t._isBuffer)},c.compare=function e(t,r){if(!c.isBuffer(t)||!c.isBuffer(r))throw new TypeError("Arguments must be Buffers");if(t===r)return 0;for(var n=t.length,i=r.length,o=0,s=Math.min(n,i);o<s;++o)if(t[o]!==r[o]){n=t[o],i=r[o];break}return n<i?-1:i<n?1:0},c.isEncoding=function e(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}},c.concat=function e(t,r){if(!o(t))throw new TypeError('"list" argument must be an Array of Buffers');if(0===t.length)return c.alloc(0);var n;if(void 0===r)for(r=0,n=0;n<t.length;++n)r+=t[n].length;var i=c.allocUnsafe(r),s=0;for(n=0;n<t.length;++n){var a=t[n];if(!c.isBuffer(a))throw new TypeError('"list" argument must be an Array of Buffers');a.copy(i,s),s+=a.length}return i},c.byteLength=_,c.prototype._isBuffer=!0,c.prototype.swap16=function e(){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)S(this,r,r+1);return this},c.prototype.swap32=function e(){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)S(this,r,r+3),S(this,r+1,r+2);return this},c.prototype.swap64=function e(){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)S(this,r,r+7),S(this,r+1,r+6),S(this,r+2,r+5),S(this,r+3,r+4);return this},c.prototype.toString=function e(){var t=0|this.length;return 0===t?"":0===arguments.length?O(this,0,t):w.apply(this,arguments)},c.prototype.equals=function e(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 e(){var r="",n=t.INSPECT_MAX_BYTES;return this.length>0&&(r=this.toString("hex",0,n).match(/.{2}/g).join(" "),this.length>n&&(r+=" ... ")),"<Buffer "+r+">"},c.prototype.compare=function e(t,r,n,i,o){if(!c.isBuffer(t))throw new TypeError("Argument must be a Buffer");if(void 0===r&&(r=0),void 0===n&&(n=t?t.length:0),void 0===i&&(i=0),void 0===o&&(o=this.length),r<0||n>t.length||i<0||o>this.length)throw new RangeError("out of range index");if(i>=o&&r>=n)return 0;if(i>=o)return-1;if(r>=n)return 1;if(r>>>=0,n>>>=0,i>>>=0,o>>>=0,this===t)return 0;for(var s=o-i,a=n-r,u=Math.min(s,a),f=this.slice(i,o),l=t.slice(r,n),h=0;h<u;++h)if(f[h]!==l[h]){s=f[h],a=l[h];break}return s<a?-1:a<s?1:0},c.prototype.includes=function e(t,r,n){return-1!==this.indexOf(t,r,n)},c.prototype.indexOf=function e(t,r,n){return k(this,t,r,n,!0)},c.prototype.lastIndexOf=function e(t,r,n){return k(this,t,r,n,!1)},c.prototype.write=function e(t,r,n,i){if(void 0===r)i="utf8",n=this.length,r=0;else if(void 0===n&&"string"==typeof r)i=r,n=this.length,r=0;else{if(!isFinite(r))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");r|=0,isFinite(n)?(n|=0,void 0===i&&(i="utf8")):(i=n,n=void 0)}var o=this.length-r;if((void 0===n||n>o)&&(n=o),t.length>0&&(n<0||r<0)||r>this.length)throw new RangeError("Attempt to write outside buffer bounds");i||(i="utf8");for(var s=!1;;)switch(i){case"hex":return A(this,t,r,n);case"utf8":case"utf-8":return x(this,t,r,n);case"ascii":return I(this,t,r,n);case"latin1":case"binary":return T(this,t,r,n);case"base64":return B(this,t,r,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return C(this,t,r,n);default:if(s)throw new TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),s=!0}},c.prototype.toJSON=function e(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var R=4096;function N(e){var t=e.length;if(t<=R)return String.fromCharCode.apply(String,e);for(var r="",n=0;n<t;)r+=String.fromCharCode.apply(String,e.slice(n,n+=R));return r}function L(e,t,r){var n="";r=Math.min(e.length,r);for(var i=t;i<r;++i)n+=String.fromCharCode(127&e[i]);return n}function j(e,t,r){var n="";r=Math.min(e.length,r);for(var i=t;i<r;++i)n+=String.fromCharCode(e[i]);return n}function M(e,t,r){var n=e.length;(!t||t<0)&&(t=0),(!r||r<0||r>n)&&(r=n);for(var i="",o=t;o<r;++o)i+=Y(e[o]);return i}function K(e,t,r){for(var n=e.slice(t,r),i="",o=0;o<n.length;o+=2)i+=String.fromCharCode(n[o]+256*n[o+1]);return i}function D(e,t,r){if(e%1!=0||e<0)throw new RangeError("offset is not uint");if(e+t>r)throw new RangeError("Trying to access beyond buffer length")}function U(e,t,r,n,i,o){if(!c.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>i||t<o)throw new RangeError('"value" argument is out of bounds');if(r+n>e.length)throw new RangeError("Index out of range")}function F(e,t,r,n){t<0&&(t=65535+t+1);for(var i=0,o=Math.min(e.length-r,2);i<o;++i)e[r+i]=(t&255<<8*(n?i:1-i))>>>8*(n?i:1-i)}function q(e,t,r,n){t<0&&(t=4294967295+t+1);for(var i=0,o=Math.min(e.length-r,4);i<o;++i)e[r+i]=t>>>8*(n?i:3-i)&255}function H(e,t,r,n,i,o){if(r+n>e.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function z(e,t,r,n,o){return o||H(e,t,r,4,3.4028234663852886e38,-3.4028234663852886e38),i.write(e,t,r,n,23,4),r+4}function V(e,t,r,n,o){return o||H(e,t,r,8,1.7976931348623157e308,-1.7976931348623157e308),i.write(e,t,r,n,52,8),r+8}c.prototype.slice=function e(t,r){var n=this.length,i;if(t=~~t,r=void 0===r?n:~~r,t<0?(t+=n,t<0&&(t=0)):t>n&&(t=n),r<0?(r+=n,r<0&&(r=0)):r>n&&(r=n),r<t&&(r=t),c.TYPED_ARRAY_SUPPORT)i=this.subarray(t,r),i.__proto__=c.prototype;else{var o=r-t;i=new c(o,void 0);for(var s=0;s<o;++s)i[s]=this[s+t]}return i},c.prototype.readUIntLE=function e(t,r,n){t|=0,r|=0,n||D(t,r,this.length);for(var i=this[t],o=1,s=0;++s<r&&(o*=256);)i+=this[t+s]*o;return i},c.prototype.readUIntBE=function e(t,r,n){t|=0,r|=0,n||D(t,r,this.length);for(var i=this[t+--r],o=1;r>0&&(o*=256);)i+=this[t+--r]*o;return i},c.prototype.readUInt8=function e(t,r){return r||D(t,1,this.length),this[t]},c.prototype.readUInt16LE=function e(t,r){return r||D(t,2,this.length),this[t]|this[t+1]<<8},c.prototype.readUInt16BE=function e(t,r){return r||D(t,2,this.length),this[t]<<8|this[t+1]},c.prototype.readUInt32LE=function e(t,r){return r||D(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},c.prototype.readUInt32BE=function e(t,r){return r||D(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},c.prototype.readIntLE=function e(t,r,n){t|=0,r|=0,n||D(t,r,this.length);for(var i=this[t],o=1,s=0;++s<r&&(o*=256);)i+=this[t+s]*o;return o*=128,i>=o&&(i-=Math.pow(2,8*r)),i},c.prototype.readIntBE=function e(t,r,n){t|=0,r|=0,n||D(t,r,this.length);for(var i=r,o=1,s=this[t+--i];i>0&&(o*=256);)s+=this[t+--i]*o;return o*=128,s>=o&&(s-=Math.pow(2,8*r)),s},c.prototype.readInt8=function e(t,r){return r||D(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},c.prototype.readInt16LE=function e(t,r){r||D(t,2,this.length);var n=this[t]|this[t+1]<<8;return 32768&n?4294901760|n:n},c.prototype.readInt16BE=function e(t,r){r||D(t,2,this.length);var n=this[t+1]|this[t]<<8;return 32768&n?4294901760|n:n},c.prototype.readInt32LE=function e(t,r){return r||D(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},c.prototype.readInt32BE=function e(t,r){return r||D(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},c.prototype.readFloatLE=function e(t,r){return r||D(t,4,this.length),i.read(this,t,!0,23,4)},c.prototype.readFloatBE=function e(t,r){return r||D(t,4,this.length),i.read(this,t,!1,23,4)},c.prototype.readDoubleLE=function e(t,r){return r||D(t,8,this.length),i.read(this,t,!0,52,8)},c.prototype.readDoubleBE=function e(t,r){return r||D(t,8,this.length),i.read(this,t,!1,52,8)},c.prototype.writeUIntLE=function e(t,r,n,i){if(t=+t,r|=0,n|=0,!i){var o=Math.pow(2,8*n)-1;U(this,t,r,n,o,0)}var s=1,a=0;for(this[r]=255&t;++a<n&&(s*=256);)this[r+a]=t/s&255;return r+n},c.prototype.writeUIntBE=function e(t,r,n,i){if(t=+t,r|=0,n|=0,!i){var o=Math.pow(2,8*n)-1;U(this,t,r,n,o,0)}var s=n-1,a=1;for(this[r+s]=255&t;--s>=0&&(a*=256);)this[r+s]=t/a&255;return r+n},c.prototype.writeUInt8=function e(t,r,n){return t=+t,r|=0,n||U(this,t,r,1,255,0),c.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),this[r]=255&t,r+1},c.prototype.writeUInt16LE=function e(t,r,n){return t=+t,r|=0,n||U(this,t,r,2,65535,0),c.TYPED_ARRAY_SUPPORT?(this[r]=255&t,this[r+1]=t>>>8):F(this,t,r,!0),r+2},c.prototype.writeUInt16BE=function e(t,r,n){return t=+t,r|=0,n||U(this,t,r,2,65535,0),c.TYPED_ARRAY_SUPPORT?(this[r]=t>>>8,this[r+1]=255&t):F(this,t,r,!1),r+2},c.prototype.writeUInt32LE=function e(t,r,n){return t=+t,r|=0,n||U(this,t,r,4,4294967295,0),c.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},c.prototype.writeUInt32BE=function e(t,r,n){return t=+t,r|=0,n||U(this,t,r,4,4294967295,0),c.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},c.prototype.writeIntLE=function e(t,r,n,i){if(t=+t,r|=0,!i){var o=Math.pow(2,8*n-1);U(this,t,r,n,o-1,-o)}var s=0,a=1,u=0;for(this[r]=255&t;++s<n&&(a*=256);)t<0&&0===u&&0!==this[r+s-1]&&(u=1),this[r+s]=(t/a>>0)-u&255;return r+n},c.prototype.writeIntBE=function e(t,r,n,i){if(t=+t,r|=0,!i){var o=Math.pow(2,8*n-1);U(this,t,r,n,o-1,-o)}var s=n-1,a=1,u=0;for(this[r+s]=255&t;--s>=0&&(a*=256);)t<0&&0===u&&0!==this[r+s+1]&&(u=1),this[r+s]=(t/a>>0)-u&255;return r+n},c.prototype.writeInt8=function e(t,r,n){return t=+t,r|=0,n||U(this,t,r,1,127,-128),c.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),t<0&&(t=255+t+1),this[r]=255&t,r+1},c.prototype.writeInt16LE=function e(t,r,n){return t=+t,r|=0,n||U(this,t,r,2,32767,-32768),c.TYPED_ARRAY_SUPPORT?(this[r]=255&t,this[r+1]=t>>>8):F(this,t,r,!0),r+2},c.prototype.writeInt16BE=function e(t,r,n){return t=+t,r|=0,n||U(this,t,r,2,32767,-32768),c.TYPED_ARRAY_SUPPORT?(this[r]=t>>>8,this[r+1]=255&t):F(this,t,r,!1),r+2},c.prototype.writeInt32LE=function e(t,r,n){return t=+t,r|=0,n||U(this,t,r,4,2147483647,-2147483648),c.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},c.prototype.writeInt32BE=function e(t,r,n){return t=+t,r|=0,n||U(this,t,r,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),c.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},c.prototype.writeFloatLE=function e(t,r,n){return z(this,t,r,!0,n)},c.prototype.writeFloatBE=function e(t,r,n){return z(this,t,r,!1,n)},c.prototype.writeDoubleLE=function e(t,r,n){return V(this,t,r,!0,n)},c.prototype.writeDoubleBE=function e(t,r,n){return V(this,t,r,!1,n)},c.prototype.copy=function e(t,r,n,i){if(n||(n=0),i||0===i||(i=this.length),r>=t.length&&(r=t.length),r||(r=0),i>0&&i<n&&(i=n),i===n)return 0;if(0===t.length||0===this.length)return 0;if(r<0)throw new RangeError("targetStart out of bounds");if(n<0||n>=this.length)throw new RangeError("sourceStart out of bounds");if(i<0)throw new RangeError("sourceEnd out of bounds");i>this.length&&(i=this.length),t.length-r<i-n&&(i=t.length-r+n);var o=i-n,s;if(this===t&&n<r&&r<i)for(s=o-1;s>=0;--s)t[s+r]=this[s+n];else if(o<1e3||!c.TYPED_ARRAY_SUPPORT)for(s=0;s<o;++s)t[s+r]=this[s+n];else Uint8Array.prototype.set.call(t,this.subarray(n,n+o),r);return o},c.prototype.fill=function e(t,r,n,i){if("string"==typeof t){if("string"==typeof r?(i=r,r=0,n=this.length):"string"==typeof n&&(i=n,n=this.length),1===t.length){var o=t.charCodeAt(0);o<256&&(t=o)}if(void 0!==i&&"string"!=typeof i)throw new TypeError("encoding must be a string");if("string"==typeof i&&!c.isEncoding(i))throw new TypeError("Unknown encoding: "+i)}else"number"==typeof t&&(t&=255);if(r<0||this.length<r||this.length<n)throw new RangeError("Out of range index");if(n<=r)return this;var s;if(r>>>=0,n=void 0===n?this.length:n>>>0,t||(t=0),"number"==typeof t)for(s=r;s<n;++s)this[s]=t;else{var a=c.isBuffer(t)?t:J(new c(t,i).toString()),u=a.length;for(s=0;s<n-r;++s)this[s+r]=a[s%u]}return this};var G=/[^+\/0-9A-Za-z-_]/g;function W(e){if(e=$(e).replace(G,""),e.length<2)return"";for(;e.length%4!=0;)e+="=";return e}function $(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")}function Y(e){return e<16?"0"+e.toString(16):e.toString(16)}function J(e,t){var r;t=t||1/0;for(var n=e.length,i=null,o=[],s=0;s<n;++s){if(r=e.charCodeAt(s),r>55295&&r<57344){if(!i){if(r>56319){(t-=3)>-1&&o.push(239,191,189);continue}if(s+1===n){(t-=3)>-1&&o.push(239,191,189);continue}i=r;continue}if(r<56320){(t-=3)>-1&&o.push(239,191,189),i=r;continue}r=65536+(i-55296<<10|r-56320)}else i&&(t-=3)>-1&&o.push(239,191,189);if(i=null,r<128){if((t-=1)<0)break;o.push(r)}else if(r<2048){if((t-=2)<0)break;o.push(r>>6|192,63&r|128)}else if(r<65536){if((t-=3)<0)break;o.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;o.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return o}function X(e){for(var t=[],r=0;r<e.length;++r)t.push(255&e.charCodeAt(r));return t}function Z(e,t){for(var r,n,i,o=[],s=0;s<e.length&&!((t-=2)<0);++s)r=e.charCodeAt(s),n=r>>8,i=r%256,o.push(i),o.push(n);return o}function Q(e){return n.toByteArray(W(e))}function ee(e,t,r,n){for(var i=0;i<n&&!(i+r>=t.length||i>=e.length);++i)t[i+r]=e[i];return i}function te(e){return e!=e}}).call(this,r(7))},function(e,t,r){(function(n){function i(){return!("undefined"==typeof window||!window.process||"renderer"!==window.process.type)||("undefined"==typeof navigator||!navigator.userAgent||!navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))&&("undefined"!=typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"undefined"!=typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/))}function o(e){var r=this.useColors;if(e[0]=(r?"%c":"")+this.namespace+(r?" %c":" ")+e[0]+(r?"%c ":" ")+"+"+t.humanize(this.diff),r){var n="color: "+this.color;e.splice(1,0,n,"color: inherit");var i=0,o=0;e[0].replace(/%[a-zA-Z%]/g,function(e){"%%"!==e&&(i++,"%c"===e&&(o=i))}),e.splice(o,0,n)}}function s(){return"object"==typeof console&&console.log&&Function.prototype.apply.call(console.log,console,arguments)}function a(e){try{null==e?t.storage.removeItem("debug"):t.storage.debug=e}catch(e){}}function u(){var e;try{e=t.storage.debug}catch(e){}return!e&&void 0!==n&&"env"in n&&(e=n.env.DEBUG),e}function c(){try{return window.localStorage}catch(e){}}t=e.exports=r(618),t.log=s,t.formatArgs=o,t.save=a,t.load=u,t.useColors=i,t.storage="undefined"!=typeof chrome&&void 0!==chrome.storage?chrome.storage.local:c(),t.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],t.formatters.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}},t.enable(u())}).call(this,r(6))},function(e,t,r){var n=r(0),i=n.Buffer;function o(e,t){for(var r in e)t[r]=e[r]}function s(e,t,r){return i(e,t,r)}i.from&&i.alloc&&i.allocUnsafe&&i.allocUnsafeSlow?e.exports=n:(o(n,t),t.Buffer=s),o(i,s),s.from=function(e,t,r){if("number"==typeof e)throw new TypeError("Argument must not be a number");return i(e,t,r)},s.alloc=function(e,t,r){if("number"!=typeof e)throw new TypeError("Argument must be a number");var n=i(e);return void 0!==t?"string"==typeof r?n.fill(t,r):n.fill(t):n.fill(0),n},s.allocUnsafe=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return i(e)},s.allocUnsafeSlow=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return n.SlowBuffer(e)}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(213),i=o(n);function o(e){return e&&e.__esModule?e:{default:e}}t.default=i.default,e.exports=t.default},function(e,t){"function"==typeof Object.create?e.exports=function e(t,r){t.super_=r,t.prototype=Object.create(r.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}})}:e.exports=function e(t,r){t.super_=r;var n=function(){};n.prototype=r.prototype,t.prototype=new n,t.prototype.constructor=t}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e,t){if(t=(0,u.default)(t||s.default),!(0,i.default)(e))return t(new Error("First argument to waterfall must be an array of functions"));if(!e.length)return t();var r=0;function n(t){var n=(0,d.default)(e[r++]);t.push((0,h.default)(o)),n.apply(null,t)}function o(i){if(i||r===e.length)return t.apply(null,arguments);n((0,f.default)(arguments,1))}n([])};var n=r(91),i=y(n),o=r(54),s=y(o),a=r(155),u=y(a),c=r(104),f=y(c),l=r(105),h=y(l),p=r(32),d=y(p);function y(e){return e&&e.__esModule?e:{default:e}}e.exports=t.default},function(e,t){var r=e.exports={},n,i;function o(){throw new Error("setTimeout has not been defined")}function s(){throw new Error("clearTimeout has not been defined")}function a(e){if(n===setTimeout)return setTimeout(e,0);if((n===o||!n)&&setTimeout)return n=setTimeout,setTimeout(e,0);try{return n(e,0)}catch(t){try{return n.call(null,e,0)}catch(t){return n.call(this,e,0)}}}function u(e){if(i===clearTimeout)return clearTimeout(e);if((i===s||!i)&&clearTimeout)return i=clearTimeout,clearTimeout(e);try{return i(e)}catch(t){try{return i.call(null,e)}catch(t){return i.call(this,e)}}}!function(){try{n="function"==typeof setTimeout?setTimeout:o}catch(e){n=o}try{i="function"==typeof clearTimeout?clearTimeout:s}catch(e){i=s}}();var c=[],f=!1,l,h=-1;function p(){f&&l&&(f=!1,l.length?c=l.concat(c):h=-1,c.length&&d())}function d(){if(!f){var e=a(p);f=!0;for(var t=c.length;t;){for(l=c,c=[];++h<t;)l&&l[h].run();h=-1,t=c.length}l=null,f=!1,u(e)}}function y(e,t){this.fun=e,this.array=t}function g(){}r.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)t[r-1]=arguments[r];c.push(new y(e,t)),1!==c.length||f||a(d)},y.prototype.run=function(){this.fun.apply(null,this.array)},r.title="browser",r.browser=!0,r.env={},r.argv=[],r.version="",r.versions={},r.on=g,r.addListener=g,r.once=g,r.off=g,r.removeListener=g,r.removeAllListeners=g,r.emit=g,r.prependListener=g,r.prependOnceListener=g,r.listeners=function(e){return[]},r.binding=function(e){throw new Error("process.binding is not supported")},r.cwd=function(){return"/"},r.chdir=function(e){throw new Error("process.chdir is not supported")},r.umask=function(){return 0}},function(e,t){var r;r=function(){return this}();try{r=r||Function("return this")()||(0,eval)("this")}catch(e){"object"==typeof window&&(r=window)}e.exports=r},function(e,t,r){"use strict";var n=r(640),i=r(646),o=r(651);for(var s in t=e.exports=r(64),t.pull=t,n)t[s]=n[s];for(var s in o)t[s]=o[s];for(var s in i)t[s]=i[s]},function(e,t,r){"use strict";(function(t){const n=r(14),i=r(209),o=r(638),s=r(153),a=r(336),u=r(14),c=r(639);class f{constructor(e,r,s){if(f.isCID(e)){let r=e;return this.version=r.version,this.codec=r.codec,void(this.multihash=t.from(r.multihash))}if("string"==typeof e)if(i.isEncoded(e)){const t=i.decode(e);e=parseInt(t.slice(0,1).toString("hex"),16),r=o.getCodec(t.slice(1)),s=o.rmPrefix(t.slice(1))}else r="dag-pb",s=n.fromB58String(e),e=0;else if(t.isBuffer(e)){const t=e.slice(0,1),n=parseInt(t.toString("hex"),16);if(0===n||1===n){const t=e;e=n,r=o.getCodec(t.slice(1)),s=o.rmPrefix(t.slice(1))}else r="dag-pb",s=e,e=0}this.codec=r,this.version=e,this.multihash=s,f.validateCID(this)}get buffer(){switch(this.version){case 0:return this.multihash;case 1:return t.concat([t.from("01","hex"),t.from(a[this.codec]),this.multihash]);default:throw new Error("unsupported version")}}get prefix(){return t.concat([t.from(`0${this.version}`,"hex"),a[this.codec],u.prefix(this.multihash)])}toV0(){if("dag-pb"!==this.codec)throw new Error("Cannot convert a non dag-pb CID to CIDv0");return new f(0,this.codec,this.multihash)}toV1(){return new f(1,this.codec,this.multihash)}toBaseEncodedString(e){switch(e=e||"base58btc",this.version){case 0:if("base58btc"!==e)throw new Error("not supported with CIDv0, to support different bases, please migrate the instance do CIDv1, you can do that through cid.toV1()");return n.toB58String(this.multihash);case 1:return i.encode(e,this.buffer).toString();default:throw new Error("Unsupported version")}}toJSON(){return{codec:this.codec,version:this.version,hash:this.multihash}}equals(e){return this.codec===e.codec&&this.version===e.version&&this.multihash.equals(e.multihash)}static isCID(e){return!c.checkCIDComponents(e)}static validateCID(e){let t=c.checkCIDComponents(e);if(t)throw new Error(t)}}f.codecs=s,e.exports=f}).call(this,r(0).Buffer)},function(e,t){function r(){this._events=this._events||{},this._maxListeners=this._maxListeners||void 0}function n(e){return"function"==typeof e}function i(e){return"number"==typeof e}function o(e){return"object"==typeof e&&null!==e}function s(e){return void 0===e}e.exports=r,r.EventEmitter=r,r.prototype._events=void 0,r.prototype._maxListeners=void 0,r.defaultMaxListeners=10,r.prototype.setMaxListeners=function(e){if(!i(e)||e<0||isNaN(e))throw TypeError("n must be a positive number");return this._maxListeners=e,this},r.prototype.emit=function(e){var t,r,i,a,u,c;if(this._events||(this._events={}),"error"===e&&(!this._events.error||o(this._events.error)&&!this._events.error.length)){if(t=arguments[1],t instanceof Error)throw t;var f=new Error('Uncaught, unspecified "error" event. ('+t+")");throw f.context=t,f}if(r=this._events[e],s(r))return!1;if(n(r))switch(arguments.length){case 1:r.call(this);break;case 2:r.call(this,arguments[1]);break;case 3:r.call(this,arguments[1],arguments[2]);break;default:a=Array.prototype.slice.call(arguments,1),r.apply(this,a)}else if(o(r))for(a=Array.prototype.slice.call(arguments,1),c=r.slice(),i=c.length,u=0;u<i;u++)c[u].apply(this,a);return!0},r.prototype.addListener=function(e,t){var i;if(!n(t))throw TypeError("listener must be a function");return this._events||(this._events={}),this._events.newListener&&this.emit("newListener",e,n(t.listener)?t.listener:t),this._events[e]?o(this._events[e])?this._events[e].push(t):this._events[e]=[this._events[e],t]:this._events[e]=t,o(this._events[e])&&!this._events[e].warned&&(i=s(this._maxListeners)?r.defaultMaxListeners:this._maxListeners,i&&i>0&&this._events[e].length>i&&(this._events[e].warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",this._events[e].length),"function"==typeof console.trace&&console.trace())),this},r.prototype.on=r.prototype.addListener,r.prototype.once=function(e,t){if(!n(t))throw TypeError("listener must be a function");var r=!1;function i(){this.removeListener(e,i),r||(r=!0,t.apply(this,arguments))}return i.listener=t,this.on(e,i),this},r.prototype.removeListener=function(e,t){var r,i,s,a;if(!n(t))throw TypeError("listener must be a function");if(!this._events||!this._events[e])return this;if(r=this._events[e],s=r.length,i=-1,r===t||n(r.listener)&&r.listener===t)delete this._events[e],this._events.removeListener&&this.emit("removeListener",e,t);else if(o(r)){for(a=s;a-- >0;)if(r[a]===t||r[a].listener&&r[a].listener===t){i=a;break}if(i<0)return this;1===r.length?(r.length=0,delete this._events[e]):r.splice(i,1),this._events.removeListener&&this.emit("removeListener",e,t)}return this},r.prototype.removeAllListeners=function(e){var t,r;if(!this._events)return this;if(!this._events.removeListener)return 0===arguments.length?this._events={}:this._events[e]&&delete this._events[e],this;if(0===arguments.length){for(t in this._events)"removeListener"!==t&&this.removeAllListeners(t);return this.removeAllListeners("removeListener"),this._events={},this}if(r=this._events[e],n(r))this.removeListener(e,r);else if(r)for(;r.length;)this.removeListener(e,r[r.length-1]);return delete this._events[e],this},r.prototype.listeners=function(e){var t;return t=this._events&&this._events[e]?n(this._events[e])?[this._events[e]]:this._events[e].slice():[],t},r.prototype.listenerCount=function(e){if(this._events){var t=this._events[e];if(n(t))return 1;if(t)return t.length}return 0},r.listenerCount=function(e,t){return e.listenerCount(t)}},function(e,t){e.exports={options:{usePureJavaScript:!1}}},function(e,t,r){"use strict";(function(t){var n=r(733),i=r(737),o=function(e){if(!e)return null;var t={};return Object.keys(e).forEach(function(r){t[r]=e[r].value}),t};e.exports=function(e,r){if(r||(r={}),!e)throw new Error("Pass in a .proto string or a protobuf-schema parsed object");var s="object"!=typeof e||t.isBuffer(e)?n.parse(e):e,a=function(){var e=this;i(s,r.encodings||{}).forEach(function(t){e[t.name]=o(t.values)||t})};return a.prototype.toString=function(){return n.stringify(s)},a.prototype.toJSON=function(){return s},new a}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(t){
|
||
/*!
|
||
* The buffer module from node.js, for the browser.
|
||
*
|
||
* @author Feross Aboukhadijeh <feross@feross.org> <http://feross.org>
|
||
* @license MIT
|
||
*/
|
||
function n(e,t){if(e===t)return 0;for(var r=e.length,n=t.length,i=0,o=Math.min(r,n);i<o;++i)if(e[i]!==t[i]){r=e[i],n=t[i];break}return r<n?-1:n<r?1:0}function i(e){return t.Buffer&&"function"==typeof t.Buffer.isBuffer?t.Buffer.isBuffer(e):!(null==e||!e._isBuffer)}var o=r(106),s=Object.prototype.hasOwnProperty,a=Array.prototype.slice,u="foo"===function e(){}.name;function c(e){return Object.prototype.toString.call(e)}function f(e){return!i(e)&&("function"==typeof t.ArrayBuffer&&("function"==typeof ArrayBuffer.isView?ArrayBuffer.isView(e):!!e&&(e instanceof DataView||!!(e.buffer&&e.buffer instanceof ArrayBuffer))))}var l=e.exports=b,h=/\s*function\s+([^\(\s]*)\s*/;function p(e){if(o.isFunction(e)){if(u)return e.name;var t=e.toString(),r=t.match(h);return r&&r[1]}}function d(e,t){return"string"==typeof e?e.length<t?e:e.slice(0,t):e}function y(e){if(u||!o.isFunction(e))return o.inspect(e);var t=p(e),r=t?": "+t:"";return"[Function"+r+"]"}function g(e){return d(y(e.actual),128)+" "+e.operator+" "+d(y(e.expected),128)}function m(e,t,r,n,i){throw new l.AssertionError({message:r,actual:e,expected:t,operator:n,stackStartFunction:i})}function b(e,t){e||m(e,!0,t,"==",l.ok)}function v(e,t,r,s){if(e===t)return!0;if(i(e)&&i(t))return 0===n(e,t);if(o.isDate(e)&&o.isDate(t))return e.getTime()===t.getTime();if(o.isRegExp(e)&&o.isRegExp(t))return e.source===t.source&&e.global===t.global&&e.multiline===t.multiline&&e.lastIndex===t.lastIndex&&e.ignoreCase===t.ignoreCase;if(null!==e&&"object"==typeof e||null!==t&&"object"==typeof t){if(f(e)&&f(t)&&c(e)===c(t)&&!(e instanceof Float32Array||e instanceof Float64Array))return 0===n(new Uint8Array(e.buffer),new Uint8Array(t.buffer));if(i(e)!==i(t))return!1;s=s||{actual:[],expected:[]};var a=s.actual.indexOf(e);return-1!==a&&a===s.expected.indexOf(t)||(s.actual.push(e),s.expected.push(t),w(e,t,r,s))}return r?e===t:e==t}function _(e){return"[object Arguments]"==Object.prototype.toString.call(e)}function w(e,t,r,n){if(null===e||void 0===e||null===t||void 0===t)return!1;if(o.isPrimitive(e)||o.isPrimitive(t))return e===t;if(r&&Object.getPrototypeOf(e)!==Object.getPrototypeOf(t))return!1;var i=_(e),s=_(t);if(i&&!s||!i&&s)return!1;if(i)return e=a.call(e),t=a.call(t),v(e,t,r);var u=x(e),c=x(t),f,l;if(u.length!==c.length)return!1;for(u.sort(),c.sort(),l=u.length-1;l>=0;l--)if(u[l]!==c[l])return!1;for(l=u.length-1;l>=0;l--)if(f=u[l],!v(e[f],t[f],r,n))return!1;return!0}function S(e,t,r){v(e,t,!0)&&m(e,t,r,"notDeepStrictEqual",S)}function k(e,t){if(!e||!t)return!1;if("[object RegExp]"==Object.prototype.toString.call(t))return t.test(e);try{if(e instanceof t)return!0}catch(e){}return!Error.isPrototypeOf(t)&&!0===t.call({},e)}function E(e){var t;try{e()}catch(e){t=e}return t}function A(e,t,r,n){var i;if("function"!=typeof t)throw new TypeError('"block" argument must be a function');"string"==typeof r&&(n=r,r=null),i=E(t),n=(r&&r.name?" ("+r.name+").":".")+(n?" "+n:"."),e&&!i&&m(i,r,"Missing expected exception"+n);var s="string"==typeof n,a=!e&&o.isError(i),u=!e&&i&&!r;if((a&&s&&k(i,r)||u)&&m(i,r,"Got unwanted exception"+n),e&&i&&r&&!k(i,r)||!e&&i)throw i}l.AssertionError=function e(t){this.name="AssertionError",this.actual=t.actual,this.expected=t.expected,this.operator=t.operator,t.message?(this.message=t.message,this.generatedMessage=!1):(this.message=g(this),this.generatedMessage=!0);var r=t.stackStartFunction||m;if(Error.captureStackTrace)Error.captureStackTrace(this,r);else{var n=new Error;if(n.stack){var i=n.stack,o=p(r),s=i.indexOf("\n"+o);if(s>=0){var a=i.indexOf("\n",s+1);i=i.substring(a+1)}this.stack=i}}},o.inherits(l.AssertionError,Error),l.fail=m,l.ok=b,l.equal=function e(t,r,n){t!=r&&m(t,r,n,"==",l.equal)},l.notEqual=function e(t,r,n){t==r&&m(t,r,n,"!=",l.notEqual)},l.deepEqual=function e(t,r,n){v(t,r,!1)||m(t,r,n,"deepEqual",l.deepEqual)},l.deepStrictEqual=function e(t,r,n){v(t,r,!0)||m(t,r,n,"deepStrictEqual",l.deepStrictEqual)},l.notDeepEqual=function e(t,r,n){v(t,r,!1)&&m(t,r,n,"notDeepEqual",l.notDeepEqual)},l.notDeepStrictEqual=S,l.strictEqual=function e(t,r,n){t!==r&&m(t,r,n,"===",l.strictEqual)},l.notStrictEqual=function e(t,r,n){t===r&&m(t,r,n,"!==",l.notStrictEqual)},l.throws=function(e,t,r){A(!0,e,t,r)},l.doesNotThrow=function(e,t,r){A(!1,e,t,r)},l.ifError=function(e){if(e)throw e};var x=Object.keys||function(e){var t=[];for(var r in e)s.call(e,r)&&t.push(r);return t}}).call(this,r(7))},function(e,t,r){"use strict";(function(e){const n=r(18),i=r(335);t.names=i.names,t.codes=i.codes,t.defaultLengths=i.defaultLengths;const o=r(23);function s(e){t.decode(e)}t.toHexString=function t(r){if(!e.isBuffer(r))throw new Error("must be passed a buffer");return r.toString("hex")},t.fromHexString=function t(r){return e.from(r,"hex")},t.toB58String=function t(r){if(!e.isBuffer(r))throw new Error("must be passed a buffer");return n.encode(r)},t.fromB58String=function t(r){let i=r;return e.isBuffer(r)&&(i=r.toString()),e.from(n.decode(i))},t.decode=function r(n){if(!e.isBuffer(n))throw new Error("multihash must be a Buffer");if(n.length<3)throw new Error("multihash too short. must be > 3 bytes.");let s=o.decode(n);if(!t.isValidCode(s))throw new Error(`multihash unknown function code: 0x${s.toString(16)}`);n=n.slice(o.decode.bytes);let a=o.decode(n);if(a<1)throw new Error(`multihash invalid length: 0x${a.toString(16)}`);if(n=n.slice(o.decode.bytes),n.length!==a)throw new Error(`multihash length inconsistent: 0x${n.toString("hex")}`);return{code:s,name:i.codes[s],length:a,digest:n}},t.encode=function r(n,i,s){if(!n||!i)throw new Error("multihash encode requires at least two args: digest, code");const a=t.coerceCode(i);if(!e.isBuffer(n))throw new Error("digest should be a Buffer");if(null==s&&(s=n.length),s&&n.length!==s)throw new Error("digest length should be equal to specified length.");return e.concat([e.from(o.encode(a)),e.from(o.encode(s)),n])},t.coerceCode=function e(r){let n=r;if("string"==typeof r){if(!i.names[r])throw new Error(`Unrecognized hash function named: ${r}`);n=i.names[r]}if("number"!=typeof n)throw new Error(`Hash function code should be a number. Got: ${n}`);if(!i.codes[n]&&!t.isAppCode(n))throw new Error(`Unrecognized function code: ${n}`);return n},t.isAppCode=function e(t){return t>0&&t<16},t.isValidCode=function e(r){return!!t.isAppCode(r)||!!i.codes[r]},t.validate=s,t.prefix=function e(t){return s(t),t.slice(0,2)}}).call(this,r(0).Buffer)},function(e,t,r){(function(e,n){var i;
|
||
/**
|
||
* @license
|
||
* lodash 3.10.1 (Custom Build) <https://lodash.com/>
|
||
* Build: `lodash modern -d -o ./index.js`
|
||
* Copyright 2012-2015 The Dojo Foundation <http://dojofoundation.org/>
|
||
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
|
||
* Copyright 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
|
||
* Available under MIT license <https://lodash.com/license>
|
||
*/(function(){var o,s="3.10.1",a=1,u=2,c=4,f=8,l=16,h=32,p=64,d=128,y=256,g=30,m="...",b=150,v=16,_=200,w=1,S=2,k="Expected a function",E="__lodash_placeholder__",A="[object Arguments]",x="[object Array]",I="[object Boolean]",T="[object Date]",B="[object Error]",C="[object Function]",P="[object Map]",O="[object Number]",R="[object Object]",N="[object RegExp]",L="[object Set]",j="[object String]",M="[object WeakMap]",K="[object ArrayBuffer]",D="[object Float32Array]",U="[object Float64Array]",F="[object Int8Array]",q="[object Int16Array]",H="[object Int32Array]",z="[object Uint8Array]",V="[object Uint8ClampedArray]",G="[object Uint16Array]",W="[object Uint32Array]",$=/\b__p \+= '';/g,Y=/\b(__p \+=) '' \+/g,J=/(__e\(.*?\)|\b__t\)) \+\n'';/g,X=/&(?:amp|lt|gt|quot|#39|#96);/g,Z=/[&<>"'`]/g,Q=RegExp(X.source),ee=RegExp(Z.source),te=/<%-([\s\S]+?)%>/g,re=/<%([\s\S]+?)%>/g,ne=/<%=([\s\S]+?)%>/g,ie=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\n\\]|\\.)*?\1)\]/,oe=/^\w*$/,se=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\n\\]|\\.)*?)\2)\]/g,ae=/^[:!,]|[\\^$.*+?()[\]{}|\/]|(^[0-9a-fA-Fnrtuvx])|([\n\r\u2028\u2029])/g,ue=RegExp(ae.source),ce=/[\u0300-\u036f\ufe20-\ufe23]/g,fe=/\\(\\)?/g,le=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,he=/\w*$/,pe=/^0[xX]/,de=/^\[object .+?Constructor\]$/,ye=/^\d+$/,ge=/[\xc0-\xd6\xd8-\xde\xdf-\xf6\xf8-\xff]/g,me=/($^)/,be=/['\n\r\u2028\u2029\\]/g,ve=(_e="[A-Z\\xc0-\\xd6\\xd8-\\xde]",we="[a-z\\xdf-\\xf6\\xf8-\\xff]+",RegExp(_e+"+(?="+_e+we+")|"+_e+"?"+we+"|"+_e+"+|[0-9]+","g")),_e,we,Se=["Array","ArrayBuffer","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Math","Number","Object","RegExp","Set","String","_","clearTimeout","isFinite","parseFloat","parseInt","setTimeout","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap"],ke=-1,Ee={};Ee[D]=Ee[U]=Ee[F]=Ee[q]=Ee[H]=Ee[z]=Ee[V]=Ee[G]=Ee[W]=!0,Ee[A]=Ee[x]=Ee[K]=Ee[I]=Ee[T]=Ee[B]=Ee[C]=Ee[P]=Ee[O]=Ee[R]=Ee[N]=Ee[L]=Ee[j]=Ee[M]=!1;var Ae={};Ae[A]=Ae[x]=Ae[K]=Ae[I]=Ae[T]=Ae[D]=Ae[U]=Ae[F]=Ae[q]=Ae[H]=Ae[O]=Ae[R]=Ae[N]=Ae[j]=Ae[z]=Ae[V]=Ae[G]=Ae[W]=!0,Ae[B]=Ae[C]=Ae[P]=Ae[L]=Ae[M]=!1;var xe={"À":"A","Á":"A","Â":"A","Ã":"A","Ä":"A","Å":"A","à":"a","á":"a","â":"a","ã":"a","ä":"a","å":"a","Ç":"C","ç":"c","Ð":"D","ð":"d","È":"E","É":"E","Ê":"E","Ë":"E","è":"e","é":"e","ê":"e","ë":"e","Ì":"I","Í":"I","Î":"I","Ï":"I","ì":"i","í":"i","î":"i","ï":"i","Ñ":"N","ñ":"n","Ò":"O","Ó":"O","Ô":"O","Õ":"O","Ö":"O","Ø":"O","ò":"o","ó":"o","ô":"o","õ":"o","ö":"o","ø":"o","Ù":"U","Ú":"U","Û":"U","Ü":"U","ù":"u","ú":"u","û":"u","ü":"u","Ý":"Y","ý":"y","ÿ":"y","Æ":"Ae","æ":"ae","Þ":"Th","þ":"th","ß":"ss"},Ie={"&":"&","<":"<",">":">",'"':""","'":"'","`":"`"},Te={"&":"&","<":"<",">":">",""":'"',"'":"'","`":"`"},Be={function:!0,object:!0},Ce={0:"x30",1:"x31",2:"x32",3:"x33",4:"x34",5:"x35",6:"x36",7:"x37",8:"x38",9:"x39",A:"x41",B:"x42",C:"x43",D:"x44",E:"x45",F:"x46",a:"x61",b:"x62",c:"x63",d:"x64",e:"x65",f:"x66",n:"x6e",r:"x72",t:"x74",u:"x75",v:"x76",x:"x78"},Pe={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},Oe=Be[typeof t]&&t&&!t.nodeType&&t,Re=Be[typeof e]&&e&&!e.nodeType&&e,Ne=Oe&&Re&&"object"==typeof n&&n&&n.Object&&n,Le=Be[typeof self]&&self&&self.Object&&self,je=Be[typeof window]&&window&&window.Object&&window,Me=Re&&Re.exports===Oe&&Oe,Ke=Ne||je!==(this&&this.window)&&je||Le||this;function De(e,t){if(e!==t){var r=null===e,n=e===o,i=e==e,s=null===t,a=t===o,u=t==t;if(e>t&&!s||!i||r&&!a&&u||n&&u)return 1;if(e<t&&!r||!u||s&&!n&&i||a&&i)return-1}return 0}function Ue(e,t,r){for(var n=e.length,i=r?n:-1;r?i--:++i<n;)if(t(e[i],i,e))return i;return-1}function Fe(e,t,r){if(t!=t)return Ze(e,r);for(var n=r-1,i=e.length;++n<i;)if(e[n]===t)return n;return-1}function qe(e){return"function"==typeof e||!1}function He(e){return null==e?"":e+""}function ze(e,t){for(var r=-1,n=e.length;++r<n&&t.indexOf(e.charAt(r))>-1;);return r}function Ve(e,t){for(var r=e.length;r--&&t.indexOf(e.charAt(r))>-1;);return r}function Ge(e,t){return De(e.criteria,t.criteria)||e.index-t.index}function We(e,t,r){for(var n=-1,i=e.criteria,o=t.criteria,s=i.length,a=r.length;++n<s;){var u=De(i[n],o[n]);if(u){if(n>=a)return u;var c=r[n];return u*("asc"===c||!0===c?1:-1)}}return e.index-t.index}function $e(e){return xe[e]}function Ye(e){return Ie[e]}function Je(e,t,r){return t?e=Ce[e]:r&&(e=Pe[e]),"\\"+e}function Xe(e){return"\\"+Pe[e]}function Ze(e,t,r){for(var n=e.length,i=t+(r?0:-1);r?i--:++i<n;){var o=e[i];if(o!=o)return i}return-1}function Qe(e){return!!e&&"object"==typeof e}function et(e){return e<=160&&e>=9&&e<=13||32==e||160==e||5760==e||6158==e||e>=8192&&(e<=8202||8232==e||8233==e||8239==e||8287==e||12288==e||65279==e)}function tt(e,t){for(var r=-1,n=e.length,i=-1,o=[];++r<n;)e[r]===t&&(e[r]=E,o[++i]=r);return o}function rt(e,t){for(var r,n=-1,i=e.length,o=-1,s=[];++n<i;){var a=e[n],u=t?t(a,n,e):a;n&&r===u||(r=u,s[++o]=a)}return s}function nt(e){for(var t=-1,r=e.length;++t<r&&et(e.charCodeAt(t)););return t}function it(e){for(var t=e.length;t--&&et(e.charCodeAt(t)););return t}function ot(e){return Te[e]}function st(e){e=e?at.defaults(Ke.Object(),e,at.pick(Ke,Se)):Ke;var t=e.Array,r=e.Date,n=e.Error,i=e.Function,P=e.Math,L=e.Number,M=e.Object,_e=e.RegExp,we=e.String,xe=e.TypeError,Ie=t.prototype,Te=M.prototype,Be=we.prototype,Ce=i.prototype.toString,Pe=Te.hasOwnProperty,Oe=0,Re=Te.toString,Ne=Ke._,Le=_e("^"+Ce.call(Pe).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),je=e.ArrayBuffer,Me=e.clearTimeout,et=e.parseFloat,ut=P.pow,ct=Te.propertyIsEnumerable,ft=$n(e,"Set"),lt=e.setTimeout,ht=Ie.splice,pt=e.Uint8Array,dt=$n(e,"WeakMap"),yt=P.ceil,gt=$n(M,"create"),mt=P.floor,bt=$n(t,"isArray"),vt=e.isFinite,_t=$n(M,"keys"),wt=P.max,St=P.min,kt=$n(r,"now"),Et=e.parseInt,At=P.random,xt=L.NEGATIVE_INFINITY,It=L.POSITIVE_INFINITY,Tt=4294967295,Bt=Tt-1,Ct=Tt>>>1,Pt=9007199254740991,Ot=dt&&new dt,Rt={};function Nt(e){if(Qe(e)&&!bs(e)&&!(e instanceof Kt)){if(e instanceof jt)return e;if(Pe.call(e,"__chain__")&&Pe.call(e,"__wrapped__"))return vi(e)}return new jt(e)}function Lt(){}function jt(e,t,r){this.__wrapped__=e,this.__actions__=r||[],this.__chain__=!!t}var Mt=Nt.support={};function Kt(e){this.__wrapped__=e,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=It,this.__views__=[]}function Dt(){var e=new Kt(this.__wrapped__);return e.__actions__=Xt(this.__actions__),e.__dir__=this.__dir__,e.__filtered__=this.__filtered__,e.__iteratees__=Xt(this.__iteratees__),e.__takeCount__=this.__takeCount__,e.__views__=Xt(this.__views__),e}function Ut(){if(this.__filtered__){var e=new Kt(this);e.__dir__=-1,e.__filtered__=!0}else e=this.clone(),e.__dir__*=-1;return e}function Ft(){var e=this.__wrapped__.value(),t=this.__dir__,r=bs(e),n=t<0,i=r?e.length:0,o=Yn(0,i,this.__views__),s=o.start,a=o.end,u=a-s,c=n?a:s-1,f=this.__iteratees__,l=f.length,h=0,p=St(u,this.__takeCount__);if(!r||i<_||i==u&&p==u)return nn(n&&r?e.reverse():e,this.__actions__);var d=[];e:for(;u--&&h<p;){c+=t;for(var y=-1,g=e[c];++y<l;){var m=f[y],b=m.iteratee,v=m.type,k=b(g);if(v==S)g=k;else if(!k){if(v==w)continue e;break e}}d[h++]=g}return d}function qt(){this.__data__={}}function Ht(e){return this.has(e)&&delete this.__data__[e]}function zt(e){return"__proto__"==e?o:this.__data__[e]}function Vt(e){return"__proto__"!=e&&Pe.call(this.__data__,e)}function Gt(e,t){return"__proto__"!=e&&(this.__data__[e]=t),this}function Wt(e){var t=e?e.length:0;for(this.data={hash:gt(null),set:new ft};t--;)this.push(e[t])}function $t(e,t){var r=e.data,n="string"==typeof t||Is(t)?r.set.has(t):r.hash[t];return n?0:-1}function Yt(e){var t=this.data;"string"==typeof e||Is(e)?t.set.add(e):t.hash[e]=!0}function Jt(e,r){for(var n=-1,i=e.length,o=-1,s=r.length,a=t(i+s);++n<i;)a[n]=e[n];for(;++o<s;)a[n++]=r[o];return a}function Xt(e,r){var n=-1,i=e.length;for(r||(r=t(i));++n<i;)r[n]=e[n];return r}function Zt(e,t){for(var r=-1,n=e.length;++r<n&&!1!==t(e[r],r,e););return e}function Qt(e,t){for(var r=e.length;r--&&!1!==t(e[r],r,e););return e}function er(e,t){for(var r=-1,n=e.length;++r<n;)if(!t(e[r],r,e))return!1;return!0}function tr(e,t,r,n){for(var i=-1,o=e.length,s=n,a=s;++i<o;){var u=e[i],c=+t(u);r(c,s)&&(s=c,a=u)}return a}function rr(e,t){for(var r=-1,n=e.length,i=-1,o=[];++r<n;){var s=e[r];t(s,r,e)&&(o[++i]=s)}return o}function nr(e,r){for(var n=-1,i=e.length,o=t(i);++n<i;)o[n]=r(e[n],n,e);return o}function ir(e,t){for(var r=-1,n=t.length,i=e.length;++r<n;)e[i+r]=t[r];return e}function or(e,t,r,n){var i=-1,o=e.length;for(n&&o&&(r=e[++i]);++i<o;)r=t(r,e[i],i,e);return r}function sr(e,t,r,n){var i=e.length;for(n&&i&&(r=e[--i]);i--;)r=t(r,e[i],i,e);return r}function ar(e,t){for(var r=-1,n=e.length;++r<n;)if(t(e[r],r,e))return!0;return!1}function ur(e,t){for(var r=e.length,n=0;r--;)n+=+t(e[r])||0;return n}function cr(e,t){return e===o?t:e}function fr(e,t,r,n){return e!==o&&Pe.call(n,r)?e:t}function lr(e,t,r){for(var n=-1,i=na(t),s=i.length;++n<s;){var a=i[n],u=e[a],c=r(u,t[a],a,e,t);(c==c?c===u:u!=u)&&(u!==o||a in e)||(e[a]=c)}return e}function hr(e,t){return null==t?e:dr(t,na(t),e)}function pr(e,r){for(var n=-1,i=null==e,s=!i&&ei(e),a=s?e.length:0,u=r.length,c=t(u);++n<u;){var f=r[n];c[n]=s?ti(f,a)?e[f]:o:i?o:e[f]}return c}function dr(e,t,r){r||(r={});for(var n=-1,i=t.length;++n<i;){var o=t[n];r[o]=e[o]}return r}function yr(e,t,r){var n=typeof e;return"function"==n?t===o?e:an(e,t,r):null==e?qa:"object"==n?Dr(e):t===o?Ja(e):Ur(e,t)}function gr(e,t,r,n,i,s,a){var u;if(r&&(u=i?r(e,n,i):r(e)),u!==o)return u;if(!Is(e))return e;var c=bs(e);if(c){if(u=Jn(e),!t)return Xt(e,u)}else{var f=Re.call(e),l=f==C;if(f!=R&&f!=A&&(!l||i))return Ae[f]?Zn(e,f,t):i?e:{};if(u=Xn(l?{}:e),!t)return hr(u,e)}s||(s=[]),a||(a=[]);for(var h=s.length;h--;)if(s[h]==e)return a[h];return s.push(e),a.push(u),(c?Zt:Pr)(e,function(n,i){u[i]=gr(n,t,r,i,e,s,a)}),u}Nt.templateSettings={escape:te,evaluate:re,interpolate:ne,variable:"",imports:{_:Nt}};var mr=function(){function e(){}return function(t){if(Is(t)){e.prototype=t;var r=new e;e.prototype=o}return r||{}}}();function br(e,t,r){if("function"!=typeof e)throw new xe(k);return lt(function(){e.apply(o,r)},t)}function vr(e,t){var r=e?e.length:0,n=[];if(!r)return n;var i=-1,o=Vn(),s=o==Fe,a=s&&t.length>=_?gn(t):null,u=t.length;a&&(o=$t,s=!1,t=a);e:for(;++i<r;){var c=e[i];if(s&&c==c){for(var f=u;f--;)if(t[f]===c)continue e;n.push(c)}else o(t,c,0)<0&&n.push(c)}return n}var _r=pn(Pr),wr=pn(Or,!0);function Sr(e,t){var r=!0;return _r(e,function(e,n,i){return r=!!t(e,n,i),r}),r}function kr(e,t,r,n){var i=n,o=i;return _r(e,function(e,s,a){var u=+t(e,s,a);(r(u,i)||u===n&&u===o)&&(i=u,o=e)}),o}function Er(e,t,r,n){var i=e.length;for(r=null==r?0:+r||0,r<0&&(r=-r>i?0:i+r),n=n===o||n>i?i:+n||0,n<0&&(n+=i),i=r>n?0:n>>>0,r>>>=0;r<i;)e[r++]=t;return e}function Ar(e,t){var r=[];return _r(e,function(e,n,i){t(e,n,i)&&r.push(e)}),r}function xr(e,t,r,n){var i;return r(e,function(e,r,o){if(t(e,r,o))return i=n?r:e,!1}),i}function Ir(e,t,r,n){n||(n=[]);for(var i=-1,o=e.length;++i<o;){var s=e[i];Qe(s)&&ei(s)&&(r||bs(s)||ms(s))?t?Ir(s,t,r,n):ir(n,s):r||(n[n.length]=s)}return n}var Tr=dn(),Br=dn(!0);function Cr(e,t){return Tr(e,t,ia)}function Pr(e,t){return Tr(e,t,na)}function Or(e,t){return Br(e,t,na)}function Rr(e,t){for(var r=-1,n=t.length,i=-1,o=[];++r<n;){var s=t[r];xs(e[s])&&(o[++i]=s)}return o}function Nr(e,t,r){if(null!=e){r!==o&&r in mi(e)&&(t=[r]);for(var n=0,i=t.length;null!=e&&n<i;)e=e[t[n++]];return n&&n==i?e:o}}function Lr(e,t,r,n,i,o){return e===t||(null==e||null==t||!Is(e)&&!Qe(t)?e!=e&&t!=t:jr(e,t,Lr,r,n,i,o))}function jr(e,t,r,n,i,o,s){var a=bs(e),u=bs(t),c=x,f=x;a||(c=Re.call(e),c==A?c=R:c!=R&&(a=js(e))),u||(f=Re.call(t),f==A?f=R:f!=R&&(u=js(t)));var l=c==R,h=f==R,p=c==f;if(p&&!a&&!l)return Un(e,t,c);if(!i){var d=l&&Pe.call(e,"__wrapped__"),y=h&&Pe.call(t,"__wrapped__");if(d||y)return r(d?e.value():e,y?t.value():t,n,i,o,s)}if(!p)return!1;o||(o=[]),s||(s=[]);for(var g=o.length;g--;)if(o[g]==e)return s[g]==t;o.push(e),s.push(t);var m=(a?Dn:Fn)(e,t,r,n,i,o,s);return o.pop(),s.pop(),m}function Mr(e,t,r){var n=t.length,i=n,s=!r;if(null==e)return!i;for(e=mi(e);n--;){var a=t[n];if(s&&a[2]?a[1]!==e[a[0]]:!(a[0]in e))return!1}for(;++n<i;){a=t[n];var u=a[0],c=e[u],f=a[1];if(s&&a[2]){if(c===o&&!(u in e))return!1}else{var l=r?r(c,f,u):o;if(!(l===o?Lr(f,c,r,!0):l))return!1}}return!0}function Kr(e,r){var n=-1,i=ei(e)?t(e.length):[];return _r(e,function(e,t,o){i[++n]=r(e,t,o)}),i}function Dr(e){var t=Wn(e);if(1==t.length&&t[0][2]){var r=t[0][0],n=t[0][1];return function(e){return null!=e&&(e[r]===n&&(n!==o||r in mi(e)))}}return function(e){return Mr(e,t)}}function Ur(e,t){var r=bs(e),n=ni(e)&&si(t),i=e+"";return e=bi(e),function(s){if(null==s)return!1;var a=i;if(s=mi(s),(r||!n)&&!(a in s)){if(s=1==e.length?s:Nr(s,Yr(e,0,-1)),null==s)return!1;a=ji(e),s=mi(s)}return s[a]===t?t!==o||a in s:Lr(t,s[a],o,!0)}}function Fr(e,t,r,n,i){if(!Is(e))return e;var s=ei(t)&&(bs(t)||js(t)),a=s?o:na(t);return Zt(a||t,function(u,c){if(a&&(c=u,u=t[c]),Qe(u))n||(n=[]),i||(i=[]),qr(e,t,c,Fr,r,n,i);else{var f=e[c],l=r?r(f,u,c,e,t):o,h=l===o;h&&(l=u),l===o&&(!s||c in e)||!h&&(l==l?l===f:f!=f)||(e[c]=l)}}),e}function qr(e,t,r,n,i,s,a){for(var u=s.length,c=t[r];u--;)if(s[u]==c)return void(e[r]=a[u]);var f=e[r],l=i?i(f,c,r,e,t):o,h=l===o;h&&(l=c,ei(c)&&(bs(c)||js(c))?l=bs(f)?f:ei(f)?Xt(f):[]:Rs(c)||ms(c)?l=ms(f)?Fs(f):Rs(f)?f:{}:h=!1),s.push(c),a.push(l),h?e[r]=n(l,c,i,s,a):(l==l?l!==f:f==f)&&(e[r]=l)}function Hr(e){return function(t){return null==t?o:t[e]}}function zr(e){var t=e+"";return e=bi(e),function(r){return Nr(r,e,t)}}function Vr(e,t){for(var r=e?t.length:0;r--;){var n=t[r];if(n!=i&&ti(n)){var i=n;ht.call(e,n,1)}}return e}function Gr(e,t){return e+mt(At()*(t-e+1))}function Wr(e,t,r,n,i){return i(e,function(e,i,o){r=n?(n=!1,e):t(r,e,i,o)}),r}var $r=Ot?function(e,t){return Ot.set(e,t),e}:qa;function Yr(e,r,n){var i=-1,s=e.length;r=null==r?0:+r||0,r<0&&(r=-r>s?0:s+r),n=n===o||n>s?s:+n||0,n<0&&(n+=s),s=r>n?0:n-r>>>0,r>>>=0;for(var a=t(s);++i<s;)a[i]=e[i+r];return a}function Jr(e,t){var r;return _r(e,function(e,n,i){return r=t(e,n,i),!r}),!!r}function Xr(e,t){var r=e.length;for(e.sort(t);r--;)e[r]=e[r].value;return e}function Zr(e,t,r){var n=qn(),i=-1;t=nr(t,function(e){return n(e)});var o=Kr(e,function(e){var r=nr(t,function(t){return t(e)});return{criteria:r,index:++i,value:e}});return Xr(o,function(e,t){return We(e,t,r)})}function Qr(e,t){var r=0;return _r(e,function(e,n,i){r+=+t(e,n,i)||0}),r}function en(e,t){var r=-1,n=Vn(),i=e.length,o=n==Fe,s=o&&i>=_,a=s?gn():null,u=[];a?(n=$t,o=!1):(s=!1,a=t?[]:u);e:for(;++r<i;){var c=e[r],f=t?t(c,r,e):c;if(o&&c==c){for(var l=a.length;l--;)if(a[l]===f)continue e;t&&a.push(f),u.push(c)}else n(a,f,0)<0&&((t||s)&&a.push(f),u.push(c))}return u}function tn(e,r){for(var n=-1,i=r.length,o=t(i);++n<i;)o[n]=e[r[n]];return o}function rn(e,t,r,n){for(var i=e.length,o=n?i:-1;(n?o--:++o<i)&&t(e[o],o,e););return r?Yr(e,n?0:o,n?o+1:i):Yr(e,n?o+1:0,n?i:o)}function nn(e,t){var r=e;r instanceof Kt&&(r=r.value());for(var n=-1,i=t.length;++n<i;){var o=t[n];r=o.func.apply(o.thisArg,ir([r],o.args))}return r}function on(e,t,r){var n=0,i=e?e.length:n;if("number"==typeof t&&t==t&&i<=Ct){for(;n<i;){var o=n+i>>>1,s=e[o];(r?s<=t:s<t)&&null!==s?n=o+1:i=o}return i}return sn(e,t,qa,r)}function sn(e,t,r,n){t=r(t);for(var i=0,s=e?e.length:0,a=t!=t,u=null===t,c=t===o;i<s;){var f=mt((i+s)/2),l=r(e[f]),h=l!==o,p=l==l;if(a)var d=p||n;else d=u?p&&h&&(n||null!=l):c?p&&(n||h):null!=l&&(n?l<=t:l<t);d?i=f+1:s=f}return St(s,Bt)}function an(e,t,r){if("function"!=typeof e)return qa;if(t===o)return e;switch(r){case 1:return function(r){return e.call(t,r)};case 3:return function(r,n,i){return e.call(t,r,n,i)};case 4:return function(r,n,i,o){return e.call(t,r,n,i,o)};case 5:return function(r,n,i,o,s){return e.call(t,r,n,i,o,s)}}return function(){return e.apply(t,arguments)}}function un(e){var t=new je(e.byteLength),r=new pt(t);return r.set(new pt(e)),t}function cn(e,r,n){for(var i=n.length,o=-1,s=wt(e.length-i,0),a=-1,u=r.length,c=t(u+s);++a<u;)c[a]=r[a];for(;++o<i;)c[n[o]]=e[o];for(;s--;)c[a++]=e[o++];return c}function fn(e,r,n){for(var i=-1,o=n.length,s=-1,a=wt(e.length-o,0),u=-1,c=r.length,f=t(a+c);++s<a;)f[s]=e[s];for(var l=s;++u<c;)f[l+u]=r[u];for(;++i<o;)f[l+n[i]]=e[s++];return f}function ln(e,t){return function(r,n,i){var o=t?t():{};if(n=qn(n,i,3),bs(r))for(var s=-1,a=r.length;++s<a;){var u=r[s];e(o,u,n(u,s,r),r)}else _r(r,function(t,r,i){e(o,t,n(t,r,i),i)});return o}}function hn(e){return cs(function(t,r){var n=-1,i=null==t?0:r.length,s=i>2?r[i-2]:o,a=i>2?r[2]:o,u=i>1?r[i-1]:o;for("function"==typeof s?(s=an(s,u,5),i-=2):(s="function"==typeof u?u:o,i-=s?1:0),a&&ri(r[0],r[1],a)&&(s=i<3?o:s,i=1);++n<i;){var c=r[n];c&&e(t,c,s)}return t})}function pn(e,t){return function(r,n){var i=r?Gn(r):0;if(!oi(i))return e(r,n);for(var o=t?i:-1,s=mi(r);(t?o--:++o<i)&&!1!==n(s[o],o,s););return r}}function dn(e){return function(t,r,n){for(var i=mi(t),o=n(t),s=o.length,a=e?s:-1;e?a--:++a<s;){var u=o[a];if(!1===r(i[u],u,i))break}return t}}function yn(e,t){var r=bn(e);function n(){var i=this&&this!==Ke&&this instanceof n?r:e;return i.apply(t,arguments)}return n}function gn(e){return gt&&ft?new Wt(e):null}function mn(e){return function(t){for(var r=-1,n=Ka(va(t)),i=n.length,o="";++r<i;)o=e(o,n[r],r);return o}}function bn(e){return function(){var t=arguments;switch(t.length){case 0:return new e;case 1:return new e(t[0]);case 2:return new e(t[0],t[1]);case 3:return new e(t[0],t[1],t[2]);case 4:return new e(t[0],t[1],t[2],t[3]);case 5:return new e(t[0],t[1],t[2],t[3],t[4]);case 6:return new e(t[0],t[1],t[2],t[3],t[4],t[5]);case 7:return new e(t[0],t[1],t[2],t[3],t[4],t[5],t[6])}var r=mr(e.prototype),n=e.apply(r,t);return Is(n)?n:r}}function vn(e){function t(r,n,i){i&&ri(r,n,i)&&(n=o);var s=Kn(r,e,o,o,o,o,o,n);return s.placeholder=t.placeholder,s}return t}function _n(e,t){return cs(function(r){var n=r[0];return null==n?n:(r.push(t),e.apply(o,r))})}function wn(e,t){return function(r,n,i){if(i&&ri(r,n,i)&&(n=o),n=qn(n,i,3),1==n.length){r=bs(r)?r:gi(r);var s=tr(r,n,e,t);if(!r.length||s!==t)return s}return kr(r,n,e,t)}}function Sn(e,t){return function(r,n,i){if(n=qn(n,i,3),bs(r)){var s=Ue(r,n,t);return s>-1?r[s]:o}return xr(r,n,e)}}function kn(e){return function(t,r,n){return t&&t.length?(r=qn(r,n,3),Ue(t,r,e)):-1}}function En(e){return function(t,r,n){return r=qn(r,n,3),xr(t,r,e,!0)}}function An(e){return function(){for(var r,n=arguments.length,i=e?n:-1,s=0,a=t(n);e?i--:++i<n;){var u=a[s++]=arguments[i];if("function"!=typeof u)throw new xe(k);!r&&jt.prototype.thru&&"wrapper"==zn(u)&&(r=new jt([],!0))}for(i=r?-1:n;++i<n;){u=a[i];var c=zn(u),l="wrapper"==c?Hn(u):o;r=l&&ii(l[0])&&l[1]==(d|f|h|y)&&!l[4].length&&1==l[9]?r[zn(l[0])].apply(r,l[3]):1==u.length&&ii(u)?r[c]():r.thru(u)}return function(){var e=arguments,t=e[0];if(r&&1==e.length&&bs(t)&&t.length>=_)return r.plant(t).value();for(var i=0,o=n?a[i].apply(this,e):t;++i<n;)o=a[i].call(this,o);return o}}}function xn(e,t){return function(r,n,i){return"function"==typeof n&&i===o&&bs(r)?e(r,n):t(r,an(n,i,3))}}function In(e){return function(t,r,n){return"function"==typeof r&&n===o||(r=an(r,n,3)),e(t,r,ia)}}function Tn(e){return function(t,r,n){return"function"==typeof r&&n===o||(r=an(r,n,3)),e(t,r)}}function Bn(e){return function(t,r,n){var i={};return r=qn(r,n,3),Pr(t,function(t,n,o){var s=r(t,n,o);n=e?s:n,t=e?t:s,i[n]=t}),i}}function Cn(e){return function(t,r,n){return t=He(t),(e?t:"")+Nn(t,r,n)+(e?"":t)}}function Pn(e){var t=cs(function(r,n){var i=tt(n,t.placeholder);return Kn(r,e,o,n,i)});return t}function On(e,t){return function(r,n,i,s){var a=arguments.length<3;return"function"==typeof n&&s===o&&bs(r)?e(r,n,i,a):Wr(r,qn(n,s,4),i,a,t)}}function Rn(e,r,n,i,s,y,g,m,b,v){var _=r&d,w=r&a,S=r&u,k=r&f,E=r&c,A=r&l,x=S?o:bn(e);function I(){for(var c=arguments.length,f=c,l=t(c);f--;)l[f]=arguments[f];if(i&&(l=cn(l,i,s)),y&&(l=fn(l,y,g)),k||A){var d=I.placeholder,T=tt(l,d);if(c-=T.length,c<v){var B=m?Xt(m):o,C=wt(v-c,0),P=k?T:o,O=k?o:T,R=k?l:o,N=k?o:l;r|=k?h:p,r&=~(k?p:h),E||(r&=~(a|u));var L=[e,r,n,R,P,N,O,B,b,C],j=Rn.apply(o,L);return ii(e)&&hi(j,L),j.placeholder=d,j}}var M=w?n:this,K=S?M[e]:e;return m&&(l=li(l,m)),_&&b<l.length&&(l.length=b),this&&this!==Ke&&this instanceof I&&(K=x||bn(e)),K.apply(M,l)}return I}function Nn(e,t,r){var n=e.length;if(t=+t,n>=t||!vt(t))return"";var i=t-n;return r=null==r?" ":r+"",Ta(r,yt(i/r.length)).slice(0,i)}function Ln(e,r,n,i){var o=r&a,s=bn(e);function u(){for(var r=-1,a=arguments.length,c=-1,f=i.length,l=t(f+a);++c<f;)l[c]=i[c];for(;a--;)l[c++]=arguments[++r];var h=this&&this!==Ke&&this instanceof u?s:e;return h.apply(o?n:this,l)}return u}function jn(e){var t=P[e];return function(e,r){return r=r===o?0:+r||0,r?(r=ut(10,r),t(e*r)/r):t(e)}}function Mn(e){return function(t,r,n,i){var o=qn(n);return null==n&&o===yr?on(t,r,e):sn(t,r,o(n,i,1),e)}}function Kn(e,t,r,n,i,s,c,f){var l=t&u;if(!l&&"function"!=typeof e)throw new xe(k);var d=n?n.length:0;if(d||(t&=~(h|p),n=i=o),d-=i?i.length:0,t&p){var y=n,g=i;n=i=o}var m=l?o:Hn(e),b=[e,t,r,n,i,y,g,s,c,f];if(m&&(ai(b,m),t=b[1],f=b[9]),b[9]=null==f?l?0:e.length:wt(f-d,0)||0,t==a)var v=yn(b[0],b[2]);else v=t!=h&&t!=(a|h)||b[4].length?Rn.apply(o,b):Ln.apply(o,b);var _=m?$r:hi;return _(v,b)}function Dn(e,t,r,n,i,s,a){var u=-1,c=e.length,f=t.length;if(c!=f&&!(i&&f>c))return!1;for(;++u<c;){var l=e[u],h=t[u],p=n?n(i?h:l,i?l:h,u):o;if(p!==o){if(p)continue;return!1}if(i){if(!ar(t,function(e){return l===e||r(l,e,n,i,s,a)}))return!1}else if(l!==h&&!r(l,h,n,i,s,a))return!1}return!0}function Un(e,t,r){switch(r){case I:case T:return+e==+t;case B:return e.name==t.name&&e.message==t.message;case O:return e!=+e?t!=+t:e==+t;case N:case j:return e==t+""}return!1}function Fn(e,t,r,n,i,s,a){var u=na(e),c=u.length,f=na(t),l=f.length;if(c!=l&&!i)return!1;for(var h=c;h--;){var p=u[h];if(!(i?p in t:Pe.call(t,p)))return!1}for(var d=i;++h<c;){p=u[h];var y=e[p],g=t[p],m=n?n(i?g:y,i?y:g,p):o;if(!(m===o?r(y,g,n,i,s,a):m))return!1;d||(d="constructor"==p)}if(!d){var b=e.constructor,v=t.constructor;if(b!=v&&"constructor"in e&&"constructor"in t&&!("function"==typeof b&&b instanceof b&&"function"==typeof v&&v instanceof v))return!1}return!0}function qn(e,t,r){var n=Nt.callback||Ua;return n=n===Ua?yr:n,r?n(e,t,r):n}var Hn=Ot?function(e){return Ot.get(e)}:Ya;function zn(e){for(var t=e.name,r=Rt[t],n=r?r.length:0;n--;){var i=r[n],o=i.func;if(null==o||o==e)return i.name}return t}function Vn(e,t,r){var n=Nt.indexOf||Ri;return n=n===Ri?Fe:n,e?n(e,t,r):n}var Gn=Hr("length");function Wn(e){for(var t=ua(e),r=t.length;r--;)t[r][2]=si(t[r][1]);return t}function $n(e,t){var r=null==e?o:e[t];return Cs(r)?r:o}function Yn(e,t,r){for(var n=-1,i=r.length;++n<i;){var o=r[n],s=o.size;switch(o.type){case"drop":e+=s;break;case"dropRight":t-=s;break;case"take":t=St(t,e+s);break;case"takeRight":e=wt(e,t-s)}}return{start:e,end:t}}function Jn(e){var t=e.length,r=new e.constructor(t);return t&&"string"==typeof e[0]&&Pe.call(e,"index")&&(r.index=e.index,r.input=e.input),r}function Xn(e){var t=e.constructor;return"function"==typeof t&&t instanceof t||(t=M),new t}function Zn(e,t,r){var n=e.constructor;switch(t){case K:return un(e);case I:case T:return new n(+e);case D:case U:case F:case q:case H:case z:case V:case G:case W:var i=e.buffer;return new n(r?un(i):i,e.byteOffset,e.length);case O:case j:return new n(e);case N:var o=new n(e.source,he.exec(e));o.lastIndex=e.lastIndex}return o}function Qn(e,t,r){null==e||ni(t,e)||(t=bi(t),e=1==t.length?e:Nr(e,Yr(t,0,-1)),t=ji(t));var n=null==e?e:e[t];return null==n?o:n.apply(e,r)}function ei(e){return null!=e&&oi(Gn(e))}function ti(e,t){return e="number"==typeof e||ye.test(e)?+e:-1,t=null==t?Pt:t,e>-1&&e%1==0&&e<t}function ri(e,t,r){if(!Is(r))return!1;var n=typeof t;if("number"==n?ei(r)&&ti(t,r.length):"string"==n&&t in r){var i=r[t];return e==e?e===i:i!=i}return!1}function ni(e,t){var r=typeof e;if("string"==r&&oe.test(e)||"number"==r)return!0;if(bs(e))return!1;var n=!ie.test(e);return n||null!=t&&e in mi(t)}function ii(e){var t=zn(e);if(!(t in Kt.prototype))return!1;var r=Nt[t];if(e===r)return!0;var n=Hn(r);return!!n&&e===n[0]}function oi(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=Pt}function si(e){return e==e&&!Is(e)}function ai(e,t){var r=e[1],n=t[1],i=r|n,o=i<d,s=n==d&&r==f||n==d&&r==y&&e[7].length<=t[8]||n==(d|y)&&r==f;if(!o&&!s)return e;n&a&&(e[2]=t[2],i|=r&a?0:c);var u=t[3];if(u){var l=e[3];e[3]=l?cn(l,u,t[4]):Xt(u),e[4]=l?tt(e[3],E):Xt(t[4])}return u=t[5],u&&(l=e[5],e[5]=l?fn(l,u,t[6]):Xt(u),e[6]=l?tt(e[5],E):Xt(t[6])),u=t[7],u&&(e[7]=Xt(u)),n&d&&(e[8]=null==e[8]?t[8]:St(e[8],t[8])),null==e[9]&&(e[9]=t[9]),e[0]=t[0],e[1]=i,e}function ui(e,t){return e===o?t:qs(e,t,ui)}function ci(e,t){e=mi(e);for(var r=-1,n=t.length,i={};++r<n;){var o=t[r];o in e&&(i[o]=e[o])}return i}function fi(e,t){var r={};return Cr(e,function(e,n,i){t(e,n,i)&&(r[n]=e)}),r}function li(e,t){for(var r=e.length,n=St(t.length,r),i=Xt(e);n--;){var s=t[n];e[n]=ti(s,r)?i[s]:o}return e}var hi=(pi=0,di=0,function(e,t){var r=qo(),n=v-(r-di);if(di=r,n>0){if(++pi>=b)return e}else pi=0;return $r(e,t)}),pi,di;function yi(e){for(var t=ia(e),r=t.length,n=r&&e.length,i=!!n&&oi(n)&&(bs(e)||ms(e)),o=-1,s=[];++o<r;){var a=t[o];(i&&ti(a,n)||Pe.call(e,a))&&s.push(a)}return s}function gi(e){return null==e?[]:ei(e)?Is(e)?e:M(e):pa(e)}function mi(e){return Is(e)?e:M(e)}function bi(e){if(bs(e))return e;var t=[];return He(e).replace(se,function(e,r,n,i){t.push(n?i.replace(fe,"$1"):r||e)}),t}function vi(e){return e instanceof Kt?e.clone():new jt(e.__wrapped__,e.__chain__,Xt(e.__actions__))}function _i(e,r,n){r=(n?ri(e,r,n):null==r)?1:wt(mt(r)||1,1);for(var i=0,o=e?e.length:0,s=-1,a=t(yt(o/r));i<o;)a[++s]=Yr(e,i,i+=r);return a}function wi(e){for(var t=-1,r=e?e.length:0,n=-1,i=[];++t<r;){var o=e[t];o&&(i[++n]=o)}return i}var Si=cs(function(e,t){return Qe(e)&&ei(e)?vr(e,Ir(t,!1,!0)):[]});function ki(e,t,r){var n=e?e.length:0;return n?((r?ri(e,t,r):null==t)&&(t=1),Yr(e,t<0?0:t)):[]}function Ei(e,t,r){var n=e?e.length:0;return n?((r?ri(e,t,r):null==t)&&(t=1),t=n-(+t||0),Yr(e,0,t<0?0:t)):[]}function Ai(e,t,r){return e&&e.length?rn(e,qn(t,r,3),!0,!0):[]}function xi(e,t,r){return e&&e.length?rn(e,qn(t,r,3),!0):[]}function Ii(e,t,r,n){var i=e?e.length:0;return i?(r&&"number"!=typeof r&&ri(e,t,r)&&(r=0,n=i),Er(e,t,r,n)):[]}var Ti=kn(),Bi=kn(!0);function Ci(e){return e?e[0]:o}function Pi(e,t,r){var n=e?e.length:0;return r&&ri(e,t,r)&&(t=!1),n?Ir(e,t):[]}function Oi(e){var t=e?e.length:0;return t?Ir(e,!0):[]}function Ri(e,t,r){var n=e?e.length:0;if(!n)return-1;if("number"==typeof r)r=r<0?wt(n+r,0):r;else if(r){var i=on(e,t);return i<n&&(t==t?t===e[i]:e[i]!=e[i])?i:-1}return Fe(e,t,r||0)}function Ni(e){return Ei(e,1)}var Li=cs(function(e){for(var r=e.length,n=r,i=t(l),o=Vn(),s=o==Fe,a=[];n--;){var u=e[n]=ei(u=e[n])?u:[];i[n]=s&&u.length>=120?gn(n&&u):null}var c=e[0],f=-1,l=c?c.length:0,h=i[0];e:for(;++f<l;)if(u=c[f],(h?$t(h,u):o(a,u,0))<0){for(var n=r;--n;){var p=i[n];if((p?$t(p,u):o(e[n],u,0))<0)continue e}h&&h.push(u),a.push(u)}return a});function ji(e){var t=e?e.length:0;return t?e[t-1]:o}function Mi(e,t,r){var n=e?e.length:0;if(!n)return-1;var i=n;if("number"==typeof r)i=(r<0?wt(n+r,0):St(r||0,n-1))+1;else if(r){i=on(e,t,!0)-1;var o=e[i];return(t==t?t===o:o!=o)?i:-1}if(t!=t)return Ze(e,i,!0);for(;i--;)if(e[i]===t)return i;return-1}function Ki(){var e=arguments,t=e[0];if(!t||!t.length)return t;for(var r=0,n=Vn(),i=e.length;++r<i;)for(var o=0,s=e[r];(o=n(t,s,o))>-1;)ht.call(t,o,1);return t}var Di=cs(function(e,t){t=Ir(t);var r=pr(e,t);return Vr(e,t.sort(De)),r});function Ui(e,t,r){var n=[];if(!e||!e.length)return n;var i=-1,o=[],s=e.length;for(t=qn(t,r,3);++i<s;){var a=e[i];t(a,i,e)&&(n.push(a),o.push(i))}return Vr(e,o),n}function Fi(e){return ki(e,1)}function qi(e,t,r){var n=e?e.length:0;return n?(r&&"number"!=typeof r&&ri(e,t,r)&&(t=0,r=n),Yr(e,t,r)):[]}var Hi=Mn(),zi=Mn(!0);function Vi(e,t,r){var n=e?e.length:0;return n?((r?ri(e,t,r):null==t)&&(t=1),Yr(e,0,t<0?0:t)):[]}function Gi(e,t,r){var n=e?e.length:0;return n?((r?ri(e,t,r):null==t)&&(t=1),t=n-(+t||0),Yr(e,t<0?0:t)):[]}function Wi(e,t,r){return e&&e.length?rn(e,qn(t,r,3),!1,!0):[]}function $i(e,t,r){return e&&e.length?rn(e,qn(t,r,3)):[]}var Yi=cs(function(e){return en(Ir(e,!1,!0))});function Ji(e,t,r,n){var i=e?e.length:0;if(!i)return[];null!=t&&"boolean"!=typeof t&&(n=r,r=ri(e,t,n)?o:t,t=!1);var s=qn();return null==r&&s===yr||(r=s(r,n,3)),t&&Vn()==Fe?rt(e,r):en(e,r)}function Xi(e){if(!e||!e.length)return[];var r=-1,n=0;e=rr(e,function(e){if(ei(e))return n=wt(e.length,n),!0});for(var i=t(n);++r<n;)i[r]=nr(e,Hr(r));return i}function Zi(e,t,r){var n=e?e.length:0;if(!n)return[];var i=Xi(e);return null==t?i:(t=an(t,r,4),nr(i,function(e){return or(e,t,o,!0)}))}var Qi=cs(function(e,t){return ei(e)?vr(e,t):[]});function eo(){for(var e=-1,t=arguments.length;++e<t;){var r=arguments[e];if(ei(r))var n=n?ir(vr(n,r),vr(r,n)):r}return n?en(n):[]}var to=cs(Xi);function ro(e,t){var r=-1,n=e?e.length:0,i={};for(!n||t||bs(e[0])||(t=[]);++r<n;){var o=e[r];t?i[o]=t[r]:o&&(i[o[0]]=o[1])}return i}var no=cs(function(e){var t=e.length,r=t>2?e[t-2]:o,n=t>1?e[t-1]:o;return t>2&&"function"==typeof r?t-=2:(r=t>1&&"function"==typeof n?(--t,n):o,n=o),e.length=t,Zi(e,r,n)});function io(e){var t=Nt(e);return t.__chain__=!0,t}function oo(e,t,r){return t.call(r,e),e}function so(e,t,r){return t.call(r,e)}function ao(){return io(this)}function uo(){return new jt(this.value(),this.__chain__)}var co=cs(function(e){return e=Ir(e),this.thru(function(t){return Jt(bs(t)?t:[mi(t)],e)})});function fo(e){for(var t,r=this;r instanceof Lt;){var n=vi(r);t?i.__wrapped__=n:t=n;var i=n;r=r.__wrapped__}return i.__wrapped__=e,t}function lo(){var e=this.__wrapped__,t=function(e){return r&&r.__dir__<0?e:e.reverse()};if(e instanceof Kt){var r=e;return this.__actions__.length&&(r=new Kt(this)),r=r.reverse(),r.__actions__.push({func:so,args:[t],thisArg:o}),new jt(r,this.__chain__)}return this.thru(t)}function ho(){return this.value()+""}function po(){return nn(this.__wrapped__,this.__actions__)}var yo=cs(function(e,t){return pr(e,Ir(t))}),go=ln(function(e,t,r){Pe.call(e,r)?++e[r]:e[r]=1});function mo(e,t,r){var n=bs(e)?er:Sr;return r&&ri(e,t,r)&&(t=o),"function"==typeof t&&r===o||(t=qn(t,r,3)),n(e,t)}function bo(e,t,r){var n=bs(e)?rr:Ar;return t=qn(t,r,3),n(e,t)}var vo=Sn(_r),_o=Sn(wr,!0);function wo(e,t){return vo(e,Dr(t))}var So=xn(Zt,_r),ko=xn(Qt,wr),Eo=ln(function(e,t,r){Pe.call(e,r)?e[r].push(t):e[r]=[t]});function Ao(e,t,r,n){var i=e?Gn(e):0;return oi(i)||(e=pa(e),i=e.length),r="number"!=typeof r||n&&ri(t,r,n)?0:r<0?wt(i+r,0):r||0,"string"==typeof e||!bs(e)&&Ls(e)?r<=i&&e.indexOf(t,r)>-1:!!i&&Vn(e,t,r)>-1}var xo=ln(function(e,t,r){e[r]=t}),Io=cs(function(e,r,n){var i=-1,s="function"==typeof r,a=ni(r),u=ei(e)?t(e.length):[];return _r(e,function(e){var t=s?r:a&&null!=e?e[r]:o;u[++i]=t?t.apply(e,n):Qn(e,r,n)}),u});function To(e,t,r){var n=bs(e)?nr:Kr;return t=qn(t,r,3),n(e,t)}var Bo=ln(function(e,t,r){e[r?0:1].push(t)},function(){return[[],[]]});function Co(e,t){return To(e,Ja(t))}var Po=On(or,_r),Oo=On(sr,wr);function Ro(e,t,r){var n=bs(e)?rr:Ar;return t=qn(t,r,3),n(e,function(e,r,n){return!t(e,r,n)})}function No(e,t,r){if(r?ri(e,t,r):null==t){e=gi(e);var n=e.length;return n>0?e[Gr(0,n-1)]:o}var i=-1,s=Us(e),n=s.length,a=n-1;for(t=St(t<0?0:+t||0,n);++i<t;){var u=Gr(i,a),c=s[u];s[u]=s[i],s[i]=c}return s.length=t,s}function Lo(e){return No(e,It)}function jo(e){var t=e?Gn(e):0;return oi(t)?t:na(e).length}function Mo(e,t,r){var n=bs(e)?ar:Jr;return r&&ri(e,t,r)&&(t=o),"function"==typeof t&&r===o||(t=qn(t,r,3)),n(e,t)}function Ko(e,t,r){if(null==e)return[];r&&ri(e,t,r)&&(t=o);var n=-1;t=qn(t,r,3);var i=Kr(e,function(e,r,i){return{criteria:t(e,r,i),index:++n,value:e}});return Xr(i,Ge)}var Do=cs(function(e,t){if(null==e)return[];var r=t[2];return r&&ri(t[0],t[1],r)&&(t.length=1),Zr(e,Ir(t),[])});function Uo(e,t,r,n){return null==e?[]:(n&&ri(t,r,n)&&(r=o),bs(t)||(t=null==t?[]:[t]),bs(r)||(r=null==r?[]:[r]),Zr(e,t,r))}function Fo(e,t){return bo(e,Dr(t))}var qo=kt||function(){return(new r).getTime()};function Ho(e,t){if("function"!=typeof t){if("function"!=typeof e)throw new xe(k);var r=e;e=t,t=r}return e=vt(e=+e)?e:0,function(){if(--e<1)return t.apply(this,arguments)}}function zo(e,t,r){return r&&ri(e,t,r)&&(t=o),t=e&&null==t?e.length:wt(+t||0,0),Kn(e,d,o,o,o,o,t)}function Vo(e,t){var r;if("function"!=typeof t){if("function"!=typeof e)throw new xe(k);var n=e;e=t,t=n}return function(){return--e>0&&(r=t.apply(this,arguments)),e<=1&&(t=o),r}}var Go=cs(function(e,t,r){var n=a;if(r.length){var i=tt(r,Go.placeholder);n|=h}return Kn(e,n,t,r,i)}),Wo=cs(function(e,t){t=t.length?Ir(t):Qs(e);for(var r=-1,n=t.length;++r<n;){var i=t[r];e[i]=Kn(e[i],a,e)}return e}),$o=cs(function(e,t,r){var n=a|u;if(r.length){var i=tt(r,$o.placeholder);n|=h}return Kn(t,n,e,r,i)}),Yo=vn(f),Jo=vn(l);function Xo(e,t,r){var n,i,s,a,u,c,f,l=0,h=!1,p=!0;if("function"!=typeof e)throw new xe(k);if(t=t<0?0:+t||0,!0===r){var d=!0;p=!1}else Is(r)&&(d=!!r.leading,h="maxWait"in r&&wt(+r.maxWait||0,t),p="trailing"in r?!!r.trailing:p);function y(){c&&Me(c),i&&Me(i),l=0,i=c=f=o}function g(t,r){r&&Me(r),i=c=f=o,t&&(l=qo(),s=e.apply(u,n),c||i||(n=u=o))}function m(){var e=t-(qo()-a);e<=0||e>t?g(f,i):c=lt(m,e)}function b(){g(p,c)}function v(){if(n=arguments,a=qo(),u=this,f=p&&(c||!d),!1===h)var r=d&&!c;else{i||d||(l=a);var y=h-(a-l),g=y<=0||y>h;g?(i&&(i=Me(i)),l=a,s=e.apply(u,n)):i||(i=lt(b,y))}return g&&c?c=Me(c):c||t===h||(c=lt(m,t)),r&&(g=!0,s=e.apply(u,n)),!g||c||i||(n=u=o),s}return v.cancel=y,v}var Zo=cs(function(e,t){return br(e,1,t)}),Qo=cs(function(e,t,r){return br(e,t,r)}),es=An(),ts=An(!0);function rs(e,t){if("function"!=typeof e||t&&"function"!=typeof t)throw new xe(k);var r=function(){var n=arguments,i=t?t.apply(this,n):n[0],o=r.cache;if(o.has(i))return o.get(i);var s=e.apply(this,n);return r.cache=o.set(i,s),s};return r.cache=new rs.Cache,r}var ns=cs(function(e,t){if(t=Ir(t),"function"!=typeof e||!er(t,qe))throw new xe(k);var r=t.length;return cs(function(n){for(var i=St(n.length,r);i--;)n[i]=t[i](n[i]);return e.apply(this,n)})});function is(e){if("function"!=typeof e)throw new xe(k);return function(){return!e.apply(this,arguments)}}function os(e){return Vo(2,e)}var ss=Pn(h),as=Pn(p),us=cs(function(e,t){return Kn(e,y,o,o,o,Ir(t))});function cs(e,r){if("function"!=typeof e)throw new xe(k);return r=wt(r===o?e.length-1:+r||0,0),function(){for(var n=arguments,i=-1,o=wt(n.length-r,0),s=t(o);++i<o;)s[i]=n[r+i];switch(r){case 0:return e.call(this,s);case 1:return e.call(this,n[0],s);case 2:return e.call(this,n[0],n[1],s)}var a=t(r+1);for(i=-1;++i<r;)a[i]=n[i];return a[r]=s,e.apply(this,a)}}function fs(e){if("function"!=typeof e)throw new xe(k);return function(t){return e.apply(this,t)}}function ls(e,t,r){var n=!0,i=!0;if("function"!=typeof e)throw new xe(k);return!1===r?n=!1:Is(r)&&(n="leading"in r?!!r.leading:n,i="trailing"in r?!!r.trailing:i),Xo(e,t,{leading:n,maxWait:+t,trailing:i})}function hs(e,t){return t=null==t?qa:t,Kn(t,h,o,[e],[])}function ps(e,t,r,n){return t&&"boolean"!=typeof t&&ri(e,t,r)?t=!1:"function"==typeof t&&(n=r,r=t,t=!1),"function"==typeof r?gr(e,t,an(r,n,1)):gr(e,t)}function ds(e,t,r){return"function"==typeof t?gr(e,!0,an(t,r,1)):gr(e,!0)}function ys(e,t){return e>t}function gs(e,t){return e>=t}function ms(e){return Qe(e)&&ei(e)&&Pe.call(e,"callee")&&!ct.call(e,"callee")}var bs=bt||function(e){return Qe(e)&&oi(e.length)&&Re.call(e)==x};function vs(e){return!0===e||!1===e||Qe(e)&&Re.call(e)==I}function _s(e){return Qe(e)&&Re.call(e)==T}function ws(e){return!!e&&1===e.nodeType&&Qe(e)&&!Rs(e)}function Ss(e){return null==e||(ei(e)&&(bs(e)||Ls(e)||ms(e)||Qe(e)&&xs(e.splice))?!e.length:!na(e).length)}function ks(e,t,r,n){r="function"==typeof r?an(r,n,3):o;var i=r?r(e,t):o;return i===o?Lr(e,t,r):!!i}function Es(e){return Qe(e)&&"string"==typeof e.message&&Re.call(e)==B}function As(e){return"number"==typeof e&&vt(e)}function xs(e){return Is(e)&&Re.call(e)==C}function Is(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function Ts(e,t,r,n){return r="function"==typeof r?an(r,n,3):o,Mr(e,Wn(t),r)}function Bs(e){return Os(e)&&e!=+e}function Cs(e){return null!=e&&(xs(e)?Le.test(Ce.call(e)):Qe(e)&&de.test(e))}function Ps(e){return null===e}function Os(e){return"number"==typeof e||Qe(e)&&Re.call(e)==O}function Rs(e){var t,r;return!(!Qe(e)||Re.call(e)!=R||ms(e)||!(Pe.call(e,"constructor")||(t=e.constructor,"function"!=typeof t||t instanceof t)))&&(Cr(e,function(e,t){r=t}),r===o||Pe.call(e,r))}function Ns(e){return Is(e)&&Re.call(e)==N}function Ls(e){return"string"==typeof e||Qe(e)&&Re.call(e)==j}function js(e){return Qe(e)&&oi(e.length)&&!!Ee[Re.call(e)]}function Ms(e){return e===o}function Ks(e,t){return e<t}function Ds(e,t){return e<=t}function Us(e){var t=e?Gn(e):0;return oi(t)?t?Xt(e):[]:pa(e)}function Fs(e){return dr(e,ia(e))}var qs=hn(Fr),Hs=hn(function(e,t,r){return r?lr(e,t,r):hr(e,t)});function zs(e,t,r){var n=mr(e);return r&&ri(e,t,r)&&(t=o),t?hr(n,t):n}var Vs=_n(Hs,cr),Gs=_n(qs,ui),Ws=En(Pr),$s=En(Or),Ys=In(Tr),Js=In(Br),Xs=Tn(Pr),Zs=Tn(Or);function Qs(e){return Rr(e,ia(e))}function ea(e,t,r){var n=null==e?o:Nr(e,bi(t),t+"");return n===o?r:n}function ta(e,t){if(null==e)return!1;var r=Pe.call(e,t);if(!r&&!ni(t)){if(t=bi(t),e=1==t.length?e:Nr(e,Yr(t,0,-1)),null==e)return!1;t=ji(t),r=Pe.call(e,t)}return r||oi(e.length)&&ti(t,e.length)&&(bs(e)||ms(e))}function ra(e,t,r){r&&ri(e,t,r)&&(t=o);for(var n=-1,i=na(e),s=i.length,a={};++n<s;){var u=i[n],c=e[u];t?Pe.call(a,c)?a[c].push(u):a[c]=[u]:a[c]=u}return a}var na=_t?function(e){var t=null==e?o:e.constructor;return"function"==typeof t&&t.prototype===e||"function"!=typeof e&&ei(e)?yi(e):Is(e)?_t(e):[]}:yi;function ia(e){if(null==e)return[];Is(e)||(e=M(e));var r=e.length;r=r&&oi(r)&&(bs(e)||ms(e))&&r||0;for(var n=e.constructor,i=-1,o="function"==typeof n&&n.prototype===e,s=t(r),a=r>0;++i<r;)s[i]=i+"";for(var u in e)a&&ti(u,r)||"constructor"==u&&(o||!Pe.call(e,u))||s.push(u);return s}var oa=Bn(!0),sa=Bn(),aa=cs(function(e,t){if(null==e)return{};if("function"!=typeof t[0]){var t=nr(Ir(t),we);return ci(e,vr(ia(e),t))}var r=an(t[0],t[1],3);return fi(e,function(e,t,n){return!r(e,t,n)})});function ua(e){e=mi(e);for(var r=-1,n=na(e),i=n.length,o=t(i);++r<i;){var s=n[r];o[r]=[s,e[s]]}return o}var ca=cs(function(e,t){return null==e?{}:"function"==typeof t[0]?fi(e,an(t[0],t[1],3)):ci(e,Ir(t))});function fa(e,t,r){var n=null==e?o:e[t];return n===o&&(null==e||ni(t,e)||(t=bi(t),e=1==t.length?e:Nr(e,Yr(t,0,-1)),n=null==e?o:e[ji(t)]),n=n===o?r:n),xs(n)?n.call(e):n}function la(e,t,r){if(null==e)return e;var n=t+"";t=null!=e[n]||ni(t,e)?[n]:bi(t);for(var i=-1,o=t.length,s=o-1,a=e;null!=a&&++i<o;){var u=t[i];Is(a)&&(i==s?a[u]=r:null==a[u]&&(a[u]=ti(t[i+1])?[]:{})),a=a[u]}return e}function ha(e,t,r,n){var i=bs(e)||js(e);if(t=qn(t,n,4),null==r)if(i||Is(e)){var s=e.constructor;r=i?bs(e)?new s:[]:mr(xs(s)?s.prototype:o)}else r={};return(i?Zt:Pr)(e,function(e,n,i){return t(r,e,n,i)}),r}function pa(e){return tn(e,na(e))}function da(e){return tn(e,ia(e))}function ya(e,t,r){return t=+t||0,r===o?(r=t,t=0):r=+r||0,e>=St(t,r)&&e<wt(t,r)}function ga(e,t,r){r&&ri(e,t,r)&&(t=r=o);var n=null==e,i=null==t;if(null==r&&(i&&"boolean"==typeof e?(r=e,e=1):"boolean"==typeof t&&(r=t,i=!0)),n&&i&&(t=1,i=!1),e=+e||0,i?(t=e,e=0):t=+t||0,r||e%1||t%1){var s=At();return St(e+s*(t-e+et("1e-"+((s+"").length-1))),t)}return Gr(e,t)}var ma=mn(function(e,t,r){return t=t.toLowerCase(),e+(r?t.charAt(0).toUpperCase()+t.slice(1):t)});function ba(e){return e=He(e),e&&e.charAt(0).toUpperCase()+e.slice(1)}function va(e){return e=He(e),e&&e.replace(ge,$e).replace(ce,"")}function _a(e,t,r){e=He(e),t+="";var n=e.length;return r=r===o?n:St(r<0?0:+r||0,n),r-=t.length,r>=0&&e.indexOf(t,r)==r}function wa(e){return e=He(e),e&&ee.test(e)?e.replace(Z,Ye):e}function Sa(e){return e=He(e),e&&ue.test(e)?e.replace(ae,Je):e||"(?:)"}var ka=mn(function(e,t,r){return e+(r?"-":"")+t.toLowerCase()});function Ea(e,t,r){e=He(e),t=+t;var n=e.length;if(n>=t||!vt(t))return e;var i=(t-n)/2,o=mt(i),s=yt(i);return r=Nn("",s,r),r.slice(0,o)+e+r}var Aa=Cn(),xa=Cn(!0);function Ia(e,t,r){return(r?ri(e,t,r):null==t)?t=0:t&&(t=+t),e=Ra(e),Et(e,t||(pe.test(e)?16:10))}function Ta(e,t){var r="";if(e=He(e),t=+t,t<1||!e||!vt(t))return r;do{t%2&&(r+=e),t=mt(t/2),e+=e}while(t);return r}var Ba=mn(function(e,t,r){return e+(r?"_":"")+t.toLowerCase()}),Ca=mn(function(e,t,r){return e+(r?" ":"")+(t.charAt(0).toUpperCase()+t.slice(1))});function Pa(e,t,r){return e=He(e),r=null==r?0:St(r<0?0:+r||0,e.length),e.lastIndexOf(t,r)==r}function Oa(e,t,r){var n=Nt.templateSettings;r&&ri(e,t,r)&&(t=r=o),e=He(e),t=lr(hr({},r||t),n,fr);var s=lr(hr({},t.imports),n.imports,fr),a=na(s),u=tn(s,a),c,f,l=0,h=t.interpolate||me,p="__p += '",d=_e((t.escape||me).source+"|"+h.source+"|"+(h===ne?le:me).source+"|"+(t.evaluate||me).source+"|$","g"),y="//# sourceURL="+("sourceURL"in t?t.sourceURL:"lodash.templateSources["+ ++ke+"]")+"\n";e.replace(d,function(t,r,n,i,o,s){return n||(n=i),p+=e.slice(l,s).replace(be,Xe),r&&(c=!0,p+="' +\n__e("+r+") +\n'"),o&&(f=!0,p+="';\n"+o+";\n__p += '"),n&&(p+="' +\n((__t = ("+n+")) == null ? '' : __t) +\n'"),l=s+t.length,t}),p+="';\n";var g=t.variable;g||(p="with (obj) {\n"+p+"\n}\n"),p=(f?p.replace($,""):p).replace(Y,"$1").replace(J,"$1;"),p="function("+(g||"obj")+") {\n"+(g?"":"obj || (obj = {});\n")+"var __t, __p = ''"+(c?", __e = _.escape":"")+(f?", __j = Array.prototype.join;\nfunction print() { __p += __j.call(arguments, '') }\n":";\n")+p+"return __p\n}";var m=Da(function(){return i(a,y+"return "+p).apply(o,u)});if(m.source=p,Es(m))throw m;return m}function Ra(e,t,r){var n=e;return e=He(e),e?(r?ri(n,t,r):null==t)?e.slice(nt(e),it(e)+1):(t+="",e.slice(ze(e,t),Ve(e,t)+1)):e}function Na(e,t,r){var n=e;return e=He(e),e?(r?ri(n,t,r):null==t)?e.slice(nt(e)):e.slice(ze(e,t+"")):e}function La(e,t,r){var n=e;return e=He(e),e?(r?ri(n,t,r):null==t)?e.slice(0,it(e)+1):e.slice(0,Ve(e,t+"")+1):e}function ja(e,t,r){r&&ri(e,t,r)&&(t=o);var n=g,i=m;if(null!=t)if(Is(t)){var s="separator"in t?t.separator:s;n="length"in t?+t.length||0:n,i="omission"in t?He(t.omission):i}else n=+t||0;if(e=He(e),n>=e.length)return e;var a=n-i.length;if(a<1)return i;var u=e.slice(0,a);if(null==s)return u+i;if(Ns(s)){if(e.slice(a).search(s)){var c,f,l=e.slice(0,a);for(s.global||(s=_e(s.source,(he.exec(s)||"")+"g")),s.lastIndex=0;c=s.exec(l);)f=c.index;u=u.slice(0,null==f?a:f)}}else if(e.indexOf(s,a)!=a){var h=u.lastIndexOf(s);h>-1&&(u=u.slice(0,h))}return u+i}function Ma(e){return e=He(e),e&&Q.test(e)?e.replace(X,ot):e}function Ka(e,t,r){return r&&ri(e,t,r)&&(t=o),e=He(e),e.match(t||ve)||[]}var Da=cs(function(e,t){try{return e.apply(o,t)}catch(e){return Es(e)?e:new n(e)}});function Ua(e,t,r){return r&&ri(e,t,r)&&(t=o),Qe(e)?Ha(e):yr(e,t)}function Fa(e){return function(){return e}}function qa(e){return e}function Ha(e){return Dr(gr(e,!0))}function za(e,t){return Ur(e,gr(t,!0))}var Va=cs(function(e,t){return function(r){return Qn(r,e,t)}}),Ga=cs(function(e,t){return function(r){return Qn(e,r,t)}});function Wa(e,t,r){if(null==r){var n=Is(t),i=n?na(t):o,s=i&&i.length?Rr(t,i):o;(s?s.length:n)||(s=!1,r=t,t=e,e=this)}s||(s=Rr(t,na(t)));var a=!0,u=-1,c=xs(e),f=s.length;!1===r?a=!1:Is(r)&&"chain"in r&&(a=r.chain);for(;++u<f;){var l=s[u],h=t[l];e[l]=h,c&&(e.prototype[l]=function(t){return function(){var r=this.__chain__;if(a||r){var n=e(this.__wrapped__),i=n.__actions__=Xt(this.__actions__);return i.push({func:t,args:arguments,thisArg:e}),n.__chain__=r,n}return t.apply(e,ir([this.value()],arguments))}}(h))}return e}function $a(){return Ke._=Ne,this}function Ya(){}function Ja(e){return ni(e)?Hr(e):zr(e)}function Xa(e){return function(t){return Nr(e,bi(t),t+"")}}function Za(e,r,n){n&&ri(e,r,n)&&(r=n=o),e=+e||0,n=null==n?1:+n||0,null==r?(r=e,e=0):r=+r||0;for(var i=-1,s=wt(yt((r-e)/(n||1)),0),a=t(s);++i<s;)a[i]=e,e+=n;return a}function Qa(e,r,n){if(e=mt(e),e<1||!vt(e))return[];var i=-1,o=t(St(e,Tt));for(r=an(r,n,1);++i<e;)i<Tt?o[i]=r(i):r(i);return o}function eu(e){var t=++Oe;return He(e)+t}function tu(e,t){return(+e||0)+(+t||0)}var ru=jn("ceil"),nu=jn("floor"),iu=wn(ys,xt),ou=wn(Ks,It),su=jn("round"),au;function uu(e,t,r){return r&&ri(e,t,r)&&(t=o),t=qn(t,r,3),1==t.length?ur(bs(e)?e:gi(e),t):Qr(e,t)}return Nt.prototype=Lt.prototype,jt.prototype=mr(Lt.prototype),jt.prototype.constructor=jt,Kt.prototype=mr(Lt.prototype),Kt.prototype.constructor=Kt,qt.prototype.delete=Ht,qt.prototype.get=zt,qt.prototype.has=Vt,qt.prototype.set=Gt,Wt.prototype.push=Yt,rs.Cache=qt,Nt.after=Ho,Nt.ary=zo,Nt.assign=Hs,Nt.at=yo,Nt.before=Vo,Nt.bind=Go,Nt.bindAll=Wo,Nt.bindKey=$o,Nt.callback=Ua,Nt.chain=io,Nt.chunk=_i,Nt.compact=wi,Nt.constant=Fa,Nt.countBy=go,Nt.create=zs,Nt.curry=Yo,Nt.curryRight=Jo,Nt.debounce=Xo,Nt.defaults=Vs,Nt.defaultsDeep=Gs,Nt.defer=Zo,Nt.delay=Qo,Nt.difference=Si,Nt.drop=ki,Nt.dropRight=Ei,Nt.dropRightWhile=Ai,Nt.dropWhile=xi,Nt.fill=Ii,Nt.filter=bo,Nt.flatten=Pi,Nt.flattenDeep=Oi,Nt.flow=es,Nt.flowRight=ts,Nt.forEach=So,Nt.forEachRight=ko,Nt.forIn=Ys,Nt.forInRight=Js,Nt.forOwn=Xs,Nt.forOwnRight=Zs,Nt.functions=Qs,Nt.groupBy=Eo,Nt.indexBy=xo,Nt.initial=Ni,Nt.intersection=Li,Nt.invert=ra,Nt.invoke=Io,Nt.keys=na,Nt.keysIn=ia,Nt.map=To,Nt.mapKeys=oa,Nt.mapValues=sa,Nt.matches=Ha,Nt.matchesProperty=za,Nt.memoize=rs,Nt.merge=qs,Nt.method=Va,Nt.methodOf=Ga,Nt.mixin=Wa,Nt.modArgs=ns,Nt.negate=is,Nt.omit=aa,Nt.once=os,Nt.pairs=ua,Nt.partial=ss,Nt.partialRight=as,Nt.partition=Bo,Nt.pick=ca,Nt.pluck=Co,Nt.property=Ja,Nt.propertyOf=Xa,Nt.pull=Ki,Nt.pullAt=Di,Nt.range=Za,Nt.rearg=us,Nt.reject=Ro,Nt.remove=Ui,Nt.rest=Fi,Nt.restParam=cs,Nt.set=la,Nt.shuffle=Lo,Nt.slice=qi,Nt.sortBy=Ko,Nt.sortByAll=Do,Nt.sortByOrder=Uo,Nt.spread=fs,Nt.take=Vi,Nt.takeRight=Gi,Nt.takeRightWhile=Wi,Nt.takeWhile=$i,Nt.tap=oo,Nt.throttle=ls,Nt.thru=so,Nt.times=Qa,Nt.toArray=Us,Nt.toPlainObject=Fs,Nt.transform=ha,Nt.union=Yi,Nt.uniq=Ji,Nt.unzip=Xi,Nt.unzipWith=Zi,Nt.values=pa,Nt.valuesIn=da,Nt.where=Fo,Nt.without=Qi,Nt.wrap=hs,Nt.xor=eo,Nt.zip=to,Nt.zipObject=ro,Nt.zipWith=no,Nt.backflow=ts,Nt.collect=To,Nt.compose=ts,Nt.each=So,Nt.eachRight=ko,Nt.extend=Hs,Nt.iteratee=Ua,Nt.methods=Qs,Nt.object=ro,Nt.select=bo,Nt.tail=Fi,Nt.unique=Ji,Wa(Nt,Nt),Nt.add=tu,Nt.attempt=Da,Nt.camelCase=ma,Nt.capitalize=ba,Nt.ceil=ru,Nt.clone=ps,Nt.cloneDeep=ds,Nt.deburr=va,Nt.endsWith=_a,Nt.escape=wa,Nt.escapeRegExp=Sa,Nt.every=mo,Nt.find=vo,Nt.findIndex=Ti,Nt.findKey=Ws,Nt.findLast=_o,Nt.findLastIndex=Bi,Nt.findLastKey=$s,Nt.findWhere=wo,Nt.first=Ci,Nt.floor=nu,Nt.get=ea,Nt.gt=ys,Nt.gte=gs,Nt.has=ta,Nt.identity=qa,Nt.includes=Ao,Nt.indexOf=Ri,Nt.inRange=ya,Nt.isArguments=ms,Nt.isArray=bs,Nt.isBoolean=vs,Nt.isDate=_s,Nt.isElement=ws,Nt.isEmpty=Ss,Nt.isEqual=ks,Nt.isError=Es,Nt.isFinite=As,Nt.isFunction=xs,Nt.isMatch=Ts,Nt.isNaN=Bs,Nt.isNative=Cs,Nt.isNull=Ps,Nt.isNumber=Os,Nt.isObject=Is,Nt.isPlainObject=Rs,Nt.isRegExp=Ns,Nt.isString=Ls,Nt.isTypedArray=js,Nt.isUndefined=Ms,Nt.kebabCase=ka,Nt.last=ji,Nt.lastIndexOf=Mi,Nt.lt=Ks,Nt.lte=Ds,Nt.max=iu,Nt.min=ou,Nt.noConflict=$a,Nt.noop=Ya,Nt.now=qo,Nt.pad=Ea,Nt.padLeft=Aa,Nt.padRight=xa,Nt.parseInt=Ia,Nt.random=ga,Nt.reduce=Po,Nt.reduceRight=Oo,Nt.repeat=Ta,Nt.result=fa,Nt.round=su,Nt.runInContext=st,Nt.size=jo,Nt.snakeCase=Ba,Nt.some=Mo,Nt.sortedIndex=Hi,Nt.sortedLastIndex=zi,Nt.startCase=Ca,Nt.startsWith=Pa,Nt.sum=uu,Nt.template=Oa,Nt.trim=Ra,Nt.trimLeft=Na,Nt.trimRight=La,Nt.trunc=ja,Nt.unescape=Ma,Nt.uniqueId=eu,Nt.words=Ka,Nt.all=mo,Nt.any=Mo,Nt.contains=Ao,Nt.eq=ks,Nt.detect=vo,Nt.foldl=Po,Nt.foldr=Oo,Nt.head=Ci,Nt.include=Ao,Nt.inject=Po,Wa(Nt,(au={},Pr(Nt,function(e,t){Nt.prototype[t]||(au[t]=e)}),au),!1),Nt.sample=No,Nt.prototype.sample=function(e){return this.__chain__||null!=e?this.thru(function(t){return No(t,e)}):No(this.value())},Nt.VERSION=s,Zt(["bind","bindKey","curry","curryRight","partial","partialRight"],function(e){Nt[e].placeholder=Nt}),Zt(["drop","take"],function(e,t){Kt.prototype[e]=function(r){var n=this.__filtered__;if(n&&!t)return new Kt(this);r=null==r?1:wt(mt(r)||0,0);var i=this.clone();return n?i.__takeCount__=St(i.__takeCount__,r):i.__views__.push({size:r,type:e+(i.__dir__<0?"Right":"")}),i},Kt.prototype[e+"Right"]=function(t){return this.reverse()[e](t).reverse()}}),Zt(["filter","map","takeWhile"],function(e,t){var r=t+1,n=r!=S;Kt.prototype[e]=function(e,t){var i=this.clone();return i.__iteratees__.push({iteratee:qn(e,t,1),type:r}),i.__filtered__=i.__filtered__||n,i}}),Zt(["first","last"],function(e,t){var r="take"+(t?"Right":"");Kt.prototype[e]=function(){return this[r](1).value()[0]}}),Zt(["initial","rest"],function(e,t){var r="drop"+(t?"":"Right");Kt.prototype[e]=function(){return this.__filtered__?new Kt(this):this[r](1)}}),Zt(["pluck","where"],function(e,t){var r=t?"filter":"map",n=t?Dr:Ja;Kt.prototype[e]=function(e){return this[r](n(e))}}),Kt.prototype.compact=function(){return this.filter(qa)},Kt.prototype.reject=function(e,t){return e=qn(e,t,1),this.filter(function(t){return!e(t)})},Kt.prototype.slice=function(e,t){e=null==e?0:+e||0;var r=this;return r.__filtered__&&(e>0||t<0)?new Kt(r):(e<0?r=r.takeRight(-e):e&&(r=r.drop(e)),t!==o&&(t=+t||0,r=t<0?r.dropRight(-t):r.take(t-e)),r)},Kt.prototype.takeRightWhile=function(e,t){return this.reverse().takeWhile(e,t).reverse()},Kt.prototype.toArray=function(){return this.take(It)},Pr(Kt.prototype,function(e,t){var r=/^(?:filter|map|reject)|While$/.test(t),n=/^(?:first|last)$/.test(t),i=Nt[n?"take"+("last"==t?"Right":""):t];i&&(Nt.prototype[t]=function(){var t=n?[1]:arguments,s=this.__chain__,a=this.__wrapped__,u=!!this.__actions__.length,c=a instanceof Kt,f=t[0],l=c||bs(a);l&&r&&"function"==typeof f&&1!=f.length&&(c=l=!1);var h=function(e){return n&&s?i(e,1)[0]:i.apply(o,ir([e],t))},p={func:so,args:[h],thisArg:o},d=c&&!u;if(n&&!s)return d?(a=a.clone(),a.__actions__.push(p),e.call(a)):i.call(o,this.value())[0];if(!n&&l){a=d?a:new Kt(this);var y=e.apply(a,t);return y.__actions__.push(p),new jt(y,s)}return this.thru(h)})}),Zt(["join","pop","push","replace","shift","sort","splice","split","unshift"],function(e){var t=(/^(?:replace|split)$/.test(e)?Be:Ie)[e],r=/^(?:push|sort|unshift)$/.test(e)?"tap":"thru",n=/^(?:join|pop|replace|shift)$/.test(e);Nt.prototype[e]=function(){var e=arguments;return n&&!this.__chain__?t.apply(this.value(),e):this[r](function(r){return t.apply(r,e)})}}),Pr(Kt.prototype,function(e,t){var r=Nt[t];if(r){var n=r.name,i=Rt[n]||(Rt[n]=[]);i.push({name:t,func:r})}}),Rt[Rn(o,u).name]=[{name:"wrapper",func:o}],Kt.prototype.clone=Dt,Kt.prototype.reverse=Ut,Kt.prototype.value=Ft,Nt.prototype.chain=ao,Nt.prototype.commit=uo,Nt.prototype.concat=co,Nt.prototype.plant=fo,Nt.prototype.reverse=lo,Nt.prototype.toString=ho,Nt.prototype.run=Nt.prototype.toJSON=Nt.prototype.valueOf=Nt.prototype.value=po,Nt.prototype.collect=Nt.prototype.map,Nt.prototype.head=Nt.prototype.first,Nt.prototype.select=Nt.prototype.filter,Nt.prototype.tail=Nt.prototype.rest,Nt}var at=st();Ke._=at,i=function(){return at}.call(t,r,t,e),i===o||(e.exports=i)}).call(this)}).call(this,r(28)(e),r(7))},function(e,t,r){(function(t,n){var i=r(11),o=r(896),s=e.exports=i.util=i.util||{};function a(e){if(8!==e&&16!==e&&24!==e&&32!==e)throw new Error("Only 8, 16, 24, or 32 bits supported: "+e)}function u(e){if(this.data="",this.read=0,"string"==typeof e)this.data=e;else if(s.isArrayBuffer(e)||s.isArrayBufferView(e))if(void 0!==n&&e instanceof n)this.data=e.toString("binary");else{var t=new Uint8Array(e);try{this.data=String.fromCharCode.apply(null,t)}catch(e){for(var r=0;r<t.length;++r)this.putByte(t[r])}}else(e instanceof u||"object"==typeof e&&"string"==typeof e.data&&"number"==typeof e.read)&&(this.data=e.data,this.read=e.read);this._constructedStringLength=0}!function(){if(void 0!==t&&t.nextTick&&!t.browser)return s.nextTick=t.nextTick,void("function"==typeof setImmediate?s.setImmediate=setImmediate:s.setImmediate=s.nextTick);if("function"==typeof setImmediate)return s.setImmediate=function(){return setImmediate.apply(void 0,arguments)},void(s.nextTick=function(e){return setImmediate(e)});if(s.setImmediate=function(e){setTimeout(e,0)},"undefined"!=typeof window&&"function"==typeof window.postMessage){var e="forge.setImmediate",r=[];function n(t){if(t.source===window&&t.data===e){t.stopPropagation();var n=r.slice();r.length=0,n.forEach(function(e){e()})}}s.setImmediate=function(t){r.push(t),1===r.length&&window.postMessage(e,"*")},window.addEventListener("message",n,!0)}if("undefined"!=typeof MutationObserver){var i=Date.now(),o=!0,a=document.createElement("div"),r=[];new MutationObserver(function(){var e=r.slice();r.length=0,e.forEach(function(e){e()})}).observe(a,{attributes:!0});var u=s.setImmediate;s.setImmediate=function(e){Date.now()-i>15?(i=Date.now(),u(e)):(r.push(e),1===r.length&&a.setAttribute("a",o=!o))}}s.nextTick=s.setImmediate}(),s.isNodejs=void 0!==t&&t.versions&&t.versions.node,s.isArray=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)},s.isArrayBuffer=function(e){return"undefined"!=typeof ArrayBuffer&&e instanceof ArrayBuffer},s.isArrayBufferView=function(e){return e&&s.isArrayBuffer(e.buffer)&&void 0!==e.byteLength},s.ByteBuffer=u,s.ByteStringBuffer=u;var c=4096;function f(e,t){t=t||{},this.read=t.readOffset||0,this.growSize=t.growSize||1024;var r=s.isArrayBuffer(e),n=s.isArrayBufferView(e);if(r||n)return this.data=r?new DataView(e):new DataView(e.buffer,e.byteOffset,e.byteLength),void(this.write="writeOffset"in t?t.writeOffset:this.data.byteLength);this.data=new DataView(new ArrayBuffer(0)),this.write=0,null!==e&&void 0!==e&&this.putBytes(e),"writeOffset"in t&&(this.write=t.writeOffset)}s.ByteStringBuffer.prototype._optimizeConstructedString=function(e){this._constructedStringLength+=e,this._constructedStringLength>4096&&(this.data.substr(0,1),this._constructedStringLength=0)},s.ByteStringBuffer.prototype.length=function(){return this.data.length-this.read},s.ByteStringBuffer.prototype.isEmpty=function(){return this.length()<=0},s.ByteStringBuffer.prototype.putByte=function(e){return this.putBytes(String.fromCharCode(e))},s.ByteStringBuffer.prototype.fillWithByte=function(e,t){e=String.fromCharCode(e);for(var r=this.data;t>0;)1&t&&(r+=e),t>>>=1,t>0&&(e+=e);return this.data=r,this._optimizeConstructedString(t),this},s.ByteStringBuffer.prototype.putBytes=function(e){return this.data+=e,this._optimizeConstructedString(e.length),this},s.ByteStringBuffer.prototype.putString=function(e){return this.putBytes(s.encodeUtf8(e))},s.ByteStringBuffer.prototype.putInt16=function(e){return this.putBytes(String.fromCharCode(e>>8&255)+String.fromCharCode(255&e))},s.ByteStringBuffer.prototype.putInt24=function(e){return this.putBytes(String.fromCharCode(e>>16&255)+String.fromCharCode(e>>8&255)+String.fromCharCode(255&e))},s.ByteStringBuffer.prototype.putInt32=function(e){return this.putBytes(String.fromCharCode(e>>24&255)+String.fromCharCode(e>>16&255)+String.fromCharCode(e>>8&255)+String.fromCharCode(255&e))},s.ByteStringBuffer.prototype.putInt16Le=function(e){return this.putBytes(String.fromCharCode(255&e)+String.fromCharCode(e>>8&255))},s.ByteStringBuffer.prototype.putInt24Le=function(e){return this.putBytes(String.fromCharCode(255&e)+String.fromCharCode(e>>8&255)+String.fromCharCode(e>>16&255))},s.ByteStringBuffer.prototype.putInt32Le=function(e){return this.putBytes(String.fromCharCode(255&e)+String.fromCharCode(e>>8&255)+String.fromCharCode(e>>16&255)+String.fromCharCode(e>>24&255))},s.ByteStringBuffer.prototype.putInt=function(e,t){a(t);var r="";do{t-=8,r+=String.fromCharCode(e>>t&255)}while(t>0);return this.putBytes(r)},s.ByteStringBuffer.prototype.putSignedInt=function(e,t){return e<0&&(e+=2<<t-1),this.putInt(e,t)},s.ByteStringBuffer.prototype.putBuffer=function(e){return this.putBytes(e.getBytes())},s.ByteStringBuffer.prototype.getByte=function(){return this.data.charCodeAt(this.read++)},s.ByteStringBuffer.prototype.getInt16=function(){var e=this.data.charCodeAt(this.read)<<8^this.data.charCodeAt(this.read+1);return this.read+=2,e},s.ByteStringBuffer.prototype.getInt24=function(){var e=this.data.charCodeAt(this.read)<<16^this.data.charCodeAt(this.read+1)<<8^this.data.charCodeAt(this.read+2);return this.read+=3,e},s.ByteStringBuffer.prototype.getInt32=function(){var e=this.data.charCodeAt(this.read)<<24^this.data.charCodeAt(this.read+1)<<16^this.data.charCodeAt(this.read+2)<<8^this.data.charCodeAt(this.read+3);return this.read+=4,e},s.ByteStringBuffer.prototype.getInt16Le=function(){var e=this.data.charCodeAt(this.read)^this.data.charCodeAt(this.read+1)<<8;return this.read+=2,e},s.ByteStringBuffer.prototype.getInt24Le=function(){var e=this.data.charCodeAt(this.read)^this.data.charCodeAt(this.read+1)<<8^this.data.charCodeAt(this.read+2)<<16;return this.read+=3,e},s.ByteStringBuffer.prototype.getInt32Le=function(){var e=this.data.charCodeAt(this.read)^this.data.charCodeAt(this.read+1)<<8^this.data.charCodeAt(this.read+2)<<16^this.data.charCodeAt(this.read+3)<<24;return this.read+=4,e},s.ByteStringBuffer.prototype.getInt=function(e){a(e);var t=0;do{t=(t<<8)+this.data.charCodeAt(this.read++),e-=8}while(e>0);return t},s.ByteStringBuffer.prototype.getSignedInt=function(e){var t=this.getInt(e),r=2<<e-2;return t>=r&&(t-=r<<1),t},s.ByteStringBuffer.prototype.getBytes=function(e){var t;return e?(e=Math.min(this.length(),e),t=this.data.slice(this.read,this.read+e),this.read+=e):0===e?t="":(t=0===this.read?this.data:this.data.slice(this.read),this.clear()),t},s.ByteStringBuffer.prototype.bytes=function(e){return void 0===e?this.data.slice(this.read):this.data.slice(this.read,this.read+e)},s.ByteStringBuffer.prototype.at=function(e){return this.data.charCodeAt(this.read+e)},s.ByteStringBuffer.prototype.setAt=function(e,t){return this.data=this.data.substr(0,this.read+e)+String.fromCharCode(t)+this.data.substr(this.read+e+1),this},s.ByteStringBuffer.prototype.last=function(){return this.data.charCodeAt(this.data.length-1)},s.ByteStringBuffer.prototype.copy=function(){var e=s.createBuffer(this.data);return e.read=this.read,e},s.ByteStringBuffer.prototype.compact=function(){return this.read>0&&(this.data=this.data.slice(this.read),this.read=0),this},s.ByteStringBuffer.prototype.clear=function(){return this.data="",this.read=0,this},s.ByteStringBuffer.prototype.truncate=function(e){var t=Math.max(0,this.length()-e);return this.data=this.data.substr(this.read,t),this.read=0,this},s.ByteStringBuffer.prototype.toHex=function(){for(var e="",t=this.read;t<this.data.length;++t){var r=this.data.charCodeAt(t);r<16&&(e+="0"),e+=r.toString(16)}return e},s.ByteStringBuffer.prototype.toString=function(){return s.decodeUtf8(this.bytes())},s.DataBuffer=f,s.DataBuffer.prototype.length=function(){return this.write-this.read},s.DataBuffer.prototype.isEmpty=function(){return this.length()<=0},s.DataBuffer.prototype.accommodate=function(e,t){if(this.length()>=e)return this;t=Math.max(t||this.growSize,e);var r=new Uint8Array(this.data.buffer,this.data.byteOffset,this.data.byteLength),n=new Uint8Array(this.length()+t);return n.set(r),this.data=new DataView(n.buffer),this},s.DataBuffer.prototype.putByte=function(e){return this.accommodate(1),this.data.setUint8(this.write++,e),this},s.DataBuffer.prototype.fillWithByte=function(e,t){this.accommodate(t);for(var r=0;r<t;++r)this.data.setUint8(e);return this},s.DataBuffer.prototype.putBytes=function(e,t){if(s.isArrayBufferView(e)){var r=new Uint8Array(e.buffer,e.byteOffset,e.byteLength),n=r.byteLength-r.byteOffset;this.accommodate(n);var i=new Uint8Array(this.data.buffer,this.write);return i.set(r),this.write+=n,this}if(s.isArrayBuffer(e)){var r=new Uint8Array(e);this.accommodate(r.byteLength);var i=new Uint8Array(this.data.buffer);return i.set(r,this.write),this.write+=r.byteLength,this}if(e instanceof s.DataBuffer||"object"==typeof e&&"number"==typeof e.read&&"number"==typeof e.write&&s.isArrayBufferView(e.data)){var r=new Uint8Array(e.data.byteLength,e.read,e.length());this.accommodate(r.byteLength);var i=new Uint8Array(e.data.byteLength,this.write);return i.set(r),this.write+=r.byteLength,this}if(e instanceof s.ByteStringBuffer&&(e=e.data,t="binary"),t=t||"binary","string"==typeof e){var o;if("hex"===t)return this.accommodate(Math.ceil(e.length/2)),o=new Uint8Array(this.data.buffer,this.write),this.write+=s.binary.hex.decode(e,o,this.write),this;if("base64"===t)return this.accommodate(3*Math.ceil(e.length/4)),o=new Uint8Array(this.data.buffer,this.write),this.write+=s.binary.base64.decode(e,o,this.write),this;if("utf8"===t&&(e=s.encodeUtf8(e),t="binary"),"binary"===t||"raw"===t)return this.accommodate(e.length),o=new Uint8Array(this.data.buffer,this.write),this.write+=s.binary.raw.decode(o),this;if("utf16"===t)return this.accommodate(2*e.length),o=new Uint16Array(this.data.buffer,this.write),this.write+=s.text.utf16.encode(o),this;throw new Error("Invalid encoding: "+t)}throw Error("Invalid parameter: "+e)},s.DataBuffer.prototype.putBuffer=function(e){return this.putBytes(e),e.clear(),this},s.DataBuffer.prototype.putString=function(e){return this.putBytes(e,"utf16")},s.DataBuffer.prototype.putInt16=function(e){return this.accommodate(2),this.data.setInt16(this.write,e),this.write+=2,this},s.DataBuffer.prototype.putInt24=function(e){return this.accommodate(3),this.data.setInt16(this.write,e>>8&65535),this.data.setInt8(this.write,e>>16&255),this.write+=3,this},s.DataBuffer.prototype.putInt32=function(e){return this.accommodate(4),this.data.setInt32(this.write,e),this.write+=4,this},s.DataBuffer.prototype.putInt16Le=function(e){return this.accommodate(2),this.data.setInt16(this.write,e,!0),this.write+=2,this},s.DataBuffer.prototype.putInt24Le=function(e){return this.accommodate(3),this.data.setInt8(this.write,e>>16&255),this.data.setInt16(this.write,e>>8&65535,!0),this.write+=3,this},s.DataBuffer.prototype.putInt32Le=function(e){return this.accommodate(4),this.data.setInt32(this.write,e,!0),this.write+=4,this},s.DataBuffer.prototype.putInt=function(e,t){a(t),this.accommodate(t/8);do{t-=8,this.data.setInt8(this.write++,e>>t&255)}while(t>0);return this},s.DataBuffer.prototype.putSignedInt=function(e,t){return a(t),this.accommodate(t/8),e<0&&(e+=2<<t-1),this.putInt(e,t)},s.DataBuffer.prototype.getByte=function(){return this.data.getInt8(this.read++)},s.DataBuffer.prototype.getInt16=function(){var e=this.data.getInt16(this.read);return this.read+=2,e},s.DataBuffer.prototype.getInt24=function(){var e=this.data.getInt16(this.read)<<8^this.data.getInt8(this.read+2);return this.read+=3,e},s.DataBuffer.prototype.getInt32=function(){var e=this.data.getInt32(this.read);return this.read+=4,e},s.DataBuffer.prototype.getInt16Le=function(){var e=this.data.getInt16(this.read,!0);return this.read+=2,e},s.DataBuffer.prototype.getInt24Le=function(){var e=this.data.getInt8(this.read)^this.data.getInt16(this.read+1,!0)<<8;return this.read+=3,e},s.DataBuffer.prototype.getInt32Le=function(){var e=this.data.getInt32(this.read,!0);return this.read+=4,e},s.DataBuffer.prototype.getInt=function(e){a(e);var t=0;do{t=(t<<8)+this.data.getInt8(this.read++),e-=8}while(e>0);return t},s.DataBuffer.prototype.getSignedInt=function(e){var t=this.getInt(e),r=2<<e-2;return t>=r&&(t-=r<<1),t},s.DataBuffer.prototype.getBytes=function(e){var t;return e?(e=Math.min(this.length(),e),t=this.data.slice(this.read,this.read+e),this.read+=e):0===e?t="":(t=0===this.read?this.data:this.data.slice(this.read),this.clear()),t},s.DataBuffer.prototype.bytes=function(e){return void 0===e?this.data.slice(this.read):this.data.slice(this.read,this.read+e)},s.DataBuffer.prototype.at=function(e){return this.data.getUint8(this.read+e)},s.DataBuffer.prototype.setAt=function(e,t){return this.data.setUint8(e,t),this},s.DataBuffer.prototype.last=function(){return this.data.getUint8(this.write-1)},s.DataBuffer.prototype.copy=function(){return new s.DataBuffer(this)},s.DataBuffer.prototype.compact=function(){if(this.read>0){var e=new Uint8Array(this.data.buffer,this.read),t=new Uint8Array(e.byteLength);t.set(e),this.data=new DataView(t),this.write-=this.read,this.read=0}return this},s.DataBuffer.prototype.clear=function(){return this.data=new DataView(new ArrayBuffer(0)),this.read=this.write=0,this},s.DataBuffer.prototype.truncate=function(e){return this.write=Math.max(0,this.length()-e),this.read=Math.min(this.read,this.write),this},s.DataBuffer.prototype.toHex=function(){for(var e="",t=this.read;t<this.data.byteLength;++t){var r=this.data.getUint8(t);r<16&&(e+="0"),e+=r.toString(16)}return e},s.DataBuffer.prototype.toString=function(e){var t=new Uint8Array(this.data,this.read,this.length());if(e=e||"utf8","binary"===e||"raw"===e)return s.binary.raw.encode(t);if("hex"===e)return s.binary.hex.encode(t);if("base64"===e)return s.binary.base64.encode(t);if("utf8"===e)return s.text.utf8.decode(t);if("utf16"===e)return s.text.utf16.decode(t);throw new Error("Invalid encoding: "+e)},s.createBuffer=function(e,t){return t=t||"raw",void 0!==e&&"utf8"===t&&(e=s.encodeUtf8(e)),new s.ByteBuffer(e)},s.fillString=function(e,t){for(var r="";t>0;)1&t&&(r+=e),t>>>=1,t>0&&(e+=e);return r},s.xorBytes=function(e,t,r){for(var n="",i="",o="",s=0,a=0;r>0;--r,++s)i=e.charCodeAt(s)^t.charCodeAt(s),a>=10&&(n+=o,o="",a=0),o+=String.fromCharCode(i),++a;return n+=o,n},s.hexToBytes=function(e){var t="",r=0;for(!0&e.length&&(r=1,t+=String.fromCharCode(parseInt(e[0],16)));r<e.length;r+=2)t+=String.fromCharCode(parseInt(e.substr(r,2),16));return t},s.bytesToHex=function(e){return s.createBuffer(e).toHex()},s.int32ToBytes=function(e){return String.fromCharCode(e>>24&255)+String.fromCharCode(e>>16&255)+String.fromCharCode(e>>8&255)+String.fromCharCode(255&e)};var l="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",h=[62,-1,-1,-1,63,52,53,54,55,56,57,58,59,60,61,-1,-1,-1,64,-1,-1,-1,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,-1,-1,-1,-1,-1,-1,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51],p="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";s.encode64=function(e,t){for(var r="",n="",i,o,s,a=0;a<e.length;)i=e.charCodeAt(a++),o=e.charCodeAt(a++),s=e.charCodeAt(a++),r+=l.charAt(i>>2),r+=l.charAt((3&i)<<4|o>>4),isNaN(o)?r+="==":(r+=l.charAt((15&o)<<2|s>>6),r+=isNaN(s)?"=":l.charAt(63&s)),t&&r.length>t&&(n+=r.substr(0,t)+"\r\n",r=r.substr(t));return n+=r,n},s.decode64=function(e){e=e.replace(/[^A-Za-z0-9\+\/\=]/g,"");for(var t="",r,n,i,o,s=0;s<e.length;)r=h[e.charCodeAt(s++)-43],n=h[e.charCodeAt(s++)-43],i=h[e.charCodeAt(s++)-43],o=h[e.charCodeAt(s++)-43],t+=String.fromCharCode(r<<2|n>>4),64!==i&&(t+=String.fromCharCode((15&n)<<4|i>>2),64!==o&&(t+=String.fromCharCode((3&i)<<6|o)));return t},s.encodeUtf8=function(e){return unescape(encodeURIComponent(e))},s.decodeUtf8=function(e){return decodeURIComponent(escape(e))},s.binary={raw:{},hex:{},base64:{},base58:{},baseN:{encode:o.encode,decode:o.decode}},s.binary.raw.encode=function(e){return String.fromCharCode.apply(null,e)},s.binary.raw.decode=function(e,t,r){var n=t;n||(n=new Uint8Array(e.length)),r=r||0;for(var i=r,o=0;o<e.length;++o)n[i++]=e.charCodeAt(o);return t?i-r:n},s.binary.hex.encode=s.bytesToHex,s.binary.hex.decode=function(e,t,r){var n=t;n||(n=new Uint8Array(Math.ceil(e.length/2))),r=r||0;var i=0,o=r;for(1&e.length&&(i=1,n[o++]=parseInt(e[0],16));i<e.length;i+=2)n[o++]=parseInt(e.substr(i,2),16);return t?o-r:n},s.binary.base64.encode=function(e,t){for(var r="",n="",i,o,s,a=0;a<e.byteLength;)i=e[a++],o=e[a++],s=e[a++],r+=l.charAt(i>>2),r+=l.charAt((3&i)<<4|o>>4),isNaN(o)?r+="==":(r+=l.charAt((15&o)<<2|s>>6),r+=isNaN(s)?"=":l.charAt(63&s)),t&&r.length>t&&(n+=r.substr(0,t)+"\r\n",r=r.substr(t));return n+=r,n},s.binary.base64.decode=function(e,t,r){var n=t,i,o,s,a;n||(n=new Uint8Array(3*Math.ceil(e.length/4))),e=e.replace(/[^A-Za-z0-9\+\/\=]/g,""),r=r||0;for(var u=0,c=r;u<e.length;)i=h[e.charCodeAt(u++)-43],o=h[e.charCodeAt(u++)-43],s=h[e.charCodeAt(u++)-43],a=h[e.charCodeAt(u++)-43],n[c++]=i<<2|o>>4,64!==s&&(n[c++]=(15&o)<<4|s>>2,64!==a&&(n[c++]=(3&s)<<6|a));return t?c-r:n.subarray(0,c)},s.binary.base58.encode=function(e,t){return s.binary.baseN.encode(e,p,t)},s.binary.base58.decode=function(e,t){return s.binary.baseN.decode(e,p,t)},s.text={utf8:{},utf16:{}},s.text.utf8.encode=function(e,t,r){e=s.encodeUtf8(e);var n=t;n||(n=new Uint8Array(e.length)),r=r||0;for(var i=r,o=0;o<e.length;++o)n[i++]=e.charCodeAt(o);return t?i-r:n},s.text.utf8.decode=function(e){return s.decodeUtf8(String.fromCharCode.apply(null,e))},s.text.utf16.encode=function(e,t,r){var n=t;n||(n=new Uint8Array(2*e.length));var i=new Uint16Array(n.buffer);r=r||0;for(var o=r,s=r,a=0;a<e.length;++a)i[s++]=e.charCodeAt(a),o+=2;return t?o-r:n},s.text.utf16.decode=function(e){return String.fromCharCode.apply(null,new Uint16Array(e.buffer))},s.deflate=function(e,t,r){if(t=s.decode64(e.deflate(s.encode64(t)).rval),r){var n=2,i=t.charCodeAt(1);32&i&&(n=6),t=t.substring(n,t.length-4)}return t},s.inflate=function(e,t,r){var n=e.inflate(s.encode64(t)).rval;return null===n?null:s.decode64(n)};var d=function(e,t,r){if(!e)throw new Error("WebStorage not available.");var n;if(null===r?n=e.removeItem(t):(r=s.encode64(JSON.stringify(r)),n=e.setItem(t,r)),void 0!==n&&!0!==n.rval){var i=new Error(n.error.message);throw i.id=n.error.id,i.name=n.error.name,i}},y=function(e,t){if(!e)throw new Error("WebStorage not available.");var r=e.getItem(t);if(e.init)if(null===r.rval){if(r.error){var n=new Error(r.error.message);throw n.id=r.error.id,n.name=r.error.name,n}r=null}else r=r.rval;return null!==r&&(r=JSON.parse(s.decode64(r))),r},g=function(e,t,r,n){var i=y(e,t);null===i&&(i={}),i[r]=n,d(e,t,i)},m=function(e,t,r){var n=y(e,t);return null!==n&&(n=r in n?n[r]:null),n},b=function(e,t,r){var n=y(e,t);if(null!==n&&r in n){delete n[r];var i=!0;for(var o in n){i=!1;break}i&&(n=null),d(e,t,n)}},v=function(e,t){d(e,t,null)},_=function(e,t,r){var n=null,i;void 0===r&&(r=["web","flash"]);var o=!1,s=null;for(var a in r){i=r[a];try{if("flash"===i||"both"===i){if(null===t[0])throw new Error("Flash local storage not available.");n=e.apply(this,t),o="flash"===i}"web"!==i&&"both"!==i||(t[0]=localStorage,n=e.apply(this,t),o=!0)}catch(e){s=e}if(o)break}if(!o)throw s;return n};s.setItem=function(e,t,r,n,i){_(g,arguments,i)},s.getItem=function(e,t,r,n){return _(m,arguments,n)},s.removeItem=function(e,t,r,n){_(b,arguments,n)},s.clearItems=function(e,t,r){_(v,arguments,r)},s.parseUrl=function(e){var t=/^(https?):\/\/([^:&^\/]*):?(\d*)(.*)$/g;t.lastIndex=0;var r=t.exec(e),n=null===r?null:{full:e,scheme:r[1],host:r[2],port:r[3],path:r[4]};return n&&(n.fullHost=n.host,n.port?80!==n.port&&"http"===n.scheme?n.fullHost+=":"+n.port:443!==n.port&&"https"===n.scheme&&(n.fullHost+=":"+n.port):"http"===n.scheme?n.port=80:"https"===n.scheme&&(n.port=443),n.full=n.scheme+"://"+n.fullHost),n};var w=null;s.getQueryVariables=function(e){var t=function(e){for(var t={},r=e.split("&"),n=0;n<r.length;n++){var i=r[n].indexOf("="),o,s;i>0?(o=r[n].substring(0,i),s=r[n].substring(i+1)):(o=r[n],s=null),o in t||(t[o]=[]),o in Object.prototype||null===s||t[o].push(unescape(s))}return t},r;return void 0===e?(null===w&&(w="undefined"!=typeof window&&window.location&&window.location.search?t(window.location.search.substring(1)):{}),r=w):r=t(e),r},s.parseFragment=function(e){var t=e,r="",n=e.indexOf("?");n>0&&(t=e.substring(0,n),r=e.substring(n+1));var i=t.split("/");i.length>0&&""===i[0]&&i.shift();var o=""===r?{}:s.getQueryVariables(r);return{pathString:t,queryString:r,path:i,query:o}},s.makeRequest=function(e){var t=s.parseFragment(e),r={path:t.pathString,query:t.queryString,getPath:function(e){return void 0===e?t.path:t.path[e]},getQuery:function(e,r){var n;return void 0===e?n=t.query:(n=t.query[e],n&&void 0!==r&&(n=n[r])),n},getQueryLast:function(e,t){var n,i=r.getQuery(e);return n=i?i[i.length-1]:t,n}};return r},s.makeLink=function(e,t,r){e=jQuery.isArray(e)?e.join("/"):e;var n=jQuery.param(t||{});return r=r||"",e+(n.length>0?"?"+n:"")+(r.length>0?"#"+r:"")},s.setPath=function(e,t,r){if("object"==typeof e&&null!==e)for(var n=0,i=t.length;n<i;){var o=t[n++];if(n==i)e[o]=r;else{var s=o in e;(!s||s&&"object"!=typeof e[o]||s&&null===e[o])&&(e[o]={}),e=e[o]}}},s.getPath=function(e,t,r){for(var n=0,i=t.length,o=!0;o&&n<i&&"object"==typeof e&&null!==e;){var s=t[n++];o=s in e,o&&(e=e[s])}return o?e:r},s.deletePath=function(e,t){if("object"==typeof e&&null!==e)for(var r=0,n=t.length;r<n;){var i=t[r++];if(r==n)delete e[i];else{if(!(i in e)||"object"!=typeof e[i]||null===e[i])break;e=e[i]}}},s.isEmpty=function(e){for(var t in e)if(e.hasOwnProperty(t))return!1;return!0},s.format=function(e){for(var t=/%./g,r,n,i=0,o=[],s=0;r=t.exec(e);){n=e.substring(s,t.lastIndex-2),n.length>0&&o.push(n),s=t.lastIndex;var a=r[0][1];switch(a){case"s":case"o":i<arguments.length?o.push(arguments[1+i++]):o.push("<?>");break;case"%":o.push("%");break;default:o.push("<%"+a+"?>")}}return o.push(e.substring(s)),o.join("")},s.formatNumber=function(e,t,r,n){var i=e,o=isNaN(t=Math.abs(t))?2:t,s=void 0===r?",":r,a=void 0===n?".":n,u=i<0?"-":"",c=parseInt(i=Math.abs(+i||0).toFixed(o),10)+"",f=c.length>3?c.length%3:0;return u+(f?c.substr(0,f)+a:"")+c.substr(f).replace(/(\d{3})(?=\d)/g,"$1"+a)+(o?s+Math.abs(i-c).toFixed(o).slice(2):"")},s.formatSize=function(e){return e=e>=1073741824?s.formatNumber(e/1073741824,2,".","")+" GiB":e>=1048576?s.formatNumber(e/1048576,2,".","")+" MiB":e>=1024?s.formatNumber(e/1024,0)+" KiB":s.formatNumber(e,0)+" bytes",e},s.bytesFromIP=function(e){return-1!==e.indexOf(".")?s.bytesFromIPv4(e):-1!==e.indexOf(":")?s.bytesFromIPv6(e):null},s.bytesFromIPv4=function(e){if(e=e.split("."),4!==e.length)return null;for(var t=s.createBuffer(),r=0;r<e.length;++r){var n=parseInt(e[r],10);if(isNaN(n))return null;t.putByte(n)}return t.getBytes()},s.bytesFromIPv6=function(e){var t=0;e=e.split(":").filter(function(e){return 0===e.length&&++t,!0});for(var r=2*(8-e.length+t),n=s.createBuffer(),i=0;i<8;++i)if(e[i]&&0!==e[i].length){var o=s.hexToBytes(e[i]);o.length<2&&n.putByte(0),n.putBytes(o)}else n.fillWithByte(0,r),r=0;return n.getBytes()},s.bytesToIP=function(e){return 4===e.length?s.bytesToIPv4(e):16===e.length?s.bytesToIPv6(e):null},s.bytesToIPv4=function(e){if(4!==e.length)return null;for(var t=[],r=0;r<e.length;++r)t.push(e.charCodeAt(r));return t.join(".")},s.bytesToIPv6=function(e){if(16!==e.length)return null;for(var t=[],r=[],n=0,i=0;i<e.length;i+=2){for(var o=s.bytesToHex(e[i]+e[i+1]);"0"===o[0]&&"0"!==o;)o=o.substr(1);if("0"===o){var a=r[r.length-1],u=t.length;a&&u===a.end+1?(a.end=u,a.end-a.start>r[n].end-r[n].start&&(n=r.length-1)):r.push({start:u,end:u})}t.push(o)}if(r.length>0){var c=r[n];c.end-c.start>0&&(t.splice(c.start,c.end-c.start+1,""),0===c.start&&t.unshift(""),7===c.end&&t.push(""))}return t.join(":")},s.estimateCores=function(e,t){if("function"==typeof e&&(t=e,e={}),e=e||{},"cores"in s&&!e.update)return t(null,s.cores);if("undefined"!=typeof navigator&&"hardwareConcurrency"in navigator&&navigator.hardwareConcurrency>0)return s.cores=navigator.hardwareConcurrency,t(null,s.cores);if("undefined"==typeof Worker)return s.cores=1,t(null,s.cores);if("undefined"==typeof Blob)return s.cores=2,t(null,s.cores);var r=URL.createObjectURL(new Blob(["(",function(){self.addEventListener("message",function(e){for(var t=Date.now(),r=t+4;Date.now()<r;);self.postMessage({st:t,et:r})})}.toString(),")()"],{type:"application/javascript"}));function n(e,a,u){if(0===a){var c=Math.floor(e.reduce(function(e,t){return e+t},0)/e.length);return s.cores=Math.max(1,c),URL.revokeObjectURL(r),t(null,s.cores)}i(u,function(t,r){e.push(o(u,r)),n(e,a-1,u)})}function i(e,t){for(var n=[],i=[],o=0;o<e;++o){var s=new Worker(r);s.addEventListener("message",function(r){if(i.push(r.data),i.length===e){for(var o=0;o<e;++o)n[o].terminate();t(null,i)}}),n.push(s)}for(var o=0;o<e;++o)n[o].postMessage(o)}function o(e,t){for(var r=[],n=0;n<e;++n)for(var i=t[n],o=r[n]=[],s=0;s<e;++s)if(n!==s){var a=t[s];(i.st>a.st&&i.st<a.et||a.st>i.st&&a.st<i.et)&&o.push(s)}return r.reduce(function(e,t){return Math.max(e,t.length)},0)}n([],5,16)}}).call(this,r(6),r(0).Buffer)},function(e,t,r){"use strict";const n=t;n.bignum=r(56),n.define=r(910).define,n.base=r(139),n.constants=r(458),n.decoders=r(915),n.encoders=r(917)},function(e,t,r){var n=r(334),i="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";e.exports=n(i)},function(e,t,r){e.exports=r(11),r(100),r(897),r(77),r(256),r(451),r(182),r(899),r(137),r(900),r(453),r(901),r(450),r(258),r(114),r(446),r(448),r(902),r(440),r(447),r(444),r(260),r(63),r(445),r(903),r(904),r(439),r(16)},function(e,t,r){"use strict";var n=r(60),i=r(15);e.exports={checkState:function(e,t){if(!e)throw new n.InvalidState(t)},checkArgument:function(e,t,r,i){if(!e)throw new n.InvalidArgument(t,r,i)},checkArgumentType:function(e,t,o){if(o=o||"(unknown name)",i.isString(t)){if("Buffer"===t){var s=r(24);if(!s.isBuffer(e))throw new n.InvalidArgumentType(e,t,o)}else if(typeof e!==t)throw new n.InvalidArgumentType(e,t,o)}else if(!(e instanceof t))throw new n.InvalidArgumentType(e,t.name,o)}}},function(e,t,r){t=e.exports=r(326),t.Stream=t,t.Readable=t,t.Writable=r(207),t.Duplex=r(89),t.Transform=r(331),t.PassThrough=r(625)},function(e,t,r){
|
||
/** PROMISIFY CALLBACK-STYLE FUNCTIONS TO ES6 PROMISES
|
||
*
|
||
* EXAMPLE:
|
||
* const fn = promisify( (callback) => callback(null, "Hello world!") );
|
||
* fn((err, str) => console.log(str));
|
||
* fn().then((str) => console.log(str));
|
||
* //Both functions, will log 'Hello world!'
|
||
*
|
||
* Note: The function you pass, may have any arguments you want, but the latest
|
||
* have to be the callback, which you will call with: next(err, value)
|
||
*
|
||
* @param method: Function/Array/Map = The function(s) to promisify
|
||
* @param options: Map =
|
||
* "context" (default is function): The context which to apply the called function
|
||
* "replace" (default is falsy): When passed an array/map, if to replace the original object
|
||
*
|
||
* @return: A promise if passed a function, otherwise the object with the promises
|
||
*
|
||
* @license: MIT
|
||
* @version: 1.0.3
|
||
* @author: Manuel Di Iorio
|
||
**/
|
||
var n=function(e,t){return function(){var r=Array.prototype.slice.call(arguments),n=r.length-1,i=r&&r.length>0?r[n]:null,o="function"==typeof i?i:null;return o?e.apply(t,r):new Promise(function(n,i){r.push(function(e,t){if(e)return i(e);n(t)}),e.apply(t,r)})}};e.exports=function(e,t){t=t||{};var r=Object.prototype.toString.call(e);if("[object Object]"===r||"[object Array]"===r){var i=t.replace?e:{};for(var o in e)e.hasOwnProperty(o)&&(i[o]=n(e[o]));return i}return n(e,t.context||e)}},function(e,t,r){e.exports={encode:r(630),decode:r(631),encodingLength:r(632)}},function(e,t,r){"use strict";(function(t){var n=r(0),i=r(13),o=r(30),s=r(20);function a(e,t){if(e.length!==t.length)return!1;for(var r=e.length,n=0;n<r;n++)if(e[n]!==t[n])return!1;return!0}e.exports={fill:function e(t,r){s.checkArgumentType(t,"Buffer","buffer"),s.checkArgumentType(r,"number","value");for(var n=t.length,i=0;i<n;i++)t[i]=r;return t},copy:function(e){var r=new t(e.length);return e.copy(r),r},isBuffer:function e(t){return n.Buffer.isBuffer(t)||t instanceof Uint8Array},emptyBuffer:function e(t){s.checkArgumentType(t,"number","bytes");for(var r=new n.Buffer(t),i=0;i<t;i++)r.write("\0",i);return r},concat:n.Buffer.concat,equals:a,equal:a,integerAsSingleByteBuffer:function e(t){return s.checkArgumentType(t,"number","integer"),new n.Buffer([255&t])},integerAsBuffer:function e(r){s.checkArgumentType(r,"number","integer");var n=[];return n.push(r>>24&255),n.push(r>>16&255),n.push(r>>8&255),n.push(255&r),new t(n)},integerFromBuffer:function e(t){return s.checkArgumentType(t,"Buffer","buffer"),t[0]<<24|t[1]<<16|t[2]<<8|t[3]},integerFromSingleByteBuffer:function e(t){return s.checkArgumentType(t,"Buffer","buffer"),t[0]},bufferToHex:function e(t){return s.checkArgumentType(t,"Buffer","buffer"),t.toString("hex")},reverse:function e(t){for(var r=new n.Buffer(t.length),i=0;i<t.length;i++)r[i]=t[t.length-i-1];return r},hexToBuffer:function e(t){return i(o.isHexa(t)),new n.Buffer(t,"hex")}},e.exports.NULL_HASH=e.exports.fill(new t(32),0),e.exports.EMPTY_BUFFER=new t(0)}).call(this,r(0).Buffer)},function(e,t,r){var n=r(394),i=r(230),o=n.tfJSON,s=n.TfTypeError,a=n.TfPropertyTypeError,u=n.tfSubError,c=n.getValueTypeName,f={arrayOf:function e(t){function r(e,r){return!!i.Array(e)&&(!i.Nil(e)&&e.every(function(e,n){try{return h(t,e,r)}catch(e){throw u(e,n)}}))}return t=l(t),r.toJSON=function(){return"["+o(t)+"]"},r},maybe:function e(t){function r(r,n){return i.Nil(r)||t(r,n,e)}return t=l(t),r.toJSON=function(){return"?"+o(t)},r},map:function e(t,r){function n(e,n){if(!i.Object(e))return!1;if(i.Nil(e))return!1;for(var o in e){try{r&&h(r,o,n)}catch(e){throw u(e,o,"key")}try{var s=e[o];h(t,s,n)}catch(e){throw u(e,o)}}return!0}return t=l(t),r&&(r=l(r)),n.toJSON=r?function(){return"{"+o(r)+": "+o(t)+"}"}:function(){return"{"+o(t)+"}"},n},object:function e(t){var r={};for(var n in t)r[n]=l(t[n]);function s(e,t){if(!i.Object(e))return!1;if(i.Nil(e))return!1;var n;try{for(n in r){var o=r[n],s=e[n];h(o,s,t)}}catch(e){throw u(e,n)}if(t)for(n in e)if(!r[n])throw new a(void 0,n);return!0}return s.toJSON=function(){return o(r)},s},oneOf:function e(){var t=[].slice.call(arguments).map(l);function r(e,r){return t.some(function(t){try{return h(t,e,r)}catch(e){return!1}})}return r.toJSON=function(){return t.map(o).join("|")},r},quacksLike:function e(t){function r(e){return t===c(e)}return r.toJSON=function(){return t},r},tuple:function e(){var t=[].slice.call(arguments).map(l);function r(e,r){return!i.Nil(e)&&(!i.Nil(e.length)&&((!r||e.length===t.length)&&t.every(function(t,n){try{return h(t,e[n],r)}catch(e){throw u(e,n)}})))}return r.toJSON=function(){return"("+t.map(o).join(", ")+")"},r},value:function e(t){function r(e){return e===t}return r.toJSON=function(){return t},r}};function l(e){return i.String(e)?"?"===e[0]?f.maybe(e.slice(1)):i[e]||f.quacksLike(e):e&&i.Object(e)?i.Array(e)?f.arrayOf(e[0]):f.object(e):i.Function(e)?e:f.value(e)}function h(e,t,r,n){if(i.Function(e)){if(e(t,r))return!0;throw new s(n||e,t)}return h(l(e),t,r)}for(var p in i)h[p]=i[p];for(p in f)h[p]=f[p];var d=r(762);for(p in d)h[p]=d[p];function y(e,t,r,n){if("function"==typeof r)return y(e,t,!1,r);try{h(e,t,r)}catch(e){return n(e)}n()}h.async=y,h.compile=l,h.TfTypeError=s,h.TfPropertyTypeError=a,e.exports=h},function(e,t,r){"use strict";const n=r(353),i=r(679),o=r(219);t.Key=n,t.MemoryDatastore=i,t.utils=o},function(e,t){e.exports=n;var r=Object.prototype.hasOwnProperty;function n(){for(var e={},t=0;t<arguments.length;t++){var n=arguments[t];for(var i in n)r.call(n,i)&&(e[i]=n[i])}return e}},function(e,t){e.exports=function(e){return e.webpackPolyfill||(e.deprecate=function(){},e.paths=[],e.children||(e.children=[]),Object.defineProperty(e,"loaded",{enumerable:!0,get:function(){return e.l}}),Object.defineProperty(e,"id",{enumerable:!0,get:function(){return e.i}}),e.webpackPolyfill=1),e}},function(e,t,r){var n=r(2).Buffer,i=r(229),o=r(393),s=r(25),a=r(33),u=r(395),c=r(39),f=r(763),l=c.OP_RESERVED;function h(e){return a.Number(e)&&(e===c.OP_0||e>=c.OP_1&&e<=c.OP_16||e===c.OP_1NEGATE)}function p(e){return a.Buffer(e)||h(e)}function d(e){return a.Array(e)&&e.every(p)}function y(e){return 0===e.length?c.OP_0:1===e.length?e[0]>=1&&e[0]<=16?l+e[0]:129===e[0]?c.OP_1NEGATE:void 0:void 0}function g(e){if(n.isBuffer(e))return e;s(a.Array,e);var t=e.reduce(function(e,t){return n.isBuffer(t)?1===t.length&&void 0!==y(t)?e+1:e+o.encodingLength(t.length)+t.length:e+1},0),r=n.allocUnsafe(t),i=0;if(e.forEach(function(e){if(n.isBuffer(e)){var t=y(e);if(void 0!==t)return r.writeUInt8(t,i),void(i+=1);i+=o.encode(r,e.length,i),e.copy(r,i),i+=e.length}else r.writeUInt8(e,i),i+=1}),i!==r.length)throw new Error("Could not decode chunks");return r}function m(e){if(a.Array(e))return e;s(a.Buffer,e);for(var t=[],r=0;r<e.length;){var n=e[r];if(n>c.OP_0&&n<=c.OP_PUSHDATA4){var i=o.decode(e,r);if(null===i)return[];if(r+=i.size,r+i.number>e.length)return[];var u=e.slice(r,r+i.number);r+=i.number;var f=y(u);void 0!==f?t.push(f):t.push(u)}else t.push(n),r+=1}return t}function b(e){return n.isBuffer(e)&&(e=m(e)),e.map(function(e){if(n.isBuffer(e)){var t=y(e);if(void 0===t)return e.toString("hex");e=t}return f[e]}).join(" ")}function v(e){return s(a.String,e),g(e.split(" ").map(function(e){return void 0!==c[e]?c[e]:(s(a.Hex,e),n.from(e,"hex"))}))}function _(e){return e=m(e),s(d,e),e.map(function(e){return n.isBuffer(e)?e:e===c.OP_0?n.allocUnsafe(0):u.encode(e-l)})}function w(e){if(!n.isBuffer(e))return!1;if(e.length<33)return!1;switch(e[0]){case 2:case 3:return 33===e.length;case 4:return 65===e.length}return!1}function S(e){var t=-129&e;return t>0&&t<4}function k(e){return!!n.isBuffer(e)&&(!!S(e[e.length-1])&&i.check(e.slice(0,-1)))}e.exports={compile:g,decompile:m,fromASM:v,toASM:b,toStack:_,number:r(395),isCanonicalPubKey:w,isCanonicalSignature:k,isPushOnly:d,isDefinedHashType:S}},function(e,t,r){"use strict";var n=r(15),i=function e(t){return!!n.isString(t)&&/^[0-9a-fA-F]+$/.test(t)};e.exports={isValidJSON:function e(t){var r;if(!n.isString(t))return!1;try{r=JSON.parse(t)}catch(e){return!1}return"object"==typeof r},isHexa:i,isHexaString:i,cloneArray:function(e){return[].concat(e)},defineImmutable:function e(t,r){return Object.keys(r).forEach(function(e){Object.defineProperty(t,e,{configurable:!1,enumerable:!0,value:r[e]})}),t},isNaturalNumber:function e(t){return"number"==typeof t&&isFinite(t)&&Math.floor(t)===t&&t>=0}}},function(e,t,r){"use strict";(function(n){const i=r(79),o=r(27),s=r(966),a=r(271),u=r(23),c=r(18),f=r(73),l=new Error("Sorry, Not Implemented Yet."),h=f.proto(function(e){if(!(this instanceof h))return new h(e);if(null==e&&(e=""),e instanceof n)this.buffer=s.fromBuffer(e);else if("string"==typeof e||e instanceof String){if(e.length>0&&"/"!==e.charAt(0))throw new Error(`multiaddr "${e}" must start with a "/"`);this.buffer=s.fromString(e)}else{if(!(e.buffer&&e.protos&&e.protoCodes))throw new Error("addr must be a string, Buffer, or another Multiaddr");this.buffer=s.fromBuffer(e.buffer)}},{className:"Multiaddr",symbolName:"@multiformats/js-multiaddr/multiaddr"});h.prototype.toString=function e(){return s.bufferToString(this.buffer)},h.prototype.toOptions=function e(){const 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},h.prototype.inspect=function e(){return"<Multiaddr "+this.buffer.toString("hex")+" - "+s.bufferToString(this.buffer)+">"},h.prototype.protos=function e(){return i(this.protoCodes(),function(e){return o(a(e))})},h.prototype.protoCodes=function e(){const t=[],r=this.buffer;let n=0;for(;n<r.length;){const e=u.decode(r,n),i=u.decode.bytes,o=a(e),c=s.sizeForAddr(o,r.slice(n+i));n+=c+i,t.push(e)}return t},h.prototype.protoNames=function e(){return i(this.protos(),function(e){return e.name})},h.prototype.tuples=function e(){return s.bufferToTuples(this.buffer)},h.prototype.stringTuples=function e(){const t=s.bufferToTuples(this.buffer);return s.tuplesToStringTuples(t)},h.prototype.encapsulate=function e(t){return t=h(t),h(this.toString()+t.toString())},h.prototype.decapsulate=function e(t){t=t.toString();const r=this.toString(),n=r.lastIndexOf(t);if(n<0)throw new Error("Address "+this+" does not contain subaddress: "+t);return h(r.slice(0,n))},h.prototype.getPeerId=function e(){let t=null;try{t=this.stringTuples().filter(e=>{if(e[0]===a.names.ipfs.code)return!0})[0][1],c.decode(t)}catch(e){t=null}return t},h.prototype.equals=function e(t){return this.buffer.equals(t.buffer)},h.prototype.nodeAddress=function e(){const t=this.protoCodes(),r=this.protoNames(),n=this.toString().split("/").slice(1);if(n.length<4)throw new Error('multiaddr must have a valid format: "/{ip4, ip6, dns4, dns6}/{address}/{tcp, udp}/{port}".');if(4!==t[0]&&41!==t[0]&&54!==t[0]&&55!==t[0])throw new Error(`no protocol with name: "'${r[0]}'". Must have a valid family name: "{ip4, ip6, dns4, dns6}".`);if("tcp"!==n[2]&&"udp"!==n[2])throw new Error(`no protocol with name: "'${r[1]}'". Must have a valid transport protocol: "{tcp, udp}".`);return{family:41===t[0]||55===t[0]?6:4,address:n[1],port:n[3]}},h.fromNodeAddress=function e(t,r){if(!t)throw new Error("requires node address object");if(!r)throw new Error("requires transport protocol");const n="IPv6"===t.family?"ip6":"ip4";return h("/"+[n,t.address,r,t.port].join("/"))},h.prototype.isThinWaistAddress=function e(t){const r=(t||this).protos();return 2===r.length&&((4===r[0].code||41===r[0].code)&&(6===r[1].code||17===r[1].code))},h.prototype.fromStupidString=function e(t){throw l},h.protocols=a,h.isName=function e(t){return!!h.isMultiaddr(t)&&t.protos().some(e=>e.resolvable)},h.resolve=function e(t,r){return h.isMultiaddr(t)&&h.isName(t)?r(new Error("not implemented yet")):r(new Error("not a valid name"))},t=e.exports=h}).call(this,r(0).Buffer)},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.isAsync=void 0;var n=r(154),i=o(n);function o(e){return e&&e.__esModule?e:{default:e}}var s="function"==typeof Symbol;function a(e){return s&&"AsyncFunction"===e[Symbol.toStringTag]}function u(e){return a(e)?(0,i.default)(e):e}t.default=u,t.isAsync=a},function(e,t,r){var n=r(25),i=Math.pow(2,31)-1;function o(e){return n.UInt32(e)&&e<=i}function s(e){return n.String(e)&&e.match(/^(m\/)?(\d+'?\/)*\d+'?$/)}s.toJSON=function(){return"BIP32 derivation path"};var a=21e14;function u(e){return n.UInt53(e)&&e<=a}var c=n.quacksLike("BigInteger"),f=n.quacksLike("Point"),l=n.compile({r:c,s:c}),h=n.compile({messagePrefix:n.oneOf(n.Buffer,n.String),bip32:{public:n.UInt32,private:n.UInt32},pubKeyHash:n.UInt8,scriptHash:n.UInt8,wif:n.UInt8}),p={BigInt:c,BIP32Path:s,Buffer256bit:n.BufferN(32),ECPoint:f,ECSignature:l,Hash160bit:n.BufferN(20),Hash256bit:n.BufferN(32),Network:h,Satoshi:u,UInt31:o};for(var d in n)p[d]=n[d];e.exports=p},function(e,t,r){"use strict";(function(t){var n=r(75),i=r(20),o=r(15),s=function(e){for(var r=new t(e.length),n=0;n<e.length;n++)r[n]=e[e.length-1-n];return r};n.Zero=new n(0),n.One=new n(1),n.Minus1=new n(-1),n.fromNumber=function(e){return i.checkArgument(o.isNumber(e)),new n(e)},n.fromString=function(e,t){return i.checkArgument(o.isString(e)),new n(e,t)},n.fromBuffer=function(e,t){void 0!==t&&"little"===t.endian&&(e=s(e));var r=e.toString("hex"),i=new n(r,16);return i},n.fromSM=function(e,r){var i;if(0===e.length)return n.fromBuffer(new t([0]));var o="big";return r&&(o=r.endian),"little"===o&&(e=s(e)),128&e[0]?(e[0]=127&e[0],i=n.fromBuffer(e),i.neg().copy(i)):i=n.fromBuffer(e),i},n.prototype.toNumber=function(){return parseInt(this.toString(10),10)},n.prototype.toBuffer=function(e){var r,i;if(e&&e.size){i=this.toString(16,2);var o=i.length/2;r=new t(i,"hex"),o===e.size?r=r:o>e.size?r=n.trim(r,o):o<e.size&&(r=n.pad(r,o,e.size))}else i=this.toString(16,2),r=new t(i,"hex");return void 0!==e&&"little"===e.endian&&(r=s(r)),r},n.prototype.toSMBigEndian=function(){var e;return-1===this.cmp(n.Zero)?(e=this.neg().toBuffer(),128&e[0]?e=t.concat([new t([128]),e]):e[0]=128|e[0]):(e=this.toBuffer(),128&e[0]&&(e=t.concat([new t([0]),e]))),1===e.length&0===e[0]&&(e=new t([])),e},n.prototype.toSM=function(e){var t=e?e.endian:"big",r=this.toSMBigEndian();return"little"===t&&(r=s(r)),r},n.fromScriptNumBuffer=function(e,t,r){var o=r||4;if(i.checkArgument(e.length<=o,new Error("script number overflow")),t&&e.length>0&&0==(127&e[e.length-1])&&(e.length<=1||0==(128&e[e.length-2])))throw new Error("non-minimally encoded script number");return n.fromSM(e,{endian:"little"})},n.prototype.toScriptNumBuffer=function(){return this.toSM({endian:"little"})},n.prototype.gt=function(e){return this.cmp(e)>0},n.prototype.gte=function(e){return this.cmp(e)>=0},n.prototype.lt=function(e){return this.cmp(e)<0},n.trim=function(e,t){return e.slice(t-e.length,e.length)},n.pad=function(e,r,n){for(var i=new t(n),o=0;o<e.length;o++)i[i.length-1-o]=e[e.length-1-o];for(o=0;o<n-r;o++)i[o]=0;return i},e.exports=n}).call(this,r(0).Buffer)},function(e,t,r){var n=r(1121);function i(e){var t=function(){return t.called?t.value:(t.called=!0,t.value=e.apply(this,arguments))};return t.called=!1,t}function o(e){var t=function(){if(t.called)throw new Error(t.onceError);return t.called=!0,t.value=e.apply(this,arguments)},r=e.name||"Function wrapped with `once`";return t.onceError=r+" shouldn't be called more than once",t.called=!1,t}e.exports=n(i),e.exports.strict=n(o),i.proto=i(function(){Object.defineProperty(Function.prototype,"once",{value:function(){return i(this)},configurable:!0}),Object.defineProperty(Function.prototype,"onceStrict",{value:function(){return o(this)},configurable:!0})})},function(e,t,r){"use strict";var n=r(614),i=r(615);function o(){this.protocol=null,this.slashes=null,this.auth=null,this.host=null,this.port=null,this.hostname=null,this.hash=null,this.search=null,this.query=null,this.pathname=null,this.path=null,this.href=null}t.parse=w,t.resolve=k,t.resolveObject=E,t.format=S,t.Url=o;var s=/^([a-z0-9.+-]+:)/i,a=/:[0-9]*$/,u=/^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,c=["<",">",'"',"`"," ","\r","\n","\t"],f=["{","}","|","\\","^","`"].concat(c),l=["'"].concat(f),h=["%","/","?",";","#"].concat(l),p=["/","?","#"],d=255,y=/^[+a-z0-9A-Z_-]{0,63}$/,g=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,m={javascript:!0,"javascript:":!0},b={javascript:!0,"javascript:":!0},v={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},_=r(205);function w(e,t,r){if(e&&i.isObject(e)&&e instanceof o)return e;var n=new o;return n.parse(e,t,r),n}function S(e){return i.isString(e)&&(e=w(e)),e instanceof o?e.format():o.prototype.format.call(e)}function k(e,t){return w(e,!1,!0).resolve(t)}function E(e,t){return e?w(e,!1,!0).resolveObject(t):t}o.prototype.parse=function(e,t,r){if(!i.isString(e))throw new TypeError("Parameter 'url' must be a string, not "+typeof e);var o=e.indexOf("?"),a=-1!==o&&o<e.indexOf("#")?"?":"#",c=e.split(a),f=/\\/g;c[0]=c[0].replace(f,"/"),e=c.join(a);var d=e;if(d=d.trim(),!r&&1===e.split("#").length){var w=u.exec(d);if(w)return this.path=d,this.href=d,this.pathname=w[1],w[2]?(this.search=w[2],this.query=t?_.parse(this.search.substr(1)):this.search.substr(1)):t&&(this.search="",this.query={}),this}var S=s.exec(d);if(S){S=S[0];var k=S.toLowerCase();this.protocol=k,d=d.substr(S.length)}if(r||S||d.match(/^\/\/[^@\/]+@[^@\/]+/)){var E="//"===d.substr(0,2);!E||S&&b[S]||(d=d.substr(2),this.slashes=!0)}if(!b[S]&&(E||S&&!v[S])){for(var A=-1,x=0,I,T;x<p.length;x++){var B=d.indexOf(p[x]);-1!==B&&(-1===A||B<A)&&(A=B)}T=-1===A?d.lastIndexOf("@"):d.lastIndexOf("@",A),-1!==T&&(I=d.slice(0,T),d=d.slice(T+1),this.auth=decodeURIComponent(I)),A=-1;for(var x=0;x<h.length;x++){var B=d.indexOf(h[x]);-1!==B&&(-1===A||B<A)&&(A=B)}-1===A&&(A=d.length),this.host=d.slice(0,A),d=d.slice(A),this.parseHost(),this.hostname=this.hostname||"";var C="["===this.hostname[0]&&"]"===this.hostname[this.hostname.length-1];if(!C)for(var P=this.hostname.split(/\./),x=0,O=P.length;x<O;x++){var R=P[x];if(R&&!R.match(y)){for(var N="",L=0,j=R.length;L<j;L++)R.charCodeAt(L)>127?N+="x":N+=R[L];if(!N.match(y)){var M=P.slice(0,x),K=P.slice(x+1),D=R.match(g);D&&(M.push(D[1]),K.unshift(D[2])),K.length&&(d="/"+K.join(".")+d),this.hostname=M.join(".");break}}}this.hostname.length>255?this.hostname="":this.hostname=this.hostname.toLowerCase(),C||(this.hostname=n.toASCII(this.hostname));var U=this.port?":"+this.port:"",F=this.hostname||"";this.host=F+U,this.href+=this.host,C&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),"/"!==d[0]&&(d="/"+d))}if(!m[k])for(var x=0,O=l.length;x<O;x++){var q=l[x];if(-1!==d.indexOf(q)){var H=encodeURIComponent(q);H===q&&(H=escape(q)),d=d.split(q).join(H)}}var z=d.indexOf("#");-1!==z&&(this.hash=d.substr(z),d=d.slice(0,z));var V=d.indexOf("?");if(-1!==V?(this.search=d.substr(V),this.query=d.substr(V+1),t&&(this.query=_.parse(this.query)),d=d.slice(0,V)):t&&(this.search="",this.query={}),d&&(this.pathname=d),v[k]&&this.hostname&&!this.pathname&&(this.pathname="/"),this.pathname||this.search){var U=this.pathname||"",G=this.search||"";this.path=U+G}return this.href=this.format(),this},o.prototype.format=function(){var e=this.auth||"";e&&(e=encodeURIComponent(e),e=e.replace(/%3A/i,":"),e+="@");var t=this.protocol||"",r=this.pathname||"",n=this.hash||"",o=!1,s="";this.host?o=e+this.host:this.hostname&&(o=e+(-1===this.hostname.indexOf(":")?this.hostname:"["+this.hostname+"]"),this.port&&(o+=":"+this.port)),this.query&&i.isObject(this.query)&&Object.keys(this.query).length&&(s=_.stringify(this.query));var a=this.search||s&&"?"+s||"";return t&&":"!==t.substr(-1)&&(t+=":"),this.slashes||(!t||v[t])&&!1!==o?(o="//"+(o||""),r&&"/"!==r.charAt(0)&&(r="/"+r)):o||(o=""),n&&"#"!==n.charAt(0)&&(n="#"+n),a&&"?"!==a.charAt(0)&&(a="?"+a),r=r.replace(/[?#]/g,function(e){return encodeURIComponent(e)}),a=a.replace("#","%23"),t+o+r+a+n},o.prototype.resolve=function(e){return this.resolveObject(w(e,!1,!0)).format()},o.prototype.resolveObject=function(e){if(i.isString(e)){var t=new o;t.parse(e,!1,!0),e=t}for(var r=new o,n=Object.keys(this),s=0;s<n.length;s++){var a=n[s];r[a]=this[a]}if(r.hash=e.hash,""===e.href)return r.href=r.format(),r;if(e.slashes&&!e.protocol){for(var u=Object.keys(e),c=0;c<u.length;c++){var f=u[c];"protocol"!==f&&(r[f]=e[f])}return v[r.protocol]&&r.hostname&&!r.pathname&&(r.path=r.pathname="/"),r.href=r.format(),r}if(e.protocol&&e.protocol!==r.protocol){if(!v[e.protocol]){for(var l=Object.keys(e),h=0;h<l.length;h++){var p=l[h];r[p]=e[p]}return r.href=r.format(),r}if(r.protocol=e.protocol,e.host||b[e.protocol])r.pathname=e.pathname;else{for(var d=(e.pathname||"").split("/");d.length&&!(e.host=d.shift()););e.host||(e.host=""),e.hostname||(e.hostname=""),""!==d[0]&&d.unshift(""),d.length<2&&d.unshift(""),r.pathname=d.join("/")}if(r.search=e.search,r.query=e.query,r.host=e.host||"",r.auth=e.auth,r.hostname=e.hostname||e.host,r.port=e.port,r.pathname||r.search){var y=r.pathname||"",g=r.search||"";r.path=y+g}return r.slashes=r.slashes||e.slashes,r.href=r.format(),r}var m=r.pathname&&"/"===r.pathname.charAt(0),_=e.host||e.pathname&&"/"===e.pathname.charAt(0),w=_||m||r.host&&e.pathname,S=w,k=r.pathname&&r.pathname.split("/")||[],d=e.pathname&&e.pathname.split("/")||[],E=r.protocol&&!v[r.protocol];if(E&&(r.hostname="",r.port=null,r.host&&(""===k[0]?k[0]=r.host:k.unshift(r.host)),r.host="",e.protocol&&(e.hostname=null,e.port=null,e.host&&(""===d[0]?d[0]=e.host:d.unshift(e.host)),e.host=null),w=w&&(""===d[0]||""===k[0])),_)r.host=e.host||""===e.host?e.host:r.host,r.hostname=e.hostname||""===e.hostname?e.hostname:r.hostname,r.search=e.search,r.query=e.query,k=d;else if(d.length)k||(k=[]),k.pop(),k=k.concat(d),r.search=e.search,r.query=e.query;else if(!i.isNullOrUndefined(e.search)){if(E){r.hostname=r.host=k.shift();var A=!!(r.host&&r.host.indexOf("@")>0)&&r.host.split("@");A&&(r.auth=A.shift(),r.host=r.hostname=A.shift())}return r.search=e.search,r.query=e.query,i.isNull(r.pathname)&&i.isNull(r.search)||(r.path=(r.pathname?r.pathname:"")+(r.search?r.search:"")),r.href=r.format(),r}if(!k.length)return r.pathname=null,r.search?r.path="/"+r.search:r.path=null,r.href=r.format(),r;for(var x=k.slice(-1)[0],I=(r.host||e.host||k.length>1)&&("."===x||".."===x)||""===x,T=0,B=k.length;B>=0;B--)x=k[B],"."===x?k.splice(B,1):".."===x?(k.splice(B,1),T++):T&&(k.splice(B,1),T--);if(!w&&!S)for(;T--;T)k.unshift("..");!w||""===k[0]||k[0]&&"/"===k[0].charAt(0)||k.unshift(""),I&&"/"!==k.join("/").substr(-1)&&k.push("");var C=""===k[0]||k[0]&&"/"===k[0].charAt(0);if(E){r.hostname=r.host=C?"":k.length?k.shift():"";var A=!!(r.host&&r.host.indexOf("@")>0)&&r.host.split("@");A&&(r.auth=A.shift(),r.host=r.hostname=A.shift())}return w=w||r.host&&k.length,w&&!C&&k.unshift(""),k.length?r.pathname=k.join("/"):(r.pathname=null,r.path=null),i.isNull(r.pathname)&&i.isNull(r.search)||(r.path=(r.pathname?r.pathname:"")+(r.search?r.search:"")),r.auth=e.auth||r.auth,r.slashes=r.slashes||e.slashes,r.href=r.format(),r},o.prototype.parseHost=function(){var e=this.host,t=a.exec(e);t&&(t=t[0],":"!==t&&(this.port=t.substr(1)),e=e.substr(0,e.length-t.length)),e&&(this.hostname=e)}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=u;var n=r(346),i=a(n),o=r(215),s=a(o);function a(e){return e&&e.__esModule?e:{default:e}}function u(e,t){(0,i.default)(s.default,e,t)}e.exports=t.default},function(e,t,r){"use strict";const n=r(12),i=n(r(1063)),o=i.Data,s=["raw","directory","file","metadata","symlink","hamt-sharded-directory"],a=["directory","hamt-sharded-directory"];function u(e,t){if(!(this instanceof u))return new u(e,t);if(-1===s.indexOf(e))throw new Error("Type: "+e+" is not valid");this.type=e,this.data=t,this.blockSizes=[],this.addBlockSize=(e=>{this.blockSizes.push(e)}),this.removeBlockSize=(e=>{this.blockSizes.splice(e,1)}),this.fileSize=(()=>{if(a.indexOf(this.type)>=0)return;let e=0;return this.blockSizes.forEach(t=>{e+=t}),t&&(e+=t.length),e}),this.marshal=(()=>{let e;switch(this.type){case"raw":e=o.DataType.Raw;break;case"directory":e=o.DataType.Directory;break;case"file":e=o.DataType.File;break;case"metadata":e=o.DataType.Metadata;break;case"symlink":e=o.DataType.Symlink;break;case"hamt-sharded-directory":e=o.DataType.HAMTShard;break;default:throw new Error(`Unkown type: "${this.type}"`)}let t=this.fileSize(),r=this.data;this.data&&this.data.length||(r=void 0);let n=this.blockSizes;return this.blockSizes&&this.blockSizes.length||(n=void 0),o.encode({Type:e,Data:r,filesize:t,blocksizes:n,hashType:this.hashType,fanout:this.fanout})})}u.unmarshal=(e=>{const t=o.decode(e);t.Data||(t.Data=void 0);const r=new u(s[t.Type],t.Data);return r.blockSizes=t.blocksizes,r}),t=e.exports=u},function(e){e.exports={OP_FALSE:0,OP_0:0,OP_PUSHDATA1:76,OP_PUSHDATA2:77,OP_PUSHDATA4:78,OP_1NEGATE:79,OP_RESERVED:80,OP_TRUE:81,OP_1:81,OP_2:82,OP_3:83,OP_4:84,OP_5:85,OP_6:86,OP_7:87,OP_8:88,OP_9:89,OP_10:90,OP_11:91,OP_12:92,OP_13:93,OP_14:94,OP_15:95,OP_16:96,OP_NOP:97,OP_VER:98,OP_IF:99,OP_NOTIF:100,OP_VERIF:101,OP_VERNOTIF:102,OP_ELSE:103,OP_ENDIF:104,OP_VERIFY:105,OP_RETURN:106,OP_TOALTSTACK:107,OP_FROMALTSTACK:108,OP_2DROP:109,OP_2DUP:110,OP_3DUP:111,OP_2OVER:112,OP_2ROT:113,OP_2SWAP:114,OP_IFDUP:115,OP_DEPTH:116,OP_DROP:117,OP_DUP:118,OP_NIP:119,OP_OVER:120,OP_PICK:121,OP_ROLL:122,OP_ROT:123,OP_SWAP:124,OP_TUCK:125,OP_CAT:126,OP_SUBSTR:127,OP_LEFT:128,OP_RIGHT:129,OP_SIZE:130,OP_INVERT:131,OP_AND:132,OP_OR:133,OP_XOR:134,OP_EQUAL:135,OP_EQUALVERIFY:136,OP_RESERVED1:137,OP_RESERVED2:138,OP_1ADD:139,OP_1SUB:140,OP_2MUL:141,OP_2DIV:142,OP_NEGATE:143,OP_ABS:144,OP_NOT:145,OP_0NOTEQUAL:146,OP_ADD:147,OP_SUB:148,OP_MUL:149,OP_DIV:150,OP_MOD:151,OP_LSHIFT:152,OP_RSHIFT:153,OP_BOOLAND:154,OP_BOOLOR:155,OP_NUMEQUAL:156,OP_NUMEQUALVERIFY:157,OP_NUMNOTEQUAL:158,OP_LESSTHAN:159,OP_GREATERTHAN:160,OP_LESSTHANOREQUAL:161,OP_GREATERTHANOREQUAL:162,OP_MIN:163,OP_MAX:164,OP_WITHIN:165,OP_RIPEMD160:166,OP_SHA1:167,OP_SHA256:168,OP_HASH160:169,OP_HASH256:170,OP_CODESEPARATOR:171,OP_CHECKSIG:172,OP_CHECKSIGVERIFY:173,OP_CHECKMULTISIG:174,OP_CHECKMULTISIGVERIFY:175,OP_NOP1:176,OP_NOP2:177,OP_CHECKLOCKTIMEVERIFY:177,OP_NOP3:178,OP_CHECKSEQUENCEVERIFY:178,OP_NOP4:179,OP_NOP5:180,OP_NOP6:181,OP_NOP7:182,OP_NOP8:183,OP_NOP9:184,OP_NOP10:185,OP_PUBKEYHASH:253,OP_PUBKEY:254,OP_INVALIDOPCODE:255}},function(e,t,r){"use strict";(function(t){var n=r(97),i=r(24),o=r(20),s=e.exports;s.sha1=function(e){return o.checkArgument(i.isBuffer(e)),n.createHash("sha1").update(e).digest()},s.sha1.blocksize=512,s.sha256=function(e){return o.checkArgument(i.isBuffer(e)),n.createHash("sha256").update(e).digest()},s.sha256.blocksize=512,s.sha256sha256=function(e){return o.checkArgument(i.isBuffer(e)),s.sha256(s.sha256(e))},s.ripemd160=function(e){return o.checkArgument(i.isBuffer(e)),n.createHash("ripemd160").update(e).digest()},s.sha256ripemd160=function(e){return o.checkArgument(i.isBuffer(e)),s.ripemd160(s.sha256(e))},s.sha512=function(e){return o.checkArgument(i.isBuffer(e)),n.createHash("sha512").update(e).digest()},s.sha512.blocksize=1024,s.hmac=function(e,r,n){o.checkArgument(i.isBuffer(r)),o.checkArgument(i.isBuffer(n)),o.checkArgument(e.blocksize);var s=e.blocksize/8;if(n.length>s)n=e(n);else if(n<s){var a=new t(s);a.fill(0),n.copy(a),n=a}var u=new t(s);u.fill(92);var c=new t(s);c.fill(54);for(var f=new t(s),l=new t(s),h=0;h<s;h++)f[h]=u[h]^n[h],l[h]=c[h]^n[h];return e(t.concat([f,e(t.concat([l,r]))]))},s.sha256hmac=function(e,t){return s.hmac(s.sha256,e,t)},s.sha512hmac=function(e,t){return s.hmac(s.sha512,e,t)}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=f;var n=r(161),i=c(n),o=r(352),s=c(o),a=r(32),u=c(a);function c(e){return e&&e.__esModule?e:{default:e}}function f(e,t,r){(0,i.default)(e,(0,s.default)((0,u.default)(t)),r)}e.exports=t.default},function(e,t,r){"use strict";t.DAGNode=r(166),t.DAGLink=r(93),t.resolver=r(382),t.util=r(225)},function(e,t){function r(e,t){"function"==typeof e&&(t=e,e=!1);var r=[],n,i,o;function s(e,t){e&&(n=e,i&&f(n)),i=t,c()}function a(e){o=o||e||!0,c()}function u(e){o||(i?f(n,e):r.push(e))}return e?{push:u,end:a,source:s,buffer:r}:(s.push=u,s.end=a,s.buffer=r,s);function c(){i&&(n?f(n):!r.length&&o?f(o):r.length&&f(null,r.shift()))}function f(e,r){var n=i;if(e&&t){var o=t;t=null,o(!0===e?null:e)}i=null,n(e,r)}}e.exports=r},function(e,t,r){"use strict";t.Connection=r(1081)},function(e,t,r){"use strict";const n=r(147);e.exports={addLink:r(319),bufferPullStreamSource:r(1378),countStreamBytes:r(1379),createLock:r(1380),createNode:r(583),errors:r(584),formatCid:r(1395),limitStreamBytes:r(1396),loadNode:r(1397),toPullSource:r(1398),toSourcesAndDestination:r(1403),toSources:r(586),traverseTo:r(1404),updateMfsRoot:r(1406),updateTree:r(1407),validatePath:r(588),withMfsRoot:r(587),zeros:r(1408),FILE_SEPARATOR:n.FILE_SEPARATOR,MAX_CHUNK_SIZE:n.MAX_CHUNK_SIZE,MAX_LINKS:n.MAX_LINKS,FILE_TYPES:n.FILE_TYPES}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=u;var n=r(161),i=a(n),o=r(346),s=a(o);function a(e){return e&&e.__esModule?e:{default:e}}function u(e,t){(0,s.default)(i.default,e,t)}e.exports=t.default},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=h;var n=r(54),i=l(n),o=r(104),s=l(o),a=r(105),u=l(a),c=r(32),f=l(c);function l(e){return e&&e.__esModule?e:{default:e}}function h(e,t,r){r=(0,u.default)(r||i.default);var n=(0,f.default)(t);if(!e())return r(null);var o=function(t){if(t)return r(t);if(e())return n(o);var i=(0,s.default)(arguments,1);r.apply(null,[null].concat(i))};n(o)}e.exports=t.default},function(e,t,r){(function(n,i){var o;
|
||
/**
|
||
* [js-sha3]{@link https://github.com/emn178/js-sha3}
|
||
*
|
||
* @version 0.7.0
|
||
* @author Chen, Yi-Cyuan [emn178@gmail.com]
|
||
* @copyright Chen, Yi-Cyuan 2015-2017
|
||
* @license MIT
|
||
*/
|
||
/**
|
||
* [js-sha3]{@link https://github.com/emn178/js-sha3}
|
||
*
|
||
* @version 0.7.0
|
||
* @author Chen, Yi-Cyuan [emn178@gmail.com]
|
||
* @copyright Chen, Yi-Cyuan 2015-2017
|
||
* @license MIT
|
||
*/
|
||
!function(){"use strict";var s="input is invalid type",a="object"==typeof window,u=a?window:{};u.JS_SHA3_NO_WINDOW&&(a=!1);var c=!a&&"object"==typeof self,f=!u.JS_SHA3_NO_NODE_JS&&"object"==typeof n&&n.versions&&n.versions.node;f?u=i:c&&(u=self);var l=!u.JS_SHA3_NO_COMMON_JS&&"object"==typeof e&&e.exports,h=r(725),p=!u.JS_SHA3_NO_ARRAY_BUFFER&&"undefined"!=typeof ArrayBuffer,d="0123456789abcdef".split(""),y=[31,7936,2031616,520093696],g=[4,1024,262144,67108864],m=[1,256,65536,16777216],b=[6,1536,393216,100663296],v=[0,8,16,24],_=[1,0,32898,0,32906,2147483648,2147516416,2147483648,32907,0,2147483649,0,2147516545,2147483648,32777,2147483648,138,0,136,0,2147516425,0,2147483658,0,2147516555,0,139,2147483648,32905,2147483648,32771,2147483648,32770,2147483648,128,2147483648,32778,0,2147483658,2147483648,2147516545,2147483648,32896,2147483648,2147483649,0,2147516424,2147483648],w=[224,256,384,512],S=[128,256],k=["hex","buffer","arrayBuffer","array","digest"],E={128:168,256:136};!u.JS_SHA3_NO_NODE_JS&&Array.isArray||(Array.isArray=function(e){return"[object Array]"===Object.prototype.toString.call(e)}),!p||!u.JS_SHA3_NO_ARRAY_BUFFER_IS_VIEW&&ArrayBuffer.isView||(ArrayBuffer.isView=function(e){return"object"==typeof e&&e.buffer&&e.buffer.constructor===ArrayBuffer});for(var A=function(e,t,r){return function(n){return new H(e,t,e).update(n)[r]()}},x=function(e,t,r){return function(n,i){return new H(e,t,i).update(n)[r]()}},I=function(e,t,r){return function(t,n,i,o){return L["cshake"+e].update(t,n,i,o)[r]()}},T=function(e,t,r){return function(t,n,i,o){return L["kmac"+e].update(t,n,i,o)[r]()}},B=function(e,t,r,n){for(var i=0;i<k.length;++i){var o=k[i];e[o]=t(r,n,o)}return e},C=function(e,t){var r=A(e,t,"hex");return r.create=function(){return new H(e,t,e)},r.update=function(e){return r.create().update(e)},B(r,A,e,t)},P=function(e,t){var r=x(e,t,"hex");return r.create=function(r){return new H(e,t,r)},r.update=function(e,t){return r.create(t).update(e)},B(r,x,e,t)},O=function(e,t){var r=E[e],n=I(e,t,"hex");return n.create=function(n,i,o){return i||o?new H(e,t,n).bytepad([i,o],r):L["shake"+e].create(n)},n.update=function(e,t,r,i){return n.create(t,r,i).update(e)},B(n,I,e,t)},R=function(e,t){var r=E[e],n=T(e,t,"hex");return n.create=function(n,i,o){return new z(e,t,i).bytepad(["KMAC",o],r).bytepad([n],r)},n.update=function(e,t,r,i){return n.create(e,r,i).update(t)},B(n,T,e,t)},N=[{name:"keccak",padding:m,bits:w,createMethod:C},{name:"sha3",padding:b,bits:w,createMethod:C},{name:"shake",padding:y,bits:S,createMethod:P},{name:"cshake",padding:g,bits:S,createMethod:O},{name:"kmac",padding:g,bits:S,createMethod:R}],L={},j=[],M=0;M<N.length;++M)for(var K=N[M],D=K.bits,U=0;U<D.length;++U){var F=K.name+"_"+D[U];if(j.push(F),L[F]=K.createMethod(D[U],K.padding),"sha3"!==K.name){var q=K.name+D[U];j.push(q),L[q]=L[F]}}function H(e,t,r){this.blocks=[],this.s=[],this.padding=t,this.outputBits=r,this.reset=!0,this.finalized=!1,this.block=0,this.start=0,this.blockCount=1600-(e<<1)>>5,this.byteCount=this.blockCount<<2,this.outputBlocks=r>>5,this.extraBytes=(31&r)>>3;for(var n=0;n<50;++n)this.s[n]=0}function z(e,t,r){H.call(this,e,t,r)}H.prototype.update=function(e){if(!this.finalized){var t,r=typeof e;if("string"!==r){if("object"!==r)throw s;if(null===e)throw s;if(p&&e.constructor===ArrayBuffer)e=new Uint8Array(e);else if(!(Array.isArray(e)||p&&ArrayBuffer.isView(e)))throw s;t=!0}for(var n=this.blocks,i=this.byteCount,o=e.length,a=this.blockCount,u=0,c=this.s,f,l;u<o;){if(this.reset)for(this.reset=!1,n[0]=this.block,f=1;f<a+1;++f)n[f]=0;if(t)for(f=this.start;u<o&&f<i;++u)n[f>>2]|=e[u]<<v[3&f++];else for(f=this.start;u<o&&f<i;++u)l=e.charCodeAt(u),l<128?n[f>>2]|=l<<v[3&f++]:l<2048?(n[f>>2]|=(192|l>>6)<<v[3&f++],n[f>>2]|=(128|63&l)<<v[3&f++]):l<55296||l>=57344?(n[f>>2]|=(224|l>>12)<<v[3&f++],n[f>>2]|=(128|l>>6&63)<<v[3&f++],n[f>>2]|=(128|63&l)<<v[3&f++]):(l=65536+((1023&l)<<10|1023&e.charCodeAt(++u)),n[f>>2]|=(240|l>>18)<<v[3&f++],n[f>>2]|=(128|l>>12&63)<<v[3&f++],n[f>>2]|=(128|l>>6&63)<<v[3&f++],n[f>>2]|=(128|63&l)<<v[3&f++]);if(this.lastByteIndex=f,f>=i){for(this.start=f-i,this.block=n[a],f=0;f<a;++f)c[f]^=n[f];V(c),this.reset=!0}else this.start=f}return this}},H.prototype.encode=function(e,t){var r=255&e,n=1,i=[r];for(e>>=8,r=255&e;r>0;)i.unshift(r),e>>=8,r=255&e,++n;return t?i.push(n):i.unshift(n),this.update(i),i.length},H.prototype.encodeString=function(e){var t,r=typeof e;if("string"!==r){if("object"!==r)throw s;if(null===e)throw s;if(p&&e.constructor===ArrayBuffer)e=new Uint8Array(e);else if(!(Array.isArray(e)||p&&ArrayBuffer.isView(e)))throw s;t=!0}var n=0,i=e.length;if(t)n=i;else for(var o=0;o<e.length;++o){var a=e.charCodeAt(o);a<128?n+=1:a<2048?n+=2:a<55296||a>=57344?n+=3:(a=65536+((1023&a)<<10|1023&e.charCodeAt(++o)),n+=4)}return n+=this.encode(8*n),this.update(e),n},H.prototype.bytepad=function(e,t){for(var r=this.encode(t),n=0;n<e.length;++n)r+=this.encodeString(e[n]);var i=t-r%t,o=[];return o.length=i,this.update(o),this},H.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var e=this.blocks,t=this.lastByteIndex,r=this.blockCount,n=this.s;if(e[t>>2]|=this.padding[3&t],this.lastByteIndex===this.byteCount)for(e[0]=e[r],t=1;t<r+1;++t)e[t]=0;for(e[r-1]|=2147483648,t=0;t<r;++t)n[t]^=e[t];V(n)}},H.prototype.toString=H.prototype.hex=function(){this.finalize();for(var e=this.blockCount,t=this.s,r=this.outputBlocks,n=this.extraBytes,i=0,o=0,s="",a;o<r;){for(i=0;i<e&&o<r;++i,++o)a=t[i],s+=d[a>>4&15]+d[15&a]+d[a>>12&15]+d[a>>8&15]+d[a>>20&15]+d[a>>16&15]+d[a>>28&15]+d[a>>24&15];o%e==0&&(V(t),i=0)}return n&&(a=t[i],s+=d[a>>4&15]+d[15&a],n>1&&(s+=d[a>>12&15]+d[a>>8&15]),n>2&&(s+=d[a>>20&15]+d[a>>16&15])),s},H.prototype.arrayBuffer=function(){this.finalize();var e=this.blockCount,t=this.s,r=this.outputBlocks,n=this.extraBytes,i=0,o=0,s=this.outputBits>>3,a;a=n?new ArrayBuffer(r+1<<2):new ArrayBuffer(s);for(var u=new Uint32Array(a);o<r;){for(i=0;i<e&&o<r;++i,++o)u[o]=t[i];o%e==0&&V(t)}return n&&(u[i]=t[i],a=a.slice(0,s)),a},H.prototype.buffer=H.prototype.arrayBuffer,H.prototype.digest=H.prototype.array=function(){this.finalize();for(var e=this.blockCount,t=this.s,r=this.outputBlocks,n=this.extraBytes,i=0,o=0,s=[],a,u;o<r;){for(i=0;i<e&&o<r;++i,++o)a=o<<2,u=t[i],s[a]=255&u,s[a+1]=u>>8&255,s[a+2]=u>>16&255,s[a+3]=u>>24&255;o%e==0&&V(t)}return n&&(a=o<<2,u=t[i],s[a]=255&u,n>1&&(s[a+1]=u>>8&255),n>2&&(s[a+2]=u>>16&255)),s},z.prototype=new H,z.prototype.finalize=function(){return this.encode(this.outputBits,!0),H.prototype.finalize.call(this)};var V=function(e){var t,r,n,i,o,s,a,u,c,f,l,h,p,d,y,g,m,b,v,w,S,k,E,A,x,I,T,B,C,P,O,R,N,L,j,M,K,D,U,F,q,H,z,V,G,W,$,Y,J,X,Z,Q,ee,te,re,ne,ie,oe,se,ae,ue,ce,fe;for(n=0;n<48;n+=2)i=e[0]^e[10]^e[20]^e[30]^e[40],o=e[1]^e[11]^e[21]^e[31]^e[41],s=e[2]^e[12]^e[22]^e[32]^e[42],a=e[3]^e[13]^e[23]^e[33]^e[43],u=e[4]^e[14]^e[24]^e[34]^e[44],c=e[5]^e[15]^e[25]^e[35]^e[45],f=e[6]^e[16]^e[26]^e[36]^e[46],l=e[7]^e[17]^e[27]^e[37]^e[47],h=e[8]^e[18]^e[28]^e[38]^e[48],p=e[9]^e[19]^e[29]^e[39]^e[49],t=h^(s<<1|a>>>31),r=p^(a<<1|s>>>31),e[0]^=t,e[1]^=r,e[10]^=t,e[11]^=r,e[20]^=t,e[21]^=r,e[30]^=t,e[31]^=r,e[40]^=t,e[41]^=r,t=i^(u<<1|c>>>31),r=o^(c<<1|u>>>31),e[2]^=t,e[3]^=r,e[12]^=t,e[13]^=r,e[22]^=t,e[23]^=r,e[32]^=t,e[33]^=r,e[42]^=t,e[43]^=r,t=s^(f<<1|l>>>31),r=a^(l<<1|f>>>31),e[4]^=t,e[5]^=r,e[14]^=t,e[15]^=r,e[24]^=t,e[25]^=r,e[34]^=t,e[35]^=r,e[44]^=t,e[45]^=r,t=u^(h<<1|p>>>31),r=c^(p<<1|h>>>31),e[6]^=t,e[7]^=r,e[16]^=t,e[17]^=r,e[26]^=t,e[27]^=r,e[36]^=t,e[37]^=r,e[46]^=t,e[47]^=r,t=f^(i<<1|o>>>31),r=l^(o<<1|i>>>31),e[8]^=t,e[9]^=r,e[18]^=t,e[19]^=r,e[28]^=t,e[29]^=r,e[38]^=t,e[39]^=r,e[48]^=t,e[49]^=r,d=e[0],y=e[1],W=e[11]<<4|e[10]>>>28,$=e[10]<<4|e[11]>>>28,B=e[20]<<3|e[21]>>>29,C=e[21]<<3|e[20]>>>29,ae=e[31]<<9|e[30]>>>23,ue=e[30]<<9|e[31]>>>23,H=e[40]<<18|e[41]>>>14,z=e[41]<<18|e[40]>>>14,L=e[2]<<1|e[3]>>>31,j=e[3]<<1|e[2]>>>31,g=e[13]<<12|e[12]>>>20,m=e[12]<<12|e[13]>>>20,Y=e[22]<<10|e[23]>>>22,J=e[23]<<10|e[22]>>>22,P=e[33]<<13|e[32]>>>19,O=e[32]<<13|e[33]>>>19,ce=e[42]<<2|e[43]>>>30,fe=e[43]<<2|e[42]>>>30,te=e[5]<<30|e[4]>>>2,re=e[4]<<30|e[5]>>>2,M=e[14]<<6|e[15]>>>26,K=e[15]<<6|e[14]>>>26,b=e[25]<<11|e[24]>>>21,v=e[24]<<11|e[25]>>>21,X=e[34]<<15|e[35]>>>17,Z=e[35]<<15|e[34]>>>17,R=e[45]<<29|e[44]>>>3,N=e[44]<<29|e[45]>>>3,A=e[6]<<28|e[7]>>>4,x=e[7]<<28|e[6]>>>4,ne=e[17]<<23|e[16]>>>9,ie=e[16]<<23|e[17]>>>9,D=e[26]<<25|e[27]>>>7,U=e[27]<<25|e[26]>>>7,w=e[36]<<21|e[37]>>>11,S=e[37]<<21|e[36]>>>11,Q=e[47]<<24|e[46]>>>8,ee=e[46]<<24|e[47]>>>8,V=e[8]<<27|e[9]>>>5,G=e[9]<<27|e[8]>>>5,I=e[18]<<20|e[19]>>>12,T=e[19]<<20|e[18]>>>12,oe=e[29]<<7|e[28]>>>25,se=e[28]<<7|e[29]>>>25,F=e[38]<<8|e[39]>>>24,q=e[39]<<8|e[38]>>>24,k=e[48]<<14|e[49]>>>18,E=e[49]<<14|e[48]>>>18,e[0]=d^~g&b,e[1]=y^~m&v,e[10]=A^~I&B,e[11]=x^~T&C,e[20]=L^~M&D,e[21]=j^~K&U,e[30]=V^~W&Y,e[31]=G^~$&J,e[40]=te^~ne&oe,e[41]=re^~ie&se,e[2]=g^~b&w,e[3]=m^~v&S,e[12]=I^~B&P,e[13]=T^~C&O,e[22]=M^~D&F,e[23]=K^~U&q,e[32]=W^~Y&X,e[33]=$^~J&Z,e[42]=ne^~oe&ae,e[43]=ie^~se&ue,e[4]=b^~w&k,e[5]=v^~S&E,e[14]=B^~P&R,e[15]=C^~O&N,e[24]=D^~F&H,e[25]=U^~q&z,e[34]=Y^~X&Q,e[35]=J^~Z&ee,e[44]=oe^~ae&ce,e[45]=se^~ue&fe,e[6]=w^~k&d,e[7]=S^~E&y,e[16]=P^~R&A,e[17]=O^~N&x,e[26]=F^~H&L,e[27]=q^~z&j,e[36]=X^~Q&V,e[37]=Z^~ee&G,e[46]=ae^~ce&te,e[47]=ue^~fe&re,e[8]=k^~d&g,e[9]=E^~y&m,e[18]=R^~A&I,e[19]=N^~x&T,e[28]=H^~L&M,e[29]=z^~j&K,e[38]=Q^~V&W,e[39]=ee^~G&$,e[48]=ce^~te&ne,e[49]=fe^~re&ie,e[0]^=_[n],e[1]^=_[n+1]};if(l)e.exports=L;else{for(M=0;M<j.length;++M)u[j[M]]=L[j[M]];h&&(o=function(){return L}.call(t,r,t,e),void 0===o||(e.exports=o))}}()}).call(this,r(6),r(7))},function(e,t,r){e.exports=r(726)},function(e,t,r){(function(t){var n=r(728),i=r(380),o;function s(e,t){return"function"!=typeof t?e:e.then(function(e){o(function(){t(null,e)})},function(e){o(function(){t(e)})})}function a(e){return s(this,e)}function u(e){if(e&&i(e)){e.nodeify=a;var t=e.then;return e.then=function(){return u(t.apply(this,arguments))},e}"function"==typeof e?e.prototype.nodeify=a:n.prototype.nodeify=a}function c(e){if(!(this instanceof c))return new c(e);n.call(this,e),u(this)}o="function"==typeof setImmediate?setImmediate:"object"==typeof t&&t&&t.nextTick?t.nextTick:function(e){setTimeout(e,0)},e.exports=s,s.extend=u,s.Promise=c,c.prototype=Object.create(n.prototype),c.prototype.constructor=c}).call(this,r(6))},function(e,t,r){var n=r(730),i=r(731);e.exports={blake2b:n.blake2b,blake2bHex:n.blake2bHex,blake2bInit:n.blake2bInit,blake2bUpdate:n.blake2bUpdate,blake2bFinal:n.blake2bFinal,blake2s:i.blake2s,blake2sHex:i.blake2sHex,blake2sInit:i.blake2sInit,blake2sUpdate:i.blake2sUpdate,blake2sFinal:i.blake2sFinal}},function(e,t,r){"use strict";const n=r(936),i=r(473).ensureMultiaddr,o=r(962),s=r(13);class a{constructor(e){s(e,"Missing peerId. Use Peer.create(cb) to create one"),this.id=e,this.multiaddrs=new o,this.protocols=new Set,this._connectedMultiaddr=void 0}connect(e){if(e=i(e),!this.multiaddrs.has(e)&&e.toString()!==`/ipfs/${this.id.toB58String()}`)throw new Error("can't be connected to missing multiaddr from set");this._connectedMultiaddr=e}disconnect(){this._connectedMultiaddr=void 0}isConnected(){return this._connectedMultiaddr}}a.create=((e,t)=>{if("function"==typeof e)return t=e,e=null,void n.create((e,r)=>{if(e)return t(e);t(null,new a(r))});"function"==typeof e.toJSON?t(null,new a(e)):n.createFromJSON(e,(e,r)=>t(e,new a(r)))}),a.isPeerInfo=(e=>Boolean("object"==typeof e&&e.id&&e.multiaddrs)),e.exports=a},function(e,t,r){"use strict";const n=r(1042),i=r(1043);t.encode=n,t.decode=i.decode,t.decodeFromReader=i.decodeFromReader},function(e,t){function r(){}e.exports=r},function(e,t,r){(function(e){function r(e,t){for(var r=0,n=e.length-1;n>=0;n--){var i=e[n];"."===i?e.splice(n,1):".."===i?(e.splice(n,1),r++):r&&(e.splice(n,1),r--)}if(t)for(;r--;r)e.unshift("..");return e}var n=/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/,i=function(e){return n.exec(e).slice(1)};function o(e,t){if(e.filter)return e.filter(t);for(var r=[],n=0;n<e.length;n++)t(e[n],n,e)&&r.push(e[n]);return r}t.resolve=function(){for(var t="",n=!1,i=arguments.length-1;i>=-1&&!n;i--){var s=i>=0?arguments[i]:e.cwd();if("string"!=typeof s)throw new TypeError("Arguments to path.resolve must be strings");s&&(t=s+"/"+t,n="/"===s.charAt(0))}return t=r(o(t.split("/"),function(e){return!!e}),!n).join("/"),(n?"/":"")+t||"."},t.normalize=function(e){var n=t.isAbsolute(e),i="/"===s(e,-1);return e=r(o(e.split("/"),function(e){return!!e}),!n).join("/"),e||n||(e="."),e&&i&&(e+="/"),(n?"/":"")+e},t.isAbsolute=function(e){return"/"===e.charAt(0)},t.join=function(){var e=Array.prototype.slice.call(arguments,0);return t.normalize(o(e,function(e,t){if("string"!=typeof e)throw new TypeError("Arguments to path.join must be strings");return e}).join("/"))},t.relative=function(e,r){function n(e){for(var t=0;t<e.length&&""===e[t];t++);for(var r=e.length-1;r>=0&&""===e[r];r--);return t>r?[]:e.slice(t,r-t+1)}e=t.resolve(e).substr(1),r=t.resolve(r).substr(1);for(var i=n(e.split("/")),o=n(r.split("/")),s=Math.min(i.length,o.length),a=s,u=0;u<s;u++)if(i[u]!==o[u]){a=u;break}for(var c=[],u=a;u<i.length;u++)c.push("..");return c=c.concat(o.slice(a)),c.join("/")},t.sep="/",t.delimiter=":",t.dirname=function(e){var t=i(e),r=t[0],n=t[1];return r||n?(n&&(n=n.substr(0,n.length-1)),r+n):"."},t.basename=function(e,t){var r=i(e)[2];return t&&r.substr(-1*t.length)===t&&(r=r.substr(0,r.length-t.length)),r},t.extname=function(e){return i(e)[3]};var s="b"==="ab".substr(-1)?function(e,t,r){return e.substr(t,r)}:function(e,t,r){return t<0&&(t=e.length+t),e.substr(t,r)}}).call(this,r(6))},function(e,t,r){(function(e){!function(e,t){"use strict";function n(e,t){if(!e)throw new Error(t||"Assertion failed")}function i(e,t){e.super_=t;var r=function(){};r.prototype=t.prototype,e.prototype=new r,e.prototype.constructor=e}function o(e,t,r){if(o.isBN(e))return e;this.negative=0,this.words=null,this.length=0,this.red=null,null!==e&&("le"!==t&&"be"!==t||(r=t,t=10),this._init(e||0,t||10,r||"be"))}var s;"object"==typeof e?e.exports=o:t.BN=o,o.BN=o,o.wordSize=26;try{s=r(808).Buffer}catch(e){}function a(e,t,r){for(var n=0,i=Math.min(e.length,r),o=t;o<i;o++){var s=e.charCodeAt(o)-48;n<<=4,n|=s>=49&&s<=54?s-49+10:s>=17&&s<=22?s-17+10:15&s}return n}function u(e,t,r,n){for(var i=0,o=Math.min(e.length,r),s=t;s<o;s++){var a=e.charCodeAt(s)-48;i*=n,i+=a>=49?a-49+10:a>=17?a-17+10:a}return i}o.isBN=function e(t){return t instanceof o||null!==t&&"object"==typeof t&&t.constructor.wordSize===o.wordSize&&Array.isArray(t.words)},o.max=function e(t,r){return t.cmp(r)>0?t:r},o.min=function e(t,r){return t.cmp(r)<0?t:r},o.prototype._init=function e(t,r,i){if("number"==typeof t)return this._initNumber(t,r,i);if("object"==typeof t)return this._initArray(t,r,i);"hex"===r&&(r=16),n(r===(0|r)&&r>=2&&r<=36),t=t.toString().replace(/\s+/g,"");var o=0;"-"===t[0]&&o++,16===r?this._parseHex(t,o):this._parseBase(t,r,o),"-"===t[0]&&(this.negative=1),this.strip(),"le"===i&&this._initArray(this.toArray(),r,i)},o.prototype._initNumber=function e(t,r,i){t<0&&(this.negative=1,t=-t),t<67108864?(this.words=[67108863&t],this.length=1):t<4503599627370496?(this.words=[67108863&t,t/67108864&67108863],this.length=2):(n(t<9007199254740992),this.words=[67108863&t,t/67108864&67108863,1],this.length=3),"le"===i&&this._initArray(this.toArray(),r,i)},o.prototype._initArray=function e(t,r,i){if(n("number"==typeof t.length),t.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(t.length/3),this.words=new Array(this.length);for(var o=0;o<this.length;o++)this.words[o]=0;var s,a,u=0;if("be"===i)for(o=t.length-1,s=0;o>=0;o-=3)a=t[o]|t[o-1]<<8|t[o-2]<<16,this.words[s]|=a<<u&67108863,this.words[s+1]=a>>>26-u&67108863,u+=24,u>=26&&(u-=26,s++);else if("le"===i)for(o=0,s=0;o<t.length;o+=3)a=t[o]|t[o+1]<<8|t[o+2]<<16,this.words[s]|=a<<u&67108863,this.words[s+1]=a>>>26-u&67108863,u+=24,u>=26&&(u-=26,s++);return this.strip()},o.prototype._parseHex=function e(t,r){this.length=Math.ceil((t.length-r)/6),this.words=new Array(this.length);for(var n=0;n<this.length;n++)this.words[n]=0;var i,o,s=0;for(n=t.length-6,i=0;n>=r;n-=6)o=a(t,n,n+6),this.words[i]|=o<<s&67108863,this.words[i+1]|=o>>>26-s&4194303,s+=24,s>=26&&(s-=26,i++);n+6!==r&&(o=a(t,r,n+6),this.words[i]|=o<<s&67108863,this.words[i+1]|=o>>>26-s&4194303),this.strip()},o.prototype._parseBase=function e(t,r,n){this.words=[0],this.length=1;for(var i=0,o=1;o<=67108863;o*=r)i++;i--,o=o/r|0;for(var s=t.length-n,a=s%i,c=Math.min(s,s-a)+n,f=0,l=n;l<c;l+=i)f=u(t,l,l+i,r),this.imuln(o),this.words[0]+f<67108864?this.words[0]+=f:this._iaddn(f);if(0!==a){var h=1;for(f=u(t,l,t.length,r),l=0;l<a;l++)h*=r;this.imuln(h),this.words[0]+f<67108864?this.words[0]+=f:this._iaddn(f)}},o.prototype.copy=function e(t){t.words=new Array(this.length);for(var r=0;r<this.length;r++)t.words[r]=this.words[r];t.length=this.length,t.negative=this.negative,t.red=this.red},o.prototype.clone=function e(){var t=new o(null);return this.copy(t),t},o.prototype._expand=function e(t){for(;this.length<t;)this.words[this.length++]=0;return this},o.prototype.strip=function e(){for(;this.length>1&&0===this.words[this.length-1];)this.length--;return this._normSign()},o.prototype._normSign=function e(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},o.prototype.inspect=function e(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"};var c=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],f=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],l=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];function h(e){for(var t=new Array(e.bitLength()),r=0;r<t.length;r++){var n=r/26|0,i=r%26;t[r]=(e.words[n]&1<<i)>>>i}return t}function p(e,t,r){r.negative=t.negative^e.negative;var n=e.length+t.length|0;r.length=n,n=n-1|0;var i=0|e.words[0],o=0|t.words[0],s=i*o,a=67108863&s,u=s/67108864|0;r.words[0]=a;for(var c=1;c<n;c++){for(var f=u>>>26,l=67108863&u,h=Math.min(c,t.length-1),p=Math.max(0,c-e.length+1);p<=h;p++){var d=c-p|0;i=0|e.words[d],o=0|t.words[p],s=i*o+l,f+=s/67108864|0,l=67108863&s}r.words[c]=0|l,u=0|f}return 0!==u?r.words[c]=0|u:r.length--,r.strip()}o.prototype.toString=function e(t,r){var i;if(t=t||10,r=0|r||1,16===t||"hex"===t){i="";for(var o=0,s=0,a=0;a<this.length;a++){var u=this.words[a],h=(16777215&(u<<o|s)).toString(16);s=u>>>24-o&16777215,i=0!==s||a!==this.length-1?c[6-h.length]+h+i:h+i,o+=2,o>=26&&(o-=26,a--)}for(0!==s&&(i=s.toString(16)+i);i.length%r!=0;)i="0"+i;return 0!==this.negative&&(i="-"+i),i}if(t===(0|t)&&t>=2&&t<=36){var p=f[t],d=l[t];i="";var y=this.clone();for(y.negative=0;!y.isZero();){var g=y.modn(d).toString(t);y=y.idivn(d),i=y.isZero()?g+i:c[p-g.length]+g+i}for(this.isZero()&&(i="0"+i);i.length%r!=0;)i="0"+i;return 0!==this.negative&&(i="-"+i),i}n(!1,"Base should be between 2 and 36")},o.prototype.toNumber=function e(){var t=this.words[0];return 2===this.length?t+=67108864*this.words[1]:3===this.length&&1===this.words[2]?t+=4503599627370496+67108864*this.words[1]:this.length>2&&n(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-t:t},o.prototype.toJSON=function e(){return this.toString(16)},o.prototype.toBuffer=function e(t,r){return n(void 0!==s),this.toArrayLike(s,t,r)},o.prototype.toArray=function e(t,r){return this.toArrayLike(Array,t,r)},o.prototype.toArrayLike=function e(t,r,i){var o=this.byteLength(),s=i||Math.max(1,o);n(o<=s,"byte array longer than desired length"),n(s>0,"Requested array length <= 0"),this.strip();var a="le"===r,u=new t(s),c,f,l=this.clone();if(a){for(f=0;!l.isZero();f++)c=l.andln(255),l.iushrn(8),u[f]=c;for(;f<s;f++)u[f]=0}else{for(f=0;f<s-o;f++)u[f]=0;for(f=0;!l.isZero();f++)c=l.andln(255),l.iushrn(8),u[s-f-1]=c}return u},Math.clz32?o.prototype._countBits=function e(t){return 32-Math.clz32(t)}:o.prototype._countBits=function e(t){var r=t,n=0;return r>=4096&&(n+=13,r>>>=13),r>=64&&(n+=7,r>>>=7),r>=8&&(n+=4,r>>>=4),r>=2&&(n+=2,r>>>=2),n+r},o.prototype._zeroBits=function e(t){if(0===t)return 26;var r=t,n=0;return 0==(8191&r)&&(n+=13,r>>>=13),0==(127&r)&&(n+=7,r>>>=7),0==(15&r)&&(n+=4,r>>>=4),0==(3&r)&&(n+=2,r>>>=2),0==(1&r)&&n++,n},o.prototype.bitLength=function e(){var t=this.words[this.length-1],r=this._countBits(t);return 26*(this.length-1)+r},o.prototype.zeroBits=function e(){if(this.isZero())return 0;for(var t=0,r=0;r<this.length;r++){var n=this._zeroBits(this.words[r]);if(t+=n,26!==n)break}return t},o.prototype.byteLength=function e(){return Math.ceil(this.bitLength()/8)},o.prototype.toTwos=function e(t){return 0!==this.negative?this.abs().inotn(t).iaddn(1):this.clone()},o.prototype.fromTwos=function e(t){return this.testn(t-1)?this.notn(t).iaddn(1).ineg():this.clone()},o.prototype.isNeg=function e(){return 0!==this.negative},o.prototype.neg=function e(){return this.clone().ineg()},o.prototype.ineg=function e(){return this.isZero()||(this.negative^=1),this},o.prototype.iuor=function e(t){for(;this.length<t.length;)this.words[this.length++]=0;for(var r=0;r<t.length;r++)this.words[r]=this.words[r]|t.words[r];return this.strip()},o.prototype.ior=function e(t){return n(0==(this.negative|t.negative)),this.iuor(t)},o.prototype.or=function e(t){return this.length>t.length?this.clone().ior(t):t.clone().ior(this)},o.prototype.uor=function e(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},o.prototype.iuand=function e(t){var r;r=this.length>t.length?t:this;for(var n=0;n<r.length;n++)this.words[n]=this.words[n]&t.words[n];return this.length=r.length,this.strip()},o.prototype.iand=function e(t){return n(0==(this.negative|t.negative)),this.iuand(t)},o.prototype.and=function e(t){return this.length>t.length?this.clone().iand(t):t.clone().iand(this)},o.prototype.uand=function e(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},o.prototype.iuxor=function e(t){var r,n;this.length>t.length?(r=this,n=t):(r=t,n=this);for(var i=0;i<n.length;i++)this.words[i]=r.words[i]^n.words[i];if(this!==r)for(;i<r.length;i++)this.words[i]=r.words[i];return this.length=r.length,this.strip()},o.prototype.ixor=function e(t){return n(0==(this.negative|t.negative)),this.iuxor(t)},o.prototype.xor=function e(t){return this.length>t.length?this.clone().ixor(t):t.clone().ixor(this)},o.prototype.uxor=function e(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},o.prototype.inotn=function e(t){n("number"==typeof t&&t>=0);var r=0|Math.ceil(t/26),i=t%26;this._expand(r),i>0&&r--;for(var o=0;o<r;o++)this.words[o]=67108863&~this.words[o];return i>0&&(this.words[o]=~this.words[o]&67108863>>26-i),this.strip()},o.prototype.notn=function e(t){return this.clone().inotn(t)},o.prototype.setn=function e(t,r){n("number"==typeof t&&t>=0);var i=t/26|0,o=t%26;return this._expand(i+1),this.words[i]=r?this.words[i]|1<<o:this.words[i]&~(1<<o),this.strip()},o.prototype.iadd=function e(t){var r,n,i;if(0!==this.negative&&0===t.negative)return this.negative=0,r=this.isub(t),this.negative^=1,this._normSign();if(0===this.negative&&0!==t.negative)return t.negative=0,r=this.isub(t),t.negative=1,r._normSign();this.length>t.length?(n=this,i=t):(n=t,i=this);for(var o=0,s=0;s<i.length;s++)r=(0|n.words[s])+(0|i.words[s])+o,this.words[s]=67108863&r,o=r>>>26;for(;0!==o&&s<n.length;s++)r=(0|n.words[s])+o,this.words[s]=67108863&r,o=r>>>26;if(this.length=n.length,0!==o)this.words[this.length]=o,this.length++;else if(n!==this)for(;s<n.length;s++)this.words[s]=n.words[s];return this},o.prototype.add=function e(t){var r;return 0!==t.negative&&0===this.negative?(t.negative=0,r=this.sub(t),t.negative^=1,r):0===t.negative&&0!==this.negative?(this.negative=0,r=t.sub(this),this.negative=1,r):this.length>t.length?this.clone().iadd(t):t.clone().iadd(this)},o.prototype.isub=function e(t){if(0!==t.negative){t.negative=0;var r=this.iadd(t);return t.negative=1,r._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var n=this.cmp(t),i,o;if(0===n)return this.negative=0,this.length=1,this.words[0]=0,this;n>0?(i=this,o=t):(i=t,o=this);for(var s=0,a=0;a<o.length;a++)r=(0|i.words[a])-(0|o.words[a])+s,s=r>>26,this.words[a]=67108863&r;for(;0!==s&&a<i.length;a++)r=(0|i.words[a])+s,s=r>>26,this.words[a]=67108863&r;if(0===s&&a<i.length&&i!==this)for(;a<i.length;a++)this.words[a]=i.words[a];return this.length=Math.max(this.length,a),i!==this&&(this.negative=1),this.strip()},o.prototype.sub=function e(t){return this.clone().isub(t)};var d=function e(t,r,n){var i=t.words,o=r.words,s=n.words,a=0,u,c,f,l=0|i[0],h=8191&l,p=l>>>13,d=0|i[1],y=8191&d,g=d>>>13,m=0|i[2],b=8191&m,v=m>>>13,_=0|i[3],w=8191&_,S=_>>>13,k=0|i[4],E=8191&k,A=k>>>13,x=0|i[5],I=8191&x,T=x>>>13,B=0|i[6],C=8191&B,P=B>>>13,O=0|i[7],R=8191&O,N=O>>>13,L=0|i[8],j=8191&L,M=L>>>13,K=0|i[9],D=8191&K,U=K>>>13,F=0|o[0],q=8191&F,H=F>>>13,z=0|o[1],V=8191&z,G=z>>>13,W=0|o[2],$=8191&W,Y=W>>>13,J=0|o[3],X=8191&J,Z=J>>>13,Q=0|o[4],ee=8191&Q,te=Q>>>13,re=0|o[5],ne=8191&re,ie=re>>>13,oe=0|o[6],se=8191&oe,ae=oe>>>13,ue=0|o[7],ce=8191&ue,fe=ue>>>13,le=0|o[8],he=8191&le,pe=le>>>13,de=0|o[9],ye=8191&de,ge=de>>>13;n.negative=t.negative^r.negative,n.length=19,u=Math.imul(h,q),c=Math.imul(h,H),c=c+Math.imul(p,q)|0,f=Math.imul(p,H);var me=(a+u|0)+((8191&c)<<13)|0;a=(f+(c>>>13)|0)+(me>>>26)|0,me&=67108863,u=Math.imul(y,q),c=Math.imul(y,H),c=c+Math.imul(g,q)|0,f=Math.imul(g,H),u=u+Math.imul(h,V)|0,c=c+Math.imul(h,G)|0,c=c+Math.imul(p,V)|0,f=f+Math.imul(p,G)|0;var be=(a+u|0)+((8191&c)<<13)|0;a=(f+(c>>>13)|0)+(be>>>26)|0,be&=67108863,u=Math.imul(b,q),c=Math.imul(b,H),c=c+Math.imul(v,q)|0,f=Math.imul(v,H),u=u+Math.imul(y,V)|0,c=c+Math.imul(y,G)|0,c=c+Math.imul(g,V)|0,f=f+Math.imul(g,G)|0,u=u+Math.imul(h,$)|0,c=c+Math.imul(h,Y)|0,c=c+Math.imul(p,$)|0,f=f+Math.imul(p,Y)|0;var ve=(a+u|0)+((8191&c)<<13)|0;a=(f+(c>>>13)|0)+(ve>>>26)|0,ve&=67108863,u=Math.imul(w,q),c=Math.imul(w,H),c=c+Math.imul(S,q)|0,f=Math.imul(S,H),u=u+Math.imul(b,V)|0,c=c+Math.imul(b,G)|0,c=c+Math.imul(v,V)|0,f=f+Math.imul(v,G)|0,u=u+Math.imul(y,$)|0,c=c+Math.imul(y,Y)|0,c=c+Math.imul(g,$)|0,f=f+Math.imul(g,Y)|0,u=u+Math.imul(h,X)|0,c=c+Math.imul(h,Z)|0,c=c+Math.imul(p,X)|0,f=f+Math.imul(p,Z)|0;var _e=(a+u|0)+((8191&c)<<13)|0;a=(f+(c>>>13)|0)+(_e>>>26)|0,_e&=67108863,u=Math.imul(E,q),c=Math.imul(E,H),c=c+Math.imul(A,q)|0,f=Math.imul(A,H),u=u+Math.imul(w,V)|0,c=c+Math.imul(w,G)|0,c=c+Math.imul(S,V)|0,f=f+Math.imul(S,G)|0,u=u+Math.imul(b,$)|0,c=c+Math.imul(b,Y)|0,c=c+Math.imul(v,$)|0,f=f+Math.imul(v,Y)|0,u=u+Math.imul(y,X)|0,c=c+Math.imul(y,Z)|0,c=c+Math.imul(g,X)|0,f=f+Math.imul(g,Z)|0,u=u+Math.imul(h,ee)|0,c=c+Math.imul(h,te)|0,c=c+Math.imul(p,ee)|0,f=f+Math.imul(p,te)|0;var we=(a+u|0)+((8191&c)<<13)|0;a=(f+(c>>>13)|0)+(we>>>26)|0,we&=67108863,u=Math.imul(I,q),c=Math.imul(I,H),c=c+Math.imul(T,q)|0,f=Math.imul(T,H),u=u+Math.imul(E,V)|0,c=c+Math.imul(E,G)|0,c=c+Math.imul(A,V)|0,f=f+Math.imul(A,G)|0,u=u+Math.imul(w,$)|0,c=c+Math.imul(w,Y)|0,c=c+Math.imul(S,$)|0,f=f+Math.imul(S,Y)|0,u=u+Math.imul(b,X)|0,c=c+Math.imul(b,Z)|0,c=c+Math.imul(v,X)|0,f=f+Math.imul(v,Z)|0,u=u+Math.imul(y,ee)|0,c=c+Math.imul(y,te)|0,c=c+Math.imul(g,ee)|0,f=f+Math.imul(g,te)|0,u=u+Math.imul(h,ne)|0,c=c+Math.imul(h,ie)|0,c=c+Math.imul(p,ne)|0,f=f+Math.imul(p,ie)|0;var Se=(a+u|0)+((8191&c)<<13)|0;a=(f+(c>>>13)|0)+(Se>>>26)|0,Se&=67108863,u=Math.imul(C,q),c=Math.imul(C,H),c=c+Math.imul(P,q)|0,f=Math.imul(P,H),u=u+Math.imul(I,V)|0,c=c+Math.imul(I,G)|0,c=c+Math.imul(T,V)|0,f=f+Math.imul(T,G)|0,u=u+Math.imul(E,$)|0,c=c+Math.imul(E,Y)|0,c=c+Math.imul(A,$)|0,f=f+Math.imul(A,Y)|0,u=u+Math.imul(w,X)|0,c=c+Math.imul(w,Z)|0,c=c+Math.imul(S,X)|0,f=f+Math.imul(S,Z)|0,u=u+Math.imul(b,ee)|0,c=c+Math.imul(b,te)|0,c=c+Math.imul(v,ee)|0,f=f+Math.imul(v,te)|0,u=u+Math.imul(y,ne)|0,c=c+Math.imul(y,ie)|0,c=c+Math.imul(g,ne)|0,f=f+Math.imul(g,ie)|0,u=u+Math.imul(h,se)|0,c=c+Math.imul(h,ae)|0,c=c+Math.imul(p,se)|0,f=f+Math.imul(p,ae)|0;var ke=(a+u|0)+((8191&c)<<13)|0;a=(f+(c>>>13)|0)+(ke>>>26)|0,ke&=67108863,u=Math.imul(R,q),c=Math.imul(R,H),c=c+Math.imul(N,q)|0,f=Math.imul(N,H),u=u+Math.imul(C,V)|0,c=c+Math.imul(C,G)|0,c=c+Math.imul(P,V)|0,f=f+Math.imul(P,G)|0,u=u+Math.imul(I,$)|0,c=c+Math.imul(I,Y)|0,c=c+Math.imul(T,$)|0,f=f+Math.imul(T,Y)|0,u=u+Math.imul(E,X)|0,c=c+Math.imul(E,Z)|0,c=c+Math.imul(A,X)|0,f=f+Math.imul(A,Z)|0,u=u+Math.imul(w,ee)|0,c=c+Math.imul(w,te)|0,c=c+Math.imul(S,ee)|0,f=f+Math.imul(S,te)|0,u=u+Math.imul(b,ne)|0,c=c+Math.imul(b,ie)|0,c=c+Math.imul(v,ne)|0,f=f+Math.imul(v,ie)|0,u=u+Math.imul(y,se)|0,c=c+Math.imul(y,ae)|0,c=c+Math.imul(g,se)|0,f=f+Math.imul(g,ae)|0,u=u+Math.imul(h,ce)|0,c=c+Math.imul(h,fe)|0,c=c+Math.imul(p,ce)|0,f=f+Math.imul(p,fe)|0;var Ee=(a+u|0)+((8191&c)<<13)|0;a=(f+(c>>>13)|0)+(Ee>>>26)|0,Ee&=67108863,u=Math.imul(j,q),c=Math.imul(j,H),c=c+Math.imul(M,q)|0,f=Math.imul(M,H),u=u+Math.imul(R,V)|0,c=c+Math.imul(R,G)|0,c=c+Math.imul(N,V)|0,f=f+Math.imul(N,G)|0,u=u+Math.imul(C,$)|0,c=c+Math.imul(C,Y)|0,c=c+Math.imul(P,$)|0,f=f+Math.imul(P,Y)|0,u=u+Math.imul(I,X)|0,c=c+Math.imul(I,Z)|0,c=c+Math.imul(T,X)|0,f=f+Math.imul(T,Z)|0,u=u+Math.imul(E,ee)|0,c=c+Math.imul(E,te)|0,c=c+Math.imul(A,ee)|0,f=f+Math.imul(A,te)|0,u=u+Math.imul(w,ne)|0,c=c+Math.imul(w,ie)|0,c=c+Math.imul(S,ne)|0,f=f+Math.imul(S,ie)|0,u=u+Math.imul(b,se)|0,c=c+Math.imul(b,ae)|0,c=c+Math.imul(v,se)|0,f=f+Math.imul(v,ae)|0,u=u+Math.imul(y,ce)|0,c=c+Math.imul(y,fe)|0,c=c+Math.imul(g,ce)|0,f=f+Math.imul(g,fe)|0,u=u+Math.imul(h,he)|0,c=c+Math.imul(h,pe)|0,c=c+Math.imul(p,he)|0,f=f+Math.imul(p,pe)|0;var Ae=(a+u|0)+((8191&c)<<13)|0;a=(f+(c>>>13)|0)+(Ae>>>26)|0,Ae&=67108863,u=Math.imul(D,q),c=Math.imul(D,H),c=c+Math.imul(U,q)|0,f=Math.imul(U,H),u=u+Math.imul(j,V)|0,c=c+Math.imul(j,G)|0,c=c+Math.imul(M,V)|0,f=f+Math.imul(M,G)|0,u=u+Math.imul(R,$)|0,c=c+Math.imul(R,Y)|0,c=c+Math.imul(N,$)|0,f=f+Math.imul(N,Y)|0,u=u+Math.imul(C,X)|0,c=c+Math.imul(C,Z)|0,c=c+Math.imul(P,X)|0,f=f+Math.imul(P,Z)|0,u=u+Math.imul(I,ee)|0,c=c+Math.imul(I,te)|0,c=c+Math.imul(T,ee)|0,f=f+Math.imul(T,te)|0,u=u+Math.imul(E,ne)|0,c=c+Math.imul(E,ie)|0,c=c+Math.imul(A,ne)|0,f=f+Math.imul(A,ie)|0,u=u+Math.imul(w,se)|0,c=c+Math.imul(w,ae)|0,c=c+Math.imul(S,se)|0,f=f+Math.imul(S,ae)|0,u=u+Math.imul(b,ce)|0,c=c+Math.imul(b,fe)|0,c=c+Math.imul(v,ce)|0,f=f+Math.imul(v,fe)|0,u=u+Math.imul(y,he)|0,c=c+Math.imul(y,pe)|0,c=c+Math.imul(g,he)|0,f=f+Math.imul(g,pe)|0,u=u+Math.imul(h,ye)|0,c=c+Math.imul(h,ge)|0,c=c+Math.imul(p,ye)|0,f=f+Math.imul(p,ge)|0;var xe=(a+u|0)+((8191&c)<<13)|0;a=(f+(c>>>13)|0)+(xe>>>26)|0,xe&=67108863,u=Math.imul(D,V),c=Math.imul(D,G),c=c+Math.imul(U,V)|0,f=Math.imul(U,G),u=u+Math.imul(j,$)|0,c=c+Math.imul(j,Y)|0,c=c+Math.imul(M,$)|0,f=f+Math.imul(M,Y)|0,u=u+Math.imul(R,X)|0,c=c+Math.imul(R,Z)|0,c=c+Math.imul(N,X)|0,f=f+Math.imul(N,Z)|0,u=u+Math.imul(C,ee)|0,c=c+Math.imul(C,te)|0,c=c+Math.imul(P,ee)|0,f=f+Math.imul(P,te)|0,u=u+Math.imul(I,ne)|0,c=c+Math.imul(I,ie)|0,c=c+Math.imul(T,ne)|0,f=f+Math.imul(T,ie)|0,u=u+Math.imul(E,se)|0,c=c+Math.imul(E,ae)|0,c=c+Math.imul(A,se)|0,f=f+Math.imul(A,ae)|0,u=u+Math.imul(w,ce)|0,c=c+Math.imul(w,fe)|0,c=c+Math.imul(S,ce)|0,f=f+Math.imul(S,fe)|0,u=u+Math.imul(b,he)|0,c=c+Math.imul(b,pe)|0,c=c+Math.imul(v,he)|0,f=f+Math.imul(v,pe)|0,u=u+Math.imul(y,ye)|0,c=c+Math.imul(y,ge)|0,c=c+Math.imul(g,ye)|0,f=f+Math.imul(g,ge)|0;var Ie=(a+u|0)+((8191&c)<<13)|0;a=(f+(c>>>13)|0)+(Ie>>>26)|0,Ie&=67108863,u=Math.imul(D,$),c=Math.imul(D,Y),c=c+Math.imul(U,$)|0,f=Math.imul(U,Y),u=u+Math.imul(j,X)|0,c=c+Math.imul(j,Z)|0,c=c+Math.imul(M,X)|0,f=f+Math.imul(M,Z)|0,u=u+Math.imul(R,ee)|0,c=c+Math.imul(R,te)|0,c=c+Math.imul(N,ee)|0,f=f+Math.imul(N,te)|0,u=u+Math.imul(C,ne)|0,c=c+Math.imul(C,ie)|0,c=c+Math.imul(P,ne)|0,f=f+Math.imul(P,ie)|0,u=u+Math.imul(I,se)|0,c=c+Math.imul(I,ae)|0,c=c+Math.imul(T,se)|0,f=f+Math.imul(T,ae)|0,u=u+Math.imul(E,ce)|0,c=c+Math.imul(E,fe)|0,c=c+Math.imul(A,ce)|0,f=f+Math.imul(A,fe)|0,u=u+Math.imul(w,he)|0,c=c+Math.imul(w,pe)|0,c=c+Math.imul(S,he)|0,f=f+Math.imul(S,pe)|0,u=u+Math.imul(b,ye)|0,c=c+Math.imul(b,ge)|0,c=c+Math.imul(v,ye)|0,f=f+Math.imul(v,ge)|0;var Te=(a+u|0)+((8191&c)<<13)|0;a=(f+(c>>>13)|0)+(Te>>>26)|0,Te&=67108863,u=Math.imul(D,X),c=Math.imul(D,Z),c=c+Math.imul(U,X)|0,f=Math.imul(U,Z),u=u+Math.imul(j,ee)|0,c=c+Math.imul(j,te)|0,c=c+Math.imul(M,ee)|0,f=f+Math.imul(M,te)|0,u=u+Math.imul(R,ne)|0,c=c+Math.imul(R,ie)|0,c=c+Math.imul(N,ne)|0,f=f+Math.imul(N,ie)|0,u=u+Math.imul(C,se)|0,c=c+Math.imul(C,ae)|0,c=c+Math.imul(P,se)|0,f=f+Math.imul(P,ae)|0,u=u+Math.imul(I,ce)|0,c=c+Math.imul(I,fe)|0,c=c+Math.imul(T,ce)|0,f=f+Math.imul(T,fe)|0,u=u+Math.imul(E,he)|0,c=c+Math.imul(E,pe)|0,c=c+Math.imul(A,he)|0,f=f+Math.imul(A,pe)|0,u=u+Math.imul(w,ye)|0,c=c+Math.imul(w,ge)|0,c=c+Math.imul(S,ye)|0,f=f+Math.imul(S,ge)|0;var Be=(a+u|0)+((8191&c)<<13)|0;a=(f+(c>>>13)|0)+(Be>>>26)|0,Be&=67108863,u=Math.imul(D,ee),c=Math.imul(D,te),c=c+Math.imul(U,ee)|0,f=Math.imul(U,te),u=u+Math.imul(j,ne)|0,c=c+Math.imul(j,ie)|0,c=c+Math.imul(M,ne)|0,f=f+Math.imul(M,ie)|0,u=u+Math.imul(R,se)|0,c=c+Math.imul(R,ae)|0,c=c+Math.imul(N,se)|0,f=f+Math.imul(N,ae)|0,u=u+Math.imul(C,ce)|0,c=c+Math.imul(C,fe)|0,c=c+Math.imul(P,ce)|0,f=f+Math.imul(P,fe)|0,u=u+Math.imul(I,he)|0,c=c+Math.imul(I,pe)|0,c=c+Math.imul(T,he)|0,f=f+Math.imul(T,pe)|0,u=u+Math.imul(E,ye)|0,c=c+Math.imul(E,ge)|0,c=c+Math.imul(A,ye)|0,f=f+Math.imul(A,ge)|0;var Ce=(a+u|0)+((8191&c)<<13)|0;a=(f+(c>>>13)|0)+(Ce>>>26)|0,Ce&=67108863,u=Math.imul(D,ne),c=Math.imul(D,ie),c=c+Math.imul(U,ne)|0,f=Math.imul(U,ie),u=u+Math.imul(j,se)|0,c=c+Math.imul(j,ae)|0,c=c+Math.imul(M,se)|0,f=f+Math.imul(M,ae)|0,u=u+Math.imul(R,ce)|0,c=c+Math.imul(R,fe)|0,c=c+Math.imul(N,ce)|0,f=f+Math.imul(N,fe)|0,u=u+Math.imul(C,he)|0,c=c+Math.imul(C,pe)|0,c=c+Math.imul(P,he)|0,f=f+Math.imul(P,pe)|0,u=u+Math.imul(I,ye)|0,c=c+Math.imul(I,ge)|0,c=c+Math.imul(T,ye)|0,f=f+Math.imul(T,ge)|0;var Pe=(a+u|0)+((8191&c)<<13)|0;a=(f+(c>>>13)|0)+(Pe>>>26)|0,Pe&=67108863,u=Math.imul(D,se),c=Math.imul(D,ae),c=c+Math.imul(U,se)|0,f=Math.imul(U,ae),u=u+Math.imul(j,ce)|0,c=c+Math.imul(j,fe)|0,c=c+Math.imul(M,ce)|0,f=f+Math.imul(M,fe)|0,u=u+Math.imul(R,he)|0,c=c+Math.imul(R,pe)|0,c=c+Math.imul(N,he)|0,f=f+Math.imul(N,pe)|0,u=u+Math.imul(C,ye)|0,c=c+Math.imul(C,ge)|0,c=c+Math.imul(P,ye)|0,f=f+Math.imul(P,ge)|0;var Oe=(a+u|0)+((8191&c)<<13)|0;a=(f+(c>>>13)|0)+(Oe>>>26)|0,Oe&=67108863,u=Math.imul(D,ce),c=Math.imul(D,fe),c=c+Math.imul(U,ce)|0,f=Math.imul(U,fe),u=u+Math.imul(j,he)|0,c=c+Math.imul(j,pe)|0,c=c+Math.imul(M,he)|0,f=f+Math.imul(M,pe)|0,u=u+Math.imul(R,ye)|0,c=c+Math.imul(R,ge)|0,c=c+Math.imul(N,ye)|0,f=f+Math.imul(N,ge)|0;var Re=(a+u|0)+((8191&c)<<13)|0;a=(f+(c>>>13)|0)+(Re>>>26)|0,Re&=67108863,u=Math.imul(D,he),c=Math.imul(D,pe),c=c+Math.imul(U,he)|0,f=Math.imul(U,pe),u=u+Math.imul(j,ye)|0,c=c+Math.imul(j,ge)|0,c=c+Math.imul(M,ye)|0,f=f+Math.imul(M,ge)|0;var Ne=(a+u|0)+((8191&c)<<13)|0;a=(f+(c>>>13)|0)+(Ne>>>26)|0,Ne&=67108863,u=Math.imul(D,ye),c=Math.imul(D,ge),c=c+Math.imul(U,ye)|0,f=Math.imul(U,ge);var Le=(a+u|0)+((8191&c)<<13)|0;return a=(f+(c>>>13)|0)+(Le>>>26)|0,Le&=67108863,s[0]=me,s[1]=be,s[2]=ve,s[3]=_e,s[4]=we,s[5]=Se,s[6]=ke,s[7]=Ee,s[8]=Ae,s[9]=xe,s[10]=Ie,s[11]=Te,s[12]=Be,s[13]=Ce,s[14]=Pe,s[15]=Oe,s[16]=Re,s[17]=Ne,s[18]=Le,0!==a&&(s[19]=a,n.length++),n};function y(e,t,r){r.negative=t.negative^e.negative,r.length=e.length+t.length;for(var n=0,i=0,o=0;o<r.length-1;o++){var s=i;i=0;for(var a=67108863&n,u=Math.min(o,t.length-1),c=Math.max(0,o-e.length+1);c<=u;c++){var f=o-c,l=0|e.words[f],h=0|t.words[c],p=l*h,d=67108863&p;s=s+(p/67108864|0)|0,d=d+a|0,a=67108863&d,s=s+(d>>>26)|0,i+=s>>>26,s&=67108863}r.words[o]=a,n=s,s=i}return 0!==n?r.words[o]=n:r.length--,r.strip()}function g(e,t,r){var n=new m;return n.mulp(e,t,r)}function m(e,t){this.x=e,this.y=t}Math.imul||(d=p),o.prototype.mulTo=function e(t,r){var n,i=this.length+t.length;return n=10===this.length&&10===t.length?d(this,t,r):i<63?p(this,t,r):i<1024?y(this,t,r):g(this,t,r),n},m.prototype.makeRBT=function e(t){for(var r=new Array(t),n=o.prototype._countBits(t)-1,i=0;i<t;i++)r[i]=this.revBin(i,n,t);return r},m.prototype.revBin=function e(t,r,n){if(0===t||t===n-1)return t;for(var i=0,o=0;o<r;o++)i|=(1&t)<<r-o-1,t>>=1;return i},m.prototype.permute=function e(t,r,n,i,o,s){for(var a=0;a<s;a++)i[a]=r[t[a]],o[a]=n[t[a]]},m.prototype.transform=function e(t,r,n,i,o,s){this.permute(s,t,r,n,i,o);for(var a=1;a<o;a<<=1)for(var u=a<<1,c=Math.cos(2*Math.PI/u),f=Math.sin(2*Math.PI/u),l=0;l<o;l+=u)for(var h=c,p=f,d=0;d<a;d++){var y=n[l+d],g=i[l+d],m=n[l+d+a],b=i[l+d+a],v=h*m-p*b;b=h*b+p*m,m=v,n[l+d]=y+m,i[l+d]=g+b,n[l+d+a]=y-m,i[l+d+a]=g-b,d!==u&&(v=c*h-f*p,p=c*p+f*h,h=v)}},m.prototype.guessLen13b=function e(t,r){var n=1|Math.max(r,t),i=1&n,o=0;for(n=n/2|0;n;n>>>=1)o++;return 1<<o+1+i},m.prototype.conjugate=function e(t,r,n){if(!(n<=1))for(var i=0;i<n/2;i++){var o=t[i];t[i]=t[n-i-1],t[n-i-1]=o,o=r[i],r[i]=-r[n-i-1],r[n-i-1]=-o}},m.prototype.normalize13b=function e(t,r){for(var n=0,i=0;i<r/2;i++){var o=8192*Math.round(t[2*i+1]/r)+Math.round(t[2*i]/r)+n;t[i]=67108863&o,n=o<67108864?0:o/67108864|0}return t},m.prototype.convert13b=function e(t,r,i,o){for(var s=0,a=0;a<r;a++)s+=0|t[a],i[2*a]=8191&s,s>>>=13,i[2*a+1]=8191&s,s>>>=13;for(a=2*r;a<o;++a)i[a]=0;n(0===s),n(0==(-8192&s))},m.prototype.stub=function e(t){for(var r=new Array(t),n=0;n<t;n++)r[n]=0;return r},m.prototype.mulp=function e(t,r,n){var i=2*this.guessLen13b(t.length,r.length),o=this.makeRBT(i),s=this.stub(i),a=new Array(i),u=new Array(i),c=new Array(i),f=new Array(i),l=new Array(i),h=new Array(i),p=n.words;p.length=i,this.convert13b(t.words,t.length,a,i),this.convert13b(r.words,r.length,f,i),this.transform(a,s,u,c,i,o),this.transform(f,s,l,h,i,o);for(var d=0;d<i;d++){var y=u[d]*l[d]-c[d]*h[d];c[d]=u[d]*h[d]+c[d]*l[d],u[d]=y}return this.conjugate(u,c,i),this.transform(u,c,p,s,i,o),this.conjugate(p,s,i),this.normalize13b(p,i),n.negative=t.negative^r.negative,n.length=t.length+r.length,n.strip()},o.prototype.mul=function e(t){var r=new o(null);return r.words=new Array(this.length+t.length),this.mulTo(t,r)},o.prototype.mulf=function e(t){var r=new o(null);return r.words=new Array(this.length+t.length),g(this,t,r)},o.prototype.imul=function e(t){return this.clone().mulTo(t,this)},o.prototype.imuln=function e(t){n("number"==typeof t),n(t<67108864);for(var r=0,i=0;i<this.length;i++){var o=(0|this.words[i])*t,s=(67108863&o)+(67108863&r);r>>=26,r+=o/67108864|0,r+=s>>>26,this.words[i]=67108863&s}return 0!==r&&(this.words[i]=r,this.length++),this},o.prototype.muln=function e(t){return this.clone().imuln(t)},o.prototype.sqr=function e(){return this.mul(this)},o.prototype.isqr=function e(){return this.imul(this.clone())},o.prototype.pow=function e(t){var r=h(t);if(0===r.length)return new o(1);for(var n=this,i=0;i<r.length&&0===r[i];i++,n=n.sqr());if(++i<r.length)for(var s=n.sqr();i<r.length;i++,s=s.sqr())0!==r[i]&&(n=n.mul(s));return n},o.prototype.iushln=function e(t){n("number"==typeof t&&t>=0);var r=t%26,i=(t-r)/26,o=67108863>>>26-r<<26-r,s;if(0!==r){var a=0;for(s=0;s<this.length;s++){var u=this.words[s]&o,c=(0|this.words[s])-u<<r;this.words[s]=c|a,a=u>>>26-r}a&&(this.words[s]=a,this.length++)}if(0!==i){for(s=this.length-1;s>=0;s--)this.words[s+i]=this.words[s];for(s=0;s<i;s++)this.words[s]=0;this.length+=i}return this.strip()},o.prototype.ishln=function e(t){return n(0===this.negative),this.iushln(t)},o.prototype.iushrn=function e(t,r,i){var o;n("number"==typeof t&&t>=0),o=r?(r-r%26)/26:0;var s=t%26,a=Math.min((t-s)/26,this.length),u=67108863^67108863>>>s<<s,c=i;if(o-=a,o=Math.max(0,o),c){for(var f=0;f<a;f++)c.words[f]=this.words[f];c.length=a}if(0===a);else if(this.length>a)for(this.length-=a,f=0;f<this.length;f++)this.words[f]=this.words[f+a];else this.words[0]=0,this.length=1;var l=0;for(f=this.length-1;f>=0&&(0!==l||f>=o);f--){var h=0|this.words[f];this.words[f]=l<<26-s|h>>>s,l=h&u}return c&&0!==l&&(c.words[c.length++]=l),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},o.prototype.ishrn=function e(t,r,i){return n(0===this.negative),this.iushrn(t,r,i)},o.prototype.shln=function e(t){return this.clone().ishln(t)},o.prototype.ushln=function e(t){return this.clone().iushln(t)},o.prototype.shrn=function e(t){return this.clone().ishrn(t)},o.prototype.ushrn=function e(t){return this.clone().iushrn(t)},o.prototype.testn=function e(t){n("number"==typeof t&&t>=0);var r=t%26,i=(t-r)/26,o=1<<r;if(this.length<=i)return!1;var s=this.words[i];return!!(s&o)},o.prototype.imaskn=function e(t){n("number"==typeof t&&t>=0);var r=t%26,i=(t-r)/26;if(n(0===this.negative,"imaskn works only with positive numbers"),this.length<=i)return this;if(0!==r&&i++,this.length=Math.min(i,this.length),0!==r){var o=67108863^67108863>>>r<<r;this.words[this.length-1]&=o}return this.strip()},o.prototype.maskn=function e(t){return this.clone().imaskn(t)},o.prototype.iaddn=function e(t){return n("number"==typeof t),n(t<67108864),t<0?this.isubn(-t):0!==this.negative?1===this.length&&(0|this.words[0])<t?(this.words[0]=t-(0|this.words[0]),this.negative=0,this):(this.negative=0,this.isubn(t),this.negative=1,this):this._iaddn(t)},o.prototype._iaddn=function e(t){this.words[0]+=t;for(var r=0;r<this.length&&this.words[r]>=67108864;r++)this.words[r]-=67108864,r===this.length-1?this.words[r+1]=1:this.words[r+1]++;return this.length=Math.max(this.length,r+1),this},o.prototype.isubn=function e(t){if(n("number"==typeof t),n(t<67108864),t<0)return this.iaddn(-t);if(0!==this.negative)return this.negative=0,this.iaddn(t),this.negative=1,this;if(this.words[0]-=t,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var r=0;r<this.length&&this.words[r]<0;r++)this.words[r]+=67108864,this.words[r+1]-=1;return this.strip()},o.prototype.addn=function e(t){return this.clone().iaddn(t)},o.prototype.subn=function e(t){return this.clone().isubn(t)},o.prototype.iabs=function e(){return this.negative=0,this},o.prototype.abs=function e(){return this.clone().iabs()},o.prototype._ishlnsubmul=function e(t,r,i){var o=t.length+i,s,a;this._expand(o);var u=0;for(s=0;s<t.length;s++){a=(0|this.words[s+i])+u;var c=(0|t.words[s])*r;a-=67108863&c,u=(a>>26)-(c/67108864|0),this.words[s+i]=67108863&a}for(;s<this.length-i;s++)a=(0|this.words[s+i])+u,u=a>>26,this.words[s+i]=67108863&a;if(0===u)return this.strip();for(n(-1===u),u=0,s=0;s<this.length;s++)a=-(0|this.words[s])+u,u=a>>26,this.words[s]=67108863&a;return this.negative=1,this.strip()},o.prototype._wordDiv=function e(t,r){var n=this.length-t.length,i=this.clone(),s=t,a=0|s.words[s.length-1],u=this._countBits(a);n=26-u,0!==n&&(s=s.ushln(n),i.iushln(n),a=0|s.words[s.length-1]);var c=i.length-s.length,f;if("mod"!==r){f=new o(null),f.length=c+1,f.words=new Array(f.length);for(var l=0;l<f.length;l++)f.words[l]=0}var h=i.clone()._ishlnsubmul(s,1,c);0===h.negative&&(i=h,f&&(f.words[c]=1));for(var p=c-1;p>=0;p--){var d=67108864*(0|i.words[s.length+p])+(0|i.words[s.length+p-1]);for(d=Math.min(d/a|0,67108863),i._ishlnsubmul(s,d,p);0!==i.negative;)d--,i.negative=0,i._ishlnsubmul(s,1,p),i.isZero()||(i.negative^=1);f&&(f.words[p]=d)}return f&&f.strip(),i.strip(),"div"!==r&&0!==n&&i.iushrn(n),{div:f||null,mod:i}},o.prototype.divmod=function e(t,r,i){return n(!t.isZero()),this.isZero()?{div:new o(0),mod:new o(0)}:0!==this.negative&&0===t.negative?(u=this.neg().divmod(t,r),"mod"!==r&&(s=u.div.neg()),"div"!==r&&(a=u.mod.neg(),i&&0!==a.negative&&a.iadd(t)),{div:s,mod:a}):0===this.negative&&0!==t.negative?(u=this.divmod(t.neg(),r),"mod"!==r&&(s=u.div.neg()),{div:s,mod:u.mod}):0!=(this.negative&t.negative)?(u=this.neg().divmod(t.neg(),r),"div"!==r&&(a=u.mod.neg(),i&&0!==a.negative&&a.isub(t)),{div:u.div,mod:a}):t.length>this.length||this.cmp(t)<0?{div:new o(0),mod:this}:1===t.length?"div"===r?{div:this.divn(t.words[0]),mod:null}:"mod"===r?{div:null,mod:new o(this.modn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new o(this.modn(t.words[0]))}:this._wordDiv(t,r);var s,a,u},o.prototype.div=function e(t){return this.divmod(t,"div",!1).div},o.prototype.mod=function e(t){return this.divmod(t,"mod",!1).mod},o.prototype.umod=function e(t){return this.divmod(t,"mod",!0).mod},o.prototype.divRound=function e(t){var r=this.divmod(t);if(r.mod.isZero())return r.div;var n=0!==r.div.negative?r.mod.isub(t):r.mod,i=t.ushrn(1),o=t.andln(1),s=n.cmp(i);return s<0||1===o&&0===s?r.div:0!==r.div.negative?r.div.isubn(1):r.div.iaddn(1)},o.prototype.modn=function e(t){n(t<=67108863);for(var r=(1<<26)%t,i=0,o=this.length-1;o>=0;o--)i=(r*i+(0|this.words[o]))%t;return i},o.prototype.idivn=function e(t){n(t<=67108863);for(var r=0,i=this.length-1;i>=0;i--){var o=(0|this.words[i])+67108864*r;this.words[i]=o/t|0,r=o%t}return this.strip()},o.prototype.divn=function e(t){return this.clone().idivn(t)},o.prototype.egcd=function e(t){n(0===t.negative),n(!t.isZero());var r=this,i=t.clone();r=0!==r.negative?r.umod(t):r.clone();for(var s=new o(1),a=new o(0),u=new o(0),c=new o(1),f=0;r.isEven()&&i.isEven();)r.iushrn(1),i.iushrn(1),++f;for(var l=i.clone(),h=r.clone();!r.isZero();){for(var p=0,d=1;0==(r.words[0]&d)&&p<26;++p,d<<=1);if(p>0)for(r.iushrn(p);p-- >0;)(s.isOdd()||a.isOdd())&&(s.iadd(l),a.isub(h)),s.iushrn(1),a.iushrn(1);for(var y=0,g=1;0==(i.words[0]&g)&&y<26;++y,g<<=1);if(y>0)for(i.iushrn(y);y-- >0;)(u.isOdd()||c.isOdd())&&(u.iadd(l),c.isub(h)),u.iushrn(1),c.iushrn(1);r.cmp(i)>=0?(r.isub(i),s.isub(u),a.isub(c)):(i.isub(r),u.isub(s),c.isub(a))}return{a:u,b:c,gcd:i.iushln(f)}},o.prototype._invmp=function e(t){n(0===t.negative),n(!t.isZero());var r=this,i=t.clone();r=0!==r.negative?r.umod(t):r.clone();for(var s=new o(1),a=new o(0),u=i.clone(),c;r.cmpn(1)>0&&i.cmpn(1)>0;){for(var f=0,l=1;0==(r.words[0]&l)&&f<26;++f,l<<=1);if(f>0)for(r.iushrn(f);f-- >0;)s.isOdd()&&s.iadd(u),s.iushrn(1);for(var h=0,p=1;0==(i.words[0]&p)&&h<26;++h,p<<=1);if(h>0)for(i.iushrn(h);h-- >0;)a.isOdd()&&a.iadd(u),a.iushrn(1);r.cmp(i)>=0?(r.isub(i),s.isub(a)):(i.isub(r),a.isub(s))}return c=0===r.cmpn(1)?s:a,c.cmpn(0)<0&&c.iadd(t),c},o.prototype.gcd=function e(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var r=this.clone(),n=t.clone();r.negative=0,n.negative=0;for(var i=0;r.isEven()&&n.isEven();i++)r.iushrn(1),n.iushrn(1);for(;;){for(;r.isEven();)r.iushrn(1);for(;n.isEven();)n.iushrn(1);var o=r.cmp(n);if(o<0){var s=r;r=n,n=s}else if(0===o||0===n.cmpn(1))break;r.isub(n)}return n.iushln(i)},o.prototype.invm=function e(t){return this.egcd(t).a.umod(t)},o.prototype.isEven=function e(){return 0==(1&this.words[0])},o.prototype.isOdd=function e(){return 1==(1&this.words[0])},o.prototype.andln=function e(t){return this.words[0]&t},o.prototype.bincn=function e(t){n("number"==typeof t);var r=t%26,i=(t-r)/26,o=1<<r;if(this.length<=i)return this._expand(i+1),this.words[i]|=o,this;for(var s=o,a=i;0!==s&&a<this.length;a++){var u=0|this.words[a];u+=s,s=u>>>26,u&=67108863,this.words[a]=u}return 0!==s&&(this.words[a]=s,this.length++),this},o.prototype.isZero=function e(){return 1===this.length&&0===this.words[0]},o.prototype.cmpn=function e(t){var r=t<0,i;if(0!==this.negative&&!r)return-1;if(0===this.negative&&r)return 1;if(this.strip(),this.length>1)i=1;else{r&&(t=-t),n(t<=67108863,"Number is too big");var o=0|this.words[0];i=o===t?0:o<t?-1:1}return 0!==this.negative?0|-i:i},o.prototype.cmp=function e(t){if(0!==this.negative&&0===t.negative)return-1;if(0===this.negative&&0!==t.negative)return 1;var r=this.ucmp(t);return 0!==this.negative?0|-r:r},o.prototype.ucmp=function e(t){if(this.length>t.length)return 1;if(this.length<t.length)return-1;for(var r=0,n=this.length-1;n>=0;n--){var i=0|this.words[n],o=0|t.words[n];if(i!==o){i<o?r=-1:i>o&&(r=1);break}}return r},o.prototype.gtn=function e(t){return 1===this.cmpn(t)},o.prototype.gt=function e(t){return 1===this.cmp(t)},o.prototype.gten=function e(t){return this.cmpn(t)>=0},o.prototype.gte=function e(t){return this.cmp(t)>=0},o.prototype.ltn=function e(t){return-1===this.cmpn(t)},o.prototype.lt=function e(t){return-1===this.cmp(t)},o.prototype.lten=function e(t){return this.cmpn(t)<=0},o.prototype.lte=function e(t){return this.cmp(t)<=0},o.prototype.eqn=function e(t){return 0===this.cmpn(t)},o.prototype.eq=function e(t){return 0===this.cmp(t)},o.red=function e(t){return new E(t)},o.prototype.toRed=function e(t){return n(!this.red,"Already a number in reduction context"),n(0===this.negative,"red works only with positives"),t.convertTo(this)._forceRed(t)},o.prototype.fromRed=function e(){return n(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},o.prototype._forceRed=function e(t){return this.red=t,this},o.prototype.forceRed=function e(t){return n(!this.red,"Already a number in reduction context"),this._forceRed(t)},o.prototype.redAdd=function e(t){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},o.prototype.redIAdd=function e(t){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},o.prototype.redSub=function e(t){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},o.prototype.redISub=function e(t){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},o.prototype.redShl=function e(t){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},o.prototype.redMul=function e(t){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},o.prototype.redIMul=function e(t){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},o.prototype.redSqr=function e(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},o.prototype.redISqr=function e(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},o.prototype.redSqrt=function e(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},o.prototype.redInvm=function e(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},o.prototype.redNeg=function e(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},o.prototype.redPow=function e(t){return n(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var b={k256:null,p224:null,p192:null,p25519:null};function v(e,t){this.name=e,this.p=new o(t,16),this.n=this.p.bitLength(),this.k=new o(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function _(){v.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function w(){v.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function S(){v.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function k(){v.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function E(e){if("string"==typeof e){var t=o._prime(e);this.m=t.p,this.prime=t}else n(e.gtn(1),"modulus must be greater than 1"),this.m=e,this.prime=null}function A(e){E.call(this,e),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new o(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}v.prototype._tmp=function e(){var t=new o(null);return t.words=new Array(Math.ceil(this.n/13)),t},v.prototype.ireduce=function e(t){var r=t,n;do{this.split(r,this.tmp),r=this.imulK(r),r=r.iadd(this.tmp),n=r.bitLength()}while(n>this.n);var i=n<this.n?-1:r.ucmp(this.p);return 0===i?(r.words[0]=0,r.length=1):i>0?r.isub(this.p):r.strip(),r},v.prototype.split=function e(t,r){t.iushrn(this.n,0,r)},v.prototype.imulK=function e(t){return t.imul(this.k)},i(_,v),_.prototype.split=function e(t,r){for(var n=4194303,i=Math.min(t.length,9),o=0;o<i;o++)r.words[o]=t.words[o];if(r.length=i,t.length<=9)return t.words[0]=0,void(t.length=1);var s=t.words[9];for(r.words[r.length++]=s&n,o=10;o<t.length;o++){var a=0|t.words[o];t.words[o-10]=(a&n)<<4|s>>>22,s=a}s>>>=22,t.words[o-10]=s,0===s&&t.length>10?t.length-=10:t.length-=9},_.prototype.imulK=function e(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var r=0,n=0;n<t.length;n++){var i=0|t.words[n];r+=977*i,t.words[n]=67108863&r,r=64*i+(r/67108864|0)}return 0===t.words[t.length-1]&&(t.length--,0===t.words[t.length-1]&&t.length--),t},i(w,v),i(S,v),i(k,v),k.prototype.imulK=function e(t){for(var r=0,n=0;n<t.length;n++){var i=19*(0|t.words[n])+r,o=67108863&i;i>>>=26,t.words[n]=o,r=i}return 0!==r&&(t.words[t.length++]=r),t},o._prime=function e(t){if(b[t])return b[t];var e;if("k256"===t)e=new _;else if("p224"===t)e=new w;else if("p192"===t)e=new S;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new k}return b[t]=e,e},E.prototype._verify1=function e(t){n(0===t.negative,"red works only with positives"),n(t.red,"red works only with red numbers")},E.prototype._verify2=function e(t,r){n(0==(t.negative|r.negative),"red works only with positives"),n(t.red&&t.red===r.red,"red works only with red numbers")},E.prototype.imod=function e(t){return this.prime?this.prime.ireduce(t)._forceRed(this):t.umod(this.m)._forceRed(this)},E.prototype.neg=function e(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},E.prototype.add=function e(t,r){this._verify2(t,r);var n=t.add(r);return n.cmp(this.m)>=0&&n.isub(this.m),n._forceRed(this)},E.prototype.iadd=function e(t,r){this._verify2(t,r);var n=t.iadd(r);return n.cmp(this.m)>=0&&n.isub(this.m),n},E.prototype.sub=function e(t,r){this._verify2(t,r);var n=t.sub(r);return n.cmpn(0)<0&&n.iadd(this.m),n._forceRed(this)},E.prototype.isub=function e(t,r){this._verify2(t,r);var n=t.isub(r);return n.cmpn(0)<0&&n.iadd(this.m),n},E.prototype.shl=function e(t,r){return this._verify1(t),this.imod(t.ushln(r))},E.prototype.imul=function e(t,r){return this._verify2(t,r),this.imod(t.imul(r))},E.prototype.mul=function e(t,r){return this._verify2(t,r),this.imod(t.mul(r))},E.prototype.isqr=function e(t){return this.imul(t,t.clone())},E.prototype.sqr=function e(t){return this.mul(t,t)},E.prototype.sqrt=function e(t){if(t.isZero())return t.clone();var r=this.m.andln(3);if(n(r%2==1),3===r){var i=this.m.add(new o(1)).iushrn(2);return this.pow(t,i)}for(var s=this.m.subn(1),a=0;!s.isZero()&&0===s.andln(1);)a++,s.iushrn(1);n(!s.isZero());var u=new o(1).toRed(this),c=u.redNeg(),f=this.m.subn(1).iushrn(1),l=this.m.bitLength();for(l=new o(2*l*l).toRed(this);0!==this.pow(l,f).cmp(c);)l.redIAdd(c);for(var h=this.pow(l,s),p=this.pow(t,s.addn(1).iushrn(1)),d=this.pow(t,s),y=a;0!==d.cmp(u);){for(var g=d,m=0;0!==g.cmp(u);m++)g=g.redSqr();n(m<y);var b=this.pow(h,new o(1).iushln(y-m-1));p=p.redMul(b),h=b.redSqr(),d=d.redMul(h),y=m}return p},E.prototype.invm=function e(t){var r=t._invmp(this.m);return 0!==r.negative?(r.negative=0,this.imod(r).redNeg()):this.imod(r)},E.prototype.pow=function e(t,r){if(r.isZero())return new o(1).toRed(this);if(0===r.cmpn(1))return t.clone();var n=4,i=new Array(16);i[0]=new o(1).toRed(this),i[1]=t;for(var s=2;s<i.length;s++)i[s]=this.mul(i[s-1],t);var a=i[0],u=0,c=0,f=r.bitLength()%26;for(0===f&&(f=26),s=r.length-1;s>=0;s--){for(var l=r.words[s],h=f-1;h>=0;h--){var p=l>>h&1;a!==i[0]&&(a=this.sqr(a)),0!==p||0!==u?(u<<=1,u|=p,c++,(4===c||0===s&&0===h)&&(a=this.mul(a,i[u]),c=0,u=0)):c=0}f=26}return a},E.prototype.convertTo=function e(t){var r=t.umod(this.m);return r===t?r.clone():r},E.prototype.convertFrom=function e(t){var r=t.clone();return r.red=null,r},o.mont=function e(t){return new A(t)},i(A,E),A.prototype.convertTo=function e(t){return this.imod(t.ushln(this.shift))},A.prototype.convertFrom=function e(t){var r=this.imod(t.mul(this.rinv));return r.red=null,r},A.prototype.imul=function e(t,r){if(t.isZero()||r.isZero())return t.words[0]=0,t.length=1,t;var n=t.imul(r),i=n.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),o=n.isub(i).iushrn(this.shift),s=o;return o.cmp(this.m)>=0?s=o.isub(this.m):o.cmpn(0)<0&&(s=o.iadd(this.m)),s._forceRed(this)},A.prototype.mul=function e(t,r){if(t.isZero()||r.isZero())return new o(0)._forceRed(this);var n=t.mul(r),i=n.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),s=n.isub(i).iushrn(this.shift),a=s;return s.cmp(this.m)>=0?a=s.isub(this.m):s.cmpn(0)<0&&(a=s.iadd(this.m)),a._forceRed(this)},A.prototype.invm=function e(t){var r=this.imod(t._invmp(this.m).mul(this.r2));return r._forceRed(this)}}(void 0===e||e,this)}).call(this,r(28)(e))},function(e,t,r){"use strict";var n=t;n.version=r(809).version,n.utils=r(810),n.rand=r(811),n.curve=r(174),n.curves=r(817),n.ec=r(825),n.eddsa=r(829)},function(e,t,r){"use strict";(function(t){var n=r(24),i=r(13),o=function e(t){if(!(this instanceof e))return new e(t);t?this.set(t):this.bufs=[]};o.prototype.set=function(e){return this.bufs=e.bufs||this.bufs||[],this},o.prototype.toBuffer=function(){return this.concat()},o.prototype.concat=function(){return t.concat(this.bufs)},o.prototype.write=function(e){return i(n.isBuffer(e)),this.bufs.push(e),this},o.prototype.writeReverse=function(e){return i(n.isBuffer(e)),this.bufs.push(n.reverse(e)),this},o.prototype.writeUInt8=function(e){var r=new t(1);return r.writeUInt8(e,0),this.write(r),this},o.prototype.writeUInt16BE=function(e){var r=new t(2);return r.writeUInt16BE(e,0),this.write(r),this},o.prototype.writeUInt16LE=function(e){var r=new t(2);return r.writeUInt16LE(e,0),this.write(r),this},o.prototype.writeUInt32BE=function(e){var r=new t(4);return r.writeUInt32BE(e,0),this.write(r),this},o.prototype.writeInt32LE=function(e){var r=new t(4);return r.writeInt32LE(e,0),this.write(r),this},o.prototype.writeUInt32LE=function(e){var r=new t(4);return r.writeUInt32LE(e,0),this.write(r),this},o.prototype.writeUInt64BEBN=function(e){var t=e.toBuffer({size:8});return this.write(t),this},o.prototype.writeUInt64LEBN=function(e){var t=e.toBuffer({size:8});return this.writeReverse(t),this},o.prototype.writeVarintNum=function(e){var t=o.varintBufNum(e);return this.write(t),this},o.prototype.writeVarintBN=function(e){var t=o.varintBufBN(e);return this.write(t),this},o.varintBufNum=function(e){var r=void 0;return e<253?(r=new t(1),r.writeUInt8(e,0)):e<65536?(r=new t(3),r.writeUInt8(253,0),r.writeUInt16LE(e,1)):e<4294967296?(r=new t(5),r.writeUInt8(254,0),r.writeUInt32LE(e,1)):(r=new t(9),r.writeUInt8(255,0),r.writeInt32LE(-1&e,1),r.writeUInt32LE(Math.floor(e/4294967296),5)),r},o.varintBufBN=function(e){var r=void 0,n=e.toNumber();if(n<253)r=new t(1),r.writeUInt8(n,0);else if(n<65536)r=new t(3),r.writeUInt8(253,0),r.writeUInt16LE(n,1);else if(n<4294967296)r=new t(5),r.writeUInt8(254,0),r.writeUInt32LE(n,1);else{var i=new o;i.writeUInt8(255),i.writeUInt64LEBN(e);var r=i.concat()}return r},e.exports=o}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(t){const n=r(14),i=r(724);function o(e,t,r,i){if("function"==typeof r&&(i=r,r=void 0),!i)throw new Error("Missing callback");o.digest(e,t,r,(e,o)=>{if(e)return i(e);i(null,n.encode(o,t,r))})}e.exports=o,o.Buffer=t,o.multihash=n,o.digest=function(e,t,r,n){if("function"==typeof r&&(n=r,r=void 0),!n)throw new Error("Missing callback");let i=n,s;r&&(i=((e,t)=>{if(e)return n(e);n(null,t.slice(0,r))}));try{s=o.createHash(t)}catch(e){return i(e)}s(e,i)},o.createHash=function(e){if(e=n.coerceCode(e),!o.functions[e])throw new Error("multihash function "+e+" not yet supported");return o.functions[e]},o.functions={17:i.sha1,18:i.sha2256,19:i.sha2512,20:i.sha3512,21:i.sha3384,22:i.sha3256,23:i.sha3224,24:i.shake128,25:i.shake256,26:i.keccak224,27:i.keccak256,28:i.keccak384,29:i.keccak512,34:i.murmur3128,35:i.murmur332,86:i.dblSha2256},i.addBlake(o.functions)}).call(this,r(0).Buffer)},function(e,t,r){"use strict";var n=r(15);function i(e,t){return e.replace("{0}",t[0]).replace("{1}",t[1]).replace("{2}",t[2])}var o=function(e,t){var r=function(){if(n.isString(t.message))this.message=i(t.message,arguments);else{if(!n.isFunction(t.message))throw new Error("Invalid error definition for "+t.name);this.message=t.message.apply(null,arguments)}this.stack=this.message+"\n"+(new Error).stack};return r.prototype=Object.create(e.prototype),r.prototype.name=e.prototype.name+t.name,e[t.name]=r,t.errors&&s(r,t.errors),r},s=function(e,t){n.each(t,function(t){o(e,t)})},a=function(e,t){return s(e,t),e},u={Error:function(){this.message="Internal error",this.stack=this.message+"\n"+(new Error).stack}};u.Error.prototype=Object.create(Error.prototype),u.Error.prototype.name="bitcore.Error";var c=r(852);a(u.Error,c),e.exports=u.Error,e.exports.extend=function(e){return o(u.Error,e)}},function(e,t,r){"use strict";(function(t){var n=r(34),i=r(15),o=r(20),s=r(24),a=r(30),u=function e(t,r){if(!(this instanceof e))return new e(t,r);if(t instanceof n)this.set({r:t,s:r});else if(t){var i=t;this.set(i)}};u.prototype.set=function(e){return this.r=e.r||this.r||void 0,this.s=e.s||this.s||void 0,this.i=void 0!==e.i?e.i:this.i,this.compressed=void 0!==e.compressed?e.compressed:this.compressed,this.nhashtype=e.nhashtype||this.nhashtype||void 0,this},u.fromCompact=function(e){o.checkArgument(s.isBuffer(e),"Argument is expected to be a Buffer");var t=new u,r=!0,i=e.slice(0,1)[0]-27-4;i<0&&(r=!1,i+=4);var a=e.slice(1,33),c=e.slice(33,65);return o.checkArgument(0===i||1===i||2===i||3===i,new Error("i must be 0, 1, 2, or 3")),o.checkArgument(32===a.length,new Error("r must be 32 bytes")),o.checkArgument(32===c.length,new Error("s must be 32 bytes")),t.compressed=r,t.i=i,t.r=n.fromBuffer(a),t.s=n.fromBuffer(c),t},u.fromDER=u.fromBuffer=function(e,t){var r=u.parseDER(e,t),n=new u;return n.r=r.r,n.s=r.s,n},u.fromTxFormat=function(e){var t=e.readUInt8(e.length-1),r=e.slice(0,e.length-1),n=new u.fromDER(r,!1);return n.nhashtype=t,n},u.fromString=function(e){var r=new t(e,"hex");return u.fromDER(r)},u.parseDER=function(e,t){o.checkArgument(s.isBuffer(e),new Error("DER formatted signature should be a buffer")),i.isUndefined(t)&&(t=!0);var r=e[0];o.checkArgument(48===r,new Error("Header byte should be 0x30"));var a=e[1],u=e.slice(2).length;o.checkArgument(!t||a===u,new Error("Length byte should length of what follows")),a=a<u?a:u;var c=e[2];o.checkArgument(2===c,new Error("Integer byte for r should be 0x02"));var f=e[3],l=e.slice(4,4+f),h=n.fromBuffer(l),p=0===e[4];o.checkArgument(f===l.length,new Error("Length of r incorrect"));var d=e[4+f+0];o.checkArgument(2===d,new Error("Integer byte for s should be 0x02"));var y=e[4+f+1],g=e.slice(4+f+2,4+f+2+y),m=n.fromBuffer(g),b=0===e[4+f+2+2];o.checkArgument(y===g.length,new Error("Length of s incorrect"));var v=4+f+2+y;o.checkArgument(a===v-2,new Error("Length of signature incorrect"));var _={header:r,length:a,rheader:c,rlength:f,rneg:p,rbuf:l,r:h,sheader:d,slength:y,sneg:b,sbuf:g,s:m};return _},u.prototype.toCompact=function(e,r){if(e="number"==typeof e?e:this.i,r="boolean"==typeof r?r:this.compressed,0!==e&&1!==e&&2!==e&&3!==e)throw new Error("i must be equal to 0, 1, 2, or 3");var n=e+27+4;!1===r&&(n-=4);var i=new t([n]),o=this.r.toBuffer({size:32}),s=this.s.toBuffer({size:32});return t.concat([i,o,s])},u.prototype.toBuffer=u.prototype.toDER=function(){var e=this.r.toBuffer(),r=this.s.toBuffer(),n=!!(128&e[0]),i=!!(128&r[0]),o=n?t.concat([new t([0]),e]):e,s=i?t.concat([new t([0]),r]):r,a=o.length,u=s.length,c=2+a+2+u,f=2,l=2,h=48,p=t.concat([new t([48,c,2,a]),o,new t([2,u]),s]);return p},u.prototype.toString=function(){var e=this.toDER();return e.toString("hex")},u.isTxDER=function(e){if(e.length<9)return!1;if(e.length>73)return!1;if(48!==e[0])return!1;if(e[1]!==e.length-3)return!1;var t=e[3];if(5+t>=e.length)return!1;var r=e[5+t];if(t+r+7!==e.length)return!1;var n=e.slice(4);if(2!==e[2])return!1;if(0===t)return!1;if(128&n[0])return!1;if(t>1&&0===n[0]&&!(128&n[1]))return!1;var i=e.slice(6+t);return 2===e[6+t-2]&&(0!==r&&(!(128&i[0])&&!(r>1&&0===i[0]&&!(128&i[1]))))},u.prototype.hasLowS=function(){return!this.s.lt(new n(1))&&!this.s.gt(new n("7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0","hex"))},u.prototype.hasDefinedHashtype=function(){if(!a.isNaturalNumber(this.nhashtype))return!1;var e=this.nhashtype&~u.SIGHASH_ANYONECANPAY;return!(e<u.SIGHASH_ALL||e>u.SIGHASH_SINGLE)},u.prototype.toTxFormat=function(){var e=this.toDER(),r=new t(1);return r.writeUInt8(this.nhashtype,0),t.concat([e,r])},u.SIGHASH_ALL=1,u.SIGHASH_NONE=2,u.SIGHASH_SINGLE=3,u.SIGHASH_ANYONECANPAY=128,e.exports=u}).call(this,r(0).Buffer)},function(e,t,r){e.exports=r(425),e.exports.Interpreter=r(871)},function(e,t,r){var n=r(11);r(100),r(443),r(444),r(16),n.random&&n.random.getBytes?e.exports=n.random:function(t){var r={},i=new Array(4),o=n.util.createBuffer();function s(){var e=n.prng.create(r);return e.getBytes=function(t,r){return e.generate(t,r)},e.getBytesSync=function(t){return e.generate(t)},e}r.formatKey=function(e){var t=n.util.createBuffer(e);return e=new Array(4),e[0]=t.getInt32(),e[1]=t.getInt32(),e[2]=t.getInt32(),e[3]=t.getInt32(),n.aes._expandKey(e,!1)},r.formatSeed=function(e){var t=n.util.createBuffer(e);return e=new Array(4),e[0]=t.getInt32(),e[1]=t.getInt32(),e[2]=t.getInt32(),e[3]=t.getInt32(),e},r.cipher=function(e,t){return n.aes._updateBlock(e,t,i,!1),o.putInt32(i[0]),o.putInt32(i[1]),o.putInt32(i[2]),o.putInt32(i[3]),o.getBytes()},r.increment=function(e){return++e[3],e},r.md=n.md.sha256;var a=s(),u=null;if("undefined"!=typeof window){var c=window.crypto||window.msCrypto;c&&c.getRandomValues&&(u=function(e){return c.getRandomValues(e)})}if(n.options.usePureJavaScript||!n.util.isNodejs&&!u){if("undefined"==typeof window||window.document,a.collectInt(+new Date,32),"undefined"!=typeof navigator){var f="";for(var l in navigator)try{"string"==typeof navigator[l]&&(f+=navigator[l])}catch(e){}a.collect(f),f=null}t&&(t().mousemove(function(e){a.collectInt(e.clientX,16),a.collectInt(e.clientY,16)}),t().keypress(function(e){a.collectInt(e.charCode,8)}))}if(n.random)for(var l in a)n.random[l]=a[l];else n.random=a;n.random.createInstance=s,e.exports=n.random}("undefined"!=typeof jQuery?jQuery:null)},function(e,t,r){"use strict";e.exports=function e(t){var r=arguments.length;if("function"==typeof t&&1===t.length){for(var n=new Array(r),i=0;i<r;i++)n[i]=arguments[i];return function(t){if(null==n)throw new TypeError("partial sink should only be called once!");var i=n;switch(n=null,r){case 1:return e(t,i[0]);case 2:return e(t,i[0],i[1]);case 3:return e(t,i[0],i[1],i[2]);case 4:return e(t,i[0],i[1],i[2],i[3]);default:return i.unshift(t),e.apply(null,i)}}}var o=t;o&&"function"==typeof o.source&&(o=o.source);for(var i=1;i<r;i++){var s=arguments[i];"function"==typeof s?o=s(o):s&&"object"==typeof s&&(s.sink(o),o=s.source)}return o}},function(e,t,r){"use strict";var n=r(84),i=r(4);function o(e,t){if(Array.isArray(e))return e.slice();if(!e)return[];var r=[];if("string"==typeof e)if(t){if("hex"===t)for(e=e.replace(/[^a-z0-9]+/gi,""),e.length%2!=0&&(e="0"+e),n=0;n<e.length;n+=2)r.push(parseInt(e[n]+e[n+1],16))}else for(var n=0;n<e.length;n++){var i=e.charCodeAt(n),o=i>>8,s=255&i;o?r.push(o,s):r.push(s)}else for(n=0;n<e.length;n++)r[n]=0|e[n];return r}function s(e){for(var t="",r=0;r<e.length;r++)t+=c(e[r].toString(16));return t}function a(e){var t=e>>>24|e>>>8&65280|e<<8&16711680|(255&e)<<24;return t>>>0}function u(e,t){for(var r="",n=0;n<e.length;n++){var i=e[n];"little"===t&&(i=a(i)),r+=f(i.toString(16))}return r}function c(e){return 1===e.length?"0"+e:e}function f(e){return 7===e.length?"0"+e:6===e.length?"00"+e:5===e.length?"000"+e:4===e.length?"0000"+e:3===e.length?"00000"+e:2===e.length?"000000"+e:1===e.length?"0000000"+e:e}function l(e,t,r,i){var o=r-t;n(o%4==0);for(var s=new Array(o/4),a=0,u=t;a<s.length;a++,u+=4){var c;c="big"===i?e[u]<<24|e[u+1]<<16|e[u+2]<<8|e[u+3]:e[u+3]<<24|e[u+2]<<16|e[u+1]<<8|e[u],s[a]=c>>>0}return s}function h(e,t){for(var r=new Array(4*e.length),n=0,i=0;n<e.length;n++,i+=4){var o=e[n];"big"===t?(r[i]=o>>>24,r[i+1]=o>>>16&255,r[i+2]=o>>>8&255,r[i+3]=255&o):(r[i+3]=o>>>24,r[i+2]=o>>>16&255,r[i+1]=o>>>8&255,r[i]=255&o)}return r}function p(e,t){return e>>>t|e<<32-t}function d(e,t){return e<<t|e>>>32-t}function y(e,t){return e+t>>>0}function g(e,t,r){return e+t+r>>>0}function m(e,t,r,n){return e+t+r+n>>>0}function b(e,t,r,n,i){return e+t+r+n+i>>>0}function v(e,t,r,n){var i=e[t],o=e[t+1],s=n+o>>>0,a=(s<n?1:0)+r+i;e[t]=a>>>0,e[t+1]=s}function _(e,t,r,n){var i=t+n>>>0,o=(i<t?1:0)+e+r;return o>>>0}function w(e,t,r,n){var i=t+n;return i>>>0}function S(e,t,r,n,i,o,s,a){var u=0,c=t;c=c+n>>>0,u+=c<t?1:0,c=c+o>>>0,u+=c<o?1:0,c=c+a>>>0,u+=c<a?1:0;var f=e+r+i+s+u;return f>>>0}function k(e,t,r,n,i,o,s,a){var u=t+n+o+a;return u>>>0}function E(e,t,r,n,i,o,s,a,u,c){var f=0,l=t;l=l+n>>>0,f+=l<t?1:0,l=l+o>>>0,f+=l<o?1:0,l=l+a>>>0,f+=l<a?1:0,l=l+c>>>0,f+=l<c?1:0;var h=e+r+i+s+u+f;return h>>>0}function A(e,t,r,n,i,o,s,a,u,c){var f=t+n+o+a+c;return f>>>0}function x(e,t,r){var n=t<<32-r|e>>>r;return n>>>0}function I(e,t,r){var n=e<<32-r|t>>>r;return n>>>0}function T(e,t,r){return e>>>r}function B(e,t,r){var n=e<<32-r|t>>>r;return n>>>0}t.inherits=i,t.toArray=o,t.toHex=s,t.htonl=a,t.toHex32=u,t.zero2=c,t.zero8=f,t.join32=l,t.split32=h,t.rotr32=p,t.rotl32=d,t.sum32=y,t.sum32_3=g,t.sum32_4=m,t.sum32_5=b,t.sum64=v,t.sum64_hi=_,t.sum64_lo=w,t.sum64_4_hi=S,t.sum64_4_lo=k,t.sum64_5_hi=E,t.sum64_5_lo=A,t.rotr64_hi=x,t.rotr64_lo=I,t.shr64_hi=T,t.shr64_lo=B},function(e,t,r){"use strict";var n=t;n.version=r(853).version,n.utils=r(854),n.rand=r(855),n.hmacDRBG=r(856),n.curve=r(175),n.curves=r(866),n.ec=r(868)},function(e,t,r){"use strict";(function(t){var n=r(34),i=r(111),o=r(40),s=r(30),a=r(98),u=r(15),c=r(20);function f(e,t){if(!(this instanceof f))return new f(e,t);if(c.checkArgument(e,"First argument is required, please include public key data."),e instanceof f)return e;t=t||{};var r=this._classifyArgs(e,t);return r.point.validate(),s.defineImmutable(this,{point:r.point,compressed:r.compressed,network:r.network||a.defaultNetwork}),this}f.prototype._classifyArgs=function(e,r){var n={compressed:u.isUndefined(r.compressed)||r.compressed};if(e instanceof i)n.point=e;else if(e.x&&e.y)n=f._transformObject(e);else if("string"==typeof e)n=f._transformDER(new t(e,"hex"));else if(f._isBuffer(e))n=f._transformDER(e);else{if(!f._isPrivateKey(e))throw new TypeError("First argument is an unrecognized data format.");n=f._transformPrivateKey(e)}return n.network||(n.network=u.isUndefined(r.network)?void 0:a.get(r.network)),n},f._isPrivateKey=function(e){var t=r(176);return e instanceof t},f._isBuffer=function(e){return e instanceof t||e instanceof Uint8Array},f._transformPrivateKey=function(e){c.checkArgument(f._isPrivateKey(e),"Must be an instance of PrivateKey");var t={};return t.point=i.getG().mul(e.bn),t.compressed=e.compressed,t.network=e.network,t},f._transformDER=function(e,t){c.checkArgument(f._isBuffer(e),"Must be a hex buffer of DER encoded public key");var r={},o,s,a,l;if(t=!!u.isUndefined(t)||t,4!==e[0]&&(t||6!==e[0]&&7!==e[0]))if(3===e[0])a=e.slice(1),o=new n(a),r=f._transformX(!0,o),r.compressed=!0;else{if(2!==e[0])throw new TypeError("Invalid DER format public key");a=e.slice(1),o=new n(a),r=f._transformX(!1,o),r.compressed=!0}else{if(a=e.slice(1,33),l=e.slice(33,65),32!==a.length||32!==l.length||65!==e.length)throw new TypeError("Length of x and y must be 32 bytes");o=new n(a),s=new n(l),r.point=new i(o,s),r.compressed=!1}return r},f._transformX=function(e,t){c.checkArgument("boolean"==typeof e,"Must specify whether y is odd or not (true or false)");var r={};return r.point=i.fromX(e,t),r},f._transformObject=function(e){var t=new n(e.x,"hex"),r=new n(e.y,"hex"),o=new i(t,r);return new f(o,{compressed:e.compressed})},f.fromPrivateKey=function(e){c.checkArgument(f._isPrivateKey(e),"Must be an instance of PrivateKey");var t=f._transformPrivateKey(e);return new f(t.point,{compressed:t.compressed,network:t.network})},f.fromDER=f.fromBuffer=function(e,t){c.checkArgument(f._isBuffer(e),"Must be a hex buffer of DER encoded public key");var r=f._transformDER(e,t);return new f(r.point,{compressed:r.compressed})},f.fromPoint=function(e,t){return c.checkArgument(e instanceof i,"First argument must be an instance of Point."),new f(e,{compressed:t})},f.fromString=function(e,r){var n=new t(e,r||"hex"),i=f._transformDER(n);return new f(i.point,{compressed:i.compressed})},f.fromX=function(e,t){var r=f._transformX(e,t);return new f(r.point,{compressed:r.compressed})},f.getValidationError=function(e){var t;try{new f(e)}catch(e){t=e}return t},f.isValid=function(e){return!f.getValidationError(e)},f.prototype.toObject=f.prototype.toJSON=function e(){return{x:this.point.getX().toString("hex",2),y:this.point.getY().toString("hex",2),compressed:this.compressed}},f.prototype.toBuffer=f.prototype.toDER=function(){var e=this.point.getX(),r=this.point.getY(),n=e.toBuffer({size:32}),i=r.toBuffer({size:32}),o;if(this.compressed){var s=i[i.length-1]%2;return o=new t(s?[3]:[2]),t.concat([o,n])}return o=new t([4]),t.concat([o,n,i])},f.prototype._getID=function e(){return o.sha256ripemd160(this.toBuffer())},f.prototype.toAddress=function(e){var t=r(99);return t.fromPublicKey(this,e||this.network)},f.prototype.toString=function(){return this.toDER().toString("hex")},f.prototype.inspect=function(){return"<PublicKey: "+this.toString()+(this.compressed?"":", uncompressed")+">"},e.exports=f}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(n){const i=r(14),o=r(113),s=r(13),a=r(5);class u{constructor(e,t,r){s(n.isBuffer(e),"invalid id provided"),t&&r&&s(t.public.bytes.equals(r.bytes),"inconsistent arguments"),this._id=e,this._idB58String=i.toB58String(this.id),this._privKey=t,this._pubKey=r}get id(){return this._id}set id(e){throw new Error("Id is immutable")}get privKey(){return this._privKey}set privKey(e){this._privKey=e}get pubKey(){return this._pubKey?this._pubKey:this._privKey?this._privKey.public:void 0}set pubKey(e){this._pubKey=e}marshalPubKey(){if(this.pubKey)return o.keys.marshalPublicKey(this.pubKey)}marshalPrivKey(){if(this.privKey)return o.keys.marshalPrivateKey(this.privKey)}toPrint(){let e=this.toB58String();e.startsWith("Qm")&&(e=e.slice(2));let t=6;return e.length<t&&(t=e.length),"<peer.ID "+e.substr(0,t)+">"}toJSON(){return{id:this.toB58String(),privKey:c(this.marshalPrivKey()),pubKey:c(this.marshalPubKey())}}toHexString(){return i.toHexString(this.id)}toBytes(){return this.id}toB58String(){return this._idB58String}isEqual(e){if(n.isBuffer(e))return this.id.equals(e);if(e.id)return this.id.equals(e.id);throw new Error("not valid Id")}isValid(e){this.privKey&&this.privKey.public&&this.privKey.public.bytes&&n.isBuffer(this.pubKey.bytes)&&this.privKey.public.bytes.equals(this.pubKey.bytes)?e():e(new Error("Keys not match"))}}function c(e){if(e)return e.toString("base64")}t=e.exports=u,t.create=function(e,t){"function"==typeof e&&(t=e,e={}),e=e||{},e.bits=e.bits||2048,a([t=>o.keys.generateKeyPair("RSA",e.bits,t),(e,t)=>e.public.hash((r,n)=>{t(r,n,e)})],(e,r,n)=>{if(e)return t(e);t(null,new u(r,n))})},t.createFromHexString=function(e){return new u(i.fromHexString(e))},t.createFromBytes=function(e){return new u(e)},t.createFromB58String=function(e){return new u(i.fromB58String(e))},t.createFromPubKey=function(e,t){if("function"!=typeof t)throw new Error("callback is required");let r;try{let i=e;if("string"==typeof i&&(i=n.from(e,"base64")),!n.isBuffer(i))throw new Error("Supplied key is neither a base64 string nor a buffer");r=o.keys.unmarshalPublicKey(i)}catch(e){return t(e)}r.hash((e,n)=>{if(e)return t(e);t(null,new u(n,null,r))})},t.createFromPrivKey=function(e,t){if("function"!=typeof t)throw new Error("callback is required");let r=e;try{if("string"==typeof r&&(r=n.from(e,"base64")),!n.isBuffer(r))throw new Error("Supplied key is neither a base64 string nor a buffer")}catch(e){return t(e)}a([e=>o.keys.unmarshalPrivateKey(r,e),(e,t)=>e.public.hash((r,n)=>{t(r,n,e)})],(e,r,n)=>{if(e)return t(e);t(null,new u(r,n,n.public))})},t.createFromJSON=function(e,t){if("function"!=typeof t)throw new Error("callback is required");let r,s,c,f;try{r=i.fromB58String(e.id),s=e.privKey&&n.from(e.privKey,"base64"),c=e.pubKey&&n.from(e.pubKey,"base64"),f=c&&o.keys.unmarshalPublicKey(c)}catch(e){return t(e)}s?a([e=>o.keys.unmarshalPrivateKey(s,e),(e,t)=>e.public.hash((r,n)=>{t(r,n,e)}),(e,t,r)=>{f?f.hash((n,i)=>{r(n,e,t,i)}):r(null,e,t)}],(e,n,i,o)=>e?t(e):f&&!n.equals(o)?t(new Error("Public and private key do not match")):r&&!n.equals(r)?t(new Error("Id and private key do not match")):void t(null,new u(r,i,f))):t(null,new u(r,null,f))},t.isPeerId=function(e){return Boolean("object"==typeof e&&e._id&&e._idB58String)}}).call(this,r(0).Buffer)},function(e,t){
|
||
/**
|
||
* @file Web Cryptography API shim
|
||
* @author Artem S Vybornov <vybornov@gmail.com>
|
||
* @license MIT
|
||
*/
|
||
e.exports=function e(t){"use strict";if("function"!=typeof Promise)throw"Promise support required";var r=t.crypto||t.msCrypto;if(r){var n=r.subtle||r.webkitSubtle;if(n){var i=t.Crypto||r.constructor||Object,o=t.SubtleCrypto||n.constructor||Object,s=t.CryptoKey||t.Key||Object,a=t.navigator.userAgent.indexOf("Edge/")>-1,u=!!t.msCrypto&&!a,c=!r.subtle&&!!r.webkitSubtle;if(u||c){var f={KoZIhvcNAQEB:"1.2.840.113549.1.1.1"},l={"1.2.840.113549.1.1.1":"KoZIhvcNAQEB"};if(["generateKey","importKey","unwrapKey"].forEach(function(e){var t=n[e];n[e]=function(i,o,s){var a=[].slice.call(arguments),f,l,h,p;switch(e){case"generateKey":f=m(i),l=o,h=s;break;case"importKey":f=m(s),l=a[3],h=a[4],"jwk"===i&&(o=v(o),o.alg||(o.alg=b(f)),o.key_ops||(o.key_ops="oct"!==o.kty?"d"in o?h.filter(I):h.filter(x):h.slice()),a[1]=_(o));break;case"unwrapKey":f=a[4],l=a[5],h=a[6],a[2]=s._key}if("generateKey"===e&&"HMAC"===f.name&&f.hash)return f.length=f.length||{"SHA-1":512,"SHA-256":512,"SHA-384":1024,"SHA-512":1024}[f.hash.name],n.importKey("raw",r.getRandomValues(new Uint8Array(f.length+7>>3)),f,l,h);if(c&&"generateKey"===e&&"RSASSA-PKCS1-v1_5"===f.name&&(!f.modulusLength||f.modulusLength>=2048))return i=m(i),i.name="RSAES-PKCS1-v1_5",delete i.hash,n.generateKey(i,!0,["encrypt","decrypt"]).then(function(e){return Promise.all([n.exportKey("jwk",e.publicKey),n.exportKey("jwk",e.privateKey)])}).then(function(e){return e[0].alg=e[1].alg=b(f),e[0].key_ops=h.filter(x),e[1].key_ops=h.filter(I),Promise.all([n.importKey("jwk",e[0],f,!0,e[0].key_ops),n.importKey("jwk",e[1],f,l,e[1].key_ops)])}).then(function(e){return{publicKey:e[0],privateKey:e[1]}});if((c||u&&"SHA-1"===(f.hash||{}).name)&&"importKey"===e&&"jwk"===i&&"HMAC"===f.name&&"oct"===o.kty)return n.importKey("raw",y(d(o.k)),s,a[3],a[4]);if(c&&"importKey"===e&&("spki"===i||"pkcs8"===i))return n.importKey("jwk",w(o),s,a[3],a[4]);if(u&&"unwrapKey"===e)return n.decrypt(a[3],s,o).then(function(e){return n.importKey(i,e,a[4],a[5],a[6])});try{p=t.apply(n,a)}catch(e){return Promise.reject(e)}return u&&(p=new Promise(function(e,t){p.onabort=p.onerror=function(e){t(e)},p.oncomplete=function(t){e(t.target.result)}})),p=p.then(function(e){return"HMAC"===f.name&&(f.length||(f.length=8*e.algorithm.length)),0==f.name.search("RSA")&&(f.modulusLength||(f.modulusLength=(e.publicKey||e).algorithm.modulusLength),f.publicExponent||(f.publicExponent=(e.publicKey||e).algorithm.publicExponent)),e=e.publicKey&&e.privateKey?{publicKey:new A(e.publicKey,f,l,h.filter(x)),privateKey:new A(e.privateKey,f,l,h.filter(I))}:new A(e,f,l,h),e}),p}}),["exportKey","wrapKey"].forEach(function(e){var t=n[e];n[e]=function(r,i,o){var s=[].slice.call(arguments),a;switch(e){case"exportKey":s[1]=i._key;break;case"wrapKey":s[1]=i._key,s[2]=o._key}if((c||u&&"SHA-1"===(i.algorithm.hash||{}).name)&&"exportKey"===e&&"jwk"===r&&"HMAC"===i.algorithm.name&&(s[0]="raw"),!c||"exportKey"!==e||"spki"!==r&&"pkcs8"!==r||(s[0]="jwk"),u&&"wrapKey"===e)return n.exportKey(r,i).then(function(e){return"jwk"===r&&(e=y(unescape(encodeURIComponent(JSON.stringify(v(e)))))),n.encrypt(s[3],o,e)});try{a=t.apply(n,s)}catch(e){return Promise.reject(e)}return u&&(a=new Promise(function(e,t){a.onabort=a.onerror=function(e){t(e)},a.oncomplete=function(t){e(t.target.result)}})),"exportKey"===e&&"jwk"===r&&(a=a.then(function(e){return(c||u&&"SHA-1"===(i.algorithm.hash||{}).name)&&"HMAC"===i.algorithm.name?{kty:"oct",alg:b(i.algorithm),key_ops:i.usages.slice(),ext:!0,k:p(g(e))}:(e=v(e),e.alg||(e.alg=b(i.algorithm)),e.key_ops||(e.key_ops="public"===i.type?i.usages.filter(x):"private"===i.type?i.usages.filter(I):i.usages.slice()),e)})),!c||"exportKey"!==e||"spki"!==r&&"pkcs8"!==r||(a=a.then(function(e){return e=S(v(e)),e})),a}}),["encrypt","decrypt","sign","verify"].forEach(function(e){var t=n[e];n[e]=function(r,i,o,s){if(u&&(!o.byteLength||s&&!s.byteLength))throw new Error("Empy input is not allowed");var a=[].slice.call(arguments),c=m(r),f;if(u&&"decrypt"===e&&"AES-GCM"===c.name){var l=r.tagLength>>3;a[2]=(o.buffer||o).slice(0,o.byteLength-l),r.tag=(o.buffer||o).slice(o.byteLength-l)}a[1]=i._key;try{f=t.apply(n,a)}catch(e){return Promise.reject(e)}return u&&(f=new Promise(function(t,r){f.onabort=f.onerror=function(e){r(e)},f.oncomplete=function(r){var r=r.target.result;if("encrypt"===e&&r instanceof AesGcmEncryptResult){var n=r.ciphertext,i=r.tag;r=new Uint8Array(n.byteLength+i.byteLength),r.set(new Uint8Array(n),0),r.set(new Uint8Array(i),n.byteLength),r=r.buffer}t(r)}})),f}}),u){var h=n.digest;n.digest=function(e,t){if(!t.byteLength)throw new Error("Empy input is not allowed");var r;try{r=h.call(n,e,t)}catch(e){return Promise.reject(e)}return r=new Promise(function(e,t){r.onabort=r.onerror=function(e){t(e)},r.oncomplete=function(t){e(t.target.result)}}),r},t.crypto=Object.create(r,{getRandomValues:{value:function(e){return r.getRandomValues(e)}},subtle:{value:n}}),t.CryptoKey=A}c&&(r.subtle=n,t.Crypto=i,t.SubtleCrypto=o,t.CryptoKey=A)}}}function p(e){return btoa(e).replace(/\=+$/,"").replace(/\+/g,"-").replace(/\//g,"_")}function d(e){return e+="===",e=e.slice(0,-e.length%4),atob(e.replace(/-/g,"+").replace(/_/g,"/"))}function y(e){for(var t=new Uint8Array(e.length),r=0;r<e.length;r++)t[r]=e.charCodeAt(r);return t}function g(e){return e instanceof ArrayBuffer&&(e=new Uint8Array(e)),String.fromCharCode.apply(String,e)}function m(e){var t={name:(e.name||e||"").toUpperCase().replace("V","v")};switch(t.name){case"SHA-1":case"SHA-256":case"SHA-384":case"SHA-512":break;case"AES-CBC":case"AES-GCM":case"AES-KW":e.length&&(t.length=e.length);break;case"HMAC":e.hash&&(t.hash=m(e.hash)),e.length&&(t.length=e.length);break;case"RSAES-PKCS1-v1_5":e.publicExponent&&(t.publicExponent=new Uint8Array(e.publicExponent)),e.modulusLength&&(t.modulusLength=e.modulusLength);break;case"RSASSA-PKCS1-v1_5":case"RSA-OAEP":e.hash&&(t.hash=m(e.hash)),e.publicExponent&&(t.publicExponent=new Uint8Array(e.publicExponent)),e.modulusLength&&(t.modulusLength=e.modulusLength);break;default:throw new SyntaxError("Bad algorithm name")}return t}function b(e){return{HMAC:{"SHA-1":"HS1","SHA-256":"HS256","SHA-384":"HS384","SHA-512":"HS512"},"RSASSA-PKCS1-v1_5":{"SHA-1":"RS1","SHA-256":"RS256","SHA-384":"RS384","SHA-512":"RS512"},"RSAES-PKCS1-v1_5":{"":"RSA1_5"},"RSA-OAEP":{"SHA-1":"RSA-OAEP","SHA-256":"RSA-OAEP-256"},"AES-KW":{128:"A128KW",192:"A192KW",256:"A256KW"},"AES-GCM":{128:"A128GCM",192:"A192GCM",256:"A256GCM"},"AES-CBC":{128:"A128CBC",192:"A192CBC",256:"A256CBC"}}[e.name][(e.hash||{}).name||e.length||""]}function v(e){(e instanceof ArrayBuffer||e instanceof Uint8Array)&&(e=JSON.parse(decodeURIComponent(escape(g(e)))));var t={kty:e.kty,alg:e.alg,ext:e.ext||e.extractable};switch(t.kty){case"oct":t.k=e.k;case"RSA":["n","e","d","p","q","dp","dq","qi","oth"].forEach(function(r){r in e&&(t[r]=e[r])});break;default:throw new TypeError("Unsupported key type")}return t}function _(e){var t=v(e);return u&&(t.extractable=t.ext,delete t.ext),y(unescape(encodeURIComponent(JSON.stringify(t)))).buffer}function w(e){var t=k(e),r=!1;t.length>2&&(r=!0,t.shift());var n={ext:!0};switch(t[0][0]){case"1.2.840.113549.1.1.1":var i=["n","e","d","p","q","dp","dq","qi"],o=k(t[1]);r&&o.shift();for(var s=0;s<o.length;s++)o[s][0]||(o[s]=o[s].subarray(1)),n[i[s]]=p(g(o[s]));n.kty="RSA";break;default:throw new TypeError("Unsupported key type")}return n}function S(e){var t,r=[["",null]],n=!1;switch(e.kty){case"RSA":for(var i=["n","e","d","p","q","dp","dq","qi"],o=[],s=0;s<i.length&&i[s]in e;s++){var a=o[s]=y(d(e[i[s]]));128&a[0]&&(o[s]=new Uint8Array(a.length+1),o[s].set(a,1))}o.length>2&&(n=!0,o.unshift(new Uint8Array([0]))),r[0][0]="1.2.840.113549.1.1.1",t=o;break;default:throw new TypeError("Unsupported key type")}return r.push(new Uint8Array(E(t)).buffer),n?r.unshift(new Uint8Array([0])):r[1]={tag:3,value:r[1]},new Uint8Array(E(r)).buffer}function k(e,t){if(e instanceof ArrayBuffer&&(e=new Uint8Array(e)),t||(t={pos:0,end:e.length}),t.end-t.pos<2||t.end>e.length)throw new RangeError("Malformed DER");var r=e[t.pos++],n=e[t.pos++],i;if(n>=128){if(n&=127,t.end-t.pos<n)throw new RangeError("Malformed DER");for(var o=0;n--;)o<<=8,o|=e[t.pos++];n=o}if(t.end-t.pos<n)throw new RangeError("Malformed DER");switch(r){case 2:i=e.subarray(t.pos,t.pos+=n);break;case 3:if(e[t.pos++])throw new Error("Unsupported bit string");n--;case 4:i=new Uint8Array(e.subarray(t.pos,t.pos+=n)).buffer;break;case 5:i=null;break;case 6:var s=btoa(g(e.subarray(t.pos,t.pos+=n)));if(!(s in f))throw new Error("Unsupported OBJECT ID "+s);i=f[s];break;case 48:i=[];for(var a=t.pos+n;t.pos<a;)i.push(k(e,t));break;default:throw new Error("Unsupported DER tag 0x"+r.toString(16))}return i}function E(e,t){t||(t=[]);var r=0,n=0,i=t.length+2;if(t.push(0,0),e instanceof Uint8Array){r=2,n=e.length;for(var o=0;o<n;o++)t.push(e[o])}else if(e instanceof ArrayBuffer){r=4,n=e.byteLength,e=new Uint8Array(e);for(var o=0;o<n;o++)t.push(e[o])}else if(null===e)r=5,n=0;else if("string"==typeof e&&e in l){var s=y(atob(l[e]));r=6,n=s.length;for(var o=0;o<n;o++)t.push(s[o])}else if(e instanceof Array){for(var o=0;o<e.length;o++)E(e[o],t);r=48,n=t.length-i}else{if(!("object"==typeof e&&3===e.tag&&e.value instanceof ArrayBuffer))throw new Error("Unsupported DER value "+e);e=new Uint8Array(e.value),r=3,n=e.byteLength,t.push(0);for(var o=0;o<n;o++)t.push(e[o]);n++}if(n>=128){var a=n,n=4;for(t.splice(i,0,a>>24&255,a>>16&255,a>>8&255,255&a);n>1&&!(a>>24);)a<<=8,n--;n<4&&t.splice(i,4-n),n|=128}return t.splice(i-2,2,r,n),t}function A(e,t,r,n){Object.defineProperties(this,{_key:{value:e},type:{value:e.type,enumerable:!0},extractable:{value:void 0===r?e.extractable:r,enumerable:!0},algorithm:{value:void 0===t?e.algorithm:t,enumerable:!0},usages:{value:void 0===n?e.usages:n,enumerable:!0}})}function x(e){return"verify"===e||"encrypt"===e||"wrapKey"===e}function I(e){return"sign"===e||"decrypt"===e||"unwrapKey"===e}}},function(e,t,r){var n=r(886),i=r(894),o=r(434);function s(){return Object.keys(o)}t.createCipher=t.Cipher=n.createCipher,t.createCipheriv=t.Cipheriv=n.createCipheriv,t.createDecipher=t.Decipher=i.createDecipher,t.createDecipheriv=t.Decipheriv=i.createDecipheriv,t.listCiphers=t.getCiphers=s},function(e,t,r){!function(e){"use strict";var t=function(e){var t,r=new Float64Array(16);if(e)for(t=0;t<e.length;t++)r[t]=e[t];return r},n=function(){throw new Error("no PRNG")},i=new Uint8Array(16),o=new Uint8Array(32);o[0]=9;var s=t(),a=t([1]),u=t([56129,1]),c=t([30883,4953,19914,30187,55467,16705,2637,112,59544,30585,16505,36039,65139,11119,27886,20995]),f=t([61785,9906,39828,60374,45398,33411,5274,224,53552,61171,33010,6542,64743,22239,55772,9222]),l=t([54554,36645,11616,51542,42930,38181,51040,26924,56412,64982,57905,49316,21502,52590,14035,8553]),h=t([26200,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214]),p=t([41136,18958,6951,50414,58488,44335,6150,12099,55207,15867,153,11085,57099,20417,9344,11139]);function d(e,t,r,n){e[t]=r>>24&255,e[t+1]=r>>16&255,e[t+2]=r>>8&255,e[t+3]=255&r,e[t+4]=n>>24&255,e[t+5]=n>>16&255,e[t+6]=n>>8&255,e[t+7]=255&n}function y(e,t,r,n,i){var o,s=0;for(o=0;o<i;o++)s|=e[t+o]^r[n+o];return(1&s-1>>>8)-1}function g(e,t,r,n){return y(e,t,r,n,16)}function m(e,t,r,n){return y(e,t,r,n,32)}function b(e,t,r,n){for(var i=255&n[0]|(255&n[1])<<8|(255&n[2])<<16|(255&n[3])<<24,o=255&r[0]|(255&r[1])<<8|(255&r[2])<<16|(255&r[3])<<24,s=255&r[4]|(255&r[5])<<8|(255&r[6])<<16|(255&r[7])<<24,a=255&r[8]|(255&r[9])<<8|(255&r[10])<<16|(255&r[11])<<24,u=255&r[12]|(255&r[13])<<8|(255&r[14])<<16|(255&r[15])<<24,c=255&n[4]|(255&n[5])<<8|(255&n[6])<<16|(255&n[7])<<24,f=255&t[0]|(255&t[1])<<8|(255&t[2])<<16|(255&t[3])<<24,l=255&t[4]|(255&t[5])<<8|(255&t[6])<<16|(255&t[7])<<24,h=255&t[8]|(255&t[9])<<8|(255&t[10])<<16|(255&t[11])<<24,p=255&t[12]|(255&t[13])<<8|(255&t[14])<<16|(255&t[15])<<24,d=255&n[8]|(255&n[9])<<8|(255&n[10])<<16|(255&n[11])<<24,y=255&r[16]|(255&r[17])<<8|(255&r[18])<<16|(255&r[19])<<24,g=255&r[20]|(255&r[21])<<8|(255&r[22])<<16|(255&r[23])<<24,m=255&r[24]|(255&r[25])<<8|(255&r[26])<<16|(255&r[27])<<24,b=255&r[28]|(255&r[29])<<8|(255&r[30])<<16|(255&r[31])<<24,v=255&n[12]|(255&n[13])<<8|(255&n[14])<<16|(255&n[15])<<24,_=i,w=o,S=s,k=a,E=u,A=c,x=f,I=l,T=h,B=p,C=d,P=y,O=g,R=m,N=b,L=v,j,M=0;M<20;M+=2)j=_+O|0,E^=j<<7|j>>>25,j=E+_|0,T^=j<<9|j>>>23,j=T+E|0,O^=j<<13|j>>>19,j=O+T|0,_^=j<<18|j>>>14,j=A+w|0,B^=j<<7|j>>>25,j=B+A|0,R^=j<<9|j>>>23,j=R+B|0,w^=j<<13|j>>>19,j=w+R|0,A^=j<<18|j>>>14,j=C+x|0,N^=j<<7|j>>>25,j=N+C|0,S^=j<<9|j>>>23,j=S+N|0,x^=j<<13|j>>>19,j=x+S|0,C^=j<<18|j>>>14,j=L+P|0,k^=j<<7|j>>>25,j=k+L|0,I^=j<<9|j>>>23,j=I+k|0,P^=j<<13|j>>>19,j=P+I|0,L^=j<<18|j>>>14,j=_+k|0,w^=j<<7|j>>>25,j=w+_|0,S^=j<<9|j>>>23,j=S+w|0,k^=j<<13|j>>>19,j=k+S|0,_^=j<<18|j>>>14,j=A+E|0,x^=j<<7|j>>>25,j=x+A|0,I^=j<<9|j>>>23,j=I+x|0,E^=j<<13|j>>>19,j=E+I|0,A^=j<<18|j>>>14,j=C+B|0,P^=j<<7|j>>>25,j=P+C|0,T^=j<<9|j>>>23,j=T+P|0,B^=j<<13|j>>>19,j=B+T|0,C^=j<<18|j>>>14,j=L+N|0,O^=j<<7|j>>>25,j=O+L|0,R^=j<<9|j>>>23,j=R+O|0,N^=j<<13|j>>>19,j=N+R|0,L^=j<<18|j>>>14;_=_+i|0,w=w+o|0,S=S+s|0,k=k+a|0,E=E+u|0,A=A+c|0,x=x+f|0,I=I+l|0,T=T+h|0,B=B+p|0,C=C+d|0,P=P+y|0,O=O+g|0,R=R+m|0,N=N+b|0,L=L+v|0,e[0]=_>>>0&255,e[1]=_>>>8&255,e[2]=_>>>16&255,e[3]=_>>>24&255,e[4]=w>>>0&255,e[5]=w>>>8&255,e[6]=w>>>16&255,e[7]=w>>>24&255,e[8]=S>>>0&255,e[9]=S>>>8&255,e[10]=S>>>16&255,e[11]=S>>>24&255,e[12]=k>>>0&255,e[13]=k>>>8&255,e[14]=k>>>16&255,e[15]=k>>>24&255,e[16]=E>>>0&255,e[17]=E>>>8&255,e[18]=E>>>16&255,e[19]=E>>>24&255,e[20]=A>>>0&255,e[21]=A>>>8&255,e[22]=A>>>16&255,e[23]=A>>>24&255,e[24]=x>>>0&255,e[25]=x>>>8&255,e[26]=x>>>16&255,e[27]=x>>>24&255,e[28]=I>>>0&255,e[29]=I>>>8&255,e[30]=I>>>16&255,e[31]=I>>>24&255,e[32]=T>>>0&255,e[33]=T>>>8&255,e[34]=T>>>16&255,e[35]=T>>>24&255,e[36]=B>>>0&255,e[37]=B>>>8&255,e[38]=B>>>16&255,e[39]=B>>>24&255,e[40]=C>>>0&255,e[41]=C>>>8&255,e[42]=C>>>16&255,e[43]=C>>>24&255,e[44]=P>>>0&255,e[45]=P>>>8&255,e[46]=P>>>16&255,e[47]=P>>>24&255,e[48]=O>>>0&255,e[49]=O>>>8&255,e[50]=O>>>16&255,e[51]=O>>>24&255,e[52]=R>>>0&255,e[53]=R>>>8&255,e[54]=R>>>16&255,e[55]=R>>>24&255,e[56]=N>>>0&255,e[57]=N>>>8&255,e[58]=N>>>16&255,e[59]=N>>>24&255,e[60]=L>>>0&255,e[61]=L>>>8&255,e[62]=L>>>16&255,e[63]=L>>>24&255}function v(e,t,r,n){for(var i=255&n[0]|(255&n[1])<<8|(255&n[2])<<16|(255&n[3])<<24,o=255&r[0]|(255&r[1])<<8|(255&r[2])<<16|(255&r[3])<<24,s=255&r[4]|(255&r[5])<<8|(255&r[6])<<16|(255&r[7])<<24,a=255&r[8]|(255&r[9])<<8|(255&r[10])<<16|(255&r[11])<<24,u=255&r[12]|(255&r[13])<<8|(255&r[14])<<16|(255&r[15])<<24,c=255&n[4]|(255&n[5])<<8|(255&n[6])<<16|(255&n[7])<<24,f=255&t[0]|(255&t[1])<<8|(255&t[2])<<16|(255&t[3])<<24,l=255&t[4]|(255&t[5])<<8|(255&t[6])<<16|(255&t[7])<<24,h=255&t[8]|(255&t[9])<<8|(255&t[10])<<16|(255&t[11])<<24,p=255&t[12]|(255&t[13])<<8|(255&t[14])<<16|(255&t[15])<<24,d=255&n[8]|(255&n[9])<<8|(255&n[10])<<16|(255&n[11])<<24,y=255&r[16]|(255&r[17])<<8|(255&r[18])<<16|(255&r[19])<<24,g=255&r[20]|(255&r[21])<<8|(255&r[22])<<16|(255&r[23])<<24,m=255&r[24]|(255&r[25])<<8|(255&r[26])<<16|(255&r[27])<<24,b=255&r[28]|(255&r[29])<<8|(255&r[30])<<16|(255&r[31])<<24,v=255&n[12]|(255&n[13])<<8|(255&n[14])<<16|(255&n[15])<<24,_=i,w=o,S=s,k=a,E=u,A=c,x=f,I=l,T=h,B=p,C=d,P=y,O=g,R=m,N=b,L=v,j,M=0;M<20;M+=2)j=_+O|0,E^=j<<7|j>>>25,j=E+_|0,T^=j<<9|j>>>23,j=T+E|0,O^=j<<13|j>>>19,j=O+T|0,_^=j<<18|j>>>14,j=A+w|0,B^=j<<7|j>>>25,j=B+A|0,R^=j<<9|j>>>23,j=R+B|0,w^=j<<13|j>>>19,j=w+R|0,A^=j<<18|j>>>14,j=C+x|0,N^=j<<7|j>>>25,j=N+C|0,S^=j<<9|j>>>23,j=S+N|0,x^=j<<13|j>>>19,j=x+S|0,C^=j<<18|j>>>14,j=L+P|0,k^=j<<7|j>>>25,j=k+L|0,I^=j<<9|j>>>23,j=I+k|0,P^=j<<13|j>>>19,j=P+I|0,L^=j<<18|j>>>14,j=_+k|0,w^=j<<7|j>>>25,j=w+_|0,S^=j<<9|j>>>23,j=S+w|0,k^=j<<13|j>>>19,j=k+S|0,_^=j<<18|j>>>14,j=A+E|0,x^=j<<7|j>>>25,j=x+A|0,I^=j<<9|j>>>23,j=I+x|0,E^=j<<13|j>>>19,j=E+I|0,A^=j<<18|j>>>14,j=C+B|0,P^=j<<7|j>>>25,j=P+C|0,T^=j<<9|j>>>23,j=T+P|0,B^=j<<13|j>>>19,j=B+T|0,C^=j<<18|j>>>14,j=L+N|0,O^=j<<7|j>>>25,j=O+L|0,R^=j<<9|j>>>23,j=R+O|0,N^=j<<13|j>>>19,j=N+R|0,L^=j<<18|j>>>14;e[0]=_>>>0&255,e[1]=_>>>8&255,e[2]=_>>>16&255,e[3]=_>>>24&255,e[4]=A>>>0&255,e[5]=A>>>8&255,e[6]=A>>>16&255,e[7]=A>>>24&255,e[8]=C>>>0&255,e[9]=C>>>8&255,e[10]=C>>>16&255,e[11]=C>>>24&255,e[12]=L>>>0&255,e[13]=L>>>8&255,e[14]=L>>>16&255,e[15]=L>>>24&255,e[16]=x>>>0&255,e[17]=x>>>8&255,e[18]=x>>>16&255,e[19]=x>>>24&255,e[20]=I>>>0&255,e[21]=I>>>8&255,e[22]=I>>>16&255,e[23]=I>>>24&255,e[24]=T>>>0&255,e[25]=T>>>8&255,e[26]=T>>>16&255,e[27]=T>>>24&255,e[28]=B>>>0&255,e[29]=B>>>8&255,e[30]=B>>>16&255,e[31]=B>>>24&255}function _(e,t,r,n){b(e,t,r,n)}function w(e,t,r,n){v(e,t,r,n)}var S=new Uint8Array([101,120,112,97,110,100,32,51,50,45,98,121,116,101,32,107]);function k(e,t,r,n,i,o,s){var a=new Uint8Array(16),u=new Uint8Array(64),c,f;for(f=0;f<16;f++)a[f]=0;for(f=0;f<8;f++)a[f]=o[f];for(;i>=64;){for(_(u,a,s,S),f=0;f<64;f++)e[t+f]=r[n+f]^u[f];for(c=1,f=8;f<16;f++)c=c+(255&a[f])|0,a[f]=255&c,c>>>=8;i-=64,t+=64,n+=64}if(i>0)for(_(u,a,s,S),f=0;f<i;f++)e[t+f]=r[n+f]^u[f];return 0}function E(e,t,r,n,i){var o=new Uint8Array(16),s=new Uint8Array(64),a,u;for(u=0;u<16;u++)o[u]=0;for(u=0;u<8;u++)o[u]=n[u];for(;r>=64;){for(_(s,o,i,S),u=0;u<64;u++)e[t+u]=s[u];for(a=1,u=8;u<16;u++)a=a+(255&o[u])|0,o[u]=255&a,a>>>=8;r-=64,t+=64}if(r>0)for(_(s,o,i,S),u=0;u<r;u++)e[t+u]=s[u];return 0}function A(e,t,r,n,i){var o=new Uint8Array(32);w(o,n,i,S);for(var s=new Uint8Array(8),a=0;a<8;a++)s[a]=n[a+16];return E(e,t,r,s,o)}function x(e,t,r,n,i,o,s){var a=new Uint8Array(32);w(a,o,s,S);for(var u=new Uint8Array(8),c=0;c<8;c++)u[c]=o[c+16];return k(e,t,r,n,i,u,a)}var I=function(e){var t,r,n,i,o,s,a,u;this.buffer=new Uint8Array(16),this.r=new Uint16Array(10),this.h=new Uint16Array(10),this.pad=new Uint16Array(8),this.leftover=0,this.fin=0,t=255&e[0]|(255&e[1])<<8,this.r[0]=8191&t,r=255&e[2]|(255&e[3])<<8,this.r[1]=8191&(t>>>13|r<<3),n=255&e[4]|(255&e[5])<<8,this.r[2]=7939&(r>>>10|n<<6),i=255&e[6]|(255&e[7])<<8,this.r[3]=8191&(n>>>7|i<<9),o=255&e[8]|(255&e[9])<<8,this.r[4]=255&(i>>>4|o<<12),this.r[5]=o>>>1&8190,s=255&e[10]|(255&e[11])<<8,this.r[6]=8191&(o>>>14|s<<2),a=255&e[12]|(255&e[13])<<8,this.r[7]=8065&(s>>>11|a<<5),u=255&e[14]|(255&e[15])<<8,this.r[8]=8191&(a>>>8|u<<8),this.r[9]=u>>>5&127,this.pad[0]=255&e[16]|(255&e[17])<<8,this.pad[1]=255&e[18]|(255&e[19])<<8,this.pad[2]=255&e[20]|(255&e[21])<<8,this.pad[3]=255&e[22]|(255&e[23])<<8,this.pad[4]=255&e[24]|(255&e[25])<<8,this.pad[5]=255&e[26]|(255&e[27])<<8,this.pad[6]=255&e[28]|(255&e[29])<<8,this.pad[7]=255&e[30]|(255&e[31])<<8};function T(e,t,r,n,i,o){var s=new I(o);return s.update(r,n,i),s.finish(e,t),0}function B(e,t,r,n,i,o){var s=new Uint8Array(16);return T(s,0,r,n,i,o),g(e,t,s,0)}function C(e,t,r,n,i){var o;if(r<32)return-1;for(x(e,0,t,0,r,n,i),T(e,16,e,32,r-32,e),o=0;o<16;o++)e[o]=0;return 0}function P(e,t,r,n,i){var o,s=new Uint8Array(32);if(r<32)return-1;if(A(s,0,32,n,i),0!==B(t,16,t,32,r-32,s))return-1;for(x(e,0,t,0,r,n,i),o=0;o<32;o++)e[o]=0;return 0}function O(e,t){var r;for(r=0;r<16;r++)e[r]=0|t[r]}function R(e){var t,r,n=1;for(t=0;t<16;t++)r=e[t]+n+65535,n=Math.floor(r/65536),e[t]=r-65536*n;e[0]+=n-1+37*(n-1)}function N(e,t,r){for(var n,i=~(r-1),o=0;o<16;o++)n=i&(e[o]^t[o]),e[o]^=n,t[o]^=n}function L(e,r){var n,i,o,s=t(),a=t();for(n=0;n<16;n++)a[n]=r[n];for(R(a),R(a),R(a),i=0;i<2;i++){for(s[0]=a[0]-65517,n=1;n<15;n++)s[n]=a[n]-65535-(s[n-1]>>16&1),s[n-1]&=65535;s[15]=a[15]-32767-(s[14]>>16&1),o=s[15]>>16&1,s[14]&=65535,N(a,s,1-o)}for(n=0;n<16;n++)e[2*n]=255&a[n],e[2*n+1]=a[n]>>8}function j(e,t){var r=new Uint8Array(32),n=new Uint8Array(32);return L(r,e),L(n,t),m(r,0,n,0)}function M(e){var t=new Uint8Array(32);return L(t,e),1&t[0]}function K(e,t){var r;for(r=0;r<16;r++)e[r]=t[2*r]+(t[2*r+1]<<8);e[15]&=32767}function D(e,t,r){for(var n=0;n<16;n++)e[n]=t[n]+r[n]}function U(e,t,r){for(var n=0;n<16;n++)e[n]=t[n]-r[n]}function F(e,t,r){var n,i,o=0,s=0,a=0,u=0,c=0,f=0,l=0,h=0,p=0,d=0,y=0,g=0,m=0,b=0,v=0,_=0,w=0,S=0,k=0,E=0,A=0,x=0,I=0,T=0,B=0,C=0,P=0,O=0,R=0,N=0,L=0,j=r[0],M=r[1],K=r[2],D=r[3],U=r[4],F=r[5],q=r[6],H=r[7],z=r[8],V=r[9],G=r[10],W=r[11],$=r[12],Y=r[13],J=r[14],X=r[15];n=t[0],o+=n*j,s+=n*M,a+=n*K,u+=n*D,c+=n*U,f+=n*F,l+=n*q,h+=n*H,p+=n*z,d+=n*V,y+=n*G,g+=n*W,m+=n*$,b+=n*Y,v+=n*J,_+=n*X,n=t[1],s+=n*j,a+=n*M,u+=n*K,c+=n*D,f+=n*U,l+=n*F,h+=n*q,p+=n*H,d+=n*z,y+=n*V,g+=n*G,m+=n*W,b+=n*$,v+=n*Y,_+=n*J,w+=n*X,n=t[2],a+=n*j,u+=n*M,c+=n*K,f+=n*D,l+=n*U,h+=n*F,p+=n*q,d+=n*H,y+=n*z,g+=n*V,m+=n*G,b+=n*W,v+=n*$,_+=n*Y,w+=n*J,S+=n*X,n=t[3],u+=n*j,c+=n*M,f+=n*K,l+=n*D,h+=n*U,p+=n*F,d+=n*q,y+=n*H,g+=n*z,m+=n*V,b+=n*G,v+=n*W,_+=n*$,w+=n*Y,S+=n*J,k+=n*X,n=t[4],c+=n*j,f+=n*M,l+=n*K,h+=n*D,p+=n*U,d+=n*F,y+=n*q,g+=n*H,m+=n*z,b+=n*V,v+=n*G,_+=n*W,w+=n*$,S+=n*Y,k+=n*J,E+=n*X,n=t[5],f+=n*j,l+=n*M,h+=n*K,p+=n*D,d+=n*U,y+=n*F,g+=n*q,m+=n*H,b+=n*z,v+=n*V,_+=n*G,w+=n*W,S+=n*$,k+=n*Y,E+=n*J,A+=n*X,n=t[6],l+=n*j,h+=n*M,p+=n*K,d+=n*D,y+=n*U,g+=n*F,m+=n*q,b+=n*H,v+=n*z,_+=n*V,w+=n*G,S+=n*W,k+=n*$,E+=n*Y,A+=n*J,x+=n*X,n=t[7],h+=n*j,p+=n*M,d+=n*K,y+=n*D,g+=n*U,m+=n*F,b+=n*q,v+=n*H,_+=n*z,w+=n*V,S+=n*G,k+=n*W,E+=n*$,A+=n*Y,x+=n*J,I+=n*X,n=t[8],p+=n*j,d+=n*M,y+=n*K,g+=n*D,m+=n*U,b+=n*F,v+=n*q,_+=n*H,w+=n*z,S+=n*V,k+=n*G,E+=n*W,A+=n*$,x+=n*Y,I+=n*J,T+=n*X,n=t[9],d+=n*j,y+=n*M,g+=n*K,m+=n*D,b+=n*U,v+=n*F,_+=n*q,w+=n*H,S+=n*z,k+=n*V,E+=n*G,A+=n*W,x+=n*$,I+=n*Y,T+=n*J,B+=n*X,n=t[10],y+=n*j,g+=n*M,m+=n*K,b+=n*D,v+=n*U,_+=n*F,w+=n*q,S+=n*H,k+=n*z,E+=n*V,A+=n*G,x+=n*W,I+=n*$,T+=n*Y,B+=n*J,C+=n*X,n=t[11],g+=n*j,m+=n*M,b+=n*K,v+=n*D,_+=n*U,w+=n*F,S+=n*q,k+=n*H,E+=n*z,A+=n*V,x+=n*G,I+=n*W,T+=n*$,B+=n*Y,C+=n*J,P+=n*X,n=t[12],m+=n*j,b+=n*M,v+=n*K,_+=n*D,w+=n*U,S+=n*F,k+=n*q,E+=n*H,A+=n*z,x+=n*V,I+=n*G,T+=n*W,B+=n*$,C+=n*Y,P+=n*J,O+=n*X,n=t[13],b+=n*j,v+=n*M,_+=n*K,w+=n*D,S+=n*U,k+=n*F,E+=n*q,A+=n*H,x+=n*z,I+=n*V,T+=n*G,B+=n*W,C+=n*$,P+=n*Y,O+=n*J,R+=n*X,n=t[14],v+=n*j,_+=n*M,w+=n*K,S+=n*D,k+=n*U,E+=n*F,A+=n*q,x+=n*H,I+=n*z,T+=n*V,B+=n*G,C+=n*W,P+=n*$,O+=n*Y,R+=n*J,N+=n*X,n=t[15],_+=n*j,w+=n*M,S+=n*K,k+=n*D,E+=n*U,A+=n*F,x+=n*q,I+=n*H,T+=n*z,B+=n*V,C+=n*G,P+=n*W,O+=n*$,R+=n*Y,N+=n*J,L+=n*X,o+=38*w,s+=38*S,a+=38*k,u+=38*E,c+=38*A,f+=38*x,l+=38*I,h+=38*T,p+=38*B,d+=38*C,y+=38*P,g+=38*O,m+=38*R,b+=38*N,v+=38*L,i=1,n=o+i+65535,i=Math.floor(n/65536),o=n-65536*i,n=s+i+65535,i=Math.floor(n/65536),s=n-65536*i,n=a+i+65535,i=Math.floor(n/65536),a=n-65536*i,n=u+i+65535,i=Math.floor(n/65536),u=n-65536*i,n=c+i+65535,i=Math.floor(n/65536),c=n-65536*i,n=f+i+65535,i=Math.floor(n/65536),f=n-65536*i,n=l+i+65535,i=Math.floor(n/65536),l=n-65536*i,n=h+i+65535,i=Math.floor(n/65536),h=n-65536*i,n=p+i+65535,i=Math.floor(n/65536),p=n-65536*i,n=d+i+65535,i=Math.floor(n/65536),d=n-65536*i,n=y+i+65535,i=Math.floor(n/65536),y=n-65536*i,n=g+i+65535,i=Math.floor(n/65536),g=n-65536*i,n=m+i+65535,i=Math.floor(n/65536),m=n-65536*i,n=b+i+65535,i=Math.floor(n/65536),b=n-65536*i,n=v+i+65535,i=Math.floor(n/65536),v=n-65536*i,n=_+i+65535,i=Math.floor(n/65536),_=n-65536*i,o+=i-1+37*(i-1),i=1,n=o+i+65535,i=Math.floor(n/65536),o=n-65536*i,n=s+i+65535,i=Math.floor(n/65536),s=n-65536*i,n=a+i+65535,i=Math.floor(n/65536),a=n-65536*i,n=u+i+65535,i=Math.floor(n/65536),u=n-65536*i,n=c+i+65535,i=Math.floor(n/65536),c=n-65536*i,n=f+i+65535,i=Math.floor(n/65536),f=n-65536*i,n=l+i+65535,i=Math.floor(n/65536),l=n-65536*i,n=h+i+65535,i=Math.floor(n/65536),h=n-65536*i,n=p+i+65535,i=Math.floor(n/65536),p=n-65536*i,n=d+i+65535,i=Math.floor(n/65536),d=n-65536*i,n=y+i+65535,i=Math.floor(n/65536),y=n-65536*i,n=g+i+65535,i=Math.floor(n/65536),g=n-65536*i,n=m+i+65535,i=Math.floor(n/65536),m=n-65536*i,n=b+i+65535,i=Math.floor(n/65536),b=n-65536*i,n=v+i+65535,i=Math.floor(n/65536),v=n-65536*i,n=_+i+65535,i=Math.floor(n/65536),_=n-65536*i,o+=i-1+37*(i-1),e[0]=o,e[1]=s,e[2]=a,e[3]=u,e[4]=c,e[5]=f,e[6]=l,e[7]=h,e[8]=p,e[9]=d,e[10]=y,e[11]=g,e[12]=m,e[13]=b,e[14]=v,e[15]=_}function q(e,t){F(e,t,t)}function H(e,r){var n=t(),i;for(i=0;i<16;i++)n[i]=r[i];for(i=253;i>=0;i--)q(n,n),2!==i&&4!==i&&F(n,n,r);for(i=0;i<16;i++)e[i]=n[i]}function z(e,r){var n=t(),i;for(i=0;i<16;i++)n[i]=r[i];for(i=250;i>=0;i--)q(n,n),1!==i&&F(n,n,r);for(i=0;i<16;i++)e[i]=n[i]}function V(e,r,n){var i=new Uint8Array(32),o=new Float64Array(80),s,a,c=t(),f=t(),l=t(),h=t(),p=t(),d=t();for(a=0;a<31;a++)i[a]=r[a];for(i[31]=127&r[31]|64,i[0]&=248,K(o,n),a=0;a<16;a++)f[a]=o[a],h[a]=c[a]=l[a]=0;for(c[0]=h[0]=1,a=254;a>=0;--a)s=i[a>>>3]>>>(7&a)&1,N(c,f,s),N(l,h,s),D(p,c,l),U(c,c,l),D(l,f,h),U(f,f,h),q(h,p),q(d,c),F(c,l,c),F(l,f,p),D(p,c,l),U(c,c,l),q(f,c),U(l,h,d),F(c,l,u),D(c,c,h),F(l,l,c),F(c,h,d),F(h,f,o),q(f,p),N(c,f,s),N(l,h,s);for(a=0;a<16;a++)o[a+16]=c[a],o[a+32]=l[a],o[a+48]=f[a],o[a+64]=h[a];var y=o.subarray(32),g=o.subarray(16);return H(y,y),F(g,g,y),L(e,g),0}function G(e,t){return V(e,t,o)}function W(e,t){return n(t,32),G(e,t)}function $(e,t,r){var n=new Uint8Array(32);return V(n,r,t),w(e,i,n,S)}I.prototype.blocks=function(e,t,r){for(var n=this.fin?0:2048,i,o,s,a,u,c,f,l,h,p,d,y,g,m,b,v,_,w,S,k=this.h[0],E=this.h[1],A=this.h[2],x=this.h[3],I=this.h[4],T=this.h[5],B=this.h[6],C=this.h[7],P=this.h[8],O=this.h[9],R=this.r[0],N=this.r[1],L=this.r[2],j=this.r[3],M=this.r[4],K=this.r[5],D=this.r[6],U=this.r[7],F=this.r[8],q=this.r[9];r>=16;)i=255&e[t+0]|(255&e[t+1])<<8,k+=8191&i,o=255&e[t+2]|(255&e[t+3])<<8,E+=8191&(i>>>13|o<<3),s=255&e[t+4]|(255&e[t+5])<<8,A+=8191&(o>>>10|s<<6),a=255&e[t+6]|(255&e[t+7])<<8,x+=8191&(s>>>7|a<<9),u=255&e[t+8]|(255&e[t+9])<<8,I+=8191&(a>>>4|u<<12),T+=u>>>1&8191,c=255&e[t+10]|(255&e[t+11])<<8,B+=8191&(u>>>14|c<<2),f=255&e[t+12]|(255&e[t+13])<<8,C+=8191&(c>>>11|f<<5),l=255&e[t+14]|(255&e[t+15])<<8,P+=8191&(f>>>8|l<<8),O+=l>>>5|n,h=0,p=h,p+=k*R,p+=E*(5*q),p+=A*(5*F),p+=x*(5*U),p+=I*(5*D),h=p>>>13,p&=8191,p+=T*(5*K),p+=B*(5*M),p+=C*(5*j),p+=P*(5*L),p+=O*(5*N),h+=p>>>13,p&=8191,d=h,d+=k*N,d+=E*R,d+=A*(5*q),d+=x*(5*F),d+=I*(5*U),h=d>>>13,d&=8191,d+=T*(5*D),d+=B*(5*K),d+=C*(5*M),d+=P*(5*j),d+=O*(5*L),h+=d>>>13,d&=8191,y=h,y+=k*L,y+=E*N,y+=A*R,y+=x*(5*q),y+=I*(5*F),h=y>>>13,y&=8191,y+=T*(5*U),y+=B*(5*D),y+=C*(5*K),y+=P*(5*M),y+=O*(5*j),h+=y>>>13,y&=8191,g=h,g+=k*j,g+=E*L,g+=A*N,g+=x*R,g+=I*(5*q),h=g>>>13,g&=8191,g+=T*(5*F),g+=B*(5*U),g+=C*(5*D),g+=P*(5*K),g+=O*(5*M),h+=g>>>13,g&=8191,m=h,m+=k*M,m+=E*j,m+=A*L,m+=x*N,m+=I*R,h=m>>>13,m&=8191,m+=T*(5*q),m+=B*(5*F),m+=C*(5*U),m+=P*(5*D),m+=O*(5*K),h+=m>>>13,m&=8191,b=h,b+=k*K,b+=E*M,b+=A*j,b+=x*L,b+=I*N,h=b>>>13,b&=8191,b+=T*R,b+=B*(5*q),b+=C*(5*F),b+=P*(5*U),b+=O*(5*D),h+=b>>>13,b&=8191,v=h,v+=k*D,v+=E*K,v+=A*M,v+=x*j,v+=I*L,h=v>>>13,v&=8191,v+=T*N,v+=B*R,v+=C*(5*q),v+=P*(5*F),v+=O*(5*U),h+=v>>>13,v&=8191,_=h,_+=k*U,_+=E*D,_+=A*K,_+=x*M,_+=I*j,h=_>>>13,_&=8191,_+=T*L,_+=B*N,_+=C*R,_+=P*(5*q),_+=O*(5*F),h+=_>>>13,_&=8191,w=h,w+=k*F,w+=E*U,w+=A*D,w+=x*K,w+=I*M,h=w>>>13,w&=8191,w+=T*j,w+=B*L,w+=C*N,w+=P*R,w+=O*(5*q),h+=w>>>13,w&=8191,S=h,S+=k*q,S+=E*F,S+=A*U,S+=x*D,S+=I*K,h=S>>>13,S&=8191,S+=T*M,S+=B*j,S+=C*L,S+=P*N,S+=O*R,h+=S>>>13,S&=8191,h=(h<<2)+h|0,h=h+p|0,p=8191&h,h>>>=13,d+=h,k=p,E=d,A=y,x=g,I=m,T=b,B=v,C=_,P=w,O=S,t+=16,r-=16;this.h[0]=k,this.h[1]=E,this.h[2]=A,this.h[3]=x,this.h[4]=I,this.h[5]=T,this.h[6]=B,this.h[7]=C,this.h[8]=P,this.h[9]=O},I.prototype.finish=function(e,t){var r=new Uint16Array(10),n,i,o,s;if(this.leftover){for(s=this.leftover,this.buffer[s++]=1;s<16;s++)this.buffer[s]=0;this.fin=1,this.blocks(this.buffer,0,16)}for(n=this.h[1]>>>13,this.h[1]&=8191,s=2;s<10;s++)this.h[s]+=n,n=this.h[s]>>>13,this.h[s]&=8191;for(this.h[0]+=5*n,n=this.h[0]>>>13,this.h[0]&=8191,this.h[1]+=n,n=this.h[1]>>>13,this.h[1]&=8191,this.h[2]+=n,r[0]=this.h[0]+5,n=r[0]>>>13,r[0]&=8191,s=1;s<10;s++)r[s]=this.h[s]+n,n=r[s]>>>13,r[s]&=8191;for(r[9]-=8192,i=(1^n)-1,s=0;s<10;s++)r[s]&=i;for(i=~i,s=0;s<10;s++)this.h[s]=this.h[s]&i|r[s];for(this.h[0]=65535&(this.h[0]|this.h[1]<<13),this.h[1]=65535&(this.h[1]>>>3|this.h[2]<<10),this.h[2]=65535&(this.h[2]>>>6|this.h[3]<<7),this.h[3]=65535&(this.h[3]>>>9|this.h[4]<<4),this.h[4]=65535&(this.h[4]>>>12|this.h[5]<<1|this.h[6]<<14),this.h[5]=65535&(this.h[6]>>>2|this.h[7]<<11),this.h[6]=65535&(this.h[7]>>>5|this.h[8]<<8),this.h[7]=65535&(this.h[8]>>>8|this.h[9]<<5),o=this.h[0]+this.pad[0],this.h[0]=65535&o,s=1;s<8;s++)o=(this.h[s]+this.pad[s]|0)+(o>>>16)|0,this.h[s]=65535&o;e[t+0]=this.h[0]>>>0&255,e[t+1]=this.h[0]>>>8&255,e[t+2]=this.h[1]>>>0&255,e[t+3]=this.h[1]>>>8&255,e[t+4]=this.h[2]>>>0&255,e[t+5]=this.h[2]>>>8&255,e[t+6]=this.h[3]>>>0&255,e[t+7]=this.h[3]>>>8&255,e[t+8]=this.h[4]>>>0&255,e[t+9]=this.h[4]>>>8&255,e[t+10]=this.h[5]>>>0&255,e[t+11]=this.h[5]>>>8&255,e[t+12]=this.h[6]>>>0&255,e[t+13]=this.h[6]>>>8&255,e[t+14]=this.h[7]>>>0&255,e[t+15]=this.h[7]>>>8&255},I.prototype.update=function(e,t,r){var n,i;if(this.leftover){for(i=16-this.leftover,i>r&&(i=r),n=0;n<i;n++)this.buffer[this.leftover+n]=e[t+n];if(r-=i,t+=i,this.leftover+=i,this.leftover<16)return;this.blocks(this.buffer,0,16),this.leftover=0}if(r>=16&&(i=r-r%16,this.blocks(e,t,i),t+=i,r-=i),r){for(n=0;n<r;n++)this.buffer[this.leftover+n]=e[t+n];this.leftover+=r}};var Y=C,J=P;function X(e,t,r,n,i,o){var s=new Uint8Array(32);return $(s,i,o),Y(e,t,r,n,s)}function Z(e,t,r,n,i,o){var s=new Uint8Array(32);return $(s,i,o),J(e,t,r,n,s)}var Q=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591];function ee(e,t,r,n){for(var i=new Int32Array(16),o=new Int32Array(16),s,a,u,c,f,l,h,p,d,y,g,m,b,v,_,w,S,k,E,A,x,I,T,B,C,P,O=e[0],R=e[1],N=e[2],L=e[3],j=e[4],M=e[5],K=e[6],D=e[7],U=t[0],F=t[1],q=t[2],H=t[3],z=t[4],V=t[5],G=t[6],W=t[7],$=0;n>=128;){for(E=0;E<16;E++)A=8*E+$,i[E]=r[A+0]<<24|r[A+1]<<16|r[A+2]<<8|r[A+3],o[E]=r[A+4]<<24|r[A+5]<<16|r[A+6]<<8|r[A+7];for(E=0;E<80;E++)if(s=O,a=R,u=N,c=L,f=j,l=M,h=K,p=D,d=U,y=F,g=q,m=H,b=z,v=V,_=G,w=W,x=D,I=W,T=65535&I,B=I>>>16,C=65535&x,P=x>>>16,x=(j>>>14|z<<18)^(j>>>18|z<<14)^(z>>>9|j<<23),I=(z>>>14|j<<18)^(z>>>18|j<<14)^(j>>>9|z<<23),T+=65535&I,B+=I>>>16,C+=65535&x,P+=x>>>16,x=j&M^~j&K,I=z&V^~z&G,T+=65535&I,B+=I>>>16,C+=65535&x,P+=x>>>16,x=Q[2*E],I=Q[2*E+1],T+=65535&I,B+=I>>>16,C+=65535&x,P+=x>>>16,x=i[E%16],I=o[E%16],T+=65535&I,B+=I>>>16,C+=65535&x,P+=x>>>16,B+=T>>>16,C+=B>>>16,P+=C>>>16,S=65535&C|P<<16,k=65535&T|B<<16,x=S,I=k,T=65535&I,B=I>>>16,C=65535&x,P=x>>>16,x=(O>>>28|U<<4)^(U>>>2|O<<30)^(U>>>7|O<<25),I=(U>>>28|O<<4)^(O>>>2|U<<30)^(O>>>7|U<<25),T+=65535&I,B+=I>>>16,C+=65535&x,P+=x>>>16,x=O&R^O&N^R&N,I=U&F^U&q^F&q,T+=65535&I,B+=I>>>16,C+=65535&x,P+=x>>>16,B+=T>>>16,C+=B>>>16,P+=C>>>16,p=65535&C|P<<16,w=65535&T|B<<16,x=c,I=m,T=65535&I,B=I>>>16,C=65535&x,P=x>>>16,x=S,I=k,T+=65535&I,B+=I>>>16,C+=65535&x,P+=x>>>16,B+=T>>>16,C+=B>>>16,P+=C>>>16,c=65535&C|P<<16,m=65535&T|B<<16,R=s,N=a,L=u,j=c,M=f,K=l,D=h,O=p,F=d,q=y,H=g,z=m,V=b,G=v,W=_,U=w,E%16==15)for(A=0;A<16;A++)x=i[A],I=o[A],T=65535&I,B=I>>>16,C=65535&x,P=x>>>16,x=i[(A+9)%16],I=o[(A+9)%16],T+=65535&I,B+=I>>>16,C+=65535&x,P+=x>>>16,S=i[(A+1)%16],k=o[(A+1)%16],x=(S>>>1|k<<31)^(S>>>8|k<<24)^S>>>7,I=(k>>>1|S<<31)^(k>>>8|S<<24)^(k>>>7|S<<25),T+=65535&I,B+=I>>>16,C+=65535&x,P+=x>>>16,S=i[(A+14)%16],k=o[(A+14)%16],x=(S>>>19|k<<13)^(k>>>29|S<<3)^S>>>6,I=(k>>>19|S<<13)^(S>>>29|k<<3)^(k>>>6|S<<26),T+=65535&I,B+=I>>>16,C+=65535&x,P+=x>>>16,B+=T>>>16,C+=B>>>16,P+=C>>>16,i[A]=65535&C|P<<16,o[A]=65535&T|B<<16;x=O,I=U,T=65535&I,B=I>>>16,C=65535&x,P=x>>>16,x=e[0],I=t[0],T+=65535&I,B+=I>>>16,C+=65535&x,P+=x>>>16,B+=T>>>16,C+=B>>>16,P+=C>>>16,e[0]=O=65535&C|P<<16,t[0]=U=65535&T|B<<16,x=R,I=F,T=65535&I,B=I>>>16,C=65535&x,P=x>>>16,x=e[1],I=t[1],T+=65535&I,B+=I>>>16,C+=65535&x,P+=x>>>16,B+=T>>>16,C+=B>>>16,P+=C>>>16,e[1]=R=65535&C|P<<16,t[1]=F=65535&T|B<<16,x=N,I=q,T=65535&I,B=I>>>16,C=65535&x,P=x>>>16,x=e[2],I=t[2],T+=65535&I,B+=I>>>16,C+=65535&x,P+=x>>>16,B+=T>>>16,C+=B>>>16,P+=C>>>16,e[2]=N=65535&C|P<<16,t[2]=q=65535&T|B<<16,x=L,I=H,T=65535&I,B=I>>>16,C=65535&x,P=x>>>16,x=e[3],I=t[3],T+=65535&I,B+=I>>>16,C+=65535&x,P+=x>>>16,B+=T>>>16,C+=B>>>16,P+=C>>>16,e[3]=L=65535&C|P<<16,t[3]=H=65535&T|B<<16,x=j,I=z,T=65535&I,B=I>>>16,C=65535&x,P=x>>>16,x=e[4],I=t[4],T+=65535&I,B+=I>>>16,C+=65535&x,P+=x>>>16,B+=T>>>16,C+=B>>>16,P+=C>>>16,e[4]=j=65535&C|P<<16,t[4]=z=65535&T|B<<16,x=M,I=V,T=65535&I,B=I>>>16,C=65535&x,P=x>>>16,x=e[5],I=t[5],T+=65535&I,B+=I>>>16,C+=65535&x,P+=x>>>16,B+=T>>>16,C+=B>>>16,P+=C>>>16,e[5]=M=65535&C|P<<16,t[5]=V=65535&T|B<<16,x=K,I=G,T=65535&I,B=I>>>16,C=65535&x,P=x>>>16,x=e[6],I=t[6],T+=65535&I,B+=I>>>16,C+=65535&x,P+=x>>>16,B+=T>>>16,C+=B>>>16,P+=C>>>16,e[6]=K=65535&C|P<<16,t[6]=G=65535&T|B<<16,x=D,I=W,T=65535&I,B=I>>>16,C=65535&x,P=x>>>16,x=e[7],I=t[7],T+=65535&I,B+=I>>>16,C+=65535&x,P+=x>>>16,B+=T>>>16,C+=B>>>16,P+=C>>>16,e[7]=D=65535&C|P<<16,t[7]=W=65535&T|B<<16,$+=128,n-=128}return n}function te(e,t,r){var n=new Int32Array(8),i=new Int32Array(8),o=new Uint8Array(256),s,a=r;for(n[0]=1779033703,n[1]=3144134277,n[2]=1013904242,n[3]=2773480762,n[4]=1359893119,n[5]=2600822924,n[6]=528734635,n[7]=1541459225,i[0]=4089235720,i[1]=2227873595,i[2]=4271175723,i[3]=1595750129,i[4]=2917565137,i[5]=725511199,i[6]=4215389547,i[7]=327033209,ee(n,i,t,r),r%=128,s=0;s<r;s++)o[s]=t[a-r+s];for(o[r]=128,r=256-128*(r<112?1:0),o[r-9]=0,d(o,r-8,a/536870912|0,a<<3),ee(n,i,o,r),s=0;s<8;s++)d(e,8*s,n[s],i[s]);return 0}function re(e,r){var n=t(),i=t(),o=t(),s=t(),a=t(),u=t(),c=t(),l=t(),h=t();U(n,e[1],e[0]),U(h,r[1],r[0]),F(n,n,h),D(i,e[0],e[1]),D(h,r[0],r[1]),F(i,i,h),F(o,e[3],r[3]),F(o,o,f),F(s,e[2],r[2]),D(s,s,s),U(a,i,n),U(u,s,o),D(c,s,o),D(l,i,n),F(e[0],a,u),F(e[1],l,c),F(e[2],c,u),F(e[3],a,l)}function ne(e,t,r){var n;for(n=0;n<4;n++)N(e[n],t[n],r)}function ie(e,r){var n=t(),i=t(),o=t();H(o,r[2]),F(n,r[0],o),F(i,r[1],o),L(e,i),e[31]^=M(n)<<7}function oe(e,t,r){var n,i;for(O(e[0],s),O(e[1],a),O(e[2],a),O(e[3],s),i=255;i>=0;--i)n=r[i/8|0]>>(7&i)&1,ne(e,t,n),re(t,e),re(e,e),ne(e,t,n)}function se(e,r){var n=[t(),t(),t(),t()];O(n[0],l),O(n[1],h),O(n[2],a),F(n[3],l,h),oe(e,n,r)}function ae(e,r,i){var o=new Uint8Array(64),s=[t(),t(),t(),t()],a;for(i||n(r,32),te(o,r,32),o[0]&=248,o[31]&=127,o[31]|=64,se(s,o),ie(e,s),a=0;a<32;a++)r[a+32]=e[a];return 0}var ue=new Float64Array([237,211,245,92,26,99,18,88,214,156,247,162,222,249,222,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16]);function ce(e,t){var r,n,i,o;for(n=63;n>=32;--n){for(r=0,i=n-32,o=n-12;i<o;++i)t[i]+=r-16*t[n]*ue[i-(n-32)],r=t[i]+128>>8,t[i]-=256*r;t[i]+=r,t[n]=0}for(r=0,i=0;i<32;i++)t[i]+=r-(t[31]>>4)*ue[i],r=t[i]>>8,t[i]&=255;for(i=0;i<32;i++)t[i]-=r*ue[i];for(n=0;n<32;n++)t[n+1]+=t[n]>>8,e[n]=255&t[n]}function fe(e){var t=new Float64Array(64),r;for(r=0;r<64;r++)t[r]=e[r];for(r=0;r<64;r++)e[r]=0;ce(e,t)}function le(e,r,n,i){var o=new Uint8Array(64),s=new Uint8Array(64),a=new Uint8Array(64),u,c,f=new Float64Array(64),l=[t(),t(),t(),t()];te(o,i,32),o[0]&=248,o[31]&=127,o[31]|=64;var h=n+64;for(u=0;u<n;u++)e[64+u]=r[u];for(u=0;u<32;u++)e[32+u]=o[32+u];for(te(a,e.subarray(32),n+32),fe(a),se(l,a),ie(e,l),u=32;u<64;u++)e[u]=i[u];for(te(s,e,n+64),fe(s),u=0;u<64;u++)f[u]=0;for(u=0;u<32;u++)f[u]=a[u];for(u=0;u<32;u++)for(c=0;c<32;c++)f[u+c]+=s[u]*o[c];return ce(e.subarray(32),f),h}function he(e,r){var n=t(),i=t(),o=t(),u=t(),f=t(),l=t(),h=t();return O(e[2],a),K(e[1],r),q(o,e[1]),F(u,o,c),U(o,o,e[2]),D(u,e[2],u),q(f,u),q(l,f),F(h,l,f),F(n,h,o),F(n,n,u),z(n,n),F(n,n,o),F(n,n,u),F(n,n,u),F(e[0],n,u),q(i,e[0]),F(i,i,u),j(i,o)&&F(e[0],e[0],p),q(i,e[0]),F(i,i,u),j(i,o)?-1:(M(e[0])===r[31]>>7&&U(e[0],s,e[0]),F(e[3],e[0],e[1]),0)}function pe(e,r,n,i){var o,s,a=new Uint8Array(32),u=new Uint8Array(64),c=[t(),t(),t(),t()],f=[t(),t(),t(),t()];if(s=-1,n<64)return-1;if(he(f,i))return-1;for(o=0;o<n;o++)e[o]=r[o];for(o=0;o<32;o++)e[o+32]=i[o];if(te(u,e,n),fe(u),oe(c,f,u),se(f,r.subarray(32)),re(c,f),ie(a,c),n-=64,m(r,0,a,0)){for(o=0;o<n;o++)e[o]=0;return-1}for(o=0;o<n;o++)e[o]=r[o+64];return s=n,s}var de=32,ye=24,ge=32,me=16,be=32,ve=32,_e=32,we=32,Se=32,ke=ye,Ee=32,Ae=16,xe=64,Ie=32,Te=64,Be=32,Ce=64;function Pe(e,t){if(e.length!==de)throw new Error("bad key size");if(t.length!==ye)throw new Error("bad nonce size")}function Oe(e,t){if(e.length!==_e)throw new Error("bad public key size");if(t.length!==we)throw new Error("bad secret key size")}function Re(){for(var e=0;e<arguments.length;e++)if(!(arguments[e]instanceof Uint8Array))throw new TypeError("unexpected type, use Uint8Array")}function Ne(e){for(var t=0;t<e.length;t++)e[t]=0}e.lowlevel={crypto_core_hsalsa20:w,crypto_stream_xor:x,crypto_stream:A,crypto_stream_salsa20_xor:k,crypto_stream_salsa20:E,crypto_onetimeauth:T,crypto_onetimeauth_verify:B,crypto_verify_16:g,crypto_verify_32:m,crypto_secretbox:C,crypto_secretbox_open:P,crypto_scalarmult:V,crypto_scalarmult_base:G,crypto_box_beforenm:$,crypto_box_afternm:Y,crypto_box:X,crypto_box_open:Z,crypto_box_keypair:W,crypto_hash:te,crypto_sign:le,crypto_sign_keypair:ae,crypto_sign_open:pe,crypto_secretbox_KEYBYTES:de,crypto_secretbox_NONCEBYTES:ye,crypto_secretbox_ZEROBYTES:32,crypto_secretbox_BOXZEROBYTES:16,crypto_scalarmult_BYTES:32,crypto_scalarmult_SCALARBYTES:32,crypto_box_PUBLICKEYBYTES:_e,crypto_box_SECRETKEYBYTES:we,crypto_box_BEFORENMBYTES:32,crypto_box_NONCEBYTES:ke,crypto_box_ZEROBYTES:32,crypto_box_BOXZEROBYTES:16,crypto_sign_BYTES:64,crypto_sign_PUBLICKEYBYTES:32,crypto_sign_SECRETKEYBYTES:64,crypto_sign_SEEDBYTES:32,crypto_hash_BYTES:64},e.randomBytes=function(e){var t=new Uint8Array(e);return n(t,e),t},e.secretbox=function(e,t,r){Re(e,t,r),Pe(r,t);for(var n=new Uint8Array(32+e.length),i=new Uint8Array(n.length),o=0;o<e.length;o++)n[o+32]=e[o];return C(i,n,n.length,t,r),i.subarray(16)},e.secretbox.open=function(e,t,r){Re(e,t,r),Pe(r,t);for(var n=new Uint8Array(16+e.length),i=new Uint8Array(n.length),o=0;o<e.length;o++)n[o+16]=e[o];return n.length<32?null:0!==P(i,n,n.length,t,r)?null:i.subarray(32)},e.secretbox.keyLength=de,e.secretbox.nonceLength=ye,e.secretbox.overheadLength=16,e.scalarMult=function(e,t){if(Re(e,t),32!==e.length)throw new Error("bad n size");if(32!==t.length)throw new Error("bad p size");var r=new Uint8Array(32);return V(r,e,t),r},e.scalarMult.base=function(e){if(Re(e),32!==e.length)throw new Error("bad n size");var t=new Uint8Array(32);return G(t,e),t},e.scalarMult.scalarLength=32,e.scalarMult.groupElementLength=32,e.box=function(t,r,n,i){var o=e.box.before(n,i);return e.secretbox(t,r,o)},e.box.before=function(e,t){Re(e,t),Oe(e,t);var r=new Uint8Array(32);return $(r,e,t),r},e.box.after=e.secretbox,e.box.open=function(t,r,n,i){var o=e.box.before(n,i);return e.secretbox.open(t,r,o)},e.box.open.after=e.secretbox.open,e.box.keyPair=function(){var e=new Uint8Array(_e),t=new Uint8Array(we);return W(e,t),{publicKey:e,secretKey:t}},e.box.keyPair.fromSecretKey=function(e){if(Re(e),e.length!==we)throw new Error("bad secret key size");var t=new Uint8Array(_e);return G(t,e),{publicKey:t,secretKey:new Uint8Array(e)}},e.box.publicKeyLength=_e,e.box.secretKeyLength=we,e.box.sharedKeyLength=32,e.box.nonceLength=ke,e.box.overheadLength=e.secretbox.overheadLength,e.sign=function(e,t){if(Re(e,t),64!==t.length)throw new Error("bad secret key size");var r=new Uint8Array(64+e.length);return le(r,e,e.length,t),r},e.sign.open=function(e,t){if(Re(e,t),32!==t.length)throw new Error("bad public key size");var r=new Uint8Array(e.length),n=pe(r,e,e.length,t);if(n<0)return null;for(var i=new Uint8Array(n),o=0;o<i.length;o++)i[o]=r[o];return i},e.sign.detached=function(t,r){for(var n=e.sign(t,r),i=new Uint8Array(64),o=0;o<i.length;o++)i[o]=n[o];return i},e.sign.detached.verify=function(e,t,r){if(Re(e,t,r),64!==t.length)throw new Error("bad signature size");if(32!==r.length)throw new Error("bad public key size");var n=new Uint8Array(64+e.length),i=new Uint8Array(64+e.length),o;for(o=0;o<64;o++)n[o]=t[o];for(o=0;o<e.length;o++)n[o+64]=e[o];return pe(i,n,n.length,r)>=0},e.sign.keyPair=function(){var e=new Uint8Array(32),t=new Uint8Array(64);return ae(e,t),{publicKey:e,secretKey:t}},e.sign.keyPair.fromSecretKey=function(e){if(Re(e),64!==e.length)throw new Error("bad secret key size");for(var t=new Uint8Array(32),r=0;r<t.length;r++)t[r]=e[32+r];return{publicKey:t,secretKey:new Uint8Array(e)}},e.sign.keyPair.fromSeed=function(e){if(Re(e),32!==e.length)throw new Error("bad seed size");for(var t=new Uint8Array(32),r=new Uint8Array(64),n=0;n<32;n++)r[n]=e[n];return ae(t,r,!0),{publicKey:t,secretKey:r}},e.sign.publicKeyLength=32,e.sign.secretKeyLength=64,e.sign.seedLength=32,e.sign.signatureLength=64,e.hash=function(e){Re(e);var t=new Uint8Array(64);return te(t,e,e.length),t},e.hash.hashLength=64,e.verify=function(e,t){return Re(e,t),0!==e.length&&0!==t.length&&(e.length===t.length&&0===y(e,0,t,0,e.length))},e.setPRNG=function(e){n=e},function(){var t="undefined"!=typeof self?self.crypto||self.msCrypto:null;if(t&&t.getRandomValues){var n=65536;e.setPRNG(function(e,r){var n,i=new Uint8Array(r);for(n=0;n<r;n+=65536)t.getRandomValues(i.subarray(n,n+Math.min(r-n,65536)));for(n=0;n<r;n++)e[n]=i[n];Ne(i)})}else t=r(921),t&&t.randomBytes&&e.setPRNG(function(e,r){var n,i=t.randomBytes(r);for(n=0;n<r;n++)e[n]=i[n];Ne(i)})}()}(void 0!==e&&e.exports?e.exports:self.nacl=self.nacl||{})},function(e,t,r){"use strict";const n=r(462);e.exports=((e,t,i)=>{i=i||r(925)(t);class o{constructor(e){i.validatePublicKey(e),this._key=e}verify(e,t,r){f(r),i.hashAndVerify(this._key,t,e,r)}marshal(){return i.compressPublicKey(this._key)}get bytes(){return e.PublicKey.encode({Type:e.KeyType.Secp256k1,Data:this.marshal()})}equals(e){return this.bytes.equals(e.bytes)}hash(e){f(e),n(this.bytes,"sha2-256",e)}}class s{constructor(e,t){this._key=e,this._publicKey=t||i.computePublicKey(e),i.validatePrivateKey(this._key),i.validatePublicKey(this._publicKey)}sign(e,t){f(t),i.hashAndSign(this._key,e,t)}get public(){return new o(this._publicKey)}marshal(){return this._key}get bytes(){return e.PrivateKey.encode({Type:e.KeyType.Secp256k1,Data:this.marshal()})}equals(e){return this.bytes.equals(e.bytes)}hash(e){f(e),n(this.bytes,"sha2-256",e)}}function a(e,t){t(null,new s(e),null)}function u(e){return new o(e)}function c(e,t){void 0===t&&"function"==typeof e&&(t=e),f(t),i.generateKey((e,r)=>{if(e)return t(e);let n;try{n=new s(r)}catch(e){return t(e)}t(null,n)})}function f(e){if("function"!=typeof e)throw new Error("callback is required")}return{Secp256k1PublicKey:o,Secp256k1PrivateKey:s,unmarshalSecp256k1PrivateKey:a,unmarshalSecp256k1PublicKey:u,generateKeyPair:c}})},function(e,t,r){"use strict";function n(e,{className:t,symbolName:r}){const n=Symbol.for(r),i={[t]:class extends e{constructor(...e){super(...e),Object.defineProperty(this,n,{value:!0})}get[Symbol.toStringTag](){return t}}}[t];return i[`is${t}`]=(e=>!(!e||!e[n])),i}function i(e,{className:t,symbolName:r,withoutNew:n}){const i=Symbol.for(r),o={[t]:function(...t){if(n&&!(this instanceof o))return new o(...t);const r=e.call(this,...t)||this;return r&&!r[i]&&Object.defineProperty(r,i,{value:!0}),r}}[t];return o.prototype=Object.create(e.prototype),o.prototype.constructor=o,Object.defineProperty(o.prototype,Symbol.toStringTag,{get:()=>t}),o[`is${t}`]=(e=>!(!e||!e[i])),o}e.exports=n,e.exports.proto=i},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(164),i=a(n),o=r(378),s=a(o);function a(e){return e&&e.__esModule?e:{default:e}}t.default=(0,i.default)(s.default),e.exports=t.default},function(e,t,r){(function(e){!function(e,t){"use strict";function r(e,t){if(!e)throw new Error(t||"Assertion failed")}function n(e,t){e.super_=t;var r=function(){};r.prototype=t.prototype,e.prototype=new r,e.prototype.constructor=e}function i(e,t,r){if(null!==e&&"object"==typeof e&&Array.isArray(e.words))return e;this.sign=!1,this.words=null,this.length=0,this.red=null,"le"!==t&&"be"!==t||(r=t,t=10),null!==e&&this._init(e||0,t||10,r||"be")}function o(e,t,r){for(var n=0,i=Math.min(e.length,r),o=t;o<i;o++){var s=e.charCodeAt(o)-48;n<<=4,n|=s>=49&&s<=54?s-49+10:s>=17&&s<=22?s-17+10:15&s}return n}function s(e,t,r,n){for(var i=0,o=Math.min(e.length,r),s=t;s<o;s++){var a=e.charCodeAt(s)-48;i*=n,i+=a>=49?a-49+10:a>=17?a-17+10:a}return i}"object"==typeof e?e.exports=i:t.BN=i,i.BN=i,i.wordSize=26,i.prototype._init=function e(t,n,i){if("number"==typeof t)return t<0&&(this.sign=!0,t=-t),void(t<67108864?(this.words=[67108863&t],this.length=1):t<4503599627370496?(this.words=[67108863&t,t/67108864&67108863],this.length=2):(r(t<9007199254740992),this.words=[67108863&t,t/67108864&67108863,1],this.length=3));if("object"==typeof t)return this._initArray(t,n,i);"hex"===n&&(n=16),r(n===(0|n)&&n>=2&&n<=36),t=t.toString().replace(/\s+/g,"");var o=0;"-"===t[0]&&o++,16===n?this._parseHex(t,o):this._parseBase(t,n,o),"-"===t[0]&&(this.sign=!0),this.strip()},i.prototype._initArray=function e(t,n,i){if(r("number"==typeof t.length),t.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(t.length/3),this.words=new Array(this.length);for(var o=0;o<this.length;o++)this.words[o]=0;var s=0;if("be"===i)for(var o=t.length-1,a=0;o>=0;o-=3){var u=t[o]|t[o-1]<<8|t[o-2]<<16;this.words[a]|=u<<s&67108863,this.words[a+1]=u>>>26-s&67108863,s+=24,s>=26&&(s-=26,a++)}else if("le"===i)for(var o=0,a=0;o<t.length;o+=3){var u=t[o]|t[o+1]<<8|t[o+2]<<16;this.words[a]|=u<<s&67108863,this.words[a+1]=u>>>26-s&67108863,s+=24,s>=26&&(s-=26,a++)}return this.strip()},i.prototype._parseHex=function e(t,r){this.length=Math.ceil((t.length-r)/6),this.words=new Array(this.length);for(var n=0;n<this.length;n++)this.words[n]=0;for(var i=0,n=t.length-6,s=0;n>=r;n-=6){var a=o(t,n,n+6);this.words[s]|=a<<i&67108863,this.words[s+1]|=a>>>26-i&4194303,i+=24,i>=26&&(i-=26,s++)}if(n+6!==r){var a=o(t,r,n+6);this.words[s]|=a<<i&67108863,this.words[s+1]|=a>>>26-i&4194303}this.strip()},i.prototype._parseBase=function e(t,r,n){this.words=[0],this.length=1;for(var i=0,o=1;o<=67108863;o*=r)i++;i--,o=o/r|0;for(var a=t.length-n,u=a%i,c=Math.min(a,a-u)+n,f=0,l=n;l<c;l+=i)f=s(t,l,l+i,r),this.imuln(o),this.words[0]+f<67108864?this.words[0]+=f:this._iaddn(f);if(0!==u){for(var h=1,f=s(t,l,t.length,r),l=0;l<u;l++)h*=r;this.imuln(h),this.words[0]+f<67108864?this.words[0]+=f:this._iaddn(f)}},i.prototype.copy=function e(t){t.words=new Array(this.length);for(var r=0;r<this.length;r++)t.words[r]=this.words[r];t.length=this.length,t.sign=this.sign,t.red=this.red},i.prototype.clone=function e(){var t=new i(null);return this.copy(t),t},i.prototype.strip=function e(){for(;this.length>1&&0===this.words[this.length-1];)this.length--;return this._normSign()},i.prototype._normSign=function e(){return 1===this.length&&0===this.words[0]&&(this.sign=!1),this},i.prototype.inspect=function e(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"};var a=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],u=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],c=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];i.prototype.toString=function e(t,n){if(t=t||10,16===t||"hex"===t){for(var i="",o=0,n=0|n||1,s=0,f=0;f<this.length;f++){var l=this.words[f],h=(16777215&(l<<o|s)).toString(16);s=l>>>24-o&16777215,i=0!==s||f!==this.length-1?a[6-h.length]+h+i:h+i,o+=2,o>=26&&(o-=26,f--)}for(0!==s&&(i=s.toString(16)+i);i.length%n!=0;)i="0"+i;return this.sign&&(i="-"+i),i}if(t===(0|t)&&t>=2&&t<=36){var p=u[t],d=c[t],i="",y=this.clone();for(y.sign=!1;0!==y.cmpn(0);){var g=y.modn(d).toString(t);y=y.idivn(d),i=0!==y.cmpn(0)?a[p-g.length]+g+i:g+i}return 0===this.cmpn(0)&&(i="0"+i),this.sign&&(i="-"+i),i}r(!1,"Base should be between 2 and 36")},i.prototype.toJSON=function e(){return this.toString(16)},i.prototype.toArray=function e(){this.strip();var t=new Array(this.byteLength());t[0]=0;for(var r=this.clone(),n=0;0!==r.cmpn(0);n++){var i=r.andln(255);r.ishrn(8),t[t.length-n-1]=i}return t},Math.clz32?i.prototype._countBits=function e(t){return 32-Math.clz32(t)}:i.prototype._countBits=function e(t){var r=t,n=0;return r>=4096&&(n+=13,r>>>=13),r>=64&&(n+=7,r>>>=7),r>=8&&(n+=4,r>>>=4),r>=2&&(n+=2,r>>>=2),n+r},i.prototype._zeroBits=function e(t){if(0===t)return 26;var r=t,n=0;return 0==(8191&r)&&(n+=13,r>>>=13),0==(127&r)&&(n+=7,r>>>=7),0==(15&r)&&(n+=4,r>>>=4),0==(3&r)&&(n+=2,r>>>=2),0==(1&r)&&n++,n},i.prototype.bitLength=function e(){var t=0,r=this.words[this.length-1],t=this._countBits(r);return 26*(this.length-1)+t},i.prototype.zeroBits=function e(){if(0===this.cmpn(0))return 0;for(var t=0,r=0;r<this.length;r++){var n=this._zeroBits(this.words[r]);if(t+=n,26!==n)break}return t},i.prototype.byteLength=function e(){return Math.ceil(this.bitLength()/8)},i.prototype.neg=function e(){if(0===this.cmpn(0))return this.clone();var t=this.clone();return t.sign=!this.sign,t},i.prototype.ior=function e(t){for(this.sign=this.sign||t.sign;this.length<t.length;)this.words[this.length++]=0;for(var r=0;r<t.length;r++)this.words[r]=this.words[r]|t.words[r];return this.strip()},i.prototype.or=function e(t){return this.length>t.length?this.clone().ior(t):t.clone().ior(this)},i.prototype.iand=function e(t){var r;this.sign=this.sign&&t.sign,r=this.length>t.length?t:this;for(var n=0;n<r.length;n++)this.words[n]=this.words[n]&t.words[n];return this.length=r.length,this.strip()},i.prototype.and=function e(t){return this.length>t.length?this.clone().iand(t):t.clone().iand(this)},i.prototype.ixor=function e(t){var r,n;this.sign=this.sign||t.sign,this.length>t.length?(r=this,n=t):(r=t,n=this);for(var i=0;i<n.length;i++)this.words[i]=r.words[i]^n.words[i];if(this!==r)for(;i<r.length;i++)this.words[i]=r.words[i];return this.length=r.length,this.strip()},i.prototype.xor=function e(t){return this.length>t.length?this.clone().ixor(t):t.clone().ixor(this)},i.prototype.setn=function e(t,n){r("number"==typeof t&&t>=0);for(var i=t/26|0,o=t%26;this.length<=i;)this.words[this.length++]=0;return this.words[i]=n?this.words[i]|1<<o:this.words[i]&~(1<<o),this.strip()},i.prototype.iadd=function e(t){if(this.sign&&!t.sign){this.sign=!1;var r=this.isub(t);return this.sign=!this.sign,this._normSign()}if(!this.sign&&t.sign){t.sign=!1;var r=this.isub(t);return t.sign=!0,r._normSign()}var n,i;this.length>t.length?(n=this,i=t):(n=t,i=this);for(var o=0,s=0;s<i.length;s++){var r=n.words[s]+i.words[s]+o;this.words[s]=67108863&r,o=r>>>26}for(;0!==o&&s<n.length;s++){var r=n.words[s]+o;this.words[s]=67108863&r,o=r>>>26}if(this.length=n.length,0!==o)this.words[this.length]=o,this.length++;else if(n!==this)for(;s<n.length;s++)this.words[s]=n.words[s];return this},i.prototype.add=function e(t){if(t.sign&&!this.sign){t.sign=!1;var r=this.sub(t);return t.sign=!0,r}if(!t.sign&&this.sign){this.sign=!1;var r=t.sub(this);return this.sign=!0,r}return this.length>t.length?this.clone().iadd(t):t.clone().iadd(this)},i.prototype.isub=function e(t){if(t.sign){t.sign=!1;var r=this.iadd(t);return t.sign=!0,r._normSign()}if(this.sign)return this.sign=!1,this.iadd(t),this.sign=!0,this._normSign();var n=this.cmp(t),i,o;if(0===n)return this.sign=!1,this.length=1,this.words[0]=0,this;n>0?(i=this,o=t):(i=t,o=this);for(var s=0,a=0;a<o.length;a++){var r=i.words[a]-o.words[a]+s;s=r>>26,this.words[a]=67108863&r}for(;0!==s&&a<i.length;a++){var r=i.words[a]+s;s=r>>26,this.words[a]=67108863&r}if(0===s&&a<i.length&&i!==this)for(;a<i.length;a++)this.words[a]=i.words[a];return this.length=Math.max(this.length,a),i!==this&&(this.sign=!0),this.strip()},i.prototype.sub=function e(t){return this.clone().isub(t)},i.prototype._smallMulTo=function e(t,r){r.sign=t.sign!==this.sign,r.length=this.length+t.length;for(var n=0,i=0;i<r.length-1;i++){for(var o=n>>>26,s=67108863&n,a=Math.min(i,t.length-1),u=Math.max(0,i-this.length+1);u<=a;u++){var c=i-u,f=0|this.words[c],l=0|t.words[u],h=f*l,p=67108863&h;o=o+(h/67108864|0)|0,p=p+s|0,s=67108863&p,o=o+(p>>>26)|0}r.words[i]=s,n=o}return 0!==n?r.words[i]=n:r.length--,r.strip()},i.prototype._bigMulTo=function e(t,r){r.sign=t.sign!==this.sign,r.length=this.length+t.length;for(var n=0,i=0,o=0;o<r.length-1;o++){var s=i;i=0;for(var a=67108863&n,u=Math.min(o,t.length-1),c=Math.max(0,o-this.length+1);c<=u;c++){var f=o-c,l=0|this.words[f],h=0|t.words[c],p=l*h,d=67108863&p;s=s+(p/67108864|0)|0,d=d+a|0,a=67108863&d,s=s+(d>>>26)|0,i+=s>>>26,s&=67108863}r.words[o]=a,n=s,s=i}return 0!==n?r.words[o]=n:r.length--,r.strip()},i.prototype.mulTo=function e(t,r){var n;return n=this.length+t.length<63?this._smallMulTo(t,r):this._bigMulTo(t,r),n},i.prototype.mul=function e(t){var r=new i(null);return r.words=new Array(this.length+t.length),this.mulTo(t,r)},i.prototype.imul=function e(t){if(0===this.cmpn(0)||0===t.cmpn(0))return this.words[0]=0,this.length=1,this;var r=this.length,n=t.length;this.sign=t.sign!==this.sign,this.length=this.length+t.length,this.words[this.length-1]=0;for(var i=this.length-2;i>=0;i--){for(var o=0,s=0,a=Math.min(i,n-1),u=Math.max(0,i-r+1);u<=a;u++){var c=i-u,f=this.words[c],l=t.words[u],h=f*l,p=67108863&h;o+=h/67108864|0,p+=s,s=67108863&p,o+=p>>>26}this.words[i]=s,this.words[i+1]+=o,o=0}for(var o=0,c=1;c<this.length;c++){var d=this.words[c]+o;this.words[c]=67108863&d,o=d>>>26}return this.strip()},i.prototype.imuln=function e(t){r("number"==typeof t);for(var n=0,i=0;i<this.length;i++){var o=this.words[i]*t,s=(67108863&o)+(67108863&n);n>>=26,n+=o/67108864|0,n+=s>>>26,this.words[i]=67108863&s}return 0!==n&&(this.words[i]=n,this.length++),this},i.prototype.sqr=function e(){return this.mul(this)},i.prototype.isqr=function e(){return this.mul(this)},i.prototype.ishln=function e(t){r("number"==typeof t&&t>=0);var n=t%26,i=(t-n)/26,o=67108863>>>26-n<<26-n;if(0!==n){for(var s=0,a=0;a<this.length;a++){var u=this.words[a]&o,c=this.words[a]-u<<n;this.words[a]=c|s,s=u>>>26-n}s&&(this.words[a]=s,this.length++)}if(0!==i){for(var a=this.length-1;a>=0;a--)this.words[a+i]=this.words[a];for(var a=0;a<i;a++)this.words[a]=0;this.length+=i}return this.strip()},i.prototype.ishrn=function e(t,n,i){var o;r("number"==typeof t&&t>=0),o=n?(n-n%26)/26:0;var s=t%26,a=Math.min((t-s)/26,this.length),u=67108863^67108863>>>s<<s,c=i;if(o-=a,o=Math.max(0,o),c){for(var f=0;f<a;f++)c.words[f]=this.words[f];c.length=a}if(0===a);else if(this.length>a){this.length-=a;for(var f=0;f<this.length;f++)this.words[f]=this.words[f+a]}else this.words[0]=0,this.length=1;for(var l=0,f=this.length-1;f>=0&&(0!==l||f>=o);f--){var h=this.words[f];this.words[f]=l<<26-s|h>>>s,l=h&u}return c&&0!==l&&(c.words[c.length++]=l),0===this.length&&(this.words[0]=0,this.length=1),this.strip(),this},i.prototype.shln=function e(t){return this.clone().ishln(t)},i.prototype.shrn=function e(t){return this.clone().ishrn(t)},i.prototype.testn=function e(t){r("number"==typeof t&&t>=0);var n=t%26,i=(t-n)/26,o=1<<n;if(this.length<=i)return!1;var s=this.words[i];return!!(s&o)},i.prototype.imaskn=function e(t){r("number"==typeof t&&t>=0);var n=t%26,i=(t-n)/26;if(r(!this.sign,"imaskn works only with positive numbers"),0!==n&&i++,this.length=Math.min(i,this.length),0!==n){var o=67108863^67108863>>>n<<n;this.words[this.length-1]&=o}return this.strip()},i.prototype.maskn=function e(t){return this.clone().imaskn(t)},i.prototype.iaddn=function e(t){return r("number"==typeof t),t<0?this.isubn(-t):this.sign?1===this.length&&this.words[0]<t?(this.words[0]=t-this.words[0],this.sign=!1,this):(this.sign=!1,this.isubn(t),this.sign=!0,this):this._iaddn(t)},i.prototype._iaddn=function e(t){this.words[0]+=t;for(var r=0;r<this.length&&this.words[r]>=67108864;r++)this.words[r]-=67108864,r===this.length-1?this.words[r+1]=1:this.words[r+1]++;return this.length=Math.max(this.length,r+1),this},i.prototype.isubn=function e(t){if(r("number"==typeof t),t<0)return this.iaddn(-t);if(this.sign)return this.sign=!1,this.iaddn(t),this.sign=!0,this;this.words[0]-=t;for(var n=0;n<this.length&&this.words[n]<0;n++)this.words[n]+=67108864,this.words[n+1]-=1;return this.strip()},i.prototype.addn=function e(t){return this.clone().iaddn(t)},i.prototype.subn=function e(t){return this.clone().isubn(t)},i.prototype.iabs=function e(){return this.sign=!1,this},i.prototype.abs=function e(){return this.clone().iabs()},i.prototype._ishlnsubmul=function e(t,n,i){var o=t.length+i,s;if(this.words.length<o){for(var a=new Array(o),s=0;s<this.length;s++)a[s]=this.words[s];this.words=a}else s=this.length;for(this.length=Math.max(this.length,o);s<this.length;s++)this.words[s]=0;for(var u=0,s=0;s<t.length;s++){var c=this.words[s+i]+u,f=t.words[s]*n;c-=67108863&f,u=(c>>26)-(f/67108864|0),this.words[s+i]=67108863&c}for(;s<this.length-i;s++){var c=this.words[s+i]+u;u=c>>26,this.words[s+i]=67108863&c}if(0===u)return this.strip();r(-1===u),u=0;for(var s=0;s<this.length;s++){var c=-this.words[s]+u;u=c>>26,this.words[s]=67108863&c}return this.sign=!0,this.strip()},i.prototype._wordDiv=function e(t,r){var n=this.length-t.length,o=this.clone(),s=t,a=s.words[s.length-1],u=this._countBits(a);n=26-u,0!==n&&(s=s.shln(n),o.ishln(n),a=s.words[s.length-1]);var c=o.length-s.length,f;if("mod"!==r){f=new i(null),f.length=c+1,f.words=new Array(f.length);for(var l=0;l<f.length;l++)f.words[l]=0}var h=o.clone()._ishlnsubmul(s,1,c);h.sign||(o=h,f&&(f.words[c]=1));for(var p=c-1;p>=0;p--){var d=67108864*o.words[s.length+p]+o.words[s.length+p-1];for(d=Math.min(d/a|0,67108863),o._ishlnsubmul(s,d,p);o.sign;)d--,o.sign=!1,o._ishlnsubmul(s,1,p),0!==o.cmpn(0)&&(o.sign=!o.sign);f&&(f.words[p]=d)}return f&&f.strip(),o.strip(),"div"!==r&&0!==n&&o.ishrn(n),{div:f||null,mod:o}},i.prototype.divmod=function e(t,n){if(r(0!==t.cmpn(0)),this.sign&&!t.sign){var o=this.neg().divmod(t,n),s,a;return"mod"!==n&&(s=o.div.neg()),"div"!==n&&(a=0===o.mod.cmpn(0)?o.mod:t.sub(o.mod)),{div:s,mod:a}}if(!this.sign&&t.sign){var o=this.divmod(t.neg(),n),s;return"mod"!==n&&(s=o.div.neg()),{div:s,mod:o.mod}}return this.sign&&t.sign?this.neg().divmod(t.neg(),n):t.length>this.length||this.cmp(t)<0?{div:new i(0),mod:this}:1===t.length?"div"===n?{div:this.divn(t.words[0]),mod:null}:"mod"===n?{div:null,mod:new i(this.modn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new i(this.modn(t.words[0]))}:this._wordDiv(t,n)},i.prototype.div=function e(t){return this.divmod(t,"div").div},i.prototype.mod=function e(t){return this.divmod(t,"mod").mod},i.prototype.divRound=function e(t){var r=this.divmod(t);if(0===r.mod.cmpn(0))return r.div;var n=r.div.sign?r.mod.isub(t):r.mod,i=t.shrn(1),o=t.andln(1),s=n.cmp(i);return s<0||1===o&&0===s?r.div:r.div.sign?r.div.isubn(1):r.div.iaddn(1)},i.prototype.modn=function e(t){r(t<=67108863);for(var n=(1<<26)%t,i=0,o=this.length-1;o>=0;o--)i=(n*i+this.words[o])%t;return i},i.prototype.idivn=function e(t){r(t<=67108863);for(var n=0,i=this.length-1;i>=0;i--){var o=this.words[i]+67108864*n;this.words[i]=o/t|0,n=o%t}return this.strip()},i.prototype.divn=function e(t){return this.clone().idivn(t)},i.prototype.egcd=function e(t){r(!t.sign),r(0!==t.cmpn(0));var n=this,o=t.clone();n=n.sign?n.mod(t):n.clone();for(var s=new i(1),a=new i(0),u=new i(0),c=new i(1),f=0;n.isEven()&&o.isEven();)n.ishrn(1),o.ishrn(1),++f;for(var l=o.clone(),h=n.clone();0!==n.cmpn(0);){for(;n.isEven();)n.ishrn(1),s.isEven()&&a.isEven()?(s.ishrn(1),a.ishrn(1)):(s.iadd(l).ishrn(1),a.isub(h).ishrn(1));for(;o.isEven();)o.ishrn(1),u.isEven()&&c.isEven()?(u.ishrn(1),c.ishrn(1)):(u.iadd(l).ishrn(1),c.isub(h).ishrn(1));n.cmp(o)>=0?(n.isub(o),s.isub(u),a.isub(c)):(o.isub(n),u.isub(s),c.isub(a))}return{a:u,b:c,gcd:o.ishln(f)}},i.prototype._invmp=function e(t){r(!t.sign),r(0!==t.cmpn(0));var n=this,o=t.clone();n=n.sign?n.mod(t):n.clone();for(var s=new i(1),a=new i(0),u=o.clone();n.cmpn(1)>0&&o.cmpn(1)>0;){for(;n.isEven();)n.ishrn(1),s.isEven()?s.ishrn(1):s.iadd(u).ishrn(1);for(;o.isEven();)o.ishrn(1),a.isEven()?a.ishrn(1):a.iadd(u).ishrn(1);n.cmp(o)>=0?(n.isub(o),s.isub(a)):(o.isub(n),a.isub(s))}return 0===n.cmpn(1)?s:a},i.prototype.gcd=function e(t){if(0===this.cmpn(0))return t.clone();if(0===t.cmpn(0))return this.clone();var r=this.clone(),n=t.clone();r.sign=!1,n.sign=!1;for(var i=0;r.isEven()&&n.isEven();i++)r.ishrn(1),n.ishrn(1);for(;;){for(;r.isEven();)r.ishrn(1);for(;n.isEven();)n.ishrn(1);var o=r.cmp(n);if(o<0){var s=r;r=n,n=s}else if(0===o||0===n.cmpn(1))break;r.isub(n)}return n.ishln(i)},i.prototype.invm=function e(t){return this.egcd(t).a.mod(t)},i.prototype.isEven=function e(){return 0==(1&this.words[0])},i.prototype.isOdd=function e(){return 1==(1&this.words[0])},i.prototype.andln=function e(t){return this.words[0]&t},i.prototype.bincn=function e(t){r("number"==typeof t);var n=t%26,i=(t-n)/26,o=1<<n;if(this.length<=i){for(var s=this.length;s<i+1;s++)this.words[s]=0;return this.words[i]|=o,this.length=i+1,this}for(var a=o,s=i;0!==a&&s<this.length;s++){var u=this.words[s];u+=a,a=u>>>26,u&=67108863,this.words[s]=u}return 0!==a&&(this.words[s]=a,this.length++),this},i.prototype.cmpn=function e(t){var r=t<0,n;if(r&&(t=-t),this.sign&&!r)return-1;if(!this.sign&&r)return 1;if(t&=67108863,this.strip(),this.length>1)n=1;else{var i=this.words[0];n=i===t?0:i<t?-1:1}return this.sign&&(n=-n),n},i.prototype.cmp=function e(t){if(this.sign&&!t.sign)return-1;if(!this.sign&&t.sign)return 1;var r=this.ucmp(t);return this.sign?-r:r},i.prototype.ucmp=function e(t){if(this.length>t.length)return 1;if(this.length<t.length)return-1;for(var r=0,n=this.length-1;n>=0;n--){var i=this.words[n],o=t.words[n];if(i!==o){i<o?r=-1:i>o&&(r=1);break}}return r},i.red=function e(t){return new g(t)},i.prototype.toRed=function e(t){return r(!this.red,"Already a number in reduction context"),r(!this.sign,"red works only with positives"),t.convertTo(this)._forceRed(t)},i.prototype.fromRed=function e(){return r(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},i.prototype._forceRed=function e(t){return this.red=t,this},i.prototype.forceRed=function e(t){return r(!this.red,"Already a number in reduction context"),this._forceRed(t)},i.prototype.redAdd=function e(t){return r(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},i.prototype.redIAdd=function e(t){return r(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},i.prototype.redSub=function e(t){return r(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},i.prototype.redISub=function e(t){return r(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},i.prototype.redShl=function e(t){return r(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},i.prototype.redMul=function e(t){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},i.prototype.redIMul=function e(t){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},i.prototype.redSqr=function e(){return r(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},i.prototype.redISqr=function e(){return r(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},i.prototype.redSqrt=function e(){return r(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},i.prototype.redInvm=function e(){return r(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},i.prototype.redNeg=function e(){return r(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},i.prototype.redPow=function e(t){return r(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var f={k256:null,p224:null,p192:null,p25519:null};function l(e,t){this.name=e,this.p=new i(t,16),this.n=this.p.bitLength(),this.k=new i(1).ishln(this.n).isub(this.p),this.tmp=this._tmp()}function h(){l.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function p(){l.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function d(){l.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function y(){l.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function g(e){if("string"==typeof e){var t=i._prime(e);this.m=t.p,this.prime=t}else this.m=e,this.prime=null}function m(e){g.call(this,e),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new i(1).ishln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv.sign=!0,this.minv=this.minv.mod(this.r)}l.prototype._tmp=function e(){var t=new i(null);return t.words=new Array(Math.ceil(this.n/13)),t},l.prototype.ireduce=function e(t){var r=t,n;do{this.split(r,this.tmp),r=this.imulK(r),r=r.iadd(this.tmp),n=r.bitLength()}while(n>this.n);var i=n<this.n?-1:r.ucmp(this.p);return 0===i?(r.words[0]=0,r.length=1):i>0?r.isub(this.p):r.strip(),r},l.prototype.split=function e(t,r){t.ishrn(this.n,0,r)},l.prototype.imulK=function e(t){return t.imul(this.k)},n(h,l),h.prototype.split=function e(t,r){for(var n=4194303,i=Math.min(t.length,9),o=0;o<i;o++)r.words[o]=t.words[o];if(r.length=i,t.length<=9)return t.words[0]=0,void(t.length=1);var s=t.words[9];r.words[r.length++]=s&n;for(var o=10;o<t.length;o++){var a=t.words[o];t.words[o-10]=(a&n)<<4|s>>>22,s=a}t.words[o-10]=s>>>22,t.length-=9},h.prototype.imulK=function e(t){var r;t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var n=0,i=0;i<t.length;i++){var o=t.words[i];r=64*o,n+=977*o,r+=n/67108864|0,n&=67108863,t.words[i]=n,n=r}return 0===t.words[t.length-1]&&(t.length--,0===t.words[t.length-1]&&t.length--),t},n(p,l),n(d,l),n(y,l),y.prototype.imulK=function e(t){for(var r=0,n=0;n<t.length;n++){var i=19*t.words[n]+r,o=67108863&i;i>>>=26,t.words[n]=o,r=i}return 0!==r&&(t.words[t.length++]=r),t},i._prime=function e(t){if(f[t])return f[t];var e;if("k256"===t)e=new h;else if("p224"===t)e=new p;else if("p192"===t)e=new d;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new y}return f[t]=e,e},g.prototype._verify1=function e(t){r(!t.sign,"red works only with positives"),r(t.red,"red works only with red numbers")},g.prototype._verify2=function e(t,n){r(!t.sign&&!n.sign,"red works only with positives"),r(t.red&&t.red===n.red,"red works only with red numbers")},g.prototype.imod=function e(t){return this.prime?this.prime.ireduce(t)._forceRed(this):t.mod(this.m)._forceRed(this)},g.prototype.neg=function e(t){var r=t.clone();return r.sign=!r.sign,r.iadd(this.m)._forceRed(this)},g.prototype.add=function e(t,r){this._verify2(t,r);var n=t.add(r);return n.cmp(this.m)>=0&&n.isub(this.m),n._forceRed(this)},g.prototype.iadd=function e(t,r){this._verify2(t,r);var n=t.iadd(r);return n.cmp(this.m)>=0&&n.isub(this.m),n},g.prototype.sub=function e(t,r){this._verify2(t,r);var n=t.sub(r);return n.cmpn(0)<0&&n.iadd(this.m),n._forceRed(this)},g.prototype.isub=function e(t,r){this._verify2(t,r);var n=t.isub(r);return n.cmpn(0)<0&&n.iadd(this.m),n},g.prototype.shl=function e(t,r){return this._verify1(t),this.imod(t.shln(r))},g.prototype.imul=function e(t,r){return this._verify2(t,r),this.imod(t.imul(r))},g.prototype.mul=function e(t,r){return this._verify2(t,r),this.imod(t.mul(r))},g.prototype.isqr=function e(t){return this.imul(t,t)},g.prototype.sqr=function e(t){return this.mul(t,t)},g.prototype.sqrt=function e(t){if(0===t.cmpn(0))return t.clone();var n=this.m.andln(3);if(r(n%2==1),3===n){var o=this.m.add(new i(1)).ishrn(2),s=this.pow(t,o);return s}for(var a=this.m.subn(1),u=0;0!==a.cmpn(0)&&0===a.andln(1);)u++,a.ishrn(1);r(0!==a.cmpn(0));var c=new i(1).toRed(this),f=c.redNeg(),l=this.m.subn(1).ishrn(1),h=this.m.bitLength();for(h=new i(2*h*h).toRed(this);0!==this.pow(h,l).cmp(f);)h.redIAdd(f);for(var p=this.pow(h,a),s=this.pow(t,a.addn(1).ishrn(1)),d=this.pow(t,a),y=u;0!==d.cmp(c);){for(var g=d,m=0;0!==g.cmp(c);m++)g=g.redSqr();r(m<y);var b=this.pow(p,new i(1).ishln(y-m-1));s=s.redMul(b),p=b.redSqr(),d=d.redMul(p),y=m}return s},g.prototype.invm=function e(t){var r=t._invmp(this.m);return r.sign?(r.sign=!1,this.imod(r).redNeg()):this.imod(r)},g.prototype.pow=function e(t,r){var n=[];if(0===r.cmpn(0))return new i(1);for(var o=r.clone();0!==o.cmpn(0);)n.push(o.andln(1)),o.ishrn(1);for(var s=t,a=0;a<n.length&&0===n[a];a++,s=this.sqr(s));if(++a<n.length)for(var o=this.sqr(s);a<n.length;a++,o=this.sqr(o))0!==n[a]&&(s=this.mul(s,o));return s},g.prototype.convertTo=function e(t){return t.clone()},g.prototype.convertFrom=function e(t){var r=t.clone();return r.red=null,r},i.mont=function e(t){return new m(t)},n(m,g),m.prototype.convertTo=function e(t){return this.imod(t.shln(this.shift))},m.prototype.convertFrom=function e(t){var r=this.imod(t.mul(this.rinv));return r.red=null,r},m.prototype.imul=function e(t,r){if(0===t.cmpn(0)||0===r.cmpn(0))return t.words[0]=0,t.length=1,t;var n=t.imul(r),i=n.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),o=n.isub(i).ishrn(this.shift),s=o;return o.cmp(this.m)>=0?s=o.isub(this.m):o.cmpn(0)<0&&(s=o.iadd(this.m)),s._forceRed(this)},m.prototype.mul=function e(t,r){if(0===t.cmpn(0)||0===r.cmpn(0))return new i(0)._forceRed(this);var n=t.mul(r),o=n.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),s=n.isub(o).ishrn(this.shift),a=s;return s.cmp(this.m)>=0?a=s.isub(this.m):s.cmpn(0)<0&&(a=s.iadd(this.m)),a._forceRed(this)},m.prototype.invm=function e(t){var r=this.imod(t._invmp(this.m).mul(this.r2));return r._forceRed(this)}}(void 0===e||e,this)}).call(this,r(28)(e))},function(e,t){"function"==typeof Object.create?e.exports=function e(t,r){t.super_=r,t.prototype=Object.create(r.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}})}:e.exports=function e(t,r){t.super_=r;var n=function(){};n.prototype=r.prototype,t.prototype=new n,t.prototype.constructor=t}},function(e,t,r){var n=r(11);r(16),r(101);var i=e.exports=n.asn1=n.asn1||{};function o(e,t,r){if(r>t){var n=new Error("Too few bytes to parse DER.");throw n.available=e.length(),n.remaining=t,n.requested=r,n}}i.Class={UNIVERSAL:0,APPLICATION:64,CONTEXT_SPECIFIC:128,PRIVATE:192},i.Type={NONE:0,BOOLEAN:1,INTEGER:2,BITSTRING:3,OCTETSTRING:4,NULL:5,OID:6,ODESC:7,EXTERNAL:8,REAL:9,ENUMERATED:10,EMBEDDED:11,UTF8:12,ROID:13,SEQUENCE:16,SET:17,PRINTABLESTRING:19,IA5STRING:22,UTCTIME:23,GENERALIZEDTIME:24,BMPSTRING:30},i.create=function(e,t,r,o,s){if(n.util.isArray(o)){for(var a=[],u=0;u<o.length;++u)void 0!==o[u]&&a.push(o[u]);o=a}var c={tagClass:e,type:t,constructed:r,composed:r||n.util.isArray(o),value:o};return s&&"bitStringContents"in s&&(c.bitStringContents=s.bitStringContents,c.original=i.copy(c)),c},i.copy=function(e,t){var r;if(n.util.isArray(e)){r=[];for(var o=0;o<e.length;++o)r.push(i.copy(e[o],t));return r}return"string"==typeof e?e:(r={tagClass:e.tagClass,type:e.type,constructed:e.constructed,composed:e.composed,value:i.copy(e.value,t)},t&&!t.excludeBitStringContents&&(r.bitStringContents=e.bitStringContents),r)},i.equals=function(e,t,r){if(n.util.isArray(e)){if(!n.util.isArray(t))return!1;if(e.length!==t.length)return!1;for(var o=0;o<e.length;++o)if(!i.equals(e[o],t[o]))return!1;return!0}if(typeof e!=typeof t)return!1;if("string"==typeof e)return e===t;var s=e.tagClass===t.tagClass&&e.type===t.type&&e.constructed===t.constructed&&e.composed===t.composed&&i.equals(e.value,t.value);return r&&r.includeBitStringContents&&(s=s&&e.bitStringContents===t.bitStringContents),s},i.getBerValueLength=function(e){var t=e.getByte();if(128!==t){var r,n=128&t;return r=n?e.getInt((127&t)<<3):t,r}};var s=function(e,t){var r=e.getByte();if(t--,128!==r){var n,i=128&r;if(i){var s=127&r;o(e,t,s),n=e.getInt(s<<3)}else n=r;if(n<0)throw new Error("Negative length: "+n);return n}};function a(e,t,r,n){var u;o(e,t,2);var c=e.getByte();t--;var f=192&c,l=31&c;u=e.length();var h=s(e,t),p,d;if(t-=u-e.length(),void 0!==h&&h>t){if(n.strict){var y=new Error("Too few bytes to read ASN.1 value.");throw y.available=e.length(),y.remaining=t,y.requested=h,y}h=t}var g=32==(32&c);if(g)if(p=[],void 0===h)for(;;){if(o(e,t,2),e.bytes(2)===String.fromCharCode(0,0)){e.getBytes(2),t-=2;break}u=e.length(),p.push(a(e,t,r+1,n)),t-=u-e.length()}else for(;h>0;)u=e.length(),p.push(a(e,h,r+1,n)),t-=u-e.length(),h-=u-e.length();if(void 0===p&&f===i.Class.UNIVERSAL&&l===i.Type.BITSTRING&&(d=e.bytes(h)),void 0===p&&n.decodeBitStrings&&f===i.Class.UNIVERSAL&&l===i.Type.BITSTRING&&h>1){var m=e.read,b=t,v=0;if(l===i.Type.BITSTRING&&(o(e,t,1),v=e.getByte(),t--),0===v)try{u=e.length();var _={verbose:n.verbose,strict:!0,decodeBitStrings:!0},w=a(e,t,r+1,_),S=u-e.length();t-=S,l==i.Type.BITSTRING&&S++;var k=w.tagClass;S!==h||k!==i.Class.UNIVERSAL&&k!==i.Class.CONTEXT_SPECIFIC||(p=[w])}catch(e){}void 0===p&&(e.read=m,t=b)}if(void 0===p){if(void 0===h){if(n.strict)throw new Error("Non-constructed ASN.1 object of indefinite length.");h=t}if(l===i.Type.BMPSTRING)for(p="";h>0;h-=2)o(e,t,2),p+=String.fromCharCode(e.getInt16()),t-=2;else p=e.getBytes(h)}var E=void 0===d?null:{bitStringContents:d};return i.create(f,l,g,p,E)}i.fromDer=function(e,t){return void 0===t&&(t={strict:!0,decodeBitStrings:!0}),"boolean"==typeof t&&(t={strict:t,decodeBitStrings:!0}),"strict"in t||(t.strict=!0),"decodeBitStrings"in t||(t.decodeBitStrings=!0),"string"==typeof e&&(e=n.util.createBuffer(e)),a(e,e.length(),0,t)},i.toDer=function(e){var t=n.util.createBuffer(),r=e.tagClass|e.type,o=n.util.createBuffer(),s=!1;if("bitStringContents"in e&&(s=!0,e.original&&(s=i.equals(e,e.original))),s)o.putBytes(e.bitStringContents);else if(e.composed){e.constructed?r|=32:o.putByte(0);for(var a=0;a<e.value.length;++a)void 0!==e.value[a]&&o.putBuffer(i.toDer(e.value[a]))}else if(e.type===i.Type.BMPSTRING)for(var a=0;a<e.value.length;++a)o.putInt16(e.value.charCodeAt(a));else e.type===i.Type.INTEGER&&e.value.length>1&&(0===e.value.charCodeAt(0)&&0==(128&e.value.charCodeAt(1))||255===e.value.charCodeAt(0)&&128==(128&e.value.charCodeAt(1)))?o.putBytes(e.value.substr(1)):o.putBytes(e.value);if(t.putByte(r),o.length()<=127)t.putByte(127&o.length());else{var u=o.length(),c="";do{c+=String.fromCharCode(255&u),u>>>=8}while(u>0);t.putByte(128|c.length);for(var a=c.length-1;a>=0;--a)t.putByte(c.charCodeAt(a))}return t.putBuffer(o),t},i.oidToDer=function(e){var t=e.split("."),r=n.util.createBuffer(),i,o,s,a;r.putByte(40*parseInt(t[0],10)+parseInt(t[1],10));for(var u=2;u<t.length;++u){i=!0,o=[],s=parseInt(t[u],10);do{a=127&s,s>>>=7,i||(a|=128),o.push(a),i=!1}while(s>0);for(var c=o.length-1;c>=0;--c)r.putByte(o[c])}return r},i.derToOid=function(e){var t;"string"==typeof e&&(e=n.util.createBuffer(e));var r=e.getByte();t=Math.floor(r/40)+"."+r%40;for(var i=0;e.length()>0;)r=e.getByte(),i<<=7,128&r?i+=127&r:(t+="."+(i+r),i=0);return t},i.utcTimeToDate=function(e){var t=new Date,r=parseInt(e.substr(0,2),10);r=r>=50?1900+r:2e3+r;var n=parseInt(e.substr(2,2),10)-1,i=parseInt(e.substr(4,2),10),o=parseInt(e.substr(6,2),10),s=parseInt(e.substr(8,2),10),a=0;if(e.length>11){var u=e.charAt(10),c=10;"+"!==u&&"-"!==u&&(a=parseInt(e.substr(10,2),10),c+=2)}if(t.setUTCFullYear(r,n,i),t.setUTCHours(o,s,a,0),c&&(u=e.charAt(c),"+"===u||"-"===u)){var f=parseInt(e.substr(c+1,2),10),l=parseInt(e.substr(c+4,2),10),h=60*f+l;h*=6e4,"+"===u?t.setTime(+t-h):t.setTime(+t+h)}return t},i.generalizedTimeToDate=function(e){var t=new Date,r=parseInt(e.substr(0,4),10),n=parseInt(e.substr(4,2),10)-1,i=parseInt(e.substr(6,2),10),o=parseInt(e.substr(8,2),10),s=parseInt(e.substr(10,2),10),a=parseInt(e.substr(12,2),10),u=0,c=0,f=!1;"Z"===e.charAt(e.length-1)&&(f=!0);var l=e.length-5,h=e.charAt(l);if("+"===h||"-"===h){var p=parseInt(e.substr(l+1,2),10),d=parseInt(e.substr(l+4,2),10);c=60*p+d,c*=6e4,"+"===h&&(c*=-1),f=!0}return"."===e.charAt(14)&&(u=1e3*parseFloat(e.substr(14),10)),f?(t.setUTCFullYear(r,n,i),t.setUTCHours(o,s,a,u),t.setTime(+t+c)):(t.setFullYear(r,n,i),t.setHours(o,s,a,u)),t},i.dateToUtcTime=function(e){if("string"==typeof e)return e;var t="",r=[];r.push((""+e.getUTCFullYear()).substr(2)),r.push(""+(e.getUTCMonth()+1)),r.push(""+e.getUTCDate()),r.push(""+e.getUTCHours()),r.push(""+e.getUTCMinutes()),r.push(""+e.getUTCSeconds());for(var n=0;n<r.length;++n)r[n].length<2&&(t+="0"),t+=r[n];return t+="Z",t},i.dateToGeneralizedTime=function(e){if("string"==typeof e)return e;var t="",r=[];r.push(""+e.getUTCFullYear()),r.push(""+(e.getUTCMonth()+1)),r.push(""+e.getUTCDate()),r.push(""+e.getUTCHours()),r.push(""+e.getUTCMinutes()),r.push(""+e.getUTCSeconds());for(var n=0;n<r.length;++n)r[n].length<2&&(t+="0"),t+=r[n];return t+="Z",t},i.integerToDer=function(e){var t=n.util.createBuffer();if(e>=-128&&e<128)return t.putSignedInt(e,8);if(e>=-32768&&e<32768)return t.putSignedInt(e,16);if(e>=-8388608&&e<8388608)return t.putSignedInt(e,24);if(e>=-2147483648&&e<2147483648)return t.putSignedInt(e,32);var r=new Error("Integer too large; max is 32-bits.");throw r.integer=e,r},i.derToInteger=function(e){"string"==typeof e&&(e=n.util.createBuffer(e));var t=8*e.length();if(t>32)throw new Error("Integer too large; max is 32-bits.");return e.getSignedInt(t)},i.validate=function(e,t,r,o){var s=!1;if(e.tagClass!==t.tagClass&&void 0!==t.tagClass||e.type!==t.type&&void 0!==t.type)o&&(e.tagClass!==t.tagClass&&o.push("["+t.name+'] Expected tag class "'+t.tagClass+'", got "'+e.tagClass+'"'),e.type!==t.type&&o.push("["+t.name+'] Expected type "'+t.type+'", got "'+e.type+'"'));else if(e.constructed===t.constructed||void 0===t.constructed){if(s=!0,t.value&&n.util.isArray(t.value))for(var a=0,u=0;s&&u<t.value.length;++u)s=t.value[u].optional||!1,e.value[a]&&(s=i.validate(e.value[a],t.value[u],r,o),s?++a:t.value[u].optional&&(s=!0)),!s&&o&&o.push("["+t.name+'] Tag class "'+t.tagClass+'", type "'+t.type+'" expected value length "'+t.value.length+'", got "'+e.value.length+'"');var c;if(s&&r)if(t.capture&&(r[t.capture]=e.value),t.captureAsn1&&(r[t.captureAsn1]=e),t.captureBitStringContents&&"bitStringContents"in e&&(r[t.captureBitStringContents]=e.bitStringContents),t.captureBitStringValue&&"bitStringContents"in e)if(e.bitStringContents.length<2)r[t.captureBitStringValue]="";else{var f=e.bitStringContents.charCodeAt(0);if(0!==f)throw new Error("captureBitStringValue only supported for zero unused bits");r[t.captureBitStringValue]=e.bitStringContents.slice(1)}}else o&&o.push("["+t.name+'] Expected constructed "'+t.constructed+'", got "'+e.constructed+'"');return s};var u=/[^\\u0000-\\u00ff]/;i.prettyPrint=function(e,t,r){var o="";t=t||0,r=r||2,t>0&&(o+="\n");for(var s="",a=0;a<t*r;++a)s+=" ";switch(o+=s+"Tag: ",e.tagClass){case i.Class.UNIVERSAL:o+="Universal:";break;case i.Class.APPLICATION:o+="Application:";break;case i.Class.CONTEXT_SPECIFIC:o+="Context-Specific:";break;case i.Class.PRIVATE:o+="Private:"}if(e.tagClass===i.Class.UNIVERSAL)switch(o+=e.type,e.type){case i.Type.NONE:o+=" (None)";break;case i.Type.BOOLEAN:o+=" (Boolean)";break;case i.Type.INTEGER:o+=" (Integer)";break;case i.Type.BITSTRING:o+=" (Bit string)";break;case i.Type.OCTETSTRING:o+=" (Octet string)";break;case i.Type.NULL:o+=" (Null)";break;case i.Type.OID:o+=" (Object Identifier)";break;case i.Type.ODESC:o+=" (Object Descriptor)";break;case i.Type.EXTERNAL:o+=" (External or Instance of)";break;case i.Type.REAL:o+=" (Real)";break;case i.Type.ENUMERATED:o+=" (Enumerated)";break;case i.Type.EMBEDDED:o+=" (Embedded PDV)";break;case i.Type.UTF8:o+=" (UTF8)";break;case i.Type.ROID:o+=" (Relative Object Identifier)";break;case i.Type.SEQUENCE:o+=" (Sequence)";break;case i.Type.SET:o+=" (Set)";break;case i.Type.PRINTABLESTRING:o+=" (Printable String)";break;case i.Type.IA5String:o+=" (IA5String (ASCII))";break;case i.Type.UTCTIME:o+=" (UTC time)";break;case i.Type.GENERALIZEDTIME:o+=" (Generalized time)";break;case i.Type.BMPSTRING:o+=" (BMP String)"}else o+=e.type;if(o+="\n",o+=s+"Constructed: "+e.constructed+"\n",e.composed){for(var c=0,f="",a=0;a<e.value.length;++a)void 0!==e.value[a]&&(c+=1,f+=i.prettyPrint(e.value[a],t+1,r),a+1<e.value.length&&(f+=","));o+=s+"Sub values: "+c+f}else{if(o+=s+"Value: ",e.type===i.Type.OID){var l=i.derToOid(e.value);o+=l,n.pki&&n.pki.oids&&l in n.pki.oids&&(o+=" ("+n.pki.oids[l]+") ")}if(e.type===i.Type.INTEGER)try{o+=i.derToInteger(e.value)}catch(t){o+="0x"+n.util.bytesToHex(e.value)}else if(e.type===i.Type.BITSTRING){if(e.value.length>1?o+="0x"+n.util.bytesToHex(e.value.slice(1)):o+="(none)",e.value.length>0){var h=e.value.charCodeAt(0);1==h?o+=" (1 unused bit shown)":h>1&&(o+=" ("+h+" unused bits shown)")}}else e.type===i.Type.OCTETSTRING?(u.test(e.value)||(o+="("+e.value+") "),o+="0x"+n.util.bytesToHex(e.value)):e.type===i.Type.UTF8?o+=n.util.decodeUtf8(e.value):e.type===i.Type.PRINTABLESTRING||e.type===i.Type.IA5String?o+=e.value:u.test(e.value)?o+="0x"+n.util.bytesToHex(e.value):0===e.value.length?o+="[null]":o+=e.value}return o}},function(e,t,r){var n=r(11);e.exports=n.md=n.md||{},n.md.algorithms=n.md.algorithms||{}},function(e,t,r){(function(e,r){var n=200,i="Expected a function",o="__lodash_hash_undefined__",s=1,a=2,u=1/0,c=9007199254740991,f="[object Arguments]",l="[object Array]",h="[object Boolean]",p="[object Date]",d="[object Error]",y="[object Function]",g="[object GeneratorFunction]",m="[object Map]",b="[object Number]",v="[object Object]",_="[object Promise]",w="[object RegExp]",S="[object Set]",k="[object String]",E="[object Symbol]",A="[object WeakMap]",x="[object ArrayBuffer]",I="[object DataView]",T="[object Float32Array]",B="[object Float64Array]",C="[object Int8Array]",P="[object Int16Array]",O="[object Int32Array]",R="[object Uint8Array]",N="[object Uint8ClampedArray]",L="[object Uint16Array]",j="[object Uint32Array]",M=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,K=/^\w*$/,D=/^\./,U=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,F=/[\\^$.*+?()[\]{}|]/g,q=/\\(\\)?/g,H=/^\[object .+?Constructor\]$/,z=/^(?:0|[1-9]\d*)$/,V={};V[T]=V[B]=V[C]=V[P]=V[O]=V[R]=V[N]=V[L]=V[j]=!0,V[f]=V[l]=V[x]=V[h]=V[I]=V[p]=V[d]=V[y]=V[m]=V[b]=V[v]=V[w]=V[S]=V[k]=V[A]=!1;var G="object"==typeof e&&e&&e.Object===Object&&e,W="object"==typeof self&&self&&self.Object===Object&&self,$=G||W||Function("return this")(),Y="object"==typeof t&&t&&!t.nodeType&&t,J=Y&&"object"==typeof r&&r&&!r.nodeType&&r,X=J&&J.exports===Y,Z=X&&G.process,Q=function(){try{return Z&&Z.binding("util")}catch(e){}}(),ee=Q&&Q.isTypedArray;function te(e,t){for(var r=-1,n=e?e.length:0,i=Array(n);++r<n;)i[r]=t(e[r],r,e);return i}function re(e,t){for(var r=-1,n=e?e.length:0;++r<n;)if(t(e[r],r,e))return!0;return!1}function ne(e){return function(t){return null==t?void 0:t[e]}}function ie(e,t){for(var r=-1,n=Array(e);++r<e;)n[r]=t(r);return n}function oe(e){return function(t){return e(t)}}function se(e,t){return null==e?void 0:e[t]}function ae(e){var t=!1;if(null!=e&&"function"!=typeof e.toString)try{t=!!(e+"")}catch(e){}return t}function ue(e){var t=-1,r=Array(e.size);return e.forEach(function(e,n){r[++t]=[n,e]}),r}function ce(e,t){return function(r){return e(t(r))}}function fe(e){var t=-1,r=Array(e.size);return e.forEach(function(e){r[++t]=e}),r}var le=Array.prototype,he=Function.prototype,pe=Object.prototype,de=$["__core-js_shared__"],ye=(ge=/[^.]+$/.exec(de&&de.keys&&de.keys.IE_PROTO||""),ge?"Symbol(src)_1."+ge:""),ge,me=he.toString,be=pe.hasOwnProperty,ve=pe.toString,_e=RegExp("^"+me.call(be).replace(F,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),we=$.Symbol,Se=$.Uint8Array,ke=pe.propertyIsEnumerable,Ee=le.splice,Ae=ce(Object.keys,Object),xe=Ft($,"DataView"),Ie=Ft($,"Map"),Te=Ft($,"Promise"),Be=Ft($,"Set"),Ce=Ft($,"WeakMap"),Pe=Ft(Object,"create"),Oe=Qt(xe),Re=Qt(Ie),Ne=Qt(Te),Le=Qt(Be),je=Qt(Ce),Me=we?we.prototype:void 0,Ke=Me?Me.valueOf:void 0,De=Me?Me.toString:void 0;function Ue(e){var t=-1,r=e?e.length:0;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}function Fe(){this.__data__=Pe?Pe(null):{}}function qe(e){return this.has(e)&&delete this.__data__[e]}function He(e){var t=this.__data__;if(Pe){var r=t[e];return r===o?void 0:r}return be.call(t,e)?t[e]:void 0}function ze(e){var t=this.__data__;return Pe?void 0!==t[e]:be.call(t,e)}function Ve(e,t){var r=this.__data__;return r[e]=Pe&&void 0===t?o:t,this}function Ge(e){var t=-1,r=e?e.length:0;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}function We(){this.__data__=[]}function $e(e){var t=this.__data__,r=dt(t,e);if(r<0)return!1;var n=t.length-1;return r==n?t.pop():Ee.call(t,r,1),!0}function Ye(e){var t=this.__data__,r=dt(t,e);return r<0?void 0:t[r][1]}function Je(e){return dt(this.__data__,e)>-1}function Xe(e,t){var r=this.__data__,n=dt(r,e);return n<0?r.push([e,t]):r[n][1]=t,this}function Ze(e){var t=-1,r=e?e.length:0;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}function Qe(){this.__data__={hash:new Ue,map:new(Ie||Ge),string:new Ue}}function et(e){return Dt(this,e).delete(e)}function tt(e){return Dt(this,e).get(e)}function rt(e){return Dt(this,e).has(e)}function nt(e,t){return Dt(this,e).set(e,t),this}function it(e){var t=-1,r=e?e.length:0;for(this.__data__=new Ze;++t<r;)this.add(e[t])}function ot(e){return this.__data__.set(e,o),this}function st(e){return this.__data__.has(e)}function at(e){this.__data__=new Ge(e)}function ut(){this.__data__=new Ge}function ct(e){return this.__data__.delete(e)}function ft(e){return this.__data__.get(e)}function lt(e){return this.__data__.has(e)}function ht(e,t){var r=this.__data__;if(r instanceof Ge){var i=r.__data__;if(!Ie||i.length<n-1)return i.push([e,t]),this;r=this.__data__=new Ze(i)}return r.set(e,t),this}function pt(e,t){var r=ir(e)||nr(e)?ie(e.length,String):[],n=r.length,i=!!n;for(var o in e)!t&&!be.call(e,o)||i&&("length"==o||zt(o,n))||r.push(o);return r}function dt(e,t){for(var r=e.length;r--;)if(rr(e[r][0],t))return r;return-1}Ue.prototype.clear=Fe,Ue.prototype.delete=qe,Ue.prototype.get=He,Ue.prototype.has=ze,Ue.prototype.set=Ve,Ge.prototype.clear=We,Ge.prototype.delete=$e,Ge.prototype.get=Ye,Ge.prototype.has=Je,Ge.prototype.set=Xe,Ze.prototype.clear=Qe,Ze.prototype.delete=et,Ze.prototype.get=tt,Ze.prototype.has=rt,Ze.prototype.set=nt,it.prototype.add=it.prototype.push=ot,it.prototype.has=st,at.prototype.clear=ut,at.prototype.delete=ct,at.prototype.get=ft,at.prototype.has=lt,at.prototype.set=ht;var yt=Nt(mt),gt=Lt();function mt(e,t){return e&>(e,t,gr)}function bt(e,t){t=Vt(t,e)?[t]:Rt(t);for(var r=0,n=t.length;null!=e&&r<n;)e=e[Zt(t[r++])];return r&&r==n?e:void 0}function vt(e){return ve.call(e)}function _t(e,t){return null!=e&&t in Object(e)}function wt(e,t,r,n,i){return e===t||(null==e||null==t||!cr(e)&&!fr(t)?e!=e&&t!=t:St(e,t,wt,r,n,i))}function St(e,t,r,n,i,o){var s=ir(e),u=ir(t),c=l,h=l;s||(c=qt(e),c=c==f?v:c),u||(h=qt(t),h=h==f?v:h);var p=c==v&&!ae(e),d=h==v&&!ae(t),y=c==h;if(y&&!p)return o||(o=new at),s||hr(e)?jt(e,t,r,n,i,o):Mt(e,t,c,r,n,i,o);if(!(i&a)){var g=p&&be.call(e,"__wrapped__"),m=d&&be.call(t,"__wrapped__");if(g||m){var b=g?e.value():e,_=m?t.value():t;return o||(o=new at),r(b,_,n,i,o)}}return!!y&&(o||(o=new at),Kt(e,t,r,n,i,o))}function kt(e,t,r,n){var i=r.length,o=i,u=!n;if(null==e)return!o;for(e=Object(e);i--;){var c=r[i];if(u&&c[2]?c[1]!==e[c[0]]:!(c[0]in e))return!1}for(;++i<o;){c=r[i];var f=c[0],l=e[f],h=c[1];if(u&&c[2]){if(void 0===l&&!(f in e))return!1}else{var p=new at;if(n)var d=n(l,h,f,e,t,p);if(!(void 0===d?wt(h,l,n,s|a,p):d))return!1}}return!0}function Et(e){if(!cr(e)||Wt(e))return!1;var t=ar(e)||ae(e)?_e:H;return t.test(Qt(e))}function At(e){return fr(e)&&ur(e.length)&&!!V[ve.call(e)]}function xt(e){return"function"==typeof e?e:null==e?mr:"object"==typeof e?ir(e)?Ct(e[0],e[1]):Bt(e):br(e)}function It(e){if(!$t(e))return Ae(e);var t=[];for(var r in Object(e))be.call(e,r)&&"constructor"!=r&&t.push(r);return t}function Tt(e,t){var r=-1,n=or(e)?Array(e.length):[];return yt(e,function(e,i,o){n[++r]=t(e,i,o)}),n}function Bt(e){var t=Ut(e);return 1==t.length&&t[0][2]?Jt(t[0][0],t[0][1]):function(r){return r===e||kt(r,e,t)}}function Ct(e,t){return Vt(e)&&Yt(t)?Jt(Zt(e),t):function(r){var n=dr(r,e);return void 0===n&&n===t?yr(r,e):wt(t,n,void 0,s|a)}}function Pt(e){return function(t){return bt(t,e)}}function Ot(e){if("string"==typeof e)return e;if(lr(e))return De?De.call(e):"";var t=e+"";return"0"==t&&1/e==-u?"-0":t}function Rt(e){return ir(e)?e:Xt(e)}function Nt(e,t){return function(r,n){if(null==r)return r;if(!or(r))return e(r,n);for(var i=r.length,o=t?i:-1,s=Object(r);(t?o--:++o<i)&&!1!==n(s[o],o,s););return r}}function Lt(e){return function(t,r,n){for(var i=-1,o=Object(t),s=n(t),a=s.length;a--;){var u=s[e?a:++i];if(!1===r(o[u],u,o))break}return t}}function jt(e,t,r,n,i,o){var u=i&a,c=e.length,f=t.length;if(c!=f&&!(u&&f>c))return!1;var l=o.get(e);if(l&&o.get(t))return l==t;var h=-1,p=!0,d=i&s?new it:void 0;for(o.set(e,t),o.set(t,e);++h<c;){var y=e[h],g=t[h];if(n)var m=u?n(g,y,h,t,e,o):n(y,g,h,e,t,o);if(void 0!==m){if(m)continue;p=!1;break}if(d){if(!re(t,function(e,t){if(!d.has(t)&&(y===e||r(y,e,n,i,o)))return d.add(t)})){p=!1;break}}else if(y!==g&&!r(y,g,n,i,o)){p=!1;break}}return o.delete(e),o.delete(t),p}function Mt(e,t,r,n,i,o,u){switch(r){case I:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case x:return!(e.byteLength!=t.byteLength||!n(new Se(e),new Se(t)));case h:case p:case b:return rr(+e,+t);case d:return e.name==t.name&&e.message==t.message;case w:case k:return e==t+"";case m:var c=ue;case S:var f=o&a;if(c||(c=fe),e.size!=t.size&&!f)return!1;var l=u.get(e);if(l)return l==t;o|=s,u.set(e,t);var y=jt(c(e),c(t),n,i,o,u);return u.delete(e),y;case E:if(Ke)return Ke.call(e)==Ke.call(t)}return!1}function Kt(e,t,r,n,i,o){var s=i&a,u=gr(e),c=u.length,f=gr(t),l=f.length;if(c!=l&&!s)return!1;for(var h=c;h--;){var p=u[h];if(!(s?p in t:be.call(t,p)))return!1}var d=o.get(e);if(d&&o.get(t))return d==t;var y=!0;o.set(e,t),o.set(t,e);for(var g=s;++h<c;){p=u[h];var m=e[p],b=t[p];if(n)var v=s?n(b,m,p,t,e,o):n(m,b,p,e,t,o);if(!(void 0===v?m===b||r(m,b,n,i,o):v)){y=!1;break}g||(g="constructor"==p)}if(y&&!g){var _=e.constructor,w=t.constructor;_!=w&&"constructor"in e&&"constructor"in t&&!("function"==typeof _&&_ instanceof _&&"function"==typeof w&&w instanceof w)&&(y=!1)}return o.delete(e),o.delete(t),y}function Dt(e,t){var r=e.__data__;return Gt(t)?r["string"==typeof t?"string":"hash"]:r.map}function Ut(e){for(var t=gr(e),r=t.length;r--;){var n=t[r],i=e[n];t[r]=[n,i,Yt(i)]}return t}function Ft(e,t){var r=se(e,t);return Et(r)?r:void 0}var qt=vt;function Ht(e,t,r){t=Vt(t,e)?[t]:Rt(t);for(var n,i=-1,o=t.length;++i<o;){var s=Zt(t[i]);if(!(n=null!=e&&r(e,s)))break;e=e[s]}if(n)return n;var o=e?e.length:0;return!!o&&ur(o)&&zt(s,o)&&(ir(e)||nr(e))}function zt(e,t){return t=null==t?c:t,!!t&&("number"==typeof e||z.test(e))&&e>-1&&e%1==0&&e<t}function Vt(e,t){if(ir(e))return!1;var r=typeof e;return!("number"!=r&&"symbol"!=r&&"boolean"!=r&&null!=e&&!lr(e))||(K.test(e)||!M.test(e)||null!=t&&e in Object(t))}function Gt(e){var t=typeof e;return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e}function Wt(e){return!!ye&&ye in e}function $t(e){var t=e&&e.constructor,r="function"==typeof t&&t.prototype||pe;return e===r}function Yt(e){return e==e&&!cr(e)}function Jt(e,t){return function(r){return null!=r&&(r[e]===t&&(void 0!==t||e in Object(r)))}}(xe&&qt(new xe(new ArrayBuffer(1)))!=I||Ie&&qt(new Ie)!=m||Te&&qt(Te.resolve())!=_||Be&&qt(new Be)!=S||Ce&&qt(new Ce)!=A)&&(qt=function(e){var t=ve.call(e),r=t==v?e.constructor:void 0,n=r?Qt(r):void 0;if(n)switch(n){case Oe:return I;case Re:return m;case Ne:return _;case Le:return S;case je:return A}return t});var Xt=tr(function(e){e=pr(e);var t=[];return D.test(e)&&t.push(""),e.replace(U,function(e,r,n,i){t.push(n?i.replace(q,"$1"):r||e)}),t});function Zt(e){if("string"==typeof e||lr(e))return e;var t=e+"";return"0"==t&&1/e==-u?"-0":t}function Qt(e){if(null!=e){try{return me.call(e)}catch(e){}try{return e+""}catch(e){}}return""}function er(e,t){var r=ir(e)?te:Tt;return r(e,xt(t,3))}function tr(e,t){if("function"!=typeof e||t&&"function"!=typeof t)throw new TypeError(i);var r=function(){var n=arguments,i=t?t.apply(this,n):n[0],o=r.cache;if(o.has(i))return o.get(i);var s=e.apply(this,n);return r.cache=o.set(i,s),s};return r.cache=new(tr.Cache||Ze),r}function rr(e,t){return e===t||e!=e&&t!=t}function nr(e){return sr(e)&&be.call(e,"callee")&&(!ke.call(e,"callee")||ve.call(e)==f)}tr.Cache=Ze;var ir=Array.isArray;function or(e){return null!=e&&ur(e.length)&&!ar(e)}function sr(e){return fr(e)&&or(e)}function ar(e){var t=cr(e)?ve.call(e):"";return t==y||t==g}function ur(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=c}function cr(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function fr(e){return!!e&&"object"==typeof e}function lr(e){return"symbol"==typeof e||fr(e)&&ve.call(e)==E}var hr=ee?oe(ee):At;function pr(e){return null==e?"":Ot(e)}function dr(e,t,r){var n=null==e?void 0:bt(e,t);return void 0===n?r:n}function yr(e,t){return null!=e&&Ht(e,t,_t)}function gr(e){return or(e)?pt(e):It(e)}function mr(e){return e}function br(e){return Vt(e)?ne(Zt(e)):Pt(e)}r.exports=er}).call(this,r(7),r(28)(e))},function(e,t,r){"use strict";const n=r(31),i=I("dns4"),o=I("dns6"),s=x(I("dnsaddr"),i,o),a=x(I("ip4"),I("ip6")),u=A(a,I("tcp")),c=A(a,I("udp")),f=A(c,I("utp")),l=x(A(s,I("tcp")),s),h=x(A(u,I("ws")),A(l,I("ws"))),p=x(A(u,I("wss")),A(l,I("wss"))),d=x(A(u,I("http")),A(a,I("http")),A(l,I("http")),A(l)),y=x(A(u,I("https")),A(a,I("https")),A(l,I("https"))),g=x(A(h,I("p2p-webrtc-star"),I("ipfs")),A(p,I("p2p-webrtc-star"),I("ipfs"))),m=x(A(h,I("p2p-websocket-star"),I("ipfs")),A(p,I("p2p-websocket-star"),I("ipfs")),A(h,I("p2p-websocket-star")),A(p,I("p2p-websocket-star"))),b=x(A(d,I("p2p-webrtc-direct")),A(y,I("p2p-webrtc-direct"))),v=x(h,p,d,y,g,b,u,f);let _=x(A(v,I("ipfs")),g,I("ipfs"));const w=x(A(_,I("p2p-circuit"),_),A(_,I("p2p-circuit")),A(I("p2p-circuit"),_),A(v,I("p2p-circuit")),A(I("p2p-circuit"),v),I("p2p-circuit")),S=()=>x(A(w,S),w),k=S(),E=x(A(k,_,k),A(_,k),A(k,_),k,_);function A(){const e=Array.from(arguments);function t(e){"string"==typeof e&&(e=n(e));let t=r(e.protoNames());return null!==t&&0===t.length}function r(t){return t.length<e.length?null:(e.some(e=>{if(t="function"==typeof e?e().partialMatch(t):e.partialMatch(t),null===t)return!0}),t)}return{toString:function(){return"{ "+e.join(" ")+" }"},input:e,matches:t,partialMatch:r}}function x(){const e=Array.from(arguments);function t(e){"string"==typeof e&&(e=n(e));const t=r(e.protoNames());return null!==t&&0===t.length}function r(t){let r=null;return e.some(e=>{const n="function"==typeof e?e().partialMatch(t):e.partialMatch(t);if(n)return r=n,!0}),r}const i={toString:function(){return"{ "+e.join(" ")+" }"},input:e,matches:t,partialMatch:r};return i}function I(e){const t=e;function r(e){"string"==typeof e&&(e=n(e));const r=e.protoNames();return 1===r.length&&r[0]===t}function i(e){return 0===e.length?null:e[0]===t?e.slice(1):null}return{toString:function(){return t},matches:r,partialMatch:i}}t.DNS=l,t.DNS4=i,t.DNS6=o,t.IP=a,t.TCP=u,t.UDP=c,t.UTP=f,t.HTTP=d,t.HTTPS=y,t.WebSockets=h,t.WebSocketsSecure=p,t.WebSocketStar=m,t.WebRTCStar=g,t.WebRTCDirect=b,t.Reliable=v,t.Circuit=k,t.IPFS=E},function(e,t){errors={};class r extends Error{constructor(e){super(e||"Coding Error"),this.name="CodingError"}}errors.CodingError=r;class n extends Error{constructor(e){super("To be implemented: "+e),this.name="ToBeImplementedError"}}errors.ToBeImplementedError=n;class i extends Error{constructor(e){super(e||"Transport failure"),this.name="TransportError"}}errors.TransportError=i;class o extends Error{constructor(e){super(e||"Timed out"),this.name="TimeoutError"}}errors.TimeoutError=o;class s extends Error{constructor(e){super(e||"Intentionally Unimplemented Function"),this.name="IntentionallyUnimplementedError"}}errors.IntentionallyUnimplementedError=s,t=e.exports=errors},function(e,t,r){"use strict";var n=r(339);e.exports=function e(t,r){if(!t)return function(e,t){return e?n(t,e,r):t(!0)};Array.isArray(t)||(t=Object.keys(t).map(function(e){return t[e]}));var i=0;return function(e,o){if(e)return n(o,e,r);i>=t.length?o(!0):o(null,t[i++])}}},function(e,t,r){"use strict";(function(t){const n=r(8),i=r(699),o=r(26).utils.asyncFilter,s=r(26).utils.asyncSort,a=r(26).Key,u=r(707);class c{constructor(e,t){let n;t&&t.db?(n=t.db,delete t.db):n=r(712),this.db=i(u(n(e),{valueEncoding:"binary"}),Object.assign({},t,{compression:!1}),e=>{if(e)throw e})}open(e){this.db.open(e)}put(e,t,r){this.db.put(e.toString(),t,r)}get(e,t){this.db.get(e.toString(),t)}has(e,t){this.db.get(e.toString(),(e,r)=>{if(e)return e.notFound?void t(null,!1):void t(e);t(null,!0)})}delete(e,t){this.db.del(e.toString(),e=>{t(e)})}close(e){this.db.close(e)}batch(){const e=[];return{put:(t,r)=>{e.push({type:"put",key:t.toString(),value:r})},delete:t=>{e.push({type:"del",key:t.toString()})},commit:t=>{this.db.batch(e,t)}}}query(e){let r=!0;null!=e.keysOnly&&(r=!e.keysOnly);const i=this.db.db.iterator({keys:!0,values:r,keyAsBuffer:!0}),u=(e,n)=>{if(e)return i.end(t=>{n(t||e)});i.next((e,o,s)=>{if(e)return n(e);if(null==e&&null==o&&null==s)return i.end(e=>{n(e||!0)});const u={key:new a(o,!1)};r&&(u.value=t.from(s)),n(null,u)})};let c=[u],f=[];if(null!=e.prefix){const t=e.prefix;f.push((e,r)=>r(null,e.key.toString().startsWith(t)))}if(null!=e.filters&&(f=f.concat(e.filters)),c=c.concat(f.map(e=>o(e))),null!=e.orders&&(c=c.concat(e.orders.map(e=>s(e)))),null!=e.offset){let t=0;c.push(n.filter(()=>t++>=e.offset))}return null!=e.limit&&c.push(n.take(e.limit)),n.apply(null,c)}}e.exports=c}).call(this,r(0).Buffer)},function(e,t){function r(e,t){if(!e)throw new Error(t||"Assertion failed")}e.exports=r,r.equal=function e(t,r,n){if(t!=r)throw new Error(n||"Assertion failed: "+t+" != "+r)}},function(e,t,r){"use strict";(function(t){var n=r(15),i=r(20),o=r(24),s=r(34),a=function e(r){if(!(this instanceof e))return new e(r);if(!n.isUndefined(r))if(t.isBuffer(r))this.set({buf:r});else if(n.isString(r))this.set({buf:new t(r,"hex")});else{if(!n.isObject(r))throw new TypeError("Unrecognized argument for BufferReader");var i=r;this.set(i)}};a.prototype.set=function(e){return this.buf=e.buf||this.buf||void 0,this.pos=e.pos||this.pos||0,this},a.prototype.eof=function(){return this.pos>=this.buf.length},a.prototype.finished=a.prototype.eof,a.prototype.read=function(e){i.checkArgument(!n.isUndefined(e),"Must specify a length");var t=this.buf.slice(this.pos,this.pos+e);return this.pos=this.pos+e,t},a.prototype.readAll=function(){var e=this.buf.slice(this.pos,this.buf.length);return this.pos=this.buf.length,e},a.prototype.readUInt8=function(){var e=this.buf.readUInt8(this.pos);return this.pos=this.pos+1,e},a.prototype.readUInt16BE=function(){var e=this.buf.readUInt16BE(this.pos);return this.pos=this.pos+2,e},a.prototype.readUInt16LE=function(){var e=this.buf.readUInt16LE(this.pos);return this.pos=this.pos+2,e},a.prototype.readUInt32BE=function(){var e=this.buf.readUInt32BE(this.pos);return this.pos=this.pos+4,e},a.prototype.readUInt32LE=function(){var e=this.buf.readUInt32LE(this.pos);return this.pos=this.pos+4,e},a.prototype.readUInt64BEBN=function(){var e=this.buf.slice(this.pos,this.pos+8),t=s.fromBuffer(e);return this.pos=this.pos+8,t},a.prototype.readUInt64LEBN=function(){var e=this.buf.readUInt32LE(this.pos),t=this.buf.readUInt32LE(this.pos+4),r=4294967296*t+e,n;if(r<=9007199254740991)n=new s(r);else{var i=Array.prototype.slice.call(this.buf,this.pos,this.pos+8);n=new s(i,10,"le")}return this.pos=this.pos+8,n},a.prototype.readVarintNum=function(){var e=this.readUInt8();switch(e){case 253:return this.readUInt16LE();case 254:return this.readUInt32LE();case 255:var t=this.readUInt64LEBN(),r=t.toNumber();if(r<=Math.pow(2,53))return r;throw new Error("number too large to retain precision - use readVarintBN");default:return e}},a.prototype.readVarLengthBuffer=function(){var e=this.readVarintNum(),t=this.read(e);return i.checkState(t.length===e,"Invalid length while reading varlength buffer. Expected to read: "+e+" and read "+t.length),t},a.prototype.readVarintBuf=function(){var e=this.buf.readUInt8(this.pos);switch(e){case 253:return this.read(3);case 254:return this.read(5);case 255:return this.read(9);default:return this.read(1)}},a.prototype.readVarintBN=function(){var e=this.readUInt8();switch(e){case 253:return new s(this.readUInt16LE());case 254:return new s(this.readUInt32LE());case 255:return this.readUInt64LEBN();default:return new s(e)}},a.prototype.reverse=function(){for(var e=new t(this.buf.length),r=0;r<e.length;r++)e[r]=this.buf[this.buf.length-1-r];return this.buf=e,this},a.prototype.readReverse=function(e){n.isUndefined(e)&&(e=this.buf.length);var t=this.buf.slice(this.pos,this.pos+e);return this.pos=this.pos+e,o.reverse(t)},e.exports=a}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(t){var n=r(0),i=r(61),o=r(62),s=r(87),a=r(85),u=r(58),c=r(34),f=r(40),l=r(423),h=r(20),p=r(15),d="0000000000000000000000000000000000000000000000000000000000000001",y="ffffffffffffffff",g=function e(l,h,p,g){var m=r(249),b=r(250),v,_=m.shallowCopy(l);for(g=new o(g),g.removeCodeseparators(),v=0;v<_.inputs.length;v++)_.inputs[v]=new b(_.inputs[v]).setScript(o.empty());if(_.inputs[p]=new b(_.inputs[p]).setScript(g),(31&h)===i.SIGHASH_NONE||(31&h)===i.SIGHASH_SINGLE)for(v=0;v<_.inputs.length;v++)v!==p&&(_.inputs[v].sequenceNumber=0);if((31&h)===i.SIGHASH_NONE)_.outputs=[];else if((31&h)===i.SIGHASH_SINGLE){if(p>=_.outputs.length)return new t(d,"hex");for(_.outputs.length=p+1,v=0;v<p;v++)_.outputs[v]=new s({satoshis:c.fromBuffer(new n.Buffer(y,"hex")),script:o.empty()})}h&i.SIGHASH_ANYONECANPAY&&(_.inputs=[_.inputs[p]]);var w=(new u).write(_.toBuffer()).writeInt32LE(h).toBuffer(),S=f.sha256sha256(w);return S=new a(S).readReverse(),S};function m(e,t,r,n,i){var o=g(e,r,n,i),s=l.sign(o,t,"little").set({nhashtype:r});return s}function b(e,t,r,n,i){h.checkArgument(!p.isUndefined(e)),h.checkArgument(!p.isUndefined(t)&&!p.isUndefined(t.nhashtype));var o=g(e,t.nhashtype,n,i);return l.verify(o,t,r,"little")}e.exports={sighash:g,sign:m,verify:b}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";var n=r(15),i=r(34),o=r(0),s=r(24),a=r(30),u=r(58),c=r(62),f=r(20),l=r(60),h=9007199254740991;function p(e){if(!(this instanceof p))return new p(e);if(!n.isObject(e))throw new TypeError("Unrecognized argument for Output");var t;this.satoshis=e.satoshis,s.isBuffer(e.script)?this._scriptBuffer=e.script:(t=n.isString(e.script)&&a.isHexa(e.script)?new o.Buffer(e.script,"hex"):e.script,this.setScript(t))}Object.defineProperty(p.prototype,"script",{configurable:!1,enumerable:!0,get:function(){return this._script?this._script:(this.setScriptFromBuffer(this._scriptBuffer),this._script)}}),Object.defineProperty(p.prototype,"satoshis",{configurable:!1,enumerable:!0,get:function(){return this._satoshis},set:function(e){e instanceof i?(this._satoshisBN=e,this._satoshis=e.toNumber()):n.isString(e)?(this._satoshis=parseInt(e),this._satoshisBN=i.fromNumber(this._satoshis)):(f.checkArgument(a.isNaturalNumber(e),"Output satoshis is not a natural number"),this._satoshisBN=i.fromNumber(e),this._satoshis=e),f.checkState(a.isNaturalNumber(this._satoshis),"Output satoshis is not a natural number")}}),p.prototype.invalidSatoshis=function(){return this._satoshis>9007199254740991?"transaction txout satoshis greater than max safe integer":this._satoshis!==this._satoshisBN.toNumber()?"transaction txout satoshis has corrupted value":this._satoshis<0&&"transaction txout negative"},p.prototype.toObject=p.prototype.toJSON=function e(){var t={satoshis:this.satoshis};return t.script=this._scriptBuffer.toString("hex"),t},p.fromObject=function(e){return new p(e)},p.prototype.setScriptFromBuffer=function(e){this._scriptBuffer=e;try{this._script=c.fromBuffer(this._scriptBuffer),this._script._isOutput=!0}catch(e){if(!(e instanceof l.Script.InvalidBuffer))throw e;this._script=null}},p.prototype.setScript=function(e){if(e instanceof c)this._scriptBuffer=e.toBuffer(),this._script=e,this._script._isOutput=!0;else if(n.isString(e))this._script=c.fromString(e),this._scriptBuffer=this._script.toBuffer(),this._script._isOutput=!0;else{if(!s.isBuffer(e))throw new TypeError("Invalid argument type: script");this.setScriptFromBuffer(e)}return this},p.prototype.inspect=function(){var e;return e=this.script?this.script.inspect():this._scriptBuffer.toString("hex"),"<Output ("+this.satoshis+" sats) "+e+">"},p.fromBufferReader=function(e){var t={};t.satoshis=e.readUInt64LEBN();var r=e.readVarintNum();return t.script=0!==r?e.read(r):new o.Buffer([]),new p(t)},p.prototype.toBufferWriter=function(e){e||(e=new u),e.writeUInt64LEBN(this._satoshisBN);var t=this._scriptBuffer;return e.writeVarintNum(t.length),e.write(t),e},e.exports=p},function(e,t,r){"use strict";function n(e,t,r){var n=e instanceof Error?e:new Error(e),i;if("object"==typeof t?r=t:null!=t&&(n.code=t),r)for(i in r)n[i]=r[i];return n}e.exports=n},function(e,t,r){"use strict";var n=r(152),i=Object.keys||function(e){var t=[];for(var r in e)t.push(r);return t};e.exports=l;var o=r(119);o.inherits=r(4);var s=r(326),a=r(207);o.inherits(l,s);for(var u=i(a.prototype),c=0;c<u.length;c++){var f=u[c];l.prototype[f]||(l.prototype[f]=a.prototype[f])}function l(e){if(!(this instanceof l))return new l(e);s.call(this,e),a.call(this,e),e&&!1===e.readable&&(this.readable=!1),e&&!1===e.writable&&(this.writable=!1),this.allowHalfOpen=!0,e&&!1===e.allowHalfOpen&&(this.allowHalfOpen=!1),this.once("end",h)}function h(){this.allowHalfOpen||this._writableState.ended||n.nextTick(p,this)}function p(e){e.end()}Object.defineProperty(l.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),Object.defineProperty(l.prototype,"destroyed",{get:function(){return void 0!==this._readableState&&void 0!==this._writableState&&(this._readableState.destroyed&&this._writableState.destroyed)},set:function(e){void 0!==this._readableState&&void 0!==this._writableState&&(this._readableState.destroyed=e,this._writableState.destroyed=e)}}),l.prototype._destroy=function(e,t){this.push(null),this.end(),n.nextTick(t,e)}},function(e,t,r){"use strict";var n=r(211);e.exports=function e(t){return n(function(e,t){return e.push(t),e},[],t)}},function(e,t){var r=Array.isArray;e.exports=r},function(e,t,r){e.exports=o;var n=r(10).EventEmitter,i=r(4);function o(){n.call(this)}i(o,n),o.Readable=r(21),o.Writable=r(717),o.Duplex=r(718),o.Transform=r(719),o.PassThrough=r(720),o.Stream=o,o.prototype.pipe=function(e,t){var r=this;function i(t){e.writable&&!1===e.write(t)&&r.pause&&r.pause()}function o(){r.readable&&r.resume&&r.resume()}r.on("data",i),e.on("drain",o),e._isStdio||t&&!1===t.end||(r.on("end",a),r.on("close",u));var s=!1;function a(){s||(s=!0,e.end())}function u(){s||(s=!0,"function"==typeof e.destroy&&e.destroy())}function c(e){if(f(),0===n.listenerCount(this,"error"))throw e}function f(){r.removeListener("data",i),e.removeListener("drain",o),r.removeListener("end",a),r.removeListener("close",u),r.removeListener("error",c),e.removeListener("error",c),r.removeListener("end",f),r.removeListener("close",f),e.removeListener("close",f)}return r.on("error",c),e.on("error",c),r.on("end",f),r.on("close",f),e.on("close",f),e.emit("pipe",r),e}},function(e,t,r){"use strict";const n=r(9),i=r(13),o=r(73);class s{constructor(e,t,r){i(r,"A link requires a multihash to point to"),this._name=e||"",this._size=t,this._cid=new n(r)}toString(){return`DAGLink <${this._cid.toBaseEncodedString()} - name: "${this.name}", size: ${this.size}>`}toJSON(){return this._json||(this._json=Object.freeze({name:this.name,size:this.size,multihash:this._cid.toBaseEncodedString()})),Object.assign({},this._json)}get name(){return this._name}set name(e){throw new Error("Can't set property: 'name' is immutable")}get size(){return this._size}set size(e){throw new Error("Can't set property: 'size' is immutable")}get multihash(){return this._cid.buffer}set multihash(e){throw new Error("Can't set property: 'multihash' is immutable")}}t=e.exports=o(s,{className:"DAGLink",symbolName:"@ipld/js-ipld-dag-pb/daglink"}),t.create=r(744),t.util=r(745)},function(e,t,r){var n=r(2).Buffer,i=r(92).Transform,o=r(208).StringDecoder,s=r(4);function a(e){i.call(this),this.hashMode="string"==typeof e,this.hashMode?this[e]=this._finalOrDigest:this.final=this._finalOrDigest,this._final&&(this.__final=this._final,this._final=null),this._decoder=null,this._encoding=null}s(a,i),a.prototype.update=function(e,t,r){"string"==typeof e&&(e=n.from(e,t));var i=this._update(e);return this.hashMode?this:(r&&(i=this._toString(i,r)),i)},a.prototype.setAutoPadding=function(){},a.prototype.getAuthTag=function(){throw new Error("trying to get auth tag in unsupported state")},a.prototype.setAuthTag=function(){throw new Error("trying to set auth tag in unsupported state")},a.prototype.setAAD=function(){throw new Error("trying to set aad in unsupported state")},a.prototype._transform=function(e,t,r){var n;try{this.hashMode?this._update(e):this.push(this._update(e))}catch(e){n=e}finally{r(n)}},a.prototype._flush=function(e){var t;try{this.push(this.__final())}catch(e){t=e}e(t)},a.prototype._finalOrDigest=function(e){var t=this.__final()||n.alloc(0);return e&&(t=this._toString(t,e,!0)),t},a.prototype._toString=function(e,t,r){if(this._decoder||(this._decoder=new o(t),this._encoding=t),this._encoding!==t)throw new Error("can't switch encodings");var n=this._decoder.write(e);return r&&(n+=this._decoder.end()),n},e.exports=a},function(e,t,r){var n=r(405);r(791),e.exports=n},function(e,t,r){"use strict";t.ethAccountSnapshot=r(408),t.ethBlock=r(418),t.ethBlockList=r(836),t.ethStateTrie=r(841),t.ethStorageTrie=r(844),t.ethTx=r(421),t.ethTxTrie=r(847)},function(e,t){},function(e,t,r){"use strict";var n=r(15),i=r(24),o=r(30),s=[],a={};function u(){}function c(e,t){if(~s.indexOf(e))return e;if(!t)return a[e];n.isArray(t)||(t=[t]);var r=function(t){return s[i][t]===e};for(var i in s)if(n.any(t,r))return s[i]}function f(e){var t=new u;return o.defineImmutable(t,{name:e.name,alias:e.alias,pubkeyhash:e.pubkeyhash,privatekey:e.privatekey,scripthash:e.scripthash,xpubkey:e.xpubkey,xprivkey:e.xprivkey,zaddr:e.zaddr,zkey:e.zkey}),e.networkMagic&&o.defineImmutable(t,{networkMagic:i.integerAsBuffer(e.networkMagic)}),e.port&&o.defineImmutable(t,{port:e.port}),e.dnsSeeds&&o.defineImmutable(t,{dnsSeeds:e.dnsSeeds}),n.each(t,function(e){n.isUndefined(e)||n.isObject(e)||(a[e]=t)}),s.push(t),t}function l(e){for(var t=0;t<s.length;t++)s[t]===e&&s.splice(t,1);for(var r in a)a[r]===e&&delete a[r]}u.prototype.toString=function e(){return this.name},f({name:"livenet",alias:"mainnet",pubkeyhash:7352,privatekey:128,scripthash:7357,xpubkey:76067358,xprivkey:76066276,zaddr:5786,zkey:43830,networkMagic:4179340459,port:8233,dnsSeeds:[]});var h=c("livenet");f({name:"testnet",alias:"regtest",pubkeyhash:7461,privatekey:239,scripthash:7354,xpubkey:70617039,xprivkey:70615956,zaddr:5814,zkey:44040});var p=c("testnet"),d={PORT:18233,NETWORK_MAGIC:i.integerAsBuffer(4187956406),DNS_SEEDS:["dnsseed.testnet.z.cash"]};for(var y in d)n.isObject(d[y])||(a[d[y]]=p);var g={PORT:18444,NETWORK_MAGIC:i.integerAsBuffer(2867347295),DNS_SEEDS:[]};for(var y in g)n.isObject(g[y])||(a[g[y]]=p);function m(){p.regtestEnabled=!0}function b(){p.regtestEnabled=!1}Object.defineProperty(p,"port",{enumerable:!0,configurable:!1,get:function(){return this.regtestEnabled?g.PORT:d.PORT}}),Object.defineProperty(p,"networkMagic",{enumerable:!0,configurable:!1,get:function(){return this.regtestEnabled?g.NETWORK_MAGIC:d.NETWORK_MAGIC}}),Object.defineProperty(p,"dnsSeeds",{enumerable:!0,configurable:!1,get:function(){return this.regtestEnabled?g.DNS_SEEDS:d.DNS_SEEDS}}),e.exports={add:f,remove:l,defaultNetwork:h,livenet:h,mainnet:h,testnet:p,get:c,enableRegtest:m,disableRegtest:b}},function(e,t,r){"use strict";(function(t){var n=r(15),i=r(20),o=r(60),s=r(133),a=r(98),u=r(40),c=r(30),f=r(67);function l(e,t,r){if(!(this instanceof l))return new l(e,t,r);if(n.isArray(e)&&n.isNumber(t))return l.createMultisig(e,t,r);if(e instanceof l)return e;if(i.checkArgument(e,"First argument is required, please include address data.","guide/address.html"),t&&!a.get(t))throw new TypeError('Second argument must be "livenet" or "testnet".');if(r&&r!==l.PayToPublicKeyHash&&r!==l.PayToScriptHash)throw new TypeError('Third argument must be "pubkeyhash" or "scripthash".');var o=this._classifyArguments(e,t,r);return o.network=o.network||a.get(t)||a.defaultNetwork,o.type=o.type||r||l.PayToPublicKeyHash,c.defineImmutable(this,{hashBuffer:o.hashBuffer,network:o.network,type:o.type}),this}l.prototype._classifyArguments=function(e,r,i){if((e instanceof t||e instanceof Uint8Array)&&20===e.length)return l._transformHash(e);if((e instanceof t||e instanceof Uint8Array)&&21===e.length)return l._transformBuffer(e,r,i);if(e instanceof f)return l._transformPublicKey(e);if(e instanceof h)return l._transformScript(e,r);if("string"==typeof e)return l._transformString(e,r,i);if(n.isObject(e))return l._transformObject(e);throw new TypeError("First argument is an unrecognized data format.")},l.PayToPublicKeyHash="pubkeyhash",l.PayToScriptHash="scripthash",l._transformHash=function(e){var r={};if(!(e instanceof t||e instanceof Uint8Array))throw new TypeError("Address supplied is not a buffer.");if(20!==e.length)throw new TypeError("Address hashbuffers must be exactly 20 bytes.");return r.hashBuffer=e,r},l._transformObject=function(e){return i.checkArgument(e.hash||e.hashBuffer,"Must provide a `hash` or `hashBuffer` property"),i.checkArgument(e.type,"Must provide a `type` property"),{hashBuffer:e.hash?new t(e.hash,"hex"):e.hashBuffer,network:a.get(e.network)||a.defaultNetwork,type:e.type}},l._classifyFromVersion=function(e){var t={},r=256*e[0]+e[1],n=a.get(r,"pubkeyhash"),i=a.get(r,"scripthash");return n?(t.network=n,t.type=l.PayToPublicKeyHash):i&&(t.network=i,t.type=l.PayToScriptHash),t},l._transformBuffer=function(e,r,n){var i={};if(!(e instanceof t||e instanceof Uint8Array))throw new TypeError("Address supplied is not a buffer.");if(22!==e.length)throw new TypeError("Address buffers must be exactly 22 bytes.");r=a.get(r);var o=l._classifyFromVersion(e);if(!o.network||r&&r!==o.network)throw new TypeError("Address has mismatched network type.");if(!o.type||n&&n!==o.type)throw new TypeError("Address has mismatched type.");return i.hashBuffer=e.slice(2),i.network=o.network,i.type=o.type,i},l._transformPublicKey=function(e){var t={};if(!(e instanceof f))throw new TypeError("Address must be an instance of PublicKey.");return t.hashBuffer=u.sha256ripemd160(e.toBuffer()),t.type=l.PayToPublicKeyHash,t},l._transformScript=function(e,t){i.checkArgument(e instanceof h,"script must be a Script instance");var r=e.getAddressInfo(t);if(!r)throw new o.Script.CantDeriveAddress(e);return r},l.createMultisig=function(e,t,r){return r=r||e[0].network||a.defaultNetwork,l.payingTo(h.buildMultisigOut(e,t),r)},l._transformString=function(e,t,r){if("string"!=typeof e)throw new TypeError("data parameter supplied is not a string.");e=e.trim();var n=s.decode(e),i=l._transformBuffer(n,t,r);return i},l.fromPublicKey=function(e,t){var r=l._transformPublicKey(e);return t=t||a.defaultNetwork,new l(r.hashBuffer,t,r.type)},l.fromPublicKeyHash=function(e,t){var r=l._transformHash(e);return new l(r.hashBuffer,t,l.PayToPublicKeyHash)},l.fromScriptHash=function(e,t){i.checkArgument(e,"hash parameter is required");var r=l._transformHash(e);return new l(r.hashBuffer,t,l.PayToScriptHash)},l.payingTo=function(e,t){return i.checkArgument(e,"script is required"),i.checkArgument(e instanceof h,"script must be instance of Script"),l.fromScriptHash(u.sha256ripemd160(e.toBuffer()),t)},l.fromScript=function(e,t){i.checkArgument(e instanceof h,"script must be a Script instance");var r=l._transformScript(e,t);return new l(r.hashBuffer,t,r.type)},l.fromBuffer=function(e,t,r){var n=l._transformBuffer(e,t,r);return new l(n.hashBuffer,n.network,n.type)},l.fromString=function(e,t,r){var n=l._transformString(e,t,r);return new l(n.hashBuffer,n.network,n.type)},l.fromObject=function e(r){i.checkState(c.isHexa(r.hash),'Unexpected hash property, "'+r.hash+'", expected to be hex.');var n=new t(r.hash,"hex");return new l(n,r.network,r.type)},l.getValidationError=function(e,t,r){var n;try{new l(e,t,r)}catch(e){n=e}return n},l.isValid=function(e,t,r){return!l.getValidationError(e,t,r)},l.prototype.isPayToPublicKeyHash=function(){return this.type===l.PayToPublicKeyHash},l.prototype.isPayToScriptHash=function(){return this.type===l.PayToScriptHash},l.prototype.toBuffer=function(){var e=new t(this.network[this.type].toString(16),"hex"),r=t.concat([e,this.hashBuffer]);return r},l.prototype.toObject=l.prototype.toJSON=function e(){return{hash:this.hashBuffer.toString("hex"),type:this.type,network:this.network.toString()}},l.prototype.toString=function(){return s.encode(this.toBuffer())},l.prototype.inspect=function(){return"<Address: "+this.toString()+", type: "+this.type+", network: "+this.network+">"},e.exports=l;var h=r(62)}).call(this,r(0).Buffer)},function(e,t,r){var n=r(11);function i(e,t){var r=function(){return new n.aes.Algorithm(e,t)};n.cipher.registerAlgorithm(e,r)}r(256),r(438),r(16),e.exports=n.aes=n.aes||{},n.aes.startEncrypting=function(e,t,r,n){var i=y({key:e,output:r,decrypt:!1,mode:n});return i.start(t),i},n.aes.createEncryptionCipher=function(e,t){return y({key:e,output:null,decrypt:!1,mode:t})},n.aes.startDecrypting=function(e,t,r,n){var i=y({key:e,output:r,decrypt:!0,mode:n});return i.start(t),i},n.aes.createDecryptionCipher=function(e,t){return y({key:e,output:null,decrypt:!0,mode:t})},n.aes.Algorithm=function(e,t){o||h();var r=this;r.name=e,r.mode=new t({blockSize:16,cipher:{encrypt:function(e,t){return d(r._w,e,t,!1)},decrypt:function(e,t){return d(r._w,e,t,!0)}}}),r._init=!1},n.aes.Algorithm.prototype.initialize=function(e){if(!this._init){var t=e.key,r;if("string"!=typeof t||16!==t.length&&24!==t.length&&32!==t.length){if(n.util.isArray(t)&&(16===t.length||24===t.length||32===t.length)){r=t,t=n.util.createBuffer();for(var i=0;i<r.length;++i)t.putByte(r[i])}}else t=n.util.createBuffer(t);if(!n.util.isArray(t)){r=t,t=[];var o=r.length();if(16===o||24===o||32===o){o>>>=2;for(var i=0;i<o;++i)t.push(r.getInt32())}}if(!n.util.isArray(t)||4!==t.length&&6!==t.length&&8!==t.length)throw new Error("Invalid key parameter.");var s=this.mode.name,a=-1!==["CFB","OFB","CTR","GCM"].indexOf(s);this._w=p(t,e.decrypt&&!a),this._init=!0}},n.aes._expandKey=function(e,t){return o||h(),p(e,t)},n.aes._updateBlock=d,i("AES-ECB",n.cipher.modes.ecb),i("AES-CBC",n.cipher.modes.cbc),i("AES-CFB",n.cipher.modes.cfb),i("AES-OFB",n.cipher.modes.ofb),i("AES-CTR",n.cipher.modes.ctr),i("AES-GCM",n.cipher.modes.gcm);var o=!1,s=4,a,u,c,f,l;function h(){o=!0,c=[0,1,2,4,8,16,32,64,128,27,54];for(var e=new Array(256),t=0;t<128;++t)e[t]=t<<1,e[t+128]=t+128<<1^283;a=new Array(256),u=new Array(256),f=new Array(4),l=new Array(4);for(var t=0;t<4;++t)f[t]=new Array(256),l[t]=new Array(256);for(var r=0,n=0,i,s,h,p,d,y,g,t=0;t<256;++t){p=n^n<<1^n<<2^n<<3^n<<4,p=p>>8^255&p^99,a[r]=p,u[p]=r,d=e[p],i=e[r],s=e[i],h=e[s],y=d<<24^p<<16^p<<8^p^d,g=(i^s^h)<<24^(r^h)<<16^(r^s^h)<<8^r^i^h;for(var m=0;m<4;++m)f[m][r]=y,l[m][p]=g,y=y<<24|y>>>8,g=g<<24|g>>>8;0===r?r=n=1:(r=i^e[e[e[i^h]]],n^=e[e[n]])}}function p(e,t){for(var r=e.slice(0),n,i=1,o=r.length,u=o+6+1,f=s*u,h=o;h<f;++h)n=r[h-1],h%o==0?(n=a[n>>>16&255]<<24^a[n>>>8&255]<<16^a[255&n]<<8^a[n>>>24]^c[i]<<24,i++):o>6&&h%o==4&&(n=a[n>>>24]<<24^a[n>>>16&255]<<16^a[n>>>8&255]<<8^a[255&n]),r[h]=r[h-o]^n;if(t){var p,d=l[0],y=l[1],g=l[2],m=l[3],b=r.slice(0);f=r.length;for(var h=0,v=f-s;h<f;h+=s,v-=s)if(0===h||h===f-s)b[h]=r[v],b[h+1]=r[v+3],b[h+2]=r[v+2],b[h+3]=r[v+1];else for(var _=0;_<s;++_)p=r[v+_],b[h+(3&-_)]=d[a[p>>>24]]^y[a[p>>>16&255]]^g[a[p>>>8&255]]^m[a[255&p]];r=b}return r}function d(e,t,r,n){var i=e.length/4-1,o,s,c,h,p,d,y,g,m,b,v,_;n?(o=l[0],s=l[1],c=l[2],h=l[3],p=u):(o=f[0],s=f[1],c=f[2],h=f[3],p=a),d=t[0]^e[0],y=t[n?3:1]^e[1],g=t[2]^e[2],m=t[n?1:3]^e[3];for(var w=3,S=1;S<i;++S)b=o[d>>>24]^s[y>>>16&255]^c[g>>>8&255]^h[255&m]^e[++w],v=o[y>>>24]^s[g>>>16&255]^c[m>>>8&255]^h[255&d]^e[++w],_=o[g>>>24]^s[m>>>16&255]^c[d>>>8&255]^h[255&y]^e[++w],m=o[m>>>24]^s[d>>>16&255]^c[y>>>8&255]^h[255&g]^e[++w],d=b,y=v,g=_;r[0]=p[d>>>24]<<24^p[y>>>16&255]<<16^p[g>>>8&255]<<8^p[255&m]^e[++w],r[n?3:1]=p[y>>>24]<<24^p[g>>>16&255]<<16^p[m>>>8&255]<<8^p[255&d]^e[++w],r[2]=p[g>>>24]<<24^p[m>>>16&255]<<16^p[d>>>8&255]<<8^p[255&y]^e[++w],r[n?1:3]=p[m>>>24]<<24^p[d>>>16&255]<<16^p[y>>>8&255]<<8^p[255&g]^e[++w]}function y(e){e=e||{};var t=(e.mode||"CBC").toUpperCase(),r="AES-"+t,i;i=e.decrypt?n.cipher.createDecipher(r,e.key):n.cipher.createCipher(r,e.key);var o=i.start;return i.start=function(e,t){var r=null;t instanceof n.util.ByteBuffer&&(r=t,t={}),t=t||{},t.output=r,t.iv=e,o.call(i,t)},i}},function(e,t,r){var n=r(11);n.pki=n.pki||{};var i=e.exports=n.pki.oids=n.oids=n.oids||{};function o(e,t){i[e]=t,i[t]=e}function s(e,t){i[e]=t}o("1.2.840.113549.1.1.1","rsaEncryption"),o("1.2.840.113549.1.1.4","md5WithRSAEncryption"),o("1.2.840.113549.1.1.5","sha1WithRSAEncryption"),o("1.2.840.113549.1.1.7","RSAES-OAEP"),o("1.2.840.113549.1.1.8","mgf1"),o("1.2.840.113549.1.1.9","pSpecified"),o("1.2.840.113549.1.1.10","RSASSA-PSS"),o("1.2.840.113549.1.1.11","sha256WithRSAEncryption"),o("1.2.840.113549.1.1.12","sha384WithRSAEncryption"),o("1.2.840.113549.1.1.13","sha512WithRSAEncryption"),o("1.2.840.10040.4.3","dsa-with-sha1"),o("1.3.14.3.2.7","desCBC"),o("1.3.14.3.2.26","sha1"),o("2.16.840.1.101.3.4.2.1","sha256"),o("2.16.840.1.101.3.4.2.2","sha384"),o("2.16.840.1.101.3.4.2.3","sha512"),o("1.2.840.113549.2.5","md5"),o("1.2.840.113549.1.7.1","data"),o("1.2.840.113549.1.7.2","signedData"),o("1.2.840.113549.1.7.3","envelopedData"),o("1.2.840.113549.1.7.4","signedAndEnvelopedData"),o("1.2.840.113549.1.7.5","digestedData"),o("1.2.840.113549.1.7.6","encryptedData"),o("1.2.840.113549.1.9.1","emailAddress"),o("1.2.840.113549.1.9.2","unstructuredName"),o("1.2.840.113549.1.9.3","contentType"),o("1.2.840.113549.1.9.4","messageDigest"),o("1.2.840.113549.1.9.5","signingTime"),o("1.2.840.113549.1.9.6","counterSignature"),o("1.2.840.113549.1.9.7","challengePassword"),o("1.2.840.113549.1.9.8","unstructuredAddress"),o("1.2.840.113549.1.9.14","extensionRequest"),o("1.2.840.113549.1.9.20","friendlyName"),o("1.2.840.113549.1.9.21","localKeyId"),o("1.2.840.113549.1.9.22.1","x509Certificate"),o("1.2.840.113549.1.12.10.1.1","keyBag"),o("1.2.840.113549.1.12.10.1.2","pkcs8ShroudedKeyBag"),o("1.2.840.113549.1.12.10.1.3","certBag"),o("1.2.840.113549.1.12.10.1.4","crlBag"),o("1.2.840.113549.1.12.10.1.5","secretBag"),o("1.2.840.113549.1.12.10.1.6","safeContentsBag"),o("1.2.840.113549.1.5.13","pkcs5PBES2"),o("1.2.840.113549.1.5.12","pkcs5PBKDF2"),o("1.2.840.113549.1.12.1.1","pbeWithSHAAnd128BitRC4"),o("1.2.840.113549.1.12.1.2","pbeWithSHAAnd40BitRC4"),o("1.2.840.113549.1.12.1.3","pbeWithSHAAnd3-KeyTripleDES-CBC"),o("1.2.840.113549.1.12.1.4","pbeWithSHAAnd2-KeyTripleDES-CBC"),o("1.2.840.113549.1.12.1.5","pbeWithSHAAnd128BitRC2-CBC"),o("1.2.840.113549.1.12.1.6","pbewithSHAAnd40BitRC2-CBC"),o("1.2.840.113549.2.7","hmacWithSHA1"),o("1.2.840.113549.2.8","hmacWithSHA224"),o("1.2.840.113549.2.9","hmacWithSHA256"),o("1.2.840.113549.2.10","hmacWithSHA384"),o("1.2.840.113549.2.11","hmacWithSHA512"),o("1.2.840.113549.3.7","des-EDE3-CBC"),o("2.16.840.1.101.3.4.1.2","aes128-CBC"),o("2.16.840.1.101.3.4.1.22","aes192-CBC"),o("2.16.840.1.101.3.4.1.42","aes256-CBC"),o("2.5.4.3","commonName"),o("2.5.4.5","serialName"),o("2.5.4.6","countryName"),o("2.5.4.7","localityName"),o("2.5.4.8","stateOrProvinceName"),o("2.5.4.10","organizationName"),o("2.5.4.11","organizationalUnitName"),o("2.16.840.1.113730.1.1","nsCertType"),s("2.5.29.1","authorityKeyIdentifier"),s("2.5.29.2","keyAttributes"),s("2.5.29.3","certificatePolicies"),s("2.5.29.4","keyUsageRestriction"),s("2.5.29.5","policyMapping"),s("2.5.29.6","subtreesConstraint"),s("2.5.29.7","subjectAltName"),s("2.5.29.8","issuerAltName"),s("2.5.29.9","subjectDirectoryAttributes"),s("2.5.29.10","basicConstraints"),s("2.5.29.11","nameConstraints"),s("2.5.29.12","policyConstraints"),s("2.5.29.13","basicConstraints"),o("2.5.29.14","subjectKeyIdentifier"),o("2.5.29.15","keyUsage"),s("2.5.29.16","privateKeyUsagePeriod"),o("2.5.29.17","subjectAltName"),o("2.5.29.18","issuerAltName"),o("2.5.29.19","basicConstraints"),s("2.5.29.20","cRLNumber"),s("2.5.29.21","cRLReason"),s("2.5.29.22","expirationDate"),s("2.5.29.23","instructionCode"),s("2.5.29.24","invalidityDate"),s("2.5.29.25","cRLDistributionPoints"),s("2.5.29.26","issuingDistributionPoint"),s("2.5.29.27","deltaCRLIndicator"),s("2.5.29.28","issuingDistributionPoint"),s("2.5.29.29","certificateIssuer"),s("2.5.29.30","nameConstraints"),o("2.5.29.31","cRLDistributionPoints"),o("2.5.29.32","certificatePolicies"),s("2.5.29.33","policyMappings"),s("2.5.29.34","policyConstraints"),o("2.5.29.35","authorityKeyIdentifier"),s("2.5.29.36","policyConstraints"),o("2.5.29.37","extKeyUsage"),s("2.5.29.46","freshestCRL"),s("2.5.29.54","inhibitAnyPolicy"),o("1.3.6.1.4.1.11129.2.4.2","timestampList"),o("1.3.6.1.5.5.7.1.1","authorityInfoAccess"),o("1.3.6.1.5.5.7.3.1","serverAuth"),o("1.3.6.1.5.5.7.3.2","clientAuth"),o("1.3.6.1.5.5.7.3.3","codeSigning"),o("1.3.6.1.5.5.7.3.4","emailProtection"),o("1.3.6.1.5.5.7.3.8","timeStamping")},function(e,t,r){var n=r(499),i=r(43),o=r(143),s=r(192);function a(e){var t=0;return function(r,n,i){t++||e(r,n,i)}}function u(e){return"function"==typeof e}e.exports=function(e,t){u(e)&&(t=e,e={}),t=a(t||function e(){});var r=n(e&&e.timeout||5e3),c=i(function(e){e&&t(e)}),f=s();return{handshake:{read:r.read,abort:function(e){c.end(e),r.abort(e,function(e){}),t(e)},write:c.push,rest:function(){return c.end(),{source:r.read(),sink:f.sink}}},sink:r,source:o([c,f.source])}}},function(e,t,r){const n=r(36),i=r(81),o=r(151),s=r(1)("dweb-transports");class a{constructor(e){}static _connected(){return this._transports.filter(e=>!e.status)}static async p_connectedNames(){return this._connected().map(e=>e.name)}static async p_connectedNamesParm(){return(await this.p_connectedNames()).map(e=>"transport="+e).join("&")}static async p_statuses(){return this._transports.map(e=>({name:e.name,status:e.status}))}static validFor(e,t,r){return e&&e[0]||["store","newlisturls","newdatabase","newtable"].includes(t)?e&&e.length>0?[].concat(...e.map(e=>"string"==typeof e?n.parse(e):e).map(e=>this._connected().filter(r=>r.supports(e,t)).map(t=>[e,t]))):this._connected().filter(e=>e.supports(void 0,t)).map(e=>[void 0,e]):(console.error("Transports.validFor called with invalid arguments: urls=",e,"func=",t),[])}static async p_urlsValidFor(e,t,r){return this.validFor(e,t,r).map(e=>e[0])}static http(){return a._connected().find(e=>"HTTP"===e.name)}static ipfs(){return a._connected().find(e=>"IPFS"===e.name)}static webtorrent(){return a._connected().find(e=>"WEBTORRENT"===e.name)}static gun(){return a._connected().find(e=>"GUN"===e.name)}static async p_resolveNames(e){return this.namingcb?await this.namingcb(e):e}static resolveNamesWith(e){this.namingcb=e}static async _p_rawstore(e,t){let r=[],n=await Promise.all(e.map(async function(e){try{s("Storing %d bytes to %s",t.length,e.name);let n=await e.p_rawstore(t);return s("Storing %d bytes to %s succeeded: %s",t.length,e.name,n),n}catch(n){return s("Storing %d bytes to %s failed: %s",t.length,e.name,n.message),void r.push(n)}}));if(n=n.filter(e=>!!e),!n.length)throw s("Storing %d bytes failed on all transports",t.length),new i.TransportError(r.map(e=>e.message).join(", "));return n}static async p_rawstore(e){let t=this.validFor(void 0,"store").map(([e,t])=>t);if(!t.length)throw s("Storing %d bytes failed: no transports available",e.length),new i.TransportError("Transports.p_rawstore: Cant find transport for store");return this._p_rawstore(t,e)}static async p_rawlist(e){e=await this.p_resolveNames(e);let t=this.validFor(e,"list");if(!t.length)throw new i.TransportError('Transports.p_rawlist: Cant find transport to "list" urls:'+e.join(","));let r=[],n=await Promise.all(t.map(async function([e,t]){try{s("Listing %s via %s",e,t.name);let n=await t.p_rawlist(e);return s("Listing %s via %s retrieved %d items",e,t.name,n.length),n}catch(n){return s("Listing %s via %s failed: %s",e,t.name,n.message),r.push(n),[]}}));if(r.length>=t.length)throw s("Listing %o failed on all transports",e),new i.TransportError(r.map(e=>e.message).join(", "));let o={};return[].concat(...n).filter(e=>!o[e.signature]&&(o[e.signature]=!0))}static async p_rawfetch(e,t={}){if(!e.length)throw new i.TransportError("Transports.p_rawfetch given an empty list of urls");let r=await this.p_resolveNames(e);if(!r.length)throw new i.TransportError("Transports.p_rawfetch none of the urls resolved: "+e);let n=this.validFor(r,"fetch");if(!n.length)throw new i.TransportError("Transports.p_rawfetch cant find any transport for urls: "+r);let o=[],a=[];for(const[e,r]of n)try{s("Fetching %s via %s",e.href,r.name);let n=await r.p_rawfetch(e,t);return s("Fetching %s via %s succeeded %d bytes",e.href,r.name,n.length),t.relay&&a.length&&(s("Fetching attempting relay of %d bytes from %s to %o",n.length,e.href,a.map(e=>e.name)),this._p_rawstore(a,n).then(e=>s("Fetching relayed %d bytes to %o",n.length,e))),n}catch(t){a.push(r),o.push(t),s("Fetching %s via %s failed: %s",e.href,r.name,t.message)}throw s("Fetching %o failed on all transports",e),new i.TransportError(o.map(e=>e.message).join(", "))}static async p_rawadd(e,t){e=await this.p_resolveNames(e);let r=this.validFor(e,"add");if(!r.length)throw s("Adding to %o failed: no transports available",e),new i.TransportError("Transports.p_rawstore: Cant find transport for urls:"+e.join(","));let n=[];if(await Promise.all(r.map(async function([e,r]){try{return s("Adding to %s via %s",e,r.name),await r.p_rawadd(e,t),void s("Adding to %s via %s succeeded",e,r.name)}catch(t){return s("Adding to %s via %s failed: %s",e,r.name,t.message),void n.push(t)}})),n.length>=r.length)throw s("Adding to %o failed on all transports",e),new i.TransportError(n.map(e=>e.message).join(", "))}static listmonitor(e,t,r={}){this.validFor(e,"listmonitor").map(([e,n])=>{n.listmonitor(e,t,r),s("Monitoring list %s via %s",e,n.name)})}static async p_newlisturls(e){let t=await Promise.all(this.validFor(void 0,"newlisturls").map(([t,r])=>r.p_newlisturls(e)));return[t.map(e=>e[0]),t.map(e=>e[1])]}static async p_f_createReadStream(e,{wanturl:t=!1}={}){let r=this.validFor(e,"createReadStream",{});if(!r.length)throw s("Opening stream to %o failed: no transports available",e),new i.TransportError("Transports.p_createReadStream cant find any transport for urls: "+e);let n=[],o;for(;(o=r.splice(Math.floor(Math.random()*r.length),1)).length;){let e=o[0][0],r=o[0][1];try{s("Opening stream to %s via %s",e.href,r.name);let i=await r.p_f_createReadStream(e,{wanturl:t});return s("Opening stream to %s via %s succeeded",e.href,r.name),i}catch(t){n.push(t),s("Opening stream to %s via %s failed: %s",e.href,r.name,t.message)}}throw s("Opening stream to %o failed on all transports",e),new i.TransportError(n.map(e=>e.message).join(", "))}static async p_get(e,t){let r=this.validFor(e,"get"),n=Array.isArray(t)?`${t.length} keys`:t;if(!r.length)throw s("Getting %s from %o failed: no transports available",n,e),new i.TransportError("Transports.p_get cant find any transport to get keys from urls: "+e);let o=[];for(const[e,i]of r)try{s("Getting %s from %s via %s",n,e.href,i.name);let r=await i.p_get(e,t);return s("Getting %s from %s via %s succeeded length=%d",n,e.href,i.name,r.length),r}catch(t){o.push(t),s("Getting %s from %s via %s failed: %s",n,e.href,i.name,t.message)}throw s("Getting %s from %o failed on all transports",n,e),new i.TransportError(o.map(e=>e.message).join(", "))}static async p_set(e,t,r){e=await this.p_resolveNames(e);let n="object"==typeof t?`${t.length} keys`:t,o=this.validFor(e,"set");if(!o.length)throw s("Setting %s on %o failed: no transports available",n,e),new i.TransportError("Transports.p_set cant find any transport for urls: "+e);let a=[],u=!1;if(await Promise.all(o.map(async function([e,i]){try{s("Setting %s on %s via %s",n,e.href,i.name),await i.p_set(e,t,r),s("Setting %s on %s via %s succeeded",n,e.href,i.name),u=!0}catch(t){s("Setting %s on %s via %s failed: %s",n,e.href,i.name,t.message),a.push(t)}})),!u)throw s("Setting %s on %o failed on all transports",n,e),new i.TransportError(a.map(e=>e.message).join(", "))}static async p_delete(e,t){e=await this.p_resolveNames(e);let r=Array.isArray(t)?`${t.length} keys`:t,n=this.validFor(e,"set");if(!n.length)throw s("Deleting %s on %o failed: no transports available",r,e),new i.TransportError("Transports.p_set cant find any transport for urls: "+e);let o=[],a=!1;if(await Promise.all(n.map(async function([e,n]){try{s("Deleting %s on %s via %s",r,e.href,n.name),await n.p_delete(e,t),s("Deleting %s on %s via %s succeeded",r,e.href,n.name),a=!0}catch(t){s("Deleting %s on %s via %s failed: %s",r,e.href,n.name,t.message),o.push(t)}})),!a)throw s("Deleting %s on %o failed on all transports",r,e),new i.TransportError(o.map(e=>e.message).join(", "))}static async p_keys(e){e=await this.p_resolveNames(e);let t=this.validFor(e,"keys");if(!t.length)throw s("Getting all keys on %o failed: no transports available",e),new i.TransportError("Transports.p_keys cant find any transport for urls: "+e);let r=[];for(const[e,n]of t)try{s("Getting all keys on %s via %s",e.href,n.name);let t=await n.p_keys(e);return s("Getting all keys on %s via %s succeeded with %d keys",e.href,n.name,t.length),t}catch(t){r.push(t),s("Getting all keys on %s via %s failed: %s",e.href,n.name,t.message)}throw s("Getting all keys on %o failed on all transports",e),new i.TransportError(r.map(e=>e.message).join(", "))}static async p_getall(e){e=await this.p_resolveNames(e);let t=this.validFor(e,"getall");if(!t.length)throw s("Getting all values on %o failed: no transports available",e),new i.TransportError("Transports.p_getall cant find any transport for urls: "+e);let r=[];for(const[e,n]of t)try{s("Getting all values on %s via %s",e.href,n.name);let t=await n.p_getall(e);return s("Getting all values on %s via %s succeeded with %d values",e.href,n.name,t.length),t}catch(t){r.push(t),s("Getting all values on %s via %s failed: %s",e.href,n.name,t.message)}throw s("Getting all keys on %o failed on all transports",e),new i.TransportError(r.map(e=>e.message).join(", "))}static async p_newdatabase(e){let t=await Promise.all(this.validFor(void 0,"newdatabase").map(([t,r])=>r.p_newdatabase(e)));return{privateurls:t.map(e=>e.privateurl),publicurls:t.map(e=>e.publicurl)}}static async p_newtable(e,t){let r=await Promise.all(this.validFor(void 0,"newtable").map(([r,n])=>n.p_newtable(e,t)));return{privateurls:r.map(e=>e.privateurl),publicurls:r.map(e=>e.publicurl)}}static async p_connection(e){e=await this.p_resolveNames(e),await Promise.all(this.validFor(e,"connection").map(([e,t])=>t.p_connection(e)))}static monitor(e,t,{current:r=!1}={}){this.validFor(e,"monitor").map(([e,n])=>{s("Monitoring table %s via %s",e,n.name),n.monitor(e,t,{current:r})})}static addtransport(e){a._transports.push(e)}static setup0(e,t,r){let n={http:{urlbase:"http://localhost:4244"}};return e.map(e=>{let r=this._transportclasses["LOCAL"===e?"HTTP":e];return r?(s("Setting up connection to %s with options %o",e,t),r.setup0("LOCAL"===e?n:t)):void s("Connection to %s unavailable",e)}).filter(e=>!!e)}static async p_setup1(e){await Promise.all(this._transports.filter(e=>!this._optionspaused.includes(e.name)).map(t=>(s("Connection stage 1 to %s",t.name),t.p_setup1(e))))}static async p_setup2(e){await Promise.all(this._transports.filter(e=>!this._optionspaused.includes(e.name)).map(t=>(s("Connection stage 2 to %s",t.name),t.p_setup2(e))))}static async refreshstatus(e){let t=["transportstatus0","transportstatus1","transportstatus2","transportstatus3","transportstatus4"],r=e.statuselement;r&&(r.classList.remove(...t),r.classList.add(t[e.status])),a.statuscb&&a.statuscb(e)}static async p_connect(e){try{e=e||{};let t=e.transports;this._optionspaused=(e.paused||[]).map(e=>e.toUpperCase()),t&&t.length||(t=e.defaulttransports||[]),t.length||(t=["HTTP","YJS","IPFS","WEBTORRENT","GUN"]),t=t.map(e=>e.toUpperCase());let r=this.setup0(t,e);if(e.statuscb&&(this.statuscb=e.statuscb),e.statuselement){let t=e.statuselement;for(;t.lastChild;)t.removeChild(t.lastChild);t.appendChild(o.createElement("UL",{},r.map(e=>{let t=o.createElement("LI",{onclick:"this.source.togglePaused(DwebTransports.refreshstatus);",source:e,name:e.name},e.name);return e.statuselement=t,t})))}await this.p_setup1(this.refreshstatus),await this.p_setup2(this.refreshstatus),s("Connection completed to %o",this._connected().map(e=>e.name))}catch(e){throw console.error("ERROR in p_connect:",e.message),e}}static async p_urlsFrom(e){if("string"==typeof e&&(e="["===e[0]?JSON.parse(e):e.includes(",")?e.split(","):[e]),!Array.isArray(e))throw new Error(`Unparsable url: ${e}`);return e}static async p_httpfetchurl(e){return a.http()._url(e.find(e=>e.startsWith("contenthash")||e.startsWith("http")),"content/rawfetch")}static async test(){console.log("Transports.test")}}a._transports=[],a.namingcb=void 0,a._transportclasses={},t=e.exports=a},function(e,t,r){"use strict";function n(e,t){t|=0;for(var r=Math.max(e.length-t,0),n=Array(r),i=0;i<r;i++)n[i]=e[t+i];return n}Object.defineProperty(t,"__esModule",{value:!0}),t.default=n,e.exports=t.default},function(e,t,r){"use strict";function n(e){return function(){if(null===e)throw new Error("Callback was already called.");var t=e;e=null,t.apply(this,arguments)}}Object.defineProperty(t,"__esModule",{value:!0}),t.default=n,e.exports=t.default},function(e,t,r){(function(e,n){var i=/%[sdj%]/g;t.format=function(e){if(!S(e)){for(var t=[],r=0;r<arguments.length;r++)t.push(a(arguments[r]));return t.join(" ")}for(var r=1,n=arguments,o=n.length,s=String(e).replace(i,function(e){if("%%"===e)return"%";if(r>=o)return e;switch(e){case"%s":return String(n[r++]);case"%d":return Number(n[r++]);case"%j":try{return JSON.stringify(n[r++])}catch(e){return"[Circular]"}default:return e}}),u=n[r];r<o;u=n[++r])v(u)||!x(u)?s+=" "+u:s+=" "+a(u);return s},t.deprecate=function(r,i){if(E(e.process))return function(){return t.deprecate(r,i).apply(this,arguments)};if(!0===n.noDeprecation)return r;var o=!1;function s(){if(!o){if(n.throwDeprecation)throw new Error(i);n.traceDeprecation?console.trace(i):console.error(i),o=!0}return r.apply(this,arguments)}return s};var o={},s;function a(e,r){var n={seen:[],stylize:c};return arguments.length>=3&&(n.depth=arguments[2]),arguments.length>=4&&(n.colors=arguments[3]),b(r)?n.showHidden=r:r&&t._extend(n,r),E(n.showHidden)&&(n.showHidden=!1),E(n.depth)&&(n.depth=2),E(n.colors)&&(n.colors=!1),E(n.customInspect)&&(n.customInspect=!0),n.colors&&(n.stylize=u),l(n,e,n.depth)}function u(e,t){var r=a.styles[t];return r?"["+a.colors[r][0]+"m"+e+"["+a.colors[r][1]+"m":e}function c(e,t){return e}function f(e){var t={};return e.forEach(function(e,r){t[e]=!0}),t}function l(e,r,n){if(e.customInspect&&r&&B(r.inspect)&&r.inspect!==t.inspect&&(!r.constructor||r.constructor.prototype!==r)){var i=r.inspect(n,e);return S(i)||(i=l(e,i,n)),i}var o=h(e,r);if(o)return o;var s=Object.keys(r),a=f(s);if(e.showHidden&&(s=Object.getOwnPropertyNames(r)),T(r)&&(s.indexOf("message")>=0||s.indexOf("description")>=0))return p(r);if(0===s.length){if(B(r)){var u=r.name?": "+r.name:"";return e.stylize("[Function"+u+"]","special")}if(A(r))return e.stylize(RegExp.prototype.toString.call(r),"regexp");if(I(r))return e.stylize(Date.prototype.toString.call(r),"date");if(T(r))return p(r)}var c="",b=!1,v=["{","}"],_;if(m(r)&&(b=!0,v=["[","]"]),B(r)){var w=r.name?": "+r.name:"";c=" [Function"+w+"]"}return A(r)&&(c=" "+RegExp.prototype.toString.call(r)),I(r)&&(c=" "+Date.prototype.toUTCString.call(r)),T(r)&&(c=" "+p(r)),0!==s.length||b&&0!=r.length?n<0?A(r)?e.stylize(RegExp.prototype.toString.call(r),"regexp"):e.stylize("[Object]","special"):(e.seen.push(r),_=b?d(e,r,n,a,s):s.map(function(t){return y(e,r,n,a,t,b)}),e.seen.pop(),g(_,c,v)):v[0]+c+v[1]}function h(e,t){if(E(t))return e.stylize("undefined","undefined");if(S(t)){var r="'"+JSON.stringify(t).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return e.stylize(r,"string")}return w(t)?e.stylize(""+t,"number"):b(t)?e.stylize(""+t,"boolean"):v(t)?e.stylize("null","null"):void 0}function p(e){return"["+Error.prototype.toString.call(e)+"]"}function d(e,t,r,n,i){for(var o=[],s=0,a=t.length;s<a;++s)L(t,String(s))?o.push(y(e,t,r,n,String(s),!0)):o.push("");return i.forEach(function(i){i.match(/^\d+$/)||o.push(y(e,t,r,n,i,!0))}),o}function y(e,t,r,n,i,o){var s,a,u;if(u=Object.getOwnPropertyDescriptor(t,i)||{value:t[i]},u.get?a=u.set?e.stylize("[Getter/Setter]","special"):e.stylize("[Getter]","special"):u.set&&(a=e.stylize("[Setter]","special")),L(n,i)||(s="["+i+"]"),a||(e.seen.indexOf(u.value)<0?(a=v(r)?l(e,u.value,null):l(e,u.value,r-1),a.indexOf("\n")>-1&&(a=o?a.split("\n").map(function(e){return" "+e}).join("\n").substr(2):"\n"+a.split("\n").map(function(e){return" "+e}).join("\n"))):a=e.stylize("[Circular]","special")),E(s)){if(o&&i.match(/^\d+$/))return a;s=JSON.stringify(""+i),s.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(s=s.substr(1,s.length-2),s=e.stylize(s,"name")):(s=s.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),s=e.stylize(s,"string"))}return s+": "+a}function g(e,t,r){var n=0,i=e.reduce(function(e,t){return n++,t.indexOf("\n")>=0&&n++,e+t.replace(/\u001b\[\d\d?m/g,"").length+1},0);return i>60?r[0]+(""===t?"":t+"\n ")+" "+e.join(",\n ")+" "+r[1]:r[0]+t+" "+e.join(", ")+" "+r[1]}function m(e){return Array.isArray(e)}function b(e){return"boolean"==typeof e}function v(e){return null===e}function _(e){return null==e}function w(e){return"number"==typeof e}function S(e){return"string"==typeof e}function k(e){return"symbol"==typeof e}function E(e){return void 0===e}function A(e){return x(e)&&"[object RegExp]"===P(e)}function x(e){return"object"==typeof e&&null!==e}function I(e){return x(e)&&"[object Date]"===P(e)}function T(e){return x(e)&&("[object Error]"===P(e)||e instanceof Error)}function B(e){return"function"==typeof e}function C(e){return null===e||"boolean"==typeof e||"number"==typeof e||"string"==typeof e||"symbol"==typeof e||void 0===e}function P(e){return Object.prototype.toString.call(e)}function O(e){return e<10?"0"+e.toString(10):e.toString(10)}t.debuglog=function(e){if(E(s)&&(s=n.env.NODE_DEBUG||""),e=e.toUpperCase(),!o[e])if(new RegExp("\\b"+e+"\\b","i").test(s)){var r=n.pid;o[e]=function(){var n=t.format.apply(t,arguments);console.error("%s %d: %s",e,r,n)}}else o[e]=function(){};return o[e]},t.inspect=a,a.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},a.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"},t.isArray=m,t.isBoolean=b,t.isNull=v,t.isNullOrUndefined=_,t.isNumber=w,t.isString=S,t.isSymbol=k,t.isUndefined=E,t.isRegExp=A,t.isObject=x,t.isDate=I,t.isError=T,t.isFunction=B,t.isPrimitive=C,t.isBuffer=r(676);var R=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function N(){var e=new Date,t=[O(e.getHours()),O(e.getMinutes()),O(e.getSeconds())].join(":");return[e.getDate(),R[e.getMonth()],t].join(" ")}function L(e,t){return Object.prototype.hasOwnProperty.call(e,t)}t.log=function(){console.log("%s - %s",N(),t.format.apply(t,arguments))},t.inherits=r(4),t._extend=function(e,t){if(!t||!x(t))return e;for(var r=Object.keys(t),n=r.length;n--;)e[r[n]]=t[r[n]];return e}}).call(this,r(7),r(6))},function(e,t,r){var n;!function(i){"use strict";var o,s=20,a=1,u=1e6,c=1e6,f=-7,l=21,h="[big.js] ",p=h+"Invalid ",d=p+"decimal places",y=p+"rounding mode",g=h+"Division by zero",m={},b=void 0,v=/^-?(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i;function _(){function e(t){var r=this;if(!(r instanceof e))return t===b?_():new e(t);t instanceof e?(r.s=t.s,r.e=t.e,r.c=t.c.slice()):w(r,t),r.constructor=e}return e.prototype=m,e.DP=s,e.RM=a,e.NE=f,e.PE=l,e.version="5.0.2",e}function w(e,t){var r,n,i;if(0===t&&1/t<0)t="-0";else if(!v.test(t+=""))throw Error(p+"number");for(e.s="-"==t.charAt(0)?(t=t.slice(1),-1):1,(r=t.indexOf("."))>-1&&(t=t.replace(".","")),(n=t.search(/e/i))>0?(r<0&&(r=n),r+=+t.slice(n+1),t=t.substring(0,n)):r<0&&(r=t.length),i=t.length,n=0;n<i&&"0"==t.charAt(n);)++n;if(n==i)e.c=[e.e=0];else{for(;i>0&&"0"==t.charAt(--i););for(e.e=r-n-1,e.c=[],r=0;n<=i;)e.c[r++]=+t.charAt(n++)}return e}function S(e,t,r,n){var i=e.c,o=e.e+t+1;if(o<i.length){if(1===r)n=i[o]>=5;else if(2===r)n=i[o]>5||5==i[o]&&(n||o<0||i[o+1]!==b||1&i[o-1]);else if(3===r)n=n||i[o]!==b||o<0;else if(n=!1,0!==r)throw Error(y);if(o<1)i.length=1,n?(e.e=-t,i[0]=1):i[0]=e.e=0;else{if(i.length=o--,n)for(;++i[o]>9;)i[o]=0,o--||(++e.e,i.unshift(1));for(o=i.length;!i[--o];)i.pop()}}else if(r<0||r>3||r!==~~r)throw Error(y);return e}function k(e,t,r,n){var i,o,s=e.constructor,a=!e.c[0];if(r!==b){if(r!==~~r||r<(3==t)||r>u)throw Error(3==t?p+"precision":d);for(e=new s(e),r=n-e.e,e.c.length>++n&&S(e,r,s.RM),2==t&&(n=e.e+r+1);e.c.length<n;)e.c.push(0)}if(i=e.e,o=e.c.join(""),r=o.length,2!=t&&(1==t||3==t&&n<=i||i<=s.NE||i>=s.PE))o=o.charAt(0)+(r>1?"."+o.slice(1):"")+(i<0?"e":"e+")+i;else if(i<0){for(;++i;)o="0"+o;o="0."+o}else if(i>0)if(++i>r)for(i-=r;i--;)o+="0";else i<r&&(o=o.slice(0,i)+"."+o.slice(i));else r>1&&(o=o.charAt(0)+"."+o.slice(1));return e.s<0&&(!a||4==t)?"-"+o:o}m.abs=function(){var e=new this.constructor(this);return e.s=1,e},m.cmp=function(e){var t,r=this,n=r.c,i=(e=new r.constructor(e)).c,o=r.s,s=e.s,a=r.e,u=e.e;if(!n[0]||!i[0])return n[0]?o:i[0]?-s:0;if(o!=s)return o;if(t=o<0,a!=u)return a>u^t?1:-1;for(s=(a=n.length)<(u=i.length)?a:u,o=-1;++o<s;)if(n[o]!=i[o])return n[o]>i[o]^t?1:-1;return a==u?0:a>u^t?1:-1},m.div=function(e){var t=this,r=t.constructor,n=t.c,i=(e=new r(e)).c,o=t.s==e.s?1:-1,s=r.DP;if(s!==~~s||s<0||s>u)throw Error(d);if(!i[0])throw Error(g);if(!n[0])return new r(0*o);var a,c,f,l,h,p=i.slice(),y=a=i.length,m=n.length,v=n.slice(0,a),_=v.length,w=e,k=w.c=[],E=0,A=s+(w.e=t.e-e.e)+1;for(w.s=o,o=A<0?0:A,p.unshift(0);_++<a;)v.push(0);do{for(f=0;f<10;f++){if(a!=(_=v.length))l=a>_?1:-1;else for(h=-1,l=0;++h<a;)if(i[h]!=v[h]){l=i[h]>v[h]?1:-1;break}if(!(l<0))break;for(c=_==a?i:p;_;){if(v[--_]<c[_]){for(h=_;h&&!v[--h];)v[h]=9;--v[h],v[_]+=10}v[_]-=c[_]}for(;!v[0];)v.shift()}k[E++]=l?f:++f,v[0]&&l?v[_]=n[y]||0:v=[n[y]]}while((y++<m||v[0]!==b)&&o--);return k[0]||1==E||(k.shift(),w.e--),E>A&&S(w,s,r.RM,v[0]!==b),w},m.eq=function(e){return!this.cmp(e)},m.gt=function(e){return this.cmp(e)>0},m.gte=function(e){return this.cmp(e)>-1},m.lt=function(e){return this.cmp(e)<0},m.lte=function(e){return this.cmp(e)<1},m.minus=m.sub=function(e){var t,r,n,i,o=this,s=o.constructor,a=o.s,u=(e=new s(e)).s;if(a!=u)return e.s=-u,o.plus(e);var c=o.c.slice(),f=o.e,l=e.c,h=e.e;if(!c[0]||!l[0])return l[0]?(e.s=-u,e):new s(c[0]?o:0);if(a=f-h){for((i=a<0)?(a=-a,n=c):(h=f,n=l),n.reverse(),u=a;u--;)n.push(0);n.reverse()}else for(r=((i=c.length<l.length)?c:l).length,a=u=0;u<r;u++)if(c[u]!=l[u]){i=c[u]<l[u];break}if(i&&(n=c,c=l,l=n,e.s=-e.s),(u=(r=l.length)-(t=c.length))>0)for(;u--;)c[t++]=0;for(u=t;r>a;){if(c[--r]<l[r]){for(t=r;t&&!c[--t];)c[t]=9;--c[t],c[r]+=10}c[r]-=l[r]}for(;0===c[--u];)c.pop();for(;0===c[0];)c.shift(),--h;return c[0]||(e.s=1,c=[h=0]),e.c=c,e.e=h,e},m.mod=function(e){var t,r=this,n=r.constructor,i=r.s,o=(e=new n(e)).s;if(!e.c[0])throw Error(g);return r.s=e.s=1,t=1==e.cmp(r),r.s=i,e.s=o,t?new n(r):(i=n.DP,o=n.RM,n.DP=n.RM=0,r=r.div(e),n.DP=i,n.RM=o,this.minus(r.times(e)))},m.plus=m.add=function(e){var t,r=this,n=r.constructor,i=r.s,o=(e=new n(e)).s;if(i!=o)return e.s=-o,r.minus(e);var s=r.e,a=r.c,u=e.e,c=e.c;if(!a[0]||!c[0])return c[0]?e:new n(a[0]?r:0*i);if(a=a.slice(),i=s-u){for(i>0?(u=s,t=c):(i=-i,t=a),t.reverse();i--;)t.push(0);t.reverse()}for(a.length-c.length<0&&(t=c,c=a,a=t),i=c.length,o=0;i;a[i]%=10)o=(a[--i]=a[i]+c[i]+o)/10|0;for(o&&(a.unshift(o),++u),i=a.length;0===a[--i];)a.pop();return e.c=a,e.e=u,e},m.pow=function(e){var t=this,r=new t.constructor(1),n=r,i=e<0;if(e!==~~e||e<-1e6||e>1e6)throw Error(p+"exponent");for(i&&(e=-e);1&e&&(n=n.times(t)),e>>=1,e;)t=t.times(t);return i?r.div(n):n},m.round=function(e,t){var r=this.constructor;if(e===b)e=0;else if(e!==~~e||e<0||e>u)throw Error(d);return S(new r(this),e,t===b?r.RM:t)},m.sqrt=function(){var e,t,r,n=this,i=n.constructor,o=n.s,s=n.e,a=new i(.5);if(!n.c[0])return new i(n);if(o<0)throw Error(h+"No square root");o=Math.sqrt(n.toString()),0===o||o===1/0?(t=n.c.join(""),t.length+s&1||(t+="0"),e=new i(Math.sqrt(t).toString()),e.e=((s+1)/2|0)-(s<0||1&s)):e=new i(o.toString()),s=e.e+(i.DP+=4);do{r=e,e=a.times(r.plus(n.div(r)))}while(r.c.slice(0,s).join("")!==e.c.slice(0,s).join(""));return S(e,i.DP-=4,i.RM)},m.times=m.mul=function(e){var t,r=this,n=r.constructor,i=r.c,o=(e=new n(e)).c,s=i.length,a=o.length,u=r.e,c=e.e;if(e.s=r.s==e.s?1:-1,!i[0]||!o[0])return new n(0*e.s);for(e.e=u+c,s<a&&(t=i,i=o,o=t,c=s,s=a,a=c),t=new Array(c=s+a);c--;)t[c]=0;for(u=a;u--;){for(a=0,c=s+u;c>u;)a=t[c]+o[u]*i[c-u-1]+a,t[c--]=a%10,a=a/10|0;t[c]=(t[c]+a)%10}for(a?++e.e:t.shift(),u=t.length;!t[--u];)t.pop();return e.c=t,e},m.toExponential=function(e){return k(this,1,e,e)},m.toFixed=function(e){return k(this,2,e,this.e+e)},m.toPrecision=function(e){return k(this,3,e,e-1)},m.toString=function(){return k(this)},m.valueOf=m.toJSON=function(){return k(this,4)},o=_(),o.default=o.Big=o,n=function(){return o}.call(t,r,t,e),void 0===n||(e.exports=n)}(this)},function(e,t,r){var n=r(127);function i(e){return n("rmd160").update(e).digest()}function o(e){return n("sha1").update(e).digest()}function s(e){return n("sha256").update(e).digest()}function a(e){return i(s(e))}function u(e){return s(s(e))}e.exports={hash160:a,hash256:u,ripemd160:i,sha1:o,sha256:s}},function(e,t,r){var n=r(2).Buffer;function i(e,t){this._block=n.alloc(e),this._finalSize=t,this._blockSize=e,this._len=0}i.prototype.update=function(e,t){"string"==typeof e&&(t=t||"utf8",e=n.from(e,t));for(var r=this._block,i=this._blockSize,o=e.length,s=this._len,a=0;a<o;){for(var u=s%i,c=Math.min(o-a,i-u),f=0;f<c;f++)r[u+f]=e[a+f];s+=c,a+=c,s%i==0&&this._update(r)}return this._len+=o,this},i.prototype.digest=function(e){var t=this._len%this._blockSize;this._block[t]=128,this._block.fill(0,t+1),t>=this._finalSize&&(this._update(this._block),this._block.fill(0));var r=8*this._len;if(r<=4294967295)this._block.writeUInt32BE(r,this._blockSize-4);else{var n=(4294967295&r)>>>0,i=(r-n)/4294967296;this._block.writeUInt32BE(i,this._blockSize-8),this._block.writeUInt32BE(n,this._blockSize-4)}this._update(this._block);var o=this._hash();return e?o.toString(e):o},i.prototype._update=function(){throw new Error("_update must be implemented by subclass")},e.exports=i},function(e,t,r){"use strict";(function(t,n){function i(){throw new Error("Secure random number generation is not supported by this browser.\nUse Chrome, Firefox or Internet Explorer 11")}var o=r(2).Buffer,s=t.crypto||t.msCrypto;function a(e,r){if(e>65536)throw new Error("requested too many random bytes");var i=new t.Uint8Array(e);e>0&&s.getRandomValues(i);var a=o.from(i.buffer);return"function"==typeof r?n.nextTick(function(){r(null,a)}):a}s&&s.getRandomValues?e.exports=a:e.exports=i}).call(this,r(7),r(6))},function(e,t,r){"use strict";(function(t){var n=r(34),i=r(24),o=r(66).curves.secp256k1,s=o.curve.point.bind(o.curve),a=o.curve.pointFromX.bind(o.curve),u=function e(t,r,n){var i=s(t,r,n);return i.validate(),i};u.prototype=Object.getPrototypeOf(o.curve.point()),u.fromX=function e(t,r){var n=a(t,r);return n.validate(),n},u.getG=function e(){return o.curve.g},u.getN=function e(){return new n(o.curve.n.toArray())},u.prototype._getX=u.prototype.getX,u.prototype.getX=function e(){return new n(this._getX().toArray())},u.prototype._getY=u.prototype.getY,u.prototype.getY=function e(){return new n(this._getY().toArray())},u.prototype.validate=function e(){if(this.isInfinity())throw new Error("Point cannot be equal to Infinity");if(0===this.getX().cmp(n.Zero)||0===this.getY().cmp(n.Zero))throw new Error("Invalid x,y value for curve, cannot equal 0.");var t=a(this.getY().isOdd(),this.getX());if(0!==t.y.cmp(this.y))throw new Error("Invalid y value for curve.");var r=this.getX().gt(n.Minus1)&&this.getX().lt(u.getN()),i=this.getY().gt(n.Minus1)&&this.getY().lt(u.getN());if(!r||!i)throw new Error("Point does not lie on the curve");if(!this.mul(u.getN()).isInfinity())throw new Error("Point times N must be infinity");return this},u.pointToCompressed=function e(r){var n=r.getX().toBuffer({size:32}),o=r.getY().toBuffer({size:32}),s,a=o[o.length-1]%2;return s=new t(a?[3]:[2]),i.concat([s,n])},e.exports=u}).call(this,r(0).Buffer)},function(e,t,r){var n=t;n.utils=r(857),n.common=r(858),n.sha=r(859),n.ripemd=r(860),n.hmac=r(861),n.sha1=n.sha.sha1,n.sha256=n.sha.sha256,n.sha224=n.sha.sha224,n.sha384=n.sha.sha384,n.sha512=n.sha.sha512,n.ripemd160=n.ripemd.ripemd160},function(e,t,r){"use strict";const n=r(430),i=r(884),o=r(895);t=e.exports,t.aes=i,t.hmac=n,t.keys=o,t.randomBytes=r(466),t.pbkdf2=r(935)},function(e,t,r){var n=r(11);r(16);var i=e.exports=n.pem=n.pem||{};function o(e){for(var t=e.name+": ",r=[],n=function(e,t){return" "+t},i=0;i<e.values.length;++i)r.push(e.values[i].replace(/^(\S+\r\n)/,n));t+=r.join(",")+"\r\n";for(var o=0,s=-1,i=0;i<t.length;++i,++o)if(o>65&&-1!==s){var a=t[s];","===a?(++s,t=t.substr(0,s)+"\r\n "+t.substr(s)):t=t.substr(0,s)+"\r\n"+a+t.substr(s+1),o=i-s-1,s=-1,++i}else" "!==t[i]&&"\t"!==t[i]&&","!==t[i]||(s=i);return t}function s(e){return e.replace(/^\s+/,"")}i.encode=function(e,t){t=t||{};var r="-----BEGIN "+e.type+"-----\r\n",i;if(e.procType&&(i={name:"Proc-Type",values:[String(e.procType.version),e.procType.type]},r+=o(i)),e.contentDomain&&(i={name:"Content-Domain",values:[e.contentDomain]},r+=o(i)),e.dekInfo&&(i={name:"DEK-Info",values:[e.dekInfo.algorithm]},e.dekInfo.parameters&&i.values.push(e.dekInfo.parameters),r+=o(i)),e.headers)for(var s=0;s<e.headers.length;++s)r+=o(e.headers[s]);return e.procType&&(r+="\r\n"),r+=n.util.encode64(e.body,t.maxline||64)+"\r\n",r+="-----END "+e.type+"-----\r\n",r},i.decode=function(e){for(var t=[],r=/\s*-----BEGIN ([A-Z0-9- ]+)-----\r?\n?([\x21-\x7e\s]+?(?:\r?\n\r?\n))?([:A-Za-z0-9+\/=\s]+?)-----END \1-----/g,i=/([\x21-\x7e]+):\s*([\x21-\x7e\s^:]+)/,o=/\r?\n/,a;a=r.exec(e),a;){var u={type:a[1],procType:null,contentDomain:null,dekInfo:null,headers:[],body:n.util.decode64(a[3])};if(t.push(u),a[2]){for(var c=a[2].split(o),f=0;a&&f<c.length;){for(var l=c[f].replace(/\s+$/,""),h=f+1;h<c.length;++h){var p=c[h];if(!/\s/.test(p[0]))break;l+=p,f=h}if(a=l.match(i),a){for(var d={name:a[1],values:[]},y=a[2].split(","),g=0;g<y.length;++g)d.values.push(s(y[g]));if(u.procType)if(u.contentDomain||"Content-Domain"!==d.name)if(u.dekInfo||"DEK-Info"!==d.name)u.headers.push(d);else{if(0===d.values.length)throw new Error('Invalid PEM formatted message. The "DEK-Info" header must have at least one subfield.');u.dekInfo={algorithm:y[0],parameters:y[1]||null}}else u.contentDomain=y[0]||"";else{if("Proc-Type"!==d.name)throw new Error('Invalid PEM formatted message. The first encapsulated header must be "Proc-Type".');if(2!==d.values.length)throw new Error('Invalid PEM formatted message. The "Proc-Type" header must have two subfields.');u.procType={version:y[0],type:y[1]}}}++f}if("ENCRYPTED"===u.procType&&!u.dekInfo)throw new Error('Invalid PEM formatted message. The "DEK-Info" header must be present if "Proc-Type" is "ENCRYPTED".')}}if(0===t.length)throw new Error("Invalid PEM formatted message.");return t}},function(e,t,r){"use strict";const n=r(1);t.logger=((e,t)=>{const r=["bitswap"];t&&r.push(t),e&&r.push(`${e.toB58String().slice(0,8)}`);const i=n(r.join(":"));return i.error=n(r.concat(["error"]).join(":")),i})},function(e,t,r){function n(e){if(e)return i(e)}function i(e){for(var t in n.prototype)e[t]=n.prototype[t];return e}e.exports=n,n.prototype.on=n.prototype.addEventListener=function(e,t){return this._callbacks=this._callbacks||{},(this._callbacks["$"+e]=this._callbacks["$"+e]||[]).push(t),this},n.prototype.once=function(e,t){function r(){this.off(e,r),t.apply(this,arguments)}return r.fn=t,this.on(e,r),this},n.prototype.off=n.prototype.removeListener=n.prototype.removeAllListeners=n.prototype.removeEventListener=function(e,t){if(this._callbacks=this._callbacks||{},0==arguments.length)return this._callbacks={},this;var r=this._callbacks["$"+e],n;if(!r)return this;if(1==arguments.length)return delete this._callbacks["$"+e],this;for(var i=0;i<r.length;i++)if(n=r[i],n===t||n.fn===t){r.splice(i,1);break}return this},n.prototype.emit=function(e){this._callbacks=this._callbacks||{};var t=[].slice.call(arguments,1),r=this._callbacks["$"+e];if(r){r=r.slice(0);for(var n=0,i=r.length;n<i;++n)r[n].apply(this,t)}return this},n.prototype.listeners=function(e){return this._callbacks=this._callbacks||{},this._callbacks["$"+e]||[]},n.prototype.hasListeners=function(e){return!!this.listeners(e).length}},function(e,t,r){(function(e){var n=r(1091),i=r(514),o=r(1093),s=r(1094),a=r(1095),u;e&&e.ArrayBuffer&&(u=r(1096));var c="undefined"!=typeof navigator&&/Android/i.test(navigator.userAgent),f="undefined"!=typeof navigator&&/PhantomJS/i.test(navigator.userAgent),l=c||f;t.protocol=3;var h=t.packets={open:0,close:1,ping:2,pong:3,message:4,upgrade:5,noop:6},p=n(h),d={type:"error",data:"parser error"},y=r(1097);function g(e,r){var n="b"+t.packets[e.type]+e.data.data;return r(n)}function m(e,r,n){if(!r)return t.encodeBase64Packet(e,n);var i=e.data,o=new Uint8Array(i),s=new Uint8Array(1+i.byteLength);s[0]=h[e.type];for(var a=0;a<o.length;a++)s[a+1]=o[a];return n(s.buffer)}function b(e,r,n){if(!r)return t.encodeBase64Packet(e,n);var i=new FileReader;return i.onload=function(){e.data=i.result,t.encodePacket(e,r,!0,n)},i.readAsArrayBuffer(e.data)}function v(e,r,n){if(!r)return t.encodeBase64Packet(e,n);if(l)return b(e,r,n);var i=new Uint8Array(1);i[0]=h[e.type];var o=new y([i.buffer,e.data]);return n(o)}function _(e){try{e=a.decode(e,{strict:!1})}catch(e){return!1}return e}function w(e,t,r){for(var n=new Array(e.length),i=s(e.length,r),o=function(e,r,i){t(r,function(t,r){n[e]=r,i(t,n)})},a=0;a<e.length;a++)o(a,e[a],i)}t.encodePacket=function(t,r,n,i){"function"==typeof r&&(i=r,r=!1),"function"==typeof n&&(i=n,n=null);var o=void 0===t.data?void 0:t.data.buffer||t.data;if(e.ArrayBuffer&&o instanceof ArrayBuffer)return m(t,r,i);if(y&&o instanceof e.Blob)return v(t,r,i);if(o&&o.base64)return g(t,i);var s=h[t.type];return void 0!==t.data&&(s+=n?a.encode(String(t.data),{strict:!1}):String(t.data)),i(""+s)},t.encodeBase64Packet=function(r,n){var i="b"+t.packets[r.type],o;if(y&&r.data instanceof e.Blob){var s=new FileReader;return s.onload=function(){var e=s.result.split(",")[1];n(i+e)},s.readAsDataURL(r.data)}try{o=String.fromCharCode.apply(null,new Uint8Array(r.data))}catch(e){for(var a=new Uint8Array(r.data),u=new Array(a.length),c=0;c<a.length;c++)u[c]=a[c];o=String.fromCharCode.apply(null,u)}return i+=e.btoa(o),n(i)},t.decodePacket=function(e,r,n){if(void 0===e)return d;if("string"==typeof e){if("b"===e.charAt(0))return t.decodeBase64Packet(e.substr(1),r);if(n&&(e=_(e),!1===e))return d;var i=e.charAt(0);return Number(i)==i&&p[i]?e.length>1?{type:p[i],data:e.substring(1)}:{type:p[i]}:d}var s=new Uint8Array(e),i=s[0],a=o(e,1);return y&&"blob"===r&&(a=new y([a])),{type:p[i],data:a}},t.decodeBase64Packet=function(e,t){var r=p[e.charAt(0)];if(!u)return{type:r,data:{base64:!0,data:e.substr(1)}};var n=u.decode(e.substr(1));return"blob"===t&&y&&(n=new y([n])),{type:r,data:n}},t.encodePayload=function(e,r,n){"function"==typeof r&&(n=r,r=null);var o=i(e);if(r&&o)return y&&!l?t.encodePayloadAsBlob(e,n):t.encodePayloadAsArrayBuffer(e,n);if(!e.length)return n("0:");function s(e){return e.length+":"+e}function a(e,n){t.encodePacket(e,!!o&&r,!1,function(e){n(null,s(e))})}w(e,a,function(e,t){return n(t.join(""))})},t.decodePayload=function(e,r,n){if("string"!=typeof e)return t.decodePayloadAsBinary(e,r,n);var i;if("function"==typeof r&&(n=r,r=null),""===e)return n(d,0,1);for(var o="",s,a,u=0,c=e.length;u<c;u++){var f=e.charAt(u);if(":"===f){if(""===o||o!=(s=Number(o)))return n(d,0,1);if(a=e.substr(u+1,s),o!=a.length)return n(d,0,1);if(a.length){if(i=t.decodePacket(a,r,!1),d.type===i.type&&d.data===i.data)return n(d,0,1);var l=n(i,u+s,c);if(!1===l)return}u+=s,o=""}else o+=f}return""!==o?n(d,0,1):void 0},t.encodePayloadAsArrayBuffer=function(e,r){if(!e.length)return r(new ArrayBuffer(0));function n(e,r){t.encodePacket(e,!0,!0,function(e){return r(null,e)})}w(e,n,function(e,t){var n=t.reduce(function(e,t){var r;return r="string"==typeof t?t.length:t.byteLength,e+r.toString().length+r+2},0),i=new Uint8Array(n),o=0;return t.forEach(function(e){var t="string"==typeof e,r=e;if(t){for(var n=new Uint8Array(e.length),s=0;s<e.length;s++)n[s]=e.charCodeAt(s);r=n.buffer}i[o++]=t?0:1;for(var a=r.byteLength.toString(),s=0;s<a.length;s++)i[o++]=parseInt(a[s]);i[o++]=255;for(var n=new Uint8Array(r),s=0;s<n.length;s++)i[o++]=n[s]}),r(i.buffer)})},t.encodePayloadAsBlob=function(e,r){function n(e,r){t.encodePacket(e,!0,!0,function(e){var t=new Uint8Array(1);if(t[0]=1,"string"==typeof e){for(var n=new Uint8Array(e.length),i=0;i<e.length;i++)n[i]=e.charCodeAt(i);e=n.buffer,t[0]=0}for(var o=e instanceof ArrayBuffer?e.byteLength:e.size,s=o.toString(),a=new Uint8Array(s.length+1),i=0;i<s.length;i++)a[i]=parseInt(s[i]);if(a[s.length]=255,y){var u=new y([t.buffer,a.buffer,e]);r(null,u)}})}w(e,n,function(e,t){return r(new y(t))})},t.decodePayloadAsBinary=function(e,r,n){"function"==typeof r&&(n=r,r=null);for(var i=e,s=[];i.byteLength>0;){for(var a=new Uint8Array(i),u=0===a[0],c="",f=1;255!==a[f];f++){if(c.length>310)return n(d,0,1);c+=a[f]}i=o(i,2+c.length),c=parseInt(c);var l=o(i,0,c);if(u)try{l=String.fromCharCode.apply(null,new Uint8Array(l))}catch(e){var h=new Uint8Array(l);l="";for(var f=0;f<h.length;f++)l+=String.fromCharCode(h[f])}s.push(l),i=o(i,c)}var p=s.length;s.forEach(function(e,i){n(t.decodePacket(e,r,!0),i,p)})}}).call(this,r(7))},function(e,t,r){const n=r(36),i=r(21),o=r(81);function s(e,t){return new Promise(r=>{setTimeout(()=>{r(t)},e)})}class a{constructor(e){}static setup0(e){throw new o.IntentionallyUnimplementedError("Intentionally undefined function Transport.setup0 should have been subclassed")}p_setup1(e){return this}p_setup2(e){return this}static async p_setup(e,t){let r=await this.setup0(e).p_setup1(t);return r.p_setup2(t)}togglePaused(e){switch(this.status){case a.STATUS_CONNECTED:this.status=a.STATUS_PAUSED;break;case a.STATUS_PAUSED:this.status=a.STATUS_CONNECTED;break;case a.STATUS_LOADED:this.p_setup1(e).then(t=>t.p_setup2(e))}e&&e(this)}async p_status(){return this.status}supports(e,t){if("string"==typeof e&&(e=n.parse(e)),e&&!e.protocol)throw new Error("URL failed to specific a scheme (before :) "+e.href);return(!e||this.supportURLs.includes(e.protocol.slice(0,-1)))&&(!t||this.supportFunctions.includes(t))}p_rawstore(e,t){throw new o.ToBeImplementedError("Intentionally undefined function Transport.p_rawstore should have been subclassed")}async p_rawstoreCaught(e){try{return await this.p_rawstore(e)}catch(e){}}p_store(){throw new o.ToBeImplementedError("Undefined function Transport.p_store - may define higher level semantics here (see Python)")}p_rawfetch(e,{timeoutMS:t,start:r,end:n,relay:i=!1}={}){return console.assert(!1,"Intentionally undefined function Transport.p_rawfetch should have been subclassed"),"UNIMPLEMENTED"}p_fetch(){throw new o.ToBeImplementedError("Undefined function Transport.p_fetch - may define higher level semantics here (see Python)")}p_rawadd(e,t){throw new o.ToBeImplementedError("Undefined function Transport.p_rawadd")}p_rawlist(e){throw new o.ToBeImplementedError("Undefined function Transport.p_rawlist")}p_list(){throw new Error("Undefined function Transport.p_list")}p_newlisturls(e){throw new Error("undefined function Transport.p_newlisturls")}p_rawreverse(e){throw new o.ToBeImplementedError("Undefined function Transport.p_rawreverse")}listmonitor(e,t,{current:r=!1}={}){console.log("Undefined function Transport.listmonitor")}async p_newdatabase(e){throw new o.ToBeImplementedError("Undefined function Transport.p_newdatabase")}async p_newtable(e,t){throw new o.ToBeImplementedError("Undefined function Transport.p_newtable")}async p_set(e,t,r){throw new o.ToBeImplementedError("Undefined function Transport.p_set")}async p_get(e,t){throw new o.ToBeImplementedError("Undefined function Transport.p_get")}async p_delete(e,t){throw new o.ToBeImplementedError("Undefined function Transport.p_delete")}async p_keys(e){throw new o.ToBeImplementedError("Undefined function Transport.p_keys")}async p_getall(e){throw new o.ToBeImplementedError("Undefined function Transport.p_keys")}static async p_f_createReadStream(e,{wanturl:t=!1}){}static mergeoptions(e){let t={};for(let r=0;r<arguments.length;r++){let n=arguments[r];for(let r in n){let i=n[r];"object"==typeof i&&!Array.isArray(i)&&t[r]?t[r]=a.mergeoptions(e[r],n[r]):t[r]=n[r]}}return t}async p_test_list({urlexpectedsubstring:e}={}){console.log(this.name,"p_test_kvt");try{let t=await this.p_newlisturls("NACL VERIFY:1234567LIST"),r=t.publicurl;console.log("newlisturls=",r),console.assert(!e||r.includes(e)),await this.p_rawadd(r,"testvalue");let n=await this.p_rawlist(r);console.assert(1===n.length&&"testvalue"===n[0]),await this.p_rawadd(r,{foo:"bar"}),n=await this.p_rawlist(r),console.assert(2===n.length&&"bar"===n[1].foo),await this.p_rawadd(r,[1,2,3]),n=await this.p_rawlist(r),console.assert(2===n.length&&3===n[2].length&&2===n[2][1]),await s(200),console.log(this.name,"p_test_list complete")}catch(e){throw console.log("Exception thrown in ",this.name,"p_test_list:",e.message),e}}async p_test_kvt(e){console.log(this.name,"p_test_kvt");try{let t=await this.p_newtable("NACL VERIFY:1234567KVT","mytable"),r=t.publicurl;console.log("newtable=",r),console.assert(r.includes(e)),await this.p_set(r,"testkey","testvalue");let n=await this.p_get(r,"testkey");console.assert("testvalue"===n),await this.p_set(r,"testkey2",{foo:"bar"}),n=await this.p_get(r,"testkey2"),console.assert("bar"===n.foo),await this.p_set(r,"testkey3",[1,2,3]),n=await this.p_get(r,"testkey3"),console.assert(2===n[1]),n=await this.p_keys(r),console.assert(n.includes("testkey")&&n.includes("testkey3")&&3===n.length),await this.p_delete(r,["testkey"]),n=await this.p_getall(r),console.log("getall=>",n),console.assert("bar"===n.testkey2.foo&&2===n.testkey3[1]&&!n.testkey),await s(200),console.log(this.name,"p_test_kvt complete")}catch(e){throw console.log("Exception thrown in ",this.name,"p_test_kvt:",e.message),e}}}a.STATUS_CONNECTED=0,a.STATUS_FAILED=1,a.STATUS_STARTING=2,a.STATUS_LOADED=3,a.STATUS_PAUSED=4,t=e.exports=a},function(e,t,r){(function(e){function r(e){return Array.isArray?Array.isArray(e):"[object Array]"===g(e)}function n(e){return"boolean"==typeof e}function i(e){return null===e}function o(e){return null==e}function s(e){return"number"==typeof e}function a(e){return"string"==typeof e}function u(e){return"symbol"==typeof e}function c(e){return void 0===e}function f(e){return"[object RegExp]"===g(e)}function l(e){return"object"==typeof e&&null!==e}function h(e){return"[object Date]"===g(e)}function p(e){return"[object Error]"===g(e)||e instanceof Error}function d(e){return"function"==typeof e}function y(e){return null===e||"boolean"==typeof e||"number"==typeof e||"string"==typeof e||"symbol"==typeof e||void 0===e}function g(e){return Object.prototype.toString.call(e)}t.isArray=r,t.isBoolean=n,t.isNull=i,t.isNullOrUndefined=o,t.isNumber=s,t.isString=a,t.isSymbol=u,t.isUndefined=c,t.isRegExp=f,t.isObject=l,t.isDate=h,t.isError=p,t.isFunction=d,t.isPrimitive=y,t.isBuffer=e.isBuffer}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(t){const n=r(9),i=r(73);class o{constructor(e,r){if(!e||!t.isBuffer(e))throw new Error("first argument must be a buffer");if(!r||!n.isCID(r))throw new Error("second argument must be a CID");this._data=e,this._cid=r}get data(){return this._data}set data(e){throw new Error("Tried to change an immutable block")}get cid(){return this._cid}set cid(e){throw new Error("Tried to change an immutable block")}}e.exports=i(o,{className:"Block",symbolName:"@ipfs/js-ipfs-block/block"})}).call(this,r(0).Buffer)},function(e,t,r){"use strict";e.exports=function e(t,r){var n,i;function o(e){if(n=e,i)return o.abort();!function e(){for(var o=!0,s=!1;o;)if(s=!1,n(null,function(a,u){if(s=!0,a=a||i){if(o=!1,r)r(!0===a?null:a);else if(a&&!0!==a)throw a}else t&&!1===t(u)||i?(o=!1,n(i||!0,r||function(){})):o||e()}),!s)return void(o=!1)}()}return o.abort=function(e,t){if("function"==typeof e&&(t=e,e=!0),i=e||!0,n)return n(i,t||function(){})},o}},function(e,t){e.exports=function e(t){return t&&("string"==typeof t?function(e){return e[t]}:"object"==typeof t&&"function"==typeof t.exec?function(e){var r=t.exec(e);return r&&r[0]}:t)}},function(e,t,r){"use strict";function n(e){return e}var i=r(122);e.exports=function e(t){if(!t)return n;t=i(t);var r=!1,o,s;return function(e){return function n(i,a){if(s)return a(s);i?(s=i,e(i,r?function(e){r?o=a:a(i)}:function(e){a(i)})):e(null,function(e,i){e?a(e):s?a(s):(r=!0,t(i,function(e,t){r=!1,s?(a(s),o(s)):e?n(e,a):a(null,t)}))})}}}},function(e,t,r){"use strict";var n=r(341);e.exports=function e(t){return t=n(t),function(e){return function r(n,i){for(var o,s=!0;s;)s=!1,o=!0,e(n,function(e,n){if(!e&&!t(n))return o?s=!0:r(e,i);i(e,n)}),o=!1}}}},function(e,t,r){var n=r(214),i=r(348);function o(e){return null!=e&&i(e.length)&&!n(e)}e.exports=o},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e,t){var r=(0,s.default)(e);return(0,i.default)(function(e,t){r(e[0],t)},t,1)};var n=r(681),i=a(n),o=r(32),s=a(o);function a(e){return e&&e.__esModule?e:{default:e}}e.exports=t.default},function(e,t,r){"use strict";var n=r(4),i=r(236),o=r(401),s=r(402),a=r(94);function u(e){a.call(this,"digest"),this._hash=e}n(u,a),u.prototype._update=function(e){this._hash.update(e)},u.prototype._final=function(){return this._hash.digest()},e.exports=function e(t){return t=t.toLowerCase(),"md5"===t?new i:"rmd160"===t||"ripemd160"===t?new o:new u(s(t))}},function(e,t){e.exports={bitcoin:{messagePrefix:"Bitcoin Signed Message:\n",bech32:"bc",bip32:{public:76067358,private:76066276},pubKeyHash:0,scriptHash:5,wif:128},testnet:{messagePrefix:"Bitcoin Signed Message:\n",bech32:"tb",bip32:{public:70617039,private:70615956},pubKeyHash:111,scriptHash:196,wif:239},litecoin:{messagePrefix:"Litecoin Signed Message:\n",bip32:{public:27108450,private:27106558},pubKeyHash:48,scriptHash:50,wif:176}}},function(e,t,r){"use strict";var n=r(65),i=r(84);function o(){this.pending=null,this.pendingTotal=0,this.blockSize=this.constructor.blockSize,this.outSize=this.constructor.outSize,this.hmacStrength=this.constructor.hmacStrength,this.padLength=this.constructor.padLength/8,this.endian="big",this._delta8=this.blockSize/8,this._delta32=this.blockSize/32}t.BlockHash=o,o.prototype.update=function e(t,r){if(t=n.toArray(t,r),this.pending?this.pending=this.pending.concat(t):this.pending=t,this.pendingTotal+=t.length,this.pending.length>=this._delta8){t=this.pending;var i=t.length%this._delta8;this.pending=t.slice(t.length-i,t.length),0===this.pending.length&&(this.pending=null),t=n.join32(t,0,t.length-i,this.endian);for(var o=0;o<t.length;o+=this._delta32)this._update(t,o,o+this._delta32)}return this},o.prototype.digest=function e(t){return this.update(this._pad()),i(null===this.pending),this._digest(t)},o.prototype._pad=function e(){var t=this.pendingTotal,r=this._delta8,n=r-(t+this.padLength)%r,i=new Array(n+this.padLength);i[0]=128;for(var o=1;o<n;o++)i[o]=0;if(t<<=3,"big"===this.endian){for(var s=8;s<this.padLength;s++)i[o++]=0;i[o++]=0,i[o++]=0,i[o++]=0,i[o++]=0,i[o++]=t>>>24&255,i[o++]=t>>>16&255,i[o++]=t>>>8&255,i[o++]=255&t}else for(i[o++]=255&t,i[o++]=t>>>8&255,i[o++]=t>>>16&255,i[o++]=t>>>24&255,i[o++]=0,i[o++]=0,i[o++]=0,i[o++]=0,s=8;s<this.padLength;s++)i[o++]=0;return i}},function(e,t,r){const n=r(13),i=r(2).Buffer;function o(e,t){if("00"===e.slice(0,2))throw new Error("invalid RLP: extra zeros");return parseInt(e,t)}function s(e,t){if(e<56)return i.from([e+t]);var r=f(e),n=r.length/2,o=f(t+55+n);return i.from(o+r,"hex")}function a(e){var t,r,n,s,u,c=[],f=e[0];if(f<=127)return{data:e.slice(0,1),remainder:e.slice(1)};if(f<=183){if(t=f-127,n=128===f?i.from([]):e.slice(1,t),2===t&&n[0]<128)throw new Error("invalid rlp encoding: byte must be less 0x80");return{data:n,remainder:e.slice(t)}}if(f<=191){if(r=f-182,t=o(e.slice(1,r).toString("hex"),16),n=e.slice(r,t+r),n.length<t)throw new Error("invalid RLP");return{data:n,remainder:e.slice(t+r)}}if(f<=247){for(t=f-191,s=e.slice(1,t);s.length;)u=a(s),c.push(u.data),s=u.remainder;return{data:c,remainder:e.slice(t)}}r=f-246,t=o(e.slice(1,r).toString("hex"),16);var l=r+t;if(l>e.length)throw new Error("invalid rlp: total length is larger than the data");if(s=e.slice(r,l),0===s.length)throw new Error("invalid rlp, List has a invalid length");for(;s.length;)u=a(s),c.push(u.data),s=u.remainder;return{data:c,remainder:e.slice(l)}}function u(e){return"0x"===e.slice(0,2)}function c(e){return"string"!=typeof e?e:u(e)?e.slice(2):e}function f(e){var t=e.toString(16);return t.length%2&&(t="0"+t),t}function l(e){return e.length%2&&(e="0"+e),e}function h(e){var t=f(e);return i.from(t,"hex")}function p(e){if(!i.isBuffer(e))if("string"==typeof e)e=u(e)?i.from(l(c(e)),"hex"):i.from(e);else if("number"==typeof e)e=e?h(e):i.from([]);else if(null===e||void 0===e)e=i.from([]);else{if(!e.toArray)throw new Error("invalid type");e=i.from(e.toArray())}return e}t.encode=function(e){if(e instanceof Array){for(var r=[],n=0;n<e.length;n++)r.push(t.encode(e[n]));var o=i.concat(r);return i.concat([s(o.length,192),o])}return e=p(e),1===e.length&&e[0]<128?e:i.concat([s(e.length,128),e])},t.decode=function(e,t){if(!e||0===e.length)return i.from([]);e=p(e);var r=a(e);return t?r:(n.equal(r.remainder.length,0,"invalid remainder"),r.data)},t.getLength=function(e){if(!e||0===e.length)return i.from([]);e=p(e);var t=e[0];if(t<=127)return e.length;if(t<=183)return t-127;if(t<=191)return t-182;if(t<=247)return t-191;var r=t-246,n=o(e.slice(1,r).toString("hex"),16);return r+n}},function(e,t,r){"use strict";const n=r(9),i=r(14);function o(e,t,r){r=r||{};const o=r.hashAlg||"keccak-256",s=void 0===r.version?1:r.version,a=i.encode(t,o);return new n(s,e,a)}e.exports=o},function(e,t,r){"use strict";const n=r(5),i=r(415),o=r(416);function s(e,t,r){const s=o(e,t),a={multicodec:e,defaultHashAlg:"keccak-256",resolve:f,tree:u,isLink:i(f),_resolveFromEthObject:l,_treeFromEthObject:c,_mapFromEthObject:r};return{resolver:a,util:s};function u(e,t,r){"function"==typeof t&&(r=t,t=void 0),t||(t={}),n([t=>s.deserialize(e,t),(e,r)=>c(e,t,r)],r)}function c(e,t,i){n([n=>r(e,t,n),(e,t)=>t(null,e.map(e=>e.path))],i)}function f(e,t,r){n([t=>s.deserialize(e,t),(e,r)=>l(e,t,r)],r)}function l(e,t,n){if(!t||"/"===t){const t={value:e,remainderPath:""};return n(null,t)}r(e,{},(e,r)=>{if(e)return n(e);const i=t.split("/");let o=r.filter(e=>e.path===t.slice(0,e.path.length));o=o.filter(e=>e.path.split("/").every((e,t)=>e===i[t]));const s=o.sort((e,t)=>e.path.length<t.path.length),a=s[0];if(!a){let e=new Error('Path not found ("'+t+'").');return n(e)}const u=t.slice(a.path.length+1),c={value:a.value,remainderPath:u};return n(null,c)})}}e.exports=s},function(e,t,r){"use strict";(function(t){var n=r(15),i=r(177),o=r(0),s=r(40).sha256sha256,a=function e(r){if(!(this instanceof e))return new e(r);if(t.isBuffer(r)){var n=r;this.fromBuffer(n)}else if("string"==typeof r){var i=r;this.fromString(i)}else r&&this.set(r)};a.prototype.set=function(e){return this.buf=e.buf||this.buf||void 0,this},a.validChecksum=function e(t,r){return n.isString(t)&&(t=new o.Buffer(i.decode(t))),n.isString(r)&&(r=new o.Buffer(i.decode(r))),r||(r=t.slice(-4),t=t.slice(0,-4)),a.checksum(t).toString("hex")===r.toString("hex")},a.decode=function(e){if("string"!=typeof e)throw new Error("Input must be a string");var r=new t(i.decode(e));if(r.length<4)throw new Error("Input string too short");var n=r.slice(0,-4),o=r.slice(-4),a=s(n),u=a.slice(0,4);if(o.toString("hex")!==u.toString("hex"))throw new Error("Checksum mismatch");return n},a.checksum=function(e){return s(e).slice(0,4)},a.encode=function(e){if(!t.isBuffer(e))throw new Error("Input must be a buffer");var r=new t(e.length+4),n=a.checksum(e);return e.copy(r),n.copy(r,e.length),i.encode(r)},a.prototype.fromBuffer=function(e){return this.buf=e,this},a.prototype.fromString=function(e){var t=a.decode(e);return this.buf=t,this},a.prototype.toBuffer=function(){return this.buf},a.prototype.toString=function(){return a.encode(this.buf)},e.exports=a}).call(this,r(0).Buffer)},function(e,t,r){"use strict";var n=r(15),i=r(20),o=r(60),s=r(58),a=r(0),u=r(24),c=r(30),f=r(62),l=r(86),h=r(87),p=4294967295,d=p-2,y=p,g=p-1;function m(e){return this instanceof m?e?this._fromObject(e):void 0:new m(e)}m.MAXINT=p,m.DEFAULT_SEQNUMBER=4294967295,m.DEFAULT_LOCKTIME_SEQNUMBER=4294967294,m.DEFAULT_RBF_SEQNUMBER=4294967293,Object.defineProperty(m.prototype,"script",{configurable:!1,enumerable:!0,get:function(){return this.isNull()?null:(this._script||(this._script=new f(this._scriptBuffer),this._script._isInput=!0),this._script)}}),m.fromObject=function(e){i.checkArgument(n.isObject(e));var t=new m;return t._fromObject(e)},m.prototype._fromObject=function(e){var t;if(t=n.isString(e.prevTxId)&&c.isHexa(e.prevTxId)?new a.Buffer(e.prevTxId,"hex"):e.prevTxId,this.output=e.output?e.output instanceof h?e.output:new h(e.output):void 0,this.prevTxId=t||e.txidbuf,this.outputIndex=n.isUndefined(e.outputIndex)?e.txoutnum:e.outputIndex,this.sequenceNumber=n.isUndefined(e.sequenceNumber)?n.isUndefined(e.seqnum)?4294967295:e.seqnum:e.sequenceNumber,n.isUndefined(e.script)&&n.isUndefined(e.scriptBuffer))throw new o.Transaction.Input.MissingScript;return this.setScript(e.scriptBuffer||e.script),this},m.prototype.toObject=m.prototype.toJSON=function e(){var t={prevTxId:this.prevTxId.toString("hex"),outputIndex:this.outputIndex,sequenceNumber:this.sequenceNumber,script:this._scriptBuffer.toString("hex")};return this.script&&(t.scriptString=this.script.toString()),this.output&&(t.output=this.output.toObject()),t},m.fromBufferReader=function(e){var t=new m;return t.prevTxId=e.readReverse(32),t.outputIndex=e.readUInt32LE(),t._scriptBuffer=e.readVarLengthBuffer(),t.sequenceNumber=e.readUInt32LE(),t},m.prototype.toBufferWriter=function(e){e||(e=new s),e.writeReverse(this.prevTxId),e.writeUInt32LE(this.outputIndex);var t=this._scriptBuffer;return e.writeVarintNum(t.length),e.write(t),e.writeUInt32LE(this.sequenceNumber),e},m.prototype.setScript=function(e){if(this._script=null,e instanceof f)this._script=e,this._script._isInput=!0,this._scriptBuffer=e.toBuffer();else if(c.isHexa(e))this._scriptBuffer=new a.Buffer(e,"hex");else if(n.isString(e))this._script=new f(e),this._script._isInput=!0,this._scriptBuffer=this._script.toBuffer();else{if(!u.isBuffer(e))throw new TypeError("Invalid argument type: script");this._scriptBuffer=new a.Buffer(e)}return this},m.prototype.getSignatures=function(){throw new o.AbstractMethodInvoked("Trying to sign unsupported output type (only P2PKH and P2SH multisig inputs are supported) for input: "+JSON.stringify(this))},m.prototype.isFullySigned=function(){throw new o.AbstractMethodInvoked("Input#isFullySigned")},m.prototype.isFinal=function(){return 4294967295!==this.sequenceNumber},m.prototype.addSignature=function(){throw new o.AbstractMethodInvoked("Input#addSignature")},m.prototype.clearSignatures=function(){throw new o.AbstractMethodInvoked("Input#clearSignatures")},m.prototype.isValidSignature=function(e,t){return t.signature.nhashtype=t.sigtype,l.verify(e,t.signature,t.publicKey,t.inputIndex,this.output.script)},m.prototype.isNull=function(){return"0000000000000000000000000000000000000000000000000000000000000000"===this.prevTxId.toString("hex")&&4294967295===this.outputIndex},m.prototype._estimateSize=function(){return this.toBufferWriter().toBuffer().length},e.exports=m},function(e,t,r){"use strict";(function(t){var n=r(15),i=r(20),o=r(76),s=r(24),a=r(30),u=r(67),c=r(60),f=r(61);function l(e){if(!(this instanceof l))return new l(e);if(e instanceof l)return e;if(n.isObject(e))return this._fromObject(e);throw new c.InvalidArgument("TransactionSignatures must be instantiated from an object")}o(l,f),l.prototype._fromObject=function(e){return this._checkObjectArgs(e),this.publicKey=new u(e.publicKey),this.prevTxId=s.isBuffer(e.prevTxId)?e.prevTxId:new t(e.prevTxId,"hex"),this.outputIndex=e.outputIndex,this.inputIndex=e.inputIndex,this.signature=e.signature instanceof f?e.signature:s.isBuffer(e.signature)?f.fromBuffer(e.signature):f.fromString(e.signature),this.sigtype=e.sigtype,this},l.prototype._checkObjectArgs=function(e){i.checkArgument(u(e.publicKey),"publicKey"),i.checkArgument(!n.isUndefined(e.inputIndex),"inputIndex"),i.checkArgument(!n.isUndefined(e.outputIndex),"outputIndex"),i.checkState(n.isNumber(e.inputIndex),"inputIndex must be a number"),i.checkState(n.isNumber(e.outputIndex),"outputIndex must be a number"),i.checkArgument(e.signature,"signature"),i.checkArgument(e.prevTxId,"prevTxId"),i.checkState(e.signature instanceof f||s.isBuffer(e.signature)||a.isHexa(e.signature),"signature must be a buffer or hexa value"),i.checkState(s.isBuffer(e.prevTxId)||a.isHexa(e.prevTxId),"prevTxId must be a buffer or hexa value"),i.checkArgument(e.sigtype,"sigtype"),i.checkState(n.isNumber(e.sigtype),"sigtype must be a number")},l.prototype.toObject=l.prototype.toJSON=function e(){return{publicKey:this.publicKey.toString(),prevTxId:this.prevTxId.toString("hex"),outputIndex:this.outputIndex,inputIndex:this.inputIndex,signature:this.signature.toString(),sigtype:this.sigtype}},l.fromObject=function(e){return i.checkArgument(e),new l(e)},e.exports=l}).call(this,r(0).Buffer)},function(e,t,r){(function(t){e.exports=function e(r,n){for(var i=Math.min(r.length,n.length),o=new t(i),s=0;s<i;++s)o[s]=r[s]^n[s];return o}}).call(this,r(0).Buffer)},function(e,t,r){var n=r(11);r(78),r(16);var i=e.exports=n.hmac=n.hmac||{};i.create=function(){var e=null,t=null,r=null,i=null,o={start:function(o,s){if(null!==o)if("string"==typeof o){if(o=o.toLowerCase(),!(o in n.md.algorithms))throw new Error('Unknown hash algorithm "'+o+'"');t=n.md.algorithms[o].create()}else t=o;if(null===s)s=e;else{if("string"==typeof s)s=n.util.createBuffer(s);else if(n.util.isArray(s)){var a=s;s=n.util.createBuffer();for(var u=0;u<a.length;++u)s.putByte(a[u])}var c=s.length();c>t.blockLength&&(t.start(),t.update(s.bytes()),s=t.digest()),r=n.util.createBuffer(),i=n.util.createBuffer(),c=s.length();for(var u=0;u<c;++u){var a=s.at(u);r.putByte(54^a),i.putByte(92^a)}if(c<t.blockLength)for(var a=t.blockLength-c,u=0;u<a;++u)r.putByte(54),i.putByte(92);e=s,r=r.bytes(),i=i.bytes()}t.start(),t.update(r)},update:function(e){t.update(e)},getMac:function(){var e=t.digest().bytes();return t.start(),t.update(i),t.update(e),t.digest()}};return o.digest=o.getMac,o}},function(e,t,r){var n=r(11);r(78),r(16);var i=e.exports=n.sha1=n.sha1||{};n.md.sha1=n.md.algorithms.sha1=i,i.create=function(){s||a();var e=null,t=n.util.createBuffer(),r=new Array(80),i={algorithm:"sha1",blockLength:64,digestLength:20,messageLength:0,fullMessageLength:null,messageLengthSize:8,start:function(){i.messageLength=0,i.fullMessageLength=i.messageLength64=[];for(var r=i.messageLengthSize/4,o=0;o<r;++o)i.fullMessageLength.push(0);return t=n.util.createBuffer(),e={h0:1732584193,h1:4023233417,h2:2562383102,h3:271733878,h4:3285377520},i}};return i.start(),i.update=function(o,s){"utf8"===s&&(o=n.util.encodeUtf8(o));var a=o.length;i.messageLength+=a,a=[a/4294967296>>>0,a>>>0];for(var c=i.fullMessageLength.length-1;c>=0;--c)i.fullMessageLength[c]+=a[1],a[1]=a[0]+(i.fullMessageLength[c]/4294967296>>>0),i.fullMessageLength[c]=i.fullMessageLength[c]>>>0,a[0]=a[1]/4294967296>>>0;return t.putBytes(o),u(e,r,t),(t.read>2048||0===t.length())&&t.compact(),i},i.digest=function(){var s=n.util.createBuffer();s.putBytes(t.bytes());var a=i.fullMessageLength[i.fullMessageLength.length-1]+i.messageLengthSize,c=a&i.blockLength-1,f,l;s.putBytes(o.substr(0,i.blockLength-c));for(var h=8*i.fullMessageLength[0],p=0;p<i.fullMessageLength.length-1;++p)f=8*i.fullMessageLength[p+1],l=f/4294967296>>>0,h+=l,s.putInt32(h>>>0),h=f>>>0;s.putInt32(h);var d={h0:e.h0,h1:e.h1,h2:e.h2,h3:e.h3,h4:e.h4};u(d,r,s);var y=n.util.createBuffer();return y.putInt32(d.h0),y.putInt32(d.h1),y.putInt32(d.h2),y.putInt32(d.h3),y.putInt32(d.h4),y},i};var o=null,s=!1;function a(){o=String.fromCharCode(128),o+=n.util.fillString(String.fromCharCode(0),64),s=!0}function u(e,t,r){for(var n,i,o,s,a,u,c,f,l=r.length();l>=64;){for(i=e.h0,o=e.h1,s=e.h2,a=e.h3,u=e.h4,f=0;f<16;++f)n=r.getInt32(),t[f]=n,c=a^o&(s^a),n=(i<<5|i>>>27)+c+u+1518500249+n,u=a,a=s,s=(o<<30|o>>>2)>>>0,o=i,i=n;for(;f<20;++f)n=t[f-3]^t[f-8]^t[f-14]^t[f-16],n=n<<1|n>>>31,t[f]=n,c=a^o&(s^a),n=(i<<5|i>>>27)+c+u+1518500249+n,u=a,a=s,s=(o<<30|o>>>2)>>>0,o=i,i=n;for(;f<32;++f)n=t[f-3]^t[f-8]^t[f-14]^t[f-16],n=n<<1|n>>>31,t[f]=n,c=o^s^a,n=(i<<5|i>>>27)+c+u+1859775393+n,u=a,a=s,s=(o<<30|o>>>2)>>>0,o=i,i=n;for(;f<40;++f)n=t[f-6]^t[f-16]^t[f-28]^t[f-32],n=n<<2|n>>>30,t[f]=n,c=o^s^a,n=(i<<5|i>>>27)+c+u+1859775393+n,u=a,a=s,s=(o<<30|o>>>2)>>>0,o=i,i=n;for(;f<60;++f)n=t[f-6]^t[f-16]^t[f-28]^t[f-32],n=n<<2|n>>>30,t[f]=n,c=o&s|a&(o^s),n=(i<<5|i>>>27)+c+u+2400959708+n,u=a,a=s,s=(o<<30|o>>>2)>>>0,o=i,i=n;for(;f<80;++f)n=t[f-6]^t[f-16]^t[f-28]^t[f-32],n=n<<2|n>>>30,t[f]=n,c=o^s^a,n=(i<<5|i>>>27)+c+u+3395469782+n,u=a,a=s,s=(o<<30|o>>>2)>>>0,o=i,i=n;e.h0=e.h0+i|0,e.h1=e.h1+o|0,e.h2=e.h2+s|0,e.h3=e.h3+a|0,e.h4=e.h4+u|0,l-=64}}},function(e,t,r){"use strict";const n=t;n.Reporter=r(912).Reporter,n.DecoderBuffer=r(457).DecoderBuffer,n.EncoderBuffer=r(457).EncoderBuffer,n.Node=r(913)},function(e,t,r){var n;!function(i){"use strict";var o={not_string:/[^s]/,not_bool:/[^t]/,not_type:/[^T]/,not_primitive:/[^v]/,number:/[diefg]/,numeric_arg:/[bcdiefguxX]/,json:/[j]/,not_json:/[^j]/,text:/^[^\x25]+/,modulo:/^\x25{2}/,placeholder:/^\x25(?:([1-9]\d*)\$|\(([^\)]+)\))?(\+)?(0|'[^$])?(-)?(\d+)?(?:\.(\d+))?([b-gijostTuvxX])/,key:/^([a-z_][a-z_\d]*)/i,key_access:/^\.([a-z_][a-z_\d]*)/i,index_access:/^\[(\d+)\]/,sign:/^[\+\-]/};function s(){var e=arguments[0],t=s.cache;return t[e]||(t[e]=s.parse(e)),s.format.call(null,t[e],arguments)}s.format=function(e,t){var r=1,n=e.length,i="",a,c=[],l,h,p,d,y,g,m=!0,b="";for(l=0;l<n;l++)if(i=u(e[l]),"string"===i)c[c.length]=e[l];else if("array"===i){if(p=e[l],p[2])for(a=t[r],h=0;h<p[2].length;h++){if(!a.hasOwnProperty(p[2][h]))throw new Error(s('[sprintf] property "%s" does not exist',p[2][h]));a=a[p[2][h]]}else a=p[1]?t[p[1]]:t[r++];if(o.not_type.test(p[8])&&o.not_primitive.test(p[8])&&"function"==u(a)&&(a=a()),o.numeric_arg.test(p[8])&&"number"!=u(a)&&isNaN(a))throw new TypeError(s("[sprintf] expecting number but found %s",u(a)));switch(o.number.test(p[8])&&(m=a>=0),p[8]){case"b":a=parseInt(a,10).toString(2);break;case"c":a=String.fromCharCode(parseInt(a,10));break;case"d":case"i":a=parseInt(a,10);break;case"j":a=JSON.stringify(a,null,p[6]?parseInt(p[6]):0);break;case"e":a=p[7]?parseFloat(a).toExponential(p[7]):parseFloat(a).toExponential();break;case"f":a=p[7]?parseFloat(a).toFixed(p[7]):parseFloat(a);break;case"g":a=p[7]?parseFloat(a).toPrecision(p[7]):parseFloat(a);break;case"o":a=a.toString(8);break;case"s":a=String(a),a=p[7]?a.substring(0,p[7]):a;break;case"t":a=String(!!a),a=p[7]?a.substring(0,p[7]):a;break;case"T":a=u(a),a=p[7]?a.substring(0,p[7]):a;break;case"u":a=parseInt(a,10)>>>0;break;case"v":a=a.valueOf(),a=p[7]?a.substring(0,p[7]):a;break;case"x":a=parseInt(a,10).toString(16);break;case"X":a=parseInt(a,10).toString(16).toUpperCase()}o.json.test(p[8])?c[c.length]=a:(!o.number.test(p[8])||m&&!p[3]?b="":(b=m?"+":"-",a=a.toString().replace(o.sign,"")),y=p[4]?"0"===p[4]?"0":p[4].charAt(1):" ",g=p[6]-(b+a).length,d=p[6]&&g>0?f(y,g):"",c[c.length]=p[5]?b+a+d:"0"===y?b+d+a:d+b+a)}return c.join("")},s.cache=Object.create(null),s.parse=function(e){for(var t=e,r=[],n=[],i=0;t;){if(null!==(r=o.text.exec(t)))n[n.length]=r[0];else if(null!==(r=o.modulo.exec(t)))n[n.length]="%";else{if(null===(r=o.placeholder.exec(t)))throw new SyntaxError("[sprintf] unexpected placeholder");if(r[2]){i|=1;var s=[],a=r[2],u=[];if(null===(u=o.key.exec(a)))throw new SyntaxError("[sprintf] failed to parse named argument key");for(s[s.length]=u[1];""!==(a=a.substring(u[0].length));)if(null!==(u=o.key_access.exec(a)))s[s.length]=u[1];else{if(null===(u=o.index_access.exec(a)))throw new SyntaxError("[sprintf] failed to parse named argument key");s[s.length]=u[1]}r[2]=s}else i|=2;if(3===i)throw new Error("[sprintf] mixing positional and named placeholders is not (yet) supported");n[n.length]=r}t=t.substring(r[0].length)}return n};var a=function(e,t,r){return r=(t||[]).slice(0),r.splice(0,0,e),s.apply(null,r)};function u(e){return"number"==typeof e?"number":"string"==typeof e?"string":Object.prototype.toString.call(e).slice(8,-1).toLowerCase()}var c={0:["","0","00","000","0000","00000","000000","0000000"]," ":[""," "," "," "," "," "," "," "],_:["","_","__","___","____","_____","______","_______"]};function f(e,t){return t>=0&&t<=7&&c[e]?c[e][t]:Array(t+1).join(e)}t.sprintf=s,t.vsprintf=a,void 0!==i&&(i.sprintf=s,i.vsprintf=a,n=function(){return{sprintf:s,vsprintf:a}}.call(t,r,t,e),void 0===n||(e.exports=n))}("undefined"==typeof window?this:window)},function(e,t,r){(function(n){var i=r(64),o=r(525);function s(e,t){function r(){i(),t()}function n(e){i(),t(e)}function i(){e.removeListener("close",r),e.removeListener("error",n)}e.on("close",r),e.on("error",n)}function s(e){e.destroy?e.destroy():console.error("warning, stream-to-pull-stream: \nthe wrapped node-stream does not implement `destroy`, \nthis may cause resource leaks.")}function a(e,t,r){var i,a=!1,u;function c(){u||(u=!0,r&&r(!0===i?null:i))}function f(){a||(a=!0,h(),i?c():e(i=!0,c))}function l(t){h(),i||e(i=t,c)}function h(){t.on("finish",f),t.removeListener("close",f),t.removeListener("error",l)}t.on("close",f),t.on("finish",f),t.on("error",l),n.nextTick(function(){o(function(r){e(null,function(e,n){if(i=i||e,!0===e)return t._isStdio?c():t.end();if(i=i||e)return s(t),c(i);if(t._isStdio)t.write(n,function(){r()});else{var o=t.write(n);!1===o?t.once("drain",r):r()}})})})}function u(e,t,r){function n(i){t.forEach(function(t){e.removeListener(t,n)}),r(i)}return t.forEach(function(t){e.on(t,n)}),e}function c(e){var t=!1,r=!1,n;function i(){var t=e.read();if(null!==t&&n){var r=n;n=null,r(null,t)}}return e.on("readable",function(){r=!0,n&&i()}).on("end",function(){t=!0,n&&n(t)}).on("error",function(e){t=e,n&&n(t)}),function(e,o){n=o,t?o(t):r&&i()}}function f(e){var t=[],r=[],n,i=!1,o;function a(){for(;(t.length||n)&&r.length;)r.shift()(t.length?null:n,t.shift());!t.length&&i&&(i=!1,e.resume())}return e.on("data",function(r){t.push(r),a(),t.length&&e.pause&&(i=!0,e.pause())}),e.on("end",function(){n=!0,a()}),e.on("close",function(){n=!0,a()}),e.on("error",function(e){n=e,a()}),function(t,i){if(!i)throw new Error("*must* provide cb");if(t){function o(){for(;r.length;)r.shift()(t);i(t)}if(n)return o();e.once("close",o),s(e)}else r.push(i),a()}}var l=f,h=function(e,t){return function(r){return a(r,e,t)}},p=function(e){return f(e)};t=e.exports=function(e,t){return e.writable&&e.write?e.readable?function(r){return a(r,e,t),f(e)}:h(e,t):p(e)},t.sink=h,t.source=p,t.read=l,t.read1=f,t.read2=c,t.duplex=function(e,t){return{source:p(e),sink:h(e,t)}},t.transform=function(e){return function(t){var r=p(e);return h(e)(t),r}}}).call(this,r(6))},function(e,t,r){(function(t){var n=r(92);e.exports=o,e.exports.source=function(e){return o(null,e)},e.exports.sink=function(e){return o(e,null)};var i="undefined"==typeof setImmediate?t.nextTick:setImmediate;function o(e,t){e&&"object"==typeof e&&(t=e.source,e=e.sink);var r=[],o=[],s,a,u=new n,c;u.writable=u.readable=!0,u.write=function(e){return r.length?r.shift()(null,e):o.push(e),r.length||(a=!0),!!r.length},u.end=function(){t?o.length?g():t(s=!0,r.length?r.shift():function(){}):r.length&&r.shift()(!0)},u.source=function(e,t){o.length?(t(null,o.shift()),o.length||u.emit("drain")):((s=s||e)?t(s):r.push(t),a&&(a=!1,u.emit("drain")))},e&&(c=e(u.source)),c&&!t&&(t=c);var f=[],l=[],h=!1,p=!1,d=!1;if(u.sink=function(e){t=e,i(g)},t){u.sink(t);var y=u.pipe.bind(u);u.pipe=function(e,t){var r=y(e,t);return u.paused&&u.resume(),r}}function g(){if(p=!1,t&&!d){for(;f.length&&!u.paused;)u.emit("data",f.shift());if(!u.paused){if(h)return u.emit("end");d=!0,t(null,function e(r,n){d=!1,u.paused?(!0===r?h=r:r?u.emit("error",r):f.push(n),p=!0):r&&!0!==(s=r)?u.emit("error",r):(s=s||r)?u.emit("end"):(u.emit("data",n),d=!0,t(null,e))})}}}return u.pause=function(){return u.paused=!0,u},u.resume=function(){return u.paused=!1,g(),u},u.destroy=function(){!s&&t&&t(s=!0,function(){}),s=!0,r.length&&r.shift()(!0),u.emit("close")},u}}).call(this,r(6))},function(e,t){var r=function(){};function n(e,t,r){var n=e.length;if(!n)return r(t);function i(){--n||r(t)}e.forEach(function(e){e?e(t,i):i()}),n||i()}e.exports=function(e){return function(t,r){!function i(){t?n(e,t,r):e.length?e[0]?e[0](null,function(t,o){t?(e.shift(),!0===t?i():n(e,t,r)):r(null,o)}):(e.shift(),i()):r(!0)}()}}},function(e,t,r){"use strict";const n=r(31),i=r(52),o=r(68),s=r(145);e.exports=function(e){function t(e){let t=null;if(n.isMultiaddr(e)){const r=n(e);t=r.getPeerId()}else i.isPeerInfo(e)&&(t=e.id.toB58String());return t}function r(t){let r;if(i.isPeerInfo(t))r=t;else if(n.isMultiaddr(t)){const n=t.getPeerId();try{r=e._peerBook.get(n)}catch(e){r=new i(o.createFromB58String(n))}r.multiaddrs.add(t)}else if(o.isPeerId(t)){const n=t.toB58String();r=e._peerBook.has(n)?e._peerBook.get(n):t}return r}function a(t){return e.muxedConns[t]||e.conns[t]}function u(e,t,r){return r=r||(()=>{}),e.write(s.CircuitRelay.encode({type:s.CircuitRelay.Type.STATUS,code:t})),r()}function c(e,t,r,i){try{e.dstPeer.addrs.forEach(e=>n(e))}catch(e){return u(t,r===s.CircuitRelay.Type.HOP?s.CircuitRelay.Status.HOP_DST_MULTIADDR_INVALID:s.CircuitRelay.Status.STOP_DST_MULTIADDR_INVALID),i(e)}try{e.srcPeer.addrs.forEach(e=>n(e))}catch(e){return u(t,r===s.CircuitRelay.Type.HOP?s.CircuitRelay.Status.HOP_SRC_MULTIADDR_INVALID:s.CircuitRelay.Status.STOP_SRC_MULTIADDR_INVALID),i(e)}return i(null)}function f(e){return"string"==typeof e?o.createFromB58String(e):o.createFromBytes(e)}return{getB58String:t,peerInfoFromMa:r,isPeerConnected:a,validateAddrs:c,writeResponse:u,peerIdFromId:f}}},function(e,t,r){"use strict";const n=r(12);e.exports=n("\nmessage CircuitRelay {\n\n enum Status {\n SUCCESS = 100;\n HOP_SRC_ADDR_TOO_LONG = 220;\n HOP_DST_ADDR_TOO_LONG = 221;\n HOP_SRC_MULTIADDR_INVALID = 250;\n HOP_DST_MULTIADDR_INVALID = 251;\n HOP_NO_CONN_TO_DST = 260;\n HOP_CANT_DIAL_DST = 261;\n HOP_CANT_OPEN_DST_STREAM = 262;\n HOP_CANT_SPEAK_RELAY = 270;\n HOP_CANT_RELAY_TO_SELF = 280;\n STOP_SRC_ADDR_TOO_LONG = 320;\n STOP_DST_ADDR_TOO_LONG = 321;\n STOP_SRC_MULTIADDR_INVALID = 350;\n STOP_DST_MULTIADDR_INVALID = 351;\n STOP_RELAY_REFUSED = 390;\n MALFORMED_MESSAGE = 400;\n }\n\n enum Type { // RPC identifier, either HOP, STOP or STATUS\n HOP = 1;\n STOP = 2;\n STATUS = 3;\n CAN_HOP = 4;\n }\n\n message Peer {\n required bytes id = 1; // peer id\n repeated bytes addrs = 2; // peer's known addresses\n }\n\n optional Type type = 1; // Type of the message\n\n optional Peer srcPeer = 2; // srcPeer and dstPeer are used when Type is HOP or STATUS\n optional Peer dstPeer = 3;\n\n optional Status code = 4; // Status code, used when Type is STATUS\n}\n")},function(e,t,r){"use strict";t.importer=t.Importer=r(1332),t.exporter=t.Exporter=r(1357)},function(e,t,r){"use strict";const n=r(26).Key,i={file:0,directory:1};e.exports={FILE_SEPARATOR:"/",MFS_ROOT_KEY:new n("/local/filesroot"),MAX_CHUNK_SIZE:262144,MAX_LINKS:174,FILE_TYPES:i}},function(e,t,r){(function(t){function r(e,r){var n,i,o,s=!0;function a(e){function i(){r&&r(e,n),r=null}s?t.nextTick(i):i()}function u(e,t,r){n[e]=r,(0==--i||t)&&a(t)}Array.isArray(e)?(n=[],i=e.length):(o=Object.keys(e),n={},i=o.length),i?o?o.forEach(function(t){e[t](function(e,r){u(t,e,r)})}):e.forEach(function(e,t){e(function(e,r){u(t,e,r)})}):a(null),s=!1}e.exports=r}).call(this,r(6))},function(e,t,r){var n=r(1470),i=new n,o="undefined"!=typeof window?window:self,s=o.crypto||o.msCrypto||{},a=s.subtle||s.webkitSubtle;function u(e){return i.digest(e)}try{a.digest({name:"sha-1"},new Uint8Array).catch(function(){a=!1})}catch(e){a=!1}function c(e,t){a?("string"==typeof e&&(e=f(e)),a.digest({name:"sha-1"},e).then(function e(r){t(l(new Uint8Array(r)))},function r(n){t(u(e))})):setTimeout(t,0,u(e))}function f(e){for(var t=e.length,r=new Uint8Array(t),n=0;n<t;n++)r[n]=e.charCodeAt(n);return r}function l(e){for(var t=e.length,r=[],n=0;n<t;n++){var i=e[n];r.push((i>>>4).toString(16)),r.push((15&i).toString(16))}return r.join("")}e.exports=c,e.exports.sync=u},function(e,t,r){(function(t){var n=r(1517),i=r(1518);e.exports=function e(r,o,s){if("number"!=typeof r)throw new TypeError('"size" argument must be a number');if(r<0)throw new RangeError('"size" argument must not be negative');if(t.alloc)return t.alloc(r,o,s);var a=i(r);return 0===r?a:void 0===o?n(a,0):("string"!=typeof s&&(s=void 0),n(a,o,s))}}).call(this,r(0).Buffer)},function(e,t,r){const n=r(81);utils={},utils.consolearr=(e=>e&&e.length>0?[e.length+" items inc:",e[e.length-1]]:e),utils.stringfrom=function(e,t={}){try{return"Url"===e.constructor.name?e.href:"string"==typeof e?e:e.toString()}catch(t){throw new n.CodingError(`Unable to turn ${e} into a string ${t.message}`)}},utils.p_timeout=function(e,t,r){let i=null;return Promise.race([new Promise((e,o)=>{i=setTimeout(o,t,new n.TimeoutError(r||`Timed out in ${t}ms`))}),e.then(e=>(clearTimeout(i),e))])},utils.createElement=function(e,t,r){var n=document.createElement(e);for(let e in t){let r="classname"===e.toLowerCase()?"class":e;if("dangerouslySetInnerHTML"===e&&(n.innerHTML=t[e].__html,delete t.dangerouslySetInnerHTML),t.hasOwnProperty(e)){let i=t[e];if(!0===i)n.setAttribute(r,e);else if("object"!=typeof i||Array.isArray(i))!1!==i&&null!=i&&n.setAttribute(r,i.toString());else if(["style"].includes(r))for(let e in i)n[r][e]=i[e];else n[r]=i}}for(let e=2;e<arguments.length;e++){let t=arguments[e];t&&(Array.isArray(t)?t.map(e=>n.appendChild(null==e.nodeType?document.createTextNode(e.toString()):e)):n.appendChild(null==t.nodeType?document.createTextNode(t.toString()):t))}return n},t=e.exports=utils},function(e,t,r){"use strict";(function(t){function r(e,r,n,i){if("function"!=typeof e)throw new TypeError('"callback" argument must be a function');var o=arguments.length,s,a;switch(o){case 0:case 1:return t.nextTick(e);case 2:return t.nextTick(function t(){e.call(null,r)});case 3:return t.nextTick(function t(){e.call(null,r,n)});case 4:return t.nextTick(function t(){e.call(null,r,n,i)});default:for(s=new Array(o-1),a=0;a<s.length;)s[a++]=arguments[a];return t.nextTick(function t(){e.apply(null,s)})}}!t.version||0===t.version.indexOf("v0.")||0===t.version.indexOf("v1.")&&0!==t.version.indexOf("v1.8.")?e.exports={nextTick:r}:e.exports=t}).call(this,r(6))},function(e,t,r){"use strict";(function(r){t=e.exports,t.raw=r.from("55","hex"),t.base1=r.from("01","hex"),t.base2=r.from("00","hex"),t.base8=r.from("07","hex"),t.base10=r.from("09","hex"),t.cbor=r.from("51","hex"),t.protobuf=r.from("50","hex"),t.rlp=r.from("60","hex"),t.bencode=r.from("63","hex"),t.multicodec=r.from("30","hex"),t.multihash=r.from("31","hex"),t.multiaddr=r.from("32","hex"),t.multibase=r.from("33","hex"),t.md4=r.from("d4","hex"),t.md5=r.from("d5","hex"),t.sha1=r.from("11","hex"),t["sha2-256"]=r.from("12","hex"),t["sha2-512"]=r.from("13","hex"),t["dbl-sha2-256"]=r.from("56","hex"),t["sha3-224"]=r.from("17","hex"),t["sha3-256"]=r.from("16","hex"),t["sha3-384"]=r.from("15","hex"),t["sha3-512"]=r.from("14","hex"),t["shake-128"]=r.from("18","hex"),t["shake-256"]=r.from("19","hex"),t["keccak-224"]=r.from("1a","hex"),t["keccak-256"]=r.from("1b","hex"),t["keccak-384"]=r.from("1c","hex"),t["keccak-512"]=r.from("1d","hex"),t.murmur3=r.from("22","hex"),t["blake2b-8"]=r.from("b201","hex"),t["blake2b-16"]=r.from("b202","hex"),t["blake2b-24"]=r.from("b203","hex"),t["blake2b-32"]=r.from("b204","hex"),t["blake2b-40"]=r.from("b205","hex"),t["blake2b-48"]=r.from("b206","hex"),t["blake2b-56"]=r.from("b207","hex"),t["blake2b-64"]=r.from("b208","hex"),t["blake2b-72"]=r.from("b209","hex"),t["blake2b-80"]=r.from("b20a","hex"),t["blake2b-88"]=r.from("b20b","hex"),t["blake2b-96"]=r.from("b20c","hex"),t["blake2b-104"]=r.from("b20d","hex"),t["blake2b-112"]=r.from("b20e","hex"),t["blake2b-120"]=r.from("b20f","hex"),t["blake2b-128"]=r.from("b210","hex"),t["blake2b-136"]=r.from("b211","hex"),t["blake2b-144"]=r.from("b212","hex"),t["blake2b-152"]=r.from("b213","hex"),t["blake2b-160"]=r.from("b214","hex"),t["blake2b-168"]=r.from("b215","hex"),t["blake2b-176"]=r.from("b216","hex"),t["blake2b-184"]=r.from("b217","hex"),t["blake2b-192"]=r.from("b218","hex"),t["blake2b-200"]=r.from("b219","hex"),t["blake2b-208"]=r.from("b21a","hex"),t["blake2b-216"]=r.from("b21b","hex"),t["blake2b-224"]=r.from("b21c","hex"),t["blake2b-232"]=r.from("b21d","hex"),t["blake2b-240"]=r.from("b21e","hex"),t["blake2b-248"]=r.from("b21f","hex"),t["blake2b-256"]=r.from("b220","hex"),t["blake2b-264"]=r.from("b221","hex"),t["blake2b-272"]=r.from("b222","hex"),t["blake2b-280"]=r.from("b223","hex"),t["blake2b-288"]=r.from("b224","hex"),t["blake2b-296"]=r.from("b225","hex"),t["blake2b-304"]=r.from("b226","hex"),t["blake2b-312"]=r.from("b227","hex"),t["blake2b-320"]=r.from("b228","hex"),t["blake2b-328"]=r.from("b229","hex"),t["blake2b-336"]=r.from("b22a","hex"),t["blake2b-344"]=r.from("b22b","hex"),t["blake2b-352"]=r.from("b22c","hex"),t["blake2b-360"]=r.from("b22d","hex"),t["blake2b-368"]=r.from("b22e","hex"),t["blake2b-376"]=r.from("b22f","hex"),t["blake2b-384"]=r.from("b230","hex"),t["blake2b-392"]=r.from("b231","hex"),t["blake2b-400"]=r.from("b232","hex"),t["blake2b-408"]=r.from("b233","hex"),t["blake2b-416"]=r.from("b234","hex"),t["blake2b-424"]=r.from("b235","hex"),t["blake2b-432"]=r.from("b236","hex"),t["blake2b-440"]=r.from("b237","hex"),t["blake2b-448"]=r.from("b238","hex"),t["blake2b-456"]=r.from("b239","hex"),t["blake2b-464"]=r.from("b23a","hex"),t["blake2b-472"]=r.from("b23b","hex"),t["blake2b-480"]=r.from("b23c","hex"),t["blake2b-488"]=r.from("b23d","hex"),t["blake2b-496"]=r.from("b23e","hex"),t["blake2b-504"]=r.from("b23f","hex"),t["blake2b-512"]=r.from("b240","hex"),t["blake2s-8"]=r.from("b241","hex"),t["blake2s-16"]=r.from("b242","hex"),t["blake2s-24"]=r.from("b243","hex"),t["blake2s-32"]=r.from("b244","hex"),t["blake2s-40"]=r.from("b245","hex"),t["blake2s-48"]=r.from("b246","hex"),t["blake2s-56"]=r.from("b247","hex"),t["blake2s-64"]=r.from("b248","hex"),t["blake2s-72"]=r.from("b249","hex"),t["blake2s-80"]=r.from("b24a","hex"),t["blake2s-88"]=r.from("b24b","hex"),t["blake2s-96"]=r.from("b24c","hex"),t["blake2s-104"]=r.from("b24d","hex"),t["blake2s-112"]=r.from("b24e","hex"),t["blake2s-120"]=r.from("b24f","hex"),t["blake2s-128"]=r.from("b250","hex"),t["blake2s-136"]=r.from("b251","hex"),t["blake2s-144"]=r.from("b252","hex"),t["blake2s-152"]=r.from("b253","hex"),t["blake2s-160"]=r.from("b254","hex"),t["blake2s-168"]=r.from("b255","hex"),t["blake2s-176"]=r.from("b256","hex"),t["blake2s-184"]=r.from("b257","hex"),t["blake2s-192"]=r.from("b258","hex"),t["blake2s-200"]=r.from("b259","hex"),t["blake2s-208"]=r.from("b25a","hex"),t["blake2s-216"]=r.from("b25b","hex"),t["blake2s-224"]=r.from("b25c","hex"),t["blake2s-232"]=r.from("b25d","hex"),t["blake2s-240"]=r.from("b25e","hex"),t["blake2s-248"]=r.from("b25f","hex"),t["blake2s-256"]=r.from("b260","hex"),t["skein256-8"]=r.from("b301","hex"),t["skein256-16"]=r.from("b302","hex"),t["skein256-24"]=r.from("b303","hex"),t["skein256-32"]=r.from("b304","hex"),t["skein256-40"]=r.from("b305","hex"),t["skein256-48"]=r.from("b306","hex"),t["skein256-56"]=r.from("b307","hex"),t["skein256-64"]=r.from("b308","hex"),t["skein256-72"]=r.from("b309","hex"),t["skein256-80"]=r.from("b30a","hex"),t["skein256-88"]=r.from("b30b","hex"),t["skein256-96"]=r.from("b30c","hex"),t["skein256-104"]=r.from("b30d","hex"),t["skein256-112"]=r.from("b30e","hex"),t["skein256-120"]=r.from("b30f","hex"),t["skein256-128"]=r.from("b310","hex"),t["skein256-136"]=r.from("b311","hex"),t["skein256-144"]=r.from("b312","hex"),t["skein256-152"]=r.from("b313","hex"),t["skein256-160"]=r.from("b314","hex"),t["skein256-168"]=r.from("b315","hex"),t["skein256-176"]=r.from("b316","hex"),t["skein256-184"]=r.from("b317","hex"),t["skein256-192"]=r.from("b318","hex"),t["skein256-200"]=r.from("b319","hex"),t["skein256-208"]=r.from("b31a","hex"),t["skein256-216"]=r.from("b31b","hex"),t["skein256-224"]=r.from("b31c","hex"),t["skein256-232"]=r.from("b31d","hex"),t["skein256-240"]=r.from("b31e","hex"),t["skein256-248"]=r.from("b31f","hex"),t["skein256-256"]=r.from("b320","hex"),t["skein512-8"]=r.from("b321","hex"),t["skein512-16"]=r.from("b322","hex"),t["skein512-24"]=r.from("b323","hex"),t["skein512-32"]=r.from("b324","hex"),t["skein512-40"]=r.from("b325","hex"),t["skein512-48"]=r.from("b326","hex"),t["skein512-56"]=r.from("b327","hex"),t["skein512-64"]=r.from("b328","hex"),t["skein512-72"]=r.from("b329","hex"),t["skein512-80"]=r.from("b32a","hex"),t["skein512-88"]=r.from("b32b","hex"),t["skein512-96"]=r.from("b32c","hex"),t["skein512-104"]=r.from("b32d","hex"),t["skein512-112"]=r.from("b32e","hex"),t["skein512-120"]=r.from("b32f","hex"),t["skein512-128"]=r.from("b330","hex"),t["skein512-136"]=r.from("b331","hex"),t["skein512-144"]=r.from("b332","hex"),t["skein512-152"]=r.from("b333","hex"),t["skein512-160"]=r.from("b334","hex"),t["skein512-168"]=r.from("b335","hex"),t["skein512-176"]=r.from("b336","hex"),t["skein512-184"]=r.from("b337","hex"),t["skein512-192"]=r.from("b338","hex"),t["skein512-200"]=r.from("b339","hex"),t["skein512-208"]=r.from("b33a","hex"),t["skein512-216"]=r.from("b33b","hex"),t["skein512-224"]=r.from("b33c","hex"),t["skein512-232"]=r.from("b33d","hex"),t["skein512-240"]=r.from("b33e","hex"),t["skein512-248"]=r.from("b33f","hex"),t["skein512-256"]=r.from("b340","hex"),t["skein512-264"]=r.from("b341","hex"),t["skein512-272"]=r.from("b342","hex"),t["skein512-280"]=r.from("b343","hex"),t["skein512-288"]=r.from("b344","hex"),t["skein512-296"]=r.from("b345","hex"),t["skein512-304"]=r.from("b346","hex"),t["skein512-312"]=r.from("b347","hex"),t["skein512-320"]=r.from("b348","hex"),t["skein512-328"]=r.from("b349","hex"),t["skein512-336"]=r.from("b34a","hex"),t["skein512-344"]=r.from("b34b","hex"),t["skein512-352"]=r.from("b34c","hex"),t["skein512-360"]=r.from("b34d","hex"),t["skein512-368"]=r.from("b34e","hex"),t["skein512-376"]=r.from("b34f","hex"),t["skein512-384"]=r.from("b350","hex"),t["skein512-392"]=r.from("b351","hex"),t["skein512-400"]=r.from("b352","hex"),t["skein512-408"]=r.from("b353","hex"),t["skein512-416"]=r.from("b354","hex"),t["skein512-424"]=r.from("b355","hex"),t["skein512-432"]=r.from("b356","hex"),t["skein512-440"]=r.from("b357","hex"),t["skein512-448"]=r.from("b358","hex"),t["skein512-456"]=r.from("b359","hex"),t["skein512-464"]=r.from("b35a","hex"),t["skein512-472"]=r.from("b35b","hex"),t["skein512-480"]=r.from("b35c","hex"),t["skein512-488"]=r.from("b35d","hex"),t["skein512-496"]=r.from("b35e","hex"),t["skein512-504"]=r.from("b35f","hex"),t["skein512-512"]=r.from("b360","hex"),t["skein1024-8"]=r.from("b361","hex"),t["skein1024-16"]=r.from("b362","hex"),t["skein1024-24"]=r.from("b363","hex"),t["skein1024-32"]=r.from("b364","hex"),t["skein1024-40"]=r.from("b365","hex"),t["skein1024-48"]=r.from("b366","hex"),t["skein1024-56"]=r.from("b367","hex"),t["skein1024-64"]=r.from("b368","hex"),t["skein1024-72"]=r.from("b369","hex"),t["skein1024-80"]=r.from("b36a","hex"),t["skein1024-88"]=r.from("b36b","hex"),t["skein1024-96"]=r.from("b36c","hex"),t["skein1024-104"]=r.from("b36d","hex"),t["skein1024-112"]=r.from("b36e","hex"),t["skein1024-120"]=r.from("b36f","hex"),t["skein1024-128"]=r.from("b370","hex"),t["skein1024-136"]=r.from("b371","hex"),t["skein1024-144"]=r.from("b372","hex"),t["skein1024-152"]=r.from("b373","hex"),t["skein1024-160"]=r.from("b374","hex"),t["skein1024-168"]=r.from("b375","hex"),t["skein1024-176"]=r.from("b376","hex"),t["skein1024-184"]=r.from("b377","hex"),t["skein1024-192"]=r.from("b378","hex"),t["skein1024-200"]=r.from("b379","hex"),t["skein1024-208"]=r.from("b37a","hex"),t["skein1024-216"]=r.from("b37b","hex"),t["skein1024-224"]=r.from("b37c","hex"),t["skein1024-232"]=r.from("b37d","hex"),t["skein1024-240"]=r.from("b37e","hex"),t["skein1024-248"]=r.from("b37f","hex"),t["skein1024-256"]=r.from("b380","hex"),t["skein1024-264"]=r.from("b381","hex"),t["skein1024-272"]=r.from("b382","hex"),t["skein1024-280"]=r.from("b383","hex"),t["skein1024-288"]=r.from("b384","hex"),t["skein1024-296"]=r.from("b385","hex"),t["skein1024-304"]=r.from("b386","hex"),t["skein1024-312"]=r.from("b387","hex"),t["skein1024-320"]=r.from("b388","hex"),t["skein1024-328"]=r.from("b389","hex"),t["skein1024-336"]=r.from("b38a","hex"),t["skein1024-344"]=r.from("b38b","hex"),t["skein1024-352"]=r.from("b38c","hex"),t["skein1024-360"]=r.from("b38d","hex"),t["skein1024-368"]=r.from("b38e","hex"),t["skein1024-376"]=r.from("b38f","hex"),t["skein1024-384"]=r.from("b390","hex"),t["skein1024-392"]=r.from("b391","hex"),t["skein1024-400"]=r.from("b392","hex"),t["skein1024-408"]=r.from("b393","hex"),t["skein1024-416"]=r.from("b394","hex"),t["skein1024-424"]=r.from("b395","hex"),t["skein1024-432"]=r.from("b396","hex"),t["skein1024-440"]=r.from("b397","hex"),t["skein1024-448"]=r.from("b398","hex"),t["skein1024-456"]=r.from("b399","hex"),t["skein1024-464"]=r.from("b39a","hex"),t["skein1024-472"]=r.from("b39b","hex"),t["skein1024-480"]=r.from("b39c","hex"),t["skein1024-488"]=r.from("b39d","hex"),t["skein1024-496"]=r.from("b39e","hex"),t["skein1024-504"]=r.from("b39f","hex"),t["skein1024-512"]=r.from("b3a0","hex"),t["skein1024-520"]=r.from("b3a1","hex"),t["skein1024-528"]=r.from("b3a2","hex"),t["skein1024-536"]=r.from("b3a3","hex"),t["skein1024-544"]=r.from("b3a4","hex"),t["skein1024-552"]=r.from("b3a5","hex"),t["skein1024-560"]=r.from("b3a6","hex"),t["skein1024-568"]=r.from("b3a7","hex"),t["skein1024-576"]=r.from("b3a8","hex"),t["skein1024-584"]=r.from("b3a9","hex"),t["skein1024-592"]=r.from("b3aa","hex"),t["skein1024-600"]=r.from("b3ab","hex"),t["skein1024-608"]=r.from("b3ac","hex"),t["skein1024-616"]=r.from("b3ad","hex"),t["skein1024-624"]=r.from("b3ae","hex"),t["skein1024-632"]=r.from("b3af","hex"),t["skein1024-640"]=r.from("b3b0","hex"),t["skein1024-648"]=r.from("b3b1","hex"),t["skein1024-656"]=r.from("b3b2","hex"),t["skein1024-664"]=r.from("b3b3","hex"),t["skein1024-672"]=r.from("b3b4","hex"),t["skein1024-680"]=r.from("b3b5","hex"),t["skein1024-688"]=r.from("b3b6","hex"),t["skein1024-696"]=r.from("b3b7","hex"),t["skein1024-704"]=r.from("b3b8","hex"),t["skein1024-712"]=r.from("b3b9","hex"),t["skein1024-720"]=r.from("b3ba","hex"),t["skein1024-728"]=r.from("b3bb","hex"),t["skein1024-736"]=r.from("b3bc","hex"),t["skein1024-744"]=r.from("b3bd","hex"),t["skein1024-752"]=r.from("b3be","hex"),t["skein1024-760"]=r.from("b3bf","hex"),t["skein1024-768"]=r.from("b3c0","hex"),t["skein1024-776"]=r.from("b3c1","hex"),t["skein1024-784"]=r.from("b3c2","hex"),t["skein1024-792"]=r.from("b3c3","hex"),t["skein1024-800"]=r.from("b3c4","hex"),t["skein1024-808"]=r.from("b3c5","hex"),t["skein1024-816"]=r.from("b3c6","hex"),t["skein1024-824"]=r.from("b3c7","hex"),t["skein1024-832"]=r.from("b3c8","hex"),t["skein1024-840"]=r.from("b3c9","hex"),t["skein1024-848"]=r.from("b3ca","hex"),t["skein1024-856"]=r.from("b3cb","hex"),t["skein1024-864"]=r.from("b3cc","hex"),t["skein1024-872"]=r.from("b3cd","hex"),t["skein1024-880"]=r.from("b3ce","hex"),t["skein1024-888"]=r.from("b3cf","hex"),t["skein1024-896"]=r.from("b3d0","hex"),t["skein1024-904"]=r.from("b3d1","hex"),t["skein1024-912"]=r.from("b3d2","hex"),t["skein1024-920"]=r.from("b3d3","hex"),t["skein1024-928"]=r.from("b3d4","hex"),t["skein1024-936"]=r.from("b3d5","hex"),t["skein1024-944"]=r.from("b3d6","hex"),t["skein1024-952"]=r.from("b3d7","hex"),t["skein1024-960"]=r.from("b3d8","hex"),t["skein1024-968"]=r.from("b3d9","hex"),t["skein1024-976"]=r.from("b3da","hex"),t["skein1024-984"]=r.from("b3db","hex"),t["skein1024-992"]=r.from("b3dc","hex"),t["skein1024-1000"]=r.from("b3dd","hex"),t["skein1024-1008"]=r.from("b3de","hex"),t["skein1024-1016"]=r.from("b3df","hex"),t["skein1024-1024"]=r.from("b3e0","hex"),t.ip4=r.from("04","hex"),t.ip6=r.from("29","hex"),t.tcp=r.from("06","hex"),t.udp=r.from("0111","hex"),t.dccp=r.from("21","hex"),t.sctp=r.from("84","hex"),t.udt=r.from("012d","hex"),t.utp=r.from("012e","hex"),t.ipfs=r.from("01a5","hex"),t.http=r.from("01e0","hex"),t.https=r.from("01bb","hex"),t.quic=r.from("01cc","hex"),t.ws=r.from("01dd","hex"),t.onion=r.from("01bc","hex"),t["p2p-circuit"]=r.from("0122","hex"),t["git-raw"]=r.from("78","hex"),t["dag-pb"]=r.from("70","hex"),t["dag-cbor"]=r.from("71","hex"),t["git-raw"]=r.from("78","hex"),t["eth-block"]=r.from("90","hex"),t["eth-block-list"]=r.from("91","hex"),t["eth-tx-trie"]=r.from("92","hex"),t["eth-tx"]=r.from("93","hex"),t["eth-tx-receipt-trie"]=r.from("94","hex"),t["eth-tx-receipt"]=r.from("95","hex"),t["eth-state-trie"]=r.from("96","hex"),t["eth-account-snapshot"]=r.from("97","hex"),t["eth-storage-trie"]=r.from("98","hex"),t["bitcoin-block"]=r.from("b0","hex"),t["bitcoin-tx"]=r.from("b1","hex"),t["zcash-block"]=r.from("c0","hex"),t["zcash-tx"]=r.from("c1","hex"),t["stellar-block"]=r.from("d0","hex"),t["stellar-tx"]=r.from("d1","hex"),t["torrent-info"]=r.from("7b","hex"),t["torrent-file"]=r.from("7c","hex"),t["ed25519-pub"]=r.from("ed","hex")}).call(this,r(0).Buffer)},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=f;var n=r(212),i=c(n),o=r(345),s=c(o),a=r(213),u=c(a);function c(e){return e&&e.__esModule?e:{default:e}}function f(e){return(0,s.default)(function(t,r){var n;try{n=e.apply(this,t)}catch(e){return r(e)}(0,i.default)(n)&&"function"==typeof n.then?n.then(function(e){l(r,null,e)},function(e){l(r,e.message?e:new Error(e))}):r(null,n)})}function l(e,t,r){try{e(t,r)}catch(e){(0,u.default)(h,e)}}function h(e){throw e}e.exports=t.default},function(e,t,r){"use strict";function n(e){return function(){if(null!==e){var t=e;e=null,t.apply(this,arguments)}}}Object.defineProperty(t,"__esModule",{value:!0}),t.default=n,e.exports=t.default},function(e,t,r){var n=r(157),i=r(658),o=r(659),s="[object Null]",a="[object Undefined]",u=n?n.toStringTag:void 0;function c(e){return null==e?void 0===e?a:s:u&&u in Object(e)?i(e):o(e)}e.exports=c},function(e,t,r){var n=r(158),i=n.Symbol;e.exports=i},function(e,t,r){var n=r(347),i="object"==typeof self&&self&&self.Object===Object&&self,o=n||i||Function("return this")();e.exports=o},function(e,t){function r(e){return null!=e&&"object"==typeof e}e.exports=r},function(e,t,r){"use strict";function n(e,t){return function(r,n,i){return e(r,t,n,i)}}Object.defineProperty(t,"__esModule",{value:!0}),t.default=n,e.exports=t.default},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e,t,r){var n=(0,i.default)(e)?_:w;n(e,(0,b.default)(t),r)};var n=r(125),i=v(n),o=r(217),s=v(o),a=r(349),u=v(a),c=r(160),f=v(c),l=r(54),h=v(l),p=r(155),d=v(p),y=r(105),g=v(y),m=r(32),b=v(m);function v(e){return e&&e.__esModule?e:{default:e}}function _(e,t,r){r=(0,d.default)(r||h.default);var n=0,i=0,o=e.length;function a(e,t){e?r(e):++i!==o&&t!==s.default||r(null)}for(0===o&&r(null);n<o;n++)t(e[n],n,(0,g.default)(a))}var w=(0,f.default)(u.default,1/0);e.exports=t.default},function(e,t){e.exports=function(){var e,t,r,n,i=function(i,o){e?e(i,o):i?(n=i,r=o):t=o};return i.resolve=function(i){if(e)throw new Error("already resolved");if(e=i,!e)throw new Error("no read cannot resolve!"+e);t&&i(null,t),r&&i(n,r)},i.abort=function(e){i.resolve(function(t,r){r(e||!0)})},i}},function(e,t,r){"use strict";const n=r(8);class i{constructor(e,t){this.child=e,this.transform=t}open(e){this.child.open(e)}put(e,t,r){this.child.put(this.transform.convert(e),t,r)}get(e,t){this.child.get(this.transform.convert(e),t)}has(e,t){this.child.has(this.transform.convert(e),t)}delete(e,t){this.child.delete(this.transform.convert(e),t)}batch(){const e=this.child.batch();return{put:(t,r)=>{e.put(this.transform.convert(t),r)},delete:t=>{e.delete(this.transform.convert(t))},commit:t=>{e.commit(t)}}}query(e){return n(this.child.query(e),n.map(e=>(e.key=this.transform.invert(e.key),e)))}close(e){this.child.close(e)}}e.exports=i},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=u;var n=r(161),i=a(n),o=r(32),s=a(o);function a(e){return e&&e.__esModule?e:{default:e}}function u(e){return function(t,r,n){return e(i.default,t,(0,s.default)(r),n)}}e.exports=t.default},function(e,t,r){t.source=r(162),t.through=r(723),t.sink=r(376),t.duplex=r(377)},function(e,t,r){"use strict";(function(n){const i=r(13),o=r(73),s=r(9);class a{constructor(e,t,r,o){i(r,"DAGNode needs its serialized format"),i(o,"DAGNode needs its multihash"),this._cid=new s(o),this._data=e||n.alloc(0),this._links=t||[],this._serialized=r}toJSON(){return this._json||(this._json=Object.freeze({data:this.data,links:this.links.map(e=>e.toJSON()),multihash:this._cid.toBaseEncodedString(),size:this.size})),Object.assign({},this._json)}toString(){return`DAGNode <${this._cid.toBaseEncodedString()} - data: "${this.data.toString()}", links: ${this.links.length}, size: ${this.size}>`}get data(){return this._data}set data(e){throw new Error("Can't set property: 'data' is immutable")}get links(){return this._links}set links(e){throw new Error("Can't set property: 'links' is immutable")}get serialized(){return this._serialized}set serialized(e){throw new Error("Can't set property: 'serialized' is immutable")}get size(){return void 0===this._size&&(this._size=this.links.reduce((e,t)=>e+t.size,this.serialized.length)),this._size}set size(e){throw new Error("Can't set property: 'size' is immutable")}get multihash(){return this._cid.buffer}set multihash(e){throw new Error("Can't set property: 'multihash' is immutable")}}t=e.exports=o(a,{className:"DAGNode",symbolName:"@ipld/js-ipld-dag-pb/dagnode"}),t.create=r(167),t.clone=r(746),t.addLink=r(747),t.rmLink=r(748)}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(t){const n=r(59),i=r(732),o=r(225),s=o.serialize,a=r(168),u=a.linkSort,c=r(166),f=r(93);function l(e,r,o,a){if("function"==typeof e?(a=e,e=void 0):"string"==typeof e&&(e=t.from(e)),"function"==typeof r&&(a=r,r=[]),"function"==typeof o&&(a=o,o=void 0),!t.isBuffer(e))return a(new Error("Passed 'data' is not a buffer or a string!"));o||(o="sha2-256");const l=r.map(e=>f.isDAGLink(e)?e:f.util.createDagLinkFromB58EncodedHash(e)),h=i(l,u);s({data:e,links:h},(t,r)=>{if(t)return a(t);n(r,o,(t,n)=>{if(t)return a(t);const i=new c(e,h,r,n);a(null,i)})})}e.exports=l}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(n){const i=r(93);function o(e){let t;return e.data&&e.data.length>0?(t=n.alloc(e.data.length),e.data.copy(t)):t=n.alloc(0),t}function s(e){return e.links.slice()}function a(e,t){const r=n.from(e.name||""),i=n.from(t.name||"");return r.compare(i)}function u(e){return new i("",e.size,e.multihash)}t=e.exports,t.cloneData=o,t.cloneLinks=s,t.linkSort=a,t.toDAGLink=u}).call(this,r(0).Buffer)},function(e,t,r){var n;!function(i){"use strict";var o,s=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,a=Math.ceil,u=Math.floor,c="[BigNumber Error] ",f=c+"Number primitive has more than 15 significant digits: ",l=1e14,h=14,p=9007199254740991,d=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],y=1e7,g=1e9;function m(e){var t,r,n,i=H.prototype,o=new H(1),A=20,x=4,I=-7,T=21,B=-1e7,C=1e7,P=!1,O=1,R=0,N={decimalSeparator:".",groupSeparator:",",groupSize:3,secondaryGroupSize:0,fractionGroupSeparator:" ",fractionGroupSize:0},L="0123456789abcdefghijklmnopqrstuvwxyz",j,M,K,D,U,F,q;function H(e,t){var i,o,a,c,l,d,y,g=this;if(!(g instanceof H))return new H(e,t);if(null==t){if(e instanceof H)return g.s=e.s,g.e=e.e,void(g.c=(e=e.c)?e.slice():e);if(l="number"==typeof e,l&&0*e==0){if(g.s=1/e<0?(e=-e,-1):1,e===~~e){for(a=0,c=e;c>=10;c/=10,a++);return g.e=a,void(g.c=[e])}y=e+""}else{if(!s.test(y=e+""))return n(g,y,l);g.s=45==y.charCodeAt(0)?(y=y.slice(1),-1):1}}else{if(w(t,2,L.length,"Base"),y=e+"",10==t)return g=new H(e instanceof H?e:y),W(g,A+g.e+1,x);if(l="number"==typeof e,l){if(0*e!=0)return n(g,y,l,t);if(g.s=1/e<0?(y=y.slice(1),-1):1,y.replace(/^0\.0*|\./,"").length>15)throw Error(f+e);l=!1}else g.s=45===y.charCodeAt(0)?(y=y.slice(1),-1):1,t>10&&t<37&&(y=y.toLowerCase());for(i=L.slice(0,t),a=c=0,d=y.length;c<d;c++)if(i.indexOf(o=y.charAt(c))<0){if("."==o&&c>a){a=d;continue}return n(g,e+"",l,t)}y=r(y,t,10,g.s)}for((a=y.indexOf("."))>-1&&(y=y.replace(".","")),(c=y.search(/e/i))>0?(a<0&&(a=c),a+=+y.slice(c+1),y=y.substring(0,c)):a<0&&(a=y.length),c=0;48===y.charCodeAt(c);c++);for(d=y.length;48===y.charCodeAt(--d););if(y=y.slice(c,d+1),y){if(d=y.length,l&&d>15&&(e>p||e!==u(e)))throw Error(f+g.s*e);if(a=a-c-1,a>C)g.c=g.e=null;else if(a<B)g.c=[g.e=0];else{if(g.e=a,g.c=[],c=(a+1)%h,a<0&&(c+=h),c<d){for(c&&g.c.push(+y.slice(0,c)),d-=h;c<d;)g.c.push(+y.slice(c,c+=h));y=y.slice(c),c=h-y.length}else c-=d;for(;c--;y+="0");g.c.push(+y)}}else g.c=[g.e=0]}function z(e,t,r,n){var i,o,s,a,u;if(null==r?r=x:w(r,0,8),!e.c)return e.toString();if(i=e.c[0],s=e.e,null==t)u=v(e.c),u=1==n||2==n&&s<=I?k(u,s):E(u,s,"0");else if(e=W(new H(e),t,r),o=e.e,u=v(e.c),a=u.length,1==n||2==n&&(t<=o||o<=I)){for(;a<t;u+="0",a++);u=k(u,o)}else if(t-=s,u=E(u,o,"0"),o+1>a){if(--t>0)for(u+=".";t--;u+="0");}else if(t+=o-a,t>0)for(o+1==a&&(u+=".");t--;u+="0");return e.s<0&&i?"-"+u:u}function V(e,t){var r,n,i=0;for(S(e[0])&&(e=e[0]),r=new H(e[0]);++i<e.length;){if(n=new H(e[i]),!n.s){r=n;break}t.call(r,n)&&(r=n)}return r}function G(e,t,r){for(var n=1,i=t.length;!t[--i];t.pop());for(i=t[0];i>=10;i/=10,n++);return(r=n+r*h-1)>C?e.c=e.e=null:r<B?e.c=[e.e=0]:(e.e=r,e.c=t),e}function W(e,t,r,n){var i,o,s,c,f,p,y,g=e.c,m=d;if(g){e:{for(i=1,c=g[0];c>=10;c/=10,i++);if(o=t-i,o<0)o+=h,s=t,f=g[p=0],y=f/m[i-s-1]%10|0;else if(p=a((o+1)/h),p>=g.length){if(!n)break e;for(;g.length<=p;g.push(0));f=y=0,i=1,o%=h,s=o-h+1}else{for(f=c=g[p],i=1;c>=10;c/=10,i++);o%=h,s=o-h+i,y=s<0?0:f/m[i-s-1]%10|0}if(n=n||t<0||null!=g[p+1]||(s<0?f:f%m[i-s-1]),n=r<4?(y||n)&&(0==r||r==(e.s<0?3:2)):y>5||5==y&&(4==r||n||6==r&&(o>0?s>0?f/m[i-s]:0:g[p-1])%10&1||r==(e.s<0?8:7)),t<1||!g[0])return g.length=0,n?(t-=e.e+1,g[0]=m[(h-t%h)%h],e.e=-t||0):g[0]=e.e=0,e;if(0==o?(g.length=p,c=1,p--):(g.length=p+1,c=m[h-o],g[p]=s>0?u(f/m[i-s]%m[s])*c:0),n)for(;;){if(0==p){for(o=1,s=g[0];s>=10;s/=10,o++);for(s=g[0]+=c,c=1;s>=10;s/=10,c++);o!=c&&(e.e++,g[0]==l&&(g[0]=1));break}if(g[p]+=c,g[p]!=l)break;g[p--]=0,c=1}for(o=g.length;0===g[--o];g.pop());}e.e>C?e.c=e.e=null:e.e<B&&(e.c=[e.e=0])}return e}return H.clone=m,H.ROUND_UP=0,H.ROUND_DOWN=1,H.ROUND_CEIL=2,H.ROUND_FLOOR=3,H.ROUND_HALF_UP=4,H.ROUND_HALF_DOWN=5,H.ROUND_HALF_EVEN=6,H.ROUND_HALF_CEIL=7,H.ROUND_HALF_FLOOR=8,H.EUCLID=9,H.config=H.set=function(e){var t,r;if(null!=e){if("object"!=typeof e)throw Error(c+"Object expected: "+e);if(e.hasOwnProperty(t="DECIMAL_PLACES")&&(r=e[t],w(r,0,g,t),A=r),e.hasOwnProperty(t="ROUNDING_MODE")&&(r=e[t],w(r,0,8,t),x=r),e.hasOwnProperty(t="EXPONENTIAL_AT")&&(r=e[t],S(r)?(w(r[0],-g,0,t),w(r[1],0,g,t),I=r[0],T=r[1]):(w(r,-g,g,t),I=-(T=r<0?-r:r))),e.hasOwnProperty(t="RANGE"))if(r=e[t],S(r))w(r[0],-g,-1,t),w(r[1],1,g,t),B=r[0],C=r[1];else{if(w(r,-g,g,t),!r)throw Error(c+t+" cannot be zero: "+r);B=-(C=r<0?-r:r)}if(e.hasOwnProperty(t="CRYPTO")){if(r=e[t],r!==!!r)throw Error(c+t+" not true or false: "+r);if(r){if("undefined"==typeof crypto||!crypto||!crypto.getRandomValues&&!crypto.randomBytes)throw P=!r,Error(c+"crypto unavailable");P=r}else P=r}if(e.hasOwnProperty(t="MODULO_MODE")&&(r=e[t],w(r,0,9,t),O=r),e.hasOwnProperty(t="POW_PRECISION")&&(r=e[t],w(r,0,g,t),R=r),e.hasOwnProperty(t="FORMAT")){if(r=e[t],"object"!=typeof r)throw Error(c+t+" not an object: "+r);N=r}if(e.hasOwnProperty(t="ALPHABET")){if(r=e[t],"string"!=typeof r||/^.$|\.|(.).*\1/.test(r))throw Error(c+t+" invalid: "+r);L=r}}return{DECIMAL_PLACES:A,ROUNDING_MODE:x,EXPONENTIAL_AT:[I,T],RANGE:[B,C],CRYPTO:P,MODULO_MODE:O,POW_PRECISION:R,FORMAT:N,ALPHABET:L}},H.isBigNumber=function(e){return e instanceof H||e&&!0===e._isBigNumber||!1},H.maximum=H.max=function(){return V(arguments,i.lt)},H.minimum=H.min=function(){return V(arguments,i.gt)},H.random=(j=9007199254740992,M=Math.random()*j&2097151?function(){return u(Math.random()*j)}:function(){return 8388608*(1073741824*Math.random()|0)+(8388608*Math.random()|0)},function(e){var t,r,n,i,s,f=0,l=[],p=new H(o);if(null==e?e=A:w(e,0,g),i=a(e/h),P)if(crypto.getRandomValues){for(t=crypto.getRandomValues(new Uint32Array(i*=2));f<i;)s=131072*t[f]+(t[f+1]>>>11),s>=9e15?(r=crypto.getRandomValues(new Uint32Array(2)),t[f]=r[0],t[f+1]=r[1]):(l.push(s%1e14),f+=2);f=i/2}else{if(!crypto.randomBytes)throw P=!1,Error(c+"crypto unavailable");for(t=crypto.randomBytes(i*=7);f<i;)s=281474976710656*(31&t[f])+1099511627776*t[f+1]+4294967296*t[f+2]+16777216*t[f+3]+(t[f+4]<<16)+(t[f+5]<<8)+t[f+6],s>=9e15?crypto.randomBytes(7).copy(t,f):(l.push(s%1e14),f+=7);f=i/7}if(!P)for(;f<i;)s=M(),s<9e15&&(l[f++]=s%1e14);for(i=l[--f],e%=h,i&&e&&(s=d[h-e],l[f]=u(i/s)*s);0===l[f];l.pop(),f--);if(f<0)l=[n=0];else{for(n=-1;0===l[0];l.splice(0,1),n-=h);for(f=1,s=l[0];s>=10;s/=10,f++);f<h&&(n-=h-f)}return p.e=n,p.c=l,p}),r=function(){var e="0123456789";function r(e,t,r,n){for(var i,o=[0],s,a=0,u=e.length;a<u;){for(s=o.length;s--;o[s]*=t);for(o[0]+=n.indexOf(e.charAt(a++)),i=0;i<o.length;i++)o[i]>r-1&&(null==o[i+1]&&(o[i+1]=0),o[i+1]+=o[i]/r|0,o[i]%=r)}return o.reverse()}return function(n,i,o,s,a){var u,c,f,l,h,p,d,y,g=n.indexOf("."),m=A,b=x;for(g>=0&&(l=R,R=0,n=n.replace(".",""),y=new H(i),p=y.pow(n.length-g),R=l,y.c=r(E(v(p.c),p.e,"0"),10,o,e),y.e=y.c.length),d=r(n,i,o,a?(u=L,e):(u=e,L)),f=l=d.length;0==d[--l];d.pop());if(!d[0])return u.charAt(0);if(g<0?--f:(p.c=d,p.e=f,p.s=s,p=t(p,y,m,b,o),d=p.c,h=p.r,f=p.e),c=f+m+1,g=d[c],l=o/2,h=h||c<0||null!=d[c+1],h=b<4?(null!=g||h)&&(0==b||b==(p.s<0?3:2)):g>l||g==l&&(4==b||h||6==b&&1&d[c-1]||b==(p.s<0?8:7)),c<1||!d[0])n=h?E(u.charAt(1),-m,u.charAt(0)):u.charAt(0);else{if(d.length=c,h)for(--o;++d[--c]>o;)d[c]=0,c||(++f,d=[1].concat(d));for(l=d.length;!d[--l];);for(g=0,n="";g<=l;n+=u.charAt(d[g++]));n=E(n,f,u.charAt(0))}return n}}(),t=function(){function e(e,t,r){var n,i,o,s,a=0,u=e.length,c=t%y,f=t/y|0;for(e=e.slice();u--;)o=e[u]%y,s=e[u]/y|0,n=f*o+s*c,i=c*o+n%y*y+a,a=(i/r|0)+(n/y|0)+f*s,e[u]=i%r;return a&&(e=[a].concat(e)),e}function t(e,t,r,n){var i,o;if(r!=n)o=r>n?1:-1;else for(i=o=0;i<r;i++)if(e[i]!=t[i]){o=e[i]>t[i]?1:-1;break}return o}function r(e,t,r,n){for(var i=0;r--;)e[r]-=i,i=e[r]<t[r]?1:0,e[r]=i*n+e[r]-t[r];for(;!e[0]&&e.length>1;e.splice(0,1));}return function(n,i,o,s,a){var c,f,p,d,y,g,m,v,_,w,S,k,E,A,x,I,T,B=n.s==i.s?1:-1,C=n.c,P=i.c;if(!(C&&C[0]&&P&&P[0]))return new H(n.s&&i.s&&(C?!P||C[0]!=P[0]:P)?C&&0==C[0]||!P?0*B:B/0:NaN);for(v=new H(B),_=v.c=[],f=n.e-i.e,B=o+f+1,a||(a=l,f=b(n.e/h)-b(i.e/h),B=B/h|0),p=0;P[p]==(C[p]||0);p++);if(P[p]>(C[p]||0)&&f--,B<0)_.push(1),d=!0;else{for(A=C.length,I=P.length,p=0,B+=2,y=u(a/(P[0]+1)),y>1&&(P=e(P,y,a),C=e(C,y,a),I=P.length,A=C.length),E=I,w=C.slice(0,I),S=w.length;S<I;w[S++]=0);T=P.slice(),T=[0].concat(T),x=P[0],P[1]>=a/2&&x++;do{if(y=0,c=t(P,w,I,S),c<0){if(k=w[0],I!=S&&(k=k*a+(w[1]||0)),y=u(k/x),y>1)for(y>=a&&(y=a-1),g=e(P,y,a),m=g.length,S=w.length;1==t(g,w,m,S);)y--,r(g,I<m?T:P,m,a),m=g.length,c=1;else 0==y&&(c=y=1),g=P.slice(),m=g.length;if(m<S&&(g=[0].concat(g)),r(w,g,S,a),S=w.length,-1==c)for(;t(P,w,I,S)<1;)y++,r(w,I<S?T:P,S,a),S=w.length}else 0===c&&(y++,w=[0]);_[p++]=y,w[0]?w[S++]=C[E]||0:(w=[C[E]],S=1)}while((E++<A||null!=w[0])&&B--);d=null!=w[0],_[0]||_.splice(0,1)}if(a==l){for(p=1,B=_[0];B>=10;B/=10,p++);W(v,o+(v.e=p+f*h-1)+1,s,d)}else v.e=f,v.r=+d;return v}}(),K=/^(-?)0([xbo])(?=\w[\w.]*$)/i,D=/^([^.]+)\.$/,U=/^\.([^.]+)$/,F=/^-?(Infinity|NaN)$/,q=/^\s*\+(?=[\w.])|^\s+|\s+$/g,n=function(e,t,r,n){var i,o=r?t:t.replace(q,"");if(!F.test(o)){if(!r&&(o=o.replace(K,function(e,t,r){return i="x"==(r=r.toLowerCase())?16:"b"==r?2:8,n&&n!=i?e:t}),n&&(i=n,o=o.replace(D,"$1").replace(U,"0.$1")),t!=o))return new H(o,i);throw Error(c+"Not a"+(n?" base "+n:"")+" number: "+t)}e.s=isNaN(o)?null:o<0?-1:1,e.c=e.e=null},i.absoluteValue=i.abs=function(){var e=new H(this);return e.s<0&&(e.s=1),e},i.comparedTo=function(e,t){return _(this,new H(e,t))},i.decimalPlaces=i.dp=function(e,t){var r,n,i,o=this;if(null!=e)return w(e,0,g),null==t?t=x:w(t,0,8),W(new H(o),e+o.e+1,t);if(!(r=o.c))return null;if(n=((i=r.length-1)-b(this.e/h))*h,i=r[i])for(;i%10==0;i/=10,n--);return n<0&&(n=0),n},i.dividedBy=i.div=function(e,r){return t(this,new H(e,r),A,x)},i.dividedToIntegerBy=i.idiv=function(e,r){return t(this,new H(e,r),0,1)},i.isEqualTo=i.eq=function(e,t){return 0===_(this,new H(e,t))},i.integerValue=function(e){var t=new H(this);return null==e?e=x:w(e,0,8),W(t,t.e+1,e)},i.isGreaterThan=i.gt=function(e,t){return _(this,new H(e,t))>0},i.isGreaterThanOrEqualTo=i.gte=function(e,t){return 1===(t=_(this,new H(e,t)))||0===t},i.isFinite=function(){return!!this.c},i.isInteger=function(){return!!this.c&&b(this.e/h)>this.c.length-2},i.isNaN=function(){return!this.s},i.isNegative=function(){return this.s<0},i.isPositive=function(){return this.s>0},i.isZero=function(){return!!this.c&&0==this.c[0]},i.isLessThan=i.lt=function(e,t){return _(this,new H(e,t))<0},i.isLessThanOrEqualTo=i.lte=function(e,t){return-1===(t=_(this,new H(e,t)))||0===t},i.minus=function(e,t){var r,n,i,o,s=this,a=s.s;if(e=new H(e,t),t=e.s,!a||!t)return new H(NaN);if(a!=t)return e.s=-t,s.plus(e);var u=s.e/h,c=e.e/h,f=s.c,p=e.c;if(!u||!c){if(!f||!p)return f?(e.s=-t,e):new H(p?s:NaN);if(!f[0]||!p[0])return p[0]?(e.s=-t,e):new H(f[0]?s:3==x?-0:0)}if(u=b(u),c=b(c),f=f.slice(),a=u-c){for((o=a<0)?(a=-a,i=f):(c=u,i=p),i.reverse(),t=a;t--;i.push(0));i.reverse()}else for(n=(o=(a=f.length)<(t=p.length))?a:t,a=t=0;t<n;t++)if(f[t]!=p[t]){o=f[t]<p[t];break}if(o&&(i=f,f=p,p=i,e.s=-e.s),t=(n=p.length)-(r=f.length),t>0)for(;t--;f[r++]=0);for(t=l-1;n>a;){if(f[--n]<p[n]){for(r=n;r&&!f[--r];f[r]=t);--f[r],f[n]+=l}f[n]-=p[n]}for(;0==f[0];f.splice(0,1),--c);return f[0]?G(e,f,c):(e.s=3==x?-1:1,e.c=[e.e=0],e)},i.modulo=i.mod=function(e,r){var n,i,o=this;return e=new H(e,r),!o.c||!e.s||e.c&&!e.c[0]?new H(NaN):!e.c||o.c&&!o.c[0]?new H(o):(9==O?(i=e.s,e.s=1,n=t(o,e,0,3),e.s=i,n.s*=i):n=t(o,e,0,O),o.minus(n.times(e)))},i.multipliedBy=i.times=function(e,t){var r,n,i,o,s,a,u,c,f,p,d,g,m,v,_,w=this,S=w.c,k=(e=new H(e,t)).c;if(!(S&&k&&S[0]&&k[0]))return!w.s||!e.s||S&&!S[0]&&!k||k&&!k[0]&&!S?e.c=e.e=e.s=null:(e.s*=w.s,S&&k?(e.c=[0],e.e=0):e.c=e.e=null),e;for(n=b(w.e/h)+b(e.e/h),e.s*=w.s,u=S.length,p=k.length,u<p&&(m=S,S=k,k=m,i=u,u=p,p=i),i=u+p,m=[];i--;m.push(0));for(v=l,_=y,i=p;--i>=0;){for(r=0,d=k[i]%_,g=k[i]/_|0,s=u,o=i+s;o>i;)c=S[--s]%_,f=S[s]/_|0,a=g*c+f*d,c=d*c+a%_*_+m[o]+r,r=(c/v|0)+(a/_|0)+g*f,m[o--]=c%v;m[o]=r}return r?++n:m.splice(0,1),G(e,m,n)},i.negated=function(){var e=new H(this);return e.s=-e.s||null,e},i.plus=function(e,t){var r,n=this,i=n.s;if(e=new H(e,t),t=e.s,!i||!t)return new H(NaN);if(i!=t)return e.s=-t,n.minus(e);var o=n.e/h,s=e.e/h,a=n.c,u=e.c;if(!o||!s){if(!a||!u)return new H(i/0);if(!a[0]||!u[0])return u[0]?e:new H(a[0]?n:0*i)}if(o=b(o),s=b(s),a=a.slice(),i=o-s){for(i>0?(s=o,r=u):(i=-i,r=a),r.reverse();i--;r.push(0));r.reverse()}for(i=a.length,t=u.length,i-t<0&&(r=u,u=a,a=r,t=i),i=0;t;)i=(a[--t]=a[t]+u[t]+i)/l|0,a[t]=l===a[t]?0:a[t]%l;return i&&(a=[i].concat(a),++s),G(e,a,s)},i.precision=i.sd=function(e,t){var r,n,i,o=this;if(null!=e&&e!==!!e)return w(e,1,g),null==t?t=x:w(t,0,8),W(new H(o),e,t);if(!(r=o.c))return null;if(i=r.length-1,n=i*h+1,i=r[i]){for(;i%10==0;i/=10,n--);for(i=r[0];i>=10;i/=10,n++);}return e&&o.e+1>n&&(n=o.e+1),n},i.shiftedBy=function(e){return w(e,-p,p),this.times("1e"+e)},i.squareRoot=i.sqrt=function(){var e,r,n,i,o,s=this,a=s.c,u=s.s,c=s.e,f=A+4,l=new H("0.5");if(1!==u||!a||!a[0])return new H(!u||u<0&&(!a||a[0])?NaN:a?s:1/0);if(u=Math.sqrt(+s),0==u||u==1/0?(r=v(a),(r.length+c)%2==0&&(r+="0"),u=Math.sqrt(r),c=b((c+1)/2)-(c<0||c%2),u==1/0?r="1e"+c:(r=u.toExponential(),r=r.slice(0,r.indexOf("e")+1)+c),n=new H(r)):n=new H(u+""),n.c[0])for(c=n.e,u=c+f,u<3&&(u=0);;)if(o=n,n=l.times(o.plus(t(s,o,f,1))),v(o.c).slice(0,u)===(r=v(n.c)).slice(0,u)){if(n.e<c&&--u,r=r.slice(u-3,u+1),"9999"!=r&&(i||"4999"!=r)){+r&&(+r.slice(1)||"5"!=r.charAt(0))||(W(n,n.e+A+2,1),e=!n.times(n).eq(s));break}if(!i&&(W(o,o.e+A+2,0),o.times(o).eq(s))){n=o;break}f+=4,u+=4,i=1}return W(n,n.e+A+1,x,e)},i.toExponential=function(e,t){return null!=e&&(w(e,0,g),e++),z(this,e,t,1)},i.toFixed=function(e,t){return null!=e&&(w(e,0,g),e=e+this.e+1),z(this,e,t)},i.toFormat=function(e,t){var r=this.toFixed(e,t);if(this.c){var n,i=r.split("."),o=+N.groupSize,s=+N.secondaryGroupSize,a=N.groupSeparator,u=i[0],c=i[1],f=this.s<0,l=f?u.slice(1):u,h=l.length;if(s&&(n=o,o=s,s=n,h-=n),o>0&&h>0){for(n=h%o||o,u=l.substr(0,n);n<h;n+=o)u+=a+l.substr(n,o);s>0&&(u+=a+l.slice(n)),f&&(u="-"+u)}r=c?u+N.decimalSeparator+((s=+N.fractionGroupSize)?c.replace(new RegExp("\\d{"+s+"}\\B","g"),"$&"+N.fractionGroupSeparator):c):u}return r},i.toFraction=function(e){var r,n,i,s,a,u,f,l,p,y,g,m,b=this,_=b.c;if(null!=e&&(l=new H(e),!l.isInteger()||l.lt(o)))throw Error(c+"Argument "+(l.isInteger()?"out of range: ":"not an integer: ")+e);if(!_)return b.toString();for(n=new H(o),y=i=new H(o),s=p=new H(o),m=v(_),u=n.e=m.length-b.e-1,n.c[0]=d[(f=u%h)<0?h+f:f],e=!e||l.comparedTo(n)>0?u>0?n:y:l,f=C,C=1/0,l=new H(m),p.c[0]=0;g=t(l,n,0,1),a=i.plus(g.times(s)),1!=a.comparedTo(e);)i=s,s=a,y=p.plus(g.times(a=y)),p=a,n=l.minus(g.times(a=n)),l=a;return a=t(e.minus(i),s,0,1),p=p.plus(a.times(y)),i=i.plus(a.times(s)),p.s=y.s=b.s,u*=2,r=t(y,s,u,x).minus(b).abs().comparedTo(t(p,i,u,x).minus(b).abs())<1?[y.toString(),s.toString()]:[p.toString(),i.toString()],C=f,r},i.toNumber=function(){return+this},i.exponentiatedBy=i.pow=function(e,t){var r,n,i,s,c=this;for(w(e,-p,p),null!=t&&(t=new H(t)),t?e>1&&c.gt(o)&&c.isInteger()&&t.gt(o)&&t.isInteger()?c=c.mod(t):(s=t,t=null):R&&(n=a(R/h+2)),i=new H(o),r=u(e<0?-e:e);;){if(r%2){if(i=i.times(c),!i.c)break;n?i.c.length>n&&(i.c.length=n):t&&(i=i.mod(t))}if(r=u(r/2),!r)break;c=c.times(c),n?c.c&&c.c.length>n&&(c.c.length=n):t&&(c=c.mod(t))}return t?i:(e<0&&(i=o.div(i)),s?i.mod(s):n?W(i,R,x):i)},i.toPrecision=function(e,t){return null!=e&&w(e,1,g),z(this,e,t,2)},i.toString=function(e){var t,n=this,i=n.s,o=n.e;return null===o?i?(t="Infinity",i<0&&(t="-"+t)):t="NaN":(t=v(n.c),null==e?t=o<=I||o>=T?k(t,o):E(t,o,"0"):(w(e,2,L.length,"Base"),t=r(E(t,o,"0"),10,e,i,!0)),i<0&&n.c[0]&&(t="-"+t)),t},i.valueOf=i.toJSON=function(){var e,t=this,r=t.e;return null===r?t.toString():(e=v(t.c),e=r<=I||r>=T?k(e,r):E(e,r,"0"),t.s<0?"-"+e:e)},i._isBigNumber=!0,null!=e&&H.set(e),H}function b(e){var t=0|e;return e>0||e===t?t:t-1}function v(e){for(var t,r,n=1,i=e.length,o=e[0]+"";n<i;){for(t=e[n++]+"",r=h-t.length;r--;t="0"+t);o+=t}for(i=o.length;48===o.charCodeAt(--i););return o.slice(0,i+1||1)}function _(e,t){var r,n,i=e.c,o=t.c,s=e.s,a=t.s,u=e.e,c=t.e;if(!s||!a)return null;if(r=i&&!i[0],n=o&&!o[0],r||n)return r?n?0:-a:s;if(s!=a)return s;if(r=s<0,n=u==c,!i||!o)return n?0:!i^r?1:-1;if(!n)return u>c^r?1:-1;for(a=(u=i.length)<(c=o.length)?u:c,s=0;s<a;s++)if(i[s]!=o[s])return i[s]>o[s]^r?1:-1;return u==c?0:u>c^r?1:-1}function w(e,t,r,n){if(e<t||e>r||e!==(e<0?a(e):u(e)))throw Error(c+(n||"Argument")+("number"==typeof e?e<t||e>r?" out of range: ":" not an integer: ":" not a primitive number: ")+e)}function S(e){return"[object Array]"==Object.prototype.toString.call(e)}function k(e,t){return(e.length>1?e.charAt(0)+"."+e.slice(1):e)+(t<0?"e":"e+")+t}function E(e,t,r){var n,i;if(t<0){for(i=r+".";++t;i+=r);e=i+e}else if(n=e.length,++t>n){for(i=r,t-=n;--t;i+=r);e+=i}else t<n&&(e=e.slice(0,t)+"."+e.slice(t));return e}o=m(),o.default=o.BigNumber=o,n=function(){return o}.call(t,r,t,e),void 0===n||(e.exports=n)}(this)},function(e,t,r){"use strict";const n=r(169);t.MT={POS_INT:0,NEG_INT:1,BYTE_STRING:2,UTF8_STRING:3,ARRAY:4,MAP:5,TAG:6,SIMPLE_FLOAT:7},t.TAG={DATE_STRING:0,DATE_EPOCH:1,POS_BIGINT:2,NEG_BIGINT:3,DECIMAL_FRAC:4,BIGFLOAT:5,BASE64URL_EXPECTED:21,BASE64_EXPECTED:22,BASE16_EXPECTED:23,CBOR:24,URI:32,BASE64URL:33,BASE64:34,REGEXP:35,MIME:36},t.NUMBYTES={ZERO:0,ONE:24,TWO:25,FOUR:26,EIGHT:27,INDEFINITE:31},t.SIMPLE={FALSE:20,TRUE:21,NULL:22,UNDEFINED:23},t.SYMS={NULL:Symbol("null"),UNDEFINED:Symbol("undef"),PARENT:Symbol("parent"),BREAK:Symbol("break"),STREAM:Symbol("stream")},t.SHIFT32=Math.pow(2,32),t.SHIFT16=Math.pow(2,16),t.MAX_SAFE_HIGH=2097151,t.NEG_ONE=new n(-1),t.TEN=new n(10),t.TWO=new n(2),t.PARENT={ARRAY:0,OBJECT:1,MAP:2,TAG:3,BYTE_STRING:4,UTF8_STRING:5}},function(e,t,r){"use strict";const n=r(172).SmartBuffer,i=r(335),o=r(153),s=r(14),a=r(9);t=e.exports,t.SHA1_LENGTH=i.defaultLengths[i.names.sha1],t.find=((e,t)=>{for(let r=0;r<e.length;r++)if(e[r]===t)return r;return-1}),t.parsePersonLine=(e=>{let t=e.match(/^(([^<]+)\s)?\s?<([^>]+)>\s?(\d+\s[+\-\d]+)?$/);return null===t?null:{name:t[2],email:t[3],date:t[4]}}),t.serializePersonLine=(e=>{let t=[];return e.name&&t.push(e.name),t.push("<"+e.email+">"),e.date&&t.push(e.date),t.join(" ")}),t.shaToCid=(e=>{let r=new n;return r.writeUInt8(1),r.writeBuffer(o["git-raw"]),r.writeUInt8(i.names.sha1),r.writeUInt8(t.SHA1_LENGTH),r.writeBuffer(e),r.toBuffer()}),t.cidToSha=(e=>{let t=s.decode(new a(e).multihash);return"sha1"!==t.name?null:t.digest})},function(e,t,r){"use strict";(function(e){Object.defineProperty(t,"__esModule",{value:!0});const n=r(756),i=4096,o="utf8";class s{constructor(t){if(this.length=0,this._encoding=o,this._writeOffset=0,this._readOffset=0,s.isSmartBufferOptions(t))if(t.encoding&&(n.checkEncoding(t.encoding),this._encoding=t.encoding),t.size){if(!(n.isFiniteInteger(t.size)&&t.size>0))throw new Error(n.ERRORS.INVALID_SMARTBUFFER_SIZE);this._buff=e.allocUnsafe(t.size)}else if(t.buff){if(!(t.buff instanceof e))throw new Error(n.ERRORS.INVALID_SMARTBUFFER_BUFFER);this._buff=t.buff,this.length=t.buff.length}else this._buff=e.allocUnsafe(i);else{if(void 0!==t)throw new Error(n.ERRORS.INVALID_SMARTBUFFER_OBJECT);this._buff=e.allocUnsafe(i)}}static fromSize(e,t){return new this({size:e,encoding:t})}static fromBuffer(e,t){return new this({buff:e,encoding:t})}static fromOptions(e){return new this(e)}static isSmartBufferOptions(e){const t=e;return t&&(void 0!==t.encoding||void 0!==t.size||void 0!==t.buff)}readInt8(t){return this._readNumberValue(e.prototype.readInt8,1,t)}readInt16BE(t){return this._readNumberValue(e.prototype.readInt16BE,2,t)}readInt16LE(t){return this._readNumberValue(e.prototype.readInt16LE,2,t)}readInt32BE(t){return this._readNumberValue(e.prototype.readInt32BE,4,t)}readInt32LE(t){return this._readNumberValue(e.prototype.readInt32LE,4,t)}writeInt8(t,r){return this._writeNumberValue(e.prototype.writeInt8,1,t,r),this}insertInt8(t,r){return this._insertNumberValue(e.prototype.writeInt8,1,t,r),this}writeInt16BE(t,r){return this._writeNumberValue(e.prototype.writeInt16BE,2,t,r),this}insertInt16BE(t,r){return this._insertNumberValue(e.prototype.writeInt16BE,2,t,r),this}writeInt16LE(t,r){return this._writeNumberValue(e.prototype.writeInt16LE,2,t,r),this}insertInt16LE(t,r){return this._insertNumberValue(e.prototype.writeInt16LE,2,t,r),this}writeInt32BE(t,r){return this._writeNumberValue(e.prototype.writeInt32BE,4,t,r),this}insertInt32BE(t,r){return this._insertNumberValue(e.prototype.writeInt32BE,4,t,r),this}writeInt32LE(t,r){return this._writeNumberValue(e.prototype.writeInt32LE,4,t,r),this}insertInt32LE(t,r){return this._insertNumberValue(e.prototype.writeInt32LE,4,t,r),this}readUInt8(t){return this._readNumberValue(e.prototype.readUInt8,1,t)}readUInt16BE(t){return this._readNumberValue(e.prototype.readUInt16BE,2,t)}readUInt16LE(t){return this._readNumberValue(e.prototype.readUInt16LE,2,t)}readUInt32BE(t){return this._readNumberValue(e.prototype.readUInt32BE,4,t)}readUInt32LE(t){return this._readNumberValue(e.prototype.readUInt32LE,4,t)}writeUInt8(t,r){return this._writeNumberValue(e.prototype.writeUInt8,1,t,r),this}insertUInt8(t,r){return this._insertNumberValue(e.prototype.writeUInt8,1,t,r),this}writeUInt16BE(t,r){return this._writeNumberValue(e.prototype.writeUInt16BE,2,t,r),this}insertUInt16BE(t,r){return this._insertNumberValue(e.prototype.writeUInt16BE,2,t,r),this}writeUInt16LE(t,r){return this._writeNumberValue(e.prototype.writeUInt16LE,2,t,r),this}insertUInt16LE(t,r){return this._insertNumberValue(e.prototype.writeUInt16LE,2,t,r),this}writeUInt32BE(t,r){return this._writeNumberValue(e.prototype.writeUInt32BE,4,t,r),this}insertUInt32BE(t,r){return this._insertNumberValue(e.prototype.writeUInt32BE,4,t,r),this}writeUInt32LE(t,r){return this._writeNumberValue(e.prototype.writeUInt32LE,4,t,r),this}insertUInt32LE(t,r){return this._insertNumberValue(e.prototype.writeUInt32LE,4,t,r),this}readFloatBE(t){return this._readNumberValue(e.prototype.readFloatBE,4,t)}readFloatLE(t){return this._readNumberValue(e.prototype.readFloatLE,4,t)}writeFloatBE(t,r){return this._writeNumberValue(e.prototype.writeFloatBE,4,t,r),this}insertFloatBE(t,r){return this._insertNumberValue(e.prototype.writeFloatBE,4,t,r),this}writeFloatLE(t,r){return this._writeNumberValue(e.prototype.writeFloatLE,4,t,r),this}insertFloatLE(t,r){return this._insertNumberValue(e.prototype.writeFloatLE,4,t,r),this}readDoubleBE(t){return this._readNumberValue(e.prototype.readDoubleBE,8,t)}readDoubleLE(t){return this._readNumberValue(e.prototype.readDoubleLE,8,t)}writeDoubleBE(t,r){return this._writeNumberValue(e.prototype.writeDoubleBE,8,t,r),this}insertDoubleBE(t,r){return this._insertNumberValue(e.prototype.writeDoubleBE,8,t,r),this}writeDoubleLE(t,r){return this._writeNumberValue(e.prototype.writeDoubleLE,8,t,r),this}insertDoubleLE(t,r){return this._insertNumberValue(e.prototype.writeDoubleLE,8,t,r),this}readString(e,t){let r;"number"==typeof e?(n.checkLengthValue(e),r=Math.min(e,this.length-this._readOffset)):(t=e,r=this.length-this._readOffset),void 0!==t&&n.checkEncoding(t);const i=this._buff.slice(this._readOffset,this._readOffset+r).toString(t||this._encoding);return this._readOffset+=r,i}insertString(e,t,r){return n.checkOffsetValue(t),this._handleString(e,!0,t,r)}writeString(e,t,r){return this._handleString(e,!1,t,r)}readStringNT(e){void 0!==e&&n.checkEncoding(e);let t=this.length;for(let e=this._readOffset;e<this.length;e++)if(0===this._buff[e]){t=e;break}const r=this._buff.slice(this._readOffset,t);return this._readOffset=t+1,r.toString(e||this._encoding)}insertStringNT(e,t,r){n.checkOffsetValue(t),this.insertString(e,t,r),this.insertUInt8(0,t+e.length)}writeStringNT(e,t,r){this.writeString(e,t,r),this.writeUInt8(0,"number"==typeof t?t+e.length:this.writeOffset)}readBuffer(e){void 0!==e&&n.checkLengthValue(e);const t="number"==typeof e?e:this.length,r=Math.min(this.length,this._readOffset+t),i=this._buff.slice(this._readOffset,r);return this._readOffset=r,i}insertBuffer(e,t){return n.checkOffsetValue(t),this._handleBuffer(e,!0,t)}writeBuffer(e,t){return this._handleBuffer(e,!1,t)}readBufferNT(){let e=this.length;for(let t=this._readOffset;t<this.length;t++)if(0===this._buff[t]){e=t;break}const t=this._buff.slice(this._readOffset,e);return this._readOffset=e+1,t}insertBufferNT(e,t){return n.checkOffsetValue(t),this.insertBuffer(e,t),this.insertUInt8(0,t+e.length),this}writeBufferNT(e,t){return void 0!==t&&n.checkOffsetValue(t),this.writeBuffer(e,t),this.writeUInt8(0,"number"==typeof t?t+e.length:this._writeOffset),this}clear(){return this._writeOffset=0,this._readOffset=0,this.length=0,this}remaining(){return this.length-this._readOffset}get readOffset(){return this._readOffset}set readOffset(e){n.checkOffsetValue(e),n.checkTargetOffset(e,this),this._readOffset=e}get writeOffset(){return this._writeOffset}set writeOffset(e){n.checkOffsetValue(e),n.checkTargetOffset(e,this),this._writeOffset=e}get encoding(){return this._encoding}set encoding(e){n.checkEncoding(e),this._encoding=e}get internalBuffer(){return this._buff}toBuffer(){return this._buff.slice(0,this.length)}toString(e){const t="string"==typeof e?e:this._encoding;return n.checkEncoding(t),this._buff.toString(t,0,this.length)}destroy(){return this.clear(),this}_handleString(t,r,i,o){let s=this._writeOffset,a=this._encoding;"number"==typeof i?s=i:"string"==typeof i&&(n.checkEncoding(i),a=i),"string"==typeof o&&(n.checkEncoding(o),a=o);const u=e.byteLength(t,a);return r?this.ensureInsertable(u,s):this._ensureWriteable(u,s),this._buff.write(t,s,u,a),r?this._writeOffset+=u:"number"==typeof i?this._writeOffset=Math.max(this._writeOffset,s+u):this._writeOffset+=u,this}_handleBuffer(e,t,r){const n="number"==typeof r?r:this._writeOffset;return t?this.ensureInsertable(e.length,n):this._ensureWriteable(e.length,n),e.copy(this._buff,n),t?this._writeOffset+=e.length:"number"==typeof r?this._writeOffset=Math.max(this._writeOffset,n+e.length):this._writeOffset+=e.length,this}ensureReadable(e,t){let r=this._readOffset;if(void 0!==t&&(n.checkOffsetValue(t),r=t),r<0||r+e>this.length)throw new Error(n.ERRORS.INVALID_READ_BEYOND_BOUNDS)}ensureInsertable(e,t){n.checkOffsetValue(t),this._ensureCapacity(this.length+e),t<this.length&&this._buff.copy(this._buff,t+e,t,this._buff.length),t+e>this.length?this.length=t+e:this.length+=e}_ensureWriteable(e,t){const r="number"==typeof t?t:this._writeOffset;this._ensureCapacity(r+e),r+e>this.length&&(this.length=r+e)}_ensureCapacity(t){const r=this._buff.length;if(t>r){let n=this._buff,i=3*r/2+1;i<t&&(i=t),this._buff=e.allocUnsafe(i),n.copy(this._buff,0,0,r)}}_readNumberValue(e,t,r){this.ensureReadable(t,r);const n=e.call(this._buff,"number"==typeof r?r:this._readOffset);return void 0===r&&(this._readOffset+=t),n}_insertNumberValue(e,t,r,i){n.checkOffsetValue(i),this.ensureInsertable(t,i),e.call(this._buff,r,i),this._writeOffset+=t}_writeNumberValue(e,t,r,i){if("number"==typeof i){if(i<0)throw new Error(n.ERRORS.INVALID_WRITE_BEYOND_BOUNDS);n.checkOffsetValue(i)}const o="number"==typeof i?i:this._writeOffset;this._ensureWriteable(t,o),e.call(this._buff,r,o),"number"==typeof i?this._writeOffset=Math.max(this._writeOffset,o+t):this._writeOffset+=t}}t.SmartBuffer=s}).call(this,r(0).Buffer)},function(e,t,r){"use strict";var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},i=r(798),o=r(804),s=r(13),a=r(130),u=r(56),c=r(127),f=r(2).Buffer;Object.assign(t,r(832)),t.MAX_INTEGER=new u("ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",16),t.TWO_POW256=new u("10000000000000000000000000000000000000000000000000000000000000000",16),t.KECCAK256_NULL_S="c5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470",t.SHA3_NULL_S=t.KECCAK256_NULL_S,t.KECCAK256_NULL=f.from(t.KECCAK256_NULL_S,"hex"),t.SHA3_NULL=t.KECCAK256_NULL,t.KECCAK256_RLP_ARRAY_S="1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",t.SHA3_RLP_ARRAY_S=t.KECCAK256_RLP_ARRAY_S,t.KECCAK256_RLP_ARRAY=f.from(t.KECCAK256_RLP_ARRAY_S,"hex"),t.SHA3_RLP_ARRAY=t.KECCAK256_RLP_ARRAY,t.KECCAK256_RLP_S="56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",t.SHA3_RLP_S=t.KECCAK256_RLP_S,t.KECCAK256_RLP=f.from(t.KECCAK256_RLP_S,"hex"),t.SHA3_RLP=t.KECCAK256_RLP,t.BN=u,t.rlp=a,t.secp256k1=o,t.zeros=function(e){return f.allocUnsafe(e).fill(0)},t.zeroAddress=function(){var e=20,r=t.zeros(20);return t.bufferToHex(r)},t.setLengthLeft=t.setLength=function(e,r,n){var i=t.zeros(r);return e=t.toBuffer(e),n?e.length<r?(e.copy(i),i):e.slice(0,r):e.length<r?(e.copy(i,r-e.length),i):e.slice(-r)},t.setLengthRight=function(e,r){return t.setLength(e,r,!0)},t.unpad=t.stripZeros=function(e){e=t.stripHexPrefix(e);for(var r=e[0];e.length>0&&"0"===r.toString();)e=e.slice(1),r=e[0];return e},t.toBuffer=function(e){if(!f.isBuffer(e))if(Array.isArray(e))e=f.from(e);else if("string"==typeof e)e=t.isHexString(e)?f.from(t.padToEven(t.stripHexPrefix(e)),"hex"):f.from(e);else if("number"==typeof e)e=t.intToBuffer(e);else if(null===e||void 0===e)e=f.allocUnsafe(0);else if(u.isBN(e))e=e.toArrayLike(f);else{if(!e.toArray)throw new Error("invalid type");e=f.from(e.toArray())}return e},t.bufferToInt=function(e){return new u(t.toBuffer(e)).toNumber()},t.bufferToHex=function(e){return e=t.toBuffer(e),"0x"+e.toString("hex")},t.fromSigned=function(e){return new u(e).fromTwos(256)},t.toUnsigned=function(e){return f.from(e.toTwos(256).toArray())},t.keccak=function(e,r){return e=t.toBuffer(e),r||(r=256),i("keccak"+r).update(e).digest()},t.keccak256=function(e){return t.keccak(e)},t.sha3=t.keccak,t.sha256=function(e){return e=t.toBuffer(e),c("sha256").update(e).digest()},t.ripemd160=function(e,r){e=t.toBuffer(e);var n=c("rmd160").update(e).digest();return!0===r?t.setLength(n,32):n},t.rlphash=function(e){return t.keccak(a.encode(e))},t.isValidPrivate=function(e){return o.privateKeyVerify(e)},t.isValidPublic=function(e,t){return 64===e.length?o.publicKeyVerify(f.concat([f.from([4]),e])):!!t&&o.publicKeyVerify(e)},t.pubToAddress=t.publicToAddress=function(e,r){return e=t.toBuffer(e),r&&64!==e.length&&(e=o.publicKeyConvert(e,!1).slice(1)),s(64===e.length),t.keccak(e).slice(-20)};var l=t.privateToPublic=function(e){return e=t.toBuffer(e),o.publicKeyCreate(e,!1).slice(1)};t.importPublic=function(e){return e=t.toBuffer(e),64!==e.length&&(e=o.publicKeyConvert(e,!1).slice(1)),e},t.ecsign=function(e,t){var r=o.sign(e,t),n={};return n.r=r.signature.slice(0,32),n.s=r.signature.slice(32,64),n.v=r.recovery+27,n},t.hashPersonalMessage=function(e){var r=t.toBuffer("Ethereum Signed Message:\n"+e.length.toString());return t.keccak(f.concat([r,e]))},t.ecrecover=function(e,r,n,i){var s=f.concat([t.setLength(n,32),t.setLength(i,32)],64),a=r-27;if(0!==a&&1!==a)throw new Error("Invalid signature v value");var u=o.recover(e,s,a);return o.publicKeyConvert(u,!1).slice(1)},t.toRpcSig=function(e,r,n){if(27!==e&&28!==e)throw new Error("Invalid recovery id");return t.bufferToHex(f.concat([t.setLengthLeft(r,32),t.setLengthLeft(n,32),t.toBuffer(e-27)]))},t.fromRpcSig=function(e){if(e=t.toBuffer(e),65!==e.length)throw new Error("Invalid signature length");var r=e[64];return r<27&&(r+=27),{v:r,r:e.slice(0,32),s:e.slice(32,64)}},t.privateToAddress=function(e){return t.publicToAddress(l(e))},t.isValidAddress=function(e){return/^0x[0-9a-fA-F]{40}$/.test(e)},t.isZeroAddress=function(e){var r=t.zeroAddress();return r===t.addHexPrefix(e)},t.toChecksumAddress=function(e){e=t.stripHexPrefix(e).toLowerCase();for(var r=t.keccak(e).toString("hex"),n="0x",i=0;i<e.length;i++)parseInt(r[i],16)>=8?n+=e[i].toUpperCase():n+=e[i];return n},t.isValidChecksumAddress=function(e){return t.isValidAddress(e)&&t.toChecksumAddress(e)===e},t.generateAddress=function(e,r){return e=t.toBuffer(e),r=new u(r),r=r.isZero()?null:f.from(r.toArray()),t.rlphash([e,r]).slice(-20)},t.isPrecompiled=function(e){var r=t.unpad(e);return 1===r.length&&r[0]>=1&&r[0]<=8},t.addHexPrefix=function(e){return"string"!=typeof e?e:t.isHexPrefixed(e)?e:"0x"+e},t.isValidSignature=function(e,t,r,n){var i=new u("7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a0",16),o=new u("fffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141",16);return 32===t.length&&32===r.length&&((27===e||28===e)&&(t=new u(t),r=new u(r),!(t.isZero()||t.gt(o)||r.isZero()||r.gt(o))&&(!1!==n||1!==new u(r).cmp(i))))},t.baToJSON=function(e){if(f.isBuffer(e))return"0x"+e.toString("hex");if(e instanceof Array){for(var r=[],n=0;n<e.length;n++)r.push(t.baToJSON(e[n]));return r}},t.defineProperties=function(e,r,i){if(e.raw=[],e._fields=[],e.toJSON=function(r){if(r){var n={};return e._fields.forEach(function(t){n[t]="0x"+e[t].toString("hex")}),n}return t.baToJSON(this.raw)},e.serialize=function t(){return a.encode(e.raw)},r.forEach(function(r,n){function i(){return e.raw[n]}function o(i){i=t.toBuffer(i),"00"!==i.toString("hex")||r.allowZero||(i=f.allocUnsafe(0)),r.allowLess&&r.length?(i=t.stripZeros(i),s(r.length>=i.length,"The field "+r.name+" must not have more "+r.length+" bytes")):r.allowZero&&0===i.length||!r.length||s(r.length===i.length,"The field "+r.name+" must have byte length of "+r.length),e.raw[n]=i}e._fields.push(r.name),Object.defineProperty(e,r.name,{enumerable:!0,configurable:!0,get:i,set:o}),r.default&&(e[r.name]=r.default),r.alias&&Object.defineProperty(e,r.alias,{enumerable:!1,configurable:!0,set:o,get:i})}),i)if("string"==typeof i&&(i=f.from(t.stripHexPrefix(i),"hex")),f.isBuffer(i)&&(i=a.decode(i)),Array.isArray(i)){if(i.length>e._fields.length)throw new Error("wrong number of fields in data");i.forEach(function(r,n){e[e._fields[n]]=t.toBuffer(r)})}else{if("object"!==(void 0===i?"undefined":n(i)))throw new Error("invalid data");var o=Object.keys(i);r.forEach(function(t){-1!==o.indexOf(t.name)&&(e[t.name]=i[t.name]),-1!==o.indexOf(t.alias)&&(e[t.alias]=i[t.alias])})}}},function(e,t,r){"use strict";var n=t;n.base=r(813),n.short=r(814),n.mont=r(815),n.edwards=r(816)},function(e,t,r){"use strict";var n=t;n.base=r(862),n.short=r(863),n.mont=r(864),n.edwards=r(865)},function(e,t,r){"use strict";(function(t){var n=r(15),i=r(99),o=r(133),s=r(34),a=r(30),u=r(98),c=r(111),f=r(67),l=r(179),h=r(20);function p(e,t){if(!(this instanceof p))return new p(e,t);if(e instanceof p)return e;var r=this._classifyArguments(e,t);if(!r.bn||0===r.bn.cmp(new s(0)))throw new TypeError("Number can not be equal to zero, undefined, null or false");if(!r.bn.lt(c.getN()))throw new TypeError("Number must be less than N");if(void 0===r.network)throw new TypeError('Must specify the network ("livenet" or "testnet")');return a.defineImmutable(this,{bn:r.bn,compressed:r.compressed,network:r.network}),Object.defineProperty(this,"publicKey",{configurable:!1,enumerable:!0,get:this.toPublicKey.bind(this)}),this}p.prototype._classifyArguments=function(e,r){var i={compressed:!0,network:r?u.get(r):u.defaultNetwork};if(n.isUndefined(e)||n.isNull(e))i.bn=p._getRandomBN();else if(e instanceof s)i.bn=e;else if(e instanceof t||e instanceof Uint8Array)i=p._transformBuffer(e,r);else if(e.bn&&e.network)i=p._transformObject(e);else if(!r&&u.get(e))i.bn=p._getRandomBN(),i.network=u.get(e);else{if("string"!=typeof e)throw new TypeError("First argument is an unrecognized data type.");a.isHexa(e)?i.bn=new s(new t(e,"hex")):i=p._transformWIF(e,r)}return i},p._getRandomBN=function(){var e,t;do{var r=l.getRandomBuffer(32);t=s.fromBuffer(r),e=t.lt(c.getN())}while(!e);return t},p._transformBuffer=function(e,t){var r={};if(32===e.length)return p._transformBNBuffer(e,t);if(r.network=u.get(e[0],"privatekey"),!r.network)throw new Error("Invalid network");if(t&&r.network!==u.get(t))throw new TypeError("Private key network mismatch");if(34===e.length&&1===e[33])r.compressed=!0;else{if(33!==e.length)throw new Error("Length of buffer must be 33 (uncompressed) or 34 (compressed)");r.compressed=!1}return r.bn=s.fromBuffer(e.slice(1,33)),r},p._transformBNBuffer=function(e,t){var r={};return r.network=u.get(t)||u.defaultNetwork,r.bn=s.fromBuffer(e),r.compressed=!1,r},p._transformWIF=function(e,t){return p._transformBuffer(o.decode(e),t)},p.fromBuffer=function(e,t){return new p(e,t)},p._transformObject=function(e){var t=new s(e.bn,"hex"),r=u.get(e.network);return{bn:t,network:r,compressed:e.compressed}},p.fromString=p.fromWIF=function(e){return h.checkArgument(n.isString(e),"First argument is expected to be a string."),new p(e)},p.fromObject=function(e){return h.checkArgument(n.isObject(e),"First argument is expected to be an object."),new p(e)},p.fromRandom=function(e){var t=p._getRandomBN();return new p(t,e)},p.getValidationError=function(e,t){var r;try{new p(e,t)}catch(e){r=e}return r},p.isValid=function(e,t){return!!e&&!p.getValidationError(e,t)},p.prototype.toString=function(){return this.toBuffer().toString("hex")},p.prototype.toWIF=function(){var e=this.network,r=this.compressed,n;return n=r?t.concat([new t([e.privatekey]),this.bn.toBuffer({size:32}),new t([1])]):t.concat([new t([e.privatekey]),this.bn.toBuffer({size:32})]),o.encode(n)},p.prototype.toBigNumber=function(){return this.bn},p.prototype.toBuffer=function(){return this.bn.toBuffer()},p.prototype.toPublicKey=function(){return this._pubkey||(this._pubkey=f.fromPrivateKey(this)),this._pubkey},p.prototype.toAddress=function(e){var t=this.toPublicKey();return i.fromPublicKey(t,e||this.network)},p.prototype.toObject=p.prototype.toJSON=function e(){return{bn:this.bn.toString("hex"),compressed:this.compressed,network:this.network.toString()}},p.prototype.inspect=function(){var e=this.compressed?"":", uncompressed";return"<PrivateKey: "+this.toString()+", network: "+this.network+e+">"},e.exports=p}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(t){var n=r(15),i=r(424),o=r(0),s="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz".split(""),a=function e(r){if(!(this instanceof e))return new e(r);if(t.isBuffer(r)){var n=r;this.fromBuffer(n)}else if("string"==typeof r){var i=r;this.fromString(i)}else r&&this.set(r)};a.validCharacters=function e(t){return o.Buffer.isBuffer(t)&&(t=t.toString()),n.all(n.map(t,function(e){return n.contains(s,e)}))},a.prototype.set=function(e){return this.buf=e.buf||this.buf||void 0,this},a.encode=function(e){if(!o.Buffer.isBuffer(e))throw new Error("Input should be a buffer");return i.encode(e)},a.decode=function(e){if("string"!=typeof e)throw new Error("Input should be a string");return new t(i.decode(e))},a.prototype.fromBuffer=function(e){return this.buf=e,this},a.prototype.fromString=function(e){var t=a.decode(e);return this.buf=t,this},a.prototype.toBuffer=function(){return this.buf},a.prototype.toString=function(){return a.encode(this.buf)},e.exports=a}).call(this,r(0).Buffer)},function(e,t,r){e.exports=r(249),e.exports.Input=r(250),e.exports.Output=r(87),e.exports.UnspentOutput=r(426),e.exports.Signature=r(135),e.exports.Sighash=r(86)},function(e,t,r){"use strict";(function(t,n){function i(){}i.getRandomBuffer=function(e){return t.browser?i.getRandomBufferBrowser(e):i.getRandomBufferNode(e)},i.getRandomBufferNode=function(e){var t=r(97);return t.randomBytes(e)},i.getRandomBufferBrowser=function(e){if(!window.crypto&&!window.msCrypto)throw new Error("window.crypto not available");if(window.crypto&&window.crypto.getRandomValues)var t=window.crypto;else{if(!window.msCrypto||!window.msCrypto.getRandomValues)throw new Error("window.crypto.getRandomValues not available");var t=window.msCrypto}var r=new Uint8Array(e);t.getRandomValues(r);var i=new n(r);return i},i.getPseudoRandomBuffer=function(e){for(var t=4294967296,r=new n(e),i,o=0;o<=e;o++){var s=Math.floor(o/4),a=o-4*s;0===a?(i=Math.random()*t,r[o]=255&i):r[o]=255&(i>>>=8)}return r},e.exports=i}).call(this,r(6),r(0).Buffer)},function(e,t,r){"use strict";(function(t){var n=r(15),i=r(34),o=r(24),s=r(85),a=r(58),u=r(40),c=r(30),f=r(20),l=537133055,h=function e(t){if(!(this instanceof e))return new e(t);var r=e._from(t);return this.version=r.version,this.prevHash=r.prevHash,this.merkleRoot=r.merkleRoot,this.reserved=r.reserved,this.time=r.time,this.timestamp=r.time,this.bits=r.bits,this.nonce=r.nonce,this.solution=r.solution,r.hash&&f.checkState(this.hash===r.hash,"Argument object hash property does not match block hash."),this};h._from=function e(t){var r={};if(o.isBuffer(t))r=h._fromBufferReader(s(t));else{if(!n.isObject(t))throw new TypeError("Unrecognized argument for BlockHeader");r=h._fromObject(t)}return r},h._fromObject=function e(r){f.checkArgument(r,"data is required");var i=r.prevHash,s=r.merkleRoot,a=r.reserved,u=r.nonce,c=r.solution;n.isString(r.prevHash)&&(i=o.reverse(new t(r.prevHash,"hex"))),n.isString(r.merkleRoot)&&(s=o.reverse(new t(r.merkleRoot,"hex"))),n.isString(r.reserved)&&(a=o.reverse(new t(r.reserved,"hex"))),n.isString(r.nonce)&&(u=o.reverse(new t(r.nonce,"hex"))),n.isString(r.solution)&&(c=new t(r.solution,"hex"));var l={hash:r.hash,version:r.version,prevHash:i,merkleRoot:s,reserved:a,time:r.time,timestamp:r.time,bits:r.bits,nonce:u,solution:c};return l},h.fromObject=function e(t){var r=h._fromObject(t);return new h(r)},h.fromRawBlock=function e(r){o.isBuffer(r)||(r=new t(r,"binary"));var n=s(r);n.pos=h.Constants.START_OF_HEADER;var i=h._fromBufferReader(n);return new h(i)},h.fromBuffer=function e(t){var r=h._fromBufferReader(s(t));return new h(r)},h.fromString=function e(r){var n=new t(r,"hex");return h.fromBuffer(n)},h._fromBufferReader=function e(t){var r={};r.version=t.readUInt32LE(),r.prevHash=t.read(32),r.merkleRoot=t.read(32),r.reserved=t.read(32),r.time=t.readUInt32LE(),r.bits=t.readUInt32LE(),r.nonce=t.read(32);var n=t.readVarintNum();return r.solution=t.read(n),r},h.fromBufferReader=function e(t){var r=h._fromBufferReader(t);return new h(r)},h.prototype.toObject=h.prototype.toJSON=function e(){return{hash:this.hash,version:this.version,prevHash:o.reverse(this.prevHash).toString("hex"),merkleRoot:o.reverse(this.merkleRoot).toString("hex"),reserved:o.reverse(this.reserved).toString("hex"),time:this.time,bits:this.bits,nonce:o.reverse(this.nonce).toString("hex"),solution:this.solution.toString("hex")}},h.prototype.toBuffer=function e(){return this.toBufferWriter().concat()},h.prototype.toString=function e(){return this.toBuffer().toString("hex")},h.prototype.toBufferWriter=function e(t){return t||(t=new a),t.writeUInt32LE(this.version),t.write(this.prevHash),t.write(this.merkleRoot),t.write(this.reserved),t.writeUInt32LE(this.time),t.writeUInt32LE(this.bits),t.write(this.nonce),t.writeVarintNum(this.solution.length),t.write(this.solution),t},h.prototype.getTargetDifficulty=function e(t){t=t||this.bits;for(var r=new i(16777215&t),n=8*((t>>>24)-3);n-- >0;)r=r.mul(new i(2));return r},h.prototype.getDifficulty=function e(){var t=this.getTargetDifficulty(537133055).mul(new i(Math.pow(10,8))),r=this.getTargetDifficulty(),n=t.div(r).toString(10),o=n.length-8;return n=n.slice(0,o)+"."+n.slice(o),parseFloat(n)},h.prototype._getHash=function e(){var t=this.toBuffer();return u.sha256sha256(t)};var p={configurable:!1,enumerable:!0,get:function(){return this._id||(this._id=s(this._getHash()).readReverse().toString("hex")),this._id},set:n.noop};Object.defineProperty(h.prototype,"id",p),Object.defineProperty(h.prototype,"hash",p),h.prototype.validTimestamp=function e(){var t=Math.round((new Date).getTime()/1e3);return!(this.time>t+h.Constants.MAX_TIME_OFFSET)},h.prototype.validProofOfWork=function e(){var t=new i(this.id,"hex"),r=this.getTargetDifficulty();return!(t.cmp(r)>0)},h.prototype.inspect=function e(){return"<BlockHeader "+this.id+">"},h.Constants={START_OF_HEADER:8,MAX_TIME_OFFSET:7200,LARGEST_HASH:new i("10000000000000000000000000000000000000000000000000000000000000000","hex")},e.exports=h}).call(this,r(0).Buffer)},function(e,t,r){var n=r(2).Buffer;function i(e){n.isBuffer(e)||(e=n.from(e));for(var t=e.length/4|0,r=new Array(t),i=0;i<t;i++)r[i]=e.readUInt32BE(4*i);return r}function o(e){for(var t=0;0<e.length;e++)e[0]=0}function s(e,t,r,n,i){for(var o=r[0],s=r[1],a=r[2],u=r[3],c=e[0]^t[0],f=e[1]^t[1],l=e[2]^t[2],h=e[3]^t[3],p,d,y,g,m=4,b=1;b<i;b++)p=o[c>>>24]^s[f>>>16&255]^a[l>>>8&255]^u[255&h]^t[m++],d=o[f>>>24]^s[l>>>16&255]^a[h>>>8&255]^u[255&c]^t[m++],y=o[l>>>24]^s[h>>>16&255]^a[c>>>8&255]^u[255&f]^t[m++],g=o[h>>>24]^s[c>>>16&255]^a[f>>>8&255]^u[255&l]^t[m++],c=p,f=d,l=y,h=g;return p=(n[c>>>24]<<24|n[f>>>16&255]<<16|n[l>>>8&255]<<8|n[255&h])^t[m++],d=(n[f>>>24]<<24|n[l>>>16&255]<<16|n[h>>>8&255]<<8|n[255&c])^t[m++],y=(n[l>>>24]<<24|n[h>>>16&255]<<16|n[c>>>8&255]<<8|n[255&f])^t[m++],g=(n[h>>>24]<<24|n[c>>>16&255]<<16|n[f>>>8&255]<<8|n[255&l])^t[m++],p>>>=0,d>>>=0,y>>>=0,g>>>=0,[p,d,y,g]}var a=[0,1,2,4,8,16,32,64,128,27,54],u=function(){for(var e=new Array(256),t=0;t<256;t++)e[t]=t<128?t<<1:t<<1^283;for(var r=[],n=[],i=[[],[],[],[]],o=[[],[],[],[]],s=0,a=0,u=0;u<256;++u){var c=a^a<<1^a<<2^a<<3^a<<4;c=c>>>8^255&c^99,r[s]=c,n[c]=s;var f=e[s],l=e[f],h=e[l],p=257*e[c]^16843008*c;i[0][s]=p<<24|p>>>8,i[1][s]=p<<16|p>>>16,i[2][s]=p<<8|p>>>24,i[3][s]=p,p=16843009*h^65537*l^257*f^16843008*s,o[0][c]=p<<24|p>>>8,o[1][c]=p<<16|p>>>16,o[2][c]=p<<8|p>>>24,o[3][c]=p,0===s?s=a=1:(s=f^e[e[e[h^f]]],a^=e[e[a]])}return{SBOX:r,INV_SBOX:n,SUB_MIX:i,INV_SUB_MIX:o}}();function c(e){this._key=i(e),this._reset()}c.blockSize=16,c.keySize=32,c.prototype.blockSize=c.blockSize,c.prototype.keySize=c.keySize,c.prototype._reset=function(){for(var e=this._key,t=e.length,r=t+6,n=4*(r+1),i=[],o=0;o<t;o++)i[o]=e[o];for(o=t;o<n;o++){var s=i[o-1];o%t==0?(s=s<<8|s>>>24,s=u.SBOX[s>>>24]<<24|u.SBOX[s>>>16&255]<<16|u.SBOX[s>>>8&255]<<8|u.SBOX[255&s],s^=a[o/t|0]<<24):t>6&&o%t==4&&(s=u.SBOX[s>>>24]<<24|u.SBOX[s>>>16&255]<<16|u.SBOX[s>>>8&255]<<8|u.SBOX[255&s]),i[o]=i[o-t]^s}for(var c=[],f=0;f<n;f++){var l=n-f,h=i[l-(f%4?0:4)];c[f]=f<4||l<=4?h:u.INV_SUB_MIX[0][u.SBOX[h>>>24]]^u.INV_SUB_MIX[1][u.SBOX[h>>>16&255]]^u.INV_SUB_MIX[2][u.SBOX[h>>>8&255]]^u.INV_SUB_MIX[3][u.SBOX[255&h]]}this._nRounds=r,this._keySchedule=i,this._invKeySchedule=c},c.prototype.encryptBlockRaw=function(e){return e=i(e),s(e,this._keySchedule,u.SUB_MIX,u.SBOX,this._nRounds)},c.prototype.encryptBlock=function(e){var t=this.encryptBlockRaw(e),r=n.allocUnsafe(16);return r.writeUInt32BE(t[0],0),r.writeUInt32BE(t[1],4),r.writeUInt32BE(t[2],8),r.writeUInt32BE(t[3],12),r},c.prototype.decryptBlock=function(e){e=i(e);var t=e[1];e[1]=e[3],e[3]=t;var r=s(e,this._invKeySchedule,u.INV_SUB_MIX,u.INV_SBOX,this._nRounds),o=n.allocUnsafe(16);return o.writeUInt32BE(r[0],0),o.writeUInt32BE(r[3],4),o.writeUInt32BE(r[2],8),o.writeUInt32BE(r[1],12),o},c.prototype.scrub=function(){o(this._keySchedule),o(this._invKeySchedule),o(this._key)},e.exports.AES=c},function(e,t,r){var n=r(11);function i(e,t){var r=function(){return new n.des.Algorithm(e,t)};n.cipher.registerAlgorithm(e,r)}r(256),r(438),r(16),e.exports=n.des=n.des||{},n.des.startEncrypting=function(e,t,r,n){var i=y({key:e,output:r,decrypt:!1,mode:n||(null===t?"ECB":"CBC")});return i.start(t),i},n.des.createEncryptionCipher=function(e,t){return y({key:e,output:null,decrypt:!1,mode:t})},n.des.startDecrypting=function(e,t,r,n){var i=y({key:e,output:r,decrypt:!0,mode:n||(null===t?"ECB":"CBC")});return i.start(t),i},n.des.createDecryptionCipher=function(e,t){return y({key:e,output:null,decrypt:!0,mode:t})},n.des.Algorithm=function(e,t){var r=this;r.name=e,r.mode=new t({blockSize:8,cipher:{encrypt:function(e,t){return d(r._keys,e,t,!1)},decrypt:function(e,t){return d(r._keys,e,t,!0)}}}),r._init=!1},n.des.Algorithm.prototype.initialize=function(e){if(!this._init){var t=n.util.createBuffer(e.key);if(0===this.name.indexOf("3DES")&&24!==t.length())throw new Error("Invalid Triple-DES key size: "+8*t.length());this._keys=p(t),this._init=!0}},i("DES-ECB",n.cipher.modes.ecb),i("DES-CBC",n.cipher.modes.cbc),i("DES-CFB",n.cipher.modes.cfb),i("DES-OFB",n.cipher.modes.ofb),i("DES-CTR",n.cipher.modes.ctr),i("3DES-ECB",n.cipher.modes.ecb),i("3DES-CBC",n.cipher.modes.cbc),i("3DES-CFB",n.cipher.modes.cfb),i("3DES-OFB",n.cipher.modes.ofb),i("3DES-CTR",n.cipher.modes.ctr);var o=[16843776,0,65536,16843780,16842756,66564,4,65536,1024,16843776,16843780,1024,16778244,16842756,16777216,4,1028,16778240,16778240,66560,66560,16842752,16842752,16778244,65540,16777220,16777220,65540,0,1028,66564,16777216,65536,16843780,4,16842752,16843776,16777216,16777216,1024,16842756,65536,66560,16777220,1024,4,16778244,66564,16843780,65540,16842752,16778244,16777220,1028,66564,16843776,1028,16778240,16778240,0,65540,66560,0,16842756],s=[-2146402272,-2147450880,32768,1081376,1048576,32,-2146435040,-2147450848,-2147483616,-2146402272,-2146402304,-2147483648,-2147450880,1048576,32,-2146435040,1081344,1048608,-2147450848,0,-2147483648,32768,1081376,-2146435072,1048608,-2147483616,0,1081344,32800,-2146402304,-2146435072,32800,0,1081376,-2146435040,1048576,-2147450848,-2146435072,-2146402304,32768,-2146435072,-2147450880,32,-2146402272,1081376,32,32768,-2147483648,32800,-2146402304,1048576,-2147483616,1048608,-2147450848,-2147483616,1048608,1081344,0,-2147450880,32800,-2147483648,-2146435040,-2146402272,1081344],a=[520,134349312,0,134348808,134218240,0,131592,134218240,131080,134217736,134217736,131072,134349320,131080,134348800,520,134217728,8,134349312,512,131584,134348800,134348808,131592,134218248,131584,131072,134218248,8,134349320,512,134217728,134349312,134217728,131080,520,131072,134349312,134218240,0,512,131080,134349320,134218240,134217736,512,0,134348808,134218248,131072,134217728,134349320,8,131592,131584,134217736,134348800,134218248,520,134348800,131592,8,134348808,131584],u=[8396801,8321,8321,128,8396928,8388737,8388609,8193,0,8396800,8396800,8396929,129,0,8388736,8388609,1,8192,8388608,8396801,128,8388608,8193,8320,8388737,1,8320,8388736,8192,8396928,8396929,129,8388736,8388609,8396800,8396929,129,0,0,8396800,8320,8388736,8388737,1,8396801,8321,8321,128,8396929,129,1,8192,8388609,8193,8396928,8388737,8193,8320,8388608,8396801,128,8388608,8192,8396928],c=[256,34078976,34078720,1107296512,524288,256,1073741824,34078720,1074266368,524288,33554688,1074266368,1107296512,1107820544,524544,1073741824,33554432,1074266112,1074266112,0,1073742080,1107820800,1107820800,33554688,1107820544,1073742080,0,1107296256,34078976,33554432,1107296256,524544,524288,1107296512,256,33554432,1073741824,34078720,1107296512,1074266368,33554688,1073741824,1107820544,34078976,1074266368,256,33554432,1107820544,1107820800,524544,1107296256,1107820800,34078720,0,1074266112,1107296256,524544,33554688,1073742080,524288,0,1074266112,34078976,1073742080],f=[536870928,541065216,16384,541081616,541065216,16,541081616,4194304,536887296,4210704,4194304,536870928,4194320,536887296,536870912,16400,0,4194320,536887312,16384,4210688,536887312,16,541065232,541065232,0,4210704,541081600,16400,4210688,541081600,536870912,536887296,16,541065232,4210688,541081616,4194304,16400,536870928,4194304,536887296,536870912,16400,536870928,541081616,4210688,541065216,4210704,541081600,0,541065232,16,16384,541065216,4210704,16384,4194320,536887312,0,541081600,536870912,4194320,536887312],l=[2097152,69206018,67110914,0,2048,67110914,2099202,69208064,69208066,2097152,0,67108866,2,67108864,69206018,2050,67110912,2099202,2097154,67110912,67108866,69206016,69208064,2097154,69206016,2048,2050,69208066,2099200,2,67108864,2099200,67108864,2099200,2097152,67110914,67110914,69206018,69206018,2,2097154,67108864,67110912,2097152,69208064,2050,2099202,69208064,2050,67108866,69208066,69206016,2099200,0,2,69208066,0,2099202,69206016,2048,67108866,67110912,2048,2097154],h=[268439616,4096,262144,268701760,268435456,268439616,64,268435456,262208,268697600,268701760,266240,268701696,266304,4096,64,268697600,268435520,268439552,4160,266240,262208,268697664,268701696,4160,0,0,268697664,268435520,268439552,266304,262144,266304,262144,268701696,4096,64,268697664,4096,266304,268439552,64,268435520,268697600,268697664,268435456,262144,268439616,0,268701760,262208,268435520,268697600,268439552,268439616,0,268701760,266240,266240,4160,4160,262208,268435456,268701696];function p(e){for(var t=[0,4,536870912,536870916,65536,65540,536936448,536936452,512,516,536871424,536871428,66048,66052,536936960,536936964],r=[0,1,1048576,1048577,67108864,67108865,68157440,68157441,256,257,1048832,1048833,67109120,67109121,68157696,68157697],n=[0,8,2048,2056,16777216,16777224,16779264,16779272,0,8,2048,2056,16777216,16777224,16779264,16779272],i=[0,2097152,134217728,136314880,8192,2105344,134225920,136323072,131072,2228224,134348800,136445952,139264,2236416,134356992,136454144],o=[0,262144,16,262160,0,262144,16,262160,4096,266240,4112,266256,4096,266240,4112,266256],s=[0,1024,32,1056,0,1024,32,1056,33554432,33555456,33554464,33555488,33554432,33555456,33554464,33555488],a=[0,268435456,524288,268959744,2,268435458,524290,268959746,0,268435456,524288,268959744,2,268435458,524290,268959746],u=[0,65536,2048,67584,536870912,536936448,536872960,536938496,131072,196608,133120,198656,537001984,537067520,537004032,537069568],c=[0,262144,0,262144,2,262146,2,262146,33554432,33816576,33554432,33816576,33554434,33816578,33554434,33816578],f=[0,268435456,8,268435464,0,268435456,8,268435464,1024,268436480,1032,268436488,1024,268436480,1032,268436488],l=[0,32,0,32,1048576,1048608,1048576,1048608,8192,8224,8192,8224,1056768,1056800,1056768,1056800],h=[0,16777216,512,16777728,2097152,18874368,2097664,18874880,67108864,83886080,67109376,83886592,69206016,85983232,69206528,85983744],p=[0,4096,134217728,134221824,524288,528384,134742016,134746112,16,4112,134217744,134221840,524304,528400,134742032,134746128],d=[0,4,256,260,0,4,256,260,1,5,257,261,1,5,257,261],y=e.length()>8?3:1,g=[],m=[0,0,1,1,1,1,1,1,0,1,1,1,1,1,1,0],b=0,v,_=0;_<y;_++){var w=e.getInt32(),S=e.getInt32();v=252645135&(w>>>4^S),S^=v,w^=v<<4,v=65535&(S>>>-16^w),w^=v,S^=v<<-16,v=858993459&(w>>>2^S),S^=v,w^=v<<2,v=65535&(S>>>-16^w),w^=v,S^=v<<-16,v=1431655765&(w>>>1^S),S^=v,w^=v<<1,v=16711935&(S>>>8^w),w^=v,S^=v<<8,v=1431655765&(w>>>1^S),S^=v,w^=v<<1,v=w<<8|S>>>20&240,w=S<<24|S<<8&16711680|S>>>8&65280|S>>>24&240,S=v;for(var k=0;k<m.length;++k){m[k]?(w=w<<2|w>>>26,S=S<<2|S>>>26):(w=w<<1|w>>>27,S=S<<1|S>>>27),w&=-15,S&=-15;var E=t[w>>>28]|r[w>>>24&15]|n[w>>>20&15]|i[w>>>16&15]|o[w>>>12&15]|s[w>>>8&15]|a[w>>>4&15],A=u[S>>>28]|c[S>>>24&15]|f[S>>>20&15]|l[S>>>16&15]|h[S>>>12&15]|p[S>>>8&15]|d[S>>>4&15];v=65535&(A>>>16^E),g[b++]=E^v,g[b++]=A^v<<16}}return g}function d(e,t,r,n){var i=32===e.length?3:9,p,d;p=3===i?n?[30,-2,-2]:[0,32,2]:n?[94,62,-2,32,64,2,30,-2,-2]:[0,32,2,62,30,-2,64,96,2];var y=t[0],g=t[1];d=252645135&(y>>>4^g),g^=d,y^=d<<4,d=65535&(y>>>16^g),g^=d,y^=d<<16,d=858993459&(g>>>2^y),y^=d,g^=d<<2,d=16711935&(g>>>8^y),y^=d,g^=d<<8,d=1431655765&(y>>>1^g),g^=d,y^=d<<1,y=y<<1|y>>>31,g=g<<1|g>>>31;for(var m=0;m<i;m+=3){for(var b=p[m+1],v=p[m+2],_=p[m];_!=b;_+=v){var w=g^e[_],S=(g>>>4|g<<28)^e[_+1];d=y,y=g,g=d^(s[w>>>24&63]|u[w>>>16&63]|f[w>>>8&63]|h[63&w]|o[S>>>24&63]|a[S>>>16&63]|c[S>>>8&63]|l[63&S])}d=y,y=g,g=d}y=y>>>1|y<<31,g=g>>>1|g<<31,d=1431655765&(y>>>1^g),g^=d,y^=d<<1,d=16711935&(g>>>8^y),y^=d,g^=d<<8,d=858993459&(g>>>2^y),y^=d,g^=d<<2,d=65535&(y>>>16^g),g^=d,y^=d<<16,d=252645135&(y>>>4^g),g^=d,y^=d<<4,r[0]=y,r[1]=g}function y(e){e=e||{};var t=(e.mode||"CBC").toUpperCase(),r="DES-"+t,i;i=e.decrypt?n.cipher.createDecipher(r,e.key):n.cipher.createCipher(r,e.key);var o=i.start;return i.start=function(e,t){var r=null;t instanceof n.util.ByteBuffer&&(r=t,t={}),t=t||{},t.output=r,t.iv=e,o.call(i,t)},i}},function(e,t,r){var n=r(11);if(r(77),r(184),r(101),r(446),r(447),r(63),r(16),void 0===i)var i=n.jsbn.BigInteger;var o=n.asn1;n.pki=n.pki||{},e.exports=n.pki.rsa=n.rsa=n.rsa||{};var s=n.pki,a=[6,4,2,4,2,4,6,2],u={name:"PrivateKeyInfo",tagClass:o.Class.UNIVERSAL,type:o.Type.SEQUENCE,constructed:!0,value:[{name:"PrivateKeyInfo.version",tagClass:o.Class.UNIVERSAL,type:o.Type.INTEGER,constructed:!1,capture:"privateKeyVersion"},{name:"PrivateKeyInfo.privateKeyAlgorithm",tagClass:o.Class.UNIVERSAL,type:o.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:o.Class.UNIVERSAL,type:o.Type.OID,constructed:!1,capture:"privateKeyOid"}]},{name:"PrivateKeyInfo",tagClass:o.Class.UNIVERSAL,type:o.Type.OCTETSTRING,constructed:!1,capture:"privateKey"}]},c={name:"RSAPrivateKey",tagClass:o.Class.UNIVERSAL,type:o.Type.SEQUENCE,constructed:!0,value:[{name:"RSAPrivateKey.version",tagClass:o.Class.UNIVERSAL,type:o.Type.INTEGER,constructed:!1,capture:"privateKeyVersion"},{name:"RSAPrivateKey.modulus",tagClass:o.Class.UNIVERSAL,type:o.Type.INTEGER,constructed:!1,capture:"privateKeyModulus"},{name:"RSAPrivateKey.publicExponent",tagClass:o.Class.UNIVERSAL,type:o.Type.INTEGER,constructed:!1,capture:"privateKeyPublicExponent"},{name:"RSAPrivateKey.privateExponent",tagClass:o.Class.UNIVERSAL,type:o.Type.INTEGER,constructed:!1,capture:"privateKeyPrivateExponent"},{name:"RSAPrivateKey.prime1",tagClass:o.Class.UNIVERSAL,type:o.Type.INTEGER,constructed:!1,capture:"privateKeyPrime1"},{name:"RSAPrivateKey.prime2",tagClass:o.Class.UNIVERSAL,type:o.Type.INTEGER,constructed:!1,capture:"privateKeyPrime2"},{name:"RSAPrivateKey.exponent1",tagClass:o.Class.UNIVERSAL,type:o.Type.INTEGER,constructed:!1,capture:"privateKeyExponent1"},{name:"RSAPrivateKey.exponent2",tagClass:o.Class.UNIVERSAL,type:o.Type.INTEGER,constructed:!1,capture:"privateKeyExponent2"},{name:"RSAPrivateKey.coefficient",tagClass:o.Class.UNIVERSAL,type:o.Type.INTEGER,constructed:!1,capture:"privateKeyCoefficient"}]},f={name:"RSAPublicKey",tagClass:o.Class.UNIVERSAL,type:o.Type.SEQUENCE,constructed:!0,value:[{name:"RSAPublicKey.modulus",tagClass:o.Class.UNIVERSAL,type:o.Type.INTEGER,constructed:!1,capture:"publicKeyModulus"},{name:"RSAPublicKey.exponent",tagClass:o.Class.UNIVERSAL,type:o.Type.INTEGER,constructed:!1,capture:"publicKeyExponent"}]},l=n.pki.rsa.publicKeyValidator={name:"SubjectPublicKeyInfo",tagClass:o.Class.UNIVERSAL,type:o.Type.SEQUENCE,constructed:!0,captureAsn1:"subjectPublicKeyInfo",value:[{name:"SubjectPublicKeyInfo.AlgorithmIdentifier",tagClass:o.Class.UNIVERSAL,type:o.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:o.Class.UNIVERSAL,type:o.Type.OID,constructed:!1,capture:"publicKeyOid"}]},{name:"SubjectPublicKeyInfo.subjectPublicKey",tagClass:o.Class.UNIVERSAL,type:o.Type.BITSTRING,constructed:!1,value:[{name:"SubjectPublicKeyInfo.subjectPublicKey.RSAPublicKey",tagClass:o.Class.UNIVERSAL,type:o.Type.SEQUENCE,constructed:!0,optional:!0,captureAsn1:"rsaPublicKey"}]}]},h=function(e){var t;if(!(e.algorithm in s.oids)){var r=new Error("Unknown message digest algorithm.");throw r.algorithm=e.algorithm,r}t=s.oids[e.algorithm];var n=o.oidToDer(t).getBytes(),i=o.create(o.Class.UNIVERSAL,o.Type.SEQUENCE,!0,[]),a=o.create(o.Class.UNIVERSAL,o.Type.SEQUENCE,!0,[]);a.value.push(o.create(o.Class.UNIVERSAL,o.Type.OID,!1,n)),a.value.push(o.create(o.Class.UNIVERSAL,o.Type.NULL,!1,""));var u=o.create(o.Class.UNIVERSAL,o.Type.OCTETSTRING,!1,e.digest().getBytes());return i.value.push(a),i.value.push(u),o.toDer(i).getBytes()},p=function(e,t,r){if(r)return e.modPow(t.e,t.n);if(!t.p||!t.q)return e.modPow(t.d,t.n);var o;t.dP||(t.dP=t.d.mod(t.p.subtract(i.ONE))),t.dQ||(t.dQ=t.d.mod(t.q.subtract(i.ONE))),t.qInv||(t.qInv=t.q.modInverse(t.p));do{o=new i(n.util.bytesToHex(n.random.getBytes(t.n.bitLength()/8)),16)}while(o.compareTo(t.n)>=0||!o.gcd(t.n).equals(i.ONE));e=e.multiply(o.modPow(t.e,t.n)).mod(t.n);for(var s=e.mod(t.p).modPow(t.dP,t.p),a=e.mod(t.q).modPow(t.dQ,t.q);s.compareTo(a)<0;)s=s.add(t.p);var u=s.subtract(a).multiply(t.qInv).mod(t.p).multiply(t.q).add(a);return u=u.multiply(o.modInverse(t.n)).mod(t.n),u};function d(e,t,r){var i=n.util.createBuffer(),o=Math.ceil(t.n.bitLength()/8);if(e.length>o-11){var s=new Error("Message is too long for PKCS#1 v1.5 padding.");throw s.length=e.length,s.max=o-11,s}i.putByte(0),i.putByte(r);var a=o-3-e.length,u;if(0===r||1===r){u=0===r?0:255;for(var c=0;c<a;++c)i.putByte(u)}else for(;a>0;){for(var f=0,l=n.random.getBytes(a),c=0;c<a;++c)u=l.charCodeAt(c),0===u?++f:i.putByte(u);a=f}return i.putByte(0),i.putBytes(e),i}function y(e,t,r,i){var o=Math.ceil(t.n.bitLength()/8),s=n.util.createBuffer(e),a=s.getByte(),u=s.getByte();if(0!==a||r&&0!==u&&1!==u||!r&&2!=u||r&&0===u&&void 0===i)throw new Error("Encryption block is invalid.");var c=0;if(0===u){c=o-3-i;for(var f=0;f<c;++f)if(0!==s.getByte())throw new Error("Encryption block is invalid.")}else if(1===u)for(c=0;s.length()>1;){if(255!==s.getByte()){--s.read;break}++c}else if(2===u)for(c=0;s.length()>1;){if(0===s.getByte()){--s.read;break}++c}var l=s.getByte();if(0!==l||c!==o-3-s.length())throw new Error("Encryption block is invalid.");return s.getBytes()}function g(e,t,r){"function"==typeof t&&(r=t,t={}),t=t||{};var o={algorithm:{name:t.algorithm||"PRIMEINC",options:{workers:t.workers||2,workLoad:t.workLoad||100,workerScript:t.workerScript}}};function a(){u(e.pBits,function(t,n){return t?r(t):(e.p=n,null!==e.q?c(t,e.q):void u(e.qBits,c))})}function u(e,t){n.prime.generateProbablePrime(e,o,t)}function c(t,n){if(t)return r(t);if(e.q=n,e.p.compareTo(e.q)<0){var o=e.p;e.p=e.q,e.q=o}if(0!==e.p.subtract(i.ONE).gcd(e.e).compareTo(i.ONE))return e.p=null,void a();if(0!==e.q.subtract(i.ONE).gcd(e.e).compareTo(i.ONE))return e.q=null,void u(e.qBits,c);if(e.p1=e.p.subtract(i.ONE),e.q1=e.q.subtract(i.ONE),e.phi=e.p1.multiply(e.q1),0!==e.phi.gcd(e.e).compareTo(i.ONE))return e.p=e.q=null,void a();if(e.n=e.p.multiply(e.q),e.n.bitLength()!==e.bits)return e.q=null,void u(e.qBits,c);var f=e.e.modInverse(e.phi);e.keys={privateKey:s.rsa.setPrivateKey(e.n,e.e,f,e.p,e.q,f.mod(e.p1),f.mod(e.q1),e.q.modInverse(e.p)),publicKey:s.rsa.setPublicKey(e.n,e.e)},r(null,e.keys)}"prng"in t&&(o.prng=t.prng),a()}function m(e){var t=e.toString(16);t[0]>="8"&&(t="00"+t);var r=n.util.hexToBytes(t);return r.length>1&&(0===r.charCodeAt(0)&&0==(128&r.charCodeAt(1))||255===r.charCodeAt(0)&&128==(128&r.charCodeAt(1)))?r.substr(1):r}function b(e){return e<=100?27:e<=150?18:e<=200?15:e<=250?12:e<=300?9:e<=350?8:e<=400?7:e<=500?6:e<=600?5:e<=800?4:e<=1250?3:2}function v(e){return"undefined"!=typeof window&&"object"==typeof window.crypto&&"object"==typeof window.crypto.subtle&&"function"==typeof window.crypto.subtle[e]}function _(e){return"undefined"!=typeof window&&"object"==typeof window.msCrypto&&"object"==typeof window.msCrypto.subtle&&"function"==typeof window.msCrypto.subtle[e]}function w(e){for(var t=n.util.hexToBytes(e.toString(16)),r=new Uint8Array(t.length),i=0;i<t.length;++i)r[i]=t.charCodeAt(i);return r}function S(e){if("RSA"!==e.kty)throw new Error('Unsupported key algorithm "'+e.kty+'"; algorithm must be "RSA".');return s.setRsaPrivateKey(E(e.n),E(e.e),E(e.d),E(e.p),E(e.q),E(e.dp),E(e.dq),E(e.qi))}function k(e){if("RSA"!==e.kty)throw new Error('Key algorithm must be "RSA".');return s.setRsaPublicKey(E(e.n),E(e.e))}function E(e){return new i(n.util.bytesToHex(n.util.decode64(e)),16)}s.rsa.encrypt=function(e,t,r){var o=r,s,a=Math.ceil(t.n.bitLength()/8);!1!==r&&!0!==r?(o=2===r,s=d(e,t,r)):(s=n.util.createBuffer(),s.putBytes(e));for(var u=new i(s.toHex(),16),c=p(u,t,o),f=c.toString(16),l=n.util.createBuffer(),h=a-Math.ceil(f.length/2);h>0;)l.putByte(0),--h;return l.putBytes(n.util.hexToBytes(f)),l.getBytes()},s.rsa.decrypt=function(e,t,r,o){var s=Math.ceil(t.n.bitLength()/8);if(e.length!==s){var a=new Error("Encrypted message length is invalid.");throw a.length=e.length,a.expected=s,a}var u=new i(n.util.createBuffer(e).toHex(),16);if(u.compareTo(t.n)>=0)throw new Error("Encrypted message is invalid.");for(var c=p(u,t,r),f=c.toString(16),l=n.util.createBuffer(),h=s-Math.ceil(f.length/2);h>0;)l.putByte(0),--h;return l.putBytes(n.util.hexToBytes(f)),!1!==o?y(l.getBytes(),t,r):l.getBytes()},s.rsa.createKeyPairGenerationState=function(e,t,r){"string"==typeof e&&(e=parseInt(e,10)),e=e||2048,r=r||{};var o=r.prng||n.random,s={nextBytes:function(e){for(var t=o.getBytesSync(e.length),r=0;r<e.length;++r)e[r]=t.charCodeAt(r)}},a=r.algorithm||"PRIMEINC",u;if("PRIMEINC"!==a)throw new Error("Invalid key generation algorithm: "+a);return u={algorithm:a,state:0,bits:e,rng:s,eInt:t||65537,e:new i(null),p:null,q:null,qBits:e>>1,pBits:e-(e>>1),pqState:0,num:null,keys:null},u.e.fromInt(u.eInt),u},s.rsa.stepKeyPairGenerationState=function(e,t){"algorithm"in e||(e.algorithm="PRIMEINC");var r=new i(null);r.fromInt(30);for(var n=0,o=function(e,t){return e|t},u=+new Date,c,f=0;null===e.keys&&(t<=0||f<t);){if(0===e.state){var l=null===e.p?e.pBits:e.qBits,h=l-1;0===e.pqState?(e.num=new i(l,e.rng),e.num.testBit(h)||e.num.bitwiseTo(i.ONE.shiftLeft(h),o,e.num),e.num.dAddOffset(31-e.num.mod(r).byteValue(),0),n=0,++e.pqState):1===e.pqState?e.num.bitLength()>l?e.pqState=0:e.num.isProbablePrime(b(e.num.bitLength()))?++e.pqState:e.num.dAddOffset(a[n++%8],0):2===e.pqState?e.pqState=0===e.num.subtract(i.ONE).gcd(e.e).compareTo(i.ONE)?3:0:3===e.pqState&&(e.pqState=0,null===e.p?e.p=e.num:e.q=e.num,null!==e.p&&null!==e.q&&++e.state,e.num=null)}else if(1===e.state)e.p.compareTo(e.q)<0&&(e.num=e.p,e.p=e.q,e.q=e.num),++e.state;else if(2===e.state)e.p1=e.p.subtract(i.ONE),e.q1=e.q.subtract(i.ONE),e.phi=e.p1.multiply(e.q1),++e.state;else if(3===e.state)0===e.phi.gcd(e.e).compareTo(i.ONE)?++e.state:(e.p=null,e.q=null,e.state=0);else if(4===e.state)e.n=e.p.multiply(e.q),e.n.bitLength()===e.bits?++e.state:(e.q=null,e.state=0);else if(5===e.state){var p=e.e.modInverse(e.phi);e.keys={privateKey:s.rsa.setPrivateKey(e.n,e.e,p,e.p,e.q,p.mod(e.p1),p.mod(e.q1),e.q.modInverse(e.p)),publicKey:s.rsa.setPublicKey(e.n,e.e)}}c=+new Date,f+=c-u,u=c}return null!==e.keys},s.rsa.generateKeyPair=function(e,t,r,i){if(1===arguments.length?"object"==typeof e?(r=e,e=void 0):"function"==typeof e&&(i=e,e=void 0):2===arguments.length?"number"==typeof e?"function"==typeof t?(i=t,t=void 0):"number"!=typeof t&&(r=t,t=void 0):(r=e,i=t,e=void 0,t=void 0):3===arguments.length&&("number"==typeof t?"function"==typeof r&&(i=r,r=void 0):(i=r,r=t,t=void 0)),r=r||{},void 0===e&&(e=r.bits||2048),void 0===t&&(t=r.e||65537),!n.options.usePureJavaScript&&i&&e>=256&&e<=16384&&(65537===t||3===t)){if(v("generateKey")&&v("exportKey"))return window.crypto.subtle.generateKey({name:"RSASSA-PKCS1-v1_5",modulusLength:e,publicExponent:w(t),hash:{name:"SHA-256"}},!0,["sign","verify"]).then(function(e){return window.crypto.subtle.exportKey("pkcs8",e.privateKey)}).then(void 0,function(e){i(e)}).then(function(e){if(e){var t=s.privateKeyFromAsn1(o.fromDer(n.util.createBuffer(e)));i(null,{privateKey:t,publicKey:s.setRsaPublicKey(t.n,t.e)})}});if(_("generateKey")&&_("exportKey")){var a=window.msCrypto.subtle.generateKey({name:"RSASSA-PKCS1-v1_5",modulusLength:e,publicExponent:w(t),hash:{name:"SHA-256"}},!0,["sign","verify"]);return a.oncomplete=function(e){var t=e.target.result,r=window.msCrypto.subtle.exportKey("pkcs8",t.privateKey);r.oncomplete=function(e){var t=e.target.result,r=s.privateKeyFromAsn1(o.fromDer(n.util.createBuffer(t)));i(null,{privateKey:r,publicKey:s.setRsaPublicKey(r.n,r.e)})},r.onerror=function(e){i(e)}},void(a.onerror=function(e){i(e)})}}var u=s.rsa.createKeyPairGenerationState(e,t,r);if(!i)return s.rsa.stepKeyPairGenerationState(u,0),u.keys;g(u,r,i)},s.setRsaPublicKey=s.rsa.setPublicKey=function(e,t){var r={n:e,e:t,encrypt:function(e,t,i){if("string"==typeof t?t=t.toUpperCase():void 0===t&&(t="RSAES-PKCS1-V1_5"),"RSAES-PKCS1-V1_5"===t)t={encode:function(e,t,r){return d(e,t,2).getBytes()}};else if("RSA-OAEP"===t||"RSAES-OAEP"===t)t={encode:function(e,t){return n.pkcs1.encode_rsa_oaep(t,e,i)}};else if(-1!==["RAW","NONE","NULL",null].indexOf(t))t={encode:function(e){return e}};else if("string"==typeof t)throw new Error('Unsupported encryption scheme: "'+t+'".');var o=t.encode(e,r,!0);return s.rsa.encrypt(o,r,!0)},verify:function(e,t,n){"string"==typeof n?n=n.toUpperCase():void 0===n&&(n="RSASSA-PKCS1-V1_5"),"RSASSA-PKCS1-V1_5"===n?n={verify:function(e,t){t=y(t,r,!0);var n=o.fromDer(t);return e===n.value[1].value}}:"NONE"!==n&&"NULL"!==n&&null!==n||(n={verify:function(e,t){return t=y(t,r,!0),e===t}});var i=s.rsa.decrypt(t,r,!0,!1);return n.verify(e,i,r.n.bitLength())}};return r},s.setRsaPrivateKey=s.rsa.setPrivateKey=function(e,t,r,i,o,a,u,c){var f={n:e,e:t,d:r,p:i,q:o,dP:a,dQ:u,qInv:c,decrypt:function(e,t,r){"string"==typeof t?t=t.toUpperCase():void 0===t&&(t="RSAES-PKCS1-V1_5");var i=s.rsa.decrypt(e,f,!1,!1);if("RSAES-PKCS1-V1_5"===t)t={decode:y};else if("RSA-OAEP"===t||"RSAES-OAEP"===t)t={decode:function(e,t){return n.pkcs1.decode_rsa_oaep(t,e,r)}};else{if(-1===["RAW","NONE","NULL",null].indexOf(t))throw new Error('Unsupported encryption scheme: "'+t+'".');t={decode:function(e){return e}}}return t.decode(i,f,!1)},sign:function(e,t){var r=!1;"string"==typeof t&&(t=t.toUpperCase()),void 0===t||"RSASSA-PKCS1-V1_5"===t?(t={encode:h},r=1):"NONE"!==t&&"NULL"!==t&&null!==t||(t={encode:function(){return e}},r=1);var n=t.encode(e,f.n.bitLength());return s.rsa.encrypt(n,f,r)}};return f},s.wrapRsaPrivateKey=function(e){return o.create(o.Class.UNIVERSAL,o.Type.SEQUENCE,!0,[o.create(o.Class.UNIVERSAL,o.Type.INTEGER,!1,o.integerToDer(0).getBytes()),o.create(o.Class.UNIVERSAL,o.Type.SEQUENCE,!0,[o.create(o.Class.UNIVERSAL,o.Type.OID,!1,o.oidToDer(s.oids.rsaEncryption).getBytes()),o.create(o.Class.UNIVERSAL,o.Type.NULL,!1,"")]),o.create(o.Class.UNIVERSAL,o.Type.OCTETSTRING,!1,o.toDer(e).getBytes())])},s.privateKeyFromAsn1=function(e){var t={},r=[],a,f,l,h,p,d,y,g;if(o.validate(e,u,t,r)&&(e=o.fromDer(n.util.createBuffer(t.privateKey))),t={},r=[],!o.validate(e,c,t,r)){var m=new Error("Cannot read private key. ASN.1 object does not contain an RSAPrivateKey.");throw m.errors=r,m}return a=n.util.createBuffer(t.privateKeyModulus).toHex(),f=n.util.createBuffer(t.privateKeyPublicExponent).toHex(),l=n.util.createBuffer(t.privateKeyPrivateExponent).toHex(),h=n.util.createBuffer(t.privateKeyPrime1).toHex(),p=n.util.createBuffer(t.privateKeyPrime2).toHex(),d=n.util.createBuffer(t.privateKeyExponent1).toHex(),y=n.util.createBuffer(t.privateKeyExponent2).toHex(),g=n.util.createBuffer(t.privateKeyCoefficient).toHex(),s.setRsaPrivateKey(new i(a,16),new i(f,16),new i(l,16),new i(h,16),new i(p,16),new i(d,16),new i(y,16),new i(g,16))},s.privateKeyToAsn1=s.privateKeyToRSAPrivateKey=function(e){return o.create(o.Class.UNIVERSAL,o.Type.SEQUENCE,!0,[o.create(o.Class.UNIVERSAL,o.Type.INTEGER,!1,o.integerToDer(0).getBytes()),o.create(o.Class.UNIVERSAL,o.Type.INTEGER,!1,m(e.n)),o.create(o.Class.UNIVERSAL,o.Type.INTEGER,!1,m(e.e)),o.create(o.Class.UNIVERSAL,o.Type.INTEGER,!1,m(e.d)),o.create(o.Class.UNIVERSAL,o.Type.INTEGER,!1,m(e.p)),o.create(o.Class.UNIVERSAL,o.Type.INTEGER,!1,m(e.q)),o.create(o.Class.UNIVERSAL,o.Type.INTEGER,!1,m(e.dP)),o.create(o.Class.UNIVERSAL,o.Type.INTEGER,!1,m(e.dQ)),o.create(o.Class.UNIVERSAL,o.Type.INTEGER,!1,m(e.qInv))])},s.publicKeyFromAsn1=function(e){var t={},r=[];if(o.validate(e,l,t,r)){var a=o.derToOid(t.publicKeyOid);if(a!==s.oids.rsaEncryption){var u=new Error("Cannot read public key. Unknown OID.");throw u.oid=a,u}e=t.rsaPublicKey}if(r=[],!o.validate(e,f,t,r)){var u=new Error("Cannot read public key. ASN.1 object does not contain an RSAPublicKey.");throw u.errors=r,u}var c=n.util.createBuffer(t.publicKeyModulus).toHex(),h=n.util.createBuffer(t.publicKeyExponent).toHex();return s.setRsaPublicKey(new i(c,16),new i(h,16))},s.publicKeyToAsn1=s.publicKeyToSubjectPublicKeyInfo=function(e){return o.create(o.Class.UNIVERSAL,o.Type.SEQUENCE,!0,[o.create(o.Class.UNIVERSAL,o.Type.SEQUENCE,!0,[o.create(o.Class.UNIVERSAL,o.Type.OID,!1,o.oidToDer(s.oids.rsaEncryption).getBytes()),o.create(o.Class.UNIVERSAL,o.Type.NULL,!1,"")]),o.create(o.Class.UNIVERSAL,o.Type.BITSTRING,!1,[s.publicKeyToRSAPublicKey(e)])])},s.publicKeyToRSAPublicKey=function(e){return o.create(o.Class.UNIVERSAL,o.Type.SEQUENCE,!0,[o.create(o.Class.UNIVERSAL,o.Type.INTEGER,!1,m(e.n)),o.create(o.Class.UNIVERSAL,o.Type.INTEGER,!1,m(e.e))])}},function(e,t,r){var n=r(11),i;e.exports=n.jsbn=n.jsbn||{};var o=0xdeadbeefcafe,s=!0;function a(e,t,r){this.data=[],null!=e&&("number"==typeof e?this.fromNumber(e,t,r):null==t&&"string"!=typeof e?this.fromString(e,256):this.fromString(e,t))}function u(){return new a(null)}function c(e,t,r,n,i,o){for(;--o>=0;){var s=t*this.data[e++]+r.data[n]+i;i=Math.floor(s/67108864),r.data[n++]=67108863&s}return i}function f(e,t,r,n,i,o){for(var s=32767&t,a=t>>15;--o>=0;){var u=32767&this.data[e],c=this.data[e++]>>15,f=a*u+c*s;u=s*u+((32767&f)<<15)+r.data[n]+(1073741823&i),i=(u>>>30)+(f>>>15)+a*c+(i>>>30),r.data[n++]=1073741823&u}return i}function l(e,t,r,n,i,o){for(var s=16383&t,a=t>>14;--o>=0;){var u=16383&this.data[e],c=this.data[e++]>>14,f=a*u+c*s;u=s*u+((16383&f)<<14)+r.data[n]+i,i=(u>>28)+(f>>14)+a*c,r.data[n++]=268435455&u}return i}n.jsbn.BigInteger=a,"undefined"==typeof navigator?(a.prototype.am=l,i=28):"Microsoft Internet Explorer"==navigator.appName?(a.prototype.am=f,i=30):"Netscape"!=navigator.appName?(a.prototype.am=c,i=26):(a.prototype.am=l,i=28),a.prototype.DB=i,a.prototype.DM=(1<<i)-1,a.prototype.DV=1<<i;var h=52;a.prototype.FV=Math.pow(2,52),a.prototype.F1=52-i,a.prototype.F2=2*i-52;var p="0123456789abcdefghijklmnopqrstuvwxyz",d=new Array,y,g;for(y="0".charCodeAt(0),g=0;g<=9;++g)d[y++]=g;for(y="a".charCodeAt(0),g=10;g<36;++g)d[y++]=g;for(y="A".charCodeAt(0),g=10;g<36;++g)d[y++]=g;function m(e){return p.charAt(e)}function b(e,t){var r=d[e.charCodeAt(t)];return null==r?-1:r}function v(e){for(var t=this.t-1;t>=0;--t)e.data[t]=this.data[t];e.t=this.t,e.s=this.s}function _(e){this.t=1,this.s=e<0?-1:0,e>0?this.data[0]=e:e<-1?this.data[0]=e+this.DV:this.t=0}function w(e){var t=u();return t.fromInt(e),t}function S(e,t){var r;if(16==t)r=4;else if(8==t)r=3;else if(256==t)r=8;else if(2==t)r=1;else if(32==t)r=5;else{if(4!=t)return void this.fromRadix(e,t);r=2}this.t=0,this.s=0;for(var n=e.length,i=!1,o=0;--n>=0;){var s=8==r?255&e[n]:b(e,n);s<0?"-"==e.charAt(n)&&(i=!0):(i=!1,0==o?this.data[this.t++]=s:o+r>this.DB?(this.data[this.t-1]|=(s&(1<<this.DB-o)-1)<<o,this.data[this.t++]=s>>this.DB-o):this.data[this.t-1]|=s<<o,o+=r,o>=this.DB&&(o-=this.DB))}8==r&&0!=(128&e[0])&&(this.s=-1,o>0&&(this.data[this.t-1]|=(1<<this.DB-o)-1<<o)),this.clamp(),i&&a.ZERO.subTo(this,this)}function k(){for(var e=this.s&this.DM;this.t>0&&this.data[this.t-1]==e;)--this.t}function E(e){if(this.s<0)return"-"+this.negate().toString(e);var t;if(16==e)t=4;else if(8==e)t=3;else if(2==e)t=1;else if(32==e)t=5;else{if(4!=e)return this.toRadix(e);t=2}var r=(1<<t)-1,n,i=!1,o="",s=this.t,a=this.DB-s*this.DB%t;if(s-- >0)for(a<this.DB&&(n=this.data[s]>>a)>0&&(i=!0,o=m(n));s>=0;)a<t?(n=(this.data[s]&(1<<a)-1)<<t-a,n|=this.data[--s]>>(a+=this.DB-t)):(n=this.data[s]>>(a-=t)&r,a<=0&&(a+=this.DB,--s)),n>0&&(i=!0),i&&(o+=m(n));return i?o:"0"}function A(){var e=u();return a.ZERO.subTo(this,e),e}function x(){return this.s<0?this.negate():this}function I(e){var t=this.s-e.s;if(0!=t)return t;var r=this.t;if(t=r-e.t,0!=t)return this.s<0?-t:t;for(;--r>=0;)if(0!=(t=this.data[r]-e.data[r]))return t;return 0}function T(e){var t=1,r;return 0!=(r=e>>>16)&&(e=r,t+=16),0!=(r=e>>8)&&(e=r,t+=8),0!=(r=e>>4)&&(e=r,t+=4),0!=(r=e>>2)&&(e=r,t+=2),0!=(r=e>>1)&&(e=r,t+=1),t}function B(){return this.t<=0?0:this.DB*(this.t-1)+T(this.data[this.t-1]^this.s&this.DM)}function C(e,t){var r;for(r=this.t-1;r>=0;--r)t.data[r+e]=this.data[r];for(r=e-1;r>=0;--r)t.data[r]=0;t.t=this.t+e,t.s=this.s}function P(e,t){for(var r=e;r<this.t;++r)t.data[r-e]=this.data[r];t.t=Math.max(this.t-e,0),t.s=this.s}function O(e,t){var r=e%this.DB,n=this.DB-r,i=(1<<n)-1,o=Math.floor(e/this.DB),s=this.s<<r&this.DM,a;for(a=this.t-1;a>=0;--a)t.data[a+o+1]=this.data[a]>>n|s,s=(this.data[a]&i)<<r;for(a=o-1;a>=0;--a)t.data[a]=0;t.data[o]=s,t.t=this.t+o+1,t.s=this.s,t.clamp()}function R(e,t){t.s=this.s;var r=Math.floor(e/this.DB);if(r>=this.t)t.t=0;else{var n=e%this.DB,i=this.DB-n,o=(1<<n)-1;t.data[0]=this.data[r]>>n;for(var s=r+1;s<this.t;++s)t.data[s-r-1]|=(this.data[s]&o)<<i,t.data[s-r]=this.data[s]>>n;n>0&&(t.data[this.t-r-1]|=(this.s&o)<<i),t.t=this.t-r,t.clamp()}}function N(e,t){for(var r=0,n=0,i=Math.min(e.t,this.t);r<i;)n+=this.data[r]-e.data[r],t.data[r++]=n&this.DM,n>>=this.DB;if(e.t<this.t){for(n-=e.s;r<this.t;)n+=this.data[r],t.data[r++]=n&this.DM,n>>=this.DB;n+=this.s}else{for(n+=this.s;r<e.t;)n-=e.data[r],t.data[r++]=n&this.DM,n>>=this.DB;n-=e.s}t.s=n<0?-1:0,n<-1?t.data[r++]=this.DV+n:n>0&&(t.data[r++]=n),t.t=r,t.clamp()}function L(e,t){var r=this.abs(),n=e.abs(),i=r.t;for(t.t=i+n.t;--i>=0;)t.data[i]=0;for(i=0;i<n.t;++i)t.data[i+r.t]=r.am(0,n.data[i],t,i,0,r.t);t.s=0,t.clamp(),this.s!=e.s&&a.ZERO.subTo(t,t)}function j(e){for(var t=this.abs(),r=e.t=2*t.t;--r>=0;)e.data[r]=0;for(r=0;r<t.t-1;++r){var n=t.am(r,t.data[r],e,2*r,0,1);(e.data[r+t.t]+=t.am(r+1,2*t.data[r],e,2*r+1,n,t.t-r-1))>=t.DV&&(e.data[r+t.t]-=t.DV,e.data[r+t.t+1]=1)}e.t>0&&(e.data[e.t-1]+=t.am(r,t.data[r],e,2*r,0,1)),e.s=0,e.clamp()}function M(e,t,r){var n=e.abs();if(!(n.t<=0)){var i=this.abs();if(i.t<n.t)return null!=t&&t.fromInt(0),void(null!=r&&this.copyTo(r));null==r&&(r=u());var o=u(),s=this.s,c=e.s,f=this.DB-T(n.data[n.t-1]);f>0?(n.lShiftTo(f,o),i.lShiftTo(f,r)):(n.copyTo(o),i.copyTo(r));var l=o.t,h=o.data[l-1];if(0!=h){var p=h*(1<<this.F1)+(l>1?o.data[l-2]>>this.F2:0),d=this.FV/p,y=(1<<this.F1)/p,g=1<<this.F2,m=r.t,b=m-l,v=null==t?u():t;for(o.dlShiftTo(b,v),r.compareTo(v)>=0&&(r.data[r.t++]=1,r.subTo(v,r)),a.ONE.dlShiftTo(l,v),v.subTo(o,o);o.t<l;)o.data[o.t++]=0;for(;--b>=0;){var _=r.data[--m]==h?this.DM:Math.floor(r.data[m]*d+(r.data[m-1]+g)*y);if((r.data[m]+=o.am(0,_,r,b,0,l))<_)for(o.dlShiftTo(b,v),r.subTo(v,r);r.data[m]<--_;)r.subTo(v,r)}null!=t&&(r.drShiftTo(l,t),s!=c&&a.ZERO.subTo(t,t)),r.t=l,r.clamp(),f>0&&r.rShiftTo(f,r),s<0&&a.ZERO.subTo(r,r)}}}function K(e){var t=u();return this.abs().divRemTo(e,null,t),this.s<0&&t.compareTo(a.ZERO)>0&&e.subTo(t,t),t}function D(e){this.m=e}function U(e){return e.s<0||e.compareTo(this.m)>=0?e.mod(this.m):e}function F(e){return e}function q(e){e.divRemTo(this.m,null,e)}function H(e,t,r){e.multiplyTo(t,r),this.reduce(r)}function z(e,t){e.squareTo(t),this.reduce(t)}function V(){if(this.t<1)return 0;var e=this.data[0];if(0==(1&e))return 0;var t=3&e;return t=t*(2-(15&e)*t)&15,t=t*(2-(255&e)*t)&255,t=t*(2-((65535&e)*t&65535))&65535,t=t*(2-e*t%this.DV)%this.DV,t>0?this.DV-t:-t}function G(e){this.m=e,this.mp=e.invDigit(),this.mpl=32767&this.mp,this.mph=this.mp>>15,this.um=(1<<e.DB-15)-1,this.mt2=2*e.t}function W(e){var t=u();return e.abs().dlShiftTo(this.m.t,t),t.divRemTo(this.m,null,t),e.s<0&&t.compareTo(a.ZERO)>0&&this.m.subTo(t,t),t}function $(e){var t=u();return e.copyTo(t),this.reduce(t),t}function Y(e){for(;e.t<=this.mt2;)e.data[e.t++]=0;for(var t=0;t<this.m.t;++t){var r=32767&e.data[t],n=r*this.mpl+((r*this.mph+(e.data[t]>>15)*this.mpl&this.um)<<15)&e.DM;for(r=t+this.m.t,e.data[r]+=this.m.am(0,n,e,t,0,this.m.t);e.data[r]>=e.DV;)e.data[r]-=e.DV,e.data[++r]++}e.clamp(),e.drShiftTo(this.m.t,e),e.compareTo(this.m)>=0&&e.subTo(this.m,e)}function J(e,t){e.squareTo(t),this.reduce(t)}function X(e,t,r){e.multiplyTo(t,r),this.reduce(r)}function Z(){return 0==(this.t>0?1&this.data[0]:this.s)}function Q(e,t){if(e>4294967295||e<1)return a.ONE;var r=u(),n=u(),i=t.convert(this),o=T(e)-1;for(i.copyTo(r);--o>=0;)if(t.sqrTo(r,n),(e&1<<o)>0)t.mulTo(n,i,r);else{var s=r;r=n,n=s}return t.revert(r)}function ee(e,t){var r;return r=e<256||t.isEven()?new D(t):new G(t),this.exp(e,r)}function te(){var e=u();return this.copyTo(e),e}function re(){if(this.s<0){if(1==this.t)return this.data[0]-this.DV;if(0==this.t)return-1}else{if(1==this.t)return this.data[0];if(0==this.t)return 0}return(this.data[1]&(1<<32-this.DB)-1)<<this.DB|this.data[0]}function ne(){return 0==this.t?this.s:this.data[0]<<24>>24}function ie(){return 0==this.t?this.s:this.data[0]<<16>>16}function oe(e){return Math.floor(Math.LN2*this.DB/Math.log(e))}function se(){return this.s<0?-1:this.t<=0||1==this.t&&this.data[0]<=0?0:1}function ae(e){if(null==e&&(e=10),0==this.signum()||e<2||e>36)return"0";var t=this.chunkSize(e),r=Math.pow(e,t),n=w(r),i=u(),o=u(),s="";for(this.divRemTo(n,i,o);i.signum()>0;)s=(r+o.intValue()).toString(e).substr(1)+s,i.divRemTo(n,i,o);return o.intValue().toString(e)+s}function ue(e,t){this.fromInt(0),null==t&&(t=10);for(var r=this.chunkSize(t),n=Math.pow(t,r),i=!1,o=0,s=0,u=0;u<e.length;++u){var c=b(e,u);c<0?"-"==e.charAt(u)&&0==this.signum()&&(i=!0):(s=t*s+c,++o>=r&&(this.dMultiply(n),this.dAddOffset(s,0),o=0,s=0))}o>0&&(this.dMultiply(Math.pow(t,o)),this.dAddOffset(s,0)),i&&a.ZERO.subTo(this,this)}function ce(e,t,r){if("number"==typeof t)if(e<2)this.fromInt(1);else for(this.fromNumber(e,r),this.testBit(e-1)||this.bitwiseTo(a.ONE.shiftLeft(e-1),me,this),this.isEven()&&this.dAddOffset(1,0);!this.isProbablePrime(t);)this.dAddOffset(2,0),this.bitLength()>e&&this.subTo(a.ONE.shiftLeft(e-1),this);else{var n=new Array,i=7&e;n.length=1+(e>>3),t.nextBytes(n),i>0?n[0]&=(1<<i)-1:n[0]=0,this.fromString(n,256)}}function fe(){var e=this.t,t=new Array;t[0]=this.s;var r=this.DB-e*this.DB%8,n,i=0;if(e-- >0)for(r<this.DB&&(n=this.data[e]>>r)!=(this.s&this.DM)>>r&&(t[i++]=n|this.s<<this.DB-r);e>=0;)r<8?(n=(this.data[e]&(1<<r)-1)<<8-r,n|=this.data[--e]>>(r+=this.DB-8)):(n=this.data[e]>>(r-=8)&255,r<=0&&(r+=this.DB,--e)),0!=(128&n)&&(n|=-256),0==i&&(128&this.s)!=(128&n)&&++i,(i>0||n!=this.s)&&(t[i++]=n);return t}function le(e){return 0==this.compareTo(e)}function he(e){return this.compareTo(e)<0?this:e}function pe(e){return this.compareTo(e)>0?this:e}function de(e,t,r){var n,i,o=Math.min(e.t,this.t);for(n=0;n<o;++n)r.data[n]=t(this.data[n],e.data[n]);if(e.t<this.t){for(i=e.s&this.DM,n=o;n<this.t;++n)r.data[n]=t(this.data[n],i);r.t=this.t}else{for(i=this.s&this.DM,n=o;n<e.t;++n)r.data[n]=t(i,e.data[n]);r.t=e.t}r.s=t(this.s,e.s),r.clamp()}function ye(e,t){return e&t}function ge(e){var t=u();return this.bitwiseTo(e,ye,t),t}function me(e,t){return e|t}function be(e){var t=u();return this.bitwiseTo(e,me,t),t}function ve(e,t){return e^t}function _e(e){var t=u();return this.bitwiseTo(e,ve,t),t}function we(e,t){return e&~t}function Se(e){var t=u();return this.bitwiseTo(e,we,t),t}function ke(){for(var e=u(),t=0;t<this.t;++t)e.data[t]=this.DM&~this.data[t];return e.t=this.t,e.s=~this.s,e}function Ee(e){var t=u();return e<0?this.rShiftTo(-e,t):this.lShiftTo(e,t),t}function Ae(e){var t=u();return e<0?this.lShiftTo(-e,t):this.rShiftTo(e,t),t}function xe(e){if(0==e)return-1;var t=0;return 0==(65535&e)&&(e>>=16,t+=16),0==(255&e)&&(e>>=8,t+=8),0==(15&e)&&(e>>=4,t+=4),0==(3&e)&&(e>>=2,t+=2),0==(1&e)&&++t,t}function Ie(){for(var e=0;e<this.t;++e)if(0!=this.data[e])return e*this.DB+xe(this.data[e]);return this.s<0?this.t*this.DB:-1}function Te(e){for(var t=0;0!=e;)e&=e-1,++t;return t}function Be(){for(var e=0,t=this.s&this.DM,r=0;r<this.t;++r)e+=Te(this.data[r]^t);return e}function Ce(e){var t=Math.floor(e/this.DB);return t>=this.t?0!=this.s:0!=(this.data[t]&1<<e%this.DB)}function Pe(e,t){var r=a.ONE.shiftLeft(e);return this.bitwiseTo(r,t,r),r}function Oe(e){return this.changeBit(e,me)}function Re(e){return this.changeBit(e,we)}function Ne(e){return this.changeBit(e,ve)}function Le(e,t){for(var r=0,n=0,i=Math.min(e.t,this.t);r<i;)n+=this.data[r]+e.data[r],t.data[r++]=n&this.DM,n>>=this.DB;if(e.t<this.t){for(n+=e.s;r<this.t;)n+=this.data[r],t.data[r++]=n&this.DM,n>>=this.DB;n+=this.s}else{for(n+=this.s;r<e.t;)n+=e.data[r],t.data[r++]=n&this.DM,n>>=this.DB;n+=e.s}t.s=n<0?-1:0,n>0?t.data[r++]=n:n<-1&&(t.data[r++]=this.DV+n),t.t=r,t.clamp()}function je(e){var t=u();return this.addTo(e,t),t}function Me(e){var t=u();return this.subTo(e,t),t}function Ke(e){var t=u();return this.multiplyTo(e,t),t}function De(e){var t=u();return this.divRemTo(e,t,null),t}function Ue(e){var t=u();return this.divRemTo(e,null,t),t}function Fe(e){var t=u(),r=u();return this.divRemTo(e,t,r),new Array(t,r)}function qe(e){this.data[this.t]=this.am(0,e-1,this,0,0,this.t),++this.t,this.clamp()}function He(e,t){if(0!=e){for(;this.t<=t;)this.data[this.t++]=0;for(this.data[t]+=e;this.data[t]>=this.DV;)this.data[t]-=this.DV,++t>=this.t&&(this.data[this.t++]=0),++this.data[t]}}function ze(){}function Ve(e){return e}function Ge(e,t,r){e.multiplyTo(t,r)}function We(e,t){e.squareTo(t)}function $e(e){return this.exp(e,new ze)}function Ye(e,t,r){var n=Math.min(this.t+e.t,t),i;for(r.s=0,r.t=n;n>0;)r.data[--n]=0;for(i=r.t-this.t;n<i;++n)r.data[n+this.t]=this.am(0,e.data[n],r,n,0,this.t);for(i=Math.min(e.t,t);n<i;++n)this.am(0,e.data[n],r,n,0,t-n);r.clamp()}function Je(e,t,r){--t;var n=r.t=this.t+e.t-t;for(r.s=0;--n>=0;)r.data[n]=0;for(n=Math.max(t-this.t,0);n<e.t;++n)r.data[this.t+n-t]=this.am(t-n,e.data[n],r,0,0,this.t+n-t);r.clamp(),r.drShiftTo(1,r)}function Xe(e){this.r2=u(),this.q3=u(),a.ONE.dlShiftTo(2*e.t,this.r2),this.mu=this.r2.divide(e),this.m=e}function Ze(e){if(e.s<0||e.t>2*this.m.t)return e.mod(this.m);if(e.compareTo(this.m)<0)return e;var t=u();return e.copyTo(t),this.reduce(t),t}function Qe(e){return e}function et(e){for(e.drShiftTo(this.m.t-1,this.r2),e.t>this.m.t+1&&(e.t=this.m.t+1,e.clamp()),this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3),this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2);e.compareTo(this.r2)<0;)e.dAddOffset(1,this.m.t+1);for(e.subTo(this.r2,e);e.compareTo(this.m)>=0;)e.subTo(this.m,e)}function tt(e,t){e.squareTo(t),this.reduce(t)}function rt(e,t,r){e.multiplyTo(t,r),this.reduce(r)}function nt(e,t){var r=e.bitLength(),n,i=w(1),o;if(r<=0)return i;n=r<18?1:r<48?3:r<144?4:r<768?5:6,o=r<8?new D(t):t.isEven()?new Xe(t):new G(t);var s=new Array,a=3,c=n-1,f=(1<<n)-1;if(s[1]=o.convert(this),n>1){var l=u();for(o.sqrTo(s[1],l);a<=f;)s[a]=u(),o.mulTo(l,s[a-2],s[a]),a+=2}var h=e.t-1,p,d=!0,y=u(),g;for(r=T(e.data[h])-1;h>=0;){for(r>=c?p=e.data[h]>>r-c&f:(p=(e.data[h]&(1<<r+1)-1)<<c-r,h>0&&(p|=e.data[h-1]>>this.DB+r-c)),a=n;0==(1&p);)p>>=1,--a;if((r-=a)<0&&(r+=this.DB,--h),d)s[p].copyTo(i),d=!1;else{for(;a>1;)o.sqrTo(i,y),o.sqrTo(y,i),a-=2;a>0?o.sqrTo(i,y):(g=i,i=y,y=g),o.mulTo(y,s[p],i)}for(;h>=0&&0==(e.data[h]&1<<r);)o.sqrTo(i,y),g=i,i=y,y=g,--r<0&&(r=this.DB-1,--h)}return o.revert(i)}function it(e){var t=this.s<0?this.negate():this.clone(),r=e.s<0?e.negate():e.clone();if(t.compareTo(r)<0){var n=t;t=r,r=n}var i=t.getLowestSetBit(),o=r.getLowestSetBit();if(o<0)return t;for(i<o&&(o=i),o>0&&(t.rShiftTo(o,t),r.rShiftTo(o,r));t.signum()>0;)(i=t.getLowestSetBit())>0&&t.rShiftTo(i,t),(i=r.getLowestSetBit())>0&&r.rShiftTo(i,r),t.compareTo(r)>=0?(t.subTo(r,t),t.rShiftTo(1,t)):(r.subTo(t,r),r.rShiftTo(1,r));return o>0&&r.lShiftTo(o,r),r}function ot(e){if(e<=0)return 0;var t=this.DV%e,r=this.s<0?e-1:0;if(this.t>0)if(0==t)r=this.data[0]%e;else for(var n=this.t-1;n>=0;--n)r=(t*r+this.data[n])%e;return r}function st(e){var t=e.isEven();if(this.isEven()&&t||0==e.signum())return a.ZERO;for(var r=e.clone(),n=this.clone(),i=w(1),o=w(0),s=w(0),u=w(1);0!=r.signum();){for(;r.isEven();)r.rShiftTo(1,r),t?(i.isEven()&&o.isEven()||(i.addTo(this,i),o.subTo(e,o)),i.rShiftTo(1,i)):o.isEven()||o.subTo(e,o),o.rShiftTo(1,o);for(;n.isEven();)n.rShiftTo(1,n),t?(s.isEven()&&u.isEven()||(s.addTo(this,s),u.subTo(e,u)),s.rShiftTo(1,s)):u.isEven()||u.subTo(e,u),u.rShiftTo(1,u);r.compareTo(n)>=0?(r.subTo(n,r),t&&i.subTo(s,i),o.subTo(u,o)):(n.subTo(r,n),t&&s.subTo(i,s),u.subTo(o,u))}return 0!=n.compareTo(a.ONE)?a.ZERO:u.compareTo(e)>=0?u.subtract(e):u.signum()<0?(u.addTo(e,u),u.signum()<0?u.add(e):u):u}D.prototype.convert=U,D.prototype.revert=F,D.prototype.reduce=q,D.prototype.mulTo=H,D.prototype.sqrTo=z,G.prototype.convert=W,G.prototype.revert=$,G.prototype.reduce=Y,G.prototype.mulTo=X,G.prototype.sqrTo=J,a.prototype.copyTo=v,a.prototype.fromInt=_,a.prototype.fromString=S,a.prototype.clamp=k,a.prototype.dlShiftTo=C,a.prototype.drShiftTo=P,a.prototype.lShiftTo=O,a.prototype.rShiftTo=R,a.prototype.subTo=N,a.prototype.multiplyTo=L,a.prototype.squareTo=j,a.prototype.divRemTo=M,a.prototype.invDigit=V,a.prototype.isEven=Z,a.prototype.exp=Q,a.prototype.toString=E,a.prototype.negate=A,a.prototype.abs=x,a.prototype.compareTo=I,a.prototype.bitLength=B,a.prototype.mod=K,a.prototype.modPowInt=ee,a.ZERO=w(0),a.ONE=w(1),ze.prototype.convert=Ve,ze.prototype.revert=Ve,ze.prototype.mulTo=Ge,ze.prototype.sqrTo=We,Xe.prototype.convert=Ze,Xe.prototype.revert=Qe,Xe.prototype.reduce=et,Xe.prototype.mulTo=rt,Xe.prototype.sqrTo=tt;var at=[2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331,337,347,349,353,359,367,373,379,383,389,397,401,409,419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,509],ut=(1<<26)/at[at.length-1];function ct(e){var t,r=this.abs();if(1==r.t&&r.data[0]<=at[at.length-1]){for(t=0;t<at.length;++t)if(r.data[0]==at[t])return!0;return!1}if(r.isEven())return!1;for(t=1;t<at.length;){for(var n=at[t],i=t+1;i<at.length&&n<ut;)n*=at[i++];for(n=r.modInt(n);t<i;)if(n%at[t++]==0)return!1}return r.millerRabin(e)}function ft(e){var t=this.subtract(a.ONE),r=t.getLowestSetBit();if(r<=0)return!1;for(var n=t.shiftRight(r),i=lt(),o,s=0;s<e;++s){do{o=new a(this.bitLength(),i)}while(o.compareTo(a.ONE)<=0||o.compareTo(t)>=0);var u=o.modPow(n,this);if(0!=u.compareTo(a.ONE)&&0!=u.compareTo(t)){for(var c=1;c++<r&&0!=u.compareTo(t);)if(u=u.modPowInt(2,this),0==u.compareTo(a.ONE))return!1;if(0!=u.compareTo(t))return!1}}return!0}function lt(){return{nextBytes:function(e){for(var t=0;t<e.length;++t)e[t]=Math.floor(256*Math.random())}}}a.prototype.chunkSize=oe,a.prototype.toRadix=ae,a.prototype.fromRadix=ue,a.prototype.fromNumber=ce,a.prototype.bitwiseTo=de,a.prototype.changeBit=Pe,a.prototype.addTo=Le,a.prototype.dMultiply=qe,a.prototype.dAddOffset=He,a.prototype.multiplyLowerTo=Ye,a.prototype.multiplyUpperTo=Je,a.prototype.modInt=ot,a.prototype.millerRabin=ft,a.prototype.clone=te,a.prototype.intValue=re,a.prototype.byteValue=ne,a.prototype.shortValue=ie,a.prototype.signum=se,a.prototype.toByteArray=fe,a.prototype.equals=le,a.prototype.min=he,a.prototype.max=pe,a.prototype.and=ge,a.prototype.or=be,a.prototype.xor=_e,a.prototype.andNot=Se,a.prototype.not=ke,a.prototype.shiftLeft=Ee,a.prototype.shiftRight=Ae,a.prototype.getLowestSetBit=Ie,a.prototype.bitCount=Be,a.prototype.testBit=Ce,a.prototype.setBit=Oe,a.prototype.clearBit=Re,a.prototype.flipBit=Ne,a.prototype.add=je,a.prototype.subtract=Me,a.prototype.multiply=Ke,a.prototype.divide=De,a.prototype.remainder=Ue,a.prototype.divideAndRemainder=Fe,a.prototype.modPow=nt,a.prototype.modInverse=st,a.prototype.pow=$e,a.prototype.gcd=it,a.prototype.isProbablePrime=ct},function(e,t,r){"use strict";var n=r(2).Buffer,i=r(930),o;function s(){this.negative=0,this.words=null,this.length=0}s.fromNumber=function(e){var t=new s;return t.words=[67108863&e],t.length=1,t},s.fromBuffer=function(e){var t=new s;return t.words=new Array(10),t.words[0]=(3&e[28])<<24|e[29]<<16|e[30]<<8|e[31],t.words[1]=(15&e[25])<<22|e[26]<<14|e[27]<<6|e[28]>>>2,t.words[2]=(63&e[22])<<20|e[23]<<12|e[24]<<4|e[25]>>>4,t.words[3]=(255&e[19])<<18|e[20]<<10|e[21]<<2|e[22]>>>6,t.words[4]=(3&e[15])<<24|e[16]<<16|e[17]<<8|e[18],t.words[5]=(15&e[12])<<22|e[13]<<14|e[14]<<6|e[15]>>>2,t.words[6]=(63&e[9])<<20|e[10]<<12|e[11]<<4|e[12]>>>4,t.words[7]=(255&e[6])<<18|e[7]<<10|e[8]<<2|e[9]>>>6,t.words[8]=(3&e[2])<<24|e[3]<<16|e[4]<<8|e[5],t.words[9]=e[0]<<14|e[1]<<6|e[2]>>>2,t.length=10,t.strip()},s.prototype.toBuffer=function(){for(var e=this.words,t=this.length;t<10;++t)e[t]=0;return n.from([e[9]>>>14&255,e[9]>>>6&255,(63&e[9])<<2|e[8]>>>24&3,e[8]>>>16&255,e[8]>>>8&255,255&e[8],e[7]>>>18&255,e[7]>>>10&255,e[7]>>>2&255,(3&e[7])<<6|e[6]>>>20&63,e[6]>>>12&255,e[6]>>>4&255,(15&e[6])<<4|e[5]>>>22&15,e[5]>>>14&255,e[5]>>>6&255,(63&e[5])<<2|e[4]>>>24&3,e[4]>>>16&255,e[4]>>>8&255,255&e[4],e[3]>>>18&255,e[3]>>>10&255,e[3]>>>2&255,(3&e[3])<<6|e[2]>>>20&63,e[2]>>>12&255,e[2]>>>4&255,(15&e[2])<<4|e[1]>>>22&15,e[1]>>>14&255,e[1]>>>6&255,(63&e[1])<<2|e[0]>>>24&3,e[0]>>>16&255,e[0]>>>8&255,255&e[0]])},s.prototype.clone=function(){var e=new s;e.words=new Array(this.length);for(var t=0;t<this.length;t++)e.words[t]=this.words[t];return e.length=this.length,e.negative=this.negative,e},s.prototype.strip=function(){for(;this.length>1&&0==(0|this.words[this.length-1]);)this.length--;return this},s.prototype.normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},s.prototype.isEven=function(){return 0==(1&this.words[0])},s.prototype.isOdd=function(){return 1==(1&this.words[0])},s.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},s.prototype.ucmp=function(e){if(this.length!==e.length)return this.length>e.length?1:-1;for(var t=this.length-1;t>=0;--t)if(this.words[t]!==e.words[t])return this.words[t]>e.words[t]?1:-1;return 0},s.prototype.gtOne=function(){return this.length>1||this.words[0]>1},s.prototype.isOverflow=function(){return this.ucmp(s.n)>=0},s.prototype.isHigh=function(){return 1===this.ucmp(s.nh)},s.prototype.bitLengthGT256=function(){return this.length>10||10===this.length&&this.words[9]>4194303},s.prototype.iuaddn=function(e){this.words[0]+=e;for(var t=0;this.words[t]>67108863&&t<this.length;++t)this.words[t]-=67108864,this.words[t+1]+=1;return t===this.length&&(this.words[t]=1,this.length+=1),this},s.prototype.iadd=function(e){if(this.negative!==e.negative)return 0!==this.negative?(this.negative=0,this.isub(e),this.negative^=1):(e.negative=0,this.isub(e),e.negative=1),this.normSign();var t,r;this.length>e.length?(t=this,r=e):(t=e,r=this);for(var n=0,i=0;n<r.length;++n){var o=t.words[n]+r.words[n]+i;this.words[n]=67108863&o,i=o>>>26}for(;0!==i&&n<t.length;++n)o=t.words[n]+i,this.words[n]=67108863&o,i=o>>>26;if(this.length=t.length,0!==i)this.words[this.length++]=i;else if(t!==this)for(;n<t.length;++n)this.words[n]=t.words[n];return this},s.prototype.add=function(e){return this.clone().iadd(e)},s.prototype.isub=function(e){if(this.negative!==e.negative)return 0!==this.negative?(this.negative=0,this.iadd(e),this.negative=1):(e.negative=0,this.iadd(e),e.negative=1),this.normSign();var t=this.ucmp(e),r,n;if(0===t)return this.negative=0,this.words[0]=0,this.length=1,this;t>0?(r=this,n=e):(r=e,n=this);for(var i=0,o=0;i<n.length;++i){var s=r.words[i]-n.words[i]+o;o=s>>26,this.words[i]=67108863&s}for(;0!==o&&i<r.length;++i)s=r.words[i]+o,o=s>>26,this.words[i]=67108863&s;if(0===o&&i<r.length&&r!==this)for(;i<r.length;++i)this.words[i]=r.words[i];return this.length=Math.max(this.length,i),r!==this&&(this.negative^=1),this.strip().normSign()},s.prototype.sub=function(e){return this.clone().isub(e)},s.umulTo=function(e,t,r){r.length=e.length+t.length-1;var n=e.words[0],i=t.words[0],o=n*i,s=o/67108864|0;r.words[0]=67108863&o;for(var a=1,u=r.length;a<u;a++){for(var c=s>>>26,f=67108863&s,l=Math.max(0,a-e.length+1),h=Math.min(a,t.length-1);l<=h;l++){var p=a-l,d=e.words[p],y=t.words[l],g=d*y+f;c+=g/67108864|0,f=67108863&g}r.words[a]=f,s=c}return 0!==s&&(r.words[r.length++]=s),r.strip()},s.umulTo10x10=Math.imul?i.umulTo10x10:s.umulTo,s.umulnTo=function(e,t,r){if(0===t)return r.words=[0],r.length=1,r;for(var n=0,i=0;n<e.length;++n){var o=e.words[n]*t+i;r.words[n]=67108863&o,i=o/67108864|0}return i>0?(r.words[n]=i,r.length=e.length+1):r.length=e.length,r},s.prototype.umul=function(e){var t=new s;return t.words=new Array(this.length+e.length),10===this.length&&10===e.length?s.umulTo10x10(this,e,t):1===this.length?s.umulnTo(e,this.words[0],t):1===e.length?s.umulnTo(this,e.words[0],t):s.umulTo(this,e,t)},s.prototype.isplit=function(e){e.length=Math.min(this.length,9);for(var t=0;t<e.length;++t)e.words[t]=this.words[t];if(this.length<=9)return this.words[0]=0,this.length=1,this;var r=this.words[9];for(e.words[e.length++]=4194303&r,t=10;t<this.length;++t){var n=this.words[t];this.words[t-10]=(4194303&n)<<4|r>>>22,r=n}return r>>>=22,this.words[t-10]=r,0===r&&this.length>10?this.length-=10:this.length-=9,this},s.prototype.fireduce=function(){return this.isOverflow()&&this.isub(s.n),this},s.prototype.ureduce=function(){var e=this.clone().isplit(s.tmp).umul(s.nc).iadd(s.tmp);return e.bitLengthGT256()&&(e=e.isplit(s.tmp).umul(s.nc).iadd(s.tmp),e.bitLengthGT256()&&(e=e.isplit(s.tmp).umul(s.nc).iadd(s.tmp))),e.fireduce()},s.prototype.ishrn=function(e){for(var t=(1<<e)-1,r=26-e,n=this.length-1,i=0;n>=0;--n){var o=this.words[n];this.words[n]=i<<r|o>>>e,i=o&t}return this.length>1&&0===this.words[this.length-1]&&(this.length-=1),this},s.prototype.uinvm=function(){for(var e=this.clone(),t=s.n.clone(),r=s.fromNumber(1),n=s.fromNumber(0),i=s.fromNumber(0),o=s.fromNumber(1);e.isEven()&&t.isEven();){for(var a=1,u=1;0==(e.words[0]&u)&&0==(t.words[0]&u)&&a<26;++a,u<<=1);e.ishrn(a),t.ishrn(a)}for(var c=t.clone(),f=e.clone();!e.isZero();){for(var l=0,h=1;0==(e.words[0]&h)&&l<26;++l,h<<=1);if(l>0)for(e.ishrn(l);l-- >0;)(r.isOdd()||n.isOdd())&&(r.iadd(c),n.isub(f)),r.ishrn(1),n.ishrn(1);for(var p=0,d=1;0==(t.words[0]&d)&&p<26;++p,d<<=1);if(p>0)for(t.ishrn(p);p-- >0;)(i.isOdd()||o.isOdd())&&(i.iadd(c),o.isub(f)),i.ishrn(1),o.ishrn(1);e.ucmp(t)>=0?(e.isub(t),r.isub(i),n.isub(o)):(t.isub(e),i.isub(r),o.isub(n))}if(1===i.negative){i.negative=0;var y=i.ureduce();return y.negative^=1,y.normSign().iadd(s.n)}return i.ureduce()},s.prototype.imulK=function(){this.words[this.length]=0,this.words[this.length+1]=0,this.length+=2;for(var e=0,t=0;e<this.length;++e){var r=0|this.words[e];t+=977*r,this.words[e]=67108863&t,t=64*r+(t/67108864|0)}return 0===this.words[this.length-1]&&(this.length-=1,0===this.words[this.length-1]&&(this.length-=1)),this},s.prototype.redIReduce=function(){this.isplit(s.tmp).imulK().iadd(s.tmp),this.bitLengthGT256()&&this.isplit(s.tmp).imulK().iadd(s.tmp);var e=this.ucmp(s.p);return 0===e?(this.words[0]=0,this.length=1):e>0?this.isub(s.p):this.strip(),this},s.prototype.redNeg=function(){return this.isZero()?s.fromNumber(0):s.p.sub(this)},s.prototype.redAdd=function(e){return this.clone().redIAdd(e)},s.prototype.redIAdd=function(e){return this.iadd(e),this.ucmp(s.p)>=0&&this.isub(s.p),this},s.prototype.redIAdd7=function(){return this.iuaddn(7),this.ucmp(s.p)>=0&&this.isub(s.p),this},s.prototype.redSub=function(e){return this.clone().redISub(e)},s.prototype.redISub=function(e){return this.isub(e),0!==this.negative&&this.iadd(s.p),this},s.prototype.redMul=function(e){return this.umul(e).redIReduce()},s.prototype.redSqr=function(){return this.umul(this).redIReduce()},s.prototype.redSqrt=function(){if(this.isZero())return this.clone();for(var e=this.redSqr(),t=e.redSqr(),r=t.redSqr().redMul(t),n=r.redMul(e),i=n.redMul(this),o=i,s=0;s<54;++s)o=o.redSqr().redSqr().redSqr().redSqr().redMul(i);for(o=o.redSqr().redSqr().redSqr().redSqr().redMul(n),s=0;s<5;++s)o=o.redSqr().redSqr().redSqr().redSqr().redMul(i);return o=o.redSqr().redSqr().redSqr().redSqr().redMul(r),o=o.redSqr().redSqr().redSqr().redSqr().redSqr().redSqr().redMul(r),0===o.redSqr().ucmp(this)?o:null},s.prototype.redInvm=function(){for(var e=this.clone(),t=s.p.clone(),r=s.fromNumber(1),n=s.fromNumber(0),i;e.gtOne()&&t.gtOne();){for(var o=0,a=1;0==(e.words[0]&a)&&o<26;++o,a<<=1);if(o>0)for(e.ishrn(o);o-- >0;)r.isOdd()&&r.iadd(s.p),r.ishrn(1);for(var u=0,c=1;0==(t.words[0]&c)&&u<26;++u,c<<=1);if(u>0)for(t.ishrn(u);u-- >0;)n.isOdd()&&n.iadd(s.p),n.ishrn(1);e.ucmp(t)>=0?(e.isub(t),r.isub(n)):(t.isub(e),n.isub(r))}return i=1===e.length&&1===e.words[0]?r:n,0!==i.negative&&i.iadd(s.p),0!==i.negative?(i.negative=0,i.redIReduce().redNeg()):i.redIReduce()},s.prototype.getNAF=function(e){for(var t=[],r=1<<e+1,n=r-1,i=r>>1,o=this.clone();!o.isZero();){for(var s=0,a=1;0==(o.words[0]&a)&&s<26;++s,a<<=1)t.push(0);if(0!==s)o.ishrn(s);else{var u=o.words[0]&n;if(u>=i)t.push(i-u),o.iuaddn(u-i).ishrn(1);else if(t.push(u),o.words[0]-=u,!o.isZero()){for(s=e-1;s>0;--s)t.push(0);o.ishrn(e)}}}return t},s.prototype.inspect=function(){if(this.isZero())return"0";for(var e=this.toBuffer().toString("hex"),t=0;"0"===e[t];++t);return e.slice(t)},s.n=s.fromBuffer(n.from("FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141","hex")),s.nh=s.n.clone().ishrn(1),s.nc=s.fromBuffer(n.from("000000000000000000000000000000014551231950B75FC4402DA1732FC9BEBF","hex")),s.p=s.fromBuffer(n.from("FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFC2F","hex")),s.psn=s.p.sub(s.n),s.tmp=new s,s.tmp.words=new Array(10),o=s.fromNumber(1),o.words[3]=0,e.exports=s},function(e,t,r){"use strict";const n=r(12),i=r(120),o=r(1034),s=r(13),a=r(41),u=r(9),c=r(338),f=r(1035),l=r(59),h=n(r(1036)),p=r(1037);class d{constructor(e){this.full=e,this.wantlist=new Map,this.blocks=new Map}get empty(){return 0===this.blocks.size&&0===this.wantlist.size}addEntry(e,t,r){s(e&&u.isCID(e),"must be a valid cid");const n=e.buffer.toString(),i=this.wantlist.get(n);i?(i.priority=t,i.cancel=Boolean(r)):this.wantlist.set(n,new p(e,t,r))}addBlock(e){s(i.isBlock(e),"must be a valid cid");const t=e.cid.buffer.toString();this.blocks.set(t,e)}cancel(e){s(u.isCID(e),"must be a valid cid");const t=e.buffer.toString();this.wantlist.delete(t),this.addEntry(e,0,!0)}serializeToBitswap100(){const e={wantlist:{entries:Array.from(this.wantlist.values()).map(e=>({block:e.cid.buffer,priority:Number(e.priority),cancel:Boolean(e.cancel)}))},blocks:Array.from(this.blocks.values()).map(e=>e.data)};return this.full&&(e.wantlist.full=!0),h.Message.encode(e)}serializeToBitswap110(){const e={wantlist:{entries:Array.from(this.wantlist.values()).map(e=>({block:e.cid.buffer,priority:Number(e.priority),cancel:Boolean(e.cancel)}))},payload:[]};return this.full&&(e.wantlist.full=!0),this.blocks.forEach(t=>{e.payload.push({prefix:t.cid.prefix,data:t.data})}),h.Message.encode(e)}equals(e){const t=(e,t)=>{if(e.equals&&"function"==typeof e.equals)return e.equals(t)};return!(this.full!==e.full||!o(this.wantlist,e.wantlist,t)||!o(this.blocks,e.blocks,t))}get[Symbol.toStringTag](){const e=Array.from(this.wantlist.keys()),t=Array.from(this.blocks.keys());return`BitswapMessage <full: ${this.full}, list: ${e}, blocks: ${t}>`}}d.deserialize=((e,t)=>{let r;try{r=h.Message.decode(e)}catch(e){return setImmediate(()=>t(e))}const n=r.wantlist&&r.wantlist.full||!1,o=new d(n);return r.wantlist&&r.wantlist.entries.forEach(e=>{let r;try{r=new u(e.block)}catch(e){return t(e)}o.addEntry(r,e.priority,e.cancel)}),r.blocks.length>0?a(r.blocks,(e,r)=>{l(e,"sha2-256",(n,s)=>{if(n)return r(n);let a;try{a=new u(s)}catch(n){return t(n)}o.addBlock(new i(e,a)),r()})},e=>{if(e)return t(e);t(null,o)}):r.payload.length>0?a(r.payload,(e,r)=>{e.prefix&&e.data||r();const n=f(e.prefix),s=n[0],a=n[1],h=n[2];l(e.data,h,(n,f)=>{if(n)return r(n);let l;try{l=new u(s,c[a.toString("16")],f)}catch(n){return t(n)}o.addBlock(new i(e.data,l)),r()})},e=>{if(e)return t(e);t(null,o)}):void t(null,o)}),d.Entry=p,e.exports=d},function(e,t,r){"use strict";const n=r(1038),i=r(1039);class o{constructor(e){this.set=new Map,this._stats=e}get length(){return this.set.size}add(e,t){const r=e.buffer.toString(),n=this.set.get(r);n?(n.inc(),n.priority=t):(this.set.set(r,new i(e,t)),this._stats&&this._stats.push(null,"wantListSize",1))}remove(e){const t=e.buffer.toString(),r=this.set.get(t);r&&(r.dec(),r.hasRefs()||(this.set.delete(t),this._stats&&this._stats.push(null,"wantListSize",-1)))}removeForce(e){this.set.has(e)&&this.set.delete(e)}forEach(e){return this.set.forEach(e)}entries(){return this.set.entries()}sortedEntries(){return new Map(n(Array.from(this.set.entries()),e=>e[1].key))}contains(e){const t=e.buffer.toString();return this.set.get(t)}}o.Entry=i,e.exports=o},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(500),i=a(n),o=r(160),s=a(o);function a(e){return e&&e.__esModule?e:{default:e}}t.default=(0,s.default)(i.default,1),e.exports=t.default},function(e,t){t.encode=function(e){var t="";for(var r in e)e.hasOwnProperty(r)&&(t.length&&(t+="&"),t+=encodeURIComponent(r)+"="+encodeURIComponent(e[r]));return t},t.decode=function(e){for(var t={},r=e.split("&"),n=0,i=r.length;n<i;n++){var o=r[n].split("=");t[decodeURIComponent(o[0])]=decodeURIComponent(o[1])}return t}},function(e,t){e.exports=function(e,t){var r=function(){};r.prototype=t.prototype,e.prototype=new r,e.prototype.constructor=e}},function(e,t,r){(function(t){e.exports=c;var n=r(1)("simple-peer"),i=r(1103),o=r(4),s=r(110),a=r(21),u=65536;function c(e){var t=this;if(!(t instanceof c))return new c(e);if(t._id=s(4).toString("hex").slice(0,7),t._debug("new peer %o",e),e=Object.assign({allowHalfOpen:!1},e),a.Duplex.call(t,e),t.channelName=e.initiator?e.channelName||s(20).toString("hex"):null,t._isChromium="undefined"!=typeof window&&!!window.webkitRTCPeerConnection,t.initiator=e.initiator||!1,t.channelConfig=e.channelConfig||c.channelConfig,t.config=e.config||c.config,t.constraints=t._transformConstraints(e.constraints||c.constraints),t.offerConstraints=t._transformConstraints(e.offerConstraints||{}),t.answerConstraints=t._transformConstraints(e.answerConstraints||{}),t.sdpTransform=e.sdpTransform||function(e){return e},t.streams=e.streams||(e.stream?[e.stream]:[]),t.trickle=void 0===e.trickle||e.trickle,t.destroyed=!1,t.connected=!1,t.remoteAddress=void 0,t.remoteFamily=void 0,t.remotePort=void 0,t.localAddress=void 0,t.localPort=void 0,t._wrtc=e.wrtc&&"object"==typeof e.wrtc?e.wrtc:i(),!t._wrtc)throw"undefined"==typeof window?f("No WebRTC support: Specify `opts.wrtc` option in this environment","ERR_WEBRTC_SUPPORT"):f("No WebRTC support: Not a supported browser","ERR_WEBRTC_SUPPORT");t._pcReady=!1,t._channelReady=!1,t._iceComplete=!1,t._channel=null,t._pendingCandidates=[],t._isNegotiating=!1,t._batchedNegotiation=!1,t._queuedNegotiation=!1,t._sendersAwaitingStable=[],t._senderMap=new WeakMap,t._remoteTracks=[],t._remoteStreams=[],t._chunk=null,t._cb=null,t._interval=null,t._pc=new t._wrtc.RTCPeerConnection(t.config,t.constraints),t._isReactNativeWebrtc="number"==typeof t._pc._peerConnectionId,t._pc.oniceconnectionstatechange=function(){t._onIceStateChange()},t._pc.onicegatheringstatechange=function(){t._onIceStateChange()},t._pc.onsignalingstatechange=function(){t._onSignalingStateChange()},t._pc.onicecandidate=function(e){t._onIceCandidate(e)},t.initiator?t._setupData({channel:t._pc.createDataChannel(t.channelName,t.channelConfig)}):t._pc.ondatachannel=function(e){t._setupData(e)},"addTrack"in t._pc&&(t.streams&&t.streams.forEach(function(e){t.addStream(e)}),t._pc.ontrack=function(e){t._onTrack(e)}),t.initiator&&t._needsNegotiation(),t._onFinishBound=function(){t._onFinish()},t.once("finish",t._onFinishBound)}function f(e,t){var r=new Error(e);return r.code=t,r}function l(){}o(c,a.Duplex),c.WEBRTC_SUPPORT=!!i(),c.config={iceServers:[{urls:"stun:stun.l.google.com:19302"},{urls:"stun:global.stun.twilio.com:3478?transport=udp"}]},c.constraints={},c.channelConfig={},Object.defineProperty(c.prototype,"bufferSize",{get:function(){var e=this;return this._channel&&this._channel.bufferedAmount||0}}),c.prototype.address=function(){var e=this;return{port:this.localPort,family:"IPv4",address:this.localAddress}},c.prototype.signal=function(e){var t=this;if(t.destroyed)throw f("cannot signal after peer is destroyed","ERR_SIGNALING");if("string"==typeof e)try{e=JSON.parse(e)}catch(t){e={}}t._debug("signal()"),e.renegotiate&&(t._debug("got request to renegotiate"),t._needsNegotiation()),e.candidate&&(t._pc.remoteDescription&&t._pc.remoteDescription.type?t._addIceCandidate(e.candidate):t._pendingCandidates.push(e.candidate)),e.sdp&&t._pc.setRemoteDescription(new t._wrtc.RTCSessionDescription(e),function(){t.destroyed||(t._pendingCandidates.forEach(function(e){t._addIceCandidate(e)}),t._pendingCandidates=[],"offer"===t._pc.remoteDescription.type&&t._createAnswer())},function(e){t.destroy(f(e,"ERR_SET_REMOTE_DESCRIPTION"))}),e.sdp||e.candidate||e.renegotiate||t.destroy(f("signal() called with invalid signal data","ERR_SIGNALING"))},c.prototype._addIceCandidate=function(e){var t=this;try{t._pc.addIceCandidate(new t._wrtc.RTCIceCandidate(e),l,function(e){t.destroy(f(e,"ERR_ADD_ICE_CANDIDATE"))})}catch(e){t.destroy(f("error adding candidate: "+e.message,"ERR_ADD_ICE_CANDIDATE"))}},c.prototype.send=function(e){var t=this;this._channel.send(e)},c.prototype.addStream=function(e){var t=this;t._debug("addStream()"),e.getTracks().forEach(function(r){t.addTrack(r,e)})},c.prototype.addTrack=function(e,t){var r=this;this._debug("addTrack()");var n=this._pc.addTrack(e,t),i=this._senderMap.get(e)||new WeakMap;i.set(t,n),this._senderMap.set(e,i),this._needsNegotiation()},c.prototype.removeTrack=function(e,t){var r=this;this._debug("removeSender()");var n=this._senderMap.get(e),i=n?n.get(t):null;i||this.destroy(new Error("Cannot remove track that was never added."));try{this._pc.removeTrack(i)}catch(e){"NS_ERROR_UNEXPECTED"===e.name?this._sendersAwaitingStable.push(i):this.destroy(e)}},c.prototype.removeStream=function(e){var t=this;t._debug("removeSenders()"),e.getTracks().forEach(function(r){t.removeTrack(r,e)})},c.prototype._needsNegotiation=function(){var e=this;e._debug("_needsNegotiation"),e._batchedNegotiation||(e._batchedNegotiation=!0,setTimeout(function(){e._batchedNegotiation=!1,e._debug("starting batched negotiation"),e.negotiate()},0))},c.prototype.negotiate=function(){var e=this;this.initiator?this._isNegotiating?(this._queuedNegotiation=!0,this._debug("already negotiating, queueing")):(this._debug("start negotiation"),this._createOffer()):(this._debug("requesting negotiation from initiator"),this.emit("signal",{renegotiate:!0})),this._isNegotiating=!0},c.prototype.destroy=function(e){var t=this;this._destroy(e,function(){})},c.prototype._destroy=function(e,t){var r=this;if(!this.destroyed){if(this._debug("destroy (error: %s)",e&&(e.message||e)),this.readable=this.writable=!1,this._readableState.ended||this.push(null),this._writableState.finished||this.end(),this.destroyed=!0,this.connected=!1,this._pcReady=!1,this._channelReady=!1,this._remoteTracks=null,this._remoteStreams=null,this._senderMap=null,clearInterval(this._interval),this._interval=null,this._chunk=null,this._cb=null,this._onFinishBound&&this.removeListener("finish",this._onFinishBound),this._onFinishBound=null,this._channel){try{this._channel.close()}catch(e){}this._channel.onmessage=null,this._channel.onopen=null,this._channel.onclose=null,this._channel.onerror=null}if(this._pc){try{this._pc.close()}catch(e){}this._pc.oniceconnectionstatechange=null,this._pc.onicegatheringstatechange=null,this._pc.onsignalingstatechange=null,this._pc.onicecandidate=null,"addTrack"in this._pc&&(this._pc.ontrack=null),this._pc.ondatachannel=null}this._pc=null,this._channel=null,e&&this.emit("error",e),this.emit("close"),t()}},c.prototype._setupData=function(e){var t=this;if(!e.channel)return t.destroy(f("Data channel event is missing `channel` property","ERR_DATA_CHANNEL"));t._channel=e.channel,t._channel.binaryType="arraybuffer","number"==typeof t._channel.bufferedAmountLowThreshold&&(t._channel.bufferedAmountLowThreshold=65536),t.channelName=t._channel.label,t._channel.onmessage=function(e){t._onChannelMessage(e)},t._channel.onbufferedamountlow=function(){t._onChannelBufferedAmountLow()},t._channel.onopen=function(){t._onChannelOpen()},t._channel.onclose=function(){t._onChannelClose()},t._channel.onerror=function(e){t.destroy(f(e,"ERR_DATA_CHANNEL"))}},c.prototype._read=function(){},c.prototype._write=function(e,t,r){var n=this;if(this.destroyed)return r(f("cannot write after peer is destroyed","ERR_DATA_CHANNEL"));if(this.connected){try{this.send(e)}catch(e){return this.destroy(f(e,"ERR_DATA_CHANNEL"))}this._channel.bufferedAmount>65536?(this._debug("start backpressure: bufferedAmount %d",this._channel.bufferedAmount),this._cb=r):r(null)}else this._debug("write before connect"),this._chunk=e,this._cb=r},c.prototype._onFinish=function(){var e=this;function t(){setTimeout(function(){e.destroy()},1e3)}e.destroyed||(e.connected?t():e.once("connect",t))},c.prototype._createOffer=function(){var e=this;e.destroyed||e._pc.createOffer(function(t){function r(){e._debug("createOffer success"),e.destroyed||(e.trickle||e._iceComplete?i():e.once("_iceComplete",i))}function n(t){e.destroy(f(t,"ERR_SET_LOCAL_DESCRIPTION"))}function i(){var r=e._pc.localDescription||t;e._debug("signal"),e.emit("signal",{type:r.type,sdp:r.sdp})}e.destroyed||(t.sdp=e.sdpTransform(t.sdp),e._pc.setLocalDescription(t,r,n))},function(t){e.destroy(f(t,"ERR_CREATE_OFFER"))},e.offerConstraints)},c.prototype._createAnswer=function(){var e=this;e.destroyed||e._pc.createAnswer(function(t){function r(){e.destroyed||(e.trickle||e._iceComplete?i():e.once("_iceComplete",i))}function n(t){e.destroy(f(t,"ERR_SET_LOCAL_DESCRIPTION"))}function i(){var r=e._pc.localDescription||t;e._debug("signal"),e.emit("signal",{type:r.type,sdp:r.sdp})}e.destroyed||(t.sdp=e.sdpTransform(t.sdp),e._pc.setLocalDescription(t,r,n))},function(t){e.destroy(f(t,"ERR_CREATE_ANSWER"))},e.answerConstraints)},c.prototype._onIceStateChange=function(){var e=this;if(!this.destroyed){var t=this._pc.iceConnectionState,r=this._pc.iceGatheringState;this._debug("iceStateChange (connection: %s) (gathering: %s)",t,r),this.emit("iceStateChange",t,r),"connected"!==t&&"completed"!==t||(this._pcReady=!0,this._maybeReady()),"failed"===t&&this.destroy(f("Ice connection failed.","ERR_ICE_CONNECTION_FAILURE")),"closed"===t&&this.destroy(new Error("Ice connection closed."))}},c.prototype.getStats=function(e){var t=this;0===t._pc.getStats.length?t._pc.getStats().then(function(t){var r=[];t.forEach(function(e){r.push(e)}),e(null,r)},function(t){e(t)}):t._isReactNativeWebrtc?t._pc.getStats(null,function(t){var r=[];t.forEach(function(e){r.push(e)}),e(null,r)},function(t){e(t)}):t._pc.getStats.length>0?t._pc.getStats(function(r){if(!t.destroyed){var n=[];r.result().forEach(function(e){var t={};e.names().forEach(function(r){t[r]=e.stat(r)}),t.id=e.id,t.type=e.type,t.timestamp=e.timestamp,n.push(t)}),e(null,n)}},function(t){e(t)}):e(null,[])},c.prototype._maybeReady=function(){var e=this;function t(){e.destroyed||e.getStats(function(r,n){if(!e.destroyed){r&&(n=[]);var i={},o={},s={},a=!1;if(n.forEach(function(e){"remotecandidate"!==e.type&&"remote-candidate"!==e.type||(i[e.id]=e),"localcandidate"!==e.type&&"local-candidate"!==e.type||(o[e.id]=e),"candidatepair"!==e.type&&"candidate-pair"!==e.type||(s[e.id]=e)}),n.forEach(function(e){"transport"===e.type&&e.selectedCandidatePairId&&c(s[e.selectedCandidatePairId]),("googCandidatePair"===e.type&&"true"===e.googActiveConnection||("candidatepair"===e.type||"candidate-pair"===e.type)&&e.selected)&&c(e)}),a||Object.keys(s).length&&!Object.keys(o).length){if(e._connecting=!1,e.connected=!0,e._chunk){try{e.send(e._chunk)}catch(r){return e.destroy(f(r,"ERR_DATA_CHANNEL"))}e._chunk=null,e._debug('sent chunk from "write before connect"');var u=e._cb;e._cb=null,u(null)}"number"!=typeof e._channel.bufferedAmountLowThreshold&&(e._interval=setInterval(function(){e._onInterval()},150),e._interval.unref&&e._interval.unref()),e._debug("connect"),e.emit("connect")}else setTimeout(t,100)}function c(t){a=!0;var r=o[t.localCandidateId];r&&r.ip?(e.localAddress=r.ip,e.localPort=Number(r.port)):r&&r.ipAddress?(e.localAddress=r.ipAddress,e.localPort=Number(r.portNumber)):"string"==typeof t.googLocalAddress&&(r=t.googLocalAddress.split(":"),e.localAddress=r[0],e.localPort=Number(r[1]));var n=i[t.remoteCandidateId];n&&n.ip?(e.remoteAddress=n.ip,e.remotePort=Number(n.port)):n&&n.ipAddress?(e.remoteAddress=n.ipAddress,e.remotePort=Number(n.portNumber)):"string"==typeof t.googRemoteAddress&&(n=t.googRemoteAddress.split(":"),e.remoteAddress=n[0],e.remotePort=Number(n[1])),e.remoteFamily="IPv4",e._debug("connect local: %s:%s remote: %s:%s",e.localAddress,e.localPort,e.remoteAddress,e.remotePort)}})}e._debug("maybeReady pc %s channel %s",e._pcReady,e._channelReady),!e.connected&&!e._connecting&&e._pcReady&&e._channelReady&&(e._connecting=!0,t())},c.prototype._onInterval=function(){var e=this;!this._cb||!this._channel||this._channel.bufferedAmount>65536||this._onChannelBufferedAmountLow()},c.prototype._onSignalingStateChange=function(){var e=this;e.destroyed||("stable"===e._pc.signalingState&&(e._isNegotiating=!1,e._debug("flushing sender queue",e._sendersAwaitingStable),e._sendersAwaitingStable.forEach(function(t){e.removeTrack(t),e._queuedNegotiation=!0}),e._sendersAwaitingStable=[],e._queuedNegotiation&&(e._debug("flushing negotiation queue"),e._queuedNegotiation=!1,e._needsNegotiation()),e._debug("negotiate"),e.emit("negotiate")),e._debug("signalingStateChange %s",e._pc.signalingState),e.emit("signalingStateChange",e._pc.signalingState))},c.prototype._onIceCandidate=function(e){var t=this;this.destroyed||(e.candidate&&this.trickle?this.emit("signal",{candidate:{candidate:e.candidate.candidate,sdpMLineIndex:e.candidate.sdpMLineIndex,sdpMid:e.candidate.sdpMid}}):e.candidate||(this._iceComplete=!0,this.emit("_iceComplete")))},c.prototype._onChannelMessage=function(e){var r=this;if(!this.destroyed){var n=e.data;n instanceof ArrayBuffer&&(n=t.from(n)),this.push(n)}},c.prototype._onChannelBufferedAmountLow=function(){var e=this;if(!this.destroyed&&this._cb){this._debug("ending backpressure: bufferedAmount %d",this._channel.bufferedAmount);var t=this._cb;this._cb=null,t(null)}},c.prototype._onChannelOpen=function(){var e=this;this.connected||this.destroyed||(this._debug("on channel open"),this._channelReady=!0,this._maybeReady())},c.prototype._onChannelClose=function(){var e=this;this.destroyed||(this._debug("on channel close"),this.destroy())},c.prototype._onTrack=function(e){var t=this;t.destroyed||e.streams.forEach(function(r){t._debug("on track"),t.emit("track",e.track,r),t._remoteTracks.push({track:e.track,stream:r}),t._remoteStreams.some(function(e){return e.id===r.id})||(t._remoteStreams.push(r),setTimeout(function(){t.emit("stream",r)},0))})},c.prototype._debug=function(){var e=this,t=[].slice.call(arguments);t[0]="["+this._id+"] "+t[0],n.apply(null,t)},c.prototype._transformConstraints=function(e){var t=this;if(0===Object.keys(e).length)return e;if((e.mandatory||e.optional)&&!this._isChromium){var r=Object.assign({},e.optional,e.mandatory);return void 0!==r.OfferToReceiveVideo&&(r.offerToReceiveVideo=r.OfferToReceiveVideo,delete r.OfferToReceiveVideo),void 0!==r.OfferToReceiveAudio&&(r.offerToReceiveAudio=r.OfferToReceiveAudio,delete r.OfferToReceiveAudio),r}return e.mandatory||e.optional||!this._isChromium?e:(void 0!==e.offerToReceiveVideo&&(e.OfferToReceiveVideo=e.offerToReceiveVideo,delete e.offerToReceiveVideo),void 0!==e.offerToReceiveAudio&&(e.OfferToReceiveAudio=e.offerToReceiveAudio,delete e.offerToReceiveAudio),{mandatory:e})}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";e.exports=function(){var e,t;function r(r){if("function"!=typeof r)throw new Error("read must be function");if(e)throw new Error("already piped");if(e=r,t){var n=t;t=null,e.apply(null,n)}}function n(r,n){e?e(r,n):t=[r,n]}return{source:n,sink:r}}},function(e,t,r){"use strict";(function(n){const i=r(8),o=r(53),s=r(1);function a(){return(~~(1e9*Math.random())).toString(36)}function u(e,t){const r=n.isBuffer(e)?[e]:[n.from(e)];i(i.values(r),o.encode(),i.collect((e,r)=>{if(e)return t(e);t(null,r[0])}))}function c(e){const t=a();function r(e){return r=>{Array.isArray(r)&&(r=r.join(" ")),e("(%s) %s",t,r)}}const n=r(s("mss:"+e));return n.error=r(s("mss:"+e+":error")),n}t=e.exports,t.writeEncoded=((e,t,r)=>{u(t,(t,n)=>{if(t)return r(t);e.write(n)})}),t.log={},t.log.dialer=(()=>c("dialer\t")),t.log.listener=(()=>c("listener\t"))}).call(this,r(0).Buffer)},function(e,t,r){var n=r(570),i=n(Object,"create");e.exports=i},function(e,t,r){var n=r(1287);function i(e,t){for(var r=e.length;r--;)if(n(e[r][0],t))return r;return-1}e.exports=i},function(e,t,r){var n=r(1293);function i(e,t){var r=e.__data__;return n(t)?r["string"==typeof t?"string":"hash"]:r.map}e.exports=i},function(e,t,r){"use strict";const n=r(22),i=r(74),o=r(481),s=r(9);function a(e){const t=new Error("invalid ipfs ref path");e=e.replace(/^\/ipfs\//,"");const r=e.match(/([^/]+(?:\/[^/]+)*)\/?$/);if(!r)throw t;const[n,...i]=r[1].split("/");if(o.cid(n))return{hash:n,links:i};throw t}t.OFFLINE_ERROR="This command must be run in online mode. Try running 'ipfs daemon' first.";const u=n(function(e,r,n){Array.isArray(r)||(r=[r]),i(r,(r,n)=>{if("string"!=typeof r){let e;try{e=new s(r)}catch(e){return n(e)}return n(null,e.buffer)}let i;try{i=t.parseIpfsPath(r)}catch(e){return n(e)}const o=new s(i.hash),a=i.links;if(!a.length)return n(null,o.buffer);function u(t,r,i){if(r)return n(r);if(!t.length)return n(null,i.multihash);const o=t[0],s=i.links.find(e=>e.name===o);if(!s)return n(new Error(`no link named "${o}" under ${i.toJSON().multihash}`));e.get(s.multihash,u.bind(null,t.slice(1)))}e.get(o,u.bind(null,a))},n)});t.parseIpfsPath=a,t.resolvePath=u},function(e,t,r){var n=r(1333);function i(e,t){return(e=e||[]).push(t),e}e.exports=function(e,t,r,o){var s,a,u;function c(i){var f=null,l=!1,h=0;if(u=i,s)return i(!!s.abort||s,function(e){o(e),a&&a()});var p=!1,d=n(function(){p||s||(p=!0,i(null,function(e,n){p=!1,function(e,n){s||(s=e,s?l||o(!0===s?null:s):(f=t(f,n),h=f&&f.length||0,null!=f&&y(),h<r&&d()))}(e,n)}))});function y(){if(!l){var t=f;f=null,l=!0,h=0,e(t,function(e){l=!1,!0!==s||h?s&&!0!==s?(o(s),a&&a()):e?i(s=!!e.abort||e,o):h?y():d():o(e)})}}c.abort=function(e){a=function(t){e&&e()};var t=new Error("aborted");t.abort=!0,i(s=t,function(e){e=!0===e?null:e,l||(o&&o(e),a&&a(e))})},d()}return t=t||i,c.abort=function(e){s=new Error("aborted before connecting"),a=function(t){e&&e()}},c}},function(e,t,r){var n=r(525);e.exports=function(e,t){return function(r){var i=[],o,s;function a(e){i.push(e)}e=e||function(e){this.queue(e)},t=t||function(){this.queue(null)};var u={emit:function(e,t){"data"==e&&a(t),"end"==e&&(o=!0,a(null)),"error"==e&&(s=t)},queue:a},c;return function(a,f){if(o=o||a,a)return r(a,function(){if(c){var e=c;c=null,e(a)}f(a)});c=f,n(function n(a){if(c)if(f=c,s)c=null,f(s);else if(i.length){var l=i.shift();c=null,f(null===l,l)}else r(o,function(i,l){if(i&&!0!==i)return s=i,a();if(o=o||i)t.call(u);else if(null!==l&&(e.call(u,l),s||o))return r(s||o,function(){c=null,f(s||o)});a(n)})})}}}},function(e,t,r){"use strict";var n=r(1384),i="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_-",o,s,a;function u(){a=!1}function c(e){if(e){if(e!==o){if(e.length!==i.length)throw new Error("Custom alphabet for shortid must be "+i.length+" unique characters. You submitted "+e.length+" characters: "+e);var t=e.split("").filter(function(e,t,r){return t!==r.lastIndexOf(e)});if(t.length)throw new Error("Custom alphabet for shortid must be "+i.length+" unique characters. These characters were not unique: "+t.join(", "));o=e,u()}}else o!==i&&(o=i,u())}function f(e){return c(e),o}function l(e){n.seed(e),s!==e&&(u(),s=e)}function h(){o||c(i);for(var e=o.split(""),t=[],r=n.nextValue(),s;e.length>0;)r=n.nextValue(),s=Math.floor(r*e.length),t.push(e.splice(s,1)[0]);return t.join("")}function p(){return a||(a=h(),a)}function d(e){var t=p();return t[e]}function y(){return o||i}e.exports={get:y,characters:f,seed:l,lookup:d,shuffled:p}},function(e,t,r){var n=e.exports;n.encode=r(1461),n.decode=r(1462),n.byteLength=n.encodingLength=function(e){return n.encode(e).length}},function(e,t,r){"use strict";function n(e,t){for(var r=1,n=e.length,i=e[0],o=e[0],s=1;s<n;++s)if(o=i,i=e[s],t(i,o)){if(s===r){r++;continue}e[r++]=i}return e.length=r,e}function i(e){for(var t=1,r=e.length,n=e[0],i=e[0],o=1;o<r;++o,i=n)if(i=n,n=e[o],n!==i){if(o===t){t++;continue}e[t++]=n}return e.length=t,e}function o(e,t,r){return 0===e.length?e:t?(r||e.sort(t),n(e,t)):(r||e.sort(),i(e))}e.exports=o},function(e,t,r){(function(t){var r=void 0!==t?t:Uint8Array;function n(e,t){if(!(this instanceof n))return new n(e,t);0===arguments.length&&(e=0),this.grow=t&&(isFinite(t.grow)&&i(t.grow)||t.grow)||0,"number"!=typeof e&&void 0!==e||(e=new r(i(e)),e.fill&&!e._isBuffer&&e.fill(0)),this.buffer=e}function i(e){var t=e>>3;return e%8!=0&&t++,t}n.prototype.get=function(e){var t=e>>3;return t<this.buffer.length&&!!(this.buffer[t]&128>>e%8)},n.prototype.set=function(e,t){var r=e>>3;t||1===arguments.length?(this.buffer.length<r+1&&this._grow(Math.max(r+1,Math.min(2*this.buffer.length,this.grow))),this.buffer[r]|=128>>e%8):r<this.buffer.length&&(this.buffer[r]&=~(128>>e%8))},n.prototype._grow=function(e){if(this.buffer.length<e&&e<=this.grow){var t=new r(e);if(t.fill&&t.fill(0),this.buffer.copy)this.buffer.copy(t,0);else for(var n=0;n<this.buffer.length;n++)t[n]=this.buffer[n];this.buffer=t}},e.exports=n}).call(this,r(0).Buffer)},function(e,t,r){var n=r(609),i=r(150),o=r(324),s=r(1519),a=4294967295,u=t,c=t.containers={moov:["mvhd","meta","traks","mvex"],trak:["tkhd","tref","trgr","edts","meta","mdia","udta"],edts:["elst"],mdia:["mdhd","hdlr","elng","minf"],minf:["vmhd","smhd","hmhd","sthd","nmhd","dinf","stbl"],dinf:["dref"],stbl:["stsd","stts","ctts","cslg","stsc","stsz","stz2","stco","co64","stss","stsh","padb","stdp","sdtp","sbgps","sgpds","subss","saizs","saios"],mvex:["mehd","trexs","leva"],moof:["mfhd","meta","trafs"],traf:["tfhd","tfdt","trun","sbgps","sgpds","subss","saizs","saios","meta"]};u.encode=function(e,t,r){return u.encodingLength(e),r=r||0,t=t||i(e.length),u._encode(e,t,r)},u._encode=function(e,t,r){var i=e.type,o=e.length;o>4294967295&&(o=1),t.writeUInt32BE(o,r),t.write(e.type,r+4,4,"ascii");var a=r+8;if(1===o&&(n.encode(e.length,t,a),a+=8),s.fullBoxes[i]&&(t.writeUInt32BE(e.flags||0,a),t.writeUInt8(e.version||0,a),a+=4),c[i]){var f=c[i];f.forEach(function(r){if(5===r.length){var n=e[r]||[];r=r.substr(0,4),n.forEach(function(e){u._encode(e,t,a),a+=u.encode.bytes})}else e[r]&&(u._encode(e[r],t,a),a+=u.encode.bytes)}),e.otherBoxes&&e.otherBoxes.forEach(function(e){u._encode(e,t,a),a+=u.encode.bytes})}else if(s[i]){var l=s[i].encode;l(e,t,a),a+=l.bytes}else{if(!e.buffer)throw new Error("Either `type` must be set to a known type (not'"+i+"') or `buffer` must be set");var h=e.buffer;h.copy(t,a),a+=e.buffer.length}return u.encode.bytes=a-r,t},u.readHeaders=function(e,t,r){if(t=t||0,r=r||e.length,r-t<8)return 8;var i=e.readUInt32BE(t),o=e.toString("ascii",t+4,t+8),a=t+8,u,c;if(1===i){if(r-t<16)return 16;i=n.decode(e,a),a+=8}return s.fullBoxes[o]&&(u=e.readUInt8(a),c=16777215&e.readUInt32BE(a),a+=4),{length:i,headersLen:a-t,contentLen:i-(a-t),type:o,version:u,flags:c}},u.decode=function(e,t,r){t=t||0,r=r||e.length;var n=u.readHeaders(e,t,r);if(!n||n.length>r-t)throw new Error("Data too short");return u.decodeWithoutHeaders(n,e,t+n.headersLen,t+n.length)},u.decodeWithoutHeaders=function(e,t,r,n){r=r||0,n=n||t.length;var i=e.type,a={};if(c[i]){a.otherBoxes=[];for(var f=c[i],l=r;n-l>=8;){var h=u.decode(t,l,n);if(l+=h.length,f.indexOf(h.type)>=0)a[h.type]=h;else if(f.indexOf(h.type+"s")>=0){var p=h.type+"s",d=a[p]=a[p]||[];d.push(h)}else a.otherBoxes.push(h)}}else if(s[i]){var y=s[i].decode;a=y(t,r,n)}else a.buffer=o(t.slice(r,n));return a.length=e.length,a.contentLen=e.contentLen,a.type=e.type,a.version=e.version,a.flags=e.flags,a},u.encodingLength=function(e){var t=e.type,r=8;if(s.fullBoxes[t]&&(r+=4),c[t]){var n=c[t];n.forEach(function(t){if(5===t.length){var n=e[t]||[];t=t.substr(0,4),n.forEach(function(e){e.type=t,r+=u.encodingLength(e)})}else if(e[t]){var i=e[t];i.type=t,r+=u.encodingLength(i)}}),e.otherBoxes&&e.otherBoxes.forEach(function(e){r+=u.encodingLength(e)})}else if(s[t])r+=s[t].encodingLength(e);else{if(!e.buffer)throw new Error("Either `type` must be set to a known type (not'"+t+"') or `buffer` must be set");r+=e.buffer.length}return r>4294967295&&(r+=8),e.length=r,r}},function(e,t,r){"use strict";t.decode=t.parse=r(616),t.encode=t.stringify=r(617)},function(e,t){var r=1e3,n=60*r,i=60*n,o=24*i,s=365.25*o;function a(e){if(e=String(e),!(e.length>100)){var t=/^((?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|years?|yrs?|y)?$/i.exec(e);if(t){var a=parseFloat(t[1]),u=(t[2]||"ms").toLowerCase();switch(u){case"years":case"year":case"yrs":case"yr":case"y":return a*s;case"days":case"day":case"d":return a*o;case"hours":case"hour":case"hrs":case"hr":case"h":return a*i;case"minutes":case"minute":case"mins":case"min":case"m":return a*n;case"seconds":case"second":case"secs":case"sec":case"s":return a*r;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return a;default:return}}}}function u(e){return e>=o?Math.round(e/o)+"d":e>=i?Math.round(e/i)+"h":e>=n?Math.round(e/n)+"m":e>=r?Math.round(e/r)+"s":e+"ms"}function c(e){return f(e,o,"day")||f(e,i,"hour")||f(e,n,"minute")||f(e,r,"second")||e+" ms"}function f(e,t,r){if(!(e<t))return e<1.5*t?Math.floor(e/t)+" "+r:Math.ceil(e/t)+" "+r+"s"}e.exports=function(e,t){t=t||{};var r=typeof e;if("string"===r&&e.length>0)return a(e);if("number"===r&&!1===isNaN(e))return t.long?c(e):u(e);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))}},function(e,t,r){"use strict";(function(t,n){var i=r(152);function o(e,t,r){this.chunk=e,this.encoding=t,this.callback=r,this.next=null}function s(e){var t=this;this.next=null,this.entry=null,this.finish=function(){M(t,e)}}e.exports=_;var a=!t.browser&&["v0.10","v0.9."].indexOf(t.version.slice(0,5))>-1?setImmediate:i.nextTick,u;_.WritableState=v;var c=r(119);c.inherits=r(4);var f={deprecate:r(624)},l=r(328),h=r(2).Buffer,p=n.Uint8Array||function(){};function d(e){return h.from(e)}function y(e){return h.isBuffer(e)||e instanceof p}var g=r(330),m;function b(){}function v(e,t){u=u||r(89),e=e||{};var n=t instanceof u;this.objectMode=!!e.objectMode,n&&(this.objectMode=this.objectMode||!!e.writableObjectMode);var i=e.highWaterMark,o=e.writableHighWaterMark,a=this.objectMode?16:16384;this.highWaterMark=i||0===i?i:n&&(o||0===o)?o:a,this.highWaterMark=Math.floor(this.highWaterMark),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var c=!1===e.decodeStrings;this.decodeStrings=!c,this.defaultEncoding=e.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(e){T(t,e)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.bufferedRequestCount=0,this.corkedRequestsFree=new s(this)}function _(e){if(u=u||r(89),!(m.call(_,this)||this instanceof u))return new _(e);this._writableState=new v(e,this),this.writable=!0,e&&("function"==typeof e.write&&(this._write=e.write),"function"==typeof e.writev&&(this._writev=e.writev),"function"==typeof e.destroy&&(this._destroy=e.destroy),"function"==typeof e.final&&(this._final=e.final)),l.call(this)}function w(e,t){var r=new Error("write after end");e.emit("error",r),i.nextTick(t,r)}function S(e,t,r,n){var o=!0,s=!1;return null===r?s=new TypeError("May not write null values to stream"):"string"==typeof r||void 0===r||t.objectMode||(s=new TypeError("Invalid non-string/buffer chunk")),s&&(e.emit("error",s),i.nextTick(n,s),o=!1),o}function k(e,t,r){return e.objectMode||!1===e.decodeStrings||"string"!=typeof t||(t=h.from(t,r)),t}function E(e,t,r,n,i,o){if(!r){var s=k(t,n,i);n!==s&&(r=!0,i="buffer",n=s)}var a=t.objectMode?1:n.length;t.length+=a;var u=t.length<t.highWaterMark;if(u||(t.needDrain=!0),t.writing||t.corked){var c=t.lastBufferedRequest;t.lastBufferedRequest={chunk:n,encoding:i,isBuf:r,callback:o,next:null},c?c.next=t.lastBufferedRequest:t.bufferedRequest=t.lastBufferedRequest,t.bufferedRequestCount+=1}else A(e,t,!1,a,n,i,o);return u}function A(e,t,r,n,i,o,s){t.writelen=n,t.writecb=s,t.writing=!0,t.sync=!0,r?e._writev(i,t.onwrite):e._write(i,o,t.onwrite),t.sync=!1}function x(e,t,r,n,o){--t.pendingcb,r?(i.nextTick(o,n),i.nextTick(L,e,t),e._writableState.errorEmitted=!0,e.emit("error",n)):(o(n),e._writableState.errorEmitted=!0,e.emit("error",n),L(e,t))}function I(e){e.writing=!1,e.writecb=null,e.length-=e.writelen,e.writelen=0}function T(e,t){var r=e._writableState,n=r.sync,i=r.writecb;if(I(r),t)x(e,r,n,t,i);else{var o=O(r);o||r.corked||r.bufferProcessing||!r.bufferedRequest||P(e,r),n?a(B,e,r,o,i):B(e,r,o,i)}}function B(e,t,r,n){r||C(e,t),t.pendingcb--,n(),L(e,t)}function C(e,t){0===t.length&&t.needDrain&&(t.needDrain=!1,e.emit("drain"))}function P(e,t){t.bufferProcessing=!0;var r=t.bufferedRequest;if(e._writev&&r&&r.next){var n=t.bufferedRequestCount,i=new Array(n),o=t.corkedRequestsFree;o.entry=r;for(var a=0,u=!0;r;)i[a]=r,r.isBuf||(u=!1),r=r.next,a+=1;i.allBuffers=u,A(e,t,!0,t.length,i,"",o.finish),t.pendingcb++,t.lastBufferedRequest=null,o.next?(t.corkedRequestsFree=o.next,o.next=null):t.corkedRequestsFree=new s(t),t.bufferedRequestCount=0}else{for(;r;){var c=r.chunk,f=r.encoding,l=r.callback,h=t.objectMode?1:c.length;if(A(e,t,!1,h,c,f,l),r=r.next,t.bufferedRequestCount--,t.writing)break}null===r&&(t.lastBufferedRequest=null)}t.bufferedRequest=r,t.bufferProcessing=!1}function O(e){return e.ending&&0===e.length&&null===e.bufferedRequest&&!e.finished&&!e.writing}function R(e,t){e._final(function(r){t.pendingcb--,r&&e.emit("error",r),t.prefinished=!0,e.emit("prefinish"),L(e,t)})}function N(e,t){t.prefinished||t.finalCalled||("function"==typeof e._final?(t.pendingcb++,t.finalCalled=!0,i.nextTick(R,e,t)):(t.prefinished=!0,e.emit("prefinish")))}function L(e,t){var r=O(t);return r&&(N(e,t),0===t.pendingcb&&(t.finished=!0,e.emit("finish"))),r}function j(e,t,r){t.ending=!0,L(e,t),r&&(t.finished?i.nextTick(r):e.once("finish",r)),t.ended=!0,e.writable=!1}function M(e,t,r){var n=e.entry;for(e.entry=null;n;){var i=n.callback;t.pendingcb--,i(r),n=n.next}t.corkedRequestsFree?t.corkedRequestsFree.next=e:t.corkedRequestsFree=e}c.inherits(_,l),v.prototype.getBuffer=function e(){for(var t=this.bufferedRequest,r=[];t;)r.push(t),t=t.next;return r},function(){try{Object.defineProperty(v.prototype,"buffer",{get:f.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch(e){}}(),"function"==typeof Symbol&&Symbol.hasInstance&&"function"==typeof Function.prototype[Symbol.hasInstance]?(m=Function.prototype[Symbol.hasInstance],Object.defineProperty(_,Symbol.hasInstance,{value:function(e){return!!m.call(this,e)||this===_&&(e&&e._writableState instanceof v)}})):m=function(e){return e instanceof this},_.prototype.pipe=function(){this.emit("error",new Error("Cannot pipe, not readable"))},_.prototype.write=function(e,t,r){var n=this._writableState,i=!1,o=!n.objectMode&&y(e);return o&&!h.isBuffer(e)&&(e=d(e)),"function"==typeof t&&(r=t,t=null),o?t="buffer":t||(t=n.defaultEncoding),"function"!=typeof r&&(r=b),n.ended?w(this,r):(o||S(this,n,e,r))&&(n.pendingcb++,i=E(this,n,o,e,t,r)),i},_.prototype.cork=function(){var e=this._writableState;e.corked++},_.prototype.uncork=function(){var e=this._writableState;e.corked&&(e.corked--,e.writing||e.corked||e.finished||e.bufferProcessing||!e.bufferedRequest||P(this,e))},_.prototype.setDefaultEncoding=function e(t){if("string"==typeof t&&(t=t.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((t+"").toLowerCase())>-1))throw new TypeError("Unknown encoding: "+t);return this._writableState.defaultEncoding=t,this},Object.defineProperty(_.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),_.prototype._write=function(e,t,r){r(new Error("_write() is not implemented"))},_.prototype._writev=null,_.prototype.end=function(e,t,r){var n=this._writableState;"function"==typeof e?(r=e,e=null,t=null):"function"==typeof t&&(r=t,t=null),null!==e&&void 0!==e&&this.write(e,t),n.corked&&(n.corked=1,this.uncork()),n.ending||n.finished||j(this,n,r)},Object.defineProperty(_.prototype,"destroyed",{get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(e){this._writableState&&(this._writableState.destroyed=e)}}),_.prototype.destroy=g.destroy,_.prototype._undestroy=g.undestroy,_.prototype._destroy=function(e,t){this.end(),t(e)}}).call(this,r(6),r(7))},function(e,t,r){"use strict";var n=r(2).Buffer,i=n.isEncoding||function(e){switch(e=""+e,e&&e.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function o(e){if(!e)return"utf8";for(var t;;)switch(e){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return e;default:if(t)return;e=(""+e).toLowerCase(),t=!0}}function s(e){var t=o(e);if("string"!=typeof t&&(n.isEncoding===i||!i(e)))throw new Error("Unknown encoding: "+e);return t||e}function a(e){var t;switch(this.encoding=s(e),this.encoding){case"utf16le":this.text=d,this.end=y,t=4;break;case"utf8":this.fillLast=l,t=4;break;case"base64":this.text=g,this.end=m,t=3;break;default:return this.write=b,void(this.end=v)}this.lastNeed=0,this.lastTotal=0,this.lastChar=n.allocUnsafe(t)}function u(e){return e<=127?0:e>>5==6?2:e>>4==14?3:e>>3==30?4:e>>6==2?-1:-2}function c(e,t,r){var n=t.length-1;if(n<r)return 0;var i=u(t[n]);return i>=0?(i>0&&(e.lastNeed=i-1),i):--n<r||-2===i?0:(i=u(t[n]),i>=0?(i>0&&(e.lastNeed=i-2),i):--n<r||-2===i?0:(i=u(t[n]),i>=0?(i>0&&(2===i?i=0:e.lastNeed=i-3),i):0))}function f(e,t,r){if(128!=(192&t[0]))return e.lastNeed=0,"<22>";if(e.lastNeed>1&&t.length>1){if(128!=(192&t[1]))return e.lastNeed=1,"<22>";if(e.lastNeed>2&&t.length>2&&128!=(192&t[2]))return e.lastNeed=2,"<22>"}}function l(e){var t=this.lastTotal-this.lastNeed,r=f(this,e,t);return void 0!==r?r:this.lastNeed<=e.length?(e.copy(this.lastChar,t,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal)):(e.copy(this.lastChar,t,0,e.length),void(this.lastNeed-=e.length))}function h(e,t){var r=c(this,e,t);if(!this.lastNeed)return e.toString("utf8",t);this.lastTotal=r;var n=e.length-(r-this.lastNeed);return e.copy(this.lastChar,0,n),e.toString("utf8",t,n)}function p(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+"<22>":t}function d(e,t){if((e.length-t)%2==0){var r=e.toString("utf16le",t);if(r){var n=r.charCodeAt(r.length-1);if(n>=55296&&n<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1],r.slice(0,-1)}return r}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=e[e.length-1],e.toString("utf16le",t,e.length-1)}function y(e){var t=e&&e.length?this.write(e):"";if(this.lastNeed){var r=this.lastTotal-this.lastNeed;return t+this.lastChar.toString("utf16le",0,r)}return t}function g(e,t){var r=(e.length-t)%3;return 0===r?e.toString("base64",t):(this.lastNeed=3-r,this.lastTotal=3,1===r?this.lastChar[0]=e[e.length-1]:(this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1]),e.toString("base64",t,e.length-r))}function m(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+this.lastChar.toString("base64",0,3-this.lastNeed):t}function b(e){return e.toString(this.encoding)}function v(e){return e&&e.length?this.write(e):""}t.StringDecoder=a,a.prototype.write=function(e){if(0===e.length)return"";var t,r;if(this.lastNeed){if(t=this.fillLast(e),void 0===t)return"";r=this.lastNeed,this.lastNeed=0}else r=0;return r<e.length?t?t+this.text(e,r):this.text(e,r):t||""},a.prototype.end=p,a.prototype.text=h,a.prototype.fillLast=function(e){if(this.lastNeed<=e.length)return e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,e.length),this.lastNeed-=e.length}},function(e,t,r){"use strict";(function(n){const i=r(633);t=e.exports=s,t.encode=a,t.decode=u,t.isEncoded=c;const o=new Error("Unsupported encoding");function s(e,t){if(!t)throw new Error("requires an encoded buffer");const r=l(e),i=n.from(r.code),o=r.name;return f(o,t),n.concat([i,t])}function a(e,t){const r=l(e),i=r.name;return s(i,n.from(r.encode(t)))}function u(e){n.isBuffer(e)&&(e=e.toString());const t=e.substring(0,1);e=e.substring(1,e.length),"string"==typeof e&&(e=n.from(e));const r=l(t),i={base:r.name,data:n.from(r.decode(e.toString()))};return i.data}function c(e){n.isBuffer(e)&&(e=e.toString());const t=e.substring(0,1);try{const e=l(t);return e.name}catch(e){return!1}}function f(e,t){const r=l(e);r.decode(t.toString())}function l(e){let t;if(i.names[e])t=i.names[e];else{if(!i.codes[e])throw o;t=i.codes[e]}if(!t.isImplemented())throw new Error("Base "+e+" is not implemented yet");return t}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";var n=r(339);e.exports=function e(t,r){return function(e,i){if(e)return n(i,e,r);if(null!=t){var o=t;t=null,i(null,o)}else i(!0)}}},function(e,t,r){"use strict";var n=r(121);e.exports=function e(t,r,i){i||(i=r,r=null);var o=n(function(e){r=t(r,e)},function(e){i(e,r)});return 2===arguments.length?function(e){e(null,function(t,n){if(t)return i(!0===t?null:t);r=n,o(e)})}:o}},function(e,t){function r(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}e.exports=r},function(e,t,r){"use strict";(function(e){Object.defineProperty(t,"__esModule",{value:!0}),t.hasNextTick=t.hasSetImmediate=void 0,t.fallback=c,t.wrap=f;var n=r(104),i=o(n);function o(e){return e&&e.__esModule?e:{default:e}}var s=t.hasSetImmediate="function"==typeof setImmediate&&setImmediate,a=t.hasNextTick="object"==typeof e&&"function"==typeof e.nextTick,u;function c(e){setTimeout(e,0)}function f(e){return function(t){var r=(0,i.default)(arguments,1);e(function(){t.apply(null,r)})}}u=s?setImmediate:a?e.nextTick:c,t.default=f(u)}).call(this,r(6))},function(e,t,r){var n=r(156),i=r(212),o="[object AsyncFunction]",s="[object Function]",a="[object GeneratorFunction]",u="[object Proxy]";function c(e){if(!i(e))return!1;var t=n(e);return t==s||t==a||t==o||t==u}e.exports=c},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(349),i=a(n),o=r(160),s=a(o);function a(e){return e&&e.__esModule?e:{default:e}}t.default=(0,s.default)(i.default,1),e.exports=t.default},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=d;var n=r(54),i=p(n),o=r(155),s=p(o),a=r(660),u=p(a),c=r(105),f=p(c),l=r(217),h=p(l);function p(e){return e&&e.__esModule?e:{default:e}}function d(e){return function(t,r,n){if(n=(0,s.default)(n||i.default),e<=0||!t)return n(null);var o=(0,u.default)(t),a=!1,c=0,l=!1;function p(e,t){if(c-=1,e)a=!0,n(e);else{if(t===h.default||a&&c<=0)return a=!0,n(null);l||d()}}function d(){for(l=!0;c<e&&!a;){var t=o();if(null===t)return a=!0,void(c<=0&&n(null));c+=1,r(t.value,t.key,(0,f.default)(p))}l=!1}d()}}e.exports=t.default},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default={},e.exports=t.default},function(e,t,r){var n=r(354),i=r(355);function o(e,t,r){var o=t&&r||0;"string"==typeof e&&(t="binary"===e?new Array(16):null,e=null),e=e||{};var s=e.random||(e.rng||n)();if(s[6]=15&s[6]|64,s[8]=63&s[8]|128,t)for(var a=0;a<16;++a)t[o+a]=s[a];return t||i(s)}e.exports=o},function(e,t,r){"use strict";const n=r(8),i=r(162),o=r(55),s=r(356),a=r(218);t.asyncFilter=function(e){let t=!1,r,n;return function(i){return function o(s,a){if(n)return a(n);s?(n=s,i(s,t?()=>{t?r=a:a(s)}:a)):i(null,(i,s)=>{i?a(i):n?a(n):(t=!0,e(s,(e,i)=>{t=!1,n?(a(n),r(n)):e?o(e,a):i?a(null,s):o(null,a)}))})}}},t.asyncSort=function(e){const t=i(),r=n.collect((r,i)=>{if(r)return t.abort(r);e(i,(e,r)=>{if(e)return t.abort(e);t.resolve(n.values(i))})});return function(e){return r(e),t}},t.replaceStartWith=function(e,t){const r=new RegExp("^"+t);return e.replace(r,"")},t.tmpdir=(()=>o.join(s.tmpdir(),a()))},function(e,t,r){(function(t){var r="Expected a function",n="__lodash_hash_undefined__",i=1/0,o="[object Function]",s="[object GeneratorFunction]",a="[object Symbol]",u=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,c=/^\w*$/,f=/^\./,l=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,h=/[\\^$.*+?()[\]{}|]/g,p=/\\(\\)?/g,d=/^\[object .+?Constructor\]$/,y="object"==typeof t&&t&&t.Object===Object&&t,g="object"==typeof self&&self&&self.Object===Object&&self,m=y||g||Function("return this")();function b(e,t){return null==e?void 0:e[t]}function v(e){var t=!1;if(null!=e&&"function"!=typeof e.toString)try{t=!!(e+"")}catch(e){}return t}var _=Array.prototype,w=Function.prototype,S=Object.prototype,k=m["__core-js_shared__"],E=(A=/[^.]+$/.exec(k&&k.keys&&k.keys.IE_PROTO||""),A?"Symbol(src)_1."+A:""),A,x=w.toString,I=S.hasOwnProperty,T=S.toString,B=RegExp("^"+x.call(I).replace(h,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),C=m.Symbol,P=_.splice,O=se(m,"Map"),R=se(Object,"create"),N=C?C.prototype:void 0,L=N?N.toString:void 0;function j(e){var t=-1,r=e?e.length:0;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}function M(){this.__data__=R?R(null):{}}function K(e){return this.has(e)&&delete this.__data__[e]}function D(e){var t=this.__data__;if(R){var r=t[e];return r===n?void 0:r}return I.call(t,e)?t[e]:void 0}function U(e){var t=this.__data__;return R?void 0!==t[e]:I.call(t,e)}function F(e,t){var r=this.__data__;return r[e]=R&&void 0===t?n:t,this}function q(e){var t=-1,r=e?e.length:0;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}function H(){this.__data__=[]}function z(e){var t=this.__data__,r=ee(t,e);if(r<0)return!1;var n=t.length-1;return r==n?t.pop():P.call(t,r,1),!0}function V(e){var t=this.__data__,r=ee(t,e);return r<0?void 0:t[r][1]}function G(e){return ee(this.__data__,e)>-1}function W(e,t){var r=this.__data__,n=ee(r,e);return n<0?r.push([e,t]):r[n][1]=t,this}function $(e){var t=-1,r=e?e.length:0;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}function Y(){this.__data__={hash:new j,map:new(O||q),string:new j}}function J(e){return oe(this,e).delete(e)}function X(e){return oe(this,e).get(e)}function Z(e){return oe(this,e).has(e)}function Q(e,t){return oe(this,e).set(e,t),this}function ee(e,t){for(var r=e.length;r--;)if(de(e[r][0],t))return r;return-1}function te(e,t){t=ae(t,e)?[t]:ie(t);for(var r=0,n=t.length;null!=e&&r<n;)e=e[le(t[r++])];return r&&r==n?e:void 0}function re(e){if(!me(e)||ce(e))return!1;var t=ge(e)||v(e)?B:d;return t.test(he(e))}function ne(e){if("string"==typeof e)return e;if(ve(e))return L?L.call(e):"";var t=e+"";return"0"==t&&1/e==-i?"-0":t}function ie(e){return ye(e)?e:fe(e)}function oe(e,t){var r=e.__data__;return ue(t)?r["string"==typeof t?"string":"hash"]:r.map}function se(e,t){var r=b(e,t);return re(r)?r:void 0}function ae(e,t){if(ye(e))return!1;var r=typeof e;return!("number"!=r&&"symbol"!=r&&"boolean"!=r&&null!=e&&!ve(e))||(c.test(e)||!u.test(e)||null!=t&&e in Object(t))}function ue(e){var t=typeof e;return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e}function ce(e){return!!E&&E in e}j.prototype.clear=M,j.prototype.delete=K,j.prototype.get=D,j.prototype.has=U,j.prototype.set=F,q.prototype.clear=H,q.prototype.delete=z,q.prototype.get=V,q.prototype.has=G,q.prototype.set=W,$.prototype.clear=Y,$.prototype.delete=J,$.prototype.get=X,$.prototype.has=Z,$.prototype.set=Q;var fe=pe(function(e){e=_e(e);var t=[];return f.test(e)&&t.push(""),e.replace(l,function(e,r,n,i){t.push(n?i.replace(p,"$1"):r||e)}),t});function le(e){if("string"==typeof e||ve(e))return e;var t=e+"";return"0"==t&&1/e==-i?"-0":t}function he(e){if(null!=e){try{return x.call(e)}catch(e){}try{return e+""}catch(e){}}return""}function pe(e,t){if("function"!=typeof e||t&&"function"!=typeof t)throw new TypeError(r);var n=function(){var r=arguments,i=t?t.apply(this,r):r[0],o=n.cache;if(o.has(i))return o.get(i);var s=e.apply(this,r);return n.cache=o.set(i,s),s};return n.cache=new(pe.Cache||$),n}function de(e,t){return e===t||e!=e&&t!=t}pe.Cache=$;var ye=Array.isArray;function ge(e){var t=me(e)?T.call(e):"";return t==o||t==s}function me(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function be(e){return!!e&&"object"==typeof e}function ve(e){return"symbol"==typeof e||be(e)&&T.call(e)==a}function _e(e){return null==e?"":ne(e)}function we(e,t,r){var n=null==e?void 0:te(e,t);return void 0===n?r:n}e.exports=we}).call(this,r(7))},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(695),i=a(n),o=r(164),s=a(o);function a(e){return e&&e.__esModule?e:{default:e}}t.default=(0,s.default)(i.default),e.exports=t.default},function(e,t){function r(e,t){for(var r=-1,n=null==e?0:e.length,i=Array(n);++r<n;)i[r]=t(e[r],r,e);return i}e.exports=r},function(e,t,r){t.AbstractLevelDOWN=r(708),t.AbstractIterator=r(369),t.AbstractChainedBatch=r(370)},function(e,t){var r=t.once=function(e){return function(t,r){if(t)return r(t);if(null!=e){var n=e;e=null,r(null,n)}else r(!0)}},n=t.depthFirst=function(e,t){var n=[],i;return n.unshift(r(e)),function e(r,o){return n.length?i?o(i):void n[0](r,function(r,s){if(r){if(!0!==r){for(i=r,n.shift();n.length;)n.shift()(r,function(){});return o(r)}return n.shift(),e(null,o)}n.unshift(t(s)),o(r,s)}):o(!0)}},i=t.widthFirst=function(e,t){var n=[];return n.push(r(e)),function e(r,i){if(!n.length)return i(!0);n[0](r,function(r,o){if(r)return n.shift(),e(null,i);n.push(t(o)),i(r,o)})}},o=t.leafFirst=function(e,t){var n=[],i=[];return n.push(r(e)),function e(r,o){n[0](r,function(r,s){if(r)return n.shift(),i.length?o(null,i.shift()):o(!0);n.unshift(t(s)),i.unshift(s),e(null,o)})}}},function(e,t,r){"use strict";(function(n){const i=r(9),o=r(12),s=o(r(743)),a=r(382),u=r(93),c=r(166),f=r(59),l=r(5);function h(e,t,r){"function"==typeof t&&(r=t,t={}),t=t||{};const n=t.hashAlg||a.defaultHashAlg;let o=t.version;void 0===o&&(o="sha2-256"===n?0:1),l([t=>p(e,t),(e,t)=>f(e,n,t),(e,t)=>t(null,new i(o,a.multicodec,e))],r)}function p(e,t){let r;!c.isDAGNode(e)&&e.links&&(e.links=e.links.map(e=>u.isDAGLink(e)?e:u.util.createDagLinkFromB58EncodedHash(e)));try{r=s.PBNode.encode(y(e))}catch(e){return t(e)}t(null,r)}function d(e,t){const r=s.PBNode.decode(e),i=r.Links.map(e=>new u(e.Name,e.Tsize,e.Hash)),o=null==r.Data?n.alloc(0):n.from(r.Data);c.create(o,i,t)}function y(e){const t={};return e.data&&e.data.length>0?t.Data=e.data:t.Data=null,e.links&&e.links.length>0?t.Links=e.links.map(e=>({Hash:e.multihash,Name:e.name,Tsize:e.size})):t.Links=null,t}t=e.exports,t.serialize=p,t.deserialize=d,t.cid=h}).call(this,r(0).Buffer)},function(e,t,r){"use strict";t.defined=function(e){return null!==e&&void 0!==e&&("number"!=typeof e||!isNaN(e))}},function(e,t,r){"use strict";(function(e){const n=r(169),i=r(170),o=i.SHIFT32,s=i.SHIFT16,a=2097151;function u(e){return e<16?"0"+e.toString(16):e.toString(16)}t.parseHalf=function e(t){var r,n,i;return i=128&t[0]?-1:1,r=(124&t[0])>>2,n=(3&t[0])<<8|t[1],r?31===r?i*(n?NaN:Infinity):i*Math.pow(2,r-25)*(1024+n):5.960464477539063e-8*i*n},t.arrayBufferToBignumber=function(e){const t=e.byteLength;let r="";for(let n=0;n<t;n++)r+=u(e[n]);return new n(r,16)},t.buildMap=(e=>{const t=new Map,r=Object.keys(e),n=r.length;for(let i=0;i<n;i++)t.set(r[i],e[r[i]]);return t}),t.buildInt32=((e,t)=>e*s+t),t.buildInt64=((e,r,i,s)=>{const a=t.buildInt32(e,r),u=t.buildInt32(i,s);return a>2097151?new n(a).times(o).plus(u):a*o+u}),t.writeHalf=function t(r,n){const i=e.allocUnsafe(4);i.writeFloatBE(n,0);const o=i.readUInt32BE(0);if(0!=(8191&o))return!1;var s=o>>16&32768;const a=o>>23&255,u=8388607&o;if(a>=113&&a<=142)s+=(a-112<<10)+(u>>13);else{if(!(a>=103&&a<113))return!1;if(u&(1<<126-a)-1)return!1;s+=u+8388608>>126-a}return r.writeUInt16BE(s,0),!0},t.keySorter=function(e,t){var r=e[0].byteLength,n=t[0].byteLength;return r>n?1:n>r?-1:e[0].compare(t[0])},t.isNegativeZero=(e=>0===e&&1/e<0),t.nextPowerOf2=(e=>{let t=0;if(e&&!(e&e-1))return e;for(;0!==e;)e>>=1,t+=1;return 1<<t})}).call(this,r(0).Buffer)},function(e,t,r){"use strict";const n=r(392),i=(e,t,r)=>{"function"==typeof t&&(r=t,t=void 0),n.deserialize(e,(e,n)=>{if(e)return r(e);if(!t)return r(null,{value:n,remainderPath:""});const i=t.split("/"),o=s(n,i[0]);if(null===o)return r(new Error("No such path"),null);let a=i.slice(1).join("/");return void 0!==o["/"]?r(null,{value:o,remainderPath:a}):a.length>0?r(new Error("No such path"),null):r(null,{value:o,remainderPath:""})})},o=(e,t,r)=>{"function"==typeof t&&(r=t,t=void 0),t=t||{},n.deserialize(e,(e,n)=>{if(e)return r(e);const i=["version","timestamp","difficulty","nonce","parent","tx"];if(!0===t.values){const e={};for(let t of i)e[t]=s(n,t);return r(null,e)}return r(null,i)})},s=(e,t)=>{switch(t){case"version":return e.version;case"timestamp":return e.timestamp;case"difficulty":return e.bits;case"nonce":return e.nonce;case"parent":return{"/":n.hashToCid(e.prevHash)};case"tx":return{"/":n.hashToCid(e.merkleRoot)};default:return null}};e.exports={multicodec:"bitcoin-block",defaultHashAlg:"dbl-sha2-256",resolve:i,tree:o}},function(e,t,r){var n=r(2).Buffer;function i(e){if(e.length<8)return!1;if(e.length>72)return!1;if(48!==e[0])return!1;if(e[1]!==e.length-2)return!1;if(2!==e[2])return!1;var t=e[3];if(0===t)return!1;if(5+t>=e.length)return!1;if(2!==e[4+t])return!1;var r=e[5+t];return 0!==r&&(6+t+r===e.length&&(!(128&e[4])&&(!(t>1&&0===e[4]&&!(128&e[5]))&&(!(128&e[t+6])&&!(r>1&&0===e[t+6]&&!(128&e[t+7]))))))}function o(e){if(e.length<8)throw new Error("DER sequence length is too short");if(e.length>72)throw new Error("DER sequence length is too long");if(48!==e[0])throw new Error("Expected DER sequence");if(e[1]!==e.length-2)throw new Error("DER sequence length is invalid");if(2!==e[2])throw new Error("Expected DER integer");var t=e[3];if(0===t)throw new Error("R length is zero");if(5+t>=e.length)throw new Error("R length is too long");if(2!==e[4+t])throw new Error("Expected DER integer (2)");var r=e[5+t];if(0===r)throw new Error("S length is zero");if(6+t+r!==e.length)throw new Error("S length is invalid");if(128&e[4])throw new Error("R value is negative");if(t>1&&0===e[4]&&!(128&e[5]))throw new Error("R value excessively padded");if(128&e[t+6])throw new Error("S value is negative");if(r>1&&0===e[t+6]&&!(128&e[t+7]))throw new Error("S value excessively padded");return{r:e.slice(4,4+t),s:e.slice(6+t)}}function s(e,t){var r=e.length,i=t.length;if(0===r)throw new Error("R length is zero");if(0===i)throw new Error("S length is zero");if(r>33)throw new Error("R length is too long");if(i>33)throw new Error("S length is too long");if(128&e[0])throw new Error("R value is negative");if(128&t[0])throw new Error("S value is negative");if(r>1&&0===e[0]&&!(128&e[1]))throw new Error("R value excessively padded");if(i>1&&0===t[0]&&!(128&t[1]))throw new Error("S value excessively padded");var o=n.allocUnsafe(6+r+i);return o[0]=48,o[1]=o.length-2,o[2]=2,o[3]=e.length,e.copy(o,4),o[4+r]=2,o[5+r]=t.length,t.copy(o,6+r),o}e.exports={check:i,decode:o,encode:s}},function(e,t){var r={Array:function(e){return null!==e&&void 0!==e&&e.constructor===Array},Boolean:function(e){return"boolean"==typeof e},Function:function(e){return"function"==typeof e},Nil:function(e){return void 0===e||null===e},Number:function(e){return"number"==typeof e},Object:function(e){return"object"==typeof e},String:function(e){return"string"==typeof e},"":function(){return!0}};for(var n in r.Null=r.Nil,r)r[n].toJSON=function(e){return e}.bind(null,n);e.exports=r},function(e,t,r){var n=r(29).decompile,i=r(232),o=r(765),s=r(233),a=r(234),u=r(770),c=r(773),f=r(775),l=r(777),h={MULTISIG:"multisig",NONSTANDARD:"nonstandard",NULLDATA:"nulldata",P2PK:"pubkey",P2PKH:"pubkeyhash",P2SH:"scripthash",P2WPKH:"witnesspubkeyhash",P2WSH:"witnessscripthash",WITNESS_COMMITMENT:"witnesscommitment"};function p(e){if(c.output.check(e))return h.P2WPKH;if(f.output.check(e))return h.P2WSH;if(a.output.check(e))return h.P2PKH;if(u.output.check(e))return h.P2SH;var t=n(e);return i.output.check(t)?h.MULTISIG:s.output.check(t)?h.P2PK:l.output.check(t)?h.WITNESS_COMMITMENT:o.output.check(t)?h.NULLDATA:h.NONSTANDARD}function d(e,t){var r=n(e);return a.input.check(r)?h.P2PKH:u.input.check(r,t)?h.P2SH:i.input.check(r,t)?h.MULTISIG:s.input.check(r)?h.P2PK:h.NONSTANDARD}function y(e,t){var r=n(e);return c.input.check(r)?h.P2WPKH:f.input.check(r,t)?h.P2WSH:h.NONSTANDARD}e.exports={classifyInput:d,classifyOutput:p,classifyWitness:y,multisig:i,nullData:o,pubKey:s,pubKeyHash:a,scriptHash:u,witnessPubKeyHash:c,witnessScriptHash:f,witnessCommitment:l,types:h}},function(e,t,r){e.exports={input:r(764),output:r(396)}},function(e,t,r){e.exports={input:r(766),output:r(767)}},function(e,t,r){e.exports={input:r(768),output:r(769)}},function(e,t,r){"use strict";var n=r(2).Buffer,i=9007199254740991;function o(e){if(e<0||e>i||e%1!=0)throw new RangeError("value out of range")}function s(e,t,r){if(o(e),t||(t=n.allocUnsafe(u(e))),!n.isBuffer(t))throw new TypeError("buffer must be a Buffer instance");return r||(r=0),e<253?(t.writeUInt8(e,r),s.bytes=1):e<=65535?(t.writeUInt8(253,r),t.writeUInt16LE(e,r+1),s.bytes=3):e<=4294967295?(t.writeUInt8(254,r),t.writeUInt32LE(e,r+1),s.bytes=5):(t.writeUInt8(255,r),t.writeUInt32LE(e>>>0,r+1),t.writeUInt32LE(e/4294967296|0,r+5),s.bytes=9),t}function a(e,t){if(!n.isBuffer(e))throw new TypeError("buffer must be a Buffer instance");t||(t=0);var r=e.readUInt8(t);if(r<253)return a.bytes=1,r;if(253===r)return a.bytes=3,e.readUInt16LE(t+1);if(254===r)return a.bytes=5,e.readUInt32LE(t+1);a.bytes=9;var i=e.readUInt32LE(t+1),s=e.readUInt32LE(t+5),u=4294967296*s+i;return o(u),u}function u(e){return o(e),e<253?1:e<=65535?3:e<=4294967295?5:9}e.exports={encode:s,decode:a,encodingLength:u}},function(e,t,r){"use strict";(function(t){var n=r(4),i=r(400),o=new Array(16);function s(){i.call(this,64),this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878}function a(e,t){return e<<t|e>>>32-t}function u(e,t,r,n,i,o,s){return a(e+(t&r|~t&n)+i+o|0,s)+t|0}function c(e,t,r,n,i,o,s){return a(e+(t&n|r&~n)+i+o|0,s)+t|0}function f(e,t,r,n,i,o,s){return a(e+(t^r^n)+i+o|0,s)+t|0}function l(e,t,r,n,i,o,s){return a(e+(r^(t|~n))+i+o|0,s)+t|0}n(s,i),s.prototype._update=function(){for(var e=o,t=0;t<16;++t)e[t]=this._block.readInt32LE(4*t);var r=this._a,n=this._b,i=this._c,s=this._d;r=u(r,n,i,s,e[0],3614090360,7),s=u(s,r,n,i,e[1],3905402710,12),i=u(i,s,r,n,e[2],606105819,17),n=u(n,i,s,r,e[3],3250441966,22),r=u(r,n,i,s,e[4],4118548399,7),s=u(s,r,n,i,e[5],1200080426,12),i=u(i,s,r,n,e[6],2821735955,17),n=u(n,i,s,r,e[7],4249261313,22),r=u(r,n,i,s,e[8],1770035416,7),s=u(s,r,n,i,e[9],2336552879,12),i=u(i,s,r,n,e[10],4294925233,17),n=u(n,i,s,r,e[11],2304563134,22),r=u(r,n,i,s,e[12],1804603682,7),s=u(s,r,n,i,e[13],4254626195,12),i=u(i,s,r,n,e[14],2792965006,17),n=u(n,i,s,r,e[15],1236535329,22),r=c(r,n,i,s,e[1],4129170786,5),s=c(s,r,n,i,e[6],3225465664,9),i=c(i,s,r,n,e[11],643717713,14),n=c(n,i,s,r,e[0],3921069994,20),r=c(r,n,i,s,e[5],3593408605,5),s=c(s,r,n,i,e[10],38016083,9),i=c(i,s,r,n,e[15],3634488961,14),n=c(n,i,s,r,e[4],3889429448,20),r=c(r,n,i,s,e[9],568446438,5),s=c(s,r,n,i,e[14],3275163606,9),i=c(i,s,r,n,e[3],4107603335,14),n=c(n,i,s,r,e[8],1163531501,20),r=c(r,n,i,s,e[13],2850285829,5),s=c(s,r,n,i,e[2],4243563512,9),i=c(i,s,r,n,e[7],1735328473,14),n=c(n,i,s,r,e[12],2368359562,20),r=f(r,n,i,s,e[5],4294588738,4),s=f(s,r,n,i,e[8],2272392833,11),i=f(i,s,r,n,e[11],1839030562,16),n=f(n,i,s,r,e[14],4259657740,23),r=f(r,n,i,s,e[1],2763975236,4),s=f(s,r,n,i,e[4],1272893353,11),i=f(i,s,r,n,e[7],4139469664,16),n=f(n,i,s,r,e[10],3200236656,23),r=f(r,n,i,s,e[13],681279174,4),s=f(s,r,n,i,e[0],3936430074,11),i=f(i,s,r,n,e[3],3572445317,16),n=f(n,i,s,r,e[6],76029189,23),r=f(r,n,i,s,e[9],3654602809,4),s=f(s,r,n,i,e[12],3873151461,11),i=f(i,s,r,n,e[15],530742520,16),n=f(n,i,s,r,e[2],3299628645,23),r=l(r,n,i,s,e[0],4096336452,6),s=l(s,r,n,i,e[7],1126891415,10),i=l(i,s,r,n,e[14],2878612391,15),n=l(n,i,s,r,e[5],4237533241,21),r=l(r,n,i,s,e[12],1700485571,6),s=l(s,r,n,i,e[3],2399980690,10),i=l(i,s,r,n,e[10],4293915773,15),n=l(n,i,s,r,e[1],2240044497,21),r=l(r,n,i,s,e[8],1873313359,6),s=l(s,r,n,i,e[15],4264355552,10),i=l(i,s,r,n,e[6],2734768916,15),n=l(n,i,s,r,e[13],1309151649,21),r=l(r,n,i,s,e[4],4149444226,6),s=l(s,r,n,i,e[11],3174756917,10),i=l(i,s,r,n,e[2],718787259,15),n=l(n,i,s,r,e[9],3951481745,21),this._a=this._a+r|0,this._b=this._b+n|0,this._c=this._c+i|0,this._d=this._d+s|0},s.prototype._digest=function(){this._block[this._blockOffset++]=128,this._blockOffset>56&&(this._block.fill(0,this._blockOffset,64),this._update(),this._blockOffset=0),this._block.fill(0,this._blockOffset,56),this._block.writeUInt32LE(this._length[0],56),this._block.writeUInt32LE(this._length[1],60),this._update();var e=new t(16);return e.writeInt32LE(this._a,0),e.writeInt32LE(this._b,4),e.writeInt32LE(this._c,8),e.writeInt32LE(this._d,12),e},e.exports=s}).call(this,r(0).Buffer)},function(e,t,r){var n=r(2).Buffer,i=r(108),o=r(29),s=r(399),a=r(39),u=r(25),c=r(33),f=r(235);function l(e){var t=e.length;return f.encodingLength(t)+t}function h(e){var t=e.length;return f.encodingLength(t)+e.reduce(function(e,t){return e+l(t)},0)}function p(){this.version=1,this.locktime=0,this.ins=[],this.outs=[]}p.DEFAULT_SEQUENCE=4294967295,p.SIGHASH_ALL=1,p.SIGHASH_NONE=2,p.SIGHASH_SINGLE=3,p.SIGHASH_ANYONECANPAY=128,p.ADVANCED_TRANSACTION_MARKER=0,p.ADVANCED_TRANSACTION_FLAG=1;var d=n.allocUnsafe(0),y=[],g=n.from("0000000000000000000000000000000000000000000000000000000000000000","hex"),m=n.from("0000000000000000000000000000000000000000000000000000000000000001","hex"),b=n.from("ffffffffffffffff","hex"),v={script:d,valueBuffer:b};p.fromBuffer=function(e,t){var r=0;function n(t){return r+=t,e.slice(r-t,r)}function i(){var t=e.readUInt32LE(r);return r+=4,t}function o(){var t=e.readInt32LE(r);return r+=4,t}function a(){var t=s.readUInt64LE(e,r);return r+=8,t}function u(){var t=f.decode(e,r);return r+=f.decode.bytes,t}function c(){return n(u())}function l(){for(var e=u(),t=[],r=0;r<e;r++)t.push(c());return t}var h=new p;h.version=o();var d=e.readUInt8(r),g=e.readUInt8(r+1),m=!1;d===p.ADVANCED_TRANSACTION_MARKER&&g===p.ADVANCED_TRANSACTION_FLAG&&(r+=2,m=!0);for(var b=u(),v=0;v<b;++v)h.ins.push({hash:n(32),index:i(),script:c(),sequence:i(),witness:y});var _=u();for(v=0;v<_;++v)h.outs.push({value:a(),script:c()});if(m){for(v=0;v<b;++v)h.ins[v].witness=l();if(!h.hasWitnesses())throw new Error("Transaction has superfluous witness data")}if(h.locktime=i(),t)return h;if(r!==e.length)throw new Error("Transaction has unexpected data");return h},p.fromHex=function(e){return p.fromBuffer(n.from(e,"hex"))},p.isCoinbaseHash=function(e){u(c.Hash256bit,e);for(var t=0;t<32;++t)if(0!==e[t])return!1;return!0},p.prototype.isCoinbase=function(){return 1===this.ins.length&&p.isCoinbaseHash(this.ins[0].hash)},p.prototype.addInput=function(e,t,r,n){return u(c.tuple(c.Hash256bit,c.UInt32,c.maybe(c.UInt32),c.maybe(c.Buffer)),arguments),c.Null(r)&&(r=p.DEFAULT_SEQUENCE),this.ins.push({hash:e,index:t,script:n||d,sequence:r,witness:y})-1},p.prototype.addOutput=function(e,t){return u(c.tuple(c.Buffer,c.Satoshi),arguments),this.outs.push({script:e,value:t})-1},p.prototype.hasWitnesses=function(){return this.ins.some(function(e){return 0!==e.witness.length})},p.prototype.weight=function(){var e=this.__byteLength(!1),t=this.__byteLength(!0);return 3*e+t},p.prototype.virtualSize=function(){return Math.ceil(this.weight()/4)},p.prototype.byteLength=function(){return this.__byteLength(!0)},p.prototype.__byteLength=function(e){var t=e&&this.hasWitnesses();return(t?10:8)+f.encodingLength(this.ins.length)+f.encodingLength(this.outs.length)+this.ins.reduce(function(e,t){return e+40+l(t.script)},0)+this.outs.reduce(function(e,t){return e+8+l(t.script)},0)+(t?this.ins.reduce(function(e,t){return e+h(t.witness)},0):0)},p.prototype.clone=function(){var e=new p;return e.version=this.version,e.locktime=this.locktime,e.ins=this.ins.map(function(e){return{hash:e.hash,index:e.index,script:e.script,sequence:e.sequence,witness:e.witness}}),e.outs=this.outs.map(function(e){return{script:e.script,value:e.value}}),e},p.prototype.hashForSignature=function(e,t,r){if(u(c.tuple(c.UInt32,c.Buffer,c.Number),arguments),e>=this.ins.length)return m;var s=o.compile(o.decompile(t).filter(function(e){return e!==a.OP_CODESEPARATOR})),f=this.clone();if((31&r)===p.SIGHASH_NONE)f.outs=[],f.ins.forEach(function(t,r){r!==e&&(t.sequence=0)});else if((31&r)===p.SIGHASH_SINGLE){if(e>=this.outs.length)return m;f.outs.length=e+1;for(var l=0;l<e;l++)f.outs[l]=v;f.ins.forEach(function(t,r){r!==e&&(t.sequence=0)})}r&p.SIGHASH_ANYONECANPAY?(f.ins=[f.ins[e]],f.ins[0].script=s):(f.ins.forEach(function(e){e.script=d}),f.ins[e].script=s);var h=n.allocUnsafe(f.__byteLength(!1)+4);return h.writeInt32LE(r,h.length-4),f.__toBuffer(h,0,!1),i.hash256(h)},p.prototype.hashForWitnessV0=function(e,t,r,o){var a,h;function d(e){h+=e.copy(a,h)}function y(e){h=a.writeUInt32LE(e,h)}function m(e){h=s.writeUInt64LE(a,e,h)}function b(e){f.encode(e,a,h),h+=f.encode.bytes}function v(e){b(e.length),d(e)}u(c.tuple(c.UInt32,c.Buffer,c.Satoshi,c.UInt32),arguments);var _=g,w=g,S=g;if(o&p.SIGHASH_ANYONECANPAY||(a=n.allocUnsafe(36*this.ins.length),h=0,this.ins.forEach(function(e){d(e.hash),y(e.index)}),w=i.hash256(a)),o&p.SIGHASH_ANYONECANPAY||(31&o)===p.SIGHASH_SINGLE||(31&o)===p.SIGHASH_NONE||(a=n.allocUnsafe(4*this.ins.length),h=0,this.ins.forEach(function(e){y(e.sequence)}),S=i.hash256(a)),(31&o)!==p.SIGHASH_SINGLE&&(31&o)!==p.SIGHASH_NONE){var k=this.outs.reduce(function(e,t){return e+8+l(t.script)},0);a=n.allocUnsafe(k),h=0,this.outs.forEach(function(e){m(e.value),v(e.script)}),_=i.hash256(a)}else if((31&o)===p.SIGHASH_SINGLE&&e<this.outs.length){var E=this.outs[e];a=n.allocUnsafe(8+l(E.script)),h=0,m(E.value),v(E.script),_=i.hash256(a)}a=n.allocUnsafe(156+l(t)),h=0;var A=this.ins[e];return y(this.version),d(w),d(S),d(A.hash),y(A.index),v(t),m(r),y(A.sequence),d(_),y(this.locktime),y(o),i.hash256(a)},p.prototype.getHash=function(){return i.hash256(this.__toBuffer(void 0,void 0,!1))},p.prototype.getId=function(){return this.getHash().reverse().toString("hex")},p.prototype.toBuffer=function(e,t){return this.__toBuffer(e,t,!0)},p.prototype.__toBuffer=function(e,t,r){e||(e=n.allocUnsafe(this.__byteLength(r)));var i=t||0;function o(t){i+=t.copy(e,i)}function a(t){i=e.writeUInt8(t,i)}function u(t){i=e.writeUInt32LE(t,i)}function c(t){i=e.writeInt32LE(t,i)}function l(t){i=s.writeUInt64LE(e,t,i)}function h(t){f.encode(t,e,i),i+=f.encode.bytes}function d(e){h(e.length),o(e)}function y(e){h(e.length),e.forEach(d)}c(this.version);var g=r&&this.hasWitnesses();return g&&(a(p.ADVANCED_TRANSACTION_MARKER),a(p.ADVANCED_TRANSACTION_FLAG)),h(this.ins.length),this.ins.forEach(function(e){o(e.hash),u(e.index),d(e.script),u(e.sequence)}),h(this.outs.length),this.outs.forEach(function(e){e.valueBuffer?o(e.valueBuffer):l(e.value),d(e.script)}),g&&this.ins.forEach(function(e){y(e.witness)}),u(this.locktime),void 0!==t?e.slice(t,i):e},p.prototype.toHex=function(){return this.toBuffer().toString("hex")},p.prototype.setInputScript=function(e,t){u(c.tuple(c.Number,c.Buffer),arguments),this.ins[e].script=t},p.prototype.setWitness=function(e,t){u(c.tuple(c.Number,[c.Buffer]),arguments),this.ins[e].witness=t},e.exports=p},function(e,t,r){var n=r(239),i=r(108),o=r(787),s=r(110),a=r(25),u=r(33),c=r(794),f=r(128),l=r(95),h=r(243),p=o.__curve;function d(e,t,r){if(r&&a({compressed:u.maybe(u.Boolean),network:u.maybe(u.Network)},r),r=r||{},e){if(e.signum()<=0)throw new Error("Private key must be greater than 0");if(e.compareTo(p.n)>=0)throw new Error("Private key must be less than the curve order");if(t)throw new TypeError("Unexpected publicKey parameter");this.d=e}else a(u.ECPoint,t),this.__Q=t;this.compressed=void 0===r.compressed||r.compressed,this.network=r.network||f.bitcoin}Object.defineProperty(d.prototype,"Q",{get:function(){return!this.__Q&&this.d&&(this.__Q=p.G.multiply(this.d)),this.__Q}}),d.fromPublicKeyBuffer=function(e,t){var r=h.Point.decodeFrom(p,e);return new d(null,r,{compressed:r.compressed,network:t})},d.fromWIF=function(e,t){var r=c.decode(e),n=r.version;if(u.Array(t)){if(t=t.filter(function(e){return n===e.wif}).pop(),!t)throw new Error("Unknown network version")}else if(t=t||f.bitcoin,n!==t.wif)throw new Error("Invalid network version");var i=l.fromBuffer(r.privateKey);return new d(i,null,{compressed:r.compressed,network:t})},d.makeRandom=function(e){e=e||{};var t=e.rng||s,r;do{var n=t(32);a(u.Buffer256bit,n),r=l.fromBuffer(n)}while(r.signum()<=0||r.compareTo(p.n)>=0);return new d(r,null,e)},d.prototype.getAddress=function(){return n.toBase58Check(i.hash160(this.getPublicKeyBuffer()),this.getNetwork().pubKeyHash)},d.prototype.getNetwork=function(){return this.network},d.prototype.getPublicKeyBuffer=function(){return this.Q.getEncoded(this.compressed)},d.prototype.sign=function(e){if(!this.d)throw new Error("Missing private key");return o.sign(e,this.d)},d.prototype.toWIF=function(){if(!this.d)throw new Error("Missing private key");return c.encode(this.network.wif,this.d.toBuffer(32),this.compressed)},d.prototype.verify=function(e,t){return o.verify(e,t,this.Q)},e.exports=d},function(e,t,r){var n=r(2).Buffer,i=r(785),o=r(240),s=r(29),a=r(231),u=r(128),c=r(25),f=r(33);function l(e){var t=o.decode(e);if(t.length<21)throw new TypeError(e+" is too short");if(t.length>21)throw new TypeError(e+" is too long");var r=t.readUInt8(0),n=t.slice(1);return{version:r,hash:n}}function h(e){var t=i.decode(e),r=i.fromWords(t.words.slice(1));return{version:t.words[0],prefix:t.prefix,data:n.from(r)}}function p(e,t){c(f.tuple(f.Hash160bit,f.UInt8),arguments);var r=n.allocUnsafe(21);return r.writeUInt8(t,0),e.copy(r,1),o.encode(r)}function d(e,t,r){var n=i.toWords(e);return n.unshift(t),i.encode(r,n)}function y(e,t){if(t=t||u.bitcoin,a.pubKeyHash.output.check(e))return p(s.compile(e).slice(3,23),t.pubKeyHash);if(a.scriptHash.output.check(e))return p(s.compile(e).slice(2,22),t.scriptHash);if(a.witnessPubKeyHash.output.check(e))return d(s.compile(e).slice(2,22),0,t.bech32);if(a.witnessScriptHash.output.check(e))return d(s.compile(e).slice(2,34),0,t.bech32);throw new Error(s.toASM(e)+" has no matching Address")}function g(e,t){var r;t=t||u.bitcoin;try{r=l(e)}catch(e){}if(r){if(r.version===t.pubKeyHash)return a.pubKeyHash.output.encode(r.hash);if(r.version===t.scriptHash)return a.scriptHash.output.encode(r.hash)}else{try{r=h(e)}catch(e){}if(r){if(r.prefix!==t.bech32)throw new Error(e+" has an invalid prefix");if(0===r.version){if(20===r.data.length)return a.witnessPubKeyHash.output.encode(r.data);if(32===r.data.length)return a.witnessScriptHash.output.encode(r.data)}}}throw new Error(e+" has no matching Script")}e.exports={fromBase58Check:l,fromBech32:h,fromOutputScript:y,toBase58Check:p,toBech32:d,toOutputScript:g}},function(e,t,r){"use strict";var n=r(127),i=r(786);function o(e){var t=n("sha256").update(e).digest();return n("sha256").update(t).digest()}e.exports=i(o)},function(e,t,r){"use strict";var n=r(4),i=r(788),o=r(94),s=r(2).Buffer,a=r(789),u=r(401),c=r(402),f=s.alloc(128);function l(e,t){o.call(this,"digest"),"string"==typeof t&&(t=s.from(t));var r="sha512"===e||"sha384"===e?128:64;if(this._alg=e,this._key=t,t.length>r){var n="rmd160"===e?new u:c(e);t=n.update(t).digest()}else t.length<r&&(t=s.concat([t,f],r));for(var i=this._ipad=s.allocUnsafe(r),a=this._opad=s.allocUnsafe(r),l=0;l<r;l++)i[l]=54^t[l],a[l]=92^t[l];this._hash="rmd160"===e?new u:c(e),this._hash.update(i)}n(l,o),l.prototype._update=function(e){this._hash.update(e)},l.prototype._final=function(){var e=this._hash.digest(),t="rmd160"===this._alg?new u:c(this._alg);return t.update(this._opad).update(e).digest()},e.exports=function e(t,r){return t=t.toLowerCase(),"rmd160"===t||"ripemd160"===t?new l("rmd160",r):"md5"===t?new i(a,r):new l(t,r)}},function(e,t,r){(function(t){var n=r(229),i=r(25),o=r(33),s=r(95);function a(e,t){i(o.tuple(o.BigInt,o.BigInt),arguments),this.r=e,this.s=t}a.parseCompact=function(e){i(o.BufferN(65),e);var t=e.readUInt8(0)-27;if(t!==(7&t))throw new Error("Invalid signature parameter");var r=!!(4&t),n=3&t,s=a.fromRSBuffer(e.slice(1));return{compressed:r,i:n,signature:s}},a.fromRSBuffer=function(e){i(o.BufferN(64),e);var t=s.fromBuffer(e.slice(0,32)),r=s.fromBuffer(e.slice(32,64));return new a(t,r)},a.fromDER=function(e){var t=n.decode(e),r=s.fromDERInteger(t.r),i=s.fromDERInteger(t.s);return new a(r,i)},a.parseScriptSignature=function(e){var t=e.readUInt8(e.length-1),r=-129&t;if(r<=0||r>=4)throw new Error("Invalid hashType "+t);return{signature:a.fromDER(e.slice(0,-1)),hashType:t}},a.prototype.toCompact=function(e,r){r&&(e+=4),e+=27;var n=t.alloc(65);return n.writeUInt8(e,0),this.toRSBuffer(n,1),n},a.prototype.toDER=function(){var e=t.from(this.r.toDERInteger()),r=t.from(this.s.toDERInteger());return n.encode(e,r)},a.prototype.toRSBuffer=function(e,r){return e=e||t.alloc(64),this.r.toBuffer(32).copy(e,r),this.s.toBuffer(32).copy(e,r+32),e},a.prototype.toScriptSignature=function(e){var r=-129&e;if(r<=0||r>=4)throw new Error("Invalid hashType "+e);var n=t.alloc(1);return n.writeUInt8(e,0),t.concat([this.toDER(),n])},e.exports=a}).call(this,r(0).Buffer)},function(e,t,r){var n=r(406),i=r(407),o=r(792);e.exports={Curve:i,Point:n,getCurveByName:o}},function(e){e.exports={COMPRESSED_TYPE_INVALID:"compressed should be a boolean",EC_PRIVATE_KEY_TYPE_INVALID:"private key should be a Buffer",EC_PRIVATE_KEY_LENGTH_INVALID:"private key length is invalid",EC_PRIVATE_KEY_RANGE_INVALID:"private key range is invalid",EC_PRIVATE_KEY_TWEAK_ADD_FAIL:"tweak out of range or resulting private key is invalid",EC_PRIVATE_KEY_TWEAK_MUL_FAIL:"tweak out of range",EC_PRIVATE_KEY_EXPORT_DER_FAIL:"couldn't export to DER format",EC_PRIVATE_KEY_IMPORT_DER_FAIL:"couldn't import from DER format",EC_PUBLIC_KEYS_TYPE_INVALID:"public keys should be an Array",EC_PUBLIC_KEYS_LENGTH_INVALID:"public keys Array should have at least 1 element",EC_PUBLIC_KEY_TYPE_INVALID:"public key should be a Buffer",EC_PUBLIC_KEY_LENGTH_INVALID:"public key length is invalid",EC_PUBLIC_KEY_PARSE_FAIL:"the public key could not be parsed or is invalid",EC_PUBLIC_KEY_CREATE_FAIL:"private was invalid, try again",EC_PUBLIC_KEY_TWEAK_ADD_FAIL:"tweak out of range or resulting public key is invalid",EC_PUBLIC_KEY_TWEAK_MUL_FAIL:"tweak out of range",EC_PUBLIC_KEY_COMBINE_FAIL:"the sum of the public keys is not valid",ECDH_FAIL:"scalar was invalid (zero or overflow)",ECDSA_SIGNATURE_TYPE_INVALID:"signature should be a Buffer",ECDSA_SIGNATURE_LENGTH_INVALID:"signature length is invalid",ECDSA_SIGNATURE_PARSE_FAIL:"couldn't parse signature",ECDSA_SIGNATURE_PARSE_DER_FAIL:"couldn't parse DER signature",ECDSA_SIGNATURE_SERIALIZE_DER_FAIL:"couldn't serialize signature to DER format",ECDSA_SIGN_FAIL:"nonce generation function failed or private key is invalid",ECDSA_RECOVER_FAIL:"couldn't recover public key from signature",MSG32_TYPE_INVALID:"message should be a Buffer",MSG32_LENGTH_INVALID:"message length is invalid",OPTIONS_TYPE_INVALID:"options should be an Object",OPTIONS_DATA_TYPE_INVALID:"options.data should be a Buffer",OPTIONS_DATA_LENGTH_INVALID:"options.data length is invalid",OPTIONS_NONCEFN_TYPE_INVALID:"options.noncefn should be a Function",RECOVERY_ID_TYPE_INVALID:"recovery should be a Number",RECOVERY_ID_VALUE_INVALID:"recovery should have value between -1 and 4",TWEAK_TYPE_INVALID:"tweak should be a Buffer",TWEAK_LENGTH_INVALID:"tweak length is invalid"}},function(e,t,r){var n=t;n.utils=r(65),n.common=r(129),n.sha=r(818),n.ripemd=r(822),n.hmac=r(823),n.sha1=n.sha.sha1,n.sha256=n.sha.sha256,n.sha224=n.sha.sha224,n.sha384=n.sha.sha384,n.sha512=n.sha.sha512,n.ripemd160=n.ripemd.ripemd160},function(e,t,r){"use strict";(function(t){const n=r(41),i=r(5),o=r(154),s=r(130),a=r(842),u=r(131),c=r(132),f=r(843),l=r(416),h=r(415),p=r(417);function d(e,r){const f=c(e,a,l);return f.util.deserialize=o(e=>{const t=s.decode(e),r=new a(t);return r}),f;function l(e,o,s){h(e,o,(e,a)=>{if(e)return s(e);if(!r)return s(null,a);let u=a.slice();const c=a.filter(e=>t.isBuffer(e.value));n(c,(e,t)=>i([t=>r.util.deserialize(e.value,t),(e,t)=>r.resolver._mapFromEthObject(e,o,t)],(r,n)=>{if(r)return t(r);n.forEach(t=>{u.push({path:e.path+"/"+t.path,value:t.value})}),t()}),e=>{if(e)return s(e);s(null,u)})})}function h(t,r,i){let o=[];"leaf"===t.type&&o.push({path:y(t.getKey()),value:t.getValue()}),n(t.getChildren(),(t,n)=>{const i=y(t[0]),s=t[1];if(a.isRawNode(s)){const e=new a(s);o.push({path:i,value:e}),h(e,r,(e,t)=>{if(e)return n(e);t.forEach(e=>{e.path=i+"/"+e.path}),o=o.concat(t),n()})}else{let t={"/":u(e,s).toBaseEncodedString()};o.push({path:i,value:t}),n()}},e=>{if(e)return i(e);i(null,o)})}}function y(e){return e.map(e=>e.toString(16)).join("/")}e.exports=d}).call(this,r(0).Buffer)},function(e,t,r){"use strict";const n=r(422),i=(e,t,r)=>{"function"==typeof t&&(r=t,t=void 0),n.deserialize(e,(e,n)=>{if(e)return r(e);if(!t)return r(null,{value:n,remainderPath:""});const i=t.split("/"),o=s(n,i[0]);if(null===o)return r(new Error("No such path"),null);let a=i.slice(1).join("/");return void 0!==o["/"]?r(null,{value:o,remainderPath:a}):a.length>0?r(new Error("No such path"),null):r(null,{value:o,remainderPath:""})})},o=(e,t,r)=>{"function"==typeof t&&(r=t,t=void 0),t=t||{},n.deserialize(e,(e,n)=>{if(e)return r(e);const i=["version","timestamp","difficulty","nonce","solution","reserved","parent","tx"];if(!0===t.values){const e={};for(let t of i)e[t]=s(n,t);return r(null,e)}return r(null,i)})},s=(e,t)=>{switch(t){case"version":return e.version;case"timestamp":return e.time;case"difficulty":return e.bits;case"nonce":return e.nonce;case"solution":return e.solution;case"reserved":return e.reserved;case"parent":return{"/":n.hashToCid(e.prevHash)};case"tx":return{"/":n.hashToCid(e.merkleRoot)};default:return null}};e.exports={multicodec:"zcash-block",defaultHashAlg:"dbl-sha2-256",resolve:i,tree:o}},function(e,t,r){"use strict";(function(t){var n=r(15),i=r(20),o=r(24),s=r(30);function a(e){if(!(this instanceof a))return new a(e);var t;if(n.isNumber(e))t=e;else{if(!n.isString(e))throw new TypeError('Unrecognized num type: "'+typeof e+'" for Opcode');t=a.map[e]}return s.defineImmutable(this,{num:t}),this}for(var u in a.fromBuffer=function(e){return i.checkArgument(o.isBuffer(e)),new a(Number("0x"+e.toString("hex")))},a.fromNumber=function(e){return i.checkArgument(n.isNumber(e)),new a(e)},a.fromString=function(e){i.checkArgument(n.isString(e));var t=a.map[e];if(void 0===t)throw new TypeError("Invalid opcodestr");return new a(t)},a.prototype.toHex=function(){return this.num.toString(16)},a.prototype.toBuffer=function(){return new t(this.toHex(),"hex")},a.prototype.toNumber=function(){return this.num},a.prototype.toString=function(){var e=a.reverseMap[this.num];if(void 0===e)throw new Error("Opcode does not have a string representation");return e},a.smallInt=function(e){return i.checkArgument(n.isNumber(e),"Invalid Argument: n should be number"),i.checkArgument(e>=0&&e<=16,"Invalid Argument: n must be between 0 and 16"),0===e?a("OP_0"):new a(a.map.OP_1+e-1)},a.map={OP_FALSE:0,OP_0:0,OP_PUSHDATA1:76,OP_PUSHDATA2:77,OP_PUSHDATA4:78,OP_1NEGATE:79,OP_RESERVED:80,OP_TRUE:81,OP_1:81,OP_2:82,OP_3:83,OP_4:84,OP_5:85,OP_6:86,OP_7:87,OP_8:88,OP_9:89,OP_10:90,OP_11:91,OP_12:92,OP_13:93,OP_14:94,OP_15:95,OP_16:96,OP_NOP:97,OP_VER:98,OP_IF:99,OP_NOTIF:100,OP_VERIF:101,OP_VERNOTIF:102,OP_ELSE:103,OP_ENDIF:104,OP_VERIFY:105,OP_RETURN:106,OP_TOALTSTACK:107,OP_FROMALTSTACK:108,OP_2DROP:109,OP_2DUP:110,OP_3DUP:111,OP_2OVER:112,OP_2ROT:113,OP_2SWAP:114,OP_IFDUP:115,OP_DEPTH:116,OP_DROP:117,OP_DUP:118,OP_NIP:119,OP_OVER:120,OP_PICK:121,OP_ROLL:122,OP_ROT:123,OP_SWAP:124,OP_TUCK:125,OP_CAT:126,OP_SUBSTR:127,OP_LEFT:128,OP_RIGHT:129,OP_SIZE:130,OP_INVERT:131,OP_AND:132,OP_OR:133,OP_XOR:134,OP_EQUAL:135,OP_EQUALVERIFY:136,OP_RESERVED1:137,OP_RESERVED2:138,OP_1ADD:139,OP_1SUB:140,OP_2MUL:141,OP_2DIV:142,OP_NEGATE:143,OP_ABS:144,OP_NOT:145,OP_0NOTEQUAL:146,OP_ADD:147,OP_SUB:148,OP_MUL:149,OP_DIV:150,OP_MOD:151,OP_LSHIFT:152,OP_RSHIFT:153,OP_BOOLAND:154,OP_BOOLOR:155,OP_NUMEQUAL:156,OP_NUMEQUALVERIFY:157,OP_NUMNOTEQUAL:158,OP_LESSTHAN:159,OP_GREATERTHAN:160,OP_LESSTHANOREQUAL:161,OP_GREATERTHANOREQUAL:162,OP_MIN:163,OP_MAX:164,OP_WITHIN:165,OP_RIPEMD160:166,OP_SHA1:167,OP_SHA256:168,OP_HASH160:169,OP_HASH256:170,OP_CODESEPARATOR:171,OP_CHECKSIG:172,OP_CHECKSIGVERIFY:173,OP_CHECKMULTISIG:174,OP_CHECKMULTISIGVERIFY:175,OP_CHECKLOCKTIMEVERIFY:177,OP_NOP1:176,OP_NOP2:177,OP_NOP3:178,OP_NOP4:179,OP_NOP5:180,OP_NOP6:181,OP_NOP7:182,OP_NOP8:183,OP_NOP9:184,OP_NOP10:185,OP_PUBKEYHASH:253,OP_PUBKEY:254,OP_INVALIDOPCODE:255},a.reverseMap=[],a.map)a.reverseMap[a.map[u]]=u;n.extend(a,a.map),a.isSmallIntOp=function(e){return e instanceof a&&(e=e.toNumber()),e===a.map.OP_0||e>=a.map.OP_1&&e<=a.map.OP_16},a.prototype.inspect=function(){return"<Opcode: "+this.toString()+", hex: "+this.toHex()+", decimal: "+this.num+">"},e.exports=a}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(t){var n=r(15),i=r(20),o=r(0),s=t.compare||r(872),a=r(60),u=r(24),c=r(30),f=r(85),l=r(58),h=r(40),p=r(61),d=r(86),y=r(99),g=r(426),m=r(250),b=m.PublicKeyHash,v=m.PublicKey,_=m.MultiSigScriptHash,w=m.MultiSig,S=r(87),k=r(62),E=r(176),A=r(34),x=r(877);function I(e){if(!(this instanceof I))return new I(e);if(this.inputs=[],this.outputs=[],this.joinSplits=[],this._inputAmount=void 0,this._outputAmount=void 0,e){if(e instanceof I)return I.shallowCopy(e);if(c.isHexa(e))this.fromString(e);else if(u.isBuffer(e))this.fromBuffer(e);else{if(!n.isObject(e))throw new a.InvalidArgument("Must provide an object or string to deserialize a transaction");this.fromObject(e)}}else this._newTransaction()}var T=1,B=0,C=1e6;I.DUST_AMOUNT=546,I.FEE_SECURITY_MARGIN=15,I.MAX_MONEY=21e14,I.NLOCKTIME_BLOCKHEIGHT_LIMIT=5e8,I.NLOCKTIME_MAX_VALUE=4294967295,I.FEE_PER_KB=1e4,I.CHANGE_OUTPUT_MAX_SIZE=62,I.MAXIMUM_EXTRA_SIZE=26,I.shallowCopy=function(e){var t=new I(e.toBuffer());return t};var P={configurable:!1,enumerable:!0,get:function(){return new f(this._getHash()).readReverse().toString("hex")}};Object.defineProperty(I.prototype,"hash",P),Object.defineProperty(I.prototype,"id",P);var O={configurable:!1,enumerable:!0,get:function(){return this._getInputAmount()}};Object.defineProperty(I.prototype,"inputAmount",O),O.get=function(){return this._getOutputAmount()},Object.defineProperty(I.prototype,"outputAmount",O),I.prototype._getHash=function(){return h.sha256sha256(this.toBuffer())},I.prototype.serialize=function(e){return!0===e||e&&e.disableAll?this.uncheckedSerialize():this.checkedSerialize(e)},I.prototype.uncheckedSerialize=I.prototype.toString=function(){return this.toBuffer().toString("hex")},I.prototype.checkedSerialize=function(e){var t=this.getSerializationError(e);if(t)throw t.message+=" Use Transaction#uncheckedSerialize if you want to skip security checks. See http://bitcore.io/guide/transaction.html#Serialization for more info.",t;return this.uncheckedSerialize()},I.prototype.invalidSatoshis=function(){for(var e=!1,t=0;t<this.outputs.length;t++)this.outputs[t].invalidSatoshis()&&(e=!0);return e},I.prototype.getSerializationError=function(e){if(e=e||{},this.invalidSatoshis())return new a.Transaction.InvalidSatoshis;var t=this._getUnspentValue(),r;return t<0?e.disableMoreOutputThanInput||(r=new a.Transaction.InvalidOutputAmountSum):r=this._hasFeeError(e,t),r||this._hasDustOutputs(e)||this._isMissingSignatures(e)},I.prototype._hasFeeError=function(e,t){if(!n.isUndefined(this._fee)&&this._fee!==t)return new a.Transaction.FeeError.Different("Unspent value is "+t+" but specified fee is "+this._fee);if(!e.disableLargeFees){var r=Math.floor(I.FEE_SECURITY_MARGIN*this._estimateFee());if(t>r)return this._missingChange()?new a.Transaction.ChangeAddressMissing("Fee is too large and no change address was provided"):new a.Transaction.FeeError.TooLarge("expected less than "+r+" but got "+t)}if(!e.disableSmallFees){var i=Math.ceil(this._estimateFee()/I.FEE_SECURITY_MARGIN);if(t<i)return new a.Transaction.FeeError.TooSmall("expected more than "+i+" but got "+t)}},I.prototype._missingChange=function(){return!this._changeScript},I.prototype._hasDustOutputs=function(e){var t,r;if(!e.disableDustOutputs)for(t in this.outputs)if(r=this.outputs[t],r.satoshis<I.DUST_AMOUNT&&!r.script.isDataOut())return new a.Transaction.DustOutputs},I.prototype._isMissingSignatures=function(e){if(!e.disableIsFullySigned)return this.isFullySigned()?void 0:new a.Transaction.MissingSignatures},I.prototype.inspect=function(){return"<Transaction: "+this.uncheckedSerialize()+">"},I.prototype.toBuffer=function(){var e=new l;return this.toBufferWriter(e).toBuffer()},I.prototype.toBufferWriter=function(e){return e.writeUInt32LE(this.version),e.writeVarintNum(this.inputs.length),n.each(this.inputs,function(t){t.toBufferWriter(e)}),e.writeVarintNum(this.outputs.length),n.each(this.outputs,function(t){t.toBufferWriter(e)}),e.writeUInt32LE(this.nLockTime),this.version>=2&&(e.writeVarintNum(this.joinSplits.length),n.each(this.joinSplits,function(t){t.toBufferWriter(e)}),this.joinSplits.length>0&&(e.write(this.joinSplitPubKey),e.write(this.joinSplitSig))),e},I.prototype.fromBuffer=function(e){var t=new f(e);return this.fromBufferReader(t)},I.prototype.fromBufferReader=function(e){var t,r,n,o;for(i.checkArgument(!e.finished(),"No transaction data received"),this.version=e.readUInt32LE(),r=e.readVarintNum(),t=0;t<r;t++){var s=m.fromBufferReader(e);this.inputs.push(s)}for(n=e.readVarintNum(),t=0;t<n;t++)this.outputs.push(S.fromBufferReader(e));if(this.nLockTime=e.readUInt32LE(),this.version>=2){for(o=e.readVarintNum(),t=0;t<o;t++)this.joinSplits.push(x.fromBufferReader(e));o>0&&(this.joinSplitPubKey=e.read(32),this.joinSplitSig=e.read(64))}return this},I.prototype.toObject=I.prototype.toJSON=function e(){var t=[];this.inputs.forEach(function(e){t.push(e.toObject())});var r=[];this.outputs.forEach(function(e){r.push(e.toObject())});var i={hash:this.hash,version:this.version,inputs:t,outputs:r,nLockTime:this.nLockTime};if(this.version>=2){var o=[];this.joinSplits.forEach(function(e){o.push(e.toObject())}),i.joinSplits=o,this.joinSplits.length>0&&(i.joinSplitPubKey=u.reverse(this.joinSplitPubKey).toString("hex"),i.joinSplitSig=this.joinSplitSig.toString("hex"))}return this._changeScript&&(i.changeScript=this._changeScript.toString()),n.isUndefined(this._changeIndex)||(i.changeIndex=this._changeIndex),n.isUndefined(this._fee)||(i.fee=this._fee),i},I.prototype.fromObject=function e(r){i.checkArgument(n.isObject(r)||r instanceof I);var o=this,s;return s=r instanceof I?s.toObject():r,n.each(s.inputs,function(e){if(e.output&&e.output.script){var t=new k(e.output.script),r;if(t.isPublicKeyHashOut())r=new m.PublicKeyHash(e);else if(t.isScriptHashOut()&&e.publicKeys&&e.threshold)r=new m.MultiSigScriptHash(e,e.publicKeys,e.threshold,e.signatures);else{if(!t.isPublicKeyOut())throw new a.Transaction.Input.UnsupportedScript(e.output.script);r=new m.PublicKey(e)}o.addInput(r)}else o.uncheckedAddInput(new m(e))}),n.each(s.outputs,function(e){o.addOutput(new S(e))}),s.changeIndex&&(this._changeIndex=s.changeIndex),s.changeScript&&(this._changeScript=new k(s.changeScript)),s.fee&&(this._fee=s.fee),this.nLockTime=s.nLockTime,this.version=s.version,this.version>=2&&(n.each(s.joinSplits,function(e){o.joinSplits.push(new x(e))}),o.joinSplits.length>0&&(o.joinSplitPubKey=u.reverse(new t(s.joinSplitPubKey,"hex")),o.joinSplitSig=new t(s.joinSplitSig,"hex"))),this._checkConsistency(r),this},I.prototype._checkConsistency=function(e){n.isUndefined(this._changeIndex)||(i.checkState(this._changeScript),i.checkState(this.outputs[this._changeIndex]),i.checkState(this.outputs[this._changeIndex].script.toString()===this._changeScript.toString())),e&&e.hash&&i.checkState(e.hash===this.hash,"Hash in object does not match transaction hash")},I.prototype.lockUntilDate=function(e){if(i.checkArgument(e),n.isNumber(e)&&e<I.NLOCKTIME_BLOCKHEIGHT_LIMIT)throw new a.Transaction.LockTimeTooEarly;n.isDate(e)&&(e=e.getTime()/1e3);for(var t=0;t<this.inputs.length;t++)this.inputs[t].sequenceNumber===m.DEFAULT_SEQNUMBER&&(this.inputs[t].sequenceNumber=m.DEFAULT_LOCKTIME_SEQNUMBER);return this.nLockTime=e,this},I.prototype.lockUntilBlockHeight=function(e){if(i.checkArgument(n.isNumber(e)),e>=I.NLOCKTIME_BLOCKHEIGHT_LIMIT)throw new a.Transaction.BlockHeightTooHigh;if(e<0)throw new a.Transaction.NLockTimeOutOfRange;for(var t=0;t<this.inputs.length;t++)this.inputs[t].sequenceNumber===m.DEFAULT_SEQNUMBER&&(this.inputs[t].sequenceNumber=m.DEFAULT_LOCKTIME_SEQNUMBER);return this.nLockTime=e,this},I.prototype.getLockTime=function(){return this.nLockTime?this.nLockTime<I.NLOCKTIME_BLOCKHEIGHT_LIMIT?this.nLockTime:new Date(1e3*this.nLockTime):null},I.prototype.fromString=function(e){this.fromBuffer(new o.Buffer(e,"hex"))},I.prototype._newTransaction=function(){this.version=1,this.nLockTime=0},I.prototype.from=function(e,t,r){if(n.isArray(e)){var i=this;return n.each(e,function(e){i.from(e,t,r)}),this}var o=n.any(this.inputs,function(t){return t.prevTxId.toString("hex")===e.txId&&t.outputIndex===e.outputIndex});return o?this:(t&&r?this._fromMultisigUtxo(e,t,r):this._fromNonP2SH(e),this)},I.prototype._fromNonP2SH=function(e){var t;e=new g(e),t=e.script.isPublicKeyHashOut()?b:e.script.isPublicKeyOut()?v:m,this.addInput(new t({output:new S({script:e.script,satoshis:e.satoshis}),prevTxId:e.txId,outputIndex:e.outputIndex,script:k.empty()}))},I.prototype._fromMultisigUtxo=function(e,t,r){var n;if(i.checkArgument(r<=t.length,"Number of required signatures must be greater than the number of public keys"),e=new g(e),e.script.isMultisigOut())n=w;else{if(!e.script.isScriptHashOut())throw new Error("@TODO");n=_}this.addInput(new n({output:new S({script:e.script,satoshis:e.satoshis}),prevTxId:e.txId,outputIndex:e.outputIndex,script:k.empty()},t,r))},I.prototype.addInput=function(e,t,r){if(i.checkArgumentType(e,m,"input"),!e.output&&(n.isUndefined(t)||n.isUndefined(r)))throw new a.Transaction.NeedMoreInfo("Need information about the UTXO script and satoshis");return e.output||!t||n.isUndefined(r)||(t=t instanceof k?t:new k(t),i.checkArgumentType(r,"number","satoshis"),e.output=new S({script:t,satoshis:r})),this.uncheckedAddInput(e)},I.prototype.uncheckedAddInput=function(e){return i.checkArgumentType(e,m,"input"),this.inputs.push(e),this._inputAmount=void 0,this._updateChangeOutput(),this},I.prototype.hasAllUtxoInfo=function(){return n.all(this.inputs.map(function(e){return!!e.output}))},I.prototype.fee=function(e){return i.checkArgument(n.isNumber(e),"amount must be a number"),this._fee=e,this._updateChangeOutput(),this},I.prototype.feePerKb=function(e){return i.checkArgument(n.isNumber(e),"amount must be a number"),this._feePerKb=e,this._updateChangeOutput(),this},I.prototype.change=function(e){return i.checkArgument(e,"address is required"),this._changeScript=k.fromAddress(e),this._updateChangeOutput(),this},I.prototype.getChangeOutput=function(){return n.isUndefined(this._changeIndex)?null:this.outputs[this._changeIndex]},I.prototype.to=function(e,t){if(n.isArray(e)){var r=this;return n.each(e,function(e){r.to(e.address,e.satoshis)}),this}return i.checkArgument(c.isNaturalNumber(t),"Amount is expected to be a positive integer"),this.addOutput(new S({script:k(new y(e)),satoshis:t})),this},I.prototype.addData=function(e){return this.addOutput(new S({script:k.buildDataOut(e),satoshis:0})),this},I.prototype.addOutput=function(e){return i.checkArgumentType(e,S,"output"),this._addOutput(e),this._updateChangeOutput(),this},I.prototype.clearOutputs=function(){return this.outputs=[],this._clearSignatures(),this._outputAmount=void 0,this._changeIndex=void 0,this._updateChangeOutput(),this},I.prototype._addOutput=function(e){this.outputs.push(e),this._outputAmount=void 0},I.prototype._getOutputAmount=function(){if(n.isUndefined(this._outputAmount)){var e=this;this._outputAmount=0,n.each(this.outputs,function(t){e._outputAmount+=t.satoshis})}return this._outputAmount},I.prototype._getInputAmount=function(){if(n.isUndefined(this._inputAmount)){var e=this;this._inputAmount=0,n.each(this.inputs,function(t){if(n.isUndefined(t.output))throw new a.Transaction.Input.MissingPreviousOutput;e._inputAmount+=t.output.satoshis})}return this._inputAmount},I.prototype._updateChangeOutput=function(){if(this._changeScript){this._clearSignatures(),n.isUndefined(this._changeIndex)||this._removeOutput(this._changeIndex);var e=this._getUnspentValue(),t=this.getFee(),r=e-t;r>0?(this._changeIndex=this.outputs.length,this._addOutput(new S({script:this._changeScript,satoshis:r}))):this._changeIndex=void 0}},I.prototype.getFee=function(){return this.isCoinbase()?0:n.isUndefined(this._fee)?this._changeScript?this._estimateFee():this._getUnspentValue():this._fee},I.prototype._estimateFee=function(){var e=this._estimateSize(),t=this._getUnspentValue();return I._estimateFee(e,t,this._feePerKb)},I.prototype._getUnspentValue=function(){return this._getInputAmount()-this._getOutputAmount()},I.prototype._clearSignatures=function(){n.each(this.inputs,function(e){e.clearSignatures()})},I._estimateFee=function(e,t,r){var n=Math.ceil(e/1e3)*(r||I.FEE_PER_KB);return t>n&&(e+=I.CHANGE_OUTPUT_MAX_SIZE),Math.ceil(e/1e3)*(r||I.FEE_PER_KB)},I.prototype._estimateSize=function(){var e=I.MAXIMUM_EXTRA_SIZE;return n.each(this.inputs,function(t){e+=t._estimateSize()}),n.each(this.outputs,function(t){e+=t.script.toBuffer().length+9}),e},I.prototype._removeOutput=function(e){var t=this.outputs[e];this.outputs=n.without(this.outputs,t),this._outputAmount=void 0},I.prototype.removeOutput=function(e){this._removeOutput(e),this._updateChangeOutput()},I.prototype.sort=function(){return this.sortInputs(function(e){var t=Array.prototype.concat.apply([],e);return t.sort(function(e,t){return s(e.prevTxId,t.prevTxId)||e.outputIndex-t.outputIndex}),t}),this.sortOutputs(function(e){var t=Array.prototype.concat.apply([],e);return t.sort(function(e,t){return e.satoshis-t.satoshis||s(e.script.toBuffer(),t.script.toBuffer())}),t}),this},I.prototype.shuffleOutputs=function(){return this.sortOutputs(n.shuffle)},I.prototype.sortOutputs=function(e){var t=e(this.outputs);return this._newOutputOrder(t)},I.prototype.sortInputs=function(e){return this.inputs=e(this.inputs),this._clearSignatures(),this},I.prototype._newOutputOrder=function(e){var t=this.outputs.length!==e.length||0!==n.difference(this.outputs,e).length;if(t)throw new a.Transaction.InvalidSorting;if(!n.isUndefined(this._changeIndex)){var r=this.outputs[this._changeIndex];this._changeIndex=n.findIndex(e,r)}return this.outputs=e,this},I.prototype.removeInput=function(e,t){var r;if(r=!t&&n.isNumber(e)?e:n.findIndex(this.inputs,function(r){return r.prevTxId.toString("hex")===e&&r.outputIndex===t}),r<0||r>=this.inputs.length)throw new a.Transaction.InvalidIndex(r,this.inputs.length);var i=this.inputs[r];this.inputs=n.without(this.inputs,i),this._inputAmount=void 0,this._updateChangeOutput()},I.prototype.sign=function(e,t){i.checkState(this.hasAllUtxoInfo());var r=this;return n.isArray(e)?(n.each(e,function(e){r.sign(e,t)}),this):(n.each(this.getSignatures(e,t),function(e){r.applySignature(e)}),this)},I.prototype.getSignatures=function(e,t){e=new E(e),t=t||p.SIGHASH_ALL;var r=this,i=[],o=h.sha256ripemd160(e.publicKey.toBuffer());return n.each(this.inputs,function s(a,u){n.each(a.getSignatures(r,e,u,t,o),function(e){i.push(e)})}),i},I.prototype.applySignature=function(e){return this.inputs[e.inputIndex].addSignature(this,e),this},I.prototype.isFullySigned=function(){return n.each(this.inputs,function(e){if(e.isFullySigned===m.prototype.isFullySigned)throw new a.Transaction.UnableToVerifySignature("Unrecognized script kind, or not enough information to execute script.This usually happens when creating a transaction from a serialized transaction")}),n.all(n.map(this.inputs,function(e){return e.isFullySigned()}))},I.prototype.isValidSignature=function(e){var t=this;if(this.inputs[e.inputIndex].isValidSignature===m.prototype.isValidSignature)throw new a.Transaction.UnableToVerifySignature("Unrecognized script kind, or not enough information to execute script.This usually happens when creating a transaction from a serialized transaction");return this.inputs[e.inputIndex].isValidSignature(this,e)},I.prototype.verifySignature=function(e,t,r,n){return d.verify(this,e,t,r,n)},I.prototype.verify=function(){if(0===this.inputs.length)return"transaction txins empty";if(0===this.outputs.length)return"transaction txouts empty";for(var e=new A(0),t=0;t<this.outputs.length;t++){var r=this.outputs[t];if(r.invalidSatoshis())return"transaction txout "+t+" satoshis is invalid";if(r._satoshisBN.gt(new A(I.MAX_MONEY,10)))return"transaction txout "+t+" greater than MAX_MONEY";if(e=e.add(r._satoshisBN),e.gt(new A(I.MAX_MONEY)))return"transaction txout "+t+" total output greater than MAX_MONEY"}if(this.toBuffer().length>1e6)return"transaction over the maximum block size";var i={};for(t=0;t<this.inputs.length;t++){var o=this.inputs[t],s=o.prevTxId+":"+o.outputIndex;if(!n.isUndefined(i[s]))return"transaction input "+t+" duplicate input";i[s]=!0}var a=this.isCoinbase();if(a){var u=this.inputs[0]._scriptBuffer;if(u.length<2||u.length>100)return"coinbase transaction script size invalid"}else for(t=0;t<this.inputs.length;t++)if(this.inputs[t].isNull())return"transaction input "+t+" has null input";return!0},I.prototype.isCoinbase=function(){return 1===this.inputs.length&&this.inputs[0].isNull()},I.prototype.isRBF=function(){for(var e=0;e<this.inputs.length;e++){var t=this.inputs[e];if(t.sequenceNumber<m.MAXINT-1)return!0}return!1},I.prototype.enableRBF=function(){for(var e=0;e<this.inputs.length;e++){var t=this.inputs[e];t.sequenceNumber>=m.MAXINT-1&&(t.sequenceNumber=m.DEFAULT_RBF_SEQNUMBER)}return this},e.exports=I}).call(this,r(0).Buffer)},function(e,t,r){e.exports=r(134),e.exports.PublicKey=r(873),e.exports.PublicKeyHash=r(874),e.exports.MultiSig=r(875),e.exports.MultiSigScriptHash=r(876)},function(e,t,r){"use strict";var n=r(15),i=r(60),o=r(20),s={BTC:[1e8,8],mBTC:[1e5,5],uBTC:[100,2],bits:[100,2],satoshis:[1,0]};function a(e,t){if(!(this instanceof a))return new a(e,t);if(n.isNumber(t)){if(t<=0)throw new i.Unit.InvalidRate(t);e/=t,t=a.BTC}this._value=this._from(e,t);var r=this,o=function(e){Object.defineProperty(r,e,{get:function(){return r.to(e)},enumerable:!0})};Object.keys(s).forEach(o)}Object.keys(s).forEach(function(e){a[e]=e}),a.fromObject=function e(t){return o.checkArgument(n.isObject(t),"Argument is expected to be an object"),new a(t.amount,t.code)},a.fromBTC=function(e){return new a(e,a.BTC)},a.fromMillis=a.fromMilis=function(e){return new a(e,a.mBTC)},a.fromMicros=a.fromBits=function(e){return new a(e,a.bits)},a.fromSatoshis=function(e){return new a(e,a.satoshis)},a.fromFiat=function(e,t){return new a(e,t)},a.prototype._from=function(e,t){if(!s[t])throw new i.Unit.UnknownCode(t);return parseInt((e*s[t][0]).toFixed())},a.prototype.to=function(e){if(n.isNumber(e)){if(e<=0)throw new i.Unit.InvalidRate(e);return parseFloat((this.BTC*e).toFixed(2))}if(!s[e])throw new i.Unit.UnknownCode(e);var t=this._value/s[e][0];return parseFloat(t.toFixed(s[e][1]))},a.prototype.toBTC=function(){return this.to(a.BTC)},a.prototype.toMillis=a.prototype.toMilis=function(){return this.to(a.mBTC)},a.prototype.toMicros=a.prototype.toBits=function(){return this.to(a.bits)},a.prototype.toSatoshis=function(){return this.to(a.satoshis)},a.prototype.atRate=function(e){return this.to(e)},a.prototype.toString=function(){return this.satoshis+" satoshis"},a.prototype.toObject=a.prototype.toJSON=function e(){return{amount:this.BTC,code:a.BTC}},a.prototype.inspect=function(){return"<Unit: "+this.toString()+">"},e.exports=a},function(e,t,r){"use strict";e.exports={_cache:{},_count:0,_eraseIndex:0,_usedList:{},_usedIndex:{},_CACHE_SIZE:5e3,get:function(e,t,r){r=!!r;var n=e+"/"+t+"/"+r;if(this._cache[n])return this._cacheHit(n),this._cache[n]},set:function(e,t,r,n){r=!!r;var i=e+"/"+t+"/"+r;this._cache[i]=n,this._cacheHit(i)},_cacheHit:function(e){this._usedIndex[e]&&delete this._usedList[this._usedIndex[e]],this._usedList[this._count]=e,this._usedIndex[e]=this._count,this._count++,this._cacheRemove()},_cacheRemove:function(){for(;this._eraseIndex<this._count-this._CACHE_SIZE;){if(this._usedList[this._eraseIndex]){var e=this._usedList[this._eraseIndex];delete this._usedIndex[e],delete this._cache[e]}delete this._usedList[this._eraseIndex],this._eraseIndex++}}}},function(e,t,r){"use strict";e.exports=function e(t,r){return t.then(e=>{r(null,e)},e=>{r(e)})}},function(e,t,r){"use strict";e.exports=(()=>{if("undefined"!=typeof self&&(r(69)(self),self.crypto))return self.crypto;throw new Error("Please use an environment with crypto support")})},function(e,t,r){"use strict";e.exports="enum KeyType {\n RSA = 0;\n Ed25519 = 1;\n Secp256k1 = 2;\n}\nmessage PublicKey {\n required KeyType Type = 1;\n required bytes Data = 2;\n}\nmessage PrivateKey {\n required KeyType Type = 1;\n required bytes Data = 2;\n}"},function(e,t,r){var n=r(11);r(16),e.exports=n.cipher=n.cipher||{},n.cipher.algorithms=n.cipher.algorithms||{},n.cipher.createCipher=function(e,t){var r=e;if("string"==typeof r&&(r=n.cipher.getAlgorithm(r),r&&(r=r())),!r)throw new Error("Unsupported algorithm: "+e);return new n.cipher.BlockCipher({algorithm:r,key:t,decrypt:!1})},n.cipher.createDecipher=function(e,t){var r=e;if("string"==typeof r&&(r=n.cipher.getAlgorithm(r),r&&(r=r())),!r)throw new Error("Unsupported algorithm: "+e);return new n.cipher.BlockCipher({algorithm:r,key:t,decrypt:!0})},n.cipher.registerAlgorithm=function(e,t){e=e.toUpperCase(),n.cipher.algorithms[e]=t},n.cipher.getAlgorithm=function(e){return e=e.toUpperCase(),e in n.cipher.algorithms?n.cipher.algorithms[e]:null};var i=n.cipher.BlockCipher=function(e){this.algorithm=e.algorithm,this.mode=this.algorithm.mode,this.blockSize=this.mode.blockSize,this._finish=!1,this._input=null,this.output=null,this._op=e.decrypt?this.mode.decrypt:this.mode.encrypt,this._decrypt=e.decrypt,this.algorithm.initialize(e)};i.prototype.start=function(e){e=e||{};var t={};for(var r in e)t[r]=e[r];t.decrypt=this._decrypt,this._finish=!1,this._input=n.util.createBuffer(),this.output=e.output||n.util.createBuffer(),this.mode.start(t)},i.prototype.update=function(e){for(e&&this._input.putBuffer(e);!this._op.call(this.mode,this._input,this.output,this._finish)&&!this._finish;);this._input.compact()},i.prototype.finish=function(e){!e||"ECB"!==this.mode.name&&"CBC"!==this.mode.name||(this.mode.pad=function(t){return e(this.blockSize,t,!1)},this.mode.unpad=function(t){return e(this.blockSize,t,!0)});var t={};return t.decrypt=this._decrypt,t.overflow=this._input.length()%this.blockSize,!(!this._decrypt&&this.mode.pad&&!this.mode.pad(this._input,t))&&(this._finish=!0,this.update(),!(this._decrypt&&this.mode.unpad&&!this.mode.unpad(this.output,t))&&!(this.mode.afterFinish&&!this.mode.afterFinish(this.output,t)))}},function(e,t,r){var n=r(11);r(78),r(16);var i=e.exports=n.md5=n.md5||{};n.md.md5=n.md.algorithms.md5=i,i.create=function(){c||f();var e=null,t=n.util.createBuffer(),r=new Array(16),i={algorithm:"md5",blockLength:64,digestLength:16,messageLength:0,fullMessageLength:null,messageLengthSize:8,start:function(){i.messageLength=0,i.fullMessageLength=i.messageLength64=[];for(var r=i.messageLengthSize/4,o=0;o<r;++o)i.fullMessageLength.push(0);return t=n.util.createBuffer(),e={h0:1732584193,h1:4023233417,h2:2562383102,h3:271733878},i}};return i.start(),i.update=function(o,s){"utf8"===s&&(o=n.util.encodeUtf8(o));var a=o.length;i.messageLength+=a,a=[a/4294967296>>>0,a>>>0];for(var u=i.fullMessageLength.length-1;u>=0;--u)i.fullMessageLength[u]+=a[1],a[1]=a[0]+(i.fullMessageLength[u]/4294967296>>>0),i.fullMessageLength[u]=i.fullMessageLength[u]>>>0,a[0]=a[1]/4294967296>>>0;return t.putBytes(o),l(e,r,t),(t.read>2048||0===t.length())&&t.compact(),i},i.digest=function(){var s=n.util.createBuffer();s.putBytes(t.bytes());var a=i.fullMessageLength[i.fullMessageLength.length-1]+i.messageLengthSize,u=a&i.blockLength-1;s.putBytes(o.substr(0,i.blockLength-u));for(var c,f=0,h=i.fullMessageLength.length-1;h>=0;--h)c=8*i.fullMessageLength[h]+f,f=c/4294967296>>>0,s.putInt32Le(c>>>0);var p={h0:e.h0,h1:e.h1,h2:e.h2,h3:e.h3};l(p,r,s);var d=n.util.createBuffer();return d.putInt32Le(p.h0),d.putInt32Le(p.h1),d.putInt32Le(p.h2),d.putInt32Le(p.h3),d},i};var o=null,s=null,a=null,u=null,c=!1;function f(){o=String.fromCharCode(128),o+=n.util.fillString(String.fromCharCode(0),64),s=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,1,6,11,0,5,10,15,4,9,14,3,8,13,2,7,12,5,8,11,14,1,4,7,10,13,0,3,6,9,12,15,2,0,7,14,5,12,3,10,1,8,15,6,13,4,11,2,9],a=[7,12,17,22,7,12,17,22,7,12,17,22,7,12,17,22,5,9,14,20,5,9,14,20,5,9,14,20,5,9,14,20,4,11,16,23,4,11,16,23,4,11,16,23,4,11,16,23,6,10,15,21,6,10,15,21,6,10,15,21,6,10,15,21],u=new Array(64);for(var e=0;e<64;++e)u[e]=Math.floor(4294967296*Math.abs(Math.sin(e+1)));c=!0}function l(e,t,r){for(var n,i,o,c,f,l,h,p,d=r.length();d>=64;){for(i=e.h0,o=e.h1,c=e.h2,f=e.h3,p=0;p<16;++p)t[p]=r.getInt32Le(),l=f^o&(c^f),n=i+l+u[p]+t[p],h=a[p],i=f,f=c,c=o,o+=n<<h|n>>>32-h;for(;p<32;++p)l=c^f&(o^c),n=i+l+u[p]+t[s[p]],h=a[p],i=f,f=c,c=o,o+=n<<h|n>>>32-h;for(;p<48;++p)l=o^c^f,n=i+l+u[p]+t[s[p]],h=a[p],i=f,f=c,c=o,o+=n<<h|n>>>32-h;for(;p<64;++p)l=c^(o|~f),n=i+l+u[p]+t[s[p]],h=a[p],i=f,f=c,c=o,o+=n<<h|n>>>32-h;e.h0=e.h0+i|0,e.h1=e.h1+o|0,e.h2=e.h2+c|0,e.h3=e.h3+f|0,d-=64}}},function(e,t,r){(function(t){var n=r(11);r(137),r(78),r(16);var i=n.pkcs5=n.pkcs5||{},o;n.util.isNodejs&&!n.options.usePureJavaScript&&(o=r(442)),e.exports=n.pbkdf2=i.pbkdf2=function(e,r,i,s,a,u){if("function"==typeof a&&(u=a,a=null),n.util.isNodejs&&!n.options.usePureJavaScript&&o.pbkdf2&&(null===a||"object"!=typeof a)&&(o.pbkdf2Sync.length>4||!a||"sha1"===a))return"string"!=typeof a&&(a="sha1"),e=new t(e,"binary"),r=new t(r,"binary"),u?4===o.pbkdf2Sync.length?o.pbkdf2(e,r,i,s,function(e,t){if(e)return u(e);u(null,t.toString("binary"))}):o.pbkdf2(e,r,i,s,a,function(e,t){if(e)return u(e);u(null,t.toString("binary"))}):4===o.pbkdf2Sync.length?o.pbkdf2Sync(e,r,i,s).toString("binary"):o.pbkdf2Sync(e,r,i,s,a).toString("binary");if(void 0!==a&&null!==a||(a="sha1"),"string"==typeof a){if(!(a in n.md.algorithms))throw new Error("Unknown hash algorithm: "+a);a=n.md[a].create()}var c=a.digestLength;if(s>4294967295*c){var f=new Error("Derived key is too long.");if(u)return u(f);throw f}var l=Math.ceil(s/c),h=s-(l-1)*c,p=n.hmac.create();p.start(a,e);var d="",y,g,m;if(!u){for(var b=1;b<=l;++b){p.start(null,null),p.update(r),p.update(n.util.int32ToBytes(b)),y=m=p.digest().getBytes();for(var v=2;v<=i;++v)p.start(null,null),p.update(m),g=p.digest().getBytes(),y=n.util.xorBytes(y,g,c),m=g;d+=b<l?y:y.substr(0,h)}return d}var b=1,v;function _(){if(b>l)return u(null,d);p.start(null,null),p.update(r),p.update(n.util.int32ToBytes(b)),y=m=p.digest().getBytes(),v=2,w()}function w(){if(v<=i)return p.start(null,null),p.update(m),g=p.digest().getBytes(),y=n.util.xorBytes(y,g,c),m=g,++v,n.util.setImmediate(w);d+=b<l?y:y.substr(0,h),++b,_()}_()}}).call(this,r(0).Buffer)},function(e,t,r){var n=r(11);r(100),r(77),r(182),r(78),r(898),r(101),r(114),r(260),r(183),r(16);var i=n.asn1,o=e.exports=n.pki=n.pki||{},s=o.oids,a={};a.CN=s.commonName,a.commonName="CN",a.C=s.countryName,a.countryName="C",a.L=s.localityName,a.localityName="L",a.ST=s.stateOrProvinceName,a.stateOrProvinceName="ST",a.O=s.organizationName,a.organizationName="O",a.OU=s.organizationalUnitName,a.organizationalUnitName="OU",a.E=s.emailAddress,a.emailAddress="E";var u=n.pki.rsa.publicKeyValidator,c={name:"Certificate",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"Certificate.TBSCertificate",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,captureAsn1:"tbsCertificate",value:[{name:"Certificate.TBSCertificate.version",tagClass:i.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,optional:!0,value:[{name:"Certificate.TBSCertificate.version.integer",tagClass:i.Class.UNIVERSAL,type:i.Type.INTEGER,constructed:!1,capture:"certVersion"}]},{name:"Certificate.TBSCertificate.serialNumber",tagClass:i.Class.UNIVERSAL,type:i.Type.INTEGER,constructed:!1,capture:"certSerialNumber"},{name:"Certificate.TBSCertificate.signature",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"Certificate.TBSCertificate.signature.algorithm",tagClass:i.Class.UNIVERSAL,type:i.Type.OID,constructed:!1,capture:"certinfoSignatureOid"},{name:"Certificate.TBSCertificate.signature.parameters",tagClass:i.Class.UNIVERSAL,optional:!0,captureAsn1:"certinfoSignatureParams"}]},{name:"Certificate.TBSCertificate.issuer",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,captureAsn1:"certIssuer"},{name:"Certificate.TBSCertificate.validity",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"Certificate.TBSCertificate.validity.notBefore (utc)",tagClass:i.Class.UNIVERSAL,type:i.Type.UTCTIME,constructed:!1,optional:!0,capture:"certValidity1UTCTime"},{name:"Certificate.TBSCertificate.validity.notBefore (generalized)",tagClass:i.Class.UNIVERSAL,type:i.Type.GENERALIZEDTIME,constructed:!1,optional:!0,capture:"certValidity2GeneralizedTime"},{name:"Certificate.TBSCertificate.validity.notAfter (utc)",tagClass:i.Class.UNIVERSAL,type:i.Type.UTCTIME,constructed:!1,optional:!0,capture:"certValidity3UTCTime"},{name:"Certificate.TBSCertificate.validity.notAfter (generalized)",tagClass:i.Class.UNIVERSAL,type:i.Type.GENERALIZEDTIME,constructed:!1,optional:!0,capture:"certValidity4GeneralizedTime"}]},{name:"Certificate.TBSCertificate.subject",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,captureAsn1:"certSubject"},u,{name:"Certificate.TBSCertificate.issuerUniqueID",tagClass:i.Class.CONTEXT_SPECIFIC,type:1,constructed:!0,optional:!0,value:[{name:"Certificate.TBSCertificate.issuerUniqueID.id",tagClass:i.Class.UNIVERSAL,type:i.Type.BITSTRING,constructed:!1,captureBitStringValue:"certIssuerUniqueId"}]},{name:"Certificate.TBSCertificate.subjectUniqueID",tagClass:i.Class.CONTEXT_SPECIFIC,type:2,constructed:!0,optional:!0,value:[{name:"Certificate.TBSCertificate.subjectUniqueID.id",tagClass:i.Class.UNIVERSAL,type:i.Type.BITSTRING,constructed:!1,captureBitStringValue:"certSubjectUniqueId"}]},{name:"Certificate.TBSCertificate.extensions",tagClass:i.Class.CONTEXT_SPECIFIC,type:3,constructed:!0,captureAsn1:"certExtensions",optional:!0}]},{name:"Certificate.signatureAlgorithm",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"Certificate.signatureAlgorithm.algorithm",tagClass:i.Class.UNIVERSAL,type:i.Type.OID,constructed:!1,capture:"certSignatureOid"},{name:"Certificate.TBSCertificate.signature.parameters",tagClass:i.Class.UNIVERSAL,optional:!0,captureAsn1:"certSignatureParams"}]},{name:"Certificate.signatureValue",tagClass:i.Class.UNIVERSAL,type:i.Type.BITSTRING,constructed:!1,captureBitStringValue:"certSignature"}]},f={name:"rsapss",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"rsapss.hashAlgorithm",tagClass:i.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,value:[{name:"rsapss.hashAlgorithm.AlgorithmIdentifier",tagClass:i.Class.UNIVERSAL,type:i.Class.SEQUENCE,constructed:!0,optional:!0,value:[{name:"rsapss.hashAlgorithm.AlgorithmIdentifier.algorithm",tagClass:i.Class.UNIVERSAL,type:i.Type.OID,constructed:!1,capture:"hashOid"}]}]},{name:"rsapss.maskGenAlgorithm",tagClass:i.Class.CONTEXT_SPECIFIC,type:1,constructed:!0,value:[{name:"rsapss.maskGenAlgorithm.AlgorithmIdentifier",tagClass:i.Class.UNIVERSAL,type:i.Class.SEQUENCE,constructed:!0,optional:!0,value:[{name:"rsapss.maskGenAlgorithm.AlgorithmIdentifier.algorithm",tagClass:i.Class.UNIVERSAL,type:i.Type.OID,constructed:!1,capture:"maskGenOid"},{name:"rsapss.maskGenAlgorithm.AlgorithmIdentifier.params",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"rsapss.maskGenAlgorithm.AlgorithmIdentifier.params.algorithm",tagClass:i.Class.UNIVERSAL,type:i.Type.OID,constructed:!1,capture:"maskGenHashOid"}]}]}]},{name:"rsapss.saltLength",tagClass:i.Class.CONTEXT_SPECIFIC,type:2,optional:!0,value:[{name:"rsapss.saltLength.saltLength",tagClass:i.Class.UNIVERSAL,type:i.Class.INTEGER,constructed:!1,capture:"saltLength"}]},{name:"rsapss.trailerField",tagClass:i.Class.CONTEXT_SPECIFIC,type:3,optional:!0,value:[{name:"rsapss.trailer.trailer",tagClass:i.Class.UNIVERSAL,type:i.Class.INTEGER,constructed:!1,capture:"trailer"}]}]},l={name:"CertificationRequestInfo",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,captureAsn1:"certificationRequestInfo",value:[{name:"CertificationRequestInfo.integer",tagClass:i.Class.UNIVERSAL,type:i.Type.INTEGER,constructed:!1,capture:"certificationRequestInfoVersion"},{name:"CertificationRequestInfo.subject",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,captureAsn1:"certificationRequestInfoSubject"},u,{name:"CertificationRequestInfo.attributes",tagClass:i.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,optional:!0,capture:"certificationRequestInfoAttributes",value:[{name:"CertificationRequestInfo.attributes",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"CertificationRequestInfo.attributes.type",tagClass:i.Class.UNIVERSAL,type:i.Type.OID,constructed:!1},{name:"CertificationRequestInfo.attributes.value",tagClass:i.Class.UNIVERSAL,type:i.Type.SET,constructed:!0}]}]}]},h={name:"CertificationRequest",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,captureAsn1:"csr",value:[l,{name:"CertificationRequest.signatureAlgorithm",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"CertificationRequest.signatureAlgorithm.algorithm",tagClass:i.Class.UNIVERSAL,type:i.Type.OID,constructed:!1,capture:"csrSignatureOid"},{name:"CertificationRequest.signatureAlgorithm.parameters",tagClass:i.Class.UNIVERSAL,optional:!0,captureAsn1:"csrSignatureParams"}]},{name:"CertificationRequest.signature",tagClass:i.Class.UNIVERSAL,type:i.Type.BITSTRING,constructed:!1,captureBitStringValue:"csrSignature"}]};function p(e,t){"string"==typeof t&&(t={shortName:t});for(var r=null,n,i=0;null===r&&i<e.attributes.length;++i)n=e.attributes[i],t.type&&t.type===n.type?r=n:t.name&&t.name===n.name?r=n:t.shortName&&t.shortName===n.shortName&&(r=n);return r}o.RDNAttributesAsArray=function(e,t){for(var r=[],n,o,u,c=0;c<e.value.length;++c){n=e.value[c];for(var f=0;f<n.value.length;++f)u={},o=n.value[f],u.type=i.derToOid(o.value[0].value),u.value=o.value[1].value,u.valueTagClass=o.value[1].type,u.type in s&&(u.name=s[u.type],u.name in a&&(u.shortName=a[u.name])),t&&(t.update(u.type),t.update(u.value)),r.push(u)}return r},o.CRIAttributesAsArray=function(e){for(var t=[],r=0;r<e.length;++r)for(var n=e[r],u=i.derToOid(n.value[0].value),c=n.value[1].value,f=0;f<c.length;++f){var l={};if(l.type=u,l.value=c[f].value,l.valueTagClass=c[f].type,l.type in s&&(l.name=s[l.type],l.name in a&&(l.shortName=a[l.name])),l.type===s.extensionRequest){l.extensions=[];for(var h=0;h<l.value.length;++h)l.extensions.push(o.certificateExtensionFromAsn1(l.value[h]))}t.push(l)}return t};var d=function(e,t,r){var n={};if(e!==s["RSASSA-PSS"])return n;r&&(n={hash:{algorithmOid:s.sha1},mgf:{algorithmOid:s.mgf1,hash:{algorithmOid:s.sha1}},saltLength:20});var o={},a=[];if(!i.validate(t,f,o,a)){var u=new Error("Cannot read RSASSA-PSS parameter block.");throw u.errors=a,u}return void 0!==o.hashOid&&(n.hash=n.hash||{},n.hash.algorithmOid=i.derToOid(o.hashOid)),void 0!==o.maskGenOid&&(n.mgf=n.mgf||{},n.mgf.algorithmOid=i.derToOid(o.maskGenOid),n.mgf.hash=n.mgf.hash||{},n.mgf.hash.algorithmOid=i.derToOid(o.maskGenHashOid)),void 0!==o.saltLength&&(n.saltLength=o.saltLength.charCodeAt(0)),n};function y(e){for(var t=i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[]),r,o,s=e.attributes,a=0;a<s.length;++a){r=s[a];var u=r.value,c=i.Type.PRINTABLESTRING;"valueTagClass"in r&&(c=r.valueTagClass,c===i.Type.UTF8&&(u=n.util.encodeUtf8(u))),o=i.create(i.Class.UNIVERSAL,i.Type.SET,!0,[i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[i.create(i.Class.UNIVERSAL,i.Type.OID,!1,i.oidToDer(r.type).getBytes()),i.create(i.Class.UNIVERSAL,c,!1,u)])]),t.value.push(o)}return t}function g(e){for(var t={},r=0;r<e.length;++r){var o=e[r];if(o.shortName&&(o.valueTagClass===i.Type.UTF8||o.valueTagClass===i.Type.PRINTABLESTRING||o.valueTagClass===i.Type.IA5STRING)){var s=o.value;o.valueTagClass===i.Type.UTF8&&(s=n.util.encodeUtf8(o.value)),o.shortName in t?n.util.isArray(t[o.shortName])?t[o.shortName].push(s):t[o.shortName]=[t[o.shortName],s]:t[o.shortName]=s}}return t}function m(e){for(var t,r=0;r<e.length;++r){if(t=e[r],void 0===t.name&&(t.type&&t.type in o.oids?t.name=o.oids[t.type]:t.shortName&&t.shortName in a&&(t.name=o.oids[a[t.shortName]])),void 0===t.type){if(!(t.name&&t.name in o.oids)){var n=new Error("Attribute type not specified.");throw n.attribute=t,n}t.type=o.oids[t.name]}if(void 0===t.shortName&&t.name&&t.name in a&&(t.shortName=a[t.name]),t.type===s.extensionRequest&&(t.valueConstructed=!0,t.valueTagClass=i.Type.SEQUENCE,!t.value&&t.extensions)){t.value=[];for(var u=0;u<t.extensions.length;++u)t.value.push(o.certificateExtensionToAsn1(b(t.extensions[u])))}if(void 0===t.value){var n=new Error("Attribute value not specified.");throw n.attribute=t,n}}}function b(e,t){if(t=t||{},void 0===e.name&&e.id&&e.id in o.oids&&(e.name=o.oids[e.id]),void 0===e.id){if(!(e.name&&e.name in o.oids)){var r=new Error("Extension ID not specified.");throw r.extension=e,r}e.id=o.oids[e.name]}if(void 0!==e.value)return e;if("keyUsage"===e.name){var a=0,u=0,c=0;e.digitalSignature&&(u|=128,a=7),e.nonRepudiation&&(u|=64,a=6),e.keyEncipherment&&(u|=32,a=5),e.dataEncipherment&&(u|=16,a=4),e.keyAgreement&&(u|=8,a=3),e.keyCertSign&&(u|=4,a=2),e.cRLSign&&(u|=2,a=1),e.encipherOnly&&(u|=1,a=0),e.decipherOnly&&(c|=128,a=7);var f=String.fromCharCode(a);0!==c?f+=String.fromCharCode(u)+String.fromCharCode(c):0!==u&&(f+=String.fromCharCode(u)),e.value=i.create(i.Class.UNIVERSAL,i.Type.BITSTRING,!1,f)}else if("basicConstraints"===e.name)e.value=i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[]),e.cA&&e.value.value.push(i.create(i.Class.UNIVERSAL,i.Type.BOOLEAN,!1,String.fromCharCode(255))),"pathLenConstraint"in e&&e.value.value.push(i.create(i.Class.UNIVERSAL,i.Type.INTEGER,!1,i.integerToDer(e.pathLenConstraint).getBytes()));else if("extKeyUsage"===e.name){e.value=i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[]);var l=e.value.value;for(var h in e)!0===e[h]&&(h in s?l.push(i.create(i.Class.UNIVERSAL,i.Type.OID,!1,i.oidToDer(s[h]).getBytes())):-1!==h.indexOf(".")&&l.push(i.create(i.Class.UNIVERSAL,i.Type.OID,!1,i.oidToDer(h).getBytes())))}else if("nsCertType"===e.name){var a=0,u=0;e.client&&(u|=128,a=7),e.server&&(u|=64,a=6),e.email&&(u|=32,a=5),e.objsign&&(u|=16,a=4),e.reserved&&(u|=8,a=3),e.sslCA&&(u|=4,a=2),e.emailCA&&(u|=2,a=1),e.objCA&&(u|=1,a=0);var f=String.fromCharCode(a);0!==u&&(f+=String.fromCharCode(u)),e.value=i.create(i.Class.UNIVERSAL,i.Type.BITSTRING,!1,f)}else if("subjectAltName"===e.name||"issuerAltName"===e.name){var p;e.value=i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[]);for(var d=0;d<e.altNames.length;++d){p=e.altNames[d];var f=p.value;if(7===p.type&&p.ip){if(f=n.util.bytesFromIP(p.ip),null===f){var r=new Error('Extension "ip" value is not a valid IPv4 or IPv6 address.');throw r.extension=e,r}}else 8===p.type&&(f=p.oid?i.oidToDer(i.oidToDer(p.oid)):i.oidToDer(f));e.value.value.push(i.create(i.Class.CONTEXT_SPECIFIC,p.type,!1,f))}}else if("subjectKeyIdentifier"===e.name&&t.cert){var g=t.cert.generateSubjectKeyIdentifier();e.subjectKeyIdentifier=g.toHex(),e.value=i.create(i.Class.UNIVERSAL,i.Type.OCTETSTRING,!1,g.getBytes())}else if("authorityKeyIdentifier"===e.name&&t.cert){e.value=i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[]);var l=e.value.value;if(e.keyIdentifier){var m=!0===e.keyIdentifier?t.cert.generateSubjectKeyIdentifier().getBytes():e.keyIdentifier;l.push(i.create(i.Class.CONTEXT_SPECIFIC,0,!1,m))}if(e.authorityCertIssuer){var b=[i.create(i.Class.CONTEXT_SPECIFIC,4,!0,[y(!0===e.authorityCertIssuer?t.cert.issuer:e.authorityCertIssuer)])];l.push(i.create(i.Class.CONTEXT_SPECIFIC,1,!0,b))}if(e.serialNumber){var v=n.util.hexToBytes(!0===e.serialNumber?t.cert.serialNumber:e.serialNumber);l.push(i.create(i.Class.CONTEXT_SPECIFIC,2,!1,v))}}else if("cRLDistributionPoints"===e.name){e.value=i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[]);for(var l=e.value.value,_=i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[]),w=i.create(i.Class.CONTEXT_SPECIFIC,0,!0,[]),p,d=0;d<e.altNames.length;++d){p=e.altNames[d];var f=p.value;if(7===p.type&&p.ip){if(f=n.util.bytesFromIP(p.ip),null===f){var r=new Error('Extension "ip" value is not a valid IPv4 or IPv6 address.');throw r.extension=e,r}}else 8===p.type&&(f=p.oid?i.oidToDer(i.oidToDer(p.oid)):i.oidToDer(f));w.value.push(i.create(i.Class.CONTEXT_SPECIFIC,p.type,!1,f))}_.value.push(i.create(i.Class.CONTEXT_SPECIFIC,0,!0,[w])),l.push(_)}if(void 0===e.value){var r=new Error("Extension value not specified.");throw r.extension=e,r}return e}function v(e,t){switch(e){case s["RSASSA-PSS"]:var r=[];return void 0!==t.hash.algorithmOid&&r.push(i.create(i.Class.CONTEXT_SPECIFIC,0,!0,[i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[i.create(i.Class.UNIVERSAL,i.Type.OID,!1,i.oidToDer(t.hash.algorithmOid).getBytes()),i.create(i.Class.UNIVERSAL,i.Type.NULL,!1,"")])])),void 0!==t.mgf.algorithmOid&&r.push(i.create(i.Class.CONTEXT_SPECIFIC,1,!0,[i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[i.create(i.Class.UNIVERSAL,i.Type.OID,!1,i.oidToDer(t.mgf.algorithmOid).getBytes()),i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[i.create(i.Class.UNIVERSAL,i.Type.OID,!1,i.oidToDer(t.mgf.hash.algorithmOid).getBytes()),i.create(i.Class.UNIVERSAL,i.Type.NULL,!1,"")])])])),void 0!==t.saltLength&&r.push(i.create(i.Class.CONTEXT_SPECIFIC,2,!0,[i.create(i.Class.UNIVERSAL,i.Type.INTEGER,!1,i.integerToDer(t.saltLength).getBytes())])),i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,r);default:return i.create(i.Class.UNIVERSAL,i.Type.NULL,!1,"")}}function _(e){var t=i.create(i.Class.CONTEXT_SPECIFIC,0,!0,[]);if(0===e.attributes.length)return t;for(var r=e.attributes,o=0;o<r.length;++o){var s=r[o],a=s.value,u=i.Type.UTF8;"valueTagClass"in s&&(u=s.valueTagClass),u===i.Type.UTF8&&(a=n.util.encodeUtf8(a));var c=!1;"valueConstructed"in s&&(c=s.valueConstructed);var f=i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[i.create(i.Class.UNIVERSAL,i.Type.OID,!1,i.oidToDer(s.type).getBytes()),i.create(i.Class.UNIVERSAL,i.Type.SET,!0,[i.create(i.Class.UNIVERSAL,u,c,a)])]);t.value.push(f)}return t}o.certificateFromPem=function(e,t,r){var s=n.pem.decode(e)[0];if("CERTIFICATE"!==s.type&&"X509 CERTIFICATE"!==s.type&&"TRUSTED CERTIFICATE"!==s.type){var a=new Error('Could not convert certificate from PEM; PEM header type is not "CERTIFICATE", "X509 CERTIFICATE", or "TRUSTED CERTIFICATE".');throw a.headerType=s.type,a}if(s.procType&&"ENCRYPTED"===s.procType.type)throw new Error("Could not convert certificate from PEM; PEM is encrypted.");var u=i.fromDer(s.body,r);return o.certificateFromAsn1(u,t)},o.certificateToPem=function(e,t){var r={type:"CERTIFICATE",body:i.toDer(o.certificateToAsn1(e)).getBytes()};return n.pem.encode(r,{maxline:t})},o.publicKeyFromPem=function(e){var t=n.pem.decode(e)[0];if("PUBLIC KEY"!==t.type&&"RSA PUBLIC KEY"!==t.type){var r=new Error('Could not convert public key from PEM; PEM header type is not "PUBLIC KEY" or "RSA PUBLIC KEY".');throw r.headerType=t.type,r}if(t.procType&&"ENCRYPTED"===t.procType.type)throw new Error("Could not convert public key from PEM; PEM is encrypted.");var s=i.fromDer(t.body);return o.publicKeyFromAsn1(s)},o.publicKeyToPem=function(e,t){var r={type:"PUBLIC KEY",body:i.toDer(o.publicKeyToAsn1(e)).getBytes()};return n.pem.encode(r,{maxline:t})},o.publicKeyToRSAPublicKeyPem=function(e,t){var r={type:"RSA PUBLIC KEY",body:i.toDer(o.publicKeyToRSAPublicKey(e)).getBytes()};return n.pem.encode(r,{maxline:t})},o.getPublicKeyFingerprint=function(e,t){t=t||{};var r=t.md||n.md.sha1.create(),s=t.type||"RSAPublicKey",a;switch(s){case"RSAPublicKey":a=i.toDer(o.publicKeyToRSAPublicKey(e)).getBytes();break;case"SubjectPublicKeyInfo":a=i.toDer(o.publicKeyToAsn1(e)).getBytes();break;default:throw new Error('Unknown fingerprint type "'+t.type+'".')}r.start(),r.update(a);var u=r.digest();if("hex"===t.encoding){var c=u.toHex();return t.delimiter?c.match(/.{2}/g).join(t.delimiter):c}if("binary"===t.encoding)return u.getBytes();if(t.encoding)throw new Error('Unknown encoding "'+t.encoding+'".');return u},o.certificationRequestFromPem=function(e,t,r){var s=n.pem.decode(e)[0];if("CERTIFICATE REQUEST"!==s.type){var a=new Error('Could not convert certification request from PEM; PEM header type is not "CERTIFICATE REQUEST".');throw a.headerType=s.type,a}if(s.procType&&"ENCRYPTED"===s.procType.type)throw new Error("Could not convert certification request from PEM; PEM is encrypted.");var u=i.fromDer(s.body,r);return o.certificationRequestFromAsn1(u,t)},o.certificationRequestToPem=function(e,t){var r={type:"CERTIFICATE REQUEST",body:i.toDer(o.certificationRequestToAsn1(e)).getBytes()};return n.pem.encode(r,{maxline:t})},o.createCertificate=function(){var e={version:2,serialNumber:"00",signatureOid:null,signature:null,siginfo:{}};return e.siginfo.algorithmOid=null,e.validity={},e.validity.notBefore=new Date,e.validity.notAfter=new Date,e.issuer={},e.issuer.getField=function(t){return p(e.issuer,t)},e.issuer.addField=function(t){m([t]),e.issuer.attributes.push(t)},e.issuer.attributes=[],e.issuer.hash=null,e.subject={},e.subject.getField=function(t){return p(e.subject,t)},e.subject.addField=function(t){m([t]),e.subject.attributes.push(t)},e.subject.attributes=[],e.subject.hash=null,e.extensions=[],e.publicKey=null,e.md=null,e.setSubject=function(t,r){m(t),e.subject.attributes=t,delete e.subject.uniqueId,r&&(e.subject.uniqueId=r),e.subject.hash=null},e.setIssuer=function(t,r){m(t),e.issuer.attributes=t,delete e.issuer.uniqueId,r&&(e.issuer.uniqueId=r),e.issuer.hash=null},e.setExtensions=function(t){for(var r=0;r<t.length;++r)b(t[r],{cert:e});e.extensions=t},e.getExtension=function(t){"string"==typeof t&&(t={name:t});for(var r=null,n,i=0;null===r&&i<e.extensions.length;++i)n=e.extensions[i],t.id&&n.id===t.id?r=n:t.name&&n.name===t.name&&(r=n);return r},e.sign=function(t,r){e.md=r||n.md.sha1.create();var a=s[e.md.algorithm+"WithRSAEncryption"];if(!a){var u=new Error("Could not compute certificate digest. Unknown message digest algorithm OID.");throw u.algorithm=e.md.algorithm,u}e.signatureOid=e.siginfo.algorithmOid=a,e.tbsCertificate=o.getTBSCertificate(e);var c=i.toDer(e.tbsCertificate);e.md.update(c.getBytes()),e.signature=t.sign(e.md)},e.verify=function(t){var r=!1;if(!e.issued(t)){var a=t.issuer,u=e.subject,c=new Error("The parent certificate did not issue the given child certificate; the child certificate's issuer does not match the parent's subject.");throw c.expectedIssuer=a.attributes,c.actualIssuer=u.attributes,c}var f=t.md;if(null===f){if(t.signatureOid in s){var l=s[t.signatureOid];switch(l){case"sha1WithRSAEncryption":f=n.md.sha1.create();break;case"md5WithRSAEncryption":f=n.md.md5.create();break;case"sha256WithRSAEncryption":f=n.md.sha256.create();break;case"sha384WithRSAEncryption":f=n.md.sha384.create();break;case"sha512WithRSAEncryption":f=n.md.sha512.create();break;case"RSASSA-PSS":f=n.md.sha256.create()}}if(null===f){var c=new Error("Could not compute certificate digest. Unknown signature OID.");throw c.signatureOid=t.signatureOid,c}var h=t.tbsCertificate||o.getTBSCertificate(t),p=i.toDer(h);f.update(p.getBytes())}if(null!==f){var d;switch(t.signatureOid){case s.sha1WithRSAEncryption:d=void 0;break;case s["RSASSA-PSS"]:var y,g;if(y=s[t.signatureParameters.mgf.hash.algorithmOid],void 0===y||void 0===n.md[y]){var c=new Error("Unsupported MGF hash function.");throw c.oid=t.signatureParameters.mgf.hash.algorithmOid,c.name=y,c}if(g=s[t.signatureParameters.mgf.algorithmOid],void 0===g||void 0===n.mgf[g]){var c=new Error("Unsupported MGF function.");throw c.oid=t.signatureParameters.mgf.algorithmOid,c.name=g,c}if(g=n.mgf[g].create(n.md[y].create()),y=s[t.signatureParameters.hash.algorithmOid],void 0===y||void 0===n.md[y])throw{message:"Unsupported RSASSA-PSS hash function.",oid:t.signatureParameters.hash.algorithmOid,name:y};d=n.pss.create(n.md[y].create(),g,t.signatureParameters.saltLength)}r=e.publicKey.verify(f.digest().getBytes(),t.signature,d)}return r},e.isIssuer=function(t){var r=!1,n=e.issuer,i=t.subject;if(n.hash&&i.hash)r=n.hash===i.hash;else if(n.attributes.length===i.attributes.length){var o,s;r=!0;for(var a=0;r&&a<n.attributes.length;++a)o=n.attributes[a],s=i.attributes[a],o.type===s.type&&o.value===s.value||(r=!1)}return r},e.issued=function(t){return t.isIssuer(e)},e.generateSubjectKeyIdentifier=function(){return o.getPublicKeyFingerprint(e.publicKey,{type:"RSAPublicKey"})},e.verifySubjectKeyIdentifier=function(){for(var t=s.subjectKeyIdentifier,r=0;r<e.extensions.length;++r){var i=e.extensions[r];if(i.id===t){var o=e.generateSubjectKeyIdentifier().getBytes();return n.util.hexToBytes(i.subjectKeyIdentifier)===o}}return!1},e},o.certificateFromAsn1=function(e,t){var r={},a=[];if(!i.validate(e,c,r,a)){var u=new Error("Cannot read X.509 certificate. ASN.1 object is not an X509v3 Certificate.");throw u.errors=a,u}var f=i.derToOid(r.publicKeyOid);if(f!==o.oids.rsaEncryption)throw new Error("Cannot read public key. OID is not RSA.");var l=o.createCertificate();l.version=r.certVersion?r.certVersion.charCodeAt(0):0;var h=n.util.createBuffer(r.certSerialNumber);l.serialNumber=h.toHex(),l.signatureOid=n.asn1.derToOid(r.certSignatureOid),l.signatureParameters=d(l.signatureOid,r.certSignatureParams,!0),l.siginfo.algorithmOid=n.asn1.derToOid(r.certinfoSignatureOid),l.siginfo.parameters=d(l.siginfo.algorithmOid,r.certinfoSignatureParams,!1),l.signature=r.certSignature;var y=[];if(void 0!==r.certValidity1UTCTime&&y.push(i.utcTimeToDate(r.certValidity1UTCTime)),void 0!==r.certValidity2GeneralizedTime&&y.push(i.generalizedTimeToDate(r.certValidity2GeneralizedTime)),void 0!==r.certValidity3UTCTime&&y.push(i.utcTimeToDate(r.certValidity3UTCTime)),void 0!==r.certValidity4GeneralizedTime&&y.push(i.generalizedTimeToDate(r.certValidity4GeneralizedTime)),y.length>2)throw new Error("Cannot read notBefore/notAfter validity times; more than two times were provided in the certificate.");if(y.length<2)throw new Error("Cannot read notBefore/notAfter validity times; they were not provided as either UTCTime or GeneralizedTime.");if(l.validity.notBefore=y[0],l.validity.notAfter=y[1],l.tbsCertificate=r.tbsCertificate,t){if(l.md=null,l.signatureOid in s){var f=s[l.signatureOid];switch(f){case"sha1WithRSAEncryption":l.md=n.md.sha1.create();break;case"md5WithRSAEncryption":l.md=n.md.md5.create();break;case"sha256WithRSAEncryption":l.md=n.md.sha256.create();break;case"sha384WithRSAEncryption":l.md=n.md.sha384.create();break;case"sha512WithRSAEncryption":l.md=n.md.sha512.create();break;case"RSASSA-PSS":l.md=n.md.sha256.create()}}if(null===l.md){var u=new Error("Could not compute certificate digest. Unknown signature OID.");throw u.signatureOid=l.signatureOid,u}var g=i.toDer(l.tbsCertificate);l.md.update(g.getBytes())}var b=n.md.sha1.create();l.issuer.getField=function(e){return p(l.issuer,e)},l.issuer.addField=function(e){m([e]),l.issuer.attributes.push(e)},l.issuer.attributes=o.RDNAttributesAsArray(r.certIssuer,b),r.certIssuerUniqueId&&(l.issuer.uniqueId=r.certIssuerUniqueId),l.issuer.hash=b.digest().toHex();var v=n.md.sha1.create();return l.subject.getField=function(e){return p(l.subject,e)},l.subject.addField=function(e){m([e]),l.subject.attributes.push(e)},l.subject.attributes=o.RDNAttributesAsArray(r.certSubject,v),r.certSubjectUniqueId&&(l.subject.uniqueId=r.certSubjectUniqueId),l.subject.hash=v.digest().toHex(),r.certExtensions?l.extensions=o.certificateExtensionsFromAsn1(r.certExtensions):l.extensions=[],l.publicKey=o.publicKeyFromAsn1(r.subjectPublicKeyInfo),l},o.certificateExtensionsFromAsn1=function(e){for(var t=[],r=0;r<e.value.length;++r)for(var n=e.value[r],i=0;i<n.value.length;++i)t.push(o.certificateExtensionFromAsn1(n.value[i]));return t},o.certificateExtensionFromAsn1=function(e){var t={};if(t.id=i.derToOid(e.value[0].value),t.critical=!1,e.value[1].type===i.Type.BOOLEAN?(t.critical=0!==e.value[1].value.charCodeAt(0),t.value=e.value[2].value):t.value=e.value[1].value,t.id in s)if(t.name=s[t.id],"keyUsage"===t.name){var r=i.fromDer(t.value),o=0,a=0;r.value.length>1&&(o=r.value.charCodeAt(1),a=r.value.length>2?r.value.charCodeAt(2):0),t.digitalSignature=128==(128&o),t.nonRepudiation=64==(64&o),t.keyEncipherment=32==(32&o),t.dataEncipherment=16==(16&o),t.keyAgreement=8==(8&o),t.keyCertSign=4==(4&o),t.cRLSign=2==(2&o),t.encipherOnly=1==(1&o),t.decipherOnly=128==(128&a)}else if("basicConstraints"===t.name){var r=i.fromDer(t.value);r.value.length>0&&r.value[0].type===i.Type.BOOLEAN?t.cA=0!==r.value[0].value.charCodeAt(0):t.cA=!1;var u=null;r.value.length>0&&r.value[0].type===i.Type.INTEGER?u=r.value[0].value:r.value.length>1&&(u=r.value[1].value),null!==u&&(t.pathLenConstraint=i.derToInteger(u))}else if("extKeyUsage"===t.name)for(var r=i.fromDer(t.value),c=0;c<r.value.length;++c){var f=i.derToOid(r.value[c].value);f in s?t[s[f]]=!0:t[f]=!0}else if("nsCertType"===t.name){var r=i.fromDer(t.value),o=0;r.value.length>1&&(o=r.value.charCodeAt(1)),t.client=128==(128&o),t.server=64==(64&o),t.email=32==(32&o),t.objsign=16==(16&o),t.reserved=8==(8&o),t.sslCA=4==(4&o),t.emailCA=2==(2&o),t.objCA=1==(1&o)}else if("subjectAltName"===t.name||"issuerAltName"===t.name){var l;t.altNames=[];for(var r=i.fromDer(t.value),h=0;h<r.value.length;++h){l=r.value[h];var p={type:l.type,value:l.value};switch(t.altNames.push(p),l.type){case 1:case 2:case 6:break;case 7:p.ip=n.util.bytesToIP(l.value);break;case 8:p.oid=i.derToOid(l.value)}}}else if("subjectKeyIdentifier"===t.name){var r=i.fromDer(t.value);t.subjectKeyIdentifier=n.util.bytesToHex(r.value)}return t},o.certificationRequestFromAsn1=function(e,t){var r={},a=[];if(!i.validate(e,h,r,a)){var u=new Error("Cannot read PKCS#10 certificate request. ASN.1 object is not a PKCS#10 CertificationRequest.");throw u.errors=a,u}var c=i.derToOid(r.publicKeyOid);if(c!==o.oids.rsaEncryption)throw new Error("Cannot read public key. OID is not RSA.");var f=o.createCertificationRequest();if(f.version=r.csrVersion?r.csrVersion.charCodeAt(0):0,f.signatureOid=n.asn1.derToOid(r.csrSignatureOid),f.signatureParameters=d(f.signatureOid,r.csrSignatureParams,!0),f.siginfo.algorithmOid=n.asn1.derToOid(r.csrSignatureOid),f.siginfo.parameters=d(f.siginfo.algorithmOid,r.csrSignatureParams,!1),f.signature=r.csrSignature,f.certificationRequestInfo=r.certificationRequestInfo,t){if(f.md=null,f.signatureOid in s){var c=s[f.signatureOid];switch(c){case"sha1WithRSAEncryption":f.md=n.md.sha1.create();break;case"md5WithRSAEncryption":f.md=n.md.md5.create();break;case"sha256WithRSAEncryption":f.md=n.md.sha256.create();break;case"sha384WithRSAEncryption":f.md=n.md.sha384.create();break;case"sha512WithRSAEncryption":f.md=n.md.sha512.create();break;case"RSASSA-PSS":f.md=n.md.sha256.create()}}if(null===f.md){var u=new Error("Could not compute certification request digest. Unknown signature OID.");throw u.signatureOid=f.signatureOid,u}var l=i.toDer(f.certificationRequestInfo);f.md.update(l.getBytes())}var y=n.md.sha1.create();return f.subject.getField=function(e){return p(f.subject,e)},f.subject.addField=function(e){m([e]),f.subject.attributes.push(e)},f.subject.attributes=o.RDNAttributesAsArray(r.certificationRequestInfoSubject,y),f.subject.hash=y.digest().toHex(),f.publicKey=o.publicKeyFromAsn1(r.subjectPublicKeyInfo),f.getAttribute=function(e){return p(f,e)},f.addAttribute=function(e){m([e]),f.attributes.push(e)},f.attributes=o.CRIAttributesAsArray(r.certificationRequestInfoAttributes||[]),f},o.createCertificationRequest=function(){var e={version:0,signatureOid:null,signature:null,siginfo:{}};return e.siginfo.algorithmOid=null,e.subject={},e.subject.getField=function(t){return p(e.subject,t)},e.subject.addField=function(t){m([t]),e.subject.attributes.push(t)},e.subject.attributes=[],e.subject.hash=null,e.publicKey=null,e.attributes=[],e.getAttribute=function(t){return p(e,t)},e.addAttribute=function(t){m([t]),e.attributes.push(t)},e.md=null,e.setSubject=function(t){m(t),e.subject.attributes=t,e.subject.hash=null},e.setAttributes=function(t){m(t),e.attributes=t},e.sign=function(t,r){e.md=r||n.md.sha1.create();var a=s[e.md.algorithm+"WithRSAEncryption"];if(!a){var u=new Error("Could not compute certification request digest. Unknown message digest algorithm OID.");throw u.algorithm=e.md.algorithm,u}e.signatureOid=e.siginfo.algorithmOid=a,e.certificationRequestInfo=o.getCertificationRequestInfo(e);var c=i.toDer(e.certificationRequestInfo);e.md.update(c.getBytes()),e.signature=t.sign(e.md)},e.verify=function(){var t=!1,r=e.md;if(null===r){if(e.signatureOid in s){var a=s[e.signatureOid];switch(a){case"sha1WithRSAEncryption":r=n.md.sha1.create();break;case"md5WithRSAEncryption":r=n.md.md5.create();break;case"sha256WithRSAEncryption":r=n.md.sha256.create();break;case"sha384WithRSAEncryption":r=n.md.sha384.create();break;case"sha512WithRSAEncryption":r=n.md.sha512.create();break;case"RSASSA-PSS":r=n.md.sha256.create()}}if(null===r){var u=new Error("Could not compute certification request digest. Unknown signature OID.");throw u.signatureOid=e.signatureOid,u}var c=e.certificationRequestInfo||o.getCertificationRequestInfo(e),f=i.toDer(c);r.update(f.getBytes())}if(null!==r){var l;switch(e.signatureOid){case s.sha1WithRSAEncryption:break;case s["RSASSA-PSS"]:var h,p;if(h=s[e.signatureParameters.mgf.hash.algorithmOid],void 0===h||void 0===n.md[h]){var u=new Error("Unsupported MGF hash function.");throw u.oid=e.signatureParameters.mgf.hash.algorithmOid,u.name=h,u}if(p=s[e.signatureParameters.mgf.algorithmOid],void 0===p||void 0===n.mgf[p]){var u=new Error("Unsupported MGF function.");throw u.oid=e.signatureParameters.mgf.algorithmOid,u.name=p,u}if(p=n.mgf[p].create(n.md[h].create()),h=s[e.signatureParameters.hash.algorithmOid],void 0===h||void 0===n.md[h]){var u=new Error("Unsupported RSASSA-PSS hash function.");throw u.oid=e.signatureParameters.hash.algorithmOid,u.name=h,u}l=n.pss.create(n.md[h].create(),p,e.signatureParameters.saltLength)}t=e.publicKey.verify(r.digest().getBytes(),e.signature,l)}return t},e},o.getTBSCertificate=function(e){var t=i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[i.create(i.Class.CONTEXT_SPECIFIC,0,!0,[i.create(i.Class.UNIVERSAL,i.Type.INTEGER,!1,i.integerToDer(e.version).getBytes())]),i.create(i.Class.UNIVERSAL,i.Type.INTEGER,!1,n.util.hexToBytes(e.serialNumber)),i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[i.create(i.Class.UNIVERSAL,i.Type.OID,!1,i.oidToDer(e.siginfo.algorithmOid).getBytes()),v(e.siginfo.algorithmOid,e.siginfo.parameters)]),y(e.issuer),i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[i.create(i.Class.UNIVERSAL,i.Type.UTCTIME,!1,i.dateToUtcTime(e.validity.notBefore)),i.create(i.Class.UNIVERSAL,i.Type.UTCTIME,!1,i.dateToUtcTime(e.validity.notAfter))]),y(e.subject),o.publicKeyToAsn1(e.publicKey)]);return e.issuer.uniqueId&&t.value.push(i.create(i.Class.CONTEXT_SPECIFIC,1,!0,[i.create(i.Class.UNIVERSAL,i.Type.BITSTRING,!1,String.fromCharCode(0)+e.issuer.uniqueId)])),e.subject.uniqueId&&t.value.push(i.create(i.Class.CONTEXT_SPECIFIC,2,!0,[i.create(i.Class.UNIVERSAL,i.Type.BITSTRING,!1,String.fromCharCode(0)+e.subject.uniqueId)])),e.extensions.length>0&&t.value.push(o.certificateExtensionsToAsn1(e.extensions)),t},o.getCertificationRequestInfo=function(e){var t=i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[i.create(i.Class.UNIVERSAL,i.Type.INTEGER,!1,i.integerToDer(e.version).getBytes()),y(e.subject),o.publicKeyToAsn1(e.publicKey),_(e)]);return t},o.distinguishedNameToAsn1=function(e){return y(e)},o.certificateToAsn1=function(e){var t=e.tbsCertificate||o.getTBSCertificate(e);return i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[t,i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[i.create(i.Class.UNIVERSAL,i.Type.OID,!1,i.oidToDer(e.signatureOid).getBytes()),v(e.signatureOid,e.signatureParameters)]),i.create(i.Class.UNIVERSAL,i.Type.BITSTRING,!1,String.fromCharCode(0)+e.signature)])},o.certificateExtensionsToAsn1=function(e){var t=i.create(i.Class.CONTEXT_SPECIFIC,3,!0,[]),r=i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[]);t.value.push(r);for(var n=0;n<e.length;++n)r.value.push(o.certificateExtensionToAsn1(e[n]));return t},o.certificateExtensionToAsn1=function(e){var t=i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[]);t.value.push(i.create(i.Class.UNIVERSAL,i.Type.OID,!1,i.oidToDer(e.id).getBytes())),e.critical&&t.value.push(i.create(i.Class.UNIVERSAL,i.Type.BOOLEAN,!1,String.fromCharCode(255)));var r=e.value;return"string"!=typeof e.value&&(r=i.toDer(r).getBytes()),t.value.push(i.create(i.Class.UNIVERSAL,i.Type.OCTETSTRING,!1,r)),t},o.certificationRequestToAsn1=function(e){var t=e.certificationRequestInfo||o.getCertificationRequestInfo(e);return i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[t,i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[i.create(i.Class.UNIVERSAL,i.Type.OID,!1,i.oidToDer(e.signatureOid).getBytes()),v(e.signatureOid,e.signatureParameters)]),i.create(i.Class.UNIVERSAL,i.Type.BITSTRING,!1,String.fromCharCode(0)+e.signature)])},o.createCaStore=function(e){var t={certs:{}};function r(e){return s(e),t.certs[e.hash]||null}function s(e){if(!e.hash){var t=n.md.sha1.create();e.attributes=o.RDNAttributesAsArray(y(e),t),e.hash=t.digest().toHex()}}if(t.getIssuer=function(e){var t=r(e.issuer);return t},t.addCertificate=function(e){if("string"==typeof e&&(e=n.pki.certificateFromPem(e)),s(e.subject),!t.hasCertificate(e))if(e.subject.hash in t.certs){var r=t.certs[e.subject.hash];n.util.isArray(r)||(r=[r]),r.push(e),t.certs[e.subject.hash]=r}else t.certs[e.subject.hash]=e},t.hasCertificate=function(e){"string"==typeof e&&(e=n.pki.certificateFromPem(e));var t=r(e.subject);if(!t)return!1;n.util.isArray(t)||(t=[t]);for(var s=i.toDer(o.certificateToAsn1(e)).getBytes(),a=0;a<t.length;++a){var u=i.toDer(o.certificateToAsn1(t[a])).getBytes();if(s===u)return!0}return!1},t.listAllCertificates=function(){var e=[];for(var r in t.certs)if(t.certs.hasOwnProperty(r)){var i=t.certs[r];if(n.util.isArray(i))for(var o=0;o<i.length;++o)e.push(i[o]);else e.push(i)}return e},t.removeCertificate=function(e){var a;if("string"==typeof e&&(e=n.pki.certificateFromPem(e)),s(e.subject),!t.hasCertificate(e))return null;var u=r(e.subject);if(!n.util.isArray(u))return a=t.certs[e.subject.hash],delete t.certs[e.subject.hash],a;for(var c=i.toDer(o.certificateToAsn1(e)).getBytes(),f=0;f<u.length;++f){var l=i.toDer(o.certificateToAsn1(u[f])).getBytes();c===l&&(a=u[f],u.splice(f,1))}return 0===u.length&&delete t.certs[e.subject.hash],a},e)for(var a=0;a<e.length;++a){var u=e[a];t.addCertificate(u)}return t},o.certificateError={bad_certificate:"forge.pki.BadCertificate",unsupported_certificate:"forge.pki.UnsupportedCertificate",certificate_revoked:"forge.pki.CertificateRevoked",certificate_expired:"forge.pki.CertificateExpired",certificate_unknown:"forge.pki.CertificateUnknown",unknown_ca:"forge.pki.UnknownCertificateAuthority"},o.verifyCertificateChain=function(e,t,r){t=t.slice(0);var i=t.slice(0),s=new Date,a=!0,u=null,c=0;do{var f=t.shift(),l=null,h=!1;if((s<f.validity.notBefore||s>f.validity.notAfter)&&(u={message:"Certificate is not valid yet or has expired.",error:o.certificateError.certificate_expired,notBefore:f.validity.notBefore,notAfter:f.validity.notAfter,now:s}),null===u){if(l=t[0]||e.getIssuer(f),null===l&&f.isIssuer(f)&&(h=!0,l=f),l){var p=l;n.util.isArray(p)||(p=[p]);for(var d=!1;!d&&p.length>0;){l=p.shift();try{d=l.verify(f)}catch(e){}}d||(u={message:"Certificate signature is invalid.",error:o.certificateError.bad_certificate})}null!==u||l&&!h||e.hasCertificate(f)||(u={message:"Certificate is not trusted.",error:o.certificateError.unknown_ca})}if(null===u&&l&&!f.isIssuer(l)&&(u={message:"Certificate issuer is invalid.",error:o.certificateError.bad_certificate}),null===u)for(var y={keyUsage:!0,basicConstraints:!0},g=0;null===u&&g<f.extensions.length;++g){var m=f.extensions[g];!m.critical||m.name in y||(u={message:"Certificate has an unsupported critical extension.",error:o.certificateError.unsupported_certificate})}if(null===u&&(!a||0===t.length&&(!l||h))){var b=f.getExtension("basicConstraints"),v=f.getExtension("keyUsage");if(null!==v&&(v.keyCertSign&&null!==b||(u={message:"Certificate keyUsage or basicConstraints conflict or indicate that the certificate is not a CA. If the certificate is the only one in the chain or isn't the first then the certificate must be a valid CA.",error:o.certificateError.bad_certificate})),null!==u||null===b||b.cA||(u={message:"Certificate basicConstraints indicates the certificate is not a CA.",error:o.certificateError.bad_certificate}),null===u&&null!==v&&"pathLenConstraint"in b){var _=c-1;_>b.pathLenConstraint&&(u={message:"Certificate basicConstraints pathLenConstraint violated.",error:o.certificateError.bad_certificate})}}var w=null===u||u.error,S=r?r(w,c,i):w;if(!0!==S)throw!0===w&&(u={message:"The application rejected the certificate.",error:o.certificateError.bad_certificate}),(S||0===S)&&("object"!=typeof S||n.util.isArray(S)?"string"==typeof S&&(u.error=S):(S.message&&(u.message=S.message),S.error&&(u.error=S.error))),u;u=null,a=!1,++c}while(t.length>0);return!0}},function(e,t,r){var n=r(11);r(63),r(16);var i=e.exports=n.pss=n.pss||{};i.create=function(e){3===arguments.length&&(e={md:arguments[0],mgf:arguments[1],saltLength:arguments[2]});var t=e.md,r=e.mgf,i=t.digestLength,o=e.salt||null,s;if("string"==typeof o&&(o=n.util.createBuffer(o)),"saltLength"in e)s=e.saltLength;else{if(null===o)throw new Error("Salt length not specified or specific salt not given.");s=o.length()}if(null!==o&&o.length()!==s)throw new Error("Given salt length does not match length of given salt.");var a=e.prng||n.random,u={encode:function(e,u){var c,f=u-1,l=Math.ceil(f/8),h=e.digest().getBytes(),p;if(l<i+s+2)throw new Error("Message is too long to encrypt.");p=null===o?a.getBytesSync(s):o.bytes();var d=new n.util.ByteBuffer;d.fillWithByte(0,8),d.putBytes(h),d.putBytes(p),t.start(),t.update(d.getBytes());var y=t.digest().getBytes(),g=new n.util.ByteBuffer;g.fillWithByte(0,l-s-i-2),g.putByte(1),g.putBytes(p);var m=g.getBytes(),b=l-i-1,v=r.generate(y,b),_="";for(c=0;c<b;c++)_+=String.fromCharCode(m.charCodeAt(c)^v.charCodeAt(c));var w=65280>>8*l-f&255;return _=String.fromCharCode(_.charCodeAt(0)&~w)+_.substr(1),_+y+String.fromCharCode(188)},verify:function(e,o,a){var u,c=a-1,f=Math.ceil(c/8);if(o=o.substr(-f),f<i+s+2)throw new Error("Inconsistent parameters to PSS signature verification.");if(188!==o.charCodeAt(f-1))throw new Error("Encoded message does not end in 0xBC.");var l=f-i-1,h=o.substr(0,l),p=o.substr(l,i),d=65280>>8*f-c&255;if(0!=(h.charCodeAt(0)&d))throw new Error("Bits beyond keysize not zero as expected.");var y=r.generate(p,l),g="";for(u=0;u<l;u++)g+=String.fromCharCode(h.charCodeAt(u)^y.charCodeAt(u));g=String.fromCharCode(g.charCodeAt(0)&~d)+g.substr(1);var m=f-i-s-2;for(u=0;u<m;u++)if(0!==g.charCodeAt(u))throw new Error("Leftmost octets not zero as expected");if(1!==g.charCodeAt(m))throw new Error("Inconsistent PSS signature, 0x01 marker not found");var b=g.substr(-s),v=new n.util.ByteBuffer;v.fillWithByte(0,8),v.putBytes(e),v.putBytes(b),t.start(),t.update(v.getBytes());var _=t.digest().getBytes();return p===_}};return u}},function(e,t){var r=[].indexOf;e.exports=function(e,t){if(r)return e.indexOf(t);for(var n=0;n<e.length;++n)if(e[n]===t)return n;return-1}},function(e,t,r){"use strict";e.exports=function e(t,r){return t.then(e=>{r(null,e)},e=>{r(e)})}},function(e,t,r){"use strict";e.exports=(()=>{if("undefined"!=typeof self&&(r(69)(self),self.crypto))return self.crypto;throw new Error("Please use an environment with crypto support")})},function(e,t,r){"use strict";e.exports="enum KeyType {\n RSA = 0;\n Ed25519 = 1;\n Secp256k1 = 2;\n}\nmessage PublicKey {\n required KeyType Type = 1;\n required bytes Data = 2;\n}\nmessage PrivateKey {\n required KeyType Type = 1;\n required bytes Data = 2;\n}"},function(e,t,r){(function(e,r){var n=200,i="Expected a function",o="__lodash_hash_undefined__",s=1,a=2,u=1/0,c=9007199254740991,f="[object Arguments]",l="[object Array]",h="[object Boolean]",p="[object Date]",d="[object Error]",y="[object Function]",g="[object GeneratorFunction]",m="[object Map]",b="[object Number]",v="[object Object]",_="[object Promise]",w="[object RegExp]",S="[object Set]",k="[object String]",E="[object Symbol]",A="[object WeakMap]",x="[object ArrayBuffer]",I="[object DataView]",T="[object Float32Array]",B="[object Float64Array]",C="[object Int8Array]",P="[object Int16Array]",O="[object Int32Array]",R="[object Uint8Array]",N="[object Uint8ClampedArray]",L="[object Uint16Array]",j="[object Uint32Array]",M=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,K=/^\w*$/,D=/^\./,U=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,F=/[\\^$.*+?()[\]{}|]/g,q=/\\(\\)?/g,H=/^\[object .+?Constructor\]$/,z=/^(?:0|[1-9]\d*)$/,V={};V[T]=V[B]=V[C]=V[P]=V[O]=V[R]=V[N]=V[L]=V[j]=!0,V[f]=V[l]=V[x]=V[h]=V[I]=V[p]=V[d]=V[y]=V[m]=V[b]=V[v]=V[w]=V[S]=V[k]=V[A]=!1;var G="object"==typeof e&&e&&e.Object===Object&&e,W="object"==typeof self&&self&&self.Object===Object&&self,$=G||W||Function("return this")(),Y="object"==typeof t&&t&&!t.nodeType&&t,J=Y&&"object"==typeof r&&r&&!r.nodeType&&r,X=J&&J.exports===Y,Z=X&&G.process,Q=function(){try{return Z&&Z.binding("util")}catch(e){}}(),ee=Q&&Q.isTypedArray;function te(e,t){for(var r=-1,n=e?e.length:0,i=0,o=[];++r<n;){var s=e[r];t(s,r,e)&&(o[i++]=s)}return o}function re(e,t){for(var r=-1,n=e?e.length:0;++r<n;)if(t(e[r],r,e))return!0;return!1}function ne(e){return function(t){return null==t?void 0:t[e]}}function ie(e,t){for(var r=-1,n=Array(e);++r<e;)n[r]=t(r);return n}function oe(e){return function(t){return e(t)}}function se(e,t){return null==e?void 0:e[t]}function ae(e){var t=!1;if(null!=e&&"function"!=typeof e.toString)try{t=!!(e+"")}catch(e){}return t}function ue(e){var t=-1,r=Array(e.size);return e.forEach(function(e,n){r[++t]=[n,e]}),r}function ce(e,t){return function(r){return e(t(r))}}function fe(e){var t=-1,r=Array(e.size);return e.forEach(function(e){r[++t]=e}),r}var le=Array.prototype,he=Function.prototype,pe=Object.prototype,de=$["__core-js_shared__"],ye=(ge=/[^.]+$/.exec(de&&de.keys&&de.keys.IE_PROTO||""),ge?"Symbol(src)_1."+ge:""),ge,me=he.toString,be=pe.hasOwnProperty,ve=pe.toString,_e=RegExp("^"+me.call(be).replace(F,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),we=$.Symbol,Se=$.Uint8Array,ke=pe.propertyIsEnumerable,Ee=le.splice,Ae=ce(Object.keys,Object),xe=Ft($,"DataView"),Ie=Ft($,"Map"),Te=Ft($,"Promise"),Be=Ft($,"Set"),Ce=Ft($,"WeakMap"),Pe=Ft(Object,"create"),Oe=Qt(xe),Re=Qt(Ie),Ne=Qt(Te),Le=Qt(Be),je=Qt(Ce),Me=we?we.prototype:void 0,Ke=Me?Me.valueOf:void 0,De=Me?Me.toString:void 0;function Ue(e){var t=-1,r=e?e.length:0;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}function Fe(){this.__data__=Pe?Pe(null):{}}function qe(e){return this.has(e)&&delete this.__data__[e]}function He(e){var t=this.__data__;if(Pe){var r=t[e];return r===o?void 0:r}return be.call(t,e)?t[e]:void 0}function ze(e){var t=this.__data__;return Pe?void 0!==t[e]:be.call(t,e)}function Ve(e,t){var r=this.__data__;return r[e]=Pe&&void 0===t?o:t,this}function Ge(e){var t=-1,r=e?e.length:0;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}function We(){this.__data__=[]}function $e(e){var t=this.__data__,r=dt(t,e);if(r<0)return!1;var n=t.length-1;return r==n?t.pop():Ee.call(t,r,1),!0}function Ye(e){var t=this.__data__,r=dt(t,e);return r<0?void 0:t[r][1]}function Je(e){return dt(this.__data__,e)>-1}function Xe(e,t){var r=this.__data__,n=dt(r,e);return n<0?r.push([e,t]):r[n][1]=t,this}function Ze(e){var t=-1,r=e?e.length:0;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}function Qe(){this.__data__={hash:new Ue,map:new(Ie||Ge),string:new Ue}}function et(e){return Dt(this,e).delete(e)}function tt(e){return Dt(this,e).get(e)}function rt(e){return Dt(this,e).has(e)}function nt(e,t){return Dt(this,e).set(e,t),this}function it(e){var t=-1,r=e?e.length:0;for(this.__data__=new Ze;++t<r;)this.add(e[t])}function ot(e){return this.__data__.set(e,o),this}function st(e){return this.__data__.has(e)}function at(e){this.__data__=new Ge(e)}function ut(){this.__data__=new Ge}function ct(e){return this.__data__.delete(e)}function ft(e){return this.__data__.get(e)}function lt(e){return this.__data__.has(e)}function ht(e,t){var r=this.__data__;if(r instanceof Ge){var i=r.__data__;if(!Ie||i.length<n-1)return i.push([e,t]),this;r=this.__data__=new Ze(i)}return r.set(e,t),this}function pt(e,t){var r=ir(e)||nr(e)?ie(e.length,String):[],n=r.length,i=!!n;for(var o in e)!t&&!be.call(e,o)||i&&("length"==o||zt(o,n))||r.push(o);return r}function dt(e,t){for(var r=e.length;r--;)if(rr(e[r][0],t))return r;return-1}Ue.prototype.clear=Fe,Ue.prototype.delete=qe,Ue.prototype.get=He,Ue.prototype.has=ze,Ue.prototype.set=Ve,Ge.prototype.clear=We,Ge.prototype.delete=$e,Ge.prototype.get=Ye,Ge.prototype.has=Je,Ge.prototype.set=Xe,Ze.prototype.clear=Qe,Ze.prototype.delete=et,Ze.prototype.get=tt,Ze.prototype.has=rt,Ze.prototype.set=nt,it.prototype.add=it.prototype.push=ot,it.prototype.has=st,at.prototype.clear=ut,at.prototype.delete=ct,at.prototype.get=ft,at.prototype.has=lt,at.prototype.set=ht;var yt=Nt(bt);function gt(e,t){var r=[];return yt(e,function(e,n,i){t(e,n,i)&&r.push(e)}),r}var mt=Lt();function bt(e,t){return e&&mt(e,t,gr)}function vt(e,t){t=Vt(t,e)?[t]:Rt(t);for(var r=0,n=t.length;null!=e&&r<n;)e=e[Zt(t[r++])];return r&&r==n?e:void 0}function _t(e){return ve.call(e)}function wt(e,t){return null!=e&&t in Object(e)}function St(e,t,r,n,i){return e===t||(null==e||null==t||!cr(e)&&!fr(t)?e!=e&&t!=t:kt(e,t,St,r,n,i))}function kt(e,t,r,n,i,o){var s=ir(e),u=ir(t),c=l,h=l;s||(c=qt(e),c=c==f?v:c),u||(h=qt(t),h=h==f?v:h);var p=c==v&&!ae(e),d=h==v&&!ae(t),y=c==h;if(y&&!p)return o||(o=new at),s||hr(e)?jt(e,t,r,n,i,o):Mt(e,t,c,r,n,i,o);if(!(i&a)){var g=p&&be.call(e,"__wrapped__"),m=d&&be.call(t,"__wrapped__");if(g||m){var b=g?e.value():e,_=m?t.value():t;return o||(o=new at),r(b,_,n,i,o)}}return!!y&&(o||(o=new at),Kt(e,t,r,n,i,o))}function Et(e,t,r,n){var i=r.length,o=i,u=!n;if(null==e)return!o;for(e=Object(e);i--;){var c=r[i];if(u&&c[2]?c[1]!==e[c[0]]:!(c[0]in e))return!1}for(;++i<o;){c=r[i];var f=c[0],l=e[f],h=c[1];if(u&&c[2]){if(void 0===l&&!(f in e))return!1}else{var p=new at;if(n)var d=n(l,h,f,e,t,p);if(!(void 0===d?St(h,l,n,s|a,p):d))return!1}}return!0}function At(e){if(!cr(e)||Wt(e))return!1;var t=ar(e)||ae(e)?_e:H;return t.test(Qt(e))}function xt(e){return fr(e)&&ur(e.length)&&!!V[ve.call(e)]}function It(e){return"function"==typeof e?e:null==e?mr:"object"==typeof e?ir(e)?Ct(e[0],e[1]):Bt(e):br(e)}function Tt(e){if(!$t(e))return Ae(e);var t=[];for(var r in Object(e))be.call(e,r)&&"constructor"!=r&&t.push(r);return t}function Bt(e){var t=Ut(e);return 1==t.length&&t[0][2]?Jt(t[0][0],t[0][1]):function(r){return r===e||Et(r,e,t)}}function Ct(e,t){return Vt(e)&&Yt(t)?Jt(Zt(e),t):function(r){var n=dr(r,e);return void 0===n&&n===t?yr(r,e):St(t,n,void 0,s|a)}}function Pt(e){return function(t){return vt(t,e)}}function Ot(e){if("string"==typeof e)return e;if(lr(e))return De?De.call(e):"";var t=e+"";return"0"==t&&1/e==-u?"-0":t}function Rt(e){return ir(e)?e:Xt(e)}function Nt(e,t){return function(r,n){if(null==r)return r;if(!or(r))return e(r,n);for(var i=r.length,o=t?i:-1,s=Object(r);(t?o--:++o<i)&&!1!==n(s[o],o,s););return r}}function Lt(e){return function(t,r,n){for(var i=-1,o=Object(t),s=n(t),a=s.length;a--;){var u=s[e?a:++i];if(!1===r(o[u],u,o))break}return t}}function jt(e,t,r,n,i,o){var u=i&a,c=e.length,f=t.length;if(c!=f&&!(u&&f>c))return!1;var l=o.get(e);if(l&&o.get(t))return l==t;var h=-1,p=!0,d=i&s?new it:void 0;for(o.set(e,t),o.set(t,e);++h<c;){var y=e[h],g=t[h];if(n)var m=u?n(g,y,h,t,e,o):n(y,g,h,e,t,o);if(void 0!==m){if(m)continue;p=!1;break}if(d){if(!re(t,function(e,t){if(!d.has(t)&&(y===e||r(y,e,n,i,o)))return d.add(t)})){p=!1;break}}else if(y!==g&&!r(y,g,n,i,o)){p=!1;break}}return o.delete(e),o.delete(t),p}function Mt(e,t,r,n,i,o,u){switch(r){case I:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case x:return!(e.byteLength!=t.byteLength||!n(new Se(e),new Se(t)));case h:case p:case b:return rr(+e,+t);case d:return e.name==t.name&&e.message==t.message;case w:case k:return e==t+"";case m:var c=ue;case S:var f=o&a;if(c||(c=fe),e.size!=t.size&&!f)return!1;var l=u.get(e);if(l)return l==t;o|=s,u.set(e,t);var y=jt(c(e),c(t),n,i,o,u);return u.delete(e),y;case E:if(Ke)return Ke.call(e)==Ke.call(t)}return!1}function Kt(e,t,r,n,i,o){var s=i&a,u=gr(e),c=u.length,f=gr(t),l=f.length;if(c!=l&&!s)return!1;for(var h=c;h--;){var p=u[h];if(!(s?p in t:be.call(t,p)))return!1}var d=o.get(e);if(d&&o.get(t))return d==t;var y=!0;o.set(e,t),o.set(t,e);for(var g=s;++h<c;){p=u[h];var m=e[p],b=t[p];if(n)var v=s?n(b,m,p,t,e,o):n(m,b,p,e,t,o);if(!(void 0===v?m===b||r(m,b,n,i,o):v)){y=!1;break}g||(g="constructor"==p)}if(y&&!g){var _=e.constructor,w=t.constructor;_!=w&&"constructor"in e&&"constructor"in t&&!("function"==typeof _&&_ instanceof _&&"function"==typeof w&&w instanceof w)&&(y=!1)}return o.delete(e),o.delete(t),y}function Dt(e,t){var r=e.__data__;return Gt(t)?r["string"==typeof t?"string":"hash"]:r.map}function Ut(e){for(var t=gr(e),r=t.length;r--;){var n=t[r],i=e[n];t[r]=[n,i,Yt(i)]}return t}function Ft(e,t){var r=se(e,t);return At(r)?r:void 0}var qt=_t;function Ht(e,t,r){t=Vt(t,e)?[t]:Rt(t);for(var n,i=-1,o=t.length;++i<o;){var s=Zt(t[i]);if(!(n=null!=e&&r(e,s)))break;e=e[s]}if(n)return n;var o=e?e.length:0;return!!o&&ur(o)&&zt(s,o)&&(ir(e)||nr(e))}function zt(e,t){return t=null==t?c:t,!!t&&("number"==typeof e||z.test(e))&&e>-1&&e%1==0&&e<t}function Vt(e,t){if(ir(e))return!1;var r=typeof e;return!("number"!=r&&"symbol"!=r&&"boolean"!=r&&null!=e&&!lr(e))||(K.test(e)||!M.test(e)||null!=t&&e in Object(t))}function Gt(e){var t=typeof e;return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e}function Wt(e){return!!ye&&ye in e}function $t(e){var t=e&&e.constructor,r="function"==typeof t&&t.prototype||pe;return e===r}function Yt(e){return e==e&&!cr(e)}function Jt(e,t){return function(r){return null!=r&&(r[e]===t&&(void 0!==t||e in Object(r)))}}(xe&&qt(new xe(new ArrayBuffer(1)))!=I||Ie&&qt(new Ie)!=m||Te&&qt(Te.resolve())!=_||Be&&qt(new Be)!=S||Ce&&qt(new Ce)!=A)&&(qt=function(e){var t=ve.call(e),r=t==v?e.constructor:void 0,n=r?Qt(r):void 0;if(n)switch(n){case Oe:return I;case Re:return m;case Ne:return _;case Le:return S;case je:return A}return t});var Xt=tr(function(e){e=pr(e);var t=[];return D.test(e)&&t.push(""),e.replace(U,function(e,r,n,i){t.push(n?i.replace(q,"$1"):r||e)}),t});function Zt(e){if("string"==typeof e||lr(e))return e;var t=e+"";return"0"==t&&1/e==-u?"-0":t}function Qt(e){if(null!=e){try{return me.call(e)}catch(e){}try{return e+""}catch(e){}}return""}function er(e,t){var r=ir(e)?te:gt;return r(e,It(t,3))}function tr(e,t){if("function"!=typeof e||t&&"function"!=typeof t)throw new TypeError(i);var r=function(){var n=arguments,i=t?t.apply(this,n):n[0],o=r.cache;if(o.has(i))return o.get(i);var s=e.apply(this,n);return r.cache=o.set(i,s),s};return r.cache=new(tr.Cache||Ze),r}function rr(e,t){return e===t||e!=e&&t!=t}function nr(e){return sr(e)&&be.call(e,"callee")&&(!ke.call(e,"callee")||ve.call(e)==f)}tr.Cache=Ze;var ir=Array.isArray;function or(e){return null!=e&&ur(e.length)&&!ar(e)}function sr(e){return fr(e)&&or(e)}function ar(e){var t=cr(e)?ve.call(e):"";return t==y||t==g}function ur(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=c}function cr(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function fr(e){return!!e&&"object"==typeof e}function lr(e){return"symbol"==typeof e||fr(e)&&ve.call(e)==E}var hr=ee?oe(ee):xt;function pr(e){return null==e?"":Ot(e)}function dr(e,t,r){var n=null==e?void 0:vt(e,t);return void 0===n?r:n}function yr(e,t){return null!=e&&Ht(e,t,wt)}function gr(e){return or(e)?pt(e):Tt(e)}function mr(e){return e}function br(e){return Vt(e)?ne(Zt(e)):Pt(e)}r.exports=er}).call(this,r(7),r(28)(e))},function(e,t,r){"use strict";var n=t,i=r(0).Buffer,o=r(356);n.toBuffer=function(e,t,r){var n;if(r=~~r,this.isV4Format(e))n=t||new i(r+4),e.split(/\./g).map(function(e){n[r++]=255&parseInt(e,10)});else if(this.isV6Format(e)){var o=e.split(":",8),s;for(s=0;s<o.length;s++){var a=this.isV4Format(o[s]),u;a&&(u=this.toBuffer(o[s]),o[s]=u.slice(0,2).toString("hex")),u&&++s<8&&o.splice(s,0,u.slice(2,4).toString("hex"))}if(""===o[0])for(;o.length<8;)o.unshift("0");else if(""===o[o.length-1])for(;o.length<8;)o.push("0");else if(o.length<8){for(s=0;s<o.length&&""!==o[s];s++);var c=[s,1];for(s=9-o.length;s>0;s--)c.push("0");o.splice.apply(o,c)}for(n=t||new i(r+16),s=0;s<o.length;s++){var f=parseInt(o[s],16);n[r++]=f>>8&255,n[r++]=255&f}}if(!n)throw Error("Invalid ip address: "+e);return n},n.toString=function(e,t,r){t=~~t,r=r||e.length-t;var n=[];if(4===r){for(var i=0;i<r;i++)n.push(e[t+i]);n=n.join(".")}else if(16===r){for(var i=0;i<r;i+=2)n.push(e.readUInt16BE(t+i).toString(16));n=n.join(":"),n=n.replace(/(^|:)0(:0)*:0(:|$)/,"$1::$3"),n=n.replace(/:{3,4}/,"::")}return n};var s=/^(\d{1,3}\.){3,3}\d{1,3}$/,a=/^(::)?(((\d{1,3}\.){3}(\d{1,3}){1})?([0-9a-f]){0,4}:{0,2}){1,8}(::)?$/i;function u(e){return e?e.toLowerCase():"ipv4"}n.isV4Format=function(e){return s.test(e)},n.isV6Format=function(e){return a.test(e)},n.fromPrefixLen=function(e,t){t=e>32?"ipv6":u(t);var r=4;"ipv6"===t&&(r=16);for(var o=new i(r),s=0,a=o.length;s<a;++s){var c=8;e<8&&(c=e),e-=c,o[s]=255&~(255>>c)}return n.toString(o)},n.mask=function(e,t){e=n.toBuffer(e),t=n.toBuffer(t);var r=new i(Math.max(e.length,t.length)),o=0;if(e.length===t.length)for(o=0;o<e.length;o++)r[o]=e[o]&t[o];else if(4===t.length)for(o=0;o<t.length;o++)r[o]=e[e.length-4+o]&t[o];else{for(var o=0;o<r.length-6;o++)r[o]=0;for(r[10]=255,r[11]=255,o=0;o<e.length;o++)r[o+12]=e[o]&t[o+12];o+=12}for(;o<r.length;o++)r[o]=0;return n.toString(r)},n.cidr=function(e){var t=e.split("/"),r=t[0];if(2!==t.length)throw new Error("invalid CIDR subnet: "+r);var i=n.fromPrefixLen(parseInt(t[1],10));return n.mask(r,i)},n.subnet=function(e,t){for(var r=n.toLong(n.mask(e,t)),i=n.toBuffer(t),o=0,s=0;s<i.length;s++)if(255===i[s])o+=8;else for(var a=255&i[s];a;)a=a<<1&255,o++;var u=Math.pow(2,32-o);return{networkAddress:n.fromLong(r),firstAddress:u<=2?n.fromLong(r):n.fromLong(r+1),lastAddress:u<=2?n.fromLong(r+u-1):n.fromLong(r+u-2),broadcastAddress:n.fromLong(r+u-1),subnetMask:t,subnetMaskLength:o,numHosts:u<=2?u:u-2,length:u,contains:function(e){return r===n.toLong(n.mask(e,t))}}},n.cidrSubnet=function(e){var t=e.split("/"),r=t[0];if(2!==t.length)throw new Error("invalid CIDR subnet: "+r);var i=n.fromPrefixLen(parseInt(t[1],10));return n.subnet(r,i)},n.not=function(e){for(var t=n.toBuffer(e),r=0;r<t.length;r++)t[r]=255^t[r];return n.toString(t)},n.or=function(e,t){if(e=n.toBuffer(e),t=n.toBuffer(t),e.length===t.length){for(var r=0;r<e.length;++r)e[r]|=t[r];return n.toString(e)}var i=e,o=t;t.length>e.length&&(i=t,o=e);for(var s=i.length-o.length,r=s;r<i.length;++r)i[r]|=o[r-s];return n.toString(i)},n.isEqual=function(e,t){if(e=n.toBuffer(e),t=n.toBuffer(t),e.length===t.length){for(var r=0;r<e.length;r++)if(e[r]!==t[r])return!1;return!0}if(4===t.length){var i=t;t=e,e=i}for(var r=0;r<10;r++)if(0!==t[r])return!1;var o=t.readUInt16BE(10);if(0!==o&&65535!==o)return!1;for(var r=0;r<4;r++)if(e[r]!==t[r+12])return!1;return!0},n.isPrivate=function(e){return/^(::f{4}:)?10\.([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})$/i.test(e)||/^(::f{4}:)?192\.168\.([0-9]{1,3})\.([0-9]{1,3})$/i.test(e)||/^(::f{4}:)?172\.(1[6-9]|2\d|30|31)\.([0-9]{1,3})\.([0-9]{1,3})$/i.test(e)||/^(::f{4}:)?127\.([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})$/i.test(e)||/^(::f{4}:)?169\.254\.([0-9]{1,3})\.([0-9]{1,3})$/i.test(e)||/^f[cd][0-9a-f]{2}:/i.test(e)||/^fe80:/i.test(e)||/^::1$/.test(e)||/^::$/.test(e)},n.isPublic=function(e){return!n.isPrivate(e)},n.isLoopback=function(e){return/^(::f{4}:)?127\.([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})/.test(e)||/^fe80::1$/.test(e)||/^::1$/.test(e)||/^::$/.test(e)},n.loopback=function(e){if(e=u(e),"ipv4"!==e&&"ipv6"!==e)throw new Error("family must be ipv4 or ipv6");return"ipv4"===e?"127.0.0.1":"fe80::1"},n.address=function(e,t){var r=o.networkInterfaces(),i;if(t=u(t),e&&"private"!==e&&"public"!==e){var s=r[e].filter(function(e){var r=e.family.toLowerCase();return r===t});if(0===s.length)return;return s[0].address}var i=Object.keys(r).map(function(i){var o=r[i].filter(function(r){return r.family=r.family.toLowerCase(),r.family===t&&!n.isLoopback(r.address)&&(!e||("public"===e?n.isPrivate(r.address):n.isPublic(r.address)))});return o.length?o[0].address:void 0}).filter(Boolean);return i.length?i[0]:n.loopback(t)},n.toLong=function(e){var t=0;return e.split(".").forEach(function(e){t<<=8,t+=parseInt(e)}),t>>>0},n.fromLong=function(e){return(e>>>24)+"."+(e>>16&255)+"."+(e>>8&255)+"."+(255&e)}},function(e,t,r){"use strict";t.Address4=r(474),t.Address6=r(956),t.v6={helpers:r(480)}},function(e,t){t.BITS=32,t.GROUPS=4,t.RE_ADDRESS=/^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/g,t.RE_SUBNET_STRING=/\/\d{1,2}$/},function(e,t){t.BITS=128,t.GROUPS=8,t.SCOPES={0:"Reserved",1:"Interface local",2:"Link local",4:"Admin local",5:"Site local",8:"Organization local",14:"Global",15:"Reserved"},t.TYPES={"ff01::1/128":"Multicast (All nodes on this interface)","ff01::2/128":"Multicast (All routers on this interface)","ff02::1/128":"Multicast (All nodes on this link)","ff02::2/128":"Multicast (All routers on this link)","ff05::2/128":"Multicast (All routers in this site)","ff02::5/128":"Multicast (OSPFv3 AllSPF routers)","ff02::6/128":"Multicast (OSPFv3 AllDR routers)","ff02::9/128":"Multicast (RIP routers)","ff02::a/128":"Multicast (EIGRP routers)","ff02::d/128":"Multicast (PIM routers)","ff02::16/128":"Multicast (MLDv2 reports)","ff01::fb/128":"Multicast (mDNSv6)","ff02::fb/128":"Multicast (mDNSv6)","ff05::fb/128":"Multicast (mDNSv6)","ff02::1:2/128":"Multicast (All DHCP servers and relay agents on this link)","ff05::1:2/128":"Multicast (All DHCP servers and relay agents in this site)","ff02::1:3/128":"Multicast (All DHCP servers on this link)","ff05::1:3/128":"Multicast (All DHCP servers in this site)","::/128":"Unspecified","::1/128":"Loopback","ff00::/8":"Multicast","fe80::/10":"Link-local unicast"},t.RE_BAD_CHARACTERS=/([^0-9a-f:\/%])/gi,t.RE_BAD_ADDRESS=/([0-9a-f]{5,}|:{3,}|[^:]:$|^:[^:]|\/$)/gi,t.RE_SUBNET_STRING=/\/\d{1,3}(?=%|$)/,t.RE_ZONE_STRING=/%.*$/,t.RE_URL=new RegExp(/^\[{0,1}([0-9a-f:]+)\]{0,1}/),t.RE_URL_WITH_PORT=new RegExp(/\[([0-9a-f:]+)\]:([0-9]{1,5})/)},function(e,t,r){"use strict";const n=r(79);function i(e){if("number"==typeof e){if(i.codes[e])return i.codes[e];throw new Error("no protocol with code: "+e)}if("string"==typeof e||e instanceof String){if(i.names[e])return i.names[e];throw new Error("no protocol with name: "+e)}throw new Error("invalid protocol id type: "+e)}const o=-1;function s(e,t,r,n){return{code:e,size:t,name:r,resolvable:Boolean(n)}}i.lengthPrefixedVarSize=o,i.V=o,i.table=[[4,32,"ip4"],[6,16,"tcp"],[17,16,"udp"],[33,16,"dccp"],[41,128,"ip6"],[54,o,"dns4","resolvable"],[55,o,"dns6","resolvable"],[56,o,"dnsaddr","resolvable"],[132,16,"sctp"],[302,0,"utp"],[421,i.lengthPrefixedVarSize,"ipfs"],[480,0,"http"],[443,0,"https"],[477,0,"ws"],[478,0,"wss"],[479,0,"p2p-websocket-star"],[275,0,"p2p-webrtc-star"],[276,0,"p2p-webrtc-direct"],[290,0,"p2p-circuit"]],i.names={},i.codes={},n(i.table,function(e){const t=s.apply(null,e);i.codes[t.code]=t,i.names[t.name]=t}),i.object=s,e.exports=i},function(e,t,r){"use strict";const n=r(79);function i(e){if("number"==typeof e){if(i.codes[e])return i.codes[e];throw new Error("no protocol with code: "+e)}if("string"==typeof e||e instanceof String){if(i.names[e])return i.names[e];throw new Error("no protocol with name: "+e)}throw new Error("invalid protocol id type: "+e)}const o=-1;function s(e,t,r,n){return{code:e,size:t,name:r,resolvable:Boolean(n)}}i.lengthPrefixedVarSize=o,i.V=o,i.table=[[4,32,"ip4"],[6,16,"tcp"],[17,16,"udp"],[33,16,"dccp"],[41,128,"ip6"],[54,o,"dns4","resolvable"],[55,o,"dns6","resolvable"],[56,o,"dnsaddr","resolvable"],[132,16,"sctp"],[302,0,"utp"],[421,i.lengthPrefixedVarSize,"ipfs"],[480,0,"http"],[443,0,"https"],[477,0,"ws"],[478,0,"wss"],[479,0,"p2p-websocket-star"],[275,0,"p2p-webrtc-star"],[276,0,"p2p-webrtc-direct"],[290,0,"p2p-circuit"]],i.names={},i.codes={},n(i.table,function(e){const t=s.apply(null,e);i.codes[t.code]=t,i.names[t.name]=t}),i.object=s,e.exports=i},function(e,t,r){"use strict";e.exports=function e(t,r){return t.then(e=>{r(null,e)},e=>{r(e)})}},function(e,t,r){"use strict";e.exports=(()=>{if("undefined"!=typeof self&&(r(69)(self),self.crypto))return self.crypto;throw new Error("Please use an environment with crypto support")})},function(e,t,r){"use strict";e.exports="enum KeyType {\n RSA = 0;\n Ed25519 = 1;\n Secp256k1 = 2;\n}\nmessage PublicKey {\n required KeyType Type = 1;\n required bytes Data = 2;\n}\nmessage PrivateKey {\n required KeyType Type = 1;\n required bytes Data = 2;\n}"},function(e,t,r){"use strict";(function(t){
|
||
/*!
|
||
* @description Recursive object extending
|
||
* @author Viacheslav Lotsmanov <lotsmanov89@gmail.com>
|
||
* @license MIT
|
||
*
|
||
* The MIT License (MIT)
|
||
*
|
||
* Copyright (c) 2013-2018 Viacheslav Lotsmanov
|
||
*
|
||
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||
* this software and associated documentation files (the "Software"), to deal in
|
||
* the Software without restriction, including without limitation the rights to
|
||
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||
* the Software, and to permit persons to whom the Software is furnished to do so,
|
||
* subject to the following conditions:
|
||
*
|
||
* The above copyright notice and this permission notice shall be included in all
|
||
* copies or substantial portions of the Software.
|
||
*
|
||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||
*/
|
||
function r(e){return e instanceof t||e instanceof Date||e instanceof RegExp}function n(e){if(e instanceof t){var r=t.alloc?t.alloc(e.length):new t(e.length);return e.copy(r),r}if(e instanceof Date)return new Date(e.getTime());if(e instanceof RegExp)return new RegExp(e);throw new Error("Unexpected situation")}function i(e){var t=[];return e.forEach(function(e,o){"object"==typeof e&&null!==e?Array.isArray(e)?t[o]=i(e):r(e)?t[o]=n(e):t[o]=s({},e):t[o]=e}),t}function o(e,t){return"__proto__"===t?void 0:e[t]}var s=e.exports=function(){if(arguments.length<1||"object"!=typeof arguments[0])return!1;if(arguments.length<2)return arguments[0];var e=arguments[0],t=Array.prototype.slice.call(arguments,1),a,u,c;return t.forEach(function(t){"object"!=typeof t||null===t||Array.isArray(t)||Object.keys(t).forEach(function(c){return u=o(e,c),a=o(t,c),a===e?void 0:"object"!=typeof a||null===a?void(e[c]=a):Array.isArray(a)?void(e[c]=i(a)):r(a)?void(e[c]=n(a)):"object"!=typeof u||null===u||Array.isArray(u)?void(e[c]=s({},a)):void(e[c]=s(u,a))})}),e}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";const n=r(79);function i(e){if("number"==typeof e){if(i.codes[e])return i.codes[e];throw new Error("no protocol with code: "+e)}if("string"==typeof e||e instanceof String){if(i.names[e])return i.names[e];throw new Error("no protocol with name: "+e)}throw new Error("invalid protocol id type: "+e)}const o=-1;function s(e,t,r,n){return{code:e,size:t,name:r,resolvable:Boolean(n)}}i.lengthPrefixedVarSize=o,i.V=o,i.table=[[4,32,"ip4"],[6,16,"tcp"],[17,16,"udp"],[33,16,"dccp"],[41,128,"ip6"],[54,o,"dns4","resolvable"],[55,o,"dns6","resolvable"],[56,o,"dnsaddr","resolvable"],[132,16,"sctp"],[302,0,"utp"],[421,i.lengthPrefixedVarSize,"ipfs"],[480,0,"http"],[443,0,"https"],[477,0,"ws"],[478,0,"wss"],[479,0,"p2p-websocket-star"],[275,0,"p2p-webrtc-star"],[276,0,"p2p-webrtc-direct"],[290,0,"p2p-circuit"]],i.names={},i.codes={},n(i.table,function(e){const t=s.apply(null,e);i.codes[t.code]=t,i.names[t.name]=t}),i.object=s,e.exports=i},function(e,t,r){"use strict";const n=r(5),i=r(37),o=r(46),s=r(41),a=r(220),u=r(13),c=r(55),f=r(1),l=r(107),h=r(8),p=r(991),d=r(992),y=r(993),g=r(994),m=r(997),b=r(998),v=r(999),_=r(1e3),w=r(1001),S=f("repo"),k=Number.MAX_SAFE_INTEGER,E={memory:r(490),fs:r(490)},A=r(1002).repoVersion;class x{constructor(e,t){u.equal(typeof e,"string","missing repoPath"),this.options=P(t),this.closed=!0,this.path=e,this._locker=this._getLocker(),this.root=p.create("root",this.path,this.options),this.version=d(this.root),this.config=y(this.root),this.spec=g(this.root),this.apiAddr=m(this.root)}init(e,t){S("initializing at: %s",this.path),i([e=>this.root.open(B(e)),t=>this.config.set(O(e),t),t=>this.spec.set(R(e),t),e=>this.version.set(A,e)],t)}open(e){this.closed?(S("opening at: %s",this.path),n([e=>this.root.open(B(e)),e=>this._isInitialized(e),e=>this._openLock(this.path,e),(e,t)=>{S("aquired repo.lock"),this.lockfile=e,t()},e=>{S("creating datastore"),this.datastore=p.create("datastore",c.join(this.path,"datastore"),this.options),S("creating blocks");const t=p.create("blocks",c.join(this.path,"blocks"),this.options);b(t,this.options.storageBackendOptions.blocks,e)},(e,t)=>{this.blocks=e,t()},e=>{S("creating keystore"),this.keys=p.create("keys",c.join(this.path,"keys"),this.options),e()},e=>{this.closed=!1,S("all opened"),e()}],t=>{t&&this.lockfile?this._closeLock(r=>{r?S("error removing lock",r):this.lockfile=null,e(t)}):e(t)})):setImmediate(()=>e(new Error("repo is already open")))}_getLocker(){return"string"==typeof this.options.lock?(u(E[this.options.lock],"Unknown lock type: "+this.options.lock),E[this.options.lock]):(u(this.options.lock,"No lock provided"),this.options.lock)}_openLock(e,t){this._locker.lock(e,(e,r)=>{if(e)return t(e,null);u.equal(typeof r.close,"function","Locks must have a close method"),t(null,r)})}_closeLock(e){if(this.lockfile)return this.lockfile.close(e);e()}_isLocked(e,t){if(this._locker)return this._locker.locked(e,t);t(null,!1)}_isInitialized(e){S("init check"),o({config:e=>this.config.exists(e),spec:e=>this.spec.exists(e),version:e=>this.version.check(A,e)},(t,r)=>{if(S("init",t,r),t&&!r.config)return e(Object.assign(new Error("repo is not initialized yet"),{code:w.ERR_REPO_NOT_INITIALIZED,path:this.path}));e(t)})}close(e){if(this.closed)return e(new Error("repo is already closed"));S("closing at: %s",this.path),i([e=>this.apiAddr.delete(C(e)),e=>{s([this.blocks,this.keys,this.datastore],(e,t)=>e.close(t),e)},e=>{S("unlocking"),this.closed=!0,this._closeLock(e)},e=>{this.lockfile=null,e()}],t=>e(t))}exists(e){this.version.exists(e)}stat(e,t){"function"==typeof e&&(t=e,e={}),e=Object.assign({},{human:!1},e),o({storageMax:e=>this.config.get("Datastore.StorageMax",(t,r)=>{e(null,new l(t?k:r))}),version:e=>this.version.get(e),blocks:e=>this.blocks.query({},(t,r)=>{r=r||[];const n=new l(r.length);let i=new l(0);r.forEach(e=>{i=i.plus(e.value.byteLength).plus(e.key._buf.byteLength)}),e(t,{count:n,size:i})}),datastore:e=>I(this.datastore,e),keys:e=>I(this.keys,e)},(r,n)=>{if(r)return t(r);let i=n.blocks.size.plus(n.datastore).plus(n.keys);e.human&&(i=i.div(1048576)),t(null,{repoPath:this.path,storageMax:n.storageMax,version:n.version,numObjects:n.blocks.count,repoSize:i})})}}function I(e,t){h(e.query({}),h.reduce((e,t)=>e.plus(t.value.byteLength).plus(t.key._buf.byteLength),new l(0),t))}function T(e,t){return r=>{t(r&&!e(r)?r:null)}}function B(e){return T(e=>"Already open"===e.message,e)}function C(e){return T(e=>e&&(e.code===w.ERR_REPO_NOT_INITIALIZED||e.message.startsWith("ENOENT")),e)}function P(e){const t=Object.assign({},v,e);return t.storageBackends=Object.assign({},v.storageBackends,t.storageBackends),t.storageBackendOptions=Object.assign({},v.storageBackendOptions,t.storageBackendOptions),t}function O(e){return e.datastore=Object.assign({},_,a(e,"datastore",{})),e}function R(e){const t=Object.assign({},_.Spec,a(e,"datastore.Spec",{}));return{type:t.type,mounts:t.mounts.map(e=>({mountpoint:e.mountpoint,type:e.child.type,path:e.child.path,shardFunc:e.child.shardFunc}))}}e.exports=x,e.exports.repoVersion=A,e.exports.errors=w},function(e,t,r){"use strict";e.exports=function e(t,r){return t.then(e=>{r(null,e)},e=>{r(e)})}},function(e,t,r){"use strict";e.exports=(()=>{if("undefined"!=typeof self&&(r(69)(self),self.crypto))return self.crypto;throw new Error("Please use an environment with crypto support")})},function(e,t,r){"use strict";e.exports="enum KeyType {\n RSA = 0;\n Ed25519 = 1;\n Secp256k1 = 2;\n}\nmessage PublicKey {\n required KeyType Type = 1;\n required bytes Data = 2;\n}\nmessage PrivateKey {\n required KeyType Type = 1;\n required bytes Data = 2;\n}"},function(e,t,r){"use strict";const n=1e3;e.exports={maxProvidersPerRequest:3,providerRequestTimeout:1e4,hasBlockTimeout:15e3,provideTimeout:15e3,kMaxPriority:Math.pow(2,31)-1,rebroadcastDelay:1e4,maxListeners:1e3}},function(e,t,r){var n=r(1)("socket.io-parser"),i=r(116),o=r(1086),s=r(509),a=r(510);function u(){}t.protocol=4,t.types=["CONNECT","DISCONNECT","EVENT","ACK","ERROR","BINARY_EVENT","BINARY_ACK"],t.CONNECT=0,t.DISCONNECT=1,t.EVENT=2,t.ACK=3,t.ERROR=4,t.BINARY_EVENT=5,t.BINARY_ACK=6,t.Encoder=u,t.Decoder=p;var c=t.ERROR+'"encode error"';function f(e){var r=""+e.type;if(t.BINARY_EVENT!==e.type&&t.BINARY_ACK!==e.type||(r+=e.attachments+"-"),e.nsp&&"/"!==e.nsp&&(r+=e.nsp+","),null!=e.id&&(r+=e.id),null!=e.data){var i=l(e.data);if(!1===i)return c;r+=i}return n("encoded %j as %s",e,r),r}function l(e){try{return JSON.stringify(e)}catch(e){return!1}}function h(e,t){function r(e){var r=o.deconstructPacket(e),n=f(r.packet),i=r.buffers;i.unshift(n),t(i)}o.removeBlobs(e,r)}function p(){this.reconstructor=null}function d(e){var r=0,i={type:Number(e.charAt(0))};if(null==t.types[i.type])return m("unknown packet type "+i.type);if(t.BINARY_EVENT===i.type||t.BINARY_ACK===i.type){for(var o="";"-"!==e.charAt(++r)&&(o+=e.charAt(r),r!=e.length););if(o!=Number(o)||"-"!==e.charAt(r))throw new Error("Illegal attachments");i.attachments=Number(o)}if("/"===e.charAt(r+1))for(i.nsp="";++r;){var a=e.charAt(r);if(","===a)break;if(i.nsp+=a,r===e.length)break}else i.nsp="/";var u=e.charAt(r+1);if(""!==u&&Number(u)==u){for(i.id="";++r;){var a=e.charAt(r);if(null==a||Number(a)!=a){--r;break}if(i.id+=e.charAt(r),r===e.length)break}i.id=Number(i.id)}if(e.charAt(++r)){var c=y(e.substr(r)),f=!1!==c&&(i.type===t.ERROR||s(c));if(!f)return m("invalid payload");i.data=c}return n("decoded %s as %j",e,i),i}function y(e){try{return JSON.parse(e)}catch(e){return!1}}function g(e){this.reconPack=e,this.buffers=[]}function m(e){return{type:t.ERROR,data:"parser error: "+e}}u.prototype.encode=function(e,r){if(n("encoding packet %j",e),t.BINARY_EVENT===e.type||t.BINARY_ACK===e.type)h(e,r);else{var i=f(e);r([i])}},i(p.prototype),p.prototype.add=function(e){var r;if("string"==typeof e)r=d(e),t.BINARY_EVENT===r.type||t.BINARY_ACK===r.type?(this.reconstructor=new g(r),0===this.reconstructor.reconPack.attachments&&this.emit("decoded",r)):this.emit("decoded",r);else{if(!a(e)&&!e.base64)throw new Error("Unknown type: "+e);if(!this.reconstructor)throw new Error("got binary data when not reconstructing a packet");r=this.reconstructor.takeBinaryData(e),r&&(this.reconstructor=null,this.emit("decoded",r))}},p.prototype.destroy=function(){this.reconstructor&&this.reconstructor.finishedReconstruction()},g.prototype.takeBinaryData=function(e){if(this.buffers.push(e),this.buffers.length===this.reconPack.attachments){var t=o.reconstructPacket(this.reconPack,this.buffers);return this.finishedReconstruction(),t}return null},g.prototype.finishedReconstruction=function(){this.reconPack=null,this.buffers=[]}},function(e,t,r){(function(t){var n=r(1089);e.exports=function(e){var r=e.xdomain,i=e.xscheme,o=e.enablesXDR;try{if("undefined"!=typeof XMLHttpRequest&&(!r||n))return new XMLHttpRequest}catch(e){}try{if("undefined"!=typeof XDomainRequest&&!i&&o)return new XDomainRequest}catch(e){}if(!r)try{return new(t[["Active"].concat("Object").join("X")])("Microsoft.XMLHTTP")}catch(e){}}}).call(this,r(7))},function(e,t,r){var n=r(117),i=r(116);function o(e){this.path=e.path,this.hostname=e.hostname,this.port=e.port,this.secure=e.secure,this.query=e.query,this.timestampParam=e.timestampParam,this.timestampRequests=e.timestampRequests,this.readyState="",this.agent=e.agent||!1,this.socket=e.socket,this.enablesXDR=e.enablesXDR,this.pfx=e.pfx,this.key=e.key,this.passphrase=e.passphrase,this.cert=e.cert,this.ca=e.ca,this.ciphers=e.ciphers,this.rejectUnauthorized=e.rejectUnauthorized,this.forceNode=e.forceNode,this.extraHeaders=e.extraHeaders,this.localAddress=e.localAddress}e.exports=o,i(o.prototype),o.prototype.onError=function(e,t){var r=new Error(e);return r.type="TransportError",r.description=t,this.emit("error",r),this},o.prototype.open=function(){return"closed"!==this.readyState&&""!==this.readyState||(this.readyState="opening",this.doOpen()),this},o.prototype.close=function(){return"opening"!==this.readyState&&"open"!==this.readyState||(this.doClose(),this.onClose()),this},o.prototype.send=function(e){if("open"!==this.readyState)throw new Error("Transport not open");this.write(e)},o.prototype.onOpen=function(){this.readyState="open",this.writable=!0,this.emit("open")},o.prototype.onData=function(e){var t=n.decodePacket(e,this.socket.binaryType);this.onPacket(t)},o.prototype.onPacket=function(e){this.emit("packet",e)},o.prototype.onClose=function(){this.readyState="closed",this.emit("close")}},function(e,t,r){"use strict";e.exports=function e(t,r){return t.then(e=>{r(null,e)},e=>{r(e)})}},function(e,t,r){"use strict";e.exports=(()=>{if("undefined"!=typeof self&&(r(69)(self),self.crypto))return self.crypto;throw new Error("Please use an environment with crypto support")})},function(e,t,r){"use strict";e.exports="enum KeyType {\n RSA = 0;\n Ed25519 = 1;\n Secp256k1 = 2;\n}\nmessage PublicKey {\n required KeyType Type = 1;\n required bytes Data = 2;\n}\nmessage PrivateKey {\n required KeyType Type = 1;\n required bytes Data = 2;\n}"},function(e,t,r){"use strict";e.exports=function e(t,r){return t.then(e=>{r(null,e)},e=>{r(e)})}},function(e,t,r){"use strict";e.exports=(()=>{if("undefined"!=typeof self&&(r(69)(self),self.crypto))return self.crypto;throw new Error("Please use an environment with crypto support")})},function(e,t,r){"use strict";e.exports="enum KeyType {\n RSA = 0;\n Ed25519 = 1;\n Secp256k1 = 2;\n}\nmessage PublicKey {\n required KeyType Type = 1;\n required bytes Data = 2;\n}\nmessage PrivateKey {\n required KeyType Type = 1;\n required bytes Data = 2;\n}"},function(e,t,r){var n=r(35),i=function(){},o=function(e){return e.setHeader&&"function"==typeof e.abort},s=function(e){return e.stdio&&Array.isArray(e.stdio)&&3===e.stdio.length},a=function(e,t,r){if("function"==typeof t)return a(e,null,t);t||(t={}),r=n(r||i);var u=e._writableState,c=e._readableState,f=t.readable||!1!==t.readable&&e.readable,l=t.writable||!1!==t.writable&&e.writable,h=function(){e.writable||p()},p=function(){l=!1,f||r.call(e)},d=function(){f=!1,l||r.call(e)},y=function(t){r.call(e,t?new Error("exited with error code: "+t):null)},g=function(t){r.call(e,t)},m=function(){return(!f||c&&c.ended)&&(!l||u&&u.ended)?void 0:r.call(e,new Error("premature close"))},b=function(){e.req.on("finish",p)};return o(e)?(e.on("complete",p),e.on("abort",m),e.req?b():e.on("request",b)):l&&!u&&(e.on("end",h),e.on("close",h)),s(e)&&e.on("exit",y),e.on("end",d),e.on("finish",p),!1!==t.error&&e.on("error",g),e.on("close",m),function(){e.removeListener("complete",p),e.removeListener("abort",m),e.removeListener("request",b),e.req&&e.req.removeListener("finish",p),e.removeListener("end",h),e.removeListener("close",h),e.removeListener("finish",p),e.removeListener("exit",y),e.removeListener("end",d),e.removeListener("error",g),e.removeListener("close",m)}};e.exports=a},function(e,t,r){(function(t){var n=r(35),i=r(291),o=r(1152),s=function(){},a=/^v?\.0/.test(t.version),u=function(e){return"function"==typeof e},c=function(e){return!!a&&(!!o&&((e instanceof(o.ReadStream||s)||e instanceof(o.WriteStream||s))&&u(e.close)))},f=function(e){return e.setHeader&&u(e.abort)},l=function(e,t,r,o){o=n(o);var a=!1;e.on("close",function(){a=!0}),i(e,{readable:t,writable:r},function(e){if(e)return o(e);a=!0,o()});var l=!1;return function(t){if(!a&&!l)return l=!0,c(e)?e.close(s):f(e)?e.abort():u(e.destroy)?e.destroy():void o(t||new Error("stream was destroyed"))}},h=function(e){e()},p=function(e,t){return e.pipe(t)},d=function(){var e=Array.prototype.slice.call(arguments),t=u(e[e.length-1]||s)&&e.pop()||s,r;if(Array.isArray(e[0])&&(e=e[0]),e.length<2)throw new Error("pump requires two streams per minimum");var n=e.map(function(i,o){var s=o<e.length-1,a=o>0;return l(i,s,a,function(e){r||(r=e),e&&n.forEach(h),s||(n.forEach(h),t(r))})});return e.reduce(p)};e.exports=d}).call(this,r(6))},function(e,t,r){"use strict";(function(e){const n=r(294),i=r(53),o=r(8),s=r(295),a=r(46);function u(e,t,r){s.hmac.create(e,t,r)}function c(e,t,r,n){if("AES-128"===e||"AES-256"===e)return s.aes.create(r,t,n);n(new Error(`unrecognized cipher type: ${e}`))}t.exchanges=["P-256","P-384","P-521"],t.ciphers=["AES-256","AES-128"],t.hashes=["SHA256","SHA512"],t.theBest=((e,t,r)=>{let n,i;if(e<0)n=r,i=t;else{if(!(e>0))return t[0];n=t,i=r}for(let e of n)for(let t of i)if(e===t)return e;throw new Error("No algorithms in common!")}),t.makeMacAndCipher=((e,t)=>{a([t=>u(e.hashT,e.keys.macKey,t),t=>c(e.cipherT,e.keys.iv,e.keys.cipherKey,t)],(r,n)=>{if(r)return t(r);e.mac=n[0],e.cipher=n[1],t()})}),t.selectBest=((r,n,i)=>{t.digest(e.concat([n.pubKeyBytes,r.nonce]),(o,s)=>{if(o)return i(o);t.digest(e.concat([r.pubKeyBytes,n.nonce]),(o,a)=>{if(o)return i(o);const u=e.compare(s,a);if(0===u)return i(new Error("you are trying to talk to yourself"));i(null,{curveT:t.theBest(u,r.exchanges,n.exchanges),cipherT:t.theBest(u,r.ciphers,n.ciphers),hashT:t.theBest(u,r.hashes,n.hashes),order:u})})})}),t.digest=((e,t)=>{n.digest(e,"sha2-256",e.length,t)}),t.write=function e(t,r,n){n=n||(()=>{}),o(o.values([r]),i.encode({fixed:!0,bytes:4}),o.collect((e,r)=>{if(e)return n(e);t.shake.write(r[0]),n()}))},t.read=function e(t,r){i.decodeFromReader(t,{fixed:!0,bytes:4},r)}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(t){const n=r(14),i=r(1156);function o(e,t,r,i){if("function"==typeof r&&(i=r,r=void 0),!i)throw new Error("Missing callback");o.digest(e,t,r,(e,o)=>{if(e)return i(e);i(null,n.encode(o,t,r))})}e.exports=o,o.Buffer=t,o.multihash=n,o.digest=function(e,t,r,n){if("function"==typeof r&&(n=r,r=void 0),!n)throw new Error("Missing callback");let i=n,s;r&&(i=((e,t)=>{if(e)return n(e);n(null,t.slice(0,r))}));try{s=o.createHash(t)}catch(e){return i(e)}s(e,i)},o.createHash=function(e){if(e=n.coerceCode(e),!o.functions[e])throw new Error("multihash function "+e+" not yet supported");return o.functions[e]},o.functions={17:i.sha1,18:i.sha2256,19:i.sha2512,20:i.sha3512,21:i.sha3384,22:i.sha3256,23:i.sha3224,24:i.shake128,25:i.shake256,26:i.keccak224,27:i.keccak256,28:i.keccak384,29:i.keccak512,34:i.murmur3128,35:i.murmur332,86:i.dblSha2256},i.addBlake(o.functions)}).call(this,r(0).Buffer)},function(e,t,r){"use strict";const n=r(537),i=r(1160),o=r(1162);t=e.exports,t.aes=i,t.hmac=n,t.keys=o,t.randomBytes=r(540),t.pbkdf2=r(1170)},function(e,t,r){"use strict";e.exports=function e(t,r){return t.then(e=>{r(null,e)},e=>{r(e)})}},function(e,t,r){"use strict";e.exports=(()=>{if("undefined"!=typeof self&&(r(69)(self),self.crypto))return self.crypto;throw new Error("Please use an environment with crypto support")})},function(e,t,r){"use strict";e.exports="enum KeyType {\n RSA = 0;\n Ed25519 = 1;\n Secp256k1 = 2;\n}\nmessage PublicKey {\n required KeyType Type = 1;\n required bytes Data = 2;\n}\nmessage PrivateKey {\n required KeyType Type = 1;\n required bytes Data = 2;\n}"},function(e,t,r){"use strict";(function(e){const n=r(12),i=r(1171),o=r(295),s=r(46),a=r(5),u=r(1),c=u("libp2p:secio");c.error=u("libp2p:secio:error");const f=n(r(1172)),l=r(293),h=16;t.createProposal=(e=>(e.proposal.out={rand:o.randomBytes(16),pubkey:e.key.local.public.bytes,exchanges:l.exchanges.join(","),ciphers:l.ciphers.join(","),hashes:l.hashes.join(",")},e.proposalEncoded.out=f.Propose.encode(e.proposal.out),e.proposalEncoded.out)),t.createExchange=((t,r)=>{o.keys.generateEphemeralKeyPair(t.protocols.local.curveT,(n,i)=>{if(n)return r(n);t.ephemeralKey.local=i.key,t.shared.generate=i.genSharedKey;const o=e.concat([t.proposalEncoded.out,t.proposalEncoded.in,t.ephemeralKey.local]);t.key.local.sign(o,(e,n)=>{if(e)return r(e);t.exchange.out={epubkey:t.ephemeralKey.local,signature:n},r(null,f.Exchange.encode(t.exchange.out))})})}),t.identify=((e,t,r)=>{c("1.1 identify"),e.proposalEncoded.in=t,e.proposal.in=f.Propose.decode(t);const n=e.proposal.in.pubkey;e.key.remote=o.keys.unmarshalPublicKey(n),i.createFromPubKey(n.toString("base64"),(t,n)=>{if(t)return r(t);if(e.id.remote){if(e.id.remote.toB58String()!==n.toB58String())return r(new Error("dialed to the wrong peer, Ids do not match"))}else e.id.remote=n;c("1.1 identify - %s - identified remote peer as %s",e.id.local.toB58String(),e.id.remote.toB58String()),r()})}),t.selectProtocols=((e,t)=>{c("1.2 selection");const r={pubKeyBytes:e.key.local.public.bytes,exchanges:l.exchanges,hashes:l.hashes,ciphers:l.ciphers,nonce:e.proposal.out.rand},n={pubKeyBytes:e.proposal.in.pubkey,exchanges:e.proposal.in.exchanges.split(","),hashes:e.proposal.in.hashes.split(","),ciphers:e.proposal.in.ciphers.split(","),nonce:e.proposal.in.rand};l.selectBest(r,n,(r,n)=>{if(r)return t(r);e.protocols.remote={order:n.order,curveT:n.curveT,cipherT:n.cipherT,hashT:n.hashT},e.protocols.local={order:n.order,curveT:n.curveT,cipherT:n.cipherT,hashT:n.hashT},t()})}),t.verify=((t,r,n)=>{c("2.1. verify"),t.exchange.in=f.Exchange.decode(r),t.ephemeralKey.remote=t.exchange.in.epubkey;const i=e.concat([t.proposalEncoded.in,t.proposalEncoded.out,t.ephemeralKey.remote]);t.key.remote.verify(i,t.exchange.in.signature,(e,t)=>e?n(e):t?(c("2.1. verify - signature verified"),void n()):n(new Error("Bad signature")))}),t.generateKeys=((e,t)=>{c("2.2. keys"),a([t=>e.shared.generate(e.exchange.in.epubkey,t),(t,r)=>{e.shared.secret=t,o.keys.keyStretcher(e.protocols.local.cipherT,e.protocols.local.hashT,e.shared.secret,r)},(t,r)=>{if(e.protocols.local.order>0)e.protocols.local.keys=t.k1,e.protocols.remote.keys=t.k2;else{if(!(e.protocols.local.order<0))return r(new Error("you are trying to talk to yourself"));e.protocols.local.keys=t.k2,e.protocols.remote.keys=t.k1}c("2.3. mac + cipher"),s([t=>l.makeMacAndCipher(e.protocols.local,t),t=>l.makeMacAndCipher(e.protocols.remote,t)],r)}],t)}),t.verifyNonce=((e,t)=>{const r=e.proposal.out.rand;if(!r.equals(t))throw new Error(`Failed to read our encrypted nonce: ${r.toString("hex")} != ${t.toString("hex")}`)})}).call(this,r(0).Buffer)},function(e,t,r){"use strict";e.exports=function e(t,r){return t.then(e=>{r(null,e)},e=>{r(e)})}},function(e,t,r){"use strict";e.exports=(()=>{if("undefined"!=typeof self&&(r(69)(self),self.crypto))return self.crypto;throw new Error("Please use an environment with crypto support")})},function(e,t,r){"use strict";e.exports="enum KeyType {\n RSA = 0;\n Ed25519 = 1;\n Secp256k1 = 2;\n}\nmessage PublicKey {\n required KeyType Type = 1;\n required bytes Data = 2;\n}\nmessage PrivateKey {\n required KeyType Type = 1;\n required bytes Data = 2;\n}"},function(e,t,r){"use strict";const n=r(12),i="\nmessage Identify {\n // protocolVersion determines compatibility between peers\n optional string protocolVersion = 5; // e.g. ipfs/1.0.0\n\n // agentVersion is like a UserAgent string in browsers, or client version in bittorrent\n // includes the client name and client.\n optional string agentVersion = 6; // e.g. go-ipfs/0.1.0\n\n // publicKey is this node's public key (which also gives its node.ID)\n // - may not need to be sent, as secure channel implies it has been sent.\n // - then again, if we change / disable secure channel, may still want it.\n optional bytes publicKey = 1;\n\n // listenAddrs are the multiaddrs the sender node listens for open connections on\n repeated bytes listenAddrs = 2;\n\n // oservedAddr is the multiaddr of the remote endpoint that the sender node perceives\n // this is useful information to convey to the other side, as it helps the remote endpoint\n // determine whether its connection to the local peer goes through NAT.\n optional bytes observedAddr = 4;\n\n repeated string protocols = 3;\n}\n";e.exports=n(i).Identify},function(e,t,r){"use strict";e.exports=function e(t,r){return t.then(e=>{r(null,e)},e=>{r(e)})}},function(e,t,r){"use strict";e.exports=(()=>{if("undefined"!=typeof self&&(r(69)(self),self.crypto))return self.crypto;throw new Error("Please use an environment with crypto support")})},function(e,t,r){"use strict";e.exports="enum KeyType {\n RSA = 0;\n Ed25519 = 1;\n Secp256k1 = 2;\n}\nmessage PublicKey {\n required KeyType Type = 1;\n required bytes Data = 2;\n}\nmessage PrivateKey {\n required KeyType Type = 1;\n required bytes Data = 2;\n}"},function(e,t,r){"use strict";t.Listener=t.listener=r(1222),t.Dialer=t.dialer=r(1225),t.matchSemver=r(1226),t.matchExact=r(557)},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=u;var n=r(54),i=a(n),o=r(217),s=a(o);function a(e){return e&&e.__esModule?e:{default:e}}function u(e,t){return function(r,n,o,a){a=a||i.default;var u=!1,c;r(n,function(r,n,i){o(r,function(n,o){n?i(n):e(o)&&!c?(u=!0,c=t(!0,r),i(null,s.default)):i()})},function(e){e?a(e):a(null,u?c:t(!1))})}}e.exports=t.default},function(e,t,r){"use strict";const n=r(8),i=r(53),o=r(102),s=r(1),a=s("libp2p:circuit:stream-handler");a.err=s("libp2p:circuit:error:stream-handler");class u{constructor(e,t,r,i){this.conn=e,this.stream=null,this.shake=null,this.timeout=t||6e4,this.maxLength=i||4096,"function"==typeof t&&(this.timeout=r||6e4),this.stream=o({timeout:this.timeout},t),this.shake=this.stream.handshake,n(this.stream,e,this.stream)}isValid(){return this.conn&&this.shake&&this.stream}read(e){this.isValid()||e(new Error("handler is not in a valid state")),i.decodeFromReader(this.shake,{maxLength:this.maxLength},(t,r)=>t?(a.err(t),e(t)):e(null,r))}write(e,t){t=t||(()=>{}),this.isValid()||t(new Error("handler is not in a valid state")),n(n.values([e]),i.encode(),n.collect((e,r)=>{if(e)return a.err(e),this.shake.abort(e),t(e);r.forEach(e=>this.shake.write(e)),t()}))}getRawConn(){return this.conn}rest(){const e=this.shake.rest();return this.conn=null,this.stream=null,this.shake=null,e}close(){n(n.empty(),this.rest())}}e.exports=u},function(e,t,r){"use strict";e.exports={relay:"/libp2p/circuit/relay/0.1.0"}},function(e,t,r){"use strict";e.exports=function e(t,r){return t.then(e=>{r(null,e)},e=>{r(e)})}},function(e,t,r){"use strict";e.exports=(()=>{if("undefined"!=typeof self&&(r(69)(self),self.crypto))return self.crypto;throw new Error("Please use an environment with crypto support")})},function(e,t,r){"use strict";e.exports="enum KeyType {\n RSA = 0;\n Ed25519 = 1;\n Secp256k1 = 2;\n}\nmessage PublicKey {\n required KeyType Type = 1;\n required bytes Data = 2;\n}\nmessage PrivateKey {\n required KeyType Type = 1;\n required bytes Data = 2;\n}"},function(e,t,r){"use strict";e.exports={PROTOCOL:"/ipfs/ping/1.0.0",PING_LENGTH:32}},function(e,t,r){var n=r(156),i=r(159),o="[object Symbol]";function s(e){return"symbol"==typeof e||i(e)&&n(e)==o}e.exports=s},function(e,t,r){"use strict";const n=r(199),i=100;e.exports=function e(t){const r=t||100;var i=[];return n(function e(t){for(i=i.concat(t);i.length>=r;){const e=r,t=i.slice(0,e);i=i.slice(e),this.queue(t)}},function e(t){i.length&&(this.queue(i),i=[]),this.queue(null)})}},function(e,t,r){"use strict";e.exports=class e{constructor(e,t){this._options=t||{},Object.assign(this,e)}}},function(e,t,r){var n=r(1359);e.exports=function(e,t,r){r=void 0===r||r;var i=!1,o;return function(s){var a=0,u=0,c=0,f=[],l=!1,h=!1,p,d;function y(){if(p){var e=p;if(d)return p=null,e(d);if(Object.hasOwnProperty.call(f,u)){p=null;var r=f[u];delete f[u],u++,e(null,r),t&&g()}else u>=c&&h&&(p=null,e(h))}}var g=n(function(){if(l=!0,h)return y();i||t&&a-t>=u||(i=!0,s(o,function(t,n){if(i=!1,t)c=a,h=t,y();else{var o=a++;e(n,function(e,t){r?f[o]=t:f.push(t),e&&(d=e),y()}),h||g()}}))});return function(e,t){e?s(h=o=e,function(e){if(t)return t(e)}):(p=t,l||g(),y())}}}},function(e,t,r){"use strict";const n=r(9),i=r(42),{DAGNode:o,DAGLink:s}=i,a=r(5),u=(e,t,r)=>(t=Object.assign({},{parent:void 0,child:void 0,name:"",flush:!0},t),t.parent?t.child?void a([e=>{if(t.name)return o.rmLink(t.parent,t.name,e);e(null,t.parent)},(e,r)=>{o.addLink(e,new s(t.name,t.child.size,t.child.hash||t.child.multihash),r)},(r,i)=>{if(!t.flush)return i(null,r);e.dag.put(r,{cid:new n(r.hash||r.multihash)},e=>i(e,r))}],r):r(new Error("No child passed to addLink")):r(new Error("No parent passed to addLink")));e.exports=u},function(e,t,r){"use strict";const n=r(146).exporter,i=r(64),o=r(210),s=r(123),a=r(165),u=r(90),c=r(38),{traverseTo:f,createLock:l}=r(45),h=r(1)("ipfs:mfs:read-pull-stream"),p={offset:0,length:void 0};e.exports=(e=>(function t(r,d={}){d=Object.assign({},p,d),h(`Reading ${r}`);const y=a.source();return i(o(r),s((t,r)=>{l().readLock(r=>{f(e,t,{parents:!1},r)})(r)}),s((t,o)=>{const s=t.node,a=c.unmarshal(s.data);if("file"!==a.type)return o(new Error(`${r} was not a file`));h(`Getting ${r} content`),i(n(s.multihash,e.dag,{offset:d.offset,length:d.length}),u((e,t)=>{o(e,e?null:t[0].content)}))}),u((e,t)=>e?y.abort(e):t.length?(h(`Got ${r} content`),void y.resolve(t[0])):y.abort(new Error(`Could not load content stream from ${r}`)))),y}))},function(e,t,r){(function(t){e.exports=function(e,r){var n=[];e.on("data",function(e){n.push(e)}),e.once("end",function(){r&&r(null,t.concat(n)),r=null}),e.once("error",function(e){r&&r(e),r=null})}}).call(this,r(0).Buffer)},function(e,t,r){(function(e){var n=r(1476),i=r(600),o=r(27),s=r(1477),a=r(36),u=t;u.request=function(t,r){t="string"==typeof t?a.parse(t):o(t);var i=-1===e.location.protocol.search(/^https?:$/)?"http:":"",s=t.protocol||i,u=t.hostname||t.host,c=t.port,f=t.path||"/";u&&-1!==u.indexOf(":")&&(u="["+u+"]"),t.url=(u?s+"//"+u:"")+(c?":"+c:"")+f,t.method=(t.method||"GET").toUpperCase(),t.headers=t.headers||{};var l=new n(t);return r&&l.on("response",r),l},u.get=function e(t,r){var n=u.request(t,r);return n.end(),n},u.ClientRequest=n,u.IncomingMessage=i.IncomingMessage,u.Agent=function(){},u.Agent.defaultMaxSockets=4,u.globalAgent=new u.Agent,u.STATUS_CODES=s,u.METHODS=["CHECKOUT","CONNECT","COPY","DELETE","GET","HEAD","LOCK","M-SEARCH","MERGE","MKACTIVITY","MKCOL","MOVE","NOTIFY","OPTIONS","PATCH","POST","PROPFIND","PROPPATCH","PURGE","PUT","REPORT","SEARCH","SUBSCRIBE","TRACE","UNLOCK","UNSUBSCRIBE"]}).call(this,r(7))},function(e,t){var r=1,n=65535,i=4,o,s=function(){r=r+1&65535};e.exports=function(e){o||(o=setInterval(s,250),o.unref&&o.unref());var t=4*(e||5),n=[0],i=1,a=r-1&65535;return function(e){var o=r-a&65535;for(o>t&&(o=t),a=r;o--;)i===t&&(i=0),n[i]=n[0===i?t-1:i-1],i++;e&&(n[i-1]+=e);var s=n[i-1],u=n.length<t?0:n[i===t?0:i];return n.length<4?s:4*(s-u)/n.length}}},function(e,t,r){(function(t){var r=Object.prototype.toString,n="function"==typeof t.alloc&&"function"==typeof t.allocUnsafe&&"function"==typeof t.from;function i(e){return"ArrayBuffer"===r.call(e).slice(8,-1)}function o(e,r,i){r>>>=0;var o=e.byteLength-r;if(o<0)throw new RangeError("'offset' is out of bounds");if(void 0===i)i=o;else if(i>>>=0,i>o)throw new RangeError("'length' is out of bounds");return n?t.from(e.slice(r,r+i)):new t(new Uint8Array(e.slice(r,r+i)))}function s(e,r){if("string"==typeof r&&""!==r||(r="utf8"),!t.isEncoding(r))throw new TypeError('"encoding" must be a valid string encoding');return n?t.from(e,r):new t(e,r)}function a(e,r,a){if("number"==typeof e)throw new TypeError('"value" argument must not be a number');return i(e)?o(e,r,a):"string"==typeof e?s(e,r):n?t.from(e):new t(e)}e.exports=a}).call(this,r(0).Buffer)},function(e){e.exports={_from:"webtorrent@^0.99.3",_id:"webtorrent@0.99.4",_inBundle:!1,_integrity:"sha512-coJ61iJOFDrSzyCwmhlLaU8tvcchI5ZA0fH9Toj4wwUq/OTUNdjXtNXwpCb6ldbBnJ04lQzxyDeuSR3KtN0MWg==",_location:"/webtorrent",_phantomChildren:{"decompress-response":"3.3.0",once:"1.4.0","simple-concat":"1.0.0"},_requested:{type:"range",registry:!0,raw:"webtorrent@^0.99.3",name:"webtorrent",escapedName:"webtorrent",rawSpec:"^0.99.3",saveSpec:null,fetchSpec:"^0.99.3"},_requiredBy:["/"],_resolved:"https://registry.npmjs.org/webtorrent/-/webtorrent-0.99.4.tgz",_shasum:"b5d4652c72f20f6ad3322b6ecbc7215cf83c6a89",_spec:"webtorrent@^0.99.3",_where:"/Users/mitra/git/dweb-transports",author:{name:"WebTorrent, LLC",email:"feross@webtorrent.io",url:"https://webtorrent.io"},browser:{"./lib/server.js":!1,"./lib/tcp-pool.js":!1,"bittorrent-dht/client":!1,"fs-chunk-store":"memory-chunk-store","load-ip-set":!1,net:!1,os:!1,ut_pex:!1},browserify:{transform:["package-json-versionify"]},bugs:{url:"https://github.com/webtorrent/webtorrent/issues"},bundleDependencies:!1,dependencies:{"addr-to-ip-port":"^1.4.2",bitfield:"^2.0.0","bittorrent-dht":"^8.0.0","bittorrent-protocol":"^2.1.5","chunk-store-stream":"^2.0.2","create-torrent":"^3.24.5",debug:"^3.1.0","end-of-stream":"^1.1.0","fs-chunk-store":"^1.6.2","immediate-chunk-store":"^1.0.8",inherits:"^2.0.1","load-ip-set":"^1.2.7","memory-chunk-store":"^1.2.0",mime:"^2.2.0",multistream:"^2.0.5","package-json-versionify":"^1.0.2","parse-torrent":"^6.0.0",pump:"^3.0.0","random-iterate":"^1.0.1",randombytes:"^2.0.3","range-parser":"^1.2.0","readable-stream":"^2.1.4","render-media":"^3.0.0","run-parallel":"^1.1.6","run-parallel-limit":"^1.0.3","safe-buffer":"^5.0.1","simple-concat":"^1.0.0","simple-get":"^3.0.1","simple-peer":"^9.0.0","simple-sha1":"^2.0.8",speedometer:"^1.0.0","stream-to-blob":"^1.0.0","stream-to-blob-url":"^2.1.0","stream-with-known-length-to-buffer":"^1.0.0","torrent-discovery":"^8.3.1","torrent-piece":"^1.1.0",uniq:"^1.0.1","unordered-array-remove":"^1.0.2",ut_metadata:"^3.0.8",ut_pex:"^1.1.1",xtend:"^4.0.1","zero-fill":"^2.2.3"},deprecated:!1,description:"Streaming torrent client",devDependencies:{airtap:"0.0.4","babel-minify":"^0.3.0","bittorrent-tracker":"^9.4.0",brfs:"^1.4.3",browserify:"^16.0.0","cross-spawn":"^6.0.3",electron:"^2.0.0",finalhandler:"^1.0.0","network-address":"^1.1.0","run-series":"^1.1.4","serve-static":"^1.11.1",standard:"*",tape:"^4.6.0","webtorrent-fixtures":"^1.5.0"},engines:{node:">=4"},homepage:"https://webtorrent.io",keywords:["bittorrent","bittorrent client","download","mad science","p2p","peer-to-peer","peers","streaming","swarm","torrent","web torrent","webrtc","webrtc data","webtorrent"],license:"MIT",main:"index.js",name:"webtorrent",repository:{type:"git",url:"git://github.com/webtorrent/webtorrent.git"},scripts:{build:"browserify -s WebTorrent -e ./ | minify > webtorrent.min.js","build-debug":"browserify -s WebTorrent -e ./ > webtorrent.debug.js",size:"npm run build && cat webtorrent.min.js | gzip | wc -c",test:"standard && npm run test-node && npm run test-browser","test-browser":"airtap -- test/*.js test/browser/*.js","test-browser-local":"airtap --local -- test/*.js test/browser/*.js","test-node":"tape test/*.js test/node/*.js","update-authors":"./scripts/update-authors.sh"},version:"0.99.4"}},function(e,t,r){"use strict";(function(t,n){var i=r(152);e.exports=k;var o=r(327),s;k.ReadableState=S;var a=r(10).EventEmitter,u=function(e,t){return e.listeners(t).length},c=r(328),f=r(2).Buffer,l=t.Uint8Array||function(){};function h(e){return f.from(e)}function p(e){return f.isBuffer(e)||e instanceof l}var d=r(119);d.inherits=r(4);var y=r(621),g=void 0;g=y&&y.debuglog?y.debuglog("stream"):function(){};var m=r(622),b=r(330),v;d.inherits(k,c);var _=["error","close","destroy","pause","resume"];function w(e,t,r){if("function"==typeof e.prependListener)return e.prependListener(t,r);e._events&&e._events[t]?o(e._events[t])?e._events[t].unshift(r):e._events[t]=[r,e._events[t]]:e.on(t,r)}function S(e,t){s=s||r(89),e=e||{};var n=t instanceof s;this.objectMode=!!e.objectMode,n&&(this.objectMode=this.objectMode||!!e.readableObjectMode);var i=e.highWaterMark,o=e.readableHighWaterMark,a=this.objectMode?16:16384;this.highWaterMark=i||0===i?i:n&&(o||0===o)?o:a,this.highWaterMark=Math.floor(this.highWaterMark),this.buffer=new m,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.destroyed=!1,this.defaultEncoding=e.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,e.encoding&&(v||(v=r(208).StringDecoder),this.decoder=new v(e.encoding),this.encoding=e.encoding)}function k(e){if(s=s||r(89),!(this instanceof k))return new k(e);this._readableState=new S(e,this),this.readable=!0,e&&("function"==typeof e.read&&(this._read=e.read),"function"==typeof e.destroy&&(this._destroy=e.destroy)),c.call(this)}function E(e,t,r,n,i){var o=e._readableState,s;null===t?(o.reading=!1,P(e,o)):(i||(s=x(o,t)),s?e.emit("error",s):o.objectMode||t&&t.length>0?("string"==typeof t||o.objectMode||Object.getPrototypeOf(t)===f.prototype||(t=h(t)),n?o.endEmitted?e.emit("error",new Error("stream.unshift() after end event")):A(e,o,t,!0):o.ended?e.emit("error",new Error("stream.push() after EOF")):(o.reading=!1,o.decoder&&!r?(t=o.decoder.write(t),o.objectMode||0!==t.length?A(e,o,t,!1):N(e,o)):A(e,o,t,!1))):n||(o.reading=!1));return I(o)}function A(e,t,r,n){t.flowing&&0===t.length&&!t.sync?(e.emit("data",r),e.read(0)):(t.length+=t.objectMode?1:r.length,n?t.buffer.unshift(r):t.buffer.push(r),t.needReadable&&O(e)),N(e,t)}function x(e,t){var r;return p(t)||"string"==typeof t||void 0===t||e.objectMode||(r=new TypeError("Invalid non-string/buffer chunk")),r}function I(e){return!e.ended&&(e.needReadable||e.length<e.highWaterMark||0===e.length)}Object.defineProperty(k.prototype,"destroyed",{get:function(){return void 0!==this._readableState&&this._readableState.destroyed},set:function(e){this._readableState&&(this._readableState.destroyed=e)}}),k.prototype.destroy=b.destroy,k.prototype._undestroy=b.undestroy,k.prototype._destroy=function(e,t){this.push(null),t(e)},k.prototype.push=function(e,t){var r=this._readableState,n;return r.objectMode?n=!0:"string"==typeof e&&(t=t||r.defaultEncoding,t!==r.encoding&&(e=f.from(e,t),t=""),n=!0),E(this,e,t,!1,n)},k.prototype.unshift=function(e){return E(this,e,null,!0,!1)},k.prototype.isPaused=function(){return!1===this._readableState.flowing},k.prototype.setEncoding=function(e){return v||(v=r(208).StringDecoder),this._readableState.decoder=new v(e),this._readableState.encoding=e,this};var T=8388608;function B(e){return e>=T?e=T:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}function C(e,t){return e<=0||0===t.length&&t.ended?0:t.objectMode?1:e!=e?t.flowing&&t.length?t.buffer.head.data.length:t.length:(e>t.highWaterMark&&(t.highWaterMark=B(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}function P(e,t){if(!t.ended){if(t.decoder){var r=t.decoder.end();r&&r.length&&(t.buffer.push(r),t.length+=t.objectMode?1:r.length)}t.ended=!0,O(e)}}function O(e){var t=e._readableState;t.needReadable=!1,t.emittedReadable||(g("emitReadable",t.flowing),t.emittedReadable=!0,t.sync?i.nextTick(R,e):R(e))}function R(e){g("emit readable"),e.emit("readable"),U(e)}function N(e,t){t.readingMore||(t.readingMore=!0,i.nextTick(L,e,t))}function L(e,t){for(var r=t.length;!t.reading&&!t.flowing&&!t.ended&&t.length<t.highWaterMark&&(g("maybeReadMore read 0"),e.read(0),r!==t.length);)r=t.length;t.readingMore=!1}function j(e){return function(){var t=e._readableState;g("pipeOnDrain",t.awaitDrain),t.awaitDrain&&t.awaitDrain--,0===t.awaitDrain&&u(e,"data")&&(t.flowing=!0,U(e))}}function M(e){g("readable nexttick read 0"),e.read(0)}function K(e,t){t.resumeScheduled||(t.resumeScheduled=!0,i.nextTick(D,e,t))}function D(e,t){t.reading||(g("resume read 0"),e.read(0)),t.resumeScheduled=!1,t.awaitDrain=0,e.emit("resume"),U(e),t.flowing&&!t.reading&&e.read(0)}function U(e){var t=e._readableState;for(g("flow",t.flowing);t.flowing&&null!==e.read(););}function F(e,t){return 0===t.length?null:(t.objectMode?r=t.buffer.shift():!e||e>=t.length?(r=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.head.data:t.buffer.concat(t.length),t.buffer.clear()):r=q(e,t.buffer,t.decoder),r);var r}function q(e,t,r){var n;return e<t.head.data.length?(n=t.head.data.slice(0,e),t.head.data=t.head.data.slice(e)):n=e===t.head.data.length?t.shift():r?H(e,t):z(e,t),n}function H(e,t){var r=t.head,n=1,i=r.data;for(e-=i.length;r=r.next;){var o=r.data,s=e>o.length?o.length:e;if(s===o.length?i+=o:i+=o.slice(0,e),e-=s,0===e){s===o.length?(++n,r.next?t.head=r.next:t.head=t.tail=null):(t.head=r,r.data=o.slice(s));break}++n}return t.length-=n,i}function z(e,t){var r=f.allocUnsafe(e),n=t.head,i=1;for(n.data.copy(r),e-=n.data.length;n=n.next;){var o=n.data,s=e>o.length?o.length:e;if(o.copy(r,r.length-e,0,s),e-=s,0===e){s===o.length?(++i,n.next?t.head=n.next:t.head=t.tail=null):(t.head=n,n.data=o.slice(s));break}++i}return t.length-=i,r}function V(e){var t=e._readableState;if(t.length>0)throw new Error('"endReadable()" called on non-empty stream');t.endEmitted||(t.ended=!0,i.nextTick(G,t,e))}function G(e,t){e.endEmitted||0!==e.length||(e.endEmitted=!0,t.readable=!1,t.emit("end"))}function W(e,t){for(var r=0,n=e.length;r<n;r++)if(e[r]===t)return r;return-1}k.prototype.read=function(e){g("read",e),e=parseInt(e,10);var t=this._readableState,r=e;if(0!==e&&(t.emittedReadable=!1),0===e&&t.needReadable&&(t.length>=t.highWaterMark||t.ended))return g("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?V(this):O(this),null;if(e=C(e,t),0===e&&t.ended)return 0===t.length&&V(this),null;var n=t.needReadable,i;return g("need readable",n),(0===t.length||t.length-e<t.highWaterMark)&&(n=!0,g("length less than watermark",n)),t.ended||t.reading?(n=!1,g("reading or ended",n)):n&&(g("do read"),t.reading=!0,t.sync=!0,0===t.length&&(t.needReadable=!0),this._read(t.highWaterMark),t.sync=!1,t.reading||(e=C(r,t))),i=e>0?F(e,t):null,null===i?(t.needReadable=!0,e=0):t.length-=e,0===t.length&&(t.ended||(t.needReadable=!0),r!==e&&t.ended&&V(this)),null!==i&&this.emit("data",i),i},k.prototype._read=function(e){this.emit("error",new Error("_read() is not implemented"))},k.prototype.pipe=function(e,t){var r=this,o=this._readableState;switch(o.pipesCount){case 0:o.pipes=e;break;case 1:o.pipes=[o.pipes,e];break;default:o.pipes.push(e)}o.pipesCount+=1,g("pipe count=%d opts=%j",o.pipesCount,t);var s=(!t||!1!==t.end)&&e!==n.stdout&&e!==n.stderr,a=s?f:_;function c(e,t){g("onunpipe"),e===r&&t&&!1===t.hasUnpiped&&(t.hasUnpiped=!0,p())}function f(){g("onend"),e.end()}o.endEmitted?i.nextTick(a):r.once("end",a),e.on("unpipe",c);var l=j(r);e.on("drain",l);var h=!1;function p(){g("cleanup"),e.removeListener("close",b),e.removeListener("finish",v),e.removeListener("drain",l),e.removeListener("error",m),e.removeListener("unpipe",c),r.removeListener("end",f),r.removeListener("end",_),r.removeListener("data",y),h=!0,!o.awaitDrain||e._writableState&&!e._writableState.needDrain||l()}var d=!1;function y(t){g("ondata"),d=!1;var n=e.write(t);!1!==n||d||((1===o.pipesCount&&o.pipes===e||o.pipesCount>1&&-1!==W(o.pipes,e))&&!h&&(g("false write response, pause",r._readableState.awaitDrain),r._readableState.awaitDrain++,d=!0),r.pause())}function m(t){g("onerror",t),_(),e.removeListener("error",m),0===u(e,"error")&&e.emit("error",t)}function b(){e.removeListener("finish",v),_()}function v(){g("onfinish"),e.removeListener("close",b),_()}function _(){g("unpipe"),r.unpipe(e)}return r.on("data",y),w(e,"error",m),e.once("close",b),e.once("finish",v),e.emit("pipe",r),o.flowing||(g("pipe resume"),r.resume()),e},k.prototype.unpipe=function(e){var t=this._readableState,r={hasUnpiped:!1};if(0===t.pipesCount)return this;if(1===t.pipesCount)return e&&e!==t.pipes?this:(e||(e=t.pipes),t.pipes=null,t.pipesCount=0,t.flowing=!1,e&&e.emit("unpipe",this,r),this);if(!e){var n=t.pipes,i=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var o=0;o<i;o++)n[o].emit("unpipe",this,r);return this}var s=W(t.pipes,e);return-1===s?this:(t.pipes.splice(s,1),t.pipesCount-=1,1===t.pipesCount&&(t.pipes=t.pipes[0]),e.emit("unpipe",this,r),this)},k.prototype.on=function(e,t){var r=c.prototype.on.call(this,e,t);if("data"===e)!1!==this._readableState.flowing&&this.resume();else if("readable"===e){var n=this._readableState;n.endEmitted||n.readableListening||(n.readableListening=n.needReadable=!0,n.emittedReadable=!1,n.reading?n.length&&O(this):i.nextTick(M,this))}return r},k.prototype.addListener=k.prototype.on,k.prototype.resume=function(){var e=this._readableState;return e.flowing||(g("resume"),e.flowing=!0,K(this,e)),this},k.prototype.pause=function(){return g("call pause flowing=%j",this._readableState.flowing),!1!==this._readableState.flowing&&(g("pause"),this._readableState.flowing=!1,this.emit("pause")),this},k.prototype.wrap=function(e){var t=this,r=this._readableState,n=!1;for(var i in e.on("end",function(){if(g("wrapped end"),r.decoder&&!r.ended){var e=r.decoder.end();e&&e.length&&t.push(e)}t.push(null)}),e.on("data",function(i){if(g("wrapped data"),r.decoder&&(i=r.decoder.write(i)),(!r.objectMode||null!==i&&void 0!==i)&&(r.objectMode||i&&i.length)){var o=t.push(i);o||(n=!0,e.pause())}}),e)void 0===this[i]&&"function"==typeof e[i]&&(this[i]=function(t){return function(){return e[t].apply(e,arguments)}}(i));for(var o=0;o<_.length;o++)e.on(_[o],this.emit.bind(this,_[o]));return this._read=function(t){g("wrapped _read",t),n&&(n=!1,e.resume())},this},Object.defineProperty(k.prototype,"readableHighWaterMark",{enumerable:!1,get:function(){return this._readableState.highWaterMark}}),k._fromList=F}).call(this,r(7),r(6))},function(e,t){var r={}.toString;e.exports=Array.isArray||function(e){return"[object Array]"==r.call(e)}},function(e,t,r){e.exports=r(10).EventEmitter},function(e,t){t.read=function(e,t,r,n,i){var o,s,a=8*i-n-1,u=(1<<a)-1,c=u>>1,f=-7,l=r?i-1:0,h=r?-1:1,p=e[t+l];for(l+=h,o=p&(1<<-f)-1,p>>=-f,f+=a;f>0;o=256*o+e[t+l],l+=h,f-=8);for(s=o&(1<<-f)-1,o>>=-f,f+=n;f>0;s=256*s+e[t+l],l+=h,f-=8);if(0===o)o=1-c;else{if(o===u)return s?NaN:1/0*(p?-1:1);s+=Math.pow(2,n),o-=c}return(p?-1:1)*s*Math.pow(2,o-n)},t.write=function(e,t,r,n,i,o){var s,a,u,c=8*o-i-1,f=(1<<c)-1,l=f>>1,h=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,p=n?0:o-1,d=n?1:-1,y=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(a=isNaN(t)?1:0,s=f):(s=Math.floor(Math.log(t)/Math.LN2),t*(u=Math.pow(2,-s))<1&&(s--,u*=2),t+=s+l>=1?h/u:h*Math.pow(2,1-l),t*u>=2&&(s++,u/=2),s+l>=f?(a=0,s=f):s+l>=1?(a=(t*u-1)*Math.pow(2,i),s+=l):(a=t*Math.pow(2,l-1)*Math.pow(2,i),s=0));i>=8;e[r+p]=255&a,p+=d,a/=256,i-=8);for(s=s<<i|a,c+=i;c>0;e[r+p]=255&s,p+=d,s/=256,c-=8);e[r+p-d]|=128*y}},function(e,t,r){"use strict";var n=r(152);function i(e,t){var r=this,i=this._readableState&&this._readableState.destroyed,o=this._writableState&&this._writableState.destroyed;return i||o?(t?t(e):!e||this._writableState&&this._writableState.errorEmitted||n.nextTick(s,this,e),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(e||null,function(e){!t&&e?(n.nextTick(s,r,e),r._writableState&&(r._writableState.errorEmitted=!0)):t&&t(e)}),this)}function o(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)}function s(e,t){e.emit("error",t)}e.exports={destroy:i,undestroy:o}},function(e,t,r){"use strict";e.exports=s;var n=r(89),i=r(119);function o(e,t){var r=this._transformState;r.transforming=!1;var n=r.writecb;if(!n)return this.emit("error",new Error("write callback called multiple times"));r.writechunk=null,r.writecb=null,null!=t&&this.push(t),n(e);var i=this._readableState;i.reading=!1,(i.needReadable||i.length<i.highWaterMark)&&this._read(i.highWaterMark)}function s(e){if(!(this instanceof s))return new s(e);n.call(this,e),this._transformState={afterTransform:o.bind(this),needTransform:!1,transforming:!1,writecb:null,writechunk:null,writeencoding:null},this._readableState.needReadable=!0,this._readableState.sync=!1,e&&("function"==typeof e.transform&&(this._transform=e.transform),"function"==typeof e.flush&&(this._flush=e.flush)),this.on("prefinish",a)}function a(){var e=this;"function"==typeof this._flush?this._flush(function(t,r){u(e,t,r)}):u(this,null,null)}function u(e,t,r){if(t)return e.emit("error",t);if(null!=r&&e.push(r),e._writableState.length)throw new Error("Calling transform done when ws.length != 0");if(e._transformState.transforming)throw new Error("Calling transform done when still transforming");return e.push(null)}i.inherits=r(4),i.inherits(s,n),s.prototype.push=function(e,t){return this._transformState.needTransform=!1,n.prototype.push.call(this,e,t)},s.prototype._transform=function(e,t,r){throw new Error("_transform() is not implemented")},s.prototype._write=function(e,t,r){var n=this._transformState;if(n.writecb=r,n.writechunk=e,n.writeencoding=t,!n.transforming){var i=this._readableState;(n.needTransform||i.needReadable||i.length<i.highWaterMark)&&this._read(i.highWaterMark)}},s.prototype._read=function(e){var t=this._transformState;null!==t.writechunk&&t.writecb&&!t.transforming?(t.transforming=!0,this._transform(t.writechunk,t.writeencoding,t.afterTransform)):t.needTransform=!0},s.prototype._destroy=function(e,t){var r=this;n.prototype._destroy.call(this,e,function(e){t(e),r.emit("close")})}},function(e,t,r){(function(n){const i=r(626),o=r(81),s=r(1)("dweb-transports:httptools");async function a(e,t,r,n){let i,o="undefined"!=typeof window&&window.loopguard;for(;r--&&o===("undefined"!=typeof window&&window.loopguard);)try{return await fetch(e)}catch(e){i=e,s("Delaying %s by %d ms because %s",n,t,e.message),await new Promise(e=>{setTimeout(()=>{e()},t)}),t*=1+Math.random()}throw console.warn("loopfetch of",n,"failed"),o!==(window&&window.loopguard)?(s("Looping exited because of page change %s",n),new Error("Looping exited because of page change "+n)):i}"undefined"==typeof fetch&&(fetch=i,Headers=fetch.Headers,Request=fetch.Request),httptools={},httptools.p_httpfetch=async function(e,t,{wantstream:r=!1}={}){try{s("p_httpfetch: %s %o",e,t);let i=new Request(e,t),u=await a(i,500,12,"fetching "+e);if(u.ok){let e=u.headers.get("Content-Type");return r?u.body:"application/json"===e?u.json():e.startsWith("text")?u.text():new n(await u.arrayBuffer())}throw new o.TransportError(`Transport Error ${u.status}: ${u.statusText}`)}catch(t){throw s("p_httpfetch failed but error of %s could be misleading since TypeErrors are generated by CORS or the Chrome anti DDOS 'feature'",t.message),t instanceof o.TransportError?t:new o.TransportError(`Transport error thrown by ${e}: ${t.message}`)}},httptools.p_GET=async function(e,t={}){let r=new Headers;(t.start||t.end)&&r.append("range",`bytes=${t.start||0}-${t.end||""}`);let n={method:"GET",headers:r,mode:"cors",cache:"default",redirect:"follow",keepalive:!0};return await httptools.p_httpfetch(e,n,{wantstream:t.wantstream})},httptools.p_POST=async function(e,t,r){let n={method:"POST",headers:{},body:r,mode:"cors",cache:"default",redirect:"follow",keepalive:!0};return await httptools.p_httpfetch(e,n)},t=e.exports=httptools}).call(this,r(0).Buffer)},function(e,t,r){"use strict";class n{constructor(e){this._repo=e,this._bitswap=null}setExchange(e){this._bitswap=e}unsetExchange(){this._bitswap=null}hasExchange(){return null!=this._bitswap}put(e,t){if(this.hasExchange())return this._bitswap.put(e,t);this._repo.blocks.put(e,t)}putMany(e,t){if(this.hasExchange())return this._bitswap.putMany(e,t);this._repo.blocks.putMany(e,t)}get(e,t){return this.hasExchange()?this._bitswap.get(e,t):this._repo.blocks.get(e,t)}delete(e,t){this._repo.blocks.delete(e,t)}}e.exports=n},function(e,t,r){var n=r(2).Buffer;e.exports=function e(t){for(var r={},i=t.length,o=t.charAt(0),s=0;s<t.length;s++){var a=t.charAt(s);if(void 0!==r[a])throw new TypeError(a+" is ambiguous");r[a]=s}function u(e){if(0===e.length)return"";for(var r=[0],n=0;n<e.length;++n){for(var s=0,a=e[n];s<r.length;++s)a+=r[s]<<8,r[s]=a%i,a=a/i|0;for(;a>0;)r.push(a%i),a=a/i|0}for(var u="",c=0;0===e[c]&&c<e.length-1;++c)u+=o;for(var f=r.length-1;f>=0;--f)u+=t[r[f]];return u}function c(e){if("string"!=typeof e)throw new TypeError("Expected String");if(0===e.length)return n.allocUnsafe(0);for(var t=[0],s=0;s<e.length;s++){var a=r[e[s]];if(void 0===a)return;for(var u=0,c=a;u<t.length;++u)c+=t[u]*i,t[u]=255&c,c>>=8;for(;c>0;)t.push(255&c),c>>=8}for(var f=0;e[f]===o&&f<e.length-1;++f)t.push(0);return n.from(t.reverse())}function f(e){var t=c(e);if(t)return t;throw new Error("Non-base"+i+" character")}return{encode:u,decodeUnsafe:c,decode:f}}},function(e,t,r){"use strict";t.names=Object.freeze({id:0,sha1:17,"sha2-256":18,"sha2-512":19,"dbl-sha2-256":86,"sha3-224":23,"sha3-256":22,"sha3-384":21,"sha3-512":20,"shake-128":24,"shake-256":25,"keccak-224":26,"keccak-256":27,"keccak-384":28,"keccak-512":29,"murmur3-128":34,"murmur3-32":35,"blake2b-8":45569,"blake2b-16":45570,"blake2b-24":45571,"blake2b-32":45572,"blake2b-40":45573,"blake2b-48":45574,"blake2b-56":45575,"blake2b-64":45576,"blake2b-72":45577,"blake2b-80":45578,"blake2b-88":45579,"blake2b-96":45580,"blake2b-104":45581,"blake2b-112":45582,"blake2b-120":45583,"blake2b-128":45584,"blake2b-136":45585,"blake2b-144":45586,"blake2b-152":45587,"blake2b-160":45588,"blake2b-168":45589,"blake2b-176":45590,"blake2b-184":45591,"blake2b-192":45592,"blake2b-200":45593,"blake2b-208":45594,"blake2b-216":45595,"blake2b-224":45596,"blake2b-232":45597,"blake2b-240":45598,"blake2b-248":45599,"blake2b-256":45600,"blake2b-264":45601,"blake2b-272":45602,"blake2b-280":45603,"blake2b-288":45604,"blake2b-296":45605,"blake2b-304":45606,"blake2b-312":45607,"blake2b-320":45608,"blake2b-328":45609,"blake2b-336":45610,"blake2b-344":45611,"blake2b-352":45612,"blake2b-360":45613,"blake2b-368":45614,"blake2b-376":45615,"blake2b-384":45616,"blake2b-392":45617,"blake2b-400":45618,"blake2b-408":45619,"blake2b-416":45620,"blake2b-424":45621,"blake2b-432":45622,"blake2b-440":45623,"blake2b-448":45624,"blake2b-456":45625,"blake2b-464":45626,"blake2b-472":45627,"blake2b-480":45628,"blake2b-488":45629,"blake2b-496":45630,"blake2b-504":45631,"blake2b-512":45632,"blake2s-8":45633,"blake2s-16":45634,"blake2s-24":45635,"blake2s-32":45636,"blake2s-40":45637,"blake2s-48":45638,"blake2s-56":45639,"blake2s-64":45640,"blake2s-72":45641,"blake2s-80":45642,"blake2s-88":45643,"blake2s-96":45644,"blake2s-104":45645,"blake2s-112":45646,"blake2s-120":45647,"blake2s-128":45648,"blake2s-136":45649,"blake2s-144":45650,"blake2s-152":45651,"blake2s-160":45652,"blake2s-168":45653,"blake2s-176":45654,"blake2s-184":45655,"blake2s-192":45656,"blake2s-200":45657,"blake2s-208":45658,"blake2s-216":45659,"blake2s-224":45660,"blake2s-232":45661,"blake2s-240":45662,"blake2s-248":45663,"blake2s-256":45664,"Skein256-8":45825,"Skein256-16":45826,"Skein256-24":45827,"Skein256-32":45828,"Skein256-40":45829,"Skein256-48":45830,"Skein256-56":45831,"Skein256-64":45832,"Skein256-72":45833,"Skein256-80":45834,"Skein256-88":45835,"Skein256-96":45836,"Skein256-104":45837,"Skein256-112":45838,"Skein256-120":45839,"Skein256-128":45840,"Skein256-136":45841,"Skein256-144":45842,"Skein256-152":45843,"Skein256-160":45844,"Skein256-168":45845,"Skein256-176":45846,"Skein256-184":45847,"Skein256-192":45848,"Skein256-200":45849,"Skein256-208":45850,"Skein256-216":45851,"Skein256-224":45852,"Skein256-232":45853,"Skein256-240":45854,"Skein256-248":45855,"Skein256-256":45856,"Skein512-8":45857,"Skein512-16":45858,"Skein512-24":45859,"Skein512-32":45860,"Skein512-40":45861,"Skein512-48":45862,"Skein512-56":45863,"Skein512-64":45864,"Skein512-72":45865,"Skein512-80":45866,"Skein512-88":45867,"Skein512-96":45868,"Skein512-104":45869,"Skein512-112":45870,"Skein512-120":45871,"Skein512-128":45872,"Skein512-136":45873,"Skein512-144":45874,"Skein512-152":45875,"Skein512-160":45876,"Skein512-168":45877,"Skein512-176":45878,"Skein512-184":45879,"Skein512-192":45880,"Skein512-200":45881,"Skein512-208":45882,"Skein512-216":45883,"Skein512-224":45884,"Skein512-232":45885,"Skein512-240":45886,"Skein512-248":45887,"Skein512-256":45888,"Skein512-264":45889,"Skein512-272":45890,"Skein512-280":45891,"Skein512-288":45892,"Skein512-296":45893,"Skein512-304":45894,"Skein512-312":45895,"Skein512-320":45896,"Skein512-328":45897,"Skein512-336":45898,"Skein512-344":45899,"Skein512-352":45900,"Skein512-360":45901,"Skein512-368":45902,"Skein512-376":45903,"Skein512-384":45904,"Skein512-392":45905,"Skein512-400":45906,"Skein512-408":45907,"Skein512-416":45908,"Skein512-424":45909,"Skein512-432":45910,"Skein512-440":45911,"Skein512-448":45912,"Skein512-456":45913,"Skein512-464":45914,"Skein512-472":45915,"Skein512-480":45916,"Skein512-488":45917,"Skein512-496":45918,"Skein512-504":45919,"Skein512-512":45920,"Skein1024-8":45921,"Skein1024-16":45922,"Skein1024-24":45923,"Skein1024-32":45924,"Skein1024-40":45925,"Skein1024-48":45926,"Skein1024-56":45927,"Skein1024-64":45928,"Skein1024-72":45929,"Skein1024-80":45930,"Skein1024-88":45931,"Skein1024-96":45932,"Skein1024-104":45933,"Skein1024-112":45934,"Skein1024-120":45935,"Skein1024-128":45936,"Skein1024-136":45937,"Skein1024-144":45938,"Skein1024-152":45939,"Skein1024-160":45940,"Skein1024-168":45941,"Skein1024-176":45942,"Skein1024-184":45943,"Skein1024-192":45944,"Skein1024-200":45945,"Skein1024-208":45946,"Skein1024-216":45947,"Skein1024-224":45948,"Skein1024-232":45949,"Skein1024-240":45950,"Skein1024-248":45951,"Skein1024-256":45952,"Skein1024-264":45953,"Skein1024-272":45954,"Skein1024-280":45955,"Skein1024-288":45956,"Skein1024-296":45957,"Skein1024-304":45958,"Skein1024-312":45959,"Skein1024-320":45960,"Skein1024-328":45961,"Skein1024-336":45962,"Skein1024-344":45963,"Skein1024-352":45964,"Skein1024-360":45965,"Skein1024-368":45966,"Skein1024-376":45967,"Skein1024-384":45968,"Skein1024-392":45969,"Skein1024-400":45970,"Skein1024-408":45971,"Skein1024-416":45972,"Skein1024-424":45973,"Skein1024-432":45974,"Skein1024-440":45975,"Skein1024-448":45976,"Skein1024-456":45977,"Skein1024-464":45978,"Skein1024-472":45979,"Skein1024-480":45980,"Skein1024-488":45981,"Skein1024-496":45982,"Skein1024-504":45983,"Skein1024-512":45984,"Skein1024-520":45985,"Skein1024-528":45986,"Skein1024-536":45987,"Skein1024-544":45988,"Skein1024-552":45989,"Skein1024-560":45990,"Skein1024-568":45991,"Skein1024-576":45992,"Skein1024-584":45993,"Skein1024-592":45994,"Skein1024-600":45995,"Skein1024-608":45996,"Skein1024-616":45997,"Skein1024-624":45998,"Skein1024-632":45999,"Skein1024-640":46e3,"Skein1024-648":46001,"Skein1024-656":46002,"Skein1024-664":46003,"Skein1024-672":46004,"Skein1024-680":46005,"Skein1024-688":46006,"Skein1024-696":46007,"Skein1024-704":46008,"Skein1024-712":46009,"Skein1024-720":46010,"Skein1024-728":46011,"Skein1024-736":46012,"Skein1024-744":46013,"Skein1024-752":46014,"Skein1024-760":46015,"Skein1024-768":46016,"Skein1024-776":46017,"Skein1024-784":46018,"Skein1024-792":46019,"Skein1024-800":46020,"Skein1024-808":46021,"Skein1024-816":46022,"Skein1024-824":46023,"Skein1024-832":46024,"Skein1024-840":46025,"Skein1024-848":46026,"Skein1024-856":46027,"Skein1024-864":46028,"Skein1024-872":46029,"Skein1024-880":46030,"Skein1024-888":46031,"Skein1024-896":46032,"Skein1024-904":46033,"Skein1024-912":46034,"Skein1024-920":46035,"Skein1024-928":46036,"Skein1024-936":46037,"Skein1024-944":46038,"Skein1024-952":46039,"Skein1024-960":46040,"Skein1024-968":46041,"Skein1024-976":46042,"Skein1024-984":46043,"Skein1024-992":46044,"Skein1024-1000":46045,"Skein1024-1008":46046,"Skein1024-1016":46047,"Skein1024-1024":46048}),t.codes=Object.freeze({17:"sha1",18:"sha2-256",19:"sha2-512",86:"dbl-sha2-256",23:"sha3-224",22:"sha3-256",21:"sha3-384",20:"sha3-512",24:"shake-128",25:"shake-256",26:"keccak-224",27:"keccak-256",28:"keccak-384",29:"keccak-512",34:"murmur3-128",35:"murmur3-32",45569:"blake2b-8",45570:"blake2b-16",45571:"blake2b-24",45572:"blake2b-32",45573:"blake2b-40",45574:"blake2b-48",45575:"blake2b-56",45576:"blake2b-64",45577:"blake2b-72",45578:"blake2b-80",45579:"blake2b-88",45580:"blake2b-96",45581:"blake2b-104",45582:"blake2b-112",45583:"blake2b-120",45584:"blake2b-128",45585:"blake2b-136",45586:"blake2b-144",45587:"blake2b-152",45588:"blake2b-160",45589:"blake2b-168",45590:"blake2b-176",45591:"blake2b-184",45592:"blake2b-192",45593:"blake2b-200",45594:"blake2b-208",45595:"blake2b-216",45596:"blake2b-224",45597:"blake2b-232",45598:"blake2b-240",45599:"blake2b-248",45600:"blake2b-256",45601:"blake2b-264",45602:"blake2b-272",45603:"blake2b-280",45604:"blake2b-288",45605:"blake2b-296",45606:"blake2b-304",45607:"blake2b-312",45608:"blake2b-320",45609:"blake2b-328",45610:"blake2b-336",45611:"blake2b-344",45612:"blake2b-352",45613:"blake2b-360",45614:"blake2b-368",45615:"blake2b-376",45616:"blake2b-384",45617:"blake2b-392",45618:"blake2b-400",45619:"blake2b-408",45620:"blake2b-416",45621:"blake2b-424",45622:"blake2b-432",45623:"blake2b-440",45624:"blake2b-448",45625:"blake2b-456",45626:"blake2b-464",45627:"blake2b-472",45628:"blake2b-480",45629:"blake2b-488",45630:"blake2b-496",45631:"blake2b-504",45632:"blake2b-512",45633:"blake2s-8",45634:"blake2s-16",45635:"blake2s-24",45636:"blake2s-32",45637:"blake2s-40",45638:"blake2s-48",45639:"blake2s-56",45640:"blake2s-64",45641:"blake2s-72",45642:"blake2s-80",45643:"blake2s-88",45644:"blake2s-96",45645:"blake2s-104",45646:"blake2s-112",45647:"blake2s-120",45648:"blake2s-128",45649:"blake2s-136",45650:"blake2s-144",45651:"blake2s-152",45652:"blake2s-160",45653:"blake2s-168",45654:"blake2s-176",45655:"blake2s-184",45656:"blake2s-192",45657:"blake2s-200",45658:"blake2s-208",45659:"blake2s-216",45660:"blake2s-224",45661:"blake2s-232",45662:"blake2s-240",45663:"blake2s-248",45664:"blake2s-256",45825:"Skein256-8",45826:"Skein256-16",45827:"Skein256-24",45828:"Skein256-32",45829:"Skein256-40",45830:"Skein256-48",45831:"Skein256-56",45832:"Skein256-64",45833:"Skein256-72",45834:"Skein256-80",45835:"Skein256-88",45836:"Skein256-96",45837:"Skein256-104",45838:"Skein256-112",45839:"Skein256-120",45840:"Skein256-128",45841:"Skein256-136",45842:"Skein256-144",45843:"Skein256-152",45844:"Skein256-160",45845:"Skein256-168",45846:"Skein256-176",45847:"Skein256-184",45848:"Skein256-192",45849:"Skein256-200",45850:"Skein256-208",45851:"Skein256-216",45852:"Skein256-224",45853:"Skein256-232",45854:"Skein256-240",45855:"Skein256-248",45856:"Skein256-256",45857:"Skein512-8",45858:"Skein512-16",45859:"Skein512-24",45860:"Skein512-32",45861:"Skein512-40",45862:"Skein512-48",45863:"Skein512-56",45864:"Skein512-64",45865:"Skein512-72",45866:"Skein512-80",45867:"Skein512-88",45868:"Skein512-96",45869:"Skein512-104",45870:"Skein512-112",45871:"Skein512-120",45872:"Skein512-128",45873:"Skein512-136",45874:"Skein512-144",45875:"Skein512-152",45876:"Skein512-160",45877:"Skein512-168",45878:"Skein512-176",45879:"Skein512-184",45880:"Skein512-192",45881:"Skein512-200",45882:"Skein512-208",45883:"Skein512-216",45884:"Skein512-224",45885:"Skein512-232",45886:"Skein512-240",45887:"Skein512-248",45888:"Skein512-256",45889:"Skein512-264",45890:"Skein512-272",45891:"Skein512-280",45892:"Skein512-288",45893:"Skein512-296",45894:"Skein512-304",45895:"Skein512-312",45896:"Skein512-320",45897:"Skein512-328",45898:"Skein512-336",45899:"Skein512-344",45900:"Skein512-352",45901:"Skein512-360",45902:"Skein512-368",45903:"Skein512-376",45904:"Skein512-384",45905:"Skein512-392",45906:"Skein512-400",45907:"Skein512-408",45908:"Skein512-416",45909:"Skein512-424",45910:"Skein512-432",45911:"Skein512-440",45912:"Skein512-448",45913:"Skein512-456",45914:"Skein512-464",45915:"Skein512-472",45916:"Skein512-480",45917:"Skein512-488",45918:"Skein512-496",45919:"Skein512-504",45920:"Skein512-512",45921:"Skein1024-8",45922:"Skein1024-16",45923:"Skein1024-24",45924:"Skein1024-32",45925:"Skein1024-40",45926:"Skein1024-48",45927:"Skein1024-56",45928:"Skein1024-64",45929:"Skein1024-72",45930:"Skein1024-80",45931:"Skein1024-88",45932:"Skein1024-96",45933:"Skein1024-104",45934:"Skein1024-112",45935:"Skein1024-120",45936:"Skein1024-128",45937:"Skein1024-136",45938:"Skein1024-144",45939:"Skein1024-152",45940:"Skein1024-160",45941:"Skein1024-168",45942:"Skein1024-176",45943:"Skein1024-184",45944:"Skein1024-192",45945:"Skein1024-200",45946:"Skein1024-208",45947:"Skein1024-216",45948:"Skein1024-224",45949:"Skein1024-232",45950:"Skein1024-240",45951:"Skein1024-248",45952:"Skein1024-256",45953:"Skein1024-264",45954:"Skein1024-272",45955:"Skein1024-280",45956:"Skein1024-288",45957:"Skein1024-296",45958:"Skein1024-304",45959:"Skein1024-312",45960:"Skein1024-320",45961:"Skein1024-328",45962:"Skein1024-336",45963:"Skein1024-344",45964:"Skein1024-352",45965:"Skein1024-360",45966:"Skein1024-368",45967:"Skein1024-376",45968:"Skein1024-384",45969:"Skein1024-392",45970:"Skein1024-400",45971:"Skein1024-408",45972:"Skein1024-416",45973:"Skein1024-424",45974:"Skein1024-432",45975:"Skein1024-440",45976:"Skein1024-448",45977:"Skein1024-456",45978:"Skein1024-464",45979:"Skein1024-472",45980:"Skein1024-480",45981:"Skein1024-488",45982:"Skein1024-496",45983:"Skein1024-504",45984:"Skein1024-512",45985:"Skein1024-520",45986:"Skein1024-528",45987:"Skein1024-536",45988:"Skein1024-544",45989:"Skein1024-552",45990:"Skein1024-560",45991:"Skein1024-568",45992:"Skein1024-576",45993:"Skein1024-584",45994:"Skein1024-592",45995:"Skein1024-600",45996:"Skein1024-608",45997:"Skein1024-616",45998:"Skein1024-624",45999:"Skein1024-632",46000:"Skein1024-640",46001:"Skein1024-648",46002:"Skein1024-656",46003:"Skein1024-664",46004:"Skein1024-672",46005:"Skein1024-680",46006:"Skein1024-688",46007:"Skein1024-696",46008:"Skein1024-704",46009:"Skein1024-712",46010:"Skein1024-720",46011:"Skein1024-728",46012:"Skein1024-736",46013:"Skein1024-744",46014:"Skein1024-752",46015:"Skein1024-760",46016:"Skein1024-768",46017:"Skein1024-776",46018:"Skein1024-784",46019:"Skein1024-792",46020:"Skein1024-800",46021:"Skein1024-808",46022:"Skein1024-816",46023:"Skein1024-824",46024:"Skein1024-832",46025:"Skein1024-840",46026:"Skein1024-848",46027:"Skein1024-856",46028:"Skein1024-864",46029:"Skein1024-872",46030:"Skein1024-880",46031:"Skein1024-888",46032:"Skein1024-896",46033:"Skein1024-904",46034:"Skein1024-912",46035:"Skein1024-920",46036:"Skein1024-928",46037:"Skein1024-936",46038:"Skein1024-944",46039:"Skein1024-952",46040:"Skein1024-960",46041:"Skein1024-968",46042:"Skein1024-976",46043:"Skein1024-984",46044:"Skein1024-992",46045:"Skein1024-1000",46046:"Skein1024-1008",46047:"Skein1024-1016",46048:"Skein1024-1024"}),t.defaultLengths=Object.freeze({17:20,18:32,19:64,86:32,23:28,22:32,21:48,20:64,24:32,25:64,26:28,27:32,28:48,29:64,34:32,45569:1,45570:2,45571:3,45572:4,45573:5,45574:6,45575:7,45576:8,45577:9,45578:10,45579:11,45580:12,45581:13,45582:14,45583:15,45584:16,45585:17,45586:18,45587:19,45588:20,45589:21,45590:22,45591:23,45592:24,45593:25,45594:26,45595:27,45596:28,45597:29,45598:30,45599:31,45600:32,45601:33,45602:34,45603:35,45604:36,45605:37,45606:38,45607:39,45608:40,45609:41,45610:42,45611:43,45612:44,45613:45,45614:46,45615:47,45616:48,45617:49,45618:50,45619:51,45620:52,45621:53,45622:54,45623:55,45624:56,45625:57,45626:58,45627:59,45628:60,45629:61,45630:62,45631:63,45632:64,45633:1,45634:2,45635:3,45636:4,45637:5,45638:6,45639:7,45640:8,45641:9,45642:10,45643:11,45644:12,45645:13,45646:14,45647:15,45648:16,45649:17,45650:18,45651:19,45652:20,45653:21,45654:22,45655:23,45656:24,45657:25,45658:26,45659:27,45660:28,45661:29,45662:30,45663:31,45664:32,45825:1,45826:2,45827:3,45828:4,45829:5,45830:6,45831:7,45832:8,45833:9,45834:10,45835:11,45836:12,45837:13,45838:14,45839:15,45840:16,45841:17,45842:18,45843:19,45844:20,45845:21,45846:22,45847:23,45848:24,45849:25,45850:26,45851:27,45852:28,45853:29,45854:30,45855:31,45856:32,45857:1,45858:2,45859:3,45860:4,45861:5,45862:6,45863:7,45864:8,45865:9,45866:10,45867:11,45868:12,45869:13,45870:14,45871:15,45872:16,45873:17,45874:18,45875:19,45876:20,45877:21,45878:22,45879:23,45880:24,45881:25,45882:26,45883:27,45884:28,45885:29,45886:30,45887:31,45888:32,45889:33,45890:34,45891:35,45892:36,45893:37,45894:38,45895:39,45896:40,45897:41,45898:42,45899:43,45900:44,45901:45,45902:46,45903:47,45904:48,45905:49,45906:50,45907:51,45908:52,45909:53,45910:54,45911:55,45912:56,45913:57,45914:58,45915:59,45916:60,45917:61,45918:62,45919:63,45920:64,45921:1,45922:2,45923:3,45924:4,45925:5,45926:6,45927:7,45928:8,45929:9,45930:10,45931:11,45932:12,45933:13,45934:14,45935:15,45936:16,45937:17,45938:18,45939:19,45940:20,45941:21,45942:22,45943:23,45944:24,45945:25,45946:26,45947:27,45948:28,45949:29,45950:30,45951:31,45952:32,45953:33,45954:34,45955:35,45956:36,45957:37,45958:38,45959:39,45960:40,45961:41,45962:42,45963:43,45964:44,45965:45,45966:46,45967:47,45968:48,45969:49,45970:50,45971:51,45972:52,45973:53,45974:54,45975:55,45976:56,45977:57,45978:58,45979:59,45980:60,45981:61,45982:62,45983:63,45984:64,45985:65,45986:66,45987:67,45988:68,45989:69,45990:70,45991:71,45992:72,45993:73,45994:74,45995:75,45996:76,45997:77,45998:78,45999:79,46000:80,46001:81,46002:82,46003:83,46004:84,46005:85,46006:86,46007:87,46008:88,46009:89,46010:90,46011:91,46012:92,46013:93,46014:94,46015:95,46016:96,46017:97,46018:98,46019:99,46020:100,46021:101,46022:102,46023:103,46024:104,46025:105,46026:106,46027:107,46028:108,46029:109,46030:110,46031:111,46032:112,46033:113,46034:114,46035:115,46036:116,46037:117,46038:118,46039:119,46040:120,46041:121,46042:122,46043:123,46044:124,46045:125,46046:126,46047:127,46048:128})},function(e,t,r){"use strict";const n=r(153),i=r(337).varintBufferEncode,o={};e.exports=o;for(let e in n){let t=n[e];o[e]=i(t)}},function(e,t,r){"use strict";(function(t){const n=r(23);function i(e){return parseInt(e.toString("hex"),16)}function o(e){let r=e.toString(16);return r.length%2==1&&(r="0"+r),t.from(r,"hex")}function s(e){return t.from(n.encode(i(e)))}function a(e){return o(n.decode(e))}e.exports={numberToBuffer:o,bufferToNumber:i,varintBufferEncode:s,varintBufferDecode:a}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";const n=r(153),i={};e.exports=i;for(let e in n){let t=n[e];i[t.toString("hex")]=e}},function(e,t){e.exports=function e(t,r,n){t(r),n&&n(!0===r?null:r)}},function(e,t,r){"use strict";function n(e){return e}var i=r(122);e.exports=function e(t){return t?(t=i(t),function(e){return function(r,n){e(r,function(r,i){try{i=r?null:t(i)}catch(t){return e(t,function(){return n(t)})}n(r,i)})}}):n}},function(e,t,r){var n=r(122);function i(e){return e}e.exports=function e(t){return"object"==typeof t&&"function"==typeof t.test?function(e){return t.test(e)}:n(t)||i}},function(e,t,r){"use strict";e.exports=function e(t,r){var n=!1;function i(e){!n&&r&&(n=!0,r(!0===e?null:e))}return function(e){return function(r,n){return r&&i(r),e(r,function(e,r){e?i(e):t&&t(r),n(e,r)})}}}},function(e,t,r){"use strict";function n(e){return e}var i=r(122),o=r(124);e.exports=function e(t,r){t=i(t)||n;var s={};return o(function(e){var n=t(e);return s[n]?!!r:(s[n]=!0,!r)})}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=h;var n=r(54),i=l(n),o=r(104),s=l(o),a=r(105),u=l(a),c=r(32),f=l(c);function l(e){return e&&e.__esModule?e:{default:e}}function h(e,t,r){r=(0,u.default)(r||i.default);var n=(0,f.default)(e),o=function(e){if(e)return r(e);var i=(0,s.default)(arguments,1);if(t.apply(this,i))return n(o);r.apply(null,[null].concat(i))};n(o)}e.exports=t.default},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){return function(){var t=(0,i.default)(arguments),r=t.pop();e.call(this,t,r)}};var n=r(104),i=o(n);function o(e){return e&&e.__esModule?e:{default:e}}e.exports=t.default},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=h;var n=r(54),i=l(n),o=r(125),s=l(o),a=r(104),u=l(a),c=r(32),f=l(c);function l(e){return e&&e.__esModule?e:{default:e}}function h(e,t,r){r=r||i.default;var n=(0,s.default)(t)?[]:{};e(t,function(e,t,r){(0,f.default)(e)(function(e,i){arguments.length>2&&(i=(0,u.default)(arguments,1)),n[t]=i,r(e)})},function(e){r(e,n)})}e.exports=t.default},function(e,t,r){(function(t){var r="object"==typeof t&&t&&t.Object===Object&&t;e.exports=r}).call(this,r(7))},function(e,t){var r=9007199254740991;function n(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=r}e.exports=n},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=u;var n=r(216),i=a(n),o=r(32),s=a(o);function a(e){return e&&e.__esModule?e:{default:e}}function u(e,t,r,n){(0,i.default)(t)(e,(0,s.default)(r),n)}e.exports=t.default},function(e,t,r){var n=r(662),i=r(672),o=r(125);function s(e){return o(e)?n(e):i(e)}e.exports=s},function(e,t,r){var n=r(664),i=r(159),o=Object.prototype,s=o.hasOwnProperty,a=o.propertyIsEnumerable,u=n(function(){return arguments}())?n:function(e){return i(e)&&s.call(e,"callee")&&!a.call(e,"callee")};e.exports=u},function(e,t,r){"use strict";function n(e){return function(t,r,n){return e(t,n)}}Object.defineProperty(t,"__esModule",{value:!0}),t.default=n,e.exports=t.default},function(e,t,r){"use strict";(function(t){const n=r(218),i="/",o=t.from(i),s=o[0];class a{constructor(e,r){if("string"==typeof e?this._buf=t.from(e):t.isBuffer(e)&&(this._buf=e),null==r&&(r=!0),r&&this.clean(),0===this._buf.length||this._buf[0]!==s)throw new Error(`Invalid key: ${this.toString()}`)}toString(e){return this._buf.toString(e||"utf8")}toBuffer(){return this._buf}get[Symbol.toStringTag](){return`[Key ${this.toString()}]`}static withNamespaces(e){return new a(e.join(i))}static random(){return new a(n().replace(/-/g,""))}clean(){for(this._buf&&0!==this._buf.length||(this._buf=t.from(i)),this._buf[0]!==s&&(this._buf=t.concat([o,this._buf]));this._buf.length>1&&this._buf[this._buf.length-1]===s;)this._buf=this._buf.slice(0,-1)}less(e){const t=this.list(),r=e.list();for(let e=0;e<t.length;e++){if(r.length<e+1)return!1;const n=t[e],i=r[e];if(n<i)return!0;if(n>i)return!1}return t.length<r.length}reverse(){return a.withNamespaces(this.list().slice().reverse())}namespaces(){return this.list()}baseNamespace(){const e=this.namespaces();return e[e.length-1]}list(){return this.toString().split(i).slice(1)}type(){return u(this.baseNamespace())}name(){return c(this.baseNamespace())}instance(e){return new a(this.toString()+":"+e)}path(){let e=this.parent().toString();return e.endsWith(i)||(e+=i),e+=this.type(),new a(e)}parent(){const e=this.list();return 1===e.length?new a(i):new a(e.slice(0,-1).join(i))}child(e){return this.toString()===i?e:e.toString()===i?this:new a(this.toString()+e.toString(),!1)}isAncestorOf(e){return e.toString()!==this.toString()&&e.toString().startsWith(this.toString())}isDecendantOf(e){return e.toString()!==this.toString()&&this.toString().startsWith(e.toString())}isTopLevel(){return 1===this.list().length}}function u(e){const t=e.split(":");return t.length<2?"":t.slice(0,-1).join(":")}function c(e){const t=e.split(":");return t[t.length-1]}e.exports=a}).call(this,r(0).Buffer)},function(e,t){var r="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof window.msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto);if(r){var n=new Uint8Array(16);e.exports=function e(){return r(n),n}}else{var i=new Array(16);e.exports=function e(){for(var t=0,r;t<16;t++)0==(3&t)&&(r=4294967296*Math.random()),i[t]=r>>>((3&t)<<3)&255;return i}}},function(e,t){for(var r=[],n=0;n<256;++n)r[n]=(n+256).toString(16).substr(1);function i(e,t){var n=t||0,i=r;return[i[e[n++]],i[e[n++]],i[e[n++]],i[e[n++]],"-",i[e[n++]],i[e[n++]],"-",i[e[n++]],i[e[n++]],"-",i[e[n++]],i[e[n++]],"-",i[e[n++]],i[e[n++]],i[e[n++]],i[e[n++]],i[e[n++]],i[e[n++]]].join("")}e.exports=i},function(e,t){t.endianness=function(){return"LE"},t.hostname=function(){return"undefined"!=typeof location?location.hostname:""},t.loadavg=function(){return[]},t.uptime=function(){return 0},t.freemem=function(){return Number.MAX_VALUE},t.totalmem=function(){return Number.MAX_VALUE},t.cpus=function(){return[]},t.type=function(){return"Browser"},t.release=function(){return"undefined"!=typeof navigator?navigator.appVersion:""},t.networkInterfaces=t.getNetworkInterfaces=function(){return{}},t.arch=function(){return"javascript"},t.platform=function(){return"browser"},t.tmpdir=t.tmpDir=function(){return"/tmp"},t.EOL="\n",t.homedir=function(){return"/"}},function(e,t,r){(function(t){var r="Expected a function",n="__lodash_hash_undefined__",i=1/0,o=9007199254740991,s="[object Function]",a="[object GeneratorFunction]",u="[object Symbol]",c=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,f=/^\w*$/,l=/^\./,h=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,p=/[\\^$.*+?()[\]{}|]/g,d=/\\(\\)?/g,y=/^\[object .+?Constructor\]$/,g=/^(?:0|[1-9]\d*)$/,m="object"==typeof t&&t&&t.Object===Object&&t,b="object"==typeof self&&self&&self.Object===Object&&self,v=m||b||Function("return this")();function _(e,t){return null==e?void 0:e[t]}function w(e){var t=!1;if(null!=e&&"function"!=typeof e.toString)try{t=!!(e+"")}catch(e){}return t}var S=Array.prototype,k=Function.prototype,E=Object.prototype,A=v["__core-js_shared__"],x=(I=/[^.]+$/.exec(A&&A.keys&&A.keys.IE_PROTO||""),I?"Symbol(src)_1."+I:""),I,T=k.toString,B=E.hasOwnProperty,C=E.toString,P=RegExp("^"+T.call(B).replace(p,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),O=v.Symbol,R=S.splice,N=ce(v,"Map"),L=ce(Object,"create"),j=O?O.prototype:void 0,M=j?j.toString:void 0;function K(e){var t=-1,r=e?e.length:0;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}function D(){this.__data__=L?L(null):{}}function U(e){return this.has(e)&&delete this.__data__[e]}function F(e){var t=this.__data__;if(L){var r=t[e];return r===n?void 0:r}return B.call(t,e)?t[e]:void 0}function q(e){var t=this.__data__;return L?void 0!==t[e]:B.call(t,e)}function H(e,t){var r=this.__data__;return r[e]=L&&void 0===t?n:t,this}function z(e){var t=-1,r=e?e.length:0;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}function V(){this.__data__=[]}function G(e){var t=this.__data__,r=ne(t,e);if(r<0)return!1;var n=t.length-1;return r==n?t.pop():R.call(t,r,1),!0}function W(e){var t=this.__data__,r=ne(t,e);return r<0?void 0:t[r][1]}function $(e){return ne(this.__data__,e)>-1}function Y(e,t){var r=this.__data__,n=ne(r,e);return n<0?r.push([e,t]):r[n][1]=t,this}function J(e){var t=-1,r=e?e.length:0;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}function X(){this.__data__={hash:new K,map:new(N||z),string:new K}}function Z(e){return ue(this,e).delete(e)}function Q(e){return ue(this,e).get(e)}function ee(e){return ue(this,e).has(e)}function te(e,t){return ue(this,e).set(e,t),this}function re(e,t,r){var n=e[t];B.call(e,t)&&be(n,r)&&(void 0!==r||t in e)||(e[t]=r)}function ne(e,t){for(var r=e.length;r--;)if(be(e[r][0],t))return r;return-1}function ie(e){if(!we(e)||pe(e))return!1;var t=_e(e)||w(e)?P:y;return t.test(ge(e))}function oe(e,t,r,n){if(!we(e))return e;t=le(t,e)?[t]:ae(t);for(var i=-1,o=t.length,s=o-1,a=e;null!=a&&++i<o;){var u=ye(t[i]),c=r;if(i!=s){var f=a[u];c=n?n(f,u,a):void 0,void 0===c&&(c=we(f)?f:fe(t[i+1])?[]:{})}re(a,u,c),a=a[u]}return e}function se(e){if("string"==typeof e)return e;if(ke(e))return M?M.call(e):"";var t=e+"";return"0"==t&&1/e==-i?"-0":t}function ae(e){return ve(e)?e:de(e)}function ue(e,t){var r=e.__data__;return he(t)?r["string"==typeof t?"string":"hash"]:r.map}function ce(e,t){var r=_(e,t);return ie(r)?r:void 0}function fe(e,t){return t=null==t?o:t,!!t&&("number"==typeof e||g.test(e))&&e>-1&&e%1==0&&e<t}function le(e,t){if(ve(e))return!1;var r=typeof e;return!("number"!=r&&"symbol"!=r&&"boolean"!=r&&null!=e&&!ke(e))||(f.test(e)||!c.test(e)||null!=t&&e in Object(t))}function he(e){var t=typeof e;return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e}function pe(e){return!!x&&x in e}K.prototype.clear=D,K.prototype.delete=U,K.prototype.get=F,K.prototype.has=q,K.prototype.set=H,z.prototype.clear=V,z.prototype.delete=G,z.prototype.get=W,z.prototype.has=$,z.prototype.set=Y,J.prototype.clear=X,J.prototype.delete=Z,J.prototype.get=Q,J.prototype.has=ee,J.prototype.set=te;var de=me(function(e){e=Ee(e);var t=[];return l.test(e)&&t.push(""),e.replace(h,function(e,r,n,i){t.push(n?i.replace(d,"$1"):r||e)}),t});function ye(e){if("string"==typeof e||ke(e))return e;var t=e+"";return"0"==t&&1/e==-i?"-0":t}function ge(e){if(null!=e){try{return T.call(e)}catch(e){}try{return e+""}catch(e){}}return""}function me(e,t){if("function"!=typeof e||t&&"function"!=typeof t)throw new TypeError(r);var n=function(){var r=arguments,i=t?t.apply(this,r):r[0],o=n.cache;if(o.has(i))return o.get(i);var s=e.apply(this,r);return n.cache=o.set(i,s),s};return n.cache=new(me.Cache||J),n}function be(e,t){return e===t||e!=e&&t!=t}me.Cache=J;var ve=Array.isArray;function _e(e){var t=we(e)?C.call(e):"";return t==s||t==a}function we(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function Se(e){return!!e&&"object"==typeof e}function ke(e){return"symbol"==typeof e||Se(e)&&C.call(e)==u}function Ee(e){return null==e?"":se(e)}function Ae(e,t,r){return null==e?e:oe(e,t,r)}e.exports=Ae}).call(this,r(7))},function(e,t,r){(function(t){var r="Expected a function",n="__lodash_hash_undefined__",i=1/0,o=9007199254740991,s="[object Arguments]",a="[object Function]",u="[object GeneratorFunction]",c="[object Symbol]",f=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,l=/^\w*$/,h=/^\./,p=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,d=/[\\^$.*+?()[\]{}|]/g,y=/\\(\\)?/g,g=/^\[object .+?Constructor\]$/,m=/^(?:0|[1-9]\d*)$/,b="object"==typeof t&&t&&t.Object===Object&&t,v="object"==typeof self&&self&&self.Object===Object&&self,_=b||v||Function("return this")();function w(e,t){return null==e?void 0:e[t]}function S(e){var t=!1;if(null!=e&&"function"!=typeof e.toString)try{t=!!(e+"")}catch(e){}return t}var k=Array.prototype,E=Function.prototype,A=Object.prototype,x=_["__core-js_shared__"],I=(T=/[^.]+$/.exec(x&&x.keys&&x.keys.IE_PROTO||""),T?"Symbol(src)_1."+T:""),T,B=E.toString,C=A.hasOwnProperty,P=A.toString,O=RegExp("^"+B.call(C).replace(d,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),R=_.Symbol,N=A.propertyIsEnumerable,L=k.splice,j=fe(_,"Map"),M=fe(Object,"create"),K=R?R.prototype:void 0,D=K?K.toString:void 0;function U(e){var t=-1,r=e?e.length:0;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}function F(){this.__data__=M?M(null):{}}function q(e){return this.has(e)&&delete this.__data__[e]}function H(e){var t=this.__data__;if(M){var r=t[e];return r===n?void 0:r}return C.call(t,e)?t[e]:void 0}function z(e){var t=this.__data__;return M?void 0!==t[e]:C.call(t,e)}function V(e,t){var r=this.__data__;return r[e]=M&&void 0===t?n:t,this}function G(e){var t=-1,r=e?e.length:0;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}function W(){this.__data__=[]}function $(e){var t=this.__data__,r=ie(t,e);if(r<0)return!1;var n=t.length-1;return r==n?t.pop():L.call(t,r,1),!0}function Y(e){var t=this.__data__,r=ie(t,e);return r<0?void 0:t[r][1]}function J(e){return ie(this.__data__,e)>-1}function X(e,t){var r=this.__data__,n=ie(r,e);return n<0?r.push([e,t]):r[n][1]=t,this}function Z(e){var t=-1,r=e?e.length:0;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}function Q(){this.__data__={hash:new U,map:new(j||G),string:new U}}function ee(e){return ce(this,e).delete(e)}function te(e){return ce(this,e).get(e)}function re(e){return ce(this,e).has(e)}function ne(e,t){return ce(this,e).set(e,t),this}function ie(e,t){for(var r=e.length;r--;)if(_e(e[r][0],t))return r;return-1}function oe(e,t){return null!=e&&C.call(e,t)}function se(e){if(!Ie(e)||ye(e))return!1;var t=Ae(e)||S(e)?O:g;return t.test(be(e))}function ae(e){if("string"==typeof e)return e;if(Be(e))return D?D.call(e):"";var t=e+"";return"0"==t&&1/e==-i?"-0":t}function ue(e){return Se(e)?e:ge(e)}function ce(e,t){var r=e.__data__;return de(t)?r["string"==typeof t?"string":"hash"]:r.map}function fe(e,t){var r=w(e,t);return se(r)?r:void 0}function le(e,t,r){t=pe(t,e)?[t]:ue(t);for(var n,i=-1,o=t.length;++i<o;){var s=me(t[i]);if(!(n=null!=e&&r(e,s)))break;e=e[s]}if(n)return n;var o=e?e.length:0;return!!o&&xe(o)&&he(s,o)&&(Se(e)||we(e))}function he(e,t){return t=null==t?o:t,!!t&&("number"==typeof e||m.test(e))&&e>-1&&e%1==0&&e<t}function pe(e,t){if(Se(e))return!1;var r=typeof e;return!("number"!=r&&"symbol"!=r&&"boolean"!=r&&null!=e&&!Be(e))||(l.test(e)||!f.test(e)||null!=t&&e in Object(t))}function de(e){var t=typeof e;return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e}function ye(e){return!!I&&I in e}U.prototype.clear=F,U.prototype.delete=q,U.prototype.get=H,U.prototype.has=z,U.prototype.set=V,G.prototype.clear=W,G.prototype.delete=$,G.prototype.get=Y,G.prototype.has=J,G.prototype.set=X,Z.prototype.clear=Q,Z.prototype.delete=ee,Z.prototype.get=te,Z.prototype.has=re,Z.prototype.set=ne;var ge=ve(function(e){e=Ce(e);var t=[];return h.test(e)&&t.push(""),e.replace(p,function(e,r,n,i){t.push(n?i.replace(y,"$1"):r||e)}),t});function me(e){if("string"==typeof e||Be(e))return e;var t=e+"";return"0"==t&&1/e==-i?"-0":t}function be(e){if(null!=e){try{return B.call(e)}catch(e){}try{return e+""}catch(e){}}return""}function ve(e,t){if("function"!=typeof e||t&&"function"!=typeof t)throw new TypeError(r);var n=function(){var r=arguments,i=t?t.apply(this,r):r[0],o=n.cache;if(o.has(i))return o.get(i);var s=e.apply(this,r);return n.cache=o.set(i,s),s};return n.cache=new(ve.Cache||Z),n}function _e(e,t){return e===t||e!=e&&t!=t}function we(e){return Ee(e)&&C.call(e,"callee")&&(!N.call(e,"callee")||P.call(e)==s)}ve.Cache=Z;var Se=Array.isArray;function ke(e){return null!=e&&xe(e.length)&&!Ae(e)}function Ee(e){return Te(e)&&ke(e)}function Ae(e){var t=Ie(e)?P.call(e):"";return t==a||t==u}function xe(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=o}function Ie(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function Te(e){return!!e&&"object"==typeof e}function Be(e){return"symbol"==typeof e||Te(e)&&P.call(e)==c}function Ce(e){return null==e?"":ae(e)}function Pe(e,t){return null!=e&&le(e,t,oe)}e.exports=Pe}).call(this,r(7))},function(e,t,r){"use strict";const n=r(163),i=r(689),o=r(691),s=r(693),a=r(694),u=r(360);t.KeytransformDatastore=n,t.ShardingDatastore=i,t.MountDatastore=o,t.TieredDatastore=s,t.NamespaceDatastore=a,t.shard=u},function(e,t,r){"use strict";const n=r(361),i=r(26).Key,o=r(690),s=t.PREFIX="/repo/flatfs/shard/",a=t.SHARDING_FN="SHARDING";t.README_FN="_README";class u{constructor(e){this.param=e}fun(e){throw new Error("implement me")}toString(){return`${s}v1/${this.name}/${this.param}`}}class c extends u{constructor(e){super(e),this._padding=n("",e,"_"),this.name="prefix"}fun(e){return(e+this._padding).slice(0,this.param)}}class f extends u{constructor(e){super(e),this._padding=n("",e,"_"),this.name="suffix"}fun(e){const t=this._padding+e;return t.slice(t.length-this.param)}}class l extends u{constructor(e){super(e),this._padding=n("",e+1,"_"),this.name="next-to-last"}fun(e){const t=this._padding+e,r=t.length-this.param-1;return t.slice(r,r+this.param)}}function h(e){if(e=e.trim(),0===e.length)throw new Error("empty shard string");if(!e.startsWith(s))throw new Error(`invalid or no path prefix: ${e}`);const t=e.slice(s.length).split("/"),r=t[0];if("v1"!==r)throw new Error(`expect 'v1' version, got '${r}'`);const n=t[1];if(!t[2])throw new Error("missing param");const i=parseInt(t[2],10);switch(n){case"prefix":return new c(i);case"suffix":return new f(i);case"next-to-last":return new l(i);default:throw new Error(`unkown sharding function: ${n}`)}}t.readShardFun=((e,t,r)=>{const n=new i(e).child(new i(a)),o="function"==typeof t.getRaw?t.getRaw.bind(t):t.get.bind(t);o(n,(e,t)=>{if(e)return r(e);let n;try{n=h((t||"").toString().trim())}catch(e){return r(e)}r(null,n)})}),t.readme=o,t.parseShardFun=h,t.Prefix=c,t.Suffix=f,t.NextToLast=l},function(e,t,r){"use strict";e.exports=i;var n=[""," "," "," "," "," "," "," "," "," "];function i(e,t,r){if(e+="",t-=e.length,t<=0)return e;if(r||0===r||(r=" "),r+=""," "===r&&t<10)return n[t]+e;for(var i="";1&t&&(i+=r),t>>=1,t;)r+=r;return i+e}},function(e,t,r){"use strict";var n=function(e,t){return t||(t={}),e.split("").forEach(function(e,r){e in t||(t[e]=r)}),t},i={alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",charmap:{0:14,1:8}};i.charmap=n(i.alphabet,i.charmap);var o={alphabet:"0123456789ABCDEFGHJKMNPQRSTVWXYZ",charmap:{O:0,I:1,L:1}};o.charmap=n(o.alphabet,o.charmap);var s={alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",charmap:{}};function a(e){if(this.buf=[],this.shift=8,this.carry=0,e){switch(e.type){case"rfc4648":this.charmap=t.rfc4648.charmap;break;case"crockford":this.charmap=t.crockford.charmap;break;case"base32hex":this.charmap=t.base32hex.charmap;break;default:throw new Error("invalid type")}e.charmap&&(this.charmap=e.charmap)}}function u(e){if(this.buf="",this.shift=3,this.carry=0,e){switch(e.type){case"rfc4648":this.alphabet=t.rfc4648.alphabet;break;case"crockford":this.alphabet=t.crockford.alphabet;break;case"base32hex":this.alphabet=t.base32hex.alphabet;break;default:throw new Error("invalid type")}e.alphabet?this.alphabet=e.alphabet:e.lc&&(this.alphabet=this.alphabet.toLowerCase())}}s.charmap=n(s.alphabet,s.charmap),a.prototype.charmap=i.charmap,a.prototype.write=function(e){var t=this.charmap,r=this.buf,n=this.shift,i=this.carry;return e.toUpperCase().split("").forEach(function(e){if("="!=e){var o=255&t[e];n-=5,n>0?i|=o<<n:n<0?(r.push(i|o>>-n),n+=8,i=o<<n&255):(r.push(i|o),n=8,i=0)}}),this.shift=n,this.carry=i,this},a.prototype.finalize=function(e){return e&&this.write(e),8!==this.shift&&0!==this.carry&&(this.buf.push(this.carry),this.shift=8,this.carry=0),this.buf},u.prototype.alphabet=i.alphabet,u.prototype.write=function(e){var t=this.shift,r=this.carry,n,i,o;for(o=0;o<e.length;o++)i=e[o],n=r|i>>t,this.buf+=this.alphabet[31&n],t>5&&(t-=5,n=i>>t,this.buf+=this.alphabet[31&n]),t=5-t,r=i<<t,t=8-t;return this.shift=t,this.carry=r,this},u.prototype.finalize=function(e){return e&&this.write(e),3!==this.shift&&(this.buf+=this.alphabet[31&this.carry],this.shift=3,this.carry=0),this.buf},t.encode=function(e,t){return new u(t).finalize(e)},t.decode=function(e,t){return new a(t).finalize(e)},t.Decoder=a,t.Encoder=u,t.charmap=n,t.crockford=o,t.rfc4648=i,t.base32hex=s},function(e,t,r){t.AbstractLevelDOWN=r(701),t.AbstractIterator=r(364),t.AbstractChainedBatch=r(365)},function(e,t,r){(function(t){function r(e){this.db=e,this._ended=!1,this._nexting=!1}r.prototype.next=function(e){var r=this;if("function"!=typeof e)throw new Error("next() requires a callback argument");return r._ended?(t.nextTick(e,new Error("cannot call next() after end()")),r):r._nexting?(t.nextTick(e,new Error("cannot call next() before previous next() has completed")),r):(r._nexting=!0,r._next(function(){r._nexting=!1,e.apply(null,arguments)}),r)},r.prototype._next=function(e){t.nextTick(e)},r.prototype.end=function(e){if("function"!=typeof e)throw new Error("end() requires a callback argument");if(this._ended)return t.nextTick(e,new Error("end() already called on iterator"));this._ended=!0,this._end(e)},r.prototype._end=function(e){t.nextTick(e)},e.exports=r}).call(this,r(6))},function(e,t,r){(function(t){function r(e){this._db=e,this._operations=[],this._written=!1}r.prototype._serializeKey=function(e){return this._db._serializeKey(e)},r.prototype._serializeValue=function(e){return this._db._serializeValue(e)},r.prototype._checkWritten=function(){if(this._written)throw new Error("write() already called on this batch")},r.prototype.put=function(e,t){this._checkWritten();var r=this._db._checkKey(e,"key");if(r)throw r;return e=this._serializeKey(e),t=this._serializeValue(t),this._put(e,t),this},r.prototype._put=function(e,t){this._operations.push({type:"put",key:e,value:t})},r.prototype.del=function(e){this._checkWritten();var t=this._db._checkKey(e,"key");if(t)throw t;return e=this._serializeKey(e),this._del(e),this},r.prototype._del=function(e){this._operations.push({type:"del",key:e})},r.prototype.clear=function(){return this._checkWritten(),this._operations=[],this._clear(),this},r.prototype._clear=function e(){},r.prototype.write=function(e,r){if(this._checkWritten(),"function"==typeof e&&(r=e),"function"!=typeof r)throw new Error("write() requires a callback argument");return"object"!=typeof e&&(e={}),this._written=!0,"function"==typeof this._write?this._write(r):"function"==typeof this._db._batch?this._db._batch(this._operations,e,r):void t.nextTick(r)},e.exports=r}).call(this,r(6))},function(e,t,r){var n=r(367).create,i=n("LevelUPError"),o=n("NotFoundError",i);o.prototype.notFound=!0,o.prototype.status=404,e.exports={LevelUPError:i,InitializationError:n("InitializationError",i),OpenError:n("OpenError",i),ReadError:n("ReadError",i),WriteError:n("WriteError",i),NotFoundError:o,EncodingError:n("EncodingError",i)}},function(e,t,r){var n=e.exports.all=[{errno:-2,code:"ENOENT",description:"no such file or directory"},{errno:-1,code:"UNKNOWN",description:"unknown error"},{errno:0,code:"OK",description:"success"},{errno:1,code:"EOF",description:"end of file"},{errno:2,code:"EADDRINFO",description:"getaddrinfo error"},{errno:3,code:"EACCES",description:"permission denied"},{errno:4,code:"EAGAIN",description:"resource temporarily unavailable"},{errno:5,code:"EADDRINUSE",description:"address already in use"},{errno:6,code:"EADDRNOTAVAIL",description:"address not available"},{errno:7,code:"EAFNOSUPPORT",description:"address family not supported"},{errno:8,code:"EALREADY",description:"connection already in progress"},{errno:9,code:"EBADF",description:"bad file descriptor"},{errno:10,code:"EBUSY",description:"resource busy or locked"},{errno:11,code:"ECONNABORTED",description:"software caused connection abort"},{errno:12,code:"ECONNREFUSED",description:"connection refused"},{errno:13,code:"ECONNRESET",description:"connection reset by peer"},{errno:14,code:"EDESTADDRREQ",description:"destination address required"},{errno:15,code:"EFAULT",description:"bad address in system call argument"},{errno:16,code:"EHOSTUNREACH",description:"host is unreachable"},{errno:17,code:"EINTR",description:"interrupted system call"},{errno:18,code:"EINVAL",description:"invalid argument"},{errno:19,code:"EISCONN",description:"socket is already connected"},{errno:20,code:"EMFILE",description:"too many open files"},{errno:21,code:"EMSGSIZE",description:"message too long"},{errno:22,code:"ENETDOWN",description:"network is down"},{errno:23,code:"ENETUNREACH",description:"network is unreachable"},{errno:24,code:"ENFILE",description:"file table overflow"},{errno:25,code:"ENOBUFS",description:"no buffer space available"},{errno:26,code:"ENOMEM",description:"not enough memory"},{errno:27,code:"ENOTDIR",description:"not a directory"},{errno:28,code:"EISDIR",description:"illegal operation on a directory"},{errno:29,code:"ENONET",description:"machine is not on the network"},{errno:31,code:"ENOTCONN",description:"socket is not connected"},{errno:32,code:"ENOTSOCK",description:"socket operation on non-socket"},{errno:33,code:"ENOTSUP",description:"operation not supported on socket"},{errno:34,code:"ENOENT",description:"no such file or directory"},{errno:35,code:"ENOSYS",description:"function not implemented"},{errno:36,code:"EPIPE",description:"broken pipe"},{errno:37,code:"EPROTO",description:"protocol error"},{errno:38,code:"EPROTONOSUPPORT",description:"protocol not supported"},{errno:39,code:"EPROTOTYPE",description:"protocol wrong type for socket"},{errno:40,code:"ETIMEDOUT",description:"connection timed out"},{errno:41,code:"ECHARSET",description:"invalid Unicode character"},{errno:42,code:"EAIFAMNOSUPPORT",description:"address family for hostname not supported"},{errno:44,code:"EAISERVICE",description:"servname not supported for ai_socktype"},{errno:45,code:"EAISOCKTYPE",description:"ai_socktype not supported"},{errno:46,code:"ESHUTDOWN",description:"cannot send after transport endpoint shutdown"},{errno:47,code:"EEXIST",description:"file already exists"},{errno:48,code:"ESRCH",description:"no such process"},{errno:49,code:"ENAMETOOLONG",description:"name too long"},{errno:50,code:"EPERM",description:"operation not permitted"},{errno:51,code:"ELOOP",description:"too many symbolic links encountered"},{errno:52,code:"EXDEV",description:"cross-device link not permitted"},{errno:53,code:"ENOTEMPTY",description:"directory not empty"},{errno:54,code:"ENOSPC",description:"no space left on device"},{errno:55,code:"EIO",description:"i/o error"},{errno:56,code:"EROFS",description:"read-only file system"},{errno:57,code:"ENODEV",description:"no such device"},{errno:58,code:"ESPIPE",description:"invalid seek"},{errno:59,code:"ECANCELED",description:"operation canceled"}];e.exports.errno={},e.exports.code={},n.forEach(function(t){e.exports.errno[t.errno]=t,e.exports.code[t.code]=t}),e.exports.custom=r(705)(e.exports),e.exports.create=e.exports.custom.createError},function(e,t){function r(){var e,t=new Promise(function(t,r){e=function e(n,i){n?r(n):t(i)}});return e.promise=t,e}e.exports=r},function(e,t,r){(function(t){function r(e){this.db=e,this._ended=!1,this._nexting=!1}r.prototype.next=function(e){var r=this;if("function"!=typeof e)throw new Error("next() requires a callback argument");return r._ended?(t.nextTick(e,new Error("cannot call next() after end()")),r):r._nexting?(t.nextTick(e,new Error("cannot call next() before previous next() has completed")),r):(r._nexting=!0,r._next(function(){r._nexting=!1,e.apply(null,arguments)}),r)},r.prototype._next=function(e){t.nextTick(e)},r.prototype.end=function(e){if("function"!=typeof e)throw new Error("end() requires a callback argument");if(this._ended)return t.nextTick(e,new Error("end() already called on iterator"));this._ended=!0,this._end(e)},r.prototype._end=function(e){t.nextTick(e)},e.exports=r}).call(this,r(6))},function(e,t,r){(function(t){function r(e){this._db=e,this._operations=[],this._written=!1}r.prototype._serializeKey=function(e){return this._db._serializeKey(e)},r.prototype._serializeValue=function(e){return this._db._serializeValue(e)},r.prototype._checkWritten=function(){if(this._written)throw new Error("write() already called on this batch")},r.prototype.put=function(e,t){this._checkWritten();var r=this._db._checkKey(e,"key");if(r)throw r;return e=this._serializeKey(e),t=this._serializeValue(t),this._put(e,t),this},r.prototype._put=function(e,t){this._operations.push({type:"put",key:e,value:t})},r.prototype.del=function(e){this._checkWritten();var t=this._db._checkKey(e,"key");if(t)throw t;return e=this._serializeKey(e),this._del(e),this},r.prototype._del=function(e){this._operations.push({type:"del",key:e})},r.prototype.clear=function(){return this._checkWritten(),this._operations=[],this._clear(),this},r.prototype._clear=function e(){},r.prototype.write=function(e,r){if(this._checkWritten(),"function"==typeof e&&(r=e),"function"!=typeof r)throw new Error("write() requires a callback argument");return"object"!=typeof e&&(e={}),this._written=!0,"function"==typeof this._write?this._write(r):"function"==typeof this._db._batch?this._db._batch(this._operations,e,r):void t.nextTick(r)},e.exports=r}).call(this,r(6))},function(e,t,r){t.AbstractLevelDOWN=r(372),t.AbstractIterator=r(373),t.AbstractChainedBatch=r(374),t.isLevelDOWN=r(713)},function(e,t,r){(function(t,n){var i=r(27),o=r(373),s=r(374);function a(e){if(!arguments.length||void 0===e)throw new Error("constructor requires at least a location argument");if("string"!=typeof e)throw new Error("constructor requires a location string argument");this.location=e,this.status="new"}a.prototype.open=function(e,r){var n=this,i=this.status;if("function"==typeof e&&(r=e),"function"!=typeof r)throw new Error("open() requires a callback argument");"object"!=typeof e&&(e={}),e.createIfMissing=0!=e.createIfMissing,e.errorIfExists=!!e.errorIfExists,"function"==typeof this._open?(this.status="opening",this._open(e,function(e){if(e)return n.status=i,r(e);n.status="open",r()})):(this.status="open",t.nextTick(r))},a.prototype.close=function(e){var r=this,n=this.status;if("function"!=typeof e)throw new Error("close() requires a callback argument");"function"==typeof this._close?(this.status="closing",this._close(function(t){if(t)return r.status=n,e(t);r.status="closed",e()})):(this.status="closed",t.nextTick(e))},a.prototype.get=function(e,r,n){var i;if("function"==typeof r&&(n=r),"function"!=typeof n)throw new Error("get() requires a callback argument");return(i=this._checkKey(e,"key",this._isBuffer))?n(i):(this._isBuffer(e)||(e=String(e)),"object"!=typeof r&&(r={}),r.asBuffer=0!=r.asBuffer,"function"==typeof this._get?this._get(e,r,n):void t.nextTick(function(){n(new Error("NotFound"))}))},a.prototype.put=function(e,r,n,i){var o;if("function"==typeof n&&(i=n),"function"!=typeof i)throw new Error("put() requires a callback argument");return(o=this._checkKey(e,"key",this._isBuffer))?i(o):(this._isBuffer(e)||(e=String(e)),null==r||this._isBuffer(r)||t.browser||(r=String(r)),"object"!=typeof n&&(n={}),"function"==typeof this._put?this._put(e,r,n,i):void t.nextTick(i))},a.prototype.del=function(e,r,n){var i;if("function"==typeof r&&(n=r),"function"!=typeof n)throw new Error("del() requires a callback argument");return(i=this._checkKey(e,"key",this._isBuffer))?n(i):(this._isBuffer(e)||(e=String(e)),"object"!=typeof r&&(r={}),"function"==typeof this._del?this._del(e,r,n):void t.nextTick(n))},a.prototype.batch=function(e,r,n){if(!arguments.length)return this._chainedBatch();if("function"==typeof r&&(n=r),"function"==typeof e&&(n=e),"function"!=typeof n)throw new Error("batch(array) requires a callback argument");if(!Array.isArray(e))return n(new Error("batch(array) requires an array argument"));r&&"object"==typeof r||(r={});for(var i=0,o=e.length,s,a;i<o;i++)if(s=e[i],"object"==typeof s){if(a=this._checkKey(s.type,"type",this._isBuffer))return n(a);if(a=this._checkKey(s.key,"key",this._isBuffer))return n(a)}if("function"==typeof this._batch)return this._batch(e,r,n);t.nextTick(n)},a.prototype.approximateSize=function(e,r,n){if(null==e||null==r||"function"==typeof e||"function"==typeof r)throw new Error("approximateSize() requires valid `start`, `end` and `callback` arguments");if("function"!=typeof n)throw new Error("approximateSize() requires a callback argument");if(this._isBuffer(e)||(e=String(e)),this._isBuffer(r)||(r=String(r)),"function"==typeof this._approximateSize)return this._approximateSize(e,r,n);t.nextTick(function(){n(null,0)})},a.prototype._setupIteratorOptions=function(e){var t=this;return e=i(e),["start","end","gt","gte","lt","lte"].forEach(function(r){e[r]&&t._isBuffer(e[r])&&0===e[r].length&&delete e[r]}),e.reverse=!!e.reverse,e.keys=0!=e.keys,e.values=0!=e.values,e.limit="limit"in e?e.limit:-1,e.keyAsBuffer=0!=e.keyAsBuffer,e.valueAsBuffer=0!=e.valueAsBuffer,e},a.prototype.iterator=function(e){return"object"!=typeof e&&(e={}),e=this._setupIteratorOptions(e),"function"==typeof this._iterator?this._iterator(e):new o(this)},a.prototype._chainedBatch=function(){return new s(this)},a.prototype._isBuffer=function(e){return n.isBuffer(e)},a.prototype._checkKey=function(e,t){if(null===e||void 0===e)return new Error(t+" cannot be `null` or `undefined`");if(this._isBuffer(e)){if(0===e.length)return new Error(t+" cannot be an empty Buffer")}else if(""===String(e))return new Error(t+" cannot be an empty String")},e.exports=a}).call(this,r(6),r(0).Buffer)},function(e,t,r){(function(t){function r(e){this.db=e,this._ended=!1,this._nexting=!1}r.prototype.next=function(e){var r=this;if("function"!=typeof e)throw new Error("next() requires a callback argument");return r._ended?e(new Error("cannot call next() after end()")):r._nexting?e(new Error("cannot call next() before previous next() has completed")):(r._nexting=!0,"function"==typeof r._next?r._next(function(){r._nexting=!1,e.apply(null,arguments)}):void t.nextTick(function(){r._nexting=!1,e()}))},r.prototype.end=function(e){if("function"!=typeof e)throw new Error("end() requires a callback argument");return this._ended?e(new Error("end() already called on iterator")):(this._ended=!0,"function"==typeof this._end?this._end(e):void t.nextTick(e))},e.exports=r}).call(this,r(6))},function(e,t,r){(function(t){function r(e){this._db=e,this._operations=[],this._written=!1}r.prototype._checkWritten=function(){if(this._written)throw new Error("write() already called on this batch")},r.prototype.put=function(e,t){this._checkWritten();var r=this._db._checkKey(e,"key",this._db._isBuffer);if(r)throw r;return this._db._isBuffer(e)||(e=String(e)),this._db._isBuffer(t)||(t=String(t)),"function"==typeof this._put?this._put(e,t):this._operations.push({type:"put",key:e,value:t}),this},r.prototype.del=function(e){this._checkWritten();var t=this._db._checkKey(e,"key",this._db._isBuffer);if(t)throw t;return this._db._isBuffer(e)||(e=String(e)),"function"==typeof this._del?this._del(e):this._operations.push({type:"del",key:e}),this},r.prototype.clear=function(){return this._checkWritten(),this._operations=[],"function"==typeof this._clear&&this._clear(),this},r.prototype.write=function(e,r){if(this._checkWritten(),"function"==typeof e&&(r=e),"function"!=typeof r)throw new Error("write() requires a callback argument");return"object"!=typeof e&&(e={}),this._written=!0,"function"==typeof this._write?this._write(r):"function"==typeof this._db._batch?this._db._batch(this._operations,e,r):void t.nextTick(r)},e.exports=r}).call(this,r(6))},function(e,t,r){"use strict";const n=r(1),i=r(3),o=n("repo:lock"),s="repo.lock",a={};t.lock=((e,t)=>{const r=e+"/"+s;o("locking %s",r),a[r]=!0;const n={close(e){a[r]&&delete a[r],i(e)}};i(()=>{t(null,n)})}),t.locked=((e,t)=>{const r=e+"/"+s;o("checking lock: %s");const n=a[r];i(()=>{t(null,n)})})},function(e,t){e.exports=function(e){var t,r=!1;function n(n){if(!n)throw new Error("must be passed a readable");t=n,r&&e(t)}return n.resolve=n.ready=n.start=function(i){return r=!0,e=i||e,t&&e(t),n},n}},function(e,t,r){var n=r(162),i=r(376);e.exports=function(){var e=n(),t=i();return{source:e,sink:t,resolve:function(r){e.resolve(r.source),t.resolve(r.sink)}}}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=u;var n=r(54),i=a(n),o=r(32),s=a(o);function a(e){return e&&e.__esModule?e:{default:e}}function u(e,t,r,n){n=n||i.default,t=t||[];var o=[],a=0,u=(0,s.default)(r);e(t,function(e,t,r){var n=a++;u(e,function(e,t){o[n]=t,r(e)})},function(e){n(e,o)})}e.exports=t.default},function(e,t,r){"use strict";(function(e){const n=r(3);t.toCallback=(e=>(function(t,r){const i=(e,t)=>n(()=>{r(e,t)});let o;try{o=e(t)}catch(e){return void i(e)}i(null,o)})),t.toBuf=((t,r)=>n=>{let i=t(n,r);return e.from(i,"hex")}),t.fromString=((t,r)=>n=>{const i=e.isBuffer(n)?n.toString():n;return t(i,r)}),t.fromNumberTo32BitBuf=((t,r)=>n=>{let i=t(n,r);const o=new Array(4);for(let e=0;e<4;e++)o[e]=255&i,i>>=8;return e.from(o)})}).call(this,r(0).Buffer)},function(e,t){function r(e){return e&&"function"==typeof e.then}e.exports=r},function(e,t,r){(function(t){var r="Input must be an string, Buffer or Uint8Array";function n(e){var n;if(e instanceof Uint8Array)n=e;else if(e instanceof t)n=new Uint8Array(e);else{if("string"!=typeof e)throw new Error(r);n=new Uint8Array(t.from(e,"utf8"))}return n}function i(e){return Array.prototype.map.call(e,function(e){return(e<16?"0":"")+e.toString(16)}).join("")}function o(e){return(4294967296+e).toString(16).substring(1)}function s(e,t,r){for(var n="\n"+e+" = ",i=0;i<t.length;i+=2){if(32===r)n+=o(t[i]).toUpperCase(),n+=" ",n+=o(t[i+1]).toUpperCase();else{if(64!==r)throw new Error("Invalid size "+r);n+=o(t[i+1]).toUpperCase(),n+=o(t[i]).toUpperCase()}i%6==4?n+="\n"+new Array(e.length+4).join(" "):i<t.length-2&&(n+=" ")}console.log(n)}function a(e,t,r){for(var n=(new Date).getTime(),i=new Uint8Array(t),o=0;o<t;o++)i[o]=o%256;var s=(new Date).getTime();for(console.log("Generated random input in "+(s-n)+"ms"),n=s,o=0;o<r;o++){var a=e(i),u=(new Date).getTime(),c=u-n;n=u,console.log("Hashed in "+c+"ms: "+a.substring(0,20)+"..."),console.log(Math.round(t/(1<<20)/(c/1e3)*100)/100+" MB PER SECOND")}}e.exports={normalizeInput:n,toHex:i,debugPrint:s,testSpeed:a}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";const n=r(5),i=r(9),o=r(225);t=e.exports,t.multicodec="dag-pb",t.defaultHashAlg="sha2-256",t.resolve=((e,t,r)=>{n([t=>o.deserialize(e,t),(e,n)=>{if(!t)return r(null,{value:e,remainderPath:""});const i=t.split("/");if("Links"===i[0]){let t="";if(!i[1])return n(null,{value:e.links.map(e=>e.toJSON()),remainderPath:""});const r={};e.links.forEach((e,t)=>{const n=e.toJSON();r[t]=r[n.name]={hash:n.multihash,name:n.name,size:n.size}});let o=r[i[1]];"Hash"===i[2]?o={"/":o.hash}:"Tsize"===i[2]?o={"/":o.size}:"Name"===i[2]&&(o={"/":o.name}),t=i.slice(3).join("/"),n(null,{value:o,remainderPath:t})}else if("Data"===i[0])n(null,{value:e.data,remainderPath:""});else{const t={};e.links.forEach((e,r)=>{const n=e.toJSON();t[n.name]={hash:n.multihash,name:n.name,size:n.size}});const r=t[i[0]];if(r)return n(null,{value:{"/":r.hash},remainderPath:i.slice(1).join("/")});n(new Error("path not available"))}}],r)}),t.tree=((e,t,r)=>{"function"==typeof t&&(r=t,t={}),t=t||{},o.deserialize(e,(e,t)=>{if(e)return r(e);const n=[];n.push("Links"),t.links.forEach((e,t)=>{n.push(`Links/${t}/Name`),n.push(`Links/${t}/Tsize`),n.push(`Links/${t}/Hash`)}),n.push("Data"),r(null,n)})}),t.isLink=((e,r,n)=>{t.resolve(e,r,(e,t)=>{if(e)return n(e);if(t.remainderPath.length>0)return n(new Error("path out of scope"));if("object"==typeof t.value&&t.value["/"]){let r;try{r=i.isCID(new i(t.value["/"]))}catch(e){r=!1}if(r)return n(null,t.value)}n(null,!1)})})},function(e,t,r){"use strict";t.util=r(384),t.resolver=r(388)},function(e,t,r){"use strict";(function(n){const i=r(749),o=r(59),s=r(9),a=r(5),u=r(3),c=r(753),f=r(388),l=42;function h(e){return"string"==typeof e&&(e=new s(e).buffer),new i.Tagged(l,n.concat([n.from("00","hex"),e]))}const p=new i.Decoder({tags:{[l]:e=>(e=e.slice(1),{"/":e})}});function d(e){let t;try{t=c(e)}catch(e){t=!1}if(t)throw new Error("The object passed has circular references");function r(e){if(!e||n.isBuffer(e)||"string"==typeof e)return e;if(Array.isArray(e))return e.map(r);const t=Object.keys(e);if(1===t.length&&"/"===t[0])return h(e["/"]);if(t.length>0){let n={};return t.forEach(t=>{"object"==typeof e[t]?n[t]=r(e[t]):n[t]=e[t]}),n}return e}return r(e)}t=e.exports,t.serialize=((e,t)=>{let r;try{const n=d(e);r=i.encode(n)}catch(e){return u(()=>t(e))}u(()=>t(null,r))}),t.deserialize=((e,t)=>{let r;try{r=p.decodeFirst(e)}catch(e){return u(()=>t(e))}u(()=>t(null,r))}),t.cid=((e,r,n)=>{"function"==typeof r&&(n=r,r={}),r=r||{};const i=r.hashAlg||f.defaultHashAlg,u=void 0===r.version?1:r.version;a([r=>t.serialize(e,r),(e,t)=>o(e,i,t),(e,t)=>t(null,new s(u,f.multicodec,e))],n)})}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(t,n){const i=r(329),o=r(169),s=r(751),a=r(227),u=r(170),c=r(386),f=r(387),l=r(36);class h{constructor(e){e=e||{},!e.size||e.size<65536?e.size=65536:e.size=a.nextPowerOf2(e.size),this._heap=new ArrayBuffer(e.size),this._heap8=new Uint8Array(this._heap),this._reset(),this._knownTags=Object.assign({0:e=>new Date(e),1:e=>new Date(1e3*e),2:e=>a.arrayBufferToBignumber(e),3:e=>u.NEG_ONE.minus(a.arrayBufferToBignumber(e)),4:e=>u.TEN.pow(e[0]).times(e[1]),5:e=>u.TWO.pow(e[0]).times(e[1]),32:e=>l.parse(e),35:e=>new RegExp(e)},e.tags),this.parser=s(t,{log:console.log.bind(console),pushInt:this.pushInt.bind(this),pushInt32:this.pushInt32.bind(this),pushInt32Neg:this.pushInt32Neg.bind(this),pushInt64:this.pushInt64.bind(this),pushInt64Neg:this.pushInt64Neg.bind(this),pushFloat:this.pushFloat.bind(this),pushFloatSingle:this.pushFloatSingle.bind(this),pushFloatDouble:this.pushFloatDouble.bind(this),pushTrue:this.pushTrue.bind(this),pushFalse:this.pushFalse.bind(this),pushUndefined:this.pushUndefined.bind(this),pushNull:this.pushNull.bind(this),pushInfinity:this.pushInfinity.bind(this),pushInfinityNeg:this.pushInfinityNeg.bind(this),pushNaN:this.pushNaN.bind(this),pushNaNNeg:this.pushNaNNeg.bind(this),pushArrayStart:this.pushArrayStart.bind(this),pushArrayStartFixed:this.pushArrayStartFixed.bind(this),pushArrayStartFixed32:this.pushArrayStartFixed32.bind(this),pushArrayStartFixed64:this.pushArrayStartFixed64.bind(this),pushObjectStart:this.pushObjectStart.bind(this),pushObjectStartFixed:this.pushObjectStartFixed.bind(this),pushObjectStartFixed32:this.pushObjectStartFixed32.bind(this),pushObjectStartFixed64:this.pushObjectStartFixed64.bind(this),pushByteString:this.pushByteString.bind(this),pushByteStringStart:this.pushByteStringStart.bind(this),pushUtf8String:this.pushUtf8String.bind(this),pushUtf8StringStart:this.pushUtf8StringStart.bind(this),pushSimpleUnassigned:this.pushSimpleUnassigned.bind(this),pushTagUnassigned:this.pushTagUnassigned.bind(this),pushTagStart:this.pushTagStart.bind(this),pushTagStart4:this.pushTagStart4.bind(this),pushTagStart8:this.pushTagStart8.bind(this),pushBreak:this.pushBreak.bind(this)},this._heap)}get _depth(){return this._parents.length}get _currentParent(){return this._parents[this._depth-1]}get _ref(){return this._currentParent.ref}_closeParent(){var e=this._parents.pop();if(e.length>0)throw new Error(`Missing ${e.length} elements`);switch(e.type){case u.PARENT.TAG:this._push(this.createTag(e.ref[0],e.ref[1]));break;case u.PARENT.BYTE_STRING:this._push(this.createByteString(e.ref,e.length));break;case u.PARENT.UTF8_STRING:this._push(this.createUtf8String(e.ref,e.length));break;case u.PARENT.MAP:if(e.values%2>0)throw new Error("Odd number of elements in the map");this._push(this.createMap(e.ref,e.length));break;case u.PARENT.OBJECT:if(e.values%2>0)throw new Error("Odd number of elements in the map");this._push(this.createObject(e.ref,e.length));break;case u.PARENT.ARRAY:this._push(this.createArray(e.ref,e.length))}this._currentParent&&this._currentParent.type===u.PARENT.TAG&&this._dec()}_dec(){const e=this._currentParent;e.length<0||(e.length--,0===e.length&&this._closeParent())}_push(e,t){const r=this._currentParent;switch(r.values++,r.type){case u.PARENT.ARRAY:case u.PARENT.BYTE_STRING:case u.PARENT.UTF8_STRING:r.length>-1?this._ref[this._ref.length-r.length]=e:this._ref.push(e),this._dec();break;case u.PARENT.OBJECT:null!=r.tmpKey?(this._ref[r.tmpKey]=e,r.tmpKey=null,this._dec()):(r.tmpKey=e,"string"!=typeof r.tmpKey&&(r.type=u.PARENT.MAP,r.ref=a.buildMap(r.ref)));break;case u.PARENT.MAP:null!=r.tmpKey?(this._ref.set(r.tmpKey,e),r.tmpKey=null,this._dec()):r.tmpKey=e;break;case u.PARENT.TAG:this._ref.push(e),t||this._dec();break;default:throw new Error("Unknown parent type")}}_createParent(e,t,r){this._parents[this._depth]={type:t,length:r,ref:e,values:0,tmpKey:null}}_reset(){this._res=[],this._parents=[{type:u.PARENT.ARRAY,length:-1,ref:this._res,values:0,tmpKey:null}]}createTag(e,t){const r=this._knownTags[e];return r?r(t):new f(e,t)}createMap(e,t){return e}createObject(e,t){return e}createArray(e,t){return e}createByteString(e,t){return n.concat(e)}createByteStringFromHeap(e,t){return e===t?n.alloc(0):n.from(this._heap.slice(e,t))}createInt(e){return e}createInt32(e,t){return a.buildInt32(e,t)}createInt64(e,t,r,n){return a.buildInt64(e,t,r,n)}createFloat(e){return e}createFloatSingle(e,t,r,n){return i.read([e,t,r,n],0,!1,23,4)}createFloatDouble(e,t,r,n,o,s,a,u){return i.read([e,t,r,n,o,s,a,u],0,!1,52,8)}createInt32Neg(e,t){return-1-a.buildInt32(e,t)}createInt64Neg(e,t,r,n){const i=a.buildInt32(e,t),s=a.buildInt32(r,n);return i>u.MAX_SAFE_HIGH?u.NEG_ONE.minus(new o(i).times(u.SHIFT32).plus(s)):-1-(i*u.SHIFT32+s)}createTrue(){return!0}createFalse(){return!1}createNull(){return null}createUndefined(){}createInfinity(){return 1/0}createInfinityNeg(){return-1/0}createNaN(){return NaN}createNaNNeg(){return NaN}createUtf8String(e,t){return e.join("")}createUtf8StringFromHeap(e,t){return e===t?"":n.from(this._heap.slice(e,t)).toString("utf8")}createSimpleUnassigned(e){return new c(e)}pushInt(e){this._push(this.createInt(e))}pushInt32(e,t){this._push(this.createInt32(e,t))}pushInt64(e,t,r,n){this._push(this.createInt64(e,t,r,n))}pushFloat(e){this._push(this.createFloat(e))}pushFloatSingle(e,t,r,n){this._push(this.createFloatSingle(e,t,r,n))}pushFloatDouble(e,t,r,n,i,o,s,a){this._push(this.createFloatDouble(e,t,r,n,i,o,s,a))}pushInt32Neg(e,t){this._push(this.createInt32Neg(e,t))}pushInt64Neg(e,t,r,n){this._push(this.createInt64Neg(e,t,r,n))}pushTrue(){this._push(this.createTrue())}pushFalse(){this._push(this.createFalse())}pushNull(){this._push(this.createNull())}pushUndefined(){this._push(this.createUndefined())}pushInfinity(){this._push(this.createInfinity())}pushInfinityNeg(){this._push(this.createInfinityNeg())}pushNaN(){this._push(this.createNaN())}pushNaNNeg(){this._push(this.createNaNNeg())}pushArrayStart(){this._createParent([],u.PARENT.ARRAY,-1)}pushArrayStartFixed(e){this._createArrayStartFixed(e)}pushArrayStartFixed32(e,t){const r=a.buildInt32(e,t);this._createArrayStartFixed(r)}pushArrayStartFixed64(e,t,r,n){const i=a.buildInt64(e,t,r,n);this._createArrayStartFixed(i)}pushObjectStart(){this._createObjectStartFixed(-1)}pushObjectStartFixed(e){this._createObjectStartFixed(e)}pushObjectStartFixed32(e,t){const r=a.buildInt32(e,t);this._createObjectStartFixed(r)}pushObjectStartFixed64(e,t,r,n){const i=a.buildInt64(e,t,r,n);this._createObjectStartFixed(i)}pushByteStringStart(){this._parents[this._depth]={type:u.PARENT.BYTE_STRING,length:-1,ref:[],values:0,tmpKey:null}}pushByteString(e,t){this._push(this.createByteStringFromHeap(e,t))}pushUtf8StringStart(){this._parents[this._depth]={type:u.PARENT.UTF8_STRING,length:-1,ref:[],values:0,tmpKey:null}}pushUtf8String(e,t){this._push(this.createUtf8StringFromHeap(e,t))}pushSimpleUnassigned(e){this._push(this.createSimpleUnassigned(e))}pushTagStart(e){this._parents[this._depth]={type:u.PARENT.TAG,length:1,ref:[e]}}pushTagStart4(e,t){this.pushTagStart(a.buildInt32(e,t))}pushTagStart8(e,t,r,n){this.pushTagStart(a.buildInt64(e,t,r,n))}pushTagUnassigned(e){this._push(this.createTag(e))}pushBreak(){if(this._currentParent.length>-1)throw new Error("Unexpected break");this._closeParent()}_createObjectStartFixed(e){0!==e?this._createParent({},u.PARENT.OBJECT,e):this._push(this.createObject({}))}_createArrayStartFixed(e){0!==e?this._createParent(new Array(e),u.PARENT.ARRAY,e):this._push(this.createArray([]))}_decode(e){if(0===e.byteLength)throw new Error("Input too short");this._reset(),this._heap8.set(e);const t=this.parser.parse(e.byteLength);if(this._depth>1){for(;0===this._currentParent.length;)this._closeParent();if(this._depth>1)throw new Error("Undeterminated nesting")}if(t>0)throw new Error("Failed to parse");if(0===this._res.length)throw new Error("No valid result")}decodeFirst(e){return this._decode(e),this._res[0]}decodeAll(e){return this._decode(e),this._res}static decode(e,t){"string"==typeof e&&(e=n.from(e,t||"hex"));const r=new h({size:e.length});return r.decodeFirst(e)}static decodeAll(e,t){"string"==typeof e&&(e=n.from(e,t||"hex"));const r=new h({size:e.length});return r.decodeAll(e)}}h.decodeFirst=h.decode,e.exports=h}).call(this,r(7),r(0).Buffer)},function(e,t,r){"use strict";const n=r(170),i=n.MT,o=n.SIMPLE,s=n.SYMS;class a{constructor(e){if("number"!=typeof e)throw new Error("Invalid Simple type: "+typeof e);if(e<0||e>255||(0|e)!==e)throw new Error("value must be a small positive integer: "+e);this.value=e}toString(){return"simple("+this.value+")"}inspect(){return"simple("+this.value+")"}encodeCBOR(e){return e._pushInt(this.value,i.SIMPLE_FLOAT)}static isSimple(e){return e instanceof a}static decode(e,t){switch(null==t&&(t=!0),e){case o.FALSE:return!1;case o.TRUE:return!0;case o.NULL:return t?null:s.NULL;case o.UNDEFINED:return t?void 0:s.UNDEFINED;case-1:if(!t)throw new Error("Invalid BREAK");return s.BREAK;default:return new a(e)}}}e.exports=a},function(e,t,r){"use strict";class n{constructor(e,t,r){if(this.tag=e,this.value=t,this.err=r,"number"!=typeof this.tag)throw new Error("Invalid tag type ("+typeof this.tag+")");if(this.tag<0||(0|this.tag)!==this.tag)throw new Error("Tag must be a positive integer: "+this.tag)}toString(){return`${this.tag}(${JSON.stringify(this.value)})`}encodeCBOR(e){return e._pushTag(this.tag),e.pushAny(this.value)}convert(e){var t,r;if(r=null!=e?e[this.tag]:void 0,"function"!=typeof r&&(r=n["_tag"+this.tag],"function"!=typeof r))return this;try{return r.call(n,this.value)}catch(e){return t=e,this.err=t,this}}}e.exports=n},function(e,t,r){"use strict";(function(n){const i=r(384),o=r(389);function s(e,t){return t=t||"/",0===Object.keys(e).length?[]:o(e).reduce(function(e,r){"object"==typeof r&&r["/"]&&this.update(void 0);const n=this.path.join(t);return""!==n&&e.push({path:n,value:r}),e},[])}t=e.exports,t.multicodec="dag-cbor",t.defaultHashAlg="sha2-256",t.resolve=((e,t,r)=>{"function"==typeof t&&(r=t,t=void 0),i.deserialize(e,(e,i)=>{if(e)return r(e);if(!t||"/"===t)return r(null,{value:i,remainderPath:""});const s=t.split("/"),a=o(i).get(s);if(a)return r(null,{value:a,remainderPath:""});let u,c=s.length;for(let e=0;e<c;e++){const e=s.shift();if(Array.isArray(i)&&!n.isBuffer(i)&&(u=i[Number(e)]),!i[e])return u?(s.unshift(e),r(null,{value:u,remainderPath:s.join("/")})):r(new Error("path not available at root"));u=i[e],i=u}})}),t.tree=((e,t,r)=>{"function"==typeof t&&(r=t,t=void 0),t=t||{},i.deserialize(e,(e,t)=>{if(e)return r(e);const n=s(t),i=n.map(e=>e.path);r(null,i)})}),t.isLink=((e,r,n)=>{t.resolve(e,r,(e,t)=>e?n(e):t.remainderPath.length>0?n(new Error("path out of scope")):void("object"==typeof t.value&&t.value["/"]?n(null,t.value):n(null,!1)))})}).call(this,r(0).Buffer)},function(e,t){var r=e.exports=function(e){return new n(e)};function n(e){this.value=e}function i(e,t,r){var n=[],i=[],a=!0;return function e(u){var c=r?o(u):u,f={},l=!0,h={node:c,node_:u,path:[].concat(n),parent:i[i.length-1],parents:i,key:n.slice(-1)[0],isRoot:0===n.length,level:n.length,circular:null,update:function(e,t){h.isRoot||(h.parent.node[h.key]=e),h.node=e,t&&(l=!1)},delete:function(e){delete h.parent.node[h.key],e&&(l=!1)},remove:function(e){d(h.parent.node)?h.parent.node.splice(h.key,1):delete h.parent.node[h.key],e&&(l=!1)},keys:null,before:function(e){f.before=e},after:function(e){f.after=e},pre:function(e){f.pre=e},post:function(e){f.post=e},stop:function(){a=!1},block:function(){l=!1}};if(!a)return h;function p(){if("object"==typeof h.node&&null!==h.node){h.keys&&h.node_===h.node||(h.keys=s(h.node)),h.isLeaf=0==h.keys.length;for(var e=0;e<i.length;e++)if(i[e].node_===u){h.circular=i[e];break}}else h.isLeaf=!0,h.keys=null;h.notLeaf=!h.isLeaf,h.notRoot=!h.isRoot}p();var m=t.call(h,h.node);return void 0!==m&&h.update&&h.update(m),f.before&&f.before.call(h,h.node),l?("object"!=typeof h.node||null===h.node||h.circular||(i.push(h),p(),y(h.keys,function(t,i){n.push(t),f.pre&&f.pre.call(h,h.node[t],t);var o=e(h.node[t]);r&&g.call(h.node,t)&&(h.node[t]=o.node),o.isLast=i==h.keys.length-1,o.isFirst=0==i,f.post&&f.post.call(h,o),n.pop()}),i.pop()),f.after&&f.after.call(h,h.node),h):h}(e).node}function o(e){if("object"==typeof e&&null!==e){var t;if(d(e))t=[];else if(u(e))t=new Date(e.getTime?e.getTime():e);else if(c(e))t=new RegExp(e);else if(f(e))t={message:e.message};else if(l(e))t=new Boolean(e);else if(h(e))t=new Number(e);else if(p(e))t=new String(e);else if(Object.create&&Object.getPrototypeOf)t=Object.create(Object.getPrototypeOf(e));else if(e.constructor===Object)t={};else{var r=e.constructor&&e.constructor.prototype||e.__proto__||{},n=function(){};n.prototype=r,t=new n}return y(s(e),function(r){t[r]=e[r]}),t}return e}n.prototype.get=function(e){for(var t=this.value,r=0;r<e.length;r++){var n=e[r];if(!t||!g.call(t,n)){t=void 0;break}t=t[n]}return t},n.prototype.has=function(e){for(var t=this.value,r=0;r<e.length;r++){var n=e[r];if(!t||!g.call(t,n))return!1;t=t[n]}return!0},n.prototype.set=function(e,t){for(var r=this.value,n=0;n<e.length-1;n++){var i=e[n];g.call(r,i)||(r[i]={}),r=r[i]}return r[e[n]]=t,t},n.prototype.map=function(e){return i(this.value,e,!0)},n.prototype.forEach=function(e){return this.value=i(this.value,e,!1),this.value},n.prototype.reduce=function(e,t){var r=1===arguments.length,n=r?this.value:t;return this.forEach(function(t){this.isRoot&&r||(n=e.call(this,n,t))}),n},n.prototype.paths=function(){var e=[];return this.forEach(function(t){e.push(this.path)}),e},n.prototype.nodes=function(){var e=[];return this.forEach(function(t){e.push(this.node)}),e},n.prototype.clone=function(){var e=[],t=[];return function r(n){for(var i=0;i<e.length;i++)if(e[i]===n)return t[i];if("object"==typeof n&&null!==n){var a=o(n);return e.push(n),t.push(a),y(s(n),function(e){a[e]=r(n[e])}),e.pop(),t.pop(),a}return n}(this.value)};var s=Object.keys||function e(t){var r=[];for(var n in t)r.push(n);return r};function a(e){return Object.prototype.toString.call(e)}function u(e){return"[object Date]"===a(e)}function c(e){return"[object RegExp]"===a(e)}function f(e){return"[object Error]"===a(e)}function l(e){return"[object Boolean]"===a(e)}function h(e){return"[object Number]"===a(e)}function p(e){return"[object String]"===a(e)}var d=Array.isArray||function e(t){return"[object Array]"===Object.prototype.toString.call(t)},y=function(e,t){if(e.forEach)return e.forEach(t);for(var r=0;r<e.length;r++)t(e[r],r,e)};y(s(n.prototype),function(e){r[e]=function(t){var r=[].slice.call(arguments,1),i=new n(t);return i[e].apply(i,r)}});var g=Object.hasOwnProperty||function(e,t){return t in e}},function(e,t,r){"use strict";(function(n){const i=r(3),o=r(5),s=r(59),a=r(9),u=r(391),c=r(171),f=r(757),l=r(758),h=r(759);t=e.exports,t.serialize=((e,t)=>{if(null!==e)if(n.isBuffer(e))"blob"===e.slice(0,4).toString()?i(()=>t(null,e)):i(()=>t(new Error("unexpected dagNode passed to serialize"),null));else switch(e.gitType){case"commit":f.serialize(e,t);break;case"tag":l.serialize(e,t);break;default:h.serialize(e,t)}else i(()=>t(new Error("dagNode passed to serialize was null"),null))}),t.deserialize=((e,t)=>{let r=c.find(e,0),n=e.slice(0,r).toString(),o=n.match(/([^ ]+) (\d+)/);if(o)switch(o[1]){case"blob":t(null,e);break;case"commit":f.deserialize(e.slice(r+1),t);break;case"tag":l.deserialize(e.slice(r+1),t);break;case"tree":h.deserialize(e.slice(r+1),t);break;default:i(()=>t(new Error("unknown object type "+o[1]),null))}else i(()=>t(new Error("invalid object header"),null))}),t.cid=((e,r,n)=>{"function"==typeof r&&(n=r,r={}),r=r||{};const i=r.hashAlg||u.defaultHashAlg,c=void 0===r.version?1:r.version;o([r=>t.serialize(e,r),(e,t)=>s(e,i,t),(e,t)=>t(null,new a(c,u.multicodec,e))],n)})}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(n){const i=r(390),o=r(389);t=e.exports,t.multicodec="git-raw",t.defaultHashAlg="sha1";const s=["original","name","email","date"];t.resolve=((e,t,r)=>{"function"==typeof t&&(r=t,t=void 0),i.deserialize(e,(e,i)=>{if(e)return r(e);if(!t||"/"===t)return r(null,{value:i,remainderPath:""});if(n.isBuffer(i))return r(null,{value:i,remainderPath:t});const s=t.split("/"),a=o(i).get(s);if(a)return r(null,{value:a,remainderPath:""});let u,c=s.length;for(let e=0;e<c;e++){const e=s.shift();if(Array.isArray(i)&&(u=i[Number(e)]),!i[e])return u?(s.unshift(e),r(null,{value:u,remainderPath:s.join("/")})):r(new Error("path not available at root"));u=i[e],i=u}})}),t.tree=((e,t,r)=>{"function"==typeof t&&(r=t,t=void 0),t=t||{},i.deserialize(e,(e,t)=>{if(e)return r(e);if(n.isBuffer(t))return r(null,[]);let i=[];switch(t.gitType){case"commit":i=["message","tree"],i=i.concat(s.map(e=>"author/"+e)),i=i.concat(s.map(e=>"committer/"+e)),i=i.concat(t.parents.map((e,t)=>"parents/"+t)),t.encoding&&i.push("encoding");break;case"tag":i=["object","type","tag","message"],t.tagger&&(i=i.concat(s.map(e=>"tagger/"+e)));break;default:Object.keys(t).forEach(e=>{i.push(e),i.push(e+"/hash"),i.push(e+"/mode")})}r(null,i)})}),t.isLink=((e,r,n)=>{t.resolve(e,r,(e,t)=>e?n(e):t.remainderPath.length>0?n(new Error("path out of scope")):void("object"==typeof t.value&&t.value["/"]?n(null,t.value):n(null,!1)))})}).call(this,r(0).Buffer)},function(e,t,r){"use strict";const n=r(761).Block,i=r(9),o=r(14),s=r(59),a=r(5),u=80,c=(e,t)=>{let r=null,n;try{n=e.toBuffer(!0)}catch(e){r=e}finally{t(r,n)}},f=(e,t)=>{if(80!==e.length){const e=new Error("Bitcoin block header needs to be 80 bytes");return t(e)}const r=n.fromBuffer(e);t(null,r)},l=(e,t,n)=>{"function"==typeof t&&(n=t,t={}),t=t||{};const o=t.hashAlg||r(228).defaultHashAlg,u=void 0===t.version?1:t.version;a([t=>{try{s(e.toBuffer(!0),o,t)}catch(e){t(e)}},(e,t)=>t(null,new i(u,"bitcoin-block",e))],n)},h=e=>{const t=r(228).defaultHashAlg,n=o.encode(e,t),s=1,a=new i(1,"bitcoin-block",n);return a};e.exports={hashToCid:h,BITCOIN_BLOCK_HEADER_SIZE:80,cid:l,deserialize:f,serialize:c}},function(e,t,r){var n=r(39);function i(e){return e<n.OP_PUSHDATA1?1:e<=255?2:e<=65535?3:5}function o(e,t,r){var o=i(t);return 1===o?e.writeUInt8(t,r):2===o?(e.writeUInt8(n.OP_PUSHDATA1,r),e.writeUInt8(t,r+1)):3===o?(e.writeUInt8(n.OP_PUSHDATA2,r),e.writeUInt16LE(t,r+1)):(e.writeUInt8(n.OP_PUSHDATA4,r),e.writeUInt32LE(t,r+1)),o}function s(e,t){var r=e.readUInt8(t),i,o;if(r<n.OP_PUSHDATA1)i=r,o=1;else if(r===n.OP_PUSHDATA1){if(t+2>e.length)return null;i=e.readUInt8(t+1),o=2}else if(r===n.OP_PUSHDATA2){if(t+3>e.length)return null;i=e.readUInt16LE(t+1),o=3}else{if(t+5>e.length)return null;if(r!==n.OP_PUSHDATA4)throw new Error("Unexpected opcode");i=e.readUInt32LE(t+1),o=5}return{opcode:r,number:i,size:o}}e.exports={encodingLength:i,encode:o,decode:s}},function(e,t,r){var n=r(230);function i(e){return e.name||e.toString().match(/function (.*?)\s*\(/)[1]}function o(e){return n.Nil(e)?"":i(e.constructor)}function s(e){return n.Function(e)?"":n.String(e)?JSON.stringify(e):e&&n.Object(e)?"":e}function a(e){return n.Function(e)?e.toJSON?e.toJSON():i(e):n.Array(e)?"Array":e&&n.Object(e)?"Object":void 0!==e?e:""}function u(e,t,r){var n=s(t);return"Expected "+a(e)+", got"+(""!==r?" "+r:"")+(""!==n?" "+n:"")}function c(e,t,r){r=r||o(t),this.message=u(e,t,r),Error.captureStackTrace(this,c),this.__type=e,this.__value=t,this.__valueTypeName=r}function f(e,t,r,n,i){var o='" of type ';return"key"===t&&(o='" with key type '),u('property "'+a(r)+o+a(e),n,i)}function l(e,t,r,n,i){e?(i=i||o(n),this.message=f(e,r,t,n,i)):this.message='Unexpected property "'+t+'"',Error.captureStackTrace(this,c),this.__label=r,this.__property=t,this.__type=e,this.__value=n,this.__valueTypeName=i}function h(e,t){return new c(e,{},t)}function p(e,t,r){return e instanceof l?(t=t+"."+e.__property,e=new l(e.__type,t,e.__label,e.__value,e.__valueTypeName)):e instanceof c&&(e=new l(e.__type,t,r,e.__value,e.__valueTypeName)),Error.captureStackTrace(e),e}c.prototype=Object.create(Error.prototype),c.prototype.constructor=c,l.prototype=Object.create(Error.prototype),l.prototype.constructor=c,e.exports={TfTypeError:c,TfPropertyTypeError:l,tfCustomError:h,tfSubError:p,tfJSON:a,getValueTypeName:o}},function(e,t,r){var n=r(2).Buffer;function i(e,t,r){t=t||4,r=void 0===r||r;var n=e.length;if(0===n)return 0;if(n>t)throw new TypeError("Script number overflow");if(r&&0==(127&e[n-1])&&(n<=1||0==(128&e[n-2])))throw new Error("Non-minimally encoded script number");if(5===n){var i=e.readUInt32LE(0),o=e.readUInt8(4);return 128&o?-(4294967296*(-129&o)+i):4294967296*o+i}for(var s=0,a=0;a<n;++a)s|=e[a]<<8*a;return 128&e[n-1]?-(s&~(128<<8*(n-1))):s}function o(e){return e>2147483647?5:e>8388607?4:e>32767?3:e>127?2:e>0?1:0}function s(e){for(var t=Math.abs(e),r=o(t),i=n.allocUnsafe(r),s=e<0,a=0;a<r;++a)i.writeUInt8(255&t,a),t>>=8;return 128&i[r-1]?i.writeUInt8(s?128:0,r-1):s&&(i[r-1]|=128),i}e.exports={decode:i,encode:s}},function(e,t,r){var n=r(29),i=r(33),o=r(25),s=r(39),a=s.OP_RESERVED;function u(e,t){var r=n.decompile(e);if(r.length<4)return!1;if(r[r.length-1]!==s.OP_CHECKMULTISIG)return!1;if(!i.Number(r[0]))return!1;if(!i.Number(r[r.length-2]))return!1;var o=r[0]-a,u=r[r.length-2]-a;if(o<=0)return!1;if(u>16)return!1;if(o>u)return!1;if(u!==r.length-3)return!1;if(t)return!0;var c=r.slice(1,-2);return c.every(n.isCanonicalPubKey)}function c(e,t){o({m:i.Number,pubKeys:[n.isCanonicalPubKey]},{m:e,pubKeys:t});var r=t.length;if(r<e)throw new TypeError("Not enough pubKeys provided");return n.compile([].concat(a+e,t,a+r,s.OP_CHECKMULTISIG))}function f(e,t){var r=n.decompile(e);return o(u,r,t),{m:r[0]-a,pubKeys:r.slice(1,-2)}}u.toJSON=function(){return"multi-sig output"},e.exports={check:u,decode:f,encode:c}},function(e,t,r){var n=r(29),i=r(33),o=r(25),s=r(39);function a(e){var t=n.compile(e);return 22===t.length&&t[0]===s.OP_0&&20===t[1]}function u(e){return o(i.Hash160bit,e),n.compile([s.OP_0,e])}function c(e){return o(a,e),e.slice(2)}a.toJSON=function(){return"Witness pubKeyHash output"},e.exports={check:a,decode:c,encode:u}},function(e,t,r){var n=r(29),i=r(33),o=r(25),s=r(39);function a(e){var t=n.compile(e);return 34===t.length&&t[0]===s.OP_0&&32===t[1]}function u(e){return o(i.Hash256bit,e),n.compile([s.OP_0,e])}function c(e){return o(a,e),e.slice(2)}a.toJSON=function(){return"Witness scriptHash output"},e.exports={check:a,decode:c,encode:u}},function(e,t,r){var n=r(393),i=r(235);function o(e,t){if("number"!=typeof e)throw new Error("cannot write a non-number as a number");if(e<0)throw new Error("specified a negative value for writing an unsigned value");if(e>t)throw new Error("RangeError: value out of range");if(Math.floor(e)!==e)throw new Error("value has a fractional component")}function s(e,t){var r=e.readUInt32LE(t),n=e.readUInt32LE(t+4);return n*=4294967296,o(n+r,9007199254740991),n+r}function a(e,t,r){return o(t,9007199254740991),e.writeInt32LE(-1&t,r),e.writeUInt32LE(Math.floor(t/4294967296),r+4),r+8}function u(e,t){var r=i.decode(e,t);return{number:r,size:i.decode.bytes}}function c(e,t,r){return i.encode(t,e,r),i.encode.bytes}e.exports={pushDataSize:n.encodingLength,readPushDataInt:n.decode,readUInt64LE:s,readVarInt:u,varIntBuffer:i.encode,varIntSize:i.encodingLength,writePushDataInt:n.encode,writeUInt64LE:a,writeVarInt:c}},function(e,t,r){"use strict";var n=r(2).Buffer,i=r(92).Transform,o=r(4);function s(e,t){if(!n.isBuffer(e)&&"string"!=typeof e)throw new TypeError(t+" must be a string or a buffer")}function a(e){i.call(this),this._block=n.allocUnsafe(e),this._blockSize=e,this._blockOffset=0,this._length=[0,0,0,0],this._finalized=!1}o(a,i),a.prototype._transform=function(e,t,r){var n=null;try{this.update(e,t)}catch(e){n=e}r(n)},a.prototype._flush=function(e){var t=null;try{this.push(this.digest())}catch(e){t=e}e(t)},a.prototype.update=function(e,t){if(s(e,"Data"),this._finalized)throw new Error("Digest already called");n.isBuffer(e)||(e=n.from(e,t));for(var r=this._block,i=0;this._blockOffset+e.length-i>=this._blockSize;){for(var o=this._blockOffset;o<this._blockSize;)r[o++]=e[i++];this._update(),this._blockOffset=0}for(;i<e.length;)r[this._blockOffset++]=e[i++];for(var a=0,u=8*e.length;u>0;++a)this._length[a]+=u,u=this._length[a]/4294967296|0,u>0&&(this._length[a]-=4294967296*u);return this},a.prototype._update=function(){throw new Error("_update is not implemented")},a.prototype.digest=function(e){if(this._finalized)throw new Error("Digest already called");this._finalized=!0;var t=this._digest();void 0!==e&&(t=t.toString(e)),this._block.fill(0),this._blockOffset=0;for(var r=0;r<4;++r)this._length[r]=0;return t},a.prototype._digest=function(){throw new Error("_digest is not implemented")},e.exports=a},function(e,t,r){"use strict";var n=r(0).Buffer,i=r(4),o=r(400),s=new Array(16),a=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13],u=[5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11],c=[11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6],f=[8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11],l=[0,1518500249,1859775393,2400959708,2840853838],h=[1352829926,1548603684,1836072691,2053994217,0];function p(){o.call(this,64),this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520}function d(e,t){return e<<t|e>>>32-t}function y(e,t,r,n,i,o,s,a){return d(e+(t^r^n)+o+s|0,a)+i|0}function g(e,t,r,n,i,o,s,a){return d(e+(t&r|~t&n)+o+s|0,a)+i|0}function m(e,t,r,n,i,o,s,a){return d(e+((t|~r)^n)+o+s|0,a)+i|0}function b(e,t,r,n,i,o,s,a){return d(e+(t&n|r&~n)+o+s|0,a)+i|0}function v(e,t,r,n,i,o,s,a){return d(e+(t^(r|~n))+o+s|0,a)+i|0}i(p,o),p.prototype._update=function(){for(var e=s,t=0;t<16;++t)e[t]=this._block.readInt32LE(4*t);for(var r=0|this._a,n=0|this._b,i=0|this._c,o=0|this._d,p=0|this._e,_=0|this._a,w=0|this._b,S=0|this._c,k=0|this._d,E=0|this._e,A=0;A<80;A+=1){var x,I;A<16?(x=y(r,n,i,o,p,e[a[A]],l[0],c[A]),I=v(_,w,S,k,E,e[u[A]],h[0],f[A])):A<32?(x=g(r,n,i,o,p,e[a[A]],l[1],c[A]),I=b(_,w,S,k,E,e[u[A]],h[1],f[A])):A<48?(x=m(r,n,i,o,p,e[a[A]],l[2],c[A]),I=m(_,w,S,k,E,e[u[A]],h[2],f[A])):A<64?(x=b(r,n,i,o,p,e[a[A]],l[3],c[A]),I=g(_,w,S,k,E,e[u[A]],h[3],f[A])):(x=v(r,n,i,o,p,e[a[A]],l[4],c[A]),I=y(_,w,S,k,E,e[u[A]],h[4],f[A])),r=p,p=o,o=d(i,10),i=n,n=x,_=E,E=k,k=d(S,10),S=w,w=I}var T=this._b+i+k|0;this._b=this._c+o+E|0,this._c=this._d+p+_|0,this._d=this._e+r+w|0,this._e=this._a+n+S|0,this._a=T},p.prototype._digest=function(){this._block[this._blockOffset++]=128,this._blockOffset>56&&(this._block.fill(0,this._blockOffset,64),this._update(),this._blockOffset=0),this._block.fill(0,this._blockOffset,56),this._block.writeUInt32LE(this._length[0],56),this._block.writeUInt32LE(this._length[1],60),this._update();var e=n.alloc?n.alloc(20):new n(20);return e.writeInt32LE(this._a,0),e.writeInt32LE(this._b,4),e.writeInt32LE(this._c,8),e.writeInt32LE(this._d,12),e.writeInt32LE(this._e,16),e},e.exports=p},function(e,t,r){var t=e.exports=function e(r){r=r.toLowerCase();var n=t[r];if(!n)throw new Error(r+" is not supported (we accept pull requests)");return new n};t.sha=r(780),t.sha1=r(781),t.sha224=r(782),t.sha256=r(403),t.sha384=r(783),t.sha512=r(404)},function(e,t,r){var n=r(4),i=r(109),o=r(2).Buffer,s=[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],a=new Array(64);function u(){this.init(),this._w=a,i.call(this,64,56)}function c(e,t,r){return r^e&(t^r)}function f(e,t,r){return e&t|r&(e|t)}function l(e){return(e>>>2|e<<30)^(e>>>13|e<<19)^(e>>>22|e<<10)}function h(e){return(e>>>6|e<<26)^(e>>>11|e<<21)^(e>>>25|e<<7)}function p(e){return(e>>>7|e<<25)^(e>>>18|e<<14)^e>>>3}function d(e){return(e>>>17|e<<15)^(e>>>19|e<<13)^e>>>10}n(u,i),u.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},u.prototype._update=function(e){for(var t=this._w,r=0|this._a,n=0|this._b,i=0|this._c,o=0|this._d,a=0|this._e,u=0|this._f,y=0|this._g,g=0|this._h,m=0;m<16;++m)t[m]=e.readInt32BE(4*m);for(;m<64;++m)t[m]=d(t[m-2])+t[m-7]+p(t[m-15])+t[m-16]|0;for(var b=0;b<64;++b){var v=g+h(a)+c(a,u,y)+s[b]+t[b]|0,_=l(r)+f(r,n,i)|0;g=y,y=u,u=a,a=o+v|0,o=i,i=n,n=r,r=v+_|0}this._a=r+this._a|0,this._b=n+this._b|0,this._c=i+this._c|0,this._d=o+this._d|0,this._e=a+this._e|0,this._f=u+this._f|0,this._g=y+this._g|0,this._h=g+this._h|0},u.prototype._hash=function(){var e=o.allocUnsafe(32);return e.writeInt32BE(this._a,0),e.writeInt32BE(this._b,4),e.writeInt32BE(this._c,8),e.writeInt32BE(this._d,12),e.writeInt32BE(this._e,16),e.writeInt32BE(this._f,20),e.writeInt32BE(this._g,24),e.writeInt32BE(this._h,28),e},e.exports=u},function(e,t,r){var n=r(4),i=r(109),o=r(2).Buffer,s=[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],a=new Array(160);function u(){this.init(),this._w=a,i.call(this,128,112)}function c(e,t,r){return r^e&(t^r)}function f(e,t,r){return e&t|r&(e|t)}function l(e,t){return(e>>>28|t<<4)^(t>>>2|e<<30)^(t>>>7|e<<25)}function h(e,t){return(e>>>14|t<<18)^(e>>>18|t<<14)^(t>>>9|e<<23)}function p(e,t){return(e>>>1|t<<31)^(e>>>8|t<<24)^e>>>7}function d(e,t){return(e>>>1|t<<31)^(e>>>8|t<<24)^(e>>>7|t<<25)}function y(e,t){return(e>>>19|t<<13)^(t>>>29|e<<3)^e>>>6}function g(e,t){return(e>>>19|t<<13)^(t>>>29|e<<3)^(e>>>6|t<<26)}function m(e,t){return e>>>0<t>>>0?1:0}n(u,i),u.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},u.prototype._update=function(e){for(var t=this._w,r=0|this._ah,n=0|this._bh,i=0|this._ch,o=0|this._dh,a=0|this._eh,u=0|this._fh,b=0|this._gh,v=0|this._hh,_=0|this._al,w=0|this._bl,S=0|this._cl,k=0|this._dl,E=0|this._el,A=0|this._fl,x=0|this._gl,I=0|this._hl,T=0;T<32;T+=2)t[T]=e.readInt32BE(4*T),t[T+1]=e.readInt32BE(4*T+4);for(;T<160;T+=2){var B=t[T-30],C=t[T-30+1],P=p(B,C),O=d(C,B);B=t[T-4],C=t[T-4+1];var R=y(B,C),N=g(C,B),L=t[T-14],j=t[T-14+1],M=t[T-32],K=t[T-32+1],D=O+j|0,U=P+L+m(D,O)|0;D=D+N|0,U=U+R+m(D,N)|0,D=D+K|0,U=U+M+m(D,K)|0,t[T]=U,t[T+1]=D}for(var F=0;F<160;F+=2){U=t[F],D=t[F+1];var q=f(r,n,i),H=f(_,w,S),z=l(r,_),V=l(_,r),G=h(a,E),W=h(E,a),$=s[F],Y=s[F+1],J=c(a,u,b),X=c(E,A,x),Z=I+W|0,Q=v+G+m(Z,I)|0;Z=Z+X|0,Q=Q+J+m(Z,X)|0,Z=Z+Y|0,Q=Q+$+m(Z,Y)|0,Z=Z+D|0,Q=Q+U+m(Z,D)|0;var ee=V+H|0,te=z+q+m(ee,V)|0;v=b,I=x,b=u,x=A,u=a,A=E,E=k+Z|0,a=o+Q+m(E,k)|0,o=i,k=S,i=n,S=w,n=r,w=_,_=Z+ee|0,r=Q+te+m(_,Z)|0}this._al=this._al+_|0,this._bl=this._bl+w|0,this._cl=this._cl+S|0,this._dl=this._dl+k|0,this._el=this._el+E|0,this._fl=this._fl+A|0,this._gl=this._gl+x|0,this._hl=this._hl+I|0,this._ah=this._ah+r+m(this._al,_)|0,this._bh=this._bh+n+m(this._bl,w)|0,this._ch=this._ch+i+m(this._cl,S)|0,this._dh=this._dh+o+m(this._dl,k)|0,this._eh=this._eh+a+m(this._el,E)|0,this._fh=this._fh+u+m(this._fl,A)|0,this._gh=this._gh+b+m(this._gl,x)|0,this._hh=this._hh+v+m(this._hl,I)|0},u.prototype._hash=function(){var e=o.allocUnsafe(64);function t(t,r,n){e.writeInt32BE(t,n),e.writeInt32BE(r,n+4)}return t(this._ah,this._al,0),t(this._bh,this._bl,8),t(this._ch,this._cl,16),t(this._dh,this._dl,24),t(this._eh,this._el,32),t(this._fh,this._fl,40),t(this._gh,this._gl,48),t(this._hh,this._hl,56),e},e.exports=u},function(e,t,r){function n(e,t,r){if(!(this instanceof n))return new n(e,t,r);null!=e&&("number"==typeof e?this.fromNumber(e,t,r):null==t&&"string"!=typeof e?this.fromString(e,256):this.fromString(e,t))}var i=n.prototype,o;function s(e,t,r,n,i,o){for(;--o>=0;){var s=t*this[e++]+r[n]+i;i=Math.floor(s/67108864),r[n++]=67108863&s}return i}function a(e,t,r,n,i,o){for(var s=32767&t,a=t>>15;--o>=0;){var u=32767&this[e],c=this[e++]>>15,f=a*u+c*s;u=s*u+((32767&f)<<15)+r[n]+(1073741823&i),i=(u>>>30)+(f>>>15)+a*c+(i>>>30),r[n++]=1073741823&u}return i}function u(e,t,r,n,i,o){for(var s=16383&t,a=t>>14;--o>=0;){var u=16383&this[e],c=this[e++]>>14,f=a*u+c*s;u=s*u+((16383&f)<<14)+r[n]+i,i=(u>>28)+(f>>14)+a*c,r[n++]=268435455&u}return i}i.__bigi=r(790).version,n.isBigInteger=function(e,t){return e&&e.__bigi&&(!t||e.__bigi===i.__bigi)},n.prototype.am=s,o=26,n.prototype.DB=26,n.prototype.DM=67108863;var c=n.prototype.DV=1<<26,f=52;n.prototype.FV=Math.pow(2,52),n.prototype.F1=26,n.prototype.F2=0;var l="0123456789abcdefghijklmnopqrstuvwxyz",h=new Array,p,d;for(p="0".charCodeAt(0),d=0;d<=9;++d)h[p++]=d;for(p="a".charCodeAt(0),d=10;d<36;++d)h[p++]=d;for(p="A".charCodeAt(0),d=10;d<36;++d)h[p++]=d;function y(e){return l.charAt(e)}function g(e,t){var r=h[e.charCodeAt(t)];return null==r?-1:r}function m(e){for(var t=this.t-1;t>=0;--t)e[t]=this[t];e.t=this.t,e.s=this.s}function b(e){this.t=1,this.s=e<0?-1:0,e>0?this[0]=e:e<-1?this[0]=e+c:this.t=0}function v(e){var t=new n;return t.fromInt(e),t}function _(e,t){var r=this,i;if(16==t)i=4;else if(8==t)i=3;else if(256==t)i=8;else if(2==t)i=1;else if(32==t)i=5;else{if(4!=t)return void this.fromRadix(e,t);i=2}this.t=0,this.s=0;for(var o=e.length,s=!1,a=0;--o>=0;){var u=8==i?255&e[o]:g(e,o);u<0?"-"==e.charAt(o)&&(s=!0):(s=!1,0==a?this[this.t++]=u:a+i>this.DB?(this[this.t-1]|=(u&(1<<this.DB-a)-1)<<a,this[this.t++]=u>>this.DB-a):this[this.t-1]|=u<<a,a+=i,a>=this.DB&&(a-=this.DB))}8==i&&0!=(128&e[0])&&(this.s=-1,a>0&&(this[this.t-1]|=(1<<this.DB-a)-1<<a)),this.clamp(),s&&n.ZERO.subTo(this,this)}function w(){for(var e=this.s&this.DM;this.t>0&&this[this.t-1]==e;)--this.t}function S(e){var t=this,r;if(this.s<0)return"-"+this.negate().toString(e);if(16==e)r=4;else if(8==e)r=3;else if(2==e)r=1;else if(32==e)r=5;else{if(4!=e)return this.toRadix(e);r=2}var n=(1<<r)-1,i,o=!1,s="",a=this.t,u=this.DB-a*this.DB%r;if(a-- >0)for(u<this.DB&&(i=this[a]>>u)>0&&(o=!0,s=y(i));a>=0;)u<r?(i=(this[a]&(1<<u)-1)<<r-u,i|=this[--a]>>(u+=this.DB-r)):(i=this[a]>>(u-=r)&n,u<=0&&(u+=this.DB,--a)),i>0&&(o=!0),o&&(s+=y(i));return o?s:"0"}function k(){var e=new n;return n.ZERO.subTo(this,e),e}function E(){return this.s<0?this.negate():this}function A(e){var t=this.s-e.s;if(0!=t)return t;var r=this.t;if(t=r-e.t,0!=t)return this.s<0?-t:t;for(;--r>=0;)if(0!=(t=this[r]-e[r]))return t;return 0}function x(e){var t=1,r;return 0!=(r=e>>>16)&&(e=r,t+=16),0!=(r=e>>8)&&(e=r,t+=8),0!=(r=e>>4)&&(e=r,t+=4),0!=(r=e>>2)&&(e=r,t+=2),0!=(r=e>>1)&&(e=r,t+=1),t}function I(){return this.t<=0?0:this.DB*(this.t-1)+x(this[this.t-1]^this.s&this.DM)}function T(){return this.bitLength()>>3}function B(e,t){var r;for(r=this.t-1;r>=0;--r)t[r+e]=this[r];for(r=e-1;r>=0;--r)t[r]=0;t.t=this.t+e,t.s=this.s}function C(e,t){for(var r=e;r<this.t;++r)t[r-e]=this[r];t.t=Math.max(this.t-e,0),t.s=this.s}function P(e,t){var r=this,n=e%this.DB,i=this.DB-n,o=(1<<i)-1,s=Math.floor(e/this.DB),a=this.s<<n&this.DM,u;for(u=this.t-1;u>=0;--u)t[u+s+1]=this[u]>>i|a,a=(this[u]&o)<<n;for(u=s-1;u>=0;--u)t[u]=0;t[s]=a,t.t=this.t+s+1,t.s=this.s,t.clamp()}function O(e,t){var r=this;t.s=this.s;var n=Math.floor(e/this.DB);if(n>=this.t)t.t=0;else{var i=e%this.DB,o=this.DB-i,s=(1<<i)-1;t[0]=this[n]>>i;for(var a=n+1;a<this.t;++a)t[a-n-1]|=(this[a]&s)<<o,t[a-n]=this[a]>>i;i>0&&(t[this.t-n-1]|=(this.s&s)<<o),t.t=this.t-n,t.clamp()}}function R(e,t){for(var r=this,n=0,i=0,o=Math.min(e.t,this.t);n<o;)i+=this[n]-e[n],t[n++]=i&this.DM,i>>=this.DB;if(e.t<this.t){for(i-=e.s;n<this.t;)i+=this[n],t[n++]=i&this.DM,i>>=this.DB;i+=this.s}else{for(i+=this.s;n<e.t;)i-=e[n],t[n++]=i&this.DM,i>>=this.DB;i-=e.s}t.s=i<0?-1:0,i<-1?t[n++]=this.DV+i:i>0&&(t[n++]=i),t.t=n,t.clamp()}function N(e,t){var r=this.abs(),i=e.abs(),o=r.t;for(t.t=o+i.t;--o>=0;)t[o]=0;for(o=0;o<i.t;++o)t[o+r.t]=r.am(0,i[o],t,o,0,r.t);t.s=0,t.clamp(),this.s!=e.s&&n.ZERO.subTo(t,t)}function L(e){for(var t=this.abs(),r=e.t=2*t.t;--r>=0;)e[r]=0;for(r=0;r<t.t-1;++r){var n=t.am(r,t[r],e,2*r,0,1);(e[r+t.t]+=t.am(r+1,2*t[r],e,2*r+1,n,t.t-r-1))>=t.DV&&(e[r+t.t]-=t.DV,e[r+t.t+1]=1)}e.t>0&&(e[e.t-1]+=t.am(r,t[r],e,2*r,0,1)),e.s=0,e.clamp()}function j(e,t,r){var i=this,o=e.abs();if(!(o.t<=0)){var s=this.abs();if(s.t<o.t)return null!=t&&t.fromInt(0),void(null!=r&&this.copyTo(r));null==r&&(r=new n);var a=new n,u=this.s,c=e.s,f=this.DB-x(o[o.t-1]);f>0?(o.lShiftTo(f,a),s.lShiftTo(f,r)):(o.copyTo(a),s.copyTo(r));var l=a.t,h=a[l-1];if(0!=h){var p=h*(1<<this.F1)+(l>1?a[l-2]>>this.F2:0),d=this.FV/p,y=(1<<this.F1)/p,g=1<<this.F2,m=r.t,b=m-l,v=null==t?new n:t;for(a.dlShiftTo(b,v),r.compareTo(v)>=0&&(r[r.t++]=1,r.subTo(v,r)),n.ONE.dlShiftTo(l,v),v.subTo(a,a);a.t<l;)a[a.t++]=0;for(;--b>=0;){var _=r[--m]==h?this.DM:Math.floor(r[m]*d+(r[m-1]+g)*y);if((r[m]+=a.am(0,_,r,b,0,l))<_)for(a.dlShiftTo(b,v),r.subTo(v,r);r[m]<--_;)r.subTo(v,r)}null!=t&&(r.drShiftTo(l,t),u!=c&&n.ZERO.subTo(t,t)),r.t=l,r.clamp(),f>0&&r.rShiftTo(f,r),u<0&&n.ZERO.subTo(r,r)}}}function M(e){var t=new n;return this.abs().divRemTo(e,null,t),this.s<0&&t.compareTo(n.ZERO)>0&&e.subTo(t,t),t}function K(e){this.m=e}function D(e){return e.s<0||e.compareTo(this.m)>=0?e.mod(this.m):e}function U(e){return e}function F(e){e.divRemTo(this.m,null,e)}function q(e,t,r){e.multiplyTo(t,r),this.reduce(r)}function H(e,t){e.squareTo(t),this.reduce(t)}function z(){if(this.t<1)return 0;var e=this[0];if(0==(1&e))return 0;var t=3&e;return t=t*(2-(15&e)*t)&15,t=t*(2-(255&e)*t)&255,t=t*(2-((65535&e)*t&65535))&65535,t=t*(2-e*t%this.DV)%this.DV,t>0?this.DV-t:-t}function V(e){this.m=e,this.mp=e.invDigit(),this.mpl=32767&this.mp,this.mph=this.mp>>15,this.um=(1<<e.DB-15)-1,this.mt2=2*e.t}function G(e){var t=new n;return e.abs().dlShiftTo(this.m.t,t),t.divRemTo(this.m,null,t),e.s<0&&t.compareTo(n.ZERO)>0&&this.m.subTo(t,t),t}function W(e){var t=new n;return e.copyTo(t),this.reduce(t),t}function $(e){for(;e.t<=this.mt2;)e[e.t++]=0;for(var t=0;t<this.m.t;++t){var r=32767&e[t],n=r*this.mpl+((r*this.mph+(e[t]>>15)*this.mpl&this.um)<<15)&e.DM;for(r=t+this.m.t,e[r]+=this.m.am(0,n,e,t,0,this.m.t);e[r]>=e.DV;)e[r]-=e.DV,e[++r]++}e.clamp(),e.drShiftTo(this.m.t,e),e.compareTo(this.m)>=0&&e.subTo(this.m,e)}function Y(e,t){e.squareTo(t),this.reduce(t)}function J(e,t,r){e.multiplyTo(t,r),this.reduce(r)}function X(){return 0==(this.t>0?1&this[0]:this.s)}function Z(e,t){if(e>4294967295||e<1)return n.ONE;var r=new n,i=new n,o=t.convert(this),s=x(e)-1;for(o.copyTo(r);--s>=0;)if(t.sqrTo(r,i),(e&1<<s)>0)t.mulTo(i,o,r);else{var a=r;r=i,i=a}return t.revert(r)}function Q(e,t){var r;return r=e<256||t.isEven()?new K(t):new V(t),this.exp(e,r)}function ee(){var e=new n;return this.copyTo(e),e}function te(){if(this.s<0){if(1==this.t)return this[0]-this.DV;if(0==this.t)return-1}else{if(1==this.t)return this[0];if(0==this.t)return 0}return(this[1]&(1<<32-this.DB)-1)<<this.DB|this[0]}function re(){return 0==this.t?this.s:this[0]<<24>>24}function ne(){return 0==this.t?this.s:this[0]<<16>>16}function ie(e){return Math.floor(Math.LN2*this.DB/Math.log(e))}function oe(){return this.s<0?-1:this.t<=0||1==this.t&&this[0]<=0?0:1}function se(e){if(null==e&&(e=10),0==this.signum()||e<2||e>36)return"0";var t=this.chunkSize(e),r=Math.pow(e,t),i=v(r),o=new n,s=new n,a="";for(this.divRemTo(i,o,s);o.signum()>0;)a=(r+s.intValue()).toString(e).substr(1)+a,o.divRemTo(i,o,s);return s.intValue().toString(e)+a}function ae(e,t){var r=this;this.fromInt(0),null==t&&(t=10);for(var i=this.chunkSize(t),o=Math.pow(t,i),s=!1,a=0,u=0,c=0;c<e.length;++c){var f=g(e,c);f<0?"-"==e.charAt(c)&&0==this.signum()&&(s=!0):(u=t*u+f,++a>=i&&(this.dMultiply(o),this.dAddOffset(u,0),a=0,u=0))}a>0&&(this.dMultiply(Math.pow(t,a)),this.dAddOffset(u,0)),s&&n.ZERO.subTo(this,this)}function ue(e,t,r){var i=this;if("number"==typeof t)if(e<2)this.fromInt(1);else for(this.fromNumber(e,r),this.testBit(e-1)||this.bitwiseTo(n.ONE.shiftLeft(e-1),ge,this),this.isEven()&&this.dAddOffset(1,0);!this.isProbablePrime(t);)this.dAddOffset(2,0),this.bitLength()>e&&this.subTo(n.ONE.shiftLeft(e-1),this);else{var o=new Array,s=7&e;o.length=1+(e>>3),t.nextBytes(o),s>0?o[0]&=(1<<s)-1:o[0]=0,this.fromString(o,256)}}function ce(){var e=this,t=this.t,r=new Array;r[0]=this.s;var n=this.DB-t*this.DB%8,i,o=0;if(t-- >0)for(n<this.DB&&(i=this[t]>>n)!=(this.s&this.DM)>>n&&(r[o++]=i|this.s<<this.DB-n);t>=0;)n<8?(i=(this[t]&(1<<n)-1)<<8-n,i|=this[--t]>>(n+=this.DB-8)):(i=this[t]>>(n-=8)&255,n<=0&&(n+=this.DB,--t)),0!=(128&i)&&(i|=-256),0===o&&(128&this.s)!=(128&i)&&++o,(o>0||i!=this.s)&&(r[o++]=i);return r}function fe(e){return 0==this.compareTo(e)}function le(e){return this.compareTo(e)<0?this:e}function he(e){return this.compareTo(e)>0?this:e}function pe(e,t,r){var n=this,i,o,s=Math.min(e.t,this.t);for(i=0;i<s;++i)r[i]=t(this[i],e[i]);if(e.t<this.t){for(o=e.s&this.DM,i=s;i<this.t;++i)r[i]=t(this[i],o);r.t=this.t}else{for(o=this.s&this.DM,i=s;i<e.t;++i)r[i]=t(o,e[i]);r.t=e.t}r.s=t(this.s,e.s),r.clamp()}function de(e,t){return e&t}function ye(e){var t=new n;return this.bitwiseTo(e,de,t),t}function ge(e,t){return e|t}function me(e){var t=new n;return this.bitwiseTo(e,ge,t),t}function be(e,t){return e^t}function ve(e){var t=new n;return this.bitwiseTo(e,be,t),t}function _e(e,t){return e&~t}function we(e){var t=new n;return this.bitwiseTo(e,_e,t),t}function Se(){for(var e=new n,t=0;t<this.t;++t)e[t]=this.DM&~this[t];return e.t=this.t,e.s=~this.s,e}function ke(e){var t=new n;return e<0?this.rShiftTo(-e,t):this.lShiftTo(e,t),t}function Ee(e){var t=new n;return e<0?this.lShiftTo(-e,t):this.rShiftTo(e,t),t}function Ae(e){if(0==e)return-1;var t=0;return 0==(65535&e)&&(e>>=16,t+=16),0==(255&e)&&(e>>=8,t+=8),0==(15&e)&&(e>>=4,t+=4),0==(3&e)&&(e>>=2,t+=2),0==(1&e)&&++t,t}function xe(){for(var e=0;e<this.t;++e)if(0!=this[e])return e*this.DB+Ae(this[e]);return this.s<0?this.t*this.DB:-1}function Ie(e){for(var t=0;0!=e;)e&=e-1,++t;return t}function Te(){for(var e=0,t=this.s&this.DM,r=0;r<this.t;++r)e+=Ie(this[r]^t);return e}function Be(e){var t=Math.floor(e/this.DB);return t>=this.t?0!=this.s:0!=(this[t]&1<<e%this.DB)}function Ce(e,t){var r=n.ONE.shiftLeft(e);return this.bitwiseTo(r,t,r),r}function Pe(e){return this.changeBit(e,ge)}function Oe(e){return this.changeBit(e,_e)}function Re(e){return this.changeBit(e,be)}function Ne(e,t){for(var r=this,n=0,i=0,o=Math.min(e.t,this.t);n<o;)i+=this[n]+e[n],t[n++]=i&this.DM,i>>=this.DB;if(e.t<this.t){for(i+=e.s;n<this.t;)i+=this[n],t[n++]=i&this.DM,i>>=this.DB;i+=this.s}else{for(i+=this.s;n<e.t;)i+=e[n],t[n++]=i&this.DM,i>>=this.DB;i+=e.s}t.s=i<0?-1:0,i>0?t[n++]=i:i<-1&&(t[n++]=this.DV+i),t.t=n,t.clamp()}function Le(e){var t=new n;return this.addTo(e,t),t}function je(e){var t=new n;return this.subTo(e,t),t}function Me(e){var t=new n;return this.multiplyTo(e,t),t}function Ke(){var e=new n;return this.squareTo(e),e}function De(e){var t=new n;return this.divRemTo(e,t,null),t}function Ue(e){var t=new n;return this.divRemTo(e,null,t),t}function Fe(e){var t=new n,r=new n;return this.divRemTo(e,t,r),new Array(t,r)}function qe(e){this[this.t]=this.am(0,e-1,this,0,0,this.t),++this.t,this.clamp()}function He(e,t){if(0!=e){for(;this.t<=t;)this[this.t++]=0;for(this[t]+=e;this[t]>=this.DV;)this[t]-=this.DV,++t>=this.t&&(this[this.t++]=0),++this[t]}}function ze(){}function Ve(e){return e}function Ge(e,t,r){e.multiplyTo(t,r)}function We(e,t){e.squareTo(t)}function $e(e){return this.exp(e,new ze)}function Ye(e,t,r){var n=Math.min(this.t+e.t,t),i;for(r.s=0,r.t=n;n>0;)r[--n]=0;for(i=r.t-this.t;n<i;++n)r[n+this.t]=this.am(0,e[n],r,n,0,this.t);for(i=Math.min(e.t,t);n<i;++n)this.am(0,e[n],r,n,0,t-n);r.clamp()}function Je(e,t,r){--t;var n=r.t=this.t+e.t-t;for(r.s=0;--n>=0;)r[n]=0;for(n=Math.max(t-this.t,0);n<e.t;++n)r[this.t+n-t]=this.am(t-n,e[n],r,0,0,this.t+n-t);r.clamp(),r.drShiftTo(1,r)}function Xe(e){this.r2=new n,this.q3=new n,n.ONE.dlShiftTo(2*e.t,this.r2),this.mu=this.r2.divide(e),this.m=e}function Ze(e){if(e.s<0||e.t>2*this.m.t)return e.mod(this.m);if(e.compareTo(this.m)<0)return e;var t=new n;return e.copyTo(t),this.reduce(t),t}function Qe(e){return e}function et(e){var t=this;for(e.drShiftTo(this.m.t-1,this.r2),e.t>this.m.t+1&&(e.t=this.m.t+1,e.clamp()),this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3),this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2);e.compareTo(this.r2)<0;)e.dAddOffset(1,this.m.t+1);for(e.subTo(this.r2,e);e.compareTo(this.m)>=0;)e.subTo(this.m,e)}function tt(e,t){e.squareTo(t),this.reduce(t)}function rt(e,t,r){e.multiplyTo(t,r),this.reduce(r)}function nt(e,t){var r=e.bitLength(),i,o=v(1),s;if(r<=0)return o;i=r<18?1:r<48?3:r<144?4:r<768?5:6,s=r<8?new K(t):t.isEven()?new Xe(t):new V(t);var a=new Array,u=3,c=i-1,f=(1<<i)-1;if(a[1]=s.convert(this),i>1){var l=new n;for(s.sqrTo(a[1],l);u<=f;)a[u]=new n,s.mulTo(l,a[u-2],a[u]),u+=2}var h=e.t-1,p,d=!0,y=new n,g;for(r=x(e[h])-1;h>=0;){for(r>=c?p=e[h]>>r-c&f:(p=(e[h]&(1<<r+1)-1)<<c-r,h>0&&(p|=e[h-1]>>this.DB+r-c)),u=i;0==(1&p);)p>>=1,--u;if((r-=u)<0&&(r+=this.DB,--h),d)a[p].copyTo(o),d=!1;else{for(;u>1;)s.sqrTo(o,y),s.sqrTo(y,o),u-=2;u>0?s.sqrTo(o,y):(g=o,o=y,y=g),s.mulTo(y,a[p],o)}for(;h>=0&&0==(e[h]&1<<r);)s.sqrTo(o,y),g=o,o=y,y=g,--r<0&&(r=this.DB-1,--h)}return s.revert(o)}function it(e){var t=this.s<0?this.negate():this.clone(),r=e.s<0?e.negate():e.clone();if(t.compareTo(r)<0){var n=t;t=r,r=n}var i=t.getLowestSetBit(),o=r.getLowestSetBit();if(o<0)return t;for(i<o&&(o=i),o>0&&(t.rShiftTo(o,t),r.rShiftTo(o,r));t.signum()>0;)(i=t.getLowestSetBit())>0&&t.rShiftTo(i,t),(i=r.getLowestSetBit())>0&&r.rShiftTo(i,r),t.compareTo(r)>=0?(t.subTo(r,t),t.rShiftTo(1,t)):(r.subTo(t,r),r.rShiftTo(1,r));return o>0&&r.lShiftTo(o,r),r}function ot(e){if(e<=0)return 0;var t=this.DV%e,r=this.s<0?e-1:0;if(this.t>0)if(0==t)r=this[0]%e;else for(var n=this.t-1;n>=0;--n)r=(t*r+this[n])%e;return r}function st(e){var t=e.isEven();if(0===this.signum())throw new Error("division by zero");if(this.isEven()&&t||0==e.signum())return n.ZERO;for(var r=e.clone(),i=this.clone(),o=v(1),s=v(0),a=v(0),u=v(1);0!=r.signum();){for(;r.isEven();)r.rShiftTo(1,r),t?(o.isEven()&&s.isEven()||(o.addTo(this,o),s.subTo(e,s)),o.rShiftTo(1,o)):s.isEven()||s.subTo(e,s),s.rShiftTo(1,s);for(;i.isEven();)i.rShiftTo(1,i),t?(a.isEven()&&u.isEven()||(a.addTo(this,a),u.subTo(e,u)),a.rShiftTo(1,a)):u.isEven()||u.subTo(e,u),u.rShiftTo(1,u);r.compareTo(i)>=0?(r.subTo(i,r),t&&o.subTo(a,o),s.subTo(u,s)):(i.subTo(r,i),t&&a.subTo(o,a),u.subTo(s,u))}if(0!=i.compareTo(n.ONE))return n.ZERO;for(;u.compareTo(e)>=0;)u.subTo(e,u);for(;u.signum()<0;)u.addTo(e,u);return u}K.prototype.convert=D,K.prototype.revert=U,K.prototype.reduce=F,K.prototype.mulTo=q,K.prototype.sqrTo=H,V.prototype.convert=G,V.prototype.revert=W,V.prototype.reduce=$,V.prototype.mulTo=J,V.prototype.sqrTo=Y,i.copyTo=m,i.fromInt=b,i.fromString=_,i.clamp=w,i.dlShiftTo=B,i.drShiftTo=C,i.lShiftTo=P,i.rShiftTo=O,i.subTo=R,i.multiplyTo=N,i.squareTo=L,i.divRemTo=j,i.invDigit=z,i.isEven=X,i.exp=Z,i.toString=S,i.negate=k,i.abs=E,i.compareTo=A,i.bitLength=I,i.byteLength=T,i.mod=M,i.modPowInt=Q,ze.prototype.convert=Ve,ze.prototype.revert=Ve,ze.prototype.mulTo=Ge,ze.prototype.sqrTo=We,Xe.prototype.convert=Ze,Xe.prototype.revert=Qe,Xe.prototype.reduce=et,Xe.prototype.mulTo=rt,Xe.prototype.sqrTo=tt;var at=[2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331,337,347,349,353,359,367,373,379,383,389,397,401,409,419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,509,521,523,541,547,557,563,569,571,577,587,593,599,601,607,613,617,619,631,641,643,647,653,659,661,673,677,683,691,701,709,719,727,733,739,743,751,757,761,769,773,787,797,809,811,821,823,827,829,839,853,857,859,863,877,881,883,887,907,911,919,929,937,941,947,953,967,971,977,983,991,997],ut=(1<<26)/at[at.length-1];function ct(e){var t,r=this.abs();if(1==r.t&&r[0]<=at[at.length-1]){for(t=0;t<at.length;++t)if(r[0]==at[t])return!0;return!1}if(r.isEven())return!1;for(t=1;t<at.length;){for(var n=at[t],i=t+1;i<at.length&&n<ut;)n*=at[i++];for(n=r.modInt(n);t<i;)if(n%at[t++]==0)return!1}return r.millerRabin(e)}function ft(e){var t=this.subtract(n.ONE),r=t.getLowestSetBit();if(r<=0)return!1;var i=t.shiftRight(r);e=e+1>>1,e>at.length&&(e=at.length);for(var o=new n(null),s,a=[],u=0;u<e;++u){for(;s=at[Math.floor(Math.random()*at.length)],-1!=a.indexOf(s););a.push(s),o.fromInt(s);var c=o.modPow(i,this);if(0!=c.compareTo(n.ONE)&&0!=c.compareTo(t)){for(var s=1;s++<r&&0!=c.compareTo(t);)if(c=c.modPowInt(2,this),0==c.compareTo(n.ONE))return!1;if(0!=c.compareTo(t))return!1}}return!0}i.chunkSize=ie,i.toRadix=se,i.fromRadix=ae,i.fromNumber=ue,i.bitwiseTo=pe,i.changeBit=Ce,i.addTo=Ne,i.dMultiply=qe,i.dAddOffset=He,i.multiplyLowerTo=Ye,i.multiplyUpperTo=Je,i.modInt=ot,i.millerRabin=ft,i.clone=ee,i.intValue=te,i.byteValue=re,i.shortValue=ne,i.signum=oe,i.toByteArray=ce,i.equals=fe,i.min=le,i.max=he,i.and=ye,i.or=me,i.xor=ve,i.andNot=we,i.not=Se,i.shiftLeft=ke,i.shiftRight=Ee,i.getLowestSetBit=xe,i.bitCount=Te,i.testBit=Be,i.setBit=Pe,i.clearBit=Oe,i.flipBit=Re,i.add=Le,i.subtract=je,i.multiply=Me,i.divide=De,i.remainder=Ue,i.divideAndRemainder=Fe,i.modPow=nt,i.modInverse=st,i.pow=$e,i.gcd=it,i.isProbablePrime=ct,i.square=Ke,n.ZERO=v(0),n.ONE=v(1),n.valueOf=v,e.exports=n},function(e,t,r){var n=r(13),i=r(2).Buffer,o=r(95),s=o.valueOf(3);function a(e,t,r,i){n.notStrictEqual(i,void 0,"Missing Z coordinate"),this.curve=e,this.x=t,this.y=r,this.z=i,this._zInv=null,this.compressed=!0}Object.defineProperty(a.prototype,"zInv",{get:function(){return null===this._zInv&&(this._zInv=this.z.modInverse(this.curve.p)),this._zInv}}),Object.defineProperty(a.prototype,"affineX",{get:function(){return this.x.multiply(this.zInv).mod(this.curve.p)}}),Object.defineProperty(a.prototype,"affineY",{get:function(){return this.y.multiply(this.zInv).mod(this.curve.p)}}),a.fromAffine=function(e,t,r){return new a(e,t,r,o.ONE)},a.prototype.equals=function(e){if(e===this)return!0;if(this.curve.isInfinity(this))return this.curve.isInfinity(e);if(this.curve.isInfinity(e))return this.curve.isInfinity(this);var t=e.y.multiply(this.z).subtract(this.y.multiply(e.z)).mod(this.curve.p);if(0!==t.signum())return!1;var r=e.x.multiply(this.z).subtract(this.x.multiply(e.z)).mod(this.curve.p);return 0===r.signum()},a.prototype.negate=function(){var e=this.curve.p.subtract(this.y);return new a(this.curve,this.x,e,this.z)},a.prototype.add=function(e){if(this.curve.isInfinity(this))return e;if(this.curve.isInfinity(e))return this;var t=this.x,r=this.y,n=e.x,i=e.y,o=i.multiply(this.z).subtract(r.multiply(e.z)).mod(this.curve.p),u=n.multiply(this.z).subtract(t.multiply(e.z)).mod(this.curve.p);if(0===u.signum())return 0===o.signum()?this.twice():this.curve.infinity;var c=u.square(),f=c.multiply(u),l=t.multiply(c),h=o.square().multiply(this.z),p=h.subtract(l.shiftLeft(1)).multiply(e.z).subtract(f).multiply(u).mod(this.curve.p),d=l.multiply(s).multiply(o).subtract(r.multiply(f)).subtract(h.multiply(o)).multiply(e.z).add(o.multiply(f)).mod(this.curve.p),y=f.multiply(this.z).multiply(e.z).mod(this.curve.p);return new a(this.curve,p,d,y)},a.prototype.twice=function(){if(this.curve.isInfinity(this))return this;if(0===this.y.signum())return this.curve.infinity;var e=this.x,t=this.y,r=t.multiply(this.z).mod(this.curve.p),n=r.multiply(t).mod(this.curve.p),i=this.curve.a,o=e.square().multiply(s);0!==i.signum()&&(o=o.add(this.z.square().multiply(i))),o=o.mod(this.curve.p);var u=o.square().subtract(e.shiftLeft(3).multiply(n)).shiftLeft(1).multiply(r).mod(this.curve.p),c=o.multiply(s).multiply(e).subtract(n.shiftLeft(1)).shiftLeft(2).multiply(n).subtract(o.pow(3)).mod(this.curve.p),f=r.pow(3).shiftLeft(3).mod(this.curve.p);return new a(this.curve,u,c,f)},a.prototype.multiply=function(e){if(this.curve.isInfinity(this))return this;if(0===e.signum())return this.curve.infinity;for(var t=e,r=t.multiply(s),n=this.negate(),i=this,o=r.bitLength()-2;o>0;--o){var a=r.testBit(o),u=t.testBit(o);i=i.twice(),a!==u&&(i=i.add(a?this:n))}return i},a.prototype.multiplyTwo=function(e,t,r){for(var n=Math.max(e.bitLength(),r.bitLength())-1,i=this.curve.infinity,o=this.add(t);n>=0;){var s=e.testBit(n),a=r.testBit(n);i=i.twice(),s?i=a?i.add(o):i.add(this):a&&(i=i.add(t)),--n}return i},a.prototype.getEncoded=function(e){if(null==e&&(e=this.compressed),this.curve.isInfinity(this))return i.alloc(1,0);var t=this.affineX,r=this.affineY,n=this.curve.pLength,o;return e?(o=i.allocUnsafe(1+n),o.writeUInt8(r.isEven()?2:3,0)):(o=i.allocUnsafe(1+n+n),o.writeUInt8(4,0),r.toBuffer(n).copy(o,1+n)),t.toBuffer(n).copy(o,1),o},a.decodeFrom=function(e,t){var r=t.readUInt8(0),i=4!==r,s=Math.floor((e.p.bitLength()+7)/8),u=o.fromBuffer(t.slice(1,1+s)),c;if(i){n.equal(t.length,s+1,"Invalid sequence length"),n(2===r||3===r,"Invalid sequence tag");var f=3===r;c=e.pointFromX(f,u)}else{n.equal(t.length,1+s+s,"Invalid sequence length");var l=o.fromBuffer(t.slice(1+s));c=a.fromAffine(e,u,l)}return c.compressed=i,c},a.prototype.toString=function(){return this.curve.isInfinity(this)?"(INFINITY)":"("+this.affineX.toString()+","+this.affineY.toString()+")"},e.exports=a},function(e,t,r){var n=r(13),i=r(95),o=r(406);function s(e,t,r,n,s,a,u){this.p=e,this.a=t,this.b=r,this.G=o.fromAffine(this,n,s),this.n=a,this.h=u,this.infinity=new o(this,null,null,i.ZERO),this.pOverFour=e.add(i.ONE).shiftRight(2),this.pLength=Math.floor((this.p.bitLength()+7)/8)}s.prototype.pointFromX=function(e,t){var r=t.pow(3).add(this.a.multiply(t)).add(this.b).mod(this.p),n=r.modPow(this.pOverFour,this.p),i=n;return n.isEven()^!e&&(i=this.p.subtract(i)),o.fromAffine(this,t,i)},s.prototype.isInfinity=function(e){return e===this.infinity||0===e.z.signum()&&0!==e.y.signum()},s.prototype.isOnCurve=function(e){if(this.isInfinity(e))return!0;var t=e.affineX,r=e.affineY,n=this.a,i=this.b,o=this.p;if(t.signum()<0||t.compareTo(o)>=0)return!1;if(r.signum()<0||r.compareTo(o)>=0)return!1;var s=r.square().mod(o),a=t.pow(3).add(n.multiply(t)).add(i).mod(o);return s.equals(a)},s.prototype.validate=function(e){n(!this.isInfinity(e),"Point is at infinity"),n(this.isOnCurve(e),"Point is not on the curve");var t=e.multiply(this.n);return n(this.isInfinity(t),"Point is not a scalar multiple of G"),!0},e.exports=s},function(e,t,r){"use strict";(function(t){const n=r(797),i=r(131),o=r(132),s=r(834);function a(e,r,n){const o=[];o.push({path:"storage",value:{"/":i("eth-storage-trie",e.stateRoot).toBaseEncodedString()}}),s.equals(e.codeHash)?o.push({path:"code",value:t.from("")}):o.push({path:"code",value:{"/":i("raw",e.codeHash).toBaseEncodedString()}}),o.push({path:"stateRoot",value:e.stateRoot}),o.push({path:"codeHash",value:e.codeHash}),o.push({path:"nonce",value:e.nonce}),o.push({path:"balance",value:e.balance}),o.push({path:"isEmpty",value:e.isEmpty()}),o.push({path:"isContract",value:e.isContract()}),n(null,o)}e.exports=o("eth-account-snapshot",n,a)}).call(this,r(0).Buffer)},function(e,t,r){"use strict";var n=r(805),i=r(806),o=r(244);function s(e,t){return void 0===e?t:(n.isBoolean(e,o.COMPRESSED_TYPE_INVALID),e)}e.exports=function(e){return{privateKeyVerify:function(t){return n.isBuffer(t,o.EC_PRIVATE_KEY_TYPE_INVALID),32===t.length&&e.privateKeyVerify(t)},privateKeyExport:function(t,r){n.isBuffer(t,o.EC_PRIVATE_KEY_TYPE_INVALID),n.isBufferLength(t,32,o.EC_PRIVATE_KEY_LENGTH_INVALID),r=s(r,!0);var a=e.privateKeyExport(t,r);return i.privateKeyExport(t,a,r)},privateKeyImport:function(t){if(n.isBuffer(t,o.EC_PRIVATE_KEY_TYPE_INVALID),t=i.privateKeyImport(t),t&&32===t.length&&e.privateKeyVerify(t))return t;throw new Error(o.EC_PRIVATE_KEY_IMPORT_DER_FAIL)},privateKeyNegate:function(t){return n.isBuffer(t,o.EC_PRIVATE_KEY_TYPE_INVALID),n.isBufferLength(t,32,o.EC_PRIVATE_KEY_LENGTH_INVALID),e.privateKeyNegate(t)},privateKeyModInverse:function(t){return n.isBuffer(t,o.EC_PRIVATE_KEY_TYPE_INVALID),n.isBufferLength(t,32,o.EC_PRIVATE_KEY_LENGTH_INVALID),e.privateKeyModInverse(t)},privateKeyTweakAdd:function(t,r){return n.isBuffer(t,o.EC_PRIVATE_KEY_TYPE_INVALID),n.isBufferLength(t,32,o.EC_PRIVATE_KEY_LENGTH_INVALID),n.isBuffer(r,o.TWEAK_TYPE_INVALID),n.isBufferLength(r,32,o.TWEAK_LENGTH_INVALID),e.privateKeyTweakAdd(t,r)},privateKeyTweakMul:function(t,r){return n.isBuffer(t,o.EC_PRIVATE_KEY_TYPE_INVALID),n.isBufferLength(t,32,o.EC_PRIVATE_KEY_LENGTH_INVALID),n.isBuffer(r,o.TWEAK_TYPE_INVALID),n.isBufferLength(r,32,o.TWEAK_LENGTH_INVALID),e.privateKeyTweakMul(t,r)},publicKeyCreate:function(t,r){return n.isBuffer(t,o.EC_PRIVATE_KEY_TYPE_INVALID),n.isBufferLength(t,32,o.EC_PRIVATE_KEY_LENGTH_INVALID),r=s(r,!0),e.publicKeyCreate(t,r)},publicKeyConvert:function(t,r){return n.isBuffer(t,o.EC_PUBLIC_KEY_TYPE_INVALID),n.isBufferLength2(t,33,65,o.EC_PUBLIC_KEY_LENGTH_INVALID),r=s(r,!0),e.publicKeyConvert(t,r)},publicKeyVerify:function(t){return n.isBuffer(t,o.EC_PUBLIC_KEY_TYPE_INVALID),e.publicKeyVerify(t)},publicKeyTweakAdd:function(t,r,i){return n.isBuffer(t,o.EC_PUBLIC_KEY_TYPE_INVALID),n.isBufferLength2(t,33,65,o.EC_PUBLIC_KEY_LENGTH_INVALID),n.isBuffer(r,o.TWEAK_TYPE_INVALID),n.isBufferLength(r,32,o.TWEAK_LENGTH_INVALID),i=s(i,!0),e.publicKeyTweakAdd(t,r,i)},publicKeyTweakMul:function(t,r,i){return n.isBuffer(t,o.EC_PUBLIC_KEY_TYPE_INVALID),n.isBufferLength2(t,33,65,o.EC_PUBLIC_KEY_LENGTH_INVALID),n.isBuffer(r,o.TWEAK_TYPE_INVALID),n.isBufferLength(r,32,o.TWEAK_LENGTH_INVALID),i=s(i,!0),e.publicKeyTweakMul(t,r,i)},publicKeyCombine:function(t,r){n.isArray(t,o.EC_PUBLIC_KEYS_TYPE_INVALID),n.isLengthGTZero(t,o.EC_PUBLIC_KEYS_LENGTH_INVALID);for(var i=0;i<t.length;++i)n.isBuffer(t[i],o.EC_PUBLIC_KEY_TYPE_INVALID),n.isBufferLength2(t[i],33,65,o.EC_PUBLIC_KEY_LENGTH_INVALID);return r=s(r,!0),e.publicKeyCombine(t,r)},signatureNormalize:function(t){return n.isBuffer(t,o.ECDSA_SIGNATURE_TYPE_INVALID),n.isBufferLength(t,64,o.ECDSA_SIGNATURE_LENGTH_INVALID),e.signatureNormalize(t)},signatureExport:function(t){n.isBuffer(t,o.ECDSA_SIGNATURE_TYPE_INVALID),n.isBufferLength(t,64,o.ECDSA_SIGNATURE_LENGTH_INVALID);var r=e.signatureExport(t);return i.signatureExport(r)},signatureImport:function(t){n.isBuffer(t,o.ECDSA_SIGNATURE_TYPE_INVALID),n.isLengthGTZero(t,o.ECDSA_SIGNATURE_LENGTH_INVALID);var r=i.signatureImport(t);if(r)return e.signatureImport(r);throw new Error(o.ECDSA_SIGNATURE_PARSE_DER_FAIL)},signatureImportLax:function(t){n.isBuffer(t,o.ECDSA_SIGNATURE_TYPE_INVALID),n.isLengthGTZero(t,o.ECDSA_SIGNATURE_LENGTH_INVALID);var r=i.signatureImportLax(t);if(r)return e.signatureImport(r);throw new Error(o.ECDSA_SIGNATURE_PARSE_DER_FAIL)},sign:function(t,r,i){n.isBuffer(t,o.MSG32_TYPE_INVALID),n.isBufferLength(t,32,o.MSG32_LENGTH_INVALID),n.isBuffer(r,o.EC_PRIVATE_KEY_TYPE_INVALID),n.isBufferLength(r,32,o.EC_PRIVATE_KEY_LENGTH_INVALID);var s=null,a=null;return void 0!==i&&(n.isObject(i,o.OPTIONS_TYPE_INVALID),void 0!==i.data&&(n.isBuffer(i.data,o.OPTIONS_DATA_TYPE_INVALID),n.isBufferLength(i.data,32,o.OPTIONS_DATA_LENGTH_INVALID),s=i.data),void 0!==i.noncefn&&(n.isFunction(i.noncefn,o.OPTIONS_NONCEFN_TYPE_INVALID),a=i.noncefn)),e.sign(t,r,a,s)},verify:function(t,r,i){return n.isBuffer(t,o.MSG32_TYPE_INVALID),n.isBufferLength(t,32,o.MSG32_LENGTH_INVALID),n.isBuffer(r,o.ECDSA_SIGNATURE_TYPE_INVALID),n.isBufferLength(r,64,o.ECDSA_SIGNATURE_LENGTH_INVALID),n.isBuffer(i,o.EC_PUBLIC_KEY_TYPE_INVALID),n.isBufferLength2(i,33,65,o.EC_PUBLIC_KEY_LENGTH_INVALID),e.verify(t,r,i)},recover:function(t,r,i,a){return n.isBuffer(t,o.MSG32_TYPE_INVALID),n.isBufferLength(t,32,o.MSG32_LENGTH_INVALID),n.isBuffer(r,o.ECDSA_SIGNATURE_TYPE_INVALID),n.isBufferLength(r,64,o.ECDSA_SIGNATURE_LENGTH_INVALID),n.isNumber(i,o.RECOVERY_ID_TYPE_INVALID),n.isNumberInInterval(i,-1,4,o.RECOVERY_ID_VALUE_INVALID),a=s(a,!0),e.recover(t,r,i,a)},ecdh:function(t,r){return n.isBuffer(t,o.EC_PUBLIC_KEY_TYPE_INVALID),n.isBufferLength2(t,33,65,o.EC_PUBLIC_KEY_LENGTH_INVALID),n.isBuffer(r,o.EC_PRIVATE_KEY_TYPE_INVALID),n.isBufferLength(r,32,o.EC_PRIVATE_KEY_LENGTH_INVALID),e.ecdh(t,r)},ecdhUnsafe:function(t,r,i){return n.isBuffer(t,o.EC_PUBLIC_KEY_TYPE_INVALID),n.isBufferLength2(t,33,65,o.EC_PUBLIC_KEY_LENGTH_INVALID),n.isBuffer(r,o.EC_PRIVATE_KEY_TYPE_INVALID),n.isBufferLength(r,32,o.EC_PRIVATE_KEY_LENGTH_INVALID),i=s(i,!0),e.ecdhUnsafe(t,r,i)}}}},function(e,t,r){"use strict";var n=t;function i(e,t){if(Array.isArray(e))return e.slice();if(!e)return[];var r=[];if("string"!=typeof e){for(var n=0;n<e.length;n++)r[n]=0|e[n];return r}if("hex"===t){e=e.replace(/[^a-z0-9]+/gi,""),e.length%2!=0&&(e="0"+e);for(var n=0;n<e.length;n+=2)r.push(parseInt(e[n]+e[n+1],16))}else for(var n=0;n<e.length;n++){var i=e.charCodeAt(n),o=i>>8,s=255&i;o?r.push(o,s):r.push(s)}return r}function o(e){return 1===e.length?"0"+e:e}function s(e){for(var t="",r=0;r<e.length;r++)t+=o(e[r].toString(16));return t}n.toArray=i,n.zero2=o,n.toHex=s,n.encode=function e(t,r){return"hex"===r?s(t):t}},function(e,t,r){"use strict";var n=r(65),i=n.rotr32;function o(e,t,r,n){return 0===e?s(t,r,n):1===e||3===e?u(t,r,n):2===e?a(t,r,n):void 0}function s(e,t,r){return e&t^~e&r}function a(e,t,r){return e&t^e&r^t&r}function u(e,t,r){return e^t^r}function c(e){return i(e,2)^i(e,13)^i(e,22)}function f(e){return i(e,6)^i(e,11)^i(e,25)}function l(e){return i(e,7)^i(e,18)^e>>>3}function h(e){return i(e,17)^i(e,19)^e>>>10}t.ft_1=o,t.ch32=s,t.maj32=a,t.p32=u,t.s0_256=c,t.s1_256=f,t.g0_256=l,t.g1_256=h},function(e,t,r){"use strict";var n=r(65),i=r(129),o=r(411),s=r(84),a=n.sum32,u=n.sum32_4,c=n.sum32_5,f=o.ch32,l=o.maj32,h=o.s0_256,p=o.s1_256,d=o.g0_256,y=o.g1_256,g=i.BlockHash,m=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298];function b(){if(!(this instanceof b))return new b;g.call(this),this.h=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],this.k=m,this.W=new Array(64)}n.inherits(b,g),e.exports=b,b.blockSize=512,b.outSize=256,b.hmacStrength=192,b.padLength=64,b.prototype._update=function e(t,r){for(var n=this.W,i=0;i<16;i++)n[i]=t[r+i];for(;i<n.length;i++)n[i]=u(y(n[i-2]),n[i-7],d(n[i-15]),n[i-16]);var o=this.h[0],g=this.h[1],m=this.h[2],b=this.h[3],v=this.h[4],_=this.h[5],w=this.h[6],S=this.h[7];for(s(this.k.length===n.length),i=0;i<n.length;i++){var k=c(S,p(v),f(v,_,w),this.k[i],n[i]),E=a(h(o),l(o,g,m));S=w,w=_,_=v,v=a(b,k),b=m,m=g,g=o,o=a(k,E)}this.h[0]=a(this.h[0],o),this.h[1]=a(this.h[1],g),this.h[2]=a(this.h[2],m),this.h[3]=a(this.h[3],b),this.h[4]=a(this.h[4],v),this.h[5]=a(this.h[5],_),this.h[6]=a(this.h[6],w),this.h[7]=a(this.h[7],S)},b.prototype._digest=function e(t){return"hex"===t?n.toHex32(this.h,"big"):n.split32(this.h,"big")}},function(e,t,r){"use strict";var n=r(65),i=r(129),o=r(84),s=n.rotr64_hi,a=n.rotr64_lo,u=n.shr64_hi,c=n.shr64_lo,f=n.sum64,l=n.sum64_hi,h=n.sum64_lo,p=n.sum64_4_hi,d=n.sum64_4_lo,y=n.sum64_5_hi,g=n.sum64_5_lo,m=i.BlockHash,b=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591];function v(){if(!(this instanceof v))return new v;m.call(this),this.h=[1779033703,4089235720,3144134277,2227873595,1013904242,4271175723,2773480762,1595750129,1359893119,2917565137,2600822924,725511199,528734635,4215389547,1541459225,327033209],this.k=b,this.W=new Array(160)}function _(e,t,r,n,i){var o=e&r^~e&i;return o<0&&(o+=4294967296),o}function w(e,t,r,n,i,o){var s=t&n^~t&o;return s<0&&(s+=4294967296),s}function S(e,t,r,n,i){var o=e&r^e&i^r&i;return o<0&&(o+=4294967296),o}function k(e,t,r,n,i,o){var s=t&n^t&o^n&o;return s<0&&(s+=4294967296),s}function E(e,t){var r=s(e,t,28),n=s(t,e,2),i=s(t,e,7),o=r^n^i;return o<0&&(o+=4294967296),o}function A(e,t){var r=a(e,t,28),n=a(t,e,2),i=a(t,e,7),o=r^n^i;return o<0&&(o+=4294967296),o}function x(e,t){var r=s(e,t,14),n=s(e,t,18),i=s(t,e,9),o=r^n^i;return o<0&&(o+=4294967296),o}function I(e,t){var r=a(e,t,14),n=a(e,t,18),i=a(t,e,9),o=r^n^i;return o<0&&(o+=4294967296),o}function T(e,t){var r=s(e,t,1),n=s(e,t,8),i=u(e,t,7),o=r^n^i;return o<0&&(o+=4294967296),o}function B(e,t){var r=a(e,t,1),n=a(e,t,8),i=c(e,t,7),o=r^n^i;return o<0&&(o+=4294967296),o}function C(e,t){var r=s(e,t,19),n=s(t,e,29),i=u(e,t,6),o=r^n^i;return o<0&&(o+=4294967296),o}function P(e,t){var r=a(e,t,19),n=a(t,e,29),i=c(e,t,6),o=r^n^i;return o<0&&(o+=4294967296),o}n.inherits(v,m),e.exports=v,v.blockSize=1024,v.outSize=512,v.hmacStrength=192,v.padLength=128,v.prototype._prepareBlock=function e(t,r){for(var n=this.W,i=0;i<32;i++)n[i]=t[r+i];for(;i<n.length;i+=2){var o=C(n[i-4],n[i-3]),s=P(n[i-4],n[i-3]),a=n[i-14],u=n[i-13],c=T(n[i-30],n[i-29]),f=B(n[i-30],n[i-29]),l=n[i-32],h=n[i-31];n[i]=p(o,s,a,u,c,f,l,h),n[i+1]=d(o,s,a,u,c,f,l,h)}},v.prototype._update=function e(t,r){this._prepareBlock(t,r);var n=this.W,i=this.h[0],s=this.h[1],a=this.h[2],u=this.h[3],c=this.h[4],p=this.h[5],d=this.h[6],m=this.h[7],b=this.h[8],v=this.h[9],T=this.h[10],B=this.h[11],C=this.h[12],P=this.h[13],O=this.h[14],R=this.h[15];o(this.k.length===n.length);for(var N=0;N<n.length;N+=2){var L=O,j=R,M=x(b,v),K=I(b,v),D=_(b,v,T,B,C,P),U=w(b,v,T,B,C,P),F=this.k[N],q=this.k[N+1],H=n[N],z=n[N+1],V=y(L,j,M,K,D,U,F,q,H,z),G=g(L,j,M,K,D,U,F,q,H,z);L=E(i,s),j=A(i,s),M=S(i,s,a,u,c,p),K=k(i,s,a,u,c,p);var W=l(L,j,M,K),$=h(L,j,M,K);O=C,R=P,C=T,P=B,T=b,B=v,b=l(d,m,V,G),v=h(m,m,V,G),d=c,m=p,c=a,p=u,a=i,u=s,i=l(V,G,W,$),s=h(V,G,W,$)}f(this.h,0,i,s),f(this.h,2,a,u),f(this.h,4,c,p),f(this.h,6,d,m),f(this.h,8,b,v),f(this.h,10,T,B),f(this.h,12,C,P),f(this.h,14,O,R)},v.prototype._digest=function e(t){return"hex"===t?n.toHex32(this.h,"big"):n.split32(this.h,"big")}},function(e,t){e.exports=function e(t){if("string"!=typeof t)throw new Error("[is-hex-prefixed] value must be type 'string', is currently type "+typeof t+", while checking isHexPrefixed.");return"0x"===t.slice(0,2)}},function(e,t){function r(e){return function t(r,n,i){e(r,n,(e,t)=>e?i(e):t.remainderPath.length>0?i(new Error("path out of scope")):void("object"==typeof t.value&&t.value["/"]?i(null,t.value):i(null,!1)))}}e.exports=r},function(e,t,r){const n=r(417),i=r(154);function o(e,t){return{deserialize:i(e=>new t(e)),serialize:i(e=>e.serialize()),cid:i((t,r)=>n(e,t,r))}}e.exports=o},function(e,t,r){"use strict";const n=r(131);function i(e,t,r){const i=t.hash(),o=n(e,i,r);return o}e.exports=i},function(e,t,r){"use strict";const n=r(419),i=r(131),o=r(132);function s(e,t,r){const n=[];n.push({path:"parent",value:{"/":i("eth-block",e.parentHash).toBaseEncodedString()}}),n.push({path:"ommers",value:{"/":i("eth-block-list",e.uncleHash).toBaseEncodedString()}}),n.push({path:"transactions",value:{"/":i("eth-tx-trie",e.transactionsTrie).toBaseEncodedString()}}),n.push({path:"transactionReceipts",value:{"/":i("eth-tx-receipt-trie",e.receiptTrie).toBaseEncodedString()}}),n.push({path:"state",value:{"/":i("eth-state-trie",e.stateRoot).toBaseEncodedString()}}),n.push({path:"parentHash",value:e.parentHash}),n.push({path:"ommerHash",value:e.uncleHash}),n.push({path:"transactionTrieRoot",value:e.transactionsTrie}),n.push({path:"transactionReceiptTrieRoot",value:e.receiptTrie}),n.push({path:"stateRoot",value:e.stateRoot}),n.push({path:"authorAddress",value:e.coinbase}),n.push({path:"bloom",value:e.bloom}),n.push({path:"difficulty",value:e.difficulty}),n.push({path:"number",value:e.number}),n.push({path:"gasLimit",value:e.gasLimit}),n.push({path:"gasUsed",value:e.gasUsed}),n.push({path:"timestamp",value:e.timestamp}),n.push({path:"extraData",value:e.extraData}),n.push({path:"mixHash",value:e.mixHash}),n.push({path:"nonce",value:e.nonce}),r(null,n)}e.exports=o("eth-block",n,s)},function(e,t,r){(function(t){const n=r(173),i=r(835),o=n.BN;var s=e.exports=function(e){var r=[{name:"parentHash",length:32,default:n.zeros(32)},{name:"uncleHash",default:n.SHA3_RLP_ARRAY},{name:"coinbase",length:20,default:n.zeros(20)},{name:"stateRoot",length:32,default:n.zeros(32)},{name:"transactionsTrie",length:32,default:n.SHA3_RLP},{name:"receiptTrie",length:32,default:n.SHA3_RLP},{name:"bloom",default:n.zeros(256)},{name:"difficulty",default:new t([])},{name:"number",default:n.intToBuffer(i.homeSteadForkNumber.v)},{name:"gasLimit",default:new t("ffffffffffffff","hex")},{name:"gasUsed",empty:!0,default:new t([])},{name:"timestamp",default:new t([])},{name:"extraData",allowZero:!0,empty:!0,default:new t([])},{name:"mixHash",default:n.zeros(32)},{name:"nonce",default:new t([])}];n.defineProperties(this,r,e)};s.prototype.canonicalDifficulty=function(e){const t=new o(this.timestamp),r=new o(e.header.timestamp),s=new o(e.header.difficulty),a=new o(i.minimumDifficulty.v);var u=s.div(new o(i.difficultyBoundDivisor.v)),c,f=e.header.uncleHash.equals(n.SHA3_RLP_ARRAY)?1:2,l=t.sub(r).idivn(9).ineg().iaddn(f),h=new o(-99);1===h.cmp(l)&&(l=h),c=s.add(u.mul(l));var p=new o(this.number).isubn(3e6);p.ltn(0)&&(p=new o(0));var d=p.idivn(1e5).isubn(2);return d.isNeg()||c.iadd(new o(2).pow(d)),-1===c.cmp(a)&&(c=a),c},s.prototype.validateDifficulty=function(e){const t=this.canonicalDifficulty(e);return 0===t.cmp(new o(this.difficulty))},s.prototype.validateGasLimit=function(e){const t=new o(e.header.gasLimit),r=new o(this.gasLimit),n=t.div(new o(i.gasLimitBoundDivisor.v)),s=t.add(n),a=t.sub(n);return r.lt(s)&&r.gt(a)&&r.gte(i.minGasLimit.v)},s.prototype.validate=function(e,t,r){var s=this;if(2===arguments.length&&(r=t,t=!1),this.isGenesis())return r();e.getBlock(s.parentHash,function(e,a){if(e)return r("could not find parent block");s.parentBlock=a;var u=new o(s.number);if(0!==u.cmp(new o(a.header.number).iaddn(1)))return r("invalid number");if(t){var c=t.sub(new o(a.header.number));if(-1!==c.cmpn(8)||1!==c.cmpn(1))return r("uncle block has a parent that is too old or to young")}return s.validateDifficulty(a)?s.validateGasLimit(a)?n.bufferToInt(a.header.number)+1!==n.bufferToInt(s.number)?r("invalid heigth"):n.bufferToInt(s.timestamp)<=n.bufferToInt(a.header.timestamp)?r("invalid timestamp"):s.extraData.length>i.maximumExtraDataSize.v?r("invalid amount of extra data"):void r():r("invalid gas limit"):r("invalid Difficulty")})},s.prototype.hash=function(){return n.rlphash(this.raw)},s.prototype.isGenesis=function(){return""===this.number.toString("hex")}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(e){const n=r(3);t.toCallback=(e=>(function(t,r){const i=(e,t)=>n(()=>{r(e,t)});let o;try{o=e(t)}catch(e){return void i(e)}i(null,o)})),t.toBuf=((t,r)=>n=>{let i=t(n,r);return e.from(i,"hex")}),t.fromString=((t,r)=>n=>{const i=e.isBuffer(n)?n.toString():n;return t(i,r)}),t.fromNumberTo32BitBuf=((t,r)=>n=>{let i=t(n,r);const o=new Array(4);for(let e=0;e<4;e++)o[e]=255&i,i>>=8;return e.from(o)})}).call(this,r(0).Buffer)},function(e,t,r){"use strict";const n=r(845),i=r(132);function o(e,t,r){const n=[];n.push({path:"nonce",value:e.nonce}),n.push({path:"gasPrice",value:e.gasPrice}),n.push({path:"gasLimit",value:e.gasLimit}),n.push({path:"toAddress",value:e.to}),n.push({path:"value",value:e.value}),n.push({path:"data",value:e.data}),n.push({path:"v",value:e.v}),n.push({path:"r",value:e.r}),n.push({path:"s",value:e.s}),n.push({path:"fromAddress",value:e.from}),n.push({path:"signature",value:[e.v,e.r,e.s]}),n.push({path:"isContractPublish",value:e.toCreationAddress()}),r(null,n)}e.exports=i("eth-tx",n,o)},function(e,t,r){"use strict";const n=r(850).BlockHeader,i=r(9),o=r(14),s=r(59),a=r(5),u=1487,c=(e,t)=>{let r=null,n;try{n=e.toBuffer()}catch(e){r=e}finally{t(r,n)}},f=(e,t)=>{if(1487!==e.length){const e=new Error("Zcash block header needs to be 1487 bytes");return t(e)}const r=n.fromBuffer(e);t(null,r)},l=(e,t,n)=>{"function"==typeof t&&(n=t,t={}),t=t||{};const o=t.hashAlg||r(247).defaultHashAlg,u=void 0===t.version?1:t.version;a([t=>{try{s(e.toBuffer(),o,t)}catch(e){t(e)}},(e,t)=>t(null,new i(u,"zcash-block",e))],n)},h=e=>{const t=r(247).defaultHashAlg,n=o.encode(e,t),s=1,a=new i(1,"zcash-block",n);return a};e.exports={hashToCid:h,ZCASH_BLOCK_HEADER_SIZE:1487,cid:l,deserialize:f,serialize:c}},function(e,t,r){"use strict";(function(t){var n=r(34),i=r(111),o=r(61),s=r(67),a=r(179),u=r(40),c=r(24),f=r(15),l=r(20),h=function e(t){if(!(this instanceof e))return new e(t);t&&this.set(t)};h.prototype.set=function(e){return this.hashbuf=e.hashbuf||this.hashbuf,this.endian=e.endian||this.endian,this.privkey=e.privkey||this.privkey,this.pubkey=e.pubkey||(this.privkey?this.privkey.publicKey:this.pubkey),this.sig=e.sig||this.sig,this.k=e.k||this.k,this.verified=e.verified||this.verified,this},h.prototype.privkey2pubkey=function(){this.pubkey=this.privkey.toPublicKey()},h.prototype.calci=function(){for(var e=0;e<4;e++){var t;this.sig.i=e;try{t=this.toPublicKey()}catch(e){console.error(e);continue}if(t.point.eq(this.pubkey.point))return this.sig.compressed=this.pubkey.compressed,this}throw this.sig.i=void 0,new Error("Unable to find valid recovery factor")},h.fromString=function(e){var t=JSON.parse(e);return new h(t)},h.prototype.randomK=function(){var e=i.getN(),t;do{t=n.fromBuffer(a.getRandomBuffer(32))}while(!t.lt(e)||!t.gt(n.Zero));return this.k=t,this},h.prototype.deterministicK=function(e){f.isUndefined(e)&&(e=0);var r=new t(32);r.fill(1);var o=new t(32);o.fill(0);var s=this.privkey.bn.toBuffer({size:32}),a="little"===this.endian?c.reverse(this.hashbuf):this.hashbuf;o=u.sha256hmac(t.concat([r,new t([0]),s,a]),o),r=u.sha256hmac(r,o),o=u.sha256hmac(t.concat([r,new t([1]),s,a]),o),r=u.sha256hmac(r,o),r=u.sha256hmac(r,o);for(var l=n.fromBuffer(r),h=i.getN(),p=0;p<e||!l.lt(h)||!l.gt(n.Zero);p++)o=u.sha256hmac(t.concat([r,new t([0])]),o),r=u.sha256hmac(r,o),r=u.sha256hmac(r,o),l=n.fromBuffer(r);return this.k=l,this},h.prototype.toPublicKey=function(){var e=this.sig.i;l.checkArgument(0===e||1===e||2===e||3===e,new Error("i must be equal to 0, 1, 2, or 3"));var t=n.fromBuffer(this.hashbuf),r=this.sig.r,o=this.sig.s,a=1&e,u=e>>1,c=i.getN(),f=i.getG(),h=u?r.add(c):r,p=i.fromX(a,h),d=p.mul(c);if(!d.isInfinity())throw new Error("nR is not a valid curve point");var y=t.neg().mod(c),g=r.invm(c),m=p.mul(o).add(f.mul(y)).mul(g),b=s.fromPoint(m,this.sig.compressed);return b},h.prototype.sigError=function(){if(!c.isBuffer(this.hashbuf)||32!==this.hashbuf.length)return"hashbuf must be a 32 byte buffer";var e=this.sig.r,t=this.sig.s;if(!(e.gt(n.Zero)&&e.lt(i.getN())&&t.gt(n.Zero)&&t.lt(i.getN())))return"r and s not in range";var r=n.fromBuffer(this.hashbuf,this.endian?{endian:this.endian}:void 0),o=i.getN(),s=t.invm(o),a=s.mul(r).mod(o),u=s.mul(e).mod(o),f=i.getG().mulAdd(a,this.pubkey.point,u);return f.isInfinity()?"p is infinity":0!==f.getX().mod(o).cmp(e)&&"Invalid signature"},h.toLowS=function(e){return e.gt(n.fromBuffer(new t("7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0","hex")))&&(e=i.getN().sub(e)),e},h.prototype._findSignature=function(e,t){var r=i.getN(),o=i.getG(),s=0,a,u,c,f;do{(!this.k||s>0)&&this.deterministicK(s),s++,a=this.k,u=o.mul(a),c=u.x.mod(r),f=a.invm(r).mul(t.add(e.mul(c))).mod(r)}while(c.cmp(n.Zero)<=0||f.cmp(n.Zero)<=0);return f=h.toLowS(f),{s:f,r:c}},h.prototype.sign=function(){var e=this.hashbuf,t=this.privkey,r=t.bn;l.checkState(e&&t&&r,new Error("invalid parameters")),l.checkState(c.isBuffer(e)&&32===e.length,new Error("hashbuf must be a 32 byte buffer"));var i=n.fromBuffer(e,this.endian?{endian:this.endian}:void 0),s=this._findSignature(r,i);return s.compressed=this.pubkey.compressed,this.sig=new o(s),this},h.prototype.signRandomK=function(){return this.randomK(),this.sign()},h.prototype.toString=function(){var e={};return this.hashbuf&&(e.hashbuf=this.hashbuf.toString("hex")),this.privkey&&(e.privkey=this.privkey.toString()),this.pubkey&&(e.pubkey=this.pubkey.toString()),this.sig&&(e.sig=this.sig.toString()),this.k&&(e.k=this.k.toString()),JSON.stringify(e)},h.prototype.verify=function(){return this.sigError()?this.verified=!1:this.verified=!0,this},h.sign=function(e,t,r){return h().set({hashbuf:e,endian:r,privkey:t}).sign().sig},h.verify=function(e,t,r,n){return h().set({hashbuf:e,endian:n,sig:t,pubkey:r}).verify().verified},e.exports=h}).call(this,r(0).Buffer)},function(e,t){for(var r="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz",n={},i=0;i<r.length;i++)n[r.charAt(i)]=i;var o=58;function s(e){if(0===e.length)return"";var t,n,i=[0];for(t=0;t<e.length;t++){for(n=0;n<i.length;n++)i[n]<<=8;i[0]+=e[t];var s=0;for(n=0;n<i.length;++n)i[n]+=s,s=i[n]/o|0,i[n]%=o;for(;s;)i.push(s%o),s=s/o|0}for(t=0;0===e[t]&&t<e.length-1;t++)i.push(0);return i.reverse().map(function(e){return r[e]}).join("")}function a(e){if(0===e.length)return[];var t,r,i=[0];for(t=0;t<e.length;t++){var s=e[t];if(!(s in n))throw new Error("Non-base58 character");for(r=0;r<i.length;r++)i[r]*=o;i[0]+=n[s];var a=0;for(r=0;r<i.length;++r)i[r]+=a,a=i[r]>>8,i[r]&=255;for(;a;)i.push(255&a),a>>=8}for(t=0;"1"===e[t]&&t<e.length-1;t++)i.push(0);return i.reverse()}e.exports={encode:s,decode:a}},function(e,t,r){"use strict";(function(t){var n=r(99),i=r(85),o=r(58),s=r(40),a=r(248),u=r(67),c=r(61),f=r(98),l=r(20),h=r(15),p=r(60),d=r(0),y=r(24),g=r(30),m=function e(t){return this instanceof e?(this.chunks=[],y.isBuffer(t)?e.fromBuffer(t):t instanceof n?e.fromAddress(t):t instanceof e?e.fromBuffer(t.toBuffer()):"string"==typeof t?e.fromString(t):void(void 0!==t&&this.set(t))):new e(t)};m.prototype.set=function(e){return this.chunks=e.chunks||this.chunks,this},m.fromBuffer=function(e){var t=new m;t.chunks=[];for(var r=new i(e);!r.finished();)try{var n=r.readUInt8(),o,s;n>0&&n<a.OP_PUSHDATA1?(o=n,t.chunks.push({buf:r.read(o),len:o,opcodenum:n})):n===a.OP_PUSHDATA1?(o=r.readUInt8(),s=r.read(o),t.chunks.push({buf:s,len:o,opcodenum:n})):n===a.OP_PUSHDATA2?(o=r.readUInt16LE(),s=r.read(o),t.chunks.push({buf:s,len:o,opcodenum:n})):n===a.OP_PUSHDATA4?(o=r.readUInt32LE(),s=r.read(o),t.chunks.push({buf:s,len:o,opcodenum:n})):t.chunks.push({opcodenum:n})}catch(t){if(t instanceof RangeError)throw new p.Script.InvalidBuffer(e.toString("hex"));throw t}return t},m.prototype.toBuffer=function(){for(var e=new o,t=0;t<this.chunks.length;t++){var r=this.chunks[t],n=r.opcodenum;e.writeUInt8(r.opcodenum),r.buf&&(n<a.OP_PUSHDATA1?e.write(r.buf):n===a.OP_PUSHDATA1?(e.writeUInt8(r.len),e.write(r.buf)):n===a.OP_PUSHDATA2?(e.writeUInt16LE(r.len),e.write(r.buf)):n===a.OP_PUSHDATA4&&(e.writeUInt32LE(r.len),e.write(r.buf)))}return e.concat()},m.fromASM=function(e){var r=new m;r.chunks=[];for(var n=e.split(" "),i=0;i<n.length;){var o=n[i],s=a(o),u=s.toNumber();if(h.isUndefined(u)){var c=new t(n[i],"hex");r.chunks.push({buf:c,len:c.length,opcodenum:c.length}),i+=1}else u===a.OP_PUSHDATA1||u===a.OP_PUSHDATA2||u===a.OP_PUSHDATA4?(r.chunks.push({buf:new t(n[i+2],"hex"),len:parseInt(n[i+1]),opcodenum:u}),i+=3):(r.chunks.push({opcodenum:u}),i+=1)}return r},m.fromHex=function(e){return new m(new d.Buffer(e,"hex"))},m.fromString=function(e){if(g.isHexa(e)||0===e.length)return new m(new d.Buffer(e,"hex"));var r=new m;r.chunks=[];for(var n=e.split(" "),i=0;i<n.length;){var o=n[i],s=a(o),u=s.toNumber();if(h.isUndefined(u)){if(u=parseInt(o),!(u>0&&u<a.OP_PUSHDATA1))throw new Error("Invalid script: "+JSON.stringify(e));r.chunks.push({buf:new t(n[i+1].slice(2),"hex"),len:u,opcodenum:u}),i+=2}else if(u===a.OP_PUSHDATA1||u===a.OP_PUSHDATA2||u===a.OP_PUSHDATA4){if("0x"!==n[i+2].slice(0,2))throw new Error("Pushdata data must start with 0x");r.chunks.push({buf:new t(n[i+2].slice(2),"hex"),len:parseInt(n[i+1]),opcodenum:u}),i+=3}else r.chunks.push({opcodenum:u}),i+=1}return r},m.prototype._chunkToString=function(e,t){var r=e.opcodenum,n="asm"===t,i="";if(e.buf)r!==a.OP_PUSHDATA1&&r!==a.OP_PUSHDATA2&&r!==a.OP_PUSHDATA4||(i=i+" "+a(r).toString()),e.len>0&&(i=n?i+" "+e.buf.toString("hex"):i+" "+e.len+" 0x"+e.buf.toString("hex"));else if(void 0!==a.reverseMap[r])i=i+" "+a(r).toString();else{var o=r.toString(16);o.length%2!=0&&(o="0"+o),i=n?i+" "+o:i+" 0x"+o}return i},m.prototype.toASM=function(){for(var e="",t=0;t<this.chunks.length;t++){var r=this.chunks[t];e+=this._chunkToString(r,"asm")}return e.substr(1)},m.prototype.toString=function(){for(var e="",t=0;t<this.chunks.length;t++){var r=this.chunks[t];e+=this._chunkToString(r)}return e.substr(1)},m.prototype.toHex=function(){return this.toBuffer().toString("hex")},m.prototype.inspect=function(){return"<Script: "+this.toString()+">"},m.prototype.isPublicKeyHashOut=function(){return!(5!==this.chunks.length||this.chunks[0].opcodenum!==a.OP_DUP||this.chunks[1].opcodenum!==a.OP_HASH160||!this.chunks[2].buf||20!==this.chunks[2].buf.length||this.chunks[3].opcodenum!==a.OP_EQUALVERIFY||this.chunks[4].opcodenum!==a.OP_CHECKSIG)},m.prototype.isPublicKeyHashIn=function(){if(2===this.chunks.length){var e=this.chunks[0].buf,t=this.chunks[1].buf;if(e&&e.length&&48===e[0]&&t&&t.length){var r=t[0];if((4===r||6===r||7===r)&&65===t.length)return!0;if((3===r||2===r)&&33===t.length)return!0}}return!1},m.prototype.getPublicKey=function(){return l.checkState(this.isPublicKeyOut(),"Can't retreive PublicKey from a non-PK output"),this.chunks[0].buf},m.prototype.getPublicKeyHash=function(){return l.checkState(this.isPublicKeyHashOut(),"Can't retrieve PublicKeyHash from a non-PKH output"),this.chunks[2].buf},m.prototype.isPublicKeyOut=function(){if(2===this.chunks.length&&this.chunks[0].buf&&this.chunks[0].buf.length&&this.chunks[1].opcodenum===a.OP_CHECKSIG){var e=this.chunks[0].buf,t=e[0],r=!1;if((4!==t&&6!==t&&7!==t||65!==e.length)&&(3!==t&&2!==t||33!==e.length)||(r=!0),r)return u.isValid(e)}return!1},m.prototype.isPublicKeyIn=function(){if(1===this.chunks.length){var e=this.chunks[0].buf;if(e&&e.length&&48===e[0])return!0}return!1},m.prototype.isScriptHashOut=function(){var e=this.toBuffer();return 23===e.length&&e[0]===a.OP_HASH160&&20===e[1]&&e[e.length-1]===a.OP_EQUAL},m.prototype.isScriptHashIn=function(){if(this.chunks.length<=1)return!1;var e=this.chunks[this.chunks.length-1],t=e.buf,r;if(!t)return!1;try{r=m.fromBuffer(t)}catch(e){if(e instanceof p.Script.InvalidBuffer)return!1;throw e}var n=r.classify();return n!==m.types.UNKNOWN},m.prototype.isMultisigOut=function(){return this.chunks.length>3&&a.isSmallIntOp(this.chunks[0].opcodenum)&&this.chunks.slice(1,this.chunks.length-2).every(function(e){return e.buf&&y.isBuffer(e.buf)})&&a.isSmallIntOp(this.chunks[this.chunks.length-2].opcodenum)&&this.chunks[this.chunks.length-1].opcodenum===a.OP_CHECKMULTISIG},m.prototype.isMultisigIn=function(){return this.chunks.length>=2&&0===this.chunks[0].opcodenum&&this.chunks.slice(1,this.chunks.length).every(function(e){return e.buf&&y.isBuffer(e.buf)&&c.isTxDER(e.buf)})},m.prototype.isDataOut=function(){return this.chunks.length>=1&&this.chunks[0].opcodenum===a.OP_RETURN&&(1===this.chunks.length||2===this.chunks.length&&this.chunks[1].buf&&this.chunks[1].buf.length<=m.OP_RETURN_STANDARD_SIZE&&this.chunks[1].length===this.chunks.len)},m.prototype.getData=function(){if(this.isDataOut()||this.isScriptHashOut())return h.isUndefined(this.chunks[1])?new t(0):new t(this.chunks[1].buf);if(this.isPublicKeyHashOut())return new t(this.chunks[2].buf);throw new Error("Unrecognized script type to get data from")},m.prototype.isPushOnly=function(){return h.every(this.chunks,function(e){return e.opcodenum<=a.OP_16})},m.types={},m.types.UNKNOWN="Unknown",m.types.PUBKEY_OUT="Pay to public key",m.types.PUBKEY_IN="Spend from public key",m.types.PUBKEYHASH_OUT="Pay to public key hash",m.types.PUBKEYHASH_IN="Spend from public key hash",m.types.SCRIPTHASH_OUT="Pay to script hash",m.types.SCRIPTHASH_IN="Spend from script hash",m.types.MULTISIG_OUT="Pay to multisig",m.types.MULTISIG_IN="Spend from multisig",m.types.DATA_OUT="Data push",m.OP_RETURN_STANDARD_SIZE=80,m.prototype.classify=function(){if(this._isInput)return this.classifyInput();if(this._isOutput)return this.classifyOutput();var e=this.classifyOutput();return e!=m.types.UNKNOWN?e:this.classifyInput()},m.outputIdentifiers={},m.outputIdentifiers.PUBKEY_OUT=m.prototype.isPublicKeyOut,m.outputIdentifiers.PUBKEYHASH_OUT=m.prototype.isPublicKeyHashOut,m.outputIdentifiers.MULTISIG_OUT=m.prototype.isMultisigOut,m.outputIdentifiers.SCRIPTHASH_OUT=m.prototype.isScriptHashOut,m.outputIdentifiers.DATA_OUT=m.prototype.isDataOut,m.prototype.classifyOutput=function(){for(var e in m.outputIdentifiers)if(m.outputIdentifiers[e].bind(this)())return m.types[e];return m.types.UNKNOWN},m.inputIdentifiers={},m.inputIdentifiers.PUBKEY_IN=m.prototype.isPublicKeyIn,m.inputIdentifiers.PUBKEYHASH_IN=m.prototype.isPublicKeyHashIn,m.inputIdentifiers.MULTISIG_IN=m.prototype.isMultisigIn,m.inputIdentifiers.SCRIPTHASH_IN=m.prototype.isScriptHashIn,m.prototype.classifyInput=function(){for(var e in m.inputIdentifiers)if(m.inputIdentifiers[e].bind(this)())return m.types[e];return m.types.UNKNOWN},m.prototype.isStandard=function(){return this.classify()!==m.types.UNKNOWN},m.prototype.prepend=function(e){return this._addByType(e,!0),this},m.prototype.equals=function(e){if(l.checkState(e instanceof m,"Must provide another script"),this.chunks.length!==e.chunks.length)return!1;var t;for(t=0;t<this.chunks.length;t++){if(y.isBuffer(this.chunks[t].buf)&&!y.isBuffer(e.chunks[t].buf))return!1;if(y.isBuffer(this.chunks[t].buf)&&!y.equals(this.chunks[t].buf,e.chunks[t].buf))return!1;if(this.chunks[t].opcodenum!==e.chunks[t].opcodenum)return!1}return!0},m.prototype.add=function(e){return this._addByType(e,!1),this},m.prototype._addByType=function(e,t){if("string"==typeof e)this._addOpcode(e,t);else if("number"==typeof e)this._addOpcode(e,t);else if(e instanceof a)this._addOpcode(e,t);else if(y.isBuffer(e))this._addBuffer(e,t);else if(e instanceof m)this.chunks=this.chunks.concat(e.chunks);else{if("object"!=typeof e)throw new Error("Invalid script chunk");this._insertAtPosition(e,t)}},m.prototype._insertAtPosition=function(e,t){t?this.chunks.unshift(e):this.chunks.push(e)},m.prototype._addOpcode=function(e,t){var r;return r="number"==typeof e?e:e instanceof a?e.toNumber():a(e).toNumber(),this._insertAtPosition({opcodenum:r},t),this},m.prototype._addBuffer=function(e,t){var r,n=e.length;if(n>=0&&n<a.OP_PUSHDATA1)r=n;else if(n<Math.pow(2,8))r=a.OP_PUSHDATA1;else if(n<Math.pow(2,16))r=a.OP_PUSHDATA2;else{if(!(n<Math.pow(2,32)))throw new Error("You can't push that much data");r=a.OP_PUSHDATA4}return this._insertAtPosition({buf:e,len:n,opcodenum:r},t),this},m.prototype.removeCodeseparators=function(){for(var e=[],t=0;t<this.chunks.length;t++)this.chunks[t].opcodenum!==a.OP_CODESEPARATOR&&e.push(this.chunks[t]);return this.chunks=e,this},m.buildMultisigOut=function(e,t,r){l.checkArgument(t<=e.length,"Number of required signatures must be less than or equal to the number of public keys"),r=r||{};var n=new m;n.add(a.smallInt(t)),e=h.map(e,u);var i=e;r.noSorting||(i=h.sortBy(e,function(e){return e.toString("hex")}));for(var o=0;o<i.length;o++){var s=i[o];n.add(s.toBuffer())}return n.add(a.smallInt(e.length)),n.add(a.OP_CHECKMULTISIG),n},m.buildMultisigIn=function(e,t,r,n){l.checkArgument(h.isArray(e)),l.checkArgument(h.isNumber(t)),l.checkArgument(h.isArray(r)),n=n||{};var i=new m;return i.add(a.OP_0),h.each(r,function(e){l.checkArgument(y.isBuffer(e),"Signatures must be an array of Buffers"),i.add(e)}),i},m.buildP2SHMultisigIn=function(e,t,r,n){l.checkArgument(h.isArray(e)),l.checkArgument(h.isNumber(t)),l.checkArgument(h.isArray(r)),n=n||{};var i=new m;return i.add(a.OP_0),h.each(r,function(e){l.checkArgument(y.isBuffer(e),"Signatures must be an array of Buffers"),i.add(e)}),i.add((n.cachedMultisig||m.buildMultisigOut(e,t,n)).toBuffer()),i},m.buildPublicKeyHashOut=function(e){l.checkArgument(!h.isUndefined(e)),l.checkArgument(e instanceof u||e instanceof n||h.isString(e)),e instanceof u?e=e.toAddress():h.isString(e)&&(e=new n(e));var t=new m;return t.add(a.OP_DUP).add(a.OP_HASH160).add(e.hashBuffer).add(a.OP_EQUALVERIFY).add(a.OP_CHECKSIG),t._network=e.network,t},m.buildPublicKeyOut=function(e){l.checkArgument(e instanceof u);var t=new m;return t.add(e.toBuffer()).add(a.OP_CHECKSIG),t},m.buildDataOut=function(e,r){l.checkArgument(h.isUndefined(e)||h.isString(e)||y.isBuffer(e)),h.isString(e)&&(e=new t(e,r));var n=new m;return n.add(a.OP_RETURN),h.isUndefined(e)||n.add(e),n},m.buildScriptHashOut=function(e){l.checkArgument(e instanceof m||e instanceof n&&e.isPayToScriptHash());var t=new m;return t.add(a.OP_HASH160).add(e instanceof n?e.hashBuffer:s.sha256ripemd160(e.toBuffer())).add(a.OP_EQUAL),t._network=e._network||e.network,t},m.buildPublicKeyIn=function(e,t){l.checkArgument(e instanceof c||y.isBuffer(e)),l.checkArgument(h.isUndefined(t)||h.isNumber(t)),e instanceof c&&(e=e.toBuffer());var r=new m;return r.add(y.concat([e,y.integerAsSingleByteBuffer(t||c.SIGHASH_ALL)])),r},m.buildPublicKeyHashIn=function(e,t,r){l.checkArgument(t instanceof c||y.isBuffer(t)),l.checkArgument(h.isUndefined(r)||h.isNumber(r)),t instanceof c&&(t=t.toBuffer());var n=(new m).add(y.concat([t,y.integerAsSingleByteBuffer(r||c.SIGHASH_ALL)])).add(new u(e).toBuffer());return n},m.empty=function(){return new m},m.prototype.toScriptHashOut=function(){return m.buildScriptHashOut(this)},m.fromAddress=function(e){if(e=n(e),e.isPayToScriptHash())return m.buildScriptHashOut(e);if(e.isPayToPublicKeyHash())return m.buildPublicKeyHashOut(e);throw new p.Script.UnrecognizedAddress(e)},m.prototype.getAddressInfo=function(e){if(this._isInput)return this._getInputAddressInfo();if(this._isOutput)return this._getOutputAddressInfo();var t=this._getOutputAddressInfo();return t||this._getInputAddressInfo()},m.prototype._getOutputAddressInfo=function(){var e={};if(this.isScriptHashOut())e.hashBuffer=this.getData(),e.type=n.PayToScriptHash;else{if(!this.isPublicKeyHashOut())return!1;e.hashBuffer=this.getData(),e.type=n.PayToPublicKeyHash}return e},m.prototype._getInputAddressInfo=function(){var e={};if(this.isPublicKeyHashIn())e.hashBuffer=s.sha256ripemd160(this.chunks[1].buf),e.type=n.PayToPublicKeyHash;else{if(!this.isScriptHashIn())return!1;e.hashBuffer=s.sha256ripemd160(this.chunks[this.chunks.length-1].buf),e.type=n.PayToScriptHash}return e},m.prototype.toAddress=function(e){var t=this.getAddressInfo();return!!t&&(t.network=f.get(e)||this._network||f.defaultNetwork,new n(t))},m.prototype.findAndDelete=function(e){for(var t=e.toBuffer(),r=t.toString("hex"),n=0;n<this.chunks.length;n++){var i=m({chunks:[this.chunks[n]]}),o=i.toBuffer(),s=o.toString("hex");r===s&&this.chunks.splice(n,1)}return this},m.prototype.checkMinimalPush=function(e){var t=this.chunks[e],r=t.buf,n=t.opcodenum;return!r||(0===r.length?n===a.OP_0:1===r.length&&r[0]>=1&&r[0]<=16?n===a.OP_1+(r[0]-1):1===r.length&&129===r[0]?n===a.OP_1NEGATE:r.length<=75?n===r.length:r.length<=255?n===a.OP_PUSHDATA1:!(r.length<=65535)||n===a.OP_PUSHDATA2)},m.prototype._decodeOP_N=function(e){if(e===a.OP_0)return 0;if(e>=a.OP_1&&e<=a.OP_16)return e-(a.OP_1-1);throw new Error("Invalid opcode: "+JSON.stringify(e))},m.prototype.getSignatureOperationsCount=function(e){e=!!h.isUndefined(e)||e;var t=this,r=0,n=a.OP_INVALIDOPCODE;return h.each(t.chunks,function i(o){var s=o.opcodenum;s==a.OP_CHECKSIG||s==a.OP_CHECKSIGVERIFY?r++:s!=a.OP_CHECKMULTISIG&&s!=a.OP_CHECKMULTISIGVERIFY||(e&&n>=a.OP_1&&n<=a.OP_16?r+=t._decodeOP_N(n):r+=20),n=s}),r},e.exports=m}).call(this,r(0).Buffer)},function(e,t,r){"use strict";var n=r(15),i=r(20),o=r(30),s=r(62),a=r(99),u=r(251);function c(e){if(!(this instanceof c))return new c(e);i.checkArgument(n.isObject(e),"Must provide an object from where to extract data");var t=e.address?new a(e.address):void 0,r=e.txid?e.txid:e.txId;if(!r||!o.isHexaString(r)||r.length>64)throw new Error("Invalid TXID in object",e);var f=n.isUndefined(e.vout)?e.outputIndex:e.vout;if(!n.isNumber(f))throw new Error("Invalid outputIndex, received "+f);i.checkArgument(!n.isUndefined(e.scriptPubKey)||!n.isUndefined(e.script),"Must provide the scriptPubKey for that output!");var l=new s(e.scriptPubKey||e.script);i.checkArgument(!n.isUndefined(e.amount)||!n.isUndefined(e.satoshis),"Must provide an amount for the output");var h=n.isUndefined(e.amount)?e.satoshis:new u.fromBTC(e.amount).toSatoshis();i.checkArgument(n.isNumber(h),"Amount must be a number"),o.defineImmutable(this,{address:t,txId:r,outputIndex:f,script:l,satoshis:h})}c.prototype.inspect=function(){return"<UnspentOutput: "+this.txId+":"+this.outputIndex+", satoshis: "+this.satoshis+", address: "+this.address+">"},c.prototype.toString=function(){return this.txId+":"+this.outputIndex},c.fromObject=function(e){return new c(e)},c.prototype.toObject=c.prototype.toJSON=function e(){return{address:this.address?this.address.toString():void 0,txid:this.txId,vout:this.outputIndex,scriptPubKey:this.script.toBuffer().toString("hex"),amount:u.fromSatoshis(this.satoshis).toBTC()}},e.exports=c},function(e,t,r){"use strict";(function(t){var n=r(15),i=r(180),o=r(24),s=r(85),a=r(58),u=r(40),c=r(30),f=r(178),l=r(20);function h(e){if(!(this instanceof h))return new h(e);var t={};if(o.isBuffer(e))t=h._fromBufferReader(s(e));else{if(!n.isObject(e))throw new TypeError("Unrecognized argument for MerkleBlock");var r;r=e.header instanceof i?e.header:i.fromObject(e.header),t={header:r,numTransactions:e.numTransactions,hashes:e.hashes,flags:e.flags}}return n.extend(this,t),this._flagBitsUsed=0,this._hashesUsed=0,this}h.fromBuffer=function e(t){return h.fromBufferReader(s(t))},h.fromBufferReader=function e(t){return new h(h._fromBufferReader(t))},h.prototype.toBuffer=function e(){return this.toBufferWriter().concat()},h.prototype.toBufferWriter=function e(r){r||(r=new a),r.write(this.header.toBuffer()),r.writeUInt32LE(this.numTransactions),r.writeVarintNum(this.hashes.length);for(var n=0;n<this.hashes.length;n++)r.write(new t(this.hashes[n],"hex"));for(r.writeVarintNum(this.flags.length),n=0;n<this.flags.length;n++)r.writeUInt8(this.flags[n]);return r},h.prototype.toObject=h.prototype.toJSON=function e(){return{header:this.header.toObject(),numTransactions:this.numTransactions,hashes:this.hashes,flags:this.flags}},h.prototype.validMerkleTree=function e(){if(l.checkState(n.isArray(this.flags),"MerkleBlock flags is not an array"),l.checkState(n.isArray(this.hashes),"MerkleBlock hashes is not an array"),this.hashes.length>this.numTransactions)return!1;if(8*this.flags.length<this.hashes.length)return!1;var t=this._calcTreeHeight(),r={hashesUsed:0,flagBitsUsed:0},i=this._traverseMerkleTree(t,0,r);return r.hashesUsed===this.hashes.length&&o.equals(i,this.header.merkleRoot)},h.prototype._traverseMerkleTree=function e(r,n,i){if(i=i||{},i.txs=i.txs||[],i.flagBitsUsed=i.flagBitsUsed||0,i.hashesUsed=i.hashesUsed||0,i.flagBitsUsed>8*this.flags.length)return null;var o=this.flags[i.flagBitsUsed>>3]>>>(7&i.flagBitsUsed++)&1;if(0!==r&&o){var s=this._traverseMerkleTree(r-1,2*n,i),a=s;return 2*n+1<this._calcTreeWidth(r-1)&&(a=this._traverseMerkleTree(r-1,2*n+1,i)),u.sha256sha256(new t.concat([s,a]))}if(i.hashesUsed>=this.hashes.length)return null;var c=this.hashes[i.hashesUsed++];return 0===r&&o&&i.txs.push(c),new t(c,"hex")},h.prototype._calcTreeWidth=function e(t){return this.numTransactions+(1<<t)-1>>t},h.prototype._calcTreeHeight=function e(){for(var t=0;this._calcTreeWidth(t)>1;)t++;return t},h.prototype.hasTransaction=function e(r){l.checkArgument(!n.isUndefined(r),"tx cannot be undefined"),l.checkArgument(r instanceof f||"string"==typeof r,'Invalid tx given, tx must be a "string" or "Transaction"');var i=r;r instanceof f&&(i=o.reverse(new t(r.id,"hex")).toString("hex"));var s=[],a=this._calcTreeHeight();return this._traverseMerkleTree(a,0,{txs:s}),-1!==s.indexOf(i)},h._fromBufferReader=function e(t){l.checkState(!t.finished(),"No merkleblock data received");var r={};r.header=i.fromBufferReader(t),r.numTransactions=t.readUInt32LE();var n=t.readVarintNum();r.hashes=[];for(var o=0;o<n;o++)r.hashes.push(t.read(32).toString("hex"));var s=t.readVarintNum();for(r.flags=[],o=0;o<s;o++)r.flags.push(t.readUInt8());return r},h.fromObject=function e(t){return new h(t)},e.exports=h}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(t){var n=r(13),i=r(0),o=r(15),s=r(20),a=r(34),u=r(177),c=r(133),f=r(40),l=r(98),h=r(252),p=r(111),d=r(176),y=r(179),g=r(60),m=g.HDPrivateKey,b=r(24),v=r(30),_=128,w=1/8,S=512;function k(e){if(e instanceof k)return e;if(!(this instanceof k))return new k(e);if(!e)return this._generateRandomly();if(l.get(e))return this._generateRandomly(e);if(o.isString(e)||b.isBuffer(e))if(k.isValidSerialized(e))this._buildFromSerialized(e);else if(v.isValidJSON(e))this._buildFromJSON(e);else{if(!b.isBuffer(e)||!k.isValidSerialized(e.toString()))throw k.getSerializedError(e);this._buildFromSerialized(e.toString())}else{if(!o.isObject(e))throw new m.UnrecognizedArgument(e);this._buildFromObject(e)}}k.isValidPath=function(e,t){if(o.isString(e)){var r=k._getDerivationIndexes(e);return null!==r&&o.all(r,k.isValidPath)}return!!o.isNumber(e)&&(e<k.Hardened&&!0===t&&(e+=k.Hardened),e>=0&&e<k.MaxIndex)},k._getDerivationIndexes=function(e){var t=e.split("/");if(o.contains(k.RootElementAlias,e))return[];if(!o.contains(k.RootElementAlias,t[0]))return null;var r=t.slice(1).map(function(e){var t="'"===e.slice(-1);if(t&&(e=e.slice(0,-1)),!e||"-"===e[0])return NaN;var r=+e;return t&&(r+=k.Hardened),r});return o.any(r,isNaN)?null:r},k.prototype.derive=function(e,t){if(o.isNumber(e))return this._deriveWithNumber(e,t);if(o.isString(e))return this._deriveFromString(e);throw new m.InvalidDerivationArgument(e)},k.prototype._deriveWithNumber=function(e,t){if(!k.isValidPath(e,t))throw new m.InvalidPath(e);t=e>=k.Hardened||t,e<k.Hardened&&!0===t&&(e+=k.Hardened);var r=h.get(this.xprivkey,e,t);if(r)return r;var n=b.integerAsBuffer(e),o;o=t?b.concat([new i.Buffer([0]),this.privateKey.toBuffer(),n]):b.concat([this.publicKey.toBuffer(),n]);var s=f.sha512hmac(o,this._buffers.chainCode),u=a.fromBuffer(s.slice(0,32),{size:32}),c=s.slice(32,64),l=u.add(this.privateKey.toBigNumber()).mod(p.getN()).toBuffer({size:32}),d=new k({network:this.network,depth:this.depth+1,parentFingerPrint:this.fingerPrint,childIndex:e,chainCode:c,privateKey:l});return h.set(this.xprivkey,e,t,d),d},k.prototype._deriveFromString=function(e){if(!k.isValidPath(e))throw new m.InvalidPath(e);var t=k._getDerivationIndexes(e),r=t.reduce(function(e,t){return e._deriveWithNumber(t)},this);return r},k.isValidSerialized=function(e,t){return!k.getSerializedError(e,t)},k.getSerializedError=function(e,t){if(!o.isString(e)&&!b.isBuffer(e))return new m.UnrecognizedArgument("Expected string or buffer");if(!u.validCharacters(e))return new g.InvalidB58Char("(unknown)",e);try{e=c.decode(e)}catch(t){return new g.InvalidB58Checksum(e)}if(e.length!==k.DataLength)return new m.InvalidLength(e);if(!o.isUndefined(t)){var r=k._validateNetwork(e,t);if(r)return r}return null},k._validateNetwork=function(e,t){var r=l.get(t);if(!r)return new g.InvalidNetworkArgument(t);var n=e.slice(0,4);return b.integerFromBuffer(n)!==r.xprivkey?new g.InvalidNetwork(n):null},k.fromString=function(e){return s.checkArgument(o.isString(e),"No valid string was provided"),new k(e)},k.fromObject=function(e){return s.checkArgument(o.isObject(e),"No valid argument was provided"),new k(e)},k.prototype._buildFromJSON=function(e){return this._buildFromObject(JSON.parse(e))},k.prototype._buildFromObject=function(e){var t={version:e.network?b.integerAsBuffer(l.get(e.network).xprivkey):e.version,depth:o.isNumber(e.depth)?b.integerAsSingleByteBuffer(e.depth):e.depth,parentFingerPrint:o.isNumber(e.parentFingerPrint)?b.integerAsBuffer(e.parentFingerPrint):e.parentFingerPrint,childIndex:o.isNumber(e.childIndex)?b.integerAsBuffer(e.childIndex):e.childIndex,chainCode:o.isString(e.chainCode)?b.hexToBuffer(e.chainCode):e.chainCode,privateKey:o.isString(e.privateKey)&&v.isHexa(e.privateKey)?b.hexToBuffer(e.privateKey):e.privateKey,checksum:e.checksum?e.checksum.length?e.checksum:b.integerAsBuffer(e.checksum):void 0};return this._buildFromBuffers(t)},k.prototype._buildFromSerialized=function(e){var t=c.decode(e),r={version:t.slice(k.VersionStart,k.VersionEnd),depth:t.slice(k.DepthStart,k.DepthEnd),parentFingerPrint:t.slice(k.ParentFingerPrintStart,k.ParentFingerPrintEnd),childIndex:t.slice(k.ChildIndexStart,k.ChildIndexEnd),chainCode:t.slice(k.ChainCodeStart,k.ChainCodeEnd),privateKey:t.slice(k.PrivateKeyStart,k.PrivateKeyEnd),checksum:t.slice(k.ChecksumStart,k.ChecksumEnd),xprivkey:e};return this._buildFromBuffers(r)},k.prototype._generateRandomly=function(e){return k.fromSeed(y.getRandomBuffer(64),e)},k.fromSeed=function(e,r){if(v.isHexaString(e)&&(e=b.hexToBuffer(e)),!t.isBuffer(e))throw new m.InvalidEntropyArgument(e);if(e.length<16)throw new m.InvalidEntropyArgument.NotEnoughEntropy(e);if(e.length>64)throw new m.InvalidEntropyArgument.TooMuchEntropy(e);var n=f.sha512hmac(e,new i.Buffer("Bitcoin seed"));return new k({network:l.get(r)||l.defaultNetwork,depth:0,parentFingerPrint:0,childIndex:0,privateKey:n.slice(0,32),chainCode:n.slice(32,64)})},k.prototype._calcHDPublicKey=function(){if(!this._hdPublicKey){var e=r(429);this._hdPublicKey=new e(this)}},k.prototype._buildFromBuffers=function(e){k._validateBufferArguments(e),v.defineImmutable(this,{_buffers:e});var r=[e.version,e.depth,e.parentFingerPrint,e.childIndex,e.chainCode,b.emptyBuffer(1),e.privateKey],n=i.Buffer.concat(r);if(e.checksum&&e.checksum.length){if(e.checksum.toString()!==c.checksum(n).toString())throw new g.InvalidB58Checksum(n)}else e.checksum=c.checksum(n);var o=l.get(b.integerFromBuffer(e.version)),s;s=c.encode(i.Buffer.concat(r)),e.xprivkey=new t(s);var u=new d(a.fromBuffer(e.privateKey),o),h=u.toPublicKey(),p=k.ParentFingerPrintSize,y=f.sha256ripemd160(h.toBuffer()).slice(0,p);return v.defineImmutable(this,{xprivkey:s,network:o,depth:b.integerFromSingleByteBuffer(e.depth),privateKey:u,publicKey:h,fingerPrint:y}),this._hdPublicKey=null,Object.defineProperty(this,"hdPublicKey",{configurable:!1,enumerable:!0,get:function(){return this._calcHDPublicKey(),this._hdPublicKey}}),Object.defineProperty(this,"xpubkey",{configurable:!1,enumerable:!0,get:function(){return this._calcHDPublicKey(),this._hdPublicKey.xpubkey}}),this},k._validateBufferArguments=function(e){var t=function(t,r){var i=e[t];n(b.isBuffer(i),t+" argument is not a buffer"),n(i.length===r,t+" has not the expected size: found "+i.length+", expected "+r)};t("version",k.VersionSize),t("depth",k.DepthSize),t("parentFingerPrint",k.ParentFingerPrintSize),t("childIndex",k.ChildIndexSize),t("chainCode",k.ChainCodeSize),t("privateKey",k.PrivateKeySize),e.checksum&&e.checksum.length&&t("checksum",k.CheckSumSize)},k.prototype.toString=function(){return this.xprivkey},k.prototype.inspect=function(){return"<HDPrivateKey: "+this.xprivkey+">"},k.prototype.toObject=k.prototype.toJSON=function e(){return{network:l.get(b.integerFromBuffer(this._buffers.version),"xprivkey").name,depth:b.integerFromSingleByteBuffer(this._buffers.depth),fingerPrint:b.integerFromBuffer(this.fingerPrint),parentFingerPrint:b.integerFromBuffer(this._buffers.parentFingerPrint),childIndex:b.integerFromBuffer(this._buffers.childIndex),chainCode:b.bufferToHex(this._buffers.chainCode),privateKey:this.privateKey.toBuffer().toString("hex"),checksum:b.integerFromBuffer(this._buffers.checksum),xprivkey:this.xprivkey}},k.fromBuffer=function(e){return new k(e.toString())},k.prototype.toBuffer=function(){return b.copy(this._buffers.xprivkey)},k.DefaultDepth=0,k.DefaultFingerprint=0,k.DefaultChildIndex=0,k.Hardened=2147483648,k.MaxIndex=2*k.Hardened,k.RootElementAlias=["m","M","m'","M'"],k.VersionSize=4,k.DepthSize=1,k.ParentFingerPrintSize=4,k.ChildIndexSize=4,k.ChainCodeSize=32,k.PrivateKeySize=32,k.CheckSumSize=4,k.DataLength=78,k.SerializedByteSize=82,k.VersionStart=0,k.VersionEnd=k.VersionStart+k.VersionSize,k.DepthStart=k.VersionEnd,k.DepthEnd=k.DepthStart+k.DepthSize,k.ParentFingerPrintStart=k.DepthEnd,k.ParentFingerPrintEnd=k.ParentFingerPrintStart+k.ParentFingerPrintSize,k.ChildIndexStart=k.ParentFingerPrintEnd,k.ChildIndexEnd=k.ChildIndexStart+k.ChildIndexSize,k.ChainCodeStart=k.ChildIndexEnd,k.ChainCodeEnd=k.ChainCodeStart+k.ChainCodeSize,k.PrivateKeyStart=k.ChainCodeEnd+1,k.PrivateKeyEnd=k.PrivateKeyStart+k.PrivateKeySize,k.ChecksumStart=k.PrivateKeyEnd,k.ChecksumEnd=k.ChecksumStart+k.CheckSumSize,n(k.ChecksumEnd===k.SerializedByteSize),e.exports=k}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(t){var n=r(15),i=r(20),o=r(34),s=r(177),a=r(133),u=r(40),c=r(428),f=r(252),l=r(98),h=r(111),p=r(67),d=r(60),y=d,g=d.HDPublicKey,m=r(13),b=r(30),v=r(24);function _(e){if(e instanceof _)return e;if(!(this instanceof _))return new _(e);if(e){if(n.isString(e)||v.isBuffer(e)){var t=_.getSerializedError(e);if(t){if(v.isBuffer(e)&&!_.getSerializedError(e.toString()))return this._buildFromSerialized(e.toString());if(t instanceof g.ArgumentIsPrivateExtended)return new c(e).hdPublicKey;throw t}return this._buildFromSerialized(e)}if(n.isObject(e))return e instanceof c?this._buildFromPrivate(e):this._buildFromObject(e);throw new g.UnrecognizedArgument(e)}throw new g.MustSupplyArgument}_.isValidPath=function(e){if(n.isString(e)){var t=c._getDerivationIndexes(e);return null!==t&&n.all(t,_.isValidPath)}return!!n.isNumber(e)&&(e>=0&&e<_.Hardened)},_.prototype.derive=function(e,t){if(n.isNumber(e))return this._deriveWithNumber(e,t);if(n.isString(e))return this._deriveFromString(e);throw new g.InvalidDerivationArgument(e)},_.prototype._deriveWithNumber=function(e,t){if(e>=_.Hardened||t)throw new g.InvalidIndexCantDeriveHardened;if(e<0)throw new g.InvalidPath(e);var r=f.get(this.xpubkey,e,!1);if(r)return r;var n=v.integerAsBuffer(e),i=v.concat([this.publicKey.toBuffer(),n]),s=u.sha512hmac(i,this._buffers.chainCode),a=o.fromBuffer(s.slice(0,32),{size:32}),c=s.slice(32,64),l=p.fromPoint(h.getG().mul(a).add(this.publicKey.point)),d=new _({network:this.network,depth:this.depth+1,parentFingerPrint:this.fingerPrint,childIndex:e,chainCode:c,publicKey:l});return f.set(this.xpubkey,e,!1,d),d},_.prototype._deriveFromString=function(e){if(n.contains(e,"'"))throw new g.InvalidIndexCantDeriveHardened;if(!_.isValidPath(e))throw new g.InvalidPath(e);var t=c._getDerivationIndexes(e),r=t.reduce(function(e,t){return e._deriveWithNumber(t)},this);return r},_.isValidSerialized=function(e,t){return n.isNull(_.getSerializedError(e,t))},_.getSerializedError=function(e,t){if(!n.isString(e)&&!v.isBuffer(e))return new g.UnrecognizedArgument("expected buffer or string");if(!s.validCharacters(e))return new y.InvalidB58Char("(unknown)",e);try{e=a.decode(e)}catch(t){return new y.InvalidB58Checksum(e)}if(e.length!==_.DataSize)return new g.InvalidLength(e);if(!n.isUndefined(t)){var r=_._validateNetwork(e,t);if(r)return r}var i=v.integerFromBuffer(e.slice(0,4));return i===l.livenet.xprivkey||i===l.testnet.xprivkey?new g.ArgumentIsPrivateExtended:null},_._validateNetwork=function(e,t){var r=l.get(t);if(!r)return new y.InvalidNetworkArgument(t);var n=e.slice(_.VersionStart,_.VersionEnd);return v.integerFromBuffer(n)!==r.xpubkey?new y.InvalidNetwork(n):null},_.prototype._buildFromPrivate=function(e){var t=n.clone(e._buffers),r=h.getG().mul(o.fromBuffer(t.privateKey));return t.publicKey=h.pointToCompressed(r),t.version=v.integerAsBuffer(l.get(v.integerFromBuffer(t.version)).xpubkey),t.privateKey=void 0,t.checksum=void 0,t.xprivkey=void 0,this._buildFromBuffers(t)},_.prototype._buildFromObject=function(e){var t={version:e.network?v.integerAsBuffer(l.get(e.network).xpubkey):e.version,depth:n.isNumber(e.depth)?v.integerAsSingleByteBuffer(e.depth):e.depth,parentFingerPrint:n.isNumber(e.parentFingerPrint)?v.integerAsBuffer(e.parentFingerPrint):e.parentFingerPrint,childIndex:n.isNumber(e.childIndex)?v.integerAsBuffer(e.childIndex):e.childIndex,chainCode:n.isString(e.chainCode)?v.hexToBuffer(e.chainCode):e.chainCode,publicKey:n.isString(e.publicKey)?v.hexToBuffer(e.publicKey):v.isBuffer(e.publicKey)?e.publicKey:e.publicKey.toBuffer(),checksum:n.isNumber(e.checksum)?v.integerAsBuffer(e.checksum):e.checksum};return this._buildFromBuffers(t)},_.prototype._buildFromSerialized=function(e){var t=a.decode(e),r={version:t.slice(_.VersionStart,_.VersionEnd),depth:t.slice(_.DepthStart,_.DepthEnd),parentFingerPrint:t.slice(_.ParentFingerPrintStart,_.ParentFingerPrintEnd),childIndex:t.slice(_.ChildIndexStart,_.ChildIndexEnd),chainCode:t.slice(_.ChainCodeStart,_.ChainCodeEnd),publicKey:t.slice(_.PublicKeyStart,_.PublicKeyEnd),checksum:t.slice(_.ChecksumStart,_.ChecksumEnd),xpubkey:e};return this._buildFromBuffers(r)},_.prototype._buildFromBuffers=function(e){_._validateBufferArguments(e),b.defineImmutable(this,{_buffers:e});var r=[e.version,e.depth,e.parentFingerPrint,e.childIndex,e.chainCode,e.publicKey],n=v.concat(r),i=a.checksum(n);if(e.checksum&&e.checksum.length){if(e.checksum.toString("hex")!==i.toString("hex"))throw new y.InvalidB58Checksum(n,i)}else e.checksum=i;var o=l.get(v.integerFromBuffer(e.version)),s;s=a.encode(v.concat(r)),e.xpubkey=new t(s);var c=new p(e.publicKey,{network:o}),f=_.ParentFingerPrintSize,h=u.sha256ripemd160(c.toBuffer()).slice(0,f);return b.defineImmutable(this,{xpubkey:s,network:o,depth:v.integerFromSingleByteBuffer(e.depth),publicKey:c,fingerPrint:h}),this},_._validateBufferArguments=function(e){var t=function(t,r){var n=e[t];m(v.isBuffer(n),t+" argument is not a buffer, it's "+typeof n),m(n.length===r,t+" has not the expected size: found "+n.length+", expected "+r)};t("version",_.VersionSize),t("depth",_.DepthSize),t("parentFingerPrint",_.ParentFingerPrintSize),t("childIndex",_.ChildIndexSize),t("chainCode",_.ChainCodeSize),t("publicKey",_.PublicKeySize),e.checksum&&e.checksum.length&&t("checksum",_.CheckSumSize)},_.fromString=function(e){return i.checkArgument(n.isString(e),"No valid string was provided"),new _(e)},_.fromObject=function(e){return i.checkArgument(n.isObject(e),"No valid argument was provided"),new _(e)},_.prototype.toString=function(){return this.xpubkey},_.prototype.inspect=function(){return"<HDPublicKey: "+this.xpubkey+">"},_.prototype.toObject=_.prototype.toJSON=function e(){return{network:l.get(v.integerFromBuffer(this._buffers.version)).name,depth:v.integerFromSingleByteBuffer(this._buffers.depth),fingerPrint:v.integerFromBuffer(this.fingerPrint),parentFingerPrint:v.integerFromBuffer(this._buffers.parentFingerPrint),childIndex:v.integerFromBuffer(this._buffers.childIndex),chainCode:v.bufferToHex(this._buffers.chainCode),publicKey:this.publicKey.toString(),checksum:v.integerFromBuffer(this._buffers.checksum),xpubkey:this.xpubkey}},_.fromBuffer=function(e){return new _(e)},_.prototype.toBuffer=function(){return v.copy(this._buffers.xpubkey)},_.Hardened=2147483648,_.RootElementAlias=["m","M"],_.VersionSize=4,_.DepthSize=1,_.ParentFingerPrintSize=4,_.ChildIndexSize=4,_.ChainCodeSize=32,_.PublicKeySize=33,_.CheckSumSize=4,_.DataSize=78,_.SerializedByteSize=82,_.VersionStart=0,_.VersionEnd=_.VersionStart+_.VersionSize,_.DepthStart=_.VersionEnd,_.DepthEnd=_.DepthStart+_.DepthSize,_.ParentFingerPrintStart=_.DepthEnd,_.ParentFingerPrintEnd=_.ParentFingerPrintStart+_.ParentFingerPrintSize,_.ChildIndexStart=_.ParentFingerPrintEnd,_.ChildIndexEnd=_.ChildIndexStart+_.ChildIndexSize,_.ChainCodeStart=_.ChildIndexEnd,_.ChainCodeEnd=_.ChainCodeStart+_.ChainCodeSize,_.PublicKeyStart=_.ChainCodeEnd,_.PublicKeyEnd=_.PublicKeyStart+_.PublicKeySize,_.ChecksumStart=_.PublicKeyEnd,_.ChecksumEnd=_.ChecksumStart+_.CheckSumSize,m(_.PublicKeyEnd===_.DataSize),m(_.ChecksumEnd===_.SerializedByteSize),e.exports=_}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(e){const n=r(253),i=r(254)(),o=r(883),s={SHA1:"SHA-1",SHA256:"SHA-256",SHA512:"SHA-512"},a=(t,r,o)=>{n(i.subtle.sign({name:"HMAC"},t,r).then(t=>e.from(t)),o)};t.create=function(e,t,r){const u=s[e];n(i.subtle.importKey("raw",t,{name:"HMAC",hash:{name:u}},!1,["sign"]).then(t=>({digest(e,r){a(t,e,r)},length:o[e]})),r)}}).call(this,r(0).Buffer)},function(e,t,r){var n={ECB:r(887),CBC:r(888),CFB:r(889),CFB8:r(890),CFB1:r(891),OFB:r(892),CTR:r(432),GCM:r(432)},i=r(434);for(var o in i)i[o].module=n[i[o].mode];e.exports=i},function(e,t,r){var n=r(136),i=r(2).Buffer,o=r(433);function s(e){var t=e._cipher.encryptBlockRaw(e._prev);return o(e._prev),t}var a=16;t.encrypt=function(e,t){var r=Math.ceil(t.length/16),o=e._cache.length;e._cache=i.concat([e._cache,i.allocUnsafe(16*r)]);for(var a=0;a<r;a++){var u=s(e),c=o+16*a;e._cache.writeUInt32BE(u[0],c+0),e._cache.writeUInt32BE(u[1],c+4),e._cache.writeUInt32BE(u[2],c+8),e._cache.writeUInt32BE(u[3],c+12)}var f=e._cache.slice(0,t.length);return e._cache=e._cache.slice(t.length),n(t,f)}},function(e,t){function r(e){for(var t=e.length,r;t--;){if(r=e.readUInt8(t),255!==r){r++,e.writeUInt8(r,t);break}e.writeUInt8(0,t)}}e.exports=r},function(e){e.exports={"aes-128-ecb":{cipher:"AES",key:128,iv:0,mode:"ECB",type:"block"},"aes-192-ecb":{cipher:"AES",key:192,iv:0,mode:"ECB",type:"block"},"aes-256-ecb":{cipher:"AES",key:256,iv:0,mode:"ECB",type:"block"},"aes-128-cbc":{cipher:"AES",key:128,iv:16,mode:"CBC",type:"block"},"aes-192-cbc":{cipher:"AES",key:192,iv:16,mode:"CBC",type:"block"},"aes-256-cbc":{cipher:"AES",key:256,iv:16,mode:"CBC",type:"block"},aes128:{cipher:"AES",key:128,iv:16,mode:"CBC",type:"block"},aes192:{cipher:"AES",key:192,iv:16,mode:"CBC",type:"block"},aes256:{cipher:"AES",key:256,iv:16,mode:"CBC",type:"block"},"aes-128-cfb":{cipher:"AES",key:128,iv:16,mode:"CFB",type:"stream"},"aes-192-cfb":{cipher:"AES",key:192,iv:16,mode:"CFB",type:"stream"},"aes-256-cfb":{cipher:"AES",key:256,iv:16,mode:"CFB",type:"stream"},"aes-128-cfb8":{cipher:"AES",key:128,iv:16,mode:"CFB8",type:"stream"},"aes-192-cfb8":{cipher:"AES",key:192,iv:16,mode:"CFB8",type:"stream"},"aes-256-cfb8":{cipher:"AES",key:256,iv:16,mode:"CFB8",type:"stream"},"aes-128-cfb1":{cipher:"AES",key:128,iv:16,mode:"CFB1",type:"stream"},"aes-192-cfb1":{cipher:"AES",key:192,iv:16,mode:"CFB1",type:"stream"},"aes-256-cfb1":{cipher:"AES",key:256,iv:16,mode:"CFB1",type:"stream"},"aes-128-ofb":{cipher:"AES",key:128,iv:16,mode:"OFB",type:"stream"},"aes-192-ofb":{cipher:"AES",key:192,iv:16,mode:"OFB",type:"stream"},"aes-256-ofb":{cipher:"AES",key:256,iv:16,mode:"OFB",type:"stream"},"aes-128-ctr":{cipher:"AES",key:128,iv:16,mode:"CTR",type:"stream"},"aes-192-ctr":{cipher:"AES",key:192,iv:16,mode:"CTR",type:"stream"},"aes-256-ctr":{cipher:"AES",key:256,iv:16,mode:"CTR",type:"stream"},"aes-128-gcm":{cipher:"AES",key:128,iv:12,mode:"GCM",type:"auth"},"aes-192-gcm":{cipher:"AES",key:192,iv:12,mode:"GCM",type:"auth"},"aes-256-gcm":{cipher:"AES",key:256,iv:12,mode:"GCM",type:"auth"}}},function(e,t,r){var n=r(181),i=r(2).Buffer,o=r(94),s=r(4),a=r(893),u=r(136),c=r(433);function f(e,t){var r=0;e.length!==t.length&&r++;for(var n=Math.min(e.length,t.length),i=0;i<n;++i)r+=e[i]^t[i];return r}function l(e,t,r){if(12===t.length)return e._finID=i.concat([t,i.from([0,0,0,1])]),i.concat([t,i.from([0,0,0,2])]);var n=new a(r),o=t.length,s=o%16;n.update(t),s&&(s=16-s,n.update(i.alloc(s,0))),n.update(i.alloc(8,0));var u=8*o,f=i.alloc(8);f.writeUIntBE(u,0,8),n.update(f),e._finID=n.state;var l=i.from(e._finID);return c(l),l}function h(e,t,r,s){o.call(this);var u=i.alloc(4,0);this._cipher=new n.AES(t);var c=this._cipher.encryptBlock(u);this._ghash=new a(c),r=l(this,r,c),this._prev=i.from(r),this._cache=i.allocUnsafe(0),this._secCache=i.allocUnsafe(0),this._decrypt=s,this._alen=0,this._len=0,this._mode=e,this._authTag=null,this._called=!1}s(h,o),h.prototype._update=function(e){if(!this._called&&this._alen){var t=16-this._alen%16;t<16&&(t=i.alloc(t,0),this._ghash.update(t))}this._called=!0;var r=this._mode.encrypt(this,e);return this._decrypt?this._ghash.update(e):this._ghash.update(r),this._len+=e.length,r},h.prototype._final=function(){if(this._decrypt&&!this._authTag)throw new Error("Unsupported state or unable to authenticate data");var e=u(this._ghash.final(8*this._alen,8*this._len),this._cipher.encryptBlock(this._finID));if(this._decrypt&&f(e,this._authTag))throw new Error("Unsupported state or unable to authenticate data");this._authTag=e,this._cipher.scrub()},h.prototype.getAuthTag=function e(){if(this._decrypt||!i.isBuffer(this._authTag))throw new Error("Attempting to get auth tag in unsupported state");return this._authTag},h.prototype.setAuthTag=function e(t){if(!this._decrypt)throw new Error("Attempting to set auth tag in unsupported state");this._authTag=t},h.prototype.setAAD=function e(t){if(this._called)throw new Error("Attempting to set AAD in unsupported state");this._ghash.update(t),this._alen+=t.length},e.exports=h},function(e,t,r){var n=r(181),i=r(2).Buffer,o=r(94),s=r(4);function a(e,t,r,s){o.call(this),this._cipher=new n.AES(t),this._prev=i.from(r),this._cache=i.allocUnsafe(0),this._secCache=i.allocUnsafe(0),this._decrypt=s,this._mode=e}s(a,o),a.prototype._update=function(e){return this._mode.encrypt(this,e,this._decrypt)},a.prototype._final=function(){this._cipher.scrub()},e.exports=a},function(e,t,r){var n=r(2).Buffer,i=r(236);function o(e,t,r,o){if(n.isBuffer(e)||(e=n.from(e,"binary")),t&&(n.isBuffer(t)||(t=n.from(t,"binary")),8!==t.length))throw new RangeError("salt should be Buffer with 8 byte length");for(var s=r/8,a=n.alloc(s),u=n.alloc(o||0),c=n.alloc(0);s>0||o>0;){var f=new i;f.update(c),f.update(e),t&&f.update(t),c=f.digest();var l=0;if(s>0){var h=a.length-s;l=Math.min(s,c.length),c.copy(a,h,0,l),s-=l}if(l<c.length&&o>0){var p=u.length-o,d=Math.min(o,c.length-l);c.copy(u,p,l,l+d),o-=d}}return c.fill(0),{key:a,iv:u}}e.exports=o},function(e,t,r){var n=r(11);r(16),n.cipher=n.cipher||{};var i=e.exports=n.cipher.modes=n.cipher.modes||{};function o(e){if("string"==typeof e&&(e=n.util.createBuffer(e)),n.util.isArray(e)&&e.length>4){var t=e;e=n.util.createBuffer();for(var r=0;r<t.length;++r)e.putByte(t[r])}return n.util.isArray(e)||(e=[e.getInt32(),e.getInt32(),e.getInt32(),e.getInt32()]),e}function s(e){e[e.length-1]=e[e.length-1]+1&4294967295}function a(e){return[e/4294967296|0,4294967295&e]}i.ecb=function(e){e=e||{},this.name="ECB",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=new Array(this._ints),this._outBlock=new Array(this._ints)},i.ecb.prototype.start=function(e){},i.ecb.prototype.encrypt=function(e,t,r){if(e.length()<this.blockSize&&!(r&&e.length()>0))return!0;for(var n=0;n<this._ints;++n)this._inBlock[n]=e.getInt32();this.cipher.encrypt(this._inBlock,this._outBlock);for(var n=0;n<this._ints;++n)t.putInt32(this._outBlock[n])},i.ecb.prototype.decrypt=function(e,t,r){if(e.length()<this.blockSize&&!(r&&e.length()>0))return!0;for(var n=0;n<this._ints;++n)this._inBlock[n]=e.getInt32();this.cipher.decrypt(this._inBlock,this._outBlock);for(var n=0;n<this._ints;++n)t.putInt32(this._outBlock[n])},i.ecb.prototype.pad=function(e,t){var r=e.length()===this.blockSize?this.blockSize:this.blockSize-e.length();return e.fillWithByte(r,r),!0},i.ecb.prototype.unpad=function(e,t){if(t.overflow>0)return!1;var r=e.length(),n=e.at(r-1);return!(n>this.blockSize<<2)&&(e.truncate(n),!0)},i.cbc=function(e){e=e||{},this.name="CBC",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=new Array(this._ints),this._outBlock=new Array(this._ints)},i.cbc.prototype.start=function(e){if(null===e.iv){if(!this._prev)throw new Error("Invalid IV parameter.");this._iv=this._prev.slice(0)}else{if(!("iv"in e))throw new Error("Invalid IV parameter.");this._iv=o(e.iv),this._prev=this._iv.slice(0)}},i.cbc.prototype.encrypt=function(e,t,r){if(e.length()<this.blockSize&&!(r&&e.length()>0))return!0;for(var n=0;n<this._ints;++n)this._inBlock[n]=this._prev[n]^e.getInt32();this.cipher.encrypt(this._inBlock,this._outBlock);for(var n=0;n<this._ints;++n)t.putInt32(this._outBlock[n]);this._prev=this._outBlock},i.cbc.prototype.decrypt=function(e,t,r){if(e.length()<this.blockSize&&!(r&&e.length()>0))return!0;for(var n=0;n<this._ints;++n)this._inBlock[n]=e.getInt32();this.cipher.decrypt(this._inBlock,this._outBlock);for(var n=0;n<this._ints;++n)t.putInt32(this._prev[n]^this._outBlock[n]);this._prev=this._inBlock.slice(0)},i.cbc.prototype.pad=function(e,t){var r=e.length()===this.blockSize?this.blockSize:this.blockSize-e.length();return e.fillWithByte(r,r),!0},i.cbc.prototype.unpad=function(e,t){if(t.overflow>0)return!1;var r=e.length(),n=e.at(r-1);return!(n>this.blockSize<<2)&&(e.truncate(n),!0)},i.cfb=function(e){e=e||{},this.name="CFB",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._ints),this._partialBlock=new Array(this._ints),this._partialOutput=n.util.createBuffer(),this._partialBytes=0},i.cfb.prototype.start=function(e){if(!("iv"in e))throw new Error("Invalid IV parameter.");this._iv=o(e.iv),this._inBlock=this._iv.slice(0),this._partialBytes=0},i.cfb.prototype.encrypt=function(e,t,r){var n=e.length();if(0===n)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&n>=this.blockSize)for(var i=0;i<this._ints;++i)this._inBlock[i]=e.getInt32()^this._outBlock[i],t.putInt32(this._inBlock[i]);else{var o=(this.blockSize-n)%this.blockSize;o>0&&(o=this.blockSize-o),this._partialOutput.clear();for(var i=0;i<this._ints;++i)this._partialBlock[i]=e.getInt32()^this._outBlock[i],this._partialOutput.putInt32(this._partialBlock[i]);if(o>0)e.read-=this.blockSize;else for(var i=0;i<this._ints;++i)this._inBlock[i]=this._partialBlock[i];if(this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),o>0&&!r)return t.putBytes(this._partialOutput.getBytes(o-this._partialBytes)),this._partialBytes=o,!0;t.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0}},i.cfb.prototype.decrypt=function(e,t,r){var n=e.length();if(0===n)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&n>=this.blockSize)for(var i=0;i<this._ints;++i)this._inBlock[i]=e.getInt32(),t.putInt32(this._inBlock[i]^this._outBlock[i]);else{var o=(this.blockSize-n)%this.blockSize;o>0&&(o=this.blockSize-o),this._partialOutput.clear();for(var i=0;i<this._ints;++i)this._partialBlock[i]=e.getInt32(),this._partialOutput.putInt32(this._partialBlock[i]^this._outBlock[i]);if(o>0)e.read-=this.blockSize;else for(var i=0;i<this._ints;++i)this._inBlock[i]=this._partialBlock[i];if(this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),o>0&&!r)return t.putBytes(this._partialOutput.getBytes(o-this._partialBytes)),this._partialBytes=o,!0;t.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0}},i.ofb=function(e){e=e||{},this.name="OFB",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._ints),this._partialOutput=n.util.createBuffer(),this._partialBytes=0},i.ofb.prototype.start=function(e){if(!("iv"in e))throw new Error("Invalid IV parameter.");this._iv=o(e.iv),this._inBlock=this._iv.slice(0),this._partialBytes=0},i.ofb.prototype.encrypt=function(e,t,r){var n=e.length();if(0===e.length())return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&n>=this.blockSize)for(var i=0;i<this._ints;++i)t.putInt32(e.getInt32()^this._outBlock[i]),this._inBlock[i]=this._outBlock[i];else{var o=(this.blockSize-n)%this.blockSize;o>0&&(o=this.blockSize-o),this._partialOutput.clear();for(var i=0;i<this._ints;++i)this._partialOutput.putInt32(e.getInt32()^this._outBlock[i]);if(o>0)e.read-=this.blockSize;else for(var i=0;i<this._ints;++i)this._inBlock[i]=this._outBlock[i];if(this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),o>0&&!r)return t.putBytes(this._partialOutput.getBytes(o-this._partialBytes)),this._partialBytes=o,!0;t.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0}},i.ofb.prototype.decrypt=i.ofb.prototype.encrypt,i.ctr=function(e){e=e||{},this.name="CTR",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._ints),this._partialOutput=n.util.createBuffer(),this._partialBytes=0},i.ctr.prototype.start=function(e){if(!("iv"in e))throw new Error("Invalid IV parameter.");this._iv=o(e.iv),this._inBlock=this._iv.slice(0),this._partialBytes=0},i.ctr.prototype.encrypt=function(e,t,r){var n=e.length();if(0===n)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&n>=this.blockSize)for(var i=0;i<this._ints;++i)t.putInt32(e.getInt32()^this._outBlock[i]);else{var o=(this.blockSize-n)%this.blockSize;o>0&&(o=this.blockSize-o),this._partialOutput.clear();for(var i=0;i<this._ints;++i)this._partialOutput.putInt32(e.getInt32()^this._outBlock[i]);if(o>0&&(e.read-=this.blockSize),this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),o>0&&!r)return t.putBytes(this._partialOutput.getBytes(o-this._partialBytes)),this._partialBytes=o,!0;t.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0}s(this._inBlock)},i.ctr.prototype.decrypt=i.ctr.prototype.encrypt,i.gcm=function(e){e=e||{},this.name="GCM",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=new Array(this._ints),this._outBlock=new Array(this._ints),this._partialOutput=n.util.createBuffer(),this._partialBytes=0,this._R=3774873600},i.gcm.prototype.start=function(e){if(!("iv"in e))throw new Error("Invalid IV parameter.");var t=n.util.createBuffer(e.iv),r;if(this._cipherLength=0,r="additionalData"in e?n.util.createBuffer(e.additionalData):n.util.createBuffer(),this._tagLength="tagLength"in e?e.tagLength:128,this._tag=null,e.decrypt&&(this._tag=n.util.createBuffer(e.tag).getBytes(),this._tag.length!==this._tagLength/8))throw new Error("Authentication tag does not match tag length.");this._hashBlock=new Array(this._ints),this.tag=null,this._hashSubkey=new Array(this._ints),this.cipher.encrypt([0,0,0,0],this._hashSubkey),this.componentBits=4,this._m=this.generateHashTable(this._hashSubkey,this.componentBits);var i=t.length();if(12===i)this._j0=[t.getInt32(),t.getInt32(),t.getInt32(),1];else{for(this._j0=[0,0,0,0];t.length()>0;)this._j0=this.ghash(this._hashSubkey,this._j0,[t.getInt32(),t.getInt32(),t.getInt32(),t.getInt32()]);this._j0=this.ghash(this._hashSubkey,this._j0,[0,0].concat(a(8*i)))}this._inBlock=this._j0.slice(0),s(this._inBlock),this._partialBytes=0,r=n.util.createBuffer(r),this._aDataLength=a(8*r.length());var o=r.length()%this.blockSize;for(o&&r.fillWithByte(0,this.blockSize-o),this._s=[0,0,0,0];r.length()>0;)this._s=this.ghash(this._hashSubkey,this._s,[r.getInt32(),r.getInt32(),r.getInt32(),r.getInt32()])},i.gcm.prototype.encrypt=function(e,t,r){var n=e.length();if(0===n)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&n>=this.blockSize){for(var i=0;i<this._ints;++i)t.putInt32(this._outBlock[i]^=e.getInt32());this._cipherLength+=this.blockSize}else{var o=(this.blockSize-n)%this.blockSize;o>0&&(o=this.blockSize-o),this._partialOutput.clear();for(var i=0;i<this._ints;++i)this._partialOutput.putInt32(e.getInt32()^this._outBlock[i]);if(0===o||r){if(r){var a=n%this.blockSize;this._cipherLength+=a,this._partialOutput.truncate(this.blockSize-a)}else this._cipherLength+=this.blockSize;for(var i=0;i<this._ints;++i)this._outBlock[i]=this._partialOutput.getInt32();this._partialOutput.read-=this.blockSize}if(this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),o>0&&!r)return e.read-=this.blockSize,t.putBytes(this._partialOutput.getBytes(o-this._partialBytes)),this._partialBytes=o,!0;t.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0}this._s=this.ghash(this._hashSubkey,this._s,this._outBlock),s(this._inBlock)},i.gcm.prototype.decrypt=function(e,t,r){var n=e.length();if(n<this.blockSize&&!(r&&n>0))return!0;this.cipher.encrypt(this._inBlock,this._outBlock),s(this._inBlock),this._hashBlock[0]=e.getInt32(),this._hashBlock[1]=e.getInt32(),this._hashBlock[2]=e.getInt32(),this._hashBlock[3]=e.getInt32(),this._s=this.ghash(this._hashSubkey,this._s,this._hashBlock);for(var i=0;i<this._ints;++i)t.putInt32(this._outBlock[i]^this._hashBlock[i]);n<this.blockSize?this._cipherLength+=n%this.blockSize:this._cipherLength+=this.blockSize},i.gcm.prototype.afterFinish=function(e,t){var r=!0;t.decrypt&&t.overflow&&e.truncate(this.blockSize-t.overflow),this.tag=n.util.createBuffer();var i=this._aDataLength.concat(a(8*this._cipherLength));this._s=this.ghash(this._hashSubkey,this._s,i);var o=[];this.cipher.encrypt(this._j0,o);for(var s=0;s<this._ints;++s)this.tag.putInt32(this._s[s]^o[s]);return this.tag.truncate(this.tag.length()%(this._tagLength/8)),t.decrypt&&this.tag.bytes()!==this._tag&&(r=!1),r},i.gcm.prototype.multiply=function(e,t){for(var r=[0,0,0,0],n=t.slice(0),i=0;i<128;++i){var o=e[i/32|0]&1<<31-i%32;o&&(r[0]^=n[0],r[1]^=n[1],r[2]^=n[2],r[3]^=n[3]),this.pow(n,n)}return r},i.gcm.prototype.pow=function(e,t){for(var r=1&e[3],n=3;n>0;--n)t[n]=e[n]>>>1|(1&e[n-1])<<31;t[0]=e[0]>>>1,r&&(t[0]^=this._R)},i.gcm.prototype.tableMultiply=function(e){for(var t=[0,0,0,0],r=0;r<32;++r){var n=r/8|0,i=e[n]>>>4*(7-r%8)&15,o=this._m[r][i];t[0]^=o[0],t[1]^=o[1],t[2]^=o[2],t[3]^=o[3]}return t},i.gcm.prototype.ghash=function(e,t,r){return t[0]^=r[0],t[1]^=r[1],t[2]^=r[2],t[3]^=r[3],this.tableMultiply(t)},i.gcm.prototype.generateHashTable=function(e,t){for(var r=8/t,n=4*r,i=16*r,o=new Array(i),s=0;s<i;++s){var a=[0,0,0,0],u=s/n|0,c=(n-1-s%n)*t;a[u]=1<<t-1<<c,o[s]=this.generateSubHashTable(this.multiply(a,e),t)}return o},i.gcm.prototype.generateSubHashTable=function(e,t){var r=1<<t,n=r>>>1,i=new Array(r);i[n]=e.slice(0);for(var o=n>>>1;o>0;)this.pow(i[2*o],i[o]=[]),o>>=1;for(o=2;o<n;){for(var s=1;s<o;++s){var a=i[o],u=i[s];i[o+s]=[a[0]^u[0],a[1]^u[1],a[2]^u[2],a[3]^u[3]]}o*=2}for(i[0]=[0,0,0,0],o=n+1;o<r;++o){var c=i[o^n];i[o]=[e[0]^c[0],e[1]^c[1],e[2]^c[2],e[3]^c[3]]}return i}},function(e,t,r){var n=r(11);r(77),r(137),r(257),r(114),r(440),r(63),r(138),r(16);var i=function(e,t,r,i){var o=n.util.createBuffer(),s=e.length>>1,a=s+(1&e.length),u=e.substr(0,a),c=e.substr(s,a),f=n.util.createBuffer(),l=n.hmac.create();r=t+r;var h=Math.ceil(i/16),p=Math.ceil(i/20);l.start("MD5",u);var d=n.util.createBuffer();f.putBytes(r);for(var y=0;y<h;++y)l.start(null,null),l.update(f.getBytes()),f.putBuffer(l.digest()),l.start(null,null),l.update(f.bytes()+r),d.putBuffer(l.digest());l.start("SHA1",c);var g=n.util.createBuffer();f.clear(),f.putBytes(r);for(var y=0;y<p;++y)l.start(null,null),l.update(f.getBytes()),f.putBuffer(l.digest()),l.start(null,null),l.update(f.bytes()+r),g.putBuffer(l.digest());return o.putBytes(n.util.xorBytes(d.getBytes(),g.getBytes(),i)),o},o=function(e,t,r,n){},s=function(e,t,r){var i=n.hmac.create();i.start("SHA1",e);var o=n.util.createBuffer();return o.putInt32(t[0]),o.putInt32(t[1]),o.putByte(r.type),o.putByte(r.version.major),o.putByte(r.version.minor),o.putInt16(r.length),o.putBytes(r.fragment.bytes()),i.update(o.getBytes()),i.digest().getBytes()},a=function(e,t,r){var i=!1;try{var o=e.deflate(t.fragment.getBytes());t.fragment=n.util.createBuffer(o),t.length=o.length,i=!0}catch(e){}return i},u=function(e,t,r){var i=!1;try{var o=e.inflate(t.fragment.getBytes());t.fragment=n.util.createBuffer(o),t.length=o.length,i=!0}catch(e){}return i},c=function(e,t){var r=0;switch(t){case 1:r=e.getByte();break;case 2:r=e.getInt16();break;case 3:r=e.getInt24();break;case 4:r=e.getInt32()}return n.util.createBuffer(e.getBytes(r))},f=function(e,t,r){e.putInt(r.length(),t<<3),e.putBuffer(r)},l={Versions:{TLS_1_0:{major:3,minor:1},TLS_1_1:{major:3,minor:2},TLS_1_2:{major:3,minor:3}}};l.SupportedVersions=[l.Versions.TLS_1_1,l.Versions.TLS_1_0],l.Version=l.SupportedVersions[0],l.MaxFragment=15360,l.ConnectionEnd={server:0,client:1},l.PRFAlgorithm={tls_prf_sha256:0},l.BulkCipherAlgorithm={none:null,rc4:0,des3:1,aes:2},l.CipherType={stream:0,block:1,aead:2},l.MACAlgorithm={none:null,hmac_md5:0,hmac_sha1:1,hmac_sha256:2,hmac_sha384:3,hmac_sha512:4},l.CompressionMethod={none:0,deflate:1},l.ContentType={change_cipher_spec:20,alert:21,handshake:22,application_data:23,heartbeat:24},l.HandshakeType={hello_request:0,client_hello:1,server_hello:2,certificate:11,server_key_exchange:12,certificate_request:13,server_hello_done:14,certificate_verify:15,client_key_exchange:16,finished:20},l.Alert={},l.Alert.Level={warning:1,fatal:2},l.Alert.Description={close_notify:0,unexpected_message:10,bad_record_mac:20,decryption_failed:21,record_overflow:22,decompression_failure:30,handshake_failure:40,bad_certificate:42,unsupported_certificate:43,certificate_revoked:44,certificate_expired:45,certificate_unknown:46,illegal_parameter:47,unknown_ca:48,access_denied:49,decode_error:50,decrypt_error:51,export_restriction:60,protocol_version:70,insufficient_security:71,internal_error:80,user_canceled:90,no_renegotiation:100},l.HeartbeatMessageType={heartbeat_request:1,heartbeat_response:2},l.CipherSuites={},l.getCipherSuite=function(e){var t=null;for(var r in l.CipherSuites){var n=l.CipherSuites[r];if(n.id[0]===e.charCodeAt(0)&&n.id[1]===e.charCodeAt(1)){t=n;break}}return t},l.handleUnexpected=function(e,t){var r=!e.open&&e.entity===l.ConnectionEnd.client;r||e.error(e,{message:"Unexpected message. Received TLS record out of order.",send:!0,alert:{level:l.Alert.Level.fatal,description:l.Alert.Description.unexpected_message}})},l.handleHelloRequest=function(e,t,r){!e.handshaking&&e.handshakes>0&&(l.queue(e,l.createAlert(e,{level:l.Alert.Level.warning,description:l.Alert.Description.no_renegotiation})),l.flush(e)),e.process()},l.parseHelloMessage=function(e,t,r){var i=null,o=e.entity===l.ConnectionEnd.client;if(r<38)e.error(e,{message:o?"Invalid ServerHello message. Message too short.":"Invalid ClientHello message. Message too short.",send:!0,alert:{level:l.Alert.Level.fatal,description:l.Alert.Description.illegal_parameter}});else{var s=t.fragment,a=s.length();if(i={version:{major:s.getByte(),minor:s.getByte()},random:n.util.createBuffer(s.getBytes(32)),session_id:c(s,1),extensions:[]},o?(i.cipher_suite=s.getBytes(2),i.compression_method=s.getByte()):(i.cipher_suites=c(s,2),i.compression_methods=c(s,1)),a=r-(a-s.length()),a>0){for(var u=c(s,2);u.length()>0;)i.extensions.push({type:[u.getByte(),u.getByte()],data:c(u,2)});if(!o)for(var f=0;f<i.extensions.length;++f){var h=i.extensions[f];if(0===h.type[0]&&0===h.type[1])for(var p=c(h.data,2);p.length()>0;){var d=p.getByte();if(0!==d)break;e.session.extensions.server_name.serverNameList.push(c(p,2).getBytes())}}}if(e.session.version&&(i.version.major!==e.session.version.major||i.version.minor!==e.session.version.minor))return e.error(e,{message:"TLS version change is disallowed during renegotiation.",send:!0,alert:{level:l.Alert.Level.fatal,description:l.Alert.Description.protocol_version}});if(o)e.session.cipherSuite=l.getCipherSuite(i.cipher_suite);else for(var y=n.util.createBuffer(i.cipher_suites.bytes());y.length()>0&&(e.session.cipherSuite=l.getCipherSuite(y.getBytes(2)),null===e.session.cipherSuite););if(null===e.session.cipherSuite)return e.error(e,{message:"No cipher suites in common.",send:!0,alert:{level:l.Alert.Level.fatal,description:l.Alert.Description.handshake_failure},cipherSuite:n.util.bytesToHex(i.cipher_suite)});e.session.compressionMethod=o?i.compression_method:l.CompressionMethod.none}return i},l.createSecurityParameters=function(e,t){var r=e.entity===l.ConnectionEnd.client,n=t.random.bytes(),i=r?e.session.sp.client_random:n,o=r?n:l.createRandom().getBytes();e.session.sp={entity:e.entity,prf_algorithm:l.PRFAlgorithm.tls_prf_sha256,bulk_cipher_algorithm:null,cipher_type:null,enc_key_length:null,block_length:null,fixed_iv_length:null,record_iv_length:null,mac_algorithm:null,mac_length:null,mac_key_length:null,compression_algorithm:e.session.compressionMethod,pre_master_secret:null,master_secret:null,client_random:i,server_random:o}},l.handleServerHello=function(e,t,r){var n=l.parseHelloMessage(e,t,r);if(!e.fail){if(!(n.version.minor<=e.version.minor))return e.error(e,{message:"Incompatible TLS version.",send:!0,alert:{level:l.Alert.Level.fatal,description:l.Alert.Description.protocol_version}});e.version.minor=n.version.minor,e.session.version=e.version;var i=n.session_id.bytes();i.length>0&&i===e.session.id?(e.expect=m,e.session.resuming=!0,e.session.sp.server_random=n.random.bytes()):(e.expect=p,e.session.resuming=!1,l.createSecurityParameters(e,n)),e.session.id=i,e.process()}},l.handleClientHello=function(e,t,r){var i=l.parseHelloMessage(e,t,r);if(!e.fail){var o=i.session_id.bytes(),s=null;if(e.sessionCache&&(s=e.sessionCache.getSession(o),null===s?o="":(s.version.major!==i.version.major||s.version.minor>i.version.minor)&&(s=null,o="")),0===o.length&&(o=n.random.getBytes(32)),e.session.id=o,e.session.clientHelloVersion=i.version,e.session.sp={},s)e.version=e.session.version=s.version,e.session.sp=s.sp;else{for(var a,u=1;u<l.SupportedVersions.length&&(a=l.SupportedVersions[u],!(a.minor<=i.version.minor));++u);e.version={major:a.major,minor:a.minor},e.session.version=e.version}null!==s?(e.expect=A,e.session.resuming=!0,e.session.sp.client_random=i.random.bytes()):(e.expect=!1!==e.verifyClient?S:k,e.session.resuming=!1,l.createSecurityParameters(e,i)),e.open=!0,l.queue(e,l.createRecord(e,{type:l.ContentType.handshake,data:l.createServerHello(e)})),e.session.resuming?(l.queue(e,l.createRecord(e,{type:l.ContentType.change_cipher_spec,data:l.createChangeCipherSpec()})),e.state.pending=l.createConnectionState(e),e.state.current.write=e.state.pending.write,l.queue(e,l.createRecord(e,{type:l.ContentType.handshake,data:l.createFinished(e)}))):(l.queue(e,l.createRecord(e,{type:l.ContentType.handshake,data:l.createCertificate(e)})),e.fail||(l.queue(e,l.createRecord(e,{type:l.ContentType.handshake,data:l.createServerKeyExchange(e)})),!1!==e.verifyClient&&l.queue(e,l.createRecord(e,{type:l.ContentType.handshake,data:l.createCertificateRequest(e)})),l.queue(e,l.createRecord(e,{type:l.ContentType.handshake,data:l.createServerHelloDone(e)})))),l.flush(e),e.process()}},l.handleCertificate=function(e,t,r){if(r<3)return e.error(e,{message:"Invalid Certificate message. Message too short.",send:!0,alert:{level:l.Alert.Level.fatal,description:l.Alert.Description.illegal_parameter}});var i=t.fragment,o={certificate_list:c(i,3)},s,a,u=[];try{for(;o.certificate_list.length()>0;)s=c(o.certificate_list,3),a=n.asn1.fromDer(s),s=n.pki.certificateFromAsn1(a,!0),u.push(s)}catch(t){return e.error(e,{message:"Could not parse certificate list.",cause:t,send:!0,alert:{level:l.Alert.Level.fatal,description:l.Alert.Description.bad_certificate}})}var f=e.entity===l.ConnectionEnd.client;!f&&!0!==e.verifyClient||0!==u.length?0===u.length?e.expect=f?d:k:(f?e.session.serverCertificate=u[0]:e.session.clientCertificate=u[0],l.verifyCertificateChain(e,u)&&(e.expect=f?d:k)):e.error(e,{message:f?"No server certificate provided.":"No client certificate provided.",send:!0,alert:{level:l.Alert.Level.fatal,description:l.Alert.Description.illegal_parameter}}),e.process()},l.handleServerKeyExchange=function(e,t,r){if(r>0)return e.error(e,{message:"Invalid key parameters. Only RSA is supported.",send:!0,alert:{level:l.Alert.Level.fatal,description:l.Alert.Description.unsupported_certificate}});e.expect=y,e.process()},l.handleClientKeyExchange=function(e,t,r){if(r<48)return e.error(e,{message:"Invalid key parameters. Only RSA is supported.",send:!0,alert:{level:l.Alert.Level.fatal,description:l.Alert.Description.unsupported_certificate}});var i=t.fragment,o={enc_pre_master_secret:c(i,2).getBytes()},s=null;if(e.getPrivateKey)try{s=e.getPrivateKey(e,e.session.serverCertificate),s=n.pki.privateKeyFromPem(s)}catch(t){e.error(e,{message:"Could not get private key.",cause:t,send:!0,alert:{level:l.Alert.Level.fatal,description:l.Alert.Description.internal_error}})}if(null===s)return e.error(e,{message:"No private key set.",send:!0,alert:{level:l.Alert.Level.fatal,description:l.Alert.Description.internal_error}});try{var a=e.session.sp;a.pre_master_secret=s.decrypt(o.enc_pre_master_secret);var u=e.session.clientHelloVersion;if(u.major!==a.pre_master_secret.charCodeAt(0)||u.minor!==a.pre_master_secret.charCodeAt(1))throw new Error("TLS version rollback attack detected.")}catch(e){a.pre_master_secret=n.random.getBytes(48)}e.expect=A,null!==e.session.clientCertificate&&(e.expect=E),e.process()},l.handleCertificateRequest=function(e,t,r){if(r<3)return e.error(e,{message:"Invalid CertificateRequest. Message too short.",send:!0,alert:{level:l.Alert.Level.fatal,description:l.Alert.Description.illegal_parameter}});var n=t.fragment,i={certificate_types:c(n,1),certificate_authorities:c(n,2)};e.session.certificateRequest=i,e.expect=g,e.process()},l.handleCertificateVerify=function(e,t,r){if(r<2)return e.error(e,{message:"Invalid CertificateVerify. Message too short.",send:!0,alert:{level:l.Alert.Level.fatal,description:l.Alert.Description.illegal_parameter}});var i=t.fragment;i.read-=4;var o=i.bytes();i.read+=4;var s={signature:c(i,2).getBytes()},a=n.util.createBuffer();a.putBuffer(e.session.md5.digest()),a.putBuffer(e.session.sha1.digest()),a=a.getBytes();try{var u=e.session.clientCertificate;if(!u.publicKey.verify(a,s.signature,"NONE"))throw new Error("CertificateVerify signature does not match.");e.session.md5.update(o),e.session.sha1.update(o)}catch(t){return e.error(e,{message:"Bad signature in CertificateVerify.",send:!0,alert:{level:l.Alert.Level.fatal,description:l.Alert.Description.handshake_failure}})}e.expect=A,e.process()},l.handleServerHelloDone=function(e,t,r){if(r>0)return e.error(e,{message:"Invalid ServerHelloDone message. Invalid length.",send:!0,alert:{level:l.Alert.Level.fatal,description:l.Alert.Description.record_overflow}});if(null===e.serverCertificate){var i={message:"No server certificate provided. Not enough security.",send:!0,alert:{level:l.Alert.Level.fatal,description:l.Alert.Description.insufficient_security}},o=0,s=e.verify(e,i.alert.description,0,[]);if(!0!==s)return(s||0===s)&&("object"!=typeof s||n.util.isArray(s)?"number"==typeof s&&(i.alert.description=s):(s.message&&(i.message=s.message),s.alert&&(i.alert.description=s.alert))),e.error(e,i)}null!==e.session.certificateRequest&&(t=l.createRecord(e,{type:l.ContentType.handshake,data:l.createCertificate(e)}),l.queue(e,t)),t=l.createRecord(e,{type:l.ContentType.handshake,data:l.createClientKeyExchange(e)}),l.queue(e,t),e.expect=_;var a=function(e,t){null!==e.session.certificateRequest&&null!==e.session.clientCertificate&&l.queue(e,l.createRecord(e,{type:l.ContentType.handshake,data:l.createCertificateVerify(e,t)})),l.queue(e,l.createRecord(e,{type:l.ContentType.change_cipher_spec,data:l.createChangeCipherSpec()})),e.state.pending=l.createConnectionState(e),e.state.current.write=e.state.pending.write,l.queue(e,l.createRecord(e,{type:l.ContentType.handshake,data:l.createFinished(e)})),e.expect=m,l.flush(e),e.process()};if(null===e.session.certificateRequest||null===e.session.clientCertificate)return a(e,null);l.getClientSignature(e,a)},l.handleChangeCipherSpec=function(e,t){if(1!==t.fragment.getByte())return e.error(e,{message:"Invalid ChangeCipherSpec message received.",send:!0,alert:{level:l.Alert.Level.fatal,description:l.Alert.Description.illegal_parameter}});var r=e.entity===l.ConnectionEnd.client;(e.session.resuming&&r||!e.session.resuming&&!r)&&(e.state.pending=l.createConnectionState(e)),e.state.current.read=e.state.pending.read,(!e.session.resuming&&r||e.session.resuming&&!r)&&(e.state.pending=null),e.expect=r?b:x,e.process()},l.handleFinished=function(e,t,r){var o=t.fragment;o.read-=4;var s=o.bytes();o.read+=4;var a=t.fragment.getBytes();o=n.util.createBuffer(),o.putBuffer(e.session.md5.digest()),o.putBuffer(e.session.sha1.digest());var u=e.entity===l.ConnectionEnd.client,c=u?"server finished":"client finished",f=e.session.sp,h=12,p=i;if(o=p(f.master_secret,c,o.getBytes(),12),o.getBytes()!==a)return e.error(e,{message:"Invalid verify_data in Finished message.",send:!0,alert:{level:l.Alert.Level.fatal,description:l.Alert.Description.decrypt_error}});e.session.md5.update(s),e.session.sha1.update(s),(e.session.resuming&&u||!e.session.resuming&&!u)&&(l.queue(e,l.createRecord(e,{type:l.ContentType.change_cipher_spec,data:l.createChangeCipherSpec()})),e.state.current.write=e.state.pending.write,e.state.pending=null,l.queue(e,l.createRecord(e,{type:l.ContentType.handshake,data:l.createFinished(e)}))),e.expect=u?v:I,e.handshaking=!1,++e.handshakes,e.peerCertificate=u?e.session.serverCertificate:e.session.clientCertificate,l.flush(e),e.isConnected=!0,e.connected(e),e.process()},l.handleAlert=function(e,t){var r=t.fragment,n={level:r.getByte(),description:r.getByte()},i;switch(n.description){case l.Alert.Description.close_notify:i="Connection closed.";break;case l.Alert.Description.unexpected_message:i="Unexpected message.";break;case l.Alert.Description.bad_record_mac:i="Bad record MAC.";break;case l.Alert.Description.decryption_failed:i="Decryption failed.";break;case l.Alert.Description.record_overflow:i="Record overflow.";break;case l.Alert.Description.decompression_failure:i="Decompression failed.";break;case l.Alert.Description.handshake_failure:i="Handshake failure.";break;case l.Alert.Description.bad_certificate:i="Bad certificate.";break;case l.Alert.Description.unsupported_certificate:i="Unsupported certificate.";break;case l.Alert.Description.certificate_revoked:i="Certificate revoked.";break;case l.Alert.Description.certificate_expired:i="Certificate expired.";break;case l.Alert.Description.certificate_unknown:i="Certificate unknown.";break;case l.Alert.Description.illegal_parameter:i="Illegal parameter.";break;case l.Alert.Description.unknown_ca:i="Unknown certificate authority.";break;case l.Alert.Description.access_denied:i="Access denied.";break;case l.Alert.Description.decode_error:i="Decode error.";break;case l.Alert.Description.decrypt_error:i="Decrypt error.";break;case l.Alert.Description.export_restriction:i="Export restriction.";break;case l.Alert.Description.protocol_version:i="Unsupported protocol version.";break;case l.Alert.Description.insufficient_security:i="Insufficient security.";break;case l.Alert.Description.internal_error:i="Internal error.";break;case l.Alert.Description.user_canceled:i="User canceled.";break;case l.Alert.Description.no_renegotiation:i="Renegotiation not supported.";break;default:i="Unknown error."}if(n.description===l.Alert.Description.close_notify)return e.close();e.error(e,{message:i,send:!1,origin:e.entity===l.ConnectionEnd.client?"server":"client",alert:n}),e.process()},l.handleHandshake=function(e,t){var r=t.fragment,i=r.getByte(),o=r.getInt24();if(o>r.length())return e.fragmented=t,t.fragment=n.util.createBuffer(),r.read-=4,e.process();e.fragmented=null,r.read-=4;var s=r.bytes(o+4);r.read+=4,i in H[e.entity][e.expect]?(e.entity!==l.ConnectionEnd.server||e.open||e.fail||(e.handshaking=!0,e.session={version:null,extensions:{server_name:{serverNameList:[]}},cipherSuite:null,compressionMethod:null,serverCertificate:null,clientCertificate:null,md5:n.md.md5.create(),sha1:n.md.sha1.create()}),i!==l.HandshakeType.hello_request&&i!==l.HandshakeType.certificate_verify&&i!==l.HandshakeType.finished&&(e.session.md5.update(s),e.session.sha1.update(s)),H[e.entity][e.expect][i](e,t,o)):l.handleUnexpected(e,t)},l.handleApplicationData=function(e,t){e.data.putBuffer(t.fragment),e.dataReady(e),e.process()},l.handleHeartbeat=function(e,t){var r=t.fragment,i=r.getByte(),o=r.getInt16(),s=r.getBytes(o);if(i===l.HeartbeatMessageType.heartbeat_request){if(e.handshaking||o>s.length)return e.process();l.queue(e,l.createRecord(e,{type:l.ContentType.heartbeat,data:l.createHeartbeat(l.HeartbeatMessageType.heartbeat_response,s)})),l.flush(e)}else if(i===l.HeartbeatMessageType.heartbeat_response){if(s!==e.expectedHeartbeatPayload)return e.process();e.heartbeatReceived&&e.heartbeatReceived(e,n.util.createBuffer(s))}e.process()};var h=0,p=1,d=2,y=3,g=4,m=5,b=6,v=7,_=8,w=0,S=1,k=2,E=3,A=4,x=5,I=6,T=7,B=l.handleUnexpected,C=l.handleChangeCipherSpec,P=l.handleAlert,O=l.handleHandshake,R=l.handleApplicationData,N=l.handleHeartbeat,L=[];L[l.ConnectionEnd.client]=[[B,P,O,B,N],[B,P,O,B,N],[B,P,O,B,N],[B,P,O,B,N],[B,P,O,B,N],[C,P,B,B,N],[B,P,O,B,N],[B,P,O,R,N],[B,P,O,B,N]],L[l.ConnectionEnd.server]=[[B,P,O,B,N],[B,P,O,B,N],[B,P,O,B,N],[B,P,O,B,N],[C,P,B,B,N],[B,P,O,B,N],[B,P,O,R,N],[B,P,O,B,N]];var j=l.handleHelloRequest,M=l.handleServerHello,K=l.handleCertificate,D=l.handleServerKeyExchange,U=l.handleCertificateRequest,F=l.handleServerHelloDone,q=l.handleFinished,H=[];H[l.ConnectionEnd.client]=[[B,B,M,B,B,B,B,B,B,B,B,B,B,B,B,B,B,B,B,B,B],[j,B,B,B,B,B,B,B,B,B,B,K,D,U,F,B,B,B,B,B,B],[j,B,B,B,B,B,B,B,B,B,B,B,D,U,F,B,B,B,B,B,B],[j,B,B,B,B,B,B,B,B,B,B,B,B,U,F,B,B,B,B,B,B],[j,B,B,B,B,B,B,B,B,B,B,B,B,B,F,B,B,B,B,B,B],[j,B,B,B,B,B,B,B,B,B,B,B,B,B,B,B,B,B,B,B,B],[j,B,B,B,B,B,B,B,B,B,B,B,B,B,B,B,B,B,B,B,q],[j,B,B,B,B,B,B,B,B,B,B,B,B,B,B,B,B,B,B,B,B],[j,B,B,B,B,B,B,B,B,B,B,B,B,B,B,B,B,B,B,B,B]];var z=l.handleClientHello,V=l.handleClientKeyExchange,G=l.handleCertificateVerify;H[l.ConnectionEnd.server]=[[B,z,B,B,B,B,B,B,B,B,B,B,B,B,B,B,B,B,B,B,B],[B,B,B,B,B,B,B,B,B,B,B,K,B,B,B,B,B,B,B,B,B],[B,B,B,B,B,B,B,B,B,B,B,B,B,B,B,B,V,B,B,B,B],[B,B,B,B,B,B,B,B,B,B,B,B,B,B,B,G,B,B,B,B,B],[B,B,B,B,B,B,B,B,B,B,B,B,B,B,B,B,B,B,B,B,B],[B,B,B,B,B,B,B,B,B,B,B,B,B,B,B,B,B,B,B,B,q],[B,B,B,B,B,B,B,B,B,B,B,B,B,B,B,B,B,B,B,B,B],[B,B,B,B,B,B,B,B,B,B,B,B,B,B,B,B,B,B,B,B,B]],l.generateKeys=function(e,t){var r=i,n=t.client_random+t.server_random;e.session.resuming||(t.master_secret=r(t.pre_master_secret,"master secret",n,48).bytes(),t.pre_master_secret=null),n=t.server_random+t.client_random;var o=2*t.mac_key_length+2*t.enc_key_length,s=e.version.major===l.Versions.TLS_1_0.major&&e.version.minor===l.Versions.TLS_1_0.minor;s&&(o+=2*t.fixed_iv_length);var a=r(t.master_secret,"key expansion",n,o),u={client_write_MAC_key:a.getBytes(t.mac_key_length),server_write_MAC_key:a.getBytes(t.mac_key_length),client_write_key:a.getBytes(t.enc_key_length),server_write_key:a.getBytes(t.enc_key_length)};return s&&(u.client_write_IV=a.getBytes(t.fixed_iv_length),u.server_write_IV=a.getBytes(t.fixed_iv_length)),u},l.createConnectionState=function(e){var t=e.entity===l.ConnectionEnd.client,r=function(){var e={sequenceNumber:[0,0],macKey:null,macLength:0,macFunction:null,cipherState:null,cipherFunction:function(e){return!0},compressionState:null,compressFunction:function(e){return!0},updateSequenceNumber:function(){4294967295===e.sequenceNumber[1]?(e.sequenceNumber[1]=0,++e.sequenceNumber[0]):++e.sequenceNumber[1]}};return e},n={read:r(),write:r()};if(n.read.update=function(e,t){return n.read.cipherFunction(t,n.read)?n.read.compressFunction(e,t,n.read)||e.error(e,{message:"Could not decompress record.",send:!0,alert:{level:l.Alert.Level.fatal,description:l.Alert.Description.decompression_failure}}):e.error(e,{message:"Could not decrypt record or bad MAC.",send:!0,alert:{level:l.Alert.Level.fatal,description:l.Alert.Description.bad_record_mac}}),!e.fail},n.write.update=function(e,t){return n.write.compressFunction(e,t,n.write)?n.write.cipherFunction(t,n.write)||e.error(e,{message:"Could not encrypt record.",send:!1,alert:{level:l.Alert.Level.fatal,description:l.Alert.Description.internal_error}}):e.error(e,{message:"Could not compress record.",send:!1,alert:{level:l.Alert.Level.fatal,description:l.Alert.Description.internal_error}}),!e.fail},e.session){var i=e.session.sp;switch(e.session.cipherSuite.initSecurityParameters(i),i.keys=l.generateKeys(e,i),n.read.macKey=t?i.keys.server_write_MAC_key:i.keys.client_write_MAC_key,n.write.macKey=t?i.keys.client_write_MAC_key:i.keys.server_write_MAC_key,e.session.cipherSuite.initConnectionState(n,e,i),i.compression_algorithm){case l.CompressionMethod.none:break;case l.CompressionMethod.deflate:n.read.compressFunction=u,n.write.compressFunction=a;break;default:throw new Error("Unsupported compression algorithm.")}}return n},l.createRandom=function(){var e=new Date,t=+e+6e4*e.getTimezoneOffset(),r=n.util.createBuffer();return r.putInt32(t),r.putBytes(n.random.getBytes(28)),r},l.createRecord=function(e,t){if(!t.data)return null;var r={type:t.type,version:{major:e.version.major,minor:e.version.minor},length:t.data.length(),fragment:t.data};return r},l.createAlert=function(e,t){var r=n.util.createBuffer();return r.putByte(t.level),r.putByte(t.description),l.createRecord(e,{type:l.ContentType.alert,data:r})},l.createClientHello=function(e){e.session.clientHelloVersion={major:e.version.major,minor:e.version.minor};for(var t=n.util.createBuffer(),r=0;r<e.cipherSuites.length;++r){var i=e.cipherSuites[r];t.putByte(i.id[0]),t.putByte(i.id[1])}var o=t.length(),s=n.util.createBuffer();s.putByte(l.CompressionMethod.none);var a=s.length(),u=n.util.createBuffer();if(e.virtualHost){var c=n.util.createBuffer();c.putByte(0),c.putByte(0);var h=n.util.createBuffer();h.putByte(0),f(h,2,n.util.createBuffer(e.virtualHost));var p=n.util.createBuffer();f(p,2,h),f(c,2,p),u.putBuffer(c)}var d=u.length();d>0&&(d+=2);var y=e.session.id,g=y.length+1+2+4+28+2+o+1+a+d,m=n.util.createBuffer();return m.putByte(l.HandshakeType.client_hello),m.putInt24(g),m.putByte(e.version.major),m.putByte(e.version.minor),m.putBytes(e.session.sp.client_random),f(m,1,n.util.createBuffer(y)),f(m,2,t),f(m,1,s),d>0&&f(m,2,u),m},l.createServerHello=function(e){var t=e.session.id,r=t.length+1+2+4+28+2+1,i=n.util.createBuffer();return i.putByte(l.HandshakeType.server_hello),i.putInt24(r),i.putByte(e.version.major),i.putByte(e.version.minor),i.putBytes(e.session.sp.server_random),f(i,1,n.util.createBuffer(t)),i.putByte(e.session.cipherSuite.id[0]),i.putByte(e.session.cipherSuite.id[1]),i.putByte(e.session.compressionMethod),i},l.createCertificate=function(e){var t=e.entity===l.ConnectionEnd.client,r=null,i;e.getCertificate&&(i=t?e.session.certificateRequest:e.session.extensions.server_name.serverNameList,r=e.getCertificate(e,i));var o=n.util.createBuffer();if(null!==r)try{n.util.isArray(r)||(r=[r]);for(var s=null,a=0;a<r.length;++a){var u=n.pem.decode(r[a])[0];if("CERTIFICATE"!==u.type&&"X509 CERTIFICATE"!==u.type&&"TRUSTED CERTIFICATE"!==u.type){var c=new Error('Could not convert certificate from PEM; PEM header type is not "CERTIFICATE", "X509 CERTIFICATE", or "TRUSTED CERTIFICATE".');throw c.headerType=u.type,c}if(u.procType&&"ENCRYPTED"===u.procType.type)throw new Error("Could not convert certificate from PEM; PEM is encrypted.");var h=n.util.createBuffer(u.body);null===s&&(s=n.asn1.fromDer(h.bytes(),!1));var p=n.util.createBuffer();f(p,3,h),o.putBuffer(p)}r=n.pki.certificateFromAsn1(s),t?e.session.clientCertificate=r:e.session.serverCertificate=r}catch(t){return e.error(e,{message:"Could not send certificate list.",cause:t,send:!0,alert:{level:l.Alert.Level.fatal,description:l.Alert.Description.bad_certificate}})}var d=3+o.length(),y=n.util.createBuffer();return y.putByte(l.HandshakeType.certificate),y.putInt24(d),f(y,3,o),y},l.createClientKeyExchange=function(e){var t=n.util.createBuffer();t.putByte(e.session.clientHelloVersion.major),t.putByte(e.session.clientHelloVersion.minor),t.putBytes(n.random.getBytes(46));var r=e.session.sp;r.pre_master_secret=t.getBytes();var i=e.session.serverCertificate.publicKey;t=i.encrypt(r.pre_master_secret);var o=t.length+2,s=n.util.createBuffer();return s.putByte(l.HandshakeType.client_key_exchange),s.putInt24(o),s.putInt16(t.length),s.putBytes(t),s},l.createServerKeyExchange=function(e){var t=0,r=n.util.createBuffer();return r},l.getClientSignature=function(e,t){var r=n.util.createBuffer();r.putBuffer(e.session.md5.digest()),r.putBuffer(e.session.sha1.digest()),r=r.getBytes(),e.getSignature=e.getSignature||function(e,t,r){var i=null;if(e.getPrivateKey)try{i=e.getPrivateKey(e,e.session.clientCertificate),i=n.pki.privateKeyFromPem(i)}catch(t){e.error(e,{message:"Could not get private key.",cause:t,send:!0,alert:{level:l.Alert.Level.fatal,description:l.Alert.Description.internal_error}})}null===i?e.error(e,{message:"No private key set.",send:!0,alert:{level:l.Alert.Level.fatal,description:l.Alert.Description.internal_error}}):t=i.sign(t,null),r(e,t)},e.getSignature(e,r,t)},l.createCertificateVerify=function(e,t){var r=t.length+2,i=n.util.createBuffer();return i.putByte(l.HandshakeType.certificate_verify),i.putInt24(r),i.putInt16(t.length),i.putBytes(t),i},l.createCertificateRequest=function(e){var t=n.util.createBuffer();t.putByte(1);var r=n.util.createBuffer();for(var i in e.caStore.certs){var o=e.caStore.certs[i],s=n.pki.distinguishedNameToAsn1(o.subject),a=n.asn1.toDer(s);r.putInt16(a.length()),r.putBuffer(a)}var u=1+t.length()+2+r.length(),c=n.util.createBuffer();return c.putByte(l.HandshakeType.certificate_request),c.putInt24(u),f(c,1,t),f(c,2,r),c},l.createServerHelloDone=function(e){var t=n.util.createBuffer();return t.putByte(l.HandshakeType.server_hello_done),t.putInt24(0),t},l.createChangeCipherSpec=function(){var e=n.util.createBuffer();return e.putByte(1),e},l.createFinished=function(e){var t=n.util.createBuffer();t.putBuffer(e.session.md5.digest()),t.putBuffer(e.session.sha1.digest());var r=e.entity===l.ConnectionEnd.client,o=e.session.sp,s=12,a=i,u=r?"client finished":"server finished";t=a(o.master_secret,u,t.getBytes(),12);var c=n.util.createBuffer();return c.putByte(l.HandshakeType.finished),c.putInt24(t.length()),c.putBuffer(t),c},l.createHeartbeat=function(e,t,r){void 0===r&&(r=t.length);var i=n.util.createBuffer();i.putByte(e),i.putInt16(r),i.putBytes(t);var o=i.length(),s=Math.max(16,o-r-3);return i.putBytes(n.random.getBytes(s)),i},l.queue=function(e,t){if(t&&(0!==t.fragment.length()||t.type!==l.ContentType.handshake&&t.type!==l.ContentType.alert&&t.type!==l.ContentType.change_cipher_spec)){if(t.type===l.ContentType.handshake){var r=t.fragment.bytes();e.session.md5.update(r),e.session.sha1.update(r),r=null}var i;if(t.fragment.length()<=l.MaxFragment)i=[t];else{i=[];for(var o=t.fragment.bytes();o.length>l.MaxFragment;)i.push(l.createRecord(e,{type:t.type,data:n.util.createBuffer(o.slice(0,l.MaxFragment))})),o=o.slice(l.MaxFragment);o.length>0&&i.push(l.createRecord(e,{type:t.type,data:n.util.createBuffer(o)}))}for(var s=0;s<i.length&&!e.fail;++s){var a=i[s],u=e.state.current.write;u.update(e,a)&&e.records.push(a)}}},l.flush=function(e){for(var t=0;t<e.records.length;++t){var r=e.records[t];e.tlsData.putByte(r.type),e.tlsData.putByte(r.version.major),e.tlsData.putByte(r.version.minor),e.tlsData.putInt16(r.fragment.length()),e.tlsData.putBuffer(e.records[t].fragment)}return e.records=[],e.tlsDataReady(e)};var W=function(e){switch(e){case!0:return!0;case n.pki.certificateError.bad_certificate:return l.Alert.Description.bad_certificate;case n.pki.certificateError.unsupported_certificate:return l.Alert.Description.unsupported_certificate;case n.pki.certificateError.certificate_revoked:return l.Alert.Description.certificate_revoked;case n.pki.certificateError.certificate_expired:return l.Alert.Description.certificate_expired;case n.pki.certificateError.certificate_unknown:return l.Alert.Description.certificate_unknown;case n.pki.certificateError.unknown_ca:return l.Alert.Description.unknown_ca;default:return l.Alert.Description.bad_certificate}},$=function(e){switch(e){case!0:return!0;case l.Alert.Description.bad_certificate:return n.pki.certificateError.bad_certificate;case l.Alert.Description.unsupported_certificate:return n.pki.certificateError.unsupported_certificate;case l.Alert.Description.certificate_revoked:return n.pki.certificateError.certificate_revoked;case l.Alert.Description.certificate_expired:return n.pki.certificateError.certificate_expired;case l.Alert.Description.certificate_unknown:return n.pki.certificateError.certificate_unknown;case l.Alert.Description.unknown_ca:return n.pki.certificateError.unknown_ca;default:return n.pki.certificateError.bad_certificate}};for(var Y in l.verifyCertificateChain=function(e,t){try{n.pki.verifyCertificateChain(e.caStore,t,function t(r,i,o){var s=W(r),a=e.verify(e,r,i,o);if(!0!==a){if("object"==typeof a&&!n.util.isArray(a)){var u=new Error("The application rejected the certificate.");throw u.send=!0,u.alert={level:l.Alert.Level.fatal,description:l.Alert.Description.bad_certificate},a.message&&(u.message=a.message),a.alert&&(u.alert.description=a.alert),u}a!==r&&(a=$(a))}return a})}catch(t){var r=t;("object"!=typeof r||n.util.isArray(r))&&(r={send:!0,alert:{level:l.Alert.Level.fatal,description:W(t)}}),"send"in r||(r.send=!0),"alert"in r||(r.alert={level:l.Alert.Level.fatal,description:W(r.error)}),e.error(e,r)}return!e.fail},l.createSessionCache=function(e,t){var r=null;if(e&&e.getSession&&e.setSession&&e.order)r=e;else{for(var i in r={},r.cache=e||{},r.capacity=Math.max(t||100,1),r.order=[],e)r.order.length<=t?r.order.push(i):delete e[i];r.getSession=function(e){var t=null,i=null;if(e?i=n.util.bytesToHex(e):r.order.length>0&&(i=r.order[0]),null!==i&&i in r.cache)for(var o in t=r.cache[i],delete r.cache[i],r.order)if(r.order[o]===i){r.order.splice(o,1);break}return t},r.setSession=function(e,t){if(r.order.length===r.capacity){var i=r.order.shift();delete r.cache[i]}var i=n.util.bytesToHex(e);r.order.push(i),r.cache[i]=t}}return r},l.createConnection=function(e){var t=null;t=e.caStore?n.util.isArray(e.caStore)?n.pki.createCaStore(e.caStore):e.caStore:n.pki.createCaStore();var r=e.cipherSuites||null;if(null===r)for(var i in r=[],l.CipherSuites)r.push(l.CipherSuites[i]);var o=e.server?l.ConnectionEnd.server:l.ConnectionEnd.client,s=e.sessionCache?l.createSessionCache(e.sessionCache):null,a={version:{major:l.Version.major,minor:l.Version.minor},entity:o,sessionId:e.sessionId,caStore:t,sessionCache:s,cipherSuites:r,connected:e.connected,virtualHost:e.virtualHost||null,verifyClient:e.verifyClient||!1,verify:e.verify||function(e,t,r,n){return t},getCertificate:e.getCertificate||null,getPrivateKey:e.getPrivateKey||null,getSignature:e.getSignature||null,input:n.util.createBuffer(),tlsData:n.util.createBuffer(),data:n.util.createBuffer(),tlsDataReady:e.tlsDataReady,dataReady:e.dataReady,heartbeatReceived:e.heartbeatReceived,closed:e.closed,error:function(t,r){r.origin=r.origin||(t.entity===l.ConnectionEnd.client?"client":"server"),r.send&&(l.queue(t,l.createAlert(t,r.alert)),l.flush(t));var n=!1!==r.fatal;n&&(t.fail=!0),e.error(t,r),n&&t.close(!1)},deflate:e.deflate||null,inflate:e.inflate||null,reset:function(e){a.version={major:l.Version.major,minor:l.Version.minor},a.record=null,a.session=null,a.peerCertificate=null,a.state={pending:null,current:null},a.expect=(a.entity,l.ConnectionEnd.client,0),a.fragmented=null,a.records=[],a.open=!1,a.handshakes=0,a.handshaking=!1,a.isConnected=!1,a.fail=!(e||void 0===e),a.input.clear(),a.tlsData.clear(),a.data.clear(),a.state.current=l.createConnectionState(a)}};a.reset();var u=function(e,t){var r=t.type-l.ContentType.change_cipher_spec,n=L[e.entity][e.expect];r in n?n[r](e,t):l.handleUnexpected(e,t)},c=function(e){var t=0,r=e.input,i=r.length();if(i<5)t=5-i;else{e.record={type:r.getByte(),version:{major:r.getByte(),minor:r.getByte()},length:r.getInt16(),fragment:n.util.createBuffer(),ready:!1};var o=e.record.version.major===e.version.major;o&&e.session&&e.session.version&&(o=e.record.version.minor===e.version.minor),o||e.error(e,{message:"Incompatible TLS version.",send:!0,alert:{level:l.Alert.Level.fatal,description:l.Alert.Description.protocol_version}})}return t},f=function(e){var t=0,r=e.input,n=r.length();if(n<e.record.length)t=e.record.length-n;else{e.record.fragment.putBytes(r.getBytes(e.record.length)),r.compact();var i=e.state.current.read;i.update(e,e.record)&&(null!==e.fragmented&&(e.fragmented.type===e.record.type?(e.fragmented.fragment.putBuffer(e.record.fragment),e.record=e.fragmented):e.error(e,{message:"Invalid fragmented record.",send:!0,alert:{level:l.Alert.Level.fatal,description:l.Alert.Description.unexpected_message}})),e.record.ready=!0)}return t};return a.handshake=function(e){if(a.entity!==l.ConnectionEnd.client)a.error(a,{message:"Cannot initiate handshake as a server.",fatal:!1});else if(a.handshaking)a.error(a,{message:"Handshake already in progress.",fatal:!1});else{a.fail&&!a.open&&0===a.handshakes&&(a.fail=!1),a.handshaking=!0,e=e||"";var t=null;e.length>0&&(a.sessionCache&&(t=a.sessionCache.getSession(e)),null===t&&(e="")),0===e.length&&a.sessionCache&&(t=a.sessionCache.getSession(),null!==t&&(e=t.id)),a.session={id:e,version:null,cipherSuite:null,compressionMethod:null,serverCertificate:null,certificateRequest:null,clientCertificate:null,sp:{},md5:n.md.md5.create(),sha1:n.md.sha1.create()},t&&(a.version=t.version,a.session.sp=t.sp),a.session.sp.client_random=l.createRandom().getBytes(),a.open=!0,l.queue(a,l.createRecord(a,{type:l.ContentType.handshake,data:l.createClientHello(a)})),l.flush(a)}},a.process=function(e){var t=0;return e&&a.input.putBytes(e),a.fail||(null!==a.record&&a.record.ready&&a.record.fragment.isEmpty()&&(a.record=null),null===a.record&&(t=c(a)),a.fail||null===a.record||a.record.ready||(t=f(a)),!a.fail&&null!==a.record&&a.record.ready&&u(a,a.record)),t},a.prepare=function(e){return l.queue(a,l.createRecord(a,{type:l.ContentType.application_data,data:n.util.createBuffer(e)})),l.flush(a)},a.prepareHeartbeatRequest=function(e,t){return e instanceof n.util.ByteBuffer&&(e=e.bytes()),void 0===t&&(t=e.length),a.expectedHeartbeatPayload=e,l.queue(a,l.createRecord(a,{type:l.ContentType.heartbeat,data:l.createHeartbeat(l.HeartbeatMessageType.heartbeat_request,e,t)})),l.flush(a)},a.close=function(e){if(!a.fail&&a.sessionCache&&a.session){var t={id:a.session.id,version:a.session.version,sp:a.session.sp};t.sp.keys=null,a.sessionCache.setSession(t.id,t)}a.open&&(a.open=!1,a.input.clear(),(a.isConnected||a.handshaking)&&(a.isConnected=a.handshaking=!1,l.queue(a,l.createAlert(a,{level:l.Alert.Level.warning,description:l.Alert.Description.close_notify})),l.flush(a)),a.closed(a)),a.reset(e)},a},e.exports=n.tls=n.tls||{},l)"function"!=typeof l[Y]&&(n.tls[Y]=l[Y]);n.tls.prf_tls1=i,n.tls.hmac_sha1=s,n.tls.createSessionCache=l.createSessionCache,n.tls.createConnection=l.createConnection},function(e,t,r){var n=r(11);r(77),r(101),r(441),r(114),r(258),r(448),r(260),r(183),r(16),r(259);var i=n.asn1,o=e.exports=n.pki=n.pki||{};o.pemToDer=function(e){var t=n.pem.decode(e)[0];if(t.procType&&"ENCRYPTED"===t.procType.type)throw new Error("Could not convert PEM to DER; PEM is encrypted.");return n.util.createBuffer(t.body)},o.privateKeyFromPem=function(e){var t=n.pem.decode(e)[0];if("PRIVATE KEY"!==t.type&&"RSA PRIVATE KEY"!==t.type){var r=new Error('Could not convert private key from PEM; PEM header type is not "PRIVATE KEY" or "RSA PRIVATE KEY".');throw r.headerType=t.type,r}if(t.procType&&"ENCRYPTED"===t.procType.type)throw new Error("Could not convert private key from PEM; PEM is encrypted.");var s=i.fromDer(t.body);return o.privateKeyFromAsn1(s)},o.privateKeyToPem=function(e,t){var r={type:"RSA PRIVATE KEY",body:i.toDer(o.privateKeyToAsn1(e)).getBytes()};return n.pem.encode(r,{maxline:t})},o.privateKeyInfoToPem=function(e,t){var r={type:"PRIVATE KEY",body:i.toDer(e).getBytes()};return n.pem.encode(r,{maxline:t})}},function(e,t,r){var n=r(11);if(r(100),r(77),r(182),r(78),r(101),r(258),r(114),r(63),r(445),r(183),r(16),void 0===i)var i=n.jsbn.BigInteger;var o=n.asn1,s=n.pki=n.pki||{};e.exports=s.pbe=n.pbe=n.pbe||{};var a=s.oids,u={name:"EncryptedPrivateKeyInfo",tagClass:o.Class.UNIVERSAL,type:o.Type.SEQUENCE,constructed:!0,value:[{name:"EncryptedPrivateKeyInfo.encryptionAlgorithm",tagClass:o.Class.UNIVERSAL,type:o.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:o.Class.UNIVERSAL,type:o.Type.OID,constructed:!1,capture:"encryptionOid"},{name:"AlgorithmIdentifier.parameters",tagClass:o.Class.UNIVERSAL,type:o.Type.SEQUENCE,constructed:!0,captureAsn1:"encryptionParams"}]},{name:"EncryptedPrivateKeyInfo.encryptedData",tagClass:o.Class.UNIVERSAL,type:o.Type.OCTETSTRING,constructed:!1,capture:"encryptedData"}]},c={name:"PBES2Algorithms",tagClass:o.Class.UNIVERSAL,type:o.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.keyDerivationFunc",tagClass:o.Class.UNIVERSAL,type:o.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.keyDerivationFunc.oid",tagClass:o.Class.UNIVERSAL,type:o.Type.OID,constructed:!1,capture:"kdfOid"},{name:"PBES2Algorithms.params",tagClass:o.Class.UNIVERSAL,type:o.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.params.salt",tagClass:o.Class.UNIVERSAL,type:o.Type.OCTETSTRING,constructed:!1,capture:"kdfSalt"},{name:"PBES2Algorithms.params.iterationCount",tagClass:o.Class.UNIVERSAL,type:o.Type.INTEGER,constructed:!1,capture:"kdfIterationCount"},{name:"PBES2Algorithms.params.keyLength",tagClass:o.Class.UNIVERSAL,type:o.Type.INTEGER,constructed:!1,optional:!0,capture:"keyLength"},{name:"PBES2Algorithms.params.prf",tagClass:o.Class.UNIVERSAL,type:o.Type.SEQUENCE,constructed:!0,optional:!0,value:[{name:"PBES2Algorithms.params.prf.algorithm",tagClass:o.Class.UNIVERSAL,type:o.Type.OID,constructed:!1,capture:"prfOid"}]}]}]},{name:"PBES2Algorithms.encryptionScheme",tagClass:o.Class.UNIVERSAL,type:o.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.encryptionScheme.oid",tagClass:o.Class.UNIVERSAL,type:o.Type.OID,constructed:!1,capture:"encOid"},{name:"PBES2Algorithms.encryptionScheme.iv",tagClass:o.Class.UNIVERSAL,type:o.Type.OCTETSTRING,constructed:!1,capture:"encIv"}]}]},f={name:"pkcs-12PbeParams",tagClass:o.Class.UNIVERSAL,type:o.Type.SEQUENCE,constructed:!0,value:[{name:"pkcs-12PbeParams.salt",tagClass:o.Class.UNIVERSAL,type:o.Type.OCTETSTRING,constructed:!1,capture:"salt"},{name:"pkcs-12PbeParams.iterations",tagClass:o.Class.UNIVERSAL,type:o.Type.INTEGER,constructed:!1,capture:"iterations"}]};function l(e,t){return e.start().update(t).digest().getBytes()}function h(e){var t;if(e){if(t=s.oids[o.derToOid(e)],!t){var r=new Error("Unsupported PRF OID.");throw r.oid=e,r.supported=["hmacWithSHA1","hmacWithSHA224","hmacWithSHA256","hmacWithSHA384","hmacWithSHA512"],r}}else t="hmacWithSHA1";return p(t)}function p(e){var t=n.md;switch(e){case"hmacWithSHA224":t=n.md.sha512;case"hmacWithSHA1":case"hmacWithSHA256":case"hmacWithSHA384":case"hmacWithSHA512":e=e.substr(8).toLowerCase();break;default:var r=new Error("Unsupported PRF algorithm.");throw r.algorithm=e,r.supported=["hmacWithSHA1","hmacWithSHA224","hmacWithSHA256","hmacWithSHA384","hmacWithSHA512"],r}if(!(t&&e in t))throw new Error("Unknown hash algorithm: "+e);return t[e].create()}function d(e,t,r,i){var a=o.create(o.Class.UNIVERSAL,o.Type.SEQUENCE,!0,[o.create(o.Class.UNIVERSAL,o.Type.OCTETSTRING,!1,e),o.create(o.Class.UNIVERSAL,o.Type.INTEGER,!1,t.getBytes())]);return"hmacWithSHA1"!==i&&a.value.push(o.create(o.Class.UNIVERSAL,o.Type.INTEGER,!1,n.util.hexToBytes(r.toString(16))),o.create(o.Class.UNIVERSAL,o.Type.SEQUENCE,!0,[o.create(o.Class.UNIVERSAL,o.Type.OID,!1,o.oidToDer(s.oids[i]).getBytes()),o.create(o.Class.UNIVERSAL,o.Type.NULL,!1,"")])),a}s.encryptPrivateKeyInfo=function(e,t,r){r=r||{},r.saltSize=r.saltSize||8,r.count=r.count||2048,r.algorithm=r.algorithm||"aes128",r.prfAlgorithm=r.prfAlgorithm||"sha1";var i=n.random.getBytesSync(r.saltSize),u=r.count,c=o.integerToDer(u),f,l,h;if(0===r.algorithm.indexOf("aes")||"des"===r.algorithm){var y,g,m;switch(r.algorithm){case"aes128":f=16,y=16,g=a["aes128-CBC"],m=n.aes.createEncryptionCipher;break;case"aes192":f=24,y=16,g=a["aes192-CBC"],m=n.aes.createEncryptionCipher;break;case"aes256":f=32,y=16,g=a["aes256-CBC"],m=n.aes.createEncryptionCipher;break;case"des":f=8,y=8,g=a.desCBC,m=n.des.createEncryptionCipher;break;default:var b=new Error("Cannot encrypt private key. Unknown encryption algorithm.");throw b.algorithm=r.algorithm,b}var v="hmacWith"+r.prfAlgorithm.toUpperCase(),_=p(v),w=n.pkcs5.pbkdf2(t,i,u,f,_),S=n.random.getBytesSync(y),k=m(w);k.start(S),k.update(o.toDer(e)),k.finish(),h=k.output.getBytes();var E=d(i,c,f,v);l=o.create(o.Class.UNIVERSAL,o.Type.SEQUENCE,!0,[o.create(o.Class.UNIVERSAL,o.Type.OID,!1,o.oidToDer(a.pkcs5PBES2).getBytes()),o.create(o.Class.UNIVERSAL,o.Type.SEQUENCE,!0,[o.create(o.Class.UNIVERSAL,o.Type.SEQUENCE,!0,[o.create(o.Class.UNIVERSAL,o.Type.OID,!1,o.oidToDer(a.pkcs5PBKDF2).getBytes()),E]),o.create(o.Class.UNIVERSAL,o.Type.SEQUENCE,!0,[o.create(o.Class.UNIVERSAL,o.Type.OID,!1,o.oidToDer(g).getBytes()),o.create(o.Class.UNIVERSAL,o.Type.OCTETSTRING,!1,S)])])])}else{if("3des"!==r.algorithm){var b=new Error("Cannot encrypt private key. Unknown encryption algorithm.");throw b.algorithm=r.algorithm,b}f=24;var A=new n.util.ByteBuffer(i),w=s.pbe.generatePkcs12Key(t,A,1,u,f),S=s.pbe.generatePkcs12Key(t,A,2,u,f),k=n.des.createEncryptionCipher(w);k.start(S),k.update(o.toDer(e)),k.finish(),h=k.output.getBytes(),l=o.create(o.Class.UNIVERSAL,o.Type.SEQUENCE,!0,[o.create(o.Class.UNIVERSAL,o.Type.OID,!1,o.oidToDer(a["pbeWithSHAAnd3-KeyTripleDES-CBC"]).getBytes()),o.create(o.Class.UNIVERSAL,o.Type.SEQUENCE,!0,[o.create(o.Class.UNIVERSAL,o.Type.OCTETSTRING,!1,i),o.create(o.Class.UNIVERSAL,o.Type.INTEGER,!1,c.getBytes())])])}var x=o.create(o.Class.UNIVERSAL,o.Type.SEQUENCE,!0,[l,o.create(o.Class.UNIVERSAL,o.Type.OCTETSTRING,!1,h)]);return x},s.decryptPrivateKeyInfo=function(e,t){var r=null,i={},a=[];if(!o.validate(e,u,i,a)){var c=new Error("Cannot read encrypted private key. ASN.1 object is not a supported EncryptedPrivateKeyInfo.");throw c.errors=a,c}var f=o.derToOid(i.encryptionOid),l=s.pbe.getCipher(f,i.encryptionParams,t),h=n.util.createBuffer(i.encryptedData);return l.update(h),l.finish()&&(r=o.fromDer(l.output)),r},s.encryptedPrivateKeyToPem=function(e,t){var r={type:"ENCRYPTED PRIVATE KEY",body:o.toDer(e).getBytes()};return n.pem.encode(r,{maxline:t})},s.encryptedPrivateKeyFromPem=function(e){var t=n.pem.decode(e)[0];if("ENCRYPTED PRIVATE KEY"!==t.type){var r=new Error('Could not convert encrypted private key from PEM; PEM header type is "ENCRYPTED PRIVATE KEY".');throw r.headerType=t.type,r}if(t.procType&&"ENCRYPTED"===t.procType.type)throw new Error("Could not convert encrypted private key from PEM; PEM is encrypted.");return o.fromDer(t.body)},s.encryptRsaPrivateKey=function(e,t,r){if(r=r||{},!r.legacy){var i=s.wrapRsaPrivateKey(s.privateKeyToAsn1(e));return i=s.encryptPrivateKeyInfo(i,t,r),s.encryptedPrivateKeyToPem(i)}var a,u,c,f;switch(r.algorithm){case"aes128":a="AES-128-CBC",c=16,u=n.random.getBytesSync(16),f=n.aes.createEncryptionCipher;break;case"aes192":a="AES-192-CBC",c=24,u=n.random.getBytesSync(16),f=n.aes.createEncryptionCipher;break;case"aes256":a="AES-256-CBC",c=32,u=n.random.getBytesSync(16),f=n.aes.createEncryptionCipher;break;case"3des":a="DES-EDE3-CBC",c=24,u=n.random.getBytesSync(8),f=n.des.createEncryptionCipher;break;case"des":a="DES-CBC",c=8,u=n.random.getBytesSync(8),f=n.des.createEncryptionCipher;break;default:var l=new Error('Could not encrypt RSA private key; unsupported encryption algorithm "'+r.algorithm+'".');throw l.algorithm=r.algorithm,l}var h=n.pbe.opensslDeriveBytes(t,u.substr(0,8),c),p=f(h);p.start(u),p.update(o.toDer(s.privateKeyToAsn1(e))),p.finish();var d={type:"RSA PRIVATE KEY",procType:{version:"4",type:"ENCRYPTED"},dekInfo:{algorithm:a,parameters:n.util.bytesToHex(u).toUpperCase()},body:p.output.getBytes()};return n.pem.encode(d)},s.decryptRsaPrivateKey=function(e,t){var r=null,i=n.pem.decode(e)[0];if("ENCRYPTED PRIVATE KEY"!==i.type&&"PRIVATE KEY"!==i.type&&"RSA PRIVATE KEY"!==i.type){var a=new Error('Could not convert private key from PEM; PEM header type is not "ENCRYPTED PRIVATE KEY", "PRIVATE KEY", or "RSA PRIVATE KEY".');throw a.headerType=a,a}if(i.procType&&"ENCRYPTED"===i.procType.type){var u,c;switch(i.dekInfo.algorithm){case"DES-CBC":u=8,c=n.des.createDecryptionCipher;break;case"DES-EDE3-CBC":u=24,c=n.des.createDecryptionCipher;break;case"AES-128-CBC":u=16,c=n.aes.createDecryptionCipher;break;case"AES-192-CBC":u=24,c=n.aes.createDecryptionCipher;break;case"AES-256-CBC":u=32,c=n.aes.createDecryptionCipher;break;case"RC2-40-CBC":u=5,c=function(e){return n.rc2.createDecryptionCipher(e,40)};break;case"RC2-64-CBC":u=8,c=function(e){return n.rc2.createDecryptionCipher(e,64)};break;case"RC2-128-CBC":u=16,c=function(e){return n.rc2.createDecryptionCipher(e,128)};break;default:var a=new Error('Could not decrypt private key; unsupported encryption algorithm "'+i.dekInfo.algorithm+'".');throw a.algorithm=i.dekInfo.algorithm,a}var f=n.util.hexToBytes(i.dekInfo.parameters),l=n.pbe.opensslDeriveBytes(t,f.substr(0,8),u),h=c(l);if(h.start(f),h.update(n.util.createBuffer(i.body)),!h.finish())return r;r=h.output.getBytes()}else r=i.body;return r="ENCRYPTED PRIVATE KEY"===i.type?s.decryptPrivateKeyInfo(o.fromDer(r),t):o.fromDer(r),null!==r&&(r=s.privateKeyFromAsn1(r)),r},s.pbe.generatePkcs12Key=function(e,t,r,i,o,s){var a,u;if(void 0===s||null===s){if(!("sha1"in n.md))throw new Error('"sha1" hash algorithm unavailable.');s=n.md.sha1.create()}var c=s.digestLength,f=s.blockLength,l=new n.util.ByteBuffer,h=new n.util.ByteBuffer;if(null!==e&&void 0!==e){for(u=0;u<e.length;u++)h.putInt16(e.charCodeAt(u));h.putInt16(0)}var p=h.length(),d=t.length(),y=new n.util.ByteBuffer;y.fillWithByte(r,f);var g=f*Math.ceil(d/f),m=new n.util.ByteBuffer;for(u=0;u<g;u++)m.putByte(t.at(u%d));var b=f*Math.ceil(p/f),v=new n.util.ByteBuffer;for(u=0;u<b;u++)v.putByte(h.at(u%p));var _=m;_.putBuffer(v);for(var w=Math.ceil(o/c),S=1;S<=w;S++){var k=new n.util.ByteBuffer;k.putBytes(y.bytes()),k.putBytes(_.bytes());for(var E=0;E<i;E++)s.start(),s.update(k.getBytes()),k=s.digest();var A=new n.util.ByteBuffer;for(u=0;u<f;u++)A.putByte(k.at(u%c));var x=Math.ceil(d/f)+Math.ceil(p/f),I=new n.util.ByteBuffer;for(a=0;a<x;a++){var T=new n.util.ByteBuffer(_.getBytes(f)),B=511;for(u=A.length()-1;u>=0;u--)B>>=8,B+=A.at(u)+T.at(u),T.setAt(u,255&B);I.putBuffer(T)}_=I,l.putBuffer(k)}return l.truncate(l.length()-o),l},s.pbe.getCipher=function(e,t,r){switch(e){case s.oids.pkcs5PBES2:return s.pbe.getCipherForPBES2(e,t,r);case s.oids["pbeWithSHAAnd3-KeyTripleDES-CBC"]:case s.oids["pbewithSHAAnd40BitRC2-CBC"]:return s.pbe.getCipherForPKCS12PBE(e,t,r);default:var n=new Error("Cannot read encrypted PBE data block. Unsupported OID.");throw n.oid=e,n.supportedOids=["pkcs5PBES2","pbeWithSHAAnd3-KeyTripleDES-CBC","pbewithSHAAnd40BitRC2-CBC"],n}},s.pbe.getCipherForPBES2=function(e,t,r){var i={},a=[];if(!o.validate(t,c,i,a)){var u=new Error("Cannot read password-based-encryption algorithm parameters. ASN.1 object is not a supported EncryptedPrivateKeyInfo.");throw u.errors=a,u}if(e=o.derToOid(i.kdfOid),e!==s.oids.pkcs5PBKDF2){var u=new Error("Cannot read encrypted private key. Unsupported key derivation function OID.");throw u.oid=e,u.supportedOids=["pkcs5PBKDF2"],u}if(e=o.derToOid(i.encOid),e!==s.oids["aes128-CBC"]&&e!==s.oids["aes192-CBC"]&&e!==s.oids["aes256-CBC"]&&e!==s.oids["des-EDE3-CBC"]&&e!==s.oids.desCBC){var u=new Error("Cannot read encrypted private key. Unsupported encryption scheme OID.");throw u.oid=e,u.supportedOids=["aes128-CBC","aes192-CBC","aes256-CBC","des-EDE3-CBC","desCBC"],u}var f=i.kdfSalt,l=n.util.createBuffer(i.kdfIterationCount),p,d;switch(l=l.getInt(l.length()<<3),s.oids[e]){case"aes128-CBC":p=16,d=n.aes.createDecryptionCipher;break;case"aes192-CBC":p=24,d=n.aes.createDecryptionCipher;break;case"aes256-CBC":p=32,d=n.aes.createDecryptionCipher;break;case"des-EDE3-CBC":p=24,d=n.des.createDecryptionCipher;break;case"desCBC":p=8,d=n.des.createDecryptionCipher}var y=h(i.prfOid),g=n.pkcs5.pbkdf2(r,f,l,p,y),m=i.encIv,b=d(g);return b.start(m),b},s.pbe.getCipherForPKCS12PBE=function(e,t,r){var i={},a=[];if(!o.validate(t,f,i,a)){var u=new Error("Cannot read password-based-encryption algorithm parameters. ASN.1 object is not a supported EncryptedPrivateKeyInfo.");throw u.errors=a,u}var c=n.util.createBuffer(i.salt),l=n.util.createBuffer(i.iterations),p,d,y;switch(l=l.getInt(l.length()<<3),e){case s.oids["pbeWithSHAAnd3-KeyTripleDES-CBC"]:p=24,d=8,y=n.des.startDecrypting;break;case s.oids["pbewithSHAAnd40BitRC2-CBC"]:p=5,d=8,y=function(e,t){var r=n.rc2.createDecryptionCipher(e,40);return r.start(t,null),r};break;default:var u=new Error("Cannot read PKCS #12 PBE data block. Unsupported OID.");throw u.oid=e,u}var g=h(i.prfOid),m=s.pbe.generatePkcs12Key(r,c,1,l,p,g);g.start();var b=s.pbe.generatePkcs12Key(r,c,2,l,d,g);return y(m,b)},s.pbe.opensslDeriveBytes=function(e,t,r,i){if(void 0===i||null===i){if(!("md5"in n.md))throw new Error('"md5" hash algorithm unavailable.');i=n.md.md5.create()}null===t&&(t="");for(var o=[l(i,e+t)],s=16,a=1;s<r;++a,s+=16)o.push(l(i,o[a-1]+e+t));return o.join("").substr(0,r)}},function(e,t){},function(e,t,r){var n=r(11);r(78),r(16);var i=e.exports=n.sha256=n.sha256||{};n.md.sha256=n.md.algorithms.sha256=i,i.create=function(){s||u();var e=null,t=n.util.createBuffer(),r=new Array(64),i={algorithm:"sha256",blockLength:64,digestLength:32,messageLength:0,fullMessageLength:null,messageLengthSize:8,start:function(){i.messageLength=0,i.fullMessageLength=i.messageLength64=[];for(var r=i.messageLengthSize/4,o=0;o<r;++o)i.fullMessageLength.push(0);return t=n.util.createBuffer(),e={h0:1779033703,h1:3144134277,h2:1013904242,h3:2773480762,h4:1359893119,h5:2600822924,h6:528734635,h7:1541459225},i}};return i.start(),i.update=function(o,s){"utf8"===s&&(o=n.util.encodeUtf8(o));var a=o.length;i.messageLength+=a,a=[a/4294967296>>>0,a>>>0];for(var u=i.fullMessageLength.length-1;u>=0;--u)i.fullMessageLength[u]+=a[1],a[1]=a[0]+(i.fullMessageLength[u]/4294967296>>>0),i.fullMessageLength[u]=i.fullMessageLength[u]>>>0,a[0]=a[1]/4294967296>>>0;return t.putBytes(o),c(e,r,t),(t.read>2048||0===t.length())&&t.compact(),i},i.digest=function(){var s=n.util.createBuffer();s.putBytes(t.bytes());var a=i.fullMessageLength[i.fullMessageLength.length-1]+i.messageLengthSize,u=a&i.blockLength-1,f,l;s.putBytes(o.substr(0,i.blockLength-u));for(var h=8*i.fullMessageLength[0],p=0;p<i.fullMessageLength.length-1;++p)f=8*i.fullMessageLength[p+1],l=f/4294967296>>>0,h+=l,s.putInt32(h>>>0),h=f>>>0;s.putInt32(h);var d={h0:e.h0,h1:e.h1,h2:e.h2,h3:e.h3,h4:e.h4,h5:e.h5,h6:e.h6,h7:e.h7};c(d,r,s);var y=n.util.createBuffer();return y.putInt32(d.h0),y.putInt32(d.h1),y.putInt32(d.h2),y.putInt32(d.h3),y.putInt32(d.h4),y.putInt32(d.h5),y.putInt32(d.h6),y.putInt32(d.h7),y},i};var o=null,s=!1,a=null;function u(){o=String.fromCharCode(128),o+=n.util.fillString(String.fromCharCode(0),64),a=[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],s=!0}function c(e,t,r){for(var n,i,o,s,u,c,f,l,h,p,d,y,g,m,b,v=r.length();v>=64;){for(f=0;f<16;++f)t[f]=r.getInt32();for(;f<64;++f)n=t[f-2],n=(n>>>17|n<<15)^(n>>>19|n<<13)^n>>>10,i=t[f-15],i=(i>>>7|i<<25)^(i>>>18|i<<14)^i>>>3,t[f]=n+t[f-7]+i+t[f-16]|0;for(l=e.h0,h=e.h1,p=e.h2,d=e.h3,y=e.h4,g=e.h5,m=e.h6,b=e.h7,f=0;f<64;++f)s=(y>>>6|y<<26)^(y>>>11|y<<21)^(y>>>25|y<<7),u=m^y&(g^m),o=(l>>>2|l<<30)^(l>>>13|l<<19)^(l>>>22|l<<10),c=l&h|p&(l^h),n=b+s+u+a[f]+t[f],i=o+c,b=m,m=g,g=y,y=d+n>>>0,d=p,p=h,h=l,l=n+i>>>0;e.h0=e.h0+l|0,e.h1=e.h1+h|0,e.h2=e.h2+p|0,e.h3=e.h3+d|0,e.h4=e.h4+y|0,e.h5=e.h5+g|0,e.h6=e.h6+m|0,e.h7=e.h7+b|0,v-=64}}},function(e,t,r){(function(t){var n=r(11);r(16);var i=null;!n.util.isNodejs||n.options.usePureJavaScript||t.versions["node-webkit"]||(i=r(442));var o=e.exports=n.prng=n.prng||{};o.create=function(e){for(var t={plugin:e,key:null,seed:null,time:null,reseeds:0,generated:0,keyBytes:""},r=e.md,o=new Array(32),s=0;s<32;++s)o[s]=r.create();function a(e){if(t.pools[0].messageLength>=32)return c(),e();var r=32-t.pools[0].messageLength<<5;t.seedFile(r,function(r,n){if(r)return e(r);t.collect(n),c(),e()})}function u(){if(t.pools[0].messageLength>=32)return c();var e=32-t.pools[0].messageLength<<5;t.collect(t.seedFileSync(e)),c()}function c(){t.reseeds=4294967295===t.reseeds?0:t.reseeds+1;var e=t.plugin.md.create();e.update(t.keyBytes);for(var r=1,n=0;n<32;++n)t.reseeds%r==0&&(e.update(t.pools[n].digest().getBytes()),t.pools[n].start()),r<<=1;t.keyBytes=e.digest().getBytes(),e.start(),e.update(t.keyBytes);var i=e.digest().getBytes();t.key=t.plugin.formatKey(t.keyBytes),t.seed=t.plugin.formatSeed(i),t.generated=0}function f(e){var t=null;if("undefined"!=typeof window){var r=window.crypto||window.msCrypto;r&&r.getRandomValues&&(t=function(e){return r.getRandomValues(e)})}var i=n.util.createBuffer();if(t)for(;i.length()<e;){var o=Math.max(1,Math.min(e-i.length(),65536)/4),s=new Uint32Array(Math.floor(o));try{t(s);for(var a=0;a<s.length;++a)i.putInt32(s[a])}catch(e){if(!("undefined"!=typeof QuotaExceededError&&e instanceof QuotaExceededError))throw e}}if(i.length()<e)for(var u,c,f,l=Math.floor(65536*Math.random());i.length()<e;){c=16807*(65535&l),u=16807*(l>>16),c+=(32767&u)<<16,c+=u>>15,c=(2147483647&c)+(c>>31),l=4294967295&c;for(var a=0;a<3;++a)f=l>>>(a<<3),f^=Math.floor(256*Math.random()),i.putByte(String.fromCharCode(255&f))}return i.getBytes(e)}return t.pools=o,t.pool=0,t.generate=function(e,r){if(!r)return t.generateSync(e);var i=t.plugin.cipher,o=t.plugin.increment,s=t.plugin.formatKey,u=t.plugin.formatSeed,c=n.util.createBuffer();function f(l){if(l)return r(l);if(c.length()>=e)return r(null,c.getBytes(e));if(t.generated>1048575&&(t.key=null),null===t.key)return n.util.nextTick(function(){a(f)});var h=i(t.key,t.seed);t.generated+=h.length,c.putBytes(h),t.key=s(i(t.key,o(t.seed))),t.seed=u(i(t.key,t.seed)),n.util.setImmediate(f)}t.key=null,f()},t.generateSync=function(e){var r=t.plugin.cipher,i=t.plugin.increment,o=t.plugin.formatKey,s=t.plugin.formatSeed;t.key=null;for(var a=n.util.createBuffer();a.length()<e;){t.generated>1048575&&(t.key=null),null===t.key&&u();var c=r(t.key,t.seed);t.generated+=c.length,a.putBytes(c),t.key=o(r(t.key,i(t.seed))),t.seed=s(r(t.key,t.seed))}return a.getBytes(e)},i?(t.seedFile=function(e,t){i.randomBytes(e,function(e,r){if(e)return t(e);t(null,r.toString())})},t.seedFileSync=function(e){return i.randomBytes(e).toString()}):(t.seedFile=function(e,t){try{t(null,f(e))}catch(e){t(e)}},t.seedFileSync=f),t.collect=function(e){for(var r=e.length,n=0;n<r;++n)t.pools[t.pool].update(e.substr(n,1)),t.pool=31===t.pool?0:t.pool+1},t.collectInt=function(e,r){for(var n="",i=0;i<r;i+=8)n+=String.fromCharCode(e>>i&255);t.collect(n)},t.registerWorker=function(e){if(e===self)t.seedFile=function(e,t){function r(e){var n=e.data;n.forge&&n.forge.prng&&(self.removeEventListener("message",r),t(n.forge.prng.err,n.forge.prng.bytes))}self.addEventListener("message",r),self.postMessage({forge:{prng:{needed:e}}})};else{var r=function(r){var n=r.data;n.forge&&n.forge.prng&&t.seedFile(n.forge.prng.needed,function(t,r){e.postMessage({forge:{prng:{err:t,bytes:r}}})})};e.addEventListener("message",r)}},t}}).call(this,r(6))},function(e,t,r){var n=r(11);r(16);var i=[217,120,249,196,25,221,181,237,40,233,253,121,74,160,216,157,198,126,55,131,43,118,83,142,98,76,100,136,68,139,251,162,23,154,89,245,135,179,79,19,97,69,109,141,9,129,125,50,189,143,64,235,134,183,123,11,240,149,33,34,92,107,78,130,84,214,101,147,206,96,178,28,115,86,192,20,167,140,241,220,18,117,202,31,59,190,228,209,66,61,212,48,163,60,182,38,111,191,14,218,70,105,7,87,39,242,29,155,188,148,67,3,248,17,199,246,144,239,62,231,6,195,213,47,200,102,30,215,8,232,234,222,128,82,238,247,132,170,114,172,53,77,106,42,150,26,210,113,90,21,73,116,75,159,208,94,4,24,164,236,194,224,65,110,15,81,203,204,36,145,175,80,161,244,112,57,153,124,58,133,35,184,180,122,252,2,54,91,37,85,151,49,45,93,250,152,227,138,146,174,5,223,41,16,103,108,186,201,211,0,230,207,225,158,168,44,99,22,1,63,88,226,137,169,13,56,52,27,171,51,255,176,187,72,12,95,185,177,205,46,197,243,219,71,229,165,156,119,10,166,32,104,254,127,193,173],o=[1,2,3,5],s=function(e,t){return e<<t&65535|(65535&e)>>16-t},a=function(e,t){return(65535&e)>>t|e<<16-t&65535};e.exports=n.rc2=n.rc2||{},n.rc2.expandKey=function(e,t){"string"==typeof e&&(e=n.util.createBuffer(e)),t=t||128;var r=e,o=e.length(),s=t,a=Math.ceil(s/8),u=255>>(7&s),c;for(c=o;c<128;c++)r.putByte(i[r.at(c-1)+r.at(c-o)&255]);for(r.setAt(128-a,i[r.at(128-a)&u]),c=127-a;c>=0;c--)r.setAt(c,i[r.at(c+1)^r.at(c+a)]);return r};var u=function(e,t,r){var i=!1,u=null,c=null,f=null,l,h,p,d,y=[];for(e=n.rc2.expandKey(e,t),p=0;p<64;p++)y.push(e.getInt16Le());r?(l=function(e){for(p=0;p<4;p++)e[p]+=y[d]+(e[(p+3)%4]&e[(p+2)%4])+(~e[(p+3)%4]&e[(p+1)%4]),e[p]=s(e[p],o[p]),d++},h=function(e){for(p=0;p<4;p++)e[p]+=y[63&e[(p+3)%4]]}):(l=function(e){for(p=3;p>=0;p--)e[p]=a(e[p],o[p]),e[p]-=y[d]+(e[(p+3)%4]&e[(p+2)%4])+(~e[(p+3)%4]&e[(p+1)%4]),d--},h=function(e){for(p=3;p>=0;p--)e[p]-=y[63&e[(p+3)%4]]});var g=function(e){var t=[];for(p=0;p<4;p++){var n=u.getInt16Le();null!==f&&(r?n^=f.getInt16Le():f.putInt16Le(n)),t.push(65535&n)}d=r?0:63;for(var i=0;i<e.length;i++)for(var o=0;o<e[i][0];o++)e[i][1](t);for(p=0;p<4;p++)null!==f&&(r?f.putInt16Le(t[p]):t[p]^=f.getInt16Le()),c.putInt16Le(t[p])},m=null;return m={start:function(e,t){e&&"string"==typeof e&&(e=n.util.createBuffer(e)),i=!1,u=n.util.createBuffer(),c=t||new n.util.createBuffer,f=e,m.output=c},update:function(e){for(i||u.putBuffer(e);u.length()>=8;)g([[5,l],[1,h],[6,l],[1,h],[5,l]])},finish:function(e){var t=!0;if(r)if(e)t=e(8,u,!r);else{var n=8===u.length()?8:8-u.length();u.fillWithByte(n,n)}if(t&&(i=!0,m.update()),!r&&(t=0===u.length(),t))if(e)t=e(8,c,!r);else{var o=c.length(),s=c.at(o-1);s>o?t=!1:c.truncate(s)}return t}},m};n.rc2.startEncrypting=function(e,t,r){var i=n.rc2.createEncryptionCipher(e,128);return i.start(t,r),i},n.rc2.createEncryptionCipher=function(e,t){return u(e,t,!0)},n.rc2.startDecrypting=function(e,t,r){var i=n.rc2.createDecryptionCipher(e,128);return i.start(t,r),i},n.rc2.createDecryptionCipher=function(e,t){return u(e,t,!1)}},function(e,t,r){var n=r(11);r(16),r(63),r(138);var i=e.exports=n.pkcs1=n.pkcs1||{};function o(e,t,r){r||(r=n.md.sha1.create());for(var i="",o=Math.ceil(t/r.digestLength),s=0;s<o;++s){var a=String.fromCharCode(s>>24&255,s>>16&255,s>>8&255,255&s);r.start(),r.update(e+a),i+=r.digest().getBytes()}return i.substring(0,t)}i.encode_rsa_oaep=function(e,t,r){var i,s,a,u;"string"==typeof r?(i=r,s=arguments[3]||void 0,a=arguments[4]||void 0):r&&(i=r.label||void 0,s=r.seed||void 0,a=r.md||void 0,r.mgf1&&r.mgf1.md&&(u=r.mgf1.md)),a?a.start():a=n.md.sha1.create(),u||(u=a);var c=Math.ceil(e.n.bitLength()/8),f=c-2*a.digestLength-2;if(t.length>f){var l=new Error("RSAES-OAEP input message length is too long.");throw l.length=t.length,l.maxLength=f,l}i||(i=""),a.update(i,"raw");for(var h=a.digest(),p="",d=f-t.length,y=0;y<d;y++)p+="\0";var g=h.getBytes()+p+""+t;if(s){if(s.length!==a.digestLength){var l=new Error("Invalid RSAES-OAEP seed. The seed length must match the digest length.");throw l.seedLength=s.length,l.digestLength=a.digestLength,l}}else s=n.random.getBytes(a.digestLength);var m=o(s,c-a.digestLength-1,u),b=n.util.xorBytes(g,m,g.length),v=o(b,a.digestLength,u),_=n.util.xorBytes(s,v,s.length);return"\0"+_+b},i.decode_rsa_oaep=function(e,t,r){var i,s,a;"string"==typeof r?(i=r,s=arguments[3]||void 0):r&&(i=r.label||void 0,s=r.md||void 0,r.mgf1&&r.mgf1.md&&(a=r.mgf1.md));var u=Math.ceil(e.n.bitLength()/8);if(t.length!==u){var c=new Error("RSAES-OAEP encoded message length is invalid.");throw c.length=t.length,c.expectedLength=u,c}if(void 0===s?s=n.md.sha1.create():s.start(),a||(a=s),u<2*s.digestLength+2)throw new Error("RSAES-OAEP key is too short for the hash function.");i||(i=""),s.update(i,"raw");for(var f=s.digest().getBytes(),l=t.charAt(0),h=t.substring(1,s.digestLength+1),p=t.substring(1+s.digestLength),d=o(p,s.digestLength,a),y=n.util.xorBytes(h,d,h.length),g=o(y,u-s.digestLength-1,a),m=n.util.xorBytes(p,g,p.length),b=m.substring(0,s.digestLength),c="\0"!==l,v=0;v<s.digestLength;++v)c|=f.charAt(v)!==b.charAt(v);for(var _=1,w=s.digestLength,S=s.digestLength;S<m.length;S++){var k=m.charCodeAt(S),E=1&k^1,A=_?65534:0;c|=k&A,_&=E,w+=_}if(c||1!==m.charCodeAt(w))throw new Error("Invalid RSAES-OAEP padding.");return m.substring(w+1)}},function(e,t,r){var n=r(11);r(16),r(184),r(63),function(){if(n.prime)e.exports=n.prime;else{var t=e.exports=n.prime=n.prime||{},r=n.jsbn.BigInteger,i=[6,4,2,4,2,4,6,2],o=new r(null);o.fromInt(30);var s=function(e,t){return e|t};t.generateProbablePrime=function(e,t,r){"function"==typeof t&&(r=t,t={}),t=t||{};var i=t.algorithm||"PRIMEINC";"string"==typeof i&&(i={name:i}),i.options=i.options||{};var o=t.prng||n.random,s={nextBytes:function(e){for(var t=o.getBytesSync(e.length),r=0;r<e.length;++r)e[r]=t.charCodeAt(r)}};if("PRIMEINC"===i.name)return a(e,s,i.options,r);throw new Error("Invalid prime generation algorithm: "+i.name)}}function a(e,t,r,n){return"workers"in r?f(e,t,r,n):u(e,t,r,n)}function u(e,t,r,n){var i=l(e,t),o=0,s=h(i.bitLength());"millerRabinTests"in r&&(s=r.millerRabinTests);var a=10;"maxBlockTime"in r&&(a=r.maxBlockTime),c(i,e,t,0,s,a,n)}function c(e,t,r,o,s,a,u){var f=+new Date;do{if(e.bitLength()>t&&(e=l(t,r)),e.isProbablePrime(s))return u(null,e);e.dAddOffset(i[o++%8],0)}while(a<0||+new Date-f<a);n.util.setImmediate(function(){c(e,t,r,o,s,a,u)})}function f(e,t,i,o){if("undefined"==typeof Worker)return u(e,t,i,o);var s=l(e,t),a=i.workers,c=i.workLoad||100,f=30*c/8,h=i.workerScript||"forge/prime.worker.js";if(-1===a)return n.util.estimateCores(function(e,t){e&&(t=2),a=t-1,p()});function p(){a=Math.max(1,a);for(var n=[],i=0;i<a;++i)n[i]=new Worker(h);for(var u=a,i=0;i<a;++i)n[i].addEventListener("message",d);var p=!1;function d(i){if(!p){--u;var a=i.data;if(a.found){for(var h=0;h<n.length;++h)n[h].terminate();return p=!0,o(null,new r(a.prime,16))}s.bitLength()>e&&(s=l(e,t));var d=s.toString(16);i.target.postMessage({hex:d,workLoad:c}),s.dAddOffset(f,0)}}}p()}function l(e,t){var n=new r(e,t),i=e-1;return n.testBit(i)||n.bitwiseTo(r.ONE.shiftLeft(i),s,n),n.dAddOffset(31-n.mod(o).byteValue(),0),n}function h(e){return e<=100?27:e<=150?18:e<=200?15:e<=250?12:e<=300?9:e<=350?8:e<=400?7:e<=500?6:e<=600?5:e<=800?4:e<=1250?3:2}}()},function(e,t,r){var n=r(11);r(77),r(137),r(101),r(449),r(441),r(63),r(183),r(138),r(16),r(259);var i=n.asn1,o=n.pki,s=e.exports=n.pkcs12=n.pkcs12||{},a={name:"ContentInfo",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"ContentInfo.contentType",tagClass:i.Class.UNIVERSAL,type:i.Type.OID,constructed:!1,capture:"contentType"},{name:"ContentInfo.content",tagClass:i.Class.CONTEXT_SPECIFIC,constructed:!0,captureAsn1:"content"}]},u={name:"PFX",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"PFX.version",tagClass:i.Class.UNIVERSAL,type:i.Type.INTEGER,constructed:!1,capture:"version"},a,{name:"PFX.macData",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,optional:!0,captureAsn1:"mac",value:[{name:"PFX.macData.mac",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"PFX.macData.mac.digestAlgorithm",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"PFX.macData.mac.digestAlgorithm.algorithm",tagClass:i.Class.UNIVERSAL,type:i.Type.OID,constructed:!1,capture:"macAlgorithm"},{name:"PFX.macData.mac.digestAlgorithm.parameters",tagClass:i.Class.UNIVERSAL,captureAsn1:"macAlgorithmParameters"}]},{name:"PFX.macData.mac.digest",tagClass:i.Class.UNIVERSAL,type:i.Type.OCTETSTRING,constructed:!1,capture:"macDigest"}]},{name:"PFX.macData.macSalt",tagClass:i.Class.UNIVERSAL,type:i.Type.OCTETSTRING,constructed:!1,capture:"macSalt"},{name:"PFX.macData.iterations",tagClass:i.Class.UNIVERSAL,type:i.Type.INTEGER,constructed:!1,optional:!0,capture:"macIterations"}]}]},c={name:"SafeBag",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"SafeBag.bagId",tagClass:i.Class.UNIVERSAL,type:i.Type.OID,constructed:!1,capture:"bagId"},{name:"SafeBag.bagValue",tagClass:i.Class.CONTEXT_SPECIFIC,constructed:!0,captureAsn1:"bagValue"},{name:"SafeBag.bagAttributes",tagClass:i.Class.UNIVERSAL,type:i.Type.SET,constructed:!0,optional:!0,capture:"bagAttributes"}]},f={name:"Attribute",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"Attribute.attrId",tagClass:i.Class.UNIVERSAL,type:i.Type.OID,constructed:!1,capture:"oid"},{name:"Attribute.attrValues",tagClass:i.Class.UNIVERSAL,type:i.Type.SET,constructed:!0,capture:"values"}]},l={name:"CertBag",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"CertBag.certId",tagClass:i.Class.UNIVERSAL,type:i.Type.OID,constructed:!1,capture:"certId"},{name:"CertBag.certValue",tagClass:i.Class.CONTEXT_SPECIFIC,constructed:!0,value:[{name:"CertBag.certValue[0]",tagClass:i.Class.UNIVERSAL,type:i.Class.OCTETSTRING,constructed:!1,capture:"cert"}]}]};function h(e,t,r,n){for(var i=[],o=0;o<e.length;o++)for(var s=0;s<e[o].safeBags.length;s++){var a=e[o].safeBags[s];void 0!==n&&a.type!==n||(null!==t?void 0!==a.attributes[t]&&a.attributes[t].indexOf(r)>=0&&i.push(a):i.push(a))}return i}function p(e){if(e.composed||e.constructed){for(var t=n.util.createBuffer(),r=0;r<e.value.length;++r)t.putBytes(e.value[r].value);e.composed=e.constructed=!1,e.value=t.getBytes()}return e}function d(e,t,r,n){if(t=i.fromDer(t,r),t.tagClass!==i.Class.UNIVERSAL||t.type!==i.Type.SEQUENCE||!0!==t.constructed)throw new Error("PKCS#12 AuthenticatedSafe expected to be a SEQUENCE OF ContentInfo");for(var s=0;s<t.value.length;s++){var u=t.value[s],c={},f=[];if(!i.validate(u,a,c,f)){var l=new Error("Cannot read ContentInfo.");throw l.errors=f,l}var h={encrypted:!1},d=null,m=c.content.value[0];switch(i.derToOid(c.contentType)){case o.oids.data:if(m.tagClass!==i.Class.UNIVERSAL||m.type!==i.Type.OCTETSTRING)throw new Error("PKCS#12 SafeContents Data is not an OCTET STRING.");d=p(m).value;break;case o.oids.encryptedData:d=y(m,n),h.encrypted=!0;break;default:var l=new Error("Unsupported PKCS#12 contentType.");throw l.contentType=i.derToOid(c.contentType),l}h.safeBags=g(d,r,n),e.safeContents.push(h)}}function y(e,t){var r={},s=[];if(!i.validate(e,n.pkcs7.asn1.encryptedDataValidator,r,s)){var a=new Error("Cannot read EncryptedContentInfo.");throw a.errors=s,a}var u=i.derToOid(r.contentType);if(u!==o.oids.data){var a=new Error("PKCS#12 EncryptedContentInfo ContentType is not Data.");throw a.oid=u,a}u=i.derToOid(r.encAlgorithm);var c=o.pbe.getCipher(u,r.encParameter,t),f=p(r.encryptedContentAsn1),l=n.util.createBuffer(f.value);if(c.update(l),!c.finish())throw new Error("Failed to decrypt PKCS#12 SafeContents.");return c.output.getBytes()}function g(e,t,r){if(!t&&0===e.length)return[];if(e=i.fromDer(e,t),e.tagClass!==i.Class.UNIVERSAL||e.type!==i.Type.SEQUENCE||!0!==e.constructed)throw new Error("PKCS#12 SafeContents expected to be a SEQUENCE OF SafeBag.");for(var n=[],s=0;s<e.value.length;s++){var a=e.value[s],u={},f=[];if(!i.validate(a,c,u,f)){var h=new Error("Cannot read SafeBag.");throw h.errors=f,h}var p={type:i.derToOid(u.bagId),attributes:m(u.bagAttributes)},d,y;n.push(p);var g=u.bagValue.value[0];switch(p.type){case o.oids.pkcs8ShroudedKeyBag:if(g=o.decryptPrivateKeyInfo(g,r),null===g)throw new Error("Unable to decrypt PKCS#8 ShroudedKeyBag, wrong password?");case o.oids.keyBag:try{p.key=o.privateKeyFromAsn1(g)}catch(e){p.key=null,p.asn1=g}continue;case o.oids.certBag:d=l,y=function(){if(i.derToOid(u.certId)!==o.oids.x509Certificate){var e=new Error("Unsupported certificate type, only X.509 supported.");throw e.oid=i.derToOid(u.certId),e}var r=i.fromDer(u.cert,t);try{p.cert=o.certificateFromAsn1(r,!0)}catch(e){p.cert=null,p.asn1=r}};break;default:var h=new Error("Unsupported PKCS#12 SafeBag type.");throw h.oid=p.type,h}if(void 0!==d&&!i.validate(g,d,u,f)){var h=new Error("Cannot read PKCS#12 "+d.name);throw h.errors=f,h}y()}return n}function m(e){var t={};if(void 0!==e)for(var r=0;r<e.length;++r){var n={},s=[];if(!i.validate(e[r],f,n,s)){var a=new Error("Cannot read PKCS#12 BagAttribute.");throw a.errors=s,a}var u=i.derToOid(n.oid);if(void 0!==o.oids[u]){t[o.oids[u]]=[];for(var c=0;c<n.values.length;++c)t[o.oids[u]].push(n.values[c].value)}}return t}s.pkcs12FromAsn1=function(e,t,r){"string"==typeof t?(r=t,t=!0):void 0===t&&(t=!0);var a={},c=[];if(!i.validate(e,u,a,c)){var f=new Error("Cannot read PKCS#12 PFX. ASN.1 object is not an PKCS#12 PFX.");throw f.errors=f,f}var l={version:a.version.charCodeAt(0),safeContents:[],getBags:function(e){var t={},r;return"localKeyId"in e?r=e.localKeyId:"localKeyIdHex"in e&&(r=n.util.hexToBytes(e.localKeyIdHex)),void 0===r&&!("friendlyName"in e)&&"bagType"in e&&(t[e.bagType]=h(l.safeContents,null,null,e.bagType)),void 0!==r&&(t.localKeyId=h(l.safeContents,"localKeyId",r,e.bagType)),"friendlyName"in e&&(t.friendlyName=h(l.safeContents,"friendlyName",e.friendlyName,e.bagType)),t},getBagsByFriendlyName:function(e,t){return h(l.safeContents,"friendlyName",e,t)},getBagsByLocalKeyId:function(e,t){return h(l.safeContents,"localKeyId",e,t)}};if(3!==a.version.charCodeAt(0)){var f=new Error("PKCS#12 PFX of version other than 3 not supported.");throw f.version=a.version.charCodeAt(0),f}if(i.derToOid(a.contentType)!==o.oids.data){var f=new Error("Only PKCS#12 PFX in password integrity mode supported.");throw f.oid=i.derToOid(a.contentType),f}var y=a.content.value[0];if(y.tagClass!==i.Class.UNIVERSAL||y.type!==i.Type.OCTETSTRING)throw new Error("PKCS#12 authSafe content data is not an OCTET STRING.");if(y=p(y),a.mac){var g=null,m=0,b=i.derToOid(a.macAlgorithm);switch(b){case o.oids.sha1:g=n.md.sha1.create(),m=20;break;case o.oids.sha256:g=n.md.sha256.create(),m=32;break;case o.oids.sha384:g=n.md.sha384.create(),m=48;break;case o.oids.sha512:g=n.md.sha512.create(),m=64;break;case o.oids.md5:g=n.md.md5.create(),m=16}if(null===g)throw new Error("PKCS#12 uses unsupported MAC algorithm: "+b);var v=new n.util.ByteBuffer(a.macSalt),_="macIterations"in a?parseInt(n.util.bytesToHex(a.macIterations),16):1,w=s.generateKey(r,v,3,_,m,g),S=n.hmac.create();S.start(g,w),S.update(y.value);var k=S.getMac();if(k.getBytes()!==a.macDigest)throw new Error("PKCS#12 MAC could not be verified. Invalid password?")}return d(l,y.value,t,r),l},s.toPkcs12Asn1=function(e,t,r,a){a=a||{},a.saltSize=a.saltSize||8,a.count=a.count||2048,a.algorithm=a.algorithm||a.encAlgorithm||"aes128","useMac"in a||(a.useMac=!0),"localKeyId"in a||(a.localKeyId=null),"generateLocalKeyId"in a||(a.generateLocalKeyId=!0);var u=a.localKeyId,c;if(null!==u)u=n.util.hexToBytes(u);else if(a.generateLocalKeyId)if(t){var f=n.util.isArray(t)?t[0]:t;"string"==typeof f&&(f=o.certificateFromPem(f));var l=n.md.sha1.create();l.update(i.toDer(o.certificateToAsn1(f)).getBytes()),u=l.digest().getBytes()}else u=n.random.getBytes(20);var h=[];null!==u&&h.push(i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[i.create(i.Class.UNIVERSAL,i.Type.OID,!1,i.oidToDer(o.oids.localKeyId).getBytes()),i.create(i.Class.UNIVERSAL,i.Type.SET,!0,[i.create(i.Class.UNIVERSAL,i.Type.OCTETSTRING,!1,u)])])),"friendlyName"in a&&h.push(i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[i.create(i.Class.UNIVERSAL,i.Type.OID,!1,i.oidToDer(o.oids.friendlyName).getBytes()),i.create(i.Class.UNIVERSAL,i.Type.SET,!0,[i.create(i.Class.UNIVERSAL,i.Type.BMPSTRING,!1,a.friendlyName)])])),h.length>0&&(c=i.create(i.Class.UNIVERSAL,i.Type.SET,!0,h));var p=[],d=[];null!==t&&(d=n.util.isArray(t)?t:[t]);for(var y=[],g=0;g<d.length;++g){t=d[g],"string"==typeof t&&(t=o.certificateFromPem(t));var m=0===g?c:void 0,b=o.certificateToAsn1(t),v=i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[i.create(i.Class.UNIVERSAL,i.Type.OID,!1,i.oidToDer(o.oids.certBag).getBytes()),i.create(i.Class.CONTEXT_SPECIFIC,0,!0,[i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[i.create(i.Class.UNIVERSAL,i.Type.OID,!1,i.oidToDer(o.oids.x509Certificate).getBytes()),i.create(i.Class.CONTEXT_SPECIFIC,0,!0,[i.create(i.Class.UNIVERSAL,i.Type.OCTETSTRING,!1,i.toDer(b).getBytes())])])]),m]);y.push(v)}if(y.length>0){var _=i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,y),w=i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[i.create(i.Class.UNIVERSAL,i.Type.OID,!1,i.oidToDer(o.oids.data).getBytes()),i.create(i.Class.CONTEXT_SPECIFIC,0,!0,[i.create(i.Class.UNIVERSAL,i.Type.OCTETSTRING,!1,i.toDer(_).getBytes())])]);p.push(w)}var S=null;if(null!==e){var k=o.wrapRsaPrivateKey(o.privateKeyToAsn1(e));S=null===r?i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[i.create(i.Class.UNIVERSAL,i.Type.OID,!1,i.oidToDer(o.oids.keyBag).getBytes()),i.create(i.Class.CONTEXT_SPECIFIC,0,!0,[k]),c]):i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[i.create(i.Class.UNIVERSAL,i.Type.OID,!1,i.oidToDer(o.oids.pkcs8ShroudedKeyBag).getBytes()),i.create(i.Class.CONTEXT_SPECIFIC,0,!0,[o.encryptPrivateKeyInfo(k,r,a)]),c]);var E=i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[S]),A=i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[i.create(i.Class.UNIVERSAL,i.Type.OID,!1,i.oidToDer(o.oids.data).getBytes()),i.create(i.Class.CONTEXT_SPECIFIC,0,!0,[i.create(i.Class.UNIVERSAL,i.Type.OCTETSTRING,!1,i.toDer(E).getBytes())])]);p.push(A)}var x=i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,p),I;if(a.useMac){var l=n.md.sha1.create(),T=new n.util.ByteBuffer(n.random.getBytes(a.saltSize)),B=a.count,e=s.generateKey(r,T,3,B,20),C=n.hmac.create();C.start(l,e),C.update(i.toDer(x).getBytes());var P=C.getMac();I=i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[i.create(i.Class.UNIVERSAL,i.Type.OID,!1,i.oidToDer(o.oids.sha1).getBytes()),i.create(i.Class.UNIVERSAL,i.Type.NULL,!1,"")]),i.create(i.Class.UNIVERSAL,i.Type.OCTETSTRING,!1,P.getBytes())]),i.create(i.Class.UNIVERSAL,i.Type.OCTETSTRING,!1,T.getBytes()),i.create(i.Class.UNIVERSAL,i.Type.INTEGER,!1,i.integerToDer(B).getBytes())])}return i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[i.create(i.Class.UNIVERSAL,i.Type.INTEGER,!1,i.integerToDer(3).getBytes()),i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[i.create(i.Class.UNIVERSAL,i.Type.OID,!1,i.oidToDer(o.oids.data).getBytes()),i.create(i.Class.CONTEXT_SPECIFIC,0,!0,[i.create(i.Class.UNIVERSAL,i.Type.OCTETSTRING,!1,i.toDer(x).getBytes())])]),I])},s.generateKey=n.pbe.generatePkcs12Key},function(e,t,r){var n=r(11);r(77),r(16);var i=n.asn1,o=e.exports=n.pkcs7asn1=n.pkcs7asn1||{};n.pkcs7=n.pkcs7||{},n.pkcs7.asn1=o;var s={name:"ContentInfo",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"ContentInfo.ContentType",tagClass:i.Class.UNIVERSAL,type:i.Type.OID,constructed:!1,capture:"contentType"},{name:"ContentInfo.content",tagClass:i.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,optional:!0,captureAsn1:"content"}]};o.contentInfoValidator=s;var a={name:"EncryptedContentInfo",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"EncryptedContentInfo.contentType",tagClass:i.Class.UNIVERSAL,type:i.Type.OID,constructed:!1,capture:"contentType"},{name:"EncryptedContentInfo.contentEncryptionAlgorithm",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"EncryptedContentInfo.contentEncryptionAlgorithm.algorithm",tagClass:i.Class.UNIVERSAL,type:i.Type.OID,constructed:!1,capture:"encAlgorithm"},{name:"EncryptedContentInfo.contentEncryptionAlgorithm.parameter",tagClass:i.Class.UNIVERSAL,captureAsn1:"encParameter"}]},{name:"EncryptedContentInfo.encryptedContent",tagClass:i.Class.CONTEXT_SPECIFIC,type:0,capture:"encryptedContent",captureAsn1:"encryptedContentAsn1"}]};o.envelopedDataValidator={name:"EnvelopedData",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"EnvelopedData.Version",tagClass:i.Class.UNIVERSAL,type:i.Type.INTEGER,constructed:!1,capture:"version"},{name:"EnvelopedData.RecipientInfos",tagClass:i.Class.UNIVERSAL,type:i.Type.SET,constructed:!0,captureAsn1:"recipientInfos"}].concat(a)},o.encryptedDataValidator={name:"EncryptedData",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"EncryptedData.Version",tagClass:i.Class.UNIVERSAL,type:i.Type.INTEGER,constructed:!1,capture:"version"}].concat(a)};var u={name:"SignerInfo",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"SignerInfo.version",tagClass:i.Class.UNIVERSAL,type:i.Type.INTEGER,constructed:!1},{name:"SignerInfo.issuerAndSerialNumber",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"SignerInfo.issuerAndSerialNumber.issuer",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,captureAsn1:"issuer"},{name:"SignerInfo.issuerAndSerialNumber.serialNumber",tagClass:i.Class.UNIVERSAL,type:i.Type.INTEGER,constructed:!1,capture:"serial"}]},{name:"SignerInfo.digestAlgorithm",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"SignerInfo.digestAlgorithm.algorithm",tagClass:i.Class.UNIVERSAL,type:i.Type.OID,constructed:!1,capture:"digestAlgorithm"},{name:"SignerInfo.digestAlgorithm.parameter",tagClass:i.Class.UNIVERSAL,constructed:!1,captureAsn1:"digestParameter",optional:!0}]},{name:"SignerInfo.authenticatedAttributes",tagClass:i.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,optional:!0,capture:"authenticatedAttributes"},{name:"SignerInfo.digestEncryptionAlgorithm",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,capture:"signatureAlgorithm"},{name:"SignerInfo.encryptedDigest",tagClass:i.Class.UNIVERSAL,type:i.Type.OCTETSTRING,constructed:!1,capture:"signature"},{name:"SignerInfo.unauthenticatedAttributes",tagClass:i.Class.CONTEXT_SPECIFIC,type:1,constructed:!0,optional:!0,capture:"unauthenticatedAttributes"}]};o.signedDataValidator={name:"SignedData",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"SignedData.Version",tagClass:i.Class.UNIVERSAL,type:i.Type.INTEGER,constructed:!1,capture:"version"},{name:"SignedData.DigestAlgorithms",tagClass:i.Class.UNIVERSAL,type:i.Type.SET,constructed:!0,captureAsn1:"digestAlgorithms"},s,{name:"SignedData.Certificates",tagClass:i.Class.CONTEXT_SPECIFIC,type:0,optional:!0,captureAsn1:"certificates"},{name:"SignedData.CertificateRevocationLists",tagClass:i.Class.CONTEXT_SPECIFIC,type:1,optional:!0,captureAsn1:"crls"},{name:"SignedData.SignerInfos",tagClass:i.Class.UNIVERSAL,type:i.Type.SET,capture:"signerInfos",optional:!0,value:[u]}]},o.recipientInfoValidator={name:"RecipientInfo",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"RecipientInfo.version",tagClass:i.Class.UNIVERSAL,type:i.Type.INTEGER,constructed:!1,capture:"version"},{name:"RecipientInfo.issuerAndSerial",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"RecipientInfo.issuerAndSerial.issuer",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,captureAsn1:"issuer"},{name:"RecipientInfo.issuerAndSerial.serialNumber",tagClass:i.Class.UNIVERSAL,type:i.Type.INTEGER,constructed:!1,capture:"serial"}]},{name:"RecipientInfo.keyEncryptionAlgorithm",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"RecipientInfo.keyEncryptionAlgorithm.algorithm",tagClass:i.Class.UNIVERSAL,type:i.Type.OID,constructed:!1,capture:"encAlgorithm"},{name:"RecipientInfo.keyEncryptionAlgorithm.parameter",tagClass:i.Class.UNIVERSAL,constructed:!1,captureAsn1:"encParameter"}]},{name:"RecipientInfo.encryptedKey",tagClass:i.Class.UNIVERSAL,type:i.Type.OCTETSTRING,constructed:!1,capture:"encKey"}]}},function(e,t,r){var n=r(11);r(16),n.mgf=n.mgf||{};var i=e.exports=n.mgf.mgf1=n.mgf1=n.mgf1||{};i.create=function(e){var t={generate:function(t,r){for(var i=new n.util.ByteBuffer,o=Math.ceil(r/e.digestLength),s=0;s<o;s++){var a=new n.util.ByteBuffer;a.putInt32(s),e.start(),e.update(t+a.getBytes()),i.putBuffer(e.digest())}return i.truncate(i.length()-r),i.getBytes()}};return t}},function(e,t,r){var n=r(11);e.exports=n.debug=n.debug||{},n.debug.storage={},n.debug.get=function(e,t){var r;return void 0===e?r=n.debug.storage:e in n.debug.storage&&(r=void 0===t?n.debug.storage[e]:n.debug.storage[e][t]),r},n.debug.set=function(e,t,r){e in n.debug.storage||(n.debug.storage[e]={}),n.debug.storage[e][t]=r},n.debug.clear=function(e,t){void 0===e?n.debug.storage={}:e in n.debug.storage&&(void 0===t?delete n.debug.storage[e]:delete n.debug.storage[e][t])}},function(e,t,r){var n=r(11);r(78),r(16);var i=e.exports=n.sha512=n.sha512||{};n.md.sha512=n.md.algorithms.sha512=i;var o=n.sha384=n.sha512.sha384=n.sha512.sha384||{};o.create=function(){return i.create("SHA-384")},n.md.sha384=n.md.algorithms.sha384=o,n.sha512.sha256=n.sha512.sha256||{create:function(){return i.create("SHA-512/256")}},n.md["sha512/256"]=n.md.algorithms["sha512/256"]=n.sha512.sha256,n.sha512.sha224=n.sha512.sha224||{create:function(){return i.create("SHA-512/224")}},n.md["sha512/224"]=n.md.algorithms["sha512/224"]=n.sha512.sha224,i.create=function(e){if(a||f(),void 0===e&&(e="SHA-512"),!(e in c))throw new Error("Invalid SHA-512 algorithm: "+e);for(var t=c[e],r=null,i=n.util.createBuffer(),o=new Array(80),u=0;u<80;++u)o[u]=new Array(2);var h=64;switch(e){case"SHA-384":h=48;break;case"SHA-512/256":h=32;break;case"SHA-512/224":h=28}var p={algorithm:e.replace("-","").toLowerCase(),blockLength:128,digestLength:h,messageLength:0,fullMessageLength:null,messageLengthSize:16,start:function(){p.messageLength=0,p.fullMessageLength=p.messageLength128=[];for(var e=p.messageLengthSize/4,o=0;o<e;++o)p.fullMessageLength.push(0);i=n.util.createBuffer(),r=new Array(t.length);for(var o=0;o<t.length;++o)r[o]=t[o].slice(0);return p}};return p.start(),p.update=function(e,t){"utf8"===t&&(e=n.util.encodeUtf8(e));var s=e.length;p.messageLength+=s,s=[s/4294967296>>>0,s>>>0];for(var a=p.fullMessageLength.length-1;a>=0;--a)p.fullMessageLength[a]+=s[1],s[1]=s[0]+(p.fullMessageLength[a]/4294967296>>>0),p.fullMessageLength[a]=p.fullMessageLength[a]>>>0,s[0]=s[1]/4294967296>>>0;return i.putBytes(e),l(r,o,i),(i.read>2048||0===i.length())&&i.compact(),p},p.digest=function(){var t=n.util.createBuffer();t.putBytes(i.bytes());var a=p.fullMessageLength[p.fullMessageLength.length-1]+p.messageLengthSize,u=a&p.blockLength-1,c,f;t.putBytes(s.substr(0,p.blockLength-u));for(var h=8*p.fullMessageLength[0],d=0;d<p.fullMessageLength.length-1;++d)c=8*p.fullMessageLength[d+1],f=c/4294967296>>>0,h+=f,t.putInt32(h>>>0),h=c>>>0;t.putInt32(h);for(var y=new Array(r.length),d=0;d<r.length;++d)y[d]=r[d].slice(0);l(y,o,t);var g=n.util.createBuffer(),m;m="SHA-512"===e?y.length:"SHA-384"===e?y.length-2:y.length-4;for(var d=0;d<m;++d)g.putInt32(y[d][0]),d===m-1&&"SHA-512/224"===e||g.putInt32(y[d][1]);return g},p};var s=null,a=!1,u=null,c=null;function f(){s=String.fromCharCode(128),s+=n.util.fillString(String.fromCharCode(0),128),u=[[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]],c={},c["SHA-512"]=[[1779033703,4089235720],[3144134277,2227873595],[1013904242,4271175723],[2773480762,1595750129],[1359893119,2917565137],[2600822924,725511199],[528734635,4215389547],[1541459225,327033209]],c["SHA-384"]=[[3418070365,3238371032],[1654270250,914150663],[2438529370,812702999],[355462360,4144912697],[1731405415,4290775857],[2394180231,1750603025],[3675008525,1694076839],[1203062813,3204075428]],c["SHA-512/256"]=[[573645204,4230739756],[2673172387,3360449730],[596883563,1867755857],[2520282905,1497426621],[2519219938,2827943907],[3193839141,1401305490],[721525244,746961066],[246885852,2177182882]],c["SHA-512/224"]=[[2352822216,424955298],[1944164710,2312950998],[502970286,855612546],[1738396948,1479516111],[258812777,2077511080],[2011393907,79989058],[1067287976,1780299464],[286451373,2446758561]],a=!0}function l(e,t,r){for(var n,i,o,s,a,c,f,l,h,p,d,y,g,m,b,v,_,w,S,k,E,A,x,I,T,B,C,P,O,R,N,L,j,M,K,D=r.length();D>=128;){for(O=0;O<16;++O)t[O][0]=r.getInt32()>>>0,t[O][1]=r.getInt32()>>>0;for(;O<80;++O)L=t[O-2],R=L[0],N=L[1],n=((R>>>19|N<<13)^(N>>>29|R<<3)^R>>>6)>>>0,i=((R<<13|N>>>19)^(N<<3|R>>>29)^(R<<26|N>>>6))>>>0,M=t[O-15],R=M[0],N=M[1],o=((R>>>1|N<<31)^(R>>>8|N<<24)^R>>>7)>>>0,s=((R<<31|N>>>1)^(R<<24|N>>>8)^(R<<25|N>>>7))>>>0,j=t[O-7],K=t[O-16],N=i+j[1]+s+K[1],t[O][0]=n+j[0]+o+K[0]+(N/4294967296>>>0)>>>0,t[O][1]=N>>>0;for(g=e[0][0],m=e[0][1],b=e[1][0],v=e[1][1],_=e[2][0],w=e[2][1],S=e[3][0],k=e[3][1],E=e[4][0],A=e[4][1],x=e[5][0],I=e[5][1],T=e[6][0],B=e[6][1],C=e[7][0],P=e[7][1],O=0;O<80;++O)f=((E>>>14|A<<18)^(E>>>18|A<<14)^(A>>>9|E<<23))>>>0,l=((E<<18|A>>>14)^(E<<14|A>>>18)^(A<<23|E>>>9))>>>0,h=(T^E&(x^T))>>>0,p=(B^A&(I^B))>>>0,a=((g>>>28|m<<4)^(m>>>2|g<<30)^(m>>>7|g<<25))>>>0,c=((g<<4|m>>>28)^(m<<30|g>>>2)^(m<<25|g>>>7))>>>0,d=(g&b|_&(g^b))>>>0,y=(m&v|w&(m^v))>>>0,N=P+l+p+u[O][1]+t[O][1],n=C+f+h+u[O][0]+t[O][0]+(N/4294967296>>>0)>>>0,i=N>>>0,N=c+y,o=a+d+(N/4294967296>>>0)>>>0,s=N>>>0,C=T,P=B,T=x,B=I,x=E,I=A,N=k+i,E=S+n+(N/4294967296>>>0)>>>0,A=N>>>0,S=_,k=w,_=b,w=v,b=g,v=m,N=i+s,g=n+o+(N/4294967296>>>0)>>>0,m=N>>>0;N=e[0][1]+m,e[0][0]=e[0][0]+g+(N/4294967296>>>0)>>>0,e[0][1]=N>>>0,N=e[1][1]+v,e[1][0]=e[1][0]+b+(N/4294967296>>>0)>>>0,e[1][1]=N>>>0,N=e[2][1]+w,e[2][0]=e[2][0]+_+(N/4294967296>>>0)>>>0,e[2][1]=N>>>0,N=e[3][1]+k,e[3][0]=e[3][0]+S+(N/4294967296>>>0)>>>0,e[3][1]=N>>>0,N=e[4][1]+A,e[4][0]=e[4][0]+E+(N/4294967296>>>0)>>>0,e[4][1]=N>>>0,N=e[5][1]+I,e[5][0]=e[5][0]+x+(N/4294967296>>>0)>>>0,e[5][1]=N>>>0,N=e[6][1]+B,e[6][0]=e[6][0]+T+(N/4294967296>>>0)>>>0,e[6][1]=N>>>0,N=e[7][1]+P,e[7][0]=e[7][0]+C+(N/4294967296>>>0)>>>0,e[7][1]=N>>>0,D-=128}}},function(e,t,r){var n=r(11);r(16),e.exports=n.log=n.log||{},n.log.levels=["none","error","warning","info","debug","verbose","max"];var i={},o=[],s=null;n.log.LEVEL_LOCKED=2,n.log.NO_LEVEL_CHECK=4,n.log.INTERPOLATE=8;for(var a=0;a<n.log.levels.length;++a){var u=n.log.levels[a];i[u]={index:a,name:u.toUpperCase()}}n.log.logMessage=function(e){for(var t=i[e.level].index,r=0;r<o.length;++r){var s=o[r];if(s.flags&n.log.NO_LEVEL_CHECK)s.f(e);else{var a=i[s.level].index;t<=a&&s.f(s,e)}}},n.log.prepareStandard=function(e){"standard"in e||(e.standard=i[e.level].name+" ["+e.category+"] "+e.message)},n.log.prepareFull=function(e){if(!("full"in e)){var t=[e.message];t=t.concat([]||e.arguments),e.full=n.util.format.apply(this,t)}},n.log.prepareStandardFull=function(e){"standardFull"in e||(n.log.prepareStandard(e),e.standardFull=e.standard)};for(var c=["error","warning","info","debug","verbose"],a=0;a<c.length;++a)!function(e){n.log[e]=function(t,r){var i=Array.prototype.slice.call(arguments).slice(2),o={timestamp:new Date,level:e,category:t,message:r,arguments:i};n.log.logMessage(o)}}(c[a]);if(n.log.makeLogger=function(e){var t={flags:0,f:e};return n.log.setLevel(t,"none"),t},n.log.setLevel=function(e,t){var r=!1;if(e&&!(e.flags&n.log.LEVEL_LOCKED))for(var i=0;i<n.log.levels.length;++i){var o=n.log.levels[i];if(t==o){e.level=t,r=!0;break}}return r},n.log.lock=function(e,t){void 0===t||t?e.flags|=n.log.LEVEL_LOCKED:e.flags&=~n.log.LEVEL_LOCKED},n.log.addLogger=function(e){o.push(e)},"undefined"!=typeof console&&"log"in console){var f;if(console.error&&console.warn&&console.info&&console.debug){var l={error:console.error,warning:console.warn,info:console.info,debug:console.debug,verbose:console.debug},h=function(e,t){n.log.prepareStandard(t);var r=l[t.level],i=[t.standard];i=i.concat(t.arguments.slice()),r.apply(console,i)};f=n.log.makeLogger(h)}else{var h=function(e,t){n.log.prepareStandardFull(t),console.log(t.standardFull)};f=n.log.makeLogger(h)}n.log.setLevel(f,"debug"),n.log.addLogger(f),s=f}else console={log:function(){}};if(null!==s){var p=n.util.getQueryVariables();if("console.level"in p&&n.log.setLevel(s,p["console.level"].slice(-1)[0]),"console.lock"in p){var d=p["console.lock"].slice(-1)[0];"true"==d&&n.log.lock(s)}}n.log.consoleLogger=s},function(e,t,r){"use strict";(function(t){const n=r(14),i=r(906);function o(e,t,r,i){if("function"==typeof r&&(i=r,r=void 0),!i)throw new Error("Missing callback");o.digest(e,t,r,(e,o)=>{if(e)return i(e);i(null,n.encode(o,t,r))})}e.exports=o,o.Buffer=t,o.multihash=n,o.digest=function(e,t,r,n){if("function"==typeof r&&(n=r,r=void 0),!n)throw new Error("Missing callback");let i=n,s;r&&(i=((e,t)=>{if(e)return n(e);n(null,t.slice(0,r))}));try{s=o.createHash(t)}catch(e){return i(e)}s(e,i)},o.createHash=function(e){if(e=n.coerceCode(e),!o.functions[e])throw new Error("multihash function "+e+" not yet supported");return o.functions[e]},o.functions={17:i.sha1,18:i.sha2256,19:i.sha2512,20:i.sha3512,21:i.sha3384,22:i.sha3256,23:i.sha3224,24:i.shake128,25:i.shake256,26:i.keccak224,27:i.keccak256,28:i.keccak384,29:i.keccak512,34:i.murmur3128,35:i.murmur332,86:i.dblSha2256},i.addBlake(o.functions)}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(e){const n=r(3);t.toCallback=(e=>(function(t,r){const i=(e,t)=>n(()=>{r(e,t)});let o;try{o=e(t)}catch(e){return void i(e)}i(null,o)})),t.toBuf=((t,r)=>n=>{let i=t(n,r);return e.from(i,"hex")}),t.fromString=((t,r)=>n=>{const i=e.isBuffer(n)?n.toString():n;return t(i,r)}),t.fromNumberTo32BitBuf=((t,r)=>n=>{let i=t(n,r);const o=new Array(4);for(let e=0;e<4;e++)o[e]=255&i,i>>=8;return e.from(o)})}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(e){const n=r(253),i=r(254)();function o(e){return Promise.all([i.subtle.exportKey("jwk",e.privateKey),i.subtle.exportKey("jwk",e.publicKey)])}function s(e){return i.subtle.importKey("jwk",{kty:e.kty,n:e.n,e:e.e},{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}},!0,["verify"])}t.utils=r(909),t.generateKey=function(e,t){n(i.subtle.generateKey({name:"RSASSA-PKCS1-v1_5",modulusLength:e,publicExponent:new Uint8Array([1,0,1]),hash:{name:"SHA-256"}},!0,["sign","verify"]).then(o).then(e=>({privateKey:e[0],publicKey:e[1]})),t)},t.unmarshalPrivateKey=function(e,t){const r=i.subtle.importKey("jwk",e,{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}},!0,["sign"]);n(Promise.all([r,s(e)]).then(e=>o({privateKey:e[0],publicKey:e[1]})).then(e=>({privateKey:e[0],publicKey:e[1]})),t)},t.getRandomValues=function(t){return e.from(i.getRandomValues(t))},t.hashAndSign=function(t,r,o){n(i.subtle.importKey("jwk",t,{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}},!1,["sign"]).then(e=>i.subtle.sign({name:"RSASSA-PKCS1-v1_5"},e,Uint8Array.from(r))).then(t=>e.from(t)),o)},t.hashAndVerify=function(e,t,r,o){n(i.subtle.importKey("jwk",e,{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}},!1,["verify"]).then(e=>i.subtle.verify({name:"RSASSA-PKCS1-v1_5"},e,t,r)),o)}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";const n=r(4),i=r(139).Reporter,o=r(0).Buffer;function s(e,t){i.call(this,t),o.isBuffer(e)?(this.base=e,this.offset=0,this.length=e.length):this.error("Input not Buffer")}function a(e,t){if(Array.isArray(e))this.length=0,this.value=e.map(function(e){return e instanceof a||(e=new a(e,t)),this.length+=e.length,e},this);else if("number"==typeof e){if(!(0<=e&&e<=255))return t.error("non-byte EncoderBuffer value");this.value=e,this.length=1}else if("string"==typeof e)this.value=e,this.length=o.byteLength(e);else{if(!o.isBuffer(e))return t.error("Unsupported type: "+typeof e);this.value=e,this.length=e.length}}n(s,i),t.DecoderBuffer=s,s.prototype.save=function e(){return{offset:this.offset,reporter:i.prototype.save.call(this)}},s.prototype.restore=function e(t){const r=new s(this.base);return r.offset=t.offset,r.length=this.offset,this.offset=t.offset,i.prototype.restore.call(this,t.reporter),r},s.prototype.isEmpty=function e(){return this.offset===this.length},s.prototype.readUInt8=function e(t){return this.offset+1<=this.length?this.base.readUInt8(this.offset++,!0):this.error(t||"DecoderBuffer overrun")},s.prototype.skip=function e(t,r){if(!(this.offset+t<=this.length))return this.error(r||"DecoderBuffer overrun");const n=new s(this.base);return n._reporterState=this._reporterState,n.offset=this.offset,n.length=this.offset+t,this.offset+=t,n},s.prototype.raw=function e(t){return this.base.slice(t?t.offset:this.offset,this.length)},t.EncoderBuffer=a,a.prototype.join=function e(t,r){return t||(t=new o(this.length)),r||(r=0),0===this.length?t:(Array.isArray(this.value)?this.value.forEach(function(e){e.join(t,r),r+=e.length}):("number"==typeof this.value?t[r]=this.value:"string"==typeof this.value?t.write(this.value,r):o.isBuffer(this.value)&&this.value.copy(t,r),r+=this.length),t)}},function(e,t,r){"use strict";const n=t;n._reverse=function e(t){const r={};return Object.keys(t).forEach(function(e){(0|e)==e&&(e|=0);const n=t[e];r[n]=e}),r},n.der=r(914)},function(e,t,r){"use strict";const n=r(4),i=r(17),o=i.base,s=i.bignum,a=i.constants.der;function u(e){this.enc="der",this.name=e.name,this.entity=e,this.tree=new c,this.tree._init(e.body)}function c(e){o.Node.call(this,"der",e)}function f(e,t){let r=e.readUInt8(t);if(e.isError(r))return r;const n=a.tagClass[r>>6],i=0==(32&r);if(31==(31&r)){let n=r;for(r=0;128==(128&n);){if(n=e.readUInt8(t),e.isError(n))return n;r<<=7,r|=127&n}}else r&=31;const o=a.tag[r];return{cls:n,primitive:i,tag:r,tagStr:o}}function l(e,t,r){let n=e.readUInt8(r);if(e.isError(n))return n;if(!t&&128===n)return null;if(0==(128&n))return n;const i=127&n;if(i>4)return e.error("length octect is too long");n=0;for(let t=0;t<i;t++){n<<=8;const t=e.readUInt8(r);if(e.isError(t))return t;n|=t}return n}e.exports=u,u.prototype.decode=function e(t,r){return t instanceof o.DecoderBuffer||(t=new o.DecoderBuffer(t,r)),this.tree._decode(t,r)},n(c,o.Node),c.prototype._peekTag=function e(t,r,n){if(t.isEmpty())return!1;const i=t.save(),o=f(t,'Failed to peek tag: "'+r+'"');return t.isError(o)?o:(t.restore(i),o.tag===r||o.tagStr===r||o.tagStr+"of"===r||n)},c.prototype._decodeTag=function e(t,r,n){const i=f(t,'Failed to decode tag of "'+r+'"');if(t.isError(i))return i;let o=l(t,i.primitive,'Failed to get length of "'+r+'"');if(t.isError(o))return o;if(!n&&i.tag!==r&&i.tagStr!==r&&i.tagStr+"of"!==r)return t.error('Failed to match tag: "'+r+'"');if(i.primitive||null!==o)return t.skip(o,'Failed to match body of: "'+r+'"');const s=t.save(),a=this._skipUntilEnd(t,'Failed to skip indefinite length body: "'+this.tag+'"');return t.isError(a)?a:(o=t.offset-s.offset,t.restore(s),t.skip(o,'Failed to match body of: "'+r+'"'))},c.prototype._skipUntilEnd=function e(t,r){for(;;){const e=f(t,r);if(t.isError(e))return e;const n=l(t,e.primitive,r);if(t.isError(n))return n;let i;if(i=e.primitive||null!==n?t.skip(n):this._skipUntilEnd(t,r),t.isError(i))return i;if("end"===e.tagStr)break}},c.prototype._decodeList=function e(t,r,n,i){const o=[];for(;!t.isEmpty();){const e=this._peekTag(t,"end");if(t.isError(e))return e;const r=n.decode(t,"der",i);if(t.isError(r)&&e)break;o.push(r)}return o},c.prototype._decodeStr=function e(t,r){if("bitstr"===r){const e=t.readUInt8();return t.isError(e)?e:{unused:e,data:t.raw()}}if("bmpstr"===r){const e=t.raw();if(e.length%2==1)return t.error("Decoding of string type: bmpstr length mismatch");let r="";for(let t=0;t<e.length/2;t++)r+=String.fromCharCode(e.readUInt16BE(2*t));return r}if("numstr"===r){const e=t.raw().toString("ascii");return this._isNumstr(e)?e:t.error("Decoding of string type: numstr unsupported characters")}if("octstr"===r)return t.raw();if("objDesc"===r)return t.raw();if("printstr"===r){const e=t.raw().toString("ascii");return this._isPrintstr(e)?e:t.error("Decoding of string type: printstr unsupported characters")}return/str$/.test(r)?t.raw().toString():t.error("Decoding of string type: "+r+" unsupported")},c.prototype._decodeObjid=function e(t,r,n){let i;const o=[];let s=0,a=0;for(;!t.isEmpty();)a=t.readUInt8(),s<<=7,s|=127&a,0==(128&a)&&(o.push(s),s=0);128&a&&o.push(s);const u=o[0]/40|0,c=o[0]%40;if(i=n?o:[u,c].concat(o.slice(1)),r){let e=r[i.join(" ")];void 0===e&&(e=r[i.join(".")]),void 0!==e&&(i=e)}return i},c.prototype._decodeTime=function e(t,r){const n=t.raw().toString();let i,o,s,a,u,c;if("gentime"===r)i=0|n.slice(0,4),o=0|n.slice(4,6),s=0|n.slice(6,8),a=0|n.slice(8,10),u=0|n.slice(10,12),c=0|n.slice(12,14);else{if("utctime"!==r)return t.error("Decoding "+r+" time is not supported yet");i=0|n.slice(0,2),o=0|n.slice(2,4),s=0|n.slice(4,6),a=0|n.slice(6,8),u=0|n.slice(8,10),c=0|n.slice(10,12),i=i<70?2e3+i:1900+i}return Date.UTC(i,o-1,s,a,u,c,0)},c.prototype._decodeNull=function e(){return null},c.prototype._decodeBool=function e(t){const r=t.readUInt8();return t.isError(r)?r:0!==r},c.prototype._decodeInt=function e(t,r){const n=t.raw();let i=new s(n);return r&&(i=r[i.toString(10)]||i),i},c.prototype._use=function e(t,r){return"function"==typeof t&&(t=t(r)),t._getDecoder("der").tree}},function(e,t,r){"use strict";const n=r(4),i=r(0).Buffer,o=r(17),s=o.base,a=o.constants.der;function u(e){this.enc="der",this.name=e.name,this.entity=e,this.tree=new c,this.tree._init(e.body)}function c(e){s.Node.call(this,"der",e)}function f(e){return e<10?"0"+e:e}function l(e,t,r,n){let i;if("seqof"===e?e="seq":"setof"===e&&(e="set"),a.tagByName.hasOwnProperty(e))i=a.tagByName[e];else{if("number"!=typeof e||(0|e)!==e)return n.error("Unknown tag: "+e);i=e}return i>=31?n.error("Multi-octet tag encoding unsupported"):(t||(i|=32),i|=a.tagClassByName[r||"universal"]<<6,i)}e.exports=u,u.prototype.encode=function e(t,r){return this.tree._encode(t,r).join()},n(c,s.Node),c.prototype._encodeComposite=function e(t,r,n,o){const s=l(t,r,n,this.reporter);if(o.length<128){const e=new i(2);return e[0]=s,e[1]=o.length,this._createEncoderBuffer([e,o])}let a=1;for(let e=o.length;e>=256;e>>=8)a++;const u=new i(2+a);u[0]=s,u[1]=128|a;for(let e=1+a,t=o.length;t>0;e--,t>>=8)u[e]=255&t;return this._createEncoderBuffer([u,o])},c.prototype._encodeStr=function e(t,r){if("bitstr"===r)return this._createEncoderBuffer([0|t.unused,t.data]);if("bmpstr"===r){const e=new i(2*t.length);for(let r=0;r<t.length;r++)e.writeUInt16BE(t.charCodeAt(r),2*r);return this._createEncoderBuffer(e)}return"numstr"===r?this._isNumstr(t)?this._createEncoderBuffer(t):this.reporter.error("Encoding of string type: numstr supports only digits and space"):"printstr"===r?this._isPrintstr(t)?this._createEncoderBuffer(t):this.reporter.error("Encoding of string type: printstr supports only latin upper and lower case letters, digits, space, apostrophe, left and rigth parenthesis, plus sign, comma, hyphen, dot, slash, colon, equal sign, question mark"):/str$/.test(r)?this._createEncoderBuffer(t):"objDesc"===r?this._createEncoderBuffer(t):this.reporter.error("Encoding of string type: "+r+" unsupported")},c.prototype._encodeObjid=function e(t,r,n){if("string"==typeof t){if(!r)return this.reporter.error("string objid given, but no values map found");if(!r.hasOwnProperty(t))return this.reporter.error("objid not found in values map");t=r[t].split(/[\s.]+/g);for(let e=0;e<t.length;e++)t[e]|=0}else if(Array.isArray(t)){t=t.slice();for(let e=0;e<t.length;e++)t[e]|=0}if(!Array.isArray(t))return this.reporter.error("objid() should be either array or string, got: "+JSON.stringify(t));if(!n){if(t[1]>=40)return this.reporter.error("Second objid identifier OOB");t.splice(0,2,40*t[0]+t[1])}let o=0;for(let e=0;e<t.length;e++){let r=t[e];for(o++;r>=128;r>>=7)o++}const s=new i(o);let a=s.length-1;for(let e=t.length-1;e>=0;e--){let r=t[e];for(s[a--]=127&r;(r>>=7)>0;)s[a--]=128|127&r}return this._createEncoderBuffer(s)},c.prototype._encodeTime=function e(t,r){let n;const i=new Date(t);return"gentime"===r?n=[f(i.getUTCFullYear()),f(i.getUTCMonth()+1),f(i.getUTCDate()),f(i.getUTCHours()),f(i.getUTCMinutes()),f(i.getUTCSeconds()),"Z"].join(""):"utctime"===r?n=[f(i.getUTCFullYear()%100),f(i.getUTCMonth()+1),f(i.getUTCDate()),f(i.getUTCHours()),f(i.getUTCMinutes()),f(i.getUTCSeconds()),"Z"].join(""):this.reporter.error("Encoding "+r+" time is not supported yet"),this._encodeStr(n,"octstr")},c.prototype._encodeNull=function e(){return this._createEncoderBuffer("")},c.prototype._encodeInt=function e(t,r){if("string"==typeof t){if(!r)return this.reporter.error("String int or enum given, but no values map");if(!r.hasOwnProperty(t))return this.reporter.error("Values map doesn't contain: "+JSON.stringify(t));t=r[t]}if("number"!=typeof t&&!i.isBuffer(t)){const e=t.toArray();!t.sign&&128&e[0]&&e.unshift(0),t=new i(e)}if(i.isBuffer(t)){let e=t.length;0===t.length&&e++;const r=new i(e);return t.copy(r),0===t.length&&(r[0]=0),this._createEncoderBuffer(r)}if(t<128)return this._createEncoderBuffer(t);if(t<256)return this._createEncoderBuffer([0,t]);let n=1;for(let e=t;e>=256;e>>=8)n++;const o=new Array(n);for(let e=o.length-1;e>=0;e--)o[e]=255&t,t>>=8;return 128&o[0]&&o.unshift(0),this._createEncoderBuffer(new i(o))},c.prototype._encodeBool=function e(t){return this._createEncoderBuffer(t?255:0)},c.prototype._use=function e(t,r){return"function"==typeof t&&(t=t(r)),t._getEncoder("der").tree},c.prototype._skipDefault=function e(t,r,n){const i=this._baseState;let o;if(null===i.default)return!1;const s=t.join();if(void 0===i.defaultBuffer&&(i.defaultBuffer=this._encodeValue(i.default,r,n).join()),s.length!==i.defaultBuffer.length)return!1;for(o=0;o<s.length;o++)if(s[o]!==i.defaultBuffer[o])return!1;return!0}},function(e,t,r){"use strict";(function(e){const n=r(17).bignum;t.toBase64=function t(r,n){let i=r.toArrayLike(e,"be",n).toString("base64");return i.replace(/(=*)$/,"").replace(/\+/g,"-").replace(/\//g,"_")},t.toBn=function t(r){return new n(e.from(r,"base64"))}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(t){const n=r(14),i=r(922);function o(e,t,r,i){if("function"==typeof r&&(i=r,r=void 0),!i)throw new Error("Missing callback");o.digest(e,t,r,(e,o)=>{if(e)return i(e);i(null,n.encode(o,t,r))})}e.exports=o,o.Buffer=t,o.multihash=n,o.digest=function(e,t,r,n){if("function"==typeof r&&(n=r,r=void 0),!n)throw new Error("Missing callback");let i=n,s;r&&(i=((e,t)=>{if(e)return n(e);n(null,t.slice(0,r))}));try{s=o.createHash(t)}catch(e){return i(e)}s(e,i)},o.createHash=function(e){if(e=n.coerceCode(e),!o.functions[e])throw new Error("multihash function "+e+" not yet supported");return o.functions[e]},o.functions={17:i.sha1,18:i.sha2256,19:i.sha2512,20:i.sha3512,21:i.sha3384,22:i.sha3256,23:i.sha3224,24:i.shake128,25:i.shake256,26:i.keccak224,27:i.keccak256,28:i.keccak384,29:i.keccak512,34:i.murmur3128,35:i.murmur332,86:i.dblSha2256},i.addBlake(o.functions)}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(e){const n=r(3);t.toCallback=(e=>(function(t,r){const i=(e,t)=>n(()=>{r(e,t)});let o;try{o=e(t)}catch(e){return void i(e)}i(null,o)})),t.toBuf=((t,r)=>n=>{let i=t(n,r);return e.from(i,"hex")}),t.fromString=((t,r)=>n=>{const i=e.isBuffer(n)?n.toString():n;return t(i,r)}),t.fromNumberTo32BitBuf=((t,r)=>n=>{let i=t(n,r);const o=new Array(4);for(let e=0;e<4;e++)o[e]=255&i,i>>=8;return e.from(o)})}).call(this,r(0).Buffer)},function(e,t,r){"use strict";var n=r(2).Buffer,i=r(185),o=r(465);function s(e,t){null===e&&null===t?(this.x=this.y=null,this.inf=!0):(this.x=e,this.y=t,this.inf=!1)}s.fromPublicKey=function(e){var t=e[0],r,n;return 33!==e.length||2!==t&&3!==t?65!==e.length||4!==t&&6!==t&&7!==t?null:(r=i.fromBuffer(e.slice(1,33)),n=i.fromBuffer(e.slice(33,65)),r.ucmp(i.p)>=0||n.ucmp(i.p)>=0?null:6!==t&&7!==t||n.isOdd()===(7===t)?0!==r.redSqr().redMul(r).redIAdd7().ucmp(n.redSqr())?null:new s(r,n):null):(r=i.fromBuffer(e.slice(1,33)),r.ucmp(i.p)>=0?null:(n=r.redSqr().redMul(r).redIAdd7().redSqrt(),null===n?null:(3===t!==n.isOdd()&&(n=n.redNeg()),new s(r,n))))},s.prototype.toPublicKey=function(e){var t=this.x,r=this.y,i;return e?(i=n.alloc(33),i[0]=r.isOdd()?3:2,t.toBuffer().copy(i,1)):(i=n.alloc(65),i[0]=4,t.toBuffer().copy(i,1),r.toBuffer().copy(i,33)),i},s.fromECJPoint=function(e){if(e.inf)return new s(null,null);var t=e.z.redInvm(),r=t.redSqr(),n=e.x.redMul(r),i=e.y.redMul(r).redMul(t);return new s(n,i)},s.prototype.toECJPoint=function(){return this.inf?new o(null,null,null):new o(this.x,this.y,o.one)},s.prototype.neg=function(){return this.inf?this:new s(this.x,this.y.redNeg())},s.prototype.add=function(e){if(this.inf)return e;if(e.inf)return this;if(0===this.x.ucmp(e.x))return 0===this.y.ucmp(e.y)?this.dbl():new s(null,null);var t=this.y.redSub(e.y);t.isZero()||(t=t.redMul(this.x.redSub(e.x).redInvm()));var r=t.redSqr().redISub(this.x).redISub(e.x),n=t.redMul(this.x.redSub(r)).redISub(this.y);return new s(r,n)},s.prototype.dbl=function(){if(this.inf)return this;var e=this.y.redAdd(this.y);if(e.isZero())return new s(null,null);var t=this.x.redSqr(),r=t.redAdd(t).redIAdd(t).redMul(e.redInvm()),n=r.redSqr().redISub(this.x.redAdd(this.x)),i=r.redMul(this.x.redSub(n)).redISub(this.y);return new s(n,i)},s.prototype.mul=function(e){for(var t=this._getNAFPoints(4),r=t.points,n=e.getNAF(t.wnd),i=new o(null,null,null),a=n.length-1;a>=0;a--){for(var u=0;a>=0&&0===n[a];a--,++u);if(a>=0&&(u+=1),i=i.dblp(u),a<0)break;var c=n[a];i=c>0?i.mixedAdd(r[c-1>>1]):i.mixedAdd(r[-c-1>>1].neg())}return s.fromECJPoint(i)},s.prototype._getNAFPoints1=function(){return{wnd:1,points:[this]}},s.prototype._getNAFPoints=function(e){var t=new Array((1<<e)-1);t[0]=this;for(var r=this.dbl(),n=1;n<t.length;++n)t[n]=t[n-1].add(r);return{wnd:e,points:t}},e.exports=s},function(e,t,r){"use strict";var n=r(185);function i(e,t,r){null===e&&null===t&&null===r?(this.x=i.one,this.y=i.one,this.z=i.zero):(this.x=e,this.y=t,this.z=r),this.zOne=this.z===i.one}i.zero=n.fromNumber(0),i.one=n.fromNumber(1),i.prototype.neg=function(){return this.inf?this:new i(this.x,this.y.redNeg(),this.z)},i.prototype.add=function(e){if(this.inf)return e;if(e.inf)return this;var t=e.z.redSqr(),r=this.z.redSqr(),n=this.x.redMul(t),o=e.x.redMul(r),s=this.y.redMul(t).redMul(e.z),a=e.y.redMul(r).redMul(this.z),u=n.redSub(o),c=s.redSub(a);if(u.isZero())return c.isZero()?this.dbl():new i(null,null,null);var f=u.redSqr(),l=n.redMul(f),h=f.redMul(u),p=c.redSqr().redIAdd(h).redISub(l).redISub(l),d=c.redMul(l.redISub(p)).redISub(s.redMul(h)),y=this.z.redMul(e.z).redMul(u);return new i(p,d,y)},i.prototype.mixedAdd=function(e){if(this.inf)return e.toECJPoint();if(e.inf)return this;var t=this.z.redSqr(),r=this.x,n=e.x.redMul(t),o=this.y,s=e.y.redMul(t).redMul(this.z),a=r.redSub(n),u=o.redSub(s);if(a.isZero())return u.isZero()?this.dbl():new i(null,null,null);var c=a.redSqr(),f=r.redMul(c),l=c.redMul(a),h=u.redSqr().redIAdd(l).redISub(f).redISub(f),p=u.redMul(f.redISub(h)).redISub(o.redMul(l)),d=this.z.redMul(a);return new i(h,p,d)},i.prototype.dbl=function(){if(this.inf)return this;var e,t,r;if(this.zOne){var n=this.x.redSqr(),o=this.y.redSqr(),s=o.redSqr(),a=this.x.redAdd(o).redSqr().redISub(n).redISub(s);a=a.redIAdd(a);var u=n.redAdd(n).redIAdd(n),c=u.redSqr().redISub(a).redISub(a),f=s.redIAdd(s).redIAdd(s).redIAdd(s);e=c,t=u.redMul(a.redISub(c)).redISub(f),r=this.y.redAdd(this.y)}else{var l=this.x.redSqr(),h=this.y.redSqr(),p=h.redSqr(),d=this.x.redAdd(h).redSqr().redISub(l).redISub(p);d=d.redIAdd(d);var y=l.redAdd(l).redIAdd(l),g=y.redSqr(),m=p.redIAdd(p).redIAdd(p).redIAdd(p);e=g.redISub(d).redISub(d),t=y.redMul(d.redISub(e)).redISub(m),r=this.y.redMul(this.z),r=r.redIAdd(r)}return new i(e,t,r)},i.prototype.dblp=function(e){if(0===e||this.inf)return this;for(var t=this,r=0;r<e;r++)t=t.dbl();return t},Object.defineProperty(i.prototype,"inf",{enumerable:!0,get:function(){return this.z.isZero()}}),e.exports=i},function(e,t,r){"use strict";const n=r(456);function i(e){if(!e||"number"!=typeof e)throw new Error("first argument must be a Number bigger than 0");return n.getRandomValues(new Uint8Array(e))}e.exports=i},function(e,t,r){"use strict";(function(e){const n=r(262),i=r(263)(),o=r(938),s={SHA1:"SHA-1",SHA256:"SHA-256",SHA512:"SHA-512"},a=(t,r,o)=>{n(i.subtle.sign({name:"HMAC"},t,r).then(t=>e.from(t)),o)};t.create=function(e,t,r){const u=s[e];n(i.subtle.importKey("raw",t,{name:"HMAC",hash:{name:u}},!1,["sign"]).then(t=>({digest(e,r){a(t,e,r)},length:o[e]})),r)}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(t){const n=r(14),i=r(943);function o(e,t,r,i){if("function"==typeof r&&(i=r,r=void 0),!i)throw new Error("Missing callback");o.digest(e,t,r,(e,o)=>{if(e)return i(e);i(null,n.encode(o,t,r))})}e.exports=o,o.Buffer=t,o.multihash=n,o.digest=function(e,t,r,n){if("function"==typeof r&&(n=r,r=void 0),!n)throw new Error("Missing callback");let i=n,s;r&&(i=((e,t)=>{if(e)return n(e);n(null,t.slice(0,r))}));try{s=o.createHash(t)}catch(e){return i(e)}s(e,i)},o.createHash=function(e){if(e=n.coerceCode(e),!o.functions[e])throw new Error("multihash function "+e+" not yet supported");return o.functions[e]},o.functions={17:i.sha1,18:i.sha2256,19:i.sha2512,20:i.sha3512,21:i.sha3384,22:i.sha3256,23:i.sha3224,24:i.shake128,25:i.shake256,26:i.keccak224,27:i.keccak256,28:i.keccak384,29:i.keccak512,34:i.murmur3128,35:i.murmur332,86:i.dblSha2256},i.addBlake(o.functions)}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(e){const n=r(3);t.toCallback=(e=>(function(t,r){const i=(e,t)=>n(()=>{r(e,t)});let o;try{o=e(t)}catch(e){return void i(e)}i(null,o)})),t.toBuf=((t,r)=>n=>{let i=t(n,r);return e.from(i,"hex")}),t.fromString=((t,r)=>n=>{const i=e.isBuffer(n)?n.toString():n;return t(i,r)}),t.fromNumberTo32BitBuf=((t,r)=>n=>{let i=t(n,r);const o=new Array(4);for(let e=0;e<4;e++)o[e]=255&i,i>>=8;return e.from(o)})}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(e){const n=r(262),i=r(263)();function o(e){return Promise.all([i.subtle.exportKey("jwk",e.privateKey),i.subtle.exportKey("jwk",e.publicKey)])}function s(e){return i.subtle.importKey("jwk",{kty:e.kty,n:e.n,e:e.e},{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}},!0,["verify"])}t.utils=r(946),t.generateKey=function(e,t){n(i.subtle.generateKey({name:"RSASSA-PKCS1-v1_5",modulusLength:e,publicExponent:new Uint8Array([1,0,1]),hash:{name:"SHA-256"}},!0,["sign","verify"]).then(o).then(e=>({privateKey:e[0],publicKey:e[1]})),t)},t.unmarshalPrivateKey=function(e,t){const r=i.subtle.importKey("jwk",e,{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}},!0,["sign"]);n(Promise.all([r,s(e)]).then(e=>o({privateKey:e[0],publicKey:e[1]})).then(e=>({privateKey:e[0],publicKey:e[1]})),t)},t.getRandomValues=function(t){return e.from(i.getRandomValues(t))},t.hashAndSign=function(t,r,o){n(i.subtle.importKey("jwk",t,{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}},!1,["sign"]).then(e=>i.subtle.sign({name:"RSASSA-PKCS1-v1_5"},e,Uint8Array.from(r))).then(t=>e.from(t)),o)},t.hashAndVerify=function(e,t,r,o){n(i.subtle.importKey("jwk",e,{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}},!1,["verify"]).then(e=>i.subtle.verify({name:"RSASSA-PKCS1-v1_5"},e,t,r)),o)}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(e){const n=r(17).bignum;t.toBase64=function t(r,n){let i=r.toArrayLike(e,"be",n).toString("base64");return i.replace(/(=*)$/,"").replace(/\+/g,"-").replace(/\//g,"_")},t.toBn=function t(r){return new n(e.from(r,"base64"))}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";const n=r(470);function i(e){if(!e||"number"!=typeof e)throw new Error("first argument must be a Number bigger than 0");return n.getRandomValues(new Uint8Array(e))}e.exports=i},function(e,t,r){"use strict";const n=r(953);function i(e){return n.isMultiaddr(e)?e:n(e)}e.exports={ensureMultiaddr:i}},function(e,t,r){"use strict";var n=r(475).BigInteger,i=r(476),o=r(477),s=r(478),a=r(140).sprintf,u=r(268);function c(e){this.valid=!1,this.address=e,this.groups=u.GROUPS,this.v4=!0,this.subnet="/32",this.subnetMask=32;var t=u.RE_SUBNET_STRING.exec(e);if(t){if(this.parsedSubnet=t[0].replace("/",""),this.subnetMask=parseInt(this.parsedSubnet,10),this.subnet="/"+this.subnetMask,this.subnetMask<0||this.subnetMask>u.BITS)return this.valid=!1,void(this.error="Invalid subnet mask.");e=e.replace(u.RE_SUBNET_STRING,"")}this.addressMinusSuffix=e,this.parsedAddress=this.parse(e)}c.prototype.parse=function(e){var t=e.split(".");return e.match(u.RE_ADDRESS)?this.valid=!0:this.error="Invalid IPv4 address.",t},c.prototype.isValid=function(){return this.valid},c.prototype.correctForm=function(){return this.parsedAddress.map(function(e){return parseInt(e,10)}).join(".")},c.prototype.isCorrect=i.isCorrect(u.BITS),c.fromHex=function(e){var t=o(e.replace(/:/g,""),8,"0"),r=[],n;for(n=0;n<8;n+=2){var i=t.slice(n,n+2);r.push(parseInt(i,16))}return new c(r.join("."))},c.fromInteger=function(e){return c.fromHex(e.toString(16))},c.prototype.toHex=function(){return this.parsedAddress.map(function(e){return a("%02x",parseInt(e,10))}).join(":")},c.prototype.toArray=function(){return this.parsedAddress.map(function(e){return parseInt(e,10)})},c.prototype.toGroup6=function(){var e=[],t;for(t=0;t<u.GROUPS;t+=2){var r=a("%02x%02x",parseInt(this.parsedAddress[t],10),parseInt(this.parsedAddress[t+1],10));e.push(a("%x",parseInt(r,16)))}return e.join(":")},c.prototype.bigInteger=function(){return this.valid?new n(this.parsedAddress.map(function(e){return a("%02x",parseInt(e,10))}).join(""),16):null},c.prototype.startAddress=function(){var e=new n(this.mask()+s(0,u.BITS-this.subnetMask),2);return c.fromBigInteger(e)},c.prototype.endAddress=function(){var e=new n(this.mask()+s(1,u.BITS-this.subnetMask),2);return c.fromBigInteger(e)},c.fromBigInteger=function(e){return c.fromInteger(parseInt(e.toString(),10))},c.prototype.mask=function(e){return void 0===e&&(e=this.subnetMask),this.getBitsBase2(0,e)},c.prototype.getBitsBase2=function(e,t){return this.binaryZeroPad().slice(e,t)},c.prototype.isInSubnet=i.isInSubnet,c.prototype.binaryZeroPad=function(){return o(this.bigInteger().toString(2),u.BITS,"0")},e.exports=c},function(e,t,r){(function(){var r,n=0xdeadbeefcafe,i=!0;function o(e,t,r){null!=e&&("number"==typeof e?this.fromNumber(e,t,r):null==t&&"string"!=typeof e?this.fromString(e,256):this.fromString(e,t))}function s(){return new o(null)}function a(e,t,r,n,i,o){for(;--o>=0;){var s=t*this[e++]+r[n]+i;i=Math.floor(s/67108864),r[n++]=67108863&s}return i}function u(e,t,r,n,i,o){for(var s=32767&t,a=t>>15;--o>=0;){var u=32767&this[e],c=this[e++]>>15,f=a*u+c*s;u=s*u+((32767&f)<<15)+r[n]+(1073741823&i),i=(u>>>30)+(f>>>15)+a*c+(i>>>30),r[n++]=1073741823&u}return i}function c(e,t,r,n,i,o){for(var s=16383&t,a=t>>14;--o>=0;){var u=16383&this[e],c=this[e++]>>14,f=a*u+c*s;u=s*u+((16383&f)<<14)+r[n]+i,i=(u>>28)+(f>>14)+a*c,r[n++]=268435455&u}return i}var f="undefined"!=typeof navigator;f&&"Microsoft Internet Explorer"==navigator.appName?(o.prototype.am=u,r=30):f&&"Netscape"!=navigator.appName?(o.prototype.am=a,r=26):(o.prototype.am=c,r=28),o.prototype.DB=r,o.prototype.DM=(1<<r)-1,o.prototype.DV=1<<r;var l=52;o.prototype.FV=Math.pow(2,52),o.prototype.F1=52-r,o.prototype.F2=2*r-52;var h="0123456789abcdefghijklmnopqrstuvwxyz",p=new Array,d,y;for(d="0".charCodeAt(0),y=0;y<=9;++y)p[d++]=y;for(d="a".charCodeAt(0),y=10;y<36;++y)p[d++]=y;for(d="A".charCodeAt(0),y=10;y<36;++y)p[d++]=y;function g(e){return h.charAt(e)}function m(e,t){var r=p[e.charCodeAt(t)];return null==r?-1:r}function b(e){for(var t=this.t-1;t>=0;--t)e[t]=this[t];e.t=this.t,e.s=this.s}function v(e){this.t=1,this.s=e<0?-1:0,e>0?this[0]=e:e<-1?this[0]=e+this.DV:this.t=0}function _(e){var t=s();return t.fromInt(e),t}function w(e,t){var r;if(16==t)r=4;else if(8==t)r=3;else if(256==t)r=8;else if(2==t)r=1;else if(32==t)r=5;else{if(4!=t)return void this.fromRadix(e,t);r=2}this.t=0,this.s=0;for(var n=e.length,i=!1,s=0;--n>=0;){var a=8==r?255&e[n]:m(e,n);a<0?"-"==e.charAt(n)&&(i=!0):(i=!1,0==s?this[this.t++]=a:s+r>this.DB?(this[this.t-1]|=(a&(1<<this.DB-s)-1)<<s,this[this.t++]=a>>this.DB-s):this[this.t-1]|=a<<s,s+=r,s>=this.DB&&(s-=this.DB))}8==r&&0!=(128&e[0])&&(this.s=-1,s>0&&(this[this.t-1]|=(1<<this.DB-s)-1<<s)),this.clamp(),i&&o.ZERO.subTo(this,this)}function S(){for(var e=this.s&this.DM;this.t>0&&this[this.t-1]==e;)--this.t}function k(e){if(this.s<0)return"-"+this.negate().toString(e);var t;if(16==e)t=4;else if(8==e)t=3;else if(2==e)t=1;else if(32==e)t=5;else{if(4!=e)return this.toRadix(e);t=2}var r=(1<<t)-1,n,i=!1,o="",s=this.t,a=this.DB-s*this.DB%t;if(s-- >0)for(a<this.DB&&(n=this[s]>>a)>0&&(i=!0,o=g(n));s>=0;)a<t?(n=(this[s]&(1<<a)-1)<<t-a,n|=this[--s]>>(a+=this.DB-t)):(n=this[s]>>(a-=t)&r,a<=0&&(a+=this.DB,--s)),n>0&&(i=!0),i&&(o+=g(n));return i?o:"0"}function E(){var e=s();return o.ZERO.subTo(this,e),e}function A(){return this.s<0?this.negate():this}function x(e){var t=this.s-e.s;if(0!=t)return t;var r=this.t;if(t=r-e.t,0!=t)return this.s<0?-t:t;for(;--r>=0;)if(0!=(t=this[r]-e[r]))return t;return 0}function I(e){var t=1,r;return 0!=(r=e>>>16)&&(e=r,t+=16),0!=(r=e>>8)&&(e=r,t+=8),0!=(r=e>>4)&&(e=r,t+=4),0!=(r=e>>2)&&(e=r,t+=2),0!=(r=e>>1)&&(e=r,t+=1),t}function T(){return this.t<=0?0:this.DB*(this.t-1)+I(this[this.t-1]^this.s&this.DM)}function B(e,t){var r;for(r=this.t-1;r>=0;--r)t[r+e]=this[r];for(r=e-1;r>=0;--r)t[r]=0;t.t=this.t+e,t.s=this.s}function C(e,t){for(var r=e;r<this.t;++r)t[r-e]=this[r];t.t=Math.max(this.t-e,0),t.s=this.s}function P(e,t){var r=e%this.DB,n=this.DB-r,i=(1<<n)-1,o=Math.floor(e/this.DB),s=this.s<<r&this.DM,a;for(a=this.t-1;a>=0;--a)t[a+o+1]=this[a]>>n|s,s=(this[a]&i)<<r;for(a=o-1;a>=0;--a)t[a]=0;t[o]=s,t.t=this.t+o+1,t.s=this.s,t.clamp()}function O(e,t){t.s=this.s;var r=Math.floor(e/this.DB);if(r>=this.t)t.t=0;else{var n=e%this.DB,i=this.DB-n,o=(1<<n)-1;t[0]=this[r]>>n;for(var s=r+1;s<this.t;++s)t[s-r-1]|=(this[s]&o)<<i,t[s-r]=this[s]>>n;n>0&&(t[this.t-r-1]|=(this.s&o)<<i),t.t=this.t-r,t.clamp()}}function R(e,t){for(var r=0,n=0,i=Math.min(e.t,this.t);r<i;)n+=this[r]-e[r],t[r++]=n&this.DM,n>>=this.DB;if(e.t<this.t){for(n-=e.s;r<this.t;)n+=this[r],t[r++]=n&this.DM,n>>=this.DB;n+=this.s}else{for(n+=this.s;r<e.t;)n-=e[r],t[r++]=n&this.DM,n>>=this.DB;n-=e.s}t.s=n<0?-1:0,n<-1?t[r++]=this.DV+n:n>0&&(t[r++]=n),t.t=r,t.clamp()}function N(e,t){var r=this.abs(),n=e.abs(),i=r.t;for(t.t=i+n.t;--i>=0;)t[i]=0;for(i=0;i<n.t;++i)t[i+r.t]=r.am(0,n[i],t,i,0,r.t);t.s=0,t.clamp(),this.s!=e.s&&o.ZERO.subTo(t,t)}function L(e){for(var t=this.abs(),r=e.t=2*t.t;--r>=0;)e[r]=0;for(r=0;r<t.t-1;++r){var n=t.am(r,t[r],e,2*r,0,1);(e[r+t.t]+=t.am(r+1,2*t[r],e,2*r+1,n,t.t-r-1))>=t.DV&&(e[r+t.t]-=t.DV,e[r+t.t+1]=1)}e.t>0&&(e[e.t-1]+=t.am(r,t[r],e,2*r,0,1)),e.s=0,e.clamp()}function j(e,t,r){var n=e.abs();if(!(n.t<=0)){var i=this.abs();if(i.t<n.t)return null!=t&&t.fromInt(0),void(null!=r&&this.copyTo(r));null==r&&(r=s());var a=s(),u=this.s,c=e.s,f=this.DB-I(n[n.t-1]);f>0?(n.lShiftTo(f,a),i.lShiftTo(f,r)):(n.copyTo(a),i.copyTo(r));var l=a.t,h=a[l-1];if(0!=h){var p=h*(1<<this.F1)+(l>1?a[l-2]>>this.F2:0),d=this.FV/p,y=(1<<this.F1)/p,g=1<<this.F2,m=r.t,b=m-l,v=null==t?s():t;for(a.dlShiftTo(b,v),r.compareTo(v)>=0&&(r[r.t++]=1,r.subTo(v,r)),o.ONE.dlShiftTo(l,v),v.subTo(a,a);a.t<l;)a[a.t++]=0;for(;--b>=0;){var _=r[--m]==h?this.DM:Math.floor(r[m]*d+(r[m-1]+g)*y);if((r[m]+=a.am(0,_,r,b,0,l))<_)for(a.dlShiftTo(b,v),r.subTo(v,r);r[m]<--_;)r.subTo(v,r)}null!=t&&(r.drShiftTo(l,t),u!=c&&o.ZERO.subTo(t,t)),r.t=l,r.clamp(),f>0&&r.rShiftTo(f,r),u<0&&o.ZERO.subTo(r,r)}}}function M(e){var t=s();return this.abs().divRemTo(e,null,t),this.s<0&&t.compareTo(o.ZERO)>0&&e.subTo(t,t),t}function K(e){this.m=e}function D(e){return e.s<0||e.compareTo(this.m)>=0?e.mod(this.m):e}function U(e){return e}function F(e){e.divRemTo(this.m,null,e)}function q(e,t,r){e.multiplyTo(t,r),this.reduce(r)}function H(e,t){e.squareTo(t),this.reduce(t)}function z(){if(this.t<1)return 0;var e=this[0];if(0==(1&e))return 0;var t=3&e;return t=t*(2-(15&e)*t)&15,t=t*(2-(255&e)*t)&255,t=t*(2-((65535&e)*t&65535))&65535,t=t*(2-e*t%this.DV)%this.DV,t>0?this.DV-t:-t}function V(e){this.m=e,this.mp=e.invDigit(),this.mpl=32767&this.mp,this.mph=this.mp>>15,this.um=(1<<e.DB-15)-1,this.mt2=2*e.t}function G(e){var t=s();return e.abs().dlShiftTo(this.m.t,t),t.divRemTo(this.m,null,t),e.s<0&&t.compareTo(o.ZERO)>0&&this.m.subTo(t,t),t}function W(e){var t=s();return e.copyTo(t),this.reduce(t),t}function $(e){for(;e.t<=this.mt2;)e[e.t++]=0;for(var t=0;t<this.m.t;++t){var r=32767&e[t],n=r*this.mpl+((r*this.mph+(e[t]>>15)*this.mpl&this.um)<<15)&e.DM;for(r=t+this.m.t,e[r]+=this.m.am(0,n,e,t,0,this.m.t);e[r]>=e.DV;)e[r]-=e.DV,e[++r]++}e.clamp(),e.drShiftTo(this.m.t,e),e.compareTo(this.m)>=0&&e.subTo(this.m,e)}function Y(e,t){e.squareTo(t),this.reduce(t)}function J(e,t,r){e.multiplyTo(t,r),this.reduce(r)}function X(){return 0==(this.t>0?1&this[0]:this.s)}function Z(e,t){if(e>4294967295||e<1)return o.ONE;var r=s(),n=s(),i=t.convert(this),a=I(e)-1;for(i.copyTo(r);--a>=0;)if(t.sqrTo(r,n),(e&1<<a)>0)t.mulTo(n,i,r);else{var u=r;r=n,n=u}return t.revert(r)}function Q(e,t){var r;return r=e<256||t.isEven()?new K(t):new V(t),this.exp(e,r)}function ee(){var e=s();return this.copyTo(e),e}function te(){if(this.s<0){if(1==this.t)return this[0]-this.DV;if(0==this.t)return-1}else{if(1==this.t)return this[0];if(0==this.t)return 0}return(this[1]&(1<<32-this.DB)-1)<<this.DB|this[0]}function re(){return 0==this.t?this.s:this[0]<<24>>24}function ne(){return 0==this.t?this.s:this[0]<<16>>16}function ie(e){return Math.floor(Math.LN2*this.DB/Math.log(e))}function oe(){return this.s<0?-1:this.t<=0||1==this.t&&this[0]<=0?0:1}function se(e){if(null==e&&(e=10),0==this.signum()||e<2||e>36)return"0";var t=this.chunkSize(e),r=Math.pow(e,t),n=_(r),i=s(),o=s(),a="";for(this.divRemTo(n,i,o);i.signum()>0;)a=(r+o.intValue()).toString(e).substr(1)+a,i.divRemTo(n,i,o);return o.intValue().toString(e)+a}function ae(e,t){this.fromInt(0),null==t&&(t=10);for(var r=this.chunkSize(t),n=Math.pow(t,r),i=!1,s=0,a=0,u=0;u<e.length;++u){var c=m(e,u);c<0?"-"==e.charAt(u)&&0==this.signum()&&(i=!0):(a=t*a+c,++s>=r&&(this.dMultiply(n),this.dAddOffset(a,0),s=0,a=0))}s>0&&(this.dMultiply(Math.pow(t,s)),this.dAddOffset(a,0)),i&&o.ZERO.subTo(this,this)}function ue(e,t,r){if("number"==typeof t)if(e<2)this.fromInt(1);else for(this.fromNumber(e,r),this.testBit(e-1)||this.bitwiseTo(o.ONE.shiftLeft(e-1),ge,this),this.isEven()&&this.dAddOffset(1,0);!this.isProbablePrime(t);)this.dAddOffset(2,0),this.bitLength()>e&&this.subTo(o.ONE.shiftLeft(e-1),this);else{var n=new Array,i=7&e;n.length=1+(e>>3),t.nextBytes(n),i>0?n[0]&=(1<<i)-1:n[0]=0,this.fromString(n,256)}}function ce(){var e=this.t,t=new Array;t[0]=this.s;var r=this.DB-e*this.DB%8,n,i=0;if(e-- >0)for(r<this.DB&&(n=this[e]>>r)!=(this.s&this.DM)>>r&&(t[i++]=n|this.s<<this.DB-r);e>=0;)r<8?(n=(this[e]&(1<<r)-1)<<8-r,n|=this[--e]>>(r+=this.DB-8)):(n=this[e]>>(r-=8)&255,r<=0&&(r+=this.DB,--e)),0!=(128&n)&&(n|=-256),0==i&&(128&this.s)!=(128&n)&&++i,(i>0||n!=this.s)&&(t[i++]=n);return t}function fe(e){return 0==this.compareTo(e)}function le(e){return this.compareTo(e)<0?this:e}function he(e){return this.compareTo(e)>0?this:e}function pe(e,t,r){var n,i,o=Math.min(e.t,this.t);for(n=0;n<o;++n)r[n]=t(this[n],e[n]);if(e.t<this.t){for(i=e.s&this.DM,n=o;n<this.t;++n)r[n]=t(this[n],i);r.t=this.t}else{for(i=this.s&this.DM,n=o;n<e.t;++n)r[n]=t(i,e[n]);r.t=e.t}r.s=t(this.s,e.s),r.clamp()}function de(e,t){return e&t}function ye(e){var t=s();return this.bitwiseTo(e,de,t),t}function ge(e,t){return e|t}function me(e){var t=s();return this.bitwiseTo(e,ge,t),t}function be(e,t){return e^t}function ve(e){var t=s();return this.bitwiseTo(e,be,t),t}function _e(e,t){return e&~t}function we(e){var t=s();return this.bitwiseTo(e,_e,t),t}function Se(){for(var e=s(),t=0;t<this.t;++t)e[t]=this.DM&~this[t];return e.t=this.t,e.s=~this.s,e}function ke(e){var t=s();return e<0?this.rShiftTo(-e,t):this.lShiftTo(e,t),t}function Ee(e){var t=s();return e<0?this.lShiftTo(-e,t):this.rShiftTo(e,t),t}function Ae(e){if(0==e)return-1;var t=0;return 0==(65535&e)&&(e>>=16,t+=16),0==(255&e)&&(e>>=8,t+=8),0==(15&e)&&(e>>=4,t+=4),0==(3&e)&&(e>>=2,t+=2),0==(1&e)&&++t,t}function xe(){for(var e=0;e<this.t;++e)if(0!=this[e])return e*this.DB+Ae(this[e]);return this.s<0?this.t*this.DB:-1}function Ie(e){for(var t=0;0!=e;)e&=e-1,++t;return t}function Te(){for(var e=0,t=this.s&this.DM,r=0;r<this.t;++r)e+=Ie(this[r]^t);return e}function Be(e){var t=Math.floor(e/this.DB);return t>=this.t?0!=this.s:0!=(this[t]&1<<e%this.DB)}function Ce(e,t){var r=o.ONE.shiftLeft(e);return this.bitwiseTo(r,t,r),r}function Pe(e){return this.changeBit(e,ge)}function Oe(e){return this.changeBit(e,_e)}function Re(e){return this.changeBit(e,be)}function Ne(e,t){for(var r=0,n=0,i=Math.min(e.t,this.t);r<i;)n+=this[r]+e[r],t[r++]=n&this.DM,n>>=this.DB;if(e.t<this.t){for(n+=e.s;r<this.t;)n+=this[r],t[r++]=n&this.DM,n>>=this.DB;n+=this.s}else{for(n+=this.s;r<e.t;)n+=e[r],t[r++]=n&this.DM,n>>=this.DB;n+=e.s}t.s=n<0?-1:0,n>0?t[r++]=n:n<-1&&(t[r++]=this.DV+n),t.t=r,t.clamp()}function Le(e){var t=s();return this.addTo(e,t),t}function je(e){var t=s();return this.subTo(e,t),t}function Me(e){var t=s();return this.multiplyTo(e,t),t}function Ke(){var e=s();return this.squareTo(e),e}function De(e){var t=s();return this.divRemTo(e,t,null),t}function Ue(e){var t=s();return this.divRemTo(e,null,t),t}function Fe(e){var t=s(),r=s();return this.divRemTo(e,t,r),new Array(t,r)}function qe(e){this[this.t]=this.am(0,e-1,this,0,0,this.t),++this.t,this.clamp()}function He(e,t){if(0!=e){for(;this.t<=t;)this[this.t++]=0;for(this[t]+=e;this[t]>=this.DV;)this[t]-=this.DV,++t>=this.t&&(this[this.t++]=0),++this[t]}}function ze(){}function Ve(e){return e}function Ge(e,t,r){e.multiplyTo(t,r)}function We(e,t){e.squareTo(t)}function $e(e){return this.exp(e,new ze)}function Ye(e,t,r){var n=Math.min(this.t+e.t,t),i;for(r.s=0,r.t=n;n>0;)r[--n]=0;for(i=r.t-this.t;n<i;++n)r[n+this.t]=this.am(0,e[n],r,n,0,this.t);for(i=Math.min(e.t,t);n<i;++n)this.am(0,e[n],r,n,0,t-n);r.clamp()}function Je(e,t,r){--t;var n=r.t=this.t+e.t-t;for(r.s=0;--n>=0;)r[n]=0;for(n=Math.max(t-this.t,0);n<e.t;++n)r[this.t+n-t]=this.am(t-n,e[n],r,0,0,this.t+n-t);r.clamp(),r.drShiftTo(1,r)}function Xe(e){this.r2=s(),this.q3=s(),o.ONE.dlShiftTo(2*e.t,this.r2),this.mu=this.r2.divide(e),this.m=e}function Ze(e){if(e.s<0||e.t>2*this.m.t)return e.mod(this.m);if(e.compareTo(this.m)<0)return e;var t=s();return e.copyTo(t),this.reduce(t),t}function Qe(e){return e}function et(e){for(e.drShiftTo(this.m.t-1,this.r2),e.t>this.m.t+1&&(e.t=this.m.t+1,e.clamp()),this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3),this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2);e.compareTo(this.r2)<0;)e.dAddOffset(1,this.m.t+1);for(e.subTo(this.r2,e);e.compareTo(this.m)>=0;)e.subTo(this.m,e)}function tt(e,t){e.squareTo(t),this.reduce(t)}function rt(e,t,r){e.multiplyTo(t,r),this.reduce(r)}function nt(e,t){var r=e.bitLength(),n,i=_(1),o;if(r<=0)return i;n=r<18?1:r<48?3:r<144?4:r<768?5:6,o=r<8?new K(t):t.isEven()?new Xe(t):new V(t);var a=new Array,u=3,c=n-1,f=(1<<n)-1;if(a[1]=o.convert(this),n>1){var l=s();for(o.sqrTo(a[1],l);u<=f;)a[u]=s(),o.mulTo(l,a[u-2],a[u]),u+=2}var h=e.t-1,p,d=!0,y=s(),g;for(r=I(e[h])-1;h>=0;){for(r>=c?p=e[h]>>r-c&f:(p=(e[h]&(1<<r+1)-1)<<c-r,h>0&&(p|=e[h-1]>>this.DB+r-c)),u=n;0==(1&p);)p>>=1,--u;if((r-=u)<0&&(r+=this.DB,--h),d)a[p].copyTo(i),d=!1;else{for(;u>1;)o.sqrTo(i,y),o.sqrTo(y,i),u-=2;u>0?o.sqrTo(i,y):(g=i,i=y,y=g),o.mulTo(y,a[p],i)}for(;h>=0&&0==(e[h]&1<<r);)o.sqrTo(i,y),g=i,i=y,y=g,--r<0&&(r=this.DB-1,--h)}return o.revert(i)}function it(e){var t=this.s<0?this.negate():this.clone(),r=e.s<0?e.negate():e.clone();if(t.compareTo(r)<0){var n=t;t=r,r=n}var i=t.getLowestSetBit(),o=r.getLowestSetBit();if(o<0)return t;for(i<o&&(o=i),o>0&&(t.rShiftTo(o,t),r.rShiftTo(o,r));t.signum()>0;)(i=t.getLowestSetBit())>0&&t.rShiftTo(i,t),(i=r.getLowestSetBit())>0&&r.rShiftTo(i,r),t.compareTo(r)>=0?(t.subTo(r,t),t.rShiftTo(1,t)):(r.subTo(t,r),r.rShiftTo(1,r));return o>0&&r.lShiftTo(o,r),r}function ot(e){if(e<=0)return 0;var t=this.DV%e,r=this.s<0?e-1:0;if(this.t>0)if(0==t)r=this[0]%e;else for(var n=this.t-1;n>=0;--n)r=(t*r+this[n])%e;return r}function st(e){var t=e.isEven();if(this.isEven()&&t||0==e.signum())return o.ZERO;for(var r=e.clone(),n=this.clone(),i=_(1),s=_(0),a=_(0),u=_(1);0!=r.signum();){for(;r.isEven();)r.rShiftTo(1,r),t?(i.isEven()&&s.isEven()||(i.addTo(this,i),s.subTo(e,s)),i.rShiftTo(1,i)):s.isEven()||s.subTo(e,s),s.rShiftTo(1,s);for(;n.isEven();)n.rShiftTo(1,n),t?(a.isEven()&&u.isEven()||(a.addTo(this,a),u.subTo(e,u)),a.rShiftTo(1,a)):u.isEven()||u.subTo(e,u),u.rShiftTo(1,u);r.compareTo(n)>=0?(r.subTo(n,r),t&&i.subTo(a,i),s.subTo(u,s)):(n.subTo(r,n),t&&a.subTo(i,a),u.subTo(s,u))}return 0!=n.compareTo(o.ONE)?o.ZERO:u.compareTo(e)>=0?u.subtract(e):u.signum()<0?(u.addTo(e,u),u.signum()<0?u.add(e):u):u}K.prototype.convert=D,K.prototype.revert=U,K.prototype.reduce=F,K.prototype.mulTo=q,K.prototype.sqrTo=H,V.prototype.convert=G,V.prototype.revert=W,V.prototype.reduce=$,V.prototype.mulTo=J,V.prototype.sqrTo=Y,o.prototype.copyTo=b,o.prototype.fromInt=v,o.prototype.fromString=w,o.prototype.clamp=S,o.prototype.dlShiftTo=B,o.prototype.drShiftTo=C,o.prototype.lShiftTo=P,o.prototype.rShiftTo=O,o.prototype.subTo=R,o.prototype.multiplyTo=N,o.prototype.squareTo=L,o.prototype.divRemTo=j,o.prototype.invDigit=z,o.prototype.isEven=X,o.prototype.exp=Z,o.prototype.toString=k,o.prototype.negate=E,o.prototype.abs=A,o.prototype.compareTo=x,o.prototype.bitLength=T,o.prototype.mod=M,o.prototype.modPowInt=Q,o.ZERO=_(0),o.ONE=_(1),ze.prototype.convert=Ve,ze.prototype.revert=Ve,ze.prototype.mulTo=Ge,ze.prototype.sqrTo=We,Xe.prototype.convert=Ze,Xe.prototype.revert=Qe,Xe.prototype.reduce=et,Xe.prototype.mulTo=rt,Xe.prototype.sqrTo=tt;var at=[2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331,337,347,349,353,359,367,373,379,383,389,397,401,409,419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,509,521,523,541,547,557,563,569,571,577,587,593,599,601,607,613,617,619,631,641,643,647,653,659,661,673,677,683,691,701,709,719,727,733,739,743,751,757,761,769,773,787,797,809,811,821,823,827,829,839,853,857,859,863,877,881,883,887,907,911,919,929,937,941,947,953,967,971,977,983,991,997],ut=(1<<26)/at[at.length-1],ct,ft,lt;function ht(e){var t,r=this.abs();if(1==r.t&&r[0]<=at[at.length-1]){for(t=0;t<at.length;++t)if(r[0]==at[t])return!0;return!1}if(r.isEven())return!1;for(t=1;t<at.length;){for(var n=at[t],i=t+1;i<at.length&&n<ut;)n*=at[i++];for(n=r.modInt(n);t<i;)if(n%at[t++]==0)return!1}return r.millerRabin(e)}function pt(e){var t=this.subtract(o.ONE),r=t.getLowestSetBit();if(r<=0)return!1;var n=t.shiftRight(r);e=e+1>>1,e>at.length&&(e=at.length);for(var i=s(),a=0;a<e;++a){i.fromInt(at[Math.floor(Math.random()*at.length)]);var u=i.modPow(n,this);if(0!=u.compareTo(o.ONE)&&0!=u.compareTo(t)){for(var c=1;c++<r&&0!=u.compareTo(t);)if(u=u.modPowInt(2,this),0==u.compareTo(o.ONE))return!1;if(0!=u.compareTo(t))return!1}}return!0}function dt(e){ft[lt++]^=255&e,ft[lt++]^=e>>8&255,ft[lt++]^=e>>16&255,ft[lt++]^=e>>24&255,lt>=xt&&(lt-=xt)}function yt(){dt((new Date).getTime())}if(o.prototype.chunkSize=ie,o.prototype.toRadix=se,o.prototype.fromRadix=ae,o.prototype.fromNumber=ue,o.prototype.bitwiseTo=pe,o.prototype.changeBit=Ce,o.prototype.addTo=Ne,o.prototype.dMultiply=qe,o.prototype.dAddOffset=He,o.prototype.multiplyLowerTo=Ye,o.prototype.multiplyUpperTo=Je,o.prototype.modInt=ot,o.prototype.millerRabin=pt,o.prototype.clone=ee,o.prototype.intValue=te,o.prototype.byteValue=re,o.prototype.shortValue=ne,o.prototype.signum=oe,o.prototype.toByteArray=ce,o.prototype.equals=fe,o.prototype.min=le,o.prototype.max=he,o.prototype.and=ye,o.prototype.or=me,o.prototype.xor=ve,o.prototype.andNot=we,o.prototype.not=Se,o.prototype.shiftLeft=ke,o.prototype.shiftRight=Ee,o.prototype.getLowestSetBit=xe,o.prototype.bitCount=Te,o.prototype.testBit=Be,o.prototype.setBit=Pe,o.prototype.clearBit=Oe,o.prototype.flipBit=Re,o.prototype.add=Le,o.prototype.subtract=je,o.prototype.multiply=Me,o.prototype.divide=De,o.prototype.remainder=Ue,o.prototype.divideAndRemainder=Fe,o.prototype.modPow=nt,o.prototype.modInverse=st,o.prototype.pow=$e,o.prototype.gcd=it,o.prototype.isProbablePrime=ht,o.prototype.square=Ke,o.prototype.Barrett=Xe,null==ft){var gt;if(ft=new Array,lt=0,"undefined"!=typeof window&&window.crypto)if(window.crypto.getRandomValues){var mt=new Uint8Array(32);for(window.crypto.getRandomValues(mt),gt=0;gt<32;++gt)ft[lt++]=mt[gt]}else if("Netscape"==navigator.appName&&navigator.appVersion<"5"){var bt=window.crypto.random(32);for(gt=0;gt<bt.length;++gt)ft[lt++]=255&bt.charCodeAt(gt)}for(;lt<xt;)gt=Math.floor(65536*Math.random()),ft[lt++]=gt>>>8,ft[lt++]=255>lt=0,yt()}function vt(){if(null==ct){for(yt(),ct=At(),ct.init(ft),lt=0;lt<ft.length;++lt)ft[lt]=0;lt=0}return ct.next()}function _t(e){var t;for(t=0;t<e.length;++t)e[t]=vt()}function wt(){}function St(){this.i=0,this.j=0,this.S=new Array}function kt(e){var t,r,n;for(t=0;t<256;++t)this.S[t]=t;for(r=0,t=0;t<256;++t)r=r+this.S[t]+e[t%e.length]&255,n=this.S[t],this.S[t]=this.S[r],this.S[r]=n;this.i=0,this.j=0}function Et(){var e;return this.i=this.i+1&255,this.j=this.j+this.S[this.i]&255,e=this.S[this.i],this.S[this.i]=this.S[this.j],this.S[this.j]=e,this.S[e+this.S[this.i]&255]}function At(){return new St}wt.prototype.nextBytes=_t,St.prototype.init=kt,St.prototype.next=Et;var xt=256;t=e.exports={default:o,BigInteger:o,SecureRandom:wt}}).call(this)},function(e,t,r){"use strict";var n=t.falseIfInvalid=function(e){return function(){return!!this.valid&&e.apply(this,arguments)}};t.isInSubnet=n(function(e){return!(this.subnetMask<e.subnetMask)&&this.mask(e.subnetMask)===e.mask()}),t.isCorrect=function(e){return n(function(){return this.addressMinusSuffix===this.correctForm()&&(this.subnetMask===e&&!this.parsedSubnet||this.parsedSubnet===String(this.subnetMask))})}},function(e,t,r){(function(t){var r=1/0,n=9007199254740991,i=1.7976931348623157e308,o=NaN,s="[object Symbol]",a=/^\s+|\s+$/g,u=/^[-+]0x[0-9a-f]+$/i,c=/^0b[01]+$/i,f=/^0o[0-7]+$/i,l="\\ud800-\\udfff",h="\\u0300-\\u036f\\ufe20-\\ufe23",p="\\u20d0-\\u20f0",d="\\ufe0e\\ufe0f",y="[\\ud800-\\udfff]",g="["+h+"\\u20d0-\\u20f0]",m="\\ud83c[\\udffb-\\udfff]",b="(?:"+g+"|"+m+")",v="[^\\ud800-\\udfff]",_="(?:\\ud83c[\\udde6-\\uddff]){2}",w="[\\ud800-\\udbff][\\udc00-\\udfff]",S="\\u200d",k=b+"?",E="[\\ufe0e\\ufe0f]?",A="(?:\\u200d(?:"+[v,_,w].join("|")+")"+E+k+")*",x=E+k+A,I="(?:"+[v+g+"?",g,_,w,y].join("|")+")",T=RegExp(m+"(?="+m+")|"+I+x,"g"),B=RegExp("["+S+l+h+"\\u20d0-\\u20f0"+d+"]"),C=parseInt,P="object"==typeof t&&t&&t.Object===Object&&t,O="object"==typeof self&&self&&self.Object===Object&&self,R=P||O||Function("return this")(),N=j("length");function L(e){return e.split("")}function j(e){return function(t){return null==t?void 0:t[e]}}function M(e){return B.test(e)}function K(e){return M(e)?U(e):N(e)}function D(e){return M(e)?F(e):L(e)}function U(e){for(var t=T.lastIndex=0;T.test(e);)t++;return t}function F(e){return e.match(T)||[]}var q=Object.prototype,H=q.toString,z=R.Symbol,V=Math.ceil,G=Math.floor,W=z?z.prototype:void 0,$=W?W.toString:void 0;function Y(e,t){var r="";if(!e||t<1||t>n)return r;do{t%2&&(r+=e),t=G(t/2),t&&(e+=e)}while(t);return r}function J(e,t,r){var n=-1,i=e.length;t<0&&(t=-t>i?0:i+t),r=r>i?i:r,r<0&&(r+=i),i=t>r?0:r-t>>>0,t>>>=0;for(var o=Array(i);++n<i;)o[n]=e[n+t];return o}function X(e){if("string"==typeof e)return e;if(re(e))return $?$.call(e):"";var t=e+"";return"0"==t&&1/e==-r?"-0":t}function Z(e,t,r){var n=e.length;return r=void 0===r?n:r,!t&&r>=n?e:J(e,t,r)}function Q(e,t){t=void 0===t?" ":X(t);var r=t.length;if(r<2)return r?Y(t,e):t;var n=Y(t,V(e/K(t)));return M(t)?Z(D(n),0,e).join(""):n.slice(0,e)}function ee(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function te(e){return!!e&&"object"==typeof e}function re(e){return"symbol"==typeof e||te(e)&&H.call(e)==s}function ne(e){if(!e)return 0===e?e:0;if(e=oe(e),e===r||e===-r){var t=e<0?-1:1;return t*i}return e==e?e:0}function ie(e){var t=ne(e),r=t%1;return t==t?r?t-r:t:0}function oe(e){if("number"==typeof e)return e;if(re(e))return o;if(ee(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=ee(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=e.replace(a,"");var r=c.test(e);return r||f.test(e)?C(e.slice(2),r?2:8):u.test(e)?o:+e}function se(e){return null==e?"":X(e)}function ae(e,t,r){e=se(e),t=ie(t);var n=t?K(e):0;return t&&n<t?Q(t-n,r)+e:e}e.exports=ae}).call(this,r(7))},function(e,t,r){(function(t){var r=1/0,n=9007199254740991,i=1.7976931348623157e308,o=NaN,s="[object Function]",a="[object GeneratorFunction]",u="[object Symbol]",c=/^\s+|\s+$/g,f=/^[-+]0x[0-9a-f]+$/i,l=/^0b[01]+$/i,h=/^0o[0-7]+$/i,p=/^(?:0|[1-9]\d*)$/,d=parseInt,y="object"==typeof t&&t&&t.Object===Object&&t,g="object"==typeof self&&self&&self.Object===Object&&self,m=y||g||Function("return this")(),b=Object.prototype,v=b.toString,_=m.Symbol,w=Math.floor,S=_?_.prototype:void 0,k=S?S.toString:void 0;function E(e,t){var r="";if(!e||t<1||t>n)return r;do{t%2&&(r+=e),t=w(t/2),t&&(e+=e)}while(t);return r}function A(e){if("string"==typeof e)return e;if(N(e))return k?k.call(e):"";var t=e+"";return"0"==t&&1/e==-r?"-0":t}function x(e,t){return t=null==t?n:t,!!t&&("number"==typeof e||p.test(e))&&e>-1&&e%1==0&&e<t}function I(e,t,r){if(!O(r))return!1;var n=typeof t;return!!("number"==n?B(r)&&x(t,r.length):"string"==n&&t in r)&&T(r[t],e)}function T(e,t){return e===t||e!=e&&t!=t}function B(e){return null!=e&&P(e.length)&&!C(e)}function C(e){var t=O(e)?v.call(e):"";return t==s||t==a}function P(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=n}function O(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function R(e){return!!e&&"object"==typeof e}function N(e){return"symbol"==typeof e||R(e)&&v.call(e)==u}function L(e){if(!e)return 0===e?e:0;if(e=M(e),e===r||e===-r){var t=e<0?-1:1;return t*i}return e==e?e:0}function j(e){var t=L(e),r=t%1;return t==t?r?t-r:t:0}function M(e){if("number"==typeof e)return e;if(N(e))return o;if(O(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=O(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=e.replace(c,"");var r=l.test(e);return r||h.test(e)?d(e.slice(2),r?2:8):f.test(e)?o:+e}function K(e){return null==e?"":A(e)}function D(e,t,r){return t=(r?I(e,t,r):void 0===t)?1:j(t),E(K(e),t)}e.exports=D}).call(this,r(7))},function(e,t,r){(function(e,r){var n=200,i="Expected a function",o="__lodash_hash_undefined__",s=1,a=2,u=1/0,c=9007199254740991,f=1.7976931348623157e308,l=NaN,h="[object Arguments]",p="[object Array]",d="[object Boolean]",y="[object Date]",g="[object Error]",m="[object Function]",b="[object GeneratorFunction]",v="[object Map]",_="[object Number]",w="[object Object]",S="[object Promise]",k="[object RegExp]",E="[object Set]",A="[object String]",x="[object Symbol]",I="[object WeakMap]",T="[object ArrayBuffer]",B="[object DataView]",C="[object Float32Array]",P="[object Float64Array]",O="[object Int8Array]",R="[object Int16Array]",N="[object Int32Array]",L="[object Uint8Array]",j="[object Uint8ClampedArray]",M="[object Uint16Array]",K="[object Uint32Array]",D=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,U=/^\w*$/,F=/^\./,q=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,H=/[\\^$.*+?()[\]{}|]/g,z=/^\s+|\s+$/g,V=/\\(\\)?/g,G=/^[-+]0x[0-9a-f]+$/i,W=/^0b[01]+$/i,$=/^\[object .+?Constructor\]$/,Y=/^0o[0-7]+$/i,J=/^(?:0|[1-9]\d*)$/,X={};X[C]=X[P]=X[O]=X[R]=X[N]=X[L]=X[j]=X[M]=X[K]=!0,X[h]=X[p]=X[T]=X[d]=X[B]=X[y]=X[g]=X[m]=X[v]=X[_]=X[w]=X[k]=X[E]=X[A]=X[I]=!1;var Z=parseInt,Q="object"==typeof e&&e&&e.Object===Object&&e,ee="object"==typeof self&&self&&self.Object===Object&&self,te=Q||ee||Function("return this")(),re="object"==typeof t&&t&&!t.nodeType&&t,ne=re&&"object"==typeof r&&r&&!r.nodeType&&r,ie=ne&&ne.exports===re,oe=ie&&Q.process,se=function(){try{return oe&&oe.binding("util")}catch(e){}}(),ae=se&&se.isTypedArray;function ue(e,t){for(var r=-1,n=e?e.length:0;++r<n;)if(t(e[r],r,e))return!0;return!1}function ce(e,t,r,n){for(var i=e.length,o=r+(n?1:-1);n?o--:++o<i;)if(t(e[o],o,e))return o;return-1}function fe(e){return function(t){return null==t?void 0:t[e]}}function le(e,t){for(var r=-1,n=Array(e);++r<e;)n[r]=t(r);return n}function he(e){return function(t){return e(t)}}function pe(e,t){return null==e?void 0:e[t]}function de(e){var t=!1;if(null!=e&&"function"!=typeof e.toString)try{t=!!(e+"")}catch(e){}return t}function ye(e){var t=-1,r=Array(e.size);return e.forEach(function(e,n){r[++t]=[n,e]}),r}function ge(e,t){return function(r){return e(t(r))}}function me(e){var t=-1,r=Array(e.size);return e.forEach(function(e){r[++t]=e}),r}var be=Array.prototype,ve=Function.prototype,_e=Object.prototype,we=te["__core-js_shared__"],Se=(ke=/[^.]+$/.exec(we&&we.keys&&we.keys.IE_PROTO||""),ke?"Symbol(src)_1."+ke:""),ke,Ee=ve.toString,Ae=_e.hasOwnProperty,xe=_e.toString,Ie=RegExp("^"+Ee.call(Ae).replace(H,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Te=te.Symbol,Be=te.Uint8Array,Ce=_e.propertyIsEnumerable,Pe=be.splice,Oe=ge(Object.keys,Object),Re=Math.max,Ne=zt(te,"DataView"),Le=zt(te,"Map"),je=zt(te,"Promise"),Me=zt(te,"Set"),Ke=zt(te,"WeakMap"),De=zt(Object,"create"),Ue=rr(Ne),Fe=rr(Le),qe=rr(je),He=rr(Me),ze=rr(Ke),Ve=Te?Te.prototype:void 0,Ge=Ve?Ve.valueOf:void 0,We=Ve?Ve.toString:void 0;function $e(e){var t=-1,r=e?e.length:0;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}function Ye(){this.__data__=De?De(null):{}}function Je(e){return this.has(e)&&delete this.__data__[e]}function Xe(e){var t=this.__data__;if(De){var r=t[e];return r===o?void 0:r}return Ae.call(t,e)?t[e]:void 0}function Ze(e){var t=this.__data__;return De?void 0!==t[e]:Ae.call(t,e)}function Qe(e,t){var r=this.__data__;return r[e]=De&&void 0===t?o:t,this}function et(e){var t=-1,r=e?e.length:0;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}function tt(){this.__data__=[]}function rt(e){var t=this.__data__,r=St(t,e);if(r<0)return!1;var n=t.length-1;return r==n?t.pop():Pe.call(t,r,1),!0}function nt(e){var t=this.__data__,r=St(t,e);return r<0?void 0:t[r][1]}function it(e){return St(this.__data__,e)>-1}function ot(e,t){var r=this.__data__,n=St(r,e);return n<0?r.push([e,t]):r[n][1]=t,this}function st(e){var t=-1,r=e?e.length:0;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}function at(){this.__data__={hash:new $e,map:new(Le||et),string:new $e}}function ut(e){return qt(this,e).delete(e)}function ct(e){return qt(this,e).get(e)}function ft(e){return qt(this,e).has(e)}function lt(e,t){return qt(this,e).set(e,t),this}function ht(e){var t=-1,r=e?e.length:0;for(this.__data__=new st;++t<r;)this.add(e[t])}function pt(e){return this.__data__.set(e,o),this}function dt(e){return this.__data__.has(e)}function yt(e){this.__data__=new et(e)}function gt(){this.__data__=new et}function mt(e){return this.__data__.delete(e)}function bt(e){return this.__data__.get(e)}function vt(e){return this.__data__.has(e)}function _t(e,t){var r=this.__data__;if(r instanceof et){var i=r.__data__;if(!Le||i.length<n-1)return i.push([e,t]),this;r=this.__data__=new st(i)}return r.set(e,t),this}function wt(e,t){var r=ur(e)||ar(e)?le(e.length,String):[],n=r.length,i=!!n;for(var o in e)!t&&!Ae.call(e,o)||i&&("length"==o||Wt(o,n))||r.push(o);return r}function St(e,t){for(var r=e.length;r--;)if(sr(e[r][0],t))return r;return-1}function kt(e,t){t=$t(t,e)?[t]:Mt(t);for(var r=0,n=t.length;null!=e&&r<n;)e=e[tr(t[r++])];return r&&r==n?e:void 0}function Et(e){return xe.call(e)}function At(e,t){return null!=e&&t in Object(e)}function xt(e,t,r,n,i){return e===t||(null==e||null==t||!pr(e)&&!dr(t)?e!=e&&t!=t:It(e,t,xt,r,n,i))}function It(e,t,r,n,i,o){var s=ur(e),u=ur(t),c=p,f=p;s||(c=Vt(e),c=c==h?w:c),u||(f=Vt(t),f=f==h?w:f);var l=c==w&&!de(e),d=f==w&&!de(t),y=c==f;if(y&&!l)return o||(o=new yt),s||gr(e)?Dt(e,t,r,n,i,o):Ut(e,t,c,r,n,i,o);if(!(i&a)){var g=l&&Ae.call(e,"__wrapped__"),m=d&&Ae.call(t,"__wrapped__");if(g||m){var b=g?e.value():e,v=m?t.value():t;return o||(o=new yt),r(b,v,n,i,o)}}return!!y&&(o||(o=new yt),Ft(e,t,r,n,i,o))}function Tt(e,t,r,n){var i=r.length,o=i,u=!n;if(null==e)return!o;for(e=Object(e);i--;){var c=r[i];if(u&&c[2]?c[1]!==e[c[0]]:!(c[0]in e))return!1}for(;++i<o;){c=r[i];var f=c[0],l=e[f],h=c[1];if(u&&c[2]){if(void 0===l&&!(f in e))return!1}else{var p=new yt;if(n)var d=n(l,h,f,e,t,p);if(!(void 0===d?xt(h,l,n,s|a,p):d))return!1}}return!0}function Bt(e){if(!pr(e)||Jt(e))return!1;var t=lr(e)||de(e)?Ie:$;return t.test(rr(e))}function Ct(e){return dr(e)&&hr(e.length)&&!!X[xe.call(e)]}function Pt(e){return"function"==typeof e?e:null==e?Er:"object"==typeof e?ur(e)?Nt(e[0],e[1]):Rt(e):Ar(e)}function Ot(e){if(!Xt(e))return Oe(e);var t=[];for(var r in Object(e))Ae.call(e,r)&&"constructor"!=r&&t.push(r);return t}function Rt(e){var t=Ht(e);return 1==t.length&&t[0][2]?Qt(t[0][0],t[0][1]):function(r){return r===e||Tt(r,e,t)}}function Nt(e,t){return $t(e)&&Zt(t)?Qt(tr(e),t):function(r){var n=wr(r,e);return void 0===n&&n===t?Sr(r,e):xt(t,n,void 0,s|a)}}function Lt(e){return function(t){return kt(t,e)}}function jt(e){if("string"==typeof e)return e;if(yr(e))return We?We.call(e):"";var t=e+"";return"0"==t&&1/e==-u?"-0":t}function Mt(e){return ur(e)?e:er(e)}function Kt(e){return function(t,r,n){var i=Object(t);if(!cr(t)){var o=Pt(r,3);t=kr(t),r=function(e){return o(i[e],e,i)}}var s=e(t,r,n);return s>-1?i[o?t[s]:s]:void 0}}function Dt(e,t,r,n,i,o){var u=i&a,c=e.length,f=t.length;if(c!=f&&!(u&&f>c))return!1;var l=o.get(e);if(l&&o.get(t))return l==t;var h=-1,p=!0,d=i&s?new ht:void 0;for(o.set(e,t),o.set(t,e);++h<c;){var y=e[h],g=t[h];if(n)var m=u?n(g,y,h,t,e,o):n(y,g,h,e,t,o);if(void 0!==m){if(m)continue;p=!1;break}if(d){if(!ue(t,function(e,t){if(!d.has(t)&&(y===e||r(y,e,n,i,o)))return d.add(t)})){p=!1;break}}else if(y!==g&&!r(y,g,n,i,o)){p=!1;break}}return o.delete(e),o.delete(t),p}function Ut(e,t,r,n,i,o,u){switch(r){case B:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case T:return!(e.byteLength!=t.byteLength||!n(new Be(e),new Be(t)));case d:case y:case _:return sr(+e,+t);case g:return e.name==t.name&&e.message==t.message;case k:case A:return e==t+"";case v:var c=ye;case E:var f=o&a;if(c||(c=me),e.size!=t.size&&!f)return!1;var l=u.get(e);if(l)return l==t;o|=s,u.set(e,t);var h=Dt(c(e),c(t),n,i,o,u);return u.delete(e),h;case x:if(Ge)return Ge.call(e)==Ge.call(t)}return!1}function Ft(e,t,r,n,i,o){var s=i&a,u=kr(e),c=u.length,f=kr(t),l=f.length;if(c!=l&&!s)return!1;for(var h=c;h--;){var p=u[h];if(!(s?p in t:Ae.call(t,p)))return!1}var d=o.get(e);if(d&&o.get(t))return d==t;var y=!0;o.set(e,t),o.set(t,e);for(var g=s;++h<c;){p=u[h];var m=e[p],b=t[p];if(n)var v=s?n(b,m,p,t,e,o):n(m,b,p,e,t,o);if(!(void 0===v?m===b||r(m,b,n,i,o):v)){y=!1;break}g||(g="constructor"==p)}if(y&&!g){var _=e.constructor,w=t.constructor;_!=w&&"constructor"in e&&"constructor"in t&&!("function"==typeof _&&_ instanceof _&&"function"==typeof w&&w instanceof w)&&(y=!1)}return o.delete(e),o.delete(t),y}function qt(e,t){var r=e.__data__;return Yt(t)?r["string"==typeof t?"string":"hash"]:r.map}function Ht(e){for(var t=kr(e),r=t.length;r--;){var n=t[r],i=e[n];t[r]=[n,i,Zt(i)]}return t}function zt(e,t){var r=pe(e,t);return Bt(r)?r:void 0}$e.prototype.clear=Ye,$e.prototype.delete=Je,$e.prototype.get=Xe,$e.prototype.has=Ze,$e.prototype.set=Qe,et.prototype.clear=tt,et.prototype.delete=rt,et.prototype.get=nt,et.prototype.has=it,et.prototype.set=ot,st.prototype.clear=at,st.prototype.delete=ut,st.prototype.get=ct,st.prototype.has=ft,st.prototype.set=lt,ht.prototype.add=ht.prototype.push=pt,ht.prototype.has=dt,yt.prototype.clear=gt,yt.prototype.delete=mt,yt.prototype.get=bt,yt.prototype.has=vt,yt.prototype.set=_t;var Vt=Et;function Gt(e,t,r){t=$t(t,e)?[t]:Mt(t);for(var n,i=-1,o=t.length;++i<o;){var s=tr(t[i]);if(!(n=null!=e&&r(e,s)))break;e=e[s]}if(n)return n;var o=e?e.length:0;return!!o&&hr(o)&&Wt(s,o)&&(ur(e)||ar(e))}function Wt(e,t){return t=null==t?c:t,!!t&&("number"==typeof e||J.test(e))&&e>-1&&e%1==0&&e<t}function $t(e,t){if(ur(e))return!1;var r=typeof e;return!("number"!=r&&"symbol"!=r&&"boolean"!=r&&null!=e&&!yr(e))||(U.test(e)||!D.test(e)||null!=t&&e in Object(t))}function Yt(e){var t=typeof e;return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e}function Jt(e){return!!Se&&Se in e}function Xt(e){var t=e&&e.constructor,r="function"==typeof t&&t.prototype||_e;return e===r}function Zt(e){return e==e&&!pr(e)}function Qt(e,t){return function(r){return null!=r&&(r[e]===t&&(void 0!==t||e in Object(r)))}}(Ne&&Vt(new Ne(new ArrayBuffer(1)))!=B||Le&&Vt(new Le)!=v||je&&Vt(je.resolve())!=S||Me&&Vt(new Me)!=E||Ke&&Vt(new Ke)!=I)&&(Vt=function(e){var t=xe.call(e),r=t==w?e.constructor:void 0,n=r?rr(r):void 0;if(n)switch(n){case Ue:return B;case Fe:return v;case qe:return S;case He:return E;case ze:return I}return t});var er=or(function(e){e=_r(e);var t=[];return F.test(e)&&t.push(""),e.replace(q,function(e,r,n,i){t.push(n?i.replace(V,"$1"):r||e)}),t});function tr(e){if("string"==typeof e||yr(e))return e;var t=e+"";return"0"==t&&1/e==-u?"-0":t}function rr(e){if(null!=e){try{return Ee.call(e)}catch(e){}try{return e+""}catch(e){}}return""}function nr(e,t,r){var n=e?e.length:0;if(!n)return-1;var i=null==r?0:br(r);return i<0&&(i=Re(n+i,0)),ce(e,Pt(t,3),i)}var ir=Kt(nr);function or(e,t){if("function"!=typeof e||t&&"function"!=typeof t)throw new TypeError(i);var r=function(){var n=arguments,i=t?t.apply(this,n):n[0],o=r.cache;if(o.has(i))return o.get(i);var s=e.apply(this,n);return r.cache=o.set(i,s),s};return r.cache=new(or.Cache||st),r}function sr(e,t){return e===t||e!=e&&t!=t}function ar(e){return fr(e)&&Ae.call(e,"callee")&&(!Ce.call(e,"callee")||xe.call(e)==h)}or.Cache=st;var ur=Array.isArray;function cr(e){return null!=e&&hr(e.length)&&!lr(e)}function fr(e){return dr(e)&&cr(e)}function lr(e){var t=pr(e)?xe.call(e):"";return t==m||t==b}function hr(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=c}function pr(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function dr(e){return!!e&&"object"==typeof e}function yr(e){return"symbol"==typeof e||dr(e)&&xe.call(e)==x}var gr=ae?he(ae):Ct;function mr(e){if(!e)return 0===e?e:0;if(e=vr(e),e===u||e===-u){var t=e<0?-1:1;return t*f}return e==e?e:0}function br(e){var t=mr(e),r=t%1;return t==t?r?t-r:t:0}function vr(e){if("number"==typeof e)return e;if(yr(e))return l;if(pr(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=pr(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=e.replace(z,"");var r=W.test(e);return r||Y.test(e)?Z(e.slice(2),r?2:8):G.test(e)?l:+e}function _r(e){return null==e?"":jt(e)}function wr(e,t,r){var n=null==e?void 0:kt(e,t);return void 0===n?r:n}function Sr(e,t){return null!=e&&Gt(e,t,At)}function kr(e){return cr(e)?wt(e):Ot(e)}function Er(e){return e}function Ar(e){return $t(e)?fe(tr(e)):Lt(e)}r.exports=ir}).call(this,r(7),r(28)(e))},function(e,t,r){"use strict";var n=r(140).sprintf,i=t.spanAllZeroes=function(e){return e.replace(/(0+)/g,'<span class="zero">$1</span>')};function o(e){return e.replace(/^(0+)/,'<span class="zero">$1</span>')}t.spanAll=function(e,t){void 0===t&&(t=0);var r=e.split("");return r.map(function(e,r){return n('<span class="digit value-%s position-%d">%s</span>',e,r+t,i(e))}).join("")},t.spanLeadingZeroes=function(e){var t=e.split(":");return t.map(function(e){return o(e)}).join(":")},t.simpleGroup=function(e,t){var r=e.split(":");return t||(t=0),r.map(function(e,r){return/group-v4/.test(e)?e:n('<span class="hover-group group-%d">%s</span>',r+t,o(e))}).join(":")}},function(e,t,r){"use strict";(function(t){const n=r(18),i=r(964),o=r(209),s=r(9),a=/^https?:\/\/[^/]+\/(ip(f|n)s)\/((\w+).*)/,u=/^\/(ip(f|n)s)\/((\w+).*)/,c=1,f=4,l=/^https?:\/\/([^/]+)\.(ip(?:f|n)s)\.[^/]+/,h=1,p=2;function d(e){const r=v(e);try{const e=t.from(n.decode(r));return i.decode(e),!0}catch(e){return!1}}function y(e){try{return o.isEncoded(e)}catch(e){return!1}}function g(e){try{return s.isCID(new s(e))}catch(e){return!1}}function m(e,t,r=c,n=f){const i=v(e);if(!i)return!1;const o=i.match(t);if(!o)return!1;if("ipfs"!==o[r])return!1;let s=o[n];return s&&t===l&&(s=s.toLowerCase()),g(s)}function b(e,t,r=c,n){const i=v(e);if(!i)return!1;const o=i.match(t);if(!o)return!1;if("ipns"!==o[r])return!1;if(n&&t===l){let e=o[n];return e=e.toLowerCase(),g(e)}return!0}function v(e){return t.isBuffer(e)?n.encode(e):"string"==typeof e&&e}const _=e=>m(e,l,2,1),w=e=>b(e,l,2,1);e.exports={multihash:d,cid:g,base32cid:e=>"base32"===y(e)&&g(e),ipfsSubdomain:_,ipnsSubdomain:w,subdomain:e=>_(e)||w(e),subdomainPattern:l,ipfsUrl:e=>m(e,a),ipnsUrl:e=>b(e,a),url:e=>m(e,a)||b(e,a),urlPattern:a,ipfsPath:e=>m(e,u),ipnsPath:e=>b(e,u),path:e=>m(e,u)||b(e,u),pathPattern:u,urlOrPath:e=>m(e,a)||b(e,a)||m(e,u)||b(e,u)}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(t){const n=r(18),i=r(968),o=r(52);function s(e){let r;if("string"==typeof e)r=e;else if(t.isBuffer(e))r=n.encode(e).toString();else if(i.isPeerId(e))r=e.toB58String();else{if(!o.isPeerInfo(e))throw new Error("not valid PeerId or PeerInfo, or B58Str");r=e.id.toB58String()}return r}class a{constructor(){this._peers={}}has(e){const t=s(e);return Boolean(this._peers[t])}put(e,t){const r=this._peers[e.id.toB58String()];if(!r||t)return this._peers[e.id.toB58String()]=e,e;e.multiaddrs.forEach(e=>r.multiaddrs.add(e));const n=e.isConnected();return n&&r.connect(n),e.protocols.forEach(e=>r.protocols.add(e)),!r.id.privKey&&e.id.privKey&&(r.id.privKey=e.id.privKey),!r.id.pubKey&&e.id.pubKey&&(r.id.pubKey=e.id.pubKey),r}get(e){const t=s(e),r=this._peers[t];if(r)return r;throw new Error("PeerInfo not found")}getAll(){return this._peers}getAllArray(){return Object.keys(this._peers).map(e=>this._peers[e])}getMultiaddrs(e){const t=this.get(e);return t.multiaddrs.toArray()}remove(e){const t=s(e);this._peers[t]&&delete this._peers[t]}}e.exports=a}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(e){const n=r(272),i=r(273)(),o=r(970),s={SHA1:"SHA-1",SHA256:"SHA-256",SHA512:"SHA-512"},a=(t,r,o)=>{n(i.subtle.sign({name:"HMAC"},t,r).then(t=>e.from(t)),o)};t.create=function(e,t,r){const u=s[e];n(i.subtle.importKey("raw",t,{name:"HMAC",hash:{name:u}},!1,["sign"]).then(t=>({digest(e,r){a(t,e,r)},length:o[e]})),r)}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(t){const n=r(14),i=r(975);function o(e,t,r,i){if("function"==typeof r&&(i=r,r=void 0),!i)throw new Error("Missing callback");o.digest(e,t,r,(e,o)=>{if(e)return i(e);i(null,n.encode(o,t,r))})}e.exports=o,o.Buffer=t,o.multihash=n,o.digest=function(e,t,r,n){if("function"==typeof r&&(n=r,r=void 0),!n)throw new Error("Missing callback");let i=n,s;r&&(i=((e,t)=>{if(e)return n(e);n(null,t.slice(0,r))}));try{s=o.createHash(t)}catch(e){return i(e)}s(e,i)},o.createHash=function(e){if(e=n.coerceCode(e),!o.functions[e])throw new Error("multihash function "+e+" not yet supported");return o.functions[e]},o.functions={17:i.sha1,18:i.sha2256,19:i.sha2512,20:i.sha3512,21:i.sha3384,22:i.sha3256,23:i.sha3224,24:i.shake128,25:i.shake256,26:i.keccak224,27:i.keccak256,28:i.keccak384,29:i.keccak512,34:i.murmur3128,35:i.murmur332,86:i.dblSha2256},i.addBlake(o.functions)}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(e){const n=r(3);t.toCallback=(e=>(function(t,r){const i=(e,t)=>n(()=>{r(e,t)});let o;try{o=e(t)}catch(e){return void i(e)}i(null,o)})),t.toBuf=((t,r)=>n=>{let i=t(n,r);return e.from(i,"hex")}),t.fromString=((t,r)=>n=>{const i=e.isBuffer(n)?n.toString():n;return t(i,r)}),t.fromNumberTo32BitBuf=((t,r)=>n=>{let i=t(n,r);const o=new Array(4);for(let e=0;e<4;e++)o[e]=255&i,i>>=8;return e.from(o)})}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(e){const n=r(272),i=r(273)();function o(e){return Promise.all([i.subtle.exportKey("jwk",e.privateKey),i.subtle.exportKey("jwk",e.publicKey)])}function s(e){return i.subtle.importKey("jwk",{kty:e.kty,n:e.n,e:e.e},{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}},!0,["verify"])}t.utils=r(978),t.generateKey=function(e,t){n(i.subtle.generateKey({name:"RSASSA-PKCS1-v1_5",modulusLength:e,publicExponent:new Uint8Array([1,0,1]),hash:{name:"SHA-256"}},!0,["sign","verify"]).then(o).then(e=>({privateKey:e[0],publicKey:e[1]})),t)},t.unmarshalPrivateKey=function(e,t){const r=i.subtle.importKey("jwk",e,{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}},!0,["sign"]);n(Promise.all([r,s(e)]).then(e=>o({privateKey:e[0],publicKey:e[1]})).then(e=>({privateKey:e[0],publicKey:e[1]})),t)},t.getRandomValues=function(t){return e.from(i.getRandomValues(t))},t.hashAndSign=function(t,r,o){n(i.subtle.importKey("jwk",t,{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}},!1,["sign"]).then(e=>i.subtle.sign({name:"RSASSA-PKCS1-v1_5"},e,Uint8Array.from(r))).then(t=>e.from(t)),o)},t.hashAndVerify=function(e,t,r,o){n(i.subtle.importKey("jwk",e,{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}},!1,["verify"]).then(e=>i.subtle.verify({name:"RSASSA-PKCS1-v1_5"},e,t,r)),o)}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(e){const n=r(17).bignum;t.toBase64=function t(r,n){let i=r.toArrayLike(e,"be",n).toString("base64");return i.replace(/(=*)$/,"").replace(/\+/g,"-").replace(/\//g,"_")},t.toBn=function t(r){return new n(e.from(r,"base64"))}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";const n=r(486);function i(e){if(!e||"number"!=typeof e)throw new Error("first argument must be a Number bigger than 0");return n.getRandomValues(new Uint8Array(e))}e.exports=i},function(e,t,r){!function t(r,n){e.exports=n()}(this,function(){return function(e){var t={};function r(n){if(t[n])return t[n].exports;var i=t[n]={i:n,l:!1,exports:{}};return e[n].call(i.exports,i,i.exports,r),i.l=!0,i.exports}return r.m=e,r.c=t,r.i=function(e){return e},r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get:n})},r.n=function(e){var t=e&&e.__esModule?function t(){return e.default}:function t(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=32)}([function(e,t,r){"use strict";(function(e,n){var i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},o=r(17),s=r(15),a=r(37),u=r(16),c=r(18),f={};t.clone=function(r,n){if("object"!==(void 0===r?"undefined":i(r))||null===r)return r;n=n||new Map;var o=n.get(r);if(o)return o;var s=void 0,a=!1;if(Array.isArray(r))s=[],a=!0;else if(e.isBuffer(r))s=e.from(r);else if(r instanceof Date)s=new Date(r.getTime());else if(r instanceof RegExp)s=new RegExp(r);else{var u=Object.getPrototypeOf(r);u&&u.isImmutable?s=r:(s=Object.create(u),a=!0)}if(n.set(r,s),a)for(var c=Object.getOwnPropertyNames(r),f=0;f<c.length;++f){var l=c[f],h=Object.getOwnPropertyDescriptor(r,l);h&&(h.get||h.set)?Object.defineProperty(s,l,h):s[l]=t.clone(r[l],n)}return s},t.merge=function(r,n,o,s){if(t.assert(r&&"object"===(void 0===r?"undefined":i(r)),"Invalid target value: must be an object"),t.assert(null===n||void 0===n||"object"===(void 0===n?"undefined":i(n)),"Invalid source value: must be null, undefined, or an object"),!n)return r;if(Array.isArray(n)){t.assert(Array.isArray(r),"Cannot merge array onto an object"),!1===s&&(r.length=0);for(var a=0;a<n.length;++a)r.push(t.clone(n[a]));return r}for(var u=Object.keys(n),c=0;c<u.length;++c){var f=u[c];if("__proto__"!==f){var l=n[f];l&&"object"===(void 0===l?"undefined":i(l))?!r[f]||"object"!==i(r[f])||Array.isArray(r[f])!==Array.isArray(l)||l instanceof Date||e.isBuffer(l)||l instanceof RegExp?r[f]=t.clone(l):t.merge(r[f],l,o,s):null!==l&&void 0!==l?r[f]=l:!1!==o&&(r[f]=l)}}return r},t.applyToDefaults=function(e,r,n){if(t.assert(e&&"object"===(void 0===e?"undefined":i(e)),"Invalid defaults value: must be an object"),t.assert(!r||!0===r||"object"===(void 0===r?"undefined":i(r)),"Invalid options value: must be true, falsy or an object"),!r)return null;var o=t.clone(e);return!0===r?o:t.merge(o,r,!0===n,!1)},t.cloneWithShallow=function(e,r){if(!e||"object"!==(void 0===e?"undefined":i(e)))return e;var n=f.store(e,r),o=t.clone(e);return f.restore(o,e,n),o},f.store=function(e,r){for(var n={},i=0;i<r.length;++i){var o=r[i],s=t.reach(e,o);void 0!==s&&(n[o]=s,f.reachSet(e,o,void 0))}return n},f.restore=function(e,t,r){for(var n=Object.keys(r),i=0;i<n.length;++i){var o=n[i];f.reachSet(e,o,r[o]),f.reachSet(t,o,r[o])}},f.reachSet=function(e,t,r){for(var n=t.split("."),i=e,o=0;o<n.length;++o){var s=n[o];o+1===n.length&&(i[s]=r),i=i[s]}},t.applyToDefaultsWithShallow=function(e,r,n){if(t.assert(e&&"object"===(void 0===e?"undefined":i(e)),"Invalid defaults value: must be an object"),t.assert(!r||!0===r||"object"===(void 0===r?"undefined":i(r)),"Invalid options value: must be true, falsy or an object"),t.assert(n&&Array.isArray(n),"Invalid keys"),!r)return null;var o=t.cloneWithShallow(e,n);if(!0===r)return o;var s=f.store(r,n);return t.merge(o,r,!1,!1),f.restore(o,r,s),o},t.deepEqual=function(r,n,o,s){o=o||{prototype:!0};var a=void 0===r?"undefined":i(r);if(a!==(void 0===n?"undefined":i(n)))return!1;if("object"!==a||null===r||null===n)return r===n?0!==r||1/r==1/n:r!=r&&n!=n;if(s=s||[],-1!==s.indexOf(r))return!0;if(s.push(r),Array.isArray(r)){if(!Array.isArray(n))return!1;if(!o.part&&r.length!==n.length)return!1;for(var u=0;u<r.length;++u){if(o.part){for(var c=!1,f=0;f<n.length;++f)if(t.deepEqual(r[u],n[f],o)){c=!0;break}return c}if(!t.deepEqual(r[u],n[u],o))return!1}return!0}if(e.isBuffer(r)){if(!e.isBuffer(n))return!1;if(r.length!==n.length)return!1;for(var l=0;l<r.length;++l)if(r[l]!==n[l])return!1;return!0}if(r instanceof Date)return n instanceof Date&&r.getTime()===n.getTime();if(r instanceof RegExp)return n instanceof RegExp&&r.toString()===n.toString();if(o.prototype&&Object.getPrototypeOf(r)!==Object.getPrototypeOf(n))return!1;var h=Object.getOwnPropertyNames(r);if(!o.part&&h.length!==Object.getOwnPropertyNames(n).length)return!1;for(var p=0;p<h.length;++p){var d=h[p],y=Object.getOwnPropertyDescriptor(r,d);if(y.get){if(!t.deepEqual(y,Object.getOwnPropertyDescriptor(n,d),o,s))return!1}else if(!t.deepEqual(r[d],n[d],o,s))return!1}return!0},t.unique=function(e,t){var r=void 0;if(t){r=[];var n=new Set;e.forEach(function(e){var i=e[t];n.has(i)||(n.add(i),r.push(e))})}else r=Array.from(new Set(e));return r},t.mapToObject=function(e,t){if(!e)return null;for(var r={},n=0;n<e.length;++n)t?e[n][t]&&(r[e[n][t]]=!0):r[e[n]]=!0;return r},t.intersect=function(e,r,n){if(!e||!r)return[];for(var i=[],o=Array.isArray(e)?t.mapToObject(e):e,s={},a=0;a<r.length;++a)if(o[r[a]]&&!s[r[a]]){if(n)return r[a];i.push(r[a]),s[r[a]]=!0}return n?null:i},t.contain=function(e,r,n){var o=null;"object"!==(void 0===e?"undefined":i(e))||"object"!==(void 0===r?"undefined":i(r))||Array.isArray(e)||Array.isArray(r)?r=[].concat(r):(o=r,r=Object.keys(r)),n=n||{},t.assert("string"==typeof e||"object"===(void 0===e?"undefined":i(e)),"Reference must be string or an object"),t.assert(r.length,"Values array cannot be empty");var s=void 0,a=void 0;if(n.deep){s=t.deepEqual;var u=n.hasOwnProperty("only"),c=n.hasOwnProperty("part");a={prototype:u?n.only:!!c&&!n.part,part:u?!n.only:!c||n.part}}else s=function e(t,r){return t===r};for(var f=!1,l=new Array(r.length),h=0;h<l.length;++h)l[h]=0;if("string"==typeof e){for(var p="(",d=0;d<r.length;++d){var y=r[d];t.assert("string"==typeof y,"Cannot compare string reference to non-string value"),p+=(d?"|":"")+t.escapeRegex(y)}var g=new RegExp(p+")","g"),m=e.replace(g,function(e,t){var n=r.indexOf(t);return++l[n],""});f=!!m}else if(Array.isArray(e))for(var b=0;b<e.length;++b){for(var v=!1,_=0;_<r.length&&!1===v;++_)v=s(r[_],e[b],a)&&_;!1!==v?++l[v]:f=!0}else for(var w=Object.getOwnPropertyNames(e),S=0;S<w.length;++S){var k=w[S],E=r.indexOf(k);if(-1!==E){if(o&&!s(o[k],e[k],a))return!1;++l[E]}else f=!0}for(var A=!1,x=0;x<l.length;++x)if(A=A||!!l[x],n.once&&l[x]>1||!n.part&&!l[x])return!1;return(!n.only||!f)&&A},t.flatten=function(e,r){for(var n=r||[],i=0;i<e.length;++i)Array.isArray(e[i])?t.flatten(e[i],n):n.push(e[i]);return n},t.reach=function(e,r,n){if(!1===r||null===r||void 0===r)return e;n=n||{},"string"==typeof n&&(n={separator:n});for(var o=r.split(n.separator||"."),s=e,a=0;a<o.length;++a){var u=o[a];if("-"===u[0]&&Array.isArray(s)&&(u=u.slice(1,u.length),u=s.length-u),!s||"object"!==(void 0===s?"undefined":i(s))&&"function"!=typeof s||!(u in s)||"object"!==(void 0===s?"undefined":i(s))&&!1===n.functions){t.assert(!n.strict||a+1===o.length,"Missing segment",u,"in reach path ",r),t.assert("object"===(void 0===s?"undefined":i(s))||!0===n.functions||"function"!=typeof s,"Invalid segment",u,"in reach path ",r),s=n.default;break}s=s[u]}return s},t.reachTemplate=function(e,r,n){return r.replace(/{([^}]+)}/g,function(r,i){var o=t.reach(e,i,n);return void 0===o||null===o?"":o})},t.formatStack=function(e){for(var t=[],r=0;r<e.length;++r){var n=e[r];t.push([n.getFileName(),n.getLineNumber(),n.getColumnNumber(),n.getFunctionName(),n.isConstructor()])}return t},t.formatTrace=function(e){for(var t=[],r=0;r<e.length;++r){var n=e[r];t.push((n[4]?"new ":"")+n[3]+" ("+n[0]+":"+n[1]+":"+n[2]+")")}return t},t.callStack=function(e){var r=Error.prepareStackTrace;Error.prepareStackTrace=function(e,t){return t};var n={};Error.captureStackTrace(n,this);var i=n.stack;Error.prepareStackTrace=r;var o=t.formatStack(i);return o.slice(1+e)},t.displayStack=function(e){var r=t.callStack(void 0===e?1:e+1);return t.formatTrace(r)},t.abortThrow=!1,t.abort=function(e,r){if("test"===n.env.NODE_ENV||!0===t.abortThrow)throw new Error(e||"Unknown error");var i="";r||(i=t.displayStack(1).join("\n\t")),console.log("ABORT: "+e+"\n\t"+i),n.exit(1)},t.assert=function(e){if(!e){for(var r=arguments.length,n=Array(r>1?r-1:0),i=1;i<r;i++)n[i-1]=arguments[i];if(1===n.length&&n[0]instanceof Error)throw n[0];var s=n.filter(function(e){return""!==e}).map(function(e){return"string"==typeof e?e:e instanceof Error?e.message:t.stringify(e)});throw new o.AssertionError({message:s.join(" ")||"Unknown error",actual:!1,expected:!0,operator:"==",stackStartFunction:t.assert})}},t.Bench=function(){this.ts=0,this.reset()},t.Bench.prototype.reset=function(){this.ts=t.Bench.now()},t.Bench.prototype.elapsed=function(){return t.Bench.now()-this.ts},t.Bench.now=function(){var e=n.hrtime();return 1e3*e[0]+e[1]/1e6},t.escapeRegex=function(e){return e.replace(/[\^\$\.\*\+\-\?\=\!\:\|\\\/\(\)\[\]\{\}\,]/g,"\\$&")},t.base64urlEncode=function(r,n){t.assert("string"==typeof r||e.isBuffer(r),"value must be string or buffer");var i=e.isBuffer(r)?r:e.from(r,n||"binary");return i.toString("base64").replace(/\+/g,"-").replace(/\//g,"_").replace(/\=/g,"")},t.base64urlDecode=function(t,r){if("string"!=typeof t)throw new Error("Value not a string");if(!/^[\w\-]*$/.test(t))throw new Error("Invalid character");var n=e.from(t,"base64");return"buffer"===r?n:n.toString(r||"binary")},t.escapeHeaderAttribute=function(e){return t.assert(/^[ \w\!#\$%&'\(\)\*\+,\-\.\/\:;<\=>\?@\[\]\^`\{\|\}~\"\\]*$/.test(e),"Bad attribute value ("+e+")"),e.replace(/\\/g,"\\\\").replace(/\"/g,'\\"')},t.escapeHtml=function(e){return c.escapeHtml(e)},t.escapeJavaScript=function(e){return c.escapeJavaScript(e)},t.escapeJson=function(e){return c.escapeJson(e)},t.once=function(e){if(e._hoekOnce)return e;var t=!1,r=function r(){if(!t){t=!0;for(var n=arguments.length,i=Array(n),o=0;o<n;o++)i[o]=arguments[o];e.apply(null,i)}};return r._hoekOnce=!0,r},t.isInteger=Number.isSafeInteger,t.ignore=function(){},t.inherits=u.inherits,t.format=u.format,t.transform=function(e,r,n){t.assert(null===e||void 0===e||"object"===(void 0===e?"undefined":i(e))||Array.isArray(e),"Invalid source object: must be null, undefined, an object, or an array");var o="object"===(void 0===n?"undefined":i(n))&&null!==n&&n.separator||".";if(Array.isArray(e)){for(var s=[],a=0;a<e.length;++a)s.push(t.transform(e[a],r,n));return s}for(var u={},c=Object.keys(r),f=0;f<c.length;++f){var l=c[f],h=l.split(o),p=r[l];t.assert("string"==typeof p,'All mappings must be "." delineated strings');for(var d=void 0,y=u;h.length>1;)d=h.shift(),y[d]||(y[d]={}),y=y[d];d=h.shift(),y[d]=t.reach(e,p,n)}return u},t.uniqueFilename=function(e,t){t=t?"."!==t[0]?"."+t:t:"",e=a.resolve(e);var r=[Date.now(),n.pid,s.randomBytes(8).toString("hex")].join("-")+t;return a.join(e,r)},t.stringify=function(){try{for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];return JSON.stringify.apply(null,t)}catch(e){return"[Cannot display object: "+e.message+"]"}},t.shallow=function(e){for(var t={},r=Object.keys(e),n=0;n<r.length;++n){var i=r[n];t[i]=e[i]}return t},t.wait=function(e){return new Promise(function(t){return setTimeout(t,e)})},t.block=function(){return new Promise(t.ignore)}}).call(t,r(3).Buffer,r(7))},function(e,t,r){"use strict";var n=r(0);t.create=function(e,t){n.assert("string"==typeof e,"Invalid reference key:",e);var r=n.clone(t),i=function e(t,i){return n.reach(e.isContext?i.context:t,e.key,r)};return i.isContext=e[0]===(r&&r.contextPrefix||"$"),i.key=i.isContext?e.slice(1):e,i.path=i.key.split(r&&r.separator||"."),i.depth=i.path.length,i.root=i.path[0],i.isJoi=!0,i.toString=function(){return(i.isContext?"context:":"ref:")+i.key},i},t.isRef=function(e){return"function"==typeof e&&e.isJoi},t.push=function(e,r){t.isRef(r)&&!r.isContext&&e.push(r.root)}},function(e,t,r){"use strict";var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},i=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}();function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var s=r(0),a=r(11),u=r(1),c=r(6),f=null,l=null,h={Set:r(9),defaults:{abortEarly:!0,convert:!0,allowUnknown:!1,skipFunctions:!1,stripUnknown:!1,language:{},presence:"optional",strip:!1,noDefaults:!1,escapeHtml:!1}};e.exports=h.Any=function(){function e(){o(this,e),l=l||r(4),this.isJoi=!0,this._type="any",this._settings=null,this._valids=new h.Set,this._invalids=new h.Set,this._tests=[],this._refs=[],this._flags={},this._description=null,this._unit=null,this._notes=[],this._tags=[],this._examples=[],this._meta=[],this._inner={}}return e.prototype._init=function e(){return this},e.prototype.createError=function e(t,r,n,i){var o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:this._flags;return c.create(t,r,n,i,o)},e.prototype.createOverrideError=function e(t,r,n,i,o,s){return c.create(t,r,n,i,this._flags,o,s)},e.prototype.checkOptions=function e(t){var n=r(21),i=n.options.validate(t);if(i.error)throw new Error(i.error.details[0].message)},e.prototype.clone=function e(){var t=Object.create(Object.getPrototypeOf(this));t.isJoi=!0,t._currentJoi=this._currentJoi,t._type=this._type,t._settings=this._settings,t._baseType=this._baseType,t._valids=this._valids.slice(),t._invalids=this._invalids.slice(),t._tests=this._tests.slice(),t._refs=this._refs.slice(),t._flags=s.clone(this._flags),t._description=this._description,t._unit=this._unit,t._notes=this._notes.slice(),t._tags=this._tags.slice(),t._examples=this._examples.slice(),t._meta=this._meta.slice(),t._inner={};for(var r=Object.keys(this._inner),n=0;n<r.length;++n){var i=r[n];t._inner[i]=this._inner[i]?this._inner[i].slice():null}return t},e.prototype.concat=function e(t){s.assert(t instanceof h.Any,"Invalid schema object"),s.assert("any"===this._type||"any"===t._type||t._type===this._type,"Cannot merge type",this._type,"with another type:",t._type);var r=this.clone();if("any"===this._type&&"any"!==t._type){for(var n=t.clone(),i=["_settings","_valids","_invalids","_tests","_refs","_flags","_description","_unit","_notes","_tags","_examples","_meta","_inner"],o=0;o<i.length;++o)n[i[o]]=r[i[o]];r=n}r._settings=r._settings?a.concat(r._settings,t._settings):t._settings,r._valids.merge(t._valids,t._invalids),r._invalids.merge(t._invalids,t._valids),r._tests=r._tests.concat(t._tests),r._refs=r._refs.concat(t._refs),s.merge(r._flags,t._flags),r._description=t._description||r._description,r._unit=t._unit||r._unit,r._notes=r._notes.concat(t._notes),r._tags=r._tags.concat(t._tags),r._examples=r._examples.concat(t._examples),r._meta=r._meta.concat(t._meta);for(var u=Object.keys(t._inner),c="object"===r._type,f=0;f<u.length;++f){var l=u[f],p=t._inner[l];if(p){var d=r._inner[l];if(d)if(c&&"children"===l){for(var y={},g=0;g<d.length;++g)y[d[g].key]=g;for(var m=0;m<p.length;++m){var b=p[m].key;y[b]>=0?d[y[b]]={key:b,schema:d[y[b]].schema.concat(p[m].schema)}:d.push(p[m])}}else r._inner[l]=r._inner[l].concat(p);else r._inner[l]=p.slice()}}return r},e.prototype._test=function e(t,r,n,i){var o=this.clone();return o._tests.push({func:n,name:t,arg:r,options:i}),o},e.prototype.options=function e(t){s.assert(!t.context,"Cannot override context"),this.checkOptions(t);var r=this.clone();return r._settings=a.concat(r._settings,t),r},e.prototype.strict=function e(t){var r=this.clone(),n=void 0!==t&&!t;return r._settings=a.concat(r._settings,{convert:n}),r},e.prototype.raw=function e(t){var r=void 0===t||t;if(this._flags.raw===r)return this;var n=this.clone();return n._flags.raw=r,n},e.prototype.error=function e(t){s.assert(t&&(t instanceof Error||"function"==typeof t),"Must provide a valid Error object or a function");var r=this.clone();return r._flags.error=t,r},e.prototype.allow=function e(){for(var t=arguments.length,r=Array(t),n=0;n<t;n++)r[n]=arguments[n];var i=this.clone();r=s.flatten(r);for(var o=0;o<r.length;++o){var a=r[o];s.assert(void 0!==a,"Cannot call allow/valid/invalid with undefined"),i._invalids.remove(a),i._valids.add(a,i._refs)}return i},e.prototype.valid=function e(){var t=this.allow.apply(this,arguments);return t._flags.allowOnly=!0,t},e.prototype.invalid=function e(){for(var t=arguments.length,r=Array(t),n=0;n<t;n++)r[n]=arguments[n];var i=this.clone();r=s.flatten(r);for(var o=0;o<r.length;++o){var a=r[o];s.assert(void 0!==a,"Cannot call allow/valid/invalid with undefined"),i._valids.remove(a),i._invalids.add(a,i._refs)}return i},e.prototype.required=function e(){if("required"===this._flags.presence)return this;var t=this.clone();return t._flags.presence="required",t},e.prototype.optional=function e(){if("optional"===this._flags.presence)return this;var t=this.clone();return t._flags.presence="optional",t},e.prototype.forbidden=function e(){if("forbidden"===this._flags.presence)return this;var t=this.clone();return t._flags.presence="forbidden",t},e.prototype.strip=function e(){if(this._flags.strip)return this;var t=this.clone();return t._flags.strip=!0,t},e.prototype.applyFunctionToChildren=function e(t,r,n,i){if(t=[].concat(t),1!==t.length||""!==t[0]){i=i?i+".":"";var o=(""===t[0]?t.slice(1):t).map(function(e){return i+e});throw new Error("unknown key(s) "+o.join(", "))}return this[r].apply(this,n)},e.prototype.default=function e(t,r){"function"!=typeof t||u.isRef(t)||(!t.description&&r&&(t.description=r),this._flags.func||s.assert("string"==typeof t.description&&t.description.length>0,"description must be provided when default value is a function"));var n=this.clone();return n._flags.default=t,u.push(n._refs,t),n},e.prototype.empty=function e(t){var r=this.clone();return void 0===t?delete r._flags.empty:r._flags.empty=l.schema(this._currentJoi,t),r},e.prototype.when=function e(t,i){s.assert(i&&"object"===(void 0===i?"undefined":n(i)),"Invalid options"),s.assert(void 0!==i.then||void 0!==i.otherwise,'options must have at least one of "then" or "otherwise"');var o=i.hasOwnProperty("then")?this.concat(l.schema(this._currentJoi,i.then)):void 0,a=i.hasOwnProperty("otherwise")?this.concat(l.schema(this._currentJoi,i.otherwise)):void 0;f=f||r(10);var u={then:o,otherwise:a};Object.prototype.hasOwnProperty.call(i,"is")&&(u.is=i.is);var c=f.when(t,u);return c._flags.presence="ignore",c._baseType=this,c},e.prototype.description=function e(t){s.assert(t&&"string"==typeof t,"Description must be a non-empty string");var r=this.clone();return r._description=t,r},e.prototype.notes=function e(t){s.assert(t&&("string"==typeof t||Array.isArray(t)),"Notes must be a non-empty string or array");var r=this.clone();return r._notes=r._notes.concat(t),r},e.prototype.tags=function e(t){s.assert(t&&("string"==typeof t||Array.isArray(t)),"Tags must be a non-empty string or array");var r=this.clone();return r._tags=r._tags.concat(t),r},e.prototype.meta=function e(t){s.assert(void 0!==t,"Meta cannot be undefined");var r=this.clone();return r._meta=r._meta.concat(t),r},e.prototype.example=function e(){s.assert(1===arguments.length,"Missing example");var t=arguments.length<=0?void 0:arguments[0],r=this.clone();return r._examples.push(t),r},e.prototype.unit=function e(t){s.assert(t&&"string"==typeof t,"Unit name must be a non-empty string");var r=this.clone();return r._unit=t,r},e.prototype._prepareEmptyValue=function e(t){return"string"==typeof t&&this._flags.trim?t.trim():t},e.prototype._validate=function e(t,r,n,i){var o=this,f=t;r=r||{key:"",path:[],parent:null,reference:i},this._settings&&(n=a.concat(n,this._settings));var l=[],p=function e(){var i=void 0;if(void 0!==t)i=o._flags.raw?f:t;else if(n.noDefaults)i=t;else if(u.isRef(o._flags.default))i=o._flags.default(r.parent,n);else if("function"!=typeof o._flags.default||o._flags.func&&!o._flags.default.description)i=s.clone(o._flags.default);else{var a=void 0;null!==r.parent&&o._flags.default.length>0&&(a=[s.clone(r.parent),n]);var c=h._try(o._flags.default,a);i=c.value,c.error&&l.push(o.createError("any.default",{error:c.error},r,n))}if(l.length&&"function"==typeof o._flags.error){var p=o._flags.error.call(o,l);l="string"==typeof p?[o.createOverrideError("override",{reason:l},r,n,p)]:[].concat(p).map(function(e){return e instanceof Error?e:o.createOverrideError(e.type||"override",e.context,r,n,e.message,e.template)})}return{value:o._flags.strip?void 0:i,finalValue:i,errors:l.length?l:null}};if(this._coerce){var d=this._coerce.call(this,t,r,n);if(d.errors)return t=d.value,l=l.concat(d.errors),p();t=d.value}this._flags.empty&&!this._flags.empty._validate(this._prepareEmptyValue(t),null,h.defaults).errors&&(t=void 0);var y=this._flags.presence||n.presence;if("optional"===y){if(void 0===t){var g=this._flags.hasOwnProperty("default")&&void 0===this._flags.default;if(!g||"object"!==this._type)return p();t={}}}else{if("required"===y&&void 0===t)return l.push(this.createError("any.required",null,r,n)),p();if("forbidden"===y)return void 0===t?p():(l.push(this.createError("any.unknown",null,r,n)),p())}if(this._valids.has(t,r,n,this._flags.insensitive))return p();if(this._invalids.has(t,r,n,this._flags.insensitive)&&(l.push(this.createError(""===t?"any.empty":"any.invalid",{value:t,invalids:this._invalids.values({stripUndefined:!0})},r,n)),n.abortEarly||void 0===t))return p();if(this._base){var m=this._base.call(this,t,r,n);if(m.errors)return t=m.value,l=l.concat(m.errors),p();if(m.value!==t){if(t=m.value,this._valids.has(t,r,n,this._flags.insensitive))return p();if(this._invalids.has(t,r,n,this._flags.insensitive)&&(l.push(this.createError(""===t?"any.empty":"any.invalid",{value:t,invalids:this._invalids.values({stripUndefined:!0})},r,n)),n.abortEarly))return p()}}if(this._flags.allowOnly&&(l.push(this.createError("any.allowOnly",{value:t,valids:this._valids.values({stripUndefined:!0})},r,n)),n.abortEarly))return p();for(var b=0;b<this._tests.length;++b){var v=this._tests[b],_=v.func.call(this,t,r,n);if(_ instanceof c.Err){if(l.push(_),n.abortEarly)return p()}else t=_}return p()},e.prototype._validateWithOptions=function e(t,r,n){r&&this.checkOptions(r);var i=a.concat(h.defaults,r),o=this._validate(t,null,i),s=c.process(o.errors,t);return n?n(s,o.value):{error:s,value:o.value,then:function e(t,r){return s?Promise.reject(s).catch(r):Promise.resolve(o.value).then(t)},catch:function e(t){return s?Promise.reject(s).catch(t):Promise.resolve(o.value)}}},e.prototype.validate=function e(t,r,n){return"function"==typeof r?this._validateWithOptions(t,null,r):this._validateWithOptions(t,r,n)},e.prototype.describe=function e(){var t=this,r={type:this._type},n=Object.keys(this._flags);if(n.length)if(["empty","default","lazy","label"].some(function(e){return t._flags.hasOwnProperty(e)})){r.flags={};for(var i=0;i<n.length;++i){var o=n[i];"empty"===o?r.flags[o]=this._flags[o].describe():"default"===o?u.isRef(this._flags[o])?r.flags[o]=this._flags[o].toString():"function"==typeof this._flags[o]?r.flags[o]={description:this._flags[o].description,function:this._flags[o]}:r.flags[o]=this._flags[o]:"lazy"===o||"label"===o||(r.flags[o]=this._flags[o])}}else r.flags=this._flags;this._settings&&(r.options=s.clone(this._settings)),this._baseType&&(r.base=this._baseType.describe()),this._description&&(r.description=this._description),this._notes.length&&(r.notes=this._notes),this._tags.length&&(r.tags=this._tags),this._meta.length&&(r.meta=this._meta),this._examples.length&&(r.examples=this._examples),this._unit&&(r.unit=this._unit);var a=this._valids.values();a.length&&(r.valids=a.map(function(e){return u.isRef(e)?e.toString():e}));var c=this._invalids.values();c.length&&(r.invalids=c.map(function(e){return u.isRef(e)?e.toString():e})),r.rules=[];for(var f=0;f<this._tests.length;++f){var l=this._tests[f],h={name:l.name};void 0!==l.arg&&(h.arg=u.isRef(l.arg)?l.arg.toString():l.arg);var p=l.options;if(p){if(p.hasRef){h.arg={};for(var d=Object.keys(l.arg),y=0;y<d.length;++y){var g=d[y],m=l.arg[g];h.arg[g]=u.isRef(m)?m.toString():m}}"string"==typeof p.description?h.description=p.description:"function"==typeof p.description&&(h.description=p.description(h.arg))}r.rules.push(h)}r.rules.length||delete r.rules;var b=this._getLabel();return b&&(r.label=b),r},e.prototype.label=function e(t){s.assert(t&&"string"==typeof t,"Label name must be a non-empty string");var r=this.clone();return r._flags.label=t,r},e.prototype._getLabel=function e(t){return this._flags.label||t},i(e,[{key:"schemaType",get:function e(){return this._type}}]),e}(),h.Any.prototype.isImmutable=!0,h.Any.prototype.only=h.Any.prototype.equal=h.Any.prototype.valid,h.Any.prototype.disallow=h.Any.prototype.not=h.Any.prototype.invalid,h.Any.prototype.exist=h.Any.prototype.required,h._try=function(e,t){var r=void 0,n=void 0;try{n=e.apply(null,t)}catch(e){r=e}return{value:n,error:r}}},function(e,t,r){"use strict";(function(e){
|
||
/*!
|
||
* The buffer module from node.js, for the browser.
|
||
*
|
||
* @author Feross Aboukhadijeh <feross@feross.org> <http://feross.org>
|
||
* @license MIT
|
||
*/
|
||
var n=r(33),i=r(34),o=r(35);function s(){try{var e=new Uint8Array(1);return e.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===e.foo()&&"function"==typeof e.subarray&&0===e.subarray(1,1).byteLength}catch(e){return!1}}function a(){return c.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function u(e,t){if(a()<t)throw new RangeError("Invalid typed array length");return c.TYPED_ARRAY_SUPPORT?(e=new Uint8Array(t),e.__proto__=c.prototype):(null===e&&(e=new c(t)),e.length=t),e}function c(e,t,r){if(!(c.TYPED_ARRAY_SUPPORT||this instanceof c))return new c(e,t,r);if("number"==typeof e){if("string"==typeof t)throw new Error("If encoding is specified then the first argument must be a string");return p(this,e)}return f(this,e,t,r)}function f(e,t,r,n){if("number"==typeof t)throw new TypeError('"value" argument must not be a number');return"undefined"!=typeof ArrayBuffer&&t instanceof ArrayBuffer?g(e,t,r,n):"string"==typeof t?d(e,t,r):m(e,t)}function l(e){if("number"!=typeof e)throw new TypeError('"size" argument must be a number');if(e<0)throw new RangeError('"size" argument must not be negative')}function h(e,t,r,n){return l(t),t<=0?u(e,t):void 0!==r?"string"==typeof n?u(e,t).fill(r,n):u(e,t).fill(r):u(e,t)}function p(e,t){if(l(t),e=u(e,t<0?0:0|b(t)),!c.TYPED_ARRAY_SUPPORT)for(var r=0;r<t;++r)e[r]=0;return e}function d(e,t,r){if("string"==typeof r&&""!==r||(r="utf8"),!c.isEncoding(r))throw new TypeError('"encoding" must be a valid string encoding');var n=0|_(t,r);e=u(e,n);var i=e.write(t,r);return i!==n&&(e=e.slice(0,i)),e}function y(e,t){var r=t.length<0?0:0|b(t.length);e=u(e,r);for(var n=0;n<r;n+=1)e[n]=255&t[n];return e}function g(e,t,r,n){if(t.byteLength,r<0||t.byteLength<r)throw new RangeError("'offset' is out of bounds");if(t.byteLength<r+(n||0))throw new RangeError("'length' is out of bounds");return t=void 0===r&&void 0===n?new Uint8Array(t):void 0===n?new Uint8Array(t,r):new Uint8Array(t,r,n),c.TYPED_ARRAY_SUPPORT?(e=t,e.__proto__=c.prototype):e=y(e,t),e}function m(e,t){if(c.isBuffer(t)){var r=0|b(t.length);return e=u(e,r),0===e.length?e:(t.copy(e,0,0,r),e)}if(t){if("undefined"!=typeof ArrayBuffer&&t.buffer instanceof ArrayBuffer||"length"in t)return"number"!=typeof t.length||te(t.length)?u(e,0):y(e,t);if("Buffer"===t.type&&o(t.data))return y(e,t.data)}throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}function b(e){if(e>=a())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+a().toString(16)+" bytes");return 0|e}function v(e){return+e!=e&&(e=0),c.alloc(+e)}function _(e,t){if(c.isBuffer(e))return e.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(e)||e instanceof ArrayBuffer))return e.byteLength;"string"!=typeof e&&(e=""+e);var r=e.length;if(0===r)return 0;for(var n=!1;;)switch(t){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":case void 0:return J(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return Q(e).length;default:if(n)return J(e).length;t=(""+t).toLowerCase(),n=!0}}function w(e,t,r){var n=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if(r>>>=0,t>>>=0,r<=t)return"";for(e||(e="utf8");;)switch(e){case"hex":return M(this,t,r);case"utf8":case"utf-8":return O(this,t,r);case"ascii":return L(this,t,r);case"latin1":case"binary":return j(this,t,r);case"base64":return P(this,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return K(this,t,r);default:if(n)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),n=!0}}function S(e,t,r){var n=e[t];e[t]=e[r],e[r]=n}function k(e,t,r,n,i){if(0===e.length)return-1;if("string"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,isNaN(r)&&(r=i?0:e.length-1),r<0&&(r=e.length+r),r>=e.length){if(i)return-1;r=e.length-1}else if(r<0){if(!i)return-1;r=0}if("string"==typeof t&&(t=c.from(t,n)),c.isBuffer(t))return 0===t.length?-1:E(e,t,r,n,i);if("number"==typeof t)return t&=255,c.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(e,t,r):Uint8Array.prototype.lastIndexOf.call(e,t,r):E(e,[t],r,n,i);throw new TypeError("val must be string, number or Buffer")}function E(e,t,r,n,i){var o=1,s=e.length,a=t.length,u;if(void 0!==n&&(n=String(n).toLowerCase(),"ucs2"===n||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(e.length<2||t.length<2)return-1;o=2,s/=2,a/=2,r/=2}function c(e,t){return 1===o?e[t]:e.readUInt16BE(t*o)}if(i){var f=-1;for(u=r;u<s;u++)if(c(e,u)===c(t,-1===f?0:u-f)){if(-1===f&&(f=u),u-f+1===a)return f*o}else-1!==f&&(u-=u-f),f=-1}else for(r+a>s&&(r=s-a),u=r;u>=0;u--){for(var l=!0,h=0;h<a;h++)if(c(e,u+h)!==c(t,h)){l=!1;break}if(l)return u}return-1}function A(e,t,r,n){r=Number(r)||0;var i=e.length-r;n?(n=Number(n),n>i&&(n=i)):n=i;var o=t.length;if(o%2!=0)throw new TypeError("Invalid hex string");n>o/2&&(n=o/2);for(var s=0;s<n;++s){var a=parseInt(t.substr(2*s,2),16);if(isNaN(a))return s;e[r+s]=a}return s}function x(e,t,r,n){return ee(J(t,e.length-r),e,r,n)}function I(e,t,r,n){return ee(X(t),e,r,n)}function T(e,t,r,n){return I(e,t,r,n)}function B(e,t,r,n){return ee(Q(t),e,r,n)}function C(e,t,r,n){return ee(Z(t,e.length-r),e,r,n)}function P(e,t,r){return 0===t&&r===e.length?n.fromByteArray(e):n.fromByteArray(e.slice(t,r))}function O(e,t,r){r=Math.min(e.length,r);for(var n=[],i=t;i<r;){var o=e[i],s=null,a=o>239?4:o>223?3:o>191?2:1,u,c,f,l;if(i+a<=r)switch(a){case 1:o<128&&(s=o);break;case 2:u=e[i+1],128==(192&u)&&(l=(31&o)<<6|63&u,l>127&&(s=l));break;case 3:u=e[i+1],c=e[i+2],128==(192&u)&&128==(192&c)&&(l=(15&o)<<12|(63&u)<<6|63&c,l>2047&&(l<55296||l>57343)&&(s=l));break;case 4:u=e[i+1],c=e[i+2],f=e[i+3],128==(192&u)&&128==(192&c)&&128==(192&f)&&(l=(15&o)<<18|(63&u)<<12|(63&c)<<6|63&f,l>65535&&l<1114112&&(s=l))}null===s?(s=65533,a=1):s>65535&&(s-=65536,n.push(s>>>10&1023|55296),s=56320|1023&s),n.push(s),i+=a}return N(n)}t.Buffer=c,t.SlowBuffer=v,t.INSPECT_MAX_BYTES=50,c.TYPED_ARRAY_SUPPORT=void 0!==e.TYPED_ARRAY_SUPPORT?e.TYPED_ARRAY_SUPPORT:s(),t.kMaxLength=a(),c.poolSize=8192,c._augment=function(e){return e.__proto__=c.prototype,e},c.from=function(e,t,r){return f(null,e,t,r)},c.TYPED_ARRAY_SUPPORT&&(c.prototype.__proto__=Uint8Array.prototype,c.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&c[Symbol.species]===c&&Object.defineProperty(c,Symbol.species,{value:null,configurable:!0})),c.alloc=function(e,t,r){return h(null,e,t,r)},c.allocUnsafe=function(e){return p(null,e)},c.allocUnsafeSlow=function(e){return p(null,e)},c.isBuffer=function e(t){return!(null==t||!t._isBuffer)},c.compare=function e(t,r){if(!c.isBuffer(t)||!c.isBuffer(r))throw new TypeError("Arguments must be Buffers");if(t===r)return 0;for(var n=t.length,i=r.length,o=0,s=Math.min(n,i);o<s;++o)if(t[o]!==r[o]){n=t[o],i=r[o];break}return n<i?-1:i<n?1:0},c.isEncoding=function e(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}},c.concat=function e(t,r){if(!o(t))throw new TypeError('"list" argument must be an Array of Buffers');if(0===t.length)return c.alloc(0);var n;if(void 0===r)for(r=0,n=0;n<t.length;++n)r+=t[n].length;var i=c.allocUnsafe(r),s=0;for(n=0;n<t.length;++n){var a=t[n];if(!c.isBuffer(a))throw new TypeError('"list" argument must be an Array of Buffers');a.copy(i,s),s+=a.length}return i},c.byteLength=_,c.prototype._isBuffer=!0,c.prototype.swap16=function e(){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)S(this,r,r+1);return this},c.prototype.swap32=function e(){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)S(this,r,r+3),S(this,r+1,r+2);return this},c.prototype.swap64=function e(){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)S(this,r,r+7),S(this,r+1,r+6),S(this,r+2,r+5),S(this,r+3,r+4);return this},c.prototype.toString=function e(){var t=0|this.length;return 0===t?"":0===arguments.length?O(this,0,t):w.apply(this,arguments)},c.prototype.equals=function e(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 e(){var r="",n=t.INSPECT_MAX_BYTES;return this.length>0&&(r=this.toString("hex",0,n).match(/.{2}/g).join(" "),this.length>n&&(r+=" ... ")),"<Buffer "+r+">"},c.prototype.compare=function e(t,r,n,i,o){if(!c.isBuffer(t))throw new TypeError("Argument must be a Buffer");if(void 0===r&&(r=0),void 0===n&&(n=t?t.length:0),void 0===i&&(i=0),void 0===o&&(o=this.length),r<0||n>t.length||i<0||o>this.length)throw new RangeError("out of range index");if(i>=o&&r>=n)return 0;if(i>=o)return-1;if(r>=n)return 1;if(r>>>=0,n>>>=0,i>>>=0,o>>>=0,this===t)return 0;for(var s=o-i,a=n-r,u=Math.min(s,a),f=this.slice(i,o),l=t.slice(r,n),h=0;h<u;++h)if(f[h]!==l[h]){s=f[h],a=l[h];break}return s<a?-1:a<s?1:0},c.prototype.includes=function e(t,r,n){return-1!==this.indexOf(t,r,n)},c.prototype.indexOf=function e(t,r,n){return k(this,t,r,n,!0)},c.prototype.lastIndexOf=function e(t,r,n){return k(this,t,r,n,!1)},c.prototype.write=function e(t,r,n,i){if(void 0===r)i="utf8",n=this.length,r=0;else if(void 0===n&&"string"==typeof r)i=r,n=this.length,r=0;else{if(!isFinite(r))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");r|=0,isFinite(n)?(n|=0,void 0===i&&(i="utf8")):(i=n,n=void 0)}var o=this.length-r;if((void 0===n||n>o)&&(n=o),t.length>0&&(n<0||r<0)||r>this.length)throw new RangeError("Attempt to write outside buffer bounds");i||(i="utf8");for(var s=!1;;)switch(i){case"hex":return A(this,t,r,n);case"utf8":case"utf-8":return x(this,t,r,n);case"ascii":return I(this,t,r,n);case"latin1":case"binary":return T(this,t,r,n);case"base64":return B(this,t,r,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return C(this,t,r,n);default:if(s)throw new TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),s=!0}},c.prototype.toJSON=function e(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var R=4096;function N(e){var t=e.length;if(t<=R)return String.fromCharCode.apply(String,e);for(var r="",n=0;n<t;)r+=String.fromCharCode.apply(String,e.slice(n,n+=R));return r}function L(e,t,r){var n="";r=Math.min(e.length,r);for(var i=t;i<r;++i)n+=String.fromCharCode(127&e[i]);return n}function j(e,t,r){var n="";r=Math.min(e.length,r);for(var i=t;i<r;++i)n+=String.fromCharCode(e[i]);return n}function M(e,t,r){var n=e.length;(!t||t<0)&&(t=0),(!r||r<0||r>n)&&(r=n);for(var i="",o=t;o<r;++o)i+=Y(e[o]);return i}function K(e,t,r){for(var n=e.slice(t,r),i="",o=0;o<n.length;o+=2)i+=String.fromCharCode(n[o]+256*n[o+1]);return i}function D(e,t,r){if(e%1!=0||e<0)throw new RangeError("offset is not uint");if(e+t>r)throw new RangeError("Trying to access beyond buffer length")}function U(e,t,r,n,i,o){if(!c.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>i||t<o)throw new RangeError('"value" argument is out of bounds');if(r+n>e.length)throw new RangeError("Index out of range")}function F(e,t,r,n){t<0&&(t=65535+t+1);for(var i=0,o=Math.min(e.length-r,2);i<o;++i)e[r+i]=(t&255<<8*(n?i:1-i))>>>8*(n?i:1-i)}function q(e,t,r,n){t<0&&(t=4294967295+t+1);for(var i=0,o=Math.min(e.length-r,4);i<o;++i)e[r+i]=t>>>8*(n?i:3-i)&255}function H(e,t,r,n,i,o){if(r+n>e.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function z(e,t,r,n,o){return o||H(e,t,r,4,3.4028234663852886e38,-3.4028234663852886e38),i.write(e,t,r,n,23,4),r+4}function V(e,t,r,n,o){return o||H(e,t,r,8,1.7976931348623157e308,-1.7976931348623157e308),i.write(e,t,r,n,52,8),r+8}c.prototype.slice=function e(t,r){var n=this.length,i;if(t=~~t,r=void 0===r?n:~~r,t<0?(t+=n,t<0&&(t=0)):t>n&&(t=n),r<0?(r+=n,r<0&&(r=0)):r>n&&(r=n),r<t&&(r=t),c.TYPED_ARRAY_SUPPORT)i=this.subarray(t,r),i.__proto__=c.prototype;else{var o=r-t;i=new c(o,void 0);for(var s=0;s<o;++s)i[s]=this[s+t]}return i},c.prototype.readUIntLE=function e(t,r,n){t|=0,r|=0,n||D(t,r,this.length);for(var i=this[t],o=1,s=0;++s<r&&(o*=256);)i+=this[t+s]*o;return i},c.prototype.readUIntBE=function e(t,r,n){t|=0,r|=0,n||D(t,r,this.length);for(var i=this[t+--r],o=1;r>0&&(o*=256);)i+=this[t+--r]*o;return i},c.prototype.readUInt8=function e(t,r){return r||D(t,1,this.length),this[t]},c.prototype.readUInt16LE=function e(t,r){return r||D(t,2,this.length),this[t]|this[t+1]<<8},c.prototype.readUInt16BE=function e(t,r){return r||D(t,2,this.length),this[t]<<8|this[t+1]},c.prototype.readUInt32LE=function e(t,r){return r||D(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},c.prototype.readUInt32BE=function e(t,r){return r||D(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},c.prototype.readIntLE=function e(t,r,n){t|=0,r|=0,n||D(t,r,this.length);for(var i=this[t],o=1,s=0;++s<r&&(o*=256);)i+=this[t+s]*o;return o*=128,i>=o&&(i-=Math.pow(2,8*r)),i},c.prototype.readIntBE=function e(t,r,n){t|=0,r|=0,n||D(t,r,this.length);for(var i=r,o=1,s=this[t+--i];i>0&&(o*=256);)s+=this[t+--i]*o;return o*=128,s>=o&&(s-=Math.pow(2,8*r)),s},c.prototype.readInt8=function e(t,r){return r||D(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},c.prototype.readInt16LE=function e(t,r){r||D(t,2,this.length);var n=this[t]|this[t+1]<<8;return 32768&n?4294901760|n:n},c.prototype.readInt16BE=function e(t,r){r||D(t,2,this.length);var n=this[t+1]|this[t]<<8;return 32768&n?4294901760|n:n},c.prototype.readInt32LE=function e(t,r){return r||D(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},c.prototype.readInt32BE=function e(t,r){return r||D(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},c.prototype.readFloatLE=function e(t,r){return r||D(t,4,this.length),i.read(this,t,!0,23,4)},c.prototype.readFloatBE=function e(t,r){return r||D(t,4,this.length),i.read(this,t,!1,23,4)},c.prototype.readDoubleLE=function e(t,r){return r||D(t,8,this.length),i.read(this,t,!0,52,8)},c.prototype.readDoubleBE=function e(t,r){return r||D(t,8,this.length),i.read(this,t,!1,52,8)},c.prototype.writeUIntLE=function e(t,r,n,i){if(t=+t,r|=0,n|=0,!i){var o=Math.pow(2,8*n)-1;U(this,t,r,n,o,0)}var s=1,a=0;for(this[r]=255&t;++a<n&&(s*=256);)this[r+a]=t/s&255;return r+n},c.prototype.writeUIntBE=function e(t,r,n,i){if(t=+t,r|=0,n|=0,!i){var o=Math.pow(2,8*n)-1;U(this,t,r,n,o,0)}var s=n-1,a=1;for(this[r+s]=255&t;--s>=0&&(a*=256);)this[r+s]=t/a&255;return r+n},c.prototype.writeUInt8=function e(t,r,n){return t=+t,r|=0,n||U(this,t,r,1,255,0),c.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),this[r]=255&t,r+1},c.prototype.writeUInt16LE=function e(t,r,n){return t=+t,r|=0,n||U(this,t,r,2,65535,0),c.TYPED_ARRAY_SUPPORT?(this[r]=255&t,this[r+1]=t>>>8):F(this,t,r,!0),r+2},c.prototype.writeUInt16BE=function e(t,r,n){return t=+t,r|=0,n||U(this,t,r,2,65535,0),c.TYPED_ARRAY_SUPPORT?(this[r]=t>>>8,this[r+1]=255&t):F(this,t,r,!1),r+2},c.prototype.writeUInt32LE=function e(t,r,n){return t=+t,r|=0,n||U(this,t,r,4,4294967295,0),c.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},c.prototype.writeUInt32BE=function e(t,r,n){return t=+t,r|=0,n||U(this,t,r,4,4294967295,0),c.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},c.prototype.writeIntLE=function e(t,r,n,i){if(t=+t,r|=0,!i){var o=Math.pow(2,8*n-1);U(this,t,r,n,o-1,-o)}var s=0,a=1,u=0;for(this[r]=255&t;++s<n&&(a*=256);)t<0&&0===u&&0!==this[r+s-1]&&(u=1),this[r+s]=(t/a>>0)-u&255;return r+n},c.prototype.writeIntBE=function e(t,r,n,i){if(t=+t,r|=0,!i){var o=Math.pow(2,8*n-1);U(this,t,r,n,o-1,-o)}var s=n-1,a=1,u=0;for(this[r+s]=255&t;--s>=0&&(a*=256);)t<0&&0===u&&0!==this[r+s+1]&&(u=1),this[r+s]=(t/a>>0)-u&255;return r+n},c.prototype.writeInt8=function e(t,r,n){return t=+t,r|=0,n||U(this,t,r,1,127,-128),c.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),t<0&&(t=255+t+1),this[r]=255&t,r+1},c.prototype.writeInt16LE=function e(t,r,n){return t=+t,r|=0,n||U(this,t,r,2,32767,-32768),c.TYPED_ARRAY_SUPPORT?(this[r]=255&t,this[r+1]=t>>>8):F(this,t,r,!0),r+2},c.prototype.writeInt16BE=function e(t,r,n){return t=+t,r|=0,n||U(this,t,r,2,32767,-32768),c.TYPED_ARRAY_SUPPORT?(this[r]=t>>>8,this[r+1]=255&t):F(this,t,r,!1),r+2},c.prototype.writeInt32LE=function e(t,r,n){return t=+t,r|=0,n||U(this,t,r,4,2147483647,-2147483648),c.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},c.prototype.writeInt32BE=function e(t,r,n){return t=+t,r|=0,n||U(this,t,r,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),c.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},c.prototype.writeFloatLE=function e(t,r,n){return z(this,t,r,!0,n)},c.prototype.writeFloatBE=function e(t,r,n){return z(this,t,r,!1,n)},c.prototype.writeDoubleLE=function e(t,r,n){return V(this,t,r,!0,n)},c.prototype.writeDoubleBE=function e(t,r,n){return V(this,t,r,!1,n)},c.prototype.copy=function e(t,r,n,i){if(n||(n=0),i||0===i||(i=this.length),r>=t.length&&(r=t.length),r||(r=0),i>0&&i<n&&(i=n),i===n)return 0;if(0===t.length||0===this.length)return 0;if(r<0)throw new RangeError("targetStart out of bounds");if(n<0||n>=this.length)throw new RangeError("sourceStart out of bounds");if(i<0)throw new RangeError("sourceEnd out of bounds");i>this.length&&(i=this.length),t.length-r<i-n&&(i=t.length-r+n);var o=i-n,s;if(this===t&&n<r&&r<i)for(s=o-1;s>=0;--s)t[s+r]=this[s+n];else if(o<1e3||!c.TYPED_ARRAY_SUPPORT)for(s=0;s<o;++s)t[s+r]=this[s+n];else Uint8Array.prototype.set.call(t,this.subarray(n,n+o),r);return o},c.prototype.fill=function e(t,r,n,i){if("string"==typeof t){if("string"==typeof r?(i=r,r=0,n=this.length):"string"==typeof n&&(i=n,n=this.length),1===t.length){var o=t.charCodeAt(0);o<256&&(t=o)}if(void 0!==i&&"string"!=typeof i)throw new TypeError("encoding must be a string");if("string"==typeof i&&!c.isEncoding(i))throw new TypeError("Unknown encoding: "+i)}else"number"==typeof t&&(t&=255);if(r<0||this.length<r||this.length<n)throw new RangeError("Out of range index");if(n<=r)return this;var s;if(r>>>=0,n=void 0===n?this.length:n>>>0,t||(t=0),"number"==typeof t)for(s=r;s<n;++s)this[s]=t;else{var a=c.isBuffer(t)?t:J(new c(t,i).toString()),u=a.length;for(s=0;s<n-r;++s)this[s+r]=a[s%u]}return this};var G=/[^+\/0-9A-Za-z-_]/g;function W(e){if(e=$(e).replace(G,""),e.length<2)return"";for(;e.length%4!=0;)e+="=";return e}function $(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")}function Y(e){return e<16?"0"+e.toString(16):e.toString(16)}function J(e,t){var r;t=t||1/0;for(var n=e.length,i=null,o=[],s=0;s<n;++s){if(r=e.charCodeAt(s),r>55295&&r<57344){if(!i){if(r>56319){(t-=3)>-1&&o.push(239,191,189);continue}if(s+1===n){(t-=3)>-1&&o.push(239,191,189);continue}i=r;continue}if(r<56320){(t-=3)>-1&&o.push(239,191,189),i=r;continue}r=65536+(i-55296<<10|r-56320)}else i&&(t-=3)>-1&&o.push(239,191,189);if(i=null,r<128){if((t-=1)<0)break;o.push(r)}else if(r<2048){if((t-=2)<0)break;o.push(r>>6|192,63&r|128)}else if(r<65536){if((t-=3)<0)break;o.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;o.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return o}function X(e){for(var t=[],r=0;r<e.length;++r)t.push(255&e.charCodeAt(r));return t}function Z(e,t){for(var r,n,i,o=[],s=0;s<e.length&&!((t-=2)<0);++s)r=e.charCodeAt(s),n=r>>8,i=r%256,o.push(i),o.push(n);return o}function Q(e){return n.toByteArray(W(e))}function ee(e,t,r,n){for(var i=0;i<n&&!(i+r>=t.length||i>=e.length);++i)t[i+r]=e[i];return i}function te(e){return e!=e}}).call(t,r(5))},function(e,t,r){"use strict";var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},i=r(0),o=r(1);t.schema=function(e,t){return void 0!==t&&null!==t&&"object"===(void 0===t?"undefined":n(t))?t.isJoi?t:Array.isArray(t)?e.alternatives().try(t):t instanceof RegExp?e.string().regex(t):t instanceof Date?e.date().valid(t):e.object().keys(t):"string"==typeof t?e.string().valid(t):"number"==typeof t?e.number().valid(t):"boolean"==typeof t?e.boolean().valid(t):o.isRef(t)?e.valid(t):(i.assert(null===t,"Invalid schema content:",t),e.valid(null))},t.ref=function(e){return o.isRef(e)?e:o.create(e)}},function(e,t){var r;r=function(){return this}();try{r=r||Function("return this")()||(0,eval)("this")}catch(e){"object"==typeof window&&(r=window)}e.exports=r},function(e,t,r){"use strict";var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var o=r(0),s=r(20),a={annotations:Symbol("joi-annotations"),stringify:function(e,r){var i=void 0===e?"undefined":n(e);if(null===e)return"null";if("string"===i)return e;if(e instanceof t.Err||"function"===i||"symbol"===i)return e.toString();if("object"===i){if(Array.isArray(e)){for(var o="",s=0;s<e.length;++s)o=o+(o.length?", ":"")+a.stringify(e[s],r);return r?"["+o+"]":o}return e.toString()}return JSON.stringify(e)}};t.Err=function(){function e(t,r,n,o,a,u,c){i(this,e),this.isJoi=!0,this.type=t,this.context=r||{},this.context.key=n.path[n.path.length-1],this.context.label=n.key,this.path=n.path,this.options=o,this.flags=a,this.message=u,this.template=c;var f=this.options.language;this.flags.label?this.context.label=this.flags.label:!f||""!==this.context.label&&null!==this.context.label||(this.context.label=f.root||s.errors.root)}return e.prototype.toString=function e(){var t=this;if(this.message)return this.message;var r=void 0;this.template&&(r=this.template);var n=this.options.language;if(r=r||o.reach(n,this.type)||o.reach(s.errors,this.type),void 0===r)return'Error code "'+this.type+'" is not defined, your custom type is missing the correct language definition';var i=o.reach(n,"messages.wrapArrays");if("boolean"!=typeof i&&(i=s.errors.messages.wrapArrays),null===r){var u=a.stringify(this.context.reason,i);return i?u.slice(1,-1):u}var c=/\{\{\!?label\}\}/.test(r),f=r.length>2&&"!"===r[0]&&"!"===r[1];if(f&&(r=r.slice(2)),!c&&!f){var l=o.reach(n,"key");r="string"==typeof l?l+r:o.reach(s.errors,"key")+r}return r.replace(/\{\{(\!?)([^}]+)\}\}/g,function(e,r,n){var s=o.reach(t.context,n),u=a.stringify(s,i);return r&&t.options.escapeHtml?o.escapeHtml(u):u})},e}(),t.create=function(e,r,n,i,o,s,a){return new t.Err(e,r,n,i,o,s,a)},t.process=function(e,t){if(!e||!e.length)return null;var r="",n=[],i=function e(t,i){for(var o=0;o<t.length;++o){var s=t[o];if(s instanceof Error)return s;if(s.flags.error&&"function"!=typeof s.flags.error)return s.flags.error;var a=void 0;if(void 0===i&&(a=s.toString(),r=r+(r?". ":"")+a),s.context.reason&&s.context.reason.length){var u=e(s.context.reason,s.path);if(u)return u}else n.push({message:a||s.toString(),path:s.path,type:s.type,context:s.context})}},o=i(e);if(o)return o;var s=new Error(r);return s.isJoi=!0,s.name="ValidationError",s.details=n,s._object=t,s.annotate=a.annotate,s},a.safeStringify=function(e,t){return JSON.stringify(e,a.serializer(),t)},a.serializer=function(){var e=[],t=[],r=function r(n,i){return t[0]===i?"[Circular ~]":"[Circular ~."+e.slice(0,t.indexOf(i)).join(".")+"]"};return function(i,o){if(t.length>0){var s=t.indexOf(this);~s?(t.length=s+1,e.length=s+1,e[s]=i):(t.push(this),e.push(i)),~t.indexOf(o)&&(o=r.call(this,i,o))}else t.push(o);if(o){var u=o[a.annotations];if(u){if(Array.isArray(o)){for(var c=[],f=0;f<o.length;++f)u.errors[f]&&c.push("_$idx$_"+u.errors[f].sort().join(", ")+"_$end$_"),c.push(o[f]);o=c}else{for(var l=Object.keys(u.errors),h=0;h<l.length;++h){var p=l[h];o[p+"_$key$_"+u.errors[p].sort().join(", ")+"_$end$_"]=o[p],o[p]=void 0}for(var d=Object.keys(u.missing),y=0;y<d.length;++y){var g=d[y];o["_$miss$_"+g+"|"+u.missing[g]+"_$end$_"]="__missing__"}}return o}}return o===1/0||o===-1/0||Number.isNaN(o)||"function"==typeof o||"symbol"===(void 0===o?"undefined":n(o))?"["+o.toString()+"]":o}},a.annotate=function(e){var t=e?"":"[31m",r=e?"":"[41m",i=e?"":"[0m";if("object"!==n(this._object))return this.details[0].message;for(var s=o.clone(this._object||{}),u=this.details.length-1;u>=0;--u)for(var c=u+1,f=this.details[u],l=f.path,h=s,p=0;;++p){var d=l[p];if(h.isImmutable&&(h=h.clone()),!(p+1<l.length&&h[d]&&"string"!=typeof h[d])){var y=h[a.annotations]=h[a.annotations]||{errors:{},missing:{}},g=h[d],m=d||f.context.label;void 0!==g?(y.errors[m]=y.errors[m]||[],y.errors[m].push(c)):y.missing[m]=c;break}h=h[d]}var b=/_\$key\$_([, \d]+)_\$end\$_\"/g,v=/\"_\$miss\$_([^\|]+)\|(\d+)_\$end\$_\"\: \"__missing__\"/g,_=/\s*\"_\$idx\$_([, \d]+)_\$end\$_\",?\n(.*)/g,w=/"\[(NaN|Symbol.*|-?Infinity|function.*|\(.*)\]"/g,S=a.safeStringify(s,2).replace(b,function(e,r){return'" '+t+"["+r+"]"+i}).replace(v,function(e,n,o){return r+'"'+n+'"'+i+t+" ["+o+"]: -- missing --"+i}).replace(_,function(e,r,n){return"\n"+n+" "+t+"["+r+"]"+i}).replace(w,function(e,t){return t});S=S+"\n"+t;for(var k=0;k<this.details.length;++k){var E=k+1;S=S+"\n["+E+"] "+this.details[k].message}return S+=i,S}},function(e,t){var r=e.exports={},n,i;function o(){throw new Error("setTimeout has not been defined")}function s(){throw new Error("clearTimeout has not been defined")}function a(e){if(n===setTimeout)return setTimeout(e,0);if((n===o||!n)&&setTimeout)return n=setTimeout,setTimeout(e,0);try{return n(e,0)}catch(t){try{return n.call(null,e,0)}catch(t){return n.call(this,e,0)}}}function u(e){if(i===clearTimeout)return clearTimeout(e);if((i===s||!i)&&clearTimeout)return i=clearTimeout,clearTimeout(e);try{return i(e)}catch(t){try{return i.call(null,e)}catch(t){return i.call(this,e)}}}!function(){try{n="function"==typeof setTimeout?setTimeout:o}catch(e){n=o}try{i="function"==typeof clearTimeout?clearTimeout:s}catch(e){i=s}}();var c=[],f=!1,l,h=-1;function p(){f&&l&&(f=!1,l.length?c=l.concat(c):h=-1,c.length&&d())}function d(){if(!f){var e=a(p);f=!0;for(var t=c.length;t;){for(l=c,c=[];++h<t;)l&&l[h].run();h=-1,t=c.length}l=null,f=!1,u(e)}}function y(e,t){this.fun=e,this.array=t}function g(){}r.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)t[r-1]=arguments[r];c.push(new y(e,t)),1!==c.length||f||a(d)},y.prototype.run=function(){this.fun.apply(null,this.array)},r.title="browser",r.browser=!0,r.env={},r.argv=[],r.version="",r.versions={},r.on=g,r.addListener=g,r.once=g,r.off=g,r.removeListener=g,r.removeAllListeners=g,r.emit=g,r.prependListener=g,r.prependOnceListener=g,r.listeners=function(e){return[]},r.binding=function(e){throw new Error("process.binding is not supported")},r.cwd=function(){return"/"},r.chdir=function(e){throw new Error("process.chdir is not supported")},r.umask=function(){return 0}},function(e,t,r){"use strict";var n=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e};function i(e,t){for(var r=Object.getOwnPropertyNames(t),n=0;n<r.length;n++){var i=r[n],o=Object.getOwnPropertyDescriptor(t,i);o&&o.configurable&&void 0===e[i]&&Object.defineProperty(e,i,o)}return e}function o(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function s(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function u(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):i(e,t))}function c(e){if(Array.isArray(e)){for(var t=0,r=Array(e.length);t<e.length;t++)r[t]=e[t];return r}return Array.from(e)}var f=r(0),l=r(2),h=r(4),p=r(6),d=r(26),y=r(1),g=r(11),m={alternatives:r(10),array:r(22),boolean:r(24),binary:r(23),date:r(12),func:r(25),number:r(27),object:r(13),string:r(28),callWithDefaults:function(e,t){var r;return f.assert(this,"Must be invoked on a Joi instance."),this._defaults&&(e=this._defaults(e)),e._currentJoi=this,(r=e)._init.apply(r,c(t))},root:function(){var e=new l,t=e.clone();return l.prototype._currentJoi=t,t._currentJoi=t,t.any=function(){for(var t=arguments.length,r=Array(t),n=0;n<t;n++)r[n]=arguments[n];return f.assert(0===r.length,"Joi.any() does not allow arguments."),m.callWithDefaults.call(this,e,r)},t.alternatives=t.alt=function(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];return m.callWithDefaults.call(this,m.alternatives,t)},t.array=function(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];return f.assert(0===t.length,"Joi.array() does not allow arguments."),m.callWithDefaults.call(this,m.array,t)},t.boolean=t.bool=function(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];return f.assert(0===t.length,"Joi.boolean() does not allow arguments."),m.callWithDefaults.call(this,m.boolean,t)},t.binary=function(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];return f.assert(0===t.length,"Joi.binary() does not allow arguments."),m.callWithDefaults.call(this,m.binary,t)},t.date=function(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];return f.assert(0===t.length,"Joi.date() does not allow arguments."),m.callWithDefaults.call(this,m.date,t)},t.func=function(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];return f.assert(0===t.length,"Joi.func() does not allow arguments."),m.callWithDefaults.call(this,m.func,t)},t.number=function(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];return f.assert(0===t.length,"Joi.number() does not allow arguments."),m.callWithDefaults.call(this,m.number,t)},t.object=function(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];return m.callWithDefaults.call(this,m.object,t)},t.string=function(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];return f.assert(0===t.length,"Joi.string() does not allow arguments."),m.callWithDefaults.call(this,m.string,t)},t.ref=function(){return y.create.apply(y,arguments)},t.isRef=function(e){return y.isRef(e)},t.validate=function(r){var n,i=(n=(arguments.length<=1?0:arguments.length-1)-1+1,arguments.length<=n?void 0:arguments[n]),o="function"==typeof i?i:null,s=(arguments.length<=1?0:arguments.length-1)-(o?1:0);if(0===s)return e.validate(r,o);var a=2===s?arguments.length<=2?void 0:arguments[2]:{},u=t.compile(arguments.length<=1?void 0:arguments[1]);return u._validateWithOptions(r,a,o)},t.describe=function(){var r=arguments.length?t.compile(arguments.length<=0?void 0:arguments[0]):e;return r.describe()},t.compile=function(e){try{return h.schema(this,e)}catch(e){throw e.hasOwnProperty("path")&&(e.message=e.message+"("+e.path+")"),e}},t.assert=function(e,r,n){t.attempt(e,r,n)},t.attempt=function(e,r,n){var i=t.validate(e,r),o=i.error;if(o){if(!n)throw"function"==typeof o.annotate&&(o.message=o.annotate()),o;if(!(n instanceof Error))throw"function"==typeof o.annotate&&(o.message=n+" "+o.annotate()),o;throw n}return i.value},t.reach=function(e,t){f.assert(e&&e instanceof l,"you must provide a joi schema"),f.assert(Array.isArray(t)||"string"==typeof t,"path must be a string or an array of strings");var r=function e(t,r){if(!r.length)return t;var n=t._inner.children;if(n)for(var i=r.shift(),o=0;o<n.length;++o){var s=n[o];if(s.key===i)return e(s.schema,r)}},n="string"==typeof t?t?t.split("."):[]:t.slice();return r(e,n)},t.lazy=function(e){return d.set(e)},t.defaults=function(e){var t=this;f.assert("function"==typeof e,"Defaults must be a function");var r=Object.create(this.any());return r=e(r),f.assert(r&&r instanceof this.constructor,"defaults() must return a schema"),n(r,this,r.clone()),r._defaults=function(r){return t._defaults&&(r=t._defaults(r),f.assert(r instanceof t.constructor,"defaults() must return a schema")),r=e(r),f.assert(r instanceof t.constructor,"defaults() must return a schema"),r},r},t.extend=function(){for(var e=this,r=arguments.length,i=Array(r),c=0;c<r;c++)i[c]=arguments[c];var d=f.flatten(i);f.assert(d.length>0,"You need to provide at least one extension"),this.assert(d,t.extensionsSchema);var b=Object.create(this.any());n(b,this);for(var v=function r(i){var c=d[i];"function"==typeof c&&(c=c(b)),e.assert(c,t.extensionSchema);var v=(c.base||e.any()).clone(),_=v.constructor,w=function(e){function t(){s(this,t);var r=a(this,e.call(this));return c.base&&n(r,v),r._type=c.name,c.language&&(r._settings=g.concat(r._settings,{language:o({},c.name,c.language)})),r}return u(t,e),t}(_);if(c.coerce&&(w.prototype._coerce=function(e,t,r){if(_.prototype._coerce){var n=_.prototype._coerce.call(this,e,t,r);if(n.errors)return n;e=n.value}var i=c.coerce.call(this,e,t,r);return i instanceof p.Err?{value:e,errors:i}:{value:i}}),c.pre&&(w.prototype._base=function(e,t,r){if(_.prototype._base){var n=_.prototype._base.call(this,e,t,r);if(n.errors)return n;e=n.value}var i=c.pre.call(this,e,t,r);return i instanceof p.Err?{value:e,errors:i}:{value:i}}),c.rules)for(var S=function t(r){var n=c.rules[r],i=n.params?n.params instanceof l?n.params._inner.children.map(function(e){return e.key}):Object.keys(n.params):[],o=n.params?h.schema(e,n.params):null;w.prototype[n.name]=function(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];if(t.length>i.length)throw new Error("Unexpected number of arguments");for(var s=!1,a={},u=0;u<i.length;++u)a[i[u]]=t[u],!s&&y.isRef(t[u])&&(s=!0);o&&(a=b.attempt(a,o));var c=void 0;if(n.validate){var h=function e(t,r,i){return n.validate.call(this,a,t,r,i)};c=this._test(n.name,a,h,{description:n.description,hasRef:s})}else c=this.clone();if(n.setup){var p=n.setup.call(c,a);void 0!==p&&(f.assert(p instanceof l,"Setup of extension Joi."+this._type+"()."+n.name+"() must return undefined or a Joi object"),c=p)}return c}},k=0;k<c.rules.length;++k)S(k);c.describe&&(w.prototype.describe=function(){var e=_.prototype.describe.call(this);return c.describe.call(this,e)});var E=new w;b[c.name]=function(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];return m.callWithDefaults.call(this,E,t)}},_=0;_<d.length;++_)v(_);return b},t.extensionSchema=m.object.keys({base:m.object.type(l,"Joi object"),name:m.string.required(),coerce:m.func.arity(3),pre:m.func.arity(3),language:m.object,describe:m.func.arity(1),rules:m.array.items(m.object.keys({name:m.string.required(),setup:m.func.arity(1),validate:m.func.arity(4),params:[m.object.pattern(/.*/,m.object.type(l,"Joi object")),m.object.type(m.object.constructor,"Joi object")],description:[m.string,m.func.arity(1)]}).or("setup","validate"))}).strict(),t.extensionsSchema=m.array.items([m.object,m.func.arity(1)]).strict(),t.version=r(36).version,t}};e.exports=m.root()},function(e,t,r){"use strict";(function(t){var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};function i(e){if(Array.isArray(e)){for(var t=0,r=Array(e.length);t<e.length;t++)r[t]=e[t];return r}return Array.from(e)}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var s=r(1),a={extendedCheckForValue:function(e,r){var i=void 0===e?"undefined":n(e);if("object"===i){if(e instanceof Date)return function(t){return t instanceof Date&&e.getTime()===t.getTime()};if(t.isBuffer(e))return function(r){return t.isBuffer(r)&&e.length===r.length&&e.toString("binary")===r.toString("binary")}}else if(r&&"string"===i){var o=e.toLowerCase();return function(e){return"string"==typeof e&&o===e.toLowerCase()}}return null}};e.exports=function(){function e(t){o(this,e),this._set=new Set(t),this._hasRef=!1}return e.prototype.add=function e(t,r){var n=s.isRef(t);return!n&&this.has(t,null,null,!1)?this:(void 0!==r&&s.push(r,t),this._set.add(t),this._hasRef|=n,this)},e.prototype.merge=function e(t,r){var n=!0,i=!1,o=void 0;try{for(var s=t._set[Symbol.iterator](),a;!(n=(a=s.next()).done);n=!0){var u=a.value;this.add(u)}}catch(e){i=!0,o=e}finally{try{!n&&s.return&&s.return()}finally{if(i)throw o}}var c=!0,f=!1,l=void 0;try{for(var h=r._set[Symbol.iterator](),p;!(c=(p=h.next()).done);c=!0){var d=p.value;this.remove(d)}}catch(e){f=!0,l=e}finally{try{!c&&h.return&&h.return()}finally{if(f)throw l}}return this},e.prototype.remove=function e(t){return this._set.delete(t),this},e.prototype.has=function e(t,r,n,i){if(!this._set.size)return!1;var o=this._set.has(t);if(o)return o;var u=a.extendedCheckForValue(t,i);if(!u){if(r&&this._hasRef){var c=!0,f=!1,l=void 0;try{for(var h=this._set[Symbol.iterator](),p;!(c=(p=h.next()).done);c=!0){var d=p.value;if(s.isRef(d)&&(d=d(r.reference||r.parent,n),t===d||Array.isArray(d)&&d.includes(t)))return!0}}catch(e){f=!0,l=e}finally{try{!c&&h.return&&h.return()}finally{if(f)throw l}}}return!1}return this._has(t,r,n,u)},e.prototype._has=function e(t,r,n,i){var o=!(!r||!this._hasRef),a=function e(r){return t===r||i(r)},u=!0,c=!1,f=void 0;try{for(var l=this._set[Symbol.iterator](),h;!(u=(h=l.next()).done);u=!0){var p=h.value;if(o&&s.isRef(p)&&(p=p(r.reference||r.parent,n),Array.isArray(p))){if(p.find(a))return!0}else if(a(p))return!0}}catch(e){c=!0,f=e}finally{try{!u&&l.return&&l.return()}finally{if(c)throw f}}return!1},e.prototype.values=function e(t){if(t&&t.stripUndefined){var e=[],r=!0,n=!1,i=void 0;try{for(var o=this._set[Symbol.iterator](),s;!(r=(s=o.next()).done);r=!0){var a=s.value;void 0!==a&&e.push(a)}}catch(e){n=!0,i=e}finally{try{!r&&o.return&&o.return()}finally{if(n)throw i}}return e}return Array.from(this._set)},e.prototype.slice=function t(){var r=new e(this._set);return r._hasRef=this._hasRef,r},e.prototype.concat=function t(r){var n=new e([].concat(i(this._set),i(r._set)));return n._hasRef=!!(this._hasRef|r._hasRef),n},e}()}).call(t,r(3).Buffer)},function(e,t,r){"use strict";var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};function i(e,t){for(var r=Object.getOwnPropertyNames(t),n=0;n<r.length;n++){var i=r[n],o=Object.getOwnPropertyDescriptor(t,i);o&&o.configurable&&void 0===e[i]&&Object.defineProperty(e,i,o)}return e}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function s(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):i(e,t))}var u=r(0),c=r(2),f=r(4),l=r(1),h={};h.Alternatives=function(e){function t(){o(this,t);var r=s(this,e.call(this));return r._type="alternatives",r._invalids.remove(null),r._inner.matches=[],r}return a(t,e),t.prototype._init=function e(){return arguments.length?this.try.apply(this,arguments):this},t.prototype._base=function e(t,r,n){for(var i=[],o=this._inner.matches.length,s=this._baseType,a=0;a<o;++a){var u=this._inner.matches[a];if(u.schema){var c=u.schema._validate(t,r,n);if(!c.errors)return c;i=i.concat(c.errors)}else{var f=u.peek||u.is,l=u.is?u.ref(r.reference||r.parent,n):t,h=f._validate(l,null,n,r.parent).errors;if(h){if(u.otherwise)return u.otherwise._validate(t,r,n)}else if(u.then)return u.then._validate(t,r,n);if(a===o-1&&s)return s._validate(t,r,n)}}return i.length?{errors:this.createError("alternatives.child",{reason:i},r,n)}:{errors:this.createError("alternatives.base",null,r,n)}},t.prototype.try=function e(){for(var t=arguments.length,r=Array(t),n=0;n<t;n++)r[n]=arguments[n];r=u.flatten(r),u.assert(r.length,"Cannot add other alternatives without at least one schema");for(var i=this.clone(),o=0;o<r.length;++o){var s=f.schema(this._currentJoi,r[o]);s._refs.length&&(i._refs=i._refs.concat(s._refs)),i._inner.matches.push({schema:s})}return i},t.prototype.when=function e(t,r){var i=!1;u.assert(l.isRef(t)||"string"==typeof t||(i=t instanceof c),"Invalid condition:",t),u.assert(r,"Missing options"),u.assert("object"===(void 0===r?"undefined":n(r)),"Invalid options"),i?u.assert(!r.hasOwnProperty("is"),'"is" can not be used with a schema condition'):u.assert(r.hasOwnProperty("is"),'Missing "is" directive'),u.assert(void 0!==r.then||void 0!==r.otherwise,'options must have at least one of "then" or "otherwise"');var o=this.clone(),s=void 0;i||(s=f.schema(this._currentJoi,r.is),null!==r.is&&(l.isRef(r.is)||r.is instanceof c)||(s=s.required()));var a={ref:i?null:f.ref(t),peek:i?t:null,is:s,then:void 0!==r.then?f.schema(this._currentJoi,r.then):void 0,otherwise:void 0!==r.otherwise?f.schema(this._currentJoi,r.otherwise):void 0};return o._baseType&&(a.then=a.then&&o._baseType.concat(a.then),a.otherwise=a.otherwise&&o._baseType.concat(a.otherwise)),i||(l.push(o._refs,a.ref),o._refs=o._refs.concat(a.is._refs)),a.then&&a.then._refs&&(o._refs=o._refs.concat(a.then._refs)),a.otherwise&&a.otherwise._refs&&(o._refs=o._refs.concat(a.otherwise._refs)),o._inner.matches.push(a),o},t.prototype.describe=function e(){for(var t=c.prototype.describe.call(this),r=[],n=0;n<this._inner.matches.length;++n){var i=this._inner.matches[n];if(i.schema)r.push(i.schema.describe());else{var o=i.is?{ref:i.ref.toString(),is:i.is.describe()}:{peek:i.peek.describe()};i.then&&(o.then=i.then.describe()),i.otherwise&&(o.otherwise=i.otherwise.describe()),r.push(o)}}return t.alternatives=r,t},t}(c),e.exports=new h.Alternatives},function(e,t,r){"use strict";var n=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},i=r(0);t.concat=function(e,t){if(!t)return e;for(var r=n({},e),o=Object.keys(t),s=0;s<o.length;++s){var a=o[s];"language"===a&&r.hasOwnProperty(a)?r[a]=i.applyToDefaults(r[a],t[a]):r[a]=t[a]}return r}},function(e,t,r){"use strict";function n(e,t){for(var r=Object.getOwnPropertyNames(t),n=0;n<r.length;n++){var i=r[n],o=Object.getOwnPropertyDescriptor(t,i);o&&o.configurable&&void 0===e[i]&&Object.defineProperty(e,i,o)}return e}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):n(e,t))}var a=r(2),u=r(1),c=r(0),f={},l;f.isoDate=/^(?:[-+]\d{2})?(?:\d{4}(?!\d{2}\b))(?:(-?)(?:(?:0[1-9]|1[0-2])(?:\1(?:[12]\d|0[1-9]|3[01]))?|W(?:[0-4]\d|5[0-2])(?:-?[1-7])?|(?:00[1-9]|0[1-9]\d|[12]\d{2}|3(?:[0-5]\d|6[1-6])))(?![T]$|[T][\d]+Z$)(?:[T\s](?:(?:(?:[01]\d|2[0-3])(?:(:?)[0-5]\d)?|24\:?00)(?:[.,]\d+(?!:))?)(?:\2[0-5]\d(?:[.,]\d+)?)?(?:[Z]|(?:[+-])(?:[01]\d|2[0-3])(?::?[0-5]\d)?)?)?)?$/,f.invalidDate=new Date(""),f.isIsoDate=(l=f.isoDate.toString(),function(e){return e&&e.toString()===l}),f.Date=function(e){function t(){i(this,t);var r=o(this,e.call(this));return r._type="date",r}return s(t,e),t.prototype._base=function e(t,r,n){var i={value:n.convert&&f.Date.toDate(t,this._flags.format,this._flags.timestamp,this._flags.multiplier)||t};if(i.value instanceof Date&&!isNaN(i.value.getTime()))i.errors=null;else if(n.convert){var o=void 0;o=f.isIsoDate(this._flags.format)?"isoDate":this._flags.timestamp?"timestamp."+this._flags.timestamp:"base",i.errors=this.createError("date."+o,null,r,n)}else i.errors=this.createError("date.strict",null,r,n);return i},t.toDate=function e(t,r,n,i){if(t instanceof Date)return t;if("string"==typeof t||"number"==typeof t&&!isNaN(t)&&isFinite(t)){"string"==typeof t&&/^[+-]?\d+(\.\d+)?$/.test(t)&&(t=parseFloat(t));var o=void 0;if(o=r&&f.isIsoDate(r)?r.test(t)?new Date(t):f.invalidDate:n&&i?/^\s*$/.test(t)?f.invalidDate:new Date(t*i):new Date(t),!isNaN(o.getTime()))return o}return null},t.prototype.iso=function e(){if(this._flags.format===f.isoDate)return this;var t=this.clone();return t._flags.format=f.isoDate,t},t.prototype.timestamp=function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"javascript",r=["javascript","unix"];if(c.assert(r.includes(t),'"type" must be one of "'+r.join('", "')+'"'),this._flags.timestamp===t)return this;var n=this.clone();return n._flags.timestamp=t,n._flags.multiplier="unix"===t?1e3:1,n},t.prototype._isIsoDate=function e(t){return f.isoDate.test(t)},t}(a),f.compare=function(e,t){return function(r){var n="now"===r,i=u.isRef(r);return n||i||(r=f.Date.toDate(r)),c.assert(r,"Invalid date format"),this._test(e,r,function(o,s,a){var u=void 0;if(n)u=Date.now();else if(i){if(u=f.Date.toDate(r(s.reference||s.parent,a)),!u)return this.createError("date.ref",{ref:r.key},s,a);u=u.getTime()}else u=r.getTime();return t(o.getTime(),u)?o:this.createError("date."+e,{limit:new Date(u)},s,a)})}},f.Date.prototype.min=f.compare("min",function(e,t){return e>=t}),f.Date.prototype.max=f.compare("max",function(e,t){return e<=t}),f.Date.prototype.greater=f.compare("greater",function(e,t){return e>t}),f.Date.prototype.less=f.compare("less",function(e,t){return e<t}),e.exports=new f.Date},function(e,t,r){"use strict";var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};function i(e,t){for(var r=Object.getOwnPropertyNames(t),n=0;n<r.length;n++){var i=r[n],o=Object.getOwnPropertyDescriptor(t,i);o&&o.configurable&&void 0===e[i]&&Object.defineProperty(e,i,o)}return e}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function s(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):i(e,t))}var u=r(0),c=r(31),f=r(2),l=r(6),h=r(4),p={};p.Object=function(e){function t(){o(this,t);var r=s(this,e.call(this));return r._type="object",r._inner.children=null,r._inner.renames=[],r._inner.dependencies=[],r._inner.patterns=[],r}return a(t,e),t.prototype._init=function e(){return arguments.length?this.keys.apply(this,arguments):this},t.prototype._base=function e(t,r,i){var o=t,s=[],a=function e(){return{value:o,errors:s.length?s:null}};"string"==typeof t&&i.convert&&(t=p.safeParse(t));var c=this._flags.func?"function":"object";if(!t||(void 0===t?"undefined":n(t))!==c||Array.isArray(t))return s.push(this.createError(c+".base",null,r,i)),a();if(!(this._inner.renames.length||this._inner.dependencies.length||this._inner.children||this._inner.patterns.length))return o=t,a();if(o===t){"object"===c?o=Object.create(Object.getPrototypeOf(t)):(o=function e(){for(var r=arguments.length,n=Array(r),i=0;i<r;i++)n[i]=arguments[i];return t.apply(this,n)},o.prototype=u.clone(t.prototype));for(var f=Object.keys(t),h=0;h<f.length;++h)o[f[h]]=t[f[h]]}else o=t;for(var d={},y=0;y<this._inner.renames.length;++y){var g=this._inner.renames[y];if(g.isRegExp){for(var m=Object.keys(o),b=[],v=0;v<m.length;++v)g.from.test(m[v])&&b.push(m[v]);var _=b.every(function(e){return void 0===o[e]});if(g.options.ignoreUndefined&&_)continue;if(!g.options.multiple&&d[g.to]&&(s.push(this.createError("object.rename.regex.multiple",{from:b,to:g.to},r,i)),i.abortEarly))return a();if(Object.prototype.hasOwnProperty.call(o,g.to)&&!g.options.override&&!d[g.to]&&(s.push(this.createError("object.rename.regex.override",{from:b,to:g.to},r,i)),i.abortEarly))return a();if(_?delete o[g.to]:o[g.to]=o[b[b.length-1]],d[g.to]=!0,!g.options.alias)for(var w=0;w<b.length;++w)delete o[b[w]]}else{if(g.options.ignoreUndefined&&void 0===o[g.from])continue;if(!g.options.multiple&&d[g.to]&&(s.push(this.createError("object.rename.multiple",{from:g.from,to:g.to},r,i)),i.abortEarly))return a();if(Object.prototype.hasOwnProperty.call(o,g.to)&&!g.options.override&&!d[g.to]&&(s.push(this.createError("object.rename.override",{from:g.from,to:g.to},r,i)),i.abortEarly))return a();void 0===o[g.from]?delete o[g.to]:o[g.to]=o[g.from],d[g.to]=!0,g.options.alias||delete o[g.from]}}if(!this._inner.children&&!this._inner.patterns.length&&!this._inner.dependencies.length)return a();var S=new Set(Object.keys(o));if(this._inner.children){for(var k=[],E=0;E<this._inner.children.length;++E){var A=this._inner.children[E],x=A.key,I=o[x];S.delete(x);var T={key:x,path:r.path.concat(x),parent:o,reference:r.reference},B=A.schema._validate(I,T,i);if(B.errors){if(s.push(this.createError("object.child",{key:x,child:A.schema._getLabel(x),reason:B.errors},T,i)),i.abortEarly)return a()}else A.schema._flags.strip||void 0===B.value&&B.value!==I?(k.push(x),o[x]=B.finalValue):void 0!==B.value&&(o[x]=B.value)}for(var C=0;C<k.length;++C)delete o[k[C]]}if(S.size&&this._inner.patterns.length){var P=!0,O=!1,R=void 0;try{for(var N=S[Symbol.iterator](),L;!(P=(L=N.next()).done);P=!0)for(var j=L.value,M={key:j,path:r.path.concat(j),parent:o,reference:r.reference},K=o[j],D=0;D<this._inner.patterns.length;++D){var U=this._inner.patterns[D];if(U.regex?U.regex.test(j):!U.schema.validate(j).error){S.delete(j);var F=U.rule._validate(K,M,i);if(F.errors&&(s.push(this.createError("object.child",{key:j,child:U.rule._getLabel(j),reason:F.errors},M,i)),i.abortEarly))return a();o[j]=F.value}}}catch(ne){O=!0,R=ne}finally{try{!P&&N.return&&N.return()}finally{if(O)throw R}}}if(S.size&&(this._inner.children||this._inner.patterns.length)){if(i.stripUnknown&&!0!==this._flags.allowUnknown||i.skipFunctions){var q=!!i.stripUnknown&&(!0===i.stripUnknown||!!i.stripUnknown.objects),H=!0,z=!1,V=void 0;try{for(var G=S[Symbol.iterator](),W;!(H=(W=G.next()).done);H=!0){var $=W.value;q?(delete o[$],S.delete($)):"function"==typeof o[$]&&S.delete($)}}catch(ne){z=!0,V=ne}finally{try{!H&&G.return&&G.return()}finally{if(z)throw V}}}if(void 0!==this._flags.allowUnknown?!this._flags.allowUnknown:!i.allowUnknown){var Y=!0,J=!1,X=void 0;try{for(var Z=S[Symbol.iterator](),Q;!(Y=(Q=Z.next()).done);Y=!0){var ee=Q.value;s.push(this.createError("object.allowUnknown",{child:ee},{key:ee,path:r.path.concat(ee)},i,{}))}}catch(ne){J=!0,X=ne}finally{try{!Y&&Z.return&&Z.return()}finally{if(J)throw X}}}}for(var te=0;te<this._inner.dependencies.length;++te){var re=this._inner.dependencies[te],ne=p[re.type].call(this,null!==re.key&&o[re.key],re.peers,o,{key:re.key,path:null===re.key?r.path:r.path.concat(re.key)},i);if(ne instanceof l.Err&&(s.push(ne),i.abortEarly))return a()}return a()},t.prototype.keys=function e(t){u.assert(null===t||void 0===t||"object"===(void 0===t?"undefined":n(t)),"Object schema must be a valid object"),u.assert(!(t&&t instanceof f),"Object schema cannot be a joi schema");var r=this.clone();if(!t)return r._inner.children=null,r;var i=Object.keys(t);if(!i.length)return r._inner.children=[],r;var o=new c;if(r._inner.children)for(var s=0;s<r._inner.children.length;++s){var a=r._inner.children[s];i.includes(a.key)||o.add(a,{after:a._refs,group:a.key})}for(var l=0;l<i.length;++l){var p=i[l],d=t[p];try{var y=h.schema(this._currentJoi,d);o.add({key:p,schema:y},{after:y._refs,group:p})}catch(e){throw e.hasOwnProperty("path")?e.path=p+"."+e.path:e.path=p,e}}return r._inner.children=o.nodes,r},t.prototype.append=function e(t){return null===t||void 0===t||0===Object.keys(t).length?this:this.keys(t)},t.prototype.unknown=function e(t){var r=!1!==t;if(this._flags.allowUnknown===r)return this;var n=this.clone();return n._flags.allowUnknown=r,n},t.prototype.length=function e(t){return u.assert(Number.isSafeInteger(t)&&t>=0,"limit must be a positive integer"),this._test("length",t,function(e,r,n){return Object.keys(e).length===t?e:this.createError("object.length",{limit:t},r,n)})},t.prototype.min=function e(t){return u.assert(Number.isSafeInteger(t)&&t>=0,"limit must be a positive integer"),this._test("min",t,function(e,r,n){return Object.keys(e).length>=t?e:this.createError("object.min",{limit:t},r,n)})},t.prototype.max=function e(t){return u.assert(Number.isSafeInteger(t)&&t>=0,"limit must be a positive integer"),this._test("max",t,function(e,r,n){return Object.keys(e).length<=t?e:this.createError("object.max",{limit:t},r,n)})},t.prototype.pattern=function e(t,r){var n=t instanceof RegExp;u.assert(n||t instanceof f,"pattern must be a regex or schema"),u.assert(void 0!==r,"Invalid rule"),n&&(t=new RegExp(t.source,t.ignoreCase?"i":void 0));try{r=h.schema(this._currentJoi,r)}catch(e){throw e.hasOwnProperty("path")&&(e.message=e.message+"("+e.path+")"),e}var i=this.clone();return n?i._inner.patterns.push({regex:t,rule:r}):i._inner.patterns.push({schema:t,rule:r}),i},t.prototype.schema=function e(){return this._test("schema",null,function(e,t,r){return e instanceof f?e:this.createError("object.schema",null,t,r)})},t.prototype.with=function e(t,r){return u.assert(2===arguments.length,"Invalid number of arguments, expected 2."),this._dependency("with",t,r)},t.prototype.without=function e(t,r){return u.assert(2===arguments.length,"Invalid number of arguments, expected 2."),this._dependency("without",t,r)},t.prototype.xor=function e(){for(var t=arguments.length,r=Array(t),n=0;n<t;n++)r[n]=arguments[n];return r=u.flatten(r),this._dependency("xor",null,r)},t.prototype.or=function e(){for(var t=arguments.length,r=Array(t),n=0;n<t;n++)r[n]=arguments[n];return r=u.flatten(r),this._dependency("or",null,r)},t.prototype.and=function e(){for(var t=arguments.length,r=Array(t),n=0;n<t;n++)r[n]=arguments[n];return r=u.flatten(r),this._dependency("and",null,r)},t.prototype.nand=function e(){for(var t=arguments.length,r=Array(t),n=0;n<t;n++)r[n]=arguments[n];return r=u.flatten(r),this._dependency("nand",null,r)},t.prototype.requiredKeys=function e(){for(var t=arguments.length,r=Array(t),n=0;n<t;n++)r[n]=arguments[n];return r=u.flatten(r),this.applyFunctionToChildren(r,"required")},t.prototype.optionalKeys=function e(){for(var t=arguments.length,r=Array(t),n=0;n<t;n++)r[n]=arguments[n];return r=u.flatten(r),this.applyFunctionToChildren(r,"optional")},t.prototype.forbiddenKeys=function e(){for(var t=arguments.length,r=Array(t),n=0;n<t;n++)r[n]=arguments[n];return r=u.flatten(r),this.applyFunctionToChildren(r,"forbidden")},t.prototype.rename=function e(t,r,n){u.assert("string"==typeof t||t instanceof RegExp,"Rename missing the from argument"),u.assert("string"==typeof r,"Rename missing the to argument"),u.assert(r!==t,"Cannot rename key to same name:",t);for(var i=0;i<this._inner.renames.length;++i)u.assert(this._inner.renames[i].from!==t,"Cannot rename the same key multiple times");var o=this.clone();return o._inner.renames.push({from:t,to:r,options:u.applyToDefaults(p.renameDefaults,n||{}),isRegExp:t instanceof RegExp}),o},t.prototype.applyFunctionToChildren=function e(t,r,n,i){t=[].concat(t),u.assert(t.length>0,"expected at least one children");var o=p.groupChildren(t),s=void 0;if(""in o?(s=this[r].apply(this,n),delete o[""]):s=this.clone(),s._inner.children){i=i?i+".":"";for(var a=0;a<s._inner.children.length;++a){var c=s._inner.children[a],f=o[c.key];f&&(s._inner.children[a]={key:c.key,_refs:c._refs,schema:c.schema.applyFunctionToChildren(f,r,n,i+c.key)},delete o[c.key])}}var l=Object.keys(o);return u.assert(0===l.length,"unknown key(s)",l.join(", ")),s},t.prototype._dependency=function e(t,r,n){n=[].concat(n);for(var i=0;i<n.length;++i)u.assert("string"==typeof n[i],t,"peers must be a string or array of strings");var o=this.clone();return o._inner.dependencies.push({type:t,key:r,peers:n}),o},t.prototype.describe=function e(t){var r=f.prototype.describe.call(this);if(r.rules)for(var i=0;i<r.rules.length;++i){var o=r.rules[i];o.arg&&"object"===n(o.arg)&&o.arg.schema&&o.arg.ref&&(o.arg={schema:o.arg.schema.describe(),ref:o.arg.ref.toString()})}if(this._inner.children&&!t){r.children={};for(var s=0;s<this._inner.children.length;++s){var a=this._inner.children[s];r.children[a.key]=a.schema.describe()}}if(this._inner.dependencies.length&&(r.dependencies=u.clone(this._inner.dependencies)),this._inner.patterns.length){r.patterns=[];for(var c=0;c<this._inner.patterns.length;++c){var l=this._inner.patterns[c];l.regex?r.patterns.push({regex:l.regex.toString(),rule:l.rule.describe()}):r.patterns.push({schema:l.schema.describe(),rule:l.rule.describe()})}}return this._inner.renames.length>0&&(r.renames=u.clone(this._inner.renames)),r},t.prototype.assert=function e(t,r,n){t=h.ref(t),u.assert(t.isContext||t.depth>1,"Cannot use assertions for root level references - use direct key rules instead"),n=n||"pass the assertion test";try{r=h.schema(this._currentJoi,r)}catch(e){throw e.hasOwnProperty("path")&&(e.message=e.message+"("+e.path+")"),e}var i=t.path[t.path.length-1],o=t.path.join(".");return this._test("assert",{schema:r,ref:t},function(e,s,a){var c=r._validate(t(e),null,a,e);if(!c.errors)return e;var f=u.merge({},s);return f.key=i,f.path=t.path,this.createError("object.assert",{ref:o,message:n},f,a)})},t.prototype.type=function e(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t.name;u.assert("function"==typeof t,"type must be a constructor function");var n={name:r,ctor:t};return this._test("type",n,function(e,r,i){return e instanceof t?e:this.createError("object.type",{type:n.name},r,i)})},t}(f),p.safeParse=function(e){try{return JSON.parse(e)}catch(e){}return e},p.renameDefaults={alias:!1,multiple:!1,override:!1},p.groupChildren=function(e){e.sort();for(var t={},r=0;r<e.length;++r){var n=e[r];u.assert("string"==typeof n,"children must be strings");var i=n.split(".")[0],o=t[i]=t[i]||[];o.push(n.substring(i.length+1))}return t},p.keysToLabels=function(e,t){var r=e._inner.children;if(!r)return t;var n=function e(t){var n=r.find(function(e){return e.key===t});return n?n.schema._getLabel(t):t};return Array.isArray(t)?t.map(n):n(t)},p.with=function(e,t,r,n,i){if(void 0===e)return e;for(var o=0;o<t.length;++o){var s=t[o];if(!Object.prototype.hasOwnProperty.call(r,s)||void 0===r[s])return this.createError("object.with",{main:n.key,mainWithLabel:p.keysToLabels(this,n.key),peer:s,peerWithLabel:p.keysToLabels(this,s)},n,i)}return e},p.without=function(e,t,r,n,i){if(void 0===e)return e;for(var o=0;o<t.length;++o){var s=t[o];if(Object.prototype.hasOwnProperty.call(r,s)&&void 0!==r[s])return this.createError("object.without",{main:n.key,mainWithLabel:p.keysToLabels(this,n.key),peer:s,peerWithLabel:p.keysToLabels(this,s)},n,i)}return e},p.xor=function(e,t,r,n,i){for(var o=[],s=0;s<t.length;++s){var a=t[s];Object.prototype.hasOwnProperty.call(r,a)&&void 0!==r[a]&&o.push(a)}if(1===o.length)return e;var u={peers:t,peersWithLabels:p.keysToLabels(this,t)};return 0===o.length?this.createError("object.missing",u,n,i):this.createError("object.xor",u,n,i)},p.or=function(e,t,r,n,i){for(var o=0;o<t.length;++o){var s=t[o];if(Object.prototype.hasOwnProperty.call(r,s)&&void 0!==r[s])return e}return this.createError("object.missing",{peers:t,peersWithLabels:p.keysToLabels(this,t)},n,i)},p.and=function(e,t,r,n,i){for(var o=[],s=[],a=t.length,u=0;u<a;++u){var c=t[u];Object.prototype.hasOwnProperty.call(r,c)&&void 0!==r[c]?s.push(c):o.push(c)}var f=o.length===a||s.length===a;if(!f)return this.createError("object.and",{present:s,presentWithLabels:p.keysToLabels(this,s),missing:o,missingWithLabels:p.keysToLabels(this,o)},n,i)},p.nand=function(e,t,r,n,i){for(var o=[],s=0;s<t.length;++s){var a=t[s];Object.prototype.hasOwnProperty.call(r,a)&&void 0!==r[a]&&o.push(a)}var c=u.clone(t),f=c.splice(0,1)[0],l=o.length===t.length;return l?this.createError("object.nand",{main:f,mainWithLabel:p.keysToLabels(this,f),peers:c,peersWithLabels:p.keysToLabels(this,c)},n,i):null},e.exports=new p.Object},function(e,t,r){"use strict";var n={rfc3986:{},generate:function(){var e="|",t="0?",r="0-9",i="[0-9]",o="a-zA-Z",s="[a-zA-Z]";n.rfc3986.ipv4Cidr="[0-9]|[1-2][0-9]|3[0-2]",n.rfc3986.ipv6Cidr="(?:0?0?[0-9]|0?[1-9][0-9]|1[01][0-9]|12[0-8])";var a="0-9A-Fa-f",u="[0-9A-Fa-f]",c="a-zA-Z0-9-\\._~",f="!\\$&'\\(\\)\\*\\+,;=",l="%0-9A-Fa-f",h=c+l+f+":@",p="["+h+"]",d="(?:0?0?[0-9]|0?[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])";n.rfc3986.IPv4address="(?:"+d+"\\.){3}"+d;var y="[0-9A-Fa-f]{1,4}",g="(?:"+y+":"+y+"|"+n.rfc3986.IPv4address+")",m="(?:"+y+":){6}"+g,b="::(?:"+y+":){5}"+g,v="(?:"+y+")?::(?:"+y+":){4}"+g,_="(?:(?:"+y+":){0,1}"+y+")?::(?:"+y+":){3}"+g,w="(?:(?:"+y+":){0,2}"+y+")?::(?:"+y+":){2}"+g,S="(?:(?:"+y+":){0,3}"+y+")?::"+y+":"+g,k="(?:(?:"+y+":){0,4}"+y+")?::"+g,E="(?:(?:"+y+":){0,5}"+y+")?::"+y,A="(?:(?:"+y+":){0,6}"+y+")?::";n.rfc3986.IPv6address="(?:"+m+e+b+e+v+e+_+e+w+e+S+e+k+e+E+e+A+")",n.rfc3986.IPvFuture="v[0-9A-Fa-f]+\\.["+c+f+":]+",n.rfc3986.scheme="[a-zA-Z][a-zA-Z0-9+-\\.]*";var x="["+c+l+f+":]*",I="\\[(?:"+n.rfc3986.IPv6address+e+n.rfc3986.IPvFuture+")\\]",T="["+c+l+f+"]{0,255}",B="(?:"+I+e+n.rfc3986.IPv4address+e+T+")",C="[0-9]*",P="(?:"+x+"@)?"+B+"(?::"+C+")?",O=p+"*",R=p+"+",N="["+c+l+f+"@]+",L="",j="(?:\\/"+O+")*",M="\\/(?:"+R+j+")?",K=R+j,D=N+j;n.rfc3986.hierPart="(?:(?:\\/\\/"+P+j+")"+e+M+e+K+")",n.rfc3986.relativeRef="(?:(?:\\/\\/"+P+j+")"+e+M+e+D+e+")",n.rfc3986.query="["+h+"\\/\\?]*(?=#|$)",n.rfc3986.fragment="["+h+"\\/\\?]*"}};n.generate(),e.exports=n.rfc3986},function(e,t){},function(e,t,r){(function(e,n){var i=/%[sdj%]/g;t.format=function(e){if(!S(e)){for(var t=[],r=0;r<arguments.length;r++)t.push(a(arguments[r]));return t.join(" ")}for(var r=1,n=arguments,o=n.length,s=String(e).replace(i,function(e){if("%%"===e)return"%";if(r>=o)return e;switch(e){case"%s":return String(n[r++]);case"%d":return Number(n[r++]);case"%j":try{return JSON.stringify(n[r++])}catch(e){return"[Circular]"}default:return e}}),u=n[r];r<o;u=n[++r])v(u)||!x(u)?s+=" "+u:s+=" "+a(u);return s},t.deprecate=function(r,i){if(E(e.process))return function(){return t.deprecate(r,i).apply(this,arguments)};if(!0===n.noDeprecation)return r;var o=!1;function s(){if(!o){if(n.throwDeprecation)throw new Error(i);n.traceDeprecation?console.trace(i):console.error(i),o=!0}return r.apply(this,arguments)}return s};var o={},s;function a(e,r){var n={seen:[],stylize:c};return arguments.length>=3&&(n.depth=arguments[2]),arguments.length>=4&&(n.colors=arguments[3]),b(r)?n.showHidden=r:r&&t._extend(n,r),E(n.showHidden)&&(n.showHidden=!1),E(n.depth)&&(n.depth=2),E(n.colors)&&(n.colors=!1),E(n.customInspect)&&(n.customInspect=!0),n.colors&&(n.stylize=u),l(n,e,n.depth)}function u(e,t){var r=a.styles[t];return r?"["+a.colors[r][0]+"m"+e+"["+a.colors[r][1]+"m":e}function c(e,t){return e}function f(e){var t={};return e.forEach(function(e,r){t[e]=!0}),t}function l(e,r,n){if(e.customInspect&&r&&B(r.inspect)&&r.inspect!==t.inspect&&(!r.constructor||r.constructor.prototype!==r)){var i=r.inspect(n,e);return S(i)||(i=l(e,i,n)),i}var o=h(e,r);if(o)return o;var s=Object.keys(r),a=f(s);if(e.showHidden&&(s=Object.getOwnPropertyNames(r)),T(r)&&(s.indexOf("message")>=0||s.indexOf("description")>=0))return p(r);if(0===s.length){if(B(r)){var u=r.name?": "+r.name:"";return e.stylize("[Function"+u+"]","special")}if(A(r))return e.stylize(RegExp.prototype.toString.call(r),"regexp");if(I(r))return e.stylize(Date.prototype.toString.call(r),"date");if(T(r))return p(r)}var c="",b=!1,v=["{","}"],_;if(m(r)&&(b=!0,v=["[","]"]),B(r)){var w=r.name?": "+r.name:"";c=" [Function"+w+"]"}return A(r)&&(c=" "+RegExp.prototype.toString.call(r)),I(r)&&(c=" "+Date.prototype.toUTCString.call(r)),T(r)&&(c=" "+p(r)),0!==s.length||b&&0!=r.length?n<0?A(r)?e.stylize(RegExp.prototype.toString.call(r),"regexp"):e.stylize("[Object]","special"):(e.seen.push(r),_=b?d(e,r,n,a,s):s.map(function(t){return y(e,r,n,a,t,b)}),e.seen.pop(),g(_,c,v)):v[0]+c+v[1]}function h(e,t){if(E(t))return e.stylize("undefined","undefined");if(S(t)){var r="'"+JSON.stringify(t).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return e.stylize(r,"string")}return w(t)?e.stylize(""+t,"number"):b(t)?e.stylize(""+t,"boolean"):v(t)?e.stylize("null","null"):void 0}function p(e){return"["+Error.prototype.toString.call(e)+"]"}function d(e,t,r,n,i){for(var o=[],s=0,a=t.length;s<a;++s)L(t,String(s))?o.push(y(e,t,r,n,String(s),!0)):o.push("");return i.forEach(function(i){i.match(/^\d+$/)||o.push(y(e,t,r,n,i,!0))}),o}function y(e,t,r,n,i,o){var s,a,u;if(u=Object.getOwnPropertyDescriptor(t,i)||{value:t[i]},u.get?a=u.set?e.stylize("[Getter/Setter]","special"):e.stylize("[Getter]","special"):u.set&&(a=e.stylize("[Setter]","special")),L(n,i)||(s="["+i+"]"),a||(e.seen.indexOf(u.value)<0?(a=v(r)?l(e,u.value,null):l(e,u.value,r-1),a.indexOf("\n")>-1&&(a=o?a.split("\n").map(function(e){return" "+e}).join("\n").substr(2):"\n"+a.split("\n").map(function(e){return" "+e}).join("\n"))):a=e.stylize("[Circular]","special")),E(s)){if(o&&i.match(/^\d+$/))return a;s=JSON.stringify(""+i),s.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(s=s.substr(1,s.length-2),s=e.stylize(s,"name")):(s=s.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),s=e.stylize(s,"string"))}return s+": "+a}function g(e,t,r){var n=0,i=e.reduce(function(e,t){return n++,t.indexOf("\n")>=0&&n++,e+t.replace(/\u001b\[\d\d?m/g,"").length+1},0);return i>60?r[0]+(""===t?"":t+"\n ")+" "+e.join(",\n ")+" "+r[1]:r[0]+t+" "+e.join(", ")+" "+r[1]}function m(e){return Array.isArray(e)}function b(e){return"boolean"==typeof e}function v(e){return null===e}function _(e){return null==e}function w(e){return"number"==typeof e}function S(e){return"string"==typeof e}function k(e){return"symbol"==typeof e}function E(e){return void 0===e}function A(e){return x(e)&&"[object RegExp]"===P(e)}function x(e){return"object"==typeof e&&null!==e}function I(e){return x(e)&&"[object Date]"===P(e)}function T(e){return x(e)&&("[object Error]"===P(e)||e instanceof Error)}function B(e){return"function"==typeof e}function C(e){return null===e||"boolean"==typeof e||"number"==typeof e||"string"==typeof e||"symbol"==typeof e||void 0===e}function P(e){return Object.prototype.toString.call(e)}function O(e){return e<10?"0"+e.toString(10):e.toString(10)}t.debuglog=function(e){if(E(s)&&(s=n.env.NODE_DEBUG||""),e=e.toUpperCase(),!o[e])if(new RegExp("\\b"+e+"\\b","i").test(s)){var r=n.pid;o[e]=function(){var n=t.format.apply(t,arguments);console.error("%s %d: %s",e,r,n)}}else o[e]=function(){};return o[e]},t.inspect=a,a.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},a.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"},t.isArray=m,t.isBoolean=b,t.isNull=v,t.isNullOrUndefined=_,t.isNumber=w,t.isString=S,t.isSymbol=k,t.isUndefined=E,t.isRegExp=A,t.isObject=x,t.isDate=I,t.isError=T,t.isFunction=B,t.isPrimitive=C,t.isBuffer=r(40);var R=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function N(){var e=new Date,t=[O(e.getHours()),O(e.getMinutes()),O(e.getSeconds())].join(":");return[e.getDate(),R[e.getMonth()],t].join(" ")}function L(e,t){return Object.prototype.hasOwnProperty.call(e,t)}t.log=function(){console.log("%s - %s",N(),t.format.apply(t,arguments))},t.inherits=r(39),t._extend=function(e,t){if(!t||!x(t))return e;for(var r=Object.keys(t),n=r.length;n--;)e[r[n]]=t[r[n]];return e}}).call(t,r(5),r(7))},function(e,t,r){"use strict";(function(t){
|
||
/*!
|
||
* The buffer module from node.js, for the browser.
|
||
*
|
||
* @author Feross Aboukhadijeh <feross@feross.org> <http://feross.org>
|
||
* @license MIT
|
||
*/
|
||
function n(e,t){if(e===t)return 0;for(var r=e.length,n=t.length,i=0,o=Math.min(r,n);i<o;++i)if(e[i]!==t[i]){r=e[i],n=t[i];break}return r<n?-1:n<r?1:0}function i(e){return t.Buffer&&"function"==typeof t.Buffer.isBuffer?t.Buffer.isBuffer(e):!(null==e||!e._isBuffer)}var o=r(16),s=Object.prototype.hasOwnProperty,a=Array.prototype.slice,u="foo"===function e(){}.name;function c(e){return Object.prototype.toString.call(e)}function f(e){return!i(e)&&("function"==typeof t.ArrayBuffer&&("function"==typeof ArrayBuffer.isView?ArrayBuffer.isView(e):!!e&&(e instanceof DataView||!!(e.buffer&&e.buffer instanceof ArrayBuffer))))}var l=e.exports=b,h=/\s*function\s+([^\(\s]*)\s*/;function p(e){if(o.isFunction(e)){if(u)return e.name;var t=e.toString(),r=t.match(h);return r&&r[1]}}function d(e,t){return"string"==typeof e?e.length<t?e:e.slice(0,t):e}function y(e){if(u||!o.isFunction(e))return o.inspect(e);var t=p(e),r=t?": "+t:"";return"[Function"+r+"]"}function g(e){return d(y(e.actual),128)+" "+e.operator+" "+d(y(e.expected),128)}function m(e,t,r,n,i){throw new l.AssertionError({message:r,actual:e,expected:t,operator:n,stackStartFunction:i})}function b(e,t){e||m(e,!0,t,"==",l.ok)}function v(e,t,r,s){if(e===t)return!0;if(i(e)&&i(t))return 0===n(e,t);if(o.isDate(e)&&o.isDate(t))return e.getTime()===t.getTime();if(o.isRegExp(e)&&o.isRegExp(t))return e.source===t.source&&e.global===t.global&&e.multiline===t.multiline&&e.lastIndex===t.lastIndex&&e.ignoreCase===t.ignoreCase;if(null!==e&&"object"==typeof e||null!==t&&"object"==typeof t){if(f(e)&&f(t)&&c(e)===c(t)&&!(e instanceof Float32Array||e instanceof Float64Array))return 0===n(new Uint8Array(e.buffer),new Uint8Array(t.buffer));if(i(e)!==i(t))return!1;s=s||{actual:[],expected:[]};var a=s.actual.indexOf(e);return-1!==a&&a===s.expected.indexOf(t)||(s.actual.push(e),s.expected.push(t),w(e,t,r,s))}return r?e===t:e==t}function _(e){return"[object Arguments]"==Object.prototype.toString.call(e)}function w(e,t,r,n){if(null===e||void 0===e||null===t||void 0===t)return!1;if(o.isPrimitive(e)||o.isPrimitive(t))return e===t;if(r&&Object.getPrototypeOf(e)!==Object.getPrototypeOf(t))return!1;var i=_(e),s=_(t);if(i&&!s||!i&&s)return!1;if(i)return e=a.call(e),t=a.call(t),v(e,t,r);var u=x(e),c=x(t),f,l;if(u.length!==c.length)return!1;for(u.sort(),c.sort(),l=u.length-1;l>=0;l--)if(u[l]!==c[l])return!1;for(l=u.length-1;l>=0;l--)if(f=u[l],!v(e[f],t[f],r,n))return!1;return!0}function S(e,t,r){v(e,t,!0)&&m(e,t,r,"notDeepStrictEqual",S)}function k(e,t){if(!e||!t)return!1;if("[object RegExp]"==Object.prototype.toString.call(t))return t.test(e);try{if(e instanceof t)return!0}catch(e){}return!Error.isPrototypeOf(t)&&!0===t.call({},e)}function E(e){var t;try{e()}catch(e){t=e}return t}function A(e,t,r,n){var i;if("function"!=typeof t)throw new TypeError('"block" argument must be a function');"string"==typeof r&&(n=r,r=null),i=E(t),n=(r&&r.name?" ("+r.name+").":".")+(n?" "+n:"."),e&&!i&&m(i,r,"Missing expected exception"+n);var s="string"==typeof n,a=!e&&o.isError(i),u=!e&&i&&!r;if((a&&s&&k(i,r)||u)&&m(i,r,"Got unwanted exception"+n),e&&i&&r&&!k(i,r)||!e&&i)throw i}l.AssertionError=function e(t){this.name="AssertionError",this.actual=t.actual,this.expected=t.expected,this.operator=t.operator,t.message?(this.message=t.message,this.generatedMessage=!1):(this.message=g(this),this.generatedMessage=!0);var r=t.stackStartFunction||m;if(Error.captureStackTrace)Error.captureStackTrace(this,r);else{var n=new Error;if(n.stack){var i=n.stack,o=p(r),s=i.indexOf("\n"+o);if(s>=0){var a=i.indexOf("\n",s+1);i=i.substring(a+1)}this.stack=i}}},o.inherits(l.AssertionError,Error),l.fail=m,l.ok=b,l.equal=function e(t,r,n){t!=r&&m(t,r,n,"==",l.equal)},l.notEqual=function e(t,r,n){t==r&&m(t,r,n,"!=",l.notEqual)},l.deepEqual=function e(t,r,n){v(t,r,!1)||m(t,r,n,"deepEqual",l.deepEqual)},l.deepStrictEqual=function e(t,r,n){v(t,r,!0)||m(t,r,n,"deepStrictEqual",l.deepStrictEqual)},l.notDeepEqual=function e(t,r,n){v(t,r,!1)&&m(t,r,n,"notDeepEqual",l.notDeepEqual)},l.notDeepStrictEqual=S,l.strictEqual=function e(t,r,n){t!==r&&m(t,r,n,"===",l.strictEqual)},l.notStrictEqual=function e(t,r,n){t===r&&m(t,r,n,"!==",l.notStrictEqual)},l.throws=function(e,t,r){A(!0,e,t,r)},l.doesNotThrow=function(e,t,r){A(!1,e,t,r)},l.ifError=function(e){if(e)throw e};var x=Object.keys||function(e){var t=[];for(var r in e)s.call(e,r)&&t.push(r);return t}}).call(t,r(5))},function(e,t,r){"use strict";(function(e){var r={};t.escapeJavaScript=function(e){if(!e)return"";for(var t="",n=0;n<e.length;++n){var i=e.charCodeAt(n);r.isSafe(i)?t+=e[n]:t+=r.escapeJavaScriptChar(i)}return t},t.escapeHtml=function(e){if(!e)return"";for(var t="",n=0;n<e.length;++n){var i=e.charCodeAt(n);r.isSafe(i)?t+=e[n]:t+=r.escapeHtmlChar(i)}return t},t.escapeJson=function(e){if(!e)return"";var t=60,r=62,n=38,i=8232,o=void 0;return e.replace(/[<>&\u2028\u2029]/g,function(e){return o=e.charCodeAt(0),60===o?"\\u003c":62===o?"\\u003e":38===o?"\\u0026":8232===o?"\\u2028":"\\u2029"})},r.escapeJavaScriptChar=function(t){if(t>=256)return"\\u"+r.padLeft(""+t,4);var n=e.from(String.fromCharCode(t),"ascii").toString("hex");return"\\x"+r.padLeft(n,2)},r.escapeHtmlChar=function(t){var n=r.namedHtml[t];if(void 0!==n)return n;if(t>=256)return"&#"+t+";";var i=e.from(String.fromCharCode(t),"ascii").toString("hex");return"&#x"+r.padLeft(i,2)+";"},r.padLeft=function(e,t){for(;e.length<t;)e="0"+e;return e},r.isSafe=function(e){return void 0!==r.safeCharCodes[e]},r.namedHtml={38:"&",60:"<",62:">",34:""",160:" ",162:"¢",163:"£",164:"¤",169:"©",174:"®"},r.safeCharCodes=function(){for(var e={},t=32;t<123;++t)(t>=97||t>=65&&t<=90||t>=48&&t<=57||32===t||46===t||44===t||45===t||58===t||95===t)&&(e[t]=null);return e}()}).call(t,r(3).Buffer)},function(e,t,r){"use strict";(function(e){var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},i=r(38),o={hasOwn:Object.prototype.hasOwnProperty,indexOf:Array.prototype.indexOf,defaultThreshold:16,maxIPv6Groups:8,categories:{valid:1,dnsWarn:7,rfc5321:15,cfws:31,deprecated:63,rfc5322:127,error:255},diagnoses:{valid:0,rfc5321TLD:9,rfc5321TLDNumeric:10,rfc5321QuotedString:11,rfc5321AddressLiteral:12,cfwsComment:17,cfwsFWS:18,undesiredNonAscii:25,deprecatedLocalPart:33,deprecatedFWS:34,deprecatedQTEXT:35,deprecatedQP:36,deprecatedComment:37,deprecatedCTEXT:38,deprecatedIPv6:39,deprecatedCFWSNearAt:49,rfc5322Domain:65,rfc5322TooLong:66,rfc5322LocalTooLong:67,rfc5322DomainTooLong:68,rfc5322LabelTooLong:69,rfc5322DomainLiteral:70,rfc5322DomainLiteralOBSDText:71,rfc5322IPv6GroupCount:72,rfc5322IPv62x2xColon:73,rfc5322IPv6BadCharacter:74,rfc5322IPv6MaxGroups:75,rfc5322IPv6ColonStart:76,rfc5322IPv6ColonEnd:77,errExpectingDTEXT:129,errNoLocalPart:130,errNoDomain:131,errConsecutiveDots:132,errATEXTAfterCFWS:133,errATEXTAfterQS:134,errATEXTAfterDomainLiteral:135,errExpectingQPair:136,errExpectingATEXT:137,errExpectingQTEXT:138,errExpectingCTEXT:139,errBackslashEnd:140,errDotStart:141,errDotEnd:142,errDomainHyphenStart:143,errDomainHyphenEnd:144,errUnclosedQuotedString:145,errUnclosedComment:146,errUnclosedDomainLiteral:147,errFWSCRLFx2:148,errFWSCRLFEnd:149,errCRNoLF:150,errUnknownTLD:160,errDomainTooShort:161},components:{localpart:0,domain:1,literal:2,contextComment:3,contextFWS:4,contextQuotedString:5,contextQuotedPair:6}};o.specials=function(){var e='()<>[]:;@\\,."',t=new Array(256);t.fill(!1);for(var r=0;r<e.length;++r)t[e.codePointAt(r)]=!0;return function(e){return t[e]}}(),o.c0Controls=function(){var e=new Array(256);e.fill(!1);for(var t=0;t<33;++t)e[t]=!0;return function(t){return e[t]}}(),o.c1Controls=function(){var e=new Array(256);e.fill(!1);for(var t=127;t<160;++t)e[t]=!0;return function(t){return e[t]}}(),o.regex={ipV4:/\b(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)$/,ipV6:/^[a-fA-F\d]{0,4}$/},o.normalizeSupportsNul="\0"==="\0".normalize("NFC"),o.nulNormalize=function(e){return e.split("\0").map(function(e){return e.normalize("NFC")}).join("\0")},o.normalize=function(e){return!o.normalizeSupportsNul&&e.indexOf("\0")>=0?o.nulNormalize(e):e.normalize("NFC")},o.checkIpV6=function(e){return e.every(function(e){return o.regex.ipV6.test(e)})},o.validDomain=function(e,t){return t.tldBlacklist?Array.isArray(t.tldBlacklist)?-1===o.indexOf.call(t.tldBlacklist,e):!o.hasOwn.call(t.tldBlacklist,e):Array.isArray(t.tldWhitelist)?-1!==o.indexOf.call(t.tldWhitelist,e):o.hasOwn.call(t.tldWhitelist,e)},t.validate=o.validate=function(t,r,s){r=r||{},t=o.normalize(t),"function"==typeof r&&(s=r,r={}),"function"!=typeof s&&(s=null);var a=void 0,u=void 0;if("number"==typeof r.errorLevel?(a=!0,u=r.errorLevel):(a=!!r.errorLevel,u=o.diagnoses.valid),r.tldWhitelist)if("string"==typeof r.tldWhitelist)r.tldWhitelist=[r.tldWhitelist];else if("object"!==n(r.tldWhitelist))throw new TypeError("expected array or object tldWhitelist");if(r.tldBlacklist)if("string"==typeof r.tldBlacklist)r.tldBlacklist=[r.tldBlacklist];else if("object"!==n(r.tldBlacklist))throw new TypeError("expected array or object tldBlacklist");if(r.minDomainAtoms&&(r.minDomainAtoms!==(0|+r.minDomainAtoms)||r.minDomainAtoms<0))throw new TypeError("expected positive integer minDomainAtoms");var c=o.diagnoses.valid,f=function e(t){t>c&&(c=t)},l=void 0===r.allowUnicode||!!r.allowUnicode;!l&&/[^\x00-\x7f]/.test(t)&&f(o.diagnoses.undesiredNonAscii);for(var h={now:o.components.localpart,prev:o.components.localpart,stack:[o.components.localpart]},p="",d={local:"",domain:""},y={locals:[""],domains:[""]},g=0,m=0,b=0,v=void 0,_=!1,w=!1,S=t.length,k=void 0,E=0;E<S;E+=k.length){switch(k=String.fromCodePoint(t.codePointAt(E)),h.now){case o.components.localpart:switch(k){case"(":0===m?f(0===g?o.diagnoses.cfwsComment:o.diagnoses.deprecatedComment):(f(o.diagnoses.cfwsComment),w=!0),h.stack.push(h.now),h.now=o.components.contextComment;break;case".":0===m?f(0===g?o.diagnoses.errDotStart:o.diagnoses.errConsecutiveDots):(w&&f(o.diagnoses.deprecatedLocalPart),w=!1,m=0,++g,d.local+=k,y.locals[g]="");break;case'"':0===m?(f(0===g?o.diagnoses.rfc5321QuotedString:o.diagnoses.deprecatedLocalPart),d.local+=k,y.locals[g]+=k,m+=e.byteLength(k,"utf8"),w=!0,h.stack.push(h.now),h.now=o.components.contextQuotedString):f(o.diagnoses.errExpectingATEXT);break;case"\r":if(S===++E||"\n"!==t[E]){f(o.diagnoses.errCRNoLF);break}case" ":case"\t":0===m?f(0===g?o.diagnoses.cfwsFWS:o.diagnoses.deprecatedFWS):w=!0,h.stack.push(h.now),h.now=o.components.contextFWS,p=k;break;case"@":if(1!==h.stack.length)throw new Error("unexpected item on context stack");0===d.local.length?f(o.diagnoses.errNoLocalPart):0===m?f(o.diagnoses.errDotEnd):e.byteLength(d.local,"utf8")>64?f(o.diagnoses.rfc5322LocalTooLong):h.prev!==o.components.contextComment&&h.prev!==o.components.contextFWS||f(o.diagnoses.deprecatedCFWSNearAt),h.now=o.components.domain,h.stack[0]=o.components.domain,g=0,m=0,w=!1;break;default:if(w)switch(h.prev){case o.components.contextComment:case o.components.contextFWS:f(o.diagnoses.errATEXTAfterCFWS);break;case o.components.contextQuotedString:f(o.diagnoses.errATEXTAfterQS);break;default:throw new Error("more atext found where none is allowed, but unrecognized prev context: "+h.prev)}else h.prev=h.now,v=k.codePointAt(0),(o.specials(v)||o.c0Controls(v)||o.c1Controls(v))&&f(o.diagnoses.errExpectingATEXT),d.local+=k,y.locals[g]+=k,m+=e.byteLength(k,"utf8")}break;case o.components.domain:switch(k){case"(":0===m?f(0===g?o.diagnoses.deprecatedCFWSNearAt:o.diagnoses.deprecatedComment):(w=!0,f(o.diagnoses.cfwsComment)),h.stack.push(h.now),h.now=o.components.contextComment;break;case".":var A=i.encode(y.domains[g]).length;0===m?f(0===g?o.diagnoses.errDotStart:o.diagnoses.errConsecutiveDots):_?f(o.diagnoses.errDomainHyphenEnd):A>63&&f(o.diagnoses.rfc5322LabelTooLong),w=!1,m=0,++g,y.domains[g]="",d.domain+=k;break;case"[":0===d.domain.length?(w=!0,m+=e.byteLength(k,"utf8"),h.stack.push(h.now),h.now=o.components.literal,d.domain+=k,y.domains[g]+=k,d.literal=""):f(o.diagnoses.errExpectingATEXT);break;case"\r":if(S===++E||"\n"!==t[E]){f(o.diagnoses.errCRNoLF);break}case" ":case"\t":0===m?f(0===g?o.diagnoses.deprecatedCFWSNearAt:o.diagnoses.deprecatedFWS):(f(o.diagnoses.cfwsFWS),w=!0),h.stack.push(h.now),h.now=o.components.contextFWS,p=k;break;default:if(w)switch(h.prev){case o.components.contextComment:case o.components.contextFWS:f(o.diagnoses.errATEXTAfterCFWS);break;case o.components.literal:f(o.diagnoses.errATEXTAfterDomainLiteral);break;default:throw new Error("more atext found where none is allowed, but unrecognized prev context: "+h.prev)}v=k.codePointAt(0),_=!1,o.specials(v)||o.c0Controls(v)||o.c1Controls(v)?f(o.diagnoses.errExpectingATEXT):"-"===k?(0===m&&f(o.diagnoses.errDomainHyphenStart),_=!0):(v<48||v>122&&v<192||v>57&&v<65||v>90&&v<97)&&f(o.diagnoses.rfc5322Domain),d.domain+=k,y.domains[g]+=k,m+=e.byteLength(k,"utf8")}break;case o.components.literal:switch(k){case"]":if(c<o.categories.deprecated){var x=-1,I=d.literal,T=o.regex.ipV4.exec(I);if(T&&(x=T.index,0!==x&&(I=I.slice(0,x)+"0:0")),0===x)f(o.diagnoses.rfc5321AddressLiteral);else if("ipv6:"!==I.slice(0,5).toLowerCase())f(o.diagnoses.rfc5322DomainLiteral);else{var B=I.slice(5),C=o.maxIPv6Groups,P=B.split(":");x=B.indexOf("::"),~x?x!==B.lastIndexOf("::")?f(o.diagnoses.rfc5322IPv62x2xColon):(0!==x&&x!==B.length-2||++C,P.length>C?f(o.diagnoses.rfc5322IPv6MaxGroups):P.length===C&&f(o.diagnoses.deprecatedIPv6)):P.length!==C&&f(o.diagnoses.rfc5322IPv6GroupCount),":"===B[0]&&":"!==B[1]?f(o.diagnoses.rfc5322IPv6ColonStart):":"===B[B.length-1]&&":"!==B[B.length-2]?f(o.diagnoses.rfc5322IPv6ColonEnd):o.checkIpV6(P)?f(o.diagnoses.rfc5321AddressLiteral):f(o.diagnoses.rfc5322IPv6BadCharacter)}}else f(o.diagnoses.rfc5322DomainLiteral);d.domain+=k,y.domains[g]+=k,m+=e.byteLength(k,"utf8"),h.prev=h.now,h.now=h.stack.pop();break;case"\\":f(o.diagnoses.rfc5322DomainLiteralOBSDText),h.stack.push(h.now),h.now=o.components.contextQuotedPair;break;case"\r":if(S===++E||"\n"!==t[E]){f(o.diagnoses.errCRNoLF);break}case" ":case"\t":f(o.diagnoses.cfwsFWS),h.stack.push(h.now),h.now=o.components.contextFWS,p=k;break;default:if(v=k.codePointAt(0),127!==v&&o.c1Controls(v)||0===v||"["===k){f(o.diagnoses.errExpectingDTEXT);break}(o.c0Controls(v)||127===v)&&f(o.diagnoses.rfc5322DomainLiteralOBSDText),d.literal+=k,d.domain+=k,y.domains[g]+=k,m+=e.byteLength(k,"utf8")}break;case o.components.contextQuotedString:switch(k){case"\\":h.stack.push(h.now),h.now=o.components.contextQuotedPair;break;case"\r":if(S===++E||"\n"!==t[E]){f(o.diagnoses.errCRNoLF);break}case"\t":d.local+=" ",y.locals[g]+=" ",m+=e.byteLength(k,"utf8"),f(o.diagnoses.cfwsFWS),h.stack.push(h.now),h.now=o.components.contextFWS,p=k;break;case'"':d.local+=k,y.locals[g]+=k,m+=e.byteLength(k,"utf8"),h.prev=h.now,h.now=h.stack.pop();break;default:v=k.codePointAt(0),127!==v&&o.c1Controls(v)||0===v||10===v?f(o.diagnoses.errExpectingQTEXT):(o.c0Controls(v)||127===v)&&f(o.diagnoses.deprecatedQTEXT),d.local+=k,y.locals[g]+=k,m+=e.byteLength(k,"utf8")}break;case o.components.contextQuotedPair:v=k.codePointAt(0),127!==v&&o.c1Controls(v)?f(o.diagnoses.errExpectingQPair):(v<31&&9!==v||127===v)&&f(o.diagnoses.deprecatedQP),h.prev=h.now,h.now=h.stack.pop();var O="\\"+k;switch(h.now){case o.components.contextComment:break;case o.components.contextQuotedString:d.local+=O,y.locals[g]+=O,m+=2;break;case o.components.literal:d.domain+=O,y.domains[g]+=O,m+=2;break;default:throw new Error("quoted pair logic invoked in an invalid context: "+h.now)}break;case o.components.contextComment:switch(k){case"(":h.stack.push(h.now),h.now=o.components.contextComment;break;case")":h.prev=h.now,h.now=h.stack.pop();break;case"\\":h.stack.push(h.now),h.now=o.components.contextQuotedPair;break;case"\r":if(S===++E||"\n"!==t[E]){f(o.diagnoses.errCRNoLF);break}case" ":case"\t":f(o.diagnoses.cfwsFWS),h.stack.push(h.now),h.now=o.components.contextFWS,p=k;break;default:if(v=k.codePointAt(0),0===v||10===v||127!==v&&o.c1Controls(v)){f(o.diagnoses.errExpectingCTEXT);break}(o.c0Controls(v)||127===v)&&f(o.diagnoses.deprecatedCTEXT)}break;case o.components.contextFWS:if("\r"===p){if("\r"===k){f(o.diagnoses.errFWSCRLFx2);break}++b>1?f(o.diagnoses.deprecatedFWS):b=1}switch(k){case"\r":S!==++E&&"\n"===t[E]||f(o.diagnoses.errCRNoLF);break;case" ":case"\t":break;default:"\r"===p&&f(o.diagnoses.errFWSCRLFEnd),b=0,h.prev=h.now,h.now=h.stack.pop(),--E}p=k;break;default:throw new Error("unknown context: "+h.now)}if(c>o.categories.rfc5322)break}if(c<o.categories.rfc5322){var R=i.encode(d.domain).length;if(h.now===o.components.contextQuotedString)f(o.diagnoses.errUnclosedQuotedString);else if(h.now===o.components.contextQuotedPair)f(o.diagnoses.errBackslashEnd);else if(h.now===o.components.contextComment)f(o.diagnoses.errUnclosedComment);else if(h.now===o.components.literal)f(o.diagnoses.errUnclosedDomainLiteral);else if("\r"===k)f(o.diagnoses.errFWSCRLFEnd);else if(0===d.domain.length)f(o.diagnoses.errNoDomain);else if(0===m)f(o.diagnoses.errDotEnd);else if(_)f(o.diagnoses.errDomainHyphenEnd);else if(R>255)f(o.diagnoses.rfc5322DomainTooLong);else if(e.byteLength(d.local,"utf8")+R+1>254)f(o.diagnoses.rfc5322TooLong);else if(m>63)f(o.diagnoses.rfc5322LabelTooLong);else if(r.minDomainAtoms&&y.domains.length<r.minDomainAtoms)f(o.diagnoses.errDomainTooShort);else if(r.tldWhitelist||r.tldBlacklist){var N=y.domains[g];o.validDomain(N,r)||f(o.diagnoses.errUnknownTLD)}}if(c<o.categories.dnsWarn){var L=y.domains[g].codePointAt(0);L<=57&&f(o.diagnoses.rfc5321TLDNumeric)}c<u&&(c=o.diagnoses.valid);var j=a?c:c<o.defaultThreshold;return s&&s(j),j},t.diagnoses=o.validate.diagnoses=function(){for(var e={},t=Object.keys(o.diagnoses),r=0;r<t.length;++r){var n=t[r];e[n]=o.diagnoses[n]}return e}(),t.normalize=o.normalize}).call(t,r(3).Buffer)},function(e,t,r){"use strict";t.errors={root:"value",key:'"{{!label}}" ',messages:{wrapArrays:!0},any:{unknown:"is not allowed",invalid:"contains an invalid value",empty:"is not allowed to be empty",required:"is required",allowOnly:"must be one of {{valids}}",default:"threw an error when running default method"},alternatives:{base:"not matching any of the allowed alternatives",child:null},array:{base:"must be an array",includes:"at position {{pos}} does not match any of the allowed types",includesSingle:'single value of "{{!label}}" does not match any of the allowed types',includesOne:"at position {{pos}} fails because {{reason}}",includesOneSingle:'single value of "{{!label}}" fails because {{reason}}',includesRequiredUnknowns:"does not contain {{unknownMisses}} required value(s)",includesRequiredKnowns:"does not contain {{knownMisses}}",includesRequiredBoth:"does not contain {{knownMisses}} and {{unknownMisses}} other required value(s)",excludes:"at position {{pos}} contains an excluded value",excludesSingle:'single value of "{{!label}}" contains an excluded value',min:"must contain at least {{limit}} items",max:"must contain less than or equal to {{limit}} items",length:"must contain {{limit}} items",ordered:"at position {{pos}} fails because {{reason}}",orderedLength:"at position {{pos}} fails because array must contain at most {{limit}} items",ref:'references "{{ref}}" which is not a positive integer',sparse:"must not be a sparse array",unique:"position {{pos}} contains a duplicate value"},boolean:{base:"must be a boolean"},binary:{base:"must be a buffer or a string",min:"must be at least {{limit}} bytes",max:"must be less than or equal to {{limit}} bytes",length:"must be {{limit}} bytes"},date:{base:"must be a number of milliseconds or valid date string",format:"must be a string with one of the following formats {{format}}",strict:"must be a valid date",min:'must be larger than or equal to "{{limit}}"',max:'must be less than or equal to "{{limit}}"',less:'must be less than "{{limit}}"',greater:'must be greater than "{{limit}}"',isoDate:"must be a valid ISO 8601 date",timestamp:{javascript:"must be a valid timestamp or number of milliseconds",unix:"must be a valid timestamp or number of seconds"},ref:'references "{{ref}}" which is not a date'},function:{base:"must be a Function",arity:"must have an arity of {{n}}",minArity:"must have an arity greater or equal to {{n}}",maxArity:"must have an arity lesser or equal to {{n}}",ref:"must be a Joi reference",class:"must be a class"},lazy:{base:"!!schema error: lazy schema must be set",schema:"!!schema error: lazy schema function must return a schema"},object:{base:"must be an object",child:'!!child "{{!child}}" fails because {{reason}}',min:"must have at least {{limit}} children",max:"must have less than or equal to {{limit}} children",length:"must have {{limit}} children",allowUnknown:'!!"{{!child}}" is not allowed',with:'!!"{{mainWithLabel}}" missing required peer "{{peerWithLabel}}"',without:'!!"{{mainWithLabel}}" conflict with forbidden peer "{{peerWithLabel}}"',missing:"must contain at least one of {{peersWithLabels}}",xor:"contains a conflict between exclusive peers {{peersWithLabels}}",or:"must contain at least one of {{peersWithLabels}}",and:"contains {{presentWithLabels}} without its required peers {{missingWithLabels}}",nand:'!!"{{mainWithLabel}}" must not exist simultaneously with {{peersWithLabels}}',assert:'!!"{{ref}}" validation failed because "{{ref}}" failed to {{message}}',rename:{multiple:'cannot rename child "{{from}}" because multiple renames are disabled and another key was already renamed to "{{to}}"',override:'cannot rename child "{{from}}" because override is disabled and target "{{to}}" exists',regex:{multiple:'cannot rename children {{from}} because multiple renames are disabled and another key was already renamed to "{{to}}"',override:'cannot rename children {{from}} because override is disabled and target "{{to}}" exists'}},type:'must be an instance of "{{type}}"',schema:"must be a Joi instance"},number:{base:"must be a number",min:"must be larger than or equal to {{limit}}",max:"must be less than or equal to {{limit}}",less:"must be less than {{limit}}",greater:"must be greater than {{limit}}",float:"must be a float or double",integer:"must be an integer",negative:"must be a negative number",positive:"must be a positive number",precision:"must have no more than {{limit}} decimal places",ref:'references "{{ref}}" which is not a number',multiple:"must be a multiple of {{multiple}}",port:"must be a valid port"},string:{base:"must be a string",min:"length must be at least {{limit}} characters long",max:"length must be less than or equal to {{limit}} characters long",length:"length must be {{limit}} characters long",alphanum:"must only contain alpha-numeric characters",token:"must only contain alpha-numeric and underscore characters",regex:{base:'with value "{{!value}}" fails to match the required pattern: {{pattern}}',name:'with value "{{!value}}" fails to match the {{name}} pattern',invert:{base:'with value "{{!value}}" matches the inverted pattern: {{pattern}}',name:'with value "{{!value}}" matches the inverted {{name}} pattern'}},email:"must be a valid email",uri:"must be a valid uri",uriRelativeOnly:"must be a valid relative uri",uriCustomScheme:"must be a valid uri with a scheme matching the {{scheme}} pattern",isoDate:"must be a valid ISO 8601 date",guid:"must be a valid GUID",hex:"must only contain hexadecimal characters",hexAlign:"hex decoded representation must be byte aligned",base64:"must be a valid base64 string",hostname:"must be a valid hostname",normalize:"must be unicode normalized in the {{form}} form",lowercase:"must only contain lowercase characters",uppercase:"must only contain uppercase characters",trim:"must not have leading or trailing whitespace",creditCard:"must be a credit card",ref:'references "{{ref}}" which is not a number',ip:"must be a valid ip address with a {{cidr}} CIDR",ipVersion:"must be a valid ip address of one of the following versions {{version}} with a {{cidr}} CIDR"}}},function(e,t,r){"use strict";var n=r(8);t.options=n.object({abortEarly:n.boolean(),convert:n.boolean(),allowUnknown:n.boolean(),skipFunctions:n.boolean(),stripUnknown:[n.boolean(),n.object({arrays:n.boolean(),objects:n.boolean()}).or("arrays","objects")],language:n.object(),presence:n.string().only("required","optional","forbidden","ignore"),raw:n.boolean(),context:n.object(),strip:n.boolean(),noDefaults:n.boolean(),escapeHtml:n.boolean()}).strict()},function(e,t,r){"use strict";var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};function i(e,t){for(var r=Object.getOwnPropertyNames(t),n=0;n<r.length;n++){var i=r[n],o=Object.getOwnPropertyDescriptor(t,i);o&&o.configurable&&void 0===e[i]&&Object.defineProperty(e,i,o)}return e}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function s(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):i(e,t))}var u=r(2),c=r(4),f=r(1),l=r(0),h={fastSplice:function(e,t){for(var r=t;r<e.length;)e[r++]=e[r];--e.length}};h.Array=function(e){function t(){o(this,t);var r=s(this,e.call(this));return r._type="array",r._inner.items=[],r._inner.ordereds=[],r._inner.inclusions=[],r._inner.exclusions=[],r._inner.requireds=[],r._flags.sparse=!1,r}return a(t,e),t.prototype._base=function e(t,r,n){var i={value:t};"string"==typeof t&&n.convert&&h.safeParse(t,i);var o=Array.isArray(i.value),s=o;if(n.convert&&this._flags.single&&!o&&(i.value=[i.value],o=!0),!o)return i.errors=this.createError("array.base",null,r,n),i;if((this._inner.inclusions.length||this._inner.exclusions.length||this._inner.requireds.length||this._inner.ordereds.length||!this._flags.sparse)&&(s&&(i.value=i.value.slice(0)),i.errors=this._checkItems.call(this,i.value,s,r,n),i.errors&&s&&n.convert&&this._flags.single)){var a=i.errors;i.value=[i.value],i.errors=this._checkItems.call(this,i.value,s,r,n),i.errors&&(i.errors=a,i.value=i.value[0])}return i},t.prototype._checkItems=function e(t,r,n,i){for(var o=[],s=void 0,a=this._inner.requireds.slice(),u=this._inner.ordereds.slice(),c=this._inner.inclusions.concat(a),f=t.length,l=0;l<f;++l){s=!1;var p=t[l],d=!1,y=r?l:n.key,g=r?n.path.concat(l):n.path,m={key:y,path:g,parent:n.parent,reference:n.reference},b=void 0;if(this._flags.sparse||void 0!==p){for(var v=0;v<this._inner.exclusions.length;++v)if(b=this._inner.exclusions[v]._validate(p,m,{}),!b.errors){if(o.push(this.createError(r?"array.excludes":"array.excludesSingle",{pos:l,value:p},{key:n.key,path:m.path},i)),s=!0,i.abortEarly)return o;u.shift();break}if(!s){if(this._inner.ordereds.length){if(u.length>0){var _=u.shift();if(b=_._validate(p,m,i),b.errors){if(o.push(this.createError("array.ordered",{pos:l,reason:b.errors,value:p},{key:n.key,path:m.path},i)),i.abortEarly)return o}else if(_._flags.strip)h.fastSplice(t,l),--l,--f;else{if(!this._flags.sparse&&void 0===b.value){if(o.push(this.createError("array.sparse",null,{key:n.key,path:m.path,pos:l},i)),i.abortEarly)return o;continue}t[l]=b.value}continue}if(!this._inner.items.length){if(o.push(this.createError("array.orderedLength",{pos:l,limit:this._inner.ordereds.length},{key:n.key,path:m.path},i)),i.abortEarly)return o;continue}}for(var w=[],S=a.length,k=0;k<S;++k)if(b=w[k]=a[k]._validate(p,m,i),!b.errors){if(t[l]=b.value,d=!0,h.fastSplice(a,k),--k,--S,!this._flags.sparse&&void 0===b.value&&(o.push(this.createError("array.sparse",null,{key:n.key,path:m.path,pos:l},i)),i.abortEarly))return o;break}if(!d){var E=!!i.stripUnknown&&(!0===i.stripUnknown||!!i.stripUnknown.arrays);S=c.length;for(var A=0;A<S;++A){var x=c[A],I=a.indexOf(x);if(-1!==I)b=w[I];else if(b=x._validate(p,m,i),!b.errors){x._flags.strip?(h.fastSplice(t,l),--l,--f):this._flags.sparse||void 0!==b.value?t[l]=b.value:(o.push(this.createError("array.sparse",null,{key:n.key,path:m.path,pos:l},i)),s=!0),d=!0;break}if(1===S){if(E){h.fastSplice(t,l),--l,--f,d=!0;break}if(o.push(this.createError(r?"array.includesOne":"array.includesOneSingle",{pos:l,reason:b.errors,value:p},{key:n.key,path:m.path},i)),s=!0,i.abortEarly)return o;break}}if(!s&&this._inner.inclusions.length&&!d){if(E){h.fastSplice(t,l),--l,--f;continue}if(o.push(this.createError(r?"array.includes":"array.includesSingle",{pos:l,value:p},{key:n.key,path:m.path},i)),i.abortEarly)return o}}}}else{if(o.push(this.createError("array.sparse",null,{key:n.key,path:m.path,pos:l},i)),i.abortEarly)return o;u.shift()}}return a.length&&this._fillMissedErrors.call(this,o,a,n,i),u.length&&this._fillOrderedErrors.call(this,o,u,n,i),o.length?o:null},t.prototype.describe=function e(){var t=u.prototype.describe.call(this);if(this._inner.ordereds.length){t.orderedItems=[];for(var r=0;r<this._inner.ordereds.length;++r)t.orderedItems.push(this._inner.ordereds[r].describe())}if(this._inner.items.length){t.items=[];for(var n=0;n<this._inner.items.length;++n)t.items.push(this._inner.items[n].describe())}return t},t.prototype.items=function e(){for(var t=this,r=this.clone(),n=arguments.length,i=Array(n),o=0;o<n;o++)i[o]=arguments[o];return l.flatten(i).forEach(function(e,n){try{e=c.schema(t._currentJoi,e)}catch(e){throw e.hasOwnProperty("path")?e.path=n+"."+e.path:e.path=n,e.message=e.message+"("+e.path+")",e}r._inner.items.push(e),"required"===e._flags.presence?r._inner.requireds.push(e):"forbidden"===e._flags.presence?r._inner.exclusions.push(e.optional()):r._inner.inclusions.push(e)}),r},t.prototype.ordered=function e(){for(var t=this,r=this.clone(),n=arguments.length,i=Array(n),o=0;o<n;o++)i[o]=arguments[o];return l.flatten(i).forEach(function(e,n){try{e=c.schema(t._currentJoi,e)}catch(e){throw e.hasOwnProperty("path")?e.path=n+"."+e.path:e.path=n,e.message=e.message+"("+e.path+")",e}r._inner.ordereds.push(e)}),r},t.prototype.min=function e(t){var r=f.isRef(t);return l.assert(Number.isSafeInteger(t)&&t>=0||r,"limit must be a positive integer or reference"),this._test("min",t,function(e,n,i){var o=void 0;if(r){if(o=t(n.reference||n.parent,i),!(Number.isSafeInteger(o)&&o>=0))return this.createError("array.ref",{ref:t.key},n,i)}else o=t;return e.length>=o?e:this.createError("array.min",{limit:t,value:e},n,i)})},t.prototype.max=function e(t){var r=f.isRef(t);return l.assert(Number.isSafeInteger(t)&&t>=0||r,"limit must be a positive integer or reference"),this._test("max",t,function(e,n,i){var o=void 0;if(r){if(o=t(n.reference||n.parent,i),!(Number.isSafeInteger(o)&&o>=0))return this.createError("array.ref",{ref:t.key},n,i)}else o=t;return e.length<=o?e:this.createError("array.max",{limit:t,value:e},n,i)})},t.prototype.length=function e(t){var r=f.isRef(t);return l.assert(Number.isSafeInteger(t)&&t>=0||r,"limit must be a positive integer or reference"),this._test("length",t,function(e,n,i){var o=void 0;if(r){if(o=t(n.reference||n.parent,i),!(Number.isSafeInteger(o)&&o>=0))return this.createError("array.ref",{ref:t.key},n,i)}else o=t;return e.length===o?e:this.createError("array.length",{limit:t,value:e},n,i)})},t.prototype.unique=function e(t){l.assert(void 0===t||"function"==typeof t||"string"==typeof t,"comparator must be a function or a string");var r={};return"string"==typeof t?r.path=t:"function"==typeof t&&(r.comparator=t),this._test("unique",r,function(e,t,i){for(var o={string:Object.create(null),number:Object.create(null),undefined:Object.create(null),boolean:Object.create(null),object:new Map,function:new Map,custom:new Map},s=r.comparator||l.deepEqual,a=0;a<e.length;++a){var u=r.path?l.reach(e[a],r.path):e[a],c=r.comparator?o.custom:o[void 0===u?"undefined":n(u)];if(c)if(c instanceof Map){for(var f=c.entries(),h=void 0;!(h=f.next()).done;)if(s(h.value[0],u)){var p={key:t.key,path:t.path.concat(a),parent:t.parent,reference:t.reference},d={pos:a,value:e[a],dupePos:h.value[1],dupeValue:e[h.value[1]]};return r.path&&(d.path=r.path),this.createError("array.unique",d,p,i)}c.set(u,a)}else{if(void 0!==c[u]){var y={key:t.key,path:t.path.concat(a),parent:t.parent,reference:t.reference},g={pos:a,value:e[a],dupePos:c[u],dupeValue:e[c[u]]};return r.path&&(g.path=r.path),this.createError("array.unique",g,y,i)}c[u]=a}}return e})},t.prototype.sparse=function e(t){var r=void 0===t||!!t;if(this._flags.sparse===r)return this;var n=this.clone();return n._flags.sparse=r,n},t.prototype.single=function e(t){var r=void 0===t||!!t;if(this._flags.single===r)return this;var n=this.clone();return n._flags.single=r,n},t.prototype._fillMissedErrors=function e(t,r,n,i){for(var o=[],s=0,a=0;a<r.length;++a){var u=r[a]._getLabel();u?o.push(u):++s}o.length?s?t.push(this.createError("array.includesRequiredBoth",{knownMisses:o,unknownMisses:s},{key:n.key,path:n.path},i)):t.push(this.createError("array.includesRequiredKnowns",{knownMisses:o},{key:n.key,path:n.path},i)):t.push(this.createError("array.includesRequiredUnknowns",{unknownMisses:s},{key:n.key,path:n.path},i))},t.prototype._fillOrderedErrors=function e(t,r,n,i){for(var o=[],s=0;s<r.length;++s){var a=l.reach(r[s],"_flags.presence");"required"===a&&o.push(r[s])}o.length&&this._fillMissedErrors.call(this,t,o,n,i)},t}(u),h.safeParse=function(e,t){try{var r=JSON.parse(e);Array.isArray(r)&&(t.value=r)}catch(e){}},e.exports=new h.Array},function(e,t,r){"use strict";(function(t){function n(e,t){for(var r=Object.getOwnPropertyNames(t),n=0;n<r.length;n++){var i=r[n],o=Object.getOwnPropertyDescriptor(t,i);o&&o.configurable&&void 0===e[i]&&Object.defineProperty(e,i,o)}return e}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):n(e,t))}var a=r(2),u=r(0),c={};c.Binary=function(e){function r(){i(this,r);var t=o(this,e.call(this));return t._type="binary",t}return s(r,e),r.prototype._base=function e(r,n,i){var o={value:r};if("string"==typeof r&&i.convert)try{o.value=t.from(r,this._flags.encoding)}catch(e){}return o.errors=t.isBuffer(o.value)?null:this.createError("binary.base",null,n,i),o},r.prototype.encoding=function e(r){if(u.assert(t.isEncoding(r),"Invalid encoding:",r),this._flags.encoding===r)return this;var n=this.clone();return n._flags.encoding=r,n},r.prototype.min=function e(t){return u.assert(Number.isSafeInteger(t)&&t>=0,"limit must be a positive integer"),this._test("min",t,function(e,r,n){return e.length>=t?e:this.createError("binary.min",{limit:t,value:e},r,n)})},r.prototype.max=function e(t){return u.assert(Number.isSafeInteger(t)&&t>=0,"limit must be a positive integer"),this._test("max",t,function(e,r,n){return e.length<=t?e:this.createError("binary.max",{limit:t,value:e},r,n)})},r.prototype.length=function e(t){return u.assert(Number.isSafeInteger(t)&&t>=0,"limit must be a positive integer"),this._test("length",t,function(e,r,n){return e.length===t?e:this.createError("binary.length",{limit:t,value:e},r,n)})},r}(a),e.exports=new c.Binary}).call(t,r(3).Buffer)},function(e,t,r){"use strict";function n(e,t){for(var r=Object.getOwnPropertyNames(t),n=0;n<r.length;n++){var i=r[n],o=Object.getOwnPropertyDescriptor(t,i);o&&o.configurable&&void 0===e[i]&&Object.defineProperty(e,i,o)}return e}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):n(e,t))}var a=r(2),u=r(0),c={Set:r(9)};c.Boolean=function(e){function t(){i(this,t);var r=o(this,e.call(this));return r._type="boolean",r._flags.insensitive=!0,r._inner.truthySet=new c.Set,r._inner.falsySet=new c.Set,r}return s(t,e),t.prototype._base=function e(t,r,n){var i={value:t};if("string"==typeof t&&n.convert){var o=this._flags.insensitive?t.toLowerCase():t;i.value="true"===o||"false"!==o&&t}return"boolean"!=typeof i.value&&(i.value=!!this._inner.truthySet.has(t,null,null,this._flags.insensitive)||!this._inner.falsySet.has(t,null,null,this._flags.insensitive)&&t),i.errors="boolean"==typeof i.value?null:this.createError("boolean.base",null,r,n),i},t.prototype.truthy=function e(){for(var t=arguments.length,r=Array(t),n=0;n<t;n++)r[n]=arguments[n];var i=this.clone();r=u.flatten(r);for(var o=0;o<r.length;++o){var s=r[o];u.assert(void 0!==s,"Cannot call truthy with undefined"),i._inner.truthySet.add(s)}return i},t.prototype.falsy=function e(){for(var t=arguments.length,r=Array(t),n=0;n<t;n++)r[n]=arguments[n];var i=this.clone();r=u.flatten(r);for(var o=0;o<r.length;++o){var s=r[o];u.assert(void 0!==s,"Cannot call falsy with undefined"),i._inner.falsySet.add(s)}return i},t.prototype.insensitive=function e(t){var e=void 0===t||!!t;if(this._flags.insensitive===e)return this;var r=this.clone();return r._flags.insensitive=e,r},t.prototype.describe=function e(){var t=a.prototype.describe.call(this);return t.truthy=[!0].concat(this._inner.truthySet.values()),t.falsy=[!1].concat(this._inner.falsySet.values()),t},t}(a),e.exports=new c.Boolean},function(e,t,r){"use strict";function n(e,t){for(var r=Object.getOwnPropertyNames(t),n=0;n<r.length;n++){var i=r[n],o=Object.getOwnPropertyDescriptor(t,i);o&&o.configurable&&void 0===e[i]&&Object.defineProperty(e,i,o)}return e}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):n(e,t))}var a=r(0),u=r(13),c=r(1),f={};f.Func=function(e){function t(){i(this,t);var r=o(this,e.call(this));return r._flags.func=!0,r}return s(t,e),t.prototype.arity=function e(t){return a.assert(Number.isSafeInteger(t)&&t>=0,"n must be a positive integer"),this._test("arity",t,function(e,r,n){return e.length===t?e:this.createError("function.arity",{n:t},r,n)})},t.prototype.minArity=function e(t){return a.assert(Number.isSafeInteger(t)&&t>0,"n must be a strict positive integer"),this._test("minArity",t,function(e,r,n){return e.length>=t?e:this.createError("function.minArity",{n:t},r,n)})},t.prototype.maxArity=function e(t){return a.assert(Number.isSafeInteger(t)&&t>=0,"n must be a positive integer"),this._test("maxArity",t,function(e,r,n){return e.length<=t?e:this.createError("function.maxArity",{n:t},r,n)})},t.prototype.ref=function e(){return this._test("ref",null,function(e,t,r){return c.isRef(e)?e:this.createError("function.ref",null,t,r)})},t.prototype.class=function e(){return this._test("class",null,function(e,t,r){return/^\s*class\s/.test(e.toString())?e:this.createError("function.class",null,t,r)})},t}(u.constructor),e.exports=new f.Func},function(e,t,r){"use strict";function n(e,t){for(var r=Object.getOwnPropertyNames(t),n=0;n<r.length;n++){var i=r[n],o=Object.getOwnPropertyDescriptor(t,i);o&&o.configurable&&void 0===e[i]&&Object.defineProperty(e,i,o)}return e}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):n(e,t))}var a=r(2),u=r(0),c={};c.Lazy=function(e){function t(){i(this,t);var r=o(this,e.call(this));return r._type="lazy",r}return s(t,e),t.prototype._base=function e(t,r,n){var i={value:t},o=this._flags.lazy;if(!o)return i.errors=this.createError("lazy.base",null,r,n),i;var s=o();return s instanceof a?s._validate(t,r,n):(i.errors=this.createError("lazy.schema",null,r,n),i)},t.prototype.set=function e(t){u.assert("function"==typeof t,"You must provide a function as first argument");var r=this.clone();return r._flags.lazy=t,r},t}(a),e.exports=new c.Lazy},function(e,t,r){"use strict";function n(e,t){for(var r=Object.getOwnPropertyNames(t),n=0;n<r.length;n++){var i=r[n],o=Object.getOwnPropertyDescriptor(t,i);o&&o.configurable&&void 0===e[i]&&Object.defineProperty(e,i,o)}return e}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):n(e,t))}var a=r(2),u=r(1),c=r(0),f={precisionRx:/(?:\.(\d+))?(?:[eE]([+-]?\d+))?$/};f.Number=function(e){function t(){i(this,t);var r=o(this,e.call(this));return r._type="number",r._invalids.add(1/0),r._invalids.add(-1/0),r}return s(t,e),t.prototype._base=function e(t,r,n){var i={errors:null,value:t};if("string"==typeof t&&n.convert){var o=parseFloat(t);i.value=isNaN(o)||!isFinite(t)?NaN:o}var s="number"==typeof i.value&&!isNaN(i.value);if(n.convert&&"precision"in this._flags&&s){var a=Math.pow(10,this._flags.precision);i.value=Math.round(i.value*a)/a}return i.errors=s?null:this.createError("number.base",null,r,n),i},t.prototype.multiple=function e(t){var r=u.isRef(t);return r||(c.assert("number"==typeof t&&isFinite(t),"multiple must be a number"),c.assert(t>0,"multiple must be greater than 0")),this._test("multiple",t,function(e,n,i){var o=r?t(n.reference||n.parent,i):t;return!r||"number"==typeof o&&isFinite(o)?e%o==0?e:this.createError("number.multiple",{multiple:t,value:e},n,i):this.createError("number.ref",{ref:t.key},n,i)})},t.prototype.integer=function e(){return this._test("integer",void 0,function(e,t,r){return Number.isSafeInteger(e)?e:this.createError("number.integer",{value:e},t,r)})},t.prototype.negative=function e(){return this._test("negative",void 0,function(e,t,r){return e<0?e:this.createError("number.negative",{value:e},t,r)})},t.prototype.positive=function e(){return this._test("positive",void 0,function(e,t,r){return e>0?e:this.createError("number.positive",{value:e},t,r)})},t.prototype.precision=function e(t){c.assert(Number.isSafeInteger(t),"limit must be an integer"),c.assert(!("precision"in this._flags),"precision already set");var r=this._test("precision",t,function(e,r,n){var i=e.toString().match(f.precisionRx),o=Math.max((i[1]?i[1].length:0)-(i[2]?parseInt(i[2],10):0),0);return o<=t?e:this.createError("number.precision",{limit:t,value:e},r,n)});return r._flags.precision=t,r},t.prototype.port=function e(){return this._test("port",void 0,function(e,t,r){return!Number.isSafeInteger(e)||e<0||e>65535?this.createError("number.port",{value:e},t,r):e})},t}(a),f.compare=function(e,t){return function(r){var n=u.isRef(r),i="number"==typeof r&&!isNaN(r);return c.assert(i||n,"limit must be a number or reference"),this._test(e,r,function(i,o,s){var a=void 0;if(n){if(a=r(o.reference||o.parent,s),"number"!=typeof a||isNaN(a))return this.createError("number.ref",{ref:r.key},o,s)}else a=r;return t(i,a)?i:this.createError("number."+e,{limit:a,value:i},o,s)})}},f.Number.prototype.min=f.compare("min",function(e,t){return e>=t}),f.Number.prototype.max=f.compare("max",function(e,t){return e<=t}),f.Number.prototype.greater=f.compare("greater",function(e,t){return e>t}),f.Number.prototype.less=f.compare("less",function(e,t){return e<t}),e.exports=new f.Number},function(e,t,r){"use strict";(function(t){var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};function i(e,t){for(var r=Object.getOwnPropertyNames(t),n=0;n<r.length;n++){var i=r[n],o=Object.getOwnPropertyDescriptor(t,i);o&&o.configurable&&void 0===e[i]&&Object.defineProperty(e,i,o)}return e}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function s(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):i(e,t))}var u=r(15),c=r(0),f=void 0,l=r(2),h=r(1),p=r(12),d=r(30),y=r(29),g={uriRegex:d.createUriRegex(),ipRegex:y.createIpRegex(["ipv4","ipv6","ipvfuture"],"optional"),guidBrackets:{"{":"}","[":"]","(":")","":""},guidVersions:{uuidv1:"1",uuidv2:"2",uuidv3:"3",uuidv4:"4",uuidv5:"5"},cidrPresences:["required","optional","forbidden"],normalizationForms:["NFC","NFD","NFKC","NFKD"]};g.String=function(e){function t(){o(this,t);var r=s(this,e.call(this));return r._type="string",r._invalids.add(""),r}return a(t,e),t.prototype._base=function e(t,r,n){if("string"==typeof t&&n.convert){if(this._flags.normalize&&(t=t.normalize(this._flags.normalize)),this._flags.case&&(t="upper"===this._flags.case?t.toLocaleUpperCase():t.toLocaleLowerCase()),this._flags.trim&&(t=t.trim()),this._inner.replacements)for(var i=0;i<this._inner.replacements.length;++i){var o=this._inner.replacements[i];t=t.replace(o.pattern,o.replacement)}if(this._flags.truncate)for(var s=0;s<this._tests.length;++s){var a=this._tests[s];if("max"===a.name){t=t.slice(0,a.arg);break}}this._flags.byteAligned&&t.length%2!=0&&(t="0"+t)}return{value:t,errors:"string"==typeof t?null:this.createError("string.base",{value:t},r,n)}},t.prototype.insensitive=function e(){if(this._flags.insensitive)return this;var t=this.clone();return t._flags.insensitive=!0,t},t.prototype.creditCard=function e(){return this._test("creditCard",void 0,function(e,t,r){for(var n=e.length,i=0,o=1;n--;){var s=e.charAt(n)*o;i+=s-9*(s>9),o^=3}var a=i%10==0&&i>0;return a?e:this.createError("string.creditCard",{value:e},t,r)})},t.prototype.regex=function e(t,r){c.assert(t instanceof RegExp,"pattern must be a RegExp");var i={pattern:new RegExp(t.source,t.ignoreCase?"i":void 0)};"string"==typeof r?i.name=r:"object"===(void 0===r?"undefined":n(r))&&(i.invert=!!r.invert,r.name&&(i.name=r.name));var o=["string.regex",i.invert?".invert":"",i.name?".name":".base"].join("");return this._test("regex",i,function(e,t,r){var n=i.pattern.test(e);return n^i.invert?e:this.createError(o,{name:i.name,pattern:i.pattern,value:e},t,r)})},t.prototype.alphanum=function e(){return this._test("alphanum",void 0,function(e,t,r){return/^[a-zA-Z0-9]+$/.test(e)?e:this.createError("string.alphanum",{value:e},t,r)})},t.prototype.token=function e(){return this._test("token",void 0,function(e,t,r){return/^\w+$/.test(e)?e:this.createError("string.token",{value:e},t,r)})},t.prototype.email=function e(t){return t&&(c.assert("object"===(void 0===t?"undefined":n(t)),"email options must be an object"),c.assert(void 0===t.checkDNS,"checkDNS option is not supported"),c.assert(void 0===t.tldWhitelist||"object"===n(t.tldWhitelist),"tldWhitelist must be an array or object"),c.assert(void 0===t.minDomainAtoms||Number.isSafeInteger(t.minDomainAtoms)&&t.minDomainAtoms>0,"minDomainAtoms must be a positive integer"),c.assert(void 0===t.errorLevel||"boolean"==typeof t.errorLevel||Number.isSafeInteger(t.errorLevel)&&t.errorLevel>=0,"errorLevel must be a non-negative integer or boolean")),this._test("email",t,function(e,n,i){f=f||r(19);try{var o=f.validate(e,t);if(!0===o||0===o)return e}catch(e){}return this.createError("string.email",{value:e},n,i)})},t.prototype.ip=function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=g.ipRegex;c.assert("object"===(void 0===t?"undefined":n(t)),"options must be an object"),t.cidr?(c.assert("string"==typeof t.cidr,"cidr must be a string"),t.cidr=t.cidr.toLowerCase(),c.assert(c.contain(g.cidrPresences,t.cidr),"cidr must be one of "+g.cidrPresences.join(", ")),t.version||"optional"===t.cidr||(r=y.createIpRegex(["ipv4","ipv6","ipvfuture"],t.cidr))):t.cidr="optional";var i=void 0;if(t.version){Array.isArray(t.version)||(t.version=[t.version]),c.assert(t.version.length>=1,"version must have at least 1 version specified"),i=[];for(var o=0;o<t.version.length;++o){var s=t.version[o];c.assert("string"==typeof s,"version at position "+o+" must be a string"),s=s.toLowerCase(),c.assert(y.versions[s],"version at position "+o+" must be one of "+Object.keys(y.versions).join(", ")),i.push(s)}i=c.unique(i),r=y.createIpRegex(i,t.cidr)}return this._test("ip",t,function(e,n,o){return r.test(e)?e:i?this.createError("string.ipVersion",{value:e,cidr:t.cidr,version:i},n,o):this.createError("string.ip",{value:e,cidr:t.cidr},n,o)})},t.prototype.uri=function e(t){var r="",i=!1,o=!1,s=g.uriRegex;if(t){if(c.assert("object"===(void 0===t?"undefined":n(t)),"options must be an object"),t.scheme){c.assert(t.scheme instanceof RegExp||"string"==typeof t.scheme||Array.isArray(t.scheme),"scheme must be a RegExp, String, or Array"),Array.isArray(t.scheme)||(t.scheme=[t.scheme]),c.assert(t.scheme.length>=1,"scheme must have at least 1 scheme specified");for(var a=0;a<t.scheme.length;++a){var u=t.scheme[a];c.assert(u instanceof RegExp||"string"==typeof u,"scheme at position "+a+" must be a RegExp or String"),r+=r?"|":"",u instanceof RegExp?r+=u.source:(c.assert(/[a-zA-Z][a-zA-Z0-9+-\.]*/.test(u),"scheme at position "+a+" must be a valid scheme"),r+=c.escapeRegex(u))}}t.allowRelative&&(i=!0),t.relativeOnly&&(o=!0)}return(r||i||o)&&(s=d.createUriRegex(r,i,o)),this._test("uri",t,function(e,t,n){return s.test(e)?e:o?this.createError("string.uriRelativeOnly",{value:e},t,n):r?this.createError("string.uriCustomScheme",{scheme:r,value:e},t,n):this.createError("string.uri",{value:e},t,n)})},t.prototype.isoDate=function e(){return this._test("isoDate",void 0,function(e,t,r){if(p._isIsoDate(e)){if(!r.convert)return e;var n=new Date(e);if(!isNaN(n.getTime()))return n.toISOString()}return this.createError("string.isoDate",{value:e},t,r)})},t.prototype.guid=function e(t){var r="";if(t&&t.version){Array.isArray(t.version)||(t.version=[t.version]),c.assert(t.version.length>=1,"version must have at least 1 valid version specified");for(var n=new Set,i=0;i<t.version.length;++i){var o=t.version[i];c.assert("string"==typeof o,"version at position "+i+" must be a string"),o=o.toLowerCase();var s=g.guidVersions[o];c.assert(s,"version at position "+i+" must be one of "+Object.keys(g.guidVersions).join(", ")),c.assert(!n.has(s),"version at position "+i+" must not be a duplicate."),r+=s,n.add(s)}}var a=new RegExp("^([\\[{\\(]?)[0-9A-F]{8}([:-]?)[0-9A-F]{4}\\2?["+(r||"0-9A-F")+"][0-9A-F]{3}\\2?["+(r?"89AB":"0-9A-F")+"][0-9A-F]{3}\\2?[0-9A-F]{12}([\\]}\\)]?)$","i");return this._test("guid",t,function(e,t,r){var n=a.exec(e);return n?g.guidBrackets[n[1]]!==n[n.length-1]?this.createError("string.guid",{value:e},t,r):e:this.createError("string.guid",{value:e},t,r)})},t.prototype.hex=function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};c.assert("object"===(void 0===t?"undefined":n(t)),"hex options must be an object"),c.assert(void 0===t.byteAligned||"boolean"==typeof t.byteAligned,"byteAligned must be boolean");var r=!0===t.byteAligned,i=/^[a-f0-9]+$/i,o=this._test("hex",i,function(e,t,n){return i.test(e)?r&&e.length%2!=0?this.createError("string.hexAlign",{value:e},t,n):e:this.createError("string.hex",{value:e},t,n)});return r&&(o._flags.byteAligned=!0),o},t.prototype.base64=function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};c.assert("object"===(void 0===t?"undefined":n(t)),"base64 options must be an object"),c.assert(void 0===t.paddingRequired||"boolean"==typeof t.paddingRequired,"paddingRequired must be boolean");var r=!1===t.paddingRequired?t.paddingRequired:t.paddingRequired||!0,i=r?/^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/:/^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}(==)?|[A-Za-z0-9+\/]{3}=?)?$/;return this._test("base64",i,function(e,t,r){return i.test(e)?e:this.createError("string.base64",{value:e},t,r)})},t.prototype.hostname=function e(){var t=/^(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]*[a-zA-Z0-9])\.)*([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\-]*[A-Za-z0-9])$/;return this._test("hostname",void 0,function(e,r,n){return e.length<=255&&t.test(e)||u.isIPv6(e)?e:this.createError("string.hostname",{value:e},r,n)})},t.prototype.normalize=function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"NFC";c.assert(c.contain(g.normalizationForms,t),"normalization form must be one of "+g.normalizationForms.join(", "));var r=this._test("normalize",t,function(e,r,n){return n.convert||e===e.normalize(t)?e:this.createError("string.normalize",{value:e,form:t},r,n)});return r._flags.normalize=t,r},t.prototype.lowercase=function e(){var t=this._test("lowercase",void 0,function(e,t,r){return r.convert||e===e.toLocaleLowerCase()?e:this.createError("string.lowercase",{value:e},t,r)});return t._flags.case="lower",t},t.prototype.uppercase=function e(){var t=this._test("uppercase",void 0,function(e,t,r){return r.convert||e===e.toLocaleUpperCase()?e:this.createError("string.uppercase",{value:e},t,r)});return t._flags.case="upper",t},t.prototype.trim=function e(){var t=this._test("trim",void 0,function(e,t,r){return r.convert||e===e.trim()?e:this.createError("string.trim",{value:e},t,r)});return t._flags.trim=!0,t},t.prototype.replace=function e(t,r){"string"==typeof t&&(t=new RegExp(c.escapeRegex(t),"g")),c.assert(t instanceof RegExp,"pattern must be a RegExp"),c.assert("string"==typeof r,"replacement must be a String");var n=this.clone();return n._inner.replacements||(n._inner.replacements=[]),n._inner.replacements.push({pattern:t,replacement:r}),n},t.prototype.truncate=function e(t){var r=void 0===t||!!t;if(this._flags.truncate===r)return this;var n=this.clone();return n._flags.truncate=r,n},t}(l),g.compare=function(e,r){return function(n,i){var o=h.isRef(n);return c.assert(Number.isSafeInteger(n)&&n>=0||o,"limit must be a positive integer or reference"),c.assert(!i||t.isEncoding(i),"Invalid encoding:",i),this._test(e,n,function(t,s,a){var u=void 0;if(o){if(u=n(s.reference||s.parent,a),!Number.isSafeInteger(u))return this.createError("string.ref",{ref:n.key},s,a)}else u=n;return r(t,u,i)?t:this.createError("string."+e,{limit:u,value:t,encoding:i},s,a)})}},g.String.prototype.min=g.compare("min",function(e,r,n){var i=n?t.byteLength(e,n):e.length;return i>=r}),g.String.prototype.max=g.compare("max",function(e,r,n){var i=n?t.byteLength(e,n):e.length;return i<=r}),g.String.prototype.length=g.compare("length",function(e,r,n){var i=n?t.byteLength(e,n):e.length;return i===r}),g.String.prototype.uuid=g.String.prototype.guid,e.exports=new g.String}).call(t,r(3).Buffer)},function(e,t,r){"use strict";var n=r(14),i={Ip:{cidrs:{ipv4:{required:"\\/(?:"+n.ipv4Cidr+")",optional:"(?:\\/(?:"+n.ipv4Cidr+"))?",forbidden:""},ipv6:{required:"\\/"+n.ipv6Cidr,optional:"(?:\\/"+n.ipv6Cidr+")?",forbidden:""},ipvfuture:{required:"\\/"+n.ipv6Cidr,optional:"(?:\\/"+n.ipv6Cidr+")?",forbidden:""}},versions:{ipv4:n.IPv4address,ipv6:n.IPv6address,ipvfuture:n.IPvFuture}}};i.Ip.createIpRegex=function(e,t){for(var r=void 0,n=0;n<e.length;++n){var o=e[n];r?r+="|"+i.Ip.versions[o]+i.Ip.cidrs[o][t]:r="^(?:"+i.Ip.versions[o]+i.Ip.cidrs[o][t]}return new RegExp(r+")$")},e.exports=i.Ip},function(e,t,r){"use strict";var n=r(14),i={Uri:{createUriRegex:function e(t,r,i){var o=n.scheme,s=void 0;if(i)s="(?:"+n.relativeRef+")";else{t&&(o="(?:"+t+")");var a="(?:"+o+":"+n.hierPart+")";s=r?"(?:"+a+"|"+n.relativeRef+")":a}return new RegExp("^"+s+"(?:\\?"+n.query+")?(?:#"+n.fragment+")?$")}}};e.exports=i.Uri},function(e,t,r){"use strict";var n=r(0),i={};t=e.exports=i.Topo=function(){this._items=[],this.nodes=[]},i.Topo.prototype.add=function(e,t){var r=this;t=t||{};var i=[].concat(t.before||[]),o=[].concat(t.after||[]),s=t.group||"?",a=t.sort||0;n.assert(-1===i.indexOf(s),"Item cannot come before itself:",s),n.assert(-1===i.indexOf("?"),"Item cannot come before unassociated items"),n.assert(-1===o.indexOf(s),"Item cannot come after itself:",s),n.assert(-1===o.indexOf("?"),"Item cannot come after unassociated items"),[].concat(e).forEach(function(e,t){var n={seq:r._items.length,sort:a,before:i,after:o,group:s,node:e};r._items.push(n)});var u=this._sort();return n.assert(!u,"item","?"!==s?"added into group "+s:"","created a dependencies error"),this.nodes},i.Topo.prototype.merge=function(e){e=[].concat(e);for(var t=0;t<e.length;++t){var r=e[t];if(r)for(var o=0;o<r._items.length;++o){var s=n.shallow(r._items[o]);this._items.push(s)}}this._items.sort(i.mergeSort);for(var a=0;a<this._items.length;++a)this._items[a].seq=a;var u=this._sort();return n.assert(!u,"merge created a dependencies error"),this.nodes},i.mergeSort=function(e,t){return e.sort===t.sort?0:e.sort<t.sort?-1:1},i.Topo.prototype._sort=function(){for(var e={},t=Object.create(null),r=Object.create(null),n=0;n<this._items.length;++n){var i=this._items[n],o=i.seq,s=i.group;r[s]=r[s]||[],r[s].push(o),e[o]=i.before;for(var a=i.after,u=0;u<a.length;++u)t[a[u]]=(t[a[u]]||[]).concat(o)}for(var c=Object.keys(e),f=0;f<c.length;++f){for(var l=c[f],h=[],p=Object.keys(e[l]),d=0;d<p.length;++d){var y=e[l][p[d]];r[y]=r[y]||[];for(var g=0;g<r[y].length;++g)h.push(r[y][g])}e[l]=h}for(var m=Object.keys(t),b=0;b<m.length;++b){var v=m[b];if(r[v])for(var _=0;_<r[v].length;++_){var w=r[v][_];e[w]=e[w].concat(t[v])}}var S=void 0,k={};c=Object.keys(e);for(var E=0;E<c.length;++E){var A=c[E];S=e[A];for(var x=0;x<S.length;++x)k[S[x]]=(k[S[x]]||[]).concat(A)}for(var I={},T=[],B=0;B<this._items.length;++B){var C=B;if(k[B]){C=null;for(var P=0;P<this._items.length;++P)if(!0!==I[P]){k[P]||(k[P]=[]);for(var O=k[P].length,R=0,N=0;N<O;++N)I[k[P][N]]&&++R;if(R===O){C=P;break}}}null!==C&&(I[C]=!0,T.push(C))}if(T.length!==this._items.length)return new Error("Invalid dependencies");for(var L={},j=0;j<this._items.length;++j){var M=this._items[j];L[M.seq]=M}var K=[];this._items=T.map(function(e){var t=L[e];return K.push(t.node),t}),this.nodes=K}},function(e,t,r){"use strict";var n=r(8);e.exports=n},function(e,t,r){"use strict";t.byteLength=f,t.toByteArray=l,t.fromByteArray=d;for(var n=[],i=[],o="undefined"!=typeof Uint8Array?Uint8Array:Array,s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",a=0,u=s.length;a<u;++a)n[a]=s[a],i[s.charCodeAt(a)]=a;function c(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");return"="===e[t-2]?2:"="===e[t-1]?1:0}function f(e){return 3*e.length/4-c(e)}function l(e){var t,r,n,s,a,u=e.length;s=c(e),a=new o(3*u/4-s),r=s>0?u-4:u;var f=0;for(t=0;t<r;t+=4)n=i[e.charCodeAt(t)]<<18|i[e.charCodeAt(t+1)]<<12|i[e.charCodeAt(t+2)]<<6|i[e.charCodeAt(t+3)],a[f++]=n>>16&255,a[f++]=n>>8&255,a[f++]=255&n;return 2===s?(n=i[e.charCodeAt(t)]<<2|i[e.charCodeAt(t+1)]>>4,a[f++]=255&n):1===s&&(n=i[e.charCodeAt(t)]<<10|i[e.charCodeAt(t+1)]<<4|i[e.charCodeAt(t+2)]>>2,a[f++]=n>>8&255,a[f++]=255&n),a}function h(e){return n[e>>18&63]+n[e>>12&63]+n[e>>6&63]+n[63&e]}function p(e,t,r){for(var n,i=[],o=t;o<r;o+=3)n=(e[o]<<16)+(e[o+1]<<8)+e[o+2],i.push(h(n));return i.join("")}function d(e){for(var t,r=e.length,i=r%3,o="",s=[],a=16383,u=0,c=r-i;u<c;u+=16383)s.push(p(e,u,u+16383>c?c:u+16383));return 1===i?(t=e[r-1],o+=n[t>>2],o+=n[t<<4&63],o+="=="):2===i&&(t=(e[r-2]<<8)+e[r-1],o+=n[t>>10],o+=n[t>>4&63],o+=n[t<<2&63],o+="="),s.push(o),s.join("")}i["-".charCodeAt(0)]=62,i["_".charCodeAt(0)]=63},function(e,t){t.read=function(e,t,r,n,i){var o,s,a=8*i-n-1,u=(1<<a)-1,c=u>>1,f=-7,l=r?i-1:0,h=r?-1:1,p=e[t+l];for(l+=h,o=p&(1<<-f)-1,p>>=-f,f+=a;f>0;o=256*o+e[t+l],l+=h,f-=8);for(s=o&(1<<-f)-1,o>>=-f,f+=n;f>0;s=256*s+e[t+l],l+=h,f-=8);if(0===o)o=1-c;else{if(o===u)return s?NaN:1/0*(p?-1:1);s+=Math.pow(2,n),o-=c}return(p?-1:1)*s*Math.pow(2,o-n)},t.write=function(e,t,r,n,i,o){var s,a,u,c=8*o-i-1,f=(1<<c)-1,l=f>>1,h=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,p=n?0:o-1,d=n?1:-1,y=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(a=isNaN(t)?1:0,s=f):(s=Math.floor(Math.log(t)/Math.LN2),t*(u=Math.pow(2,-s))<1&&(s--,u*=2),t+=s+l>=1?h/u:h*Math.pow(2,1-l),t*u>=2&&(s++,u/=2),s+l>=f?(a=0,s=f):s+l>=1?(a=(t*u-1)*Math.pow(2,i),s+=l):(a=t*Math.pow(2,l-1)*Math.pow(2,i),s=0));i>=8;e[r+p]=255&a,p+=d,a/=256,i-=8);for(s=s<<i|a,c+=i;c>0;e[r+p]=255&s,p+=d,s/=256,c-=8);e[r+p-d]|=128*y}},function(e,t){var r={}.toString;e.exports=Array.isArray||function(e){return"[object Array]"==r.call(e)}},function(e,t){e.exports={_args:[["joi@13.4.0","/Users/jeff/projects/joi-browser"]],_development:!0,_from:"joi@13.4.0",_id:"joi@13.4.0",_inBundle:!1,_integrity:"sha512-JuK4GjEu6j7zr9FuVe2MAseZ6si/8/HaY0qMAejfDFHp7jcH4OKE937mIHM5VT4xDS0q7lpQbszbxKV9rm0yUg==",_location:"/joi",_phantomChildren:{},_requested:{type:"version",registry:!0,raw:"joi@13.4.0",name:"joi",escapedName:"joi",rawSpec:"13.4.0",saveSpec:null,fetchSpec:"13.4.0"},_requiredBy:["#DEV:/"],_resolved:"https://registry.npmjs.org/joi/-/joi-13.4.0.tgz",_spec:"13.4.0",_where:"/Users/jeff/projects/joi-browser",bugs:{url:"https://github.com/hapijs/joi/issues"},dependencies:{hoek:"5.x.x",isemail:"3.x.x",topo:"3.x.x"},description:"Object schema validation",devDependencies:{code:"5.x.x",hapitoc:"1.x.x",lab:"15.x.x"},engines:{node:">=8.9.0"},homepage:"https://github.com/hapijs/joi",keywords:["hapi","schema","validation"],license:"BSD-3-Clause",main:"lib/index.js",name:"joi",repository:{type:"git",url:"git://github.com/hapijs/joi.git"},scripts:{test:"lab -t 100 -a code -L","test-cov-html":"lab -r html -o coverage.html -a code","test-debug":"lab -a code",toc:"hapitoc",version:"npm run toc && git add API.md README.md"},version:"13.4.0"}},function(e,t,r){(function(e){function r(e,t){for(var r=0,n=e.length-1;n>=0;n--){var i=e[n];"."===i?e.splice(n,1):".."===i?(e.splice(n,1),r++):r&&(e.splice(n,1),r--)}if(t)for(;r--;r)e.unshift("..");return e}var n=/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/,i=function(e){return n.exec(e).slice(1)};function o(e,t){if(e.filter)return e.filter(t);for(var r=[],n=0;n<e.length;n++)t(e[n],n,e)&&r.push(e[n]);return r}t.resolve=function(){for(var t="",n=!1,i=arguments.length-1;i>=-1&&!n;i--){var s=i>=0?arguments[i]:e.cwd();if("string"!=typeof s)throw new TypeError("Arguments to path.resolve must be strings");s&&(t=s+"/"+t,n="/"===s.charAt(0))}return t=r(o(t.split("/"),function(e){return!!e}),!n).join("/"),(n?"/":"")+t||"."},t.normalize=function(e){var n=t.isAbsolute(e),i="/"===s(e,-1);return e=r(o(e.split("/"),function(e){return!!e}),!n).join("/"),e||n||(e="."),e&&i&&(e+="/"),(n?"/":"")+e},t.isAbsolute=function(e){return"/"===e.charAt(0)},t.join=function(){var e=Array.prototype.slice.call(arguments,0);return t.normalize(o(e,function(e,t){if("string"!=typeof e)throw new TypeError("Arguments to path.join must be strings");return e}).join("/"))},t.relative=function(e,r){function n(e){for(var t=0;t<e.length&&""===e[t];t++);for(var r=e.length-1;r>=0&&""===e[r];r--);return t>r?[]:e.slice(t,r-t+1)}e=t.resolve(e).substr(1),r=t.resolve(r).substr(1);for(var i=n(e.split("/")),o=n(r.split("/")),s=Math.min(i.length,o.length),a=s,u=0;u<s;u++)if(i[u]!==o[u]){a=u;break}for(var c=[],u=a;u<i.length;u++)c.push("..");return c=c.concat(o.slice(a)),c.join("/")},t.sep="/",t.delimiter=":",t.dirname=function(e){var t=i(e),r=t[0],n=t[1];return r||n?(n&&(n=n.substr(0,n.length-1)),r+n):"."},t.basename=function(e,t){var r=i(e)[2];return t&&r.substr(-1*t.length)===t&&(r=r.substr(0,r.length-t.length)),r},t.extname=function(e){return i(e)[3]};var s="b"==="ab".substr(-1)?function(e,t,r){return e.substr(t,r)}:function(e,t,r){return t<0&&(t=e.length+t),e.substr(t,r)}}).call(t,r(7))},function(e,t,r){(function(e,n){var i;/*! https://mths.be/punycode v1.4.1 by @mathias */!function(o){var s="object"==typeof t&&t&&!t.nodeType&&t,a="object"==typeof e&&e&&!e.nodeType&&e,u="object"==typeof n&&n;u.global!==u&&u.window!==u&&u.self!==u||(o=u);var c,f=2147483647,l=36,h=1,p=26,d=38,y=700,g=72,m=128,b="-",v=/^xn--/,_=/[^\x20-\x7E]/,w=/[\x2E\u3002\uFF0E\uFF61]/g,S={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},k=l-h,E=Math.floor,A=String.fromCharCode,x;function I(e){throw new RangeError(S[e])}function T(e,t){for(var r=e.length,n=[];r--;)n[r]=t(e[r]);return n}function B(e,t){var r=e.split("@"),n="";r.length>1&&(n=r[0]+"@",e=r[1]),e=e.replace(w,".");var i=e.split("."),o=T(i,t).join(".");return n+o}function C(e){for(var t=[],r=0,n=e.length,i,o;r<n;)i=e.charCodeAt(r++),i>=55296&&i<=56319&&r<n?(o=e.charCodeAt(r++),56320==(64512&o)?t.push(((1023&i)<<10)+(1023&o)+65536):(t.push(i),r--)):t.push(i);return t}function P(e){return T(e,function(e){var t="";return e>65535&&(e-=65536,t+=A(e>>>10&1023|55296),e=56320|1023&e),t+=A(e),t}).join("")}function O(e){return e-48<10?e-22:e-65<26?e-65:e-97<26?e-97:l}function R(e,t){return e+22+75*(e<26)-((0!=t)<<5)}function N(e,t,r){var n=0;for(e=r?E(e/y):e>>1,e+=E(e/t);e>k*p>>1;n+=l)e=E(e/k);return E(n+(k+1)*e/(e+d))}function L(e){var t=[],r=e.length,n,i=0,o=m,s=g,a,u,c,d,y,v,_,w,S;for(a=e.lastIndexOf(b),a<0&&(a=0),u=0;u<a;++u)e.charCodeAt(u)>=128&&I("not-basic"),t.push(e.charCodeAt(u));for(c=a>0?a+1:0;c<r;){for(d=i,y=1,v=l;c>=r&&I("invalid-input"),_=O(e.charCodeAt(c++)),(_>=l||_>E((f-i)/y))&&I("overflow"),i+=_*y,w=v<=s?h:v>=s+p?p:v-s,!(_<w);v+=l)S=l-w,y>E(f/S)&&I("overflow"),y*=S;n=t.length+1,s=N(i-d,n,0==d),E(i/n)>f-o&&I("overflow"),o+=E(i/n),i%=n,t.splice(i++,0,o)}return P(t)}function j(e){var t,r,n,i,o,s,a,u,c,d,y,v=[],_,w,S,k;for(e=C(e),_=e.length,t=m,r=0,o=g,s=0;s<_;++s)y=e[s],y<128&&v.push(A(y));for(n=i=v.length,i&&v.push(b);n<_;){for(a=f,s=0;s<_;++s)y=e[s],y>=t&&y<a&&(a=y);for(w=n+1,a-t>E((f-r)/w)&&I("overflow"),r+=(a-t)*w,t=a,s=0;s<_;++s)if(y=e[s],y<t&&++r>f&&I("overflow"),y==t){for(u=r,c=l;d=c<=o?h:c>=o+p?p:c-o,!(u<d);c+=l)k=u-d,S=l-d,v.push(A(R(d+k%S,0))),u=E(k/S);v.push(A(R(u,0))),o=N(r,w,n==i),r=0,++n}++r,++t}return v.join("")}function M(e){return B(e,function(e){return v.test(e)?L(e.slice(4).toLowerCase()):e})}function K(e){return B(e,function(e){return _.test(e)?"xn--"+j(e):e})}c={version:"1.4.1",ucs2:{decode:C,encode:P},decode:L,encode:j,toASCII:K,toUnicode:M},i=function(){return c}.call(t,r,t,e),void 0===i||(e.exports=i)}(this)}).call(t,r(41)(e),r(5))},function(e,t){"function"==typeof Object.create?e.exports=function e(t,r){t.super_=r,t.prototype=Object.create(r.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}})}:e.exports=function e(t,r){t.super_=r;var n=function(){};n.prototype=r.prototype,t.prototype=new n,t.prototype.constructor=t}},function(e,t){e.exports=function e(t){return t&&"object"==typeof t&&"function"==typeof t.copy&&"function"==typeof t.fill&&"function"==typeof t.readUInt8}},function(e,t){e.exports=function(e){return e.webpackPolyfill||(e.deprecate=function(){},e.paths=[],e.children||(e.children=[]),Object.defineProperty(e,"loaded",{enumerable:!0,get:function(){return e.l}}),Object.defineProperty(e,"id",{enumerable:!0,get:function(){return e.i}}),e.webpackPolyfill=1),e}}])})},function(e,t,r){"use strict";const n=r(1),i=r(3),o=n("repo:lock"),s="repo.lock",a={};t.lock=((e,t)=>{const r=e+"/"+s;o("locking %s",r),a[r]=!0;const n={close(e){a[r]&&delete a[r],i(e)}};i(()=>{t(null,n)})}),t.locked=((e,t)=>{const r=e+"/"+s;o("checking lock: %s");const n=a[r];i(()=>{t(null,n)})})},function(e,t,r){"use strict";e.exports=r(1005)},function(e,t,r){"use strict";(function(e){const n=r(278),i=r(279)(),o=r(1012),s={SHA1:"SHA-1",SHA256:"SHA-256",SHA512:"SHA-512"},a=(t,r,o)=>{n(i.subtle.sign({name:"HMAC"},t,r).then(t=>e.from(t)),o)};t.create=function(e,t,r){const u=s[e];n(i.subtle.importKey("raw",t,{name:"HMAC",hash:{name:u}},!1,["sign"]).then(t=>({digest(e,r){a(t,e,r)},length:o[e]})),r)}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(t){const n=r(14),i=r(1017);function o(e,t,r,i){if("function"==typeof r&&(i=r,r=void 0),!i)throw new Error("Missing callback");o.digest(e,t,r,(e,o)=>{if(e)return i(e);i(null,n.encode(o,t,r))})}e.exports=o,o.Buffer=t,o.multihash=n,o.digest=function(e,t,r,n){if("function"==typeof r&&(n=r,r=void 0),!n)throw new Error("Missing callback");let i=n,s;r&&(i=((e,t)=>{if(e)return n(e);n(null,t.slice(0,r))}));try{s=o.createHash(t)}catch(e){return i(e)}s(e,i)},o.createHash=function(e){if(e=n.coerceCode(e),!o.functions[e])throw new Error("multihash function "+e+" not yet supported");return o.functions[e]},o.functions={17:i.sha1,18:i.sha2256,19:i.sha2512,20:i.sha3512,21:i.sha3384,22:i.sha3256,23:i.sha3224,24:i.shake128,25:i.shake256,26:i.keccak224,27:i.keccak256,28:i.keccak384,29:i.keccak512,34:i.murmur3128,35:i.murmur332,86:i.dblSha2256},i.addBlake(o.functions)}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(e){const n=r(3);t.toCallback=(e=>(function(t,r){const i=(e,t)=>n(()=>{r(e,t)});let o;try{o=e(t)}catch(e){return void i(e)}i(null,o)})),t.toBuf=((t,r)=>n=>{let i=t(n,r);return e.from(i,"hex")}),t.fromString=((t,r)=>n=>{const i=e.isBuffer(n)?n.toString():n;return t(i,r)}),t.fromNumberTo32BitBuf=((t,r)=>n=>{let i=t(n,r);const o=new Array(4);for(let e=0;e<4;e++)o[e]=255&i,i>>=8;return e.from(o)})}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(e){const n=r(278),i=r(279)();function o(e){return Promise.all([i.subtle.exportKey("jwk",e.privateKey),i.subtle.exportKey("jwk",e.publicKey)])}function s(e){return i.subtle.importKey("jwk",{kty:e.kty,n:e.n,e:e.e},{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}},!0,["verify"])}t.utils=r(1020),t.generateKey=function(e,t){n(i.subtle.generateKey({name:"RSASSA-PKCS1-v1_5",modulusLength:e,publicExponent:new Uint8Array([1,0,1]),hash:{name:"SHA-256"}},!0,["sign","verify"]).then(o).then(e=>({privateKey:e[0],publicKey:e[1]})),t)},t.unmarshalPrivateKey=function(e,t){const r=i.subtle.importKey("jwk",e,{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}},!0,["sign"]);n(Promise.all([r,s(e)]).then(e=>o({privateKey:e[0],publicKey:e[1]})).then(e=>({privateKey:e[0],publicKey:e[1]})),t)},t.getRandomValues=function(t){return e.from(i.getRandomValues(t))},t.hashAndSign=function(t,r,o){n(i.subtle.importKey("jwk",t,{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}},!1,["sign"]).then(e=>i.subtle.sign({name:"RSASSA-PKCS1-v1_5"},e,Uint8Array.from(r))).then(t=>e.from(t)),o)},t.hashAndVerify=function(e,t,r,o){n(i.subtle.importKey("jwk",e,{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}},!1,["verify"]).then(e=>i.subtle.verify({name:"RSASSA-PKCS1-v1_5"},e,t,r)),o)}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(e){const n=r(17).bignum;t.toBase64=function t(r,n){let i=r.toArrayLike(e,"be",n).toString("base64");return i.replace(/(=*)$/,"").replace(/\+/g,"-").replace(/\//g,"_")},t.toBn=function t(r){return new n(e.from(r,"base64"))}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";const n=r(495);function i(e){if(!e||"number"!=typeof e)throw new Error("first argument must be a Number bigger than 0");return n.getRandomValues(new Uint8Array(e))}e.exports=i},function(e,t,r){(function(t){var r="Expected a function",n=NaN,i="[object Symbol]",o=/^\s+|\s+$/g,s=/^[-+]0x[0-9a-f]+$/i,a=/^0b[01]+$/i,u=/^0o[0-7]+$/i,c=parseInt,f="object"==typeof t&&t&&t.Object===Object&&t,l="object"==typeof self&&self&&self.Object===Object&&self,h=f||l||Function("return this")(),p=Object.prototype,d=p.toString,y=Math.max,g=Math.min,m=function(){return h.Date.now()};function b(e,t,n){var i,o,s,a,u,c,f=0,l=!1,h=!1,p=!0;if("function"!=typeof e)throw new TypeError(r);function d(t){var r=i,n=o;return i=o=void 0,f=t,a=e.apply(n,r),a}function b(e){return f=e,u=setTimeout(k,t),l?d(e):a}function _(e){var r=e-c,n=e-f,i=t-r;return h?g(i,s-n):i}function w(e){var r=e-c,n=e-f;return void 0===c||r>=t||r<0||h&&n>=s}function k(){var e=m();if(w(e))return E(e);u=setTimeout(k,_(e))}function E(e){return u=void 0,p&&i?d(e):(i=o=void 0,a)}function A(){void 0!==u&&clearTimeout(u),f=0,i=c=o=u=void 0}function x(){return void 0===u?a:E(m())}function I(){var e=m(),r=w(e);if(i=arguments,o=this,c=e,r){if(void 0===u)return b(c);if(h)return u=setTimeout(k,t),d(c)}return void 0===u&&(u=setTimeout(k,t)),a}return t=S(t)||0,v(n)&&(l=!!n.leading,h="maxWait"in n,s=h?y(S(n.maxWait)||0,t):s,p="trailing"in n?!!n.trailing:p),I.cancel=A,I.flush=x,I}function v(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function _(e){return!!e&&"object"==typeof e}function w(e){return"symbol"==typeof e||_(e)&&d.call(e)==i}function S(e){if("number"==typeof e)return e;if(w(e))return n;if(v(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=v(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=e.replace(o,"");var r=a.test(e);return r||u.test(e)?c(e.slice(2),r?2:8):s.test(e)?n:+e}e.exports=b}).call(this,r(7))},function(e,t,r){"use strict";var n=r(1044);function i(e){return Number.isFinite(e)}function o(e){return"function"==typeof e}function s(e,t){return t?function(r,n){var i=setTimeout(function(){e(new Error("pull-reader: read exceeded timeout"),n)},t);e(r,function(e,t){clearTimeout(i),n(e,t)})}:e}e.exports=function(e){var t=[],r,a,u=!1,c=n(),f,l,h;function p(){for(;t.length;)if(null==t[0].length&&c.has(1))t.shift().cb(null,c.get());else if(c.has(t[0].length)){var e=t.shift();e.cb(null,c.get(e.length))}else if(1==f&&t[0].length&&c.length<t[0].length){var r="stream ended with:"+c.length+" but wanted:"+t[0].length;t.shift().cb(new Error(r))}else{if(!f)return!!t.length;t.shift().cb(f)}return t.length||!c.has(1)||h}function d(){var e=p();e&&!u&&(!r||u||l||(u=!0,a(null,function(e,t){if(u=!1,e)return f=e,p();c.add(t),d()})))}function y(n){if(h){for(;t.length;)t.shift().cb(h);return cb&&cb(h)}a=s(n,e),r=n,d()}return y.abort=function(e,n){h=e||!0,r?(u=!0,r(h,function(){for(;t.length;)t.shift().cb(h);n&&n(h)})):n()},y.read=function(n,a,f){if(o(a)&&(f=a,a=e),!o(f))return l=!0,function(e,n){if(u||c.has(1)){if(e)return r(e,n);t.push({length:null,cb:n}),d()}else s(r,a)(e,function(e,t){n(e,t)})};t.push({length:i(n)?n:null,cb:f}),d()},y}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=f;var n=r(216),i=c(n),o=r(352),s=c(o),a=r(32),u=c(a);function c(e){return e&&e.__esModule?e:{default:e}}function f(e,t,r,n){(0,i.default)(t)(e,(0,s.default)((0,u.default)(r)),n)}e.exports=t.default},function(e,t){var r=9007199254740991,n="[object Arguments]",i="[object Function]",o="[object GeneratorFunction]",s=/^(?:0|[1-9]\d*)$/;function a(e,t){for(var r=-1,n=e?e.length:0,i=Array(n);++r<n;)i[r]=t(e[r],r,e);return i}function u(e,t){for(var r=-1,n=Array(e);++r<e;)n[r]=t(r);return n}function c(e,t){return a(t,function(t){return e[t]})}function f(e,t){return function(r){return e(t(r))}}var l=Object.prototype,h=l.hasOwnProperty,p=l.toString,d=l.propertyIsEnumerable,y=f(Object.keys,Object);function g(e,t){var r=w(e)||_(e)?u(e.length,String):[],n=r.length,i=!!n;for(var o in e)!t&&!h.call(e,o)||i&&("length"==o||b(o,n))||r.push(o);return r}function m(e){if(!v(e))return y(e);var t=[];for(var r in Object(e))h.call(e,r)&&"constructor"!=r&&t.push(r);return t}function b(e,t){return t=null==t?r:t,!!t&&("number"==typeof e||s.test(e))&&e>-1&&e%1==0&&e<t}function v(e){var t=e&&e.constructor,r="function"==typeof t&&t.prototype||l;return e===r}function _(e){return k(e)&&h.call(e,"callee")&&(!d.call(e,"callee")||p.call(e)==n)}var w=Array.isArray;function S(e){return null!=e&&A(e.length)&&!E(e)}function k(e){return I(e)&&S(e)}function E(e){var t=x(e)?p.call(e):"";return t==i||t==o}function A(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=r}function x(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function I(e){return!!e&&"object"==typeof e}function T(e){return S(e)?g(e):m(e)}function B(e){return e?c(e,T(e)):[]}e.exports=B},function(e,t,r){"use strict";const n=Math.exp;t=e.exports=function e(t){if("number"!=typeof t)throw new Error("must provide a timespan to the moving average constructor");if(t<=0)throw new Error("must provide a timespan > 0 to the moving average constructor");let r,i=0,o=0,s=0,a,u={};function c(e,r){return 1-n(-(e-r)/t)}return u.push=function e(t,n){if(a){const e=c(t,a),u=n-r,f=e*u;r=e*n+(1-e)*r,i=(1-e)*(i+u*f),o=Math.sqrt(i),s=r+e*u}else r=n;a=t},u.movingAverage=function e(){return r},u.variance=function e(){return i},u.deviation=function e(){return o},u.forecast=function e(){return s},u}},function(e){e.exports={_from:"ipfs@0.31.7",_id:"ipfs@0.31.7",_inBundle:!1,_integrity:"sha512-HuA0Y6K7Y6f2Yu+ehUlGhv5VF2PtdZuME1AWYu/8zkfZ+HRpIYANjoK9GqZh6CQjOTJnIrEdqkHpOivUrZnIIg==",_location:"/ipfs",_phantomChildren:{},_requested:{type:"version",registry:!0,raw:"ipfs@0.31.7",name:"ipfs",escapedName:"ipfs",rawSpec:"0.31.7",saveSpec:null,fetchSpec:"0.31.7"},_requiredBy:["#USER","/"],_resolved:"https://registry.npmjs.org/ipfs/-/ipfs-0.31.7.tgz",_shasum:"4383c263421da9e6020257e44aae3759f3fdc7f0",_spec:"ipfs@0.31.7",_where:"/Users/mitra/git/dweb-transports",bin:{jsipfs:"src/cli/bin.js"},browser:{"./src/core/components/init-assets.js":!1,"./src/core/runtime/config-nodejs.js":"./src/core/runtime/config-browser.js","./src/core/runtime/libp2p-nodejs.js":"./src/core/runtime/libp2p-browser.js","./src/core/runtime/preload-nodejs.js":"./src/core/runtime/preload-browser.js","./src/core/runtime/repo-nodejs.js":"./src/core/runtime/repo-browser.js","./src/core/runtime/dns-nodejs.js":"./src/core/runtime/dns-browser.js","./test/utils/create-repo-nodejs.js":"./test/utils/create-repo-browser.js",stream:"readable-stream",joi:"joi-browser"},bugs:{url:"https://github.com/ipfs/js-ipfs/issues"},bundleDependencies:!1,contributors:[{name:"Alan Shaw",email:"alan@tableflip.io"},{name:"Alex Potsides",email:"alex@achingbrain.net"},{name:"Andrew de Andrade",email:"andrew@deandrade.com.br"},{name:"André Cruz",email:"andremiguelcruz@msn.com"},{name:"Arpit Agarwal",email:"93arpit@gmail.com"},{name:"Arpit Agarwal",email:"atvanguard@users.noreply.github.com"},{name:"Bernard Mordan",email:"bernard@tableflip.io"},{name:"Brian Vander Schaaf",email:"bvs330@gmail.com"},{name:"Bruno Zell",email:"bruno.zzell@gmail.com"},{name:"CHEVALAY JOSSELIN",email:"josselin54.chevalay@gmail.com"},{name:"Caio Gondim",email:"me@caiogondim.com"},{name:"Christian Couder",email:"chriscool@tuxfamily.org"},{name:"Dafeng",email:"dfguo.joe@gmail.com"},{name:"Daniel J. O'Quinn",email:"danieljoquinn@gmail.com"},{name:"Daniela Borges Matos de Carvalho",email:"alunassertiva@gmail.com"},{name:"David Dias",email:"daviddias.p@gmail.com"},{name:"David Gilbertson",email:"gilbertson.david@gmail.com"},{name:"David da Silva",email:"dasilvacontin@gmail.com"},{name:"Diogo Silva",email:"fsdiogo@gmail.com"},{name:"Dmitriy Ryajov",email:"dryajov@gmail.com"},{name:"Dzmitry Das",email:"dbachko@gmail.com"},{name:"Enrico Marino",email:"enrico.marino@email.com"},{name:"Faheel Ahmad",email:"faheel@live.in"},{name:"Felix Yan",email:"felixonmars@archlinux.org"},{name:"Francisco Baio Dias",email:"xicombd@gmail.com"},{name:"Francisco Baio Dias",email:"francisco@typeform.com"},{name:"Friedel Ziegelmayer",email:"dignifiedquire@gmail.com"},{name:"Gar",email:"gar+gh@danger.computer"},{name:"Georgios Rassias",email:"georassias@gmail.com"},{name:"Gorka Ludlow",email:"gorka@aquigorka.com"},{name:"Greenkeeper",email:"support@greenkeeper.io"},{name:"Haad",email:"haadcode@users.noreply.github.com"},{name:"Haoliang Yu",email:"haoliangyu@users.noreply.github.com"},{name:"Harsh Vakharia",email:"harshjv@users.noreply.github.com"},{name:"Henrique Dias",email:"hacdias@gmail.com"},{name:"Henry Rodrick",email:"moshisushi@gmail.com"},{name:"Heo Sangmin",email:"heo@mapiacompany.com"},{name:"Jacob Heun",email:"jacobheun@gmail.com"},{name:"Jacob Heun",email:"jake@andyet.net"},{name:"Jade Meskill",email:"jade.meskill@gmail.com"},{name:"Johannes Wikner",email:"johannes.wikner@gmail.com"},{name:"Jon Schlinkert",email:"dev@sellside.com"},{name:"Jonathan",email:"jkrone@vt.edu"},{name:"João Antunes",email:"j.goncalo.antunes@gmail.com"},{name:"João Santos",email:"joaosantos15@users.noreply.github.com"},{name:"Kevin Wang",email:"kevin@fossa.io"},{name:"Lars Gierth",email:"larsg@systemli.org"},{name:"Lukas Drgon",email:"lukas.drgon@gmail.com"},{name:"Maciej Krüger",email:"mkg20001@gmail.com"},{name:"Marius Darila",email:"marius.darila@gmail.com"},{name:"Michelle Lee",email:"michelle@protocol.ai"},{name:"Mikeal Rogers",email:"mikeal.rogers@gmail.com"},{name:"Mithgol",email:"getgit@mithgol.ru"},{name:"My9Bot",email:"34904312+My9Bot@users.noreply.github.com"},{name:"Nuno Nogueira",email:"nunofmn@gmail.com"},{name:"Oskar Nyberg",email:"oskar@oskarnyberg.com"},{name:"Pascal Precht",email:"pascal.precht@googlemail.com"},{name:"Pau Ramon Revilla",email:"masylum@gmail.com"},{name:"Paulo Rodrigues",email:"me@paulogr.com"},{name:"Pedro Teixeira",email:"i@pgte.me"},{name:"RasmusErik Voel Jensen",email:"github@solsort.com"},{name:"Richard Littauer",email:"richard.littauer@gmail.com"},{name:"Richard Schneider",email:"makaretu@gmail.com"},{name:"Rob Brackett",email:"rob@robbrackett.com"},{name:"Rod Keys",email:"rod@zokos.com"},{name:"Sangwon Hong",email:"qpakzk@gmail.com"},{name:"Sid Harder",email:"sideharder@gmail.com"},{name:"SidHarder",email:"softwarenavigator@gmail.com"},{name:"Stephen Whitmore",email:"stephen.whitmore@gmail.com"},{name:"Stephen Whitmore",email:"noffle@users.noreply.github.com"},{name:"Terence Pae",email:"terencepae@gmail.com"},{name:"Uroš Jurglič",email:"jurglic@gmail.com"},{name:"Vasco Santos",email:"vasco.santos@ua.pt"},{name:"Vasco Santos",email:"vasco.santos@moxy.studio"},{name:"Volker Mische",email:"volker.mische@gmail.com"},{name:"Xiao Liang",email:"yxliang01@users.noreply.github.com"},{name:"Yahya",email:"ya7yaz@gmail.com"},{name:"bitspill",email:"bitspill+github@bitspill.net"},{name:"haad",email:"haad@headbanggames.com"},{name:"jbenet",email:"juan@benet.ai"},{name:"jonahweissman",email:"19804455+jonahweissman@users.noreply.github.com"},{name:"kevingzhang",email:"kevin.zhang.canada@gmail.com"},{name:"kumavis",email:"kumavis@users.noreply.github.com"},{name:"nginnever",email:"ginneversource@gmail.com"},{name:"npmcdn-to-unpkg-bot",email:"npmcdn-to-unpkg-bot@users.noreply.github.com"},{name:"robbsolter",email:"35879806+robbsolter@users.noreply.github.com"},{name:"seungwon-kang",email:"ksw3894@gmail.com"},{name:"tcme",email:"hi@this-connect.me"},{name:"Łukasz Magiera",email:"magik6k@users.noreply.github.com"},{name:"Максим Ильин",email:"negamaxi@gmail.com"},{name:"ᴠɪᴄᴛᴏʀ ʙᴊᴇʟᴋʜᴏʟᴍ",email:"victorbjelkholm@gmail.com"}],dependencies:{"@nodeutils/defaults-deep":"^1.1.0",async:"^2.6.1","big.js":"^5.1.2","binary-querystring":"~0.1.2",bl:"^2.0.1",boom:"^7.2.0",bs58:"^4.0.1",byteman:"^1.3.5",cids:"~0.5.3",debug:"^3.1.0","err-code":"^1.1.2","file-type":"^8.1.0",filesize:"^3.6.1",fnv1a:"^1.0.1","fsm-event":"^2.1.0","get-folder-size":"^2.0.0",glob:"^7.1.2",hapi:"^16.6.2","hapi-set-header":"^1.0.2",hoek:"^5.0.3","human-to-milliseconds":"^1.0.0","interface-datastore":"~0.4.2","ipfs-api":"^24.0.0","ipfs-bitswap":"~0.20.3","ipfs-block":"~0.7.1","ipfs-block-service":"~0.14.0","ipfs-http-response":"~0.1.2","ipfs-mfs":"~0.3.0","ipfs-multipart":"~0.1.0","ipfs-repo":"~0.23.1","ipfs-unixfs":"~0.1.15","ipfs-unixfs-engine":"~0.32.1",ipld:"~0.17.3","ipld-dag-cbor":"~0.12.1","ipld-dag-pb":"~0.14.6","is-ipfs":"~0.4.2","is-pull-stream":"~0.0.0","is-stream":"^1.1.0",joi:"^13.4.0","joi-browser":"^13.4.0","joi-multiaddr":"^2.0.0",libp2p:"~0.23.0","libp2p-bootstrap":"~0.9.3","libp2p-circuit":"~0.2.0","libp2p-floodsub":"~0.15.0","libp2p-kad-dht":"~0.10.1","libp2p-keychain":"~0.3.1","libp2p-mdns":"~0.12.0","libp2p-mplex":"~0.8.0","libp2p-secio":"~0.10.0","libp2p-tcp":"~0.12.0","libp2p-webrtc-star":"~0.15.3","libp2p-websocket-star":"~0.8.1","libp2p-websockets":"~0.12.0",lodash:"^4.17.10",mafmt:"^6.0.0","mime-types":"^2.1.19",mkdirp:"~0.5.1",multiaddr:"^5.0.0","multiaddr-to-uri":"^4.0.0",multibase:"~0.4.0",multihashes:"~0.4.13",once:"^1.4.0","path-exists":"^3.0.0","peer-book":"~0.8.0","peer-id":"~0.11.0","peer-info":"~0.14.1",progress:"^2.0.0","prom-client":"^11.1.1","prometheus-gc-stats":"~0.5.1","promisify-es6":"^1.0.3","pull-abortable":"^4.1.1","pull-defer":"~0.2.2","pull-file":"^1.1.0","pull-ndjson":"~0.1.1","pull-paramap":"^1.2.2","pull-pushable":"^2.2.0","pull-sort":"^1.0.1","pull-stream":"^3.6.8","pull-stream-to-stream":"^1.3.4","pull-zip":"^2.0.1","read-pkg-up":"^4.0.0","readable-stream":"2.3.6","stream-to-pull-stream":"^1.7.2","tar-stream":"^1.6.1",temp:"~0.8.3",through2:"^2.0.3","update-notifier":"^2.5.0",yargs:"^12.0.1","yargs-parser":"^10.1.0","yargs-promise":"^1.1.0"},deprecated:!1,description:"JavaScript implementation of the IPFS specification",devDependencies:{aegir:"^15.1.0","buffer-loader":"~0.0.1",chai:"^4.1.2",delay:"^3.0.0","detect-node":"^2.0.3","dir-compare":"^1.4.0","dirty-chai":"^2.0.1","eslint-plugin-react":"^7.10.0",execa:"~0.10.0","expose-loader":"~0.7.5","form-data":"^2.3.2",hat:"0.0.3","interface-ipfs-core":"~0.76.1","ipfsd-ctl":"~0.39.1",mocha:"^5.2.0",ncp:"^2.0.0",nexpect:"~0.5.0","pretty-bytes":"^5.1.0",qs:"^6.5.2","random-fs":"^1.0.3",rimraf:"^2.6.2","stream-to-promise":"^2.2.0","transform-loader":"~0.2.4"},engines:{node:">=6.0.0",npm:">=3.0.0"},homepage:"https://github.com/ipfs/js-ipfs#readme",keywords:["IPFS"],leadMaintainer:"Alan Shaw <alan@tableflip.io>",license:"MIT",main:"src/core/index.js",name:"ipfs",optionalDependencies:{"prom-client":"^11.1.1","prometheus-gc-stats":"~0.5.1"},repository:{type:"git",url:"git+https://github.com/ipfs/js-ipfs.git"},scripts:{benchmark:'echo "Error: no benchmarks yet" && exit 1',"benchmark:browser":'echo "Error: no benchmarks yet" && exit 1',"benchmark:node":'echo "Error: no benchmarks yet" && exit 1',"benchmark:node:core":'echo "Error: no benchmarks yet" && exit 1',"benchmark:node:http":'echo "Error: no benchmarks yet" && exit 1',build:"aegir build",coverage:"aegir coverage","coverage-publish":"aegir-coverage publish",lint:"aegir lint",release:"aegir release -t node -t browser","release-major":"aegir release --type major -t node -t browser","release-minor":"aegir release --type minor -t node -t browser",test:"aegir test -t node -t browser -t webworker --no-cors","test:bootstrapers":"IPFS_TEST=bootstrapers aegir test -t browser -f test/bootstrapers.js","test:browser":"aegir test -t browser --no-cors","test:node":"aegir test -t node","test:node:cli":"aegir test -t node -f test/cli/index.js","test:node:core":"aegir test -t node -f test/core/**/*.js","test:node:gateway":"aegir test -t node -f test/gateway/index.js","test:node:http":"aegir test -t node -f test/http-api/index.js","test:webworker":"aegir test -t webworker --no-cors"},version:"0.31.7"}},function(e,t,r){"use strict";const n=r(22),i=r(277).repoVersion;e.exports=function e(t){return{init:(e,t,r)=>{},version:n(e=>{t._repo._isInitialized(r=>{if(r){const t=[/Key not found in database \[\/version\]/,/ENOENT/,/repo is not initialized yet/].some(e=>e.test(r.message));return t?e(null,i):e(r)}t._repo.version.get(e)})}),gc:n((e,t)=>{"function"==typeof e&&(t=e,e={}),t(new Error("Not implemented"))}),stat:n((e,r)=>{"function"==typeof e&&(r=e,e={}),t._repo.stat(e,(e,t)=>{if(e)return r(e);r(null,{numObjects:t.numObjects,repoSize:t.repoSize,repoPath:t.repoPath,version:t.version.toString(),storageMax:t.storageMax})})}),path:()=>t._repo.path}}},function(e,t,r){"use strict";e.exports=(()=>({Addresses:{Swarm:[],API:"",Gateway:""},Discovery:{MDNS:{Enabled:!1,Interval:10},webRTCStar:{Enabled:!0}},Bootstrap:["/dns4/ams-1.bootstrap.libp2p.io/tcp/443/wss/ipfs/QmSoLer265NRgSp2LA3dPaeykiS1J6DifTC88f5uVQKNAd","/dns4/lon-1.bootstrap.libp2p.io/tcp/443/wss/ipfs/QmSoLMeWqB7YGVLJN3pNLQpmmEk35v6wYtsMGLzSr5QBU3","/dns4/sfo-3.bootstrap.libp2p.io/tcp/443/wss/ipfs/QmSoLPppuBtQSGwKDZT2M73ULpjvfd3aZ6ha4oFGL1KrGM","/dns4/sgp-1.bootstrap.libp2p.io/tcp/443/wss/ipfs/QmSoLSafTMBsPKadTEgaXctDQVcqN88CNLHXMkTNwMKPnu","/dns4/nyc-1.bootstrap.libp2p.io/tcp/443/wss/ipfs/QmSoLueR4xBeUbY9WZ9xGUUxunbKWcrNFTDAadQJmocnWm","/dns4/nyc-2.bootstrap.libp2p.io/tcp/443/wss/ipfs/QmSoLV4Bbm51jM9C4gDYZQ9Cy3U6aXMJDAbzgu2fzaDs64","/dns4/node0.preload.ipfs.io/tcp/443/wss/ipfs/QmZMxNdpMkewiVZLMRxaNxUeZpDUb34pWjZ1kZvsd16Zic","/dns4/node1.preload.ipfs.io/tcp/443/wss/ipfs/Qmbut9Ywz9YEDrz8ySBSgWyJk41Uvm2QJPhwDJzJyGFsD6"]}))},function(e,t,r){"use strict";const n=r(1071),i=r(80),o=r(73),s=r(1080),a=r(44).Connection,u=r(1082),c=r(1),f=c("libp2p:websockets:dialer"),l=r(1083);class h{dial(e,t,r){"function"==typeof t&&(r=t,t={}),r=r||function(){};const i=u(e);f("dialing %s",i);const o=n(i,{binary:!0,onConnect:e=>{r(e)}}),s=new a(o);return s.getObservedAddrs=(t=>t(null,[e])),s.close=(e=>o.close(e)),s}createListener(e,t){return"function"==typeof e&&(t=e,e={}),l(e,t)}filter(e){return Array.isArray(e)||(e=[e]),e.filter(e=>!s(e.protoNames(),"p2p-circuit")&&(s(e.protoNames(),"ipfs")&&(e=e.decapsulate("ipfs")),i.WebSockets.matches(e)||i.WebSocketsSecure.matches(e)))}}e.exports=o(h,{className:"WebSockets",symbolName:"@libp2p/js-libp2p-websockets/websockets"})},function(e,t,r){var n=r(1085),i=r(282),o=r(511),s=r(1)("socket.io-client");e.exports=t=u;var a=t.managers={};function u(e,t){"object"==typeof e&&(t=e,e=void 0),t=t||{};var r=n(e),i=r.source,u=r.id,c=r.path,f=a[u]&&c in a[u].nsps,l=t.forceNew||t["force new connection"]||!1===t.multiplex||f,h;return l?(s("ignoring socket cache for %s",i),h=o(i,t)):(a[u]||(s("new io instance for %s",i),a[u]=o(i,t)),h=a[u]),r.query&&!t.query&&(t.query=r.query),h.socket(r.path,t)}t.protocol=i.protocol,t.connect=u,t.Manager=r(511),t.Socket=r(516)},function(e,t){var r=/^(?:(?![^:@]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@]*)(?::([^:@]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,n=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];e.exports=function e(t){var i=t,o=t.indexOf("["),s=t.indexOf("]");-1!=o&&-1!=s&&(t=t.substring(0,o)+t.substring(o,s).replace(/:/g,";")+t.substring(s,t.length));for(var a=r.exec(t||""),u={},c=14;c--;)u[n[c]]=a[c]||"";return-1!=o&&-1!=s&&(u.source=i,u.host=u.host.substring(1,u.host.length-1).replace(/;/g,":"),u.authority=u.authority.replace("[","").replace("]","").replace(/;/g,":"),u.ipv6uri=!0),u}},function(e,t){var r={}.toString;e.exports=Array.isArray||function(e){return"[object Array]"==r.call(e)}},function(e,t,r){(function(t){e.exports=o;var r="function"==typeof t.Buffer&&"function"==typeof t.Buffer.isBuffer,n="function"==typeof t.ArrayBuffer,i=n&&"function"==typeof t.ArrayBuffer.isView?t.ArrayBuffer.isView:function(e){return e.buffer instanceof t.ArrayBuffer};function o(e){return r&&t.Buffer.isBuffer(e)||n&&(e instanceof t.ArrayBuffer||i(e))}}).call(this,r(7))},function(e,t,r){var n=r(1087),i=r(516),o=r(116),s=r(282),a=r(517),u=r(518),c=r(1)("socket.io-client:manager"),f=r(261),l=r(1102),h=Object.prototype.hasOwnProperty;function p(e,t){if(!(this instanceof p))return new p(e,t);e&&"object"==typeof e&&(t=e,e=void 0),t=t||{},t.path=t.path||"/socket.io",this.nsps={},this.subs=[],this.opts=t,this.reconnection(!1!==t.reconnection),this.reconnectionAttempts(t.reconnectionAttempts||1/0),this.reconnectionDelay(t.reconnectionDelay||1e3),this.reconnectionDelayMax(t.reconnectionDelayMax||5e3),this.randomizationFactor(t.randomizationFactor||.5),this.backoff=new l({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(null==t.timeout?2e4:t.timeout),this.readyState="closed",this.uri=e,this.connecting=[],this.lastPing=null,this.encoding=!1,this.packetBuffer=[];var r=t.parser||s;this.encoder=new r.Encoder,this.decoder=new r.Decoder,this.autoConnect=!1!==t.autoConnect,this.autoConnect&&this.open()}e.exports=p,p.prototype.emitAll=function(){for(var e in this.emit.apply(this,arguments),this.nsps)h.call(this.nsps,e)&&this.nsps[e].emit.apply(this.nsps[e],arguments)},p.prototype.updateSocketIds=function(){for(var e in this.nsps)h.call(this.nsps,e)&&(this.nsps[e].id=this.generateId(e))},p.prototype.generateId=function(e){return("/"===e?"":e+"#")+this.engine.id},o(p.prototype),p.prototype.reconnection=function(e){return arguments.length?(this._reconnection=!!e,this):this._reconnection},p.prototype.reconnectionAttempts=function(e){return arguments.length?(this._reconnectionAttempts=e,this):this._reconnectionAttempts},p.prototype.reconnectionDelay=function(e){return arguments.length?(this._reconnectionDelay=e,this.backoff&&this.backoff.setMin(e),this):this._reconnectionDelay},p.prototype.randomizationFactor=function(e){return arguments.length?(this._randomizationFactor=e,this.backoff&&this.backoff.setJitter(e),this):this._randomizationFactor},p.prototype.reconnectionDelayMax=function(e){return arguments.length?(this._reconnectionDelayMax=e,this.backoff&&this.backoff.setMax(e),this):this._reconnectionDelayMax},p.prototype.timeout=function(e){return arguments.length?(this._timeout=e,this):this._timeout},p.prototype.maybeReconnectOnOpen=function(){!this.reconnecting&&this._reconnection&&0===this.backoff.attempts&&this.reconnect()},p.prototype.open=p.prototype.connect=function(e,t){if(c("readyState %s",this.readyState),~this.readyState.indexOf("open"))return this;c("opening %s",this.uri),this.engine=n(this.uri,this.opts);var r=this.engine,i=this;this.readyState="opening",this.skipReconnect=!1;var o=a(r,"open",function(){i.onopen(),e&&e()}),s=a(r,"error",function(t){if(c("connect_error"),i.cleanup(),i.readyState="closed",i.emitAll("connect_error",t),e){var r=new Error("Connection error");r.data=t,e(r)}else i.maybeReconnectOnOpen()});if(!1!==this._timeout){var u=this._timeout;c("connect attempt will timeout after %d",u);var f=setTimeout(function(){c("connect attempt timed out after %d",u),o.destroy(),r.close(),r.emit("error","timeout"),i.emitAll("connect_timeout",u)},u);this.subs.push({destroy:function(){clearTimeout(f)}})}return this.subs.push(o),this.subs.push(s),this},p.prototype.onopen=function(){c("open"),this.cleanup(),this.readyState="open",this.emit("open");var e=this.engine;this.subs.push(a(e,"data",u(this,"ondata"))),this.subs.push(a(e,"ping",u(this,"onping"))),this.subs.push(a(e,"pong",u(this,"onpong"))),this.subs.push(a(e,"error",u(this,"onerror"))),this.subs.push(a(e,"close",u(this,"onclose"))),this.subs.push(a(this.decoder,"decoded",u(this,"ondecoded")))},p.prototype.onping=function(){this.lastPing=new Date,this.emitAll("ping")},p.prototype.onpong=function(){this.emitAll("pong",new Date-this.lastPing)},p.prototype.ondata=function(e){this.decoder.add(e)},p.prototype.ondecoded=function(e){this.emit("packet",e)},p.prototype.onerror=function(e){c("error",e),this.emitAll("error",e)},p.prototype.socket=function(e,t){var r=this.nsps[e];if(!r){r=new i(this,e,t),this.nsps[e]=r;var n=this;r.on("connecting",o),r.on("connect",function(){r.id=n.generateId(e)}),this.autoConnect&&o()}function o(){~f(n.connecting,r)||n.connecting.push(r)}return r},p.prototype.destroy=function(e){var t=f(this.connecting,e);~t&&this.connecting.splice(t,1),this.connecting.length||this.close()},p.prototype.packet=function(e){c("writing packet %j",e);var t=this;e.query&&0===e.type&&(e.nsp+="?"+e.query),t.encoding?t.packetBuffer.push(e):(t.encoding=!0,this.encoder.encode(e,function(r){for(var n=0;n<r.length;n++)t.engine.write(r[n],e.options);t.encoding=!1,t.processPacketQueue()}))},p.prototype.processPacketQueue=function(){if(this.packetBuffer.length>0&&!this.encoding){var e=this.packetBuffer.shift();this.packet(e)}},p.prototype.cleanup=function(){c("cleanup");for(var e=this.subs.length,t=0;t<e;t++){var r=this.subs.shift();r.destroy()}this.packetBuffer=[],this.encoding=!1,this.lastPing=null,this.decoder.destroy()},p.prototype.close=p.prototype.disconnect=function(){c("disconnect"),this.skipReconnect=!0,this.reconnecting=!1,"opening"===this.readyState&&this.cleanup(),this.backoff.reset(),this.readyState="closed",this.engine&&this.engine.close()},p.prototype.onclose=function(e){c("onclose"),this.cleanup(),this.backoff.reset(),this.readyState="closed",this.emit("close",e),this._reconnection&&!this.skipReconnect&&this.reconnect()},p.prototype.reconnect=function(){if(this.reconnecting||this.skipReconnect)return this;var e=this;if(this.backoff.attempts>=this._reconnectionAttempts)c("reconnect failed"),this.backoff.reset(),this.emitAll("reconnect_failed"),this.reconnecting=!1;else{var t=this.backoff.duration();c("will wait %dms before reconnect attempt",t),this.reconnecting=!0;var r=setTimeout(function(){e.skipReconnect||(c("attempting reconnect"),e.emitAll("reconnect_attempt",e.backoff.attempts),e.emitAll("reconnecting",e.backoff.attempts),e.skipReconnect||e.open(function(t){t?(c("reconnect attempt error"),e.reconnecting=!1,e.reconnect(),e.emitAll("reconnect_error",t.data)):(c("reconnect success"),e.onreconnect())}))},t);this.subs.push({destroy:function(){clearTimeout(r)}})}},p.prototype.onreconnect=function(){var e=this.backoff.attempts;this.reconnecting=!1,this.backoff.reset(),this.updateSocketIds(),this.emitAll("reconnect",e)}},function(e,t,r){(function(e){var n=r(283),i=r(1090),o=r(1098),s=r(1099);function a(t){var r,s=!1,a=!1,u=!1!==t.jsonp;if(e.location){var c="https:"===location.protocol,f=location.port;f||(f=c?443:80),s=t.hostname!==location.hostname||f!==t.port,a=t.secure!==c}if(t.xdomain=s,t.xscheme=a,r=new n(t),"open"in r&&!t.forceJSONP)return new i(t);if(!u)throw new Error("JSONP disabled");return new o(t)}t.polling=a,t.websocket=s}).call(this,r(7))},function(e,t,r){var n=r(284),i=r(189),o=r(117),s=r(190),a=r(515),u=r(1)("engine.io-client:polling");e.exports=h;var c=(f=r(283),l=new f({xdomain:!1}),null!=l.responseType),f,l;function h(e){var t=e&&e.forceBase64;c&&!t||(this.supportsBinary=!1),n.call(this,e)}s(h,n),h.prototype.name="polling",h.prototype.doOpen=function(){this.poll()},h.prototype.pause=function(e){var t=this;function r(){u("paused"),t.readyState="paused",e()}if(this.readyState="pausing",this.polling||!this.writable){var n=0;this.polling&&(u("we are currently polling - waiting to pause"),n++,this.once("pollComplete",function(){u("pre-pause polling complete"),--n||r()})),this.writable||(u("we are currently writing - waiting to pause"),n++,this.once("drain",function(){u("pre-pause writing complete"),--n||r()}))}else r()},h.prototype.poll=function(){u("polling"),this.polling=!0,this.doPoll(),this.emit("poll")},h.prototype.onData=function(e){var t=this;u("polling got data %s",e);var r=function(e,r,n){if("opening"===t.readyState&&t.onOpen(),"close"===e.type)return t.onClose(),!1;t.onPacket(e)};o.decodePayload(e,this.socket.binaryType,r),"closed"!==this.readyState&&(this.polling=!1,this.emit("pollComplete"),"open"===this.readyState?this.poll():u('ignoring poll - transport state "%s"',this.readyState))},h.prototype.doClose=function(){var e=this;function t(){u("writing close packet"),e.write([{type:"close"}])}"open"===this.readyState?(u("transport open - closing"),t()):(u("transport not open - deferring close"),this.once("open",t))},h.prototype.write=function(e){var t=this;this.writable=!1;var r=function(){t.writable=!0,t.emit("drain")};o.encodePayload(e,this.supportsBinary,function(e){t.doWrite(e,r)})},h.prototype.uri=function(){var e=this.query||{},t=this.secure?"https":"http",r="";!1!==this.timestampRequests&&(e[this.timestampParam]=a()),this.supportsBinary||e.sid||(e.b64=1),e=i.encode(e),this.port&&("https"===t&&443!==Number(this.port)||"http"===t&&80!==Number(this.port))&&(r=":"+this.port),e.length&&(e="?"+e);var n=-1!==this.hostname.indexOf(":");return t+"://"+(n?"["+this.hostname+"]":this.hostname)+r+this.path+e}},function(e,t,r){(function(t){var n=r(1092),i=Object.prototype.toString,o="function"==typeof Blob||"undefined"!=typeof Blob&&"[object BlobConstructor]"===i.call(Blob),s="function"==typeof File||"undefined"!=typeof File&&"[object FileConstructor]"===i.call(File);function a(e){if(!e||"object"!=typeof e)return!1;if(n(e)){for(var r=0,i=e.length;r<i;r++)if(a(e[r]))return!0;return!1}if("function"==typeof t&&t.isBuffer&&t.isBuffer(e)||"function"==typeof ArrayBuffer&&e instanceof ArrayBuffer||o&&e instanceof Blob||s&&e instanceof File)return!0;if(e.toJSON&&"function"==typeof e.toJSON&&1===arguments.length)return a(e.toJSON(),!0);for(var u in e)if(Object.prototype.hasOwnProperty.call(e,u)&&a(e[u]))return!0;return!1}e.exports=a}).call(this,r(0).Buffer)},function(e,t,r){"use strict";var n="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_".split(""),i=64,o={},s=0,a=0,u;function c(e){var t="";do{t=n[e%i]+t,e=Math.floor(e/i)}while(e>0);return t}function f(e){var t=0;for(a=0;a<e.length;a++)t=t*i+o[e.charAt(a)];return t}function l(){var e=c(+new Date);return e!==u?(s=0,u=e):e+"."+c(s++)}for(;a<i;a++)o[n[a]]=a;l.encode=c,l.decode=f,e.exports=l},function(e,t,r){var n=r(282),i=r(116),o=r(1101),s=r(517),a=r(518),u=r(1)("socket.io-client:socket"),c=r(189),f=r(514);e.exports=t=p;var l={connect:1,connect_error:1,connect_timeout:1,connecting:1,disconnect:1,error:1,reconnect:1,reconnect_attempt:1,reconnect_failed:1,reconnect_error:1,reconnecting:1,ping:1,pong:1},h=i.prototype.emit;function p(e,t,r){this.io=e,this.nsp=t,this.json=this,this.ids=0,this.acks={},this.receiveBuffer=[],this.sendBuffer=[],this.connected=!1,this.disconnected=!0,this.flags={},r&&r.query&&(this.query=r.query),this.io.autoConnect&&this.open()}i(p.prototype),p.prototype.subEvents=function(){if(!this.subs){var e=this.io;this.subs=[s(e,"open",a(this,"onopen")),s(e,"packet",a(this,"onpacket")),s(e,"close",a(this,"onclose"))]}},p.prototype.open=p.prototype.connect=function(){return this.connected?this:(this.subEvents(),this.io.open(),"open"===this.io.readyState&&this.onopen(),this.emit("connecting"),this)},p.prototype.send=function(){var e=o(arguments);return e.unshift("message"),this.emit.apply(this,e),this},p.prototype.emit=function(e){if(l.hasOwnProperty(e))return h.apply(this,arguments),this;var t=o(arguments),r={type:(void 0!==this.flags.binary?this.flags.binary:f(t))?n.BINARY_EVENT:n.EVENT,data:t,options:{}};return r.options.compress=!this.flags||!1!==this.flags.compress,"function"==typeof t[t.length-1]&&(u("emitting packet with ack id %d",this.ids),this.acks[this.ids]=t.pop(),r.id=this.ids++),this.connected?this.packet(r):this.sendBuffer.push(r),this.flags={},this},p.prototype.packet=function(e){e.nsp=this.nsp,this.io.packet(e)},p.prototype.onopen=function(){if(u("transport is open - connecting"),"/"!==this.nsp)if(this.query){var e="object"==typeof this.query?c.encode(this.query):this.query;u("sending connect packet with query %s",e),this.packet({type:n.CONNECT,query:e})}else this.packet({type:n.CONNECT})},p.prototype.onclose=function(e){u("close (%s)",e),this.connected=!1,this.disconnected=!0,delete this.id,this.emit("disconnect",e)},p.prototype.onpacket=function(e){var t=e.nsp===this.nsp,r=e.type===n.ERROR&&"/"===e.nsp;if(t||r)switch(e.type){case n.CONNECT:this.onconnect();break;case n.EVENT:case n.BINARY_EVENT:this.onevent(e);break;case n.ACK:case n.BINARY_ACK:this.onack(e);break;case n.DISCONNECT:this.ondisconnect();break;case n.ERROR:this.emit("error",e.data)}},p.prototype.onevent=function(e){var t=e.data||[];u("emitting event %j",t),null!=e.id&&(u("attaching ack callback to event"),t.push(this.ack(e.id))),this.connected?h.apply(this,t):this.receiveBuffer.push(t)},p.prototype.ack=function(e){var t=this,r=!1;return function(){if(!r){r=!0;var i=o(arguments);u("sending ack %j",i),t.packet({type:f(i)?n.BINARY_ACK:n.ACK,id:e,data:i})}}},p.prototype.onack=function(e){var t=this.acks[e.id];"function"==typeof t?(u("calling ack %s with %j",e.id,e.data),t.apply(this,e.data),delete this.acks[e.id]):u("bad ack %s",e.id)},p.prototype.onconnect=function(){this.connected=!0,this.disconnected=!1,this.emit("connect"),this.emitBuffered()},p.prototype.emitBuffered=function(){var e;for(e=0;e<this.receiveBuffer.length;e++)h.apply(this,this.receiveBuffer[e]);for(this.receiveBuffer=[],e=0;e<this.sendBuffer.length;e++)this.packet(this.sendBuffer[e]);this.sendBuffer=[]},p.prototype.ondisconnect=function(){u("server disconnect (%s)",this.nsp),this.destroy(),this.onclose("io server disconnect")},p.prototype.destroy=function(){if(this.subs){for(var e=0;e<this.subs.length;e++)this.subs[e].destroy();this.subs=null}this.io.destroy(this)},p.prototype.close=p.prototype.disconnect=function(){return this.connected&&(u("performing disconnect (%s)",this.nsp),this.packet({type:n.DISCONNECT})),this.destroy(),this.connected&&this.onclose("io client disconnect"),this},p.prototype.compress=function(e){return this.flags.compress=e,this},p.prototype.binary=function(e){return this.flags.binary=e,this}},function(e,t){function r(e,t,r){return e.on(t,r),{destroy:function(){e.removeListener(t,r)}}}e.exports=r},function(e,t){var r=[].slice;e.exports=function(e,t){if("string"==typeof t&&(t=e[t]),"function"!=typeof t)throw new Error("bind() requires a function");var n=r.call(arguments,2);return function(){return t.apply(e,n.concat(r.call(arguments)))}}},function(e,t,r){"use strict";(function(e){const n=r(285),i=r(286)(),o=r(1106),s={SHA1:"SHA-1",SHA256:"SHA-256",SHA512:"SHA-512"},a=(t,r,o)=>{n(i.subtle.sign({name:"HMAC"},t,r).then(t=>e.from(t)),o)};t.create=function(e,t,r){const u=s[e];n(i.subtle.importKey("raw",t,{name:"HMAC",hash:{name:u}},!1,["sign"]).then(t=>({digest(e,r){a(t,e,r)},length:o[e]})),r)}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(t){const n=r(14),i=r(1111);function o(e,t,r,i){if("function"==typeof r&&(i=r,r=void 0),!i)throw new Error("Missing callback");o.digest(e,t,r,(e,o)=>{if(e)return i(e);i(null,n.encode(o,t,r))})}e.exports=o,o.Buffer=t,o.multihash=n,o.digest=function(e,t,r,n){if("function"==typeof r&&(n=r,r=void 0),!n)throw new Error("Missing callback");let i=n,s;r&&(i=((e,t)=>{if(e)return n(e);n(null,t.slice(0,r))}));try{s=o.createHash(t)}catch(e){return i(e)}s(e,i)},o.createHash=function(e){if(e=n.coerceCode(e),!o.functions[e])throw new Error("multihash function "+e+" not yet supported");return o.functions[e]},o.functions={17:i.sha1,18:i.sha2256,19:i.sha2512,20:i.sha3512,21:i.sha3384,22:i.sha3256,23:i.sha3224,24:i.shake128,25:i.shake256,26:i.keccak224,27:i.keccak256,28:i.keccak384,29:i.keccak512,34:i.murmur3128,35:i.murmur332,86:i.dblSha2256},i.addBlake(o.functions)}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(e){const n=r(3);t.toCallback=(e=>(function(t,r){const i=(e,t)=>n(()=>{r(e,t)});let o;try{o=e(t)}catch(e){return void i(e)}i(null,o)})),t.toBuf=((t,r)=>n=>{let i=t(n,r);return e.from(i,"hex")}),t.fromString=((t,r)=>n=>{const i=e.isBuffer(n)?n.toString():n;return t(i,r)}),t.fromNumberTo32BitBuf=((t,r)=>n=>{let i=t(n,r);const o=new Array(4);for(let e=0;e<4;e++)o[e]=255&i,i>>=8;return e.from(o)})}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(e){const n=r(285),i=r(286)();function o(e){return Promise.all([i.subtle.exportKey("jwk",e.privateKey),i.subtle.exportKey("jwk",e.publicKey)])}function s(e){return i.subtle.importKey("jwk",{kty:e.kty,n:e.n,e:e.e},{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}},!0,["verify"])}t.utils=r(1114),t.generateKey=function(e,t){n(i.subtle.generateKey({name:"RSASSA-PKCS1-v1_5",modulusLength:e,publicExponent:new Uint8Array([1,0,1]),hash:{name:"SHA-256"}},!0,["sign","verify"]).then(o).then(e=>({privateKey:e[0],publicKey:e[1]})),t)},t.unmarshalPrivateKey=function(e,t){const r=i.subtle.importKey("jwk",e,{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}},!0,["sign"]);n(Promise.all([r,s(e)]).then(e=>o({privateKey:e[0],publicKey:e[1]})).then(e=>({privateKey:e[0],publicKey:e[1]})),t)},t.getRandomValues=function(t){return e.from(i.getRandomValues(t))},t.hashAndSign=function(t,r,o){n(i.subtle.importKey("jwk",t,{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}},!1,["sign"]).then(e=>i.subtle.sign({name:"RSASSA-PKCS1-v1_5"},e,Uint8Array.from(r))).then(t=>e.from(t)),o)},t.hashAndVerify=function(e,t,r,o){n(i.subtle.importKey("jwk",e,{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}},!1,["verify"]).then(e=>i.subtle.verify({name:"RSASSA-PKCS1-v1_5"},e,t,r)),o)}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(e){const n=r(17).bignum;t.toBase64=function t(r,n){let i=r.toArrayLike(e,"be",n).toString("base64");return i.replace(/(=*)$/,"").replace(/\+/g,"-").replace(/\//g,"_")},t.toBn=function t(r){return new n(e.from(r,"base64"))}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";const n=r(522);function i(e){if(!e||"number"!=typeof e)throw new Error("first argument must be a Number bigger than 0");return n.getRandomValues(new Uint8Array(e))}e.exports=i},function(e,t){var r=e.exports=function(e){!function t(){var r=!0,n=!1,i=!1;do{i=!0,r=!1,e.call(this,function(){i?r=!0:t()}),i=!1}while(r)}()}},function(e,t,r){"use strict";(function(n){const i=r(14),o=r(1125),s=r(13),a=r(5);class u{constructor(e,t,r){s(n.isBuffer(e),"invalid id provided"),t&&r&&s(t.public.bytes.equals(r.bytes),"inconsistent arguments"),this._id=e,this._idB58String=i.toB58String(this.id),this._privKey=t,this._pubKey=r}get id(){return this._id}set id(e){throw new Error("Id is immutable")}get privKey(){return this._privKey}set privKey(e){this._privKey=e}get pubKey(){return this._pubKey?this._pubKey:this._privKey?this._privKey.public:void 0}set pubKey(e){this._pubKey=e}marshalPubKey(){if(this.pubKey)return o.keys.marshalPublicKey(this.pubKey)}marshalPrivKey(){if(this.privKey)return o.keys.marshalPrivateKey(this.privKey)}toPrint(){return this.toJSON()}toJSON(){return{id:this.toB58String(),privKey:c(this.marshalPrivKey()),pubKey:c(this.marshalPubKey())}}toHexString(){return i.toHexString(this.id)}toBytes(){return this.id}toB58String(){return this._idB58String}isEqual(e){if(n.isBuffer(e))return this.id.equals(e);if(e.id)return this.id.equals(e.id);throw new Error("not valid Id")}isValid(e){this.privKey&&this.privKey.public&&this.privKey.public.bytes&&n.isBuffer(this.pubKey.bytes)&&this.privKey.public.bytes.equals(this.pubKey.bytes)?e():e(new Error("Keys not match"))}}function c(e){if(e)return e.toString("base64")}t=e.exports=u,t.create=function(e,t){"function"==typeof e&&(t=e,e={}),e=e||{},e.bits=e.bits||2048,a([t=>o.keys.generateKeyPair("RSA",e.bits,t),(e,t)=>e.public.hash((r,n)=>{t(r,n,e)})],(e,r,n)=>{if(e)return t(e);t(null,new u(r,n))})},t.createFromHexString=function(e){return new u(i.fromHexString(e))},t.createFromBytes=function(e){return new u(e)},t.createFromB58String=function(e){return new u(i.fromB58String(e))},t.createFromPubKey=function(e,t){if("function"!=typeof t)throw new Error("callback is required");let r;try{let i=e;if("string"==typeof i&&(i=n.from(e,"base64")),!n.isBuffer(i))throw new Error("Supplied key is neither a base64 string nor a buffer");r=o.keys.unmarshalPublicKey(i)}catch(e){return t(e)}r.hash((e,n)=>{if(e)return t(e);t(null,new u(n,null,r))})},t.createFromPrivKey=function(e,t){if("function"!=typeof t)throw new Error("callback is required");let r=e;try{if("string"==typeof r&&(r=n.from(e,"base64")),!n.isBuffer(r))throw new Error("Supplied key is neither a base64 string nor a buffer")}catch(e){return t(e)}a([e=>o.keys.unmarshalPrivateKey(r,e),(e,t)=>e.public.hash((r,n)=>{t(r,n,e)})],(e,r,n)=>{if(e)return t(e);t(null,new u(r,n,n.public))})},t.createFromJSON=function(e,t){if("function"!=typeof t)throw new Error("callback is required");let r,s,c,f;try{r=i.fromB58String(e.id),s=e.privKey&&n.from(e.privKey,"base64"),c=e.pubKey&&n.from(e.pubKey,"base64"),f=c&&o.keys.unmarshalPublicKey(c)}catch(e){return t(e)}s?a([e=>o.keys.unmarshalPrivateKey(s,e),(e,t)=>e.public.hash((r,n)=>{t(r,n,e)}),(e,t,r)=>{f?f.hash((n,i)=>{r(n,e,t,i)}):r(null,e,t)}],(e,n,i,o)=>e?t(e):f&&!n.equals(o)?t(new Error("Public and private key do not match")):r&&!n.equals(r)?t(new Error("Id and private key do not match")):void t(null,new u(r,i,f))):t(null,new u(r,null,f))},t.isPeerId=function(e){return Boolean("object"==typeof e&&e._id&&e._idB58String)}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(e){const n=r(288),i=r(289)(),o=r(1126),s={SHA1:"SHA-1",SHA256:"SHA-256",SHA512:"SHA-512"},a=(t,r,o)=>{n(i.subtle.sign({name:"HMAC"},t,r).then(t=>e.from(t)),o)};t.create=function(e,t,r){const u=s[e];n(i.subtle.importKey("raw",t,{name:"HMAC",hash:{name:u}},!1,["sign"]).then(t=>({digest(e,r){a(t,e,r)},length:o[e]})),r)}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(t){const n=r(14),i=r(1131);function o(e,t,r,i){if("function"==typeof r&&(i=r,r=void 0),!i)throw new Error("Missing callback");o.digest(e,t,r,(e,o)=>{if(e)return i(e);i(null,n.encode(o,t,r))})}e.exports=o,o.Buffer=t,o.multihash=n,o.digest=function(e,t,r,n){if("function"==typeof r&&(n=r,r=void 0),!n)throw new Error("Missing callback");let i=n,s;r&&(i=((e,t)=>{if(e)return n(e);n(null,t.slice(0,r))}));try{s=o.createHash(t)}catch(e){return i(e)}s(e,i)},o.createHash=function(e){if(e=n.coerceCode(e),!o.functions[e])throw new Error("multihash function "+e+" not yet supported");return o.functions[e]},o.functions={17:i.sha1,18:i.sha2256,19:i.sha2512,20:i.sha3512,21:i.sha3384,22:i.sha3256,23:i.sha3224,24:i.shake128,25:i.shake256,26:i.keccak224,27:i.keccak256,28:i.keccak384,29:i.keccak512,34:i.murmur3128,35:i.murmur332,86:i.dblSha2256},i.addBlake(o.functions)}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(e){const n=r(3);t.toCallback=(e=>(function(t,r){const i=(e,t)=>n(()=>{r(e,t)});let o;try{o=e(t)}catch(e){return void i(e)}i(null,o)})),t.toBuf=((t,r)=>n=>{let i=t(n,r);return e.from(i,"hex")}),t.fromString=((t,r)=>n=>{const i=e.isBuffer(n)?n.toString():n;return t(i,r)}),t.fromNumberTo32BitBuf=((t,r)=>n=>{let i=t(n,r);const o=new Array(4);for(let e=0;e<4;e++)o[e]=255&i,i>>=8;return e.from(o)})}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(e){const n=r(288),i=r(289)();function o(e){return Promise.all([i.subtle.exportKey("jwk",e.privateKey),i.subtle.exportKey("jwk",e.publicKey)])}function s(e){return i.subtle.importKey("jwk",{kty:e.kty,n:e.n,e:e.e},{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}},!0,["verify"])}t.utils=r(1134),t.generateKey=function(e,t){n(i.subtle.generateKey({name:"RSASSA-PKCS1-v1_5",modulusLength:e,publicExponent:new Uint8Array([1,0,1]),hash:{name:"SHA-256"}},!0,["sign","verify"]).then(o).then(e=>({privateKey:e[0],publicKey:e[1]})),t)},t.unmarshalPrivateKey=function(e,t){const r=i.subtle.importKey("jwk",e,{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}},!0,["sign"]);n(Promise.all([r,s(e)]).then(e=>o({privateKey:e[0],publicKey:e[1]})).then(e=>({privateKey:e[0],publicKey:e[1]})),t)},t.getRandomValues=function(t){return e.from(i.getRandomValues(t))},t.hashAndSign=function(t,r,o){n(i.subtle.importKey("jwk",t,{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}},!1,["sign"]).then(e=>i.subtle.sign({name:"RSASSA-PKCS1-v1_5"},e,Uint8Array.from(r))).then(t=>e.from(t)),o)},t.hashAndVerify=function(e,t,r,o){n(i.subtle.importKey("jwk",e,{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}},!1,["verify"]).then(e=>i.subtle.verify({name:"RSASSA-PKCS1-v1_5"},e,t,r)),o)}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(e){const n=r(17).bignum;t.toBase64=function t(r,n){let i=r.toArrayLike(e,"be",n).toString("base64");return i.replace(/(=*)$/,"").replace(/\+/g,"-").replace(/\//g,"_")},t.toBn=function t(r){return new n(e.from(r,"base64"))}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";const n=r(530);function i(e){if(!e||"number"!=typeof e)throw new Error("first argument must be a Number bigger than 0");return n.getRandomValues(new Uint8Array(e))}e.exports=i},function(e,t,r){"use strict";(function(n){const i=r(31),o=r(526),s=r(113),a=r(80);function u(e){const t=e.protos(),r=t[0].name,n=t[1].name,i=t[2].name,o=e.stringTuples(),s=o[1][1];if("tcp"!==n||"ws"!==i&&"wss"!==i)throw new Error("invalid multiaddr: "+e.toString());let a=o[0][1];"ip6"===r&&(a="["+a+"]");let u="wss"===i?"https":"http",c="ws"===i&&80===s||"wss"===i&&443===s?"":s;return u+"://"+a+(c?":"+c:"")}const c={string:e=>"string"==typeof e,object:e=>"object"==typeof e,multiaddr:e=>{if(c.string(e))try{return i(e),!0}catch(e){return!1}},function:e=>"function"==typeof e};function f(e,t){if(!Array.isArray(t))throw new Error("Data is not an array");e.forEach((e,r)=>{if(!c[e])throw console.error("Type %s does not exist",e),new Error("Type "+e+" does not exist");if(!c[e](t[r]))throw new Error("Data at index "+r+" is invalid for type "+e)})}function l(e){e||(e=(()=>{}));const t=this;t.requests={},t.addRequest=((e,r,n)=>{t.requests[e]={def:r,handle:n}}),t.handleSocket=(r=>{r.r={},Object.keys(t.requests).forEach(n=>{const i=t.requests[n];r.on(n,function(){const t=[...arguments];try{f(i.def,t),t.unshift(r),i.handle.apply(null,t)}catch(i){e(i),e("peer %s has sent invalid data for request %s",r.id||"<server>",n,t)}})})})}function h(e,t,r){o.createFromPubKey(n.from(e,"hex"),(i,o)=>i?r(new Error("Crypto error")):o.toB58String()!==t?r(new Error("Id is not matching")):r(null,s.keys.unmarshalPublicKey(n.from(e,"hex"))))}t=e.exports,t.cleanUrlSIO=u,t.validate=f,t.Protocol=l,t.getIdAndValidate=h,t.validateMa=(e=>a.WebSocketStar.matches(i(e)))}).call(this,r(0).Buffer)},function(e,t,r){var n=r(1144),i=r(218),o=i;o.v1=n,o.v4=i,e.exports=o},function(e,t,r){"use strict";e.exports="/mplex/6.7.0"},function(e,t,r){"use strict";(function(e){const n=r(3);t.toCallback=(e=>(function(t,r){const i=(e,t)=>n(()=>{r(e,t)});let o;try{o=e(t)}catch(e){return void i(e)}i(null,o)})),t.toBuf=((t,r)=>n=>{let i=t(n,r);return e.from(i,"hex")}),t.fromString=((t,r)=>n=>{const i=e.isBuffer(n)?n.toString():n;return t(i,r)}),t.fromNumberTo32BitBuf=((t,r)=>n=>{let i=t(n,r);const o=new Array(4);for(let e=0;e<4;e++)o[e]=255&i,i>>=8;return e.from(o)})}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(e){const n=r(296),i=r(297)(),o=r(1159),s={SHA1:"SHA-1",SHA256:"SHA-256",SHA512:"SHA-512"},a=(t,r,o)=>{n(i.subtle.sign({name:"HMAC"},t,r).then(t=>e.from(t)),o)};t.create=function(e,t,r){const u=s[e];n(i.subtle.importKey("raw",t,{name:"HMAC",hash:{name:u}},!1,["sign"]).then(t=>({digest(e,r){a(t,e,r)},length:o[e]})),r)}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(e){const n=r(296),i=r(297)();function o(e){return Promise.all([i.subtle.exportKey("jwk",e.privateKey),i.subtle.exportKey("jwk",e.publicKey)])}function s(e){return i.subtle.importKey("jwk",{kty:e.kty,n:e.n,e:e.e},{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}},!0,["verify"])}t.utils=r(1164),t.generateKey=function(e,t){n(i.subtle.generateKey({name:"RSASSA-PKCS1-v1_5",modulusLength:e,publicExponent:new Uint8Array([1,0,1]),hash:{name:"SHA-256"}},!0,["sign","verify"]).then(o).then(e=>({privateKey:e[0],publicKey:e[1]})),t)},t.unmarshalPrivateKey=function(e,t){const r=i.subtle.importKey("jwk",e,{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}},!0,["sign"]);n(Promise.all([r,s(e)]).then(e=>o({privateKey:e[0],publicKey:e[1]})).then(e=>({privateKey:e[0],publicKey:e[1]})),t)},t.getRandomValues=function(t){return e.from(i.getRandomValues(t))},t.hashAndSign=function(t,r,o){n(i.subtle.importKey("jwk",t,{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}},!1,["sign"]).then(e=>i.subtle.sign({name:"RSASSA-PKCS1-v1_5"},e,Uint8Array.from(r))).then(t=>e.from(t)),o)},t.hashAndVerify=function(e,t,r,o){n(i.subtle.importKey("jwk",e,{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}},!1,["verify"]).then(e=>i.subtle.verify({name:"RSASSA-PKCS1-v1_5"},e,t,r)),o)}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(e){const n=r(17).bignum;t.toBase64=function t(r,n){let i=r.toArrayLike(e,"be",n).toString("base64");return i.replace(/(=*)$/,"").replace(/\+/g,"-").replace(/\//g,"_")},t.toBn=function t(r){return new n(e.from(r,"base64"))}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";const n=r(538);function i(e){if(!e||"number"!=typeof e)throw new Error("first argument must be a Number bigger than 0");return n.getRandomValues(new Uint8Array(e))}e.exports=i},function(e,t,r){"use strict";(function(e){const n=r(300),i=r(301)(),o=r(1180),s={SHA1:"SHA-1",SHA256:"SHA-256",SHA512:"SHA-512"},a=(t,r,o)=>{n(i.subtle.sign({name:"HMAC"},t,r).then(t=>e.from(t)),o)};t.create=function(e,t,r){const u=s[e];n(i.subtle.importKey("raw",t,{name:"HMAC",hash:{name:u}},!1,["sign"]).then(t=>({digest(e,r){a(t,e,r)},length:o[e]})),r)}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(t){const n=r(14),i=r(1185);function o(e,t,r,i){if("function"==typeof r&&(i=r,r=void 0),!i)throw new Error("Missing callback");o.digest(e,t,r,(e,o)=>{if(e)return i(e);i(null,n.encode(o,t,r))})}e.exports=o,o.Buffer=t,o.multihash=n,o.digest=function(e,t,r,n){if("function"==typeof r&&(n=r,r=void 0),!n)throw new Error("Missing callback");let i=n,s;r&&(i=((e,t)=>{if(e)return n(e);n(null,t.slice(0,r))}));try{s=o.createHash(t)}catch(e){return i(e)}s(e,i)},o.createHash=function(e){if(e=n.coerceCode(e),!o.functions[e])throw new Error("multihash function "+e+" not yet supported");return o.functions[e]},o.functions={17:i.sha1,18:i.sha2256,19:i.sha2512,20:i.sha3512,21:i.sha3384,22:i.sha3256,23:i.sha3224,24:i.shake128,25:i.shake256,26:i.keccak224,27:i.keccak256,28:i.keccak384,29:i.keccak512,34:i.murmur3128,35:i.murmur332,86:i.dblSha2256},i.addBlake(o.functions)}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(e){const n=r(3);t.toCallback=(e=>(function(t,r){const i=(e,t)=>n(()=>{r(e,t)});let o;try{o=e(t)}catch(e){return void i(e)}i(null,o)})),t.toBuf=((t,r)=>n=>{let i=t(n,r);return e.from(i,"hex")}),t.fromString=((t,r)=>n=>{const i=e.isBuffer(n)?n.toString():n;return t(i,r)}),t.fromNumberTo32BitBuf=((t,r)=>n=>{let i=t(n,r);const o=new Array(4);for(let e=0;e<4;e++)o[e]=255&i,i>>=8;return e.from(o)})}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(e){const n=r(300),i=r(301)();function o(e){return Promise.all([i.subtle.exportKey("jwk",e.privateKey),i.subtle.exportKey("jwk",e.publicKey)])}function s(e){return i.subtle.importKey("jwk",{kty:e.kty,n:e.n,e:e.e},{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}},!0,["verify"])}t.utils=r(1188),t.generateKey=function(e,t){n(i.subtle.generateKey({name:"RSASSA-PKCS1-v1_5",modulusLength:e,publicExponent:new Uint8Array([1,0,1]),hash:{name:"SHA-256"}},!0,["sign","verify"]).then(o).then(e=>({privateKey:e[0],publicKey:e[1]})),t)},t.unmarshalPrivateKey=function(e,t){const r=i.subtle.importKey("jwk",e,{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}},!0,["sign"]);n(Promise.all([r,s(e)]).then(e=>o({privateKey:e[0],publicKey:e[1]})).then(e=>({privateKey:e[0],publicKey:e[1]})),t)},t.getRandomValues=function(t){return e.from(i.getRandomValues(t))},t.hashAndSign=function(t,r,o){n(i.subtle.importKey("jwk",t,{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}},!1,["sign"]).then(e=>i.subtle.sign({name:"RSASSA-PKCS1-v1_5"},e,Uint8Array.from(r))).then(t=>e.from(t)),o)},t.hashAndVerify=function(e,t,r,o){n(i.subtle.importKey("jwk",e,{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}},!1,["verify"]).then(e=>i.subtle.verify({name:"RSASSA-PKCS1-v1_5"},e,t,r)),o)}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(e){const n=r(17).bignum;t.toBase64=function t(r,n){let i=r.toArrayLike(e,"be",n).toString("base64");return i.replace(/(=*)$/,"").replace(/\+/g,"-").replace(/\//g,"_")},t.toBn=function t(r){return new n(e.from(r,"base64"))}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";const n=r(544);function i(e){if(!e||"number"!=typeof e)throw new Error("first argument must be a Number bigger than 0");return n.getRandomValues(new Uint8Array(e))}e.exports=i},function(e,t,r){"use strict";(function(e){const n=r(304),i=r(305)(),o=r(1207),s={SHA1:"SHA-1",SHA256:"SHA-256",SHA512:"SHA-512"},a=(t,r,o)=>{n(i.subtle.sign({name:"HMAC"},t,r).then(t=>e.from(t)),o)};t.create=function(e,t,r){const u=s[e];n(i.subtle.importKey("raw",t,{name:"HMAC",hash:{name:u}},!1,["sign"]).then(t=>({digest(e,r){a(t,e,r)},length:o[e]})),r)}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(t){const n=r(14),i=r(1212);function o(e,t,r,i){if("function"==typeof r&&(i=r,r=void 0),!i)throw new Error("Missing callback");o.digest(e,t,r,(e,o)=>{if(e)return i(e);i(null,n.encode(o,t,r))})}e.exports=o,o.Buffer=t,o.multihash=n,o.digest=function(e,t,r,n){if("function"==typeof r&&(n=r,r=void 0),!n)throw new Error("Missing callback");let i=n,s;r&&(i=((e,t)=>{if(e)return n(e);n(null,t.slice(0,r))}));try{s=o.createHash(t)}catch(e){return i(e)}s(e,i)},o.createHash=function(e){if(e=n.coerceCode(e),!o.functions[e])throw new Error("multihash function "+e+" not yet supported");return o.functions[e]},o.functions={17:i.sha1,18:i.sha2256,19:i.sha2512,20:i.sha3512,21:i.sha3384,22:i.sha3256,23:i.sha3224,24:i.shake128,25:i.shake256,26:i.keccak224,27:i.keccak256,28:i.keccak384,29:i.keccak512,34:i.murmur3128,35:i.murmur332,86:i.dblSha2256},i.addBlake(o.functions)}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(e){const n=r(3);t.toCallback=(e=>(function(t,r){const i=(e,t)=>n(()=>{r(e,t)});let o;try{o=e(t)}catch(e){return void i(e)}i(null,o)})),t.toBuf=((t,r)=>n=>{let i=t(n,r);return e.from(i,"hex")}),t.fromString=((t,r)=>n=>{const i=e.isBuffer(n)?n.toString():n;return t(i,r)}),t.fromNumberTo32BitBuf=((t,r)=>n=>{let i=t(n,r);const o=new Array(4);for(let e=0;e<4;e++)o[e]=255&i,i>>=8;return e.from(o)})}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(e){const n=r(304),i=r(305)();function o(e){return Promise.all([i.subtle.exportKey("jwk",e.privateKey),i.subtle.exportKey("jwk",e.publicKey)])}function s(e){return i.subtle.importKey("jwk",{kty:e.kty,n:e.n,e:e.e},{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}},!0,["verify"])}t.utils=r(1215),t.generateKey=function(e,t){n(i.subtle.generateKey({name:"RSASSA-PKCS1-v1_5",modulusLength:e,publicExponent:new Uint8Array([1,0,1]),hash:{name:"SHA-256"}},!0,["sign","verify"]).then(o).then(e=>({privateKey:e[0],publicKey:e[1]})),t)},t.unmarshalPrivateKey=function(e,t){const r=i.subtle.importKey("jwk",e,{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}},!0,["sign"]);n(Promise.all([r,s(e)]).then(e=>o({privateKey:e[0],publicKey:e[1]})).then(e=>({privateKey:e[0],publicKey:e[1]})),t)},t.getRandomValues=function(t){return e.from(i.getRandomValues(t))},t.hashAndSign=function(t,r,o){n(i.subtle.importKey("jwk",t,{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}},!1,["sign"]).then(e=>i.subtle.sign({name:"RSASSA-PKCS1-v1_5"},e,Uint8Array.from(r))).then(t=>e.from(t)),o)},t.hashAndVerify=function(e,t,r,o){n(i.subtle.importKey("jwk",e,{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}},!1,["verify"]).then(e=>i.subtle.verify({name:"RSASSA-PKCS1-v1_5"},e,t,r)),o)}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(e){const n=r(17).bignum;t.toBase64=function t(r,n){let i=r.toArrayLike(e,"be",n).toString("base64");return i.replace(/(=*)$/,"").replace(/\+/g,"-").replace(/\//g,"_")},t.toBn=function t(r){return new n(e.from(r,"base64"))}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";const n=r(550);function i(e){if(!e||"number"!=typeof e)throw new Error("first argument must be a Number bigger than 0");return n.getRandomValues(new Uint8Array(e))}e.exports=i},function(e,t,r){(function(t){var r="[object AsyncFunction]",n="[object Function]",i="[object GeneratorFunction]",o="[object Null]",s="[object Proxy]",a="[object Undefined]",u="object"==typeof t&&t&&t.Object===Object&&t,c="object"==typeof self&&self&&self.Object===Object&&self,f=u||c||Function("return this")(),l=Object.prototype,h=l.hasOwnProperty,p=l.toString,d=f.Symbol,y=d?d.toStringTag:void 0;function g(e){return null==e?void 0===e?a:o:y&&y in Object(e)?m(e):b(e)}function m(e){var t=h.call(e,y),r=e[y];try{e[y]=void 0;var n=!0}catch(e){}var i=p.call(e);return n&&(t?e[y]=r:delete e[y]),i}function b(e){return p.call(e)}function v(e){if(!_(e))return!1;var t=g(e);return t==n||t==i||t==r||t==s}function _(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}e.exports=v}).call(this,r(7))},function(e,t,r){"use strict";(function(t){const n=r(102),i=r(53),o=r(193),s=o.writeEncoded;function a(e,r,o){const a=n({timeout:6e4},r),u=a.handshake;return o("writing multicodec: "+e),s(u,t.from(e+"\n"),r),i.decodeFromReader(u,(t,n)=>{if(t)return r(t);const i=n.toString().slice(0,-1);if(i!==e)return r(new Error(`"${e}" not supported`),u.rest());o("received ack: "+i),r(null,u.rest())}),a}e.exports=a}).call(this,r(0).Buffer)},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(308),i=c(n),o=r(164),s=c(o),a=r(556),u=c(a);function c(e){return e&&e.__esModule?e:{default:e}}t.default=(0,s.default)((0,i.default)(Boolean,u.default)),e.exports=t.default},function(e,t){function r(e){return e}e.exports=r},function(e,t,r){"use strict";function n(e,t,r){const n=e===t;r(null,n)}e.exports=n},function(e,t,r){"use strict";t=e.exports,t.PROTOCOL_ID="/multistream/1.0.0"},function(e,t,r){"use strict";e.exports=r(1228)},function(e,t,r){"use strict";const n=r(3);e.exports={tag:"/plaintext/1.0.0",encrypt:(e,t,r,i)=>("function"==typeof r&&(i=r,r=void 0),n(()=>i()),t)}},function(e,t,r){"use strict";const n=r(1233),i=r(52),o=r(31);function s(e,t){let r;if(i.isPeerInfo(e))return e;if(o.isMultiaddr(e)){const o=e.getPeerId();try{r=t.get(o)}catch(e){r=new i(n.createFromB58String(o))}return r.multiaddrs.add(e),r}if(n.isPeerId(e)){const r=e.toB58String();try{return t.get(r)}catch(e){throw new Error("Couldnt get PeerInfo")}}throw new Error("peer type not recognized")}e.exports=s},function(e,t,r){"use strict";(function(e){const n=r(311),i=r(312)(),o=r(1235),s={SHA1:"SHA-1",SHA256:"SHA-256",SHA512:"SHA-512"},a=(t,r,o)=>{n(i.subtle.sign({name:"HMAC"},t,r).then(t=>e.from(t)),o)};t.create=function(e,t,r){const u=s[e];n(i.subtle.importKey("raw",t,{name:"HMAC",hash:{name:u}},!1,["sign"]).then(t=>({digest(e,r){a(t,e,r)},length:o[e]})),r)}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(t){const n=r(14),i=r(1240);function o(e,t,r,i){if("function"==typeof r&&(i=r,r=void 0),!i)throw new Error("Missing callback");o.digest(e,t,r,(e,o)=>{if(e)return i(e);i(null,n.encode(o,t,r))})}e.exports=o,o.Buffer=t,o.multihash=n,o.digest=function(e,t,r,n){if("function"==typeof r&&(n=r,r=void 0),!n)throw new Error("Missing callback");let i=n,s;r&&(i=((e,t)=>{if(e)return n(e);n(null,t.slice(0,r))}));try{s=o.createHash(t)}catch(e){return i(e)}s(e,i)},o.createHash=function(e){if(e=n.coerceCode(e),!o.functions[e])throw new Error("multihash function "+e+" not yet supported");return o.functions[e]},o.functions={17:i.sha1,18:i.sha2256,19:i.sha2512,20:i.sha3512,21:i.sha3384,22:i.sha3256,23:i.sha3224,24:i.shake128,25:i.shake256,26:i.keccak224,27:i.keccak256,28:i.keccak384,29:i.keccak512,34:i.murmur3128,35:i.murmur332,86:i.dblSha2256},i.addBlake(o.functions)}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(e){const n=r(3);t.toCallback=(e=>(function(t,r){const i=(e,t)=>n(()=>{r(e,t)});let o;try{o=e(t)}catch(e){return void i(e)}i(null,o)})),t.toBuf=((t,r)=>n=>{let i=t(n,r);return e.from(i,"hex")}),t.fromString=((t,r)=>n=>{const i=e.isBuffer(n)?n.toString():n;return t(i,r)}),t.fromNumberTo32BitBuf=((t,r)=>n=>{let i=t(n,r);const o=new Array(4);for(let e=0;e<4;e++)o[e]=255&i,i>>=8;return e.from(o)})}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(e){const n=r(311),i=r(312)();function o(e){return Promise.all([i.subtle.exportKey("jwk",e.privateKey),i.subtle.exportKey("jwk",e.publicKey)])}function s(e){return i.subtle.importKey("jwk",{kty:e.kty,n:e.n,e:e.e},{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}},!0,["verify"])}t.utils=r(1243),t.generateKey=function(e,t){n(i.subtle.generateKey({name:"RSASSA-PKCS1-v1_5",modulusLength:e,publicExponent:new Uint8Array([1,0,1]),hash:{name:"SHA-256"}},!0,["sign","verify"]).then(o).then(e=>({privateKey:e[0],publicKey:e[1]})),t)},t.unmarshalPrivateKey=function(e,t){const r=i.subtle.importKey("jwk",e,{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}},!0,["sign"]);n(Promise.all([r,s(e)]).then(e=>o({privateKey:e[0],publicKey:e[1]})).then(e=>({privateKey:e[0],publicKey:e[1]})),t)},t.getRandomValues=function(t){return e.from(i.getRandomValues(t))},t.hashAndSign=function(t,r,o){n(i.subtle.importKey("jwk",t,{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}},!1,["sign"]).then(e=>i.subtle.sign({name:"RSASSA-PKCS1-v1_5"},e,Uint8Array.from(r))).then(t=>e.from(t)),o)},t.hashAndVerify=function(e,t,r,o){n(i.subtle.importKey("jwk",e,{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}},!1,["verify"]).then(e=>i.subtle.verify({name:"RSASSA-PKCS1-v1_5"},e,t,r)),o)}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(e){const n=r(17).bignum;t.toBase64=function t(r,n){let i=r.toArrayLike(e,"be",n).toString("base64");return i.replace(/(=*)$/,"").replace(/\+/g,"-").replace(/\//g,"_")},t.toBn=function t(r){return new n(e.from(r,"base64"))}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";const n=r(565);function i(e){if(!e||"number"!=typeof e)throw new Error("first argument must be a Number bigger than 0");return n.getRandomValues(new Uint8Array(e))}e.exports=i},function(e,t,r){"use strict";const n=r(44).Connection,i=r(8);e.exports=((e,t,r,o)=>{const s=new Promise((e,t)=>{r.getPeerInfo((t,n)=>{if(!t&&n)return void e(n);const i=r.setPeerInfo;r.setPeerInfo=(t=>{i.call(r,t),e(t)})})}),a={source:i(r,o.incoming(e,t,s)),sink:i(o.outgoing(e,t,s),r)};return new n(a,r)})},function(e,t,r){var n=r(1265);function i(e,t,r){var i=null==e?void 0:n(e,t);return void 0===i?r:i}e.exports=i},function(e,t,r){var n=r(1275),i=r(1279);function o(e,t){var r=i(e,t);return n(r)?r:void 0}e.exports=o},function(e,t,r){(function(n){function i(){return!("undefined"==typeof window||!window.process||"renderer"!==window.process.type)||("undefined"!=typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"undefined"!=typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/))}function o(e){var r=this.useColors;if(e[0]=(r?"%c":"")+this.namespace+(r?" %c":" ")+e[0]+(r?"%c ":" ")+"+"+t.humanize(this.diff),r){var n="color: "+this.color;e.splice(1,0,n,"color: inherit");var i=0,o=0;e[0].replace(/%[a-zA-Z%]/g,function(e){"%%"!==e&&(i++,"%c"===e&&(o=i))}),e.splice(o,0,n)}}function s(){return"object"==typeof console&&console.log&&Function.prototype.apply.call(console.log,console,arguments)}function a(e){try{null==e?t.storage.removeItem("debug"):t.storage.debug=e}catch(e){}}function u(){var e;try{e=t.storage.debug}catch(e){}return!e&&void 0!==n&&"env"in n&&(e=n.env.DEBUG),e}function c(){try{return window.localStorage}catch(e){}}t=e.exports=r(1301),t.log=s,t.formatArgs=o,t.save=a,t.load=u,t.useColors=i,t.storage="undefined"!=typeof chrome&&void 0!==chrome.storage?chrome.storage.local:c(),t.colors=["lightseagreen","forestgreen","goldenrod","dodgerblue","darkorchid","crimson"],t.formatters.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}},t.enable(u())}).call(this,r(6))},function(e,t,r){"use strict";const n=r(12),i=n(r(1311)),o=n(r(1312));t=e.exports,t.rpc=i,t.td=o},function(e,t,r){"use strict";var n=r(1317);e.exports=function(){var e={};return n.toArray(arguments).reverse().forEach(function(t){n.mergeWith(e,t,function(e,t){return n.isArray(t)?t:void 0})}),e}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=u;var n=r(216),i=a(n),o=r(32),s=a(o);function a(e){return e&&e.__esModule?e:{default:e}}function u(e){return function(t,r,n,o){return e((0,i.default)(r),t,(0,s.default)(n),o)}}e.exports=t.default},function(e,t){e.exports=function(e){var t,r,n;function i(e){return r=e,function(e,i){n?t=[e,i]:r(e,i)}}return i.pause=function(){n||(n=!0,e&&e(n))},i.resume=function(){if(n&&(n=!1,e&&e(n),t)){var i=t;t=null,r(i[0],i[1])}},i}},function(e,t,r){"use strict";(function(t){e.exports=function e(r,n,i,o){const s=r.length;return i>=n+s?t.alloc(0):(o-n<s&&(r=r.slice(0,o-n)),i>n&&i<n+s&&(r=r.slice(i-n)),r)}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";var n=e.exports=function(e){return null!==e&&"object"==typeof e&&"function"==typeof e.pipe};n.writable=function(e){return n(e)&&!1!==e.writable&&"function"==typeof e._write&&"object"==typeof e._writableState},n.readable=function(e){return n(e)&&!1!==e.readable&&"function"==typeof e._read&&"object"==typeof e._readableState},n.duplex=function(e){return n.writable(e)&&n.readable(e)},n.transform=function(e){return n.duplex(e)&&"function"==typeof e._transform&&"object"==typeof e._transformState}},function(e,t){function r(e){return"function"==typeof e}function n(e){return"object"==typeof e&&i(e.source)&&o(e.sink)}function i(e){return r(e)&&2===e.length}function o(e){return r(e)&&1===e.length}t.isDuplex=n,t.isSource=i,t.isSink=o},function(e,t,r){"use strict";const n=r(197).OFFLINE_ERROR,i=r(22),o=r(3),s=r(107),a=r(9),u=r(68),c=r(88);function f(e){return Array.from(e).map(e=>({"/":e[1].cid.toBaseEncodedString()}))}e.exports=function e(t){return{wantlist:i((e,r)=>{if(r||(r=e,e=void 0),!t.isOnline())return o(()=>r(new Error(n)));let i;if(e){try{e=u.createFromB58String(e)}catch(t){e=null}if(!e)return o(()=>r(new Error("Invalid peerId")));i=t._bitswap.wantlistForPeer(e)}else i=t._bitswap.getWantlist();return i=f(i),o(()=>r(null,{Keys:i}))}),stat:i(e=>{if(!t.isOnline())return o(()=>e(new Error(n)));const r=t._bitswap.stat().snapshot;e(null,{provideBufLen:parseInt(r.providesBufferLength.toString()),blocksReceived:new s(r.blocksReceived),wantlist:f(t._bitswap.getWantlist()),peers:t._bitswap.peers().map(e=>e.toB58String()),dupBlksReceived:new s(r.dupBlksReceived),dupDataReceived:new s(r.dupDataReceived),dataReceived:new s(r.dataReceived),blocksSent:new s(r.blocksSent),dataSent:new s(r.dataSent)})}),unwant:i((e,r)=>{if(!t.isOnline())return o(()=>r(new Error(n)));Array.isArray(e)||(e=[e]);try{e=e.map(e=>a.isCID(e)?e:new a(e))}catch(e){return o(()=>r(c(e,"ERR_INVALID_CID")))}return o(()=>r(null,t._bitswap.unwant(e)))})}}},function(e,t,r){"use strict";e.exports=r(1383)},function(e,t){e.exports={WORKER_REQUEST_READ_LOCK:"lock:worker:request-read",WORKER_RELEASE_READ_LOCK:"lock:worker:release-read",MASTER_GRANT_READ_LOCK:"lock:master:grant-read",WORKER_REQUEST_WRITE_LOCK:"lock:worker:request-write",WORKER_RELEASE_WRITE_LOCK:"lock:worker:release-write",MASTER_GRANT_WRITE_LOCK:"lock:master:grant-write"}},function(e,t){const r={},n=e=>{e.addEventListener("message",t=>{n.dispatchEvent("message",e,t)}),e.port&&e.port.addEventListener("message",t=>{n.dispatchEvent("message",e,t)})};n.addEventListener=((e,t)=>{r[e]||(r[e]=[]),r[e].push(t)}),n.removeEventListener=((e,t)=>{r[e]&&(r[e]=r[e].filter(e=>e===t))}),n.dispatchEvent=function(){const e=Array.prototype.slice.call(arguments),t=e.shift();r[t]&&r[t].forEach(t=>t.apply(null,e))},e.exports=n},function(e,t,r){"use strict";const n=r(5),{DAGNode:i}=r(42),o={format:"dag-pb",hashAlg:"sha2-256"},s=(e,t,r,s,a)=>{s=Object.assign({},o,s),n([e=>i.create(t,r,e),(t,r)=>{e.dag.put(t,{format:s.format,hashAlg:s.hashAlg},e=>r(e,t))}],a)};e.exports=s},function(e,t,r){"use strict";class n extends Error{constructor(e){super(e),this.code=0}}class i extends Error{constructor(e){super(e),this.code=1}}e.exports={NonFatalError:n,FatalError:i}},function(e,t,r){(function(t){var n=r(1401).strict;e.exports=function e(r){if(n(r)){var i=t.from(r.buffer);return r.byteLength!==r.buffer.byteLength&&(i=i.slice(r.byteOffset,r.byteOffset+r.byteLength)),i}return t.from(r)}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";const n=r(55);function i(e,t){e=e.slice();const r=e.filter(e=>"function"==typeof e).pop(),i=Object.assign({},t,e.filter(e=>"object"==typeof e).pop()||{});Array.isArray(e[0])&&(e=e[0]);const o=e.filter(e=>"string"==typeof e).map(e=>(e=e.trim(),{path:e,name:n.basename(e),dir:n.dirname(e)}));return{sources:o,options:i,callback:r}}e.exports=i},function(e,t,r){"use strict";const n=r(9),i=r(1)("ipfs:mfs:utils:with-mfs-root"),o=r(5),{MFS_ROOT_KEY:s}=r(147),a=(e,t)=>{const r=e._repo,a=r&&r.datastore;if(!r||!a)return t(new Error("Please run jsipfs init first"));o([e=>a.open(t=>e(t)),t=>{a.get(s,(u,c)=>{if(u&&u.notFound)return i("Creating new MFS root"),o([t=>e.files.add({path:"/"},t),([{hash:e}],t)=>t(null,new n(e)),(e,t)=>r.closed?a.open(r=>t(r,e)):t(null,e),(e,t)=>a.put(s,e.buffer,r=>t(r,e))],t);t(u,new n(c))})},(e,t)=>{i(`Fetched MFS root ${e.toBaseEncodedString()}`),t(null,e)}],t)};e.exports=a},function(e,t,r){"use strict";const{FILE_SEPARATOR:n}=r(147),i="/ipfs",o=(e,t)=>{if(e=(e||"").trim(),!e)return t(new Error("paths must not be empty"));if(e.substring(0,1)!==n)return t(new Error(`paths must start with a leading ${n}`));e.substring(e.length-n.length)===n&&(e=e.substring(0,e.length-n.length));const r=e.split(n).filter(Boolean),i=r.pop(),o=`${n}${r.join(n)}`;if("/ipfs"===e.substring(0,"/ipfs".length))return t(null,{type:"ifps",path:e.substring("/ipfs".length+1),directory:o,name:i});t(null,{type:"mfs",path:e||n,directory:o,name:i})};e.exports=o},function(e,t,r){"use strict";const n=r(38).unmarshal,{traverseTo:i,formatCid:o}=r(45),s=r(5),a=r(1)("ipfs:mfs:stat"),u={hash:!1,size:!1,withLocal:!1,cidBase:"base58btc"};e.exports=(e=>(function t(r,c,f){"function"==typeof c&&(f=c,c={}),c=Object.assign({},u,c),a(`Fetching stats for ${r}`),s([t=>i(e,r,{withCreateHint:!1},t),({node:e},t)=>{if(c.hash)return t(null,{hash:o(e.multihash,c.cidBase)});if(c.size)return t(null,{size:e.size});const r=n(e.data);let i=e.links.length;"file"===r.type&&(i=r.blockSizes.length),t(null,{hash:o(e.multihash,c.cidBase),size:r.fileSize()||0,cumulativeSize:e.size,blocks:i,type:r.type,local:void 0,sizeLocal:void 0,withLocality:!1})}],f)}))},function(e,t,r){"use strict";const n=r(5),i=r(46),o=r(37),s=r(38),{traverseTo:a,addLink:u,updateTree:c,updateMfsRoot:f,toSourcesAndDestination:l}=r(45),h=r(589),p=r(1)("ipfs:mfs:cp"),d={parents:!1,flush:!0,format:"dag-pb",hashAlg:"sha2-256"};e.exports=(e=>(function t(){const r=Array.from(arguments),{sources:n,destination:i,options:o,callback:u}=l(r,d);return n.length?i?(o.parents=o.p||o.parents,void a(e,i.path,{},(t,r)=>{if(t)return 1===n.length?(p("Only one source, copying to a file"),y(e,n.pop(),i,o,u)):(p("Multiple sources, copying to a directory"),g(e,n,i,o,u));const a=s.unmarshal(r.node.data);if("directory"===a.type)return g(e,n,i,o,u);u(new Error("directory already has entry by that name"))})):u(new Error("Please supply a destination")):u(new Error("Please supply at least one source"))}));const y=(e,t,r,o,s)=>{n([n=>{i([r=>h(e)(t.path,o,r),t=>h(e)(r.path,o,e=>{if(!e)return t(new Error("directory already has entry by that name"));t()}),t=>a(e,r.dir,o,t)],n)},([t,i,o],s)=>{n([n=>u(e,{parent:o.node,child:{size:t.cumulativeSize,hash:t.hash},name:r.name},n),(t,r)=>{o.node=t,c(e,o,r)},(t,r)=>f(e,t.node.multihash,r)],s)}],e=>s(e))},g=(e,t,r,s,l)=>{n([n=>{o([r=>i(t.map(t=>r=>h(e)(t.path,s,r)),r),t=>a(e,r.path,Object.assign({},s,{createLastComponent:!0}),t)],n)},(o,a)=>{const l=o.pop(),p=o[0];n([n=>{i(t.map(t=>n=>{h(e)(`${r.path}/${t.name}`,s,e=>{if(!e)return n(new Error("directory already has entry by that name"));n()})}),e=>n(e))},r=>{n([e=>e(null,l.node)].concat(p.map((r,n)=>(i,o)=>u(e,{parent:i,child:{size:r.cumulativeSize,hash:r.hash},name:t[n].name},o))),r)},(t,r)=>{l.node=t,c(e,l,r)},(t,r)=>f(e,t.node.multihash,r)],a)}],e=>l(e))}},function(e,t,r){"use strict";const n=r(38),i=r(5),o=r(37),{DAGNode:s}=r(42),a=r(9),{traverseTo:u,updateTree:c,updateMfsRoot:f,toSources:l,FILE_SEPARATOR:h}=r(45),p={recursive:!1};e.exports=(e=>(function t(){const r=Array.from(arguments),{sources:n,options:i,callback:s}=l(r,p);if(!n.length)return s(new Error("Please supply at least one path to remove"));o(n.map(t=>r=>d(e,t.path,i,r)),e=>s(e))}));const d=(e,t,r,o)=>{if(t===h)return o(new Error("Cannot delete root"));i([r=>u(e,t,{withCreateHint:!1},r),(o,u)=>{const l=n.unmarshal(o.node.data);if("directory"===l.type&&!r.recursive)return u(new Error(`${t} is a directory, use -r to remove directories`));i([e=>s.rmLink(o.parent.node,o.name,e),(t,r)=>{e.dag.put(t,{cid:new a(t.hash||t.multihash)},e=>r(e,t))},(t,r)=>{o.parent.node=t,c(e,o.parent,r)},(t,r)=>f(e,t.node.multihash,r)],u)}],o)}},function(e,t,r){"use strict";const n=r(5),i=r(64),o=r(82),s=r(90),a=r(146).importer,{loadNode:u}=r(45),c=(e,t,r,c)=>{n([n=>i(o([{content:i(t)}]),a(e.dag,{progress:r.progress,hashAlg:r.hashAlg,cidVersion:r.cidVersion,strategy:r.strategy,rawLeaves:r.rawLeaves,reduceSingleLeafToSelf:r.reduceSingleLeafToSelf,leafType:r.leafType}),s(n)),(t,r)=>u(e,t[0],r)],c)};e.exports=c},function(e,t,r){(function(e,r){var n=200,i="__lodash_hash_undefined__",o=9007199254740991,s="[object Arguments]",a="[object Array]",u="[object Boolean]",c="[object Date]",f="[object Error]",l="[object Function]",h="[object GeneratorFunction]",p="[object Map]",d="[object Number]",y="[object Object]",g="[object Promise]",m="[object RegExp]",b="[object Set]",v="[object String]",_="[object Symbol]",w="[object WeakMap]",S="[object ArrayBuffer]",k="[object DataView]",E="[object Float32Array]",A="[object Float64Array]",x="[object Int8Array]",I="[object Int16Array]",T="[object Int32Array]",B="[object Uint8Array]",C="[object Uint8ClampedArray]",P="[object Uint16Array]",O="[object Uint32Array]",R=/[\\^$.*+?()[\]{}|]/g,N=/\w*$/,L=/^\[object .+?Constructor\]$/,j=/^(?:0|[1-9]\d*)$/,M={};M[s]=M[a]=M[S]=M[k]=M[u]=M[c]=M[E]=M[A]=M[x]=M[I]=M[T]=M[p]=M[d]=M[y]=M[m]=M[b]=M[v]=M[_]=M[B]=M[C]=M[P]=M[O]=!0,M[f]=M[l]=M[w]=!1;var K="object"==typeof e&&e&&e.Object===Object&&e,D="object"==typeof self&&self&&self.Object===Object&&self,U=K||D||Function("return this")(),F="object"==typeof t&&t&&!t.nodeType&&t,q=F&&"object"==typeof r&&r&&!r.nodeType&&r,H=q&&q.exports===F;function z(e,t){return e.set(t[0],t[1]),e}function V(e,t){return e.add(t),e}function G(e,t){for(var r=-1,n=e?e.length:0;++r<n&&!1!==t(e[r],r,e););return e}function W(e,t){for(var r=-1,n=t.length,i=e.length;++r<n;)e[i+r]=t[r];return e}function $(e,t,r,n){var i=-1,o=e?e.length:0;for(n&&o&&(r=e[++i]);++i<o;)r=t(r,e[i],i,e);return r}function Y(e,t){for(var r=-1,n=Array(e);++r<e;)n[r]=t(r);return n}function J(e,t){return null==e?void 0:e[t]}function X(e){var t=!1;if(null!=e&&"function"!=typeof e.toString)try{t=!!(e+"")}catch(e){}return t}function Z(e){var t=-1,r=Array(e.size);return e.forEach(function(e,n){r[++t]=[n,e]}),r}function Q(e,t){return function(r){return e(t(r))}}function ee(e){var t=-1,r=Array(e.size);return e.forEach(function(e){r[++t]=e}),r}var te=Array.prototype,re=Function.prototype,ne=Object.prototype,ie=U["__core-js_shared__"],oe=(se=/[^.]+$/.exec(ie&&ie.keys&&ie.keys.IE_PROTO||""),se?"Symbol(src)_1."+se:""),se,ae=re.toString,ue=ne.hasOwnProperty,ce=ne.toString,fe=RegExp("^"+ae.call(ue).replace(R,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),le=H?U.Buffer:void 0,he=U.Symbol,pe=U.Uint8Array,de=Q(Object.getPrototypeOf,Object),ye=Object.create,ge=ne.propertyIsEnumerable,me=te.splice,be=Object.getOwnPropertySymbols,ve=le?le.isBuffer:void 0,_e=Q(Object.keys,Object),we=It(U,"DataView"),Se=It(U,"Map"),ke=It(U,"Promise"),Ee=It(U,"Set"),Ae=It(U,"WeakMap"),xe=It(Object,"create"),Ie=Mt(we),Te=Mt(Se),Be=Mt(ke),Ce=Mt(Ee),Pe=Mt(Ae),Oe=he?he.prototype:void 0,Re=Oe?Oe.valueOf:void 0;function Ne(e){var t=-1,r=e?e.length:0;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}function Le(){this.__data__=xe?xe(null):{}}function je(e){return this.has(e)&&delete this.__data__[e]}function Me(e){var t=this.__data__;if(xe){var r=t[e];return r===i?void 0:r}return ue.call(t,e)?t[e]:void 0}function Ke(e){var t=this.__data__;return xe?void 0!==t[e]:ue.call(t,e)}function De(e,t){var r=this.__data__;return r[e]=xe&&void 0===t?i:t,this}function Ue(e){var t=-1,r=e?e.length:0;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}function Fe(){this.__data__=[]}function qe(e){var t=this.__data__,r=st(t,e);if(r<0)return!1;var n=t.length-1;return r==n?t.pop():me.call(t,r,1),!0}function He(e){var t=this.__data__,r=st(t,e);return r<0?void 0:t[r][1]}function ze(e){return st(this.__data__,e)>-1}function Ve(e,t){var r=this.__data__,n=st(r,e);return n<0?r.push([e,t]):r[n][1]=t,this}function Ge(e){var t=-1,r=e?e.length:0;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}function We(){this.__data__={hash:new Ne,map:new(Se||Ue),string:new Ne}}function $e(e){return xt(this,e).delete(e)}function Ye(e){return xt(this,e).get(e)}function Je(e){return xt(this,e).has(e)}function Xe(e,t){return xt(this,e).set(e,t),this}function Ze(e){this.__data__=new Ue(e)}function Qe(){this.__data__=new Ue}function et(e){return this.__data__.delete(e)}function tt(e){return this.__data__.get(e)}function rt(e){return this.__data__.has(e)}function nt(e,t){var r=this.__data__;if(r instanceof Ue){var i=r.__data__;if(!Se||i.length<n-1)return i.push([e,t]),this;r=this.__data__=new Ge(i)}return r.set(e,t),this}function it(e,t){var r=Ft(e)||Ut(e)?Y(e.length,String):[],n=r.length,i=!!n;for(var o in e)!t&&!ue.call(e,o)||i&&("length"==o||Rt(o,n))||r.push(o);return r}function ot(e,t,r){var n=e[t];ue.call(e,t)&&Dt(n,r)&&(void 0!==r||t in e)||(e[t]=r)}function st(e,t){for(var r=e.length;r--;)if(Dt(e[r][0],t))return r;return-1}function at(e,t){return e&&kt(t,Yt(t),e)}function ut(e,t,r,n,i,o,a){var u;if(n&&(u=o?n(e,i,o,a):n(e)),void 0!==u)return u;if(!Wt(e))return e;var c=Ft(e);if(c){if(u=Ct(e),!t)return St(e,u)}else{var f=Bt(e),p=f==l||f==h;if(zt(e))return dt(e,t);if(f==y||f==s||p&&!o){if(X(e))return o?e:{};if(u=Pt(p?{}:e),!t)return Et(e,at(u,e))}else{if(!M[f])return o?e:{};u=Ot(e,f,ut,t)}}a||(a=new Ze);var d=a.get(e);if(d)return d;if(a.set(e,u),!c)var g=r?At(e):Yt(e);return G(g||e,function(i,o){g&&(o=i,i=e[o]),ot(u,o,ut(i,t,r,n,o,e,a))}),u}function ct(e){return Wt(e)?ye(e):{}}function ft(e,t,r){var n=t(e);return Ft(e)?n:W(n,r(e))}function lt(e){return ce.call(e)}function ht(e){if(!Wt(e)||Lt(e))return!1;var t=Vt(e)||X(e)?fe:L;return t.test(Mt(e))}function pt(e){if(!jt(e))return _e(e);var t=[];for(var r in Object(e))ue.call(e,r)&&"constructor"!=r&&t.push(r);return t}function dt(e,t){if(t)return e.slice();var r=new e.constructor(e.length);return e.copy(r),r}function yt(e){var t=new e.constructor(e.byteLength);return new pe(t).set(new pe(e)),t}function gt(e,t){var r=t?yt(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.byteLength)}function mt(e,t,r){var n=t?r(Z(e),!0):Z(e);return $(n,z,new e.constructor)}function bt(e){var t=new e.constructor(e.source,N.exec(e));return t.lastIndex=e.lastIndex,t}function vt(e,t,r){var n=t?r(ee(e),!0):ee(e);return $(n,V,new e.constructor)}function _t(e){return Re?Object(Re.call(e)):{}}function wt(e,t){var r=t?yt(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.length)}function St(e,t){var r=-1,n=e.length;for(t||(t=Array(n));++r<n;)t[r]=e[r];return t}function kt(e,t,r,n){r||(r={});for(var i=-1,o=t.length;++i<o;){var s=t[i],a=n?n(r[s],e[s],s,r,e):void 0;ot(r,s,void 0===a?e[s]:a)}return r}function Et(e,t){return kt(e,Tt(e),t)}function At(e){return ft(e,Yt,Tt)}function xt(e,t){var r=e.__data__;return Nt(t)?r["string"==typeof t?"string":"hash"]:r.map}function It(e,t){var r=J(e,t);return ht(r)?r:void 0}Ne.prototype.clear=Le,Ne.prototype.delete=je,Ne.prototype.get=Me,Ne.prototype.has=Ke,Ne.prototype.set=De,Ue.prototype.clear=Fe,Ue.prototype.delete=qe,Ue.prototype.get=He,Ue.prototype.has=ze,Ue.prototype.set=Ve,Ge.prototype.clear=We,Ge.prototype.delete=$e,Ge.prototype.get=Ye,Ge.prototype.has=Je,Ge.prototype.set=Xe,Ze.prototype.clear=Qe,Ze.prototype.delete=et,Ze.prototype.get=tt,Ze.prototype.has=rt,Ze.prototype.set=nt;var Tt=be?Q(be,Object):Jt,Bt=lt;function Ct(e){var t=e.length,r=e.constructor(t);return t&&"string"==typeof e[0]&&ue.call(e,"index")&&(r.index=e.index,r.input=e.input),r}function Pt(e){return"function"!=typeof e.constructor||jt(e)?{}:ct(de(e))}function Ot(e,t,r,n){var i=e.constructor;switch(t){case S:return yt(e);case u:case c:return new i(+e);case k:return gt(e,n);case E:case A:case x:case I:case T:case B:case C:case P:case O:return wt(e,n);case p:return mt(e,n,r);case d:case v:return new i(e);case m:return bt(e);case b:return vt(e,n,r);case _:return _t(e)}}function Rt(e,t){return t=null==t?o:t,!!t&&("number"==typeof e||j.test(e))&&e>-1&&e%1==0&&e<t}function Nt(e){var t=typeof e;return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e}function Lt(e){return!!oe&&oe in e}function jt(e){var t=e&&e.constructor,r="function"==typeof t&&t.prototype||ne;return e===r}function Mt(e){if(null!=e){try{return ae.call(e)}catch(e){}try{return e+""}catch(e){}}return""}function Kt(e){return ut(e,!0,!0)}function Dt(e,t){return e===t||e!=e&&t!=t}function Ut(e){return Ht(e)&&ue.call(e,"callee")&&(!ge.call(e,"callee")||ce.call(e)==s)}(we&&Bt(new we(new ArrayBuffer(1)))!=k||Se&&Bt(new Se)!=p||ke&&Bt(ke.resolve())!=g||Ee&&Bt(new Ee)!=b||Ae&&Bt(new Ae)!=w)&&(Bt=function(e){var t=ce.call(e),r=t==y?e.constructor:void 0,n=r?Mt(r):void 0;if(n)switch(n){case Ie:return k;case Te:return p;case Be:return g;case Ce:return b;case Pe:return w}return t});var Ft=Array.isArray;function qt(e){return null!=e&&Gt(e.length)&&!Vt(e)}function Ht(e){return $t(e)&&qt(e)}var zt=ve||Xt;function Vt(e){var t=Wt(e)?ce.call(e):"";return t==l||t==h}function Gt(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=o}function Wt(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function $t(e){return!!e&&"object"==typeof e}function Yt(e){return qt(e)?it(e):pt(e)}function Jt(){return[]}function Xt(){return!1}r.exports=Kt}).call(this,r(7),r(28)(e))},function(e,t,r){"use strict";e.exports="ipfs-pubsub-room/v2"},function(e,t,r){"use strict";(function(t){e.exports=(e=>{let r=e;return t.isBuffer(r)||(r=t.from(r)),r})}).call(this,r(0).Buffer)},function(e,t,r){(function(t){var n=r(4),i=r(21).Transform,o=r(1463);function s(e,t){if(!(this instanceof s))return new s(e,t);i.call(this),t||(t={}),"object"==typeof e&&(t=e,e=t.size),this.size=e||512,t.nopad?this._zeroPadding=!1:this._zeroPadding=o(t.zeroPadding,!0),this._buffered=[],this._bufferedBytes=0}e.exports=s,n(s,i),s.prototype._transform=function(e,r,n){for(this._bufferedBytes+=e.length,this._buffered.push(e);this._bufferedBytes>=this.size;){var i=t.concat(this._buffered);this._bufferedBytes-=this.size,this.push(i.slice(0,this.size)),this._buffered=[i.slice(this.size,i.length)]}n()},s.prototype._flush=function(){if(this._bufferedBytes&&this._zeroPadding){var e=new t(this.size-this._bufferedBytes);e.fill(0),this._buffered.push(e),this.push(t.concat(this._buffered)),this._buffered=null}else this._bufferedBytes&&(this.push(t.concat(this._buffered)),this._buffered=null);this.push(null)}}).call(this,r(0).Buffer)},function(e,t,r){e.exports=o;var n=r(4),i=r(21);function o(e,t){var r=this;if(!(r instanceof o))return new o(e,t);i.Readable.call(r,t),r.destroyed=!1,r._drained=!1,r._forwarding=!1,r._current=null,r._toStreams2=t&&t.objectMode?s:a,"function"==typeof e?r._queue=e:(r._queue=e.map(r._toStreams2),r._queue.forEach(function(e){"function"!=typeof e&&r._attachErrorListener(e)})),r._next()}function s(e){return u(e,{objectMode:!0,highWaterMark:16})}function a(e){return u(e)}function u(e,t){if(!e||"function"==typeof e||e._readableState)return e;var r=new i.Readable(t).wrap(e);return e.destroy&&(r.destroy=e.destroy.bind(e)),r}n(o,i.Readable),o.obj=function(e){return new o(e,{objectMode:!0,highWaterMark:16})},o.prototype._read=function(){this._drained=!0,this._forward()},o.prototype._forward=function(){if(!this._forwarding&&this._drained&&this._current){var e;for(this._forwarding=!0;null!==(e=this._current.read());)this._drained=this.push(e);this._forwarding=!1}},o.prototype.destroy=function(e){this.destroyed||(this.destroyed=!0,this._current&&this._current.destroy&&this._current.destroy(),"function"!=typeof this._queue&&this._queue.forEach(function(e){e.destroy&&e.destroy()}),e&&this.emit("error",e),this.emit("close"))},o.prototype._next=function(){var e=this;if(e._current=null,"function"==typeof e._queue)e._queue(function(t,r){if(t)return e.destroy(t);r=e._toStreams2(r),e._attachErrorListener(r),e._gotNextStream(r)});else{var t=e._queue.shift();"function"==typeof t&&(t=e._toStreams2(t()),e._attachErrorListener(t)),e._gotNextStream(t)}},o.prototype._gotNextStream=function(e){var t=this;if(!e)return t.push(null),void t.destroy();function r(){t._forward()}function n(){e._readableState.ended||t.destroy()}function i(){t._current=null,e.removeListener("readable",r),e.removeListener("end",i),e.removeListener("close",n),t._next()}t._current=e,t._forward(),e.on("readable",r),e.once("end",i),e.once("close",n)},o.prototype._attachErrorListener=function(e){var t=this;function r(n){e.removeListener("error",r),t.destroy(n)}e&&e.once("error",r)}},function(e,t,r){(function(t,n){const i=r(201),o=r(1473),s=r(97),a=r(1474),u=r(1478),c=r(55),f=r(149),l=r(202);function h(e){if("string"==typeof e&&/^(stream-)?magnet:/.test(e))return u(e);if("string"==typeof e&&(/^[a-f0-9]{40}$/i.test(e)||/^[a-z2-7]{32}$/i.test(e)))return u(`magnet:?xt=urn:btih:${e}`);if(t.isBuffer(e)&&20===e.length)return u(`magnet:?xt=urn:btih:${e.toString("hex")}`);if(t.isBuffer(e))return d(e);if(e&&e.infoHash)return e.infoHash=e.infoHash.toLowerCase(),e.announce||(e.announce=[]),"string"==typeof e.announce&&(e.announce=[e.announce]),e.urlList||(e.urlList=[]),e;throw new Error("Invalid torrent identifier")}function p(e,t){let r;if("function"!=typeof t)throw new Error("second argument must be a Function");try{r=h(e)}catch(e){}function i(e){try{r=h(e)}catch(e){return t(e)}r&&r.infoHash?t(null,r):t(new Error("Invalid torrent identifier"))}r&&r.infoHash?n.nextTick(()=>{t(null,r)}):g(e)?o(e,(e,r)=>{if(e)return t(new Error(`Error converting Blob: ${e.message}`));i(r)}):"function"==typeof a&&/^https?:/.test(e)?a.concat({url:e,timeout:3e4,headers:{"user-agent":"WebTorrent (https://webtorrent.io)"}},(e,r,n)=>{if(e)return t(new Error(`Error downloading torrent: ${e.message}`));i(n)}):"function"==typeof s.readFile&&"string"==typeof e?s.readFile(e,(e,r)=>{if(e)return t(new Error("Invalid torrent identifier"));i(r)}):n.nextTick(()=>{t(new Error("Invalid torrent identifier"))})}function d(e){t.isBuffer(e)&&(e=i.decode(e)),v(e.info,"info"),v(e.info["name.utf-8"]||e.info.name,"info.name"),v(e.info["piece length"],"info['piece length']"),v(e.info.pieces,"info.pieces"),e.info.files?e.info.files.forEach(e=>{v("number"==typeof e.length,"info.files[0].length"),v(e["path.utf-8"]||e.path,"info.files[0].path")}):v("number"==typeof e.info.length,"info.length");const r={info:e.info,infoBuffer:i.encode(e.info),name:(e.info["name.utf-8"]||e.info.name).toString(),announce:[]};r.infoHash=f.sync(r.infoBuffer),r.infoHashBuffer=t.from(r.infoHash,"hex"),void 0!==e.info.private&&(r.private=!!e.info.private),e["creation date"]&&(r.created=new Date(1e3*e["creation date"])),e["created by"]&&(r.createdBy=e["created by"].toString()),t.isBuffer(e.comment)&&(r.comment=e.comment.toString()),Array.isArray(e["announce-list"])&&e["announce-list"].length>0?e["announce-list"].forEach(e=>{e.forEach(e=>{r.announce.push(e.toString())})}):e.announce&&r.announce.push(e.announce.toString()),t.isBuffer(e["url-list"])&&(e["url-list"]=e["url-list"].length>0?[e["url-list"]]:[]),r.urlList=(e["url-list"]||[]).map(e=>e.toString()),l(r.announce),l(r.urlList);const n=e.info.files||[e.info];r.files=n.map((e,t)=>{const i=[].concat(r.name,e["path.utf-8"]||e.path||[]).map(e=>e.toString());return{path:c.join.apply(null,[c.sep].concat(i)).slice(1),name:i[i.length-1],length:e.length,offset:n.slice(0,t).reduce(m,0)}}),r.length=n.reduce(m,0);const o=r.files[r.files.length-1];return r.pieceLength=e.info["piece length"],r.lastPieceLength=(o.offset+o.length)%r.pieceLength||r.pieceLength,r.pieces=b(e.info.pieces),r}function y(e){const r={info:e.info};return r["announce-list"]=(e.announce||[]).map(e=>(r.announce||(r.announce=e),e=t.from(e,"utf8"),[e])),r["url-list"]=e.urlList||[],void 0!==e.private&&(r.private=Number(e.private)),e.created&&(r["creation date"]=e.created.getTime()/1e3|0),e.createdBy&&(r["created by"]=e.createdBy),e.comment&&(r.comment=e.comment),i.encode(r)}function g(e){return"undefined"!=typeof Blob&&e instanceof Blob}function m(e,t){return e+t.length}function b(e){const t=[];for(let r=0;r<e.length;r+=20)t.push(e.slice(r,r+20).toString("hex"));return t}function v(e,t){if(!e)throw new Error(`Torrent is missing required field: ${t}`)}e.exports=h,e.exports.remote=p,e.exports.toMagnetURI=u.encode,e.exports.toTorrentFile=y,t.alloc(0)}).call(this,r(0).Buffer,r(6))},function(e,t,r){(function(e){t.fetch=a(e.fetch)&&a(e.ReadableStream),t.writableStream=a(e.WritableStream),t.abortController=a(e.AbortController),t.blobConstructor=!1;try{new Blob([new ArrayBuffer(1)]),t.blobConstructor=!0}catch(e){}var r;function n(){if(void 0!==r)return r;if(e.XMLHttpRequest){r=new e.XMLHttpRequest;try{r.open("GET",e.XDomainRequest?"/":"https://example.com")}catch(e){r=null}}else r=null;return r}function i(e){var t=n();if(!t)return!1;try{return t.responseType=e,t.responseType===e}catch(e){}return!1}var o=void 0!==e.ArrayBuffer,s=o&&a(e.ArrayBuffer.prototype.slice);function a(e){return"function"==typeof e}t.arraybuffer=t.fetch||o&&i("arraybuffer"),t.msstream=!t.fetch&&s&&i("ms-stream"),t.mozchunkedarraybuffer=!t.fetch&&o&&i("moz-chunked-arraybuffer"),t.overrideMimeType=t.fetch||!!n()&&a(n().overrideMimeType),t.vbArray=a(e.VBArray),r=null}).call(this,r(7))},function(e,t,r){(function(e,n,i){var o=r(599),s=r(4),a=r(21),u=t.readyStates={UNSENT:0,OPENED:1,HEADERS_RECEIVED:2,LOADING:3,DONE:4},c=t.IncomingMessage=function(t,r,s,u){var c=this;if(a.Readable.call(c),c._mode=s,c.headers={},c.rawHeaders=[],c.trailers={},c.rawTrailers=[],c.on("end",function(){e.nextTick(function(){c.emit("close")})}),"fetch"===s){if(c._fetchResponse=r,c.url=r.url,c.statusCode=r.status,c.statusMessage=r.statusText,r.headers.forEach(function(e,t){c.headers[t.toLowerCase()]=e,c.rawHeaders.push(t,e)}),o.writableStream){var f=new WritableStream({write:function(e){return new Promise(function(t,r){c._destroyed?r():c.push(new n(e))?t():c._resumeFetch=t})},close:function(){i.clearTimeout(u),c._destroyed||c.push(null)},abort:function(e){c._destroyed||c.emit("error",e)}});try{return void r.body.pipeTo(f).catch(function(e){i.clearTimeout(u),c._destroyed||c.emit("error",e)})}catch(e){}}var l=r.body.getReader();function h(){l.read().then(function(e){if(!c._destroyed){if(e.done)return i.clearTimeout(u),void c.push(null);c.push(new n(e.value)),h()}}).catch(function(e){i.clearTimeout(u),c._destroyed||c.emit("error",e)})}h()}else{c._xhr=t,c._pos=0,c.url=t.responseURL,c.statusCode=t.status,c.statusMessage=t.statusText;var p=t.getAllResponseHeaders().split(/\r?\n/);if(p.forEach(function(e){var t=e.match(/^([^:]+):\s*(.*)/);if(t){var r=t[1].toLowerCase();"set-cookie"===r?(void 0===c.headers[r]&&(c.headers[r]=[]),c.headers[r].push(t[2])):void 0!==c.headers[r]?c.headers[r]+=", "+t[2]:c.headers[r]=t[2],c.rawHeaders.push(t[1],t[2])}}),c._charset="x-user-defined",!o.overrideMimeType){var d=c.rawHeaders["mime-type"];if(d){var y=d.match(/;\s*charset=([^;])(;|$)/);y&&(c._charset=y[1].toLowerCase())}c._charset||(c._charset="utf-8")}}};s(c,a.Readable),c.prototype._read=function(){var e=this,t=this._resumeFetch;t&&(this._resumeFetch=null,t())},c.prototype._onXHRProgress=function(){var e=this,t=e._xhr,r=null;switch(e._mode){case"text:vbarray":if(t.readyState!==u.DONE)break;try{r=new i.VBArray(t.responseBody).toArray()}catch(e){}if(null!==r){e.push(new n(r));break}case"text":try{r=t.responseText}catch(t){e._mode="text:vbarray";break}if(r.length>e._pos){var o=r.substr(e._pos);if("x-user-defined"===e._charset){for(var s=new n(o.length),a=0;a<o.length;a++)s[a]=255&o.charCodeAt(a);e.push(s)}else e.push(o,e._charset);e._pos=r.length}break;case"arraybuffer":if(t.readyState!==u.DONE||!t.response)break;r=t.response,e.push(new n(new Uint8Array(r)));break;case"moz-chunked-arraybuffer":if(r=t.response,t.readyState!==u.LOADING||!r)break;e.push(new n(new Uint8Array(r)));break;case"ms-stream":if(r=t.response,t.readyState!==u.LOADING)break;var c=new i.MSStreamReader;c.onprogress=function(){c.result.byteLength>e._pos&&(e.push(new n(new Uint8Array(c.result.slice(e._pos)))),e._pos=c.result.byteLength)},c.onload=function(){e.push(null)},c.readAsArrayBuffer(r)}e._xhr.readyState===u.DONE&&"ms-stream"!==e._mode&&e.push(null)}}).call(this,r(6),r(0).Buffer,r(7))},function(e,t,r){var n=r(0).Buffer;e.exports=function(e){if(e instanceof Uint8Array){if(0===e.byteOffset&&e.byteLength===e.buffer.byteLength)return e.buffer;if("function"==typeof e.buffer.slice)return e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength)}if(n.isBuffer(e)){for(var t=new Uint8Array(e.length),r=e.length,i=0;i<r;i++)t[i]=e[i];return t.buffer}throw new Error("Argument must be a Buffer")}},function(e,t,r){var n=r(322),i=r(36),o=e.exports;for(var s in n)n.hasOwnProperty(s)&&(o[s]=n[s]);function a(e){if("string"==typeof e&&(e=i.parse(e)),e.protocol||(e.protocol="https:"),"https:"!==e.protocol)throw new Error('Protocol "'+e.protocol+'" not supported. Expected "https:"');return e}o.request=function(e,t){return e=a(e),n.request.call(this,e,t)},o.get=function(e,t){return e=a(e),n.get.call(this,e,t)}},function(e,t,r){var n=r(2).Buffer,i=r(604);t.DEFAULT_ANNOUNCE_PEERS=50,t.MAX_ANNOUNCE_PEERS=82,t.binaryToHex=function(e){return"string"!=typeof e&&(e=String(e)),n.from(e,"binary").toString("hex")},t.hexToBinary=function(e){return"string"!=typeof e&&(e=String(e)),n.from(e,"hex").toString("binary")};var o=r(1489);i(t,o)},function(e,t){e.exports=n;var r=Object.prototype.hasOwnProperty;function n(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)r.call(n,i)&&(e[i]=n[i])}return e}},function(e,t,r){(function(t){e.exports=l;const n=r(321),i=r(1497),o=r(322),s=r(602),a=r(35),u=r(205),c=r(36),f=e=>null!==e&&"object"==typeof e&&"function"==typeof e.pipe;function l(e,r){if(e=Object.assign({maxRedirects:10},"string"==typeof e?{url:e}:e),r=a(r),e.url){const{hostname:t,port:r,protocol:n,auth:i,path:o}=c.parse(e.url);delete e.url,t||r||n||i?Object.assign(e,{hostname:t,port:r,protocol:n,auth:i,path:o}):e.path=o}const n={"accept-encoding":"gzip, deflate"};let h;e.headers&&Object.keys(e.headers).forEach(t=>n[t.toLowerCase()]=e.headers[t]),e.headers=n,e.body?h=e.json&&!f(e.body)?JSON.stringify(e.body):e.body:e.form&&(h="string"==typeof e.form?e.form:u.stringify(e.form),e.headers["content-type"]="application/x-www-form-urlencoded"),h&&(e.method||(e.method="POST"),f(h)||(e.headers["content-length"]=t.byteLength(h)),e.json&&!e.form&&(e.headers["content-type"]="application/json")),delete e.body,delete e.form,e.json&&(e.headers.accept="application/json"),e.method&&(e.method=e.method.toUpperCase());const p="https:"===e.protocol?s:o,d=p.request(e,t=>{if(t.statusCode>=300&&t.statusCode<400&&t.headers.location)return e.url=t.headers.location,delete e.headers.host,t.resume(),"POST"===e.method&&[301,302].includes(t.statusCode)&&(e.method="GET",delete e.headers["content-length"],delete e.headers["content-type"]),0==e.maxRedirects--?r(new Error("too many redirects")):l(e,r);const n="function"==typeof i&&"HEAD"!==e.method;r(null,n?i(t):t)});return d.on("timeout",()=>{d.abort(),r(new Error("Request timed out"))}),d.on("error",r),f(h)?h.on("error",r).pipe(d):d.end(h),d}l.concat=((e,t)=>l(e,(r,i)=>{if(r)return t(r);n(i,(r,n)=>{if(r)return t(r);if(e.json)try{n=JSON.parse(n.toString())}catch(r){return t(r,i,n)}t(null,i,n)})})),["get","post","put","patch","head","delete"].forEach(e=>{l[e]=((t,r)=>("string"==typeof t&&(t={url:t}),l(Object.assign({method:e.toUpperCase()},t),r)))})}).call(this,r(0).Buffer)},function(e,t,r){e.exports=u;var n=r(4),i=r(21),o=r(601),s="undefined"!=typeof window&&window.MediaSource,a=60;function u(e,t){var r=this;if(!(r instanceof u))return new u(e,t);if(!s)throw new Error("web browser lacks MediaSource support");t||(t={}),r._debug=t.debug,r._bufferDuration=t.bufferDuration||a,r._elem=e,r._mediaSource=new s,r._streams=[],r.detailedError=null,r._errorHandler=function(){r._elem.removeEventListener("error",r._errorHandler);var e=r._streams.slice();e.forEach(function(e){e.destroy(r._elem.error)})},r._elem.addEventListener("error",r._errorHandler),r._elem.src=window.URL.createObjectURL(r._mediaSource)}function c(e,t){var r=this;if(i.Writable.call(r),r._wrapper=e,r._elem=e._elem,r._mediaSource=e._mediaSource,r._allStreams=e._streams,r._allStreams.push(r),r._bufferDuration=e._bufferDuration,r._sourceBuffer=null,r._debugBuffers=[],r._openHandler=function(){r._onSourceOpen()},r._flowHandler=function(){r._flow()},r._errorHandler=function(e){r.destroyed||r.emit("error",e)},"string"==typeof t)r._type=t,"open"===r._mediaSource.readyState?r._createSourceBuffer():r._mediaSource.addEventListener("sourceopen",r._openHandler);else if(null===t._sourceBuffer)t.destroy(),r._type=t._type,r._mediaSource.addEventListener("sourceopen",r._openHandler);else{if(!t._sourceBuffer)throw new Error("The argument to MediaElementWrapper.createWriteStream must be a string or a previous stream returned from that function");t.destroy(),r._type=t._type,r._sourceBuffer=t._sourceBuffer,r._debugBuffers=t._debugBuffers,r._sourceBuffer.addEventListener("updateend",r._flowHandler),r._sourceBuffer.addEventListener("error",r._errorHandler)}r._elem.addEventListener("timeupdate",r._flowHandler),r.on("error",function(e){r._wrapper.error(e)}),r.on("finish",function(){if(!r.destroyed&&(r._finished=!0,r._allStreams.every(function(e){return e._finished}))){r._wrapper._dumpDebugData();try{r._mediaSource.endOfStream()}catch(e){}}})}u.prototype.createWriteStream=function(e){var t=this;return new c(this,e)},u.prototype.error=function(e){var t=this;this.detailedError||(this.detailedError=e),this._dumpDebugData();try{this._mediaSource.endOfStream("decode")}catch(e){}},u.prototype._dumpDebugData=function(){var e=this;this._debug&&(this._debug=!1,this._streams.forEach(function(e,t){l(e._debugBuffers,"mediasource-stream-"+t)}))},n(c,i.Writable),c.prototype._onSourceOpen=function(){var e=this;this.destroyed||(this._mediaSource.removeEventListener("sourceopen",this._openHandler),this._createSourceBuffer())},c.prototype.destroy=function(e){var t=this;this.destroyed||(this.destroyed=!0,this._allStreams.splice(this._allStreams.indexOf(this),1),this._mediaSource.removeEventListener("sourceopen",this._openHandler),this._elem.removeEventListener("timeupdate",this._flowHandler),this._sourceBuffer&&(this._sourceBuffer.removeEventListener("updateend",this._flowHandler),this._sourceBuffer.removeEventListener("error",this._errorHandler),"open"===this._mediaSource.readyState&&this._sourceBuffer.abort()),e&&this.emit("error",e),this.emit("close"))},c.prototype._createSourceBuffer=function(){var e=this;if(!this.destroyed)if(s.isTypeSupported(this._type)){if(this._sourceBuffer=this._mediaSource.addSourceBuffer(this._type),this._sourceBuffer.addEventListener("updateend",this._flowHandler),this._sourceBuffer.addEventListener("error",this._errorHandler),this._cb){var t=this._cb;this._cb=null,t()}}else this.destroy(new Error("The provided type is not supported"))},c.prototype._write=function(e,t,r){var n=this;if(!n.destroyed)if(n._sourceBuffer){if(n._sourceBuffer.updating)return r(new Error("Cannot append buffer while source buffer updating"));var i=o(e);n._wrapper._debug&&n._debugBuffers.push(i);try{n._sourceBuffer.appendBuffer(i)}catch(e){return void n.destroy(e)}n._cb=r}else n._cb=function(i){if(i)return r(i);n._write(e,t,r)}},c.prototype._flow=function(){var e=this;if(!this.destroyed&&this._sourceBuffer&&!this._sourceBuffer.updating&&!("open"===this._mediaSource.readyState&&this._getBufferDuration()>this._bufferDuration)&&this._cb){var t=this._cb;this._cb=null,t()}};var f=0;function l(e,t){var r=document.createElement("a");r.href=window.URL.createObjectURL(new window.Blob(e)),r.download=t,r.click()}c.prototype._getBufferDuration=function(){for(var e=this,t=this._sourceBuffer.buffered,r=this._elem.currentTime,n=-1,i=0;i<t.length;i++){var o=t.start(i),s=t.end(i)+0;if(o>r)break;(n>=0||r<=s)&&(n=s)}var a=n-r;return a<0&&(a=0),a}},function(e,t,r){var n=r(608);e.exports=function e(t,r,i){if("function"==typeof r)return e(t,null,r);n(t,r,function(e,t){if(e)return i(e);var r=URL.createObjectURL(t);i(null,r)})}},function(e,t,r){var n=r(35);e.exports=function e(t,r,i){if("function"==typeof r)return e(t,null,r);i=n(i);var o=[];t.on("data",function(e){o.push(e)}).on("end",function(){var e=r?new Blob(o,{type:r}):new Blob(o);i(null,e)}).on("error",i)}},function(e,t,r){var n=r(150),i=Math.pow(2,32);t.encodingLength=function(){return 8},t.encode=function(e,t,r){t||(t=n(8)),r||(r=0);var o=Math.floor(e/i),s=e-o*i;return t.writeUInt32BE(o,r),t.writeUInt32BE(s,r+4),t},t.decode=function(e,t){t||(t=0);var r=e.readUInt32BE(t),n=e.readUInt32BE(t+4);return r*i+n},t.encode.bytes=8,t.decode.bytes=8},function(e,t){function r(e,t){if(!(t>=e.length||t<0)){var r=e.pop();if(t<e.length){var n=e[t];return e[t]=r,n}return r}}e.exports=r},function(e,t,r){e.exports=E;var n=r(610),i=r(201),o=r(203),s=r(2).Buffer,a=r(1)("bittorrent-protocol"),u=r(27),c=r(4),f=r(110),l=r(323),h=r(21),p=4e5,d=55e3,y=s.from("BitTorrent protocol"),g=s.from([0,0,0,0]),m=s.from([0,0,0,1,0]),b=s.from([0,0,0,1,1]),v=s.from([0,0,0,1,2]),_=s.from([0,0,0,1,3]),w=[0,0,0,0,0,0,0,0],S=[0,0,0,3,9,0,0];function k(e,t,r,n){this.piece=e,this.offset=t,this.length=r,this.callback=n}function E(){if(!(this instanceof E))return new E;h.Duplex.call(this),this._debugId=f(4).toString("hex"),this._debug("new wire"),this.peerId=null,this.peerIdBuffer=null,this.type=null,this.amChoking=!0,this.amInterested=!1,this.peerChoking=!0,this.peerInterested=!1,this.peerPieces=new o(0,{grow:p}),this.peerExtensions={},this.requests=[],this.peerRequests=[],this.extendedMapping={},this.peerExtendedMapping={},this.extendedHandshake={},this.peerExtendedHandshake={},this._ext={},this._nextExt=1,this.uploaded=0,this.downloaded=0,this.uploadSpeed=l(),this.downloadSpeed=l(),this._keepAliveInterval=null,this._timeout=null,this._timeoutMs=0,this.destroyed=!1,this._finished=!1,this._parserSize=0,this._parser=null,this._buffer=[],this._bufferSize=0,this.on("finish",this._onFinish),this._parseHandshake()}function A(e,t,r,i){for(var o=0;o<e.length;o++){var s=e[o];if(s.piece===t&&s.offset===r&&s.length===i)return n(e,o),s}return null}c(E,h.Duplex),E.prototype.setKeepAlive=function(e){var t=this;t._debug("setKeepAlive %s",e),clearInterval(t._keepAliveInterval),!1!==e&&(t._keepAliveInterval=setInterval(function(){t.keepAlive()},55e3))},E.prototype.setTimeout=function(e,t){this._debug("setTimeout ms=%d unref=%s",e,t),this._clearTimeout(),this._timeoutMs=e,this._timeoutUnref=!!t,this._updateTimeout()},E.prototype.destroy=function(){this.destroyed||(this.destroyed=!0,this._debug("destroy"),this.emit("close"),this.end())},E.prototype.end=function(){this._debug("end"),this._onUninterested(),this._onChoke(),h.Duplex.prototype.end.apply(this,arguments)},E.prototype.use=function(e){var t=e.prototype.name;if(!t)throw new Error('Extension class requires a "name" property on the prototype');this._debug("use extension.name=%s",t);var r=this._nextExt,n=new e(this);function i(){}"function"!=typeof n.onHandshake&&(n.onHandshake=i),"function"!=typeof n.onExtendedHandshake&&(n.onExtendedHandshake=i),"function"!=typeof n.onMessage&&(n.onMessage=i),this.extendedMapping[r]=t,this._ext[t]=n,this[t]=n,this._nextExt+=1},E.prototype.keepAlive=function(){this._debug("keep-alive"),this._push(g)},E.prototype.handshake=function(e,t,r){var n,i;if("string"==typeof e?(e=e.toLowerCase(),n=s.from(e,"hex")):(n=e,e=n.toString("hex")),"string"==typeof t?i=s.from(t,"hex"):(i=t,t=i.toString("hex")),20!==n.length||20!==i.length)throw new Error("infoHash and peerId MUST have length 20");this._debug("handshake i=%s p=%s exts=%o",e,t,r);var o=s.from(w);o[5]|=16,r&&r.dht&&(o[7]|=1),this._push(s.concat([y,o,n,i])),this._handshakeSent=!0,this.peerExtensions.extended&&!this._extendedHandshakeSent&&this._sendExtendedHandshake()},E.prototype._sendExtendedHandshake=function(){var e=u(this.extendedHandshake);for(var t in e.m={},this.extendedMapping){var r=this.extendedMapping[t];e.m[r]=Number(t)}this.extended(0,i.encode(e)),this._extendedHandshakeSent=!0},E.prototype.choke=function(){if(!this.amChoking){for(this.amChoking=!0,this._debug("choke");this.peerRequests.length;)this.peerRequests.pop();this._push(m)}},E.prototype.unchoke=function(){this.amChoking&&(this.amChoking=!1,this._debug("unchoke"),this._push(b))},E.prototype.interested=function(){this.amInterested||(this.amInterested=!0,this._debug("interested"),this._push(v))},E.prototype.uninterested=function(){this.amInterested&&(this.amInterested=!1,this._debug("uninterested"),this._push(_))},E.prototype.have=function(e){this._debug("have %d",e),this._message(4,[e],null)},E.prototype.bitfield=function(e){this._debug("bitfield"),s.isBuffer(e)||(e=e.buffer),this._message(5,[],e)},E.prototype.request=function(e,t,r,n){return n||(n=function(){}),this._finished?n(new Error("wire is closed")):this.peerChoking?n(new Error("peer is choking")):(this._debug("request index=%d offset=%d length=%d",e,t,r),this.requests.push(new k(e,t,r,n)),this._updateTimeout(),void this._message(6,[e,t,r],null))},E.prototype.piece=function(e,t,r){this._debug("piece index=%d offset=%d",e,t),this.uploaded+=r.length,this.uploadSpeed(r.length),this.emit("upload",r.length),this._message(7,[e,t],r)},E.prototype.cancel=function(e,t,r){this._debug("cancel index=%d offset=%d length=%d",e,t,r),this._callback(A(this.requests,e,t,r),new Error("request was cancelled"),null),this._message(8,[e,t,r],null)},E.prototype.port=function(e){this._debug("port %d",e);var t=s.from(S);t.writeUInt16BE(e,5),this._push(t)},E.prototype.extended=function(e,t){if(this._debug("extended ext=%s",e),"string"==typeof e&&this.peerExtendedMapping[e]&&(e=this.peerExtendedMapping[e]),"number"!=typeof e)throw new Error("Unrecognized extension: "+e);var r=s.from([e]),n=s.isBuffer(t)?t:i.encode(t);this._message(20,[],s.concat([r,n]))},E.prototype._read=function(){},E.prototype._message=function(e,t,r){var n=r?r.length:0,i=s.allocUnsafe(5+4*t.length);i.writeUInt32BE(i.length+n-4,0),i[4]=e;for(var o=0;o<t.length;o++)i.writeUInt32BE(t[o],5+4*o);this._push(i),r&&this._push(r)},E.prototype._push=function(e){if(!this._finished)return this.push(e)},E.prototype._onKeepAlive=function(){this._debug("got keep-alive"),this.emit("keep-alive")},E.prototype._onHandshake=function(e,t,r){var n=e.toString("hex"),i=t.toString("hex"),o;for(o in this._debug("got handshake i=%s p=%s exts=%o",n,i,r),this.peerId=i,this.peerIdBuffer=t,this.peerExtensions=r,this.emit("handshake",n,i,r),this._ext)this._ext[o].onHandshake(n,i,r);r.extended&&this._handshakeSent&&!this._extendedHandshakeSent&&this._sendExtendedHandshake()},E.prototype._onChoke=function(){for(this.peerChoking=!0,this._debug("got choke"),this.emit("choke");this.requests.length;)this._callback(this.requests.pop(),new Error("peer is choking"),null)},E.prototype._onUnchoke=function(){this.peerChoking=!1,this._debug("got unchoke"),this.emit("unchoke")},E.prototype._onInterested=function(){this.peerInterested=!0,this._debug("got interested"),this.emit("interested")},E.prototype._onUninterested=function(){this.peerInterested=!1,this._debug("got uninterested"),this.emit("uninterested")},E.prototype._onHave=function(e){this.peerPieces.get(e)||(this._debug("got have %d",e),this.peerPieces.set(e,!0),this.emit("have",e))},E.prototype._onBitField=function(e){this.peerPieces=new o(e),this._debug("got bitfield"),this.emit("bitfield",this.peerPieces)},E.prototype._onRequest=function(e,t,r){var n=this;if(!n.amChoking){n._debug("got request index=%d offset=%d length=%d",e,t,r);var i=function(i,s){if(o===A(n.peerRequests,e,t,r))return i?n._debug("error satisfying request index=%d offset=%d length=%d (%s)",e,t,r,i.message):void n.piece(e,t,s)},o=new k(e,t,r,i);n.peerRequests.push(o),n.emit("request",e,t,r,i)}},E.prototype._onPiece=function(e,t,r){this._debug("got piece index=%d offset=%d",e,t),this._callback(A(this.requests,e,t,r.length),null,r),this.downloaded+=r.length,this.downloadSpeed(r.length),this.emit("download",r.length),this.emit("piece",e,t,r)},E.prototype._onCancel=function(e,t,r){this._debug("got cancel index=%d offset=%d length=%d",e,t,r),A(this.peerRequests,e,t,r),this.emit("cancel",e,t,r)},E.prototype._onPort=function(e){this._debug("got port %d",e),this.emit("port",e)},E.prototype._onExtended=function(e,t){if(0===e){var r,n;try{r=i.decode(t)}catch(e){this._debug("ignoring invalid extended handshake: %s",e.message||e)}if(!r)return;if(this.peerExtendedHandshake=r,"object"==typeof r.m)for(n in r.m)this.peerExtendedMapping[n]=Number(r.m[n].toString());for(n in this._ext)this.peerExtendedMapping[n]&&this._ext[n].onExtendedHandshake(this.peerExtendedHandshake);this._debug("got extended handshake"),this.emit("extended","handshake",this.peerExtendedHandshake)}else this.extendedMapping[e]&&(e=this.extendedMapping[e],this._ext[e]&&this._ext[e].onMessage(t)),this._debug("got extended message ext=%s",e),this.emit("extended",e,t)},E.prototype._onTimeout=function(){this._debug("request timed out"),this._callback(this.requests.shift(),new Error("request has timed out"),null),this.emit("timeout")},E.prototype._write=function(e,t,r){for(this._bufferSize+=e.length,this._buffer.push(e);this._bufferSize>=this._parserSize;){var n=1===this._buffer.length?this._buffer[0]:s.concat(this._buffer);this._bufferSize-=this._parserSize,this._buffer=this._bufferSize?[n.slice(this._parserSize)]:[],this._parser(n.slice(0,this._parserSize))}r(null)},E.prototype._callback=function(e,t,r){e&&(this._clearTimeout(),this.peerChoking||this._finished||this._updateTimeout(),e.callback(t,r))},E.prototype._clearTimeout=function(){this._timeout&&(clearTimeout(this._timeout),this._timeout=null)},E.prototype._updateTimeout=function(){var e=this;e._timeoutMs&&e.requests.length&&!e._timeout&&(e._timeout=setTimeout(function(){e._onTimeout()},e._timeoutMs),e._timeoutUnref&&e._timeout.unref&&e._timeout.unref())},E.prototype._parse=function(e,t){this._parserSize=e,this._parser=t},E.prototype._onMessageLength=function(e){var t=e.readUInt32BE(0);t>0?this._parse(t,this._onMessage):(this._onKeepAlive(),this._parse(4,this._onMessageLength))},E.prototype._onMessage=function(e){switch(this._parse(4,this._onMessageLength),e[0]){case 0:return this._onChoke();case 1:return this._onUnchoke();case 2:return this._onInterested();case 3:return this._onUninterested();case 4:return this._onHave(e.readUInt32BE(1));case 5:return this._onBitField(e.slice(1));case 6:return this._onRequest(e.readUInt32BE(1),e.readUInt32BE(5),e.readUInt32BE(9));case 7:return this._onPiece(e.readUInt32BE(1),e.readUInt32BE(5),e.slice(9));case 8:return this._onCancel(e.readUInt32BE(1),e.readUInt32BE(5),e.readUInt32BE(9));case 9:return this._onPort(e.readUInt16BE(1));case 20:return this._onExtended(e.readUInt8(1),e.slice(2));default:return this._debug("got unknown message"),this.emit("unknownmessage",e)}},E.prototype._parseHandshake=function(){var e=this;e._parse(1,function(t){var r=t.readUInt8(0);e._parse(r+48,function(t){var n=t.slice(0,r);if("BitTorrent protocol"!==n.toString())return e._debug("Error: wire not speaking BitTorrent protocol (%s)",n.toString()),void e.end();t=t.slice(r),e._onHandshake(t.slice(8,28),t.slice(28,48),{dht:!!(1&t[7]),extended:!!(16&t[5])}),e._parse(4,e._onMessageLength)})})},E.prototype._onFinish=function(){for(this._finished=!0,this.push(null);this.read(););for(clearInterval(this._keepAliveInterval),this._parse(Number.MAX_VALUE,function(){});this.peerRequests.length;)this.peerRequests.pop();for(;this.requests.length;)this._callback(this.requests.pop(),new Error("wire was closed"),null)},E.prototype._debug=function(){var e=[].slice.call(arguments);e[0]="["+this._debugId+"] "+e[0],a.apply(null,e)}},function(e,t,r){(function(e,t){!function(){var r;"undefined"!=typeof window&&(r=window),void 0!==e&&(r=e),r=r||{};var n=r.console||{log:function(){}};function i(e){return e.slice?i[t(e)]:function(r,n){e(r={exports:{}}),i[t(n)]=r.exports};function t(e){return e.split("/").slice(-1).toString().replace(".js","")}}var o=t;i(function(e){var t={fn:{is:function(e){return!!e&&"function"==typeof e}}};t.bi={is:function(e){return e instanceof Boolean||"boolean"==typeof e}},t.num={is:function(e){return!n(e)&&(e-parseFloat(e)+1>=0||1/0===e||-1/0===e)}},t.text={is:function(e){return"string"==typeof e}},t.text.ify=function(e){return t.text.is(e)?e:"undefined"!=typeof JSON?JSON.stringify(e):e&&e.toString?e.toString():e},t.text.random=function(e,t){var r="";for(e=e||24,t=t||"0123456789ABCDEFGHIJKLMNOPQRSTUVWXZabcdefghijklmnopqrstuvwxyz";e>0;)r+=t.charAt(Math.floor(Math.random()*t.length)),e--;return r},t.text.match=function(e,r){var n=!1;if(e=e||"",r=t.text.is(r)?{"=":r}:r||{},t.obj.has(r,"~")&&(e=e.toLowerCase(),r["="]=(r["="]||r["~"]).toLowerCase()),t.obj.has(r,"="))return e===r["="];if(t.obj.has(r,"*")){if(e.slice(0,r["*"].length)!==r["*"])return!1;n=!0,e=e.slice(r["*"].length)}if(t.obj.has(r,"!")){if(e.slice(-r["!"].length)!==r["!"])return!1;n=!0}if(t.obj.has(r,"+")&&t.list.map(t.list.is(r["+"])?r["+"]:[r["+"]],function(t){if(!(e.indexOf(t)>=0))return!0;n=!0}))return!1;if(t.obj.has(r,"-")&&t.list.map(t.list.is(r["-"])?r["-"]:[r["-"]],function(t){if(!(e.indexOf(t)<0))return!0;n=!0}))return!1;if(t.obj.has(r,">")){if(!(e>r[">"]))return!1;n=!0}if(t.obj.has(r,"<")){if(!(e<r["<"]))return!1;n=!0}function i(e,t){for(var r=-1,n=0,i;i=t[n++];)if(!~(r=e.indexOf(i,r+1)))return!1;return!0}if(t.obj.has(r,"?")){if(!i(e,r["?"]))return!1;n=!0}return n},t.list={is:function(e){return e instanceof Array}},t.list.slit=Array.prototype.slice,t.list.sort=function(e){return function(t,r){return t&&r?(t=t[e],r=r[e],t<r?-1:t>r?1:0):0}},t.list.map=function(e,t,r){return a(e,t,r)},t.list.index=1,t.obj={is:function(e){return!!e&&(e instanceof Object&&e.constructor===Object||"Object"===Object.prototype.toString.call(e).match(/^\[object (\w+)\]$/)[1])}},t.obj.put=function(e,t,r){return(e||{})[t]=r,e},t.obj.has=function(e,t){return e&&Object.prototype.hasOwnProperty.call(e,t)},t.obj.del=function(e,t){if(e)return e[t]=null,delete e[t],e},t.obj.as=function(e,t,r,n){return e[t]=e[t]||(n===r?{}:r)},t.obj.ify=function(e){if(o(e))return e;try{e=JSON.parse(e)}catch(t){e={}}return e},function(){var e;function r(t,r){s(this,r)&&e!==this[r]||(this[r]=t)}t.obj.to=function(e,t){return t=t||{},a(e,r,t),t}}(),t.obj.copy=function(e){return e?JSON.parse(JSON.stringify(e)):e},function(){function e(e,t){var r=this.n;if(!r||!(t===r||o(r)&&s(r,t)))return!!t||void 0}t.obj.empty=function(t,r){return!t||!a(t,e,{n:r})}}(),function(){function e(t,r){if(2===arguments.length)return e.r=e.r||{},void(e.r[t]=r);e.r=e.r||[],e.r.push(t)}var i=Object.keys;t.obj.map=function(a,u,c){var f,l=0,h,p,d,y,g=r(u);if(e.r=null,i&&o(a)&&(d=i(a),y=!0),n(a)||d)for(h=(d||a).length;l<h;l++){var m=l+t.list.index;if(g){if(p=y?u.call(c||this,a[d[l]],d[l],e):u.call(c||this,a[l],m,e),p!==f)return p}else if(u===a[y?d[l]:l])return d?d[l]:m}else for(l in a)if(g){if(s(a,l)&&(p=c?u.call(c,a[l],l,e):u(a[l],l,e),p!==f))return p}else if(u===a[l])return l;return g?e.r:t.list.index?0:-1}}(),t.time={},t.time.is=function(e){return e?e instanceof Date:+(new Date).getTime()};var r=t.fn.is,n=t.list.is,i=t.obj,o=i.is,s=i.has,a=i.map;e.exports=t})(i,"./type"),i(function(e){e.exports=function e(t,r,n){if(!t)return{to:e};var i,t=(this.tag||(this.tag={}))[t]||(this.tag[t]={tag:t,to:e._={next:function(e){var t;(t=this.to)&&t.next(e)}}});if(r instanceof Function){var o={off:e.off||(e.off=function(){if(this.next===e._.next)return!0;this===this.the.last&&(this.the.last=this.back),this.to.back=this.back,this.next=e._.next,this.back.to=this.to,this.the.last===this.the&&delete this.on.tag[this.the.tag]}),to:e._,next:r,the:t,on:this,as:n};return(o.back=t.last||t).to=o,t.last=o}return(t=t.to)&&i!==r&&t.next(r),t}})(i,"./onto"),i(function(e){function t(e,t,n,i,o){if(e<t)return{defer:!0};if(t<n)return{historical:!0};if(n<t)return{converge:!0,incoming:!0};if(t===n){if(i=r(i)||"",o=r(o)||"",i===o)return{state:!0};if(i<o)return{converge:!0,current:!0};if(o<i)return{converge:!0,incoming:!0}}return{err:"Invalid CRDT Data: "+i+" to "+o+" at "+t+" to "+n+"!"}}if("undefined"==typeof JSON)throw new Error("JSON is not included in this browser. Please load it first: ajax.cdnjs.com/ajax/libs/json2/20110223/json2.js");var r=JSON.stringify,n;e.exports=t})(i,"./HAM"),i(function(e){var t=i("./type"),r={is:function(e){return e!==o&&(null===e||e!==1/0&&(!!(u(e)||s(e)||a(e))||(r.rel.is(e)||!1)))}};r.link=r.rel={_:"#"},function(){function e(e,t){var r=this;return r.id?r.id=!1:t==n&&u(e)?void(r.id=e):r.id=!1}r.rel.is=function(t){if(t&&t[n]&&!t._&&f(t)){var r={};if(h(t,e,r),r.id)return r.id}return!1}}(),r.rel.ify=function(e){return l({},n,e)},t.obj.has._=".";var n=r.link._,o,s=t.bi.is,a=t.num.is,u=t.text.is,c=t.obj,f=c.is,l=c.put,h=c.map;e.exports=r})(i,"./val"),i(function(e){var t=i("./type"),r=i("./val"),n={_:"_",soul:function(e,t){return e&&e._&&e._[t||l]}};n.soul.ify=function(e,t){return t="string"==typeof t?{soul:t}:t||{},e=e||{},e._=e._||{},e._[l]=t.soul||e._[l]||f(),e},n.soul._=r.link._,function(){function e(e,t){if(t!==n._)return!r.is(e)||void(this.cb&&this.cb.call(this.as,e,t,this.n,this.s))}n.is=function(t,r,i){var o;return!!s(t)&&(!!(o=n.soul(t))&&!u(t,e,{as:i,cb:r,s:o,n:t}))}}(),function(){function e(e,t){var n=this.o,i,o;if(n.map)return i=n.map.call(this.as,e,""+t,n.node),void(o===i?a(n.node,t):n.node&&(n.node[t]=i));r.is(e)&&(n.node[t]=e)}n.ify=function(t,r,i){return r?"string"==typeof r?r={soul:r}:r instanceof Function&&(r={map:r}):r={},r.map&&(r.node=r.map.call(i,t,h,r.node||{})),(r.node=n.soul.ify(r.node||{},r))&&u(t,e,{o:r,as:i}),r.node}}();var o=t.obj,s=o.is,a=o.del,u=o.map,c=t.text,f=c.random,l=n.soul._,h;e.exports=n})(i,"./node"),i(function(e){var t=i("./type"),r=i("./node");function n(){var e;return e=o(),s<e?(a=0,s=e+n.drift):s=e+(a+=1)/u+n.drift}var o=t.time.is,s=-1/0,a=0,u=1e3,c="undefined"!=typeof performance&&(performance.timing&&performance),f=c&&c.timing&&c.timing.navigationStart||(c=!1);n._=">",n.drift=0,n.is=function(e,t,r){var i=t&&e&&e[w]&&e[w][n._]||r;if(i)return b(i=i[t])?i:-1/0},n.lex=function(){return n().toString(36).replace(".","")},n.ify=function(e,t,i,o,s){if(!e||!e[w]){if(!s)return;e=r.soul.ify(e,s)}var a=h(e[w],n._);return S!==t&&t!==w&&(b(i)&&(a[t]=i),S!==o&&(e[t]=o)),e},n.to=function(e,t,i){var o=e[t];return d(o)&&(o=g(o)),n.ify(i,t,n.is(e,t),o,r.soul(e))},function(){function e(e,t){w!==t&&n.ify(this.o,t,this.s)}n.map=function(t,r,i){var o,s=d(s=t||r)?s:null;return t=_(t=t||r)?t:null,s&&!t?(r=b(r)?r:n(),s[w]=s[w]||{},y(s,e,{o:s,s:r}),s):(i=i||d(r)?r:o,r=b(r)?r:n(),function(n,s,a,u){if(!t)return e.call({o:a,s:r},n,s),n;t.call(i||this||{},n,s,a,u),p(a,s)&&o===a[s]||e.call({o:a,s:r},n,s)})}}();var l=t.obj,h=l.as,p=l.has,d=l.is,y=l.map,g=l.copy,m=t.num,b=m.is,v=t.fn,_=v.is,w=r._,S;e.exports=n})(i,"./state"),i(function(e){var t=i("./type"),r=i("./val"),n=i("./node"),o={};!function(){function e(e,r){if(!e||r!==n.soul(e)||!n.is(e,this.fn,this.as))return!0;this.cb&&(t.n=e,t.as=this.as,this.cb.call(t.as,e,r,t))}function t(e){e&&n.is(t.n,e,t.as)}o.is=function(t,r,n,i){return!(!t||!u(t)||l(t))&&!p(t,e,{cb:r,fn:n,as:i})}}(),function(){function e(e,t){var o;return(o=l(e,t))?o:(t.env=e,t.soul=s,n.ify(t.obj,i,t)&&(t.rel=t.rel||r.rel.ify(n.soul(t.node)),t.obj!==e.shell&&(e.graph[r.rel.is(t.rel)]=t.node)),t)}function i(t,i,o){var s=this,u=s.env,l,h;if(n._===i&&f(t,r.rel._))return o._;if(l=a(t,i,o,s,u)){if(i||(s.node=s.node||o||{},f(t,n._)&&n.soul(t)&&(s.node._=d(t._)),s.node=n.soul.ify(s.node,r.rel.is(s.rel)),s.rel=s.rel||r.rel.ify(n.soul(s.node))),(h=u.map)&&(h.call(u.as||{},t,i,o,s),f(o,i))){if(t=o[i],y===t)return void c(o,i);if(!(l=a(t,i,o,s,u)))return}if(!i)return s.node;if(!0===l)return t;if(h=e(u,{obj:t,path:s.path.concat(i)}),h.node)return h.rel}}function s(e){var t=this,i=r.link.is(t.rel),o=t.env.graph;t.rel=t.rel||r.rel.ify(e),t.rel[r.rel._]=e,t.node&&t.node[n._]&&(t.node[n._][r.rel._]=e),f(o,i)&&(o[e]=o[i],c(o,i))}function a(e,n,i,o,s){var c;return!!r.is(e)||(u(e)?1:(c=s.invalid)?(e=c.call(s.as||{},e,n,i),a(e,n,i,o,s)):(s.err="Invalid value at '"+o.path.concat(n).join(".")+"'!",void(t.list.is(e)&&(s.err+=" Use `.set(item)` instead of an Array."))))}function l(e,t){for(var r=e.seen,n=r.length,i;n--;)if(i=r[n],t.obj===i.obj)return i;r.push(t)}o.ify=function(t,n,i){var o={path:[],obj:t};return n?"string"==typeof n?n={soul:n}:n instanceof Function&&(n.map=n):n={},n.soul&&(o.rel=r.rel.ify(n.soul)),n.shell=(i||{}).shell,n.graph=n.graph||{},n.seen=n.seen||[],n.as=n.as||i,e(n,o),n.root=o.node,n.graph}}(),o.node=function(e){var t=n.soul(e);if(t)return h({},t,e)},function(){function e(e,t){var i,s;if(n._!==t)(i=r.rel.is(e))?(s=this.opt.seen[i])?this.obj[t]=s:this.obj[t]=this.opt.seen[i]=o.to(this.graph,i,this.opt):this.obj[t]=e;else{if(l(e,r.rel._))return;this.obj[t]=d(e)}}o.to=function(t,r,n){if(t){var i={};return n=n||{seen:{}},p(t[r],e,{obj:i,graph:t,opt:n}),i}}}();var s=t.fn.is,a=t.obj,u=a.is,c=a.del,f=a.has,l=a.empty,h=a.put,p=a.map,d=a.copy,y;e.exports=o})(i,"./graph"),i(function(e){i("./onto"),e.exports=function e(t,r){if(this.on){if(!(t instanceof Function)){if(!t||!r)return;var n=t["#"]||t,i=(this.tag||empty)[n];if(!i)return;return i=this.on(n,r),clearTimeout(i.err),!0}var n=r&&r["#"]||Math.random().toString(36).slice(2);if(!t)return n;var o=this.on(n,t,r);return o.err=o.err||setTimeout(function(){o.next({err:"Error: No ACK received yet.",lack:!0}),o.off()},(this.opt||{}).lack||9e3),n}}})(i,"./ask"),i(function(e){var t=i("./type");function r(e){var r={s:{}};return e=e||{max:1e3,age:9e3},r.check=function(e){var t;return!!(t=r.s[e])&&(t.pass?t.pass=!1:r.track(e))},r.track=function(i,o){var s=r.s[i]||(r.s[i]={});return s.was=n(),o&&(s.pass=!0),r.to||(r.to=setTimeout(function(){var i=n();t.obj.map(r.s,function(n,o){e.age>i-n.was||t.obj.del(r.s,o)}),r.to=null},e.age+9)),s},r}var n=t.time.is;e.exports=r})(i,"./dup"),i(function(e){function t(e){return e instanceof t?(this._={gun:this,$:this}).$:this instanceof t?t.create(this._={gun:this,$:this,opt:e}):new t(e)}t.is=function(e){return e instanceof t||e&&e._&&e===e._.$||!1},t.version=.9,t.chain=t.prototype,t.chain.toJSON=function(){};var r=i("./type");r.obj.to(r,t),t.HAM=i("./HAM"),t.val=i("./val"),t.node=i("./node"),t.state=i("./state"),t.graph=i("./graph"),t.on=i("./onto"),t.ask=i("./ask"),t.dup=i("./dup"),function(){function e(r){var n=this,i=n.as,o=i.at||i,s=o.$,a,u;(u=r["#"])||(u=r["#"]=c(9)),(a=o.dup).check(u)?i.out===r.out&&(r.out=S,n.to.next(r)):(a.track(u),o.ask(r["@"],r)||(r.get&&t.on.get(r,s),r.put&&t.on.put(r,s)),n.to.next(r),i.out||(r.out=e,o.on("out",r)))}t.create=function(r){r.root=r.root||r,r.graph=r.graph||{},r.on=r.on||t.on,r.ask=r.ask||t.ask,r.dup=r.dup||t.dup();var n=r.$.opt(r.opt);return r.once||(r.on("in",e,r),r.on("out",e,{at:r,out:e}),t.on("create",r),r.on("create",r)),r.once=1,n}}(),function(){function e(e,r,n,i){var o=this,s=t.state.is(n,r),a;if(!s)return o.err="Error: No state on '"+r+"' in node '"+i+"'!";var u=o.graph[i]||w,c=t.state.is(u,r,!0),f=u[r],l=t.HAM(o.machine,s,c,e,f);l.incoming?(o.put[i]=t.state.to(n,r,o.put[i]),(o.diff||(o.diff={}))[i]=t.state.to(n,r,o.diff[i]),o.souls[i]=!0):l.defer&&(o.defer=s<(o.defer||1/0)?s:o.defer)}function r(e,t){var r=this,s=r.$._,a=(s.next||w)[t];if(!a){if(!(s.opt||w).super)return void(r.souls[t]=!1);a=r.$.get(t)._}var u=r.map[t]={put:e,get:t,$:a.$},c={ctx:r,msg:u};r.async=!!s.tag.node,r.ack&&(u["@"]=r.ack),d(e,n,c),r.async&&(r.and||s.on("node",function(e){this.to.next(e),e===r.map[e.get]&&(r.souls[e.get]=!1,d(e.put,i,e),d(r.souls,function(e){if(e)return e})||r.c||(r.c=1,this.off(),d(r.map,o,r)))}),r.and=!0,s.on("node",u))}function n(e,r){var n=this.ctx,i=n.graph,o=this.msg,s=o.get,a=o.put,u=o.$._,c;i[s]=t.state.to(a,r,i[s]),n.async||(u.put=t.state.to(a,r,u.put))}function i(e,r){var n=this,i=n.put,o=n.$._;o.put=t.state.to(i,r,o.put)}function o(e,t){e.$&&(this.cat.stop=this.stop,e.$._.on("in",e),this.cat.stop=null)}t.on.put=function(n,i){var s=i._,a={$:i,graph:s.graph,put:{},map:{},souls:{},machine:t.state(),ack:n["@"],cat:s,stop:{}};if(t.graph.is(n.put,null,e,a)||(a.err="Error: Invalid graph!"),a.err)return s.on("in",{"@":n["#"],err:t.log(a.err)});d(a.put,r,a),a.async||d(a.map,o,a),S!==a.defer&&setTimeout(function(){t.on.put(n,i)},a.defer-a.machine),a.diff&&s.on("put",p(n,{put:a.diff}))},t.on.get=function(e,r){var n=r._,i=e.get,o=i[m],s=n.graph[o],a=i[b],u,c=n.next||(n.next={}),f=c[o];if(h(o,"*")){var l={};t.obj.map(n.graph,function(e,r){t.text.match(r,o)&&(l[r]=t.obj.copy(e))}),t.obj.empty(l)||n.on("in",{"@":e["#"],how:"*",put:l,$:r})}if(!s)return n.on("get",e);if(a){if(!h(s,a))return n.on("get",e);s=t.state.to(s,a)}else s=t.obj.copy(s);s=t.graph.node(s),u=(f||w).ack,n.on("in",{"@":e["#"],how:"mem",put:s,$:r}),n.on("get",e)}}(),t.chain.opt=function(e){e=e||{};var r=this,n=r._,i=e.peers||e;return l(e)||(e={}),l(n.opt)||(n.opt=e),u(i)&&(i=[i]),s(i)&&(i=d(i,function(e,t,r){r(e,{url:e})}),l(n.opt.peers)||(n.opt.peers={}),n.opt.peers=p(i,n.opt.peers)),n.opt.peers=n.opt.peers||{},p(e,n.opt),t.on("opt",n),n.opt.uuid=n.opt.uuid||function(){return g()+c(12)},r};var s=t.list.is,a=t.text,u=a.is,c=a.random,f=t.obj,l=f.is,h=f.has,p=f.to,d=f.map,y=f.copy,g=t.state.lex,m=t.val.rel._,b=".",v=t.node._,_=t.val.link.is,w={},S;n.debug=function(e,t){return n.debug.i&&e===n.debug.i&&n.debug.i++&&(n.log.apply(n,arguments)||t)},t.log=function(){return!t.log.off&&n.log.apply(n,arguments),[].slice.call(arguments).join(" ")},t.log.once=function(e,r,n){return(n=t.log.once)[e]=n[e]||0,n[e]++||t.log(r)},t.log.once("welcome","Hello wonderful person! :) Thanks for using GUN, feel free to ask for help on https://gitter.im/amark/gun and ask StackOverflow questions tagged with 'gun'!"),"undefined"!=typeof window&&((window.Gun=t).window=window);try{void 0!==o&&(o.exports=t)}catch(e){}e.exports=t})(i,"./root"),i(function(e){var t=i("./root");t.chain.back=function(e,i){var o;if(e=e||1,-1===e||1/0===e)return this._.root.$;if(1===e)return(this._.back||this._).$;var s=this,a=s._;if("string"==typeof e&&(e=e.split(".")),e instanceof Array){for(var u=0,c=e.length,o=a;u<c;u++)o=(o||r)[e[u]];return n!==o?i?s:o:(o=a.back)?o.$.back(e,i):void 0}if(e instanceof Function){for(var f,o={back:a};(o=o.back)&&n===(f=e(o,i)););return f}return t.num.is(e)?(a.back||a).$.back(e-1):this};var r={},n})(i,"./back"),i(function(e){var t=i("./root");function r(e){var r,n,i=this.as,o=i.back,s=i.root,a;if(e.I||(e.I=i.$),e.$||(e.$=i.$),this.to.next(e),n=e.get){if(n["#"]||i.soul){if(n["#"]=n["#"]||i.soul,e["#"]||(e["#"]=w(9)),o=s.$.get(n["#"])._,n=n["."]){if(g(o.put,n)&&(r=o.$.get(n)._,(a=r.ack)||(r.ack=-1),o.on("in",{$:o.$,put:t.state.to(o.put,n),get:o.get}),a))return}else{if(a=o.ack,a||(o.ack=-1),g(o,"put")&&o.on("in",o),a)return;e.$=o.$}return s.ask(h,e),s.on("in",e)}if(s.now&&(s.now[i.id]=s.now[i.id]||!0,i.pass={}),n["."])return i.get?(e={get:{".":i.get},$:i.$},o.ask||(o.ask={}),o.ask[i.get]=e.$._,o.on("out",e)):(e={get:{},$:i.$},o.on("out",e));if(i.ack=i.ack||-1,i.get)return e.$=i.$,n["."]=i.get,(o.ask||(o.ask={}))[i.get]=e.$._,o.on("out",e)}return o.on("out",e)}function n(e){var r=this,n=r.as,i=n.root,o=e.$,u=(o||p)._||p,l=e.put,h,y;if(n.get&&e.get!==n.get&&(e=v(e,{get:n.get})),n.has&&u!==n&&(e=v(e,{$:n.$}),u.ack&&(n.ack=u.ack)),d===l){if(y=u.put,r.to.next(e),n.soul)return;if(d===y&&d!==u.put)return;return a(n,e,r),n.has&&f(n,e),b(u.echo,n.id),void b(n.map,u.id)}if(n.soul)return r.to.next(e),a(n,e,r),void(n.next&&_(l,c,{msg:e,cat:n}));if(!(h=t.val.link.is(l)))return t.val.is(l)?(n.has||n.soul?f(n,e):(u.has||u.soul)&&((u.echo||(u.echo={}))[n.id]=u.echo[u.id]||n,(n.map||(n.map={}))[u.id]=n.map[u.id]||{at:u}),r.to.next(e),void a(n,e,r)):(n.has&&u!==n&&g(u,"put")&&(n.put=u.put),(h=t.node.soul(l))&&u.has&&(u.put=n.root.$.get(h)._.put),y=(i.stop||{})[u.id],r.to.next(e),s(n,e,u,h),a(n,e,r),void(n.next&&_(l,c,{msg:e,cat:n})));var m=i.stop;y=i.stop||{},y=y[u.id]||(y[u.id]={}),y.is=y.is||u.put,y[n.id]=u.put||!0,r.to.next(e),s(n,e,u,h),a(n,e,r)}t.chain.chain=function(e){var i=this,o=i._,s=new(e||i).constructor(i),a=s._,u;return a.root=u=o.root,a.id=++u.once,a.back=i._,a.on=t.on,a.on("in",n,a),a.on("out",r,a),s};var o=0;function s(e,r,n,i){if(i&&k!==e.get){var o=e.root.$.get(i)._;e.has?n=o:n.has&&s(n,r,n,i),n!==e&&(n.$||(n={}),(n.echo||(n.echo={}))[e.id]=n.echo[e.id]||e,e.has&&!(e.map||p)[n.id]&&f(e,r),o=n.id?(e.map||(e.map={}))[n.id]=e.map[n.id]||{at:n}:{},(i!==o.link||o.pass||e.pass)&&(e.pass&&(t.obj.map(e.map,function(e){e.pass=!0}),b(e,"pass")),o.pass&&b(o,"pass"),e.has&&(e.link=i),l(e,o.link=i)))}}function a(e,t,r){e.echo&&_(e.echo,u,t)}function u(e){e&&e.on&&e.on("in",this)}function c(e,r){var n=this.cat,i=n.next||p,o=this.msg,s,a,u;(k!==r||i[r])&&(a=i[r])&&(a.has?(d!==a.put&&t.val.link.is(e)||(a.put=e),s=a.$):(u=o.$)&&(u=(s=o.$.get(r))._,d!==u.put&&t.val.link.is(e)||(u.put=e)),a.on("in",{put:e,get:r,$:s,via:o}))}function f(e,r){if(e.has||e.soul){var n=e.map,i=e.root;e.map=null,e.has&&(e.link=null),(e.pass||r["@"]||null!==n)&&(d===n&&t.val.link.is(e.put)||(_(n,function(t){(t=t.at)&&b(t.echo,e.id)}),n=e.put,_(e.next,function(t,r){if(d===n&&d!==e.put)return!0;t.put=d,t.ack&&(t.ack=-1),t.on("in",{get:r,$:t.$,put:d})})))}}function l(e,r){var n=e.root.$.get(r)._;e.ack&&(n.on("out",{get:{"#":r}}),!e.ask)||(n=e.ask,t.obj.del(e,"ask"),_(n||e.next,function(e,t){e.on("out",{get:{"#":r,".":t}})}),t.obj.del(e,"ask"))}function h(e,r){var n=this.as,i=n.get||p,o=n.$._,s=(e.put||p)[i["#"]];if(o.ack&&(o.ack=o.ack+1||1),!e.put||i["."]&&!g(s,o.get)){if(o.put!==d)return;o.on("in",{get:o.get,put:o.put=d,$:o.$,"@":e["@"]})}else k!=i["."]?(e.$=o.root.$,t.on.put(e,o.root.$)):o.on("in",{get:o.get,put:t.val.link.ify(i["#"]),$:o.$,"@":e["@"]})}var p={},d,y=t.obj,g=y.has,m=y.put,b=y.del,v=y.to,_=y.map,w=t.text.random,S=t.val.rel._,k=t.node._})(i,"./chain"),i(function(e){var t=i("./root");function r(e,t){var r=t._,n=r.next,i=t.chain(),o=i._;return n||(n=r.next={}),n[o.get=e]=o,t===r.root.$?o.soul=e:(r.soul||r.has)&&(o.has=e),o}function n(e,t,r,n){var i=e._,o;return(o=i.soul)?(t(o,n,i),e):(o=i.link)?(t(o,n,i),e):(e.get(function(e,r){r.rid(e);var i=(i=e.$)&&i._||{};o=i.link||i.soul||l.is(e.put)||h(e.put),t(o,n,e,r)},{out:{get:{".":!0}}}),e)}function o(e){var t=this,r=t.as,n=r.at,i=n.root,o=e.$,s=(o||{})._||{},a=e.put||s.put,u;if((u=i.now)&&t!==u[r.now])return t.to.next(e);if(t.seen&&s.id&&t.seen[s.id])return t.to.next(e);if((u=a)&&u[l._]&&(u=l.is(u))&&(u=(e.$$=s.root.gun.get(u))._,y!==u.put&&(e=c(e,{put:a=u.put}))),(u=i.mum)&&s.id){if(u[s.id])return;y===a||l.is(a)||(u[s.id]=!0)}r.use(e,t),t.stun?t.stun=null:t.to.next(e)}function s(e){var t=this.on;if(!e||t.soul||t.has)return this.off();if(e=(e=(e=e.$||e)._||e).id){var r=t.map,n,i;if(n=(i=this.seen||(this.seen={}))[e])return!0;i[e]=!0}}t.chain.get=function(e,i,a){var u,c;if("string"!=typeof e){if(e instanceof Function){if(!0===i)return n(this,e,i,a);u=this;var h=u._,p=h.root,c=p.now,y;a=i||{},a.at=h,a.use=e,a.out=a.out||{},a.out.get=a.out.get||{},(y=h.on("in",o,a)).rid=s,(p.now={$:1})[a.now=h.id]=y;var g=p.mum;return p.mum={},h.on("out",a.out),p.mum=g,p.now=c,u}return f(e)?this.get(""+e,i,a):(c=l.is(e))?this.get(c,i,a):((a=this.chain())._.err={err:t.log("Invalid get request!",e)},i&&i.call(a,a._.err),a)}var m=this,b=this._,v=b.next||d;return(u=v[e])||(u=r(e,this)),u=u.$,(c=b.stun)&&(u._.stun=u._.stun||c),i&&i instanceof Function&&u.get(i,a),u};var a=t.obj,u=a.has,c=t.obj.to,f=t.num.is,l=t.val.link,h=t.node.soul,p=t.node._,d={},y})(i,"./get"),i(function(e){var t=i("./root");function r(e){e.batch=s;var r=e.opt||{},n=e.env=t.state.map(u,r.state);if(n.soul=e.soul,e.graph=t.graph.ify(e.data,n,e),n.err)return(e.ack||b).call(e,e.out={err:t.log(n.err)}),void(e.res&&e.res());e.batch()}function o(e){var t;e&&e()}function s(){var e=this;e.graph&&!y(e.stun,a)&&(e.res=e.res||function(e){e&&e()},e.res(function(){var r=e.$.back(-1)._,n=r.ask(function(n){r.root.on("ack",n),n.err&&t.log(n),n.lack||this.off(),e.ack&&e.ack(n,this)},e.opt),i=r.root.now;h.del(r.root,"now");var o=r.root.mum;r.root.mum={},e.ref._.on("out",{$:e.ref,put:e.out=e.env.graph,opt:e.opt,"#":n}),r.root.mum=o?h.to(o,r.root.mum):o,r.root.now=i},e),e.res&&e.res())}function a(e,t){if(e)return!0}function u(e,r,n,i){var o=this,s=t.is(e);!r&&i.path.length&&(o.res||v)(function(){for(var r=i.path,n=o.ref,a=o.opt,u=0,f=r.length;u<f;u++)n=n.get(r[u]);s&&(n=e);var l=n._.dub;if(l||(l=t.node.soul(i.obj)))return n.back(-1).get(l),void i.soul(l);(o.stun=o.stun||{})[r]=!0,n.get(c,!0,{as:{at:i,as:o,p:r}})},{as:o,at:i})}function c(e,r,n,i){var r=r.as,o=r.at;r=r.as;var s=((n||{}).$||{})._||{};e=s.dub=s.dub||e||t.node.soul(o.obj)||t.node.soul(n.put||s.put)||t.val.rel.is(n.put||s.put)||(r.via.back("opt.uuid")||t.text.random)(),i&&(i.stun=!0),e?f(s,s.dub=e,o,r):s.via.back("opt.uuid")(function(e,n){if(e)return t.log(e);f(s,s.dub=s.dub||n,o,r)})}function f(e,t,r,n){e.$.back(-1).get(t),r.soul(t),n.stun[r.path]=!1,n.batch()}function l(e,r,i,o){if(r=r.as,i.$&&i.$._)if(i.err)n.log("Please report this as an issue! Put.any.err");else{var s=i.$._,a=s.put,u=r.opt||{},c,f;if(!(f=r.ref)||!f._.now){if(o&&(o.stun=!0),r.ref!==r.$){if(f=r.$._.get||s.get,!f)return void n.log("Please report this as an issue! Put.no.get");r.data=d({},f,r.data),f=null}if(g===a){if(!s.get)return;e||(f=s.$.back(function(e){if(e.link||e.soul)return e.link||e.soul;r.data=d({},e.get,r.data)})),f=f||s.get,s=s.root.$.get(f)._,r.soul=f,a=r.data}r.not||(r.soul=r.soul||e)||(r.path&&p(r.data)?r.soul=(u.uuid||r.via.back("opt.uuid")||t.text.random)():(_==s.get&&(r.soul=(s.put||m)["#"]||s.dub),r.soul=r.soul||s.soul||s.soul||(u.uuid||r.via.back("opt.uuid")||t.text.random)()),r.soul)?r.ref.put(r.data,r.soul,r):r.via.back("opt.uuid")(function(e,n){if(e)return t.log(e);r.ref.put(r.data,r.soul=n,r)})}}}t.chain.put=function(e,n,i){var s=this,a=s._,u=a.root.$,c;return i=i||{},i.data=e,i.via=i.$=i.via||i.$||s,"string"==typeof n?i.soul=n:i.ack=i.ack||n,a.soul&&(i.soul=a.soul),i.soul||u===s?p(i.data)?(i.soul=i.soul||(i.not=t.node.soul(i.data)||(i.via.back("opt.uuid")||t.text.random)()),i.soul?(i.$=s=u.get(i.soul),i.ref=i.$,r(i),s):(i.via.back("opt.uuid")(function(e,r){if(e)return t.log(e);(i.ref||i.$).put(i.data,i.soul=r,i)}),s)):((i.ack||b).call(i,i.out={err:t.log("Data saved to the root level of the graph must be a node (an object), not a",typeof i.data,'of "'+i.data+'"!')}),i.res&&i.res(),s):t.is(e)?(e.get(function(e,r,o){if(!e&&t.val.is(o.put))return t.log("The reference you are saving is a",typeof o.put,'"'+o.put+'", not a node (object)!');s.put(t.val.rel.ify(e),n,i)},!0),s):(i.ref=i.ref||u._===(c=a.back)?s:c.$,i.ref._.soul&&t.val.is(i.data)&&a.get?(i.data=d({},a.get,i.data),i.ref.put(i.data,i.soul,i),s):(i.ref.get(l,!0,{as:i}),i.out||(i.res=i.res||o,i.$._.stun=i.ref._.stun),s))};var h=t.obj,p=h.is,d=h.put,y=h.map,g,m={},b=function(){},v=function(e,t){e.call(t||m)},_=t.node._})(i,"./put"),i(function(e){var t=i("./root");i("./chain"),i("./back"),i("./put"),i("./get"),e.exports=t})(i,"./index"),i(function(e){var t=i("./index");function r(e,t){var r=this,n=e.$,i=(n||{})._||{},o=i.put||e.put,s=r.at,a;if(h!==o){if(a=e.$$){if(a=e.$$._,h===a.put)return;o=a.put}r.change&&(o=e.put),r.as?r.ok.call(r.as,e,t):r.ok.call(n,o,e.get,e,t)}}function n(e,t,r){var i=this.as,o=i.at,s=e.$,a=s._,u=a.put||e.put,c,f;if(f=e.$$){if(c=f=e.$$._,h===f.put)return;u=f.put}(f=t.wait)&&(f=f[a.id])&&clearTimeout(f),r||h!==u&&!a.soul&&!a.link&&(!c||0<c.ack)?(t.rid(e),i.ok.call(s||i.$,u,e.get)):f=(t.wait={})[a.id]=setTimeout(function(){n.call({as:i},e,t,f||1)},i.wait||99)}t.chain.on=function(e,t,n,i){var o=this,s=o._,a,u,c;if("string"==typeof e)return t?(u=s.on(e,t,n||s,i),n&&n.$&&(n.subs||(n.subs=[])).push(u),o):s.on(e);var f=t;return f=!0===f?{change:!0}:f||{},f.at=s,f.ok=e,o.get(r,f),o},t.chain.val=function(e,r){return t.log.once("onceval","Future Breaking API Change: .val -> .once, apologies unexpected."),this.once(e,r)},t.chain.once=function(e,r){var i=this,o=i._,s=o.put;if(0<o.ack&&h!==s)return(e||l).call(i,s,o.get),i;if(!e){t.log.once("valonce","Chainable val is experimental, its behavior and API may change moving forward. Please play with it and report bugs and ideas on how to improve it.");var a=i.chain();return a._.nix=i.once(function(){a._.on("in",i._)}),a}return(r=r||{}).ok=e,r.at=o,r.out={"#":t.text.random(9)},i.get(n,{as:r}),r.async=!0,i},t.chain.off=function(){var e=this,t=e._,r,n=t.back;if(n)return(r=n.next)&&r[t.get]&&u(r,t.get),(r=n.ask)&&u(r,t.get),(r=n.put)&&u(r,t.get),(r=t.soul)&&u(n.root.graph,r),(r=t.map)&&s(r,function(e){e.link&&n.root.$.get(e.link).off()}),(r=t.next)&&s(r,function(e){e.$.off()}),t.on("off",{}),e};var o=t.obj,s=o.map,a=o.has,u=o.del,c=o.to,f=t.val.link,l=function(){},h})(i,"./on"),i(function(e){var t=i("./index");function r(e){if(!e.put||t.val.is(e.put))return this.to.next(e);this.as.nix&&this.off(),o(e.put,n,{at:this.as,msg:e}),this.to.next(e)}function n(e,t){if(c!==t){var r=this.msg,n=r.$,i=this.at,o=n.get(t)._;(o.echo||(o.echo={}))[i.id]=o.echo[i.id]||i}}t.chain.map=function(e,n,i){var o=this,a=o._,u;return e?(t.log.once("mapfn","Map functions are experimental, their behavior and API may change moving forward. Please play with it and report bugs and ideas on how to improve it."),u=o.chain(),o.map().on(function(r,n,i,o){var a=(e||s).call(this,r,n,i,o);if(f!==a)return r===a?u._.on("in",i):t.is(a)?u._.on("in",a._):void u._.on("in",{get:n,put:a})}),u):(u=a.each)?u:(a.each=u=o.chain(),u._.nix=o.back("nix"),o.on("in",r,u._),u)};var o=t.obj.map,s=function(){},a=s,u=s,c=t.node._,f})(i,"./map"),i(function(e){var t=i("./index");t.chain.set=function(e,r,n){var i=this,o;if(r=r||function(){},n=n||{},n.item=n.item||e,o=t.node.soul(e))return i.set(i.back(-1).get(o),r,n);if(!t.is(e)){var s=i.back("opt.uuid")();return s&&t.obj.is(e)?i.set(i._.root.$.put(e,s),r,n):i.get(t.state.lex()+t.text.random(7)).put(e,r,n)}return e.get(function(e,o,s){if(!e)return r.call(i,{err:t.log('Only a node can be linked! Not "'+s.put+'"!')});i.put(t.obj.put({},e,t.val.link.ify(e)),r,n)},!0),e}})(i,"./set"),i(function(e){if("undefined"!=typeof Gun){var t,r=function(){},n;"undefined"!=typeof window&&(t=window);var i=t.localStorage||{setItem:r,removeItem:r,getItem:r};Gun.on("create",function(e){var t=this.to,r=e.opt;if(e.once)return t.next(e);r.prefix=r.file||"gun/";var n=Gun.obj.ify(i.getItem("gap/"+r.prefix))||{},o=Gun.obj.empty,s,a,u;if(!o(n)){var c=Gun.obj.ify(i.getItem(r.prefix))||{},f={};Gun.obj.map(n,function(e,t){Gun.obj.map(e,function(e,r){f[t]=Gun.state.to(c[t],r,f[t])})}),setTimeout(function(){e.on("out",{put:f,"#":e.ask(l),I:e.$})},1)}function l(e){if(!e.err&&e.ok){var t=e["@"];setTimeout(function(){Gun.obj.map(n,function(e,r){Gun.obj.map(e,function(r,n){t===r&&delete e[n]}),o(e)&&delete n[r]}),p()},r.wait||1)}}e.on("out",function(e){e.lS||(e.I&&e.put&&!e["@"]&&!o(r.peers)&&(s=e["#"],Gun.graph.is(e.put,null,h),a||(a=setTimeout(p,r.wait||1))),this.to.next(e))}),e.on("ack",l),t.next(e);var h=function(e,t,r,i){(n[i]||(n[i]={}))[t]=s},p=function(){clearTimeout(a),a=!1;try{i.setItem("gap/"+r.prefix,JSON.stringify(n))}catch(e){Gun.log(err=e||"localStorage failure")}}}),Gun.on("create",function(e){this.to.next(e);var t=e.opt;if(!e.once&&!1!==t.localStorage){t.prefix=t.file||"gun/";var r=e.graph,n={},o=0,s,a=Gun.obj.ify(i.getItem(t.prefix))||{},u=function(){},c;e.on("localStorage",a),e.on("put",function(e){if(this.to.next(e),Gun.graph.is(e.put,null,f),e["@"]||(n[e["#"]]=!0),o+=1,o>=(t.batch||1e3))return l();s||(s=setTimeout(l,t.wait||1))}),e.on("get",function(r){this.to.next(r);var n=r.get,i,o,s;function u(){if(n&&(i=n["#"])){var u=n["."];o=a[i]||s,o&&u&&(o=Gun.state.to(o,u)),(o||Gun.obj.empty(t.peers))&&e.on("in",{"@":r["#"],put:Gun.graph.node(o),how:"lS",lS:r.I})}}Gun.debug?setTimeout(u,1):u()});var f=function(e,t,r,n){a[n]=Gun.state.to(r,t,a[n])},l=function(r){var u;o=0,clearTimeout(s),s=!1;var c=n;n={},r&&(a=r);try{i.setItem(t.prefix,JSON.stringify(a))}catch(r){Gun.log(u=r||"localStorage failure"),e.on("localStorage:error",{err:u,file:t.prefix,flush:a,retry:l})}(u||Gun.obj.empty(t.peers))&&Gun.obj.map(c,function(t,r){e.on("in",{"@":r,err:u,ok:0})})}}})}})(i,"./adapters/localStorage"),i(function(e){var t=i("../type");function r(e){var i=function(){},a=e.opt;return i.out=function(t){var r;if(this.to&&this.to.next(t),(r=t["@"])&&(r=e.dup.s[r])&&(r=r.it)&&r.mesh)return i.say(t,r.mesh.via,1),void(r["##"]=t["##"]);i.say(t)},e.on("create",function(r){r.opt.pid=r.opt.pid||t.text.random(9),this.to.next(r),e.on("out",i.out)}),i.hear=function(r,o){if(r){var s=e.dup,a,u,c,f=r[0];try{c=JSON.parse(r)}catch(e){n.log("DAM JSON parse error",e)}if("{"===f){if(!c)return;if(s.check(a=c["#"]))return;if(s.track(a,!0).it=c,(f=c["@"])&&c.put&&(u=c["##"]||(c["##"]=i.hash(c)),(f+=u)!=a)){if(s.check(f))return;(f=s.s)[u]=f[a]}return(c.mesh=function(){}).via=o,(f=c["><"])&&(c.mesh.to=t.obj.map(f.split(","),function(e,t,r){r(e,!0)})),c.dam?void((f=i.hear[c.dam])&&f(c,o,e)):void e.on("in",c)}if("["!==f);else{if(!c)return;for(var l=0,h;h=c[l++];)i.hear(h,o)}}},function(){function r(e,t){var r=t.wire;try{r.send?r.send(e):t.say&&t.say(e)}catch(r){(t.queue=t.queue||[]).push(e)}}i.say=function(n,s,u){if(s){var c,f=s.wire||a.wire&&a.wire(s),l,h;f&&(l=n.mesh||o,s!==l.via&&((h=l.raw)||(h=i.raw(n)),(c=n["@"])&&(c=e.dup.s[c])&&(c=c.it)&&c.get&&c["##"]&&c["##"]===n["##"]||(c=l.to)&&(c[s.url]||c[s.id])&&!u||(s.batch?s.batch.push(h):(s.batch=[],setTimeout(function(){var e=s.batch;e&&(s.batch=null,e.length&&r(JSON.stringify(e),s))},a.gap||a.wait||1),r(h,s)))))}else t.obj.map(a.peers,function(e){i.say(n,e)})}}(),function(){function n(e,r){var n;return r instanceof Object?(t.obj.map(Object.keys(r).sort(),o,{to:n={},on:r}),n):r}function o(e){this.to[e]=this.on[e]}i.raw=function(r){if(!r)return"";var o=e.dup,f=r.mesh||{},l,h,p;if(p=f.raw)return p;if("string"==typeof r)return r;r["@"]&&(p=r.put)&&((h=r["##"])||(l=u(p,n)||"",h=i.hash(r,l),r["##"]=h),(p=o.s)[h=r["@"]+h]=p[r["#"]],r["#"]=h||r["#"],l&&((r=t.obj.to(r)).put=c));var d=0,y=[];t.obj.map(a.peers,function(e){if(y.push(e.url||e.id),++d>9)return!0}),r["><"]=y.join();var g=u(r);return s!==l&&(p=g.indexOf(c,g.indexOf("put")),g=g.slice(0,p-1)+l+g.slice(p+c.length+1)),f&&(f.raw=g),g},i.hash=function(e,i){return r.hash(i||u(e.put,n)||"")||e["#"]||t.text.random(9)};var u=JSON.stringify,c=":])([:"}(),i.hi=function(r){var n=r.wire||{};r.id||r.url?(a.peers[r.url||r.id]=r,t.obj.del(a.peers,n.id)):(n=n.id=n.id||t.text.random(9),i.say({dam:"?"},a.peers[n]=r)),n.hied||e.on(n.hied="hi",r),n=r.queue,r.queue=[],t.obj.map(n,function(e){i.say(e,r)})},i.bye=function(r){t.obj.del(a.peers,r.id),e.on("bye",r)},i.hear["?"]=function(e,t){if(!e.pid)return i.say({dam:"?",pid:a.pid,"@":e["#"]},t);t.id=t.id||e.pid,i.hi(t)},i}r.hash=function(e){if("string"!=typeof e)return{err:1};var t=0;if(!e.length)return t;for(var r=0,n=e.length,i;r<n;++r)i=e.charCodeAt(r),t=(t<<5)-t+i,t|=0;return t};var o={},s;Object.keys=Object.keys||function(e){return map(e,function(e,t,r){r(t)})};try{e.exports=r}catch(e){}})(i,"./adapters/mesh"),i(function(t){var r=i("../index");r.Mesh=i("./mesh"),r.on("opt",function(t){this.to.next(t);var n=t.opt;if(!t.once&&!1!==n.WebSocket){var i;"undefined"!=typeof window&&(i=window),void 0!==e&&(i=e),i=i||{};var o=n.WebSocket||i.WebSocket||i.webkitWebSocket||i.mozWebSocket;if(o){n.WebSocket=o;var s=n.mesh=n.mesh||r.Mesh(t),a=n.wire;n.wire=u}}function u(e){if(!e||!e.url)return r&&r(e);var t=e.url.replace("http","ws"),r=e.wire=new n.WebSocket(t);return r.onclose=function(){n.mesh.bye(e),c(e)},r.onerror=function(t){c(e),t&&t.code},r.onopen=function(){n.mesh.hi(e)},r.onmessage=function(t){t&&n.mesh.hear(t.data||t,e)},r}function c(e){clearTimeout(e.defer),e.defer=setTimeout(function(){u(e)},2e3)}});var n=function(){}})(i,"./adapters/websocket")}()}).call(this,r(7),r(28)(e))},function(e,t,r){const n=r(103);r(619),r(627),r(1429),r(1458),r(1528),"undefined"!=typeof window&&(window.DwebTransports=n),t=e.exports=n},function(e,t,r){(function(e,n){var i;/*! https://mths.be/punycode v1.4.1 by @mathias */!function(o){var s="object"==typeof t&&t&&!t.nodeType&&t,a="object"==typeof e&&e&&!e.nodeType&&e,u="object"==typeof n&&n;u.global!==u&&u.window!==u&&u.self!==u||(o=u);var c,f=2147483647,l=36,h=1,p=26,d=38,y=700,g=72,m=128,b="-",v=/^xn--/,_=/[^\x20-\x7E]/,w=/[\x2E\u3002\uFF0E\uFF61]/g,S={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},k=l-h,E=Math.floor,A=String.fromCharCode,x;function I(e){throw new RangeError(S[e])}function T(e,t){for(var r=e.length,n=[];r--;)n[r]=t(e[r]);return n}function B(e,t){var r=e.split("@"),n="";r.length>1&&(n=r[0]+"@",e=r[1]),e=e.replace(w,".");var i=e.split("."),o=T(i,t).join(".");return n+o}function C(e){for(var t=[],r=0,n=e.length,i,o;r<n;)i=e.charCodeAt(r++),i>=55296&&i<=56319&&r<n?(o=e.charCodeAt(r++),56320==(64512&o)?t.push(((1023&i)<<10)+(1023&o)+65536):(t.push(i),r--)):t.push(i);return t}function P(e){return T(e,function(e){var t="";return e>65535&&(e-=65536,t+=A(e>>>10&1023|55296),e=56320|1023&e),t+=A(e),t}).join("")}function O(e){return e-48<10?e-22:e-65<26?e-65:e-97<26?e-97:l}function R(e,t){return e+22+75*(e<26)-((0!=t)<<5)}function N(e,t,r){var n=0;for(e=r?E(e/y):e>>1,e+=E(e/t);e>k*p>>1;n+=l)e=E(e/k);return E(n+(k+1)*e/(e+d))}function L(e){var t=[],r=e.length,n,i=0,o=m,s=g,a,u,c,d,y,v,_,w,S;for(a=e.lastIndexOf(b),a<0&&(a=0),u=0;u<a;++u)e.charCodeAt(u)>=128&&I("not-basic"),t.push(e.charCodeAt(u));for(c=a>0?a+1:0;c<r;){for(d=i,y=1,v=l;c>=r&&I("invalid-input"),_=O(e.charCodeAt(c++)),(_>=l||_>E((f-i)/y))&&I("overflow"),i+=_*y,w=v<=s?h:v>=s+p?p:v-s,!(_<w);v+=l)S=l-w,y>E(f/S)&&I("overflow"),y*=S;n=t.length+1,s=N(i-d,n,0==d),E(i/n)>f-o&&I("overflow"),o+=E(i/n),i%=n,t.splice(i++,0,o)}return P(t)}function j(e){var t,r,n,i,o,s,a,u,c,d,y,v=[],_,w,S,k;for(e=C(e),_=e.length,t=m,r=0,o=g,s=0;s<_;++s)y=e[s],y<128&&v.push(A(y));for(n=i=v.length,i&&v.push(b);n<_;){for(a=f,s=0;s<_;++s)y=e[s],y>=t&&y<a&&(a=y);for(w=n+1,a-t>E((f-r)/w)&&I("overflow"),r+=(a-t)*w,t=a,s=0;s<_;++s)if(y=e[s],y<t&&++r>f&&I("overflow"),y==t){for(u=r,c=l;d=c<=o?h:c>=o+p?p:c-o,!(u<d);c+=l)k=u-d,S=l-d,v.push(A(R(d+k%S,0))),u=E(k/S);v.push(A(R(u,0))),o=N(r,w,n==i),r=0,++n}++r,++t}return v.join("")}function M(e){return B(e,function(e){return v.test(e)?L(e.slice(4).toLowerCase()):e})}function K(e){return B(e,function(e){return _.test(e)?"xn--"+j(e):e})}c={version:"1.4.1",ucs2:{decode:C,encode:P},decode:L,encode:j,toASCII:K,toUnicode:M},i=function(){return c}.call(t,r,t,e),void 0===i||(e.exports=i)}(this)}).call(this,r(28)(e),r(7))},function(e,t,r){"use strict";e.exports={isString:function(e){return"string"==typeof e},isObject:function(e){return"object"==typeof e&&null!==e},isNull:function(e){return null===e},isNullOrUndefined:function(e){return null==e}}},function(e,t,r){"use strict";function n(e,t){return Object.prototype.hasOwnProperty.call(e,t)}e.exports=function(e,t,r,o){t=t||"&",r=r||"=";var s={};if("string"!=typeof e||0===e.length)return s;var a=/\+/g;e=e.split(t);var u=1e3;o&&"number"==typeof o.maxKeys&&(u=o.maxKeys);var c=e.length;u>0&&c>u&&(c=u);for(var f=0;f<c;++f){var l=e[f].replace(a,"%20"),h=l.indexOf(r),p,d,y,g;h>=0?(p=l.substr(0,h),d=l.substr(h+1)):(p=l,d=""),y=decodeURIComponent(p),g=decodeURIComponent(d),n(s,y)?i(s[y])?s[y].push(g):s[y]=[s[y],g]:s[y]=g}return s};var i=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)}},function(e,t,r){"use strict";var n=function(e){switch(typeof e){case"string":return e;case"boolean":return e?"true":"false";case"number":return isFinite(e)?e:"";default:return""}};e.exports=function(e,t,r,a){return t=t||"&",r=r||"=",null===e&&(e=void 0),"object"==typeof e?o(s(e),function(s){var a=encodeURIComponent(n(s))+r;return i(e[s])?o(e[s],function(e){return a+encodeURIComponent(n(e))}).join(t):a+encodeURIComponent(n(e[s]))}).join(t):a?encodeURIComponent(n(a))+r+encodeURIComponent(n(e)):""};var i=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)};function o(e,t){if(e.map)return e.map(t);for(var r=[],n=0;n<e.length;n++)r.push(t(e[n],n));return r}var s=Object.keys||function(e){var t=[];for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.push(r);return t}},function(e,t,r){function n(e){var r=0,n;for(n in e)r=(r<<5)-r+e.charCodeAt(n),r|=0;return t.colors[Math.abs(r)%t.colors.length]}function i(e){var r;function i(){if(i.enabled){var e=i,n=+new Date,o=n-(r||n);e.diff=o,e.prev=r,e.curr=n,r=n;for(var s=new Array(arguments.length),a=0;a<s.length;a++)s[a]=arguments[a];s[0]=t.coerce(s[0]),"string"!=typeof s[0]&&s.unshift("%O");var u=0;s[0]=s[0].replace(/%([a-zA-Z%])/g,function(r,n){if("%%"===r)return r;u++;var i=t.formatters[n];if("function"==typeof i){var o=s[u];r=i.call(e,o),s.splice(u,1),u--}return r}),t.formatArgs.call(e,s);var c=i.log||t.log||console.log.bind(console);c.apply(e,s)}}return i.namespace=e,i.enabled=t.enabled(e),i.useColors=t.useColors(),i.color=n(e),i.destroy=o,"function"==typeof t.init&&t.init(i),t.instances.push(i),i}function o(){var e=t.instances.indexOf(this);return-1!==e&&(t.instances.splice(e,1),!0)}function s(e){var r;t.save(e),t.names=[],t.skips=[];var n=("string"==typeof e?e:"").split(/[\s,]+/),i=n.length;for(r=0;r<i;r++)n[r]&&(e=n[r].replace(/\*/g,".*?"),"-"===e[0]?t.skips.push(new RegExp("^"+e.substr(1)+"$")):t.names.push(new RegExp("^"+e+"$")));for(r=0;r<t.instances.length;r++){var o=t.instances[r];o.enabled=t.enabled(o.namespace)}}function a(){t.enable("")}function u(e){if("*"===e[e.length-1])return!0;var r,n;for(r=0,n=t.skips.length;r<n;r++)if(t.skips[r].test(e))return!1;for(r=0,n=t.names.length;r<n;r++)if(t.names[r].test(e))return!0;return!1}function c(e){return e instanceof Error?e.stack||e.message:e}t=e.exports=i.debug=i.default=i,t.coerce=c,t.disable=a,t.enable=s,t.enabled=u,t.humanize=r(206),t.instances=[],t.names=[],t.skips=[],t.formatters={}},function(e,t,r){const n=r(118),i=r(103),o=r(332),s=r(36),a=r(21),u=r(1)("dweb-transports:http");defaulthttpoptions={urlbase:"https://dweb.me:443"},servercommands={rawfetch:"contenthash",rawstore:"contenturl/rawstore",rawadd:"void/rawadd",rawlist:"metadata/rawlist",get:"get/table",set:"set/table",delete:"delete/table",keys:"keys/table",getall:"getall/table"};class c extends n{constructor(e){super(e),this.options=e,this.urlbase=e.http.urlbase,this.supportURLs=["contenthash","http","https"],this.supportFunctions=["fetch","store","add","list","reverse","newlisturls","get","set","keys","getall","delete","newtable","newdatabase"],this.supportFeatures=["fetch.range"],this.name="HTTP",this.status=n.STATUS_LOADED}static setup0(e){let t=n.mergeoptions({http:defaulthttpoptions},e);try{let e=new c(t);return i.addtransport(e),e}catch(e){throw console.error("HTTP unable to setup0",e.message),e}}async p_setup1(e){return this.status=n.STATUS_STARTING,e&&e(this),await this.p_status(),e&&e(this),this}async p_status(){try{this.info=await this.p_info(),this.status=n.STATUS_CONNECTED}catch(e){console.error(this.name,": Error in p_status.info",e.message),this.status=n.STATUS_FAILED}return super.p_status()}_cmdurl(e){return`${this.urlbase}/${e}`}_url(e,t,r){if(!e)throw new errors.CodingError(`${t}: requires url`);return"string"!=typeof e&&(e=e.href),e=e.replace("contenthash:/contenthash",this._cmdurl(t)),e=e.replace("getall/table",t),e+=r?"?"+r:"",e}async p_rawfetch(e,t={}){if(("string"==typeof e?e:e.href).includes("/getall/table"))throw new Error("Probably dont want to be calling p_rawfetch on a KeyValueTable, especially since dont know if its keyvaluetable or subclass");return await o.p_GET(this._url(e,servercommands.rawfetch),t)}p_rawlist(e){if(!e)throw new errors.CodingError("TransportHTTP.p_rawlist: requires url");return o.p_GET(this._url(e,servercommands.rawlist))}rawreverse(){throw new errors.ToBeImplementedError("Undefined function TransportHTTP.rawreverse")}async p_rawstore(e){console.assert(e,"TransportHttp.p_rawstore: requires data");let t=await o.p_POST(this._cmdurl(servercommands.rawstore),"application/octet-stream",e),r=s.parse(t),n=r.pathname.split("/");return`contenthash:/contenthash/${n.slice(-1)}`}p_rawadd(e,t){if(!e||!t)throw new errors.CodingError("TransportHTTP.p_rawadd: invalid parms",e,t);let r=JSON.stringify(t.preflight(Object.assign({},t)))+"\n";return o.p_POST(this._url(e,servercommands.rawadd),"application/json",r)}p_newlisturls(e){let t=e._publicurls.map(e=>s.parse(e)).find(e=>"https:"===e.protocol&&["gateway.dweb.me","dweb.me"].includes(e.host)&&(e.pathname.includes("/content/rawfetch")||e.pathname.includes("/contenthash/"))||"contenthash:"===e.protocol&&"contenthash"===e.pathname.split("/")[1]);return t||(t=`contenthash:/contenthash/${e.keypair.verifyexportmultihashsha256_58()}`),[t,t]}async p_f_createReadStream(e,{wanturl:t=!1}={}){try{let r=this;return t?e:function(t){return r.p_createReadStream(e,t)}}catch(e){throw e}}async createReadStream(e,t){let r;u("createreadstream %s %o",s.parse(e).href,t);try{r=new a.PassThrough;const n=o.p_GET(this._url(e,servercommands.rawfetch),Object.assign({wantstream:!0},t));return n.then(e=>e.pipe(r)),r}catch(e){console.warn(this.name,"createReadStream caught error",e.message),"function"==typeof r.destroy?r.destroy(e):r.emit("error",e)}}async p_createReadStream(e,t){u("createreadstream %s %o",s.parse(e).href,t);try{return await o.p_GET(this._url(e,servercommands.rawfetch),Object.assign({wantstream:!0},t))}catch(e){throw console.warn(this.name,"caught error",e),e}}async p_newdatabase(e){e.hasOwnProperty("keypair")&&(e=e.keypair.signingexport());let t=`${this.urlbase}/getall/table/${encodeURIComponent(e)}`;return{publicurl:t,privateurl:t}}async p_newtable(e,t){if(!e)throw new errors.CodingError("p_newtable currently requires a pubkey");let r=await this.p_newdatabase(e);return{privateurl:`${r.privateurl}/${t}`,publicurl:`${r.publicurl}/${t}`}}async p_set(e,t,r){if(!e||!t)throw new errors.CodingError("TransportHTTP.p_set: invalid parms",e,keyvalyes);if("string"==typeof t){let n=JSON.stringify([{key:t,value:r}]);await o.p_POST(this._url(e,servercommands.set),"application/json",n)}else{let r=JSON.stringify(Object.keys(t).map(e=>({key:e,value:t[e]})));await o.p_POST(this._url(e,servercommands.set),"application/json",r)}}_keyparm(e){return`key=${encodeURIComponent(e)}`}async p_get(e,t){if(!e&&t)throw new errors.CodingError("TransportHTTP.p_get: requires url and at least one key");let r=Array.isArray(t)?t.map(e=>this._keyparm(e)).join("&"):this._keyparm(t),n=await o.p_GET(this._url(e,servercommands.get,r));return Array.isArray(t)?n:n[t]}async p_delete(e,t){if(!e&&t)throw new errors.CodingError("TransportHTTP.p_get: requires url and at least one key");let r=t.map(e=>this._keyparm(e)).join("&");await o.p_GET(this._url(e,servercommands.delete,r))}async p_keys(e){if(!e&&keys)throw new errors.CodingError("TransportHTTP.p_get: requires url and at least one key");return await o.p_GET(this._url(e,servercommands.keys))}async p_getall(e){if(!e&&keys)throw new errors.CodingError("TransportHTTP.p_get: requires url and at least one key");return await o.p_GET(this._url(e,servercommands.getall))}p_info(){return o.p_GET(`${this.urlbase}/info`)}static async p_test(e={}){console.log("TransportHTTP.test");try{let t=await this.p_setup(e);console.log("HTTP connected");let r=await t.p_info();console.log("TransportHTTP info=",r),r=await t.p_status(),console.assert(r===n.STATUS_CONNECTED),await t.p_test_kvt("NACL%20VERIFY")}catch(e){throw console.log("Exception thrown in TransportHTTP.test:",e.message),e}}static async test(){return this}}i._transportclasses.HTTP=c,t=e.exports=c},function(e,t,r){"use strict";t.byteLength=f,t.toByteArray=h,t.fromByteArray=y;for(var n=[],i=[],o="undefined"!=typeof Uint8Array?Uint8Array:Array,s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",a=0,u=s.length;a<u;++a)n[a]=s[a],i[s.charCodeAt(a)]=a;function c(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=e.indexOf("=");-1===r&&(r=t);var n=r===t?0:4-r%4;return[r,n]}function f(e){var t=c(e),r=t[0],n=t[1];return 3*(r+n)/4-n}function l(e,t,r){return 3*(t+r)/4-r}function h(e){for(var t,r=c(e),n=r[0],s=r[1],a=new o(l(e,n,s)),u=0,f=s>0?n-4:n,h=0;h<f;h+=4)t=i[e.charCodeAt(h)]<<18|i[e.charCodeAt(h+1)]<<12|i[e.charCodeAt(h+2)]<<6|i[e.charCodeAt(h+3)],a[u++]=t>>16&255,a[u++]=t>>8&255,a[u++]=255&t;return 2===s&&(t=i[e.charCodeAt(h)]<<2|i[e.charCodeAt(h+1)]>>4,a[u++]=255&t),1===s&&(t=i[e.charCodeAt(h)]<<10|i[e.charCodeAt(h+1)]<<4|i[e.charCodeAt(h+2)]>>2,a[u++]=t>>8&255,a[u++]=255&t),a}function p(e){return n[e>>18&63]+n[e>>12&63]+n[e>>6&63]+n[63&e]}function d(e,t,r){for(var n,i=[],o=t;o<r;o+=3)n=(e[o]<<16&16711680)+(e[o+1]<<8&65280)+(255&e[o+2]),i.push(p(n));return i.join("")}function y(e){for(var t,r=e.length,i=r%3,o=[],s=16383,a=0,u=r-i;a<u;a+=16383)o.push(d(e,a,a+16383>u?u:a+16383));return 1===i?(t=e[r-1],o.push(n[t>>2]+n[t<<4&63]+"==")):2===i&&(t=(e[r-2]<<8)+e[r-1],o.push(n[t>>10]+n[t>>4&63]+n[t<<2&63]+"=")),o.join("")}i["-".charCodeAt(0)]=62,i["_".charCodeAt(0)]=63},function(e,t){},function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var i=r(2).Buffer,o=r(623);function s(e,t,r){e.copy(t,r)}e.exports=function(){function e(){n(this,e),this.head=null,this.tail=null,this.length=0}return e.prototype.push=function e(t){var r={data:t,next:null};this.length>0?this.tail.next=r:this.head=r,this.tail=r,++this.length},e.prototype.unshift=function e(t){var r={data:t,next:this.head};0===this.length&&(this.tail=r),this.head=r,++this.length},e.prototype.shift=function e(){if(0!==this.length){var t=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,t}},e.prototype.clear=function e(){this.head=this.tail=null,this.length=0},e.prototype.join=function e(t){if(0===this.length)return"";for(var r=this.head,n=""+r.data;r=r.next;)n+=t+r.data;return n},e.prototype.concat=function e(t){if(0===this.length)return i.alloc(0);if(1===this.length)return this.head.data;for(var r=i.allocUnsafe(t>>>0),n=this.head,o=0;n;)s(n.data,r,o),o+=n.data.length,n=n.next;return r},e}(),o&&o.inspect&&o.inspect.custom&&(e.exports.prototype[o.inspect.custom]=function(){var e=o.inspect({length:this.length});return this.constructor.name+" "+e})},function(e,t){},function(e,t,r){(function(t){function r(e,t){if(n("noDeprecation"))return e;var r=!1;function i(){if(!r){if(n("throwDeprecation"))throw new Error(t);n("traceDeprecation")?console.trace(t):console.warn(t),r=!0}return e.apply(this,arguments)}return i}function n(e){try{if(!t.localStorage)return!1}catch(e){return!1}var r=t.localStorage[e];return null!=r&&"true"===String(r).toLowerCase()}e.exports=r}).call(this,r(7))},function(e,t,r){"use strict";e.exports=o;var n=r(331),i=r(119);function o(e){if(!(this instanceof o))return new o(e);n.call(this,e)}i.inherits=r(4),i.inherits(o,n),o.prototype._transform=function(e,t,r){r(null,e)}},function(e,t){},function(e,t,r){(function(n){const i=r(332),o=r(1)("dweb-transports:ipfs"),s=r(628),a=r(9),u=r(38),c=r(36),f=r(21),l=r(81),h=r(118),p=r(103),d=r(151),y={repo:"/tmp/dweb_ipfsv2700",config:{Bootstrap:["/dns4/dweb.me/tcp/4245/wss/ipfs/QmPNgKEjC7wkpu3aHUzKKhZmbEfiGzL5TP1L8zZoHJyXZW"]},EXPERIMENTAL:{pubsub:!0}};class g extends h{constructor(e){super(e),this.ipfs=void 0,this.options=e,this.name="IPFS",this.supportURLs=["ipfs"],this.supportFunctions=["fetch","store","createReadStream"],this.status=h.STATUS_LOADED}p_ipfsstart(){const e=this;return new Promise((e,t)=>{this.ipfs=new s(this.options),this.ipfs.on("ready",()=>{e()}),this.ipfs.on("error",e=>t(e))}).then(()=>e.ipfs.version()).then(e=>o("ready %o",e)).catch(e=>{throw console.warn("IPFS p_ipfsstart failed",e.message),e})}static setup0(e){const t=h.mergeoptions(y,e.ipfs);o("setup options=%o",t);const r=new g(t);return p.addtransport(r),r}async p_setup1(e){try{this.status=h.STATUS_STARTING,e&&e(this),await this.p_ipfsstart(),this.status=await this.p_status()}catch(e){console.error(this.name,"failed to connect",e),this.status=h.STATUS_FAILED}return e&&e(this),this}async p_status(){return this.status=await this.ipfs.isOnline()?h.STATUS_CONNECTED:h.STATUS_FAILED,super.p_status()}static urlFrom(e){if(e instanceof a)return"ipfs:/ipfs/"+e.toBaseEncodedString();if("object"==typeof e&&e.hash)return"ipfs:/ipfs/"+e.hash;if("string"==typeof e)return"ipfs:/ipfs/"+e;throw new l.CodingError("TransportIPFS.urlFrom: Cant convert to url from",e)}static cidFrom(e){if(e instanceof a)return e;if("string"==typeof e&&(e=c.parse(e)),e&&e.pathname){const t=e.pathname.split("/");if(!["ipfs:","dweb:"].includes(e.protocol)||"ipfs"!==t[1]||t.length<3)throw new l.TransportError("TransportIPFS.cidFrom bad format for url should be dweb: or ipfs:/ipfs/...: "+e.href);if(t.length>3)throw new l.TransportError("TransportIPFS.cidFrom not supporting paths in url yet, should be dweb: or ipfs:/ipfs/...: "+e.href);return new a(t[2])}throw new l.CodingError("TransportIPFS.cidFrom: Cant convert url",e)}static _stringFrom(e){return e instanceof a?"/ipfs/"+e.toBaseEncodedString():"object"==typeof e&&e.path?e.path:void 0}static ipfsFrom(e){if(e=this._stringFrom(e),e.indexOf("/ipfs/")>-1)return e.slice(e.indexOf("/ipfs/"));throw new l.CodingError(`TransportIPFS.ipfsFrom: Cant convert url ${e} into a path starting /ipfs/`)}static ipfsGatewayFrom(e){if(e=this._stringFrom(e),e.indexOf("/ipfs/")>-1)return"https://ipfs.io"+e.slice(e.indexOf("/ipfs/"));throw new l.CodingError(`TransportIPFS.ipfsGatewayFrom: Cant convert url ${e} into a path starting /ipfs/`)}static multihashFrom(e){if(e instanceof a)return cid.toBaseEncodedString();if("object"==typeof e&&e.path&&(e=e.path),"string"==typeof e){const t=e.indexOf("/ipfs/");if(t>-1)return e.slice(t+6)}throw new l.CodingError(`Cant turn ${e} into a multihash`)}async p_rawfetch(e,{timeoutMS:t=6e4,relay:r=!1}={}){if(!e)throw new l.CodingError("TransportIPFS.p_rawfetch: requires url");const n=g.cidFrom(e),s=g.ipfsFrom(e);try{const r=await d.p_timeout(this.ipfs.dag.get(n),t,"Timed out IPFS fetch of "+g._stringFrom(n));if(r.remainderPath.length)throw new l.TransportError("Not yet supporting paths in p_rawfetch");let a;return"DAGNode"===r.value.constructor.name?a=await this.ipfs.files.cat(s):(o("Found a raw IPFS block (unusual) - not a DAGNode - handling as such"),a=r.value),a}catch(r){o("Caught error '%s' fetching via IPFS, trying IPFS HTTP gateway",r.message);try{let r=g.ipfsGatewayFrom(e);return await d.p_timeout(i.p_GET(r),t,"Timed out IPFS fetch of "+r)}catch(e){throw e}}}async p_rawstore(e){console.assert(e,"TransportIPFS.p_rawstore: requires data");const t=e instanceof n?e:new n(e),r=(await this.ipfs.files.add(t,{"cid-version":1,hashAlg:"sha2-256"}))[0];return g.urlFrom(r)}async p_f_createReadStream(e,{wanturl:t=!1}={}){let r;try{let n=e.pathname.split("/ipfs/")[1];if(n.includes("/"))throw new CodingError("Should not be seeing URLS with a path here:"+e);let i=this;return t?e:function e(t){o("reading from stream %o %o",n,t||"");const s=t?t.start:0,a=t&&t.end?s+t.end+1:void 0;return r&&r.destroy&&r.destroy(),r=i.ipfs.files.catReadableStream(n,{offset:s,length:a&&a-s}),r.on("error",e=>console.error(e)),r}}catch(e){throw r&&r.destroy&&r.destroy(),e}}static async p_test(e){console.log("TransportIPFS.test");try{const t=await this.p_setup(e);console.log(t.name,"setup");const r=await t.p_status();let n;console.assert(r===h.STATUS_CONNECTED);const i="The quick brown fox",o="ipfs:/ipfs/zdpuAscRnisRkYnEyJAp1LydQ3po25rCEDPPEDMymYRfN1yPK",s="1114",a=await t.p_rawstore(i);console.log("rawstore returned",a);const u=g.cidFrom(a);console.assert(a===o,"url should match url from rawstore");const c=a.split("/")[2],f=g.urlFrom(u);console.assert(a===f,"Should round trip"),n=a;const l=await t.p_rawfetch(n);return console.assert(l.toString()===i,"Should fetch block stored above"),t}catch(e){throw console.log("Exception thrown in TransportIPFS.test:",e.message),e}}}p._transportclasses.IPFS=g,t=e.exports=g}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(n){const i=r(333),o=r(629),s=r(68),a=r(52),u=r(383),c=r(42),f=r(113),l=r(481),h=r(31),p=r(14),d=r(482),y=r(209),g=r(9),m=r(1),b=r(275),v=r(10),_=r(985),w=r(990),S=r(1003),k=r(1419),E=r(1420),A=r(1425);class x extends v{constructor(e){super(),this._options={init:!0,start:!0,EXPERIMENTAL:{},preload:{enabled:!0,addresses:["/dnsaddr/node0.preload.ipfs.io/https","/dnsaddr/node1.preload.ipfs.io/https"]}},e=_.validate(e||{}),b(this._options,e),!1===e.init&&(this._options.init=!1),!1!==e.start&&(this._options.start=!0),"string"==typeof e.repo||void 0===e.repo?this._repo=k(e.repo):this._repo=e.repo,this.log=m("jsipfs"),this.log.err=m("jsipfs:err"),this.types={Buffer:n,PeerId:s,PeerInfo:a,multiaddr:h,multibase:y,multihash:p,CID:g,dagPB:c,dagCBOR:u},this._peerInfoBook=new d,this._peerInfo=void 0,this._libp2pNode=void 0,this._bitswap=void 0,this._blockService=new i(this._repo),this._ipld=new o(this._blockService),this._pubsub=void 0,this._preload=E(this),this._mfsPreload=A(this),this.init=S.init(this),this.preStart=S.preStart(this),this.start=S.start(this),this.stop=S.stop(this),this.shutdown=this.stop,this.isOnline=S.isOnline(this),this.version=S.version(this),this.id=S.id(this),this.repo=S.repo(this),this.bootstrap=S.bootstrap(this),this.config=S.config(this),this.block=S.block(this),this.object=S.object(this),this.dag=S.dag(this),this.libp2p=S.libp2p(this),this.swarm=S.swarm(this),this.files=S.files(this),this.bitswap=S.bitswap(this),this.pin=S.pin(this),this.ping=S.ping(this),this.pingPullStream=S.pingPullStream(this),this.pingReadableStream=S.pingReadableStream(this),this.pubsub=S.pubsub(this),this.dht=S.dht(this),this.dns=S.dns(this),this.key=S.key(this),this.stats=S.stats(this),this._options.EXPERIMENTAL.pubsub&&this.log("EXPERIMENTAL pubsub is enabled"),this._options.EXPERIMENTAL.sharding&&this.log("EXPERIMENTAL sharding is enabled"),this._options.EXPERIMENTAL.dht&&this.log("EXPERIMENTAL Kademlia DHT is enabled"),this.state=r(1426)(this),this.ls=this.files.lsImmutable,this.lsReadableStream=this.files.lsReadableStreamImmutable,this.lsPullStream=this.files.lsPullStreamImmutable,this.util={crypto:f,isIPFS:l};const t=S.mfs(this);Object.keys(t).forEach(e=>{this.files[e]=t[e]}),w(this)}}t=e.exports=x,t.createNode=(e=>new x(e))}).call(this,r(0).Buffer)},function(e,t,r){"use strict";const n=r(120),i=r(8),o=r(9),s=r(656),a=r(657),u=r(333),c=r(55).join,f=r(55).sep,l=r(165).source,h=r(224),p=r(74),d=r(37),y=r(5),g=r(26).MemoryDatastore,m=r(42),b=r(383),v=r(755),_=r(760),w=r(96).ethAccountSnapshot,S=r(96).ethBlock,k=r(96).ethBlockList,E=r(96).ethStateTrie,A=r(96).ethStorageTrie,x=r(96).ethTx,I=r(96).ethTxTrie,T=r(848),B=r(849);function C(){}class P{constructor(e){if(!e)throw new Error("Missing blockservice");this.bs=e,this.resolvers={},this.support={},this.support.add=((e,t,r)=>{if(this.resolvers[e])throw new Error('Resolver already exists for codec "'+e+'"');this.resolvers[e]={resolver:t,util:r}}),this.support.rm=(e=>{this.resolvers[e]&&delete this.resolvers[e]}),this.support.add(m.resolver.multicodec,m.resolver,m.util),this.support.add(b.resolver.multicodec,b.resolver,b.util),this.support.add(v.resolver.multicodec,v.resolver,v.util),this.support.add(_.resolver.multicodec,_.resolver,_.util),this.support.add(w.resolver.multicodec,w.resolver,w.util),this.support.add(S.resolver.multicodec,S.resolver,S.util),this.support.add(k.resolver.multicodec,k.resolver,k.util),this.support.add(E.resolver.multicodec,E.resolver,E.util),this.support.add(A.resolver.multicodec,A.resolver,A.util),this.support.add(x.resolver.multicodec,x.resolver,x.util),this.support.add(I.resolver.multicodec,I.resolver,I.util),this.support.add(T.resolver.multicodec,T.resolver,T.util),this.support.add(B.resolver.multicodec,B.resolver,B.util)}get(e,t,r,n){if("function"==typeof t&&(n=t,t=void 0),"function"==typeof r&&(n=r,r={}),"string"==typeof t&&(t=c("/",t).substr(1).split(f).join("/")),""===t||!t)return this._get(e,(e,t)=>{if(e)return n(e);n(null,{value:t,remainderPath:""})});let i;s(r=>{this.bs.get(e,(n,o)=>{if(n)return r(n);const s=this.resolvers[e.codec];if(!s)return r(new Error('No resolver found for codec "'+e.codec+'"'));s.resolver.resolve(o.data,t,(e,n)=>{if(e)return r(e);i=n.value,t=n.remainderPath,r()})})},()=>{const n=!t||""===t||"/"===t,s=i&&!i["/"];return!!(n&&s||r.localResolve)||(i&&(e=new o(i["/"])),!1)},(e,r)=>e?n(e):n(null,{value:i,remainderPath:t}))}getStream(e,t,r){const n=l();return this.get(e,t,r,(e,t)=>{if(e)return n.resolve(i.error(e));n.resolve(i.values([t]))}),n}put(e,t,r){if("function"==typeof t)return r=t,setImmediate(()=>r(new Error("IPLDResolver.put requires options")));if(r=r||C,t.cid&&o.isCID(t.cid))return this._put(t.cid,e,r);const n=this.resolvers[t.format];if(!n)return r(new Error('No resolver found for codec "'+t.format+'"'));n.util.cid(e,t,(t,n)=>{if(t)return r(t);this._put(n,e,r)})}treeStream(e,t,r){let n;if("object"==typeof t&&(r=t,t=void 0),r=r||{},!r.recursive){n=l();const t=this.resolvers[e.codec];if(!t)return n.abort(new Error('No resolver found for codec "'+e.codec+'"')),n;y([t=>this.bs.get(e,t),(e,r)=>t.resolver.tree(e.data,r)],(e,t)=>{if(e)return n.abort(e),n;n.resolve(i.values(t))})}return r.recursive&&(n=i(h.widthFirst({basePath:null,cid:e},e=>{if("string"==typeof e)return i.empty();const t=l(),r=e.cid,n=this.resolvers[r.codec];return n?(y([t=>this.bs.get(e.cid,t),(e,t)=>n.resolver.tree(e.data,(r,i)=>{if(r)return t(r);p(i,(t,r)=>{n.resolver.isLink(e.data,t,(e,n)=>{if(e)return r(e);r(null,{path:t,link:n})})},t)})],(r,n)=>{if(r)return t.abort(r),t;t.resolve(i.values(n.map(t=>{const r=e.basePath?e.basePath+"/"+t.path:t.path;return t.link?{basePath:r,cid:new o(t.link["/"])}:r})))}),t):(t.abort(new Error('No resolver found for codec "'+r.codec+'"')),t)}),i.map(e=>"string"==typeof e?e:e.basePath),i.filter(Boolean))),t?i(n,i.map(e=>{if(0===e.indexOf(t))return e=e.slice(t.length+1),e}),i.filter(Boolean)):n}remove(e,t){this.bs.delete(e,t)}_get(e,t){const r=this.resolvers[e.codec];if(!r)return t(new Error('No resolver found for codec "'+e.codec+'"'));y([t=>this.bs.get(e,t),(e,t)=>{r?r.util.deserialize(e.data,(e,r)=>{if(e)return t(e);t(null,r)}):t(null,e.data)}],t)}_put(e,t,r){r=r||C;const i=this.resolvers[e.codec];if(!i)return r(new Error('No resolver found for codec "'+e.codec+'"'));y([e=>i.util.serialize(t,e),(t,r)=>this.bs.put(new n(t,e),r)],t=>{if(t)return r(t);r(null,e)})}}P.inMemory=function(e){const t=new a("in-memory",{storageBackends:{root:g,blocks:g,datastore:g},lock:"memory"}),r=new u(t);d([e=>t.init({},e),e=>t.open(e)],t=>{if(t)return e(t);e(null,new P(r))})},e.exports=P},function(e,t){e.exports=s;var r=128,n=127,i=-128,o=Math.pow(2,31);function s(e,t,n){t=t||[],n=n||0;for(var a=n;e>=o;)t[n++]=255&e|r,e/=128;for(;e&i;)t[n++]=255&e|r,e>>>=7;return t[n]=0|e,s.bytes=n-a+1,t}},function(e,t){e.exports=i;var r=128,n=127;function i(e,t){var o=0,t=t||0,s=0,a=t,u,c=e.length;do{if(a>=c)throw i.bytes=0,new RangeError("Could not decode varint");u=e[a++],o+=s<28?(u&n)<<s:(u&n)*Math.pow(2,s),s+=7}while(u>=r);return i.bytes=a-t,o}},function(e,t){var r=Math.pow(2,7),n=Math.pow(2,14),i=Math.pow(2,21),o=Math.pow(2,28),s=Math.pow(2,35),a=Math.pow(2,42),u=Math.pow(2,49),c=Math.pow(2,56),f=Math.pow(2,63);e.exports=function(e){return e<r?1:e<n?2:e<i?3:e<o?4:e<s?5:e<a?6:e<u?7:e<c?8:e<f?9:10}},function(e,t,r){"use strict";const n=r(634),i=r(334),o=r(635),s=r(636),a=r(637),u=[["base1","1","","1"],["base2","0",i,"01"],["base8","7",i,"01234567"],["base10","9",i,"0123456789"],["base16","f",o,"0123456789abcdef"],["base32","b",s,"abcdefghijklmnopqrstuvwxyz234567"],["base32pad","c",s,"abcdefghijklmnopqrstuvwxyz234567="],["base32hex","v",s,"0123456789abcdefghijklmnopqrstuv"],["base32hexpad","t",s,"0123456789abcdefghijklmnopqrstuv="],["base32z","h",s,"ybndrfg8ejkmcpqxot1uwisza345h769"],["base58flickr","Z",i,"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"],["base58btc","z",i,"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"],["base64","m",a,"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"],["base64pad","M",a,"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="],["base64url","u",a,"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"],["base64urlpad","U",a,"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_="]],c=u.reduce((e,t)=>(e[t[0]]=new n(t[0],t[1],t[2],t[3]),e),{}),f=u.reduce((e,t)=>(e[t[1]]=c[t[0]],e),{});e.exports={names:c,codes:f}},function(e,t,r){"use strict";class n{constructor(e,t,r,n){this.name=e,this.code=t,this.alphabet=n,r&&n&&(this.engine=r(n))}encode(e){return this.engine.encode(e)}decode(e){return this.engine.decode(e)}isImplemented(){return this.engine}}e.exports=n},function(e,t,r){"use strict";(function(t){e.exports=function e(r){return{encode:e=>"string"==typeof e?t.from(e).toString("hex"):e.toString("hex"),decode(e){for(let t of e)if(r.indexOf(t)<0)throw new Error("invalid base16 character");return t.from(e,"hex")}}}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(t){function r(e,t){e=e.replace(new RegExp("=","g"),"");let r=e.length,n=0,i=0,o=0,s=new Uint8Array(5*r/8|0);for(let a=0;a<r;a++)i=i<<5|t.indexOf(e[a]),n+=5,n>=8&&(s[o++]=i>>>n-8&255,n-=8);return s.buffer}function n(e,t){let r=e.byteLength,n=new Uint8Array(e),i=t.indexOf("=")===t.length-1;i&&(t=t.substring(0,t.length-2));let o=0,s=0,a="";for(let e=0;e<r;e++)for(s=s<<8|n[e],o+=8;o>=5;)a+=t[s>>>o-5&31],o-=5;if(o>0&&(a+=t[s<<5-o&31]),i)for(;a.length%8!=0;)a+="=";return a}e.exports=function e(i){return{encode:e=>n("string"==typeof e?t.from(e):e,i),decode(e){for(let t of e)if(i.indexOf(t)<0)throw new Error("invalid base32 character");return r(e,i)}}}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(t){e.exports=function e(r){const n=r.indexOf("=")>-1,i=r.indexOf("-")>-1&&r.indexOf("_")>-1;return{encode(e){let r="";r="string"==typeof e?t.from(e).toString("base64"):e.toString("base64"),i&&(r=r.replace("+","-"),r=r.replace("/","_"));const o=r.indexOf("=");return o>0&&!n&&(r=r.substring(0,o)),r},decode(e){i&&(e=e.replace("+","-"),e=e.replace("/","_"));for(let t of e)if(r.indexOf(t)<0)throw new Error("invalid base64 character");return t.from(e,"base64")}}}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(n){const i=r(23),o=r(336),s=r(338),a=r(337);t=e.exports,t.addPrefix=((e,t)=>{let r;if(n.isBuffer(e))r=a.varintBufferEncode(e);else{if(!o[e])throw new Error("multicodec not recognized");r=o[e]}return n.concat([r,t])}),t.rmPrefix=(e=>(i.decode(e),e.slice(i.decode.bytes))),t.getCodec=(e=>{const t=a.varintBufferDecode(e),r=s[t.toString("hex")];if(void 0===r)throw new Error("Code `0x"+t.toString("hex")+"` not found");return r}),t.getCodeVarint=(e=>{const t=o[e];if(void 0===t)throw new Error("Codec `"+e+"` not found");return t}),t.addCodec=((e,t)=>{o[e]=a.varintBufferEncode(t),s[t.toString("hex")]=e})}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(t){const n=r(14);var i={checkCIDComponents:function(e){if(null==e)return"null values are not valid CIDs";if(0!==e.version&&1!==e.version)return"Invalid version, must be a number equal to 1 or 0";if("string"!=typeof e.codec)return"codec must be string";if(!t.isBuffer(e.multihash))return"multihash must be a Buffer";try{n.validate(e.multihash)}catch(e){let t=e.message;return t||(t="Multihash validation failed"),t}}};e.exports=i}).call(this,r(0).Buffer)},function(e,t,r){"use strict";e.exports={keys:r(641),once:r(210),values:r(82),count:r(642),infinite:r(643),empty:r(644),error:r(645)}},function(e,t,r){"use strict";var n=r(82);e.exports=function(e){return n(Object.keys(e))}},function(e,t,r){"use strict";e.exports=function e(t){var r=0;return t=t||1/0,function(e,n){return e?n&&n(e):r>t?n(!0):void n(null,r++)}}},function(e,t,r){"use strict";e.exports=function e(t){return t=t||Math.random,function(e,r){return e?r&&r(e):r(null,t())}}},function(e,t,r){"use strict";e.exports=function e(){return function(e,t){t(!0)}}},function(e,t,r){"use strict";e.exports=function e(t){return function(e,r){r(t)}}},function(e,t,r){"use strict";e.exports={drain:r(121),onEnd:r(647),log:r(648),find:r(649),reduce:r(211),collect:r(90),concat:r(650)}},function(e,t,r){"use strict";var n=r(121);e.exports=function e(t){return n(null,t)}},function(e,t,r){"use strict";var n=r(121);e.exports=function e(t){return n(function(e){console.log(e)},t)}},function(e,t,r){"use strict";function n(e){return e}var i=r(122),o=r(121);e.exports=function e(t,r){var s=!1;return r?t=i(t)||n:(r=t,t=n),o(function(e){if(t(e))return s=!0,r(null,e),!1},function(e){s||r(!0===e?null:e,null)})}},function(e,t,r){"use strict";var n=r(211);e.exports=function e(t){return n(function(e,t){return e+t},"",t)}},function(e,t,r){"use strict";e.exports={map:r(340),asyncMap:r(123),filter:r(124),filterNot:r(652),through:r(342),take:r(653),unique:r(343),nonUnique:r(654),flatten:r(655)}},function(e,t,r){"use strict";var n=r(341),i=r(124);e.exports=function e(t){return t=n(t),i(function(e){return!t(e)})}},function(e,t,r){"use strict";e.exports=function e(t,r){r=r||{};var n=r.last||!1,i=!1;if("number"==typeof t){n=!0;var o=t;t=function(){return--o}}return function(e){function r(t){e(!0,function(e){n=!1,t(e||!0)})}return function(o,s){i&&!o?n?r(s):s(i):(i=o)?e(i,s):e(null,function(e,o){(i=i||e)?s(i):t(o)?s(null,o):(i=!0,n?s(null,o):r(s))})}}}},function(e,t,r){"use strict";var n=r(343);e.exports=function e(t){return n(t,!0)}},function(e,t,r){"use strict";var n=r(82),i=r(210);e.exports=function e(){return function(e){var t;return function(r,o){function s(){t(null,function(t,r){!0===t?a():t?e(!0,function(e){o(t)}):o(null,r)})}function a(){t=null,e(null,function(e,r){if(e)return o(e);Array.isArray(r)||r&&"object"==typeof r?r=n(r):"function"!=typeof r&&(r=i(r)),t=r,s()})}r?t?t(r,function(t){e(t||r,o)}):e(r,o):t?s():a()}}}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=s;var n=r(344),i=o(n);function o(e){return e&&e.__esModule?e:{default:e}}function s(e,t,r){(0,i.default)(e,function(){return!t.apply(this,arguments)},r)}e.exports=t.default},function(e,t,r){"use strict";const n=r(5),i=r(37),o=r(46),s=r(41),a=r(13),u=r(55),c=r(1),f=r(107),l=r(8),h=r(677),p=r(678),d=r(680),y=r(687),g=r(688),m=r(698),b=r(721),v=c("repo"),_=Number.MAX_SAFE_INTEGER,w={memory:r(375),fs:r(375)},S=r(722).repoVersion;class k{constructor(e,t){a.equal(typeof e,"string","missing repoPath"),this.options=T(t),this.closed=!0,this.path=e,this._locker=this._getLocker(),this.root=h.create("root",this.path,this.options),this.version=p(this.root),this.config=d(this.root),this.apiAddr=y(this.root)}init(e,t){v("initializing at: %s",this.path),i([e=>this.root.open(x(e)),t=>this.config.set(e,t),e=>this.version.set(S,e)],t)}open(e){this.closed?(v("opening at: %s",this.path),n([e=>this.root.open(x(e)),e=>this._isInitialized(e),e=>this._openLock(this.path,e),(e,t)=>{v("aquired repo.lock"),this.lockfile=e,t()},e=>{v("creating datastore"),this.datastore=h.create("datastore",u.join(this.path,"datastore"),this.options),v("creating blocks");const t=h.create("blocks",u.join(this.path,"blocks"),this.options);g(t,this.options.storageBackendOptions.blocks,e)},(e,t)=>{this.blocks=e,t()},e=>{v("creating keystore"),this.keys=h.create("keys",u.join(this.path,"keys"),this.options),e()},e=>{this.closed=!1,v("all opened"),e()}],t=>{t&&this.lockfile?this._closeLock(r=>{r?v("error removing lock",r):this.lockfile=null,e(t)}):e(t)})):setImmediate(()=>e(new Error("repo is already open")))}_getLocker(){return"string"==typeof this.options.lock?(a(w[this.options.lock],"Unknown lock type: "+this.options.lock),w[this.options.lock]):(a(this.options.lock,"No lock provided"),this.options.lock)}_openLock(e,t){this._locker.lock(e,(e,r)=>{if(e)return t(e,null);a.equal(typeof r.close,"function","Locks must have a close method"),t(null,r)})}_closeLock(e){if(this.lockfile)return this.lockfile.close(e);e()}_isLocked(e,t){if(this._locker)return this._locker.locked(e,t);t(null,!1)}_isInitialized(e){v("init check"),o({config:e=>this.config.exists(e),version:e=>this.version.check(S,e)},(t,r)=>{if(v("init",t,r),t&&!r.config)return e(Object.assign(new Error("repo is not initialized yet"),{code:b.ERR_REPO_NOT_INITIALIZED,path:this.path}));e(t)})}close(e){if(this.closed)return e(new Error("repo is already closed"));v("closing at: %s",this.path),i([e=>this.apiAddr.delete(I(e)),e=>{s([this.blocks,this.keys,this.datastore],(e,t)=>e.close(t),e)},e=>{v("unlocking"),this.closed=!0,this._closeLock(e)},e=>{this.lockfile=null,e()}],t=>e(t))}exists(e){this.version.exists(e)}stat(e,t){"function"==typeof e&&(t=e,e={}),e=Object.assign({},{human:!1},e),o({storageMax:e=>this.config.get("Datastore.StorageMax",(t,r)=>{e(null,new f(t?_:r))}),version:e=>this.version.get(e),blocks:e=>this.blocks.query({},(t,r)=>{r=r||[];const n=new f(r.length);let i=new f(0);r.forEach(e=>{i=i.plus(e.value.byteLength).plus(e.key._buf.byteLength)}),e(t,{count:n,size:i})}),datastore:e=>E(this.datastore,e),keys:e=>E(this.keys,e)},(r,n)=>{if(r)return t(r);let i=n.blocks.size.plus(n.datastore).plus(n.keys);e.human&&(i=i.div(1048576)),t(null,{repoPath:this.path,storageMax:n.storageMax,version:n.version,numObjects:n.blocks.count,repoSize:i})})}}function E(e,t){l(e.query({}),l.reduce((e,t)=>e.plus(t.value.byteLength).plus(t.key._buf.byteLength),new f(0),t))}function A(e,t){return r=>{t(r&&!e(r)?r:null)}}function x(e){return A(e=>"Already open"===e.message,e)}function I(e){return A(e=>e&&(e.code===b.ERR_REPO_NOT_INITIALIZED||e.message.startsWith("ENOENT")),e)}function T(e){const t=Object.assign({},m,e);return t.storageBackends=Object.assign({},m.storageBackends,t.storageBackends),t.storageBackendOptions=Object.assign({},m.storageBackendOptions,t.storageBackendOptions),t}e.exports=k,e.exports.repoVersion=S,e.exports.errors=b},function(e,t,r){var n=r(157),i=Object.prototype,o=i.hasOwnProperty,s=i.toString,a=n?n.toStringTag:void 0;function u(e){var t=o.call(e,a),r=e[a];try{e[a]=void 0;var n=!0}catch(e){}var i=s.call(e);return n&&(t?e[a]=r:delete e[a]),i}e.exports=u},function(e,t){var r=Object.prototype,n=r.toString;function i(e){return n.call(e)}e.exports=i},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=p;var n=r(125),i=c(n),o=r(661),s=c(o),a=r(350),u=c(a);function c(e){return e&&e.__esModule?e:{default:e}}function f(e){var t=-1,r=e.length;return function n(){return++t<r?{value:e[t],key:t}:null}}function l(e){var t=-1;return function r(){var n=e.next();return n.done?null:(t++,{value:n.value,key:t})}}function h(e){var t=(0,u.default)(e),r=-1,n=t.length;return function i(){var o=t[++r];return r<n?{value:e[o],key:o}:null}}function p(e){if((0,i.default)(e))return f(e);var t=(0,s.default)(e);return t?l(t):h(e)}e.exports=t.default},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){return n&&e[n]&&e[n]()};var n="function"==typeof Symbol&&Symbol.iterator;e.exports=t.default},function(e,t,r){var n=r(663),i=r(351),o=r(91),s=r(665),a=r(667),u=r(668),c=Object.prototype,f=c.hasOwnProperty;function l(e,t){var r=o(e),c=!r&&i(e),l=!r&&!c&&s(e),h=!r&&!c&&!l&&u(e),p=r||c||l||h,d=p?n(e.length,String):[],y=d.length;for(var g in e)!t&&!f.call(e,g)||p&&("length"==g||l&&("offset"==g||"parent"==g)||h&&("buffer"==g||"byteLength"==g||"byteOffset"==g)||a(g,y))||d.push(g);return d}e.exports=l},function(e,t){function r(e,t){for(var r=-1,n=Array(e);++r<e;)n[r]=t(r);return n}e.exports=r},function(e,t,r){var n=r(156),i=r(159),o="[object Arguments]";function s(e){return i(e)&&n(e)==o}e.exports=s},function(e,t,r){(function(e){var n=r(158),i=r(666),o="object"==typeof t&&t&&!t.nodeType&&t,s=o&&"object"==typeof e&&e&&!e.nodeType&&e,a=s&&s.exports===o,u=a?n.Buffer:void 0,c=u?u.isBuffer:void 0,f=c||i;e.exports=f}).call(this,r(28)(e))},function(e,t){function r(){return!1}e.exports=r},function(e,t){var r=9007199254740991,n=/^(?:0|[1-9]\d*)$/;function i(e,t){var i=typeof e;return t=null==t?r:t,!!t&&("number"==i||"symbol"!=i&&n.test(e))&&e>-1&&e%1==0&&e<t}e.exports=i},function(e,t,r){var n=r(669),i=r(670),o=r(671),s=o&&o.isTypedArray,a=s?i(s):n;e.exports=a},function(e,t,r){var n=r(156),i=r(348),o=r(159),s="[object Arguments]",a="[object Array]",u="[object Boolean]",c="[object Date]",f="[object Error]",l="[object Function]",h="[object Map]",p="[object Number]",d="[object Object]",y="[object RegExp]",g="[object Set]",m="[object String]",b="[object WeakMap]",v="[object ArrayBuffer]",_="[object DataView]",w="[object Float32Array]",S="[object Float64Array]",k="[object Int8Array]",E="[object Int16Array]",A="[object Int32Array]",x="[object Uint8Array]",I="[object Uint8ClampedArray]",T="[object Uint16Array]",B="[object Uint32Array]",C={};function P(e){return o(e)&&i(e.length)&&!!C[n(e)]}C[w]=C[S]=C[k]=C[E]=C[A]=C[x]=C[I]=C[T]=C[B]=!0,C[s]=C[a]=C[v]=C[u]=C[_]=C[c]=C[f]=C[l]=C[h]=C[p]=C[d]=C[y]=C[g]=C[m]=C[b]=!1,e.exports=P},function(e,t){function r(e){return function(t){return e(t)}}e.exports=r},function(e,t,r){(function(e){var n=r(347),i="object"==typeof t&&t&&!t.nodeType&&t,o=i&&"object"==typeof e&&e&&!e.nodeType&&e,s=o&&o.exports===i,a=s&&n.process,u=function(){try{var e=o&&o.require&&o.require("util").types;return e||a&&a.binding&&a.binding("util")}catch(e){}}();e.exports=u}).call(this,r(28)(e))},function(e,t,r){var n=r(673),i=r(674),o=Object.prototype,s=o.hasOwnProperty;function a(e){if(!n(e))return i(e);var t=[];for(var r in Object(e))s.call(e,r)&&"constructor"!=r&&t.push(r);return t}e.exports=a},function(e,t){var r=Object.prototype;function n(e){var t=e&&e.constructor,n="function"==typeof t&&t.prototype||r;return e===n}e.exports=n},function(e,t,r){var n=r(675),i=n(Object.keys,Object);e.exports=i},function(e,t){function r(e,t){return function(r){return e(t(r))}}e.exports=r},function(e,t){e.exports=function e(t){return t&&"object"==typeof t&&"function"==typeof t.copy&&"function"==typeof t.fill&&"function"==typeof t.readUInt8}},function(e,t,r){"use strict";t.create=function e(t,r,n){const i=n.storageBackends[t],o=Object.assign({},n.storageBackendOptions[t]||{});return new i(r,o)}},function(e,t,r){"use strict";(function(t){const n=r(26).Key,i=r(1),o=i("repo:version"),s=new n("version");e.exports=(e=>({exists(t){e.has(s,t)},get(t){e.get(s,(e,r)=>{if(e)return t(e);t(null,parseInt(r.toString().trim(),10))})},set(r,n){e.put(s,t.from(String(r)),n)},check(e,t){this.get((r,n)=>r?t(r):(o("comparing version: %s and %s",n,e),n!==e?t(new Error(`version mismatch: expected v${e}, found v${n}`)):void t()))}}))}).call(this,r(0).Buffer)},function(e,t,r){"use strict";const n=r(8),i=r(3),o=r(219).asyncFilter,s=r(219).asyncSort,a=r(353);class u{constructor(){this.data={}}open(e){i(e)}put(e,t,r){this.data[e.toString()]=t,i(r)}get(e,t){this.has(e,(r,n)=>r?t(r):n?void t(null,this.data[e.toString()]):t(new Error("No value")))}has(e,t){i(()=>{t(null,void 0!==this.data[e.toString()])})}delete(e,t){delete this.data[e.toString()],i(()=>{t()})}batch(){let e=[],t=[];return{put(t,r){e.push([t,r])},delete(e){t.push(e)},commit:r=>{e.forEach(e=>{this.data[e[0].toString()]=e[1]}),e=[],t.forEach(e=>{delete this.data[e.toString()]}),t=[],i(r)}}}query(e){let t=[n.keys(this.data),n.map(e=>({key:new a(e),value:this.data[e]}))],r=[];if(null!=e.prefix){const t=e.prefix;r.push((e,r)=>r(null,e.key.toString().startsWith(t)))}if(null!=e.filters&&(r=r.concat(e.filters)),t=t.concat(r.map(e=>o(e))),null!=e.orders&&(t=t.concat(e.orders.map(e=>s(e)))),null!=e.offset){let r=0;t.push(n.filter(()=>r++>=e.offset))}return null!=e.limit&&t.push(n.take(e.limit)),!0===e.keysOnly&&t.push(n.map(e=>({key:e.key}))),n.apply(null,t)}close(e){i(e)}}e.exports=u},function(e,t,r){"use strict";const n=r(26).Key,i=r(126),o=r(5),s=r(220),a=r(357),u=r(358),c=r(2).Buffer,f=new n("config");e.exports=(e=>{const t=i(n,1),r={get(t,r){"function"==typeof t&&(r=t,t=void 0),t||(t=void 0),e.get(f,(e,n)=>{if(e)return r(e);let i;try{i=JSON.parse(n.toString())}catch(e){return r(e)}if(void 0!==t&&!u(i,t))return r(new Error("Key "+t+" does not exist in config"));let o=void 0!==t?s(i,t):i;r(null,o)})},set(e,r,n){if("function"==typeof r)n=r,r=e,e=void 0;else if(!e||"string"!=typeof e)return n(new Error("Invalid key type"));if(void 0===r||c.isBuffer(r))return n(new Error("Invalid value type"));t.push({key:e,value:r},n)},exists(t){e.has(f,t)}};return r;function n(e,t){const n=e.key,i=e.value;n?o([e=>r.get(e),(e,t)=>t(null,a(e,n,i)),l],t):l(i,t)}function l(t,r){const n=c.from(JSON.stringify(t,null,2));e.put(f,n,r)}})},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=b;var n=r(682),i=m(n),o=r(91),s=m(o),a=r(54),u=m(a),c=r(105),f=m(c),l=r(213),h=m(l),p=r(686),d=m(p),y=r(32),g=m(y);function m(e){return e&&e.__esModule?e:{default:e}}function b(e,t,r){if(null==t)t=1;else if(0===t)throw new Error("Concurrency must not be zero");var n=(0,g.default)(e),o=0,a=[],c=!1;function l(e,t,r){if(null!=r&&"function"!=typeof r)throw new Error("task callback must be a function");if(m.started=!0,(0,s.default)(e)||(e=[e]),0===e.length&&m.idle())return(0,h.default)(function(){m.drain()});for(var n=0,i=e.length;n<i;n++){var o={data:e[n],callback:r||u.default};t?m._tasks.unshift(o):m._tasks.push(o)}c||(c=!0,(0,h.default)(function(){c=!1,m.process()}))}function p(e){return function(t){o-=1;for(var r=0,n=e.length;r<n;r++){var s=e[r],u=(0,i.default)(a,s,0);0===u?a.shift():u>0&&a.splice(u,1),s.callback.apply(s,arguments),null!=t&&m.error(t,s.data)}o<=m.concurrency-m.buffer&&m.unsaturated(),m.idle()&&m.drain(),m.process()}}var y=!1,m={_tasks:new d.default,concurrency:t,payload:r,saturated:u.default,unsaturated:u.default,buffer:t/4,empty:u.default,drain:u.default,error:u.default,started:!1,paused:!1,push:function(e,t){l(e,!1,t)},kill:function(){m.drain=u.default,m._tasks.empty()},unshift:function(e,t){l(e,!0,t)},remove:function(e){m._tasks.remove(e)},process:function(){if(!y){for(y=!0;!m.paused&&o<m.concurrency&&m._tasks.length;){var e=[],t=[],r=m._tasks.length;m.payload&&(r=Math.min(r,m.payload));for(var i=0;i<r;i++){var s=m._tasks.shift();e.push(s),a.push(s),t.push(s.data)}o+=1,0===m._tasks.length&&m.empty(),o===m.concurrency&&m.saturated();var u=(0,f.default)(p(e));n(t,u)}y=!1}},length:function(){return m._tasks.length},running:function(){return o},workersList:function(){return a},idle:function(){return m._tasks.length+o===0},pause:function(){m.paused=!0},resume:function(){!1!==m.paused&&(m.paused=!1,(0,h.default)(m.process))}};return m}e.exports=t.default},function(e,t,r){var n=r(683),i=r(684),o=r(685);function s(e,t,r){return t==t?o(e,t,r):n(e,i,r)}e.exports=s},function(e,t){function r(e,t,r,n){for(var i=e.length,o=r+(n?1:-1);n?o--:++o<i;)if(t(e[o],o,e))return o;return-1}e.exports=r},function(e,t){function r(e){return e!=e}e.exports=r},function(e,t){function r(e,t,r){for(var n=r-1,i=e.length;++n<i;)if(e[n]===t)return n;return-1}e.exports=r},function(e,t,r){"use strict";function n(){this.head=this.tail=null,this.length=0}function i(e,t){e.length=1,e.head=e.tail=t}Object.defineProperty(t,"__esModule",{value:!0}),t.default=n,n.prototype.removeLink=function(e){return e.prev?e.prev.next=e.next:this.head=e.next,e.next?e.next.prev=e.prev:this.tail=e.prev,e.prev=e.next=null,this.length-=1,e},n.prototype.empty=function(){for(;this.head;)this.shift();return this},n.prototype.insertAfter=function(e,t){t.prev=e,t.next=e.next,e.next?e.next.prev=t:this.tail=t,e.next=t,this.length+=1},n.prototype.insertBefore=function(e,t){t.prev=e.prev,t.next=e,e.prev?e.prev.next=t:this.head=t,e.prev=t,this.length+=1},n.prototype.unshift=function(e){this.head?this.insertBefore(this.head,e):i(this,e)},n.prototype.push=function(e){this.tail?this.insertAfter(this.tail,e):i(this,e)},n.prototype.shift=function(){return this.head&&this.removeLink(this.head)},n.prototype.pop=function(){return this.tail&&this.removeLink(this.tail)},n.prototype.toArray=function(){for(var e=Array(this.length),t=this.head,r=0;r<this.length;r++)e[r]=t.data,t=t.next;return e},n.prototype.remove=function(e){for(var t=this.head;t;){var r=t.next;e(t)&&this.removeLink(t),t=r}return this},e.exports=t.default},function(e,t,r){"use strict";const n=r(26).Key,i=r(2).Buffer,o=new n("api");e.exports=(e=>({get(t){e.get(o,(e,r)=>t(e,r&&r.toString()))},set(t,r){e.put(o,i.from(t.toString()),r)},delete(t){e.delete(o,t)}}))},function(e,t,r){"use strict";const n=r(359),i=n.ShardingDatastore,o=r(26).Key,s=r(362),a=r(120),u=r(3),c=r(221),f=r(9),l=r(8),h=e=>{const t=new s.Encoder;return new o("/"+t.write(e).finalize(),!1)},p=e=>h(e.buffer);function d(e,t,r){if(t.sharding){const t=new n.shard.NextToLast(2);i.createOrOpen(e,t,r)}else u(()=>r(null,e))}function y(e){return{query(t,r){l(e.query(t),l.collect(r))},get(t,r){if(!f.isCID(t))return u(()=>{r(new Error("Not a valid cid"))});const n=p(t);e.get(n,(e,n)=>{if(e)return r(e);r(null,new a(n,t))})},put(t,r){if(!a.isBlock(t))return u(()=>{r(new Error("invalid block"))});const n=p(t.cid);e.has(n,(i,o)=>i?r(i):o?r():void e.put(n,t.data,r))},putMany(t,r){const n=t.map(e=>({key:p(e.cid),block:e})),i=e.batch();c(n,(t,r)=>e.has(t.key,r),(e,t)=>{if(e)return r(e);t.forEach(e=>{i.put(e.key,e.block.data)}),i.commit(r)})},has(t,r){if(!f.isCID(t))return u(()=>{r(new Error("Not a valid cid"))});e.has(p(t),r)},delete(t,r){if(!f.isCID(t))return u(()=>{r(new Error("Not a valid cid"))});e.delete(p(t),r)},close(t){e.close(t)}}}e.exports=((e,t,r)=>{d(e,t,(e,t)=>{if(e)return r(e);r(null,y(t))})})},function(e,t,r){"use strict";(function(t){const n=r(5),i=r(46),o=r(26).Key,s=r(360),a=r(163),u=new o(s.SHARDING_FN),c=new o(s.README_FN);class f{constructor(e,t){this.child=new a(e,{convert:this._convertKey.bind(this),invert:this._invertKey.bind(this)}),this.shard=t}open(e){this.child.open(e)}_convertKey(e){const t=e.toString();if(t===u.toString()||t===c.toString())return e;const r=new o(this.shard.fun(t));return r.child(e)}_invertKey(e){const t=e.toString();return t===u.toString()||t===c.toString()?e:o.withNamespaces(e.list().slice(1))}static createOrOpen(e,t,r){f.create(e,t,t=>{if(t&&"datastore exists"!==t.message)return r(t);f.open(e,r)})}static open(e,t){n([t=>s.readShardFun("/",e,t),(t,r)=>{r(null,new f(e,t))}],t)}static create(e,r,n){e.has(u,(o,a)=>{if(o)return n(o);if(!a){const o="function"==typeof e.putRaw?e.putRaw.bind(e):e.put.bind(e);return i([e=>o(u,t.from(r.toString()+"\n"),e),e=>o(c,t.from(s.readme),e)],e=>n(e))}s.readShardFun("/",e,(e,t)=>{if(e)return n(e);const i=(t||"").toString(),o=r.toString();if(i!==o)return n(new Error(`specified fun ${o} does not match repo shard fun ${i}`));n(new Error("datastore exists"))})})}put(e,t,r){this.child.put(e,t,r)}get(e,t){this.child.get(e,t)}has(e,t){this.child.has(e,t)}delete(e,t){this.child.delete(e,t)}batch(){return this.child.batch()}query(e){const t={keysOnly:e.keysOnly,offset:e.offset,limit:e.limit,filters:[(e,t)=>t(null,e.key.toString()!==u.toString()),(e,t)=>t(null,e.key.toString()!==c.toString())]};if(null!=e.prefix&&t.filters.push((t,r)=>{r(null,this._invertKey(t.key).toString().startsWith(e.prefix))}),null!=e.filters){const r=e.filters.map(e=>(t,r)=>{e(Object.assign({},t,{key:this._invertKey(t.key)}),r)});t.filters=t.filters.concat(r)}return null!=e.orders&&(t.orders=e.orders.map(e=>(t,r)=>{t.forEach(e=>{e.key=this._invertKey(e.key)}),e(t,(e,t)=>{if(e)return r(e);t.forEach(e=>{e.key=this._convertKey(e.key)}),r(null,t)})})),this.child.query(t)}close(e){this.child.close(e)}}e.exports=f}).call(this,r(0).Buffer)},function(e,t,r){"use strict";e.exports="This is a repository of IPLD objects. Each IPLD object is in a single file,\nnamed <base32 encoding of cid>.data. Where <base32 encoding of cid> is the\n\"base32\" encoding of the CID (as specified in\nhttps://github.com/multiformats/multibase) without the 'B' prefix.\nAll the object files are placed in a tree of directories, based on a\nfunction of the CID. This is a form of sharding similar to\nthe objects directory in git repositories. Previously, we used\nprefixes, we now use the next-to-last two charters.\n func NextToLast(base32cid string) {\n nextToLastLen := 2\n offset := len(base32cid) - nextToLastLen - 1\n return str[offset : offset+nextToLastLen]\n }\nFor example, an object with a base58 CIDv1 of\n zb2rhYSxw4ZjuzgCnWSt19Q94ERaeFhu9uSqRgjSdx9bsgM6f\nhas a base32 CIDv1 of\n BAFKREIA22FLID5AJ2KU7URG47MDLROZIH6YF2KALU2PWEFPVI37YLKRSCA\nand will be placed at\n SC/AFKREIA22FLID5AJ2KU7URG47MDLROZIH6YF2KALU2PWEFPVI37YLKRSCA.data\nwith 'SC' being the last-to-next two characters and the 'B' at the\nbeginning of the CIDv1 string is the multibase prefix that is not\nstored in the filename.\n"},function(e,t,r){"use strict";const n=r(41),i=r(692),o=r(8),s=r(26).Key,a=r(26).utils,u=a.asyncFilter,c=a.asyncSort,f=a.replaceStartWith,l=r(163);class h{constructor(e){this.mounts=e.slice()}open(e){n(this.mounts,(e,t)=>{e.datastore.open(t)},e)}_lookup(e){for(let t of this.mounts)if(t.prefix.toString()===e.toString()||t.prefix.isAncestorOf(e)){const r=f(e.toString(),t.prefix.toString());return{datastore:t.datastore,mountpoint:t.prefix,rest:new s(r)}}}put(e,t,r){const n=this._lookup(e);null!=n?n.datastore.put(n.rest,t,r):r(new Error("No datastore mounted for this key"))}get(e,t){const r=this._lookup(e);null!=r?r.datastore.get(r.rest,t):t(new Error("No datastore mounted for this key"))}has(e,t){const r=this._lookup(e);null!=r?r.datastore.has(r.rest,t):t(null,!1)}delete(e,t){const r=this._lookup(e);null!=r?r.datastore.delete(r.rest,t):t(new Error("No datastore mounted for this key"))}close(e){n(this.mounts,(e,t)=>{e.datastore.close(t)},e)}batch(){const e={},t=t=>{const r=this._lookup(t);if(null==r)throw new Error("No datastore mounted for this key");const n=r.mountpoint.toString();return null==e[n]&&(e[n]=r.datastore.batch()),{batch:e[n],rest:r.rest}};return{put:(e,r)=>{const n=t(e);n.batch.put(n.rest,r)},delete:e=>{const r=t(e);r.batch.delete(r.rest)},commit:t=>{n(Object.keys(e),(t,r)=>{e[t].commit(r)},t)}}}query(e){const t=this.mounts.map(t=>{const r=new l(t.datastore,{convert:e=>{throw new Error("should never be called")},invert:e=>t.prefix.child(e)});let n;return null!=e.prefix&&(n=f(e.prefix,t.prefix.toString())),r.query({prefix:n,filters:e.filters,keysOnly:e.keysOnly})});let r=[i(t)];if(null!=e.filters&&(r=r.concat(e.filters.map(e=>u(e)))),null!=e.orders&&(r=r.concat(e.orders.map(e=>c(e)))),null!=e.offset){let t=0;r.push(o.filter(()=>t++>=e.offset))}return null!=e.limit&&r.push(o.take(e.limit)),o.apply(null,r)}}e.exports=h},function(e,t){e.exports=function(e){var t=!!e,r=(e||[]).map(s),n=0,i,o;function s(e){return{ready:!1,reading:!1,ended:!1,read:e,data:null}}function a(){if(o){u();var e=r.length,s=o;if(0===e&&(i||t))return o=null,void s(i||!0);for(var a=0;a<e;a++){var c=r[(n+a)%e];if(c.ready&&!c.ended){var f=c.data;return c.ready=!1,c.data=null,n++,o=null,s(null,f)}}}}function u(){for(var e=r.length;e--;)r[e].ended&&r.splice(e,1)}function c(){for(var e=r.length;e--;)!function(t){if(e>r.length)throw new Error("this should never happen");if(!(t.reading||t.ended||t.ready)){t.reading=!0;var n=!0;t.read(i,function e(r,o){t.data=o,t.ready=!0,t.reading=!1,!0===r||i?t.ended=!0:r&&(i=t.ended=r),i&&!r&&t.read(i,e),n||a()}),n=!1}}(r[e]);a()}function f(e,t){i=i||e,o=t,c()}return f.add=function(e){if(!e)return t=!0,c();r.push(s(e)),c()},f.cap=function(e){f.add(null)},f}},function(e,t,r){"use strict";const n=r(41),i=r(47);class o{constructor(e){this.stores=e.slice()}open(e){n(this.stores,(e,t)=>{e.open(t)},e)}put(e,t,r){n(this.stores,(r,n)=>{r.put(e,t,n)},r)}get(e,t){const r=this.stores.length;let n=!1,o=0;i(()=>!n&&o<r,t=>{const r=this.stores[o++];r.get(e,(e,r)=>{if(null==e)return n=!0,t(null,r);t()})},t)}has(e,t){const r=this.stores.length;let n=!1,o=0;i(()=>!n&&o<r,t=>{const r=this.stores[o++];r.has(e,(e,r)=>{if(null==e)return n=!0,t(null,r);t()})},t)}delete(e,t){n(this.stores,(t,r)=>{t.delete(e,r)},t)}close(e){n(this.stores,(e,t)=>{e.close(t)},e)}batch(){const e=this.stores.map(e=>e.batch());return{put:(t,r)=>{e.forEach(e=>e.put(t,r))},delete:t=>{e.forEach(e=>e.delete(t))},commit:t=>{n(e,(e,t)=>{e.commit(t)},t)}}}query(e){return this.stores[this.stores.length-1].query(e)}}e.exports=o},function(e,t,r){"use strict";const n=r(26).Key,i=r(163);class o extends i{constructor(e,t){super(e,{convert:e=>t.child(e),invert(e){if("/"===t.toString())return e;if(!t.isAncestorOf(e))throw new Error(`Expected prefix: (${t.toString()}) in key: ${e.toString()}`);return new n(e.toString().slice(t.toString().length),!1)}}),this.prefix=t}query(e){return e.prefix&&"/"!==this.prefix.toString()?super.query(Object.assign({},e,{prefix:this.prefix.child(new n(e.prefix)).toString()})):super.query(e)}}e.exports=o},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=s;var n=r(696),i=o(n);function o(e){return e&&e.__esModule?e:{default:e}}function s(e,t,r,n){(0,i.default)(e,t,function(e,t){r(e,function(e,r){t(e,!r)})},n)}e.exports=t.default},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=g;var n=r(222),i=p(n),o=r(125),s=p(o),a=r(697),u=p(a),c=r(54),f=p(c),l=r(32),h=p(l);function p(e){return e&&e.__esModule?e:{default:e}}function d(e,t,r,n){var i=new Array(t.length);e(t,function(e,t,n){r(e,function(e,r){i[t]=!!r,n(e)})},function(e){if(e)return n(e);for(var r=[],o=0;o<t.length;o++)i[o]&&r.push(t[o]);n(null,r)})}function y(e,t,r,n){var o=[];e(t,function(e,t,n){r(e,function(r,i){r?n(r):(i&&o.push({index:t,value:e}),n())})},function(e){e?n(e):n(null,(0,i.default)(o.sort(function(e,t){return e.index-t.index}),(0,u.default)("value")))})}function g(e,t,r,n){var i=(0,s.default)(t)?d:y;i(e,t,(0,h.default)(r),n||f.default)}e.exports=t.default},function(e,t){function r(e){return function(t){return null==t?void 0:t[e]}}e.exports=r},function(e,t,r){"use strict";e.exports={lock:"memory",storageBackends:{root:r(83),blocks:r(83),keys:r(83),datastore:r(83)},storageBackendOptions:{root:{extension:""},blocks:{sharding:!1},keys:{sharding:!1}}}},function(e,t,r){(function(t){var n=r(10).EventEmitter,i=r(106).inherits,o=r(27),s=r(700),a=r(703),u=r(704),c=r(366),f=r(13),l=r(368),h=c.WriteError,p=c.ReadError,d=c.NotFoundError,y=c.OpenError,g=c.InitializationError;function m(e,r,i){if(!(this instanceof m))return new m(e,r,i);var o;if(n.call(this),this.setMaxListeners(1/0),"function"==typeof r&&(i=r,r={}),r=r||{},!e||"object"!=typeof e){if(o=new g("First argument must be an abstract-leveldown compliant store"),"function"==typeof i)return t.nextTick(i,o);throw o}f.equal(typeof e.status,"string",".status required, old abstract-leveldown"),this.options=v(r),this._db=e,this.db=new s(e),this.open(i)}function b(e,t){return"function"==typeof e?e:t}function v(e){return"object"==typeof e&&null!==e?e:{}}function _(e,r){if(!e._isOpening()&&!e.isOpen())return t.nextTick(r,new p("Database is not open")),!0}m.prototype.emit=n.prototype.emit,m.prototype.once=n.prototype.once,i(m,n),m.prototype.open=function(e){var r=this,n;return e||(e=l(),n=e.promise),this.isOpen()?(t.nextTick(e,null,r),n):this._isOpening()?(this.once("open",function(){e(null,r)}),n):(this.emit("opening"),this.db.open(this.options,function(t){if(t)return e(new y(t));r.db=r._db,e(null,r),r.emit("open"),r.emit("ready")}),n)},m.prototype.close=function(e){var r=this,n;return e||(e=l(),n=e.promise),this.isOpen()?(this.db.close(function(){r.emit("closed"),e.apply(null,arguments)}),this.emit("closing"),this.db=new s(this._db)):this.isClosed()?t.nextTick(e):"closing"===this.db.status?this.once("closed",e):this._isOpening()&&this.once("open",function(){r.close(e)}),n},m.prototype.isOpen=function(){return"open"===this.db.status},m.prototype._isOpening=function(){return"opening"===this.db.status},m.prototype.isClosed=function(){return/^clos|new/.test(this.db.status)},m.prototype.get=function(e,t,r){if(null===e||void 0===e)throw new p("get() requires a key argument");var n;return r=b(t,r),r||(r=l(),n=r.promise),_(this,r)?n:(t=v(t),this.db.get(e,t,function(t,n){if(t)return t=/notfound/i.test(t)||t.notFound?new d("Key not found in database ["+e+"]",t):new p(t),r(t);r(null,n)}),n)},m.prototype.put=function(e,t,r,n){if(null===e||void 0===e)throw new h("put() requires a key argument");var i=this,o;return n=b(r,n),n||(n=l(),o=n.promise),_(this,n)?o:(r=v(r),this.db.put(e,t,r,function(r){if(r)return n(new h(r));i.emit("put",e,t),n()}),o)},m.prototype.del=function(e,t,r){if(null===e||void 0===e)throw new h("del() requires a key argument");var n=this,i;return r=b(t,r),r||(r=l(),i=r.promise),_(this,r)?i:(t=v(t),this.db.del(e,t,function(t){if(t)return r(new h(t));n.emit("del",e),r()}),i)},m.prototype.batch=function(e,t,r){if(!arguments.length)return new u(this);if(!Array.isArray(e))throw new h("batch() requires an array argument");var n=this,i;return r=b(t,r),r||(r=l(),i=r.promise),_(this,r)?i:(t=v(t),e=e.map(function(e){return e.type||void 0===e.key||void 0===e.value||(e.type="put"),e}),this.db.batch(e,t,function(t){if(t)return r(new h(t));n.emit("batch",e),r()}),i)},m.prototype.readStream=m.prototype.createReadStream=function(e){return e=o({keys:!0,values:!0},e),"number"!=typeof e.limit&&(e.limit=-1),new a(this.db.iterator(e),e)},m.prototype.keyStream=m.prototype.createKeyStream=function(e){return this.createReadStream(o(e,{keys:!0,values:!1}))},m.prototype.valueStream=m.prototype.createValueStream=function(e){return this.createReadStream(o(e,{keys:!1,values:!0}))},m.prototype.toString=function(){return"LevelUP"},m.errors=c,e.exports=m.default=m}).call(this,r(6))},function(e,t,r){var n=r(106),i=r(363).AbstractLevelDOWN,o=r(702),s="put get del batch".split(" ");function a(e){i.call(this,""),this._db=e,this._operations=[],this._iterators=[],c(this)}function u(e){s.concat("iterator").forEach(function(t){e["_"+t]=function(){return this._db[t].apply(this._db,arguments)}}),e._db.approximateSize&&(e.approximateSize=function(){return this._db.approximateSize.apply(this._db,arguments)})}function c(e){s.forEach(function(t){e["_"+t]=function(){this._operations.push({method:t,args:arguments})}}),"function"==typeof e._db.approximateSize&&(e.approximateSize=function(){this._operations.push({method:"approximateSize",args:arguments})}),e._iterator=function(e){var t=new o(e);return this._iterators.push(t),t}}n.inherits(a,i),a.prototype._open=function(e,t){var r=this;this._db.open(e,function(e){if(e)return t(e);r._operations.forEach(function(e){r._db[e.method].apply(r._db,e.args)}),r._operations=[],r._iterators.forEach(function(e){e.setDb(r._db)}),r._iterators=[],u(r),t()})},a.prototype._close=function(e){var t=this;this._db.close(function(r){if(r)return e(r);c(t),e()})},a.prototype._serializeKey=function(e){return e},a.prototype._serializeValue=function(e){return e},e.exports=a,e.exports.DeferredIterator=o},function(e,t,r){(function(t,n){const i=r(27),o=r(364),s=r(365),a=Object.prototype.hasOwnProperty,u="start end gt gte lt lte".split(" ");function c(e){if(!arguments.length||void 0===e)throw new Error("constructor requires at least a location argument");if("string"!=typeof e)throw new Error("constructor requires a location string argument");this.location=e,this.status="new"}function f(e){var t={};for(var r in e)a.call(e,r)&&(l(r)&&h(e[r])||(t[r]=e[r]));return t}function l(e){return-1!==u.indexOf(e)}function h(e){return""===e||null==e||p(e)}function p(e){return n.isBuffer(e)&&0===e.length}c.prototype.open=function(e,t){var r=this,n=this.status;if("function"==typeof e&&(t=e),"function"!=typeof t)throw new Error("open() requires a callback argument");"object"!=typeof e&&(e={}),e.createIfMissing=!1!==e.createIfMissing,e.errorIfExists=!!e.errorIfExists,this.status="opening",this._open(e,function(e){if(e)return r.status=n,t(e);r.status="open",t()})},c.prototype._open=function(e,r){t.nextTick(r)},c.prototype.close=function(e){var t=this,r=this.status;if("function"!=typeof e)throw new Error("close() requires a callback argument");this.status="closing",this._close(function(n){if(n)return t.status=r,e(n);t.status="closed",e()})},c.prototype._close=function(e){t.nextTick(e)},c.prototype.get=function(e,r,n){if("function"==typeof r&&(n=r),"function"!=typeof n)throw new Error("get() requires a callback argument");var i=this._checkKey(e,"key");if(i)return t.nextTick(n,i);e=this._serializeKey(e),"object"!=typeof r&&(r={}),r.asBuffer=!1!==r.asBuffer,this._get(e,r,n)},c.prototype._get=function(e,r,n){t.nextTick(function(){n(new Error("NotFound"))})},c.prototype.put=function(e,r,n,i){if("function"==typeof n&&(i=n),"function"!=typeof i)throw new Error("put() requires a callback argument");var o=this._checkKey(e,"key");if(o)return t.nextTick(i,o);e=this._serializeKey(e),r=this._serializeValue(r),"object"!=typeof n&&(n={}),this._put(e,r,n,i)},c.prototype._put=function(e,r,n,i){t.nextTick(i)},c.prototype.del=function(e,r,n){if("function"==typeof r&&(n=r),"function"!=typeof n)throw new Error("del() requires a callback argument");var i=this._checkKey(e,"key");if(i)return t.nextTick(n,i);e=this._serializeKey(e),"object"!=typeof r&&(r={}),this._del(e,r,n)},c.prototype._del=function(e,r,n){t.nextTick(n)},c.prototype.batch=function(e,r,n){if(!arguments.length)return this._chainedBatch();if("function"==typeof r&&(n=r),"function"==typeof e&&(n=e),"function"!=typeof n)throw new Error("batch(array) requires a callback argument");if(!Array.isArray(e))return t.nextTick(n,new Error("batch(array) requires an array argument"));r&&"object"==typeof r||(r={});for(var o=new Array(e.length),s=0;s<e.length;s++){if("object"!=typeof e[s]||null===e[s])return t.nextTick(n,new Error("batch(array) element must be an object and not `null`"));var a=i(e[s]);if("put"!==a.type&&"del"!==a.type)return t.nextTick(n,new Error("`type` must be 'put' or 'del'"));var u=this._checkKey(a.key,"key");if(u)return t.nextTick(n,u);a.key=this._serializeKey(a.key),"put"===a.type&&(a.value=this._serializeValue(a.value)),o[s]=a}this._batch(o,r,n)},c.prototype._batch=function(e,r,n){t.nextTick(n)},c.prototype._setupIteratorOptions=function(e){return e=f(e),e.reverse=!!e.reverse,e.keys=!1!==e.keys,e.values=!1!==e.values,e.limit="limit"in e?e.limit:-1,e.keyAsBuffer=!1!==e.keyAsBuffer,e.valueAsBuffer=!1!==e.valueAsBuffer,e},c.prototype.iterator=function(e){return"object"!=typeof e&&(e={}),e=this._setupIteratorOptions(e),this._iterator(e)},c.prototype._iterator=function(e){return new o(this)},c.prototype._chainedBatch=function(){return new s(this)},c.prototype._serializeKey=function(e){return n.isBuffer(e)?e:String(e)},c.prototype._serializeValue=function(e){return null==e?"":n.isBuffer(e)||t.browser?e:String(e)},c.prototype._checkKey=function(e,t){return null===e||void 0===e?new Error(t+" cannot be `null` or `undefined`"):n.isBuffer(e)&&0===e.length?new Error(t+" cannot be an empty Buffer"):""===String(e)?new Error(t+" cannot be an empty String"):void 0},e.exports=c}).call(this,r(6),r(0).Buffer)},function(e,t,r){var n=r(106),i=r(363).AbstractIterator;function o(e){i.call(this,e),this._options=e,this._iterator=null,this._operations=[]}n.inherits(o,i),o.prototype.setDb=function(e){var t=this._iterator=e.iterator(this._options);this._operations.forEach(function(e){t[e.method].apply(t,e.args)})},o.prototype._operation=function(e,t){if(this._iterator)return this._iterator[e].apply(this._iterator,t);this._operations.push({method:e,args:t})},"next end".split(" ").forEach(function(e){o.prototype["_"+e]=function(){this._operation(e,arguments)}}),e.exports=o},function(e,t,r){var n=r(4),i=r(21).Readable,o=r(27);function s(e,t){if(!(this instanceof s))return new s(e,t);t=t||{},i.call(this,o(t,{objectMode:!0})),this._iterator=e,this._destroyed=!1,this._options=t,this.on("end",this._cleanup.bind(this))}e.exports=s,n(s,i),s.prototype._read=function(){var e=this,t=this._options;this._destroyed||this._iterator.next(function(r,n,i){if(!e._destroyed)return r?e.emit("error",r):void(void 0===n&&void 0===i?e.push(null):!1!==t.keys&&!1===t.values?e.push(n):!1===t.keys&&!1!==t.values?e.push(i):e.push({key:n,value:i}))})},s.prototype.destroy=s.prototype._cleanup=function(){var e=this;this._destroyed||(this._destroyed=!0,this._iterator.end(function(t){if(t)return e.emit("error",t);e.emit("close")}))}},function(e,t,r){var n=r(366).WriteError,i=r(368);function o(e){this._levelup=e,this.batch=e.db.batch(),this.ops=[],this.length=0}o.prototype.put=function(e,t){try{this.batch.put(e,t)}catch(e){throw new n(e)}return this.ops.push({type:"put",key:e,value:t}),this.length++,this},o.prototype.del=function(e){try{this.batch.del(e)}catch(e){throw new n(e)}return this.ops.push({type:"del",key:e}),this.length++,this},o.prototype.clear=function(){try{this.batch.clear()}catch(e){throw new n(e)}return this.ops=[],this.length=0,this},o.prototype.write=function(e){var t=this._levelup,r=this.ops,o;e||(e=i(),o=e.promise);try{this.batch.write(function(i){if(i)return e(new n(i));t.emit("batch",r),e()})}catch(e){throw new n(e)}return o},e.exports=o},function(e,t,r){var n=r(706);function i(e,t,r){t&&"string"!=typeof t&&(t=t.message||t.name),n(this,{type:e,name:e,cause:"string"!=typeof t?t:r,message:t},"ewr")}function o(e,t){Error.call(this),Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor),i.call(this,"CustomError",e,t)}function s(e,t,r){var n=function(r,o){i.call(this,t,r,o),"FilesystemError"==t&&(this.code=this.cause.code,this.path=this.cause.path,this.errno=this.cause.errno,this.message=(e.errno[this.cause.errno]?e.errno[this.cause.errno].description:this.cause.message)+(this.cause.path?" ["+this.cause.path+"]":"")),Error.call(this),Error.captureStackTrace&&Error.captureStackTrace(this,n)};return n.prototype=r?new r:new o,n}o.prototype=new Error,e.exports=function(e){var t=function(t,r){return s(e,t,r)};return{CustomError:o,FilesystemError:t("FilesystemError"),createError:t}}},function(e,t){
|
||
/*!
|
||
* prr
|
||
* (c) 2013 Rod Vagg <rod@vagg.org>
|
||
* https://github.com/rvagg/prr
|
||
* License: MIT
|
||
*/
|
||
var r,n,i;r="prr",n=this,i=function(){var e="function"==typeof Object.defineProperty?function(e,t,r){return Object.defineProperty(e,t,r),e}:function(e,t,r){return e[t]=r.value,e},t=function(e,t){var r="object"==typeof t,n=!r&&"string"==typeof t,i=function(e){return r?!!t[e]:!!n&&t.indexOf(e[0])>-1};return{enumerable:i("enumerable"),configurable:i("configurable"),writable:i("writable"),value:e}},r=function(r,n,i,o){var s;if(o=t(i,o),"object"==typeof n){for(s in n)Object.hasOwnProperty.call(n,s)&&(o.value=n[s],e(r,s,o));return r}return e(r,n,o)};return r},void 0!==e&&e.exports?e.exports=i():n.prr=i()},function(e,t,r){"use strict";var n=r(223).AbstractLevelDOWN,i=r(223).AbstractChainedBatch,o=r(223).AbstractIterator,s=r(4),a=r(27),u=r(709),c=r(711).EncodingError;function f(e,t){if(!(this instanceof f))return new f(e,t);n.call(this,""),t=t||{},void 0===t.keyEncoding&&(t.keyEncoding="utf8"),void 0===t.valueEncoding&&(t.valueEncoding="utf8"),this.db=e,this.codec=new u(t)}function l(e,t){o.call(this,e),this.codec=e.codec,this.keys=t.keys,this.values=t.values,this.opts=this.codec.encodeLtgt(t),this.it=e.db.iterator(this.opts)}function h(e,t){i.call(this,e),this.codec=e.codec,this.batch=e.db.batch()}e.exports=f.default=f,s(f,n),f.prototype._serializeKey=f.prototype._serializeValue=function(e){return e},f.prototype._open=function(e,t){this.db.open(e,t)},f.prototype._close=function(e){this.db.close(e)},f.prototype._put=function(e,t,r,n){e=this.codec.encodeKey(e,r),t=this.codec.encodeValue(t,r),this.db.put(e,t,r,n)},f.prototype._get=function(e,t,r){var n=this;e=this.codec.encodeKey(e,t),t.asBuffer=this.codec.valueAsBuffer(t),this.db.get(e,t,function(e,i){if(e)return r(e);try{i=n.codec.decodeValue(i,t)}catch(e){return r(new c(e))}r(null,i)})},f.prototype._del=function(e,t,r){e=this.codec.encodeKey(e,t),this.db.del(e,t,r)},f.prototype._chainedBatch=function(){return new h(this)},f.prototype._batch=function(e,t,r){e=this.codec.encodeBatch(e,t),this.db.batch(e,t,r)},f.prototype._iterator=function(e){return e.keyAsBuffer=this.codec.keyAsBuffer(e),e.valueAsBuffer=this.codec.valueAsBuffer(e),new l(this,e)},f.prototype._setupIteratorOptions=function(e){return e=a(e),e.reverse=!!e.reverse,e.keys=!1!==e.keys,e.values=!1!==e.values,e.limit="limit"in e?e.limit:-1,e.keyAsBuffer=!1!==e.keyAsBuffer,e.valueAsBuffer=!1!==e.valueAsBuffer,e},f.prototype.approximateSize=function(e,t,r,n){return this.db.approximateSize(e,t,r,n)},s(l,o),l.prototype._next=function(e){var t=this;this.it.next(function(r,n,i){if(r)return e(r);try{n=t.keys&&void 0!==n?t.codec.decodeKey(n,t.opts):void 0,i=t.values&&void 0!==i?t.codec.decodeValue(i,t.opts):void 0}catch(r){return e(new c(r))}e(null,n,i)})},l.prototype._end=function(e){this.it.end(e)},s(h,i),h.prototype._put=function(e,t){e=this.codec.encodeKey(e),t=this.codec.encodeValue(t),this.batch.put(e,t)},h.prototype._del=function(e){e=this.codec.encodeKey(e),this.batch.del(e)},h.prototype._clear=function(){this.batch.clear()},h.prototype._write=function(e,t){this.batch.write(e,t)}},function(e,t,r){(function(t,n){var i=r(27),o=r(369),s=r(370),a=Object.prototype.hasOwnProperty,u="start end gt gte lt lte".split(" ");function c(e){if(!arguments.length||void 0===e)throw new Error("constructor requires at least a location argument");if("string"!=typeof e)throw new Error("constructor requires a location string argument");this.location=e,this.status="new"}function f(e){var t={};for(var r in e)a.call(e,r)&&(l(r)&&h(e[r])||(t[r]=e[r]));return t}function l(e){return-1!==u.indexOf(e)}function h(e){return""===e||null==e||p(e)}function p(e){return n.isBuffer(e)&&0===e.length}c.prototype.open=function(e,t){var r=this,n=this.status;if("function"==typeof e&&(t=e),"function"!=typeof t)throw new Error("open() requires a callback argument");"object"!=typeof e&&(e={}),e.createIfMissing=!1!==e.createIfMissing,e.errorIfExists=!!e.errorIfExists,this.status="opening",this._open(e,function(e){if(e)return r.status=n,t(e);r.status="open",t()})},c.prototype._open=function(e,r){t.nextTick(r)},c.prototype.close=function(e){var t=this,r=this.status;if("function"!=typeof e)throw new Error("close() requires a callback argument");this.status="closing",this._close(function(n){if(n)return t.status=r,e(n);t.status="closed",e()})},c.prototype._close=function(e){t.nextTick(e)},c.prototype.get=function(e,r,n){if("function"==typeof r&&(n=r),"function"!=typeof n)throw new Error("get() requires a callback argument");var i=this._checkKey(e,"key");if(i)return t.nextTick(n,i);e=this._serializeKey(e),"object"!=typeof r&&(r={}),r.asBuffer=!1!==r.asBuffer,this._get(e,r,n)},c.prototype._get=function(e,r,n){t.nextTick(function(){n(new Error("NotFound"))})},c.prototype.put=function(e,r,n,i){if("function"==typeof n&&(i=n),"function"!=typeof i)throw new Error("put() requires a callback argument");var o=this._checkKey(e,"key");if(o)return t.nextTick(i,o);e=this._serializeKey(e),r=this._serializeValue(r),"object"!=typeof n&&(n={}),this._put(e,r,n,i)},c.prototype._put=function(e,r,n,i){t.nextTick(i)},c.prototype.del=function(e,r,n){if("function"==typeof r&&(n=r),"function"!=typeof n)throw new Error("del() requires a callback argument");var i=this._checkKey(e,"key");if(i)return t.nextTick(n,i);e=this._serializeKey(e),"object"!=typeof r&&(r={}),this._del(e,r,n)},c.prototype._del=function(e,r,n){t.nextTick(n)},c.prototype.batch=function(e,r,n){if(!arguments.length)return this._chainedBatch();if("function"==typeof r&&(n=r),"function"==typeof e&&(n=e),"function"!=typeof n)throw new Error("batch(array) requires a callback argument");if(!Array.isArray(e))return t.nextTick(n,new Error("batch(array) requires an array argument"));r&&"object"==typeof r||(r={});for(var o=new Array(e.length),s=0;s<e.length;s++){if("object"!=typeof e[s]||null===e[s])return t.nextTick(n,new Error("batch(array) element must be an object and not `null`"));var a=i(e[s]);if("put"!==a.type&&"del"!==a.type)return t.nextTick(n,new Error("`type` must be 'put' or 'del'"));var u=this._checkKey(a.key,"key");if(u)return t.nextTick(n,u);a.key=this._serializeKey(a.key),"put"===a.type&&(a.value=this._serializeValue(a.value)),o[s]=a}this._batch(o,r,n)},c.prototype._batch=function(e,r,n){t.nextTick(n)},c.prototype._setupIteratorOptions=function(e){return e=f(e),e.reverse=!!e.reverse,e.keys=!1!==e.keys,e.values=!1!==e.values,e.limit="limit"in e?e.limit:-1,e.keyAsBuffer=!1!==e.keyAsBuffer,e.valueAsBuffer=!1!==e.valueAsBuffer,e},c.prototype.iterator=function(e){return"object"!=typeof e&&(e={}),e=this._setupIteratorOptions(e),this._iterator(e)},c.prototype._iterator=function(e){return new o(this)},c.prototype._chainedBatch=function(){return new s(this)},c.prototype._serializeKey=function(e){return n.isBuffer(e)?e:String(e)},c.prototype._serializeValue=function(e){return null==e?"":n.isBuffer(e)||t.browser?e:String(e)},c.prototype._checkKey=function(e,t){return null===e||void 0===e?new Error(t+" cannot be `null` or `undefined`"):n.isBuffer(e)&&0===e.length?new Error(t+" cannot be an empty Buffer"):""===String(e)?new Error(t+" cannot be an empty String"):void 0},e.exports=c}).call(this,r(6),r(0).Buffer)},function(e,t,r){var n=r(710);function i(e){if(!(this instanceof i))return new i(e);this.opts=e||{},this.encodings=n}e.exports=i,i.prototype._encoding=function(e){return"string"==typeof e&&(e=n[e]),e||(e=n.id),e},i.prototype._keyEncoding=function(e,t){return this._encoding(t&&t.keyEncoding||e&&e.keyEncoding||this.opts.keyEncoding)},i.prototype._valueEncoding=function(e,t){return this._encoding(t&&(t.valueEncoding||t.encoding)||e&&(e.valueEncoding||e.encoding)||this.opts.valueEncoding||this.opts.encoding)},i.prototype.encodeKey=function(e,t,r){return this._keyEncoding(t,r).encode(e)},i.prototype.encodeValue=function(e,t,r){return this._valueEncoding(t,r).encode(e)},i.prototype.decodeKey=function(e,t){return this._keyEncoding(t).decode(e)},i.prototype.decodeValue=function(e,t){return this._valueEncoding(t).decode(e)},i.prototype.encodeBatch=function(e,t){var r=this;return e.map(function(e){var n={type:e.type,key:r.encodeKey(e.key,t,e)};return r.keyAsBuffer(t,e)&&(n.keyEncoding="binary"),e.prefix&&(n.prefix=e.prefix),"value"in e&&(n.value=r.encodeValue(e.value,t,e),r.valueAsBuffer(t,e)&&(n.valueEncoding="binary")),n})};var o=["lt","gt","lte","gte","start","end"];i.prototype.encodeLtgt=function(e){var t=this,r={};return Object.keys(e).forEach(function(n){r[n]=o.indexOf(n)>-1?t.encodeKey(e[n],e):e[n]}),r},i.prototype.createStreamDecoder=function(e){var t=this;return e.keys&&e.values?function(r,n){return{key:t.decodeKey(r,e),value:t.decodeValue(n,e)}}:e.keys?function(r){return t.decodeKey(r,e)}:e.values?function(r,n){return t.decodeValue(n,e)}:function(){}},i.prototype.keyAsBuffer=function(e){return this._keyEncoding(e).buffer},i.prototype.valueAsBuffer=function(e){return this._valueEncoding(e).buffer}},function(e,t,r){(function(e){t.utf8=t["utf-8"]={encode:function(e){return i(e)?e:String(e)},decode:n,buffer:!1,type:"utf8"},t.json={encode:JSON.stringify,decode:JSON.parse,buffer:!1,type:"json"},t.binary={encode:function(t){return i(t)?t:e.from(t)},decode:n,buffer:!0,type:"binary"},t.none={encode:n,decode:n,buffer:!1,type:"id"},t.id=t.none;var r=["hex","ascii","base64","ucs2","ucs-2","utf16le","utf-16le"];function n(e){return e}function i(t){return void 0===t||null===t||e.isBuffer(t)}r.forEach(function(r){t[r]={encode:function(t){return i(t)?t:e.from(t,r)},decode:function(e){return e.toString(r)},buffer:!0,type:r}})}).call(this,r(0).Buffer)},function(e,t,r){var n=r(367).create,i=n("LevelUPError"),o=n("NotFoundError",i);o.prototype.notFound=!0,o.prototype.status=404,e.exports={LevelUPError:i,InitializationError:n("InitializationError",i),OpenError:n("OpenError",i),ReadError:n("ReadError",i),WriteError:n("WriteError",i),NotFoundError:o,EncodingError:n("EncodingError",i)}},function(e,t,r){(function(t,n){e.exports=u;var i=r(371).AbstractLevelDOWN,o=r(106),s=r(714),a=r(27);function u(e){if(!(this instanceof u))return new u(e);i.call(this,e)}o.inherits(u,i),u.prototype._open=function(e,t){var r=this;if(this._idbOpts=a({storeName:this.location,keyEncoding:"none",valueEncoding:"none"},e),this._idbOpts.idb)o(this._idbOpts.idb);else{var n=indexedDB.open(this.location);n.onerror=i,n.onsuccess=function(){o(n.result)}}function i(e){t(e.target.error)}function o(n){r._db=n;var i=r._db.objectStoreNames.contains(r._idbOpts.storeName);if(e.errorIfExists&&i)return r._db.close(),void t(new Error("store already exists"));if(!e.createIfMissing&&!i)return r._db.close(),void t(new Error("store does not exist"));if(e.createIfMissing&&!i){r._db.close();var o=indexedDB.open(r.location,r._db.version+1);return o.onerror=function(e){t(e.target.error)},o.onupgradeneeded=function(){var e=o.result;e.createObjectStore(r._idbOpts.storeName,r._idbOpts)},void(o.onsuccess=function(){r._db=o.result,t(null,r)})}t(null,r)}},u.prototype._get=function(e,r,n){r=a(this._idbOpts,r);var i=e;"binary"!==r.keyEncoding||Array.isArray(e)||(e=Array.prototype.slice.call(e));var o=this._db.transaction(this._idbOpts.storeName),s=o.objectStore(this._idbOpts.storeName).openCursor(IDBKeyRange.only(e));o.onabort=function(){n(o.error)},s.onsuccess=function(){var e=s.result;if(e){var o=e.value;if(o instanceof Uint8Array&&(o=new t(o)),"binary"!==r.valueEncoding||t.isBuffer(o)||(o=new t(o)),r.asBuffer&&!t.isBuffer(o))if(null==o)o=new t(0);else if("string"==typeof o)o=new t(o);else if("boolean"==typeof o)o=new t(String(o));else if("number"==typeof o)o=new t(String(o));else if(Array.isArray(o))o=new t(String(o));else{if(!(o instanceof Uint8Array))return void n(new TypeError("can't coerce `"+o.constructor.name+"` into a Buffer"));o=new t(o)}n(null,o,i)}else n(new Error("NotFound"))}},u.prototype._del=function(e,t,r){t=a(this._idbOpts,t),"binary"!==t.keyEncoding||Array.isArray(e)||(e=Array.prototype.slice.call(e));var n="readwrite";!0===t.sync&&(n="readwriteflush");var i=this._db.transaction(this._idbOpts.storeName,n),o=i.objectStore(this._idbOpts.storeName).delete(e);i.onabort=function(){r(i.error)},i.oncomplete=function(){r()}},u.prototype._put=function(e,t,r,n){r=a(this._idbOpts,r),"binary"!==r.keyEncoding||Array.isArray(e)||(e=Array.prototype.slice.call(e));var i="readwrite";!0===r.sync&&(i="readwriteflush");var o=this._db.transaction(this._idbOpts.storeName,i),s=o.objectStore(this._idbOpts.storeName).put(t,e);o.onabort=function(){n(o.error)},o.oncomplete=function(){n()}},u.prototype._iterator=function(e){return new s(this,e)},u.prototype._batch=function(e,t,r){if(0===e.length)return n.nextTick(r);var i="readwrite";!0===t.sync&&(i="readwriteflush");var o=this._db.transaction(this._idbOpts.storeName,i),s=o.objectStore(this._idbOpts.storeName);o.onabort=function(){r(o.error)},o.oncomplete=function(){r()},e.forEach(function(e){var r=a(t,e);"binary"!==r.keyEncoding||Array.isArray(e.key)||(e.key=Array.prototype.slice.call(e.key)),"del"===e.type?s.delete(e.key):s.put(e.value,e.key)})},u.prototype._close=function(e){this._db.close(),n.nextTick(e)},u.prototype._approximateSize=function(e,t,r){var i=new Error("Not implemented");if(!r)throw i;n.nextTick(function(){r(i)})},u.destroy=function(e,t){var r;if(null!=e&&"object"==typeof e)r=a({location:e.location,storeName:e.location},e._idbOpts);else{if("string"!=typeof e)throw new TypeError("location must be a string or an object");r={location:e,storeName:e}}if("string"!=typeof r.location)throw new TypeError("location must be a string");if("string"!=typeof r.storeName)throw new TypeError("db.storeName must be a string");var n=indexedDB.open(r.location);n.onerror=function(e){t(e.target.error)},n.onsuccess=function(){var e=n.result;function i(e){var r=indexedDB.deleteDatabase(e);r.onerror=function(e){t(e.target.error)},r.onsuccess=function(){t()}}if(e.close(),0!==e.objectStoreNames.length)if(e.objectStoreNames.contains(r.storeName)){var o=indexedDB.open(r.location,e.version+1);o.onerror=function(e){t(e.target.error)},o.onupgradeneeded=function(){e=o.result,e.deleteObjectStore(r.storeName)},o.onsuccess=function(){e=o.result,e.close(),0===e.objectStoreNames.length?i(r.location):t()}}else t();else i(r.location)}}}).call(this,r(0).Buffer,r(6))},function(e,t,r){var n=r(372);function i(e){return!(!e||"object"!=typeof e)&&Object.keys(n.prototype).filter(function(e){return"_"!=e[0]&&"approximateSize"!=e}).every(function(t){return"function"==typeof e[t]})}e.exports=i},function(e,t,r){(function(t,n){var i=r(106),o=r(371).AbstractIterator,s=r(715),a=r(716),u=r(92),c=r(27),f=u.Writable;function l(e,t){if(this._db=e._db,this._idbOpts=e._idbOpts,o.call(this,e),this._options=c({snapshot:!0},this._idbOpts,t),this._limit=this._options.limit,null!=this._limit&&-1!==this._limit||(this._limit=1/0),"number"!=typeof this._limit)throw new TypeError("options.limit must be a number");0!==this._limit&&(this._count=0,this._startCursor(this._options))}e.exports=l,i.inherits(l,o),l.prototype._startCursor=function(e){e=c(this._options,e);var t=this,r=null,n=s.lowerBound(e),i=s.upperBound(e),o=s.lowerBoundExclusive(e),u=s.upperBoundExclusive(e),l=e.reverse?"prev":"next";if(n&&("binary"!==e.keyEncoding||Array.isArray(n)||(n=Array.prototype.slice.call(n))),i&&("binary"!==e.keyEncoding||Array.isArray(i)||(i=Array.prototype.slice.call(i))),n&&i)try{r=IDBKeyRange.bound(n,i,o,u)}catch(e){return void(this._keyRangeError=!0)}else n?r=IDBKeyRange.lowerBound(n,o):i&&(r=IDBKeyRange.upperBound(i,u));this._reader=a(this._db,this._idbOpts.storeName,c(e,{range:r,direction:l})),this._reader.on("error",function(e){var r=t._callback;t._callback=!1,r?r(e):t._readNext=function(t){t(e)}}),this._reader.pipe(new f({objectMode:!0,write:function(e,r,n){if(t._count++>=t._limit)return t._reader.pause(),t._reader.unpipe(this),n(),void this.end();var i=t._callback;t._callback=!1,i?t._processItem(e,function(e,t,r){n(e),i(e,t,r)}):t._readNext=function(r){t._processItem(e,function(e,t,i){n(e),r(e,t,i)})}}})).on("finish",function(){var e=t._callback;t._callback=!1,e?e():t._readNext=function(e){e()}})},l.prototype._processItem=function(e,r){if("function"!=typeof r)throw new TypeError("cb must be a function");var n=e.key,i=e.value;if(i instanceof Uint8Array&&(i=new t(i)),"binary"===this._options.keyEncoding&&Array.isArray(n)&&(n=new t(n)),"binary"!==this._options.valueEncoding||t.isBuffer(i)||(i=new t(i)),this._options.keyAsBuffer&&!t.isBuffer(n))if(null==n)n=new t(0);else if("string"==typeof n)n=new t(n);else if("boolean"==typeof n)n=new t(String(n));else if("number"==typeof n)n=new t(String(n));else if(Array.isArray(n))n=new t(String(n));else{if(!(n instanceof Uint8Array))throw new TypeError("can't coerce `"+n.constructor.name+"` into a Buffer");n=new t(n)}if(this._options.valueAsBuffer&&!t.isBuffer(i))if(null==i)i=new t(0);else if("string"==typeof i)i=new t(i);else if("boolean"==typeof i)i=new t(String(i));else if("number"==typeof i)i=new t(String(i));else if(Array.isArray(i))i=new t(String(i));else{if(!(i instanceof Uint8Array))throw new TypeError("can't coerce `"+i.constructor.name+"` into a Buffer");i=new t(i)}r(null,n,i)},l.prototype._next=function(e){if(this._callback)throw new Error("callback already exists");if(this._keyRangeError||0===this._limit)e();else{var t=this._readNext;this._readNext=!1,t?n.nextTick(function(){t(e)}):this._callback=e}}}).call(this,r(0).Buffer,r(6))},function(e,t,r){(function(e){function r(e){return void 0!==e&&""!==e}function n(e,t){return Object.hasOwnProperty.call(e,t)}function i(e,t){return Object.hasOwnProperty.call(e,t)&&t}t.compare=function(t,r){if(e.isBuffer(t)){for(var n=Math.min(t.length,r.length),i=0;i<n;i++){var o=t[i]-r[i];if(o)return o}return t.length-r.length}return t<r?-1:t>r?1:0};var o=t.lowerBoundKey=function(e){return i(e,"gt")||i(e,"gte")||i(e,"min")||(e.reverse?i(e,"end"):i(e,"start"))||void 0},s=t.lowerBound=function(e,t){var r=o(e);return r?e[r]:t},a=t.lowerBoundInclusive=function(e){return!n(e,"gt")},u=t.upperBoundInclusive=function(e){return!n(e,"lt")},c=t.lowerBoundExclusive=function(e){return!a(e)},f=t.upperBoundExclusive=function(e){return!u(e)},l=t.upperBoundKey=function(e){return i(e,"lt")||i(e,"lte")||i(e,"max")||(e.reverse?i(e,"start"):i(e,"end"))||void 0},h=t.upperBound=function(e,t){var r=l(e);return r?e[r]:t};function p(e){return e}t.start=function(e,t){return e.reverse?h(e,t):s(e,t)},t.end=function(e,t){return e.reverse?s(e,t):h(e,t)},t.startInclusive=function(e){return e.reverse?u(e):a(e)},t.endInclusive=function(e){return e.reverse?a(e):u(e)},t.toLtgt=function(e,r,i,o,s){r=r||{},i=i||p;var a=arguments.length>3,u=t.lowerBoundKey(e),c=t.upperBoundKey(e);return u?"gt"===u?r.gt=i(e.gt,!1):r.gte=i(e[u],!1):a&&(r.gte=i(o,!1)),c?"lt"===c?r.lt=i(e.lt,!0):r.lte=i(e[c],!0):a&&(r.lte=i(s,!0)),null!=e.reverse&&(r.reverse=!!e.reverse),n(r,"max")&&delete r.max,n(r,"min")&&delete r.min,n(r,"start")&&delete r.start,n(r,"end")&&delete r.end,r},t.contains=function(e,n,i){i=i||t.compare;var o=s(e);if(r(o)){var a=i(n,o);if(a<0||0===a&&c(e))return!1}var u=h(e);if(r(u)){var a=i(n,u);if(a>0||0===a&&f(e))return!1}return!0},t.filter=function(e,r){return function(n){return t.contains(e,n,r)}}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";var n=r(92),i=r(27);function o(e,t,r){if("object"!=typeof e)throw new TypeError("db must be an object");if("string"!=typeof t)throw new TypeError("storeName must be a string");if(null==r&&(r={}),"object"!=typeof r)throw new TypeError("opts must be an object");var o=new n.Transform(i(r,{objectMode:!0,transform:function(e,t,r){r(null,e)}}));r=i({snapshot:!1},r);var s=null;function a(){var n,i,u,c,f=r.direction||"next",l=r.range||{},h;n=l.lower,i=l.upper,u=!!l.lowerOpen,c=!!l.upperOpen,s&&("next"===f?(u=!0,n=s):(c=!0,i=s)),n&&i?h=IDBKeyRange.bound(n,i,u,c):n?h=IDBKeyRange.lowerBound(n,u):i&&(h=IDBKeyRange.upperBound(i,c));var p=e.transaction(t,"readonly"),d=p.objectStore(t);o._cursorsOpened++;var y=d.openCursor(h,r.direction);function g(e){try{e.continue()}catch(e){"TransactionInactiveError"!==e.name||r.snapshot?o.emit("error",e):a()}}y.onsuccess=function(){var e=y.result;if(e){s=e.key;var t=o.write({key:e.key,value:e.value});r.snapshot||t?g(e):o.once("drain",function(){g(e)})}else o.end()},p.onabort=function(){o.emit("error",p.error)},p.onerror=function(){o.emit("error",p.error)}}return o._cursorsOpened=0,a(),o}e.exports=o},function(e,t,r){e.exports=r(207)},function(e,t,r){e.exports=r(89)},function(e,t,r){e.exports=r(21).Transform},function(e,t,r){e.exports=r(21).PassThrough},function(e,t,r){"use strict";t.ERR_REPO_NOT_INITIALIZED="ERR_REPO_NOT_INITIALIZED"},function(e,t,r){"use strict";e.exports={repoVersion:6}},function(e,t){e.exports=function(){var e,t,r,n,i;function o(o){return i?i(o):(e=o,function(e,i){t?t(e,i):(n=e,r=i)})}return o.resolve=function(o){if(i)throw new Error("already resolved");if(i=o,!i)throw new Error("resolve *must* be passed a transform stream");e&&(t=i(e),r&&t(n,r))},o}},function(e,t,r){"use strict";(function(t){const n=r(48),i=r(49),o=r(379),s=r(727),a=o.toCallback,u=o.toBuf,c=o.fromString,f=o.fromNumberTo32BitBuf,l=(e,r)=>{s.sha2256(e,(e,n)=>{e&&r(e),s.sha2256(t.from(n),r)})};e.exports={sha1:s.sha1,sha2256:s.sha2256,sha2512:s.sha2512,sha3512:a(u(n.sha3_512)),sha3384:a(u(n.sha3_384)),sha3256:a(u(n.sha3_256)),sha3224:a(u(n.sha3_224)),shake128:a(u(n.shake_128,128)),shake256:a(u(n.shake_256,256)),keccak224:a(u(n.keccak_224)),keccak256:a(u(n.keccak_256)),keccak384:a(u(n.keccak_384)),keccak512:a(u(n.keccak_512)),murmur3128:a(u(c(i.x64.hash128))),murmur332:a(f(c(i.x86.hash32))),addBlake:r(729),dblSha2256:l}}).call(this,r(0).Buffer)},function(e,t){(function(t){e.exports=t}).call(this,{})},function(e,t,r){!function(r,n){"use strict";var i={version:"3.0.1",x86:{},x64:{}};function o(e,t){return(65535&e)*t+(((e>>>16)*t&65535)<<16)}function s(e,t){return e<<t|e>>>32-t}function a(e){return e^=e>>>16,e=o(e,2246822507),e^=e>>>13,e=o(e,3266489909),e^=e>>>16,e}function u(e,t){e=[e[0]>>>16,65535&e[0],e[1]>>>16,65535&e[1]],t=[t[0]>>>16,65535&t[0],t[1]>>>16,65535&t[1]];var r=[0,0,0,0];return r[3]+=e[3]+t[3],r[2]+=r[3]>>>16,r[3]&=65535,r[2]+=e[2]+t[2],r[1]+=r[2]>>>16,r[2]&=65535,r[1]+=e[1]+t[1],r[0]+=r[1]>>>16,r[1]&=65535,r[0]+=e[0]+t[0],r[0]&=65535,[r[0]<<16|r[1],r[2]<<16|r[3]]}function c(e,t){e=[e[0]>>>16,65535&e[0],e[1]>>>16,65535&e[1]],t=[t[0]>>>16,65535&t[0],t[1]>>>16,65535&t[1]];var r=[0,0,0,0];return r[3]+=e[3]*t[3],r[2]+=r[3]>>>16,r[3]&=65535,r[2]+=e[2]*t[3],r[1]+=r[2]>>>16,r[2]&=65535,r[2]+=e[3]*t[2],r[1]+=r[2]>>>16,r[2]&=65535,r[1]+=e[1]*t[3],r[0]+=r[1]>>>16,r[1]&=65535,r[1]+=e[2]*t[2],r[0]+=r[1]>>>16,r[1]&=65535,r[1]+=e[3]*t[1],r[0]+=r[1]>>>16,r[1]&=65535,r[0]+=e[0]*t[3]+e[1]*t[2]+e[2]*t[1]+e[3]*t[0],r[0]&=65535,[r[0]<<16|r[1],r[2]<<16|r[3]]}function f(e,t){return t%=64,32===t?[e[1],e[0]]:t<32?[e[0]<<t|e[1]>>>32-t,e[1]<<t|e[0]>>>32-t]:(t-=32,[e[1]<<t|e[0]>>>32-t,e[0]<<t|e[1]>>>32-t])}function l(e,t){return t%=64,0===t?e:t<32?[e[0]<<t|e[1]>>>32-t,e[1]<<t]:[e[1]<<t-32,0]}function h(e,t){return[e[0]^t[0],e[1]^t[1]]}function p(e){return e=h(e,[0,e[0]>>>1]),e=c(e,[4283543511,3981806797]),e=h(e,[0,e[0]>>>1]),e=c(e,[3301882366,444984403]),e=h(e,[0,e[0]>>>1]),e}i.x86.hash32=function(e,t){e=e||"",t=t||0;for(var r=e.length%4,n=e.length-r,i=t,u=0,c=3432918353,f=461845907,l=0;l<n;l+=4)u=255&e.charCodeAt(l)|(255&e.charCodeAt(l+1))<<8|(255&e.charCodeAt(l+2))<<16|(255&e.charCodeAt(l+3))<<24,u=o(u,c),u=s(u,15),u=o(u,f),i^=u,i=s(i,13),i=o(i,5)+3864292196;switch(u=0,r){case 3:u^=(255&e.charCodeAt(l+2))<<16;case 2:u^=(255&e.charCodeAt(l+1))<<8;case 1:u^=255&e.charCodeAt(l),u=o(u,c),u=s(u,15),u=o(u,f),i^=u}return i^=e.length,i=a(i),i>>>0},i.x86.hash128=function(e,t){e=e||"",t=t||0;for(var r=e.length%16,n=e.length-r,i=t,u=t,c=t,f=t,l=0,h=0,p=0,d=0,y=597399067,g=2869860233,m=951274213,b=2716044179,v=0;v<n;v+=16)l=255&e.charCodeAt(v)|(255&e.charCodeAt(v+1))<<8|(255&e.charCodeAt(v+2))<<16|(255&e.charCodeAt(v+3))<<24,h=255&e.charCodeAt(v+4)|(255&e.charCodeAt(v+5))<<8|(255&e.charCodeAt(v+6))<<16|(255&e.charCodeAt(v+7))<<24,p=255&e.charCodeAt(v+8)|(255&e.charCodeAt(v+9))<<8|(255&e.charCodeAt(v+10))<<16|(255&e.charCodeAt(v+11))<<24,d=255&e.charCodeAt(v+12)|(255&e.charCodeAt(v+13))<<8|(255&e.charCodeAt(v+14))<<16|(255&e.charCodeAt(v+15))<<24,l=o(l,y),l=s(l,15),l=o(l,g),i^=l,i=s(i,19),i+=u,i=o(i,5)+1444728091,h=o(h,g),h=s(h,16),h=o(h,m),u^=h,u=s(u,17),u+=c,u=o(u,5)+197830471,p=o(p,m),p=s(p,17),p=o(p,b),c^=p,c=s(c,15),c+=f,c=o(c,5)+2530024501,d=o(d,b),d=s(d,18),d=o(d,y),f^=d,f=s(f,13),f+=i,f=o(f,5)+850148119;switch(l=0,h=0,p=0,d=0,r){case 15:d^=e.charCodeAt(v+14)<<16;case 14:d^=e.charCodeAt(v+13)<<8;case 13:d^=e.charCodeAt(v+12),d=o(d,b),d=s(d,18),d=o(d,y),f^=d;case 12:p^=e.charCodeAt(v+11)<<24;case 11:p^=e.charCodeAt(v+10)<<16;case 10:p^=e.charCodeAt(v+9)<<8;case 9:p^=e.charCodeAt(v+8),p=o(p,m),p=s(p,17),p=o(p,b),c^=p;case 8:h^=e.charCodeAt(v+7)<<24;case 7:h^=e.charCodeAt(v+6)<<16;case 6:h^=e.charCodeAt(v+5)<<8;case 5:h^=e.charCodeAt(v+4),h=o(h,g),h=s(h,16),h=o(h,m),u^=h;case 4:l^=e.charCodeAt(v+3)<<24;case 3:l^=e.charCodeAt(v+2)<<16;case 2:l^=e.charCodeAt(v+1)<<8;case 1:l^=e.charCodeAt(v),l=o(l,y),l=s(l,15),l=o(l,g),i^=l}return i^=e.length,u^=e.length,c^=e.length,f^=e.length,i+=u,i+=c,i+=f,u+=i,c+=i,f+=i,i=a(i),u=a(u),c=a(c),f=a(f),i+=u,i+=c,i+=f,u+=i,c+=i,f+=i,("00000000"+(i>>>0).toString(16)).slice(-8)+("00000000"+(u>>>0).toString(16)).slice(-8)+("00000000"+(c>>>0).toString(16)).slice(-8)+("00000000"+(f>>>0).toString(16)).slice(-8)},i.x64.hash128=function(e,t){e=e||"",t=t||0;for(var r=e.length%16,n=e.length-r,i=[0,t],o=[0,t],s=[0,0],a=[0,0],d=[2277735313,289559509],y=[1291169091,658871167],g=0;g<n;g+=16)s=[255&e.charCodeAt(g+4)|(255&e.charCodeAt(g+5))<<8|(255&e.charCodeAt(g+6))<<16|(255&e.charCodeAt(g+7))<<24,255&e.charCodeAt(g)|(255&e.charCodeAt(g+1))<<8|(255&e.charCodeAt(g+2))<<16|(255&e.charCodeAt(g+3))<<24],a=[255&e.charCodeAt(g+12)|(255&e.charCodeAt(g+13))<<8|(255&e.charCodeAt(g+14))<<16|(255&e.charCodeAt(g+15))<<24,255&e.charCodeAt(g+8)|(255&e.charCodeAt(g+9))<<8|(255&e.charCodeAt(g+10))<<16|(255&e.charCodeAt(g+11))<<24],s=c(s,d),s=f(s,31),s=c(s,y),i=h(i,s),i=f(i,27),i=u(i,o),i=u(c(i,[0,5]),[0,1390208809]),a=c(a,y),a=f(a,33),a=c(a,d),o=h(o,a),o=f(o,31),o=u(o,i),o=u(c(o,[0,5]),[0,944331445]);switch(s=[0,0],a=[0,0],r){case 15:a=h(a,l([0,e.charCodeAt(g+14)],48));case 14:a=h(a,l([0,e.charCodeAt(g+13)],40));case 13:a=h(a,l([0,e.charCodeAt(g+12)],32));case 12:a=h(a,l([0,e.charCodeAt(g+11)],24));case 11:a=h(a,l([0,e.charCodeAt(g+10)],16));case 10:a=h(a,l([0,e.charCodeAt(g+9)],8));case 9:a=h(a,[0,e.charCodeAt(g+8)]),a=c(a,y),a=f(a,33),a=c(a,d),o=h(o,a);case 8:s=h(s,l([0,e.charCodeAt(g+7)],56));case 7:s=h(s,l([0,e.charCodeAt(g+6)],48));case 6:s=h(s,l([0,e.charCodeAt(g+5)],40));case 5:s=h(s,l([0,e.charCodeAt(g+4)],32));case 4:s=h(s,l([0,e.charCodeAt(g+3)],24));case 3:s=h(s,l([0,e.charCodeAt(g+2)],16));case 2:s=h(s,l([0,e.charCodeAt(g+1)],8));case 1:s=h(s,[0,e.charCodeAt(g)]),s=c(s,d),s=f(s,31),s=c(s,y),i=h(i,s)}return i=h(i,[0,e.length]),o=h(o,[0,e.length]),i=u(i,o),o=u(o,i),i=p(i),o=p(o),i=u(i,o),o=u(o,i),("00000000"+(i[0]>>>0).toString(16)).slice(-8)+("00000000"+(i[1]>>>0).toString(16)).slice(-8)+("00000000"+(o[0]>>>0).toString(16)).slice(-8)+("00000000"+(o[1]>>>0).toString(16)).slice(-8)},void 0!==e&&e.exports&&(t=e.exports=i),t.murmurHash3=i}(this)},function(e,t,r){"use strict";(function(t){const n=r(50),i=o();function o(){return self.crypto?self.crypto.subtle||self.crypto.webkitSubtle:self.msCrypto?self.msCrypto.subtle:void 0}function s(e){if(!i)throw new Error("Please use a browser with webcrypto support and ensure the code has been delivered securely via HTTPS/TLS and run within a Secure Context");return(r,o)=>{const s=i.digest({name:e},r);if("function"!=typeof s.then)return s.onerror=(()=>{o(new Error(`hashing data using ${e}`))}),void(s.oncomplete=(e=>{o(null,e.target.result)}));n(s.then(e=>t.from(new Uint8Array(e))),o)}}function a(e,t){s("SHA-1")(e,t)}function u(e,t){s("SHA-256")(e,t)}function c(e,t){s("SHA-512")(e,t)}e.exports={sha1:a,sha2256:u,sha2512:c}}).call(this,r(0).Buffer)},function(e,t,r){(function(t){var n=r(380),i;i="function"==typeof setImediate?setImediate:"object"==typeof t&&t&&t.nextTick?t.nextTick:function(e){setTimeout(e,0)};var o=[];function s(e){if(!(this instanceof s))return"function"==typeof e?new s(e):a();var t=!1,r=!1,u,c=[],f=!1;function l(e){c.length?(f=!0,c.shift()(e||!1)):f=!1}function h(e,n){return new s(function(o){function s(t){var s=r?e:n;if("function"==typeof s){function a(){var e;try{e=s(u)}catch(e){return o.reject(e),l()}o.fulfill(e),l(!0)}t?a():i(a)}else r?(o.fulfill(u),l(t)):(o.reject(u),l(t))}c.push(s),t&&!f&&l()})}this.then=h,function(){function i(e){t||(n(e)?e.then(i,s):(t=r=!0,u=e,l()))}function s(e){t||(t=!0,r=!1,u=e,l())}for(var a={fulfill:i,reject:s},c=0;c<o.length;c++)o[c](this,a);if("function"==typeof e)try{e(a)}catch(e){a.reject(e)}}()}function a(){var e,t=new s(function(t){e=t});return{resolver:e,promise:t}}e.exports=s,s.use=function(e){o.push(e)}}).call(this,r(6))},function(e,t,r){"use strict";(function(t){const n=r(51),i=r(379).toCallback,o=45569,s=45633,a={init:n.blake2bInit,update:n.blake2bUpdate,digest:n.blake2bFinal},u={init:n.blake2sInit,update:n.blake2sUpdate,digest:n.blake2sFinal},c=(e,r)=>i(n=>{const i=r.init(e,null);return r.update(i,n),t.from(r.digest(i))});e.exports=(e=>{for(let t=0;t<64;t++)e[o+t]=c(t+1,a);for(let t=0;t<32;t++)e[s+t]=c(t+1,u)})}).call(this,r(0).Buffer)},function(e,t,r){var n=r(381);function i(e,t,r){var n=e[t]+e[r],i=e[t+1]+e[r+1];n>=4294967296&&i++,e[t]=n,e[t+1]=i}function o(e,t,r,n){var i=e[t]+r;r<0&&(i+=4294967296);var o=e[t+1]+n;i>=4294967296&&o++,e[t]=i,e[t+1]=o}function s(e,t){return e[t]^e[t+1]<<8^e[t+2]<<16^e[t+3]<<24}function a(e,t,r,n,s,a){var u=h[s],c=h[s+1],f=h[a],p=h[a+1];i(l,e,t),o(l,e,u,c);var d=l[n]^l[e],y=l[n+1]^l[e+1];l[n]=y,l[n+1]=d,i(l,r,n),d=l[t]^l[r],y=l[t+1]^l[r+1],l[t]=d>>>24^y<<8,l[t+1]=y>>>24^d<<8,i(l,e,t),o(l,e,f,p),d=l[n]^l[e],y=l[n+1]^l[e+1],l[n]=d>>>16^y<<16,l[n+1]=y>>>16^d<<16,i(l,r,n),d=l[t]^l[r],y=l[t+1]^l[r+1],l[t]=y>>>31^d<<1,l[t+1]=d>>>31^y<<1}var u=new Uint32Array([4089235720,1779033703,2227873595,3144134277,4271175723,1013904242,1595750129,2773480762,2917565137,1359893119,725511199,2600822924,4215389547,528734635,327033209,1541459225]),c=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,14,10,4,8,9,15,13,6,1,12,0,2,11,7,5,3,11,8,12,0,5,2,15,13,10,14,3,6,7,1,9,4,7,9,3,1,13,12,11,14,2,6,5,10,4,0,15,8,9,0,5,7,2,4,10,15,14,1,11,12,6,8,3,13,2,12,6,10,0,11,8,3,4,13,7,5,15,14,1,9,12,5,1,15,14,13,4,10,0,7,6,3,9,2,8,11,13,11,7,14,12,1,3,9,5,0,15,4,8,6,2,10,6,15,14,9,11,3,0,8,12,2,13,7,1,4,10,5,10,2,8,4,7,6,1,5,15,11,9,14,3,12,13,0,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,14,10,4,8,9,15,13,6,1,12,0,2,11,7,5,3],f=new Uint8Array(c.map(function(e){return 2*e})),l=new Uint32Array(32),h=new Uint32Array(32);function p(e,t){var r=0;for(r=0;r<16;r++)l[r]=e.h[r],l[r+16]=u[r];for(l[24]=l[24]^e.t,l[25]=l[25]^e.t/4294967296,t&&(l[28]=~l[28],l[29]=~l[29]),r=0;r<32;r++)h[r]=s(e.b,4*r);for(r=0;r<12;r++)a(0,8,16,24,f[16*r+0],f[16*r+1]),a(2,10,18,26,f[16*r+2],f[16*r+3]),a(4,12,20,28,f[16*r+4],f[16*r+5]),a(6,14,22,30,f[16*r+6],f[16*r+7]),a(0,10,20,30,f[16*r+8],f[16*r+9]),a(2,12,22,24,f[16*r+10],f[16*r+11]),a(4,14,16,26,f[16*r+12],f[16*r+13]),a(6,8,18,28,f[16*r+14],f[16*r+15]);for(r=0;r<16;r++)e.h[r]=e.h[r]^l[r]^l[r+16]}function d(e,t){if(0===e||e>64)throw new Error("Illegal output length, expected 0 < length <= 64");if(t&&t.length>64)throw new Error("Illegal key, expected Uint8Array with 0 < length <= 64");for(var r={b:new Uint8Array(128),h:new Uint32Array(16),t:0,c:0,outlen:e},n=0;n<16;n++)r.h[n]=u[n];var i=t?t.length:0;return r.h[0]^=16842752^i<<8^e,t&&(y(r,t),r.c=128),r}function y(e,t){for(var r=0;r<t.length;r++)128===e.c&&(e.t+=e.c,p(e,!1),e.c=0),e.b[e.c++]=t[r]}function g(e){for(e.t+=e.c;e.c<128;)e.b[e.c++]=0;p(e,!0);for(var t=new Uint8Array(e.outlen),r=0;r<e.outlen;r++)t[r]=e.h[r>>2]>>8*(3&r);return t}function m(e,t,r){r=r||64,e=n.normalizeInput(e);var i=d(r,t);return y(i,e),g(i)}function b(e,t,r){var i=m(e,t,r);return n.toHex(i)}e.exports={blake2b:m,blake2bHex:b,blake2bInit:d,blake2bUpdate:y,blake2bFinal:g}},function(e,t,r){var n=r(381);function i(e,t){return e[t]^e[t+1]<<8^e[t+2]<<16^e[t+3]<<24}function o(e,t,r,n,i,o){c[e]=c[e]+c[t]+i,c[n]=s(c[n]^c[e],16),c[r]=c[r]+c[n],c[t]=s(c[t]^c[r],12),c[e]=c[e]+c[t]+o,c[n]=s(c[n]^c[e],8),c[r]=c[r]+c[n],c[t]=s(c[t]^c[r],7)}function s(e,t){return e>>>t^e<<32-t}var a=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),u=new Uint8Array([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,14,10,4,8,9,15,13,6,1,12,0,2,11,7,5,3,11,8,12,0,5,2,15,13,10,14,3,6,7,1,9,4,7,9,3,1,13,12,11,14,2,6,5,10,4,0,15,8,9,0,5,7,2,4,10,15,14,1,11,12,6,8,3,13,2,12,6,10,0,11,8,3,4,13,7,5,15,14,1,9,12,5,1,15,14,13,4,10,0,7,6,3,9,2,8,11,13,11,7,14,12,1,3,9,5,0,15,4,8,6,2,10,6,15,14,9,11,3,0,8,12,2,13,7,1,4,10,5,10,2,8,4,7,6,1,5,15,11,9,14,3,12,13,0]),c=new Uint32Array(16),f=new Uint32Array(16);function l(e,t){var r=0;for(r=0;r<8;r++)c[r]=e.h[r],c[r+8]=a[r];for(c[12]^=e.t,c[13]^=e.t/4294967296,t&&(c[14]=~c[14]),r=0;r<16;r++)f[r]=i(e.b,4*r);for(r=0;r<10;r++)o(0,4,8,12,f[u[16*r+0]],f[u[16*r+1]]),o(1,5,9,13,f[u[16*r+2]],f[u[16*r+3]]),o(2,6,10,14,f[u[16*r+4]],f[u[16*r+5]]),o(3,7,11,15,f[u[16*r+6]],f[u[16*r+7]]),o(0,5,10,15,f[u[16*r+8]],f[u[16*r+9]]),o(1,6,11,12,f[u[16*r+10]],f[u[16*r+11]]),o(2,7,8,13,f[u[16*r+12]],f[u[16*r+13]]),o(3,4,9,14,f[u[16*r+14]],f[u[16*r+15]]);for(r=0;r<8;r++)e.h[r]^=c[r]^c[r+8]}function h(e,t){if(!(e>0&&e<=32))throw new Error("Incorrect output length, should be in [1, 32]");var r=t?t.length:0;if(t&&!(r>0&&r<=32))throw new Error("Incorrect key length, should be in [1, 32]");var n={h:new Uint32Array(a),b:new Uint32Array(64),c:0,t:0,outlen:e};return n.h[0]^=16842752^r<<8^e,r>0&&(p(n,t),n.c=64),n}function p(e,t){for(var r=0;r<t.length;r++)64===e.c&&(e.t+=e.c,l(e,!1),e.c=0),e.b[e.c++]=t[r]}function d(e){for(e.t+=e.c;e.c<64;)e.b[e.c++]=0;l(e,!0);for(var t=new Uint8Array(e.outlen),r=0;r<e.outlen;r++)t[r]=e.h[r>>2]>>8*(3&r)&255;return t}function y(e,t,r){r=r||32,e=n.normalizeInput(e);var i=h(r,t);return p(i,e),d(i)}function g(e,t,r){var i=y(e,t,r);return n.toHex(i)}e.exports={blake2s:y,blake2sHex:g,blake2sInit:h,blake2sUpdate:p,blake2sFinal:d}},function(e,t,r){
|
||
//! stable.js 0.1.8, https://github.com/Two-Screen/stable
|
||
//! © 2018 Angry Bytes and contributors. MIT licensed.
|
||
var n,i;n=this,i=function(){"use strict";var e=function(e,r){return t(e.slice(),r)};function t(e,t){"function"!=typeof t&&(t=function(e,t){return String(e).localeCompare(t)});var n=e.length;if(n<=1)return e;for(var i=new Array(n),o=1;o<n;o*=2){r(e,t,o,i);var s=e;e=i,i=s}return e}e.inplace=function(e,n){var i=t(e,n);return i!==e&&r(i,null,e.length,e),e};var r=function(e,t,r,n){var i=e.length,o=0,s=2*r,a,u,c,f,l;for(a=0;a<i;a+=s)for(u=a+r,c=u+r,u>i&&(u=i),c>i&&(c=i),f=a,l=u;;)if(f<u&&l<c)t(e[f],e[l])<=0?n[o++]=e[f++]:n[o++]=e[l++];else if(f<u)n[o++]=e[f++];else{if(!(l<c))break;n[o++]=e[l++]}};return e},e.exports=i()},function(e,t,r){var n=r(734),i=r(736);e.exports=n,e.exports.parse=n,e.exports.stringify=i},function(e,t,r){var n=r(735),i=536870911,o=["int32","int64","uint32","uint64","sint32","sint64","bool","fixed64","sfixed64","double","fixed32","sfixed32","float"],s=function(e){for(var t={};e.length;)switch(e[0]){case"[":case",":e.shift();var r=e.shift();if("("===r&&(r=e.shift(),e.shift()),"="!==e[0])throw new Error("Unexpected token in field options: "+e[0]);if(e.shift(),"]"===e[0])throw new Error("Unexpected ] in field option");t[r]=e.shift();break;case"]":return e.shift(),t;default:throw new Error("Unexpected token in field options: "+e[0])}throw new Error("No closing tag for field options")},a=function(e){for(var t={name:null,type:null,tag:-1,map:null,oneof:null,required:!1,repeated:!1,options:{}};e.length;)switch(e[0]){case"=":e.shift(),t.tag=Number(e.shift());break;case"map":if(t.type="map",t.map={from:null,to:null},e.shift(),"<"!==e[0])throw new Error("Unexpected token in map type: "+e[0]);if(e.shift(),t.map.from=e.shift(),","!==e[0])throw new Error("Unexpected token in map type: "+e[0]);if(e.shift(),t.map.to=e.shift(),">"!==e[0])throw new Error("Unexpected token in map type: "+e[0]);e.shift(),t.name=e.shift();break;case"repeated":case"required":case"optional":var r=e.shift();t.required="required"===r,t.repeated="repeated"===r,t.type=e.shift(),t.name=e.shift();break;case"[":t.options=s(e);break;case";":if(null===t.name)throw new Error("Missing field name");if(null===t.type)throw new Error("Missing type in message field: "+t.name);if(-1===t.tag)throw new Error("Missing tag number in message field: "+t.name);return e.shift(),t;default:throw new Error("Unexpected token in message field: "+e[0])}throw new Error("No ; found for message field")},u=function(e){for(var t={enums:[],messages:[],fields:[],extends:[],extensions:null};e.length;)switch(e[0]){case"map":case"repeated":case"optional":case"required":t.fields.push(a(e));break;case"enum":t.enums.push(y(e));break;case"message":t.messages.push(l(e));break;case"extensions":t.extensions=f(e);break;case"oneof":e.shift();var r=e.shift();if("{"!==e[0])throw new Error("Unexpected token in oneof: "+e[0]);for(e.shift();"}"!==e[0];){e.unshift("optional");var n=a(e);n.oneof=r,t.fields.push(n)}e.shift();break;case"extend":t.extends.push(c(e));break;case";":e.shift();break;case"reserved":case"option":for(e.shift();";"!==e[0];)e.shift();break;default:e.unshift("optional"),t.fields.push(a(e))}return t},c=function(e){var t={name:e[1],message:l(e)};return t},f=function(e){e.shift();var t=Number(e.shift());if(isNaN(t))throw new Error("Invalid from in extensions definition");if("to"!==e.shift())throw new Error("Expected keyword 'to' in extensions definition");var r=e.shift();if("max"===r&&(r=536870911),r=Number(r),isNaN(r))throw new Error("Invalid to in extensions definition");if(";"!==e.shift())throw new Error("Missing ; in extensions definition");return{from:t,to:r}},l=function(e){e.shift();var t=1,r=[],n={name:e.shift(),enums:[],extends:[],messages:[],fields:[]};if("{"!==e[0])throw new Error("Expected { but found "+e[0]);for(e.shift();e.length;){if("{"===e[0]?t++:"}"===e[0]&&t--,!t)return e.shift(),r=u(r),n.enums=r.enums,n.messages=r.messages,n.fields=r.fields,n.extends=r.extends,n.extensions=r.extensions,n;r.push(e.shift())}if(t)throw new Error("No closing tag for message")},h=function(e){e.shift();var t=e.shift();if(";"!==e[0])throw new Error("Expected ; but found "+e[0]);return e.shift(),t},p=function(e){if(e.shift(),"="!==e[0])throw new Error("Expected = but found "+e[0]);e.shift();var t=e.shift();switch(t){case'"proto2"':t=2;break;case'"proto3"':t=3;break;default:throw new Error("Expected protobuf syntax version but found "+t)}if(";"!==e[0])throw new Error("Expected ; but found "+e[0]);return e.shift(),t},d=function(e){if(e.length<4)throw new Error("Invalid enum value: "+e.slice(0,3).join(" "));if("="!==e[1])throw new Error("Expected = but found "+e[1]);if(";"!==e[3]&&"["!==e[3])throw new Error("Expected ; or [ but found "+e[1]);var t=e.shift();e.shift();var r={value:null,options:{}};return r.value=Number(e.shift()),"["===e[0]&&(r.options=s(e)),e.shift(),{name:t,val:r}},y=function(e){e.shift();var t={},r={name:e.shift(),values:{},options:{}};if("{"!==e[0])throw new Error("Expected { but found "+e[0]);for(e.shift();e.length;){if("}"===e[0])return e.shift(),";"===e[0]&&e.shift(),r;if("option"!==e[0]){var n=d(e);r.values[n.name]=n.val}else t=g(e),r.options[t.name]=t.value}throw new Error("No closing tag for enum")},g=function(e){for(var t=null,r=null,n=function(e){return"true"===e||"false"!==e&&e.replace(/^"+|"+$/gm,"")};e.length;){if(";"===e[0])return e.shift(),{name:t,value:r};switch(e[0]){case"option":e.shift();var i="("===e[0];if(i&&e.shift(),t=e.shift(),i){if(")"!==e[0])throw new Error("Expected ) but found "+e[0]);e.shift()}"."===e[0][0]&&(t+=e.shift());break;case"=":if(e.shift(),null===t)throw new Error("Expected key for option with value: "+e[0]);if(r=n(e.shift()),"optimize_for"===t&&!/^(SPEED|CODE_SIZE|LITE_RUNTIME)$/.test(r))throw new Error("Unexpected value for option optimize_for: "+r);"{"===r&&(r=m(e));break;default:throw new Error("Unexpected token in option: "+e[0])}}},m=function(e){for(var t=function(e){return"true"===e||"false"!==e&&e.replace(/^"+|"+$/gm,"")},r={};e.length;){if("}"===e[0])return e.shift(),r;var n="("===e[0];n&&e.shift();var i=e.shift();if(n){if(")"!==e[0])throw new Error("Expected ) but found "+e[0]);e.shift()}var o=null;switch(e[0]){case":":if(void 0!==r[i])throw new Error("Duplicate option map key "+i);e.shift(),o=t(e.shift()),"{"===o&&(o=m(e)),r[i]=o,";"===e[0]&&e.shift();break;case"{":if(e.shift(),o=m(e),void 0===r[i]&&(r[i]=[]),!Array.isArray(r[i]))throw new Error("Duplicate option map key "+i);r[i].push(o);break;default:throw new Error("Unexpected token in option map: "+e[0])}}throw new Error("No closing tag for option map")},b=function(e){e.shift();var t=e.shift().replace(/^"+|"+$/gm,"");if(";"!==e[0])throw new Error("Unexpected token: "+e[0]+'. Expected ";"');return e.shift(),t},v=function(e){e.shift();var t={name:e.shift(),methods:[],options:{}};if("{"!==e[0])throw new Error("Expected { but found "+e[0]);for(e.shift();e.length;){if("}"===e[0])return e.shift(),";"===e[0]&&e.shift(),t;switch(e[0]){case"option":var r=g(e);if(void 0!==t.options[r.name])throw new Error("Duplicate option "+r.name);t.options[r.name]=r.value;break;case"rpc":t.methods.push(_(e));break;default:throw new Error("Unexpected token in service: "+e[0])}}throw new Error("No closing tag for service")},_=function(e){e.shift();var t={name:e.shift(),input_type:null,output_type:null,client_streaming:!1,server_streaming:!1,options:{}};if("("!==e[0])throw new Error("Expected ( but found "+e[0]);if(e.shift(),"stream"===e[0]&&(e.shift(),t.client_streaming=!0),t.input_type=e.shift(),")"!==e[0])throw new Error("Expected ) but found "+e[0]);if(e.shift(),"returns"!==e[0])throw new Error("Expected returns but found "+e[0]);if(e.shift(),"("!==e[0])throw new Error("Expected ( but found "+e[0]);if(e.shift(),"stream"===e[0]&&(e.shift(),t.server_streaming=!0),t.output_type=e.shift(),")"!==e[0])throw new Error("Expected ) but found "+e[0]);if(e.shift(),";"===e[0])return e.shift(),t;if("{"!==e[0])throw new Error("Expected { but found "+e[0]);for(e.shift();e.length;){if("}"===e[0])return e.shift(),";"===e[0]&&e.shift(),t;if("option"!==e[0])throw new Error("Unexpected token in rpc options: "+e[0]);var r=g(e);if(void 0!==t.options[r.name])throw new Error("Duplicate option "+r.name);t.options[r.name]=r.value}throw new Error("No closing tag for rpc")},w=function(e){for(var t=n(e.toString()),r=0;r<t.length;r++){var i;if(/^("|')([^'"]*)$/.test(t[r]))for(i=1===t[r].length?r+1:r;i<t.length;i++)if(/^([^'"]*)("|')$/.test(t[i])){t=t.slice(0,r).concat(t.slice(r,i+1).join("")).concat(t.slice(i+1));break}}for(var s={syntax:3,package:null,imports:[],enums:[],messages:[],options:{},extends:[]},a=!0;t.length;){switch(t[0]){case"package":s.package=h(t);break;case"syntax":if(!a)throw new Error("Protobuf syntax version should be first thing in file");s.syntax=p(t);break;case"message":s.messages.push(l(t));break;case"enum":s.enums.push(y(t));break;case"option":var u=g(t);if(s.options[u.name])throw new Error("Duplicate option "+u.name);s.options[u.name]=u.value;break;case"import":s.imports.push(b(t));break;case"extend":s.extends.push(c(t));break;case"service":s.services||(s.services=[]),s.services.push(v(t));break;default:throw new Error("Unexpected token: "+t[0])}a=!1}return s.extends.forEach(function(e){s.messages.forEach(function(t){t.name===e.name&&e.message.fields.forEach(function(e){if(!t.extensions||e.tag<t.extensions.from||e.tag>t.extensions.to)throw new Error(t.name+" does not declare "+e.tag+" as an extension number");t.fields.push(e)})})}),s.messages.forEach(function(e){e.fields.forEach(function(t){var r,n,i,a;function u(e){return e.name===t.type}function c(e){return e.name===i}if(t.options&&"true"===t.options.packed&&-1===o.indexOf(t.type)){if(-1===t.type.indexOf(".")){if(e.enums&&e.enums.some(u))return}else{if(r=t.type.split("."),r.length>2)throw new Error("what is this?");if(n=r[0],i=r[1],s.messages.some(function(e){if(e.name===n)return a=e,e}),a&&a.enums&&a.enums.some(c))return}throw new Error("Fields of type "+t.type+' cannot be declared [packed=true]. Only repeated fields of primitive numeric types (types which use the varint, 32-bit, or 64-bit wire types) can be declared "packed". See https://developers.google.com/protocol-buffers/docs/encoding#optional')}})}),s};e.exports=w},function(e,t){e.exports=function(e){var t=function(e){var t=e.indexOf("//");return t>-1?e.slice(0,t):e},r=function(){var e=!1;return function(t){return"/*"===t?(e=!0,!1):"*/"===t?(e=!1,!1):!e}},n=function(e){return e.trim()};return e.replace(/([;,{}()=:[\]<>]|\/\*|\*\/)/g," $1 ").split(/\n/).map(n).filter(Boolean).map(t).map(n).filter(Boolean).join("\n").split(/\s+|\n+/gm).filter(r())}},function(e,t){var r=function(e,t){var r=e.repeated?"repeated":e.required?"required":"optional";"map"===e.type&&(r="map<"+e.map.from+","+e.map.to+">"),e.oneof&&(r="");var n=Object.keys(e.options||{}).map(function(t){return t+" = "+e.options[t]}).join(",");return n&&(n=" ["+n+"]"),t.push((r?r+" ":"")+("map"===e.map?"":e.type+" ")+e.name+" = "+e.tag+n+";"),t},n=function(e,t){t.push("message "+e.name+" {"),e.enums||(e.enums=[]),e.enums.forEach(function(e){t.push(i(e,[]))}),e.messages||(e.messages=[]),e.messages.forEach(function(e){t.push(n(e,[]))});var o={};return e.fields||(e.fields=[]),e.fields.forEach(function(e){e.oneof?(o[e.oneof]||(o[e.oneof]=[]),o[e.oneof].push(r(e,[]))):t.push(r(e,[]))}),Object.keys(o).forEach(function(e){o[e].unshift("oneof "+e+" {"),o[e].push("}"),t.push(o[e])}),t.push("}",""),t},i=function(e,t){t.push("enum "+e.name+" {"),e.options||(e.options={});var r=s(e.options,[]);return r.length>1&&t.push(r.slice(0,-1)),Object.keys(e.values).map(function(r){var n=o(e.values[r]);t.push([r+" = "+n+";"])}),t.push("}",""),t},o=function(e,t){var r=Object.keys(e.options||{}).map(function(t){return t+" = "+e.options[t]}).join(",");r&&(r=" ["+r+"]");var n=e.value+r;return n},s=function(e,t){var r=Object.keys(e);return r.forEach(function(r){var n=e[r];~r.indexOf(".")&&(r="("+r+")");var i=typeof n;"object"===i?(n=a(n,[]),n.length&&t.push("option "+r+" = {",n,"};")):("string"===i&&"optimize_for"!==r&&(n='"'+n+'"'),t.push("option "+r+" = "+n+";"))}),r.length>0&&t.push(""),t},a=function(e,t){var r=Object.keys(e);return r.forEach(function(r){var n=e[r],i=typeof n;"object"===i?Array.isArray(n)?n.forEach(function(e){e=a(e,[]),e.length&&t.push(r+" {",e,"}")}):(n=a(n,[]),n.length&&t.push(r+" {",n,"}")):("string"===i&&(n='"'+n+'"'),t.push(r+": "+n))}),t},u=function(e,t){return t.push("service "+e.name+" {"),e.options||(e.options={}),s(e.options,t),e.methods||(e.methods=[]),e.methods.forEach(function(e){t.push(c(e,[]))}),t.push("}",""),t},c=function(e,t){var r="rpc "+e.name+"(";e.client_streaming&&(r+="stream "),r+=e.input_type+") returns (",e.server_streaming&&(r+="stream "),r+=e.output_type+")",e.options||(e.options={});var n=s(e.options,[]);return n.length>1?t.push(r+" {",n.slice(0,-1),"}"):t.push(r+";"),t},f=function(e){return function(t){return Array.isArray(t)?t.map(f(e+" ")).join("\n"):e+t}};e.exports=function(e){var t=[];return t.push('syntax = "proto'+e.syntax+'";',""),e.package&&t.push("package "+e.package+";",""),e.options||(e.options={}),s(e.options,t),e.enums||(e.enums=[]),e.enums.forEach(function(e){i(e,t)}),e.messages||(e.messages=[]),e.messages.forEach(function(e){n(e,t)}),e.services&&e.services.forEach(function(e){u(e,t)}),t.map(f("")).join("\n")}},function(e,t,r){"use strict";var n=r(738),i=r(740),o=r(741),s=r(742),a=r(23),u=function(e){if(!e)return null;var t={};return Object.keys(e).forEach(function(r){t[r]=e[r].value}),t};e.exports=function(e,t){var r={},c={},f={},l=function(e,t){e.enums&&e.enums.forEach(function(e){e.id=t+(t?".":"")+e.name,c[e.id]=e,l(e,e.id)}),e.messages&&e.messages.forEach(function(n){n.id=t+(t?".":"")+n.name,r[n.id]=n,n.fields.forEach(function(n){if(n.map){var i="Map_"+n.map.from+"_"+n.map.to,o={name:i,enums:[],messages:[],fields:[{name:"key",type:n.map.from,tag:1,repeated:!1,required:!0},{name:"value",type:n.map.to,tag:2,repeated:!1,required:!1}],extensions:null,id:t+(t?".":"")+i};r[o.id]||(r[o.id]=o,e.messages.push(o)),n.type=i,n.repeated=!0}}),l(n,n.id)})};l(e,"");var h=function(e){var t=Object.keys(e.values||[]).map(function(t){return parseInt(e.values[t].value,10)}),r=function e(r,n,i){if(!t.length||-1===t.indexOf(r))throw new Error("Invalid enum value: "+r);return a.encode(r,n,i),e.bytes=a.encode.bytes,n},i=function e(r,n){var i=a.decode(r,n);if(!t.length||-1===t.indexOf(i))throw new Error("Invalid enum value: "+i);return e.bytes=a.decode.bytes,i};return n.make(0,r,i,a.encodingLength)},p=function(e,t){e.messages.forEach(function(r){t[r.name]=d(r.name,e.id)}),e.enums.forEach(function(e){t[e.name]=u(e.values)}),t.type=2,t.message=!0,t.name=e.name;var r={};e.fields.forEach(function(e){e.oneof&&(r[e.oneof]||(r[e.oneof]=[]),r[e.oneof].push(e.name))});var n=e.fields.map(function(t){return d(t.type,e.id)}),a=s(e,n,r),c=o(e,d,n,r,a),f=i(e,d,n);return c.bytes=f.bytes=0,t.buffer=!0,t.encode=c,t.decode=f,t.encodingLength=a,t},d=function(e,i,o){if(t&&t[e])return t[e];if(n[e])return n[e];var s=(i?i+"."+e:e).split(".").map(function(t,r,n){return n.slice(0,r).concat(e).join(".")}).reverse().reduce(function(e,t){return e||r[t]||c[t]},null);if(!1===o)return s;if(!s)throw new Error("Could not resolve "+e);if(s.values)return h(s);var a=f[s.id]||p(s,f[s.id]={});return a};return(e.enums||[]).concat((e.messages||[]).map(function(e){return d(e.id)}))}},function(e,t,r){"use strict";var n=r(23),i=r(739),o=r(2).Buffer,s=function(e,t,r,n){return t.bytes=r.bytes=0,{type:e,encode:t,decode:r,encodingLength:n}},a,u,c,f,l;t.make=s,t.bytes=(u=function(e){return o.isBuffer(e)?e.length:o.byteLength(e)},c=function(e){var t=u(e);return n.encodingLength(t)+t},f=function(e,t,r){var i=r,s=u(e);return n.encode(s,t,r),r+=n.encode.bytes,o.isBuffer(e)?e.copy(t,r):t.write(e,r,s),r+=s,f.bytes=r-i,t},l=function(e,t){var r=t,i=n.decode(e,t);t+=n.decode.bytes;var o=e.slice(t,t+i);return t+=o.length,l.bytes=t-r,o},s(2,f,l,c)),t.string=function(){var e=function(e){var t=o.byteLength(e);return n.encodingLength(t)+t},t=function(e,r,i){var s=i,a=o.byteLength(e);return n.encode(a,r,i,"utf-8"),i+=n.encode.bytes,r.write(e,i,a),i+=a,t.bytes=i-s,r},r=function(e,t){var i=t,o=n.decode(e,t);t+=n.decode.bytes;var s=e.toString("utf-8",t,t+o);return t+=o,r.bytes=t-i,s};return s(2,t,r,e)}(),t.bool=function(){var e=function(e){return 1},t=function(e,r,n){return r[n]=e?1:0,t.bytes=1,r},r=function(e,t){var n=e[t]>0;return r.bytes=1,n};return s(0,t,r,e)}(),t.int32=function(){var e=function(t,r){var i=n.decode(t,r);return e.bytes=n.decode.bytes,i>2147483647?i-4294967296:i},t=function(e,r,i){return n.encode(e<0?e+4294967296:e,r,i),t.bytes=n.encode.bytes,r},r=function(e){return n.encodingLength(e<0?e+4294967296:e)};return s(0,n.encode,e,r)}(),t.int64=function(){var e=function(t,r){var i=n.decode(t,r);if(i>=Math.pow(2,63)){for(var s=9;255===t[r+s-1];)s--;s=s||9;var a=o.allocUnsafe(s);t.copy(a,0,r,r+s),a[s-1]=127&a[s-1],i=-1*n.decode(a,0),e.bytes=10}else e.bytes=n.decode.bytes;return i},t=function(e,r,i){if(e<0){var o=i+9;for(n.encode(-1*e,r,i),i+=n.encode.bytes-1,r[i]=128|r[i];i<o-1;)i++,r[i]=255;r[o]=1,t.bytes=10}else n.encode(e,r,i),t.bytes=n.encode.bytes;return r},r=function(e){return e<0?10:n.encodingLength(e)};return s(0,t,e,r)}(),t.sint32=t.sint64=s(0,i.encode,i.decode,i.encodingLength),t.uint32=t.uint64=t.enum=t.varint=s(0,n.encode,n.decode,n.encodingLength),t.fixed64=t.sfixed64=function(){var e=function(e){return 8},t=function(e,r,n){return e.copy(r,n),t.bytes=8,r},r=function(e,t){var n=e.slice(t,t+8);return r.bytes=8,n};return s(1,t,r,e)}(),t.double=function(){var e=function(e){return 8},t=function(e,r,n){return r.writeDoubleLE(e,n),t.bytes=8,r},r=function(e,t){var n=e.readDoubleLE(t);return r.bytes=8,n};return s(1,t,r,e)}(),t.fixed32=function(){var e=function(e){return 4},t=function(e,r,n){return r.writeUInt32LE(e,n),t.bytes=4,r},r=function(e,t){var n=e.readUInt32LE(t);return r.bytes=4,n};return s(5,t,r,e)}(),t.sfixed32=function(){var e=function(e){return 4},t=function(e,r,n){return r.writeInt32LE(e,n),t.bytes=4,r},r=function(e,t){var n=e.readInt32LE(t);return r.bytes=4,n};return s(5,t,r,e)}(),t.float=function(){var e=function(e){return 4},t=function(e,r,n){return r.writeFloatLE(e,n),t.bytes=4,r},r=function(e,t){var n=e.readFloatLE(t);return r.bytes=4,n};return s(5,t,r,e)}()},function(e,t,r){var n=r(23);t.encode=function e(t,r,i){t=t>=0?2*t:-2*t-1;var o=n.encode(t,r,i);return e.bytes=n.encode.bytes,o},t.decode=function e(t,r){var i=n.decode(t,r);return e.bytes=n.decode.bytes,1&i?(i+1)/-2:i/2},t.encodingLength=function(e){return n.encodingLength(e>=0?2*e:-2*e-1)}},function(e,t,r){"use strict";var n=r(23),i=r(226).defined;function o(e,t,r){for(var o=[],u={},c=[],f=[],l=0;l<r.length;l++){var h=e.fields[l];u[h.tag]=l;var p=h.options&&h.options.default,d=t(h.type,e.id,!1);f[l]=[p,d&&d.values],e.fields[l].packed=h.repeated&&h.options&&h.options.packed&&"false"!==h.options.packed,h.required&&o.push(h.name),h.oneof&&c.push(h.name)}function y(e,t,r,i,o,s){var a=t.name;if(t.oneof)for(var u=Object.keys(r),f=0;f<u.length;f++)c.indexOf(u[f])>-1&&delete r[u[f]];if(e.message){var l=n.decode(i,o);o+=n.decode.bytes;var h=e.decode(i,o,o+l);t.map?(r[a]=r[a]||{},r[a][h.key]=h.value):t.repeated?(r[a]=r[a]||[],r[a].push(h)):r[a]=h}else t.repeated?(r[a]=r[a]||[],r[a].push(e.decode(i,o))):r[a]=e.decode(i,o);return o+=e.decode.bytes,o}return function t(l,h,p){if(null==h&&(h=0),null==p&&(p=l.length),!(p<=l.length&&h<=l.length))throw new Error("Decoded message is not valid");for(var d=h,g={},m;;){if(p<=h){var b="",v=0,_,w;for(v=0;v<o.length;v++)if(b=o[v],!i(g[b]))throw new Error("Decoded message is not valid, missing required field: "+b);for(v=0;v<r.length;v++)if(m=e.fields[v],w=f[v][0],_=f[v][1],b=m.name,!i(g[b])){var S=!1;if(m.oneof)for(var k=Object.keys(g),E=0;E<k.length;E++)if(c.indexOf(k[E])>-1){S=!0;break}S||(_?m.repeated?g[b]=[]:(w=w&&_[w]?_[w].value:_[Object.keys(_)[0]].value,g[b]=parseInt(w||0,10)):g[b]=a(m,w))}return t.bytes=h-d,g}var A=n.decode(l,h);h+=n.decode.bytes;var x=A>>3,I=u[x];if(null!=I){var T=r[I];if(m=e.fields[I],m.packed){var B=n.decode(l,h);for(h+=n.decode.bytes,B+=h;h<B;)h=y(T,m,g,l,h,I)}else h=y(T,m,g,l,h,I)}else h=s(7&A,l,h)}}}var s=function(e,t,r){switch(e){case 0:return n.decode(t,r),r+n.decode.bytes;case 1:return r+8;case 2:var i=n.decode(t,r);return r+n.decode.bytes+i;case 3:case 4:throw new Error("Groups are not supported");case 5:return r+4;default:throw new Error("Unknown wire type: "+e)}},a=function(e,t){if(e.map)return{};if(e.repeated)return[];switch(e.type){case"string":return null!=t?t:"";case"bool":return"true"===t;case"float":case"double":case"sfixed32":case"fixed32":case"varint":case"enum":case"uint64":case"uint32":case"int64":case"int32":case"sint64":case"sint32":return parseInt(t||0,10);default:return null}};e.exports=o},function(e,t,r){"use strict";(function(t){var n=r(226).defined,i=r(23);function o(e,r,o,s,a){for(var u=Object.keys(s),c=o.length,f={},l=0;l<c;l++){f[l]={p:i.encode(e.fields[l].tag<<3|2),h:i.encode(e.fields[l].tag<<3|o[l].type)};var h=e.fields[l];e.fields[l].packed=h.repeated&&h.options&&h.options.packed&&"false"!==h.options.packed}function p(e,t,r,n,o,s){var a=0;if(!o)for(a=0;a<r.length;a++)e[t++]=r[a];return n.message&&(i.encode(n.encodingLength(s),e,t),t+=i.encode.bytes),n.encode(s,e,t),t+n.encode.bytes}return function r(l,h,d){null==d&&(d=0),null==h&&(h=t.allocUnsafe(a(l)));var y=d,g=Object.keys(l),m=0,b=!1;for(m=0;m<u.length;m++){var v=u[m],_=s[m];if(g.indexOf(_)>-1){if(b)throw new Error("only one of the properties defined in oneof "+v+" can be set");b=!0}}for(m=0;m<c;m++){var w=o[m],S=e.fields[m],k=l[S.name],E=0;if(n(k)){var A=f[m].p,x=f[m].h,I=S.packed,T;if(S.map){var B=Object.keys(k);for(E=0;E<B.length;E++)B[E]={key:B[E],value:k[B[E]]};k=B}if(I){var C=0;for(E=0;E<k.length;E++)n(k[E])&&(C+=w.encodingLength(k[E]));if(C){for(E=0;E<x.length;E++)h[d++]=A[E];i.encode(C,h,d),d+=i.encode.bytes}}if(S.repeated)for(E=0;E<k.length;E++)T=k[E],n(T)&&(d=p(h,d,x,w,I,T));else d=p(h,d,x,w,I,k)}else if(S.required)throw new Error(S.name+" is required")}return r.bytes=d-y,h}}e.exports=o}).call(this,r(0).Buffer)},function(e,t,r){"use strict";var n=r(226).defined,i=r(23);function o(e,t,r){for(var o=Object.keys(r),s=t.length,a=new Array(s),u=0;u<e.fields.length;u++){a[u]=i.encodingLength(e.fields[u].tag<<3|t[u].type);var c=e.fields[u];e.fields[u].packed=c.repeated&&c.options&&c.options.packed&&"false"!==c.options.packed}return function u(c){var f=0,l=0,h=0;for(l=0;l<o.length;l++){var p=o[l],d=r[p],y=!1;for(h=0;h<d.length;h++)if(n(c[d[h]])){if(y)throw new Error("only one of the properties defined in oneof "+p+" can be set");y=!0}}for(l=0;l<s;l++){var g=t[l],m=e.fields[l],b=c[m.name],v=a[l],_;if(n(b)){if(m.map){var w=Object.keys(b);for(h=0;h<w.length;h++)w[h]={key:w[h],value:b[w[h]]};b=w}if(m.packed){var S=0;for(h=0;h<b.length;h++)n(b[h])&&(_=g.encodingLength(b[h]),S+=_,g.message&&(S+=i.encodingLength(_)));S&&(f+=v+S+i.encodingLength(S))}else if(m.repeated)for(h=0;h<b.length;h++)n(b[h])&&(_=g.encodingLength(b[h]),f+=v+_+(g.message?i.encodingLength(_):0));else _=g.encodingLength(b),f+=v+_+(g.message?i.encodingLength(_):0)}else if(m.required)throw new Error(m.name+" is required")}return f}}e.exports=o},function(e,t,r){"use strict";e.exports="// An IPFS MerkleDAG Link\nmessage PBLink {\n\n // multihash of the target object\n optional bytes Hash = 1;\n\n // utf string name. should be unique per object\n optional string Name = 2;\n\n // cumulative size of target object\n optional uint64 Tsize = 3;\n}\n\n// An IPFS MerkleDAG Node\nmessage PBNode {\n\n // refs to other objects\n repeated PBLink Links = 2;\n\n // opaque user data\n optional bytes Data = 1;\n}"},function(e,t,r){"use strict";const n=r(93);function i(e,t,r,i){const o=new n(e,t,r);i(null,o)}e.exports=i},function(e,t,r){"use strict";const n=r(93);function i(e){return new n(e.name?e.name:e.Name,e.size?e.size:e.Size,e.hash||e.Hash||e.multihash)}t=e.exports,t.createDagLinkFromB58EncodedHash=i},function(e,t,r){"use strict";const n=r(168),i=n.cloneLinks,o=n.cloneData,s=r(167);function a(e,t){const r=o(e),n=i(e);s(r,n,t)}e.exports=a},function(e,t,r){"use strict";const n=r(168),i=n.cloneLinks,o=n.cloneData,s=n.toDAGLink,a=r(93),u=r(166),c=r(167);function f(e,t,r){const n=i(e),f=o(e);if(a.isDAGLink(t));else if(u.isDAGNode(t))t=s(t);else try{t=new a(t.name,t.size,t.multihash||t.hash)}catch(e){return r(e)}n.push(t),c(f,n,r)}e.exports=f},function(e,t,r){"use strict";(function(t){const n=r(168),i=n.cloneLinks,o=n.cloneData,s=r(167);function a(e,r,n){const a=o(e);let u=i(e);if("string"==typeof r)u=u.filter(e=>e.name!==r);else{if(!t.isBuffer(r))return n(new Error("second arg needs to be a name or multihash"),null);u=u.filter(e=>!e.multihash.equals(r))}s(a,u,n)}e.exports=a}).call(this,r(0).Buffer)},function(e,t,r){"use strict";t.Diagnose=r(750),t.Decoder=r(385),t.Encoder=r(752),t.Simple=r(386),t.Tagged=r(387),t.decodeAll=t.Decoder.decodeAll,t.decodeFirst=t.Decoder.decodeFirst,t.diagnose=t.Diagnose.diagnose,t.encode=t.Encoder.encode,t.decode=t.Decoder.decode,t.leveldb={decode:t.Decoder.decodeAll,encode:t.Encoder.encode,buffer:!0,name:"cbor"}},function(e,t,r){"use strict";(function(t){const n=r(385),i=r(227);class o extends n{createTag(e,t){return`${e}(${t})`}createInt(e){return super.createInt(e).toString()}createInt32(e,t){return super.createInt32(e,t).toString()}createInt64(e,t,r,n){return super.createInt64(e,t,r,n).toString()}createInt32Neg(e,t){return super.createInt32Neg(e,t).toString()}createInt64Neg(e,t,r,n){return super.createInt64Neg(e,t,r,n).toString()}createTrue(){return"true"}createFalse(){return"false"}createFloat(e){const t=super.createFloat(e);return i.isNegativeZero(e)?"-0_1":`${t}_1`}createFloatSingle(e,t,r,n){const i=super.createFloatSingle(e,t,r,n);return`${i}_2`}createFloatDouble(e,t,r,n,i,o,s,a){const u=super.createFloatDouble(e,t,r,n,i,o,s,a);return`${u}_3`}createByteString(e,t){const r=e.join(", ");return-1===t?`(_ ${r})`:`h'${r}`}createByteStringFromHeap(e,r){const n=t.from(super.createByteStringFromHeap(e,r)).toString("hex");return`h'${n}'`}createInfinity(){return"Infinity_1"}createInfinityNeg(){return"-Infinity_1"}createNaN(){return"NaN_1"}createNaNNeg(){return"-NaN_1"}createNull(){return"null"}createUndefined(){return"undefined"}createSimpleUnassigned(e){return`simple(${e})`}createArray(e,t){const r=super.createArray(e,t);return-1===t?`[_ ${r.join(", ")}]`:`[${r.join(", ")}]`}createMap(e,t){const r=super.createMap(e),n=Array.from(r.keys()).reduce(s(r),"");return-1===t?`{_ ${n}}`:`{${n}}`}createObject(e,t){const r=super.createObject(e),n=Object.keys(r).reduce(s(r),"");return-1===t?`{_ ${n}}`:`{${n}}`}createUtf8String(e,t){const r=e.join(", ");return-1===t?`(_ ${r})`:`"${r}"`}createUtf8StringFromHeap(e,r){const n=t.from(super.createUtf8StringFromHeap(e,r)).toString("utf8");return`"${n}"`}static diagnose(e,r){"string"==typeof e&&(e=t.from(e,r||"hex"));const n=new o;return n.decodeFirst(e)}}function s(e){return(t,r)=>t?`${t}, ${r}: ${e[r]}`:`${r}: ${e[r]}`}e.exports=o}).call(this,r(0).Buffer)},function(e,t){e.exports=function e(t,r,n){"use asm";var i=new t.Uint8Array(n);var o=r.pushInt;var s=r.pushInt32;var a=r.pushInt32Neg;var u=r.pushInt64;var c=r.pushInt64Neg;var f=r.pushFloat;var l=r.pushFloatSingle;var h=r.pushFloatDouble;var p=r.pushTrue;var d=r.pushFalse;var y=r.pushUndefined;var g=r.pushNull;var m=r.pushInfinity;var b=r.pushInfinityNeg;var v=r.pushNaN;var _=r.pushNaNNeg;var w=r.pushArrayStart;var S=r.pushArrayStartFixed;var k=r.pushArrayStartFixed32;var E=r.pushArrayStartFixed64;var A=r.pushObjectStart;var x=r.pushObjectStartFixed;var I=r.pushObjectStartFixed32;var T=r.pushObjectStartFixed64;var B=r.pushByteString;var C=r.pushByteStringStart;var P=r.pushUtf8String;var O=r.pushUtf8StringStart;var R=r.pushSimpleUnassigned;var N=r.pushTagStart;var L=r.pushTagStart4;var j=r.pushTagStart8;var M=r.pushTagUnassigned;var K=r.pushBreak;var D=t.Math.pow;var U=0;var F=0;var q=0;function H(e){e=e|0;U=0;F=e;while((U|0)<(F|0)){q=Xe[i[U]&255](i[U]|0)|0;if((q|0)>0){break}}return q|0}function z(e){e=e|0;if(((U|0)+(e|0)|0)<(F|0)){return 0}return 1}function V(e){e=e|0;return i[e|0]<<8|i[e+1|0]|0}function G(e){e=e|0;return i[e|0]<<24|i[e+1|0]<<16|i[e+2|0]<<8|i[e+3|0]|0}function W(e){e=e|0;o(e|0);U=U+1|0;return 0}function $(e){e=e|0;if(z(1)|0){return 1}o(i[U+1|0]|0);U=U+2|0;return 0}function Y(e){e=e|0;if(z(2)|0){return 1}o(V(U+1|0)|0);U=U+3|0;return 0}function J(e){e=e|0;if(z(4)|0){return 1}s(V(U+1|0)|0,V(U+3|0)|0);U=U+5|0;return 0}function X(e){e=e|0;if(z(8)|0){return 1}u(V(U+1|0)|0,V(U+3|0)|0,V(U+5|0)|0,V(U+7|0)|0);U=U+9|0;return 0}function Z(e){e=e|0;o(-1-(e-32|0)|0);U=U+1|0;return 0}function Q(e){e=e|0;if(z(1)|0){return 1}o(-1-(i[U+1|0]|0)|0);U=U+2|0;return 0}function ee(e){e=e|0;var t=0;if(z(2)|0){return 1}t=V(U+1|0)|0;o(-1-(t|0)|0);U=U+3|0;return 0}function te(e){e=e|0;if(z(4)|0){return 1}a(V(U+1|0)|0,V(U+3|0)|0);U=U+5|0;return 0}function re(e){e=e|0;if(z(8)|0){return 1}c(V(U+1|0)|0,V(U+3|0)|0,V(U+5|0)|0,V(U+7|0)|0);U=U+9|0;return 0}function ne(e){e=e|0;var t=0;var r=0;var n=0;n=e-64|0;if(z(n|0)|0){return 1}t=U+1|0;r=(U+1|0)+(n|0)|0;B(t|0,r|0);U=r|0;return 0}function ie(e){e=e|0;var t=0;var r=0;var n=0;if(z(1)|0){return 1}n=i[U+1|0]|0;t=U+2|0;r=(U+2|0)+(n|0)|0;if(z(n+1|0)|0){return 1}B(t|0,r|0);U=r|0;return 0}function oe(e){e=e|0;var t=0;var r=0;var n=0;if(z(2)|0){return 1}n=V(U+1|0)|0;t=U+3|0;r=(U+3|0)+(n|0)|0;if(z(n+2|0)|0){return 1}B(t|0,r|0);U=r|0;return 0}function se(e){e=e|0;var t=0;var r=0;var n=0;if(z(4)|0){return 1}n=G(U+1|0)|0;t=U+5|0;r=(U+5|0)+(n|0)|0;if(z(n+4|0)|0){return 1}B(t|0,r|0);U=r|0;return 0}function ae(e){e=e|0;return 1}function ue(e){e=e|0;C();U=U+1|0;return 0}function ce(e){e=e|0;var t=0;var r=0;var n=0;n=e-96|0;if(z(n|0)|0){return 1}t=U+1|0;r=(U+1|0)+(n|0)|0;P(t|0,r|0);U=r|0;return 0}function fe(e){e=e|0;var t=0;var r=0;var n=0;if(z(1)|0){return 1}n=i[U+1|0]|0;t=U+2|0;r=(U+2|0)+(n|0)|0;if(z(n+1|0)|0){return 1}P(t|0,r|0);U=r|0;return 0}function le(e){e=e|0;var t=0;var r=0;var n=0;if(z(2)|0){return 1}n=V(U+1|0)|0;t=U+3|0;r=(U+3|0)+(n|0)|0;if(z(n+2|0)|0){return 1}P(t|0,r|0);U=r|0;return 0}function he(e){e=e|0;var t=0;var r=0;var n=0;if(z(4)|0){return 1}n=G(U+1|0)|0;t=U+5|0;r=(U+5|0)+(n|0)|0;if(z(n+4|0)|0){return 1}P(t|0,r|0);U=r|0;return 0}function pe(e){e=e|0;return 1}function de(e){e=e|0;O();U=U+1|0;return 0}function ye(e){e=e|0;S(e-128|0);U=U+1|0;return 0}function ge(e){e=e|0;if(z(1)|0){return 1}S(i[U+1|0]|0);U=U+2|0;return 0}function me(e){e=e|0;if(z(2)|0){return 1}S(V(U+1|0)|0);U=U+3|0;return 0}function be(e){e=e|0;if(z(4)|0){return 1}k(V(U+1|0)|0,V(U+3|0)|0);U=U+5|0;return 0}function ve(e){e=e|0;if(z(8)|0){return 1}E(V(U+1|0)|0,V(U+3|0)|0,V(U+5|0)|0,V(U+7|0)|0);U=U+9|0;return 0}function _e(e){e=e|0;w();U=U+1|0;return 0}function we(e){e=e|0;var t=0;t=e-160|0;if(z(t|0)|0){return 1}x(t|0);U=U+1|0;return 0}function Se(e){e=e|0;if(z(1)|0){return 1}x(i[U+1|0]|0);U=U+2|0;return 0}function ke(e){e=e|0;if(z(2)|0){return 1}x(V(U+1|0)|0);U=U+3|0;return 0}function Ee(e){e=e|0;if(z(4)|0){return 1}I(V(U+1|0)|0,V(U+3|0)|0);U=U+5|0;return 0}function Ae(e){e=e|0;if(z(8)|0){return 1}T(V(U+1|0)|0,V(U+3|0)|0,V(U+5|0)|0,V(U+7|0)|0);U=U+9|0;return 0}function xe(e){e=e|0;A();U=U+1|0;return 0}function Ie(e){e=e|0;N(e-192|0|0);U=U+1|0;return 0}function Te(e){e=e|0;N(e|0);U=U+1|0;return 0}function Be(e){e=e|0;N(e|0);U=U+1|0;return 0}function Ce(e){e=e|0;N(e|0);U=U+1|0;return 0}function Pe(e){e=e|0;N(e|0);U=U+1|0;return 0}function Oe(e){e=e|0;N(e-192|0|0);U=U+1|0;return 0}function Re(e){e=e|0;N(e|0);U=U+1|0;return 0}function Ne(e){e=e|0;N(e|0);U=U+1|0;return 0}function Le(e){e=e|0;N(e|0);U=U+1|0;return 0}function je(e){e=e|0;if(z(1)|0){return 1}N(i[U+1|0]|0);U=U+2|0;return 0}function Me(e){e=e|0;if(z(2)|0){return 1}N(V(U+1|0)|0);U=U+3|0;return 0}function Ke(e){e=e|0;if(z(4)|0){return 1}L(V(U+1|0)|0,V(U+3|0)|0);U=U+5|0;return 0}function De(e){e=e|0;if(z(8)|0){return 1}j(V(U+1|0)|0,V(U+3|0)|0,V(U+5|0)|0,V(U+7|0)|0);U=U+9|0;return 0}function Ue(e){e=e|0;R((e|0)-224|0);U=U+1|0;return 0}function Fe(e){e=e|0;d();U=U+1|0;return 0}function qe(e){e=e|0;p();U=U+1|0;return 0}function He(e){e=e|0;g();U=U+1|0;return 0}function ze(e){e=e|0;y();U=U+1|0;return 0}function Ve(e){e=e|0;if(z(1)|0){return 1}R(i[U+1|0]|0);U=U+2|0;return 0}function Ge(e){e=e|0;var t=0;var r=0;var n=1.0;var o=0.0;var s=0.0;var a=0.0;if(z(2)|0){return 1}t=i[U+1|0]|0;r=i[U+2|0]|0;if((t|0)&0x80){n=-1.0}o=+(((t|0)&0x7C)>>2);s=+(((t|0)&0x03)<<8|r);if(+o==0.0){f(+(+n*+5.9604644775390625e-8*+s))}else if(+o==31.0){if(+n==1.0){if(+s>0.0){v()}else{m()}}else{if(+s>0.0){_()}else{b()}}}else{f(+(+n*D(+2,+(+o-25.0))*+(1024.0+s)))}U=U+3|0;return 0}function We(e){e=e|0;if(z(4)|0){return 1}l(i[U+1|0]|0,i[U+2|0]|0,i[U+3|0]|0,i[U+4|0]|0);U=U+5|0;return 0}function $e(e){e=e|0;if(z(8)|0){return 1}h(i[U+1|0]|0,i[U+2|0]|0,i[U+3|0]|0,i[U+4|0]|0,i[U+5|0]|0,i[U+6|0]|0,i[U+7|0]|0,i[U+8|0]|0);U=U+9|0;return 0}function Ye(e){e=e|0;return 1}function Je(e){e=e|0;K();U=U+1|0;return 0}var Xe=[W,W,W,W,W,W,W,W,W,W,W,W,W,W,W,W,W,W,W,W,W,W,W,W,$,Y,J,X,Ye,Ye,Ye,Ye,Z,Z,Z,Z,Z,Z,Z,Z,Z,Z,Z,Z,Z,Z,Z,Z,Z,Z,Z,Z,Z,Z,Z,Z,Q,ee,te,re,Ye,Ye,Ye,Ye,ne,ne,ne,ne,ne,ne,ne,ne,ne,ne,ne,ne,ne,ne,ne,ne,ne,ne,ne,ne,ne,ne,ne,ne,ie,oe,se,ae,Ye,Ye,Ye,ue,ce,ce,ce,ce,ce,ce,ce,ce,ce,ce,ce,ce,ce,ce,ce,ce,ce,ce,ce,ce,ce,ce,ce,ce,fe,le,he,pe,Ye,Ye,Ye,de,ye,ye,ye,ye,ye,ye,ye,ye,ye,ye,ye,ye,ye,ye,ye,ye,ye,ye,ye,ye,ye,ye,ye,ye,ge,me,be,ve,Ye,Ye,Ye,_e,we,we,we,we,we,we,we,we,we,we,we,we,we,we,we,we,we,we,we,we,we,we,we,we,Se,ke,Ee,Ae,Ye,Ye,Ye,xe,Ie,Ie,Ie,Ie,Ie,Ie,Oe,Oe,Oe,Oe,Oe,Oe,Oe,Oe,Oe,Oe,Oe,Oe,Oe,Oe,Oe,Oe,Oe,Oe,je,Me,Ke,De,Ye,Ye,Ye,Ye,Ue,Ue,Ue,Ue,Ue,Ue,Ue,Ue,Ue,Ue,Ue,Ue,Ue,Ue,Ue,Ue,Ue,Ue,Ue,Ue,Fe,qe,He,ze,Ve,Ge,We,$e,Ye,Ye,Ye,Je];return{parse:H}}},function(e,t,r){"use strict";(function(t){const n=r(36),i=r(169),o=r(227),s=r(170),a=s.MT,u=s.NUMBYTES,c=s.SHIFT32,f=s.SYMS,l=s.TAG,h=s.MT.SIMPLE_FLOAT<<5|s.NUMBYTES.TWO,p=s.MT.SIMPLE_FLOAT<<5|s.NUMBYTES.FOUR,d=s.MT.SIMPLE_FLOAT<<5|s.NUMBYTES.EIGHT,y=s.MT.SIMPLE_FLOAT<<5|s.SIMPLE.TRUE,g=s.MT.SIMPLE_FLOAT<<5|s.SIMPLE.FALSE,m=s.MT.SIMPLE_FLOAT<<5|s.SIMPLE.UNDEFINED,b=s.MT.SIMPLE_FLOAT<<5|s.SIMPLE.NULL,v=new i("0x20000000000000"),_=t.from("f97e00","hex"),w=t.from("f9fc00","hex"),S=t.from("f97c00","hex");function k(e){return{}.toString.call(e).slice(8,-1)}class E{constructor(e){e=e||{},this.streaming="function"==typeof e.stream,this.onData=e.stream,this.semanticTypes=[[n.Url,this._pushUrl],[i,this._pushBigNumber]];const t=e.genTypes||[],r=t.length;for(let e=0;e<r;e++)this.addSemanticType(t[e][0],t[e][1]);this._reset()}addSemanticType(e,t){const r=this.semanticTypes.length;for(let n=0;n<r;n++){const r=this.semanticTypes[n][0];if(r===e){const e=this.semanticTypes[n][1];return this.semanticTypes[n][1]=t,e}}return this.semanticTypes.push([e,t]),null}push(e){return!e||(this.result[this.offset]=e,this.resultMethod[this.offset]=0,this.resultLength[this.offset]=e.length,this.offset++,this.streaming&&this.onData(this.finalize()),!0)}pushWrite(e,t,r){return this.result[this.offset]=e,this.resultMethod[this.offset]=t,this.resultLength[this.offset]=r,this.offset++,this.streaming&&this.onData(this.finalize()),!0}_pushUInt8(e){return this.pushWrite(e,1,1)}_pushUInt16BE(e){return this.pushWrite(e,2,2)}_pushUInt32BE(e){return this.pushWrite(e,3,4)}_pushDoubleBE(e){return this.pushWrite(e,4,8)}_pushNaN(){return this.push(_)}_pushInfinity(e){const t=e<0?w:S;return this.push(t)}_pushFloat(e){const r=t.allocUnsafe(2);if(o.writeHalf(r,e)&&o.parseHalf(r)===e)return this._pushUInt8(h)&&this.push(r);const n=t.allocUnsafe(4);return n.writeFloatBE(e,0),n.readFloatBE(0)===e?this._pushUInt8(p)&&this.push(n):this._pushUInt8(d)&&this._pushDoubleBE(e)}_pushInt(e,t,r){const n=t<<5;return e<24?this._pushUInt8(n|e):e<=255?this._pushUInt8(n|u.ONE)&&this._pushUInt8(e):e<=65535?this._pushUInt8(n|u.TWO)&&this._pushUInt16BE(e):e<=4294967295?this._pushUInt8(n|u.FOUR)&&this._pushUInt32BE(e):e<=Number.MAX_SAFE_INTEGER?this._pushUInt8(n|u.EIGHT)&&this._pushUInt32BE(Math.floor(e/c))&&this._pushUInt32BE(e%c):t===a.NEG_INT?this._pushFloat(r):this._pushFloat(e)}_pushIntNum(e){return e<0?this._pushInt(-e-1,a.NEG_INT,e):this._pushInt(e,a.POS_INT)}_pushNumber(e){switch(!1){case e==e:return this._pushNaN(e);case isFinite(e):return this._pushInfinity(e);case e%1!=0:return this._pushIntNum(e);default:return this._pushFloat(e)}}_pushString(e){const r=t.byteLength(e,"utf8");return this._pushInt(r,a.UTF8_STRING)&&this.pushWrite(e,5,r)}_pushBoolean(e){return this._pushUInt8(e?y:g)}_pushUndefined(e){return this._pushUInt8(m)}_pushArray(e,t){const r=t.length;if(!e._pushInt(r,a.ARRAY))return!1;for(let n=0;n<r;n++)if(!e.pushAny(t[n]))return!1;return!0}_pushTag(e){return this._pushInt(e,a.TAG)}_pushDate(e,t){return e._pushTag(l.DATE_EPOCH)&&e.pushAny(Math.round(t/1e3))}_pushBuffer(e,t){return e._pushInt(t.length,a.BYTE_STRING)&&e.push(t)}_pushNoFilter(e,t){return e._pushBuffer(e,t.slice())}_pushRegexp(e,t){return e._pushTag(l.REGEXP)&&e.pushAny(t.source)}_pushSet(e,t){if(!e._pushInt(t.size,a.ARRAY))return!1;for(let r of t)if(!e.pushAny(r))return!1;return!0}_pushUrl(e,t){return e._pushTag(l.URI)&&e.pushAny(t.format())}_pushBigint(e){let r=l.POS_BIGINT;e.isNegative()&&(e=e.negated().minus(1),r=l.NEG_BIGINT);let n=e.toString(16);n.length%2&&(n="0"+n);const i=t.from(n,"hex");return this._pushTag(r)&&this._pushBuffer(this,i)}_pushBigNumber(e,t){if(t.isNaN())return e._pushNaN();if(!t.isFinite())return e._pushInfinity(t.isNegative()?-1/0:1/0);if(t.isInteger())return e._pushBigint(t);if(!e._pushTag(l.DECIMAL_FRAC)||!e._pushInt(2,a.ARRAY))return!1;const r=t.decimalPlaces(),n=t.multipliedBy(new i(10).pow(r));return!!e._pushIntNum(-r)&&(n.abs().isLessThan(v)?e._pushIntNum(n.toNumber()):e._pushBigint(n))}_pushMap(e,t){return!!e._pushInt(t.size,a.MAP)&&this._pushRawMap(t.size,Array.from(t))}_pushObject(e){if(!e)return this._pushUInt8(b);for(var t=this.semanticTypes.length,r=0;r<t;r++)if(e instanceof this.semanticTypes[r][0])return this.semanticTypes[r][1].call(e,this,e);var n=e.encodeCBOR;if("function"==typeof n)return n.call(e,this);var i=Object.keys(e),o=i.length;return!!this._pushInt(o,a.MAP)&&this._pushRawMap(o,i.map(t=>[t,e[t]]))}_pushRawMap(e,t){t=t.map(function(e){return e[0]=E.encode(e[0]),e}).sort(o.keySorter);for(var r=0;r<e;r++){if(!this.push(t[r][0]))return!1;if(!this.pushAny(t[r][1]))return!1}return!0}write(e){return this.pushAny(e)}pushAny(e){var r=k(e);switch(r){case"Number":return this._pushNumber(e);case"String":return this._pushString(e);case"Boolean":return this._pushBoolean(e);case"Object":return this._pushObject(e);case"Array":return this._pushArray(this,e);case"Uint8Array":return this._pushBuffer(this,t.isBuffer(e)?e:t.from(e));case"Null":return this._pushUInt8(b);case"Undefined":return this._pushUndefined(e);case"Map":return this._pushMap(this,e);case"Set":return this._pushSet(this,e);case"Date":return this._pushDate(this,e);case"RegExp":return this._pushRegexp(this,e);case"Symbol":switch(e){case f.NULL:return this._pushObject(null);case f.UNDEFINED:return this._pushUndefined(void 0);default:throw new Error("Unknown symbol: "+e.toString())}default:throw new Error("Unknown type: "+typeof e+", "+(e?e.toString():""))}}finalize(){if(0===this.offset)return null;for(var e=this.result,r=this.resultLength,n=this.resultMethod,i=this.offset,o=0,s=0;s<i;s++)o+=r[s];var a=t.allocUnsafe(o),u=0,c=0;for(s=0;s<i;s++){switch(c=r[s],n[s]){case 0:e[s].copy(a,u);break;case 1:a.writeUInt8(e[s],u,!0);break;case 2:a.writeUInt16BE(e[s],u,!0);break;case 3:a.writeUInt32BE(e[s],u,!0);break;case 4:a.writeDoubleBE(e[s],u,!0);break;case 5:a.write(e[s],u,c,"utf8");break;default:throw new Error("unkown method")}u+=c}var f=a;return this._reset(),f}_reset(){this.result=[],this.resultMethod=[],this.resultLength=[],this.offset=0}static encode(e){const t=new E,r=t.pushAny(e);if(!r)throw new Error("Failed to encode input");return t.finalize()}}e.exports=E}).call(this,r(0).Buffer)},function(e,t,r){var n=r(754);function i(e){if(!(e instanceof Object))throw new TypeError('"obj" must be an object (or inherit from it)');return o(e)}function o(e,t){for(var r in t=new n(e,t),e){var i=e[r];if(i instanceof Object&&(t.contains(i)||o(i,t)))return!0}return!1}e.exports=i},function(e,t){function r(e,t){this.value=e,this.next=t}e.exports=r,r.prototype.contains=function(e){for(var t=this;t;){if(t.value===e)return!0;t=t.next}return!1}},function(e,t,r){"use strict";t.util=r(390),t.resolver=r(391)},function(e,t,r){"use strict";(function(e){Object.defineProperty(t,"__esModule",{value:!0});const r={INVALID_ENCODING:"Invalid encoding provided. Please specify a valid encoding the internal Node.js Buffer supports.",INVALID_SMARTBUFFER_SIZE:"Invalid size provided. Size must be a valid integer greater than zero.",INVALID_SMARTBUFFER_BUFFER:"Invalid Buffer provided in SmartBufferOptions.",INVALID_SMARTBUFFER_OBJECT:"Invalid SmartBufferOptions object supplied to SmartBuffer constructor or factory methods.",INVALID_OFFSET:"An invalid offset value was provided.",INVALID_OFFSET_NON_NUMBER:"An invalid offset value was provided. A numeric value is required.",INVALID_LENGTH:"An invalid length value was provided.",INVALID_LENGTH_NON_NUMBER:"An invalid length value was provived. A numeric value is required.",INVALID_TARGET_OFFSET:"Target offset is beyond the bounds of the internal SmartBuffer data.",INVALID_TARGET_LENGTH:"Specified length value moves cursor beyong the bounds of the internal SmartBuffer data.",INVALID_READ_BEYOND_BOUNDS:"Attempted to read beyond the bounds of the managed data.",INVALID_WRITE_BEYOND_BOUNDS:"Attempted to write beyond the bounds of the managed data."};function n(t){if(!e.isEncoding(t))throw new Error(r.INVALID_ENCODING)}function i(e){return"number"==typeof e&&isFinite(e)&&c(e)}function o(e,t){if("number"!=typeof e)throw new Error(t?r.INVALID_OFFSET_NON_NUMBER:r.INVALID_LENGTH_NON_NUMBER);if(!i(e)||e<0)throw new Error(t?r.INVALID_OFFSET:r.INVALID_LENGTH)}function s(e){o(e,!1)}function a(e){o(e,!0)}function u(e,t){if(e<0||e>t.length)throw new Error(r.INVALID_TARGET_OFFSET)}function c(e){return"number"==typeof e&&isFinite(e)&&Math.floor(e)===e}t.ERRORS=r,t.checkEncoding=n,t.isFiniteInteger=i,t.checkLengthValue=s,t.checkOffsetValue=a,t.checkTargetOffset=u}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(n){const i=r(3),o=r(172).SmartBuffer,s=r(171);t=e.exports,t.serialize=((e,t)=>{let r=[];r.push("tree "+s.cidToSha(e.tree["/"]).toString("hex")),e.parents.forEach(e=>{r.push("parent "+s.cidToSha(e["/"]).toString("hex"))}),r.push("author "+s.serializePersonLine(e.author)),r.push("committer "+s.serializePersonLine(e.committer)),e.encoding&&r.push("encoding "+e.encoding),e.signature&&(r.push("gpgsig -----BEGIN PGP SIGNATURE-----"),r.push(e.signature.text)),r.push(""),r.push(e.message);let n=r.join("\n"),a=new o;a.writeString("commit "),a.writeString(n.length.toString()),a.writeUInt8(0),a.writeString(n),i(()=>t(null,a.toBuffer()))}),t.deserialize=((e,t)=>{let r=e.toString().split("\n"),o={gitType:"commit",parents:[]};for(let e=0;e<r.length;e++){let a=r[e].match(/^([^ ]+) (.+)$/);if(!a){""!==r[e]&&i(()=>t(new Error("Invalid commit line "+e))),o.message=r.slice(e+1).join("\n");break}let u=a[1],c=a[2];switch(u){case"tree":o.tree={"/":s.shaToCid(n.from(c,"hex"))};break;case"committer":o.committer=s.parsePersonLine(c);break;case"author":o.author=s.parsePersonLine(c);break;case"parent":o.parents.push({"/":s.shaToCid(n.from(c,"hex"))});break;case"gpgsig":{"-----BEGIN PGP SIGNATURE-----"!==c&&i(()=>t(new Error("Invalid commit line "+e))),o.signature={};let n=e;for(;e<r.length-1;e++)if(" "!==r[e+1][0]){o.signature.text=r.slice(n+1,e+1).join("\n");break}break}default:o[u]=c}}i(()=>t(null,o))})}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(n){const i=r(3),o=r(172).SmartBuffer,s=r(171);t=e.exports,t.serialize=((e,t)=>{let r=[];r.push("object "+s.cidToSha(e.object["/"]).toString("hex")),r.push("type "+e.type),r.push("tag "+e.tag),null!==e.tagger&&r.push("tagger "+s.serializePersonLine(e.tagger)),r.push(""),r.push(e.message);let n=r.join("\n"),a=new o;a.writeString("tag "),a.writeString(n.length.toString()),a.writeUInt8(0),a.writeString(n),i(()=>t(null,a.toBuffer()))}),t.deserialize=((e,t)=>{let r=e.toString().split("\n"),o={gitType:"tag"};for(let e=0;e<r.length;e++){let a=r[e].match(/^([^ ]+) (.+)$/);if(null===a){""!==r[e]&&i(()=>t(new Error("Invalid tag line "+e))),o.message=r.slice(e+1).join("\n");break}let u=a[1],c=a[2];switch(u){case"object":o.object={"/":s.shaToCid(n.from(c,"hex"))};break;case"tagger":o.tagger=s.parsePersonLine(c);break;case"tag":o.tag=c;break;case"type":o.type=c;break;default:o[u]=c}}i(()=>t(null,o))})}).call(this,r(0).Buffer)},function(e,t,r){"use strict";const n=r(3),i=r(172).SmartBuffer,o=r(171);t=e.exports,t.serialize=((e,t)=>{let r=[];Object.keys(e).forEach(t=>{r.push([t,e[t]])}),r.sort((e,t)=>e[0]>t[0]?1:-1);let s=new i;r.forEach(e=>{s.writeStringNT(e[1].mode+" "+e[0]),s.writeBuffer(o.cidToSha(e[1].hash["/"]))});let a=new i;a.writeString("tree "),a.writeString(s.length.toString()),a.writeUInt8(0),a.writeBuffer(s.toBuffer()),n(()=>t(null,a.toBuffer()))}),t.deserialize=((e,t)=>{let r={},s=i.fromBuffer(e,"utf8");for(;;){let e=s.readStringNT();if(""===e)break;let i=s.readBuffer(o.SHA1_LENGTH),a=e.match(/^(\d+) (.+)$/);a||n(()=>t(new Error("invalid file mode/name"))),r[a[2]]&&n(()=>t(new Error("duplicate file in tree"))),r[a[2]]={mode:a[1],hash:{"/":o.shaToCid(i)}}}n(()=>t(null,r))})},function(e,t,r){"use strict";t.resolver=r(228),t.util=r(392)},function(e,t,r){var n=r(29),i=r(231);for(var o in i)n[o]=i[o];e.exports={bufferutils:r(399),Block:r(779),ECPair:r(238),ECSignature:r(242),HDNode:r(795),Transaction:r(237),TransactionBuilder:r(796),address:r(239),crypto:r(108),networks:r(128),opcodes:r(39),script:n}},function(e,t,r){(function(t){var n=r(230),i=r(394);function o(e){return t.isBuffer(e)}function s(e){return"string"==typeof e&&/^([0-9a-f]{2})+$/i.test(e)}function a(e,t){var r=e.toJSON();function n(n){if(!e(n))return!1;if(n.length===t)return!0;throw i.tfCustomError(r+"(Length: "+t+")",r+"(Length: "+n.length+")")}return n.toJSON=function(){return r},n}var u=a.bind(null,n.Array),c=a.bind(null,o),f=a.bind(null,s),l=a.bind(null,n.String),h=Math.pow(2,53)-1;function p(e){return"number"==typeof e&&isFinite(e)}function d(e){return e<<24>>24===e}function y(e){return e<<16>>16===e}function g(e){return(0|e)===e}function m(e){return(255&e)===e}function b(e){return(65535&e)===e}function v(e){return e>>>0===e}function _(e){return"number"==typeof e&&e>=0&&e<=h&&Math.floor(e)===e}var w={ArrayN:u,Buffer:o,BufferN:c,Finite:p,Hex:s,HexN:f,Int8:d,Int16:y,Int32:g,StringN:l,UInt8:m,UInt16:b,UInt32:v,UInt53:_};for(var S in w)w[S].toJSON=function(e){return e}.bind(null,S);e.exports=w}).call(this,r(0).Buffer)},function(e,t,r){var n=r(39),i={};for(var o in n){var s=n[o];i[s]=o}e.exports=i},function(e,t,r){var n=r(2).Buffer,i=r(29),o=r(396),s=r(25),a=r(39);function u(e){return e===a.OP_0||i.isCanonicalSignature(e)}function c(e,t){var r=i.decompile(e);return!(r.length<2)&&(r[0]===a.OP_0&&(t?r.slice(1).every(u):r.slice(1).every(i.isCanonicalSignature)))}c.toJSON=function(){return"multisig input"};var f=n.allocUnsafe(0);function l(e,t){if(s([u],e),t){var r=o.decode(t);if(e.length<r.m)throw new TypeError("Not enough signatures provided");if(e.length>r.pubKeys.length)throw new TypeError("Too many signatures provided")}return[].concat(f,e.map(function(e){return e===a.OP_0?f:e}))}function h(e,t){return i.compile(l(e,t))}function p(e,t){return s(s.Array,e),s(c,e,t),e.slice(1)}function d(e,t){var r=i.decompile(e);return p(r,t)}e.exports={check:c,decode:d,decodeStack:p,encode:h,encodeStack:l}},function(e,t,r){var n=r(29),i=r(33),o=r(25),s=r(39);function a(e){var t=n.compile(e);return t.length>1&&t[0]===s.OP_RETURN}function u(e){return o(i.Buffer,e),n.compile([s.OP_RETURN,e])}function c(e){return o(a,e),e.slice(2)}a.toJSON=function(){return"null data output"},e.exports={output:{check:a,decode:c,encode:u}}},function(e,t,r){var n=r(29),i=r(25);function o(e){var t=n.decompile(e);return 1===t.length&&n.isCanonicalSignature(t[0])}function s(e){return i(n.isCanonicalSignature,e),[e]}function a(e){return n.compile(s(e))}function u(e){return i(i.Array,e),i(o,e),e[0]}function c(e){var t=n.decompile(e);return u(t)}o.toJSON=function(){return"pubKey input"},e.exports={check:o,decode:c,decodeStack:u,encode:a,encodeStack:s}},function(e,t,r){var n=r(29),i=r(25),o=r(39);function s(e){var t=n.decompile(e);return 2===t.length&&n.isCanonicalPubKey(t[0])&&t[1]===o.OP_CHECKSIG}function a(e){return i(n.isCanonicalPubKey,e),n.compile([e,o.OP_CHECKSIG])}function u(e){var t=n.decompile(e);return i(s,t),t[0]}s.toJSON=function(){return"pubKey output"},e.exports={check:s,decode:u,encode:a}},function(e,t,r){var n=r(29),i=r(25);function o(e){var t=n.decompile(e);return 2===t.length&&n.isCanonicalSignature(t[0])&&n.isCanonicalPubKey(t[1])}function s(e,t){return i({signature:n.isCanonicalSignature,pubKey:n.isCanonicalPubKey},{signature:e,pubKey:t}),[e,t]}function a(e,t){return n.compile(s(e,t))}function u(e){return i(i.Array,e),i(o,e),{signature:e[0],pubKey:e[1]}}function c(e){var t=n.decompile(e);return u(t)}o.toJSON=function(){return"pubKeyHash input"},e.exports={check:o,decode:c,decodeStack:u,encode:a,encodeStack:s}},function(e,t,r){var n=r(29),i=r(33),o=r(25),s=r(39);function a(e){var t=n.compile(e);return 25===t.length&&t[0]===s.OP_DUP&&t[1]===s.OP_HASH160&&20===t[2]&&t[23]===s.OP_EQUALVERIFY&&t[24]===s.OP_CHECKSIG}function u(e){return o(i.Hash160bit,e),n.compile([s.OP_DUP,s.OP_HASH160,e,s.OP_EQUALVERIFY,s.OP_CHECKSIG])}function c(e){return o(a,e),e.slice(3,23)}a.toJSON=function(){return"pubKeyHash output"},e.exports={check:a,decode:c,encode:u}},function(e,t,r){e.exports={input:r(771),output:r(772)}},function(e,t,r){var n=r(2).Buffer,i=r(29),o=r(25),s=r(232),a=r(233),u=r(234),c=r(397),f=r(398);function l(e,t){var r=i.decompile(e);if(r.length<1)return!1;var o=r[r.length-1];if(!n.isBuffer(o))return!1;var l=i.decompile(i.compile(r.slice(0,-1))),h=i.decompile(o);return 0!==h.length&&(!!i.isPushOnly(l)&&(1===r.length?f.check(h)||c.check(h):!(!u.input.check(l)||!u.output.check(h))||(!(!s.input.check(l,t)||!s.output.check(h))||!(!a.input.check(l)||!a.output.check(h)))))}function h(e,t){var r=i.compile(t);return[].concat(e,r)}function p(e,t){var r=i.decompile(e);return i.compile(h(r,t))}function d(e){return o(o.Array,e),o(l,e),{redeemScriptStack:e.slice(0,-1),redeemScript:e[e.length-1]}}function y(e){var t=i.decompile(e),r=d(t);return r.redeemScriptSig=i.compile(r.redeemScriptStack),delete r.redeemScriptStack,r}l.toJSON=function(){return"scriptHash input"},e.exports={check:l,decode:y,decodeStack:d,encode:p,encodeStack:h}},function(e,t,r){var n=r(29),i=r(33),o=r(25),s=r(39);function a(e){var t=n.compile(e);return 23===t.length&&t[0]===s.OP_HASH160&&20===t[1]&&t[22]===s.OP_EQUAL}function u(e){return o(i.Hash160bit,e),n.compile([s.OP_HASH160,e,s.OP_EQUAL])}function c(e){return o(a,e),e.slice(2,22)}a.toJSON=function(){return"scriptHash output"},e.exports={check:a,decode:c,encode:u}},function(e,t,r){e.exports={input:r(774),output:r(397)}},function(e,t,r){var n=r(29),i=r(25);function o(e){return n.isCanonicalPubKey(e)&&33===e.length}function s(e){var t=n.decompile(e);return 2===t.length&&n.isCanonicalSignature(t[0])&&o(t[1])}function a(e,t){return i({signature:n.isCanonicalSignature,pubKey:o},{signature:e,pubKey:t}),[e,t]}function u(e){return i(i.Array,e),i(s,e),{signature:e[0],pubKey:e[1]}}s.toJSON=function(){return"witnessPubKeyHash input"},e.exports={check:s,decodeStack:u,encodeStack:a}},function(e,t,r){e.exports={input:r(776),output:r(398)}},function(e,t,r){(function(t){var n=r(29),i=r(33),o=r(25),s=r(232),a=r(233),u=r(234);function c(e,r){if(o(i.Array,e),e.length<1)return!1;var c=e[e.length-1];if(!t.isBuffer(c))return!1;var f=n.decompile(c);if(0===f.length)return!1;var l=n.compile(e.slice(0,-1));return!(!u.input.check(l)||!u.output.check(f))||(!(!s.input.check(l,r)||!s.output.check(f))||!(!a.input.check(l)||!a.output.check(f)))}function f(e,t){return o({witnessData:[i.Buffer],witnessScript:i.Buffer},{witnessData:e,witnessScript:t}),[].concat(e,t)}function l(e){return o(o.Array,e),o(c,e),{witnessData:e.slice(0,-1),witnessScript:e[e.length-1]}}c.toJSON=function(){return"witnessScriptHash input"},e.exports={check:c,decodeStack:l,encodeStack:f}}).call(this,r(0).Buffer)},function(e,t,r){e.exports={output:r(778)}},function(e,t,r){var n=r(2).Buffer,i=r(29),o=r(33),s=r(25),a=r(39),u=n.from("aa21a9ed","hex");function c(e){var t=i.compile(e);return t.length>37&&t[0]===a.OP_RETURN&&36===t[1]&&t.slice(2,6).equals(u)}function f(e){s(o.Hash256bit,e);var t=n.allocUnsafe(36);return u.copy(t,0),e.copy(t,4),i.compile([a.OP_RETURN,t])}function l(e){return s(c,e),i.decompile(e)[1].slice(4,36)}c.toJSON=function(){return"Witness commitment output"},e.exports={check:c,decode:l,encode:f}},function(e,t,r){var n=r(2).Buffer,i=r(108),o=r(784),s=r(25),a=r(33),u=r(235),c=r(237);function f(){this.version=1,this.prevHash=null,this.merkleRoot=null,this.timestamp=0,this.bits=0,this.nonce=0}f.fromBuffer=function(e){if(e.length<80)throw new Error("Buffer too small (< 80 bytes)");var t=0;function r(r){return t+=r,e.slice(t-r,t)}function n(){var r=e.readUInt32LE(t);return t+=4,r}function i(){var r=e.readInt32LE(t);return t+=4,r}var o=new f;if(o.version=i(),o.prevHash=r(32),o.merkleRoot=r(32),o.timestamp=n(),o.bits=n(),o.nonce=n(),80===e.length)return o;function s(){var r=u.decode(e,t);return t+=u.decode.bytes,r}function a(){var r=c.fromBuffer(e.slice(t),!0);return t+=r.byteLength(),r}var l=s();o.transactions=[];for(var h=0;h<l;++h){var p=a();o.transactions.push(p)}return o},f.prototype.byteLength=function(e){return e||!this.transactions?80:80+u.encodingLength(this.transactions.length)+this.transactions.reduce(function(e,t){return e+t.byteLength()},0)},f.fromHex=function(e){return f.fromBuffer(n.from(e,"hex"))},f.prototype.getHash=function(){return i.hash256(this.toBuffer(!0))},f.prototype.getId=function(){return this.getHash().reverse().toString("hex")},f.prototype.getUTCDate=function(){var e=new Date(0);return e.setUTCSeconds(this.timestamp),e},f.prototype.toBuffer=function(e){var t=n.allocUnsafe(this.byteLength(e)),r=0;function i(e){e.copy(t,r),r+=e.length}function o(e){t.writeInt32LE(e,r),r+=4}function s(e){t.writeUInt32LE(e,r),r+=4}return o(this.version),i(this.prevHash),i(this.merkleRoot),s(this.timestamp),s(this.bits),s(this.nonce),e||!this.transactions?t:(u.encode(this.transactions.length,t,r),r+=u.encode.bytes,this.transactions.forEach(function(e){var n=e.byteLength();e.toBuffer(t,r),r+=n}),t)},f.prototype.toHex=function(e){return this.toBuffer(e).toString("hex")},f.calculateTarget=function(e){var t=((4278190080&e)>>24)-3,r=8388607&e,i=n.alloc(32,0);return i.writeUInt32BE(r,28-t),i},f.calculateMerkleRoot=function(e){if(s([{getHash:a.Function}],e),0===e.length)throw TypeError("Cannot compute merkle root for zero transactions");var t=e.map(function(e){return e.getHash()});return o(t,i.hash256)},f.prototype.checkMerkleRoot=function(){if(!this.transactions)return!1;var e=f.calculateMerkleRoot(this.transactions);return 0===this.merkleRoot.compare(e)},f.prototype.checkProofOfWork=function(){var e=this.getHash().reverse(),t=f.calculateTarget(this.bits);return e.compare(t)<=0},e.exports=f},function(e,t,r){var n=r(4),i=r(109),o=r(2).Buffer,s=[1518500249,1859775393,-1894007588,-899497514],a=new Array(80);function u(){this.init(),this._w=a,i.call(this,64,56)}function c(e){return e<<5|e>>>27}function f(e){return e<<30|e>>>2}function l(e,t,r,n){return 0===e?t&r|~t&n:2===e?t&r|t&n|r&n:t^r^n}n(u,i),u.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this},u.prototype._update=function(e){for(var t=this._w,r=0|this._a,n=0|this._b,i=0|this._c,o=0|this._d,a=0|this._e,u=0;u<16;++u)t[u]=e.readInt32BE(4*u);for(;u<80;++u)t[u]=t[u-3]^t[u-8]^t[u-14]^t[u-16];for(var h=0;h<80;++h){var p=~~(h/20),d=c(r)+l(p,n,i,o)+a+t[h]+s[p]|0;a=o,o=i,i=f(n),n=r,r=d}this._a=r+this._a|0,this._b=n+this._b|0,this._c=i+this._c|0,this._d=o+this._d|0,this._e=a+this._e|0},u.prototype._hash=function(){var e=o.allocUnsafe(20);return e.writeInt32BE(0|this._a,0),e.writeInt32BE(0|this._b,4),e.writeInt32BE(0|this._c,8),e.writeInt32BE(0|this._d,12),e.writeInt32BE(0|this._e,16),e},e.exports=u},function(e,t,r){var n=r(4),i=r(109),o=r(2).Buffer,s=[1518500249,1859775393,-1894007588,-899497514],a=new Array(80);function u(){this.init(),this._w=a,i.call(this,64,56)}function c(e){return e<<1|e>>>31}function f(e){return e<<5|e>>>27}function l(e){return e<<30|e>>>2}function h(e,t,r,n){return 0===e?t&r|~t&n:2===e?t&r|t&n|r&n:t^r^n}n(u,i),u.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this},u.prototype._update=function(e){for(var t=this._w,r=0|this._a,n=0|this._b,i=0|this._c,o=0|this._d,a=0|this._e,u=0;u<16;++u)t[u]=e.readInt32BE(4*u);for(;u<80;++u)t[u]=c(t[u-3]^t[u-8]^t[u-14]^t[u-16]);for(var p=0;p<80;++p){var d=~~(p/20),y=f(r)+h(d,n,i,o)+a+t[p]+s[d]|0;a=o,o=i,i=l(n),n=r,r=y}this._a=r+this._a|0,this._b=n+this._b|0,this._c=i+this._c|0,this._d=o+this._d|0,this._e=a+this._e|0},u.prototype._hash=function(){var e=o.allocUnsafe(20);return e.writeInt32BE(0|this._a,0),e.writeInt32BE(0|this._b,4),e.writeInt32BE(0|this._c,8),e.writeInt32BE(0|this._d,12),e.writeInt32BE(0|this._e,16),e},e.exports=u},function(e,t,r){var n=r(4),i=r(403),o=r(109),s=r(2).Buffer,a=new Array(64);function u(){this.init(),this._w=a,o.call(this,64,56)}n(u,i),u.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},u.prototype._hash=function(){var e=s.allocUnsafe(28);return e.writeInt32BE(this._a,0),e.writeInt32BE(this._b,4),e.writeInt32BE(this._c,8),e.writeInt32BE(this._d,12),e.writeInt32BE(this._e,16),e.writeInt32BE(this._f,20),e.writeInt32BE(this._g,24),e},e.exports=u},function(e,t,r){var n=r(4),i=r(404),o=r(109),s=r(2).Buffer,a=new Array(160);function u(){this.init(),this._w=a,o.call(this,128,112)}n(u,i),u.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},u.prototype._hash=function(){var e=s.allocUnsafe(48);function t(t,r,n){e.writeInt32BE(t,n),e.writeInt32BE(r,n+4)}return t(this._ah,this._al,0),t(this._bh,this._bl,8),t(this._ch,this._cl,16),t(this._dh,this._dl,24),t(this._eh,this._el,32),t(this._fh,this._fl,40),e},e.exports=u},function(e,t,r){(function(t){e.exports=function e(r,n){if(!Array.isArray(r))throw TypeError("Expected values Array");if("function"!=typeof n)throw TypeError("Expected digest Function");for(var i=r.length,o=r.concat();i>1;){for(var s=0,a=0;a<i;a+=2,++s){var u=o[a],c=a+1===i?u:o[a+1],f=t.concat([u,c]);o[s]=n(f)}i=s}return o[0]}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";for(var n="qpzry9x8gf2tvdw0s3jn54khce6mua7l",i={},o=0;o<n.length;o++){var s=n.charAt(o);if(void 0!==i[s])throw new TypeError(s+" is ambiguous");i[s]=o}function a(e){var t=e>>25;return(33554431&e)<<5^996825010&-(t>>0&1)^642813549&-(t>>1&1)^513874426&-(t>>2&1)^1027748829&-(t>>3&1)^705979059&-(t>>4&1)}function u(e){for(var t=1,r=0;r<e.length;++r){var n=e.charCodeAt(r);if(n<33||n>126)throw new Error("Invalid prefix ("+e+")");t=a(t)^n>>5}for(t=a(t),r=0;r<e.length;++r){var i=e.charCodeAt(r);t=a(t)^31&i}return t}function c(e,t,r){if(r=r||90,e.length+7+t.length>r)throw new TypeError("Exceeds length limit");e=e.toLowerCase();for(var i=u(e),o=e+"1",s=0;s<t.length;++s){var c=t[s];if(c>>5!=0)throw new Error("Non 5-bit word");i=a(i)^c,o+=n.charAt(c)}for(s=0;s<6;++s)i=a(i);for(i^=1,s=0;s<6;++s){var f=i>>5*(5-s)&31;o+=n.charAt(f)}return o}function f(e,t){if(t=t||90,e.length<8)throw new TypeError(e+" too short");if(e.length>t)throw new TypeError("Exceeds length limit");var r=e.toLowerCase(),n=e.toUpperCase();if(e!==r&&e!==n)throw new Error("Mixed-case string "+e);e=r;var o=e.lastIndexOf("1");if(-1===o)throw new Error("No separator character for "+e);if(0===o)throw new Error("Missing prefix for "+e);var s=e.slice(0,o),c=e.slice(o+1);if(c.length<6)throw new Error("Data too short");for(var f=u(s),l=[],h=0;h<c.length;++h){var p=c.charAt(h),d=i[p];if(void 0===d)throw new Error("Unknown character "+p);f=a(f)^d,h+6>=c.length||l.push(d)}if(1!==f)throw new Error("Invalid checksum for "+e);return{prefix:s,words:l}}function l(e,t,r,n){for(var i=0,o=0,s=(1<<r)-1,a=[],u=0;u<e.length;++u)for(i=i<<t|e[u],o+=t;o>=r;)o-=r,a.push(i>>o&s);if(n)o>0&&a.push(i<<r-o&s);else{if(o>=t)throw new Error("Excess padding");if(i<<r-o&s)throw new Error("Non-zero padding")}return a}function h(e){return l(e,8,5,!0)}function p(e){return l(e,5,8,!1)}e.exports={decode:f,encode:c,toWords:h,fromWords:p}},function(e,t,r){"use strict";var n=r(18),i=r(2).Buffer;e.exports=function(e){function t(t){var r=e(t);return n.encode(i.concat([t,r],t.length+4))}function r(t){var r=t.slice(0,-4),n=t.slice(-4),i=e(r);if(!(n[0]^i[0]|n[1]^i[1]|n[2]^i[2]|n[3]^i[3]))return r}function o(e){var t=n.decodeUnsafe(e);if(t)return r(t)}function s(t){var i=n.decode(t),o=r(i,e);if(!o)throw new Error("Invalid checksum");return o}return{encode:t,decode:s,decodeUnsafe:o}}},function(e,t,r){var n=r(2).Buffer,i=r(241),o=r(25),s=r(33),a=r(95),u=r(242),c=n.alloc(1,0),f=n.alloc(1,1),l=r(243),h=l.getCurveByName("secp256k1");function p(e,t,r){o(s.tuple(s.Hash256bit,s.Buffer256bit,s.Function),arguments);var u=n.alloc(32,0),l=n.alloc(32,1);u=i("sha256",u).update(l).update(c).update(t).update(e).digest(),l=i("sha256",u).update(l).digest(),u=i("sha256",u).update(l).update(f).update(t).update(e).digest(),l=i("sha256",u).update(l).digest(),l=i("sha256",u).update(l).digest();for(var p=a.fromBuffer(l);p.signum()<=0||p.compareTo(h.n)>=0||!r(p);)u=i("sha256",u).update(l).update(c).digest(),l=i("sha256",u).update(l).digest(),l=i("sha256",u).update(l).digest(),p=a.fromBuffer(l);return p}var d=h.n.shiftRight(1);function y(e,t){o(s.tuple(s.Hash256bit,s.BigInt),arguments);var r=t.toBuffer(32),n=a.fromBuffer(e),i=h.n,c=h.G,f,l;return p(e,r,function(e){var r=c.multiply(e);return!h.isInfinity(r)&&(f=r.affineX.mod(i),0!==f.signum()&&(l=e.modInverse(i).multiply(n.add(t.multiply(f))).mod(i),0!==l.signum()))}),l.compareTo(d)>0&&(l=i.subtract(l)),new u(f,l)}function g(e,t,r){o(s.tuple(s.Hash256bit,s.ECSignature,s.ECPoint),arguments);var n=h.n,i=h.G,u=t.r,c=t.s;if(u.signum()<=0||u.compareTo(n)>=0)return!1;if(c.signum()<=0||c.compareTo(n)>=0)return!1;var f=a.fromBuffer(e),l=c.modInverse(n),p=f.multiply(l).mod(n),d=u.multiply(l).mod(n),y=i.multiplyTwo(p,r,d);if(h.isInfinity(y))return!1;var g=y.affineX,m=g.mod(n);return m.equals(u)}e.exports={deterministicGenerateK:p,sign:y,verify:g,__curve:h}},function(e,t,r){"use strict";var n=r(4),i=r(2).Buffer,o=r(94),s=i.alloc(128),a=64;function u(e,t){o.call(this,"digest"),"string"==typeof t&&(t=i.from(t)),this._alg=e,this._key=t,t.length>a?t=e(t):t.length<a&&(t=i.concat([t,s],a));for(var r=this._ipad=i.allocUnsafe(a),n=this._opad=i.allocUnsafe(a),u=0;u<a;u++)r[u]=54^t[u],n[u]=92^t[u];this._hash=[r]}n(u,o),u.prototype._update=function(e){this._hash.push(e)},u.prototype._final=function(){var e=this._alg(i.concat(this._hash));return this._alg(i.concat([this._opad,e]))},e.exports=u},function(e,t,r){var n=r(236);e.exports=function(e){return(new n).update(e).digest()}},function(e){e.exports={_from:"bigi@^1.4.0",_id:"bigi@1.4.2",_inBundle:!1,_integrity:"sha1-nGZalfiLiwj8Bc/XMfVhhZ1yWCU=",_location:"/bigi",_phantomChildren:{},_requested:{type:"range",registry:!0,raw:"bigi@^1.4.0",name:"bigi",escapedName:"bigi",rawSpec:"^1.4.0",saveSpec:null,fetchSpec:"^1.4.0"},_requiredBy:["/bitcoinjs-lib","/ecurve"],_resolved:"https://registry.npmjs.org/bigi/-/bigi-1.4.2.tgz",_shasum:"9c665a95f88b8b08fc05cfd731f561859d725825",_spec:"bigi@^1.4.0",_where:"/Users/mitra/git/dweb-transports/node_modules/bitcoinjs-lib",bugs:{url:"https://github.com/cryptocoinjs/bigi/issues"},bundleDependencies:!1,dependencies:{},deprecated:!1,description:"Big integers.",devDependencies:{coveralls:"^2.11.2",istanbul:"^0.3.5",jshint:"^2.5.1",mocha:"^2.1.0",mochify:"^2.1.0"},homepage:"https://github.com/cryptocoinjs/bigi#readme",keywords:["cryptography","math","bitcoin","arbitrary","precision","arithmetic","big","integer","int","number","biginteger","bigint","bignumber","decimal","float"],main:"./lib/index.js",name:"bigi",repository:{url:"git+https://github.com/cryptocoinjs/bigi.git",type:"git"},scripts:{"browser-test":"mochify --wd -R spec",coverage:"istanbul cover ./node_modules/.bin/_mocha -- --reporter list test/*.js",coveralls:"npm run-script coverage && node ./node_modules/.bin/coveralls < coverage/lcov.info",jshint:"jshint --config jshint.json lib/*.js ; true",test:"_mocha -- test/*.js",unit:"mocha"},testling:{files:"test/*.js",harness:"mocha",browsers:["ie/9..latest","firefox/latest","chrome/latest","safari/6.0..latest","iphone/6.0..latest","android-browser/4.2..latest"]},version:"1.4.2"}},function(e,t,r){(function(e){var t=r(13),n=r(405);n.fromByteArrayUnsigned=function(e){return 128&e[0]?new n([0].concat(e)):new n(e)},n.prototype.toByteArrayUnsigned=function(){var e=this.toByteArray();return 0===e[0]?e.slice(1):e},n.fromDERInteger=function(e){return new n(e)},n.prototype.toDERInteger=n.prototype.toByteArray,n.fromBuffer=function(e){if(128&e[0]){var t=Array.prototype.slice.call(e);return new n([0].concat(t))}return new n(e)},n.fromHex=function(e){return""===e?n.ZERO:(t.equal(e,e.match(/^[A-Fa-f0-9]+/),"Invalid hex string"),t.equal(e.length%2,0,"Incomplete hex"),new n(e,16))},n.prototype.toBuffer=function(t){for(var r=this.toByteArrayUnsigned(),n=[],i=t-r.length;n.length<i;)n.push(0);return new e(n.concat(r))},n.prototype.toHex=function(e){return this.toBuffer(e).toString("hex")}}).call(this,r(0).Buffer)},function(e,t,r){var n=r(95),i=r(793),o=r(407);function s(e){var t=i[e];if(!t)return null;var r=new n(t.p,16),s=new n(t.a,16),a=new n(t.b,16),u=new n(t.n,16),c=new n(t.h,16),f=new n(t.Gx,16),l=new n(t.Gy,16);return new o(r,s,a,f,l,u,c)}e.exports=s},function(e){e.exports={secp128r1:{p:"fffffffdffffffffffffffffffffffff",a:"fffffffdfffffffffffffffffffffffc",b:"e87579c11079f43dd824993c2cee5ed3",n:"fffffffe0000000075a30d1b9038a115",h:"01",Gx:"161ff7528b899b2d0c28607ca52c5b86",Gy:"cf5ac8395bafeb13c02da292dded7a83"},secp160k1:{p:"fffffffffffffffffffffffffffffffeffffac73",a:"00",b:"07",n:"0100000000000000000001b8fa16dfab9aca16b6b3",h:"01",Gx:"3b4c382ce37aa192a4019e763036f4f5dd4d7ebb",Gy:"938cf935318fdced6bc28286531733c3f03c4fee"},secp160r1:{p:"ffffffffffffffffffffffffffffffff7fffffff",a:"ffffffffffffffffffffffffffffffff7ffffffc",b:"1c97befc54bd7a8b65acf89f81d4d4adc565fa45",n:"0100000000000000000001f4c8f927aed3ca752257",h:"01",Gx:"4a96b5688ef573284664698968c38bb913cbfc82",Gy:"23a628553168947d59dcc912042351377ac5fb32"},secp192k1:{p:"fffffffffffffffffffffffffffffffffffffffeffffee37",a:"00",b:"03",n:"fffffffffffffffffffffffe26f2fc170f69466a74defd8d",h:"01",Gx:"db4ff10ec057e9ae26b07d0280b7f4341da5d1b1eae06c7d",Gy:"9b2f2f6d9c5628a7844163d015be86344082aa88d95e2f9d"},secp192r1:{p:"fffffffffffffffffffffffffffffffeffffffffffffffff",a:"fffffffffffffffffffffffffffffffefffffffffffffffc",b:"64210519e59c80e70fa7e9ab72243049feb8deecc146b9b1",n:"ffffffffffffffffffffffff99def836146bc9b1b4d22831",h:"01",Gx:"188da80eb03090f67cbf20eb43a18800f4ff0afd82ff1012",Gy:"07192b95ffc8da78631011ed6b24cdd573f977a11e794811"},secp256k1:{p:"fffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f",a:"00",b:"07",n:"fffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141",h:"01",Gx:"79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798",Gy:"483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8"},secp256r1:{p:"ffffffff00000001000000000000000000000000ffffffffffffffffffffffff",a:"ffffffff00000001000000000000000000000000fffffffffffffffffffffffc",b:"5ac635d8aa3a93e7b3ebbd55769886bc651d06b0cc53b0f63bce3c3e27d2604b",n:"ffffffff00000000ffffffffffffffffbce6faada7179e84f3b9cac2fc632551",h:"01",Gx:"6b17d1f2e12c4247f8bce6e563a440f277037d812deb33a0f4a13945d898c296",Gy:"4fe342e2fe1a7f9b8ee7eb4a7c0f9e162bce33576b315ececbb6406837bf51f5"}}},function(e,t,r){(function(t){var n=r(240);function i(e,t){if(void 0!==t&&e[0]!==t)throw new Error("Invalid network version");if(33===e.length)return{version:e[0],privateKey:e.slice(1,33),compressed:!1};if(34!==e.length)throw new Error("Invalid WIF length");if(1!==e[33])throw new Error("Invalid compression flag");return{version:e[0],privateKey:e.slice(1,33),compressed:!0}}function o(e,r,n){var i=new t(n?34:33);return i.writeUInt8(e,0),r.copy(i,1),n&&(i[33]=1),i}function s(e,t){return i(n.decode(e),t)}function a(e,t,r){return"number"==typeof e?n.encode(o(e,t,r)):n.encode(o(e.version,e.privateKey,e.compressed))}e.exports={decode:s,decodeRaw:i,encode:a,encodeRaw:o}}).call(this,r(0).Buffer)},function(e,t,r){var n=r(2).Buffer,i=r(240),o=r(108),s=r(241),a=r(25),u=r(33),c=r(128),f=r(95),l=r(238),h=r(243),p=h.getCurveByName("secp256k1");function d(e,t){if(a(u.tuple("ECPair",u.Buffer256bit),arguments),!e.compressed)throw new TypeError("BIP32 only allows compressed keyPairs");this.keyPair=e,this.chainCode=t,this.depth=0,this.index=0,this.parentFingerprint=0}d.HIGHEST_BIT=2147483648,d.LENGTH=78,d.MASTER_SECRET=n.from("Bitcoin seed","utf8"),d.fromSeedBuffer=function(e,t){if(a(u.tuple(u.Buffer,u.maybe(u.Network)),arguments),e.length<16)throw new TypeError("Seed should be at least 128 bits");if(e.length>64)throw new TypeError("Seed should be at most 512 bits");var r=s("sha512",d.MASTER_SECRET).update(e).digest(),n=r.slice(0,32),i=r.slice(32),o=f.fromBuffer(n),c=new l(o,null,{network:t});return new d(c,i)},d.fromSeedHex=function(e,t){return d.fromSeedBuffer(n.from(e,"hex"),t)},d.fromBase58=function(e,t){var r=i.decode(e);if(78!==r.length)throw new Error("Invalid buffer length");var n=r.readUInt32BE(0),o;if(Array.isArray(t)){if(o=t.filter(function(e){return n===e.bip32.private||n===e.bip32.public}).pop(),!o)throw new Error("Unknown network version")}else o=t||c.bitcoin;if(n!==o.bip32.private&&n!==o.bip32.public)throw new Error("Invalid network version");var s=r[4],a=r.readUInt32BE(5);if(0===s&&0!==a)throw new Error("Invalid parent fingerprint");var u=r.readUInt32BE(9);if(0===s&&0!==u)throw new Error("Invalid index");var y=r.slice(13,45),g;if(n===o.bip32.private){if(0!==r.readUInt8(45))throw new Error("Invalid private key");var m=f.fromBuffer(r.slice(46,78));g=new l(m,null,{network:o})}else{var b=h.Point.decodeFrom(p,r.slice(45,78));p.validate(b),g=new l(null,b,{network:o})}var v=new d(g,y);return v.depth=s,v.index=u,v.parentFingerprint=a,v},d.prototype.getAddress=function(){return this.keyPair.getAddress()},d.prototype.getIdentifier=function(){return o.hash160(this.keyPair.getPublicKeyBuffer())},d.prototype.getFingerprint=function(){return this.getIdentifier().slice(0,4)},d.prototype.getNetwork=function(){return this.keyPair.getNetwork()},d.prototype.getPublicKeyBuffer=function(){return this.keyPair.getPublicKeyBuffer()},d.prototype.neutered=function(){var e=new l(null,this.keyPair.Q,{network:this.keyPair.network}),t=new d(e,this.chainCode);return t.depth=this.depth,t.index=this.index,t.parentFingerprint=this.parentFingerprint,t},d.prototype.sign=function(e){return this.keyPair.sign(e)},d.prototype.verify=function(e,t){return this.keyPair.verify(e,t)},d.prototype.toBase58=function(e){if(void 0!==e)throw new TypeError("Unsupported argument in 2.0.0");var t=this.keyPair.network,r=this.isNeutered()?t.bip32.public:t.bip32.private,o=n.allocUnsafe(78);return o.writeUInt32BE(r,0),o.writeUInt8(this.depth,4),o.writeUInt32BE(this.parentFingerprint,5),o.writeUInt32BE(this.index,9),this.chainCode.copy(o,13),this.isNeutered()?this.keyPair.getPublicKeyBuffer().copy(o,45):(o.writeUInt8(0,45),this.keyPair.d.toBuffer(32).copy(o,46)),i.encode(o)},d.prototype.derive=function(e){a(u.UInt32,e);var t=e>=d.HIGHEST_BIT,r=n.allocUnsafe(37);if(t){if(this.isNeutered())throw new TypeError("Could not derive hardened child key");r[0]=0,this.keyPair.d.toBuffer(32).copy(r,1),r.writeUInt32BE(e,33)}else this.keyPair.getPublicKeyBuffer().copy(r,0),r.writeUInt32BE(e,33);var i=s("sha512",this.chainCode).update(r).digest(),o=i.slice(0,32),c=i.slice(32),h=f.fromBuffer(o),y;if(h.compareTo(p.n)>=0)return this.derive(e+1);if(this.isNeutered()){var g=p.G.multiply(h).add(this.keyPair.Q);if(p.isInfinity(g))return this.derive(e+1);y=new l(null,g,{network:this.keyPair.network})}else{var m=h.add(this.keyPair.d).mod(p.n);if(0===m.signum())return this.derive(e+1);y=new l(m,null,{network:this.keyPair.network})}var b=new d(y,c);return b.depth=this.depth+1,b.index=e,b.parentFingerprint=this.getFingerprint().readUInt32BE(0),b},d.prototype.deriveHardened=function(e){return a(u.UInt31,e),this.derive(e+d.HIGHEST_BIT)},d.prototype.isNeutered=function(){return!this.keyPair.d},d.prototype.derivePath=function(e){a(u.BIP32Path,e);var t=e.split("/");if("m"===t[0]){if(this.parentFingerprint)throw new Error("Not a master node");t=t.slice(1)}return t.reduce(function(e,t){var r;return"'"===t.slice(-1)?(r=parseInt(t.slice(0,-1),10),e.deriveHardened(r)):(r=parseInt(t,10),e.derive(r))},this)},e.exports=d},function(e,t,r){var n=r(2).Buffer,i=r(239),o=r(108),s=r(29),a=r(231),u=r(128),c=r(39),f=r(25),l=r(33),h=a.types,p=[a.types.P2PKH,a.types.P2PK,a.types.MULTISIG],d=p.concat([a.types.P2WPKH,a.types.P2WSH]),y=r(238),g=r(242),m=r(237);function b(e){return-1!==p.indexOf(e)}function v(e){return-1!==d.indexOf(e)}function _(e,t,r){var n=[],i=[];switch(e){case h.P2PKH:n=t.slice(1),i=t.slice(0,1);break;case h.P2PK:n[0]=r?a.pubKey.output.decode(r):void 0,i=t.slice(0,1);break;case h.MULTISIG:if(r){var o=a.multisig.output.decode(r);n=o.pubKeys}i=t.slice(1).map(function(e){return 0===e.length?void 0:e})}return{pubKeys:n,signatures:i}}function w(e,t){if(0===e.length&&0===t.length)return{};var r,n,i,u,c,f,l,p,d=!1,y=!1,g=!1,m,w,S=s.decompile(e),k=a.classifyInput(S,!0);k===h.P2SH&&(g=!0,c=S[S.length-1],p=a.classifyOutput(c),r=a.scriptHash.output.encode(o.hash160(c)),n=h.P2SH,u=c);var E=a.classifyWitness(t,!0);if(E===h.P2WSH){if(f=t[t.length-1],l=a.classifyOutput(f),y=!0,d=!0,0===e.length){if(r=a.witnessScriptHash.output.encode(o.sha256(f)),n=h.P2WSH,void 0!==c)throw new Error("Redeem script given when unnecessary")}else{if(!c)throw new Error("No redeemScript provided for P2WSH, but scriptSig non-empty");if(m=a.witnessScriptHash.output.encode(o.sha256(f)),!c.equals(m))throw new Error("Redeem script didn't match witnessScript")}if(!b(a.classifyOutput(f)))throw new Error("unsupported witness script");u=f,i=l,w=t.slice(0,-1)}else if(E===h.P2WPKH){d=!0;var A=t[t.length-1],x=o.hash160(A);if(0===e.length){if(r=a.witnessPubKeyHash.output.encode(x),n=h.P2WPKH,void 0!==c)throw new Error("Redeem script given when unnecessary")}else{if(!c)throw new Error("No redeemScript provided for P2WPKH, but scriptSig wasn't empty");if(m=a.witnessPubKeyHash.output.encode(x),!c.equals(m))throw new Error("Redeem script did not have the right witness program")}i=h.P2PKH,w=t}else if(c){if(!v(p))throw new Error("Bad redeemscript!");u=c,i=p,w=S.slice(0,-1)}else n=i=a.classifyInput(e),w=S;var I=_(i,w,u),T={pubKeys:I.pubKeys,signatures:I.signatures,prevOutScript:r,prevOutType:n,signType:i,signScript:u,witness:Boolean(d)};return g&&(T.redeemScript=c,T.redeemScriptType=p),y&&(T.witnessScript=f,T.witnessScriptType=l),T}function S(e,t,r){if(e.redeemScriptType===h.MULTISIG&&e.redeemScript&&e.pubKeys.length!==e.signatures.length){var n=e.signatures.concat();e.signatures=e.pubKeys.map(function(i){var o=y.fromPublicKeyBuffer(i),s;return n.some(function(i,a){if(!i)return!1;var u=g.parseScriptSignature(i),c=t.hashForSignature(r,e.redeemScript,u.hashType);return!!o.verify(c,u.signature)&&(n[a]=void 0,s=i,!0)}),s})}}function k(e,t,r){f(l.Buffer,e);var n=s.decompile(e);t||(t=a.classifyOutput(e));var i=[];switch(t){case h.P2PKH:if(!r)break;var u=n[2],c=o.hash160(r);u.equals(c)&&(i=[r]);break;case h.P2WPKH:if(!r)break;var p=n[1],d=o.hash160(r);p.equals(d)&&(i=[r]);break;case h.P2PK:i=n.slice(0,1);break;case h.MULTISIG:i=n.slice(1,-2);break;default:return{scriptType:t}}return{pubKeys:i,scriptType:t,signatures:i.map(function(){})}}function E(e,t){if(e.prevOutType){if(e.prevOutType!==h.P2SH)throw new Error("PrevOutScript must be P2SH");var r=s.decompile(e.prevOutScript)[1];if(!r.equals(t))throw new Error("Inconsistent hash160(RedeemScript)")}}function A(e,t){if(e.prevOutType){if(e.prevOutType!==h.P2WSH)throw new Error("PrevOutScript must be P2WSH");var r=s.decompile(e.prevOutScript)[1];if(!r.equals(t))throw new Error("Inconsistent sha25(WitnessScript)")}}function x(e,t,r,n,i){var u,c,f,l=!1,p,d,y=!1,g=!1,m,b,v,_;if(r&&i){if(d=o.hash160(r),b=o.sha256(i),E(e,d),!r.equals(a.witnessScriptHash.output.encode(b)))throw new Error("Witness script inconsistent with redeem script");if(u=k(i,void 0,t),!u.pubKeys)throw new Error('WitnessScript not supported "'+s.toASM(r)+'"');c=a.types.P2SH,f=a.scriptHash.output.encode(d),l=y=g=!0,p=a.types.P2WSH,v=m=u.scriptType,_=i}else if(r){if(d=o.hash160(r),E(e,d),u=k(r,void 0,t),!u.pubKeys)throw new Error('RedeemScript not supported "'+s.toASM(r)+'"');c=a.types.P2SH,f=a.scriptHash.output.encode(d),l=!0,v=p=u.scriptType,_=r,y=v===a.types.P2WPKH}else if(i){if(b=o.sha256(i),A(e,b),u=k(i,void 0,t),!u.pubKeys)throw new Error('WitnessScript not supported "'+s.toASM(r)+'"');c=a.types.P2WSH,f=a.witnessScriptHash.output.encode(b),y=g=!0,v=m=u.scriptType,_=i}else if(e.prevOutType){if(e.prevOutType===h.P2SH||e.prevOutType===h.P2WSH)throw new Error("PrevOutScript is "+e.prevOutType+", requires redeemScript");if(c=e.prevOutType,f=e.prevOutScript,u=k(e.prevOutScript,e.prevOutType,t),!u.pubKeys)return;y=e.prevOutType===h.P2WPKH,v=c,_=f}else f=a.pubKeyHash.output.encode(o.hash160(t)),u=k(f,h.P2PKH,t),c=h.P2PKH,y=!1,v=c,_=f;v===h.P2WPKH&&(_=a.pubKeyHash.output.encode(a.witnessPubKeyHash.output.decode(_))),l&&(e.redeemScript=r,e.redeemScriptType=p),g&&(e.witnessScript=i,e.witnessScriptType=m),e.pubKeys=u.pubKeys,e.signatures=u.signatures,e.signScript=_,e.signType=v,e.prevOutScript=f,e.prevOutType=c,e.witness=y}function I(e,t,r,i){if(e===h.P2PKH){if(1===t.length&&n.isBuffer(t[0])&&1===r.length)return a.pubKeyHash.input.encodeStack(t[0],r[0])}else if(e===h.P2PK){if(1===t.length&&n.isBuffer(t[0]))return a.pubKey.input.encodeStack(t[0])}else{if(e!==h.MULTISIG)throw new Error("Not yet supported");if(t.length>0)return t=t.map(function(e){return e||c.OP_0}),i||(t=t.filter(function(e){return e!==c.OP_0})),a.multisig.input.encodeStack(t)}if(!i)throw new Error("Not enough signatures provided");return[]}function T(e,t){var r=e.prevOutType,n=[],i=[];b(r)&&(n=I(r,e.signatures,e.pubKeys,t));var o=!1;if(r===a.types.P2SH){if(!t&&!v(e.redeemScriptType))throw new Error("Impossible to sign this type");b(e.redeemScriptType)&&(n=I(e.redeemScriptType,e.signatures,e.pubKeys,t)),e.redeemScriptType&&(o=!0,r=e.redeemScriptType)}switch(r){case a.types.P2WPKH:i=I(a.types.P2PKH,e.signatures,e.pubKeys,t);break;case a.types.P2WSH:if(!t&&!b(e.witnessScriptType))throw new Error("Impossible to sign this type");b(e.witnessScriptType)&&(i=I(e.witnessScriptType,e.signatures,e.pubKeys,t),i.push(e.witnessScript),r=e.witnessScriptType)}return o&&n.push(e.redeemScript),{type:r,script:s.compile(n),witness:i}}function B(e,t){this.prevTxMap={},this.network=e||u.bitcoin,this.maximumFeeRate=t||2500,this.inputs=[],this.tx=new m}function C(e){return void 0!==e.prevOutScript&&void 0!==e.signScript&&void 0!==e.pubKeys&&void 0!==e.signatures&&e.signatures.length===e.pubKeys.length&&e.pubKeys.length>0&&(!1===e.witness||!0===e.witness&&void 0!==e.value)}function P(e){return e.readUInt8(e.length-1)}B.prototype.setLockTime=function(e){if(f(l.UInt32,e),this.inputs.some(function(e){return!!e.signatures&&e.signatures.some(function(e){return e})}))throw new Error("No, this would invalidate signatures");this.tx.locktime=e},B.prototype.setVersion=function(e){f(l.UInt32,e),this.tx.version=e},B.fromTransaction=function(e,t){var r=new B(t);return r.setVersion(e.version),r.setLockTime(e.locktime),e.outs.forEach(function(e){r.addOutput(e.script,e.value)}),e.ins.forEach(function(e){r.__addInputUnsafe(e.hash,e.index,{sequence:e.sequence,script:e.script,witness:e.witness})}),r.inputs.forEach(function(t,r){S(t,e,r)}),r},B.prototype.addInput=function(e,t,r,i){if(!this.__canModifyInputs())throw new Error("No, this would invalidate signatures");var o;if("string"==typeof e)e=n.from(e,"hex").reverse();else if(e instanceof m){var s=e.outs[t];i=s.script,o=s.value,e=e.getHash()}return this.__addInputUnsafe(e,t,{sequence:r,prevOutScript:i,value:o})},B.prototype.__addInputUnsafe=function(e,t,r){if(m.isCoinbaseHash(e))throw new Error("coinbase inputs not supported");var n=e.toString("hex")+":"+t;if(void 0!==this.prevTxMap[n])throw new Error("Duplicate TxOut: "+n);var i={};if(void 0!==r.script&&(i=w(r.script,r.witness||[])),void 0!==r.value&&(i.value=r.value),!i.prevOutScript&&r.prevOutScript){var o;if(!i.pubKeys&&!i.signatures){var s=k(r.prevOutScript);s.pubKeys&&(i.pubKeys=s.pubKeys,i.signatures=s.signatures),o=s.scriptType}i.prevOutScript=r.prevOutScript,i.prevOutType=o||a.classifyOutput(r.prevOutScript)}var u=this.tx.addInput(e,t,r.sequence,r.scriptSig);return this.inputs[u]=i,this.prevTxMap[n]=u,u},B.prototype.addOutput=function(e,t){if(!this.__canModifyOutputs())throw new Error("No, this would invalidate signatures");return"string"==typeof e&&(e=i.toOutputScript(e,this.network)),this.tx.addOutput(e,t)},B.prototype.build=function(){return this.__build(!1)},B.prototype.buildIncomplete=function(){return this.__build(!0)},B.prototype.__build=function(e){if(!e){if(!this.tx.ins.length)throw new Error("Transaction has no inputs");if(!this.tx.outs.length)throw new Error("Transaction has no outputs")}var t=this.tx.clone();if(this.inputs.forEach(function(r,n){var i=r.witnessScriptType||r.redeemScriptType||r.prevOutType;if(!i&&!e)throw new Error("Transaction is not complete");var o=T(r,e);if(!e&&!b(o.type)&&o.type!==a.types.P2WPKH)throw new Error(o.type+" not supported");t.setInputScript(n,o.script),t.setWitness(n,o.witness)}),!e&&this.__overMaximumFees(t.virtualSize()))throw new Error("Transaction has absurd fees");return t},B.prototype.sign=function(e,t,r,i,o,s){if(t.network&&t.network!==this.network)throw new TypeError("Inconsistent network");if(!this.inputs[e])throw new Error("No input at index: "+e);i=i||m.SIGHASH_ALL;var a=this.inputs[e];if(void 0!==a.redeemScript&&r&&!a.redeemScript.equals(r))throw new Error("Inconsistent redeemScript");var u=t.publicKey||t.getPublicKeyBuffer(),c;if(!C(a)){if(void 0!==o){if(void 0!==a.value&&a.value!==o)throw new Error("Input didn't match witnessValue");f(l.Satoshi,o),a.value=o}if(C(a)||x(a,u,r,o,s),!C(a))throw Error(a.prevOutType+" not supported")}c=a.witness?this.tx.hashForWitnessV0(e,a.signScript,a.value,i):this.tx.hashForSignature(e,a.signScript,i);var p=a.pubKeys.some(function(e,r){if(!u.equals(e))return!1;if(a.signatures[r])throw new Error("Signature already exists");if(33!==u.length&&a.signType===h.P2WPKH)throw new Error("BIP143 rejects uncompressed public keys in P2WPKH or P2WSH");var o=t.sign(c);return n.isBuffer(o)&&(o=g.fromRSBuffer(o)),a.signatures[r]=o.toScriptSignature(i),!0});if(!p)throw new Error("Key pair cannot sign for this input")},B.prototype.__canModifyInputs=function(){return this.inputs.every(function(e){return void 0===e.signatures||e.signatures.every(function(e){if(!e)return!0;var t=P(e);return t&m.SIGHASH_ANYONECANPAY})})},B.prototype.__canModifyOutputs=function(){var e=this.tx.ins.length,t=this.tx.outs.length;return this.inputs.every(function(r){return void 0===r.signatures||r.signatures.every(function(r){if(!r)return!0;var n=P(r),i=31&n;return i===m.SIGHASH_NONE||(i===m.SIGHASH_SINGLE?e<=t:void 0)})})},B.prototype.__overMaximumFees=function(e){var t=this.inputs.reduce(function(e,t){return e+(t.value>>>0)},0),r=this.tx.outs.reduce(function(e,t){return e+t.value},0),n=t-r,i=n/e;return i>this.maximumFeeRate},e.exports=B},function(e,t,r){const n=r(173),i=r(130),o=r(2).Buffer;var s=e.exports=function(e){var t=[{name:"nonce",default:o.alloc(0)},{name:"balance",default:o.alloc(0)},{name:"stateRoot",length:32,default:n.SHA3_RLP},{name:"codeHash",length:32,default:n.SHA3_NULL}];n.defineProperties(this,t,e)};s.prototype.serialize=function(){return i.encode(this.raw)},s.prototype.isContract=function(){return this.codeHash.toString("hex")!==n.SHA3_NULL_S},s.prototype.getCode=function(e,t){this.isContract()?e.getRaw(this.codeHash,t):t(null,o.alloc(0))},s.prototype.setCode=function(e,t,r){var i=this;this.codeHash=n.sha3(t),this.codeHash.toString("hex")!==n.SHA3_NULL_S?e.putRaw(this.codeHash,t,function(e){r(e,i.codeHash)}):r(null,o.alloc(0))},s.prototype.getStorage=function(e,t,r){var n=e.copy();n.root=this.stateRoot,n.get(t,r)},s.prototype.setStorage=function(e,t,r,n){var i=this,o=e.copy();o.root=i.stateRoot,o.put(t,r,function(e){if(e)return n();i.stateRoot=o.root,n()})},s.prototype.isEmpty=function(){return""===this.balance.toString("hex")&&""===this.nonce.toString("hex")&&this.stateRoot.toString("hex")===n.SHA3_RLP_S&&this.codeHash.toString("hex")===n.SHA3_NULL_S}},function(e,t,r){"use strict";e.exports=r(799)(r(802))},function(e,t,r){"use strict";var n=r(800),i=r(801);e.exports=function(e){var t=n(e),r=i(e);return function(e,n){var i="string"==typeof e?e.toLowerCase():e;switch(i){case"keccak224":return new t(1152,448,null,224,n);case"keccak256":return new t(1088,512,null,256,n);case"keccak384":return new t(832,768,null,384,n);case"keccak512":return new t(576,1024,null,512,n);case"sha3-224":return new t(1152,448,6,224,n);case"sha3-256":return new t(1088,512,6,256,n);case"sha3-384":return new t(832,768,6,384,n);case"sha3-512":return new t(576,1024,6,512,n);case"shake128":return new r(1344,256,31,n);case"shake256":return new r(1088,512,31,n);default:throw new Error("Invald algorithm: "+e)}}}},function(e,t,r){"use strict";var n=r(2).Buffer,i=r(92).Transform,o=r(4);e.exports=function(e){function t(t,r,n,o,s){i.call(this,s),this._rate=t,this._capacity=r,this._delimitedSuffix=n,this._hashBitLength=o,this._options=s,this._state=new e,this._state.initialize(t,r),this._finalized=!1}return o(t,i),t.prototype._transform=function(e,t,r){var n=null;try{this.update(e,t)}catch(e){n=e}r(n)},t.prototype._flush=function(e){var t=null;try{this.push(this.digest())}catch(e){t=e}e(t)},t.prototype.update=function(e,t){if(!n.isBuffer(e)&&"string"!=typeof e)throw new TypeError("Data must be a string or a buffer");if(this._finalized)throw new Error("Digest already called");return n.isBuffer(e)||(e=n.from(e,t)),this._state.absorb(e),this},t.prototype.digest=function(e){if(this._finalized)throw new Error("Digest already called");this._finalized=!0,this._delimitedSuffix&&this._state.absorbLastFewBits(this._delimitedSuffix);var t=this._state.squeeze(this._hashBitLength/8);return void 0!==e&&(t=t.toString(e)),this._resetState(),t},t.prototype._resetState=function(){return this._state.initialize(this._rate,this._capacity),this},t.prototype._clone=function(){var e=new t(this._rate,this._capacity,this._delimitedSuffix,this._hashBitLength,this._options);return this._state.copy(e._state),e._finalized=this._finalized,e},t}},function(e,t,r){"use strict";var n=r(2).Buffer,i=r(92).Transform,o=r(4);e.exports=function(e){function t(t,r,n,o){i.call(this,o),this._rate=t,this._capacity=r,this._delimitedSuffix=n,this._options=o,this._state=new e,this._state.initialize(t,r),this._finalized=!1}return o(t,i),t.prototype._transform=function(e,t,r){var n=null;try{this.update(e,t)}catch(e){n=e}r(n)},t.prototype._flush=function(){},t.prototype._read=function(e){this.push(this.squeeze(e))},t.prototype.update=function(e,t){if(!n.isBuffer(e)&&"string"!=typeof e)throw new TypeError("Data must be a string or a buffer");if(this._finalized)throw new Error("Squeeze already called");return n.isBuffer(e)||(e=n.from(e,t)),this._state.absorb(e),this},t.prototype.squeeze=function(e,t){this._finalized||(this._finalized=!0,this._state.absorbLastFewBits(this._delimitedSuffix));var r=this._state.squeeze(e);return void 0!==t&&(r=r.toString(t)),r},t.prototype._resetState=function(){return this._state.initialize(this._rate,this._capacity),this},t.prototype._clone=function(){var e=new t(this._rate,this._capacity,this._delimitedSuffix,this._options);return this._state.copy(e._state),e._finalized=this._finalized,e},t}},function(e,t,r){"use strict";var n=r(2).Buffer,i=r(803);function o(){this.state=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],this.blockSize=null,this.count=0,this.squeezing=!1}o.prototype.initialize=function(e,t){for(var r=0;r<50;++r)this.state[r]=0;this.blockSize=e/8,this.count=0,this.squeezing=!1},o.prototype.absorb=function(e){for(var t=0;t<e.length;++t)this.state[~~(this.count/4)]^=e[t]<<this.count%4*8,this.count+=1,this.count===this.blockSize&&(i.p1600(this.state),this.count=0)},o.prototype.absorbLastFewBits=function(e){this.state[~~(this.count/4)]^=e<<this.count%4*8,0!=(128&e)&&this.count===this.blockSize-1&&i.p1600(this.state),this.state[~~((this.blockSize-1)/4)]^=128<<(this.blockSize-1)%4*8,i.p1600(this.state),this.count=0,this.squeezing=!0},o.prototype.squeeze=function(e){this.squeezing||this.absorbLastFewBits(1);for(var t=n.alloc(e),r=0;r<e;++r)t[r]=this.state[~~(this.count/4)]>>>this.count%4*8&255,this.count+=1,this.count===this.blockSize&&(i.p1600(this.state),this.count=0);return t},o.prototype.copy=function(e){for(var t=0;t<50;++t)e.state[t]=this.state[t];e.blockSize=this.blockSize,e.count=this.count,e.squeezing=this.squeezing},e.exports=o},function(e,t,r){"use strict";var n=[1,0,32898,0,32906,2147483648,2147516416,2147483648,32907,0,2147483649,0,2147516545,2147483648,32777,2147483648,138,0,136,0,2147516425,0,2147483658,0,2147516555,0,139,2147483648,32905,2147483648,32771,2147483648,32770,2147483648,128,2147483648,32778,0,2147483658,2147483648,2147516545,2147483648,32896,2147483648,2147483649,0,2147516424,2147483648];t.p1600=function(e){for(var t=0;t<24;++t){var r=e[0]^e[10]^e[20]^e[30]^e[40],i=e[1]^e[11]^e[21]^e[31]^e[41],o=e[2]^e[12]^e[22]^e[32]^e[42],s=e[3]^e[13]^e[23]^e[33]^e[43],a=e[4]^e[14]^e[24]^e[34]^e[44],u=e[5]^e[15]^e[25]^e[35]^e[45],c=e[6]^e[16]^e[26]^e[36]^e[46],f=e[7]^e[17]^e[27]^e[37]^e[47],l=e[8]^e[18]^e[28]^e[38]^e[48],h=e[9]^e[19]^e[29]^e[39]^e[49],p=l^(o<<1|s>>>31),d=h^(s<<1|o>>>31),y=e[0]^p,g=e[1]^d,m=e[10]^p,b=e[11]^d,v=e[20]^p,_=e[21]^d,w=e[30]^p,S=e[31]^d,k=e[40]^p,E=e[41]^d;p=r^(a<<1|u>>>31),d=i^(u<<1|a>>>31);var A=e[2]^p,x=e[3]^d,I=e[12]^p,T=e[13]^d,B=e[22]^p,C=e[23]^d,P=e[32]^p,O=e[33]^d,R=e[42]^p,N=e[43]^d;p=o^(c<<1|f>>>31),d=s^(f<<1|c>>>31);var L=e[4]^p,j=e[5]^d,M=e[14]^p,K=e[15]^d,D=e[24]^p,U=e[25]^d,F=e[34]^p,q=e[35]^d,H=e[44]^p,z=e[45]^d;p=a^(l<<1|h>>>31),d=u^(h<<1|l>>>31);var V=e[6]^p,G=e[7]^d,W=e[16]^p,$=e[17]^d,Y=e[26]^p,J=e[27]^d,X=e[36]^p,Z=e[37]^d,Q=e[46]^p,ee=e[47]^d;p=c^(r<<1|i>>>31),d=f^(i<<1|r>>>31);var te=e[8]^p,re=e[9]^d,ne=e[18]^p,ie=e[19]^d,oe=e[28]^p,se=e[29]^d,ae=e[38]^p,ue=e[39]^d,ce=e[48]^p,fe=e[49]^d,le=y,he=g,pe=b<<4|m>>>28,de=m<<4|b>>>28,ye=v<<3|_>>>29,ge=_<<3|v>>>29,me=S<<9|w>>>23,be=w<<9|S>>>23,ve=k<<18|E>>>14,_e=E<<18|k>>>14,we=A<<1|x>>>31,Se=x<<1|A>>>31,ke=T<<12|I>>>20,Ee=I<<12|T>>>20,Ae=B<<10|C>>>22,xe=C<<10|B>>>22,Ie=O<<13|P>>>19,Te=P<<13|O>>>19,Be=R<<2|N>>>30,Ce=N<<2|R>>>30,Pe=j<<30|L>>>2,Oe=L<<30|j>>>2,Re=M<<6|K>>>26,Ne=K<<6|M>>>26,Le=U<<11|D>>>21,je=D<<11|U>>>21,Me=F<<15|q>>>17,Ke=q<<15|F>>>17,De=z<<29|H>>>3,Ue=H<<29|z>>>3,Fe=V<<28|G>>>4,qe=G<<28|V>>>4,He=$<<23|W>>>9,ze=W<<23|$>>>9,Ve=Y<<25|J>>>7,Ge=J<<25|Y>>>7,We=X<<21|Z>>>11,$e=Z<<21|X>>>11,Ye=ee<<24|Q>>>8,Je=Q<<24|ee>>>8,Xe=te<<27|re>>>5,Ze=re<<27|te>>>5,Qe=ne<<20|ie>>>12,et=ie<<20|ne>>>12,tt=se<<7|oe>>>25,rt=oe<<7|se>>>25,nt=ae<<8|ue>>>24,it=ue<<8|ae>>>24,ot=ce<<14|fe>>>18,st=fe<<14|ce>>>18;e[0]=le^~ke&Le,e[1]=he^~Ee&je,e[10]=Fe^~Qe&ye,e[11]=qe^~et&ge,e[20]=we^~Re&Ve,e[21]=Se^~Ne&Ge,e[30]=Xe^~pe&Ae,e[31]=Ze^~de&xe,e[40]=Pe^~He&tt,e[41]=Oe^~ze&rt,e[2]=ke^~Le&We,e[3]=Ee^~je&$e,e[12]=Qe^~ye&Ie,e[13]=et^~ge&Te,e[22]=Re^~Ve&nt,e[23]=Ne^~Ge&it,e[32]=pe^~Ae&Me,e[33]=de^~xe&Ke,e[42]=He^~tt&me,e[43]=ze^~rt&be,e[4]=Le^~We&ot,e[5]=je^~$e&st,e[14]=ye^~Ie&De,e[15]=ge^~Te&Ue,e[24]=Ve^~nt&ve,e[25]=Ge^~it&_e,e[34]=Ae^~Me&Ye,e[35]=xe^~Ke&Je,e[44]=tt^~me&Be,e[45]=rt^~be&Ce,e[6]=We^~ot&le,e[7]=$e^~st&he,e[16]=Ie^~De&Fe,e[17]=Te^~Ue&qe,e[26]=nt^~ve&we,e[27]=it^~_e&Se,e[36]=Me^~Ye&Xe,e[37]=Ke^~Je&Ze,e[46]=me^~Be&Pe,e[47]=be^~Ce&Oe,e[8]=ot^~le&ke,e[9]=st^~he&Ee,e[18]=De^~Fe&Qe,e[19]=Ue^~qe&et,e[28]=ve^~we&Re,e[29]=_e^~Se&Ne,e[38]=Ye^~Xe&pe,e[39]=Je^~Ze&de,e[48]=Be^~Pe&He,e[49]=Ce^~Oe&ze,e[0]^=n[2*t],e[1]^=n[2*t+1]}}},function(e,t,r){"use strict";e.exports=r(409)(r(807))},function(e,t,r){"use strict";(function(e){var r=Object.prototype.toString;t.isArray=function(e,t){if(!Array.isArray(e))throw TypeError(t)},t.isBoolean=function(e,t){if("[object Boolean]"!==r.call(e))throw TypeError(t)},t.isBuffer=function(t,r){if(!e.isBuffer(t))throw TypeError(r)},t.isFunction=function(e,t){if("[object Function]"!==r.call(e))throw TypeError(t)},t.isNumber=function(e,t){if("[object Number]"!==r.call(e))throw TypeError(t)},t.isObject=function(e,t){if("[object Object]"!==r.call(e))throw TypeError(t)},t.isBufferLength=function(e,t,r){if(e.length!==t)throw RangeError(r)},t.isBufferLength2=function(e,t,r,n){if(e.length!==t&&e.length!==r)throw RangeError(n)},t.isLengthGTZero=function(e,t){if(0===e.length)throw RangeError(t)},t.isNumberInInterval=function(e,t,r,n){if(e<=t||e>=r)throw RangeError(n)}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";var n=r(2).Buffer,i=r(229),o=n.from([48,129,211,2,1,1,4,32,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,160,129,133,48,129,130,2,1,1,48,44,6,7,42,134,72,206,61,1,1,2,33,0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,254,255,255,252,47,48,6,4,1,0,4,1,7,4,33,2,121,190,102,126,249,220,187,172,85,160,98,149,206,135,11,7,2,155,252,219,45,206,40,217,89,242,129,91,22,248,23,152,2,33,0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,254,186,174,220,230,175,72,160,59,191,210,94,140,208,54,65,65,2,1,1,161,36,3,34,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]),s=n.from([48,130,1,19,2,1,1,4,32,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,160,129,165,48,129,162,2,1,1,48,44,6,7,42,134,72,206,61,1,1,2,33,0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,254,255,255,252,47,48,6,4,1,0,4,1,7,4,65,4,121,190,102,126,249,220,187,172,85,160,98,149,206,135,11,7,2,155,252,219,45,206,40,217,89,242,129,91,22,248,23,152,72,58,218,119,38,163,196,101,93,164,251,252,14,17,8,168,253,23,180,72,166,133,84,25,156,71,208,143,251,16,212,184,2,33,0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,254,186,174,220,230,175,72,160,59,191,210,94,140,208,54,65,65,2,1,1,161,68,3,66,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]);t.privateKeyExport=function(e,t,r){var i=n.from(r?o:s);return e.copy(i,r?8:9),t.copy(i,r?181:214),i},t.privateKeyImport=function(e){var t=e.length,r=0;if(!(t<r+1||48!==e[r])&&(r+=1,!(t<r+1)&&128&e[r])){var n=127&e[r];if(r+=1,!(n<1||n>2||t<r+n)){var i=e[r+n-1]|(n>1?e[r+n-2]<<8:0);if(r+=n,!(t<r+i||t<r+3||2!==e[r]||1!==e[r+1]||1!==e[r+2]||(r+=3,t<r+2||4!==e[r]||e[r+1]>32||t<r+2+e[r+1])))return e.slice(r+2,r+2+e[r+1])}}},t.signatureExport=function(e){for(var t=n.concat([n.from([0]),e.r]),r=33,o=0;r>1&&0===t[o]&&!(128&t[o+1]);--r,++o);for(var s=n.concat([n.from([0]),e.s]),a=33,u=0;a>1&&0===s[u]&&!(128&s[u+1]);--a,++u);return i.encode(t.slice(o),s.slice(u))},t.signatureImport=function(e){var t=n.alloc(32,0),r=n.alloc(32,0);try{var o=i.decode(e);if(33===o.r.length&&0===o.r[0]&&(o.r=o.r.slice(1)),o.r.length>32)throw new Error("R length is too long");if(33===o.s.length&&0===o.s[0]&&(o.s=o.s.slice(1)),o.s.length>32)throw new Error("S length is too long")}catch(e){return}return o.r.copy(t,32-o.r.length),o.s.copy(r,32-o.s.length),{r:t,s:r}},t.signatureImportLax=function(e){var t=n.alloc(32,0),r=n.alloc(32,0),i=e.length,o=0;if(48===e[o++]){var s=e[o++];if(!(128&s&&(o+=s-128,o>i))&&2===e[o++]){var a=e[o++];if(128&a){if(s=a-128,o+s>i)return;for(;s>0&&0===e[o];o+=1,s-=1);for(a=0;s>0;o+=1,s-=1)a=(a<<8)+e[o]}if(!(a>i-o)){var u=o;if(o+=a,2===e[o++]){var c=e[o++];if(128&c){if(s=c-128,o+s>i)return;for(;s>0&&0===e[o];o+=1,s-=1);for(c=0;s>0;o+=1,s-=1)c=(c<<8)+e[o]}if(!(c>i-o)){var f=o;for(o+=c;a>0&&0===e[u];a-=1,u+=1);if(!(a>32)){var l=e.slice(u,u+a);for(l.copy(t,32-l.length);c>0&&0===e[f];c-=1,f+=1);if(!(c>32)){var h=e.slice(f,f+c);return h.copy(r,32-h.length),{r:t,s:r}}}}}}}}}},function(e,t,r){"use strict";var n=r(2).Buffer,i=r(127),o=r(56),s=r(57).ec,a=r(244),u=new s("secp256k1"),c=u.curve;function f(e,t){var r=new o(t);if(r.cmp(c.p)>=0)return null;r=r.toRed(c.red);var n=r.redSqr().redIMul(r).redIAdd(c.b).redSqrt();return 3===e!==n.isOdd()&&(n=n.redNeg()),u.keyPair({pub:{x:r,y:n}})}function l(e,t,r){var n=new o(t),i=new o(r);if(n.cmp(c.p)>=0||i.cmp(c.p)>=0)return null;if(n=n.toRed(c.red),i=i.toRed(c.red),(6===e||7===e)&&i.isOdd()!==(7===e))return null;var s=n.redSqr().redIMul(n);return i.redSqr().redISub(s.redIAdd(c.b)).isZero()?u.keyPair({pub:{x:n,y:i}}):null}function h(e){var t=e[0];switch(t){case 2:case 3:return 33!==e.length?null:f(t,e.slice(1,33));case 4:case 6:case 7:return 65!==e.length?null:l(t,e.slice(1,33),e.slice(33,65));default:return null}}t.privateKeyVerify=function(e){var t=new o(e);return t.cmp(c.n)<0&&!t.isZero()},t.privateKeyExport=function(e,t){var r=new o(e);if(r.cmp(c.n)>=0||r.isZero())throw new Error(a.EC_PRIVATE_KEY_EXPORT_DER_FAIL);return n.from(u.keyFromPrivate(e).getPublic(t,!0))},t.privateKeyNegate=function(e){var t=new o(e);return t.isZero()?n.alloc(32):c.n.sub(t).umod(c.n).toArrayLike(n,"be",32)},t.privateKeyModInverse=function(e){var t=new o(e);if(t.cmp(c.n)>=0||t.isZero())throw new Error(a.EC_PRIVATE_KEY_RANGE_INVALID);return t.invm(c.n).toArrayLike(n,"be",32)},t.privateKeyTweakAdd=function(e,t){var r=new o(t);if(r.cmp(c.n)>=0)throw new Error(a.EC_PRIVATE_KEY_TWEAK_ADD_FAIL);if(r.iadd(new o(e)),r.cmp(c.n)>=0&&r.isub(c.n),r.isZero())throw new Error(a.EC_PRIVATE_KEY_TWEAK_ADD_FAIL);return r.toArrayLike(n,"be",32)},t.privateKeyTweakMul=function(e,t){var r=new o(t);if(r.cmp(c.n)>=0||r.isZero())throw new Error(a.EC_PRIVATE_KEY_TWEAK_MUL_FAIL);return r.imul(new o(e)),r.cmp(c.n)&&(r=r.umod(c.n)),r.toArrayLike(n,"be",32)},t.publicKeyCreate=function(e,t){var r=new o(e);if(r.cmp(c.n)>=0||r.isZero())throw new Error(a.EC_PUBLIC_KEY_CREATE_FAIL);return n.from(u.keyFromPrivate(e).getPublic(t,!0))},t.publicKeyConvert=function(e,t){var r=h(e);if(null===r)throw new Error(a.EC_PUBLIC_KEY_PARSE_FAIL);return n.from(r.getPublic(t,!0))},t.publicKeyVerify=function(e){return null!==h(e)},t.publicKeyTweakAdd=function(e,t,r){var i=h(e);if(null===i)throw new Error(a.EC_PUBLIC_KEY_PARSE_FAIL);if(t=new o(t),t.cmp(c.n)>=0)throw new Error(a.EC_PUBLIC_KEY_TWEAK_ADD_FAIL);return n.from(c.g.mul(t).add(i.pub).encode(!0,r))},t.publicKeyTweakMul=function(e,t,r){var i=h(e);if(null===i)throw new Error(a.EC_PUBLIC_KEY_PARSE_FAIL);if(t=new o(t),t.cmp(c.n)>=0||t.isZero())throw new Error(a.EC_PUBLIC_KEY_TWEAK_MUL_FAIL);return n.from(i.pub.mul(t).encode(!0,r))},t.publicKeyCombine=function(e,t){for(var r=new Array(e.length),i=0;i<e.length;++i)if(r[i]=h(e[i]),null===r[i])throw new Error(a.EC_PUBLIC_KEY_PARSE_FAIL);for(var o=r[0].pub,s=1;s<r.length;++s)o=o.add(r[s].pub);if(o.isInfinity())throw new Error(a.EC_PUBLIC_KEY_COMBINE_FAIL);return n.from(o.encode(!0,t))},t.signatureNormalize=function(e){var t=new o(e.slice(0,32)),r=new o(e.slice(32,64));if(t.cmp(c.n)>=0||r.cmp(c.n)>=0)throw new Error(a.ECDSA_SIGNATURE_PARSE_FAIL);var i=n.from(e);return 1===r.cmp(u.nh)&&c.n.sub(r).toArrayLike(n,"be",32).copy(i,32),i},t.signatureExport=function(e){var t=e.slice(0,32),r=e.slice(32,64);if(new o(t).cmp(c.n)>=0||new o(r).cmp(c.n)>=0)throw new Error(a.ECDSA_SIGNATURE_PARSE_FAIL);return{r:t,s:r}},t.signatureImport=function(e){var t=new o(e.r);t.cmp(c.n)>=0&&(t=new o(0));var r=new o(e.s);return r.cmp(c.n)>=0&&(r=new o(0)),n.concat([t.toArrayLike(n,"be",32),r.toArrayLike(n,"be",32)])},t.sign=function(e,t,r,i){if("function"==typeof r){var s=r;r=function(r){var u=s(e,t,null,i,r);if(!n.isBuffer(u)||32!==u.length)throw new Error(a.ECDSA_SIGN_FAIL);return new o(u)}}var f=new o(t);if(f.cmp(c.n)>=0||f.isZero())throw new Error(a.ECDSA_SIGN_FAIL);var l=u.sign(e,t,{canonical:!0,k:r,pers:i});return{signature:n.concat([l.r.toArrayLike(n,"be",32),l.s.toArrayLike(n,"be",32)]),recovery:l.recoveryParam}},t.verify=function(e,t,r){var n={r:t.slice(0,32),s:t.slice(32,64)},i=new o(n.r),s=new o(n.s);if(i.cmp(c.n)>=0||s.cmp(c.n)>=0)throw new Error(a.ECDSA_SIGNATURE_PARSE_FAIL);if(1===s.cmp(u.nh)||i.isZero()||s.isZero())return!1;var f=h(r);if(null===f)throw new Error(a.EC_PUBLIC_KEY_PARSE_FAIL);return u.verify(e,n,{x:f.pub.x,y:f.pub.y})},t.recover=function(e,t,r,i){var s={r:t.slice(0,32),s:t.slice(32,64)},f=new o(s.r),l=new o(s.s);if(f.cmp(c.n)>=0||l.cmp(c.n)>=0)throw new Error(a.ECDSA_SIGNATURE_PARSE_FAIL);try{if(f.isZero()||l.isZero())throw new Error;var h=u.recoverPubKey(e,s,r);return n.from(h.encode(!0,i))}catch(e){throw new Error(a.ECDSA_RECOVER_FAIL)}},t.ecdh=function(e,r){var n=t.ecdhUnsafe(e,r,!0);return i("sha256").update(n).digest()},t.ecdhUnsafe=function(e,t,r){var i=h(e);if(null===i)throw new Error(a.EC_PUBLIC_KEY_PARSE_FAIL);var s=new o(t);if(s.cmp(c.n)>=0||s.isZero())throw new Error(a.ECDH_FAIL);return n.from(i.pub.mul(s).encode(!0,r))}},function(e,t){},function(e){e.exports={_from:"elliptic@^6.2.3",_id:"elliptic@6.4.1",_inBundle:!1,_integrity:"sha512-BsXLz5sqX8OHcsh7CqBMztyXARmGQ3LWPtGjJi6DiJHq5C/qvi9P3OqgswKSDftbu8+IoI/QDTAm2fFnQ9SZSQ==",_location:"/elliptic",_phantomChildren:{},_requested:{type:"range",registry:!0,raw:"elliptic@^6.2.3",name:"elliptic",escapedName:"elliptic",rawSpec:"^6.2.3",saveSpec:null,fetchSpec:"^6.2.3"},_requiredBy:["/browserify-sign","/create-ecdh","/secp256k1"],_resolved:"https://registry.npmjs.org/elliptic/-/elliptic-6.4.1.tgz",_shasum:"c2d0b7776911b86722c632c3c06c60f2f819939a",_spec:"elliptic@^6.2.3",_where:"/Users/mitra/git/dweb-transports/node_modules/secp256k1",author:{name:"Fedor Indutny",email:"fedor@indutny.com"},bugs:{url:"https://github.com/indutny/elliptic/issues"},bundleDependencies:!1,dependencies:{"bn.js":"^4.4.0",brorand:"^1.0.1","hash.js":"^1.0.0","hmac-drbg":"^1.0.0",inherits:"^2.0.1","minimalistic-assert":"^1.0.0","minimalistic-crypto-utils":"^1.0.0"},deprecated:!1,description:"EC cryptography",devDependencies:{brfs:"^1.4.3",coveralls:"^2.11.3",grunt:"^0.4.5","grunt-browserify":"^5.0.0","grunt-cli":"^1.2.0","grunt-contrib-connect":"^1.0.0","grunt-contrib-copy":"^1.0.0","grunt-contrib-uglify":"^1.0.1","grunt-mocha-istanbul":"^3.0.1","grunt-saucelabs":"^8.6.2",istanbul:"^0.4.2",jscs:"^2.9.0",jshint:"^2.6.0",mocha:"^2.1.0"},files:["lib"],homepage:"https://github.com/indutny/elliptic",keywords:["EC","Elliptic","curve","Cryptography"],license:"MIT",main:"lib/elliptic.js",name:"elliptic",repository:{type:"git",url:"git+ssh://git@github.com/indutny/elliptic.git"},scripts:{jscs:"jscs benchmarks/*.js lib/*.js lib/**/*.js lib/**/**/*.js test/index.js",jshint:"jscs benchmarks/*.js lib/*.js lib/**/*.js lib/**/**/*.js test/index.js",lint:"npm run jscs && npm run jshint",test:"npm run lint && npm run unit",unit:"istanbul test _mocha --reporter=spec test/index.js",version:"grunt dist && git add dist/"},version:"6.4.1"}},function(e,t,r){"use strict";var n=t,i=r(56),o=r(84),s=r(410);function a(e,t){for(var r=[],n=1<<t+1,i=e.clone();i.cmpn(1)>=0;){var o;if(i.isOdd()){var s=i.andln(n-1);o=s>(n>>1)-1?(n>>1)-s:s,i.isubn(o)}else o=0;r.push(o);for(var a=0!==i.cmpn(0)&&0===i.andln(n-1)?t+1:1,u=1;u<a;u++)r.push(0);i.iushrn(a)}return r}function u(e,t){var r=[[],[]];e=e.clone(),t=t.clone();for(var n=0,i=0;e.cmpn(-n)>0||t.cmpn(-i)>0;){var o=e.andln(3)+n&3,s=t.andln(3)+i&3,a,u;if(3===o&&(o=-1),3===s&&(s=-1),0==(1&o))a=0;else{var c=e.andln(7)+n&7;a=3!==c&&5!==c||2!==s?o:-o}if(r[0].push(a),0==(1&s))u=0;else{var c=t.andln(7)+i&7;u=3!==c&&5!==c||2!==o?s:-s}r[1].push(u),2*n===a+1&&(n=1-n),2*i===u+1&&(i=1-i),e.iushrn(1),t.iushrn(1)}return r}function c(e,t,r){var n="_"+t;e.prototype[t]=function e(){return void 0!==this[n]?this[n]:this[n]=r.call(this)}}function f(e){return"string"==typeof e?n.toArray(e,"hex"):e}function l(e){return new i(e,"hex","le")}n.assert=o,n.toArray=s.toArray,n.zero2=s.zero2,n.toHex=s.toHex,n.encode=s.encode,n.getNAF=a,n.getJSF=u,n.cachedProperty=c,n.parseBytes=f,n.intFromLE=l},function(e,t,r){var n;function i(e){this.rand=e}if(e.exports=function e(t){return n||(n=new i(null)),n.generate(t)},e.exports.Rand=i,i.prototype.generate=function e(t){return this._rand(t)},i.prototype._rand=function e(t){if(this.rand.getBytes)return this.rand.getBytes(t);for(var r=new Uint8Array(t),n=0;n<r.length;n++)r[n]=this.rand.getByte();return r},"object"==typeof self)self.crypto&&self.crypto.getRandomValues?i.prototype._rand=function e(t){var r=new Uint8Array(t);return self.crypto.getRandomValues(r),r}:self.msCrypto&&self.msCrypto.getRandomValues?i.prototype._rand=function e(t){var r=new Uint8Array(t);return self.msCrypto.getRandomValues(r),r}:"object"==typeof window&&(i.prototype._rand=function(){throw new Error("Not implemented yet")});else try{var o=r(812);if("function"!=typeof o.randomBytes)throw new Error("Not supported");i.prototype._rand=function e(t){return o.randomBytes(t)}}catch(e){}},function(e,t){},function(e,t,r){"use strict";var n=r(56),i=r(57),o=i.utils,s=o.getNAF,a=o.getJSF,u=o.assert;function c(e,t){this.type=e,this.p=new n(t.p,16),this.red=t.prime?n.red(t.prime):n.mont(this.p),this.zero=new n(0).toRed(this.red),this.one=new n(1).toRed(this.red),this.two=new n(2).toRed(this.red),this.n=t.n&&new n(t.n,16),this.g=t.g&&this.pointFromJSON(t.g,t.gRed),this._wnafT1=new Array(4),this._wnafT2=new Array(4),this._wnafT3=new Array(4),this._wnafT4=new Array(4);var r=this.n&&this.p.div(this.n);!r||r.cmpn(100)>0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}function f(e,t){this.curve=e,this.type=t,this.precomputed=null}e.exports=c,c.prototype.point=function e(){throw new Error("Not implemented")},c.prototype.validate=function e(){throw new Error("Not implemented")},c.prototype._fixedNafMul=function e(t,r){u(t.precomputed);var n=t._getDoubles(),i=s(r,1),o=(1<<n.step+1)-(n.step%2==0?2:1);o/=3;for(var a=[],c=0;c<i.length;c+=n.step){for(var f=0,r=c+n.step-1;r>=c;r--)f=(f<<1)+i[r];a.push(f)}for(var l=this.jpoint(null,null,null),h=this.jpoint(null,null,null),p=o;p>0;p--){for(var c=0;c<a.length;c++){var f=a[c];f===p?h=h.mixedAdd(n.points[c]):f===-p&&(h=h.mixedAdd(n.points[c].neg()))}l=l.add(h)}return l.toP()},c.prototype._wnafMul=function e(t,r){var n=4,i=t._getNAFPoints(n);n=i.wnd;for(var o=i.points,a=s(r,n),c=this.jpoint(null,null,null),f=a.length-1;f>=0;f--){for(var r=0;f>=0&&0===a[f];f--)r++;if(f>=0&&r++,c=c.dblp(r),f<0)break;var l=a[f];u(0!==l),c="affine"===t.type?l>0?c.mixedAdd(o[l-1>>1]):c.mixedAdd(o[-l-1>>1].neg()):l>0?c.add(o[l-1>>1]):c.add(o[-l-1>>1].neg())}return"affine"===t.type?c.toP():c},c.prototype._wnafMulAdd=function e(t,r,n,i,o){for(var u=this._wnafT1,c=this._wnafT2,f=this._wnafT3,l=0,h=0;h<i;h++){var p=r[h],d=p._getNAFPoints(t);u[h]=d.wnd,c[h]=d.points}for(var h=i-1;h>=1;h-=2){var y=h-1,g=h;if(1===u[y]&&1===u[g]){var m=[r[y],null,null,r[g]];0===r[y].y.cmp(r[g].y)?(m[1]=r[y].add(r[g]),m[2]=r[y].toJ().mixedAdd(r[g].neg())):0===r[y].y.cmp(r[g].y.redNeg())?(m[1]=r[y].toJ().mixedAdd(r[g]),m[2]=r[y].add(r[g].neg())):(m[1]=r[y].toJ().mixedAdd(r[g]),m[2]=r[y].toJ().mixedAdd(r[g].neg()));var b=[-3,-1,-5,-7,0,7,5,1,3],v=a(n[y],n[g]);l=Math.max(v[0].length,l),f[y]=new Array(l),f[g]=new Array(l);for(var _=0;_<l;_++){var w=0|v[0][_],S=0|v[1][_];f[y][_]=b[3*(w+1)+(S+1)],f[g][_]=0,c[y]=m}}else f[y]=s(n[y],u[y]),f[g]=s(n[g],u[g]),l=Math.max(f[y].length,l),l=Math.max(f[g].length,l)}for(var k=this.jpoint(null,null,null),E=this._wnafT4,h=l;h>=0;h--){for(var A=0;h>=0;){for(var x=!0,_=0;_<i;_++)E[_]=0|f[_][h],0!==E[_]&&(x=!1);if(!x)break;A++,h--}if(h>=0&&A++,k=k.dblp(A),h<0)break;for(var _=0;_<i;_++){var I=E[_],p;0!==I&&(I>0?p=c[_][I-1>>1]:I<0&&(p=c[_][-I-1>>1].neg()),k="affine"===p.type?k.mixedAdd(p):k.add(p))}}for(var h=0;h<i;h++)c[h]=null;return o?k:k.toP()},c.BasePoint=f,f.prototype.eq=function e(){throw new Error("Not implemented")},f.prototype.validate=function e(){return this.curve.validate(this)},c.prototype.decodePoint=function e(t,r){t=o.toArray(t,r);var n=this.p.byteLength();if((4===t[0]||6===t[0]||7===t[0])&&t.length-1==2*n){6===t[0]?u(t[t.length-1]%2==0):7===t[0]&&u(t[t.length-1]%2==1);var i=this.point(t.slice(1,1+n),t.slice(1+n,1+2*n));return i}if((2===t[0]||3===t[0])&&t.length-1===n)return this.pointFromX(t.slice(1,1+n),3===t[0]);throw new Error("Unknown point format")},f.prototype.encodeCompressed=function e(t){return this.encode(t,!0)},f.prototype._encode=function e(t){var r=this.curve.p.byteLength(),n=this.getX().toArray("be",r);return t?[this.getY().isEven()?2:3].concat(n):[4].concat(n,this.getY().toArray("be",r))},f.prototype.encode=function e(t,r){return o.encode(this._encode(r),t)},f.prototype.precompute=function e(t){if(this.precomputed)return this;var r={doubles:null,naf:null,beta:null};return r.naf=this._getNAFPoints(8),r.doubles=this._getDoubles(4,t),r.beta=this._getBeta(),this.precomputed=r,this},f.prototype._hasDoubles=function e(t){if(!this.precomputed)return!1;var r=this.precomputed.doubles;return!!r&&r.points.length>=Math.ceil((t.bitLength()+1)/r.step)},f.prototype._getDoubles=function e(t,r){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var n=[this],i=this,o=0;o<r;o+=t){for(var s=0;s<t;s++)i=i.dbl();n.push(i)}return{step:t,points:n}},f.prototype._getNAFPoints=function e(t){if(this.precomputed&&this.precomputed.naf)return this.precomputed.naf;for(var r=[this],n=(1<<t)-1,i=1===n?null:this.dbl(),o=1;o<n;o++)r[o]=r[o-1].add(i);return{wnd:t,points:r}},f.prototype._getBeta=function e(){return null},f.prototype.dblp=function e(t){for(var r=this,n=0;n<t;n++)r=r.dbl();return r}},function(e,t,r){"use strict";var n=r(174),i=r(57),o=r(56),s=r(4),a=n.base,u=i.utils.assert;function c(e){a.call(this,"short",e),this.a=new o(e.a,16).toRed(this.red),this.b=new o(e.b,16).toRed(this.red),this.tinv=this.two.redInvm(),this.zeroA=0===this.a.fromRed().cmpn(0),this.threeA=0===this.a.fromRed().sub(this.p).cmpn(-3),this.endo=this._getEndomorphism(e),this._endoWnafT1=new Array(4),this._endoWnafT2=new Array(4)}function f(e,t,r,n){a.BasePoint.call(this,e,"affine"),null===t&&null===r?(this.x=null,this.y=null,this.inf=!0):(this.x=new o(t,16),this.y=new o(r,16),n&&(this.x.forceRed(this.curve.red),this.y.forceRed(this.curve.red)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.inf=!1)}function l(e,t,r,n){a.BasePoint.call(this,e,"jacobian"),null===t&&null===r&&null===n?(this.x=this.curve.one,this.y=this.curve.one,this.z=new o(0)):(this.x=new o(t,16),this.y=new o(r,16),this.z=new o(n,16)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.zOne=this.z===this.curve.one}s(c,a),e.exports=c,c.prototype._getEndomorphism=function e(t){if(this.zeroA&&this.g&&this.n&&1===this.p.modn(3)){var r,n,i;if(t.beta)r=new o(t.beta,16).toRed(this.red);else{var s=this._getEndoRoots(this.p);r=s[0].cmp(s[1])<0?s[0]:s[1],r=r.toRed(this.red)}if(t.lambda)n=new o(t.lambda,16);else{var a=this._getEndoRoots(this.n);0===this.g.mul(a[0]).x.cmp(this.g.x.redMul(r))?n=a[0]:(n=a[1],u(0===this.g.mul(n).x.cmp(this.g.x.redMul(r))))}return i=t.basis?t.basis.map(function(e){return{a:new o(e.a,16),b:new o(e.b,16)}}):this._getEndoBasis(n),{beta:r,lambda:n,basis:i}}},c.prototype._getEndoRoots=function e(t){var r=t===this.p?this.red:o.mont(t),n=new o(2).toRed(r).redInvm(),i=n.redNeg(),s=new o(3).toRed(r).redNeg().redSqrt().redMul(n),a=i.redAdd(s).fromRed(),u=i.redSub(s).fromRed();return[a,u]},c.prototype._getEndoBasis=function e(t){for(var r=this.n.ushrn(Math.floor(this.n.bitLength()/2)),n=t,i=this.n.clone(),s=new o(1),a=new o(0),u=new o(0),c=new o(1),f,l,h,p,d,y,g,m=0,b,v;0!==n.cmpn(0);){var _=i.div(n);b=i.sub(_.mul(n)),v=u.sub(_.mul(s));var w=c.sub(_.mul(a));if(!h&&b.cmp(r)<0)f=g.neg(),l=s,h=b.neg(),p=v;else if(h&&2==++m)break;g=b,i=n,n=b,u=s,s=v,c=a,a=w}d=b.neg(),y=v;var S=h.sqr().add(p.sqr()),k=d.sqr().add(y.sqr());return k.cmp(S)>=0&&(d=f,y=l),h.negative&&(h=h.neg(),p=p.neg()),d.negative&&(d=d.neg(),y=y.neg()),[{a:h,b:p},{a:d,b:y}]},c.prototype._endoSplit=function e(t){var r=this.endo.basis,n=r[0],i=r[1],o=i.b.mul(t).divRound(this.n),s=n.b.neg().mul(t).divRound(this.n),a=o.mul(n.a),u=s.mul(i.a),c=o.mul(n.b),f=s.mul(i.b),l=t.sub(a).sub(u),h=c.add(f).neg();return{k1:l,k2:h}},c.prototype.pointFromX=function e(t,r){t=new o(t,16),t.red||(t=t.toRed(this.red));var n=t.redSqr().redMul(t).redIAdd(t.redMul(this.a)).redIAdd(this.b),i=n.redSqrt();if(0!==i.redSqr().redSub(n).cmp(this.zero))throw new Error("invalid point");var s=i.fromRed().isOdd();return(r&&!s||!r&&s)&&(i=i.redNeg()),this.point(t,i)},c.prototype.validate=function e(t){if(t.inf)return!0;var r=t.x,n=t.y,i=this.a.redMul(r),o=r.redSqr().redMul(r).redIAdd(i).redIAdd(this.b);return 0===n.redSqr().redISub(o).cmpn(0)},c.prototype._endoWnafMulAdd=function e(t,r,n){for(var i=this._endoWnafT1,o=this._endoWnafT2,s=0;s<t.length;s++){var a=this._endoSplit(r[s]),u=t[s],c=u._getBeta();a.k1.negative&&(a.k1.ineg(),u=u.neg(!0)),a.k2.negative&&(a.k2.ineg(),c=c.neg(!0)),i[2*s]=u,i[2*s+1]=c,o[2*s]=a.k1,o[2*s+1]=a.k2}for(var f=this._wnafMulAdd(1,i,o,2*s,n),l=0;l<2*s;l++)i[l]=null,o[l]=null;return f},s(f,a.BasePoint),c.prototype.point=function e(t,r,n){return new f(this,t,r,n)},c.prototype.pointFromJSON=function e(t,r){return f.fromJSON(this,t,r)},f.prototype._getBeta=function e(){if(this.curve.endo){var t=this.precomputed;if(t&&t.beta)return t.beta;var r=this.curve.point(this.x.redMul(this.curve.endo.beta),this.y);if(t){var n=this.curve,i=function(e){return n.point(e.x.redMul(n.endo.beta),e.y)};t.beta=r,r.precomputed={beta:null,naf:t.naf&&{wnd:t.naf.wnd,points:t.naf.points.map(i)},doubles:t.doubles&&{step:t.doubles.step,points:t.doubles.points.map(i)}}}return r}},f.prototype.toJSON=function e(){return this.precomputed?[this.x,this.y,this.precomputed&&{doubles:this.precomputed.doubles&&{step:this.precomputed.doubles.step,points:this.precomputed.doubles.points.slice(1)},naf:this.precomputed.naf&&{wnd:this.precomputed.naf.wnd,points:this.precomputed.naf.points.slice(1)}}]:[this.x,this.y]},f.fromJSON=function e(t,r,n){"string"==typeof r&&(r=JSON.parse(r));var i=t.point(r[0],r[1],n);if(!r[2])return i;function o(e){return t.point(e[0],e[1],n)}var s=r[2];return i.precomputed={beta:null,doubles:s.doubles&&{step:s.doubles.step,points:[i].concat(s.doubles.points.map(o))},naf:s.naf&&{wnd:s.naf.wnd,points:[i].concat(s.naf.points.map(o))}},i},f.prototype.inspect=function e(){return this.isInfinity()?"<EC Point Infinity>":"<EC Point x: "+this.x.fromRed().toString(16,2)+" y: "+this.y.fromRed().toString(16,2)+">"},f.prototype.isInfinity=function e(){return this.inf},f.prototype.add=function e(t){if(this.inf)return t;if(t.inf)return this;if(this.eq(t))return this.dbl();if(this.neg().eq(t))return this.curve.point(null,null);if(0===this.x.cmp(t.x))return this.curve.point(null,null);var r=this.y.redSub(t.y);0!==r.cmpn(0)&&(r=r.redMul(this.x.redSub(t.x).redInvm()));var n=r.redSqr().redISub(this.x).redISub(t.x),i=r.redMul(this.x.redSub(n)).redISub(this.y);return this.curve.point(n,i)},f.prototype.dbl=function e(){if(this.inf)return this;var t=this.y.redAdd(this.y);if(0===t.cmpn(0))return this.curve.point(null,null);var r=this.curve.a,n=this.x.redSqr(),i=t.redInvm(),o=n.redAdd(n).redIAdd(n).redIAdd(r).redMul(i),s=o.redSqr().redISub(this.x.redAdd(this.x)),a=o.redMul(this.x.redSub(s)).redISub(this.y);return this.curve.point(s,a)},f.prototype.getX=function e(){return this.x.fromRed()},f.prototype.getY=function e(){return this.y.fromRed()},f.prototype.mul=function e(t){return t=new o(t,16),this._hasDoubles(t)?this.curve._fixedNafMul(this,t):this.curve.endo?this.curve._endoWnafMulAdd([this],[t]):this.curve._wnafMul(this,t)},f.prototype.mulAdd=function e(t,r,n){var i=[this,r],o=[t,n];return this.curve.endo?this.curve._endoWnafMulAdd(i,o):this.curve._wnafMulAdd(1,i,o,2)},f.prototype.jmulAdd=function e(t,r,n){var i=[this,r],o=[t,n];return this.curve.endo?this.curve._endoWnafMulAdd(i,o,!0):this.curve._wnafMulAdd(1,i,o,2,!0)},f.prototype.eq=function e(t){return this===t||this.inf===t.inf&&(this.inf||0===this.x.cmp(t.x)&&0===this.y.cmp(t.y))},f.prototype.neg=function e(t){if(this.inf)return this;var r=this.curve.point(this.x,this.y.redNeg());if(t&&this.precomputed){var n=this.precomputed,i=function(e){return e.neg()};r.precomputed={naf:n.naf&&{wnd:n.naf.wnd,points:n.naf.points.map(i)},doubles:n.doubles&&{step:n.doubles.step,points:n.doubles.points.map(i)}}}return r},f.prototype.toJ=function e(){if(this.inf)return this.curve.jpoint(null,null,null);var t=this.curve.jpoint(this.x,this.y,this.curve.one);return t},s(l,a.BasePoint),c.prototype.jpoint=function e(t,r,n){return new l(this,t,r,n)},l.prototype.toP=function e(){if(this.isInfinity())return this.curve.point(null,null);var t=this.z.redInvm(),r=t.redSqr(),n=this.x.redMul(r),i=this.y.redMul(r).redMul(t);return this.curve.point(n,i)},l.prototype.neg=function e(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},l.prototype.add=function e(t){if(this.isInfinity())return t;if(t.isInfinity())return this;var r=t.z.redSqr(),n=this.z.redSqr(),i=this.x.redMul(r),o=t.x.redMul(n),s=this.y.redMul(r.redMul(t.z)),a=t.y.redMul(n.redMul(this.z)),u=i.redSub(o),c=s.redSub(a);if(0===u.cmpn(0))return 0!==c.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var f=u.redSqr(),l=f.redMul(u),h=i.redMul(f),p=c.redSqr().redIAdd(l).redISub(h).redISub(h),d=c.redMul(h.redISub(p)).redISub(s.redMul(l)),y=this.z.redMul(t.z).redMul(u);return this.curve.jpoint(p,d,y)},l.prototype.mixedAdd=function e(t){if(this.isInfinity())return t.toJ();if(t.isInfinity())return this;var r=this.z.redSqr(),n=this.x,i=t.x.redMul(r),o=this.y,s=t.y.redMul(r).redMul(this.z),a=n.redSub(i),u=o.redSub(s);if(0===a.cmpn(0))return 0!==u.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var c=a.redSqr(),f=c.redMul(a),l=n.redMul(c),h=u.redSqr().redIAdd(f).redISub(l).redISub(l),p=u.redMul(l.redISub(h)).redISub(o.redMul(f)),d=this.z.redMul(a);return this.curve.jpoint(h,p,d)},l.prototype.dblp=function e(t){if(0===t)return this;if(this.isInfinity())return this;if(!t)return this.dbl();if(this.curve.zeroA||this.curve.threeA){for(var r=this,n=0;n<t;n++)r=r.dbl();return r}for(var i=this.curve.a,o=this.curve.tinv,s=this.x,a=this.y,u=this.z,c=u.redSqr().redSqr(),f=a.redAdd(a),n=0;n<t;n++){var l=s.redSqr(),h=f.redSqr(),p=h.redSqr(),d=l.redAdd(l).redIAdd(l).redIAdd(i.redMul(c)),y=s.redMul(h),g=d.redSqr().redISub(y.redAdd(y)),m=y.redISub(g),b=d.redMul(m);b=b.redIAdd(b).redISub(p);var v=f.redMul(u);n+1<t&&(c=c.redMul(p)),s=g,u=v,f=b}return this.curve.jpoint(s,f.redMul(o),u)},l.prototype.dbl=function e(){return this.isInfinity()?this:this.curve.zeroA?this._zeroDbl():this.curve.threeA?this._threeDbl():this._dbl()},l.prototype._zeroDbl=function e(){var t,r,n;if(this.zOne){var i=this.x.redSqr(),o=this.y.redSqr(),s=o.redSqr(),a=this.x.redAdd(o).redSqr().redISub(i).redISub(s);a=a.redIAdd(a);var u=i.redAdd(i).redIAdd(i),c=u.redSqr().redISub(a).redISub(a),f=s.redIAdd(s);f=f.redIAdd(f),f=f.redIAdd(f),t=c,r=u.redMul(a.redISub(c)).redISub(f),n=this.y.redAdd(this.y)}else{var l=this.x.redSqr(),h=this.y.redSqr(),p=h.redSqr(),d=this.x.redAdd(h).redSqr().redISub(l).redISub(p);d=d.redIAdd(d);var y=l.redAdd(l).redIAdd(l),g=y.redSqr(),m=p.redIAdd(p);m=m.redIAdd(m),m=m.redIAdd(m),t=g.redISub(d).redISub(d),r=y.redMul(d.redISub(t)).redISub(m),n=this.y.redMul(this.z),n=n.redIAdd(n)}return this.curve.jpoint(t,r,n)},l.prototype._threeDbl=function e(){var t,r,n;if(this.zOne){var i=this.x.redSqr(),o=this.y.redSqr(),s=o.redSqr(),a=this.x.redAdd(o).redSqr().redISub(i).redISub(s);a=a.redIAdd(a);var u=i.redAdd(i).redIAdd(i).redIAdd(this.curve.a),c=u.redSqr().redISub(a).redISub(a);t=c;var f=s.redIAdd(s);f=f.redIAdd(f),f=f.redIAdd(f),r=u.redMul(a.redISub(c)).redISub(f),n=this.y.redAdd(this.y)}else{var l=this.z.redSqr(),h=this.y.redSqr(),p=this.x.redMul(h),d=this.x.redSub(l).redMul(this.x.redAdd(l));d=d.redAdd(d).redIAdd(d);var y=p.redIAdd(p);y=y.redIAdd(y);var g=y.redAdd(y);t=d.redSqr().redISub(g),n=this.y.redAdd(this.z).redSqr().redISub(h).redISub(l);var m=h.redSqr();m=m.redIAdd(m),m=m.redIAdd(m),m=m.redIAdd(m),r=d.redMul(y.redISub(t)).redISub(m)}return this.curve.jpoint(t,r,n)},l.prototype._dbl=function e(){var t=this.curve.a,r=this.x,n=this.y,i=this.z,o=i.redSqr().redSqr(),s=r.redSqr(),a=n.redSqr(),u=s.redAdd(s).redIAdd(s).redIAdd(t.redMul(o)),c=r.redAdd(r);c=c.redIAdd(c);var f=c.redMul(a),l=u.redSqr().redISub(f.redAdd(f)),h=f.redISub(l),p=a.redSqr();p=p.redIAdd(p),p=p.redIAdd(p),p=p.redIAdd(p);var d=u.redMul(h).redISub(p),y=n.redAdd(n).redMul(i);return this.curve.jpoint(l,d,y)},l.prototype.trpl=function e(){if(!this.curve.zeroA)return this.dbl().add(this);var t=this.x.redSqr(),r=this.y.redSqr(),n=this.z.redSqr(),i=r.redSqr(),o=t.redAdd(t).redIAdd(t),s=o.redSqr(),a=this.x.redAdd(r).redSqr().redISub(t).redISub(i);a=a.redIAdd(a),a=a.redAdd(a).redIAdd(a),a=a.redISub(s);var u=a.redSqr(),c=i.redIAdd(i);c=c.redIAdd(c),c=c.redIAdd(c),c=c.redIAdd(c);var f=o.redIAdd(a).redSqr().redISub(s).redISub(u).redISub(c),l=r.redMul(f);l=l.redIAdd(l),l=l.redIAdd(l);var h=this.x.redMul(u).redISub(l);h=h.redIAdd(h),h=h.redIAdd(h);var p=this.y.redMul(f.redMul(c.redISub(f)).redISub(a.redMul(u)));p=p.redIAdd(p),p=p.redIAdd(p),p=p.redIAdd(p);var d=this.z.redAdd(a).redSqr().redISub(n).redISub(u);return this.curve.jpoint(h,p,d)},l.prototype.mul=function e(t,r){return t=new o(t,r),this.curve._wnafMul(this,t)},l.prototype.eq=function e(t){if("affine"===t.type)return this.eq(t.toJ());if(this===t)return!0;var r=this.z.redSqr(),n=t.z.redSqr();if(0!==this.x.redMul(n).redISub(t.x.redMul(r)).cmpn(0))return!1;var i=r.redMul(this.z),o=n.redMul(t.z);return 0===this.y.redMul(o).redISub(t.y.redMul(i)).cmpn(0)},l.prototype.eqXToP=function e(t){var r=this.z.redSqr(),n=t.toRed(this.curve.red).redMul(r);if(0===this.x.cmp(n))return!0;for(var i=t.clone(),o=this.curve.redN.redMul(r);;){if(i.iadd(this.curve.n),i.cmp(this.curve.p)>=0)return!1;if(n.redIAdd(o),0===this.x.cmp(n))return!0}},l.prototype.inspect=function e(){return this.isInfinity()?"<EC JPoint Infinity>":"<EC JPoint x: "+this.x.toString(16,2)+" y: "+this.y.toString(16,2)+" z: "+this.z.toString(16,2)+">"},l.prototype.isInfinity=function e(){return 0===this.z.cmpn(0)}},function(e,t,r){"use strict";var n=r(174),i=r(56),o=r(4),s=n.base,a=r(57),u=a.utils;function c(e){s.call(this,"mont",e),this.a=new i(e.a,16).toRed(this.red),this.b=new i(e.b,16).toRed(this.red),this.i4=new i(4).toRed(this.red).redInvm(),this.two=new i(2).toRed(this.red),this.a24=this.i4.redMul(this.a.redAdd(this.two))}function f(e,t,r){s.BasePoint.call(this,e,"projective"),null===t&&null===r?(this.x=this.curve.one,this.z=this.curve.zero):(this.x=new i(t,16),this.z=new i(r,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)))}o(c,s),e.exports=c,c.prototype.validate=function e(t){var r=t.normalize().x,n=r.redSqr(),i=n.redMul(r).redAdd(n.redMul(this.a)).redAdd(r),o=i.redSqrt();return 0===o.redSqr().cmp(i)},o(f,s.BasePoint),c.prototype.decodePoint=function e(t,r){return this.point(u.toArray(t,r),1)},c.prototype.point=function e(t,r){return new f(this,t,r)},c.prototype.pointFromJSON=function e(t){return f.fromJSON(this,t)},f.prototype.precompute=function e(){},f.prototype._encode=function e(){return this.getX().toArray("be",this.curve.p.byteLength())},f.fromJSON=function e(t,r){return new f(t,r[0],r[1]||t.one)},f.prototype.inspect=function e(){return this.isInfinity()?"<EC Point Infinity>":"<EC Point x: "+this.x.fromRed().toString(16,2)+" z: "+this.z.fromRed().toString(16,2)+">"},f.prototype.isInfinity=function e(){return 0===this.z.cmpn(0)},f.prototype.dbl=function e(){var t=this.x.redAdd(this.z),r=t.redSqr(),n=this.x.redSub(this.z),i=n.redSqr(),o=r.redSub(i),s=r.redMul(i),a=o.redMul(i.redAdd(this.curve.a24.redMul(o)));return this.curve.point(s,a)},f.prototype.add=function e(){throw new Error("Not supported on Montgomery curve")},f.prototype.diffAdd=function e(t,r){var n=this.x.redAdd(this.z),i=this.x.redSub(this.z),o=t.x.redAdd(t.z),s=t.x.redSub(t.z),a=s.redMul(n),u=o.redMul(i),c=r.z.redMul(a.redAdd(u).redSqr()),f=r.x.redMul(a.redISub(u).redSqr());return this.curve.point(c,f)},f.prototype.mul=function e(t){for(var r=t.clone(),n=this,i=this.curve.point(null,null),o=this,s=[];0!==r.cmpn(0);r.iushrn(1))s.push(r.andln(1));for(var a=s.length-1;a>=0;a--)0===s[a]?(n=n.diffAdd(i,o),i=i.dbl()):(i=n.diffAdd(i,o),n=n.dbl());return i},f.prototype.mulAdd=function e(){throw new Error("Not supported on Montgomery curve")},f.prototype.jumlAdd=function e(){throw new Error("Not supported on Montgomery curve")},f.prototype.eq=function e(t){return 0===this.getX().cmp(t.getX())},f.prototype.normalize=function e(){return this.x=this.x.redMul(this.z.redInvm()),this.z=this.curve.one,this},f.prototype.getX=function e(){return this.normalize(),this.x.fromRed()}},function(e,t,r){"use strict";var n=r(174),i=r(57),o=r(56),s=r(4),a=n.base,u=i.utils.assert;function c(e){this.twisted=1!=(0|e.a),this.mOneA=this.twisted&&-1==(0|e.a),this.extended=this.mOneA,a.call(this,"edwards",e),this.a=new o(e.a,16).umod(this.red.m),this.a=this.a.toRed(this.red),this.c=new o(e.c,16).toRed(this.red),this.c2=this.c.redSqr(),this.d=new o(e.d,16).toRed(this.red),this.dd=this.d.redAdd(this.d),u(!this.twisted||0===this.c.fromRed().cmpn(1)),this.oneC=1==(0|e.c)}function f(e,t,r,n,i){a.BasePoint.call(this,e,"projective"),null===t&&null===r&&null===n?(this.x=this.curve.zero,this.y=this.curve.one,this.z=this.curve.one,this.t=this.curve.zero,this.zOne=!0):(this.x=new o(t,16),this.y=new o(r,16),this.z=n?new o(n,16):this.curve.one,this.t=i&&new o(i,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.t&&!this.t.red&&(this.t=this.t.toRed(this.curve.red)),this.zOne=this.z===this.curve.one,this.curve.extended&&!this.t&&(this.t=this.x.redMul(this.y),this.zOne||(this.t=this.t.redMul(this.z.redInvm()))))}s(c,a),e.exports=c,c.prototype._mulA=function e(t){return this.mOneA?t.redNeg():this.a.redMul(t)},c.prototype._mulC=function e(t){return this.oneC?t:this.c.redMul(t)},c.prototype.jpoint=function e(t,r,n,i){return this.point(t,r,n,i)},c.prototype.pointFromX=function e(t,r){t=new o(t,16),t.red||(t=t.toRed(this.red));var n=t.redSqr(),i=this.c2.redSub(this.a.redMul(n)),s=this.one.redSub(this.c2.redMul(this.d).redMul(n)),a=i.redMul(s.redInvm()),u=a.redSqrt();if(0!==u.redSqr().redSub(a).cmp(this.zero))throw new Error("invalid point");var c=u.fromRed().isOdd();return(r&&!c||!r&&c)&&(u=u.redNeg()),this.point(t,u)},c.prototype.pointFromY=function e(t,r){t=new o(t,16),t.red||(t=t.toRed(this.red));var n=t.redSqr(),i=n.redSub(this.c2),s=n.redMul(this.d).redMul(this.c2).redSub(this.a),a=i.redMul(s.redInvm());if(0===a.cmp(this.zero)){if(r)throw new Error("invalid point");return this.point(this.zero,t)}var u=a.redSqrt();if(0!==u.redSqr().redSub(a).cmp(this.zero))throw new Error("invalid point");return u.fromRed().isOdd()!==r&&(u=u.redNeg()),this.point(u,t)},c.prototype.validate=function e(t){if(t.isInfinity())return!0;t.normalize();var r=t.x.redSqr(),n=t.y.redSqr(),i=r.redMul(this.a).redAdd(n),o=this.c2.redMul(this.one.redAdd(this.d.redMul(r).redMul(n)));return 0===i.cmp(o)},s(f,a.BasePoint),c.prototype.pointFromJSON=function e(t){return f.fromJSON(this,t)},c.prototype.point=function e(t,r,n,i){return new f(this,t,r,n,i)},f.fromJSON=function e(t,r){return new f(t,r[0],r[1],r[2])},f.prototype.inspect=function e(){return this.isInfinity()?"<EC Point Infinity>":"<EC Point x: "+this.x.fromRed().toString(16,2)+" y: "+this.y.fromRed().toString(16,2)+" z: "+this.z.fromRed().toString(16,2)+">"},f.prototype.isInfinity=function e(){return 0===this.x.cmpn(0)&&(0===this.y.cmp(this.z)||this.zOne&&0===this.y.cmp(this.curve.c))},f.prototype._extDbl=function e(){var t=this.x.redSqr(),r=this.y.redSqr(),n=this.z.redSqr();n=n.redIAdd(n);var i=this.curve._mulA(t),o=this.x.redAdd(this.y).redSqr().redISub(t).redISub(r),s=i.redAdd(r),a=s.redSub(n),u=i.redSub(r),c=o.redMul(a),f=s.redMul(u),l=o.redMul(u),h=a.redMul(s);return this.curve.point(c,f,h,l)},f.prototype._projDbl=function e(){var t=this.x.redAdd(this.y).redSqr(),r=this.x.redSqr(),n=this.y.redSqr(),i,o,s;if(this.curve.twisted){var a=this.curve._mulA(r),u=a.redAdd(n);if(this.zOne)i=t.redSub(r).redSub(n).redMul(u.redSub(this.curve.two)),o=u.redMul(a.redSub(n)),s=u.redSqr().redSub(u).redSub(u);else{var c=this.z.redSqr(),f=u.redSub(c).redISub(c);i=t.redSub(r).redISub(n).redMul(f),o=u.redMul(a.redSub(n)),s=u.redMul(f)}}else{var a=r.redAdd(n),c=this.curve._mulC(this.z).redSqr(),f=a.redSub(c).redSub(c);i=this.curve._mulC(t.redISub(a)).redMul(f),o=this.curve._mulC(a).redMul(r.redISub(n)),s=a.redMul(f)}return this.curve.point(i,o,s)},f.prototype.dbl=function e(){return this.isInfinity()?this:this.curve.extended?this._extDbl():this._projDbl()},f.prototype._extAdd=function e(t){var r=this.y.redSub(this.x).redMul(t.y.redSub(t.x)),n=this.y.redAdd(this.x).redMul(t.y.redAdd(t.x)),i=this.t.redMul(this.curve.dd).redMul(t.t),o=this.z.redMul(t.z.redAdd(t.z)),s=n.redSub(r),a=o.redSub(i),u=o.redAdd(i),c=n.redAdd(r),f=s.redMul(a),l=u.redMul(c),h=s.redMul(c),p=a.redMul(u);return this.curve.point(f,l,p,h)},f.prototype._projAdd=function e(t){var r=this.z.redMul(t.z),n=r.redSqr(),i=this.x.redMul(t.x),o=this.y.redMul(t.y),s=this.curve.d.redMul(i).redMul(o),a=n.redSub(s),u=n.redAdd(s),c=this.x.redAdd(this.y).redMul(t.x.redAdd(t.y)).redISub(i).redISub(o),f=r.redMul(a).redMul(c),l,h;return this.curve.twisted?(l=r.redMul(u).redMul(o.redSub(this.curve._mulA(i))),h=a.redMul(u)):(l=r.redMul(u).redMul(o.redSub(i)),h=this.curve._mulC(a).redMul(u)),this.curve.point(f,l,h)},f.prototype.add=function e(t){return this.isInfinity()?t:t.isInfinity()?this:this.curve.extended?this._extAdd(t):this._projAdd(t)},f.prototype.mul=function e(t){return this._hasDoubles(t)?this.curve._fixedNafMul(this,t):this.curve._wnafMul(this,t)},f.prototype.mulAdd=function e(t,r,n){return this.curve._wnafMulAdd(1,[this,r],[t,n],2,!1)},f.prototype.jmulAdd=function e(t,r,n){return this.curve._wnafMulAdd(1,[this,r],[t,n],2,!0)},f.prototype.normalize=function e(){if(this.zOne)return this;var t=this.z.redInvm();return this.x=this.x.redMul(t),this.y=this.y.redMul(t),this.t&&(this.t=this.t.redMul(t)),this.z=this.curve.one,this.zOne=!0,this},f.prototype.neg=function e(){return this.curve.point(this.x.redNeg(),this.y,this.z,this.t&&this.t.redNeg())},f.prototype.getX=function e(){return this.normalize(),this.x.fromRed()},f.prototype.getY=function e(){return this.normalize(),this.y.fromRed()},f.prototype.eq=function e(t){return this===t||0===this.getX().cmp(t.getX())&&0===this.getY().cmp(t.getY())},f.prototype.eqXToP=function e(t){var r=t.toRed(this.curve.red).redMul(this.z);if(0===this.x.cmp(r))return!0;for(var n=t.clone(),i=this.curve.redN.redMul(this.z);;){if(n.iadd(this.curve.n),n.cmp(this.curve.p)>=0)return!1;if(r.redIAdd(i),0===this.x.cmp(r))return!0}},f.prototype.toP=f.prototype.normalize,f.prototype.mixedAdd=f.prototype.add},function(e,t,r){"use strict";var n=t,i=r(245),o=r(57),s=o.utils.assert,a;function u(e){"short"===e.type?this.curve=new o.curve.short(e):"edwards"===e.type?this.curve=new o.curve.edwards(e):this.curve=new o.curve.mont(e),this.g=this.curve.g,this.n=this.curve.n,this.hash=e.hash,s(this.g.validate(),"Invalid curve"),s(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}function c(e,t){Object.defineProperty(n,e,{configurable:!0,enumerable:!0,get:function(){var r=new u(t);return Object.defineProperty(n,e,{configurable:!0,enumerable:!0,value:r}),r}})}n.PresetCurve=u,c("p192",{type:"short",prime:"p192",p:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff",a:"ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc",b:"64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1",n:"ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831",hash:i.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),c("p224",{type:"short",prime:"p224",p:"ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001",a:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe",b:"b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4",n:"ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d",hash:i.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),c("p256",{type:"short",prime:null,p:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff",a:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc",b:"5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b",n:"ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551",hash:i.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),c("p384",{type:"short",prime:null,p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 ffffffff",a:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 fffffffc",b:"b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f 5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef",n:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 f4372ddf 581a0db2 48b0a77a ecec196a ccc52973",hash:i.sha384,gRed:!1,g:["aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 5502f25d bf55296c 3a545e38 72760ab7","3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 0a60b1ce 1d7e819d 7a431d7c 90ea0e5f"]}),c("p521",{type:"short",prime:null,p:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff",a:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffc",b:"00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b 99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd 3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00",n:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409",hash:i.sha512,gRed:!1,g:["000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66","00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 3fad0761 353c7086 a272c240 88be9476 9fd16650"]}),c("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:i.sha256,gRed:!1,g:["9"]}),c("ed25519",{type:"edwards",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"-1",c:"1",d:"52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:i.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});try{a=r(824)}catch(e){a=void 0}c("secp256k1",{type:"short",prime:"k256",p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f",a:"0",b:"7",n:"ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141",h:"1",hash:i.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",a]})},function(e,t,r){"use strict";t.sha1=r(819),t.sha224=r(820),t.sha256=r(412),t.sha384=r(821),t.sha512=r(413)},function(e,t,r){"use strict";var n=r(65),i=r(129),o=r(411),s=n.rotl32,a=n.sum32,u=n.sum32_5,c=o.ft_1,f=i.BlockHash,l=[1518500249,1859775393,2400959708,3395469782];function h(){if(!(this instanceof h))return new h;f.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.W=new Array(80)}n.inherits(h,f),e.exports=h,h.blockSize=512,h.outSize=160,h.hmacStrength=80,h.padLength=64,h.prototype._update=function e(t,r){for(var n=this.W,i=0;i<16;i++)n[i]=t[r+i];for(;i<n.length;i++)n[i]=s(n[i-3]^n[i-8]^n[i-14]^n[i-16],1);var o=this.h[0],f=this.h[1],h=this.h[2],p=this.h[3],d=this.h[4];for(i=0;i<n.length;i++){var y=~~(i/20),g=u(s(o,5),c(y,f,h,p),d,n[i],l[y]);d=p,p=h,h=s(f,30),f=o,o=g}this.h[0]=a(this.h[0],o),this.h[1]=a(this.h[1],f),this.h[2]=a(this.h[2],h),this.h[3]=a(this.h[3],p),this.h[4]=a(this.h[4],d)},h.prototype._digest=function e(t){return"hex"===t?n.toHex32(this.h,"big"):n.split32(this.h,"big")}},function(e,t,r){"use strict";var n=r(65),i=r(412);function o(){if(!(this instanceof o))return new o;i.call(this),this.h=[3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428]}n.inherits(o,i),e.exports=o,o.blockSize=512,o.outSize=224,o.hmacStrength=192,o.padLength=64,o.prototype._digest=function e(t){return"hex"===t?n.toHex32(this.h.slice(0,7),"big"):n.split32(this.h.slice(0,7),"big")}},function(e,t,r){"use strict";var n=r(65),i=r(413);function o(){if(!(this instanceof o))return new o;i.call(this),this.h=[3418070365,3238371032,1654270250,914150663,2438529370,812702999,355462360,4144912697,1731405415,4290775857,2394180231,1750603025,3675008525,1694076839,1203062813,3204075428]}n.inherits(o,i),e.exports=o,o.blockSize=1024,o.outSize=384,o.hmacStrength=192,o.padLength=128,o.prototype._digest=function e(t){return"hex"===t?n.toHex32(this.h.slice(0,12),"big"):n.split32(this.h.slice(0,12),"big")}},function(e,t,r){"use strict";var n=r(65),i=r(129),o=n.rotl32,s=n.sum32,a=n.sum32_3,u=n.sum32_4,c=i.BlockHash;function f(){if(!(this instanceof f))return new f;c.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.endian="little"}function l(e,t,r,n){return e<=15?t^r^n:e<=31?t&r|~t&n:e<=47?(t|~r)^n:e<=63?t&n|r&~n:t^(r|~n)}function h(e){return e<=15?0:e<=31?1518500249:e<=47?1859775393:e<=63?2400959708:2840853838}function p(e){return e<=15?1352829926:e<=31?1548603684:e<=47?1836072691:e<=63?2053994217:0}n.inherits(f,c),t.ripemd160=f,f.blockSize=512,f.outSize=160,f.hmacStrength=192,f.padLength=64,f.prototype._update=function e(t,r){for(var n=this.h[0],i=this.h[1],c=this.h[2],f=this.h[3],b=this.h[4],v=n,_=i,w=c,S=f,k=b,E=0;E<80;E++){var A=s(o(u(n,l(E,i,c,f),t[d[E]+r],h(E)),g[E]),b);n=b,b=f,f=o(c,10),c=i,i=A,A=s(o(u(v,l(79-E,_,w,S),t[y[E]+r],p(E)),m[E]),k),v=k,k=S,S=o(w,10),w=_,_=A}A=a(this.h[1],c,S),this.h[1]=a(this.h[2],f,k),this.h[2]=a(this.h[3],b,v),this.h[3]=a(this.h[4],n,_),this.h[4]=a(this.h[0],i,w),this.h[0]=A},f.prototype._digest=function e(t){return"hex"===t?n.toHex32(this.h,"little"):n.split32(this.h,"little")};var d=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13],y=[5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11],g=[11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6],m=[8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11]},function(e,t,r){"use strict";var n=r(65),i=r(84);function o(e,t,r){if(!(this instanceof o))return new o(e,t,r);this.Hash=e,this.blockSize=e.blockSize/8,this.outSize=e.outSize/8,this.inner=null,this.outer=null,this._init(n.toArray(t,r))}e.exports=o,o.prototype._init=function e(t){t.length>this.blockSize&&(t=(new this.Hash).update(t).digest()),i(t.length<=this.blockSize);for(var r=t.length;r<this.blockSize;r++)t.push(0);for(r=0;r<t.length;r++)t[r]^=54;for(this.inner=(new this.Hash).update(t),r=0;r<t.length;r++)t[r]^=106;this.outer=(new this.Hash).update(t)},o.prototype.update=function e(t,r){return this.inner.update(t,r),this},o.prototype.digest=function e(t){return this.outer.update(this.inner.digest()),this.outer.digest(t)}},function(e,t){e.exports={doubles:{step:4,points:[["e60fce93b59e9ec53011aabc21c23e97b2a31369b87a5ae9c44ee89e2a6dec0a","f7e3507399e595929db99f34f57937101296891e44d23f0be1f32cce69616821"],["8282263212c609d9ea2a6e3e172de238d8c39cabd5ac1ca10646e23fd5f51508","11f8a8098557dfe45e8256e830b60ace62d613ac2f7b17bed31b6eaff6e26caf"],["175e159f728b865a72f99cc6c6fc846de0b93833fd2222ed73fce5b551e5b739","d3506e0d9e3c79eba4ef97a51ff71f5eacb5955add24345c6efa6ffee9fed695"],["363d90d447b00c9c99ceac05b6262ee053441c7e55552ffe526bad8f83ff4640","4e273adfc732221953b445397f3363145b9a89008199ecb62003c7f3bee9de9"],["8b4b5f165df3c2be8c6244b5b745638843e4a781a15bcd1b69f79a55dffdf80c","4aad0a6f68d308b4b3fbd7813ab0da04f9e336546162ee56b3eff0c65fd4fd36"],["723cbaa6e5db996d6bf771c00bd548c7b700dbffa6c0e77bcb6115925232fcda","96e867b5595cc498a921137488824d6e2660a0653779494801dc069d9eb39f5f"],["eebfa4d493bebf98ba5feec812c2d3b50947961237a919839a533eca0e7dd7fa","5d9a8ca3970ef0f269ee7edaf178089d9ae4cdc3a711f712ddfd4fdae1de8999"],["100f44da696e71672791d0a09b7bde459f1215a29b3c03bfefd7835b39a48db0","cdd9e13192a00b772ec8f3300c090666b7ff4a18ff5195ac0fbd5cd62bc65a09"],["e1031be262c7ed1b1dc9227a4a04c017a77f8d4464f3b3852c8acde6e534fd2d","9d7061928940405e6bb6a4176597535af292dd419e1ced79a44f18f29456a00d"],["feea6cae46d55b530ac2839f143bd7ec5cf8b266a41d6af52d5e688d9094696d","e57c6b6c97dce1bab06e4e12bf3ecd5c981c8957cc41442d3155debf18090088"],["da67a91d91049cdcb367be4be6ffca3cfeed657d808583de33fa978bc1ec6cb1","9bacaa35481642bc41f463f7ec9780e5dec7adc508f740a17e9ea8e27a68be1d"],["53904faa0b334cdda6e000935ef22151ec08d0f7bb11069f57545ccc1a37b7c0","5bc087d0bc80106d88c9eccac20d3c1c13999981e14434699dcb096b022771c8"],["8e7bcd0bd35983a7719cca7764ca906779b53a043a9b8bcaeff959f43ad86047","10b7770b2a3da4b3940310420ca9514579e88e2e47fd68b3ea10047e8460372a"],["385eed34c1cdff21e6d0818689b81bde71a7f4f18397e6690a841e1599c43862","283bebc3e8ea23f56701de19e9ebf4576b304eec2086dc8cc0458fe5542e5453"],["6f9d9b803ecf191637c73a4413dfa180fddf84a5947fbc9c606ed86c3fac3a7","7c80c68e603059ba69b8e2a30e45c4d47ea4dd2f5c281002d86890603a842160"],["3322d401243c4e2582a2147c104d6ecbf774d163db0f5e5313b7e0e742d0e6bd","56e70797e9664ef5bfb019bc4ddaf9b72805f63ea2873af624f3a2e96c28b2a0"],["85672c7d2de0b7da2bd1770d89665868741b3f9af7643397721d74d28134ab83","7c481b9b5b43b2eb6374049bfa62c2e5e77f17fcc5298f44c8e3094f790313a6"],["948bf809b1988a46b06c9f1919413b10f9226c60f668832ffd959af60c82a0a","53a562856dcb6646dc6b74c5d1c3418c6d4dff08c97cd2bed4cb7f88d8c8e589"],["6260ce7f461801c34f067ce0f02873a8f1b0e44dfc69752accecd819f38fd8e8","bc2da82b6fa5b571a7f09049776a1ef7ecd292238051c198c1a84e95b2b4ae17"],["e5037de0afc1d8d43d8348414bbf4103043ec8f575bfdc432953cc8d2037fa2d","4571534baa94d3b5f9f98d09fb990bddbd5f5b03ec481f10e0e5dc841d755bda"],["e06372b0f4a207adf5ea905e8f1771b4e7e8dbd1c6a6c5b725866a0ae4fce725","7a908974bce18cfe12a27bb2ad5a488cd7484a7787104870b27034f94eee31dd"],["213c7a715cd5d45358d0bbf9dc0ce02204b10bdde2a3f58540ad6908d0559754","4b6dad0b5ae462507013ad06245ba190bb4850f5f36a7eeddff2c27534b458f2"],["4e7c272a7af4b34e8dbb9352a5419a87e2838c70adc62cddf0cc3a3b08fbd53c","17749c766c9d0b18e16fd09f6def681b530b9614bff7dd33e0b3941817dcaae6"],["fea74e3dbe778b1b10f238ad61686aa5c76e3db2be43057632427e2840fb27b6","6e0568db9b0b13297cf674deccb6af93126b596b973f7b77701d3db7f23cb96f"],["76e64113f677cf0e10a2570d599968d31544e179b760432952c02a4417bdde39","c90ddf8dee4e95cf577066d70681f0d35e2a33d2b56d2032b4b1752d1901ac01"],["c738c56b03b2abe1e8281baa743f8f9a8f7cc643df26cbee3ab150242bcbb891","893fb578951ad2537f718f2eacbfbbbb82314eef7880cfe917e735d9699a84c3"],["d895626548b65b81e264c7637c972877d1d72e5f3a925014372e9f6588f6c14b","febfaa38f2bc7eae728ec60818c340eb03428d632bb067e179363ed75d7d991f"],["b8da94032a957518eb0f6433571e8761ceffc73693e84edd49150a564f676e03","2804dfa44805a1e4d7c99cc9762808b092cc584d95ff3b511488e4e74efdf6e7"],["e80fea14441fb33a7d8adab9475d7fab2019effb5156a792f1a11778e3c0df5d","eed1de7f638e00771e89768ca3ca94472d155e80af322ea9fcb4291b6ac9ec78"],["a301697bdfcd704313ba48e51d567543f2a182031efd6915ddc07bbcc4e16070","7370f91cfb67e4f5081809fa25d40f9b1735dbf7c0a11a130c0d1a041e177ea1"],["90ad85b389d6b936463f9d0512678de208cc330b11307fffab7ac63e3fb04ed4","e507a3620a38261affdcbd9427222b839aefabe1582894d991d4d48cb6ef150"],["8f68b9d2f63b5f339239c1ad981f162ee88c5678723ea3351b7b444c9ec4c0da","662a9f2dba063986de1d90c2b6be215dbbea2cfe95510bfdf23cbf79501fff82"],["e4f3fb0176af85d65ff99ff9198c36091f48e86503681e3e6686fd5053231e11","1e63633ad0ef4f1c1661a6d0ea02b7286cc7e74ec951d1c9822c38576feb73bc"],["8c00fa9b18ebf331eb961537a45a4266c7034f2f0d4e1d0716fb6eae20eae29e","efa47267fea521a1a9dc343a3736c974c2fadafa81e36c54e7d2a4c66702414b"],["e7a26ce69dd4829f3e10cec0a9e98ed3143d084f308b92c0997fddfc60cb3e41","2a758e300fa7984b471b006a1aafbb18d0a6b2c0420e83e20e8a9421cf2cfd51"],["b6459e0ee3662ec8d23540c223bcbdc571cbcb967d79424f3cf29eb3de6b80ef","67c876d06f3e06de1dadf16e5661db3c4b3ae6d48e35b2ff30bf0b61a71ba45"],["d68a80c8280bb840793234aa118f06231d6f1fc67e73c5a5deda0f5b496943e8","db8ba9fff4b586d00c4b1f9177b0e28b5b0e7b8f7845295a294c84266b133120"],["324aed7df65c804252dc0270907a30b09612aeb973449cea4095980fc28d3d5d","648a365774b61f2ff130c0c35aec1f4f19213b0c7e332843967224af96ab7c84"],["4df9c14919cde61f6d51dfdbe5fee5dceec4143ba8d1ca888e8bd373fd054c96","35ec51092d8728050974c23a1d85d4b5d506cdc288490192ebac06cad10d5d"],["9c3919a84a474870faed8a9c1cc66021523489054d7f0308cbfc99c8ac1f98cd","ddb84f0f4a4ddd57584f044bf260e641905326f76c64c8e6be7e5e03d4fc599d"],["6057170b1dd12fdf8de05f281d8e06bb91e1493a8b91d4cc5a21382120a959e5","9a1af0b26a6a4807add9a2daf71df262465152bc3ee24c65e899be932385a2a8"],["a576df8e23a08411421439a4518da31880cef0fba7d4df12b1a6973eecb94266","40a6bf20e76640b2c92b97afe58cd82c432e10a7f514d9f3ee8be11ae1b28ec8"],["7778a78c28dec3e30a05fe9629de8c38bb30d1f5cf9a3a208f763889be58ad71","34626d9ab5a5b22ff7098e12f2ff580087b38411ff24ac563b513fc1fd9f43ac"],["928955ee637a84463729fd30e7afd2ed5f96274e5ad7e5cb09eda9c06d903ac","c25621003d3f42a827b78a13093a95eeac3d26efa8a8d83fc5180e935bcd091f"],["85d0fef3ec6db109399064f3a0e3b2855645b4a907ad354527aae75163d82751","1f03648413a38c0be29d496e582cf5663e8751e96877331582c237a24eb1f962"],["ff2b0dce97eece97c1c9b6041798b85dfdfb6d8882da20308f5404824526087e","493d13fef524ba188af4c4dc54d07936c7b7ed6fb90e2ceb2c951e01f0c29907"],["827fbbe4b1e880ea9ed2b2e6301b212b57f1ee148cd6dd28780e5e2cf856e241","c60f9c923c727b0b71bef2c67d1d12687ff7a63186903166d605b68baec293ec"],["eaa649f21f51bdbae7be4ae34ce6e5217a58fdce7f47f9aa7f3b58fa2120e2b3","be3279ed5bbbb03ac69a80f89879aa5a01a6b965f13f7e59d47a5305ba5ad93d"],["e4a42d43c5cf169d9391df6decf42ee541b6d8f0c9a137401e23632dda34d24f","4d9f92e716d1c73526fc99ccfb8ad34ce886eedfa8d8e4f13a7f7131deba9414"],["1ec80fef360cbdd954160fadab352b6b92b53576a88fea4947173b9d4300bf19","aeefe93756b5340d2f3a4958a7abbf5e0146e77f6295a07b671cdc1cc107cefd"],["146a778c04670c2f91b00af4680dfa8bce3490717d58ba889ddb5928366642be","b318e0ec3354028add669827f9d4b2870aaa971d2f7e5ed1d0b297483d83efd0"],["fa50c0f61d22e5f07e3acebb1aa07b128d0012209a28b9776d76a8793180eef9","6b84c6922397eba9b72cd2872281a68a5e683293a57a213b38cd8d7d3f4f2811"],["da1d61d0ca721a11b1a5bf6b7d88e8421a288ab5d5bba5220e53d32b5f067ec2","8157f55a7c99306c79c0766161c91e2966a73899d279b48a655fba0f1ad836f1"],["a8e282ff0c9706907215ff98e8fd416615311de0446f1e062a73b0610d064e13","7f97355b8db81c09abfb7f3c5b2515888b679a3e50dd6bd6cef7c73111f4cc0c"],["174a53b9c9a285872d39e56e6913cab15d59b1fa512508c022f382de8319497c","ccc9dc37abfc9c1657b4155f2c47f9e6646b3a1d8cb9854383da13ac079afa73"],["959396981943785c3d3e57edf5018cdbe039e730e4918b3d884fdff09475b7ba","2e7e552888c331dd8ba0386a4b9cd6849c653f64c8709385e9b8abf87524f2fd"],["d2a63a50ae401e56d645a1153b109a8fcca0a43d561fba2dbb51340c9d82b151","e82d86fb6443fcb7565aee58b2948220a70f750af484ca52d4142174dcf89405"],["64587e2335471eb890ee7896d7cfdc866bacbdbd3839317b3436f9b45617e073","d99fcdd5bf6902e2ae96dd6447c299a185b90a39133aeab358299e5e9faf6589"],["8481bde0e4e4d885b3a546d3e549de042f0aa6cea250e7fd358d6c86dd45e458","38ee7b8cba5404dd84a25bf39cecb2ca900a79c42b262e556d64b1b59779057e"],["13464a57a78102aa62b6979ae817f4637ffcfed3c4b1ce30bcd6303f6caf666b","69be159004614580ef7e433453ccb0ca48f300a81d0942e13f495a907f6ecc27"],["bc4a9df5b713fe2e9aef430bcc1dc97a0cd9ccede2f28588cada3a0d2d83f366","d3a81ca6e785c06383937adf4b798caa6e8a9fbfa547b16d758d666581f33c1"],["8c28a97bf8298bc0d23d8c749452a32e694b65e30a9472a3954ab30fe5324caa","40a30463a3305193378fedf31f7cc0eb7ae784f0451cb9459e71dc73cbef9482"],["8ea9666139527a8c1dd94ce4f071fd23c8b350c5a4bb33748c4ba111faccae0","620efabbc8ee2782e24e7c0cfb95c5d735b783be9cf0f8e955af34a30e62b945"],["dd3625faef5ba06074669716bbd3788d89bdde815959968092f76cc4eb9a9787","7a188fa3520e30d461da2501045731ca941461982883395937f68d00c644a573"],["f710d79d9eb962297e4f6232b40e8f7feb2bc63814614d692c12de752408221e","ea98e67232d3b3295d3b535532115ccac8612c721851617526ae47a9c77bfc82"]]},naf:{wnd:7,points:[["f9308a019258c31049344f85f89d5229b531c845836f99b08601f113bce036f9","388f7b0f632de8140fe337e62a37f3566500a99934c2231b6cb9fd7584b8e672"],["2f8bde4d1a07209355b4a7250a5c5128e88b84bddc619ab7cba8d569b240efe4","d8ac222636e5e3d6d4dba9dda6c9c426f788271bab0d6840dca87d3aa6ac62d6"],["5cbdf0646e5db4eaa398f365f2ea7a0e3d419b7e0330e39ce92bddedcac4f9bc","6aebca40ba255960a3178d6d861a54dba813d0b813fde7b5a5082628087264da"],["acd484e2f0c7f65309ad178a9f559abde09796974c57e714c35f110dfc27ccbe","cc338921b0a7d9fd64380971763b61e9add888a4375f8e0f05cc262ac64f9c37"],["774ae7f858a9411e5ef4246b70c65aac5649980be5c17891bbec17895da008cb","d984a032eb6b5e190243dd56d7b7b365372db1e2dff9d6a8301d74c9c953c61b"],["f28773c2d975288bc7d1d205c3748651b075fbc6610e58cddeeddf8f19405aa8","ab0902e8d880a89758212eb65cdaf473a1a06da521fa91f29b5cb52db03ed81"],["d7924d4f7d43ea965a465ae3095ff41131e5946f3c85f79e44adbcf8e27e080e","581e2872a86c72a683842ec228cc6defea40af2bd896d3a5c504dc9ff6a26b58"],["defdea4cdb677750a420fee807eacf21eb9898ae79b9768766e4faa04a2d4a34","4211ab0694635168e997b0ead2a93daeced1f4a04a95c0f6cfb199f69e56eb77"],["2b4ea0a797a443d293ef5cff444f4979f06acfebd7e86d277475656138385b6c","85e89bc037945d93b343083b5a1c86131a01f60c50269763b570c854e5c09b7a"],["352bbf4a4cdd12564f93fa332ce333301d9ad40271f8107181340aef25be59d5","321eb4075348f534d59c18259dda3e1f4a1b3b2e71b1039c67bd3d8bcf81998c"],["2fa2104d6b38d11b0230010559879124e42ab8dfeff5ff29dc9cdadd4ecacc3f","2de1068295dd865b64569335bd5dd80181d70ecfc882648423ba76b532b7d67"],["9248279b09b4d68dab21a9b066edda83263c3d84e09572e269ca0cd7f5453714","73016f7bf234aade5d1aa71bdea2b1ff3fc0de2a887912ffe54a32ce97cb3402"],["daed4f2be3a8bf278e70132fb0beb7522f570e144bf615c07e996d443dee8729","a69dce4a7d6c98e8d4a1aca87ef8d7003f83c230f3afa726ab40e52290be1c55"],["c44d12c7065d812e8acf28d7cbb19f9011ecd9e9fdf281b0e6a3b5e87d22e7db","2119a460ce326cdc76c45926c982fdac0e106e861edf61c5a039063f0e0e6482"],["6a245bf6dc698504c89a20cfded60853152b695336c28063b61c65cbd269e6b4","e022cf42c2bd4a708b3f5126f16a24ad8b33ba48d0423b6efd5e6348100d8a82"],["1697ffa6fd9de627c077e3d2fe541084ce13300b0bec1146f95ae57f0d0bd6a5","b9c398f186806f5d27561506e4557433a2cf15009e498ae7adee9d63d01b2396"],["605bdb019981718b986d0f07e834cb0d9deb8360ffb7f61df982345ef27a7479","2972d2de4f8d20681a78d93ec96fe23c26bfae84fb14db43b01e1e9056b8c49"],["62d14dab4150bf497402fdc45a215e10dcb01c354959b10cfe31c7e9d87ff33d","80fc06bd8cc5b01098088a1950eed0db01aa132967ab472235f5642483b25eaf"],["80c60ad0040f27dade5b4b06c408e56b2c50e9f56b9b8b425e555c2f86308b6f","1c38303f1cc5c30f26e66bad7fe72f70a65eed4cbe7024eb1aa01f56430bd57a"],["7a9375ad6167ad54aa74c6348cc54d344cc5dc9487d847049d5eabb0fa03c8fb","d0e3fa9eca8726909559e0d79269046bdc59ea10c70ce2b02d499ec224dc7f7"],["d528ecd9b696b54c907a9ed045447a79bb408ec39b68df504bb51f459bc3ffc9","eecf41253136e5f99966f21881fd656ebc4345405c520dbc063465b521409933"],["49370a4b5f43412ea25f514e8ecdad05266115e4a7ecb1387231808f8b45963","758f3f41afd6ed428b3081b0512fd62a54c3f3afbb5b6764b653052a12949c9a"],["77f230936ee88cbbd73df930d64702ef881d811e0e1498e2f1c13eb1fc345d74","958ef42a7886b6400a08266e9ba1b37896c95330d97077cbbe8eb3c7671c60d6"],["f2dac991cc4ce4b9ea44887e5c7c0bce58c80074ab9d4dbaeb28531b7739f530","e0dedc9b3b2f8dad4da1f32dec2531df9eb5fbeb0598e4fd1a117dba703a3c37"],["463b3d9f662621fb1b4be8fbbe2520125a216cdfc9dae3debcba4850c690d45b","5ed430d78c296c3543114306dd8622d7c622e27c970a1de31cb377b01af7307e"],["f16f804244e46e2a09232d4aff3b59976b98fac14328a2d1a32496b49998f247","cedabd9b82203f7e13d206fcdf4e33d92a6c53c26e5cce26d6579962c4e31df6"],["caf754272dc84563b0352b7a14311af55d245315ace27c65369e15f7151d41d1","cb474660ef35f5f2a41b643fa5e460575f4fa9b7962232a5c32f908318a04476"],["2600ca4b282cb986f85d0f1709979d8b44a09c07cb86d7c124497bc86f082120","4119b88753c15bd6a693b03fcddbb45d5ac6be74ab5f0ef44b0be9475a7e4b40"],["7635ca72d7e8432c338ec53cd12220bc01c48685e24f7dc8c602a7746998e435","91b649609489d613d1d5e590f78e6d74ecfc061d57048bad9e76f302c5b9c61"],["754e3239f325570cdbbf4a87deee8a66b7f2b33479d468fbc1a50743bf56cc18","673fb86e5bda30fb3cd0ed304ea49a023ee33d0197a695d0c5d98093c536683"],["e3e6bd1071a1e96aff57859c82d570f0330800661d1c952f9fe2694691d9b9e8","59c9e0bba394e76f40c0aa58379a3cb6a5a2283993e90c4167002af4920e37f5"],["186b483d056a033826ae73d88f732985c4ccb1f32ba35f4b4cc47fdcf04aa6eb","3b952d32c67cf77e2e17446e204180ab21fb8090895138b4a4a797f86e80888b"],["df9d70a6b9876ce544c98561f4be4f725442e6d2b737d9c91a8321724ce0963f","55eb2dafd84d6ccd5f862b785dc39d4ab157222720ef9da217b8c45cf2ba2417"],["5edd5cc23c51e87a497ca815d5dce0f8ab52554f849ed8995de64c5f34ce7143","efae9c8dbc14130661e8cec030c89ad0c13c66c0d17a2905cdc706ab7399a868"],["290798c2b6476830da12fe02287e9e777aa3fba1c355b17a722d362f84614fba","e38da76dcd440621988d00bcf79af25d5b29c094db2a23146d003afd41943e7a"],["af3c423a95d9f5b3054754efa150ac39cd29552fe360257362dfdecef4053b45","f98a3fd831eb2b749a93b0e6f35cfb40c8cd5aa667a15581bc2feded498fd9c6"],["766dbb24d134e745cccaa28c99bf274906bb66b26dcf98df8d2fed50d884249a","744b1152eacbe5e38dcc887980da38b897584a65fa06cedd2c924f97cbac5996"],["59dbf46f8c94759ba21277c33784f41645f7b44f6c596a58ce92e666191abe3e","c534ad44175fbc300f4ea6ce648309a042ce739a7919798cd85e216c4a307f6e"],["f13ada95103c4537305e691e74e9a4a8dd647e711a95e73cb62dc6018cfd87b8","e13817b44ee14de663bf4bc808341f326949e21a6a75c2570778419bdaf5733d"],["7754b4fa0e8aced06d4167a2c59cca4cda1869c06ebadfb6488550015a88522c","30e93e864e669d82224b967c3020b8fa8d1e4e350b6cbcc537a48b57841163a2"],["948dcadf5990e048aa3874d46abef9d701858f95de8041d2a6828c99e2262519","e491a42537f6e597d5d28a3224b1bc25df9154efbd2ef1d2cbba2cae5347d57e"],["7962414450c76c1689c7b48f8202ec37fb224cf5ac0bfa1570328a8a3d7c77ab","100b610ec4ffb4760d5c1fc133ef6f6b12507a051f04ac5760afa5b29db83437"],["3514087834964b54b15b160644d915485a16977225b8847bb0dd085137ec47ca","ef0afbb2056205448e1652c48e8127fc6039e77c15c2378b7e7d15a0de293311"],["d3cc30ad6b483e4bc79ce2c9dd8bc54993e947eb8df787b442943d3f7b527eaf","8b378a22d827278d89c5e9be8f9508ae3c2ad46290358630afb34db04eede0a4"],["1624d84780732860ce1c78fcbfefe08b2b29823db913f6493975ba0ff4847610","68651cf9b6da903e0914448c6cd9d4ca896878f5282be4c8cc06e2a404078575"],["733ce80da955a8a26902c95633e62a985192474b5af207da6df7b4fd5fc61cd4","f5435a2bd2badf7d485a4d8b8db9fcce3e1ef8e0201e4578c54673bc1dc5ea1d"],["15d9441254945064cf1a1c33bbd3b49f8966c5092171e699ef258dfab81c045c","d56eb30b69463e7234f5137b73b84177434800bacebfc685fc37bbe9efe4070d"],["a1d0fcf2ec9de675b612136e5ce70d271c21417c9d2b8aaaac138599d0717940","edd77f50bcb5a3cab2e90737309667f2641462a54070f3d519212d39c197a629"],["e22fbe15c0af8ccc5780c0735f84dbe9a790badee8245c06c7ca37331cb36980","a855babad5cd60c88b430a69f53a1a7a38289154964799be43d06d77d31da06"],["311091dd9860e8e20ee13473c1155f5f69635e394704eaa74009452246cfa9b3","66db656f87d1f04fffd1f04788c06830871ec5a64feee685bd80f0b1286d8374"],["34c1fd04d301be89b31c0442d3e6ac24883928b45a9340781867d4232ec2dbdf","9414685e97b1b5954bd46f730174136d57f1ceeb487443dc5321857ba73abee"],["f219ea5d6b54701c1c14de5b557eb42a8d13f3abbcd08affcc2a5e6b049b8d63","4cb95957e83d40b0f73af4544cccf6b1f4b08d3c07b27fb8d8c2962a400766d1"],["d7b8740f74a8fbaab1f683db8f45de26543a5490bca627087236912469a0b448","fa77968128d9c92ee1010f337ad4717eff15db5ed3c049b3411e0315eaa4593b"],["32d31c222f8f6f0ef86f7c98d3a3335ead5bcd32abdd94289fe4d3091aa824bf","5f3032f5892156e39ccd3d7915b9e1da2e6dac9e6f26e961118d14b8462e1661"],["7461f371914ab32671045a155d9831ea8793d77cd59592c4340f86cbc18347b5","8ec0ba238b96bec0cbdddcae0aa442542eee1ff50c986ea6b39847b3cc092ff6"],["ee079adb1df1860074356a25aa38206a6d716b2c3e67453d287698bad7b2b2d6","8dc2412aafe3be5c4c5f37e0ecc5f9f6a446989af04c4e25ebaac479ec1c8c1e"],["16ec93e447ec83f0467b18302ee620f7e65de331874c9dc72bfd8616ba9da6b5","5e4631150e62fb40d0e8c2a7ca5804a39d58186a50e497139626778e25b0674d"],["eaa5f980c245f6f038978290afa70b6bd8855897f98b6aa485b96065d537bd99","f65f5d3e292c2e0819a528391c994624d784869d7e6ea67fb18041024edc07dc"],["78c9407544ac132692ee1910a02439958ae04877151342ea96c4b6b35a49f51","f3e0319169eb9b85d5404795539a5e68fa1fbd583c064d2462b675f194a3ddb4"],["494f4be219a1a77016dcd838431aea0001cdc8ae7a6fc688726578d9702857a5","42242a969283a5f339ba7f075e36ba2af925ce30d767ed6e55f4b031880d562c"],["a598a8030da6d86c6bc7f2f5144ea549d28211ea58faa70ebf4c1e665c1fe9b5","204b5d6f84822c307e4b4a7140737aec23fc63b65b35f86a10026dbd2d864e6b"],["c41916365abb2b5d09192f5f2dbeafec208f020f12570a184dbadc3e58595997","4f14351d0087efa49d245b328984989d5caf9450f34bfc0ed16e96b58fa9913"],["841d6063a586fa475a724604da03bc5b92a2e0d2e0a36acfe4c73a5514742881","73867f59c0659e81904f9a1c7543698e62562d6744c169ce7a36de01a8d6154"],["5e95bb399a6971d376026947f89bde2f282b33810928be4ded112ac4d70e20d5","39f23f366809085beebfc71181313775a99c9aed7d8ba38b161384c746012865"],["36e4641a53948fd476c39f8a99fd974e5ec07564b5315d8bf99471bca0ef2f66","d2424b1b1abe4eb8164227b085c9aa9456ea13493fd563e06fd51cf5694c78fc"],["336581ea7bfbbb290c191a2f507a41cf5643842170e914faeab27c2c579f726","ead12168595fe1be99252129b6e56b3391f7ab1410cd1e0ef3dcdcabd2fda224"],["8ab89816dadfd6b6a1f2634fcf00ec8403781025ed6890c4849742706bd43ede","6fdcef09f2f6d0a044e654aef624136f503d459c3e89845858a47a9129cdd24e"],["1e33f1a746c9c5778133344d9299fcaa20b0938e8acff2544bb40284b8c5fb94","60660257dd11b3aa9c8ed618d24edff2306d320f1d03010e33a7d2057f3b3b6"],["85b7c1dcb3cec1b7ee7f30ded79dd20a0ed1f4cc18cbcfcfa410361fd8f08f31","3d98a9cdd026dd43f39048f25a8847f4fcafad1895d7a633c6fed3c35e999511"],["29df9fbd8d9e46509275f4b125d6d45d7fbe9a3b878a7af872a2800661ac5f51","b4c4fe99c775a606e2d8862179139ffda61dc861c019e55cd2876eb2a27d84b"],["a0b1cae06b0a847a3fea6e671aaf8adfdfe58ca2f768105c8082b2e449fce252","ae434102edde0958ec4b19d917a6a28e6b72da1834aff0e650f049503a296cf2"],["4e8ceafb9b3e9a136dc7ff67e840295b499dfb3b2133e4ba113f2e4c0e121e5","cf2174118c8b6d7a4b48f6d534ce5c79422c086a63460502b827ce62a326683c"],["d24a44e047e19b6f5afb81c7ca2f69080a5076689a010919f42725c2b789a33b","6fb8d5591b466f8fc63db50f1c0f1c69013f996887b8244d2cdec417afea8fa3"],["ea01606a7a6c9cdd249fdfcfacb99584001edd28abbab77b5104e98e8e3b35d4","322af4908c7312b0cfbfe369f7a7b3cdb7d4494bc2823700cfd652188a3ea98d"],["af8addbf2b661c8a6c6328655eb96651252007d8c5ea31be4ad196de8ce2131f","6749e67c029b85f52a034eafd096836b2520818680e26ac8f3dfbcdb71749700"],["e3ae1974566ca06cc516d47e0fb165a674a3dabcfca15e722f0e3450f45889","2aeabe7e4531510116217f07bf4d07300de97e4874f81f533420a72eeb0bd6a4"],["591ee355313d99721cf6993ffed1e3e301993ff3ed258802075ea8ced397e246","b0ea558a113c30bea60fc4775460c7901ff0b053d25ca2bdeee98f1a4be5d196"],["11396d55fda54c49f19aa97318d8da61fa8584e47b084945077cf03255b52984","998c74a8cd45ac01289d5833a7beb4744ff536b01b257be4c5767bea93ea57a4"],["3c5d2a1ba39c5a1790000738c9e0c40b8dcdfd5468754b6405540157e017aa7a","b2284279995a34e2f9d4de7396fc18b80f9b8b9fdd270f6661f79ca4c81bd257"],["cc8704b8a60a0defa3a99a7299f2e9c3fbc395afb04ac078425ef8a1793cc030","bdd46039feed17881d1e0862db347f8cf395b74fc4bcdc4e940b74e3ac1f1b13"],["c533e4f7ea8555aacd9777ac5cad29b97dd4defccc53ee7ea204119b2889b197","6f0a256bc5efdf429a2fb6242f1a43a2d9b925bb4a4b3a26bb8e0f45eb596096"],["c14f8f2ccb27d6f109f6d08d03cc96a69ba8c34eec07bbcf566d48e33da6593","c359d6923bb398f7fd4473e16fe1c28475b740dd098075e6c0e8649113dc3a38"],["a6cbc3046bc6a450bac24789fa17115a4c9739ed75f8f21ce441f72e0b90e6ef","21ae7f4680e889bb130619e2c0f95a360ceb573c70603139862afd617fa9b9f"],["347d6d9a02c48927ebfb86c1359b1caf130a3c0267d11ce6344b39f99d43cc38","60ea7f61a353524d1c987f6ecec92f086d565ab687870cb12689ff1e31c74448"],["da6545d2181db8d983f7dcb375ef5866d47c67b1bf31c8cf855ef7437b72656a","49b96715ab6878a79e78f07ce5680c5d6673051b4935bd897fea824b77dc208a"],["c40747cc9d012cb1a13b8148309c6de7ec25d6945d657146b9d5994b8feb1111","5ca560753be2a12fc6de6caf2cb489565db936156b9514e1bb5e83037e0fa2d4"],["4e42c8ec82c99798ccf3a610be870e78338c7f713348bd34c8203ef4037f3502","7571d74ee5e0fb92a7a8b33a07783341a5492144cc54bcc40a94473693606437"],["3775ab7089bc6af823aba2e1af70b236d251cadb0c86743287522a1b3b0dedea","be52d107bcfa09d8bcb9736a828cfa7fac8db17bf7a76a2c42ad961409018cf7"],["cee31cbf7e34ec379d94fb814d3d775ad954595d1314ba8846959e3e82f74e26","8fd64a14c06b589c26b947ae2bcf6bfa0149ef0be14ed4d80f448a01c43b1c6d"],["b4f9eaea09b6917619f6ea6a4eb5464efddb58fd45b1ebefcdc1a01d08b47986","39e5c9925b5a54b07433a4f18c61726f8bb131c012ca542eb24a8ac07200682a"],["d4263dfc3d2df923a0179a48966d30ce84e2515afc3dccc1b77907792ebcc60e","62dfaf07a0f78feb30e30d6295853ce189e127760ad6cf7fae164e122a208d54"],["48457524820fa65a4f8d35eb6930857c0032acc0a4a2de422233eeda897612c4","25a748ab367979d98733c38a1fa1c2e7dc6cc07db2d60a9ae7a76aaa49bd0f77"],["dfeeef1881101f2cb11644f3a2afdfc2045e19919152923f367a1767c11cceda","ecfb7056cf1de042f9420bab396793c0c390bde74b4bbdff16a83ae09a9a7517"],["6d7ef6b17543f8373c573f44e1f389835d89bcbc6062ced36c82df83b8fae859","cd450ec335438986dfefa10c57fea9bcc521a0959b2d80bbf74b190dca712d10"],["e75605d59102a5a2684500d3b991f2e3f3c88b93225547035af25af66e04541f","f5c54754a8f71ee540b9b48728473e314f729ac5308b06938360990e2bfad125"],["eb98660f4c4dfaa06a2be453d5020bc99a0c2e60abe388457dd43fefb1ed620c","6cb9a8876d9cb8520609af3add26cd20a0a7cd8a9411131ce85f44100099223e"],["13e87b027d8514d35939f2e6892b19922154596941888336dc3563e3b8dba942","fef5a3c68059a6dec5d624114bf1e91aac2b9da568d6abeb2570d55646b8adf1"],["ee163026e9fd6fe017c38f06a5be6fc125424b371ce2708e7bf4491691e5764a","1acb250f255dd61c43d94ccc670d0f58f49ae3fa15b96623e5430da0ad6c62b2"],["b268f5ef9ad51e4d78de3a750c2dc89b1e626d43505867999932e5db33af3d80","5f310d4b3c99b9ebb19f77d41c1dee018cf0d34fd4191614003e945a1216e423"],["ff07f3118a9df035e9fad85eb6c7bfe42b02f01ca99ceea3bf7ffdba93c4750d","438136d603e858a3a5c440c38eccbaddc1d2942114e2eddd4740d098ced1f0d8"],["8d8b9855c7c052a34146fd20ffb658bea4b9f69e0d825ebec16e8c3ce2b526a1","cdb559eedc2d79f926baf44fb84ea4d44bcf50fee51d7ceb30e2e7f463036758"],["52db0b5384dfbf05bfa9d472d7ae26dfe4b851ceca91b1eba54263180da32b63","c3b997d050ee5d423ebaf66a6db9f57b3180c902875679de924b69d84a7b375"],["e62f9490d3d51da6395efd24e80919cc7d0f29c3f3fa48c6fff543becbd43352","6d89ad7ba4876b0b22c2ca280c682862f342c8591f1daf5170e07bfd9ccafa7d"],["7f30ea2476b399b4957509c88f77d0191afa2ff5cb7b14fd6d8e7d65aaab1193","ca5ef7d4b231c94c3b15389a5f6311e9daff7bb67b103e9880ef4bff637acaec"],["5098ff1e1d9f14fb46a210fada6c903fef0fb7b4a1dd1d9ac60a0361800b7a00","9731141d81fc8f8084d37c6e7542006b3ee1b40d60dfe5362a5b132fd17ddc0"],["32b78c7de9ee512a72895be6b9cbefa6e2f3c4ccce445c96b9f2c81e2778ad58","ee1849f513df71e32efc3896ee28260c73bb80547ae2275ba497237794c8753c"],["e2cb74fddc8e9fbcd076eef2a7c72b0ce37d50f08269dfc074b581550547a4f7","d3aa2ed71c9dd2247a62df062736eb0baddea9e36122d2be8641abcb005cc4a4"],["8438447566d4d7bedadc299496ab357426009a35f235cb141be0d99cd10ae3a8","c4e1020916980a4da5d01ac5e6ad330734ef0d7906631c4f2390426b2edd791f"],["4162d488b89402039b584c6fc6c308870587d9c46f660b878ab65c82c711d67e","67163e903236289f776f22c25fb8a3afc1732f2b84b4e95dbda47ae5a0852649"],["3fad3fa84caf0f34f0f89bfd2dcf54fc175d767aec3e50684f3ba4a4bf5f683d","cd1bc7cb6cc407bb2f0ca647c718a730cf71872e7d0d2a53fa20efcdfe61826"],["674f2600a3007a00568c1a7ce05d0816c1fb84bf1370798f1c69532faeb1a86b","299d21f9413f33b3edf43b257004580b70db57da0b182259e09eecc69e0d38a5"],["d32f4da54ade74abb81b815ad1fb3b263d82d6c692714bcff87d29bd5ee9f08f","f9429e738b8e53b968e99016c059707782e14f4535359d582fc416910b3eea87"],["30e4e670435385556e593657135845d36fbb6931f72b08cb1ed954f1e3ce3ff6","462f9bce619898638499350113bbc9b10a878d35da70740dc695a559eb88db7b"],["be2062003c51cc3004682904330e4dee7f3dcd10b01e580bf1971b04d4cad297","62188bc49d61e5428573d48a74e1c655b1c61090905682a0d5558ed72dccb9bc"],["93144423ace3451ed29e0fb9ac2af211cb6e84a601df5993c419859fff5df04a","7c10dfb164c3425f5c71a3f9d7992038f1065224f72bb9d1d902a6d13037b47c"],["b015f8044f5fcbdcf21ca26d6c34fb8197829205c7b7d2a7cb66418c157b112c","ab8c1e086d04e813744a655b2df8d5f83b3cdc6faa3088c1d3aea1454e3a1d5f"],["d5e9e1da649d97d89e4868117a465a3a4f8a18de57a140d36b3f2af341a21b52","4cb04437f391ed73111a13cc1d4dd0db1693465c2240480d8955e8592f27447a"],["d3ae41047dd7ca065dbf8ed77b992439983005cd72e16d6f996a5316d36966bb","bd1aeb21ad22ebb22a10f0303417c6d964f8cdd7df0aca614b10dc14d125ac46"],["463e2763d885f958fc66cdd22800f0a487197d0a82e377b49f80af87c897b065","bfefacdb0e5d0fd7df3a311a94de062b26b80c61fbc97508b79992671ef7ca7f"],["7985fdfd127c0567c6f53ec1bb63ec3158e597c40bfe747c83cddfc910641917","603c12daf3d9862ef2b25fe1de289aed24ed291e0ec6708703a5bd567f32ed03"],["74a1ad6b5f76e39db2dd249410eac7f99e74c59cb83d2d0ed5ff1543da7703e9","cc6157ef18c9c63cd6193d83631bbea0093e0968942e8c33d5737fd790e0db08"],["30682a50703375f602d416664ba19b7fc9bab42c72747463a71d0896b22f6da3","553e04f6b018b4fa6c8f39e7f311d3176290d0e0f19ca73f17714d9977a22ff8"],["9e2158f0d7c0d5f26c3791efefa79597654e7a2b2464f52b1ee6c1347769ef57","712fcdd1b9053f09003a3481fa7762e9ffd7c8ef35a38509e2fbf2629008373"],["176e26989a43c9cfeba4029c202538c28172e566e3c4fce7322857f3be327d66","ed8cc9d04b29eb877d270b4878dc43c19aefd31f4eee09ee7b47834c1fa4b1c3"],["75d46efea3771e6e68abb89a13ad747ecf1892393dfc4f1b7004788c50374da8","9852390a99507679fd0b86fd2b39a868d7efc22151346e1a3ca4726586a6bed8"],["809a20c67d64900ffb698c4c825f6d5f2310fb0451c869345b7319f645605721","9e994980d9917e22b76b061927fa04143d096ccc54963e6a5ebfa5f3f8e286c1"],["1b38903a43f7f114ed4500b4eac7083fdefece1cf29c63528d563446f972c180","4036edc931a60ae889353f77fd53de4a2708b26b6f5da72ad3394119daf408f9"]]}}},function(e,t,r){"use strict";var n=r(56),i=r(826),o=r(57),s=o.utils,a=s.assert,u=r(827),c=r(828);function f(e){if(!(this instanceof f))return new f(e);"string"==typeof e&&(a(o.curves.hasOwnProperty(e),"Unknown curve "+e),e=o.curves[e]),e instanceof o.curves.PresetCurve&&(e={curve:e}),this.curve=e.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=e.curve.g,this.g.precompute(e.curve.n.bitLength()+1),this.hash=e.hash||e.curve.hash}e.exports=f,f.prototype.keyPair=function e(t){return new u(this,t)},f.prototype.keyFromPrivate=function e(t,r){return u.fromPrivate(this,t,r)},f.prototype.keyFromPublic=function e(t,r){return u.fromPublic(this,t,r)},f.prototype.genKeyPair=function e(t){t||(t={});for(var r=new i({hash:this.hash,pers:t.pers,persEnc:t.persEnc||"utf8",entropy:t.entropy||o.rand(this.hash.hmacStrength),entropyEnc:t.entropy&&t.entropyEnc||"utf8",nonce:this.n.toArray()}),s=this.n.byteLength(),a=this.n.sub(new n(2));;){var u=new n(r.generate(s));if(!(u.cmp(a)>0))return u.iaddn(1),this.keyFromPrivate(u)}},f.prototype._truncateToN=function e(t,r){var n=8*t.byteLength()-this.n.bitLength();return n>0&&(t=t.ushrn(n)),!r&&t.cmp(this.n)>=0?t.sub(this.n):t},f.prototype.sign=function e(t,r,o,s){"object"==typeof o&&(s=o,o=null),s||(s={}),r=this.keyFromPrivate(r,o),t=this._truncateToN(new n(t,16));for(var a=this.n.byteLength(),u=r.getPrivate().toArray("be",a),f=t.toArray("be",a),l=new i({hash:this.hash,entropy:u,nonce:f,pers:s.pers,persEnc:s.persEnc||"utf8"}),h=this.n.sub(new n(1)),p=0;;p++){var d=s.k?s.k(p):new n(l.generate(this.n.byteLength()));if(d=this._truncateToN(d,!0),!(d.cmpn(1)<=0||d.cmp(h)>=0)){var y=this.g.mul(d);if(!y.isInfinity()){var g=y.getX(),m=g.umod(this.n);if(0!==m.cmpn(0)){var b=d.invm(this.n).mul(m.mul(r.getPrivate()).iadd(t));if(b=b.umod(this.n),0!==b.cmpn(0)){var v=(y.getY().isOdd()?1:0)|(0!==g.cmp(m)?2:0);return s.canonical&&b.cmp(this.nh)>0&&(b=this.n.sub(b),v^=1),new c({r:m,s:b,recoveryParam:v})}}}}}},f.prototype.verify=function e(t,r,i,o){t=this._truncateToN(new n(t,16)),i=this.keyFromPublic(i,o),r=new c(r,"hex");var s=r.r,a=r.s;if(s.cmpn(1)<0||s.cmp(this.n)>=0)return!1;if(a.cmpn(1)<0||a.cmp(this.n)>=0)return!1;var u=a.invm(this.n),f=u.mul(t).umod(this.n),l=u.mul(s).umod(this.n);if(!this.curve._maxwellTrick){var h=this.g.mulAdd(f,i.getPublic(),l);return!h.isInfinity()&&0===h.getX().umod(this.n).cmp(s)}var h=this.g.jmulAdd(f,i.getPublic(),l);return!h.isInfinity()&&h.eqXToP(s)},f.prototype.recoverPubKey=function(e,t,r,i){a((3&r)===r,"The recovery param is more than two bits"),t=new c(t,i);var o=this.n,s=new n(e),u=t.r,f=t.s,l=1&r,h=r>>1;if(u.cmp(this.curve.p.umod(this.curve.n))>=0&&h)throw new Error("Unable to find sencond key candinate");u=h?this.curve.pointFromX(u.add(this.curve.n),l):this.curve.pointFromX(u,l);var p=t.r.invm(o),d=o.sub(s).mul(p).umod(o),y=f.mul(p).umod(o);return this.g.mulAdd(d,u,y)},f.prototype.getKeyRecoveryParam=function(e,t,r,n){if(t=new c(t,n),null!==t.recoveryParam)return t.recoveryParam;for(var i=0;i<4;i++){var o;try{o=this.recoverPubKey(e,t,i)}catch(e){continue}if(o.eq(r))return i}throw new Error("Unable to find valid recovery factor")}},function(e,t,r){"use strict";var n=r(245),i=r(410),o=r(84);function s(e){if(!(this instanceof s))return new s(e);this.hash=e.hash,this.predResist=!!e.predResist,this.outLen=this.hash.outSize,this.minEntropy=e.minEntropy||this.hash.hmacStrength,this._reseed=null,this.reseedInterval=null,this.K=null,this.V=null;var t=i.toArray(e.entropy,e.entropyEnc||"hex"),r=i.toArray(e.nonce,e.nonceEnc||"hex"),n=i.toArray(e.pers,e.persEnc||"hex");o(t.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(t,r,n)}e.exports=s,s.prototype._init=function e(t,r,n){var i=t.concat(r).concat(n);this.K=new Array(this.outLen/8),this.V=new Array(this.outLen/8);for(var o=0;o<this.V.length;o++)this.K[o]=0,this.V[o]=1;this._update(i),this._reseed=1,this.reseedInterval=281474976710656},s.prototype._hmac=function e(){return new n.hmac(this.hash,this.K)},s.prototype._update=function e(t){var r=this._hmac().update(this.V).update([0]);t&&(r=r.update(t)),this.K=r.digest(),this.V=this._hmac().update(this.V).digest(),t&&(this.K=this._hmac().update(this.V).update([1]).update(t).digest(),this.V=this._hmac().update(this.V).digest())},s.prototype.reseed=function e(t,r,n,s){"string"!=typeof r&&(s=n,n=r,r=null),t=i.toArray(t,r),n=i.toArray(n,s),o(t.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(t.concat(n||[])),this._reseed=1},s.prototype.generate=function e(t,r,n,o){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");"string"!=typeof r&&(o=n,n=r,r=null),n&&(n=i.toArray(n,o||"hex"),this._update(n));for(var s=[];s.length<t;)this.V=this._hmac().update(this.V).digest(),s=s.concat(this.V);var a=s.slice(0,t);return this._update(n),this._reseed++,i.encode(a,r)}},function(e,t,r){"use strict";var n=r(56),i=r(57),o=i.utils,s=o.assert;function a(e,t){this.ec=e,this.priv=null,this.pub=null,t.priv&&this._importPrivate(t.priv,t.privEnc),t.pub&&this._importPublic(t.pub,t.pubEnc)}e.exports=a,a.fromPublic=function e(t,r,n){return r instanceof a?r:new a(t,{pub:r,pubEnc:n})},a.fromPrivate=function e(t,r,n){return r instanceof a?r:new a(t,{priv:r,privEnc:n})},a.prototype.validate=function e(){var t=this.getPublic();return t.isInfinity()?{result:!1,reason:"Invalid public key"}:t.validate()?t.mul(this.ec.curve.n).isInfinity()?{result:!0,reason:null}:{result:!1,reason:"Public key * N != O"}:{result:!1,reason:"Public key is not a point"}},a.prototype.getPublic=function e(t,r){return"string"==typeof t&&(r=t,t=null),this.pub||(this.pub=this.ec.g.mul(this.priv)),r?this.pub.encode(r,t):this.pub},a.prototype.getPrivate=function e(t){return"hex"===t?this.priv.toString(16,2):this.priv},a.prototype._importPrivate=function e(t,r){this.priv=new n(t,r||16),this.priv=this.priv.umod(this.ec.curve.n)},a.prototype._importPublic=function e(t,r){if(t.x||t.y)return"mont"===this.ec.curve.type?s(t.x,"Need x coordinate"):"short"!==this.ec.curve.type&&"edwards"!==this.ec.curve.type||s(t.x&&t.y,"Need both x and y coordinate"),void(this.pub=this.ec.curve.point(t.x,t.y));this.pub=this.ec.curve.decodePoint(t,r)},a.prototype.derive=function e(t){return t.mul(this.priv).getX()},a.prototype.sign=function e(t,r,n){return this.ec.sign(t,this,r,n)},a.prototype.verify=function e(t,r){return this.ec.verify(t,r,this)},a.prototype.inspect=function e(){return"<Key priv: "+(this.priv&&this.priv.toString(16,2))+" pub: "+(this.pub&&this.pub.inspect())+" >"}},function(e,t,r){"use strict";var n=r(56),i=r(57),o=i.utils,s=o.assert;function a(e,t){if(e instanceof a)return e;this._importDER(e,t)||(s(e.r&&e.s,"Signature without r or s"),this.r=new n(e.r,16),this.s=new n(e.s,16),void 0===e.recoveryParam?this.recoveryParam=null:this.recoveryParam=e.recoveryParam)}function u(){this.place=0}function c(e,t){var r=e[t.place++];if(!(128&r))return r;for(var n=15&r,i=0,o=0,s=t.place;o<n;o++,s++)i<<=8,i|=e[s];return t.place=s,i}function f(e){for(var t=0,r=e.length-1;!e[t]&&!(128&e[t+1])&&t<r;)t++;return 0===t?e:e.slice(t)}function l(e,t){if(t<128)e.push(t);else{var r=1+(Math.log(t)/Math.LN2>>>3);for(e.push(128|r);--r;)e.push(t>>>(r<<3)&255);e.push(t)}}e.exports=a,a.prototype._importDER=function e(t,r){t=o.toArray(t,r);var i=new u;if(48!==t[i.place++])return!1;var s=c(t,i);if(s+i.place!==t.length)return!1;if(2!==t[i.place++])return!1;var a=c(t,i),f=t.slice(i.place,a+i.place);if(i.place+=a,2!==t[i.place++])return!1;var l=c(t,i);if(t.length!==l+i.place)return!1;var h=t.slice(i.place,l+i.place);return 0===f[0]&&128&f[1]&&(f=f.slice(1)),0===h[0]&&128&h[1]&&(h=h.slice(1)),this.r=new n(f),this.s=new n(h),this.recoveryParam=null,!0},a.prototype.toDER=function e(t){var r=this.r.toArray(),n=this.s.toArray();for(128&r[0]&&(r=[0].concat(r)),128&n[0]&&(n=[0].concat(n)),r=f(r),n=f(n);!(n[0]||128&n[1]);)n=n.slice(1);var i=[2];l(i,r.length),i=i.concat(r),i.push(2),l(i,n.length);var s=i.concat(n),a=[48];return l(a,s.length),a=a.concat(s),o.encode(a,t)}},function(e,t,r){"use strict";var n=r(245),i=r(57),o=i.utils,s=o.assert,a=o.parseBytes,u=r(830),c=r(831);function f(e){if(s("ed25519"===e,"only tested with ed25519 so far"),!(this instanceof f))return new f(e);var e=i.curves[e].curve;this.curve=e,this.g=e.g,this.g.precompute(e.n.bitLength()+1),this.pointClass=e.point().constructor,this.encodingLength=Math.ceil(e.n.bitLength()/8),this.hash=n.sha512}e.exports=f,f.prototype.sign=function e(t,r){t=a(t);var n=this.keyFromSecret(r),i=this.hashInt(n.messagePrefix(),t),o=this.g.mul(i),s=this.encodePoint(o),u=this.hashInt(s,n.pubBytes(),t).mul(n.priv()),c=i.add(u).umod(this.curve.n);return this.makeSignature({R:o,S:c,Rencoded:s})},f.prototype.verify=function e(t,r,n){t=a(t),r=this.makeSignature(r);var i=this.keyFromPublic(n),o=this.hashInt(r.Rencoded(),i.pubBytes(),t),s=this.g.mul(r.S()),u=r.R().add(i.pub().mul(o));return u.eq(s)},f.prototype.hashInt=function e(){for(var t=this.hash(),r=0;r<arguments.length;r++)t.update(arguments[r]);return o.intFromLE(t.digest()).umod(this.curve.n)},f.prototype.keyFromPublic=function e(t){return u.fromPublic(this,t)},f.prototype.keyFromSecret=function e(t){return u.fromSecret(this,t)},f.prototype.makeSignature=function e(t){return t instanceof c?t:new c(this,t)},f.prototype.encodePoint=function e(t){var r=t.getY().toArray("le",this.encodingLength);return r[this.encodingLength-1]|=t.getX().isOdd()?128:0,r},f.prototype.decodePoint=function e(t){t=o.parseBytes(t);var r=t.length-1,n=t.slice(0,r).concat(-129&t[r]),i=0!=(128&t[r]),s=o.intFromLE(n);return this.curve.pointFromY(s,i)},f.prototype.encodeInt=function e(t){return t.toArray("le",this.encodingLength)},f.prototype.decodeInt=function e(t){return o.intFromLE(t)},f.prototype.isPoint=function e(t){return t instanceof this.pointClass}},function(e,t,r){"use strict";var n=r(57),i=n.utils,o=i.assert,s=i.parseBytes,a=i.cachedProperty;function u(e,t){this.eddsa=e,this._secret=s(t.secret),e.isPoint(t.pub)?this._pub=t.pub:this._pubBytes=s(t.pub)}u.fromPublic=function e(t,r){return r instanceof u?r:new u(t,{pub:r})},u.fromSecret=function e(t,r){return r instanceof u?r:new u(t,{secret:r})},u.prototype.secret=function e(){return this._secret},a(u,"pubBytes",function e(){return this.eddsa.encodePoint(this.pub())}),a(u,"pub",function e(){return this._pubBytes?this.eddsa.decodePoint(this._pubBytes):this.eddsa.g.mul(this.priv())}),a(u,"privBytes",function e(){var t=this.eddsa,r=this.hash(),n=t.encodingLength-1,i=r.slice(0,t.encodingLength);return i[0]&=248,i[n]&=127,i[n]|=64,i}),a(u,"priv",function e(){return this.eddsa.decodeInt(this.privBytes())}),a(u,"hash",function e(){return this.eddsa.hash().update(this.secret()).digest()}),a(u,"messagePrefix",function e(){return this.hash().slice(this.eddsa.encodingLength)}),u.prototype.sign=function e(t){return o(this._secret,"KeyPair can only verify"),this.eddsa.sign(t,this)},u.prototype.verify=function e(t,r){return this.eddsa.verify(t,r,this)},u.prototype.getSecret=function e(t){return o(this._secret,"KeyPair is public only"),i.encode(this.secret(),t)},u.prototype.getPublic=function e(t){return i.encode(this.pubBytes(),t)},e.exports=u},function(e,t,r){"use strict";var n=r(56),i=r(57),o=i.utils,s=o.assert,a=o.cachedProperty,u=o.parseBytes;function c(e,t){this.eddsa=e,"object"!=typeof t&&(t=u(t)),Array.isArray(t)&&(t={R:t.slice(0,e.encodingLength),S:t.slice(e.encodingLength)}),s(t.R&&t.S,"Signature without R or S"),e.isPoint(t.R)&&(this._R=t.R),t.S instanceof n&&(this._S=t.S),this._Rencoded=Array.isArray(t.R)?t.R:t.Rencoded,this._Sencoded=Array.isArray(t.S)?t.S:t.Sencoded}a(c,"S",function e(){return this.eddsa.decodeInt(this.Sencoded())}),a(c,"R",function e(){return this.eddsa.decodePoint(this.Rencoded())}),a(c,"Rencoded",function e(){return this.eddsa.encodePoint(this.R())}),a(c,"Sencoded",function e(){return this.eddsa.encodeInt(this.S())}),c.prototype.toBytes=function e(){return this.Rencoded().concat(this.Sencoded())},c.prototype.toHex=function e(){return o.encode(this.toBytes(),"hex").toUpperCase()},e.exports=c},function(e,t,r){"use strict";(function(t){var n=r(414),i=r(833);function o(e){var t=e;if("string"!=typeof t)throw new Error("[ethjs-util] while padding to even, value must be string, is currently "+typeof t+", while padToEven.");return t.length%2&&(t="0"+t),t}function s(e){var t=e.toString(16);return"0x"+t}function a(e){var r=s(e);return new t(o(r.slice(2)),"hex")}function u(e){if("string"!=typeof e)throw new Error("[ethjs-util] while getting binary size, method getBinarySize requires input 'str' to be type String, got '"+typeof e+"'.");return t.byteLength(e,"utf8")}function c(e,t,r){if(!0!==Array.isArray(e))throw new Error("[ethjs-util] method arrayContainsArray requires input 'superset' to be an array got type '"+typeof e+"'");if(!0!==Array.isArray(t))throw new Error("[ethjs-util] method arrayContainsArray requires input 'subset' to be an array got type '"+typeof t+"'");return t[Boolean(r)?"some":"every"](function(t){return e.indexOf(t)>=0})}function f(e){var r=new t(o(i(e).replace(/^0+|0+$/g,"")),"hex");return r.toString("utf8")}function l(e){var t="",r=0,n=e.length;for("0x"===e.substring(0,2)&&(r=2);r<n;r+=2){var i=parseInt(e.substr(r,2),16);t+=String.fromCharCode(i)}return t}function h(e){var r=new t(e,"utf8");return"0x"+o(r.toString("hex")).replace(/^0+|0+$/g,"")}function p(e){for(var t="",r=0;r<e.length;r++){var n=e.charCodeAt(r),i=n.toString(16);t+=i.length<2?"0"+i:i}return"0x"+t}function d(e,t,r){if(!Array.isArray(e))throw new Error("[ethjs-util] method getKeys expecting type Array as 'params' input, got '"+typeof e+"'");if("string"!=typeof t)throw new Error("[ethjs-util] method getKeys expecting type String for input 'key' got '"+typeof t+"'.");for(var n=[],i=0;i<e.length;i++){var o=e[i][t];if(r&&!o)o="";else if("string"!=typeof o)throw new Error("invalid abi");n.push(o)}return n}function y(e,t){return!("string"!=typeof e||!e.match(/^0x[0-9A-Fa-f]*$/))&&(!t||e.length===2+2*t)}e.exports={arrayContainsArray:c,intToBuffer:a,getBinarySize:u,isHexPrefixed:n,stripHexPrefix:i,padToEven:o,intToHex:s,fromAscii:p,fromUtf8:h,toAscii:l,toUtf8:f,getKeys:d,isHexString:y}}).call(this,r(0).Buffer)},function(e,t,r){var n=r(414);e.exports=function e(t){return"string"!=typeof t?t:n(t)?t.slice(2):t}},function(e,t,r){(function(t){e.exports=new t("c5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470","hex")}).call(this,r(0).Buffer)},function(e){e.exports={genesisGasLimit:{v:5e3,d:"Gas limit of the Genesis block."},genesisDifficulty:{v:17179869184,d:"Difficulty of the Genesis block."},genesisNonce:{v:"0x0000000000000042",d:"the geneis nonce"},genesisExtraData:{v:"0x11bbe8db4e347b4e8c937c1c8370e4b5ed33adb3db69cbdb7a38e1e50b1b82fa",d:"extra data "},genesisHash:{v:"0xd4e56740f876aef8c010b86a40d5f56745a118d0906a34e69aec8c0db1cb8fa3",d:"genesis hash"},genesisStateRoot:{v:"0xd7f8974fb5ac78d9ac099b9ad5018bedc2ce0a72dad1827a1709da30580f0544",d:"the genesis state root"},minGasLimit:{v:5e3,d:"Minimum the gas limit may ever be."},gasLimitBoundDivisor:{v:1024,d:"The bound divisor of the gas limit, used in update calculations."},minimumDifficulty:{v:131072,d:"The minimum that the difficulty may ever be."},difficultyBoundDivisor:{v:2048,d:"The bound divisor of the difficulty, used in the update calculations."},durationLimit:{v:13,d:"The decision boundary on the blocktime duration used to determine whether difficulty should go up or not."},maximumExtraDataSize:{v:32,d:"Maximum size extra data may be after Genesis."},epochDuration:{v:3e4,d:"Duration between proof-of-work epochs."},stackLimit:{v:1024,d:"Maximum size of VM stack allowed."},callCreateDepth:{v:1024,d:"Maximum depth of call/create stack."},tierStepGas:{v:[0,2,3,5,8,10,20],d:"Once per operation, for a selection of them."},expGas:{v:10,d:"Once per EXP instuction."},expByteGas:{v:50,d:"Times ceil(log256(exponent)) for the EXP instruction."},sha3Gas:{v:30,d:"Once per SHA3 operation."},sha3WordGas:{v:6,d:"Once per word of the SHA3 operation's data."},sloadGas:{v:50,d:"Once per SLOAD operation."},sstoreSetGas:{v:2e4,d:"Once per SSTORE operation if the zeroness changes from zero."},sstoreResetGas:{v:5e3,d:"Once per SSTORE operation if the zeroness does not change from zero."},sstoreRefundGas:{v:15e3,d:"Once per SSTORE operation if the zeroness changes to zero."},jumpdestGas:{v:1,d:"Refunded gas, once per SSTORE operation if the zeroness changes to zero."},logGas:{v:375,d:"Per LOG* operation."},logDataGas:{v:8,d:"Per byte in a LOG* operation's data."},logTopicGas:{v:375,d:"Multiplied by the * of the LOG*, per LOG transaction. e.g. LOG0 incurs 0 * c_txLogTopicGas, LOG4 incurs 4 * c_txLogTopicGas."},createGas:{v:32e3,d:"Once per CREATE operation & contract-creation transaction."},callGas:{v:40,d:"Once per CALL operation & message call transaction."},callStipend:{v:2300,d:"Free gas given at beginning of call."},callValueTransferGas:{v:9e3,d:"Paid for CALL when the value transfor is non-zero."},callNewAccountGas:{v:25e3,d:"Paid for CALL when the destination address didn't exist prior."},suicideRefundGas:{v:24e3,d:"Refunded following a suicide operation."},memoryGas:{v:3,d:"Times the address of the (highest referenced byte in memory + 1). NOTE: referencing happens on read, write and in instructions such as RETURN and CALL."},quadCoeffDiv:{v:512,d:"Divisor for the quadratic particle of the memory cost equation."},createDataGas:{v:200,d:""},txGas:{v:21e3,d:"Per transaction. NOTE: Not payable on data of calls between transactions."},txCreation:{v:32e3,d:"the cost of creating a contract via tx"},txDataZeroGas:{v:4,d:"Per byte of data attached to a transaction that equals zero. NOTE: Not payable on data of calls between transactions."},txDataNonZeroGas:{v:68,d:"Per byte of data attached to a transaction that is not equal to zero. NOTE: Not payable on data of calls between transactions."},copyGas:{v:3,d:"Multiplied by the number of 32-byte words that are copied (round up) for any *COPY operation and added."},ecrecoverGas:{v:3e3,d:""},sha256Gas:{v:60,d:""},sha256WordGas:{v:12,d:""},ripemd160Gas:{v:600,d:""},ripemd160WordGas:{v:120,d:""},identityGas:{v:15,d:""},identityWordGas:{v:3,d:""},modexpGquaddivisor:{v:20,d:"Gquaddivisor from modexp precompile for gas calculation."},ecAddGas:{v:500,d:"Gas costs for curve addition precompile."},ecMulGas:{v:4e4,d:"Gas costs for curve multiplication precompile."},ecPairingGas:{v:1e5,d:"Base gas costs for curve pairing precompile."},ecPairingWordGas:{v:8e4,d:"Gas costs regarding curve pairing precompile input length."},minerReward:{v:"3000000000000000000",d:"the amount a miner get rewarded for mining a block"},homeSteadForkNumber:{v:115e4,d:"the block that the Homestead fork started at"},homesteadRepriceForkNumber:{v:2463e3,d:"the block that the Homestead Reprice (EIP150) fork started at"},timebombPeriod:{v:1e5,d:"Exponential difficulty timebomb period"},freeBlockPeriod:{v:2}}},function(e,t,r){"use strict";const n=r(5),i=r(41),o=r(154),s=r(130),a=r(419),u=r(837),c=r(131),f=r(418).resolver,l=r(132),h=l("eth-block-list",void 0,d),p=h.util;function d(e,t,r){let n=[];n.push({path:"count",value:e.length}),i(e,(t,r)=>{const i=e.indexOf(t),o=i.toString();n.push({path:o,value:t}),f._mapFromEthObject(t,{},(e,t)=>{if(e)return r(e);t.forEach(e=>e.path=o+"/"+e.path),n=n.concat(t),r()})},e=>{if(e)return r(e);r(null,n)})}p.serialize=o(e=>{const t=e.map(e=>e.raw);return s.encode(t)}),p.deserialize=o(e=>{const t=s.decode(e);return t.map(e=>new a(e))}),p.cid=((e,t,r)=>{"function"==typeof t&&(r=t,t={}),t=t||{};const i=t.hashAlg||"keccak-256",s=void 0===t.version?1:t.version;n([t=>p.serialize(e,t),(e,t)=>u.digest(e,i,t),o(e=>c("eth-block-list",e,t))],r)}),e.exports=h},function(e,t,r){"use strict";(function(t){const n=r(14),i=r(838);function o(e,t,r,i){if("function"==typeof r&&(i=r,r=void 0),!i)throw new Error("Missing callback");o.digest(e,t,r,(e,o)=>{if(e)return i(e);i(null,n.encode(o,t,r))})}e.exports=o,o.Buffer=t,o.multihash=n,o.digest=function(e,t,r,n){if("function"==typeof r&&(n=r,r=void 0),!n)throw new Error("Missing callback");let i=n,s;r&&(i=((e,t)=>{if(e)return n(e);n(null,t.slice(0,r))}));try{s=o.createHash(t)}catch(e){return i(e)}s(e,i)},o.createHash=function(e){if(e=n.coerceCode(e),!o.functions[e])throw new Error("multihash function "+e+" not yet supported");return o.functions[e]},o.functions={17:i.sha1,18:i.sha2256,19:i.sha2512,20:i.sha3512,21:i.sha3384,22:i.sha3256,23:i.sha3224,24:i.shake128,25:i.shake256,26:i.keccak224,27:i.keccak256,28:i.keccak384,29:i.keccak512,34:i.murmur3128,35:i.murmur332,86:i.dblSha2256},i.addBlake(o.functions)}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(t){const n=r(48),i=r(49),o=r(420),s=r(839),a=o.toCallback,u=o.toBuf,c=o.fromString,f=o.fromNumberTo32BitBuf,l=(e,r)=>{s.sha2256(e,(e,n)=>{e&&r(e),s.sha2256(t.from(n),r)})};e.exports={sha1:s.sha1,sha2256:s.sha2256,sha2512:s.sha2512,sha3512:a(u(n.sha3_512)),sha3384:a(u(n.sha3_384)),sha3256:a(u(n.sha3_256)),sha3224:a(u(n.sha3_224)),shake128:a(u(n.shake_128,256)),shake256:a(u(n.shake_256,512)),keccak224:a(u(n.keccak_224)),keccak256:a(u(n.keccak_256)),keccak384:a(u(n.keccak_384)),keccak512:a(u(n.keccak_512)),murmur3128:a(u(c(i.x64.hash128))),murmur332:a(f(c(i.x86.hash32))),addBlake:r(840),dblSha2256:l}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(t){const n=r(50),i=o();function o(){return self.crypto?self.crypto.subtle||self.crypto.webkitSubtle:self.msCrypto?self.msCrypto.subtle:void 0}function s(e){if(!i)throw new Error("Please use a browser with webcrypto support");return(r,o)=>{const s=i.digest({name:e},r);if("function"!=typeof s.then)return s.onerror=(()=>{o(new Error(`hashing data using ${e}`))}),void(s.oncomplete=(e=>{o(null,e.target.result)}));n(s.then(e=>t.from(new Uint8Array(e))),o)}}function a(e,t){s("SHA-1")(e,t)}function u(e,t){s("SHA-256")(e,t)}function c(e,t){s("SHA-512")(e,t)}e.exports={sha1:a,sha2256:u,sha2512:c}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(t){const n=r(51),i=r(420).toCallback,o=45569,s=45633,a={init:n.blake2bInit,update:n.blake2bUpdate,digest:n.blake2bFinal},u={init:n.blake2sInit,update:n.blake2sUpdate,digest:n.blake2sFinal},c=(e,r)=>i(n=>{const i=r.init(e,null);return r.update(i,n),t.from(r.digest(i))});e.exports=(e=>{for(let t=0;t<64;t++)e[o+t]=c(t+1,a);for(let t=0;t<32;t++)e[s+t]=c(t+1,u)})}).call(this,r(0).Buffer)},function(e,t,r){"use strict";const n=r(408),i=r(246),o=i("eth-state-trie",n);e.exports=o},function(e,t,r){(function(t){const n=r(130),i=r(173);function o(e,t,r){if(Array.isArray(e))this.parseNode(e);else if(this.type=e,"branch"===e){var n=t;this.raw=Array.apply(null,Array(17)),n&&n.forEach(function(e){this.set.apply(this,e)})}else this.raw=Array(2),this.setValue(r),this.setKey(t)}function s(e,t){return e.length%2?e.unshift(1):(e.unshift(0),e.unshift(0)),t&&(e[0]+=2),e}function a(e){return e=e[0]%2?e.slice(1):e.slice(2),e}function u(e){return e[0]>1}function c(e){for(var r=new t(e),n=[],i=0;i<r.length;i++){var o=2*i;n[o]=r[i]>>4,++o,n[o]=r[i]%16}return n}function f(e){for(var r=new t(e.length/2),n=0;n<r.length;n++){var i=2*n;r[n]=(e[i]<<4)+e[++i]}return r}function l(e){if(17===e.length)return"branch";if(2===e.length){var t=c(e[0]);return u(t)?"leaf":"extention"}}function h(e){return Array.isArray(e)&&!t.isBuffer(e)}e.exports=o,o.isRawNode=h,o.addHexPrefix=s,o.removeHexPrefix=a,o.isTerminator=u,o.stringToNibbles=c,o.nibblesToBuffer=f,o.getNodeType=l,Object.defineProperty(o.prototype,"value",{get:function(){return this.getValue()},set:function(e){this.setValue(e)}}),Object.defineProperty(o.prototype,"key",{get:function(){return this.getKey()},set:function(e){this.setKey(e)}}),o.prototype.parseNode=function(e){this.raw=e,this.type=l(e)},o.prototype.setValue=function(e,t){"branch"!==this.type?this.raw[1]=e:(1===arguments.length&&(t=e,e=16),this.raw[e]=t)},o.prototype.getValue=function(e){if("branch"!==this.type)return this.raw[1];0===arguments.length&&(e=16);var t=this.raw[e];return null!==t&&void 0!==t&&0!==t.length?t:void 0},o.prototype.setKey=function(e){"branch"!==this.type&&(e=t.isBuffer(e)?c(e):e.slice(0),e=s(e,"leaf"===this.type),this.raw[0]=f(e))},o.prototype.getKey=function(){if("branch"!==this.type){var e=this.raw[0];return e=a(c(e)),e}},o.prototype.serialize=function(){return n.encode(this.raw)},o.prototype.hash=function(){return i.sha3(this.serialize())},o.prototype.toString=function(){var e=this.type;return e+=": [",this.raw.forEach(function(r){t.isBuffer(r)?e+=r.toString("hex")+", ":e+=r?"object, ":"empty, "}),e=e.slice(0,-2),e+="]",e},o.prototype.getChildren=function(){var e=[];switch(this.type){case"leaf":break;case"extention":e.push([this.key,this.getValue()]);break;case"branch":for(var t=0,r=16;t<16;t++){var n=this.getValue(t);n&&e.push([[t],n])}}return e}}).call(this,r(0).Buffer)},function(e,t){function r(e){return Boolean(e["/"])}e.exports=r},function(e,t,r){"use strict";const n=r(246),i=n("eth-storage-trie");e.exports=i},function(e,t,r){"use strict";(function(t){function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var i=r(173),o=r(846),s=i.BN,a=new s("7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a0",16),u=function(){function e(r){n(this,e),r=r||{};var o=[{name:"nonce",length:32,allowLess:!0,default:new t([])},{name:"gasPrice",length:32,allowLess:!0,default:new t([])},{name:"gasLimit",alias:"gas",length:32,allowLess:!0,default:new t([])},{name:"to",allowZero:!0,length:20,default:new t([])},{name:"value",length:32,allowLess:!0,default:new t([])},{name:"data",alias:"input",allowZero:!0,default:new t([])},{name:"v",allowZero:!0,default:new t([28])},{name:"r",length:32,allowZero:!0,allowLess:!0,default:new t([])},{name:"s",length:32,allowZero:!0,allowLess:!0,default:new t([])}];i.defineProperties(this,o,r),Object.defineProperty(this,"from",{enumerable:!0,configurable:!0,get:this.getSenderAddress.bind(this)});var s=i.bufferToInt(this.v),a=Math.floor((s-35)/2);a<0&&(a=0),this._chainId=a||r.chainId||0,this._homestead=!0}return e.prototype.toCreationAddress=function e(){return""===this.to.toString("hex")},e.prototype.hash=function e(t){void 0===t&&(t=!0);var r=void 0;if(t)r=this.raw;else if(this._chainId>0){var n=this.raw.slice();this.v=this._chainId,this.r=0,this.s=0,r=this.raw,this.raw=n}else r=this.raw.slice(0,6);return i.rlphash(r)},e.prototype.getChainId=function e(){return this._chainId},e.prototype.getSenderAddress=function e(){if(this._from)return this._from;var t=this.getSenderPublicKey();return this._from=i.publicToAddress(t),this._from},e.prototype.getSenderPublicKey=function e(){if(!(this._senderPubKey&&this._senderPubKey.length||this.verifySignature()))throw new Error("Invalid Signature");return this._senderPubKey},e.prototype.verifySignature=function e(){var t=this.hash(!1);if(this._homestead&&1===new s(this.s).cmp(a))return!1;try{var r=i.bufferToInt(this.v);this._chainId>0&&(r-=2*this._chainId+8),this._senderPubKey=i.ecrecover(t,r,this.r,this.s)}catch(e){return!1}return!!this._senderPubKey},e.prototype.sign=function e(t){var r=this.hash(!1),n=i.ecsign(r,t);this._chainId>0&&(n.v+=2*this._chainId+8),Object.assign(this,n)},e.prototype.getDataFee=function e(){for(var t=this.raw[5],r=new s(0),n=0;n<t.length;n++)0===t[n]?r.iaddn(o.txDataZeroGas.v):r.iaddn(o.txDataNonZeroGas.v);return r},e.prototype.getBaseFee=function e(){var t=this.getDataFee().iaddn(o.txGas.v);return this._homestead&&this.toCreationAddress()&&t.iaddn(o.txCreation.v),t},e.prototype.getUpfrontCost=function e(){return new s(this.gasLimit).imul(new s(this.gasPrice)).iadd(new s(this.value))},e.prototype.validate=function e(t){var r=[];return this.verifySignature()||r.push("Invalid Signature"),this.getBaseFee().cmp(new s(this.gasLimit))>0&&r.push(["gas limit is too low. Need at least "+this.getBaseFee()]),void 0===t||!1===t?0===r.length:r.join(" ")},e}();e.exports=u}).call(this,r(0).Buffer)},function(e){e.exports={genesisGasLimit:{v:5e3,d:"Gas limit of the Genesis block."},genesisDifficulty:{v:17179869184,d:"Difficulty of the Genesis block."},genesisNonce:{v:"0x0000000000000042",d:"the geneis nonce"},genesisExtraData:{v:"0x11bbe8db4e347b4e8c937c1c8370e4b5ed33adb3db69cbdb7a38e1e50b1b82fa",d:"extra data "},genesisHash:{v:"0xd4e56740f876aef8c010b86a40d5f56745a118d0906a34e69aec8c0db1cb8fa3",d:"genesis hash"},genesisStateRoot:{v:"0xd7f8974fb5ac78d9ac099b9ad5018bedc2ce0a72dad1827a1709da30580f0544",d:"the genesis state root"},minGasLimit:{v:5e3,d:"Minimum the gas limit may ever be."},gasLimitBoundDivisor:{v:1024,d:"The bound divisor of the gas limit, used in update calculations."},minimumDifficulty:{v:131072,d:"The minimum that the difficulty may ever be."},difficultyBoundDivisor:{v:2048,d:"The bound divisor of the difficulty, used in the update calculations."},durationLimit:{v:13,d:"The decision boundary on the blocktime duration used to determine whether difficulty should go up or not."},maximumExtraDataSize:{v:32,d:"Maximum size extra data may be after Genesis."},epochDuration:{v:3e4,d:"Duration between proof-of-work epochs."},stackLimit:{v:1024,d:"Maximum size of VM stack allowed."},callCreateDepth:{v:1024,d:"Maximum depth of call/create stack."},tierStepGas:{v:[0,2,3,5,8,10,20],d:"Once per operation, for a selection of them."},expGas:{v:10,d:"Once per EXP instuction."},expByteGas:{v:10,d:"Times ceil(log256(exponent)) for the EXP instruction."},sha3Gas:{v:30,d:"Once per SHA3 operation."},sha3WordGas:{v:6,d:"Once per word of the SHA3 operation's data."},sloadGas:{v:50,d:"Once per SLOAD operation."},sstoreSetGas:{v:2e4,d:"Once per SSTORE operation if the zeroness changes from zero."},sstoreResetGas:{v:5e3,d:"Once per SSTORE operation if the zeroness does not change from zero."},sstoreRefundGas:{v:15e3,d:"Once per SSTORE operation if the zeroness changes to zero."},jumpdestGas:{v:1,d:"Refunded gas, once per SSTORE operation if the zeroness changes to zero."},logGas:{v:375,d:"Per LOG* operation."},logDataGas:{v:8,d:"Per byte in a LOG* operation's data."},logTopicGas:{v:375,d:"Multiplied by the * of the LOG*, per LOG transaction. e.g. LOG0 incurs 0 * c_txLogTopicGas, LOG4 incurs 4 * c_txLogTopicGas."},createGas:{v:32e3,d:"Once per CREATE operation & contract-creation transaction."},callGas:{v:40,d:"Once per CALL operation & message call transaction."},callStipend:{v:2300,d:"Free gas given at beginning of call."},callValueTransferGas:{v:9e3,d:"Paid for CALL when the value transfor is non-zero."},callNewAccountGas:{v:25e3,d:"Paid for CALL when the destination address didn't exist prior."},suicideRefundGas:{v:24e3,d:"Refunded following a suicide operation."},memoryGas:{v:3,d:"Times the address of the (highest referenced byte in memory + 1). NOTE: referencing happens on read, write and in instructions such as RETURN and CALL."},quadCoeffDiv:{v:512,d:"Divisor for the quadratic particle of the memory cost equation."},createDataGas:{v:200,d:""},txGas:{v:21e3,d:"Per transaction. NOTE: Not payable on data of calls between transactions."},txCreation:{v:32e3,d:"the cost of creating a contract via tx"},txDataZeroGas:{v:4,d:"Per byte of data attached to a transaction that equals zero. NOTE: Not payable on data of calls between transactions."},txDataNonZeroGas:{v:68,d:"Per byte of data attached to a transaction that is not equal to zero. NOTE: Not payable on data of calls between transactions."},copyGas:{v:3,d:"Multiplied by the number of 32-byte words that are copied (round up) for any *COPY operation and added."},ecrecoverGas:{v:3e3,d:""},sha256Gas:{v:60,d:""},sha256WordGas:{v:12,d:""},ripemd160Gas:{v:600,d:""},ripemd160WordGas:{v:120,d:""},identityGas:{v:15,d:""},identityWordGas:{v:3,d:""},minerReward:{v:"5000000000000000000",d:"the amount a miner get rewarded for mining a block"},ommerReward:{v:"625000000000000000",d:"The amount of wei a miner of an uncle block gets for being inculded in the blockchain"},niblingReward:{v:"156250000000000000",d:"the amount a miner gets for inculding a uncle"},homeSteadForkNumber:{v:115e4,d:"the block that the Homestead fork started at"},homesteadRepriceForkNumber:{v:2463e3,d:"the block that the Homestead Reprice (EIP150) fork started at"},timebombPeriod:{v:1e5,d:"Exponential difficulty timebomb period"},freeBlockPeriod:{v:2}}},function(e,t,r){"use strict";const n=r(421),i=r(246),o=i("eth-tx-trie",n);e.exports=o},function(e,t,r){"use strict";const n=r(9),i=r(59);e.exports={resolver:{multicodec:"raw",defaultHashAlg:"sha2-256",resolve:(e,t,r)=>{r(null,{value:e,remainderPath:""})},tree:(e,t,r)=>{"function"==typeof t&&(r=t),r(null,[])}},util:{deserialize:(e,t)=>{t(null,e)},serialize:(e,t)=>{t(null,e)},cid:(e,t,r)=>{"function"==typeof t&&(r=t,t={}),t=t||{};const o=t.hashAlg||"sha2-256",s=void 0===t.version?1:t.version;i(e,o,(e,t)=>{if(e)return r(e);r(null,new n(s,"raw",t))})}}}},function(e,t,r){"use strict";t.resolver=r(247),t.util=r(422)},function(e,t,r){"use strict";(function(t,n){var i=e.exports;i.version="v"+r(851).version,i.versionGuard=function(e){if(void 0!==e)var t="More than one instance of zcash-bitcore-lib found. Please make sure to require zcash-bitcore-lib and check that submodules do not also include their own zcash-bitcore-lib dependency."},i.versionGuard(t._bitcore),t._bitcore=i.version,i.crypto={},i.crypto.BN=r(34),i.crypto.ECDSA=r(423),i.crypto.Hash=r(40),i.crypto.Random=r(179),i.crypto.Point=r(111),i.crypto.Signature=r(61),i.encoding={},i.encoding.Base58=r(177),i.encoding.Base58Check=r(133),i.encoding.BufferReader=r(85),i.encoding.BufferWriter=r(58),i.encoding.Varint=r(879),i.util={},i.util.buffer=r(24),i.util.js=r(30),i.util.preconditions=r(20),i.errors=r(60),i.Address=r(99),i.Block=r(880),i.MerkleBlock=r(427),i.BlockHeader=r(180),i.HDPrivateKey=r(428),i.HDPublicKey=r(429),i.Networks=r(98),i.Opcode=r(248),i.PrivateKey=r(176),i.PublicKey=r(67),i.Script=r(62),i.Transaction=r(178),i.URI=r(882),i.Unit=r(251),i.deps={},i.deps.bnjs=r(75),i.deps.bs58=r(424),i.deps.Buffer=n,i.deps.elliptic=r(66),i.deps._=r(15),i._HDKeyCache=r(252),i.Transaction.sighash=r(86)}).call(this,r(7),r(0).Buffer)},function(e){e.exports={_from:"zcash-bitcore-lib@~0.13.20-rc3",_id:"zcash-bitcore-lib@0.13.20-rc3",_inBundle:!1,_integrity:"sha1-gToPVtz4t2vBQplRvqbRI2xQcAg=",_location:"/zcash-bitcore-lib",_phantomChildren:{},_requested:{type:"range",registry:!0,raw:"zcash-bitcore-lib@~0.13.20-rc3",name:"zcash-bitcore-lib",escapedName:"zcash-bitcore-lib",rawSpec:"~0.13.20-rc3",saveSpec:null,fetchSpec:"~0.13.20-rc3"},_requiredBy:["/ipld-zcash"],_resolved:"https://registry.npmjs.org/zcash-bitcore-lib/-/zcash-bitcore-lib-0.13.20-rc3.tgz",_shasum:"813a0f56dcf8b76bc1429951bea6d1236c507008",_shrinkwrap:{name:"bitcore",version:"0.13.19",dependencies:{"bn.js":{version:"2.0.4",from:"bn.js@=2.0.4",resolved:"https://registry.npmjs.org/bn.js/-/bn.js-2.0.4.tgz"},bs58:{version:"2.0.0",from:"bs58@=2.0.0",resolved:"https://registry.npmjs.org/bs58/-/bs58-2.0.0.tgz"},"buffer-compare":{version:"1.0.0",from:"buffer-compare@=1.0.0",resolved:"https://registry.npmjs.org/buffer-compare/-/buffer-compare-1.0.0.tgz"},elliptic:{version:"3.0.3",from:"elliptic@=3.0.3",resolved:"https://registry.npmjs.org/elliptic/-/elliptic-3.0.3.tgz",dependencies:{brorand:{version:"1.0.5",from:"brorand@^1.0.1",resolved:"https://registry.npmjs.org/brorand/-/brorand-1.0.5.tgz"},"hash.js":{version:"1.0.3",from:"hash.js@=1.0.3",resolved:"https://registry.npmjs.org/hash.js/-/hash.js-1.0.3.tgz"}}},inherits:{version:"2.0.1",from:"inherits@=2.0.1",resolved:"https://registry.npmjs.org/inherits/-/inherits-2.0.1.tgz"},lodash:{version:"3.10.1",from:"lodash@=3.10.1",resolved:"https://registry.npmjs.org/lodash/-/lodash-3.10.1.tgz"}}},_spec:"zcash-bitcore-lib@~0.13.20-rc3",_where:"/Users/mitra/git/dweb-transports/node_modules/ipld-zcash",author:{name:"BitPay",email:"dev@bitpay.com"},browser:{request:"browser-request"},bugs:{url:"https://github.com/bitmex/zcash-bitcore-lib/issues"},bundleDependencies:!1,contributors:[{name:"Daniel Cousens",email:"bitcoin@dcousens.com"},{name:"Esteban Ordano",email:"eordano@gmail.com"},{name:"Gordon Hall",email:"gordon@bitpay.com"},{name:"Jeff Garzik",email:"jgarzik@bitpay.com"},{name:"Kyle Drake",email:"kyle@kyledrake.net"},{name:"Manuel Araoz",email:"manuelaraoz@gmail.com"},{name:"Matias Alejo Garcia",email:"ematiu@gmail.com"},{name:"Ryan X. Charles",email:"ryanxcharles@gmail.com"},{name:"Stefan Thomas",email:"moon@justmoon.net"},{name:"Stephen Pair",email:"stephen@bitpay.com"},{name:"Wei Lu",email:"luwei.here@gmail.com"},{name:"Jack Grigg",email:"jack@z.cash"}],dependencies:{"bn.js":"=2.0.4",bs58:"=2.0.0","buffer-compare":"=1.0.0",elliptic:"=3.0.3",inherits:"=2.0.1",lodash:"=3.10.1"},deprecated:!1,description:"A pure and powerful JavaScript Zcash library.",devDependencies:{brfs:"^1.2.0",chai:"^1.10.0",gulp:"^3.8.10",sinon:"^1.13.0","zcash-bitcore-build":"^0.5.4"},homepage:"https://github.com/bitmex/zcash-bitcore-lib#readme",keywords:["zcash","transaction","address","p2p","ecies","cryptocurrency","blockchain","payment","bip21","bip32","bip37","bip69","bip70","multisig"],license:"MIT",main:"index.js",name:"zcash-bitcore-lib",repository:{type:"git",url:"git+https://github.com/bitmex/zcash-bitcore-lib.git"},scripts:{build:"gulp",coverage:"gulp coverage",lint:"gulp lint",test:"gulp test"},version:"0.13.20-rc3"}},function(e,t,r){"use strict";var n="http://bitcore.io/";e.exports=[{name:"InvalidB58Char",message:"Invalid Base58 character: {0} in {1}"},{name:"InvalidB58Checksum",message:"Invalid Base58 checksum for {0}"},{name:"InvalidNetwork",message:"Invalid version for network: got {0}"},{name:"InvalidState",message:"Invalid state: {0}"},{name:"NotImplemented",message:"Function {0} was not implemented yet"},{name:"InvalidNetworkArgument",message:'Invalid network: must be "livenet" or "testnet", got {0}'},{name:"InvalidArgument",message:function(){return"Invalid Argument"+(arguments[0]?": "+arguments[0]:"")+(arguments[1]?" Documentation: "+n+arguments[1]:"")}},{name:"AbstractMethodInvoked",message:"Abstract Method Invocation: {0}"},{name:"InvalidArgumentType",message:function(){return"Invalid Argument for "+arguments[2]+", expected "+arguments[1]+" but got "+typeof arguments[0]}},{name:"Unit",message:"Internal Error on Unit {0}",errors:[{name:"UnknownCode",message:"Unrecognized unit code: {0}"},{name:"InvalidRate",message:"Invalid exchange rate: {0}"}]},{name:"Transaction",message:"Internal Error on Transaction {0}",errors:[{name:"Input",message:"Internal Error on Input {0}",errors:[{name:"MissingScript",message:"Need a script to create an input"},{name:"UnsupportedScript",message:"Unsupported input script type: {0}"},{name:"MissingPreviousOutput",message:"No previous output information."}]},{name:"NeedMoreInfo",message:"{0}"},{name:"InvalidSorting",message:"The sorting function provided did not return the change output as one of the array elements"},{name:"InvalidOutputAmountSum",message:"{0}"},{name:"MissingSignatures",message:"Some inputs have not been fully signed"},{name:"InvalidIndex",message:"Invalid index: {0} is not between 0, {1}"},{name:"UnableToVerifySignature",message:"Unable to verify signature: {0}"},{name:"DustOutputs",message:"Dust amount detected in one output"},{name:"InvalidSatoshis",message:"Output satoshis are invalid"},{name:"FeeError",message:"Internal Error on Fee {0}",errors:[{name:"TooSmall",message:"Fee is too small: {0}"},{name:"TooLarge",message:"Fee is too large: {0}"},{name:"Different",message:"Unspent value is different from specified fee: {0}"}]},{name:"ChangeAddressMissing",message:"Change address is missing"},{name:"BlockHeightTooHigh",message:"Block Height can be at most 2^32 -1"},{name:"NLockTimeOutOfRange",message:"Block Height can only be between 0 and 499 999 999"},{name:"LockTimeTooEarly",message:"Lock Time can't be earlier than UNIX date 500 000 000"}]},{name:"Script",message:"Internal Error on Script {0}",errors:[{name:"UnrecognizedAddress",message:"Expected argument {0} to be an address"},{name:"CantDeriveAddress",message:"Can't derive address associated with script {0}, needs to be p2pkh in, p2pkh out, p2sh in, or p2sh out."},{name:"InvalidBuffer",message:"Invalid script buffer: can't parse valid script from given buffer {0}"}]},{name:"HDPrivateKey",message:"Internal Error on HDPrivateKey {0}",errors:[{name:"InvalidDerivationArgument",message:"Invalid derivation argument {0}, expected string, or number and boolean"},{name:"InvalidEntropyArgument",message:"Invalid entropy: must be an hexa string or binary buffer, got {0}",errors:[{name:"TooMuchEntropy",message:'Invalid entropy: more than 512 bits is non standard, got "{0}"'},{name:"NotEnoughEntropy",message:'Invalid entropy: at least 128 bits needed, got "{0}"'}]},{name:"InvalidLength",message:"Invalid length for xprivkey string in {0}"},{name:"InvalidPath",message:"Invalid derivation path: {0}"},{name:"UnrecognizedArgument",message:'Invalid argument: creating a HDPrivateKey requires a string, buffer, json or object, got "{0}"'}]},{name:"HDPublicKey",message:"Internal Error on HDPublicKey {0}",errors:[{name:"ArgumentIsPrivateExtended",message:"Argument is an extended private key: {0}"},{name:"InvalidDerivationArgument",message:"Invalid derivation argument: got {0}"},{name:"InvalidLength",message:'Invalid length for xpubkey: got "{0}"'},{name:"InvalidPath",message:'Invalid derivation path, it should look like: "m/1/100", got "{0}"'},{name:"InvalidIndexCantDeriveHardened",message:"Invalid argument: creating a hardened path requires an HDPrivateKey"},{name:"MustSupplyArgument",message:"Must supply an argument to create a HDPublicKey"},{name:"UnrecognizedArgument",message:"Invalid argument for creation, must be string, json, buffer, or object"}]}]},function(e){e.exports={_from:"elliptic@=3.0.3",_id:"elliptic@3.0.3",_inBundle:!1,_integrity:"sha1-hlybQgv75VAGuflp+XoNLESWZZU=",_location:"/zcash-bitcore-lib/elliptic",_phantomChildren:{inherits:"2.0.1"},_requested:{type:"version",registry:!0,raw:"elliptic@3.0.3",name:"elliptic",escapedName:"elliptic",rawSpec:"3.0.3",saveSpec:null,fetchSpec:"3.0.3"},_requiredBy:["/zcash-bitcore-lib"],_resolved:"https://registry.npmjs.org/elliptic/-/elliptic-3.0.3.tgz",_shasum:"865c9b420bfbe55006b9f969f97a0d2c44966595",_spec:"elliptic@3.0.3",_where:"/Users/mitra/git/dweb-transports/node_modules/zcash-bitcore-lib",author:{name:"Fedor Indutny",email:"fedor@indutny.com"},bugs:{url:"https://github.com/indutny/elliptic/issues"},bundleDependencies:!1,dependencies:{"bn.js":"^2.0.0",brorand:"^1.0.1","hash.js":"^1.0.0",inherits:"^2.0.1"},deprecated:!1,description:"EC cryptography",devDependencies:{browserify:"^3.44.2",jscs:"^1.11.3",jshint:"^2.6.0",mocha:"^2.1.0","uglify-js":"^2.4.13"},homepage:"https://github.com/indutny/elliptic",keywords:["EC","Elliptic","curve","Cryptography"],license:"MIT",main:"lib/elliptic.js",name:"elliptic",repository:{type:"git",url:"git+ssh://git@github.com/indutny/elliptic.git"},scripts:{test:"make lint && mocha --reporter=spec test/*-test.js"},version:"3.0.3"}},function(e,t,r){"use strict";var n=t;function i(e,t){if(Array.isArray(e))return e.slice();if(!e)return[];var r=[];if("string"!=typeof e){for(var n=0;n<e.length;n++)r[n]=0|e[n];return r}if(t){if("hex"===t){e=e.replace(/[^a-z0-9]+/gi,""),e.length%2!=0&&(e="0"+e);for(var n=0;n<e.length;n+=2)r.push(parseInt(e[n]+e[n+1],16))}}else for(var n=0;n<e.length;n++){var i=e.charCodeAt(n),o=i>>8,s=255&i;o?r.push(o,s):r.push(s)}return r}function o(e){return 1===e.length?"0"+e:e}function s(e){for(var t="",r=0;r<e.length;r++)t+=o(e[r].toString(16));return t}function a(e,t){for(var r=[],n=1<<t+1,i=e.clone();i.cmpn(1)>=0;){var o;if(i.isOdd()){var s=i.andln(n-1);o=s>(n>>1)-1?(n>>1)-s:s,i.isubn(o)}else o=0;r.push(o);for(var a=0!==i.cmpn(0)&&0===i.andln(n-1)?t+1:1,u=1;u<a;u++)r.push(0);i.ishrn(a)}return r}function u(e,t){var r=[[],[]];e=e.clone(),t=t.clone();for(var n=0,i=0;e.cmpn(-n)>0||t.cmpn(-i)>0;){var o=e.andln(3)+n&3,s=t.andln(3)+i&3,a,u;if(3===o&&(o=-1),3===s&&(s=-1),0==(1&o))a=0;else{var c=e.andln(7)+n&7;a=3!==c&&5!==c||2!==s?o:-o}if(r[0].push(a),0==(1&s))u=0;else{var c=t.andln(7)+i&7;u=3!==c&&5!==c||2!==o?s:-s}r[1].push(u),2*n===a+1&&(n=1-n),2*i===u+1&&(i=1-i),e.ishrn(1),t.ishrn(1)}return r}n.assert=function e(t,r){if(!t)throw new Error(r||"Assertion failed")},n.toArray=i,n.zero2=o,n.toHex=s,n.encode=function e(t,r){return"hex"===r?s(t):t},n.getNAF=a,n.getJSF=u},function(e,t,r){var n;function i(e){this.rand=e}if(e.exports=function e(t){return n||(n=new i(null)),n.generate(t)},e.exports.Rand=i,i.prototype.generate=function e(t){return this._rand(t)},"object"==typeof window)window.crypto&&window.crypto.getRandomValues?i.prototype._rand=function e(t){var r=new Uint8Array(t);return window.crypto.getRandomValues(r),r}:window.msCrypto&&window.msCrypto.getRandomValues?i.prototype._rand=function e(t){var r=new Uint8Array(t);return window.msCrypto.getRandomValues(r),r}:i.prototype._rand=function(){throw new Error("Not implemented yet")};else try{var o=r(97);i.prototype._rand=function e(t){return o.randomBytes(t)}}catch(e){i.prototype._rand=function e(t){for(var r=new Uint8Array(t),n=0;n<r.length;n++)r[n]=this.rand.getByte();return r}}},function(e,t,r){"use strict";var n=r(112),i=r(66),o=i.utils,s=o.assert;function a(e){if(!(this instanceof a))return new a(e);this.hash=e.hash,this.predResist=!!e.predResist,this.outLen=this.hash.outSize,this.minEntropy=e.minEntropy||this.hash.hmacStrength,this.reseed=null,this.reseedInterval=null,this.K=null,this.V=null;var t=o.toArray(e.entropy,e.entropyEnc),r=o.toArray(e.nonce,e.nonceEnc),n=o.toArray(e.pers,e.persEnc);s(t.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(t,r,n)}e.exports=a,a.prototype._init=function e(t,r,n){var i=t.concat(r).concat(n);this.K=new Array(this.outLen/8),this.V=new Array(this.outLen/8);for(var o=0;o<this.V.length;o++)this.K[o]=0,this.V[o]=1;this._update(i),this.reseed=1,this.reseedInterval=281474976710656},a.prototype._hmac=function e(){return new n.hmac(this.hash,this.K)},a.prototype._update=function e(t){var r=this._hmac().update(this.V).update([0]);t&&(r=r.update(t)),this.K=r.digest(),this.V=this._hmac().update(this.V).digest(),t&&(this.K=this._hmac().update(this.V).update([1]).update(t).digest(),this.V=this._hmac().update(this.V).digest())},a.prototype.reseed=function e(t,r,n,i){"string"!=typeof r&&(i=n,n=r,r=null),t=o.toBuffer(t,r),n=o.toBuffer(n,i),s(t.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(t.concat(n||[])),this.reseed=1},a.prototype.generate=function e(t,r,n,i){if(this.reseed>this.reseedInterval)throw new Error("Reseed is required");"string"!=typeof r&&(i=n,n=r,r=null),n&&(n=o.toArray(n,i),this._update(n));for(var s=[];s.length<t;)this.V=this._hmac().update(this.V).digest(),s=s.concat(this.V);var a=s.slice(0,t);return this._update(n),this.reseed++,o.encode(a,r)}},function(e,t,r){var n=t,i=r(76);function o(e,t){if(Array.isArray(e))return e.slice();if(!e)return[];var r=[];if("string"==typeof e)if(t){if("hex"===t){e=e.replace(/[^a-z0-9]+/gi,""),e.length%2!=0&&(e="0"+e);for(var n=0;n<e.length;n+=2)r.push(parseInt(e[n]+e[n+1],16))}}else for(var n=0;n<e.length;n++){var i=e.charCodeAt(n),o=i>>8,s=255&i;o?r.push(o,s):r.push(s)}else for(var n=0;n<e.length;n++)r[n]=0|e[n];return r}function s(e){for(var t="",r=0;r<e.length;r++)t+=c(e[r].toString(16));return t}function a(e){var t=e>>>24|e>>>8&65280|e<<8&16711680|(255&e)<<24;return t>>>0}function u(e,t){for(var r="",n=0;n<e.length;n++){var i=e[n];"little"===t&&(i=a(i)),r+=f(i.toString(16))}return r}function c(e){return 1===e.length?"0"+e:e}function f(e){return 7===e.length?"0"+e:6===e.length?"00"+e:5===e.length?"000"+e:4===e.length?"0000"+e:3===e.length?"00000"+e:2===e.length?"000000"+e:1===e.length?"0000000"+e:e}function l(e,t,r,n){var i=r-t;v(i%4==0);for(var o=new Array(i/4),s=0,a=t;s<o.length;s++,a+=4){var u;u="big"===n?e[a]<<24|e[a+1]<<16|e[a+2]<<8|e[a+3]:e[a+3]<<24|e[a+2]<<16|e[a+1]<<8|e[a],o[s]=u>>>0}return o}function h(e,t){for(var r=new Array(4*e.length),n=0,i=0;n<e.length;n++,i+=4){var o=e[n];"big"===t?(r[i]=o>>>24,r[i+1]=o>>>16&255,r[i+2]=o>>>8&255,r[i+3]=255&o):(r[i+3]=o>>>24,r[i+2]=o>>>16&255,r[i+1]=o>>>8&255,r[i]=255&o)}return r}function p(e,t){return e>>>t|e<<32-t}function d(e,t){return e<<t|e>>>32-t}function y(e,t){return e+t>>>0}function g(e,t,r){return e+t+r>>>0}function m(e,t,r,n){return e+t+r+n>>>0}function b(e,t,r,n,i){return e+t+r+n+i>>>0}function v(e,t){if(!e)throw new Error(t||"Assertion failed")}function _(e,t,r,n){var i=e[t],o=e[t+1],s=n+o>>>0,a=(s<n?1:0)+r+i;e[t]=a>>>0,e[t+1]=s}function w(e,t,r,n){var i=t+n>>>0,o=(i<t?1:0)+e+r;return o>>>0}function S(e,t,r,n){var i=t+n;return i>>>0}function k(e,t,r,n,i,o,s,a){var u=0,c=t;c=c+n>>>0,u+=c<t?1:0,c=c+o>>>0,u+=c<o?1:0,c=c+a>>>0,u+=c<a?1:0;var f=e+r+i+s+u;return f>>>0}function E(e,t,r,n,i,o,s,a){var u=t+n+o+a;return u>>>0}function A(e,t,r,n,i,o,s,a,u,c){var f=0,l=t;l=l+n>>>0,f+=l<t?1:0,l=l+o>>>0,f+=l<o?1:0,l=l+a>>>0,f+=l<a?1:0,l=l+c>>>0,f+=l<c?1:0;var h=e+r+i+s+u+f;return h>>>0}function x(e,t,r,n,i,o,s,a,u,c){var f=t+n+o+a+c;return f>>>0}function I(e,t,r){var n=t<<32-r|e>>>r;return n>>>0}function T(e,t,r){var n=e<<32-r|t>>>r;return n>>>0}function B(e,t,r){return e>>>r}function C(e,t,r){var n=e<<32-r|t>>>r;return n>>>0}n.toArray=o,n.toHex=s,n.htonl=a,n.toHex32=u,n.zero2=c,n.zero8=f,n.join32=l,n.split32=h,n.rotr32=p,n.rotl32=d,n.sum32=y,n.sum32_3=g,n.sum32_4=m,n.sum32_5=b,n.assert=v,n.inherits=i,t.sum64=_,t.sum64_hi=w,t.sum64_lo=S,t.sum64_4_hi=k,t.sum64_4_lo=E,t.sum64_5_hi=A,t.sum64_5_lo=x,t.rotr64_hi=I,t.rotr64_lo=T,t.shr64_hi=B,t.shr64_lo=C},function(e,t,r){var n=r(112),i=n.utils,o=i.assert;function s(){this.pending=null,this.pendingTotal=0,this.blockSize=this.constructor.blockSize,this.outSize=this.constructor.outSize,this.hmacStrength=this.constructor.hmacStrength,this.padLength=this.constructor.padLength/8,this.endian="big",this._delta8=this.blockSize/8,this._delta32=this.blockSize/32}t.BlockHash=s,s.prototype.update=function e(t,r){if(t=i.toArray(t,r),this.pending?this.pending=this.pending.concat(t):this.pending=t,this.pendingTotal+=t.length,this.pending.length>=this._delta8){t=this.pending;var n=t.length%this._delta8;this.pending=t.slice(t.length-n,t.length),0===this.pending.length&&(this.pending=null),t=i.join32(t,0,t.length-n,this.endian);for(var o=0;o<t.length;o+=this._delta32)this._update(t,o,o+this._delta32)}return this},s.prototype.digest=function e(t){return this.update(this._pad()),o(null===this.pending),this._digest(t)},s.prototype._pad=function e(){var t=this.pendingTotal,r=this._delta8,n=r-(t+this.padLength)%r,i=new Array(n+this.padLength);i[0]=128;for(var o=1;o<n;o++)i[o]=0;if(t<<=3,"big"===this.endian){for(var s=8;s<this.padLength;s++)i[o++]=0;i[o++]=0,i[o++]=0,i[o++]=0,i[o++]=0,i[o++]=t>>>24&255,i[o++]=t>>>16&255,i[o++]=t>>>8&255,i[o++]=255&t}else{i[o++]=255&t,i[o++]=t>>>8&255,i[o++]=t>>>16&255,i[o++]=t>>>24&255,i[o++]=0,i[o++]=0,i[o++]=0,i[o++]=0;for(var s=8;s<this.padLength;s++)i[o++]=0}return i}},function(e,t,r){var n=r(112),i=n.utils,o=i.assert,s=i.rotr32,a=i.rotl32,u=i.sum32,c=i.sum32_4,f=i.sum32_5,l=i.rotr64_hi,h=i.rotr64_lo,p=i.shr64_hi,d=i.shr64_lo,y=i.sum64,g=i.sum64_hi,m=i.sum64_lo,b=i.sum64_4_hi,v=i.sum64_4_lo,_=i.sum64_5_hi,w=i.sum64_5_lo,S=n.common.BlockHash,k=[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],E=[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],A=[1518500249,1859775393,2400959708,3395469782];function x(){if(!(this instanceof x))return new x;S.call(this),this.h=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],this.k=k,this.W=new Array(64)}function I(){if(!(this instanceof I))return new I;x.call(this),this.h=[3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428]}function T(){if(!(this instanceof T))return new T;S.call(this),this.h=[1779033703,4089235720,3144134277,2227873595,1013904242,4271175723,2773480762,1595750129,1359893119,2917565137,2600822924,725511199,528734635,4215389547,1541459225,327033209],this.k=E,this.W=new Array(160)}function B(){if(!(this instanceof B))return new B;T.call(this),this.h=[3418070365,3238371032,1654270250,914150663,2438529370,812702999,355462360,4144912697,1731405415,4290775857,2394180231,1750603025,3675008525,1694076839,1203062813,3204075428]}function C(){if(!(this instanceof C))return new C;S.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.W=new Array(80)}function P(e,t,r){return e&t^~e&r}function O(e,t,r){return e&t^e&r^t&r}function R(e,t,r){return e^t^r}function N(e){return s(e,2)^s(e,13)^s(e,22)}function L(e){return s(e,6)^s(e,11)^s(e,25)}function j(e){return s(e,7)^s(e,18)^e>>>3}function M(e){return s(e,17)^s(e,19)^e>>>10}function K(e,t,r,n){return 0===e?P(t,r,n):1===e||3===e?R(t,r,n):2===e?O(t,r,n):void 0}function D(e,t,r,n,i,o){var s=e&r^~e&i;return s<0&&(s+=4294967296),s}function U(e,t,r,n,i,o){var s=t&n^~t&o;return s<0&&(s+=4294967296),s}function F(e,t,r,n,i,o){var s=e&r^e&i^r&i;return s<0&&(s+=4294967296),s}function q(e,t,r,n,i,o){var s=t&n^t&o^n&o;return s<0&&(s+=4294967296),s}function H(e,t){var r=l(e,t,28),n=l(t,e,2),i=l(t,e,7),o=r^n^i;return o<0&&(o+=4294967296),o}function z(e,t){var r=h(e,t,28),n=h(t,e,2),i=h(t,e,7),o=r^n^i;return o<0&&(o+=4294967296),o}function V(e,t){var r=l(e,t,14),n=l(e,t,18),i=l(t,e,9),o=r^n^i;return o<0&&(o+=4294967296),o}function G(e,t){var r=h(e,t,14),n=h(e,t,18),i=h(t,e,9),o=r^n^i;return o<0&&(o+=4294967296),o}function W(e,t){var r=l(e,t,1),n=l(e,t,8),i=p(e,t,7),o=r^n^i;return o<0&&(o+=4294967296),o}function $(e,t){var r=h(e,t,1),n=h(e,t,8),i=d(e,t,7),o=r^n^i;return o<0&&(o+=4294967296),o}function Y(e,t){var r=l(e,t,19),n=l(t,e,29),i=p(e,t,6),o=r^n^i;return o<0&&(o+=4294967296),o}function J(e,t){var r=h(e,t,19),n=h(t,e,29),i=d(e,t,6),o=r^n^i;return o<0&&(o+=4294967296),o}i.inherits(x,S),t.sha256=x,x.blockSize=512,x.outSize=256,x.hmacStrength=192,x.padLength=64,x.prototype._update=function e(t,r){for(var n=this.W,i=0;i<16;i++)n[i]=t[r+i];for(;i<n.length;i++)n[i]=c(M(n[i-2]),n[i-7],j(n[i-15]),n[i-16]);var s=this.h[0],a=this.h[1],l=this.h[2],h=this.h[3],p=this.h[4],d=this.h[5],y=this.h[6],g=this.h[7];o(this.k.length===n.length);for(var i=0;i<n.length;i++){var m=f(g,L(p),P(p,d,y),this.k[i],n[i]),b=u(N(s),O(s,a,l));g=y,y=d,d=p,p=u(h,m),h=l,l=a,a=s,s=u(m,b)}this.h[0]=u(this.h[0],s),this.h[1]=u(this.h[1],a),this.h[2]=u(this.h[2],l),this.h[3]=u(this.h[3],h),this.h[4]=u(this.h[4],p),this.h[5]=u(this.h[5],d),this.h[6]=u(this.h[6],y),this.h[7]=u(this.h[7],g)},x.prototype._digest=function e(t){return"hex"===t?i.toHex32(this.h,"big"):i.split32(this.h,"big")},i.inherits(I,x),t.sha224=I,I.blockSize=512,I.outSize=224,I.hmacStrength=192,I.padLength=64,I.prototype._digest=function e(t){return"hex"===t?i.toHex32(this.h.slice(0,7),"big"):i.split32(this.h.slice(0,7),"big")},i.inherits(T,S),t.sha512=T,T.blockSize=1024,T.outSize=512,T.hmacStrength=192,T.padLength=128,T.prototype._prepareBlock=function e(t,r){for(var n=this.W,i=0;i<32;i++)n[i]=t[r+i];for(;i<n.length;i+=2){var o=Y(n[i-4],n[i-3]),s=J(n[i-4],n[i-3]),a=n[i-14],u=n[i-13],c=W(n[i-30],n[i-29]),f=$(n[i-30],n[i-29]),l=n[i-32],h=n[i-31];n[i]=b(o,s,a,u,c,f,l,h),n[i+1]=v(o,s,a,u,c,f,l,h)}},T.prototype._update=function e(t,r){this._prepareBlock(t,r);var n=this.W,i=this.h[0],s=this.h[1],a=this.h[2],u=this.h[3],c=this.h[4],f=this.h[5],l=this.h[6],h=this.h[7],p=this.h[8],d=this.h[9],b=this.h[10],v=this.h[11],S=this.h[12],k=this.h[13],E=this.h[14],A=this.h[15];o(this.k.length===n.length);for(var x=0;x<n.length;x+=2){var I=E,T=A,B=V(p,d),C=G(p,d),P=D(p,d,b,v,S,k),O=U(p,d,b,v,S,k),R=this.k[x],N=this.k[x+1],L=n[x],j=n[x+1],M=_(I,T,B,C,P,O,R,N,L,j),K=w(I,T,B,C,P,O,R,N,L,j),I=H(i,s),T=z(i,s),B=F(i,s,a,u,c,f),C=q(i,s,a,u,c,f),W=g(I,T,B,C),$=m(I,T,B,C);E=S,A=k,S=b,k=v,b=p,v=d,p=g(l,h,M,K),d=m(h,h,M,K),l=c,h=f,c=a,f=u,a=i,u=s,i=g(M,K,W,$),s=m(M,K,W,$)}y(this.h,0,i,s),y(this.h,2,a,u),y(this.h,4,c,f),y(this.h,6,l,h),y(this.h,8,p,d),y(this.h,10,b,v),y(this.h,12,S,k),y(this.h,14,E,A)},T.prototype._digest=function e(t){return"hex"===t?i.toHex32(this.h,"big"):i.split32(this.h,"big")},i.inherits(B,T),t.sha384=B,B.blockSize=1024,B.outSize=384,B.hmacStrength=192,B.padLength=128,B.prototype._digest=function e(t){return"hex"===t?i.toHex32(this.h.slice(0,12),"big"):i.split32(this.h.slice(0,12),"big")},i.inherits(C,S),t.sha1=C,C.blockSize=512,C.outSize=160,C.hmacStrength=80,C.padLength=64,C.prototype._update=function e(t,r){for(var n=this.W,i=0;i<16;i++)n[i]=t[r+i];for(;i<n.length;i++)n[i]=a(n[i-3]^n[i-8]^n[i-14]^n[i-16],1);for(var o=this.h[0],s=this.h[1],c=this.h[2],l=this.h[3],h=this.h[4],i=0;i<n.length;i++){var p=~~(i/20),d=f(a(o,5),K(p,s,c,l),h,n[i],A[p]);h=l,l=c,c=a(s,30),s=o,o=d}this.h[0]=u(this.h[0],o),this.h[1]=u(this.h[1],s),this.h[2]=u(this.h[2],c),this.h[3]=u(this.h[3],l),this.h[4]=u(this.h[4],h)},C.prototype._digest=function e(t){return"hex"===t?i.toHex32(this.h,"big"):i.split32(this.h,"big")}},function(e,t,r){var n=r(112),i=n.utils,o=i.rotl32,s=i.sum32,a=i.sum32_3,u=i.sum32_4,c=n.common.BlockHash;function f(){if(!(this instanceof f))return new f;c.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.endian="little"}function l(e,t,r,n){return e<=15?t^r^n:e<=31?t&r|~t&n:e<=47?(t|~r)^n:e<=63?t&n|r&~n:t^(r|~n)}function h(e){return e<=15?0:e<=31?1518500249:e<=47?1859775393:e<=63?2400959708:2840853838}function p(e){return e<=15?1352829926:e<=31?1548603684:e<=47?1836072691:e<=63?2053994217:0}i.inherits(f,c),t.ripemd160=f,f.blockSize=512,f.outSize=160,f.hmacStrength=192,f.padLength=64,f.prototype._update=function e(t,r){for(var n=this.h[0],i=this.h[1],c=this.h[2],f=this.h[3],b=this.h[4],v=n,_=i,w=c,S=f,k=b,E=0;E<80;E++){var A=s(o(u(n,l(E,i,c,f),t[d[E]+r],h(E)),g[E]),b);n=b,b=f,f=o(c,10),c=i,i=A,A=s(o(u(v,l(79-E,_,w,S),t[y[E]+r],p(E)),m[E]),k),v=k,k=S,S=o(w,10),w=_,_=A}A=a(this.h[1],c,S),this.h[1]=a(this.h[2],f,k),this.h[2]=a(this.h[3],b,v),this.h[3]=a(this.h[4],n,_),this.h[4]=a(this.h[0],i,w),this.h[0]=A},f.prototype._digest=function e(t){return"hex"===t?i.toHex32(this.h,"little"):i.split32(this.h,"little")};var d=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13],y=[5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11],g=[11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6],m=[8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11]},function(e,t,r){var n=t,i=r(112),o=i.utils,s=o.assert;function a(e,t,r){if(!(this instanceof a))return new a(e,t,r);this.Hash=e,this.blockSize=e.blockSize/8,this.outSize=e.outSize/8,this.inner=null,this.outer=null,this._init(o.toArray(t,r))}e.exports=a,a.prototype._init=function e(t){t.length>this.blockSize&&(t=(new this.Hash).update(t).digest()),s(t.length<=this.blockSize);for(var r=t.length;r<this.blockSize;r++)t.push(0);for(var r=0;r<t.length;r++)t[r]^=54;this.inner=(new this.Hash).update(t);for(var r=0;r<t.length;r++)t[r]^=106;this.outer=(new this.Hash).update(t)},a.prototype.update=function e(t,r){return this.inner.update(t,r),this},a.prototype.digest=function e(t){return this.outer.update(this.inner.digest()),this.outer.digest(t)}},function(e,t,r){"use strict";var n=r(75),i=r(66),o=i.utils.getNAF,s=i.utils.getJSF,a=i.utils.assert;function u(e,t){this.type=e,this.p=new n(t.p,16),this.red=t.prime?n.red(t.prime):n.mont(this.p),this.zero=new n(0).toRed(this.red),this.one=new n(1).toRed(this.red),this.two=new n(2).toRed(this.red),this.n=t.n&&new n(t.n,16),this.g=t.g&&this.pointFromJSON(t.g,t.gRed),this._wnafT1=new Array(4),this._wnafT2=new Array(4),this._wnafT3=new Array(4),this._wnafT4=new Array(4)}function c(e,t){this.curve=e,this.type=t,this.precomputed=null}e.exports=u,u.prototype.point=function e(){throw new Error("Not implemented")},u.prototype.validate=function e(){throw new Error("Not implemented")},u.prototype._fixedNafMul=function e(t,r){var n=t._getDoubles(),i=o(r,1),s=(1<<n.step+1)-(n.step%2==0?2:1);s/=3;for(var a=[],u=0;u<i.length;u+=n.step){for(var c=0,r=u+n.step-1;r>=u;r--)c=(c<<1)+i[r];a.push(c)}for(var f=this.jpoint(null,null,null),l=this.jpoint(null,null,null),h=s;h>0;h--){for(var u=0;u<a.length;u++){var c=a[u];c===h?l=l.mixedAdd(n.points[u]):c===-h&&(l=l.mixedAdd(n.points[u].neg()))}f=f.add(l)}return f.toP()},u.prototype._wnafMul=function e(t,r){var n=4,i=t._getNAFPoints(n);n=i.wnd;for(var s=i.points,u=o(r,n),c=this.jpoint(null,null,null),f=u.length-1;f>=0;f--){for(var r=0;f>=0&&0===u[f];f--)r++;if(f>=0&&r++,c=c.dblp(r),f<0)break;var l=u[f];a(0!==l),c="affine"===t.type?l>0?c.mixedAdd(s[l-1>>1]):c.mixedAdd(s[-l-1>>1].neg()):l>0?c.add(s[l-1>>1]):c.add(s[-l-1>>1].neg())}return"affine"===t.type?c.toP():c},u.prototype._wnafMulAdd=function e(t,r,n,i){for(var a=this._wnafT1,u=this._wnafT2,c=this._wnafT3,f=0,l=0;l<i;l++){var h=r[l],p=h._getNAFPoints(t);a[l]=p.wnd,u[l]=p.points}for(var l=i-1;l>=1;l-=2){var d=l-1,y=l;if(1===a[d]&&1===a[y]){var g=[r[d],null,null,r[y]];0===r[d].y.cmp(r[y].y)?(g[1]=r[d].add(r[y]),g[2]=r[d].toJ().mixedAdd(r[y].neg())):0===r[d].y.cmp(r[y].y.redNeg())?(g[1]=r[d].toJ().mixedAdd(r[y]),g[2]=r[d].add(r[y].neg())):(g[1]=r[d].toJ().mixedAdd(r[y]),g[2]=r[d].toJ().mixedAdd(r[y].neg()));var m=[-3,-1,-5,-7,0,7,5,1,3],b=s(n[d],n[y]);f=Math.max(b[0].length,f),c[d]=new Array(f),c[y]=new Array(f);for(var v=0;v<f;v++){var _=0|b[0][v],w=0|b[1][v];c[d][v]=m[3*(_+1)+(w+1)],c[y][v]=0,u[d]=g}}else c[d]=o(n[d],a[d]),c[y]=o(n[y],a[y]),f=Math.max(c[d].length,f),f=Math.max(c[y].length,f)}for(var S=this.jpoint(null,null,null),k=this._wnafT4,l=f;l>=0;l--){for(var E=0;l>=0;){for(var A=!0,v=0;v<i;v++)k[v]=0|c[v][l],0!==k[v]&&(A=!1);if(!A)break;E++,l--}if(l>=0&&E++,S=S.dblp(E),l<0)break;for(var v=0;v<i;v++){var x=k[v],h;0!==x&&(x>0?h=u[v][x-1>>1]:x<0&&(h=u[v][-x-1>>1].neg()),S="affine"===h.type?S.mixedAdd(h):S.add(h))}}for(var l=0;l<i;l++)u[l]=null;return S.toP()},u.BasePoint=c,c.prototype.validate=function e(){return this.curve.validate(this)},c.prototype.precompute=function e(t){if(this.precomputed)return this;var r={doubles:null,naf:null,beta:null};return r.naf=this._getNAFPoints(8),r.doubles=this._getDoubles(4,t),r.beta=this._getBeta(),this.precomputed=r,this},c.prototype._getDoubles=function e(t,r){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var n=[this],i=this,o=0;o<r;o+=t){for(var s=0;s<t;s++)i=i.dbl();n.push(i)}return{step:t,points:n}},c.prototype._getNAFPoints=function e(t){if(this.precomputed&&this.precomputed.naf)return this.precomputed.naf;for(var r=[this],n=(1<<t)-1,i=1===n?null:this.dbl(),o=1;o<n;o++)r[o]=r[o-1].add(i);return{wnd:t,points:r}},c.prototype._getBeta=function e(){return null},c.prototype.dblp=function e(t){for(var r=this,n=0;n<t;n++)r=r.dbl();return r}},function(e,t,r){"use strict";var n=r(175),i=r(66),o=r(75),s=r(76),a=n.base,u=i.utils.assert;function c(e){a.call(this,"short",e),this.a=new o(e.a,16).toRed(this.red),this.b=new o(e.b,16).toRed(this.red),this.tinv=this.two.redInvm(),this.zeroA=0===this.a.fromRed().cmpn(0),this.threeA=0===this.a.fromRed().sub(this.p).cmpn(-3),this.endo=this._getEndomorphism(e),this._endoWnafT1=new Array(4),this._endoWnafT2=new Array(4)}function f(e,t,r,n){a.BasePoint.call(this,e,"affine"),null===t&&null===r?(this.x=null,this.y=null,this.inf=!0):(this.x=new o(t,16),this.y=new o(r,16),n&&(this.x.forceRed(this.curve.red),this.y.forceRed(this.curve.red)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.inf=!1)}function l(e,t,r,n){a.BasePoint.call(this,e,"jacobian"),null===t&&null===r&&null===n?(this.x=this.curve.one,this.y=this.curve.one,this.z=new o(0)):(this.x=new o(t,16),this.y=new o(r,16),this.z=new o(n,16)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.zOne=this.z===this.curve.one}s(c,a),e.exports=c,c.prototype._getEndomorphism=function e(t){if(this.zeroA&&this.g&&this.n&&1===this.p.modn(3)){var r,n,i;if(t.beta)r=new o(t.beta,16).toRed(this.red);else{var s=this._getEndoRoots(this.p);r=s[0].cmp(s[1])<0?s[0]:s[1],r=r.toRed(this.red)}if(t.lambda)n=new o(t.lambda,16);else{var a=this._getEndoRoots(this.n);0===this.g.mul(a[0]).x.cmp(this.g.x.redMul(r))?n=a[0]:(n=a[1],u(0===this.g.mul(n).x.cmp(this.g.x.redMul(r))))}return i=t.basis?t.basis.map(function(e){return{a:new o(e.a,16),b:new o(e.b,16)}}):this._getEndoBasis(n),{beta:r,lambda:n,basis:i}}},c.prototype._getEndoRoots=function e(t){var r=t===this.p?this.red:o.mont(t),n=new o(2).toRed(r).redInvm(),i=n.redNeg(),s=new o(3).toRed(r).redNeg().redSqrt().redMul(n),a=i.redAdd(s).fromRed(),u=i.redSub(s).fromRed();return[a,u]},c.prototype._getEndoBasis=function e(t){for(var r=this.n.shrn(Math.floor(this.n.bitLength()/2)),n=t,i=this.n.clone(),s=new o(1),a=new o(0),u=new o(0),c=new o(1),f,l,h,p,d,y,g,m=0,b,v;0!==n.cmpn(0);){var _=i.div(n);b=i.sub(_.mul(n)),v=u.sub(_.mul(s));var w=c.sub(_.mul(a));if(!h&&b.cmp(r)<0)f=g.neg(),l=s,h=b.neg(),p=v;else if(h&&2==++m)break;g=b,i=n,n=b,u=s,s=v,c=a,a=w}d=b.neg(),y=v;var S=h.sqr().add(p.sqr()),k=d.sqr().add(y.sqr());return k.cmp(S)>=0&&(d=f,y=l),h.sign&&(h=h.neg(),p=p.neg()),d.sign&&(d=d.neg(),y=y.neg()),[{a:h,b:p},{a:d,b:y}]},c.prototype._endoSplit=function e(t){var r=this.endo.basis,n=r[0],i=r[1],o=i.b.mul(t).divRound(this.n),s=n.b.neg().mul(t).divRound(this.n),a=o.mul(n.a),u=s.mul(i.a),c=o.mul(n.b),f=s.mul(i.b),l=t.sub(a).sub(u),h=c.add(f).neg();return{k1:l,k2:h}},c.prototype.pointFromX=function e(t,r){r=new o(r,16),r.red||(r=r.toRed(this.red));var n=r.redSqr().redMul(r).redIAdd(r.redMul(this.a)).redIAdd(this.b),i=n.redSqrt(),s=i.fromRed().isOdd();return(t&&!s||!t&&s)&&(i=i.redNeg()),this.point(r,i)},c.prototype.validate=function e(t){if(t.inf)return!0;var r=t.x,n=t.y,i=this.a.redMul(r),o=r.redSqr().redMul(r).redIAdd(i).redIAdd(this.b);return 0===n.redSqr().redISub(o).cmpn(0)},c.prototype._endoWnafMulAdd=function e(t,r){for(var n=this._endoWnafT1,i=this._endoWnafT2,o=0;o<t.length;o++){var s=this._endoSplit(r[o]),a=t[o],u=a._getBeta();s.k1.sign&&(s.k1.sign=!s.k1.sign,a=a.neg(!0)),s.k2.sign&&(s.k2.sign=!s.k2.sign,u=u.neg(!0)),n[2*o]=a,n[2*o+1]=u,i[2*o]=s.k1,i[2*o+1]=s.k2}for(var c=this._wnafMulAdd(1,n,i,2*o),f=0;f<2*o;f++)n[f]=null,i[f]=null;return c},s(f,a.BasePoint),c.prototype.point=function e(t,r,n){return new f(this,t,r,n)},c.prototype.pointFromJSON=function e(t,r){return f.fromJSON(this,t,r)},f.prototype._getBeta=function e(){if(this.curve.endo){var t=this.precomputed;if(t&&t.beta)return t.beta;var r=this.curve.point(this.x.redMul(this.curve.endo.beta),this.y);if(t){var n=this.curve,i=function(e){return n.point(e.x.redMul(n.endo.beta),e.y)};t.beta=r,r.precomputed={beta:null,naf:t.naf&&{wnd:t.naf.wnd,points:t.naf.points.map(i)},doubles:t.doubles&&{step:t.doubles.step,points:t.doubles.points.map(i)}}}return r}},f.prototype.toJSON=function e(){return this.precomputed?[this.x,this.y,this.precomputed&&{doubles:this.precomputed.doubles&&{step:this.precomputed.doubles.step,points:this.precomputed.doubles.points.slice(1)},naf:this.precomputed.naf&&{wnd:this.precomputed.naf.wnd,points:this.precomputed.naf.points.slice(1)}}]:[this.x,this.y]},f.fromJSON=function e(t,r,n){"string"==typeof r&&(r=JSON.parse(r));var i=t.point(r[0],r[1],n);if(!r[2])return i;function o(e){return t.point(e[0],e[1],n)}var s=r[2];return i.precomputed={beta:null,doubles:s.doubles&&{step:s.doubles.step,points:[i].concat(s.doubles.points.map(o))},naf:s.naf&&{wnd:s.naf.wnd,points:[i].concat(s.naf.points.map(o))}},i},f.prototype.inspect=function e(){return this.isInfinity()?"<EC Point Infinity>":"<EC Point x: "+this.x.fromRed().toString(16,2)+" y: "+this.y.fromRed().toString(16,2)+">"},f.prototype.isInfinity=function e(){return this.inf},f.prototype.add=function e(t){if(this.inf)return t;if(t.inf)return this;if(this.eq(t))return this.dbl();if(this.neg().eq(t))return this.curve.point(null,null);if(0===this.x.cmp(t.x))return this.curve.point(null,null);var r=this.y.redSub(t.y);0!==r.cmpn(0)&&(r=r.redMul(this.x.redSub(t.x).redInvm()));var n=r.redSqr().redISub(this.x).redISub(t.x),i=r.redMul(this.x.redSub(n)).redISub(this.y);return this.curve.point(n,i)},f.prototype.dbl=function e(){if(this.inf)return this;var t=this.y.redAdd(this.y);if(0===t.cmpn(0))return this.curve.point(null,null);var r=this.curve.a,n=this.x.redSqr(),i=t.redInvm(),o=n.redAdd(n).redIAdd(n).redIAdd(r).redMul(i),s=o.redSqr().redISub(this.x.redAdd(this.x)),a=o.redMul(this.x.redSub(s)).redISub(this.y);return this.curve.point(s,a)},f.prototype.getX=function e(){return this.x.fromRed()},f.prototype.getY=function e(){return this.y.fromRed()},f.prototype.mul=function e(t){return t=new o(t,16),this.precomputed&&this.precomputed.doubles?this.curve._fixedNafMul(this,t):this.curve.endo?this.curve._endoWnafMulAdd([this],[t]):this.curve._wnafMul(this,t)},f.prototype.mulAdd=function e(t,r,n){var i=[this,r],o=[t,n];return this.curve.endo?this.curve._endoWnafMulAdd(i,o):this.curve._wnafMulAdd(1,i,o,2)},f.prototype.eq=function e(t){return this===t||this.inf===t.inf&&(this.inf||0===this.x.cmp(t.x)&&0===this.y.cmp(t.y))},f.prototype.neg=function e(t){if(this.inf)return this;var r=this.curve.point(this.x,this.y.redNeg());if(t&&this.precomputed){var n=this.precomputed,i=function(e){return e.neg()};r.precomputed={naf:n.naf&&{wnd:n.naf.wnd,points:n.naf.points.map(i)},doubles:n.doubles&&{step:n.doubles.step,points:n.doubles.points.map(i)}}}return r},f.prototype.toJ=function e(){if(this.inf)return this.curve.jpoint(null,null,null);var t=this.curve.jpoint(this.x,this.y,this.curve.one);return t},s(l,a.BasePoint),c.prototype.jpoint=function e(t,r,n){return new l(this,t,r,n)},l.prototype.toP=function e(){if(this.isInfinity())return this.curve.point(null,null);var t=this.z.redInvm(),r=t.redSqr(),n=this.x.redMul(r),i=this.y.redMul(r).redMul(t);return this.curve.point(n,i)},l.prototype.neg=function e(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},l.prototype.add=function e(t){if(this.isInfinity())return t;if(t.isInfinity())return this;var r=t.z.redSqr(),n=this.z.redSqr(),i=this.x.redMul(r),o=t.x.redMul(n),s=this.y.redMul(r.redMul(t.z)),a=t.y.redMul(n.redMul(this.z)),u=i.redSub(o),c=s.redSub(a);if(0===u.cmpn(0))return 0!==c.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var f=u.redSqr(),l=f.redMul(u),h=i.redMul(f),p=c.redSqr().redIAdd(l).redISub(h).redISub(h),d=c.redMul(h.redISub(p)).redISub(s.redMul(l)),y=this.z.redMul(t.z).redMul(u);return this.curve.jpoint(p,d,y)},l.prototype.mixedAdd=function e(t){if(this.isInfinity())return t.toJ();if(t.isInfinity())return this;var r=this.z.redSqr(),n=this.x,i=t.x.redMul(r),o=this.y,s=t.y.redMul(r).redMul(this.z),a=n.redSub(i),u=o.redSub(s);if(0===a.cmpn(0))return 0!==u.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var c=a.redSqr(),f=c.redMul(a),l=n.redMul(c),h=u.redSqr().redIAdd(f).redISub(l).redISub(l),p=u.redMul(l.redISub(h)).redISub(o.redMul(f)),d=this.z.redMul(a);return this.curve.jpoint(h,p,d)},l.prototype.dblp=function e(t){if(0===t)return this;if(this.isInfinity())return this;if(!t)return this.dbl();if(this.curve.zeroA||this.curve.threeA){for(var r=this,n=0;n<t;n++)r=r.dbl();return r}for(var i=this.curve.a,o=this.curve.tinv,s=this.x,a=this.y,u=this.z,c=u.redSqr().redSqr(),f=a.redAdd(a),n=0;n<t;n++){var l=s.redSqr(),h=f.redSqr(),p=h.redSqr(),d=l.redAdd(l).redIAdd(l).redIAdd(i.redMul(c)),y=s.redMul(h),g=d.redSqr().redISub(y.redAdd(y)),m=y.redISub(g),b=d.redMul(m);b=b.redIAdd(b).redISub(p);var v=f.redMul(u);n+1<t&&(c=c.redMul(p)),s=g,u=v,f=b}return this.curve.jpoint(s,f.redMul(o),u)},l.prototype.dbl=function e(){return this.isInfinity()?this:this.curve.zeroA?this._zeroDbl():this.curve.threeA?this._threeDbl():this._dbl()},l.prototype._zeroDbl=function e(){var t,r,n;if(this.zOne){var i=this.x.redSqr(),o=this.y.redSqr(),s=o.redSqr(),a=this.x.redAdd(o).redSqr().redISub(i).redISub(s);a=a.redIAdd(a);var u=i.redAdd(i).redIAdd(i),c=u.redSqr().redISub(a).redISub(a),f=s.redIAdd(s);f=f.redIAdd(f),f=f.redIAdd(f),t=c,r=u.redMul(a.redISub(c)).redISub(f),n=this.y.redAdd(this.y)}else{var l=this.x.redSqr(),h=this.y.redSqr(),p=h.redSqr(),d=this.x.redAdd(h).redSqr().redISub(l).redISub(p);d=d.redIAdd(d);var y=l.redAdd(l).redIAdd(l),g=y.redSqr(),m=p.redIAdd(p);m=m.redIAdd(m),m=m.redIAdd(m),t=g.redISub(d).redISub(d),r=y.redMul(d.redISub(t)).redISub(m),n=this.y.redMul(this.z),n=n.redIAdd(n)}return this.curve.jpoint(t,r,n)},l.prototype._threeDbl=function e(){var t,r,n;if(this.zOne){var i=this.x.redSqr(),o=this.y.redSqr(),s=o.redSqr(),a=this.x.redAdd(o).redSqr().redISub(i).redISub(s);a=a.redIAdd(a);var u=i.redAdd(i).redIAdd(i).redIAdd(this.curve.a),c=u.redSqr().redISub(a).redISub(a);t=c;var f=s.redIAdd(s);f=f.redIAdd(f),f=f.redIAdd(f),r=u.redMul(a.redISub(c)).redISub(f),n=this.y.redAdd(this.y)}else{var l=this.z.redSqr(),h=this.y.redSqr(),p=this.x.redMul(h),d=this.x.redSub(l).redMul(this.x.redAdd(l));d=d.redAdd(d).redIAdd(d);var y=p.redIAdd(p);y=y.redIAdd(y);var g=y.redAdd(y);t=d.redSqr().redISub(g),n=this.y.redAdd(this.z).redSqr().redISub(h).redISub(l);var m=h.redSqr();m=m.redIAdd(m),m=m.redIAdd(m),m=m.redIAdd(m),r=d.redMul(y.redISub(t)).redISub(m)}return this.curve.jpoint(t,r,n)},l.prototype._dbl=function e(){var t=this.curve.a,r=this.x,n=this.y,i=this.z,o=i.redSqr().redSqr(),s=r.redSqr(),a=n.redSqr(),u=s.redAdd(s).redIAdd(s).redIAdd(t.redMul(o)),c=r.redAdd(r);c=c.redIAdd(c);var f=c.redMul(a),l=u.redSqr().redISub(f.redAdd(f)),h=f.redISub(l),p=a.redSqr();p=p.redIAdd(p),p=p.redIAdd(p),p=p.redIAdd(p);var d=u.redMul(h).redISub(p),y=n.redAdd(n).redMul(i);return this.curve.jpoint(l,d,y)},l.prototype.trpl=function e(){if(!this.curve.zeroA)return this.dbl().add(this);var t=this.x.redSqr(),r=this.y.redSqr(),n=this.z.redSqr(),i=r.redSqr(),o=t.redAdd(t).redIAdd(t),s=o.redSqr(),a=this.x.redAdd(r).redSqr().redISub(t).redISub(i);a=a.redIAdd(a),a=a.redAdd(a).redIAdd(a),a=a.redISub(s);var u=a.redSqr(),c=i.redIAdd(i);c=c.redIAdd(c),c=c.redIAdd(c),c=c.redIAdd(c);var f=o.redIAdd(a).redSqr().redISub(s).redISub(u).redISub(c),l=r.redMul(f);l=l.redIAdd(l),l=l.redIAdd(l);var h=this.x.redMul(u).redISub(l);h=h.redIAdd(h),h=h.redIAdd(h);var p=this.y.redMul(f.redMul(c.redISub(f)).redISub(a.redMul(u)));p=p.redIAdd(p),p=p.redIAdd(p),p=p.redIAdd(p);var d=this.z.redAdd(a).redSqr().redISub(n).redISub(u);return this.curve.jpoint(h,p,d)},l.prototype.mul=function e(t,r){return t=new o(t,r),this.curve._wnafMul(this,t)},l.prototype.eq=function e(t){if("affine"===t.type)return this.eq(t.toJ());if(this===t)return!0;var r=this.z.redSqr(),n=t.z.redSqr();if(0!==this.x.redMul(n).redISub(t.x.redMul(r)).cmpn(0))return!1;var i=r.redMul(this.z),o=n.redMul(t.z);return 0===this.y.redMul(o).redISub(t.y.redMul(i)).cmpn(0)},l.prototype.inspect=function e(){return this.isInfinity()?"<EC JPoint Infinity>":"<EC JPoint x: "+this.x.toString(16,2)+" y: "+this.y.toString(16,2)+" z: "+this.z.toString(16,2)+">"},l.prototype.isInfinity=function e(){return 0===this.z.cmpn(0)}},function(e,t,r){"use strict";var n=r(175),i=r(75),o=r(76),s=n.base;function a(e){s.call(this,"mont",e),this.a=new i(e.a,16).toRed(this.red),this.b=new i(e.b,16).toRed(this.red),this.i4=new i(4).toRed(this.red).redInvm(),this.two=new i(2).toRed(this.red),this.a24=this.i4.redMul(this.a.redAdd(this.two))}function u(e,t,r){s.BasePoint.call(this,e,"projective"),null===t&&null===r?(this.x=this.curve.one,this.z=this.curve.zero):(this.x=new i(t,16),this.z=new i(r,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)))}o(a,s),e.exports=a,a.prototype.validate=function e(t){var r=t.normalize().x,n=r.redSqr(),i=n.redMul(r).redAdd(n.redMul(this.a)).redAdd(r),o=i.redSqrt();return 0===o.redSqr().cmp(i)},o(u,s.BasePoint),a.prototype.point=function e(t,r){return new u(this,t,r)},a.prototype.pointFromJSON=function e(t){return u.fromJSON(this,t)},u.prototype.precompute=function e(){},u.fromJSON=function e(t,r){return new u(t,r[0],r[1]||t.one)},u.prototype.inspect=function e(){return this.isInfinity()?"<EC Point Infinity>":"<EC Point x: "+this.x.fromRed().toString(16,2)+" z: "+this.z.fromRed().toString(16,2)+">"},u.prototype.isInfinity=function e(){return 0===this.z.cmpn(0)},u.prototype.dbl=function e(){var t=this.x.redAdd(this.z),r=t.redSqr(),n=this.x.redSub(this.z),i=n.redSqr(),o=r.redSub(i),s=r.redMul(i),a=o.redMul(i.redAdd(this.curve.a24.redMul(o)));return this.curve.point(s,a)},u.prototype.add=function e(){throw new Error("Not supported on Montgomery curve")},u.prototype.diffAdd=function e(t,r){var n=this.x.redAdd(this.z),i=this.x.redSub(this.z),o=t.x.redAdd(t.z),s=t.x.redSub(t.z),a=s.redMul(n),u=o.redMul(i),c=r.z.redMul(a.redAdd(u).redSqr()),f=r.x.redMul(a.redISub(u).redSqr());return this.curve.point(c,f)},u.prototype.mul=function e(t){for(var r=t.clone(),n=this,i=this.curve.point(null,null),o=this,s=[];0!==r.cmpn(0);r.ishrn(1))s.push(r.andln(1));for(var a=s.length-1;a>=0;a--)0===s[a]?(n=n.diffAdd(i,o),i=i.dbl()):(i=n.diffAdd(i,o),n=n.dbl());return i},u.prototype.mulAdd=function e(){throw new Error("Not supported on Montgomery curve")},u.prototype.normalize=function e(){return this.x=this.x.redMul(this.z.redInvm()),this.z=this.curve.one,this},u.prototype.getX=function e(){return this.normalize(),this.x.fromRed()}},function(e,t,r){"use strict";var n=r(175),i=r(66),o=r(75),s=r(76),a=n.base,u=i.utils.assert;function c(e){this.twisted=1!=(0|e.a),this.mOneA=this.twisted&&-1==(0|e.a),this.extended=this.mOneA,a.call(this,"edwards",e),this.a=new o(e.a,16).mod(this.red.m).toRed(this.red),this.c=new o(e.c,16).toRed(this.red),this.c2=this.c.redSqr(),this.d=new o(e.d,16).toRed(this.red),this.dd=this.d.redAdd(this.d),u(!this.twisted||0===this.c.fromRed().cmpn(1)),this.oneC=1==(0|e.c)}function f(e,t,r,n,i){a.BasePoint.call(this,e,"projective"),null===t&&null===r&&null===n?(this.x=this.curve.zero,this.y=this.curve.one,this.z=this.curve.one,this.t=this.curve.zero,this.zOne=!0):(this.x=new o(t,16),this.y=new o(r,16),this.z=n?new o(n,16):this.curve.one,this.t=i&&new o(i,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.t&&!this.t.red&&(this.t=this.t.toRed(this.curve.red)),this.zOne=this.z===this.curve.one,this.curve.extended&&!this.t&&(this.t=this.x.redMul(this.y),this.zOne||(this.t=this.t.redMul(this.z.redInvm()))))}s(c,a),e.exports=c,c.prototype._mulA=function e(t){return this.mOneA?t.redNeg():this.a.redMul(t)},c.prototype._mulC=function e(t){return this.oneC?t:this.c.redMul(t)},c.prototype.jpoint=function e(t,r,n,i){return this.point(t,r,n,i)},c.prototype.pointFromX=function e(t,r){r=new o(r,16),r.red||(r=r.toRed(this.red));var i=r.redSqr(),s=this.c2.redSub(this.a.redMul(i)),a=this.one.redSub(this.c2.redMul(this.d).redMul(i)),u=s.redMul(a.redInvm()).redSqrt(),c=u.fromRed().isOdd();return(t&&!c||!t&&c)&&(u=u.redNeg()),this.point(r,u,n.one)},c.prototype.validate=function e(t){if(t.isInfinity())return!0;t.normalize();var r=t.x.redSqr(),n=t.y.redSqr(),i=r.redMul(this.a).redAdd(n),o=this.c2.redMul(this.one.redAdd(this.d.redMul(r).redMul(n)));return 0===i.cmp(o)},s(f,a.BasePoint),c.prototype.pointFromJSON=function e(t){return f.fromJSON(this,t)},c.prototype.point=function e(t,r,n,i){return new f(this,t,r,n,i)},f.fromJSON=function e(t,r){return new f(t,r[0],r[1],r[2])},f.prototype.inspect=function e(){return this.isInfinity()?"<EC Point Infinity>":"<EC Point x: "+this.x.fromRed().toString(16,2)+" y: "+this.y.fromRed().toString(16,2)+" z: "+this.z.fromRed().toString(16,2)+">"},f.prototype.isInfinity=function e(){return 0===this.x.cmpn(0)&&0===this.y.cmp(this.z)},f.prototype._extDbl=function e(){var t=this.x.redSqr(),r=this.y.redSqr(),n=this.z.redSqr();n=n.redIAdd(n);var i=this.curve._mulA(t),o=this.x.redAdd(this.y).redSqr().redISub(t).redISub(r),s=i.redAdd(r),a=s.redSub(n),u=i.redSub(r),c=o.redMul(a),f=s.redMul(u),l=o.redMul(u),h=a.redMul(s);return this.curve.point(c,f,h,l)},f.prototype._projDbl=function e(){var t=this.x.redAdd(this.y).redSqr(),r=this.x.redSqr(),n=this.y.redSqr(),i,o,s;if(this.curve.twisted){var a=this.curve._mulA(r),u=a.redAdd(n);if(this.zOne)i=t.redSub(r).redSub(n).redMul(u.redSub(this.curve.two)),o=u.redMul(a.redSub(n)),s=u.redSqr().redSub(u).redSub(u);else{var c=this.z.redSqr(),f=u.redSub(c).redISub(c);i=t.redSub(r).redISub(n).redMul(f),o=u.redMul(a.redSub(n)),s=u.redMul(f)}}else{var a=r.redAdd(n),c=this.curve._mulC(this.c.redMul(this.z)).redSqr(),f=a.redSub(c).redSub(c);i=this.curve._mulC(t.redISub(a)).redMul(f),o=this.curve._mulC(a).redMul(r.redISub(n)),s=a.redMul(f)}return this.curve.point(i,o,s)},f.prototype.dbl=function e(){return this.isInfinity()?this:this.curve.extended?this._extDbl():this._projDbl()},f.prototype._extAdd=function e(t){var r=this.y.redSub(this.x).redMul(t.y.redSub(t.x)),n=this.y.redAdd(this.x).redMul(t.y.redAdd(t.x)),i=this.t.redMul(this.curve.dd).redMul(t.t),o=this.z.redMul(t.z.redAdd(t.z)),s=n.redSub(r),a=o.redSub(i),u=o.redAdd(i),c=n.redAdd(r),f=s.redMul(a),l=u.redMul(c),h=s.redMul(c),p=a.redMul(u);return this.curve.point(f,l,p,h)},f.prototype._projAdd=function e(t){var r=this.z.redMul(t.z),n=r.redSqr(),i=this.x.redMul(t.x),o=this.y.redMul(t.y),s=this.curve.d.redMul(i).redMul(o),a=n.redSub(s),u=n.redAdd(s),c=this.x.redAdd(this.y).redMul(t.x.redAdd(t.y)).redISub(i).redISub(o),f=r.redMul(a).redMul(c),l,h;return this.curve.twisted?(l=r.redMul(u).redMul(o.redSub(this.curve._mulA(i))),h=a.redMul(u)):(l=r.redMul(u).redMul(o.redSub(i)),h=this.curve._mulC(a).redMul(u)),this.curve.point(f,l,h)},f.prototype.add=function e(t){return this.isInfinity()?t:t.isInfinity()?this:this.curve.extended?this._extAdd(t):this._projAdd(t)},f.prototype.mul=function e(t){return this.precomputed&&this.precomputed.doubles?this.curve._fixedNafMul(this,t):this.curve._wnafMul(this,t)},f.prototype.mulAdd=function e(t,r,n){return this.curve._wnafMulAdd(1,[this,r],[t,n],2)},f.prototype.normalize=function e(){if(this.zOne)return this;var t=this.z.redInvm();return this.x=this.x.redMul(t),this.y=this.y.redMul(t),this.t&&(this.t=this.t.redMul(t)),this.z=this.curve.one,this.zOne=!0,this},f.prototype.neg=function e(){return this.curve.point(this.x.redNeg(),this.y,this.z,this.t&&this.t.redNeg())},f.prototype.getX=function e(){return this.normalize(),this.x.fromRed()},f.prototype.getY=function e(){return this.normalize(),this.y.fromRed()},f.prototype.toP=f.prototype.normalize,f.prototype.mixedAdd=f.prototype.add},function(e,t,r){"use strict";var n=t,i=r(112),o=r(66),s=o.utils.assert,a;function u(e){"short"===e.type?this.curve=new o.curve.short(e):"edwards"===e.type?this.curve=new o.curve.edwards(e):this.curve=new o.curve.mont(e),this.g=this.curve.g,this.n=this.curve.n,this.hash=e.hash,s(this.g.validate(),"Invalid curve"),s(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}function c(e,t){Object.defineProperty(n,e,{configurable:!0,enumerable:!0,get:function(){var r=new u(t);return Object.defineProperty(n,e,{configurable:!0,enumerable:!0,value:r}),r}})}n.PresetCurve=u,c("p192",{type:"short",prime:"p192",p:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff",a:"ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc",b:"64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1",n:"ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831",hash:i.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),c("p224",{type:"short",prime:"p224",p:"ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001",a:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe",b:"b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4",n:"ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d",hash:i.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),c("p256",{type:"short",prime:null,p:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff",a:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc",b:"5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b",n:"ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551",hash:i.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),c("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"0",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:i.sha256,gRed:!1,g:["9"]}),c("ed25519",{type:"edwards",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"-1",c:"1",d:"52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:i.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});try{a=r(867)}catch(e){a=void 0}c("secp256k1",{type:"short",prime:"k256",p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f",a:"0",b:"7",n:"ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141",h:"1",hash:i.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",a]})},function(e,t){e.exports={doubles:{step:4,points:[["e60fce93b59e9ec53011aabc21c23e97b2a31369b87a5ae9c44ee89e2a6dec0a","f7e3507399e595929db99f34f57937101296891e44d23f0be1f32cce69616821"],["8282263212c609d9ea2a6e3e172de238d8c39cabd5ac1ca10646e23fd5f51508","11f8a8098557dfe45e8256e830b60ace62d613ac2f7b17bed31b6eaff6e26caf"],["175e159f728b865a72f99cc6c6fc846de0b93833fd2222ed73fce5b551e5b739","d3506e0d9e3c79eba4ef97a51ff71f5eacb5955add24345c6efa6ffee9fed695"],["363d90d447b00c9c99ceac05b6262ee053441c7e55552ffe526bad8f83ff4640","4e273adfc732221953b445397f3363145b9a89008199ecb62003c7f3bee9de9"],["8b4b5f165df3c2be8c6244b5b745638843e4a781a15bcd1b69f79a55dffdf80c","4aad0a6f68d308b4b3fbd7813ab0da04f9e336546162ee56b3eff0c65fd4fd36"],["723cbaa6e5db996d6bf771c00bd548c7b700dbffa6c0e77bcb6115925232fcda","96e867b5595cc498a921137488824d6e2660a0653779494801dc069d9eb39f5f"],["eebfa4d493bebf98ba5feec812c2d3b50947961237a919839a533eca0e7dd7fa","5d9a8ca3970ef0f269ee7edaf178089d9ae4cdc3a711f712ddfd4fdae1de8999"],["100f44da696e71672791d0a09b7bde459f1215a29b3c03bfefd7835b39a48db0","cdd9e13192a00b772ec8f3300c090666b7ff4a18ff5195ac0fbd5cd62bc65a09"],["e1031be262c7ed1b1dc9227a4a04c017a77f8d4464f3b3852c8acde6e534fd2d","9d7061928940405e6bb6a4176597535af292dd419e1ced79a44f18f29456a00d"],["feea6cae46d55b530ac2839f143bd7ec5cf8b266a41d6af52d5e688d9094696d","e57c6b6c97dce1bab06e4e12bf3ecd5c981c8957cc41442d3155debf18090088"],["da67a91d91049cdcb367be4be6ffca3cfeed657d808583de33fa978bc1ec6cb1","9bacaa35481642bc41f463f7ec9780e5dec7adc508f740a17e9ea8e27a68be1d"],["53904faa0b334cdda6e000935ef22151ec08d0f7bb11069f57545ccc1a37b7c0","5bc087d0bc80106d88c9eccac20d3c1c13999981e14434699dcb096b022771c8"],["8e7bcd0bd35983a7719cca7764ca906779b53a043a9b8bcaeff959f43ad86047","10b7770b2a3da4b3940310420ca9514579e88e2e47fd68b3ea10047e8460372a"],["385eed34c1cdff21e6d0818689b81bde71a7f4f18397e6690a841e1599c43862","283bebc3e8ea23f56701de19e9ebf4576b304eec2086dc8cc0458fe5542e5453"],["6f9d9b803ecf191637c73a4413dfa180fddf84a5947fbc9c606ed86c3fac3a7","7c80c68e603059ba69b8e2a30e45c4d47ea4dd2f5c281002d86890603a842160"],["3322d401243c4e2582a2147c104d6ecbf774d163db0f5e5313b7e0e742d0e6bd","56e70797e9664ef5bfb019bc4ddaf9b72805f63ea2873af624f3a2e96c28b2a0"],["85672c7d2de0b7da2bd1770d89665868741b3f9af7643397721d74d28134ab83","7c481b9b5b43b2eb6374049bfa62c2e5e77f17fcc5298f44c8e3094f790313a6"],["948bf809b1988a46b06c9f1919413b10f9226c60f668832ffd959af60c82a0a","53a562856dcb6646dc6b74c5d1c3418c6d4dff08c97cd2bed4cb7f88d8c8e589"],["6260ce7f461801c34f067ce0f02873a8f1b0e44dfc69752accecd819f38fd8e8","bc2da82b6fa5b571a7f09049776a1ef7ecd292238051c198c1a84e95b2b4ae17"],["e5037de0afc1d8d43d8348414bbf4103043ec8f575bfdc432953cc8d2037fa2d","4571534baa94d3b5f9f98d09fb990bddbd5f5b03ec481f10e0e5dc841d755bda"],["e06372b0f4a207adf5ea905e8f1771b4e7e8dbd1c6a6c5b725866a0ae4fce725","7a908974bce18cfe12a27bb2ad5a488cd7484a7787104870b27034f94eee31dd"],["213c7a715cd5d45358d0bbf9dc0ce02204b10bdde2a3f58540ad6908d0559754","4b6dad0b5ae462507013ad06245ba190bb4850f5f36a7eeddff2c27534b458f2"],["4e7c272a7af4b34e8dbb9352a5419a87e2838c70adc62cddf0cc3a3b08fbd53c","17749c766c9d0b18e16fd09f6def681b530b9614bff7dd33e0b3941817dcaae6"],["fea74e3dbe778b1b10f238ad61686aa5c76e3db2be43057632427e2840fb27b6","6e0568db9b0b13297cf674deccb6af93126b596b973f7b77701d3db7f23cb96f"],["76e64113f677cf0e10a2570d599968d31544e179b760432952c02a4417bdde39","c90ddf8dee4e95cf577066d70681f0d35e2a33d2b56d2032b4b1752d1901ac01"],["c738c56b03b2abe1e8281baa743f8f9a8f7cc643df26cbee3ab150242bcbb891","893fb578951ad2537f718f2eacbfbbbb82314eef7880cfe917e735d9699a84c3"],["d895626548b65b81e264c7637c972877d1d72e5f3a925014372e9f6588f6c14b","febfaa38f2bc7eae728ec60818c340eb03428d632bb067e179363ed75d7d991f"],["b8da94032a957518eb0f6433571e8761ceffc73693e84edd49150a564f676e03","2804dfa44805a1e4d7c99cc9762808b092cc584d95ff3b511488e4e74efdf6e7"],["e80fea14441fb33a7d8adab9475d7fab2019effb5156a792f1a11778e3c0df5d","eed1de7f638e00771e89768ca3ca94472d155e80af322ea9fcb4291b6ac9ec78"],["a301697bdfcd704313ba48e51d567543f2a182031efd6915ddc07bbcc4e16070","7370f91cfb67e4f5081809fa25d40f9b1735dbf7c0a11a130c0d1a041e177ea1"],["90ad85b389d6b936463f9d0512678de208cc330b11307fffab7ac63e3fb04ed4","e507a3620a38261affdcbd9427222b839aefabe1582894d991d4d48cb6ef150"],["8f68b9d2f63b5f339239c1ad981f162ee88c5678723ea3351b7b444c9ec4c0da","662a9f2dba063986de1d90c2b6be215dbbea2cfe95510bfdf23cbf79501fff82"],["e4f3fb0176af85d65ff99ff9198c36091f48e86503681e3e6686fd5053231e11","1e63633ad0ef4f1c1661a6d0ea02b7286cc7e74ec951d1c9822c38576feb73bc"],["8c00fa9b18ebf331eb961537a45a4266c7034f2f0d4e1d0716fb6eae20eae29e","efa47267fea521a1a9dc343a3736c974c2fadafa81e36c54e7d2a4c66702414b"],["e7a26ce69dd4829f3e10cec0a9e98ed3143d084f308b92c0997fddfc60cb3e41","2a758e300fa7984b471b006a1aafbb18d0a6b2c0420e83e20e8a9421cf2cfd51"],["b6459e0ee3662ec8d23540c223bcbdc571cbcb967d79424f3cf29eb3de6b80ef","67c876d06f3e06de1dadf16e5661db3c4b3ae6d48e35b2ff30bf0b61a71ba45"],["d68a80c8280bb840793234aa118f06231d6f1fc67e73c5a5deda0f5b496943e8","db8ba9fff4b586d00c4b1f9177b0e28b5b0e7b8f7845295a294c84266b133120"],["324aed7df65c804252dc0270907a30b09612aeb973449cea4095980fc28d3d5d","648a365774b61f2ff130c0c35aec1f4f19213b0c7e332843967224af96ab7c84"],["4df9c14919cde61f6d51dfdbe5fee5dceec4143ba8d1ca888e8bd373fd054c96","35ec51092d8728050974c23a1d85d4b5d506cdc288490192ebac06cad10d5d"],["9c3919a84a474870faed8a9c1cc66021523489054d7f0308cbfc99c8ac1f98cd","ddb84f0f4a4ddd57584f044bf260e641905326f76c64c8e6be7e5e03d4fc599d"],["6057170b1dd12fdf8de05f281d8e06bb91e1493a8b91d4cc5a21382120a959e5","9a1af0b26a6a4807add9a2daf71df262465152bc3ee24c65e899be932385a2a8"],["a576df8e23a08411421439a4518da31880cef0fba7d4df12b1a6973eecb94266","40a6bf20e76640b2c92b97afe58cd82c432e10a7f514d9f3ee8be11ae1b28ec8"],["7778a78c28dec3e30a05fe9629de8c38bb30d1f5cf9a3a208f763889be58ad71","34626d9ab5a5b22ff7098e12f2ff580087b38411ff24ac563b513fc1fd9f43ac"],["928955ee637a84463729fd30e7afd2ed5f96274e5ad7e5cb09eda9c06d903ac","c25621003d3f42a827b78a13093a95eeac3d26efa8a8d83fc5180e935bcd091f"],["85d0fef3ec6db109399064f3a0e3b2855645b4a907ad354527aae75163d82751","1f03648413a38c0be29d496e582cf5663e8751e96877331582c237a24eb1f962"],["ff2b0dce97eece97c1c9b6041798b85dfdfb6d8882da20308f5404824526087e","493d13fef524ba188af4c4dc54d07936c7b7ed6fb90e2ceb2c951e01f0c29907"],["827fbbe4b1e880ea9ed2b2e6301b212b57f1ee148cd6dd28780e5e2cf856e241","c60f9c923c727b0b71bef2c67d1d12687ff7a63186903166d605b68baec293ec"],["eaa649f21f51bdbae7be4ae34ce6e5217a58fdce7f47f9aa7f3b58fa2120e2b3","be3279ed5bbbb03ac69a80f89879aa5a01a6b965f13f7e59d47a5305ba5ad93d"],["e4a42d43c5cf169d9391df6decf42ee541b6d8f0c9a137401e23632dda34d24f","4d9f92e716d1c73526fc99ccfb8ad34ce886eedfa8d8e4f13a7f7131deba9414"],["1ec80fef360cbdd954160fadab352b6b92b53576a88fea4947173b9d4300bf19","aeefe93756b5340d2f3a4958a7abbf5e0146e77f6295a07b671cdc1cc107cefd"],["146a778c04670c2f91b00af4680dfa8bce3490717d58ba889ddb5928366642be","b318e0ec3354028add669827f9d4b2870aaa971d2f7e5ed1d0b297483d83efd0"],["fa50c0f61d22e5f07e3acebb1aa07b128d0012209a28b9776d76a8793180eef9","6b84c6922397eba9b72cd2872281a68a5e683293a57a213b38cd8d7d3f4f2811"],["da1d61d0ca721a11b1a5bf6b7d88e8421a288ab5d5bba5220e53d32b5f067ec2","8157f55a7c99306c79c0766161c91e2966a73899d279b48a655fba0f1ad836f1"],["a8e282ff0c9706907215ff98e8fd416615311de0446f1e062a73b0610d064e13","7f97355b8db81c09abfb7f3c5b2515888b679a3e50dd6bd6cef7c73111f4cc0c"],["174a53b9c9a285872d39e56e6913cab15d59b1fa512508c022f382de8319497c","ccc9dc37abfc9c1657b4155f2c47f9e6646b3a1d8cb9854383da13ac079afa73"],["959396981943785c3d3e57edf5018cdbe039e730e4918b3d884fdff09475b7ba","2e7e552888c331dd8ba0386a4b9cd6849c653f64c8709385e9b8abf87524f2fd"],["d2a63a50ae401e56d645a1153b109a8fcca0a43d561fba2dbb51340c9d82b151","e82d86fb6443fcb7565aee58b2948220a70f750af484ca52d4142174dcf89405"],["64587e2335471eb890ee7896d7cfdc866bacbdbd3839317b3436f9b45617e073","d99fcdd5bf6902e2ae96dd6447c299a185b90a39133aeab358299e5e9faf6589"],["8481bde0e4e4d885b3a546d3e549de042f0aa6cea250e7fd358d6c86dd45e458","38ee7b8cba5404dd84a25bf39cecb2ca900a79c42b262e556d64b1b59779057e"],["13464a57a78102aa62b6979ae817f4637ffcfed3c4b1ce30bcd6303f6caf666b","69be159004614580ef7e433453ccb0ca48f300a81d0942e13f495a907f6ecc27"],["bc4a9df5b713fe2e9aef430bcc1dc97a0cd9ccede2f28588cada3a0d2d83f366","d3a81ca6e785c06383937adf4b798caa6e8a9fbfa547b16d758d666581f33c1"],["8c28a97bf8298bc0d23d8c749452a32e694b65e30a9472a3954ab30fe5324caa","40a30463a3305193378fedf31f7cc0eb7ae784f0451cb9459e71dc73cbef9482"],["8ea9666139527a8c1dd94ce4f071fd23c8b350c5a4bb33748c4ba111faccae0","620efabbc8ee2782e24e7c0cfb95c5d735b783be9cf0f8e955af34a30e62b945"],["dd3625faef5ba06074669716bbd3788d89bdde815959968092f76cc4eb9a9787","7a188fa3520e30d461da2501045731ca941461982883395937f68d00c644a573"],["f710d79d9eb962297e4f6232b40e8f7feb2bc63814614d692c12de752408221e","ea98e67232d3b3295d3b535532115ccac8612c721851617526ae47a9c77bfc82"]]},naf:{wnd:7,points:[["f9308a019258c31049344f85f89d5229b531c845836f99b08601f113bce036f9","388f7b0f632de8140fe337e62a37f3566500a99934c2231b6cb9fd7584b8e672"],["2f8bde4d1a07209355b4a7250a5c5128e88b84bddc619ab7cba8d569b240efe4","d8ac222636e5e3d6d4dba9dda6c9c426f788271bab0d6840dca87d3aa6ac62d6"],["5cbdf0646e5db4eaa398f365f2ea7a0e3d419b7e0330e39ce92bddedcac4f9bc","6aebca40ba255960a3178d6d861a54dba813d0b813fde7b5a5082628087264da"],["acd484e2f0c7f65309ad178a9f559abde09796974c57e714c35f110dfc27ccbe","cc338921b0a7d9fd64380971763b61e9add888a4375f8e0f05cc262ac64f9c37"],["774ae7f858a9411e5ef4246b70c65aac5649980be5c17891bbec17895da008cb","d984a032eb6b5e190243dd56d7b7b365372db1e2dff9d6a8301d74c9c953c61b"],["f28773c2d975288bc7d1d205c3748651b075fbc6610e58cddeeddf8f19405aa8","ab0902e8d880a89758212eb65cdaf473a1a06da521fa91f29b5cb52db03ed81"],["d7924d4f7d43ea965a465ae3095ff41131e5946f3c85f79e44adbcf8e27e080e","581e2872a86c72a683842ec228cc6defea40af2bd896d3a5c504dc9ff6a26b58"],["defdea4cdb677750a420fee807eacf21eb9898ae79b9768766e4faa04a2d4a34","4211ab0694635168e997b0ead2a93daeced1f4a04a95c0f6cfb199f69e56eb77"],["2b4ea0a797a443d293ef5cff444f4979f06acfebd7e86d277475656138385b6c","85e89bc037945d93b343083b5a1c86131a01f60c50269763b570c854e5c09b7a"],["352bbf4a4cdd12564f93fa332ce333301d9ad40271f8107181340aef25be59d5","321eb4075348f534d59c18259dda3e1f4a1b3b2e71b1039c67bd3d8bcf81998c"],["2fa2104d6b38d11b0230010559879124e42ab8dfeff5ff29dc9cdadd4ecacc3f","2de1068295dd865b64569335bd5dd80181d70ecfc882648423ba76b532b7d67"],["9248279b09b4d68dab21a9b066edda83263c3d84e09572e269ca0cd7f5453714","73016f7bf234aade5d1aa71bdea2b1ff3fc0de2a887912ffe54a32ce97cb3402"],["daed4f2be3a8bf278e70132fb0beb7522f570e144bf615c07e996d443dee8729","a69dce4a7d6c98e8d4a1aca87ef8d7003f83c230f3afa726ab40e52290be1c55"],["c44d12c7065d812e8acf28d7cbb19f9011ecd9e9fdf281b0e6a3b5e87d22e7db","2119a460ce326cdc76c45926c982fdac0e106e861edf61c5a039063f0e0e6482"],["6a245bf6dc698504c89a20cfded60853152b695336c28063b61c65cbd269e6b4","e022cf42c2bd4a708b3f5126f16a24ad8b33ba48d0423b6efd5e6348100d8a82"],["1697ffa6fd9de627c077e3d2fe541084ce13300b0bec1146f95ae57f0d0bd6a5","b9c398f186806f5d27561506e4557433a2cf15009e498ae7adee9d63d01b2396"],["605bdb019981718b986d0f07e834cb0d9deb8360ffb7f61df982345ef27a7479","2972d2de4f8d20681a78d93ec96fe23c26bfae84fb14db43b01e1e9056b8c49"],["62d14dab4150bf497402fdc45a215e10dcb01c354959b10cfe31c7e9d87ff33d","80fc06bd8cc5b01098088a1950eed0db01aa132967ab472235f5642483b25eaf"],["80c60ad0040f27dade5b4b06c408e56b2c50e9f56b9b8b425e555c2f86308b6f","1c38303f1cc5c30f26e66bad7fe72f70a65eed4cbe7024eb1aa01f56430bd57a"],["7a9375ad6167ad54aa74c6348cc54d344cc5dc9487d847049d5eabb0fa03c8fb","d0e3fa9eca8726909559e0d79269046bdc59ea10c70ce2b02d499ec224dc7f7"],["d528ecd9b696b54c907a9ed045447a79bb408ec39b68df504bb51f459bc3ffc9","eecf41253136e5f99966f21881fd656ebc4345405c520dbc063465b521409933"],["49370a4b5f43412ea25f514e8ecdad05266115e4a7ecb1387231808f8b45963","758f3f41afd6ed428b3081b0512fd62a54c3f3afbb5b6764b653052a12949c9a"],["77f230936ee88cbbd73df930d64702ef881d811e0e1498e2f1c13eb1fc345d74","958ef42a7886b6400a08266e9ba1b37896c95330d97077cbbe8eb3c7671c60d6"],["f2dac991cc4ce4b9ea44887e5c7c0bce58c80074ab9d4dbaeb28531b7739f530","e0dedc9b3b2f8dad4da1f32dec2531df9eb5fbeb0598e4fd1a117dba703a3c37"],["463b3d9f662621fb1b4be8fbbe2520125a216cdfc9dae3debcba4850c690d45b","5ed430d78c296c3543114306dd8622d7c622e27c970a1de31cb377b01af7307e"],["f16f804244e46e2a09232d4aff3b59976b98fac14328a2d1a32496b49998f247","cedabd9b82203f7e13d206fcdf4e33d92a6c53c26e5cce26d6579962c4e31df6"],["caf754272dc84563b0352b7a14311af55d245315ace27c65369e15f7151d41d1","cb474660ef35f5f2a41b643fa5e460575f4fa9b7962232a5c32f908318a04476"],["2600ca4b282cb986f85d0f1709979d8b44a09c07cb86d7c124497bc86f082120","4119b88753c15bd6a693b03fcddbb45d5ac6be74ab5f0ef44b0be9475a7e4b40"],["7635ca72d7e8432c338ec53cd12220bc01c48685e24f7dc8c602a7746998e435","91b649609489d613d1d5e590f78e6d74ecfc061d57048bad9e76f302c5b9c61"],["754e3239f325570cdbbf4a87deee8a66b7f2b33479d468fbc1a50743bf56cc18","673fb86e5bda30fb3cd0ed304ea49a023ee33d0197a695d0c5d98093c536683"],["e3e6bd1071a1e96aff57859c82d570f0330800661d1c952f9fe2694691d9b9e8","59c9e0bba394e76f40c0aa58379a3cb6a5a2283993e90c4167002af4920e37f5"],["186b483d056a033826ae73d88f732985c4ccb1f32ba35f4b4cc47fdcf04aa6eb","3b952d32c67cf77e2e17446e204180ab21fb8090895138b4a4a797f86e80888b"],["df9d70a6b9876ce544c98561f4be4f725442e6d2b737d9c91a8321724ce0963f","55eb2dafd84d6ccd5f862b785dc39d4ab157222720ef9da217b8c45cf2ba2417"],["5edd5cc23c51e87a497ca815d5dce0f8ab52554f849ed8995de64c5f34ce7143","efae9c8dbc14130661e8cec030c89ad0c13c66c0d17a2905cdc706ab7399a868"],["290798c2b6476830da12fe02287e9e777aa3fba1c355b17a722d362f84614fba","e38da76dcd440621988d00bcf79af25d5b29c094db2a23146d003afd41943e7a"],["af3c423a95d9f5b3054754efa150ac39cd29552fe360257362dfdecef4053b45","f98a3fd831eb2b749a93b0e6f35cfb40c8cd5aa667a15581bc2feded498fd9c6"],["766dbb24d134e745cccaa28c99bf274906bb66b26dcf98df8d2fed50d884249a","744b1152eacbe5e38dcc887980da38b897584a65fa06cedd2c924f97cbac5996"],["59dbf46f8c94759ba21277c33784f41645f7b44f6c596a58ce92e666191abe3e","c534ad44175fbc300f4ea6ce648309a042ce739a7919798cd85e216c4a307f6e"],["f13ada95103c4537305e691e74e9a4a8dd647e711a95e73cb62dc6018cfd87b8","e13817b44ee14de663bf4bc808341f326949e21a6a75c2570778419bdaf5733d"],["7754b4fa0e8aced06d4167a2c59cca4cda1869c06ebadfb6488550015a88522c","30e93e864e669d82224b967c3020b8fa8d1e4e350b6cbcc537a48b57841163a2"],["948dcadf5990e048aa3874d46abef9d701858f95de8041d2a6828c99e2262519","e491a42537f6e597d5d28a3224b1bc25df9154efbd2ef1d2cbba2cae5347d57e"],["7962414450c76c1689c7b48f8202ec37fb224cf5ac0bfa1570328a8a3d7c77ab","100b610ec4ffb4760d5c1fc133ef6f6b12507a051f04ac5760afa5b29db83437"],["3514087834964b54b15b160644d915485a16977225b8847bb0dd085137ec47ca","ef0afbb2056205448e1652c48e8127fc6039e77c15c2378b7e7d15a0de293311"],["d3cc30ad6b483e4bc79ce2c9dd8bc54993e947eb8df787b442943d3f7b527eaf","8b378a22d827278d89c5e9be8f9508ae3c2ad46290358630afb34db04eede0a4"],["1624d84780732860ce1c78fcbfefe08b2b29823db913f6493975ba0ff4847610","68651cf9b6da903e0914448c6cd9d4ca896878f5282be4c8cc06e2a404078575"],["733ce80da955a8a26902c95633e62a985192474b5af207da6df7b4fd5fc61cd4","f5435a2bd2badf7d485a4d8b8db9fcce3e1ef8e0201e4578c54673bc1dc5ea1d"],["15d9441254945064cf1a1c33bbd3b49f8966c5092171e699ef258dfab81c045c","d56eb30b69463e7234f5137b73b84177434800bacebfc685fc37bbe9efe4070d"],["a1d0fcf2ec9de675b612136e5ce70d271c21417c9d2b8aaaac138599d0717940","edd77f50bcb5a3cab2e90737309667f2641462a54070f3d519212d39c197a629"],["e22fbe15c0af8ccc5780c0735f84dbe9a790badee8245c06c7ca37331cb36980","a855babad5cd60c88b430a69f53a1a7a38289154964799be43d06d77d31da06"],["311091dd9860e8e20ee13473c1155f5f69635e394704eaa74009452246cfa9b3","66db656f87d1f04fffd1f04788c06830871ec5a64feee685bd80f0b1286d8374"],["34c1fd04d301be89b31c0442d3e6ac24883928b45a9340781867d4232ec2dbdf","9414685e97b1b5954bd46f730174136d57f1ceeb487443dc5321857ba73abee"],["f219ea5d6b54701c1c14de5b557eb42a8d13f3abbcd08affcc2a5e6b049b8d63","4cb95957e83d40b0f73af4544cccf6b1f4b08d3c07b27fb8d8c2962a400766d1"],["d7b8740f74a8fbaab1f683db8f45de26543a5490bca627087236912469a0b448","fa77968128d9c92ee1010f337ad4717eff15db5ed3c049b3411e0315eaa4593b"],["32d31c222f8f6f0ef86f7c98d3a3335ead5bcd32abdd94289fe4d3091aa824bf","5f3032f5892156e39ccd3d7915b9e1da2e6dac9e6f26e961118d14b8462e1661"],["7461f371914ab32671045a155d9831ea8793d77cd59592c4340f86cbc18347b5","8ec0ba238b96bec0cbdddcae0aa442542eee1ff50c986ea6b39847b3cc092ff6"],["ee079adb1df1860074356a25aa38206a6d716b2c3e67453d287698bad7b2b2d6","8dc2412aafe3be5c4c5f37e0ecc5f9f6a446989af04c4e25ebaac479ec1c8c1e"],["16ec93e447ec83f0467b18302ee620f7e65de331874c9dc72bfd8616ba9da6b5","5e4631150e62fb40d0e8c2a7ca5804a39d58186a50e497139626778e25b0674d"],["eaa5f980c245f6f038978290afa70b6bd8855897f98b6aa485b96065d537bd99","f65f5d3e292c2e0819a528391c994624d784869d7e6ea67fb18041024edc07dc"],["78c9407544ac132692ee1910a02439958ae04877151342ea96c4b6b35a49f51","f3e0319169eb9b85d5404795539a5e68fa1fbd583c064d2462b675f194a3ddb4"],["494f4be219a1a77016dcd838431aea0001cdc8ae7a6fc688726578d9702857a5","42242a969283a5f339ba7f075e36ba2af925ce30d767ed6e55f4b031880d562c"],["a598a8030da6d86c6bc7f2f5144ea549d28211ea58faa70ebf4c1e665c1fe9b5","204b5d6f84822c307e4b4a7140737aec23fc63b65b35f86a10026dbd2d864e6b"],["c41916365abb2b5d09192f5f2dbeafec208f020f12570a184dbadc3e58595997","4f14351d0087efa49d245b328984989d5caf9450f34bfc0ed16e96b58fa9913"],["841d6063a586fa475a724604da03bc5b92a2e0d2e0a36acfe4c73a5514742881","73867f59c0659e81904f9a1c7543698e62562d6744c169ce7a36de01a8d6154"],["5e95bb399a6971d376026947f89bde2f282b33810928be4ded112ac4d70e20d5","39f23f366809085beebfc71181313775a99c9aed7d8ba38b161384c746012865"],["36e4641a53948fd476c39f8a99fd974e5ec07564b5315d8bf99471bca0ef2f66","d2424b1b1abe4eb8164227b085c9aa9456ea13493fd563e06fd51cf5694c78fc"],["336581ea7bfbbb290c191a2f507a41cf5643842170e914faeab27c2c579f726","ead12168595fe1be99252129b6e56b3391f7ab1410cd1e0ef3dcdcabd2fda224"],["8ab89816dadfd6b6a1f2634fcf00ec8403781025ed6890c4849742706bd43ede","6fdcef09f2f6d0a044e654aef624136f503d459c3e89845858a47a9129cdd24e"],["1e33f1a746c9c5778133344d9299fcaa20b0938e8acff2544bb40284b8c5fb94","60660257dd11b3aa9c8ed618d24edff2306d320f1d03010e33a7d2057f3b3b6"],["85b7c1dcb3cec1b7ee7f30ded79dd20a0ed1f4cc18cbcfcfa410361fd8f08f31","3d98a9cdd026dd43f39048f25a8847f4fcafad1895d7a633c6fed3c35e999511"],["29df9fbd8d9e46509275f4b125d6d45d7fbe9a3b878a7af872a2800661ac5f51","b4c4fe99c775a606e2d8862179139ffda61dc861c019e55cd2876eb2a27d84b"],["a0b1cae06b0a847a3fea6e671aaf8adfdfe58ca2f768105c8082b2e449fce252","ae434102edde0958ec4b19d917a6a28e6b72da1834aff0e650f049503a296cf2"],["4e8ceafb9b3e9a136dc7ff67e840295b499dfb3b2133e4ba113f2e4c0e121e5","cf2174118c8b6d7a4b48f6d534ce5c79422c086a63460502b827ce62a326683c"],["d24a44e047e19b6f5afb81c7ca2f69080a5076689a010919f42725c2b789a33b","6fb8d5591b466f8fc63db50f1c0f1c69013f996887b8244d2cdec417afea8fa3"],["ea01606a7a6c9cdd249fdfcfacb99584001edd28abbab77b5104e98e8e3b35d4","322af4908c7312b0cfbfe369f7a7b3cdb7d4494bc2823700cfd652188a3ea98d"],["af8addbf2b661c8a6c6328655eb96651252007d8c5ea31be4ad196de8ce2131f","6749e67c029b85f52a034eafd096836b2520818680e26ac8f3dfbcdb71749700"],["e3ae1974566ca06cc516d47e0fb165a674a3dabcfca15e722f0e3450f45889","2aeabe7e4531510116217f07bf4d07300de97e4874f81f533420a72eeb0bd6a4"],["591ee355313d99721cf6993ffed1e3e301993ff3ed258802075ea8ced397e246","b0ea558a113c30bea60fc4775460c7901ff0b053d25ca2bdeee98f1a4be5d196"],["11396d55fda54c49f19aa97318d8da61fa8584e47b084945077cf03255b52984","998c74a8cd45ac01289d5833a7beb4744ff536b01b257be4c5767bea93ea57a4"],["3c5d2a1ba39c5a1790000738c9e0c40b8dcdfd5468754b6405540157e017aa7a","b2284279995a34e2f9d4de7396fc18b80f9b8b9fdd270f6661f79ca4c81bd257"],["cc8704b8a60a0defa3a99a7299f2e9c3fbc395afb04ac078425ef8a1793cc030","bdd46039feed17881d1e0862db347f8cf395b74fc4bcdc4e940b74e3ac1f1b13"],["c533e4f7ea8555aacd9777ac5cad29b97dd4defccc53ee7ea204119b2889b197","6f0a256bc5efdf429a2fb6242f1a43a2d9b925bb4a4b3a26bb8e0f45eb596096"],["c14f8f2ccb27d6f109f6d08d03cc96a69ba8c34eec07bbcf566d48e33da6593","c359d6923bb398f7fd4473e16fe1c28475b740dd098075e6c0e8649113dc3a38"],["a6cbc3046bc6a450bac24789fa17115a4c9739ed75f8f21ce441f72e0b90e6ef","21ae7f4680e889bb130619e2c0f95a360ceb573c70603139862afd617fa9b9f"],["347d6d9a02c48927ebfb86c1359b1caf130a3c0267d11ce6344b39f99d43cc38","60ea7f61a353524d1c987f6ecec92f086d565ab687870cb12689ff1e31c74448"],["da6545d2181db8d983f7dcb375ef5866d47c67b1bf31c8cf855ef7437b72656a","49b96715ab6878a79e78f07ce5680c5d6673051b4935bd897fea824b77dc208a"],["c40747cc9d012cb1a13b8148309c6de7ec25d6945d657146b9d5994b8feb1111","5ca560753be2a12fc6de6caf2cb489565db936156b9514e1bb5e83037e0fa2d4"],["4e42c8ec82c99798ccf3a610be870e78338c7f713348bd34c8203ef4037f3502","7571d74ee5e0fb92a7a8b33a07783341a5492144cc54bcc40a94473693606437"],["3775ab7089bc6af823aba2e1af70b236d251cadb0c86743287522a1b3b0dedea","be52d107bcfa09d8bcb9736a828cfa7fac8db17bf7a76a2c42ad961409018cf7"],["cee31cbf7e34ec379d94fb814d3d775ad954595d1314ba8846959e3e82f74e26","8fd64a14c06b589c26b947ae2bcf6bfa0149ef0be14ed4d80f448a01c43b1c6d"],["b4f9eaea09b6917619f6ea6a4eb5464efddb58fd45b1ebefcdc1a01d08b47986","39e5c9925b5a54b07433a4f18c61726f8bb131c012ca542eb24a8ac07200682a"],["d4263dfc3d2df923a0179a48966d30ce84e2515afc3dccc1b77907792ebcc60e","62dfaf07a0f78feb30e30d6295853ce189e127760ad6cf7fae164e122a208d54"],["48457524820fa65a4f8d35eb6930857c0032acc0a4a2de422233eeda897612c4","25a748ab367979d98733c38a1fa1c2e7dc6cc07db2d60a9ae7a76aaa49bd0f77"],["dfeeef1881101f2cb11644f3a2afdfc2045e19919152923f367a1767c11cceda","ecfb7056cf1de042f9420bab396793c0c390bde74b4bbdff16a83ae09a9a7517"],["6d7ef6b17543f8373c573f44e1f389835d89bcbc6062ced36c82df83b8fae859","cd450ec335438986dfefa10c57fea9bcc521a0959b2d80bbf74b190dca712d10"],["e75605d59102a5a2684500d3b991f2e3f3c88b93225547035af25af66e04541f","f5c54754a8f71ee540b9b48728473e314f729ac5308b06938360990e2bfad125"],["eb98660f4c4dfaa06a2be453d5020bc99a0c2e60abe388457dd43fefb1ed620c","6cb9a8876d9cb8520609af3add26cd20a0a7cd8a9411131ce85f44100099223e"],["13e87b027d8514d35939f2e6892b19922154596941888336dc3563e3b8dba942","fef5a3c68059a6dec5d624114bf1e91aac2b9da568d6abeb2570d55646b8adf1"],["ee163026e9fd6fe017c38f06a5be6fc125424b371ce2708e7bf4491691e5764a","1acb250f255dd61c43d94ccc670d0f58f49ae3fa15b96623e5430da0ad6c62b2"],["b268f5ef9ad51e4d78de3a750c2dc89b1e626d43505867999932e5db33af3d80","5f310d4b3c99b9ebb19f77d41c1dee018cf0d34fd4191614003e945a1216e423"],["ff07f3118a9df035e9fad85eb6c7bfe42b02f01ca99ceea3bf7ffdba93c4750d","438136d603e858a3a5c440c38eccbaddc1d2942114e2eddd4740d098ced1f0d8"],["8d8b9855c7c052a34146fd20ffb658bea4b9f69e0d825ebec16e8c3ce2b526a1","cdb559eedc2d79f926baf44fb84ea4d44bcf50fee51d7ceb30e2e7f463036758"],["52db0b5384dfbf05bfa9d472d7ae26dfe4b851ceca91b1eba54263180da32b63","c3b997d050ee5d423ebaf66a6db9f57b3180c902875679de924b69d84a7b375"],["e62f9490d3d51da6395efd24e80919cc7d0f29c3f3fa48c6fff543becbd43352","6d89ad7ba4876b0b22c2ca280c682862f342c8591f1daf5170e07bfd9ccafa7d"],["7f30ea2476b399b4957509c88f77d0191afa2ff5cb7b14fd6d8e7d65aaab1193","ca5ef7d4b231c94c3b15389a5f6311e9daff7bb67b103e9880ef4bff637acaec"],["5098ff1e1d9f14fb46a210fada6c903fef0fb7b4a1dd1d9ac60a0361800b7a00","9731141d81fc8f8084d37c6e7542006b3ee1b40d60dfe5362a5b132fd17ddc0"],["32b78c7de9ee512a72895be6b9cbefa6e2f3c4ccce445c96b9f2c81e2778ad58","ee1849f513df71e32efc3896ee28260c73bb80547ae2275ba497237794c8753c"],["e2cb74fddc8e9fbcd076eef2a7c72b0ce37d50f08269dfc074b581550547a4f7","d3aa2ed71c9dd2247a62df062736eb0baddea9e36122d2be8641abcb005cc4a4"],["8438447566d4d7bedadc299496ab357426009a35f235cb141be0d99cd10ae3a8","c4e1020916980a4da5d01ac5e6ad330734ef0d7906631c4f2390426b2edd791f"],["4162d488b89402039b584c6fc6c308870587d9c46f660b878ab65c82c711d67e","67163e903236289f776f22c25fb8a3afc1732f2b84b4e95dbda47ae5a0852649"],["3fad3fa84caf0f34f0f89bfd2dcf54fc175d767aec3e50684f3ba4a4bf5f683d","cd1bc7cb6cc407bb2f0ca647c718a730cf71872e7d0d2a53fa20efcdfe61826"],["674f2600a3007a00568c1a7ce05d0816c1fb84bf1370798f1c69532faeb1a86b","299d21f9413f33b3edf43b257004580b70db57da0b182259e09eecc69e0d38a5"],["d32f4da54ade74abb81b815ad1fb3b263d82d6c692714bcff87d29bd5ee9f08f","f9429e738b8e53b968e99016c059707782e14f4535359d582fc416910b3eea87"],["30e4e670435385556e593657135845d36fbb6931f72b08cb1ed954f1e3ce3ff6","462f9bce619898638499350113bbc9b10a878d35da70740dc695a559eb88db7b"],["be2062003c51cc3004682904330e4dee7f3dcd10b01e580bf1971b04d4cad297","62188bc49d61e5428573d48a74e1c655b1c61090905682a0d5558ed72dccb9bc"],["93144423ace3451ed29e0fb9ac2af211cb6e84a601df5993c419859fff5df04a","7c10dfb164c3425f5c71a3f9d7992038f1065224f72bb9d1d902a6d13037b47c"],["b015f8044f5fcbdcf21ca26d6c34fb8197829205c7b7d2a7cb66418c157b112c","ab8c1e086d04e813744a655b2df8d5f83b3cdc6faa3088c1d3aea1454e3a1d5f"],["d5e9e1da649d97d89e4868117a465a3a4f8a18de57a140d36b3f2af341a21b52","4cb04437f391ed73111a13cc1d4dd0db1693465c2240480d8955e8592f27447a"],["d3ae41047dd7ca065dbf8ed77b992439983005cd72e16d6f996a5316d36966bb","bd1aeb21ad22ebb22a10f0303417c6d964f8cdd7df0aca614b10dc14d125ac46"],["463e2763d885f958fc66cdd22800f0a487197d0a82e377b49f80af87c897b065","bfefacdb0e5d0fd7df3a311a94de062b26b80c61fbc97508b79992671ef7ca7f"],["7985fdfd127c0567c6f53ec1bb63ec3158e597c40bfe747c83cddfc910641917","603c12daf3d9862ef2b25fe1de289aed24ed291e0ec6708703a5bd567f32ed03"],["74a1ad6b5f76e39db2dd249410eac7f99e74c59cb83d2d0ed5ff1543da7703e9","cc6157ef18c9c63cd6193d83631bbea0093e0968942e8c33d5737fd790e0db08"],["30682a50703375f602d416664ba19b7fc9bab42c72747463a71d0896b22f6da3","553e04f6b018b4fa6c8f39e7f311d3176290d0e0f19ca73f17714d9977a22ff8"],["9e2158f0d7c0d5f26c3791efefa79597654e7a2b2464f52b1ee6c1347769ef57","712fcdd1b9053f09003a3481fa7762e9ffd7c8ef35a38509e2fbf2629008373"],["176e26989a43c9cfeba4029c202538c28172e566e3c4fce7322857f3be327d66","ed8cc9d04b29eb877d270b4878dc43c19aefd31f4eee09ee7b47834c1fa4b1c3"],["75d46efea3771e6e68abb89a13ad747ecf1892393dfc4f1b7004788c50374da8","9852390a99507679fd0b86fd2b39a868d7efc22151346e1a3ca4726586a6bed8"],["809a20c67d64900ffb698c4c825f6d5f2310fb0451c869345b7319f645605721","9e994980d9917e22b76b061927fa04143d096ccc54963e6a5ebfa5f3f8e286c1"],["1b38903a43f7f114ed4500b4eac7083fdefece1cf29c63528d563446f972c180","4036edc931a60ae889353f77fd53de4a2708b26b6f5da72ad3394119daf408f9"]]}}},function(e,t,r){"use strict";var n=r(75),i=r(66),o=i.utils,s=o.assert,a=r(869),u=r(870);function c(e){if(!(this instanceof c))return new c(e);"string"==typeof e&&(s(i.curves.hasOwnProperty(e),"Unknown curve "+e),e=i.curves[e]),e instanceof i.curves.PresetCurve&&(e={curve:e}),this.curve=e.curve.curve,this.n=this.curve.n,this.nh=this.n.shrn(1),this.g=this.curve.g,this.g=e.curve.g,this.g.precompute(e.curve.n.bitLength()+1),this.hash=e.hash||e.curve.hash}e.exports=c,c.prototype.keyPair=function e(t){return new a(this,t)},c.prototype.keyFromPrivate=function e(t,r){return a.fromPrivate(this,t,r)},c.prototype.keyFromPublic=function e(t,r){return a.fromPublic(this,t,r)},c.prototype.genKeyPair=function e(t){t||(t={});for(var r=new i.hmacDRBG({hash:this.hash,pers:t.pers,entropy:t.entropy||i.rand(this.hash.hmacStrength),nonce:this.n.toArray()}),o=this.n.byteLength(),s=this.n.sub(new n(2));;){var a=new n(r.generate(o));if(!(a.cmp(s)>0))return a.iaddn(1),this.keyFromPrivate(a)}},c.prototype._truncateToN=function e(t,r){var n=8*t.byteLength()-this.n.bitLength();return n>0&&(t=t.shrn(n)),!r&&t.cmp(this.n)>=0?t.sub(this.n):t},c.prototype.sign=function e(t,r,o,s){"object"==typeof o&&(s=o,o=null),s||(s={}),r=this.keyFromPrivate(r,o),t=this._truncateToN(new n(t,16));for(var a=this.n.byteLength(),c=r.getPrivate().toArray(),f=c.length;f<21;f++)c.unshift(0);for(var l=t.toArray(),f=l.length;f<a;f++)l.unshift(0);for(var h=new i.hmacDRBG({hash:this.hash,entropy:c,nonce:l}),p=this.n.sub(new n(1));;){var d=new n(h.generate(this.n.byteLength()));if(d=this._truncateToN(d,!0),!(d.cmpn(1)<=0||d.cmp(p)>=0)){var y=this.g.mul(d);if(!y.isInfinity()){var g=y.getX().mod(this.n);if(0!==g.cmpn(0)){var m=d.invm(this.n).mul(g.mul(r.getPrivate()).iadd(t)).mod(this.n);if(0!==m.cmpn(0))return s.canonical&&m.cmp(this.nh)>0&&(m=this.n.sub(m)),new u({r:g,s:m})}}}}},c.prototype.verify=function e(t,r,i,o){t=this._truncateToN(new n(t,16)),i=this.keyFromPublic(i,o),r=new u(r,"hex");var s=r.r,a=r.s;if(s.cmpn(1)<0||s.cmp(this.n)>=0)return!1;if(a.cmpn(1)<0||a.cmp(this.n)>=0)return!1;var c=a.invm(this.n),f=c.mul(t).mod(this.n),l=c.mul(s).mod(this.n),h=this.g.mulAdd(f,i.getPublic(),l);return!h.isInfinity()&&0===h.getX().mod(this.n).cmp(s)}},function(e,t,r){"use strict";var n=r(75),i=r(66),o=i.utils;function s(e,t){this.ec=e,this.priv=null,this.pub=null,t.priv&&this._importPrivate(t.priv,t.privEnc),t.pub&&this._importPublic(t.pub,t.pubEnc)}e.exports=s,s.fromPublic=function e(t,r,n){return r instanceof s?r:new s(t,{pub:r,pubEnc:n})},s.fromPrivate=function e(t,r,n){return r instanceof s?r:new s(t,{priv:r,privEnc:n})},s.prototype.validate=function e(){var t=this.getPublic();return t.isInfinity()?{result:!1,reason:"Invalid public key"}:t.validate()?t.mul(this.ec.curve.n).isInfinity()?{result:!0,reason:null}:{result:!1,reason:"Public key * N != O"}:{result:!1,reason:"Public key is not a point"}},s.prototype.getPublic=function e(t,r){if(this.pub||(this.pub=this.ec.g.mul(this.priv)),"string"==typeof t&&(r=t,t=null),!r)return this.pub;for(var n=this.ec.curve.p.byteLength(),i=this.pub.getX().toArray(),s=i.length,a;s<n;s++)i.unshift(0);if("mont"!==this.ec.curve.type)if(t)a=[this.pub.getY().isEven()?2:3].concat(i);else{for(var u=this.pub.getY().toArray(),s=u.length;s<n;s++)u.unshift(0);var a=[4].concat(i,u)}else a=i;return o.encode(a,r)},s.prototype.getPrivate=function e(t){return"hex"===t?this.priv.toString(16,2):this.priv},s.prototype._importPrivate=function e(t,r){this.priv=new n(t,r||16),this.priv=this.priv.mod(this.ec.curve.n)},s.prototype._importPublic=function e(t,r){if(!t.x&&!t.y)return t=o.toArray(t,r),"mont"!==this.ec.curve.type?this._importPublicShort(t):this._importPublicMont(t);this.pub=this.ec.curve.point(t.x,t.y)},s.prototype._importPublicShort=function e(t){var r=this.ec.curve.p.byteLength();4===t[0]&&t.length-1==2*r?this.pub=this.ec.curve.point(t.slice(1,1+r),t.slice(1+r,1+2*r)):2!==t[0]&&3!==t[0]||t.length-1!==r||(this.pub=this.ec.curve.pointFromX(3===t[0],t.slice(1,1+r)))},s.prototype._importPublicMont=function e(t){this.pub=this.ec.curve.point(t,1)},s.prototype.derive=function e(t){return t.mul(this.priv).getX()},s.prototype.sign=function e(t){return this.ec.sign(t,this)},s.prototype.verify=function e(t,r){return this.ec.verify(t,r,this)},s.prototype.inspect=function e(){return"<Key priv: "+(this.priv&&this.priv.toString(16,2))+" pub: "+(this.pub&&this.pub.inspect())+" >"}},function(e,t,r){"use strict";var n=r(75),i=r(66),o=i.utils,s=o.assert;function a(e,t){if(e instanceof a)return e;this._importDER(e,t)||(s(e.r&&e.s,"Signature without r or s"),this.r=new n(e.r,16),this.s=new n(e.s,16))}e.exports=a,a.prototype._importDER=function e(t,r){if(t=o.toArray(t,r),t.length<6||48!==t[0]||2!==t[2])return!1;var i=t[1];if(1+i>t.length)return!1;var s=t[3];if(s>=128)return!1;if(4+s+2>=t.length)return!1;if(2!==t[4+s])return!1;var a=t[5+s];return!(a>=128)&&(!(4+s+2+a>t.length)&&(this.r=new n(t.slice(4,4+s)),this.s=new n(t.slice(4+s+2,4+s+2+a)),!0))},a.prototype.toDER=function e(t){var r=this.r.toArray(),n=this.s.toArray();128&r[0]&&(r=[0].concat(r)),128&n[0]&&(n=[0].concat(n));var i=r.length+n.length+4,s=[48,i,2,r.length];return s=s.concat(r,[2,n.length],n),o.encode(s,t)}},function(e,t,r){"use strict";(function(t){var n=r(15),i=r(425),o=r(248),s=r(34),a=r(40),u=r(61),c=r(67),f=function e(t){if(!(this instanceof e))return new e(t);t?(this.initialize(),this.set(t)):this.initialize()};f.prototype.verify=function(e,t,o,s,a){var u=r(178),c;if(n.isUndefined(o)&&(o=new u),n.isUndefined(s)&&(s=0),n.isUndefined(a)&&(a=0),this.set({script:e,tx:o,nin:s,flags:a}),0!=(a&f.SCRIPT_VERIFY_SIGPUSHONLY)&&!e.isPushOnly())return this.errstr="SCRIPT_ERR_SIG_PUSHONLY",!1;if(!this.evaluate())return!1;a&f.SCRIPT_VERIFY_P2SH&&(c=this.stack.slice());var l=this.stack;if(this.initialize(),this.set({script:t,stack:l,tx:o,nin:s,flags:a}),!this.evaluate())return!1;if(0===this.stack.length)return this.errstr="SCRIPT_ERR_EVAL_FALSE_NO_RESULT",!1;var h=this.stack[this.stack.length-1];if(!f.castToBool(h))return this.errstr="SCRIPT_ERR_EVAL_FALSE_IN_STACK",!1;if(a&f.SCRIPT_VERIFY_P2SH&&t.isScriptHashOut()){if(!e.isPushOnly())return this.errstr="SCRIPT_ERR_SIG_PUSHONLY",!1;if(0===c.length)throw new Error("internal error - stack copy empty");var p=c[c.length-1],d=i.fromBuffer(p);return c.pop(),this.initialize(),this.set({script:d,stack:c,tx:o,nin:s,flags:a}),!!this.evaluate()&&(0===c.length?(this.errstr="SCRIPT_ERR_EVAL_FALSE_NO_P2SH_STACK",!1):!!f.castToBool(c[c.length-1])||(this.errstr="SCRIPT_ERR_EVAL_FALSE_IN_P2SH_STACK",!1))}return!0},e.exports=f,f.prototype.initialize=function(e){this.stack=[],this.altstack=[],this.pc=0,this.pbegincodehash=0,this.nOpCount=0,this.vfExec=[],this.errstr="",this.flags=0},f.prototype.set=function(e){this.script=e.script||this.script,this.tx=e.tx||this.tx,this.nin=void 0!==e.nin?e.nin:this.nin,this.stack=e.stack||this.stack,this.altstack=e.altack||this.altstack,this.pc=void 0!==e.pc?e.pc:this.pc,this.pbegincodehash=void 0!==e.pbegincodehash?e.pbegincodehash:this.pbegincodehash,this.nOpCount=void 0!==e.nOpCount?e.nOpCount:this.nOpCount,this.vfExec=e.vfExec||this.vfExec,this.errstr=e.errstr||this.errstr,this.flags=void 0!==e.flags?e.flags:this.flags},f.true=new t([1]),f.false=new t([]),f.MAX_SCRIPT_ELEMENT_SIZE=520,f.LOCKTIME_THRESHOLD=5e8,f.LOCKTIME_THRESHOLD_BN=new s(f.LOCKTIME_THRESHOLD),f.SCRIPT_VERIFY_NONE=0,f.SCRIPT_VERIFY_P2SH=1,f.SCRIPT_VERIFY_STRICTENC=2,f.SCRIPT_VERIFY_DERSIG=4,f.SCRIPT_VERIFY_LOW_S=8,f.SCRIPT_VERIFY_NULLDUMMY=16,f.SCRIPT_VERIFY_SIGPUSHONLY=32,f.SCRIPT_VERIFY_MINIMALDATA=64,f.SCRIPT_VERIFY_DISCOURAGE_UPGRADABLE_NOPS=128,f.SCRIPT_VERIFY_CHECKLOCKTIMEVERIFY=512,f.castToBool=function(e){for(var t=0;t<e.length;t++)if(0!==e[t])return t!==e.length-1||128!==e[t];return!1},f.prototype.checkSignatureEncoding=function(e){var t;if(0!=(this.flags&(f.SCRIPT_VERIFY_DERSIG|f.SCRIPT_VERIFY_LOW_S|f.SCRIPT_VERIFY_STRICTENC))&&!u.isTxDER(e))return this.errstr="SCRIPT_ERR_SIG_DER_INVALID_FORMAT",!1;if(0!=(this.flags&f.SCRIPT_VERIFY_LOW_S)){if(t=u.fromTxFormat(e),!t.hasLowS())return this.errstr="SCRIPT_ERR_SIG_DER_HIGH_S",!1}else if(0!=(this.flags&f.SCRIPT_VERIFY_STRICTENC)&&(t=u.fromTxFormat(e),!t.hasDefinedHashtype()))return this.errstr="SCRIPT_ERR_SIG_HASHTYPE",!1;return!0},f.prototype.checkPubkeyEncoding=function(e){return!(0!=(this.flags&f.SCRIPT_VERIFY_STRICTENC)&&!c.isValid(e))||(this.errstr="SCRIPT_ERR_PUBKEYTYPE",!1)},f.prototype.evaluate=function(){if(this.script.toBuffer().length>1e4)return this.errstr="SCRIPT_ERR_SCRIPT_SIZE",!1;try{for(;this.pc<this.script.chunks.length;){var e=this.step();if(!e)return!1}if(this.stack.length+this.altstack.length>1e3)return this.errstr="SCRIPT_ERR_STACK_SIZE",!1}catch(e){return this.errstr="SCRIPT_ERR_UNKNOWN_ERROR: "+e,!1}return!(this.vfExec.length>0)||(this.errstr="SCRIPT_ERR_UNBALANCED_CONDITIONAL",!1)},f.prototype.checkLockTime=function(e){return!!(this.tx.nLockTime<f.LOCKTIME_THRESHOLD&&e.lt(f.LOCKTIME_THRESHOLD_BN)||this.tx.nLockTime>=f.LOCKTIME_THRESHOLD&&e.gte(f.LOCKTIME_THRESHOLD_BN))&&(!e.gt(new s(this.tx.nLockTime))&&!!this.tx.inputs[this.nin].isFinal())},f.prototype.step=function(){var e=0!=(this.flags&f.SCRIPT_VERIFY_MINIMALDATA),t=-1===this.vfExec.indexOf(!1),r,l,h,p,d,y,g,m,b,v,_,w,S,k,E,A,x,I=this.script.chunks[this.pc];this.pc++;var T=I.opcodenum;if(n.isUndefined(T))return this.errstr="SCRIPT_ERR_UNDEFINED_OPCODE",!1;if(I.buf&&I.buf.length>f.MAX_SCRIPT_ELEMENT_SIZE)return this.errstr="SCRIPT_ERR_PUSH_SIZE",!1;if(T>o.OP_16&&++this.nOpCount>201)return this.errstr="SCRIPT_ERR_OP_COUNT",!1;if(T===o.OP_CAT||T===o.OP_SUBSTR||T===o.OP_LEFT||T===o.OP_RIGHT||T===o.OP_INVERT||T===o.OP_AND||T===o.OP_OR||T===o.OP_XOR||T===o.OP_2MUL||T===o.OP_2DIV||T===o.OP_MUL||T===o.OP_DIV||T===o.OP_MOD||T===o.OP_LSHIFT||T===o.OP_RSHIFT)return this.errstr="SCRIPT_ERR_DISABLED_OPCODE",!1;if(t&&0<=T&&T<=o.OP_PUSHDATA4){if(e&&!this.script.checkMinimalPush(this.pc-1))return this.errstr="SCRIPT_ERR_MINIMALDATA",!1;if(I.buf){if(I.len!==I.buf.length)throw new Error("Length of push value not equal to length of data");this.stack.push(I.buf)}else this.stack.push(f.false)}else if(t||o.OP_IF<=T&&T<=o.OP_ENDIF)switch(T){case o.OP_1NEGATE:case o.OP_1:case o.OP_2:case o.OP_3:case o.OP_4:case o.OP_5:case o.OP_6:case o.OP_7:case o.OP_8:case o.OP_9:case o.OP_10:case o.OP_11:case o.OP_12:case o.OP_13:case o.OP_14:case o.OP_15:case o.OP_16:d=T-(o.OP_1-1),r=new s(d).toScriptNumBuffer(),this.stack.push(r);break;case o.OP_NOP:break;case o.OP_NOP2:case o.OP_CHECKLOCKTIMEVERIFY:if(!(this.flags&f.SCRIPT_VERIFY_CHECKLOCKTIMEVERIFY)){if(this.flags&f.SCRIPT_VERIFY_DISCOURAGE_UPGRADABLE_NOPS)return this.errstr="SCRIPT_ERR_DISCOURAGE_UPGRADABLE_NOPS",!1;break}if(this.stack.length<1)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;var B=s.fromScriptNumBuffer(this.stack[this.stack.length-1],e,5);if(B.lt(new s(0)))return this.errstr="SCRIPT_ERR_NEGATIVE_LOCKTIME",!1;if(!this.checkLockTime(B))return this.errstr="SCRIPT_ERR_UNSATISFIED_LOCKTIME",!1;break;case o.OP_NOP1:case o.OP_NOP3:case o.OP_NOP4:case o.OP_NOP5:case o.OP_NOP6:case o.OP_NOP7:case o.OP_NOP8:case o.OP_NOP9:case o.OP_NOP10:if(this.flags&f.SCRIPT_VERIFY_DISCOURAGE_UPGRADABLE_NOPS)return this.errstr="SCRIPT_ERR_DISCOURAGE_UPGRADABLE_NOPS",!1;break;case o.OP_IF:case o.OP_NOTIF:if(A=!1,t){if(this.stack.length<1)return this.errstr="SCRIPT_ERR_UNBALANCED_CONDITIONAL",!1;r=this.stack.pop(),A=f.castToBool(r),T===o.OP_NOTIF&&(A=!A)}this.vfExec.push(A);break;case o.OP_ELSE:if(0===this.vfExec.length)return this.errstr="SCRIPT_ERR_UNBALANCED_CONDITIONAL",!1;this.vfExec[this.vfExec.length-1]=!this.vfExec[this.vfExec.length-1];break;case o.OP_ENDIF:if(0===this.vfExec.length)return this.errstr="SCRIPT_ERR_UNBALANCED_CONDITIONAL",!1;this.vfExec.pop();break;case o.OP_VERIFY:if(this.stack.length<1)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;if(r=this.stack[this.stack.length-1],A=f.castToBool(r),!A)return this.errstr="SCRIPT_ERR_VERIFY",!1;this.stack.pop();break;case o.OP_RETURN:return this.errstr="SCRIPT_ERR_OP_RETURN",!1;case o.OP_TOALTSTACK:if(this.stack.length<1)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;this.altstack.push(this.stack.pop());break;case o.OP_FROMALTSTACK:if(this.altstack.length<1)return this.errstr="SCRIPT_ERR_INVALID_ALTSTACK_OPERATION",!1;this.stack.push(this.altstack.pop());break;case o.OP_2DROP:if(this.stack.length<2)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;this.stack.pop(),this.stack.pop();break;case o.OP_2DUP:if(this.stack.length<2)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;l=this.stack[this.stack.length-2],h=this.stack[this.stack.length-1],this.stack.push(l),this.stack.push(h);break;case o.OP_3DUP:if(this.stack.length<3)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;l=this.stack[this.stack.length-3],h=this.stack[this.stack.length-2];var C=this.stack[this.stack.length-1];this.stack.push(l),this.stack.push(h),this.stack.push(C);break;case o.OP_2OVER:if(this.stack.length<4)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;l=this.stack[this.stack.length-4],h=this.stack[this.stack.length-3],this.stack.push(l),this.stack.push(h);break;case o.OP_2ROT:if(this.stack.length<6)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;p=this.stack.splice(this.stack.length-6,2),this.stack.push(p[0]),this.stack.push(p[1]);break;case o.OP_2SWAP:if(this.stack.length<4)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;p=this.stack.splice(this.stack.length-4,2),this.stack.push(p[0]),this.stack.push(p[1]);break;case o.OP_IFDUP:if(this.stack.length<1)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;r=this.stack[this.stack.length-1],A=f.castToBool(r),A&&this.stack.push(r);break;case o.OP_DEPTH:r=new s(this.stack.length).toScriptNumBuffer(),this.stack.push(r);break;case o.OP_DROP:if(this.stack.length<1)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;this.stack.pop();break;case o.OP_DUP:if(this.stack.length<1)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;this.stack.push(this.stack[this.stack.length-1]);break;case o.OP_NIP:if(this.stack.length<2)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;this.stack.splice(this.stack.length-2,1);break;case o.OP_OVER:if(this.stack.length<2)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;this.stack.push(this.stack[this.stack.length-2]);break;case o.OP_PICK:case o.OP_ROLL:if(this.stack.length<2)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;if(r=this.stack[this.stack.length-1],m=s.fromScriptNumBuffer(r,e),d=m.toNumber(),this.stack.pop(),d<0||d>=this.stack.length)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;r=this.stack[this.stack.length-d-1],T===o.OP_ROLL&&this.stack.splice(this.stack.length-d-1,1),this.stack.push(r);break;case o.OP_ROT:if(this.stack.length<3)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;y=this.stack[this.stack.length-3],g=this.stack[this.stack.length-2];var P=this.stack[this.stack.length-1];this.stack[this.stack.length-3]=g,this.stack[this.stack.length-2]=P,this.stack[this.stack.length-1]=y;break;case o.OP_SWAP:if(this.stack.length<2)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;y=this.stack[this.stack.length-2],g=this.stack[this.stack.length-1],this.stack[this.stack.length-2]=g,this.stack[this.stack.length-1]=y;break;case o.OP_TUCK:if(this.stack.length<2)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;this.stack.splice(this.stack.length-2,0,this.stack[this.stack.length-1]);break;case o.OP_SIZE:if(this.stack.length<1)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;m=new s(this.stack[this.stack.length-1].length),this.stack.push(m.toScriptNumBuffer());break;case o.OP_EQUAL:case o.OP_EQUALVERIFY:if(this.stack.length<2)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;l=this.stack[this.stack.length-2],h=this.stack[this.stack.length-1];var O=l.toString("hex")===h.toString("hex");if(this.stack.pop(),this.stack.pop(),this.stack.push(O?f.true:f.false),T===o.OP_EQUALVERIFY){if(!O)return this.errstr="SCRIPT_ERR_EQUALVERIFY",!1;this.stack.pop()}break;case o.OP_1ADD:case o.OP_1SUB:case o.OP_NEGATE:case o.OP_ABS:case o.OP_NOT:case o.OP_0NOTEQUAL:if(this.stack.length<1)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;switch(r=this.stack[this.stack.length-1],m=s.fromScriptNumBuffer(r,e),T){case o.OP_1ADD:m=m.add(s.One);break;case o.OP_1SUB:m=m.sub(s.One);break;case o.OP_NEGATE:m=m.neg();break;case o.OP_ABS:m.cmp(s.Zero)<0&&(m=m.neg());break;case o.OP_NOT:m=new s((0===m.cmp(s.Zero))+0);break;case o.OP_0NOTEQUAL:m=new s((0!==m.cmp(s.Zero))+0)}this.stack.pop(),this.stack.push(m.toScriptNumBuffer());break;case o.OP_ADD:case o.OP_SUB:case o.OP_BOOLAND:case o.OP_BOOLOR:case o.OP_NUMEQUAL:case o.OP_NUMEQUALVERIFY:case o.OP_NUMNOTEQUAL:case o.OP_LESSTHAN:case o.OP_GREATERTHAN:case o.OP_LESSTHANOREQUAL:case o.OP_GREATERTHANOREQUAL:case o.OP_MIN:case o.OP_MAX:if(this.stack.length<2)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;switch(b=s.fromScriptNumBuffer(this.stack[this.stack.length-2],e),v=s.fromScriptNumBuffer(this.stack[this.stack.length-1],e),m=new s(0),T){case o.OP_ADD:m=b.add(v);break;case o.OP_SUB:m=b.sub(v);break;case o.OP_BOOLAND:m=new s((0!==b.cmp(s.Zero)&&0!==v.cmp(s.Zero))+0);break;case o.OP_BOOLOR:m=new s((0!==b.cmp(s.Zero)||0!==v.cmp(s.Zero))+0);break;case o.OP_NUMEQUAL:case o.OP_NUMEQUALVERIFY:m=new s((0===b.cmp(v))+0);break;case o.OP_NUMNOTEQUAL:m=new s((0!==b.cmp(v))+0);break;case o.OP_LESSTHAN:m=new s((b.cmp(v)<0)+0);break;case o.OP_GREATERTHAN:m=new s((b.cmp(v)>0)+0);break;case o.OP_LESSTHANOREQUAL:m=new s((b.cmp(v)<=0)+0);break;case o.OP_GREATERTHANOREQUAL:m=new s((b.cmp(v)>=0)+0);break;case o.OP_MIN:m=b.cmp(v)<0?b:v;break;case o.OP_MAX:m=b.cmp(v)>0?b:v}if(this.stack.pop(),this.stack.pop(),this.stack.push(m.toScriptNumBuffer()),T===o.OP_NUMEQUALVERIFY){if(!f.castToBool(this.stack[this.stack.length-1]))return this.errstr="SCRIPT_ERR_NUMEQUALVERIFY",!1;this.stack.pop()}break;case o.OP_WITHIN:if(this.stack.length<3)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;b=s.fromScriptNumBuffer(this.stack[this.stack.length-3],e),v=s.fromScriptNumBuffer(this.stack[this.stack.length-2],e);var R=s.fromScriptNumBuffer(this.stack[this.stack.length-1],e);A=v.cmp(b)<=0&&b.cmp(R)<0,this.stack.pop(),this.stack.pop(),this.stack.pop(),this.stack.push(A?f.true:f.false);break;case o.OP_RIPEMD160:case o.OP_SHA1:case o.OP_SHA256:case o.OP_HASH160:case o.OP_HASH256:if(this.stack.length<1)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;var N;r=this.stack[this.stack.length-1],T===o.OP_RIPEMD160?N=a.ripemd160(r):T===o.OP_SHA1?N=a.sha1(r):T===o.OP_SHA256?N=a.sha256(r):T===o.OP_HASH160?N=a.sha256ripemd160(r):T===o.OP_HASH256&&(N=a.sha256sha256(r)),this.stack.pop(),this.stack.push(N);break;case o.OP_CODESEPARATOR:this.pbegincodehash=this.pc;break;case o.OP_CHECKSIG:case o.OP_CHECKSIGVERIFY:if(this.stack.length<2)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;_=this.stack[this.stack.length-2],w=this.stack[this.stack.length-1],S=(new i).set({chunks:this.script.chunks.slice(this.pbegincodehash)});var L=(new i).add(_);if(S.findAndDelete(L),!this.checkSignatureEncoding(_)||!this.checkPubkeyEncoding(w))return!1;try{k=u.fromTxFormat(_),E=c.fromBuffer(w,!1),x=this.tx.verifySignature(k,E,this.nin,S)}catch(e){x=!1}if(this.stack.pop(),this.stack.pop(),this.stack.push(x?f.true:f.false),T===o.OP_CHECKSIGVERIFY){if(!x)return this.errstr="SCRIPT_ERR_CHECKSIGVERIFY",!1;this.stack.pop()}break;case o.OP_CHECKMULTISIG:case o.OP_CHECKMULTISIGVERIFY:var j=1;if(this.stack.length<j)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;var M=s.fromScriptNumBuffer(this.stack[this.stack.length-j],e).toNumber();if(M<0||M>20)return this.errstr="SCRIPT_ERR_PUBKEY_COUNT",!1;if(this.nOpCount+=M,this.nOpCount>201)return this.errstr="SCRIPT_ERR_OP_COUNT",!1;var K=++j;if(j+=M,this.stack.length<j)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;var D=s.fromScriptNumBuffer(this.stack[this.stack.length-j],e).toNumber();if(D<0||D>M)return this.errstr="SCRIPT_ERR_SIG_COUNT",!1;var U=++j;if(j+=D,this.stack.length<j)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;S=(new i).set({chunks:this.script.chunks.slice(this.pbegincodehash)});for(var F=0;F<D;F++)_=this.stack[this.stack.length-U-F],S.findAndDelete((new i).add(_));for(x=!0;x&&D>0;){if(_=this.stack[this.stack.length-U],w=this.stack[this.stack.length-K],!this.checkSignatureEncoding(_)||!this.checkPubkeyEncoding(w))return!1;var q;try{k=u.fromTxFormat(_),E=c.fromBuffer(w,!1),q=this.tx.verifySignature(k,E,this.nin,S)}catch(e){q=!1}q&&(U++,D--),K++,M--,D>M&&(x=!1)}for(;j-- >1;)this.stack.pop();if(this.stack.length<1)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;if(this.flags&f.SCRIPT_VERIFY_NULLDUMMY&&this.stack[this.stack.length-1].length)return this.errstr="SCRIPT_ERR_SIG_NULLDUMMY",!1;if(this.stack.pop(),this.stack.push(x?f.true:f.false),T===o.OP_CHECKMULTISIGVERIFY){if(!x)return this.errstr="SCRIPT_ERR_CHECKMULTISIGVERIFY",!1;this.stack.pop()}break;default:return this.errstr="SCRIPT_ERR_BAD_OPCODE",!1}return!0}}).call(this,r(0).Buffer)},function(e,t){e.exports=function(e,t){for(var r=0,n=0;n<e.length&&n!=t.length&&(r=e[n]<t[n]?-1:e[n]>t[n]?1:0,0==r);++n);return 0==r&&(t.length>e.length?r=-1:e.length>t.length&&(r=1)),r}},function(e,t,r){"use strict";var n=r(76),i=r(20),o=r(24),s=r(134),a=r(87),u=r(86),c=r(62),f=r(61),l=r(135);function h(){s.apply(this,arguments)}n(h,s),h.prototype.getSignatures=function(e,t,r,n){i.checkState(this.output instanceof a),n=n||f.SIGHASH_ALL;var o=t.toPublicKey();return o.toString()===this.output.script.getPublicKey().toString("hex")?[new l({publicKey:o,prevTxId:this.prevTxId,outputIndex:this.outputIndex,inputIndex:r,signature:u.sign(e,t,n,r,this.output.script),sigtype:n})]:[]},h.prototype.addSignature=function(e,t){return i.checkState(this.isValidSignature(e,t),"Signature is invalid"),this.setScript(c.buildPublicKeyIn(t.signature.toDER(),t.sigtype)),this},h.prototype.clearSignatures=function(){return this.setScript(c.empty()),this},h.prototype.isFullySigned=function(){return this.script.isPublicKeyIn()},h.SCRIPT_MAX_SIZE=73,h.prototype._estimateSize=function(){return h.SCRIPT_MAX_SIZE},e.exports=h},function(e,t,r){"use strict";var n=r(76),i=r(20),o=r(24),s=r(40),a=r(134),u=r(87),c=r(86),f=r(62),l=r(61),h=r(135);function p(){a.apply(this,arguments)}n(p,a),p.prototype.getSignatures=function(e,t,r,n,a){return i.checkState(this.output instanceof u),a=a||s.sha256ripemd160(t.publicKey.toBuffer()),n=n||l.SIGHASH_ALL,o.equals(a,this.output.script.getPublicKeyHash())?[new h({publicKey:t.publicKey,prevTxId:this.prevTxId,outputIndex:this.outputIndex,inputIndex:r,signature:c.sign(e,t,n,r,this.output.script),sigtype:n})]:[]},p.prototype.addSignature=function(e,t){return i.checkState(this.isValidSignature(e,t),"Signature is invalid"),this.setScript(f.buildPublicKeyHashIn(t.publicKey,t.signature.toDER(),t.sigtype)),this},p.prototype.clearSignatures=function(){return this.setScript(f.empty()),this},p.prototype.isFullySigned=function(){return this.script.isPublicKeyHashIn()},p.SCRIPT_MAX_SIZE=107,p.prototype._estimateSize=function(){return p.SCRIPT_MAX_SIZE},e.exports=p},function(e,t,r){"use strict";var n=r(15),i=r(76),o=r(249),s=r(134),a=r(87),u=r(20),c=r(62),f=r(61),l=r(86),h=r(67),p=r(24),d=r(135);function y(e,t,r,i){s.apply(this,arguments);var o=this;t=t||e.publicKeys,r=r||e.threshold,i=i||e.signatures,this.publicKeys=n.sortBy(t,function(e){return e.toString("hex")}),u.checkState(c.buildMultisigOut(this.publicKeys,r).equals(this.output.script),"Provided public keys don't match to the provided output script"),this.publicKeyIndex={},n.each(this.publicKeys,function(e,t){o.publicKeyIndex[e.toString()]=t}),this.threshold=r,this.signatures=i?this._deserializeSignatures(i):new Array(this.publicKeys.length)}i(y,s),y.prototype.toObject=function(){var e=s.prototype.toObject.apply(this,arguments);return e.threshold=this.threshold,e.publicKeys=n.map(this.publicKeys,function(e){return e.toString()}),e.signatures=this._serializeSignatures(),e},y.prototype._deserializeSignatures=function(e){return n.map(e,function(e){if(e)return new d(e)})},y.prototype._serializeSignatures=function(){return n.map(this.signatures,function(e){if(e)return e.toObject()})},y.prototype.getSignatures=function(e,t,r,i){u.checkState(this.output instanceof a),i=i||f.SIGHASH_ALL;var o=this,s=[];return n.each(this.publicKeys,function(n){n.toString()===t.publicKey.toString()&&s.push(new d({publicKey:t.publicKey,prevTxId:o.prevTxId,outputIndex:o.outputIndex,inputIndex:r,signature:l.sign(e,t,i,r,o.output.script),sigtype:i}))}),s},y.prototype.addSignature=function(e,t){return u.checkState(!this.isFullySigned(),"All needed signatures have already been added"),u.checkArgument(!n.isUndefined(this.publicKeyIndex[t.publicKey.toString()]),"Signature has no matching public key"),u.checkState(this.isValidSignature(e,t)),this.signatures[this.publicKeyIndex[t.publicKey.toString()]]=t,this._updateScript(),this},y.prototype._updateScript=function(){return this.setScript(c.buildMultisigIn(this.publicKeys,this.threshold,this._createSignatures())),this},y.prototype._createSignatures=function(){return n.map(n.filter(this.signatures,function(e){return!n.isUndefined(e)}),function(e){return p.concat([e.signature.toDER(),p.integerAsSingleByteBuffer(e.sigtype)])})},y.prototype.clearSignatures=function(){this.signatures=new Array(this.publicKeys.length),this._updateScript()},y.prototype.isFullySigned=function(){return this.countSignatures()===this.threshold},y.prototype.countMissingSignatures=function(){return this.threshold-this.countSignatures()},y.prototype.countSignatures=function(){return n.reduce(this.signatures,function(e,t){return e+!!t},0)},y.prototype.publicKeysWithoutSignature=function(){var e=this;return n.filter(this.publicKeys,function(t){return!e.signatures[e.publicKeyIndex[t.toString()]]})},y.prototype.isValidSignature=function(e,t){return t.signature.nhashtype=t.sigtype,l.verify(e,t.signature,t.publicKey,t.inputIndex,this.output.script)},y.normalizeSignatures=function(e,t,r,n,i){return i.map(function(i){var o=null;return n=n.filter(function(n){if(o)return!0;var s=new d({signature:f.fromTxFormat(n),publicKey:i,prevTxId:t.prevTxId,outputIndex:t.outputIndex,inputIndex:r,sigtype:f.SIGHASH_ALL});s.signature.nhashtype=s.sigtype;var a=l.verify(e,s.signature,s.publicKey,s.inputIndex,t.output.script);return!a||(o=s,!1)}),o||null})},y.OPCODES_SIZE=1,y.SIGNATURE_SIZE=73,y.prototype._estimateSize=function(){return y.OPCODES_SIZE+this.threshold*y.SIGNATURE_SIZE},e.exports=y},function(e,t,r){"use strict";var n=r(15),i=r(76),o=r(134),s=r(87),a=r(20),u=r(62),c=r(61),f=r(86),l=r(67),h=r(24),p=r(135);function d(e,t,r,i){o.apply(this,arguments);var s=this;t=t||e.publicKeys,r=r||e.threshold,i=i||e.signatures,this.publicKeys=n.sortBy(t,function(e){return e.toString("hex")}),this.redeemScript=u.buildMultisigOut(this.publicKeys,r),a.checkState(u.buildScriptHashOut(this.redeemScript).equals(this.output.script),"Provided public keys don't hash to the provided output"),this.publicKeyIndex={},n.each(this.publicKeys,function(e,t){s.publicKeyIndex[e.toString()]=t}),this.threshold=r,this.signatures=i?this._deserializeSignatures(i):new Array(this.publicKeys.length)}i(d,o),d.prototype.toObject=function(){var e=o.prototype.toObject.apply(this,arguments);return e.threshold=this.threshold,e.publicKeys=n.map(this.publicKeys,function(e){return e.toString()}),e.signatures=this._serializeSignatures(),e},d.prototype._deserializeSignatures=function(e){return n.map(e,function(e){if(e)return new p(e)})},d.prototype._serializeSignatures=function(){return n.map(this.signatures,function(e){if(e)return e.toObject()})},d.prototype.getSignatures=function(e,t,r,i){a.checkState(this.output instanceof s),i=i||c.SIGHASH_ALL;var o=this,u=[];return n.each(this.publicKeys,function(n){n.toString()===t.publicKey.toString()&&u.push(new p({publicKey:t.publicKey,prevTxId:o.prevTxId,outputIndex:o.outputIndex,inputIndex:r,signature:f.sign(e,t,i,r,o.redeemScript),sigtype:i}))}),u},d.prototype.addSignature=function(e,t){return a.checkState(!this.isFullySigned(),"All needed signatures have already been added"),a.checkArgument(!n.isUndefined(this.publicKeyIndex[t.publicKey.toString()]),"Signature has no matching public key"),a.checkState(this.isValidSignature(e,t)),this.signatures[this.publicKeyIndex[t.publicKey.toString()]]=t,this._updateScript(),this},d.prototype._updateScript=function(){return this.setScript(u.buildP2SHMultisigIn(this.publicKeys,this.threshold,this._createSignatures(),{cachedMultisig:this.redeemScript})),this},d.prototype._createSignatures=function(){return n.map(n.filter(this.signatures,function(e){return!n.isUndefined(e)}),function(e){return h.concat([e.signature.toDER(),h.integerAsSingleByteBuffer(e.sigtype)])})},d.prototype.clearSignatures=function(){this.signatures=new Array(this.publicKeys.length),this._updateScript()},d.prototype.isFullySigned=function(){return this.countSignatures()===this.threshold},d.prototype.countMissingSignatures=function(){return this.threshold-this.countSignatures()},d.prototype.countSignatures=function(){return n.reduce(this.signatures,function(e,t){return e+!!t},0)},d.prototype.publicKeysWithoutSignature=function(){var e=this;return n.filter(this.publicKeys,function(t){return!e.signatures[e.publicKeyIndex[t.toString()]]})},d.prototype.isValidSignature=function(e,t){return t.signature.nhashtype=t.sigtype,f.verify(e,t.signature,t.publicKey,t.inputIndex,this.redeemScript)},d.OPCODES_SIZE=7,d.SIGNATURE_SIZE=74,d.PUBKEY_SIZE=34,d.prototype._estimateSize=function(){return d.OPCODES_SIZE+this.threshold*d.SIGNATURE_SIZE+this.publicKeys.length*d.PUBKEY_SIZE},e.exports=d},function(e,t,r){"use strict";var n=r(15),i=r(20),o=r(34),s=r(0),a=r(58),u=r(24),c=r(30),f=r(878),l=2,h=2,p=601;function d(e){return this instanceof d?(this.nullifiers=[],this.commitments=[],this.ciphertexts=[],this.macs=[],e?this._fromObject(e):void 0):new d(e)}Object.defineProperty(d.prototype,"vpub_old",{configurable:!1,enumerable:!0,get:function(){return this._vpub_old},set:function(e){e instanceof o?(this._vpub_oldBN=e,this._vpub_old=e.toNumber()):n.isString(e)?(this._vpub_old=parseInt(e),this._vpub_oldBN=o.fromNumber(this._vpub_old)):(i.checkArgument(c.isNaturalNumber(e),"vpub_old is not a natural number"),this._vpub_oldBN=o.fromNumber(e),this._vpub_old=e),i.checkState(c.isNaturalNumber(this._vpub_old),"vpub_old is not a natural number")}}),Object.defineProperty(d.prototype,"vpub_new",{configurable:!1,enumerable:!0,get:function(){return this._vpub_new},set:function(e){e instanceof o?(this._vpub_newBN=e,this._vpub_new=e.toNumber()):n.isString(e)?(this._vpub_new=parseInt(e),this._vpub_newBN=o.fromNumber(this._vpub_new)):(i.checkArgument(c.isNaturalNumber(e),"vpub_new is not a natural number"),this._vpub_newBN=o.fromNumber(e),this._vpub_new=e),i.checkState(c.isNaturalNumber(this._vpub_new),"vpub_new is not a natural number")}}),d.fromObject=function(e){i.checkArgument(n.isObject(e));var t=new d;return t._fromObject(e)},d.prototype._fromObject=function(e){var t=[];n.each(e.nullifiers,function(e){t.push(u.reverse(new s.Buffer(e,"hex")))});var r=[];n.each(e.commitments,function(e){r.push(u.reverse(new s.Buffer(e,"hex")))});var i=[];n.each(e.ciphertexts,function(e){i.push(new s.Buffer(e,"hex"))});var o=[];return n.each(e.macs,function(e){o.push(u.reverse(new s.Buffer(e,"hex")))}),this.vpub_old=e.vpub_old,this.vpub_new=e.vpub_new,this.anchor=u.reverse(new s.Buffer(e.anchor,"hex")),this.nullifiers=t,this.commitments=r,this.ephemeralKey=u.reverse(new s.Buffer(e.ephemeralKey,"hex")),this.ciphertexts=i,this.randomSeed=u.reverse(new s.Buffer(e.randomSeed,"hex")),this.macs=o,this.proof=f.fromObject(e.proof),this},d.prototype.toObject=d.prototype.toJSON=function e(){var t=[];n.each(this.nullifiers,function(e){t.push(u.reverse(e).toString("hex"))});var r=[];n.each(this.commitments,function(e){r.push(u.reverse(e).toString("hex"))});var i=[];n.each(this.ciphertexts,function(e){i.push(e.toString("hex"))});var o=[];n.each(this.macs,function(e){o.push(u.reverse(e).toString("hex"))});var s={vpub_old:this.vpub_old,vpub_new:this.vpub_new,anchor:u.reverse(this.anchor).toString("hex"),nullifiers:t,commitments:r,ephemeralKey:u.reverse(this.ephemeralKey).toString("hex"),ciphertexts:i,randomSeed:u.reverse(this.randomSeed).toString("hex"),macs:o,proof:this.proof.toObject()};return s},d.fromBufferReader=function(e){var t,r=new d;for(r.vpub_old=e.readUInt64LEBN(),r.vpub_new=e.readUInt64LEBN(),r.anchor=e.read(32),t=0;t<2;t++)r.nullifiers.push(e.read(32));for(t=0;t<2;t++)r.commitments.push(e.read(32));for(r.ephemeralKey=e.read(32),r.randomSeed=e.read(32),t=0;t<2;t++)r.macs.push(e.read(32));for(r.proof=f.fromBufferReader(e),t=0;t<2;t++)r.ciphertexts.push(e.read(601));return r},d.prototype.toBufferWriter=function(e){var t;for(e||(e=new a),e.writeUInt64LEBN(this._vpub_oldBN),e.writeUInt64LEBN(this._vpub_newBN),e.write(this.anchor),t=0;t<2;t++)e.write(this.nullifiers[t]);for(t=0;t<2;t++)e.write(this.commitments[t]);for(e.write(this.ephemeralKey),e.write(this.randomSeed),t=0;t<2;t++)e.write(this.macs[t]);for(this.proof.toBufferWriter(e),t=0;t<2;t++)e.write(this.ciphertexts[t]);return e},e.exports=d},function(e,t,r){"use strict";var n=r(20),i=r(0),o=r(58),s=2,a=10;function u(e){return this instanceof u?e?this._fromObject(e):void 0:new u(e)}function c(e){return this instanceof c?e?this._fromObject(e):void 0:new c(e)}function f(e){return this instanceof f?e?this._fromObject(e):void 0:new f(e)}u.fromObject=function(e){n.checkArgument(_.isObject(e));var t=new u;return t._fromObject(e)},u.prototype._fromObject=function(e){return this.y_lsb=e.y_lsb,this.x=new i.Buffer(e.x,"hex"),this},u.prototype.toObject=u.prototype.toJSON=function e(){var t={y_lsb:this.y_lsb,x:this.x.toString("hex")};return t},u.fromBufferReader=function(e){var t=new u,r=e.readUInt8();return t.y_lsb=1&r,t.x=e.read(32),t},u.prototype.toBufferWriter=function(e){return e||(e=new o),e.writeUInt8(2|this.y_lsb),e.write(this.x),e},c.fromObject=function(e){n.checkArgument(_.isObject(e));var t=new c;return t._fromObject(e)},c.prototype._fromObject=function(e){return this.y_gt=e.y_gt,this.x=new i.Buffer(e.x,"hex"),this},c.prototype.toObject=c.prototype.toJSON=function e(){var t={y_gt:this.y_gt,x:this.x.toString("hex")};return t},c.fromBufferReader=function(e){var t=new c,r=e.readUInt8();return t.y_gt=1&r,t.x=e.read(64),t},c.prototype.toBufferWriter=function(e){return e||(e=new o),e.writeUInt8(10|this.y_gt),e.write(this.x),e},f.fromObject=function(e){n.checkArgument(_.isObject(e));var t=new f;return t._fromObject(e)},f.prototype._fromObject=function(e){return this.g_A=u.fromObject(e.g_A),this.g_A_prime=u.fromObject(e.g_A_prime),this.g_B=c.fromObject(e.g_B),this.g_B_prime=u.fromObject(e.g_B_prime),this.g_C=u.fromObject(e.g_C),this.g_C_prime=u.fromObject(e.g_C_prime),this.g_K=u.fromObject(e.g_K),this.g_H=u.fromObject(e.g_H),this},f.prototype.toObject=f.prototype.toJSON=function e(){var t={g_A:this.g_A.toObject(),g_A_prime:this.g_A_prime.toObject(),g_B:this.g_B.toObject(),g_B_prime:this.g_B_prime.toObject(),g_C:this.g_C.toObject(),g_C_prime:this.g_C_prime.toObject(),g_K:this.g_K.toObject(),g_H:this.g_H.toObject()};return t},f.fromBufferReader=function(e){var t=new f;return t.g_A=u.fromBufferReader(e),t.g_A_prime=u.fromBufferReader(e),t.g_B=c.fromBufferReader(e),t.g_B_prime=u.fromBufferReader(e),t.g_C=u.fromBufferReader(e),t.g_C_prime=u.fromBufferReader(e),t.g_K=u.fromBufferReader(e),t.g_H=u.fromBufferReader(e),t},f.prototype.toBufferWriter=function(e){return e||(e=new o),this.g_A.toBufferWriter(e),this.g_A_prime.toBufferWriter(e),this.g_B.toBufferWriter(e),this.g_B_prime.toBufferWriter(e),this.g_C.toBufferWriter(e),this.g_C_prime.toBufferWriter(e),this.g_K.toBufferWriter(e),this.g_H.toBufferWriter(e),e},e.exports=f},function(e,t,r){"use strict";(function(t){var n=r(58),i=r(85),o=r(34),s=function e(r){if(!(this instanceof e))return new e(r);if(t.isBuffer(r))this.buf=r;else if("number"==typeof r){var n=r;this.fromNumber(n)}else if(r instanceof o){var i=r;this.fromBN(i)}else if(r){var s=r;this.set(s)}};s.prototype.set=function(e){return this.buf=e.buf||this.buf,this},s.prototype.fromString=function(e){return this.set({buf:new t(e,"hex")}),this},s.prototype.toString=function(){return this.buf.toString("hex")},s.prototype.fromBuffer=function(e){return this.buf=e,this},s.prototype.fromBufferReader=function(e){return this.buf=e.readVarintBuf(),this},s.prototype.fromBN=function(e){return this.buf=n().writeVarintBN(e).concat(),this},s.prototype.fromNumber=function(e){return this.buf=n().writeVarintNum(e).concat(),this},s.prototype.toBuffer=function(){return this.buf},s.prototype.toBN=function(){return i(this.buf).readVarintBN()},s.prototype.toNumber=function(){return i(this.buf).readVarintNum()},e.exports=s}).call(this,r(0).Buffer)},function(e,t,r){e.exports=r(881),e.exports.BlockHeader=r(180),e.exports.MerkleBlock=r(427)},function(e,t,r){"use strict";(function(t){var n=r(15),i=r(180),o=r(34),s=r(24),a=r(85),u=r(58),c=r(40),f=r(178),l=r(20);function h(e){return this instanceof h?(n.extend(this,h._from(e)),this):new h(e)}h.MAX_BLOCK_SIZE=1e6,h._from=function e(t){var r={};if(s.isBuffer(t))r=h._fromBufferReader(a(t));else{if(!n.isObject(t))throw new TypeError("Unrecognized argument for Block");r=h._fromObject(t)}return r},h._fromObject=function e(t){var r=[];t.transactions.forEach(function(e){e instanceof f?r.push(e):r.push(f().fromObject(e))});var n={header:i.fromObject(t.header),transactions:r};return n},h.fromObject=function e(t){var r=h._fromObject(t);return new h(r)},h._fromBufferReader=function e(t){var r={};l.checkState(!t.finished(),"No block data received"),r.header=i.fromBufferReader(t);var n=t.readVarintNum();r.transactions=[];for(var o=0;o<n;o++)r.transactions.push(f().fromBufferReader(t));return r},h.fromBufferReader=function e(t){l.checkArgument(t,"br is required");var r=h._fromBufferReader(t);return new h(r)},h.fromBuffer=function e(t){return h.fromBufferReader(new a(t))},h.fromString=function e(r){var n=new t(r,"hex");return h.fromBuffer(n)},h.fromRawBlock=function e(r){s.isBuffer(r)||(r=new t(r,"binary"));var n=a(r);n.pos=h.Values.START_OF_BLOCK;var i=h._fromBufferReader(n);return new h(i)},h.prototype.toObject=h.prototype.toJSON=function e(){var t=[];return this.transactions.forEach(function(e){t.push(e.toObject())}),{header:this.header.toObject(),transactions:t}},h.prototype.toBuffer=function e(){return this.toBufferWriter().concat()},h.prototype.toString=function e(){return this.toBuffer().toString("hex")},h.prototype.toBufferWriter=function e(t){t||(t=new u),t.write(this.header.toBuffer()),t.writeVarintNum(this.transactions.length);for(var r=0;r<this.transactions.length;r++)this.transactions[r].toBufferWriter(t);return t},h.prototype.getTransactionHashes=function e(){var t=[];if(0===this.transactions.length)return[h.Values.NULL_HASH];for(var r=0;r<this.transactions.length;r++)t.push(this.transactions[r]._getHash());return t},h.prototype.getMerkleTree=function e(){for(var r=this.getTransactionHashes(),n=0,i=this.transactions.length;i>1;i=Math.floor((i+1)/2)){for(var o=0;o<i;o+=2){var s=Math.min(o+1,i-1),a=t.concat([r[n+o],r[n+s]]);r.push(c.sha256sha256(a))}n+=i}return r},h.prototype.getMerkleRoot=function e(){var t=this.getMerkleTree();return t[t.length-1]},h.prototype.validMerkleRoot=function e(){var t=new o(this.header.merkleRoot.toString("hex"),"hex"),r=new o(this.getMerkleRoot().toString("hex"),"hex");return 0===t.cmp(r)},h.prototype._getHash=function(){return this.header._getHash()};var p={configurable:!1,enumerable:!0,get:function(){return this._id||(this._id=this.header.id),this._id},set:n.noop};Object.defineProperty(h.prototype,"id",p),Object.defineProperty(h.prototype,"hash",p),h.prototype.inspect=function e(){return"<Block "+this.id+">"},h.Values={START_OF_BLOCK:8,NULL_HASH:new t("0000000000000000000000000000000000000000000000000000000000000000","hex")},e.exports=h}).call(this,r(0).Buffer)},function(e,t,r){"use strict";var n=r(15),i=r(36),o=r(99),s=r(251),a=function(e,t){if(!(this instanceof a))return new a(e,t);if(this.extras={},this.knownParams=t||[],this.address=this.network=this.amount=this.message=null,"string"==typeof e){var r=a.parse(e);r.amount&&(r.amount=this._parseAmount(r.amount)),this._fromObject(r)}else{if("object"!=typeof e)throw new TypeError("Unrecognized data format.");this._fromObject(e)}};a.fromString=function e(t){if("string"!=typeof t)throw new TypeError("Expected a string");return new a(t)},a.fromObject=function e(t){return new a(t)},a.isValid=function(e,t){try{new a(e,t)}catch(e){return!1}return!0},a.parse=function(e){var t=i.parse(e,!0);if("zcash:"!==t.protocol)throw new TypeError("Invalid zcash URI");var r=/[^:]*:\/?\/?([^?]*)/.exec(e);return t.query.address=r&&r[1]||void 0,t.query},a.Members=["address","amount","message","label","r"],a.prototype._fromObject=function(e){if(!o.isValid(e.address))throw new TypeError("Invalid zcash address");for(var t in this.address=new o(e.address),this.network=this.address.network,this.amount=e.amount,e)if("address"!==t&&"amount"!==t){if(/^req-/.exec(t)&&-1===this.knownParams.indexOf(t))throw Error("Unknown required argument "+t);var r=a.Members.indexOf(t)>-1?this:this.extras;r[t]=e[t]}},a.prototype._parseAmount=function(e){if(e=Number(e),isNaN(e))throw new TypeError("Invalid amount");return s.fromBTC(e).toSatoshis()},a.prototype.toObject=a.prototype.toJSON=function e(){for(var t={},r=0;r<a.Members.length;r++){var i=a.Members[r];this.hasOwnProperty(i)&&void 0!==this[i]&&(t[i]=this[i].toString())}return n.extend(t,this.extras),t},a.prototype.toString=function(){var e={};return this.amount&&(e.amount=s.fromSatoshis(this.amount).toBTC()),this.message&&(e.message=this.message),this.label&&(e.label=this.label),this.r&&(e.r=this.r),n.extend(e,this.extras),i.format({protocol:"zcash:",host:this.address,query:e})},a.prototype.inspect=function(){return"<URI: "+this.toString()+">"},e.exports=a},function(e,t,r){"use strict";e.exports={SHA1:20,SHA256:32,SHA512:64}},function(e,t,r){"use strict";const n=r(885),i={16:"aes-128-ctr",32:"aes-256-ctr"};t.create=function(e,t,r){const o=i[e.length];if(!o)return r(new Error("Invalid key length"));const s=n.createCipheriv(o,e,t),a=n.createDecipheriv(o,e,t),u={encrypt(e,t){t(null,s.update(e))},decrypt(e,t){t(null,a.update(e))}};r(null,u)}},function(e,t,r){"use strict";const n=r(70);e.exports={createCipheriv:n.createCipheriv,createDecipheriv:n.createDecipheriv}},function(e,t,r){var n=r(431),i=r(435),o=r(2).Buffer,s=r(436),a=r(94),u=r(181),c=r(437),f=r(4);function l(e,t,r){a.call(this),this._cache=new p,this._cipher=new u.AES(t),this._prev=o.from(r),this._mode=e,this._autopadding=!0}f(l,a),l.prototype._update=function(e){var t,r;this._cache.add(e);for(var n=[];t=this._cache.get();)r=this._mode.encrypt(this,t),n.push(r);return o.concat(n)};var h=o.alloc(16,16);function p(){this.cache=o.allocUnsafe(0)}function d(e,t,r){var a=n[e.toLowerCase()];if(!a)throw new TypeError("invalid suite type");if("string"==typeof t&&(t=o.from(t)),t.length!==a.key/8)throw new TypeError("invalid key length "+t.length);if("string"==typeof r&&(r=o.from(r)),"GCM"!==a.mode&&r.length!==a.iv)throw new TypeError("invalid iv length "+r.length);return"stream"===a.type?new s(a.module,t,r):"auth"===a.type?new i(a.module,t,r):new l(a.module,t,r)}function y(e,t){var r=n[e.toLowerCase()];if(!r)throw new TypeError("invalid suite type");var i=c(t,!1,r.key,r.iv);return d(e,i.key,i.iv)}l.prototype._final=function(){var e=this._cache.flush();if(this._autopadding)return e=this._mode.encrypt(this,e),this._cipher.scrub(),e;if(!e.equals(h))throw this._cipher.scrub(),new Error("data not multiple of block length")},l.prototype.setAutoPadding=function(e){return this._autopadding=!!e,this},p.prototype.add=function(e){this.cache=o.concat([this.cache,e])},p.prototype.get=function(){if(this.cache.length>15){var e=this.cache.slice(0,16);return this.cache=this.cache.slice(16),e}return null},p.prototype.flush=function(){for(var e=16-this.cache.length,t=o.allocUnsafe(e),r=-1;++r<e;)t.writeUInt8(e,r);return o.concat([this.cache,t])},t.createCipheriv=d,t.createCipher=y},function(e,t){t.encrypt=function(e,t){return e._cipher.encryptBlock(t)},t.decrypt=function(e,t){return e._cipher.decryptBlock(t)}},function(e,t,r){var n=r(136);t.encrypt=function(e,t){var r=n(t,e._prev);return e._prev=e._cipher.encryptBlock(r),e._prev},t.decrypt=function(e,t){var r=e._prev;e._prev=t;var i=e._cipher.decryptBlock(t);return n(i,r)}},function(e,t,r){var n=r(2).Buffer,i=r(136);function o(e,t,r){var o=t.length,s=i(t,e._cache);return e._cache=e._cache.slice(o),e._prev=n.concat([e._prev,r?t:s]),s}t.encrypt=function(e,t,r){for(var i=n.allocUnsafe(0),s;t.length;){if(0===e._cache.length&&(e._cache=e._cipher.encryptBlock(e._prev),e._prev=n.allocUnsafe(0)),!(e._cache.length<=t.length)){i=n.concat([i,o(e,t,r)]);break}s=e._cache.length,i=n.concat([i,o(e,t.slice(0,s),r)]),t=t.slice(s)}return i}},function(e,t,r){var n=r(2).Buffer;function i(e,t,r){var i=e._cipher.encryptBlock(e._prev),o=i[0]^t;return e._prev=n.concat([e._prev.slice(1),n.from([r?t:o])]),o}t.encrypt=function(e,t,r){for(var o=t.length,s=n.allocUnsafe(o),a=-1;++a<o;)s[a]=i(e,t[a],r);return s}},function(e,t,r){var n=r(2).Buffer;function i(e,t,r){for(var n,i=-1,s=8,a=0,u,c;++i<8;)n=e._cipher.encryptBlock(e._prev),u=t&1<<7-i?128:0,c=n[0]^u,a+=(128&c)>>i%8,e._prev=o(e._prev,r?u:c);return a}function o(e,t){var r=e.length,i=-1,o=n.allocUnsafe(e.length);for(e=n.concat([e,n.from([t])]);++i<r;)o[i]=e[i]<<1|e[i+1]>>7;return o}t.encrypt=function(e,t,r){for(var o=t.length,s=n.allocUnsafe(o),a=-1;++a<o;)s[a]=i(e,t[a],r);return s}},function(e,t,r){(function(e){var n=r(136);function i(e){return e._prev=e._cipher.encryptBlock(e._prev),e._prev}t.encrypt=function(t,r){for(;t._cache.length<r.length;)t._cache=e.concat([t._cache,i(t)]);var o=t._cache.slice(0,r.length);return t._cache=t._cache.slice(r.length),n(r,o)}}).call(this,r(0).Buffer)},function(e,t,r){var n=r(2).Buffer,i=n.alloc(16,0);function o(e){return[e.readUInt32BE(0),e.readUInt32BE(4),e.readUInt32BE(8),e.readUInt32BE(12)]}function s(e){var t=n.allocUnsafe(16);return t.writeUInt32BE(e[0]>>>0,0),t.writeUInt32BE(e[1]>>>0,4),t.writeUInt32BE(e[2]>>>0,8),t.writeUInt32BE(e[3]>>>0,12),t}function a(e){this.h=e,this.state=n.alloc(16,0),this.cache=n.allocUnsafe(0)}a.prototype.ghash=function(e){for(var t=-1;++t<e.length;)this.state[t]^=e[t];this._multiply()},a.prototype._multiply=function(){for(var e=o(this.h),t=[0,0,0,0],r,n,i,a=-1;++a<128;){for(n=0!=(this.state[~~(a/8)]&1<<7-a%8),n&&(t[0]^=e[0],t[1]^=e[1],t[2]^=e[2],t[3]^=e[3]),i=0!=(1&e[3]),r=3;r>0;r--)e[r]=e[r]>>>1|(1&e[r-1])<<31;e[0]=e[0]>>>1,i&&(e[0]=e[0]^225<<24)}this.state=s(t)},a.prototype.update=function(e){var t;for(this.cache=n.concat([this.cache,e]);this.cache.length>=16;)t=this.cache.slice(0,16),this.cache=this.cache.slice(16),this.ghash(t)},a.prototype.final=function(e,t){return this.cache.length&&this.ghash(n.concat([this.cache,i],16)),this.ghash(s([0,e,0,t])),this.state},e.exports=a},function(e,t,r){var n=r(435),i=r(2).Buffer,o=r(431),s=r(436),a=r(94),u=r(181),c=r(437),f=r(4);function l(e,t,r){a.call(this),this._cache=new h,this._last=void 0,this._cipher=new u.AES(t),this._prev=i.from(r),this._mode=e,this._autopadding=!0}function h(){this.cache=i.allocUnsafe(0)}function p(e){var t=e[15];if(t<1||t>16)throw new Error("unable to decrypt data");for(var r=-1;++r<t;)if(e[r+(16-t)]!==t)throw new Error("unable to decrypt data");if(16!==t)return e.slice(0,16-t)}function d(e,t,r){var a=o[e.toLowerCase()];if(!a)throw new TypeError("invalid suite type");if("string"==typeof r&&(r=i.from(r)),"GCM"!==a.mode&&r.length!==a.iv)throw new TypeError("invalid iv length "+r.length);if("string"==typeof t&&(t=i.from(t)),t.length!==a.key/8)throw new TypeError("invalid key length "+t.length);return"stream"===a.type?new s(a.module,t,r,!0):"auth"===a.type?new n(a.module,t,r,!0):new l(a.module,t,r)}function y(e,t){var r=o[e.toLowerCase()];if(!r)throw new TypeError("invalid suite type");var n=c(t,!1,r.key,r.iv);return d(e,n.key,n.iv)}f(l,a),l.prototype._update=function(e){var t,r;this._cache.add(e);for(var n=[];t=this._cache.get(this._autopadding);)r=this._mode.decrypt(this,t),n.push(r);return i.concat(n)},l.prototype._final=function(){var e=this._cache.flush();if(this._autopadding)return p(this._mode.decrypt(this,e));if(e)throw new Error("data not multiple of block length")},l.prototype.setAutoPadding=function(e){return this._autopadding=!!e,this},h.prototype.add=function(e){this.cache=i.concat([this.cache,e])},h.prototype.get=function(e){var t;if(e){if(this.cache.length>16)return t=this.cache.slice(0,16),this.cache=this.cache.slice(16),t}else if(this.cache.length>=16)return t=this.cache.slice(0,16),this.cache=this.cache.slice(16),t;return null},h.prototype.flush=function(){if(this.cache.length)return this.cache},t.createDecipher=y,t.createDecipheriv=d},function(e,t,r){"use strict";(function(n){const i=r(12),o=i(r(255)),s=r(19);t=e.exports;const a={rsa:r(905),ed25519:r(919),secp256k1:r(72)(o,r(466))};function u(e){const t=a[e.toLowerCase()];return void 0!==t}t.supportedKeys=a,t.keysPBM=o,t.keyStretcher=r(932),t.generateEphemeralKeyPair=r(933),t.generateKeyPair=((e,t,r)=>{let n=a[e.toLowerCase()];if(!n)return r(new Error("invalid or unsupported key type"));n.generateKeyPair(t,r)}),t.generateKeyPairFromSeed=((e,t,r,n)=>{let i=a[e.toLowerCase()];return i?"ed25519"!==e.toLowerCase()?n(new Error("Seed key derivation is unimplemented for RSA or secp256k1")):void i.generateKeyPairFromSeed(t,r,n):n(new Error("invalid or unsupported key type"))}),t.unmarshalPublicKey=(e=>{const t=o.PublicKey.decode(e),r=t.Data;switch(t.Type){case o.KeyType.RSA:return a.rsa.unmarshalRsaPublicKey(r);case o.KeyType.Ed25519:return a.ed25519.unmarshalEd25519PublicKey(r);case o.KeyType.Secp256k1:if(a.secp256k1)return a.secp256k1.unmarshalSecp256k1PublicKey(r);throw new Error("secp256k1 support requires libp2p-crypto-secp256k1 package");default:throw new Error("invalid or unsupported key type")}}),t.marshalPublicKey=((e,t)=>{if(t=(t||"rsa").toLowerCase(),!u(t))throw new Error("invalid or unsupported key type");return e.bytes}),t.unmarshalPrivateKey=((e,t)=>{let r;try{r=o.PrivateKey.decode(e)}catch(e){return t(e)}const n=r.Data;switch(r.Type){case o.KeyType.RSA:return a.rsa.unmarshalRsaPrivateKey(n,t);case o.KeyType.Ed25519:return a.ed25519.unmarshalEd25519PrivateKey(n,t);case o.KeyType.Secp256k1:return a.secp256k1?a.secp256k1.unmarshalSecp256k1PrivateKey(n,t):t(new Error("secp256k1 support requires libp2p-crypto-secp256k1 package"));default:t(new Error("invalid or unsupported key type"))}}),t.marshalPrivateKey=((e,t)=>{if(t=(t||"rsa").toLowerCase(),!u(t))throw new Error("invalid or unsupported key type");return e.bytes}),t.import=((e,t,r)=>{try{const i=s.pki.decryptRsaPrivateKey(e,t);if(null===i)throw new Error("Cannot read the key, most likely the password is wrong or not a RSA key");let o=s.asn1.toDer(s.pki.privateKeyToAsn1(i));return o=n.from(o.getBytes(),"binary"),a.rsa.unmarshalRsaPrivateKey(o,r)}catch(e){r(e)}})}).call(this,r(0).Buffer)},function(e,t,r){(function(t){var r={};e.exports=r;var n={};function i(e,t){var r=0,n=t.length,i=t.charAt(0),o=[0];for(r=0;r<e.length();++r){for(var s=0,a=e.at(r);s<o.length;++s)a+=o[s]<<8,o[s]=a%n,a=a/n|0;for(;a>0;)o.push(a%n),a=a/n|0}var u="";for(r=0;0===e.at(r)&&r<e.length()-1;++r)u+=i;for(r=o.length-1;r>=0;--r)u+=t[o[r]];return u}r.encode=function(e,t,r){if("string"!=typeof t)throw new TypeError('"alphabet" must be a string.');if(void 0!==r&&"number"!=typeof r)throw new TypeError('"maxline" must be a number.');var n="";if(e instanceof Uint8Array){var o=0,s=t.length,a=t.charAt(0),u=[0];for(o=0;o<e.length;++o){for(var c=0,f=e[o];c<u.length;++c)f+=u[c]<<8,u[c]=f%s,f=f/s|0;for(;f>0;)u.push(f%s),f=f/s|0}for(o=0;0===e[o]&&o<e.length-1;++o)n+=a;for(o=u.length-1;o>=0;--o)n+=t[u[o]]}else n=i(e,t);if(r){var l=new RegExp(".{1,"+r+"}","g");n=n.match(l).join("\r\n")}return n},r.decode=function(e,r){if("string"!=typeof e)throw new TypeError('"input" must be a string.');if("string"!=typeof r)throw new TypeError('"alphabet" must be a string.');var i=n[r];if(!i){i=n[r]=[];for(var o=0;o<r.length;++o)i[r.charCodeAt(o)]=o}e=e.replace(/\s/g,"");for(var s=r.length,a=r.charAt(0),u=[0],o=0;o<e.length;o++){var c=i[e.charCodeAt(o)];if(void 0===c)return;for(var f=0,l=c;f<u.length;++f)l+=u[f]*s,u[f]=255&l,l>>=8;for(;l>0;)u.push(255&l),l>>=8}for(var h=0;e[h]===a&&h<e.length-1;++h)u.push(0);return void 0!==t?t.from(u.reverse()):new Uint8Array(u.reverse())}}).call(this,r(0).Buffer)},function(e,t,r){var n=r(11);r(100),r(439);var i=e.exports=n.tls;function o(e,t,r){var o=t.entity===n.tls.ConnectionEnd.client;e.read.cipherState={init:!1,cipher:n.cipher.createDecipher("AES-CBC",o?r.keys.server_write_key:r.keys.client_write_key),iv:o?r.keys.server_write_IV:r.keys.client_write_IV},e.write.cipherState={init:!1,cipher:n.cipher.createCipher("AES-CBC",o?r.keys.client_write_key:r.keys.server_write_key),iv:o?r.keys.client_write_IV:r.keys.server_write_IV},e.read.cipherFunction=f,e.write.cipherFunction=s,e.read.macLength=e.write.macLength=r.mac_length,e.read.macFunction=e.write.macFunction=i.hmac_sha1}function s(e,t){var r=!1,o=t.macFunction(t.macKey,t.sequenceNumber,e),s;e.fragment.putBytes(o),t.updateSequenceNumber(),s=e.version.minor===i.Versions.TLS_1_0.minor?t.cipherState.init?null:t.cipherState.iv:n.random.getBytesSync(16),t.cipherState.init=!0;var u=t.cipherState.cipher;return u.start({iv:s}),e.version.minor>=i.Versions.TLS_1_1.minor&&u.output.putBytes(s),u.update(e.fragment),u.finish(a)&&(e.fragment=u.output,e.length=e.fragment.length(),r=!0),r}function a(e,t,r){if(!r){var n=e-t.length()%e;t.fillWithByte(n-1,n)}return!0}function u(e,t,r){var n=!0;if(r){for(var i=t.length(),o=t.last(),s=i-1-o;s<i-1;++s)n=n&&t.at(s)==o;n&&t.truncate(o+1)}return n}i.CipherSuites.TLS_RSA_WITH_AES_128_CBC_SHA={id:[0,47],name:"TLS_RSA_WITH_AES_128_CBC_SHA",initSecurityParameters:function(e){e.bulk_cipher_algorithm=i.BulkCipherAlgorithm.aes,e.cipher_type=i.CipherType.block,e.enc_key_length=16,e.block_length=16,e.fixed_iv_length=16,e.record_iv_length=16,e.mac_algorithm=i.MACAlgorithm.hmac_sha1,e.mac_length=20,e.mac_key_length=20},initConnectionState:o},i.CipherSuites.TLS_RSA_WITH_AES_256_CBC_SHA={id:[0,53],name:"TLS_RSA_WITH_AES_256_CBC_SHA",initSecurityParameters:function(e){e.bulk_cipher_algorithm=i.BulkCipherAlgorithm.aes,e.cipher_type=i.CipherType.block,e.enc_key_length=32,e.block_length=16,e.fixed_iv_length=16,e.record_iv_length=16,e.mac_algorithm=i.MACAlgorithm.hmac_sha1,e.mac_length=20,e.mac_key_length=20},initConnectionState:o};var c=0;function f(e,t){var r=!1,o;++c,o=e.version.minor===i.Versions.TLS_1_0.minor?t.cipherState.init?null:t.cipherState.iv:e.fragment.getBytes(16),t.cipherState.init=!0;var s=t.cipherState.cipher;s.start({iv:o}),s.update(e.fragment),r=s.finish(u);var a=t.macLength,f=n.random.getBytesSync(a),h=s.output.length();h>=a?(e.fragment=s.output.getBytes(h-a),f=s.output.getBytes(a)):e.fragment=s.output.getBytes(),e.fragment=n.util.createBuffer(e.fragment),e.length=e.fragment.length();var p=t.macFunction(t.macKey,t.sequenceNumber,e);return t.updateSequenceNumber(),r=l(t.macKey,f,p)&&r,r}function l(e,t,r){var i=n.hmac.create();return i.start("SHA1",e),i.update(t),t=i.digest().getBytes(),i.start(null,null),i.update(r),r=i.digest().getBytes(),t===r}},function(e,t,r){var n=r(11);r(450),e.exports=n.mgf=n.mgf||{},n.mgf.mgf1=n.mgf1},function(e,t,r){(function(t){var n=r(11);if(r(184),r(63),r(452),r(16),void 0===i)var i=n.jsbn.BigInteger;var o=n.util.ByteBuffer,s=void 0===t?Uint8Array:t;n.pki=n.pki||{},e.exports=n.pki.ed25519=n.ed25519=n.ed25519||{};var a=n.ed25519;function u(e){var r=e.message;if(r instanceof Uint8Array)return r;var n=e.encoding;if(void 0===r){if(!e.md)throw new TypeError('"options.message" or "options.md" not specified.');r=e.md.digest().getBytes(),n="binary"}if("string"==typeof r&&!n)throw new TypeError('"options.encoding" must be "binary" or "utf8".');if("string"==typeof r){if(void 0!==t)return new t(r,n);r=new o(r,n)}else if(!(r instanceof o))throw new TypeError('"options.message" must be a node.js Buffer, a Uint8Array, a forge ByteBuffer, or a string with "options.encoding" specifying its encoding.');for(var i=new s(r.length()),a=0;a<i.length;++a)i[a]=r.at(a);return i}a.constants={},a.constants.PUBLIC_KEY_BYTE_LENGTH=32,a.constants.PRIVATE_KEY_BYTE_LENGTH=64,a.constants.SEED_BYTE_LENGTH=32,a.constants.SIGN_BYTE_LENGTH=64,a.constants.HASH_BYTE_LENGTH=64,a.generateKeyPair=function(e){e=e||{};var t=e.seed;if(void 0===t)t=n.random.getBytesSync(a.constants.SEED_BYTE_LENGTH);else if("string"==typeof t){if(t.length!==a.constants.SEED_BYTE_LENGTH)throw new TypeError('"seed" must be '+a.constants.SEED_BYTE_LENGTH+" bytes in length.")}else if(!(t instanceof Uint8Array))throw new TypeError('"seed" must be a node.js Buffer, Uint8Array, or a binary string.');t=u({message:t,encoding:"binary"});for(var r=new s(a.constants.PUBLIC_KEY_BYTE_LENGTH),i=new s(a.constants.PRIVATE_KEY_BYTE_LENGTH),o=0;o<32;++o)i[o]=t[o];return b(r,i),{publicKey:r,privateKey:i}},a.publicKeyFromPrivateKey=function(e){e=e||{};var t=u({message:e.privateKey,encoding:"binary"});if(t.length!==a.constants.PRIVATE_KEY_BYTE_LENGTH)throw new TypeError('"options.privateKey" must have a byte length of '+a.constants.PRIVATE_KEY_BYTE_LENGTH);for(var r=new s(a.constants.PUBLIC_KEY_BYTE_LENGTH),n=0;n<r.length;++n)r[n]=t[32+n];return r},a.sign=function(e){e=e||{};var t=u(e),r=u({message:e.privateKey,encoding:"binary"});if(r.length!==a.constants.PRIVATE_KEY_BYTE_LENGTH)throw new TypeError('"options.privateKey" must have a byte length of '+a.constants.PRIVATE_KEY_BYTE_LENGTH);var n=new s(a.constants.SIGN_BYTE_LENGTH+t.length);v(n,t,t.length,r);for(var i=new s(a.constants.SIGN_BYTE_LENGTH),o=0;o<i.length;++o)i[o]=n[o];return i},a.verify=function(e){e=e||{};var t=u(e);if(void 0===e.signature)throw new TypeError('"options.signature" must be a node.js Buffer, a Uint8Array, a forge ByteBuffer, or a binary string.');var r=u({message:e.signature,encoding:"binary"});if(r.length!==a.constants.SIGN_BYTE_LENGTH)throw new TypeError('"options.signature" must have a byte length of '+a.constants.SIGN_BYTE_LENGTH);var n=u({message:e.publicKey,encoding:"binary"});if(n.length!==a.constants.PUBLIC_KEY_BYTE_LENGTH)throw new TypeError('"options.publicKey" must have a byte length of '+a.constants.PUBLIC_KEY_BYTE_LENGTH);var i=new s(a.constants.SIGN_BYTE_LENGTH+t.length),o=new s(a.constants.SIGN_BYTE_LENGTH+t.length),c;for(c=0;c<a.constants.SIGN_BYTE_LENGTH;++c)i[c]=r[c];for(c=0;c<t.length;++c)i[c+a.constants.SIGN_BYTE_LENGTH]=t[c];return _(o,i,i.length,n)>=0};var c=U(),f=U([1]),l=U([30883,4953,19914,30187,55467,16705,2637,112,59544,30585,16505,36039,65139,11119,27886,20995]),h=U([61785,9906,39828,60374,45398,33411,5274,224,53552,61171,33010,6542,64743,22239,55772,9222]),p=U([54554,36645,11616,51542,42930,38181,51040,26924,56412,64982,57905,49316,21502,52590,14035,8553]),d=U([26200,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214]),y=new Float64Array([237,211,245,92,26,99,18,88,214,156,247,162,222,249,222,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16]),g=U([41136,18958,6951,50414,58488,44335,6150,12099,55207,15867,153,11085,57099,20417,9344,11139]);function m(e,r){var i=n.md.sha512.create(),u=new o(e);i.update(u.getBytes(r),"binary");var c=i.digest().getBytes();if(void 0!==t)return new t(c,"binary");for(var f=new s(a.constants.HASH_BYTE_LENGTH),l=0;l<64;++l)f[l]=c.charCodeAt(l);return f}function b(e,t){var r=[U(),U(),U(),U()],n,i=m(t,32);for(i[0]&=248,i[31]&=127,i[31]|=64,L(r,i),A(e,r),n=0;n<32;++n)t[n+32]=e[n];return 0}function v(e,t,r,n){var i,o,s=new Float64Array(64),a=[U(),U(),U(),U()],u=m(n,32);u[0]&=248,u[31]&=127,u[31]|=64;var c=r+64;for(i=0;i<r;++i)e[64+i]=t[i];for(i=0;i<32;++i)e[32+i]=u[32+i];var f=m(e.subarray(32),r+32);for(S(f),L(a,f),A(e,a),i=32;i<64;++i)e[i]=n[i];var l=m(e,r+64);for(S(l),i=32;i<64;++i)s[i]=0;for(i=0;i<32;++i)s[i]=f[i];for(i=0;i<32;++i)for(o=0;o<32;o++)s[i+o]+=l[i]*u[o];return w(e.subarray(32),s),c}function _(e,t,r,n){var i,o,a=new s(32),u=[U(),U(),U(),U()],c=[U(),U(),U(),U()];if(o=-1,r<64)return-1;if(I(c,n))return-1;for(i=0;i<r;++i)e[i]=t[i];for(i=0;i<32;++i)e[i+32]=n[i];var f=m(e,r);if(S(f),N(u,c,f),L(c,t.subarray(32)),k(u,c),A(a,u),r-=64,P(t,0,a,0)){for(i=0;i<r;++i)e[i]=0;return-1}for(i=0;i<r;++i)e[i]=t[i+64];return o=r,o}function w(e,t){var r,n,i,o;for(n=63;n>=32;--n){for(r=0,i=n-32,o=n-12;i<o;++i)t[i]+=r-16*t[n]*y[i-(n-32)],r=t[i]+128>>8,t[i]-=256*r;t[i]+=r,t[n]=0}for(r=0,i=0;i<32;++i)t[i]+=r-(t[31]>>4)*y[i],r=t[i]>>8,t[i]&=255;for(i=0;i<32;++i)t[i]-=r*y[i];for(n=0;n<32;++n)t[n+1]+=t[n]>>8,e[n]=255&t[n]}function S(e){for(var t=new Float64Array(64),r=0;r<64;++r)t[r]=e[r],e[r]=0;w(e,t)}function k(e,t){var r=U(),n=U(),i=U(),o=U(),s=U(),a=U(),u=U(),c=U(),f=U();q(r,e[1],e[0]),q(f,t[1],t[0]),z(r,r,f),F(n,e[0],e[1]),F(f,t[0],t[1]),z(n,n,f),z(i,e[3],t[3]),z(i,i,h),z(o,e[2],t[2]),F(o,o,o),q(s,n,r),q(a,o,i),F(u,o,i),F(c,n,r),z(e[0],s,a),z(e[1],c,u),z(e[2],u,a),z(e[3],s,c)}function E(e,t,r){for(var n=0;n<4;++n)D(e[n],t[n],r)}function A(e,t){var r=U(),n=U(),i=U();M(i,t[2]),z(r,t[0],i),z(n,t[1],i),x(e,n),e[31]^=R(r)<<7}function x(e,t){var r,n,i,o=U(),s=U();for(r=0;r<16;++r)s[r]=t[r];for(K(s),K(s),K(s),n=0;n<2;++n){for(o[0]=s[0]-65517,r=1;r<15;++r)o[r]=s[r]-65535-(o[r-1]>>16&1),o[r-1]&=65535;o[15]=s[15]-32767-(o[14]>>16&1),i=o[15]>>16&1,o[14]&=65535,D(s,o,1-i)}for(r=0;r<16;r++)e[2*r]=255&s[r],e[2*r+1]=s[r]>>8}function I(e,t){var r=U(),n=U(),i=U(),o=U(),s=U(),a=U(),u=U();return j(e[2],f),T(e[1],t),H(i,e[1]),z(o,i,l),q(i,i,e[2]),F(o,e[2],o),H(s,o),H(a,s),z(u,a,s),z(r,u,i),z(r,r,o),B(r,r),z(r,r,i),z(r,r,o),z(r,r,o),z(e[0],r,o),H(n,e[0]),z(n,n,o),C(n,i)&&z(e[0],e[0],g),H(n,e[0]),z(n,n,o),C(n,i)?-1:(R(e[0])===t[31]>>7&&q(e[0],c,e[0]),z(e[3],e[0],e[1]),0)}function T(e,t){var r;for(r=0;r<16;++r)e[r]=t[2*r]+(t[2*r+1]<<8);e[15]&=32767}function B(e,t){var r=U(),n;for(n=0;n<16;++n)r[n]=t[n];for(n=250;n>=0;--n)H(r,r),1!==n&&z(r,r,t);for(n=0;n<16;++n)e[n]=r[n]}function C(e,t){var r=new s(32),n=new s(32);return x(r,e),x(n,t),P(r,0,n,0)}function P(e,t,r,n){return O(e,t,r,n,32)}function O(e,t,r,n,i){var o,s=0;for(o=0;o<i;++o)s|=e[t+o]^r[n+o];return(1&s-1>>>8)-1}function R(e){var t=new s(32);return x(t,e),1&t[0]}function N(e,t,r){var n,i;for(j(e[0],c),j(e[1],f),j(e[2],f),j(e[3],c),i=255;i>=0;--i)n=r[i/8|0]>>(7&i)&1,E(e,t,n),k(t,e),k(e,e),E(e,t,n)}function L(e,t){var r=[U(),U(),U(),U()];j(r[0],p),j(r[1],d),j(r[2],f),z(r[3],p,d),N(e,r,t)}function j(e,t){var r;for(r=0;r<16;r++)e[r]=0|t[r]}function M(e,t){var r=U(),n;for(n=0;n<16;++n)r[n]=t[n];for(n=253;n>=0;--n)H(r,r),2!==n&&4!==n&&z(r,r,t);for(n=0;n<16;++n)e[n]=r[n]}function K(e){var t,r,n=1;for(t=0;t<16;++t)r=e[t]+n+65535,n=Math.floor(r/65536),e[t]=r-65536*n;e[0]+=n-1+37*(n-1)}function D(e,t,r){for(var n,i=~(r-1),o=0;o<16;++o)n=i&(e[o]^t[o]),e[o]^=n,t[o]^=n}function U(e){var t,r=new Float64Array(16);if(e)for(t=0;t<e.length;++t)r[t]=e[t];return r}function F(e,t,r){for(var n=0;n<16;++n)e[n]=t[n]+r[n]}function q(e,t,r){for(var n=0;n<16;++n)e[n]=t[n]-r[n]}function H(e,t){z(e,t,t)}function z(e,t,r){var n,i,o=0,s=0,a=0,u=0,c=0,f=0,l=0,h=0,p=0,d=0,y=0,g=0,m=0,b=0,v=0,_=0,w=0,S=0,k=0,E=0,A=0,x=0,I=0,T=0,B=0,C=0,P=0,O=0,R=0,N=0,L=0,j=r[0],M=r[1],K=r[2],D=r[3],U=r[4],F=r[5],q=r[6],H=r[7],z=r[8],V=r[9],G=r[10],W=r[11],$=r[12],Y=r[13],J=r[14],X=r[15];n=t[0],o+=n*j,s+=n*M,a+=n*K,u+=n*D,c+=n*U,f+=n*F,l+=n*q,h+=n*H,p+=n*z,d+=n*V,y+=n*G,g+=n*W,m+=n*$,b+=n*Y,v+=n*J,_+=n*X,n=t[1],s+=n*j,a+=n*M,u+=n*K,c+=n*D,f+=n*U,l+=n*F,h+=n*q,p+=n*H,d+=n*z,y+=n*V,g+=n*G,m+=n*W,b+=n*$,v+=n*Y,_+=n*J,w+=n*X,n=t[2],a+=n*j,u+=n*M,c+=n*K,f+=n*D,l+=n*U,h+=n*F,p+=n*q,d+=n*H,y+=n*z,g+=n*V,m+=n*G,b+=n*W,v+=n*$,_+=n*Y,w+=n*J,S+=n*X,n=t[3],u+=n*j,c+=n*M,f+=n*K,l+=n*D,h+=n*U,p+=n*F,d+=n*q,y+=n*H,g+=n*z,m+=n*V,b+=n*G,v+=n*W,_+=n*$,w+=n*Y,S+=n*J,k+=n*X,n=t[4],c+=n*j,f+=n*M,l+=n*K,h+=n*D,p+=n*U,d+=n*F,y+=n*q,g+=n*H,m+=n*z,b+=n*V,v+=n*G,_+=n*W,w+=n*$,S+=n*Y,k+=n*J,E+=n*X,n=t[5],f+=n*j,l+=n*M,h+=n*K,p+=n*D,d+=n*U,y+=n*F,g+=n*q,m+=n*H,b+=n*z,v+=n*V,_+=n*G,w+=n*W,S+=n*$,k+=n*Y,E+=n*J,A+=n*X,n=t[6],l+=n*j,h+=n*M,p+=n*K,d+=n*D,y+=n*U,g+=n*F,m+=n*q,b+=n*H,v+=n*z,_+=n*V,w+=n*G,S+=n*W,k+=n*$,E+=n*Y,A+=n*J,x+=n*X,n=t[7],h+=n*j,p+=n*M,d+=n*K,y+=n*D,g+=n*U,m+=n*F,b+=n*q,v+=n*H,_+=n*z,w+=n*V,S+=n*G,k+=n*W,E+=n*$,A+=n*Y,x+=n*J,I+=n*X,n=t[8],p+=n*j,d+=n*M,y+=n*K,g+=n*D,m+=n*U,b+=n*F,v+=n*q,_+=n*H,w+=n*z,S+=n*V,k+=n*G,E+=n*W,A+=n*$,x+=n*Y,I+=n*J,T+=n*X,n=t[9],d+=n*j,y+=n*M,g+=n*K,m+=n*D,b+=n*U,v+=n*F,_+=n*q,w+=n*H,S+=n*z,k+=n*V,E+=n*G,A+=n*W,x+=n*$,I+=n*Y,T+=n*J,B+=n*X,n=t[10],y+=n*j,g+=n*M,m+=n*K,b+=n*D,v+=n*U,_+=n*F,w+=n*q,S+=n*H,k+=n*z,E+=n*V,A+=n*G,x+=n*W,I+=n*$,T+=n*Y,B+=n*J,C+=n*X,n=t[11],g+=n*j,m+=n*M,b+=n*K,v+=n*D,_+=n*U,w+=n*F,S+=n*q,k+=n*H,E+=n*z,A+=n*V,x+=n*G,I+=n*W,T+=n*$,B+=n*Y,C+=n*J,P+=n*X,n=t[12],m+=n*j,b+=n*M,v+=n*K,_+=n*D,w+=n*U,S+=n*F,k+=n*q,E+=n*H,A+=n*z,x+=n*V,I+=n*G,T+=n*W,B+=n*$,C+=n*Y,P+=n*J,O+=n*X,n=t[13],b+=n*j,v+=n*M,_+=n*K,w+=n*D,S+=n*U,k+=n*F,E+=n*q,A+=n*H,x+=n*z,I+=n*V,T+=n*G,B+=n*W,C+=n*$,P+=n*Y,O+=n*J,R+=n*X,n=t[14],v+=n*j,_+=n*M,w+=n*K,S+=n*D,k+=n*U,E+=n*F,A+=n*q,x+=n*H,I+=n*z,T+=n*V,B+=n*G,C+=n*W,P+=n*$,O+=n*Y,R+=n*J,N+=n*X,n=t[15],_+=n*j,w+=n*M,S+=n*K,k+=n*D,E+=n*U,A+=n*F,x+=n*q,I+=n*H,T+=n*z,B+=n*V,C+=n*G,P+=n*W,O+=n*$,R+=n*Y,N+=n*J,L+=n*X,o+=38*w,s+=38*S,a+=38*k,u+=38*E,c+=38*A,f+=38*x,l+=38*I,h+=38*T,p+=38*B,d+=38*C,y+=38*P,g+=38*O,m+=38*R,b+=38*N,v+=38*L,i=1,n=o+i+65535,i=Math.floor(n/65536),o=n-65536*i,n=s+i+65535,i=Math.floor(n/65536),s=n-65536*i,n=a+i+65535,i=Math.floor(n/65536),a=n-65536*i,n=u+i+65535,i=Math.floor(n/65536),u=n-65536*i,n=c+i+65535,i=Math.floor(n/65536),c=n-65536*i,n=f+i+65535,i=Math.floor(n/65536),f=n-65536*i,n=l+i+65535,i=Math.floor(n/65536),l=n-65536*i,n=h+i+65535,i=Math.floor(n/65536),h=n-65536*i,n=p+i+65535,i=Math.floor(n/65536),p=n-65536*i,n=d+i+65535,i=Math.floor(n/65536),d=n-65536*i,n=y+i+65535,i=Math.floor(n/65536),y=n-65536*i,n=g+i+65535,i=Math.floor(n/65536),g=n-65536*i,n=m+i+65535,i=Math.floor(n/65536),m=n-65536*i,n=b+i+65535,i=Math.floor(n/65536),b=n-65536*i,n=v+i+65535,i=Math.floor(n/65536),v=n-65536*i,n=_+i+65535,i=Math.floor(n/65536),_=n-65536*i,o+=i-1+37*(i-1),i=1,n=o+i+65535,i=Math.floor(n/65536),o=n-65536*i,n=s+i+65535,i=Math.floor(n/65536),s=n-65536*i,n=a+i+65535,i=Math.floor(n/65536),a=n-65536*i,n=u+i+65535,i=Math.floor(n/65536),u=n-65536*i,n=c+i+65535,i=Math.floor(n/65536),c=n-65536*i,n=f+i+65535,i=Math.floor(n/65536),f=n-65536*i,n=l+i+65535,i=Math.floor(n/65536),l=n-65536*i,n=h+i+65535,i=Math.floor(n/65536),h=n-65536*i,n=p+i+65535,i=Math.floor(n/65536),p=n-65536*i,n=d+i+65535,i=Math.floor(n/65536),d=n-65536*i,n=y+i+65535,i=Math.floor(n/65536),y=n-65536*i,n=g+i+65535,i=Math.floor(n/65536),g=n-65536*i,n=m+i+65535,i=Math.floor(n/65536),m=n-65536*i,n=b+i+65535,i=Math.floor(n/65536),b=n-65536*i,n=v+i+65535,i=Math.floor(n/65536),v=n-65536*i,n=_+i+65535,i=Math.floor(n/65536),_=n-65536*i,o+=i-1+37*(i-1),e[0]=o,e[1]=s,e[2]=a,e[3]=u,e[4]=c,e[5]=f,e[6]=l,e[7]=h,e[8]=p,e[9]=d,e[10]=y,e[11]=g,e[12]=m,e[13]=b,e[14]=v,e[15]=_}}).call(this,r(0).Buffer)},function(e,t,r){var n=r(11);r(16),r(63),r(184),e.exports=n.kem=n.kem||{};var i=n.jsbn.BigInteger;function o(e,t,r,i){e.generate=function(e,o){for(var s=new n.util.ByteBuffer,a=Math.ceil(o/i)+r,u=new n.util.ByteBuffer,c=r;c<a;++c){u.putInt32(c),t.start(),t.update(e+u.getBytes());var f=t.digest();s.putBytes(f.getBytes(i))}return s.truncate(s.length()-o),s.getBytes()}}n.kem.rsa={},n.kem.rsa.create=function(e,t){t=t||{};var r=t.prng||n.random,o={encrypt:function(t,o){var s=Math.ceil(t.n.bitLength()/8),a;do{a=new i(n.util.bytesToHex(r.getBytesSync(s)),16).mod(t.n)}while(a.equals(i.ZERO));a=n.util.hexToBytes(a.toString(16));var u=s-a.length;u>0&&(a=n.util.fillString(String.fromCharCode(0),u)+a);var c=t.encrypt(a,"NONE"),f=e.generate(a,o);return{encapsulation:c,key:f}},decrypt:function(t,r,n){var i=t.decrypt(r,"NONE");return e.generate(i,n)}};return o},n.kem.kdf1=function(e,t){o(this,e,0,t||e.digestLength)},n.kem.kdf2=function(e,t){o(this,e,1,t||e.digestLength)}},function(e,t,r){e.exports=r(78),r(257),r(138),r(443),r(452)},function(e,t,r){var n=r(11);r(100),r(77),r(182),r(101),r(114),r(449),r(63),r(16),r(259);var i=n.asn1,o=e.exports=n.pkcs7=n.pkcs7||{};function s(e){var t={},r=[];if(!i.validate(e,o.asn1.recipientInfoValidator,t,r)){var s=new Error("Cannot read PKCS#7 RecipientInfo. ASN.1 object is not an PKCS#7 RecipientInfo.");throw s.errors=r,s}return{version:t.version.charCodeAt(0),issuer:n.pki.RDNAttributesAsArray(t.issuer),serialNumber:n.util.createBuffer(t.serial).toHex(),encryptedContent:{algorithm:i.derToOid(t.encAlgorithm),parameter:t.encParameter.value,content:t.encKey}}}function a(e){return i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[i.create(i.Class.UNIVERSAL,i.Type.INTEGER,!1,i.integerToDer(e.version).getBytes()),i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[n.pki.distinguishedNameToAsn1({attributes:e.issuer}),i.create(i.Class.UNIVERSAL,i.Type.INTEGER,!1,n.util.hexToBytes(e.serialNumber))]),i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[i.create(i.Class.UNIVERSAL,i.Type.OID,!1,i.oidToDer(e.encryptedContent.algorithm).getBytes()),i.create(i.Class.UNIVERSAL,i.Type.NULL,!1,"")]),i.create(i.Class.UNIVERSAL,i.Type.OCTETSTRING,!1,e.encryptedContent.content)])}function u(e){for(var t=[],r=0;r<e.length;++r)t.push(s(e[r]));return t}function c(e){for(var t=[],r=0;r<e.length;++r)t.push(a(e[r]));return t}function f(e){var t={},r=[];if(!i.validate(e,o.asn1.signerInfoValidator,t,r)){var s=new Error("Cannot read PKCS#7 SignerInfo. ASN.1 object is not an PKCS#7 SignerInfo.");throw s.errors=r,s}var a={version:t.version.charCodeAt(0),issuer:n.pki.RDNAttributesAsArray(t.issuer),serialNumber:n.util.createBuffer(t.serial).toHex(),digestAlgorithm:i.derToOid(t.digestAlgorithm),signatureAlgorithm:i.derToOid(t.signatureAlgorithm),signature:t.signature,authenticatedAttributes:[],unauthenticatedAttributes:[]},u=t.authenticatedAttributes||[],c=t.unauthenticatedAttributes||[];return a}function l(e){var t=i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[i.create(i.Class.UNIVERSAL,i.Type.INTEGER,!1,i.integerToDer(e.version).getBytes()),i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[n.pki.distinguishedNameToAsn1({attributes:e.issuer}),i.create(i.Class.UNIVERSAL,i.Type.INTEGER,!1,n.util.hexToBytes(e.serialNumber))]),i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[i.create(i.Class.UNIVERSAL,i.Type.OID,!1,i.oidToDer(e.digestAlgorithm).getBytes()),i.create(i.Class.UNIVERSAL,i.Type.NULL,!1,"")])]);if(e.authenticatedAttributesAsn1&&t.value.push(e.authenticatedAttributesAsn1),t.value.push(i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[i.create(i.Class.UNIVERSAL,i.Type.OID,!1,i.oidToDer(e.signatureAlgorithm).getBytes()),i.create(i.Class.UNIVERSAL,i.Type.NULL,!1,"")])),t.value.push(i.create(i.Class.UNIVERSAL,i.Type.OCTETSTRING,!1,e.signature)),e.unauthenticatedAttributes.length>0){for(var r=i.create(i.Class.CONTEXT_SPECIFIC,1,!0,[]),o=0;o<e.unauthenticatedAttributes.length;++o){var s=e.unauthenticatedAttributes[o];r.values.push(d(s))}t.value.push(r)}return t}function h(e){for(var t=[],r=0;r<e.length;++r)t.push(f(e[r]));return t}function p(e){for(var t=[],r=0;r<e.length;++r)t.push(l(e[r]));return t}function d(e){var t;if(e.type===n.pki.oids.contentType)t=i.create(i.Class.UNIVERSAL,i.Type.OID,!1,i.oidToDer(e.value).getBytes());else if(e.type===n.pki.oids.messageDigest)t=i.create(i.Class.UNIVERSAL,i.Type.OCTETSTRING,!1,e.value.bytes());else if(e.type===n.pki.oids.signingTime){var r=new Date("1950-01-01T00:00:00Z"),o=new Date("2050-01-01T00:00:00Z"),s=e.value;if("string"==typeof s){var a=Date.parse(s);s=isNaN(a)?13===s.length?i.utcTimeToDate(s):i.generalizedTimeToDate(s):new Date(a)}t=s>=r&&s<o?i.create(i.Class.UNIVERSAL,i.Type.UTCTIME,!1,i.dateToUtcTime(s)):i.create(i.Class.UNIVERSAL,i.Type.GENERALIZEDTIME,!1,i.dateToGeneralizedTime(s))}return i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[i.create(i.Class.UNIVERSAL,i.Type.OID,!1,i.oidToDer(e.type).getBytes()),i.create(i.Class.UNIVERSAL,i.Type.SET,!0,[t])])}function y(e){return[i.create(i.Class.UNIVERSAL,i.Type.OID,!1,i.oidToDer(n.pki.oids.data).getBytes()),i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[i.create(i.Class.UNIVERSAL,i.Type.OID,!1,i.oidToDer(e.algorithm).getBytes()),i.create(i.Class.UNIVERSAL,i.Type.OCTETSTRING,!1,e.parameter.getBytes())]),i.create(i.Class.CONTEXT_SPECIFIC,0,!0,[i.create(i.Class.UNIVERSAL,i.Type.OCTETSTRING,!1,e.content.getBytes())])]}function g(e,t,r){var o={},s=[];if(!i.validate(t,r,o,s)){var a=new Error("Cannot read PKCS#7 message. ASN.1 object is not a supported PKCS#7 message.");throw a.errors=a,a}var u=i.derToOid(o.contentType);if(u!==n.pki.oids.data)throw new Error("Unsupported PKCS#7 message. Only wrapped ContentType Data supported.");if(o.encryptedContent){var c="";if(n.util.isArray(o.encryptedContent))for(var f=0;f<o.encryptedContent.length;++f){if(o.encryptedContent[f].type!==i.Type.OCTETSTRING)throw new Error("Malformed PKCS#7 message, expecting encrypted content constructed of only OCTET STRING objects.");c+=o.encryptedContent[f].value}else c=o.encryptedContent;e.encryptedContent={algorithm:i.derToOid(o.encAlgorithm),parameter:n.util.createBuffer(o.encParameter.value),content:n.util.createBuffer(c)}}if(o.content){var c="";if(n.util.isArray(o.content))for(var f=0;f<o.content.length;++f){if(o.content[f].type!==i.Type.OCTETSTRING)throw new Error("Malformed PKCS#7 message, expecting content constructed of only OCTET STRING objects.");c+=o.content[f].value}else c=o.content;e.content=n.util.createBuffer(c)}return e.version=o.version.charCodeAt(0),e.rawCapture=o,o}function m(e){if(void 0===e.encryptedContent.key)throw new Error("Symmetric key not available.");if(void 0===e.content){var t;switch(e.encryptedContent.algorithm){case n.pki.oids["aes128-CBC"]:case n.pki.oids["aes192-CBC"]:case n.pki.oids["aes256-CBC"]:t=n.aes.createDecryptionCipher(e.encryptedContent.key);break;case n.pki.oids.desCBC:case n.pki.oids["des-EDE3-CBC"]:t=n.des.createDecryptionCipher(e.encryptedContent.key);break;default:throw new Error("Unsupported symmetric cipher, OID "+e.encryptedContent.algorithm)}if(t.start(e.encryptedContent.parameter),t.update(e.encryptedContent.content),!t.finish())throw new Error("Symmetric decryption failed.");e.content=t.output}}o.messageFromPem=function(e){var t=n.pem.decode(e)[0];if("PKCS7"!==t.type){var r=new Error('Could not convert PKCS#7 message from PEM; PEM header type is not "PKCS#7".');throw r.headerType=t.type,r}if(t.procType&&"ENCRYPTED"===t.procType.type)throw new Error("Could not convert PKCS#7 message from PEM; PEM is encrypted.");var s=i.fromDer(t.body);return o.messageFromAsn1(s)},o.messageToPem=function(e,t){var r={type:"PKCS7",body:i.toDer(e.toAsn1()).getBytes()};return n.pem.encode(r,{maxline:t})},o.messageFromAsn1=function(e){var t={},r=[];if(!i.validate(e,o.asn1.contentInfoValidator,t,r)){var s=new Error("Cannot read PKCS#7 message. ASN.1 object is not an PKCS#7 ContentInfo.");throw s.errors=r,s}var a=i.derToOid(t.contentType),u;switch(a){case n.pki.oids.envelopedData:u=o.createEnvelopedData();break;case n.pki.oids.encryptedData:u=o.createEncryptedData();break;case n.pki.oids.signedData:u=o.createSignedData();break;default:throw new Error("Cannot read PKCS#7 message. ContentType with OID "+a+" is not (yet) supported.")}return u.fromAsn1(t.content.value[0]),u},o.createSignedData=function(){var e=null;return e={type:n.pki.oids.signedData,version:1,certificates:[],crls:[],signers:[],digestAlgorithmIdentifiers:[],contentInfo:null,signerInfos:[],fromAsn1:function(t){if(g(e,t,o.asn1.signedDataValidator),e.certificates=[],e.crls=[],e.digestAlgorithmIdentifiers=[],e.contentInfo=null,e.signerInfos=[],e.rawCapture.certificates)for(var r=e.rawCapture.certificates.value,i=0;i<r.length;++i)e.certificates.push(n.pki.certificateFromAsn1(r[i]))},toAsn1:function(){e.contentInfo||e.sign();for(var t=[],r=0;r<e.certificates.length;++r)t.push(n.pki.certificateToAsn1(e.certificates[r]));var o=[],s=i.create(i.Class.CONTEXT_SPECIFIC,0,!0,[i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[i.create(i.Class.UNIVERSAL,i.Type.INTEGER,!1,i.integerToDer(e.version).getBytes()),i.create(i.Class.UNIVERSAL,i.Type.SET,!0,e.digestAlgorithmIdentifiers),e.contentInfo])]);return t.length>0&&s.value[0].value.push(i.create(i.Class.CONTEXT_SPECIFIC,0,!0,t)),o.length>0&&s.value[0].value.push(i.create(i.Class.CONTEXT_SPECIFIC,1,!0,o)),s.value[0].value.push(i.create(i.Class.UNIVERSAL,i.Type.SET,!0,e.signerInfos)),i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[i.create(i.Class.UNIVERSAL,i.Type.OID,!1,i.oidToDer(e.type).getBytes()),s])},addSigner:function(t){var r=t.issuer,i=t.serialNumber;if(t.certificate){var o=t.certificate;"string"==typeof o&&(o=n.pki.certificateFromPem(o)),r=o.issuer.attributes,i=o.serialNumber}var s=t.key;if(!s)throw new Error("Could not add PKCS#7 signer; no private key specified.");"string"==typeof s&&(s=n.pki.privateKeyFromPem(s));var a=t.digestAlgorithm||n.pki.oids.sha1;switch(a){case n.pki.oids.sha1:case n.pki.oids.sha256:case n.pki.oids.sha384:case n.pki.oids.sha512:case n.pki.oids.md5:break;default:throw new Error("Could not add PKCS#7 signer; unknown message digest algorithm: "+a)}var u=t.authenticatedAttributes||[];if(u.length>0){for(var c=!1,f=!1,l=0;l<u.length;++l){var h=u[l];if(c||h.type!==n.pki.oids.contentType){if(f||h.type!==n.pki.oids.messageDigest);else if(f=!0,c)break}else if(c=!0,f)break}if(!c||!f)throw new Error("Invalid signer.authenticatedAttributes. If signer.authenticatedAttributes is specified, then it must contain at least two attributes, PKCS #9 content-type and PKCS #9 message-digest.")}e.signers.push({key:s,version:1,issuer:r,serialNumber:i,digestAlgorithm:a,signatureAlgorithm:n.pki.oids.rsaEncryption,signature:null,authenticatedAttributes:u,unauthenticatedAttributes:[]})},sign:function(o){var s;(o=o||{},"object"!=typeof e.content||null===e.contentInfo)&&(e.contentInfo=i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[i.create(i.Class.UNIVERSAL,i.Type.OID,!1,i.oidToDer(n.pki.oids.data).getBytes())]),"content"in e&&(e.content instanceof n.util.ByteBuffer?s=e.content.bytes():"string"==typeof e.content&&(s=n.util.encodeUtf8(e.content)),o.detached?e.detachedContent=i.create(i.Class.UNIVERSAL,i.Type.OCTETSTRING,!1,s):e.contentInfo.value.push(i.create(i.Class.CONTEXT_SPECIFIC,0,!0,[i.create(i.Class.UNIVERSAL,i.Type.OCTETSTRING,!1,s)]))));if(0!==e.signers.length){var a=t();r(a)}},verify:function(){throw new Error("PKCS#7 signature verification not yet implemented.")},addCertificate:function(t){"string"==typeof t&&(t=n.pki.certificateFromPem(t)),e.certificates.push(t)},addCertificateRevokationList:function(e){throw new Error("PKCS#7 CRL support not yet implemented.")}},e;function t(){for(var t={},r=0;r<e.signers.length;++r){var o=e.signers[r],s=o.digestAlgorithm;s in t||(t[s]=n.md[n.pki.oids[s]].create()),0===o.authenticatedAttributes.length?o.md=t[s]:o.md=n.md[n.pki.oids[s]].create()}for(var s in e.digestAlgorithmIdentifiers=[],t)e.digestAlgorithmIdentifiers.push(i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[i.create(i.Class.UNIVERSAL,i.Type.OID,!1,i.oidToDer(s).getBytes()),i.create(i.Class.UNIVERSAL,i.Type.NULL,!1,"")]));return t}function r(t){var r;if(e.detachedContent?r=e.detachedContent:(r=e.contentInfo.value[1],r=r.value[0]),!r)throw new Error("Could not sign PKCS#7 message; there is no content to sign.");var o=i.derToOid(e.contentInfo.value[0].value),s=i.toDer(r);for(var a in s.getByte(),i.getBerValueLength(s),s=s.getBytes(),t)t[a].start().update(s);for(var u=new Date,c=0;c<e.signers.length;++c){var f=e.signers[c];if(0===f.authenticatedAttributes.length){if(o!==n.pki.oids.data)throw new Error("Invalid signer; authenticatedAttributes must be present when the ContentInfo content type is not PKCS#7 Data.")}else{f.authenticatedAttributesAsn1=i.create(i.Class.CONTEXT_SPECIFIC,0,!0,[]);for(var l=i.create(i.Class.UNIVERSAL,i.Type.SET,!0,[]),h=0;h<f.authenticatedAttributes.length;++h){var y=f.authenticatedAttributes[h];y.type===n.pki.oids.messageDigest?y.value=t[f.digestAlgorithm].digest():y.type===n.pki.oids.signingTime&&(y.value||(y.value=u)),l.value.push(d(y)),f.authenticatedAttributesAsn1.value.push(d(y))}s=i.toDer(l).getBytes(),f.md.start().update(s)}f.signature=f.key.sign(f.md,"RSASSA-PKCS1-V1_5")}e.signerInfos=p(e.signers)}},o.createEncryptedData=function(){var e=null;return e={type:n.pki.oids.encryptedData,version:0,encryptedContent:{algorithm:n.pki.oids["aes256-CBC"]},fromAsn1:function(t){g(e,t,o.asn1.encryptedDataValidator)},decrypt:function(t){void 0!==t&&(e.encryptedContent.key=t),m(e)}},e},o.createEnvelopedData=function(){var e=null;return e={type:n.pki.oids.envelopedData,version:0,recipients:[],encryptedContent:{algorithm:n.pki.oids["aes256-CBC"]},fromAsn1:function(t){var r=g(e,t,o.asn1.envelopedDataValidator);e.recipients=u(r.recipientInfos.value)},toAsn1:function(){return i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[i.create(i.Class.UNIVERSAL,i.Type.OID,!1,i.oidToDer(e.type).getBytes()),i.create(i.Class.CONTEXT_SPECIFIC,0,!0,[i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[i.create(i.Class.UNIVERSAL,i.Type.INTEGER,!1,i.integerToDer(e.version).getBytes()),i.create(i.Class.UNIVERSAL,i.Type.SET,!0,c(e.recipients)),i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,y(e.encryptedContent))])])])},findRecipient:function(t){for(var r=t.issuer.attributes,n=0;n<e.recipients.length;++n){var i=e.recipients[n],o=i.issuer;if(i.serialNumber===t.serialNumber&&o.length===r.length){for(var s=!0,a=0;a<r.length;++a)if(o[a].type!==r[a].type||o[a].value!==r[a].value){s=!1;break}if(s)return i}}return null},decrypt:function(t,r){if(void 0===e.encryptedContent.key&&void 0!==t&&void 0!==r)switch(t.encryptedContent.algorithm){case n.pki.oids.rsaEncryption:case n.pki.oids.desCBC:var i=r.decrypt(t.encryptedContent.content);e.encryptedContent.key=n.util.createBuffer(i);break;default:throw new Error("Unsupported asymmetric cipher, OID "+t.encryptedContent.algorithm)}m(e)},addRecipient:function(t){e.recipients.push({version:0,issuer:t.issuer.attributes,serialNumber:t.serialNumber,encryptedContent:{algorithm:n.pki.oids.rsaEncryption,key:t.publicKey}})},encrypt:function(t,r){if(void 0===e.encryptedContent.content){var i,o,s;switch(r=r||e.encryptedContent.algorithm,t=t||e.encryptedContent.key,r){case n.pki.oids["aes128-CBC"]:i=16,o=16,s=n.aes.createEncryptionCipher;break;case n.pki.oids["aes192-CBC"]:i=24,o=16,s=n.aes.createEncryptionCipher;break;case n.pki.oids["aes256-CBC"]:i=32,o=16,s=n.aes.createEncryptionCipher;break;case n.pki.oids["des-EDE3-CBC"]:i=24,o=8,s=n.des.createEncryptionCipher;break;default:throw new Error("Unsupported symmetric cipher, OID "+r)}if(void 0===t)t=n.util.createBuffer(n.random.getBytes(i));else if(t.length()!=i)throw new Error("Symmetric key has wrong length; got "+t.length()+" bytes, expected "+i+".");e.encryptedContent.algorithm=r,e.encryptedContent.key=t,e.encryptedContent.parameter=n.util.createBuffer(n.random.getBytes(o));var a=s(t);if(a.start(e.encryptedContent.parameter.copy()),a.update(e.content),!a.finish())throw new Error("Symmetric encryption failed.");e.encryptedContent.content=a.output}for(var u=0;u<e.recipients.length;++u){var c=e.recipients[u];if(void 0===c.encryptedContent.content)switch(c.encryptedContent.algorithm){case n.pki.oids.rsaEncryption:c.encryptedContent.content=c.encryptedContent.key.encrypt(e.encryptedContent.key.data);break;default:throw new Error("Unsupported asymmetric cipher, OID "+c.encryptedContent.algorithm)}}}},e}},function(e,t,r){var n=r(11);r(100),r(137),r(257),r(138),r(16);var i=e.exports=n.ssh=n.ssh||{};function o(e,t){var r=t.toString(16);r[0]>="8"&&(r="00"+r);var i=n.util.hexToBytes(r);e.putInt32(i.length),e.putBytes(i)}function s(e,t){e.putInt32(t.length),e.putString(t)}function a(){for(var e=n.md.sha1.create(),t=arguments.length,r=0;r<t;++r)e.update(arguments[r]);return e.digest()}i.privateKeyToPutty=function(e,t,r){r=r||"",t=t||"";var i="ssh-rsa",u=""===t?"none":"aes256-cbc",c="PuTTY-User-Key-File-2: ssh-rsa\r\n";c+="Encryption: "+u+"\r\n",c+="Comment: "+r+"\r\n";var f=n.util.createBuffer();s(f,"ssh-rsa"),o(f,e.e),o(f,e.n);var l=n.util.encode64(f.bytes(),64),h=Math.floor(l.length/66)+1;c+="Public-Lines: "+h+"\r\n",c+=l;var p=n.util.createBuffer(),d;if(o(p,e.d),o(p,e.p),o(p,e.q),o(p,e.qInv),t){var y=p.length()+16-1;y-=y%16;var g=a(p.bytes());g.truncate(g.length()-y+p.length()),p.putBuffer(g);var m=n.util.createBuffer();m.putBuffer(a("\0\0\0\0",t)),m.putBuffer(a("\0\0\0",t));var b=n.aes.createEncryptionCipher(m.truncate(8),"CBC");b.start(n.util.createBuffer().fillWithByte(0,16)),b.update(p.copy()),b.finish();var v=b.output;v.truncate(16),d=n.util.encode64(v.bytes(),64)}else d=n.util.encode64(p.bytes(),64);h=Math.floor(d.length/66)+1,c+="\r\nPrivate-Lines: "+h+"\r\n",c+=d;var _=a("putty-private-key-file-mac-key",t),w=n.util.createBuffer();s(w,"ssh-rsa"),s(w,u),s(w,r),w.putInt32(f.length()),w.putBuffer(f),w.putInt32(p.length()),w.putBuffer(p);var S=n.hmac.create();return S.start("sha1",_),S.update(w.bytes()),c+="\r\nPrivate-MAC: "+S.digest().toHex()+"\r\n",c},i.publicKeyToOpenSSH=function(e,t){var r="ssh-rsa";t=t||"";var i=n.util.createBuffer();return s(i,r),o(i,e.e),o(i,e.n),r+" "+n.util.encode64(i.bytes())+" "+t},i.privateKeyToOpenSSH=function(e,t){return t?n.pki.encryptRsaPrivateKey(e,t,{legacy:!0,algorithm:"aes128"}):n.pki.privateKeyToPem(e)},i.getPublicKeyFingerprint=function(e,t){t=t||{};var r=t.md||n.md.md5.create(),i="ssh-rsa",a=n.util.createBuffer();s(a,i),o(a,e.e),o(a,e.n),r.start(),r.update(a.getBytes());var u=r.digest();if("hex"===t.encoding){var c=u.toHex();return t.delimiter?c.match(/.{2}/g).join(t.delimiter):c}if("binary"===t.encoding)return u.getBytes();if(t.encoding)throw new Error('Unknown encoding "'+t.encoding+'".');return u}},function(e,t,r){var n=r(11);r(451),r(453),r(16);var i="forge.task",o=0,s={},a=0;n.debug.set(i,"tasks",s);var u={};n.debug.set(i,"queues",u);var c="?",f=30,l=20,h="ready",p="running",d="blocked",y="sleeping",g="done",m="error",b="stop",v="start",_="block",w="unblock",S="sleep",k="wakeup",E="cancel",A="fail",x={ready:{}};x.ready.stop=h,x.ready.start=p,x.ready.cancel=g,x.ready.fail=m,x.running={},x.running.stop=h,x.running.start=p,x.running.block=d,x.running.unblock=p,x.running.sleep=y,x.running.wakeup=p,x.running.cancel=g,x.running.fail=m,x.blocked={},x.blocked.stop=d,x.blocked.start=d,x.blocked.block=d,x.blocked.unblock=d,x.blocked.sleep=d,x.blocked.wakeup=d,x.blocked.cancel=g,x.blocked.fail=m,x.sleeping={},x.sleeping.stop=y,x.sleeping.start=y,x.sleeping.block=y,x.sleeping.unblock=y,x.sleeping.sleep=y,x.sleeping.wakeup=y,x.sleeping.cancel=g,x.sleeping.fail=m,x.done={},x.done.stop=g,x.done.start=g,x.done.block=g,x.done.unblock=g,x.done.sleep=g,x.done.wakeup=g,x.done.cancel=g,x.done.fail=m,x.error={},x.error.stop=m,x.error.start=m,x.error.block=m,x.error.unblock=m,x.error.sleep=m,x.error.wakeup=m,x.error.cancel=m,x.error.fail=m;var I=function(e){this.id=-1,this.name=e.name||"?",this.parent=e.parent||null,this.run=e.run,this.subtasks=[],this.error=!1,this.state=h,this.blocks=0,this.timeoutId=null,this.swapTime=null,this.userData=null,this.id=a++,s[this.id]=this};I.prototype.debug=function(e){e=e||"",n.log.debug(i,e,"[%s][%s] task:",this.id,this.name,this,"subtasks:",this.subtasks.length,"queue:",u)},I.prototype.next=function(e,t){"function"==typeof e&&(t=e,e=this.name);var r=new I({run:t,name:e,parent:this});return r.state=p,r.type=this.type,r.successCallback=this.successCallback||null,r.failureCallback=this.failureCallback||null,this.subtasks.push(r),this},I.prototype.parallel=function(e,t){return n.util.isArray(e)&&(t=e,e=this.name),this.next(e,function(r){var i=r;i.block(t.length);for(var o=function(e,r){n.task.start({type:e,run:function(e){t[r](e)},success:function(e){i.unblock()},failure:function(e){i.unblock()}})},s=0;s<t.length;s++){var a=e+"__parallel-"+r.id+"-"+s,u=s;o(a,u)}})},I.prototype.stop=function(){this.state=x[this.state].stop},I.prototype.start=function(){this.error=!1,this.state=x[this.state].start,this.state===p&&(this.start=new Date,this.run(this),B(this,0))},I.prototype.block=function(e){e=void 0===e?1:e,this.blocks+=e,this.blocks>0&&(this.state=x[this.state].block)},I.prototype.unblock=function(e){return e=void 0===e?1:e,this.blocks-=e,0===this.blocks&&this.state!==g&&(this.state=p,B(this,0)),this.blocks},I.prototype.sleep=function(e){e=void 0===e?0:e,this.state=x[this.state].sleep;var t=this;this.timeoutId=setTimeout(function(){t.timeoutId=null,t.state=p,B(t,0)},e)},I.prototype.wait=function(e){e.wait(this)},I.prototype.wakeup=function(){this.state===y&&(cancelTimeout(this.timeoutId),this.timeoutId=null,this.state=p,B(this,0))},I.prototype.cancel=function(){this.state=x[this.state].cancel,this.permitsNeeded=0,null!==this.timeoutId&&(cancelTimeout(this.timeoutId),this.timeoutId=null),this.subtasks=[]},I.prototype.fail=function(e){if(this.error=!0,C(this,!0),e)e.error=this.error,e.swapTime=this.swapTime,e.userData=this.userData,B(e,0);else{if(null!==this.parent){for(var t=this.parent;null!==t.parent;)t.error=this.error,t.swapTime=this.swapTime,t.userData=this.userData,t=t.parent;C(t,!0)}this.failureCallback&&this.failureCallback(this)}};var T=function(e){e.error=!1,e.state=x[e.state].start,setTimeout(function(){e.state===p&&(e.swapTime=+new Date,e.run(e),B(e,0))},0)},B=function(e,t){var r=t>30||+new Date-e.swapTime>20,n=function(t){if(t++,e.state===p)if(r&&(e.swapTime=+new Date),e.subtasks.length>0){var n=e.subtasks.shift();n.error=e.error,n.swapTime=e.swapTime,n.userData=e.userData,n.run(n),n.error||B(n,t)}else C(e),e.error||null!==e.parent&&(e.parent.error=e.error,e.parent.swapTime=e.swapTime,e.parent.userData=e.userData,B(e.parent,t))};r?setTimeout(n,0):n(t)},C=function(e,t){e.state=g,delete s[e.id],null===e.parent&&(e.type in u?0===u[e.type].length?n.log.error(i,"[%s][%s] task queue empty [%s]",e.id,e.name,e.type):u[e.type][0]!==e?n.log.error(i,"[%s][%s] task not first in queue [%s]",e.id,e.name,e.type):(u[e.type].shift(),0===u[e.type].length?delete u[e.type]:u[e.type][0].start()):n.log.error(i,"[%s][%s] task queue missing [%s]",e.id,e.name,e.type),t||(e.error&&e.failureCallback?e.failureCallback(e):!e.error&&e.successCallback&&e.successCallback(e)))};e.exports=n.task=n.task||{},n.task.start=function(e){var t=new I({run:e.run,name:e.name||"?"});t.type=e.type,t.successCallback=e.success||null,t.failureCallback=e.failure||null,t.type in u?u[e.type].push(t):(u[t.type]=[t],T(t))},n.task.cancel=function(e){e in u&&(u[e]=[u[e][0]])},n.task.createCondition=function(){var e={tasks:{},wait:function(t){t.id in e.tasks||(t.block(),e.tasks[t.id]=t)},notify:function(){var t=e.tasks;for(var r in e.tasks={},t)t[r].unblock()}};return e}},function(e,t,r){"use strict";const n=r(454),i=r(12),o=r(18),s=r(456),a=i(r(255)),u=r(19),c=r(3);class f{constructor(e){this._key=e}verify(e,t,r){g(r),s.hashAndVerify(this._key,t,e,r)}marshal(){return s.utils.jwkToPkix(this._key)}get bytes(){return a.PublicKey.encode({Type:a.KeyType.RSA,Data:this.marshal()})}encrypt(e){return this._key.encrypt(e,"RSAES-PKCS1-V1_5")}equals(e){return this.bytes.equals(e.bytes)}hash(e){g(e),n(this.bytes,"sha2-256",e)}}class l{constructor(e,t){this._key=e,this._publicKey=t}genSecret(){return s.getRandomValues(new Uint8Array(16))}sign(e,t){g(t),s.hashAndSign(this._key,e,t)}get public(){if(!this._publicKey)throw new Error("public key not provided");return new f(this._publicKey)}decrypt(e,t){s.decrypt(this._key,e,t)}marshal(){return s.utils.jwkToPkcs1(this._key)}get bytes(){return a.PrivateKey.encode({Type:a.KeyType.RSA,Data:this.marshal()})}equals(e){return this.bytes.equals(e.bytes)}hash(e){g(e),n(this.bytes,"sha2-256",e)}id(e){this.public.hash((t,r)=>{if(t)return e(t);e(null,o.encode(r))})}export(e,t,r){"function"==typeof t&&(r=t,t=e,e="pkcs-8"),g(r),c(()=>{let n=null,i=null;try{const r=new u.util.ByteBuffer(this.marshal()),o=u.asn1.fromDer(r),s=u.pki.privateKeyFromAsn1(o);if("pkcs-8"===e){const e={algorithm:"aes256",count:1e4,saltSize:16,prfAlgorithm:"sha512"};i=u.pki.encryptRsaPrivateKey(s,t,e)}else n=new Error(`Unknown export format '${e}'`)}catch(e){n=e}r(n,i)})}}function h(e,t){const r=s.utils.pkcs1ToJwk(e);s.unmarshalPrivateKey(r,(e,r)=>{if(e)return t(e);t(null,new l(r.privateKey,r.publicKey))})}function p(e){const t=s.utils.pkixToJwk(e);return new f(t)}function d(e,t){s.unmarshalPrivateKey(e,(e,r)=>{if(e)return t(e);t(null,new l(r.privateKey,r.publicKey))})}function y(e,t){s.generateKey(e,(e,r)=>{if(e)return t(e);t(null,new l(r.privateKey,r.publicKey))})}function g(e){if("function"!=typeof e)throw new Error("callback is required")}e.exports={RsaPublicKey:f,RsaPrivateKey:l,unmarshalRsaPublicKey:p,unmarshalRsaPrivateKey:h,generateKeyPair:y,fromJwk:d}},function(e,t,r){"use strict";(function(t){const n=r(48),i=r(49),o=r(455),s=r(907),a=o.toCallback,u=o.toBuf,c=o.fromString,f=o.fromNumberTo32BitBuf,l=(e,r)=>{s.sha2256(e,(e,n)=>{e&&r(e),s.sha2256(t.from(n),r)})};e.exports={sha1:s.sha1,sha2256:s.sha2256,sha2512:s.sha2512,sha3512:a(u(n.sha3_512)),sha3384:a(u(n.sha3_384)),sha3256:a(u(n.sha3_256)),sha3224:a(u(n.sha3_224)),shake128:a(u(n.shake_128,256)),shake256:a(u(n.shake_256,512)),keccak224:a(u(n.keccak_224)),keccak256:a(u(n.keccak_256)),keccak384:a(u(n.keccak_384)),keccak512:a(u(n.keccak_512)),murmur3128:a(u(c(i.x64.hash128))),murmur332:a(f(c(i.x86.hash32))),addBlake:r(908),dblSha2256:l}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(t){const n=r(50),i=o();function o(){return self.crypto?self.crypto.subtle||self.crypto.webkitSubtle:self.msCrypto?self.msCrypto.subtle:void 0}function s(e){if(!i)throw new Error("Please use a browser with webcrypto support");return(r,o)=>{const s=i.digest({name:e},r);if("function"!=typeof s.then)return s.onerror=(()=>{o(new Error(`hashing data using ${e}`))}),void(s.oncomplete=(e=>{o(null,e.target.result)}));n(s.then(e=>t.from(new Uint8Array(e))),o)}}function a(e,t){s("SHA-1")(e,t)}function u(e,t){s("SHA-256")(e,t)}function c(e,t){s("SHA-512")(e,t)}e.exports={sha1:a,sha2256:u,sha2512:c}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(t){const n=r(51),i=r(455).toCallback,o=45569,s=45633,a={init:n.blake2bInit,update:n.blake2bUpdate,digest:n.blake2bFinal},u={init:n.blake2sInit,update:n.blake2sUpdate,digest:n.blake2sFinal},c=(e,r)=>i(n=>{const i=r.init(e,null);return r.update(i,n),t.from(r.digest(i))});e.exports=(e=>{for(let t=0;t<64;t++)e[o+t]=c(t+1,a);for(let t=0;t<32;t++)e[s+t]=c(t+1,u)})}).call(this,r(0).Buffer)},function(e,t,r){"use strict";const n=r(17),i=r(461),o=i.toBase64,s=i.toBn,a=n.define("RSAPrivateKey",function(){this.seq().obj(this.key("version").int(),this.key("modulus").int(),this.key("publicExponent").int(),this.key("privateExponent").int(),this.key("prime1").int(),this.key("prime2").int(),this.key("exponent1").int(),this.key("exponent2").int(),this.key("coefficient").int())}),u=n.define("AlgorithmIdentifier",function(){this.seq().obj(this.key("algorithm").objid({"1.2.840.113549.1.1.1":"rsa"}),this.key("none").optional().null_(),this.key("curve").optional().objid(),this.key("params").optional().seq().obj(this.key("p").int(),this.key("q").int(),this.key("g").int()))}),c=n.define("RSAPublicKey",function(){this.seq().obj(this.key("algorithm").use(u),this.key("subjectPublicKey").bitstr())}),f=n.define("RSAPublicKey",function(){this.seq().obj(this.key("modulus").int(),this.key("publicExponent").int())});t.pkcs1ToJwk=function(e){const t=a.decode(e,"der");return{kty:"RSA",n:o(t.modulus),e:o(t.publicExponent),d:o(t.privateExponent),p:o(t.prime1),q:o(t.prime2),dp:o(t.exponent1),dq:o(t.exponent2),qi:o(t.coefficient),alg:"RS256",kid:"2011-04-29"}},t.jwkToPkcs1=function(e){return a.encode({version:0,modulus:s(e.n),publicExponent:s(e.e),privateExponent:s(e.d),prime1:s(e.p),prime2:s(e.q),exponent1:s(e.dp),exponent2:s(e.dq),coefficient:s(e.qi)},"der")},t.pkixToJwk=function(e){const t=c.decode(e,"der"),r=f.decode(t.subjectPublicKey.data,"der");return{kty:"RSA",n:o(r.modulus),e:o(r.publicExponent),alg:"RS256",kid:"2011-04-29"}},t.jwkToPkix=function(e){return c.encode({algorithm:{algorithm:"rsa",none:null},subjectPublicKey:{data:f.encode({modulus:s(e.n),publicExponent:s(e.e)},"der")}},"der")}},function(e,t,r){"use strict";const n=r(17),i=r(4),o=t;function s(e,t){this.name=e,this.body=t,this.decoders={},this.encoders={}}o.define=function e(t,r){return new s(t,r)},s.prototype._createNamed=function e(t){let n;try{n=r(911).runInThisContext("(function "+this.name+"(entity) {\n this._initNamed(entity);\n})")}catch(e){n=function(e){this._initNamed(e)}}return i(n,t),n.prototype._initNamed=function e(r){t.call(this,r)},new n(this)},s.prototype._getDecoder=function e(t){return t=t||"der",this.decoders.hasOwnProperty(t)||(this.decoders[t]=this._createNamed(n.decoders[t])),this.decoders[t]},s.prototype.decode=function e(t,r,n){return this._getDecoder(r).decode(t,n)},s.prototype._getEncoder=function e(t){return t=t||"der",this.encoders.hasOwnProperty(t)||(this.encoders[t]=this._createNamed(n.encoders[t])),this.encoders[t]},s.prototype.encode=function e(t,r,n){return this._getEncoder(r).encode(t,n)}},function(module,exports,__webpack_require__){var indexOf=__webpack_require__(261),Object_keys=function(e){if(Object.keys)return Object.keys(e);var t=[];for(var r in e)t.push(r);return t},forEach=function(e,t){if(e.forEach)return e.forEach(t);for(var r=0;r<e.length;r++)t(e[r],r,e)},defineProp=function(){try{return Object.defineProperty({},"_",{}),function(e,t,r){Object.defineProperty(e,t,{writable:!0,enumerable:!1,configurable:!0,value:r})}}catch(e){return function(e,t,r){e[t]=r}}}(),globals=["Array","Boolean","Date","Error","EvalError","Function","Infinity","JSON","Math","NaN","Number","Object","RangeError","ReferenceError","RegExp","String","SyntaxError","TypeError","URIError","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","eval","isFinite","isNaN","parseFloat","parseInt","undefined","unescape"];function Context(){}Context.prototype={};var Script=exports.Script=function e(t){if(!(this instanceof Script))return new Script(t);this.code=t};Script.prototype.runInContext=function(e){if(!(e instanceof Context))throw new TypeError("needs a 'context' argument.");var t=document.createElement("iframe");t.style||(t.style={}),t.style.display="none",document.body.appendChild(t);var r=t.contentWindow,n=r.eval,i=r.execScript;!n&&i&&(i.call(r,"null"),n=r.eval),forEach(Object_keys(e),function(t){r[t]=e[t]}),forEach(globals,function(t){e[t]&&(r[t]=e[t])});var o=Object_keys(r),s=n.call(r,this.code);return forEach(Object_keys(r),function(t){(t in e||-1===indexOf(o,t))&&(e[t]=r[t])}),forEach(globals,function(t){t in e||defineProp(e,t,r[t])}),document.body.removeChild(t),s},Script.prototype.runInThisContext=function(){return eval(this.code)},Script.prototype.runInNewContext=function(e){var t=Script.createContext(e),r=this.runInContext(t);return forEach(Object_keys(t),function(r){e[r]=t[r]}),r},forEach(Object_keys(Script.prototype),function(e){exports[e]=Script[e]=function(t){var r=Script(t);return r[e].apply(r,[].slice.call(arguments,1))}}),exports.createScript=function(e){return exports.Script(e)},exports.createContext=Script.createContext=function(e){var t=new Context;return"object"==typeof e&&forEach(Object_keys(e),function(r){t[r]=e[r]}),t}},function(e,t,r){"use strict";const n=r(4);function i(e){this._reporterState={obj:null,path:[],options:e||{},errors:[]}}function o(e,t){this.path=e,this.rethrow(t)}t.Reporter=i,i.prototype.isError=function e(t){return t instanceof o},i.prototype.save=function e(){const t=this._reporterState;return{obj:t.obj,pathLen:t.path.length}},i.prototype.restore=function e(t){const r=this._reporterState;r.obj=t.obj,r.path=r.path.slice(0,t.pathLen)},i.prototype.enterKey=function e(t){return this._reporterState.path.push(t)},i.prototype.exitKey=function e(t){const r=this._reporterState;r.path=r.path.slice(0,t-1)},i.prototype.leaveKey=function e(t,r,n){const i=this._reporterState;this.exitKey(t),null!==i.obj&&(i.obj[r]=n)},i.prototype.path=function e(){return this._reporterState.path.join("/")},i.prototype.enterObject=function e(){const t=this._reporterState,r=t.obj;return t.obj={},r},i.prototype.leaveObject=function e(t){const r=this._reporterState,n=r.obj;return r.obj=t,n},i.prototype.error=function e(t){let r;const n=this._reporterState,i=t instanceof o;if(r=i?t:new o(n.path.map(function(e){return"["+JSON.stringify(e)+"]"}).join(""),t.message||t,t.stack),!n.options.partial)throw r;return i||n.errors.push(r),r},i.prototype.wrapResult=function e(t){const r=this._reporterState;return r.options.partial?{result:this.isError(t)?null:t,errors:r.errors}:t},n(o,Error),o.prototype.rethrow=function e(t){if(this.message=t+" at: "+(this.path||"(shallow)"),Error.captureStackTrace&&Error.captureStackTrace(this,o),!this.stack)try{throw new Error(this.message)}catch(e){this.stack=e.stack}return this}},function(e,t,r){"use strict";const n=r(139).Reporter,i=r(139).EncoderBuffer,o=r(139).DecoderBuffer,s=r(84),a=["seq","seqof","set","setof","objid","bool","gentime","utctime","null_","enum","int","objDesc","bitstr","bmpstr","charstr","genstr","graphstr","ia5str","iso646str","numstr","octstr","printstr","t61str","unistr","utf8str","videostr"],u=["key","obj","use","optional","explicit","implicit","def","choice","any","contains"].concat(a),c=["_peekTag","_decodeTag","_use","_decodeStr","_decodeObjid","_decodeTime","_decodeNull","_decodeInt","_decodeBool","_decodeList","_encodeComposite","_encodeStr","_encodeObjid","_encodeTime","_encodeNull","_encodeInt","_encodeBool"];function f(e,t){const r={};this._baseState=r,r.enc=e,r.parent=t||null,r.children=null,r.tag=null,r.args=null,r.reverseArgs=null,r.choice=null,r.optional=!1,r.any=!1,r.obj=!1,r.use=null,r.useDecoder=null,r.key=null,r.default=null,r.explicit=null,r.implicit=null,r.contains=null,r.parent||(r.children=[],this._wrap())}e.exports=f;const l=["enc","parent","children","tag","args","reverseArgs","choice","optional","any","obj","use","alteredUse","key","default","explicit","implicit","contains"];f.prototype.clone=function e(){const t=this._baseState,r={};l.forEach(function(e){r[e]=t[e]});const n=new this.constructor(r.parent);return n._baseState=r,n},f.prototype._wrap=function e(){const t=this._baseState;u.forEach(function(e){this[e]=function r(){const n=new this.constructor(this);return t.children.push(n),n[e].apply(n,arguments)}},this)},f.prototype._init=function e(t){const r=this._baseState;s(null===r.parent),t.call(this),r.children=r.children.filter(function(e){return e._baseState.parent===this},this),s.equal(r.children.length,1,"Root node can have only one child")},f.prototype._useArgs=function e(t){const r=this._baseState,n=t.filter(function(e){return e instanceof this.constructor},this);t=t.filter(function(e){return!(e instanceof this.constructor)},this),0!==n.length&&(s(null===r.children),r.children=n,n.forEach(function(e){e._baseState.parent=this},this)),0!==t.length&&(s(null===r.args),r.args=t,r.reverseArgs=t.map(function(e){if("object"!=typeof e||e.constructor!==Object)return e;const t={};return Object.keys(e).forEach(function(r){r==(0|r)&&(r|=0);const n=e[r];t[n]=r}),t}))},c.forEach(function(e){f.prototype[e]=function t(){const r=this._baseState;throw new Error(e+" not implemented for encoding: "+r.enc)}}),a.forEach(function(e){f.prototype[e]=function t(){const r=this._baseState,n=Array.prototype.slice.call(arguments);return s(null===r.tag),r.tag=e,this._useArgs(n),this}}),f.prototype.use=function e(t){s(t);const r=this._baseState;return s(null===r.use),r.use=t,this},f.prototype.optional=function e(){const t=this._baseState;return t.optional=!0,this},f.prototype.def=function e(t){const r=this._baseState;return s(null===r.default),r.default=t,r.optional=!0,this},f.prototype.explicit=function e(t){const r=this._baseState;return s(null===r.explicit&&null===r.implicit),r.explicit=t,this},f.prototype.implicit=function e(t){const r=this._baseState;return s(null===r.explicit&&null===r.implicit),r.implicit=t,this},f.prototype.obj=function e(){const t=this._baseState,r=Array.prototype.slice.call(arguments);return t.obj=!0,0!==r.length&&this._useArgs(r),this},f.prototype.key=function e(t){const r=this._baseState;return s(null===r.key),r.key=t,this},f.prototype.any=function e(){const t=this._baseState;return t.any=!0,this},f.prototype.choice=function e(t){const r=this._baseState;return s(null===r.choice),r.choice=t,this._useArgs(Object.keys(t).map(function(e){return t[e]})),this},f.prototype.contains=function e(t){const r=this._baseState;return s(null===r.use),r.contains=t,this},f.prototype._decode=function e(t,r){const n=this._baseState;if(null===n.parent)return t.wrapResult(n.children[0]._decode(t,r));let i=n.default,s=!0,a=null,u;if(null!==n.key&&(a=t.enterKey(n.key)),n.optional){let e=null;if(null!==n.explicit?e=n.explicit:null!==n.implicit?e=n.implicit:null!==n.tag&&(e=n.tag),null!==e||n.any){if(s=this._peekTag(t,e,n.any),t.isError(s))return s}else{const e=t.save();try{null===n.choice?this._decodeGeneric(n.tag,t,r):this._decodeChoice(t,r),s=!0}catch(e){s=!1}t.restore(e)}}if(n.obj&&s&&(u=t.enterObject()),s){if(null!==n.explicit){const e=this._decodeTag(t,n.explicit);if(t.isError(e))return e;t=e}const e=t.offset;if(null===n.use&&null===n.choice){let e;n.any&&(e=t.save());const r=this._decodeTag(t,null!==n.implicit?n.implicit:n.tag,n.any);if(t.isError(r))return r;n.any?i=t.raw(e):t=r}if(r&&r.track&&null!==n.tag&&r.track(t.path(),e,t.length,"tagged"),r&&r.track&&null!==n.tag&&r.track(t.path(),t.offset,t.length,"content"),n.any||(i=null===n.choice?this._decodeGeneric(n.tag,t,r):this._decodeChoice(t,r)),t.isError(i))return i;if(n.any||null!==n.choice||null===n.children||n.children.forEach(function e(n){n._decode(t,r)}),n.contains&&("octstr"===n.tag||"bitstr"===n.tag)){const e=new o(i);i=this._getUse(n.contains,t._reporterState.obj)._decode(e,r)}}return n.obj&&s&&(i=t.leaveObject(u)),null===n.key||null===i&&!0!==s?null!==a&&t.exitKey(a):t.leaveKey(a,n.key,i),i},f.prototype._decodeGeneric=function e(t,r,n){const i=this._baseState;return"seq"===t||"set"===t?null:"seqof"===t||"setof"===t?this._decodeList(r,t,i.args[0],n):/str$/.test(t)?this._decodeStr(r,t,n):"objid"===t&&i.args?this._decodeObjid(r,i.args[0],i.args[1],n):"objid"===t?this._decodeObjid(r,null,null,n):"gentime"===t||"utctime"===t?this._decodeTime(r,t,n):"null_"===t?this._decodeNull(r,n):"bool"===t?this._decodeBool(r,n):"objDesc"===t?this._decodeStr(r,t,n):"int"===t||"enum"===t?this._decodeInt(r,i.args&&i.args[0],n):null!==i.use?this._getUse(i.use,r._reporterState.obj)._decode(r,n):r.error("unknown tag: "+t)},f.prototype._getUse=function e(t,r){const n=this._baseState;return n.useDecoder=this._use(t,r),s(null===n.useDecoder._baseState.parent),n.useDecoder=n.useDecoder._baseState.children[0],n.implicit!==n.useDecoder._baseState.implicit&&(n.useDecoder=n.useDecoder.clone(),n.useDecoder._baseState.implicit=n.implicit),n.useDecoder},f.prototype._decodeChoice=function e(t,r){const n=this._baseState;let i=null,o=!1;return Object.keys(n.choice).some(function(e){const s=t.save(),a=n.choice[e];try{const n=a._decode(t,r);if(t.isError(n))return!1;i={type:e,value:n},o=!0}catch(e){return t.restore(s),!1}return!0},this),o?i:t.error("Choice not matched")},f.prototype._createEncoderBuffer=function e(t){return new i(t,this.reporter)},f.prototype._encode=function e(t,r,n){const i=this._baseState;if(null!==i.default&&i.default===t)return;const o=this._encodeValue(t,r,n);return void 0===o||this._skipDefault(o,r,n)?void 0:o},f.prototype._encodeValue=function e(t,r,i){const o=this._baseState;if(null===o.parent)return o.children[0]._encode(t,r||new n);let s=null;if(this.reporter=r,o.optional&&void 0===t){if(null===o.default)return;t=o.default}let a=null,u=!1;if(o.any)s=this._createEncoderBuffer(t);else if(o.choice)s=this._encodeChoice(t,r);else if(o.contains)a=this._getUse(o.contains,i)._encode(t,r),u=!0;else if(o.children)a=o.children.map(function(e){if("null_"===e._baseState.tag)return e._encode(null,r,t);if(null===e._baseState.key)return r.error("Child should have a key");const n=r.enterKey(e._baseState.key);if("object"!=typeof t)return r.error("Child expected, but input is not object");const i=e._encode(t[e._baseState.key],r,t);return r.leaveKey(n),i},this).filter(function(e){return e}),a=this._createEncoderBuffer(a);else if("seqof"===o.tag||"setof"===o.tag){if(!o.args||1!==o.args.length)return r.error("Too many args for : "+o.tag);if(!Array.isArray(t))return r.error("seqof/setof, but data is not Array");const e=this.clone();e._baseState.implicit=null,a=this._createEncoderBuffer(t.map(function(e){const n=this._baseState;return this._getUse(n.args[0],t)._encode(e,r)},e))}else null!==o.use?s=this._getUse(o.use,i)._encode(t,r):(a=this._encodePrimitive(o.tag,t),u=!0);if(!o.any&&null===o.choice){const e=null!==o.implicit?o.implicit:o.tag,t=null===o.implicit?"universal":"context";null===e?null===o.use&&r.error("Tag could be omitted only for .use()"):null===o.use&&(s=this._encodeComposite(e,u,t,a))}return null!==o.explicit&&(s=this._encodeComposite(o.explicit,!1,"context",s)),s},f.prototype._encodeChoice=function e(t,r){const n=this._baseState,i=n.choice[t.type];return i||s(!1,t.type+" not found in "+JSON.stringify(Object.keys(n.choice))),i._encode(t.value,r)},f.prototype._encodePrimitive=function e(t,r){const n=this._baseState;if(/str$/.test(t))return this._encodeStr(r,t);if("objid"===t&&n.args)return this._encodeObjid(r,n.reverseArgs[0],n.args[1]);if("objid"===t)return this._encodeObjid(r,null,null);if("gentime"===t||"utctime"===t)return this._encodeTime(r,t);if("null_"===t)return this._encodeNull();if("int"===t||"enum"===t)return this._encodeInt(r,n.args&&n.reverseArgs[0]);if("bool"===t)return this._encodeBool(r);if("objDesc"===t)return this._encodeStr(r,t);throw new Error("Unsupported tag: "+t)},f.prototype._isNumstr=function e(t){return/^[0-9 ]*$/.test(t)},f.prototype._isPrintstr=function e(t){return/^[A-Za-z0-9 '()+,-./:=?]*$/.test(t)}},function(e,t,r){"use strict";const n=r(458);t.tagClass={0:"universal",1:"application",2:"context",3:"private"},t.tagClassByName=n._reverse(t.tagClass),t.tag={0:"end",1:"bool",2:"int",3:"bitstr",4:"octstr",5:"null_",6:"objid",7:"objDesc",8:"external",9:"real",10:"enum",11:"embed",12:"utf8str",13:"relativeOid",16:"seq",17:"set",18:"numstr",19:"printstr",20:"t61str",21:"videostr",22:"ia5str",23:"utctime",24:"gentime",25:"graphstr",26:"iso646str",27:"genstr",28:"unistr",29:"charstr",30:"bmpstr"},t.tagByName=n._reverse(t.tag)},function(e,t,r){"use strict";const n=t;n.der=r(459),n.pem=r(916)},function(e,t,r){"use strict";const n=r(4),i=r(0).Buffer,o=r(459);function s(e){o.call(this,e),this.enc="pem"}n(s,o),e.exports=s,s.prototype.decode=function e(t,r){const n=t.toString().split(/[\r\n]+/g),s=r.label.toUpperCase(),a=/^-----(BEGIN|END) ([^-]+)-----$/;let u=-1,c=-1;for(let e=0;e<n.length;e++){const t=n[e].match(a);if(null!==t&&t[2]===s){if(-1!==u){if("END"!==t[1])break;c=e;break}if("BEGIN"!==t[1])break;u=e}}if(-1===u||-1===c)throw new Error("PEM section not found for: "+s);const f=n.slice(u+1,c).join("");f.replace(/[^a-z0-9+/=]+/gi,"");const l=new i(f,"base64");return o.prototype.decode.call(this,l,r)}},function(e,t,r){"use strict";const n=t;n.der=r(460),n.pem=r(918)},function(e,t,r){"use strict";const n=r(4),i=r(460);function o(e){i.call(this,e),this.enc="pem"}n(o,i),e.exports=o,o.prototype.encode=function e(t,r){const n=i.prototype.encode.call(this,t),o=n.toString("base64"),s=["-----BEGIN "+r.label+"-----"];for(let e=0;e<o.length;e+=64)s.push(o.slice(e,e+64));return s.push("-----END "+r.label+"-----"),s.join("\n")}},function(e,t,r){"use strict";(function(t){const n=r(454),i=r(12),o=r(18),s=r(920),a=i(r(255));class u{constructor(e){this._key=y(e,s.publicKeyLength)}verify(e,t,r){d(r),s.hashAndVerify(this._key,t,e,r)}marshal(){return t.from(this._key)}get bytes(){return a.PublicKey.encode({Type:a.KeyType.Ed25519,Data:this.marshal()})}equals(e){return this.bytes.equals(e.bytes)}hash(e){d(e),n(this.bytes,"sha2-256",e)}}class c{constructor(e,t){this._key=y(e,s.privateKeyLength),this._publicKey=y(t,s.publicKeyLength)}sign(e,t){d(t),s.hashAndSign(this._key,e,t)}get public(){if(!this._publicKey)throw new Error("public key not provided");return new u(this._publicKey)}marshal(){return t.concat([t.from(this._key),t.from(this._publicKey)])}get bytes(){return a.PrivateKey.encode({Type:a.KeyType.Ed25519,Data:this.marshal()})}equals(e){return this.bytes.equals(e.bytes)}hash(e){d(e),n(this.bytes,"sha2-256",e)}id(e){this.public.hash((t,r)=>{if(t)return e(t);e(null,o.encode(r))})}}function f(e,t){try{e=y(e,s.privateKeyLength+s.publicKeyLength)}catch(e){return t(e)}const r=e.slice(0,s.privateKeyLength),n=e.slice(s.privateKeyLength,e.length);t(null,new c(r,n))}function l(e){return e=y(e,s.publicKeyLength),new u(e)}function h(e,t){void 0===t&&"function"==typeof e&&(t=e),s.generateKey((e,r)=>{if(e)return t(e);let n;try{n=new c(r.secretKey,r.publicKey)}catch(e){return void t(e)}t(null,n)})}function p(e,t,r){void 0===r&&"function"==typeof t&&(r=t),s.generateKeyFromSeed(e,(e,t)=>{if(e)return r(e);let n;try{n=new c(t.secretKey,t.publicKey)}catch(e){return void r(e)}r(null,n)})}function d(e){if("function"!=typeof e)throw new Error("callback is required")}function y(e,r){if(t.isBuffer(e)&&(e=new Uint8Array(e)),!(e instanceof Uint8Array)||e.length!==r)throw new Error("Key must be a Uint8Array or Buffer of length "+r);return e}e.exports={Ed25519PublicKey:u,Ed25519PrivateKey:c,unmarshalEd25519PrivateKey:f,unmarshalEd25519PublicKey:l,generateKeyPair:h,generateKeyPairFromSeed:p}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(e){const n=r(71),i=r(3);t.publicKeyLength=n.sign.publicKeyLength,t.privateKeyLength=n.sign.secretKeyLength,t.generateKey=function(e){i(()=>{let t;try{t=n.sign.keyPair()}catch(t){return e(t)}e(null,t)})},t.generateKeyFromSeed=function(e,t){i(()=>{let r;try{r=n.sign.keyPair.fromSeed(e)}catch(e){return t(e)}t(null,r)})},t.hashAndSign=function(t,r,o){i(()=>{o(null,e.from(n.sign.detached(r,t)))})},t.hashAndVerify=function(e,t,r,o){i(()=>{let i;try{i=n.sign.detached.verify(r,t,e)}catch(e){return o(e)}o(null,i)})}}).call(this,r(0).Buffer)},function(e,t){},function(e,t,r){"use strict";(function(t){const n=r(48),i=r(49),o=r(463),s=r(923),a=o.toCallback,u=o.toBuf,c=o.fromString,f=o.fromNumberTo32BitBuf,l=(e,r)=>{s.sha2256(e,(e,n)=>{e&&r(e),s.sha2256(t.from(n),r)})};e.exports={sha1:s.sha1,sha2256:s.sha2256,sha2512:s.sha2512,sha3512:a(u(n.sha3_512)),sha3384:a(u(n.sha3_384)),sha3256:a(u(n.sha3_256)),sha3224:a(u(n.sha3_224)),shake128:a(u(n.shake_128,256)),shake256:a(u(n.shake_256,512)),keccak224:a(u(n.keccak_224)),keccak256:a(u(n.keccak_256)),keccak384:a(u(n.keccak_384)),keccak512:a(u(n.keccak_512)),murmur3128:a(u(c(i.x64.hash128))),murmur332:a(f(c(i.x86.hash32))),addBlake:r(924),dblSha2256:l}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(t){const n=r(50),i=o();function o(){return self.crypto?self.crypto.subtle||self.crypto.webkitSubtle:self.msCrypto?self.msCrypto.subtle:void 0}function s(e){if(!i)throw new Error("Please use a browser with webcrypto support");return(r,o)=>{const s=i.digest({name:e},r);if("function"!=typeof s.then)return s.onerror=(()=>{o(new Error(`hashing data using ${e}`))}),void(s.oncomplete=(e=>{o(null,e.target.result)}));n(s.then(e=>t.from(new Uint8Array(e))),o)}}function a(e,t){s("SHA-1")(e,t)}function u(e,t){s("SHA-256")(e,t)}function c(e,t){s("SHA-512")(e,t)}e.exports={sha1:a,sha2256:u,sha2512:c}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(t){const n=r(51),i=r(463).toCallback,o=45569,s=45633,a={init:n.blake2bInit,update:n.blake2bUpdate,digest:n.blake2bFinal},u={init:n.blake2sInit,update:n.blake2sUpdate,digest:n.blake2sFinal},c=(e,r)=>i(n=>{const i=r.init(e,null);return r.update(i,n),t.from(r.digest(i))});e.exports=(e=>{for(let t=0;t<64;t++)e[o+t]=c(t+1,a);for(let t=0;t<32;t++)e[s+t]=c(t+1,u)})}).call(this,r(0).Buffer)},function(e,t,r){"use strict";const n=r(926),i=r(462),o=r(3),s="sha2-256";e.exports=(e=>{const t=32;function r(t){const r=(e,r)=>o(()=>t(e,r));let i;do{i=e(32)}while(!n.privateKeyVerify(i));r(null,i)}function a(e,t,r){const a=(e,t)=>o(()=>r(e,t));i.digest(t,s,(t,r)=>{if(t)return a(t);try{const i=n.sign(r,e),o=n.signatureExport(i.signature);return a(null,o)}catch(t){a(t)}})}function u(e,t,r,a){const u=(e,t)=>o(()=>a(e,t));i.digest(r,s,(r,i)=>{if(r)return u(r);try{t=n.signatureImport(t);const o=n.verify(i,t,e);return u(null,o)}catch(r){u(r)}})}function c(e){if(!n.publicKeyVerify(e))throw new Error("Invalid public key");return n.publicKeyConvert(e,!0)}function f(e){return n.publicKeyConvert(e,!1)}function l(e){if(!n.privateKeyVerify(e))throw new Error("Invalid private key")}function h(e){if(!n.publicKeyVerify(e))throw new Error("Invalid public key")}function p(e){return l(e),n.publicKeyCreate(e)}return{generateKey:r,privateKeyLength:32,hashAndSign:a,hashAndVerify:u,compressPublicKey:c,decompressPublicKey:f,validatePrivateKey:l,validatePublicKey:h,computePublicKey:p}})},function(e,t,r){"use strict";e.exports=r(409)(r(927))},function(e,t,r){"use strict";var n=r(2).Buffer,i=r(127),o=r(928),s=r(244),a=r(185),u=r(464),c=r(931);t.privateKeyVerify=function(e){var t=a.fromBuffer(e);return!(t.isOverflow()||t.isZero())},t.privateKeyExport=function(e,t){var r=a.fromBuffer(e);if(r.isOverflow()||r.isZero())throw new Error(s.EC_PRIVATE_KEY_EXPORT_DER_FAIL);return c.mul(r).toPublicKey(t)},t.privateKeyNegate=function(e){var t=a.fromBuffer(e);return t.isZero()?n.alloc(32):(t.ucmp(a.n)>0&&t.isub(a.n),a.n.sub(t).toBuffer())},t.privateKeyModInverse=function(e){var t=a.fromBuffer(e);if(t.isOverflow()||t.isZero())throw new Error(s.EC_PRIVATE_KEY_RANGE_INVALID);return t.uinvm().toBuffer()},t.privateKeyTweakAdd=function(e,t){var r=a.fromBuffer(t);if(r.isOverflow())throw new Error(s.EC_PRIVATE_KEY_TWEAK_ADD_FAIL);if(r.iadd(a.fromBuffer(e)),r.isOverflow()&&r.isub(a.n),r.isZero())throw new Error(s.EC_PRIVATE_KEY_TWEAK_ADD_FAIL);return r.toBuffer()},t.privateKeyTweakMul=function(e,t){var r=a.fromBuffer(t);if(r.isOverflow()||r.isZero())throw new Error(s.EC_PRIVATE_KEY_TWEAK_MUL_FAIL);var n=a.fromBuffer(e);return r.umul(n).ureduce().toBuffer()},t.publicKeyCreate=function(e,t){var r=a.fromBuffer(e);if(r.isOverflow()||r.isZero())throw new Error(s.EC_PUBLIC_KEY_CREATE_FAIL);return c.mul(r).toPublicKey(t)},t.publicKeyConvert=function(e,t){var r=u.fromPublicKey(e);if(null===r)throw new Error(s.EC_PUBLIC_KEY_PARSE_FAIL);return r.toPublicKey(t)},t.publicKeyVerify=function(e){return null!==u.fromPublicKey(e)},t.publicKeyTweakAdd=function(e,t,r){var n=u.fromPublicKey(e);if(null===n)throw new Error(s.EC_PUBLIC_KEY_PARSE_FAIL);if(t=a.fromBuffer(t),t.isOverflow())throw new Error(s.EC_PUBLIC_KEY_TWEAK_ADD_FAIL);return c.mul(t).add(n).toPublicKey(r)},t.publicKeyTweakMul=function(e,t,r){var n=u.fromPublicKey(e);if(null===n)throw new Error(s.EC_PUBLIC_KEY_PARSE_FAIL);if(t=a.fromBuffer(t),t.isOverflow()||t.isZero())throw new Error(s.EC_PUBLIC_KEY_TWEAK_MUL_FAIL);return n.mul(t).toPublicKey(r)},t.publicKeyCombine=function(e,t){for(var r=new Array(e.length),n=0;n<e.length;++n)if(r[n]=u.fromPublicKey(e[n]),null===r[n])throw new Error(s.EC_PUBLIC_KEY_PARSE_FAIL);for(var i=r[0],o=1;o<r.length;++o)i=i.add(r[o]);if(i.inf)throw new Error(s.EC_PUBLIC_KEY_COMBINE_FAIL);return i.toPublicKey(t)},t.signatureNormalize=function(e){var t=a.fromBuffer(e.slice(0,32)),r=a.fromBuffer(e.slice(32,64));if(t.isOverflow()||r.isOverflow())throw new Error(s.ECDSA_SIGNATURE_PARSE_FAIL);var i=n.from(e);return r.isHigh()&&a.n.sub(r).toBuffer().copy(i,32),i},t.signatureExport=function(e){var t=e.slice(0,32),r=e.slice(32,64);if(a.fromBuffer(t).isOverflow()||a.fromBuffer(r).isOverflow())throw new Error(s.ECDSA_SIGNATURE_PARSE_FAIL);return{r:t,s:r}},t.signatureImport=function(e){var t=a.fromBuffer(e.r);t.isOverflow()&&(t=a.fromNumber(0));var r=a.fromBuffer(e.s);return r.isOverflow()&&(r=a.fromNumber(0)),n.concat([t.toBuffer(),r.toBuffer()])},t.sign=function(e,t,r,i){var u=a.fromBuffer(t);if(u.isOverflow()||u.isZero())throw new Error(s.ECDSA_SIGN_FAIL);if(null===r){var f=new o("sha256",t,e,i);r=function(){return f.generate(32)}}for(var l=a.fromBuffer(e),h=0;;++h){var p=r(e,t,null,i,h);if(!n.isBuffer(p)||32!==p.length)throw new Error(s.ECDSA_SIGN_FAIL);var d=a.fromBuffer(p);if(!d.isOverflow()&&!d.isZero()){var y=c.mul(d),g=y.x.fireduce();if(!g.isZero()){var m=d.uinvm().umul(g.umul(u).ureduce().iadd(l).fireduce()).ureduce();if(!m.isZero()){var b=(0!==y.x.ucmp(g)?2:0)|(y.y.isOdd()?1:0);return m.isHigh()&&(m=a.n.sub(m),b^=1),{signature:n.concat([g.toBuffer(),m.toBuffer()]),recovery:b}}}}}},t.verify=function(e,t,r){var n=a.fromBuffer(t.slice(0,32)),i=a.fromBuffer(t.slice(32,64));if(n.isOverflow()||i.isOverflow())throw new Error(s.ECDSA_SIGNATURE_PARSE_FAIL);if(i.isHigh()||n.isZero()||i.isZero())return!1;var o=u.fromPublicKey(r);if(null===o)throw new Error(s.EC_PUBLIC_KEY_PARSE_FAIL);var f=i.uinvm(),l=f.umul(a.fromBuffer(e)).ureduce(),h=f.umul(n).ureduce(),p=c.mulAdd(l,o,h);if(p.inf)return!1;var d=p.z.redSqr();return 0===n.redMul(d).ucmp(p.x)||!(n.ucmp(a.psn)>=0)&&0===n.iadd(a.psn).redMul(d).ucmp(p.x)},t.recover=function(e,t,r,i){var o=a.fromBuffer(t.slice(0,32)),f=a.fromBuffer(t.slice(32,64));if(o.isOverflow()||f.isOverflow())throw new Error(s.ECDSA_SIGNATURE_PARSE_FAIL);do{if(o.isZero()||f.isZero())break;var l=o;if(r>>1){if(l.ucmp(a.psn)>=0)break;l=o.add(a.n)}var h=n.concat([n.from([2+(1&r)]),l.toBuffer()]),p=u.fromPublicKey(h);if(null===p)break;var d=o.uinvm(),y=a.n.sub(a.fromBuffer(e)).umul(d).ureduce(),g=f.umul(d).ureduce(),m=u.fromECJPoint(c.mulAdd(y,p,g));return m.toPublicKey(i)}while(0);throw new Error(s.ECDSA_RECOVER_FAIL)},t.ecdh=function(e,r){var n=t.ecdhUnsafe(e,r,!0);return i("sha256").update(n).digest()},t.ecdhUnsafe=function(e,t,r){var n=u.fromPublicKey(e);if(null===n)throw new Error(s.EC_PUBLIC_KEY_PARSE_FAIL);var i=a.fromBuffer(t);if(i.isOverflow()||i.isZero())throw new Error(s.ECDH_FAIL);return n.mul(i).toPublicKey(r)}},function(e,t,r){"use strict";(function(t){var n=r(241),i=r(929),o=new t(0),s=new t([0]),a=new t([1]);function u(e,t,r,n){var o=i[e];if(void 0===o)throw new Error("hash "+e+" is not supported");this._algo=e,this._securityStrength=o.securityStrength/8,this._outlen=o.outlen/8,this._reseedInterval=281474976710656,this._init(t,r,n)}u.prototype._update=function(e){var t=n(this._algo,this._K).update(this._V).update(s);e&&t.update(e),this._K=t.digest(),this._V=n(this._algo,this._K).update(this._V).digest(),e&&(this._K=n(this._algo,this._K).update(this._V).update(a).update(e).digest(),this._V=n(this._algo,this._K).update(this._V).digest())},u.prototype._init=function(e,r,n){if(e.length<this._securityStrength)throw new Error("Not enough entropy");this._K=new t(this._outlen),this._V=new t(this._outlen);for(var i=0;i<this._K.length;++i)this._K[i]=0,this._V[i]=1;this._update(t.concat([e,r,n||o])),this._reseed=1},u.prototype.reseed=function(e,r){if(e.length<this._securityStrength)throw new Error("Not enough entropy");this._update(t.concat([e,r||o])),this._reseed=1},u.prototype.generate=function(e,r){if(this._reseed>this._reseedInterval)throw new Error("Reseed is required");r&&0===r.length&&(r=void 0),r&&this._update(r);for(var i=new t(0);i.length<e;)this._V=n(this._algo,this._K).update(this._V).digest(),i=t.concat([i,this._V]);return this._update(r),this._reseed+=1,i.slice(0,e)},e.exports=u}).call(this,r(0).Buffer)},function(e){e.exports={sha1:{securityStrength:128,outlen:160,seedlen:440},sha224:{securityStrength:192,outlen:224,seedlen:440},sha256:{securityStrength:256,outlen:256,seedlen:440},sha384:{securityStrength:256,outlen:384,seedlen:888},sha512:{securityStrength:256,outlen:512,seedlen:888}}},function(e,t,r){"use strict";t.umulTo10x10=function(e,t,r){var n=e.words,i=t.words,o=r.words,s=0,a,u,c,f=0|n[0],l=8191&f,h=f>>>13,p=0|n[1],d=8191&p,y=p>>>13,g=0|n[2],m=8191&g,b=g>>>13,v=0|n[3],_=8191&v,w=v>>>13,S=0|n[4],k=8191&S,E=S>>>13,A=0|n[5],x=8191&A,I=A>>>13,T=0|n[6],B=8191&T,C=T>>>13,P=0|n[7],O=8191&P,R=P>>>13,N=0|n[8],L=8191&N,j=N>>>13,M=0|n[9],K=8191&M,D=M>>>13,U=0|i[0],F=8191&U,q=U>>>13,H=0|i[1],z=8191&H,V=H>>>13,G=0|i[2],W=8191&G,$=G>>>13,Y=0|i[3],J=8191&Y,X=Y>>>13,Z=0|i[4],Q=8191&Z,ee=Z>>>13,te=0|i[5],re=8191&te,ne=te>>>13,ie=0|i[6],oe=8191&ie,se=ie>>>13,ae=0|i[7],ue=8191&ae,ce=ae>>>13,fe=0|i[8],le=8191&fe,he=fe>>>13,pe=0|i[9],de=8191&pe,ye=pe>>>13;r.length=19,a=Math.imul(l,F),u=Math.imul(l,q),u+=Math.imul(h,F),c=Math.imul(h,q);var ge=s+a+((8191&u)<<13);s=c+(u>>>13)+(ge>>>26),ge&=67108863,a=Math.imul(d,F),u=Math.imul(d,q),u+=Math.imul(y,F),c=Math.imul(y,q),a+=Math.imul(l,z),u+=Math.imul(l,V),u+=Math.imul(h,z),c+=Math.imul(h,V);var me=s+a+((8191&u)<<13);s=c+(u>>>13)+(me>>>26),me&=67108863,a=Math.imul(m,F),u=Math.imul(m,q),u+=Math.imul(b,F),c=Math.imul(b,q),a+=Math.imul(d,z),u+=Math.imul(d,V),u+=Math.imul(y,z),c+=Math.imul(y,V),a+=Math.imul(l,W),u+=Math.imul(l,$),u+=Math.imul(h,W),c+=Math.imul(h,$);var be=s+a+((8191&u)<<13);s=c+(u>>>13)+(be>>>26),be&=67108863,a=Math.imul(_,F),u=Math.imul(_,q),u+=Math.imul(w,F),c=Math.imul(w,q),a+=Math.imul(m,z),u+=Math.imul(m,V),u+=Math.imul(b,z),c+=Math.imul(b,V),a+=Math.imul(d,W),u+=Math.imul(d,$),u+=Math.imul(y,W),c+=Math.imul(y,$),a+=Math.imul(l,J),u+=Math.imul(l,X),u+=Math.imul(h,J),c+=Math.imul(h,X);var ve=s+a+((8191&u)<<13);s=c+(u>>>13)+(ve>>>26),ve&=67108863,a=Math.imul(k,F),u=Math.imul(k,q),u+=Math.imul(E,F),c=Math.imul(E,q),a+=Math.imul(_,z),u+=Math.imul(_,V),u+=Math.imul(w,z),c+=Math.imul(w,V),a+=Math.imul(m,W),u+=Math.imul(m,$),u+=Math.imul(b,W),c+=Math.imul(b,$),a+=Math.imul(d,J),u+=Math.imul(d,X),u+=Math.imul(y,J),c+=Math.imul(y,X),a+=Math.imul(l,Q),u+=Math.imul(l,ee),u+=Math.imul(h,Q),c+=Math.imul(h,ee);var _e=s+a+((8191&u)<<13);s=c+(u>>>13)+(_e>>>26),_e&=67108863,a=Math.imul(x,F),u=Math.imul(x,q),u+=Math.imul(I,F),c=Math.imul(I,q),a+=Math.imul(k,z),u+=Math.imul(k,V),u+=Math.imul(E,z),c+=Math.imul(E,V),a+=Math.imul(_,W),u+=Math.imul(_,$),u+=Math.imul(w,W),c+=Math.imul(w,$),a+=Math.imul(m,J),u+=Math.imul(m,X),u+=Math.imul(b,J),c+=Math.imul(b,X),a+=Math.imul(d,Q),u+=Math.imul(d,ee),u+=Math.imul(y,Q),c+=Math.imul(y,ee),a+=Math.imul(l,re),u+=Math.imul(l,ne),u+=Math.imul(h,re),c+=Math.imul(h,ne);var we=s+a+((8191&u)<<13);s=c+(u>>>13)+(we>>>26),we&=67108863,a=Math.imul(B,F),u=Math.imul(B,q),u+=Math.imul(C,F),c=Math.imul(C,q),a+=Math.imul(x,z),u+=Math.imul(x,V),u+=Math.imul(I,z),c+=Math.imul(I,V),a+=Math.imul(k,W),u+=Math.imul(k,$),u+=Math.imul(E,W),c+=Math.imul(E,$),a+=Math.imul(_,J),u+=Math.imul(_,X),u+=Math.imul(w,J),c+=Math.imul(w,X),a+=Math.imul(m,Q),u+=Math.imul(m,ee),u+=Math.imul(b,Q),c+=Math.imul(b,ee),a+=Math.imul(d,re),u+=Math.imul(d,ne),u+=Math.imul(y,re),c+=Math.imul(y,ne),a+=Math.imul(l,oe),u+=Math.imul(l,se),u+=Math.imul(h,oe),c+=Math.imul(h,se);var Se=s+a+((8191&u)<<13);s=c+(u>>>13)+(Se>>>26),Se&=67108863,a=Math.imul(O,F),u=Math.imul(O,q),u+=Math.imul(R,F),c=Math.imul(R,q),a+=Math.imul(B,z),u+=Math.imul(B,V),u+=Math.imul(C,z),c+=Math.imul(C,V),a+=Math.imul(x,W),u+=Math.imul(x,$),u+=Math.imul(I,W),c+=Math.imul(I,$),a+=Math.imul(k,J),u+=Math.imul(k,X),u+=Math.imul(E,J),c+=Math.imul(E,X),a+=Math.imul(_,Q),u+=Math.imul(_,ee),u+=Math.imul(w,Q),c+=Math.imul(w,ee),a+=Math.imul(m,re),u+=Math.imul(m,ne),u+=Math.imul(b,re),c+=Math.imul(b,ne),a+=Math.imul(d,oe),u+=Math.imul(d,se),u+=Math.imul(y,oe),c+=Math.imul(y,se),a+=Math.imul(l,ue),u+=Math.imul(l,ce),u+=Math.imul(h,ue),c+=Math.imul(h,ce);var ke=s+a+((8191&u)<<13);s=c+(u>>>13)+(ke>>>26),ke&=67108863,a=Math.imul(L,F),u=Math.imul(L,q),u+=Math.imul(j,F),c=Math.imul(j,q),a+=Math.imul(O,z),u+=Math.imul(O,V),u+=Math.imul(R,z),c+=Math.imul(R,V),a+=Math.imul(B,W),u+=Math.imul(B,$),u+=Math.imul(C,W),c+=Math.imul(C,$),a+=Math.imul(x,J),u+=Math.imul(x,X),u+=Math.imul(I,J),c+=Math.imul(I,X),a+=Math.imul(k,Q),u+=Math.imul(k,ee),u+=Math.imul(E,Q),c+=Math.imul(E,ee),a+=Math.imul(_,re),u+=Math.imul(_,ne),u+=Math.imul(w,re),c+=Math.imul(w,ne),a+=Math.imul(m,oe),u+=Math.imul(m,se),u+=Math.imul(b,oe),c+=Math.imul(b,se),a+=Math.imul(d,ue),u+=Math.imul(d,ce),u+=Math.imul(y,ue),c+=Math.imul(y,ce),a+=Math.imul(l,le),u+=Math.imul(l,he),u+=Math.imul(h,le),c+=Math.imul(h,he);var Ee=s+a+((8191&u)<<13);s=c+(u>>>13)+(Ee>>>26),Ee&=67108863,a=Math.imul(K,F),u=Math.imul(K,q),u+=Math.imul(D,F),c=Math.imul(D,q),a+=Math.imul(L,z),u+=Math.imul(L,V),u+=Math.imul(j,z),c+=Math.imul(j,V),a+=Math.imul(O,W),u+=Math.imul(O,$),u+=Math.imul(R,W),c+=Math.imul(R,$),a+=Math.imul(B,J),u+=Math.imul(B,X),u+=Math.imul(C,J),c+=Math.imul(C,X),a+=Math.imul(x,Q),u+=Math.imul(x,ee),u+=Math.imul(I,Q),c+=Math.imul(I,ee),a+=Math.imul(k,re),u+=Math.imul(k,ne),u+=Math.imul(E,re),c+=Math.imul(E,ne),a+=Math.imul(_,oe),u+=Math.imul(_,se),u+=Math.imul(w,oe),c+=Math.imul(w,se),a+=Math.imul(m,ue),u+=Math.imul(m,ce),u+=Math.imul(b,ue),c+=Math.imul(b,ce),a+=Math.imul(d,le),u+=Math.imul(d,he),u+=Math.imul(y,le),c+=Math.imul(y,he),a+=Math.imul(l,de),u+=Math.imul(l,ye),u+=Math.imul(h,de),c+=Math.imul(h,ye);var Ae=s+a+((8191&u)<<13);s=c+(u>>>13)+(Ae>>>26),Ae&=67108863,a=Math.imul(K,z),u=Math.imul(K,V),u+=Math.imul(D,z),c=Math.imul(D,V),a+=Math.imul(L,W),u+=Math.imul(L,$),u+=Math.imul(j,W),c+=Math.imul(j,$),a+=Math.imul(O,J),u+=Math.imul(O,X),u+=Math.imul(R,J),c+=Math.imul(R,X),a+=Math.imul(B,Q),u+=Math.imul(B,ee),u+=Math.imul(C,Q),c+=Math.imul(C,ee),a+=Math.imul(x,re),u+=Math.imul(x,ne),u+=Math.imul(I,re),c+=Math.imul(I,ne),a+=Math.imul(k,oe),u+=Math.imul(k,se),u+=Math.imul(E,oe),c+=Math.imul(E,se),a+=Math.imul(_,ue),u+=Math.imul(_,ce),u+=Math.imul(w,ue),c+=Math.imul(w,ce),a+=Math.imul(m,le),u+=Math.imul(m,he),u+=Math.imul(b,le),c+=Math.imul(b,he),a+=Math.imul(d,de),u+=Math.imul(d,ye),u+=Math.imul(y,de),c+=Math.imul(y,ye);var xe=s+a+((8191&u)<<13);s=c+(u>>>13)+(xe>>>26),xe&=67108863,a=Math.imul(K,W),u=Math.imul(K,$),u+=Math.imul(D,W),c=Math.imul(D,$),a+=Math.imul(L,J),u+=Math.imul(L,X),u+=Math.imul(j,J),c+=Math.imul(j,X),a+=Math.imul(O,Q),u+=Math.imul(O,ee),u+=Math.imul(R,Q),c+=Math.imul(R,ee),a+=Math.imul(B,re),u+=Math.imul(B,ne),u+=Math.imul(C,re),c+=Math.imul(C,ne),a+=Math.imul(x,oe),u+=Math.imul(x,se),u+=Math.imul(I,oe),c+=Math.imul(I,se),a+=Math.imul(k,ue),u+=Math.imul(k,ce),u+=Math.imul(E,ue),c+=Math.imul(E,ce),a+=Math.imul(_,le),u+=Math.imul(_,he),u+=Math.imul(w,le),c+=Math.imul(w,he),a+=Math.imul(m,de),u+=Math.imul(m,ye),u+=Math.imul(b,de),c+=Math.imul(b,ye);var Ie=s+a+((8191&u)<<13);s=c+(u>>>13)+(Ie>>>26),Ie&=67108863,a=Math.imul(K,J),u=Math.imul(K,X),u+=Math.imul(D,J),c=Math.imul(D,X),a+=Math.imul(L,Q),u+=Math.imul(L,ee),u+=Math.imul(j,Q),c+=Math.imul(j,ee),a+=Math.imul(O,re),u+=Math.imul(O,ne),u+=Math.imul(R,re),c+=Math.imul(R,ne),a+=Math.imul(B,oe),u+=Math.imul(B,se),u+=Math.imul(C,oe),c+=Math.imul(C,se),a+=Math.imul(x,ue),u+=Math.imul(x,ce),u+=Math.imul(I,ue),c+=Math.imul(I,ce),a+=Math.imul(k,le),u+=Math.imul(k,he),u+=Math.imul(E,le),c+=Math.imul(E,he),a+=Math.imul(_,de),u+=Math.imul(_,ye),u+=Math.imul(w,de),c+=Math.imul(w,ye);var Te=s+a+((8191&u)<<13);s=c+(u>>>13)+(Te>>>26),Te&=67108863,a=Math.imul(K,Q),u=Math.imul(K,ee),u+=Math.imul(D,Q),c=Math.imul(D,ee),a+=Math.imul(L,re),u+=Math.imul(L,ne),u+=Math.imul(j,re),c+=Math.imul(j,ne),a+=Math.imul(O,oe),u+=Math.imul(O,se),u+=Math.imul(R,oe),c+=Math.imul(R,se),a+=Math.imul(B,ue),u+=Math.imul(B,ce),u+=Math.imul(C,ue),c+=Math.imul(C,ce),a+=Math.imul(x,le),u+=Math.imul(x,he),u+=Math.imul(I,le),c+=Math.imul(I,he),a+=Math.imul(k,de),u+=Math.imul(k,ye),u+=Math.imul(E,de),c+=Math.imul(E,ye);var Be=s+a+((8191&u)<<13);s=c+(u>>>13)+(Be>>>26),Be&=67108863,a=Math.imul(K,re),u=Math.imul(K,ne),u+=Math.imul(D,re),c=Math.imul(D,ne),a+=Math.imul(L,oe),u+=Math.imul(L,se),u+=Math.imul(j,oe),c+=Math.imul(j,se),a+=Math.imul(O,ue),u+=Math.imul(O,ce),u+=Math.imul(R,ue),c+=Math.imul(R,ce),a+=Math.imul(B,le),u+=Math.imul(B,he),u+=Math.imul(C,le),c+=Math.imul(C,he),a+=Math.imul(x,de),u+=Math.imul(x,ye),u+=Math.imul(I,de),c+=Math.imul(I,ye);var Ce=s+a+((8191&u)<<13);s=c+(u>>>13)+(Ce>>>26),Ce&=67108863,a=Math.imul(K,oe),u=Math.imul(K,se),u+=Math.imul(D,oe),c=Math.imul(D,se),a+=Math.imul(L,ue),u+=Math.imul(L,ce),u+=Math.imul(j,ue),c+=Math.imul(j,ce),a+=Math.imul(O,le),u+=Math.imul(O,he),u+=Math.imul(R,le),c+=Math.imul(R,he),a+=Math.imul(B,de),u+=Math.imul(B,ye),u+=Math.imul(C,de),c+=Math.imul(C,ye);var Pe=s+a+((8191&u)<<13);s=c+(u>>>13)+(Pe>>>26),Pe&=67108863,a=Math.imul(K,ue),u=Math.imul(K,ce),u+=Math.imul(D,ue),c=Math.imul(D,ce),a+=Math.imul(L,le),u+=Math.imul(L,he),u+=Math.imul(j,le),c+=Math.imul(j,he),a+=Math.imul(O,de),u+=Math.imul(O,ye),u+=Math.imul(R,de),c+=Math.imul(R,ye);var Oe=s+a+((8191&u)<<13);s=c+(u>>>13)+(Oe>>>26),Oe&=67108863,a=Math.imul(K,le),u=Math.imul(K,he),u+=Math.imul(D,le),c=Math.imul(D,he),a+=Math.imul(L,de),u+=Math.imul(L,ye),u+=Math.imul(j,de),c+=Math.imul(j,ye);var Re=s+a+((8191&u)<<13);s=c+(u>>>13)+(Re>>>26),Re&=67108863,a=Math.imul(K,de),u=Math.imul(K,ye),u+=Math.imul(D,de),c=Math.imul(D,ye);var Ne=s+a+((8191&u)<<13);return s=c+(u>>>13)+(Ne>>>26),Ne&=67108863,o[0]=ge,o[1]=me,o[2]=be,o[3]=ve,o[4]=_e,o[5]=we,o[6]=Se,o[7]=ke,o[8]=Ee,o[9]=Ae,o[10]=xe,o[11]=Ie,o[12]=Te,o[13]=Be,o[14]=Ce,o[15]=Pe,o[16]=Oe,o[17]=Re,o[18]=Ne,0!==s&&(o[19]=s,r.length++),r}},function(e,t,r){"use strict";var n=r(2).Buffer,i=r(185),o=r(464),s=r(465);function a(){this.x=i.fromBuffer(n.from("79BE667EF9DCBBAC55A06295CE870B07029BFCDB2DCE28D959F2815B16F81798","hex")),this.y=i.fromBuffer(n.from("483ADA7726A3C4655DA4FBFC0E1108A8FD17B448A68554199C47D08FFB10D4B8","hex")),this.inf=!1,this._precompute()}a.prototype._precompute=function(){for(var e=new o(this.x,this.y),t=4,r=new Array(1+Math.ceil(64.25)),n=r[0]=e,i=1;i<r.length;++i){for(var s=0;s<4;s++)n=n.dbl();r[i]=n}this.precomputed={naf:e._getNAFPoints(7),doubles:{step:4,points:r,negpoints:r.map(function(e){return e.neg()})}}},a.prototype.mul=function(e){for(var t=this.precomputed.doubles.step,r=this.precomputed.doubles.points,n=this.precomputed.doubles.negpoints,i=e.getNAF(1),a=((1<<t+1)-(t%2==0?2:1))/3,u=[],c=0;c<i.length;c+=t){for(var f=0,l=c+t-1;l>=c;l--)f=(f<<1)+i[l];u.push(f)}for(var h=new s(null,null,null),p=new s(null,null,null),d=a;d>0;d--){for(var y=0;y<u.length;y++)u[y]===d?p=p.mixedAdd(r[y]):u[y]===-d&&(p=p.mixedAdd(n[y]));h=h.add(p)}return o.fromECJPoint(h)},a.prototype.mulAdd=function(e,t,r){for(var n=this.precomputed.naf,i=t._getNAFPoints1(),o=[n.points,i.points],a=[e.getNAF(n.wnd),r.getNAF(i.wnd)],u=new s(null,null,null),c=[null,null],f=Math.max(a[0].length,a[1].length);f>=0;f--){for(var l=0;f>=0&&(c[0]=0|a[0][f],c[1]=0|a[1][f],0===c[0]&&0===c[1]);++l,--f);if(f>=0&&(l+=1),u=u.dblp(l),f<0)break;for(var h=0;h<2;h++){var p=c[h],d;0!==p&&(p>0?d=o[h][p>>1]:p<0&&(d=o[h][-p>>1].neg()),u=void 0===d.z?u.mixedAdd(d):u.add(d))}}return u},e.exports=new a},function(e,t,r){"use strict";(function(t){const n=r(47),i=r(430),o={"AES-128":{ivSize:16,keySize:16},"AES-256":{ivSize:16,keySize:32},Blowfish:{ivSize:8,cipherKeySize:32}};e.exports=((e,r,s,a)=>{const u=o[e];if(!u)return a(new Error("unkown cipherType passed"));if(!r)return a(new Error("unkown hashType passed"));const c=u.keySize,f=u.ivSize,l=20,h=t.from("key expansion"),p=2*(f+c+20);i.create(r,s,(e,r)=>{if(e)return a(e);r.digest(h,(e,i)=>{if(e)return a(e);let o=[],s=0;function u(e){r.digest(t.concat([i,h]),(t,n)=>{if(t)return e(t);let a=n.length;s+a>p&&(a=p-s),o.push(n),s+=a,r.digest(i,(t,r)=>{if(t)return e(t);i=r,e()})})}function l(e){if(e)return a(e);const r=p/2,n=t.concat(o),i=n.slice(0,r),s=n.slice(r,p),u=e=>({iv:e.slice(0,f),cipherKey:e.slice(f,f+c),macKey:e.slice(f+c)});a(null,{k1:u(i),k2:u(s)})}n(()=>s<p,u,l)})})})}).call(this,r(0).Buffer)},function(e,t,r){"use strict";const n=r(934);e.exports=((e,t)=>{n.generateEphmeralKeyPair(e,t)})},function(e,t,r){"use strict";(function(e){const n=r(254)(),i=r(253),o=r(17).bignum,s=r(461),a=s.toBase64,u=s.toBn,c={"P-256":256,"P-384":384,"P-521":521};t.generateEphmeralKeyPair=function(t,r){i(n.subtle.generateKey({name:"ECDH",namedCurve:t},!0,["deriveBits"]).then(r=>{const o=(o,s,a)=>{let u;"function"==typeof s&&(a=s,s=void 0),u=s?n.subtle.importKey("jwk",p(t,s),{name:"ECDH",namedCurve:t},!1,["deriveBits"]):Promise.resolve(r.privateKey);const f=Promise.all([n.subtle.importKey("jwk",h(t,o),{name:"ECDH",namedCurve:t},!1,[]),u]);i(f.then(e=>n.subtle.deriveBits({name:"ECDH",namedCurve:t,public:e[0]},e[1],c[t])).then(t=>e.from(t)),a)};return n.subtle.exportKey("jwk",r.publicKey).then(e=>({key:l(e),genSharedKey:o}))}),r)};const f={"P-256":32,"P-384":48,"P-521":66};function l(t){const r=f[t.crv];return e.concat([e.from([4]),u(t.x).toArrayLike(e,"be",r),u(t.y).toArrayLike(e,"be",r)],1+2*r)}function h(t,r){const n=f[t];if(!r.slice(0,1).equals(e.from([4])))throw new Error("Invalid key format");const i=new o(r.slice(1,n+1)),s=new o(r.slice(1+n));return{kty:"EC",crv:t,x:a(i,n),y:a(s,n),ext:!0}}function p(e,t){const r=h(e,t.public);return r.d=a(new o(t.private)),r}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";const n=r(19),i={sha1:"sha1","sha2-256":"sha256","sha2-512":"sha512"};function o(e,t,r,o,s){const a=i[s];if(!a)throw new Error(`Hash '${s}' is unknown or not supported`);const u=n.pkcs5.pbkdf2(e,t,r,o,a);return n.util.encode64(u)}e.exports=o},function(e,t,r){"use strict";(function(n){const i=r(14),o=r(937),s=r(13),a=r(5);class u{constructor(e,t,r){s(n.isBuffer(e),"invalid id provided"),t&&r&&s(t.public.bytes.equals(r.bytes),"inconsistent arguments"),this._id=e,this._idB58String=i.toB58String(this.id),this._privKey=t,this._pubKey=r}get id(){return this._id}set id(e){throw new Error("Id is immutable")}get privKey(){return this._privKey}set privKey(e){this._privKey=e}get pubKey(){return this._pubKey?this._pubKey:this._privKey?this._privKey.public:void 0}set pubKey(e){this._pubKey=e}marshalPubKey(){if(this.pubKey)return o.keys.marshalPublicKey(this.pubKey)}marshalPrivKey(){if(this.privKey)return o.keys.marshalPrivateKey(this.privKey)}toPrint(){return this.toJSON()}toJSON(){return{id:this.toB58String(),privKey:c(this.marshalPrivKey()),pubKey:c(this.marshalPubKey())}}toHexString(){return i.toHexString(this.id)}toBytes(){return this.id}toB58String(){return this._idB58String}isEqual(e){if(n.isBuffer(e))return this.id.equals(e);if(e.id)return this.id.equals(e.id);throw new Error("not valid Id")}isValid(e){this.privKey&&this.privKey.public&&this.privKey.public.bytes&&n.isBuffer(this.pubKey.bytes)&&this.privKey.public.bytes.equals(this.pubKey.bytes)?e():e(new Error("Keys not match"))}}function c(e){if(e)return e.toString("base64")}t=e.exports=u,t.create=function(e,t){"function"==typeof e&&(t=e,e={}),e=e||{},e.bits=e.bits||2048,a([t=>o.keys.generateKeyPair("RSA",e.bits,t),(e,t)=>e.public.hash((r,n)=>{t(r,n,e)})],(e,r,n)=>{if(e)return t(e);t(null,new u(r,n))})},t.createFromHexString=function(e){return new u(i.fromHexString(e))},t.createFromBytes=function(e){return new u(e)},t.createFromB58String=function(e){return new u(i.fromB58String(e))},t.createFromPubKey=function(e,t){if("function"!=typeof t)throw new Error("callback is required");let r;try{let i=e;if("string"==typeof i&&(i=n.from(e,"base64")),!n.isBuffer(i))throw new Error("Supplied key is neither a base64 string nor a buffer");r=o.keys.unmarshalPublicKey(i)}catch(e){return t(e)}r.hash((e,n)=>{if(e)return t(e);t(null,new u(n,null,r))})},t.createFromPrivKey=function(e,t){if("function"!=typeof t)throw new Error("callback is required");let r=e;try{if("string"==typeof r&&(r=n.from(e,"base64")),!n.isBuffer(r))throw new Error("Supplied key is neither a base64 string nor a buffer")}catch(e){return t(e)}a([e=>o.keys.unmarshalPrivateKey(r,e),(e,t)=>e.public.hash((r,n)=>{t(r,n,e)})],(e,r,n)=>{if(e)return t(e);t(null,new u(r,n,n.public))})},t.createFromJSON=function(e,t){if("function"!=typeof t)throw new Error("callback is required");let r,s,c,f;try{r=i.fromB58String(e.id),s=e.privKey&&n.from(e.privKey,"base64"),c=e.pubKey&&n.from(e.pubKey,"base64"),f=c&&o.keys.unmarshalPublicKey(c)}catch(e){return t(e)}s?a([e=>o.keys.unmarshalPrivateKey(s,e),(e,t)=>e.public.hash((r,n)=>{t(r,n,e)}),(e,t,r)=>{f?f.hash((n,i)=>{r(n,e,t,i)}):r(null,e,t)}],(e,n,i,o)=>e?t(e):f&&!n.equals(o)?t(new Error("Public and private key do not match")):r&&!n.equals(r)?t(new Error("Id and private key do not match")):void t(null,new u(r,i,f))):t(null,new u(r,null,f))},t.isPeerId=function(e){return Boolean("object"==typeof e&&e._id&&e._idB58String)}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";const n=r(467),i=r(939),o=r(941);t=e.exports,t.aes=i,t.hmac=n,t.keys=o,t.randomBytes=r(472),t.pbkdf2=r(952)},function(e,t,r){"use strict";e.exports={SHA1:20,SHA256:32,SHA512:64}},function(e,t,r){"use strict";const n=r(940),i={16:"aes-128-ctr",32:"aes-256-ctr"};t.create=function(e,t,r){const o=i[e.length];if(!o)return r(new Error("Invalid key length"));const s=n.createCipheriv(o,e,t),a=n.createDecipheriv(o,e,t),u={encrypt(e,t){t(null,s.update(e))},decrypt(e,t){t(null,a.update(e))}};r(null,u)}},function(e,t,r){"use strict";const n=r(70);e.exports={createCipheriv:n.createCipheriv,createDecipheriv:n.createDecipheriv}},function(e,t,r){"use strict";(function(n){const i=r(12),o=i(r(264)),s=r(19);t=e.exports;const a={rsa:r(942),ed25519:r(947),secp256k1:r(72)(o,r(472))};function u(e){const t=a[e.toLowerCase()];return void 0!==t}t.supportedKeys=a,t.keysPBM=o,t.keyStretcher=r(949),t.generateEphemeralKeyPair=r(950),t.generateKeyPair=((e,t,r)=>{let n=a[e.toLowerCase()];if(!n)return r(new Error("invalid or unsupported key type"));n.generateKeyPair(t,r)}),t.generateKeyPairFromSeed=((e,t,r,n)=>{let i=a[e.toLowerCase()];return i?"ed25519"!==e.toLowerCase()?n(new Error("Seed key derivation is unimplemented for RSA or secp256k1")):void i.generateKeyPairFromSeed(t,r,n):n(new Error("invalid or unsupported key type"))}),t.unmarshalPublicKey=(e=>{const t=o.PublicKey.decode(e),r=t.Data;switch(t.Type){case o.KeyType.RSA:return a.rsa.unmarshalRsaPublicKey(r);case o.KeyType.Ed25519:return a.ed25519.unmarshalEd25519PublicKey(r);case o.KeyType.Secp256k1:if(a.secp256k1)return a.secp256k1.unmarshalSecp256k1PublicKey(r);throw new Error("secp256k1 support requires libp2p-crypto-secp256k1 package");default:throw new Error("invalid or unsupported key type")}}),t.marshalPublicKey=((e,t)=>{if(t=(t||"rsa").toLowerCase(),!u(t))throw new Error("invalid or unsupported key type");return e.bytes}),t.unmarshalPrivateKey=((e,t)=>{let r;try{r=o.PrivateKey.decode(e)}catch(e){return t(e)}const n=r.Data;switch(r.Type){case o.KeyType.RSA:return a.rsa.unmarshalRsaPrivateKey(n,t);case o.KeyType.Ed25519:return a.ed25519.unmarshalEd25519PrivateKey(n,t);case o.KeyType.Secp256k1:return a.secp256k1?a.secp256k1.unmarshalSecp256k1PrivateKey(n,t):t(new Error("secp256k1 support requires libp2p-crypto-secp256k1 package"));default:t(new Error("invalid or unsupported key type"))}}),t.marshalPrivateKey=((e,t)=>{if(t=(t||"rsa").toLowerCase(),!u(t))throw new Error("invalid or unsupported key type");return e.bytes}),t.import=((e,t,r)=>{try{const i=s.pki.decryptRsaPrivateKey(e,t);if(null===i)throw new Error("Cannot read the key, most likely the password is wrong or not a RSA key");let o=s.asn1.toDer(s.pki.privateKeyToAsn1(i));return o=n.from(o.getBytes(),"binary"),a.rsa.unmarshalRsaPrivateKey(o,r)}catch(e){r(e)}})}).call(this,r(0).Buffer)},function(e,t,r){"use strict";const n=r(468),i=r(12),o=r(18),s=r(470),a=i(r(264)),u=r(19),c=r(3);class f{constructor(e){this._key=e}verify(e,t,r){g(r),s.hashAndVerify(this._key,t,e,r)}marshal(){return s.utils.jwkToPkix(this._key)}get bytes(){return a.PublicKey.encode({Type:a.KeyType.RSA,Data:this.marshal()})}encrypt(e){return this._key.encrypt(e,"RSAES-PKCS1-V1_5")}equals(e){return this.bytes.equals(e.bytes)}hash(e){g(e),n(this.bytes,"sha2-256",e)}}class l{constructor(e,t){this._key=e,this._publicKey=t}genSecret(){return s.getRandomValues(new Uint8Array(16))}sign(e,t){g(t),s.hashAndSign(this._key,e,t)}get public(){if(!this._publicKey)throw new Error("public key not provided");return new f(this._publicKey)}decrypt(e,t){s.decrypt(this._key,e,t)}marshal(){return s.utils.jwkToPkcs1(this._key)}get bytes(){return a.PrivateKey.encode({Type:a.KeyType.RSA,Data:this.marshal()})}equals(e){return this.bytes.equals(e.bytes)}hash(e){g(e),n(this.bytes,"sha2-256",e)}id(e){this.public.hash((t,r)=>{if(t)return e(t);e(null,o.encode(r))})}export(e,t,r){"function"==typeof t&&(r=t,t=e,e="pkcs-8"),g(r),c(()=>{let n=null,i=null;try{const r=new u.util.ByteBuffer(this.marshal()),o=u.asn1.fromDer(r),s=u.pki.privateKeyFromAsn1(o);if("pkcs-8"===e){const e={algorithm:"aes256",count:1e4,saltSize:16,prfAlgorithm:"sha512"};i=u.pki.encryptRsaPrivateKey(s,t,e)}else n=new Error(`Unknown export format '${e}'`)}catch(e){n=e}r(n,i)})}}function h(e,t){const r=s.utils.pkcs1ToJwk(e);s.unmarshalPrivateKey(r,(e,r)=>{if(e)return t(e);t(null,new l(r.privateKey,r.publicKey))})}function p(e){const t=s.utils.pkixToJwk(e);return new f(t)}function d(e,t){s.unmarshalPrivateKey(e,(e,r)=>{if(e)return t(e);t(null,new l(r.privateKey,r.publicKey))})}function y(e,t){s.generateKey(e,(e,r)=>{if(e)return t(e);t(null,new l(r.privateKey,r.publicKey))})}function g(e){if("function"!=typeof e)throw new Error("callback is required")}e.exports={RsaPublicKey:f,RsaPrivateKey:l,unmarshalRsaPublicKey:p,unmarshalRsaPrivateKey:h,generateKeyPair:y,fromJwk:d}},function(e,t,r){"use strict";(function(t){const n=r(48),i=r(49),o=r(469),s=r(944),a=o.toCallback,u=o.toBuf,c=o.fromString,f=o.fromNumberTo32BitBuf,l=(e,r)=>{s.sha2256(e,(e,n)=>{e&&r(e),s.sha2256(t.from(n),r)})};e.exports={sha1:s.sha1,sha2256:s.sha2256,sha2512:s.sha2512,sha3512:a(u(n.sha3_512)),sha3384:a(u(n.sha3_384)),sha3256:a(u(n.sha3_256)),sha3224:a(u(n.sha3_224)),shake128:a(u(n.shake_128,256)),shake256:a(u(n.shake_256,512)),keccak224:a(u(n.keccak_224)),keccak256:a(u(n.keccak_256)),keccak384:a(u(n.keccak_384)),keccak512:a(u(n.keccak_512)),murmur3128:a(u(c(i.x64.hash128))),murmur332:a(f(c(i.x86.hash32))),addBlake:r(945),dblSha2256:l}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(t){const n=r(50),i=o();function o(){return self.crypto?self.crypto.subtle||self.crypto.webkitSubtle:self.msCrypto?self.msCrypto.subtle:void 0}function s(e){if(!i)throw new Error("Please use a browser with webcrypto support");return(r,o)=>{const s=i.digest({name:e},r);if("function"!=typeof s.then)return s.onerror=(()=>{o(new Error(`hashing data using ${e}`))}),void(s.oncomplete=(e=>{o(null,e.target.result)}));n(s.then(e=>t.from(new Uint8Array(e))),o)}}function a(e,t){s("SHA-1")(e,t)}function u(e,t){s("SHA-256")(e,t)}function c(e,t){s("SHA-512")(e,t)}e.exports={sha1:a,sha2256:u,sha2512:c}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(t){const n=r(51),i=r(469).toCallback,o=45569,s=45633,a={init:n.blake2bInit,update:n.blake2bUpdate,digest:n.blake2bFinal},u={init:n.blake2sInit,update:n.blake2sUpdate,digest:n.blake2sFinal},c=(e,r)=>i(n=>{const i=r.init(e,null);return r.update(i,n),t.from(r.digest(i))});e.exports=(e=>{for(let t=0;t<64;t++)e[o+t]=c(t+1,a);for(let t=0;t<32;t++)e[s+t]=c(t+1,u)})}).call(this,r(0).Buffer)},function(e,t,r){"use strict";const n=r(17),i=r(471),o=i.toBase64,s=i.toBn,a=n.define("RSAPrivateKey",function(){this.seq().obj(this.key("version").int(),this.key("modulus").int(),this.key("publicExponent").int(),this.key("privateExponent").int(),this.key("prime1").int(),this.key("prime2").int(),this.key("exponent1").int(),this.key("exponent2").int(),this.key("coefficient").int())}),u=n.define("AlgorithmIdentifier",function(){this.seq().obj(this.key("algorithm").objid({"1.2.840.113549.1.1.1":"rsa"}),this.key("none").optional().null_(),this.key("curve").optional().objid(),this.key("params").optional().seq().obj(this.key("p").int(),this.key("q").int(),this.key("g").int()))}),c=n.define("RSAPublicKey",function(){this.seq().obj(this.key("algorithm").use(u),this.key("subjectPublicKey").bitstr())}),f=n.define("RSAPublicKey",function(){this.seq().obj(this.key("modulus").int(),this.key("publicExponent").int())});t.pkcs1ToJwk=function(e){const t=a.decode(e,"der");return{kty:"RSA",n:o(t.modulus),e:o(t.publicExponent),d:o(t.privateExponent),p:o(t.prime1),q:o(t.prime2),dp:o(t.exponent1),dq:o(t.exponent2),qi:o(t.coefficient),alg:"RS256",kid:"2011-04-29"}},t.jwkToPkcs1=function(e){return a.encode({version:0,modulus:s(e.n),publicExponent:s(e.e),privateExponent:s(e.d),prime1:s(e.p),prime2:s(e.q),exponent1:s(e.dp),exponent2:s(e.dq),coefficient:s(e.qi)},"der")},t.pkixToJwk=function(e){const t=c.decode(e,"der"),r=f.decode(t.subjectPublicKey.data,"der");return{kty:"RSA",n:o(r.modulus),e:o(r.publicExponent),alg:"RS256",kid:"2011-04-29"}},t.jwkToPkix=function(e){return c.encode({algorithm:{algorithm:"rsa",none:null},subjectPublicKey:{data:f.encode({modulus:s(e.n),publicExponent:s(e.e)},"der")}},"der")}},function(e,t,r){"use strict";(function(t){const n=r(468),i=r(12),o=r(18),s=r(948),a=i(r(264));class u{constructor(e){this._key=y(e,s.publicKeyLength)}verify(e,t,r){d(r),s.hashAndVerify(this._key,t,e,r)}marshal(){return t.from(this._key)}get bytes(){return a.PublicKey.encode({Type:a.KeyType.Ed25519,Data:this.marshal()})}equals(e){return this.bytes.equals(e.bytes)}hash(e){d(e),n(this.bytes,"sha2-256",e)}}class c{constructor(e,t){this._key=y(e,s.privateKeyLength),this._publicKey=y(t,s.publicKeyLength)}sign(e,t){d(t),s.hashAndSign(this._key,e,t)}get public(){if(!this._publicKey)throw new Error("public key not provided");return new u(this._publicKey)}marshal(){return t.concat([t.from(this._key),t.from(this._publicKey)])}get bytes(){return a.PrivateKey.encode({Type:a.KeyType.Ed25519,Data:this.marshal()})}equals(e){return this.bytes.equals(e.bytes)}hash(e){d(e),n(this.bytes,"sha2-256",e)}id(e){this.public.hash((t,r)=>{if(t)return e(t);e(null,o.encode(r))})}}function f(e,t){try{e=y(e,s.privateKeyLength+s.publicKeyLength)}catch(e){return t(e)}const r=e.slice(0,s.privateKeyLength),n=e.slice(s.privateKeyLength,e.length);t(null,new c(r,n))}function l(e){return e=y(e,s.publicKeyLength),new u(e)}function h(e,t){void 0===t&&"function"==typeof e&&(t=e),s.generateKey((e,r)=>{if(e)return t(e);let n;try{n=new c(r.secretKey,r.publicKey)}catch(e){return void t(e)}t(null,n)})}function p(e,t,r){void 0===r&&"function"==typeof t&&(r=t),s.generateKeyFromSeed(e,(e,t)=>{if(e)return r(e);let n;try{n=new c(t.secretKey,t.publicKey)}catch(e){return void r(e)}r(null,n)})}function d(e){if("function"!=typeof e)throw new Error("callback is required")}function y(e,r){if(t.isBuffer(e)&&(e=new Uint8Array(e)),!(e instanceof Uint8Array)||e.length!==r)throw new Error("Key must be a Uint8Array or Buffer of length "+r);return e}e.exports={Ed25519PublicKey:u,Ed25519PrivateKey:c,unmarshalEd25519PrivateKey:f,unmarshalEd25519PublicKey:l,generateKeyPair:h,generateKeyPairFromSeed:p}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(e){const n=r(71),i=r(3);t.publicKeyLength=n.sign.publicKeyLength,t.privateKeyLength=n.sign.secretKeyLength,t.generateKey=function(e){i(()=>{let t;try{t=n.sign.keyPair()}catch(t){return e(t)}e(null,t)})},t.generateKeyFromSeed=function(e,t){i(()=>{let r;try{r=n.sign.keyPair.fromSeed(e)}catch(e){return t(e)}t(null,r)})},t.hashAndSign=function(t,r,o){i(()=>{o(null,e.from(n.sign.detached(r,t)))})},t.hashAndVerify=function(e,t,r,o){i(()=>{let i;try{i=n.sign.detached.verify(r,t,e)}catch(e){return o(e)}o(null,i)})}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(t){const n=r(47),i=r(467),o={"AES-128":{ivSize:16,keySize:16},"AES-256":{ivSize:16,keySize:32},Blowfish:{ivSize:8,cipherKeySize:32}};e.exports=((e,r,s,a)=>{const u=o[e];if(!u)return a(new Error("unkown cipherType passed"));if(!r)return a(new Error("unkown hashType passed"));const c=u.keySize,f=u.ivSize,l=20,h=t.from("key expansion"),p=2*(f+c+20);i.create(r,s,(e,r)=>{if(e)return a(e);r.digest(h,(e,i)=>{if(e)return a(e);let o=[],s=0;function u(e){r.digest(t.concat([i,h]),(t,n)=>{if(t)return e(t);let a=n.length;s+a>p&&(a=p-s),o.push(n),s+=a,r.digest(i,(t,r)=>{if(t)return e(t);i=r,e()})})}function l(e){if(e)return a(e);const r=p/2,n=t.concat(o),i=n.slice(0,r),s=n.slice(r,p),u=e=>({iv:e.slice(0,f),cipherKey:e.slice(f,f+c),macKey:e.slice(f+c)});a(null,{k1:u(i),k2:u(s)})}n(()=>s<p,u,l)})})})}).call(this,r(0).Buffer)},function(e,t,r){"use strict";const n=r(951);e.exports=((e,t)=>{n.generateEphmeralKeyPair(e,t)})},function(e,t,r){"use strict";(function(e){const n=r(263)(),i=r(262),o=r(17).bignum,s=r(471),a=s.toBase64,u=s.toBn,c={"P-256":256,"P-384":384,"P-521":521};t.generateEphmeralKeyPair=function(t,r){i(n.subtle.generateKey({name:"ECDH",namedCurve:t},!0,["deriveBits"]).then(r=>{const o=(o,s,a)=>{let u;"function"==typeof s&&(a=s,s=void 0),u=s?n.subtle.importKey("jwk",p(t,s),{name:"ECDH",namedCurve:t},!1,["deriveBits"]):Promise.resolve(r.privateKey);const f=Promise.all([n.subtle.importKey("jwk",h(t,o),{name:"ECDH",namedCurve:t},!1,[]),u]);i(f.then(e=>n.subtle.deriveBits({name:"ECDH",namedCurve:t,public:e[0]},e[1],c[t])).then(t=>e.from(t)),a)};return n.subtle.exportKey("jwk",r.publicKey).then(e=>({key:l(e),genSharedKey:o}))}),r)};const f={"P-256":32,"P-384":48,"P-521":66};function l(t){const r=f[t.crv];return e.concat([e.from([4]),u(t.x).toArrayLike(e,"be",r),u(t.y).toArrayLike(e,"be",r)],1+2*r)}function h(t,r){const n=f[t];if(!r.slice(0,1).equals(e.from([4])))throw new Error("Invalid key format");const i=new o(r.slice(1,n+1)),s=new o(r.slice(1+n));return{kty:"EC",crv:t,x:a(i,n),y:a(s,n),ext:!0}}function p(e,t){const r=h(e,t.public);return r.d=a(new o(t.private)),r}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";const n=r(19),i={sha1:"sha1","sha2-256":"sha256","sha2-512":"sha512"};function o(e,t,r,o,s){const a=i[s];if(!a)throw new Error(`Hash '${s}' is unknown or not supported`);const u=n.pkcs5.pbkdf2(e,t,r,o,a);return n.util.encode64(u)}e.exports=o},function(e,t,r){"use strict";(function(n){const i=r(79),o=r(27),s=r(954),a=r(270),u=r(23),c=r(18),f=r(73),l=new Error("Sorry, Not Implemented Yet."),h=f.proto(function(e){if(!(this instanceof h))return new h(e);if(null==e&&(e=""),e instanceof n)this.buffer=s.fromBuffer(e);else if("string"==typeof e||e instanceof String)this.buffer=s.fromString(e);else{if(!(e.buffer&&e.protos&&e.protoCodes))throw new Error("addr must be a string, Buffer, or another Multiaddr");this.buffer=s.fromBuffer(e.buffer)}},{className:"Multiaddr",symbolName:"@multiformats/js-multiaddr/multiaddr"});h.prototype.toString=function e(){return s.bufferToString(this.buffer)},h.prototype.toOptions=function e(){const 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},h.prototype.inspect=function e(){return"<Multiaddr "+this.buffer.toString("hex")+" - "+s.bufferToString(this.buffer)+">"},h.prototype.protos=function e(){return i(this.protoCodes(),function(e){return o(a(e))})},h.prototype.protoCodes=function e(){const t=[],r=this.buffer;let n=0;for(;n<r.length;){const e=u.decode(r,n),i=u.decode.bytes,o=a(e),c=s.sizeForAddr(o,r.slice(n+i));n+=c+i,t.push(e)}return t},h.prototype.protoNames=function e(){return i(this.protos(),function(e){return e.name})},h.prototype.tuples=function e(){return s.bufferToTuples(this.buffer)},h.prototype.stringTuples=function e(){const t=s.bufferToTuples(this.buffer);return s.tuplesToStringTuples(t)},h.prototype.encapsulate=function e(t){return t=h(t),h(this.toString()+t.toString())},h.prototype.decapsulate=function e(t){t=t.toString();const r=this.toString(),n=r.lastIndexOf(t);if(n<0)throw new Error("Address "+this+" does not contain subaddress: "+t);return h(r.slice(0,n))},h.prototype.getPeerId=function e(){let t=null;try{t=this.stringTuples().filter(e=>{if(e[0]===a.names.ipfs.code)return!0})[0][1],c.decode(t)}catch(e){t=null}return t},h.prototype.equals=function e(t){return this.buffer.equals(t.buffer)},h.prototype.nodeAddress=function e(){if(!this.isThinWaistAddress())throw new Error('Multiaddr must be "thin waist" address for nodeAddress.');const t=this.protoCodes(),r=this.toString().split("/").slice(1);return{family:41===t[0]?"IPv6":"IPv4",address:r[1],port:r[3]}},h.fromNodeAddress=function e(t,r){if(!t)throw new Error("requires node address object");if(!r)throw new Error("requires transport protocol");const n="IPv6"===t.family?"ip6":"ip4";return h("/"+[n,t.address,r,t.port].join("/"))},h.prototype.isThinWaistAddress=function e(t){const r=(t||this).protos();return 2===r.length&&((4===r[0].code||41===r[0].code)&&(6===r[1].code||17===r[1].code))},h.prototype.fromStupidString=function e(t){throw l},h.protocols=a,h.isName=function e(t){return!!h.isMultiaddr(t)&&t.protos().some(e=>e.resolvable)},h.resolve=function e(t,r){return h.isMultiaddr(t)&&h.isName(t)?r(new Error("not implemented yet")):r(new Error("not a valid name"))},t=e.exports=h}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(t){const n=r(79),i=r(265),o=r(955),s=r(270),a=r(23);function u(e){const t=[],r=e.split("/").slice(1);if(1===r.length&&""===r[0])return[];for(let n=0;n<r.length;n++){const i=r[n],o=s(i);if(0!==o.size){if(n++,n>=r.length)throw S("invalid address: "+e);t.push([i,r[n]])}else t.push([i])}return t}function c(e){const t=[];return n(e,function(e){const r=k(e);t.push(r.name),e.length>1&&t.push(e[1])}),"/"+t.join("/")}function f(e){return n(e,function(e){Array.isArray(e)||(e=[e]);const t=k(e);return e.length>1?[t.code,o.toBuffer(t.code,e[1])]:[t.code]})}function l(e){return n(e,function(e){const t=k(e);return e.length>1?[t.code,o.toString(t.code,e[1])]:[t.code]})}function h(e){return b(t.concat(n(e,function(e){const r=k(e);let n=t.from(a.encode(r.code));return e.length>1&&(n=t.concat([n,e[1]])),n})))}function p(e,t){if(e.size>0)return e.size/8;if(0===e.size)return 0;{const e=a.decode(t);return e+a.decode.bytes}}function d(e){const t=[];let r=0;for(;r<e.length;){const n=a.decode(e,r),i=a.decode.bytes,o=s(n),u=p(o,e.slice(r+i));if(0===u){t.push([n]),r+=i;continue}const c=e.slice(r+i,r+i+u);if(r+=u+i,r>e.length)throw S("Invalid address buffer: "+e.toString("hex"));t.push([n,c])}return t}function y(e){const t=d(e),r=l(t);return c(r)}function g(e){e=w(e);const t=u(e),r=f(t);return h(r)}function m(e){return g(e)}function b(e){const r=v(e);if(r)throw r;return t.from(e)}function v(e){try{d(e)}catch(e){return e}}function _(e){return void 0===v(e)}function w(e){return"/"+i(e.trim().split("/")).join("/")}function S(e){return new Error("Error parsing address: "+e)}function k(e){const t=s(e[0]);return t}e.exports={stringToStringTuples:u,stringTuplesToString:c,tuplesToStringTuples:l,stringTuplesToTuples:f,bufferToTuples:d,tuplesToBuffer:h,bufferToString:y,stringToBuffer:g,fromString:m,fromBuffer:b,validateBuffer:v,isValidBuffer:_,cleanPath:w,ParseError:S,protoFromTuple:k,sizeForAddr:p}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(t){const n=r(266),i=r(267),o=r(270),s=r(18),a=r(23);function u(e,r){return r instanceof t?u.toString(e,r):u.toBuffer(e,r)}function c(e){if(!e.isValid())throw new Error("invalid ip address");return n.toBuffer(e.address)}function f(e){const r=t.alloc(2);return r.writeUInt16BE(e,0),r}function l(e){return e.readUInt16BE(0)}function h(e){const r=t.from(e),n=t.from(a.encode(r.length));return t.concat([n,r])}function p(e){const t=a.decode(e);if(e=e.slice(a.decode.bytes),e.length!==t)throw new Error("inconsistent lengths");return e.toString()}function d(e){const r=t.from(s.decode(e)),n=t.from(a.encode(r.length));return t.concat([n,r])}function y(e){const t=a.decode(e),r=e.slice(a.decode.bytes);if(r.length!==t)throw new Error("inconsistent lengths");return s.encode(r)}e.exports=u,u.toString=function e(t,r){switch(t=o(t),t.code){case 4:case 41:return n.toString(r);case 6:case 17:case 33:case 132:return l(r);case 54:case 55:case 56:return p(r);case 421:return y(r);default:return r.toString("hex")}},u.toBuffer=function e(r,n){switch(r=o(r),r.code){case 4:return c(new i.Address4(n));case 41:return c(new i.Address6(n));case 6:case 17:case 33:case 132:return f(parseInt(n,10));case 54:case 55:case 56:return h(n);case 421:return d(n);default:return t.from(n,"hex")}}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";var n=r(475).BigInteger,i=r(479),o=r(957),s=r(958),a=r(477),u=r(478),c=r(140).sprintf,f=r(268),l=r(269),h=r(474);function p(e){for(var t=/(\d+)(\d{3})/;t.test(e);)e=e.replace(t,"$1,$2");return e}function d(e){return e=e.replace(/^(0{1,})([1-9]+)$/,'<span class="parse-error">$1</span>$2'),e=e.replace(/^(0{1,})(0)$/,'<span class="parse-error">$1</span>$2'),e}function y(e,t){this.groups=void 0===t?l.GROUPS:t,this.v4=!1,this.subnet="/128",this.subnetMask=128,this.zone="",this.address=e;var r=l.RE_SUBNET_STRING.exec(e);if(r){if(this.parsedSubnet=r[0].replace("/",""),this.subnetMask=parseInt(this.parsedSubnet,10),this.subnet="/"+this.subnetMask,isNaN(this.subnetMask)||this.subnetMask<0||this.subnetMask>l.BITS)return this.valid=!1,void(this.error="Invalid subnet mask.");e=e.replace(l.RE_SUBNET_STRING,"")}else if(/\//.test(e))return this.valid=!1,void(this.error="Invalid subnet mask.");var n=l.RE_ZONE_STRING.exec(e);n&&(this.zone=n[0],e=e.replace(l.RE_ZONE_STRING,"")),this.addressMinusSuffix=e,this.parsedAddress=this.parse(this.addressMinusSuffix)}function g(e,t){var r=[],n=[],i;for(i=0;i<e.length;i++)i<t[0]?r.push(e[i]):i>t[1]&&n.push(e[i]);return r.concat(["compact"]).concat(n)}function m(e){return c("%04x",parseInt(e,16))}function b(e){return 255&e}s(y.prototype,r(959)),s(y.prototype,r(960)),s(y.prototype,r(961)),y.fromBigInteger=function(e){var t=a(e.toString(16),32,"0"),r=[],n;for(n=0;n<l.GROUPS;n++)r.push(t.slice(4*n,4*(n+1)));return new y(r.join(":"))},y.fromURL=function(e){var t,r,n;if(-1!==e.indexOf("[")&&-1!==e.indexOf("]:")){if(n=l.RE_URL_WITH_PORT.exec(e),null===n)return{error:"failed to parse address with port",address:null,port:null};t=n[1],r=n[2]}else if(-1!==e.indexOf("/")){if(e=e.replace(/^[a-z0-9]+:\/\//,""),n=l.RE_URL.exec(e),null===n)return{error:"failed to parse address from URL",address:null,port:null};t=n[1]}else t=e;return r?(r=parseInt(r,10),(r<0||r>65536)&&(r=null)):r=null,{address:new y(t),port:r}},y.fromAddress4=function(e){var e=new h(e),t=l.BITS-(f.BITS-e.subnetMask);return new y("::ffff:"+e.correctForm()+"/"+t)},y.fromArpa=function(e){var t=e.replace(/(\.ip6\.arpa)?\.$/,""),r=7;if(63!==t.length)return t={error:"Not Valid 'ip6.arpa' form",address:null},t;t=t.split(".").reverse();for(var n=7;n>0;n--){var i=4*n;t.splice(i,0,":")}return t=t.join(""),new y(t)},y.prototype.microsoftTranscription=function(){return c("%s.ipv6-literal.net",this.correctForm().replace(/:/g,"-"))},y.prototype.mask=function(e){return void 0===e&&(e=this.subnetMask),this.getBitsBase2(0,e)},y.prototype.possibleSubnets=function(e){void 0===e&&(e=128);var t=l.BITS-this.subnetMask,r=Math.abs(e-l.BITS),i=t-r;return i<0?"0":p(new n("2",10).pow(i).toString(10))},y.prototype.startAddress=function(){var e=new n(this.mask()+u(0,l.BITS-this.subnetMask),2);return y.fromBigInteger(e)},y.prototype.endAddress=function(){var e=new n(this.mask()+u(1,l.BITS-this.subnetMask),2);return y.fromBigInteger(e)},y.prototype.getScope=function(){var e=l.SCOPES[this.getBits(12,16)];return"Global unicast"===this.getType()&&"Link local"!==e&&(e="Global"),e},y.prototype.getType=function(){var e=this;function t(t,r){return e.isInSubnet(new y(r))}return i(l.TYPES,t)||"Global unicast"},y.prototype.getBits=function(e,t){return new n(this.getBitsBase2(e,t),2)},y.prototype.getBitsBase2=function(e,t){return this.binaryZeroPad().slice(e,t)},y.prototype.getBitsBase16=function(e,t){var r=t-e;return r%4!=0?null:a(this.getBits(e,t).toString(16),r/4,"0")},y.prototype.getBitsPastSubnet=function(){return this.getBitsBase2(this.subnetMask,l.BITS)},y.prototype.reverseForm=function(e){e||(e={});var t=Math.floor(this.subnetMask/4),r=this.canonicalForm().replace(/:/g,"").split("").slice(0,t).reverse().join(".");return t>0?e.omitSuffix?r:c("%s.ip6.arpa.",r):e.omitSuffix?"":"ip6.arpa."},y.prototype.correctForm=function(){if(!this.parsedAddress)return null;var e,t=[],r=0,n=[];for(e=0;e<this.parsedAddress.length;e++){var i=parseInt(this.parsedAddress[e],16);0===i&&r++,0!==i&&r>0&&(r>1&&n.push([e-r,e-1]),r=0)}r>1&&n.push([this.parsedAddress.length-r,this.parsedAddress.length-1]);var s=n.map(function(e){return e[1]-e[0]+1});if(n.length>0){var a=s.indexOf(o(s));t=g(this.parsedAddress,n[a])}else t=this.parsedAddress;for(e=0;e<t.length;e++)"compact"!==t[e]&&(t[e]=parseInt(t[e],16).toString(16));var u=t.join(":");return u=u.replace(/^compact$/,"::"),u=u.replace(/^compact|compact$/,":"),u=u.replace(/compact/,""),u},y.prototype.binaryZeroPad=function(){return a(this.bigInteger().toString(2),l.BITS,"0")},y.prototype.parse4in6=function(e){var t=e.split(":"),r=t.slice(-1)[0],n=r.match(f.RE_ADDRESS);if(n){for(var i=new h(n[0]),o=0;o<i.groups;o++)if(/^0[0-9]+/.test(i.parsedAddress[o]))return this.valid=!1,this.error="IPv4 addresses can not have leading zeroes.",this.parseError=e.replace(f.RE_ADDRESS,i.parsedAddress.map(d).join(".")),null;this.v4=!0,t[t.length-1]=i.toGroup6(),e=t.join(":")}return e},y.prototype.parse=function(e){if(e=this.parse4in6(e),this.error)return null;var t=e.match(l.RE_BAD_CHARACTERS);if(t)return this.valid=!1,this.error=c("Bad character%s detected in address: %s",t.length>1?"s":"",t.join("")),this.parseError=e.replace(l.RE_BAD_CHARACTERS,'<span class="parse-error">$1</span>'),null;var r=e.match(l.RE_BAD_ADDRESS);if(r)return this.valid=!1,this.error=c("Address failed regex: %s",r.join("")),this.parseError=e.replace(l.RE_BAD_ADDRESS,'<span class="parse-error">$1</span>'),null;var n=[],i=e.split("::");if(2===i.length){var o=i[0].split(":"),s=i[1].split(":");1===o.length&&""===o[0]&&(o=[]),1===s.length&&""===s[0]&&(s=[]);var a=this.groups-(o.length+s.length);if(!a)return this.valid=!1,this.error="Error parsing groups",null;this.elidedGroups=a,this.elisionBegin=o.length,this.elisionEnd=o.length+this.elidedGroups,o.forEach(function(e){n.push(e)});for(var u=0;u<a;u++)n.push(0);s.forEach(function(e){n.push(e)})}else{if(1!==i.length)return this.valid=!1,this.error="Too many :: groups found",null;n=e.split(":"),this.elidedGroups=0}return n=n.map(function(e){return c("%x",parseInt(e,16))}),n.length!==this.groups?(this.valid=!1,this.error="Incorrect number of groups found",null):(this.valid=!0,n)},y.prototype.canonicalForm=function(){return this.valid?this.parsedAddress.map(m).join(":"):null},y.prototype.decimal=function(){return this.valid?this.parsedAddress.map(function(e){return c("%05d",parseInt(e,16))}).join(":"):null},y.prototype.bigInteger=function(){return this.valid?new n(this.parsedAddress.map(m).join(""),16):null},y.prototype.to4=function(){var e=this.binaryZeroPad().split("");return h.fromHex(new n(e.slice(96,128).join(""),2).toString(16))},y.prototype.to4in6=function(){var e=this.to4(),t=new y(this.parsedAddress.slice(0,6).join(":"),6),r=t.correctForm(),n="";return/:$/.test(r)||(n=":"),t.correctForm()+n+e.address},y.prototype.inspectTeredo=function(){var e=this.getBitsBase16(0,32),t=this.getBits(80,96).xor(new n("ffff",16)).toString(),r=h.fromHex(this.getBitsBase16(32,64)),i=h.fromHex(this.getBits(96,128).xor(new n("ffffffff",16)).toString(16)),o=this.getBits(64,80),s=this.getBitsBase2(64,80),a=o.testBit(15),u=o.testBit(14),f=o.testBit(8),l=o.testBit(9),p=new n(s.slice(2,6)+s.slice(8,16),2).toString(10);return{prefix:c("%s:%s",e.slice(0,4),e.slice(4,8)),server4:r.address,client4:i.address,flags:s,coneNat:a,microsoft:{reserved:u,universalLocal:l,groupIndividual:f,nonce:p},udpPort:t}},y.prototype.inspect6to4=function(){var e=this.getBitsBase16(0,16),t=h.fromHex(this.getBitsBase16(16,48));return{prefix:c("%s",e.slice(0,4)),gateway:t.address}},y.prototype.to6to4=function(){if(!this.is4())return null;var e=["2002",this.getBitsBase16(96,112),this.getBitsBase16(112,128),"","/16"].join(":");return new y(e)},y.prototype.toByteArray=function(){var e=this.bigInteger().toByteArray();return 17===e.length&&0===e[0]?e.slice(1):e},y.prototype.toUnsignedByteArray=function(){return this.toByteArray().map(b)},y.fromByteArray=function(e){return this.fromUnsignedByteArray(e.map(b))},y.fromUnsignedByteArray=function(e){for(var t=new n("256",10),r=new n("0",10),i=new n("1",10),o=e.length-1;o>=0;o--)r=r.add(i.multiply(new n(e[o].toString(10),10))),i=i.multiply(t);return y.fromBigInteger(r)},e.exports=y},function(e,t){var r="[object Symbol]",n=Object.prototype,i=n.toString;function o(e,t,r){for(var n=-1,i=e.length;++n<i;){var o=e[n],s=t(o);if(null!=s&&(void 0===a?s==s&&!u(s):r(s,a)))var a=s,c=o}return c}function s(e,t){return e>t}function a(e){return!!e&&"object"==typeof e}function u(e){return"symbol"==typeof e||a(e)&&i.call(e)==r}function c(e){return e}function f(e){return e&&e.length?o(e,c,s):void 0}e.exports=f},function(e,t,r){(function(e,r){var n=200,i="__lodash_hash_undefined__",o=800,s=16,a=9007199254740991,u="[object Arguments]",c="[object Array]",f="[object AsyncFunction]",l="[object Boolean]",h="[object Date]",p="[object Error]",d="[object Function]",y="[object GeneratorFunction]",g="[object Map]",m="[object Number]",b="[object Null]",v="[object Object]",_="[object Proxy]",w="[object RegExp]",S="[object Set]",k="[object String]",E="[object Undefined]",A="[object WeakMap]",x="[object ArrayBuffer]",I="[object DataView]",T="[object Float32Array]",B="[object Float64Array]",C="[object Int8Array]",P="[object Int16Array]",O="[object Int32Array]",R="[object Uint8Array]",N="[object Uint8ClampedArray]",L="[object Uint16Array]",j="[object Uint32Array]",M=/[\\^$.*+?()[\]{}|]/g,K=/^\[object .+?Constructor\]$/,D=/^(?:0|[1-9]\d*)$/,U={};U[T]=U[B]=U[C]=U[P]=U[O]=U[R]=U[N]=U[L]=U[j]=!0,U[u]=U[c]=U[x]=U[l]=U[I]=U[h]=U[p]=U[d]=U[g]=U[m]=U[v]=U[w]=U[S]=U[k]=U[A]=!1;var F="object"==typeof e&&e&&e.Object===Object&&e,q="object"==typeof self&&self&&self.Object===Object&&self,H=F||q||Function("return this")(),z="object"==typeof t&&t&&!t.nodeType&&t,V=z&&"object"==typeof r&&r&&!r.nodeType&&r,G=V&&V.exports===z,W=G&&F.process,$=function(){try{return W&&W.binding&&W.binding("util")}catch(e){}}(),Y=$&&$.isTypedArray;function J(e,t,r){switch(r.length){case 0:return e.call(t);case 1:return e.call(t,r[0]);case 2:return e.call(t,r[0],r[1]);case 3:return e.call(t,r[0],r[1],r[2])}return e.apply(t,r)}function X(e,t){for(var r=-1,n=Array(e);++r<e;)n[r]=t(r);return n}function Z(e){return function(t){return e(t)}}function Q(e,t){return null==e?void 0:e[t]}function ee(e,t){return function(r){return e(t(r))}}function te(e,t){return"__proto__"==t?void 0:e[t]}var re=Array.prototype,ne=Function.prototype,ie=Object.prototype,oe=H["__core-js_shared__"],se=ne.toString,ae=ie.hasOwnProperty,ue=(ce=/[^.]+$/.exec(oe&&oe.keys&&oe.keys.IE_PROTO||""),ce?"Symbol(src)_1."+ce:""),ce,fe=ie.toString,le=se.call(Object),he=RegExp("^"+se.call(ae).replace(M,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),pe=G?H.Buffer:void 0,de=H.Symbol,ye=H.Uint8Array,ge=pe?pe.allocUnsafe:void 0,me=ee(Object.getPrototypeOf,Object),be=Object.create,ve=ie.propertyIsEnumerable,_e=re.splice,we=de?de.toStringTag:void 0,Se=function(){try{var e=St(Object,"defineProperty");return e({},"",{}),e}catch(e){}}(),ke=pe?pe.isBuffer:void 0,Ee=Math.max,Ae=Date.now,xe=St(H,"Map"),Ie=St(Object,"create"),Te=function(){function e(){}return function(t){if(!zt(t))return{};if(be)return be(t);e.prototype=t;var r=new e;return e.prototype=void 0,r}}();function Be(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}function Ce(){this.__data__=Ie?Ie(null):{},this.size=0}function Pe(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}function Oe(e){var t=this.__data__;if(Ie){var r=t[e];return r===i?void 0:r}return ae.call(t,e)?t[e]:void 0}function Re(e){var t=this.__data__;return Ie?void 0!==t[e]:ae.call(t,e)}function Ne(e,t){var r=this.__data__;return this.size+=this.has(e)?0:1,r[e]=Ie&&void 0===t?i:t,this}function Le(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}function je(){this.__data__=[],this.size=0}function Me(e){var t=this.__data__,r=rt(t,e);if(r<0)return!1;var n=t.length-1;return r==n?t.pop():_e.call(t,r,1),--this.size,!0}function Ke(e){var t=this.__data__,r=rt(t,e);return r<0?void 0:t[r][1]}function De(e){return rt(this.__data__,e)>-1}function Ue(e,t){var r=this.__data__,n=rt(r,e);return n<0?(++this.size,r.push([e,t])):r[n][1]=t,this}function Fe(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}function qe(){this.size=0,this.__data__={hash:new Be,map:new(xe||Le),string:new Be}}function He(e){var t=wt(this,e).delete(e);return this.size-=t?1:0,t}function ze(e){return wt(this,e).get(e)}function Ve(e){return wt(this,e).has(e)}function Ge(e,t){var r=wt(this,e),n=r.size;return r.set(e,t),this.size+=r.size==n?0:1,this}function We(e){var t=this.__data__=new Le(e);this.size=t.size}function $e(){this.__data__=new Le,this.size=0}function Ye(e){var t=this.__data__,r=t.delete(e);return this.size=t.size,r}function Je(e){return this.__data__.get(e)}function Xe(e){return this.__data__.has(e)}function Ze(e,t){var r=this.__data__;if(r instanceof Le){var i=r.__data__;if(!xe||i.length<n-1)return i.push([e,t]),this.size=++r.size,this;r=this.__data__=new Fe(i)}return r.set(e,t),this.size=r.size,this}function Qe(e,t){var r=Kt(e),n=!r&&Mt(e),i=!r&&!n&&Ft(e),o=!r&&!n&&!i&&Wt(e),s=r||n||i||o,a=s?X(e.length,String):[],u=a.length;for(var c in e)!t&&!ae.call(e,c)||s&&("length"==c||i&&("offset"==c||"parent"==c)||o&&("buffer"==c||"byteLength"==c||"byteOffset"==c)||At(c,u))||a.push(c);return a}function et(e,t,r){(void 0===r||jt(e[t],r))&&(void 0!==r||t in e)||nt(e,t,r)}function tt(e,t,r){var n=e[t];ae.call(e,t)&&jt(n,r)&&(void 0!==r||t in e)||nt(e,t,r)}function rt(e,t){for(var r=e.length;r--;)if(jt(e[r][0],t))return r;return-1}function nt(e,t,r){"__proto__"==t&&Se?Se(e,t,{configurable:!0,enumerable:!0,value:r,writable:!0}):e[t]=r}Be.prototype.clear=Ce,Be.prototype.delete=Pe,Be.prototype.get=Oe,Be.prototype.has=Re,Be.prototype.set=Ne,Le.prototype.clear=je,Le.prototype.delete=Me,Le.prototype.get=Ke,Le.prototype.has=De,Le.prototype.set=Ue,Fe.prototype.clear=qe,Fe.prototype.delete=He,Fe.prototype.get=ze,Fe.prototype.has=Ve,Fe.prototype.set=Ge,We.prototype.clear=$e,We.prototype.delete=Ye,We.prototype.get=Je,We.prototype.has=Xe,We.prototype.set=Ze;var it=_t();function ot(e){return null==e?void 0===e?E:b:we&&we in Object(e)?kt(e):Pt(e)}function st(e){return Vt(e)&&ot(e)==u}function at(e){if(!zt(e)||Tt(e))return!1;var t=qt(e)?he:K;return t.test(Lt(e))}function ut(e){return Vt(e)&&Ht(e.length)&&!!U[ot(e)]}function ct(e){if(!zt(e))return Ct(e);var t=Bt(e),r=[];for(var n in e)("constructor"!=n||!t&&ae.call(e,n))&&r.push(n);return r}function ft(e,t,r,n,i){e!==t&&it(t,function(o,s){if(zt(o))i||(i=new We),lt(e,t,s,r,ft,n,i);else{var a=n?n(te(e,s),o,s+"",e,t,i):void 0;void 0===a&&(a=o),et(e,s,a)}},Yt)}function lt(e,t,r,n,i,o,s){var a=te(e,r),u=te(t,r),c=s.get(u);if(c)et(e,r,c);else{var f=o?o(a,u,r+"",e,t,s):void 0,l=void 0===f;if(l){var h=Kt(u),p=!h&&Ft(u),d=!h&&!p&&Wt(u);f=u,h||p||d?Kt(a)?f=a:Ut(a)?f=mt(a):p?(l=!1,f=dt(u,!0)):d?(l=!1,f=gt(u,!0)):f=[]:Gt(u)||Mt(u)?(f=a,Mt(a)?f=$t(a):(!zt(a)||n&&qt(a))&&(f=Et(u))):l=!1}l&&(s.set(u,f),i(f,u,n,o,s),s.delete(u)),et(e,r,f)}}function ht(e,t){return Rt(Ot(e,t,Zt),e+"")}var pt=Se?function(e,t){return Se(e,"toString",{configurable:!0,enumerable:!1,value:Xt(t),writable:!0})}:Zt;function dt(e,t){if(t)return e.slice();var r=e.length,n=ge?ge(r):new e.constructor(r);return e.copy(n),n}function yt(e){var t=new e.constructor(e.byteLength);return new ye(t).set(new ye(e)),t}function gt(e,t){var r=t?yt(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.length)}function mt(e,t){var r=-1,n=e.length;for(t||(t=Array(n));++r<n;)t[r]=e[r];return t}function bt(e,t,r,n){var i=!r;r||(r={});for(var o=-1,s=t.length;++o<s;){var a=t[o],u=n?n(r[a],e[a],a,r,e):void 0;void 0===u&&(u=e[a]),i?nt(r,a,u):tt(r,a,u)}return r}function vt(e){return ht(function(t,r){var n=-1,i=r.length,o=i>1?r[i-1]:void 0,s=i>2?r[2]:void 0;for(o=e.length>3&&"function"==typeof o?(i--,o):void 0,s&&xt(r[0],r[1],s)&&(o=i<3?void 0:o,i=1),t=Object(t);++n<i;){var a=r[n];a&&e(t,a,n,o)}return t})}function _t(e){return function(t,r,n){for(var i=-1,o=Object(t),s=n(t),a=s.length;a--;){var u=s[e?a:++i];if(!1===r(o[u],u,o))break}return t}}function wt(e,t){var r=e.__data__;return It(t)?r["string"==typeof t?"string":"hash"]:r.map}function St(e,t){var r=Q(e,t);return at(r)?r:void 0}function kt(e){var t=ae.call(e,we),r=e[we];try{e[we]=void 0;var n=!0}catch(e){}var i=fe.call(e);return n&&(t?e[we]=r:delete e[we]),i}function Et(e){return"function"!=typeof e.constructor||Bt(e)?{}:Te(me(e))}function At(e,t){var r=typeof e;return t=null==t?a:t,!!t&&("number"==r||"symbol"!=r&&D.test(e))&&e>-1&&e%1==0&&e<t}function xt(e,t,r){if(!zt(r))return!1;var n=typeof t;return!!("number"==n?Dt(r)&&At(t,r.length):"string"==n&&t in r)&&jt(r[t],e)}function It(e){var t=typeof e;return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e}function Tt(e){return!!ue&&ue in e}function Bt(e){var t=e&&e.constructor,r="function"==typeof t&&t.prototype||ie;return e===r}function Ct(e){var t=[];if(null!=e)for(var r in Object(e))t.push(r);return t}function Pt(e){return fe.call(e)}function Ot(e,t,r){return t=Ee(void 0===t?e.length-1:t,0),function(){for(var n=arguments,i=-1,o=Ee(n.length-t,0),s=Array(o);++i<o;)s[i]=n[t+i];i=-1;for(var a=Array(t+1);++i<t;)a[i]=n[i];return a[t]=r(s),J(e,this,a)}}var Rt=Nt(pt);function Nt(e){var t=0,r=0;return function(){var n=Ae(),i=s-(n-r);if(r=n,i>0){if(++t>=o)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}function Lt(e){if(null!=e){try{return se.call(e)}catch(e){}try{return e+""}catch(e){}}return""}function jt(e,t){return e===t||e!=e&&t!=t}var Mt=st(function(){return arguments}())?st:function(e){return Vt(e)&&ae.call(e,"callee")&&!ve.call(e,"callee")},Kt=Array.isArray;function Dt(e){return null!=e&&Ht(e.length)&&!qt(e)}function Ut(e){return Vt(e)&&Dt(e)}var Ft=ke||Qt;function qt(e){if(!zt(e))return!1;var t=ot(e);return t==d||t==y||t==f||t==_}function Ht(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=a}function zt(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}function Vt(e){return null!=e&&"object"==typeof e}function Gt(e){if(!Vt(e)||ot(e)!=v)return!1;var t=me(e);if(null===t)return!0;var r=ae.call(t,"constructor")&&t.constructor;return"function"==typeof r&&r instanceof r&&se.call(r)==le}var Wt=Y?Z(Y):ut;function $t(e){return bt(e,Yt(e))}function Yt(e){return Dt(e)?Qe(e,!0):ct(e)}var Jt=vt(function(e,t,r){ft(e,t,r)});function Xt(e){return function(){return e}}function Zt(e){return e}function Qt(){return!1}r.exports=Jt}).call(this,r(7),r(28)(e))},function(e,t,r){"use strict";var n=r(476),i=r(269);t.isValid=function(){return this.valid},t.isInSubnet=n.isInSubnet,t.isCorrect=n.isCorrect(i.BITS),t.isCanonical=n.falseIfInvalid(function(){return this.addressMinusSuffix===this.canonicalForm()}),t.isLinkLocal=n.falseIfInvalid(function(){return"1111111010000000000000000000000000000000000000000000000000000000"===this.getBitsBase2(0,64)}),t.isMulticast=n.falseIfInvalid(function(){return"Multicast"===this.getType()}),t.is4=n.falseIfInvalid(function(){return this.v4}),t.isTeredo=n.falseIfInvalid(function(){return this.isInSubnet(new this.constructor("2001::/32"))}),t.is6to4=n.falseIfInvalid(function(){return this.isInSubnet(new this.constructor("2002::/16"))}),t.isLoopback=n.falseIfInvalid(function(){return"Loopback"===this.getType()})},function(e,t,r){"use strict";var n=r(268),i=r(480),o=r(140).sprintf;t.href=function(e){return e=void 0===e?"":o(":%s",e),o("http://[%s]%s/",this.correctForm(),e)},t.link=function(e){e||(e={}),void 0===e.className&&(e.className=""),void 0===e.prefix&&(e.prefix="/#address="),void 0===e.v4&&(e.v4=!1);var t=this.correctForm;return e.v4&&(t=this.to4in6),e.className?o('<a href="%1$s%2$s" class="%3$s">%2$s</a>',e.prefix,t.call(this),e.className):o('<a href="%1$s%2$s">%2$s</a>',e.prefix,t.call(this))},t.group=function(){var e=this.address.match(n.RE_ADDRESS),t;if(e){var r=e[0].split(".");this.address=this.address.replace(n.RE_ADDRESS,o('<span class="hover-group group-v4 group-6">%s</span>.<span class="hover-group group-v4 group-7">%s</span>',r.slice(0,2).join("."),r.slice(2,4).join(".")))}if(0===this.elidedGroups)return i.simpleGroup(this.address);var s=[],a=this.address.split("::");a[0].length?s.push(i.simpleGroup(a[0])):s.push("");var u=["hover-group"];for(t=this.elisionBegin;t<this.elisionBegin+this.elidedGroups;t++)u.push(o("group-%d",t));return s.push(o('<span class="%s"></span>',u.join(" "))),a[1].length?s.push(i.simpleGroup(a[1],this.elisionEnd)):s.push(""),s.join(":")}},function(e,t,r){"use strict";var n=r(140).sprintf,i=r(269);function o(e){return n("(%s)",e.join("|"))}function s(e){return e.length<4?n("0{0,%d}%s",4-e.length,e):e}function a(e){var t=[];e.forEach(function(e,r){var n=parseInt(e,16);0===n&&t.push(r)});var r=t.map(function(t){return e.map(function(e,r){if(r===t){var n=0===r||r===i.GROUPS-1?":":"";return o([s(e),n])}return s(e)}).join(":")});return r.push(e.map(s).join(":")),o(r)}function u(e,t,r){var i=t?"":":",s=r?"":":",a=[];t||r||a.push("::"),t&&r&&a.push(""),(r&&!t||!r&&t)&&a.push(":"),a.push(n("%s(:0{1,4}){1,%d}",i,e-1)),a.push(n("(0{1,4}:){1,%d}%s",e-1,s)),a.push(n("(0{1,4}:){%d}0{1,4}",e-1));for(var u=1;u<e-1;u++)for(var c=1;c<e-u;c++)a.push(n("(0{1,4}:){%d}:(0{1,4}:){%d}0{1,4}",c,e-c-u-1));return o(a)}t.regularExpressionString=function(e){void 0===e&&(e=!1);var t=[],r=new this.constructor(this.correctForm());if(0===r.elidedGroups)t.push(a(r.parsedAddress));else if(r.elidedGroups===i.GROUPS)t.push(u(i.GROUPS));else{var n=r.address.split("::");n[0].length&&t.push(a(n[0].split(":"))),t.push(u(r.elidedGroups,0!==n[0].length,0!==n[1].length)),n[1].length&&t.push(a(n[1].split(":"))),t=[t.join(":")]}return e||(t=[].concat("(?=^|\\b|[^\\w\\:])(",t,")(?=[^\\w\\:]|\\b|$)")),t.join("")},t.regularExpression=function(e){return new RegExp(this.regularExpressionString(e),"i")}},function(e,t,r){"use strict";const n=r(473).ensureMultiaddr,i=r(963);class o{constructor(e){this._multiaddrs=e||[],this._observedMultiaddrs=[]}add(e){e=n(e),this.has(e)||this._multiaddrs.push(e)}addSafe(e){e=n(e);const t=this._observedMultiaddrs.some((t,r)=>{if(t.equals(e))return this.add(e),this._observedMultiaddrs.splice(r,1),!0});t||this._observedMultiaddrs.push(e)}toArray(){return this._multiaddrs.slice()}get size(){return this._multiaddrs.length}forEach(e){return this._multiaddrs.forEach(e)}filterBy(e){return"object"!=typeof e||"function"!=typeof e.matches||"function"!=typeof e.partialMatch||"function"!=typeof e.toString?[]:this._multiaddrs.filter(t=>e.matches(t))}has(e){return e=n(e),this._multiaddrs.some(t=>t.equals(e))}delete(e){e=n(e),this._multiaddrs.some((t,r)=>{if(t.equals(e))return this._multiaddrs.splice(r,1),!0})}replace(e,t){Array.isArray(e)||(e=[e]),Array.isArray(t)||(t=[t]),e.forEach(e=>this.delete(e)),t.forEach(e=>this.add(e))}clear(){this._multiaddrs=[]}distinct(){return i(this._multiaddrs,e=>[e.toOptions().port,e.toOptions().transport].join())}}e.exports=o},function(e,t,r){(function(e,r){var n=200,i="Expected a function",o="__lodash_hash_undefined__",s=1,a=2,u=1/0,c=9007199254740991,f="[object Arguments]",l="[object Array]",h="[object Boolean]",p="[object Date]",d="[object Error]",y="[object Function]",g="[object GeneratorFunction]",m="[object Map]",b="[object Number]",v="[object Object]",_="[object Promise]",w="[object RegExp]",S="[object Set]",k="[object String]",E="[object Symbol]",A="[object WeakMap]",x="[object ArrayBuffer]",I="[object DataView]",T="[object Float32Array]",B="[object Float64Array]",C="[object Int8Array]",P="[object Int16Array]",O="[object Int32Array]",R="[object Uint8Array]",N="[object Uint8ClampedArray]",L="[object Uint16Array]",j="[object Uint32Array]",M=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,K=/^\w*$/,D=/^\./,U=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,F=/[\\^$.*+?()[\]{}|]/g,q=/\\(\\)?/g,H=/^\[object .+?Constructor\]$/,z=/^(?:0|[1-9]\d*)$/,V={};V[T]=V[B]=V[C]=V[P]=V[O]=V[R]=V[N]=V[L]=V[j]=!0,V[f]=V[l]=V[x]=V[h]=V[I]=V[p]=V[d]=V[y]=V[m]=V[b]=V[v]=V[w]=V[S]=V[k]=V[A]=!1;var G="object"==typeof e&&e&&e.Object===Object&&e,W="object"==typeof self&&self&&self.Object===Object&&self,$=G||W||Function("return this")(),Y="object"==typeof t&&t&&!t.nodeType&&t,J=Y&&"object"==typeof r&&r&&!r.nodeType&&r,X=J&&J.exports===Y,Z=X&&G.process,Q=function(){try{return Z&&Z.binding("util")}catch(e){}}(),ee=Q&&Q.isTypedArray;function te(e,t){var r=e?e.length:0;return!!r&&oe(e,t,0)>-1}function re(e,t,r){for(var n=-1,i=e?e.length:0;++n<i;)if(r(t,e[n]))return!0;return!1}function ne(e,t){for(var r=-1,n=e?e.length:0;++r<n;)if(t(e[r],r,e))return!0;return!1}function ie(e,t,r,n){for(var i=e.length,o=r+(n?1:-1);n?o--:++o<i;)if(t(e[o],o,e))return o;return-1}function oe(e,t,r){if(t!=t)return ie(e,se,r);for(var n=r-1,i=e.length;++n<i;)if(e[n]===t)return n;return-1}function se(e){return e!=e}function ae(e){return function(t){return null==t?void 0:t[e]}}function ue(e,t){for(var r=-1,n=Array(e);++r<e;)n[r]=t(r);return n}function ce(e){return function(t){return e(t)}}function fe(e,t){return e.has(t)}function le(e,t){return null==e?void 0:e[t]}function he(e){var t=!1;if(null!=e&&"function"!=typeof e.toString)try{t=!!(e+"")}catch(e){}return t}function pe(e){var t=-1,r=Array(e.size);return e.forEach(function(e,n){r[++t]=[n,e]}),r}function de(e,t){return function(r){return e(t(r))}}function ye(e){var t=-1,r=Array(e.size);return e.forEach(function(e){r[++t]=e}),r}var ge=Array.prototype,me=Function.prototype,be=Object.prototype,ve=$["__core-js_shared__"],_e=(we=/[^.]+$/.exec(ve&&ve.keys&&ve.keys.IE_PROTO||""),we?"Symbol(src)_1."+we:""),we,Se=me.toString,ke=be.hasOwnProperty,Ee=be.toString,Ae=RegExp("^"+Se.call(ke).replace(F,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),xe=$.Symbol,Ie=$.Uint8Array,Te=be.propertyIsEnumerable,Be=ge.splice,Ce=de(Object.keys,Object),Pe=qt($,"DataView"),Oe=qt($,"Map"),Re=qt($,"Promise"),Ne=qt($,"Set"),Le=qt($,"WeakMap"),je=qt(Object,"create"),Me=er(Pe),Ke=er(Oe),De=er(Re),Ue=er(Ne),Fe=er(Le),qe=xe?xe.prototype:void 0,He=qe?qe.valueOf:void 0,ze=qe?qe.toString:void 0;function Ve(e){var t=-1,r=e?e.length:0;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}function Ge(){this.__data__=je?je(null):{}}function We(e){return this.has(e)&&delete this.__data__[e]}function $e(e){var t=this.__data__;if(je){var r=t[e];return r===o?void 0:r}return ke.call(t,e)?t[e]:void 0}function Ye(e){var t=this.__data__;return je?void 0!==t[e]:ke.call(t,e)}function Je(e,t){var r=this.__data__;return r[e]=je&&void 0===t?o:t,this}function Xe(e){var t=-1,r=e?e.length:0;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}function Ze(){this.__data__=[]}function Qe(e){var t=this.__data__,r=vt(t,e);if(r<0)return!1;var n=t.length-1;return r==n?t.pop():Be.call(t,r,1),!0}function et(e){var t=this.__data__,r=vt(t,e);return r<0?void 0:t[r][1]}function tt(e){return vt(this.__data__,e)>-1}function rt(e,t){var r=this.__data__,n=vt(r,e);return n<0?r.push([e,t]):r[n][1]=t,this}function nt(e){var t=-1,r=e?e.length:0;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}function it(){this.__data__={hash:new Ve,map:new(Oe||Xe),string:new Ve}}function ot(e){return Ut(this,e).delete(e)}function st(e){return Ut(this,e).get(e)}function at(e){return Ut(this,e).has(e)}function ut(e,t){return Ut(this,e).set(e,t),this}function ct(e){var t=-1,r=e?e.length:0;for(this.__data__=new nt;++t<r;)this.add(e[t])}function ft(e){return this.__data__.set(e,o),this}function lt(e){return this.__data__.has(e)}function ht(e){this.__data__=new Xe(e)}function pt(){this.__data__=new Xe}function dt(e){return this.__data__.delete(e)}function yt(e){return this.__data__.get(e)}function gt(e){return this.__data__.has(e)}function mt(e,t){var r=this.__data__;if(r instanceof Xe){var i=r.__data__;if(!Oe||i.length<n-1)return i.push([e,t]),this;r=this.__data__=new nt(i)}return r.set(e,t),this}function bt(e,t){var r=or(e)||ir(e)?ue(e.length,String):[],n=r.length,i=!!n;for(var o in e)!t&&!ke.call(e,o)||i&&("length"==o||Vt(o,n))||r.push(o);return r}function vt(e,t){for(var r=e.length;r--;)if(nr(e[r][0],t))return r;return-1}function _t(e,t){t=Gt(t,e)?[t]:Lt(t);for(var r=0,n=t.length;null!=e&&r<n;)e=e[Qt(t[r++])];return r&&r==n?e:void 0}function wt(e){return Ee.call(e)}function St(e,t){return null!=e&&t in Object(e)}function kt(e,t,r,n,i){return e===t||(null==e||null==t||!fr(e)&&!lr(t)?e!=e&&t!=t:Et(e,t,kt,r,n,i))}function Et(e,t,r,n,i,o){var s=or(e),u=or(t),c=l,h=l;s||(c=Ht(e),c=c==f?v:c),u||(h=Ht(t),h=h==f?v:h);var p=c==v&&!he(e),d=h==v&&!he(t),y=c==h;if(y&&!p)return o||(o=new ht),s||pr(e)?Mt(e,t,r,n,i,o):Kt(e,t,c,r,n,i,o);if(!(i&a)){var g=p&&ke.call(e,"__wrapped__"),m=d&&ke.call(t,"__wrapped__");if(g||m){var b=g?e.value():e,_=m?t.value():t;return o||(o=new ht),r(b,_,n,i,o)}}return!!y&&(o||(o=new ht),Dt(e,t,r,n,i,o))}function At(e,t,r,n){var i=r.length,o=i,u=!n;if(null==e)return!o;for(e=Object(e);i--;){var c=r[i];if(u&&c[2]?c[1]!==e[c[0]]:!(c[0]in e))return!1}for(;++i<o;){c=r[i];var f=c[0],l=e[f],h=c[1];if(u&&c[2]){if(void 0===l&&!(f in e))return!1}else{var p=new ht;if(n)var d=n(l,h,f,e,t,p);if(!(void 0===d?kt(h,l,n,s|a,p):d))return!1}}return!0}function xt(e){if(!fr(e)||$t(e))return!1;var t=ur(e)||he(e)?Ae:H;return t.test(er(e))}function It(e){return lr(e)&&cr(e.length)&&!!V[Ee.call(e)]}function Tt(e){return"function"==typeof e?e:null==e?br:"object"==typeof e?or(e)?Pt(e[0],e[1]):Ct(e):_r(e)}function Bt(e){if(!Yt(e))return Ce(e);var t=[];for(var r in Object(e))ke.call(e,r)&&"constructor"!=r&&t.push(r);return t}function Ct(e){var t=Ft(e);return 1==t.length&&t[0][2]?Xt(t[0][0],t[0][1]):function(r){return r===e||At(r,e,t)}}function Pt(e,t){return Gt(e)&&Jt(t)?Xt(Qt(e),t):function(r){var n=yr(r,e);return void 0===n&&n===t?gr(r,e):kt(t,n,void 0,s|a)}}function Ot(e){return function(t){return _t(t,e)}}function Rt(e){if("string"==typeof e)return e;if(hr(e))return ze?ze.call(e):"";var t=e+"";return"0"==t&&1/e==-u?"-0":t}function Nt(e,t,r){var i=-1,o=te,s=e.length,a=!0,u=[],c=u;if(r)a=!1,o=re;else if(s>=n){var f=t?null:jt(e);if(f)return ye(f);a=!1,o=fe,c=new ct}else c=t?[]:u;e:for(;++i<s;){var l=e[i],h=t?t(l):l;if(l=r||0!==l?l:0,a&&h==h){for(var p=c.length;p--;)if(c[p]===h)continue e;t&&c.push(h),u.push(l)}else o(c,h,r)||(c!==u&&c.push(h),u.push(l))}return u}function Lt(e){return or(e)?e:Zt(e)}Ve.prototype.clear=Ge,Ve.prototype.delete=We,Ve.prototype.get=$e,Ve.prototype.has=Ye,Ve.prototype.set=Je,Xe.prototype.clear=Ze,Xe.prototype.delete=Qe,Xe.prototype.get=et,Xe.prototype.has=tt,Xe.prototype.set=rt,nt.prototype.clear=it,nt.prototype.delete=ot,nt.prototype.get=st,nt.prototype.has=at,nt.prototype.set=ut,ct.prototype.add=ct.prototype.push=ft,ct.prototype.has=lt,ht.prototype.clear=pt,ht.prototype.delete=dt,ht.prototype.get=yt,ht.prototype.has=gt,ht.prototype.set=mt;var jt=Ne&&1/ye(new Ne([,-0]))[1]==u?function(e){return new Ne(e)}:vr;function Mt(e,t,r,n,i,o){var u=i&a,c=e.length,f=t.length;if(c!=f&&!(u&&f>c))return!1;var l=o.get(e);if(l&&o.get(t))return l==t;var h=-1,p=!0,d=i&s?new ct:void 0;for(o.set(e,t),o.set(t,e);++h<c;){var y=e[h],g=t[h];if(n)var m=u?n(g,y,h,t,e,o):n(y,g,h,e,t,o);if(void 0!==m){if(m)continue;p=!1;break}if(d){if(!ne(t,function(e,t){if(!d.has(t)&&(y===e||r(y,e,n,i,o)))return d.add(t)})){p=!1;break}}else if(y!==g&&!r(y,g,n,i,o)){p=!1;break}}return o.delete(e),o.delete(t),p}function Kt(e,t,r,n,i,o,u){switch(r){case I:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case x:return!(e.byteLength!=t.byteLength||!n(new Ie(e),new Ie(t)));case h:case p:case b:return nr(+e,+t);case d:return e.name==t.name&&e.message==t.message;case w:case k:return e==t+"";case m:var c=pe;case S:var f=o&a;if(c||(c=ye),e.size!=t.size&&!f)return!1;var l=u.get(e);if(l)return l==t;o|=s,u.set(e,t);var y=Mt(c(e),c(t),n,i,o,u);return u.delete(e),y;case E:if(He)return He.call(e)==He.call(t)}return!1}function Dt(e,t,r,n,i,o){var s=i&a,u=mr(e),c=u.length,f=mr(t),l=f.length;if(c!=l&&!s)return!1;for(var h=c;h--;){var p=u[h];if(!(s?p in t:ke.call(t,p)))return!1}var d=o.get(e);if(d&&o.get(t))return d==t;var y=!0;o.set(e,t),o.set(t,e);for(var g=s;++h<c;){p=u[h];var m=e[p],b=t[p];if(n)var v=s?n(b,m,p,t,e,o):n(m,b,p,e,t,o);if(!(void 0===v?m===b||r(m,b,n,i,o):v)){y=!1;break}g||(g="constructor"==p)}if(y&&!g){var _=e.constructor,w=t.constructor;_!=w&&"constructor"in e&&"constructor"in t&&!("function"==typeof _&&_ instanceof _&&"function"==typeof w&&w instanceof w)&&(y=!1)}return o.delete(e),o.delete(t),y}function Ut(e,t){var r=e.__data__;return Wt(t)?r["string"==typeof t?"string":"hash"]:r.map}function Ft(e){for(var t=mr(e),r=t.length;r--;){var n=t[r],i=e[n];t[r]=[n,i,Jt(i)]}return t}function qt(e,t){var r=le(e,t);return xt(r)?r:void 0}var Ht=wt;function zt(e,t,r){t=Gt(t,e)?[t]:Lt(t);for(var n,i=-1,o=t.length;++i<o;){var s=Qt(t[i]);if(!(n=null!=e&&r(e,s)))break;e=e[s]}if(n)return n;var o=e?e.length:0;return!!o&&cr(o)&&Vt(s,o)&&(or(e)||ir(e))}function Vt(e,t){return t=null==t?c:t,!!t&&("number"==typeof e||z.test(e))&&e>-1&&e%1==0&&e<t}function Gt(e,t){if(or(e))return!1;var r=typeof e;return!("number"!=r&&"symbol"!=r&&"boolean"!=r&&null!=e&&!hr(e))||(K.test(e)||!M.test(e)||null!=t&&e in Object(t))}function Wt(e){var t=typeof e;return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e}function $t(e){return!!_e&&_e in e}function Yt(e){var t=e&&e.constructor,r="function"==typeof t&&t.prototype||be;return e===r}function Jt(e){return e==e&&!fr(e)}function Xt(e,t){return function(r){return null!=r&&(r[e]===t&&(void 0!==t||e in Object(r)))}}(Pe&&Ht(new Pe(new ArrayBuffer(1)))!=I||Oe&&Ht(new Oe)!=m||Re&&Ht(Re.resolve())!=_||Ne&&Ht(new Ne)!=S||Le&&Ht(new Le)!=A)&&(Ht=function(e){var t=Ee.call(e),r=t==v?e.constructor:void 0,n=r?er(r):void 0;if(n)switch(n){case Me:return I;case Ke:return m;case De:return _;case Ue:return S;case Fe:return A}return t});var Zt=rr(function(e){e=dr(e);var t=[];return D.test(e)&&t.push(""),e.replace(U,function(e,r,n,i){t.push(n?i.replace(q,"$1"):r||e)}),t});function Qt(e){if("string"==typeof e||hr(e))return e;var t=e+"";return"0"==t&&1/e==-u?"-0":t}function er(e){if(null!=e){try{return Se.call(e)}catch(e){}try{return e+""}catch(e){}}return""}function tr(e,t){return e&&e.length?Nt(e,Tt(t,2)):[]}function rr(e,t){if("function"!=typeof e||t&&"function"!=typeof t)throw new TypeError(i);var r=function(){var n=arguments,i=t?t.apply(this,n):n[0],o=r.cache;if(o.has(i))return o.get(i);var s=e.apply(this,n);return r.cache=o.set(i,s),s};return r.cache=new(rr.Cache||nt),r}function nr(e,t){return e===t||e!=e&&t!=t}function ir(e){return ar(e)&&ke.call(e,"callee")&&(!Te.call(e,"callee")||Ee.call(e)==f)}rr.Cache=nt;var or=Array.isArray;function sr(e){return null!=e&&cr(e.length)&&!ur(e)}function ar(e){return lr(e)&&sr(e)}function ur(e){var t=fr(e)?Ee.call(e):"";return t==y||t==g}function cr(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=c}function fr(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function lr(e){return!!e&&"object"==typeof e}function hr(e){return"symbol"==typeof e||lr(e)&&Ee.call(e)==E}var pr=ee?ce(ee):It;function dr(e){return null==e?"":Rt(e)}function yr(e,t,r){var n=null==e?void 0:_t(e,t);return void 0===n?r:n}function gr(e,t){return null!=e&&zt(e,t,St)}function mr(e){return sr(e)?bt(e):Bt(e)}function br(e){return e}function vr(){}function _r(e){return Gt(e)?ae(Qt(e)):Ot(e)}r.exports=tr}).call(this,r(7),r(28)(e))},function(e,t,r){"use strict";(function(e){const n=r(18),i=r(965);t.names=i.names,t.codes=i.codes,t.defaultLengths=i.defaultLengths;const o=r(23);function s(e){t.decode(e)}t.toHexString=function t(r){if(!e.isBuffer(r))throw new Error("must be passed a buffer");return r.toString("hex")},t.fromHexString=function t(r){return e.from(r,"hex")},t.toB58String=function t(r){if(!e.isBuffer(r))throw new Error("must be passed a buffer");return n.encode(r)},t.fromB58String=function t(r){let i=r;return e.isBuffer(r)&&(i=r.toString()),e.from(n.decode(i))},t.decode=function r(n){if(!e.isBuffer(n))throw new Error("multihash must be a Buffer");if(n.length<3)throw new Error("multihash too short. must be > 3 bytes.");let s=o.decode(n);if(!t.isValidCode(s))throw new Error(`multihash unknown function code: 0x${s.toString(16)}`);n=n.slice(o.decode.bytes);let a=o.decode(n);if(a<1)throw new Error(`multihash invalid length: 0x${a.toString(16)}`);if(n=n.slice(o.decode.bytes),n.length!==a)throw new Error(`multihash length inconsistent: 0x${n.toString("hex")}`);return{code:s,name:i.codes[s],length:a,digest:n}},t.encode=function r(n,i,s){if(!n||!i)throw new Error("multihash encode requires at least two args: digest, code");const a=t.coerceCode(i);if(!e.isBuffer(n))throw new Error("digest should be a Buffer");if(null==s&&(s=n.length),s&&n.length!==s)throw new Error("digest length should be equal to specified length.");return e.concat([e.from(o.encode(a)),e.from(o.encode(s)),n])},t.coerceCode=function e(r){let n=r;if("string"==typeof r){if(!i.names[r])throw new Error(`Unrecognized hash function named: ${r}`);n=i.names[r]}if("number"!=typeof n)throw new Error(`Hash function code should be a number. Got: ${n}`);if(!i.codes[n]&&!t.isAppCode(n))throw new Error(`Unrecognized function code: ${n}`);return n},t.isAppCode=function e(t){return t>0&&t<16},t.isValidCode=function e(r){return!!t.isAppCode(r)||!!i.codes[r]},t.validate=s,t.prefix=function e(t){return s(t),t.slice(0,2)}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";t.names=Object.freeze({sha1:17,"sha2-256":18,"sha2-512":19,"dbl-sha2-256":86,"sha3-224":23,"sha3-256":22,"sha3-384":21,"sha3-512":20,"shake-128":24,"shake-256":25,"keccak-224":26,"keccak-256":27,"keccak-384":28,"keccak-512":29,"murmur3-128":34,"murmur3-32":35,"blake2b-8":45569,"blake2b-16":45570,"blake2b-24":45571,"blake2b-32":45572,"blake2b-40":45573,"blake2b-48":45574,"blake2b-56":45575,"blake2b-64":45576,"blake2b-72":45577,"blake2b-80":45578,"blake2b-88":45579,"blake2b-96":45580,"blake2b-104":45581,"blake2b-112":45582,"blake2b-120":45583,"blake2b-128":45584,"blake2b-136":45585,"blake2b-144":45586,"blake2b-152":45587,"blake2b-160":45588,"blake2b-168":45589,"blake2b-176":45590,"blake2b-184":45591,"blake2b-192":45592,"blake2b-200":45593,"blake2b-208":45594,"blake2b-216":45595,"blake2b-224":45596,"blake2b-232":45597,"blake2b-240":45598,"blake2b-248":45599,"blake2b-256":45600,"blake2b-264":45601,"blake2b-272":45602,"blake2b-280":45603,"blake2b-288":45604,"blake2b-296":45605,"blake2b-304":45606,"blake2b-312":45607,"blake2b-320":45608,"blake2b-328":45609,"blake2b-336":45610,"blake2b-344":45611,"blake2b-352":45612,"blake2b-360":45613,"blake2b-368":45614,"blake2b-376":45615,"blake2b-384":45616,"blake2b-392":45617,"blake2b-400":45618,"blake2b-408":45619,"blake2b-416":45620,"blake2b-424":45621,"blake2b-432":45622,"blake2b-440":45623,"blake2b-448":45624,"blake2b-456":45625,"blake2b-464":45626,"blake2b-472":45627,"blake2b-480":45628,"blake2b-488":45629,"blake2b-496":45630,"blake2b-504":45631,"blake2b-512":45632,"blake2s-8":45633,"blake2s-16":45634,"blake2s-24":45635,"blake2s-32":45636,"blake2s-40":45637,"blake2s-48":45638,"blake2s-56":45639,"blake2s-64":45640,"blake2s-72":45641,"blake2s-80":45642,"blake2s-88":45643,"blake2s-96":45644,"blake2s-104":45645,"blake2s-112":45646,"blake2s-120":45647,"blake2s-128":45648,"blake2s-136":45649,"blake2s-144":45650,"blake2s-152":45651,"blake2s-160":45652,"blake2s-168":45653,"blake2s-176":45654,"blake2s-184":45655,"blake2s-192":45656,"blake2s-200":45657,"blake2s-208":45658,"blake2s-216":45659,"blake2s-224":45660,"blake2s-232":45661,"blake2s-240":45662,"blake2s-248":45663,"blake2s-256":45664,"Skein256-8":45825,"Skein256-16":45826,"Skein256-24":45827,"Skein256-32":45828,"Skein256-40":45829,"Skein256-48":45830,"Skein256-56":45831,"Skein256-64":45832,"Skein256-72":45833,"Skein256-80":45834,"Skein256-88":45835,"Skein256-96":45836,"Skein256-104":45837,"Skein256-112":45838,"Skein256-120":45839,"Skein256-128":45840,"Skein256-136":45841,"Skein256-144":45842,"Skein256-152":45843,"Skein256-160":45844,"Skein256-168":45845,"Skein256-176":45846,"Skein256-184":45847,"Skein256-192":45848,"Skein256-200":45849,"Skein256-208":45850,"Skein256-216":45851,"Skein256-224":45852,"Skein256-232":45853,"Skein256-240":45854,"Skein256-248":45855,"Skein256-256":45856,"Skein512-8":45857,"Skein512-16":45858,"Skein512-24":45859,"Skein512-32":45860,"Skein512-40":45861,"Skein512-48":45862,"Skein512-56":45863,"Skein512-64":45864,"Skein512-72":45865,"Skein512-80":45866,"Skein512-88":45867,"Skein512-96":45868,"Skein512-104":45869,"Skein512-112":45870,"Skein512-120":45871,"Skein512-128":45872,"Skein512-136":45873,"Skein512-144":45874,"Skein512-152":45875,"Skein512-160":45876,"Skein512-168":45877,"Skein512-176":45878,"Skein512-184":45879,"Skein512-192":45880,"Skein512-200":45881,"Skein512-208":45882,"Skein512-216":45883,"Skein512-224":45884,"Skein512-232":45885,"Skein512-240":45886,"Skein512-248":45887,"Skein512-256":45888,"Skein512-264":45889,"Skein512-272":45890,"Skein512-280":45891,"Skein512-288":45892,"Skein512-296":45893,"Skein512-304":45894,"Skein512-312":45895,"Skein512-320":45896,"Skein512-328":45897,"Skein512-336":45898,"Skein512-344":45899,"Skein512-352":45900,"Skein512-360":45901,"Skein512-368":45902,"Skein512-376":45903,"Skein512-384":45904,"Skein512-392":45905,"Skein512-400":45906,"Skein512-408":45907,"Skein512-416":45908,"Skein512-424":45909,"Skein512-432":45910,"Skein512-440":45911,"Skein512-448":45912,"Skein512-456":45913,"Skein512-464":45914,"Skein512-472":45915,"Skein512-480":45916,"Skein512-488":45917,"Skein512-496":45918,"Skein512-504":45919,"Skein512-512":45920,"Skein1024-8":45921,"Skein1024-16":45922,"Skein1024-24":45923,"Skein1024-32":45924,"Skein1024-40":45925,"Skein1024-48":45926,"Skein1024-56":45927,"Skein1024-64":45928,"Skein1024-72":45929,"Skein1024-80":45930,"Skein1024-88":45931,"Skein1024-96":45932,"Skein1024-104":45933,"Skein1024-112":45934,"Skein1024-120":45935,"Skein1024-128":45936,"Skein1024-136":45937,"Skein1024-144":45938,"Skein1024-152":45939,"Skein1024-160":45940,"Skein1024-168":45941,"Skein1024-176":45942,"Skein1024-184":45943,"Skein1024-192":45944,"Skein1024-200":45945,"Skein1024-208":45946,"Skein1024-216":45947,"Skein1024-224":45948,"Skein1024-232":45949,"Skein1024-240":45950,"Skein1024-248":45951,"Skein1024-256":45952,"Skein1024-264":45953,"Skein1024-272":45954,"Skein1024-280":45955,"Skein1024-288":45956,"Skein1024-296":45957,"Skein1024-304":45958,"Skein1024-312":45959,"Skein1024-320":45960,"Skein1024-328":45961,"Skein1024-336":45962,"Skein1024-344":45963,"Skein1024-352":45964,"Skein1024-360":45965,"Skein1024-368":45966,"Skein1024-376":45967,"Skein1024-384":45968,"Skein1024-392":45969,"Skein1024-400":45970,"Skein1024-408":45971,"Skein1024-416":45972,"Skein1024-424":45973,"Skein1024-432":45974,"Skein1024-440":45975,"Skein1024-448":45976,"Skein1024-456":45977,"Skein1024-464":45978,"Skein1024-472":45979,"Skein1024-480":45980,"Skein1024-488":45981,"Skein1024-496":45982,"Skein1024-504":45983,"Skein1024-512":45984,"Skein1024-520":45985,"Skein1024-528":45986,"Skein1024-536":45987,"Skein1024-544":45988,"Skein1024-552":45989,"Skein1024-560":45990,"Skein1024-568":45991,"Skein1024-576":45992,"Skein1024-584":45993,"Skein1024-592":45994,"Skein1024-600":45995,"Skein1024-608":45996,"Skein1024-616":45997,"Skein1024-624":45998,"Skein1024-632":45999,"Skein1024-640":46e3,"Skein1024-648":46001,"Skein1024-656":46002,"Skein1024-664":46003,"Skein1024-672":46004,"Skein1024-680":46005,"Skein1024-688":46006,"Skein1024-696":46007,"Skein1024-704":46008,"Skein1024-712":46009,"Skein1024-720":46010,"Skein1024-728":46011,"Skein1024-736":46012,"Skein1024-744":46013,"Skein1024-752":46014,"Skein1024-760":46015,"Skein1024-768":46016,"Skein1024-776":46017,"Skein1024-784":46018,"Skein1024-792":46019,"Skein1024-800":46020,"Skein1024-808":46021,"Skein1024-816":46022,"Skein1024-824":46023,"Skein1024-832":46024,"Skein1024-840":46025,"Skein1024-848":46026,"Skein1024-856":46027,"Skein1024-864":46028,"Skein1024-872":46029,"Skein1024-880":46030,"Skein1024-888":46031,"Skein1024-896":46032,"Skein1024-904":46033,"Skein1024-912":46034,"Skein1024-920":46035,"Skein1024-928":46036,"Skein1024-936":46037,"Skein1024-944":46038,"Skein1024-952":46039,"Skein1024-960":46040,"Skein1024-968":46041,"Skein1024-976":46042,"Skein1024-984":46043,"Skein1024-992":46044,"Skein1024-1000":46045,"Skein1024-1008":46046,"Skein1024-1016":46047,"Skein1024-1024":46048}),t.codes=Object.freeze({17:"sha1",18:"sha2-256",19:"sha2-512",86:"dbl-sha2-256",23:"sha3-224",22:"sha3-256",21:"sha3-384",20:"sha3-512",24:"shake-128",25:"shake-256",26:"keccak-224",27:"keccak-256",28:"keccak-384",29:"keccak-512",34:"murmur3-128",35:"murmur3-32",45569:"blake2b-8",45570:"blake2b-16",45571:"blake2b-24",45572:"blake2b-32",45573:"blake2b-40",45574:"blake2b-48",45575:"blake2b-56",45576:"blake2b-64",45577:"blake2b-72",45578:"blake2b-80",45579:"blake2b-88",45580:"blake2b-96",45581:"blake2b-104",45582:"blake2b-112",45583:"blake2b-120",45584:"blake2b-128",45585:"blake2b-136",45586:"blake2b-144",45587:"blake2b-152",45588:"blake2b-160",45589:"blake2b-168",45590:"blake2b-176",45591:"blake2b-184",45592:"blake2b-192",45593:"blake2b-200",45594:"blake2b-208",45595:"blake2b-216",45596:"blake2b-224",45597:"blake2b-232",45598:"blake2b-240",45599:"blake2b-248",45600:"blake2b-256",45601:"blake2b-264",45602:"blake2b-272",45603:"blake2b-280",45604:"blake2b-288",45605:"blake2b-296",45606:"blake2b-304",45607:"blake2b-312",45608:"blake2b-320",45609:"blake2b-328",45610:"blake2b-336",45611:"blake2b-344",45612:"blake2b-352",45613:"blake2b-360",45614:"blake2b-368",45615:"blake2b-376",45616:"blake2b-384",45617:"blake2b-392",45618:"blake2b-400",45619:"blake2b-408",45620:"blake2b-416",45621:"blake2b-424",45622:"blake2b-432",45623:"blake2b-440",45624:"blake2b-448",45625:"blake2b-456",45626:"blake2b-464",45627:"blake2b-472",45628:"blake2b-480",45629:"blake2b-488",45630:"blake2b-496",45631:"blake2b-504",45632:"blake2b-512",45633:"blake2s-8",45634:"blake2s-16",45635:"blake2s-24",45636:"blake2s-32",45637:"blake2s-40",45638:"blake2s-48",45639:"blake2s-56",45640:"blake2s-64",45641:"blake2s-72",45642:"blake2s-80",45643:"blake2s-88",45644:"blake2s-96",45645:"blake2s-104",45646:"blake2s-112",45647:"blake2s-120",45648:"blake2s-128",45649:"blake2s-136",45650:"blake2s-144",45651:"blake2s-152",45652:"blake2s-160",45653:"blake2s-168",45654:"blake2s-176",45655:"blake2s-184",45656:"blake2s-192",45657:"blake2s-200",45658:"blake2s-208",45659:"blake2s-216",45660:"blake2s-224",45661:"blake2s-232",45662:"blake2s-240",45663:"blake2s-248",45664:"blake2s-256",45825:"Skein256-8",45826:"Skein256-16",45827:"Skein256-24",45828:"Skein256-32",45829:"Skein256-40",45830:"Skein256-48",45831:"Skein256-56",45832:"Skein256-64",45833:"Skein256-72",45834:"Skein256-80",45835:"Skein256-88",45836:"Skein256-96",45837:"Skein256-104",45838:"Skein256-112",45839:"Skein256-120",45840:"Skein256-128",45841:"Skein256-136",45842:"Skein256-144",45843:"Skein256-152",45844:"Skein256-160",45845:"Skein256-168",45846:"Skein256-176",45847:"Skein256-184",45848:"Skein256-192",45849:"Skein256-200",45850:"Skein256-208",45851:"Skein256-216",45852:"Skein256-224",45853:"Skein256-232",45854:"Skein256-240",45855:"Skein256-248",45856:"Skein256-256",45857:"Skein512-8",45858:"Skein512-16",45859:"Skein512-24",45860:"Skein512-32",45861:"Skein512-40",45862:"Skein512-48",45863:"Skein512-56",45864:"Skein512-64",45865:"Skein512-72",45866:"Skein512-80",45867:"Skein512-88",45868:"Skein512-96",45869:"Skein512-104",45870:"Skein512-112",45871:"Skein512-120",45872:"Skein512-128",45873:"Skein512-136",45874:"Skein512-144",45875:"Skein512-152",45876:"Skein512-160",45877:"Skein512-168",45878:"Skein512-176",45879:"Skein512-184",45880:"Skein512-192",45881:"Skein512-200",45882:"Skein512-208",45883:"Skein512-216",45884:"Skein512-224",45885:"Skein512-232",45886:"Skein512-240",45887:"Skein512-248",45888:"Skein512-256",45889:"Skein512-264",45890:"Skein512-272",45891:"Skein512-280",45892:"Skein512-288",45893:"Skein512-296",45894:"Skein512-304",45895:"Skein512-312",45896:"Skein512-320",45897:"Skein512-328",45898:"Skein512-336",45899:"Skein512-344",45900:"Skein512-352",45901:"Skein512-360",45902:"Skein512-368",45903:"Skein512-376",45904:"Skein512-384",45905:"Skein512-392",45906:"Skein512-400",45907:"Skein512-408",45908:"Skein512-416",45909:"Skein512-424",45910:"Skein512-432",45911:"Skein512-440",45912:"Skein512-448",45913:"Skein512-456",45914:"Skein512-464",45915:"Skein512-472",45916:"Skein512-480",45917:"Skein512-488",45918:"Skein512-496",45919:"Skein512-504",45920:"Skein512-512",45921:"Skein1024-8",45922:"Skein1024-16",45923:"Skein1024-24",45924:"Skein1024-32",45925:"Skein1024-40",45926:"Skein1024-48",45927:"Skein1024-56",45928:"Skein1024-64",45929:"Skein1024-72",45930:"Skein1024-80",45931:"Skein1024-88",45932:"Skein1024-96",45933:"Skein1024-104",45934:"Skein1024-112",45935:"Skein1024-120",45936:"Skein1024-128",45937:"Skein1024-136",45938:"Skein1024-144",45939:"Skein1024-152",45940:"Skein1024-160",45941:"Skein1024-168",45942:"Skein1024-176",45943:"Skein1024-184",45944:"Skein1024-192",45945:"Skein1024-200",45946:"Skein1024-208",45947:"Skein1024-216",45948:"Skein1024-224",45949:"Skein1024-232",45950:"Skein1024-240",45951:"Skein1024-248",45952:"Skein1024-256",45953:"Skein1024-264",45954:"Skein1024-272",45955:"Skein1024-280",45956:"Skein1024-288",45957:"Skein1024-296",45958:"Skein1024-304",45959:"Skein1024-312",45960:"Skein1024-320",45961:"Skein1024-328",45962:"Skein1024-336",45963:"Skein1024-344",45964:"Skein1024-352",45965:"Skein1024-360",45966:"Skein1024-368",45967:"Skein1024-376",45968:"Skein1024-384",45969:"Skein1024-392",45970:"Skein1024-400",45971:"Skein1024-408",45972:"Skein1024-416",45973:"Skein1024-424",45974:"Skein1024-432",45975:"Skein1024-440",45976:"Skein1024-448",45977:"Skein1024-456",45978:"Skein1024-464",45979:"Skein1024-472",45980:"Skein1024-480",45981:"Skein1024-488",45982:"Skein1024-496",45983:"Skein1024-504",45984:"Skein1024-512",45985:"Skein1024-520",45986:"Skein1024-528",45987:"Skein1024-536",45988:"Skein1024-544",45989:"Skein1024-552",45990:"Skein1024-560",45991:"Skein1024-568",45992:"Skein1024-576",45993:"Skein1024-584",45994:"Skein1024-592",45995:"Skein1024-600",45996:"Skein1024-608",45997:"Skein1024-616",45998:"Skein1024-624",45999:"Skein1024-632",46000:"Skein1024-640",46001:"Skein1024-648",46002:"Skein1024-656",46003:"Skein1024-664",46004:"Skein1024-672",46005:"Skein1024-680",46006:"Skein1024-688",46007:"Skein1024-696",46008:"Skein1024-704",46009:"Skein1024-712",46010:"Skein1024-720",46011:"Skein1024-728",46012:"Skein1024-736",46013:"Skein1024-744",46014:"Skein1024-752",46015:"Skein1024-760",46016:"Skein1024-768",46017:"Skein1024-776",46018:"Skein1024-784",46019:"Skein1024-792",46020:"Skein1024-800",46021:"Skein1024-808",46022:"Skein1024-816",46023:"Skein1024-824",46024:"Skein1024-832",46025:"Skein1024-840",46026:"Skein1024-848",46027:"Skein1024-856",46028:"Skein1024-864",46029:"Skein1024-872",46030:"Skein1024-880",46031:"Skein1024-888",46032:"Skein1024-896",46033:"Skein1024-904",46034:"Skein1024-912",46035:"Skein1024-920",46036:"Skein1024-928",46037:"Skein1024-936",46038:"Skein1024-944",46039:"Skein1024-952",46040:"Skein1024-960",46041:"Skein1024-968",46042:"Skein1024-976",46043:"Skein1024-984",46044:"Skein1024-992",46045:"Skein1024-1000",46046:"Skein1024-1008",46047:"Skein1024-1016",46048:"Skein1024-1024"}),t.defaultLengths=Object.freeze({17:20,18:32,19:64,86:32,23:28,22:32,21:48,20:64,24:32,25:64,26:28,27:32,28:48,29:64,34:32,45569:1,45570:2,45571:3,45572:4,45573:5,45574:6,45575:7,45576:8,45577:9,45578:10,45579:11,45580:12,45581:13,45582:14,45583:15,45584:16,45585:17,45586:18,45587:19,45588:20,45589:21,45590:22,45591:23,45592:24,45593:25,45594:26,45595:27,45596:28,45597:29,45598:30,45599:31,45600:32,45601:33,45602:34,45603:35,45604:36,45605:37,45606:38,45607:39,45608:40,45609:41,45610:42,45611:43,45612:44,45613:45,45614:46,45615:47,45616:48,45617:49,45618:50,45619:51,45620:52,45621:53,45622:54,45623:55,45624:56,45625:57,45626:58,45627:59,45628:60,45629:61,45630:62,45631:63,45632:64,45633:1,45634:2,45635:3,45636:4,45637:5,45638:6,45639:7,45640:8,45641:9,45642:10,45643:11,45644:12,45645:13,45646:14,45647:15,45648:16,45649:17,45650:18,45651:19,45652:20,45653:21,45654:22,45655:23,45656:24,45657:25,45658:26,45659:27,45660:28,45661:29,45662:30,45663:31,45664:32,45825:1,45826:2,45827:3,45828:4,45829:5,45830:6,45831:7,45832:8,45833:9,45834:10,45835:11,45836:12,45837:13,45838:14,45839:15,45840:16,45841:17,45842:18,45843:19,45844:20,45845:21,45846:22,45847:23,45848:24,45849:25,45850:26,45851:27,45852:28,45853:29,45854:30,45855:31,45856:32,45857:1,45858:2,45859:3,45860:4,45861:5,45862:6,45863:7,45864:8,45865:9,45866:10,45867:11,45868:12,45869:13,45870:14,45871:15,45872:16,45873:17,45874:18,45875:19,45876:20,45877:21,45878:22,45879:23,45880:24,45881:25,45882:26,45883:27,45884:28,45885:29,45886:30,45887:31,45888:32,45889:33,45890:34,45891:35,45892:36,45893:37,45894:38,45895:39,45896:40,45897:41,45898:42,45899:43,45900:44,45901:45,45902:46,45903:47,45904:48,45905:49,45906:50,45907:51,45908:52,45909:53,45910:54,45911:55,45912:56,45913:57,45914:58,45915:59,45916:60,45917:61,45918:62,45919:63,45920:64,45921:1,45922:2,45923:3,45924:4,45925:5,45926:6,45927:7,45928:8,45929:9,45930:10,45931:11,45932:12,45933:13,45934:14,45935:15,45936:16,45937:17,45938:18,45939:19,45940:20,45941:21,45942:22,45943:23,45944:24,45945:25,45946:26,45947:27,45948:28,45949:29,45950:30,45951:31,45952:32,45953:33,45954:34,45955:35,45956:36,45957:37,45958:38,45959:39,45960:40,45961:41,45962:42,45963:43,45964:44,45965:45,45966:46,45967:47,45968:48,45969:49,45970:50,45971:51,45972:52,45973:53,45974:54,45975:55,45976:56,45977:57,45978:58,45979:59,45980:60,45981:61,45982:62,45983:63,45984:64,45985:65,45986:66,45987:67,45988:68,45989:69,45990:70,45991:71,45992:72,45993:73,45994:74,45995:75,45996:76,45997:77,45998:78,45999:79,46000:80,46001:81,46002:82,46003:83,46004:84,46005:85,46006:86,46007:87,46008:88,46009:89,46010:90,46011:91,46012:92,46013:93,46014:94,46015:95,46016:96,46017:97,46018:98,46019:99,46020:100,46021:101,46022:102,46023:103,46024:104,46025:105,46026:106,46027:107,46028:108,46029:109,46030:110,46031:111,46032:112,46033:113,46034:114,46035:115,46036:116,46037:117,46038:118,46039:119,46040:120,46041:121,46042:122,46043:123,46044:124,46045:125,46046:126,46047:127,46048:128})},function(e,t,r){"use strict";(function(t){const n=r(79),i=r(265),o=r(967),s=r(271),a=r(23);function u(e){const t=[],r=e.split("/").slice(1);if(1===r.length&&""===r[0])return[];for(let n=0;n<r.length;n++){const i=r[n],o=s(i);if(0!==o.size){if(n++,n>=r.length)throw S("invalid address: "+e);t.push([i,r[n]])}else t.push([i])}return t}function c(e){const t=[];return n(e,function(e){const r=k(e);t.push(r.name),e.length>1&&t.push(e[1])}),"/"+t.join("/")}function f(e){return n(e,function(e){Array.isArray(e)||(e=[e]);const t=k(e);return e.length>1?[t.code,o.toBuffer(t.code,e[1])]:[t.code]})}function l(e){return n(e,function(e){const t=k(e);return e.length>1?[t.code,o.toString(t.code,e[1])]:[t.code]})}function h(e){return b(t.concat(n(e,function(e){const r=k(e);let n=t.from(a.encode(r.code));return e.length>1&&(n=t.concat([n,e[1]])),n})))}function p(e,t){if(e.size>0)return e.size/8;if(0===e.size)return 0;{const e=a.decode(t);return e+a.decode.bytes}}function d(e){const t=[];let r=0;for(;r<e.length;){const n=a.decode(e,r),i=a.decode.bytes,o=s(n),u=p(o,e.slice(r+i));if(0===u){t.push([n]),r+=i;continue}const c=e.slice(r+i,r+i+u);if(r+=u+i,r>e.length)throw S("Invalid address buffer: "+e.toString("hex"));t.push([n,c])}return t}function y(e){const t=d(e),r=l(t);return c(r)}function g(e){e=w(e);const t=u(e),r=f(t);return h(r)}function m(e){return g(e)}function b(e){const r=v(e);if(r)throw r;return t.from(e)}function v(e){try{d(e)}catch(e){return e}}function _(e){return void 0===v(e)}function w(e){return"/"+i(e.trim().split("/")).join("/")}function S(e){return new Error("Error parsing address: "+e)}function k(e){const t=s(e[0]);return t}e.exports={stringToStringTuples:u,stringTuplesToString:c,tuplesToStringTuples:l,stringTuplesToTuples:f,bufferToTuples:d,tuplesToBuffer:h,bufferToString:y,stringToBuffer:g,fromString:m,fromBuffer:b,validateBuffer:v,isValidBuffer:_,cleanPath:w,ParseError:S,protoFromTuple:k,sizeForAddr:p}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(t){const n=r(266),i=r(267),o=r(271),s=r(18),a=r(23);function u(e,r){return r instanceof t?u.toString(e,r):u.toBuffer(e,r)}function c(e){if(!e.isValid())throw new Error("invalid ip address");return n.toBuffer(e.address)}function f(e){const r=t.alloc(2);return r.writeUInt16BE(e,0),r}function l(e){return e.readUInt16BE(0)}function h(e){const r=t.from(e),n=t.from(a.encode(r.length));return t.concat([n,r])}function p(e){const t=a.decode(e);if(e=e.slice(a.decode.bytes),e.length!==t)throw new Error("inconsistent lengths");return e.toString()}function d(e){const r=t.from(s.decode(e)),n=t.from(a.encode(r.length));return t.concat([n,r])}function y(e){const t=a.decode(e),r=e.slice(a.decode.bytes);if(r.length!==t)throw new Error("inconsistent lengths");return s.encode(r)}e.exports=u,u.toString=function e(t,r){switch(t=o(t),t.code){case 4:case 41:return n.toString(r);case 6:case 17:case 33:case 132:return l(r);case 54:case 55:case 56:return p(r);case 421:return y(r);default:return r.toString("hex")}},u.toBuffer=function e(r,n){switch(r=o(r),r.code){case 4:return c(new i.Address4(n));case 41:return c(new i.Address6(n));case 6:case 17:case 33:case 132:return f(parseInt(n,10));case 54:case 55:case 56:return h(n);case 421:return d(n);default:return t.from(n,"hex")}}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(n){const i=r(14),o=r(969),s=r(13),a=r(5);class u{constructor(e,t,r){s(n.isBuffer(e),"invalid id provided"),t&&r&&s(t.public.bytes.equals(r.bytes),"inconsistent arguments"),this._id=e,this._idB58String=i.toB58String(this.id),this._privKey=t,this._pubKey=r}get id(){return this._id}set id(e){throw new Error("Id is immutable")}get privKey(){return this._privKey}set privKey(e){this._privKey=e}get pubKey(){return this._pubKey?this._pubKey:this._privKey?this._privKey.public:void 0}set pubKey(e){this._pubKey=e}marshalPubKey(){if(this.pubKey)return o.keys.marshalPublicKey(this.pubKey)}marshalPrivKey(){if(this.privKey)return o.keys.marshalPrivateKey(this.privKey)}toPrint(){return this.toJSON()}toJSON(){return{id:this.toB58String(),privKey:c(this.marshalPrivKey()),pubKey:c(this.marshalPubKey())}}toHexString(){return i.toHexString(this.id)}toBytes(){return this.id}toB58String(){return this._idB58String}isEqual(e){if(n.isBuffer(e))return this.id.equals(e);if(e.id)return this.id.equals(e.id);throw new Error("not valid Id")}isValid(e){this.privKey&&this.privKey.public&&this.privKey.public.bytes&&n.isBuffer(this.pubKey.bytes)&&this.privKey.public.bytes.equals(this.pubKey.bytes)?e():e(new Error("Keys not match"))}}function c(e){if(e)return e.toString("base64")}t=e.exports=u,t.create=function(e,t){"function"==typeof e&&(t=e,e={}),e=e||{},e.bits=e.bits||2048,a([t=>o.keys.generateKeyPair("RSA",e.bits,t),(e,t)=>e.public.hash((r,n)=>{t(r,n,e)})],(e,r,n)=>{if(e)return t(e);t(null,new u(r,n))})},t.createFromHexString=function(e){return new u(i.fromHexString(e))},t.createFromBytes=function(e){return new u(e)},t.createFromB58String=function(e){return new u(i.fromB58String(e))},t.createFromPubKey=function(e,t){if("function"!=typeof t)throw new Error("callback is required");let r;try{let i=e;if("string"==typeof i&&(i=n.from(e,"base64")),!n.isBuffer(i))throw new Error("Supplied key is neither a base64 string nor a buffer");r=o.keys.unmarshalPublicKey(i)}catch(e){return t(e)}r.hash((e,n)=>{if(e)return t(e);t(null,new u(n,null,r))})},t.createFromPrivKey=function(e,t){if("function"!=typeof t)throw new Error("callback is required");let r=e;try{if("string"==typeof r&&(r=n.from(e,"base64")),!n.isBuffer(r))throw new Error("Supplied key is neither a base64 string nor a buffer")}catch(e){return t(e)}a([e=>o.keys.unmarshalPrivateKey(r,e),(e,t)=>e.public.hash((r,n)=>{t(r,n,e)})],(e,r,n)=>{if(e)return t(e);t(null,new u(r,n,n.public))})},t.createFromJSON=function(e,t){if("function"!=typeof t)throw new Error("callback is required");let r,s,c,f;try{r=i.fromB58String(e.id),s=e.privKey&&n.from(e.privKey,"base64"),c=e.pubKey&&n.from(e.pubKey,"base64"),f=c&&o.keys.unmarshalPublicKey(c)}catch(e){return t(e)}s?a([e=>o.keys.unmarshalPrivateKey(s,e),(e,t)=>e.public.hash((r,n)=>{t(r,n,e)}),(e,t,r)=>{f?f.hash((n,i)=>{r(n,e,t,i)}):r(null,e,t)}],(e,n,i,o)=>e?t(e):f&&!n.equals(o)?t(new Error("Public and private key do not match")):r&&!n.equals(r)?t(new Error("Id and private key do not match")):void t(null,new u(r,i,f))):t(null,new u(r,null,f))},t.isPeerId=function(e){return Boolean("object"==typeof e&&e._id&&e._idB58String)}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";const n=r(483),i=r(971),o=r(973);t=e.exports,t.aes=i,t.hmac=n,t.keys=o,t.randomBytes=r(488),t.pbkdf2=r(984)},function(e,t,r){"use strict";e.exports={SHA1:20,SHA256:32,SHA512:64}},function(e,t,r){"use strict";const n=r(972),i={16:"aes-128-ctr",32:"aes-256-ctr"};t.create=function(e,t,r){const o=i[e.length];if(!o)return r(new Error("Invalid key length"));const s=n.createCipheriv(o,e,t),a=n.createDecipheriv(o,e,t),u={encrypt(e,t){t(null,s.update(e))},decrypt(e,t){t(null,a.update(e))}};r(null,u)}},function(e,t,r){"use strict";const n=r(70);e.exports={createCipheriv:n.createCipheriv,createDecipheriv:n.createDecipheriv}},function(e,t,r){"use strict";(function(n){const i=r(12),o=i(r(274)),s=r(19);t=e.exports;const a={rsa:r(974),ed25519:r(979),secp256k1:r(72)(o,r(488))};function u(e){const t=a[e.toLowerCase()];return void 0!==t}t.supportedKeys=a,t.keysPBM=o,t.keyStretcher=r(981),t.generateEphemeralKeyPair=r(982),t.generateKeyPair=((e,t,r)=>{let n=a[e.toLowerCase()];if(!n)return r(new Error("invalid or unsupported key type"));n.generateKeyPair(t,r)}),t.generateKeyPairFromSeed=((e,t,r,n)=>{let i=a[e.toLowerCase()];return i?"ed25519"!==e.toLowerCase()?n(new Error("Seed key derivation is unimplemented for RSA or secp256k1")):void i.generateKeyPairFromSeed(t,r,n):n(new Error("invalid or unsupported key type"))}),t.unmarshalPublicKey=(e=>{const t=o.PublicKey.decode(e),r=t.Data;switch(t.Type){case o.KeyType.RSA:return a.rsa.unmarshalRsaPublicKey(r);case o.KeyType.Ed25519:return a.ed25519.unmarshalEd25519PublicKey(r);case o.KeyType.Secp256k1:if(a.secp256k1)return a.secp256k1.unmarshalSecp256k1PublicKey(r);throw new Error("secp256k1 support requires libp2p-crypto-secp256k1 package");default:throw new Error("invalid or unsupported key type")}}),t.marshalPublicKey=((e,t)=>{if(t=(t||"rsa").toLowerCase(),!u(t))throw new Error("invalid or unsupported key type");return e.bytes}),t.unmarshalPrivateKey=((e,t)=>{let r;try{r=o.PrivateKey.decode(e)}catch(e){return t(e)}const n=r.Data;switch(r.Type){case o.KeyType.RSA:return a.rsa.unmarshalRsaPrivateKey(n,t);case o.KeyType.Ed25519:return a.ed25519.unmarshalEd25519PrivateKey(n,t);case o.KeyType.Secp256k1:return a.secp256k1?a.secp256k1.unmarshalSecp256k1PrivateKey(n,t):t(new Error("secp256k1 support requires libp2p-crypto-secp256k1 package"));default:t(new Error("invalid or unsupported key type"))}}),t.marshalPrivateKey=((e,t)=>{if(t=(t||"rsa").toLowerCase(),!u(t))throw new Error("invalid or unsupported key type");return e.bytes}),t.import=((e,t,r)=>{try{const i=s.pki.decryptRsaPrivateKey(e,t);if(null===i)throw new Error("Cannot read the key, most likely the password is wrong or not a RSA key");let o=s.asn1.toDer(s.pki.privateKeyToAsn1(i));return o=n.from(o.getBytes(),"binary"),a.rsa.unmarshalRsaPrivateKey(o,r)}catch(e){r(e)}})}).call(this,r(0).Buffer)},function(e,t,r){"use strict";const n=r(484),i=r(12),o=r(18),s=r(486),a=i(r(274)),u=r(19),c=r(3);class f{constructor(e){this._key=e}verify(e,t,r){g(r),s.hashAndVerify(this._key,t,e,r)}marshal(){return s.utils.jwkToPkix(this._key)}get bytes(){return a.PublicKey.encode({Type:a.KeyType.RSA,Data:this.marshal()})}encrypt(e){return this._key.encrypt(e,"RSAES-PKCS1-V1_5")}equals(e){return this.bytes.equals(e.bytes)}hash(e){g(e),n(this.bytes,"sha2-256",e)}}class l{constructor(e,t){this._key=e,this._publicKey=t}genSecret(){return s.getRandomValues(new Uint8Array(16))}sign(e,t){g(t),s.hashAndSign(this._key,e,t)}get public(){if(!this._publicKey)throw new Error("public key not provided");return new f(this._publicKey)}decrypt(e,t){s.decrypt(this._key,e,t)}marshal(){return s.utils.jwkToPkcs1(this._key)}get bytes(){return a.PrivateKey.encode({Type:a.KeyType.RSA,Data:this.marshal()})}equals(e){return this.bytes.equals(e.bytes)}hash(e){g(e),n(this.bytes,"sha2-256",e)}id(e){this.public.hash((t,r)=>{if(t)return e(t);e(null,o.encode(r))})}export(e,t,r){"function"==typeof t&&(r=t,t=e,e="pkcs-8"),g(r),c(()=>{let n=null,i=null;try{const r=new u.util.ByteBuffer(this.marshal()),o=u.asn1.fromDer(r),s=u.pki.privateKeyFromAsn1(o);if("pkcs-8"===e){const e={algorithm:"aes256",count:1e4,saltSize:16,prfAlgorithm:"sha512"};i=u.pki.encryptRsaPrivateKey(s,t,e)}else n=new Error(`Unknown export format '${e}'`)}catch(e){n=e}r(n,i)})}}function h(e,t){const r=s.utils.pkcs1ToJwk(e);s.unmarshalPrivateKey(r,(e,r)=>{if(e)return t(e);t(null,new l(r.privateKey,r.publicKey))})}function p(e){const t=s.utils.pkixToJwk(e);return new f(t)}function d(e,t){s.unmarshalPrivateKey(e,(e,r)=>{if(e)return t(e);t(null,new l(r.privateKey,r.publicKey))})}function y(e,t){s.generateKey(e,(e,r)=>{if(e)return t(e);t(null,new l(r.privateKey,r.publicKey))})}function g(e){if("function"!=typeof e)throw new Error("callback is required")}e.exports={RsaPublicKey:f,RsaPrivateKey:l,unmarshalRsaPublicKey:p,unmarshalRsaPrivateKey:h,generateKeyPair:y,fromJwk:d}},function(e,t,r){"use strict";(function(t){const n=r(48),i=r(49),o=r(485),s=r(976),a=o.toCallback,u=o.toBuf,c=o.fromString,f=o.fromNumberTo32BitBuf,l=(e,r)=>{s.sha2256(e,(e,n)=>{e&&r(e),s.sha2256(t.from(n),r)})};e.exports={sha1:s.sha1,sha2256:s.sha2256,sha2512:s.sha2512,sha3512:a(u(n.sha3_512)),sha3384:a(u(n.sha3_384)),sha3256:a(u(n.sha3_256)),sha3224:a(u(n.sha3_224)),shake128:a(u(n.shake_128,256)),shake256:a(u(n.shake_256,512)),keccak224:a(u(n.keccak_224)),keccak256:a(u(n.keccak_256)),keccak384:a(u(n.keccak_384)),keccak512:a(u(n.keccak_512)),murmur3128:a(u(c(i.x64.hash128))),murmur332:a(f(c(i.x86.hash32))),addBlake:r(977),dblSha2256:l}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(t){const n=r(50),i=o();function o(){return self.crypto?self.crypto.subtle||self.crypto.webkitSubtle:self.msCrypto?self.msCrypto.subtle:void 0}function s(e){if(!i)throw new Error("Please use a browser with webcrypto support");return(r,o)=>{const s=i.digest({name:e},r);if("function"!=typeof s.then)return s.onerror=(()=>{o(new Error(`hashing data using ${e}`))}),void(s.oncomplete=(e=>{o(null,e.target.result)}));n(s.then(e=>t.from(new Uint8Array(e))),o)}}function a(e,t){s("SHA-1")(e,t)}function u(e,t){s("SHA-256")(e,t)}function c(e,t){s("SHA-512")(e,t)}e.exports={sha1:a,sha2256:u,sha2512:c}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(t){const n=r(51),i=r(485).toCallback,o=45569,s=45633,a={init:n.blake2bInit,update:n.blake2bUpdate,digest:n.blake2bFinal},u={init:n.blake2sInit,update:n.blake2sUpdate,digest:n.blake2sFinal},c=(e,r)=>i(n=>{const i=r.init(e,null);return r.update(i,n),t.from(r.digest(i))});e.exports=(e=>{for(let t=0;t<64;t++)e[o+t]=c(t+1,a);for(let t=0;t<32;t++)e[s+t]=c(t+1,u)})}).call(this,r(0).Buffer)},function(e,t,r){"use strict";const n=r(17),i=r(487),o=i.toBase64,s=i.toBn,a=n.define("RSAPrivateKey",function(){this.seq().obj(this.key("version").int(),this.key("modulus").int(),this.key("publicExponent").int(),this.key("privateExponent").int(),this.key("prime1").int(),this.key("prime2").int(),this.key("exponent1").int(),this.key("exponent2").int(),this.key("coefficient").int())}),u=n.define("AlgorithmIdentifier",function(){this.seq().obj(this.key("algorithm").objid({"1.2.840.113549.1.1.1":"rsa"}),this.key("none").optional().null_(),this.key("curve").optional().objid(),this.key("params").optional().seq().obj(this.key("p").int(),this.key("q").int(),this.key("g").int()))}),c=n.define("RSAPublicKey",function(){this.seq().obj(this.key("algorithm").use(u),this.key("subjectPublicKey").bitstr())}),f=n.define("RSAPublicKey",function(){this.seq().obj(this.key("modulus").int(),this.key("publicExponent").int())});t.pkcs1ToJwk=function(e){const t=a.decode(e,"der");return{kty:"RSA",n:o(t.modulus),e:o(t.publicExponent),d:o(t.privateExponent),p:o(t.prime1),q:o(t.prime2),dp:o(t.exponent1),dq:o(t.exponent2),qi:o(t.coefficient),alg:"RS256",kid:"2011-04-29"}},t.jwkToPkcs1=function(e){return a.encode({version:0,modulus:s(e.n),publicExponent:s(e.e),privateExponent:s(e.d),prime1:s(e.p),prime2:s(e.q),exponent1:s(e.dp),exponent2:s(e.dq),coefficient:s(e.qi)},"der")},t.pkixToJwk=function(e){const t=c.decode(e,"der"),r=f.decode(t.subjectPublicKey.data,"der");return{kty:"RSA",n:o(r.modulus),e:o(r.publicExponent),alg:"RS256",kid:"2011-04-29"}},t.jwkToPkix=function(e){return c.encode({algorithm:{algorithm:"rsa",none:null},subjectPublicKey:{data:f.encode({modulus:s(e.n),publicExponent:s(e.e)},"der")}},"der")}},function(e,t,r){"use strict";(function(t){const n=r(484),i=r(12),o=r(18),s=r(980),a=i(r(274));class u{constructor(e){this._key=y(e,s.publicKeyLength)}verify(e,t,r){d(r),s.hashAndVerify(this._key,t,e,r)}marshal(){return t.from(this._key)}get bytes(){return a.PublicKey.encode({Type:a.KeyType.Ed25519,Data:this.marshal()})}equals(e){return this.bytes.equals(e.bytes)}hash(e){d(e),n(this.bytes,"sha2-256",e)}}class c{constructor(e,t){this._key=y(e,s.privateKeyLength),this._publicKey=y(t,s.publicKeyLength)}sign(e,t){d(t),s.hashAndSign(this._key,e,t)}get public(){if(!this._publicKey)throw new Error("public key not provided");return new u(this._publicKey)}marshal(){return t.concat([t.from(this._key),t.from(this._publicKey)])}get bytes(){return a.PrivateKey.encode({Type:a.KeyType.Ed25519,Data:this.marshal()})}equals(e){return this.bytes.equals(e.bytes)}hash(e){d(e),n(this.bytes,"sha2-256",e)}id(e){this.public.hash((t,r)=>{if(t)return e(t);e(null,o.encode(r))})}}function f(e,t){try{e=y(e,s.privateKeyLength+s.publicKeyLength)}catch(e){return t(e)}const r=e.slice(0,s.privateKeyLength),n=e.slice(s.privateKeyLength,e.length);t(null,new c(r,n))}function l(e){return e=y(e,s.publicKeyLength),new u(e)}function h(e,t){void 0===t&&"function"==typeof e&&(t=e),s.generateKey((e,r)=>{if(e)return t(e);let n;try{n=new c(r.secretKey,r.publicKey)}catch(e){return void t(e)}t(null,n)})}function p(e,t,r){void 0===r&&"function"==typeof t&&(r=t),s.generateKeyFromSeed(e,(e,t)=>{if(e)return r(e);let n;try{n=new c(t.secretKey,t.publicKey)}catch(e){return void r(e)}r(null,n)})}function d(e){if("function"!=typeof e)throw new Error("callback is required")}function y(e,r){if(t.isBuffer(e)&&(e=new Uint8Array(e)),!(e instanceof Uint8Array)||e.length!==r)throw new Error("Key must be a Uint8Array or Buffer of length "+r);return e}e.exports={Ed25519PublicKey:u,Ed25519PrivateKey:c,unmarshalEd25519PrivateKey:f,unmarshalEd25519PublicKey:l,generateKeyPair:h,generateKeyPairFromSeed:p}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(e){const n=r(71),i=r(3);t.publicKeyLength=n.sign.publicKeyLength,t.privateKeyLength=n.sign.secretKeyLength,t.generateKey=function(e){i(()=>{let t;try{t=n.sign.keyPair()}catch(t){return e(t)}e(null,t)})},t.generateKeyFromSeed=function(e,t){i(()=>{let r;try{r=n.sign.keyPair.fromSeed(e)}catch(e){return t(e)}t(null,r)})},t.hashAndSign=function(t,r,o){i(()=>{o(null,e.from(n.sign.detached(r,t)))})},t.hashAndVerify=function(e,t,r,o){i(()=>{let i;try{i=n.sign.detached.verify(r,t,e)}catch(e){return o(e)}o(null,i)})}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(t){const n=r(47),i=r(483),o={"AES-128":{ivSize:16,keySize:16},"AES-256":{ivSize:16,keySize:32},Blowfish:{ivSize:8,cipherKeySize:32}};e.exports=((e,r,s,a)=>{const u=o[e];if(!u)return a(new Error("unkown cipherType passed"));if(!r)return a(new Error("unkown hashType passed"));const c=u.keySize,f=u.ivSize,l=20,h=t.from("key expansion"),p=2*(f+c+20);i.create(r,s,(e,r)=>{if(e)return a(e);r.digest(h,(e,i)=>{if(e)return a(e);let o=[],s=0;function u(e){r.digest(t.concat([i,h]),(t,n)=>{if(t)return e(t);let a=n.length;s+a>p&&(a=p-s),o.push(n),s+=a,r.digest(i,(t,r)=>{if(t)return e(t);i=r,e()})})}function l(e){if(e)return a(e);const r=p/2,n=t.concat(o),i=n.slice(0,r),s=n.slice(r,p),u=e=>({iv:e.slice(0,f),cipherKey:e.slice(f,f+c),macKey:e.slice(f+c)});a(null,{k1:u(i),k2:u(s)})}n(()=>s<p,u,l)})})})}).call(this,r(0).Buffer)},function(e,t,r){"use strict";const n=r(983);e.exports=((e,t)=>{n.generateEphmeralKeyPair(e,t)})},function(e,t,r){"use strict";(function(e){const n=r(273)(),i=r(272),o=r(17).bignum,s=r(487),a=s.toBase64,u=s.toBn,c={"P-256":256,"P-384":384,"P-521":521};t.generateEphmeralKeyPair=function(t,r){i(n.subtle.generateKey({name:"ECDH",namedCurve:t},!0,["deriveBits"]).then(r=>{const o=(o,s,a)=>{let u;"function"==typeof s&&(a=s,s=void 0),u=s?n.subtle.importKey("jwk",p(t,s),{name:"ECDH",namedCurve:t},!1,["deriveBits"]):Promise.resolve(r.privateKey);const f=Promise.all([n.subtle.importKey("jwk",h(t,o),{name:"ECDH",namedCurve:t},!1,[]),u]);i(f.then(e=>n.subtle.deriveBits({name:"ECDH",namedCurve:t,public:e[0]},e[1],c[t])).then(t=>e.from(t)),a)};return n.subtle.exportKey("jwk",r.publicKey).then(e=>({key:l(e),genSharedKey:o}))}),r)};const f={"P-256":32,"P-384":48,"P-521":66};function l(t){const r=f[t.crv];return e.concat([e.from([4]),u(t.x).toArrayLike(e,"be",r),u(t.y).toArrayLike(e,"be",r)],1+2*r)}function h(t,r){const n=f[t];if(!r.slice(0,1).equals(e.from([4])))throw new Error("Invalid key format");const i=new o(r.slice(1,n+1)),s=new o(r.slice(1+n));return{kty:"EC",crv:t,x:a(i,n),y:a(s,n),ext:!0}}function p(e,t){const r=h(e,t.public);return r.d=a(new o(t.private)),r}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";const n=r(19),i={sha1:"sha1","sha2-256":"sha256","sha2-512":"sha512"};function o(e,t,r,o,s){const a=i[s];if(!a)throw new Error(`Hash '${s}' is unknown or not supported`);const u=n.pkcs5.pbkdf2(e,t,r,o,a);return n.util.encode64(u)}e.exports=o},function(e,t,r){"use strict";const n=r(489).extend(r(986)),i=n.object().keys({repo:n.alternatives().try(n.object(),n.string()).allow(null),repoOwner:n.boolean().default(!0),preload:n.object().keys({enabled:n.boolean().default(!0),addresses:n.array().items(n.multiaddr().options({convert:!1}))}).allow(null),init:n.alternatives().try(n.boolean(),n.object().keys({bits:n.number().integer()})).allow(null),start:n.boolean(),pass:n.string().allow(""),relay:n.object().keys({enabled:n.boolean(),hop:n.object().keys({enabled:n.boolean(),active:n.boolean()}).allow(null)}).allow(null),EXPERIMENTAL:n.object().keys({pubsub:n.boolean(),sharding:n.boolean(),dht:n.boolean()}).allow(null),connectionManager:n.object().allow(null),config:n.object().keys({Addresses:n.object().keys({Swarm:n.array().items(n.multiaddr().options({convert:!1})),API:n.multiaddr().options({convert:!1}),Gateway:n.multiaddr().options({convert:!1})}).allow(null),Discovery:n.object().keys({MDNS:n.object().keys({Enabled:n.boolean(),Interval:n.number().integer()}).allow(null),webRTCStar:n.object().keys({Enabled:n.boolean()}).allow(null)}).allow(null),Bootstrap:n.array().items(n.multiaddr().IPFS().options({convert:!1}))}).allow(null),libp2p:n.object().keys({modules:n.object().allow(null)}).allow(null)}).options({allowUnknown:!0});e.exports.validate=(e=>n.attempt(e,i))},function(e,t,r){const n=r(987),i=r(80);e.exports={name:"multiaddr",language:{invalid:"{{message}}",fmt:"must be in {{fmt}} format"},pre(e,t,r){if(null==e)return this.createError("multiaddr.invalid",{v:e,message:"addr must be a string, Buffer, or another Multiaddr"},t,r);let i;try{i=n(e)}catch(n){return this.createError("multiaddr.invalid",{v:e,message:n.message},t,r)}return r.convert?i:e},rules:Object.keys(i).map(e=>({name:e,validate(t,r,n,o){return i[e].matches(r)?r:this.createError("multiaddr.fmt",{v:r,fmt:e},n,o)}}))}},function(e,t,r){"use strict";(function(n){const i=r(79),o=r(27),s=r(988),a=r(276),u=r(23),c=r(18),f=r(73),l=new Error("Sorry, Not Implemented Yet."),h=f.proto(function(e){if(!(this instanceof h))return new h(e);if(null==e&&(e=""),e instanceof n)this.buffer=s.fromBuffer(e);else if("string"==typeof e||e instanceof String)this.buffer=s.fromString(e);else{if(!(e.buffer&&e.protos&&e.protoCodes))throw new Error("addr must be a string, Buffer, or another Multiaddr");this.buffer=s.fromBuffer(e.buffer)}},{className:"Multiaddr",symbolName:"@multiformats/js-multiaddr/multiaddr"});h.prototype.toString=function e(){return s.bufferToString(this.buffer)},h.prototype.toOptions=function e(){const 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},h.prototype.inspect=function e(){return"<Multiaddr "+this.buffer.toString("hex")+" - "+s.bufferToString(this.buffer)+">"},h.prototype.protos=function e(){return i(this.protoCodes(),function(e){return o(a(e))})},h.prototype.protoCodes=function e(){const t=[],r=this.buffer;let n=0;for(;n<r.length;){const e=u.decode(r,n),i=u.decode.bytes,o=a(e),c=s.sizeForAddr(o,r.slice(n+i));n+=c+i,t.push(e)}return t},h.prototype.protoNames=function e(){return i(this.protos(),function(e){return e.name})},h.prototype.tuples=function e(){return s.bufferToTuples(this.buffer)},h.prototype.stringTuples=function e(){const t=s.bufferToTuples(this.buffer);return s.tuplesToStringTuples(t)},h.prototype.encapsulate=function e(t){return t=h(t),h(this.toString()+t.toString())},h.prototype.decapsulate=function e(t){t=t.toString();const r=this.toString(),n=r.lastIndexOf(t);if(n<0)throw new Error("Address "+this+" does not contain subaddress: "+t);return h(r.slice(0,n))},h.prototype.getPeerId=function e(){let t=null;try{t=this.stringTuples().filter(e=>{if(e[0]===a.names.ipfs.code)return!0})[0][1],c.decode(t)}catch(e){t=null}return t},h.prototype.equals=function e(t){return this.buffer.equals(t.buffer)},h.prototype.nodeAddress=function e(){if(!this.isThinWaistAddress())throw new Error('Multiaddr must be "thin waist" address for nodeAddress.');const t=this.protoCodes(),r=this.toString().split("/").slice(1);return{family:41===t[0]?"IPv6":"IPv4",address:r[1],port:r[3]}},h.fromNodeAddress=function e(t,r){if(!t)throw new Error("requires node address object");if(!r)throw new Error("requires transport protocol");const n="IPv6"===t.family?"ip6":"ip4";return h("/"+[n,t.address,r,t.port].join("/"))},h.prototype.isThinWaistAddress=function e(t){const r=(t||this).protos();return 2===r.length&&((4===r[0].code||41===r[0].code)&&(6===r[1].code||17===r[1].code))},h.prototype.fromStupidString=function e(t){throw l},h.protocols=a,h.isName=function e(t){return!!h.isMultiaddr(t)&&t.protos().some(e=>e.resolvable)},h.resolve=function e(t,r){return h.isMultiaddr(t)&&h.isName(t)?r(new Error("not implemented yet")):r(new Error("not a valid name"))},t=e.exports=h}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(t){const n=r(79),i=r(265),o=r(989),s=r(276),a=r(23);function u(e){const t=[],r=e.split("/").slice(1);if(1===r.length&&""===r[0])return[];for(let n=0;n<r.length;n++){const i=r[n],o=s(i);if(0!==o.size){if(n++,n>=r.length)throw S("invalid address: "+e);t.push([i,r[n]])}else t.push([i])}return t}function c(e){const t=[];return n(e,function(e){const r=k(e);t.push(r.name),e.length>1&&t.push(e[1])}),"/"+t.join("/")}function f(e){return n(e,function(e){Array.isArray(e)||(e=[e]);const t=k(e);return e.length>1?[t.code,o.toBuffer(t.code,e[1])]:[t.code]})}function l(e){return n(e,function(e){const t=k(e);return e.length>1?[t.code,o.toString(t.code,e[1])]:[t.code]})}function h(e){return b(t.concat(n(e,function(e){const r=k(e);let n=t.from(a.encode(r.code));return e.length>1&&(n=t.concat([n,e[1]])),n})))}function p(e,t){if(e.size>0)return e.size/8;if(0===e.size)return 0;{const e=a.decode(t);return e+a.decode.bytes}}function d(e){const t=[];let r=0;for(;r<e.length;){const n=a.decode(e,r),i=a.decode.bytes,o=s(n),u=p(o,e.slice(r+i));if(0===u){t.push([n]),r+=i;continue}const c=e.slice(r+i,r+i+u);if(r+=u+i,r>e.length)throw S("Invalid address buffer: "+e.toString("hex"));t.push([n,c])}return t}function y(e){const t=d(e),r=l(t);return c(r)}function g(e){e=w(e);const t=u(e),r=f(t);return h(r)}function m(e){return g(e)}function b(e){const r=v(e);if(r)throw r;return t.from(e)}function v(e){try{d(e)}catch(e){return e}}function _(e){return void 0===v(e)}function w(e){return"/"+i(e.trim().split("/")).join("/")}function S(e){return new Error("Error parsing address: "+e)}function k(e){const t=s(e[0]);return t}e.exports={stringToStringTuples:u,stringTuplesToString:c,tuplesToStringTuples:l,stringTuplesToTuples:f,bufferToTuples:d,tuplesToBuffer:h,bufferToString:y,stringToBuffer:g,fromString:m,fromBuffer:b,validateBuffer:v,isValidBuffer:_,cleanPath:w,ParseError:S,protoFromTuple:k,sizeForAddr:p}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(t){const n=r(266),i=r(267),o=r(276),s=r(18),a=r(23);function u(e,r){return r instanceof t?u.toString(e,r):u.toBuffer(e,r)}function c(e){if(!e.isValid())throw new Error("invalid ip address");return n.toBuffer(e.address)}function f(e){const r=t.alloc(2);return r.writeUInt16BE(e,0),r}function l(e){return e.readUInt16BE(0)}function h(e){const r=t.from(e),n=t.from(a.encode(r.length));return t.concat([n,r])}function p(e){const t=a.decode(e);if(e=e.slice(a.decode.bytes),e.length!==t)throw new Error("inconsistent lengths");return e.toString()}function d(e){const r=t.from(s.decode(e)),n=t.from(a.encode(r.length));return t.concat([n,r])}function y(e){const t=a.decode(e),r=e.slice(a.decode.bytes);if(r.length!==t)throw new Error("inconsistent lengths");return s.encode(r)}e.exports=u,u.toString=function e(t,r){switch(t=o(t),t.code){case 4:case 41:return n.toString(r);case 6:case 17:case 33:case 132:return l(r);case 54:case 55:case 56:return p(r);case 421:return y(r);default:return r.toString("hex")}},u.toBuffer=function e(r,n){switch(r=o(r),r.code){case 4:return c(new i.Address4(n));case 41:return c(new i.Address6(n));case 6:case 17:case 33:case 132:return f(parseInt(n,10));case 54:case 55:case 56:return h(n);case 421:return d(n);default:return t.from(n,"hex")}}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";const n=r(5),i=r(277).errors;function o(e){return!!e&&(e.code===i.ERR_REPO_NOT_INITIALIZED||!!(e.message.match(/not found/)||e.message.match(/ENOENT/)||e.message.match(/No value/)))}e.exports=(e=>{e.log("booting");const t=e._options,r=t.init,i=t.start;n([t=>{if(!e._repo.closed)return t(null,!0);e._repo.open((e,r)=>o(e)?t(null,!1):e?t(e):void t(null,!0))},(n,i)=>{if(n)return e.init({repo:e._repo},e=>{if(e)return i(Object.assign(e,{emitted:!0}));i()});if(r){const r=Object.assign({bits:2048,pass:e._options.pass},"object"==typeof t.init?t.init:{});return e.init(r,e=>{if(e)return i(Object.assign(e,{emitted:!0}));i()})}i()},t=>{if(!i)return t();e.start(e=>{if(e)return t(Object.assign(e,{emitted:!0}));t()})}],t=>{t?t.emitted||e.emit("error",t):(e.log("booted"),e.emit("ready"))})})},function(e,t,r){"use strict";t.create=function e(t,r,n){const i=n.storageBackends[t],o=Object.assign({},n.storageBackendOptions[t]||{});return new i(r,o)}},function(e,t,r){"use strict";(function(t){const n=r(26).Key,i=r(1),o=i("repo:version"),s=new n("version");e.exports=(e=>({exists(t){e.has(s,t)},get(t){e.get(s,(e,r)=>{if(e)return t(e);t(null,parseInt(r.toString().trim(),10))})},set(r,n){e.put(s,t.from(String(r)),n)},check(e,t){this.get((r,n)=>{if(r)return t(r);o("comparing version: %s and %s",n,e);const i=6===n&&7===e||6===e&&7===n;if(n!==e&&!i)return t(new Error(`version mismatch: expected v${e}, found v${n}`));t()})}}))}).call(this,r(0).Buffer)},function(e,t,r){"use strict";const n=r(26).Key,i=r(126),o=r(5),s=r(220),a=r(357),u=r(358),c=r(2).Buffer,f=new n("config");e.exports=(e=>{const t=i(n,1),r={get(t,r){"function"==typeof t&&(r=t,t=void 0),t||(t=void 0),e.get(f,(e,n)=>{if(e)return r(e);let i;try{i=JSON.parse(n.toString())}catch(e){return r(e)}if(void 0!==t&&!u(i,t))return r(new Error("Key "+t+" does not exist in config"));let o=void 0!==t?s(i,t):i;r(null,o)})},set(e,r,n){if("function"==typeof r)n=r,r=e,e=void 0;else if(!e||"string"!=typeof e)return n(new Error("Invalid key type"));if(void 0===r||c.isBuffer(r))return n(new Error("Invalid value type"));t.push({key:e,value:r},n)},exists(t){e.has(f,t)}};return r;function n(e,t){const n=e.key,i=e.value;n?o([e=>r.get(e),(e,t)=>t(null,a(e,n,i)),l],t):l(i,t)}function l(t,r){const n=c.from(JSON.stringify(t,null,2));e.put(f,n,r)}})},function(e,t,r){"use strict";(function(t){const n=r(26).Key,i=r(995),o=new n("datastore_spec");e.exports=(e=>({exists(t){e.has(o,t)},get(t){e.get(o,(e,r)=>{if(e)return t(e);t(null,JSON.parse(r.toString()))})},set(r,n){e.put(o,t.from(JSON.stringify(i(r,{deep:!0}))),n)}}))}).call(this,r(0).Buffer)},function(e,t,r){"use strict";const n=r(996);e.exports=((e,t)=>{if(!n(e))throw new TypeError("Expected a plain object");if(t=t||{},"function"==typeof t)throw new TypeError("Specify the compare function as an option instead");const r=t.deep,i=[],o=[],s=e=>{const a=i.indexOf(e);if(-1!==a)return o[a];const u={},c=Object.keys(e).sort(t.compare);i.push(e),o.push(u);for(let t=0;t<c.length;t++){const i=c[t],o=e[i];if(r&&Array.isArray(o)){const e=[];for(let t=0;t<o.length;t++)e[t]=n(o[t])?s(o[t]):o[t];u[i]=e}else u[i]=r&&n(o)?s(o):o}return u};return s(e)})},function(e,t,r){"use strict";var n=Object.prototype.toString;e.exports=function(e){var t;return"[object Object]"===n.call(e)&&(t=Object.getPrototypeOf(e),null===t||t===Object.getPrototypeOf({}))}},function(e,t,r){"use strict";const n=r(26).Key,i=r(2).Buffer,o=new n("api");e.exports=(e=>({get(t){e.get(o,(e,r)=>t(e,r&&r.toString()))},set(t,r){e.put(o,i.from(t.toString()),r)},delete(t){e.delete(o,t)}}))},function(e,t,r){"use strict";const n=r(359),i=n.ShardingDatastore,o=r(26).Key,s=r(362),a=r(120),u=r(3),c=r(221),f=r(9),l=r(8),h=e=>{const t=new s.Encoder;return new o("/"+t.write(e).finalize(),!1)},p=e=>h(e.buffer);function d(e,t,r){if(t.sharding){const t=new n.shard.NextToLast(2);i.createOrOpen(e,t,r)}else u(()=>r(null,e))}function y(e){return{query(t,r){l(e.query(t),l.collect(r))},get(t,r){if(!f.isCID(t))return u(()=>{r(new Error("Not a valid cid"))});const n=p(t);e.get(n,(e,n)=>{if(e)return r(e);r(null,new a(n,t))})},put(t,r){if(!a.isBlock(t))return u(()=>{r(new Error("invalid block"))});const n=p(t.cid);e.has(n,(i,o)=>i?r(i):o?r():void e.put(n,t.data,r))},putMany(t,r){const n=t.map(e=>({key:p(e.cid),block:e})),i=e.batch();c(n,(t,r)=>e.has(t.key,r),(e,t)=>{if(e)return r(e);t.forEach(e=>{i.put(e.key,e.block.data)}),i.commit(r)})},has(t,r){if(!f.isCID(t))return u(()=>{r(new Error("Not a valid cid"))});e.has(p(t),r)},delete(t,r){if(!f.isCID(t))return u(()=>{r(new Error("Not a valid cid"))});e.delete(p(t),r)},close(t){e.close(t)}}}e.exports=((e,t,r)=>{d(e,t,(e,t)=>{if(e)return r(e);r(null,y(t))})})},function(e,t,r){"use strict";e.exports={lock:"memory",storageBackends:{root:r(83),blocks:r(83),keys:r(83),datastore:r(83)},storageBackendOptions:{root:{extension:""},blocks:{sharding:!1},keys:{sharding:!1}}}},function(e,t,r){"use strict";e.exports={Spec:{type:"mount",mounts:[{mountpoint:"/blocks",type:"measure",prefix:"flatfs.datastore",child:{type:"flatfs",path:"blocks",sync:!0,shardFunc:"/repo/flatfs/shard/v1/next-to-last/2"}},{mountpoint:"/",type:"measure",prefix:"leveldb.datastore",child:{type:"levelds",path:"datastore",compression:"none"}}]}}},function(e,t,r){"use strict";t.ERR_REPO_NOT_INITIALIZED="ERR_REPO_NOT_INITIALIZED"},function(e,t,r){"use strict";e.exports={repoVersion:7}},function(e,t,r){"use strict";t.preStart=r(1004),t.start=r(1031),t.stop=r(1053),t.isOnline=r(1054),t.version=r(1055),t.id=r(1056),t.repo=r(504),t.init=r(1057),t.bootstrap=r(1059),t.config=r(1060),t.block=r(1061),t.object=r(1062),t.dag=r(1064),t.libp2p=r(1069),t.swarm=r(1318),t.ping=r(1321),t.pingPullStream=r(1322),t.pingReadableStream=r(1323),t.pin=r(1324),t.files=r(1331),t.bitswap=r(579),t.pubsub=r(1366),t.dht=r(1367),t.dns=r(1370),t.key=r(1372),t.stats=r(1373),t.mfs=r(1375)},function(e,t,r){"use strict";const n=r(68),i=r(52),o=r(31),s=r(5),a=r(491),u=r(275),c=r(1030);e.exports=function e(t){return e=>{t.log("pre-start");const r=t._options.pass;s([e=>t._repo.config.get(e),(e,r)=>{if(!t._options.config)return r(null,e);u(e,t._options.config),t.config.replace(e,t=>{if(t)return r(t);r(null,e)})},(e,r)=>{if(e.Keychain)return r(null,e);e.Keychain=a.generateOptions(),t.config.set("Keychain",e.Keychain,n=>{t.log("using default keychain options"),r(n,e)})},(e,n)=>{if(t._keychain);else if(r){const n=Object.assign({passPhrase:r},e.Keychain);t._keychain=new a(t._repo.keys,n),t.log("keychain constructed")}else t._keychain=new c,t.log("no keychain, use --pass");n(null,e)},(e,t)=>{const r=e.Identity.PrivKey;n.createFromPrivKey(r,(r,n)=>{t(r,e,n)})},(e,n,i)=>{if(!r)return i(null,e,n);t._keychain.findKeyByName("self",r=>{if(r)return t.log('Creating "self" key'),t._keychain.importPeer("self",n,t=>i(t,e,n));i(null,e,n)})},(e,r,n)=>{t.log("peer created"),t._peerInfo=new i(r),e.Addresses&&e.Addresses.Swarm&&e.Addresses.Swarm.forEach(e=>{let r=o(e);r.getPeerId()&&(r=r.encapsulate("/ipfs/"+t._peerInfo.id.toB58String())),t._peerInfo.multiaddrs.add(r)}),n()},e=>t.pin._load(e)],e)}}},function(e,t,r){"use strict";const n=r(1006),i=r(1010),o=r(1011),s=r(26),a=r(8),u=r(1027),c="/pkcs8/",f="/info/",l={minKeyLength:14,minSaltLength:16,minIterationCount:1e3},h={dek:{keyLength:64,iterationCount:1e4,salt:"you should override this value with a crypto secure random number",hash:"sha2-512"}};function p(e){return!!e&&e===n(e.trim())}function d(e,t){const r=200,n=1e3,i=800*Math.random()+200;"string"==typeof t&&(t=new Error(t)),setTimeout(e,i,t,null)}function y(e){return new s.Key(c+e)}function g(e){return new s.Key(f+e)}class m{constructor(e,t){if(!e)throw new Error("store is required");this.store=e;const r=i(h,t);if(!r.passPhrase||r.passPhrase.length<20)throw new Error("passPhrase must be least 20 characters");if(r.dek.keyLength<l.minKeyLength)throw new Error(`dek.keyLength must be least ${l.minKeyLength} bytes`);if(r.dek.salt.length<l.minSaltLength)throw new Error(`dek.saltLength must be least ${l.minSaltLength} bytes`);if(r.dek.iterationCount<l.minIterationCount)throw new Error(`dek.iterationCount must be least ${l.minIterationCount}`);const n=o.pbkdf2(r.passPhrase,r.dek.salt,r.dek.iterationCount,r.dek.keyLength,r.dek.hash);Object.defineProperty(this,"_",{value:()=>n})}get cms(){return new u(this)}static generateOptions(){const e=Object.assign({},h),t=3*Math.ceil(l.minSaltLength/3);return e.dek.salt=o.randomBytes(t).toString("base64"),e}static get options(){return h}createKey(e,t,r,n){const i=this;if(!p(e)||"self"===e)return d(n,`Invalid key name '${e}'`);const s=y(e);i.store.has(s,(a,u)=>{if(a)return d(n,a);if(u)return d(n,`Key '${e}' already exists`);switch(t.toLowerCase()){case"rsa":if(r<2048)return d(n,`Invalid RSA key size ${r}`)}o.keys.generateKeyPair(t,r,(t,r)=>{if(t)return d(n,t);r.id((t,o)=>{if(t)return d(n,t);r.export(this._(),(t,r)=>{if(t)return d(n,t);const a={name:e,id:o},u=i.store.batch();u.put(s,r),u.put(g(e),JSON.stringify(a)),u.commit(e=>{if(e)return d(n,e);n(null,a)})})})})})}listKeys(e){const t=this,r={prefix:f};a(this.store.query(r),a.collect((t,r)=>{if(t)return d(e,t);const n=r.map(e=>JSON.parse(e.value));e(null,n)}))}findKeyById(e,t){this.listKeys((r,n)=>{if(r)return d(t,r);const i=n.find(t=>t.id===e);t(null,i)})}findKeyByName(e,t){if(!p(e))return d(t,`Invalid key name '${e}'`);const r=g(e);this.store.get(r,(r,n)=>{if(r)return d(t,`Key '${e}' does not exist. ${r.message}`);t(null,JSON.parse(n.toString()))})}removeKey(e,t){const r=this;if(!p(e)||"self"===e)return d(t,`Invalid key name '${e}'`);const n=y(e);r.findKeyByName(e,(i,o)=>{if(i)return d(t,i);const s=r.store.batch();s.delete(n),s.delete(g(e)),s.commit(e=>{if(e)return d(t,e);t(null,o)})})}renameKey(e,t,r){const n=this;if(!p(e)||"self"===e)return d(r,`Invalid old key name '${e}'`);if(!p(t)||"self"===t)return d(r,`Invalid new key name '${t}'`);const i=y(e),o=y(t),s=g(e),a=g(t);this.store.get(i,(u,c)=>{if(u)return d(r,`Key '${e}' does not exist. ${u.message}`);const f=c.toString();n.store.has(o,(e,u)=>e?d(r,e):u?d(r,`Key '${t}' already exists`):void n.store.get(s,(e,u)=>{if(e)return d(r,e);const c=JSON.parse(u.toString());c.name=t;const l=n.store.batch();l.put(o,f),l.put(a,JSON.stringify(c)),l.delete(i),l.delete(s),l.commit(e=>{if(e)return d(r,e);r(null,c)})}))})}exportKey(e,t,r){if(!p(e))return d(r,`Invalid key name '${e}'`);if(!t)return d(r,"Password is required");const n=y(e);this.store.get(n,(n,i)=>{if(n)return d(r,`Key '${e}' does not exist. ${n.message}`);const s=i.toString();o.keys.import(s,this._(),(e,n)=>{if(e)return d(r,e);n.export(t,r)})})}importKey(e,t,r,n){const i=this;if(!p(e)||"self"===e)return d(n,`Invalid key name '${e}'`);if(!t)return d(n,"PEM encoded key is required");const s=y(e);i.store.has(s,(a,u)=>a?d(n,a):u?d(n,`Key '${e}' already exists`):void o.keys.import(t,r,(t,r)=>{if(t)return d(n,"Cannot read the key, most likely the password is wrong");r.id((t,o)=>{if(t)return d(n,t);r.export(this._(),(t,r)=>{if(t)return d(n,t);const a={name:e,id:o},u=i.store.batch();u.put(s,r),u.put(g(e),JSON.stringify(a)),u.commit(e=>{if(e)return d(n,e);n(null,a)})})})}))}importPeer(e,t,r){const n=this;if(!p(e))return d(r,`Invalid key name '${e}'`);if(!t||!t.privKey)return d(r,"Peer.privKey is required");const i=t.privKey,o=y(e);n.store.has(o,(t,s)=>t?d(r,t):s?d(r,`Key '${e}' already exists`):void i.id((t,s)=>{if(t)return d(r,t);i.export(this._(),(t,i)=>{if(t)return d(r,t);const a={name:e,id:s},u=n.store.batch();u.put(o,i),u.put(g(e),JSON.stringify(a)),u.commit(e=>{if(e)return d(r,e);r(null,a)})})}))}_getPrivateKey(e,t){if(!p(e))return d(t,`Invalid key name '${e}'`);this.store.get(y(e),(r,n)=>{if(r)return d(t,`Key '${e}' does not exist. ${r.message}`);t(null,n.toString())})}}e.exports=m},function(e,t,r){"use strict";var n=r(1007),i=/[\/\?<>\\:\*\|":]/g,o=/[\x00-\x1f\x80-\x9f]/g,s=/^\.+$/,a=/^(con|prn|aux|nul|com[0-9]|lpt[0-9])(\..*)?$/i,u=/[\. ]+$/;function c(e,t){var r=e.replace(i,t).replace(o,t).replace(s,t).replace(a,t).replace(u,t);return n(r,255)}e.exports=function(e,t){var r=t&&t.replacement||"",n=c(e,r);return""===r?n:c(n,"")}},function(e,t,r){"use strict";var n=r(1008),i=r(1009);e.exports=n.bind(null,i)},function(e,t,r){"use strict";function n(e){return e>=55296&&e<=56319}function i(e){return e>=56320&&e<=57343}e.exports=function e(t,r,o){if("string"!=typeof r)throw new Error("Input must be string");for(var s=r.length,a=0,u,c,f=0;f<s;f+=1){if(u=r.charCodeAt(f),c=r[f],n(u)&&i(r.charCodeAt(f+1))&&(f+=1,c+=r[f]),a+=t(c),a===o)return r.slice(0,f+1);if(a>o)return r.slice(0,f-c.length+1)}return r}},function(e,t,r){"use strict";function n(e){return e>=55296&&e<=56319}function i(e){return e>=56320&&e<=57343}e.exports=function e(t){if("string"!=typeof t)throw new Error("Input must be string");for(var r=t.length,o=0,s=null,a=null,u=0;u<r;u++)s=t.charCodeAt(u),i(s)?null!=a&&n(a)?o+=1:o+=3:s<=127?o+=1:s>=128&&s<=2047?o+=2:s>=2048&&s<=65535&&(o+=3),a=s;return o}},function(e,t,r){"use strict";var n=function e(t){return i(t)&&!o(t)};function i(e){return!!e&&"object"==typeof e}function o(e){var t=Object.prototype.toString.call(e);return"[object RegExp]"===t||"[object Date]"===t||u(e)}var s="function"==typeof Symbol&&Symbol.for,a=s?Symbol.for("react.element"):60103;function u(e){return e.$$typeof===a}function c(e){return Array.isArray(e)?[]:{}}function f(e,t){var r=t&&!0===t.clone;return r&&n(e)?p(c(e),e,t):e}function l(e,t,r){var i=e.slice();return t.forEach(function(t,o){void 0===i[o]?i[o]=f(t,r):n(t)?i[o]=p(e[o],t,r):-1===e.indexOf(t)&&i.push(f(t,r))}),i}function h(e,t,r){var i={};return n(e)&&Object.keys(e).forEach(function(t){i[t]=f(e[t],r)}),Object.keys(t).forEach(function(o){n(t[o])&&e[o]?i[o]=p(e[o],t[o],r):i[o]=f(t[o],r)}),i}function p(e,t,r){var n=Array.isArray(t),i=Array.isArray(e),o=r||{arrayMerge:l},s=n===i;if(s){if(n){var a=o.arrayMerge||l;return a(e,t,r)}return h(e,t,r)}return f(t,r)}p.all=function e(t,r){if(!Array.isArray(t)||t.length<2)throw new Error("first argument should be an array with at least two elements");return t.reduce(function(e,t){return p(e,t,r)})};var d=p;e.exports=d},function(e,t,r){"use strict";const n=r(492),i=r(1013),o=r(1015);t=e.exports,t.aes=i,t.hmac=n,t.keys=o,t.randomBytes=r(497),t.pbkdf2=r(1026)},function(e,t,r){"use strict";e.exports={SHA1:20,SHA256:32,SHA512:64}},function(e,t,r){"use strict";const n=r(1014),i={16:"aes-128-ctr",32:"aes-256-ctr"};t.create=function(e,t,r){const o=i[e.length];if(!o)return r(new Error("Invalid key length"));const s=n.createCipheriv(o,e,t),a=n.createDecipheriv(o,e,t),u={encrypt(e,t){t(null,s.update(e))},decrypt(e,t){t(null,a.update(e))}};r(null,u)}},function(e,t,r){"use strict";const n=r(70);e.exports={createCipheriv:n.createCipheriv,createDecipheriv:n.createDecipheriv}},function(e,t,r){"use strict";(function(n){const i=r(12),o=i(r(280)),s=r(19);t=e.exports;const a={rsa:r(1016),ed25519:r(1021),secp256k1:r(72)(o,r(497))};function u(e){const t=a[e.toLowerCase()];return void 0!==t}t.supportedKeys=a,t.keysPBM=o,t.keyStretcher=r(1023),t.generateEphemeralKeyPair=r(1024),t.generateKeyPair=((e,t,r)=>{let n=a[e.toLowerCase()];if(!n)return r(new Error("invalid or unsupported key type"));n.generateKeyPair(t,r)}),t.generateKeyPairFromSeed=((e,t,r,n)=>{let i=a[e.toLowerCase()];return i?"ed25519"!==e.toLowerCase()?n(new Error("Seed key derivation is unimplemented for RSA or secp256k1")):void i.generateKeyPairFromSeed(t,r,n):n(new Error("invalid or unsupported key type"))}),t.unmarshalPublicKey=(e=>{const t=o.PublicKey.decode(e),r=t.Data;switch(t.Type){case o.KeyType.RSA:return a.rsa.unmarshalRsaPublicKey(r);case o.KeyType.Ed25519:return a.ed25519.unmarshalEd25519PublicKey(r);case o.KeyType.Secp256k1:if(a.secp256k1)return a.secp256k1.unmarshalSecp256k1PublicKey(r);throw new Error("secp256k1 support requires libp2p-crypto-secp256k1 package");default:throw new Error("invalid or unsupported key type")}}),t.marshalPublicKey=((e,t)=>{if(t=(t||"rsa").toLowerCase(),!u(t))throw new Error("invalid or unsupported key type");return e.bytes}),t.unmarshalPrivateKey=((e,t)=>{let r;try{r=o.PrivateKey.decode(e)}catch(e){return t(e)}const n=r.Data;switch(r.Type){case o.KeyType.RSA:return a.rsa.unmarshalRsaPrivateKey(n,t);case o.KeyType.Ed25519:return a.ed25519.unmarshalEd25519PrivateKey(n,t);case o.KeyType.Secp256k1:return a.secp256k1?a.secp256k1.unmarshalSecp256k1PrivateKey(n,t):t(new Error("secp256k1 support requires libp2p-crypto-secp256k1 package"));default:t(new Error("invalid or unsupported key type"))}}),t.marshalPrivateKey=((e,t)=>{if(t=(t||"rsa").toLowerCase(),!u(t))throw new Error("invalid or unsupported key type");return e.bytes}),t.import=((e,t,r)=>{try{const i=s.pki.decryptRsaPrivateKey(e,t);if(null===i)throw new Error("Cannot read the key, most likely the password is wrong or not a RSA key");let o=s.asn1.toDer(s.pki.privateKeyToAsn1(i));return o=n.from(o.getBytes(),"binary"),a.rsa.unmarshalRsaPrivateKey(o,r)}catch(e){r(e)}})}).call(this,r(0).Buffer)},function(e,t,r){"use strict";const n=r(493),i=r(12),o=r(18),s=r(495),a=i(r(280)),u=r(19),c=r(3);class f{constructor(e){this._key=e}verify(e,t,r){g(r),s.hashAndVerify(this._key,t,e,r)}marshal(){return s.utils.jwkToPkix(this._key)}get bytes(){return a.PublicKey.encode({Type:a.KeyType.RSA,Data:this.marshal()})}encrypt(e){return this._key.encrypt(e,"RSAES-PKCS1-V1_5")}equals(e){return this.bytes.equals(e.bytes)}hash(e){g(e),n(this.bytes,"sha2-256",e)}}class l{constructor(e,t){this._key=e,this._publicKey=t}genSecret(){return s.getRandomValues(new Uint8Array(16))}sign(e,t){g(t),s.hashAndSign(this._key,e,t)}get public(){if(!this._publicKey)throw new Error("public key not provided");return new f(this._publicKey)}decrypt(e,t){s.decrypt(this._key,e,t)}marshal(){return s.utils.jwkToPkcs1(this._key)}get bytes(){return a.PrivateKey.encode({Type:a.KeyType.RSA,Data:this.marshal()})}equals(e){return this.bytes.equals(e.bytes)}hash(e){g(e),n(this.bytes,"sha2-256",e)}id(e){this.public.hash((t,r)=>{if(t)return e(t);e(null,o.encode(r))})}export(e,t,r){"function"==typeof t&&(r=t,t=e,e="pkcs-8"),g(r),c(()=>{let n=null,i=null;try{const r=new u.util.ByteBuffer(this.marshal()),o=u.asn1.fromDer(r),s=u.pki.privateKeyFromAsn1(o);if("pkcs-8"===e){const e={algorithm:"aes256",count:1e4,saltSize:16,prfAlgorithm:"sha512"};i=u.pki.encryptRsaPrivateKey(s,t,e)}else n=new Error(`Unknown export format '${e}'`)}catch(e){n=e}r(n,i)})}}function h(e,t){const r=s.utils.pkcs1ToJwk(e);s.unmarshalPrivateKey(r,(e,r)=>{if(e)return t(e);t(null,new l(r.privateKey,r.publicKey))})}function p(e){const t=s.utils.pkixToJwk(e);return new f(t)}function d(e,t){s.unmarshalPrivateKey(e,(e,r)=>{if(e)return t(e);t(null,new l(r.privateKey,r.publicKey))})}function y(e,t){s.generateKey(e,(e,r)=>{if(e)return t(e);t(null,new l(r.privateKey,r.publicKey))})}function g(e){if("function"!=typeof e)throw new Error("callback is required")}e.exports={RsaPublicKey:f,RsaPrivateKey:l,unmarshalRsaPublicKey:p,unmarshalRsaPrivateKey:h,generateKeyPair:y,fromJwk:d}},function(e,t,r){"use strict";(function(t){const n=r(48),i=r(49),o=r(494),s=r(1018),a=o.toCallback,u=o.toBuf,c=o.fromString,f=o.fromNumberTo32BitBuf,l=(e,r)=>{s.sha2256(e,(e,n)=>{e&&r(e),s.sha2256(t.from(n),r)})};e.exports={sha1:s.sha1,sha2256:s.sha2256,sha2512:s.sha2512,sha3512:a(u(n.sha3_512)),sha3384:a(u(n.sha3_384)),sha3256:a(u(n.sha3_256)),sha3224:a(u(n.sha3_224)),shake128:a(u(n.shake_128,256)),shake256:a(u(n.shake_256,512)),keccak224:a(u(n.keccak_224)),keccak256:a(u(n.keccak_256)),keccak384:a(u(n.keccak_384)),keccak512:a(u(n.keccak_512)),murmur3128:a(u(c(i.x64.hash128))),murmur332:a(f(c(i.x86.hash32))),addBlake:r(1019),dblSha2256:l}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(t){const n=r(50),i=o();function o(){return self.crypto?self.crypto.subtle||self.crypto.webkitSubtle:self.msCrypto?self.msCrypto.subtle:void 0}function s(e){if(!i)throw new Error("Please use a browser with webcrypto support");return(r,o)=>{const s=i.digest({name:e},r);if("function"!=typeof s.then)return s.onerror=(()=>{o(new Error(`hashing data using ${e}`))}),void(s.oncomplete=(e=>{o(null,e.target.result)}));n(s.then(e=>t.from(new Uint8Array(e))),o)}}function a(e,t){s("SHA-1")(e,t)}function u(e,t){s("SHA-256")(e,t)}function c(e,t){s("SHA-512")(e,t)}e.exports={sha1:a,sha2256:u,sha2512:c}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(t){const n=r(51),i=r(494).toCallback,o=45569,s=45633,a={init:n.blake2bInit,update:n.blake2bUpdate,digest:n.blake2bFinal},u={init:n.blake2sInit,update:n.blake2sUpdate,digest:n.blake2sFinal},c=(e,r)=>i(n=>{const i=r.init(e,null);return r.update(i,n),t.from(r.digest(i))});e.exports=(e=>{for(let t=0;t<64;t++)e[o+t]=c(t+1,a);for(let t=0;t<32;t++)e[s+t]=c(t+1,u)})}).call(this,r(0).Buffer)},function(e,t,r){"use strict";const n=r(17),i=r(496),o=i.toBase64,s=i.toBn,a=n.define("RSAPrivateKey",function(){this.seq().obj(this.key("version").int(),this.key("modulus").int(),this.key("publicExponent").int(),this.key("privateExponent").int(),this.key("prime1").int(),this.key("prime2").int(),this.key("exponent1").int(),this.key("exponent2").int(),this.key("coefficient").int())}),u=n.define("AlgorithmIdentifier",function(){this.seq().obj(this.key("algorithm").objid({"1.2.840.113549.1.1.1":"rsa"}),this.key("none").optional().null_(),this.key("curve").optional().objid(),this.key("params").optional().seq().obj(this.key("p").int(),this.key("q").int(),this.key("g").int()))}),c=n.define("RSAPublicKey",function(){this.seq().obj(this.key("algorithm").use(u),this.key("subjectPublicKey").bitstr())}),f=n.define("RSAPublicKey",function(){this.seq().obj(this.key("modulus").int(),this.key("publicExponent").int())});t.pkcs1ToJwk=function(e){const t=a.decode(e,"der");return{kty:"RSA",n:o(t.modulus),e:o(t.publicExponent),d:o(t.privateExponent),p:o(t.prime1),q:o(t.prime2),dp:o(t.exponent1),dq:o(t.exponent2),qi:o(t.coefficient),alg:"RS256",kid:"2011-04-29"}},t.jwkToPkcs1=function(e){return a.encode({version:0,modulus:s(e.n),publicExponent:s(e.e),privateExponent:s(e.d),prime1:s(e.p),prime2:s(e.q),exponent1:s(e.dp),exponent2:s(e.dq),coefficient:s(e.qi)},"der")},t.pkixToJwk=function(e){const t=c.decode(e,"der"),r=f.decode(t.subjectPublicKey.data,"der");return{kty:"RSA",n:o(r.modulus),e:o(r.publicExponent),alg:"RS256",kid:"2011-04-29"}},t.jwkToPkix=function(e){return c.encode({algorithm:{algorithm:"rsa",none:null},subjectPublicKey:{data:f.encode({modulus:s(e.n),publicExponent:s(e.e)},"der")}},"der")}},function(e,t,r){"use strict";(function(t){const n=r(493),i=r(12),o=r(18),s=r(1022),a=i(r(280));class u{constructor(e){this._key=y(e,s.publicKeyLength)}verify(e,t,r){d(r),s.hashAndVerify(this._key,t,e,r)}marshal(){return t.from(this._key)}get bytes(){return a.PublicKey.encode({Type:a.KeyType.Ed25519,Data:this.marshal()})}equals(e){return this.bytes.equals(e.bytes)}hash(e){d(e),n(this.bytes,"sha2-256",e)}}class c{constructor(e,t){this._key=y(e,s.privateKeyLength),this._publicKey=y(t,s.publicKeyLength)}sign(e,t){d(t),s.hashAndSign(this._key,e,t)}get public(){if(!this._publicKey)throw new Error("public key not provided");return new u(this._publicKey)}marshal(){return t.concat([t.from(this._key),t.from(this._publicKey)])}get bytes(){return a.PrivateKey.encode({Type:a.KeyType.Ed25519,Data:this.marshal()})}equals(e){return this.bytes.equals(e.bytes)}hash(e){d(e),n(this.bytes,"sha2-256",e)}id(e){this.public.hash((t,r)=>{if(t)return e(t);e(null,o.encode(r))})}}function f(e,t){try{e=y(e,s.privateKeyLength+s.publicKeyLength)}catch(e){return t(e)}const r=e.slice(0,s.privateKeyLength),n=e.slice(s.privateKeyLength,e.length);t(null,new c(r,n))}function l(e){return e=y(e,s.publicKeyLength),new u(e)}function h(e,t){void 0===t&&"function"==typeof e&&(t=e),s.generateKey((e,r)=>{if(e)return t(e);let n;try{n=new c(r.secretKey,r.publicKey)}catch(e){return void t(e)}t(null,n)})}function p(e,t,r){void 0===r&&"function"==typeof t&&(r=t),s.generateKeyFromSeed(e,(e,t)=>{if(e)return r(e);let n;try{n=new c(t.secretKey,t.publicKey)}catch(e){return void r(e)}r(null,n)})}function d(e){if("function"!=typeof e)throw new Error("callback is required")}function y(e,r){if(t.isBuffer(e)&&(e=new Uint8Array(e)),!(e instanceof Uint8Array)||e.length!==r)throw new Error("Key must be a Uint8Array or Buffer of length "+r);return e}e.exports={Ed25519PublicKey:u,Ed25519PrivateKey:c,unmarshalEd25519PrivateKey:f,unmarshalEd25519PublicKey:l,generateKeyPair:h,generateKeyPairFromSeed:p}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(e){const n=r(71),i=r(3);t.publicKeyLength=n.sign.publicKeyLength,t.privateKeyLength=n.sign.secretKeyLength,t.generateKey=function(e){i(()=>{let t;try{t=n.sign.keyPair()}catch(t){return e(t)}e(null,t)})},t.generateKeyFromSeed=function(e,t){i(()=>{let r;try{r=n.sign.keyPair.fromSeed(e)}catch(e){return t(e)}t(null,r)})},t.hashAndSign=function(t,r,o){i(()=>{o(null,e.from(n.sign.detached(r,t)))})},t.hashAndVerify=function(e,t,r,o){i(()=>{let i;try{i=n.sign.detached.verify(r,t,e)}catch(e){return o(e)}o(null,i)})}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(t){const n=r(47),i=r(492),o={"AES-128":{ivSize:16,keySize:16},"AES-256":{ivSize:16,keySize:32},Blowfish:{ivSize:8,cipherKeySize:32}};e.exports=((e,r,s,a)=>{const u=o[e];if(!u)return a(new Error("unkown cipherType passed"));if(!r)return a(new Error("unkown hashType passed"));const c=u.keySize,f=u.ivSize,l=20,h=t.from("key expansion"),p=2*(f+c+20);i.create(r,s,(e,r)=>{if(e)return a(e);r.digest(h,(e,i)=>{if(e)return a(e);let o=[],s=0;function u(e){r.digest(t.concat([i,h]),(t,n)=>{if(t)return e(t);let a=n.length;s+a>p&&(a=p-s),o.push(n),s+=a,r.digest(i,(t,r)=>{if(t)return e(t);i=r,e()})})}function l(e){if(e)return a(e);const r=p/2,n=t.concat(o),i=n.slice(0,r),s=n.slice(r,p),u=e=>({iv:e.slice(0,f),cipherKey:e.slice(f,f+c),macKey:e.slice(f+c)});a(null,{k1:u(i),k2:u(s)})}n(()=>s<p,u,l)})})})}).call(this,r(0).Buffer)},function(e,t,r){"use strict";const n=r(1025);e.exports=((e,t)=>{n.generateEphmeralKeyPair(e,t)})},function(e,t,r){"use strict";(function(e){const n=r(279)(),i=r(278),o=r(17).bignum,s=r(496),a=s.toBase64,u=s.toBn,c={"P-256":256,"P-384":384,"P-521":521};t.generateEphmeralKeyPair=function(t,r){i(n.subtle.generateKey({name:"ECDH",namedCurve:t},!0,["deriveBits"]).then(r=>{const o=(o,s,a)=>{let u;"function"==typeof s&&(a=s,s=void 0),u=s?n.subtle.importKey("jwk",p(t,s),{name:"ECDH",namedCurve:t},!1,["deriveBits"]):Promise.resolve(r.privateKey);const f=Promise.all([n.subtle.importKey("jwk",h(t,o),{name:"ECDH",namedCurve:t},!1,[]),u]);i(f.then(e=>n.subtle.deriveBits({name:"ECDH",namedCurve:t,public:e[0]},e[1],c[t])).then(t=>e.from(t)),a)};return n.subtle.exportKey("jwk",r.publicKey).then(e=>({key:l(e),genSharedKey:o}))}),r)};const f={"P-256":32,"P-384":48,"P-521":66};function l(t){const r=f[t.crv];return e.concat([e.from([4]),u(t.x).toArrayLike(e,"be",r),u(t.y).toArrayLike(e,"be",r)],1+2*r)}function h(t,r){const n=f[t];if(!r.slice(0,1).equals(e.from([4])))throw new Error("Invalid key format");const i=new o(r.slice(1,n+1)),s=new o(r.slice(1+n));return{kty:"EC",crv:t,x:a(i,n),y:a(s,n),ext:!0}}function p(e,t){const r=h(e,t.public);return r.d=a(new o(t.private)),r}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";const n=r(19),i={sha1:"sha1","sha2-256":"sha256","sha2-512":"sha512"};function o(e,t,r,o,s){const a=i[s];if(!a)throw new Error(`Hash '${s}' is unknown or not supported`);const u=n.pkcs5.pbkdf2(e,t,r,o,a);return n.util.encode64(u)}e.exports=o},function(e,t,r){"use strict";(function(t){const n=r(1028),i=r(19),o=r(1029);class s{constructor(e){if(!e)throw new Error("keychain is required");this.keychain=e}encrypt(e,r,s){const a=this,u=(e,t)=>n.setImmediate(()=>s(e,t));if(!t.isBuffer(r))return u(new Error("Plain data must be a Buffer"));n.series([t=>a.keychain.findKeyByName(e,t),t=>a.keychain._getPrivateKey(e,t)],(e,n)=>{if(e)return u(e);let c=n[0],f=n[1];try{const n=i.pki.decryptRsaPrivateKey(f,a.keychain._());o.certificateForKey(c,n,(e,n)=>{if(e)return s(e);const o=i.pkcs7.createEnvelopedData();o.addRecipient(n),o.content=i.util.createBuffer(r),o.encrypt();const a=i.asn1.toDer(o.toAsn1()).getBytes();u(null,t.from(a,"binary"))})}catch(e){u(e)}})}decrypt(e,r){const o=(e,t)=>n.setImmediate(()=>r(e,t));if(!t.isBuffer(e))return o(new Error("CMS data is required"));const s=this;let a;try{const t=i.util.createBuffer(e.toString("binary")),r=i.asn1.fromDer(t);a=i.pkcs7.messageFromAsn1(r)}catch(e){return o(new Error("Invalid CMS: "+e.message))}const u=a.recipients.filter(e=>e.issuer.find(e=>"O"===e.shortName&&"ipfs"===e.value)).filter(e=>e.issuer.find(e=>"CN"===e.shortName)).map(e=>({recipient:e,keyId:e.issuer.find(e=>"CN"===e.shortName).value}));n.detect(u,(e,t)=>s.keychain.findKeyById(e.keyId,(e,r)=>t(null,!e&&r)),(e,r)=>{if(e)return o(e);if(!r){const t=u.map(e=>e.keyId);return e=new Error("Decryption needs one of the key(s): "+t.join(", ")),e.missingKeys=t,o(e)}n.waterfall([e=>s.keychain.findKeyById(r.keyId,e),(e,t)=>s.keychain._getPrivateKey(e.name,t)],(e,n)=>{if(e)return o(e);const u=i.pki.decryptRsaPrivateKey(n,s.keychain._());a.decrypt(r.recipient,u),o(null,t.from(a.content.getBytes(),"binary"))})})}}e.exports=s}).call(this,r(0).Buffer)},function(e,t,r){(function(e,r,n){!function(e,r){r(t)}(this,function(t){"use strict";function i(e,t){t|=0;for(var r=Math.max(e.length-t,0),n=Array(r),i=0;i<r;i++)n[i]=e[t+i];return n}var o=function(e){var t=i(arguments,1);return function(){var r=i(arguments);return e.apply(null,t.concat(r))}},s=function(e){return function(){var t=i(arguments),r=t.pop();e.call(this,t,r)}};function a(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}var u="function"==typeof setImmediate&&setImmediate,c="object"==typeof e&&"function"==typeof e.nextTick,f;function l(e){setTimeout(e,0)}function h(e){return function(t){var r=i(arguments,1);e(function(){t.apply(null,r)})}}f=u?setImmediate:c?e.nextTick:l;var p=h(f);function d(e){return s(function(t,r){var n;try{n=e.apply(this,t)}catch(e){return r(e)}a(n)&&"function"==typeof n.then?n.then(function(e){y(r,null,e)},function(e){y(r,e.message?e:new Error(e))}):r(null,n)})}function y(e,t,r){try{e(t,r)}catch(e){p(g,e)}}function g(e){throw e}var m="function"==typeof Symbol;function b(e){return m&&"AsyncFunction"===e[Symbol.toStringTag]}function v(e){return b(e)?d(e):e}function _(e){return function(t){var r=i(arguments,1),n=s(function(r,n){var i=this;return e(t,function(e,t){v(e).apply(i,r.concat(t))},n)});return r.length?n.apply(this,r):n}}var w="object"==typeof r&&r&&r.Object===Object&&r,S="object"==typeof self&&self&&self.Object===Object&&self,k=w||S||Function("return this")(),E=k.Symbol,A=Object.prototype,x=A.hasOwnProperty,I=A.toString,T=E?E.toStringTag:void 0;function B(e){var t=x.call(e,T),r=e[T];try{e[T]=void 0;var n=!0}catch(e){}var i=I.call(e);return n&&(t?e[T]=r:delete e[T]),i}var C=Object.prototype,P=C.toString;function O(e){return P.call(e)}var R="[object Null]",N="[object Undefined]",L=E?E.toStringTag:void 0;function j(e){return null==e?void 0===e?N:R:L&&L in Object(e)?B(e):O(e)}var M="[object AsyncFunction]",K="[object Function]",D="[object GeneratorFunction]",U="[object Proxy]";function F(e){if(!a(e))return!1;var t=j(e);return t==K||t==D||t==M||t==U}var q=9007199254740991;function H(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=q}function z(e){return null!=e&&H(e.length)&&!F(e)}var V={};function G(){}function W(e){return function(){if(null!==e){var t=e;e=null,t.apply(this,arguments)}}}var $="function"==typeof Symbol&&Symbol.iterator,Y=function(e){return $&&e[$]&&e[$]()};function J(e,t){for(var r=-1,n=Array(e);++r<e;)n[r]=t(r);return n}function X(e){return null!=e&&"object"==typeof e}var Z="[object Arguments]";function Q(e){return X(e)&&j(e)==Z}var ee=Object.prototype,te=ee.hasOwnProperty,re=ee.propertyIsEnumerable,ne=Q(function(){return arguments}())?Q:function(e){return X(e)&&te.call(e,"callee")&&!re.call(e,"callee")},ie=Array.isArray;function oe(){return!1}var se="object"==typeof t&&t&&!t.nodeType&&t,ae=se&&"object"==typeof n&&n&&!n.nodeType&&n,ue=ae&&ae.exports===se,ce=ue?k.Buffer:void 0,fe=ce?ce.isBuffer:void 0,le=fe||oe,he=9007199254740991,pe=/^(?:0|[1-9]\d*)$/;function de(e,t){var r=typeof e;return t=null==t?he:t,!!t&&("number"==r||"symbol"!=r&&pe.test(e))&&e>-1&&e%1==0&&e<t}var ye="[object Arguments]",ge="[object Array]",me="[object Boolean]",be="[object Date]",ve="[object Error]",_e="[object Function]",we="[object Map]",Se="[object Number]",ke="[object Object]",Ee="[object RegExp]",Ae="[object Set]",xe="[object String]",Ie="[object WeakMap]",Te="[object ArrayBuffer]",Be="[object DataView]",Ce="[object Float32Array]",Pe="[object Float64Array]",Oe="[object Int8Array]",Re="[object Int16Array]",Ne="[object Int32Array]",Le="[object Uint8Array]",je="[object Uint8ClampedArray]",Me="[object Uint16Array]",Ke="[object Uint32Array]",De={};function Ue(e){return X(e)&&H(e.length)&&!!De[j(e)]}function Fe(e){return function(t){return e(t)}}De[Ce]=De[Pe]=De[Oe]=De[Re]=De[Ne]=De[Le]=De[je]=De[Me]=De[Ke]=!0,De[ye]=De[ge]=De[Te]=De[me]=De[Be]=De[be]=De[ve]=De[_e]=De[we]=De[Se]=De[ke]=De[Ee]=De[Ae]=De[xe]=De[Ie]=!1;var qe="object"==typeof t&&t&&!t.nodeType&&t,He=qe&&"object"==typeof n&&n&&!n.nodeType&&n,ze=He&&He.exports===qe,Ve=ze&&w.process,Ge=function(){try{var e=He&&He.require&&He.require("util").types;return e||Ve&&Ve.binding&&Ve.binding("util")}catch(e){}}(),We=Ge&&Ge.isTypedArray,$e=We?Fe(We):Ue,Ye=Object.prototype,Je=Ye.hasOwnProperty;function Xe(e,t){var r=ie(e),n=!r&&ne(e),i=!r&&!n&&le(e),o=!r&&!n&&!i&&$e(e),s=r||n||i||o,a=s?J(e.length,String):[],u=a.length;for(var c in e)!t&&!Je.call(e,c)||s&&("length"==c||i&&("offset"==c||"parent"==c)||o&&("buffer"==c||"byteLength"==c||"byteOffset"==c)||de(c,u))||a.push(c);return a}var Ze=Object.prototype;function Qe(e){var t=e&&e.constructor,r="function"==typeof t&&t.prototype||Ze;return e===r}function et(e,t){return function(r){return e(t(r))}}var tt=et(Object.keys,Object),rt=Object.prototype,nt=rt.hasOwnProperty;function it(e){if(!Qe(e))return tt(e);var t=[];for(var r in Object(e))nt.call(e,r)&&"constructor"!=r&&t.push(r);return t}function ot(e){return z(e)?Xe(e):it(e)}function st(e){var t=-1,r=e.length;return function n(){return++t<r?{value:e[t],key:t}:null}}function at(e){var t=-1;return function r(){var n=e.next();return n.done?null:(t++,{value:n.value,key:t})}}function ut(e){var t=ot(e),r=-1,n=t.length;return function i(){var o=t[++r];return r<n?{value:e[o],key:o}:null}}function ct(e){if(z(e))return st(e);var t=Y(e);return t?at(t):ut(e)}function ft(e){return function(){if(null===e)throw new Error("Callback was already called.");var t=e;e=null,t.apply(this,arguments)}}function lt(e){return function(t,r,n){if(n=W(n||G),e<=0||!t)return n(null);var i=ct(t),o=!1,s=0,a=!1;function u(e,t){if(s-=1,e)o=!0,n(e);else{if(t===V||o&&s<=0)return o=!0,n(null);a||c()}}function c(){for(a=!0;s<e&&!o;){var t=i();if(null===t)return o=!0,void(s<=0&&n(null));s+=1,r(t.value,t.key,ft(u))}a=!1}c()}}function ht(e,t,r,n){lt(t)(e,v(r),n)}function pt(e,t){return function(r,n,i){return e(r,t,n,i)}}function dt(e,t,r){r=W(r||G);var n=0,i=0,o=e.length;function s(e,t){e?r(e):++i!==o&&t!==V||r(null)}for(0===o&&r(null);n<o;n++)t(e[n],n,ft(s))}var yt=pt(ht,1/0),gt=function(e,t,r){var n=z(e)?dt:yt;n(e,v(t),r)};function mt(e){return function(t,r,n){return e(gt,t,v(r),n)}}function bt(e,t,r,n){n=n||G,t=t||[];var i=[],o=0,s=v(r);e(t,function(e,t,r){var n=o++;s(e,function(e,t){i[n]=t,r(e)})},function(e){n(e,i)})}var vt=mt(bt),_t=_(vt);function wt(e){return function(t,r,n,i){return e(lt(r),t,v(n),i)}}var St=wt(bt),kt=pt(St,1),Et=_(kt);function At(e,t){for(var r=-1,n=null==e?0:e.length;++r<n&&!1!==t(e[r],r,e););return e}function xt(e){return function(t,r,n){for(var i=-1,o=Object(t),s=n(t),a=s.length;a--;){var u=s[e?a:++i];if(!1===r(o[u],u,o))break}return t}}var It=xt();function Tt(e,t){return e&&It(e,t,ot)}function Bt(e,t,r,n){for(var i=e.length,o=r+(n?1:-1);n?o--:++o<i;)if(t(e[o],o,e))return o;return-1}function Ct(e){return e!=e}function Pt(e,t,r){for(var n=r-1,i=e.length;++n<i;)if(e[n]===t)return n;return-1}function Ot(e,t,r){return t==t?Pt(e,t,r):Bt(e,Ct,r)}var Rt=function(e,t,r){"function"==typeof t&&(r=t,t=null),r=W(r||G);var n=ot(e),o=n.length;if(!o)return r(null);t||(t=o);var s={},a=0,u=!1,c=Object.create(null),f=[],l=[],h={};function p(e,t){f.push(function(){m(e,t)})}function d(){if(0===f.length&&0===a)return r(null,s);for(;f.length&&a<t;){var e=f.shift();e()}}function y(e,t){var r=c[e];r||(r=c[e]=[]),r.push(t)}function g(e){var t=c[e]||[];At(t,function(e){e()}),d()}function m(e,t){if(!u){var n=ft(function(t,n){if(a--,arguments.length>2&&(n=i(arguments,1)),t){var o={};Tt(s,function(e,t){o[t]=e}),o[e]=n,u=!0,c=Object.create(null),r(t,o)}else s[e]=n,g(e)});a++;var o=v(t[t.length-1]);t.length>1?o(s,n):o(n)}}function b(){for(var e,t=0;l.length;)e=l.pop(),t++,At(_(e),function(e){0==--h[e]&&l.push(e)});if(t!==o)throw new Error("async.auto cannot execute tasks due to a recursive dependency")}function _(t){var r=[];return Tt(e,function(e,n){ie(e)&&Ot(e,t,0)>=0&&r.push(n)}),r}Tt(e,function(t,r){if(!ie(t))return p(r,[t]),void l.push(r);var n=t.slice(0,t.length-1),i=n.length;if(0===i)return p(r,t),void l.push(r);h[r]=i,At(n,function(o){if(!e[o])throw new Error("async.auto task `"+r+"` has a non-existent dependency `"+o+"` in "+n.join(", "));y(o,function(){i--,0===i&&p(r,t)})})}),b(),d()};function Nt(e,t){for(var r=-1,n=null==e?0:e.length,i=Array(n);++r<n;)i[r]=t(e[r],r,e);return i}var Lt="[object Symbol]";function jt(e){return"symbol"==typeof e||X(e)&&j(e)==Lt}var Mt=1/0,Kt=E?E.prototype:void 0,Dt=Kt?Kt.toString:void 0;function Ut(e){if("string"==typeof e)return e;if(ie(e))return Nt(e,Ut)+"";if(jt(e))return Dt?Dt.call(e):"";var t=e+"";return"0"==t&&1/e==-Mt?"-0":t}function Ft(e,t,r){var n=-1,i=e.length;t<0&&(t=-t>i?0:i+t),r=r>i?i:r,r<0&&(r+=i),i=t>r?0:r-t>>>0,t>>>=0;for(var o=Array(i);++n<i;)o[n]=e[n+t];return o}function qt(e,t,r){var n=e.length;return r=void 0===r?n:r,!t&&r>=n?e:Ft(e,t,r)}function Ht(e,t){for(var r=e.length;r--&&Ot(t,e[r],0)>-1;);return r}function zt(e,t){for(var r=-1,n=e.length;++r<n&&Ot(t,e[r],0)>-1;);return r}function Vt(e){return e.split("")}var Gt="\\ud800-\\udfff",Wt="\\u0300-\\u036f",$t="\\ufe20-\\ufe2f",Yt="\\u20d0-\\u20ff",Jt="\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff",Xt="\\ufe0e\\ufe0f",Zt="\\u200d",Qt=RegExp("["+Zt+Gt+Jt+Xt+"]");function er(e){return Qt.test(e)}var tr="\\ud800-\\udfff",rr="\\u0300-\\u036f",nr="\\ufe20-\\ufe2f",ir="\\u20d0-\\u20ff",or="\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff",sr="\\ufe0e\\ufe0f",ar="[\\ud800-\\udfff]",ur="["+or+"]",cr="\\ud83c[\\udffb-\\udfff]",fr="(?:"+ur+"|"+cr+")",lr="[^\\ud800-\\udfff]",hr="(?:\\ud83c[\\udde6-\\uddff]){2}",pr="[\\ud800-\\udbff][\\udc00-\\udfff]",dr="\\u200d",yr=fr+"?",gr="[\\ufe0e\\ufe0f]?",mr="(?:\\u200d(?:"+[lr,hr,pr].join("|")+")"+gr+yr+")*",br=gr+yr+mr,vr="(?:"+[lr+ur+"?",ur,hr,pr,ar].join("|")+")",_r=RegExp(cr+"(?="+cr+")|"+vr+br,"g");function wr(e){return e.match(_r)||[]}function Sr(e){return er(e)?wr(e):Vt(e)}function kr(e){return null==e?"":Ut(e)}var Er=/^\s+|\s+$/g;function Ar(e,t,r){if(e=kr(e),e&&(r||void 0===t))return e.replace(Er,"");if(!e||!(t=Ut(t)))return e;var n=Sr(e),i=Sr(t),o=zt(n,i),s=Ht(n,i)+1;return qt(n,o,s).join("")}var xr=/^(?:async\s+)?(function)?\s*[^\(]*\(\s*([^\)]*)\)/m,Ir=/,/,Tr=/(=.+)?(\s*)$/,Br=/((\/\/.*$)|(\/\*[\s\S]*?\*\/))/gm;function Cr(e){return e=e.toString().replace(Br,""),e=e.match(xr)[2].replace(" ",""),e=e?e.split(Ir):[],e=e.map(function(e){return Ar(e.replace(Tr,""))}),e}function Pr(e,t){var r={};Tt(e,function(e,t){var n,i=b(e),o=!i&&1===e.length||i&&0===e.length;if(ie(e))n=e.slice(0,-1),e=e[e.length-1],r[t]=n.concat(n.length>0?s:e);else if(o)r[t]=e;else{if(n=Cr(e),0===e.length&&!i&&0===n.length)throw new Error("autoInject task functions require explicit parameters.");i||n.pop(),r[t]=n.concat(s)}function s(t,r){var i=Nt(n,function(e){return t[e]});i.push(r),v(e).apply(null,i)}}),Rt(r,t)}function Or(){this.head=this.tail=null,this.length=0}function Rr(e,t){e.length=1,e.head=e.tail=t}function Nr(e,t,r){if(null==t)t=1;else if(0===t)throw new Error("Concurrency must not be zero");var n=v(e),i=0,o=[],s=!1;function a(e,t,r){if(null!=r&&"function"!=typeof r)throw new Error("task callback must be a function");if(f.started=!0,ie(e)||(e=[e]),0===e.length&&f.idle())return p(function(){f.drain()});for(var n=0,i=e.length;n<i;n++){var o={data:e[n],callback:r||G};t?f._tasks.unshift(o):f._tasks.push(o)}s||(s=!0,p(function(){s=!1,f.process()}))}function u(e){return function(t){i-=1;for(var r=0,n=e.length;r<n;r++){var s=e[r],a=Ot(o,s,0);0===a?o.shift():a>0&&o.splice(a,1),s.callback.apply(s,arguments),null!=t&&f.error(t,s.data)}i<=f.concurrency-f.buffer&&f.unsaturated(),f.idle()&&f.drain(),f.process()}}var c=!1,f={_tasks:new Or,concurrency:t,payload:r,saturated:G,unsaturated:G,buffer:t/4,empty:G,drain:G,error:G,started:!1,paused:!1,push:function(e,t){a(e,!1,t)},kill:function(){f.drain=G,f._tasks.empty()},unshift:function(e,t){a(e,!0,t)},remove:function(e){f._tasks.remove(e)},process:function(){if(!c){for(c=!0;!f.paused&&i<f.concurrency&&f._tasks.length;){var e=[],t=[],r=f._tasks.length;f.payload&&(r=Math.min(r,f.payload));for(var s=0;s<r;s++){var a=f._tasks.shift();e.push(a),o.push(a),t.push(a.data)}i+=1,0===f._tasks.length&&f.empty(),i===f.concurrency&&f.saturated();var l=ft(u(e));n(t,l)}c=!1}},length:function(){return f._tasks.length},running:function(){return i},workersList:function(){return o},idle:function(){return f._tasks.length+i===0},pause:function(){f.paused=!0},resume:function(){!1!==f.paused&&(f.paused=!1,p(f.process))}};return f}function Lr(e,t){return Nr(e,1,t)}Or.prototype.removeLink=function(e){return e.prev?e.prev.next=e.next:this.head=e.next,e.next?e.next.prev=e.prev:this.tail=e.prev,e.prev=e.next=null,this.length-=1,e},Or.prototype.empty=function(){for(;this.head;)this.shift();return this},Or.prototype.insertAfter=function(e,t){t.prev=e,t.next=e.next,e.next?e.next.prev=t:this.tail=t,e.next=t,this.length+=1},Or.prototype.insertBefore=function(e,t){t.prev=e.prev,t.next=e,e.prev?e.prev.next=t:this.head=t,e.prev=t,this.length+=1},Or.prototype.unshift=function(e){this.head?this.insertBefore(this.head,e):Rr(this,e)},Or.prototype.push=function(e){this.tail?this.insertAfter(this.tail,e):Rr(this,e)},Or.prototype.shift=function(){return this.head&&this.removeLink(this.head)},Or.prototype.pop=function(){return this.tail&&this.removeLink(this.tail)},Or.prototype.toArray=function(){for(var e=Array(this.length),t=this.head,r=0;r<this.length;r++)e[r]=t.data,t=t.next;return e},Or.prototype.remove=function(e){for(var t=this.head;t;){var r=t.next;e(t)&&this.removeLink(t),t=r}return this};var jr=pt(ht,1);function Mr(e,t,r,n){n=W(n||G);var i=v(r);jr(e,function(e,r,n){i(t,e,function(e,r){t=r,n(e)})},function(e){n(e,t)})}function Kr(){var e=Nt(arguments,v);return function(){var t=i(arguments),r=this,n=t[t.length-1];"function"==typeof n?t.pop():n=G,Mr(e,t,function(e,t,n){t.apply(r,e.concat(function(e){var t=i(arguments,1);n(e,t)}))},function(e,t){n.apply(r,[e].concat(t))})}}var Dr=function(){return Kr.apply(null,i(arguments).reverse())},Ur=Array.prototype.concat,Fr=function(e,t,r,n){n=n||G;var o=v(r);St(e,t,function(e,t){o(e,function(e){return e?t(e):t(null,i(arguments,1))})},function(e,t){for(var r=[],i=0;i<t.length;i++)t[i]&&(r=Ur.apply(r,t[i]));return n(e,r)})},qr=pt(Fr,1/0),Hr=pt(Fr,1),zr=function(){var e=i(arguments),t=[null].concat(e);return function(){var e=arguments[arguments.length-1];return e.apply(this,t)}};function Vr(e){return e}function Gr(e,t){return function(r,n,i,o){o=o||G;var s=!1,a;r(n,function(r,n,o){i(r,function(n,i){n?o(n):e(i)&&!a?(s=!0,a=t(!0,r),o(null,V)):o()})},function(e){e?o(e):o(null,s?a:t(!1))})}}function Wr(e,t){return t}var $r=mt(Gr(Vr,Wr)),Yr=wt(Gr(Vr,Wr)),Jr=pt(Yr,1);function Xr(e){return function(t){var r=i(arguments,1);r.push(function(t){var r=i(arguments,1);"object"==typeof console&&(t?console.error&&console.error(t):console[e]&&At(r,function(t){console[e](t)}))}),v(t).apply(null,r)}}var Zr=Xr("dir");function Qr(e,t,r){r=ft(r||G);var n=v(e),o=v(t);function s(e){if(e)return r(e);var t=i(arguments,1);t.push(a),o.apply(this,t)}function a(e,t){return e?r(e):t?void n(s):r(null)}a(null,!0)}function en(e,t,r){r=ft(r||G);var n=v(e),o=function(e){if(e)return r(e);var s=i(arguments,1);if(t.apply(this,s))return n(o);r.apply(null,[null].concat(s))};n(o)}function tn(e,t,r){en(e,function(){return!t.apply(this,arguments)},r)}function rn(e,t,r){r=ft(r||G);var n=v(t),i=v(e);function o(e){if(e)return r(e);i(s)}function s(e,t){return e?r(e):t?void n(o):r(null)}i(s)}function nn(e){return function(t,r,n){return e(t,n)}}function on(e,t,r){gt(e,nn(v(t)),r)}function sn(e,t,r,n){lt(t)(e,nn(v(r)),n)}var an=pt(sn,1);function un(e){return b(e)?e:s(function(t,r){var n=!0;t.push(function(){var e=arguments;n?p(function(){r.apply(null,e)}):r.apply(null,e)}),e.apply(this,t),n=!1})}function cn(e){return!e}var fn=mt(Gr(cn,cn)),ln=wt(Gr(cn,cn)),hn=pt(ln,1);function pn(e){return function(t){return null==t?void 0:t[e]}}function dn(e,t,r,n){var i=new Array(t.length);e(t,function(e,t,n){r(e,function(e,r){i[t]=!!r,n(e)})},function(e){if(e)return n(e);for(var r=[],o=0;o<t.length;o++)i[o]&&r.push(t[o]);n(null,r)})}function yn(e,t,r,n){var i=[];e(t,function(e,t,n){r(e,function(r,o){r?n(r):(o&&i.push({index:t,value:e}),n())})},function(e){e?n(e):n(null,Nt(i.sort(function(e,t){return e.index-t.index}),pn("value")))})}function gn(e,t,r,n){var i=z(t)?dn:yn;i(e,t,v(r),n||G)}var mn=mt(gn),bn=wt(gn),vn=pt(bn,1);function _n(e,t){var r=ft(t||G),n=v(un(e));function i(e){if(e)return r(e);n(i)}i()}var wn=function(e,t,r,n){n=n||G;var i=v(r);St(e,t,function(e,t){i(e,function(r,n){return r?t(r):t(null,{key:n,val:e})})},function(e,t){for(var r={},i=Object.prototype.hasOwnProperty,o=0;o<t.length;o++)if(t[o]){var s=t[o].key,a=t[o].val;i.call(r,s)?r[s].push(a):r[s]=[a]}return n(e,r)})},Sn=pt(wn,1/0),kn=pt(wn,1),En=Xr("log");function An(e,t,r,n){n=W(n||G);var i={},o=v(r);ht(e,t,function(e,t,r){o(e,t,function(e,n){if(e)return r(e);i[t]=n,r()})},function(e){n(e,i)})}var xn=pt(An,1/0),In=pt(An,1),Tn;function Bn(e,t){return t in e}function Cn(e,t){var r=Object.create(null),n=Object.create(null);t=t||Vr;var o=v(e),a=s(function e(s,a){var u=t.apply(null,s);Bn(r,u)?p(function(){a.apply(null,r[u])}):Bn(n,u)?n[u].push(a):(n[u]=[a],o.apply(null,s.concat(function(){var e=i(arguments);r[u]=e;var t=n[u];delete n[u];for(var o=0,s=t.length;o<s;o++)t[o].apply(null,e)})))});return a.memo=r,a.unmemoized=e,a}Tn=c?e.nextTick:u?setImmediate:l;var Pn=h(Tn);function On(e,t,r){r=r||G;var n=z(t)?[]:{};e(t,function(e,t,r){v(e)(function(e,o){arguments.length>2&&(o=i(arguments,1)),n[t]=o,r(e)})},function(e){r(e,n)})}function Rn(e,t){On(gt,e,t)}function Nn(e,t,r){On(lt(t),e,r)}var Ln=function(e,t){var r=v(e);return Nr(function(e,t){r(e[0],t)},t,1)},jn=function(e,t){var r=Ln(e,t);return r.push=function(e,t,n){if(null==n&&(n=G),"function"!=typeof n)throw new Error("task callback must be a function");if(r.started=!0,ie(e)||(e=[e]),0===e.length)return p(function(){r.drain()});t=t||0;for(var i=r._tasks.head;i&&t>=i.priority;)i=i.next;for(var o=0,s=e.length;o<s;o++){var a={data:e[o],priority:t,callback:n};i?r._tasks.insertBefore(i,a):r._tasks.push(a)}p(r.process)},delete r.unshift,r};function Mn(e,t){if(t=W(t||G),!ie(e))return t(new TypeError("First argument to race must be an array of functions"));if(!e.length)return t();for(var r=0,n=e.length;r<n;r++)v(e[r])(t)}function Kn(e,t,r,n){var o=i(e).reverse();Mr(o,t,r,n)}function Dn(e){var t=v(e);return s(function e(r,n){return r.push(function e(t,r){var o;t?n(null,{error:t}):(o=arguments.length<=2?r:i(arguments,1),n(null,{value:o}))}),t.apply(this,r)})}function Un(e){var t;return ie(e)?t=Nt(e,Dn):(t={},Tt(e,function(e,r){t[r]=Dn.call(this,e)})),t}function Fn(e,t,r,n){gn(e,t,function(e,t){r(e,function(e,r){t(e,!r)})},n)}var qn=mt(Fn),Hn=wt(Fn),zn=pt(Hn,1);function Vn(e){return function(){return e}}function Gn(e,t,r){var n=5,i=0,o={times:n,intervalFunc:Vn(i)};function s(e,t){if("object"==typeof t)e.times=+t.times||n,e.intervalFunc="function"==typeof t.interval?t.interval:Vn(+t.interval||i),e.errorFilter=t.errorFilter;else{if("number"!=typeof t&&"string"!=typeof t)throw new Error("Invalid arguments for async.retry");e.times=+t||n}}if(arguments.length<3&&"function"==typeof e?(r=t||G,t=e):(s(o,e),r=r||G),"function"!=typeof t)throw new Error("Invalid arguments for async.retry");var a=v(t),u=1;function c(){a(function(e){e&&u++<o.times&&("function"!=typeof o.errorFilter||o.errorFilter(e))?setTimeout(c,o.intervalFunc(u)):r.apply(null,arguments)})}c()}var Wn=function(e,t){t||(t=e,e=null);var r=v(t);return s(function(t,n){function i(e){r.apply(null,t.concat(e))}e?Gn(e,i,n):Gn(i,n)})};function $n(e,t){On(jr,e,t)}var Yn=mt(Gr(Boolean,Vr)),Jn=wt(Gr(Boolean,Vr)),Xn=pt(Jn,1);function Zn(e,t,r){var n=v(t);function i(e,t){var r=e.criteria,n=t.criteria;return r<n?-1:r>n?1:0}vt(e,function(e,t){n(e,function(r,n){if(r)return t(r);t(null,{value:e,criteria:n})})},function(e,t){if(e)return r(e);r(null,Nt(t.sort(i),pn("value")))})}function Qn(e,t,r){var n=v(e);return s(function(i,o){var s=!1,a;function u(){var t=e.name||"anonymous",n=new Error('Callback function "'+t+'" timed out.');n.code="ETIMEDOUT",r&&(n.info=r),s=!0,o(n)}i.push(function(){s||(o.apply(null,arguments),clearTimeout(a))}),a=setTimeout(u,t),n.apply(null,i)})}var ei=Math.ceil,ti=Math.max;function ri(e,t,r,n){for(var i=-1,o=ti(ei((t-e)/(r||1)),0),s=Array(o);o--;)s[n?o:++i]=e,e+=r;return s}function ni(e,t,r,n){var i=v(r);St(ri(0,e,1),t,i,n)}var ii=pt(ni,1/0),oi=pt(ni,1);function si(e,t,r,n){arguments.length<=3&&(n=r,r=t,t=ie(e)?[]:{}),n=W(n||G);var i=v(r);gt(e,function(e,r,n){i(t,e,r,n)},function(e){n(e,t)})}function ai(e,t){var r=null,n;t=t||G,an(e,function(e,t){v(e)(function(e,o){n=arguments.length>2?i(arguments,1):o,r=e,t(!e)})},function(){t(r,n)})}function ui(e){return function(){return(e.unmemoized||e).apply(null,arguments)}}function ci(e,t,r){r=ft(r||G);var n=v(t);if(!e())return r(null);var o=function(t){if(t)return r(t);if(e())return n(o);var s=i(arguments,1);r.apply(null,[null].concat(s))};n(o)}function fi(e,t,r){ci(function(){return!e.apply(this,arguments)},t,r)}var li=function(e,t){if(t=W(t||G),!ie(e))return t(new Error("First argument to waterfall must be an array of functions"));if(!e.length)return t();var r=0;function n(t){var n=v(e[r++]);t.push(ft(o)),n.apply(null,t)}function o(o){if(o||r===e.length)return t.apply(null,arguments);n(i(arguments,1))}n([])},hi={apply:o,applyEach:_t,applyEachSeries:Et,asyncify:d,auto:Rt,autoInject:Pr,cargo:Lr,compose:Dr,concat:qr,concatLimit:Fr,concatSeries:Hr,constant:zr,detect:$r,detectLimit:Yr,detectSeries:Jr,dir:Zr,doDuring:Qr,doUntil:tn,doWhilst:en,during:rn,each:on,eachLimit:sn,eachOf:gt,eachOfLimit:ht,eachOfSeries:jr,eachSeries:an,ensureAsync:un,every:fn,everyLimit:ln,everySeries:hn,filter:mn,filterLimit:bn,filterSeries:vn,forever:_n,groupBy:Sn,groupByLimit:wn,groupBySeries:kn,log:En,map:vt,mapLimit:St,mapSeries:kt,mapValues:xn,mapValuesLimit:An,mapValuesSeries:In,memoize:Cn,nextTick:Pn,parallel:Rn,parallelLimit:Nn,priorityQueue:jn,queue:Ln,race:Mn,reduce:Mr,reduceRight:Kn,reflect:Dn,reflectAll:Un,reject:qn,rejectLimit:Hn,rejectSeries:zn,retry:Gn,retryable:Wn,seq:Kr,series:$n,setImmediate:p,some:Yn,someLimit:Jn,someSeries:Xn,sortBy:Zn,timeout:Qn,times:ii,timesLimit:ni,timesSeries:oi,transform:si,tryEach:ai,unmemoize:ui,until:fi,waterfall:li,whilst:ci,all:fn,allLimit:ln,allSeries:hn,any:Yn,anyLimit:Jn,anySeries:Xn,find:$r,findLimit:Yr,findSeries:Jr,forEach:on,forEachSeries:an,forEachLimit:sn,forEachOf:gt,forEachOfSeries:jr,forEachOfLimit:ht,inject:Mr,foldl:Mr,foldr:Kn,select:mn,selectLimit:bn,selectSeries:vn,wrapSync:d};t.default=hi,t.apply=o,t.applyEach=_t,t.applyEachSeries=Et,t.asyncify=d,t.auto=Rt,t.autoInject=Pr,t.cargo=Lr,t.compose=Dr,t.concat=qr,t.concatLimit=Fr,t.concatSeries=Hr,t.constant=zr,t.detect=$r,t.detectLimit=Yr,t.detectSeries=Jr,t.dir=Zr,t.doDuring=Qr,t.doUntil=tn,t.doWhilst=en,t.during=rn,t.each=on,t.eachLimit=sn,t.eachOf=gt,t.eachOfLimit=ht,t.eachOfSeries=jr,t.eachSeries=an,t.ensureAsync=un,t.every=fn,t.everyLimit=ln,t.everySeries=hn,t.filter=mn,t.filterLimit=bn,t.filterSeries=vn,t.forever=_n,t.groupBy=Sn,t.groupByLimit=wn,t.groupBySeries=kn,t.log=En,t.map=vt,t.mapLimit=St,t.mapSeries=kt,t.mapValues=xn,t.mapValuesLimit=An,t.mapValuesSeries=In,t.memoize=Cn,t.nextTick=Pn,t.parallel=Rn,t.parallelLimit=Nn,t.priorityQueue=jn,t.queue=Ln,t.race=Mn,t.reduce=Mr,t.reduceRight=Kn,t.reflect=Dn,t.reflectAll=Un,t.reject=qn,t.rejectLimit=Hn,t.rejectSeries=zn,t.retry=Gn,t.retryable=Wn,t.seq=Kr,t.series=$n,t.setImmediate=p,t.some=Yn,t.someLimit=Jn,t.someSeries=Xn,t.sortBy=Zn,t.timeout=Qn,t.times=ii,t.timesLimit=ni,t.timesSeries=oi,t.transform=si,t.tryEach=ai,t.unmemoize=ui,t.until=fi,t.waterfall=li,t.whilst=ci,t.all=fn,t.allLimit=ln,t.allSeries=hn,t.any=Yn,t.anyLimit=Jn,t.anySeries=Xn,t.find=$r,t.findLimit=Yr,t.findSeries=Jr,t.forEach=on,t.forEachSeries=an,t.forEachLimit=sn,t.forEachOf=gt,t.forEachOfSeries=jr,t.forEachOfLimit=ht,t.inject=Mr,t.foldl=Mr,t.foldr=Kn,t.select=mn,t.selectLimit=bn,t.selectSeries=vn,t.wrapSync=d,Object.defineProperty(t,"__esModule",{value:!0})})}).call(this,r(6),r(7),r(28)(e))},function(e,t,r){"use strict";const n=r(19),i=n.pki;t=e.exports,t.certificateForKey=((e,t,r)=>{const n=i.setRsaPublicKey(t.n,t.e),o=i.createCertificate();o.publicKey=n,o.serialNumber="01",o.validity.notBefore=new Date,o.validity.notAfter=new Date,o.validity.notAfter.setFullYear(o.validity.notBefore.getFullYear()+10);const s=[{name:"organizationName",value:"ipfs"},{shortName:"OU",value:"keystore"},{name:"commonName",value:e.id}];return o.setSubject(s),o.setIssuer(s),o.setExtensions([{name:"basicConstraints",cA:!0},{name:"keyUsage",keyCertSign:!0,digitalSignature:!0,nonRepudiation:!0,keyEncipherment:!0,dataEncipherment:!0},{name:"extKeyUsage",serverAuth:!0,clientAuth:!0,codeSigning:!0,emailProtection:!0,timeStamping:!0},{name:"nsCertType",client:!0,server:!0,email:!0,objsign:!0,sslCA:!0,emailCA:!0,objCA:!0}]),o.sign(t),r(null,o)})},function(e,t,r){"use strict";function n(){throw new Error("Key management requires '--pass ...' option")}class i{static get options(){n()}static generateOptions(){n()}createKey(){n()}listKeys(){n()}findKeyById(){n()}findKeyByName(){n()}renameKey(){n()}removeKey(){n()}exportKey(){n()}importKey(){n()}importPeer(){n()}get cms(){n()}}e.exports=i},function(e,t,r){"use strict";const n=r(37),i=r(1032),o=r(3),s=r(22);e.exports=(e=>s(t=>{const r=r=>{if(r)return o(()=>e.emit("error",r)),t(r);e.state.started(),o(()=>e.emit("start")),t()};if("stopped"!==e.state.state())return r(new Error(`Not able to start from state: ${e.state.state()}`));e.log("starting"),e.state.start(),n([t=>{e._repo.closed?e._repo.open(t):t()},t=>e.libp2p.start(t),t=>{e._bitswap=new i(e._libp2pNode,e._repo.blocks,{statsEnabled:!0}),e._bitswap.start(),e._blockService.setExchange(e._bitswap),e._preload.start(),e._mfsPreload.start(t)}],r)}))},function(e,t,r){"use strict";const n=r(5),i=r(221),o=r(41),s=r(37),a=r(74),u=r(1033),c=r(1041),f=r(1045),l=r(1050),h=r(115).logger,p=r(1051),d={statsEnabled:!1,statsComputeThrottleTimeout:1e3,statsComputeThrottleMaxQueueSize:1e3},y=["blocksReceived","dataReceived","dupBlksReceived","dupDataReceived","blocksSent","dataSent","providesBufferLength","wantListLength","peerCount"];class g{constructor(e,t,r){this._libp2p=e,this._log=h(this.peerInfo.id),this._options=Object.assign({},d,r),this._stats=new p(y,{enabled:this._options.statsEnabled,computeThrottleTimeout:this._options.statsComputeThrottleTimeout,computeThrottleMaxQueueSize:this._options.statsComputeThrottleMaxQueueSize}),this.network=new c(e,this,{},this._stats),this.blockstore=t,this.engine=new f(this.peerInfo.id,t,this.network,this._stats),this.wm=new u(this.peerInfo.id,this.network,this._stats),this.notifications=new l(this.peerInfo.id)}get peerInfo(){return this._libp2p.peerInfo}_receiveMessage(e,t,r){this.engine.messageReceived(e,t,n=>{if(n&&this._log("failed to receive message",t),0===t.blocks.size)return r();const i=Array.from(t.blocks.values()),s=i.filter(e=>this.wm.wantlist.contains(e.cid)).map(e=>e.cid);this.wm.cancelWants(s),o(i,(t,r)=>this._handleReceivedBlock(e,t,r),r)})}_handleReceivedBlock(e,t,r){this._log("received block"),n([e=>this.blockstore.has(t.cid,e),(r,n)=>{if(this._updateReceiveCounters(e.toB58String(),t,r),r)return n();this._putBlock(t,n)}],r)}_updateReceiveCounters(e,t,r){this._stats.push(e,"blocksReceived",1),this._stats.push(e,"dataReceived",t.data.length),r&&(this._stats.push(e,"dupBlksReceived",1),this._stats.push(e,"dupDataReceived",t.data.length))}_receiveError(e){this._log.error("ReceiveError: %s",e.message)}_onPeerConnected(e){this.wm.connected(e)}_onPeerDisconnected(e){this.wm.disconnected(e),this.engine.peerDisconnected(e),this._stats.disconnected(e)}_putBlock(e,t){this.blockstore.put(e,r=>{if(r)return t(r);this.notifications.hasBlock(e),this.network.provide(e.cid,e=>{e&&this._log.error("Failed to provide: %s",e.message)}),this.engine.receivedBlocks([e.cid]),t()})}enableStats(){this._stats.enable()}disableStats(){this._stats.disable()}wantlistForPeer(e){return this.engine.wantlistForPeer(e)}ledgerForPeer(e){return this.engine.ledgerForPeer(e)}get(e,t){this.getMany([e],(e,r)=>{if(e)return t(e);r&&r.length>0?t(null,r[0]):t()})}getMany(e,t){let r=e.length;const i=[];let o=!1;const s=(e,t)=>{i.push(e),this.notifications.wantBlock(e,r=>{this.wm.cancelWants([e]),t(null,r)},()=>{this.wm.cancelWants([e]),t(null,void 0)}),r||this.wm.wantBlocks(i)};a(e,(t,a)=>{n([e=>this.blockstore.has(t,e),(n,a)=>{if(r--,n)return r||this.wm.wantBlocks(i),this.blockstore.get(t,a);o||(o=!0,this.network.findAndConnect(e[0],e=>{e&&this._log.error(e)})),s(t,a)}],a)},t)}unwant(e){Array.isArray(e)||(e=[e]),this.wm.unwantBlocks(e),e.forEach(e=>this.notifications.unwantBlock(e))}cancelWants(e){Array.isArray(e)||(e=[e]),this.wm.cancelWants(e)}put(e,t){this._log("putting block"),n([t=>this.blockstore.has(e.cid,t),(t,r)=>{if(t)return r();this._putBlock(e,r)}],t)}putMany(e,t){n([t=>i(e,(e,t)=>{this.blockstore.has(e.cid,t)},t),(e,t)=>this.blockstore.putMany(e,r=>{if(r)return t(r);e.forEach(e=>{this.notifications.hasBlock(e),this.engine.receivedBlocks([e.cid]),this.network.provide(e.cid,e=>{e&&this._log.error("Failed to provide: %s",e.message)})}),t()})],t)}getWantlist(){return this.wm.wantlist.entries()}peers(){return this.engine.peers()}stat(){return this._stats}start(e){s([e=>this.wm.start(e),e=>this.network.start(e),e=>this.engine.start(e)],e)}stop(e){this._stats.stop(),s([e=>this.wm.stop(e),e=>this.network.stop(e),e=>this.engine.stop(e)],e)}}e.exports=g},function(e,t,r){"use strict";const n=r(3),i=r(186),o=r(187),s=r(281),a=r(1040),u=r(115).logger;e.exports=class e{constructor(e,t,r){this.peers=new Map,this.wantlist=new o(r),this.network=t,this._stats=r,this._peerId=e,this._log=u(e,"want")}_addEntries(e,t,r){const n=e.map((e,r)=>new i.Entry(e,s.kMaxPriority-r,t));n.forEach(e=>{e.cancel?r?this.wantlist.removeForce(e.cid):this.wantlist.remove(e.cid):(this._log("adding to wl"),this.wantlist.add(e.cid,e.priority))});for(let e of this.peers.values())e.addEntries(n)}_startPeerHandler(e){let t=this.peers.get(e.toB58String());if(t)return void t.refcnt++;t=new a(this._peerId,e,this.network);const r=new i(!0);for(let e of this.wantlist.entries())r.addEntry(e[1].cid,e[1].priority);return t.addMessage(r),this.peers.set(e.toB58String(),t),t}_stopPeerHandler(e){const t=this.peers.get(e.toB58String());t&&(t.refcnt--,t.refcnt>0||this.peers.delete(e.toB58String()))}wantBlocks(e){this._addEntries(e,!1)}unwantBlocks(e){this._log("unwant blocks: %s",e.length),this._addEntries(e,!0,!0)}cancelWants(e){this._log("cancel wants: %s",e.length),this._addEntries(e,!0)}connectedPeers(){return Array.from(this.peers.keys())}connected(e){this._startPeerHandler(e)}disconnected(e){this._stopPeerHandler(e)}start(e){this.timer=setInterval(()=>{this._log("resend full-wantlist");const e=new i(!0);this.wantlist.forEach(t=>{e.addEntry(t.cid,t.priority)}),this.peers.forEach(t=>t.addMessage(e))},6e4),n(()=>e())}stop(e){this.peers.forEach(e=>this.disconnected(e.peerId)),clearInterval(this.timer),n(()=>e())}}},function(e,t,r){(function(e,r){var n=200,i="__lodash_hash_undefined__",o=1,s=2,a=9007199254740991,u="[object Arguments]",c="[object Array]",f="[object Boolean]",l="[object Date]",h="[object Error]",p="[object Function]",d="[object GeneratorFunction]",y="[object Map]",g="[object Number]",m="[object Object]",b="[object Promise]",v="[object RegExp]",_="[object Set]",w="[object String]",S="[object Symbol]",k="[object WeakMap]",E="[object ArrayBuffer]",A="[object DataView]",x="[object Float32Array]",I="[object Float64Array]",T="[object Int8Array]",B="[object Int16Array]",C="[object Int32Array]",P="[object Uint8Array]",O="[object Uint8ClampedArray]",R="[object Uint16Array]",N="[object Uint32Array]",L=/[\\^$.*+?()[\]{}|]/g,j=/^\[object .+?Constructor\]$/,M=/^(?:0|[1-9]\d*)$/,K={};K[x]=K[I]=K[T]=K[B]=K[C]=K[P]=K[O]=K[R]=K[N]=!0,K[u]=K[c]=K[E]=K[f]=K[A]=K[l]=K[h]=K[p]=K[y]=K[g]=K[m]=K[v]=K[_]=K[w]=K[k]=!1;var D="object"==typeof e&&e&&e.Object===Object&&e,U="object"==typeof self&&self&&self.Object===Object&&self,F=D||U||Function("return this")(),q="object"==typeof t&&t&&!t.nodeType&&t,H=q&&"object"==typeof r&&r&&!r.nodeType&&r,z=H&&H.exports===q,V=z&&D.process,G=function(){try{return V&&V.binding("util")}catch(e){}}(),W=G&&G.isTypedArray;function $(e,t){for(var r=-1,n=e?e.length:0;++r<n;)if(t(e[r],r,e))return!0;return!1}function Y(e,t){for(var r=-1,n=Array(e);++r<e;)n[r]=t(r);return n}function J(e){return function(t){return e(t)}}function X(e,t){return null==e?void 0:e[t]}function Z(e){var t=!1;if(null!=e&&"function"!=typeof e.toString)try{t=!!(e+"")}catch(e){}return t}function Q(e){var t=-1,r=Array(e.size);return e.forEach(function(e,n){r[++t]=[n,e]}),r}function ee(e,t){return function(r){return e(t(r))}}function te(e){var t=-1,r=Array(e.size);return e.forEach(function(e){r[++t]=e}),r}var re=Array.prototype,ne=Function.prototype,ie=Object.prototype,oe=F["__core-js_shared__"],se=(ae=/[^.]+$/.exec(oe&&oe.keys&&oe.keys.IE_PROTO||""),ae?"Symbol(src)_1."+ae:""),ae,ue=ne.toString,ce=ie.hasOwnProperty,fe=ie.toString,le=RegExp("^"+ue.call(ce).replace(L,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),he=F.Symbol,pe=F.Uint8Array,de=ie.propertyIsEnumerable,ye=re.splice,ge=ee(Object.keys,Object),me=yt(F,"DataView"),be=yt(F,"Map"),ve=yt(F,"Promise"),_e=yt(F,"Set"),we=yt(F,"WeakMap"),Se=yt(Object,"create"),ke=wt(me),Ee=wt(be),Ae=wt(ve),xe=wt(_e),Ie=wt(we),Te=he?he.prototype:void 0,Be=Te?Te.valueOf:void 0;function Ce(e){var t=-1,r=e?e.length:0;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}function Pe(){this.__data__=Se?Se(null):{}}function Oe(e){return this.has(e)&&delete this.__data__[e]}function Re(e){var t=this.__data__;if(Se){var r=t[e];return r===i?void 0:r}return ce.call(t,e)?t[e]:void 0}function Ne(e){var t=this.__data__;return Se?void 0!==t[e]:ce.call(t,e)}function Le(e,t){var r=this.__data__;return r[e]=Se&&void 0===t?i:t,this}function je(e){var t=-1,r=e?e.length:0;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}function Me(){this.__data__=[]}function Ke(e){var t=this.__data__,r=it(t,e);if(r<0)return!1;var n=t.length-1;return r==n?t.pop():ye.call(t,r,1),!0}function De(e){var t=this.__data__,r=it(t,e);return r<0?void 0:t[r][1]}function Ue(e){return it(this.__data__,e)>-1}function Fe(e,t){var r=this.__data__,n=it(r,e);return n<0?r.push([e,t]):r[n][1]=t,this}function qe(e){var t=-1,r=e?e.length:0;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}function He(){this.__data__={hash:new Ce,map:new(be||je),string:new Ce}}function ze(e){return dt(this,e).delete(e)}function Ve(e){return dt(this,e).get(e)}function Ge(e){return dt(this,e).has(e)}function We(e,t){return dt(this,e).set(e,t),this}function $e(e){var t=-1,r=e?e.length:0;for(this.__data__=new qe;++t<r;)this.add(e[t])}function Ye(e){return this.__data__.set(e,i),this}function Je(e){return this.__data__.has(e)}function Xe(e){this.__data__=new je(e)}function Ze(){this.__data__=new je}function Qe(e){return this.__data__.delete(e)}function et(e){return this.__data__.get(e)}function tt(e){return this.__data__.has(e)}function rt(e,t){var r=this.__data__;if(r instanceof je){var i=r.__data__;if(!be||i.length<n-1)return i.push([e,t]),this;r=this.__data__=new qe(i)}return r.set(e,t),this}function nt(e,t){var r=Et(e)||kt(e)?Y(e.length,String):[],n=r.length,i=!!n;for(var o in e)!t&&!ce.call(e,o)||i&&("length"==o||mt(o,n))||r.push(o);return r}function it(e,t){for(var r=e.length;r--;)if(St(e[r][0],t))return r;return-1}function ot(e){return fe.call(e)}function st(e,t,r,n,i){return e===t||(null==e||null==t||!Ct(e)&&!Pt(t)?e!=e&&t!=t:at(e,t,st,r,n,i))}function at(e,t,r,n,i,o){var a=Et(e),f=Et(t),l=c,h=c;a||(l=gt(e),l=l==u?m:l),f||(h=gt(t),h=h==u?m:h);var p=l==m&&!Z(e),d=h==m&&!Z(t),y=l==h;if(y&&!p)return o||(o=new Xe),a||Ot(e)?lt(e,t,r,n,i,o):ht(e,t,l,r,n,i,o);if(!(i&s)){var g=p&&ce.call(e,"__wrapped__"),b=d&&ce.call(t,"__wrapped__");if(g||b){var v=g?e.value():e,_=b?t.value():t;return o||(o=new Xe),r(v,_,n,i,o)}}return!!y&&(o||(o=new Xe),pt(e,t,r,n,i,o))}function ut(e){if(!Ct(e)||vt(e))return!1;var t=Tt(e)||Z(e)?le:j;return t.test(wt(e))}function ct(e){return Pt(e)&&Bt(e.length)&&!!K[fe.call(e)]}function ft(e){if(!_t(e))return ge(e);var t=[];for(var r in Object(e))ce.call(e,r)&&"constructor"!=r&&t.push(r);return t}function lt(e,t,r,n,i,a){var u=i&s,c=e.length,f=t.length;if(c!=f&&!(u&&f>c))return!1;var l=a.get(e);if(l&&a.get(t))return l==t;var h=-1,p=!0,d=i&o?new $e:void 0;for(a.set(e,t),a.set(t,e);++h<c;){var y=e[h],g=t[h];if(n)var m=u?n(g,y,h,t,e,a):n(y,g,h,e,t,a);if(void 0!==m){if(m)continue;p=!1;break}if(d){if(!$(t,function(e,t){if(!d.has(t)&&(y===e||r(y,e,n,i,a)))return d.add(t)})){p=!1;break}}else if(y!==g&&!r(y,g,n,i,a)){p=!1;break}}return a.delete(e),a.delete(t),p}function ht(e,t,r,n,i,a,u){switch(r){case A:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case E:return!(e.byteLength!=t.byteLength||!n(new pe(e),new pe(t)));case f:case l:case g:return St(+e,+t);case h:return e.name==t.name&&e.message==t.message;case v:case w:return e==t+"";case y:var c=Q;case _:var p=a&s;if(c||(c=te),e.size!=t.size&&!p)return!1;var d=u.get(e);if(d)return d==t;a|=o,u.set(e,t);var m=lt(c(e),c(t),n,i,a,u);return u.delete(e),m;case S:if(Be)return Be.call(e)==Be.call(t)}return!1}function pt(e,t,r,n,i,o){var a=i&s,u=Rt(e),c=u.length,f=Rt(t),l=f.length;if(c!=l&&!a)return!1;for(var h=c;h--;){var p=u[h];if(!(a?p in t:ce.call(t,p)))return!1}var d=o.get(e);if(d&&o.get(t))return d==t;var y=!0;o.set(e,t),o.set(t,e);for(var g=a;++h<c;){p=u[h];var m=e[p],b=t[p];if(n)var v=a?n(b,m,p,t,e,o):n(m,b,p,e,t,o);if(!(void 0===v?m===b||r(m,b,n,i,o):v)){y=!1;break}g||(g="constructor"==p)}if(y&&!g){var _=e.constructor,w=t.constructor;_!=w&&"constructor"in e&&"constructor"in t&&!("function"==typeof _&&_ instanceof _&&"function"==typeof w&&w instanceof w)&&(y=!1)}return o.delete(e),o.delete(t),y}function dt(e,t){var r=e.__data__;return bt(t)?r["string"==typeof t?"string":"hash"]:r.map}function yt(e,t){var r=X(e,t);return ut(r)?r:void 0}Ce.prototype.clear=Pe,Ce.prototype.delete=Oe,Ce.prototype.get=Re,Ce.prototype.has=Ne,Ce.prototype.set=Le,je.prototype.clear=Me,je.prototype.delete=Ke,je.prototype.get=De,je.prototype.has=Ue,je.prototype.set=Fe,qe.prototype.clear=He,qe.prototype.delete=ze,qe.prototype.get=Ve,qe.prototype.has=Ge,qe.prototype.set=We,$e.prototype.add=$e.prototype.push=Ye,$e.prototype.has=Je,Xe.prototype.clear=Ze,Xe.prototype.delete=Qe,Xe.prototype.get=et,Xe.prototype.has=tt,Xe.prototype.set=rt;var gt=ot;function mt(e,t){return t=null==t?a:t,!!t&&("number"==typeof e||M.test(e))&&e>-1&&e%1==0&&e<t}function bt(e){var t=typeof e;return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e}function vt(e){return!!se&&se in e}function _t(e){var t=e&&e.constructor,r="function"==typeof t&&t.prototype||ie;return e===r}function wt(e){if(null!=e){try{return ue.call(e)}catch(e){}try{return e+""}catch(e){}}return""}function St(e,t){return e===t||e!=e&&t!=t}function kt(e){return xt(e)&&ce.call(e,"callee")&&(!de.call(e,"callee")||fe.call(e)==u)}(me&>(new me(new ArrayBuffer(1)))!=A||be&>(new be)!=y||ve&>(ve.resolve())!=b||_e&>(new _e)!=_||we&>(new we)!=k)&&(gt=function(e){var t=fe.call(e),r=t==m?e.constructor:void 0,n=r?wt(r):void 0;if(n)switch(n){case ke:return A;case Ee:return y;case Ae:return b;case xe:return _;case Ie:return k}return t});var Et=Array.isArray;function At(e){return null!=e&&Bt(e.length)&&!Tt(e)}function xt(e){return Pt(e)&&At(e)}function It(e,t,r){r="function"==typeof r?r:void 0;var n=r?r(e,t):void 0;return void 0===n?st(e,t,r):!!n}function Tt(e){var t=Ct(e)?fe.call(e):"";return t==p||t==d}function Bt(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=a}function Ct(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function Pt(e){return!!e&&"object"==typeof e}var Ot=W?J(W):ct;function Rt(e){return At(e)?nt(e):ft(e)}r.exports=It}).call(this,r(7),r(28)(e))},function(e,t,r){"use strict";(function(t){const n=r(23);e.exports=(e=>{if(!t.isBuffer(e))throw new Error("arg needs to be a buffer");let r=[];for(;e.length>0;){const t=n.decode(e);r.push(t),e=e.slice(n.decode.bytes)}return r})}).call(this,r(0).Buffer)},function(e,t,r){"use strict";e.exports="\n message Message {\n message Wantlist {\n message Entry {\n // changed from string to bytes, it makes a difference in JavaScript\n optional bytes block = 1; // the block cid (cidV0 in bitswap 1.0.0, cidV1 in bitswap 1.1.0)\n optional int32 priority = 2; // the priority (normalized). default to 1\n optional bool cancel = 3; // whether this revokes an entry\n }\n\n repeated Entry entries = 1; // a list of wantlist entries\n optional bool full = 2; // whether this is the full wantlist. default to false\n }\n\n message Block {\n optional bytes prefix = 1; // CID prefix (cid version, multicodec and multihash prefix (type + length)\n optional bytes data = 2;\n }\n\n optional Wantlist wantlist = 1;\n repeated bytes blocks = 2; // used to send Blocks in bitswap 1.0.0\n repeated Block payload = 3; // used to send Blocks in bitswap 1.1.0\n }\n"},function(e,t,r){"use strict";const n=r(187).Entry,i=r(9),o=r(13);e.exports=class e{constructor(e,t,r){o(i.isCID(e),"needs valid cid"),this.entry=new n(e,t),this.cancel=Boolean(r)}get cid(){return this.entry.cid}set cid(e){this.entry.cid=e}get priority(){return this.entry.priority}set priority(e){this.entry.priority=e}get[Symbol.toStringTag](){const e=this.cid.toBaseEncodedString();return`BitswapMessageEntry ${e} <cancel: ${this.cancel}, priority: ${this.priority}>`}equals(e){return this.cancel===e.cancel&&this.entry.equals(e.entry)}}},function(e,t,r){(function(e,r){var n=200,i="Expected a function",o="__lodash_hash_undefined__",s=1,a=2,u=1/0,c=9007199254740991,f="[object Arguments]",l="[object Array]",h="[object Boolean]",p="[object Date]",d="[object Error]",y="[object Function]",g="[object GeneratorFunction]",m="[object Map]",b="[object Number]",v="[object Object]",_="[object Promise]",w="[object RegExp]",S="[object Set]",k="[object String]",E="[object Symbol]",A="[object WeakMap]",x="[object ArrayBuffer]",I="[object DataView]",T="[object Float32Array]",B="[object Float64Array]",C="[object Int8Array]",P="[object Int16Array]",O="[object Int32Array]",R="[object Uint8Array]",N="[object Uint8ClampedArray]",L="[object Uint16Array]",j="[object Uint32Array]",M=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,K=/^\w*$/,D=/^\./,U=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,F=/[\\^$.*+?()[\]{}|]/g,q=/\\(\\)?/g,H=/^\[object .+?Constructor\]$/,z=/^(?:0|[1-9]\d*)$/,V={};V[T]=V[B]=V[C]=V[P]=V[O]=V[R]=V[N]=V[L]=V[j]=!0,V[f]=V[l]=V[x]=V[h]=V[I]=V[p]=V[d]=V[y]=V[m]=V[b]=V[v]=V[w]=V[S]=V[k]=V[A]=!1;var G="object"==typeof e&&e&&e.Object===Object&&e,W="object"==typeof self&&self&&self.Object===Object&&self,$=G||W||Function("return this")(),Y="object"==typeof t&&t&&!t.nodeType&&t,J=Y&&"object"==typeof r&&r&&!r.nodeType&&r,X=J&&J.exports===Y,Z=X&&G.process,Q=function(){try{return Z&&Z.binding("util")}catch(e){}}(),ee=Q&&Q.isTypedArray;function te(e,t,r){switch(r.length){case 0:return e.call(t);case 1:return e.call(t,r[0]);case 2:return e.call(t,r[0],r[1]);case 3:return e.call(t,r[0],r[1],r[2])}return e.apply(t,r)}function re(e,t){for(var r=-1,n=e?e.length:0,i=Array(n);++r<n;)i[r]=t(e[r],r,e);return i}function ne(e,t){for(var r=-1,n=t.length,i=e.length;++r<n;)e[i+r]=t[r];return e}function ie(e,t){for(var r=-1,n=e?e.length:0;++r<n;)if(t(e[r],r,e))return!0;return!1}function oe(e){return function(t){return null==t?void 0:t[e]}}function se(e,t){var r=e.length;for(e.sort(t);r--;)e[r]=e[r].value;return e}function ae(e,t){for(var r=-1,n=Array(e);++r<e;)n[r]=t(r);return n}function ue(e){return function(t){return e(t)}}function ce(e,t){return null==e?void 0:e[t]}function fe(e){var t=!1;if(null!=e&&"function"!=typeof e.toString)try{t=!!(e+"")}catch(e){}return t}function le(e){var t=-1,r=Array(e.size);return e.forEach(function(e,n){r[++t]=[n,e]}),r}function he(e,t){return function(r){return e(t(r))}}function pe(e){var t=-1,r=Array(e.size);return e.forEach(function(e){r[++t]=e}),r}var de=Array.prototype,ye=Function.prototype,ge=Object.prototype,me=$["__core-js_shared__"],be=(ve=/[^.]+$/.exec(me&&me.keys&&me.keys.IE_PROTO||""),ve?"Symbol(src)_1."+ve:""),ve,_e=ye.toString,we=ge.hasOwnProperty,Se=ge.toString,ke=RegExp("^"+_e.call(we).replace(F,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Ee=$.Symbol,Ae=$.Uint8Array,xe=ge.propertyIsEnumerable,Ie=de.splice,Te=Ee?Ee.isConcatSpreadable:void 0,Be=he(Object.keys,Object),Ce=Math.max,Pe=Xt($,"DataView"),Oe=Xt($,"Map"),Re=Xt($,"Promise"),Ne=Xt($,"Set"),Le=Xt($,"WeakMap"),je=Xt(Object,"create"),Me=lr(Pe),Ke=lr(Oe),De=lr(Re),Ue=lr(Ne),Fe=lr(Le),qe=Ee?Ee.prototype:void 0,He=qe?qe.valueOf:void 0,ze=qe?qe.toString:void 0;function Ve(e){var t=-1,r=e?e.length:0;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}function Ge(){this.__data__=je?je(null):{}}function We(e){return this.has(e)&&delete this.__data__[e]}function $e(e){var t=this.__data__;if(je){var r=t[e];return r===o?void 0:r}return we.call(t,e)?t[e]:void 0}function Ye(e){var t=this.__data__;return je?void 0!==t[e]:we.call(t,e)}function Je(e,t){var r=this.__data__;return r[e]=je&&void 0===t?o:t,this}function Xe(e){var t=-1,r=e?e.length:0;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}function Ze(){this.__data__=[]}function Qe(e){var t=this.__data__,r=vt(t,e);if(r<0)return!1;var n=t.length-1;return r==n?t.pop():Ie.call(t,r,1),!0}function et(e){var t=this.__data__,r=vt(t,e);return r<0?void 0:t[r][1]}function tt(e){return vt(this.__data__,e)>-1}function rt(e,t){var r=this.__data__,n=vt(r,e);return n<0?r.push([e,t]):r[n][1]=t,this}function nt(e){var t=-1,r=e?e.length:0;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}function it(){this.__data__={hash:new Ve,map:new(Oe||Xe),string:new Ve}}function ot(e){return Yt(this,e).delete(e)}function st(e){return Yt(this,e).get(e)}function at(e){return Yt(this,e).has(e)}function ut(e,t){return Yt(this,e).set(e,t),this}function ct(e){var t=-1,r=e?e.length:0;for(this.__data__=new nt;++t<r;)this.add(e[t])}function ft(e){return this.__data__.set(e,o),this}function lt(e){return this.__data__.has(e)}function ht(e){this.__data__=new Xe(e)}function pt(){this.__data__=new Xe}function dt(e){return this.__data__.delete(e)}function yt(e){return this.__data__.get(e)}function gt(e){return this.__data__.has(e)}function mt(e,t){var r=this.__data__;if(r instanceof Xe){var i=r.__data__;if(!Oe||i.length<n-1)return i.push([e,t]),this;r=this.__data__=new nt(i)}return r.set(e,t),this}function bt(e,t){var r=gr(e)||yr(e)?ae(e.length,String):[],n=r.length,i=!!n;for(var o in e)!t&&!we.call(e,o)||i&&("length"==o||tr(o,n))||r.push(o);return r}function vt(e,t){for(var r=e.length;r--;)if(dr(e[r][0],t))return r;return-1}Ve.prototype.clear=Ge,Ve.prototype.delete=We,Ve.prototype.get=$e,Ve.prototype.has=Ye,Ve.prototype.set=Je,Xe.prototype.clear=Ze,Xe.prototype.delete=Qe,Xe.prototype.get=et,Xe.prototype.has=tt,Xe.prototype.set=rt,nt.prototype.clear=it,nt.prototype.delete=ot,nt.prototype.get=st,nt.prototype.has=at,nt.prototype.set=ut,ct.prototype.add=ct.prototype.push=ft,ct.prototype.has=lt,ht.prototype.clear=pt,ht.prototype.delete=dt,ht.prototype.get=yt,ht.prototype.has=gt,ht.prototype.set=mt;var _t=zt(kt);function wt(e,t,r,n,i){var o=-1,s=e.length;for(r||(r=er),i||(i=[]);++o<s;){var a=e[o];t>0&&r(a)?t>1?wt(a,t-1,r,n,i):ne(i,a):n||(i[i.length]=a)}return i}var St=Vt();function kt(e,t){return e&&St(e,t,Tr)}function Et(e,t){t=nr(t,e)?[t]:Ft(t);for(var r=0,n=t.length;null!=e&&r<n;)e=e[fr(t[r++])];return r&&r==n?e:void 0}function At(e){return Se.call(e)}function xt(e,t){return null!=e&&t in Object(e)}function It(e,t,r,n,i){return e===t||(null==e||null==t||!wr(e)&&!Sr(t)?e!=e&&t!=t:Tt(e,t,It,r,n,i))}function Tt(e,t,r,n,i,o){var s=gr(e),u=gr(t),c=l,h=l;s||(c=Zt(e),c=c==f?v:c),u||(h=Zt(t),h=h==f?v:h);var p=c==v&&!fe(e),d=h==v&&!fe(t),y=c==h;if(y&&!p)return o||(o=new ht),s||Er(e)?Gt(e,t,r,n,i,o):Wt(e,t,c,r,n,i,o);if(!(i&a)){var g=p&&we.call(e,"__wrapped__"),m=d&&we.call(t,"__wrapped__");if(g||m){var b=g?e.value():e,_=m?t.value():t;return o||(o=new ht),r(b,_,n,i,o)}}return!!y&&(o||(o=new ht),$t(e,t,r,n,i,o))}function Bt(e,t,r,n){var i=r.length,o=i,u=!n;if(null==e)return!o;for(e=Object(e);i--;){var c=r[i];if(u&&c[2]?c[1]!==e[c[0]]:!(c[0]in e))return!1}for(;++i<o;){c=r[i];var f=c[0],l=e[f],h=c[1];if(u&&c[2]){if(void 0===l&&!(f in e))return!1}else{var p=new ht;if(n)var d=n(l,h,f,e,t,p);if(!(void 0===d?It(h,l,n,s|a,p):d))return!1}}return!0}function Ct(e){if(!wr(e)||or(e))return!1;var t=vr(e)||fe(e)?ke:H;return t.test(lr(e))}function Pt(e){return Sr(e)&&_r(e.length)&&!!V[Se.call(e)]}function Ot(e){return"function"==typeof e?e:null==e?Br:"object"==typeof e?gr(e)?jt(e[0],e[1]):Lt(e):Cr(e)}function Rt(e){if(!sr(e))return Be(e);var t=[];for(var r in Object(e))we.call(e,r)&&"constructor"!=r&&t.push(r);return t}function Nt(e,t){var r=-1,n=mr(e)?Array(e.length):[];return _t(e,function(e,i,o){n[++r]=t(e,i,o)}),n}function Lt(e){var t=Jt(e);return 1==t.length&&t[0][2]?ur(t[0][0],t[0][1]):function(r){return r===e||Bt(r,e,t)}}function jt(e,t){return nr(e)&&ar(t)?ur(fr(e),t):function(r){var n=xr(r,e);return void 0===n&&n===t?Ir(r,e):It(t,n,void 0,s|a)}}function Mt(e,t,r){var n=-1;t=re(t.length?t:[Br],ue(Ot));var i=Nt(e,function(e,r,i){var o=re(t,function(t){return t(e)});return{criteria:o,index:++n,value:e}});return se(i,function(e,t){return Ht(e,t,r)})}function Kt(e){return function(t){return Et(t,e)}}function Dt(e,t){return t=Ce(void 0===t?e.length-1:t,0),function(){for(var r=arguments,n=-1,i=Ce(r.length-t,0),o=Array(i);++n<i;)o[n]=r[t+n];n=-1;for(var s=Array(t+1);++n<t;)s[n]=r[n];return s[t]=o,te(e,this,s)}}function Ut(e){if("string"==typeof e)return e;if(kr(e))return ze?ze.call(e):"";var t=e+"";return"0"==t&&1/e==-u?"-0":t}function Ft(e){return gr(e)?e:cr(e)}function qt(e,t){if(e!==t){var r=void 0!==e,n=null===e,i=e==e,o=kr(e),s=void 0!==t,a=null===t,u=t==t,c=kr(t);if(!a&&!c&&!o&&e>t||o&&s&&u&&!a&&!c||n&&s&&u||!r&&u||!i)return 1;if(!n&&!o&&!c&&e<t||c&&r&&i&&!n&&!o||a&&r&&i||!s&&i||!u)return-1}return 0}function Ht(e,t,r){for(var n=-1,i=e.criteria,o=t.criteria,s=i.length,a=r.length;++n<s;){var u=qt(i[n],o[n]);if(u){if(n>=a)return u;var c=r[n];return u*("desc"==c?-1:1)}}return e.index-t.index}function zt(e,t){return function(r,n){if(null==r)return r;if(!mr(r))return e(r,n);for(var i=r.length,o=t?i:-1,s=Object(r);(t?o--:++o<i)&&!1!==n(s[o],o,s););return r}}function Vt(e){return function(t,r,n){for(var i=-1,o=Object(t),s=n(t),a=s.length;a--;){var u=s[e?a:++i];if(!1===r(o[u],u,o))break}return t}}function Gt(e,t,r,n,i,o){var u=i&a,c=e.length,f=t.length;if(c!=f&&!(u&&f>c))return!1;var l=o.get(e);if(l&&o.get(t))return l==t;var h=-1,p=!0,d=i&s?new ct:void 0;for(o.set(e,t),o.set(t,e);++h<c;){var y=e[h],g=t[h];if(n)var m=u?n(g,y,h,t,e,o):n(y,g,h,e,t,o);if(void 0!==m){if(m)continue;p=!1;break}if(d){if(!ie(t,function(e,t){if(!d.has(t)&&(y===e||r(y,e,n,i,o)))return d.add(t)})){p=!1;break}}else if(y!==g&&!r(y,g,n,i,o)){p=!1;break}}return o.delete(e),o.delete(t),p}function Wt(e,t,r,n,i,o,u){switch(r){case I:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case x:return!(e.byteLength!=t.byteLength||!n(new Ae(e),new Ae(t)));case h:case p:case b:return dr(+e,+t);case d:return e.name==t.name&&e.message==t.message;case w:case k:return e==t+"";case m:var c=le;case S:var f=o&a;if(c||(c=pe),e.size!=t.size&&!f)return!1;var l=u.get(e);if(l)return l==t;o|=s,u.set(e,t);var y=Gt(c(e),c(t),n,i,o,u);return u.delete(e),y;case E:if(He)return He.call(e)==He.call(t)}return!1}function $t(e,t,r,n,i,o){var s=i&a,u=Tr(e),c=u.length,f=Tr(t),l=f.length;if(c!=l&&!s)return!1;for(var h=c;h--;){var p=u[h];if(!(s?p in t:we.call(t,p)))return!1}var d=o.get(e);if(d&&o.get(t))return d==t;var y=!0;o.set(e,t),o.set(t,e);for(var g=s;++h<c;){p=u[h];var m=e[p],b=t[p];if(n)var v=s?n(b,m,p,t,e,o):n(m,b,p,e,t,o);if(!(void 0===v?m===b||r(m,b,n,i,o):v)){y=!1;break}g||(g="constructor"==p)}if(y&&!g){var _=e.constructor,w=t.constructor;_!=w&&"constructor"in e&&"constructor"in t&&!("function"==typeof _&&_ instanceof _&&"function"==typeof w&&w instanceof w)&&(y=!1)}return o.delete(e),o.delete(t),y}function Yt(e,t){var r=e.__data__;return ir(t)?r["string"==typeof t?"string":"hash"]:r.map}function Jt(e){for(var t=Tr(e),r=t.length;r--;){var n=t[r],i=e[n];t[r]=[n,i,ar(i)]}return t}function Xt(e,t){var r=ce(e,t);return Ct(r)?r:void 0}var Zt=At;function Qt(e,t,r){t=nr(t,e)?[t]:Ft(t);for(var n,i=-1,o=t.length;++i<o;){var s=fr(t[i]);if(!(n=null!=e&&r(e,s)))break;e=e[s]}if(n)return n;var o=e?e.length:0;return!!o&&_r(o)&&tr(s,o)&&(gr(e)||yr(e))}function er(e){return gr(e)||yr(e)||!!(Te&&e&&e[Te])}function tr(e,t){return t=null==t?c:t,!!t&&("number"==typeof e||z.test(e))&&e>-1&&e%1==0&&e<t}function rr(e,t,r){if(!wr(r))return!1;var n=typeof t;return!!("number"==n?mr(r)&&tr(t,r.length):"string"==n&&t in r)&&dr(r[t],e)}function nr(e,t){if(gr(e))return!1;var r=typeof e;return!("number"!=r&&"symbol"!=r&&"boolean"!=r&&null!=e&&!kr(e))||(K.test(e)||!M.test(e)||null!=t&&e in Object(t))}function ir(e){var t=typeof e;return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e}function or(e){return!!be&&be in e}function sr(e){var t=e&&e.constructor,r="function"==typeof t&&t.prototype||ge;return e===r}function ar(e){return e==e&&!wr(e)}function ur(e,t){return function(r){return null!=r&&(r[e]===t&&(void 0!==t||e in Object(r)))}}(Pe&&Zt(new Pe(new ArrayBuffer(1)))!=I||Oe&&Zt(new Oe)!=m||Re&&Zt(Re.resolve())!=_||Ne&&Zt(new Ne)!=S||Le&&Zt(new Le)!=A)&&(Zt=function(e){var t=Se.call(e),r=t==v?e.constructor:void 0,n=r?lr(r):void 0;if(n)switch(n){case Me:return I;case Ke:return m;case De:return _;case Ue:return S;case Fe:return A}return t});var cr=pr(function(e){e=Ar(e);var t=[];return D.test(e)&&t.push(""),e.replace(U,function(e,r,n,i){t.push(n?i.replace(q,"$1"):r||e)}),t});function fr(e){if("string"==typeof e||kr(e))return e;var t=e+"";return"0"==t&&1/e==-u?"-0":t}function lr(e){if(null!=e){try{return _e.call(e)}catch(e){}try{return e+""}catch(e){}}return""}var hr=Dt(function(e,t){if(null==e)return[];var r=t.length;return r>1&&rr(e,t[0],t[1])?t=[]:r>2&&rr(t[0],t[1],t[2])&&(t=[t[0]]),Mt(e,wt(t,1),[])});function pr(e,t){if("function"!=typeof e||t&&"function"!=typeof t)throw new TypeError(i);var r=function(){var n=arguments,i=t?t.apply(this,n):n[0],o=r.cache;if(o.has(i))return o.get(i);var s=e.apply(this,n);return r.cache=o.set(i,s),s};return r.cache=new(pr.Cache||nt),r}function dr(e,t){return e===t||e!=e&&t!=t}function yr(e){return br(e)&&we.call(e,"callee")&&(!xe.call(e,"callee")||Se.call(e)==f)}pr.Cache=nt;var gr=Array.isArray;function mr(e){return null!=e&&_r(e.length)&&!vr(e)}function br(e){return Sr(e)&&mr(e)}function vr(e){var t=wr(e)?Se.call(e):"";return t==y||t==g}function _r(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=c}function wr(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function Sr(e){return!!e&&"object"==typeof e}function kr(e){return"symbol"==typeof e||Sr(e)&&Se.call(e)==E}var Er=ee?ue(ee):Pt;function Ar(e){return null==e?"":Ut(e)}function xr(e,t,r){var n=null==e?void 0:Et(e,t);return void 0===n?r:n}function Ir(e,t){return null!=e&&Qt(e,t,xt)}function Tr(e){return mr(e)?bt(e):Rt(e)}function Br(e){return e}function Cr(e){return nr(e)?oe(fr(e)):Kt(e)}r.exports=hr}).call(this,r(7),r(28)(e))},function(e,t,r){"use strict";const n=r(13),i=r(9);class o{constructor(e,t){n(i.isCID(e),"must be valid CID"),this._refCounter=1,this.cid=e,this.priority=t||1}inc(){this._refCounter+=1}dec(){this._refCounter=Math.max(0,this._refCounter-1)}hasRefs(){return this._refCounter>0}get[Symbol.toStringTag](){const e=this.cid.toBaseEncodedString();return`WantlistEntry <key: ${e}, priority: ${this.priority}, refs: ${this._refCounter}>`}equals(e){return this._refCounter===e._refCounter&&this.cid.equals(e.cid)&&this.priority===e.priority}}e.exports=o},function(e,t,r){"use strict";const n=r(498),i=r(186),o=r(115).logger;e.exports=class e{constructor(e,t,r){this.peerId=t,this.network=r,this.refcnt=1,this._entries=[],this._log=o(e,"msgqueue",t.toB58String().slice(0,8)),this.sendEntries=n(this._sendEntries.bind(this),200)}addMessage(e){e.empty||this.send(e)}addEntries(e){this._entries=this._entries.concat(e),this.sendEntries()}_sendEntries(){if(!this._entries.length)return;const e=new i(!1);this._entries.forEach(t=>{t.cancel?e.cancel(t.cid):e.addEntry(t.cid,t.priority)}),this._entries=[],this.addMessage(e)}send(e){this.network.connectTo(this.peerId,t=>{t?this._log.error("cant connect to peer %s: %s",this.peerId.toB58String(),t.message):(this._log("sending message"),this.network.sendMessage(this.peerId,e,e=>{e&&this._log.error("send error: %s",e.message)}))})}}},function(e,t,r){"use strict";const n=r(53),i=r(8),o=r(5),s=r(41),a=r(3),u=r(186),c=r(281),f=r(115).logger,l="/ipfs/bitswap/1.0.0",h="/ipfs/bitswap/1.1.0";class p{constructor(e,t,r,n){this._log=f(e.peerInfo.id,"network"),r=r||{},this.libp2p=e,this.bitswap=t,this.b100Only=r.b100Only||!1,this._stats=n,this._running=!1}start(e){this._running=!0,this._onPeerConnect=this._onPeerConnect.bind(this),this._onPeerDisconnect=this._onPeerDisconnect.bind(this),this._onConnection=this._onConnection.bind(this),this.libp2p.handle(l,this._onConnection),this.b100Only||this.libp2p.handle(h,this._onConnection),this.libp2p.on("peer:connect",this._onPeerConnect),this.libp2p.on("peer:disconnect",this._onPeerDisconnect),this.libp2p.peerBook.getAllArray().filter(e=>e.isConnected()).forEach(e=>this._onPeerConnect(e)),a(()=>e())}stop(e){this._running=!1,this.libp2p.unhandle(l),this.b100Only||this.libp2p.unhandle(h),this.libp2p.removeListener("peer:connect",this._onPeerConnect),this.libp2p.removeListener("peer:disconnect",this._onPeerDisconnect),a(()=>e())}_onConnection(e,t){this._running&&(this._log("incomming new bitswap connection: %s",e),i(t,n.decode(),i.asyncMap((e,t)=>u.deserialize(e,t)),i.asyncMap((e,r)=>{t.getPeerInfo((t,n)=>{if(t)return r(t);this.bitswap._receiveMessage(n.id,e,r)})}),i.onEnd(e=>{this._log("ending connection"),e&&this.bitswap._receiveError(e)})))}_onPeerConnect(e){this._running&&this.bitswap._onPeerConnected(e.id)}_onPeerDisconnect(e){this._running&&this.bitswap._onPeerDisconnected(e.id)}findProviders(e,t,r){this.libp2p.contentRouting.findProviders(e,c.providerRequestTimeout,r)}findAndConnect(e,t){o([t=>this.findProviders(e,c.maxProvidersPerRequest,t),(e,t)=>{this._log("connecting to providers",e.map(e=>e.id.toB58String())),s(e,(e,t)=>this.connectTo(e,t))}],t)}provide(e,t){this.libp2p.contentRouting.provide(e,t)}sendMessage(e,t,r){if(!this._running)return r(new Error("network isn't running"));const n=e.toB58String()?e.toB58String():e.id.toB58String();this._log("sendMessage to %s",n,t),this._dialPeer(e,(n,i,o)=>{if(n)return r(n);let s;switch(o){case l:s=t.serializeToBitswap100();break;case h:s=t.serializeToBitswap110();break;default:return r(new Error("Unkown protocol: "+o))}d(i,s,e=>{e&&this._log.error(e)}),r(),this._updateSentStats(e,t.blocks)})}connectTo(e,t){if(!this._running)return t(new Error("network isn't running"));this.libp2p.dial(e,t)}_dialPeer(e,t){this.libp2p.dialProtocol(e,h,(r,n)=>{r?this.libp2p.dialProtocol(e,l,(e,r)=>{if(e)return t(e);t(null,r,l)}):t(null,n,h)})}_updateSentStats(e,t){const r=e.toB58String();this._stats&&(t.forEach(e=>this._stats.push(r,"dataSent",e.data.length)),this._stats.push(r,"blocksSent",t.size))}}function d(e,t,r){i(i.values([t]),n.encode(),e,i.onEnd(r))}e.exports=p},function(e,t,r){"use strict";const n=r(2).Buffer;e.exports=o;const i=10240;function o(e){e=Object.assign({fixed:!1},e||{});const t=r(23);let i=e.fixed?null:s(),o=0,a=!1;return r=>(u,c)=>{if(u&&(a=u),a)return c(a);r(null,(r,u)=>{if(r&&(a=r),a)return c(a);if(!n.isBuffer(u))return a=new Error("data must be a buffer"),c(a);let f;e.fixed?(f=n.alloc(4),f.writeInt32BE(u.length,0)):(t.encode(u.length,i,o),o+=t.encode.bytes,f=i.slice(o-t.encode.bytes,o),i.length-o<100&&(i=s(),o=0)),c(null,n.concat([f,u]))})}}function s(){return n.alloc(i)}},function(e,t,r){"use strict";const n=r(23),i=r(499),o=r(2).Buffer,s=r(43);t.decode=f,t.decodeFromReader=l;const a=128,u=e=>!(128&e),c=4194304;function f(e){let t=new i,r=s(e=>{t.abort(e)});return n=>{function i(){h(t,e,(e,t)=>{if(e)return r.end(e);r.push(t),i()})}return t(n),i(),r}}function l(e,t,r){"function"==typeof t&&(r=t,t={}),h(e,t,function e(t,n){if(t)return r(!0===t?new Error("Unexpected end of input from reader."):t);r(null,n)})}function h(e,t,r){t=Object.assign({fixed:!1,maxLength:c},t||{}),t.fixed?p(e,t.maxLength,r):d(e,t.maxLength,r)}function p(e,t,r){e.read(4,(n,i)=>{if(n)return r(n);const o=i.readInt32BE(0);if(o>t)return r(new Error("size longer than max permitted length of "+t+"!"));y(e,o,r)})}function d(e,t,r){let i=[];function s(){e.read(1,(a,c)=>{if(a)return r(a);if(i.push(c),c&&!u(c[0]))return void s();const f=n.decode(o.concat(i));if(f>t)return r(new Error("size longer than max permitted length of "+t+"!"));y(e,f,(e,t)=>e?r(e):(i=[],t.length<f?r(new Error("Message length does not match prefix specified length.")):void r(null,t)))})}0===i.length&&s()}function y(e,t,r){e.read(t,(e,t)=>{if(e)return r(e);r(null,t)})}},function(e,t,r){(function(t){e.exports=function(){var e=[],r=0;function n(){return e.reduce(function(e,t){return e+t.length},0)}return{length:r,data:this,add:function(n){if(!t.isBuffer(n))throw new Error("data must be a buffer, was: "+JSON.stringify(n));return this.length=r+=n.length,e.push(n),this},has:function(e){return null==e?r>0:r>=e},get:function(n){var i;if(null==n||n===r){r=0;var o=e;return e=[],1==o.length?o[0]:t.concat(o)}if(e.length>1&&n<=(i=e[0].length)){var s=e[0].slice(0,n);return n===i?e.shift():e[0]=e[0].slice(n,i),r-=n,s}if(n<r){for(var a=[],u=0;u+e[0].length<n;){var c=e.shift();u+=c.length,a.push(c)}return u<n&&(a.push(e[0].slice(0,n-u)),e[0]=e[0].slice(n-u,e[0].length),this.length=r-=n),t.concat(a)}throw new Error("could not get "+n+" bytes")}}}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";const n=r(41),i=r(188),o=r(5),s=r(3),a=r(74),u=r(498),c=r(1046),f=r(479),l=r(501),h=r(1047),p=r(1048),d=r(186),y=r(187),g=r(1049),m=r(115).logger,b=524288;class v{constructor(e,t,r,n){this._log=m(e,"engine"),this.blockstore=t,this.network=r,this._stats=n,this.ledgerMap=new Map,this._running=!1,this._tasks=[],this._outbox=u(this._processTasks.bind(this),100)}_sendBlocks(e,t,r){const n=t.reduce((e,t)=>e+t.data.byteLength,0);if(n<b)return this._sendSafeBlocks(e,t,r);let o=0,s=[],a=t.length;i(t,(t,r)=>{if(a--,s.push(t),o+=t.data.byteLength,o>=b||0===a){o=0;const t=s.slice();s=[],this._sendSafeBlocks(e,t,e=>{e&&this._log("sendblock error: %s",e.message),r()})}else r()},r)}_sendSafeBlocks(e,t,r){const n=new d(!1);t.forEach(e=>n.addBlock(e)),this.network.sendMessage(e,n,r)}_processTasks(){if(!this._running||!this._tasks.length)return;const e=this._tasks;this._tasks=[];const t=e.map(e=>e.entry),r=t.map(e=>e.cid),i=c(r,(e,t)=>e.equals(t)),s=h(e,e=>e.target.toB58String());o([e=>a(i,(e,t)=>{this.blockstore.get(e,t)},e),(e,t)=>n(l(s),(t,n)=>{const i=t[0].target,o=r.map(t=>f(e,e=>e.cid.equals(t)));this._sendBlocks(i,o,e=>{e?this._log.error("should never happen: ",e):o.forEach(e=>this.messageSent(i,e)),n()})})],e=>{this._tasks=[],e&&this._log.error(e)})}wantlistForPeer(e){const t=e.toB58String();return this.ledgerMap.has(t)?this.ledgerMap.get(t).wantlist.sortedEntries():new Map}ledgerForPeer(e){const t=e.toB58String(),r=this.ledgerMap.get(t);return r?{peer:r.partner.toB58String(),value:r.debtRatio(),sent:r.accounting.bytesSent,recv:r.accounting.bytesRecv,exchanged:r.exchangeCount}:null}peers(){return Array.from(this.ledgerMap.values()).map(e=>e.partner)}receivedBlocks(e){e.length&&(this.ledgerMap.forEach(t=>{e.map(e=>t.wantlistContains(e)).filter(Boolean).forEach(e=>{this._tasks.push({entry:e,target:t.partner})})}),this._outbox())}messageReceived(e,t,r){const n=this._findOrCreate(e);if(t.empty)return r();if(t.full&&(n.wantlist=new y),this._processBlocks(t.blocks,n),0===t.wantlist.size)return r();let i=[],o=[];t.wantlist.forEach(e=>{e.cancel?(n.cancelWant(e.cid),i.push(e)):(n.wants(e.cid,e.priority),o.push(e))}),this._cancelWants(n,e,i),this._addWants(n,e,o,r)}_cancelWants(e,t,r){const n=t.toB58String();p(this._tasks,r,(e,t)=>{const r=e.target.toB58String()===n,i=e.entry.cid.equals(t.cid);return r&&i})}_addWants(e,t,r,i){n(r,(e,r)=>{this.blockstore.has(e.cid,(n,i)=>{n?this._log.error("failed existence check"):i&&this._tasks.push({entry:e.entry,target:t}),r()})},()=>{this._outbox(),i()})}_processBlocks(e,t,r){const n=[];e.forEach((e,r)=>{this._log("got block (%s bytes)",e.data.length),t.receivedBytes(e.data.length),n.push(e.cid)}),this.receivedBlocks(n)}messageSent(e,t){const r=this._findOrCreate(e);r.sentBytes(t?t.data.length:0),t&&t.cid&&r.wantlist.remove(t.cid)}numBytesSentTo(e){return this._findOrCreate(e).accounting.bytesSent}numBytesReceivedFrom(e){return this._findOrCreate(e).accounting.bytesRecv}peerDisconnected(e){}_findOrCreate(e){const t=e.toB58String();if(this.ledgerMap.has(t))return this.ledgerMap.get(t);const r=new g(e);return this.ledgerMap.set(t,r),this._stats&&this._stats.push(t,"peerCount",1),r}start(e){this._running=!0,s(()=>e())}stop(e){this._running=!1,s(()=>e())}}e.exports=v},function(e,t,r){(function(t){var r=200,n="__lodash_hash_undefined__",i=1/0,o="[object Function]",s="[object GeneratorFunction]",a=/[\\^$.*+?()[\]{}|]/g,u=/^\[object .+?Constructor\]$/,c="object"==typeof t&&t&&t.Object===Object&&t,f="object"==typeof self&&self&&self.Object===Object&&self,l=c||f||Function("return this")();function h(e,t){var r=e?e.length:0;return!!r&&y(e,t,0)>-1}function p(e,t,r){for(var n=-1,i=e?e.length:0;++n<i;)if(r(t,e[n]))return!0;return!1}function d(e,t,r,n){for(var i=e.length,o=r+(n?1:-1);n?o--:++o<i;)if(t(e[o],o,e))return o;return-1}function y(e,t,r){if(t!=t)return d(e,g,r);for(var n=r-1,i=e.length;++n<i;)if(e[n]===t)return n;return-1}function g(e){return e!=e}function m(e,t){return e.has(t)}function b(e,t){return null==e?void 0:e[t]}function v(e){var t=!1;if(null!=e&&"function"!=typeof e.toString)try{t=!!(e+"")}catch(e){}return t}function _(e){var t=-1,r=Array(e.size);return e.forEach(function(e){r[++t]=e}),r}var w=Array.prototype,S=Function.prototype,k=Object.prototype,E=l["__core-js_shared__"],A=(x=/[^.]+$/.exec(E&&E.keys&&E.keys.IE_PROTO||""),x?"Symbol(src)_1."+x:""),x,I=S.toString,T=k.hasOwnProperty,B=k.toString,C=RegExp("^"+I.call(T).replace(a,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),P=w.splice,O=ae(l,"Map"),R=ae(l,"Set"),N=ae(Object,"create");function L(e){var t=-1,r=e?e.length:0;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}function j(){this.__data__=N?N(null):{}}function M(e){return this.has(e)&&delete this.__data__[e]}function K(e){var t=this.__data__;if(N){var r=t[e];return r===n?void 0:r}return T.call(t,e)?t[e]:void 0}function D(e){var t=this.__data__;return N?void 0!==t[e]:T.call(t,e)}function U(e,t){var r=this.__data__;return r[e]=N&&void 0===t?n:t,this}function F(e){var t=-1,r=e?e.length:0;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}function q(){this.__data__=[]}function H(e){var t=this.__data__,r=re(t,e);if(r<0)return!1;var n=t.length-1;return r==n?t.pop():P.call(t,r,1),!0}function z(e){var t=this.__data__,r=re(t,e);return r<0?void 0:t[r][1]}function V(e){return re(this.__data__,e)>-1}function G(e,t){var r=this.__data__,n=re(r,e);return n<0?r.push([e,t]):r[n][1]=t,this}function W(e){var t=-1,r=e?e.length:0;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}function $(){this.__data__={hash:new L,map:new(O||F),string:new L}}function Y(e){return se(this,e).delete(e)}function J(e){return se(this,e).get(e)}function X(e){return se(this,e).has(e)}function Z(e,t){return se(this,e).set(e,t),this}function Q(e){var t=-1,r=e?e.length:0;for(this.__data__=new W;++t<r;)this.add(e[t])}function ee(e){return this.__data__.set(e,n),this}function te(e){return this.__data__.has(e)}function re(e,t){for(var r=e.length;r--;)if(he(e[r][0],t))return r;return-1}function ne(e){if(!de(e)||ce(e))return!1;var t=pe(e)||v(e)?C:u;return t.test(fe(e))}function ie(e,t,n){var i=-1,o=h,s=e.length,a=!0,u=[],c=u;if(n)a=!1,o=p;else if(s>=r){var f=t?null:oe(e);if(f)return _(f);a=!1,o=m,c=new Q}else c=t?[]:u;e:for(;++i<s;){var l=e[i],d=t?t(l):l;if(l=n||0!==l?l:0,a&&d==d){for(var y=c.length;y--;)if(c[y]===d)continue e;t&&c.push(d),u.push(l)}else o(c,d,n)||(c!==u&&c.push(d),u.push(l))}return u}L.prototype.clear=j,L.prototype.delete=M,L.prototype.get=K,L.prototype.has=D,L.prototype.set=U,F.prototype.clear=q,F.prototype.delete=H,F.prototype.get=z,F.prototype.has=V,F.prototype.set=G,W.prototype.clear=$,W.prototype.delete=Y,W.prototype.get=J,W.prototype.has=X,W.prototype.set=Z,Q.prototype.add=Q.prototype.push=ee,Q.prototype.has=te;var oe=R&&1/_(new R([,-0]))[1]==1/0?function(e){return new R(e)}:ye;function se(e,t){var r=e.__data__;return ue(t)?r["string"==typeof t?"string":"hash"]:r.map}function ae(e,t){var r=b(e,t);return ne(r)?r:void 0}function ue(e){var t=typeof e;return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e}function ce(e){return!!A&&A in e}function fe(e){if(null!=e){try{return I.call(e)}catch(e){}try{return e+""}catch(e){}}return""}function le(e,t){return e&&e.length?ie(e,void 0,t):[]}function he(e,t){return e===t||e!=e&&t!=t}function pe(e){var t=de(e)?B.call(e):"";return t==o||t==s}function de(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function ye(){}e.exports=le}).call(this,r(7))},function(e,t,r){(function(e,r){var n=200,i="Expected a function",o="__lodash_hash_undefined__",s=1,a=2,u=1/0,c=9007199254740991,f="[object Arguments]",l="[object Array]",h="[object Boolean]",p="[object Date]",d="[object Error]",y="[object Function]",g="[object GeneratorFunction]",m="[object Map]",b="[object Number]",v="[object Object]",_="[object Promise]",w="[object RegExp]",S="[object Set]",k="[object String]",E="[object Symbol]",A="[object WeakMap]",x="[object ArrayBuffer]",I="[object DataView]",T="[object Float32Array]",B="[object Float64Array]",C="[object Int8Array]",P="[object Int16Array]",O="[object Int32Array]",R="[object Uint8Array]",N="[object Uint8ClampedArray]",L="[object Uint16Array]",j="[object Uint32Array]",M=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,K=/^\w*$/,D=/^\./,U=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,F=/[\\^$.*+?()[\]{}|]/g,q=/\\(\\)?/g,H=/^\[object .+?Constructor\]$/,z=/^(?:0|[1-9]\d*)$/,V={};V[T]=V[B]=V[C]=V[P]=V[O]=V[R]=V[N]=V[L]=V[j]=!0,V[f]=V[l]=V[x]=V[h]=V[I]=V[p]=V[d]=V[y]=V[m]=V[b]=V[v]=V[w]=V[S]=V[k]=V[A]=!1;var G="object"==typeof e&&e&&e.Object===Object&&e,W="object"==typeof self&&self&&self.Object===Object&&self,$=G||W||Function("return this")(),Y="object"==typeof t&&t&&!t.nodeType&&t,J=Y&&"object"==typeof r&&r&&!r.nodeType&&r,X=J&&J.exports===Y,Z=X&&G.process,Q=function(){try{return Z&&Z.binding("util")}catch(e){}}(),ee=Q&&Q.isTypedArray;function te(e,t,r,n){for(var i=-1,o=e?e.length:0;++i<o;){var s=e[i];t(n,s,r(s),e)}return n}function re(e,t){for(var r=-1,n=e?e.length:0;++r<n;)if(t(e[r],r,e))return!0;return!1}function ne(e){return function(t){return null==t?void 0:t[e]}}function ie(e,t){for(var r=-1,n=Array(e);++r<e;)n[r]=t(r);return n}function oe(e){return function(t){return e(t)}}function se(e,t){return null==e?void 0:e[t]}function ae(e){var t=!1;if(null!=e&&"function"!=typeof e.toString)try{t=!!(e+"")}catch(e){}return t}function ue(e){var t=-1,r=Array(e.size);return e.forEach(function(e,n){r[++t]=[n,e]}),r}function ce(e,t){return function(r){return e(t(r))}}function fe(e){var t=-1,r=Array(e.size);return e.forEach(function(e){r[++t]=e}),r}var le=Array.prototype,he=Function.prototype,pe=Object.prototype,de=$["__core-js_shared__"],ye=(ge=/[^.]+$/.exec(de&&de.keys&&de.keys.IE_PROTO||""),ge?"Symbol(src)_1."+ge:""),ge,me=he.toString,be=pe.hasOwnProperty,ve=pe.toString,_e=RegExp("^"+me.call(be).replace(F,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),we=$.Symbol,Se=$.Uint8Array,ke=pe.propertyIsEnumerable,Ee=le.splice,Ae=ce(Object.keys,Object),xe=qt($,"DataView"),Ie=qt($,"Map"),Te=qt($,"Promise"),Be=qt($,"Set"),Ce=qt($,"WeakMap"),Pe=qt(Object,"create"),Oe=er(xe),Re=er(Ie),Ne=er(Te),Le=er(Be),je=er(Ce),Me=we?we.prototype:void 0,Ke=Me?Me.valueOf:void 0,De=Me?Me.toString:void 0;function Ue(e){var t=-1,r=e?e.length:0;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}function Fe(){this.__data__=Pe?Pe(null):{}}function qe(e){return this.has(e)&&delete this.__data__[e]}function He(e){var t=this.__data__;if(Pe){var r=t[e];return r===o?void 0:r}return be.call(t,e)?t[e]:void 0}function ze(e){var t=this.__data__;return Pe?void 0!==t[e]:be.call(t,e)}function Ve(e,t){var r=this.__data__;return r[e]=Pe&&void 0===t?o:t,this}function Ge(e){var t=-1,r=e?e.length:0;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}function We(){this.__data__=[]}function $e(e){var t=this.__data__,r=dt(t,e);if(r<0)return!1;var n=t.length-1;return r==n?t.pop():Ee.call(t,r,1),!0}function Ye(e){var t=this.__data__,r=dt(t,e);return r<0?void 0:t[r][1]}function Je(e){return dt(this.__data__,e)>-1}function Xe(e,t){var r=this.__data__,n=dt(r,e);return n<0?r.push([e,t]):r[n][1]=t,this}function Ze(e){var t=-1,r=e?e.length:0;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}function Qe(){this.__data__={hash:new Ue,map:new(Ie||Ge),string:new Ue}}function et(e){return Ut(this,e).delete(e)}function tt(e){return Ut(this,e).get(e)}function rt(e){return Ut(this,e).has(e)}function nt(e,t){return Ut(this,e).set(e,t),this}function it(e){var t=-1,r=e?e.length:0;for(this.__data__=new Ze;++t<r;)this.add(e[t])}function ot(e){return this.__data__.set(e,o),this}function st(e){return this.__data__.has(e)}function at(e){this.__data__=new Ge(e)}function ut(){this.__data__=new Ge}function ct(e){return this.__data__.delete(e)}function ft(e){return this.__data__.get(e)}function lt(e){return this.__data__.has(e)}function ht(e,t){var r=this.__data__;if(r instanceof Ge){var i=r.__data__;if(!Ie||i.length<n-1)return i.push([e,t]),this;r=this.__data__=new Ze(i)}return r.set(e,t),this}function pt(e,t){var r=or(e)||ir(e)?ie(e.length,String):[],n=r.length,i=!!n;for(var o in e)!t&&!be.call(e,o)||i&&("length"==o||Vt(o,n))||r.push(o);return r}function dt(e,t){for(var r=e.length;r--;)if(nr(e[r][0],t))return r;return-1}function yt(e,t,r,n){return gt(e,function(e,i,o){t(n,e,r(e),o)}),n}Ue.prototype.clear=Fe,Ue.prototype.delete=qe,Ue.prototype.get=He,Ue.prototype.has=ze,Ue.prototype.set=Ve,Ge.prototype.clear=We,Ge.prototype.delete=$e,Ge.prototype.get=Ye,Ge.prototype.has=Je,Ge.prototype.set=Xe,Ze.prototype.clear=Qe,Ze.prototype.delete=et,Ze.prototype.get=tt,Ze.prototype.has=rt,Ze.prototype.set=nt,it.prototype.add=it.prototype.push=ot,it.prototype.has=st,at.prototype.clear=ut,at.prototype.delete=ct,at.prototype.get=ft,at.prototype.has=lt,at.prototype.set=ht;var gt=Lt(bt),mt=jt();function bt(e,t){return e&&mt(e,t,mr)}function vt(e,t){t=Gt(t,e)?[t]:Rt(t);for(var r=0,n=t.length;null!=e&&r<n;)e=e[Qt(t[r++])];return r&&r==n?e:void 0}function _t(e){return ve.call(e)}function wt(e,t){return null!=e&&t in Object(e)}function St(e,t,r,n,i){return e===t||(null==e||null==t||!fr(e)&&!lr(t)?e!=e&&t!=t:kt(e,t,St,r,n,i))}function kt(e,t,r,n,i,o){var s=or(e),u=or(t),c=l,h=l;s||(c=Ht(e),c=c==f?v:c),u||(h=Ht(t),h=h==f?v:h);var p=c==v&&!ae(e),d=h==v&&!ae(t),y=c==h;if(y&&!p)return o||(o=new at),s||pr(e)?Mt(e,t,r,n,i,o):Kt(e,t,c,r,n,i,o);if(!(i&a)){var g=p&&be.call(e,"__wrapped__"),m=d&&be.call(t,"__wrapped__");if(g||m){var b=g?e.value():e,_=m?t.value():t;return o||(o=new at),r(b,_,n,i,o)}}return!!y&&(o||(o=new at),Dt(e,t,r,n,i,o))}function Et(e,t,r,n){var i=r.length,o=i,u=!n;if(null==e)return!o;for(e=Object(e);i--;){var c=r[i];if(u&&c[2]?c[1]!==e[c[0]]:!(c[0]in e))return!1}for(;++i<o;){c=r[i];var f=c[0],l=e[f],h=c[1];if(u&&c[2]){if(void 0===l&&!(f in e))return!1}else{var p=new at;if(n)var d=n(l,h,f,e,t,p);if(!(void 0===d?St(h,l,n,s|a,p):d))return!1}}return!0}function At(e){if(!fr(e)||$t(e))return!1;var t=ur(e)||ae(e)?_e:H;return t.test(er(e))}function xt(e){return lr(e)&&cr(e.length)&&!!V[ve.call(e)]}function It(e){return"function"==typeof e?e:null==e?br:"object"==typeof e?or(e)?Ct(e[0],e[1]):Bt(e):vr(e)}function Tt(e){if(!Yt(e))return Ae(e);var t=[];for(var r in Object(e))be.call(e,r)&&"constructor"!=r&&t.push(r);return t}function Bt(e){var t=Ft(e);return 1==t.length&&t[0][2]?Xt(t[0][0],t[0][1]):function(r){return r===e||Et(r,e,t)}}function Ct(e,t){return Gt(e)&&Jt(t)?Xt(Qt(e),t):function(r){var n=yr(r,e);return void 0===n&&n===t?gr(r,e):St(t,n,void 0,s|a)}}function Pt(e){return function(t){return vt(t,e)}}function Ot(e){if("string"==typeof e)return e;if(hr(e))return De?De.call(e):"";var t=e+"";return"0"==t&&1/e==-u?"-0":t}function Rt(e){return or(e)?e:Zt(e)}function Nt(e,t){return function(r,n){var i=or(r)?te:yt,o=t?t():{};return i(r,e,It(n,2),o)}}function Lt(e,t){return function(r,n){if(null==r)return r;if(!sr(r))return e(r,n);for(var i=r.length,o=t?i:-1,s=Object(r);(t?o--:++o<i)&&!1!==n(s[o],o,s););return r}}function jt(e){return function(t,r,n){for(var i=-1,o=Object(t),s=n(t),a=s.length;a--;){var u=s[e?a:++i];if(!1===r(o[u],u,o))break}return t}}function Mt(e,t,r,n,i,o){var u=i&a,c=e.length,f=t.length;if(c!=f&&!(u&&f>c))return!1;var l=o.get(e);if(l&&o.get(t))return l==t;var h=-1,p=!0,d=i&s?new it:void 0;for(o.set(e,t),o.set(t,e);++h<c;){var y=e[h],g=t[h];if(n)var m=u?n(g,y,h,t,e,o):n(y,g,h,e,t,o);if(void 0!==m){if(m)continue;p=!1;break}if(d){if(!re(t,function(e,t){if(!d.has(t)&&(y===e||r(y,e,n,i,o)))return d.add(t)})){p=!1;break}}else if(y!==g&&!r(y,g,n,i,o)){p=!1;break}}return o.delete(e),o.delete(t),p}function Kt(e,t,r,n,i,o,u){switch(r){case I:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case x:return!(e.byteLength!=t.byteLength||!n(new Se(e),new Se(t)));case h:case p:case b:return nr(+e,+t);case d:return e.name==t.name&&e.message==t.message;case w:case k:return e==t+"";case m:var c=ue;case S:var f=o&a;if(c||(c=fe),e.size!=t.size&&!f)return!1;var l=u.get(e);if(l)return l==t;o|=s,u.set(e,t);var y=Mt(c(e),c(t),n,i,o,u);return u.delete(e),y;case E:if(Ke)return Ke.call(e)==Ke.call(t)}return!1}function Dt(e,t,r,n,i,o){var s=i&a,u=mr(e),c=u.length,f=mr(t),l=f.length;if(c!=l&&!s)return!1;for(var h=c;h--;){var p=u[h];if(!(s?p in t:be.call(t,p)))return!1}var d=o.get(e);if(d&&o.get(t))return d==t;var y=!0;o.set(e,t),o.set(t,e);for(var g=s;++h<c;){p=u[h];var m=e[p],b=t[p];if(n)var v=s?n(b,m,p,t,e,o):n(m,b,p,e,t,o);if(!(void 0===v?m===b||r(m,b,n,i,o):v)){y=!1;break}g||(g="constructor"==p)}if(y&&!g){var _=e.constructor,w=t.constructor;_!=w&&"constructor"in e&&"constructor"in t&&!("function"==typeof _&&_ instanceof _&&"function"==typeof w&&w instanceof w)&&(y=!1)}return o.delete(e),o.delete(t),y}function Ut(e,t){var r=e.__data__;return Wt(t)?r["string"==typeof t?"string":"hash"]:r.map}function Ft(e){for(var t=mr(e),r=t.length;r--;){var n=t[r],i=e[n];t[r]=[n,i,Jt(i)]}return t}function qt(e,t){var r=se(e,t);return At(r)?r:void 0}var Ht=_t;function zt(e,t,r){t=Gt(t,e)?[t]:Rt(t);for(var n,i=-1,o=t.length;++i<o;){var s=Qt(t[i]);if(!(n=null!=e&&r(e,s)))break;e=e[s]}if(n)return n;var o=e?e.length:0;return!!o&&cr(o)&&Vt(s,o)&&(or(e)||ir(e))}function Vt(e,t){return t=null==t?c:t,!!t&&("number"==typeof e||z.test(e))&&e>-1&&e%1==0&&e<t}function Gt(e,t){if(or(e))return!1;var r=typeof e;return!("number"!=r&&"symbol"!=r&&"boolean"!=r&&null!=e&&!hr(e))||(K.test(e)||!M.test(e)||null!=t&&e in Object(t))}function Wt(e){var t=typeof e;return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e}function $t(e){return!!ye&&ye in e}function Yt(e){var t=e&&e.constructor,r="function"==typeof t&&t.prototype||pe;return e===r}function Jt(e){return e==e&&!fr(e)}function Xt(e,t){return function(r){return null!=r&&(r[e]===t&&(void 0!==t||e in Object(r)))}}(xe&&Ht(new xe(new ArrayBuffer(1)))!=I||Ie&&Ht(new Ie)!=m||Te&&Ht(Te.resolve())!=_||Be&&Ht(new Be)!=S||Ce&&Ht(new Ce)!=A)&&(Ht=function(e){var t=ve.call(e),r=t==v?e.constructor:void 0,n=r?er(r):void 0;if(n)switch(n){case Oe:return I;case Re:return m;case Ne:return _;case Le:return S;case je:return A}return t});var Zt=rr(function(e){e=dr(e);var t=[];return D.test(e)&&t.push(""),e.replace(U,function(e,r,n,i){t.push(n?i.replace(q,"$1"):r||e)}),t});function Qt(e){if("string"==typeof e||hr(e))return e;var t=e+"";return"0"==t&&1/e==-u?"-0":t}function er(e){if(null!=e){try{return me.call(e)}catch(e){}try{return e+""}catch(e){}}return""}var tr=Nt(function(e,t,r){be.call(e,r)?e[r].push(t):e[r]=[t]});function rr(e,t){if("function"!=typeof e||t&&"function"!=typeof t)throw new TypeError(i);var r=function(){var n=arguments,i=t?t.apply(this,n):n[0],o=r.cache;if(o.has(i))return o.get(i);var s=e.apply(this,n);return r.cache=o.set(i,s),s};return r.cache=new(rr.Cache||Ze),r}function nr(e,t){return e===t||e!=e&&t!=t}function ir(e){return ar(e)&&be.call(e,"callee")&&(!ke.call(e,"callee")||ve.call(e)==f)}rr.Cache=Ze;var or=Array.isArray;function sr(e){return null!=e&&cr(e.length)&&!ur(e)}function ar(e){return lr(e)&&sr(e)}function ur(e){var t=fr(e)?ve.call(e):"";return t==y||t==g}function cr(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=c}function fr(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function lr(e){return!!e&&"object"==typeof e}function hr(e){return"symbol"==typeof e||lr(e)&&ve.call(e)==E}var pr=ee?oe(ee):xt;function dr(e){return null==e?"":Ot(e)}function yr(e,t,r){var n=null==e?void 0:vt(e,t);return void 0===n?r:n}function gr(e,t){return null!=e&&zt(e,t,wt)}function mr(e){return sr(e)?pt(e):Tt(e)}function br(e){return e}function vr(e){return Gt(e)?ne(Qt(e)):Pt(e)}r.exports=tr}).call(this,r(7),r(28)(e))},function(e,t){function r(e,t){for(var r=-1,n=e?e.length:0,i=Array(n);++r<n;)i[r]=t(e[r],r,e);return i}function n(e,t,r,n){for(var i=e.length,o=r+(n?1:-1);n?o--:++o<i;)if(t(e[o],o,e))return o;return-1}function i(e,t,r){if(t!=t)return n(e,s,r);for(var i=r-1,o=e.length;++i<o;)if(e[i]===t)return i;return-1}function o(e,t,r,n){for(var i=r-1,o=e.length;++i<o;)if(n(e[i],t))return i;return-1}function s(e){return e!=e}function a(e){return function(t){return e(t)}}var u=Array.prototype,c=u.splice;function f(e,t,n,s){var u=s?o:i,f=-1,h=t.length,p=e;for(e===t&&(t=l(t)),n&&(p=r(e,a(n)));++f<h;)for(var d=0,y=t[f],g=n?n(y):y;(d=u(p,g,d,s))>-1;)p!==e&&c.call(p,d,1),c.call(e,d,1);return e}function l(e,t){var r=-1,n=e.length;for(t||(t=Array(n));++r<n;)t[r]=e[r];return t}function h(e,t,r){return e&&e.length&&t&&t.length?f(e,t,void 0,r):e}e.exports=h},function(e,t,r){"use strict";const n=r(187);class i{constructor(e){this.partner=e,this.wantlist=new n,this.exchangeCount=0,this.sentToPeer=new Map,this.accounting={bytesSent:0,bytesRecv:0}}sentBytes(e){this.exchangeCount++,this.lastExchange=(new Date).getTime(),this.accounting.bytesSent+=e}receivedBytes(e){this.exchangeCount++,this.lastExchange=(new Date).getTime(),this.accounting.bytesRecv+=e}wants(e,t){this.wantlist.add(e,t)}cancelWant(e){this.wantlist.remove(e)}wantlistContains(e){return this.wantlist.contains(e)}debtRatio(){return this.accounting.bytesSent/(this.accounting.bytesRecv+1)}}e.exports=i},function(e,t,r){"use strict";const n=r(10).EventEmitter,i=r(281),o=r(115).logger,s=e=>`unwant:${e}`,a=e=>`block:${e}`;class u extends n{constructor(e){super(),this.setMaxListeners(i.maxListeners),this._log=o(e,"notif"),this._unwantListeners={},this._blockListeners={}}hasBlock(e){const t=`block:${e.cid.buffer.toString()}`;this._log(t),this.emit(t,e)}wantBlock(e,t,r){const n=e.buffer.toString();this._log(`wantBlock:${n}`),this._unwantListeners[n]=(()=>{this._log(`manual unwant: ${n}`),this._cleanup(n),r()}),this._blockListeners[n]=(e=>{this._cleanup(n),t(e)}),this.once(s(n),this._unwantListeners[n]),this.once(a(n),this._blockListeners[n])}unwantBlock(e){const t=`unwant:${e.buffer.toString()}`;this._log(t),this.emit(t)}_cleanup(e){this._unwantListeners[e]&&(this.removeListener(s(e),this._unwantListeners[e]),delete this._unwantListeners[e]),this._blockListeners[e]&&(this.removeListener(a(e),this._blockListeners[e]),delete this._blockListeners[e])}}e.exports=u},function(e,t,r){"use strict";const n=r(10),i=r(1052),o={movingAverageIntervals:[6e4,3e5,9e5]};class s extends n{constructor(e,t){super();const r=Object.assign({},o,t);if("number"!=typeof r.computeThrottleTimeout)throw new Error("need computeThrottleTimeout");if("number"!=typeof r.computeThrottleMaxQueueSize)throw new Error("need computeThrottleMaxQueueSize");this._initialCounters=e,this._options=r,this._enabled=this._options.enabled,this._global=new i(e,r),this._global.on("update",e=>this.emit("update",e)),this._peers=new Map}enable(){this._enabled=!0,this._options.enabled=!0,this._global.enable()}disable(){this._enabled=!1,this._options.enabled=!1,this._global.disable()}stop(){this._enabled=!1,this._global.stop();for(let e of this._peers)e[1].stop()}get snapshot(){return this._global.snapshot}get movingAverages(){return this._global.movingAverages}forPeer(e){return e.toB58String&&(e=e.toB58String()),this._peers.get(e)}push(e,t,r){if(this._enabled&&(this._global.push(t,r),e)){let n=this._peers.get(e);n||(n=new i(this._initialCounters,this._options),this._peers.set(e,n)),n.push(t,r)}}disconnected(e){const t=e.toB58String(),r=this._peers.get(t);r&&(r.stop(),this._peers.delete(t))}}e.exports=s},function(e,t,r){"use strict";const n=r(10),i=r(107),o=r(502);class s extends n{constructor(e,t){super(),this._options=t,this._queue=[],this._stats={},this._frequencyLastTime=Date.now(),this._frequencyAccumulators={},this._movingAverages={},this._update=this._update.bind(this),e.forEach(e=>{this._stats[e]=i(0),this._movingAverages[e]={},this._options.movingAverageIntervals.forEach(t=>{const r=this._movingAverages[e][t]=o(t);r.push(this._frequencyLastTime,0)})}),this._enabled=this._options.enabled}enable(){this._enabled=!0}disable(){this._disabled=!0}stop(){this._timeout&&clearTimeout(this._timeout)}get snapshot(){return Object.assign({},this._stats)}get movingAverages(){return Object.assign({},this._movingAverages)}push(e,t){this._enabled&&(this._queue.push([e,t,Date.now()]),this._resetComputeTimeout())}_resetComputeTimeout(){this._timeout&&clearTimeout(this._timeout),this._timeout=setTimeout(this._update,this._nextTimeout())}_nextTimeout(){const e=this._queue.length/this._options.computeThrottleMaxQueueSize;return Math.max(this._options.computeThrottleTimeout*(1-e),0)}_update(){if(this._timeout=null,this._queue.length){let e;for(;this._queue.length;){const t=e=this._queue.shift();this._applyOp(t)}this._updateFrequency(e[2]),this.emit("update",this._stats)}}_updateFrequency(e){const t=e-this._frequencyLastTime;Object.keys(this._stats).forEach(r=>{this._updateFrequencyFor(r,t,e)}),this._frequencyLastTime=e}_updateFrequencyFor(e,t,r){const n=this._frequencyAccumulators[e]||0;this._frequencyAccumulators[e]=0;const i=n/t*1e3;let s=this._movingAverages[e];s||(s=this._movingAverages[e]={}),this._options.movingAverageIntervals.forEach(e=>{let t=s[e];t||(t=s[e]=o(e)),t.push(r,i)})}_applyOp(e){const t=e[0],r=e[1];if("number"!=typeof r)throw new Error("invalid increment number:",r);let n;n=this._stats.hasOwnProperty(t)?this._stats[t]:this._stats[t]=i(0),this._stats[t]=n.plus(r),this._frequencyAccumulators[t]||(this._frequencyAccumulators[t]=0),this._frequencyAccumulators[t]+=r}}e.exports=s},function(e,t,r){"use strict";const n=r(37),i=r(22);e.exports=(e=>i(t=>{if(t=t||function e(){},e.log("stop"),"stopped"===e.state.state())return t(new Error("Already stopped"));if("running"!==e.state.state())return t(new Error("Not able to stop from state: "+e.state.state()));const r=r=>{if(r)return e.emit("error",r),t(r);e.state.stopped(),e.emit("stop"),t()};e.state.stop(),e._blockService.unsetExchange(),e._bitswap.stop(),e._preload.stop(),n([t=>e._mfsPreload.stop(t),t=>e.libp2p.stop(t),t=>e._repo.close(t)],r)}))},function(e,t,r){"use strict";e.exports=function e(t){return()=>Boolean(t._bitswap&&t._libp2pNode&&t._libp2pNode.isStarted())}},function(e,t,r){"use strict";const n=r(503),i=r(22);e.exports=function e(t){return i((e,r)=>{"function"==typeof e&&(r=e,e={}),t.repo.version((e,t)=>{e&&r(e),r(null,{version:n.version,repo:t,commit:""})})})}},function(e,t,r){"use strict";const n=r(22),i=r(3),o=r(503).version;e.exports=function e(t){return n((e,r)=>{"function"==typeof e&&(r=e,e={}),i(()=>r(null,{id:t._peerInfo.id.toB58String(),publicKey:t._peerInfo.id.pubKey.bytes.toString("base64"),addresses:t._peerInfo.multiaddrs.toArray().map(e=>e.toString()).filter(e=>e.indexOf("ipfs")>=0).sort(),agentVersion:`js-ipfs/${o}`,protocolVersion:"9000"}))})}},function(e,t,r){"use strict";const n=r(68),i=r(5),o=r(46),s=r(22),a=r(505),u=r(491),c=r(1058);e.exports=function e(t){return s((e,r)=>{"function"==typeof e&&(r=e,e={});const s=(e,n)=>{if(e)return t.emit("error",e),r(e);t.preStart(e=>{if(e)return t.emit("error",e),r(e);t.state.initialized(),t.emit("init"),r(null,n)})};if("uninitialized"!==t.state.state())return s(new Error("Not able to init from state: "+t.state.state()));if(t.state.init(),t.log("init"),e.repo)return t._repo=e.repo,s(null,!0);e.emptyRepo=e.emptyRepo||!1,e.bits=Number(e.bits)||2048,e.log=e.log||function(){};const f=a();let l;i([e=>t._repo.exists(e),(r,i)=>{if(t.log("repo exists?",r),!0===r)return i(new Error("repo already exists"));e.log(`generating ${e.bits}-bit RSA keypair...`,!1),t.log("generating peer id: %s bits",e.bits),n.create({bits:e.bits},i)},(r,n)=>{t.log("identity generated"),f.Identity={PeerID:r.toB58String(),PrivKey:r.privKey.bytes.toString("base64")},e.pass&&(l=r.privKey,f.Keychain=u.generateOptions()),e.log("done"),e.log("peer identity: "+f.Identity.PeerID),t._repo.init(f,n)},(e,r)=>t._repo.open(r),r=>{if(t.log("repo opened"),e.pass){t.log("creating keychain");const n=Object.assign({passPhrase:e.pass},f.Keychain);t._keychain=new u(t._repo.keys,n),t._keychain.importPeer("self",{privKey:l},r)}else r(null,!0)},(r,n)=>{if(e.emptyRepo)return n(null,!0);const i=[e=>t.object.new("unixfs-dir",e)];"function"==typeof c&&i.push(r=>c(t,e.log,r)),t.log("adding assets"),o(i,e=>{e?n(e):n(null,!0)})}],s)})}},function(e,t){},function(e,t,r){"use strict";const n=r(505),i=r(80).IPFS.matches,o=r(22);function s(e){try{return i(e)}catch(e){return!1}}function a(e){return new Error(`${e} is not a valid Multiaddr`)}e.exports=function e(t){return{list:o(e=>{t._repo.config.get((t,r)=>{if(t)return e(t);e(null,{Peers:r.Bootstrap})})}),add:o((e,r,i)=>{if("function"==typeof r&&(i=r,r={default:!1}),e&&!s(e))return setImmediate(()=>i(a(e)));t._repo.config.get((o,s)=>{if(o)return i(o);r.default?s.Bootstrap=n().Bootstrap:e&&-1===s.Bootstrap.indexOf(e)&&s.Bootstrap.push(e),t._repo.config.set(s,t=>{if(t)return i(t);i(null,{Peers:r.default?n().Bootstrap:[e]})})})}),rm:o((e,r,n)=>{if("function"==typeof r&&(n=r,r={all:!1}),e&&!s(e))return setImmediate(()=>n(a(e)));t._repo.config.get((i,o)=>{if(i)return n(i);r.all?o.Bootstrap=[]:o.Bootstrap=o.Bootstrap.filter(t=>t!==e),t._repo.config.set(o,t=>{if(t)return n(t);const i=[];!r.all&&e&&i.push(e),n(null,{Peers:i})})})})}}},function(e,t,r){"use strict";const n=r(22);e.exports=function e(t){return{get:n((e,r)=>("function"==typeof e&&(r=e,e=void 0),t._repo.config.get(e,r))),set:n((e,r,n)=>{t._repo.config.set(e,r,n)}),replace:n((e,r)=>{t._repo.config.set(e,r)})}}},function(e,t,r){"use strict";const n=r(120),i=r(14),o=r(59),s=r(9),a=r(5),u=r(3),c=r(22),f=r(88);function l(e){return s.isCID(e)?e:new s(e)}e.exports=function e(t){return{get:c((e,r,n)=>{"function"==typeof r&&(n=r,r={}),r=r||{};try{e=l(e)}catch(e){return u(()=>n(f(e,"ERR_INVALID_CID")))}!1!==r.preload&&t._preload(e),t._blockService.get(e,n)}),put:c((e,r,i)=>{if(i=i||function e(){},"function"==typeof r&&(i=r,r={}),Array.isArray(e))return i(new Error("Array is not supported"));a([t=>{if(n.isBlock(e))return t(null,e);if(r.cid&&s.isCID(r.cid))return t(null,new n(e,r.cid));const i=r.mhtype||"sha2-256",a=r.format||"dag-pb",u=r.version||0;o(e,i,(r,i)=>{if(r)return t(r);t(null,new n(e,new s(u,a,i)))})},(e,n)=>t._blockService.put(e,i=>{if(i)return n(i);!1!==r.preload&&t._preload(e.cid),n(null,e)})],i)}),rm:c((e,r)=>{try{e=l(e)}catch(e){return u(()=>r(f(e,"ERR_INVALID_CID")))}t._blockService.delete(e,r)}),stat:c((e,r,n)=>{"function"==typeof r&&(n=r,r={});try{e=l(e)}catch(e){return u(()=>n(f(e,"ERR_INVALID_CID")))}!1!==r.preload&&t._preload(e),t._blockService.get(e,(t,r)=>{if(t)return n(t);n(null,{key:i.toB58String(e.multihash),size:r.data.length})})})}}},function(e,t,r){"use strict";(function(t){const n=r(5),i=r(3),o=r(22),s=r(42),a=s.DAGNode,u=s.DAGLink,c=r(9),f=r(14),l=r(38),h=r(88);function p(e,r){if("string"==typeof e)return"base58"!==r&&r?t.from(e,r):e;if(t.isBuffer(e))return e;throw new Error("unsupported multihash")}function d(e,t,r){switch(t){case"json":return y(e,r);case"protobuf":return g(e,r);default:r(new Error(`unkown encoding: ${t}`))}}function y(e,r){let n,i;try{const o=JSON.parse(e.toString());i=(o.Links||[]).map(e=>new u(e.Name||e.name,e.Size||e.size,f.fromB58String(e.Hash||e.hash||e.multihash))),n=t.from(o.Data)}catch(e){return r(new Error("failed to parse JSON: "+e))}a.create(n,i,r)}function g(e,t){s.util.deserialize(e,t)}e.exports=function e(r){function f(e){return(t,i,o)=>{"function"==typeof i&&(o=i,i={}),n([e=>{r.object.get(t,i,e)},(t,n)=>{e(t,(e,t)=>{if(e)return n(e);const o=new c(t.multihash);r._ipld.put(t,{cid:o},e=>{if(e)return n(e);!1!==i.preload&&r._preload(o),n(null,t)})})}],o)}}return{new:o((e,n,o)=>{let s;if("function"==typeof e&&(o=e,e=void 0,n={}),"function"==typeof n&&(o=n,n={}),n=n||{},e){if("unixfs-dir"!==e)return i(()=>o(new Error("unknown template")));s=new l("directory").marshal()}else s=t.alloc(0);a.create(s,(e,t)=>{if(e)return o(e);const i=new c(t.multihash);r._ipld.put(t,{cid:i},e=>{if(e)return o(e);!1!==n.preload&&r._preload(i),o(null,t)})})}),put:o((e,n,o)=>{"function"==typeof n&&(o=n,n={});const s=n.enc;let u;if(t.isBuffer(e))s?d(e,s,(e,t)=>{if(e)return o(e);u=t,f()}):a.create(e,(e,t)=>{if(e)return o(e);u=t,f()});else if(e.multihash)u=e,f();else{if("object"!=typeof e)return o(new Error("obj not recognized"));a.create(e.Data,e.Links,(e,t)=>{if(e)return o(e);u=t,f()})}function f(){let e;try{e=new c(u.multihash)}catch(e){return i(()=>o(h(e,"ERR_INVALID_CID")))}r._ipld.put(u,{cid:e},t=>{if(t)return o(t);!1!==n.preload&&r._preload(e),r.object.get(u.multihash,o)})}}),get:o((e,t,n)=>{let o,s;"function"==typeof t&&(n=t,t={});try{o=p(e,t.enc)}catch(e){return i(()=>n(h(e,"ERR_INVALID_MULTIHASH")))}try{s=new c(o)}catch(e){return i(()=>n(h(e,"ERR_INVALID_CID")))}1===t.cidVersion&&(s=s.toV1()),!1!==t.preload&&r._preload(s),r._ipld.get(s,(e,t)=>{if(e)return n(e);const r=t.value;n(null,r)})}),data:o((e,t,n)=>{"function"==typeof t&&(n=t,t={}),r.object.get(e,t,(e,t)=>{if(e)return n(e);n(null,t.data)})}),links:o((e,t,n)=>{"function"==typeof t&&(n=t,t={}),r.object.get(e,t,(e,t)=>{if(e)return n(e);n(null,t.links)})}),stat:o((e,t,n)=>{"function"==typeof t&&(n=t,t={}),r.object.get(e,t,(e,t)=>{if(e)return n(e);s.util.serialize(t,(e,r)=>{if(e)return n(e);const i=r.length,o=t.links.reduce((e,t)=>e+t.size,0),s=t.toJSON();n(null,{Hash:s.multihash,NumLinks:t.links.length,BlockSize:i,LinksSize:i-t.data.length,DataSize:t.data.length,CumulativeSize:i+o})})})}),patch:o({addLink(e,t,r,n){f((e,r)=>{a.addLink(e,t,r)})(e,r,n)},rmLink(e,t,r,n){f((e,r)=>{u.isDAGLink(t)?t=t._name:t&&t.name&&(t=t.name),a.rmLink(e,t,r)})(e,r,n)},appendData(e,r,n,i){f((e,n)=>{const i=t.concat([e.data,r]);a.create(i,e.links,n)})(e,n,i)},setData(e,t,r,n){f((e,r)=>{a.create(t,e.links,r)})(e,r,n)}})}}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";e.exports="message Data {\n enum DataType {\n Raw = 0;\n Directory = 1;\n File = 2;\n Metadata = 3;\n Symlink = 4;\n HAMTShard = 5;\n }\n\n required DataType Type = 1;\n optional bytes Data = 2;\n optional uint64 filesize = 3;\n repeated uint64 blocksizes = 4;\n\n optional uint64 hashType = 5;\n optional uint64 fanout = 6;\n}\n\nmessage Metadata {\n optional string MimeType = 1;\n}"},function(e,t,r){"use strict";(function(t){const n=r(22),i=r(9),o=r(8),s=r(74),a=r(3),u=r(1065),c=r(88);e.exports=function e(r){return{put:n((e,t,n)=>{if("function"==typeof t)n=t,t={};else{if(t&&t.cid&&(t.format||t.hashAlg))return n(new Error("Can't put dag node. Please provide either `cid` OR `format` and `hashAlg` options."));if(t&&(t.format&&!t.hashAlg||!t.format&&t.hashAlg))return n(new Error("Can't put dag node. Please provide `format` AND `hashAlg` options."))}t=t||{};const i={format:"dag-cbor",hashAlg:"sha2-256"};t=t.cid?t:Object.assign({},i,t),r._ipld.put(e,t,(e,i)=>{if(e)return n(e);!1!==t.preload&&r._preload(i),n(null,i)})}),get:n((e,n,o,s)=>{if("function"==typeof n&&(s=n,n=void 0),"function"==typeof o&&(s=o,o={}),o=o||{},"string"==typeof e){const t=e.split("/");try{e=new i(t[0])}catch(e){return a(()=>s(c(e,"ERR_INVALID_CID")))}t.shift(),n=t.length>0?t.join("/"):"/"}else if(t.isBuffer(e))try{e=new i(e)}catch(e){return a(()=>s(c(e,"ERR_INVALID_CID")))}!1!==o.preload&&r._preload(e),r._ipld.get(e,n,o,s)}),tree:n((e,t,n,s)=>{if("object"==typeof t&&(s=n,n=t,t=void 0),"function"==typeof t&&(s=t,t=void 0),"function"==typeof n&&(s=n,n={}),n=n||{},"string"==typeof e){const r=e.split("/");try{e=new i(r[0])}catch(e){return a(()=>s(c(e,"ERR_INVALID_CID")))}r.shift(),t=r.length>0?r.join("/"):void 0}!1!==n.preload&&r._preload(e),o(r._ipld.treeStream(e,t,n),o.collect(s))}),_getRecursive:n((e,t,n)=>{let o;"function"==typeof t&&(n=t,t={}),t=t||{};try{o=new i(e)}catch(e){return a(()=>n(c(e,"ERR_INVALID_CID")))}r.dag.get(o,"",t,(e,t)=>{if(e)return n(e);s(t.value.links,(e,t)=>{r.dag._getRecursive(e.multihash,t)},(e,r)=>{if(e)return n(e);n(null,u([t.value,r]))})})})}}}).call(this,r(0).Buffer)},function(e,t,r){var n=r(1066),i=1/0;function o(e){var t=null==e?0:e.length;return t?n(e,i):[]}e.exports=o},function(e,t,r){var n=r(1067),i=r(1068);function o(e,t,r,s,a){var u=-1,c=e.length;for(r||(r=i),a||(a=[]);++u<c;){var f=e[u];t>0&&r(f)?t>1?o(f,t-1,r,s,a):n(a,f):s||(a[a.length]=f)}return a}e.exports=o},function(e,t){function r(e,t){for(var r=-1,n=t.length,i=e.length;++r<n;)e[i+r]=t[r];return e}e.exports=r},function(e,t,r){var n=r(157),i=r(351),o=r(91),s=n?n.isConcatSpreadable:void 0;function a(e){return o(e)||i(e)||!!(s&&e&&e[s])}e.exports=a},function(e,t,r){"use strict";const n=r(1070),i=r(22),o=r(569),s=r(573);e.exports=function e(t){return{start:i(e=>{function r(r,i){if(r)return e(r);const a={peerInfo:t._peerInfo,peerBook:t._peerInfoBook,config:{peerDiscovery:{mdns:{enabled:o(t._options,"config.Discovery.MDNS.Enabled",o(i,"Discovery.MDNS.Enabled",!0))},webRTCStar:{enabled:o(t._options,"config.Discovery.webRTCStar.Enabled",o(i,"Discovery.webRTCStar.Enabled",!0))},bootstrap:{list:o(t._options,"config.Bootstrap",o(i,"Bootstrap",[]))}},relay:{enabled:o(t._options,"relay.enabled",o(i,"relay.enabled",!1)),hop:{enabled:o(t._options,"relay.hop.enabled",o(i,"relay.hop.enabled",!1)),active:o(t._options,"relay.hop.active",o(i,"relay.hop.active",!1))}},EXPERIMENTAL:{dht:o(t._options,"EXPERIMENTAL.dht",!1),pubsub:o(t._options,"EXPERIMENTAL.pubsub",!1)}},connectionManager:o(t._options,"connectionManager",o(i,"connectionManager",{}))},u=s(o(t._options,"libp2p",{}),a);t._libp2pNode=new n(u),t._libp2pNode.on("peer:discovery",e=>{const r=()=>{t._peerInfoBook.put(e),t._libp2pNode.dial(e,()=>{})};t.isOnline()?r():t._libp2pNode.once("start",r)}),t._libp2pNode.on("peer:connect",e=>{t._peerInfoBook.put(e)}),t._libp2pNode.start(r=>{if(r)return e(r);t._libp2pNode.peerInfo.multiaddrs.forEach(e=>{console.log("Swarm listening on",e.toString())}),e()})}t.config.get(r)}),stop:i(e=>{t._libp2pNode.stop(e)})}}},function(e,t,r){"use strict";const n=r(506),i=r(1084),o=r(1124),s=r(1145),a=r(1153),u=r(1177),c=r(1195),f=r(573);class l extends c{constructor(e){const t=new i({id:e.peerInfo.id}),r=new o({id:e.peerInfo.id}),c={modules:{transport:[n,t,r],streamMuxer:[s],connEncryption:[a],peerDiscovery:[t.discovery,r.discovery,u]},config:{peerDiscovery:{bootstrap:{enabled:!0},webRTCStar:{enabled:!0},websocketStar:{enabled:!0}},EXPERIMENTAL:{dht:!1,pubsub:!1}}};super(f(e,c))}}e.exports=l},function(e,t,r){"use strict";var n=r(1072),i=r(1074),o=r(1078);function s(e){return"function"==typeof e}e.exports=function(e,t){s(t)&&(t={onConnect:t});var r="undefined"==typeof window?{}:window.location,a=o(e,r),u=new n(a),c=i(u,t);return c.remoteAddress=a,c.close=function(e){s(e)&&u.addEventListener("close",e),u.close()},u.addEventListener("open",function(e){t&&s(t.onConnect)&&t.onConnect(null,c)}),c},e.exports.connect=e.exports},function(e,t,r){e.exports="undefined"==typeof WebSocket?r(1073):WebSocket},function(e,t){},function(e,t,r){var n=r(1075),i=r(1076);function o(e,t){var r=e.upgradeReq||{};return t&&t.binaryType?e.binaryType=t.binaryType:t&&t.binary&&(e.binaryType="arraybuffer"),{source:n(e,t&&t.onConnect),sink:i(e,t),headers:r.headers,url:r.url,upgrade:r.upgrade,method:r.method}}e.exports=o},function(e,t,r){var n=r(2).Buffer;function i(e){return e instanceof ArrayBuffer||null!=e&&null!=e.constructor&&"ArrayBuffer"===e.constructor.name&&"number"==typeof e.byteLength}e.exports=function(e,t){var r=[],o,s,a=!1;function u(t,n){if(o=null,s)return n(s);t?(o=n,e.close()):r.length>0?n(null,r.shift()):o=n}return e.addEventListener("message",function(e){var t=e.data;if(i(t)&&(t=n.from(t)),o)return o(null,t);r.push(t)}),e.addEventListener("close",function(e){s||o&&o(s=!0)}),e.addEventListener("error",function(e){s||(s=e,a||(a=!0,t&&t(e)),o&&o(s))}),e.addEventListener("open",function(e){a||s||(a=!0)}),u}},function(e,t,r){(function(t){var n=r(1077),i="undefined"!=typeof setImmediate?setImmediate:t.nextTick;e.exports=function(e,t){return function(r){t=t||{};var o=!1!==t.closeOnEnd,s="function"==typeof t?t:t.onClose;function a(t,u){t?o&&e.readyState<=1&&(s&&e.addEventListener("close",function(e){if(e.wasClean||1006===e.code)s();else{var t=new Error("ws error");t.event=e,s(t)}}),e.close()):n(e,function(t){if(t)return r(t,function(){});e.send(u),i(function(){r(null,a)})})}r(null,a)}}}).call(this,r(6))},function(e,t){e.exports=function(e,t){var r=e&&(e.removeEventListener||e.removeListener);function n(){"function"==typeof r&&(r.call(e,"open",i),r.call(e,"error",o))}function i(e){n(),t()}function o(e){n(),t(e)}return e.readyState>=2?t(!0):1===e.readyState?t():(e.addEventListener("open",i),void e.addEventListener("error",o))}},function(e,t,r){var n=r(1079),i={http:"ws",https:"wss"},o="ws";e.exports=function(e,t){return n(e,t,i,o)}},function(e,t,r){var n=r(36);e.exports=function(e,t,r,i){r=r||{};var e=n.parse(e,!1,!0),o;return e.protocol?o=e.protocol:(o=t.protocol?t.protocol.replace(/:$/,""):"http",o=(r[o]||i||o)+":"),e.host&&":"===e.host[0]&&(e.host=null),e.hostname?n.format({protocol:o,slashes:!0,hostname:e.hostname,port:e.port,pathname:e.pathname,search:e.search}):(e.host=t.host,e.port?n.format({protocol:o,slashes:!0,host:t.hostname+":"+e.port,port:e.port,pathname:e.pathname,search:e.search}):e.pathname?n.format({protocol:o,slashes:!0,host:e.host,pathname:e.pathname,search:e.search}):(e.pathname=t.pathname,e.search?n.format({protocol:o,slashes:!0,host:e.host,pathname:e.pathname,search:e.search}):(e.search=t.search,e.format(e))))}},function(e,t){var r=1/0,n=9007199254740991,i=1.7976931348623157e308,o=NaN,s="[object Arguments]",a="[object Function]",u="[object GeneratorFunction]",c="[object String]",f="[object Symbol]",l=/^\s+|\s+$/g,h=/^[-+]0x[0-9a-f]+$/i,p=/^0b[01]+$/i,d=/^0o[0-7]+$/i,y=/^(?:0|[1-9]\d*)$/,g=parseInt;function m(e,t){for(var r=-1,n=e?e.length:0,i=Array(n);++r<n;)i[r]=t(e[r],r,e);return i}function b(e,t,r,n){for(var i=e.length,o=r+(n?1:-1);n?o--:++o<i;)if(t(e[o],o,e))return o;return-1}function v(e,t,r){if(t!=t)return b(e,_,r);for(var n=r-1,i=e.length;++n<i;)if(e[n]===t)return n;return-1}function _(e){return e!=e}function w(e,t){for(var r=-1,n=Array(e);++r<e;)n[r]=t(r);return n}function S(e,t){return m(t,function(t){return e[t]})}function k(e,t){return function(r){return e(t(r))}}var E=Object.prototype,A=E.hasOwnProperty,x=E.toString,I=E.propertyIsEnumerable,T=k(Object.keys,Object),B=Math.max;function C(e,t){var r=j(e)||L(e)?w(e.length,String):[],n=r.length,i=!!n;for(var o in e)!t&&!A.call(e,o)||i&&("length"==o||O(o,n))||r.push(o);return r}function P(e){if(!R(e))return T(e);var t=[];for(var r in Object(e))A.call(e,r)&&"constructor"!=r&&t.push(r);return t}function O(e,t){return t=null==t?n:t,!!t&&("number"==typeof e||y.test(e))&&e>-1&&e%1==0&&e<t}function R(e){var t=e&&e.constructor,r="function"==typeof t&&t.prototype||E;return e===r}function N(e,t,r,n){e=M(e)?e:Y(e),r=r&&!n?G(r):0;var i=e.length;return r<0&&(r=B(i+r,0)),H(e)?r<=i&&e.indexOf(t,r)>-1:!!i&&v(e,t,r)>-1}function L(e){return K(e)&&A.call(e,"callee")&&(!I.call(e,"callee")||x.call(e)==s)}var j=Array.isArray;function M(e){return null!=e&&U(e.length)&&!D(e)}function K(e){return q(e)&&M(e)}function D(e){var t=F(e)?x.call(e):"";return t==a||t==u}function U(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=n}function F(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function q(e){return!!e&&"object"==typeof e}function H(e){return"string"==typeof e||!j(e)&&q(e)&&x.call(e)==c}function z(e){return"symbol"==typeof e||q(e)&&x.call(e)==f}function V(e){if(!e)return 0===e?e:0;if(e=W(e),e===r||e===-r){var t=e<0?-1:1;return t*i}return e==e?e:0}function G(e){var t=V(e),r=t%1;return t==t?r?t-r:t:0}function W(e){if("number"==typeof e)return e;if(z(e))return o;if(F(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=F(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=e.replace(l,"");var r=p.test(e);return r||d.test(e)?g(e.slice(2),r?2:8):h.test(e)?o:+e}function $(e){return M(e)?C(e):P(e)}function Y(e){return e?S(e,$(e)):[]}e.exports=N},function(e,t,r){"use strict";const n=r(377);e.exports=class e{constructor(e,t){this.peerInfo=null,this.conn=n(),e?this.setInnerConn(e,t):t&&(this.info=t)}get source(){return this.conn.source}get sink(){return this.conn.sink}getPeerInfo(e){return this.info&&this.info.getPeerInfo?this.info.getPeerInfo(e):this.peerInfo?void e(null,this.peerInfo):e(new Error("Peer Info not set yet"))}setPeerInfo(e){if(this.info&&this.info.setPeerInfo)return this.info.setPeerInfo(e);this.peerInfo=e}getObservedAddrs(e){if(this.info&&this.info.getObservedAddrs)return this.info.getObservedAddrs(e);e(null,[])}setInnerConn(e,t){this.conn.resolve(e),this.info=t||e}}},function(e,t,r){"use strict";const n=r(1),i=n("libp2p:websockets:dialer");function o(e){const t=e.toString().split("/");let r,n;try{r=e.protoNames().filter(e=>"ws"===e||"wss"===e)[0]}catch(e){throw i(e),new Error("Not a valid websocket address",e)}try{n=e.stringTuples().filter(t=>{if(t[0]===e.protos().filter(e=>"tcp"===e.name)[0].code)return!0})[0][1]}catch(e){i("No port, skipping")}let o=`${r}://${t[2]}${!n||80===n&&443===n?"":`:${n}`}`;return o}e.exports=o},function(e,t,r){"use strict";e.exports=function(){throw new Error("WebSocket Servers can not be created in the browser!")}},function(e,t,r){"use strict";const n=r(1),i=n("libp2p:webrtc-star"),o=r(31),s=r(80),a=r(73),u=r(507),c=r(10).EventEmitter,f=r(191),l=r(1104),h=r(52),p=r(44).Connection,d=r(141),y=r(35),g=r(3),m=r(1122),b=r(1123),v=b.cleanUrlSIO,_=b.cleanMultiaddr,w=y(()=>{}),S={transports:["websocket"],"force new connection":!0};class k{constructor(e){e=e||{},this.maSelf=void 0,this.sioOptions={transports:["websocket"],"force new connection":!0},e.wrtc&&(this.wrtc=e.wrtc),this.discovery=new c,this.discovery.tag="webRTCStar",this.discovery.start=(e=>{g(e)}),this.discovery.stop=(e=>{g(e)}),this.listenersRefs={},this._peerDiscovered=this._peerDiscovered.bind(this)}dial(e,t,r){"function"==typeof t&&(r=t,t={}),r=r?y(r):w;const n=(~~(1e9*Math.random())).toString(36)+Date.now(),i=this.listenersRefs[Object.keys(this.listenersRefs)[0]].io,o={initiator:!0,trickle:!1};this.wrtc&&(o.wrtc=this.wrtc);const s=new f(o),a=new p(d.duplex(s));let u=!1;return s.on("signal",t=>{i.emit("ss-handshake",{intentId:n,srcMultiaddr:this.maSelf.toString(),dstMultiaddr:e.toString(),signal:t})}),s.once("timeout",()=>r(new Error("timeout"))),s.once("error",e=>{u||r(e)}),i.on("ws-handshake",t=>{if(t.intentId===n&&t.err)return r(new Error(t.err));t.intentId===n&&t.answer&&(s.once("connect",()=>{u=!0,a.destroy=s.destroy.bind(s),s.once("close",()=>a.destroy()),a.getObservedAddrs=(t=>t(null,[e])),r(null,a)}),s.signal(t.signal))}),a}createListener(e,t){"function"==typeof e&&(t=e,e={});const r=new c;return r.listen=((e,n)=>{if(n=n?y(n):w,!m.support&&!this.wrtc)return g(()=>n(new Error("no WebRTC support")));this.maSelf=e;const o=v(e);i("Dialing to Signalling Server on: "+o),r.io=u.connect(o,S),r.io.once("connect_error",n),r.io.once("error",e=>{r.emit("error",e),r.emit("close")}),r.io.on("ws-handshake",a),r.io.on("ws-peer",this._peerDiscovered),r.io.on("connect",()=>{r.io.emit("ss-join",e.toString())}),r.io.once("connect",()=>{r.emit("listening"),n()});const s=this;function a(e){if(e.answer||e.err)return;const n={trickle:!1};s.wrtc&&(n.wrtc=s.wrtc);const i=new f(n),o=new p(d.duplex(i));i.once("connect",()=>{o.getObservedAddrs=(t=>t(null,[e.srcMultiaddr])),r.emit("connection",o),t(o)}),i.once("signal",t=>{e.signal=t,e.answer=!0,r.io.emit("ss-handshake",e)}),i.signal(e.signal)}}),r.close=(e=>{e=e?y(e):w,r.io.emit("ss-leave"),g(()=>{r.emit("close"),e()})}),r.getAddrs=(e=>{g(()=>e(null,[this.maSelf]))}),this.listenersRefs[o.toString()]=r,r}filter(e){return Array.isArray(e)||(e=[e]),e.filter(e=>!(e.protoNames().indexOf("p2p-circuit")>-1)&&s.WebRTCStar.matches(e))}_peerDiscovered(e){i("Peer Discovered:",e),e=_(e);const t=e.split("/ipfs/"),r=t[t.length-1],n=l.createFromB58String(r),s=new h(n);s.multiaddrs.add(o(e)),this.discovery.emit("peer",s)}}e.exports=a(k,{className:"WebRTCStar",symbolName:"@libp2p/js-libp2p-webrtc-star/webrtcstar"})},function(e,t,r){(function(t){var n=r(508),i=r(1)("socket.io-client:url");function o(e,r){var o=e;r=r||t.location,null==e&&(e=r.protocol+"//"+r.host),"string"==typeof e&&("/"===e.charAt(0)&&(e="/"===e.charAt(1)?r.protocol+e:r.host+e),/^(https?|wss?):\/\//.test(e)||(i("protocol-less url %s",e),e=void 0!==r?r.protocol+"//"+e:"https://"+e),i("parse %s",e),o=n(e)),o.port||(/^(http|ws)$/.test(o.protocol)?o.port="80":/^(http|ws)s$/.test(o.protocol)&&(o.port="443")),o.path=o.path||"/";var s=-1!==o.host.indexOf(":"),a=s?"["+o.host+"]":o.host;return o.id=o.protocol+"://"+a+":"+o.port,o.href=o.protocol+"://"+a+(r&&r.port===o.port?"":":"+o.port),o}e.exports=o}).call(this,r(7))},function(e,t,r){(function(e){var n=r(509),i=r(510),o=Object.prototype.toString,s="function"==typeof e.Blob||"[object BlobConstructor]"===o.call(e.Blob),a="function"==typeof e.File||"[object FileConstructor]"===o.call(e.File);function u(e,t){if(!e)return e;if(i(e)){var r={_placeholder:!0,num:t.length};return t.push(e),r}if(n(e)){for(var o=new Array(e.length),s=0;s<e.length;s++)o[s]=u(e[s],t);return o}if("object"==typeof e&&!(e instanceof Date)){var o={};for(var a in e)o[a]=u(e[a],t);return o}return e}function c(e,t){if(!e)return e;if(e&&e._placeholder)return t[e.num];if(n(e))for(var r=0;r<e.length;r++)e[r]=c(e[r],t);else if("object"==typeof e)for(var i in e)e[i]=c(e[i],t);return e}t.deconstructPacket=function(e){var t=[],r=e.data,n=e;return n.data=u(r,t),n.attachments=t.length,{packet:n,buffers:t}},t.reconstructPacket=function(e,t){return e.data=c(e.data,t),e.attachments=void 0,e},t.removeBlobs=function(e,t){function r(e,c,f){if(!e)return e;if(s&&e instanceof Blob||a&&e instanceof File){o++;var l=new FileReader;l.onload=function(){f?f[c]=this.result:u=this.result,--o||t(u)},l.readAsArrayBuffer(e)}else if(n(e))for(var h=0;h<e.length;h++)r(e[h],h,e);else if("object"==typeof e&&!i(e))for(var p in e)r(e[p],p,e)}var o=0,u=e;r(u),o||t(u)}}).call(this,r(7))},function(e,t,r){e.exports=r(1088),e.exports.parser=r(117)},function(e,t,r){(function(t){var n=r(512),i=r(116),o=r(1)("engine.io-client:socket"),s=r(261),a=r(117),u=r(508),c=r(189);function f(e,r){if(!(this instanceof f))return new f(e,r);r=r||{},e&&"object"==typeof e&&(r=e,e=null),e?(e=u(e),r.hostname=e.host,r.secure="https"===e.protocol||"wss"===e.protocol,r.port=e.port,e.query&&(r.query=e.query)):r.host&&(r.hostname=u(r.host).host),this.secure=null!=r.secure?r.secure:t.location&&"https:"===location.protocol,r.hostname&&!r.port&&(r.port=this.secure?"443":"80"),this.agent=r.agent||!1,this.hostname=r.hostname||(t.location?location.hostname:"localhost"),this.port=r.port||(t.location&&location.port?location.port:this.secure?443:80),this.query=r.query||{},"string"==typeof this.query&&(this.query=c.decode(this.query)),this.upgrade=!1!==r.upgrade,this.path=(r.path||"/engine.io").replace(/\/$/,"")+"/",this.forceJSONP=!!r.forceJSONP,this.jsonp=!1!==r.jsonp,this.forceBase64=!!r.forceBase64,this.enablesXDR=!!r.enablesXDR,this.timestampParam=r.timestampParam||"t",this.timestampRequests=r.timestampRequests,this.transports=r.transports||["polling","websocket"],this.transportOptions=r.transportOptions||{},this.readyState="",this.writeBuffer=[],this.prevBufferLen=0,this.policyPort=r.policyPort||843,this.rememberUpgrade=r.rememberUpgrade||!1,this.binaryType=null,this.onlyBinaryUpgrades=r.onlyBinaryUpgrades,this.perMessageDeflate=!1!==r.perMessageDeflate&&(r.perMessageDeflate||{}),!0===this.perMessageDeflate&&(this.perMessageDeflate={}),this.perMessageDeflate&&null==this.perMessageDeflate.threshold&&(this.perMessageDeflate.threshold=1024),this.pfx=r.pfx||null,this.key=r.key||null,this.passphrase=r.passphrase||null,this.cert=r.cert||null,this.ca=r.ca||null,this.ciphers=r.ciphers||null,this.rejectUnauthorized=void 0===r.rejectUnauthorized||r.rejectUnauthorized,this.forceNode=!!r.forceNode;var n="object"==typeof t&&t;n.global===n&&(r.extraHeaders&&Object.keys(r.extraHeaders).length>0&&(this.extraHeaders=r.extraHeaders),r.localAddress&&(this.localAddress=r.localAddress)),this.id=null,this.upgrades=null,this.pingInterval=null,this.pingTimeout=null,this.pingIntervalTimer=null,this.pingTimeoutTimer=null,this.open()}function l(e){var t={};for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r]);return t}e.exports=f,f.priorWebsocketSuccess=!1,i(f.prototype),f.protocol=a.protocol,f.Socket=f,f.Transport=r(284),f.transports=r(512),f.parser=r(117),f.prototype.createTransport=function(e){o('creating transport "%s"',e);var t=l(this.query);t.EIO=a.protocol,t.transport=e;var r=this.transportOptions[e]||{};this.id&&(t.sid=this.id);var i=new n[e]({query:t,socket:this,agent:r.agent||this.agent,hostname:r.hostname||this.hostname,port:r.port||this.port,secure:r.secure||this.secure,path:r.path||this.path,forceJSONP:r.forceJSONP||this.forceJSONP,jsonp:r.jsonp||this.jsonp,forceBase64:r.forceBase64||this.forceBase64,enablesXDR:r.enablesXDR||this.enablesXDR,timestampRequests:r.timestampRequests||this.timestampRequests,timestampParam:r.timestampParam||this.timestampParam,policyPort:r.policyPort||this.policyPort,pfx:r.pfx||this.pfx,key:r.key||this.key,passphrase:r.passphrase||this.passphrase,cert:r.cert||this.cert,ca:r.ca||this.ca,ciphers:r.ciphers||this.ciphers,rejectUnauthorized:r.rejectUnauthorized||this.rejectUnauthorized,perMessageDeflate:r.perMessageDeflate||this.perMessageDeflate,extraHeaders:r.extraHeaders||this.extraHeaders,forceNode:r.forceNode||this.forceNode,localAddress:r.localAddress||this.localAddress,requestTimeout:r.requestTimeout||this.requestTimeout,protocols:r.protocols||void 0});return i},f.prototype.open=function(){var e;if(this.rememberUpgrade&&f.priorWebsocketSuccess&&-1!==this.transports.indexOf("websocket"))e="websocket";else{if(0===this.transports.length){var t=this;return void setTimeout(function(){t.emit("error","No transports available")},0)}e=this.transports[0]}this.readyState="opening";try{e=this.createTransport(e)}catch(e){return this.transports.shift(),void this.open()}e.open(),this.setTransport(e)},f.prototype.setTransport=function(e){o("setting transport %s",e.name);var t=this;this.transport&&(o("clearing existing transport %s",this.transport.name),this.transport.removeAllListeners()),this.transport=e,e.on("drain",function(){t.onDrain()}).on("packet",function(e){t.onPacket(e)}).on("error",function(e){t.onError(e)}).on("close",function(){t.onClose("transport close")})},f.prototype.probe=function(e){o('probing transport "%s"',e);var t=this.createTransport(e,{probe:1}),r=!1,n=this;function i(){if(n.onlyBinaryUpgrades){var i=!this.supportsBinary&&n.transport.supportsBinary;r=r||i}r||(o('probe transport "%s" opened',e),t.send([{type:"ping",data:"probe"}]),t.once("packet",function(i){if(!r)if("pong"===i.type&&"probe"===i.data){if(o('probe transport "%s" pong',e),n.upgrading=!0,n.emit("upgrading",t),!t)return;f.priorWebsocketSuccess="websocket"===t.name,o('pausing current transport "%s"',n.transport.name),n.transport.pause(function(){r||"closed"!==n.readyState&&(o("changing transport and sending upgrade packet"),h(),n.setTransport(t),t.send([{type:"upgrade"}]),n.emit("upgrade",t),t=null,n.upgrading=!1,n.flush())})}else{o('probe transport "%s" failed',e);var s=new Error("probe error");s.transport=t.name,n.emit("upgradeError",s)}}))}function s(){r||(r=!0,h(),t.close(),t=null)}function a(r){var i=new Error("probe error: "+r);i.transport=t.name,s(),o('probe transport "%s" failed because of error: %s',e,r),n.emit("upgradeError",i)}function u(){a("transport closed")}function c(){a("socket closed")}function l(e){t&&e.name!==t.name&&(o('"%s" works - aborting "%s"',e.name,t.name),s())}function h(){t.removeListener("open",i),t.removeListener("error",a),t.removeListener("close",u),n.removeListener("close",c),n.removeListener("upgrading",l)}f.priorWebsocketSuccess=!1,t.once("open",i),t.once("error",a),t.once("close",u),this.once("close",c),this.once("upgrading",l),t.open()},f.prototype.onOpen=function(){if(o("socket open"),this.readyState="open",f.priorWebsocketSuccess="websocket"===this.transport.name,this.emit("open"),this.flush(),"open"===this.readyState&&this.upgrade&&this.transport.pause){o("starting upgrade probes");for(var e=0,t=this.upgrades.length;e<t;e++)this.probe(this.upgrades[e])}},f.prototype.onPacket=function(e){if("opening"===this.readyState||"open"===this.readyState||"closing"===this.readyState)switch(o('socket receive: type "%s", data "%s"',e.type,e.data),this.emit("packet",e),this.emit("heartbeat"),e.type){case"open":this.onHandshake(JSON.parse(e.data));break;case"pong":this.setPing(),this.emit("pong");break;case"error":var t=new Error("server error");t.code=e.data,this.onError(t);break;case"message":this.emit("data",e.data),this.emit("message",e.data)}else o('packet received with socket readyState "%s"',this.readyState)},f.prototype.onHandshake=function(e){this.emit("handshake",e),this.id=e.sid,this.transport.query.sid=e.sid,this.upgrades=this.filterUpgrades(e.upgrades),this.pingInterval=e.pingInterval,this.pingTimeout=e.pingTimeout,this.onOpen(),"closed"!==this.readyState&&(this.setPing(),this.removeListener("heartbeat",this.onHeartbeat),this.on("heartbeat",this.onHeartbeat))},f.prototype.onHeartbeat=function(e){clearTimeout(this.pingTimeoutTimer);var t=this;t.pingTimeoutTimer=setTimeout(function(){"closed"!==t.readyState&&t.onClose("ping timeout")},e||t.pingInterval+t.pingTimeout)},f.prototype.setPing=function(){var e=this;clearTimeout(e.pingIntervalTimer),e.pingIntervalTimer=setTimeout(function(){o("writing ping packet - expecting pong within %sms",e.pingTimeout),e.ping(),e.onHeartbeat(e.pingTimeout)},e.pingInterval)},f.prototype.ping=function(){var e=this;this.sendPacket("ping",function(){e.emit("ping")})},f.prototype.onDrain=function(){this.writeBuffer.splice(0,this.prevBufferLen),this.prevBufferLen=0,0===this.writeBuffer.length?this.emit("drain"):this.flush()},f.prototype.flush=function(){"closed"!==this.readyState&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length&&(o("flushing %d packets in socket",this.writeBuffer.length),this.transport.send(this.writeBuffer),this.prevBufferLen=this.writeBuffer.length,this.emit("flush"))},f.prototype.write=f.prototype.send=function(e,t,r){return this.sendPacket("message",e,t,r),this},f.prototype.sendPacket=function(e,t,r,n){if("function"==typeof t&&(n=t,t=void 0),"function"==typeof r&&(n=r,r=null),"closing"!==this.readyState&&"closed"!==this.readyState){r=r||{},r.compress=!1!==r.compress;var i={type:e,data:t,options:r};this.emit("packetCreate",i),this.writeBuffer.push(i),n&&this.once("flush",n),this.flush()}},f.prototype.close=function(){if("opening"===this.readyState||"open"===this.readyState){this.readyState="closing";var e=this;this.writeBuffer.length?this.once("drain",function(){this.upgrading?n():t()}):this.upgrading?n():t()}function t(){e.onClose("forced close"),o("socket closing - telling transport to close"),e.transport.close()}function r(){e.removeListener("upgrade",r),e.removeListener("upgradeError",r),t()}function n(){e.once("upgrade",r),e.once("upgradeError",r)}return this},f.prototype.onError=function(e){o("socket error %j",e),f.priorWebsocketSuccess=!1,this.emit("error",e),this.onClose("transport error",e)},f.prototype.onClose=function(e,t){if("opening"===this.readyState||"open"===this.readyState||"closing"===this.readyState){o('socket close with reason: "%s"',e);var r=this;clearTimeout(this.pingIntervalTimer),clearTimeout(this.pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),this.readyState="closed",this.id=null,this.emit("close",e,t),this.writeBuffer=[],this.prevBufferLen=0}},f.prototype.filterUpgrades=function(e){for(var t=[],r=0,n=e.length;r<n;r++)~s(this.transports,e[r])&&t.push(e[r]);return t}}).call(this,r(7))},function(e,t){try{e.exports="undefined"!=typeof XMLHttpRequest&&"withCredentials"in new XMLHttpRequest}catch(t){e.exports=!1}},function(e,t,r){(function(t){var n=r(283),i=r(513),o=r(116),s=r(190),a=r(1)("engine.io-client:polling-xhr");function u(){}function c(e){if(i.call(this,e),this.requestTimeout=e.requestTimeout,this.extraHeaders=e.extraHeaders,t.location){var r="https:"===location.protocol,n=location.port;n||(n=r?443:80),this.xd=e.hostname!==t.location.hostname||n!==e.port,this.xs=e.secure!==r}}function f(e){this.method=e.method||"GET",this.uri=e.uri,this.xd=!!e.xd,this.xs=!!e.xs,this.async=!1!==e.async,this.data=void 0!==e.data?e.data:null,this.agent=e.agent,this.isBinary=e.isBinary,this.supportsBinary=e.supportsBinary,this.enablesXDR=e.enablesXDR,this.requestTimeout=e.requestTimeout,this.pfx=e.pfx,this.key=e.key,this.passphrase=e.passphrase,this.cert=e.cert,this.ca=e.ca,this.ciphers=e.ciphers,this.rejectUnauthorized=e.rejectUnauthorized,this.extraHeaders=e.extraHeaders,this.create()}function l(){for(var e in f.requests)f.requests.hasOwnProperty(e)&&f.requests[e].abort()}e.exports=c,e.exports.Request=f,s(c,i),c.prototype.supportsBinary=!0,c.prototype.request=function(e){return e=e||{},e.uri=this.uri(),e.xd=this.xd,e.xs=this.xs,e.agent=this.agent||!1,e.supportsBinary=this.supportsBinary,e.enablesXDR=this.enablesXDR,e.pfx=this.pfx,e.key=this.key,e.passphrase=this.passphrase,e.cert=this.cert,e.ca=this.ca,e.ciphers=this.ciphers,e.rejectUnauthorized=this.rejectUnauthorized,e.requestTimeout=this.requestTimeout,e.extraHeaders=this.extraHeaders,new f(e)},c.prototype.doWrite=function(e,t){var r="string"!=typeof e&&void 0!==e,n=this.request({method:"POST",data:e,isBinary:r}),i=this;n.on("success",t),n.on("error",function(e){i.onError("xhr post error",e)}),this.sendXhr=n},c.prototype.doPoll=function(){a("xhr poll");var e=this.request(),t=this;e.on("data",function(e){t.onData(e)}),e.on("error",function(e){t.onError("xhr poll error",e)}),this.pollXhr=e},o(f.prototype),f.prototype.create=function(){var e={agent:this.agent,xdomain:this.xd,xscheme:this.xs,enablesXDR:this.enablesXDR};e.pfx=this.pfx,e.key=this.key,e.passphrase=this.passphrase,e.cert=this.cert,e.ca=this.ca,e.ciphers=this.ciphers,e.rejectUnauthorized=this.rejectUnauthorized;var r=this.xhr=new n(e),i=this;try{a("xhr open %s: %s",this.method,this.uri),r.open(this.method,this.uri,this.async);try{if(this.extraHeaders)for(var o in r.setDisableHeaderCheck&&r.setDisableHeaderCheck(!0),this.extraHeaders)this.extraHeaders.hasOwnProperty(o)&&r.setRequestHeader(o,this.extraHeaders[o])}catch(e){}if("POST"===this.method)try{this.isBinary?r.setRequestHeader("Content-type","application/octet-stream"):r.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch(e){}try{r.setRequestHeader("Accept","*/*")}catch(e){}"withCredentials"in r&&(r.withCredentials=!0),this.requestTimeout&&(r.timeout=this.requestTimeout),this.hasXDR()?(r.onload=function(){i.onLoad()},r.onerror=function(){i.onError(r.responseText)}):r.onreadystatechange=function(){if(2===r.readyState)try{var e=r.getResponseHeader("Content-Type");i.supportsBinary&&"application/octet-stream"===e&&(r.responseType="arraybuffer")}catch(e){}4===r.readyState&&(200===r.status||1223===r.status?i.onLoad():setTimeout(function(){i.onError(r.status)},0))},a("xhr data %s",this.data),r.send(this.data)}catch(e){return void setTimeout(function(){i.onError(e)},0)}t.document&&(this.index=f.requestsCount++,f.requests[this.index]=this)},f.prototype.onSuccess=function(){this.emit("success"),this.cleanup()},f.prototype.onData=function(e){this.emit("data",e),this.onSuccess()},f.prototype.onError=function(e){this.emit("error",e),this.cleanup(!0)},f.prototype.cleanup=function(e){if(void 0!==this.xhr&&null!==this.xhr){if(this.hasXDR()?this.xhr.onload=this.xhr.onerror=u:this.xhr.onreadystatechange=u,e)try{this.xhr.abort()}catch(e){}t.document&&delete f.requests[this.index],this.xhr=null}},f.prototype.onLoad=function(){var e;try{var t;try{t=this.xhr.getResponseHeader("Content-Type")}catch(e){}e="application/octet-stream"===t&&this.xhr.response||this.xhr.responseText}catch(e){this.onError(e)}null!=e&&this.onData(e)},f.prototype.hasXDR=function(){return void 0!==t.XDomainRequest&&!this.xs&&this.enablesXDR},f.prototype.abort=function(){this.cleanup()},f.requestsCount=0,f.requests={},t.document&&(t.attachEvent?t.attachEvent("onunload",l):t.addEventListener&&t.addEventListener("beforeunload",l,!1))}).call(this,r(7))},function(e,t){e.exports=Object.keys||function e(t){var r=[],n=Object.prototype.hasOwnProperty;for(var i in t)n.call(t,i)&&r.push(i);return r}},function(e,t){var r={}.toString;e.exports=Array.isArray||function(e){return"[object Array]"==r.call(e)}},function(e,t){e.exports=function(e,t,r){var n=e.byteLength;if(t=t||0,r=r||n,e.slice)return e.slice(t,r);if(t<0&&(t+=n),r<0&&(r+=n),r>n&&(r=n),t>=n||t>=r||0===n)return new ArrayBuffer(0);for(var i=new Uint8Array(e),o=new Uint8Array(r-t),s=t,a=0;s<r;s++,a++)o[a]=i[s];return o.buffer}},function(e,t){function r(e,t,r){var i=!1;return r=r||n,o.count=e,0===e?t():o;function o(e,n){if(o.count<=0)throw new Error("after called too many times");--o.count,e?(i=!0,t(e),t=r):0!==o.count||i||t(null,n)}}function n(){}e.exports=r},function(e,t,r){(function(e,n){var i;/*! https://mths.be/utf8js v2.1.2 by @mathias */!function(o){var s="object"==typeof t&&t,a="object"==typeof e&&e&&e.exports==s&&e,u="object"==typeof n&&n;u.global!==u&&u.window!==u||(o=u);var c=String.fromCharCode,f,l,h;function p(e){for(var t=[],r=0,n=e.length,i,o;r<n;)i=e.charCodeAt(r++),i>=55296&&i<=56319&&r<n?(o=e.charCodeAt(r++),56320==(64512&o)?t.push(((1023&i)<<10)+(1023&o)+65536):(t.push(i),r--)):t.push(i);return t}function d(e){for(var t=e.length,r=-1,n,i="";++r<t;)n=e[r],n>65535&&(n-=65536,i+=c(n>>>10&1023|55296),n=56320|1023&n),i+=c(n);return i}function y(e,t){if(e>=55296&&e<=57343){if(t)throw Error("Lone surrogate U+"+e.toString(16).toUpperCase()+" is not a scalar value");return!1}return!0}function g(e,t){return c(e>>t&63|128)}function m(e,t){if(0==(4294967168&e))return c(e);var r="";return 0==(4294965248&e)?r=c(e>>6&31|192):0==(4294901760&e)?(y(e,t)||(e=65533),r=c(e>>12&15|224),r+=g(e,6)):0==(4292870144&e)&&(r=c(e>>18&7|240),r+=g(e,12),r+=g(e,6)),r+=c(63&e|128),r}function b(e,t){t=t||{};for(var r=!1!==t.strict,n=p(e),i=n.length,o=-1,s,a="";++o<i;)s=n[o],a+=m(s,r);return a}function v(){if(h>=l)throw Error("Invalid byte index");var e=255&f[h];if(h++,128==(192&e))return 63&e;throw Error("Invalid continuation byte")}function _(e){var t,r,n,i,o;if(h>l)throw Error("Invalid byte index");if(h==l)return!1;if(t=255&f[h],h++,0==(128&t))return t;if(192==(224&t)){if(r=v(),o=(31&t)<<6|r,o>=128)return o;throw Error("Invalid continuation byte")}if(224==(240&t)){if(r=v(),n=v(),o=(15&t)<<12|r<<6|n,o>=2048)return y(o,e)?o:65533;throw Error("Invalid continuation byte")}if(240==(248&t)&&(r=v(),n=v(),i=v(),o=(7&t)<<18|r<<12|n<<6|i,o>=65536&&o<=1114111))return o;throw Error("Invalid UTF-8 detected")}function w(e,t){t=t||{};var r=!1!==t.strict;f=p(e),l=f.length,h=0;for(var n=[],i;!1!==(i=_(r));)n.push(i);return d(n)}var S={version:"2.1.2",encode:b,decode:w},k,E,A;i=function(){return S}.call(t,r,t,e),void 0===i||(e.exports=i)}(this)}).call(this,r(28)(e),r(7))},function(e,t){!function(){"use strict";for(var e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",r=new Uint8Array(256),n=0;n<e.length;n++)r[e.charCodeAt(n)]=n;t.encode=function(t){var r=new Uint8Array(t),n,i=r.length,o="";for(n=0;n<i;n+=3)o+=e[r[n]>>2],o+=e[(3&r[n])<<4|r[n+1]>>4],o+=e[(15&r[n+1])<<2|r[n+2]>>6],o+=e[63&r[n+2]];return i%3==2?o=o.substring(0,o.length-1)+"=":i%3==1&&(o=o.substring(0,o.length-2)+"=="),o},t.decode=function(e){var t=.75*e.length,n=e.length,i,o=0,s,a,u,c;"="===e[e.length-1]&&(t--,"="===e[e.length-2]&&t--);var f=new ArrayBuffer(t),l=new Uint8Array(f);for(i=0;i<n;i+=4)s=r[e.charCodeAt(i)],a=r[e.charCodeAt(i+1)],u=r[e.charCodeAt(i+2)],c=r[e.charCodeAt(i+3)],l[o++]=s<<2|a>>4,l[o++]=(15&a)<<4|u>>2,l[o++]=(3&u)<<6|63&c;return f}}()},function(e,t,r){(function(t){var r=t.BlobBuilder||t.WebKitBlobBuilder||t.MSBlobBuilder||t.MozBlobBuilder,n=function(){try{var e=new Blob(["hi"]);return 2===e.size}catch(e){return!1}}(),i=n&&function(){try{var e=new Blob([new Uint8Array([1,2])]);return 2===e.size}catch(e){return!1}}(),o=r&&r.prototype.append&&r.prototype.getBlob;function s(e){for(var t=0;t<e.length;t++){var r=e[t];if(r.buffer instanceof ArrayBuffer){var n=r.buffer;if(r.byteLength!==n.byteLength){var i=new Uint8Array(r.byteLength);i.set(new Uint8Array(n,r.byteOffset,r.byteLength)),n=i.buffer}e[t]=n}}}function a(e,t){t=t||{};var n=new r;s(e);for(var i=0;i<e.length;i++)n.append(e[i]);return t.type?n.getBlob(t.type):n.getBlob()}function u(e,t){return s(e),new Blob(e,t||{})}e.exports=n?i?t.Blob:u:o?a:void 0}).call(this,r(7))},function(e,t,r){(function(t){var n=r(513),i=r(190);e.exports=c;var o=/\n/g,s=/\\n/g,a;function u(){}function c(e){n.call(this,e),this.query=this.query||{},a||(t.___eio||(t.___eio=[]),a=t.___eio),this.index=a.length;var r=this;a.push(function(e){r.onData(e)}),this.query.j=this.index,t.document&&t.addEventListener&&t.addEventListener("beforeunload",function(){r.script&&(r.script.onerror=u)},!1)}i(c,n),c.prototype.supportsBinary=!1,c.prototype.doClose=function(){this.script&&(this.script.parentNode.removeChild(this.script),this.script=null),this.form&&(this.form.parentNode.removeChild(this.form),this.form=null,this.iframe=null),n.prototype.doClose.call(this)},c.prototype.doPoll=function(){var e=this,t=document.createElement("script");this.script&&(this.script.parentNode.removeChild(this.script),this.script=null),t.async=!0,t.src=this.uri(),t.onerror=function(t){e.onError("jsonp poll error",t)};var r=document.getElementsByTagName("script")[0];r?r.parentNode.insertBefore(t,r):(document.head||document.body).appendChild(t),this.script=t;var n="undefined"!=typeof navigator&&/gecko/i.test(navigator.userAgent);n&&setTimeout(function(){var e=document.createElement("iframe");document.body.appendChild(e),document.body.removeChild(e)},100)},c.prototype.doWrite=function(e,t){var r=this;if(!this.form){var n=document.createElement("form"),i=document.createElement("textarea"),a=this.iframeId="eio_iframe_"+this.index,u;n.className="socketio",n.style.position="absolute",n.style.top="-1000px",n.style.left="-1000px",n.target=a,n.method="POST",n.setAttribute("accept-charset","utf-8"),i.name="d",n.appendChild(i),document.body.appendChild(n),this.form=n,this.area=i}function c(){f(),t()}function f(){if(r.iframe)try{r.form.removeChild(r.iframe)}catch(e){r.onError("jsonp polling iframe removal error",e)}try{var e='<iframe src="javascript:0" name="'+r.iframeId+'">';u=document.createElement(e)}catch(e){u=document.createElement("iframe"),u.name=r.iframeId,u.src="javascript:0"}u.id=r.iframeId,r.form.appendChild(u),r.iframe=u}this.form.action=this.uri(),f(),e=e.replace(s,"\\\n"),this.area.value=e.replace(o,"\\n");try{this.form.submit()}catch(e){}this.iframe.attachEvent?this.iframe.onreadystatechange=function(){"complete"===r.iframe.readyState&&c()}:this.iframe.onload=c}}).call(this,r(7))},function(e,t,r){(function(t){var n=r(284),i=r(117),o=r(189),s=r(190),a=r(515),u=r(1)("engine.io-client:websocket"),c=t.WebSocket||t.MozWebSocket,f;if("undefined"==typeof window)try{f=r(1100)}catch(e){}var l=c;function h(e){var t=e&&e.forceBase64;t&&(this.supportsBinary=!1),this.perMessageDeflate=e.perMessageDeflate,this.usingBrowserWebSocket=c&&!e.forceNode,this.protocols=e.protocols,this.usingBrowserWebSocket||(l=f),n.call(this,e)}l||"undefined"!=typeof window||(l=f),e.exports=h,s(h,n),h.prototype.name="websocket",h.prototype.supportsBinary=!0,h.prototype.doOpen=function(){if(this.check()){var e=this.uri(),t=this.protocols,r={agent:this.agent,perMessageDeflate:this.perMessageDeflate};r.pfx=this.pfx,r.key=this.key,r.passphrase=this.passphrase,r.cert=this.cert,r.ca=this.ca,r.ciphers=this.ciphers,r.rejectUnauthorized=this.rejectUnauthorized,this.extraHeaders&&(r.headers=this.extraHeaders),this.localAddress&&(r.localAddress=this.localAddress);try{this.ws=this.usingBrowserWebSocket?t?new l(e,t):new l(e):new l(e,t,r)}catch(e){return this.emit("error",e)}void 0===this.ws.binaryType&&(this.supportsBinary=!1),this.ws.supports&&this.ws.supports.binary?(this.supportsBinary=!0,this.ws.binaryType="nodebuffer"):this.ws.binaryType="arraybuffer",this.addEventListeners()}},h.prototype.addEventListeners=function(){var e=this;this.ws.onopen=function(){e.onOpen()},this.ws.onclose=function(){e.onClose()},this.ws.onmessage=function(t){e.onData(t.data)},this.ws.onerror=function(t){e.onError("websocket error",t)}},h.prototype.write=function(e){var r=this;this.writable=!1;for(var n=e.length,o=0,s=n;o<s;o++)!function(e){i.encodePacket(e,r.supportsBinary,function(i){if(!r.usingBrowserWebSocket){var o={};if(e.options&&(o.compress=e.options.compress),r.perMessageDeflate){var s="string"==typeof i?t.Buffer.byteLength(i):i.length;s<r.perMessageDeflate.threshold&&(o.compress=!1)}}try{r.usingBrowserWebSocket?r.ws.send(i):r.ws.send(i,o)}catch(e){u("websocket closed before onclose event")}--n||a()})}(e[o]);function a(){r.emit("flush"),setTimeout(function(){r.writable=!0,r.emit("drain")},0)}},h.prototype.onClose=function(){n.prototype.onClose.call(this)},h.prototype.doClose=function(){void 0!==this.ws&&this.ws.close()},h.prototype.uri=function(){var e=this.query||{},t=this.secure?"wss":"ws",r="";this.port&&("wss"===t&&443!==Number(this.port)||"ws"===t&&80!==Number(this.port))&&(r=":"+this.port),this.timestampRequests&&(e[this.timestampParam]=a()),this.supportsBinary||(e.b64=1),e=o.encode(e),e.length&&(e="?"+e);var n=-1!==this.hostname.indexOf(":");return t+"://"+(n?"["+this.hostname+"]":this.hostname)+r+this.path+e},h.prototype.check=function(){return!(!l||"__initialize"in l&&this.name===h.prototype.name)}}).call(this,r(7))},function(e,t){},function(e,t){function r(e,t){var r=[];t=t||0;for(var n=t||0;n<e.length;n++)r[n-t]=e[n];return r}e.exports=r},function(e,t){function r(e){e=e||{},this.ms=e.min||100,this.max=e.max||1e4,this.factor=e.factor||2,this.jitter=e.jitter>0&&e.jitter<=1?e.jitter:0,this.attempts=0}e.exports=r,r.prototype.duration=function(){var e=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var t=Math.random(),r=Math.floor(t*this.jitter*e);e=0==(1&Math.floor(10*t))?e-r:e+r}return 0|Math.min(e,this.max)},r.prototype.reset=function(){this.attempts=0},r.prototype.setMin=function(e){this.ms=e},r.prototype.setMax=function(e){this.max=e},r.prototype.setJitter=function(e){this.jitter=e}},function(e,t){e.exports=function e(){if("undefined"==typeof window)return null;var t={RTCPeerConnection:window.RTCPeerConnection||window.mozRTCPeerConnection||window.webkitRTCPeerConnection,RTCSessionDescription:window.RTCSessionDescription||window.mozRTCSessionDescription||window.webkitRTCSessionDescription,RTCIceCandidate:window.RTCIceCandidate||window.mozRTCIceCandidate||window.webkitRTCIceCandidate};return t.RTCPeerConnection?t:null}},function(e,t,r){"use strict";(function(n){const i=r(14),o=r(1105),s=r(13),a=r(5);class u{constructor(e,t,r){s(n.isBuffer(e),"invalid id provided"),t&&r&&s(t.public.bytes.equals(r.bytes),"inconsistent arguments"),this._id=e,this._idB58String=i.toB58String(this.id),this._privKey=t,this._pubKey=r}get id(){return this._id}set id(e){throw new Error("Id is immutable")}get privKey(){return this._privKey}set privKey(e){this._privKey=e}get pubKey(){return this._pubKey?this._pubKey:this._privKey?this._privKey.public:void 0}set pubKey(e){this._pubKey=e}marshalPubKey(){if(this.pubKey)return o.keys.marshalPublicKey(this.pubKey)}marshalPrivKey(){if(this.privKey)return o.keys.marshalPrivateKey(this.privKey)}toPrint(){return this.toJSON()}toJSON(){return{id:this.toB58String(),privKey:c(this.marshalPrivKey()),pubKey:c(this.marshalPubKey())}}toHexString(){return i.toHexString(this.id)}toBytes(){return this.id}toB58String(){return this._idB58String}isEqual(e){if(n.isBuffer(e))return this.id.equals(e);if(e.id)return this.id.equals(e.id);throw new Error("not valid Id")}isValid(e){this.privKey&&this.privKey.public&&this.privKey.public.bytes&&n.isBuffer(this.pubKey.bytes)&&this.privKey.public.bytes.equals(this.pubKey.bytes)?e():e(new Error("Keys not match"))}}function c(e){if(e)return e.toString("base64")}t=e.exports=u,t.create=function(e,t){"function"==typeof e&&(t=e,e={}),e=e||{},e.bits=e.bits||2048,a([t=>o.keys.generateKeyPair("RSA",e.bits,t),(e,t)=>e.public.hash((r,n)=>{t(r,n,e)})],(e,r,n)=>{if(e)return t(e);t(null,new u(r,n))})},t.createFromHexString=function(e){return new u(i.fromHexString(e))},t.createFromBytes=function(e){return new u(e)},t.createFromB58String=function(e){return new u(i.fromB58String(e))},t.createFromPubKey=function(e,t){if("function"!=typeof t)throw new Error("callback is required");let r;try{let i=e;if("string"==typeof i&&(i=n.from(e,"base64")),!n.isBuffer(i))throw new Error("Supplied key is neither a base64 string nor a buffer");r=o.keys.unmarshalPublicKey(i)}catch(e){return t(e)}r.hash((e,n)=>{if(e)return t(e);t(null,new u(n,null,r))})},t.createFromPrivKey=function(e,t){if("function"!=typeof t)throw new Error("callback is required");let r=e;try{if("string"==typeof r&&(r=n.from(e,"base64")),!n.isBuffer(r))throw new Error("Supplied key is neither a base64 string nor a buffer")}catch(e){return t(e)}a([e=>o.keys.unmarshalPrivateKey(r,e),(e,t)=>e.public.hash((r,n)=>{t(r,n,e)})],(e,r,n)=>{if(e)return t(e);t(null,new u(r,n,n.public))})},t.createFromJSON=function(e,t){if("function"!=typeof t)throw new Error("callback is required");let r,s,c,f;try{r=i.fromB58String(e.id),s=e.privKey&&n.from(e.privKey,"base64"),c=e.pubKey&&n.from(e.pubKey,"base64"),f=c&&o.keys.unmarshalPublicKey(c)}catch(e){return t(e)}s?a([e=>o.keys.unmarshalPrivateKey(s,e),(e,t)=>e.public.hash((r,n)=>{t(r,n,e)}),(e,t,r)=>{f?f.hash((n,i)=>{r(n,e,t,i)}):r(null,e,t)}],(e,n,i,o)=>e?t(e):f&&!n.equals(o)?t(new Error("Public and private key do not match")):r&&!n.equals(r)?t(new Error("Id and private key do not match")):void t(null,new u(r,i,f))):t(null,new u(r,null,f))},t.isPeerId=function(e){return Boolean("object"==typeof e&&e._id&&e._idB58String)}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";const n=r(519),i=r(1107),o=r(1109);t=e.exports,t.aes=i,t.hmac=n,t.keys=o,t.randomBytes=r(524),t.pbkdf2=r(1120)},function(e,t,r){"use strict";e.exports={SHA1:20,SHA256:32,SHA512:64}},function(e,t,r){"use strict";const n=r(1108),i={16:"aes-128-ctr",32:"aes-256-ctr"};t.create=function(e,t,r){const o=i[e.length];if(!o)return r(new Error("Invalid key length"));const s=n.createCipheriv(o,e,t),a=n.createDecipheriv(o,e,t),u={encrypt(e,t){t(null,s.update(e))},decrypt(e,t){t(null,a.update(e))}};r(null,u)}},function(e,t,r){"use strict";const n=r(70);e.exports={createCipheriv:n.createCipheriv,createDecipheriv:n.createDecipheriv}},function(e,t,r){"use strict";(function(n){const i=r(12),o=i(r(287)),s=r(19);t=e.exports;const a={rsa:r(1110),ed25519:r(1115),secp256k1:r(72)(o,r(524))};function u(e){const t=a[e.toLowerCase()];return void 0!==t}t.supportedKeys=a,t.keysPBM=o,t.keyStretcher=r(1117),t.generateEphemeralKeyPair=r(1118),t.generateKeyPair=((e,t,r)=>{let n=a[e.toLowerCase()];if(!n)return r(new Error("invalid or unsupported key type"));n.generateKeyPair(t,r)}),t.generateKeyPairFromSeed=((e,t,r,n)=>{let i=a[e.toLowerCase()];return i?"ed25519"!==e.toLowerCase()?n(new Error("Seed key derivation is unimplemented for RSA or secp256k1")):void i.generateKeyPairFromSeed(t,r,n):n(new Error("invalid or unsupported key type"))}),t.unmarshalPublicKey=(e=>{const t=o.PublicKey.decode(e),r=t.Data;switch(t.Type){case o.KeyType.RSA:return a.rsa.unmarshalRsaPublicKey(r);case o.KeyType.Ed25519:return a.ed25519.unmarshalEd25519PublicKey(r);case o.KeyType.Secp256k1:if(a.secp256k1)return a.secp256k1.unmarshalSecp256k1PublicKey(r);throw new Error("secp256k1 support requires libp2p-crypto-secp256k1 package");default:throw new Error("invalid or unsupported key type")}}),t.marshalPublicKey=((e,t)=>{if(t=(t||"rsa").toLowerCase(),!u(t))throw new Error("invalid or unsupported key type");return e.bytes}),t.unmarshalPrivateKey=((e,t)=>{let r;try{r=o.PrivateKey.decode(e)}catch(e){return t(e)}const n=r.Data;switch(r.Type){case o.KeyType.RSA:return a.rsa.unmarshalRsaPrivateKey(n,t);case o.KeyType.Ed25519:return a.ed25519.unmarshalEd25519PrivateKey(n,t);case o.KeyType.Secp256k1:return a.secp256k1?a.secp256k1.unmarshalSecp256k1PrivateKey(n,t):t(new Error("secp256k1 support requires libp2p-crypto-secp256k1 package"));default:t(new Error("invalid or unsupported key type"))}}),t.marshalPrivateKey=((e,t)=>{if(t=(t||"rsa").toLowerCase(),!u(t))throw new Error("invalid or unsupported key type");return e.bytes}),t.import=((e,t,r)=>{try{const i=s.pki.decryptRsaPrivateKey(e,t);if(null===i)throw new Error("Cannot read the key, most likely the password is wrong or not a RSA key");let o=s.asn1.toDer(s.pki.privateKeyToAsn1(i));return o=n.from(o.getBytes(),"binary"),a.rsa.unmarshalRsaPrivateKey(o,r)}catch(e){r(e)}})}).call(this,r(0).Buffer)},function(e,t,r){"use strict";const n=r(520),i=r(12),o=r(18),s=r(522),a=i(r(287)),u=r(19),c=r(3);class f{constructor(e){this._key=e}verify(e,t,r){g(r),s.hashAndVerify(this._key,t,e,r)}marshal(){return s.utils.jwkToPkix(this._key)}get bytes(){return a.PublicKey.encode({Type:a.KeyType.RSA,Data:this.marshal()})}encrypt(e){return this._key.encrypt(e,"RSAES-PKCS1-V1_5")}equals(e){return this.bytes.equals(e.bytes)}hash(e){g(e),n(this.bytes,"sha2-256",e)}}class l{constructor(e,t){this._key=e,this._publicKey=t}genSecret(){return s.getRandomValues(new Uint8Array(16))}sign(e,t){g(t),s.hashAndSign(this._key,e,t)}get public(){if(!this._publicKey)throw new Error("public key not provided");return new f(this._publicKey)}decrypt(e,t){s.decrypt(this._key,e,t)}marshal(){return s.utils.jwkToPkcs1(this._key)}get bytes(){return a.PrivateKey.encode({Type:a.KeyType.RSA,Data:this.marshal()})}equals(e){return this.bytes.equals(e.bytes)}hash(e){g(e),n(this.bytes,"sha2-256",e)}id(e){this.public.hash((t,r)=>{if(t)return e(t);e(null,o.encode(r))})}export(e,t,r){"function"==typeof t&&(r=t,t=e,e="pkcs-8"),g(r),c(()=>{let n=null,i=null;try{const r=new u.util.ByteBuffer(this.marshal()),o=u.asn1.fromDer(r),s=u.pki.privateKeyFromAsn1(o);if("pkcs-8"===e){const e={algorithm:"aes256",count:1e4,saltSize:16,prfAlgorithm:"sha512"};i=u.pki.encryptRsaPrivateKey(s,t,e)}else n=new Error(`Unknown export format '${e}'`)}catch(e){n=e}r(n,i)})}}function h(e,t){const r=s.utils.pkcs1ToJwk(e);s.unmarshalPrivateKey(r,(e,r)=>{if(e)return t(e);t(null,new l(r.privateKey,r.publicKey))})}function p(e){const t=s.utils.pkixToJwk(e);return new f(t)}function d(e,t){s.unmarshalPrivateKey(e,(e,r)=>{if(e)return t(e);t(null,new l(r.privateKey,r.publicKey))})}function y(e,t){s.generateKey(e,(e,r)=>{if(e)return t(e);t(null,new l(r.privateKey,r.publicKey))})}function g(e){if("function"!=typeof e)throw new Error("callback is required")}e.exports={RsaPublicKey:f,RsaPrivateKey:l,unmarshalRsaPublicKey:p,unmarshalRsaPrivateKey:h,generateKeyPair:y,fromJwk:d}},function(e,t,r){"use strict";(function(t){const n=r(48),i=r(49),o=r(521),s=r(1112),a=o.toCallback,u=o.toBuf,c=o.fromString,f=o.fromNumberTo32BitBuf,l=(e,r)=>{s.sha2256(e,(e,n)=>{e&&r(e),s.sha2256(t.from(n),r)})};e.exports={sha1:s.sha1,sha2256:s.sha2256,sha2512:s.sha2512,sha3512:a(u(n.sha3_512)),sha3384:a(u(n.sha3_384)),sha3256:a(u(n.sha3_256)),sha3224:a(u(n.sha3_224)),shake128:a(u(n.shake_128,256)),shake256:a(u(n.shake_256,512)),keccak224:a(u(n.keccak_224)),keccak256:a(u(n.keccak_256)),keccak384:a(u(n.keccak_384)),keccak512:a(u(n.keccak_512)),murmur3128:a(u(c(i.x64.hash128))),murmur332:a(f(c(i.x86.hash32))),addBlake:r(1113),dblSha2256:l}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(t){const n=r(50),i=o();function o(){return self.crypto?self.crypto.subtle||self.crypto.webkitSubtle:self.msCrypto?self.msCrypto.subtle:void 0}function s(e){if(!i)throw new Error("Please use a browser with webcrypto support");return(r,o)=>{const s=i.digest({name:e},r);if("function"!=typeof s.then)return s.onerror=(()=>{o(new Error(`hashing data using ${e}`))}),void(s.oncomplete=(e=>{o(null,e.target.result)}));n(s.then(e=>t.from(new Uint8Array(e))),o)}}function a(e,t){s("SHA-1")(e,t)}function u(e,t){s("SHA-256")(e,t)}function c(e,t){s("SHA-512")(e,t)}e.exports={sha1:a,sha2256:u,sha2512:c}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(t){const n=r(51),i=r(521).toCallback,o=45569,s=45633,a={init:n.blake2bInit,update:n.blake2bUpdate,digest:n.blake2bFinal},u={init:n.blake2sInit,update:n.blake2sUpdate,digest:n.blake2sFinal},c=(e,r)=>i(n=>{const i=r.init(e,null);return r.update(i,n),t.from(r.digest(i))});e.exports=(e=>{for(let t=0;t<64;t++)e[o+t]=c(t+1,a);for(let t=0;t<32;t++)e[s+t]=c(t+1,u)})}).call(this,r(0).Buffer)},function(e,t,r){"use strict";const n=r(17),i=r(523),o=i.toBase64,s=i.toBn,a=n.define("RSAPrivateKey",function(){this.seq().obj(this.key("version").int(),this.key("modulus").int(),this.key("publicExponent").int(),this.key("privateExponent").int(),this.key("prime1").int(),this.key("prime2").int(),this.key("exponent1").int(),this.key("exponent2").int(),this.key("coefficient").int())}),u=n.define("AlgorithmIdentifier",function(){this.seq().obj(this.key("algorithm").objid({"1.2.840.113549.1.1.1":"rsa"}),this.key("none").optional().null_(),this.key("curve").optional().objid(),this.key("params").optional().seq().obj(this.key("p").int(),this.key("q").int(),this.key("g").int()))}),c=n.define("RSAPublicKey",function(){this.seq().obj(this.key("algorithm").use(u),this.key("subjectPublicKey").bitstr())}),f=n.define("RSAPublicKey",function(){this.seq().obj(this.key("modulus").int(),this.key("publicExponent").int())});t.pkcs1ToJwk=function(e){const t=a.decode(e,"der");return{kty:"RSA",n:o(t.modulus),e:o(t.publicExponent),d:o(t.privateExponent),p:o(t.prime1),q:o(t.prime2),dp:o(t.exponent1),dq:o(t.exponent2),qi:o(t.coefficient),alg:"RS256",kid:"2011-04-29"}},t.jwkToPkcs1=function(e){return a.encode({version:0,modulus:s(e.n),publicExponent:s(e.e),privateExponent:s(e.d),prime1:s(e.p),prime2:s(e.q),exponent1:s(e.dp),exponent2:s(e.dq),coefficient:s(e.qi)},"der")},t.pkixToJwk=function(e){const t=c.decode(e,"der"),r=f.decode(t.subjectPublicKey.data,"der");return{kty:"RSA",n:o(r.modulus),e:o(r.publicExponent),alg:"RS256",kid:"2011-04-29"}},t.jwkToPkix=function(e){return c.encode({algorithm:{algorithm:"rsa",none:null},subjectPublicKey:{data:f.encode({modulus:s(e.n),publicExponent:s(e.e)},"der")}},"der")}},function(e,t,r){"use strict";(function(t){const n=r(520),i=r(12),o=r(18),s=r(1116),a=i(r(287));class u{constructor(e){this._key=y(e,s.publicKeyLength)}verify(e,t,r){d(r),s.hashAndVerify(this._key,t,e,r)}marshal(){return t.from(this._key)}get bytes(){return a.PublicKey.encode({Type:a.KeyType.Ed25519,Data:this.marshal()})}equals(e){return this.bytes.equals(e.bytes)}hash(e){d(e),n(this.bytes,"sha2-256",e)}}class c{constructor(e,t){this._key=y(e,s.privateKeyLength),this._publicKey=y(t,s.publicKeyLength)}sign(e,t){d(t),s.hashAndSign(this._key,e,t)}get public(){if(!this._publicKey)throw new Error("public key not provided");return new u(this._publicKey)}marshal(){return t.concat([t.from(this._key),t.from(this._publicKey)])}get bytes(){return a.PrivateKey.encode({Type:a.KeyType.Ed25519,Data:this.marshal()})}equals(e){return this.bytes.equals(e.bytes)}hash(e){d(e),n(this.bytes,"sha2-256",e)}id(e){this.public.hash((t,r)=>{if(t)return e(t);e(null,o.encode(r))})}}function f(e,t){try{e=y(e,s.privateKeyLength+s.publicKeyLength)}catch(e){return t(e)}const r=e.slice(0,s.privateKeyLength),n=e.slice(s.privateKeyLength,e.length);t(null,new c(r,n))}function l(e){return e=y(e,s.publicKeyLength),new u(e)}function h(e,t){void 0===t&&"function"==typeof e&&(t=e),s.generateKey((e,r)=>{if(e)return t(e);let n;try{n=new c(r.secretKey,r.publicKey)}catch(e){return void t(e)}t(null,n)})}function p(e,t,r){void 0===r&&"function"==typeof t&&(r=t),s.generateKeyFromSeed(e,(e,t)=>{if(e)return r(e);let n;try{n=new c(t.secretKey,t.publicKey)}catch(e){return void r(e)}r(null,n)})}function d(e){if("function"!=typeof e)throw new Error("callback is required")}function y(e,r){if(t.isBuffer(e)&&(e=new Uint8Array(e)),!(e instanceof Uint8Array)||e.length!==r)throw new Error("Key must be a Uint8Array or Buffer of length "+r);return e}e.exports={Ed25519PublicKey:u,Ed25519PrivateKey:c,unmarshalEd25519PrivateKey:f,unmarshalEd25519PublicKey:l,generateKeyPair:h,generateKeyPairFromSeed:p}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(e){const n=r(71),i=r(3);t.publicKeyLength=n.sign.publicKeyLength,t.privateKeyLength=n.sign.secretKeyLength,t.generateKey=function(e){i(()=>{let t;try{t=n.sign.keyPair()}catch(t){return e(t)}e(null,t)})},t.generateKeyFromSeed=function(e,t){i(()=>{let r;try{r=n.sign.keyPair.fromSeed(e)}catch(e){return t(e)}t(null,r)})},t.hashAndSign=function(t,r,o){i(()=>{o(null,e.from(n.sign.detached(r,t)))})},t.hashAndVerify=function(e,t,r,o){i(()=>{let i;try{i=n.sign.detached.verify(r,t,e)}catch(e){return o(e)}o(null,i)})}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(t){const n=r(47),i=r(519),o={"AES-128":{ivSize:16,keySize:16},"AES-256":{ivSize:16,keySize:32},Blowfish:{ivSize:8,cipherKeySize:32}};e.exports=((e,r,s,a)=>{const u=o[e];if(!u)return a(new Error("unkown cipherType passed"));if(!r)return a(new Error("unkown hashType passed"));const c=u.keySize,f=u.ivSize,l=20,h=t.from("key expansion"),p=2*(f+c+20);i.create(r,s,(e,r)=>{if(e)return a(e);r.digest(h,(e,i)=>{if(e)return a(e);let o=[],s=0;function u(e){r.digest(t.concat([i,h]),(t,n)=>{if(t)return e(t);let a=n.length;s+a>p&&(a=p-s),o.push(n),s+=a,r.digest(i,(t,r)=>{if(t)return e(t);i=r,e()})})}function l(e){if(e)return a(e);const r=p/2,n=t.concat(o),i=n.slice(0,r),s=n.slice(r,p),u=e=>({iv:e.slice(0,f),cipherKey:e.slice(f,f+c),macKey:e.slice(f+c)});a(null,{k1:u(i),k2:u(s)})}n(()=>s<p,u,l)})})})}).call(this,r(0).Buffer)},function(e,t,r){"use strict";const n=r(1119);e.exports=((e,t)=>{n.generateEphmeralKeyPair(e,t)})},function(e,t,r){"use strict";(function(e){const n=r(286)(),i=r(285),o=r(17).bignum,s=r(523),a=s.toBase64,u=s.toBn,c={"P-256":256,"P-384":384,"P-521":521};t.generateEphmeralKeyPair=function(t,r){i(n.subtle.generateKey({name:"ECDH",namedCurve:t},!0,["deriveBits"]).then(r=>{const o=(o,s,a)=>{let u;"function"==typeof s&&(a=s,s=void 0),u=s?n.subtle.importKey("jwk",p(t,s),{name:"ECDH",namedCurve:t},!1,["deriveBits"]):Promise.resolve(r.privateKey);const f=Promise.all([n.subtle.importKey("jwk",h(t,o),{name:"ECDH",namedCurve:t},!1,[]),u]);i(f.then(e=>n.subtle.deriveBits({name:"ECDH",namedCurve:t,public:e[0]},e[1],c[t])).then(t=>e.from(t)),a)};return n.subtle.exportKey("jwk",r.publicKey).then(e=>({key:l(e),genSharedKey:o}))}),r)};const f={"P-256":32,"P-384":48,"P-521":66};function l(t){const r=f[t.crv];return e.concat([e.from([4]),u(t.x).toArrayLike(e,"be",r),u(t.y).toArrayLike(e,"be",r)],1+2*r)}function h(t,r){const n=f[t];if(!r.slice(0,1).equals(e.from([4])))throw new Error("Invalid key format");const i=new o(r.slice(1,n+1)),s=new o(r.slice(1+n));return{kty:"EC",crv:t,x:a(i,n),y:a(s,n),ext:!0}}function p(e,t){const r=h(e,t.public);return r.d=a(new o(t.private)),r}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";const n=r(19),i={sha1:"sha1","sha2-256":"sha256","sha2-512":"sha512"};function o(e,t,r,o,s){const a=i[s];if(!a)throw new Error(`Hash '${s}' is unknown or not supported`);const u=n.pkcs5.pbkdf2(e,t,r,o,a);return n.util.encode64(u)}e.exports=o},function(e,t){function r(e,t){if(e&&t)return r(e)(t);if("function"!=typeof e)throw new TypeError("need wrapper function");return Object.keys(e).forEach(function(t){n[t]=e[t]}),n;function n(){for(var t=new Array(arguments.length),r=0;r<t.length;r++)t[r]=arguments[r];var n=e.apply(this,t),i=t[t.length-1];return"function"==typeof n&&n!==i&&Object.keys(i).forEach(function(e){n[e]=i[e]}),n}}e.exports=r},function(e,t){var r,n;self.mozRTCPeerConnection||navigator.mozGetUserMedia?(r="moz",n=parseInt(navigator.userAgent.match(/Firefox\/([0-9]+)\./)[1],10)):(self.webkitRTCPeerConnection||navigator.webkitGetUserMedia)&&(r="webkit",n=navigator.userAgent.match(/Chrom(e|ium)/)&&parseInt(navigator.userAgent.match(/Chrom(e|ium)\/([0-9]+)\./)[2],10));var i=self.RTCPeerConnection||self.mozRTCPeerConnection||self.webkitRTCPeerConnection,o=self.mozRTCIceCandidate||self.RTCIceCandidate,s=self.mozRTCSessionDescription||self.RTCSessionDescription,a=self.webkitMediaStream||self.MediaStream,u="https:"===self.location.protocol&&("webkit"===r&&n>=26||"moz"===r&&n>=33),c=self.AudioContext||self.webkitAudioContext,f=self.document&&document.createElement("video"),l=f&&f.canPlayType&&"probably"===f.canPlayType('video/webm; codecs="vp8", vorbis'),h=navigator.getUserMedia||navigator.webkitGetUserMedia||navigator.msGetUserMedia||navigator.mozGetUserMedia;e.exports={prefix:r,browserVersion:n,support:!!i&&!!h,supportRTCPeerConnection:!!i,supportVp8:l,supportGetUserMedia:!!h,supportDataChannel:!!(i&&i.prototype&&i.prototype.createDataChannel),supportWebAudio:!(!c||!c.prototype.createMediaStreamSource),supportMediaStream:!(!a||!a.prototype.removeTrack),supportScreenSharing:!!u,AudioContext:c,PeerConnection:i,SessionDescription:s,IceCandidate:o,MediaStream:a,getUserMedia:h}},function(e,t,r){"use strict";const n=r(31);function i(e){const t=e.toString().split("/"),r=e.protos()[1].name,i=e.protos()[2].name,o=e.stringTuples()[1][1];if("tcp"!==r||"ws"!==i&&"wss"!==i)throw new Error("invalid multiaddr: "+e.toString());return n.isName(e)?"ws"===i?"http://"+t[2]+(80===o?"":":"+o):"wss"===i?"https://"+t[2]+(443===o?"":":"+o):void 0:"http://"+t[2]+":"+t[4]}function o(e){const t="/libp2p-webrtc-star";if(-1!==e.indexOf(t)){e=e.substring(t.length,e.length);let r=n(e);const i=r.stringTuples().filter(e=>421===e[0])[0];r=r.decapsulate("ipfs"),r=r.encapsulate("/p2p-webrtc-star"),r=r.encapsulate(`/ipfs/${i[1]}`),e=r.toString()}return e}t=e.exports,t.cleanUrlSIO=i,t.cleanMultiaddr=o},function(e,t,r){"use strict";const n=r(1),i=n("libp2p:websocket-star"),o=r(31),s=r(10).EventEmitter,a=r(526),u=r(52),c=r(44).Connection,f=r(3),l=r(533),h=r(1141),p=l.cleanUrlSIO,d=r(80),y=r(73);class g{constructor(e){e=e||{},this.id=e.id,this.flag=e.allowJoinWithDisabledChallenge,this.discovery=new s,this.discovery.tag="websocketStar",this.discovery.start=(e=>{f(e)}),this.discovery.stop=(e=>{f(e)}),this.listeners_list={},this._peerDiscovered=this._peerDiscovered.bind(this)}lazySetId(e){e&&(this.id=e,this.canCrypto=!0)}dial(e,t,r){let n;"function"==typeof t&&(r=t,t={});try{n=p(e)}catch(e){return r(e)}const i=this.listeners_list[n];return i?i.dial(e,t,r):(r(new Error("No listener for this server")),new c)}createListener(e,t){"function"==typeof e&&(t=e,e={});const r=new h({id:this.id,handler:t,listeners:this.listeners_list,flag:this.flag});return r.on("peer",this._peerDiscovered),r}filter(e){return Array.isArray(e)||(e=[e]),e.filter(e=>d.WebSocketStar.matches(e))}_peerDiscovered(e){i("Peer Discovered:",e);const t=e.split("/ipfs/").pop(),r=a.createFromB58String(t),n=new u(r);n.multiaddrs.add(o(e)),this.discovery.emit("peer",n)}}e.exports=y(g,{className:"WebsocketStar",symbolName:"@libp2p/js-libp2p-websocket-star/websocketstar"})},function(e,t,r){"use strict";const n=r(527),i=r(1127),o=r(1129);t=e.exports,t.aes=i,t.hmac=n,t.keys=o,t.randomBytes=r(532),t.pbkdf2=r(1140)},function(e,t,r){"use strict";e.exports={SHA1:20,SHA256:32,SHA512:64}},function(e,t,r){"use strict";const n=r(1128),i={16:"aes-128-ctr",32:"aes-256-ctr"};t.create=function(e,t,r){const o=i[e.length];if(!o)return r(new Error("Invalid key length"));const s=n.createCipheriv(o,e,t),a=n.createDecipheriv(o,e,t),u={encrypt(e,t){t(null,s.update(e))},decrypt(e,t){t(null,a.update(e))}};r(null,u)}},function(e,t,r){"use strict";const n=r(70);e.exports={createCipheriv:n.createCipheriv,createDecipheriv:n.createDecipheriv}},function(e,t,r){"use strict";(function(n){const i=r(12),o=i(r(290)),s=r(19);t=e.exports;const a={rsa:r(1130),ed25519:r(1135),secp256k1:r(72)(o,r(532))};function u(e){const t=a[e.toLowerCase()];return void 0!==t}t.supportedKeys=a,t.keysPBM=o,t.keyStretcher=r(1137),t.generateEphemeralKeyPair=r(1138),t.generateKeyPair=((e,t,r)=>{let n=a[e.toLowerCase()];if(!n)return r(new Error("invalid or unsupported key type"));n.generateKeyPair(t,r)}),t.generateKeyPairFromSeed=((e,t,r,n)=>{let i=a[e.toLowerCase()];return i?"ed25519"!==e.toLowerCase()?n(new Error("Seed key derivation is unimplemented for RSA or secp256k1")):void i.generateKeyPairFromSeed(t,r,n):n(new Error("invalid or unsupported key type"))}),t.unmarshalPublicKey=(e=>{const t=o.PublicKey.decode(e),r=t.Data;switch(t.Type){case o.KeyType.RSA:return a.rsa.unmarshalRsaPublicKey(r);case o.KeyType.Ed25519:return a.ed25519.unmarshalEd25519PublicKey(r);case o.KeyType.Secp256k1:if(a.secp256k1)return a.secp256k1.unmarshalSecp256k1PublicKey(r);throw new Error("secp256k1 support requires libp2p-crypto-secp256k1 package");default:throw new Error("invalid or unsupported key type")}}),t.marshalPublicKey=((e,t)=>{if(t=(t||"rsa").toLowerCase(),!u(t))throw new Error("invalid or unsupported key type");return e.bytes}),t.unmarshalPrivateKey=((e,t)=>{let r;try{r=o.PrivateKey.decode(e)}catch(e){return t(e)}const n=r.Data;switch(r.Type){case o.KeyType.RSA:return a.rsa.unmarshalRsaPrivateKey(n,t);case o.KeyType.Ed25519:return a.ed25519.unmarshalEd25519PrivateKey(n,t);case o.KeyType.Secp256k1:return a.secp256k1?a.secp256k1.unmarshalSecp256k1PrivateKey(n,t):t(new Error("secp256k1 support requires libp2p-crypto-secp256k1 package"));default:t(new Error("invalid or unsupported key type"))}}),t.marshalPrivateKey=((e,t)=>{if(t=(t||"rsa").toLowerCase(),!u(t))throw new Error("invalid or unsupported key type");return e.bytes}),t.import=((e,t,r)=>{try{const i=s.pki.decryptRsaPrivateKey(e,t);if(null===i)throw new Error("Cannot read the key, most likely the password is wrong or not a RSA key");let o=s.asn1.toDer(s.pki.privateKeyToAsn1(i));return o=n.from(o.getBytes(),"binary"),a.rsa.unmarshalRsaPrivateKey(o,r)}catch(e){r(e)}})}).call(this,r(0).Buffer)},function(e,t,r){"use strict";const n=r(528),i=r(12),o=r(18),s=r(530),a=i(r(290)),u=r(19),c=r(3);class f{constructor(e){this._key=e}verify(e,t,r){g(r),s.hashAndVerify(this._key,t,e,r)}marshal(){return s.utils.jwkToPkix(this._key)}get bytes(){return a.PublicKey.encode({Type:a.KeyType.RSA,Data:this.marshal()})}encrypt(e){return this._key.encrypt(e,"RSAES-PKCS1-V1_5")}equals(e){return this.bytes.equals(e.bytes)}hash(e){g(e),n(this.bytes,"sha2-256",e)}}class l{constructor(e,t){this._key=e,this._publicKey=t}genSecret(){return s.getRandomValues(new Uint8Array(16))}sign(e,t){g(t),s.hashAndSign(this._key,e,t)}get public(){if(!this._publicKey)throw new Error("public key not provided");return new f(this._publicKey)}decrypt(e,t){s.decrypt(this._key,e,t)}marshal(){return s.utils.jwkToPkcs1(this._key)}get bytes(){return a.PrivateKey.encode({Type:a.KeyType.RSA,Data:this.marshal()})}equals(e){return this.bytes.equals(e.bytes)}hash(e){g(e),n(this.bytes,"sha2-256",e)}id(e){this.public.hash((t,r)=>{if(t)return e(t);e(null,o.encode(r))})}export(e,t,r){"function"==typeof t&&(r=t,t=e,e="pkcs-8"),g(r),c(()=>{let n=null,i=null;try{const r=new u.util.ByteBuffer(this.marshal()),o=u.asn1.fromDer(r),s=u.pki.privateKeyFromAsn1(o);if("pkcs-8"===e){const e={algorithm:"aes256",count:1e4,saltSize:16,prfAlgorithm:"sha512"};i=u.pki.encryptRsaPrivateKey(s,t,e)}else n=new Error(`Unknown export format '${e}'`)}catch(e){n=e}r(n,i)})}}function h(e,t){const r=s.utils.pkcs1ToJwk(e);s.unmarshalPrivateKey(r,(e,r)=>{if(e)return t(e);t(null,new l(r.privateKey,r.publicKey))})}function p(e){const t=s.utils.pkixToJwk(e);return new f(t)}function d(e,t){s.unmarshalPrivateKey(e,(e,r)=>{if(e)return t(e);t(null,new l(r.privateKey,r.publicKey))})}function y(e,t){s.generateKey(e,(e,r)=>{if(e)return t(e);t(null,new l(r.privateKey,r.publicKey))})}function g(e){if("function"!=typeof e)throw new Error("callback is required")}e.exports={RsaPublicKey:f,RsaPrivateKey:l,unmarshalRsaPublicKey:p,unmarshalRsaPrivateKey:h,generateKeyPair:y,fromJwk:d}},function(e,t,r){"use strict";(function(t){const n=r(48),i=r(49),o=r(529),s=r(1132),a=o.toCallback,u=o.toBuf,c=o.fromString,f=o.fromNumberTo32BitBuf,l=(e,r)=>{s.sha2256(e,(e,n)=>{e&&r(e),s.sha2256(t.from(n),r)})};e.exports={sha1:s.sha1,sha2256:s.sha2256,sha2512:s.sha2512,sha3512:a(u(n.sha3_512)),sha3384:a(u(n.sha3_384)),sha3256:a(u(n.sha3_256)),sha3224:a(u(n.sha3_224)),shake128:a(u(n.shake_128,256)),shake256:a(u(n.shake_256,512)),keccak224:a(u(n.keccak_224)),keccak256:a(u(n.keccak_256)),keccak384:a(u(n.keccak_384)),keccak512:a(u(n.keccak_512)),murmur3128:a(u(c(i.x64.hash128))),murmur332:a(f(c(i.x86.hash32))),addBlake:r(1133),dblSha2256:l}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(t){const n=r(50),i=o();function o(){return self.crypto?self.crypto.subtle||self.crypto.webkitSubtle:self.msCrypto?self.msCrypto.subtle:void 0}function s(e){if(!i)throw new Error("Please use a browser with webcrypto support");return(r,o)=>{const s=i.digest({name:e},r);if("function"!=typeof s.then)return s.onerror=(()=>{o(new Error(`hashing data using ${e}`))}),void(s.oncomplete=(e=>{o(null,e.target.result)}));n(s.then(e=>t.from(new Uint8Array(e))),o)}}function a(e,t){s("SHA-1")(e,t)}function u(e,t){s("SHA-256")(e,t)}function c(e,t){s("SHA-512")(e,t)}e.exports={sha1:a,sha2256:u,sha2512:c}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(t){const n=r(51),i=r(529).toCallback,o=45569,s=45633,a={init:n.blake2bInit,update:n.blake2bUpdate,digest:n.blake2bFinal},u={init:n.blake2sInit,update:n.blake2sUpdate,digest:n.blake2sFinal},c=(e,r)=>i(n=>{const i=r.init(e,null);return r.update(i,n),t.from(r.digest(i))});e.exports=(e=>{for(let t=0;t<64;t++)e[o+t]=c(t+1,a);for(let t=0;t<32;t++)e[s+t]=c(t+1,u)})}).call(this,r(0).Buffer)},function(e,t,r){"use strict";const n=r(17),i=r(531),o=i.toBase64,s=i.toBn,a=n.define("RSAPrivateKey",function(){this.seq().obj(this.key("version").int(),this.key("modulus").int(),this.key("publicExponent").int(),this.key("privateExponent").int(),this.key("prime1").int(),this.key("prime2").int(),this.key("exponent1").int(),this.key("exponent2").int(),this.key("coefficient").int())}),u=n.define("AlgorithmIdentifier",function(){this.seq().obj(this.key("algorithm").objid({"1.2.840.113549.1.1.1":"rsa"}),this.key("none").optional().null_(),this.key("curve").optional().objid(),this.key("params").optional().seq().obj(this.key("p").int(),this.key("q").int(),this.key("g").int()))}),c=n.define("RSAPublicKey",function(){this.seq().obj(this.key("algorithm").use(u),this.key("subjectPublicKey").bitstr())}),f=n.define("RSAPublicKey",function(){this.seq().obj(this.key("modulus").int(),this.key("publicExponent").int())});t.pkcs1ToJwk=function(e){const t=a.decode(e,"der");return{kty:"RSA",n:o(t.modulus),e:o(t.publicExponent),d:o(t.privateExponent),p:o(t.prime1),q:o(t.prime2),dp:o(t.exponent1),dq:o(t.exponent2),qi:o(t.coefficient),alg:"RS256",kid:"2011-04-29"}},t.jwkToPkcs1=function(e){return a.encode({version:0,modulus:s(e.n),publicExponent:s(e.e),privateExponent:s(e.d),prime1:s(e.p),prime2:s(e.q),exponent1:s(e.dp),exponent2:s(e.dq),coefficient:s(e.qi)},"der")},t.pkixToJwk=function(e){const t=c.decode(e,"der"),r=f.decode(t.subjectPublicKey.data,"der");return{kty:"RSA",n:o(r.modulus),e:o(r.publicExponent),alg:"RS256",kid:"2011-04-29"}},t.jwkToPkix=function(e){return c.encode({algorithm:{algorithm:"rsa",none:null},subjectPublicKey:{data:f.encode({modulus:s(e.n),publicExponent:s(e.e)},"der")}},"der")}},function(e,t,r){"use strict";(function(t){const n=r(528),i=r(12),o=r(18),s=r(1136),a=i(r(290));class u{constructor(e){this._key=y(e,s.publicKeyLength)}verify(e,t,r){d(r),s.hashAndVerify(this._key,t,e,r)}marshal(){return t.from(this._key)}get bytes(){return a.PublicKey.encode({Type:a.KeyType.Ed25519,Data:this.marshal()})}equals(e){return this.bytes.equals(e.bytes)}hash(e){d(e),n(this.bytes,"sha2-256",e)}}class c{constructor(e,t){this._key=y(e,s.privateKeyLength),this._publicKey=y(t,s.publicKeyLength)}sign(e,t){d(t),s.hashAndSign(this._key,e,t)}get public(){if(!this._publicKey)throw new Error("public key not provided");return new u(this._publicKey)}marshal(){return t.concat([t.from(this._key),t.from(this._publicKey)])}get bytes(){return a.PrivateKey.encode({Type:a.KeyType.Ed25519,Data:this.marshal()})}equals(e){return this.bytes.equals(e.bytes)}hash(e){d(e),n(this.bytes,"sha2-256",e)}id(e){this.public.hash((t,r)=>{if(t)return e(t);e(null,o.encode(r))})}}function f(e,t){try{e=y(e,s.privateKeyLength+s.publicKeyLength)}catch(e){return t(e)}const r=e.slice(0,s.privateKeyLength),n=e.slice(s.privateKeyLength,e.length);t(null,new c(r,n))}function l(e){return e=y(e,s.publicKeyLength),new u(e)}function h(e,t){void 0===t&&"function"==typeof e&&(t=e),s.generateKey((e,r)=>{if(e)return t(e);let n;try{n=new c(r.secretKey,r.publicKey)}catch(e){return void t(e)}t(null,n)})}function p(e,t,r){void 0===r&&"function"==typeof t&&(r=t),s.generateKeyFromSeed(e,(e,t)=>{if(e)return r(e);let n;try{n=new c(t.secretKey,t.publicKey)}catch(e){return void r(e)}r(null,n)})}function d(e){if("function"!=typeof e)throw new Error("callback is required")}function y(e,r){if(t.isBuffer(e)&&(e=new Uint8Array(e)),!(e instanceof Uint8Array)||e.length!==r)throw new Error("Key must be a Uint8Array or Buffer of length "+r);return e}e.exports={Ed25519PublicKey:u,Ed25519PrivateKey:c,unmarshalEd25519PrivateKey:f,unmarshalEd25519PublicKey:l,generateKeyPair:h,generateKeyPairFromSeed:p}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(e){const n=r(71),i=r(3);t.publicKeyLength=n.sign.publicKeyLength,t.privateKeyLength=n.sign.secretKeyLength,t.generateKey=function(e){i(()=>{let t;try{t=n.sign.keyPair()}catch(t){return e(t)}e(null,t)})},t.generateKeyFromSeed=function(e,t){i(()=>{let r;try{r=n.sign.keyPair.fromSeed(e)}catch(e){return t(e)}t(null,r)})},t.hashAndSign=function(t,r,o){i(()=>{o(null,e.from(n.sign.detached(r,t)))})},t.hashAndVerify=function(e,t,r,o){i(()=>{let i;try{i=n.sign.detached.verify(r,t,e)}catch(e){return o(e)}o(null,i)})}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(t){const n=r(47),i=r(527),o={"AES-128":{ivSize:16,keySize:16},"AES-256":{ivSize:16,keySize:32},Blowfish:{ivSize:8,cipherKeySize:32}};e.exports=((e,r,s,a)=>{const u=o[e];if(!u)return a(new Error("unkown cipherType passed"));if(!r)return a(new Error("unkown hashType passed"));const c=u.keySize,f=u.ivSize,l=20,h=t.from("key expansion"),p=2*(f+c+20);i.create(r,s,(e,r)=>{if(e)return a(e);r.digest(h,(e,i)=>{if(e)return a(e);let o=[],s=0;function u(e){r.digest(t.concat([i,h]),(t,n)=>{if(t)return e(t);let a=n.length;s+a>p&&(a=p-s),o.push(n),s+=a,r.digest(i,(t,r)=>{if(t)return e(t);i=r,e()})})}function l(e){if(e)return a(e);const r=p/2,n=t.concat(o),i=n.slice(0,r),s=n.slice(r,p),u=e=>({iv:e.slice(0,f),cipherKey:e.slice(f,f+c),macKey:e.slice(f+c)});a(null,{k1:u(i),k2:u(s)})}n(()=>s<p,u,l)})})})}).call(this,r(0).Buffer)},function(e,t,r){"use strict";const n=r(1139);e.exports=((e,t)=>{n.generateEphmeralKeyPair(e,t)})},function(e,t,r){"use strict";(function(e){const n=r(289)(),i=r(288),o=r(17).bignum,s=r(531),a=s.toBase64,u=s.toBn,c={"P-256":256,"P-384":384,"P-521":521};t.generateEphmeralKeyPair=function(t,r){i(n.subtle.generateKey({name:"ECDH",namedCurve:t},!0,["deriveBits"]).then(r=>{const o=(o,s,a)=>{let u;"function"==typeof s&&(a=s,s=void 0),u=s?n.subtle.importKey("jwk",p(t,s),{name:"ECDH",namedCurve:t},!1,["deriveBits"]):Promise.resolve(r.privateKey);const f=Promise.all([n.subtle.importKey("jwk",h(t,o),{name:"ECDH",namedCurve:t},!1,[]),u]);i(f.then(e=>n.subtle.deriveBits({name:"ECDH",namedCurve:t,public:e[0]},e[1],c[t])).then(t=>e.from(t)),a)};return n.subtle.exportKey("jwk",r.publicKey).then(e=>({key:l(e),genSharedKey:o}))}),r)};const f={"P-256":32,"P-384":48,"P-521":66};function l(t){const r=f[t.crv];return e.concat([e.from([4]),u(t.x).toArrayLike(e,"be",r),u(t.y).toArrayLike(e,"be",r)],1+2*r)}function h(t,r){const n=f[t];if(!r.slice(0,1).equals(e.from([4])))throw new Error("Invalid key format");const i=new o(r.slice(1,n+1)),s=new o(r.slice(1+n));return{kty:"EC",crv:t,x:a(i,n),y:a(s,n),ext:!0}}function p(e,t){const r=h(e,t.public);return r.d=a(new o(t.private)),r}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";const n=r(19),i={sha1:"sha1","sha2-256":"sha256","sha2-512":"sha512"};function o(e,t,r,o,s){const a=i[s];if(!a)throw new Error(`Hash '${s}' is unknown or not supported`);const u=n.pkcs5.pbkdf2(e,t,r,o,a);return n.util.encode64(u)}e.exports=o},function(e,t,r){"use strict";(function(t){const n=r(1),i=n("libp2p:websocket-star:listener"),o=r(31),s=r(507),a=r(1142),u=r(534),c=r(37),f=r(10).EventEmitter,l=r(44).Connection,h=r(35),p=r(3),d=r(533),y=d.cleanUrlSIO,g=r(113),m=h(()=>{}),b={transports:["websocket"],"force new connection":!0};class v extends f{constructor(e){super(),this.id=e.id,this.log=i.bind(i,"listener#offline"),this.canCrypto=Boolean(e.id),this._handler=e.handler||m,this.listeners_list=e.listeners||{},this.flag=e.flag}_up(e){if(e=e?h(e):m,this.io)return e();this.log=i.bind(i,"listener#"+this.server),this.log("dialing to signalling server");const t=this.io=s.connect(this.server,b);a(t,{codec:"buffer"}),t.once("error",e),t.once("connect_error",e),t.once("connect",e);const r=new d.Protocol(this.log);r.addRequest("ws-peer",["multiaddr"],(e,t)=>this.emit("peer",t)),r.addRequest("ss-incomming",["string","multiaddr","function"],this._incommingDial.bind(this)),r.handleSocket(t)}_down(){this.io&&(this.io.disconnect(),this.emit("close"),delete this.io)}_cryptoChallenge(e){if(!this.io)return e(new Error("Not connected"));const r=this.canCrypto?g.keys.marshalPublicKey(this.id.pubKey).toString("hex"):"",n=this.ma.toString();this.io.emit("ss-join",n,r,(r,n)=>{if(r)return e(r);if(n){if(!this.canCrypto)return this._down(),e(new Error("Can't sign cryptoChallenge: No id provided"));this.log("performing cryptoChallenge"),this.id.privKey.sign(t.from(n),(t,r)=>{if(t)return e(t);this.signature=r.toString("hex"),this._join(e)})}else{if(!this.flag)return this._down(),e(new Error('Tried to listen on a server with crypto challenge disabled!\n This is prohibited by default and can lead to security issues!\n Please set "allowJoinWithDisabledChallenge" to true in the constructor options (but only if you know what you are doing)!'));this.signature="_",e()}})}_crypto(e){if(e=e?h(e):m,this.log("joining"),!this.io)return e(new Error("Not connected"));this.signature?this._join((t,r)=>{if(r)return this.cryptoChallenge(e);e(t)}):this._cryptoChallenge(e)}_join(e){this.io.emit("ss-join",this.ma.toString(),this.signature,e)}_incommingDial(e,t,r,n){this.log("dial#"+t+" incomming from",r);const i=o(r),s=this.io.createSource(t+".dialer"),a=this.io.createSink(t+".listener");n();const u=new l({sink:a,source:s},{getObservedAddrs:e=>e(null,[i])});this.emit("connection",u),this._handler(u)}listen(e,t){this.ma=e,this.server=y(e),this.listeners_list[this.server]=this,t=t?h(t):m,c([e=>this._up(e),e=>this._crypto(e)],e=>{if(e)return this.log("error",e),e instanceof Error||(e=new Error(e)),this._down(),this.emit("error",e),this.emit("close"),t(e);this.log("success"),this.io.on("reconnect",()=>{this.signature=null,this._crypto(e=>{e?(this.log("reconnect error",e),this.emit("error",e)):this.log("reconnected")})}),this.emit("listening"),t()})}getAddrs(e){p(()=>e(null,this.ma?[this.ma]:[]))}close(e){e=e?h(e):m,this._down(),e()}dial(e,t,r){"function"==typeof t&&(r=t,t={});const n=o(e),s=new l(null),a=u(),c=this.log.bind(i,"dial#"+a);r=r?h(r):m;let f=this.io;if(!f)return r(new Error("Not listening"));const p=f.createSink(a+".dialer");return c("dialing",e.toString()),f.emit("ss-dial",this.ma.toString(),e.toString(),a,e=>{if(e)return r(e instanceof Error?e:new Error(e));c(e?"error: "+e.toString():"success");const t=f.createSource(a+".listener");s.setInnerConn({sink:p,source:t},{getObservedAddrs:e=>e(null,[n])}),r(null,s)}),s}}e.exports=v}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(t){const n=r(1143),i=r(534),o=r(8),s=(e,t)=>"socket.io-pull-stream."+e+(t?"."+t:""),a=r(1),u=a("socket.io-pull-stream");function c(e,t){if(null==t)return t;try{return e(t)}catch(e){return console.error("Codec Error"),console.error(e),!1}}const f={hex:{encode:e=>e.toString("hex"),decode:e=>t.from(e,"hex")},plain:{encode:e=>e,decode:e=>e},buffer:{encode:e=>t.from(e),decode:e=>t.from(e)}};function l(e){if(e||(e="plain"),"object"==typeof e)return e;const t=f[e];if(!t)throw new Error("Invalid codec "+e);return t}function h(e,t,r){const i=n(),o=e.sioplog.bind(e.sioplog,"source("+t+")"),a=l(r.codec).decode;function u(){e.removeAllListeners(s("error",t)),e.removeAllListeners(s("queue",t))}return o("create source"),e.emit(s("accept",t)),e.on(s("error",t),e=>{o(!0===e?"finish":"error"),u(),i.append({end:e})}),e.on(s("queue",t),e=>{o("queue data"),i.append({data:c(a,e)})}),e.once("disconnect",()=>{u(),i.append({end:!0})}),function(e,t){if(o("reading"),e)return t(e);i.get((e,r)=>e?t(e):r.end?(i.error(r.end),t(r.end)):t(null,r.data))}}function p(e,t,r){const i=n(),o=e.sioplog.bind(e.sioplog," sink("+t+")"),a=l(r.codec).encode;let u;function f(e){i.append({err:e}),u=e}return o("create sink"),e.once(s("accept",t),()=>{function r(){i.get((n,u)=>{let{data:f,err:l}=u||{};if(n&&(l=n),o("send",l&&!0===l?"finish":l?"error":f?"data":"<invalid>"),l&&!n&&i.error(l),l)return e.emit(s("error",t),l);f&&e.emit(s("queue",t),c(a,f)),r()})}o("start transmission"),r()}),e.once("disconnect",()=>f(!0)),function(e){e(null,function t(r,n){return r?f(r):u?e(u,t):(i.append({data:n}),void e(null,t))})}}e.exports=function e(t,r){t.createSink||(t.sioplog=t.id?u.bind(u,"["+t.id+"]"):u,t.createSink=((e,n)=>{e||(e=i());const o=p(t,e,r||n);return o.id=e,o}),t.createSource=((e,n)=>{const i=h(t,e,r||n);return i.id=e,i}),t.createProxy=((e,r,n)=>{o(t.createSource(e,n),r.createSink(e,n))}))}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";const n=r(10).EventEmitter;function i(){const e=new n;let t=[],r;function i(){e.removeAllListeners("err"),e.removeAllListeners("data")}return{append:n=>{if(r)return r;t.push(n),e.emit("data")},prepend:e=>{if(r)return r;t.unshift(e)},error:t=>{r=t,e.emit("err",t)},get:n=>(i(),r?n(r):t.length?n(null,t.shift()):(e.once("err",e=>{i(),n(e)}),void e.once("data",()=>(i(),n(null,t.shift()))))),height:()=>t.length}}e.exports=i},function(e,t,r){var n=r(354),i=r(355),o,s,a=0,u=0;function c(e,t,r){var c=t&&r||0,f=t||[];e=e||{};var l=e.node||o,h=void 0!==e.clockseq?e.clockseq:s;if(null==l||null==h){var p=n();null==l&&(l=o=[1|p[0],p[1],p[2],p[3],p[4],p[5]]),null==h&&(h=s=16383&(p[6]<<8|p[7]))}var d=void 0!==e.msecs?e.msecs:(new Date).getTime(),y=void 0!==e.nsecs?e.nsecs:u+1,g=d-a+(y-u)/1e4;if(g<0&&void 0===e.clockseq&&(h=h+1&16383),(g<0||d>a)&&void 0===e.nsecs&&(y=0),y>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");a=d,u=y,s=h,d+=122192928e5;var m=(1e4*(268435455&d)+y)%4294967296;f[c++]=m>>>24&255,f[c++]=m>>>16&255,f[c++]=m>>>8&255,f[c++]=255&m;var b=d/4294967296*1e4&268435455;f[c++]=b>>>8&255,f[c++]=255&b,f[c++]=b>>>24&15|16,f[c++]=b>>>16&255,f[c++]=h>>>8|128,f[c++]=255&h;for(var v=0;v<6;++v)f[c+v]=l[v];return t||i(f)}e.exports=c},function(e,t,r){"use strict";const n=r(142),i=r(1146),o=r(535),s=r(1150),a=r(292);function u(e,t){const r=n(e);r.on("end",()=>r.destroy());const o=new i({halfOpen:!0,initiator:!t});return a(r,o,r),new s(e,o)}t=e.exports=u,t.multicodec=o,t.dialer=(e=>u(e,!1)),t.listener=(e=>u(e,!0))},function(e,t,r){"use strict";(function(t){const n=r(21),i=r(23),o=r(1147),s=r(1),a=r(1149),u=t.from([0]),c=t.alloc(0);let f=t.alloc(10240),l=0;class h extends n.Duplex{constructor(e,r){super(),"function"==typeof e&&(r=e,e={}),e||(e={}),r&&this.on("stream",r),this.destroyed=!1,this.limit=e.limit||0,null==e.initiator&&(e.initiator=!0),this.initiator=e.initiator,this._corked=0,this._options=e,this._binaryName=Boolean(e.binaryName),this._local=[],this._remote=[],this._list=this._local,this._receiving=null,this._chunked=!1,this._state=0,this._type=0,this._channel=0,this._missing=0,this._message=null,this.log=s("mplex:main:"+Math.floor(1e5*Math.random())),this.log("construction");let n=100;this.limit&&(n=i.encodingLength(this.limit)),this._buf=t.alloc(n),this._ptr=0,this._awaitChannelDrains=0,this._onwritedrain=null,this._ondrain=[],this._finished=!1,this.once("finish",this._clear),this._nextId=this.initiator?0:1}_nextStreamId(){let e=this._nextId;return this._nextId+=2,e}createStream(e,t){if(this.destroyed)throw new Error("Multiplexer is destroyed");const r=this._nextStreamId();let n=this._name(e||r.toString());const i=Object.assign(this._options,t);this.log("createStream: %s",r,n.toString(),i);const o=new a(n,this,i);return this._addChannel(o,r,this._local)}receiveStream(e,t){if(this.destroyed)throw new Error("Multiplexer is destroyed");if(void 0===e||null===e)throw new Error("Name is needed when receiving a stream");const r=this._name(e);this.log("receiveStream: "+r.toString());const n=new a(r,this,Object.assign(this._options,t));if(this._receiving||(this._receiving={}),this._receiving[n.name])throw new Error("You are already receiving this stream");return this._receiving[n.name]=n,n}createSharedStream(e,t){return this.log("createSharedStream"),o(this.createStream(e,Object.assign(t,{lazy:!0})),this.receiveStream(e,t))}_name(e){return this._binaryName?t.isBuffer(e)?e:t.from(e):e.toString()}_send(e,r){const n=r?r.length:0,o=l;let s=!0;return this.log("_send",e,n),i.encode(e,f,l),l+=i.encode.bytes,i.encode(n,f,l),l+=i.encode.bytes,s=this.push(f.slice(o,l)),f.length-l<100&&(f=t.alloc(10240),l=0),r&&(s=this.push(r)),s}_addChannel(e,t,r){return this.log("_addChannel",t),r[t]=e,e.on("finalize",()=>{this.log("_remove channel",t),r[t]=null}),e.open(t,r===this._local),e}_writeVarint(e,t){for(;t<e.length;t++){if(this._ptr===this._buf.length)return this._lengthError(e);if(this._buf[this._ptr++]=e[t],!(128&e[t])){if(0===this._state){const e=i.decode(this._buf);this._type=7&e,this._channel=e>>3,this._list=1&this._type?this._local:this._remote;const t=this._list.length>this._channel&&this._list[this._channel]&&this._list[this._channel].chunked;this._chunked=Boolean(1===this._type||2===this._type)&&t}else if(this._missing=i.decode(this._buf),this.limit&&this._missing>this.limit)return this._lengthError(e);return this._state++,this._ptr=0,t+1}}return e.length}_lengthError(e){return this.destroy(new Error("Incoming message is too big")),e.length}_writeMessage(e,r){const n=e.length-r,i=this._missing;if(!this._message){if(i<=n)return this._missing=0,this._push(e.slice(r,r+i)),r+i;if(this._chunked)return this._missing-=n,this._push(e.slice(r,e.length)),e.length;this._message=t.alloc(i)}return e.copy(this._message,this._ptr,r,r+i),i<=n?(this._missing=0,this._push(this._message),r+i):(this._missing-=n,this._ptr+=n,e.length)}_push(e){if(this.log("_push",e.length),this._missing||(this._ptr=0,this._state=0,this._message=null),0===this._type){if(this.log("open",this._channel),this.destroyed||this._finished)return;let t,r;return t=this._binaryName?e:e.toString()||this._channel.toString(),this.log("open name",t),void(this._receiving&&this._receiving[t]?(r=this._receiving[t],delete this._receiving[t],this._addChannel(r,this._channel,this._list)):(r=new a(t,this,this._options),this.emit("stream",this._addChannel(r,this._channel,this._list),r.name)))}const t=this._list[this._channel];if(t)switch(this._type){case 5:case 6:{const r=new Error(e.toString()||"Channel destroyed");return void t._destroy(r,!1)}case 3:case 4:return void t.push(null);case 1:case 2:t.push(e)||(this._awaitChannelDrains++,t._awaitDrain++)}}_onchanneldrain(e){if(this._awaitChannelDrains-=e,this._awaitChannelDrains)return;const t=this._onwritedrain;this._onwritedrain=null,t&&t()}_write(e,t,r){if(this.log("_write",e.length),this._finished)return void r();if(this._corked)return void this._onuncork(this._write.bind(this,e,t,r));if(e===u)return void this._finish(r);let n=0;for(;n<e.length;)n=2===this._state?this._writeMessage(e,n):this._writeVarint(e,n);2!==this._state||this._missing||this._push(c),this._awaitChannelDrains?this._onwritedrain=r:r()}_finish(e){this._onuncork(()=>{!1===this._writableState.prefinished&&(this._writableState.prefinished=!0),this.emit("prefinish"),this._onuncork(e)})}cork(){1==++this._corked&&this.emit("cork")}uncork(){this._corked&&0==--this._corked&&this.emit("uncork")}end(e,t,r){return this.log("end"),"function"==typeof e&&(r=e,e=void 0),"function"==typeof t&&(r=t,t=void 0),e&&this.write(e),this._writableState.ending||this.write(u),n.Writable.prototype.end.call(this,r)}_onuncork(e){this._corked?this.once("uncork",e):e()}_read(){for(;this._ondrain.length;)this._ondrain.shift()()}_clear(){if(this.log("_clear"),this._finished)return;this._finished=!0;const e=this._local.concat(this._remote);this._local=[],this._remote=[],e.forEach(function(e){e&&e._destroy(null,!1)}),this.push(null)}finalize(){this._clear()}destroy(e){if(this.log("destroy"),this.destroyed)this.log("already destroyed");else{var t=this._local.concat(this._remote);this.destroyed=!0,e&&this.emit("error",e),this.emit("close"),t.forEach(function(t){t&&t.emit("error",e||new Error("underlying socket has been closed"))}),this._clear()}}}e.exports=h}).call(this,r(0).Buffer)},function(e,t,r){(function(t,n){var i=r(21),o=r(291),s=r(4),a=r(1148),u=t.from&&t.from!==Uint8Array.from?t.from([0]):new t([0]),c=function(e,t){e._corked?e.once("uncork",t):t()},f=function(e,t){e._autoDestroy&&e.destroy(t)},l=function(e,t){return function(r){r?f(e,"premature close"===r.message?null:r):t&&!e._ended&&e.end()}},h=function(e,t){return e?e._writableState&&e._writableState.finished?t():e._writableState?e.end(t):(e.end(),void t()):t()},p=function(e){return new i.Readable({objectMode:!0,highWaterMark:16}).wrap(e)},d=function(e,t,r){if(!(this instanceof d))return new d(e,t,r);i.Duplex.call(this,r),this._writable=null,this._readable=null,this._readable2=null,this._autoDestroy=!r||!1!==r.autoDestroy,this._forwardDestroy=!r||!1!==r.destroy,this._forwardEnd=!r||!1!==r.end,this._corked=1,this._ondrain=null,this._drained=!1,this._forwarding=!1,this._unwrite=null,this._unread=null,this._ended=!1,this.destroyed=!1,e&&this.setWritable(e),t&&this.setReadable(t)};s(d,i.Duplex),d.obj=function(e,t,r){return r||(r={}),r.objectMode=!0,r.highWaterMark=16,new d(e,t,r)},d.prototype.cork=function(){1==++this._corked&&this.emit("cork")},d.prototype.uncork=function(){this._corked&&0==--this._corked&&this.emit("uncork")},d.prototype.setWritable=function(e){if(this._unwrite&&this._unwrite(),this.destroyed)e&&e.destroy&&e.destroy();else if(null!==e&&!1!==e){var t=this,r=o(e,{writable:!0,readable:!1},l(this,this._forwardEnd)),i=function(){var e=t._ondrain;t._ondrain=null,e&&e()},s=function(){t._writable.removeListener("drain",i),r()};this._unwrite&&n.nextTick(i),this._writable=e,this._writable.on("drain",i),this._unwrite=s,this.uncork()}else this.end()},d.prototype.setReadable=function(e){if(this._unread&&this._unread(),this.destroyed)e&&e.destroy&&e.destroy();else{if(null===e||!1===e)return this.push(null),void this.resume();var t=this,r=o(e,{writable:!1,readable:!0},l(this)),n=function(){t._forward()},i=function(){t.push(null)},s=function(){t._readable2.removeListener("readable",n),t._readable2.removeListener("end",i),r()};this._drained=!0,this._readable=e,this._readable2=e._readableState?e:p(e),this._readable2.on("readable",n),this._readable2.on("end",i),this._unread=s,this._forward()}},d.prototype._read=function(){this._drained=!0,this._forward()},d.prototype._forward=function(){if(!this._forwarding&&this._readable2&&this._drained){var e;for(this._forwarding=!0;this._drained&&null!==(e=a(this._readable2));)this.destroyed||(this._drained=this.push(e));this._forwarding=!1}},d.prototype.destroy=function(e){if(!this.destroyed){this.destroyed=!0;var t=this;n.nextTick(function(){t._destroy(e)})}},d.prototype._destroy=function(e){if(e){var t=this._ondrain;this._ondrain=null,t?t(e):this.emit("error",e)}this._forwardDestroy&&(this._readable&&this._readable.destroy&&this._readable.destroy(),this._writable&&this._writable.destroy&&this._writable.destroy()),this.emit("close")},d.prototype._write=function(e,t,r){return this.destroyed?r():this._corked?c(this,this._write.bind(this,e,t,r)):e===u?this._finish(r):this._writable?void(!1===this._writable.write(e)?this._ondrain=r:r()):r()},d.prototype._finish=function(e){var t=this;this.emit("preend"),c(this,function(){h(t._forwardEnd&&t._writable,function(){!1===t._writableState.prefinished&&(t._writableState.prefinished=!0),t.emit("prefinish"),c(t,e)})})},d.prototype.end=function(e,t,r){return"function"==typeof e?this.end(null,null,e):"function"==typeof t?this.end(e,null,t):(this._ended=!0,e&&this.write(e),this._writableState.ending||this.write(u),i.Writable.prototype.end.call(this,r))},e.exports=d}).call(this,r(0).Buffer,r(6))},function(e,t){function r(e){var t=e._readableState;return t?t.objectMode?e.read():e.read(n(t)):null}function n(e){return e.buffer.length?e.buffer.head?e.buffer.head.data.length:e.buffer[0].length:e.length}e.exports=r},function(e,t,r){"use strict";(function(t){const n=r(21),i=r(1);class o extends n.Duplex{constructor(e,t,r){const n=Boolean(r.halfOpen);super({allowHalfOpen:n}),this.name=e,this.log=i("mplex:channel:"+this.name.toString()),this.channel=0,this.initiator=!1,this.chunked=Boolean(r.chunked),this.halfOpen=n,this.destroyed=!1,this.finalized=!1,this._multiplex=t,this._dataHeader=0,this._opened=!1,this._awaitDrain=0,this._lazy=Boolean(r.lazy);let o=!1,s=!1;this.log("open, halfOpen: "+this.halfOpen),this.once("end",()=>{this.log("end"),this._read(),this.destroyed||(s=!0,o?this._finalize():this.halfOpen||this.end())}),this.once("finish",function e(){if(!this.destroyed){if(!this._opened)return this.once("open",e);this._lazy&&this.initiator&&this._open(),this._multiplex._send(this.channel<<3|(this.initiator?4:3),null),o=!0,s&&this._finalize()}})}destroy(e){this._destroy(e,!0)}_destroy(e,r){if(this.log("_destroy:"+(r?"local":"remote")),this.destroyed)return void this.log("already destroyed");this.destroyed=!0;const n=this.listenerCount("error")>0;if(!e||r&&!n||this.emit("error",e),this.emit("close"),r&&this._opened){this._lazy&&this.initiator&&this._open();const r=e?t.from(e.message):null;try{this._multiplex._send(this.channel<<3|(this.initiator?6:5),r)}catch(e){}}this._finalize()}_finalize(){this.finalized||(this.finalized=!0,this.emit("finalize"))}_write(e,t,r){if(this.log("write: ",e.length),!this._opened)return void this.once("open",()=>{this._write(e,t,r)});if(this.destroyed)return void r();this._lazy&&this.initiator&&this._open();const n=this._multiplex._send(this._dataHeader,e);n?r():this._multiplex._ondrain.push(r)}_read(){if(this._awaitDrain){const e=this._awaitDrain;this._awaitDrain=0,this._multiplex._onchanneldrain(e)}}_open(){let e=null;t.isBuffer(this.name)?e=this.name:this.name!==this.channel.toString()&&(e=t.from(this.name)),this._lazy=!1,this._multiplex._send(this.channel<<3|0,e)}open(e,t){this.log("open: "+e),this.channel=e,this.initiator=t,this._dataHeader=e<<3|(t?2:1),this._opened=!0,!this._lazy&&this.initiator&&this._open(),this.emit("open")}}e.exports=o}).call(this,r(0).Buffer)},function(e,t,r){"use strict";const n=r(10).EventEmitter,i=r(44).Connection,o=r(141),s=r(8),a=r(1151),u=r(3),c=r(535);function f(){}function l(e){return{source:s(e.source,a(e=>{if("Channel destroyed"!==e.message)return!1})),sink:e.sink}}class h extends n{constructor(e,t){super(),this.multiplex=t,this.conn=e,this.multicodec=c,t.on("close",()=>this.emit("close")),t.on("error",e=>this.emit("error",e)),t.on("stream",(e,t)=>{const r=new i(l(o.duplex(e)),this.conn);this.emit("stream",r)})}newStream(e){let t;e=e||f;try{t=this.multiplex.createStream()}catch(t){return u(()=>e(t))}const r=new i(l(o.duplex(t)),this.conn);return u(()=>e(null,r)),r}end(e){e=e||f,this.multiplex.once("close",e),this.multiplex.destroy()}}e.exports=h},function(e,t){e.exports=function e(t){var r;return t=t||function e(){},function e(n){return function e(i,o){n(i,function e(n,i){if(r)return o(!0);if(n&&!0!==n){var s=t(n);return!1===s?o(n):s&&!0!==s?(r=!0,o(null,s)):o(!0)}o(n,i)})}}}},function(e,t){},function(e,t,r){"use strict";const n=r(8),i=r(44).Connection,o=r(13),s=r(52),a=r(1),u=r(35),c=a("libp2p:secio");c.error=a("libp2p:secio:error");const f=r(1154),l=r(1176);e.exports={tag:"/secio/1.0.0",encrypt(e,t,r,a){o(e,"no local private key provided"),o(t,"no connection for the handshake provided"),"function"==typeof r&&(a=r,r=void 0),a=u(a||function(e){e&&c.error(e)});const h=3e5,p=new l(e,r,3e5,a);function d(e){if(e)return a(e);t.getPeerInfo((e,r)=>{y.setInnerConn(new i(p.secure,t)),e&&y.setPeerInfo(new s(p.id.remote)),a()})}const y=new i(void 0,t);return n(t,f(p,d),t),y}}},function(e,t,r){"use strict";const n=r(37),i=r(1155),o=r(1173),s=r(1174);e.exports=function e(t,r){return n([e=>i(t,e),e=>o(t,e),e=>s(t,e)],e=>{t.cleanSecrets(),e&&(!0===e&&(e=new Error("Stream ended prematurely")),t.shake.abort(e)),r(e)}),t.stream}},function(e,t,r){"use strict";const n=r(1),i=r(5),o=r(293),s=r(299),a=n("libp2p:secio");a.error=n("libp2p:secio:error"),e.exports=function e(t,r){a("1. propose - start"),a("1. propose - writing proposal"),o.write(t,s.createProposal(t)),i([e=>o.read(t.shake,e),(e,r)=>{a("1. propose - reading proposal",e),s.identify(t,e,r)},e=>s.selectProtocols(t,e)],e=>{if(e)return r(e);a("1. propose - finish"),r()})}},function(e,t,r){"use strict";(function(t){const n=r(48),i=r(49),o=r(536),s=r(1157),a=o.toCallback,u=o.toBuf,c=o.fromString,f=o.fromNumberTo32BitBuf,l=(e,r)=>{s.sha2256(e,(e,n)=>{e&&r(e),s.sha2256(t.from(n),r)})};e.exports={sha1:s.sha1,sha2256:s.sha2256,sha2512:s.sha2512,sha3512:a(u(n.sha3_512)),sha3384:a(u(n.sha3_384)),sha3256:a(u(n.sha3_256)),sha3224:a(u(n.sha3_224)),shake128:a(u(n.shake_128,256)),shake256:a(u(n.shake_256,512)),keccak224:a(u(n.keccak_224)),keccak256:a(u(n.keccak_256)),keccak384:a(u(n.keccak_384)),keccak512:a(u(n.keccak_512)),murmur3128:a(u(c(i.x64.hash128))),murmur332:a(f(c(i.x86.hash32))),addBlake:r(1158),dblSha2256:l}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(t){const n=r(50),i=o();function o(){return self.crypto?self.crypto.subtle||self.crypto.webkitSubtle:self.msCrypto?self.msCrypto.subtle:void 0}function s(e){if(!i)throw new Error("Please use a browser with webcrypto support");return(r,o)=>{const s=i.digest({name:e},r);if("function"!=typeof s.then)return s.onerror=(()=>{o(new Error(`hashing data using ${e}`))}),void(s.oncomplete=(e=>{o(null,e.target.result)}));n(s.then(e=>t.from(new Uint8Array(e))),o)}}function a(e,t){s("SHA-1")(e,t)}function u(e,t){s("SHA-256")(e,t)}function c(e,t){s("SHA-512")(e,t)}e.exports={sha1:a,sha2256:u,sha2512:c}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(t){const n=r(51),i=r(536).toCallback,o=45569,s=45633,a={init:n.blake2bInit,update:n.blake2bUpdate,digest:n.blake2bFinal},u={init:n.blake2sInit,update:n.blake2sUpdate,digest:n.blake2sFinal},c=(e,r)=>i(n=>{const i=r.init(e,null);return r.update(i,n),t.from(r.digest(i))});e.exports=(e=>{for(let t=0;t<64;t++)e[o+t]=c(t+1,a);for(let t=0;t<32;t++)e[s+t]=c(t+1,u)})}).call(this,r(0).Buffer)},function(e,t,r){"use strict";e.exports={SHA1:20,SHA256:32,SHA512:64}},function(e,t,r){"use strict";const n=r(1161),i={16:"aes-128-ctr",32:"aes-256-ctr"};t.create=function(e,t,r){const o=i[e.length];if(!o)return r(new Error("Invalid key length"));const s=n.createCipheriv(o,e,t),a=n.createDecipheriv(o,e,t),u={encrypt(e,t){t(null,s.update(e))},decrypt(e,t){t(null,a.update(e))}};r(null,u)}},function(e,t,r){"use strict";const n=r(70);e.exports={createCipheriv:n.createCipheriv,createDecipheriv:n.createDecipheriv}},function(e,t,r){"use strict";(function(n){const i=r(12),o=i(r(298)),s=r(19);t=e.exports;const a={rsa:r(1163),ed25519:r(1165),secp256k1:r(72)(o,r(540))};function u(e){const t=a[e.toLowerCase()];return void 0!==t}t.supportedKeys=a,t.keysPBM=o,t.keyStretcher=r(1167),t.generateEphemeralKeyPair=r(1168),t.generateKeyPair=((e,t,r)=>{let n=a[e.toLowerCase()];if(!n)return r(new Error("invalid or unsupported key type"));n.generateKeyPair(t,r)}),t.generateKeyPairFromSeed=((e,t,r,n)=>{let i=a[e.toLowerCase()];return i?"ed25519"!==e.toLowerCase()?n(new Error("Seed key derivation is unimplemented for RSA or secp256k1")):void i.generateKeyPairFromSeed(t,r,n):n(new Error("invalid or unsupported key type"))}),t.unmarshalPublicKey=(e=>{const t=o.PublicKey.decode(e),r=t.Data;switch(t.Type){case o.KeyType.RSA:return a.rsa.unmarshalRsaPublicKey(r);case o.KeyType.Ed25519:return a.ed25519.unmarshalEd25519PublicKey(r);case o.KeyType.Secp256k1:if(a.secp256k1)return a.secp256k1.unmarshalSecp256k1PublicKey(r);throw new Error("secp256k1 support requires libp2p-crypto-secp256k1 package");default:throw new Error("invalid or unsupported key type")}}),t.marshalPublicKey=((e,t)=>{if(t=(t||"rsa").toLowerCase(),!u(t))throw new Error("invalid or unsupported key type");return e.bytes}),t.unmarshalPrivateKey=((e,t)=>{let r;try{r=o.PrivateKey.decode(e)}catch(e){return t(e)}const n=r.Data;switch(r.Type){case o.KeyType.RSA:return a.rsa.unmarshalRsaPrivateKey(n,t);case o.KeyType.Ed25519:return a.ed25519.unmarshalEd25519PrivateKey(n,t);case o.KeyType.Secp256k1:return a.secp256k1?a.secp256k1.unmarshalSecp256k1PrivateKey(n,t):t(new Error("secp256k1 support requires libp2p-crypto-secp256k1 package"));default:t(new Error("invalid or unsupported key type"))}}),t.marshalPrivateKey=((e,t)=>{if(t=(t||"rsa").toLowerCase(),!u(t))throw new Error("invalid or unsupported key type");return e.bytes}),t.import=((e,t,r)=>{try{const i=s.pki.decryptRsaPrivateKey(e,t);if(null===i)throw new Error("Cannot read the key, most likely the password is wrong or not a RSA key");let o=s.asn1.toDer(s.pki.privateKeyToAsn1(i));return o=n.from(o.getBytes(),"binary"),a.rsa.unmarshalRsaPrivateKey(o,r)}catch(e){r(e)}})}).call(this,r(0).Buffer)},function(e,t,r){"use strict";const n=r(294),i=r(12),o=r(18),s=r(538),a=i(r(298)),u=r(19),c=r(3);class f{constructor(e){this._key=e}verify(e,t,r){g(r),s.hashAndVerify(this._key,t,e,r)}marshal(){return s.utils.jwkToPkix(this._key)}get bytes(){return a.PublicKey.encode({Type:a.KeyType.RSA,Data:this.marshal()})}encrypt(e){return this._key.encrypt(e,"RSAES-PKCS1-V1_5")}equals(e){return this.bytes.equals(e.bytes)}hash(e){g(e),n(this.bytes,"sha2-256",e)}}class l{constructor(e,t){this._key=e,this._publicKey=t}genSecret(){return s.getRandomValues(new Uint8Array(16))}sign(e,t){g(t),s.hashAndSign(this._key,e,t)}get public(){if(!this._publicKey)throw new Error("public key not provided");return new f(this._publicKey)}decrypt(e,t){s.decrypt(this._key,e,t)}marshal(){return s.utils.jwkToPkcs1(this._key)}get bytes(){return a.PrivateKey.encode({Type:a.KeyType.RSA,Data:this.marshal()})}equals(e){return this.bytes.equals(e.bytes)}hash(e){g(e),n(this.bytes,"sha2-256",e)}id(e){this.public.hash((t,r)=>{if(t)return e(t);e(null,o.encode(r))})}export(e,t,r){"function"==typeof t&&(r=t,t=e,e="pkcs-8"),g(r),c(()=>{let n=null,i=null;try{const r=new u.util.ByteBuffer(this.marshal()),o=u.asn1.fromDer(r),s=u.pki.privateKeyFromAsn1(o);if("pkcs-8"===e){const e={algorithm:"aes256",count:1e4,saltSize:16,prfAlgorithm:"sha512"};i=u.pki.encryptRsaPrivateKey(s,t,e)}else n=new Error(`Unknown export format '${e}'`)}catch(e){n=e}r(n,i)})}}function h(e,t){const r=s.utils.pkcs1ToJwk(e);s.unmarshalPrivateKey(r,(e,r)=>{if(e)return t(e);t(null,new l(r.privateKey,r.publicKey))})}function p(e){const t=s.utils.pkixToJwk(e);return new f(t)}function d(e,t){s.unmarshalPrivateKey(e,(e,r)=>{if(e)return t(e);t(null,new l(r.privateKey,r.publicKey))})}function y(e,t){s.generateKey(e,(e,r)=>{if(e)return t(e);t(null,new l(r.privateKey,r.publicKey))})}function g(e){if("function"!=typeof e)throw new Error("callback is required")}e.exports={RsaPublicKey:f,RsaPrivateKey:l,unmarshalRsaPublicKey:p,unmarshalRsaPrivateKey:h,generateKeyPair:y,fromJwk:d}},function(e,t,r){"use strict";const n=r(17),i=r(539),o=i.toBase64,s=i.toBn,a=n.define("RSAPrivateKey",function(){this.seq().obj(this.key("version").int(),this.key("modulus").int(),this.key("publicExponent").int(),this.key("privateExponent").int(),this.key("prime1").int(),this.key("prime2").int(),this.key("exponent1").int(),this.key("exponent2").int(),this.key("coefficient").int())}),u=n.define("AlgorithmIdentifier",function(){this.seq().obj(this.key("algorithm").objid({"1.2.840.113549.1.1.1":"rsa"}),this.key("none").optional().null_(),this.key("curve").optional().objid(),this.key("params").optional().seq().obj(this.key("p").int(),this.key("q").int(),this.key("g").int()))}),c=n.define("RSAPublicKey",function(){this.seq().obj(this.key("algorithm").use(u),this.key("subjectPublicKey").bitstr())}),f=n.define("RSAPublicKey",function(){this.seq().obj(this.key("modulus").int(),this.key("publicExponent").int())});t.pkcs1ToJwk=function(e){const t=a.decode(e,"der");return{kty:"RSA",n:o(t.modulus),e:o(t.publicExponent),d:o(t.privateExponent),p:o(t.prime1),q:o(t.prime2),dp:o(t.exponent1),dq:o(t.exponent2),qi:o(t.coefficient),alg:"RS256",kid:"2011-04-29"}},t.jwkToPkcs1=function(e){return a.encode({version:0,modulus:s(e.n),publicExponent:s(e.e),privateExponent:s(e.d),prime1:s(e.p),prime2:s(e.q),exponent1:s(e.dp),exponent2:s(e.dq),coefficient:s(e.qi)},"der")},t.pkixToJwk=function(e){const t=c.decode(e,"der"),r=f.decode(t.subjectPublicKey.data,"der");return{kty:"RSA",n:o(r.modulus),e:o(r.publicExponent),alg:"RS256",kid:"2011-04-29"}},t.jwkToPkix=function(e){return c.encode({algorithm:{algorithm:"rsa",none:null},subjectPublicKey:{data:f.encode({modulus:s(e.n),publicExponent:s(e.e)},"der")}},"der")}},function(e,t,r){"use strict";(function(t){const n=r(294),i=r(12),o=r(18),s=r(1166),a=i(r(298));class u{constructor(e){this._key=y(e,s.publicKeyLength)}verify(e,t,r){d(r),s.hashAndVerify(this._key,t,e,r)}marshal(){return t.from(this._key)}get bytes(){return a.PublicKey.encode({Type:a.KeyType.Ed25519,Data:this.marshal()})}equals(e){return this.bytes.equals(e.bytes)}hash(e){d(e),n(this.bytes,"sha2-256",e)}}class c{constructor(e,t){this._key=y(e,s.privateKeyLength),this._publicKey=y(t,s.publicKeyLength)}sign(e,t){d(t),s.hashAndSign(this._key,e,t)}get public(){if(!this._publicKey)throw new Error("public key not provided");return new u(this._publicKey)}marshal(){return t.concat([t.from(this._key),t.from(this._publicKey)])}get bytes(){return a.PrivateKey.encode({Type:a.KeyType.Ed25519,Data:this.marshal()})}equals(e){return this.bytes.equals(e.bytes)}hash(e){d(e),n(this.bytes,"sha2-256",e)}id(e){this.public.hash((t,r)=>{if(t)return e(t);e(null,o.encode(r))})}}function f(e,t){try{e=y(e,s.privateKeyLength+s.publicKeyLength)}catch(e){return t(e)}const r=e.slice(0,s.privateKeyLength),n=e.slice(s.privateKeyLength,e.length);t(null,new c(r,n))}function l(e){return e=y(e,s.publicKeyLength),new u(e)}function h(e,t){void 0===t&&"function"==typeof e&&(t=e),s.generateKey((e,r)=>{if(e)return t(e);let n;try{n=new c(r.secretKey,r.publicKey)}catch(e){return void t(e)}t(null,n)})}function p(e,t,r){void 0===r&&"function"==typeof t&&(r=t),s.generateKeyFromSeed(e,(e,t)=>{if(e)return r(e);let n;try{n=new c(t.secretKey,t.publicKey)}catch(e){return void r(e)}r(null,n)})}function d(e){if("function"!=typeof e)throw new Error("callback is required")}function y(e,r){if(t.isBuffer(e)&&(e=new Uint8Array(e)),!(e instanceof Uint8Array)||e.length!==r)throw new Error("Key must be a Uint8Array or Buffer of length "+r);return e}e.exports={Ed25519PublicKey:u,Ed25519PrivateKey:c,unmarshalEd25519PrivateKey:f,unmarshalEd25519PublicKey:l,generateKeyPair:h,generateKeyPairFromSeed:p}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(e){const n=r(71),i=r(3);t.publicKeyLength=n.sign.publicKeyLength,t.privateKeyLength=n.sign.secretKeyLength,t.generateKey=function(e){i(()=>{let t;try{t=n.sign.keyPair()}catch(t){return e(t)}e(null,t)})},t.generateKeyFromSeed=function(e,t){i(()=>{let r;try{r=n.sign.keyPair.fromSeed(e)}catch(e){return t(e)}t(null,r)})},t.hashAndSign=function(t,r,o){i(()=>{o(null,e.from(n.sign.detached(r,t)))})},t.hashAndVerify=function(e,t,r,o){i(()=>{let i;try{i=n.sign.detached.verify(r,t,e)}catch(e){return o(e)}o(null,i)})}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(t){const n=r(47),i=r(537),o={"AES-128":{ivSize:16,keySize:16},"AES-256":{ivSize:16,keySize:32},Blowfish:{ivSize:8,cipherKeySize:32}};e.exports=((e,r,s,a)=>{const u=o[e];if(!u)return a(new Error("unkown cipherType passed"));if(!r)return a(new Error("unkown hashType passed"));const c=u.keySize,f=u.ivSize,l=20,h=t.from("key expansion"),p=2*(f+c+20);i.create(r,s,(e,r)=>{if(e)return a(e);r.digest(h,(e,i)=>{if(e)return a(e);let o=[],s=0;function u(e){r.digest(t.concat([i,h]),(t,n)=>{if(t)return e(t);let a=n.length;s+a>p&&(a=p-s),o.push(n),s+=a,r.digest(i,(t,r)=>{if(t)return e(t);i=r,e()})})}function l(e){if(e)return a(e);const r=p/2,n=t.concat(o),i=n.slice(0,r),s=n.slice(r,p),u=e=>({iv:e.slice(0,f),cipherKey:e.slice(f,f+c),macKey:e.slice(f+c)});a(null,{k1:u(i),k2:u(s)})}n(()=>s<p,u,l)})})})}).call(this,r(0).Buffer)},function(e,t,r){"use strict";const n=r(1169);e.exports=((e,t)=>{n.generateEphmeralKeyPair(e,t)})},function(e,t,r){"use strict";(function(e){const n=r(297)(),i=r(296),o=r(17).bignum,s=r(539),a=s.toBase64,u=s.toBn,c={"P-256":256,"P-384":384,"P-521":521};t.generateEphmeralKeyPair=function(t,r){i(n.subtle.generateKey({name:"ECDH",namedCurve:t},!0,["deriveBits"]).then(r=>{const o=(o,s,a)=>{let u;"function"==typeof s&&(a=s,s=void 0),u=s?n.subtle.importKey("jwk",p(t,s),{name:"ECDH",namedCurve:t},!1,["deriveBits"]):Promise.resolve(r.privateKey);const f=Promise.all([n.subtle.importKey("jwk",h(t,o),{name:"ECDH",namedCurve:t},!1,[]),u]);i(f.then(e=>n.subtle.deriveBits({name:"ECDH",namedCurve:t,public:e[0]},e[1],c[t])).then(t=>e.from(t)),a)};return n.subtle.exportKey("jwk",r.publicKey).then(e=>({key:l(e),genSharedKey:o}))}),r)};const f={"P-256":32,"P-384":48,"P-521":66};function l(t){const r=f[t.crv];return e.concat([e.from([4]),u(t.x).toArrayLike(e,"be",r),u(t.y).toArrayLike(e,"be",r)],1+2*r)}function h(t,r){const n=f[t];if(!r.slice(0,1).equals(e.from([4])))throw new Error("Invalid key format");const i=new o(r.slice(1,n+1)),s=new o(r.slice(1+n));return{kty:"EC",crv:t,x:a(i,n),y:a(s,n),ext:!0}}function p(e,t){const r=h(e,t.public);return r.d=a(new o(t.private)),r}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";const n=r(19),i={sha1:"sha1","sha2-256":"sha256","sha2-512":"sha512"};function o(e,t,r,o,s){const a=i[s];if(!a)throw new Error(`Hash '${s}' is unknown or not supported`);const u=n.pkcs5.pbkdf2(e,t,r,o,a);return n.util.encode64(u)}e.exports=o},function(e,t,r){"use strict";(function(n){const i=r(14),o=r(295),s=r(13),a=r(5);class u{constructor(e,t,r){s(n.isBuffer(e),"invalid id provided"),t&&r&&s(t.public.bytes.equals(r.bytes),"inconsistent arguments"),this._id=e,this._idB58String=i.toB58String(this.id),this._privKey=t,this._pubKey=r}get id(){return this._id}set id(e){throw new Error("Id is immutable")}get privKey(){return this._privKey}set privKey(e){this._privKey=e}get pubKey(){return this._pubKey?this._pubKey:this._privKey?this._privKey.public:void 0}set pubKey(e){this._pubKey=e}marshalPubKey(){if(this.pubKey)return o.keys.marshalPublicKey(this.pubKey)}marshalPrivKey(){if(this.privKey)return o.keys.marshalPrivateKey(this.privKey)}toPrint(){return this.toJSON()}toJSON(){return{id:this.toB58String(),privKey:c(this.marshalPrivKey()),pubKey:c(this.marshalPubKey())}}toHexString(){return i.toHexString(this.id)}toBytes(){return this.id}toB58String(){return this._idB58String}isEqual(e){if(n.isBuffer(e))return this.id.equals(e);if(e.id)return this.id.equals(e.id);throw new Error("not valid Id")}isValid(e){this.privKey&&this.privKey.public&&this.privKey.public.bytes&&n.isBuffer(this.pubKey.bytes)&&this.privKey.public.bytes.equals(this.pubKey.bytes)?e():e(new Error("Keys not match"))}}function c(e){if(e)return e.toString("base64")}t=e.exports=u,t.create=function(e,t){"function"==typeof e&&(t=e,e={}),e=e||{},e.bits=e.bits||2048,a([t=>o.keys.generateKeyPair("RSA",e.bits,t),(e,t)=>e.public.hash((r,n)=>{t(r,n,e)})],(e,r,n)=>{if(e)return t(e);t(null,new u(r,n))})},t.createFromHexString=function(e){return new u(i.fromHexString(e))},t.createFromBytes=function(e){return new u(e)},t.createFromB58String=function(e){return new u(i.fromB58String(e))},t.createFromPubKey=function(e,t){if("function"!=typeof t)throw new Error("callback is required");let r;try{let i=e;if("string"==typeof i&&(i=n.from(e,"base64")),!n.isBuffer(i))throw new Error("Supplied key is neither a base64 string nor a buffer");r=o.keys.unmarshalPublicKey(i)}catch(e){return t(e)}r.hash((e,n)=>{if(e)return t(e);t(null,new u(n,null,r))})},t.createFromPrivKey=function(e,t){if("function"!=typeof t)throw new Error("callback is required");let r=e;try{if("string"==typeof r&&(r=n.from(e,"base64")),!n.isBuffer(r))throw new Error("Supplied key is neither a base64 string nor a buffer")}catch(e){return t(e)}a([e=>o.keys.unmarshalPrivateKey(r,e),(e,t)=>e.public.hash((r,n)=>{t(r,n,e)})],(e,r,n)=>{if(e)return t(e);t(null,new u(r,n,n.public))})},t.createFromJSON=function(e,t){if("function"!=typeof t)throw new Error("callback is required");let r,s,c,f;try{r=i.fromB58String(e.id),s=e.privKey&&n.from(e.privKey,"base64"),c=e.pubKey&&n.from(e.pubKey,"base64"),f=c&&o.keys.unmarshalPublicKey(c)}catch(e){return t(e)}s?a([e=>o.keys.unmarshalPrivateKey(s,e),(e,t)=>e.public.hash((r,n)=>{t(r,n,e)}),(e,t,r)=>{f?f.hash((n,i)=>{r(n,e,t,i)}):r(null,e,t)}],(e,n,i,o)=>e?t(e):f&&!n.equals(o)?t(new Error("Public and private key do not match")):r&&!n.equals(r)?t(new Error("Id and private key do not match")):void t(null,new u(r,i,f))):t(null,new u(r,null,f))},t.isPeerId=function(e){return Boolean("object"==typeof e&&e._id&&e._idB58String)}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";e.exports="message Propose {\n optional bytes rand = 1;\n optional bytes pubkey = 2;\n optional string exchanges = 3;\n optional string ciphers = 4;\n optional string hashes = 5;\n}\n\nmessage Exchange {\n optional bytes epubkey = 1;\n optional bytes signature = 2;\n}"},function(e,t,r){"use strict";const n=r(1),i=r(5),o=r(293),s=r(299),a=n("libp2p:secio");a.error=n("libp2p:secio:error"),e.exports=function e(t,r){a("2. exchange - start"),a("2. exchange - writing exchange"),i([e=>s.createExchange(t,e),(e,r)=>{o.write(t,e),o.read(t.shake,r)},(e,r)=>{a("2. exchange - reading exchange"),s.verify(t,e,r)},e=>s.generateKeys(t,e)],e=>{if(e)return r(e);a("2. exchange - finish"),r()})}},function(e,t,r){"use strict";const n=r(8),i=r(102),o=r(1),s=o("libp2p:secio");s.error=o("libp2p:secio:error");const a=r(1175),u=r(299);e.exports=function e(t,r){s("3. finish - start");const o=t.protocols,c=t.shake.rest(),f=i({timeout:t.timeout},e=>{if(e)throw e});n(c,a.createUnboxStream(o.remote.cipher,o.remote.mac),f,a.createBoxStream(o.local.cipher,o.local.mac),c),f.handshake.write(t.proposal.in.rand),f.handshake.read(t.proposal.in.rand.length,(e,i)=>{const o=e=>{s.error(e),t.secure.resolve({source:n.error(e),sink(e){}}),r(e)};if(e)return o(e);try{u.verifyNonce(t,i)}catch(e){return o(e)}s("3. finish - finish"),t.secure.resolve(f.handshake.rest()),r()})}},function(e,t,r){"use strict";(function(e){const n=r(8),i=r(53),o={fixed:!0,bytes:4};function s(){return n.map(t=>"string"==typeof t?e.from(t,"utf-8"):t)}t.createBoxStream=((t,r)=>n(s(),n.asyncMap((n,i)=>{t.encrypt(n,(t,n)=>{if(t)return i(t);r.digest(n,(t,r)=>{if(t)return i(t);i(null,e.concat([n,r]))})})}),i.encode(o))),t.createUnboxStream=((e,t)=>n(s(),i.decode(o),n.asyncMap((r,n)=>{const i=r.length,o=t.length;if(i<o)return n(new Error(`buffer (${i}) shorter than MAC size (${o})`));const s=i-o,a=r.slice(0,s),u=r.slice(s);t.digest(a,(t,r)=>t?n(t):u.equals(r)?void e.decrypt(a,(e,t)=>{if(e)return n(e);n(null,t)}):n(new Error(`MAC Invalid: ${u.toString("hex")} != ${r.toString("hex")}`)))})))}).call(this,r(0).Buffer)},function(e,t,r){"use strict";const n=r(102),i=r(165);class o{constructor(e,t,r,o){"function"==typeof r&&(o=r,r=void 0),this.setup(),this.id.local=e,this.id.remote=t,this.key.local=e.privKey,this.timeout=r||6e4,o=o||(()=>{}),this.secure=i.duplex(),this.stream=n({timeout:this.timeout},o),this.shake=this.stream.handshake,delete this.stream.handshake}setup(){this.id={local:null,remote:null},this.key={local:null,remote:null},this.shake=null,this.cleanSecrets()}cleanSecrets(){this.shared={},this.ephemeralKey={local:null,remote:null},this.proposal={in:null,out:null},this.proposalEncoded={in:null,out:null},this.protocols={local:null,remote:null},this.exchange={in:null,out:null}}}e.exports=o},function(e,t,r){"use strict";const n=r(1178),i=r(52),o=r(31),s=r(80),a=r(10).EventEmitter,u=r(1),c=r(3),f=u("libp2p:railing");function l(e){try{return s.IPFS.matches(e)}catch(e){return!1}}f.error=u("libp2p:railing:error");class h extends a{constructor(e){super(),this._list=e.list,this._interval=e.interval||1e4,this._timer=null}start(e){c(()=>e()),this._timer||(this._timer=setInterval(()=>{this._list.forEach(e=>{if(!l(e))return f.error("Invalid multiaddr");const t=o(e),r=n.createFromB58String(t.getPeerId());i.create(r,(e,r)=>{if(e)return f.error("Invalid bootstrap peer id",e);r.multiaddrs.add(t),this.emit("peer",r)})})},this._interval))}stop(e){c(e),this._timer&&(clearInterval(this._timer),this._timer=null)}}t=e.exports=h,t.tag="bootstrap"},function(e,t,r){"use strict";(function(n){const i=r(14),o=r(1179),s=r(13),a=r(5);class u{constructor(e,t,r){s(n.isBuffer(e),"invalid id provided"),t&&r&&s(t.public.bytes.equals(r.bytes),"inconsistent arguments"),this._id=e,this._idB58String=i.toB58String(this.id),this._privKey=t,this._pubKey=r}get id(){return this._id}set id(e){throw new Error("Id is immutable")}get privKey(){return this._privKey}set privKey(e){this._privKey=e}get pubKey(){return this._pubKey?this._pubKey:this._privKey?this._privKey.public:void 0}set pubKey(e){this._pubKey=e}marshalPubKey(){if(this.pubKey)return o.keys.marshalPublicKey(this.pubKey)}marshalPrivKey(){if(this.privKey)return o.keys.marshalPrivateKey(this.privKey)}toPrint(){return this.toJSON()}toJSON(){return{id:this.toB58String(),privKey:c(this.marshalPrivKey()),pubKey:c(this.marshalPubKey())}}toHexString(){return i.toHexString(this.id)}toBytes(){return this.id}toB58String(){return this._idB58String}isEqual(e){if(n.isBuffer(e))return this.id.equals(e);if(e.id)return this.id.equals(e.id);throw new Error("not valid Id")}isValid(e){this.privKey&&this.privKey.public&&this.privKey.public.bytes&&n.isBuffer(this.pubKey.bytes)&&this.privKey.public.bytes.equals(this.pubKey.bytes)?e():e(new Error("Keys not match"))}}function c(e){if(e)return e.toString("base64")}t=e.exports=u,t.create=function(e,t){"function"==typeof e&&(t=e,e={}),e=e||{},e.bits=e.bits||2048,a([t=>o.keys.generateKeyPair("RSA",e.bits,t),(e,t)=>e.public.hash((r,n)=>{t(r,n,e)})],(e,r,n)=>{if(e)return t(e);t(null,new u(r,n))})},t.createFromHexString=function(e){return new u(i.fromHexString(e))},t.createFromBytes=function(e){return new u(e)},t.createFromB58String=function(e){return new u(i.fromB58String(e))},t.createFromPubKey=function(e,t){if("function"!=typeof t)throw new Error("callback is required");let r;try{let i=e;if("string"==typeof i&&(i=n.from(e,"base64")),!n.isBuffer(i))throw new Error("Supplied key is neither a base64 string nor a buffer");r=o.keys.unmarshalPublicKey(i)}catch(e){return t(e)}r.hash((e,n)=>{if(e)return t(e);t(null,new u(n,null,r))})},t.createFromPrivKey=function(e,t){if("function"!=typeof t)throw new Error("callback is required");let r=e;try{if("string"==typeof r&&(r=n.from(e,"base64")),!n.isBuffer(r))throw new Error("Supplied key is neither a base64 string nor a buffer")}catch(e){return t(e)}a([e=>o.keys.unmarshalPrivateKey(r,e),(e,t)=>e.public.hash((r,n)=>{t(r,n,e)})],(e,r,n)=>{if(e)return t(e);t(null,new u(r,n,n.public))})},t.createFromJSON=function(e,t){if("function"!=typeof t)throw new Error("callback is required");let r,s,c,f;try{r=i.fromB58String(e.id),s=e.privKey&&n.from(e.privKey,"base64"),c=e.pubKey&&n.from(e.pubKey,"base64"),f=c&&o.keys.unmarshalPublicKey(c)}catch(e){return t(e)}s?a([e=>o.keys.unmarshalPrivateKey(s,e),(e,t)=>e.public.hash((r,n)=>{t(r,n,e)}),(e,t,r)=>{f?f.hash((n,i)=>{r(n,e,t,i)}):r(null,e,t)}],(e,n,i,o)=>e?t(e):f&&!n.equals(o)?t(new Error("Public and private key do not match")):r&&!n.equals(r)?t(new Error("Id and private key do not match")):void t(null,new u(r,i,f))):t(null,new u(r,null,f))},t.isPeerId=function(e){return Boolean("object"==typeof e&&e._id&&e._idB58String)}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";const n=r(541),i=r(1181),o=r(1183);t=e.exports,t.aes=i,t.hmac=n,t.keys=o,t.randomBytes=r(546),t.pbkdf2=r(1194)},function(e,t,r){"use strict";e.exports={SHA1:20,SHA256:32,SHA512:64}},function(e,t,r){"use strict";const n=r(1182),i={16:"aes-128-ctr",32:"aes-256-ctr"};t.create=function(e,t,r){const o=i[e.length];if(!o)return r(new Error("Invalid key length"));const s=n.createCipheriv(o,e,t),a=n.createDecipheriv(o,e,t),u={encrypt(e,t){t(null,s.update(e))},decrypt(e,t){t(null,a.update(e))}};r(null,u)}},function(e,t,r){"use strict";const n=r(70);e.exports={createCipheriv:n.createCipheriv,createDecipheriv:n.createDecipheriv}},function(e,t,r){"use strict";(function(n){const i=r(12),o=i(r(302)),s=r(19);t=e.exports;const a={rsa:r(1184),ed25519:r(1189),secp256k1:r(72)(o,r(546))};function u(e){const t=a[e.toLowerCase()];return void 0!==t}t.supportedKeys=a,t.keysPBM=o,t.keyStretcher=r(1191),t.generateEphemeralKeyPair=r(1192),t.generateKeyPair=((e,t,r)=>{let n=a[e.toLowerCase()];if(!n)return r(new Error("invalid or unsupported key type"));n.generateKeyPair(t,r)}),t.generateKeyPairFromSeed=((e,t,r,n)=>{let i=a[e.toLowerCase()];return i?"ed25519"!==e.toLowerCase()?n(new Error("Seed key derivation is unimplemented for RSA or secp256k1")):void i.generateKeyPairFromSeed(t,r,n):n(new Error("invalid or unsupported key type"))}),t.unmarshalPublicKey=(e=>{const t=o.PublicKey.decode(e),r=t.Data;switch(t.Type){case o.KeyType.RSA:return a.rsa.unmarshalRsaPublicKey(r);case o.KeyType.Ed25519:return a.ed25519.unmarshalEd25519PublicKey(r);case o.KeyType.Secp256k1:if(a.secp256k1)return a.secp256k1.unmarshalSecp256k1PublicKey(r);throw new Error("secp256k1 support requires libp2p-crypto-secp256k1 package");default:throw new Error("invalid or unsupported key type")}}),t.marshalPublicKey=((e,t)=>{if(t=(t||"rsa").toLowerCase(),!u(t))throw new Error("invalid or unsupported key type");return e.bytes}),t.unmarshalPrivateKey=((e,t)=>{let r;try{r=o.PrivateKey.decode(e)}catch(e){return t(e)}const n=r.Data;switch(r.Type){case o.KeyType.RSA:return a.rsa.unmarshalRsaPrivateKey(n,t);case o.KeyType.Ed25519:return a.ed25519.unmarshalEd25519PrivateKey(n,t);case o.KeyType.Secp256k1:return a.secp256k1?a.secp256k1.unmarshalSecp256k1PrivateKey(n,t):t(new Error("secp256k1 support requires libp2p-crypto-secp256k1 package"));default:t(new Error("invalid or unsupported key type"))}}),t.marshalPrivateKey=((e,t)=>{if(t=(t||"rsa").toLowerCase(),!u(t))throw new Error("invalid or unsupported key type");return e.bytes}),t.import=((e,t,r)=>{try{const i=s.pki.decryptRsaPrivateKey(e,t);if(null===i)throw new Error("Cannot read the key, most likely the password is wrong or not a RSA key");let o=s.asn1.toDer(s.pki.privateKeyToAsn1(i));return o=n.from(o.getBytes(),"binary"),a.rsa.unmarshalRsaPrivateKey(o,r)}catch(e){r(e)}})}).call(this,r(0).Buffer)},function(e,t,r){"use strict";const n=r(542),i=r(12),o=r(18),s=r(544),a=i(r(302)),u=r(19),c=r(3);class f{constructor(e){this._key=e}verify(e,t,r){g(r),s.hashAndVerify(this._key,t,e,r)}marshal(){return s.utils.jwkToPkix(this._key)}get bytes(){return a.PublicKey.encode({Type:a.KeyType.RSA,Data:this.marshal()})}encrypt(e){return this._key.encrypt(e,"RSAES-PKCS1-V1_5")}equals(e){return this.bytes.equals(e.bytes)}hash(e){g(e),n(this.bytes,"sha2-256",e)}}class l{constructor(e,t){this._key=e,this._publicKey=t}genSecret(){return s.getRandomValues(new Uint8Array(16))}sign(e,t){g(t),s.hashAndSign(this._key,e,t)}get public(){if(!this._publicKey)throw new Error("public key not provided");return new f(this._publicKey)}decrypt(e,t){s.decrypt(this._key,e,t)}marshal(){return s.utils.jwkToPkcs1(this._key)}get bytes(){return a.PrivateKey.encode({Type:a.KeyType.RSA,Data:this.marshal()})}equals(e){return this.bytes.equals(e.bytes)}hash(e){g(e),n(this.bytes,"sha2-256",e)}id(e){this.public.hash((t,r)=>{if(t)return e(t);e(null,o.encode(r))})}export(e,t,r){"function"==typeof t&&(r=t,t=e,e="pkcs-8"),g(r),c(()=>{let n=null,i=null;try{const r=new u.util.ByteBuffer(this.marshal()),o=u.asn1.fromDer(r),s=u.pki.privateKeyFromAsn1(o);if("pkcs-8"===e){const e={algorithm:"aes256",count:1e4,saltSize:16,prfAlgorithm:"sha512"};i=u.pki.encryptRsaPrivateKey(s,t,e)}else n=new Error(`Unknown export format '${e}'`)}catch(e){n=e}r(n,i)})}}function h(e,t){const r=s.utils.pkcs1ToJwk(e);s.unmarshalPrivateKey(r,(e,r)=>{if(e)return t(e);t(null,new l(r.privateKey,r.publicKey))})}function p(e){const t=s.utils.pkixToJwk(e);return new f(t)}function d(e,t){s.unmarshalPrivateKey(e,(e,r)=>{if(e)return t(e);t(null,new l(r.privateKey,r.publicKey))})}function y(e,t){s.generateKey(e,(e,r)=>{if(e)return t(e);t(null,new l(r.privateKey,r.publicKey))})}function g(e){if("function"!=typeof e)throw new Error("callback is required")}e.exports={RsaPublicKey:f,RsaPrivateKey:l,unmarshalRsaPublicKey:p,unmarshalRsaPrivateKey:h,generateKeyPair:y,fromJwk:d}},function(e,t,r){"use strict";(function(t){const n=r(48),i=r(49),o=r(543),s=r(1186),a=o.toCallback,u=o.toBuf,c=o.fromString,f=o.fromNumberTo32BitBuf,l=(e,r)=>{s.sha2256(e,(e,n)=>{e&&r(e),s.sha2256(t.from(n),r)})};e.exports={sha1:s.sha1,sha2256:s.sha2256,sha2512:s.sha2512,sha3512:a(u(n.sha3_512)),sha3384:a(u(n.sha3_384)),sha3256:a(u(n.sha3_256)),sha3224:a(u(n.sha3_224)),shake128:a(u(n.shake_128,256)),shake256:a(u(n.shake_256,512)),keccak224:a(u(n.keccak_224)),keccak256:a(u(n.keccak_256)),keccak384:a(u(n.keccak_384)),keccak512:a(u(n.keccak_512)),murmur3128:a(u(c(i.x64.hash128))),murmur332:a(f(c(i.x86.hash32))),addBlake:r(1187),dblSha2256:l}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(t){const n=r(50),i=o();function o(){return self.crypto?self.crypto.subtle||self.crypto.webkitSubtle:self.msCrypto?self.msCrypto.subtle:void 0}function s(e){if(!i)throw new Error("Please use a browser with webcrypto support");return(r,o)=>{const s=i.digest({name:e},r);if("function"!=typeof s.then)return s.onerror=(()=>{o(new Error(`hashing data using ${e}`))}),void(s.oncomplete=(e=>{o(null,e.target.result)}));n(s.then(e=>t.from(new Uint8Array(e))),o)}}function a(e,t){s("SHA-1")(e,t)}function u(e,t){s("SHA-256")(e,t)}function c(e,t){s("SHA-512")(e,t)}e.exports={sha1:a,sha2256:u,sha2512:c}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(t){const n=r(51),i=r(543).toCallback,o=45569,s=45633,a={init:n.blake2bInit,update:n.blake2bUpdate,digest:n.blake2bFinal},u={init:n.blake2sInit,update:n.blake2sUpdate,digest:n.blake2sFinal},c=(e,r)=>i(n=>{const i=r.init(e,null);return r.update(i,n),t.from(r.digest(i))});e.exports=(e=>{for(let t=0;t<64;t++)e[o+t]=c(t+1,a);for(let t=0;t<32;t++)e[s+t]=c(t+1,u)})}).call(this,r(0).Buffer)},function(e,t,r){"use strict";const n=r(17),i=r(545),o=i.toBase64,s=i.toBn,a=n.define("RSAPrivateKey",function(){this.seq().obj(this.key("version").int(),this.key("modulus").int(),this.key("publicExponent").int(),this.key("privateExponent").int(),this.key("prime1").int(),this.key("prime2").int(),this.key("exponent1").int(),this.key("exponent2").int(),this.key("coefficient").int())}),u=n.define("AlgorithmIdentifier",function(){this.seq().obj(this.key("algorithm").objid({"1.2.840.113549.1.1.1":"rsa"}),this.key("none").optional().null_(),this.key("curve").optional().objid(),this.key("params").optional().seq().obj(this.key("p").int(),this.key("q").int(),this.key("g").int()))}),c=n.define("RSAPublicKey",function(){this.seq().obj(this.key("algorithm").use(u),this.key("subjectPublicKey").bitstr())}),f=n.define("RSAPublicKey",function(){this.seq().obj(this.key("modulus").int(),this.key("publicExponent").int())});t.pkcs1ToJwk=function(e){const t=a.decode(e,"der");return{kty:"RSA",n:o(t.modulus),e:o(t.publicExponent),d:o(t.privateExponent),p:o(t.prime1),q:o(t.prime2),dp:o(t.exponent1),dq:o(t.exponent2),qi:o(t.coefficient),alg:"RS256",kid:"2011-04-29"}},t.jwkToPkcs1=function(e){return a.encode({version:0,modulus:s(e.n),publicExponent:s(e.e),privateExponent:s(e.d),prime1:s(e.p),prime2:s(e.q),exponent1:s(e.dp),exponent2:s(e.dq),coefficient:s(e.qi)},"der")},t.pkixToJwk=function(e){const t=c.decode(e,"der"),r=f.decode(t.subjectPublicKey.data,"der");return{kty:"RSA",n:o(r.modulus),e:o(r.publicExponent),alg:"RS256",kid:"2011-04-29"}},t.jwkToPkix=function(e){return c.encode({algorithm:{algorithm:"rsa",none:null},subjectPublicKey:{data:f.encode({modulus:s(e.n),publicExponent:s(e.e)},"der")}},"der")}},function(e,t,r){"use strict";(function(t){const n=r(542),i=r(12),o=r(18),s=r(1190),a=i(r(302));class u{constructor(e){this._key=y(e,s.publicKeyLength)}verify(e,t,r){d(r),s.hashAndVerify(this._key,t,e,r)}marshal(){return t.from(this._key)}get bytes(){return a.PublicKey.encode({Type:a.KeyType.Ed25519,Data:this.marshal()})}equals(e){return this.bytes.equals(e.bytes)}hash(e){d(e),n(this.bytes,"sha2-256",e)}}class c{constructor(e,t){this._key=y(e,s.privateKeyLength),this._publicKey=y(t,s.publicKeyLength)}sign(e,t){d(t),s.hashAndSign(this._key,e,t)}get public(){if(!this._publicKey)throw new Error("public key not provided");return new u(this._publicKey)}marshal(){return t.concat([t.from(this._key),t.from(this._publicKey)])}get bytes(){return a.PrivateKey.encode({Type:a.KeyType.Ed25519,Data:this.marshal()})}equals(e){return this.bytes.equals(e.bytes)}hash(e){d(e),n(this.bytes,"sha2-256",e)}id(e){this.public.hash((t,r)=>{if(t)return e(t);e(null,o.encode(r))})}}function f(e,t){try{e=y(e,s.privateKeyLength+s.publicKeyLength)}catch(e){return t(e)}const r=e.slice(0,s.privateKeyLength),n=e.slice(s.privateKeyLength,e.length);t(null,new c(r,n))}function l(e){return e=y(e,s.publicKeyLength),new u(e)}function h(e,t){void 0===t&&"function"==typeof e&&(t=e),s.generateKey((e,r)=>{if(e)return t(e);let n;try{n=new c(r.secretKey,r.publicKey)}catch(e){return void t(e)}t(null,n)})}function p(e,t,r){void 0===r&&"function"==typeof t&&(r=t),s.generateKeyFromSeed(e,(e,t)=>{if(e)return r(e);let n;try{n=new c(t.secretKey,t.publicKey)}catch(e){return void r(e)}r(null,n)})}function d(e){if("function"!=typeof e)throw new Error("callback is required")}function y(e,r){if(t.isBuffer(e)&&(e=new Uint8Array(e)),!(e instanceof Uint8Array)||e.length!==r)throw new Error("Key must be a Uint8Array or Buffer of length "+r);return e}e.exports={Ed25519PublicKey:u,Ed25519PrivateKey:c,unmarshalEd25519PrivateKey:f,unmarshalEd25519PublicKey:l,generateKeyPair:h,generateKeyPairFromSeed:p}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(e){const n=r(71),i=r(3);t.publicKeyLength=n.sign.publicKeyLength,t.privateKeyLength=n.sign.secretKeyLength,t.generateKey=function(e){i(()=>{let t;try{t=n.sign.keyPair()}catch(t){return e(t)}e(null,t)})},t.generateKeyFromSeed=function(e,t){i(()=>{let r;try{r=n.sign.keyPair.fromSeed(e)}catch(e){return t(e)}t(null,r)})},t.hashAndSign=function(t,r,o){i(()=>{o(null,e.from(n.sign.detached(r,t)))})},t.hashAndVerify=function(e,t,r,o){i(()=>{let i;try{i=n.sign.detached.verify(r,t,e)}catch(e){return o(e)}o(null,i)})}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(t){const n=r(47),i=r(541),o={"AES-128":{ivSize:16,keySize:16},"AES-256":{ivSize:16,keySize:32},Blowfish:{ivSize:8,cipherKeySize:32}};e.exports=((e,r,s,a)=>{const u=o[e];if(!u)return a(new Error("unkown cipherType passed"));if(!r)return a(new Error("unkown hashType passed"));const c=u.keySize,f=u.ivSize,l=20,h=t.from("key expansion"),p=2*(f+c+20);i.create(r,s,(e,r)=>{if(e)return a(e);r.digest(h,(e,i)=>{if(e)return a(e);let o=[],s=0;function u(e){r.digest(t.concat([i,h]),(t,n)=>{if(t)return e(t);let a=n.length;s+a>p&&(a=p-s),o.push(n),s+=a,r.digest(i,(t,r)=>{if(t)return e(t);i=r,e()})})}function l(e){if(e)return a(e);const r=p/2,n=t.concat(o),i=n.slice(0,r),s=n.slice(r,p),u=e=>({iv:e.slice(0,f),cipherKey:e.slice(f,f+c),macKey:e.slice(f+c)});a(null,{k1:u(i),k2:u(s)})}n(()=>s<p,u,l)})})})}).call(this,r(0).Buffer)},function(e,t,r){"use strict";const n=r(1193);e.exports=((e,t)=>{n.generateEphmeralKeyPair(e,t)})},function(e,t,r){"use strict";(function(e){const n=r(301)(),i=r(300),o=r(17).bignum,s=r(545),a=s.toBase64,u=s.toBn,c={"P-256":256,"P-384":384,"P-521":521};t.generateEphmeralKeyPair=function(t,r){i(n.subtle.generateKey({name:"ECDH",namedCurve:t},!0,["deriveBits"]).then(r=>{const o=(o,s,a)=>{let u;"function"==typeof s&&(a=s,s=void 0),u=s?n.subtle.importKey("jwk",p(t,s),{name:"ECDH",namedCurve:t},!1,["deriveBits"]):Promise.resolve(r.privateKey);const f=Promise.all([n.subtle.importKey("jwk",h(t,o),{name:"ECDH",namedCurve:t},!1,[]),u]);i(f.then(e=>n.subtle.deriveBits({name:"ECDH",namedCurve:t,public:e[0]},e[1],c[t])).then(t=>e.from(t)),a)};return n.subtle.exportKey("jwk",r.publicKey).then(e=>({key:l(e),genSharedKey:o}))}),r)};const f={"P-256":32,"P-384":48,"P-521":66};function l(t){const r=f[t.crv];return e.concat([e.from([4]),u(t.x).toArrayLike(e,"be",r),u(t.y).toArrayLike(e,"be",r)],1+2*r)}function h(t,r){const n=f[t];if(!r.slice(0,1).equals(e.from([4])))throw new Error("Invalid key format");const i=new o(r.slice(1,n+1)),s=new o(r.slice(1+n));return{kty:"EC",crv:t,x:a(i,n),y:a(s,n),ext:!0}}function p(e,t){const r=h(e,t.public);return r.d=a(new o(t.private)),r}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";const n=r(19),i={sha1:"sha1","sha2-256":"sha256","sha2-512":"sha512"};function o(e,t,r,o,s){const a=i[s];if(!a)throw new Error(`Hash '${s}' is unknown or not supported`);const u=n.pkcs5.pbkdf2(e,t,r,o,a);return n.util.encode64(u)}e.exports=o},function(e,t,r){"use strict";(function(n){const i=r(10).EventEmitter,o=r(13),s=r(41),a=r(37),u=r(46),c=r(482),f=r(1196),l=r(1258),h=r(506),p=r(1262),d=r(1302),y=r(1303),g=r(1304),m=r(1305),b=r(1315),v=r(1316).validate;t=e.exports;const _="The libp2p node is not started yet";class w extends i{constructor(e){if(super(),e=v(e),this.peerInfo=e.peerInfo,this.peerBook=e.peerBook||new c,this._modules=e.modules,this._config=e.config,this._isStarted=!1,this._transport=[],this._discovery=[],this._switch=new f(this.peerInfo,this.peerBook,e.switch),this.stats=this._switch.stats,this.connectionManager=new p(this,e.connectionManager),this._modules.streamMuxer){let e=this._modules.streamMuxer;e.forEach(e=>this._switch.connection.addStreamMuxer(e)),this._switch.connection.reuse(),this._switch.connection.enableCircuitRelay(this._config.relay),this._switch.on("peer-mux-established",e=>{this.emit("peer:connect",e),this.peerBook.put(e)}),this._switch.on("peer-mux-closed",e=>{this.emit("peer:disconnect",e)})}if(this._modules.connEncryption){let e=this._modules.connEncryption;e.forEach(e=>{this._switch.connection.crypto(e.tag,e.encrypt)})}if(this._modules.connProtector)this._switch.protector=this._modules.connProtector;else if(n.env.LIBP2P_FORCE_PNET)throw new Error("Private network is enforced, but no protector was provided");if(this._config.EXPERIMENTAL.dht){const e=this._modules.dht;this._dht=new e(this._switch,{kBucketSize:this._config.dht.kBucketSize||20,datastore:g.datastore})}this._config.EXPERIMENTAL.pubsub&&(this.pubsub=m(this)),this.peerRouting=d(this),this.contentRouting=y(this),this.dht=g(this),this._getPeerInfo=b(this),l.mount(this._switch)}start(e){if(!this._modules.transport)return e(new Error("no transports were present"));let t;const r=[],n=[];this.peerInfo.multiaddrs.toArray().forEach(e=>{e.getPeerId()||(r.push(e),n.push(e.encapsulate("/ipfs/"+this.peerInfo.id.toB58String())))}),this.peerInfo.multiaddrs.replace(r,n);const i=this.peerInfo.multiaddrs.toArray();this._modules.transport.forEach(e=>{let r;r="function"==typeof e?new e:e,r.filter(i).length>0?this._switch.transport.add(r.tag||r.constructor.name,r):h.isWebSockets(r)&&(t=r),this._transport.push(r)}),a([e=>{this.connectionManager.start(),this._switch.start(e)},e=>{t&&this._switch.transport.add(t.tag||t.constructor.name,t),this._modules.peerDiscovery?s(this._modules.peerDiscovery,(e,t)=>{let r={};e.tag&&this._config.peerDiscovery&&this._config.peerDiscovery[e.tag]&&(r=this._config.peerDiscovery[e.tag]);const n=null==r.enabled||r.enabled;if(n){let n;n="function"==typeof e?new e(Object.assign({},r,{peerInfo:this.peerInfo})):e,n.on("peer",e=>this.emit("peer:discovery",e)),this._discovery.push(n),n.start(t)}else t()},e):e()},e=>{this._isStarted=!0,this._dht?this._dht.start(e):e()},e=>{this._floodSub?this._floodSub.start(e):e()},e=>{const t=this.peerInfo.multiaddrs.toArray();t.forEach(e=>{e.toString().match(/\/p2p-circuit($|\/)/)||this._transport.find(t=>t.filter(e).length>0)||this.peerInfo.multiaddrs.delete(e)}),e()},e=>{this.emit("start"),e()}],e)}stop(e){a([e=>{if(this._modules.peerDiscovery)return u(this._discovery.map(e=>t=>e.stop(()=>{t()})),e);e()},e=>{if(this._floodSub)return this._floodSub.stop(e);e()},e=>{if(this._dht)return this._dht.stop(e);e()},e=>{this.connectionManager.stop(),this._switch.stop(e)},e=>{this.emit("stop"),e()}],t=>{this._isStarted=!1,e(t)})}isStarted(){return this._isStarted}dial(e,t){o(this.isStarted(),_),this._getPeerInfo(e,(e,r)=>{if(e)return t(e);this._switch.dial(r,e=>{if(e)return t(e);this.peerBook.put(r),t()})})}dialProtocol(e,t,r){o(this.isStarted(),_),"function"==typeof t&&(r=t,t=void 0),this._getPeerInfo(e,(e,n)=>{if(e)return r(e);this._switch.dial(n,t,(e,t)=>{if(e)return r(e);this.peerBook.put(n),r(null,t)})})}hangUp(e,t){o(this.isStarted(),_),this._getPeerInfo(e,(e,r)=>{if(e)return t(e);this._switch.hangUp(r,t)})}ping(e,t){if(!this.isStarted())return t(new Error(_));this._getPeerInfo(e,(e,r)=>{if(e)return t(e);t(null,new l(this._switch,r))})}handle(e,t,r){this._switch.handle(e,t,r)}unhandle(e){this._switch.unhandle(e)}}e.exports=w}).call(this,r(6))},function(e,t,r){"use strict";const n=r(10).EventEmitter,i=r(41),o=r(37),s=r(1197),a=r(1201),u=r(561),c=r(1250),f=r(1251),l=r(560),h=r(1252),p=r(1253),d=r(13),y=r(1257);class g extends n{constructor(e,t,r){super(),d(e,"You must provide a `peerInfo`"),d(t,"You must provide a `peerBook`"),this._peerInfo=e,this._peerBook=t,this._options=r||{},this.setMaxListeners(1/0),this.transports={},this.conns={},this.muxedConns={},this.protocols={},this.muxers={},this.identify=!1,this.crypto=l,this.protector=this._options.protector||null,this.transport=new s(this),this.connection=new a(this),this.observer=h(this),this.stats=p(this.observer,this._options.stats),this.protocolMuxer=f(this.protocols,this.observer),this.handle(this.crypto.tag,(e,t)=>{const r=this._peerInfo.id,n=this.crypto.encrypt(r,t,void 0,()=>{});return this.protocolMuxer(null)(n)}),this.dial=c(this)}availableTransports(e){const t=e.multiaddrs.toArray(),r=Object.keys(this.transports);return r.filter(e=>this.transports[e].filter(t).length>0).sort(e=>"Circuit"===e?1:0)}start(e){i(this.availableTransports(this._peerInfo),(e,t)=>{this.transport.listen(e,{},null,t)},e)}stop(e){this.stats.stop(),o([e=>i(this.muxedConns,(e,t)=>{if(!e)return t();e.muxer.end(e=>{if(e&&"Fatal error: OK"!==e.message)return t(e);t()})},e),e=>{i(this.transports,(e,t)=>{i(e.listeners,(e,t)=>{e.close(t)},t)},e)}],e)}handle(e,t,r){this.protocols[e]={handlerFunc:t,matchFunc:r}}unhandle(e){this.protocols[e]&&delete this.protocols[e]}hangUp(e,t){const r=u(e,this.peerBook),n=r.id.toB58String();if(this.muxedConns[n]){const e=this.muxedConns[n].muxer;e.once("close",()=>{delete this.muxedConns[n],t()}),e.end()}else t()}hasTransports(){const e=Object.keys(this.transports).filter(e=>"Circuit"!==e);return e&&e.length>0}}e.exports=g,e.exports.errors=y},function(e,t,r){"use strict";const n=r(46),i=r(35),o=r(1),s=o("libp2p:switch:transport"),a=r(1198),u=8,c=3e4;class f{constructor(e){this.switch=e,this.dialer=new a(u,c)}add(e,t){if(s("adding %s",e),this.switch.transports[e])throw new Error("There is already a transport with this key");this.switch.transports[e]=t,this.switch.transports[e].listeners||(this.switch.transports[e].listeners=[])}dial(e,t,r){const n=this.switch.transports[e];let i=t.multiaddrs.toArray();Array.isArray(i)||(i=[i]),i=f.dialables(n,i),s("dialing %s",e,i.map(e=>e.toString())),this.dialer.dialMany(t.id,n,i,(e,n)=>{if(e)return r(e);t.connect(n.multiaddr),this.switch._peerBook.put(t),r(null,n.conn)})}listen(e,t,r,o){let s;r||(r=this.switch.protocolMuxer(e)),this.switch.protector&&(s=r,r=(e=>{const t=this.switch.protector.protect(e,()=>{s(t)})}));const a=this.switch.transports[e],u=f.dialables(a,this.switch._peerInfo.multiaddrs.distinct());a.listeners||(a.listeners=[]);let c=[];const l=u.map(e=>t=>{const n=i(t),o=a.createListener(r);o.once("error",n),o.listen(e,e=>{if(e)return n(e);o.removeListener("error",n),o.getAddrs((e,t)=>{if(e)return n(e);c=c.concat(t),a.listeners.push(o),n()})})});n(l,e=>{if(e)return o(e);this.switch._peerInfo.multiaddrs.replace(u,c),o()})}close(e,t){const r=this.switch.transports[e];if(!r)return t(new Error(`Trying to close non existing transport: ${e}`));n(r.listeners.map(e=>t=>{e.close(t)}),t)}static dialables(e,t){return e.filter(t)}}e.exports=f},function(e,t,r){"use strict";const n=r(74),i=r(1),o=r(35),s=i("libp2p:swarm:dialer"),a=r(1199);class u{constructor(e,t){s("create: %s peer limit, %s dial timeout",e,t),this.perPeerLimit=e,this.dialTimeout=t,this.queues=new Map}dialMany(e,t,r,i){s("dialMany:start");const a={cancel:!1};i=o(i),n(r,(r,n)=>{this.dialSingle(e,t,r,a,n)},(e,t)=>{if(e)return i(e);const r=t.filter(e=>e.conn);if(r.length>0)return s("dialMany:success"),i(null,r[0]);s("dialMany:error");const n=new Error("Failed to dial any provided address");return n.errors=t.filter(e=>e.error).map(e=>e.error),i(n)})}dialSingle(e,t,r,n,i){const o=e.toB58String();let u;s("dialSingle: %s:%s",o,r.toString()),this.queues.has(o)?u=this.queues.get(o):(u=new a(this.perPeerLimit,this.dialTimeout),this.queues.set(o,u)),u.push(t,r,n,i)}}e.exports=u},function(e,t,r){"use strict";const n=r(44).Connection,i=r(8),o=r(1200),s=r(126),a=r(1),u=a("libp2p:swarm:dialer:queue");class c{constructor(e,t){this.dialTimeout=t,this.queue=s((e,t)=>{this._doWork(e.transport,e.addr,e.token,t)},e)}_doWork(e,t,r,o){u("work"),this._dialWithTimeout(e,t,(e,s)=>{if(e)return u("work:error"),o(null,{error:e});if(r.cancel)return u("work:cancel"),i(i.empty(),s),o(null,{cancel:!0});r.cancel=!0,u("work:success");const a=new n;a.setInnerConn(s),o(null,{multiaddr:t,conn:s})})}_dialWithTimeout(e,t,r){o(r=>{const n=e.dial(t,e=>{if(e)return r(e);r(null,n)})},this.dialTimeout)(r)}push(e,t,r,n){this.queue.push({transport:e,addr:t,token:r},n)}}e.exports=c},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=u;var n=r(345),i=a(n),o=r(32),s=a(o);function a(e){return e&&e.__esModule?e:{default:e}}function u(e,t,r){var n=(0,s.default)(e);return(0,i.default)(function(i,o){var s=!1,a;function u(){var t=e.name||"anonymous",n=new Error('Callback function "'+t+'" timed out.');n.code="ETIMEDOUT",r&&(n.info=r),s=!0,o(n)}i.push(function(){s||(o.apply(null,arguments),clearTimeout(a))}),a=setTimeout(u,t),n.apply(null,i)})}e.exports=t.default},function(e,t,r){"use strict";const n=r(1202),i=r(307),o=r(5),s=r(1),a=s("libp2p:switch:connection"),u=r(35),c=r(3),f=r(559),l=r(560);class h{constructor(e){this.switch=e}addStreamMuxer(e){this.switch.muxers[e.multicodec]=e,this.switch.handle(e.multicodec,(t,r)=>{const s=e.listener(r);return s.on("stream",this.switch.protocolMuxer(null)),this.switch.identify&&r.getPeerInfo((e,t)=>{!e&&t||a("crypto peerInfo wasnt found"),r.getPeerInfo=(e=>{const r=s.newStream(),a=new i.Dialer;e=u(e),o([e=>a.handle(r,e),e=>a.select(n.multicodec,e),(e,r)=>n.dialer(e,t,r),(e,t,r)=>{t.forEach(e=>{this.switch._peerInfo.multiaddrs.addSafe(e)}),r(null,e)}],(t,n)=>{if(t)return s.end(()=>{n&&c(()=>this.switch.emit("peer-mux-closed",n)),e(t,null)});n&&r.setPeerInfo(n),e(t,n)})}),r.getPeerInfo((e,t)=>{if(e)return a("identify not successful");const r=t.id.toB58String();this.switch.muxedConns[r]={muxer:s},t.multiaddrs.size>0?t.connect(t.multiaddrs.toArray()[0]):t.connect(`/ipfs/${r}`),t=this.switch._peerBook.put(t),s.on("close",()=>{delete this.switch.muxedConns[r],t.disconnect(),t=this.switch._peerBook.put(t),a(`closed connection to ${r}`),c(()=>this.switch.emit("peer-mux-closed",t))}),c(()=>this.switch.emit("peer-mux-established",t))})}),r})}crypto(e,t){e||t||(e=l.tag,t=l.encrypt),this.switch.unhandle(this.switch.crypto.tag),this.switch.handle(e,(e,r)=>{const n=this.switch._peerInfo.id,i=t(n,r,void 0,()=>{this.switch.protocolMuxer(null)(i)})}),this.switch.crypto={tag:e,encrypt:t}}enableCircuitRelay(e){e=e||{},e.enabled&&(e.hop||Object.assign(e,{hop:{enabled:!1,active:!1}}),this.switch.transport.add(f.tag,new f(this.switch,e)))}reuse(){this.switch.identify=!0,this.switch.handle(n.multicodec,(e,t)=>{n.listener(t,this.switch._peerInfo)})}}e.exports=h},function(e,t,r){"use strict";t=e.exports,t.multicodec="/ipfs/id/1.0.0",t.listener=r(1203),t.dialer=r(1204),t.message=r(303)},function(e,t,r){"use strict";(function(t){const n=r(8),i=r(53),o=r(303);e.exports=((e,r)=>{e.getObservedAddrs((s,a)=>{if(s)return;a=a[0];let u=t.alloc(0);r.id.pubKey&&(u=r.id.pubKey.bytes);const c=o.encode({protocolVersion:"ipfs/0.1.0",agentVersion:"na",publicKey:u,listenAddrs:r.multiaddrs.toArray().map(e=>e.buffer),observedAddr:a?a.buffer:t.from("")});n(n.values([c]),i.encode(),e)})})}).call(this,r(0).Buffer)},function(e,t,r){"use strict";const n=r(52),i=r(1205),o=r(31),s=r(8),a=r(53),u=r(303);function c(e){if(!f(e))return[];let t=e.observedAddr;return Array.isArray(t)||(t=[t]),t.map(e=>o(e))}function f(e){return e.observedAddr&&e.observedAddr.length>0}e.exports=((e,t,r)=>{"function"==typeof t&&(r=t,t=null,console.warn("WARNING: no expected peer info was given, identify will not be able to verify peer integrity")),s(e,a.decode(),s.take(1),s.collect((e,s)=>{if(e)return r(e);if(0===s.length)return r(new Error("conn was closed, did not receive data"));const a=u.decode(s[0]);i.createFromPubKey(a.publicKey,(e,i)=>{if(e)return r(e);const s=new n(i);if(t&&t.id.toB58String()!==i.toB58String())return r(new Error("invalid peer"));try{a.listenAddrs.map(o).forEach(e=>s.multiaddrs.add(e))}catch(e){return r(e)}let u;try{u=c(a)}catch(e){return r(e)}r(null,s,u)})}))})},function(e,t,r){"use strict";(function(n){const i=r(14),o=r(1206),s=r(13),a=r(5);class u{constructor(e,t,r){s(n.isBuffer(e),"invalid id provided"),t&&r&&s(t.public.bytes.equals(r.bytes),"inconsistent arguments"),this._id=e,this._idB58String=i.toB58String(this.id),this._privKey=t,this._pubKey=r}get id(){return this._id}set id(e){throw new Error("Id is immutable")}get privKey(){return this._privKey}set privKey(e){this._privKey=e}get pubKey(){return this._pubKey?this._pubKey:this._privKey?this._privKey.public:void 0}set pubKey(e){this._pubKey=e}marshalPubKey(){if(this.pubKey)return o.keys.marshalPublicKey(this.pubKey)}marshalPrivKey(){if(this.privKey)return o.keys.marshalPrivateKey(this.privKey)}toPrint(){return this.toJSON()}toJSON(){return{id:this.toB58String(),privKey:c(this.marshalPrivKey()),pubKey:c(this.marshalPubKey())}}toHexString(){return i.toHexString(this.id)}toBytes(){return this.id}toB58String(){return this._idB58String}isEqual(e){if(n.isBuffer(e))return this.id.equals(e);if(e.id)return this.id.equals(e.id);throw new Error("not valid Id")}isValid(e){this.privKey&&this.privKey.public&&this.privKey.public.bytes&&n.isBuffer(this.pubKey.bytes)&&this.privKey.public.bytes.equals(this.pubKey.bytes)?e():e(new Error("Keys not match"))}}function c(e){if(e)return e.toString("base64")}t=e.exports=u,t.create=function(e,t){"function"==typeof e&&(t=e,e={}),e=e||{},e.bits=e.bits||2048,a([t=>o.keys.generateKeyPair("RSA",e.bits,t),(e,t)=>e.public.hash((r,n)=>{t(r,n,e)})],(e,r,n)=>{if(e)return t(e);t(null,new u(r,n))})},t.createFromHexString=function(e){return new u(i.fromHexString(e))},t.createFromBytes=function(e){return new u(e)},t.createFromB58String=function(e){return new u(i.fromB58String(e))},t.createFromPubKey=function(e,t){if("function"!=typeof t)throw new Error("callback is required");let r;try{let i=e;if("string"==typeof i&&(i=n.from(e,"base64")),!n.isBuffer(i))throw new Error("Supplied key is neither a base64 string nor a buffer");r=o.keys.unmarshalPublicKey(i)}catch(e){return t(e)}r.hash((e,n)=>{if(e)return t(e);t(null,new u(n,null,r))})},t.createFromPrivKey=function(e,t){if("function"!=typeof t)throw new Error("callback is required");let r=e;try{if("string"==typeof r&&(r=n.from(e,"base64")),!n.isBuffer(r))throw new Error("Supplied key is neither a base64 string nor a buffer")}catch(e){return t(e)}a([e=>o.keys.unmarshalPrivateKey(r,e),(e,t)=>e.public.hash((r,n)=>{t(r,n,e)})],(e,r,n)=>{if(e)return t(e);t(null,new u(r,n,n.public))})},t.createFromJSON=function(e,t){if("function"!=typeof t)throw new Error("callback is required");let r,s,c,f;try{r=i.fromB58String(e.id),s=e.privKey&&n.from(e.privKey,"base64"),c=e.pubKey&&n.from(e.pubKey,"base64"),f=c&&o.keys.unmarshalPublicKey(c)}catch(e){return t(e)}s?a([e=>o.keys.unmarshalPrivateKey(s,e),(e,t)=>e.public.hash((r,n)=>{t(r,n,e)}),(e,t,r)=>{f?f.hash((n,i)=>{r(n,e,t,i)}):r(null,e,t)}],(e,n,i,o)=>e?t(e):f&&!n.equals(o)?t(new Error("Public and private key do not match")):r&&!n.equals(r)?t(new Error("Id and private key do not match")):void t(null,new u(r,i,f))):t(null,new u(r,null,f))},t.isPeerId=function(e){return Boolean("object"==typeof e&&e._id&&e._idB58String)}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";const n=r(547),i=r(1208),o=r(1210);t=e.exports,t.aes=i,t.hmac=n,t.keys=o,t.randomBytes=r(552),t.pbkdf2=r(1221)},function(e,t,r){"use strict";e.exports={SHA1:20,SHA256:32,SHA512:64}},function(e,t,r){"use strict";const n=r(1209),i={16:"aes-128-ctr",32:"aes-256-ctr"};t.create=function(e,t,r){const o=i[e.length];if(!o)return r(new Error("Invalid key length"));const s=n.createCipheriv(o,e,t),a=n.createDecipheriv(o,e,t),u={encrypt(e,t){t(null,s.update(e))},decrypt(e,t){t(null,a.update(e))}};r(null,u)}},function(e,t,r){"use strict";const n=r(70);e.exports={createCipheriv:n.createCipheriv,createDecipheriv:n.createDecipheriv}},function(e,t,r){"use strict";(function(n){const i=r(12),o=i(r(306)),s=r(19);t=e.exports;const a={rsa:r(1211),ed25519:r(1216),secp256k1:r(72)(o,r(552))};function u(e){const t=a[e.toLowerCase()];return void 0!==t}t.supportedKeys=a,t.keysPBM=o,t.keyStretcher=r(1218),t.generateEphemeralKeyPair=r(1219),t.generateKeyPair=((e,t,r)=>{let n=a[e.toLowerCase()];if(!n)return r(new Error("invalid or unsupported key type"));n.generateKeyPair(t,r)}),t.generateKeyPairFromSeed=((e,t,r,n)=>{let i=a[e.toLowerCase()];return i?"ed25519"!==e.toLowerCase()?n(new Error("Seed key derivation is unimplemented for RSA or secp256k1")):void i.generateKeyPairFromSeed(t,r,n):n(new Error("invalid or unsupported key type"))}),t.unmarshalPublicKey=(e=>{const t=o.PublicKey.decode(e),r=t.Data;switch(t.Type){case o.KeyType.RSA:return a.rsa.unmarshalRsaPublicKey(r);case o.KeyType.Ed25519:return a.ed25519.unmarshalEd25519PublicKey(r);case o.KeyType.Secp256k1:if(a.secp256k1)return a.secp256k1.unmarshalSecp256k1PublicKey(r);throw new Error("secp256k1 support requires libp2p-crypto-secp256k1 package");default:throw new Error("invalid or unsupported key type")}}),t.marshalPublicKey=((e,t)=>{if(t=(t||"rsa").toLowerCase(),!u(t))throw new Error("invalid or unsupported key type");return e.bytes}),t.unmarshalPrivateKey=((e,t)=>{let r;try{r=o.PrivateKey.decode(e)}catch(e){return t(e)}const n=r.Data;switch(r.Type){case o.KeyType.RSA:return a.rsa.unmarshalRsaPrivateKey(n,t);case o.KeyType.Ed25519:return a.ed25519.unmarshalEd25519PrivateKey(n,t);case o.KeyType.Secp256k1:return a.secp256k1?a.secp256k1.unmarshalSecp256k1PrivateKey(n,t):t(new Error("secp256k1 support requires libp2p-crypto-secp256k1 package"));default:t(new Error("invalid or unsupported key type"))}}),t.marshalPrivateKey=((e,t)=>{if(t=(t||"rsa").toLowerCase(),!u(t))throw new Error("invalid or unsupported key type");return e.bytes}),t.import=((e,t,r)=>{try{const i=s.pki.decryptRsaPrivateKey(e,t);if(null===i)throw new Error("Cannot read the key, most likely the password is wrong or not a RSA key");let o=s.asn1.toDer(s.pki.privateKeyToAsn1(i));return o=n.from(o.getBytes(),"binary"),a.rsa.unmarshalRsaPrivateKey(o,r)}catch(e){r(e)}})}).call(this,r(0).Buffer)},function(e,t,r){"use strict";const n=r(548),i=r(12),o=r(18),s=r(550),a=i(r(306)),u=r(19),c=r(3);class f{constructor(e){this._key=e}verify(e,t,r){g(r),s.hashAndVerify(this._key,t,e,r)}marshal(){return s.utils.jwkToPkix(this._key)}get bytes(){return a.PublicKey.encode({Type:a.KeyType.RSA,Data:this.marshal()})}encrypt(e){return this._key.encrypt(e,"RSAES-PKCS1-V1_5")}equals(e){return this.bytes.equals(e.bytes)}hash(e){g(e),n(this.bytes,"sha2-256",e)}}class l{constructor(e,t){this._key=e,this._publicKey=t}genSecret(){return s.getRandomValues(new Uint8Array(16))}sign(e,t){g(t),s.hashAndSign(this._key,e,t)}get public(){if(!this._publicKey)throw new Error("public key not provided");return new f(this._publicKey)}decrypt(e,t){s.decrypt(this._key,e,t)}marshal(){return s.utils.jwkToPkcs1(this._key)}get bytes(){return a.PrivateKey.encode({Type:a.KeyType.RSA,Data:this.marshal()})}equals(e){return this.bytes.equals(e.bytes)}hash(e){g(e),n(this.bytes,"sha2-256",e)}id(e){this.public.hash((t,r)=>{if(t)return e(t);e(null,o.encode(r))})}export(e,t,r){"function"==typeof t&&(r=t,t=e,e="pkcs-8"),g(r),c(()=>{let n=null,i=null;try{const r=new u.util.ByteBuffer(this.marshal()),o=u.asn1.fromDer(r),s=u.pki.privateKeyFromAsn1(o);if("pkcs-8"===e){const e={algorithm:"aes256",count:1e4,saltSize:16,prfAlgorithm:"sha512"};i=u.pki.encryptRsaPrivateKey(s,t,e)}else n=new Error(`Unknown export format '${e}'`)}catch(e){n=e}r(n,i)})}}function h(e,t){const r=s.utils.pkcs1ToJwk(e);s.unmarshalPrivateKey(r,(e,r)=>{if(e)return t(e);t(null,new l(r.privateKey,r.publicKey))})}function p(e){const t=s.utils.pkixToJwk(e);return new f(t)}function d(e,t){s.unmarshalPrivateKey(e,(e,r)=>{if(e)return t(e);t(null,new l(r.privateKey,r.publicKey))})}function y(e,t){s.generateKey(e,(e,r)=>{if(e)return t(e);t(null,new l(r.privateKey,r.publicKey))})}function g(e){if("function"!=typeof e)throw new Error("callback is required")}e.exports={RsaPublicKey:f,RsaPrivateKey:l,unmarshalRsaPublicKey:p,unmarshalRsaPrivateKey:h,generateKeyPair:y,fromJwk:d}},function(e,t,r){"use strict";(function(t){const n=r(48),i=r(49),o=r(549),s=r(1213),a=o.toCallback,u=o.toBuf,c=o.fromString,f=o.fromNumberTo32BitBuf,l=(e,r)=>{s.sha2256(e,(e,n)=>{e&&r(e),s.sha2256(t.from(n),r)})};e.exports={sha1:s.sha1,sha2256:s.sha2256,sha2512:s.sha2512,sha3512:a(u(n.sha3_512)),sha3384:a(u(n.sha3_384)),sha3256:a(u(n.sha3_256)),sha3224:a(u(n.sha3_224)),shake128:a(u(n.shake_128,256)),shake256:a(u(n.shake_256,512)),keccak224:a(u(n.keccak_224)),keccak256:a(u(n.keccak_256)),keccak384:a(u(n.keccak_384)),keccak512:a(u(n.keccak_512)),murmur3128:a(u(c(i.x64.hash128))),murmur332:a(f(c(i.x86.hash32))),addBlake:r(1214),dblSha2256:l}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(t){const n=r(50),i=o();function o(){return self.crypto?self.crypto.subtle||self.crypto.webkitSubtle:self.msCrypto?self.msCrypto.subtle:void 0}function s(e){if(!i)throw new Error("Please use a browser with webcrypto support");return(r,o)=>{const s=i.digest({name:e},r);if("function"!=typeof s.then)return s.onerror=(()=>{o(new Error(`hashing data using ${e}`))}),void(s.oncomplete=(e=>{o(null,e.target.result)}));n(s.then(e=>t.from(new Uint8Array(e))),o)}}function a(e,t){s("SHA-1")(e,t)}function u(e,t){s("SHA-256")(e,t)}function c(e,t){s("SHA-512")(e,t)}e.exports={sha1:a,sha2256:u,sha2512:c}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(t){const n=r(51),i=r(549).toCallback,o=45569,s=45633,a={init:n.blake2bInit,update:n.blake2bUpdate,digest:n.blake2bFinal},u={init:n.blake2sInit,update:n.blake2sUpdate,digest:n.blake2sFinal},c=(e,r)=>i(n=>{const i=r.init(e,null);return r.update(i,n),t.from(r.digest(i))});e.exports=(e=>{for(let t=0;t<64;t++)e[o+t]=c(t+1,a);for(let t=0;t<32;t++)e[s+t]=c(t+1,u)})}).call(this,r(0).Buffer)},function(e,t,r){"use strict";const n=r(17),i=r(551),o=i.toBase64,s=i.toBn,a=n.define("RSAPrivateKey",function(){this.seq().obj(this.key("version").int(),this.key("modulus").int(),this.key("publicExponent").int(),this.key("privateExponent").int(),this.key("prime1").int(),this.key("prime2").int(),this.key("exponent1").int(),this.key("exponent2").int(),this.key("coefficient").int())}),u=n.define("AlgorithmIdentifier",function(){this.seq().obj(this.key("algorithm").objid({"1.2.840.113549.1.1.1":"rsa"}),this.key("none").optional().null_(),this.key("curve").optional().objid(),this.key("params").optional().seq().obj(this.key("p").int(),this.key("q").int(),this.key("g").int()))}),c=n.define("RSAPublicKey",function(){this.seq().obj(this.key("algorithm").use(u),this.key("subjectPublicKey").bitstr())}),f=n.define("RSAPublicKey",function(){this.seq().obj(this.key("modulus").int(),this.key("publicExponent").int())});t.pkcs1ToJwk=function(e){const t=a.decode(e,"der");return{kty:"RSA",n:o(t.modulus),e:o(t.publicExponent),d:o(t.privateExponent),p:o(t.prime1),q:o(t.prime2),dp:o(t.exponent1),dq:o(t.exponent2),qi:o(t.coefficient),alg:"RS256",kid:"2011-04-29"}},t.jwkToPkcs1=function(e){return a.encode({version:0,modulus:s(e.n),publicExponent:s(e.e),privateExponent:s(e.d),prime1:s(e.p),prime2:s(e.q),exponent1:s(e.dp),exponent2:s(e.dq),coefficient:s(e.qi)},"der")},t.pkixToJwk=function(e){const t=c.decode(e,"der"),r=f.decode(t.subjectPublicKey.data,"der");return{kty:"RSA",n:o(r.modulus),e:o(r.publicExponent),alg:"RS256",kid:"2011-04-29"}},t.jwkToPkix=function(e){return c.encode({algorithm:{algorithm:"rsa",none:null},subjectPublicKey:{data:f.encode({modulus:s(e.n),publicExponent:s(e.e)},"der")}},"der")}},function(e,t,r){"use strict";(function(t){const n=r(548),i=r(12),o=r(18),s=r(1217),a=i(r(306));class u{constructor(e){this._key=y(e,s.publicKeyLength)}verify(e,t,r){d(r),s.hashAndVerify(this._key,t,e,r)}marshal(){return t.from(this._key)}get bytes(){return a.PublicKey.encode({Type:a.KeyType.Ed25519,Data:this.marshal()})}equals(e){return this.bytes.equals(e.bytes)}hash(e){d(e),n(this.bytes,"sha2-256",e)}}class c{constructor(e,t){this._key=y(e,s.privateKeyLength),this._publicKey=y(t,s.publicKeyLength)}sign(e,t){d(t),s.hashAndSign(this._key,e,t)}get public(){if(!this._publicKey)throw new Error("public key not provided");return new u(this._publicKey)}marshal(){return t.concat([t.from(this._key),t.from(this._publicKey)])}get bytes(){return a.PrivateKey.encode({Type:a.KeyType.Ed25519,Data:this.marshal()})}equals(e){return this.bytes.equals(e.bytes)}hash(e){d(e),n(this.bytes,"sha2-256",e)}id(e){this.public.hash((t,r)=>{if(t)return e(t);e(null,o.encode(r))})}}function f(e,t){try{e=y(e,s.privateKeyLength+s.publicKeyLength)}catch(e){return t(e)}const r=e.slice(0,s.privateKeyLength),n=e.slice(s.privateKeyLength,e.length);t(null,new c(r,n))}function l(e){return e=y(e,s.publicKeyLength),new u(e)}function h(e,t){void 0===t&&"function"==typeof e&&(t=e),s.generateKey((e,r)=>{if(e)return t(e);let n;try{n=new c(r.secretKey,r.publicKey)}catch(e){return void t(e)}t(null,n)})}function p(e,t,r){void 0===r&&"function"==typeof t&&(r=t),s.generateKeyFromSeed(e,(e,t)=>{if(e)return r(e);let n;try{n=new c(t.secretKey,t.publicKey)}catch(e){return void r(e)}r(null,n)})}function d(e){if("function"!=typeof e)throw new Error("callback is required")}function y(e,r){if(t.isBuffer(e)&&(e=new Uint8Array(e)),!(e instanceof Uint8Array)||e.length!==r)throw new Error("Key must be a Uint8Array or Buffer of length "+r);return e}e.exports={Ed25519PublicKey:u,Ed25519PrivateKey:c,unmarshalEd25519PrivateKey:f,unmarshalEd25519PublicKey:l,generateKeyPair:h,generateKeyPairFromSeed:p}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(e){const n=r(71),i=r(3);t.publicKeyLength=n.sign.publicKeyLength,t.privateKeyLength=n.sign.secretKeyLength,t.generateKey=function(e){i(()=>{let t;try{t=n.sign.keyPair()}catch(t){return e(t)}e(null,t)})},t.generateKeyFromSeed=function(e,t){i(()=>{let r;try{r=n.sign.keyPair.fromSeed(e)}catch(e){return t(e)}t(null,r)})},t.hashAndSign=function(t,r,o){i(()=>{o(null,e.from(n.sign.detached(r,t)))})},t.hashAndVerify=function(e,t,r,o){i(()=>{let i;try{i=n.sign.detached.verify(r,t,e)}catch(e){return o(e)}o(null,i)})}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(t){const n=r(47),i=r(547),o={"AES-128":{ivSize:16,keySize:16},"AES-256":{ivSize:16,keySize:32},Blowfish:{ivSize:8,cipherKeySize:32}};e.exports=((e,r,s,a)=>{const u=o[e];if(!u)return a(new Error("unkown cipherType passed"));if(!r)return a(new Error("unkown hashType passed"));const c=u.keySize,f=u.ivSize,l=20,h=t.from("key expansion"),p=2*(f+c+20);i.create(r,s,(e,r)=>{if(e)return a(e);r.digest(h,(e,i)=>{if(e)return a(e);let o=[],s=0;function u(e){r.digest(t.concat([i,h]),(t,n)=>{if(t)return e(t);let a=n.length;s+a>p&&(a=p-s),o.push(n),s+=a,r.digest(i,(t,r)=>{if(t)return e(t);i=r,e()})})}function l(e){if(e)return a(e);const r=p/2,n=t.concat(o),i=n.slice(0,r),s=n.slice(r,p),u=e=>({iv:e.slice(0,f),cipherKey:e.slice(f,f+c),macKey:e.slice(f+c)});a(null,{k1:u(i),k2:u(s)})}n(()=>s<p,u,l)})})})}).call(this,r(0).Buffer)},function(e,t,r){"use strict";const n=r(1220);e.exports=((e,t)=>{n.generateEphmeralKeyPair(e,t)})},function(e,t,r){"use strict";(function(e){const n=r(305)(),i=r(304),o=r(17).bignum,s=r(551),a=s.toBase64,u=s.toBn,c={"P-256":256,"P-384":384,"P-521":521};t.generateEphmeralKeyPair=function(t,r){i(n.subtle.generateKey({name:"ECDH",namedCurve:t},!0,["deriveBits"]).then(r=>{const o=(o,s,a)=>{let u;"function"==typeof s&&(a=s,s=void 0),u=s?n.subtle.importKey("jwk",p(t,s),{name:"ECDH",namedCurve:t},!1,["deriveBits"]):Promise.resolve(r.privateKey);const f=Promise.all([n.subtle.importKey("jwk",h(t,o),{name:"ECDH",namedCurve:t},!1,[]),u]);i(f.then(e=>n.subtle.deriveBits({name:"ECDH",namedCurve:t,public:e[0]},e[1],c[t])).then(t=>e.from(t)),a)};return n.subtle.exportKey("jwk",r.publicKey).then(e=>({key:l(e),genSharedKey:o}))}),r)};const f={"P-256":32,"P-384":48,"P-521":66};function l(t){const r=f[t.crv];return e.concat([e.from([4]),u(t.x).toArrayLike(e,"be",r),u(t.y).toArrayLike(e,"be",r)],1+2*r)}function h(t,r){const n=f[t];if(!r.slice(0,1).equals(e.from([4])))throw new Error("Invalid key format");const i=new o(r.slice(1,n+1)),s=new o(r.slice(1+n));return{kty:"EC",crv:t,x:a(i,n),y:a(s,n),ext:!0}}function p(e,t){const r=h(e,t.public);return r.d=a(new o(t.private)),r}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";const n=r(19),i={sha1:"sha1","sha2-256":"sha256","sha2-512":"sha512"};function o(e,t,r,o,s){const a=i[s];if(!a)throw new Error(`Hash '${s}' is unknown or not supported`);const u=n.pkcs5.pbkdf2(e,t,r,o,a);return n.util.encode64(u)}e.exports=o},function(e,t,r){"use strict";const n=r(8),i=r(553),o=r(13),s=r(554),a=r(1223),u=r(1224),c=r(557),f=r(193),l=r(44).Connection,h=r(558).PROTOCOL_ID;class p{constructor(){this.handlers={ls:{handlerFunc:(e,t)=>u(this,t),matchFunc:c}},this.log=f.log.listener()}handle(e,t){this.log("listener handle conn");const r=s(h,(r,i)=>{if(r)return t(r);const o=new l(i,e),s=a(o,this.handlers,this.log);n(o,s,o),t()},this.log);n(e,r,e)}addHandler(e,t,r){this.log("adding handler: "+e),o(i(t),"handler must be a function"),this.handlers[e]&&this.log("overwriting handler for "+e),r||(r=c),this.handlers[e]={handlerFunc:t,matchFunc:r}}}e.exports=p},function(e,t,r){"use strict";(function(t){const n=r(102),i=r(53),o=r(44).Connection,s=r(193).writeEncoded,a=r(555);function u(e,r,a){const u=e=>{a.error(e)},f=n({timeout:6e4},u),l=f.handshake;return h(),f;function h(){i.decodeFromReader(l,(n,i)=>{if(n)return u(n);a("received:",i.toString());const f=i.toString().slice(0,-1);c(f,r,(n,c)=>{if(n)return u(n);const p=c;if(p){a("send ack back of: "+f),s(l,i,u);const t=new o(l.rest(),e);r[p].handlerFunc(f,t)}else a("not supported protocol: "+f),s(l,t.from("na\n")),h()})})}}function c(e,t,r){const n=Object.keys(t);let i=!1;a(n,(r,n)=>{t[r].matchFunc(r,e,(e,t)=>{if(e)return n(e);t&&(i=r),n()})},e=>{if(e)return r(e);r(null,i)})}e.exports=u}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(t){const n=r(8),i=r(53),o=r(23);function s(e,r){const s=Object.keys(e.handlers).filter(e=>"ls"!==e),a=s.length,u=s.reduce((e,r)=>{const n=t.from(r+"\n"),i=o.encodingLength(n.length);return e+i},0),c=t.concat([t.from(o.encode(a)),t.from(o.encode(u)),t.from("\n")]),f=s.map(e=>t.from(e+"\n")),l=[c].concat(f);n(n.values(l),i.encode(),r)}e.exports=s}).call(this,r(0).Buffer)},function(e,t,r){"use strict";const n=r(23),i=r(8),o=r(53),s=r(44).Connection,a=r(193),u=r(554),c=r(35),f=r(558).PROTOCOL_ID;class l{constructor(){this.conn=null,this.log=a.log.dialer()}handle(e,t){this.log("dialer handle conn"),t=c(t);const r=u(f,(r,n)=>{if(r)return t(r);this.log("handshake success"),this.conn=new s(n,e),t()},this.log);try{i(e,r,e)}catch(e){this.log.error(e),t(e)}}select(e,t){if(this.log("dialer select "+e),t=c(t),!this.conn)return t(new Error("multistream handshake has not finalized yet"));const r=u(e,(e,r)=>{if(e)return this.conn=new s(r,this.conn),t(e);t(null,new s(r,this.conn))},this.log);i(this.conn,r,this.conn)}ls(e){e=c(e);const t=u("ls",(t,r)=>{if(t)return e(t);i(r,o.decode(),p(r),i.map(h),i.collect((t,r)=>{if(t)return e(t);e(null,r.slice(1))}))},this.log);i(this.conn,t,this.conn)}}function h(e){return e.toString().slice(0,-1)}function p(e){let t=!0,r=0;return i.take(e=>(n.decode(e),r=n.decode(e,n.decode.bytes),!0))}e.exports=l},function(e,t,r){"use strict";const n=r(1227);function i(e,t,r){const i=e.split("/"),o=t.split("/"),s=i[1],a=i[2],u=o[1],c=o[2];if(s!==u)return r(null,!1);const f=n.satisfies(a,"~"+c);r(null,f)}e.exports=i},function(e,t,r){(function(r){var n;t=e.exports=ee,n="object"==typeof r&&r.env&&r.env.NODE_DEBUG&&/\bsemver\b/i.test(r.env.NODE_DEBUG)?function(){var e=Array.prototype.slice.call(arguments,0);e.unshift("SEMVER"),console.log.apply(console,e)}:function(){},t.SEMVER_SPEC_VERSION="2.0.0";var i=256,o=Number.MAX_SAFE_INTEGER||9007199254740991,s=16,a=t.re=[],u=t.src=[],c=0,f=c++;u[f]="0|[1-9]\\d*";var l=c++;u[l]="[0-9]+";var h=c++;u[h]="\\d*[a-zA-Z-][a-zA-Z0-9-]*";var p=c++;u[p]="("+u[f]+")\\.("+u[f]+")\\.("+u[f]+")";var d=c++;u[d]="("+u[l]+")\\.("+u[l]+")\\.("+u[l]+")";var y=c++;u[y]="(?:"+u[f]+"|"+u[h]+")";var g=c++;u[g]="(?:"+u[l]+"|"+u[h]+")";var m=c++;u[m]="(?:-("+u[y]+"(?:\\."+u[y]+")*))";var b=c++;u[b]="(?:-?("+u[g]+"(?:\\."+u[g]+")*))";var v=c++;u[v]="[0-9A-Za-z-]+";var _=c++;u[_]="(?:\\+("+u[v]+"(?:\\."+u[v]+")*))";var w=c++,S="v?"+u[p]+u[m]+"?"+u[_]+"?";u[w]="^"+S+"$";var k="[v=\\s]*"+u[d]+u[b]+"?"+u[_]+"?",E=c++;u[E]="^"+k+"$";var A=c++;u[A]="((?:<|>)?=?)";var x=c++;u[x]=u[l]+"|x|X|\\*";var I=c++;u[I]=u[f]+"|x|X|\\*";var T=c++;u[T]="[v=\\s]*("+u[I]+")(?:\\.("+u[I]+")(?:\\.("+u[I]+")(?:"+u[m]+")?"+u[_]+"?)?)?";var B=c++;u[B]="[v=\\s]*("+u[x]+")(?:\\.("+u[x]+")(?:\\.("+u[x]+")(?:"+u[b]+")?"+u[_]+"?)?)?";var C=c++;u[C]="^"+u[A]+"\\s*"+u[T]+"$";var P=c++;u[P]="^"+u[A]+"\\s*"+u[B]+"$";var O=c++;u[O]="(?:^|[^\\d])(\\d{1,16})(?:\\.(\\d{1,16}))?(?:\\.(\\d{1,16}))?(?:$|[^\\d])";var R=c++;u[R]="(?:~>?)";var N=c++;u[N]="(\\s*)"+u[R]+"\\s+",a[N]=new RegExp(u[N],"g");var L="$1~",j=c++;u[j]="^"+u[R]+u[T]+"$";var M=c++;u[M]="^"+u[R]+u[B]+"$";var K=c++;u[K]="(?:\\^)";var D=c++;u[D]="(\\s*)"+u[K]+"\\s+",a[D]=new RegExp(u[D],"g");var U="$1^",F=c++;u[F]="^"+u[K]+u[T]+"$";var q=c++;u[q]="^"+u[K]+u[B]+"$";var H=c++;u[H]="^"+u[A]+"\\s*("+k+")$|^$";var z=c++;u[z]="^"+u[A]+"\\s*("+S+")$|^$";var V=c++;u[V]="(\\s*)"+u[A]+"\\s*("+k+"|"+u[T]+")",a[V]=new RegExp(u[V],"g");var G="$1$2$3",W=c++;u[W]="^\\s*("+u[T]+")\\s+-\\s+("+u[T]+")\\s*$";var $=c++;u[$]="^\\s*("+u[B]+")\\s+-\\s+("+u[B]+")\\s*$";var Y=c++;u[Y]="(<|>)?=?\\s*\\*";for(var J=0;J<c;J++)n(J,u[J]),a[J]||(a[J]=new RegExp(u[J]));function X(e,t){if(e instanceof ee)return e;if("string"!=typeof e)return null;if(e.length>i)return null;var r=t?a[E]:a[w];if(!r.test(e))return null;try{return new ee(e,t)}catch(e){return null}}function Z(e,t){var r=X(e,t);return r?r.version:null}function Q(e,t){var r=X(e.trim().replace(/^[=v]+/,""),t);return r?r.version:null}function ee(e,t){if(e instanceof ee){if(e.loose===t)return e;e=e.version}else if("string"!=typeof e)throw new TypeError("Invalid Version: "+e);if(e.length>i)throw new TypeError("version is longer than "+i+" characters");if(!(this instanceof ee))return new ee(e,t);n("SemVer",e,t),this.loose=t;var r=e.trim().match(t?a[E]:a[w]);if(!r)throw new TypeError("Invalid Version: "+e);if(this.raw=e,this.major=+r[1],this.minor=+r[2],this.patch=+r[3],this.major>o||this.major<0)throw new TypeError("Invalid major version");if(this.minor>o||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>o||this.patch<0)throw new TypeError("Invalid patch version");r[4]?this.prerelease=r[4].split(".").map(function(e){if(/^[0-9]+$/.test(e)){var t=+e;if(t>=0&&t<o)return t}return e}):this.prerelease=[],this.build=r[5]?r[5].split("."):[],this.format()}function te(e,t,r,n){"string"==typeof r&&(n=r,r=void 0);try{return new ee(e,r).inc(t,n).version}catch(e){return null}}function re(e,t){if(ge(e,t))return null;var r=X(e),n=X(t);if(r.prerelease.length||n.prerelease.length){for(var i in r)if(("major"===i||"minor"===i||"patch"===i)&&r[i]!==n[i])return"pre"+i;return"prerelease"}for(var i in r)if(("major"===i||"minor"===i||"patch"===i)&&r[i]!==n[i])return i}t.parse=X,t.valid=Z,t.clean=Q,t.SemVer=ee,ee.prototype.format=function(){return this.version=this.major+"."+this.minor+"."+this.patch,this.prerelease.length&&(this.version+="-"+this.prerelease.join(".")),this.version},ee.prototype.toString=function(){return this.version},ee.prototype.compare=function(e){return n("SemVer.compare",this.version,this.loose,e),e instanceof ee||(e=new ee(e,this.loose)),this.compareMain(e)||this.comparePre(e)},ee.prototype.compareMain=function(e){return e instanceof ee||(e=new ee(e,this.loose)),ie(this.major,e.major)||ie(this.minor,e.minor)||ie(this.patch,e.patch)},ee.prototype.comparePre=function(e){if(e instanceof ee||(e=new ee(e,this.loose)),this.prerelease.length&&!e.prerelease.length)return-1;if(!this.prerelease.length&&e.prerelease.length)return 1;if(!this.prerelease.length&&!e.prerelease.length)return 0;var t=0;do{var r=this.prerelease[t],i=e.prerelease[t];if(n("prerelease compare",t,r,i),void 0===r&&void 0===i)return 0;if(void 0===i)return 1;if(void 0===r)return-1;if(r!==i)return ie(r,i)}while(++t)},ee.prototype.inc=function(e,t){switch(e){case"premajor":this.prerelease.length=0,this.patch=0,this.minor=0,this.major++,this.inc("pre",t);break;case"preminor":this.prerelease.length=0,this.patch=0,this.minor++,this.inc("pre",t);break;case"prepatch":this.prerelease.length=0,this.inc("patch",t),this.inc("pre",t);break;case"prerelease":0===this.prerelease.length&&this.inc("patch",t),this.inc("pre",t);break;case"major":0===this.minor&&0===this.patch&&0!==this.prerelease.length||this.major++,this.minor=0,this.patch=0,this.prerelease=[];break;case"minor":0===this.patch&&0!==this.prerelease.length||this.minor++,this.patch=0,this.prerelease=[];break;case"patch":0===this.prerelease.length&&this.patch++,this.prerelease=[];break;case"pre":if(0===this.prerelease.length)this.prerelease=[0];else{for(var r=this.prerelease.length;--r>=0;)"number"==typeof this.prerelease[r]&&(this.prerelease[r]++,r=-2);-1===r&&this.prerelease.push(0)}t&&(this.prerelease[0]===t?isNaN(this.prerelease[1])&&(this.prerelease=[t,0]):this.prerelease=[t,0]);break;default:throw new Error("invalid increment argument: "+e)}return this.format(),this.raw=this.version,this},t.inc=te,t.diff=re,t.compareIdentifiers=ie;var ne=/^[0-9]+$/;function ie(e,t){var r=ne.test(e),n=ne.test(t);return r&&n&&(e=+e,t=+t),r&&!n?-1:n&&!r?1:e<t?-1:e>t?1:0}function oe(e,t){return ie(t,e)}function se(e,t){return new ee(e,t).major}function ae(e,t){return new ee(e,t).minor}function ue(e,t){return new ee(e,t).patch}function ce(e,t,r){return new ee(e,r).compare(new ee(t,r))}function fe(e,t){return ce(e,t,!0)}function le(e,t,r){return ce(t,e,r)}function he(e,r){return e.sort(function(e,n){return t.compare(e,n,r)})}function pe(e,r){return e.sort(function(e,n){return t.rcompare(e,n,r)})}function de(e,t,r){return ce(e,t,r)>0}function ye(e,t,r){return ce(e,t,r)<0}function ge(e,t,r){return 0===ce(e,t,r)}function me(e,t,r){return 0!==ce(e,t,r)}function be(e,t,r){return ce(e,t,r)>=0}function ve(e,t,r){return ce(e,t,r)<=0}function _e(e,t,r,n){var i;switch(t){case"===":"object"==typeof e&&(e=e.version),"object"==typeof r&&(r=r.version),i=e===r;break;case"!==":"object"==typeof e&&(e=e.version),"object"==typeof r&&(r=r.version),i=e!==r;break;case"":case"=":case"==":i=ge(e,r,n);break;case"!=":i=me(e,r,n);break;case">":i=de(e,r,n);break;case">=":i=be(e,r,n);break;case"<":i=ye(e,r,n);break;case"<=":i=ve(e,r,n);break;default:throw new TypeError("Invalid operator: "+t)}return i}function we(e,t){if(e instanceof we){if(e.loose===t)return e;e=e.value}if(!(this instanceof we))return new we(e,t);n("comparator",e,t),this.loose=t,this.parse(e),this.semver===Se?this.value="":this.value=this.operator+this.semver.version,n("comp",this)}t.rcompareIdentifiers=oe,t.major=se,t.minor=ae,t.patch=ue,t.compare=ce,t.compareLoose=fe,t.rcompare=le,t.sort=he,t.rsort=pe,t.gt=de,t.lt=ye,t.eq=ge,t.neq=me,t.gte=be,t.lte=ve,t.cmp=_e,t.Comparator=we;var Se={};function ke(e,t){if(e instanceof ke)return e.loose===t?e:new ke(e.raw,t);if(e instanceof we)return new ke(e.value,t);if(!(this instanceof ke))return new ke(e,t);if(this.loose=t,this.raw=e,this.set=e.split(/\s*\|\|\s*/).map(function(e){return this.parseRange(e.trim())},this).filter(function(e){return e.length}),!this.set.length)throw new TypeError("Invalid SemVer Range: "+e);this.format()}function Ee(e,t){return new ke(e,t).set.map(function(e){return e.map(function(e){return e.value}).join(" ").trim().split(" ")})}function Ae(e,t){return n("comp",e),e=Be(e,t),n("caret",e),e=Ie(e,t),n("tildes",e),e=Pe(e,t),n("xrange",e),e=Re(e,t),n("stars",e),e}function xe(e){return!e||"x"===e.toLowerCase()||"*"===e}function Ie(e,t){return e.trim().split(/\s+/).map(function(e){return Te(e,t)}).join(" ")}function Te(e,t){var r=t?a[M]:a[j];return e.replace(r,function(t,r,i,o,s){var a;return n("tilde",e,t,r,i,o,s),xe(r)?a="":xe(i)?a=">="+r+".0.0 <"+(+r+1)+".0.0":xe(o)?a=">="+r+"."+i+".0 <"+r+"."+(+i+1)+".0":s?(n("replaceTilde pr",s),"-"!==s.charAt(0)&&(s="-"+s),a=">="+r+"."+i+"."+o+s+" <"+r+"."+(+i+1)+".0"):a=">="+r+"."+i+"."+o+" <"+r+"."+(+i+1)+".0",n("tilde return",a),a})}function Be(e,t){return e.trim().split(/\s+/).map(function(e){return Ce(e,t)}).join(" ")}function Ce(e,t){n("caret",e,t);var r=t?a[q]:a[F];return e.replace(r,function(t,r,i,o,s){var a;return n("caret",e,t,r,i,o,s),xe(r)?a="":xe(i)?a=">="+r+".0.0 <"+(+r+1)+".0.0":xe(o)?a="0"===r?">="+r+"."+i+".0 <"+r+"."+(+i+1)+".0":">="+r+"."+i+".0 <"+(+r+1)+".0.0":s?(n("replaceCaret pr",s),"-"!==s.charAt(0)&&(s="-"+s),a="0"===r?"0"===i?">="+r+"."+i+"."+o+s+" <"+r+"."+i+"."+(+o+1):">="+r+"."+i+"."+o+s+" <"+r+"."+(+i+1)+".0":">="+r+"."+i+"."+o+s+" <"+(+r+1)+".0.0"):(n("no pr"),a="0"===r?"0"===i?">="+r+"."+i+"."+o+" <"+r+"."+i+"."+(+o+1):">="+r+"."+i+"."+o+" <"+r+"."+(+i+1)+".0":">="+r+"."+i+"."+o+" <"+(+r+1)+".0.0"),n("caret return",a),a})}function Pe(e,t){return n("replaceXRanges",e,t),e.split(/\s+/).map(function(e){return Oe(e,t)}).join(" ")}function Oe(e,t){e=e.trim();var r=t?a[P]:a[C];return e.replace(r,function(t,r,i,o,s,a){n("xRange",e,t,r,i,o,s,a);var u=xe(i),c=u||xe(o),f=c||xe(s),l=f;return"="===r&&l&&(r=""),u?t=">"===r||"<"===r?"<0.0.0":"*":r&&l?(c&&(o=0),f&&(s=0),">"===r?(r=">=",c?(i=+i+1,o=0,s=0):f&&(o=+o+1,s=0)):"<="===r&&(r="<",c?i=+i+1:o=+o+1),t=r+i+"."+o+"."+s):c?t=">="+i+".0.0 <"+(+i+1)+".0.0":f&&(t=">="+i+"."+o+".0 <"+i+"."+(+o+1)+".0"),n("xRange return",t),t})}function Re(e,t){return n("replaceStars",e,t),e.trim().replace(a[Y],"")}function Ne(e,t,r,n,i,o,s,a,u,c,f,l,h){return t=xe(r)?"":xe(n)?">="+r+".0.0":xe(i)?">="+r+"."+n+".0":">="+t,a=xe(u)?"":xe(c)?"<"+(+u+1)+".0.0":xe(f)?"<"+u+"."+(+c+1)+".0":l?"<="+u+"."+c+"."+f+"-"+l:"<="+a,(t+" "+a).trim()}function Le(e,t){for(var r=0;r<e.length;r++)if(!e[r].test(t))return!1;if(t.prerelease.length){for(var r=0;r<e.length;r++)if(n(e[r].semver),e[r].semver!==Se&&e[r].semver.prerelease.length>0){var i=e[r].semver;if(i.major===t.major&&i.minor===t.minor&&i.patch===t.patch)return!0}return!1}return!0}function je(e,t,r){try{t=new ke(t,r)}catch(e){return!1}return t.test(e)}function Me(e,t,r){var n=null,i=null;try{var o=new ke(t,r)}catch(e){return null}return e.forEach(function(e){o.test(e)&&(n&&-1!==i.compare(e)||(n=e,i=new ee(n,r)))}),n}function Ke(e,t,r){var n=null,i=null;try{var o=new ke(t,r)}catch(e){return null}return e.forEach(function(e){o.test(e)&&(n&&1!==i.compare(e)||(n=e,i=new ee(n,r)))}),n}function De(e,t){try{return new ke(e,t).range||"*"}catch(e){return null}}function Ue(e,t,r){return qe(e,t,"<",r)}function Fe(e,t,r){return qe(e,t,">",r)}function qe(e,t,r,n){var i,o,s,a,u;switch(e=new ee(e,n),t=new ke(t,n),r){case">":i=de,o=ve,s=ye,a=">",u=">=";break;case"<":i=ye,o=be,s=de,a="<",u="<=";break;default:throw new TypeError('Must provide a hilo val of "<" or ">"')}if(je(e,t,n))return!1;for(var c=0;c<t.set.length;++c){var f=t.set[c],l=null,h=null;if(f.forEach(function(e){e.semver===Se&&(e=new we(">=0.0.0")),l=l||e,h=h||e,i(e.semver,l.semver,n)?l=e:s(e.semver,h.semver,n)&&(h=e)}),l.operator===a||l.operator===u)return!1;if((!h.operator||h.operator===a)&&o(e,h.semver))return!1;if(h.operator===u&&s(e,h.semver))return!1}return!0}function He(e,t){var r=X(e,t);return r&&r.prerelease.length?r.prerelease:null}function ze(e,t,r){return e=new ke(e,r),t=new ke(t,r),e.intersects(t)}function Ve(e){if(e instanceof ee)return e;if("string"!=typeof e)return null;var t=e.match(a[O]);return null==t?null:X((t[1]||"0")+"."+(t[2]||"0")+"."+(t[3]||"0"))}we.prototype.parse=function(e){var t=this.loose?a[H]:a[z],r=e.match(t);if(!r)throw new TypeError("Invalid comparator: "+e);this.operator=r[1],"="===this.operator&&(this.operator=""),r[2]?this.semver=new ee(r[2],this.loose):this.semver=Se},we.prototype.toString=function(){return this.value},we.prototype.test=function(e){return n("Comparator.test",e,this.loose),this.semver===Se||("string"==typeof e&&(e=new ee(e,this.loose)),_e(e,this.operator,this.semver,this.loose))},we.prototype.intersects=function(e,t){if(!(e instanceof we))throw new TypeError("a Comparator is required");var r;if(""===this.operator)return r=new ke(e.value,t),je(this.value,r,t);if(""===e.operator)return r=new ke(this.value,t),je(e.semver,r,t);var n=!(">="!==this.operator&&">"!==this.operator||">="!==e.operator&&">"!==e.operator),i=!("<="!==this.operator&&"<"!==this.operator||"<="!==e.operator&&"<"!==e.operator),o=this.semver.version===e.semver.version,s=!(">="!==this.operator&&"<="!==this.operator||">="!==e.operator&&"<="!==e.operator),a=_e(this.semver,"<",e.semver,t)&&(">="===this.operator||">"===this.operator)&&("<="===e.operator||"<"===e.operator),u=_e(this.semver,">",e.semver,t)&&("<="===this.operator||"<"===this.operator)&&(">="===e.operator||">"===e.operator);return n||i||o&&s||a||u},t.Range=ke,ke.prototype.format=function(){return this.range=this.set.map(function(e){return e.join(" ").trim()}).join("||").trim(),this.range},ke.prototype.toString=function(){return this.range},ke.prototype.parseRange=function(e){var t=this.loose;e=e.trim(),n("range",e,t);var r=t?a[$]:a[W];e=e.replace(r,Ne),n("hyphen replace",e),e=e.replace(a[V],"$1$2$3"),n("comparator trim",e,a[V]),e=e.replace(a[N],"$1~"),e=e.replace(a[D],"$1^"),e=e.split(/\s+/).join(" ");var i=t?a[H]:a[z],o=e.split(" ").map(function(e){return Ae(e,t)}).join(" ").split(/\s+/);return this.loose&&(o=o.filter(function(e){return!!e.match(i)})),o=o.map(function(e){return new we(e,t)}),o},ke.prototype.intersects=function(e,t){if(!(e instanceof ke))throw new TypeError("a Range is required");return this.set.some(function(r){return r.every(function(r){return e.set.some(function(e){return e.every(function(e){return r.intersects(e,t)})})})})},t.toComparators=Ee,ke.prototype.test=function(e){if(!e)return!1;"string"==typeof e&&(e=new ee(e,this.loose));for(var t=0;t<this.set.length;t++)if(Le(this.set[t],e))return!0;return!1},t.satisfies=je,t.maxSatisfying=Me,t.minSatisfying=Ke,t.validRange=De,t.ltr=Ue,t.gtr=Fe,t.outside=qe,t.prerelease=He,t.intersects=ze,t.coerce=Ve}).call(this,r(6))},function(e,t,r){"use strict";const n=r(80),i=r(31),o=r(1229),s=r(144),a=r(1),u=a("libp2p:circuit:transportdialer");u.err=a("libp2p:circuit:error:transportdialer");const c=r(1230);class f{static get tag(){return"Circuit"}constructor(e,t){this.options=t||{},this.swarm=e,this.dialer=null,this.utils=s(e),this.peerInfo=this.swarm._peerInfo,this.relays=this.filter(this.peerInfo.multiaddrs.toArray()),0===this.relays.length&&this.peerInfo.multiaddrs.add(`/p2p-circuit/ipfs/${this.peerInfo.id.toB58String()}`),this.dialer=new o(e,t),this.swarm.on("peer-mux-established",this.dialer.canHop.bind(this.dialer)),this.swarm.on("peer-mux-closed",e=>{this.dialer.relayPeers.delete(e.id.toB58String())})}_dialSwarmRelays(){this.relays.forEach(e=>{let t=e.toString().split("/p2p-circuit").filter(e=>e.length);t.forEach(e=>{const t=this.utils.peerInfoFromMa(i(e));this.dialer._dialRelay(t)})})}dial(e,t,r){return this.dialer.dial(e,t,r)}createListener(e,t){"function"==typeof e&&(t=e,e=this.options||{});const r=c(this.swarm,e,t);return r.on("listen",this._dialSwarmRelays.bind(this)),r}filter(e){return Array.isArray(e)||(e=[e]),e.filter(e=>n.Circuit.matches(e))}}e.exports=f},function(e,t,r){"use strict";const n=r(35),i=r(68),o=r(5),s=r(553),a=r(31),u=r(44).Connection,c=r(144),f=r(309),l=r(1),h=l("libp2p:circuit:dialer");h.err=l("libp2p:circuit:error:dialer");const p=r(310),d=r(145);class y{constructor(e,t){this.swarm=e,this.relayPeers=new Map,this.relayConns=new Map,this.options=t,this.utils=c(e)}_dialRelayHelper(e,t){return this.relayConns.has(e.id.toB58String())?t(null,this.relayConns.get(e.id.toB58String())):this._dialRelay(e,t)}dial(e,t){t=t||(()=>{});const r=e.toString();if(!r.includes("/p2p-circuit"))return h.err("invalid circuit address"),t(new Error("invalid circuit address"));const n=r.split("p2p-circuit"),i="/"===n[0]?null:a(n[0]),o=a(n[1]||n[0]),s=new u;return setImmediate(this._dialPeer.bind(this),o,i,(e,r)=>{if(e)return h.err(e),t(e);s.setInnerConn(r),t(null,s)}),s}canHop(e,t){t=n(t||(()=>{})),this._dialRelayHelper(e,(r,n)=>{if(r)return t(r);const i=new f(n);o([e=>i.write(d.CircuitRelay.encode({type:d.CircuitRelay.Type.CAN_HOP}),e),e=>i.read(e)],(r,n)=>{if(r)return t(r);const o=d.CircuitRelay.decode(n);if(o.code!==d.CircuitRelay.Status.SUCCESS){const r=new Error(`HOP not supported, skipping - ${this.utils.getB58String(e)}`);return h(r),t(r)}h(`HOP supported adding as relay - ${this.utils.getB58String(e)}`),this.relayPeers.set(this.utils.getB58String(e),e),i.close(),t()})})}_dialPeer(e,t,r){if(s(t)&&(r=t,t=null),r||(r=(()=>{})),e=a(e),t)return this._negotiateRelay(t,e,(e,t)=>e?(h.err("An error has occurred negotiating the relay connection",e),r(e)):r(null,t));{const t=Array.from(this.relayPeers.values());let n=i=>{if(!i){let e="no relay peers were found or all relays failed to dial";return h.err(e),r(e)}return this._negotiateRelay(i,e,(e,i)=>{if(e)return h.err(e),n(t.shift());r(null,i)})};n(t.shift())}}_negotiateRelay(e,t,r){t=a(t),e=this.utils.peerInfoFromMa(e);const n=this.swarm._peerInfo.multiaddrs.toArray();this._dialRelayHelper(e,(e,s)=>{if(e)return h.err(e),r(e);let a=new f(s);o([e=>{h(`negotiating relay for peer ${t.getPeerId()}`),a.write(d.CircuitRelay.encode({type:d.CircuitRelay.Type.HOP,srcPeer:{id:this.swarm._peerInfo.id.id,addrs:n.map(e=>e.buffer)},dstPeer:{id:i.createFromB58String(t.getPeerId()).id,addrs:[t.buffer]}}),e)},e=>a.read(e)],(e,t)=>{if(e)return r(e);const n=d.CircuitRelay.decode(t);return n.type!==d.CircuitRelay.Type.STATUS?r(new Error("Got invalid message type - "+`expected ${d.CircuitRelay.Type.STATUS} got ${n.type}`)):n.code!==d.CircuitRelay.Status.SUCCESS?r(new Error(`Got ${n.code} error code trying to dial over relay`)):void r(null,new u(a.rest()))})})}_dialRelay(e,t){t=n(t||(()=>{})),this.swarm.dial(e,p.relay,n((e,r)=>{if(e)return h.err(e),t(e);t(null,r)}))}}e.exports=y},function(e,t,r){"use strict";const n=r(3),i=r(310),o=r(10).EventEmitter,s=r(31),a=r(80),u=r(1231),c=r(1232),f=r(145),l=r(144),h=r(309),p=r(1),d=p("libp2p:circuit:listener");d.err=p("libp2p:circuit:error:listener"),e.exports=((e,t,r)=>{const p=new o,y=l(e);return p.stopHandler=new u(e),p.hopHandler=new c(e,t.hop),p.listen=((t,o)=>{o=o||(()=>{}),e.handle(i.relay,(e,t)=>{const n=new h(t);n.read((e,t)=>{if(e)return void d.err(e);let i=null;try{i=f.CircuitRelay.decode(t)}catch(e){return y.writeResponse(n,f.CircuitRelay.Status.MALFORMED_MESSAGE)}switch(i.type){case f.CircuitRelay.Type.CAN_HOP:case f.CircuitRelay.Type.HOP:return p.hopHandler.handle(i,n);case f.CircuitRelay.Type.STOP:return p.stopHandler.handle(i,n,r);default:return y.writeResponse(n,f.CircuitRelay.Status.INVALID_MSG_TYPE)}})}),n(()=>p.emit("listen")),o()}),p.close=(t=>{e.unhandle(i.relay),n(()=>p.emit("close")),t()}),p.getAddrs=(t=>{let r=e._peerInfo.multiaddrs.toArray(),n=r.filter(t=>a.Circuit.matches(t)&&!t.toString().includes(e._peerInfo.id.toB58String()));n.length&&(r=n);let i=[];r.forEach(t=>{const r=`/p2p-circuit/ipfs/${e._peerInfo.id.toB58String()}`;if(t.toString()!==r)if(a.Circuit.matches(t))i.push(t.encapsulate(`/ipfs/${e._peerInfo.id.toB58String()}`));else if(t.getPeerId())i.push(s("/p2p-circuit").encapsulate(t));else{const r=`${t}/ipfs/${e._peerInfo.id.toB58String()}`;i.push(s("/p2p-circuit").encapsulate(r))}else i.push(s(r))}),t(null,i)}),p})},function(e,t,r){"use strict";const n=r(3),i=r(10).EventEmitter,o=r(44).Connection,s=r(144),a=r(52),u=r(145).CircuitRelay,c=r(37),f=r(1),l=f("libp2p:circuit:stop");l.err=f("libp2p:circuit:error:stop");class h extends i{constructor(e){super(),this.swarm=e,this.utils=s(e)}handle(e,t,r){r=r||(()=>{}),c([r=>this.utils.validateAddrs(e,t,u.Type.STOP,r),e=>this.utils.writeResponse(t,u.Status.Success,e)],i=>{if(i)return r(),l(i);const s=new a(this.utils.peerIdFromId(e.srcPeer.id));e.srcPeer.addrs.forEach(e=>s.multiaddrs.add(e));const u=new o(t.rest());u.setPeerInfo(s),n(()=>this.emit("connection",u)),r(u)})}}e.exports=h},function(e,t,r){"use strict";const n=r(8),i=r(1),o=r(52),s=r(68),a=r(10).EventEmitter,u=r(35),c=r(144),f=r(309),l=r(145).CircuitRelay,h=r(31),p=r(37),d=r(5),y=r(310),g=i("libp2p:swarm:circuit:relay");g.err=i("libp2p:swarm:circuit:error:relay");class m extends a{constructor(e,t){super(),this.swarm=e,this.peerInfo=this.swarm._peerInfo,this.utils=c(e),this.config=t||{active:!1,enabled:!1},this.active=this.config.active}handle(e,t){if(!this.config.enabled)return this.utils.writeResponse(t,l.Status.HOP_CANT_SPEAK_RELAY),t.close();if(e.type===l.Type.CAN_HOP)return this.utils.writeResponse(t,l.Status.SUCCESS),t.close();const r=s.createFromBytes(e.dstPeer.id);if(r.toB58String()===this.peerInfo.id.toB58String())return this.utils.writeResponse(t,l.Status.HOP_CANT_RELAY_TO_SELF),t.close();const n=s.createFromBytes(e.dstPeer.id).toB58String();if(!e.dstPeer.addrs.length){const t=h(`/p2p-circuit/ipfs/${n}`).buffer;e.dstPeer.addrs.push(t)}const i=e=>(g.err(e),this.utils.writeResponse(t,l.Status.HOP_NO_CONN_TO_DST),t.close()),o=e=>{let t;try{if(t=this.swarm._peerBook.get(n),!t.isConnected()&&!this.active){const t=new Error("No Connection to peer");return i(t),e(t)}}catch(t){if(!this.active)return i(t),e(t)}e()};p([r=>this.utils.validateAddrs(e,t,l.Type.HOP,r),e=>o(e),r=>this._circuit(t.rest(),e,r)],e=>{e&&(g.err(e),setImmediate(()=>this.emit("circuit:error",e))),setImmediate(()=>this.emit("circuit:success"))})}_connectToStop(e,t,r){this._dialPeer(e,(e,n)=>e?(this.utils.writeResponse(t,l.Status.HOP_CANT_DIAL_DST),g.err(e),r(e)):this.utils.writeResponse(t,l.Status.SUCCESS,e=>e?(g.err(e),r(e)):r(null,n)))}_negotiateStop(e,t,r,n){const i=Object.assign({},r,{type:l.Type.STOP});e.write(l.encode(i),r=>{if(r)return this.utils.writeResponse(t,l.Status.HOP_CANT_OPEN_DST_STREAM),g.err(r),n(r);e.read((e,t)=>{if(e)return g.err(e),n(e);const r=l.decode(t);return r.code!==l.Status.SUCCESS?n(new Error("Unable to create circuit!")):n(null,t)})})}_circuit(e,t,r){let i=null;const o=new f(e);d([e=>this._connectToStop(t.dstPeer,o,e),(r,n)=>{i=new f(r),this._negotiateStop(i,e,t,n)}],e=>{if(e)return o&&o.close(),i&&i.close(),r(e);const t=o.rest(),s=i.rest();n(t,s,t),r()})}_dialPeer(e,t){const r=new o(s.createFromBytes(e.id));e.addrs.forEach(e=>r.multiaddrs.add(e)),this.swarm.dial(r,y.relay,u((e,r)=>{if(e)return g.err(e),t(e);t(null,r)}))}}e.exports=m},function(e,t,r){"use strict";(function(n){const i=r(14),o=r(1234),s=r(13),a=r(5);class u{constructor(e,t,r){s(n.isBuffer(e),"invalid id provided"),t&&r&&s(t.public.bytes.equals(r.bytes),"inconsistent arguments"),this._id=e,this._idB58String=i.toB58String(this.id),this._privKey=t,this._pubKey=r}get id(){return this._id}set id(e){throw new Error("Id is immutable")}get privKey(){return this._privKey}set privKey(e){this._privKey=e}get pubKey(){return this._pubKey?this._pubKey:this._privKey?this._privKey.public:void 0}set pubKey(e){this._pubKey=e}marshalPubKey(){if(this.pubKey)return o.keys.marshalPublicKey(this.pubKey)}marshalPrivKey(){if(this.privKey)return o.keys.marshalPrivateKey(this.privKey)}toPrint(){return this.toJSON()}toJSON(){return{id:this.toB58String(),privKey:c(this.marshalPrivKey()),pubKey:c(this.marshalPubKey())}}toHexString(){return i.toHexString(this.id)}toBytes(){return this.id}toB58String(){return this._idB58String}isEqual(e){if(n.isBuffer(e))return this.id.equals(e);if(e.id)return this.id.equals(e.id);throw new Error("not valid Id")}isValid(e){this.privKey&&this.privKey.public&&this.privKey.public.bytes&&n.isBuffer(this.pubKey.bytes)&&this.privKey.public.bytes.equals(this.pubKey.bytes)?e():e(new Error("Keys not match"))}}function c(e){if(e)return e.toString("base64")}t=e.exports=u,t.create=function(e,t){"function"==typeof e&&(t=e,e={}),e=e||{},e.bits=e.bits||2048,a([t=>o.keys.generateKeyPair("RSA",e.bits,t),(e,t)=>e.public.hash((r,n)=>{t(r,n,e)})],(e,r,n)=>{if(e)return t(e);t(null,new u(r,n))})},t.createFromHexString=function(e){return new u(i.fromHexString(e))},t.createFromBytes=function(e){return new u(e)},t.createFromB58String=function(e){return new u(i.fromB58String(e))},t.createFromPubKey=function(e,t){if("function"!=typeof t)throw new Error("callback is required");let r;try{let i=e;if("string"==typeof i&&(i=n.from(e,"base64")),!n.isBuffer(i))throw new Error("Supplied key is neither a base64 string nor a buffer");r=o.keys.unmarshalPublicKey(i)}catch(e){return t(e)}r.hash((e,n)=>{if(e)return t(e);t(null,new u(n,null,r))})},t.createFromPrivKey=function(e,t){if("function"!=typeof t)throw new Error("callback is required");let r=e;try{if("string"==typeof r&&(r=n.from(e,"base64")),!n.isBuffer(r))throw new Error("Supplied key is neither a base64 string nor a buffer")}catch(e){return t(e)}a([e=>o.keys.unmarshalPrivateKey(r,e),(e,t)=>e.public.hash((r,n)=>{t(r,n,e)})],(e,r,n)=>{if(e)return t(e);t(null,new u(r,n,n.public))})},t.createFromJSON=function(e,t){if("function"!=typeof t)throw new Error("callback is required");let r,s,c,f;try{r=i.fromB58String(e.id),s=e.privKey&&n.from(e.privKey,"base64"),c=e.pubKey&&n.from(e.pubKey,"base64"),f=c&&o.keys.unmarshalPublicKey(c)}catch(e){return t(e)}s?a([e=>o.keys.unmarshalPrivateKey(s,e),(e,t)=>e.public.hash((r,n)=>{t(r,n,e)}),(e,t,r)=>{f?f.hash((n,i)=>{r(n,e,t,i)}):r(null,e,t)}],(e,n,i,o)=>e?t(e):f&&!n.equals(o)?t(new Error("Public and private key do not match")):r&&!n.equals(r)?t(new Error("Id and private key do not match")):void t(null,new u(r,i,f))):t(null,new u(r,null,f))},t.isPeerId=function(e){return Boolean("object"==typeof e&&e._id&&e._idB58String)}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";const n=r(562),i=r(1236),o=r(1238);t=e.exports,t.aes=i,t.hmac=n,t.keys=o,t.randomBytes=r(567),t.pbkdf2=r(1249)},function(e,t,r){"use strict";e.exports={SHA1:20,SHA256:32,SHA512:64}},function(e,t,r){"use strict";const n=r(1237),i={16:"aes-128-ctr",32:"aes-256-ctr"};t.create=function(e,t,r){const o=i[e.length];if(!o)return r(new Error("Invalid key length"));const s=n.createCipheriv(o,e,t),a=n.createDecipheriv(o,e,t),u={encrypt(e,t){t(null,s.update(e))},decrypt(e,t){t(null,a.update(e))}};r(null,u)}},function(e,t,r){"use strict";const n=r(70);e.exports={createCipheriv:n.createCipheriv,createDecipheriv:n.createDecipheriv}},function(e,t,r){"use strict";(function(n){const i=r(12),o=i(r(313)),s=r(19);t=e.exports;const a={rsa:r(1239),ed25519:r(1244),secp256k1:r(72)(o,r(567))};function u(e){const t=a[e.toLowerCase()];return void 0!==t}t.supportedKeys=a,t.keysPBM=o,t.keyStretcher=r(1246),t.generateEphemeralKeyPair=r(1247),t.generateKeyPair=((e,t,r)=>{let n=a[e.toLowerCase()];if(!n)return r(new Error("invalid or unsupported key type"));n.generateKeyPair(t,r)}),t.generateKeyPairFromSeed=((e,t,r,n)=>{let i=a[e.toLowerCase()];return i?"ed25519"!==e.toLowerCase()?n(new Error("Seed key derivation is unimplemented for RSA or secp256k1")):void i.generateKeyPairFromSeed(t,r,n):n(new Error("invalid or unsupported key type"))}),t.unmarshalPublicKey=(e=>{const t=o.PublicKey.decode(e),r=t.Data;switch(t.Type){case o.KeyType.RSA:return a.rsa.unmarshalRsaPublicKey(r);case o.KeyType.Ed25519:return a.ed25519.unmarshalEd25519PublicKey(r);case o.KeyType.Secp256k1:if(a.secp256k1)return a.secp256k1.unmarshalSecp256k1PublicKey(r);throw new Error("secp256k1 support requires libp2p-crypto-secp256k1 package");default:throw new Error("invalid or unsupported key type")}}),t.marshalPublicKey=((e,t)=>{if(t=(t||"rsa").toLowerCase(),!u(t))throw new Error("invalid or unsupported key type");return e.bytes}),t.unmarshalPrivateKey=((e,t)=>{let r;try{r=o.PrivateKey.decode(e)}catch(e){return t(e)}const n=r.Data;switch(r.Type){case o.KeyType.RSA:return a.rsa.unmarshalRsaPrivateKey(n,t);case o.KeyType.Ed25519:return a.ed25519.unmarshalEd25519PrivateKey(n,t);case o.KeyType.Secp256k1:return a.secp256k1?a.secp256k1.unmarshalSecp256k1PrivateKey(n,t):t(new Error("secp256k1 support requires libp2p-crypto-secp256k1 package"));default:t(new Error("invalid or unsupported key type"))}}),t.marshalPrivateKey=((e,t)=>{if(t=(t||"rsa").toLowerCase(),!u(t))throw new Error("invalid or unsupported key type");return e.bytes}),t.import=((e,t,r)=>{try{const i=s.pki.decryptRsaPrivateKey(e,t);if(null===i)throw new Error("Cannot read the key, most likely the password is wrong or not a RSA key");let o=s.asn1.toDer(s.pki.privateKeyToAsn1(i));return o=n.from(o.getBytes(),"binary"),a.rsa.unmarshalRsaPrivateKey(o,r)}catch(e){r(e)}})}).call(this,r(0).Buffer)},function(e,t,r){"use strict";const n=r(563),i=r(12),o=r(18),s=r(565),a=i(r(313)),u=r(19),c=r(3);class f{constructor(e){this._key=e}verify(e,t,r){g(r),s.hashAndVerify(this._key,t,e,r)}marshal(){return s.utils.jwkToPkix(this._key)}get bytes(){return a.PublicKey.encode({Type:a.KeyType.RSA,Data:this.marshal()})}encrypt(e){return this._key.encrypt(e,"RSAES-PKCS1-V1_5")}equals(e){return this.bytes.equals(e.bytes)}hash(e){g(e),n(this.bytes,"sha2-256",e)}}class l{constructor(e,t){this._key=e,this._publicKey=t}genSecret(){return s.getRandomValues(new Uint8Array(16))}sign(e,t){g(t),s.hashAndSign(this._key,e,t)}get public(){if(!this._publicKey)throw new Error("public key not provided");return new f(this._publicKey)}decrypt(e,t){s.decrypt(this._key,e,t)}marshal(){return s.utils.jwkToPkcs1(this._key)}get bytes(){return a.PrivateKey.encode({Type:a.KeyType.RSA,Data:this.marshal()})}equals(e){return this.bytes.equals(e.bytes)}hash(e){g(e),n(this.bytes,"sha2-256",e)}id(e){this.public.hash((t,r)=>{if(t)return e(t);e(null,o.encode(r))})}export(e,t,r){"function"==typeof t&&(r=t,t=e,e="pkcs-8"),g(r),c(()=>{let n=null,i=null;try{const r=new u.util.ByteBuffer(this.marshal()),o=u.asn1.fromDer(r),s=u.pki.privateKeyFromAsn1(o);if("pkcs-8"===e){const e={algorithm:"aes256",count:1e4,saltSize:16,prfAlgorithm:"sha512"};i=u.pki.encryptRsaPrivateKey(s,t,e)}else n=new Error(`Unknown export format '${e}'`)}catch(e){n=e}r(n,i)})}}function h(e,t){const r=s.utils.pkcs1ToJwk(e);s.unmarshalPrivateKey(r,(e,r)=>{if(e)return t(e);t(null,new l(r.privateKey,r.publicKey))})}function p(e){const t=s.utils.pkixToJwk(e);return new f(t)}function d(e,t){s.unmarshalPrivateKey(e,(e,r)=>{if(e)return t(e);t(null,new l(r.privateKey,r.publicKey))})}function y(e,t){s.generateKey(e,(e,r)=>{if(e)return t(e);t(null,new l(r.privateKey,r.publicKey))})}function g(e){if("function"!=typeof e)throw new Error("callback is required")}e.exports={RsaPublicKey:f,RsaPrivateKey:l,unmarshalRsaPublicKey:p,unmarshalRsaPrivateKey:h,generateKeyPair:y,fromJwk:d}},function(e,t,r){"use strict";(function(t){const n=r(48),i=r(49),o=r(564),s=r(1241),a=o.toCallback,u=o.toBuf,c=o.fromString,f=o.fromNumberTo32BitBuf,l=(e,r)=>{s.sha2256(e,(e,n)=>{e&&r(e),s.sha2256(t.from(n),r)})};e.exports={sha1:s.sha1,sha2256:s.sha2256,sha2512:s.sha2512,sha3512:a(u(n.sha3_512)),sha3384:a(u(n.sha3_384)),sha3256:a(u(n.sha3_256)),sha3224:a(u(n.sha3_224)),shake128:a(u(n.shake_128,256)),shake256:a(u(n.shake_256,512)),keccak224:a(u(n.keccak_224)),keccak256:a(u(n.keccak_256)),keccak384:a(u(n.keccak_384)),keccak512:a(u(n.keccak_512)),murmur3128:a(u(c(i.x64.hash128))),murmur332:a(f(c(i.x86.hash32))),addBlake:r(1242),dblSha2256:l}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(t){const n=r(50),i=o();function o(){return self.crypto?self.crypto.subtle||self.crypto.webkitSubtle:self.msCrypto?self.msCrypto.subtle:void 0}function s(e){if(!i)throw new Error("Please use a browser with webcrypto support");return(r,o)=>{const s=i.digest({name:e},r);if("function"!=typeof s.then)return s.onerror=(()=>{o(new Error(`hashing data using ${e}`))}),void(s.oncomplete=(e=>{o(null,e.target.result)}));n(s.then(e=>t.from(new Uint8Array(e))),o)}}function a(e,t){s("SHA-1")(e,t)}function u(e,t){s("SHA-256")(e,t)}function c(e,t){s("SHA-512")(e,t)}e.exports={sha1:a,sha2256:u,sha2512:c}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(t){const n=r(51),i=r(564).toCallback,o=45569,s=45633,a={init:n.blake2bInit,update:n.blake2bUpdate,digest:n.blake2bFinal},u={init:n.blake2sInit,update:n.blake2sUpdate,digest:n.blake2sFinal},c=(e,r)=>i(n=>{const i=r.init(e,null);return r.update(i,n),t.from(r.digest(i))});e.exports=(e=>{for(let t=0;t<64;t++)e[o+t]=c(t+1,a);for(let t=0;t<32;t++)e[s+t]=c(t+1,u)})}).call(this,r(0).Buffer)},function(e,t,r){"use strict";const n=r(17),i=r(566),o=i.toBase64,s=i.toBn,a=n.define("RSAPrivateKey",function(){this.seq().obj(this.key("version").int(),this.key("modulus").int(),this.key("publicExponent").int(),this.key("privateExponent").int(),this.key("prime1").int(),this.key("prime2").int(),this.key("exponent1").int(),this.key("exponent2").int(),this.key("coefficient").int())}),u=n.define("AlgorithmIdentifier",function(){this.seq().obj(this.key("algorithm").objid({"1.2.840.113549.1.1.1":"rsa"}),this.key("none").optional().null_(),this.key("curve").optional().objid(),this.key("params").optional().seq().obj(this.key("p").int(),this.key("q").int(),this.key("g").int()))}),c=n.define("RSAPublicKey",function(){this.seq().obj(this.key("algorithm").use(u),this.key("subjectPublicKey").bitstr())}),f=n.define("RSAPublicKey",function(){this.seq().obj(this.key("modulus").int(),this.key("publicExponent").int())});t.pkcs1ToJwk=function(e){const t=a.decode(e,"der");return{kty:"RSA",n:o(t.modulus),e:o(t.publicExponent),d:o(t.privateExponent),p:o(t.prime1),q:o(t.prime2),dp:o(t.exponent1),dq:o(t.exponent2),qi:o(t.coefficient),alg:"RS256",kid:"2011-04-29"}},t.jwkToPkcs1=function(e){return a.encode({version:0,modulus:s(e.n),publicExponent:s(e.e),privateExponent:s(e.d),prime1:s(e.p),prime2:s(e.q),exponent1:s(e.dp),exponent2:s(e.dq),coefficient:s(e.qi)},"der")},t.pkixToJwk=function(e){const t=c.decode(e,"der"),r=f.decode(t.subjectPublicKey.data,"der");return{kty:"RSA",n:o(r.modulus),e:o(r.publicExponent),alg:"RS256",kid:"2011-04-29"}},t.jwkToPkix=function(e){return c.encode({algorithm:{algorithm:"rsa",none:null},subjectPublicKey:{data:f.encode({modulus:s(e.n),publicExponent:s(e.e)},"der")}},"der")}},function(e,t,r){"use strict";(function(t){const n=r(563),i=r(12),o=r(18),s=r(1245),a=i(r(313));class u{constructor(e){this._key=y(e,s.publicKeyLength)}verify(e,t,r){d(r),s.hashAndVerify(this._key,t,e,r)}marshal(){return t.from(this._key)}get bytes(){return a.PublicKey.encode({Type:a.KeyType.Ed25519,Data:this.marshal()})}equals(e){return this.bytes.equals(e.bytes)}hash(e){d(e),n(this.bytes,"sha2-256",e)}}class c{constructor(e,t){this._key=y(e,s.privateKeyLength),this._publicKey=y(t,s.publicKeyLength)}sign(e,t){d(t),s.hashAndSign(this._key,e,t)}get public(){if(!this._publicKey)throw new Error("public key not provided");return new u(this._publicKey)}marshal(){return t.concat([t.from(this._key),t.from(this._publicKey)])}get bytes(){return a.PrivateKey.encode({Type:a.KeyType.Ed25519,Data:this.marshal()})}equals(e){return this.bytes.equals(e.bytes)}hash(e){d(e),n(this.bytes,"sha2-256",e)}id(e){this.public.hash((t,r)=>{if(t)return e(t);e(null,o.encode(r))})}}function f(e,t){try{e=y(e,s.privateKeyLength+s.publicKeyLength)}catch(e){return t(e)}const r=e.slice(0,s.privateKeyLength),n=e.slice(s.privateKeyLength,e.length);t(null,new c(r,n))}function l(e){return e=y(e,s.publicKeyLength),new u(e)}function h(e,t){void 0===t&&"function"==typeof e&&(t=e),s.generateKey((e,r)=>{if(e)return t(e);let n;try{n=new c(r.secretKey,r.publicKey)}catch(e){return void t(e)}t(null,n)})}function p(e,t,r){void 0===r&&"function"==typeof t&&(r=t),s.generateKeyFromSeed(e,(e,t)=>{if(e)return r(e);let n;try{n=new c(t.secretKey,t.publicKey)}catch(e){return void r(e)}r(null,n)})}function d(e){if("function"!=typeof e)throw new Error("callback is required")}function y(e,r){if(t.isBuffer(e)&&(e=new Uint8Array(e)),!(e instanceof Uint8Array)||e.length!==r)throw new Error("Key must be a Uint8Array or Buffer of length "+r);return e}e.exports={Ed25519PublicKey:u,Ed25519PrivateKey:c,unmarshalEd25519PrivateKey:f,unmarshalEd25519PublicKey:l,generateKeyPair:h,generateKeyPairFromSeed:p}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(e){const n=r(71),i=r(3);t.publicKeyLength=n.sign.publicKeyLength,t.privateKeyLength=n.sign.secretKeyLength,t.generateKey=function(e){i(()=>{let t;try{t=n.sign.keyPair()}catch(t){return e(t)}e(null,t)})},t.generateKeyFromSeed=function(e,t){i(()=>{let r;try{r=n.sign.keyPair.fromSeed(e)}catch(e){return t(e)}t(null,r)})},t.hashAndSign=function(t,r,o){i(()=>{o(null,e.from(n.sign.detached(r,t)))})},t.hashAndVerify=function(e,t,r,o){i(()=>{let i;try{i=n.sign.detached.verify(r,t,e)}catch(e){return o(e)}o(null,i)})}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(t){const n=r(47),i=r(562),o={"AES-128":{ivSize:16,keySize:16},"AES-256":{ivSize:16,keySize:32},Blowfish:{ivSize:8,cipherKeySize:32}};e.exports=((e,r,s,a)=>{const u=o[e];if(!u)return a(new Error("unkown cipherType passed"));if(!r)return a(new Error("unkown hashType passed"));const c=u.keySize,f=u.ivSize,l=20,h=t.from("key expansion"),p=2*(f+c+20);i.create(r,s,(e,r)=>{if(e)return a(e);r.digest(h,(e,i)=>{if(e)return a(e);let o=[],s=0;function u(e){r.digest(t.concat([i,h]),(t,n)=>{if(t)return e(t);let a=n.length;s+a>p&&(a=p-s),o.push(n),s+=a,r.digest(i,(t,r)=>{if(t)return e(t);i=r,e()})})}function l(e){if(e)return a(e);const r=p/2,n=t.concat(o),i=n.slice(0,r),s=n.slice(r,p),u=e=>({iv:e.slice(0,f),cipherKey:e.slice(f,f+c),macKey:e.slice(f+c)});a(null,{k1:u(i),k2:u(s)})}n(()=>s<p,u,l)})})})}).call(this,r(0).Buffer)},function(e,t,r){"use strict";const n=r(1248);e.exports=((e,t)=>{n.generateEphmeralKeyPair(e,t)})},function(e,t,r){"use strict";(function(e){const n=r(312)(),i=r(311),o=r(17).bignum,s=r(566),a=s.toBase64,u=s.toBn,c={"P-256":256,"P-384":384,"P-521":521};t.generateEphmeralKeyPair=function(t,r){i(n.subtle.generateKey({name:"ECDH",namedCurve:t},!0,["deriveBits"]).then(r=>{const o=(o,s,a)=>{let u;"function"==typeof s&&(a=s,s=void 0),u=s?n.subtle.importKey("jwk",p(t,s),{name:"ECDH",namedCurve:t},!1,["deriveBits"]):Promise.resolve(r.privateKey);const f=Promise.all([n.subtle.importKey("jwk",h(t,o),{name:"ECDH",namedCurve:t},!1,[]),u]);i(f.then(e=>n.subtle.deriveBits({name:"ECDH",namedCurve:t,public:e[0]},e[1],c[t])).then(t=>e.from(t)),a)};return n.subtle.exportKey("jwk",r.publicKey).then(e=>({key:l(e),genSharedKey:o}))}),r)};const f={"P-256":32,"P-384":48,"P-521":66};function l(t){const r=f[t.crv];return e.concat([e.from([4]),u(t.x).toArrayLike(e,"be",r),u(t.y).toArrayLike(e,"be",r)],1+2*r)}function h(t,r){const n=f[t];if(!r.slice(0,1).equals(e.from([4])))throw new Error("Invalid key format");const i=new o(r.slice(1,n+1)),s=new o(r.slice(1+n));return{kty:"EC",crv:t,x:a(i,n),y:a(s,n),ext:!0}}function p(e,t){const r=h(e,t.public);return r.d=a(new o(t.private)),r}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";const n=r(19),i={sha1:"sha1","sha2-256":"sha256","sha2-512":"sha512"};function o(e,t,r,o,s){const a=i[s];if(!a)throw new Error(`Hash '${s}' is unknown or not supported`);const u=n.pkcs5.pbkdf2(e,t,r,o,a);return n.util.encode64(u)}e.exports=o},function(e,t,r){"use strict";const n=r(307),i=r(44).Connection,o=r(3),s=r(559),a=r(5),u=r(1),c=u("libp2p:switch:dial"),f=r(561),l=r(568),h="Unexpected end of input from reader.";function p(e,t,r,n){e.select(t,(e,t)=>{if(!0===e)return n(new Error(h));r(e,t)})}function d(e,t,r,n){e.handle(t,e=>{if(!0===e)return n(new Error(h));r(e)})}class y{constructor(e,t,r,n,i){this.switch=e,this.peerInfo=t,this.ourPeerInfo=r,this.protocol=n,this.callback=i}dial(){const e=new i;return e.setPeerInfo(this.peerInfo),a([e=>{this._establishConnection(e)},(t,r)=>{if(t)return e.setPeerInfo(this.peerInfo),e.setInnerConn(t),r(null,e);r(null)}],(e,t)=>{if(e&&e.message===h||!0===e)return c("Connection dropped for %s",this.peerInfo.id.toB58String()),this.callback(null,null);this.callback(e,t)}),e}_establishConnection(e){const t=this.peerInfo.id.toB58String();if(c("dialing %s",t),t===this.ourPeerInfo.id.toB58String())return e(new Error("A node cannot dial itself"));a([e=>{this._createBaseConnection(t,e)},(e,r)=>{this._createMuxedConnection(e,t,r)},(e,t)=>{if(!this.protocol)return t();e.newStream?e.newStream((e,r)=>{if(e)return t(e);this._performProtocolHandshake(r,t)}):this._performProtocolHandshake(e,t)}],(t,r)=>{e(t,r)})}_createBaseConnection(e,t){const r=this.switch.conns[e],n=this.switch.muxedConns[e];return n?t(null,null):r?(this.switch.conns[e]=void 0,t(null,r)):void a([e=>{this._attemptDial(e)},(e,t)=>{this._createPrivateConnection(e,t)},(e,t)=>{this._encryptConnection(e,t)}],(e,r)=>{if(e)return t(e);t(null,r)})}_createPrivateConnection(e,t){if(null===this.switch.protector)return t(null,e);const r=this.switch.protector.protect(e,e=>{if(e)return t(e);r.setPeerInfo(this.peerInfo),t(null,r)})}_createMuxedConnection(e,t,r){const n=this.switch.muxedConns[t];if(n)return r(null,n.muxer);e.setPeerInfo(this.peerInfo),this._attemptMuxerUpgrade(e,t,(n,i)=>n&&!this.protocol?(this.switch.conns[t]=e,r(null,null)):n?(c("muxer upgrade failed with error",n),r(null,e)):void r(null,i),r)}_attemptMuxerUpgrade(e,t,r,i){const s=Object.keys(this.switch.muxers);if(0===s.length)return r(new Error("no muxers available"));const a=new n.Dialer;d(a,e,e=>{if(e)return r(new Error("multistream not supported"));const n=e=>{c("selecting %s",e),p(a,e,(i,a)=>{if(i)return 0===s.length?r(new Error("could not upgrade to stream muxing")):n(s.shift());const u=l(null,e,a,this.switch.observer),f=this.switch.muxers[e].dialer(u);this.switch.muxedConns[t]={muxer:f},f.once("close",()=>{delete this.switch.muxedConns[t],this.peerInfo.disconnect(),this.switch._peerInfo.disconnect(),c(`closed connection to ${t}`),o(()=>this.switch.emit("peer-mux-closed",this.peerInfo))}),f.on("stream",e=>{e.setPeerInfo(this.peerInfo),this.switch.protocolMuxer(null)(e)}),o(()=>this.switch.emit("peer-mux-established",this.peerInfo)),r(null,f)},i)};n(s.shift())},i)}_attemptDial(e){if(!this.switch.hasTransports())return e(new Error("No transports registered, dial not possible"));const t=this.switch.availableTransports(this.peerInfo),r=Boolean(this.switch.transports[s.tag]);let n=!1;const i=o=>{let a=o;const u=this.peerInfo.id.toB58String();if(!a){if(!r){const t=`Circuit not enabled and all transports failed to dial peer ${u}!`;return e(new Error(t))}if(n)return e(new Error(`No available transports to dial peer ${u}!`));c("Falling back to dialing over circuit"),this.peerInfo.multiaddrs.add(`/p2p-circuit/ipfs/${u}`),n=!0,a=s.tag}c(`dialing transport ${a}`),this.switch.transport.dial(a,this.peerInfo,(r,n)=>{if(r)return c(r),i(t.shift());const o=l(a,null,n,this.switch.observer);e(null,o)})};i(t.shift())}_encryptConnection(e,t){const r=new n.Dialer;d(r,e,e=>{if(e)return t(e);const n=this.switch._peerInfo.id;c("selecting crypto: %s",this.switch.crypto.tag),p(r,this.switch.crypto.tag,(e,r)=>{if(e)return t(e);const i=l(null,this.switch.crypto.tag,r,this.switch.observer),o=this.switch.crypto.encrypt(n,i,this.peerInfo.id,e=>{if(e)return t(e);o.setPeerInfo(this.peerInfo),t(null,o)})},t)},t)}_performProtocolHandshake(e,t){this.protocol||t();const r=new n.Dialer;d(r,e,e=>{if(e)return t(e);p(r,this.protocol,(e,r)=>{if(e)return c("could not perform protocol handshake: ",e),t(e);const n=l(null,this.protocol,r,this.switch.observer);t(null,n)},t)},t)}}function g(e){return(t,r,n)=>{"function"==typeof r&&(n=r,r=null),n=n||function e(){};const i=f(t,e._peerBook),o=new y(e,i,e._peerInfo,r,n);return o.dial()}}e.exports=g},function(e,t,r){"use strict";const n=r(307),i=r(568),o=r(1),s=o("libp2p:switch:protocol-muxer");e.exports=function e(t,r){return e=>o=>{const a=e?i(e,null,o,r):o,u=new n.Listener;Object.keys(t).forEach(e=>{if(!e)return;const n=(e,n)=>{s(`registering handler with protocol ${e}`);const o=t[e];if(o){const t=o&&o.handlerFunc;if(t){const s=i(null,e,n,r);t(o,s)}}};u.addHandler(e,n,t[e].matchFunc)}),u.handle(a,e=>{})}}},function(e,t,r){"use strict";const n=r(8),i=r(10);e.exports=(e=>{const t=Object.assign(new i,{incoming:r("in"),outgoing:r("out")});return e.on("peer-mux-established",e=>{t.emit("peer:connected",e.id.toB58String())}),e.on("peer-mux-closed",e=>{t.emit("peer:closed",e.id.toB58String())}),t;function r(e){return(t,r,i)=>n.map(n=>(o(i,t,r,e,n.length),n))}function o(e,r,n,i,o){e.then(e=>{if(e){const s=e.id.toB58String();setImmediate(()=>t.emit("message",s,r,n,i,o))}})}})},function(e,t,r){"use strict";const n=r(10),i=r(1254),o=r(1255),s={computeThrottleMaxQueueSize:1e3,computeThrottleTimeout:2e3,movingAverageIntervals:[6e4,3e5,9e5],maxOldPeersRetention:50},a=["dataReceived","dataSent"],u={in:"dataReceived",out:"dataSent"};e.exports=((e,t)=>{const r=Object.assign({},s,t),c=new i(a,r),f=Object.assign(new n,{stop:y,global:c,peers:()=>Array.from(h.keys()),forPeer:e=>h.get(e)||l.get(e),transports:()=>Array.from(p.keys()),forTransport:e=>p.get(e),protocols:()=>Array.from(d.keys()),forProtocol:e=>d.get(e)});c.on("update",g);const l=o(r.maxOldPeersRetention),h=new Map,p=new Map,d=new Map;return e.on("message",(e,t,n,o,s)=>{const f=u[o];if(t){c.push(f,s);let t=h.get(e);t||(t=l.get(e),t?l.delete(e):t=new i(a,r),t.on("update",g),t.start(),h.set(e,t)),t.push(f,s)}if(t){let e=p.get(t);e||(e=new i(a,r),e.on("update",g),p.set(t,e)),e.push(f,s)}if(n){let e=d.get(n);e||(e=new i(a,r),e.on("update",g),d.set(n,e)),e.push(f,s)}}),e.on("peer:closed",e=>{const t=h.get(e);t&&(t.removeListener("update",g),t.stop(),h.delete(e),l.set(e,t))}),f;function y(){c.stop();for(let e of h.values())e.stop();for(let e of p.values())e.stop()}function g(){f.emit("update")}})},function(e,t,r){"use strict";const n=r(10),i=r(107).Big,o=r(502);class s extends n{constructor(e,t){super(),this._options=t,this._queue=[],this._stats={},this._frequencyLastTime=Date.now(),this._frequencyAccumulators={},this._movingAverages={},this._update=this._update.bind(this),e.forEach(e=>{this._stats[e]=i(0),this._movingAverages[e]={},this._options.movingAverageIntervals.forEach(t=>{const r=this._movingAverages[e][t]=o(t);r.push(this._frequencyLastTime,0)})})}start(){this._queue.length&&this._resetComputeTimeout()}stop(){this._timeout&&clearTimeout(this._timeout)}get snapshot(){return Object.assign({},this._stats)}get movingAverages(){return Object.assign({},this._movingAverages)}push(e,t){this._queue.push([e,t,Date.now()]),this._resetComputeTimeout()}_resetComputeTimeout(){this._timeout&&clearTimeout(this._timeout),this._timeout=setTimeout(this._update,this._nextTimeout())}_nextTimeout(){const e=this._queue.length/this._options.computeThrottleMaxQueueSize,t=Math.max(this._options.computeThrottleTimeout*(1-e),0);return t}_update(){if(this._timeout=null,this._queue.length){let e;for(;this._queue.length;){const t=e=this._queue.shift();this._applyOp(t)}this._updateFrequency(e[2]),this.emit("update",this._stats)}}_updateFrequency(e){const t=e-this._frequencyLastTime;Object.keys(this._stats).forEach(r=>{this._updateFrequencyFor(r,t,e)}),this._frequencyLastTime=e}_updateFrequencyFor(e,t,r){const n=this._frequencyAccumulators[e]||0;this._frequencyAccumulators[e]=0;const i=n/t*1e3;let s=this._movingAverages[e];s||(s=this._movingAverages[e]={}),this._options.movingAverageIntervals.forEach(e=>{let t=s[e];t||(t=s[e]=o(e)),t.push(r,i)})}_applyOp(e){const t=e[0],r=e[1];if("number"!=typeof r)throw new Error("invalid increment number:",r);let n;n=this._stats.hasOwnProperty(t)?this._stats[t]:this._stats[t]=i(0),this._stats[t]=n.plus(r),this._frequencyAccumulators[t]||(this._frequencyAccumulators[t]=0),this._frequencyAccumulators[t]+=r}}e.exports=s},function(e,t,r){"use strict";const n=r(1256);e.exports=(e=>{const t=n(e);return t.delete=t.remove,t})},function(e,t){e.exports=function(e){if(!e)throw Error("hashlru must have a max value, of type number, greater than 0");var t=0,r=Object.create(null),n=Object.create(null);function i(i,o){r[i]=o,t++,t>=e&&(t=0,n=r,r=Object.create(null))}return{has:function(e){return void 0!==r[e]||void 0!==n[e]},remove:function(e){void 0!==r[e]&&(r[e]=void 0),void 0!==n[e]&&(n[e]=void 0)},get:function(e){var t=r[e];return void 0!==t?t:void 0!==(t=n[e])?(i(e,t),t):void 0},set:function(e,t){void 0!==r[e]?r[e]=t:i(e,t)},clear:function(){r=Object.create(null),n=Object.create(null)}}}},function(e,t,r){"use strict";e.exports.PROTECTOR_REQUIRED="No protector provided with private network enforced"},function(e,t,r){"use strict";const n=r(1259);t=e.exports=r(1260),t.mount=n.mount,t.unmount=n.unmount},function(e,t,r){"use strict";const n=r(8),i=r(102),o=r(314),s=o.PROTOCOL,a=o.PING_LENGTH,u=r(1),c=u("libp2p-ping");function f(e){e.handle(s,(e,t)=>{const r=i({timeout:0}),o=r.handshake;function s(){o.read(a,(e,t)=>{if(!0!==e)return e?c.error(e):(o.write(t),s())})}n(t,r,t),s()})}function l(e){e.unhandle(s)}c.error=u("libp2p-ping:error"),t=e.exports,t.mount=f,t.unmount=l},function(e,t,r){"use strict";const n=r(10).EventEmitter,i=r(8),o=r(102),s=r(314),a=r(1261),u=a.rnd,c=r(1),f=c("libp2p-ping");f.error=c("libp2p-ping:error");const l=s.PROTOCOL,h=s.PING_LENGTH;class p extends n{constructor(e,t){super(),this._stopped=!1,this.peer=t,this.swarm=e}start(){f("dialing %s to %s",l,this.peer.id.toB58String()),this.swarm.dial(this.peer,l,(e,t)=>{if(e)return this.emit("error",e);const r=o({timeout:0});this.shake=r.handshake,i(r,t,r);const n=this;function s(){let e=new Date,t=u(h);n.shake.write(t),n.shake.read(h,(r,i)=>{let o=new Date;if(r||!t.equals(i)){const e=new Error("Received wrong ping ack");return n.emit("error",e)}n.emit("ping",o-e),n._stopped||s()})}s()})}stop(){!this._stopped&&this.shake&&(this._stopped=!0,i(i.empty(),this.shake.rest()))}}e.exports=p},function(e,t,r){"use strict";const n=r(113),i=r(314);t=e.exports,t.rnd=(e=>(e||(e=i.PING_LENGTH),n.randomBytes(e)))},function(e,t,r){"use strict";const n=r(10),i=r(1263).default,o=r(1)("libp2p:connection-manager"),s={maxPeers:1/0,minPeers:0,maxData:1/0,maxSentData:1/0,maxReceivedData:1/0,maxEventLoopDelay:1/0,pollInterval:2e3,movingAverageInterval:6e4,defaultPeerValue:1};class a extends n{constructor(e,t){if(super(),this._libp2p=e,this._options=Object.assign({},s,t),this._options.maxPeersPerProtocol=c(this._options.maxPeersPerProtocol),o("options: %j",this._options),this._stats=e.stats,t&&!this._stats)throw new Error("No libp2p.stats");this._peerValues=new Map,this._peers=new Map,this._peerProtocols=new Map,this._peerCountPerProtocol=new Map,this._onStatsUpdate=this._onStatsUpdate.bind(this),this._onPeerConnect=this._onPeerConnect.bind(this),this._onPeerDisconnect=this._onPeerDisconnect.bind(this),this._libp2p.isStarted()?this._onceStarted():this._libp2p.once("start",this._onceStarted.bind(this))}start(){this._stats.on("update",this._onStatsUpdate),this._libp2p.on("peer:connect",this._onPeerConnect),this._libp2p.on("peer:disconnect",this._onPeerDisconnect),this._latencyMonitor=new i({dataEmitIntervalMs:this._options.pollInterval}),this._onLatencyMeasure=this._onLatencyMeasure.bind(this),this._latencyMonitor.on("data",this._onLatencyMeasure)}stop(){this._stats.removeListener("update",this._onStatsUpdate),this._libp2p.removeListener("peer:connect",this._onPeerConnect),this._libp2p.removeListener("peer:disconnect",this._onPeerDisconnect),this._latencyMonitor.removeListener("data",this._onLatencyMeasure)}setPeerValue(e,t){if(t<0||t>1)throw new Error("value should be a number between 0 and 1");e.toB58String&&(e=e.toB58String()),this._peerValues.set(e,t)}_onceStarted(){this._peerId=this._libp2p.peerInfo.id.toB58String()}_onStatsUpdate(){const e=this._stats.global.movingAverages,t=e.dataReceived[this._options.movingAverageInterval].movingAverage();this._checkLimit("maxReceivedData",t);const r=e.dataSent[this._options.movingAverageInterval].movingAverage();this._checkLimit("maxSentData",r);const n=t+r;this._checkLimit("maxData",n),o("stats update",n)}_onPeerConnect(e){const t=e.id.toB58String();o("%s: connected to %s",this._peerId,t),this._peerValues.set(t,this._options.defaultPeerValue),this._peers.set(t,e),this.emit("connected",t),this._checkLimit("maxPeers",this._peers.size),f(e).forEach(e=>{const r=this._peerCountPerProtocol[e];r||(this._peerCountPerProtocol[e]=0),this._peerCountPerProtocol[e]++;let n=this._peerProtocols[t];n||(n=this._peerProtocols[t]=new Set),n.add(e),this._checkProtocolMaxPeersLimit(e,this._peerCountPerProtocol[e])})}_onPeerDisconnect(e){const t=e.id.toB58String();o("%s: disconnected from %s",this._peerId,t),this._peerValues.delete(t),this._peers.delete(t);const r=this._peerProtocols[t];r&&Array.from(r).forEach(e=>{const t=this._peerCountPerProtocol[e];t&&this._peerCountPerProtocol[e]--}),this.emit("disconnected",t)}_onLatencyMeasure(e){this._checkLimit("maxEventLoopDelay",e.avgMs)}_checkLimit(e,t){o("checking limit. current value of %s is %d",e,t);const r=this._options[e];t>r&&(o("%s: limit exceeded: %s, %d",this._peerId,e,t),this.emit("limit:exceeded",e,t),this._maybeDisconnectOne())}_checkProtocolMaxPeersLimit(e,t){o("checking protocol limit. current value of %s is %d",e,t);const r=this._options.maxPeersPerProtocol[e];t>r&&(o("%s: protocol max peers limit exceeded: %s, %d",this._peerId,e,t),this.emit("limit:exceeded",e,t),this._maybeDisconnectOne())}_maybeDisconnectOne(){if(this._options.minPeers<this._peerValues.size){const e=Array.from(this._peerValues).sort(u);o("%s: sorted peer values: %j",this._peerId,e);const t=e[0];if(t){const e=t[0];o("%s: lowest value peer is %s",this._peerId,e),o("%s: forcing disconnection from %j",this._peerId,e),this._disconnectPeer(e)}}}_disconnectPeer(e){o("preemptively disconnecting peer",e),this.emit("%s: disconnect:preemptive",this._peerId,e);const t=this._peers.get(e);this._libp2p.hangUp(t,e=>{e&&this.emit("error",e)})}}function u(e,t){return e[1]-t[1]}function c(e){return e||(e={}),Object.keys(e).forEach(t=>{const r=e[t];delete e[t],e[t.toLowerCase()]=r}),e}function f(e){const t=new Set;return e.multiaddrs.forEach(e=>{e.protos().map(l).forEach(e=>{t.add(e)})}),Array.from(t)}function l(e){return e.name.toLowerCase()}e.exports=a},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=r(1264).default},function(e,t,r){"use strict";(function(e){Object.defineProperty(t,"__esModule",{value:!0});var n=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),i=r(10),o=h(i),s=r(569),a=h(s),u=r(214),c=h(u),f=r(1300),l=h(f);function h(e){return e&&e.__esModule?e:{default:e}}function p(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function d(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function y(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var g=r(571)("latency-monitor:LatencyMonitor"),m=function(t){function r(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=t.latencyCheckIntervalMs,i=t.dataEmitIntervalMs,o=t.asyncTestFn,s=t.latencyRandomPercentage;p(this,r);var u=d(this,(r.__proto__||Object.getPrototypeOf(r)).call(this)),c=u;return c.latencyCheckIntervalMs=n||500,c.latencyRandomPercentage=s||10,c._latecyCheckMultiply=c.latencyRandomPercentage/100*2*c.latencyCheckIntervalMs,c._latecyCheckSubtract=c._latecyCheckMultiply/2,c.dataEmitIntervalMs=null===i||0===i?void 0:i||5e3,g("latencyCheckIntervalMs: %s dataEmitIntervalMs: %s",c.latencyCheckIntervalMs,c.dataEmitIntervalMs),c.dataEmitIntervalMs?g("Expecting ~%s events per summary",c.latencyCheckIntervalMs/c.dataEmitIntervalMs):g("Not emitting summaries"),c.asyncTestFn=o,e&&e.hrtime?(g("Using process.hrtime for timing"),c.now=e.hrtime,c.getDeltaMS=function(e){var t=c.now(e);return 1e3*t[0]+t[1]/1e6}):"undefined"!=typeof window&&(0,a.default)(window,"performance.now")?(g("Using performance.now for timing"),c.now=window.performance.now.bind(window.performance),c.getDeltaMS=function(e){return Math.round(c.now()-e)}):(g("Using Date.now for timing"),c.now=Date.now,c.getDeltaMS=function(e){return c.now()-e}),c._latencyData=c._initLatencyData(),b()&&(c._visibilityChangeEmitter=new l.default,c._visibilityChangeEmitter.on("visibilityChange",function(e){e?c._startTimers():(c._emitSummary(),c._stopTimers())})),c._visibilityChangeEmitter&&!c._visibilityChangeEmitter.isVisible()||c._startTimers(),u}return y(r,t),n(r,[{key:"_startTimers",value:function e(){var t=this;this._checkLatencyID||(this._checkLatency(),this.dataEmitIntervalMs&&(this._emitIntervalID=setInterval(function(){return t._emitSummary()},this.dataEmitIntervalMs),(0,c.default)(this._emitIntervalID.unref)&&this._emitIntervalID.unref()))}},{key:"_stopTimers",value:function e(){this._checkLatencyID&&(clearTimeout(this._checkLatencyID),this._checkLatencyID=void 0),this._emitIntervalID&&(clearInterval(this._emitIntervalID),this._emitIntervalID=void 0)}},{key:"_emitSummary",value:function e(){var t=this.getSummary();t.events>0&&this.emit("data",t)}},{key:"getSummary",value:function e(){var t={events:this._latencyData.events,minMs:this._latencyData.minMs,maxMs:this._latencyData.maxMs,avgMs:this._latencyData.events?this._latencyData.totalMs/this._latencyData.events:Number.POSITIVE_INFINITY,lengthMs:this.getDeltaMS(this._latencyData.startTime)};return this._latencyData=this._initLatencyData(),g("Summary: %O",t),t}},{key:"_checkLatency",value:function e(){var t=this,r=this,n=Math.random()*r._latecyCheckMultiply-r._latecyCheckSubtract,i={deltaOffset:Math.ceil(r.latencyCheckIntervalMs+n),startTime:r.now()},o=function e(){if(t._checkLatencyID){var n=r.getDeltaMS(i.startTime)-i.deltaOffset;r._checkLatency(),r._latencyData.events++,r._latencyData.minMs=Math.min(r._latencyData.minMs,n),r._latencyData.maxMs=Math.max(r._latencyData.maxMs,n),r._latencyData.totalMs+=n,g("MS: %s Data: %O",n,r._latencyData)}};g("localData: %O",i),this._checkLatencyID=setTimeout(function(){r.asyncTestFn?(i.deltaOffset=0,i.startTime=r.now(),r.asyncTestFn(o)):(i.deltaOffset-=1,o())},i.deltaOffset),(0,c.default)(this._checkLatencyID.unref)&&this._checkLatencyID.unref()}},{key:"_initLatencyData",value:function e(){return{startTime:this.now(),minMs:Number.POSITIVE_INFINITY,maxMs:Number.NEGATIVE_INFINITY,events:0,totalMs:0}}}]),r}(o.default);function b(){return"undefined"!=typeof window}t.default=m}).call(this,r(6))},function(e,t,r){var n=r(1266),i=r(1299);function o(e,t){t=n(t,e);for(var r=0,o=t.length;null!=e&&r<o;)e=e[i(t[r++])];return r&&r==o?e:void 0}e.exports=o},function(e,t,r){var n=r(91),i=r(1267),o=r(1268),s=r(1297);function a(e,t){return n(e)?e:i(e,t)?[e]:o(s(e))}e.exports=a},function(e,t,r){var n=r(91),i=r(315),o=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,s=/^\w*$/;function a(e,t){if(n(e))return!1;var r=typeof e;return!("number"!=r&&"symbol"!=r&&"boolean"!=r&&null!=e&&!i(e))||(s.test(e)||!o.test(e)||null!=t&&e in Object(t))}e.exports=a},function(e,t,r){var n=r(1269),i=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,o=/\\(\\)?/g,s=n(function(e){var t=[];return 46===e.charCodeAt(0)&&t.push(""),e.replace(i,function(e,r,n,i){t.push(n?i.replace(o,"$1"):r||e)}),t});e.exports=s},function(e,t,r){var n=r(1270),i=500;function o(e){var t=n(e,function(e){return r.size===i&&r.clear(),e}),r=t.cache;return t}e.exports=o},function(e,t,r){var n=r(1271),i="Expected a function";function o(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new TypeError(i);var r=function(){var n=arguments,i=t?t.apply(this,n):n[0],o=r.cache;if(o.has(i))return o.get(i);var s=e.apply(this,n);return r.cache=o.set(i,s)||o,s};return r.cache=new(o.Cache||n),r}o.Cache=n,e.exports=o},function(e,t,r){var n=r(1272),i=r(1292),o=r(1294),s=r(1295),a=r(1296);function u(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}u.prototype.clear=n,u.prototype.delete=i,u.prototype.get=o,u.prototype.has=s,u.prototype.set=a,e.exports=u},function(e,t,r){var n=r(1273),i=r(1284),o=r(1291);function s(){this.size=0,this.__data__={hash:new n,map:new(o||i),string:new n}}e.exports=s},function(e,t,r){var n=r(1274),i=r(1280),o=r(1281),s=r(1282),a=r(1283);function u(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}u.prototype.clear=n,u.prototype.delete=i,u.prototype.get=o,u.prototype.has=s,u.prototype.set=a,e.exports=u},function(e,t,r){var n=r(194);function i(){this.__data__=n?n(null):{},this.size=0}e.exports=i},function(e,t,r){var n=r(214),i=r(1276),o=r(212),s=r(1278),a=/[\\^$.*+?()[\]{}|]/g,u=/^\[object .+?Constructor\]$/,c=Function.prototype,f=Object.prototype,l=c.toString,h=f.hasOwnProperty,p=RegExp("^"+l.call(h).replace(a,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function d(e){if(!o(e)||i(e))return!1;var t=n(e)?p:u;return t.test(s(e))}e.exports=d},function(e,t,r){var n=r(1277),i=(o=/[^.]+$/.exec(n&&n.keys&&n.keys.IE_PROTO||""),o?"Symbol(src)_1."+o:""),o;function s(e){return!!i&&i in e}e.exports=s},function(e,t,r){var n=r(158),i=n["__core-js_shared__"];e.exports=i},function(e,t){var r=Function.prototype,n=r.toString;function i(e){if(null!=e){try{return n.call(e)}catch(e){}try{return e+""}catch(e){}}return""}e.exports=i},function(e,t){function r(e,t){return null==e?void 0:e[t]}e.exports=r},function(e,t){function r(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}e.exports=r},function(e,t,r){var n=r(194),i="__lodash_hash_undefined__",o=Object.prototype,s=o.hasOwnProperty;function a(e){var t=this.__data__;if(n){var r=t[e];return r===i?void 0:r}return s.call(t,e)?t[e]:void 0}e.exports=a},function(e,t,r){var n=r(194),i=Object.prototype,o=i.hasOwnProperty;function s(e){var t=this.__data__;return n?void 0!==t[e]:o.call(t,e)}e.exports=s},function(e,t,r){var n=r(194),i="__lodash_hash_undefined__";function o(e,t){var r=this.__data__;return this.size+=this.has(e)?0:1,r[e]=n&&void 0===t?i:t,this}e.exports=o},function(e,t,r){var n=r(1285),i=r(1286),o=r(1288),s=r(1289),a=r(1290);function u(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}u.prototype.clear=n,u.prototype.delete=i,u.prototype.get=o,u.prototype.has=s,u.prototype.set=a,e.exports=u},function(e,t){function r(){this.__data__=[],this.size=0}e.exports=r},function(e,t,r){var n=r(195),i=Array.prototype,o=i.splice;function s(e){var t=this.__data__,r=n(t,e);if(r<0)return!1;var i=t.length-1;return r==i?t.pop():o.call(t,r,1),--this.size,!0}e.exports=s},function(e,t){function r(e,t){return e===t||e!=e&&t!=t}e.exports=r},function(e,t,r){var n=r(195);function i(e){var t=this.__data__,r=n(t,e);return r<0?void 0:t[r][1]}e.exports=i},function(e,t,r){var n=r(195);function i(e){return n(this.__data__,e)>-1}e.exports=i},function(e,t,r){var n=r(195);function i(e,t){var r=this.__data__,i=n(r,e);return i<0?(++this.size,r.push([e,t])):r[i][1]=t,this}e.exports=i},function(e,t,r){var n=r(570),i=r(158),o=n(i,"Map");e.exports=o},function(e,t,r){var n=r(196);function i(e){var t=n(this,e).delete(e);return this.size-=t?1:0,t}e.exports=i},function(e,t){function r(e){var t=typeof e;return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e}e.exports=r},function(e,t,r){var n=r(196);function i(e){return n(this,e).get(e)}e.exports=i},function(e,t,r){var n=r(196);function i(e){return n(this,e).has(e)}e.exports=i},function(e,t,r){var n=r(196);function i(e,t){var r=n(this,e),i=r.size;return r.set(e,t),this.size+=r.size==i?0:1,this}e.exports=i},function(e,t,r){var n=r(1298);function i(e){return null==e?"":n(e)}e.exports=i},function(e,t,r){var n=r(157),i=r(222),o=r(91),s=r(315),a=1/0,u=n?n.prototype:void 0,c=u?u.toString:void 0;function f(e){if("string"==typeof e)return e;if(o(e))return i(e,f)+"";if(s(e))return c?c.call(e):"";var t=e+"";return"0"==t&&1/e==-a?"-0":t}e.exports=f},function(e,t,r){var n=r(315),i=1/0;function o(e){if("string"==typeof e||n(e))return e;var t=e+"";return"0"==t&&1/e==-i?"-0":t}e.exports=o},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),i=r(10),o=s(i);function s(e){return e&&e.__esModule?e:{default:e}}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function u(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function c(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var f=r(571)("latency-monitor:VisibilityChangeEmitter"),l=function(e){function t(){a(this,t);var e=u(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));return"undefined"==typeof document?(f('This is not a browser, no "document" found. Stopping.'),u(e)):(e._initializeVisibilityVarNames(),e._addVisibilityChangeListener(),e)}return c(t,e),n(t,[{key:"_initializeVisibilityVarNames",value:function e(){var t=void 0,r=void 0;void 0!==document.hidden?(t="hidden",r="visibilitychange"):void 0!==document.mozHidden?(t="mozHidden",r="mozvisibilitychange"):void 0!==document.msHidden?(t="msHidden",r="msvisibilitychange"):void 0!==document.webkitHidden&&(t="webkitHidden",r="webkitvisibilitychange"),this._hidden=t,this._visibilityChange=r}},{key:"_addVisibilityChangeListener",value:function e(){void 0===document.addEventListener||void 0===document[this._hidden]?f("Checking page visibility requires a browser that supports the Page Visibility API."):document.addEventListener(this._visibilityChange,this._handleVisibilityChange.bind(this),!1)}},{key:"isVisible",value:function e(){if(void 0!==this._hidden&&void 0!==document[this._hidden])return!document[this._hidden]}},{key:"_handleVisibilityChange",value:function e(){var t=!document[this._hidden];f(t?"Page Visible":"Page Hidden"),this.emit("visibilityChange",t)}}]),t}(o.default);t.default=l},function(e,t,r){var n;function i(e){var r=0,n;for(n in e)r=(r<<5)-r+e.charCodeAt(n),r|=0;return t.colors[Math.abs(r)%t.colors.length]}function o(e){function r(){if(r.enabled){var e=r,i=+new Date,o=i-(n||i);e.diff=o,e.prev=n,e.curr=i,n=i;for(var s=new Array(arguments.length),a=0;a<s.length;a++)s[a]=arguments[a];s[0]=t.coerce(s[0]),"string"!=typeof s[0]&&s.unshift("%O");var u=0;s[0]=s[0].replace(/%([a-zA-Z%])/g,function(r,n){if("%%"===r)return r;u++;var i=t.formatters[n];if("function"==typeof i){var o=s[u];r=i.call(e,o),s.splice(u,1),u--}return r}),t.formatArgs.call(e,s);var c=r.log||t.log||console.log.bind(console);c.apply(e,s)}}return r.namespace=e,r.enabled=t.enabled(e),r.useColors=t.useColors(),r.color=i(e),"function"==typeof t.init&&t.init(r),r}function s(e){t.save(e),t.names=[],t.skips=[];for(var r=("string"==typeof e?e:"").split(/[\s,]+/),n=r.length,i=0;i<n;i++)r[i]&&(e=r[i].replace(/\*/g,".*?"),"-"===e[0]?t.skips.push(new RegExp("^"+e.substr(1)+"$")):t.names.push(new RegExp("^"+e+"$")))}function a(){t.enable("")}function u(e){var r,n;for(r=0,n=t.skips.length;r<n;r++)if(t.skips[r].test(e))return!1;for(r=0,n=t.names.length;r<n;r++)if(t.names[r].test(e))return!0;return!1}function c(e){return e instanceof Error?e.stack||e.message:e}t=e.exports=o.debug=o.default=o,t.coerce=c,t.disable=a,t.enable=s,t.enabled=u,t.humanize=r(206),t.names=[],t.skips=[],t.formatters={}},function(e,t,r){"use strict";e.exports=(e=>({findPeer:(t,r)=>{if(!e._dht)return r(new Error("DHT is not available"));e._dht.findPeer(t,r)}}))},function(e,t,r){"use strict";e.exports=(e=>({findProviders:(t,r,n)=>{if(!e._dht)return n(new Error("DHT is not available"));e._dht.findProviders(t,r,n)},provide:(t,r)=>{if(!e._dht)return r(new Error("DHT is not available"));e._dht.provide(t,r)}}))},function(e,t,r){"use strict";e.exports=(e=>({put:(t,r,n)=>{if(!e._dht)return n(new Error("DHT is not available"));e._dht.put(t,r,n)},get:(t,r)=>{if(!e._dht)return r(new Error("DHT is not available"));e._dht.get(t,r)},getMany(t,r,n){if(!e._dht)return n(new Error("DHT is not available"));e._dht.getMany(t,r,n)}}))},function(e,t,r){"use strict";(function(t){const n=r(3),i=r(1306).NOT_STARTED_YET,o=r(1307);e.exports=(e=>{const r=new o(e);return e._floodSub=r,{subscribe:(t,o,s,a)=>{if("function"==typeof o&&(a=s,s=o,o={}),!e.isStarted()&&!r.started)return n(()=>a(new Error(i)));function u(e){0===r.listenerCount(t)&&r.subscribe(t),r.on(t,s),n(e)}u(a)},unsubscribe:(t,n)=>{if(!e.isStarted()&&!r.started)throw new Error(i);r.removeListener(t,n),0===r.listenerCount(t)&&r.unsubscribe(t)},publish:(o,s,a)=>e.isStarted()||r.started?t.isBuffer(s)?(r.publish(o,s),void n(()=>a())):n(()=>a(new Error("data must be a Buffer"))):n(()=>a(new Error(i))),ls:t=>{if(!e.isStarted()&&!r.started)return n(()=>t(new Error(i)));const o=Array.from(r.subscriptions);n(()=>t(null,o))},peers:(t,o)=>{if(!e.isStarted()&&!r.started)return n(()=>o(new Error(i)));"function"==typeof t&&(o=t,t=null);const s=Array.from(r.peers.values()).filter(e=>!t||e.topics.has(t)).map(e=>e.info.id.toB58String());n(()=>o(null,s))},setMaxListeners:e=>r.setMaxListeners(e)}})}).call(this,r(0).Buffer)},function(e,t,r){"use strict";t.NOT_STARTED_YET="The libp2p node is not started yet"},function(e,t,r){"use strict";const n=r(10),i=r(1308),o=r(501),s=r(8),a=r(53),u=r(13),c=r(41),f=r(1310),l=r(1313),h=r(572),p=r(1314),d=r(2).Buffer,y=p.log,g=p.multicodec,m=l.ensureArray,b=r(3);class v extends n{constructor(e){super(),this.libp2p=e,this.started=!1,this.cache=new i,this.peers=new Map,this.subscriptions=new Set,this._onConnection=this._onConnection.bind(this),this._dialPeer=this._dialPeer.bind(this)}_addPeer(e){const t=e.info.id.toB58String();let r=this.peers.get(t);return r||(y("new peer",t),this.peers.set(t,e),r=e,e.once("close",()=>this._removePeer(e))),++r._references,r}_removePeer(e){const t=e.info.id.toB58String();return y("remove",t,e._references),0==--e._references&&(y("delete peer",t),this.peers.delete(t)),e}_dialPeer(e,t){t=t||function e(){};const r=e.id.toB58String(),n=this.peers.get(r);if(n&&n.isConnected)return b(()=>t());y("dialing %s",r),this.libp2p.dialProtocol(e,g,(r,n)=>{if(r)return y.err(r),t();this._onDial(e,n,t)})}_onDial(e,t,r){const n=e.id.toB58String();y("connected",n);const i=this._addPeer(new f(e));i.attachConnection(t),i.sendSubscriptions(this.subscriptions),b(()=>r())}_onConnection(e,t){t.getPeerInfo((e,r)=>{if(e)return y.err("Failed to identify incomming conn",e),s(s.empty(),t);const n=r.id.toB58String(),i=this._addPeer(new f(r));this._processConnection(n,t,i)})}_processConnection(e,t,r){s(t,a.decode(),s.map(e=>h.rpc.RPC.decode(e)),s.drain(t=>this._onRpc(e,t),t=>this._onConnectionEnd(e,r,t)))}_onRpc(e,t){if(!t)return;y("rpc from",e);const r=t.subscriptions,n=t.msgs;if(n&&n.length&&this._processRpcMessages(l.normalizeInRpcMessages(t.msgs)),r&&r.length){const t=this.peers.get(e);t&&t.updateSubscriptions(r)}}_processRpcMessages(e){e.forEach(e=>{const t=l.msgId(e.from,e.seqno.toString());this.cache.has(t)||(this.cache.put(t),this._emitMessages(e.topicIDs,[e]),this._forwardMessages(e.topicIDs,[e]))})}_onConnectionEnd(e,t,r){r&&"socket hang up"!==r.message&&y.err(r),y("connection ended",e,r?r.message:""),this._removePeer(t)}_emitMessages(e,t){e.forEach(e=>{this.subscriptions.has(e)&&t.forEach(t=>{this.emit(e,t)})})}_forwardMessages(e,t){this.peers.forEach(r=>{r.isWritable&&l.anyMatch(r.topics,e)&&(r.sendMessages(l.normalizeOutRpcMessages(t)),y("publish msgs on topics",e,r.info.id.toB58String()))})}start(e){if(this.started)return b(()=>e(new Error("already started")));this.libp2p.handle(g,this._onConnection),this.libp2p.on("peer:connect",this._dialPeer);const t=o(this.libp2p.peerBook.getAll());c(t,(e,t)=>this._dialPeer(e,t),t=>{b(()=>{this.started=!0,e(t)})})}stop(e){if(!this.started)return b(()=>e(new Error("not started yet")));this.libp2p.unhandle(g),this.libp2p.removeListener("peer:connect",this._dialPeer),y("stopping"),c(this.peers.values(),(e,t)=>e.close(t),t=>{if(t)return e(t);y("stopped"),this.peers=new Map,this.subscriptions=new Set,this.started=!1,e()})}publish(e,t){u(this.started,"FloodSub is not started"),y("publish",e,t),e=m(e),t=m(t);const r=this.libp2p.peerInfo.id.toB58String(),n=t=>{const n=l.randomSeqno();return this.cache.put(l.msgId(r,n)),{from:r,data:t,seqno:new d(n),topicIDs:e}},i=t.map(n);this._emitMessages(e,i),this._forwardMessages(e,i)}subscribe(e){function t(r){if(r&&r.isWritable)return r.sendSubscriptions(e);const n=()=>{r.removeListener("connection",n),t(r)};r.on("connection",n),r.once("close",()=>r.removeListener("connection",n))}u(this.started,"FloodSub is not started"),e=m(e),e.forEach(e=>this.subscriptions.add(e)),this.peers.forEach(e=>t(e))}unsubscribe(e){function t(r){r&&r.isWritable?r.sendUnsubscriptions(e):b(t.bind(r))}this.started&&(e=m(e),e.forEach(e=>this.subscriptions.delete(e)),this.peers.forEach(e=>t(e)))}}e.exports=v},function(e,t,r){"use strict";const n=r(1309);function i(e){if(!(this instanceof i))return new i(e);e=e||{};const t=e.validity||30,r=new Map,s=n(()=>{r.forEach((e,n)=>{const i=e.validity||t,s=o(e.timestamp);s>i&&r.delete(n)})},200);this.put=((e,t,n)=>{this.has(e)||r.set(e,{value:t,timestamp:new Date,validity:n}),s()}),this.get=(e=>{if(r.has(e))return r.get(e).value;throw new Error("key does not exist")}),this.has=(e=>r.has(e))}function o(e){const t=new Date,r=t.getTime()-e.getTime();return Math.floor(r/1e3)}t=e.exports=i},function(e,t,r){(function(t){var r="Expected a function",n=NaN,i="[object Symbol]",o=/^\s+|\s+$/g,s=/^[-+]0x[0-9a-f]+$/i,a=/^0b[01]+$/i,u=/^0o[0-7]+$/i,c=parseInt,f="object"==typeof t&&t&&t.Object===Object&&t,l="object"==typeof self&&self&&self.Object===Object&&self,h=f||l||Function("return this")(),p=Object.prototype,d=p.toString,y=Math.max,g=Math.min,m=function(){return h.Date.now()};function b(e,t,n){var i,o,s,a,u,c,f=0,l=!1,h=!1,p=!0;if("function"!=typeof e)throw new TypeError(r);function d(t){var r=i,n=o;return i=o=void 0,f=t,a=e.apply(n,r),a}function b(e){return f=e,u=setTimeout(S,t),l?d(e):a}function v(e){var r=e-c,n=e-f,i=t-r;return h?g(i,s-n):i}function w(e){var r=e-c,n=e-f;return void 0===c||r>=t||r<0||h&&n>=s}function S(){var e=m();if(w(e))return E(e);u=setTimeout(S,v(e))}function E(e){return u=void 0,p&&i?d(e):(i=o=void 0,a)}function A(){void 0!==u&&clearTimeout(u),f=0,i=c=o=u=void 0}function x(){return void 0===u?a:E(m())}function I(){var e=m(),r=w(e);if(i=arguments,o=this,c=e,r){if(void 0===u)return b(c);if(h)return u=setTimeout(S,t),d(c)}return void 0===u&&(u=setTimeout(S,t)),a}return t=k(t)||0,_(n)&&(l=!!n.leading,h="maxWait"in n,s=h?y(k(n.maxWait)||0,t):s,p="trailing"in n?!!n.trailing:p),I.cancel=A,I.flush=x,I}function v(e,t,n){var i=!0,o=!0;if("function"!=typeof e)throw new TypeError(r);return _(n)&&(i="leading"in n?!!n.leading:i,o="trailing"in n?!!n.trailing:o),b(e,t,{leading:i,maxWait:t,trailing:o})}function _(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function w(e){return!!e&&"object"==typeof e}function S(e){return"symbol"==typeof e||w(e)&&d.call(e)==i}function k(e){if("number"==typeof e)return e;if(S(e))return n;if(_(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=_(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=e.replace(o,"");var r=a.test(e);return r||u.test(e)?c(e.slice(2),r?2:8):s.test(e)?n:+e}e.exports=v}).call(this,r(7))},function(e,t,r){"use strict";const n=r(53),i=r(43),o=r(8),s=r(3),a=r(10),u=r(572).rpc.RPC;class c extends a{constructor(e){super(),this.info=e,this.conn=null,this.topics=new Set,this.stream=null,this._references=0}get isConnected(){return Boolean(this.conn)}get isWritable(){return Boolean(this.stream)}write(e){if(!this.isWritable){const e=this.info.id.toB58String();throw new Error("No writable connection to "+e)}this.stream.push(e)}attachConnection(e){this.conn=e,this.stream=new i,o(this.stream,n.encode(),e,o.onEnd(()=>{this.conn=null,this.stream=null,this.emit("close")})),this.emit("connection")}_sendRawSubscriptions(e,t){if(0===e.size)return;const r=[];e.forEach(e=>{r.push({subscribe:t,topicCID:e})}),this.write(u.encode({subscriptions:r}))}sendSubscriptions(e){this._sendRawSubscriptions(e,!0)}sendUnsubscriptions(e){this._sendRawSubscriptions(e,!1)}sendMessages(e){this.write(u.encode({msgs:e}))}updateSubscriptions(e){e.forEach(e=>{e.subscribe?this.topics.add(e.topicCID):this.topics.delete(e.topicCID)})}close(e){this._references=1,this.stream&&this.stream.end(),s(()=>{this.conn=null,this.stream=null,this.emit("close"),e()})}}e.exports=c},function(e,t,r){"use strict";e.exports="\nmessage RPC {\n repeated SubOpts subscriptions = 1;\n repeated Message msgs = 2;\n\n message SubOpts {\n optional bool subscribe = 1; // subscribe or unsubcribe\n optional string topicCID = 2;\n }\n\n message Message {\n optional bytes from = 1;\n optional bytes data = 2;\n optional bytes seqno = 3;\n repeated string topicIDs = 4; \n }\n}"},function(e,t,r){"use strict";e.exports="\n// topicCID = cid(merkledag_protobuf(topicDescriptor)); (not the topic.name)\nmessage TopicDescriptor {\n optional string name = 1;\n optional AuthOpts auth = 2;\n optional EncOpts enc = 2;\n\n message AuthOpts {\n optional AuthMode mode = 1;\n repeated bytes keys = 2; // root keys to trust\n\n enum AuthMode {\n NONE = 0; // no authentication, anyone can publish\n KEY = 1; // only messages signed by keys in the topic descriptor are accepted\n WOT = 2; // web of trust, certificates can allow publisher set to grow\n }\n }\n\n message EncOpts {\n optional EncMode mode = 1;\n repeated bytes keyHashes = 2; // the hashes of the shared keys used (salted)\n\n enum EncMode {\n NONE = 0; // no encryption, anyone can read\n SHAREDKEY = 1; // messages are encrypted with shared key\n WOT = 2; // web of trust, certificates can allow publisher set to grow\n }\n }\n}"},function(e,t,r){"use strict";(function(n){const i=r(113),o=r(18);t=e.exports,t.randomSeqno=(()=>i.randomBytes(20).toString("hex")),t.msgId=((e,t)=>e+t),t.anyMatch=((e,t)=>{let r;r=Array.isArray(t)?e=>t.indexOf(e)>-1:e=>t.has(e);for(let t of e)if(r(t))return!0;return!1}),t.ensureArray=(e=>Array.isArray(e)?e:[e]),t.normalizeInRpcMessages=(e=>e?e.map(e=>{const t=Object.assign({},e);return n.isBuffer(e.from)&&(t.from=o.encode(e.from)),t}):e),t.normalizeOutRpcMessages=(e=>e?e.map(e=>{const t=Object.assign({},e);return("string"==typeof e.from||e.from instanceof String)&&(t.from=o.decode(e.from)),t}):e)}).call(this,r(0).Buffer)},function(e,t,r){"use strict";const n=r(1),i=n("libp2p:floodsub");i.err=n("libp2p:floodsub:error"),e.exports={log:i,multicodec:"/floodsub/1.0.0"}},function(e,t,r){"use strict";const n=r(68),i=r(52),o=r(31),s=r(3);e.exports=(e=>(function(t,r){let a;if(i.isPeerInfo(t))a=t;else if(o.isMultiaddr(t)||"string"==typeof t){if("string"==typeof t)try{t=o(t)}catch(e){return s(()=>r(e))}const u=t.getPeerId();if(!u)return s(()=>{r(new Error("peer multiaddr instance or string must include peerId"))});try{a=e.peerBook.get(u)}catch(e){a=new i(n.createFromB58String(u))}a.multiaddrs.add(t)}else{if(!n.isPeerId(t))return s(()=>r(new Error("peer type not recognized")));{const n=t.toB58String();try{a=e.peerBook.get(n)}catch(n){return e.peerRouting.findPeer(t,r)}}}s(()=>r(null,a))}))},function(e,t,r){"use strict";const n=r(489),i=n.alternatives().try(n.func(),n.object()),o=n.object({connectionManager:n.object(),peerInfo:n.object().required(),peerBook:n.object(),modules:n.object().keys({transport:n.array().items(i).min(1).required(),streamMuxer:n.array().items(i).allow(null),connEncryption:n.array().items(i).allow(null),connProtector:n.object().keys({protect:n.func().required()}).unknown(),peerDiscovery:n.array().items(i).allow(null),dht:i.allow(null)}).required(),config:n.object().keys({peerDiscovery:n.object().allow(null),relay:n.object().keys({enabled:n.boolean().default(!1),hop:n.object().keys({enabled:n.boolean().default(!1),active:n.boolean().default(!1)})}).default(),dht:n.object().keys({kBucketSize:n.number().allow(null)}),EXPERIMENTAL:n.object().keys({dht:n.boolean().default(!1),pubsub:n.boolean().default(!1)}).default()}).default()});e.exports.validate=(e=>(e=n.attempt(e,o),e.config.EXPERIMENTAL.dht&&n.assert(e.modules.dht,i.required()),e))},function(e,t,r){(function(e,n){var i;
|
||
/**
|
||
* @license
|
||
* Lodash <https://lodash.com/>
|
||
* Copyright JS Foundation and other contributors <https://js.foundation/>
|
||
* Released under MIT license <https://lodash.com/license>
|
||
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
|
||
* Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
|
||
*/(function(){var o,s="4.17.10",a=200,u="Unsupported core-js use. Try https://npms.io/search?q=ponyfill.",c="Expected a function",f="__lodash_hash_undefined__",l=500,h="__lodash_placeholder__",p=1,d=2,y=4,g=1,m=2,b=1,v=2,_=4,w=8,S=16,k=32,E=64,A=128,x=256,I=512,T=30,B="...",C=800,P=16,O=1,R=2,N=3,L=1/0,j=9007199254740991,M=1.7976931348623157e308,K=NaN,D=4294967295,U=D-1,F=D>>>1,q=[["ary",A],["bind",b],["bindKey",v],["curry",w],["curryRight",S],["flip",I],["partial",k],["partialRight",E],["rearg",x]],H="[object Arguments]",z="[object Array]",V="[object AsyncFunction]",G="[object Boolean]",W="[object Date]",$="[object DOMException]",Y="[object Error]",J="[object Function]",X="[object GeneratorFunction]",Z="[object Map]",Q="[object Number]",ee="[object Null]",te="[object Object]",re="[object Promise]",ne="[object Proxy]",ie="[object RegExp]",oe="[object Set]",se="[object String]",ae="[object Symbol]",ue="[object Undefined]",ce="[object WeakMap]",fe="[object WeakSet]",le="[object ArrayBuffer]",he="[object DataView]",pe="[object Float32Array]",de="[object Float64Array]",ye="[object Int8Array]",ge="[object Int16Array]",me="[object Int32Array]",be="[object Uint8Array]",ve="[object Uint8ClampedArray]",_e="[object Uint16Array]",we="[object Uint32Array]",Se=/\b__p \+= '';/g,ke=/\b(__p \+=) '' \+/g,Ee=/(__e\(.*?\)|\b__t\)) \+\n'';/g,Ae=/&(?:amp|lt|gt|quot|#39);/g,xe=/[&<>"']/g,Ie=RegExp(Ae.source),Te=RegExp(xe.source),Be=/<%-([\s\S]+?)%>/g,Ce=/<%([\s\S]+?)%>/g,Pe=/<%=([\s\S]+?)%>/g,Oe=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Re=/^\w*$/,Ne=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Le=/[\\^$.*+?()[\]{}|]/g,je=RegExp(Le.source),Me=/^\s+|\s+$/g,Ke=/^\s+/,De=/\s+$/,Ue=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,Fe=/\{\n\/\* \[wrapped with (.+)\] \*/,qe=/,? & /,He=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,ze=/\\(\\)?/g,Ve=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,Ge=/\w*$/,We=/^[-+]0x[0-9a-f]+$/i,$e=/^0b[01]+$/i,Ye=/^\[object .+?Constructor\]$/,Je=/^0o[0-7]+$/i,Xe=/^(?:0|[1-9]\d*)$/,Ze=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,Qe=/($^)/,et=/['\n\r\u2028\u2029\\]/g,tt="\\ud800-\\udfff",rt="\\u0300-\\u036f",nt="\\ufe20-\\ufe2f",it="\\u20d0-\\u20ff",ot="\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff",st="\\u2700-\\u27bf",at="a-z\\xdf-\\xf6\\xf8-\\xff",ut="\\xac\\xb1\\xd7\\xf7",ct="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",ft="\\u2000-\\u206f",lt=" \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",ht="A-Z\\xc0-\\xd6\\xd8-\\xde",pt="\\ufe0e\\ufe0f",dt=ut+ct+"\\u2000-\\u206f"+lt,yt="['’]",gt="[\\ud800-\\udfff]",mt="["+dt+"]",bt="["+ot+"]",vt="\\d+",_t="[\\u2700-\\u27bf]",wt="["+at+"]",St="[^"+tt+dt+vt+st+at+ht+"]",kt="\\ud83c[\\udffb-\\udfff]",Et="(?:"+bt+"|"+kt+")",At="[^\\ud800-\\udfff]",xt="(?:\\ud83c[\\udde6-\\uddff]){2}",It="[\\ud800-\\udbff][\\udc00-\\udfff]",Tt="["+ht+"]",Bt="\\u200d",Ct="(?:"+wt+"|"+St+")",Pt="(?:"+Tt+"|"+St+")",Ot="(?:['’](?:d|ll|m|re|s|t|ve))?",Rt="(?:['’](?:D|LL|M|RE|S|T|VE))?",Nt=Et+"?",Lt="[\\ufe0e\\ufe0f]?",jt="(?:\\u200d(?:"+[At,xt,It].join("|")+")"+Lt+Nt+")*",Mt="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Kt="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",Dt=Lt+Nt+jt,Ut="(?:"+[_t,xt,It].join("|")+")"+Dt,Ft="(?:"+[At+bt+"?",bt,xt,It,gt].join("|")+")",qt=RegExp("['’]","g"),Ht=RegExp(bt,"g"),zt=RegExp(kt+"(?="+kt+")|"+Ft+Dt,"g"),Vt=RegExp([Tt+"?"+wt+"+"+Ot+"(?="+[mt,Tt,"$"].join("|")+")",Pt+"+"+Rt+"(?="+[mt,Tt+Ct,"$"].join("|")+")",Tt+"?"+Ct+"+"+Ot,Tt+"+"+Rt,Kt,Mt,vt,Ut].join("|"),"g"),Gt=RegExp("["+Bt+tt+ot+pt+"]"),Wt=/[a-z][A-Z]|[A-Z]{2,}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,$t=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],Yt=-1,Jt={};Jt[pe]=Jt[de]=Jt[ye]=Jt[ge]=Jt[me]=Jt[be]=Jt[ve]=Jt[_e]=Jt[we]=!0,Jt[H]=Jt[z]=Jt[le]=Jt[G]=Jt[he]=Jt[W]=Jt[Y]=Jt[J]=Jt[Z]=Jt[Q]=Jt[te]=Jt[ie]=Jt[oe]=Jt[se]=Jt[ce]=!1;var Xt={};Xt[H]=Xt[z]=Xt[le]=Xt[he]=Xt[G]=Xt[W]=Xt[pe]=Xt[de]=Xt[ye]=Xt[ge]=Xt[me]=Xt[Z]=Xt[Q]=Xt[te]=Xt[ie]=Xt[oe]=Xt[se]=Xt[ae]=Xt[be]=Xt[ve]=Xt[_e]=Xt[we]=!0,Xt[Y]=Xt[J]=Xt[ce]=!1;var Zt={"À":"A","Á":"A","Â":"A","Ã":"A","Ä":"A","Å":"A","à":"a","á":"a","â":"a","ã":"a","ä":"a","å":"a","Ç":"C","ç":"c","Ð":"D","ð":"d","È":"E","É":"E","Ê":"E","Ë":"E","è":"e","é":"e","ê":"e","ë":"e","Ì":"I","Í":"I","Î":"I","Ï":"I","ì":"i","í":"i","î":"i","ï":"i","Ñ":"N","ñ":"n","Ò":"O","Ó":"O","Ô":"O","Õ":"O","Ö":"O","Ø":"O","ò":"o","ó":"o","ô":"o","õ":"o","ö":"o","ø":"o","Ù":"U","Ú":"U","Û":"U","Ü":"U","ù":"u","ú":"u","û":"u","ü":"u","Ý":"Y","ý":"y","ÿ":"y","Æ":"Ae","æ":"ae","Þ":"Th","þ":"th","ß":"ss","Ā":"A","Ă":"A","Ą":"A","ā":"a","ă":"a","ą":"a","Ć":"C","Ĉ":"C","Ċ":"C","Č":"C","ć":"c","ĉ":"c","ċ":"c","č":"c","Ď":"D","Đ":"D","ď":"d","đ":"d","Ē":"E","Ĕ":"E","Ė":"E","Ę":"E","Ě":"E","ē":"e","ĕ":"e","ė":"e","ę":"e","ě":"e","Ĝ":"G","Ğ":"G","Ġ":"G","Ģ":"G","ĝ":"g","ğ":"g","ġ":"g","ģ":"g","Ĥ":"H","Ħ":"H","ĥ":"h","ħ":"h","Ĩ":"I","Ī":"I","Ĭ":"I","Į":"I","İ":"I","ĩ":"i","ī":"i","ĭ":"i","į":"i","ı":"i","Ĵ":"J","ĵ":"j","Ķ":"K","ķ":"k","ĸ":"k","Ĺ":"L","Ļ":"L","Ľ":"L","Ŀ":"L","Ł":"L","ĺ":"l","ļ":"l","ľ":"l","ŀ":"l","ł":"l","Ń":"N","Ņ":"N","Ň":"N","Ŋ":"N","ń":"n","ņ":"n","ň":"n","ŋ":"n","Ō":"O","Ŏ":"O","Ő":"O","ō":"o","ŏ":"o","ő":"o","Ŕ":"R","Ŗ":"R","Ř":"R","ŕ":"r","ŗ":"r","ř":"r","Ś":"S","Ŝ":"S","Ş":"S","Š":"S","ś":"s","ŝ":"s","ş":"s","š":"s","Ţ":"T","Ť":"T","Ŧ":"T","ţ":"t","ť":"t","ŧ":"t","Ũ":"U","Ū":"U","Ŭ":"U","Ů":"U","Ű":"U","Ų":"U","ũ":"u","ū":"u","ŭ":"u","ů":"u","ű":"u","ų":"u","Ŵ":"W","ŵ":"w","Ŷ":"Y","ŷ":"y","Ÿ":"Y","Ź":"Z","Ż":"Z","Ž":"Z","ź":"z","ż":"z","ž":"z","IJ":"IJ","ij":"ij","Œ":"Oe","œ":"oe","ʼn":"'n","ſ":"s"},Qt={"&":"&","<":"<",">":">",'"':""","'":"'"},er={"&":"&","<":"<",">":">",""":'"',"'":"'"},tr={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},rr=parseFloat,nr=parseInt,ir="object"==typeof e&&e&&e.Object===Object&&e,or="object"==typeof self&&self&&self.Object===Object&&self,sr=ir||or||Function("return this")(),ar="object"==typeof t&&t&&!t.nodeType&&t,ur=ar&&"object"==typeof n&&n&&!n.nodeType&&n,cr=ur&&ur.exports===ar,fr=cr&&ir.process,lr=function(){try{var e=ur&&ur.require&&ur.require("util").types;return e||fr&&fr.binding&&fr.binding("util")}catch(e){}}(),hr=lr&&lr.isArrayBuffer,pr=lr&&lr.isDate,dr=lr&&lr.isMap,yr=lr&&lr.isRegExp,gr=lr&&lr.isSet,mr=lr&&lr.isTypedArray;function br(e,t,r){switch(r.length){case 0:return e.call(t);case 1:return e.call(t,r[0]);case 2:return e.call(t,r[0],r[1]);case 3:return e.call(t,r[0],r[1],r[2])}return e.apply(t,r)}function vr(e,t,r,n){for(var i=-1,o=null==e?0:e.length;++i<o;){var s=e[i];t(n,s,r(s),e)}return n}function _r(e,t){for(var r=-1,n=null==e?0:e.length;++r<n&&!1!==t(e[r],r,e););return e}function wr(e,t){for(var r=null==e?0:e.length;r--&&!1!==t(e[r],r,e););return e}function Sr(e,t){for(var r=-1,n=null==e?0:e.length;++r<n;)if(!t(e[r],r,e))return!1;return!0}function kr(e,t){for(var r=-1,n=null==e?0:e.length,i=0,o=[];++r<n;){var s=e[r];t(s,r,e)&&(o[i++]=s)}return o}function Er(e,t){var r=null==e?0:e.length;return!!r&&jr(e,t,0)>-1}function Ar(e,t,r){for(var n=-1,i=null==e?0:e.length;++n<i;)if(r(t,e[n]))return!0;return!1}function xr(e,t){for(var r=-1,n=null==e?0:e.length,i=Array(n);++r<n;)i[r]=t(e[r],r,e);return i}function Ir(e,t){for(var r=-1,n=t.length,i=e.length;++r<n;)e[i+r]=t[r];return e}function Tr(e,t,r,n){var i=-1,o=null==e?0:e.length;for(n&&o&&(r=e[++i]);++i<o;)r=t(r,e[i],i,e);return r}function Br(e,t,r,n){var i=null==e?0:e.length;for(n&&i&&(r=e[--i]);i--;)r=t(r,e[i],i,e);return r}function Cr(e,t){for(var r=-1,n=null==e?0:e.length;++r<n;)if(t(e[r],r,e))return!0;return!1}var Pr=Ur("length");function Or(e){return e.split("")}function Rr(e){return e.match(He)||[]}function Nr(e,t,r){var n;return r(e,function(e,r,i){if(t(e,r,i))return n=r,!1}),n}function Lr(e,t,r,n){for(var i=e.length,o=r+(n?1:-1);n?o--:++o<i;)if(t(e[o],o,e))return o;return-1}function jr(e,t,r){return t==t?pn(e,t,r):Lr(e,Kr,r)}function Mr(e,t,r,n){for(var i=r-1,o=e.length;++i<o;)if(n(e[i],t))return i;return-1}function Kr(e){return e!=e}function Dr(e,t){var r=null==e?0:e.length;return r?zr(e,t)/r:K}function Ur(e){return function(t){return null==t?o:t[e]}}function Fr(e){return function(t){return null==e?o:e[t]}}function qr(e,t,r,n,i){return i(e,function(e,i,o){r=n?(n=!1,e):t(r,e,i,o)}),r}function Hr(e,t){var r=e.length;for(e.sort(t);r--;)e[r]=e[r].value;return e}function zr(e,t){for(var r,n=-1,i=e.length;++n<i;){var s=t(e[n]);s!==o&&(r=r===o?s:r+s)}return r}function Vr(e,t){for(var r=-1,n=Array(e);++r<e;)n[r]=t(r);return n}function Gr(e,t){return xr(t,function(t){return[t,e[t]]})}function Wr(e){return function(t){return e(t)}}function $r(e,t){return xr(t,function(t){return e[t]})}function Yr(e,t){return e.has(t)}function Jr(e,t){for(var r=-1,n=e.length;++r<n&&jr(t,e[r],0)>-1;);return r}function Xr(e,t){for(var r=e.length;r--&&jr(t,e[r],0)>-1;);return r}function Zr(e,t){for(var r=e.length,n=0;r--;)e[r]===t&&++n;return n}var Qr=Fr(Zt),en=Fr(Qt);function tn(e){return"\\"+tr[e]}function rn(e,t){return null==e?o:e[t]}function nn(e){return Gt.test(e)}function on(e){return Wt.test(e)}function sn(e){for(var t,r=[];!(t=e.next()).done;)r.push(t.value);return r}function an(e){var t=-1,r=Array(e.size);return e.forEach(function(e,n){r[++t]=[n,e]}),r}function un(e,t){return function(r){return e(t(r))}}function cn(e,t){for(var r=-1,n=e.length,i=0,o=[];++r<n;){var s=e[r];s!==t&&s!==h||(e[r]=h,o[i++]=r)}return o}function fn(e,t){return"__proto__"==t?o:e[t]}function ln(e){var t=-1,r=Array(e.size);return e.forEach(function(e){r[++t]=e}),r}function hn(e){var t=-1,r=Array(e.size);return e.forEach(function(e){r[++t]=[e,e]}),r}function pn(e,t,r){for(var n=r-1,i=e.length;++n<i;)if(e[n]===t)return n;return-1}function dn(e,t,r){for(var n=r+1;n--;)if(e[n]===t)return n;return n}function yn(e){return nn(e)?bn(e):Pr(e)}function gn(e){return nn(e)?vn(e):Or(e)}var mn=Fr(er);function bn(e){for(var t=zt.lastIndex=0;zt.test(e);)++t;return t}function vn(e){return e.match(zt)||[]}function _n(e){return e.match(Vt)||[]}var wn=function e(t){t=null==t?sr:Sn.defaults(sr.Object(),t,Sn.pick(sr,$t));var r=t.Array,n=t.Date,i=t.Error,N=t.Function,He=t.Math,tt=t.Object,rt=t.RegExp,nt=t.String,it=t.TypeError,ot=r.prototype,st=N.prototype,at=tt.prototype,ut=t["__core-js_shared__"],ct=st.toString,ft=at.hasOwnProperty,lt=0,ht=(pt=/[^.]+$/.exec(ut&&ut.keys&&ut.keys.IE_PROTO||""),pt?"Symbol(src)_1."+pt:""),pt,dt=at.toString,yt=ct.call(tt),gt=sr._,mt=rt("^"+ct.call(ft).replace(Le,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),bt=cr?t.Buffer:o,vt=t.Symbol,_t=t.Uint8Array,wt=bt?bt.allocUnsafe:o,St=un(tt.getPrototypeOf,tt),kt=tt.create,Et=at.propertyIsEnumerable,At=ot.splice,xt=vt?vt.isConcatSpreadable:o,It=vt?vt.iterator:o,Tt=vt?vt.toStringTag:o,Bt=function(){try{var e=Gs(tt,"defineProperty");return e({},"",{}),e}catch(e){}}(),Ct=t.clearTimeout!==sr.clearTimeout&&t.clearTimeout,Pt=n&&n.now!==sr.Date.now&&n.now,Ot=t.setTimeout!==sr.setTimeout&&t.setTimeout,Rt=He.ceil,Nt=He.floor,Lt=tt.getOwnPropertySymbols,jt=bt?bt.isBuffer:o,Mt=t.isFinite,Kt=ot.join,Dt=un(tt.keys,tt),Ut=He.max,Ft=He.min,zt=n.now,Vt=t.parseInt,Gt=He.random,Wt=ot.reverse,Zt=Gs(t,"DataView"),Qt=Gs(t,"Map"),er=Gs(t,"Promise"),tr=Gs(t,"Set"),ir=Gs(t,"WeakMap"),or=Gs(tt,"create"),ar=ir&&new ir,ur={},fr=Ca(Zt),lr=Ca(Qt),Pr=Ca(er),Or=Ca(tr),Fr=Ca(ir),pn=vt?vt.prototype:o,bn=pn?pn.valueOf:o,vn=pn?pn.toString:o;function wn(e){if(Ef(e)&&!af(e)&&!(e instanceof xn)){if(e instanceof An)return e;if(ft.call(e,"__wrapped__"))return Oa(e)}return new An(e)}var kn=function(){function e(){}return function(t){if(!kf(t))return{};if(kt)return kt(t);e.prototype=t;var r=new e;return e.prototype=o,r}}();function En(){}function An(e,t){this.__wrapped__=e,this.__actions__=[],this.__chain__=!!t,this.__index__=0,this.__values__=o}function xn(e){this.__wrapped__=e,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=D,this.__views__=[]}function In(){var e=new xn(this.__wrapped__);return e.__actions__=ns(this.__actions__),e.__dir__=this.__dir__,e.__filtered__=this.__filtered__,e.__iteratees__=ns(this.__iteratees__),e.__takeCount__=this.__takeCount__,e.__views__=ns(this.__views__),e}function Tn(){if(this.__filtered__){var e=new xn(this);e.__dir__=-1,e.__filtered__=!0}else e=this.clone(),e.__dir__*=-1;return e}function Bn(){var e=this.__wrapped__.value(),t=this.__dir__,r=af(e),n=t<0,i=r?e.length:0,o=Xs(0,i,this.__views__),s=o.start,a=o.end,u=a-s,c=n?a:s-1,f=this.__iteratees__,l=f.length,h=0,p=Ft(u,this.__takeCount__);if(!r||!n&&i==u&&p==u)return Ko(e,this.__actions__);var d=[];e:for(;u--&&h<p;){c+=t;for(var y=-1,g=e[c];++y<l;){var m=f[y],b=m.iteratee,v=m.type,_=b(g);if(v==R)g=_;else if(!_){if(v==O)continue e;break e}}d[h++]=g}return d}function Cn(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}function Pn(){this.__data__=or?or(null):{},this.size=0}function On(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}function Rn(e){var t=this.__data__;if(or){var r=t[e];return r===f?o:r}return ft.call(t,e)?t[e]:o}function Nn(e){var t=this.__data__;return or?t[e]!==o:ft.call(t,e)}function Ln(e,t){var r=this.__data__;return this.size+=this.has(e)?0:1,r[e]=or&&t===o?f:t,this}function jn(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}function Mn(){this.__data__=[],this.size=0}function Kn(e){var t=this.__data__,r=ci(t,e);if(r<0)return!1;var n=t.length-1;return r==n?t.pop():At.call(t,r,1),--this.size,!0}function Dn(e){var t=this.__data__,r=ci(t,e);return r<0?o:t[r][1]}function Un(e){return ci(this.__data__,e)>-1}function Fn(e,t){var r=this.__data__,n=ci(r,e);return n<0?(++this.size,r.push([e,t])):r[n][1]=t,this}function qn(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}function Hn(){this.size=0,this.__data__={hash:new Cn,map:new(Qt||jn),string:new Cn}}function zn(e){var t=zs(this,e).delete(e);return this.size-=t?1:0,t}function Vn(e){return zs(this,e).get(e)}function Gn(e){return zs(this,e).has(e)}function Wn(e,t){var r=zs(this,e),n=r.size;return r.set(e,t),this.size+=r.size==n?0:1,this}function $n(e){var t=-1,r=null==e?0:e.length;for(this.__data__=new qn;++t<r;)this.add(e[t])}function Yn(e){return this.__data__.set(e,f),this}function Jn(e){return this.__data__.has(e)}function Xn(e){var t=this.__data__=new jn(e);this.size=t.size}function Zn(){this.__data__=new jn,this.size=0}function Qn(e){var t=this.__data__,r=t.delete(e);return this.size=t.size,r}function ei(e){return this.__data__.get(e)}function ti(e){return this.__data__.has(e)}function ri(e,t){var r=this.__data__;if(r instanceof jn){var n=r.__data__;if(!Qt||n.length<a-1)return n.push([e,t]),this.size=++r.size,this;r=this.__data__=new qn(n)}return r.set(e,t),this.size=r.size,this}function ni(e,t){var r=af(e),n=!r&&sf(e),i=!r&&!n&&hf(e),o=!r&&!n&&!i&&Df(e),s=r||n||i||o,a=s?Vr(e.length,nt):[],u=a.length;for(var c in e)!t&&!ft.call(e,c)||s&&("length"==c||i&&("offset"==c||"parent"==c)||o&&("buffer"==c||"byteLength"==c||"byteOffset"==c)||oa(c,u))||a.push(c);return a}function ii(e){var t=e.length;return t?e[mo(0,t-1)]:o}function oi(e,t){return Ia(ns(e),yi(t,0,e.length))}function si(e){return Ia(ns(e))}function ai(e,t,r){(r===o||rf(e[t],r))&&(r!==o||t in e)||pi(e,t,r)}function ui(e,t,r){var n=e[t];ft.call(e,t)&&rf(n,r)&&(r!==o||t in e)||pi(e,t,r)}function ci(e,t){for(var r=e.length;r--;)if(rf(e[r][0],t))return r;return-1}function fi(e,t,r,n){return wi(e,function(e,i,o){t(n,e,r(e),o)}),n}function li(e,t){return e&&is(t,wl(t),e)}function hi(e,t){return e&&is(t,Sl(t),e)}function pi(e,t,r){"__proto__"==t&&Bt?Bt(e,t,{configurable:!0,enumerable:!0,value:r,writable:!0}):e[t]=r}function di(e,t){for(var n=-1,i=t.length,s=r(i),a=null==e;++n<i;)s[n]=a?o:yl(e,t[n]);return s}function yi(e,t,r){return e==e&&(r!==o&&(e=e<=r?e:r),t!==o&&(e=e>=t?e:t)),e}function gi(e,t,r,n,i,s){var a,u=t&p,c=t&d,f=t&y;if(r&&(a=i?r(e,n,i,s):r(e)),a!==o)return a;if(!kf(e))return e;var l=af(e);if(l){if(a=ea(e),!u)return ns(e,a)}else{var h=Js(e),g=h==J||h==X;if(hf(e))return Wo(e,u);if(h==te||h==H||g&&!i){if(a=c||g?{}:ta(e),!u)return c?ss(e,hi(a,e)):os(e,li(a,e))}else{if(!Xt[h])return i?e:{};a=ra(e,h,u)}}s||(s=new Xn);var m=s.get(e);if(m)return m;if(s.set(e,a),jf(e))return e.forEach(function(n){a.add(gi(n,t,r,n,e,s))}),a;if(Af(e))return e.forEach(function(n,i){a.set(i,gi(n,t,r,i,e,s))}),a;var b=f?c?Ds:Ks:c?Sl:wl,v=l?o:b(e);return _r(v||e,function(n,i){v&&(i=n,n=e[i]),ui(a,i,gi(n,t,r,i,e,s))}),a}function mi(e){var t=wl(e);return function(r){return bi(r,e,t)}}function bi(e,t,r){var n=r.length;if(null==e)return!n;for(e=tt(e);n--;){var i=r[n],s=t[i],a=e[i];if(a===o&&!(i in e)||!s(a))return!1}return!0}function vi(e,t,r){if("function"!=typeof e)throw new it(c);return ka(function(){e.apply(o,r)},t)}function _i(e,t,r,n){var i=-1,o=Er,s=!0,u=e.length,c=[],f=t.length;if(!u)return c;r&&(t=xr(t,Wr(r))),n?(o=Ar,s=!1):t.length>=a&&(o=Yr,s=!1,t=new $n(t));e:for(;++i<u;){var l=e[i],h=null==r?l:r(l);if(l=n||0!==l?l:0,s&&h==h){for(var p=f;p--;)if(t[p]===h)continue e;c.push(l)}else o(t,h,n)||c.push(l)}return c}wn.templateSettings={escape:Be,evaluate:Ce,interpolate:Pe,variable:"",imports:{_:wn}},wn.prototype=En.prototype,wn.prototype.constructor=wn,An.prototype=kn(En.prototype),An.prototype.constructor=An,xn.prototype=kn(En.prototype),xn.prototype.constructor=xn,Cn.prototype.clear=Pn,Cn.prototype.delete=On,Cn.prototype.get=Rn,Cn.prototype.has=Nn,Cn.prototype.set=Ln,jn.prototype.clear=Mn,jn.prototype.delete=Kn,jn.prototype.get=Dn,jn.prototype.has=Un,jn.prototype.set=Fn,qn.prototype.clear=Hn,qn.prototype.delete=zn,qn.prototype.get=Vn,qn.prototype.has=Gn,qn.prototype.set=Wn,$n.prototype.add=$n.prototype.push=Yn,$n.prototype.has=Jn,Xn.prototype.clear=Zn,Xn.prototype.delete=Qn,Xn.prototype.get=ei,Xn.prototype.has=ti,Xn.prototype.set=ri;var wi=cs(Ci),Si=cs(Pi,!0);function ki(e,t){var r=!0;return wi(e,function(e,n,i){return r=!!t(e,n,i),r}),r}function Ei(e,t,r){for(var n=-1,i=e.length;++n<i;){var s=e[n],a=t(s);if(null!=a&&(u===o?a==a&&!Kf(a):r(a,u)))var u=a,c=s}return c}function Ai(e,t,r,n){var i=e.length;for(r=Wf(r),r<0&&(r=-r>i?0:i+r),n=n===o||n>i?i:Wf(n),n<0&&(n+=i),n=r>n?0:$f(n);r<n;)e[r++]=t;return e}function xi(e,t){var r=[];return wi(e,function(e,n,i){t(e,n,i)&&r.push(e)}),r}function Ii(e,t,r,n,i){var o=-1,s=e.length;for(r||(r=ia),i||(i=[]);++o<s;){var a=e[o];t>0&&r(a)?t>1?Ii(a,t-1,r,n,i):Ir(i,a):n||(i[i.length]=a)}return i}var Ti=fs(),Bi=fs(!0);function Ci(e,t){return e&&Ti(e,t,wl)}function Pi(e,t){return e&&Bi(e,t,wl)}function Oi(e,t){return kr(t,function(t){return _f(e[t])})}function Ri(e,t){t=Ho(t,e);for(var r=0,n=t.length;null!=e&&r<n;)e=e[Ba(t[r++])];return r&&r==n?e:o}function Ni(e,t,r){var n=t(e);return af(e)?n:Ir(n,r(e))}function Li(e){return null==e?e===o?ue:ee:Tt&&Tt in tt(e)?Ws(e):ba(e)}function ji(e,t){return e>t}function Mi(e,t){return null!=e&&ft.call(e,t)}function Ki(e,t){return null!=e&&t in tt(e)}function Di(e,t,r){return e>=Ft(t,r)&&e<Ut(t,r)}function Ui(e,t,n){for(var i=n?Ar:Er,s=e[0].length,a=e.length,u=a,c=r(a),f=1/0,l=[];u--;){var h=e[u];u&&t&&(h=xr(h,Wr(t))),f=Ft(h.length,f),c[u]=!n&&(t||s>=120&&h.length>=120)?new $n(u&&h):o}h=e[0];var p=-1,d=c[0];e:for(;++p<s&&l.length<f;){var y=h[p],g=t?t(y):y;if(y=n||0!==y?y:0,!(d?Yr(d,g):i(l,g,n))){for(u=a;--u;){var m=c[u];if(!(m?Yr(m,g):i(e[u],g,n)))continue e}d&&d.push(g),l.push(y)}}return l}function Fi(e,t,r,n){return Ci(e,function(e,i,o){t(n,r(e),i,o)}),n}function qi(e,t,r){t=Ho(t,e),e=_a(e,t);var n=null==e?e:e[Ba(nu(t))];return null==n?o:br(n,e,r)}function Hi(e){return Ef(e)&&Li(e)==H}function zi(e){return Ef(e)&&Li(e)==le}function Vi(e){return Ef(e)&&Li(e)==W}function Gi(e,t,r,n,i){return e===t||(null==e||null==t||!Ef(e)&&!Ef(t)?e!=e&&t!=t:Wi(e,t,r,n,Gi,i))}function Wi(e,t,r,n,i,o){var s=af(e),a=af(t),u=s?z:Js(e),c=a?z:Js(t);u=u==H?te:u,c=c==H?te:c;var f=u==te,l=c==te,h=u==c;if(h&&hf(e)){if(!hf(t))return!1;s=!0,f=!1}if(h&&!f)return o||(o=new Xn),s||Df(e)?Ns(e,t,r,n,i,o):Ls(e,t,u,r,n,i,o);if(!(r&g)){var p=f&&ft.call(e,"__wrapped__"),d=l&&ft.call(t,"__wrapped__");if(p||d){var y=p?e.value():e,m=d?t.value():t;return o||(o=new Xn),i(y,m,r,n,o)}}return!!h&&(o||(o=new Xn),js(e,t,r,n,i,o))}function $i(e){return Ef(e)&&Js(e)==Z}function Yi(e,t,r,n){var i=r.length,s=i,a=!n;if(null==e)return!s;for(e=tt(e);i--;){var u=r[i];if(a&&u[2]?u[1]!==e[u[0]]:!(u[0]in e))return!1}for(;++i<s;){u=r[i];var c=u[0],f=e[c],l=u[1];if(a&&u[2]){if(f===o&&!(c in e))return!1}else{var h=new Xn;if(n)var p=n(f,l,c,e,t,h);if(!(p===o?Gi(l,f,g|m,n,h):p))return!1}}return!0}function Ji(e){if(!kf(e)||fa(e))return!1;var t=_f(e)?mt:Ye;return t.test(Ca(e))}function Xi(e){return Ef(e)&&Li(e)==ie}function Zi(e){return Ef(e)&&Js(e)==oe}function Qi(e){return Ef(e)&&Sf(e.length)&&!!Jt[Li(e)]}function eo(e){return"function"==typeof e?e:null==e?Bh:"object"==typeof e?af(e)?so(e[0],e[1]):oo(e):qh(e)}function to(e){if(!ha(e))return Dt(e);var t=[];for(var r in tt(e))ft.call(e,r)&&"constructor"!=r&&t.push(r);return t}function ro(e){if(!kf(e))return ma(e);var t=ha(e),r=[];for(var n in e)("constructor"!=n||!t&&ft.call(e,n))&&r.push(n);return r}function no(e,t){return e<t}function io(e,t){var n=-1,i=cf(e)?r(e.length):[];return wi(e,function(e,r,o){i[++n]=t(e,r,o)}),i}function oo(e){var t=Vs(e);return 1==t.length&&t[0][2]?da(t[0][0],t[0][1]):function(r){return r===e||Yi(r,e,t)}}function so(e,t){return aa(e)&&pa(t)?da(Ba(e),t):function(r){var n=yl(r,e);return n===o&&n===t?ml(r,e):Gi(t,n,g|m)}}function ao(e,t,r,n,i){e!==t&&Ti(t,function(s,a){if(kf(s))i||(i=new Xn),uo(e,t,a,r,ao,n,i);else{var u=n?n(fn(e,a),s,a+"",e,t,i):o;u===o&&(u=s),ai(e,a,u)}},Sl)}function uo(e,t,r,n,i,s,a){var u=fn(e,r),c=fn(t,r),f=a.get(c);if(f)ai(e,r,f);else{var l=s?s(u,c,r+"",e,t,a):o,h=l===o;if(h){var p=af(c),d=!p&&hf(c),y=!p&&!d&&Df(c);l=c,p||d||y?af(u)?l=u:ff(u)?l=ns(u):d?(h=!1,l=Wo(c,!0)):y?(h=!1,l=Zo(c,!0)):l=[]:Rf(c)||sf(c)?(l=u,sf(u)?l=Jf(u):(!kf(u)||n&&_f(u))&&(l=ta(c))):h=!1}h&&(a.set(c,l),i(l,c,n,s,a),a.delete(c)),ai(e,r,l)}}function co(e,t){var r=e.length;if(r)return t+=t<0?r:0,oa(t,r)?e[t]:o}function fo(e,t,r){var n=-1;t=xr(t.length?t:[Bh],Wr(Hs()));var i=io(e,function(e,r,i){var o=xr(t,function(t){return t(e)});return{criteria:o,index:++n,value:e}});return Hr(i,function(e,t){return es(e,t,r)})}function lo(e,t){return ho(e,t,function(t,r){return ml(e,r)})}function ho(e,t,r){for(var n=-1,i=t.length,o={};++n<i;){var s=t[n],a=Ri(e,s);r(a,s)&&ko(o,Ho(s,e),a)}return o}function po(e){return function(t){return Ri(t,e)}}function yo(e,t,r,n){var i=n?Mr:jr,o=-1,s=t.length,a=e;for(e===t&&(t=ns(t)),r&&(a=xr(e,Wr(r)));++o<s;)for(var u=0,c=t[o],f=r?r(c):c;(u=i(a,f,u,n))>-1;)a!==e&&At.call(a,u,1),At.call(e,u,1);return e}function go(e,t){for(var r=e?t.length:0,n=r-1;r--;){var i=t[r];if(r==n||i!==o){var o=i;oa(i)?At.call(e,i,1):Lo(e,i)}}return e}function mo(e,t){return e+Nt(Gt()*(t-e+1))}function bo(e,t,n,i){for(var o=-1,s=Ut(Rt((t-e)/(n||1)),0),a=r(s);s--;)a[i?s:++o]=e,e+=n;return a}function vo(e,t){var r="";if(!e||t<1||t>j)return r;do{t%2&&(r+=e),t=Nt(t/2),t&&(e+=e)}while(t);return r}function _o(e,t){return Ea(va(e,t,Bh),e+"")}function wo(e){return ii(Ul(e))}function So(e,t){var r=Ul(e);return Ia(r,yi(t,0,r.length))}function ko(e,t,r,n){if(!kf(e))return e;t=Ho(t,e);for(var i=-1,s=t.length,a=s-1,u=e;null!=u&&++i<s;){var c=Ba(t[i]),f=r;if(i!=a){var l=u[c];f=n?n(l,c,u):o,f===o&&(f=kf(l)?l:oa(t[i+1])?[]:{})}ui(u,c,f),u=u[c]}return e}var Eo=ar?function(e,t){return ar.set(e,t),e}:Bh,Ao=Bt?function(e,t){return Bt(e,"toString",{configurable:!0,enumerable:!1,value:Ah(t),writable:!0})}:Bh;function xo(e){return Ia(Ul(e))}function Io(e,t,n){var i=-1,o=e.length;t<0&&(t=-t>o?0:o+t),n=n>o?o:n,n<0&&(n+=o),o=t>n?0:n-t>>>0,t>>>=0;for(var s=r(o);++i<o;)s[i]=e[i+t];return s}function To(e,t){var r;return wi(e,function(e,n,i){return r=t(e,n,i),!r}),!!r}function Bo(e,t,r){var n=0,i=null==e?n:e.length;if("number"==typeof t&&t==t&&i<=F){for(;n<i;){var o=n+i>>>1,s=e[o];null!==s&&!Kf(s)&&(r?s<=t:s<t)?n=o+1:i=o}return i}return Co(e,t,Bh,r)}function Co(e,t,r,n){t=r(t);for(var i=0,s=null==e?0:e.length,a=t!=t,u=null===t,c=Kf(t),f=t===o;i<s;){var l=Nt((i+s)/2),h=r(e[l]),p=h!==o,d=null===h,y=h==h,g=Kf(h);if(a)var m=n||y;else m=f?y&&(n||p):u?y&&p&&(n||!d):c?y&&p&&!d&&(n||!g):!d&&!g&&(n?h<=t:h<t);m?i=l+1:s=l}return Ft(s,U)}function Po(e,t){for(var r=-1,n=e.length,i=0,o=[];++r<n;){var s=e[r],a=t?t(s):s;if(!r||!rf(a,u)){var u=a;o[i++]=0===s?0:s}}return o}function Oo(e){return"number"==typeof e?e:Kf(e)?K:+e}function Ro(e){if("string"==typeof e)return e;if(af(e))return xr(e,Ro)+"";if(Kf(e))return vn?vn.call(e):"";var t=e+"";return"0"==t&&1/e==-L?"-0":t}function No(e,t,r){var n=-1,i=Er,o=e.length,s=!0,u=[],c=u;if(r)s=!1,i=Ar;else if(o>=a){var f=t?null:Ts(e);if(f)return ln(f);s=!1,i=Yr,c=new $n}else c=t?[]:u;e:for(;++n<o;){var l=e[n],h=t?t(l):l;if(l=r||0!==l?l:0,s&&h==h){for(var p=c.length;p--;)if(c[p]===h)continue e;t&&c.push(h),u.push(l)}else i(c,h,r)||(c!==u&&c.push(h),u.push(l))}return u}function Lo(e,t){return t=Ho(t,e),e=_a(e,t),null==e||delete e[Ba(nu(t))]}function jo(e,t,r,n){return ko(e,t,r(Ri(e,t)),n)}function Mo(e,t,r,n){for(var i=e.length,o=n?i:-1;(n?o--:++o<i)&&t(e[o],o,e););return r?Io(e,n?0:o,n?o+1:i):Io(e,n?o+1:0,n?i:o)}function Ko(e,t){var r=e;return r instanceof xn&&(r=r.value()),Tr(t,function(e,t){return t.func.apply(t.thisArg,Ir([e],t.args))},r)}function Do(e,t,n){var i=e.length;if(i<2)return i?No(e[0]):[];for(var o=-1,s=r(i);++o<i;)for(var a=e[o],u=-1;++u<i;)u!=o&&(s[o]=_i(s[o]||a,e[u],t,n));return No(Ii(s,1),t,n)}function Uo(e,t,r){for(var n=-1,i=e.length,s=t.length,a={};++n<i;){var u=n<s?t[n]:o;r(a,e[n],u)}return a}function Fo(e){return ff(e)?e:[]}function qo(e){return"function"==typeof e?e:Bh}function Ho(e,t){return af(e)?e:aa(e,t)?[e]:Ta(Zf(e))}var zo=_o;function Vo(e,t,r){var n=e.length;return r=r===o?n:r,!t&&r>=n?e:Io(e,t,r)}var Go=Ct||function(e){return sr.clearTimeout(e)};function Wo(e,t){if(t)return e.slice();var r=e.length,n=wt?wt(r):new e.constructor(r);return e.copy(n),n}function $o(e){var t=new e.constructor(e.byteLength);return new _t(t).set(new _t(e)),t}function Yo(e,t){var r=t?$o(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.byteLength)}function Jo(e){var t=new e.constructor(e.source,Ge.exec(e));return t.lastIndex=e.lastIndex,t}function Xo(e){return bn?tt(bn.call(e)):{}}function Zo(e,t){var r=t?$o(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.length)}function Qo(e,t){if(e!==t){var r=e!==o,n=null===e,i=e==e,s=Kf(e),a=t!==o,u=null===t,c=t==t,f=Kf(t);if(!u&&!f&&!s&&e>t||s&&a&&c&&!u&&!f||n&&a&&c||!r&&c||!i)return 1;if(!n&&!s&&!f&&e<t||f&&r&&i&&!n&&!s||u&&r&&i||!a&&i||!c)return-1}return 0}function es(e,t,r){for(var n=-1,i=e.criteria,o=t.criteria,s=i.length,a=r.length;++n<s;){var u=Qo(i[n],o[n]);if(u){if(n>=a)return u;var c=r[n];return u*("desc"==c?-1:1)}}return e.index-t.index}function ts(e,t,n,i){for(var o=-1,s=e.length,a=n.length,u=-1,c=t.length,f=Ut(s-a,0),l=r(c+f),h=!i;++u<c;)l[u]=t[u];for(;++o<a;)(h||o<s)&&(l[n[o]]=e[o]);for(;f--;)l[u++]=e[o++];return l}function rs(e,t,n,i){for(var o=-1,s=e.length,a=-1,u=n.length,c=-1,f=t.length,l=Ut(s-u,0),h=r(l+f),p=!i;++o<l;)h[o]=e[o];for(var d=o;++c<f;)h[d+c]=t[c];for(;++a<u;)(p||o<s)&&(h[d+n[a]]=e[o++]);return h}function ns(e,t){var n=-1,i=e.length;for(t||(t=r(i));++n<i;)t[n]=e[n];return t}function is(e,t,r,n){var i=!r;r||(r={});for(var s=-1,a=t.length;++s<a;){var u=t[s],c=n?n(r[u],e[u],u,r,e):o;c===o&&(c=e[u]),i?pi(r,u,c):ui(r,u,c)}return r}function os(e,t){return is(e,$s(e),t)}function ss(e,t){return is(e,Ys(e),t)}function as(e,t){return function(r,n){var i=af(r)?vr:fi,o=t?t():{};return i(r,e,Hs(n,2),o)}}function us(e){return _o(function(t,r){var n=-1,i=r.length,s=i>1?r[i-1]:o,a=i>2?r[2]:o;for(s=e.length>3&&"function"==typeof s?(i--,s):o,a&&sa(r[0],r[1],a)&&(s=i<3?o:s,i=1),t=tt(t);++n<i;){var u=r[n];u&&e(t,u,n,s)}return t})}function cs(e,t){return function(r,n){if(null==r)return r;if(!cf(r))return e(r,n);for(var i=r.length,o=t?i:-1,s=tt(r);(t?o--:++o<i)&&!1!==n(s[o],o,s););return r}}function fs(e){return function(t,r,n){for(var i=-1,o=tt(t),s=n(t),a=s.length;a--;){var u=s[e?a:++i];if(!1===r(o[u],u,o))break}return t}}function ls(e,t,r){var n=t&b,i=ds(e);function o(){var t=this&&this!==sr&&this instanceof o?i:e;return t.apply(n?r:this,arguments)}return o}function hs(e){return function(t){t=Zf(t);var r=nn(t)?gn(t):o,n=r?r[0]:t.charAt(0),i=r?Vo(r,1).join(""):t.slice(1);return n[e]()+i}}function ps(e){return function(t){return Tr(_h(Wl(t).replace(qt,"")),e,"")}}function ds(e){return function(){var t=arguments;switch(t.length){case 0:return new e;case 1:return new e(t[0]);case 2:return new e(t[0],t[1]);case 3:return new e(t[0],t[1],t[2]);case 4:return new e(t[0],t[1],t[2],t[3]);case 5:return new e(t[0],t[1],t[2],t[3],t[4]);case 6:return new e(t[0],t[1],t[2],t[3],t[4],t[5]);case 7:return new e(t[0],t[1],t[2],t[3],t[4],t[5],t[6])}var r=kn(e.prototype),n=e.apply(r,t);return kf(n)?n:r}}function ys(e,t,n){var i=ds(e);function s(){for(var a=arguments.length,u=r(a),c=a,f=qs(s);c--;)u[c]=arguments[c];var l=a<3&&u[0]!==f&&u[a-1]!==f?[]:cn(u,f);if(a-=l.length,a<n)return xs(e,t,bs,s.placeholder,o,u,l,o,o,n-a);var h=this&&this!==sr&&this instanceof s?i:e;return br(h,this,u)}return s}function gs(e){return function(t,r,n){var i=tt(t);if(!cf(t)){var s=Hs(r,3);t=wl(t),r=function(e){return s(i[e],e,i)}}var a=e(t,r,n);return a>-1?i[s?t[a]:a]:o}}function ms(e){return Ms(function(t){var r=t.length,n=r,i=An.prototype.thru;for(e&&t.reverse();n--;){var s=t[n];if("function"!=typeof s)throw new it(c);if(i&&!a&&"wrapper"==Fs(s))var a=new An([],!0)}for(n=a?n:r;++n<r;){s=t[n];var u=Fs(s),f="wrapper"==u?Us(s):o;a=f&&ca(f[0])&&f[1]==(A|w|k|x)&&!f[4].length&&1==f[9]?a[Fs(f[0])].apply(a,f[3]):1==s.length&&ca(s)?a[u]():a.thru(s)}return function(){var e=arguments,n=e[0];if(a&&1==e.length&&af(n))return a.plant(n).value();for(var i=0,o=r?t[i].apply(this,e):n;++i<r;)o=t[i].call(this,o);return o}})}function bs(e,t,n,i,s,a,u,c,f,l){var h=t&A,p=t&b,d=t&v,y=t&(w|S),g=t&I,m=d?o:ds(e);function _(){for(var o=arguments.length,b=r(o),v=o;v--;)b[v]=arguments[v];if(y)var w=qs(_),S=Zr(b,w);if(i&&(b=ts(b,i,s,y)),a&&(b=rs(b,a,u,y)),o-=S,y&&o<l){var k=cn(b,w);return xs(e,t,bs,_.placeholder,n,b,k,c,f,l-o)}var E=p?n:this,A=d?E[e]:e;return o=b.length,c?b=wa(b,c):g&&o>1&&b.reverse(),h&&f<o&&(b.length=f),this&&this!==sr&&this instanceof _&&(A=m||ds(A)),A.apply(E,b)}return _}function vs(e,t){return function(r,n){return Fi(r,e,t(n),{})}}function _s(e,t){return function(r,n){var i;if(r===o&&n===o)return t;if(r!==o&&(i=r),n!==o){if(i===o)return n;"string"==typeof r||"string"==typeof n?(r=Ro(r),n=Ro(n)):(r=Oo(r),n=Oo(n)),i=e(r,n)}return i}}function ws(e){return Ms(function(t){return t=xr(t,Wr(Hs())),_o(function(r){var n=this;return e(t,function(e){return br(e,n,r)})})})}function Ss(e,t){t=t===o?" ":Ro(t);var r=t.length;if(r<2)return r?vo(t,e):t;var n=vo(t,Rt(e/yn(t)));return nn(t)?Vo(gn(n),0,e).join(""):n.slice(0,e)}function ks(e,t,n,i){var o=t&b,s=ds(e);function a(){for(var t=-1,u=arguments.length,c=-1,f=i.length,l=r(f+u),h=this&&this!==sr&&this instanceof a?s:e;++c<f;)l[c]=i[c];for(;u--;)l[c++]=arguments[++t];return br(h,o?n:this,l)}return a}function Es(e){return function(t,r,n){return n&&"number"!=typeof n&&sa(t,r,n)&&(r=n=o),t=Gf(t),r===o?(r=t,t=0):r=Gf(r),n=n===o?t<r?1:-1:Gf(n),bo(t,r,n,e)}}function As(e){return function(t,r){return"string"==typeof t&&"string"==typeof r||(t=Yf(t),r=Yf(r)),e(t,r)}}function xs(e,t,r,n,i,s,a,u,c,f){var l=t&w,h=l?a:o,p=l?o:a,d=l?s:o,y=l?o:s;t|=l?k:E,t&=~(l?E:k),t&_||(t&=~(b|v));var g=[e,t,i,d,h,y,p,u,c,f],m=r.apply(o,g);return ca(e)&&Sa(m,g),m.placeholder=n,Aa(m,e,t)}function Is(e){var t=He[e];return function(e,r){if(e=Yf(e),r=null==r?0:Ft(Wf(r),292),r){var n=(Zf(e)+"e").split("e"),i=t(n[0]+"e"+(+n[1]+r));return n=(Zf(i)+"e").split("e"),+(n[0]+"e"+(+n[1]-r))}return t(e)}}var Ts=tr&&1/ln(new tr([,-0]))[1]==L?function(e){return new tr(e)}:Mh;function Bs(e){return function(t){var r=Js(t);return r==Z?an(t):r==oe?hn(t):Gr(t,e(t))}}function Cs(e,t,r,n,i,s,a,u){var f=t&v;if(!f&&"function"!=typeof e)throw new it(c);var l=n?n.length:0;if(l||(t&=~(k|E),n=i=o),a=a===o?a:Ut(Wf(a),0),u=u===o?u:Wf(u),l-=i?i.length:0,t&E){var h=n,p=i;n=i=o}var d=f?o:Us(e),y=[e,t,r,n,i,h,p,s,a,u];if(d&&ga(y,d),e=y[0],t=y[1],r=y[2],n=y[3],i=y[4],u=y[9]=y[9]===o?f?0:e.length:Ut(y[9]-l,0),!u&&t&(w|S)&&(t&=~(w|S)),t&&t!=b)g=t==w||t==S?ys(e,t,u):t!=k&&t!=(b|k)||i.length?bs.apply(o,y):ks(e,t,r,n);else var g=ls(e,t,r);var m=d?Eo:Sa;return Aa(m(g,y),e,t)}function Ps(e,t,r,n){return e===o||rf(e,at[r])&&!ft.call(n,r)?t:e}function Os(e,t,r,n,i,s){return kf(e)&&kf(t)&&(s.set(t,e),ao(e,t,o,Os,s),s.delete(t)),e}function Rs(e){return Rf(e)?o:e}function Ns(e,t,r,n,i,s){var a=r&g,u=e.length,c=t.length;if(u!=c&&!(a&&c>u))return!1;var f=s.get(e);if(f&&s.get(t))return f==t;var l=-1,h=!0,p=r&m?new $n:o;for(s.set(e,t),s.set(t,e);++l<u;){var d=e[l],y=t[l];if(n)var b=a?n(y,d,l,t,e,s):n(d,y,l,e,t,s);if(b!==o){if(b)continue;h=!1;break}if(p){if(!Cr(t,function(e,t){if(!Yr(p,t)&&(d===e||i(d,e,r,n,s)))return p.push(t)})){h=!1;break}}else if(d!==y&&!i(d,y,r,n,s)){h=!1;break}}return s.delete(e),s.delete(t),h}function Ls(e,t,r,n,i,o,s){switch(r){case he:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case le:return!(e.byteLength!=t.byteLength||!o(new _t(e),new _t(t)));case G:case W:case Q:return rf(+e,+t);case Y:return e.name==t.name&&e.message==t.message;case ie:case se:return e==t+"";case Z:var a=an;case oe:var u=n&g;if(a||(a=ln),e.size!=t.size&&!u)return!1;var c=s.get(e);if(c)return c==t;n|=m,s.set(e,t);var f=Ns(a(e),a(t),n,i,o,s);return s.delete(e),f;case ae:if(bn)return bn.call(e)==bn.call(t)}return!1}function js(e,t,r,n,i,s){var a=r&g,u=Ks(e),c=u.length,f=Ks(t),l=f.length;if(c!=l&&!a)return!1;for(var h=c;h--;){var p=u[h];if(!(a?p in t:ft.call(t,p)))return!1}var d=s.get(e);if(d&&s.get(t))return d==t;var y=!0;s.set(e,t),s.set(t,e);for(var m=a;++h<c;){p=u[h];var b=e[p],v=t[p];if(n)var _=a?n(v,b,p,t,e,s):n(b,v,p,e,t,s);if(!(_===o?b===v||i(b,v,r,n,s):_)){y=!1;break}m||(m="constructor"==p)}if(y&&!m){var w=e.constructor,S=t.constructor;w!=S&&"constructor"in e&&"constructor"in t&&!("function"==typeof w&&w instanceof w&&"function"==typeof S&&S instanceof S)&&(y=!1)}return s.delete(e),s.delete(t),y}function Ms(e){return Ea(va(e,o,Ga),e+"")}function Ks(e){return Ni(e,wl,$s)}function Ds(e){return Ni(e,Sl,Ys)}var Us=ar?function(e){return ar.get(e)}:Mh;function Fs(e){for(var t=e.name+"",r=ur[t],n=ft.call(ur,t)?r.length:0;n--;){var i=r[n],o=i.func;if(null==o||o==e)return i.name}return t}function qs(e){var t=ft.call(wn,"placeholder")?wn:e;return t.placeholder}function Hs(){var e=wn.iteratee||Ch;return e=e===Ch?eo:e,arguments.length?e(arguments[0],arguments[1]):e}function zs(e,t){var r=e.__data__;return ua(t)?r["string"==typeof t?"string":"hash"]:r.map}function Vs(e){for(var t=wl(e),r=t.length;r--;){var n=t[r],i=e[n];t[r]=[n,i,pa(i)]}return t}function Gs(e,t){var r=rn(e,t);return Ji(r)?r:o}function Ws(e){var t=ft.call(e,Tt),r=e[Tt];try{e[Tt]=o;var n=!0}catch(e){}var i=dt.call(e);return n&&(t?e[Tt]=r:delete e[Tt]),i}var $s=Lt?function(e){return null==e?[]:(e=tt(e),kr(Lt(e),function(t){return Et.call(e,t)}))}:Gh,Ys=Lt?function(e){for(var t=[];e;)Ir(t,$s(e)),e=St(e);return t}:Gh,Js=Li;function Xs(e,t,r){for(var n=-1,i=r.length;++n<i;){var o=r[n],s=o.size;switch(o.type){case"drop":e+=s;break;case"dropRight":t-=s;break;case"take":t=Ft(t,e+s);break;case"takeRight":e=Ut(e,t-s)}}return{start:e,end:t}}function Zs(e){var t=e.match(Fe);return t?t[1].split(qe):[]}function Qs(e,t,r){t=Ho(t,e);for(var n=-1,i=t.length,o=!1;++n<i;){var s=Ba(t[n]);if(!(o=null!=e&&r(e,s)))break;e=e[s]}return o||++n!=i?o:(i=null==e?0:e.length,!!i&&Sf(i)&&oa(s,i)&&(af(e)||sf(e)))}function ea(e){var t=e.length,r=new e.constructor(t);return t&&"string"==typeof e[0]&&ft.call(e,"index")&&(r.index=e.index,r.input=e.input),r}function ta(e){return"function"!=typeof e.constructor||ha(e)?{}:kn(St(e))}function ra(e,t,r){var n=e.constructor;switch(t){case le:return $o(e);case G:case W:return new n(+e);case he:return Yo(e,r);case pe:case de:case ye:case ge:case me:case be:case ve:case _e:case we:return Zo(e,r);case Z:return new n;case Q:case se:return new n(e);case ie:return Jo(e);case oe:return new n;case ae:return Xo(e)}}function na(e,t){var r=t.length;if(!r)return e;var n=r-1;return t[n]=(r>1?"& ":"")+t[n],t=t.join(r>2?", ":" "),e.replace(Ue,"{\n/* [wrapped with "+t+"] */\n")}function ia(e){return af(e)||sf(e)||!!(xt&&e&&e[xt])}function oa(e,t){var r=typeof e;return t=null==t?j:t,!!t&&("number"==r||"symbol"!=r&&Xe.test(e))&&e>-1&&e%1==0&&e<t}function sa(e,t,r){if(!kf(r))return!1;var n=typeof t;return!!("number"==n?cf(r)&&oa(t,r.length):"string"==n&&t in r)&&rf(r[t],e)}function aa(e,t){if(af(e))return!1;var r=typeof e;return!("number"!=r&&"symbol"!=r&&"boolean"!=r&&null!=e&&!Kf(e))||(Re.test(e)||!Oe.test(e)||null!=t&&e in tt(t))}function ua(e){var t=typeof e;return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e}function ca(e){var t=Fs(e),r=wn[t];if("function"!=typeof r||!(t in xn.prototype))return!1;if(e===r)return!0;var n=Us(r);return!!n&&e===n[0]}function fa(e){return!!ht&&ht in e}(Zt&&Js(new Zt(new ArrayBuffer(1)))!=he||Qt&&Js(new Qt)!=Z||er&&Js(er.resolve())!=re||tr&&Js(new tr)!=oe||ir&&Js(new ir)!=ce)&&(Js=function(e){var t=Li(e),r=t==te?e.constructor:o,n=r?Ca(r):"";if(n)switch(n){case fr:return he;case lr:return Z;case Pr:return re;case Or:return oe;case Fr:return ce}return t});var la=ut?_f:Wh;function ha(e){var t=e&&e.constructor,r="function"==typeof t&&t.prototype||at;return e===r}function pa(e){return e==e&&!kf(e)}function da(e,t){return function(r){return null!=r&&(r[e]===t&&(t!==o||e in tt(r)))}}function ya(e){var t=Kc(e,function(e){return r.size===l&&r.clear(),e}),r=t.cache;return t}function ga(e,t){var r=e[1],n=t[1],i=r|n,o=i<(b|v|A),s=n==A&&r==w||n==A&&r==x&&e[7].length<=t[8]||n==(A|x)&&t[7].length<=t[8]&&r==w;if(!o&&!s)return e;n&b&&(e[2]=t[2],i|=r&b?0:_);var a=t[3];if(a){var u=e[3];e[3]=u?ts(u,a,t[4]):a,e[4]=u?cn(e[3],h):t[4]}return a=t[5],a&&(u=e[5],e[5]=u?rs(u,a,t[6]):a,e[6]=u?cn(e[5],h):t[6]),a=t[7],a&&(e[7]=a),n&A&&(e[8]=null==e[8]?t[8]:Ft(e[8],t[8])),null==e[9]&&(e[9]=t[9]),e[0]=t[0],e[1]=i,e}function ma(e){var t=[];if(null!=e)for(var r in tt(e))t.push(r);return t}function ba(e){return dt.call(e)}function va(e,t,n){return t=Ut(t===o?e.length-1:t,0),function(){for(var i=arguments,o=-1,s=Ut(i.length-t,0),a=r(s);++o<s;)a[o]=i[t+o];o=-1;for(var u=r(t+1);++o<t;)u[o]=i[o];return u[t]=n(a),br(e,this,u)}}function _a(e,t){return t.length<2?e:Ri(e,Io(t,0,-1))}function wa(e,t){for(var r=e.length,n=Ft(t.length,r),i=ns(e);n--;){var s=t[n];e[n]=oa(s,r)?i[s]:o}return e}var Sa=xa(Eo),ka=Ot||function(e,t){return sr.setTimeout(e,t)},Ea=xa(Ao);function Aa(e,t,r){var n=t+"";return Ea(e,na(n,Pa(Zs(n),r)))}function xa(e){var t=0,r=0;return function(){var n=zt(),i=P-(n-r);if(r=n,i>0){if(++t>=C)return arguments[0]}else t=0;return e.apply(o,arguments)}}function Ia(e,t){var r=-1,n=e.length,i=n-1;for(t=t===o?n:t;++r<t;){var s=mo(r,i),a=e[s];e[s]=e[r],e[r]=a}return e.length=t,e}var Ta=ya(function(e){var t=[];return 46===e.charCodeAt(0)&&t.push(""),e.replace(Ne,function(e,r,n,i){t.push(n?i.replace(ze,"$1"):r||e)}),t});function Ba(e){if("string"==typeof e||Kf(e))return e;var t=e+"";return"0"==t&&1/e==-L?"-0":t}function Ca(e){if(null!=e){try{return ct.call(e)}catch(e){}try{return e+""}catch(e){}}return""}function Pa(e,t){return _r(q,function(r){var n="_."+r[0];t&r[1]&&!Er(e,n)&&e.push(n)}),e.sort()}function Oa(e){if(e instanceof xn)return e.clone();var t=new An(e.__wrapped__,e.__chain__);return t.__actions__=ns(e.__actions__),t.__index__=e.__index__,t.__values__=e.__values__,t}function Ra(e,t,n){t=(n?sa(e,t,n):t===o)?1:Ut(Wf(t),0);var i=null==e?0:e.length;if(!i||t<1)return[];for(var s=0,a=0,u=r(Rt(i/t));s<i;)u[a++]=Io(e,s,s+=t);return u}function Na(e){for(var t=-1,r=null==e?0:e.length,n=0,i=[];++t<r;){var o=e[t];o&&(i[n++]=o)}return i}function La(){var e=arguments.length;if(!e)return[];for(var t=r(e-1),n=arguments[0],i=e;i--;)t[i-1]=arguments[i];return Ir(af(n)?ns(n):[n],Ii(t,1))}var ja=_o(function(e,t){return ff(e)?_i(e,Ii(t,1,ff,!0)):[]}),Ma=_o(function(e,t){var r=nu(t);return ff(r)&&(r=o),ff(e)?_i(e,Ii(t,1,ff,!0),Hs(r,2)):[]}),Ka=_o(function(e,t){var r=nu(t);return ff(r)&&(r=o),ff(e)?_i(e,Ii(t,1,ff,!0),o,r):[]});function Da(e,t,r){var n=null==e?0:e.length;return n?(t=r||t===o?1:Wf(t),Io(e,t<0?0:t,n)):[]}function Ua(e,t,r){var n=null==e?0:e.length;return n?(t=r||t===o?1:Wf(t),t=n-t,Io(e,0,t<0?0:t)):[]}function Fa(e,t){return e&&e.length?Mo(e,Hs(t,3),!0,!0):[]}function qa(e,t){return e&&e.length?Mo(e,Hs(t,3),!0):[]}function Ha(e,t,r,n){var i=null==e?0:e.length;return i?(r&&"number"!=typeof r&&sa(e,t,r)&&(r=0,n=i),Ai(e,t,r,n)):[]}function za(e,t,r){var n=null==e?0:e.length;if(!n)return-1;var i=null==r?0:Wf(r);return i<0&&(i=Ut(n+i,0)),Lr(e,Hs(t,3),i)}function Va(e,t,r){var n=null==e?0:e.length;if(!n)return-1;var i=n-1;return r!==o&&(i=Wf(r),i=r<0?Ut(n+i,0):Ft(i,n-1)),Lr(e,Hs(t,3),i,!0)}function Ga(e){var t=null==e?0:e.length;return t?Ii(e,1):[]}function Wa(e){var t=null==e?0:e.length;return t?Ii(e,L):[]}function $a(e,t){var r=null==e?0:e.length;return r?(t=t===o?1:Wf(t),Ii(e,t)):[]}function Ya(e){for(var t=-1,r=null==e?0:e.length,n={};++t<r;){var i=e[t];n[i[0]]=i[1]}return n}function Ja(e){return e&&e.length?e[0]:o}function Xa(e,t,r){var n=null==e?0:e.length;if(!n)return-1;var i=null==r?0:Wf(r);return i<0&&(i=Ut(n+i,0)),jr(e,t,i)}function Za(e){var t=null==e?0:e.length;return t?Io(e,0,-1):[]}var Qa=_o(function(e){var t=xr(e,Fo);return t.length&&t[0]===e[0]?Ui(t):[]}),eu=_o(function(e){var t=nu(e),r=xr(e,Fo);return t===nu(r)?t=o:r.pop(),r.length&&r[0]===e[0]?Ui(r,Hs(t,2)):[]}),tu=_o(function(e){var t=nu(e),r=xr(e,Fo);return t="function"==typeof t?t:o,t&&r.pop(),r.length&&r[0]===e[0]?Ui(r,o,t):[]});function ru(e,t){return null==e?"":Kt.call(e,t)}function nu(e){var t=null==e?0:e.length;return t?e[t-1]:o}function iu(e,t,r){var n=null==e?0:e.length;if(!n)return-1;var i=n;return r!==o&&(i=Wf(r),i=i<0?Ut(n+i,0):Ft(i,n-1)),t==t?dn(e,t,i):Lr(e,Kr,i,!0)}function ou(e,t){return e&&e.length?co(e,Wf(t)):o}var su=_o(au);function au(e,t){return e&&e.length&&t&&t.length?yo(e,t):e}function uu(e,t,r){return e&&e.length&&t&&t.length?yo(e,t,Hs(r,2)):e}function cu(e,t,r){return e&&e.length&&t&&t.length?yo(e,t,o,r):e}var fu=Ms(function(e,t){var r=null==e?0:e.length,n=di(e,t);return go(e,xr(t,function(e){return oa(e,r)?+e:e}).sort(Qo)),n});function lu(e,t){var r=[];if(!e||!e.length)return r;var n=-1,i=[],o=e.length;for(t=Hs(t,3);++n<o;){var s=e[n];t(s,n,e)&&(r.push(s),i.push(n))}return go(e,i),r}function hu(e){return null==e?e:Wt.call(e)}function pu(e,t,r){var n=null==e?0:e.length;return n?(r&&"number"!=typeof r&&sa(e,t,r)?(t=0,r=n):(t=null==t?0:Wf(t),r=r===o?n:Wf(r)),Io(e,t,r)):[]}function du(e,t){return Bo(e,t)}function yu(e,t,r){return Co(e,t,Hs(r,2))}function gu(e,t){var r=null==e?0:e.length;if(r){var n=Bo(e,t);if(n<r&&rf(e[n],t))return n}return-1}function mu(e,t){return Bo(e,t,!0)}function bu(e,t,r){return Co(e,t,Hs(r,2),!0)}function vu(e,t){var r=null==e?0:e.length;if(r){var n=Bo(e,t,!0)-1;if(rf(e[n],t))return n}return-1}function _u(e){return e&&e.length?Po(e):[]}function wu(e,t){return e&&e.length?Po(e,Hs(t,2)):[]}function Su(e){var t=null==e?0:e.length;return t?Io(e,1,t):[]}function ku(e,t,r){return e&&e.length?(t=r||t===o?1:Wf(t),Io(e,0,t<0?0:t)):[]}function Eu(e,t,r){var n=null==e?0:e.length;return n?(t=r||t===o?1:Wf(t),t=n-t,Io(e,t<0?0:t,n)):[]}function Au(e,t){return e&&e.length?Mo(e,Hs(t,3),!1,!0):[]}function xu(e,t){return e&&e.length?Mo(e,Hs(t,3)):[]}var Iu=_o(function(e){return No(Ii(e,1,ff,!0))}),Tu=_o(function(e){var t=nu(e);return ff(t)&&(t=o),No(Ii(e,1,ff,!0),Hs(t,2))}),Bu=_o(function(e){var t=nu(e);return t="function"==typeof t?t:o,No(Ii(e,1,ff,!0),o,t)});function Cu(e){return e&&e.length?No(e):[]}function Pu(e,t){return e&&e.length?No(e,Hs(t,2)):[]}function Ou(e,t){return t="function"==typeof t?t:o,e&&e.length?No(e,o,t):[]}function Ru(e){if(!e||!e.length)return[];var t=0;return e=kr(e,function(e){if(ff(e))return t=Ut(e.length,t),!0}),Vr(t,function(t){return xr(e,Ur(t))})}function Nu(e,t){if(!e||!e.length)return[];var r=Ru(e);return null==t?r:xr(r,function(e){return br(t,o,e)})}var Lu=_o(function(e,t){return ff(e)?_i(e,t):[]}),ju=_o(function(e){return Do(kr(e,ff))}),Mu=_o(function(e){var t=nu(e);return ff(t)&&(t=o),Do(kr(e,ff),Hs(t,2))}),Ku=_o(function(e){var t=nu(e);return t="function"==typeof t?t:o,Do(kr(e,ff),o,t)}),Du=_o(Ru);function Uu(e,t){return Uo(e||[],t||[],ui)}function Fu(e,t){return Uo(e||[],t||[],ko)}var qu=_o(function(e){var t=e.length,r=t>1?e[t-1]:o;return r="function"==typeof r?(e.pop(),r):o,Nu(e,r)});function Hu(e){var t=wn(e);return t.__chain__=!0,t}function zu(e,t){return t(e),e}function Vu(e,t){return t(e)}var Gu=Ms(function(e){var t=e.length,r=t?e[0]:0,n=this.__wrapped__,i=function(t){return di(t,e)};return!(t>1||this.__actions__.length)&&n instanceof xn&&oa(r)?(n=n.slice(r,+r+(t?1:0)),n.__actions__.push({func:Vu,args:[i],thisArg:o}),new An(n,this.__chain__).thru(function(e){return t&&!e.length&&e.push(o),e})):this.thru(i)});function Wu(){return Hu(this)}function $u(){return new An(this.value(),this.__chain__)}function Yu(){this.__values__===o&&(this.__values__=Vf(this.value()));var e=this.__index__>=this.__values__.length,t=e?o:this.__values__[this.__index__++];return{done:e,value:t}}function Ju(){return this}function Xu(e){for(var t,r=this;r instanceof En;){var n=Oa(r);n.__index__=0,n.__values__=o,t?i.__wrapped__=n:t=n;var i=n;r=r.__wrapped__}return i.__wrapped__=e,t}function Zu(){var e=this.__wrapped__;if(e instanceof xn){var t=e;return this.__actions__.length&&(t=new xn(this)),t=t.reverse(),t.__actions__.push({func:Vu,args:[hu],thisArg:o}),new An(t,this.__chain__)}return this.thru(hu)}function Qu(){return Ko(this.__wrapped__,this.__actions__)}var ec=as(function(e,t,r){ft.call(e,r)?++e[r]:pi(e,r,1)});function tc(e,t,r){var n=af(e)?Sr:ki;return r&&sa(e,t,r)&&(t=o),n(e,Hs(t,3))}function rc(e,t){var r=af(e)?kr:xi;return r(e,Hs(t,3))}var nc=gs(za),ic=gs(Va);function oc(e,t){return Ii(dc(e,t),1)}function sc(e,t){return Ii(dc(e,t),L)}function ac(e,t,r){return r=r===o?1:Wf(r),Ii(dc(e,t),r)}function uc(e,t){var r=af(e)?_r:wi;return r(e,Hs(t,3))}function cc(e,t){var r=af(e)?wr:Si;return r(e,Hs(t,3))}var fc=as(function(e,t,r){ft.call(e,r)?e[r].push(t):pi(e,r,[t])});function lc(e,t,r,n){e=cf(e)?e:Ul(e),r=r&&!n?Wf(r):0;var i=e.length;return r<0&&(r=Ut(i+r,0)),Mf(e)?r<=i&&e.indexOf(t,r)>-1:!!i&&jr(e,t,r)>-1}var hc=_o(function(e,t,n){var i=-1,o="function"==typeof t,s=cf(e)?r(e.length):[];return wi(e,function(e){s[++i]=o?br(t,e,n):qi(e,t,n)}),s}),pc=as(function(e,t,r){pi(e,r,t)});function dc(e,t){var r=af(e)?xr:io;return r(e,Hs(t,3))}function yc(e,t,r,n){return null==e?[]:(af(t)||(t=null==t?[]:[t]),r=n?o:r,af(r)||(r=null==r?[]:[r]),fo(e,t,r))}var gc=as(function(e,t,r){e[r?0:1].push(t)},function(){return[[],[]]});function mc(e,t,r){var n=af(e)?Tr:qr,i=arguments.length<3;return n(e,Hs(t,4),r,i,wi)}function bc(e,t,r){var n=af(e)?Br:qr,i=arguments.length<3;return n(e,Hs(t,4),r,i,Si)}function vc(e,t){var r=af(e)?kr:xi;return r(e,Dc(Hs(t,3)))}function _c(e){var t=af(e)?ii:wo;return t(e)}function wc(e,t,r){t=(r?sa(e,t,r):t===o)?1:Wf(t);var n=af(e)?oi:So;return n(e,t)}function Sc(e){var t=af(e)?si:xo;return t(e)}function kc(e){if(null==e)return 0;if(cf(e))return Mf(e)?yn(e):e.length;var t=Js(e);return t==Z||t==oe?e.size:to(e).length}function Ec(e,t,r){var n=af(e)?Cr:To;return r&&sa(e,t,r)&&(t=o),n(e,Hs(t,3))}var Ac=_o(function(e,t){if(null==e)return[];var r=t.length;return r>1&&sa(e,t[0],t[1])?t=[]:r>2&&sa(t[0],t[1],t[2])&&(t=[t[0]]),fo(e,Ii(t,1),[])}),xc=Pt||function(){return sr.Date.now()};function Ic(e,t){if("function"!=typeof t)throw new it(c);return e=Wf(e),function(){if(--e<1)return t.apply(this,arguments)}}function Tc(e,t,r){return t=r?o:t,t=e&&null==t?e.length:t,Cs(e,A,o,o,o,o,t)}function Bc(e,t){var r;if("function"!=typeof t)throw new it(c);return e=Wf(e),function(){return--e>0&&(r=t.apply(this,arguments)),e<=1&&(t=o),r}}var Cc=_o(function(e,t,r){var n=b;if(r.length){var i=cn(r,qs(Cc));n|=k}return Cs(e,n,t,r,i)}),Pc=_o(function(e,t,r){var n=b|v;if(r.length){var i=cn(r,qs(Pc));n|=k}return Cs(t,n,e,r,i)});function Oc(e,t,r){t=r?o:t;var n=Cs(e,w,o,o,o,o,o,t);return n.placeholder=Oc.placeholder,n}function Rc(e,t,r){t=r?o:t;var n=Cs(e,S,o,o,o,o,o,t);return n.placeholder=Rc.placeholder,n}function Nc(e,t,r){var n,i,s,a,u,f,l=0,h=!1,p=!1,d=!0;if("function"!=typeof e)throw new it(c);function y(t){var r=n,s=i;return n=i=o,l=t,a=e.apply(s,r),a}function g(e){return l=e,u=ka(v,t),h?y(e):a}function m(e){var r=e-f,n=e-l,i=t-r;return p?Ft(i,s-n):i}function b(e){var r=e-f,n=e-l;return f===o||r>=t||r<0||p&&n>=s}function v(){var e=xc();if(b(e))return _(e);u=ka(v,m(e))}function _(e){return u=o,d&&n?y(e):(n=i=o,a)}function w(){u!==o&&Go(u),l=0,n=f=i=u=o}function S(){return u===o?a:_(xc())}function k(){var e=xc(),r=b(e);if(n=arguments,i=this,f=e,r){if(u===o)return g(f);if(p)return u=ka(v,t),y(f)}return u===o&&(u=ka(v,t)),a}return t=Yf(t)||0,kf(r)&&(h=!!r.leading,p="maxWait"in r,s=p?Ut(Yf(r.maxWait)||0,t):s,d="trailing"in r?!!r.trailing:d),k.cancel=w,k.flush=S,k}var Lc=_o(function(e,t){return vi(e,1,t)}),jc=_o(function(e,t,r){return vi(e,Yf(t)||0,r)});function Mc(e){return Cs(e,I)}function Kc(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new it(c);var r=function(){var n=arguments,i=t?t.apply(this,n):n[0],o=r.cache;if(o.has(i))return o.get(i);var s=e.apply(this,n);return r.cache=o.set(i,s)||o,s};return r.cache=new(Kc.Cache||qn),r}function Dc(e){if("function"!=typeof e)throw new it(c);return function(){var t=arguments;switch(t.length){case 0:return!e.call(this);case 1:return!e.call(this,t[0]);case 2:return!e.call(this,t[0],t[1]);case 3:return!e.call(this,t[0],t[1],t[2])}return!e.apply(this,t)}}function Uc(e){return Bc(2,e)}Kc.Cache=qn;var Fc=zo(function(e,t){t=1==t.length&&af(t[0])?xr(t[0],Wr(Hs())):xr(Ii(t,1),Wr(Hs()));var r=t.length;return _o(function(n){for(var i=-1,o=Ft(n.length,r);++i<o;)n[i]=t[i].call(this,n[i]);return br(e,this,n)})}),qc=_o(function(e,t){var r=cn(t,qs(qc));return Cs(e,k,o,t,r)}),Hc=_o(function(e,t){var r=cn(t,qs(Hc));return Cs(e,E,o,t,r)}),zc=Ms(function(e,t){return Cs(e,x,o,o,o,t)});function Vc(e,t){if("function"!=typeof e)throw new it(c);return t=t===o?t:Wf(t),_o(e,t)}function Gc(e,t){if("function"!=typeof e)throw new it(c);return t=null==t?0:Ut(Wf(t),0),_o(function(r){var n=r[t],i=Vo(r,0,t);return n&&Ir(i,n),br(e,this,i)})}function Wc(e,t,r){var n=!0,i=!0;if("function"!=typeof e)throw new it(c);return kf(r)&&(n="leading"in r?!!r.leading:n,i="trailing"in r?!!r.trailing:i),Nc(e,t,{leading:n,maxWait:t,trailing:i})}function $c(e){return Tc(e,1)}function Yc(e,t){return qc(qo(t),e)}function Jc(){if(!arguments.length)return[];var e=arguments[0];return af(e)?e:[e]}function Xc(e){return gi(e,y)}function Zc(e,t){return t="function"==typeof t?t:o,gi(e,y,t)}function Qc(e){return gi(e,p|y)}function ef(e,t){return t="function"==typeof t?t:o,gi(e,p|y,t)}function tf(e,t){return null==t||bi(e,t,wl(t))}function rf(e,t){return e===t||e!=e&&t!=t}var nf=As(ji),of=As(function(e,t){return e>=t}),sf=Hi(function(){return arguments}())?Hi:function(e){return Ef(e)&&ft.call(e,"callee")&&!Et.call(e,"callee")},af=r.isArray,uf=hr?Wr(hr):zi;function cf(e){return null!=e&&Sf(e.length)&&!_f(e)}function ff(e){return Ef(e)&&cf(e)}function lf(e){return!0===e||!1===e||Ef(e)&&Li(e)==G}var hf=jt||Wh,pf=pr?Wr(pr):Vi;function df(e){return Ef(e)&&1===e.nodeType&&!Rf(e)}function yf(e){if(null==e)return!0;if(cf(e)&&(af(e)||"string"==typeof e||"function"==typeof e.splice||hf(e)||Df(e)||sf(e)))return!e.length;var t=Js(e);if(t==Z||t==oe)return!e.size;if(ha(e))return!to(e).length;for(var r in e)if(ft.call(e,r))return!1;return!0}function gf(e,t){return Gi(e,t)}function mf(e,t,r){r="function"==typeof r?r:o;var n=r?r(e,t):o;return n===o?Gi(e,t,o,r):!!n}function bf(e){if(!Ef(e))return!1;var t=Li(e);return t==Y||t==$||"string"==typeof e.message&&"string"==typeof e.name&&!Rf(e)}function vf(e){return"number"==typeof e&&Mt(e)}function _f(e){if(!kf(e))return!1;var t=Li(e);return t==J||t==X||t==V||t==ne}function wf(e){return"number"==typeof e&&e==Wf(e)}function Sf(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=j}function kf(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}function Ef(e){return null!=e&&"object"==typeof e}var Af=dr?Wr(dr):$i;function xf(e,t){return e===t||Yi(e,t,Vs(t))}function If(e,t,r){return r="function"==typeof r?r:o,Yi(e,t,Vs(t),r)}function Tf(e){return Of(e)&&e!=+e}function Bf(e){if(la(e))throw new i(u);return Ji(e)}function Cf(e){return null===e}function Pf(e){return null==e}function Of(e){return"number"==typeof e||Ef(e)&&Li(e)==Q}function Rf(e){if(!Ef(e)||Li(e)!=te)return!1;var t=St(e);if(null===t)return!0;var r=ft.call(t,"constructor")&&t.constructor;return"function"==typeof r&&r instanceof r&&ct.call(r)==yt}var Nf=yr?Wr(yr):Xi;function Lf(e){return wf(e)&&e>=-j&&e<=j}var jf=gr?Wr(gr):Zi;function Mf(e){return"string"==typeof e||!af(e)&&Ef(e)&&Li(e)==se}function Kf(e){return"symbol"==typeof e||Ef(e)&&Li(e)==ae}var Df=mr?Wr(mr):Qi;function Uf(e){return e===o}function Ff(e){return Ef(e)&&Js(e)==ce}function qf(e){return Ef(e)&&Li(e)==fe}var Hf=As(no),zf=As(function(e,t){return e<=t});function Vf(e){if(!e)return[];if(cf(e))return Mf(e)?gn(e):ns(e);if(It&&e[It])return sn(e[It]());var t=Js(e),r=t==Z?an:t==oe?ln:Ul;return r(e)}function Gf(e){if(!e)return 0===e?e:0;if(e=Yf(e),e===L||e===-L){var t=e<0?-1:1;return t*M}return e==e?e:0}function Wf(e){var t=Gf(e),r=t%1;return t==t?r?t-r:t:0}function $f(e){return e?yi(Wf(e),0,D):0}function Yf(e){if("number"==typeof e)return e;if(Kf(e))return K;if(kf(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=kf(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=e.replace(Me,"");var r=$e.test(e);return r||Je.test(e)?nr(e.slice(2),r?2:8):We.test(e)?K:+e}function Jf(e){return is(e,Sl(e))}function Xf(e){return e?yi(Wf(e),-j,j):0===e?e:0}function Zf(e){return null==e?"":Ro(e)}var Qf=us(function(e,t){if(ha(t)||cf(t))is(t,wl(t),e);else for(var r in t)ft.call(t,r)&&ui(e,r,t[r])}),el=us(function(e,t){is(t,Sl(t),e)}),tl=us(function(e,t,r,n){is(t,Sl(t),e,n)}),rl=us(function(e,t,r,n){is(t,wl(t),e,n)}),nl=Ms(di);function il(e,t){var r=kn(e);return null==t?r:li(r,t)}var ol=_o(function(e,t){e=tt(e);var r=-1,n=t.length,i=n>2?t[2]:o;for(i&&sa(t[0],t[1],i)&&(n=1);++r<n;)for(var s=t[r],a=Sl(s),u=-1,c=a.length;++u<c;){var f=a[u],l=e[f];(l===o||rf(l,at[f])&&!ft.call(e,f))&&(e[f]=s[f])}return e}),sl=_o(function(e){return e.push(o,Os),br(xl,o,e)});function al(e,t){return Nr(e,Hs(t,3),Ci)}function ul(e,t){return Nr(e,Hs(t,3),Pi)}function cl(e,t){return null==e?e:Ti(e,Hs(t,3),Sl)}function fl(e,t){return null==e?e:Bi(e,Hs(t,3),Sl)}function ll(e,t){return e&&Ci(e,Hs(t,3))}function hl(e,t){return e&&Pi(e,Hs(t,3))}function pl(e){return null==e?[]:Oi(e,wl(e))}function dl(e){return null==e?[]:Oi(e,Sl(e))}function yl(e,t,r){var n=null==e?o:Ri(e,t);return n===o?r:n}function gl(e,t){return null!=e&&Qs(e,t,Mi)}function ml(e,t){return null!=e&&Qs(e,t,Ki)}var bl=vs(function(e,t,r){null!=t&&"function"!=typeof t.toString&&(t=dt.call(t)),e[t]=r},Ah(Bh)),vl=vs(function(e,t,r){null!=t&&"function"!=typeof t.toString&&(t=dt.call(t)),ft.call(e,t)?e[t].push(r):e[t]=[r]},Hs),_l=_o(qi);function wl(e){return cf(e)?ni(e):to(e)}function Sl(e){return cf(e)?ni(e,!0):ro(e)}function kl(e,t){var r={};return t=Hs(t,3),Ci(e,function(e,n,i){pi(r,t(e,n,i),e)}),r}function El(e,t){var r={};return t=Hs(t,3),Ci(e,function(e,n,i){pi(r,n,t(e,n,i))}),r}var Al=us(function(e,t,r){ao(e,t,r)}),xl=us(function(e,t,r,n){ao(e,t,r,n)}),Il=Ms(function(e,t){var r={};if(null==e)return r;var n=!1;t=xr(t,function(t){return t=Ho(t,e),n||(n=t.length>1),t}),is(e,Ds(e),r),n&&(r=gi(r,p|d|y,Rs));for(var i=t.length;i--;)Lo(r,t[i]);return r});function Tl(e,t){return Cl(e,Dc(Hs(t)))}var Bl=Ms(function(e,t){return null==e?{}:lo(e,t)});function Cl(e,t){if(null==e)return{};var r=xr(Ds(e),function(e){return[e]});return t=Hs(t),ho(e,r,function(e,r){return t(e,r[0])})}function Pl(e,t,r){t=Ho(t,e);var n=-1,i=t.length;for(i||(i=1,e=o);++n<i;){var s=null==e?o:e[Ba(t[n])];s===o&&(n=i,s=r),e=_f(s)?s.call(e):s}return e}function Ol(e,t,r){return null==e?e:ko(e,t,r)}function Rl(e,t,r,n){return n="function"==typeof n?n:o,null==e?e:ko(e,t,r,n)}var Nl=Bs(wl),Ll=Bs(Sl);function jl(e,t,r){var n=af(e),i=n||hf(e)||Df(e);if(t=Hs(t,4),null==r){var o=e&&e.constructor;r=i?n?new o:[]:kf(e)&&_f(o)?kn(St(e)):{}}return(i?_r:Ci)(e,function(e,n,i){return t(r,e,n,i)}),r}function Ml(e,t){return null==e||Lo(e,t)}function Kl(e,t,r){return null==e?e:jo(e,t,qo(r))}function Dl(e,t,r,n){return n="function"==typeof n?n:o,null==e?e:jo(e,t,qo(r),n)}function Ul(e){return null==e?[]:$r(e,wl(e))}function Fl(e){return null==e?[]:$r(e,Sl(e))}function ql(e,t,r){return r===o&&(r=t,t=o),r!==o&&(r=Yf(r),r=r==r?r:0),t!==o&&(t=Yf(t),t=t==t?t:0),yi(Yf(e),t,r)}function Hl(e,t,r){return t=Gf(t),r===o?(r=t,t=0):r=Gf(r),e=Yf(e),Di(e,t,r)}function zl(e,t,r){if(r&&"boolean"!=typeof r&&sa(e,t,r)&&(t=r=o),r===o&&("boolean"==typeof t?(r=t,t=o):"boolean"==typeof e&&(r=e,e=o)),e===o&&t===o?(e=0,t=1):(e=Gf(e),t===o?(t=e,e=0):t=Gf(t)),e>t){var n=e;e=t,t=n}if(r||e%1||t%1){var i=Gt();return Ft(e+i*(t-e+rr("1e-"+((i+"").length-1))),t)}return mo(e,t)}var Vl=ps(function(e,t,r){return t=t.toLowerCase(),e+(r?Gl(t):t)});function Gl(e){return vh(Zf(e).toLowerCase())}function Wl(e){return e=Zf(e),e&&e.replace(Ze,Qr).replace(Ht,"")}function $l(e,t,r){e=Zf(e),t=Ro(t);var n=e.length;r=r===o?n:yi(Wf(r),0,n);var i=r;return r-=t.length,r>=0&&e.slice(r,i)==t}function Yl(e){return e=Zf(e),e&&Te.test(e)?e.replace(xe,en):e}function Jl(e){return e=Zf(e),e&&je.test(e)?e.replace(Le,"\\$&"):e}var Xl=ps(function(e,t,r){return e+(r?"-":"")+t.toLowerCase()}),Zl=ps(function(e,t,r){return e+(r?" ":"")+t.toLowerCase()}),Ql=hs("toLowerCase");function eh(e,t,r){e=Zf(e),t=Wf(t);var n=t?yn(e):0;if(!t||n>=t)return e;var i=(t-n)/2;return Ss(Nt(i),r)+e+Ss(Rt(i),r)}function th(e,t,r){e=Zf(e),t=Wf(t);var n=t?yn(e):0;return t&&n<t?e+Ss(t-n,r):e}function rh(e,t,r){e=Zf(e),t=Wf(t);var n=t?yn(e):0;return t&&n<t?Ss(t-n,r)+e:e}function nh(e,t,r){return r||null==t?t=0:t&&(t=+t),Vt(Zf(e).replace(Ke,""),t||0)}function ih(e,t,r){return t=(r?sa(e,t,r):t===o)?1:Wf(t),vo(Zf(e),t)}function oh(){var e=arguments,t=Zf(e[0]);return e.length<3?t:t.replace(e[1],e[2])}var sh=ps(function(e,t,r){return e+(r?"_":"")+t.toLowerCase()});function ah(e,t,r){return r&&"number"!=typeof r&&sa(e,t,r)&&(t=r=o),r=r===o?D:r>>>0,r?(e=Zf(e),e&&("string"==typeof t||null!=t&&!Nf(t))&&(t=Ro(t),!t&&nn(e))?Vo(gn(e),0,r):e.split(t,r)):[]}var uh=ps(function(e,t,r){return e+(r?" ":"")+vh(t)});function ch(e,t,r){return e=Zf(e),r=null==r?0:yi(Wf(r),0,e.length),t=Ro(t),e.slice(r,r+t.length)==t}function fh(e,t,r){var n=wn.templateSettings;r&&sa(e,t,r)&&(t=o),e=Zf(e),t=tl({},t,n,Ps);var i=tl({},t.imports,n.imports,Ps),s=wl(i),a=$r(i,s),u,c,f=0,l=t.interpolate||Qe,h="__p += '",p=rt((t.escape||Qe).source+"|"+l.source+"|"+(l===Pe?Ve:Qe).source+"|"+(t.evaluate||Qe).source+"|$","g"),d="//# sourceURL="+("sourceURL"in t?t.sourceURL:"lodash.templateSources["+ ++Yt+"]")+"\n";e.replace(p,function(t,r,n,i,o,s){return n||(n=i),h+=e.slice(f,s).replace(et,tn),r&&(u=!0,h+="' +\n__e("+r+") +\n'"),o&&(c=!0,h+="';\n"+o+";\n__p += '"),n&&(h+="' +\n((__t = ("+n+")) == null ? '' : __t) +\n'"),f=s+t.length,t}),h+="';\n";var y=t.variable;y||(h="with (obj) {\n"+h+"\n}\n"),h=(c?h.replace(Se,""):h).replace(ke,"$1").replace(Ee,"$1;"),h="function("+(y||"obj")+") {\n"+(y?"":"obj || (obj = {});\n")+"var __t, __p = ''"+(u?", __e = _.escape":"")+(c?", __j = Array.prototype.join;\nfunction print() { __p += __j.call(arguments, '') }\n":";\n")+h+"return __p\n}";var g=wh(function(){return N(s,d+"return "+h).apply(o,a)});if(g.source=h,bf(g))throw g;return g}function lh(e){return Zf(e).toLowerCase()}function hh(e){return Zf(e).toUpperCase()}function ph(e,t,r){if(e=Zf(e),e&&(r||t===o))return e.replace(Me,"");if(!e||!(t=Ro(t)))return e;var n=gn(e),i=gn(t),s=Jr(n,i),a=Xr(n,i)+1;return Vo(n,s,a).join("")}function dh(e,t,r){if(e=Zf(e),e&&(r||t===o))return e.replace(De,"");if(!e||!(t=Ro(t)))return e;var n=gn(e),i=Xr(n,gn(t))+1;return Vo(n,0,i).join("")}function yh(e,t,r){if(e=Zf(e),e&&(r||t===o))return e.replace(Ke,"");if(!e||!(t=Ro(t)))return e;var n=gn(e),i=Jr(n,gn(t));return Vo(n,i).join("")}function gh(e,t){var r=T,n=B;if(kf(t)){var i="separator"in t?t.separator:i;r="length"in t?Wf(t.length):r,n="omission"in t?Ro(t.omission):n}e=Zf(e);var s=e.length;if(nn(e)){var a=gn(e);s=a.length}if(r>=s)return e;var u=r-yn(n);if(u<1)return n;var c=a?Vo(a,0,u).join(""):e.slice(0,u);if(i===o)return c+n;if(a&&(u+=c.length-u),Nf(i)){if(e.slice(u).search(i)){var f,l=c;for(i.global||(i=rt(i.source,Zf(Ge.exec(i))+"g")),i.lastIndex=0;f=i.exec(l);)var h=f.index;c=c.slice(0,h===o?u:h)}}else if(e.indexOf(Ro(i),u)!=u){var p=c.lastIndexOf(i);p>-1&&(c=c.slice(0,p))}return c+n}function mh(e){return e=Zf(e),e&&Ie.test(e)?e.replace(Ae,mn):e}var bh=ps(function(e,t,r){return e+(r?" ":"")+t.toUpperCase()}),vh=hs("toUpperCase");function _h(e,t,r){return e=Zf(e),t=r?o:t,t===o?on(e)?_n(e):Rr(e):e.match(t)||[]}var wh=_o(function(e,t){try{return br(e,o,t)}catch(e){return bf(e)?e:new i(e)}}),Sh=Ms(function(e,t){return _r(t,function(t){t=Ba(t),pi(e,t,Cc(e[t],e))}),e});function kh(e){var t=null==e?0:e.length,r=Hs();return e=t?xr(e,function(e){if("function"!=typeof e[1])throw new it(c);return[r(e[0]),e[1]]}):[],_o(function(r){for(var n=-1;++n<t;){var i=e[n];if(br(i[0],this,r))return br(i[1],this,r)}})}function Eh(e){return mi(gi(e,p))}function Ah(e){return function(){return e}}function xh(e,t){return null==e||e!=e?t:e}var Ih=ms(),Th=ms(!0);function Bh(e){return e}function Ch(e){return eo("function"==typeof e?e:gi(e,p))}function Ph(e){return oo(gi(e,p))}function Oh(e,t){return so(e,gi(t,p))}var Rh=_o(function(e,t){return function(r){return qi(r,e,t)}}),Nh=_o(function(e,t){return function(r){return qi(e,r,t)}});function Lh(e,t,r){var n=wl(t),i=Oi(t,n);null!=r||kf(t)&&(i.length||!n.length)||(r=t,t=e,e=this,i=Oi(t,wl(t)));var o=!(kf(r)&&"chain"in r&&!r.chain),s=_f(e);return _r(i,function(r){var n=t[r];e[r]=n,s&&(e.prototype[r]=function(){var t=this.__chain__;if(o||t){var r=e(this.__wrapped__),i=r.__actions__=ns(this.__actions__);return i.push({func:n,args:arguments,thisArg:e}),r.__chain__=t,r}return n.apply(e,Ir([this.value()],arguments))})}),e}function jh(){return sr._===this&&(sr._=gt),this}function Mh(){}function Kh(e){return e=Wf(e),_o(function(t){return co(t,e)})}var Dh=ws(xr),Uh=ws(Sr),Fh=ws(Cr);function qh(e){return aa(e)?Ur(Ba(e)):po(e)}function Hh(e){return function(t){return null==e?o:Ri(e,t)}}var zh=Es(),Vh=Es(!0);function Gh(){return[]}function Wh(){return!1}function $h(){return{}}function Yh(){return""}function Jh(){return!0}function Xh(e,t){if(e=Wf(e),e<1||e>j)return[];var r=D,n=Ft(e,D);t=Hs(t),e-=D;for(var i=Vr(n,t);++r<e;)t(r);return i}function Zh(e){return af(e)?xr(e,Ba):Kf(e)?[e]:ns(Ta(Zf(e)))}function Qh(e){var t=++lt;return Zf(e)+t}var ep=_s(function(e,t){return e+t},0),tp=Is("ceil"),rp=_s(function(e,t){return e/t},1),np=Is("floor");function ip(e){return e&&e.length?Ei(e,Bh,ji):o}function op(e,t){return e&&e.length?Ei(e,Hs(t,2),ji):o}function sp(e){return Dr(e,Bh)}function ap(e,t){return Dr(e,Hs(t,2))}function up(e){return e&&e.length?Ei(e,Bh,no):o}function cp(e,t){return e&&e.length?Ei(e,Hs(t,2),no):o}var fp=_s(function(e,t){return e*t},1),lp=Is("round"),hp=_s(function(e,t){return e-t},0),pp;function dp(e){return e&&e.length?zr(e,Bh):0}function yp(e,t){return e&&e.length?zr(e,Hs(t,2)):0}return wn.after=Ic,wn.ary=Tc,wn.assign=Qf,wn.assignIn=el,wn.assignInWith=tl,wn.assignWith=rl,wn.at=nl,wn.before=Bc,wn.bind=Cc,wn.bindAll=Sh,wn.bindKey=Pc,wn.castArray=Jc,wn.chain=Hu,wn.chunk=Ra,wn.compact=Na,wn.concat=La,wn.cond=kh,wn.conforms=Eh,wn.constant=Ah,wn.countBy=ec,wn.create=il,wn.curry=Oc,wn.curryRight=Rc,wn.debounce=Nc,wn.defaults=ol,wn.defaultsDeep=sl,wn.defer=Lc,wn.delay=jc,wn.difference=ja,wn.differenceBy=Ma,wn.differenceWith=Ka,wn.drop=Da,wn.dropRight=Ua,wn.dropRightWhile=Fa,wn.dropWhile=qa,wn.fill=Ha,wn.filter=rc,wn.flatMap=oc,wn.flatMapDeep=sc,wn.flatMapDepth=ac,wn.flatten=Ga,wn.flattenDeep=Wa,wn.flattenDepth=$a,wn.flip=Mc,wn.flow=Ih,wn.flowRight=Th,wn.fromPairs=Ya,wn.functions=pl,wn.functionsIn=dl,wn.groupBy=fc,wn.initial=Za,wn.intersection=Qa,wn.intersectionBy=eu,wn.intersectionWith=tu,wn.invert=bl,wn.invertBy=vl,wn.invokeMap=hc,wn.iteratee=Ch,wn.keyBy=pc,wn.keys=wl,wn.keysIn=Sl,wn.map=dc,wn.mapKeys=kl,wn.mapValues=El,wn.matches=Ph,wn.matchesProperty=Oh,wn.memoize=Kc,wn.merge=Al,wn.mergeWith=xl,wn.method=Rh,wn.methodOf=Nh,wn.mixin=Lh,wn.negate=Dc,wn.nthArg=Kh,wn.omit=Il,wn.omitBy=Tl,wn.once=Uc,wn.orderBy=yc,wn.over=Dh,wn.overArgs=Fc,wn.overEvery=Uh,wn.overSome=Fh,wn.partial=qc,wn.partialRight=Hc,wn.partition=gc,wn.pick=Bl,wn.pickBy=Cl,wn.property=qh,wn.propertyOf=Hh,wn.pull=su,wn.pullAll=au,wn.pullAllBy=uu,wn.pullAllWith=cu,wn.pullAt=fu,wn.range=zh,wn.rangeRight=Vh,wn.rearg=zc,wn.reject=vc,wn.remove=lu,wn.rest=Vc,wn.reverse=hu,wn.sampleSize=wc,wn.set=Ol,wn.setWith=Rl,wn.shuffle=Sc,wn.slice=pu,wn.sortBy=Ac,wn.sortedUniq=_u,wn.sortedUniqBy=wu,wn.split=ah,wn.spread=Gc,wn.tail=Su,wn.take=ku,wn.takeRight=Eu,wn.takeRightWhile=Au,wn.takeWhile=xu,wn.tap=zu,wn.throttle=Wc,wn.thru=Vu,wn.toArray=Vf,wn.toPairs=Nl,wn.toPairsIn=Ll,wn.toPath=Zh,wn.toPlainObject=Jf,wn.transform=jl,wn.unary=$c,wn.union=Iu,wn.unionBy=Tu,wn.unionWith=Bu,wn.uniq=Cu,wn.uniqBy=Pu,wn.uniqWith=Ou,wn.unset=Ml,wn.unzip=Ru,wn.unzipWith=Nu,wn.update=Kl,wn.updateWith=Dl,wn.values=Ul,wn.valuesIn=Fl,wn.without=Lu,wn.words=_h,wn.wrap=Yc,wn.xor=ju,wn.xorBy=Mu,wn.xorWith=Ku,wn.zip=Du,wn.zipObject=Uu,wn.zipObjectDeep=Fu,wn.zipWith=qu,wn.entries=Nl,wn.entriesIn=Ll,wn.extend=el,wn.extendWith=tl,Lh(wn,wn),wn.add=ep,wn.attempt=wh,wn.camelCase=Vl,wn.capitalize=Gl,wn.ceil=tp,wn.clamp=ql,wn.clone=Xc,wn.cloneDeep=Qc,wn.cloneDeepWith=ef,wn.cloneWith=Zc,wn.conformsTo=tf,wn.deburr=Wl,wn.defaultTo=xh,wn.divide=rp,wn.endsWith=$l,wn.eq=rf,wn.escape=Yl,wn.escapeRegExp=Jl,wn.every=tc,wn.find=nc,wn.findIndex=za,wn.findKey=al,wn.findLast=ic,wn.findLastIndex=Va,wn.findLastKey=ul,wn.floor=np,wn.forEach=uc,wn.forEachRight=cc,wn.forIn=cl,wn.forInRight=fl,wn.forOwn=ll,wn.forOwnRight=hl,wn.get=yl,wn.gt=nf,wn.gte=of,wn.has=gl,wn.hasIn=ml,wn.head=Ja,wn.identity=Bh,wn.includes=lc,wn.indexOf=Xa,wn.inRange=Hl,wn.invoke=_l,wn.isArguments=sf,wn.isArray=af,wn.isArrayBuffer=uf,wn.isArrayLike=cf,wn.isArrayLikeObject=ff,wn.isBoolean=lf,wn.isBuffer=hf,wn.isDate=pf,wn.isElement=df,wn.isEmpty=yf,wn.isEqual=gf,wn.isEqualWith=mf,wn.isError=bf,wn.isFinite=vf,wn.isFunction=_f,wn.isInteger=wf,wn.isLength=Sf,wn.isMap=Af,wn.isMatch=xf,wn.isMatchWith=If,wn.isNaN=Tf,wn.isNative=Bf,wn.isNil=Pf,wn.isNull=Cf,wn.isNumber=Of,wn.isObject=kf,wn.isObjectLike=Ef,wn.isPlainObject=Rf,wn.isRegExp=Nf,wn.isSafeInteger=Lf,wn.isSet=jf,wn.isString=Mf,wn.isSymbol=Kf,wn.isTypedArray=Df,wn.isUndefined=Uf,wn.isWeakMap=Ff,wn.isWeakSet=qf,wn.join=ru,wn.kebabCase=Xl,wn.last=nu,wn.lastIndexOf=iu,wn.lowerCase=Zl,wn.lowerFirst=Ql,wn.lt=Hf,wn.lte=zf,wn.max=ip,wn.maxBy=op,wn.mean=sp,wn.meanBy=ap,wn.min=up,wn.minBy=cp,wn.stubArray=Gh,wn.stubFalse=Wh,wn.stubObject=$h,wn.stubString=Yh,wn.stubTrue=Jh,wn.multiply=fp,wn.nth=ou,wn.noConflict=jh,wn.noop=Mh,wn.now=xc,wn.pad=eh,wn.padEnd=th,wn.padStart=rh,wn.parseInt=nh,wn.random=zl,wn.reduce=mc,wn.reduceRight=bc,wn.repeat=ih,wn.replace=oh,wn.result=Pl,wn.round=lp,wn.runInContext=e,wn.sample=_c,wn.size=kc,wn.snakeCase=sh,wn.some=Ec,wn.sortedIndex=du,wn.sortedIndexBy=yu,wn.sortedIndexOf=gu,wn.sortedLastIndex=mu,wn.sortedLastIndexBy=bu,wn.sortedLastIndexOf=vu,wn.startCase=uh,wn.startsWith=ch,wn.subtract=hp,wn.sum=dp,wn.sumBy=yp,wn.template=fh,wn.times=Xh,wn.toFinite=Gf,wn.toInteger=Wf,wn.toLength=$f,wn.toLower=lh,wn.toNumber=Yf,wn.toSafeInteger=Xf,wn.toString=Zf,wn.toUpper=hh,wn.trim=ph,wn.trimEnd=dh,wn.trimStart=yh,wn.truncate=gh,wn.unescape=mh,wn.uniqueId=Qh,wn.upperCase=bh,wn.upperFirst=vh,wn.each=uc,wn.eachRight=cc,wn.first=Ja,Lh(wn,(pp={},Ci(wn,function(e,t){ft.call(wn.prototype,t)||(pp[t]=e)}),pp),{chain:!1}),wn.VERSION=s,_r(["bind","bindKey","curry","curryRight","partial","partialRight"],function(e){wn[e].placeholder=wn}),_r(["drop","take"],function(e,t){xn.prototype[e]=function(r){r=r===o?1:Ut(Wf(r),0);var n=this.__filtered__&&!t?new xn(this):this.clone();return n.__filtered__?n.__takeCount__=Ft(r,n.__takeCount__):n.__views__.push({size:Ft(r,D),type:e+(n.__dir__<0?"Right":"")}),n},xn.prototype[e+"Right"]=function(t){return this.reverse()[e](t).reverse()}}),_r(["filter","map","takeWhile"],function(e,t){var r=t+1,n=r==O||3==r;xn.prototype[e]=function(e){var t=this.clone();return t.__iteratees__.push({iteratee:Hs(e,3),type:r}),t.__filtered__=t.__filtered__||n,t}}),_r(["head","last"],function(e,t){var r="take"+(t?"Right":"");xn.prototype[e]=function(){return this[r](1).value()[0]}}),_r(["initial","tail"],function(e,t){var r="drop"+(t?"":"Right");xn.prototype[e]=function(){return this.__filtered__?new xn(this):this[r](1)}}),xn.prototype.compact=function(){return this.filter(Bh)},xn.prototype.find=function(e){return this.filter(e).head()},xn.prototype.findLast=function(e){return this.reverse().find(e)},xn.prototype.invokeMap=_o(function(e,t){return"function"==typeof e?new xn(this):this.map(function(r){return qi(r,e,t)})}),xn.prototype.reject=function(e){return this.filter(Dc(Hs(e)))},xn.prototype.slice=function(e,t){e=Wf(e);var r=this;return r.__filtered__&&(e>0||t<0)?new xn(r):(e<0?r=r.takeRight(-e):e&&(r=r.drop(e)),t!==o&&(t=Wf(t),r=t<0?r.dropRight(-t):r.take(t-e)),r)},xn.prototype.takeRightWhile=function(e){return this.reverse().takeWhile(e).reverse()},xn.prototype.toArray=function(){return this.take(D)},Ci(xn.prototype,function(e,t){var r=/^(?:filter|find|map|reject)|While$/.test(t),n=/^(?:head|last)$/.test(t),i=wn[n?"take"+("last"==t?"Right":""):t],s=n||/^find/.test(t);i&&(wn.prototype[t]=function(){var t=this.__wrapped__,a=n?[1]:arguments,u=t instanceof xn,c=a[0],f=u||af(t),l=function(e){var t=i.apply(wn,Ir([e],a));return n&&h?t[0]:t};f&&r&&"function"==typeof c&&1!=c.length&&(u=f=!1);var h=this.__chain__,p=!!this.__actions__.length,d=s&&!h,y=u&&!p;if(!s&&f){t=y?t:new xn(this);var g=e.apply(t,a);return g.__actions__.push({func:Vu,args:[l],thisArg:o}),new An(g,h)}return d&&y?e.apply(this,a):(g=this.thru(l),d?n?g.value()[0]:g.value():g)})}),_r(["pop","push","shift","sort","splice","unshift"],function(e){var t=ot[e],r=/^(?:push|sort|unshift)$/.test(e)?"tap":"thru",n=/^(?:pop|shift)$/.test(e);wn.prototype[e]=function(){var e=arguments;if(n&&!this.__chain__){var i=this.value();return t.apply(af(i)?i:[],e)}return this[r](function(r){return t.apply(af(r)?r:[],e)})}}),Ci(xn.prototype,function(e,t){var r=wn[t];if(r){var n=r.name+"",i=ur[n]||(ur[n]=[]);i.push({name:t,func:r})}}),ur[bs(o,v).name]=[{name:"wrapper",func:o}],xn.prototype.clone=In,xn.prototype.reverse=Tn,xn.prototype.value=Bn,wn.prototype.at=Gu,wn.prototype.chain=Wu,wn.prototype.commit=$u,wn.prototype.next=Yu,wn.prototype.plant=Xu,wn.prototype.reverse=Zu,wn.prototype.toJSON=wn.prototype.valueOf=wn.prototype.value=Qu,wn.prototype.first=wn.prototype.head,It&&(wn.prototype[It]=Ju),wn},Sn=wn();sr._=Sn,i=function(){return Sn}.call(t,r,t,n),i===o||(n.exports=i)}).call(this)}).call(this,r(7),r(28)(e))},function(e,t,r){"use strict";const n=r(22),i=r(1319),o=r(197).OFFLINE_ERROR;e.exports=function e(t){return{peers:n((e,r)=>{if("function"==typeof e&&(r=e,e={}),!t.isOnline())return r(new Error(o));const n=e.v||e.verbose,s=[];i(t._peerInfoBook.getAll()).forEach(e=>{const t=e.isConnected();if(!t)return;const r={addr:t,peer:e.id};n&&(r.latency="unknown"),s.push(r)}),r(null,s)}),addrs:n(e=>{if(!t.isOnline())return e(new Error(o));const r=i(t._peerInfoBook.getAll());e(null,r)}),localAddrs:n(e=>{if(!t.isOnline())return e(new Error(o));e(null,t._libp2pNode.peerInfo.multiaddrs.toArray())}),connect:n((e,r)=>{if(!t.isOnline())return r(new Error(o));t._libp2pNode.dial(e,r)}),disconnect:n((e,r)=>{if(!t.isOnline())return r(new Error(o));t._libp2pNode.hangUp(e,r)}),filters:n(e=>e(new Error("Not implemented")))}}},function(e,t,r){var n=r(1320),i=r(350);function o(e){return null==e?[]:n(e,i(e))}e.exports=o},function(e,t,r){var n=r(222);function i(e,t){return n(t,function(t){return e[t]})}e.exports=i},function(e,t,r){"use strict";const n=r(22),i=r(64);e.exports=function e(t){return n((e,r,n)=>{i(t.pingPullStream(e,r),i.collect(n))})}},function(e,t,r){"use strict";const n=r(1),i=r(197).OFFLINE_ERROR,o=r(68),s=r(8),a=r(43),u=r(5),c=n("jsipfs:pingPullStream");function f(e){const t={success:!0,time:0,text:""};return Object.assign(t,e)}function l(e,t,r,n){let i;try{i=e.peerBook.get(r)}catch(i){c("Peer not found in peer book, trying peer routing"),t.push(f({text:`Looking up peer ${r}`}));try{r=o.createFromB58String(r)}catch(e){return n(Object.assign(e,{message:`failed to parse peer address '${r}': input isn't valid multihash`}))}return e.peerRouting.findPeer(r,n)}n(null,i)}function h(e,t,r,n,i){e.ping(n,(e,o)=>{if(e)return i(e);c("Got peer",n);let s=0,a=0;return t.push(f({text:`PING ${n.id.toB58String()}`})),o.on("ping",e=>{if(t.push(f({time:e})),a+=e,s++,s>=r){const e=a/r;o.stop(),t.push(f({text:`Average latency: ${e}ms`})),t.end()}}),o.on("error",e=>{c.error(e),o.stop(),t.push(f({success:!1,text:e.toString()})),t.end(e)}),o.start(),i()})}c.error=n("jsipfs:pingPullStream:error"),e.exports=function e(t){return(e,r)=>{if(!t.isOnline())return s.error(new Error(i));r=Object.assign({count:10},r);const n=a();return u([r=>l(t._libp2pNode,n,e,r),(e,i)=>h(t._libp2pNode,n,r.count,e,i)],e=>{e&&(c.error(e),n.push(f({success:!1,text:e.toString()})),n.end(e))}),n}}},function(e,t,r){"use strict";const n=r(142);e.exports=function e(t){return(e,r)=>n.source(t.pingPullStream(e,r))}},function(e,t,r){"use strict";(function(t){const n=r(22),{DAGNode:i,DAGLink:o}=r(42),s=r(9),a=r(74),u=r(1325),c=r(37),f=r(46),l=r(500),h=r(5),p=r(1327),d=r(3),{Key:y}=r(26),g=r(88),m=r(1328),{resolvePath:b}=r(197),v=300,_=new y("/local/pins");function w(e){return new s(e).toBaseEncodedString()}function S(e){const t=`Invalid type '${e}', must be one of {direct, indirect, recursive, all}`;return g(new Error(t),"ERR_INVALID_PIN_TYPE")}e.exports=(e=>{const r=e._repo,y=e.dag,g=m(y),k={direct:"direct",recursive:"recursive",indirect:"indirect",all:"all"};let E=new Set,A=new Set;const x=()=>Array.from(E).map(e=>new s(e).buffer),I=()=>Array.from(A).map(e=>new s(e).buffer);function T(e){const t=new Set;l(I(),v,(e,r)=>{y._getRecursive(e,(e,n)=>{if(e)return r(e);n.map(({multihash:e})=>w(e)).filter(e=>!A.has(e)).forEach(e=>t.add(e)),r()})},r=>{if(r)return e(r);e(null,Array.from(t))})}function B(n){let a,u,f;c([e=>h([e=>g.storeSet(x(),e),(e,t)=>o.create(k.direct,e.size,e.multihash,t),(e,t)=>{a=e,t(null)}],e),e=>h([e=>g.storeSet(I(),e),(e,t)=>o.create(k.recursive,e.size,e.multihash,t),(e,t)=>{u=e,t(null)}],e),e=>i.create(t.alloc(0),(t,r)=>{if(t)return e(t);y.put(r,{cid:new s(r.multihash),preload:!1},e)}),e=>i.create(t.alloc(0),[a,u],(t,r)=>{if(t)return e(t);f=r,y.put(f,{cid:new s(f.multihash),preload:!1},e)}),e=>r.closed?r.open(e):e(null,null),e=>r.datastore.put(_,f.multihash,e)],(t,r)=>t?n(t):(e.log(`Flushed pins with root: ${f}`),n(null,f)))}const C={add:n((t,r,n)=>{"function"==typeof r&&(n=r,r=null);const i=!r||r.recursive;b(e.object,t,(e,t)=>{if(e)return n(e);a(t,(e,t)=>{const r=w(e);if(i){if(A.has(r))return t(null,r);y._getRecursive(r,e=>e?t(e):t(null,r))}else{if(A.has(r))return t(new Error(`${r} already pinned recursively`));if(E.has(r))return t(null,r);y.get(new s(e),e=>e?t(e):t(null,r))}},(e,t)=>{if(e)return n(e);const r=i?A:E;t.forEach(e=>r.add(e)),B((e,r)=>e?n(e):n(null,t.map(e=>({hash:e}))))})})}),rm:n((t,r,n)=>{let i=!0;"function"==typeof r?n=r:r&&!1===r.recursive&&(i=!1),b(e.object,t,(t,r)=>{if(t)return n(t);a(r,(e,t)=>{C._isPinnedWithType(e,k.all,(r,n)=>{if(r)return t(r);const{pinned:o,reason:s}=n,a=w(e);if(!o)return t(new Error(`${a} is not pinned`));switch(s){case k.recursive:return i?t(null,a):t(new Error(`${a} is pinned recursively`));case k.direct:return t(null,a);default:return t(new Error(`${a} is pinned indirectly under ${s}`))}})},(t,r)=>{if(t)return n(t);r.forEach(e=>{i&&A.has(e)?A.delete(e):E.delete(e)}),B((t,i)=>t?n(t):(e.log(`Removed pins: ${r}`),n(null,r.map(e=>({hash:e})))))})})}),ls:n((t,r,n)=>{let i=k.all;if("function"==typeof t&&(n=t,r=null,t=null),"function"==typeof r&&(n=r),t&&t.type&&(r=t,t=null),r&&r.type){if("string"!=typeof r.type)return d(()=>n(S(r.type)));i=r.type.toLowerCase()}if(!Object.keys(k).includes(i))return d(()=>n(S(i)));if(t)b(e.object,t,(e,t)=>{if(e)return n(e);u(t,(e,t)=>{C._isPinnedWithType(e,k.all,(r,n)=>{if(r)return t(r);const{pinned:i,reason:o}=n,s=w(e);if(!i)return t(new Error(`Path ${s} is not pinned`));switch(o){case k.direct:case k.recursive:return t(null,{hash:s,type:o});default:return t(null,{hash:s,type:`${k.indirect} through ${o}`})}})},n)});else{let e=[];if(i!==k.direct&&i!==k.all||(e=e.concat(Array.from(E).map(e=>({type:k.direct,hash:e})))),i!==k.recursive&&i!==k.all||(e=e.concat(Array.from(A).map(e=>({type:k.recursive,hash:e})))),i!==k.indirect&&i!==k.all)return n(null,e);T((t,r)=>t?n(t):(e=e.filter(({hash:e})=>!r.includes(e)||r.includes(e)&&!E.has(e)).concat(r.map(e=>({type:k.indirect,hash:e}))),n(null,e)))}}),_isPinnedWithType:n((e,t,r)=>{const n=w(e),{recursive:i,direct:o,all:a}=k;if((t===i||t===a)&&A.has(n))return r(null,{pinned:!0,reason:i});if(t===i)return r(null,{pinned:!1});if((t===o||t===a)&&E.has(n))return r(null,{pinned:!0,reason:o});if(t===o)return r(null,{pinned:!1});let u;p(I(),v,(t,r)=>{y.get(new s(t),(t,n)=>{if(t)return r(t);g.hasDescendant(n.value,e,(e,t)=>{t&&(u=w(n.value.multihash)),r(e,t)})})},(e,t)=>e?r(e):r(null,{pinned:t,reason:u}))}),_load:n(t=>{h([e=>r.closed?r.datastore.open(e):e(null,null),(e,t)=>r.datastore.has(_,t),(e,t)=>e?t():t(new Error("No pins to load")),e=>r.datastore.get(_,e),(e,t)=>y.get(new s(e),"",{preload:!1},t)],(r,n)=>{if(r)return"No pins to load"===r.message?(e.log("No pins to load"),t()):t(r);f([e=>g.loadSet(n.value,k.recursive,e),e=>g.loadSet(n.value,k.direct,e)],(r,n)=>{if(r)return t(r);const[i,o]=n;return E=new Set(o.map(w)),A=new Set(i.map(w)),e.log("Loaded pins from the datastore"),t(null)})})})};return C})}).call(this,r(0).Buffer)},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(1326),i=a(n),o=r(160),s=a(o);function a(e){return e&&e.__esModule?e:{default:e}}t.default=(0,s.default)(i.default,1),e.exports=t.default},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(574),i=a(n),o=r(378),s=a(o);function a(e){return e&&e.__esModule?e:{default:e}}t.default=(0,i.default)(s.default),e.exports=t.default},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(308),i=c(n),o=r(574),s=c(o),a=r(556),u=c(a);function c(e){return e&&e.__esModule?e:{default:e}}t.default=(0,s.default)((0,i.default)(Boolean,u.default)),e.exports=t.default},function(e,t,r){"use strict";(function(n){const i=r(14),o=r(9),s=r(12),a=r(1329),u=r(23),{DAGNode:c,DAGLink:f}=r(42),l=r(555),h=r(161),p=r(1330),d="QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n",y=i.fromB58String(d),g=256,m=8192,b=s(p);function v(e){return new o(e).toBaseEncodedString()}function _(e){const t=e.data,r=u.decode(t),n=u.decode.bytes;if(n<=0)throw new Error("Invalid Set header length");if(n+r>t.length)throw new Error("Impossibly large set header length");const i=t.slice(n,r+n),o=b.Set.decode(i);if(1!==o.version)throw new Error(`Unsupported Set version: ${o.version}`);if(o.fanout>e.links.length)throw new Error("Impossibly large fanout");return{header:o,data:t.slice(r+n)}}function w(e,t){const r=n.alloc(4);r.writeUInt32LE(e,0);const i=n.concat([r,n.from(v(t))]);return a(i.toString("binary"))}t=e.exports=function(e){const t={hasDescendant:(t,r,i)=>{const s={};return(o.isCID(r)||n.isBuffer(r))&&(r=v(r)),a(t,i);function a(t,n){l(t.links,({multihash:t},n)=>{const i=v(t);return i===r?n(null,!0):i in s?n(null,!1):(s[i]=!0,void e.get(t,"",{preload:!1},(e,t)=>{if(e)return n(e);a(t.value,n)}))},n)}},storeSet:(r,n)=>{const i=r.map(e=>({key:e,data:null}));t.storeItems(i,(t,r)=>{if(t)return n(t);const i={cid:new o(r.multihash),preload:!1};e.put(r,i,(e,t)=>{if(e)return n(e);n(null,r)})})},storeItems:(t,r)=>{return i(t,0,r);function i(t,r,s){const a=b.Set.encode({version:1,fanout:g,seed:r}),l=n.concat([n.from(u.encode(a.length)),a]),p=[];for(let e=0;e<g;e++)p.push(new f("",1,y));if(t.length<=m){const e=t.map(e=>({link:new f("",1,e.key),data:e.data||n.alloc(0)})).sort((e,t)=>n.compare(e.link.multihash,t.link.multihash)),r=p.concat(e.map(e=>e.link)),i=n.concat([l].concat(e.map(e=>e.data)));c.create(i,r,(e,t)=>e?s(e):s(null,t))}else{const e=t.reduce((e,t)=>{const n=w(r,t.key)%g;return e[n]=n in e?e[n].concat([t]):[t],e},{});h(e,(e,t,n)=>{i(e,r+1,(e,r)=>d(e,r,t,n))},e=>{if(e)return s(e);c.create(l,p,(e,t)=>e?s(e):s(null,t))})}function d(t,r,n,i){if(t)return i(t);const s={cid:new o(r.multihash),preload:!1};e.put(r,s,e=>{if(e)return i(e);p[n]=new f("",r.size,r.multihash),i(null)})}}},loadSet:(r,n,i)=>{const o=r.links.find(e=>e.name===n);if(!o)return i(new Error("No link found with name "+n));e.get(o.multihash,"",{preload:!1},(e,r)=>{if(e)return i(e);const n=[],o=e=>n.push(e.multihash);t.walkItems(r.value,o,e=>e?i(e):i(null,n))})},walkItems:(r,n,i)=>{let o;try{o=_(r)}catch(e){return i(e)}h(r.links,(r,i,s)=>{if(i<o.header.fanout){const i=r.multihash;if(!y.equals(i))return e.get(i,"",{preload:!1},(e,r)=>{if(e)return s(e);t.walkItems(r.value,n,s)})}else n(r,i,o.data);s(null)},i)}};return t}}).call(this,r(0).Buffer)},function(e,t){function r(e){for(var t=r.BASE,n=0,i=e.length;n<i;n++)t^=e.charCodeAt(n),t+=(t<<1)+(t<<4)+(t<<7)+(t<<8)+(t<<24);return t>>>0}r.BASE=2166136261,e.exports=r},function(e,t,r){"use strict";e.exports='\n syntax = "proto2";\n\n package ipfs.pin;\n\n option go_package = "pb";\n\n message Set {\n optional uint32 version = 1;\n optional uint32 fanout = 2;\n optional fixed32 seed = 3;\n }\n'},function(e,t,r){"use strict";(function(t,n){const i=r(146),o=i.importer,s=i.exporter,a=r(22),u=r(8),c=r(1365),f=r(43),l=r(142),h=r(141),p=r(165),d=r(5),y=r(577),g=r(578).isSource,m=r(21).Duplex,b=r(0).Buffer,v=r(9),_=r(14).toB58String,w=r(88),S="wrapper/";function k(){}function E(e,t,r,n){t=t||{};let i=new v(r.multihash);1===t.cidVersion&&(i=i.toV1()),d([n=>t.onlyHash?n(null,r):e.object.get(r.multihash,t,n),(e,n)=>{const o=i.toBaseEncodedString();n(null,{path:t.wrapWithDirectory?r.path.substring(S.length):r.path||o,hash:o,size:e.size})}],n)}function A(e,r){return Array.isArray(r)||(r=[r]),r.map(r=>{if(t.isBuffer(r)&&(r={path:"",content:u.values([r])}),y.readable(r)&&(r={path:"",content:h.source(r)}),g(r)&&(r={path:"",content:r}),r&&r.content&&"function"!=typeof r.content&&(t.isBuffer(r.content)&&(r.content=u.values([r.content])),y.readable(r.content)&&(r.content=h.source(r.content))),e.wrapWithDirectory&&!r.path)throw new Error("Must provide a path when wrapping with a directory");return e.wrapWithDirectory&&(r.path=S+r.path),r})}function x(e,t,r){const n=t.wrapWithDirectory?""===r.path:!r.path.includes("/"),i=n&&!t.onlyHash&&!1!==t.preload;return i&&e._preload(r.hash),r}function I(e,t,r,n){const i=!("pin"in t)||t.pin,o=!r.path.includes("/"),s=i&&o&&!t.onlyHash&&!t.hashAlg;if(s)return e.pin.add(r.hash,e=>n(e,r));n(null,r)}class T extends m{constructor(e,t,r){super(Object.assign({objectMode:!0},r)),this._pullStream=e,this._pushable=t,this._waitingPullFlush=[]}_read(){this._pullStream(null,(e,t)=>{for(;this._waitingPullFlush.length;){const e=this._waitingPullFlush.shift();e()}e?e instanceof Error&&this.emit("error",e):this.push(t)})}_write(e,t,r){this._waitingPullFlush.push(r),this._pushable.push(e)}}function B(e){return t.isBuffer(e)&&(e=_(e)),v.isCID(e)&&(e=e.toBaseEncodedString()),0===e.indexOf("/ipfs/")&&(e=e.substring("/ipfs/".length)),"/"===e.charAt(e.length-1)&&(e=e.substring(0,e.length-1)),e}e.exports=function e(r){function i(e){const t=Object.assign({},{shardSplitThreshold:r._options.EXPERIMENTAL.sharding?1e3:1/0},e);t.hashAlg&&1!==t.cidVersion&&(t.cidVersion=1);let n=0;const i=t.progress||k,s=e=>{n+=e,i(n)};return t.progress=s,u(u.map(A.bind(null,t)),u.flatten(),o(r._ipld,t),u.asyncMap(E.bind(null,r,t)),u.map(x.bind(null,r,t)),u.asyncMap(I.bind(null,r,t)))}function h(e,t){if("function"==typeof e)throw new Error("You must supply an ipfsPath");t=t||{},e=B(e);const n=e.split("/"),i=B(n.slice(1).join("/")),o=t=>i&&t.path===i||t.path===e;!1!==t.preload&&r._preload(n[0]);const a=p.source();return u(s(e,r._ipld,t),u.collect((e,t)=>{if(e)return a.abort(e);if(t&&t.length>1&&(t=t.filter(o)),!t||!t.length)return a.abort(new Error("No such file"));const r=t[0],n=r.content;if(!n&&"dir"===r.type)return a.abort(new Error("this dag node is a directory"));a.resolve(n)})),a}function d(e,t){t=t||{};const i=B(e),o=t.recursive,a=i.split("/"),c=a.length,f=o?n.Infinity:c;return t.maxDepth=t.maxDepth||f,!1!==t.preload&&r._preload(a[0]),u(s(e,r._ipld,t),u.filter(e=>o?e.depth>=c:e.depth===c),u.map(e=>{const t=new v(e.hash);return e=Object.assign({},e,{hash:t.toBaseEncodedString()}),delete e.content,e}))}return{add:(()=>{const e=a((e,r={},n)=>{"function"==typeof r?(n=r,r={}):n&&"function"==typeof n||(n=k);const o=t.isBuffer(e)||y.readable(e)||Array.isArray(e)||b.isBuffer(e)||"object"==typeof e||g(e);if(!o)return n(new Error("first arg must be a buffer, readable stream, pull stream, an object or array of objects"));r.hashAlg&&1!==r.cidVersion&&(r.cidVersion=1),u(u.values([e]),i(r),c((e,t)=>e.path<t.path?1:e.path>t.path?-1:0),u.collect(n))});return function(){const t=Array.from(arguments);return 1===t.length&&g(t[0])&&t.push({}),e.apply(null,t)}})(),addReadableStream:e=>{e=e||{};const t=f(),r=u(t,i(e)),n=new T(r,t);return n.once("finish",()=>t.end()),n},addPullStream:i,cat:a((e,r,n)=>{if("function"==typeof r&&(n=r,r={}),"function"!=typeof n)throw new Error("Please supply a callback to ipfs.files.cat");u(h(e,r),u.collect((e,r)=>{if(e)return n(e);n(null,t.concat(r))}))}),catReadableStream:(e,t)=>l.source(h(e,t)),catPullStream:(e,t)=>h(e,t),get:a((e,n,i)=>{if("function"==typeof n&&(i=n,n={}),n=n||{},!1!==n.preload){let t;try{t=B(e).split("/")}catch(e){return setImmediate(()=>i(w(e,"ERR_INVALID_PATH")))}r._preload(t[0])}u(s(e,r._ipld,n),u.asyncMap((e,r)=>{e.content?u(e.content,u.collect((n,i)=>{if(n)return r(n);e.content=t.concat(i),r(null,e)})):r(null,e)}),u.collect(i))}),getReadableStream:(e,t)=>{if(t=t||{},!1!==t.preload){let t;try{t=B(e).split("/")}catch(e){return l.source(u.error(w(e,"ERR_INVALID_PATH")))}r._preload(t[0])}return l.source(u(s(e,r._ipld,t),u.map(e=>(e.content&&(e.content=l.source(e.content),e.content.pause()),e))))},getPullStream:(e,t)=>{if(t=t||{},!1!==t.preload){let t;try{t=B(e).split("/")}catch(e){return u.error(w(e,"ERR_INVALID_PATH"))}r._preload(t[0])}return s(e,r._ipld,t)},lsImmutable:a((e,t,r)=>{"function"==typeof t&&(r=t,t={}),t=t||{},u(d(e,t),u.collect((e,t)=>{e?r(e):r(null,t)}))}),lsReadableStreamImmutable:(e,t)=>l.source(d(e,t)),lsPullStreamImmutable:d}}}).call(this,r(0).Buffer,r(7))},function(e,t,r){"use strict";(function(t){const n=r(575),i=r(8),o=r(198),s=r(43),a=r(13),u=r(3),c=r(1334),f=r(1343),l=r(1352),h={chunker:"fixed",rawLeaves:!1,hashOnly:!1,cidVersion:0,hash:null,leafType:"file",hashAlg:"sha2-256"};e.exports=function(e,r){const p=Object.assign({},h,r);p.cidVersion=p.cidVersion||0,p.cidVersion>0&&void 0===r.rawLeaves&&(p.rawLeaves=!0),r&&void 0!==r.hash&&void 0===r.rawLeaves&&(p.rawLeaves=!0);const d=l[p.chunker];a(d,"Unknkown chunker named "+p.chunker);let y=0;const g=[],m={sink:o((e,t)=>{y+=e.length,e.forEach(e=>m.source.push(e)),u(t)},null,1,e=>m.source.end(e)),source:s()},b=c(d,e,p),v=f(e,p),_=v.stream(),w=n(()=>{});return i(m,w,b,i.map(e=>(y--,y||t.nextTick(()=>{for(;g.length;)g.shift()()}),e)),_),{sink:m.sink,source:_.source,flush:S};function S(e){function t(){v.flush((t,r)=>{if(t)return _.source.end(t),void e(t);w.resume(),e(null,r)})}w.pause(),y?g.push(t):t()}}}).call(this,r(6))},function(e,t){e.exports=function(e){var t=!1,r=0;return function(){if(r=!0,!t){for(t=!0;r;)r=!1,e();t=!1}}}},function(e,t,r){"use strict";const n=r(13),i=r(1335),o=r(1336),s={flat:r(1338),balanced:r(1339),trickle:r(1341)},a={strategy:"balanced",highWaterMark:100,reduceSingleLeafToSelf:!0};e.exports=function(e,t,r){n(e,"Missing chunker creator function"),n(t,"Missing IPLD");const u=Object.assign({},a,r),c=u.strategy,f=s[c];n(f,"Unknown importer build strategy name: "+c);const l=o(e,t,f,u);return i(l,t,u)}},function(e,t,r){"use strict";const n=r(43),i=r(198);e.exports=function e(t,r,o){const s=n(),a=i(t(s),null,o.highWaterMark,e=>s.end(e));return{source:s,sink:a}}},function(e,t,r){"use strict";(function(t){const n=r(275),i=r(38),o=r(8),s=r(199),a=r(46),u=r(5),c=r(42),f=r(9),l=r(59),h=r(1337),p=c.DAGNode,d={chunkerOptions:{maxChunkSize:262144,avgChunkSize:262144},rawLeaves:!1,hashAlg:"sha2-256",leafType:"file",cidVersion:0};e.exports=function e(r,c,y,g){const m=n({},d,g);return m.cidVersion=m.cidVersion||m.cidVersion,m.hashAlg=m.hashAlg||d.hashAlg,"sha2-256"!==m.hashAlg&&(m.cidVersion=1),function(e){return function(t,r){a(t.map(t=>r=>{if(!t.content)return b(t,(t,n)=>{if(t)return r(t);n&&e.push(n),r()});v(t,(t,n)=>{if(t)return r(t);n&&e.push(n),r()})}),r)}};function b(e,t){const r=new i("directory");u([e=>p.create(r.marshal(),[],m.hashAlg,e),(e,t)=>{if(m.onlyHash)return t(null,e);e.cid=new f(m.cidVersion,"dag-pb",e.multihash),c.put(e,{cid:e.cid},r=>t(r,e))}],(r,n)=>{if(r)return t(r);t(null,{path:e.path,multihash:n.cid.buffer,size:n.size})})}function v(e,n){if(t.isBuffer(e.content)&&(e.content=o.values([e.content])),"function"!=typeof e.content)return n(new Error("invalid content"));const a=y(h(e,c,m),m);let u,d;try{u=r(m.chunkerOptions)}catch(e){return n(e)}let g=0;o(e.content,u,o.map(e=>(m.progress&&"function"==typeof m.progress&&m.progress(e.byteLength),t.from(e))),o.asyncMap((e,t)=>{if(m.rawLeaves)return l(e,m.hashAlg,(r,n)=>r?t(r):t(null,{multihash:n,size:e.length,leafSize:e.length,cid:new f(1,"raw",n),data:e}));const r=new i(m.leafType,e);p.create(r.marshal(),[],m.hashAlg,(e,n)=>{if(e)return t(e);t(null,{multihash:n.multihash,size:n.size,leafSize:r.fileSize(),cid:new f(m.cidVersion,"dag-pb",n.multihash),data:n})})}),o.asyncMap((e,t)=>{if(m.onlyHash)return t(null,e);c.put(e.data,{cid:e.cid},r=>t(r,e))}),o.map(t=>({path:e.path,multihash:t.cid.buffer,size:t.size,leafSize:t.leafSize,name:"",cid:t.cid})),s(function e(t){g++,d&&this.queue(d),d=t},function e(){d&&(1===g&&(d.single=!0),this.queue(d)),this.queue(null)}),a,o.collect((e,t)=>{e?n(e):n(null,t[0])}))}}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";const n=r(5),i=r(42),o=r(38),s=r(9),a=i.DAGLink,u=i.DAGNode;e.exports=function e(t,r,i){return function(e,c){if(1===e.length&&e[0].single&&i.reduceSingleLeafToSelf){const r=e[0];return c(null,{path:t.path,multihash:r.multihash,size:r.size,leafSize:r.leafSize,name:r.name})}const f=new o("file"),l=e.map(e=>{f.addBlockSize(e.leafSize);let t=e.cid;return t||(t=new s(i.cidVersion,"dag-pb",e.multihash)),new a(e.name,e.size,t.buffer)});n([e=>u.create(f.marshal(),l,i.hashAlg,e),(e,t)=>{const n=new s(i.cidVersion,"dag-pb",e.multihash);if(i.onlyHash)return t(null,{node:e,cid:n});r.put(e,{cid:n},r=>t(r,{node:e,cid:n}))}],(e,r)=>{if(e)return c(e);c(null,{name:"",path:t.path,multihash:r.cid.buffer,size:r.node.size,leafSize:f.fileSize()})})}}},function(e,t,r){"use strict";const n=r(8),i=r(43),o=r(192),s=r(316);e.exports=function(e,t){const r=o(),a=r.source,u=i();return n(a,s(1/0),n.asyncMap(e),n.collect((e,t)=>{e?u.end(e):1===t.length?(u.push(t[0]),u.end()):t.length>1?u.end(new Error("expected a maximum of 1 roots and got "+t.length)):u.end()})),{sink:r.sink,source:u}}},function(e,t,r){"use strict";const n=r(1340),i={maxChildrenPerNode:174};e.exports=function(e,t){const r=Object.assign({},i,t);return n(e,r)}},function(e,t,r){"use strict";const n=r(8),i=r(43),o=r(192),s=r(316);e.exports=function e(t,r){const a=o(),u=a.source,c=i();function f(e,i){let o=e;function a(e,t){e?i(e):t.length>1?f(t,i):i(null,t)}Array.isArray(o)&&(o=n.values(o)),n(o,s(r.maxChildrenPerNode),n.asyncMap(t),n.collect(a))}return f(u,(e,t)=>{e?c.end(e):1===t.length?(c.push(t[0]),c.end()):t.length>1?c.end(new Error("expected a maximum of 1 roots and got "+t.length)):c.end()}),{sink:a.sink,source:c}}},function(e,t,r){"use strict";const n=r(1342),i={maxChildrenPerNode:174,layerRepeat:4};e.exports=function(e,t){const r=Object.assign({},i,t);return n(e,r)}},function(e,t,r){"use strict";const n=r(8),i=r(43),o=r(316),s=r(192),a=r(199),u=r(198),c=r(575);e.exports=function e(t,r){const f=s(),l=i(),h=c(()=>{});let p=0;return n(f.source,h,d(0,-1),o(1/0),n.asyncMap(t),n.collect((e,t)=>{e?l.end(e):1===t.length?(l.push(t[0]),l.end()):t.length>1?l.end(new Error("expected a maximum of 1 roots and got "+t.length)):l.end()})),{sink:f.sink,source:l};function d(e,s){let c=0,f=0,l,y=!1;const g=i();return{source:g,sink:u(m,null,1,v)};function m(r,s){let u=!1;const c=r[0];f&&!l&&(l=i(),n(l,d(e+1,f-1),a(function(e){this.queue(e)},function(e){e?this.emit("error",e):(u||(u=!0,p++,h.pause()),this.queue(null))}),o(1/0),n.asyncMap(t),n.collect((e,t)=>{p--,e?g.end(e):(t.forEach(e=>{g.push(e)}),b())}))),l?l.push(c):(g.push(c),b()),s()}function b(){l=null,c++,(0===f&&c===r.maxChildrenPerNode||f>0&&c===r.layerRepeat)&&(c=0,f++),(!y&&s>=0&&f>s||y&&!p)&&(y=!0,g.end()),p||h.resume()}function v(e){e?g.end(e):l?y||(y=!0,l.end()):g.end()}}}},function(e,t,r){"use strict";(function(t){const n=r(188),i=r(215),o=r(5),s=r(126),a=r(198),u=r(43),c=r(1344),f=r(1345),l=r(317);e.exports=p;const h={wrap:!1,shardSplitThreshold:1e3,onlyHash:!1};function p(e,r){const p=Object.assign({},h,r),y=s(b,1);let g=_(),m=c({path:"",root:!0,dir:!0,dirty:!1,flat:!0},p);return{flush:S,stream:v};function b(e,t){const r=e.args.concat(function(){e.cb.apply(null,arguments),t()});e.fn.apply(null,r)}function v(){return g}function _(){const e=a(r,null,1,i),t=u();return{sink:e,source:t};function r(e,r){n(e,(e,r)=>{y.push({fn:w,args:[e],cb:n=>{n?r(n):(t.push(e),r())}})},r)}function i(e){S(r=>{t.end(r||e)})}}function w(e,t){const r=(e.path||"").split("/").filter(d);let n=m;const s=r.length-1;let a="";i(r,(t,r,i)=>{a&&(a+="/"),a+=t;const u=r===s;n.dirty=!0,n.multihash=null,n.size=null,u?o([r=>n.put(t,e,r),e=>f(null,n,p.shardSplitThreshold,p,e),(e,t)=>{m=e,t()}],i):n.get(t,(e,r)=>{if(e)return void i(e);let o=r;o&&o instanceof l||(o=c({dir:!0,parent:n,parentKey:t,path:a,dirty:!0,flat:!0},p));const s=n;n=o,s.put(t,o,i)})},t)}function S(e){y.push({fn:k,args:["",m],cb:(t,r)=>{t?e(t):e(null,r&&r.multihash)}})}function k(e,r,n){if(r.dir){if(r.root&&r.childCount()>1&&!p.wrap)return void n(new Error("detected more than one root"));r.eachChildSeries((t,r,n)=>{k(e?e+"/"+t:t,r,n)},t=>{t?n(t):E(e,r,n)})}else t.nextTick(n)}function E(t,r,n){!r.root||p.wrap?r.dirty?(r.dirty=!1,r.flush(t,e,g.source,(e,t)=>{e?n(e):n(null,t)})):n(null,r.multihash):r.onlyChild((e,t)=>{e?n(e):n(null,t)})}}function d(e){return Boolean(e)}}).call(this,r(6))},function(e,t,r){"use strict";(function(t){const n=r(188),i=r(5),o=r(9),s=r(42),a=r(38),u=s.DAGLink,c=s.DAGNode,f=r(317);class l extends f{constructor(e,t){super(e,t),this._children={}}put(e,r,n){this.multihash=void 0,this.size=void 0,this._children[e]=r,t.nextTick(n)}get(e,r){t.nextTick(()=>r(null,this._children[e]))}childCount(){return Object.keys(this._children).length}directChildrenCount(){return this.childCount()}onlyChild(e){t.nextTick(()=>e(null,this._children[Object.keys(this._children)[0]]))}eachChildSeries(e,t){n(Object.keys(this._children),(t,r)=>{e(t,this._children[t],r)},t)}flush(e,t,r,n){const s=Object.keys(this._children).map(e=>{const t=this._children[e];return new u(e,t.size,t.multihash)}),f=new a("directory"),l=this._options;i([e=>c.create(f.marshal(),s,l.hashAlg,e),(e,r)=>{if(l.onlyHash)return r(null,e);let n=new o(e.multihash);1===l.cidVersion&&(n=n.toV1()),t.put(e,{cid:n},t=>r(t,e))},(t,n)=>{this.multihash=t.multihash,this.size=t.size;const i={path:e,multihash:t.multihash,size:t.size};r.push(i),n(null,t)}],n)}}function h(e,t){return new l(e,t)}e.exports=h}).call(this,r(6))},function(e,t,r){"use strict";const n=r(5),i=r(1346);function o(e,t,r,i,a){s(t,r,i,(s,u)=>{if(s)return void a(s);const c=u.parent;c?n([r=>{u!==t?(e&&(e.parent=u),c.put(u.parentKey,u,r)):r()},e=>{c?o(u,c,r,i,e):e(null,u)}],a):a(null,u)})}function s(e,t,r,n){e.flat&&e.directChildrenCount()>=t?a(e,r,n):n(null,e)}function a(e,t,r){const n=i({root:e.root,dir:!0,parent:e.parent,parentKey:e.parentKey,path:e.path,dirty:e.dirty,flat:!1},t);e.eachChildSeries((e,t,r)=>{n.put(e,t,r)},e=>{e?r(e):r(e,n)})}e.exports=o},function(e,t,r){"use strict";(function(t){const n=r(361),i=r(47),o=r(5),s=r(9),a=r(42),u=r(38),c=a.DAGLink,f=a.DAGNode,l=r(59),h=r(317),p=r(1347),d=function(e,r){l(e,"murmur3-128",(e,n)=>{if(e)r(e);else{const e=n.slice(2,10),i=e.length,o=t.alloc(i);for(let t=0;t<i;t++)o[i-t-1]=e[t];r(null,o)}})};d.code=34;const y={hashFn:d};class g extends h{constructor(e,t){const r=Object.assign({},y,t);super(e,r),this._bucket=p(r)}put(e,t,r){this._bucket.put(e,t,r)}get(e,t){this._bucket.get(e,t)}childCount(){return this._bucket.leafCount()}directChildrenCount(){return this._bucket.childrenCount()}onlyChild(e){this._bucket.onlyChild(e)}eachChildSeries(e,t){this._bucket.eachLeafSeries(e,t)}flush(e,t,r,n){b(this._options,this._bucket,e,t,r,(e,t)=>{e?n(e):(this.multihash=t.multihash,this.size=t.size),n(null,t)})}}function m(e,t){return new g(e,t)}function b(e,r,a,l,h,d){const y=r._children;let g=0;const m=[];function v(t,r,i){const o=n(r.toString(16).toUpperCase(),2,"0");if(p.isBucket(t))b(e,t,a,l,null,(e,t)=>{e?i(e):(m.push(new c(o,t.size,t.multihash)),i())});else{const e=t.value,r=o+t.key;m.push(new c(r,e.size,e.multihash)),i()}}function _(n){const i=t.from(y.bitField().reverse()),c=new u("hamt-sharded-directory",i);c.fanout=r.tableSize(),c.hashType=e.hashFn.code,o([t=>f.create(c.marshal(),n,e.hashAlg,t),(t,r)=>{if(e.onlyHash)return r(null,t);let n=new s(t.multihash);1===e.cidVersion&&(n=n.toV1()),l.put(t,{cid:n},e=>r(e,t))},(e,t)=>{const r={path:a,multihash:e.multihash,size:e.size};h&&h.push(r),t(null,e)}],d)}i(()=>g<y.length,e=>{const t=y.get(g);t?v(t,g,t=>{g++,e(t)}):(g++,e())},e=>{e?d(e):_(m)})}e.exports=m}).call(this,r(0).Buffer)},function(e,t,r){"use strict";const n=r(1348);e.exports=function e(t){return new n(t)},e.exports.isBucket=n.isBucket},function(e,t,r){"use strict";(function(t){const n=r(1349),i=r(74),o=r(188),s=r(1350),a={bits:8};class u{constructor(e,t,r){if(this._options=Object.assign({},a,e),this._popCount=0,this._parent=t,this._posAtParent=r,!this._options.hashFn)throw new Error("please define an options.hashFn");this._options.hash||(this._options.hash=s(this._options.hashFn)),this._children=new n}static isBucket(e){return e instanceof u}put(e,t,r){this._findNewBucketAndPos(e,(n,i)=>{n?r(n):(i.bucket._putAt(i,e,t),r())})}get(e,t){this._findChild(e,(e,r)=>{e?t(e):t(null,r&&r.value)})}del(e,t){this._findPlace(e,(r,n)=>{if(r)return void t(r);const i=n.bucket._at(n.pos);i&&i.key===e&&n.bucket._delAt(n.pos),t(null)})}leafCount(){this._children.reduce((e,t)=>t instanceof u?e+t.leafCount():e+1,0)}childrenCount(){return this._children.length}onlyChild(e){t.nextTick(()=>e(null,this._children.get(0)))}eachLeafSeries(e,t){o(this._children.compactArray(),(t,r)=>{t instanceof u?t.eachLeafSeries(e,r):e(t.key,t.value,r)},t)}serialize(e,t){return t(this._children.reduce((r,n,i)=>(n&&(n instanceof u?r.push(n.serialize(e,t)):r.push(e(n,i))),r),[]))}asyncTransform(e,t,r){h(this,e,t,r)}toJSON(){return this.serialize(f,l)}prettyPrint(){return JSON.stringify(this.toJSON(),null," ")}tableSize(){return Math.pow(2,this._options.bits)}_findChild(e,t){this._findPlace(e,(r,n)=>{if(r)return void t(r);const i=n.bucket._at(n.pos);i&&i.key===e?t(null,i):t(null,void 0)})}_findPlace(e,t){const r=this._options.hash(e);r.take(this._options.bits,(e,n)=>{if(e)return void t(e);const i=this._children.get(n);if(i instanceof u)i._findPlace(r,t);else{const e={bucket:this,pos:n,hash:r};t(null,e)}})}_findNewBucketAndPos(e,t){this._findPlace(e,(r,n)=>{if(r)return void t(r);const i=n.bucket._at(n.pos);if(i&&i.key!==e){const e=new u(this._options,n.bucket,n.pos);n.bucket._putObjectAt(n.pos,e),e._findPlace(i.hash,(r,o)=>{r?t(r):(o.bucket._putAt(o,i.key,i.value),e._findNewBucketAndPos(n.hash,t))})}else t(null,n)})}_putAt(e,t,r){this._putObjectAt(e.pos,{key:t,value:r,hash:e.hash})}_putObjectAt(e,t){this._children.get(e)||this._popCount++,this._children.set(e,t)}_delAt(e){this._children.get(e)&&this._popCount--,this._children.unset(e),this._level()}_level(){if(this._parent&&this._popCount<=1)if(1===this._popCount){const e=this._children.find(c);if(!(e instanceof u)){const t=e.hash;t.untake(this._options.bits);const r={pos:this._posAtParent,hash:t};this._parent._putAt(r,e.key,e.value)}}else this._parent._delAt(this._posAtParent)}_at(e){return this._children.get(e)}}function c(e){return Boolean(e)}function f(e,t){return e.key}function l(e){return e}function h(e,t,r,n){i(e._children.compactArray(),(n,i)=>{n instanceof u?h(n,t,r,i):t(n,(t,r)=>{t?i(t):i(null,{bitField:e._children.bitField(),children:r})})},(e,t)=>{e?n(e):r(t,n)})}e.exports=u}).call(this,r(6))},function(e,t,r){"use strict";const n=7;function i(e,t){return e+o(t)}function o(e){let t=e;return t-=t>>1&1431655765,t=(858993459&t)+(t>>2&858993459),16843009*(t+(t>>4)&252645135)>>24}function s(e,t){return e[0]-t[0]}function a(e){return e[1]}e.exports=class e{constructor(){this._bitArrays=[],this._data=[],this._length=0,this._changedLength=!1,this._changedData=!1}set(e,t){let r=this._internalPositionFor(e,!1);if(void 0===t)-1!==r&&(this._unsetInternalPos(r),this._unsetBit(e),this._changedLength=!0,this._changedData=!0);else{let n=!1;-1===r?(r=this._data.length,this._setBit(e),this._changedData=!0):n=!0,this._setInternalPos(r,e,t,n),this._changedLength=!0}}unset(e){this.set(e,void 0)}get(e){this._sortData();const t=this._internalPositionFor(e,!0);if(-1!==t)return this._data[t][1]}push(e){return this.set(this.length,e),this.length}get length(){if(this._sortData(),this._changedLength){const e=this._data[this._data.length-1];this._length=e?e[0]+1:0,this._changedLength=!1}return this._length}forEach(e){let t=0;for(;t<this.length;)e(this.get(t),t,this),t++}map(e){let t=0,r=new Array(this.length);for(;t<this.length;)r[t]=e(this.get(t),t,this),t++;return r}reduce(e,t){let r=0,n=t;for(;r<this.length;){const t=this.get(r);n=e(n,t,r),r++}return n}find(e){let t=0,r,n;for(;t<this.length&&!r;)n=this.get(t),r=e(n),t++;return r?n:void 0}_internalPositionFor(e,t){const r=this._bytePosFor(e,t);if(r>=this._bitArrays.length)return-1;const n=this._bitArrays[r],s=e-7*r,a=(n&1<<s)>0;if(!a)return-1;const u=this._bitArrays.slice(0,r).reduce(i,0),c=~(4294967295<<s+1),f=o(n&c),l=u+f-1;return l}_bytePosFor(e,t){const r=Math.floor(e/7),n=r+1;for(;!t&&this._bitArrays.length<n;)this._bitArrays.push(0);return r}_setBit(e){const t=this._bytePosFor(e,!1);this._bitArrays[t]|=1<<e-7*t}_unsetBit(e){const t=this._bytePosFor(e,!1);this._bitArrays[t]&=~(1<<e-7*t)}_setInternalPos(e,t,r,n){const i=this._data,o=[t,r];if(n)this._sortData(),i[e]=o;else{if(i.length)if(i[i.length-1][0]>=t)i.push(o);else if(i[0][0]<=t)i.unshift(o);else{const e=Math.round(i.length/2);this._data=i.slice(0,e).concat(o).concat(i.slice(e))}else this._data.push(o);this._changedData=!0,this._changedLength=!0}}_unsetInternalPos(e){this._data.splice(e,1)}_sortData(){this._changedData&&this._data.sort(s)}bitField(){const e=[];let t=8,r=0,n=0,i;const o=this._bitArrays.slice();for(;o.length||r;){0===r&&(i=o.shift(),r=7);const s=Math.min(r,t),a=~(255<<s),u=i&a;n|=u<<8-t,i>>>=s,r-=s,t-=s,t&&(r||o.length)||(e.push(n),n=0,t=8)}for(var s=e.length-1;s>0;s--){const t=e[s];if(0!==t)break;e.pop()}return e}compactArray(){return this._sortData(),this._data.map(a)}}},function(e,t,r){"use strict";(function(t,n){const i=r(47),o=r(1351);e.exports=function e(t){return function e(r){return r instanceof s?r:new s(r,t)}};class s{constructor(e,r){if("string"!=typeof e&&!t.isBuffer(e))throw new Error("can only hash strings or buffers");this._value=e,this._hashFn=r,this._depth=-1,this._availableBits=0,this._currentBufferIndex=0,this._buffers=[]}take(e,t){let r=e;i(()=>this._availableBits<r,e=>{this._produceMoreBits(e)},e=>{if(e)return void t(e);let o=0;i(()=>r>0,e=>{const t=this._buffers[this._currentBufferIndex],n=Math.min(t.availableBits(),r),i=t.take(n);o=(o<<n)+i,r-=n,this._availableBits-=n,0===t.availableBits()&&this._currentBufferIndex++,e()},e=>{e?t(e):n.nextTick(()=>t(null,o))})})}untake(e){let t=e;for(;t>0;){const e=this._buffers[this._currentBufferIndex],r=Math.min(e.totalBits()-e.availableBits(),t);e.untake(r),t-=r,this._availableBits+=r,this._currentBufferIndex>0&&e.totalBits()===e.availableBits()&&(this._depth--,this._currentBufferIndex--)}}_produceMoreBits(e){this._depth++;const t=this._depth?this._value+this._depth:this._value;this._hashFn(t,(t,r)=>{if(t)return void e(t);const n=new o(r);this._buffers.push(n),this._availableBits+=n.availableBits(),e()})}}}).call(this,r(0).Buffer,r(6))},function(e,t,r){"use strict";const n=[255,254,252,248,240,224,192,128],i=[1,3,7,15,31,63,127,255];function o(e,t,r){const n=s(t,r);return(e&n)>>>t}function s(e,t){return n[e]&i[Math.min(t+e-1,7)]}e.exports=class e{constructor(e){this._value=e,this._currentBytePos=e.length-1,this._currentBitPos=7}availableBits(){return this._currentBitPos+1+8*this._currentBytePos}totalBits(){return 8*this._value.length}take(e){let t=e,r=0;for(;t&&this._haveBits();){const e=this._value[this._currentBytePos],n=this._currentBitPos+1,i=Math.min(n,t),s=o(e,n-i,i);r=(r<<i)+s,t-=i,this._currentBitPos-=i,this._currentBitPos<0&&(this._currentBitPos=7,this._currentBytePos--)}return r}untake(e){for(this._currentBitPos+=e;this._currentBitPos>7;)this._currentBitPos-=8,this._currentBytePos+=1}_haveBits(){return this._currentBytePos>=0}}},function(e,t,r){"use strict";const n={fixed:r(1353),rabin:r(1355)};e.exports=n},function(e,t,r){"use strict";const n=r(1354);e.exports=(e=>{let t="number"==typeof e?e:e.maxChunkSize;return n(t,{zeroPadding:!1,emitEmpty:!0})})},function(e,t,r){"use strict";(function(t){var n=r(199);function i(e){return 1===e.length?e[0]:t.concat(e)}function o(e,t,r){return 0===t&&r===e.length?e:e.slice(t,r)}e.exports=function e(r,s){var a;s||(s={}),"object"==typeof r&&(s=r,r=s.size),r=r||512,a=!s.nopad&&(void 0===s.zeroPadding||s.zeroPadding);var u=[],c=0,f=0,l=!1;return n(function e(n){for("number"==typeof n&&(n=t.from([n])),c+=n.length,u.push(n);c>=r;){for(var s=0,a=[],h=0,p,d,y;s<r;)p=u[h],d=Math.min(f+r-s,p.length),y=o(p,f,d),s+=y.length,a.push(y),d===p.length?(h++,f=0):f+=y.length;u=u.slice(h),c-=s,this.queue(i(a)),l=!0}},function e(n){if(s.emitEmpty&&!l||c){if(a){var o=t.alloc(r-c);o.fill(0),u.push(o)}u&&(u.length>0&&(u[0]=u[0].slice(f)),this.queue(i(u)),u=null)}this.queue(null)})}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";const n=r(141);let i;e.exports=(e=>{if(!i)try{i=r(1356)}catch(e){throw e.message=`Rabin chunker not supported, it may have failed to install - ${e.message}`,e}let t,o,s;e.minChunkSize&&e.maxChunkSize&&e.avgChunkSize?(s=e.avgChunkSize,t=e.minChunkSize,o=e.maxChunkSize):(s=e.avgChunkSize,t=s/3,o=s+s/2);const a=Math.floor(Math.log2(s)),u=i({min:t,max:o,bits:a,window:e.window||16,polynomial:e.polynomial||"0x3DF305DFB2A805"});return n.duplex(u)})},function(e,t){},function(e,t,r){"use strict";(function(t){const n=r(8),i=r(9),o=r(1358).createResolver;function s(e){let r=e,n="/";if(t.isBuffer(e)&&(r=new i(e).toBaseEncodedString()),"string"==typeof e){0===e.indexOf("/ipfs/")&&(e=r=e.substring(6));const t=e.indexOf("/");t>0&&(r=e.substring(0,t),n=e.substring(t))}else i.isCID(r)&&(r=r.toBaseEncodedString());return r=new i(r).toBaseEncodedString(),{base:r,rest:n.split("/").filter(Boolean)}}const a={maxDepth:1/0,offset:void 0,length:void 0};function u(e){return e.reduce((e,t)=>(e.length&&(e+="/"),e+t),"")}e.exports=((e,t,r)=>{let c;r=Object.assign({},a,r);try{c=s(e)}catch(e){return n.error(e)}const f=u([c.base].concat(c.rest.slice(0,c.rest.length-1))).length;return n(n.values([{multihash:new i(c.base),name:c.base,path:c.base,pathRest:c.rest,depth:0}]),o(t,r),n.filter(Boolean),n.map(e=>({depth:e.depth,name:e.name,path:l(e),size:e.size,hash:e.hash||e.multihash,content:e.content,type:e.type})));function l(e){if(!c.rest.length)return e.path;let t=e.path.substring(f);return"/"===t.charAt(0)&&(t=t.substring(1)),t||(t=c.rest[c.rest.length-1]||c.base),t}})}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(t){const n=r(38),i=r(8),o=r(318),s=r(9),a={directory:r(1360),"hamt-sharded-directory":r(1361),file:r(1362),object:r(1363),raw:r(1364)};function u(e,t,r,n){return r||(r=0),r>t.maxDepth?i.map(f):i(o((r,n)=>{if("number"!=typeof r.depth)return i.error(new Error("no depth"));if(r.object)return n(null,l(null,r.object,r,t.offset,t.length));const o=new s(r.multihash);e.get(o,(e,i)=>{if(e)return n(e);n(null,l(o,i.value,r,t.offset,t.length))})}),i.flatten(),i.filter(Boolean),i.filter(e=>e.depth<=t.maxDepth));function l(t,r,i,o,s){return h(t,r,i.name,i.path,i.pathRest,i.size,e,i.parent||n,i.depth,o,s)}function h(e,r,n,o,s,f,l,h,p,d,y){const g=c(r),m=a[g];if(!m)return i.error(new Error("Unkown node type "+g));const b=u(l,t,p,r);return m(e,r,n,o,s,b,f,l,h,p,d,y)}}function c(e){return t.isBuffer(e)?"raw":t.isBuffer(e.data)?n.unmarshal(e.data).type:"object"}function f(e){return e}e.exports=Object.assign({createResolver:u,typeOf:c},a)}).call(this,r(0).Buffer)},function(e,t){e.exports=function(e){var t=!1,r=0;return function(){if(r=!0,!t){for(t=!0;r;)r=!1,e();t=!1}}}},function(e,t,r){"use strict";const n=r(8),i=r(143);function o(e,t,r,o,s,a,u,c,f,l){const h=s[0],p={name:r,depth:l,path:o,hash:e,size:t.size,type:"dir"},d=[n(n.values(t.links),n.map(e=>({depth:l+1,size:e.size,name:e.name,path:o+"/"+e.name,multihash:e.multihash,linkName:e.name,pathRest:s.slice(1),type:"dir"})),n.filter(e=>void 0===h||e.linkName===h),a)];return s.length||d.unshift(n.values([p])),i(d)}e.exports=o},function(e,t,r){"use strict";const n=r(8),i=r(143);function o(e,t,r,o,s,a,u,c,f,l){let h;f&&f.path===o||(h={name:r,depth:l,path:o,hash:e,size:t.size,type:"dir"});const p=[n(n.values(t.links),n.map(e=>{const t=e.name.substring(2),r=t?o+"/"+t:o;let n=!0;return t&&s.length&&(n=t===s[0]),n?{depth:l+1,name:t,path:r,multihash:e.multihash,pathRest:t?s.slice(1):s,parent:h||f}:""}),n.filter(Boolean),a)];return s.length||p.unshift(n.values([h])),i(p)}e.exports=o},function(e,t,r){"use strict";(function(t){const n=r(224),i=r(38),o=r(9),s=r(8),a=r(318),u=r(576);function c(e,r,c,f,l){if(f===c||0===l)return s.once(t.alloc(0));const h=f+l;function p({node:e,start:r}){try{if(t.isBuffer(e))return u(e,r,f,h);const n=i.unmarshal(e.data);if(!n.data){if(n.blockSizes.length)return;return t.alloc(0)}return u(n.data,r,f,h)}catch(e){throw new Error(`Failed to unmarshal node - ${e.message}`)}}let d=0;function y({node:r}){if(t.isBuffer(r))return s.empty();const n=i.unmarshal(r.data),u=Boolean(n.data&&n.data.length);u&&r.links.length&&(d+=n.data.length);const c=r.links.map((e,t)=>{const r={link:e,start:d,end:d+n.blockSizes[t]};return d=r.end,r}).filter(e=>f>=e.start&&f<e.end||h>e.start&&h<=e.end||f<e.start&&h>e.end);return c.length&&(d=c[0].start),s(s.values(c),a((t,r)=>{e.get(new o(t.link.multihash),(e,n)=>r(e,{start:t.start,end:t.end,node:n&&n.value,size:t.size}))}))}return s(n.depthFirst({node:r,start:0,end:c},y),s.map(p),s.filter(Boolean))}e.exports=((e,r,n,o,a,u,f,l,h,p,d,y)=>{const g=a[0];if(void 0!==g&&g!==o)return s.empty();const m=i.unmarshal(r.data),b=f||m.fileSize();if(d<0)return s.error(new Error("Offset must be greater than or equal to 0"));if(d>b)return s.error(new Error("Offset must be less than the file size"));if(y<0)return s.error(new Error("Length must be greater than or equal to 0"));if(0===y)return s.once({depth:p,content:s.once(t.alloc(0)),name:n,path:o,hash:e,size:b,type:"file"});d||(d=0),(!y||d+y>b)&&(y=b-d);const v=c(l,r,b,d,y);return s.values([{depth:p,content:v,name:n,path:o,hash:e,size:b,type:"file"}])})}).call(this,r(0).Buffer)},function(e,t,r){"use strict";const n=r(9),i=r(8);e.exports=((e,t,r,o,s,a,u,c,f,l)=>{let h;if(s.length){const e=s[0];h=t[e];const r=o+"/"+e;if(!h)return i.error("not found");const u=n.isCID(h);return i(i.values([{depth:l,name:e,path:r,pathRest:s.slice(1),multihash:u&&h,object:!u&&h,parent:f}]),a)}return i.error(new Error("invalid node type"))})},function(e,t,r){"use strict";(function(t){const n=r(8),i=r(576);e.exports=((e,r,o,s,a,u,c,f,l,h,p,d)=>{const y=a[0];return void 0!==y&&y!==s?n.empty():(c=c||r.length,p<0?n.error(new Error("Offset must be greater than or equal to 0")):p>c?n.error(new Error("Offset must be less than the file size")):d<0?n.error(new Error("Length must be greater than or equal to 0")):0===d?n.once({depth:h,content:n.once(t.alloc(0)),hash:e,name:o,path:s,size:c,type:"raw"}):(p||(p=0),(!d||p+d>c)&&(d=c-p),n.once({depth:h,content:n.once(i(r,0,p,p+d)),hash:e,name:o,path:s,size:c,type:"raw"})))})}).call(this,r(0).Buffer)},function(e,t,r){var n=r(162),i=r(8);e.exports=function(e){var t=n(),r=i.collect(function(r,n){t.resolve(i.values(n.sort(e)))});return function(e){return r(e),t}}},function(e,t,r){"use strict";const n=r(22),i=r(3);e.exports=function e(t){return{subscribe:(e,r,n,i)=>{if("function"==typeof n&&(i=n,n={}),!i)return new Promise((i,o)=>{t._libp2pNode.pubsub.subscribe(e,n,r,e=>{if(e)return o(e);i()})});t._libp2pNode.pubsub.subscribe(e,n,r,i)},unsubscribe:(e,r,n)=>{if(t._libp2pNode.pubsub.unsubscribe(e,r),!n)return Promise.resolve();i(()=>n())},publish:n((e,r,n)=>{t._libp2pNode.pubsub.publish(e,r,n)}),ls:n(e=>{t._libp2pNode.pubsub.ls(e)}),peers:n((e,r)=>{t._libp2pNode.pubsub.peers(e,r)}),setMaxListeners(e){t._libp2pNode.pubsub.setMaxListeners(e)}}}},function(e,t,r){"use strict";(function(t){const n=r(22),i=r(1368),o=r(68),s=r(9),a=r(41),u=r(3),c=r(88);e.exports=(e=>({get:n((r,n,i)=>{if(!t.isBuffer(r))return i(new Error("Not valid key"));"function"==typeof n&&(i=n,n={}),e._libp2pNode.dht.get(r,n.timeout,i)}),put:n((r,n,i)=>{if(!t.isBuffer(r))return i(new Error("Not valid key"));e._libp2pNode.dht.put(r,n,i)}),findprovs:n((t,r,n)=>{if("function"==typeof r&&(n=r,r={}),r=r||{},"string"==typeof t)try{t=new s(t)}catch(e){return u(()=>n(c(e,"ERR_INVALID_CID")))}"function"==typeof r&&(n=r,r={}),r=r||{},e._libp2pNode.contentRouting.findProviders(t,r.timeout||null,n)}),findpeer:n((t,r)=>{"string"==typeof t&&(t=o.createFromB58String(t)),e._libp2pNode.peerRouting.findPeer(t,(e,t)=>{if(e)return r(e);const n=[{Responses:[{ID:t.id.toB58String(),Addresses:t.multiaddrs.toArray().map(e=>e.toString())}]}];r(null,n)})}),provide:n((t,r,n)=>{Array.isArray(t)||(t=[t]),"function"==typeof r&&(n=r,r={}),i(t,(t,r)=>{e._repo.blocks.has(t,r)},(i,o)=>i?n(i):o?void(r.recursive||a(t,(t,r)=>{e._libp2pNode.contentRouting.provide(t,r)},n)):n(new Error("block(s) not found locally, cannot provide")))}),query:n((t,r)=>{"string"==typeof t&&(t=o.createFromB58String(t)),e._libp2pNode._dht.getClosestPeers(t.toBytes(),(e,t)=>{if(e)return r(e);r(null,t.map(e=>({ID:e.toB58String()})))})})}))}).call(this,r(0).Buffer)},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(308),i=c(n),o=r(164),s=c(o),a=r(1369),u=c(a);function c(e){return e&&e.__esModule?e:{default:e}}t.default=(0,s.default)((0,i.default)(u.default,u.default)),e.exports=t.default},function(e,t,r){"use strict";function n(e){return!e}Object.defineProperty(t,"__esModule",{value:!0}),t.default=n,e.exports=t.default},function(e,t,r){"use strict";const n=r(1371),i=r(22);e.exports=(()=>i((e,t,r)=>{if("string"!=typeof e)return r(new Error("Invalid arguments, domain must be a string"));"function"==typeof t&&(r=t,t={}),n(e,t,r)}))},function(e,t,r){"use strict";e.exports=((e,t,r)=>{e=encodeURIComponent(e);let n=`https://ipfs.io/api/v0/dns?arg=${e}`;for(const e in t)n+=`&${e}=${t[e]}`;self.fetch(n,{mode:"cors"}).then(e=>e.json()).then(e=>e.Path?r(null,e.Path):r(new Error(e.Message))).catch(e=>{r(e)})})},function(e,t,r){"use strict";const n=r(22);e.exports=function e(t){return{gen:n((e,r,n)=>{t._keychain.createKey(e,r.type,r.size,n)}),info:n((e,r)=>{t._keychain.findKeyByName(e,r)}),list:n(e=>{t._keychain.listKeys(e)}),rm:n((e,r)=>{t._keychain.removeKey(e,r)}),rename:n((e,r,n)=>{t._keychain.renameKey(e,r,(t,r)=>{if(t)return n(t);const i={was:e,now:r.name,id:r.id,overwrite:!1};n(null,i)})}),import:n((e,r,n,i)=>{t._keychain.importKey(e,r,n,i)}),export:n((e,r,n)=>{t._keychain.exportKey(e,r,n)})}}},function(e,t,r){"use strict";const n=r(22),i=r(107),o=r(43),s=r(1374),a=r(142),u=r(88);function c(e,t){return new Promise((r,n)=>{let o;o=t.peer?e._libp2pNode.stats.forPeer(t.peer):t.proto?e._libp2pNode.stats.forProtocol(t.proto):e._libp2pNode.stats.global,r(o?{totalIn:o.snapshot.dataReceived,totalOut:o.snapshot.dataSent,rateIn:new i(o.movingAverages.dataReceived[6e4].movingAverage()/60),rateOut:new i(o.movingAverages.dataSent[6e4].movingAverage()/60)}:{totalIn:new i(0),totalOut:new i(0),rateIn:new i(0),rateOut:new i(0)})})}e.exports=function e(t){const i=e=>{e=e||{};let r=null,n=o(!0,()=>{r&&clearInterval(r)});return e.poll?s(e.interval||"1s",(i,o)=>{if(i)return n.end(u(i,"ERR_INVALID_POLL_INTERVAL"));r=setInterval(()=>{c(t,e).then(e=>n.push(e)).catch(e=>n.end(e))},o)}):c(t,e).then(e=>{n.push(e),n.end()}).catch(e=>n.end(e)),n.source};return{bitswap:r(579)(t).stat,repo:r(504)(t).stat,bw:n((e,r)=>{"function"==typeof e&&(r=e,e={}),c(t,e).then(e=>r(null,e)).catch(e=>r(e))}),bwReadableStream:e=>a.source(i(e)),bwPullStream:i}}},function(e,t,r){"use strict";const n=r(22),i=/^((\d+(\.\d+)*)(ns|ms|us|µs|m|s|h))+$/,o=/((\d+(\.\d+)*)(ns|ms|us|µs|m|s|h))/g,s=/(ns|ms|us|µs|m|s|h)/g,a={ns:1e-6,us:.001,"µs":.001,ms:1,s:1e3,m:6e4,h:36e5};function u(e){let t=e.match(s)[0];return e=e.substring(0,e.length-t.length),parseFloat(e)*a[t]}e.exports=n(function(e,t){return"string"!=typeof e?t(new Error("the first argument must be a string")):i.test(e)?void t(null,e.match(o).reduce((e,t)=>e+u(t),0)):t(new Error("invalid time"))})},function(e,t,r){"use strict";const n=r(22),i=r(1376);e.exports=(e=>{const t=Object.assign({},e);return t.dag=Object.assign({},e.dag,{get:n((t,r,n,i)=>("function"==typeof r&&(i=r,r=void 0),"function"==typeof n&&(i=n,n={}),n=Object.assign({},n,{preload:!1}),e.dag.get(t,r,n,i))),put:n((t,r,n)=>("function"==typeof r&&(n=r,r={}),r=Object.assign({},r,{preload:!1}),e.dag.put(t,r,n)))}),i(t,t._options)})},function(e,t,r){"use strict";e.exports=r(1377)},function(e,t,r){"use strict";const n=r(22),{createLock:i}=r(45),o={ls:r(1409),stat:r(589)},s={cp:r(590),flush:r(1410),mkdir:r(1411),mv:r(1412),rm:r(591)},a={write:r(1413),read:r(1417)},u={readPullStream:r(320),readReadableStream:r(1418)},c=({ipfs:e,mfs:t,operations:r,lock:i})=>{Object.keys(r).forEach(o=>{t[o]=n(i(r[o](e)))})},f={repoOwner:!0};e.exports=((e,t)=>{const{repoOwner:r}=Object.assign({},f||{},t),l=i(r),h=e=>l.readLock(e),p=e=>l.writeLock(e),d={};return c({ipfs:e,mfs:d,operations:o,lock:h}),c({ipfs:e,mfs:d,operations:s,lock:p}),Object.keys(a).forEach(t=>{d[t]=n(a[t](e))}),Object.keys(u).forEach(t=>{d[t]=u[t](e)}),d})},function(e,t,r){"use strict";(function(t){const r=e=>{let r=t.alloc(0);const n=(i,o)=>{e(null,(e,s)=>{if(e)return!0===e?o(null,r):o(e);if(r=t.concat([r,s]),r.length<i)return n(i,o);const a=r.slice(0,i);r=r.slice(i),o(null,a)})};return n};e.exports=r}).call(this,r(0).Buffer)},function(e,t,r){"use strict";const n=r(342),i=e=>{let t=0;return n(e=>{t+=e.length},()=>{e(t)})};e.exports=i},function(e,t,r){"use strict";const n=r(1381),i=r(1)("ipfs:mfs:lock");let o;e.exports=(e=>{if(o)return o;const t=n({singleProcess:e}),r=(e,r,n,o)=>{i(`Queuing ${e} operation`),t[`${e}Lock`](()=>new Promise((t,o)=>{n.push((r,n)=>{if(i(`${e} operation callback invoked${r?" with error: "+r.message:""}`),r)return o(r);t(n)}),i(`Starting ${e} operation`),r.apply(null,n)})).then(t=>{i(`Finished ${e} operation`);const r=o;o=null,r(null,t)}).catch(t=>{if(i(`Finished ${e} operation with error: ${t.message}`),o)return o(t);throw i(`Callback already invoked for ${e} operation`),t})};return o={readLock:e=>(function(){const t=Array.from(arguments);let n=t.pop();r("read",e,t,n)}),writeLock:e=>(function(){const t=Array.from(arguments);let n=t.pop();r("write",e,t,n)})},o})},function(e,t,r){(function(t){const n=r(1382),i=r(1392),o=r(1393),{timeout:s}=r(1394),a=r(582),u={};let c;const f=(e,t)=>{if(c.isWorker)return{readLock:c.readLock(e,t),writeLock:c.writeLock(e,t)};const r=new o({concurrency:1});let n=null;return{readLock:e=>{if(!n){n=new o({concurrency:t.concurrency,autoStart:!1});const e=n;r.add(()=>(e.start(),e.onIdle().then(()=>{n===e&&(n=null)})))}return n.add(()=>s(e(),t.timeout))},writeLock:e=>(n=null,r.add(()=>s(e(),t.timeout)))}},l={concurrency:1/0,timeout:846e5,global:t,singleProcess:!1};e.exports=((e,t)=>(t||(t={}),"object"==typeof e&&(t=e,e="lock"),e||(e="lock"),t=Object.assign({},l,t),c||(c=n(t)||i(t),c.isWorker||(c.on("requestReadLock",(e,t)=>{u[e]&&u[e].readLock(t)}),c.on("requestWriteLock",(e,t)=>{u[e]&&u[e].writeLock(t)}))),u[e]||(u[e]=f(e,t)),u[e])),e.exports.Worker=function(e,r){let n;r=r||t.Worker;try{n=new r(e)}catch(t){t.message.includes("not a constructor")&&(n=r(e))}if(!n)throw new Error("Could not create Worker from",r);return a(n),n}}).call(this,r(7))},function(e,t,r){(function(t){const n=r(10).EventEmitter,i=r(580),{WORKER_REQUEST_READ_LOCK:o,WORKER_RELEASE_READ_LOCK:s,MASTER_GRANT_READ_LOCK:a,WORKER_REQUEST_WRITE_LOCK:u,WORKER_RELEASE_WRITE_LOCK:c,MASTER_GRANT_WRITE_LOCK:f}=r(581);let l;const h=(e,t,r,n,i)=>(o,s)=>{s&&s.type===r&&e.emit(t,s.name,()=>(o.send({type:i,name:s.name,identifier:s.identifier}),new Promise(e=>{const t=r=>{r&&r.type===n&&r.identifier===s.identifier&&(o.removeListener("message",t),e())};o.on("message",t)})))},p=(e,r,n,o)=>s=>{const a=i.generate();return t.send({type:r,identifier:a,name:e}),new Promise((r,i)=>{const u=c=>{if(c&&c.type===n&&c.identifier===a){t.removeListener("message",u);let n=null;s().catch(e=>{n=e}).then(s=>{if(t.send({type:o,identifier:a,name:e}),n)return i(n);r(s)})}};t.on("message",u)})};e.exports=(e=>{try{if(l=r(1391),!Object.keys(l).length)return}catch(e){return}if(l.isMaster||e.singleProcess){const e=new n;return l.on("message",h(e,"requestReadLock",o,s,a)),l.on("message",h(e,"requestWriteLock",u,c,f)),e}return{isWorker:!0,readLock:(e,t)=>p(e,o,a,s),writeLock:(e,t)=>p(e,u,f,c)}})}).call(this,r(6))},function(e,t,r){"use strict";var n=r(200),i=r(1385),o=r(1389),s=r(1390)||0;function a(t){return n.seed(t),e.exports}function u(t){return s=t,e.exports}function c(e){return void 0!==e&&n.characters(e),n.shuffled()}function f(){return i(s)}e.exports=f,e.exports.generate=f,e.exports.seed=a,e.exports.worker=u,e.exports.characters=c,e.exports.isValid=o},function(e,t,r){"use strict";var n=1;function i(){return n=(9301*n+49297)%233280,n/233280}function o(e){n=e}e.exports={nextValue:i,seed:o}},function(e,t,r){"use strict";var n=r(1386),i=r(200),o=1459707606518,s=6,a,u;function c(e){var t="",r=Math.floor(.001*(Date.now()-o));return r===u?a++:(a=0,u=r),t+=n(s),t+=n(e),a>0&&(t+=n(a)),t+=n(r),t}e.exports=c},function(e,t,r){"use strict";var n=r(200),i=r(1387),o=r(1388);function s(e){for(var t=0,r,s="";!r;)s+=o(i,n.get(),1),r=e<Math.pow(16,t+1),t++;return s}e.exports=s},function(e,t,r){"use strict";var n="object"==typeof window&&(window.crypto||window.msCrypto),i;i=n&&n.getRandomValues?function(e){return n.getRandomValues(new Uint8Array(e))}:function(e){for(var t=[],r=0;r<e;r++)t.push(Math.floor(256*Math.random()));return t},e.exports=i},function(e,t){e.exports=function(e,t,r){for(var n=(2<<Math.log(t.length-1)/Math.LN2)-1,i=Math.ceil(1.6*n*r/t.length),o="";;)for(var s=e(i),a=0;a<i;a++){var u=s[a]&n;if(t[u]&&(o+=t[u],o.length===r))return o}}},function(e,t,r){"use strict";var n=r(200);function i(e){if(!e||"string"!=typeof e||e.length<6)return!1;var t=new RegExp("[^"+n.get().replace(/[|\\{}()[\]^$+*?.-]/g,"\\$&")+"]");return!t.test(e)}e.exports=i},function(e,t,r){"use strict";e.exports=0},function(e,t){},function(e,t,r){(function(t){const n=r(10).EventEmitter,i=r(580),{WORKER_REQUEST_READ_LOCK:o,WORKER_RELEASE_READ_LOCK:s,MASTER_GRANT_READ_LOCK:a,WORKER_REQUEST_WRITE_LOCK:u,WORKER_RELEASE_WRITE_LOCK:c,MASTER_GRANT_WRITE_LOCK:f}=r(581),l=r(582),h=(e,t,r,n,i)=>(o,s)=>{if(!s||!s.data||s.data.type!==r)return;const a={type:s.data.type,name:s.data.name,identifier:s.data.identifier};e.emit(t,a.name,()=>(o.postMessage({type:i,name:a.name,identifier:a.identifier}),new Promise(e=>{const t=r=>{if(!r||!r.data)return;const i={type:r.data.type,name:r.data.name,identifier:r.data.identifier};i&&i.type===n&&i.identifier===a.identifier&&(o.removeEventListener("message",t),e())};o.addEventListener("message",t)})))},p=(e,t,r,n,o)=>s=>{const a=i.generate();return e.postMessage({type:r,identifier:a,name:t}),new Promise((r,i)=>{const u=c=>{if(!c||!c.data)return;const f={type:c.data.type,identifier:c.data.identifier};if(f&&f.type===n&&f.identifier===a){let n;e.removeEventListener("message",u),s().catch(e=>{n=e}).then(s=>(e.postMessage({type:o,identifier:a,name:t}),n?i(n):r(s)))}};e.addEventListener("message",u)})},d={global:t,singleProcess:!1};e.exports=(e=>{e=Object.assign({},d,e);const t=!!e.global.document||e.singleProcess;if(t){const e=new n;return l.addEventListener("message",h(e,"requestReadLock",o,s,a)),l.addEventListener("message",h(e,"requestWriteLock",u,c,f)),e}return{isWorker:!0,readLock:(e,t)=>p(t.global,e,o,a,s),writeLock:(e,t)=>p(t.global,e,u,f,c)}})}).call(this,r(7))},function(e,t,r){"use strict";function n(e,t,r){let n=0,i=e.length;for(;i>0;){const o=i/2|0;let s=n+o;r(e[s],t)<=0?(n=++s,i-=o+1):i=o}return n}class i{constructor(){this._queue=[]}enqueue(e,t){t=Object.assign({priority:0},t);const r={priority:t.priority,run:e};if(this.size&&this._queue[this.size-1].priority>=t.priority)return void this._queue.push(r);const i=n(this._queue,r,(e,t)=>t.priority-e.priority);this._queue.splice(i,0,r)}dequeue(){return this._queue.shift().run}get size(){return this._queue.length}}class o{constructor(e){if(e=Object.assign({concurrency:1/0,autoStart:!0,queueClass:i},e),!("number"==typeof e.concurrency&&e.concurrency>=1))throw new TypeError(`Expected \`concurrency\` to be a number from 1 and up, got \`${e.concurrency}\` (${typeof e.concurrency})`);this.queue=new e.queueClass,this._queueClass=e.queueClass,this._pendingCount=0,this._concurrency=e.concurrency,this._isPaused=!1===e.autoStart,this._resolveEmpty=(()=>{}),this._resolveIdle=(()=>{})}_next(){this._pendingCount--,this.queue.size>0?this._isPaused||this.queue.dequeue()():(this._resolveEmpty(),this._resolveEmpty=(()=>{}),0===this._pendingCount&&(this._resolveIdle(),this._resolveIdle=(()=>{})))}add(e,t){return new Promise((r,n)=>{const i=()=>{this._pendingCount++;try{Promise.resolve(e()).then(e=>{r(e),this._next()},e=>{n(e),this._next()})}catch(e){n(e),this._next()}};!this._isPaused&&this._pendingCount<this._concurrency?i():this.queue.enqueue(i,t)})}addAll(e,t){return Promise.all(e.map(e=>this.add(e,t)))}start(){if(this._isPaused)for(this._isPaused=!1;this.queue.size>0&&this._pendingCount<this._concurrency;)this.queue.dequeue()()}pause(){this._isPaused=!0}clear(){this.queue=new this._queueClass}onEmpty(){return 0===this.queue.size?Promise.resolve():new Promise(e=>{const t=this._resolveEmpty;this._resolveEmpty=(()=>{t(),e()})})}onIdle(){return 0===this._pendingCount?Promise.resolve():new Promise(e=>{const t=this._resolveIdle;this._resolveIdle=(()=>{t(),e()})})}get size(){return this.queue.size}get pending(){return this._pendingCount}get isPaused(){return this._isPaused}}e.exports=o},function(e,t,r){"use strict";var n,i=e.exports.timeout=function(e,t){var r=new n,i;return Promise.race([e,new Promise(function(e,n){i=setTimeout(function(){n(r)},t)})]).then(function(e){return clearTimeout(i),e},function(e){throw clearTimeout(i),e})};n=e.exports.TimeoutError=function(){Error.call(this),this.stack=Error().stack,this.message="Timeout"},n.prototype=Object.create(Error.prototype),n.prototype.name="TimeoutError"},function(e,t,r){"use strict";(function(t){const n=r(9);e.exports=((e,r)=>(t.isBuffer(e)&&(e=new n(e)),"base58btc"===r?e.toBaseEncodedString():e.toV1().toBaseEncodedString(r)))}).call(this,r(0).Buffer)},function(e,t,r){"use strict";const n=r(123),i=e=>{let t=0;return n((r,n)=>{t>e&&n(!0),t+r.length>e&&(r=r.slice(0,e-t)),t+=r.length,n(null,r)})};e.exports=i},function(e,t,r){"use strict";const n=r(5),i=r(9),o=r(1)("ipfs:mfs:utils:load-node"),s=(e,t,r)=>{const s=t&&(t.multihash||t.hash);if(!s)return o("No multihash passed so cannot load DAGNode"),r();const a=new i(s);o(`Loading DAGNode for child ${a.toBaseEncodedString()}`),n([t=>e.dag.get(a,t),(e,t)=>t(null,e.value)],r)};e.exports=s},function(e,t,r){"use strict";(function(t,n){const i=r(141),o=r(577),s=r(1399),a=r(578),u=r(1402),c=r(82),f=r(1)("ipfs:mfs:utils:to-pull-source"),l=r(5),h=(e,r,h)=>e?t.isBuffer(e)?(f("Content was a buffer"),r.length=r.length||e.length,h(null,c([e]))):"string"==typeof e||e instanceof String?(f("Content was a path"),l([t=>r.length?t(null,{size:r.length}):u.stat(e,t),(t,n)=>{r.length=t.size,n(null,i.source(u.createReadStream(e)))}],h)):(n.Blob&&e instanceof n.Blob&&(f("Content was an HTML5 Blob"),r.length=r.length||e.size,e=s(e)),o(e)?(f("Content was a Node stream"),h(null,i.source(e))):a.isSource(e)?(f("Content was a pull-stream"),h(null,e)):void h(new Error(`Don't know how to convert ${e} into a pull stream source`))):h(new Error("paths must start with a leading /"));e.exports=h}).call(this,r(0).Buffer,r(7))},function(e,t,r){var n=r(1400),i=r(585);e.exports=function(e,t){t=t||{};var r=t.offset||0,o=t.chunkSize||1048576,s=new FileReader(e),a=n(function(t,n){if(r>=e.size)return n(null,null);s.onloadend=function e(t){var r=t.target.result;r instanceof ArrayBuffer&&(r=i(new Uint8Array(t.target.result))),n(null,r)};var a=r+o,u=e.slice(r,a);s.readAsArrayBuffer(u),r=a});return a.name=e.name,a.size=e.size,a.type=e.type,a.lastModified=e.lastModified,s.onerror=function(e){a.destroy(e)},a}},function(e,t,r){(function(t){var n=r(21).Readable,i=r(4);e.exports=a,a.ctor=u,a.obj=c;var o=u();function s(e){return e=e.slice(),function(t,r){var n=null,i=e.length?e.shift():null;i instanceof Error&&(n=i,i=null),r(n,i)}}function a(e,t){("object"!=typeof e||Array.isArray(e))&&(t=e,e={});var r=new o(e);return r._from=Array.isArray(t)?s(t):t||f,r}function u(e,r){function o(t){if(!(this instanceof o))return new o(t);this._reading=!1,this._callback=s,this.destroyed=!1,n.call(this,t||e);var r=this,i=this._readableState.highWaterMark;function s(e,t){if(!r.destroyed){if(e)return r.destroy(e);if(null===t)return r.push(null);r._reading=!1,r.push(t)&&r._read(i)}}}return"function"==typeof e&&(r=e,e={}),e=l(e),i(o,n),o.prototype._from=r||f,o.prototype._read=function(e){this._reading||this.destroyed||(this._reading=!0,this._from(e,this._callback))},o.prototype.destroy=function(e){if(!this.destroyed){this.destroyed=!0;var r=this;t.nextTick(function(){e&&r.emit("error",e),r.emit("close")})}},o}function c(e,t){return("function"==typeof e||Array.isArray(e))&&(t=e,e={}),e=l(e),e.objectMode=!0,e.highWaterMark=16,a(e,t)}function f(){}function l(e){return e=e||{},e}}).call(this,r(6))},function(e,t){e.exports=i,i.strict=o,i.loose=s;var r=Object.prototype.toString,n={"[object Int8Array]":!0,"[object Int16Array]":!0,"[object Int32Array]":!0,"[object Uint8Array]":!0,"[object Uint8ClampedArray]":!0,"[object Uint16Array]":!0,"[object Uint32Array]":!0,"[object Float32Array]":!0,"[object Float64Array]":!0};function i(e){return o(e)||s(e)}function o(e){return e instanceof Int8Array||e instanceof Int16Array||e instanceof Int32Array||e instanceof Uint8Array||e instanceof Uint8ClampedArray||e instanceof Uint16Array||e instanceof Uint32Array||e instanceof Float32Array||e instanceof Float64Array}function s(e){return n[r.call(e)]}},function(e,t){},function(e,t,r){"use strict";const n=r(586);function i(e,t){const{sources:r,options:i,callback:o}=n(e,t),s=r.pop();return{sources:r,destination:s,options:i,callback:o}}e.exports=i},function(e,t,r){"use strict";const n=r(9),i=r(1)("ipfs:mfs:utils:traverse-to"),o=r(38),s=r(5),a=r(1405),u=r(587),c=r(588),f=r(319),{FILE_SEPARATOR:l}=r(147),h=r(583),{NonFatalError:p}=r(584),d={parents:!1,flush:!0,createLastComponent:!1,withCreateHint:!0},y=(e,t,r,n)=>{r=Object.assign({},d,r),i("Traversing to",t),s([e=>c(t,e),(t,n)=>"mfs"===t.type?m(e,t,r,n):g(e,t,r,n)],n)},g=(e,t,r,n)=>{i("IPFS",t),s([r=>e.dag.get(t.path,r),(e,r)=>r(null,{name:t.name,node:e&&e.value,parent:null})],n)},m=(e,t,r,c)=>{s([t=>u(e,t),(u,c)=>{const d=t.path.split(l).filter(Boolean),y=[];s([t=>e.dag.get(u,t),(u,c)=>{const g=u.value;y.push({name:l,node:g,parent:null}),a(d.map((e,t)=>({pathSegment:e,index:t})),{name:l,node:g,parent:null},(a,{pathSegment:u,index:c},l)=>{const g=a.node.links.find(e=>e.name===u);if(!g){const g=c===d.length-1;return i(`index ${c} pathSegments.length ${d.length} pathSegment ${u} lastComponent ${g}`,r),g&&!r.createLastComponent?(i(`Last segment of ${t} did not exist`),l(new p("file does not exist"))):g||r.parents?(i(`Adding empty directory '${u}' to parent ${a.name}`),s([t=>h(e,new o("directory").marshal(),[],r,t),(t,i)=>{f(e,{parent:a.node,child:t,name:u,flush:r.flush},(e,r)=>{a.node=r,i(e,{name:u,node:t,cid:new n(t.multihash),parent:a})})}],(e,t)=>{y.push(t),l(e,t)})):(i(`Cannot traverse to ${t} - ${u} did not exist`),l(new p("file does not exist")))}let m=g.hash||g.multihash;const b=new n(m);e.dag.get(b,(e,t)=>{if(e)return l(e);const r=t.value,n={name:u,node:r,parent:a};y.push(n),l(null,n)})},c)}],c)}],c)};e.exports=y},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=h;var n=r(215),i=l(n),o=r(54),s=l(o),a=r(155),u=l(a),c=r(32),f=l(c);function l(e){return e&&e.__esModule?e:{default:e}}function h(e,t,r,n){n=(0,u.default)(n||s.default);var o=(0,f.default)(r);(0,i.default)(e,function(e,r,n){o(t,e,function(e,r){t=r,n(e)})},function(e){n(e,t)})}e.exports=t.default},function(e,t,r){"use strict";const n=r(1)("ipfs:mfs:utils:update-mfs:root"),i=r(5),o=r(9),{MFS_ROOT_KEY:s}=r(147),a=(e,t,r)=>{const a=e._repo,u=a&&a.datastore;if(!a||!u)return r(new Error("Please run jsipfs init first"));const c=new o(t);n(`New MFS root will be ${c.toBaseEncodedString()}`),i([e=>{if(a.closed)return n("Opening datastore"),u.open(t=>e(t));n("Datastore was already open"),e()},e=>u.put(s,c.buffer,t=>e(t))],e=>r(e,c))};e.exports=a},function(e,t,r){"use strict";const n=r(344),i=r(319),o=(e,t,r)=>{n(r=>{if(!t.parent){const e=t;return t=null,r(null,e)}i(e,{parent:t.parent.node,child:t.node,name:t.name,flush:!0},(e,n)=>{t.parent.node=n;const i=t;t=t.parent,r(e,i)})},()=>Boolean(t),r)};e.exports=o},function(e,t,r){"use strict";(function(t){const r=(e=1/0,r=4096)=>{let n=0;return(i,o)=>{if(i)return o&&o(i);if(n>=e){const e=!0;return o(e)}let s=r;n+s>e&&(s=e-n),n+=s,o(null,t.alloc(s,0))}};e.exports=r}).call(this,r(0).Buffer)},function(e,t,r){"use strict";const n=r(5),i=r(74),o=r(38),{traverseTo:s,loadNode:a,formatCid:u,FILE_SEPARATOR:c,FILE_TYPES:f}=r(45),l={long:!1,cidBase:"base58btc",unsorted:!1};e.exports=(e=>(function t(r,h,p){"function"==typeof r&&(p=r,r=c,h={}),"function"==typeof h&&(p=h,h={}),h=Object.assign({},l,h),h.long=h.l||h.long,n([t=>s(e,r,{},t),(t,r)=>{const s=o.unmarshal(t.node.data);"directory"===s.type?i(t.node.links,(t,r)=>{n([r=>a(e,t,r),(e,r)=>{const n=o.unmarshal(e.data);r(null,{name:t.name,type:n.type,hash:u(e.multihash,h.cidBase),size:n.fileSize()||0})}],r)},r):r(null,[{name:t.name,type:s.type,hash:u(t.node.multihash,h.cidBase),size:s.fileSize()||0}])},(e,t)=>h.unsorted?t(null,e):t(null,e.sort((e,t)=>t.name.localeCompare(e.name))),(e,t)=>t(null,e.map(e=>(f.hasOwnProperty(e.type)&&(e.type=f[e.type]),h.long||(e.type=0,e.size=0,e.hash=""),e)))],p)}))},function(e,t,r){"use strict";const n=r(5),{traverseTo:i,FILE_SEPARATOR:o}=r(45),s={};e.exports=(e=>(function t(r,a,u){"function"==typeof a&&(u=a,a={}),"function"==typeof r&&(u=r,a={},r=o),r||(r=o),a=Object.assign({},s,a),n([t=>i(e,r,{},t),(e,t)=>{t()}],u)}))},function(e,t,r){"use strict";const n=r(5),i=r(1)("ipfs:mfs:mkdir"),{updateMfsRoot:o,updateTree:s,traverseTo:a,FILE_SEPARATOR:u}=r(45),c={parents:!1,hash:void 0,cidVersion:0};e.exports=(e=>(function t(r,f,l){return"function"==typeof f&&(l=f,f={}),f=Object.assign({},c,f),f.parents=f.p||f.parents,f.cidVersion=f.cidVersion||0,r?(r=r.trim(),r===u?l(f.parents?null:new Error(`cannot create directory '${u}': Already exists`)):(i(`Creating ${r}`),void n([t=>{a(e,r,{parents:!1,createLastComponent:!1},e=>e?e.message.includes("does not exist")?(i(`${r} does not exist`),t()):t(e):(i(`${r} already exists`),t(new Error("file already exists"))))},t=>a(e,r,{parents:f.parents,flush:f.flush,createLastComponent:!0},t),(t,r)=>s(e,t,r),(t,r)=>o(e,t.node.multihash,r)],e=>{e&&e.message.includes("file already exists")&&f.parents&&(e=null),l(e)}))):l(new Error("no path given to Mkdir"))}))},function(e,t,r){"use strict";const n=r(37),{toSources:i}=r(45),o=r(590),s=r(591),a={parents:!1,recursive:!1,flush:!0,format:"dag-pb",hashAlg:"sha2-256"};e.exports=(e=>(function t(){let r=Array.from(arguments);Array.isArray(r[0])&&(r=r[0].concat(r.slice(1)));const{sources:u,options:c,callback:f}=i(r,a),l=u.map(e=>e.path).concat(c),h=u.slice(0,-1).map(e=>e.path).concat(Object.assign(c,{recursive:!0}));n([t=>o(e).apply(null,l.concat(t)),t=>s(e).apply(null,h.concat(t))],f)}))},function(e,t,r){"use strict";(function(t){const n=r(22),i=r(9),o=r(5),s=r(46),{createLock:a,updateMfsRoot:u,validatePath:c,traverseTo:f,addLink:l,updateTree:h,limitStreamBytes:p,toPullSource:d}=r(45),y=r(82),g=r(1)("ipfs:mfs:write"),m=r(592),b=r(1414),v=r(143),_=r(64),w={offset:0,length:void 0,create:!1,truncate:!1,rawLeaves:!1,reduceSingleLeafToSelf:!1,cidVersion:0,hashAlg:"sha2-256",format:"dag-pb",parents:!1,progress:void 0,strategy:"trickle",flush:!0,leafType:"raw"};e.exports=function e(t){return n((e,r,n,i)=>("function"==typeof n&&(i=n,n={}),n=Object.assign({},w,n),n.offset<0?i(new Error("cannot have negative write offset")):n.length<0?i(new Error("cannot have negative byte count")):0!==n.length||n.truncate?(n.length||(n.length=1/0),n.cidVersion=n.cidVersion||0,void o([t=>{s([e=>d(r,n,e),t=>c(e,t)],t)},([e,r],i)=>{o([i=>{const o=Object.assign({},n,{createLastComponent:n.parents});o.createLastComponent?a().writeLock(n=>{f(t,r.directory,o,(t,r)=>n(t,{source:e,containingFolder:r}))})(i):a().readLock(n=>{f(t,r.directory,o,(t,r)=>n(t,{source:e,containingFolder:r}))})(i)},({source:e,containingFolder:i},o)=>{S(t,n,r,e,i,o)}],i)}],e=>i(e))):i()))};const S=(e,r,n,s,c,d)=>{o([o=>{const a=c.node.links.reduce((e,t)=>t.name===n.name?t:e,null);if(a){const t=new i(a.multihash);g(`Updating linked DAGNode ${t.toBaseEncodedString()}`),b(e,t,s,r,o)}else{if(!r.create)return o(new Error("file does not exist"));r.offset&&(r.length+=r.offset,s=v([y([t.alloc(r.offset,0)]),s])),s=_(s,p(r.length)),g("Importing file",n.name),m(e,s,r,o)}},(t,i)=>{a().writeLock(i=>{const s=Object.assign({},r,{createLastComponent:r.parents});f(e,n.directory,s,(s,a)=>{if(s)return i(s);o([i=>{l(e,{parent:a.node,name:n.name,child:{multihash:t.multihash||t.hash,size:t.size},flush:r.flush},(e,t)=>{a.node=t,i(e)})},t=>h(e,a,t),(t,r)=>u(e,t.node.multihash,r)],i)})})(i)}],d)}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";const n=r(38),{unmarshal:i}=n,o=r(64),s=r(143),a=r(90),u=r(43),c=r(340),f=r(124),l=r(5),h=r(46),p=r(1)("ipfs:mfs:write:update-node"),{limitStreamBytes:d,countStreamBytes:y,createNode:g,zeros:m,loadNode:b}=r(45),v=r(592),_=r(1415),w=r(1416),{DAGLink:S}=r(42),k=(e,t,r,n,k)=>{let E=n.offset||0,A=E,x=E+n.length,I=A;l([r=>b(e,t,r),(b,k)=>{const T=i(b.data),B=T.fileSize();p(`Updating bytes ${A}-${x} of ${B} bytes from ${t.toBaseEncodedString()} with source`);let C=0;A>B&&(C=A-B,p(`Adding ${C} 0s to the start of the block`),r=s([m(C),r]));const P=u(),O=u();o(r,f(Boolean),d(n.length+C),y(e=>{x===1/0&&(x=E+e)}),c(e=>{p(`Writing ${e.length} at ${I} of ${B}`),I<B?I+e.length>B?(P.push(e.slice(0,B-I)),O.push(e.slice(B-I))):P.push(e):O.push(e),I+=e.length}),a(e=>{P.end(e),O.end()})),l([t=>{h([t=>_(e,b,B,A,x,P,n,t),t=>v(e,O,n,t)],t)},([t,r],o)=>{t=t||b;const s=i(t.data),a=i(r.data);if(a.fileSize()){const i=t.links;return a.data&&a.data.length?(p("New data was found on appended node"),r.links&&r.links.length&&p("New data was also found on appended node children"),s.addBlockSize(a.fileSize()),i.push(new S("",r.size,r.multihash))):r.links&&r.links.length&&(p("New data required multiple DAGNodes"),r.links.forEach((e,t)=>{s.addBlockSize(a.blockSizes[t]),i.push(e)})),g(e,s.marshal(),i,n,o)}o(null,t)},(t,r)=>{if(n.truncate)return w(e,t,x,n,r);r(null,t)}],k)}],k)};e.exports=k},function(e,t,r){"use strict";(function(t){const n=r(5),i=r(64),o=r(82),s=r(123),a=r(124),u=r(90),c=r(318),f=r(1)("ipfs:mfs:write:update-tree"),l=r(38),h=r(9),{unmarshal:p}=l,{leafFirst:d}=r(224),{DAGLink:y}=r(42),{createNode:g,loadNode:m,bufferPullStreamSource:b}=r(45),v=(e,r,v,_,w,S,k,E)=>{let A=0;function x({node:t}){const r=p(t.data);f(`Node links ${t.links.length}${r.blockSizes.length?`, block sizes ${r.blockSizes.join(", ")}`:""} with ${r.data?`${r.data.length} bytes of`:"no"} data`);const n={node:t},s=t.links.map((e,t)=>{const i={parent:n,link:e,index:t,nodeStart:A,nodeEnd:A+r.blockSizes[t]};return A=i.nodeEnd,i}).filter((e,t)=>(f("child.nodeStart",e.nodeStart,"child.nodeEnd",e.nodeEnd,"streamStart",_,"streamEnd",w),_>=e.nodeStart&&_<e.nodeEnd||w>e.nodeStart&&w<=e.nodeEnd||_<e.nodeStart&&w>e.nodeEnd));return s.length?(A=s[0].nodeStart,f(`Updating links with index(es) ${s.map(e=>e.index).join(",")}`)):f("No links to update"),i(o(s),c((t,r)=>{m(e,t.link,(e,n)=>{r(e,Object.assign({},t,{node:n}))})}))}function I(r){const i=b(r);return({parent:r,link:o,nodeStart:s,node:a,index:u},c)=>{if(!a||!a.data)return c();const f=p(a.data);if(!f||!f.data||!f.data.length)return c();n([e=>i(f.data.length,e),(e,r)=>{const n=_-s,i=0;let o=w-_;f.data.length<o&&(_+=f.data.length);const a=t.from(f.data);o===1/0&&(o=void 0);try{e.copy(a,n,0,o)}catch(e){return r(e)}r(null,new l(f.type,a).marshal())},(t,r)=>g(e,t,[],k,r),(e,t)=>{t(null,{parent:r,index:u,multihash:e.multihash,size:e.size})}],c)}}n([t=>i(d({parent:null,link:null,index:null,node:r,nodeStart:A,nodeEnd:v},x),s(I(S)),a(Boolean),s((t,r)=>{if(!t.parent||void 0===t.index)return r(null,t);const i=t.parent.node.links.map((e,r)=>r===t.index?new y("",t.size,t.multihash):e);n([r=>g(e,t.parent.node.data,i,k,r),(e,r)=>{t.parent.node=e,r(null,t)}],r)}),u((e,r)=>{let n;if(!e&&r&&r.length){for(n=r[0];n.parent;)n=n.parent;n.node&&(n=n.node),f(`Updated root is ${new h(n.multihash).toBaseEncodedString()}`)}t(e,n)})),(t,r)=>m(e,t,r)],E)};e.exports=v}).call(this,r(0).Buffer)},function(e,t,r){"use strict";const n=r(146).exporter,i=r(146).importer,o=r(64),s=r(82),a=r(123),u=r(90),c=r(1)("ipfs:mfs:write:truncate-node"),{loadNode:f}=r(45),l=(e,t,r,l,h)=>{c(`Truncating ${t.multihash} to ${r} bytes`),o(n(t.multihash,e.dag,{offset:0,length:r}),a((t,r)=>{o(s([{content:t.content}]),i(e.dag,{progress:l.progress,hashAlg:l.hash,cidVersion:l.cidVersion,strategy:l.strategy,rawLeaves:l.rawLeaves,reduceSingleLeafToSelf:l.reduceSingleLeafToSelf,leafType:l.leafType}),u(r))}),a((t,r)=>f(e,t[0],r)),u((e,t)=>{h(e,t.pop())}))};e.exports=l},function(e,t,r){"use strict";(function(t){const n=r(64),i=r(90),o=r(320);e.exports=(e=>(function r(s,a,u){"function"==typeof a&&(u=a,a={}),n(o(e)(s,a),i((e,r)=>e?u(e):u(null,t.concat(r))))}))}).call(this,r(0).Buffer)},function(e,t,r){"use strict";const n=r(320),i=r(142);e.exports=(e=>(function t(r,o={}){return i.source(n(e)(r,o))}))},function(e,t,r){"use strict";const n=r(277);e.exports=(e=>{const t=e||"ipfs";return new n(t)})},function(e,t,r){"use strict";const n=r(3),i=r(1421),o=r(1423),s=r(1),a=r(9),u=r(1424),c=s("jsipfs:preload");c.error=s("jsipfs:preload:error");const f=e=>{e&&c.error(e)};function l(e){return e.endsWith("http")||e.endsWith("https")||(e+="/http"),o(e)}e.exports=(e=>{const t=e._options.preload||{};if(t.enabled=Boolean(t.enabled),t.addresses=t.addresses||[],!t.enabled||!t.addresses.length){const e=(e,t)=>{t&&n(()=>t())};return e.start=(()=>{}),e.stop=(()=>{}),e}let r=!0,o=[];const s=t.addresses.map(l),h=(e,t)=>{if(t=t||f,"string"!=typeof e)try{e=new a(e).toBaseEncodedString()}catch(e){return n(()=>t(e))}const l=Array.from(s);let h;const p=Date.now();i({times:l.length},t=>{if(r)return t(new Error(`preload aborted for ${e}`));o=o.filter(e=>e!==h);const n=l.shift();h=u(`${n}/api/v0/refs?r=true&arg=${e}`,t),o=o.concat(h)},r=>{if(o=o.filter(e=>e!==h),r)return t(r);c(`preloaded ${e} in ${Date.now()-p}ms`),t()})};return h.start=(()=>{r=!1}),h.stop=(()=>{r=!0,c(`canceling ${o.length} pending preload request(s)`),o.forEach(e=>e.cancel()),o=[]}),h})},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=f;var n=r(54),i=c(n),o=r(1422),s=c(o),a=r(32),u=c(a);function c(e){return e&&e.__esModule?e:{default:e}}function f(e,t,r){var n=5,o=0,a={times:n,intervalFunc:(0,s.default)(o)};function c(e,t){if("object"==typeof t)e.times=+t.times||n,e.intervalFunc="function"==typeof t.interval?t.interval:(0,s.default)(+t.interval||o),e.errorFilter=t.errorFilter;else{if("number"!=typeof t&&"string"!=typeof t)throw new Error("Invalid arguments for async.retry");e.times=+t||n}}if(arguments.length<3&&"function"==typeof e?(r=t||i.default,t=e):(c(a,e),r=r||i.default),"function"!=typeof t)throw new Error("Invalid arguments for async.retry");var f=(0,u.default)(t),l=1;function h(){f(function(e){e&&l++<a.times&&("function"!=typeof a.errorFilter||a.errorFilter(e))?setTimeout(h,a.intervalFunc(l)):r.apply(null,arguments)})}h()}e.exports=t.default},function(e,t){function r(e){return function(){return e}}e.exports=r},function(e,t,r){const n=r(31),i=(e,t)=>t,o={ip4:i,ip6:i,tcp:(e,t,r,n)=>n.some(e=>["http","https","ws","wss"].includes(e.protocol))?`${e}:${t}`:`tcp://${e}:${t}`,udp:(e,t)=>`udp://${e}:${t}`,dnsaddr:i,dns4:i,dns6:i,ipfs:(e,t)=>`${e}/ipfs/${t}`,p2p:(e,t)=>`${e}/p2p/${t}`,http:e=>`http://${e}`,https:e=>`https://${e}`,ws:e=>`ws://${e}`,wss:e=>`wss://${e}`,"p2p-websocket-star":e=>`${e}/p2p-websocket-star`,"p2p-webrtc-star":e=>`${e}/p2p-webrtc-star`,"p2p-webrtc-direct":e=>`${e}/p2p-webrtc-direct`};e.exports=(e=>n(e).stringTuples().map(e=>({protocol:n.protocols.codes[e[0]].name,content:e[1]})).reduce((e,t,r,n)=>{const i=o[t.protocol];if(!i)throw new Error(`Unsupported protocol ${t.protocol}`);return i(e,t.content,r,n)},""))},function(e,t,r){"use strict";const n=r(1),i=n("jsipfs:preload");i.error=n("jsipfs:preload:error"),e.exports=function e(t,r){i(t);const n=new AbortController,o=n.signal;return fetch(t,{signal:o}).then(e=>{if(!e.ok)throw i.error("failed to preload",t,e.status,e.statusText),new Error(`failed to preload ${t}`);return e.text()}).then(()=>r()).catch(r),{cancel:()=>n.abort()}}},function(e,t,r){"use strict";const n=r(1),i=n("jsipfs:mfs-preload");i.error=n("jsipfs:mfs-preload:error"),e.exports=((e,t)=>{let r,n;t=t||{},t.interval=t.interval||3e4;const o=()=>{e.files.stat("/",(s,a)=>s?(n=setTimeout(o,t.interval),i.error("failed to stat MFS root for preload",s)):r!==a.hash?(i(`preloading updated MFS root ${r} -> ${a.hash}`),e._preload(a.hash,e=>{if(n=setTimeout(o,t.interval),e)return i.error(`failed to preload MFS root ${a.hash}`,e);r=a.hash})):void(n=setTimeout(o,t.interval)))};return{start(s){e.files.stat("/",(e,a)=>{if(e)return s(e);r=a.hash,i(`monitoring MFS root ${r}`),n=setTimeout(o,t.interval),s()})},stop(e){clearTimeout(n),e()}}})},function(e,t,r){"use strict";const n=r(1),i=n("jsipfs:state");i.error=n("jsipfs:state:error");const o=r(1427);e.exports=(e=>{const t=o("uninitialized",{uninitialized:{init:"initializing",initialized:"stopped"},initializing:{initialized:"stopped"},stopped:{start:"starting"},starting:{started:"running"},running:{stop:"stopping"},stopping:{stopped:"stopped"}});return t.on("error",e=>i.error(e)),t.on("done",()=>i("-> "+t._state)),t.init=(()=>{t("init")}),t.initialized=(()=>{t("initialized")}),t.stop=(()=>{t("stop")}),t.stopped=(()=>{t("stopped")}),t.start=(()=>{t("start")}),t.started=(()=>{t("started")}),t.state=(()=>t._state),t})},function(e,t,r){const n=r(10).EventEmitter,i=r(13),o=r(1428);function s(e,t){"object"==typeof e&&(t=e,e="START"),i.equal(typeof e,"string"),i.equal(typeof t,"object"),i.ok(t[e],"invalid starting state "+e),i.ok(o.validate(t));const r=new n;return u._graph=o.reachable(t),u._emitter=r,u._events=t,u._state=e,u.emit=u,u.on=s,u;function s(e,t){r.on(e,t)}function u(e){const t=u._events[u._state][e];if(!a(u._state,t,u._graph)){const t="invalid transition: "+u._state+" -> "+e;return r.emit("error",t)}const n=u._state+":leave",i=t+":enter";return u._state?o():s();function o(){r._events[n]?r.emit(n,s):s()}function s(){r._events[i]?r.emit(i,c):c()}function c(){u._state=t,r.emit(t),r.emit("done")}}}function a(e,t,r){if(!t)return!1;if(!e)return!0;const n=r[e];return!(!n||!n[t])&&1===n[t].length}e.exports=s},function(e,t){function r(e,t){for(var r in e){var n=e[r];t(n,r,e)}}function n(e){return Object.keys(e).sort()}function i(e,t){return~e.indexOf(t)}function o(e,t){return e.filter(function(e){return i(t,e)})}function s(e,t){return e.filter(function(e){return!i(t,e)})}function a(e,t){return e.filter(function(e){return!i(t,e)}).concat(t.filter(function(t){return!i(e,t)})).sort()}function u(e,t){if(e.length!=t.length)return!1;for(var r in e)if(t[r]!==e[r])return!1}function c(e){for(var t in e)return!1;return!0}var f=t.validate=function(e){var t=Object.keys(e);return r(e,function(t,n){r(t,function(t,r){if(!e[t])throw new Error("invalid transition from state:"+n+" to state:"+t+" on event:"+r)})}),!0},l=t.reachable=function(e){var t={},n=!1;do{n=!1,r(e,function(e,i){var o=t[i]=t[i]||{};r(e,function(e,t){o[e]||(o[e]=[t],n=!0)}),r(e,function(e,i){var s=t[e];r(s,function(e,t){o[t]||(o[t]=[i].concat(e),n=!0)})})})}while(n);return t};t.terminal=t.deadlock=function(e){var t=[];return r(e,function(e,r){c(e)&&t.push(r)}),t};var h=t.livelock=function(e,t){var n=l(e),o=[];return r(n,function(e,n){i(t,n)||r(t,function(t){e[t]||i(o,n)||o.push(n)})}),o.sort()};function p(e){var t=[];return r(e,function(e,n){r(e,function(e,r){i(t,r)||t.push(r)})}),t.sort()}var d=t.combine=function(e,t,r,i){var s={},u=p(e),c=p(t),f=a(u,c);function l(r,i){var a=r+"-"+i,u;s[a]||(s[a]={}),u=s[a];var c=n(e[r]),h=n(t[i]),p=o(c,h);return p.forEach(function(n){u[n]=e[r][n]+"-"+t[i][n],s[u[n]]||l(e[r][n],t[i][n])}),o(f,c).forEach(function(t){u[t]=e[r][t]+"-"+i,s[u[t]]||l(e[r][t],i)}),o(f,h).forEach(function(e){u[e]=r+"-"+t[i][e],s[u[e]]||l(r,t[i][e])}),s[a]}return l(r,i),s}},function(e,t,r){const n=r(36),i=r(1)("dweb-transports:yjs"),o=r(1430);function s(e,t){return new Promise(r=>{setTimeout(()=>{r(t)},e)})}r(1440)(o),r(1442)(o),r(1443)(o),r(1445)(o),r(1446)(o),r(1457)(o);const a=r(81),u=r(118),c=r(103),f=r(151);let l={db:{name:"indexeddb"},connector:{name:"ipfs"}};class h extends u{constructor(e){super(e),this.options=e,this.name="YJS",this.supportURLs=["yjs"],this.supportFunctions=["fetch","add","list","listmonitor","newlisturls","connection","get","set","getall","keys","newdatabase","newtable","monitor"],this.status=u.STATUS_LOADED}async p__y(e,t){"string"!=typeof e&&(e=e.href),console.assert(e.startsWith("yjs:/yjs/"));try{if(this.yarrays[e])return this.yarrays[e];{let r=u.mergeoptions(this.options,{connector:{room:e}},t);return this.yarrays[e]=await o(r)}}catch(e){throw console.error("Failed to initialize Y",e.message),e}}async p__yarray(e){return this.p__y(e,{share:{array:"Array"}})}async p_connection(e){return this.p__y(e,{share:{map:"Map"}})}static setup0(e){let t=u.mergeoptions(l,e.yjs);i("YJS options %o",t);let r=new h(t);return c.addtransport(r),r}async p_setup2(e){try{this.status=u.STATUS_STARTING,e&&e(this),this.options.connector.ipfs=c.ipfs().ipfs,this.yarrays={},await this.p_status()}catch(e){console.error(this.name,"failed to start",e),this.status=u.STATUS_FAILED}return e&&e(this),this}async p_status(){return this.status=await this.options.connector.ipfs.isOnline()?u.STATUS_CONNECTED:u.STATUS_FAILED,super.p_status()}async p_rawlist(e){try{let t=await this.p__yarray(e),r=t.share.array.toArray();return r}catch(e){throw e}}listmonitor(e,t,{current:r=!1}={}){let n=this.yarrays["string"==typeof e?e:e.href];console.assert(n,"Should always exist before calling listmonitor - async call p__yarray(url) to create"),r&&n.share.array.toArray.map(t),n.share.array.observe(e=>{"insert"===e.type&&(i("resources inserted %o",e.values),e.values.map(t))})}rawreverse(){throw new a.ToBeImplementedError("Undefined function TransportYJS.rawreverse")}async p_rawadd(e,t){console.assert(e&&t.urls.length&&t.signature&&t.signedby.length,"TransportYJS.p_rawadd args",e,t);let r=t.preflight(Object.assign({},t)),n=await this.p__yarray(e);n.share.array.push([r])}p_newlisturls(e){let t=e._publicurls.map(e=>n.parse(e)).find(e=>"ipfs"===e.protocol&&e.pathname.includes("/ipfs/")||"yjs:"===e.protocol);return t||(t=`yjs:/yjs/${e.keypair.verifyexportmultihashsha256_58()}`),[t,t]}async p_newdatabase(e){e.hasOwnProperty("keypair")&&(e=e.keypair.signingexport());let t=`yjs:/yjs/${encodeURIComponent(e)}`;return{publicurl:t,privateurl:t}}async p_newtable(e,t){if(!e)throw new a.CodingError("p_newtable currently requires a pubkey");let r=await this.p_newdatabase(e);return{privateurl:`${r.privateurl}/${t}`,publicurl:`${r.publicurl}/${t}`}}async p_set(e,t,r){let n=await this.p_connection(e);"string"==typeof t?n.share.map.set(t,JSON.stringify(r)):Object.keys(t).map(e=>n.share.map.set(e,t[e]))}_p_get(e,t){if(Array.isArray(t))return t.reduce(function(t,r){let n=e.share.map.get(r);return t[r]="string"==typeof n?JSON.parse(n):n,t},{});{let r=e.share.map.get(t);return"string"==typeof r?JSON.parse(r):r}}async p_get(e,t){return this._p_get(await this.p_connection(e),t)}async p_delete(e,t){let r=await this.p_connection(e);"string"==typeof t?r.share.map.delete(t):t.map(e=>r.share.map.delete(e))}async p_keys(e){let t=await this.p_connection(e);return t.share.map.keys()}async p_getall(e){let t=await this.p_connection(e),r=t.share.map.keys();return this._p_get(t,r)}async p_rawfetch(e){return{table:"keyvaluetable",_map:await this.p_getall(e)}}async monitor(e,t,{current:r=!1}={}){e="string"==typeof e?e:e.href;let n=this.yarrays[e];if(!n)throw new a.CodingError("Should always exist before calling monitor - async call p__yarray(url) to create");r&&n.share.map.keys().forEach(e=>{let r=n.share.map.get[e];t({type:"set",key:e,value:"string"==typeof r?JSON.parse(r):r})}),n.share.map.observe(r=>{if(["add","update"].includes(r.type)&&(i("YJS monitor: %o %s %s %o",e,r.type,r.name,r.value),"update"!==r.type||r.oldValue!==r.value)){let e={type:{add:"set",update:"set",delete:"delete"}[r.type],value:JSON.parse(r.value),key:r.name};t(e)}})}static async p_test(e={}){console.log("TransportHTTP.test");try{let t=await this.p_setup(e);console.log("HTTP connected");let r=await t.p_info();console.log("TransportHTTP info=",r),r=await t.p_status(),console.assert(r===u.STATUS_CONNECTED),await t.p_test_kvt("NACL%20VERIFY")}catch(e){throw console.log("Exception thrown in TransportHTTP.test:",e.message),e}}}h.Y=o,c._transportclasses.YJS=h,t=e.exports=h},function(e,t,r){"use strict";r(1431)(o),r(1432)(o),r(1433)(o),r(1434)(o),r(1435)(o),r(1436)(o),o.debug=r(1437);var n={};function i(e){var t;t=null===o.sourceDir?null:o.sourceDir||"/bower_components";for(var i="undefined"!=typeof regeneratorRuntime?".js":".es6",s=[],a=0;a<e.length;a++){var u=e[a].split("(")[0],c="y-"+u.toLowerCase();if(null==o[u])if(null==n[u])if("undefined"!=typeof window&&"undefined"!==window.Y){if(null!=t){var f=document.createElement("script");f.src=t+"/"+c+"/"+c+i,document.head.appendChild(f)}let e={};n[u]=e,e.promise=new Promise(function(t){e.resolve=t}),s.push(e.promise)}else console.info("YJS: Please do not depend on automatic requiring of modules anymore! Extend modules as follows `require('y-modulename')(Y)`"),r(1439)(c)(o);else s.push(n[e[a]].promise)}return Promise.all(s)}function o(e){e.hasOwnProperty("sourceDir")&&(o.sourceDir=e.sourceDir),e.types=null!=e.types?e.types:[];var t=[e.db.name,e.connector.name].concat(e.types);for(var r in e.share)t.push(e.share[r]);return new Promise(function(r,n){null==e?n("An options object is expected! "):null==e.connector?n("You must specify a connector! (missing connector property)"):null==e.connector.name?n("You must specify connector name! (missing connector.name property)"):null==e.db?n("You must specify a database! (missing db property)"):null==e.connector.name?n("You must specify db name! (missing db.name property)"):(e=o.utils.copyObject(e),e.connector=o.utils.copyObject(e.connector),e.db=o.utils.copyObject(e.db),e.share=o.utils.copyObject(e.share),setTimeout(function(){o.requestModules(t).then(function(){var t=new s(e);t.db.whenUserIdSet(function(){t.init(function(){r(t)})})}).catch(n)},0))})}e.exports=o,o.requiringModules=n,o.extend=function(e,t){if(2===arguments.length&&"string"==typeof e)t instanceof o.utils.CustomTypeDefinition?o[e]=t.parseArguments:o[e]=t,null!=n[e]&&(n[e].resolve(),delete n[e]);else for(var r=0;r<arguments.length;r++){var i=arguments[r];if("function"!=typeof i)throw new Error("Expected function!");i(o)}},o.requestModules=i;class s{constructor(e,t){this.options=e,this.db=new o[e.db.name](this,e.db),this.connector=new o[e.connector.name](this,e.connector),this.connected=!0}init(e){var t=this.options,r={};this.share=r,this.db.requestTransaction(function*n(){for(var i in t.share){var s=t.share[i].split("("),a=s.splice(0,1),u=o[a],c=u.typeDefinition,f=["_",c.struct+"_"+a+"_"+i+"_"+s],l=[];if(1===s.length){try{l=JSON.parse("["+s[0].split(")")[0]+"]")}catch(e){throw new Error("Was not able to parse type definition! (share."+i+")")}if(null==u.typeDefinition.parseArguments)throw new Error(a+" does not expect arguments!");l=c.parseArguments(l[0])[1]}r[i]=yield*this.store.initType.call(this,f,l)}this.store.whenTransactionsFinished().then(e)})}isConnected(){return this.connector.isSynced}disconnect(){return this.connected?(this.connected=!1,this.connector.disconnect()):Promise.resolve()}reconnect(){return this.connected?Promise.resolve():(this.connected=!0,this.connector.reconnect())}destroy(){var e=this;return this.close().then(function(){return null!=e.db.deleteDB?e.db.deleteDB():Promise.resolve()})}close(){var e=this;return this.share=null,null!=this.connector.destroy?this.connector.destroy():this.connector.disconnect(),this.db.whenTransactionsFinished(function(){return this.db.destroyTypes(),this.db.requestTransaction(function*(){yield*e.db.destroy()}),this.db.whenTransactionsFinished()})}}},function(e,t){function r(e){return"read"===e||"write"===e}function n(e){return"write"===e}e.exports=function(e){class t{constructor(t,r){if(this.y=t,null==r&&(r={}),null==r.role||"master"===r.role)this.role="master";else{if("slave"!==r.role)throw new Error("Role must be either 'master' or 'slave'!");this.role="slave"}this.log=e.debug("y:connector"),this.logMessage=e.debug("y:connector-message"),this.y.db.forwardAppliedOperations=r.forwardAppliedOperations||!1,this.role=r.role,this.connections={},this.isSynced=!1,this.userEventListeners=[],this.whenSyncedListeners=[],this.currentSyncTarget=null,this.syncingClients=[],this.forwardToSyncingClients=!1!==r.forwardToSyncingClients,this.debug=!0===r.debug,this.syncStep2=Promise.resolve(),this.broadcastOpBuffer=[],this.protocolVersion=11,this.authInfo=r.auth||null,this.checkAuth=r.checkAuth||function(){return Promise.resolve("write")},!0===r.generateUserId&&this.setUserId(e.utils.generateGuid())}resetAuth(e){this.authInfo!==e&&(this.authInfo=e,this.broadcast({type:"auth",auth:this.authInfo}))}reconnect(){return this.log("reconnecting.."),this.y.db.startGarbageCollector()}disconnect(){return this.log("discronnecting.."),this.connections={},this.isSynced=!1,this.currentSyncTarget=null,this.syncingClients=[],this.whenSyncedListeners=[],this.y.db.stopGarbageCollector(),this.y.db.whenTransactionsFinished()}repair(){for(var e in this.log("Repairing the state of Yjs. This can happen if messages get lost, and Yjs detects that something is wrong. If this happens often, please report an issue here: https://github.com/y-js/yjs/issues"),this.connections)this.connections[e].isSynced=!1;this.isSynced=!1,this.currentSyncTarget=null,this.findNextSyncTarget()}setUserId(e){return null==this.userId?(this.log('Set userId to "%s"',e),this.userId=e,this.y.db.setUserId(e)):null}onUserEvent(e){this.userEventListeners.push(e)}removeUserEventListener(e){this.userEventListeners=this.userEventListeners.filter(e=>{})}userLeft(e){if(null!=this.connections[e])for(var t of(this.log("User left: %s",e),delete this.connections[e],e===this.currentSyncTarget&&(this.currentSyncTarget=null,this.findNextSyncTarget()),this.syncingClients=this.syncingClients.filter(function(t){return t!==e}),this.userEventListeners))t({action:"userLeft",user:e})}userJoined(e,t){if(null==t)throw new Error("You must specify the role of the joined user!");if(null!=this.connections[e])throw new Error("This user already joined!");for(var r of(this.log("User joined: %s",e),this.connections[e]={isSynced:!1,role:t},this.userEventListeners))r({action:"userJoined",user:e,role:t});null==this.currentSyncTarget&&this.findNextSyncTarget()}whenSynced(e){this.isSynced?e():this.whenSyncedListeners.push(e)}findNextSyncTarget(){if(null==this.currentSyncTarget){var e=null;for(var t in this.connections)if(!this.connections[t].isSynced){e=t;break}var r=this;null!=e?(this.currentSyncTarget=e,this.y.db.requestTransaction(function*(){var t=yield*this.getStateSet(),n=yield*this.getDeleteSet(),i={type:"sync step 1",stateSet:t,deleteSet:n,protocolVersion:r.protocolVersion,auth:r.authInfo};r.send(e,i)})):r.isSynced||this.y.db.requestTransaction(function*(){if(!r.isSynced){for(var e of(r.isSynced=!0,yield*this.garbageCollectAfterSync(),r.whenSyncedListeners))e();r.whenSyncedListeners=[]}})}}send(e,t){this.log("Send '%s' to %s",t.type,e),this.logMessage("Message: %j",t)}broadcast(e){this.log("Broadcast '%s'",e.type),this.logMessage("Message: %j",e)}broadcastOps(t){t=t.map(function(t){return e.Struct[t.struct].encode(t)});var r=this;function n(){r.broadcastOpBuffer.length>0&&(r.broadcast({type:"update",ops:r.broadcastOpBuffer}),r.broadcastOpBuffer=[])}0===this.broadcastOpBuffer.length?(this.broadcastOpBuffer=t,this.y.db.transactionInProgress?this.y.db.whenTransactionsFinished().then(n):setTimeout(n,0)):this.broadcastOpBuffer=this.broadcastOpBuffer.concat(t)}receiveMessage(e,t){if(e===this.userId)return Promise.resolve();if(this.log("Receive '%s' from %s",t.type,e),this.logMessage("Message: %j",t),null!=t.protocolVersion&&t.protocolVersion!==this.protocolVersion)return this.log(`You tried to sync with a yjs instance that has a different protocol version\n (You: ${this.protocolVersion}, Client: ${t.protocolVersion}).\n The sync was stopped. You need to upgrade your dependencies (especially Yjs & the Connector)!\n `),this.send(e,{type:"sync stop",protocolVersion:this.protocolVersion}),Promise.reject("Incompatible protocol version");if(null!=t.auth&&null!=this.connections[e]){var i=this.checkAuth(t.auth,this.y,e);this.connections[e].auth=i,i.then(t=>{for(var r of this.userEventListeners)r({action:"userAuthenticated",user:e,auth:t})})}else null!=this.connections[e]&&null==this.connections[e].auth&&(this.connections[e].auth=this.checkAuth(null,this.y,e));return null!=this.connections[e]&&null!=this.connections[e].auth?this.connections[e].auth.then(i=>{if("sync step 1"===t.type&&r(i)){let r=this,o=t;this.y.db.requestTransaction(function*(){var t=yield*this.getStateSet();n(i)&&(yield*this.applyDeleteSet(o.deleteSet));var s=yield*this.getDeleteSet(),a={type:"sync step 2",stateSet:t,deleteSet:s,protocolVersion:this.protocolVersion,auth:this.authInfo};a.os=yield*this.getOperations(o.stateSet),r.send(e,a),this.forwardToSyncingClients?(r.syncingClients.push(e),setTimeout(function(){r.syncingClients=r.syncingClients.filter(function(t){return t!==e}),r.send(e,{type:"sync done"})},5e3)):r.send(e,{type:"sync done"})})}else if("sync step 2"===t.type&&n(i)){var o=this.y.db,s={};s.promise=new Promise(function(e){s.resolve=e}),this.syncStep2=s.promise;let e=t;o.requestTransaction(function*(){yield*this.applyDeleteSet(e.deleteSet),null!=e.osUntransformed?yield*this.applyOperationsUntransformed(e.osUntransformed,e.stateSet):this.store.apply(e.os),s.resolve()})}else if("sync done"===t.type){var a=this;this.syncStep2.then(function(){a._setSyncedWith(e)})}else if("update"===t.type&&n(i)){if(this.forwardToSyncingClients)for(var u of this.syncingClients)this.send(u,t);if(this.y.db.forwardAppliedOperations){var c=t.ops.filter(function(e){return"Delete"===e.struct});c.length>0&&this.broadcastOps(c)}this.y.db.apply(t.ops)}}):Promise.reject("Unable to deliver message")}_setSyncedWith(e){var t=this.connections[e];null!=t&&(t.isSynced=!0),e===this.currentSyncTarget&&(this.currentSyncTarget=null,this.findNextSyncTarget())}parseMessageFromXml(e){function t(e){for(var n of e.children)return"true"===n.getAttribute("isArray")?t(n):r(n)}function r(e){var n={};for(var i in e.attrs){var o=e.attrs[i],s=parseInt(o,10);isNaN(s)||""+s!==o?n[i]=o:n[i]=s}for(var a in e.children){var u=a.name;"true"===a.getAttribute("isArray")?n[u]=t(a):n[u]=r(a)}return n}r(e)}encodeMessageToXml(e,t){function r(e,t){for(var i in t){var o=t[i];null==i||(o.constructor===Object?r(e.c(i),o):o.constructor===Array?n(e.c(i),o):e.setAttribute(i,o))}}function n(e,t){for(var i of(e.setAttribute("isArray","true"),t))i.constructor===Object?r(e.c("array-element"),i):n(e.c("array-element"),i)}if(t.constructor===Object)r(e.c("y",{xmlns:"http://y.ninja/connector-stanza"}),t);else{if(t.constructor!==Array)throw new Error("I can't encode this json!");n(e.c("y",{xmlns:"http://y.ninja/connector-stanza"}),t)}}}e.AbstractConnector=t}},function(e,t,r){"use strict";e.exports=function(e){class t{constructor(e,t){this.y=e,this.dbOpts=t;var r=this,n;function i(){return r.whenTransactionsFinished().then(function(){return r.gc1.length>0||r.gc2.length>0?(r.y.connector.isSynced||console.warn("gc should be empty when not synced!"),new Promise(e=>{r.requestTransaction(function*(){if(null!=r.y.connector&&r.y.connector.isSynced){for(var t=0;t<r.gc2.length;t++){var n=r.gc2[t];yield*this.garbageCollectOperation(n)}r.gc2=r.gc1,r.gc1=[]}r.gcTimeout>0&&(r.gcInterval=setTimeout(i,r.gcTimeout)),e()})})):(r.gcTimeout>0&&(r.gcInterval=setTimeout(i,r.gcTimeout)),Promise.resolve())})}this.userId=null,this.userIdPromise=new Promise(function(e){n=e}),this.userIdPromise.resolve=n,this.forwardAppliedOperations=!1,this.listenersById={},this.listenersByIdExecuteNow=[],this.listenersByIdRequestPending=!1,this.initializedTypes={},this.waitingTransactions=[],this.transactionInProgress=!1,this.transactionIsFlushed=!1,"undefined"!=typeof YConcurrency_TestingMode&&(this.executeOrder=[]),this.gc1=[],this.gc2=[],this.garbageCollect=i,this.startGarbageCollector(),this.repairCheckInterval=t.repairCheckInterval?t.repairCheckInterval:6e3,this.opsReceivedTimestamp=new Date,this.startRepairCheck()}startGarbageCollector(){this.gc=null==this.dbOpts.gc||this.dbOpts.gc,this.gc?this.gcTimeout=this.dbOpts.gcTimeout?this.dbOpts.gcTimeout:5e4:this.gcTimeout=-1,this.gcTimeout>0&&this.garbageCollect()}startRepairCheck(){var e=this;this.repairCheckInterval>0&&(this.repairCheckIntervalHandler=setInterval(function t(){new Date-e.opsReceivedTimestamp>e.repairCheckInterval&&Object.keys(e.listenersById).length>0&&(e.listenersById={},e.opsReceivedTimestamp=new Date,e.y.connector.repair())},this.repairCheckInterval))}stopRepairCheck(){clearInterval(this.repairCheckIntervalHandler)}queueGarbageCollector(e){this.y.connector.isSynced&&this.gc&&this.gc1.push(e)}emptyGarbageCollector(){return new Promise(e=>{var t=()=>{this.gc1.length>0||this.gc2.length>0?this.garbageCollect().then(t):e()};setTimeout(t,0)})}addToDebug(){if("undefined"!=typeof YConcurrency_TestingMode){var e=Array.prototype.map.call(arguments,function(e){return"string"==typeof e?e:JSON.stringify(e)}).join("").replace(/"/g,"'").replace(/,/g,", ").replace(/:/g,": ");this.executeOrder.push(e)}}getDebugData(){console.log(this.executeOrder.join("\n"))}stopGarbageCollector(){var e=this;return this.gc=!1,this.gcTimeout=-1,new Promise(function(t){e.requestTransaction(function*(){var r=e.gc1.concat(e.gc2);e.gc1=[],e.gc2=[];for(var n=0;n<r.length;n++){var i=yield*this.getOperation(r[n]);null!=i&&(delete i.gc,yield*this.setOperation(i))}t()})})}*addToGarbageCollector(e,t){if(null==e.gc&&!0===e.deleted&&this.store.gc&&this.store.y.connector.isSynced){var r=!1;if(null!=t&&!0===t.deleted?r=!0:null!=e.content&&e.content.length>1&&(e=yield*this.getInsertionCleanStart([e.id[0],e.id[1]+1]),r=!0),r)return e.gc=!0,yield*this.setOperation(e),this.store.queueGarbageCollector(e.id),!0}return!1}removeFromGarbageCollector(t){function r(r){return!e.utils.compareIds(r,t.id)}this.gc1=this.gc1.filter(r),this.gc2=this.gc2.filter(r),delete t.gc}destroyTypes(){for(var e in this.initializedTypes){var t=this.initializedTypes[e];null!=t._destroy?t._destroy():console.error("The type you included does not provide destroy functionality, it will remain in memory (updating your packages will help).")}}*destroy(){clearInterval(this.gcInterval),this.gcInterval=null,this.stopRepairCheck()}setUserId(e){if(!this.userIdPromise.inProgress){this.userIdPromise.inProgress=!0;var t=this;t.requestTransaction(function*(){t.userId=e;var r=yield*this.getState(e);t.opClock=r.clock,t.userIdPromise.resolve(e)})}return this.userIdPromise}whenUserIdSet(e){this.userIdPromise.then(e)}getNextOpId(e){if(null==e)throw new Error("getNextOpId expects the number of created ids to create!");if(null==this.userId)throw new Error("OperationStore not yet initialized!");var t=[this.userId,this.opClock];return this.opClock+=e,t}apply(t){this.opsReceivedTimestamp=new Date;for(var r=0;r<t.length;r++){var n=t[r];if(null==n.id||n.id[0]!==this.y.connector.userId){var i=e.Struct[n.struct].requiredOps(n);null!=n.requires&&(i=i.concat(n.requires)),this.whenOperationsExist(i,n)}}}whenOperationsExist(e,t){if(e.length>0){let r={op:t,missing:e.length};for(let t=0;t<e.length;t++){let n=e[t],i=JSON.stringify(n),o=this.listenersById[i];null==o&&(o=[],this.listenersById[i]=o),o.push(r)}}else this.listenersByIdExecuteNow.push({op:t});if(!this.listenersByIdRequestPending){this.listenersByIdRequestPending=!0;var r=this;this.requestTransaction(function*(){var e=r.listenersByIdExecuteNow;r.listenersByIdExecuteNow=[];var t=r.listenersById;r.listenersById={},r.listenersByIdRequestPending=!1;for(let t=0;t<e.length;t++){let n=e[t].op;yield*r.tryExecute.call(this,n)}for(var n in t){var i=t[n],o=JSON.parse(n),s;if(s="string"==typeof o[1]?yield*this.getOperation(o):yield*this.getInsertion(o),null==s)r.listenersById[n]=i;else for(let e=0;e<i.length;e++){let t=i[e],n=t.op;0==--t.missing&&(yield*r.tryExecute.call(this,n))}}})}}*tryExecute(t){if(this.store.addToDebug("yield* this.store.tryExecute.call(this, ",JSON.stringify(t),")"),"Delete"===t.struct)yield*e.Struct.Delete.execute.call(this,t);else{for(var r=yield*this.getInsertion(t.id);null!=r&&null!=r.content&&r.id[1]+r.content.length<t.id[1]+t.content.length;){var n=r.content.length-(t.id[1]-r.id[1]);t.content.splice(0,n),t.id=[t.id[0],t.id[1]+n],t.left=e.utils.getLastId(r),t.origin=t.left,r=yield*this.getOperation(t.id)}if(null==r){var i=t.id,o=yield*this.isGarbageCollected(i);o||(yield*e.Struct[t.struct].execute.call(this,t),yield*this.addOperation(t),yield*this.store.operationAdded(this,t),t=yield*this.getOperation(i),yield*this.tryCombineWithLeft(t))}}}*operationAdded(t,r){if("Delete"===r.struct){var n=this.initializedTypes[JSON.stringify(r.targetParent)];null!=n&&(yield*n._changed(t,r))}else{yield*t.updateState(r.id[0]);var i=null!=r.content?r.content.length:1;for(let e=0;e<i;e++){var o=JSON.stringify([r.id[0],r.id[1]+e]),s=this.listenersById[o];if(delete this.listenersById[o],null!=s)for(var a in s){var u=s[a];0==--u.missing&&this.whenOperationsExist([],u.op)}}var c=this.initializedTypes[JSON.stringify(r.parent)];if(null!=r.parent){var f=yield*t.isDeleted(r.parent);if(f)return void(yield*t.deleteList(r.id))}if(null!=c){let n=e.utils.copyOperation(r);yield*c._changed(t,n)}if(!r.deleted){var l=null!=r.content?r.content.length:1,h=r.id;for(let e=0;e<l;e++){var p=[h[0],h[1]+e],d=yield*t.isDeleted(p);if(d){var y={struct:"Delete",target:p};yield*this.tryExecute.call(t,y)}}}}}whenTransactionsFinished(){if(this.transactionInProgress){if(null==this.transactionsFinished){var e,t=new Promise(function(t){e=t});this.transactionsFinished={resolve:e,promise:t}}return this.transactionsFinished.promise}return Promise.resolve()}getNextRequest(){return 0===this.waitingTransactions.length?this.transactionIsFlushed?(this.transactionInProgress=!1,this.transactionIsFlushed=!1,null!=this.transactionsFinished&&(this.transactionsFinished.resolve(),this.transactionsFinished=null),null):(this.transactionIsFlushed=!0,function*(){yield*this.flush()}):(this.transactionIsFlushed=!1,this.waitingTransactions.shift())}requestTransaction(e,t){this.waitingTransactions.push(e),this.transactionInProgress||(this.transactionInProgress=!0,setTimeout(()=>{this.transact(this.getNextRequest())},0))}getType(e){return this.initializedTypes[JSON.stringify(e)]}*initType(t,r){var n=JSON.stringify(t),i=this.store.initializedTypes[n];if(null==i){var o=yield*this.getOperation(t);null!=o&&(i=yield*e[o.type].typeDefinition.initType.call(this,this.store,o,r),this.store.initializedTypes[n]=i)}return i}createType(t,r){var n=t[0].struct;r=r||this.getNextOpId(1);var i=e.Struct[n].create(r);i.type=t[0].name,this.requestTransaction(function*(){"_"===i.id[0]?yield*this.setOperation(i):yield*this.applyCreatedOperations([i])});var o=e[i.type].typeDefinition.createType(this,i,t[1]);return this.initializedTypes[JSON.stringify(i.id)]=o,o}}e.AbstractDatabase=t}},function(e,t,r){"use strict";e.exports=function(e){class t{*applyCreatedOperations(t){for(var r=[],n=0;n<t.length;n++){var i=t[n];yield*this.store.tryExecute.call(this,i),null!=i.id&&"string"==typeof i.id[1]||r.push(e.Struct[i.struct].encode(i))}r.length>0&&this.store.y.connector.broadcastOps(r)}*deleteList(e){for(;null!=e;){if(e=yield*this.getOperation(e),!e.gc){e.gc=!0,e.deleted=!0,yield*this.setOperation(e);var t=null!=e.content?e.content.length:1;yield*this.markDeleted(e.id,t),null!=e.opContent&&(yield*this.deleteOperation(e.opContent)),this.store.queueGarbageCollector(e.id)}e=e.right}}*deleteOperation(e,t,r){for(null==t&&(t=1),yield*this.markDeleted(e,t);t>0;){var n=!1,i=yield*this.os.findWithUpperBound([e[0],e[1]+t-1]),o=null!=i&&null!=i.content?i.content.length:1;if(null==i||i.id[0]!==e[0]||i.id[1]+o<=e[1]?(i=null,t=0):(i.deleted||(i.id[1]<e[1]&&(i=yield*this.getInsertionCleanStart(e),o=i.content.length),i.id[1]+o>e[1]+t&&(i=yield*this.getInsertionCleanEnd([e[0],e[1]+t-1]),o=i.content.length)),t=i.id[1]-e[1]),null!=i){if(!i.deleted){if(n=!0,i.deleted=!0,null!=i.start&&(yield*this.deleteList(i.start)),null!=i.map)for(var s in i.map)yield*this.deleteList(i.map[s]);if(null!=i.opContent&&(yield*this.deleteOperation(i.opContent)),null!=i.requires)for(var a=0;a<i.requires.length;a++)yield*this.deleteOperation(i.requires[a])}var u,c;u=null!=i.left?yield*this.getInsertion(i.left):null,yield*this.setOperation(i),c=null!=i.right?yield*this.getOperation(i.right):null,n&&!r&&(yield*this.store.operationAdded(this,{struct:"Delete",target:i.id,length:o,targetParent:i.parent})),yield*this.store.addToGarbageCollector.call(this,i,u),null!=c&&(yield*this.store.addToGarbageCollector.call(this,c,i))}}}*markGarbageCollected(t,r){this.store.addToDebug("yield* this.markGarbageCollected(",t,", ",r,")");var n=yield*this.markDeleted(t,r);if(n.id[1]<t[1]&&!n.gc){var i=n.len-(t[1]-n.id[1]);n.len-=i,yield*this.ds.put(n),n={id:t,len:i,gc:!1},yield*this.ds.put(n)}var o=yield*this.ds.findPrev(t),s=yield*this.ds.findNext(t);t[1]+r<n.id[1]+n.len&&!n.gc&&(yield*this.ds.put({id:[t[0],t[1]+r],len:n.len-r,gc:!1}),n.len=r),n.gc=!0,null!=o&&o.gc&&e.utils.compareIds([o.id[0],o.id[1]+o.len],n.id)&&(o.len+=n.len,yield*this.ds.delete(n.id),n=o),null!=s&&s.gc&&e.utils.compareIds([n.id[0],n.id[1]+n.len],s.id)&&(n.len+=s.len,yield*this.ds.delete(s.id)),yield*this.ds.put(n),yield*this.updateState(n.id[0])}*markDeleted(e,t){null==t&&(t=1);var r=yield*this.ds.findWithUpperBound(e);if(null!=r&&r.id[0]===e[0])if(r.id[1]<=e[1]&&e[1]<=r.id[1]+r.len){var n=e[1]+t-(r.id[1]+r.len);if(!(n>0))return r;if(r.gc){if(n=r.id[1]+r.len-e[1],!(n<t))throw new Error("Cannot happen! (it dit though.. :()");r={id:[e[0],e[1]+n],len:t-n,gc:!1},yield*this.ds.put(r)}else r.len+=n}else r={id:e,len:t,gc:!1},yield*this.ds.put(r);else r={id:e,len:t,gc:!1},yield*this.ds.put(r);var i=yield*this.ds.findNext(r.id);if(null!=i&&r.id[0]===i.id[0]&&r.id[1]+r.len>=i.id[1])for(n=r.id[1]+r.len-i.id[1];n>=0;){if(i.gc){r.len-=n,n>=i.len&&(n-=i.len,n>0&&(yield*this.ds.put(r),yield*this.markDeleted([i.id[0],i.id[1]+i.len],n)));break}if(!(n>i.len)){r.len+=i.len-n,yield*this.ds.delete(i.id);break}var o=yield*this.ds.findNext(i.id);if(yield*this.ds.delete(i.id),null==o||r.id[0]!==o.id[0])break;i=o,n=r.id[1]+r.len-i.id[1]}return yield*this.ds.put(r),r}*garbageCollectAfterSync(){(this.store.gc1.length>0||this.store.gc2.length>0)&&console.warn("gc should be empty after sync"),this.store.gc&&(yield*this.os.iterate(this,null,null,function*(e){if(e.gc&&(delete e.gc,yield*this.setOperation(e)),null!=e.parent){var t=yield*this.isDeleted(e.parent);if(t){if(e.gc=!0,!e.deleted&&(yield*this.markDeleted(e.id,null!=e.content?e.content.length:1),e.deleted=!0,null!=e.opContent&&(yield*this.deleteOperation(e.opContent)),null!=e.requires))for(var r=0;r<e.requires.length;r++)yield*this.deleteOperation(e.requires[r]);return yield*this.setOperation(e),void this.store.gc1.push(e.id)}}if(e.deleted){var n=null;null!=e.left&&(n=yield*this.getInsertion(e.left)),yield*this.store.addToGarbageCollector.call(this,e,n)}}))}*garbageCollectOperation(t){this.store.addToDebug("yield* this.garbageCollectOperation(",t,")");var r=yield*this.getOperation(t);if(yield*this.markGarbageCollected(t,null!=r&&null!=r.content?r.content.length:1),null!=r){var n=[],i;null!=r.opContent&&n.push(r.opContent),null!=r.requires&&(n=n.concat(r.requires));for(var o=0;o<n.length;o++){var s=yield*this.getOperation(n[o]);null!=s?(s.deleted||(yield*this.deleteOperation(s.id),s=yield*this.getOperation(s.id)),s.gc=!0,yield*this.setOperation(s),this.store.queueGarbageCollector(s.id)):yield*this.markGarbageCollected(n[o],1)}if(null!=r.left){var a=yield*this.getInsertion(r.left);a.right=r.right,yield*this.setOperation(a)}if(null!=r.right){var u=yield*this.getOperation(r.right);if(u.left=r.left,yield*this.setOperation(u),null!=r.originOf&&r.originOf.length>0){for(var c=r.left,f=null;null!=c&&(f=yield*this.getInsertion(c),!f.deleted);)c=f.left;for(var l in r.originOf){var h=yield*this.getOperation(r.originOf[l]);null!=h&&(h.origin=c,yield*this.setOperation(h))}null!=c&&(null==f.originOf?f.originOf=r.originOf:f.originOf=r.originOf.concat(f.originOf),yield*this.setOperation(f))}}if(null!=r.origin){var p=yield*this.getInsertion(r.origin);p.originOf=p.originOf.filter(function(r){return!e.utils.compareIds(t,r)}),yield*this.setOperation(p)}if(null!=r.parent&&(i=yield*this.getOperation(r.parent)),null!=i){var d=!1;null!=r.parentSub?e.utils.compareIds(i.map[r.parentSub],r.id)&&(d=!0,null!=r.right?i.map[r.parentSub]=r.right:delete i.map[r.parentSub]):(e.utils.compareIds(i.start,r.id)&&(d=!0,i.start=r.right),e.utils.matchesId(r,i.end)&&(d=!0,i.end=r.left)),d&&(yield*this.setOperation(i))}yield*this.removeOperation(r.id)}}*checkDeleteStoreForState(e){var t=yield*this.ds.findWithUpperBound([e.user,e.clock]);null!=t&&t.id[0]===e.user&&t.gc&&(e.clock=Math.max(e.clock,t.id[1]+t.len))}*updateState(e){var t=yield*this.getState(e);yield*this.checkDeleteStoreForState(t);for(var r=yield*this.getInsertion([e,t.clock]),n=null!=r&&null!=r.content?r.content.length:1;null!=r&&e===r.id[0]&&r.id[1]<=t.clock&&r.id[1]+n>t.clock;)t.clock+=n,yield*this.checkDeleteStoreForState(t),r=yield*this.os.findNext(r.id),n=null!=r&&null!=r.content?r.content.length:1;yield*this.setState(t)}*applyDeleteSet(e){var t=[];for(var r in e){var n=e[r],i=0,o=n[i];for(yield*this.ds.iterate(this,[r,0],[r,Number.MAX_VALUE],function*(e){for(;null!=o;){var s=0;if(e.id[1]+e.len<=o[0])break;o[0]<e.id[1]?(s=Math.min(e.id[1]-o[0],o[1]),t.push([r,o[0],s,o[2]])):(s=e.id[1]+e.len-o[0],o[2]&&!e.gc&&t.push([r,o[0],Math.min(s,o[1]),o[2]])),o[1]<=s?o=n[++i]:(o[0]=o[0]+s,o[1]=o[1]-s)}});i<n.length;i++)o=n[i],t.push([r,o[0],o[1],o[2]])}for(var s=0;s<t.length;s++){var a=t[s];if(yield*this.deleteOperation([a[0],a[1]],a[2]),a[3]){yield*this.markGarbageCollected([a[0],a[1]],a[2]);for(var u=a[1]+a[2];u>=a[1];){var c=yield*this.os.findWithUpperBound([a[0],u-1]);if(null==c)break;var f=null!=c.content?c.content.length:1;if(c.id[0]!==a[0]||c.id[1]+f<=a[1])break;c.id[1]+f>a[1]+a[2]&&(c=yield*this.getInsertionCleanEnd([a[0],a[1]+a[2]-1])),c.id[1]<a[1]&&(c=yield*this.getInsertionCleanStart([a[0],a[1]])),u=c.id[1],yield*this.garbageCollectOperation(c.id)}}if(this.store.forwardAppliedOperations){var l=[];l.push({struct:"Delete",target:[a[0],a[1]],length:a[2]}),this.store.y.connector.broadcastOps(l)}}}*isGarbageCollected(e){var t=yield*this.ds.findWithUpperBound(e);return null!=t&&t.id[0]===e[0]&&e[1]<t.id[1]+t.len&&t.gc}*getDeleteSet(){var e={};return yield*this.ds.iterate(this,null,null,function*(t){var r=t.id[0],n=t.id[1],i=t.len,o=t.gc,s=e[r];void 0===s&&(s=[],e[r]=s),s.push([n,i,o])}),e}*isDeleted(e){var t=yield*this.ds.findWithUpperBound(e);return null!=t&&t.id[0]===e[0]&&e[1]<t.id[1]+t.len}*setOperation(e){return yield*this.os.put(e),e}*addOperation(e){yield*this.os.put(e),this.store.forwardAppliedOperations&&"string"!=typeof e.id[1]&&this.store.y.connector.broadcastOps([e])}*tryCombineWithLeft(t){if(null!=t&&null!=t.left&&null!=t.content&&t.left[0]===t.id[0]&&e.utils.compareIds(t.left,t.origin)){var r=yield*this.getInsertion(t.left);null==r.content||r.id[1]+r.content.length!==t.id[1]||1!==r.originOf.length||r.gc||r.deleted||t.gc||t.deleted||(null!=t.originOf?r.originOf=t.originOf:delete r.originOf,r.content=r.content.concat(t.content),r.right=t.right,yield*this.os.delete(t.id),yield*this.setOperation(r))}}*getInsertion(e){var t=yield*this.os.findWithUpperBound(e);if(null==t)return null;var r=null!=t.content?t.content.length:1;return e[0]===t.id[0]&&e[1]<t.id[1]+r?t:null}*getInsertionCleanStartEnd(e){return yield*this.getInsertionCleanStart(e),yield*this.getInsertionCleanEnd(e)}*getInsertionCleanStart(t){var r=yield*this.getInsertion(t);if(null!=r){if(r.id[1]===t[1])return r;var n=e.utils.copyObject(r);r.content=n.content.splice(t[1]-r.id[1]),r.id=t;var i=e.utils.getLastId(n);return r.origin=i,n.originOf=[r.id],n.right=r.id,r.left=i,yield*this.setOperation(n),yield*this.setOperation(r),n.gc&&this.store.queueGarbageCollector(r.id),r}return null}*getInsertionCleanEnd(t){var r=yield*this.getInsertion(t);if(null!=r){if(null==r.content||r.id[1]+r.content.length-1===t[1])return r;var n=e.utils.copyObject(r);n.content=r.content.splice(t[1]-r.id[1]+1),n.id=[t[0],t[1]+1];var i=e.utils.getLastId(r);return n.origin=i,r.originOf=[n.id],r.right=n.id,n.left=i,yield*this.setOperation(n),yield*this.setOperation(r),r.gc&&this.store.queueGarbageCollector(n.id),r}return null}*getOperation(t){var r=yield*this.os.find(t);if("_"!==t[0]||null!=r)return r;var n=t[1].split("_");if(n.length>1){var i=n[0],o=e.Struct[i].create(t);return o.type=n[1],yield*this.setOperation(o),o}return console.error("Unexpected case. How can this happen?"),null}*removeOperation(e){yield*this.os.delete(e)}*setState(e){var t={id:[e.user],clock:e.clock};yield*this.ss.put(t)}*getState(e){var t=yield*this.ss.find([e]),r=null==t?null:t.clock;return null==r&&(r=0),{user:e,clock:r}}*getStateVector(){var e=[];return yield*this.ss.iterate(this,null,null,function*(t){e.push({user:t.id[0],clock:t.clock})}),e}*getStateSet(){var e={};return yield*this.ss.iterate(this,null,null,function*(t){e[t.id[0]]=t.clock}),e}*getOperations(t){null==t&&(t={});var r=[],n=yield*this.getStateVector();for(var i of n){var o=i.user;if("_"!==o){var s=t[o]||0;if(s>0){var a=yield*this.getInsertion([o,s]);null!=a&&(s=a.id[1],t[o]=s)}yield*this.os.iterate(this,[o,s],[o,Number.MAX_VALUE],function*(n){if(n=e.Struct[n.struct].encode(n),"Insert"!==n.struct)r.push(n);else if(null==n.right||n.right[1]<(t[n.right[0]]||0))for(var i=n,o=[n],s=n.right;;){if(null==i.left){n.left=null,r.push(n),e.utils.compareIds(i.id,n.id)||(i=e.Struct[n.struct].encode(i),i.right=o[o.length-1].id,r.push(i));break}for(i=yield*this.getInsertion(i.left);o.length>0&&e.utils.matchesId(i,o[o.length-1].origin);)o.pop();if(i.id[1]<(t[i.id[0]]||0)){n.left=e.utils.getLastId(i),r.push(n);break}if(e.utils.matchesId(i,n.origin))n.left=n.origin,r.push(n),n=e.Struct[n.struct].encode(i),n.right=s,o.length>0&&console.log("This should not happen .. :( please report this"),o=[n];else{var a=e.Struct[n.struct].encode(i);a.right=o[o.length-1].id,a.left=a.origin,r.push(a),o.push(i)}}})}}return r.reverse()}*getOperationsUntransformed(){var e=[];return yield*this.os.iterate(this,null,null,function*(t){"_"!==t.id[0]&&e.push(t)}),{untransformed:e}}*applyOperationsUntransformed(t,r){for(var n=t.untransformed,i=0;i<n.length;i++){var o=n[i];if(null!=o.parent&&"_"===o.parent[0]&&"Insert"===o.struct)if(null!=o.parentSub&&null==o.left){let e=yield*this.getOperation(o.parent);e.map[o.parentSub]=o.id,yield*this.setOperation(e)}else if(null==o.right||null==o.left){let t=yield*this.getOperation(o.parent);null==o.right&&(t.end=e.utils.getLastId(o)),null==o.left&&(t.start=o.id),yield*this.setOperation(t)}yield*this.os.put(o)}for(var s in r)yield*this.ss.put({id:[s],clock:r[s]})}*flush(){yield*this.os.flush(),yield*this.ss.flush(),yield*this.ds.flush()}}e.Transaction=t}},function(e,t,r){"use strict";e.exports=function(e){var t={Delete:{encode:function(e){return{target:e.target,length:e.length||0,struct:"Delete"}},requiredOps:function(e){return[]},execute:function*(e){return yield*this.deleteOperation(e.target,e.length||1)}},Insert:{encode:function(e){var t={id:e.id,left:e.left,right:e.right,origin:e.origin,parent:e.parent,struct:e.struct};return null!=e.parentSub&&(t.parentSub=e.parentSub),e.hasOwnProperty("opContent")?t.opContent=e.opContent:t.content=e.content.slice(),t},requiredOps:function(t){var r=[];return null!=t.left&&r.push(t.left),null!=t.right&&r.push(t.right),null==t.origin||e.utils.compareIds(t.left,t.origin)||r.push(t.origin),r.push(t.parent),null!=t.opContent&&r.push(t.opContent),r},getDistanceToOrigin:function*(t){if(null==t.left)return 0;for(var r=0,n=yield*this.getInsertion(t.left);!e.utils.matchesId(n,t.origin)&&(r++,null!=n.left);)n=yield*this.getInsertion(n.left);return r},execute:function*(r){var n,i=[];if(null!=r.origin){var o=yield*this.getInsertionCleanEnd(r.origin);null==o.originOf&&(o.originOf=[]),o.originOf.push(r.id),yield*this.setOperation(o),null!=o.right&&i.push(o.right)}var s=n=yield*t.Insert.getDistanceToOrigin.call(this,r),a,u,c;if(null!=r.left)a=yield*this.getInsertionCleanEnd(r.left),e.utils.compareIds(r.left,r.origin)||null==a.right||i.push(a.right),a=null==a.right?null:yield*this.getOperation(a.right);else{u=yield*this.getOperation(r.parent);let e=r.parentSub?u.map[r.parentSub]:u.start;c=null==e?null:yield*this.getOperation(e),a=c}for(null!=r.right&&(i.push(r.right),yield*this.getInsertionCleanStart(r.right));null!=a&&!e.utils.compareIds(a.id,r.right);){var f=yield*t.Insert.getDistanceToOrigin.call(this,a);if(f===n)a.id[0]<r.id[0]&&(r.left=e.utils.getLastId(a),s=n+1);else{if(!(f<n))break;n-s<=f&&(r.left=e.utils.getLastId(a),s=n+1)}n++,a=null!=a.right?yield*this.getInsertion(a.right):null}var l=null,h=null;for(null==u&&(u=yield*this.getOperation(r.parent)),null!=r.left?(l=yield*this.getInsertion(r.left),r.right=l.right,l.right=r.id,yield*this.setOperation(l)):r.right=r.parentSub?u.map[r.parentSub]||null:u.start,null!=r.right&&(h=yield*this.getOperation(r.right),h.left=e.utils.getLastId(r),null!=h.gc&&(null!=h.content&&h.content.length>1&&(h=yield*this.getInsertionCleanEnd(h.id)),this.store.removeFromGarbageCollector(h)),yield*this.setOperation(h)),null!=r.parentSub?(null==l&&(u.map[r.parentSub]=r.id,yield*this.setOperation(u)),null!=r.right&&(yield*this.deleteOperation(r.right,1,!0)),null!=r.left&&(yield*this.deleteOperation(r.id,1,!0))):null!=h&&null!=l||(null==h&&(u.end=e.utils.getLastId(r)),null==l&&(u.start=r.id),yield*this.setOperation(u)),n=0;n<i.length;n++){var p=yield*this.getOperation(i[n]);yield*this.tryCombineWithLeft(p)}}},List:{create:function(e){return{start:null,end:null,struct:"List",id:e}},encode:function(e){var t={struct:"List",id:e.id,type:e.type};return null!=e.requires&&(t.requires=e.requires),null!=e.info&&(t.info=e.info),t},requiredOps:function(){return[]},execute:function*(e){e.start=null,e.end=null},ref:function*(e,t){if(null==e.start)return null;for(var r=null,n=yield*this.getOperation(e.start);n.deleted||(r=n,t--),t>=0&&null!=n.right;)n=yield*this.getOperation(n.right);return r},map:function*(e,t){e=e.start;for(var r=[];null!=e;){var n=yield*this.getOperation(e);n.deleted||r.push(t(n)),e=n.right}return r}},Map:{create:function(e){return{id:e,map:{},struct:"Map"}},encode:function(e){var t={struct:"Map",type:e.type,id:e.id,map:{}};return null!=e.requires&&(t.requires=e.requires),null!=e.info&&(t.info=e.info),t},requiredOps:function(){return[]},execute:function*(){},get:function*(e,t){var r=e.map[t];if(null!=r){var n=yield*this.getOperation(r);return null==n||n.deleted?void 0:null==n.opContent?n.content[0]:yield*this.getType(n.opContent)}}}};e.Struct=t}},function(e,t,r){"use strict";e.exports=function(e){e.utils={},e.utils.bubbleEvent=function(e,t){for(e.eventHandler.callEventListeners(t),t.path=[];null!=e&&null!=e._deepEventHandler;){e._deepEventHandler.callEventListeners(t);var r=null;null!=e._parent&&(r=e.os.getType(e._parent)),null!=r&&null!=r._getPathToChild?(t.path=[r._getPathToChild(e._model)].concat(t.path),e=r):e=null}};class t{constructor(){this.eventListeners=[]}destroy(){this.eventListeners=null}addEventListener(e){this.eventListeners.push(e)}removeEventListener(e){this.eventListeners=this.eventListeners.filter(function(t){return e!==t})}removeAllEventListeners(){this.eventListeners=[]}callEventListeners(e){for(var t=0;t<this.eventListeners.length;t++)try{var r={};for(var n in e)r[n]=e[n];this.eventListeners[t](r)}catch(e){console.error('Your observer threw an error. This error was caught so that Yjs still can ensure data consistency! In order to debug this error you have to check "Pause On Caught Exceptions"',e)}}}e.utils.EventListenerHandler=t;class r extends t{constructor(e){super(),this.waiting=[],this.awaiting=0,this.onevent=e}destroy(){super.destroy(),this.waiting=null,this.onevent=null}receivedOp(e){if(this.awaiting<=0)this.onevent(e);else if("Delete"===e.struct){var t=this,r=function e(r){if(null==r.length)throw new Error("This shouldn't happen! d.length must be defined!");for(var n=0;n<t.waiting.length;n++){var i=t.waiting[n];if("Insert"===i.struct&&i.id[0]===r.target[0]){var o=i.hasOwnProperty("content")?i.content.length:1,s=r.target[1],a=r.target[1]+(r.length||1),u=i.id[1],c=i.id[1]+o;if(c<=s||a<=u)continue;if(u<s){if(s<c){if(c<a){i.content.splice(s-u),r.length=a-c,r.target=[r.target[0],c];continue}if(c===a)return void i.content.splice(s-u);var f={id:[i.id[0],a],content:i.content.slice(a-u),struct:"Insert"};return t.waiting.push(f),void i.content.splice(s-u)}}else{if(s===u){if(c<a){r.length=a-c,r.target=[r.target[0],c],i.content=[];continue}return c===a?void t.waiting.splice(n,1):(i.content=i.content.slice(a-u),void(i.id=[i.id[0],a]))}if(u<a){if(c<a)return t.waiting.splice(n,1),e({target:[r.target[0],s],length:u-s,struct:"Delete"}),void e({target:[r.target[0],c],length:c-a,struct:"Delete"});if(c===a){t.waiting.splice(n,1),n--,r.length-=o;continue}r.length=u-s,i.content.splice(0,a-u),i.id=[i.id[0],a];continue}}}}t.waiting.push(r)};null==e.key?r(e):this.waiting.push(e)}else this.waiting.push(e)}awaitAndPrematurelyCall(t){this.awaiting++,t.map(e.utils.copyOperation).forEach(this.onevent)}*awaitOps(t,r,n){function i(t){for(var r=[];t.length>0;)for(var n=0;n<t.length;n++){for(var i=!0,o=0;o<t.length;o++)if(e.utils.matchesId(t[o],t[n].left)){i=!1;break}i&&(r.push(t.splice(n,1)[0]),n--)}return r}var o=this.waiting.length;if(yield*r.apply(t,n),this.waiting.splice(o),this.awaiting>0&&this.awaiting--,0===this.awaiting&&this.waiting.length>0){for(let r=0;r<this.waiting.length;r++){var s=this.waiting[r];if("Insert"===s.struct){var a=yield*t.getInsertion(s.id);if(null!=a.parentSub&&null!=a.left)this.waiting.splice(r,1),r--;else if(e.utils.compareIds(a.id,s.id))if(null==a.left)s.left=null;else{for(var u=yield*t.getInsertion(a.left);null!=u.deleted;){if(null==u.left){u=null;break}u=yield*t.getInsertion(u.left)}s.left=null!=u?e.utils.getLastId(u):null}else s.left=[s.id[0],s.id[1]-1]}}if(null!=this._pullChanges&&this._pullChanges(),0===this.awaiting){var c=[],f=[];this.waiting.forEach(function(e){"Delete"===e.struct?f.push(e):c.push(e)}),this.waiting=[],c=i(c);for(var l=0;l<c.length;l++){if(0!==this.awaiting){this.waiting=this.waiting.concat(c.slice(l));break}this.onevent(c[l])}for(l=0;l<f.length;l++){if(0!==this.awaiting){this.waiting=this.waiting.concat(f.slice(l));break}this.onevent(f[l])}}}}awaitedInserts(t){for(var r=this.waiting.splice(this.waiting.length-t),n=0;n<r.length;n++){var i=r[n];if("Insert"!==i.struct)throw new Error("Expected Insert Operation!");for(var o=this.waiting.length-1;o>=0;o--){let t=this.waiting[o];"Insert"===t.struct&&(e.utils.matchesId(t,i.left)?(t.right=i.id,i.left=t.left):e.utils.compareIds(t.id,i.right)&&(t.left=e.utils.getLastId(i),i.right=t.right))}}this._tryCallEvents(t)}awaitedDeletes(t,r){for(var n=this.waiting.splice(this.waiting.length-t),i=0;i<n.length;i++){var o=n[i];if("Delete"!==o.struct)throw new Error("Expected Delete Operation!");if(null!=r)for(var s=0;s<this.waiting.length;s++){let t=this.waiting[s];"Insert"===t.struct&&e.utils.compareIds(o.target,t.left)&&(t.left=r)}}this._tryCallEvents(t)}_tryCallEvents(){function t(t){for(var r=[];t.length>0;)for(var n=0;n<t.length;n++){for(var i=!0,o=0;o<t.length;o++)if(e.utils.matchesId(t[o],t[n].left)){i=!1;break}i&&(r.push(t.splice(n,1)[0]),n--)}return r}if(this.awaiting>0&&this.awaiting--,0===this.awaiting&&this.waiting.length>0){var r=[],n=[];this.waiting.forEach(function(e){"Delete"===e.struct?n.push(e):r.push(e)}),r=t(r),r.forEach(this.onevent),n.forEach(this.onevent),this.waiting=[]}}}e.utils.EventHandler=r;class n{getPath(){var e=null;if(null!=this._parent&&(e=this.os.getType(this._parent)),null!=e&&null!=e._getPathToChild){var t=e._getPathToChild(this._model),r=e.getPath();return r.push(t),r}return[]}}e.utils.CustomType=n;class i{constructor(e){if(null==e.struct||null==e.initType||null==e.class||null==e.name||null==e.createType)throw new Error("Custom type was not initialized correctly!");this.struct=e.struct,this.initType=e.initType,this.createType=e.createType,this.class=e.class,this.name=e.name,null!=e.appendAdditionalInfo&&(this.appendAdditionalInfo=e.appendAdditionalInfo),this.parseArguments=(e.parseArguments||function(){return[this]}).bind(this),this.parseArguments.typeDefinition=this}}function o(e){var t={};for(var r in e)t[r]=e[r];return t}function s(e){return e=o(e),null!=e.content&&(e.content=e.content.map(function(e){return e})),e}function a(e,t){return e[0]<t[0]||e[0]===t[0]&&(e[1]<t[1]||typeof e[1]<typeof t[1])}function u(e,t){return e.target[0]===t[0]&&e.target[1]<=t[1]&&t[1]<e.target[1]+(e.length||1)}function c(e,t){return null==e||null==t?e===t:e[0]===t[0]&&e[1]===t[1]}function f(e,t){return null==t||null==e?t===e:t[0]===e.id[0]?null==e.content?t[1]===e.id[1]:t[1]>=e.id[1]&&t[1]<e.id[1]+e.content.length:void 0}function l(e){return null==e.content||1===e.content.length?e.id:[e.id[0],e.id[1]+e.content.length-1]}function h(e){for(var t=new Array(e),r=0;r<t.length;r++)t[r]={id:[null,null]};return t}function p(e){class t extends e{constructor(e,t){super(e,t),this.writeBuffer=h(5),this.readBuffer=h(10)}*find(e,t){var r,n,i;for(r=this.readBuffer.length-1;r>=0;r--)if(n=this.readBuffer[r],n.id[1]===e[1]&&n.id[0]===e[0]){for(;r<this.readBuffer.length-1;r++)this.readBuffer[r]=this.readBuffer[r+1];return this.readBuffer[this.readBuffer.length-1]=n,n}for(r=this.writeBuffer.length-1;r>=0;r--)if(n=this.writeBuffer[r],n.id[1]===e[1]&&n.id[0]===e[0]){i=n;break}if(r<0&&void 0===t&&(i=yield*super.find(e)),null!=i){for(r=0;r<this.readBuffer.length-1;r++)this.readBuffer[r]=this.readBuffer[r+1];this.readBuffer[this.readBuffer.length-1]=i}return i}*put(e){var t=e.id,r,n;for(r=this.writeBuffer.length-1;r>=0;r--)if(n=this.writeBuffer[r],n.id[1]===t[1]&&n.id[0]===t[0]){for(;r<this.writeBuffer.length-1;r++)this.writeBuffer[r]=this.writeBuffer[r+1];this.writeBuffer[this.writeBuffer.length-1]=e;break}if(r<0){var i=this.writeBuffer[0];for(null!==i.id[0]&&(yield*super.put(i)),r=0;r<this.writeBuffer.length-1;r++)this.writeBuffer[r]=this.writeBuffer[r+1];this.writeBuffer[this.writeBuffer.length-1]=e}for(r=0;r<this.readBuffer.length-1;r++)n=this.readBuffer[r+1],n.id[1]===t[1]&&n.id[0]===t[0]?this.readBuffer[r]=e:this.readBuffer[r]=n;this.readBuffer[this.readBuffer.length-1]=e}*delete(e){var t,r;for(t=0;t<this.readBuffer.length;t++)r=this.readBuffer[t],r.id[1]===e[1]&&r.id[0]===e[0]&&(this.readBuffer[t]={id:[null,null]});yield*this.flush(),yield*super.delete(e)}*findWithLowerBound(e){var t=yield*this.find(e,!0);return null!=t?t:(yield*this.flush(),yield*super.findWithLowerBound.apply(this,arguments))}*findWithUpperBound(e){var t=yield*this.find(e,!0);return null!=t?t:(yield*this.flush(),yield*super.findWithUpperBound.apply(this,arguments))}*findNext(){return yield*this.flush(),yield*super.findNext.apply(this,arguments)}*findPrev(){return yield*this.flush(),yield*super.findPrev.apply(this,arguments)}*iterate(){yield*this.flush(),yield*super.iterate.apply(this,arguments)}*flush(){for(var e=0;e<this.writeBuffer.length;e++){var t=this.writeBuffer[e];null!==t.id[0]&&(yield*super.put(t),this.writeBuffer[e]={id:[null,null]})}}}return t}function d(e){return e?(e^16*Math.random()>>e/4).toString(16):([1e7]+-1e3+-4e3+-8e3+-1e11).replace(/[018]/g,d)}e.utils.CustomTypeDefinition=i,e.utils.isTypeDefinition=function t(r){if(null!=r){if(r instanceof e.utils.CustomTypeDefinition)return[r];if(r.constructor===Array&&r[0]instanceof e.utils.CustomTypeDefinition)return r;if(r instanceof Function&&r.typeDefinition instanceof e.utils.CustomTypeDefinition)return[r.typeDefinition]}return!1},e.utils.copyObject=o,e.utils.copyOperation=s,e.utils.smaller=a,e.utils.inDeletionRange=u,e.utils.compareIds=c,e.utils.matchesId=f,e.utils.getLastId=l,e.utils.createSmallLookupBuffer=p,e.utils.generateGuid=d}},function(e,t,r){"use strict";e.exports=function(e){var t={users:{},buffers:{},removeUser:function(e){for(var t in this.users)this.users[t].userLeft(e);delete this.users[e],delete this.buffers[e]},addUser:function(e){for(var t in this.users[e.userId]=e,this.buffers[e.userId]={},this.users)if(t!==e.userId){var r=this.users[t];r.userJoined(e.userId,"master"),e.userJoined(r.userId,"master")}},whenTransactionsFinished:function(){var e=this;return new Promise(function(t,r){setTimeout(function(){var n=[];for(var i in e.users)n.push(e.users[i].y.db.whenTransactionsFinished());Promise.all(n).then(t,r)},10)})},flushOne:function e(){var r=[];for(var n in t.buffers){let e=t.buffers[n];var i=!1;for(let t in e)if(e[t].length>0){i=!0;break}i&&r.push(n)}if(r.length>0){var o=getRandom(r);let e=t.buffers[o],n=getRandom(Object.keys(e));var s=e[n].shift();0===e[n].length&&delete e[n];var a=t.users[o];return a.receiveMessage(s[0],s[1]).then(function(){return a.y.db.whenTransactionsFinished()},function(){})}return!1},flushAll:function(){return new Promise(function(e){function r(){var n=t.flushOne();if(n){for(;n;)n=t.flushOne();t.whenTransactionsFinished().then(r)}else n=t.flushOne(),n?n.then(function(){t.whenTransactionsFinished().then(r)}):e()}t.whenTransactionsFinished().then(r)})}};e.utils.globalRoom=t;var r=0;class n extends e.AbstractConnector{constructor(e,n){if(void 0===n)throw new Error("Options must not be undefined!");n.role="master",n.forwardToSyncingClients=!1,super(e,n),this.setUserId(r+++"").then(()=>{t.addUser(this)}),this.globalRoom=t,this.syncingClientDuration=0}receiveMessage(e,t){return super.receiveMessage(e,JSON.parse(JSON.stringify(t)))}send(e,r){var n=t.buffers[e];null!=n&&(null==n[this.userId]&&(n[this.userId]=[]),n[this.userId].push(JSON.parse(JSON.stringify([this.userId,r]))))}broadcast(e){for(var r in t.buffers){var n=t.buffers[r];null==n[this.userId]&&(n[this.userId]=[]),n[this.userId].push(JSON.parse(JSON.stringify([this.userId,e])))}}isDisconnected(){return null==t.users[this.userId]}reconnect(){return this.isDisconnected()&&(t.addUser(this),super.reconnect()),e.utils.globalRoom.flushAll()}disconnect(){var e=Promise.resolve();this.isDisconnected()||(t.removeUser(this.userId),e=super.disconnect());var r=this;return e.then(function(){return r.y.db.whenTransactionsFinished()})}flush(){var e=this;return async(function*(){for(var r=t.buffers[e.userId];Object.keys(r).length>0;){var n=getRandom(Object.keys(r)),i=r[n].shift();0===r[n].length&&delete r[n],yield this.receiveMessage(i[0],i[1])}yield e.whenTransactionsFinished()})}}e.Test=n}},function(e,t,r){(function(n){function i(){return!("undefined"==typeof window||!window.process||"renderer"!==window.process.type)||("undefined"!=typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"undefined"!=typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/))}function o(e){var r=this.useColors;if(e[0]=(r?"%c":"")+this.namespace+(r?" %c":" ")+e[0]+(r?"%c ":" ")+"+"+t.humanize(this.diff),r){var n="color: "+this.color;e.splice(1,0,n,"color: inherit");var i=0,o=0;e[0].replace(/%[a-zA-Z%]/g,function(e){"%%"!==e&&(i++,"%c"===e&&(o=i))}),e.splice(o,0,n)}}function s(){return"object"==typeof console&&console.log&&Function.prototype.apply.call(console.log,console,arguments)}function a(e){try{null==e?t.storage.removeItem("debug"):t.storage.debug=e}catch(e){}}function u(){var e;try{e=t.storage.debug}catch(e){}return!e&&void 0!==n&&"env"in n&&(e=n.env.DEBUG),e}function c(){try{return window.localStorage}catch(e){}}t=e.exports=r(1438),t.log=s,t.formatArgs=o,t.save=a,t.load=u,t.useColors=i,t.storage="undefined"!=typeof chrome&&void 0!==chrome.storage?chrome.storage.local:c(),t.colors=["lightseagreen","forestgreen","goldenrod","dodgerblue","darkorchid","crimson"],t.formatters.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}},t.enable(u())}).call(this,r(6))},function(e,t,r){var n;function i(e){var r=0,n;for(n in e)r=(r<<5)-r+e.charCodeAt(n),r|=0;return t.colors[Math.abs(r)%t.colors.length]}function o(e){function r(){if(r.enabled){var e=r,i=+new Date,o=i-(n||i);e.diff=o,e.prev=n,e.curr=i,n=i;for(var s=new Array(arguments.length),a=0;a<s.length;a++)s[a]=arguments[a];s[0]=t.coerce(s[0]),"string"!=typeof s[0]&&s.unshift("%O");var u=0;s[0]=s[0].replace(/%([a-zA-Z%])/g,function(r,n){if("%%"===r)return r;u++;var i=t.formatters[n];if("function"==typeof i){var o=s[u];r=i.call(e,o),s.splice(u,1),u--}return r}),t.formatArgs.call(e,s);var c=r.log||t.log||console.log.bind(console);c.apply(e,s)}}return r.namespace=e,r.enabled=t.enabled(e),r.useColors=t.useColors(),r.color=i(e),"function"==typeof t.init&&t.init(r),r}function s(e){t.save(e),t.names=[],t.skips=[];for(var r=("string"==typeof e?e:"").split(/[\s,]+/),n=r.length,i=0;i<n;i++)r[i]&&(e=r[i].replace(/\*/g,".*?"),"-"===e[0]?t.skips.push(new RegExp("^"+e.substr(1)+"$")):t.names.push(new RegExp("^"+e+"$")))}function a(){t.enable("")}function u(e){var r,n;for(r=0,n=t.skips.length;r<n;r++)if(t.skips[r].test(e))return!1;for(r=0,n=t.names.length;r<n;r++)if(t.names[r].test(e))return!0;return!1}function c(e){return e instanceof Error?e.stack||e.message:e}t=e.exports=o.debug=o.default=o,t.coerce=c,t.disable=a,t.enable=s,t.enabled=u,t.humanize=r(206),t.names=[],t.skips=[],t.formatters={}},function(e,t){function r(e){var t=new Error("Cannot find module '"+e+"'");throw t.code="MODULE_NOT_FOUND",t}r.keys=function(){return[]},r.resolve=r,e.exports=r,r.id=1439},function(e,t,r){"use strict";function n(e){r(1441)(e);class t extends e.Transaction{constructor(e){super(e),this.store=e,this.ss=e.ss,this.os=e.os,this.ds=e.ds}}var n=e.utils.RBTree,i=e.utils.createSmallLookupBuffer(n);class o extends e.AbstractDatabase{constructor(e,t){super(e,t),this.os=new i,this.ds=new n,this.ss=new i}logTable(){var e=this;this.requestTransaction(function*(){console.log("User: ",this.store.y.connector.userId,"=============================="),console.log("State Set (SS):",yield*this.getStateSet()),console.log("Operation Store (OS):"),yield*this.os.logTable(),console.log("Deletion Store (DS):"),yield*this.ds.logTable(),(this.store.gc1.length>0||this.store.gc2.length>0)&&console.warn("GC1|2 not empty!",this.store.gc1,this.store.gc2),"{}"!==JSON.stringify(this.store.listenersById)&&console.warn("listenersById not empty!"),"[]"!==JSON.stringify(this.store.listenersByIdExecuteNow)&&console.warn("listenersByIdExecuteNow not empty!"),this.store.transactionInProgress&&console.warn("Transaction still in progress!")},!0)}transact(e){for(var r=new t(this);null!==e;){for(var n=e.call(r),i=n.next();!i.done;)i=n.next(i.value);e=this.getNextRequest()}}*destroy(){yield*super.destroy(),delete this.os,delete this.ss,delete this.ds}}e.extend("memory",o)}e.exports=n,"undefined"!=typeof Y&&n(Y)},function(e,t,r){"use strict";e.exports=function(e){class t{constructor(e){if(this.val=e,this.color=!0,this._left=null,this._right=null,this._parent=null,null===e.id)throw new Error("You must define id!")}isRed(){return this.color}isBlack(){return!this.color}redden(){return this.color=!0,this}blacken(){return this.color=!1,this}get grandparent(){return this.parent.parent}get parent(){return this._parent}get sibling(){return this===this.parent.left?this.parent.right:this.parent.left}get left(){return this._left}get right(){return this._right}set left(e){null!==e&&(e._parent=this),this._left=e}set right(e){null!==e&&(e._parent=this),this._right=e}rotateLeft(e){var t=this.parent,r=this.right,n=this.right.left;if(r.left=this,this.right=n,null===t)e.root=r,r._parent=null;else if(t.left===this)t.left=r;else{if(t.right!==this)throw new Error("The elements are wrongly connected!");t.right=r}}next(){if(null!==this.right){for(var e=this.right;null!==e.left;)e=e.left;return e}for(var t=this;null!==t.parent&&t!==t.parent.left;)t=t.parent;return t.parent}prev(){if(null!==this.left){for(var e=this.left;null!==e.right;)e=e.right;return e}for(var t=this;null!==t.parent&&t!==t.parent.right;)t=t.parent;return t.parent}rotateRight(e){var t=this.parent,r=this.left,n=this.left.right;if(r.right=this,this.left=n,null===t)e.root=r,r._parent=null;else if(t.left===this)t.left=r;else{if(t.right!==this)throw new Error("The elements are wrongly connected!");t.right=r}}getUncle(){return this.parent===this.parent.parent.left?this.parent.parent.right:this.parent.parent.left}}class r{constructor(){this.root=null,this.length=0}*findNext(e){return yield*this.findWithLowerBound([e[0],e[1]+1])}*findPrev(e){return yield*this.findWithUpperBound([e[0],e[1]-1])}findNodeWithLowerBound(t){if(void 0===t)throw new Error("You must define from!");var r=this.root;if(null===r)return null;for(;;)if(null!==t&&!e.utils.smaller(t,r.val.id)||null===r.left){if(null===t||!e.utils.smaller(r.val.id,t))return r;if(null===r.right)return r.next();r=r.right}else r=r.left}findNodeWithUpperBound(t){if(void 0===t)throw new Error("You must define from!");var r=this.root;if(null===r)return null;for(;;)if(null!==t&&!e.utils.smaller(r.val.id,t)||null===r.right){if(null===t||!e.utils.smaller(t,r.val.id))return r;if(null===r.left)return r.prev();r=r.left}else r=r.right}findSmallestNode(){for(var e=this.root;null!=e&&null!=e.left;)e=e.left;return e}*findWithLowerBound(e){var t=this.findNodeWithLowerBound(e);return null==t?null:t.val}*findWithUpperBound(e){var t=this.findNodeWithUpperBound(e);return null==t?null:t.val}*iterate(t,r,n,i){var o;for(o=null===r?this.findSmallestNode():this.findNodeWithLowerBound(r);null!==o&&(null===n||e.utils.smaller(o.val.id,n)||e.utils.compareIds(o.val.id,n));)yield*i.call(t,o.val),o=o.next();return!0}*logTable(e,t,r){null==r&&(r=function(){return!0}),null==e&&(e=null),null==t&&(t=null);var n=[];yield*this.iterate(this,e,t,function*(e){if(r(e)){var t={};for(var i in e)"object"==typeof e[i]?t[i]=JSON.stringify(e[i]):t[i]=e[i];n.push(t)}}),null!=console.table&&console.table(n)}*find(e){var t;return(t=this.findNode(e))?t.val:null}findNode(t){if(null==t||t.constructor!==Array)throw new Error("Expect id to be an array!");var r=this.root;if(null===r)return!1;for(;;){if(null===r)return!1;if(e.utils.smaller(t,r.val.id))r=r.left;else{if(!e.utils.smaller(r.val.id,t))return r;r=r.right}}}*delete(e){if(null==e||e.constructor!==Array)throw new Error("id is expected to be an Array!");var r=this.findNode(e);if(null!=r){if(this.length--,null!==r.left&&null!==r.right){for(var n=r.left;null!==n.right;)n=n.right;r.val=n.val,r=n}var i,o=r.left||r.right;if(null===o?(i=!0,o=new t({id:0}),o.blacken(),r.right=o):i=!1,null!==r.parent){if(r.parent.left===r)r.parent.left=o;else{if(r.parent.right!==r)throw new Error("Impossible!");r.parent.right=o}if(r.isBlack()&&(o.isRed()?o.blacken():this._fixDelete(o)),this.root.blacken(),i)if(o.parent.left===o)o.parent.left=null;else{if(o.parent.right!==o)throw new Error("Impossible #3");o.parent.right=null}}else i?this.root=null:(this.root=o,o.blacken(),o._parent=null)}}_fixDelete(e){function t(e){return null===e||e.isBlack()}function r(e){return null!==e&&e.isRed()}if(null!==e.parent){var n=e.sibling;if(r(n)){if(e.parent.redden(),n.blacken(),e===e.parent.left)e.parent.rotateLeft(this);else{if(e!==e.parent.right)throw new Error("Impossible #2");e.parent.rotateRight(this)}n=e.sibling}e.parent.isBlack()&&n.isBlack()&&t(n.left)&&t(n.right)?(n.redden(),this._fixDelete(e.parent)):e.parent.isRed()&&n.isBlack()&&t(n.left)&&t(n.right)?(n.redden(),e.parent.blacken()):(e===e.parent.left&&n.isBlack()&&r(n.left)&&t(n.right)?(n.redden(),n.left.blacken(),n.rotateRight(this),n=e.sibling):e===e.parent.right&&n.isBlack()&&r(n.right)&&t(n.left)&&(n.redden(),n.right.blacken(),n.rotateLeft(this),n=e.sibling),n.color=e.parent.color,e.parent.blacken(),e===e.parent.left?(n.right.blacken(),e.parent.rotateLeft(this)):(n.left.blacken(),e.parent.rotateRight(this)))}}*put(r){if(null==r||null==r.id||r.id.constructor!==Array)throw new Error("v is expected to have an id property which is an Array!");var n=new t(r);if(null!==this.root){for(var i=this.root;;)if(e.utils.smaller(n.val.id,i.val.id)){if(null===i.left){i.left=n;break}i=i.left}else{if(!e.utils.smaller(i.val.id,n.val.id))return i.val=n.val,i;if(null===i.right){i.right=n;break}i=i.right}this._fixInsert(n)}else this.root=n;return this.length++,this.root.blacken(),n}_fixInsert(e){if(null!==e.parent){if(!e.parent.isBlack()){var t=e.getUncle();null!==t&&t.isRed()?(e.parent.blacken(),t.blacken(),e.grandparent.redden(),this._fixInsert(e.grandparent)):(e===e.parent.right&&e.parent===e.grandparent.left?(e.parent.rotateLeft(this),e=e.left):e===e.parent.left&&e.parent===e.grandparent.right&&(e.parent.rotateRight(this),e=e.right),e.parent.blacken(),e.grandparent.redden(),e===e.parent.left?e.grandparent.rotateRight(this):e.grandparent.rotateLeft(this))}}else e.blacken()}*flush(){}}e.utils.RBTree=r}},function(e,t,r){"use strict";function n(e){class t extends e.utils.CustomType{constructor(t,r,n){super(),this.os=t,this._model=r,this._content=n,this._parent=null,this._deepEventHandler=new e.utils.EventListenerHandler,this.eventHandler=new e.utils.EventHandler(t=>{if("Insert"===t.struct){if(this._content.some(function(r){return e.utils.compareIds(r.id,t.id)}))return;let o;if(null===t.left)o=0;else if(o=1+this._content.findIndex(function(r){return e.utils.compareIds(r.id,t.left)}),o<=0)throw new Error("Unexpected operation!");var r,n;if(t.hasOwnProperty("opContent")){this._content.splice(o,0,{id:t.id,type:t.opContent}),n=1;let e=this.os.getType(t.opContent);e._parent=this._model,r=[e]}else{var i=t.content.map(function(e,r){return{id:[t.id[0],t.id[1]+r],val:e}});i.length<3e4?this._content.splice.apply(this._content,[o,0].concat(i)):this._content=this._content.slice(0,o).concat(i).concat(this._content.slice(o)),r=t.content,n=t.content.length}e.utils.bubbleEvent(this,{type:"insert",object:this,index:o,values:r,length:n})}else{if("Delete"!==t.struct)throw new Error("Unexpected struct!");for(var o=0;o<this._content.length&&t.length>0;o++){var s=this._content[o];if(e.utils.inDeletionRange(t,s.id)){var a;for(a=1;a<t.length&&o+a<this._content.length&&e.utils.inDeletionRange(t,this._content[o+a].id);a++);s=this._content[o+a-1],t.length-=s.id[1]-t.target[1]+1,t.target=[s.id[0],s.id[1]+1];let r=this._content.splice(o,a),n=r.map(e=>null!=e.val?e.val:this.os.getType(e.type));e.utils.bubbleEvent(this,{type:"delete",object:this,index:o,values:n,_content:r,length:a})}}}})}_getPathToChild(t){return this._content.findIndex(r=>null!=r.type&&e.utils.compareIds(r.type,t))}_destroy(){this.eventHandler.destroy(),this.eventHandler=null,this._content=null,this._model=null,this._parent=null,this.os=null}get length(){return this._content.length}get(e){if(null==e||"number"!=typeof e)throw new Error("pos must be a number!");if(!(e>=this._content.length))return null==this._content[e].type?this._content[e].val:this.os.getType(this._content[e].type)}toArray(){return this._content.map((e,t)=>null!=e.type?this.os.getType(e.type):e.val)}push(e){return this.insert(this._content.length,e)}insert(t,r){if("number"!=typeof t)throw new Error("pos must be a number!");if(!Array.isArray(r))throw new Error("contents must be an Array of objects!");if(0!==r.length){if(t>this._content.length||t<0)throw new Error("This position exceeds the range of the array!");for(var n=0===t?null:this._content[t-1].id,i=[],o=n,s=0;s<r.length;){for(var a={left:o,origin:o,parent:this._model,struct:"Insert"},u=[],c;s<r.length;){var f=r[s++];if(c=e.utils.isTypeDefinition(f),c){if(u.length>0){s--;break}break}u.push(f)}if(u.length>0)a.content=u,a.id=this.os.getNextOpId(u.length);else{var l=this.os.getNextOpId(1);this.os.createType(c,l),a.opContent=l,a.id=this.os.getNextOpId(1)}i.push(a),o=a.id}var h=this.eventHandler;this.os.requestTransaction(function*(){var e;if(null!=n){var t=yield*this.getInsertionCleanEnd(n);e=t.right}else e=(yield*this.getOperation(i[0].parent)).start;for(var r=0;r<i.length;r++){var o=i[r];o.right=e}yield*h.awaitOps(this,this.applyCreatedOperations,[i])}),h.awaitAndPrematurelyCall(i)}}delete(t,r){if(null==r&&(r=1),"number"!=typeof r)throw new Error("length must be a number!");if("number"!=typeof t)throw new Error("pos must be a number!");if(t+r>this._content.length||t<0||r<0)throw new Error("The deletion range exceeds the range of the array!");if(0!==r){for(var n=this.eventHandler,i=[],o=0;o<r;o+=a){var s=this._content[t+o].id,a;for(a=1;o+a<r&&e.utils.compareIds(this._content[t+o+a].id,[s[0],s[1]+a]);a++);i.push({target:s,struct:"Delete",length:a})}this.os.requestTransaction(function*(){yield*n.awaitOps(this,this.applyCreatedOperations,[i])}),n.awaitAndPrematurelyCall(i)}}observe(e){this.eventHandler.addEventListener(e)}observeDeep(e){this._deepEventHandler.addEventListener(e)}unobserve(e){this.eventHandler.removeEventListener(e)}unobserveDeep(e){this._deepEventHandler.removeEventListener(e)}*_changed(e,t){if(!t.deleted){if("Insert"===t.struct){for(var r=t.left,n;null!=r&&(n=yield*e.getInsertion(r),n.deleted);)r=n.left;t.left=r,null!=t.opContent&&(yield*e.store.initType.call(e,t.opContent))}this.eventHandler.receivedOp(t)}}}e.extend("Array",new e.utils.CustomTypeDefinition({name:"Array",class:t,struct:"List",initType:function*r(n,i){var o=[],s=[];yield*e.Struct.List.map.call(this,i,function(e){e.hasOwnProperty("opContent")?(o.push({id:e.id,type:e.opContent}),s.push(e.opContent)):e.content.forEach(function(t,r){o.push({id:[e.id[0],e.id[1]+r],val:e.content[r]})})});for(var a=0;a<s.length;a++){var u=yield*this.store.initType.call(this,s[a]);u._parent=i.id}return new t(n,i.id,o)},createType:function e(r,n){return new t(r,n.id,[])}}))}e.exports=n,"undefined"!=typeof Y&&n(Y)},function(e,t,r){"use strict";var n=r(1444),i={major:0,minor:0};function o(e){e.requestModules(["Array"]).then(function(){class t extends e.Array.typeDefinition.class{constructor(e,t,r){super(e,t,r),this.textfields=[],this.aceInstances=[],this.codeMirrorInstances=[],this.monacoInstances=[]}toString(){return this._content.map(function(e){return e.val}).join("")}insert(e,t){for(var r=t.split(""),n=0;n<r.length;n++)/[\uD800-\uDFFF]/.test(r[n])&&(r[n]=r[n]+r[n+1],r[n+1]="",n++);super.insert(e,r)}delete(e,t){if(null==t&&(t=1),"number"!=typeof t)throw new Error("length must be a number!");if("number"!=typeof e)throw new Error("pos must be a number!");if(e+t>this._content.length||e<0||t<0)throw new Error("The deletion range exceeds the range of the array!");if(0!==t)if(this._content.length>e+t&&""===this._content[e+t].val&&2===this._content[e+t-1].val.length){let r=this._content[e+t-1].val[0];super.delete(e,t+1),super.insert(e,[r])}else if(e>0&&""===this._content[e].val&&2===this._content[e-1].val.length){let r=this._content[e-1].val[1];super.delete(e-1,t+1),super.insert(e-1,[r])}else super.delete(e,t)}unbindAll(){this.unbindTextareaAll(),this.unbindAceAll(),this.unbindCodeMirrorAll(),this.unbindMonacoAll()}unbindMonaco(e){var t=this.monacoInstances.findIndex(function(t){return t.editor===e});if(t>=0){var r=this.monacoInstances[t];this.unobserve(r.yCallback),r.disposeBinding(),this.monacoInstances.splice(t,1)}}unbindMonacoAll(){for(let e=this.monacoInstances.length-1;e>=0;e--)this.unbindMonaco(this.monacoInstances[e].editor)}bindMonaco(e,t){var r=this;t=t||{};var n=!0;function o(e){if(n){n=!1;try{e()}catch(e){throw n=!0,new Error(e)}n=!0}}function s(e){o(function(){for(var t=0,n=1;n<e.range.startLineNumber;t++)"\n"===r._content[t].val&&n++;var i=t+e.range.startColumn-1;e.rangeLength>0&&r.delete(i,e.rangeLength),r.insert(i,e.text)})}e.setValue(this.toString());var a=e.onDidChangeModelContent(s).dispose;function u(t){o(function(){let r=e.model.getPositionAt(t.index);var n,o;"insert"===t.type?(n=r,o=t.values.join("")):"delete"===t.type&&(n=e.model.modifyPosition(r,t.length),o="");var s={startLineNumber:r.lineNumber,startColumn:r.column,endLineNumber:n.lineNumber,endColumn:n.column},a={major:i.major,minor:i.minor++};e.executeEdits("Yjs",[{id:a,range:s,text:o,forceMoveMarkers:!0}])})}this.observe(u),this.monacoInstances.push({editor:e,yCallback:u,monacoCallback:s,disposeBinding:a})}unbindCodeMirror(e){var t=this.codeMirrorInstances.findIndex(function(t){return t.editor===e});if(t>=0){var r=this.codeMirrorInstances[t];this.unobserve(r.yCallback),r.editor.off("changes",r.codeMirrorCallback),this.codeMirrorInstances.splice(t,1)}}unbindCodeMirrorAll(){for(let e=this.codeMirrorInstances.length-1;e>=0;e--)this.unbindCodeMirror(this.codeMirrorInstances[e].editor)}bindCodeMirror(e,t){var r=this;t=t||{};var n=!0;function i(e){if(n){n=!1;try{e()}catch(e){throw n=!0,new Error(e)}n=!0}}function o(t,n){i(function(){for(var t=0;t<n.length;t++){var i=n[t],o=e.indexFromPos(i.from);if(i.removed.length>0){for(var s=0,a=0;a<i.removed.length;a++)s+=i.removed[a].length;s+=i.removed.length-1,r.delete(o,s)}r.insert(o,i.text.join("\n"))}})}function s(t){i(function(){let r=e.posFromIndex(t.index);if("insert"===t.type){let n=r;e.replaceRange(t.values.join(""),r,n)}else if("delete"===t.type){let n=e.posFromIndex(t.index+t.length);e.replaceRange("",r,n)}})}e.setValue(this.toString()),e.on("changes",o),this.observe(s),this.codeMirrorInstances.push({editor:e,yCallback:s,codeMirrorCallback:o})}unbindAce(e){var t=this.aceInstances.findIndex(function(t){return t.editor===e});if(t>=0){var r=this.aceInstances[t];this.unobserve(r.yCallback),r.editor.off("change",r.aceCallback),this.aceInstances.splice(t,1)}}unbindAceAll(){for(let e=this.aceInstances.length-1;e>=0;e--)this.unbindAce(this.aceInstances[e].editor)}bindAce(e,t){var r=this;t=t||{};var n=!0,i;function o(e){if(n){n=!1;try{e()}catch(e){throw n=!0,new Error(e)}n=!0}}function s(t){o(function(){var n,i,o=e.getSession().getDocument();"insert"===t.action?(n=o.positionToIndex(t.start,0),r.insert(n,t.lines.join("\n"))):"remove"===t.action&&(n=o.positionToIndex(t.start,0),i=t.lines.join("\n").length,r.delete(n,i))})}e.setValue(this.toString()),e.on("change",s),e.selection.clearSelection(),i="undefined"!=typeof ace&&null==t.aceClass?ace:t.aceClass;var a=t.aceRequire||i.require,u=a("ace/range").Range;function c(t){var r=e.getSession().getDocument();o(function(){if("insert"===t.type){let e=r.indexToPosition(t.index,0);r.insert(e,t.values.join(""))}else if("delete"===t.type){let n=r.indexToPosition(t.index,0),i=r.indexToPosition(t.index+t.length,0);var e=new u(n.row,n.column,i.row,i.column);r.remove(e)}})}this.observe(c),this.aceInstances.push({editor:e,yCallback:c,aceCallback:s})}bind(){var e=arguments[0];e instanceof Element?this.bindTextarea.apply(this,arguments):null!=e&&null!=e.session&&null!=e.getSession&&null!=e.setValue?this.bindAce.apply(this,arguments):null!=e&&null!=e.posFromIndex&&null!=e.replaceRange?this.bindCodeMirror.apply(this,arguments):null!=e&&null!=e.onDidChangeModelContent?this.bindMonaco.apply(this,arguments):console.error("Cannot bind, unsupported editor!")}unbindTextarea(e){var t=this.textfields.findIndex(function(t){return t.editor===e});if(t>=0){var r=this.textfields[t];this.unobserve(r.yCallback);var n=r.editor;n.removeEventListener("input",r.eventListener),this.textfields.splice(t,1)}}unbindTextareaAll(){for(let e=this.textfields.length-1;e>=0;e--)this.unbindTextarea(this.textfields[e].editor)}bindTextarea(e,t){t=t||window,null==t.getSelection&&(t=window);for(var r=0;r<this.textfields.length;r++)if(this.textfields[r].editor===e)return;var i=!0;function o(e){if(i){i=!1;try{e()}catch(e){throw i=!0,new Error(e)}i=!0}}var s=this,a,u,c,f;function l(e){o(()=>{var t,r;if("insert"===e.type){t=e.index,r=function(e){return e<=t?e:(e+=1,e)};var n=a(r);u(n)}else"delete"===e.type&&(t=e.index,r=function(e){return e<t?e:(e-=1,e)},n=a(r),u(n))})}e.value=this.toString(),null!=e.selectionStart&&null!=e.setSelectionRange?(a=function(t){var r=e.selectionStart,n=e.selectionEnd;return null!=t&&(r=t(r),n=t(n)),{left:r,right:n}},u=function(t){c(s.toString()),e.setSelectionRange(t.left,t.right)},c=function(t){e.value=t},f=function(){return e.value}):(a=function(r){var n={},i=t.getSelection(),o=e.textContent.length;n.left=Math.min(i.anchorOffset,o),n.right=Math.min(i.focusOffset,o),null!=r&&(n.left=r(n.left),n.right=r(n.right));var s=i.focusNode;return s===e||s===e.childNodes[0]?n.isReal=!0:n.isReal=!1,n},u=function(r){c(s.toString());var n=e.childNodes[0];if(r.isReal&&null!=n){r.left<0&&(r.left=0),r.right=Math.max(r.left,r.right),r.right>n.length&&(r.right=n.length),r.left=Math.min(r.left,r.right);var i=document.createRange();i.setStart(n,r.left),i.setEnd(n,r.right);var o=t.getSelection();o.removeAllRanges(),o.addRange(i)}},c=function(t){e.innerText=t},f=function(){return e.innerText}),c(this.toString()),this.observe(l);var h=function e(){o(function(){for(var e=a(function(e){return e}),t=s.toString(),r=f(),i=n(t,r,e.left),o=0,u=0;u<i.length;u++){var c=i[u];0===c[0]?o+=c[1].length:-1===c[0]?s.delete(o,c[1].length):(s.insert(o,c[1]),o+=c[1].length)}})};e.addEventListener("input",h),this.textfields.push({editor:e,yCallback:l,eventListener:h})}_destroy(){this.unbindAll(),this.textfields=null,this.aceInstances=null,super._destroy()}}e.extend("Text",new e.utils.CustomTypeDefinition({name:"Text",class:t,struct:"List",initType:function*r(n,i){var o=[];return yield*e.Struct.List.map.call(this,i,function(e){if(e.hasOwnProperty("opContent"))throw new Error("Text must not contain types!");e.content.forEach(function(t,r){o.push({id:[e.id[0],e.id[1]+r],val:e.content[r]})})}),new t(n,i.id,o)},createType:function e(r,n){return new t(r,n.id,[])}}))})}e.exports=o,"undefined"!=typeof Y&&o(Y)},function(e,t){var r=-1,n=1,i=0;function o(e,t,r){if(e==t)return e?[[i,e]]:[];(r<0||e.length<r)&&(r=null);var n=c(e,t),o=e.substring(0,n);e=e.substring(n),t=t.substring(n),n=f(e,t);var a=e.substring(e.length-n);e=e.substring(0,e.length-n),t=t.substring(0,t.length-n);var u=s(e,t);return o&&u.unshift([i,o]),a&&u.push([i,a]),h(u),null!=r&&(u=y(u,r)),u=g(u),u}function s(e,t){var s;if(!e)return[[n,t]];if(!t)return[[r,e]];var u=e.length>t.length?e:t,c=e.length>t.length?t:e,f=u.indexOf(c);if(-1!=f)return s=[[n,u.substring(0,f)],[i,c],[n,u.substring(f+c.length)]],e.length>t.length&&(s[0][0]=s[2][0]=r),s;if(1==c.length)return[[r,e],[n,t]];var h=l(e,t);if(h){var p=h[0],d=h[1],y=h[2],g=h[3],m=h[4],b=o(p,y),v=o(d,g);return b.concat([[i,m]],v)}return a(e,t)}function a(e,t){for(var i=e.length,o=t.length,s=Math.ceil((i+o)/2),a=s,c=2*s,f=new Array(c),l=new Array(c),h=0;h<c;h++)f[h]=-1,l[h]=-1;f[a+1]=0,l[a+1]=0;for(var p=i-o,d=p%2!=0,y=0,g=0,m=0,b=0,v=0;v<s;v++){for(var _=-v+y;_<=v-g;_+=2){var w=a+_,S;S=_==-v||_!=v&&f[w-1]<f[w+1]?f[w+1]:f[w-1]+1;for(var k=S-_;S<i&&k<o&&e.charAt(S)==t.charAt(k);)S++,k++;if(f[w]=S,S>i)g+=2;else if(k>o)y+=2;else if(d){var E=a+p-_;if(E>=0&&E<c&&-1!=l[E]){var A=i-l[E];if(S>=A)return u(e,t,S,k)}}}for(var x=-v+m;x<=v-b;x+=2){var E=a+x,A;A=x==-v||x!=v&&l[E-1]<l[E+1]?l[E+1]:l[E-1]+1;for(var I=A-x;A<i&&I<o&&e.charAt(i-A-1)==t.charAt(o-I-1);)A++,I++;if(l[E]=A,A>i)b+=2;else if(I>o)m+=2;else if(!d){var w=a+p-x;if(w>=0&&w<c&&-1!=f[w]){var S=f[w],k=a+S-w;if(A=i-A,S>=A)return u(e,t,S,k)}}}}return[[r,e],[n,t]]}function u(e,t,r,n){var i=e.substring(0,r),s=t.substring(0,n),a=e.substring(r),u=t.substring(n),c=o(i,s),f=o(a,u);return c.concat(f)}function c(e,t){if(!e||!t||e.charAt(0)!=t.charAt(0))return 0;for(var r=0,n=Math.min(e.length,t.length),i=n,o=0;r<i;)e.substring(o,i)==t.substring(o,i)?(r=i,o=r):n=i,i=Math.floor((n-r)/2+r);return i}function f(e,t){if(!e||!t||e.charAt(e.length-1)!=t.charAt(t.length-1))return 0;for(var r=0,n=Math.min(e.length,t.length),i=n,o=0;r<i;)e.substring(e.length-i,e.length-o)==t.substring(t.length-i,t.length-o)?(r=i,o=r):n=i,i=Math.floor((n-r)/2+r);return i}function l(e,t){var r=e.length>t.length?e:t,n=e.length>t.length?t:e;if(r.length<4||2*n.length<r.length)return null;function i(e,t,r){for(var n=e.substring(r,r+Math.floor(e.length/4)),i=-1,o="",s,a,u,l;-1!=(i=t.indexOf(n,i+1));){var h=c(e.substring(r),t.substring(i)),p=f(e.substring(0,r),t.substring(0,i));o.length<p+h&&(o=t.substring(i-p,i)+t.substring(i,i+h),s=e.substring(0,r-p),a=e.substring(r+h),u=t.substring(0,i-p),l=t.substring(i+h))}return 2*o.length>=e.length?[s,a,u,l,o]:null}var o=i(r,n,Math.ceil(r.length/4)),s=i(r,n,Math.ceil(r.length/2)),a,u,l,h,p;if(!o&&!s)return null;a=s?o&&o[4].length>s[4].length?o:s:o,e.length>t.length?(u=a[0],l=a[1],h=a[2],p=a[3]):(h=a[0],p=a[1],u=a[2],l=a[3]);var d=a[4];return[u,l,h,p,d]}function h(e){e.push([i,""]);for(var t=0,o=0,s=0,a="",u="",l;t<e.length;)switch(e[t][0]){case n:s++,u+=e[t][1],t++;break;case r:o++,a+=e[t][1],t++;break;case i:o+s>1?(0!==o&&0!==s&&(l=c(u,a),0!==l&&(t-o-s>0&&e[t-o-s-1][0]==i?e[t-o-s-1][1]+=u.substring(0,l):(e.splice(0,0,[i,u.substring(0,l)]),t++),u=u.substring(l),a=a.substring(l)),l=f(u,a),0!==l&&(e[t][1]=u.substring(u.length-l)+e[t][1],u=u.substring(0,u.length-l),a=a.substring(0,a.length-l))),0===o?e.splice(t-s,o+s,[n,u]):0===s?e.splice(t-o,o+s,[r,a]):e.splice(t-o-s,o+s,[r,a],[n,u]),t=t-o-s+(o?1:0)+(s?1:0)+1):0!==t&&e[t-1][0]==i?(e[t-1][1]+=e[t][1],e.splice(t,1)):t++,s=0,o=0,a="",u=""}""===e[e.length-1][1]&&e.pop();var p=!1;for(t=1;t<e.length-1;)e[t-1][0]==i&&e[t+1][0]==i&&(e[t][1].substring(e[t][1].length-e[t-1][1].length)==e[t-1][1]?(e[t][1]=e[t-1][1]+e[t][1].substring(0,e[t][1].length-e[t-1][1].length),e[t+1][1]=e[t-1][1]+e[t+1][1],e.splice(t-1,1),p=!0):e[t][1].substring(0,e[t+1][1].length)==e[t+1][1]&&(e[t-1][1]+=e[t+1][1],e[t][1]=e[t][1].substring(e[t+1][1].length)+e[t+1][1],e.splice(t+1,1),p=!0)),t++;p&&h(e)}var p=o;function d(e,t){if(0===t)return[i,e];for(var n=0,o=0;o<e.length;o++){var s=e[o];if(s[0]===r||s[0]===i){var a=n+s[1].length;if(t===a)return[o+1,e];if(t<a){e=e.slice();var u=t-n,c=[s[0],s[1].slice(0,u)],f=[s[0],s[1].slice(u)];return e.splice(o,1,c,f),[o+1,e]}n=a}}throw new Error("cursor_pos is out of bounds!")}function y(e,t){var r=d(e,t),n=r[1],o=r[0],s=n[o],a=n[o+1];if(null==s)return e;if(s[0]!==i)return e;if(null!=a&&s[1]+a[1]===a[1]+s[1])return n.splice(o,2,a,s),m(n,o,2);if(null!=a&&0===a[1].indexOf(s[1])){n.splice(o,2,[a[0],s[1]],[0,s[1]]);var u=a[1].slice(s[1].length);return u.length>0&&n.splice(o+2,0,[a[0],u]),m(n,o,3)}return e}function g(e){for(var t=!1,o=function(e){return e.charCodeAt(0)>=56320&&e.charCodeAt(0)<=57343},s=function(e){return e.charCodeAt(e.length-1)>=55296&&e.charCodeAt(e.length-1)<=56319},a=2;a<e.length;a+=1)e[a-2][0]===i&&s(e[a-2][1])&&e[a-1][0]===r&&o(e[a-1][1])&&e[a][0]===n&&o(e[a][1])&&(t=!0,e[a-1][1]=e[a-2][1].slice(-1)+e[a-1][1],e[a][1]=e[a-2][1].slice(-1)+e[a][1],e[a-2][1]=e[a-2][1].slice(0,-1));if(!t)return e;for(var u=[],a=0;a<e.length;a+=1)e[a][1].length>0&&u.push(e[a]);return u}function m(e,t,r){for(var n=t+r-1;n>=0&&n>=t-1;n--)if(n+1<e.length){var i=e[n],o=e[n+1];i[0]===o[1]&&e.splice(n,2,[i[0],i[1]+o[1]])}return e}p.INSERT=n,p.DELETE=r,p.EQUAL=i,e.exports=p},function(e,t,r){"use strict";function n(e){class t extends e.utils.CustomType{constructor(t,r,n,i){super(),this._model=r.id,this._parent=null,this._deepEventHandler=new e.utils.EventListenerHandler,this.os=t,this.map=e.utils.copyObject(r.map),this.contents=n,this.opContents=i,this.eventHandler=new e.utils.EventHandler(t=>{var r,n="Delete"===t.struct?t.key:t.parentSub;if(r=null!=this.opContents[n]?this.os.getType(this.opContents[n]):this.contents[n],"Insert"===t.struct){var i;if(null===t.left&&!e.utils.compareIds(t.id,this.map[n]))null!=t.opContent?(i=this.os.getType(t.opContent),i._parent=this._model,delete this.contents[n],t.deleted?delete this.opContents[n]:this.opContents[n]=t.opContent):(i=t.content[0],delete this.opContents[n],t.deleted?delete this.contents[n]:this.contents[n]=t.content[0]),this.map[n]=t.id,void 0===r?e.utils.bubbleEvent(this,{name:n,object:this,type:"add",value:i}):e.utils.bubbleEvent(this,{name:n,object:this,oldValue:r,type:"update",value:i})}else{if("Delete"!==t.struct)throw new Error("Unexpected Operation!");e.utils.compareIds(this.map[n],t.target)&&(delete this.opContents[n],delete this.contents[n],e.utils.bubbleEvent(this,{name:n,object:this,oldValue:r,type:"delete"}))}})}_getPathToChild(t){return Object.keys(this.opContents).find(r=>e.utils.compareIds(this.opContents[r],t))}_destroy(){this.eventHandler.destroy(),this.eventHandler=null,this.contents=null,this.opContents=null,this._model=null,this._parent=null,this.os=null,this.map=null}get(e){if(null==e||"string"!=typeof e)throw new Error("You must specify a key (as string)!");return null==this.opContents[e]?this.contents[e]:this.os.getType(this.opContents[e])}keys(){return Object.keys(this.contents).concat(Object.keys(this.opContents))}keysPrimitives(){return Object.keys(this.contents)}keysTypes(){return Object.keys(this.opContents)}getPrimitive(t){if(null==t)return e.utils.copyObject(this.contents);if("string"!=typeof t)throw new Error("Key is expected to be a string!");return this.contents[t]}getType(e){if(null==e||"string"!=typeof e)throw new Error("You must specify a key (as string)!");return null!=this.opContents[e]?this.os.getType(this.opContents[e]):null}delete(t){var r=this.map[t];if(null!=r){var n={target:r,struct:"Delete"},i=this.eventHandler,o=e.utils.copyObject(n);o.key=t,this.os.requestTransaction(function*(){yield*i.awaitOps(this,this.applyCreatedOperations,[[n]])}),i.awaitAndPrematurelyCall([o])}}set(t,r){var n=this.map[t]||null,i={id:this.os.getNextOpId(1),left:null,right:n,origin:null,parent:this._model,parentSub:t,struct:"Insert"},o=this.eventHandler,s=e.utils.isTypeDefinition(r);if(!1!==s){var a=this.os.createType(s);return i.opContent=a._model,this.os.requestTransaction(function*(){yield*o.awaitOps(this,this.applyCreatedOperations,[[i]])}),o.awaitAndPrematurelyCall([i]),a}return i.content=[r],this.os.requestTransaction(function*(){yield*o.awaitOps(this,this.applyCreatedOperations,[[i]])}),o.awaitAndPrematurelyCall([i]),r}observe(e){this.eventHandler.addEventListener(e)}observeDeep(e){this._deepEventHandler.addEventListener(e)}unobserve(e){this.eventHandler.removeEventListener(e)}unobserveDeep(e){this._deepEventHandler.removeEventListener(e)}observePath(r,n){var i=this,o;function s(e){e.name===o&&n(i.get(o))}if(r.length<1)return n(this),function(){};if(1===r.length)return o=r[0],n(i.get(o)),this.observe(s),function(){i.unobserve(n)};var a,u=function(){var o=i.get(r[0]);o instanceof t||(o=i.set(r[0],e.Map)),a=o.observePath(r.slice(1),n)},c=function(e){e.name===r[0]&&(null!=a&&a(),"add"!==e.type&&"update"!==e.type||u())};return i.observe(c),u(),function(){null!=a&&a(),i.unobserve(c)}}*_changed(e,t){if("Delete"===t.struct){if(null==t.key){var r=yield*e.getOperation(t.target);t.key=r.parentSub}}else null!=t.opContent&&(yield*e.store.initType.call(e,t.opContent));this.eventHandler.receivedOp(t)}}e.extend("Map",new e.utils.CustomTypeDefinition({name:"Map",class:t,struct:"Map",initType:function*e(r,n){var i={},o={},s=n.map;for(var a in s){var u=yield*this.getOperation(s[a]);if(!u.deleted)if(null!=u.opContent){o[a]=u.opContent;var c=yield*this.store.initType.call(this,u.opContent);c._parent=n.id}else i[a]=u.content[0]}return new t(r,n,i,o)},createType:function e(r,n){return new t(r,n,{},{})}}))}e.exports=n,"undefined"!=typeof Y&&n(Y)},function(e,t,r){"use strict";const n=r(1)("y-ipfs-connector"),i=r(10),o=r(1447),s=r(126),a=r(2).Buffer,u=r(1455),c=r(1456);function f(e){class t extends e.AbstractConnector{constructor(e,t){if(void 0===t)throw new Error("Options must not be undefined!");if(null==t.room)throw new Error("You must define a room name!");if(!t.ipfs)throw new Error("You must define a started IPFS object inside options");t.role||(t.role="master"),super(e,t),this._yConnectorOptions=t,this.ipfs=t.ipfs;const r=this.ipfsPubSubTopic="y-ipfs:rooms:"+t.room;this.roomEmitter=t.roomEmitter||new i,this.roomEmitter.peers=(()=>this._room.getPeers()),this.roomEmitter.id=(()=>r),this._receiveQueue=s(this._processQueue.bind(this),1),this._room=o(this.ipfs,r),this._room.setMaxListeners(1/0),this._room.on("error",e=>{console.error(e)}),this._room.on("message",e=>{if(this.ipfs._peerInfo&&e.from===this.ipfs._peerInfo.id.toB58String())return;const r=()=>{let r;r=this._yConnectorOptions.decode?this._yConnectorOptions.decode(e.data):c(e.data);const n=()=>{const t=c(r.payload);this.roomEmitter.emit("received message",e.from,t),null!==t.type&&this._queueReceiveMessage(e.from,t)};if(t.verifySignature){const i=r.signature&&a.from(r.signature,"base64");t.verifySignature.call(null,e.from,a.from(r.payload),i,(t,r)=>{t?console.error("Error verifying signature from peer "+e.from+". Discarding message.",t):r?n():console.error("Invalid signature from peer "+e.from+". Discarding message.")})}else n()};if(this._room.hasPeer(e.from))r();else{const t=n=>{n===e.from&&(this._room.removeListener("peer joined",t),r())};this._room.on("peer joined",t)}}),this._room.on("peer joined",e=>{this.roomEmitter.emit("peer joined",e),this.userJoined(e,"master")}),this._room.on("peer left",e=>{this.roomEmitter.emit("peer left",e),this.userLeft(e)}),this.ipfs.isOnline()?this._start():this.ipfs.once("ready",this._start.bind(this))}_queueReceiveMessage(e,t){this._receiveQueue.push({from:e,message:t})}_processQueue(e,t){const r=e.from,n=e.message;r===this._ipfsUserId?t():this._room.hasPeer(r)?(this.receiveMessage(r,n),t()):(this._receiveQueue.unshift(e),setTimeout(t,500))}_start(){const e=this.ipfs._peerInfo.id.toB58String();this._ipfsUserId=e,this.setUserId(e)}disconnect(){n("disconnect"),this._room.leave(),super.disconnect()}send(e,t){this._encodeMessage(t,(r,n)=>{if(r)throw r;this._yConnectorOptions.encode&&(n=this._yConnectorOptions.encode(n)),this._room.sendTo(e,n),this.roomEmitter.emit("sent message",e,t)})}broadcast(e){this._encodeMessage(e,(t,r)=>{if(t)throw t;this._yConnectorOptions.encode&&(r=this._yConnectorOptions.encode(r)),this._room.broadcast(r),this.roomEmitter.emit("sent message","broadcast",e)})}isDisconnected(){return!1}_encodeMessage(e,t){const r=l(e);this._yConnectorOptions.sign?this._yConnectorOptions.sign(a.from(r),(e,n)=>{if(e)return t(e);const i=n.toString("base64");t(null,u({signature:i,payload:r}))}):t(null,u({payload:r}))}}e.extend("ipfs",t)}function l(e){return JSON.stringify(e)}e.exports=f,"undefined"!=typeof Y&&f(Y)},function(e,t,r){"use strict";(function(t){const n=r(1448),i=r(10),o=r(1450),s=r(593),a=r(594),u=r(1452),c=r(595),f=r(1454),l={pollInterval:1e3};e.exports=((e,t,r)=>new h(e,t,r));class h extends i{constructor(e,t,r){if(super(),this._ipfs=e,this._topic=t,this._options=Object.assign({},s(l),s(r)),this._peers=[],this._connections={},this._handleDirectMessage=this._handleDirectMessage.bind(this),!this._ipfs.pubsub)throw new Error("This IPFS node does not have pubsub.");this._ipfs.isOnline()?this._start():this._ipfs.on("ready",this._start.bind(this)),this._ipfs.on("stop",this.leave.bind(this))}getPeers(){return this._peers.slice(0)}hasPeer(e){return this._peers.indexOf(e)>=0}leave(){return new Promise((e,t)=>{o.clearInterval(this._interval),Object.keys(this._connections).forEach(e=>{this._connections[e].stop()}),f.emitter.removeListener(this._topic,this._handleDirectMessage),this.once("stopped",()=>e()),this.emit("stopping")})}broadcast(e){let t=c(e);this._ipfs.pubsub.publish(this._topic,t,e=>{e&&this.emit("error",e)})}sendTo(e,r){let n=this._connections[e];n||(n=new u(e,this._ipfs,this),n.on("error",e=>this.emit("error",e)),this._connections[e]=n,n.once("disconnect",()=>{delete this._connections[e],this._peers=this._peers.filter(t=>t!==e),this.emit("peer left",e)}));const i=t.from([0]),o={to:e,from:this._ipfs._peerInfo.id.toB58String(),data:t.from(r).toString("hex"),seqno:i.toString("hex"),topicIDs:[this._topic],topicCIDs:[this._topic]};n.push(t.from(JSON.stringify(o)))}_start(){this._interval=o.setInterval(this._pollPeers.bind(this),this._options.pollInterval);const e=this._onMessage.bind(this);this._ipfs.pubsub.subscribe(this._topic,e,{},e=>{e?this.emit("error",e):this.emit("subscribed",this._topic)}),this.once("stopping",()=>{this._ipfs.pubsub.unsubscribe(this._topic,e,e=>{e?this.emit("error",e):this.emit("stopped")})}),this._ipfs._libp2pNode.handle(a,f.handler),f.emitter.on(this._topic,this._handleDirectMessage)}_pollPeers(){this._ipfs.pubsub.peers(this._topic,(e,t)=>{if(e)return void this.emit("error",e);const r=t.sort();this._emitChanges(r)&&(this._peers=r)})}_emitChanges(e){const t=n(this._peers,e);return t.added.forEach(e=>this.emit("peer joined",e)),t.removed.forEach(e=>this.emit("peer left",e)),t.added.length>0||t.removed.length>0}_onMessage(e){this.emit("message",e)}_handleDirectMessage(e){if(e.to===this._ipfs._peerInfo.id.toB58String()){const t=Object.assign({},e);delete t.to,this.emit("message",t)}}}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";const n=r(593),i=r(1)("hyperdiff"),o=r(1449),s=e=>-1!==e;function a(){return{common:[],removed:[]}}function u(e,t,r){return r.every(r=>t[r]===e[r])}function c(e,t){return e.indexOf(t)}function f(e,t,r){return e.findIndex(function(e){return u(e,t,r)})}function l(e,t){return{first:e,second:n(t)}}function h(e,t){return t?f:c}function p(e,t,r){const n=r?[].concat(r):[],{first:a,second:u}=l(e,t),c=h(n,r);i("preconditions first=%j second=%j findIndex=%s",a,u,c.name);const f=a.reduce(function(e,t,r){const a=c(u,t,n),f=s(a)?"common":"removed";return e[f].push(t),o(u,a),i("index=%s value=%s collection=%s",r,t,f),e},{common:[],removed:[]});return f.added=u,i("added=%j removed=%j common%j",f.added,f.removed,f.common),f}e.exports=p},function(e,t,r){(function(t){var r="Expected a function",n="__lodash_hash_undefined__",i=1/0,o=9007199254740991,s="[object Arguments]",a="[object Function]",u="[object GeneratorFunction]",c="[object Symbol]",f=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,l=/^\w*$/,h=/^\./,p=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,d=/[\\^$.*+?()[\]{}|]/g,y=/\\(\\)?/g,g=/^\[object .+?Constructor\]$/,m=/^(?:0|[1-9]\d*)$/,b="object"==typeof t&&t&&t.Object===Object&&t,v="object"==typeof self&&self&&self.Object===Object&&self,_=b||v||Function("return this")();function w(e,t,r){switch(r.length){case 0:return e.call(t);case 1:return e.call(t,r[0]);case 2:return e.call(t,r[0],r[1]);case 3:return e.call(t,r[0],r[1],r[2])}return e.apply(t,r)}function S(e,t){for(var r=-1,n=e?e.length:0,i=Array(n);++r<n;)i[r]=t(e[r],r,e);return i}function k(e,t){for(var r=-1,n=t.length,i=e.length;++r<n;)e[i+r]=t[r];return e}function E(e,t){return null==e?void 0:e[t]}function A(e){var t=!1;if(null!=e&&"function"!=typeof e.toString)try{t=!!(e+"")}catch(e){}return t}var x=Array.prototype,I=Function.prototype,T=Object.prototype,B=_["__core-js_shared__"],C=(P=/[^.]+$/.exec(B&&B.keys&&B.keys.IE_PROTO||""),P?"Symbol(src)_1."+P:""),P,O=I.toString,R=T.hasOwnProperty,N=T.toString,L=RegExp("^"+O.call(R).replace(d,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),j=_.Symbol,M=T.propertyIsEnumerable,K=x.splice,D=j?j.isConcatSpreadable:void 0,U=Math.max,F=we(_,"Map"),q=we(Object,"create"),H=j?j.prototype:void 0,z=H?H.toString:void 0;function V(e){var t=-1,r=e?e.length:0;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}function G(){this.__data__=q?q(null):{}}function W(e){return this.has(e)&&delete this.__data__[e]}function $(e){var t=this.__data__;if(q){var r=t[e];return r===n?void 0:r}return R.call(t,e)?t[e]:void 0}function Y(e){var t=this.__data__;return q?void 0!==t[e]:R.call(t,e)}function J(e,t){var r=this.__data__;return r[e]=q&&void 0===t?n:t,this}function X(e){var t=-1,r=e?e.length:0;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}function Z(){this.__data__=[]}function Q(e){var t=this.__data__,r=ce(t,e);if(r<0)return!1;var n=t.length-1;return r==n?t.pop():K.call(t,r,1),!0}function ee(e){var t=this.__data__,r=ce(t,e);return r<0?void 0:t[r][1]}function te(e){return ce(this.__data__,e)>-1}function re(e,t){var r=this.__data__,n=ce(r,e);return n<0?r.push([e,t]):r[n][1]=t,this}function ne(e){var t=-1,r=e?e.length:0;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}function ie(){this.__data__={hash:new V,map:new(F||X),string:new V}}function oe(e){return _e(this,e).delete(e)}function se(e){return _e(this,e).get(e)}function ae(e){return _e(this,e).has(e)}function ue(e,t){return _e(this,e).set(e,t),this}function ce(e,t){for(var r=e.length;r--;)if(Ne(e[r][0],t))return r;return-1}function fe(e,t){for(var r=-1,n=null==e,i=t.length,o=Array(i);++r<i;)o[r]=n?void 0:Ve(e,t[r]);return o}function le(e,t,r,n,i){var o=-1,s=e.length;for(r||(r=Se),i||(i=[]);++o<s;){var a=e[o];t>0&&r(a)?t>1?le(a,t-1,r,n,i):k(i,a):n||(i[i.length]=a)}return i}function he(e,t){t=Ee(t,e)?[t]:be(t);for(var r=0,n=t.length;null!=e&&r<n;)e=e[Be(t[r++])];return r&&r==n?e:void 0}function pe(e){if(!Fe(e)||xe(e))return!1;var t=De(e)||A(e)?L:g;return t.test(Ce(e))}function de(e,t){for(var r=e?t.length:0,n=r-1;r--;){var i=t[r];if(r==n||i!==o){var o=i;if(ke(i))K.call(e,i,1);else if(Ee(i,e))delete e[Be(i)];else{var s=be(i),a=Ie(e,s);null!=a&&delete a[Be(Pe(s))]}}}return e}function ye(e,t){return t=U(void 0===t?e.length-1:t,0),function(){for(var r=arguments,n=-1,i=U(r.length-t,0),o=Array(i);++n<i;)o[n]=r[t+n];n=-1;for(var s=Array(t+1);++n<t;)s[n]=r[n];return s[t]=o,w(e,this,s)}}function ge(e,t,r){var n=-1,i=e.length;t<0&&(t=-t>i?0:i+t),r=r>i?i:r,r<0&&(r+=i),i=t>r?0:r-t>>>0,t>>>=0;for(var o=Array(i);++n<i;)o[n]=e[n+t];return o}function me(e){if("string"==typeof e)return e;if(He(e))return z?z.call(e):"";var t=e+"";return"0"==t&&1/e==-i?"-0":t}function be(e){return je(e)?e:Te(e)}function ve(e,t){if(e!==t){var r=void 0!==e,n=null===e,i=e==e,o=He(e),s=void 0!==t,a=null===t,u=t==t,c=He(t);if(!a&&!c&&!o&&e>t||o&&s&&u&&!a&&!c||n&&s&&u||!r&&u||!i)return 1;if(!n&&!o&&!c&&e<t||c&&r&&i&&!n&&!o||a&&r&&i||!s&&i||!u)return-1}return 0}function _e(e,t){var r=e.__data__;return Ae(t)?r["string"==typeof t?"string":"hash"]:r.map}function we(e,t){var r=E(e,t);return pe(r)?r:void 0}function Se(e){return je(e)||Le(e)||!!(D&&e&&e[D])}function ke(e,t){return t=null==t?o:t,!!t&&("number"==typeof e||m.test(e))&&e>-1&&e%1==0&&e<t}function Ee(e,t){if(je(e))return!1;var r=typeof e;return!("number"!=r&&"symbol"!=r&&"boolean"!=r&&null!=e&&!He(e))||(l.test(e)||!f.test(e)||null!=t&&e in Object(t))}function Ae(e){var t=typeof e;return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e}function xe(e){return!!C&&C in e}function Ie(e,t){return 1==t.length?e:he(e,ge(t,0,-1))}V.prototype.clear=G,V.prototype.delete=W,V.prototype.get=$,V.prototype.has=Y,V.prototype.set=J,X.prototype.clear=Z,X.prototype.delete=Q,X.prototype.get=ee,X.prototype.has=te,X.prototype.set=re,ne.prototype.clear=ie,ne.prototype.delete=oe,ne.prototype.get=se,ne.prototype.has=ae,ne.prototype.set=ue;var Te=Re(function(e){e=ze(e);var t=[];return h.test(e)&&t.push(""),e.replace(p,function(e,r,n,i){t.push(n?i.replace(y,"$1"):r||e)}),t});function Be(e){if("string"==typeof e||He(e))return e;var t=e+"";return"0"==t&&1/e==-i?"-0":t}function Ce(e){if(null!=e){try{return O.call(e)}catch(e){}try{return e+""}catch(e){}}return""}function Pe(e){var t=e?e.length:0;return t?e[t-1]:void 0}var Oe=ye(function(e,t){t=le(t,1);var r=e?e.length:0,n=fe(e,t);return de(e,S(t,function(e){return ke(e,r)?+e:e}).sort(ve)),n});function Re(e,t){if("function"!=typeof e||t&&"function"!=typeof t)throw new TypeError(r);var n=function(){var r=arguments,i=t?t.apply(this,r):r[0],o=n.cache;if(o.has(i))return o.get(i);var s=e.apply(this,r);return n.cache=o.set(i,s),s};return n.cache=new(Re.Cache||ne),n}function Ne(e,t){return e===t||e!=e&&t!=t}function Le(e){return Ke(e)&&R.call(e,"callee")&&(!M.call(e,"callee")||N.call(e)==s)}Re.Cache=ne;var je=Array.isArray;function Me(e){return null!=e&&Ue(e.length)&&!De(e)}function Ke(e){return qe(e)&&Me(e)}function De(e){var t=Fe(e)?N.call(e):"";return t==a||t==u}function Ue(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=o}function Fe(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function qe(e){return!!e&&"object"==typeof e}function He(e){return"symbol"==typeof e||qe(e)&&N.call(e)==c}function ze(e){return null==e?"":me(e)}function Ve(e,t,r){var n=null==e?void 0:he(e,t);return void 0===n?r:n}e.exports=Oe}).call(this,r(7))},function(e,t,r){(function(e){var n=void 0!==e&&e||"undefined"!=typeof self&&self||window,i=Function.prototype.apply;function o(e,t){this._id=e,this._clearFn=t}t.setTimeout=function(){return new o(i.call(setTimeout,n,arguments),clearTimeout)},t.setInterval=function(){return new o(i.call(setInterval,n,arguments),clearInterval)},t.clearTimeout=t.clearInterval=function(e){e&&e.close()},o.prototype.unref=o.prototype.ref=function(){},o.prototype.close=function(){this._clearFn.call(n,this._id)},t.enroll=function(e,t){clearTimeout(e._idleTimeoutId),e._idleTimeout=t},t.unenroll=function(e){clearTimeout(e._idleTimeoutId),e._idleTimeout=-1},t._unrefActive=t.active=function(e){clearTimeout(e._idleTimeoutId);var t=e._idleTimeout;t>=0&&(e._idleTimeoutId=setTimeout(function t(){e._onTimeout&&e._onTimeout()},t))},r(1451),t.setImmediate="undefined"!=typeof self&&self.setImmediate||void 0!==e&&e.setImmediate||this&&this.setImmediate,t.clearImmediate="undefined"!=typeof self&&self.clearImmediate||void 0!==e&&e.clearImmediate||this&&this.clearImmediate}).call(this,r(7))},function(e,t,r){(function(e,t){!function(e,r){"use strict";if(!e.setImmediate){var n=1,i={},o=!1,s=e.document,a,u=Object.getPrototypeOf&&Object.getPrototypeOf(e);u=u&&u.setTimeout?u:e,"[object process]"==={}.toString.call(e.process)?p():d()?y():e.MessageChannel?g():s&&"onreadystatechange"in s.createElement("script")?m():b(),u.setImmediate=c,u.clearImmediate=f}function c(e){"function"!=typeof e&&(e=new Function(""+e));for(var t=new Array(arguments.length-1),r=0;r<t.length;r++)t[r]=arguments[r+1];var o={callback:e,args:t};return i[n]=o,a(n),n++}function f(e){delete i[e]}function l(e){var t=e.callback,n=e.args;switch(n.length){case 0:t();break;case 1:t(n[0]);break;case 2:t(n[0],n[1]);break;case 3:t(n[0],n[1],n[2]);break;default:t.apply(r,n)}}function h(e){if(o)setTimeout(h,0,e);else{var t=i[e];if(t){o=!0;try{l(t)}finally{f(e),o=!1}}}}function p(){a=function(e){t.nextTick(function(){h(e)})}}function d(){if(e.postMessage&&!e.importScripts){var t=!0,r=e.onmessage;return e.onmessage=function(){t=!1},e.postMessage("","*"),e.onmessage=r,t}}function y(){var t="setImmediate$"+Math.random()+"$",r=function(r){r.source===e&&"string"==typeof r.data&&0===r.data.indexOf(t)&&h(+r.data.slice(t.length))};e.addEventListener?e.addEventListener("message",r,!1):e.attachEvent("onmessage",r),a=function(r){e.postMessage(t+r,"*")}}function g(){var e=new MessageChannel;e.port1.onmessage=function(e){var t=e.data;h(t)},a=function(t){e.port2.postMessage(t)}}function m(){var e=s.documentElement;a=function(t){var r=s.createElement("script");r.onreadystatechange=function(){h(t),r.onreadystatechange=null,e.removeChild(r),r=null},e.appendChild(r)}}function b(){a=function(e){setTimeout(h,0,e)}}}("undefined"==typeof self?void 0===e?this:e:self)}).call(this,r(7),r(6))},function(e,t,r){"use strict";const n=r(10),i=r(8),o=r(43),s=r(594),a=r(595),u=r(1453);e.exports=class e extends n{constructor(e,t,r){super(),this._id=e,this._ipfs=t,this._room=r,this._connection=null,this._connecting=!1}push(e){this._connection?this._connection.push(a(e)):(this.once("connect",()=>this.push(e)),this._connecting||this._getConnection())}stop(){this._connection&&this._connection.end()}_getConnection(){this._connecting=!0,this._getPeerAddresses(this._id,(e,t)=>{e?this.emit("error",e):t.length?this._ipfs._libp2pNode.dialProtocol(t[0],s,(e,t)=>{if(e)return void this.emit("disconnect");this._connecting=!1;const r=o();this._connection=r,i(r,t,i.onEnd(()=>{delete this._connection,this.emit("disconnect")})),this.emit("connect",r)}):this.emit("disconnect")})}_getPeerAddresses(e,t){this._ipfs.swarm.peers((r,n)=>{r?t(r):t(null,n.filter(t=>u(t.peer)===e).map(e=>e.peer))})}}},function(e,t,r){"use strict";e.exports=(e=>(e.id&&"function"==typeof e.id.toB58String&&(e=e.id),e.toB58String()))},function(e,t,r){"use strict";(function(n){const i=r(8),o=r(10),s=new o;function a(e,t){t.getPeerInfo((e,r)=>{if(e)return void console.log(e);const o=r.id.toB58String();i(t,i.map(e=>{let t;try{t=JSON.parse(e.toString())}catch(e){return void s.emit("warning",e.message)}if(o!==t.from)return void s.emit("warning","no peerid match "+t.from);const r=t.topicIDs;if(Array.isArray(r))return t.data=n.from(t.data,"hex"),t.seqno=n.from(t.seqno,"hex"),r.forEach(e=>{s.emit(e,t)}),t;s.emit("warning","no topic IDs")}),i.onEnd(()=>{}))})}t=e.exports={handler:a,emitter:s}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(t){e.exports=(e=>t.from(JSON.stringify(e)))}).call(this,r(0).Buffer)},function(e,t,r){"use strict";e.exports=(e=>{const t=e.toString();let r;try{r=JSON.parse(t)}catch(e){throw console.error("Failed parsing",t),e}return r})},function(e,t,r){"use strict";function n(e){return e?(e^16*Math.random()>>e/4).toString(16):([1e7]+-1e3+-4e3+-8e3+-1e11).replace(/[018]/g,n)}function i(e){e.requestModules(["memory"]).then(function(){class t{constructor(e,t){this.store=e.objectStore(t)}*find(e){return yield this.store.get(e)}*put(e){yield this.store.put(e)}*delete(e){yield this.store.delete(e)}*findWithLowerBound(e){return yield this.store.openCursor(IDBKeyRange.lowerBound(e))}*findWithUpperBound(e){return yield this.store.openCursor(IDBKeyRange.upperBound(e),"prev")}*findNext(e){return yield*this.findWithLowerBound([e[0],e[1]+1])}*findPrev(e){return yield*this.findWithUpperBound([e[0],e[1]-1])}*iterate(e,t,r,n){var i=null,o;for(null!=t&&null!=r?i=IDBKeyRange.bound(t,r):null!=t?i=IDBKeyRange.lowerBound(t):null!=r&&(i=IDBKeyRange.upperBound(r)),o=null!=i?this.store.openCursor(i):this.store.openCursor();null!=(yield o);)yield*n.call(e,o.result.value),o.result.continue()}*flush(){}}function r(e){class t extends e{constructor(){super(...arguments),this.buffer=[],this._copyTo=null}copyTo(e){return this._copyTo=e,this}*put(e,t){t||this.buffer.push(this._copyTo.put(e)),yield*super.put(e)}*delete(e){this.buffer.push(this._copyTo.delete(e)),yield*super.delete(e)}*flush(){yield*super.flush();for(var e=0;e<this.buffer.length;e++)yield*this.buffer[e];yield*this._copyTo.flush()}}return t}e.utils.createStoreClone=r;var i=e.utils.createSmallLookupBuffer(t);class o extends e.Transaction{constructor(e){super(e);var t=e.db.transaction(["OperationStore","StateStore","DeleteStore"],"readwrite");this.store=e,this.ss=new i(t,"StateStore"),this.os=new i(t,"OperationStore"),this.ds=new i(t,"DeleteStore")}}class s extends e.AbstractDatabase{constructor(t,r){if(null==r.gc&&(r.gc=!1),super(t,r),null==r&&(r={}),this.options=r,null==r.namespace){if(null==t.options.connector.room)throw new Error("IndexedDB: expect a string (options.namespace)! (you can also skip this step if your connector has a room property)");r.namespace=t.options.connector.room}null!=r.idbVersion?this.idbVersion=r.idbVersion:this.idbVersion=5;var i=this;this.requestTransaction(function*(){i.db=yield indexedDB.open(r.namespace,i.idbVersion)}),r.cleanStart&&("undefined"!=typeof localStorage&&delete localStorage[JSON.stringify(["Yjs_indexeddb",r.namespace])],this.requestTransaction(function*(){yield this.os.store.clear(),yield this.ds.store.clear(),yield this.ss.store.clear()})),this.whenUserIdSet(function(e){"undefined"!=typeof localStorage&&null==localStorage[JSON.stringify(["Yjs_indexeddb",r.namespace])]&&(localStorage[JSON.stringify(["Yjs_indexeddb",r.namespace])]=JSON.stringify([e,0]))}),this.requestTransaction(function*(){var e=null;if("undefined"!=typeof localStorage&&(e=localStorage[JSON.stringify(["Yjs_indexeddb",r.namespace])]),null!=e){if(i.setUserId(e),"undefined"!=typeof localStorage){var t=JSON.parse(e);t[1]=t[1]+1,localStorage[JSON.stringify(["Yjs_indexeddb",r.namespace])]=JSON.stringify(t)}}else setTimeout(function(){null==i.userId&&i.setUserId(n())},200)});var o=[];this.communicationObserver=function(t){o.push(t),1===o.length&&i.requestTransaction(function*(){for(var t=[],r=0;r<o.length;r++){var n=o[r];(null==n.parent||o.every(function(t){return!e.utils.compareIds(t.id,n.parent)}))&&t.push(n)}for(o=[],r=0;r<t.length;r++)yield*this.store.operationAdded(this,t[r],!0)})},e.utils.localCommunication.addObserver(this.options.namespace,this.communicationObserver)}*operationAdded(t,r,n){yield*super.operationAdded(t,r),n||e.utils.localCommunication.broadcast(this.options.namespace,r)}transact(e){var t=null!=this.db?new o(this):null,r=this,n=e.call(t);function i(s){var a=s.value;if(s.done)return e=r.getNextRequest(),void(null!=e&&(null==t&&null!=r.db&&(t=new o(r)),n=e.call(t),i(n.next())));a.constructor===IDBRequest?(a.onsuccess=function(){var e=a.result;null!=e&&e.constructor===IDBCursorWithValue&&(e=e.value),i(n.next(e))},a.onerror=function(e){n.throw(e)}):a.constructor===IDBCursor?(a.onsuccess=function(){i(n.next(null!=a.result?a.result.value:null))},a.onerror=function(e){n.throw(e)}):a.constructor===IDBOpenDBRequest?(a.onsuccess=function(e){var t=e.target.result;i(n.next(t))},a.onerror=function(){n.throw("Couldn't open IndexedDB database!")},a.onupgradeneeded=function(e){var t=e.target.result;"undefined"!=typeof localStorage&&delete localStorage[JSON.stringify(["Yjs_indexeddb",r.options.namespace])],t.objectStoreNames.contains("OperationStore")&&(t.deleteObjectStore("OperationStore"),t.deleteObjectStore("DeleteStore"),t.deleteObjectStore("StateStore")),t.createObjectStore("OperationStore",{keyPath:"id"}),t.createObjectStore("DeleteStore",{keyPath:"id"}),t.createObjectStore("StateStore",{keyPath:"id"})}):n.throw("You must not yield this type!")}i(n.next())}*destroy(){this.db.close()}deleteDB(){return e.utils.localCommunication.removeObserver(this.options.namespace,this.communicationObserver),indexedDB.deleteDatabase(this.options.namespace),Promise.resolve()}}null==e.utils.localCommunication&&(e.utils.localCommunication={observer:{},addObserver:function(e,t){var r=this.observer[e];null==r&&(r=[],this.observer[e]=r),r.push(t)},removeObserver:function(e,t){this.observer[e]=this.observer[e].filter(function(e){return t!==e})},broadcast:function(e,t){"undefined"!=typeof localStorage&&localStorage.setItem(JSON.stringify(["__YJS__",e]),JSON.stringify(t)),this.observer[e].map(function(e){e(t)})}},"undefined"!=typeof localStorage&&addEventListener("storage",function(t){var r;try{var n=JSON.parse(t.key);if("__YJS__"!==n[0])return;r=n[1]}catch(e){return}var i=e.utils.localCommunication.observer[r];null!=i&&i.map(function(e){e(JSON.parse(t.newValue))})})),e.extend("indexeddb",s)})}e.exports=i,"undefined"!=typeof Y&&i(Y)},function(e,t,r){(function(n){const i=r(1459),o=r(21),s=r(36),a=r(1)("dweb-transports:webtorrent"),u=r(81),c=r(118),f=r(103);let l={};class h extends c{constructor(e){super(e),this.webtorrent=void 0,this.options=e,this.name="WEBTORRENT",this.supportURLs=["magnet"],this.supportFunctions=["fetch","createReadStream"],this.status=c.STATUS_LOADED}p_webtorrentstart(){let e=this;return new Promise((e,t)=>{this.webtorrent=new i(this.options),this.webtorrent.once("ready",()=>{a("ready"),e()}),this.webtorrent.once("error",e=>t(e)),this.webtorrent.on("warning",e=>{console.warn("WebTorrent Torrent WARNING: "+e.message)})})}static setup0(e){let t=c.mergeoptions(l,e.webtorrent);a("setup0: options=%o",t);let r=new h(t);return f.addtransport(r),r}async p_setup1(e){try{this.status=c.STATUS_STARTING,e&&e(this),await this.p_webtorrentstart(),await this.p_status()}catch(e){console.error(this.name,"failed to connect",e.message),this.status=c.STATUS_FAILED}return e&&e(this),this}async p_status(){return this.webtorrent&&this.webtorrent.ready?this.status=c.STATUS_CONNECTED:this.webtorrent?this.status=c.STATUS_STARTING:this.status=c.STATUS_FAILED,super.p_status()}webtorrentparseurl(e){if(!e)throw new u.CodingError("TransportWEBTORRENT.p_rawfetch: requires url");const t="string"==typeof e?e:e.href,r=t.indexOf("/");if(-1===r)throw new u.CodingError("TransportWEBTORRENT.p_rawfetch: invalid url - missing path component. Should look like magnet:xyzabc/path/to/file");const n=t.slice(0,r),i=t.slice(r+1);return{torrentId:n,path:i}}async p_webtorrentadd(e){return new Promise((t,r)=>{let n=this.webtorrent.get(e);n||(n=this.webtorrent.add(e),n.once("error",e=>{r(new u.TransportError("Torrent encountered a fatal error "+e.message))}),n.on("warning",e=>{console.warn("WebTorrent Torrent WARNING: "+e.message+" ("+n.name+")")})),n.ready?t(n):n.once("ready",()=>{t(n)})})}webtorrentfindfile(e,t){const r=e.name+"/"+t,n=e.files.find(e=>e.path===r);if(!n)throw new u.TransportError("Requested file ("+t+") not found within torrent ");return n}p_rawfetch(e){return new Promise((t,r)=>{const{torrentId:n,path:i}=this.webtorrentparseurl(e);this.p_webtorrentadd(n).then(e=>{e.deselect(0,e.pieces.length-1,!1);const n=this.webtorrentfindfile(e,i);n.getBuffer((n,i)=>{if(n)return r(new u.TransportError("Torrent encountered a fatal error "+n.message+" ("+e.name+")"));t(i)})}).catch(e=>r(e))})}async _p_fileTorrentFromUrl(e){try{const{torrentId:t,path:r}=this.webtorrentparseurl(e),n=await this.p_webtorrentadd(t);n.deselect(0,n.pieces.length-1,!1);const i=this.webtorrentfindfile(n,r);return"undefined"!=typeof window&&(window.WEBTORRENT_TORRENT=n,window.WEBTORRENT_FILE=i,n.once("close",()=>{window.WEBTORRENT_TORRENT=null,window.WEBTORRENT_FILE=null})),i}catch(e){throw e}}async p_f_createReadStream(e,{wanturl:t=!1}={}){try{let r=await this._p_fileTorrentFromUrl(e),n=this;return t?e:function(e){return n.createReadStream(r,e)}}catch(e){throw e}}createReadStream(e,t){let r;a("reading from stream %s %o",e.name,t);try{r=new o.PassThrough;const n=e.createReadStream(t);return n.pipe(r),r}catch(e){a("createReadStream error %s",e),"function"==typeof r.destroy?r.destroy(e):r.emit("error",e)}}async p_createReadableStream(e,t){let r=await this._p_fileTorrentFromUrl(e);return new ReadableStream({start(n){a("start %s %o",e,t);const i=r.createReadStream(t);i.on("data",e=>{n.enqueue(e)}),i.on("end",()=>{n.close()})},cancel(r){throw new u.TransportError(`cancelled ${e}, ${t} ${r}`)}})}static async p_test(e){try{let r=await this.p_setup(e);console.log(r.name,"p_test setup",e,"complete");let i=await r.p_status();console.assert(i===c.STATUS_CONNECTED);let o="magnet:?xt=urn:btih:dd8255ecdc7ca55fb0bbf81323d87062db1f6d1c&dn=Big+Buck+Bunny&tr=udp%3A%2F%2Fexplodie.org%3A6969&tr=udp%3A%2F%2Ftracker.coppersurfer.tk%3A6969&tr=udp%3A%2F%2Ftracker.empire-js.us%3A1337&tr=udp%3A%2F%2Ftracker.leechers-paradise.org%3A6969&tr=udp%3A%2F%2Ftracker.opentrackr.org%3A1337&tr=wss%3A%2F%2Ftracker.btorrent.xyz&tr=wss%3A%2F%2Ftracker.fastcast.nz&tr=wss%3A%2F%2Ftracker.openwebtorrent.com&ws=https%3A%2F%2Fwebtorrent.io%2Ftorrents%2F&xs=https%3A%2F%2Fwebtorrent.io%2Ftorrents%2Fbig-buck-bunny.torrent/Big Buck Bunny.en.srt",s=await r.p_rawfetch(o);s=s.toString(),t(s);const a=await r.createReadStream(o),u=[];function t(e){let t="00:00:02,000 --\x3e 00:00:05,000";console.assert(-1!==e.indexOf(t),"Should fetch 'Big Buck Bunny.en.srt' from the torrent"),console.assert(e.length,129,"'Big Buck Bunny.en.srt' was "+e.length)}a.on("data",e=>{u.push(e)}),a.on("end",()=>{const e=n.concat(u).toString();t(e)})}catch(e){throw console.log("Exception thrown in",r.name,"p_test():",e.message),e}}}f._transportclasses.WEBTORRENT=h,t=e.exports=h}).call(this,r(0).Buffer)},function(e,t,r){(function(t,n){e.exports=A;var i=r(2).Buffer,o=r(321),s=r(1460),a=r(1)("webtorrent"),u=r(1471),c=r(10).EventEmitter,f=r(27),l=r(4),h=r(1472),p=r(148),d=r(598),y=r(55),g=r(191),m=r(110),b=r(323),v=r(1481),_=r(1482),w=r(1483),S=r(325).version,k=S.match(/([0-9]+)/g).slice(0,2).map(function(e){return v(2,e)}).join(""),E="-WW"+k+"-";function A(e){var r=this;if(!(r instanceof A))return new A(e);function o(){r.destroyed||(r.ready=!0,r.emit("ready"))}c.call(r),e||(e={}),"string"==typeof e.peerId?r.peerId=e.peerId:i.isBuffer(e.peerId)?r.peerId=e.peerId.toString("hex"):r.peerId=i.from(E+m(9).toString("base64")).toString("hex"),r.peerIdBuffer=i.from(r.peerId,"hex"),"string"==typeof e.nodeId?r.nodeId=e.nodeId:i.isBuffer(e.nodeId)?r.nodeId=e.nodeId.toString("hex"):r.nodeId=m(20).toString("hex"),r.nodeIdBuffer=i.from(r.nodeId,"hex"),r._debugId=r.peerId.toString("hex").substring(0,7),r.destroyed=!1,r.listening=!1,r.torrentPort=e.torrentPort||0,r.dhtPort=e.dhtPort||0,r.tracker=void 0!==e.tracker?e.tracker:{},r.torrents=[],r.maxConns=Number(e.maxConns)||55,r._debug("new webtorrent (peerId %s, nodeId %s, port %s)",r.peerId,r.nodeId,r.torrentPort),r.tracker&&("object"!=typeof r.tracker&&(r.tracker={}),e.rtcConfig&&(console.warn("WebTorrent: opts.rtcConfig is deprecated. Use opts.tracker.rtcConfig instead"),r.tracker.rtcConfig=e.rtcConfig),e.wrtc&&(console.warn("WebTorrent: opts.wrtc is deprecated. Use opts.tracker.wrtc instead"),r.tracker.wrtc=e.wrtc),t.WRTC&&!r.tracker.wrtc&&(r.tracker.wrtc=t.WRTC)),"function"==typeof _?r._tcpPool=new _(r):n.nextTick(function(){r._onListening()}),r._downloadSpeed=b(),r._uploadSpeed=b(),!1!==e.dht&&"function"==typeof u?(r.dht=new u(f({nodeId:r.nodeId},e.dht)),r.dht.once("error",function(e){r._destroy(e)}),r.dht.once("listening",function(){var e=r.dht.address();e&&(r.dhtPort=e.port)}),r.dht.setMaxListeners(0),r.dht.listen(r.dhtPort)):r.dht=!1,r.enableWebSeeds=!1!==e.webSeeds,"function"==typeof h&&null!=e.blocklist?h(e.blocklist,{headers:{"user-agent":"WebTorrent/"+S+" (https://webtorrent.io)"}},function(e,t){if(e)return r.error("Failed to load blocklist: "+e.message);r.blocked=t,o()}):n.nextTick(o)}function x(e){return"object"==typeof e&&null!=e&&"function"==typeof e.pipe}function I(e){return"undefined"!=typeof FileList&&e instanceof FileList}l(A,c),A.WEBRTC_SUPPORT=g.WEBRTC_SUPPORT,A.VERSION=S,Object.defineProperty(A.prototype,"downloadSpeed",{get:function(){return this._downloadSpeed()}}),Object.defineProperty(A.prototype,"uploadSpeed",{get:function(){return this._uploadSpeed()}}),Object.defineProperty(A.prototype,"progress",{get:function(){var e=this.torrents.filter(function(e){return 1!==e.progress}),t=e.reduce(function(e,t){return e+t.downloaded},0),r=e.reduce(function(e,t){return e+(t.length||0)},0)||1;return t/r}}),Object.defineProperty(A.prototype,"ratio",{get:function(){var e=this.torrents.reduce(function(e,t){return e+t.uploaded},0),t=this.torrents.reduce(function(e,t){return e+t.received},0)||1;return e/t}}),A.prototype.get=function(e){var t=this,r,n,i=this.torrents.length;if(e instanceof w){for(r=0;r<i;r++)if(n=this.torrents[r],n===e)return n}else{var o;try{o=d(e)}catch(e){}if(!o)return null;if(!o.infoHash)throw new Error("Invalid torrent identifier");for(r=0;r<i;r++)if(n=this.torrents[r],n.infoHash===o.infoHash)return n}return null},A.prototype.download=function(e,t,r){return console.warn("WebTorrent: client.download() is deprecated. Use client.add() instead"),this.add(e,t,r)},A.prototype.add=function(e,t,r){var n=this;if(n.destroyed)throw new Error("client is destroyed");if("function"==typeof t)return n.add(e,null,t);n._debug("add"),t=t?f(t):{};var i=new w(e,n,t);function o(){if(!n.destroyed)for(var e=0,t=n.torrents.length;e<t;e++){var r=n.torrents[e];if(r.infoHash===i.infoHash&&r!==i)return void i._destroy(new Error("Cannot add duplicate torrent "+i.infoHash))}}function s(){n.destroyed||("function"==typeof r&&r(i),n.emit("torrent",i))}function a(){i.removeListener("_infoHash",o),i.removeListener("ready",s),i.removeListener("close",a)}return n.torrents.push(i),i.once("_infoHash",o),i.once("ready",s),i.once("close",a),i},A.prototype.seed=function(e,t,r){var n=this;if(n.destroyed)throw new Error("client is destroyed");if("function"==typeof t)return n.seed(e,null,t);n._debug("seed"),t=t?f(t):{},"string"==typeof e&&(t.path=y.dirname(e)),t.createdBy||(t.createdBy="WebTorrent/"+k);var i=n.add(null,t,u),a;function u(e){var t=[function(t){e.load(a,t)}];n.dht&&t.push(function(t){e.once("dhtAnnounce",t)}),p(t,function(t){if(!n.destroyed)return t?e._destroy(t):void c(e)})}function c(e){n._debug("on seed"),"function"==typeof r&&r(e),e.emit("seed"),n.emit("seed",e)}return I(e)&&(e=Array.prototype.slice.call(e)),Array.isArray(e)||(e=[e]),p(e.map(function(e){return function(t){x(e)?o(e,t):t(null,e)}}),function(e,r){if(!n.destroyed)return e?i._destroy(e):void s.parseInput(r,t,function(e,o){if(!n.destroyed){if(e)return i._destroy(e);a=o.map(function(e){return e.getStream}),s(r,t,function(e,t){if(!n.destroyed){if(e)return i._destroy(e);var r=n.get(t);r?i._destroy(new Error("Cannot add duplicate torrent "+r.infoHash)):i._onTorrentId(t)}})}})}),i},A.prototype.remove=function(e,t){this._debug("remove");var r=this.get(e);if(!r)throw new Error("No torrent with id "+e);this._remove(e,t)},A.prototype._remove=function(e,t){var r=this.get(e);r&&(this.torrents.splice(this.torrents.indexOf(r),1),r.destroy(t))},A.prototype.address=function(){return this.listening?this._tcpPool?this._tcpPool.server.address():{address:"0.0.0.0",family:"IPv4",port:0}:null},A.prototype.destroy=function(e){if(this.destroyed)throw new Error("client already destroyed");this._destroy(null,e)},A.prototype._destroy=function(e,t){var r=this;r._debug("client destroy"),r.destroyed=!0;var n=r.torrents.map(function(e){return function(t){e.destroy(t)}});r._tcpPool&&n.push(function(e){r._tcpPool.destroy(e)}),r.dht&&n.push(function(e){r.dht.destroy(e)}),p(n,t),e&&r.emit("error",e),r.torrents=[],r._tcpPool=null,r.dht=null},A.prototype._onListening=function(){if(this._debug("listening"),this.listening=!0,this._tcpPool){var e=this._tcpPool.server.address();e&&(this.torrentPort=e.port)}this.emit("listening")},A.prototype._debug=function(){var e=[].slice.call(arguments);e[0]="["+this._debugId+"] "+e[0],a.apply(null,e)}}).call(this,r(7),r(6))},function(e,t,r){(function(t,n,i){e.exports=_,e.exports.parseInput=w,e.exports.announceList=[["udp://tracker.leechers-paradise.org:6969"],["udp://tracker.coppersurfer.tk:6969"],["udp://tracker.opentrackr.org:1337"],["udp://explodie.org:6969"],["udp://tracker.empire-js.us:1337"],["wss://tracker.btorrent.xyz"],["wss://tracker.openwebtorrent.com"],["wss://tracker.fastcast.nz"]];var o=r(201),s=r(596),a=r(1464),u=r(55),c=r(27),f=r(1466),l=r(1467),h=r(97),p=r(1468),d=r(1469),y=r(597),g=r(35),m=r(148),b=r(149),v=r(21);function _(e,t,r){if("function"==typeof t)return _(e,null,t);t=t?c(t):{},S(e,t,function(e,n,i){if(e)return r(e);t.singleFileTorrent=i,T(n,t,r)})}function w(e,t,r){if("function"==typeof t)return w(e,null,t);t=t?c(t):{},S(e,t,r)}function S(e,r,i){if(P(e)&&(e=Array.prototype.slice.call(e)),Array.isArray(e)||(e=[e]),0===e.length)throw new Error("invalid input type");e.forEach(function(e){if(null==e)throw new Error("invalid input type: "+e)}),e=e.map(function(e){return C(e)&&"string"==typeof e.path&&"function"==typeof h.stat?e.path:e}),1!==e.length||"string"==typeof e[0]||e[0].name||(e[0].name=r.name);var o=null;e.forEach(function(t,r){if("string"!=typeof t){var n=t.fullPath||t.name;n||(n="Unknown File "+(r+1),t.unknownName=!0),t.path=n.split("/"),t.path[0]||t.path.shift(),t.path.length<2?o=null:0===r&&e.length>1?o=t.path[0]:t.path[0]!==o&&(o=null)}}),e=e.filter(function(e){if("string"==typeof e)return!0;var t=e.path[e.path.length-1];return x(t)&&d.not(t)}),o&&e.forEach(function(e){var r=(t.isBuffer(e)||O(e))&&!e.path;"string"==typeof e||r||e.path.shift()}),!r.name&&o&&(r.name=o),r.name||e.some(function(e){return"string"==typeof e?(r.name=u.basename(e),!0):e.unknownName?void 0:(r.name=e.path[e.path.length-1],!0)}),r.name||(r.name="Unnamed Torrent "+Date.now());var s=e.reduce(function(e,t){return e+Number("string"==typeof t)},0),a=1===e.length;if(1===e.length&&"string"==typeof e[0]){if("function"!=typeof h.stat)throw new Error("filesystem paths do not work in the browser");p(e[0],function(e,t){if(e)return i(e);a=t,c()})}else n.nextTick(function(){c()});function c(){m(e.map(function(e){return function(r){var n={};if(C(e))n.getStream=R(e),n.length=e.size;else if(t.isBuffer(e))n.getStream=N(e),n.length=e.length;else{if(!O(e)){if("string"==typeof e){if("function"!=typeof h.stat)throw new Error("filesystem paths do not work in the browser");var i=s>1||a;return void k(e,i,r)}throw new Error("invalid input type")}n.getStream=j(e,n),n.length=0}n.path=e.path,r(null,n)}}),function(e,t){if(e)return i(e);t=l(t),i(null,t,a)})}}function k(e,t,r){A(e,E,function(n,i){if(n)return r(n);i=Array.isArray(i)?l(i):[i],e=u.normalize(e),t&&(e=e.slice(0,e.lastIndexOf(u.sep)+1)),e[e.length-1]!==u.sep&&(e+=u.sep),i.forEach(function(t){t.getStream=L(t.path),t.path=t.path.replace(e,"").split(u.sep)}),r(null,i)})}function E(e,t){t=g(t),h.stat(e,function(r,n){if(r)return t(r);var i={length:n.size,path:e};t(null,i)})}function A(e,t,r){h.stat(e,function(n,i){if(n)return r(n);i.isDirectory()?h.readdir(e,function(n,i){if(n)return r(n);m(i.filter(x).filter(d.not).map(function(r){return function(n){A(u.join(e,r),t,n)}}),r)}):i.isFile()&&t(e,r)})}function x(e){return"."!==e[0]}function I(e,r,n){n=g(n);var i=[],o=0,a=e.map(function(e){return e.getStream}),u=0,c=0,f=!1,l=new y(a),h=new s(r,{zeroPadding:!1});function p(e){o+=e.length;var t=c;b(e,function(e){i[t]=e,u-=1,_()}),u+=1,c+=1}function d(){f=!0,_()}function m(e){v(),n(e)}function v(){l.removeListener("error",m),h.removeListener("data",p),h.removeListener("end",d),h.removeListener("error",m)}function _(){f&&0===u&&(v(),n(null,t.from(i.join(""),"hex"),o))}l.on("error",m),l.pipe(h).on("data",p).on("end",d).on("error",m)}function T(t,r,n){var s=r.announceList;s||("string"==typeof r.announce?s=[[r.announce]]:Array.isArray(r.announce)&&(s=r.announce.map(function(e){return[e]}))),s||(s=[]),i.WEBTORRENT_ANNOUNCE&&("string"==typeof i.WEBTORRENT_ANNOUNCE?s.push([[i.WEBTORRENT_ANNOUNCE]]):Array.isArray(i.WEBTORRENT_ANNOUNCE)&&(s=s.concat(i.WEBTORRENT_ANNOUNCE.map(function(e){return[e]})))),void 0===r.announce&&void 0===r.announceList&&(s=s.concat(e.exports.announceList)),"string"==typeof r.urlList&&(r.urlList=[r.urlList]);var u={info:{name:r.name},"creation date":Math.ceil((Number(r.creationDate)||Date.now())/1e3),encoding:"UTF-8"};0!==s.length&&(u.announce=s[0][0],u["announce-list"]=s),void 0!==r.comment&&(u.comment=r.comment),void 0!==r.createdBy&&(u["created by"]=r.createdBy),void 0!==r.private&&(u.info.private=Number(r.private)),void 0!==r.sslCert&&(u.info["ssl-cert"]=r.sslCert),void 0!==r.urlList&&(u["url-list"]=r.urlList);var c=r.pieceLength||a(t.reduce(B,0));u.info["piece length"]=c,I(t,c,function(e,i,s){if(e)return n(e);u.info.pieces=i,t.forEach(function(e){delete e.getStream}),r.singleFileTorrent?u.info.length=s:u.info.files=t,n(null,o.encode(u))})}function B(e,t){return e+t.length}function C(e){return"undefined"!=typeof Blob&&e instanceof Blob}function P(e){return"undefined"!=typeof FileList&&e instanceof FileList}function O(e){return"object"==typeof e&&null!=e&&"function"==typeof e.pipe}function R(e){return function(){return new f(e)}}function N(e){return function(){var t=new v.PassThrough;return t.end(e),t}}function L(e){return function(){return h.createReadStream(e)}}function j(e,t){return function(){var r=new v.Transform;return r._transform=function(e,r,n){t.length+=e.length,this.push(e),n()},e.pipe(r),r}}}).call(this,r(0).Buffer,r(6),r(7))},function(e,t,r){var n=r(2).Buffer;function i(e,t,r){var o=[],s=null;return i._encode(o,e),s=n.concat(o),i.bytes=s.length,n.isBuffer(t)?(s.copy(t,r),t):s}i.bytes=-1,i._floatConversionDetected=!1,i.getType=function(e){return n.isBuffer(e)?"buffer":Array.isArray(e)?"array":ArrayBuffer.isView(e)?"arraybufferview":e instanceof Number?"number":e instanceof Boolean?"boolean":e instanceof ArrayBuffer?"arraybuffer":typeof e},i._encode=function(e,t){if(null!=t)switch(i.getType(t)){case"buffer":i.buffer(e,t);break;case"object":i.dict(e,t);break;case"array":i.list(e,t);break;case"string":i.string(e,t);break;case"number":case"boolean":i.number(e,t);break;case"arraybufferview":i.buffer(e,n.from(t.buffer,t.byteOffset,t.byteLength));break;case"arraybuffer":i.buffer(e,n.from(t))}};var o=n.from("e"),s=n.from("d"),a=n.from("l");i.buffer=function(e,t){e.push(new n(t.length+":"),t)},i.string=function(e,t){e.push(n.from(n.byteLength(t)+":"+t))},i.number=function(e,t){var r=2147483648,o=t/r<<0,s=t%r<<0,a=o*r+s;e.push(n.from("i"+a+"e")),a===t||i._floatConversionDetected||(i._floatConversionDetected=!0,console.warn('WARNING: Possible data corruption detected with value "'+t+'":','Bencoding only defines support for integers, value was converted to "'+a+'"'),console.trace())},i.dict=function(e,t){e.push(s);for(var r=0,n,a=Object.keys(t).sort(),u=a.length;r<u;r++)n=a[r],null!=t[n]&&(i.string(e,n),i._encode(e,t[n]));e.push(o)},i.list=function(e,t){var r=0,n=t.length;for(e.push(a);r<n;r++)null!=t[r]&&i._encode(e,t[r]);e.push(o)},e.exports=i},function(e,t,r){(function(t){const r=105,n=58,i=100,o=108,s=101;function a(e,t,r){for(var n=0,i=1,o=t;o<r;o++){var s=e[o];if(s<58&&s>=48)n=10*n+(s-48);else if(o!==t||43!==s){if(o!==t||45!==s){if(46===s)break;throw new Error("not a number: buffer["+o+"] = "+s)}i=-1}}return n*i}function u(e,r,n,i){return null==e||0===e.length?null:("number"!=typeof r&&null==i&&(i=r,r=void 0),"number"!=typeof n&&null==i&&(i=n,n=void 0),u.position=0,u.encoding=i||null,u.data=t.isBuffer(e)?e.slice(r,n):new t(e),u.bytes=u.data.length,u.next())}u.bytes=0,u.position=0,u.data=null,u.encoding=null,u.next=function(){switch(u.data[u.position]){case 100:return u.dictionary();case 108:return u.list();case 105:return u.integer();default:return u.buffer()}},u.find=function(e){for(var t=u.position,r=u.data.length,n=u.data;t<r;){if(n[t]===e)return t;t++}throw new Error('Invalid data: Missing delimiter "'+String.fromCharCode(e)+'" [0x'+e.toString(16)+"]")},u.dictionary=function(){u.position++;for(var e={};101!==u.data[u.position];)e[u.buffer()]=u.next();return u.position++,e},u.list=function(){u.position++;for(var e=[];101!==u.data[u.position];)e.push(u.next());return u.position++,e},u.integer=function(){var e=u.find(101),t=a(u.data,u.position+1,e);return u.position+=e+1-u.position,t},u.buffer=function(){var e=u.find(58),t=a(u.data,u.position,e),r=++e+t;return u.position=r,u.encoding?u.data.toString(u.encoding,e,r):u.data.slice(e,r)},e.exports=u}).call(this,r(0).Buffer)},function(e,t){e.exports=function(){for(var e=0;e<arguments.length;e++)if(void 0!==arguments[e])return arguments[e]}},function(e,t,r){for(var n=r(1465),i=Math.pow(2,10),o=13,s=[];o++<22;)s.push(Math.pow(2,o));e.exports=function(e){return n(e/i,s)}},function(e,t){var r=Math.abs;function n(e,t,n){for(var i,o,s,a=1/0,u=0,c=t.length-1;u<=c&&(i=u+(c-u>>1),s=t[i]-e,s<0?u=i+1:s>0&&(c=i-1),s=r(s),s<a&&(a=s,o=i),t[i]!==e););return n?o:t[o]}e.exports=n},function(e,t,r){var n=r(21).Readable,i=r(4),o=/^.*\.(\w+)$/,s=r(585);function a(e,t){var r=this;if(!(this instanceof a))return new a(e,t);t=t||{},n.call(this,t),this._offset=0,this._ready=!1,this._file=e,this._size=e.size,this._chunkSize=t.chunkSize||Math.max(this._size/1e3,204800),this.reader=new FileReader,this._generateHeaderBlocks(e,t,function(e,t){if(e)return r.emit("error",e);Array.isArray(t)&&t.forEach(function(e){r.push(e)}),r._ready=!0,r.emit("_ready")})}i(a,n),e.exports=a,a.prototype._generateHeaderBlocks=function(e,t,r){r(null,[])},a.prototype._read=function(){if(this._ready){var e=this,t=this.reader,r=this._offset,n=this._offset+this._chunkSize;if(n>this._size&&(n=this._size),r===this._size)return this.destroy(),void this.push(null);t.onload=function(){e._offset=n,e.push(s(t.result))},t.onerror=function(){e.emit("error",t.error)},t.readAsArrayBuffer(this._file.slice(r,n))}else this.once("_ready",this._read.bind(this))},a.prototype.destroy=function(){if(this._file=null,this.reader){this.reader.onload=null,this.reader.onerror=null;try{this.reader.abort()}catch(e){}}this.reader=null}},function(e,t){e.exports=function e(t,r){return r="number"==typeof r?r:1/0,r?n(t,1):Array.isArray(t)?t.map(function(e){return e}):t;function n(e,t){return e.reduce(function(e,i){return Array.isArray(i)&&t<r?e.concat(n(i,t+1)):e.concat(i)},[])}}},function(e,t,r){"use strict";var n=r(97);function i(e){return n.existsSync(e)&&n.statSync(e).isFile()}e.exports=function e(t,r){if(!r)return i(t);n.stat(t,function(e,t){return e?r(e):r(null,t.isFile())})},e.exports.sync=i},function(e,t,r){"use strict";t.regex=t.re=/^npm-debug\.log$|^\..*\.swp$|^\.DS_Store$|^\.AppleDouble$|^\.LSOverride$|^Icon\r$|^\._.*|^\.Spotlight-V100(?:$|\/)|\.Trashes|^__MACOSX$|~$|^Thumbs\.db$|^ehthumbs\.db$|^Desktop\.ini$|^@eaDir$/,t.is=(e=>t.re.test(e)),t.not=(e=>!t.is(e))},function(e,t,r){!function t(r,n){e.exports=n()}("undefined"!=typeof self?self:this,function(){return function(e){var t={};function r(n){if(t[n])return t[n].exports;var i=t[n]={i:n,l:!1,exports:{}};return e[n].call(i.exports,i,i.exports,r),i.l=!0,i.exports}return r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get:n})},r.n=function(e){var t=e&&e.__esModule?function t(){return e.default}:function t(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=3)}([function(e,t,r){function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var i=r(5),o=r(1),s=o.toHex,a=o.ceilHeapSize,u=r(6),c=function(e){for(e+=9;e%64>0;e+=1);return e},f=function(e,t){var r=new Uint8Array(e.buffer),n=t%4,i=t-n;switch(n){case 0:r[i+3]=0;case 1:r[i+2]=0;case 2:r[i+1]=0;case 3:r[i+0]=0}for(var o=1+(t>>2);o<e.length;o++)e[o]=0},l=function(e,t,r){e[t>>2]|=128<<24-(t%4<<3),e[14+(2+(t>>2)&-16)]=r/(1<<29)|0,e[15+(2+(t>>2)&-16)]=r<<3},h=function(e,t){var r=new Int32Array(e,t+320,5),n=new Int32Array(5),i=new DataView(n.buffer);return i.setInt32(0,r[0],!1),i.setInt32(4,r[1],!1),i.setInt32(8,r[2],!1),i.setInt32(12,r[3],!1),i.setInt32(16,r[4],!1),n},p=function(){function e(t){if(n(this,e),t=t||65536,t%64>0)throw new Error("Chunk size must be a multiple of 128 bit");this._offset=0,this._maxChunkLen=t,this._padMaxChunkLen=c(t),this._heap=new ArrayBuffer(a(this._padMaxChunkLen+320+20)),this._h32=new Int32Array(this._heap),this._h8=new Int8Array(this._heap),this._core=new i({Int32Array:Int32Array},{},this._heap)}return e.prototype._initState=function e(t,r){this._offset=0;var n=new Int32Array(t,r+320,5);n[0]=1732584193,n[1]=-271733879,n[2]=-1732584194,n[3]=271733878,n[4]=-1009589776},e.prototype._padChunk=function e(t,r){var n=c(t),i=new Int32Array(this._heap,0,n>>2);return f(i,t),l(i,t,r),n},e.prototype._write=function e(t,r,n,i){u(t,this._h8,this._h32,r,n,i||0)},e.prototype._coreCall=function e(t,r,n,i,o){var s=n;this._write(t,r,n),o&&(s=this._padChunk(n,i)),this._core.hash(s,this._padMaxChunkLen)},e.prototype.rawDigest=function e(t){var r=t.byteLength||t.length||t.size||0;this._initState(this._heap,this._padMaxChunkLen);var n=0,i=this._maxChunkLen;for(n=0;r>n+i;n+=i)this._coreCall(t,n,i,r,!1);return this._coreCall(t,n,r-n,r,!0),h(this._heap,this._padMaxChunkLen)},e.prototype.digest=function e(t){return s(this.rawDigest(t).buffer)},e.prototype.digestFromString=function e(t){return this.digest(t)},e.prototype.digestFromBuffer=function e(t){return this.digest(t)},e.prototype.digestFromArrayBuffer=function e(t){return this.digest(t)},e.prototype.resetState=function e(){return this._initState(this._heap,this._padMaxChunkLen),this},e.prototype.append=function e(t){var r=0,n=t.byteLength||t.length||t.size||0,i=this._offset%this._maxChunkLen,o=void 0;for(this._offset+=n;r<n;)o=Math.min(n-r,this._maxChunkLen-i),this._write(t,r,o,i),i+=o,r+=o,i===this._maxChunkLen&&(this._core.hash(this._maxChunkLen,this._padMaxChunkLen),i=0);return this},e.prototype.getState=function e(){var t=this._offset%this._maxChunkLen,r=void 0;if(t)r=this._heap.slice(0);else{var n=new Int32Array(this._heap,this._padMaxChunkLen+320,5);r=n.buffer.slice(n.byteOffset,n.byteOffset+n.byteLength)}return{offset:this._offset,heap:r}},e.prototype.setState=function e(t){if(this._offset=t.offset,20===t.heap.byteLength){var r=new Int32Array(this._heap,this._padMaxChunkLen+320,5);r.set(new Int32Array(t.heap))}else this._h32.set(new Int32Array(t.heap));return this},e.prototype.rawEnd=function e(){var t=this._offset,r=t%this._maxChunkLen,n=this._padChunk(r,t);this._core.hash(n,this._padMaxChunkLen);var i=h(this._heap,this._padMaxChunkLen);return this._initState(this._heap,this._padMaxChunkLen),i},e.prototype.end=function e(){return s(this.rawEnd().buffer)},e}();e.exports=p,e.exports._core=i},function(e,t){for(var r=new Array(256),n=0;n<256;n++)r[n]=(n<16?"0":"")+n.toString(16);e.exports.toHex=function(e){for(var t=new Uint8Array(e),n=new Array(e.byteLength),i=0;i<n.length;i++)n[i]=r[t[i]];return n.join("")},e.exports.ceilHeapSize=function(e){var t=0;if(e<=65536)return 65536;if(e<16777216)for(t=1;t<e;t<<=1);else for(t=16777216;t<e;t+=16777216);return t},e.exports.isDedicatedWorkerScope=function(e){var t="WorkerGlobalScope"in e&&e instanceof e.WorkerGlobalScope,r="SharedWorkerGlobalScope"in e&&e instanceof e.SharedWorkerGlobalScope,n="ServiceWorkerGlobalScope"in e&&e instanceof e.ServiceWorkerGlobalScope;return t&&!r&&!n}},function(e,t,r){e.exports=function(){var e=r(0),t=function(e,t,r){try{return r(null,e.digest(t))}catch(e){return r(e)}},n=function(e,t,r,i,o){var s=new self.FileReader;s.onloadend=function a(){if(s.error)return o(s.error);var u=s.result;t+=s.result.byteLength;try{e.append(u)}catch(e){return void o(e)}t<i.size?n(e,t,r,i,o):o(null,e.end())},s.readAsArrayBuffer(i.slice(t,t+r))},i=!0;return self.onmessage=function(r){if(i){var o=r.data.data,s=r.data.file,a=r.data.id;if(void 0!==a&&(s||o)){var u=r.data.blockSize||4194304,c=new e(u);c.resetState();var f=function(e,t){e?self.postMessage({id:a,error:e.name}):self.postMessage({id:a,hash:t})};o&&t(c,o,f),s&&n(c,0,u,s,f)}}},function(){i=!1}}},function(e,t,r){var n=r(4),i=r(0),o=r(7),s=r(2),a=r(1),u=a.isDedicatedWorkerScope,c="undefined"!=typeof self&&u(self);i.disableWorkerBehaviour=c?s():function(){},i.createWorker=function(){var e=n(2),t=e.terminate;return e.terminate=function(){URL.revokeObjectURL(e.objectURL),t.call(e)},e},i.createHash=o,e.exports=i},function(e,t,r){function n(e){var t={};function r(n){if(t[n])return t[n].exports;var i=t[n]={i:n,l:!1,exports:{}};return e[n].call(i.exports,i,i.exports,r),i.l=!0,i.exports}r.m=e,r.c=t,r.i=function(e){return e},r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get:n})},r.r=function(e){Object.defineProperty(e,"__esModule",{value:!0})},r.n=function(e){var t=e&&e.__esModule?function t(){return e.default}:function t(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="/",r.oe=function(e){throw console.error(e),e};var n=r(r.s=ENTRY_MODULE);return n.default||n}var i="[\\.|\\-|\\+|\\w|/|@]+",o="\\((/\\*.*?\\*/)?s?.*?("+i+").*?\\)";function s(e){return(e+"").replace(/[.?*+^$[\]\\(){}|-]/g,"\\$&")}function a(e,t,n){var a={};a[n]=[];var u=t.toString(),c=u.match(/^function\s?\(\w+,\s*\w+,\s*(\w+)\)/);if(!c)return a;for(var f=c[1],l=new RegExp("(\\\\n|\\W)"+s(f)+o,"g"),h;h=l.exec(u);)"dll-reference"!==h[3]&&a[n].push(h[3]);for(l=new RegExp("\\("+s(f)+'\\("(dll-reference\\s('+i+'))"\\)\\)'+o,"g");h=l.exec(u);)e[h[2]]||(a[n].push(h[1]),e[h[2]]=r(h[1]).m),a[h[2]]=a[h[2]]||[],a[h[2]].push(h[4]);return a}function u(e){var t=Object.keys(e);return t.reduce(function(t,r){return t||e[r].length>0},!1)}function c(e,t){for(var r={main:[t]},n={main:[]},i={main:{}};u(r);)for(var o=Object.keys(r),s=0;s<o.length;s++){var c=o[s],f=r[c],l=f.pop();if(i[c]=i[c]||{},!i[c][l]&&e[c][l]){i[c][l]=!0,n[c]=n[c]||[],n[c].push(l);for(var h=a(e,e[c][l],c),p=Object.keys(h),d=0;d<p.length;d++)r[p[d]]=r[p[d]]||[],r[p[d]]=r[p[d]].concat(h[p[d]])}}return n}e.exports=function(e,t){t=t||{};var i={main:r.m},o=t.all?{main:Object.keys(i)}:c(i,e),s="";Object.keys(o).filter(function(e){return"main"!==e}).forEach(function(e){for(var t=0;o[e][t];)t++;o[e].push(t),i[e][t]="(function(module, exports, __webpack_require__) { module.exports = __webpack_require__; })",s=s+"var "+e+" = ("+n.toString().replace("ENTRY_MODULE",JSON.stringify(t))+")({"+o[e].map(function(t){return JSON.stringify(t)+": "+i[e][t].toString()}).join(",")+"});\n"}),s=s+"("+n.toString().replace("ENTRY_MODULE",JSON.stringify(e))+")({"+o.main.map(function(e){return JSON.stringify(e)+": "+i.main[e].toString()}).join(",")+"})(self);";var a=new window.Blob([s],{type:"text/javascript"});if(t.bare)return a;var u=window.URL||window.webkitURL||window.mozURL||window.msURL,f=u.createObjectURL(a),l=new window.Worker(f);return l.objectURL=f,l}},function(e,t){e.exports=function e(t,r,n){"use asm";var i=new t.Int32Array(n);function o(e,t){e=e|0;t=t|0;var r=0,n=0,o=0,s=0,a=0,u=0,c=0,f=0,l=0,h=0,p=0,d=0,y=0,g=0;o=i[t+320>>2]|0;a=i[t+324>>2]|0;c=i[t+328>>2]|0;l=i[t+332>>2]|0;p=i[t+336>>2]|0;for(r=0;(r|0)<(e|0);r=r+64|0){s=o;u=a;f=c;h=l;d=p;for(n=0;(n|0)<64;n=n+4|0){g=i[r+n>>2]|0;y=((o<<5|o>>>27)+(a&c|~a&l)|0)+((g+p|0)+1518500249|0)|0;p=l;l=c;c=a<<30|a>>>2;a=o;o=y;i[e+n>>2]=g}for(n=e+64|0;(n|0)<(e+80|0);n=n+4|0){g=(i[n-12>>2]^i[n-32>>2]^i[n-56>>2]^i[n-64>>2])<<1|(i[n-12>>2]^i[n-32>>2]^i[n-56>>2]^i[n-64>>2])>>>31;y=((o<<5|o>>>27)+(a&c|~a&l)|0)+((g+p|0)+1518500249|0)|0;p=l;l=c;c=a<<30|a>>>2;a=o;o=y;i[n>>2]=g}for(n=e+80|0;(n|0)<(e+160|0);n=n+4|0){g=(i[n-12>>2]^i[n-32>>2]^i[n-56>>2]^i[n-64>>2])<<1|(i[n-12>>2]^i[n-32>>2]^i[n-56>>2]^i[n-64>>2])>>>31;y=((o<<5|o>>>27)+(a^c^l)|0)+((g+p|0)+1859775393|0)|0;p=l;l=c;c=a<<30|a>>>2;a=o;o=y;i[n>>2]=g}for(n=e+160|0;(n|0)<(e+240|0);n=n+4|0){g=(i[n-12>>2]^i[n-32>>2]^i[n-56>>2]^i[n-64>>2])<<1|(i[n-12>>2]^i[n-32>>2]^i[n-56>>2]^i[n-64>>2])>>>31;y=((o<<5|o>>>27)+(a&c|a&l|c&l)|0)+((g+p|0)-1894007588|0)|0;p=l;l=c;c=a<<30|a>>>2;a=o;o=y;i[n>>2]=g}for(n=e+240|0;(n|0)<(e+320|0);n=n+4|0){g=(i[n-12>>2]^i[n-32>>2]^i[n-56>>2]^i[n-64>>2])<<1|(i[n-12>>2]^i[n-32>>2]^i[n-56>>2]^i[n-64>>2])>>>31;y=((o<<5|o>>>27)+(a^c^l)|0)+((g+p|0)-899497514|0)|0;p=l;l=c;c=a<<30|a>>>2;a=o;o=y;i[n>>2]=g}o=o+s|0;a=a+u|0;c=c+f|0;l=l+h|0;p=p+d|0}i[t+320>>2]=o;i[t+324>>2]=a;i[t+328>>2]=c;i[t+332>>2]=l;i[t+336>>2]=p}return{hash:o}}},function(e,t){var r=this,n=void 0;"undefined"!=typeof self&&void 0!==self.FileReaderSync&&(n=new self.FileReaderSync);var i=function(e,t,r,n,i,o){var s=void 0,a=o%4,u=(i+a)%4,c=i-u;switch(a){case 0:t[o]=e.charCodeAt(n+3);case 1:t[o+1-(a<<1)|0]=e.charCodeAt(n+2);case 2:t[o+2-(a<<1)|0]=e.charCodeAt(n+1);case 3:t[o+3-(a<<1)|0]=e.charCodeAt(n)}if(!(i<u+(4-a))){for(s=4-a;s<c;s=s+4|0)r[o+s>>2]=e.charCodeAt(n+s)<<24|e.charCodeAt(n+s+1)<<16|e.charCodeAt(n+s+2)<<8|e.charCodeAt(n+s+3);switch(u){case 3:t[o+c+1|0]=e.charCodeAt(n+c+2);case 2:t[o+c+2|0]=e.charCodeAt(n+c+1);case 1:t[o+c+3|0]=e.charCodeAt(n+c)}}},o=function(e,t,r,n,i,o){var s=void 0,a=o%4,u=(i+a)%4,c=i-u;switch(a){case 0:t[o]=e[n+3];case 1:t[o+1-(a<<1)|0]=e[n+2];case 2:t[o+2-(a<<1)|0]=e[n+1];case 3:t[o+3-(a<<1)|0]=e[n]}if(!(i<u+(4-a))){for(s=4-a;s<c;s=s+4|0)r[o+s>>2|0]=e[n+s]<<24|e[n+s+1]<<16|e[n+s+2]<<8|e[n+s+3];switch(u){case 3:t[o+c+1|0]=e[n+c+2];case 2:t[o+c+2|0]=e[n+c+1];case 1:t[o+c+3|0]=e[n+c]}}},s=function(e,t,r,i,o,s){var a=void 0,u=s%4,c=(o+u)%4,f=o-c,l=new Uint8Array(n.readAsArrayBuffer(e.slice(i,i+o)));switch(u){case 0:t[s]=l[3];case 1:t[s+1-(u<<1)|0]=l[2];case 2:t[s+2-(u<<1)|0]=l[1];case 3:t[s+3-(u<<1)|0]=l[0]}if(!(o<c+(4-u))){for(a=4-u;a<f;a=a+4|0)r[s+a>>2|0]=l[a]<<24|l[a+1]<<16|l[a+2]<<8|l[a+3];switch(c){case 3:t[s+f+1|0]=l[f+2];case 2:t[s+f+2|0]=l[f+1];case 1:t[s+f+3|0]=l[f]}}};e.exports=function(e,t,n,a,u,c){if("string"==typeof e)return i(e,t,n,a,u,c);if(e instanceof Array)return o(e,t,n,a,u,c);if(r&&r.Buffer&&r.Buffer.isBuffer(e))return o(e,t,n,a,u,c);if(e instanceof ArrayBuffer)return o(new Uint8Array(e),t,n,a,u,c);if(e.buffer instanceof ArrayBuffer)return o(new Uint8Array(e.buffer,e.byteOffset,e.byteLength),t,n,a,u,c);if(e instanceof Blob)return s(e,t,n,a,u,c);throw new Error("Unsupported data type.")}},function(e,t,r){function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var i=r(0),o=r(1),s=o.toHex,a=function(){function e(){n(this,e),this._rusha=new i,this._rusha.resetState()}return e.prototype.update=function e(t){return this._rusha.append(t),this},e.prototype.digest=function e(t){var e=this._rusha.rawEnd().buffer;if(!t)return e;if("hex"===t)return s(e);throw new Error("unsupported digest encoding")},e}();e.exports=function(){return new a}}])})},function(e,t){},function(e,t){},function(e,t,r){(function(t){e.exports=function e(r,n){if("undefined"==typeof Blob||!(r instanceof Blob))throw new Error("first argument must be a Blob");if("function"!=typeof n)throw new Error("second argument must be a function");var i=new FileReader;function o(e){i.removeEventListener("loadend",o,!1),e.error?n(e.error):n(null,t.from(i.result))}i.addEventListener("loadend",o,!1),i.readAsArrayBuffer(r)}}).call(this,r(0).Buffer)},function(e,t,r){(function(t){e.exports=l;const n=r(321),i=r(1475),o=r(322),s=r(602),a=r(35),u=r(205),c=r(36),f=e=>null!==e&&"object"==typeof e&&"function"==typeof e.pipe;function l(e,r){if(e=Object.assign({maxRedirects:10},"string"==typeof e?{url:e}:e),r=a(r),e.url){const{hostname:t,port:r,protocol:n,auth:i,path:o}=c.parse(e.url);delete e.url,t||r||n||i?Object.assign(e,{hostname:t,port:r,protocol:n,auth:i,path:o}):e.path=o}const n={"accept-encoding":"gzip, deflate"};let h;e.headers&&Object.keys(e.headers).forEach(t=>n[t.toLowerCase()]=e.headers[t]),e.headers=n,e.body?h=e.json&&!f(e.body)?JSON.stringify(e.body):e.body:e.form&&(h="string"==typeof e.form?e.form:u.stringify(e.form),e.headers["content-type"]="application/x-www-form-urlencoded"),h&&(e.method||(e.method="POST"),f(h)||(e.headers["content-length"]=t.byteLength(h)),e.json&&!e.form&&(e.headers["content-type"]="application/json")),delete e.body,delete e.form,e.json&&(e.headers.accept="application/json"),e.method&&(e.method=e.method.toUpperCase());const p="https:"===e.protocol?s:o,d=p.request(e,t=>{if(t.statusCode>=300&&t.statusCode<400&&t.headers.location)return e.url=t.headers.location,delete e.headers.host,t.resume(),"POST"===e.method&&[301,302].includes(t.statusCode)&&(e.method="GET",delete e.headers["content-length"],delete e.headers["content-type"]),0==e.maxRedirects--?r(new Error("too many redirects")):l(e,r);const n="function"==typeof i&&"HEAD"!==e.method;r(null,n?i(t):t)});return d.on("timeout",()=>{d.abort(),r(new Error("Request timed out"))}),d.on("error",r),f(h)?h.on("error",r).pipe(d):d.end(h),d}l.concat=((e,t)=>l(e,(r,i)=>{if(r)return t(r);n(i,(r,n)=>{if(r)return t(r);if(e.json)try{n=JSON.parse(n.toString())}catch(r){return t(r,i,n)}t(null,i,n)})})),["get","post","put","patch","head","delete"].forEach(e=>{l[e]=((t,r)=>("string"==typeof t&&(t={url:t}),l(Object.assign({method:e.toUpperCase()},t),r)))})}).call(this,r(0).Buffer)},function(e,t){},function(e,t,r){(function(t,n,i){var o=r(599),s=r(4),a=r(600),u=r(21),c=r(601),f=a.IncomingMessage,l=a.readyStates;function h(e,t){return o.fetch&&t?"fetch":o.mozchunkedarraybuffer?"moz-chunked-arraybuffer":o.msstream?"ms-stream":o.arraybuffer&&e?"arraybuffer":o.vbArray&&e?"text:vbarray":"text"}var p=e.exports=function(e){var r=this,n;u.Writable.call(r),r._opts=e,r._body=[],r._headers={},e.auth&&r.setHeader("Authorization","Basic "+new t(e.auth).toString("base64")),Object.keys(e.headers).forEach(function(t){r.setHeader(t,e.headers[t])});var i=!0;if("disable-fetch"===e.mode||"requestTimeout"in e&&!o.abortController)i=!1,n=!0;else if("prefer-streaming"===e.mode)n=!1;else if("allow-wrong-content-type"===e.mode)n=!o.overrideMimeType;else{if(e.mode&&"default"!==e.mode&&"prefer-fast"!==e.mode)throw new Error("Invalid value for opts.mode");n=!0}r._mode=h(n,i),r._fetchTimer=null,r.on("finish",function(){r._onFinish()})};function d(e){try{var t=e.status;return null!==t&&0!==t}catch(e){return!1}}s(p,u.Writable),p.prototype.setHeader=function(e,t){var r=this,n=e.toLowerCase();-1===y.indexOf(n)&&(this._headers[n]={name:e,value:t})},p.prototype.getHeader=function(e){var t=this._headers[e.toLowerCase()];return t?t.value:null},p.prototype.removeHeader=function(e){var t=this;delete this._headers[e.toLowerCase()]},p.prototype._onFinish=function(){var e=this;if(!e._destroyed){var r=e._opts,s=e._headers,a=null;"GET"!==r.method&&"HEAD"!==r.method&&(a=o.arraybuffer?c(t.concat(e._body)):o.blobConstructor?new n.Blob(e._body.map(function(e){return c(e)}),{type:(s["content-type"]||{}).value||""}):t.concat(e._body).toString());var u=[];if(Object.keys(s).forEach(function(e){var t=s[e].name,r=s[e].value;Array.isArray(r)?r.forEach(function(e){u.push([t,e])}):u.push([t,r])}),"fetch"===e._mode){var f=null,h=null;if(o.abortController){var p=new AbortController;f=p.signal,e._fetchAbortController=p,"requestTimeout"in r&&0!==r.requestTimeout&&(e._fetchTimer=n.setTimeout(function(){e.emit("requestTimeout"),e._fetchAbortController&&e._fetchAbortController.abort()},r.requestTimeout))}n.fetch(e._opts.url,{method:e._opts.method,headers:u,body:a||void 0,mode:"cors",credentials:r.withCredentials?"include":"same-origin",signal:f}).then(function(t){e._fetchResponse=t,e._connect()},function(t){n.clearTimeout(e._fetchTimer),e._destroyed||e.emit("error",t)})}else{var d=e._xhr=new n.XMLHttpRequest;try{d.open(e._opts.method,e._opts.url,!0)}catch(t){return void i.nextTick(function(){e.emit("error",t)})}"responseType"in d&&(d.responseType=e._mode.split(":")[0]),"withCredentials"in d&&(d.withCredentials=!!r.withCredentials),"text"===e._mode&&"overrideMimeType"in d&&d.overrideMimeType("text/plain; charset=x-user-defined"),"requestTimeout"in r&&(d.timeout=r.requestTimeout,d.ontimeout=function(){e.emit("requestTimeout")}),u.forEach(function(e){d.setRequestHeader(e[0],e[1])}),e._response=null,d.onreadystatechange=function(){switch(d.readyState){case l.LOADING:case l.DONE:e._onXHRProgress()}},"moz-chunked-arraybuffer"===e._mode&&(d.onprogress=function(){e._onXHRProgress()}),d.onerror=function(){e._destroyed||e.emit("error",new Error("XHR error"))};try{d.send(a)}catch(t){return void i.nextTick(function(){e.emit("error",t)})}}}},p.prototype._onXHRProgress=function(){var e=this;d(this._xhr)&&!this._destroyed&&(this._response||this._connect(),this._response._onXHRProgress())},p.prototype._connect=function(){var e=this;e._destroyed||(e._response=new f(e._xhr,e._fetchResponse,e._mode,e._fetchTimer),e._response.on("error",function(t){e.emit("error",t)}),e.emit("response",e._response))},p.prototype._write=function(e,t,r){var n=this;this._body.push(e),r()},p.prototype.abort=p.prototype.destroy=function(){var e=this;this._destroyed=!0,n.clearTimeout(this._fetchTimer),this._response&&(this._response._destroyed=!0),this._xhr?this._xhr.abort():this._fetchAbortController&&this._fetchAbortController.abort()},p.prototype.end=function(e,t,r){var n=this;"function"==typeof e&&(r=e,e=void 0),u.Writable.prototype.end.call(this,e,t,r)},p.prototype.flushHeaders=function(){},p.prototype.setTimeout=function(){},p.prototype.setNoDelay=function(){},p.prototype.setSocketKeepAlive=function(){};var y=["accept-charset","accept-encoding","access-control-request-headers","access-control-request-method","connection","content-length","cookie","cookie2","date","dnt","expect","host","keep-alive","origin","referer","te","trailer","transfer-encoding","upgrade","via"]}).call(this,r(0).Buffer,r(7),r(6))},function(e,t){e.exports={100:"Continue",101:"Switching Protocols",102:"Processing",200:"OK",201:"Created",202:"Accepted",203:"Non-Authoritative Information",204:"No Content",205:"Reset Content",206:"Partial Content",207:"Multi-Status",208:"Already Reported",226:"IM Used",300:"Multiple Choices",301:"Moved Permanently",302:"Found",303:"See Other",304:"Not Modified",305:"Use Proxy",307:"Temporary Redirect",308:"Permanent Redirect",400:"Bad Request",401:"Unauthorized",402:"Payment Required",403:"Forbidden",404:"Not Found",405:"Method Not Allowed",406:"Not Acceptable",407:"Proxy Authentication Required",408:"Request Timeout",409:"Conflict",410:"Gone",411:"Length Required",412:"Precondition Failed",413:"Payload Too Large",414:"URI Too Long",415:"Unsupported Media Type",416:"Range Not Satisfiable",417:"Expectation Failed",418:"I'm a teapot",421:"Misdirected Request",422:"Unprocessable Entity",423:"Locked",424:"Failed Dependency",425:"Unordered Collection",426:"Upgrade Required",428:"Precondition Required",429:"Too Many Requests",431:"Request Header Fields Too Large",451:"Unavailable For Legal Reasons",500:"Internal Server Error",501:"Not Implemented",502:"Bad Gateway",503:"Service Unavailable",504:"Gateway Timeout",505:"HTTP Version Not Supported",506:"Variant Also Negotiates",507:"Insufficient Storage",508:"Loop Detected",509:"Bandwidth Limit Exceeded",510:"Not Extended",511:"Network Authentication Required"}},function(e,t,r){(function(t){e.exports=s,e.exports.decode=s,e.exports.encode=a;const n=r(1479),i=r(27),o=r(202);function s(e){const r={},i=e.split("magnet:?")[1],s=i&&i.length>=0?i.split("&"):[];let a;if(s.forEach(e=>{const t=e.split("=");if(2!==t.length)return;const n=t[0];let i=t[1];if("dn"===n&&(i=decodeURIComponent(i).replace(/\+/g," ")),"tr"!==n&&"xs"!==n&&"as"!==n&&"ws"!==n||(i=decodeURIComponent(i)),"kt"===n&&(i=decodeURIComponent(i).split("+")),"ix"===n&&(i=Number(i)),r[n])if(Array.isArray(r[n]))r[n].push(i);else{const e=r[n];r[n]=[e,i]}else r[n]=i}),r.xt){const e=Array.isArray(r.xt)?r.xt:[r.xt];e.forEach(e=>{if(a=e.match(/^urn:btih:(.{40})/))r.infoHash=a[1].toLowerCase();else if(a=e.match(/^urn:btih:(.{32})/)){const e=n.decode(a[1]);r.infoHash=t.from(e,"binary").toString("hex")}})}return r.infoHash&&(r.infoHashBuffer=t.from(r.infoHash,"hex")),r.dn&&(r.name=r.dn),r.kt&&(r.keywords=r.kt),"string"==typeof r.tr?r.announce=[r.tr]:Array.isArray(r.tr)?r.announce=r.tr:r.announce=[],r.urlList=[],("string"==typeof r.as||Array.isArray(r.as))&&(r.urlList=r.urlList.concat(r.as)),("string"==typeof r.ws||Array.isArray(r.ws))&&(r.urlList=r.urlList.concat(r.ws)),o(r.announce),o(r.urlList),r}function a(e){e=i(e),e.infoHashBuffer&&(e.xt=`urn:btih:${e.infoHashBuffer.toString("hex")}`),e.infoHash&&(e.xt=`urn:btih:${e.infoHash}`),e.name&&(e.dn=e.name),e.keywords&&(e.kt=e.keywords),e.announce&&(e.tr=e.announce),e.urlList&&(e.ws=e.urlList,delete e.as);let t="magnet:?";return Object.keys(e).filter(e=>2===e.length).forEach((r,n)=>{const i=Array.isArray(e[r])?e[r]:[e[r]];i.forEach((e,i)=>{!(n>0||i>0)||"kt"===r&&0!==i||(t+="&"),"dn"===r&&(e=encodeURIComponent(e).replace(/%20/g,"+")),"tr"!==r&&"xs"!==r&&"as"!==r&&"ws"!==r||(e=encodeURIComponent(e)),"kt"===r&&(e=encodeURIComponent(e)),t+="kt"===r&&i>0?`+${e}`:`${r}=${e}`})}),t}}).call(this,r(0).Buffer)},function(e,t,r){var n=r(1480);t.encode=n.encode,t.decode=n.decode},function(e,t,r){"use strict";(function(e){var r="ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",n=[255,255,26,27,28,29,30,31,255,255,255,255,255,255,255,255,255,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,255,255,255,255,255,255,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,255,255,255,255,255];function i(e){var t=Math.floor(e.length/5);return e.length%5==0?t:t+1}t.encode=function(t){e.isBuffer(t)||(t=new e(t));for(var n=0,o=0,s=0,a=0,u=new e(8*i(t));n<t.length;){var c=t[n];s>3?(a=c&255>>s,s=(s+5)%8,a=a<<s|(n+1<t.length?t[n+1]:0)>>8-s,n++):(a=c>>8-(s+5)&31,s=(s+5)%8,0===s&&n++),u[o]=r.charCodeAt(a),o++}for(n=o;n<u.length;n++)u[n]=61;return u},t.decode=function(t){var r=0,i=0,o,s=0;e.isBuffer(t)||(t=new e(t));for(var a=new e(Math.ceil(5*t.length/8)),u=0;u<t.length&&61!==t[u];u++){var c=t[u]-48;if(!(c<n.length))throw new Error("Invalid input - it is not base32 encoded string");i=n[c],r<=3?(r=(r+5)%8,0===r?(o|=i,a[s]=o,s++,o=0):o|=255&i<<8-r):(r=(r+5)%8,o|=255&i>>>r,a[s]=o,s++,o=255&i<<8-r)}return a.slice(0,s)}}).call(this,r(0).Buffer)},function(e,t){e.exports=function e(t,r,n){return void 0===r?function(r,n){return e(t,r,n)}:(void 0===n&&(n="0"),t-=r.toString().length,t>0?new Array(t+(/\./.test(r)?2:1)).join(n)+r:r+"")}},function(e,t){},function(e,t,r){(function(t,n){e.exports=Y;var i=r(1484),o=r(203),s=r(1485),a=r(1)("webtorrent:torrent"),u=r(1486),c=r(10).EventEmitter,f=r(27),l=r(604),h=r(97),p=r(1496),d=r(605),y=r(1498),g=r(4),m=r(597),b=r(1499),v=r(1500),_=r(148),w=r(1501),S=r(598),k=r(55),E=r(1502),A=r(292),x=r(1503),I=r(149),T=r(323),B=r(202),C=r(1504),P=r(1505),O=r(1506),R=r(1524),N=r(1526),L=r(1527),j=131072,M=3e4,K=5e3,D=3*E.BLOCK_LENGTH,U=.5,F=1,q=1e4,H=2,z=2,V=[1e3,5e3,15e3],G=r(325).version,W="WebTorrent/"+G+" (https://webtorrent.io)",$;try{$=k.join(h.statSync("/tmp")&&"/tmp","webtorrent")}catch(e){$=k.join("function"==typeof v.tmpdir?v.tmpdir():"/","webtorrent")}function Y(e,t,r){c.call(this),this._debugId="unknown infohash",this.client=t,this.announce=r.announce,this.urlList=r.urlList,this.path=r.path,this._store=r.store||p,this._getAnnounceOpts=r.getAnnounceOpts,this.strategy=r.strategy||"sequential",this.maxWebConns=r.maxWebConns||4,this._rechokeNumSlots=!1===r.uploads||0===r.uploads?0:+r.uploads||10,this._rechokeOptimisticWire=null,this._rechokeOptimisticTime=0,this._rechokeIntervalId=null,this.ready=!1,this.destroyed=!1,this.paused=!1,this.done=!1,this.metadata=null,this.store=null,this.files=[],this.pieces=[],this._amInterested=!1,this._selections=[],this._critical=[],this.wires=[],this._queue=[],this._peers={},this._peersLength=0,this.received=0,this.uploaded=0,this._downloadSpeed=T(),this._uploadSpeed=T(),this._servers=[],this._xsRequests=[],this._fileModtimes=r.fileModtimes,null!==e&&this._onTorrentId(e),this._debug("new torrent")}function J(e,t){return 2+Math.ceil(t*e.downloadSpeed()/E.BLOCK_LENGTH)}function X(e,t,r){return 1+Math.ceil(t*e.downloadSpeed()/r)}function Z(e){return Math.random()*e|0}function Q(){}g(Y,c),Object.defineProperty(Y.prototype,"timeRemaining",{get:function(){return this.done?0:0===this.downloadSpeed?1/0:(this.length-this.downloaded)/this.downloadSpeed*1e3}}),Object.defineProperty(Y.prototype,"downloaded",{get:function(){if(!this.bitfield)return 0;for(var e=0,t=0,r=this.pieces.length;t<r;++t)if(this.bitfield.get(t))e+=t===r-1?this.lastPieceLength:this.pieceLength;else{var n=this.pieces[t];e+=n.length-n.missing}return e}}),Object.defineProperty(Y.prototype,"downloadSpeed",{get:function(){return this._downloadSpeed()}}),Object.defineProperty(Y.prototype,"uploadSpeed",{get:function(){return this._uploadSpeed()}}),Object.defineProperty(Y.prototype,"progress",{get:function(){return this.length?this.downloaded/this.length:0}}),Object.defineProperty(Y.prototype,"ratio",{get:function(){return this.uploaded/(this.received||1)}}),Object.defineProperty(Y.prototype,"numPeers",{get:function(){return this.wires.length}}),Object.defineProperty(Y.prototype,"torrentFileBlobURL",{get:function(){if("undefined"==typeof window)throw new Error("browser-only property");return this.torrentFile?URL.createObjectURL(new Blob([this.torrentFile],{type:"application/x-bittorrent"})):null}}),Object.defineProperty(Y.prototype,"_numQueued",{get:function(){return this._queue.length+(this._peersLength-this._numConns)}}),Object.defineProperty(Y.prototype,"_numConns",{get:function(){var e=this,t=0;for(var r in this._peers)this._peers[r].connected&&(t+=1);return t}}),Object.defineProperty(Y.prototype,"swarm",{get:function(){return console.warn("WebTorrent: `torrent.swarm` is deprecated. Use `torrent` directly instead."),this}}),Y.prototype._onTorrentId=function(e){var r=this;if(!r.destroyed){var n;try{n=S(e)}catch(e){}n?(r.infoHash=n.infoHash,r._debugId=n.infoHash.toString("hex").substring(0,7),t.nextTick(function(){r.destroyed||r._onParsedTorrent(n)})):S.remote(e,function(e,t){if(!r.destroyed)return e?r._destroy(e):void r._onParsedTorrent(t)})}},Y.prototype._onParsedTorrent=function(e){var t=this;if(!t.destroyed){if(t._processParsedTorrent(e),!t.infoHash)return t._destroy(new Error("Malformed torrent data: No info hash"));t.path||(t.path=k.join($,t.infoHash)),t._rechokeIntervalId=setInterval(function(){t._rechoke()},1e4),t._rechokeIntervalId.unref&&t._rechokeIntervalId.unref(),t.emit("_infoHash",t.infoHash),t.destroyed||(t.emit("infoHash",t.infoHash),t.destroyed||(t.client.listening?t._onListening():t.client.once("listening",function(){t._onListening()})))}},Y.prototype._processParsedTorrent=function(e){this._debugId=e.infoHash.toString("hex").substring(0,7),this.announce&&(e.announce=e.announce.concat(this.announce)),this.client.tracker&&n.WEBTORRENT_ANNOUNCE&&!this.private&&(e.announce=e.announce.concat(n.WEBTORRENT_ANNOUNCE)),this.urlList&&(e.urlList=e.urlList.concat(this.urlList)),B(e.announce),B(e.urlList),l(this,e),this.magnetURI=S.toMagnetURI(e),this.torrentFile=S.toTorrentFile(e)},Y.prototype._onListening=function(){var e=this;if(!e.discovery&&!e.destroyed){var t=e.client.tracker;t&&(t=f(e.client.tracker,{getAnnounceOpts:function(){var t={uploaded:e.uploaded,downloaded:e.downloaded,left:Math.max(e.length-e.downloaded,0)};return e.client.tracker.getAnnounceOpts&&l(t,e.client.tracker.getAnnounceOpts()),e._getAnnounceOpts&&l(t,e._getAnnounceOpts()),t}})),e.discovery=new u({infoHash:e.infoHash,announce:e.announce,peerId:e.client.peerId,dht:!e.private&&e.client.dht,tracker:t,port:e.client.torrentPort,userAgent:W}),e.discovery.on("error",r),e.discovery.on("peer",n),e.discovery.on("trackerAnnounce",i),e.discovery.on("dhtAnnounce",o),e.discovery.on("warning",s),e.info?e._onMetadata(e):e.xs&&e._getMetadataFromServer()}function r(t){e._destroy(t)}function n(t){"string"==typeof t&&e.done||e.addPeer(t)}function i(){e.emit("trackerAnnounce"),0===e.numPeers&&e.emit("noPeers","tracker")}function o(){e.emit("dhtAnnounce"),0===e.numPeers&&e.emit("noPeers","dht")}function s(t){e.emit("warning",t)}},Y.prototype._getMetadataFromServer=function(){var e=this,t=Array.isArray(e.xs)?e.xs:[e.xs],r=t.map(function(e){return function(t){n(e,t)}});function n(t,r){if(0!==t.indexOf("http://")&&0!==t.indexOf("https://"))return e.emit("warning",new Error("skipping non-http xs param: "+t)),r(null);var n={url:t,method:"GET",headers:{"user-agent":W}},i;try{i=d.concat(n,o)}catch(n){return e.emit("warning",new Error("skipping invalid url xs param: "+t)),r(null)}function o(n,i,o){if(e.destroyed)return r(null);if(e.metadata)return r(null);if(n)return e.emit("warning",new Error("http error from xs param: "+t)),r(null);if(200!==i.statusCode)return e.emit("warning",new Error("non-200 status code "+i.statusCode+" from xs param: "+t)),r(null);var s;try{s=S(o)}catch(n){}return s?s.infoHash!==e.infoHash?(e.emit("warning",new Error("got torrent file with incorrect info hash from xs param: "+t)),r(null)):(e._onMetadata(s),void r(null)):(e.emit("warning",new Error("got invalid torrent file from xs param: "+t)),r(null))}e._xsRequests.push(i)}_(r)},Y.prototype._onMetadata=function(e){var t=this;if(!t.metadata&&!t.destroyed){var r;if(t._debug("got metadata"),t._xsRequests.forEach(function(e){e.abort()}),t._xsRequests=[],e&&e.infoHash)r=e;else try{r=S(e)}catch(e){return t._destroy(e)}t._processParsedTorrent(r),t.metadata=t.torrentFile,t.client.enableWebSeeds&&t.urlList.forEach(function(e){t.addWebSeed(e)}),0!==t.pieces.length&&t.select(0,t.pieces.length-1,!1),t._rarityMap=new N(t),t.store=new y(new t._store(t.pieceLength,{torrent:{infoHash:t.infoHash},files:t.files.map(function(e){return{path:k.join(t.path,e.path),length:e.length,offset:e.offset}}),length:t.length})),t.files=t.files.map(function(e){return new O(t,e)}),t._hashes=t.pieces,t.pieces=t.pieces.map(function(e,r){var n=r===t.pieces.length-1?t.lastPieceLength:t.pieceLength;return new E(n)}),t._reservations=t.pieces.map(function(){return[]}),t.bitfield=new o(t.pieces.length),t.wires.forEach(function(e){e.ut_metadata&&e.ut_metadata.setMetadata(t.metadata),t._onWireWithMetadata(e)}),t._debug("verifying existing torrent data"),t._fileModtimes&&t._store===p?t.getFileModtimes(function(e,r){if(e)return t._destroy(e);var n=t.files.map(function(e,n){return r[n]===t._fileModtimes[n]}).every(function(e){return e});if(n){for(var i=0;i<t.pieces.length;i++)t._markVerified(i);t._onStore()}else t._verifyPieces()}):t._verifyPieces(),t.emit("metadata")}},Y.prototype.getFileModtimes=function(e){var t=this,r=[];w(t.files.map(function(e,n){return function(i){h.stat(k.join(t.path,e.path),function(e,t){if(e&&"ENOENT"!==e.code)return i(e);r[n]=t&&t.mtime.getTime(),i(null)})}}),2,function(n){t._debug("done getting file modtimes"),e(n,r)})},Y.prototype._verifyPieces=function(){var e=this;w(e.pieces.map(function(r,n){return function(r){if(e.destroyed)return r(new Error("torrent is destroyed"));e.store.get(n,function(i,o){return e.destroyed?r(new Error("torrent is destroyed")):i?t.nextTick(r,null):void I(o,function(t){if(e.destroyed)return r(new Error("torrent is destroyed"));if(t===e._hashes[n]){if(!e.pieces[n])return;e._debug("piece verified %s",n),e._markVerified(n)}else e._debug("piece invalid %s",n);r(null)})})}}),2,function(t){if(t)return e._destroy(t);e._debug("done verifying"),e._onStore()})},Y.prototype._markVerified=function(e){this.pieces[e]=null,this._reservations[e]=null,this.bitfield.set(e,!0)},Y.prototype._onStore=function(){var e=this;this.destroyed||(this._debug("on store"),this.ready=!0,this.emit("ready"),this._checkDone(),this._updateSelections())},Y.prototype.destroy=function(e){var t=this;this._destroy(null,e)},Y.prototype._destroy=function(e,t){var r=this;if(!r.destroyed){for(var n in r.destroyed=!0,r._debug("destroy"),r.client._remove(r),clearInterval(r._rechokeIntervalId),r._xsRequests.forEach(function(e){e.abort()}),r._rarityMap&&r._rarityMap.destroy(),r._peers)r.removePeer(n);r.files.forEach(function(e){e instanceof O&&e._destroy()});var i=r._servers.map(function(e){return function(t){e.destroy(t)}});r.discovery&&i.push(function(e){r.discovery.destroy(e)}),r.store&&i.push(function(e){r.store.close(e)}),_(i,t),e&&(0===r.listenerCount("error")?r.client.emit("error",e):r.emit("error",e)),r.emit("close"),r.client=null,r.files=[],r.discovery=null,r.store=null,r._rarityMap=null,r._peers=null,r._servers=null,r._xsRequests=null}},Y.prototype.addPeer=function(e){var t=this;if(this.destroyed)throw new Error("torrent is destroyed");if(!this.infoHash)throw new Error("addPeer() must not be called before the `infoHash` event");if(this.client.blocked){var r;if("string"==typeof e){var n;try{n=i(e)}catch(t){return this._debug("ignoring peer: invalid %s",e),this.emit("invalidPeer",e),!1}r=n[0]}else"string"==typeof e.remoteAddress&&(r=e.remoteAddress);if(r&&this.client.blocked.contains(r))return this._debug("ignoring peer: blocked %s",e),"string"!=typeof e&&e.destroy(),this.emit("blockedPeer",e),!1}var o=!!this._addPeer(e);return o?this.emit("peer",e):this.emit("invalidPeer",e),o},Y.prototype._addPeer=function(e){var t=this;if(this.destroyed)return"string"!=typeof e&&e.destroy(),null;if("string"==typeof e&&!this._validAddr(e))return this._debug("ignoring peer: invalid %s",e),null;var r=e&&e.id||e,n;return this._peers[r]?(this._debug("ignoring peer: duplicate (%s)",r),"string"!=typeof e&&e.destroy(),null):this.paused?(this._debug("ignoring peer: torrent is paused"),"string"!=typeof e&&e.destroy(),null):(this._debug("add peer %s",r),n="string"==typeof e?R.createTCPOutgoingPeer(e,this):R.createWebRTCPeer(e,this),this._peers[n.id]=n,this._peersLength+=1,"string"==typeof e&&(this._queue.push(n),this._drain()),n)},Y.prototype.addWebSeed=function(e){if(this.destroyed)throw new Error("torrent is destroyed");if(!/^https?:\/\/.+/.test(e))return this.emit("warning",new Error("ignoring invalid web seed: "+e)),void this.emit("invalidPeer",e);if(this._peers[e])return this.emit("warning",new Error("ignoring duplicate web seed: "+e)),void this.emit("invalidPeer",e);this._debug("add web seed %s",e);var t=R.createWebSeedPeer(e,this);this._peers[t.id]=t,this._peersLength+=1,this.emit("peer",e)},Y.prototype._addIncomingPeer=function(e){var t=this;return this.destroyed?e.destroy(new Error("torrent is destroyed")):this.paused?e.destroy(new Error("torrent is paused")):(this._debug("add incoming peer %s",e.id),this._peers[e.id]=e,void(this._peersLength+=1))},Y.prototype.removePeer=function(e){var t=this,r=e&&e.id||e;e=this._peers[r],e&&(this._debug("removePeer %s",r),delete this._peers[r],this._peersLength-=1,e.destroy(),this._drain())},Y.prototype.select=function(e,t,r,n){var i=this;if(this.destroyed)throw new Error("torrent is destroyed");if(e<0||t<e||this.pieces.length<=t)throw new Error("invalid selection ",e,":",t);r=Number(r)||0,this._debug("select %s-%s (priority %s)",e,t,r),this._selections.push({from:e,to:t,offset:0,priority:r,notify:n||Q}),this._selections.sort(function(e,t){return t.priority-e.priority}),this._updateSelections()},Y.prototype.deselect=function(e,t,r){var n=this;if(this.destroyed)throw new Error("torrent is destroyed");r=Number(r)||0,this._debug("deselect %s-%s (priority %s)",e,t,r);for(var i=0;i<this._selections.length;++i){var o=this._selections[i];if(o.from===e&&o.to===t&&o.priority===r){this._selections.splice(i,1);break}}this._updateSelections()},Y.prototype.critical=function(e,t){var r=this;if(this.destroyed)throw new Error("torrent is destroyed");this._debug("critical %s-%s",e,t);for(var n=e;n<=t;++n)this._critical[n]=!0;this._updateSelections()},Y.prototype._onWire=function(e,r){var n=this;if(n._debug("got wire %s (%s)",e._debugId,r||"Unknown"),e.on("download",function(e){n.destroyed||(n.received+=e,n._downloadSpeed(e),n.client._downloadSpeed(e),n.emit("download",e),n.client.emit("download",e))}),e.on("upload",function(e){n.destroyed||(n.uploaded+=e,n._uploadSpeed(e),n.client._uploadSpeed(e),n.emit("upload",e),n.client.emit("upload",e))}),n.wires.push(e),r){var o=i(r);e.remoteAddress=o[0],e.remotePort=o[1]}n.client.dht&&n.client.dht.listening&&e.on("port",function(t){if(!n.destroyed&&!n.client.dht.destroyed){if(!e.remoteAddress)return n._debug("ignoring PORT from peer with no address");if(0===t||t>65536)return n._debug("ignoring invalid PORT from peer");n._debug("port: %s (from %s)",t,r),n.client.dht.addNode({host:e.remoteAddress,port:t})}}),e.on("timeout",function(){n._debug("wire timeout (%s)",r),e.destroy()}),e.setTimeout(3e4,!0),e.setKeepAlive(!0),e.use(C(n.metadata)),e.ut_metadata.on("warning",function(e){n._debug("ut_metadata warning: %s",e.message)}),n.metadata||(e.ut_metadata.on("metadata",function(e){n._debug("got metadata via ut_metadata"),n._onMetadata(e)}),e.ut_metadata.fetch()),"function"!=typeof P||n.private||(e.use(P()),e.ut_pex.on("peer",function(e){n.done||(n._debug("ut_pex: got peer: %s (from %s)",e,r),n.addPeer(e))}),e.ut_pex.on("dropped",function(e){var t=n._peers[e];t&&!t.connected&&(n._debug("ut_pex: dropped peer: %s (from %s)",e,r),n.removePeer(e))}),e.once("close",function(){e.ut_pex.reset()})),n.emit("wire",e,r),n.metadata&&t.nextTick(function(){n._onWireWithMetadata(e)})},Y.prototype._onWireWithMetadata=function(e){var t=this,r=null,n;function i(){t.destroyed||e.destroyed||(t._numQueued>2*(t._numConns-t.numPeers)&&e.amInterested?e.destroy():(r=setTimeout(i,K),r.unref&&r.unref()))}function o(){if(e.peerPieces.buffer.length===t.bitfield.buffer.length){for(n=0;n<t.pieces.length;++n)if(!e.peerPieces.get(n))return;e.isSeeder=!0,e.choke()}}e.on("bitfield",function(){o(),t._update()}),e.on("have",function(){o(),t._update()}),e.once("interested",function(){e.unchoke()}),e.once("close",function(){clearTimeout(r)}),e.on("choke",function(){clearTimeout(r),r=setTimeout(i,K),r.unref&&r.unref()}),e.on("unchoke",function(){clearTimeout(r),t._update()}),e.on("request",function(r,n,i,o){if(i>131072)return e.destroy();t.pieces[r]||t.store.get(r,{offset:n,length:i},o)}),e.bitfield(t.bitfield),e.interested(),e.peerExtensions.dht&&t.client.dht&&t.client.dht.listening&&e.port(t.client.dht.address().port),"webSeed"!==e.type&&(r=setTimeout(i,K),r.unref&&r.unref()),e.isSeeder=!1,o()},Y.prototype._updateSelections=function(){var e=this;e.ready&&!e.destroyed&&(t.nextTick(function(){e._gcSelections()}),e._updateInterest(),e._update())},Y.prototype._gcSelections=function(){for(var e=this,t=0;t<this._selections.length;++t){for(var r=this._selections[t],n=r.offset;this.bitfield.get(r.from+r.offset)&&r.from+r.offset<r.to;)r.offset+=1;n!==r.offset&&r.notify(),r.to===r.from+r.offset&&(this.bitfield.get(r.from+r.offset)&&(this._selections.splice(t,1),t-=1,r.notify(),this._updateInterest()))}this._selections.length||this.emit("idle")},Y.prototype._updateInterest=function(){var e=this,t=e._amInterested;e._amInterested=!!e._selections.length,e.wires.forEach(function(t){e._amInterested?t.interested():t.uninterested()}),t!==e._amInterested&&(e._amInterested?e.emit("interested"):e.emit("uninterested"))},Y.prototype._update=function(){var e=this;if(!this.destroyed)for(var t=x(this.wires),r;r=t();)this._updateWire(r)},Y.prototype._updateWire=function(e){var t=this;if(!e.peerChoking){if(!e.downloaded)return o();var r=J(e,.5);if(!(e.requests.length>=r)){var n=J(e,1);u(!1)||u(!0)}}function i(t,r,n,i){return function(o){return o>=t&&o<=r&&!(o in n)&&e.peerPieces.get(o)&&(!i||i(o))}}function o(){if(!e.requests.length)for(var r=t._selections.length;r--;){var n=t._selections[r],o;if("rarest"===t.strategy)for(var s=n.from+n.offset,a=n.to,u=a-s+1,c={},f=0,l=i(s,a,c);f<u&&(o=t._rarityMap.getRarestPiece(l),!(o<0));){if(t._request(e,o,!1))return;c[o]=!0,f+=1}else for(o=n.to;o>=n.from+n.offset;--o)if(e.peerPieces.get(o)&&t._request(e,o,!1))return}}function s(){var r=e.downloadSpeed()||1;if(r>D)return function(){return!0};var n=Math.max(1,e.requests.length)*E.BLOCK_LENGTH/r,i=10,o=0;return function(e){if(!i||t.bitfield.get(e))return!0;for(var s=t.pieces[e].missing;o<t.wires.length;o++){var a=t.wires[o],u=a.downloadSpeed();if(!(u<D)&&(!(u<=r)&&a.peerPieces.get(e)&&!((s-=u*n)>0)))return i--,!1}return!0}}function a(e){for(var r=e,n=e;n<t._selections.length&&t._selections[n].priority;n++)r=n;var i=t._selections[e];t._selections[e]=t._selections[r],t._selections[r]=i}function u(r){if(e.requests.length>=n)return!0;for(var o=s(),u=0;u<t._selections.length;u++){var c=t._selections[u],f;if("rarest"===t.strategy)for(var l=c.from+c.offset,h=c.to,p=h-l+1,d={},y=0,g=i(l,h,d,o);y<p&&(f=t._rarityMap.getRarestPiece(g),!(f<0));){for(;t._request(e,f,t._critical[f]||r););if(!(e.requests.length<n))return c.priority&&a(u),!0;d[f]=!0,y++}else for(f=c.from+c.offset;f<=c.to;f++)if(e.peerPieces.get(f)&&o(f)){for(;t._request(e,f,t._critical[f]||r););if(!(e.requests.length<n))return c.priority&&a(u),!0}}return!1}},Y.prototype._rechoke=function(){var e=this;if(e.ready){e._rechokeOptimisticTime>0?e._rechokeOptimisticTime-=1:e._rechokeOptimisticWire=null;var t=[];e.wires.forEach(function(r){r.isSeeder||r===e._rechokeOptimisticWire||t.push({wire:r,downloadSpeed:r.downloadSpeed(),uploadSpeed:r.uploadSpeed(),salt:Math.random(),isChoked:!0})}),t.sort(s);for(var r=0,n=0;n<t.length&&r<e._rechokeNumSlots;++n)t[n].isChoked=!1,t[n].wire.peerInterested&&(r+=1);if(!e._rechokeOptimisticWire&&n<t.length&&e._rechokeNumSlots){var i=t.slice(n).filter(function(e){return e.wire.peerInterested}),o=i[Z(i.length)];o&&(o.isChoked=!1,e._rechokeOptimisticWire=o.wire,e._rechokeOptimisticTime=2)}t.forEach(function(e){e.wire.amChoking!==e.isChoked&&(e.isChoked?e.wire.choke():e.wire.unchoke())})}function s(e,t){return e.downloadSpeed!==t.downloadSpeed?t.downloadSpeed-e.downloadSpeed:e.uploadSpeed!==t.uploadSpeed?t.uploadSpeed-e.uploadSpeed:e.wire.amChoking!==t.wire.amChoking?e.wire.amChoking?1:-1:e.salt-t.salt}},Y.prototype._hotswap=function(e,t){var r=this,n=e.downloadSpeed();if(n<E.BLOCK_LENGTH)return!1;if(!this._reservations[t])return!1;var i=this._reservations[t];if(!i)return!1;var o=1/0,s,a;for(a=0;a<i.length;a++){var u=i[a];if(u&&u!==e){var c=u.downloadSpeed();c>=D||2*c>n||c>o||(s=u,o=c)}}if(!s)return!1;for(a=0;a<i.length;a++)i[a]===s&&(i[a]=null);for(a=0;a<s.requests.length;a++){var f=s.requests[a];f.piece===t&&this.pieces[t].cancel(f.offset/E.BLOCK_LENGTH|0)}return this.emit("hotswap",s,e,t),!0},Y.prototype._request=function(e,r,n){var i=this,o=e.requests.length,s="webSeed"===e.type;if(i.bitfield.get(r))return!1;var a=s?Math.min(X(e,1,i.pieceLength),i.maxWebConns):J(e,1);if(o>=a)return!1;var u=i.pieces[r],c=s?u.reserveRemaining():u.reserve();if(-1===c&&n&&i._hotswap(e,r)&&(c=s?u.reserveRemaining():u.reserve()),-1===c)return!1;var f=i._reservations[r];f||(f=i._reservations[r]=[]);var l=f.indexOf(null);-1===l&&(l=f.length),f[l]=e;var h=u.chunkOffset(c),p=s?u.chunkLengthRemaining(c):u.chunkLength(c);function d(){t.nextTick(function(){i._update()})}return e.request(r,h,p,function t(n,o){if(!i.destroyed){if(!i.ready)return i.once("ready",function(){t(n,o)});if(f[l]===e&&(f[l]=null),u!==i.pieces[r])return d();if(n)return i._debug("error getting piece %s (offset: %s length: %s) from %s: %s",r,h,p,e.remoteAddress+":"+e.remotePort,n.message),s?u.cancelRemaining(c):u.cancel(c),void d();if(i._debug("got piece %s (offset: %s length: %s) from %s",r,h,p,e.remoteAddress+":"+e.remotePort),!u.set(c,o,e))return d();var a=u.flush();I(a,function(e){if(!i.destroyed){if(e===i._hashes[r]){if(!i.pieces[r])return;i._debug("piece verified %s",r),i.pieces[r]=null,i._reservations[r]=null,i.bitfield.set(r,!0),i.store.put(r,a),i.wires.forEach(function(e){e.have(r)}),i._checkDone()&&!i.destroyed&&i.discovery.complete()}else i.pieces[r]=new E(u.length),i.emit("warning",new Error("Piece "+r+" failed verification"));d()}})}}),!0},Y.prototype._checkDone=function(){var e=this;if(!e.destroyed){e.files.forEach(function(t){if(!t.done){for(var r=t._startPiece;r<=t._endPiece;++r)if(!e.bitfield.get(r))return;t.done=!0,t.emit("done"),e._debug("file done: "+t.name)}});for(var t=!0,r=0;r<e._selections.length;r++){for(var n=e._selections[r],i=n.from;i<=n.to;i++)if(!e.bitfield.get(i)){t=!1;break}if(!t)break}return!e.done&&t&&(e.done=!0,e._debug("torrent done: "+e.infoHash),e.emit("done")),e._gcSelections(),t}},Y.prototype.load=function(e,t){var r=this;if(r.destroyed)throw new Error("torrent is destroyed");if(!r.ready)return r.once("ready",function(){r.load(e,t)});Array.isArray(e)||(e=[e]),t||(t=Q);var n=new m(e),i=new s(r.store,r.pieceLength);A(n,i,function(e){if(e)return t(e);r.pieces.forEach(function(e,t){r.pieces[t]=null,r._reservations[t]=null,r.bitfield.set(t,!0)}),r._checkDone(),t(null)})},Y.prototype.createServer=function(e){if("function"!=typeof L)throw new Error("node.js-only method");if(this.destroyed)throw new Error("torrent is destroyed");var t=new L(this,e);return this._servers.push(t),t},Y.prototype.pause=function(){this.destroyed||(this._debug("pause"),this.paused=!0)},Y.prototype.resume=function(){this.destroyed||(this._debug("resume"),this.paused=!1,this._drain())},Y.prototype._debug=function(){if(!this.destroyed){var e=[].slice.call(arguments);e[0]="["+this.client._debugId+"] ["+this._debugId+"] "+e[0],a.apply(null,e)}},Y.prototype._drain=function(){var e=this;if(this._debug("_drain numConns %s maxConns %s",e._numConns,e.client.maxConns),!("function"!=typeof b.connect||e.destroyed||e.paused||e._numConns>=e.client.maxConns)){this._debug("drain (%s queued, %s/%s peers)",e._numQueued,e.numPeers,e.client.maxConns);var t=e._queue.shift();if(t){this._debug("tcp connect attempt to %s",t.addr);var r=i(t.addr),n={host:r[0],port:r[1]},o=t.conn=b.connect(n);o.once("connect",function(){t.onConnect()}),o.once("error",function(e){t.destroy(e)}),t.startConnectTimeout(),o.on("close",function(){if(!e.destroyed)if(t.retries>=V.length)e._debug("conn %s closed: will not re-add (max %s attempts)",t.addr,V.length);else{var r=V[t.retries];e._debug("conn %s closed: will re-add to queue in %sms (attempt %s)",t.addr,r,t.retries+1);var n=setTimeout(function r(){var n=e._addPeer(t.addr);n&&(n.retries=t.retries+1)},r);n.unref&&n.unref()}})}}},Y.prototype._validAddr=function(e){var t;try{t=i(e)}catch(e){return!1}var r=t[0],n=t[1];return n>0&&n<65535&&!("127.0.0.1"===r&&n===this.client.torrentPort)}}).call(this,r(6),r(7))},function(e,t){const r=/^\[?([^\]]+)\]?:(\d+)$/;let n={},i=0;e.exports=function t(o){if(1e5===i&&e.exports.reset(),!n[o]){const e=r.exec(o);if(!e)throw new Error(`invalid addr: ${o}`);n[o]=[e[1],Number(e[2])],i+=1}return n[o]},e.exports.reset=function e(){n={},i=0}},function(e,t,r){e.exports=s;var n=r(596),i=r(4),o=r(21);function s(e,t,r){var i=this;if(!(i instanceof s))return new s(e,t,r);if(o.Writable.call(i,r),r||(r={}),!e||!e.put||!e.get)throw new Error("First argument must be an abstract-chunk-store compliant store");if(t=Number(t),!t)throw new Error("Second argument must be a chunk length");i._blockstream=new n(t,{zeroPadding:!1}),i._blockstream.on("data",u).on("error",function(e){i.destroy(e)});var a=0;function u(t){i.destroyed||(e.put(a,t),a+=1)}i.on("finish",function(){this._blockstream.end()})}i(s,o.Writable),s.prototype._write=function(e,t,r){this._blockstream.write(e,t,r)},s.prototype.destroy=function(e){this.destroyed||(this.destroyed=!0,e&&this.emit("error",e),this.emit("close"))}},function(e,t,r){(function(t){e.exports=f;var n=r(1)("torrent-discovery"),i=r(1487),o=r(10).EventEmitter,s=r(27),a=r(4),u=r(148),c=r(1488);function f(e){var r=this;if(!(r instanceof f))return new f(e);if(o.call(r),!e.peerId)throw new Error("Option `peerId` is required");if(!e.infoHash)throw new Error("Option `infoHash` is required");if(!t.browser&&!e.port)throw new Error("Option `port` is required");function n(e,t){var n=new i(t);return n.on("warning",r._onWarning),n.on("error",r._onError),n.listen(e),r._internalDHT=!0,n}r.peerId="string"==typeof e.peerId?e.peerId:e.peerId.toString("hex"),r.infoHash="string"==typeof e.infoHash?e.infoHash.toLowerCase():e.infoHash.toString("hex"),r._port=e.port,r._userAgent=e.userAgent,r.destroyed=!1,r._announce=e.announce||[],r._intervalMs=e.intervalMs||9e5,r._trackerOpts=null,r._dhtAnnouncing=!1,r._dhtTimeout=!1,r._internalDHT=!1,r._onWarning=function(e){r.emit("warning",e)},r._onError=function(e){r.emit("error",e)},r._onDHTPeer=function(e,t){t.toString("hex")===r.infoHash&&r.emit("peer",e.host+":"+e.port,"dht")},r._onTrackerPeer=function(e){r.emit("peer",e,"tracker")},r._onTrackerAnnounce=function(){r.emit("trackerAnnounce")},!1===e.tracker?r.tracker=null:e.tracker&&"object"==typeof e.tracker?(r._trackerOpts=s(e.tracker),r.tracker=r._createTracker()):r.tracker=r._createTracker(),!1===e.dht||"function"!=typeof i?r.dht=null:e.dht&&"function"==typeof e.dht.addNode?r.dht=e.dht:e.dht&&"object"==typeof e.dht?r.dht=n(e.dhtPort,e.dht):r.dht=n(e.dhtPort),r.dht&&(r.dht.on("peer",r._onDHTPeer),r._dhtAnnounce())}a(f,o),f.prototype.updatePort=function(e){var t=this;e!==t._port&&(t._port=e,t.dht&&t._dhtAnnounce(),t.tracker&&(t.tracker.stop(),t.tracker.destroy(function(){t.tracker=t._createTracker()})))},f.prototype.complete=function(e){this.tracker&&this.tracker.complete(e)},f.prototype.destroy=function(e){var t=this;if(!t.destroyed){t.destroyed=!0,clearTimeout(t._dhtTimeout);var r=[];t.tracker&&(t.tracker.stop(),t.tracker.removeListener("warning",t._onWarning),t.tracker.removeListener("error",t._onError),t.tracker.removeListener("peer",t._onTrackerPeer),t.tracker.removeListener("update",t._onTrackerAnnounce),r.push(function(e){t.tracker.destroy(e)})),t.dht&&t.dht.removeListener("peer",t._onDHTPeer),t._internalDHT&&(t.dht.removeListener("warning",t._onWarning),t.dht.removeListener("error",t._onError),r.push(function(e){t.dht.destroy(e)})),u(r,e),t.dht=null,t.tracker=null,t._announce=null}},f.prototype._createTracker=function(){var e=s(this._trackerOpts,{infoHash:this.infoHash,announce:this._announce,peerId:this.peerId,port:this._port,userAgent:this._userAgent}),t=new c(e);return t.on("warning",this._onWarning),t.on("error",this._onError),t.on("peer",this._onTrackerPeer),t.on("update",this._onTrackerAnnounce),t.setInterval(this._intervalMs),t.start(),t},f.prototype._dhtAnnounce=function(){var e=this;function t(){return e._intervalMs+Math.floor(Math.random()*e._intervalMs/5)}e._dhtAnnouncing||(n("dht announce"),e._dhtAnnouncing=!0,clearTimeout(e._dhtTimeout),e.dht.announce(e.infoHash,e._port,function(r){e._dhtAnnouncing=!1,n("dht announce complete"),r&&e.emit("warning",r),e.emit("dhtAnnounce"),e.destroyed||(e._dhtTimeout=setTimeout(function(){e._dhtAnnounce()},t()),e._dhtTimeout.unref&&e._dhtTimeout.unref())}))}}).call(this,r(6))},function(e,t){},function(e,t,r){(function(t){e.exports=m;var n=r(2).Buffer,i=r(1)("bittorrent-tracker:client"),o=r(10).EventEmitter,s=r(27),a=r(4),u=r(35),c=r(148),f=r(191),l=r(202),h=r(36),p=r(603),d=r(1490),y=r(1491),g=r(1492);function m(e){var r=this;if(!(r instanceof m))return new m(e);if(o.call(r),e||(e={}),!e.peerId)throw new Error("Option `peerId` is required");if(!e.infoHash)throw new Error("Option `infoHash` is required");if(!e.announce)throw new Error("Option `announce` is required");if(!t.browser&&!e.port)throw new Error("Option `port` is required");r.peerId="string"==typeof e.peerId?e.peerId:e.peerId.toString("hex"),r._peerIdBuffer=n.from(r.peerId,"hex"),r._peerIdBinary=r._peerIdBuffer.toString("binary"),r.infoHash="string"==typeof e.infoHash?e.infoHash.toLowerCase():e.infoHash.toString("hex"),r._infoHashBuffer=n.from(r.infoHash,"hex"),r._infoHashBinary=r._infoHashBuffer.toString("binary"),i("new client %s",r.infoHash),r.destroyed=!1,r._port=e.port,r._getAnnounceOpts=e.getAnnounceOpts,r._rtcConfig=e.rtcConfig,r._userAgent=e.userAgent,r._wrtc="function"==typeof e.wrtc?e.wrtc():e.wrtc;var s="string"==typeof e.announce?[e.announce]:null==e.announce?[]:e.announce;s=s.map(function(e){return e=e.toString(),"/"===e[e.length-1]&&(e=e.substring(0,e.length-1)),e}),s=l(s);var a=!1!==r._wrtc&&(!!r._wrtc||f.WEBRTC_SUPPORT);function u(e){t.nextTick(function(){r.emit("warning",e)})}r._trackers=s.map(function(e){var t=h.parse(e).protocol;return"http:"!==t&&"https:"!==t||"function"!=typeof d?"udp:"===t&&"function"==typeof y?new y(r,e):"ws:"!==t&&"wss:"!==t||!a?(u(new Error("Unsupported tracker protocol: "+e)),null):"ws:"===t&&"undefined"!=typeof window&&"https:"===window.location.protocol?(u(new Error("Unsupported tracker protocol: "+e)),null):new g(r,e):new d(r,e)}).filter(Boolean)}a(m,o),m.scrape=function(e,t){if(t=u(t),!e.infoHash)throw new Error("Option `infoHash` is required");if(!e.announce)throw new Error("Option `announce` is required");var r=s(e,{infoHash:Array.isArray(e.infoHash)?e.infoHash[0]:e.infoHash,peerId:n.from("01234567890123456789"),port:6881}),i=new m(r);i.once("error",t),i.once("warning",t);var o=Array.isArray(e.infoHash)?e.infoHash.length:1,a={};return i.on("scrape",function(e){if(o-=1,a[e.infoHash]=e,0===o){i.destroy();var r=Object.keys(a);1===r.length?t(null,a[r[0]]):t(null,a)}}),e.infoHash=Array.isArray(e.infoHash)?e.infoHash.map(function(e){return n.from(e,"hex")}):n.from(e.infoHash,"hex"),i.scrape({infoHash:e.infoHash}),i},m.prototype.start=function(e){var t=this;i("send `start`"),e=this._defaultAnnounceOpts(e),e.event="started",this._announce(e),this._trackers.forEach(function(e){e.setInterval()})},m.prototype.stop=function(e){var t=this;i("send `stop`"),e=this._defaultAnnounceOpts(e),e.event="stopped",this._announce(e)},m.prototype.complete=function(e){var t=this;i("send `complete`"),e||(e={}),e=this._defaultAnnounceOpts(e),e.event="completed",this._announce(e)},m.prototype.update=function(e){var t=this;i("send `update`"),e=this._defaultAnnounceOpts(e),e.event&&delete e.event,this._announce(e)},m.prototype._announce=function(e){var t=this;this._trackers.forEach(function(t){t.announce(e)})},m.prototype.scrape=function(e){var t=this;i("send `scrape`"),e||(e={}),this._trackers.forEach(function(t){t.scrape(e)})},m.prototype.setInterval=function(e){var t=this;i("setInterval %d",e),this._trackers.forEach(function(t){t.setInterval(e)})},m.prototype.destroy=function(e){var t=this;if(!this.destroyed){this.destroyed=!0,i("destroy");var r=this._trackers.map(function(e){return function(t){e.destroy(t)}});c(r,e),this._trackers=[],this._getAnnounceOpts=null}},m.prototype._defaultAnnounceOpts=function(e){var t=this;return e||(e={}),null==e.numwant&&(e.numwant=p.DEFAULT_ANNOUNCE_PEERS),null==e.uploaded&&(e.uploaded=0),null==e.downloaded&&(e.downloaded=0),this._getAnnounceOpts&&(e=s(e,this._getAnnounceOpts())),e}}).call(this,r(6))},function(e,t){},function(e,t){},function(e,t){},function(e,t,r){e.exports=g;var n=r(1)("bittorrent-tracker:websocket-tracker"),i=r(27),o=r(4),s=r(191),a=r(110),u=r(1493),c=r(603),f=r(1495),l={};g._socketPool=l;var h=15e3,p=18e5,d=3e4,y=5e4;function g(e,t,r){var i=this;f.call(this,e,t),n("new websocket tracker %s",t),this.peers={},this.socket=null,this.reconnecting=!1,this.retries=0,this.reconnectTimer=null,this.expectingResponse=!1,this._openSocket()}function m(){}o(g,f),g.prototype.DEFAULT_ANNOUNCE_INTERVAL=3e4,g.prototype.announce=function(e){var t=this;if(!t.destroyed&&!t.reconnecting)if(t.socket.connected){var r=i(e,{action:"announce",info_hash:t.client._infoHashBinary,peer_id:t.client._peerIdBinary});if(t._trackerId&&(r.trackerid=t._trackerId),"stopped"===e.event||"completed"===e.event)t._send(r);else{var n=Math.min(e.numwant,10);t._generateOffers(n,function(e){r.numwant=n,r.offers=e,t._send(r)})}}else t.socket.once("connect",function(){t.announce(e)})},g.prototype.scrape=function(e){var t=this;if(!t.destroyed&&!t.reconnecting)if(t.socket.connected){var r=Array.isArray(e.infoHash)&&e.infoHash.length>0?e.infoHash.map(function(e){return e.toString("binary")}):e.infoHash&&e.infoHash.toString("binary")||t.client._infoHashBinary,n={action:"scrape",info_hash:r};t._send(n)}else t.socket.once("connect",function(){t.scrape(e)})},g.prototype.destroy=function(e){var t=this;if(e||(e=m),this.destroyed)return e(null);for(var r in this.destroyed=!0,clearInterval(this.interval),clearTimeout(this.reconnectTimer),this.peers){var n=this.peers[r];clearTimeout(n.trackerTimeout),n.destroy()}if(this.peers=null,this.socket&&(this.socket.removeListener("connect",this._onSocketConnectBound),this.socket.removeListener("data",this._onSocketDataBound),this.socket.removeListener("close",this._onSocketCloseBound),this.socket.removeListener("error",this._onSocketErrorBound),this.socket=null),this._onSocketConnectBound=null,this._onSocketErrorBound=null,this._onSocketDataBound=null,this._onSocketCloseBound=null,l[this.announceUrl]&&(l[this.announceUrl].consumers-=1),l[this.announceUrl].consumers>0)return e();var i=l[this.announceUrl];if(delete l[this.announceUrl],i.on("error",m),i.once("close",e),!this.expectingResponse)return s();var o=setTimeout(s,c.DESTROY_TIMEOUT);function s(){o&&(clearTimeout(o),o=null),i.removeListener("data",s),i.destroy(),i=null}i.once("data",s)},g.prototype._openSocket=function(){var e=this;e.destroyed=!1,e.peers||(e.peers={}),e._onSocketConnectBound=function(){e._onSocketConnect()},e._onSocketErrorBound=function(t){e._onSocketError(t)},e._onSocketDataBound=function(t){e._onSocketData(t)},e._onSocketCloseBound=function(){e._onSocketClose()},e.socket=l[e.announceUrl],e.socket?l[e.announceUrl].consumers+=1:(e.socket=l[e.announceUrl]=new u(e.announceUrl),e.socket.consumers=1,e.socket.once("connect",e._onSocketConnectBound)),e.socket.on("data",e._onSocketDataBound),e.socket.once("close",e._onSocketCloseBound),e.socket.once("error",e._onSocketErrorBound)},g.prototype._onSocketConnect=function(){var e=this;this.destroyed||this.reconnecting&&(this.reconnecting=!1,this.retries=0,this.announce(this.client._defaultAnnounceOpts()))},g.prototype._onSocketData=function(e){var t=this;if(!this.destroyed){this.expectingResponse=!1;try{e=JSON.parse(e)}catch(e){return void this.client.emit("warning",new Error("Invalid tracker response"))}"announce"===e.action?this._onAnnounceResponse(e):"scrape"===e.action?this._onScrapeResponse(e):this._onSocketError(new Error("invalid action in WS response: "+e.action))}},g.prototype._onAnnounceResponse=function(e){var t=this;if(e.info_hash===t.client._infoHashBinary){if(!e.peer_id||e.peer_id!==t.client._peerIdBinary){n("received %s from %s for %s",JSON.stringify(e),t.announceUrl,t.client.infoHash);var r=e["failure reason"];if(r)return t.client.emit("warning",new Error(r));var i=e["warning message"];i&&t.client.emit("warning",new Error(i));var o=e.interval||e["min interval"];o&&t.setInterval(1e3*o);var s=e["tracker id"],a;if(s&&(t._trackerId=s),null!=e.complete){var u=Object.assign({},e,{announce:t.announceUrl,infoHash:c.binaryToHex(e.info_hash)});t.client.emit("update",u)}if(e.offer&&e.peer_id&&(n("creating peer (from remote offer)"),a=t._createPeer(),a.id=c.binaryToHex(e.peer_id),a.once("signal",function(r){var n={action:"announce",info_hash:t.client._infoHashBinary,peer_id:t.client._peerIdBinary,to_peer_id:e.peer_id,answer:r,offer_id:e.offer_id};t._trackerId&&(n.trackerid=t._trackerId),t._send(n)}),a.signal(e.offer),t.client.emit("peer",a)),e.answer&&e.peer_id){var f=c.binaryToHex(e.offer_id);a=t.peers[f],a?(a.id=c.binaryToHex(e.peer_id),a.signal(e.answer),t.client.emit("peer",a),clearTimeout(a.trackerTimeout),a.trackerTimeout=null,delete t.peers[f]):n("got unexpected answer: "+JSON.stringify(e.answer))}}}else n("ignoring websocket data from %s for %s (looking for %s: reused socket)",t.announceUrl,c.binaryToHex(e.info_hash),t.client.infoHash)},g.prototype._onScrapeResponse=function(e){var t=this;e=e.files||{};var r=Object.keys(e);0!==r.length?r.forEach(function(r){var n=Object.assign(e[r],{announce:t.announceUrl,infoHash:c.binaryToHex(r)});t.client.emit("scrape",n)}):t.client.emit("warning",new Error("invalid scrape response"))},g.prototype._onSocketClose=function(){var e=this;this.destroyed||(this.destroy(),this._startReconnectTimer())},g.prototype._onSocketError=function(e){var t=this;this.destroyed||(this.destroy(),this.client.emit("warning",e),this._startReconnectTimer())},g.prototype._startReconnectTimer=function(){var e=this,t=Math.floor(3e4*Math.random())+Math.min(15e3*Math.pow(2,e.retries),18e5);e.reconnecting=!0,clearTimeout(e.reconnectTimer),e.reconnectTimer=setTimeout(function(){e.retries++,e._openSocket()},t),e.reconnectTimer.unref&&e.reconnectTimer.unref(),n("reconnecting socket in %s ms",t)},g.prototype._send=function(e){var t=this;if(!this.destroyed){this.expectingResponse=!0;var r=JSON.stringify(e);n("send %s",r),this.socket.send(r)}},g.prototype._generateOffers=function(e,t){var r=this,i=[];n("generating %s offers",e);for(var o=0;o<e;++o)s();function s(){var e=a(20).toString("hex");n("creating peer (from _generateOffers)");var t=r.peers[e]=r._createPeer({initiator:!0});t.once("signal",function(t){i.push({offer:t,offer_id:c.hexToBinary(e)}),u()}),t.trackerTimeout=setTimeout(function(){n("tracker timeout: destroying peer"),t.trackerTimeout=null,delete r.peers[e],t.destroy()},y),t.trackerTimeout.unref&&t.trackerTimeout.unref()}function u(){i.length===e&&(n("generated %s offers",e),t(i))}u()},g.prototype._createPeer=function(e){var t=this;e=Object.assign({trickle:!1,config:t.client._rtcConfig,wrtc:t.client._wrtc},e);var r=new s(e);return r.once("error",n),r.once("connect",i),r;function n(e){t.client.emit("warning",new Error("Connection error: "+e.message)),r.destroy()}function i(){r.removeListener("error",n),r.removeListener("connect",i)}}},function(e,t,r){(function(t,n){e.exports=l;var i=r(1)("simple-websocket"),o=r(4),s=r(110),a=r(21),u=r(1494),c="function"!=typeof u?WebSocket:u,f=65536;function l(e){var r=this;if(!(r instanceof l))return new l(e);if(e||(e={}),"string"==typeof e&&(e={url:e}),null==e.url&&null==e.socket)throw new Error("Missing required `url` or `socket` option");if(null!=e.url&&null!=e.socket)throw new Error("Must specify either `url` or `socket` option, not both");if(r._id=s(4).toString("hex").slice(0,7),r._debug("new websocket: %o",e),e=Object.assign({allowHalfOpen:!1},e),a.Duplex.call(r,e),r.connected=!1,r.destroyed=!1,r._chunk=null,r._cb=null,r._interval=null,e.socket)r.url=e.socket.url,r._ws=e.socket;else{r.url=e.url;try{r._ws="function"==typeof u?new c(e.url,e):new c(e.url)}catch(e){return void t.nextTick(function(){r.destroy(e)})}}r._ws.binaryType="arraybuffer",r._ws.onopen=function(){r._onOpen()},r._ws.onmessage=function(e){r._onMessage(e)},r._ws.onclose=function(){r._onClose()},r._ws.onerror=function(){r.destroy(new Error("connection error to "+r.url))},r._onFinishBound=function(){r._onFinish()},r.once("finish",r._onFinishBound)}o(l,a.Duplex),l.WEBSOCKET_SUPPORT=!!c,l.prototype.send=function(e){this._ws.send(e)},l.prototype.destroy=function(e){this._destroy(e,function(){})},l.prototype._destroy=function(e,t){var r=this;if(!this.destroyed){if(this._debug("destroy (error: %s)",e&&(e.message||e)),this.readable=this.writable=!1,this._readableState.ended||this.push(null),this._writableState.finished||this.end(),this.connected=!1,this.destroyed=!0,clearInterval(this._interval),this._interval=null,this._chunk=null,this._cb=null,this._onFinishBound&&this.removeListener("finish",this._onFinishBound),this._onFinishBound=null,this._ws){var n=this._ws,i=function(){n.onclose=null};if(n.readyState===c.CLOSED)i();else try{n.onclose=i,n.close()}catch(e){i()}n.onopen=null,n.onmessage=null,n.onerror=function(){}}if(this._ws=null,e){if("undefined"!=typeof DOMException&&e instanceof DOMException){var o=e.code;e=new Error(e.message),e.code=o}this.emit("error",e)}this.emit("close"),t()}},l.prototype._read=function(){},l.prototype._write=function(e,t,r){if(this.destroyed)return r(new Error("cannot write after socket is destroyed"));if(this.connected){try{this.send(e)}catch(e){return this.destroy(e)}"function"!=typeof u&&this._ws.bufferedAmount>65536?(this._debug("start backpressure: bufferedAmount %d",this._ws.bufferedAmount),this._cb=r):r(null)}else this._debug("write before connect"),this._chunk=e,this._cb=r},l.prototype._onFinish=function(){var e=this;function t(){setTimeout(function(){e.destroy()},1e3)}e.destroyed||(e.connected?t():e.once("connect",t))},l.prototype._onMessage=function(e){if(!this.destroyed){var t=e.data;t instanceof ArrayBuffer&&(t=n.from(t)),this.push(t)}},l.prototype._onOpen=function(){var e=this;if(!e.connected&&!e.destroyed){if(e.connected=!0,e._chunk){try{e.send(e._chunk)}catch(t){return e.destroy(t)}e._chunk=null,e._debug('sent chunk from "write before connect"');var t=e._cb;e._cb=null,t(null)}"function"!=typeof u&&(e._interval=setInterval(function(){e._onInterval()},150),e._interval.unref&&e._interval.unref()),e._debug("connect"),e.emit("connect")}},l.prototype._onInterval=function(){if(this._cb&&this._ws&&!(this._ws.bufferedAmount>65536)){this._debug("ending backpressure: bufferedAmount %d",this._ws.bufferedAmount);var e=this._cb;this._cb=null,e(null)}},l.prototype._onClose=function(){this.destroyed||(this._debug("on close"),this.destroy())},l.prototype._debug=function(){var e=[].slice.call(arguments);e[0]="["+this._id+"] "+e[0],i.apply(null,e)}}).call(this,r(6),r(0).Buffer)},function(e,t){},function(e,t,r){e.exports=o;var n=r(10).EventEmitter,i=r(4);function o(e,t){var r=this;n.call(this),this.client=e,this.announceUrl=t,this.interval=null,this.destroyed=!1}i(o,n),o.prototype.setInterval=function(e){var t=this;null==e&&(e=t.DEFAULT_ANNOUNCE_INTERVAL),clearInterval(t.interval),e&&(t.interval=setInterval(function(){t.announce(t.client._defaultAnnounceOpts())},e),t.interval.unref&&t.interval.unref())}},function(e,t,r){(function(t){function r(e,t){if(!(this instanceof r))return new r(e,t);if(t||(t={}),this.chunkLength=Number(e),!this.chunkLength)throw new Error("First argument must be a chunk length");this.chunks=[],this.closed=!1,this.length=Number(t.length)||1/0,this.length!==1/0&&(this.lastChunkLength=this.length%this.chunkLength||this.chunkLength,this.lastChunkIndex=Math.ceil(this.length/this.chunkLength)-1)}function n(e,r,n){t.nextTick(function(){e&&e(r,n)})}e.exports=r,r.prototype.put=function(e,t,r){if(this.closed)return n(r,new Error("Storage is closed"));var i=e===this.lastChunkIndex;return i&&t.length!==this.lastChunkLength?n(r,new Error("Last chunk length must be "+this.lastChunkLength)):i||t.length===this.chunkLength?(this.chunks[e]=t,void n(r,null)):n(r,new Error("Chunk length must be "+this.chunkLength))},r.prototype.get=function(e,t,r){if("function"==typeof t)return this.get(e,null,t);if(this.closed)return n(r,new Error("Storage is closed"));var i=this.chunks[e];if(!i){var o=new Error("Chunk not found");return o.notFound=!0,n(r,o)}if(!t)return n(r,null,i);var s=t.offset||0,a=t.length||i.length-s;n(r,null,i.slice(s,a+s))},r.prototype.close=r.prototype.destroy=function(e){if(this.closed)return n(e,new Error("Storage is closed"));this.closed=!0,this.chunks=null,n(e,null)}}).call(this,r(6))},function(e,t){},function(e,t,r){(function(t){function r(e){if(!(this instanceof r))return new r(e);if(this.store=e,this.chunkLength=e.chunkLength,!this.store||!this.store.get||!this.store.put)throw new Error("First argument must be abstract-chunk-store compliant");this.mem=[]}function n(e,r,n){t.nextTick(function(){e&&e(r,n)})}e.exports=r,r.prototype.put=function(e,t,r){var n=this;n.mem[e]=t,n.store.put(e,t,function(t){n.mem[e]=null,r&&r(t)})},r.prototype.get=function(e,t,r){if("function"==typeof t)return this.get(e,null,t);var i=t&&t.offset||0,o=t&&t.length&&i+t.length,s=this.mem[e];if(s)return n(r,null,t?s.slice(i,o):s);this.store.get(e,t,r)},r.prototype.close=function(e){this.store.close(e)},r.prototype.destroy=function(e){this.store.destroy(e)}}).call(this,r(6))},function(e,t){},function(e,t){},function(e,t,r){(function(t){function r(e,r,n){if("number"!=typeof r)throw new Error("second argument must be a Number");var i,o,s,a,u,c=!0;function f(e){function r(){n&&n(e,i),n=null}c?t.nextTick(r):r()}function l(t,r,n){if(i[t]=n,r&&(u=!0),0==--s||r)f(r);else if(!u&&h<o){var c;a?(c=a[h],h+=1,e[c](function(e,t){l(c,e,t)})):(c=h,h+=1,e[c](function(e,t){l(c,e,t)}))}}Array.isArray(e)?(i=[],s=o=e.length):(a=Object.keys(e),i={},s=o=a.length);var h=r;s?a?a.some(function(t,n){if(e[t](function(e,r){l(t,e,r)}),n===r-1)return!0}):e.some(function(e,t){if(e(function(e,r){l(t,e,r)}),t===r-1)return!0}):f(null),c=!1}e.exports=r}).call(this,r(6))},function(e,t,r){(function(t){e.exports=n;var r=16384;function n(e){if(!(this instanceof n))return new n(e);this.length=e,this.missing=e,this.sources=null,this._chunks=Math.ceil(e/r),this._remainder=e%r||r,this._buffered=0,this._buffer=null,this._cancellations=null,this._reservations=0,this._flushed=!1}n.BLOCK_LENGTH=r,n.prototype.chunkLength=function(e){return e===this._chunks-1?this._remainder:r},n.prototype.chunkLengthRemaining=function(e){return this.length-e*r},n.prototype.chunkOffset=function(e){return e*r},n.prototype.reserve=function(){return this.init()?this._cancellations.length?this._cancellations.pop():this._reservations<this._chunks?this._reservations++:-1:-1},n.prototype.reserveRemaining=function(){if(!this.init())return-1;if(this._reservations<this._chunks){var e=this._reservations;return this._reservations=this._chunks,e}return-1},n.prototype.cancel=function(e){this.init()&&this._cancellations.push(e)},n.prototype.cancelRemaining=function(e){this.init()&&(this._reservations=e)},n.prototype.get=function(e){return this.init()?this._buffer[e]:null},n.prototype.set=function(e,t,n){if(!this.init())return!1;for(var i=t.length,o=Math.ceil(i/r),s=0;s<o;s++)if(!this._buffer[e+s]){var a=s*r,u=t.slice(a,a+r);this._buffered++,this._buffer[e+s]=u,this.missing-=u.length,-1===this.sources.indexOf(n)&&this.sources.push(n)}return this._buffered===this._chunks},n.prototype.flush=function(){if(!this._buffer||this._chunks!==this._buffered)return null;var e=t.concat(this._buffer,this.length);return this._buffer=null,this._cancellations=null,this.sources=null,this._flushed=!0,e},n.prototype.init=function(){return!this._flushed&&(!!this._buffer||(this._buffer=new Array(this._chunks),this._cancellations=[],this.sources=[],!0))}}).call(this,r(0).Buffer)},function(e,t){var r=function(e){var t=0;return function(){if(t===e.length)return null;var r=e.length-t,n=Math.random()*r|0,i=e[t+n],o=e[t];return e[t]=i,e[t+n]=o,t++,i}};e.exports=r},function(e,t,r){var n=r(201),i=r(203),o=r(2).Buffer,s=r(1)("ut_metadata"),a=r(10).EventEmitter,u=r(4),c=r(149),f=1e7,l=1e3,h=16384;e.exports=function(e){function t(t){a.call(this),this._wire=t,this._metadataComplete=!1,this._metadataSize=null,this._remainingRejects=null,this._fetching=!1,this._bitfield=new i(0,{grow:l}),o.isBuffer(e)&&this.setMetadata(e)}return u(t,a),t.prototype.name="ut_metadata",t.prototype.onHandshake=function(e,t,r){this._infoHash=e},t.prototype.onExtendedHandshake=function(e){return e.m&&e.m.ut_metadata?e.metadata_size?"number"!=typeof e.metadata_size||1e7<e.metadata_size||e.metadata_size<=0?this.emit("warning",new Error("Peer gave invalid metadata size")):(this._metadataSize=e.metadata_size,this._numPieces=Math.ceil(this._metadataSize/16384),this._remainingRejects=2*this._numPieces,void(this._fetching&&this._requestPieces())):this.emit("warning",new Error("Peer does not have metadata")):this.emit("warning",new Error("Peer does not support ut_metadata"))},t.prototype.onMessage=function(e){var t,r;try{var i=e.toString(),o=i.indexOf("ee")+2;t=n.decode(i.substring(0,o)),r=e.slice(o)}catch(e){return}switch(t.msg_type){case 0:this._onRequest(t.piece);break;case 1:this._onData(t.piece,r,t.total_size);break;case 2:this._onReject(t.piece)}},t.prototype.fetch=function(){this._metadataComplete||(this._fetching=!0,this._metadataSize&&this._requestPieces())},t.prototype.cancel=function(){this._fetching=!1},t.prototype.setMetadata=function(e){if(this._metadataComplete)return!0;s("set metadata");try{var t=n.decode(e).info;t&&(e=n.encode(t))}catch(e){}return(!this._infoHash||this._infoHash===c.sync(e))&&(this.cancel(),this.metadata=e,this._metadataComplete=!0,this._metadataSize=this.metadata.length,this._wire.extendedHandshake.metadata_size=this._metadataSize,this.emit("metadata",n.encode({info:n.decode(this.metadata)})),!0)},t.prototype._send=function(e,t){var r=n.encode(e);o.isBuffer(t)&&(r=o.concat([r,t])),this._wire.extended("ut_metadata",r)},t.prototype._request=function(e){this._send({msg_type:0,piece:e})},t.prototype._data=function(e,t,r){var n={msg_type:1,piece:e};"number"==typeof r&&(n.total_size=r),this._send(n,t)},t.prototype._reject=function(e){this._send({msg_type:2,piece:e})},t.prototype._onRequest=function(e){if(this._metadataComplete){var t=16384*e,r=t+16384;r>this._metadataSize&&(r=this._metadataSize);var n=this.metadata.slice(t,r);this._data(e,n,this._metadataSize)}else this._reject(e)},t.prototype._onData=function(e,t,r){t.length>16384||(t.copy(this.metadata,16384*e),this._bitfield.set(e),this._checkDone())},t.prototype._onReject=function(e){this._remainingRejects>0&&this._fetching?(this._request(e),this._remainingRejects-=1):this.emit("warning",new Error('Peer sent "reject" too much'))},t.prototype._requestPieces=function(){this.metadata=o.alloc(this._metadataSize);for(var e=0;e<this._numPieces;e++)this._request(e)},t.prototype._checkDone=function(){for(var e=!0,t=0;t<this._numPieces;t++)if(!this._bitfield.get(t)){e=!1;break}if(e){var r=this.setMetadata(this.metadata);r||this._failedMetadata()}},t.prototype._failedMetadata=function(){this._bitfield=new i(0,{grow:l}),this._remainingRejects-=this._numPieces,this._remainingRejects>0?this._requestPieces():this.emit("warning",new Error("Peer sent invalid metadata"))},t}},function(e,t){},function(e,t,r){(function(t){e.exports=p;var n=r(291),i=r(10).EventEmitter,o=r(1507),s=r(4),a=r(55),u=r(1508),c=r(21),f=r(608),l=r(607),h=r(1523);function p(e,t){i.call(this),this._torrent=e,this._destroyed=!1,this.name=t.name,this.path=t.path,this.length=t.length,this.offset=t.offset,this.done=!1;var r=t.offset,n=r+t.length-1;this._startPiece=r/this._torrent.pieceLength|0,this._endPiece=n/this._torrent.pieceLength|0,0===this.length&&(this.done=!0,this.emit("done"))}s(p,i),Object.defineProperty(p.prototype,"downloaded",{get:function(){if(!this._torrent.bitfield)return 0;for(var e=0,t=this._startPiece;t<=this._endPiece;++t)if(this._torrent.bitfield.get(t))e+=t===this._endPiece?this._torrent.lastPieceLength:this._torrent.pieceLength;else{var r=this._torrent.pieces[t];e+=r.length-r.missing}return e}}),Object.defineProperty(p.prototype,"progress",{get:function(){return this.length?this.downloaded/this.length:0}}),p.prototype.select=function(e){0!==this.length&&this._torrent.select(this._startPiece,this._endPiece,e)},p.prototype.deselect=function(){0!==this.length&&this._torrent.deselect(this._startPiece,this._endPiece,!1)},p.prototype.createReadStream=function(e){var r=this;if(0===this.length){var i=new c.PassThrough;return t.nextTick(function(){i.end()}),i}var s=new o(r,e);return r._torrent.select(s._startPiece,s._endPiece,!0,function(){s._notify()}),n(s,function(){r._destroyed||r._torrent.destroyed||r._torrent.deselect(s._startPiece,s._endPiece,!0)}),s},p.prototype.getBuffer=function(e){h(this.createReadStream(),this.length,e)},p.prototype.getBlob=function(e){if("undefined"==typeof window)throw new Error("browser-only method");f(this.createReadStream(),this._getMimeType(),e)},p.prototype.getBlobURL=function(e){if("undefined"==typeof window)throw new Error("browser-only method");l(this.createReadStream(),this._getMimeType(),e)},p.prototype.appendTo=function(e,t,r){if("undefined"==typeof window)throw new Error("browser-only method");u.append(this,e,t,r)},p.prototype.renderTo=function(e,t,r){if("undefined"==typeof window)throw new Error("browser-only method");u.render(this,e,t,r)},p.prototype._getMimeType=function(){return u.mime[a.extname(this.name).toLowerCase()]},p.prototype._destroy=function(){this._destroyed=!0,this._torrent=null}}).call(this,r(6))},function(e,t,r){e.exports=s;var n=r(1)("webtorrent:file-stream"),i=r(4),o=r(21);function s(e,t){o.Readable.call(this,t),this.destroyed=!1,this._torrent=e._torrent;var r=t&&t.start||0,n=t&&t.end&&t.end<e.length?t.end:e.length-1,i=e._torrent.pieceLength;this._startPiece=(r+e.offset)/i|0,this._endPiece=(n+e.offset)/i|0,this._piece=this._startPiece,this._offset=r+e.offset-this._startPiece*i,this._missing=n-r+1,this._reading=!1,this._notifying=!1,this._criticalLength=Math.min(1048576/i|0,2)}i(s,o.Readable),s.prototype._read=function(){this._reading||(this._reading=!0,this._notify())},s.prototype._notify=function(){var e=this;if(e._reading&&0!==e._missing){if(!e._torrent.bitfield.get(e._piece))return e._torrent.critical(e._piece,e._piece+e._criticalLength);if(!e._notifying){if(e._notifying=!0,e._torrent.destroyed)return e._destroy(new Error("Torrent removed"));var t=e._piece;e._torrent.store.get(t,function(r,i){if(e._notifying=!1,!e.destroyed){if(r)return e._destroy(r);n("read %s (length %s) (err %s)",t,i.length,r&&r.message),e._offset&&(i=i.slice(e._offset),e._offset=0),e._missing<i.length&&(i=i.slice(0,e._missing)),e._missing-=i.length,n("pushing buffer of length %s",i.length),e._reading=!1,e.push(i),0===e._missing&&e.push(null)}}),e._piece+=1}}},s.prototype.destroy=function(e){this._destroy(null,e)},s.prototype._destroy=function(e,t){this.destroyed||(this.destroyed=!0,this._torrent.destroyed||this._torrent.deselect(this._startPiece,this._endPiece,!0),e&&this.emit("error",e),this.emit("close"),t&&t())}},function(e,t,r){t.render=b,t.append=v,t.mime=r(1509);var n=r(1)("render-media"),i=r(1510),o=r(606),s=r(55),a=r(607),u=r(1511),c=[".m4a",".m4v",".mp4"],f=[".m4v",".mkv",".mp4",".webm"],l=[".m4a",".mp3"],h=[].concat(f,l),p=[".aac",".oga",".ogg",".wav",".flac"],d=[".bmp",".gif",".jpeg",".jpg",".png",".svg"],y=[".css",".html",".js",".md",".pdf",".txt"],g=2e8,m="undefined"!=typeof window&&window.MediaSource;function b(e,t,r,n){"function"==typeof r&&(n=r,r={}),r||(r={}),n||(n=function(){}),S(e),E(r),"string"==typeof t&&(t=document.querySelector(t)),_(e,function(r){if(t.nodeName!==r.toUpperCase()){var n=s.extname(e.name).toLowerCase();throw new Error('Cannot render "'+n+'" inside a "'+t.nodeName.toLowerCase()+'" element, expected "'+r+'"')}return t},r,n)}function v(e,t,r,n){if("function"==typeof r&&(n=r,r={}),r||(r={}),n||(n=function(){}),S(e),E(r),"string"==typeof t&&(t=document.querySelector(t)),t&&("VIDEO"===t.nodeName||"AUDIO"===t.nodeName))throw new Error("Invalid video/audio node argument. Argument must be root element that video/audio tag will be appended to.");function i(e){return"video"===e||"audio"===e?o(e):s(e)}function o(e){var n=s(e);return r.autoplay&&(n.autoplay=!0),r.muted&&(n.muted=!0),r.controls&&(n.controls=!0),t.appendChild(n),n}function s(e){var r=document.createElement(e);return t.appendChild(r),r}function a(e,t){e&&t&&t.remove(),n(e,t)}_(e,i,r,a)}function _(e,t,r,a){var l=s.extname(e.name).toLowerCase(),g=0,b;function v(){var i=f.indexOf(l)>=0?"video":"audio";function s(){n("Use `videostream` package for "+e.name),y(),b.addEventListener("error",p),b.addEventListener("loadstart",S),b.addEventListener("canplay",E),u(e,b)}function a(){n("Use MediaSource API for "+e.name),y(),b.addEventListener("error",d),b.addEventListener("loadstart",S),b.addEventListener("canplay",E);var t=new o(b),r=t.createWriteStream(k(e.name));e.createReadStream().pipe(r),g&&(b.currentTime=g)}function h(){n("Use Blob URL for "+e.name),y(),b.addEventListener("error",T),b.addEventListener("loadstart",S),b.addEventListener("canplay",E),w(e,function(e,t){if(e)return T(e);b.src=t,g&&(b.currentTime=g)})}function p(e){n("videostream error: fallback to MediaSource API: %o",e.message||e),b.removeEventListener("error",p),b.removeEventListener("canplay",E),a()}function d(t){if(n("MediaSource API error: fallback to Blob URL: %o",t.message||t),"number"==typeof e.length&&e.length>r.maxBlobLength)return n("File length too large for Blob URL approach: %d (max: %d)",e.length,r.maxBlobLength),T(new Error("File length too large for Blob URL approach: "+e.length+" (max: "+r.maxBlobLength+")"));b.removeEventListener("error",d),b.removeEventListener("canplay",E),h()}function y(){b||(b=t(i),b.addEventListener("progress",function(){g=b.currentTime}))}m?c.indexOf(l)>=0?s():a():h()}function _(){b=t("audio"),w(e,function(e,t){if(e)return T(e);b.addEventListener("error",T),b.addEventListener("loadstart",S),b.addEventListener("canplay",E),b.src=t})}function S(){b.removeEventListener("loadstart",S),r.autoplay&&b.play()}function E(){b.removeEventListener("canplay",E),a(null,b)}function A(){b=t("img"),w(e,function(t,r){if(t)return T(t);b.src=r,b.alt=e.name,a(null,b)})}function x(){w(e,function(e,r){if(e)return T(e);".pdf"!==l?(b=t("iframe"),b.sandbox="allow-forms allow-scripts",b.src=r):(b=t("object"),b.setAttribute("typemustmatch",!0),b.setAttribute("type","application/pdf"),b.setAttribute("data",r)),a(null,b)})}function I(){n('Unknown file extension "%s" - will attempt to render into iframe',l);var t="";function r(){i(t)?(n('File extension "%s" appears ascii, so will render.',l),x()):(n('File extension "%s" appears non-ascii, will not render.',l),a(new Error('Unsupported file type "'+l+'": Cannot append to DOM')))}e.createReadStream({start:0,end:1e3}).setEncoding("utf8").on("data",function(e){t+=e}).on("end",r).on("error",a)}function T(t){t.message='Error rendering file "'+e.name+'": '+t.message,n(t.message),a(t)}h.indexOf(l)>=0?v():p.indexOf(l)>=0?_():d.indexOf(l)>=0?A():y.indexOf(l)>=0?x():I()}function w(e,r){var n=s.extname(e.name).toLowerCase();a(e.createReadStream(),t.mime[n],r)}function S(e){if(null==e)throw new Error("file cannot be null or undefined");if("string"!=typeof e.name)throw new Error("missing or invalid file.name property");if("function"!=typeof e.createReadStream)throw new Error("missing or invalid file.createReadStream property")}function k(e){var t=s.extname(e).toLowerCase();return{".m4a":'audio/mp4; codecs="mp4a.40.5"',".m4v":'video/mp4; codecs="avc1.640029, mp4a.40.5"',".mkv":'video/webm; codecs="avc1.640029, mp4a.40.5"',".mp3":"audio/mpeg",".mp4":'video/mp4; codecs="avc1.640029, mp4a.40.5"',".webm":'video/webm; codecs="vorbis, vp8"'}[t]}function E(e){null==e.autoplay&&(e.autoplay=!1),null==e.muted&&(e.muted=!1),null==e.controls&&(e.controls=!0),null==e.maxBlobLength&&(e.maxBlobLength=g)}},function(e){e.exports={".3gp":"video/3gpp",".aac":"audio/aac",".aif":"audio/x-aiff",".aiff":"audio/x-aiff",".atom":"application/atom+xml",".avi":"video/x-msvideo",".bmp":"image/bmp",".bz2":"application/x-bzip2",".conf":"text/plain",".css":"text/css",".csv":"text/plain",".diff":"text/x-diff",".doc":"application/msword",".flv":"video/x-flv",".gif":"image/gif",".gz":"application/x-gzip",".htm":"text/html",".html":"text/html",".ico":"image/vnd.microsoft.icon",".ics":"text/calendar",".iso":"application/octet-stream",".jar":"application/java-archive",".jpeg":"image/jpeg",".jpg":"image/jpeg",".js":"application/javascript",".json":"application/json",".less":"text/css",".log":"text/plain",".m3u":"audio/x-mpegurl",".m4a":"audio/mp4",".m4v":"video/mp4",".manifest":"text/cache-manifest",".markdown":"text/x-markdown",".mathml":"application/mathml+xml",".md":"text/x-markdown",".mid":"audio/midi",".midi":"audio/midi",".mov":"video/quicktime",".mp3":"audio/mpeg",".mp4":"video/mp4",".mp4v":"video/mp4",".mpeg":"video/mpeg",".mpg":"video/mpeg",".odp":"application/vnd.oasis.opendocument.presentation",".ods":"application/vnd.oasis.opendocument.spreadsheet",".odt":"application/vnd.oasis.opendocument.text",".oga":"audio/ogg",".ogg":"application/ogg",".pdf":"application/pdf",".png":"image/png",".pps":"application/vnd.ms-powerpoint",".ppt":"application/vnd.ms-powerpoint",".ps":"application/postscript",".psd":"image/vnd.adobe.photoshop",".qt":"video/quicktime",".rar":"application/x-rar-compressed",".rdf":"application/rdf+xml",".rss":"application/rss+xml",".rtf":"application/rtf",".svg":"image/svg+xml",".svgz":"image/svg+xml",".swf":"application/x-shockwave-flash",".tar":"application/x-tar",".tbz":"application/x-bzip-compressed-tar",".text":"text/plain",".tif":"image/tiff",".tiff":"image/tiff",".torrent":"application/x-bittorrent",".ttf":"application/x-font-ttf",".txt":"text/plain",".wav":"audio/wav",".webm":"video/webm",".wma":"audio/x-ms-wma",".wmv":"video/x-ms-wmv",".xls":"application/vnd.ms-excel",".xml":"application/xml",".yaml":"text/yaml",".yml":"text/yaml",".zip":"application/zip"}},function(e,t){var r=127;e.exports=function e(t){for(var r=0,n=t.length;r<n;++r)if(t.charCodeAt(r)>127)return!1;return!0}},function(e,t,r){var n=r(606),i=r(292),o=r(1512);function s(e,t,r){var i=this;if(!(this instanceof s))return new s(e,t,r);r=r||{},i.detailedError=null,i._elem=t,i._elemWrapper=new n(t),i._waitingFired=!1,i._trackMeta=null,i._file=e,i._tracks=null,"none"!==i._elem.preload&&i._createMuxer(),i._onError=function(e){i.detailedError=i._elemWrapper.detailedError,i.destroy()},i._onWaiting=function(){i._waitingFired=!0,i._muxer?i._tracks&&i._pump():i._createMuxer()},i._elem.addEventListener("waiting",i._onWaiting),i._elem.addEventListener("error",i._onError)}e.exports=s,s.prototype._createMuxer=function(){var e=this;e._muxer=new o(e._file),e._muxer.on("ready",function(t){e._tracks=t.map(function(t){var r=e._elemWrapper.createWriteStream(t.mime);r.on("error",function(t){e._elemWrapper.error(t)});var n={muxed:null,mediaSource:r,initFlushed:!1,onInitFlushed:null};return r.write(t.init,function(e){n.initFlushed=!0,n.onInitFlushed&&n.onInitFlushed(e)}),n}),(e._waitingFired||"auto"===e._elem.preload)&&e._pump()}),e._muxer.on("error",function(t){e._elemWrapper.error(t)})},s.prototype._pump=function(){var e=this,t=e._muxer.seek(e._elem.currentTime,!e._tracks);e._tracks.forEach(function(r,n){var o=function(){r.muxed&&(r.muxed.destroy(),r.mediaSource=e._elemWrapper.createWriteStream(r.mediaSource),r.mediaSource.on("error",function(t){e._elemWrapper.error(t)})),r.muxed=t[n],i(r.muxed,r.mediaSource)};r.initFlushed?o():r.onInitFlushed=function(t){t?e._elemWrapper.error(t):o()}})},s.prototype.destroy=function(){var e=this;this.destroyed||(this.destroyed=!0,this._elem.removeEventListener("waiting",this._onWaiting),this._elem.removeEventListener("error",this._onError),this._tracks&&this._tracks.forEach(function(e){e.muxed&&e.muxed.destroy()}),this._elem.src="")}},function(e,t,r){(function(t){var n=r(1513),i=r(10).EventEmitter,o=r(4),s=r(1514),a=r(204),u=r(1522);function c(e){var t=this;i.call(this),this._tracks=[],this._fragmentSequence=1,this._file=e,this._decoder=null,this._findMoov(0)}function f(e,t){var r=this;this._entries=e,this._countName=t||"count",this._index=0,this._offset=0,this.value=this._entries[0]}function l(){return{version:0,flags:0,entries:[]}}e.exports=c,o(c,i),c.prototype._findMoov=function(e){var t=this;t._decoder&&t._decoder.destroy(),t._decoder=s.decode();var r=t._file.createReadStream({start:e});r.pipe(t._decoder),t._decoder.once("box",function(n){"moov"===n.type?t._decoder.decode(function(e){r.destroy();try{t._processMoov(e)}catch(e){e.message="Cannot parse mp4 file: "+e.message,t.emit("error",e)}}):(r.destroy(),t._findMoov(e+n.length))})},f.prototype.inc=function(){var e=this;this._offset++,this._offset>=this._entries[this._index][this._countName]&&(this._index++,this._offset=0),this.value=this._entries[this._index]},c.prototype._processMoov=function(e){var r=this,n=e.traks;this._tracks=[],this._hasVideo=!1,this._hasAudio=!1;for(var i=0;i<n.length;i++){var o=n[i],s=o.mdia.minf.stbl,u=s.stsd.entries[0],c=o.mdia.hdlr.handlerType,l,h;if("vide"===c&&"avc1"===u.type){if(this._hasVideo)continue;this._hasVideo=!0,l="avc1",u.avcC&&(l+="."+u.avcC.mimeCodec),h='video/mp4; codecs="'+l+'"'}else{if("soun"!==c||"mp4a"!==u.type)continue;if(this._hasAudio)continue;this._hasAudio=!0,l="mp4a",u.esds&&u.esds.mimeCodec&&(l+="."+u.esds.mimeCodec),h='audio/mp4; codecs="'+l+'"'}var p=[],d=0,y=0,g=0,m=0,b=0,v=0,_=new f(s.stts.entries),w=null;s.ctts&&(w=new f(s.ctts.entries));for(var S=0;;){var k=s.stsc.entries[b],E=s.stsz.entries[d],A=_.value.duration,x=w?w.value.compositionOffset:0,I=!0;s.stss&&(I=s.stss.entries[S]===d+1);var T=s.stco||s.co64;if(p.push({size:E,duration:A,dts:v,presentationOffset:x,sync:I,offset:m+T.entries[g]}),d++,d>=s.stsz.entries.length)break;if(y++,m+=E,y>=k.samplesPerChunk){y=0,m=0,g++;var B=s.stsc.entries[b+1];B&&g+1>=B.firstChunk&&b++}v+=A,_.inc(),w&&w.inc(),I&&S++}o.mdia.mdhd.duration=0,o.tkhd.duration=0;var C=k.sampleDescriptionId,P={type:"moov",mvhd:e.mvhd,traks:[{tkhd:o.tkhd,mdia:{mdhd:o.mdia.mdhd,hdlr:o.mdia.hdlr,elng:o.mdia.elng,minf:{vmhd:o.mdia.minf.vmhd,smhd:o.mdia.minf.smhd,dinf:o.mdia.minf.dinf,stbl:{stsd:s.stsd,stts:{version:0,flags:0,entries:[]},ctts:{version:0,flags:0,entries:[]},stsc:{version:0,flags:0,entries:[]},stsz:{version:0,flags:0,entries:[]},stco:{version:0,flags:0,entries:[]},stss:{version:0,flags:0,entries:[]}}}}}],mvex:{mehd:{fragmentDuration:e.mvhd.duration},trexs:[{trackId:o.tkhd.trackId,defaultSampleDescriptionIndex:C,defaultSampleDuration:0,defaultSampleSize:0,defaultSampleFlags:0}]}};this._tracks.push({trackId:o.tkhd.trackId,timeScale:o.mdia.mdhd.timeScale,samples:p,currSample:null,currTime:null,moov:P,mime:h})}if(0!==this._tracks.length){e.mvhd.duration=0,this._ftyp={type:"ftyp",brand:"iso5",brandVersion:0,compatibleBrands:["iso5"]};var O=a.encode(this._ftyp),R=this._tracks.map(function(e){var r=a.encode(e.moov);return{mime:e.mime,init:t.concat([O,r])}});this.emit("ready",R)}else this.emit("error",new Error("no playable tracks"))},c.prototype.seek=function(e){var t=this;if(!t._tracks)throw new Error("Not ready yet; wait for 'ready' event");t._fileStream&&(t._fileStream.destroy(),t._fileStream=null);var r=-1;if(t._tracks.map(function(n,i){n.outStream&&n.outStream.destroy(),n.inStream&&(n.inStream.destroy(),n.inStream=null);var o=n.outStream=s.encode(),a=t._generateFragment(i,e);if(!a)return o.finalize();function u(e){o.destroyed||o.box(e.moof,function(r){if(r)return t.emit("error",r);if(!o.destroyed){var s=n.inStream.slice(e.ranges);s.pipe(o.mediaData(e.length,function(e){if(e)return t.emit("error",e);if(!o.destroyed){var r=t._generateFragment(i);if(!r)return o.finalize();u(r)}}))}})}(-1===r||a.ranges[0].start<r)&&(r=a.ranges[0].start),u(a)}),r>=0){var n=t._fileStream=t._file.createReadStream({start:r});t._tracks.forEach(function(e){e.inStream=new u(r,{highWaterMark:1e7}),n.pipe(e.inStream)})}return t._tracks.map(function(e){return e.outStream})},c.prototype._findSampleBefore=function(e,t){var r=this,i=this._tracks[e],o=Math.floor(i.timeScale*t),s=n(i.samples,o,function(e,t){var r=e.dts+e.presentationOffset;return r-t});for(-1===s?s=0:s<0&&(s=-s-2);!i.samples[s].sync;)s--;return s};var h=1;c.prototype._generateFragment=function(e,t){var r=this,n=this._tracks[e],i;if(i=void 0!==t?this._findSampleBefore(e,t):n.currSample,i>=n.samples.length)return null;for(var o=n.samples[i].dts,s=0,a=[],u=i;u<n.samples.length;u++){var c=n.samples[u];if(c.sync&&c.dts-o>=1*n.timeScale)break;s+=c.size;var f=a.length-1;f<0||a[f].end!==c.offset?a.push({start:c.offset,end:c.offset+c.size}):a[f].end+=c.size}return n.currSample=u,{moof:this._generateMoof(e,i,u),ranges:a,length:s}},c.prototype._generateMoof=function(e,t,r){for(var n=this,i=this._tracks[e],o=[],s=0,u=t;u<r;u++){var c=i.samples[u];c.presentationOffset<0&&(s=1),o.push({sampleDuration:c.duration,sampleSize:c.size,sampleFlags:c.sync?33554432:16842752,sampleCompositionTimeOffset:c.presentationOffset})}var f={type:"moof",mfhd:{sequenceNumber:this._fragmentSequence++},trafs:[{tfhd:{flags:131072,trackId:i.trackId},tfdt:{baseMediaDecodeTime:i.samples[t].dts},trun:{flags:3841,dataOffset:8,entries:o,version:s}}]};return f.trafs[0].trun.dataOffset+=a.encodingLength(f),f}}).call(this,r(0).Buffer)},function(e,t){e.exports=function(e,t,r,n,i){var o,s;if(void 0===n)n=0;else if(n|=0,n<0||n>=e.length)throw new RangeError("invalid lower bound");if(void 0===i)i=e.length-1;else if(i|=0,i<n||i>=e.length)throw new RangeError("invalid upper bound");for(;n<=i;)if(o=n+(i-n>>1),s=+r(e[o],t,o,e),s<0)n=o+1;else{if(!(s>0))return o;i=o-1}return~n}},function(e,t,r){t.decode=r(1515),t.encode=r(1521)},function(e,t,r){(function(t){var n=r(21),i=r(4),o=r(1516),s=r(204),a=r(150),u=a(0);function c(){if(!(this instanceof c))return new c;n.Writable.call(this),this.destroyed=!1,this._pending=0,this._missing=0,this._buf=null,this._str=null,this._cb=null,this._ondrain=null,this._writeBuffer=null,this._writeCb=null,this._ondrain=null,this._kick()}function f(e){this._parent=e,this.destroyed=!1,n.PassThrough.call(this)}e.exports=c,i(c,n.Writable),c.prototype.destroy=function(e){this.destroyed||(this.destroyed=!0,e&&this.emit("error",e),this.emit("close"))},c.prototype._write=function(e,t,r){if(!this.destroyed){for(var n=!this._str||!this._str._writableState.needDrain;e.length&&!this.destroyed;){if(!this._missing)return this._writeBuffer=e,void(this._writeCb=r);var i=e.length<this._missing?e.length:this._missing;if(this._buf?e.copy(this._buf,this._buf.length-this._missing):this._str&&(n=this._str.write(i===e.length?e:e.slice(0,i))),this._missing-=i,!this._missing){var o=this._buf,s=this._cb,a=this._str;this._buf=this._cb=this._str=this._ondrain=null,n=!0,a&&a.end(),s&&s(o)}e=i===e.length?u:e.slice(i)}if(this._pending&&!this._missing)return this._writeBuffer=e,void(this._writeCb=r);n?r():this._ondrain(r)}},c.prototype._buffer=function(e,t){this._missing=e,this._buf=a(e),this._cb=t},c.prototype._stream=function(e,t){var r=this;return this._missing=e,this._str=new f(this),this._ondrain=o(this._str,"drain"),this._pending++,this._str.on("end",function(){r._pending--,r._kick()}),this._cb=t,this._str},c.prototype._readBox=function(){var e=this;function r(n,i){e._buffer(n,function(n){i=i?t.concat([i,n]):n;var o=s.readHeaders(i);"number"==typeof o?r(o-i.length,i):(e._pending++,e._headers=o,e.emit("box",o))})}r(8)},c.prototype.stream=function(){var e=this;if(!this._headers)throw new Error("this function can only be called once after 'box' is emitted");var t=this._headers;return this._headers=null,this._stream(t.contentLen,null)},c.prototype.decode=function(e){var t=this;if(!t._headers)throw new Error("this function can only be called once after 'box' is emitted");var r=t._headers;t._headers=null,t._buffer(r.contentLen,function(n){var i=s.decodeWithoutHeaders(r,n);e(i),t._pending--,t._kick()})},c.prototype.ignore=function(){var e=this;if(!e._headers)throw new Error("this function can only be called once after 'box' is emitted");var t=e._headers;e._headers=null,this._missing=t.contentLen,this._cb=function(){e._pending--,e._kick()}},c.prototype._kick=function(){if(!this._pending&&(this._buf||this._str||this._readBox(),this._writeBuffer)){var e=this._writeCb,t=this._writeBuffer;this._writeBuffer=null,this._writeCb=null,this._write(t,null,e)}},i(f,n.PassThrough),f.prototype.destroy=function(e){this.destroyed||(this.destroyed=!0,this._parent.destroy(e),e&&this.emit("error",e),this.emit("close"))}}).call(this,r(0).Buffer)},function(e,t){function r(e,t){var r=null;return e.on(t,function(e){if(r){var t=r;r=null,t(e)}}),function(e){r=e}}e.exports=r},function(e,t,r){(function(t){var r=function(){try{if(!t.isEncoding("latin1"))return!1;var e=t.alloc?t.alloc(4):new t(4);return e.fill("ab","ucs2"),"61006200"===e.toString("hex")}catch(e){return!1}}();function n(e){return 1===e.length&&e.charCodeAt(0)<256}function i(e,t,r,n){if(r<0||n>e.length)throw new RangeError("Out of range index");return r>>>=0,n=void 0===n?e.length:n>>>0,n>r&&e.fill(t,r,n),e}function o(e,t,r,n){if(r<0||n>e.length)throw new RangeError("Out of range index");if(n<=r)return e;r>>>=0,n=void 0===n?e.length:n>>>0;for(var i=r,o=t.length;i<=n-o;)t.copy(e,i),i+=o;return i!==n&&t.copy(e,i,0,n-i),e}function s(e,s,a,u,c){if(r)return e.fill(s,a,u,c);if("number"==typeof s)return i(e,s,a,u);if("string"==typeof s){if("string"==typeof a?(c=a,a=0,u=e.length):"string"==typeof u&&(c=u,u=e.length),void 0!==c&&"string"!=typeof c)throw new TypeError("encoding must be a string");if("latin1"===c&&(c="binary"),"string"==typeof c&&!t.isEncoding(c))throw new TypeError("Unknown encoding: "+c);if(""===s)return i(e,0,a,u);if(n(s))return i(e,s.charCodeAt(0),a,u);s=new t(s,c)}return t.isBuffer(s)?o(e,s,a,u):i(e,0,a,u)}e.exports=s}).call(this,r(0).Buffer)},function(e,t,r){(function(t){function r(e){if("number"!=typeof e)throw new TypeError('"size" argument must be a number');if(e<0)throw new RangeError('"size" argument must not be negative');return t.allocUnsafe?t.allocUnsafe(e):new t(e)}e.exports=r}).call(this,r(0).Buffer)},function(e,t,r){var n=r(204),i=r(1520),o=r(150),s=r(324),a=r(609),u=20828448e5;t.fullBoxes={};var c=["mvhd","tkhd","mdhd","vmhd","smhd","stsd","esds","stsz","stco","co64","stss","stts","ctts","stsc","dref","elst","hdlr","mehd","trex","mfhd","tfhd","tfdt","trun"];function f(e,t,r){for(var n=t;n<r;n++)e[n]=0}function l(e,t,r){t.writeUInt32BE(Math.floor((e.getTime()+u)/1e3),r)}function h(e,t,r){t.writeUIntBE(Math.floor((e.getTime()+u)/1e3),r,6)}function p(e,t,r){t.writeUInt16BE(Math.floor(e)%65536,r),t.writeUInt16BE(Math.floor(256*e*256)%65536,r+2)}function d(e,t,r){t[r]=Math.floor(e)%256,t[r+1]=Math.floor(256*e)%256}function y(e,t,r){e||(e=[0,0,0,0,0,0,0,0,0]);for(var n=0;n<e.length;n++)p(e[n],t,r+4*n)}function g(e,t,r){var n=s(e,"utf8");n.copy(t,r),t[r+n.length]=0}function m(e){for(var t=new Array(e.length/4),r=0;r<t.length;r++)t[r]=_(e,4*r);return t}function b(e,t){return new Date(1e3*e.readUIntBE(t,6)-u)}function v(e,t){return new Date(1e3*e.readUInt32BE(t)-u)}function _(e,t){return e.readUInt16BE(t)+e.readUInt16BE(t+2)/65536}function w(e,t){return e[t]+e[t+1]/256}function S(e,t,r){var n;for(n=0;n<r&&0!==e[t+n];n++);return e.toString("utf8",t,t+n)}c.forEach(function(e){t.fullBoxes[e]=!0}),t.ftyp={},t.ftyp.encode=function(e,r,n){r=r?r.slice(n):o(t.ftyp.encodingLength(e));var i=e.compatibleBrands||[];r.write(e.brand,0,4,"ascii"),r.writeUInt32BE(e.brandVersion,4);for(var s=0;s<i.length;s++)r.write(i[s],8+4*s,4,"ascii");return t.ftyp.encode.bytes=8+4*i.length,r},t.ftyp.decode=function(e,t){e=e.slice(t);for(var r=e.toString("ascii",0,4),n=e.readUInt32BE(4),i=[],o=8;o<e.length;o+=4)i.push(e.toString("ascii",o,o+4));return{brand:r,brandVersion:n,compatibleBrands:i}},t.ftyp.encodingLength=function(e){return 8+4*(e.compatibleBrands||[]).length},t.mvhd={},t.mvhd.encode=function(e,r,n){return r=r?r.slice(n):o(96),l(e.ctime||new Date,r,0),l(e.mtime||new Date,r,4),r.writeUInt32BE(e.timeScale||0,8),r.writeUInt32BE(e.duration||0,12),p(e.preferredRate||0,r,16),d(e.preferredVolume||0,r,20),f(r,22,32),y(e.matrix,r,32),r.writeUInt32BE(e.previewTime||0,68),r.writeUInt32BE(e.previewDuration||0,72),r.writeUInt32BE(e.posterTime||0,76),r.writeUInt32BE(e.selectionTime||0,80),r.writeUInt32BE(e.selectionDuration||0,84),r.writeUInt32BE(e.currentTime||0,88),r.writeUInt32BE(e.nextTrackId||0,92),t.mvhd.encode.bytes=96,r},t.mvhd.decode=function(e,t){return e=e.slice(t),{ctime:v(e,0),mtime:v(e,4),timeScale:e.readUInt32BE(8),duration:e.readUInt32BE(12),preferredRate:_(e,16),preferredVolume:w(e,20),matrix:m(e.slice(32,68)),previewTime:e.readUInt32BE(68),previewDuration:e.readUInt32BE(72),posterTime:e.readUInt32BE(76),selectionTime:e.readUInt32BE(80),selectionDuration:e.readUInt32BE(84),currentTime:e.readUInt32BE(88),nextTrackId:e.readUInt32BE(92)}},t.mvhd.encodingLength=function(e){return 96},t.tkhd={},t.tkhd.encode=function(e,r,n){return r=r?r.slice(n):o(80),l(e.ctime||new Date,r,0),l(e.mtime||new Date,r,4),r.writeUInt32BE(e.trackId||0,8),f(r,12,16),r.writeUInt32BE(e.duration||0,16),f(r,20,28),r.writeUInt16BE(e.layer||0,28),r.writeUInt16BE(e.alternateGroup||0,30),r.writeUInt16BE(e.volume||0,32),y(e.matrix,r,36),r.writeUInt32BE(e.trackWidth||0,72),r.writeUInt32BE(e.trackHeight||0,76),t.tkhd.encode.bytes=80,r},t.tkhd.decode=function(e,t){return e=e.slice(t),{ctime:v(e,0),mtime:v(e,4),trackId:e.readUInt32BE(8),duration:e.readUInt32BE(16),layer:e.readUInt16BE(28),alternateGroup:e.readUInt16BE(30),volume:e.readUInt16BE(32),matrix:m(e.slice(36,72)),trackWidth:e.readUInt32BE(72),trackHeight:e.readUInt32BE(76)}},t.tkhd.encodingLength=function(e){return 80},t.mdhd={},t.mdhd.encode=function(e,r,n){return 1===e.version?(r=r?r.slice(n):o(32),h(e.ctime||new Date,r,0),h(e.mtime||new Date,r,8),r.writeUInt32BE(e.timeScale||0,16),r.writeUIntBE(e.duration||0,20,6),r.writeUInt16BE(e.language||0,28),r.writeUInt16BE(e.quality||0,30),t.mdhd.encode.bytes=32,r):(r=r?r.slice(n):o(20),l(e.ctime||new Date,r,0),l(e.mtime||new Date,r,4),r.writeUInt32BE(e.timeScale||0,8),r.writeUInt32BE(e.duration||0,12),r.writeUInt16BE(e.language||0,16),r.writeUInt16BE(e.quality||0,18),t.mdhd.encode.bytes=20,r)},t.mdhd.decode=function(e,t,r){e=e.slice(t);var n=r-t!=20;return n?{ctime:b(e,0),mtime:b(e,8),timeScale:e.readUInt32BE(16),duration:e.readUIntBE(20,6),language:e.readUInt16BE(28),quality:e.readUInt16BE(30)}:{ctime:v(e,0),mtime:v(e,4),timeScale:e.readUInt32BE(8),duration:e.readUInt32BE(12),language:e.readUInt16BE(16),quality:e.readUInt16BE(18)}},t.mdhd.encodingLength=function(e){return 1===e.version?32:20},t.vmhd={},t.vmhd.encode=function(e,r,n){r=r?r.slice(n):o(8),r.writeUInt16BE(e.graphicsMode||0,0);var i=e.opcolor||[0,0,0];return r.writeUInt16BE(i[0],2),r.writeUInt16BE(i[1],4),r.writeUInt16BE(i[2],6),t.vmhd.encode.bytes=8,r},t.vmhd.decode=function(e,t){return e=e.slice(t),{graphicsMode:e.readUInt16BE(0),opcolor:[e.readUInt16BE(2),e.readUInt16BE(4),e.readUInt16BE(6)]}},t.vmhd.encodingLength=function(e){return 8},t.smhd={},t.smhd.encode=function(e,r,n){return r=r?r.slice(n):o(4),r.writeUInt16BE(e.balance||0,0),f(r,2,4),t.smhd.encode.bytes=4,r},t.smhd.decode=function(e,t){return e=e.slice(t),{balance:e.readUInt16BE(0)}},t.smhd.encodingLength=function(e){return 4},t.stsd={},t.stsd.encode=function(e,r,i){r=r?r.slice(i):o(t.stsd.encodingLength(e));var s=e.entries||[];r.writeUInt32BE(s.length,0);for(var a=4,u=0;u<s.length;u++){var c=s[u];n.encode(c,r,a),a+=n.encode.bytes}return t.stsd.encode.bytes=a,r},t.stsd.decode=function(e,t,r){e=e.slice(t);for(var i=e.readUInt32BE(0),o=new Array(i),s=4,a=0;a<i;a++){var u=n.decode(e,s,r);o[a]=u,s+=u.length}return{entries:o}},t.stsd.encodingLength=function(e){var t=4;if(!e.entries)return t;for(var r=0;r<e.entries.length;r++)t+=n.encodingLength(e.entries[r]);return t},t.avc1=t.VisualSampleEntry={},t.VisualSampleEntry.encode=function(e,r,i){r=r?r.slice(i):o(t.VisualSampleEntry.encodingLength(e)),f(r,0,6),r.writeUInt16BE(e.dataReferenceIndex||0,6),f(r,8,24),r.writeUInt16BE(e.width||0,24),r.writeUInt16BE(e.height||0,26),r.writeUInt32BE(e.hResolution||4718592,28),r.writeUInt32BE(e.vResolution||4718592,32),f(r,36,40),r.writeUInt16BE(e.frameCount||1,40);var s=e.compressorName||"",a=Math.min(s.length,31);r.writeUInt8(a,42),r.write(s,43,a,"utf8"),r.writeUInt16BE(e.depth||24,74),r.writeInt16BE(-1,76);var u=78,c=e.children||[];c.forEach(function(e){n.encode(e,r,u),u+=n.encode.bytes}),t.VisualSampleEntry.encode.bytes=u},t.VisualSampleEntry.decode=function(e,t,r){e=e.slice(t);for(var i=r-t,o=Math.min(e.readUInt8(42),31),s={dataReferenceIndex:e.readUInt16BE(6),width:e.readUInt16BE(24),height:e.readUInt16BE(26),hResolution:e.readUInt32BE(28),vResolution:e.readUInt32BE(32),frameCount:e.readUInt16BE(40),compressorName:e.toString("utf8",43,43+o),depth:e.readUInt16BE(74),children:[]},a=78;i-a>=8;){var u=n.decode(e,a,i);s.children.push(u),s[u.type]=u,a+=u.length}return s},t.VisualSampleEntry.encodingLength=function(e){var t=78,r=e.children||[];return r.forEach(function(e){t+=n.encodingLength(e)}),t},t.avcC={},t.avcC.encode=function(e,r,n){r=r?r.slice(n):o(e.buffer.length),e.buffer.copy(r),t.avcC.encode.bytes=e.buffer.length},t.avcC.decode=function(e,t,r){return e=e.slice(t,r),{mimeCodec:e.toString("hex",1,4),buffer:s(e)}},t.avcC.encodingLength=function(e){return e.buffer.length},t.mp4a=t.AudioSampleEntry={},t.AudioSampleEntry.encode=function(e,r,i){r=r?r.slice(i):o(t.AudioSampleEntry.encodingLength(e)),f(r,0,6),r.writeUInt16BE(e.dataReferenceIndex||0,6),f(r,8,16),r.writeUInt16BE(e.channelCount||2,16),r.writeUInt16BE(e.sampleSize||16,18),f(r,20,24),r.writeUInt32BE(e.sampleRate||0,24);var s=28,a=e.children||[];a.forEach(function(e){n.encode(e,r,s),s+=n.encode.bytes}),t.AudioSampleEntry.encode.bytes=s},t.AudioSampleEntry.decode=function(e,t,r){e=e.slice(t,r);for(var i=r-t,o={dataReferenceIndex:e.readUInt16BE(6),channelCount:e.readUInt16BE(16),sampleSize:e.readUInt16BE(18),sampleRate:e.readUInt32BE(24),children:[]},s=28;i-s>=8;){var a=n.decode(e,s,i);o.children.push(a),o[a.type]=a,s+=a.length}return o},t.AudioSampleEntry.encodingLength=function(e){var t=28,r=e.children||[];return r.forEach(function(e){t+=n.encodingLength(e)}),t},t.esds={},t.esds.encode=function(e,r,n){r=r?r.slice(n):o(e.buffer.length),e.buffer.copy(r,0),t.esds.encode.bytes=e.buffer.length},t.esds.decode=function(e,t,r){e=e.slice(t,r);var n=i.Descriptor.decode(e,0,e.length),o="ESDescriptor"===n.tagName?n:{},a=o.DecoderConfigDescriptor||{},u=a.oti||0,c=a.DecoderSpecificInfo,f=c?(248&c.buffer.readUInt8(0))>>3:0,l=null;return u&&(l=u.toString(16),f&&(l+="."+f)),{mimeCodec:l,buffer:s(e.slice(0))}},t.esds.encodingLength=function(e){return e.buffer.length},t.stsz={},t.stsz.encode=function(e,r,n){var i=e.entries||[];r=r?r.slice(n):o(t.stsz.encodingLength(e)),r.writeUInt32BE(0,0),r.writeUInt32BE(i.length,4);for(var s=0;s<i.length;s++)r.writeUInt32BE(i[s],4*s+8);return t.stsz.encode.bytes=8+4*i.length,r},t.stsz.decode=function(e,t){e=e.slice(t);for(var r=e.readUInt32BE(0),n=e.readUInt32BE(4),i=new Array(n),o=0;o<n;o++)i[o]=0===r?e.readUInt32BE(4*o+8):r;return{entries:i}},t.stsz.encodingLength=function(e){return 8+4*e.entries.length},t.stss=t.stco={},t.stco.encode=function(e,r,n){var i=e.entries||[];r=r?r.slice(n):o(t.stco.encodingLength(e)),r.writeUInt32BE(i.length,0);for(var s=0;s<i.length;s++)r.writeUInt32BE(i[s],4*s+4);return t.stco.encode.bytes=4+4*i.length,r},t.stco.decode=function(e,t){e=e.slice(t);for(var r=e.readUInt32BE(0),n=new Array(r),i=0;i<r;i++)n[i]=e.readUInt32BE(4*i+4);return{entries:n}},t.stco.encodingLength=function(e){return 4+4*e.entries.length},t.co64={},t.co64.encode=function(e,r,n){var i=e.entries||[];r=r?r.slice(n):o(t.co64.encodingLength(e)),r.writeUInt32BE(i.length,0);for(var s=0;s<i.length;s++)a.encode(i[s],r,8*s+4);return t.co64.encode.bytes=4+8*i.length,r},t.co64.decode=function(e,t){e=e.slice(t);for(var r=e.readUInt32BE(0),n=new Array(r),i=0;i<r;i++)n[i]=a.decode(e,8*i+4);return{entries:n}},t.co64.encodingLength=function(e){return 4+8*e.entries.length},t.stts={},t.stts.encode=function(e,r,n){var i=e.entries||[];r=r?r.slice(n):o(t.stts.encodingLength(e)),r.writeUInt32BE(i.length,0);for(var s=0;s<i.length;s++){var a=8*s+4;r.writeUInt32BE(i[s].count||0,a),r.writeUInt32BE(i[s].duration||0,a+4)}return t.stts.encode.bytes=4+8*e.entries.length,r},t.stts.decode=function(e,t){e=e.slice(t);for(var r=e.readUInt32BE(0),n=new Array(r),i=0;i<r;i++){var o=8*i+4;n[i]={count:e.readUInt32BE(o),duration:e.readUInt32BE(o+4)}}return{entries:n}},t.stts.encodingLength=function(e){return 4+8*e.entries.length},t.ctts={},t.ctts.encode=function(e,r,n){var i=e.entries||[];r=r?r.slice(n):o(t.ctts.encodingLength(e)),r.writeUInt32BE(i.length,0);for(var s=0;s<i.length;s++){var a=8*s+4;r.writeUInt32BE(i[s].count||0,a),r.writeUInt32BE(i[s].compositionOffset||0,a+4)}return t.ctts.encode.bytes=4+8*i.length,r},t.ctts.decode=function(e,t){e=e.slice(t);for(var r=e.readUInt32BE(0),n=new Array(r),i=0;i<r;i++){var o=8*i+4;n[i]={count:e.readUInt32BE(o),compositionOffset:e.readInt32BE(o+4)}}return{entries:n}},t.ctts.encodingLength=function(e){return 4+8*e.entries.length},t.stsc={},t.stsc.encode=function(e,r,n){var i=e.entries||[];r=r?r.slice(n):o(t.stsc.encodingLength(e)),r.writeUInt32BE(i.length,0);for(var s=0;s<i.length;s++){var a=12*s+4;r.writeUInt32BE(i[s].firstChunk||0,a),r.writeUInt32BE(i[s].samplesPerChunk||0,a+4),r.writeUInt32BE(i[s].sampleDescriptionId||0,a+8)}return t.stsc.encode.bytes=4+12*i.length,r},t.stsc.decode=function(e,t){e=e.slice(t);for(var r=e.readUInt32BE(0),n=new Array(r),i=0;i<r;i++){var o=12*i+4;n[i]={firstChunk:e.readUInt32BE(o),samplesPerChunk:e.readUInt32BE(o+4),sampleDescriptionId:e.readUInt32BE(o+8)}}return{entries:n}},t.stsc.encodingLength=function(e){return 4+12*e.entries.length},t.dref={},t.dref.encode=function(e,r,n){r=r?r.slice(n):o(t.dref.encodingLength(e));var i=e.entries||[];r.writeUInt32BE(i.length,0);for(var s=4,a=0;a<i.length;a++){var u=i[a],c=(u.buf?u.buf.length:0)+4+4;r.writeUInt32BE(c,s),s+=4,r.write(u.type,s,4,"ascii"),s+=4,u.buf&&(u.buf.copy(r,s),s+=u.buf.length)}return t.dref.encode.bytes=s,r},t.dref.decode=function(e,t){e=e.slice(t);for(var r=e.readUInt32BE(0),n=new Array(r),i=4,o=0;o<r;o++){var s=e.readUInt32BE(i),a=e.toString("ascii",i+4,i+8),u=e.slice(i+8,i+s);i+=s,n[o]={type:a,buf:u}}return{entries:n}},t.dref.encodingLength=function(e){var t=4;if(!e.entries)return t;for(var r=0;r<e.entries.length;r++){var n=e.entries[r].buf;t+=(n?n.length:0)+4+4}return t},t.elst={},t.elst.encode=function(e,r,n){var i=e.entries||[];r=r?r.slice(n):o(t.elst.encodingLength(e)),r.writeUInt32BE(i.length,0);for(var s=0;s<i.length;s++){var a=12*s+4;r.writeUInt32BE(i[s].trackDuration||0,a),r.writeUInt32BE(i[s].mediaTime||0,a+4),p(i[s].mediaRate||0,r,a+8)}return t.elst.encode.bytes=4+12*i.length,r},t.elst.decode=function(e,t){e=e.slice(t);for(var r=e.readUInt32BE(0),n=new Array(r),i=0;i<r;i++){var o=12*i+4;n[i]={trackDuration:e.readUInt32BE(o),mediaTime:e.readInt32BE(o+4),mediaRate:_(e,o+8)}}return{entries:n}},t.elst.encodingLength=function(e){return 4+12*e.entries.length},t.hdlr={},t.hdlr.encode=function(e,r,n){r=r?r.slice(n):o(t.hdlr.encodingLength(e));var i=21+(e.name||"").length;return r.fill(0,0,i),r.write(e.handlerType||"",4,4,"ascii"),g(e.name||"",r,20),t.hdlr.encode.bytes=i,r},t.hdlr.decode=function(e,t,r){return e=e.slice(t),{handlerType:e.toString("ascii",4,8),name:S(e,20,r)}},t.hdlr.encodingLength=function(e){return 21+(e.name||"").length},t.mehd={},t.mehd.encode=function(e,r,n){return r=r?r.slice(n):o(4),r.writeUInt32BE(e.fragmentDuration||0,0),t.mehd.encode.bytes=4,r},t.mehd.decode=function(e,t){return e=e.slice(t),{fragmentDuration:e.readUInt32BE(0)}},t.mehd.encodingLength=function(e){return 4},t.trex={},t.trex.encode=function(e,r,n){return r=r?r.slice(n):o(20),r.writeUInt32BE(e.trackId||0,0),r.writeUInt32BE(e.defaultSampleDescriptionIndex||0,4),r.writeUInt32BE(e.defaultSampleDuration||0,8),r.writeUInt32BE(e.defaultSampleSize||0,12),r.writeUInt32BE(e.defaultSampleFlags||0,16),t.trex.encode.bytes=20,r},t.trex.decode=function(e,t){return e=e.slice(t),{trackId:e.readUInt32BE(0),defaultSampleDescriptionIndex:e.readUInt32BE(4),defaultSampleDuration:e.readUInt32BE(8),defaultSampleSize:e.readUInt32BE(12),defaultSampleFlags:e.readUInt32BE(16)}},t.trex.encodingLength=function(e){return 20},t.mfhd={},t.mfhd.encode=function(e,r,n){return r=r?r.slice(n):o(4),r.writeUInt32BE(e.sequenceNumber||0,0),t.mfhd.encode.bytes=4,r},t.mfhd.decode=function(e,t){return{sequenceNumber:e.readUInt32BE(0)}},t.mfhd.encodingLength=function(e){return 4},t.tfhd={},t.tfhd.encode=function(e,r,n){return r=r?r.slice(n):o(4),r.writeUInt32BE(e.trackId,0),t.tfhd.encode.bytes=4,r},t.tfhd.decode=function(e,t){},t.tfhd.encodingLength=function(e){return 4},t.tfdt={},t.tfdt.encode=function(e,r,n){return r=r?r.slice(n):o(4),r.writeUInt32BE(e.baseMediaDecodeTime||0,0),t.tfdt.encode.bytes=4,r},t.tfdt.decode=function(e,t){},t.tfdt.encodingLength=function(e){return 4},t.trun={},t.trun.encode=function(e,r,n){r=r?r.slice(n):o(8+16*e.entries.length),r.writeUInt32BE(e.entries.length,0),r.writeInt32BE(e.dataOffset,4);for(var i=8,s=0;s<e.entries.length;s++){var a=e.entries[s];r.writeUInt32BE(a.sampleDuration,i),i+=4,r.writeUInt32BE(a.sampleSize,i),i+=4,r.writeUInt32BE(a.sampleFlags,i),i+=4,0===(e.version||0)?r.writeUInt32BE(a.sampleCompositionTimeOffset,i):r.writeInt32BE(a.sampleCompositionTimeOffset,i),i+=4}t.trun.encode.bytes=i},t.trun.decode=function(e,t){},t.trun.encodingLength=function(e){return 8+16*e.entries.length},t.mdat={},t.mdat.encode=function(e,r,n){e.buffer?(e.buffer.copy(r,n),t.mdat.encode.bytes=e.buffer.length):t.mdat.encode.bytes=t.mdat.encodingLength(e)},t.mdat.decode=function(e,t,r){return{buffer:s(e.slice(t,r))}},t.mdat.encodingLength=function(e){return e.buffer?e.buffer.length:e.contentLength}},function(e,t,r){var n=r(324),i={3:"ESDescriptor",4:"DecoderConfigDescriptor",5:"DecoderSpecificInfo",6:"SLConfigDescriptor"};t.Descriptor={},t.Descriptor.decode=function(e,r,o){var s=e.readUInt8(r),a=r+1,u,c=0,f;do{u=e.readUInt8(a++),c=c<<7|127&u}while(128&u);var l=i[s];return f=t[l]?t[l].decode(e,a,o):{buffer:n(e.slice(a,a+c))},f.tag=s,f.tagName=l,f.length=a-r+c,f.contentsLen=c,f},t.DescriptorArray={},t.DescriptorArray.decode=function(e,r,n){for(var o=r,s={};o+2<=n;){var a=t.Descriptor.decode(e,o,n);o+=a.length;var u=i[a.tag]||"Descriptor"+a.tag;s[u]=a}return s},t.ESDescriptor={},t.ESDescriptor.decode=function(e,r,n){var i=e.readUInt8(r+2),o=r+3;if(128&i&&(o+=2),64&i){var s=e.readUInt8(o);o+=s+1}return 32&i&&(o+=2),t.DescriptorArray.decode(e,o,n)},t.DecoderConfigDescriptor={},t.DecoderConfigDescriptor.decode=function(e,r,n){var i=e.readUInt8(r),o=t.DescriptorArray.decode(e,r+13,n);return o.oti=i,o}},function(e,t,r){(function(t){var n=r(21),i=r(4),o=r(204),s=r(150);function a(){}function u(){if(!(this instanceof u))return new u;n.Readable.call(this),this.destroyed=!1,this._reading=!1,this._stream=null,this._drain=null,this._want=!1,this._onreadable=t,this._onend=r;var e=this;function t(){e._want&&(e._want=!1,e._read())}function r(){e._stream=null}}function c(e){this._parent=e,this.destroyed=!1,n.PassThrough.call(this)}e.exports=u,i(u,n.Readable),u.prototype.mediaData=u.prototype.mdat=function(e,t){var r=new c(this);return this.box({type:"mdat",contentLength:e,encodeBufferLen:8,stream:r},t),r},u.prototype.box=function(e,r){if(r||(r=a),this.destroyed)return r(new Error("Encoder is destroyed"));var n;if(e.encodeBufferLen&&(n=s(e.encodeBufferLen)),e.stream)e.buffer=null,n=o.encode(e,n),this.push(n),this._stream=e.stream,this._stream.on("readable",this._onreadable),this._stream.on("end",this._onend),this._stream.on("end",r),this._forward();else{n=o.encode(e,n);var i=this.push(n);if(i)return t.nextTick(r);this._drain=r}},u.prototype.destroy=function(e){if(!this.destroyed){if(this.destroyed=!0,this._stream&&this._stream.destroy&&this._stream.destroy(),this._stream=null,this._drain){var t=this._drain;this._drain=null,t(e)}e&&this.emit("error",e),this.emit("close")}},u.prototype.finalize=function(){this.push(null)},u.prototype._forward=function(){if(this._stream)for(;!this.destroyed;){var e=this._stream.read();if(!e)return void(this._want=!!this._stream);if(!this.push(e))return}},u.prototype._read=function(){if(!this._reading&&!this.destroyed){if(this._reading=!0,this._stream&&this._forward(),this._drain){var e=this._drain;this._drain=null,e()}this._reading=!1}},i(c,n.PassThrough),c.prototype.destroy=function(e){this.destroyed||(this.destroyed=!0,this._parent.destroy(e),e&&this.emit("error",e),this.emit("close"))}}).call(this,r(6))},function(e,t,r){var n=r(4),i=r(21);function o(e,t){var r=this;if(!(this instanceof o))return new o(e);i.Writable.call(this,t),this.destroyed=!1,this._queue=[],this._position=e||0,this._cb=null,this._buffer=null,this._out=null}e.exports=o,n(o,i.Writable),o.prototype._write=function(e,t,r){for(var n=this,i=!0;;){if(this.destroyed)return;if(0===this._queue.length)return this._buffer=e,void(this._cb=r);this._buffer=null;var o=this._queue[0],s=Math.max(o.start-this._position,0),a=o.end-this._position,u;if(s>=e.length)return this._position+=e.length,r(null);if(a>e.length){this._position+=e.length,u=0===s?e:e.slice(s),i=o.stream.write(u)&&i;break}this._position+=a,u=0===s&&a===e.length?e:e.slice(s,a),i=o.stream.write(u)&&i,o.last&&o.stream.end(),e=e.slice(a),this._queue.shift()}i?r(null):o.stream.once("drain",r.bind(null,null))},o.prototype.slice=function(e){var t=this;if(t.destroyed)return null;e instanceof Array||(e=[e]);var r=new i.PassThrough;return e.forEach(function(n,i){t._queue.push({start:n.start,end:n.end,stream:r,last:i===e.length-1})}),t._buffer&&t._write(t._buffer,null,t._cb),r},o.prototype.destroy=function(e){var t=this;this.destroyed||(this.destroyed=!0,e&&this.emit("error",e))}},function(e,t,r){(function(t){var n=r(35);e.exports=function e(r,i,o){o=n(o);var s=t.alloc(i),a=0;r.on("data",function(e){e.copy(s,a),a+=e.length}).on("end",function(){o(null,s)}).on("error",o)}}).call(this,r(0).Buffer)},function(e,t,r){var n=r(610),i=r(1)("webtorrent:peer"),o=r(611),s=r(1525),a=5e3,u=25e3,c=25e3;function f(e,t){var r=this;this.id=e,this.type=t,i("new Peer %s",e),this.addr=null,this.conn=null,this.swarm=null,this.wire=null,this.connected=!1,this.destroyed=!1,this.timeout=null,this.retries=0,this.sentHandshake=!1}function l(){}t.createWebRTCPeer=function(e,t){var r=new f(e.id,"webrtc");return r.conn=e,r.swarm=t,r.conn.connected?r.onConnect():(r.conn.once("connect",function(){r.onConnect()}),r.conn.once("error",function(e){r.destroy(e)}),r.startConnectTimeout()),r},t.createTCPIncomingPeer=function(e){var t=e.remoteAddress+":"+e.remotePort,r=new f(t,"tcpIncoming");return r.conn=e,r.addr=t,r.onConnect(),r},t.createTCPOutgoingPeer=function(e,t){var r=new f(e,"tcpOutgoing");return r.addr=e,r.swarm=t,r},t.createWebSeedPeer=function(e,t){var r=new f(e,"webSeed");return r.swarm=t,r.conn=new s(e,t),r.onConnect(),r},f.prototype.onConnect=function(){var e=this;if(!e.destroyed){e.connected=!0,i("Peer %s connected",e.id),clearTimeout(e.connectTimeout);var t=e.conn;t.once("end",function(){e.destroy()}),t.once("close",function(){e.destroy()}),t.once("finish",function(){e.destroy()}),t.once("error",function(t){e.destroy(t)});var r=e.wire=new o;r.type=e.type,r.once("end",function(){e.destroy()}),r.once("close",function(){e.destroy()}),r.once("finish",function(){e.destroy()}),r.once("error",function(t){e.destroy(t)}),r.once("handshake",function(t,r){e.onHandshake(t,r)}),e.startHandshakeTimeout(),t.pipe(r).pipe(t),e.swarm&&!e.sentHandshake&&e.handshake()}},f.prototype.onHandshake=function(e,t){var r=this;if(this.swarm&&!this.destroyed){if(this.swarm.destroyed)return this.destroy(new Error("swarm already destroyed"));if(e!==this.swarm.infoHash)return this.destroy(new Error("unexpected handshake info hash for this swarm"));if(t===this.swarm.peerId)return this.destroy(new Error("refusing to connect to ourselves"));i("Peer %s got handshake %s",this.id,e),clearTimeout(this.handshakeTimeout),this.retries=0;var n=this.addr;!n&&this.conn.remoteAddress&&this.conn.remotePort&&(n=this.conn.remoteAddress+":"+this.conn.remotePort),this.swarm._onWire(this.wire,n),this.swarm&&!this.swarm.destroyed&&(this.sentHandshake||this.handshake())}},f.prototype.handshake=function(){var e=this,t={dht:!this.swarm.private&&!!this.swarm.client.dht};this.wire.handshake(this.swarm.infoHash,this.swarm.client.peerId,t),this.sentHandshake=!0},f.prototype.startConnectTimeout=function(){var e=this;clearTimeout(e.connectTimeout),e.connectTimeout=setTimeout(function(){e.destroy(new Error("connect timeout"))},"webrtc"===e.type?25e3:5e3),e.connectTimeout.unref&&e.connectTimeout.unref()},f.prototype.startHandshakeTimeout=function(){var e=this;clearTimeout(e.handshakeTimeout),e.handshakeTimeout=setTimeout(function(){e.destroy(new Error("handshake timeout"))},25e3),e.handshakeTimeout.unref&&e.handshakeTimeout.unref()},f.prototype.destroy=function(e){var t=this;if(!this.destroyed){this.destroyed=!0,this.connected=!1,i("destroy %s (error: %s)",this.id,e&&(e.message||e)),clearTimeout(this.connectTimeout),clearTimeout(this.handshakeTimeout);var r=this.swarm,o=this.conn,s=this.wire;this.swarm=null,this.conn=null,this.wire=null,r&&s&&n(r.wires,r.wires.indexOf(s)),o&&(o.on("error",l),o.destroy()),s&&s.destroy(),r&&r.removePeer(this.id)}}},function(e,t,r){e.exports=l;var n=r(203),i=r(2).Buffer,o=r(1)("webtorrent:webconn"),s=r(605),a=r(4),u=r(149),c=r(611),f=r(325).version;function l(e,t){c.call(this),this.url=e,this.webPeerId=u.sync(e),this._torrent=t,this._init()}a(l,c),l.prototype._init=function(){var e=this;e.setKeepAlive(!0),e.once("handshake",function(t,r){if(!e.destroyed){e.handshake(t,e.webPeerId);for(var i=e._torrent.pieces.length,o=new n(i),s=0;s<=i;s++)o.set(s,!0);e.bitfield(o)}}),e.once("interested",function(){o("interested"),e.unchoke()}),e.on("uninterested",function(){o("uninterested")}),e.on("choke",function(){o("choke")}),e.on("unchoke",function(){o("unchoke")}),e.on("bitfield",function(){o("bitfield")}),e.on("request",function(t,r,n,i){o("request pieceIndex=%d offset=%d length=%d",t,r,n),e.httpRequest(t,r,n,i)})},l.prototype.httpRequest=function(e,t,r,n){var a=this,u=e*a._torrent.pieceLength,c=u+t,l=c+r-1,h=a._torrent.files,p;if(h.length<=1)p=[{url:a.url,start:c,end:l}];else{var d=h.filter(function(e){return e.offset<=l&&e.offset+e.length>c});if(d.length<1)return n(new Error("Could not find file corresponnding to web seed range request"));p=d.map(function(e){var t=e.offset+e.length-1,r=a.url+("/"===a.url[a.url.length-1]?"":"/")+e.path;return{url:r,fileOffsetInRange:Math.max(e.offset-c,0),start:Math.max(c-e.offset,0),end:Math.min(t,l-e.offset)}})}var y=0,g=!1,m;p.length>1&&(m=i.alloc(r)),p.forEach(function(i){var a=i.url,u=i.start,c=i.end;o("Requesting url=%s pieceIndex=%d offset=%d length=%d start=%d end=%d",a,e,t,r,u,c);var l={url:a,method:"GET",headers:{"user-agent":"WebTorrent/"+f+" (https://webtorrent.io)",range:"bytes="+u+"-"+c}};function h(e,t){if(e.statusCode<200||e.statusCode>=300)return g=!0,n(new Error("Unexpected HTTP status code "+e.statusCode));o("Got data of length %d",t.length),1===p.length?n(null,t):(t.copy(m,i.fileOffsetInRange),++y===p.length&&n(null,m))}s.concat(l,function(e,t,r){if(!g)return e?"undefined"==typeof window||a.startsWith(window.location.origin+"/")?(g=!0,n(e)):s.head(a,function(t,r){if(!g){if(t)return g=!0,n(t);if(r.statusCode<200||r.statusCode>=300)return g=!0,n(new Error("Unexpected HTTP status code "+r.statusCode));if(r.url===a)return g=!0,n(e);l.url=r.url,s.concat(l,function(e,t,r){if(!g)return e?(g=!0,n(e)):void h(t,r)})}}):void h(t,r)})})},l.prototype.destroy=function(){c.prototype.destroy.call(this),this._torrent=null}},function(e,t){function r(e){var t=this;t._torrent=e,t._numPieces=e.pieces.length,t._pieces=[],t._onWire=function(e){t.recalculate(),t._initWire(e)},t._onWireHave=function(e){t._pieces[e]+=1},t._onWireBitfield=function(){t.recalculate()},t._torrent.wires.forEach(function(e){t._initWire(e)}),t._torrent.on("wire",t._onWire),t.recalculate()}function n(){return!0}e.exports=r,r.prototype.getRarestPiece=function(e){e||(e=n);for(var t=[],r=1/0,i=0;i<this._numPieces;++i)if(e(i)){var o=this._pieces[i];o===r?t.push(i):o<r&&(t=[i],r=o)}return t.length>0?t[Math.random()*t.length|0]:-1},r.prototype.destroy=function(){var e=this;e._torrent.removeListener("wire",e._onWire),e._torrent.wires.forEach(function(t){e._cleanupWireEvents(t)}),e._torrent=null,e._pieces=null,e._onWire=null,e._onWireHave=null,e._onWireBitfield=null},r.prototype._initWire=function(e){var t=this;e._onClose=function(){t._cleanupWireEvents(e);for(var r=0;r<this._numPieces;++r)t._pieces[r]-=e.peerPieces.get(r)},e.on("have",t._onWireHave),e.on("bitfield",t._onWireBitfield),e.once("close",e._onClose)},r.prototype.recalculate=function(){var e;for(e=0;e<this._numPieces;++e)this._pieces[e]=0;var t=this._torrent.wires.length;for(e=0;e<t;++e)for(var r=this._torrent.wires[e],n=0;n<this._numPieces;++n)this._pieces[n]+=r.peerPieces.get(n)},r.prototype._cleanupWireEvents=function(e){e.removeListener("have",this._onWireHave),e.removeListener("bitfield",this._onWireBitfield),e._onClose&&e.removeListener("close",e._onClose),e._onClose=null}},function(e,t){},function(e,t,r){(function(n){const i=r(36);n.env.GUN_ENV="false";const o=r(612);r(1529);const s=r(1)("dweb-transports:gun"),a=r(81),u=r(118),c=r(103),f=r(151);let l={peers:["https://dweb.me:4246/gun"]};class h extends u{constructor(e){super(e),this.options=e,this.gun=void 0,this.name="GUN",this.supportURLs=["gun"],this.supportFunctions=["fetch","connection","get","set","getall","keys","newdatabase","newtable","monitor","add","list","listmonitor","newlisturls"],this.status=u.STATUS_LOADED}connection(e){e=i.parse(e);let t=e.pathname.split("/");return t.shift(),t.shift(),s("path=",t),this.gun.path(t)}static setup0(e){let t=u.mergeoptions(l,e.gun);s("options %o",t);let r=new h(t);return r.gun=new o(r.options),c.addtransport(r),r}async p_setup1(e){try{this.status=u.STATUS_STARTING,e&&e(this),await this.p_status()}catch(e){console.error(this.name,"failed to start",e),this.status=u.STATUS_FAILED}return e&&e(this),this}async p_status(){return this.status=u.STATUS_CONNECTED,this.status}async p_rawfetch(e){e=i.parse(e);let t=this.connection(e),r=await this._p_once(t);if(!r)throw new a.TransportError("GUN unable to retrieve: "+e.href);let n="string"==typeof r?JSON.parse(r):r;if(n.metadata&&n.metadata.thumbnaillinks&&n.metadata.thumbnaillinks.find(e=>e.includes("ipfs/zb2")))throw new a.TransportError("GUN retrieving legacy data at: "+e.href);return n}async p_rawlist(e){try{let t=this.connection(e),r=await this._p_once(t),n=r?Object.keys(r).filter(e=>"_"!==e).sort().map(e=>r[e]):[];return s("p_rawlist found",...f.consolearr(n)),n}catch(e){throw e}}listmonitor(e,t,{current:r=!1}={}){let n=this.connection(e);r?n.map().on((e,r)=>t("set",r,JSON.parse(e))):n.once(e=>{this.monitored=e?Object.keys(e):[],n.map().on((e,r)=>{this.monitored.includes(r)||"_"===r||(this.monitored.push(r),t(JSON.parse(e)))})})}async p_rawadd(e,t){console.assert(e&&t.urls.length&&t.signature&&t.signedby.length,"TransportGUN.p_rawadd args",e,t),this.connection(e).set(JSON.stringify(t.preflight(Object.assign({},t))))}async p_newlisturls(e){let t=await this._p_newgun(e);return[t,t]}async _p_newgun(e){return e.hasOwnProperty("keypair")&&(e=e.keypair.signingexport()),`gun:/gun/${encodeURIComponent(e)}`}async p_newdatabase(e){let t=await this._p_newgun(e);return{publicurl:t,privateurl:t}}async p_newtable(e,t){if(!e)throw new a.CodingError("p_newtable currently requires a pubkey");let r=await this.p_newdatabase(e);return{privateurl:`${r.privateurl}/${t}`,publicurl:`${r.publicurl}/${t}`}}async p_set(e,t,r){let n=this.connection(e);"string"==typeof t?n.path(t).put(JSON.stringify(r)):(console.assert(!Array.isArray(t),"TransportGUN - shouldnt be passsing an array as the keyvalues"),n.put(Object.keys(t).reduce(function(e,r){return e[r]=JSON.stringify(t[r]),e},{})))}async p_get(e,t){let r=this.connection(e);if(Array.isArray(t))throw new a.ToBeImplementedError("p_get(url, [keys]) isn't supported - because of ambiguity better to explicitly loop on set of keys or use getall and filter");{let e=await this._p_once(r.get(t));return"string"==typeof e?JSON.parse(e):e}}async p_delete(e,t){let r=this.connection(e);"string"==typeof t?r.path(t).put(null):t.map(e=>r.path(e).put(null))}_p_once(e){return new Promise(t=>e.once(t))}async p_keys(e){let t=await this._p_once(this.connection(e));return Object.keys(t).filter(e=>"_"!==e&&null!==t[e])}async p_getall(e){let t=await this._p_once(this.connection(e));return Object.keys(t).filter(e=>"_"!==e&&null!==t[e]).reduce(function(e,r){return e[r]=JSON.parse(t[r]),e},{})}async monitor(e,t,{current:r=!1}={}){let n=this.connection(e);r?n.map().on((e,r)=>t("set",r,JSON.parse(e))):n.once(e=>{this.monitored=Object.assign({},e),n.map().on((e,r)=>{e!==this.monitored[r]&&"_"!==r&&(this.monitored[r]=e,t("set",r,JSON.parse(e)))})})}static async p_test(){s("p_test");try{let e=this.setup0({});await e.p_setup1(),await e.p_setup2(),e.p_test_kvt("gun:/gun/NACL")}catch(e){throw console.warn("Exception thrown in TransportGUN.test:",e.message),e}}static async demo_bugs(){let e=new o;e.get("foo").get("bar").put("baz"),console.log("Expect {bar: 'baz'} but get {_:..., bar: 'baz'}"),e.get("foo").once(e=>console.log(e)),e.get("zip").get("bar").set("alice"),console.log("Expect {12345: 'alice'} but get {_:..., 12345: 'alice'}"),e.get("foo").once(e=>console.log(e))}}c._transportclasses.GUN=h,t=e.exports=h}).call(this,r(6))},function(e,t,r){var n="undefined"!=typeof window?window.Gun:r(612);n.chain.path=function(e,t){var r=this,n=this,i;if("string"==typeof e){if(i=e.split(t||"."),1===i.length)return n=this.get(e),n;e=i}if(e instanceof Array){if(e.length>1){n=this;for(var o=0,s=e.length;o<s;o++)n=n.get(e[o])}else n=this.get(e[0]);return n}return e||0==e?(n=this.get(""+e),n):this}}]); |