mirror of
https://github.com/fluencelabs/dweb-transports
synced 2025-03-31 09:21:11 +00:00
147 lines
2.7 MiB
147 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(){return e.default}:function(){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=630)}([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(636),i=r(335),o=r(333);function s(){return u.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function a(e,t){if(s()<t)throw new RangeError("Invalid typed array length");return u.TYPED_ARRAY_SUPPORT?(e=new Uint8Array(t)).__proto__=u.prototype:(null===e&&(e=new u(t)),e.length=t),e}function u(e,t,r){if(!(u.TYPED_ARRAY_SUPPORT||this instanceof u))return new u(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 l(this,e)}return c(this,e,t,r)}function c(e,t,r,n){if("number"==typeof t)throw new TypeError('"value" argument must not be a number');return"undefined"!=typeof ArrayBuffer&&t instanceof ArrayBuffer?function(e,t,r,n){if(t.byteLength,r<0||t.byteLength<r)throw new RangeError("'offset' is out of bounds");if(t.byteLength<r+(n||0))throw new RangeError("'length' is out of bounds");return t=void 0===r&&void 0===n?new Uint8Array(t):void 0===n?new Uint8Array(t,r):new Uint8Array(t,r,n),u.TYPED_ARRAY_SUPPORT?(e=t).__proto__=u.prototype:e=h(e,t),e}(e,t,r,n):"string"==typeof t?function(e,t,r){if("string"==typeof r&&""!==r||(r="utf8"),!u.isEncoding(r))throw new TypeError('"encoding" must be a valid string encoding');var n=0|d(t,r),i=(e=a(e,n)).write(t,r);return i!==n&&(e=e.slice(0,i)),e}(e,t,r):function(e,t){if(u.isBuffer(t)){var r=0|p(t.length);return 0===(e=a(e,r)).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||function(e){return e!=e}(t.length)?a(e,0):h(e,t);if("Buffer"===t.type&&o(t.data))return h(e,t.data)}throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}(e,t)}function f(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 l(e,t){if(f(t),e=a(e,t<0?0:0|p(t)),!u.TYPED_ARRAY_SUPPORT)for(var r=0;r<t;++r)e[r]=0;return e}function h(e,t){var r=t.length<0?0:0|p(t.length);e=a(e,r);for(var n=0;n<r;n+=1)e[n]=255&t[n];return e}function p(e){if(e>=s())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+s().toString(16)+" bytes");return 0|e}function d(e,t){if(u.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 U(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return F(e).length;default:if(n)return U(e).length;t=(""+t).toLowerCase(),n=!0}}function y(e,t,r){var n=e[t];e[t]=e[r],e[r]=n}function g(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=u.from(t,n)),u.isBuffer(t))return 0===t.length?-1:m(e,t,r,n,i);if("number"==typeof t)return t&=255,u.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(e,t,r):Uint8Array.prototype.lastIndexOf.call(e,t,r):m(e,[t],r,n,i);throw new TypeError("val must be string, number or Buffer")}function m(e,t,r,n,i){var o,s=1,a=e.length,u=t.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(e.length<2||t.length<2)return-1;s=2,a/=2,u/=2,r/=2}function c(e,t){return 1===s?e[t]:e.readUInt16BE(t*s)}if(i){var f=-1;for(o=r;o<a;o++)if(c(e,o)===c(t,-1===f?0:o-f)){if(-1===f&&(f=o),o-f+1===u)return f*s}else-1!==f&&(o-=o-f),f=-1}else for(r+u>a&&(r=a-u),o=r;o>=0;o--){for(var l=!0,h=0;h<u;h++)if(c(e,o+h)!==c(t,h)){l=!1;break}if(l)return o}return-1}function b(e,t,r,n){r=Number(r)||0;var i=e.length-r;n?(n=Number(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 v(e,t,r,n){return q(U(t,e.length-r),e,r,n)}function _(e,t,r,n){return q(function(e){for(var t=[],r=0;r<e.length;++r)t.push(255&e.charCodeAt(r));return t}(t),e,r,n)}function w(e,t,r,n){return _(e,t,r,n)}function S(e,t,r,n){return q(F(t),e,r,n)}function k(e,t,r,n){return q(function(e,t){for(var r,n,i,o=[],s=0;s<e.length&&!((t-=2)<0);++s)n=(r=e.charCodeAt(s))>>8,i=r%256,o.push(i),o.push(n);return o}(t,e.length-r),e,r,n)}function E(e,t,r){return 0===t&&r===e.length?n.fromByteArray(e):n.fromByteArray(e.slice(t,r))}function A(e,t,r){r=Math.min(e.length,r);for(var n=[],i=t;i<r;){var o,s,a,u,c=e[i],f=null,l=c>239?4:c>223?3:c>191?2:1;if(i+l<=r)switch(l){case 1:c<128&&(f=c);break;case 2:128==(192&(o=e[i+1]))&&(u=(31&c)<<6|63&o)>127&&(f=u);break;case 3:o=e[i+1],s=e[i+2],128==(192&o)&&128==(192&s)&&(u=(15&c)<<12|(63&o)<<6|63&s)>2047&&(u<55296||u>57343)&&(f=u);break;case 4:o=e[i+1],s=e[i+2],a=e[i+3],128==(192&o)&&128==(192&s)&&128==(192&a)&&(u=(15&c)<<18|(63&o)<<12|(63&s)<<6|63&a)>65535&&u<1114112&&(f=u)}null===f?(f=65533,l=1):f>65535&&(f-=65536,n.push(f>>>10&1023|55296),f=56320|1023&f),n.push(f),i+=l}return function(e){var t=e.length;if(t<=x)return String.fromCharCode.apply(String,e);for(var r="",n=0;n<t;)r+=String.fromCharCode.apply(String,e.slice(n,n+=x));return r}(n)}t.Buffer=u,t.SlowBuffer=function(e){return+e!=e&&(e=0),u.alloc(+e)},t.INSPECT_MAX_BYTES=50,u.TYPED_ARRAY_SUPPORT=void 0!==e.TYPED_ARRAY_SUPPORT?e.TYPED_ARRAY_SUPPORT:function(){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}}(),t.kMaxLength=s(),u.poolSize=8192,u._augment=function(e){return e.__proto__=u.prototype,e},u.from=function(e,t,r){return c(null,e,t,r)},u.TYPED_ARRAY_SUPPORT&&(u.prototype.__proto__=Uint8Array.prototype,u.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&u[Symbol.species]===u&&Object.defineProperty(u,Symbol.species,{value:null,configurable:!0})),u.alloc=function(e,t,r){return function(e,t,r,n){return f(t),t<=0?a(e,t):void 0!==r?"string"==typeof n?a(e,t).fill(r,n):a(e,t).fill(r):a(e,t)}(null,e,t,r)},u.allocUnsafe=function(e){return l(null,e)},u.allocUnsafeSlow=function(e){return l(null,e)},u.isBuffer=function(e){return!(null==e||!e._isBuffer)},u.compare=function(e,t){if(!u.isBuffer(e)||!u.isBuffer(t))throw new TypeError("Arguments must be Buffers");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},u.isEncoding=function(e){switch(String(e).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},u.concat=function(e,t){if(!o(e))throw new TypeError('"list" argument must be an Array of Buffers');if(0===e.length)return u.alloc(0);var r;if(void 0===t)for(t=0,r=0;r<e.length;++r)t+=e[r].length;var n=u.allocUnsafe(t),i=0;for(r=0;r<e.length;++r){var s=e[r];if(!u.isBuffer(s))throw new TypeError('"list" argument must be an Array of Buffers');s.copy(n,i),i+=s.length}return n},u.byteLength=d,u.prototype._isBuffer=!0,u.prototype.swap16=function(){var e=this.length;if(e%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var t=0;t<e;t+=2)y(this,t,t+1);return this},u.prototype.swap32=function(){var e=this.length;if(e%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var t=0;t<e;t+=4)y(this,t,t+3),y(this,t+1,t+2);return this},u.prototype.swap64=function(){var e=this.length;if(e%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var t=0;t<e;t+=8)y(this,t,t+7),y(this,t+1,t+6),y(this,t+2,t+5),y(this,t+3,t+4);return this},u.prototype.toString=function(){var e=0|this.length;return 0===e?"":0===arguments.length?A(this,0,e):function(e,t,r){var n=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if((r>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return B(this,t,r);case"utf8":case"utf-8":return A(this,t,r);case"ascii":return I(this,t,r);case"latin1":case"binary":return T(this,t,r);case"base64":return E(this,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return C(this,t,r);default:if(n)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),n=!0}}.apply(this,arguments)},u.prototype.equals=function(e){if(!u.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e||0===u.compare(this,e)},u.prototype.inspect=function(){var e="",r=t.INSPECT_MAX_BYTES;return this.length>0&&(e=this.toString("hex",0,r).match(/.{2}/g).join(" "),this.length>r&&(e+=" ... ")),"<Buffer "+e+">"},u.prototype.compare=function(e,t,r,n,i){if(!u.isBuffer(e))throw new TypeError("Argument must be a Buffer");if(void 0===t&&(t=0),void 0===r&&(r=e?e.length:0),void 0===n&&(n=0),void 0===i&&(i=this.length),t<0||r>e.length||n<0||i>this.length)throw new RangeError("out of range index");if(n>=i&&t>=r)return 0;if(n>=i)return-1;if(t>=r)return 1;if(t>>>=0,r>>>=0,n>>>=0,i>>>=0,this===e)return 0;for(var o=i-n,s=r-t,a=Math.min(o,s),c=this.slice(n,i),f=e.slice(t,r),l=0;l<a;++l)if(c[l]!==f[l]){o=c[l],s=f[l];break}return o<s?-1:s<o?1:0},u.prototype.includes=function(e,t,r){return-1!==this.indexOf(e,t,r)},u.prototype.indexOf=function(e,t,r){return g(this,e,t,r,!0)},u.prototype.lastIndexOf=function(e,t,r){return g(this,e,t,r,!1)},u.prototype.write=function(e,t,r,n){if(void 0===t)n="utf8",r=this.length,t=0;else if(void 0===r&&"string"==typeof t)n=t,r=this.length,t=0;else{if(!isFinite(t))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");t|=0,isFinite(r)?(r|=0,void 0===n&&(n="utf8")):(n=r,r=void 0)}var i=this.length-t;if((void 0===r||r>i)&&(r=i),e.length>0&&(r<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var o=!1;;)switch(n){case"hex":return b(this,e,t,r);case"utf8":case"utf-8":return v(this,e,t,r);case"ascii":return _(this,e,t,r);case"latin1":case"binary":return w(this,e,t,r);case"base64":return S(this,e,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return k(this,e,t,r);default:if(o)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),o=!0}},u.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var x=4096;function I(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 T(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 B(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+=D(e[o]);return i}function C(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 P(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 O(e,t,r,n,i,o){if(!u.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 R(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 N(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 L(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 K(e,t,r,n,o){return o||L(e,0,r,4),i.write(e,t,r,n,23,4),r+4}function j(e,t,r,n,o){return o||L(e,0,r,8),i.write(e,t,r,n,52,8),r+8}u.prototype.slice=function(e,t){var r,n=this.length;if(e=~~e,t=void 0===t?n:~~t,e<0?(e+=n)<0&&(e=0):e>n&&(e=n),t<0?(t+=n)<0&&(t=0):t>n&&(t=n),t<e&&(t=e),u.TYPED_ARRAY_SUPPORT)(r=this.subarray(e,t)).__proto__=u.prototype;else{var i=t-e;r=new u(i,void 0);for(var o=0;o<i;++o)r[o]=this[o+e]}return r},u.prototype.readUIntLE=function(e,t,r){e|=0,t|=0,r||P(e,t,this.length);for(var n=this[e],i=1,o=0;++o<t&&(i*=256);)n+=this[e+o]*i;return n},u.prototype.readUIntBE=function(e,t,r){e|=0,t|=0,r||P(e,t,this.length);for(var n=this[e+--t],i=1;t>0&&(i*=256);)n+=this[e+--t]*i;return n},u.prototype.readUInt8=function(e,t){return t||P(e,1,this.length),this[e]},u.prototype.readUInt16LE=function(e,t){return t||P(e,2,this.length),this[e]|this[e+1]<<8},u.prototype.readUInt16BE=function(e,t){return t||P(e,2,this.length),this[e]<<8|this[e+1]},u.prototype.readUInt32LE=function(e,t){return t||P(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},u.prototype.readUInt32BE=function(e,t){return t||P(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},u.prototype.readIntLE=function(e,t,r){e|=0,t|=0,r||P(e,t,this.length);for(var n=this[e],i=1,o=0;++o<t&&(i*=256);)n+=this[e+o]*i;return n>=(i*=128)&&(n-=Math.pow(2,8*t)),n},u.prototype.readIntBE=function(e,t,r){e|=0,t|=0,r||P(e,t,this.length);for(var n=t,i=1,o=this[e+--n];n>0&&(i*=256);)o+=this[e+--n]*i;return o>=(i*=128)&&(o-=Math.pow(2,8*t)),o},u.prototype.readInt8=function(e,t){return t||P(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},u.prototype.readInt16LE=function(e,t){t||P(e,2,this.length);var r=this[e]|this[e+1]<<8;return 32768&r?4294901760|r:r},u.prototype.readInt16BE=function(e,t){t||P(e,2,this.length);var r=this[e+1]|this[e]<<8;return 32768&r?4294901760|r:r},u.prototype.readInt32LE=function(e,t){return t||P(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},u.prototype.readInt32BE=function(e,t){return t||P(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},u.prototype.readFloatLE=function(e,t){return t||P(e,4,this.length),i.read(this,e,!0,23,4)},u.prototype.readFloatBE=function(e,t){return t||P(e,4,this.length),i.read(this,e,!1,23,4)},u.prototype.readDoubleLE=function(e,t){return t||P(e,8,this.length),i.read(this,e,!0,52,8)},u.prototype.readDoubleBE=function(e,t){return t||P(e,8,this.length),i.read(this,e,!1,52,8)},u.prototype.writeUIntLE=function(e,t,r,n){e=+e,t|=0,r|=0,n||O(this,e,t,r,Math.pow(2,8*r)-1,0);var i=1,o=0;for(this[t]=255&e;++o<r&&(i*=256);)this[t+o]=e/i&255;return t+r},u.prototype.writeUIntBE=function(e,t,r,n){e=+e,t|=0,r|=0,n||O(this,e,t,r,Math.pow(2,8*r)-1,0);var i=r-1,o=1;for(this[t+i]=255&e;--i>=0&&(o*=256);)this[t+i]=e/o&255;return t+r},u.prototype.writeUInt8=function(e,t,r){return e=+e,t|=0,r||O(this,e,t,1,255,0),u.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[t]=255&e,t+1},u.prototype.writeUInt16LE=function(e,t,r){return e=+e,t|=0,r||O(this,e,t,2,65535,0),u.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):R(this,e,t,!0),t+2},u.prototype.writeUInt16BE=function(e,t,r){return e=+e,t|=0,r||O(this,e,t,2,65535,0),u.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):R(this,e,t,!1),t+2},u.prototype.writeUInt32LE=function(e,t,r){return e=+e,t|=0,r||O(this,e,t,4,4294967295,0),u.TYPED_ARRAY_SUPPORT?(this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e):N(this,e,t,!0),t+4},u.prototype.writeUInt32BE=function(e,t,r){return e=+e,t|=0,r||O(this,e,t,4,4294967295,0),u.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):N(this,e,t,!1),t+4},u.prototype.writeIntLE=function(e,t,r,n){if(e=+e,t|=0,!n){var i=Math.pow(2,8*r-1);O(this,e,t,r,i-1,-i)}var o=0,s=1,a=0;for(this[t]=255&e;++o<r&&(s*=256);)e<0&&0===a&&0!==this[t+o-1]&&(a=1),this[t+o]=(e/s>>0)-a&255;return t+r},u.prototype.writeIntBE=function(e,t,r,n){if(e=+e,t|=0,!n){var i=Math.pow(2,8*r-1);O(this,e,t,r,i-1,-i)}var o=r-1,s=1,a=0;for(this[t+o]=255&e;--o>=0&&(s*=256);)e<0&&0===a&&0!==this[t+o+1]&&(a=1),this[t+o]=(e/s>>0)-a&255;return t+r},u.prototype.writeInt8=function(e,t,r){return e=+e,t|=0,r||O(this,e,t,1,127,-128),u.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),e<0&&(e=255+e+1),this[t]=255&e,t+1},u.prototype.writeInt16LE=function(e,t,r){return e=+e,t|=0,r||O(this,e,t,2,32767,-32768),u.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):R(this,e,t,!0),t+2},u.prototype.writeInt16BE=function(e,t,r){return e=+e,t|=0,r||O(this,e,t,2,32767,-32768),u.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):R(this,e,t,!1),t+2},u.prototype.writeInt32LE=function(e,t,r){return e=+e,t|=0,r||O(this,e,t,4,2147483647,-2147483648),u.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24):N(this,e,t,!0),t+4},u.prototype.writeInt32BE=function(e,t,r){return e=+e,t|=0,r||O(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),u.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):N(this,e,t,!1),t+4},u.prototype.writeFloatLE=function(e,t,r){return K(this,e,t,!0,r)},u.prototype.writeFloatBE=function(e,t,r){return K(this,e,t,!1,r)},u.prototype.writeDoubleLE=function(e,t,r){return j(this,e,t,!0,r)},u.prototype.writeDoubleBE=function(e,t,r){return j(this,e,t,!1,r)},u.prototype.copy=function(e,t,r,n){if(r||(r=0),n||0===n||(n=this.length),t>=e.length&&(t=e.length),t||(t=0),n>0&&n<r&&(n=r),n===r)return 0;if(0===e.length||0===this.length)return 0;if(t<0)throw new RangeError("targetStart out of bounds");if(r<0||r>=this.length)throw new RangeError("sourceStart out of bounds");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),e.length-t<n-r&&(n=e.length-t+r);var i,o=n-r;if(this===e&&r<t&&t<n)for(i=o-1;i>=0;--i)e[i+t]=this[i+r];else if(o<1e3||!u.TYPED_ARRAY_SUPPORT)for(i=0;i<o;++i)e[i+t]=this[i+r];else Uint8Array.prototype.set.call(e,this.subarray(r,r+o),t);return o},u.prototype.fill=function(e,t,r,n){if("string"==typeof e){if("string"==typeof t?(n=t,t=0,r=this.length):"string"==typeof r&&(n=r,r=this.length),1===e.length){var i=e.charCodeAt(0);i<256&&(e=i)}if(void 0!==n&&"string"!=typeof n)throw new TypeError("encoding must be a string");if("string"==typeof n&&!u.isEncoding(n))throw new TypeError("Unknown encoding: "+n)}else"number"==typeof e&&(e&=255);if(t<0||this.length<t||this.length<r)throw new RangeError("Out of range index");if(r<=t)return this;var o;if(t>>>=0,r=void 0===r?this.length:r>>>0,e||(e=0),"number"==typeof e)for(o=t;o<r;++o)this[o]=e;else{var s=u.isBuffer(e)?e:U(new u(e,n).toString()),a=s.length;for(o=0;o<r-t;++o)this[o+t]=s[o%a]}return this};var M=/[^+\/0-9A-Za-z-_]/g;function D(e){return e<16?"0"+e.toString(16):e.toString(16)}function U(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))>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 F(e){return n.toByteArray(function(e){if((e=function(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")}(e).replace(M,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function q(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}}).call(this,r(6))},function(e,t,r){(function(n){function i(){var e;try{e=t.storage.debug}catch(e){}return!e&&void 0!==n&&"env"in n&&(e=n.env.DEBUG),e}(t=e.exports=r(690)).log=function(){return"object"==typeof console&&console.log&&Function.prototype.apply.call(console.log,console,arguments)},t.formatArgs=function(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&&"%c"===e&&(o=++i)}),e.splice(o,0,n)}},t.save=function(e){try{null==e?t.storage.removeItem("debug"):t.storage.debug=e}catch(e){}},t.load=i,t.useColors=function(){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+)/))},t.storage="undefined"!=typeof chrome&&void 0!==chrome.storage?chrome.storage.local:function(){try{return window.localStorage}catch(e){}}(),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(i())}).call(this,r(7))},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=function(e){return e&&e.__esModule?e:{default:e}}(r(213));t.default=n.default,e.exports=t.default},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e,t){if(t=(0,o.default)(t||i.default),!(0,n.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 c(t){var n=(0,u.default)(e[r++]);t.push((0,a.default)(f)),n.apply(null,t)}function f(n){if(n||r===e.length)return t.apply(null,arguments);c((0,s.default)(arguments,1))}c([])};var n=c(r(88)),i=c(r(62)),o=c(r(156)),s=c(r(102)),a=c(r(103)),u=c(r(36));function c(e){return e&&e.__esModule?e:{default:e}}e.exports=t.default},function(e,t){"function"==typeof Object.create?e.exports=function(e,t){e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})}:e.exports=function(e,t){e.super_=t;var r=function(){};r.prototype=t.prototype,e.prototype=new r,e.prototype.constructor=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){var r,n,i=e.exports={};function o(){throw new Error("setTimeout has not been defined")}function s(){throw new Error("clearTimeout has not been defined")}function a(e){if(r===setTimeout)return setTimeout(e,0);if((r===o||!r)&&setTimeout)return r=setTimeout,setTimeout(e,0);try{return r(e,0)}catch(t){try{return r.call(null,e,0)}catch(t){return r.call(this,e,0)}}}!function(){try{r="function"==typeof setTimeout?setTimeout:o}catch(e){r=o}try{n="function"==typeof clearTimeout?clearTimeout:s}catch(e){n=s}}();var u,c=[],f=!1,l=-1;function h(){f&&u&&(f=!1,u.length?c=u.concat(c):l=-1,c.length&&p())}function p(){if(!f){var e=a(h);f=!0;for(var t=c.length;t;){for(u=c,c=[];++l<t;)u&&u[l].run();l=-1,t=c.length}u=null,f=!1,function(e){if(n===clearTimeout)return clearTimeout(e);if((n===s||!n)&&clearTimeout)return n=clearTimeout,clearTimeout(e);try{n(e)}catch(t){try{return n.call(null,e)}catch(t){return n.call(this,e)}}}(e)}}function d(e,t){this.fun=e,this.array=t}function y(){}i.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 d(e,t)),1!==c.length||f||a(p)},d.prototype.run=function(){this.fun.apply(null,this.array)},i.title="browser",i.browser=!0,i.env={},i.argv=[],i.version="",i.versions={},i.on=y,i.addListener=y,i.once=y,i.off=y,i.removeListener=y,i.removeAllListeners=y,i.emit=y,i.prependListener=y,i.prependOnceListener=y,i.listeners=function(e){return[]},i.binding=function(e){throw new Error("process.binding is not supported")},i.cwd=function(){return"/"},i.chdir=function(e){throw new Error("process.chdir is not supported")},i.umask=function(){return 0}},function(e,t,r){"use strict";var n=r(656),i=r(662),o=r(667);for(var s in(t=e.exports=r(70)).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(12),i=r(342),o=r(654),s=r(152),a=r(343),u=r(12),c=r(655);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,r){"use strict";(function(t){var n=r(753),i=r(757);e.exports=function(e,r){if(r||(r={}),!e)throw new Error("Pass in a .proto string or a protobuf-schema parsed object");var o="object"!=typeof e||t.isBuffer(e)?n.parse(e):e,s=function(){var e=this;i(o,r.encodings||{}).forEach(function(t){e[t.name]=function(e){if(!e)return null;var t={};return Object.keys(e).forEach(function(r){t[r]=e[r].value}),t}(t.values)||t})};return s.prototype.toString=function(){return n.stringify(o)},s.prototype.toJSON=function(){return o},new s}}).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"object"==typeof e&&null!==e}function o(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(!function(e){return"number"==typeof e}(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,s,a,u,c;if(this._events||(this._events={}),"error"===e&&(!this._events.error||i(this._events.error)&&!this._events.error.length)){if((t=arguments[1])instanceof Error)throw t;var f=new Error('Uncaught, unspecified "error" event. ('+t+")");throw f.context=t,f}if(o(r=this._events[e]))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(i(r))for(a=Array.prototype.slice.call(arguments,1),s=(c=r.slice()).length,u=0;u<s;u++)c[u].apply(this,a);return!0},r.prototype.addListener=function(e,t){var s;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]?i(this._events[e])?this._events[e].push(t):this._events[e]=[this._events[e],t]:this._events[e]=t,i(this._events[e])&&!this._events[e].warned&&(s=o(this._maxListeners)?r.defaultMaxListeners:this._maxListeners)&&s>0&&this._events[e].length>s&&(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,o,s,a;if(!n(t))throw TypeError("listener must be a function");if(!this._events||!this._events[e])return this;if(s=(r=this._events[e]).length,o=-1,r===t||n(r.listener)&&r.listener===t)delete this._events[e],this._events.removeListener&&this.emit("removeListener",e,t);else if(i(r)){for(a=s;a-- >0;)if(r[a]===t||r[a].listener&&r[a].listener===t){o=a;break}if(o<0)return this;1===r.length?(r.length=0,delete this._events[e]):r.splice(o,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(n(r=this._events[e]))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){return this._events&&this._events[e]?n(this._events[e])?[this._events[e]]:this._events[e].slice():[]},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,r){"use strict";(function(e){const n=r(14),i=r(341);t.names=i.names,t.codes=i.codes,t.defaultLengths=i.defaultLengths;const o=r(20);function s(e){t.decode(e)}t.toHexString=function(t){if(!e.isBuffer(t))throw new Error("must be passed a buffer");return t.toString("hex")},t.fromHexString=function(t){return e.from(t,"hex")},t.toB58String=function(t){if(!e.isBuffer(t))throw new Error("must be passed a buffer");return n.encode(t)},t.fromB58String=function(t){let r=t;return e.isBuffer(t)&&(r=t.toString()),e.from(n.decode(r))},t.decode=function(r){if(!e.isBuffer(r))throw new Error("multihash must be a Buffer");if(r.length<3)throw new Error("multihash too short. must be > 3 bytes.");let n=o.decode(r);if(!t.isValidCode(n))throw new Error(`multihash unknown function code: 0x${n.toString(16)}`);r=r.slice(o.decode.bytes);let s=o.decode(r);if(s<1)throw new Error(`multihash invalid length: 0x${s.toString(16)}`);if((r=r.slice(o.decode.bytes)).length!==s)throw new Error(`multihash length inconsistent: 0x${r.toString("hex")}`);return{code:n,name:i.codes[n],length:s,digest:r}},t.encode=function(r,n,i){if(!r||!n)throw new Error("multihash encode requires at least two args: digest, code");const s=t.coerceCode(n);if(!e.isBuffer(r))throw new Error("digest should be a Buffer");if(null==i&&(i=r.length),i&&r.length!==i)throw new Error("digest length should be equal to specified length.");return e.concat([e.from(o.encode(s)),e.from(o.encode(i)),r])},t.coerceCode=function(e){let r=e;if("string"==typeof e){if(!i.names[e])throw new Error(`Unrecognized hash function named: ${e}`);r=i.names[e]}if("number"!=typeof r)throw new Error(`Hash function code should be a number. Got: ${r}`);if(!i.codes[r]&&!t.isAppCode(r))throw new Error(`Unrecognized function code: ${r}`);return r},t.isAppCode=function(e){return e>0&&e<16},t.isValidCode=function(e){return!!t.isAppCode(e)||!!i.codes[e]},t.validate=s,t.prefix=function(e){return s(e),e.slice(0,2)}}).call(this,r(0).Buffer)},function(e,t){e.exports={options:{usePureJavaScript:!1}}},function(e,t,r){var n=r(340);e.exports=n("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz")},function(e,t,r){"use strict";const n=t;n.bignum=r(53),n.define=r(930).define,n.base=r(135),n.constants=r(466),n.decoders=r(935),n.encoders=r(937)},function(e,t,r){e.exports=r(13),r(98),r(917),r(76),r(257),r(459),r(182),r(919),r(133),r(920),r(461),r(921),r(458),r(259),r(112),r(454),r(456),r(922),r(448),r(455),r(452),r(261),r(69),r(453),r(923),r(924),r(447),r(19)},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(104),s=Object.prototype.hasOwnProperty,a=Array.prototype.slice,u="foo"===function(){}.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=m,h=/\s*function\s+([^\(\s]*)\s*/;function p(e){if(o.isFunction(e)){if(u)return e.name;var t=e.toString().match(h);return t&&t[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);return"[Function"+(t?": "+t:"")+"]"}function g(e,t,r,n,i){throw new l.AssertionError({message:r,actual:e,expected:t,operator:n,stackStartFunction:i})}function m(e,t){e||g(e,!0,t,"==",l.ok)}function b(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;var a=(s=s||{actual:[],expected:[]}).actual.indexOf(e);return-1!==a&&a===s.expected.indexOf(t)||(s.actual.push(e),s.expected.push(t),_(e,t,r,s))}return r?e===t:e==t}function v(e){return"[object Arguments]"==Object.prototype.toString.call(e)}function _(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=v(e),s=v(t);if(i&&!s||!i&&s)return!1;if(i)return b(e=a.call(e),t=a.call(t),r);var u,c,f=k(e),l=k(t);if(f.length!==l.length)return!1;for(f.sort(),l.sort(),c=f.length-1;c>=0;c--)if(f[c]!==l[c])return!1;for(c=f.length-1;c>=0;c--)if(!b(e[u=f[c]],t[u],r,n))return!1;return!0}function w(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 S(e,t,r,n){var i;if("function"!=typeof t)throw new TypeError('"block" argument must be a function');"string"==typeof r&&(n=r,r=null),i=function(e){var t;try{e()}catch(e){t=e}return t}(t),n=(r&&r.name?" ("+r.name+").":".")+(n?" "+n:"."),e&&!i&&g(i,r,"Missing expected exception"+n);var s="string"==typeof n,a=!e&&o.isError(i),u=!e&&i&&!r;if((a&&s&&w(i,r)||u)&&g(i,r,"Got unwanted exception"+n),e&&i&&r&&!w(i,r)||!e&&i)throw i}l.AssertionError=function(e){this.name="AssertionError",this.actual=e.actual,this.expected=e.expected,this.operator=e.operator,e.message?(this.message=e.message,this.generatedMessage=!1):(this.message=function(e){return d(y(e.actual),128)+" "+e.operator+" "+d(y(e.expected),128)}(this),this.generatedMessage=!0);var t=e.stackStartFunction||g;if(Error.captureStackTrace)Error.captureStackTrace(this,t);else{var r=new Error;if(r.stack){var n=r.stack,i=p(t),o=n.indexOf("\n"+i);if(o>=0){var s=n.indexOf("\n",o+1);n=n.substring(s+1)}this.stack=n}}},o.inherits(l.AssertionError,Error),l.fail=g,l.ok=m,l.equal=function(e,t,r){e!=t&&g(e,t,r,"==",l.equal)},l.notEqual=function(e,t,r){e==t&&g(e,t,r,"!=",l.notEqual)},l.deepEqual=function(e,t,r){b(e,t,!1)||g(e,t,r,"deepEqual",l.deepEqual)},l.deepStrictEqual=function(e,t,r){b(e,t,!0)||g(e,t,r,"deepStrictEqual",l.deepStrictEqual)},l.notDeepEqual=function(e,t,r){b(e,t,!1)&&g(e,t,r,"notDeepEqual",l.notDeepEqual)},l.notDeepStrictEqual=function e(t,r,n){b(t,r,!0)&&g(t,r,n,"notDeepStrictEqual",e)},l.strictEqual=function(e,t,r){e!==t&&g(e,t,r,"===",l.strictEqual)},l.notStrictEqual=function(e,t,r){e===t&&g(e,t,r,"!==",l.notStrictEqual)},l.throws=function(e,t,r){S(!0,e,t,r)},l.doesNotThrow=function(e,t,r){S(!1,e,t,r)},l.ifError=function(e){if(e)throw e};var k=Object.keys||function(e){var t=[];for(var r in e)s.call(e,r)&&t.push(r);return t}}).call(this,r(6))},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>
|
||
*/
|
||
/**
|
||
* @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,a,u="3.10.1",c=1,f=2,l=4,h=8,p=16,d=32,y=64,g=128,m=256,b=30,v="...",_=150,w=16,S=200,k=1,E=2,A="Expected a function",x="__lodash_placeholder__",I="[object Arguments]",T="[object Array]",B="[object Boolean]",C="[object Date]",P="[object Error]",O="[object Function]",R="[object Map]",N="[object Number]",L="[object Object]",K="[object RegExp]",j="[object Set]",M="[object String]",D="[object WeakMap]",U="[object ArrayBuffer]",F="[object Float32Array]",q="[object Float64Array]",H="[object Int8Array]",z="[object Int16Array]",V="[object Int32Array]",G="[object Uint8Array]",W="[object Uint8ClampedArray]",$="[object Uint16Array]",Y="[object Uint32Array]",J=/\b__p \+= '';/g,X=/\b(__p \+=) '' \+/g,Z=/(__e\(.*?\)|\b__t\)) \+\n'';/g,Q=/&(?:amp|lt|gt|quot|#39|#96);/g,ee=/[&<>"'`]/g,te=RegExp(Q.source),re=RegExp(ee.source),ne=/<%-([\s\S]+?)%>/g,ie=/<%([\s\S]+?)%>/g,oe=/<%=([\s\S]+?)%>/g,se=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\n\\]|\\.)*?\1)\]/,ae=/^\w*$/,ue=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\n\\]|\\.)*?)\2)\]/g,ce=/^[:!,]|[\\^$.*+?()[\]{}|\/]|(^[0-9a-fA-Fnrtuvx])|([\n\r\u2028\u2029])/g,fe=RegExp(ce.source),le=/[\u0300-\u036f\ufe20-\ufe23]/g,he=/\\(\\)?/g,pe=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,de=/\w*$/,ye=/^0[xX]/,ge=/^\[object .+?Constructor\]$/,me=/^\d+$/,be=/[\xc0-\xd6\xd8-\xde\xdf-\xf6\xf8-\xff]/g,ve=/($^)/,_e=/['\n\r\u2028\u2029\\]/g,we=(s="[A-Z\\xc0-\\xd6\\xd8-\\xde]",a="[a-z\\xdf-\\xf6\\xf8-\\xff]+",RegExp(s+"+(?="+s+a+")|"+s+"?"+a+"|"+s+"+|[0-9]+","g")),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[F]=Ee[q]=Ee[H]=Ee[z]=Ee[V]=Ee[G]=Ee[W]=Ee[$]=Ee[Y]=!0,Ee[I]=Ee[T]=Ee[U]=Ee[B]=Ee[C]=Ee[P]=Ee[O]=Ee[R]=Ee[N]=Ee[L]=Ee[K]=Ee[j]=Ee[M]=Ee[D]=!1;var Ae={};Ae[I]=Ae[T]=Ae[U]=Ae[B]=Ae[C]=Ae[F]=Ae[q]=Ae[H]=Ae[z]=Ae[V]=Ae[N]=Ae[L]=Ae[K]=Ae[M]=Ae[G]=Ae[W]=Ae[$]=Ae[Y]=!0,Ae[P]=Ae[O]=Ae[R]=Ae[j]=Ae[D]=!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,Ke=Be[typeof window]&&window&&window.Object&&window,je=(Re&&Re.exports,Ne||Ke!==(this&&this.window)&&Ke||Le||this);function Me(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 De(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 Ue(e,t,r){if(t!=t)return Je(e,r);for(var n=r-1,i=e.length;++n<i;)if(e[n]===t)return n;return-1}function Fe(e){return"function"==typeof e||!1}function qe(e){return null==e?"":e+""}function He(e,t){for(var r=-1,n=e.length;++r<n&&t.indexOf(e.charAt(r))>-1;);return r}function ze(e,t){for(var r=e.length;r--&&t.indexOf(e.charAt(r))>-1;);return r}function Ve(e,t){return Me(e.criteria,t.criteria)||e.index-t.index}function Ge(e){return xe[e]}function We(e){return Ie[e]}function $e(e,t,r){return t?e=Ce[e]:r&&(e=Pe[e]),"\\"+e}function Ye(e){return"\\"+Pe[e]}function Je(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 Xe(e){return!!e&&"object"==typeof e}function Ze(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 Qe(e,t){for(var r=-1,n=e.length,i=-1,o=[];++r<n;)e[r]===t&&(e[r]=x,o[++i]=r);return o}function et(e){for(var t=-1,r=e.length;++t<r&&Ze(e.charCodeAt(t)););return t}function tt(e){for(var t=e.length;t--&&Ze(e.charCodeAt(t)););return t}function rt(e){return Te[e]}var nt=function e(t){var r=(t=t?nt.defaults(je.Object(),t,nt.pick(je,Se)):je).Array,n=t.Date,i=t.Error,s=t.Function,a=t.Math,R=t.Number,j=t.Object,D=t.RegExp,xe=t.String,Ie=t.TypeError,Te=r.prototype,Be=j.prototype,Ce=xe.prototype,Pe=s.prototype.toString,Oe=Be.hasOwnProperty,Re=0,Ne=Be.toString,Le=je._,Ke=D("^"+Pe.call(Oe).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Ze=t.ArrayBuffer,it=t.clearTimeout,ot=t.parseFloat,st=a.pow,at=Be.propertyIsEnumerable,ut=Sn(t,"Set"),ct=t.setTimeout,ft=Te.splice,lt=t.Uint8Array,ht=Sn(t,"WeakMap"),pt=a.ceil,dt=Sn(j,"create"),yt=a.floor,gt=Sn(r,"isArray"),mt=t.isFinite,bt=Sn(j,"keys"),vt=a.max,_t=a.min,wt=Sn(n,"now"),St=t.parseInt,kt=a.random,Et=R.NEGATIVE_INFINITY,At=R.POSITIVE_INFINITY,xt=4294967295,It=xt-1,Tt=xt>>>1,Bt=9007199254740991,Ct=ht&&new ht,Pt={};function Ot(e){if(Xe(e)&&!Xi(e)&&!(e instanceof Lt)){if(e instanceof Nt)return e;if(Oe.call(e,"__chain__")&&Oe.call(e,"__wrapped__"))return Fn(e)}return new Nt(e)}function Rt(){}function Nt(e,t,r){this.__wrapped__=e,this.__actions__=r||[],this.__chain__=!!t}Ot.support={};function Lt(e){this.__wrapped__=e,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=At,this.__views__=[]}function Kt(){this.__data__={}}function jt(e){var t=e?e.length:0;for(this.data={hash:dt(null),set:new ut};t--;)this.push(e[t])}function Mt(e,t){var r=e.data;return("string"==typeof t||to(t)?r.set.has(t):r.hash[t])?0:-1}function Dt(e,t){for(var n=-1,i=e.length,o=-1,s=t.length,a=r(i+s);++n<i;)a[n]=e[n];for(;++o<s;)a[n++]=t[o];return a}function Ut(e,t){var n=-1,i=e.length;for(t||(t=r(i));++n<i;)t[n]=e[n];return t}function Ft(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=-1,n=e.length;++r<n;)if(!t(e[r],r,e))return!1;return!0}function Ht(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 zt(e,t){for(var n=-1,i=e.length,o=r(i);++n<i;)o[n]=t(e[n],n,e);return o}function Vt(e,t){for(var r=-1,n=t.length,i=e.length;++r<n;)e[i+r]=t[r];return e}function Gt(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 Wt(e,t){for(var r=-1,n=e.length;++r<n;)if(t(e[r],r,e))return!0;return!1}function $t(e,t,r,n){return e!==o&&Oe.call(n,r)?e:t}function Yt(e,t,r){for(var n=-1,i=ko(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 Jt(e,t){return null==t?e:Zt(t,ko(t),e)}function Xt(e,t){for(var n=-1,i=null==e,s=!i&&En(e),a=s?e.length:0,u=t.length,c=r(u);++n<u;){var f=t[n];c[n]=s?An(f,a)?e[f]:o:i?o:e[f]}return c}function Zt(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 Qt(e,t,r){var n=typeof e;return"function"==n?t===o?e:Kr(e,t,r):null==e?Ho:"object"==n?_r(e):t===o?Yo(e):wr(e,t)}function er(e,t,r,n,i,s,a){var u;if(r&&(u=i?r(e,n,i):r(e)),u!==o)return u;if(!to(e))return e;var c=Xi(e);if(c){if(u=function(e){var t=e.length,r=new e.constructor(t);return t&&"string"==typeof e[0]&&Oe.call(e,"index")&&(r.index=e.index,r.input=e.input),r}(e),!t)return Ut(e,u)}else{var f=Ne.call(e),l=f==O;if(f!=L&&f!=I&&(!l||i))return Ae[f]?function(e,t,r){var n=e.constructor;switch(t){case U:return jr(e);case B:case C:return new n(+e);case F:case q:case H:case z:case V:case G:case W:case $:case Y:var i=e.buffer;return new n(r?jr(i):i,e.byteOffset,e.length);case N:case M:return new n(e);case K:var o=new n(e.source,de.exec(e));o.lastIndex=e.lastIndex}return o}(e,f,t):i?e:{};if(u=function(e){var t=e.constructor;return"function"==typeof t&&t instanceof t||(t=j),new t}(l?{}:e),!t)return Jt(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?Ft:pr)(e,function(n,i){u[i]=er(n,t,r,i,e,s,a)}),u}Ot.templateSettings={escape:ne,evaluate:ie,interpolate:oe,variable:"",imports:{_:Ot}};var tr=function(){function e(){}return function(t){if(to(t)){e.prototype=t;var r=new e;e.prototype=o}return r||{}}}();function rr(e,t,r){if("function"!=typeof e)throw new Ie(A);return ct(function(){e.apply(o,r)},t)}function nr(e,t){var r=e?e.length:0,n=[];if(!r)return n;var i=-1,o=vn(),s=o==Ue,a=s&&t.length>=S?zr(t):null,u=t.length;a&&(o=Mt,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 ir=qr(pr),or=qr(dr,!0);function sr(e,t){var r=!0;return ir(e,function(e,n,i){return r=!!t(e,n,i)}),r}function ar(e,t){var r=[];return ir(e,function(e,n,i){t(e,n,i)&&r.push(e)}),r}function ur(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 cr(e,t,r,n){n||(n=[]);for(var i=-1,o=e.length;++i<o;){var s=e[i];Xe(s)&&En(s)&&(r||Xi(s)||Ji(s))?t?cr(s,t,r,n):Vt(n,s):r||(n[n.length]=s)}return n}var fr=Hr(),lr=Hr(!0);function hr(e,t){return fr(e,t,Eo)}function pr(e,t){return fr(e,t,ko)}function dr(e,t){return lr(e,t,ko)}function yr(e,t){for(var r=-1,n=t.length,i=-1,o=[];++r<n;){var s=t[r];eo(e[s])&&(o[++i]=s)}return o}function gr(e,t,r){if(null!=e){r!==o&&r in Dn(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 mr(e,t,r,n,i,o){return e===t||(null==e||null==t||!to(e)&&!Xe(t)?e!=e&&t!=t:function(e,t,r,n,i,o,s){var a=Xi(e),u=Xi(t),c=T,f=T;a||((c=Ne.call(e))==I?c=L:c!=L&&(a=ao(e))),u||((f=Ne.call(t))==I?f=L:f!=L&&(u=ao(t)));var l=c==L,h=f==L,p=c==f;if(p&&!a&&!l)return function(e,t,r){switch(r){case B:case C:return+e==+t;case P:return e.name==t.name&&e.message==t.message;case N:return e!=+e?t!=+t:e==+t;case K:case M:return e==t+""}return!1}(e,t,c);if(!i){var d=l&&Oe.call(e,"__wrapped__"),y=h&&Oe.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:yn)(e,t,r,n,i,o,s);return o.pop(),s.pop(),m}(e,t,mr,r,n,i,o))}function br(e,t,r){var n=t.length,i=n,s=!r;if(null==e)return!i;for(e=Dn(e);n--;){var a=t[n];if(s&&a[2]?a[1]!==e[a[0]]:!(a[0]in e))return!1}for(;++n<i;){var u=(a=t[n])[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?mr(f,c,r,!0):l))return!1}}return!0}function vr(e,t){var n=-1,i=En(e)?r(e.length):[];return ir(e,function(e,r,o){i[++n]=t(e,r,o)}),i}function _r(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 Dn(e))}}return function(e){return br(e,t)}}function wr(e,t){var r=Xi(e),n=In(e)&&Cn(t),i=e+"";return e=Un(e),function(s){if(null==s)return!1;var a=i;if(s=Dn(s),(r||!n)&&!(a in s)){if(null==(s=1==e.length?s:gr(s,xr(e,0,-1))))return!1;a=Jn(e),s=Dn(s)}return s[a]===t?t!==o||a in s:mr(t,s[a],o,!0)}}function Sr(e){return function(t){return null==t?o:t[e]}}function kr(e,t){for(var r=e?t.length:0;r--;){var n=t[r];if(n!=i&&An(n)){var i=n;ft.call(e,n,1)}}return e}function Er(e,t){return e+yt(kt()*(t-e+1))}var Ar=Ct?function(e,t){return Ct.set(e,t),e}:Ho;function xr(e,t,n){var i=-1,s=e.length;(t=null==t?0:+t||0)<0&&(t=-t>s?0:s+t),(n=n===o||n>s?s:+n||0)<0&&(n+=s),s=t>n?0:n-t>>>0,t>>>=0;for(var a=r(s);++i<s;)a[i]=e[i+t];return a}function Ir(e,t){var r;return ir(e,function(e,n,i){return!(r=t(e,n,i))}),!!r}function Tr(e,t){var r=e.length;for(e.sort(t);r--;)e[r]=e[r].value;return e}function Br(e,t,r){var n=gn(),i=-1;return t=zt(t,function(e){return n(e)}),Tr(vr(e,function(e){return{criteria:zt(t,function(t){return t(e)}),index:++i,value:e}}),function(e,t){return function(e,t,r){for(var n=-1,i=e.criteria,o=t.criteria,s=i.length,a=r.length;++n<s;){var u=Me(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}(e,t,r)})}function Cr(e,t){var r=-1,n=vn(),i=e.length,o=n==Ue,s=o&&i>=S,a=s?zr():null,u=[];a?(n=Mt,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 Pr(e,t){for(var n=-1,i=t.length,o=r(i);++n<i;)o[n]=e[t[n]];return o}function Or(e,t,r,n){for(var i=e.length,o=n?i:-1;(n?o--:++o<i)&&t(e[o],o,e););return r?xr(e,n?0:o,n?o+1:i):xr(e,n?o+1:0,n?i:o)}function Rr(e,t){var r=e;r instanceof Lt&&(r=r.value());for(var n=-1,i=t.length;++n<i;){var o=t[n];r=o.func.apply(o.thisArg,Vt([r],o.args))}return r}function Nr(e,t,r){var n=0,i=e?e.length:n;if("number"==typeof t&&t==t&&i<=Tt){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 Lr(e,t,Ho,r)}function Lr(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=yt((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 _t(s,It)}function Kr(e,t,r){if("function"!=typeof e)return Ho;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 jr(e){var t=new Ze(e.byteLength);return new lt(t).set(new lt(e)),t}function Mr(e,t,n){for(var i=n.length,o=-1,s=vt(e.length-i,0),a=-1,u=t.length,c=r(u+s);++a<u;)c[a]=t[a];for(;++o<i;)c[n[o]]=e[o];for(;s--;)c[a++]=e[o++];return c}function Dr(e,t,n){for(var i=-1,o=n.length,s=-1,a=vt(e.length-o,0),u=-1,c=t.length,f=r(a+c);++s<a;)f[s]=e[s];for(var l=s;++u<c;)f[l+u]=t[u];for(;++i<o;)f[l+n[i]]=e[s++];return f}function Ur(e,t){return function(r,n,i){var o=t?t():{};if(n=gn(n,i,3),Xi(r))for(var s=-1,a=r.length;++s<a;){var u=r[s];e(o,u,n(u,s,r),r)}else ir(r,function(t,r,i){e(o,t,n(t,r,i),i)});return o}}function Fr(e){return $i(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=Kr(s,u,5),i-=2):i-=(s="function"==typeof u?u:o)?1:0,a&&xn(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 qr(e,t){return function(r,n){var i=r?_n(r):0;if(!Bn(i))return e(r,n);for(var o=t?i:-1,s=Dn(r);(t?o--:++o<i)&&!1!==n(s[o],o,s););return r}}function Hr(e){return function(t,r,n){for(var i=Dn(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 zr(e){return dt&&ut?new jt(e):null}function Vr(e){return function(t){for(var r=-1,n=Uo(Oo(t)),i=n.length,o="";++r<i;)o=e(o,n[r],r);return o}}function Gr(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=tr(e.prototype),n=e.apply(r,t);return to(n)?n:r}}function Wr(e){return function t(r,n,i){i&&xn(r,n,i)&&(n=o);var s=pn(r,e,o,o,o,o,o,n);return s.placeholder=t.placeholder,s}}function $r(e,t){return $i(function(r){var n=r[0];return null==n?n:(r.push(t),e.apply(o,r))})}function Yr(e,t){return function(r,n,i){if(i&&xn(r,n,i)&&(n=o),1==(n=gn(n,i,3)).length){var s=function(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}(r=Xi(r)?r:Mn(r),n,e,t);if(!r.length||s!==t)return s}return function(e,t,r,n){var i=n,o=i;return ir(e,function(e,s,a){var u=+t(e,s,a);(r(u,i)||u===n&&u===o)&&(i=u,o=e)}),o}(r,n,e,t)}}function Jr(e,t){return function(r,n,i){if(n=gn(n,i,3),Xi(r)){var s=De(r,n,t);return s>-1?r[s]:o}return ur(r,n,e)}}function Xr(e){return function(t,r,n){return t&&t.length?De(t,r=gn(r,n,3),e):-1}}function Zr(e){return function(t,r,n){return ur(t,r=gn(r,n,3),e,!0)}}function Qr(e){return function(){for(var t,n=arguments.length,i=e?n:-1,s=0,a=r(n);e?i--:++i<n;){var u=a[s++]=arguments[i];if("function"!=typeof u)throw new Ie(A);!t&&Nt.prototype.thru&&"wrapper"==bn(u)&&(t=new Nt([],!0))}for(i=t?-1:n;++i<n;){var c=bn(u=a[i]),f="wrapper"==c?mn(u):o;t=f&&Tn(f[0])&&f[1]==(g|h|d|m)&&!f[4].length&&1==f[9]?t[bn(f[0])].apply(t,f[3]):1==u.length&&Tn(u)?t[c]():t.thru(u)}return function(){var e=arguments,r=e[0];if(t&&1==e.length&&Xi(r)&&r.length>=S)return t.plant(r).value();for(var i=0,o=n?a[i].apply(this,e):r;++i<n;)o=a[i].call(this,o);return o}}}function en(e,t){return function(r,n,i){return"function"==typeof n&&i===o&&Xi(r)?e(r,n):t(r,Kr(n,i,3))}}function tn(e){return function(t,r,n){return"function"==typeof r&&n===o||(r=Kr(r,n,3)),e(t,r,Eo)}}function rn(e){return function(t,r,n){return"function"==typeof r&&n===o||(r=Kr(r,n,3)),e(t,r)}}function nn(e){return function(t,r,n){var i={};return r=gn(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 on(e){return function(t,r,n){return t=qe(t),(e?t:"")+cn(t,r,n)+(e?"":t)}}function sn(e){var t=$i(function(r,n){var i=Qe(n,t.placeholder);return pn(r,e,o,n,i)});return t}function an(e,t){return function(r,n,i,s){var a=arguments.length<3;return"function"==typeof n&&s===o&&Xi(r)?e(r,n,i,a):function(e,t,r,n,i){return i(e,function(e,i,o){r=n?(n=!1,e):t(r,e,i,o)}),r}(r,gn(n,s,4),i,a,t)}}function un(e,t,n,i,s,a,u,m,b,v){var _=t&g,w=t&c,S=t&f,k=t&h,E=t&l,A=t&p,x=S?o:Gr(e);return function l(){for(var h=arguments.length,p=h,g=r(h);p--;)g[p]=arguments[p];if(i&&(g=Mr(g,i,s)),a&&(g=Dr(g,a,u)),k||A){var I=l.placeholder,T=Qe(g,I);if((h-=T.length)<v){var B=m?Ut(m):o,C=vt(v-h,0);t|=k?d:y,t&=~(k?y:d),E||(t&=~(c|f));var P=[e,t,n,k?g:o,k?T:o,k?o:g,k?o:T,B,b,C],O=un.apply(o,P);return Tn(e)&&Kn(O,P),O.placeholder=I,O}}var R=w?n:this,N=S?R[e]:e;return m&&(g=function(e,t){for(var r=e.length,n=_t(t.length,r),i=Ut(e);n--;){var s=t[n];e[n]=An(s,r)?i[s]:o}return e}(g,m)),_&&b<g.length&&(g.length=b),this&&this!==je&&this instanceof l&&(N=x||Gr(e)),N.apply(R,g)}}function cn(e,t,r){var n=e.length;if(n>=(t=+t)||!mt(t))return"";var i=t-n;return Ko(r=null==r?" ":r+"",pt(i/r.length)).slice(0,i)}function fn(e,t,n,i){var o=t&c,s=Gr(e);return function t(){for(var a=-1,u=arguments.length,c=-1,f=i.length,l=r(f+u);++c<f;)l[c]=i[c];for(;u--;)l[c++]=arguments[++a];return(this&&this!==je&&this instanceof t?s:e).apply(o?n:this,l)}}function ln(e){var t=a[e];return function(e,r){return(r=r===o?0:+r||0)?(r=st(10,r),t(e*r)/r):t(e)}}function hn(e){return function(t,r,n,i){var o=gn(n);return null==n&&o===Qt?Nr(t,r,e):Lr(t,r,o(n,i,1),e)}}function pn(e,t,r,n,i,s,a,u){var l=t&f;if(!l&&"function"!=typeof e)throw new Ie(A);var h=n?n.length:0;if(h||(t&=~(d|y),n=i=o),h-=i?i.length:0,t&y){var p=n,g=i;n=i=o}var m=l?o:mn(e),b=[e,t,r,n,i,p,g,s,a,u];if(m&&(Pn(b,m),t=b[1],u=b[9]),b[9]=null==u?l?0:e.length:vt(u-h,0)||0,t==c)var v=function(e,t){var r=Gr(e);return function n(){return(this&&this!==je&&this instanceof n?r:e).apply(t,arguments)}}(b[0],b[2]);else v=t!=d&&t!=(c|d)||b[4].length?un.apply(o,b):fn.apply(o,b);return(m?Ar:Kn)(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(!Wt(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 yn(e,t,r,n,i,s,a){var u=ko(e),c=u.length;if(c!=ko(t).length&&!i)return!1;for(var f=c;f--;){var l=u[f];if(!(i?l in t:Oe.call(t,l)))return!1}for(var h=i;++f<c;){var p=e[l=u[f]],d=t[l],y=n?n(i?d:p,i?p:d,l):o;if(!(y===o?r(p,d,n,i,s,a):y))return!1;h||(h="constructor"==l)}if(!h){var g=e.constructor,m=t.constructor;if(g!=m&&"constructor"in e&&"constructor"in t&&!("function"==typeof g&&g instanceof g&&"function"==typeof m&&m instanceof m))return!1}return!0}function gn(e,t,r){var n=Ot.callback||qo;return n=n===qo?Qt:n,r?n(e,t,r):n}var mn=Ct?function(e){return Ct.get(e)}:$o;function bn(e){for(var t=e.name,r=Pt[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=Ot.indexOf||$n;return n=n===$n?Ue:n,e?n(e,t,r):n}var _n=Sr("length");function wn(e){for(var t=To(e),r=t.length;r--;)t[r][2]=Cn(t[r][1]);return t}function Sn(e,t){var r=null==e?o:e[t];return ro(r)?r:o}function kn(e,t,r){null==e||In(t,e)||(e=1==(t=Un(t)).length?e:gr(e,xr(t,0,-1)),t=Jn(t));var n=null==e?e:e[t];return null==n?o:n.apply(e,r)}function En(e){return null!=e&&Bn(_n(e))}function An(e,t){return e="number"==typeof e||me.test(e)?+e:-1,t=null==t?Bt:t,e>-1&&e%1==0&&e<t}function xn(e,t,r){if(!to(r))return!1;var n=typeof t;if("number"==n?En(r)&&An(t,r.length):"string"==n&&t in r){var i=r[t];return e==e?e===i:i!=i}return!1}function In(e,t){var r=typeof e;return!!("string"==r&&ae.test(e)||"number"==r)||!Xi(e)&&(!se.test(e)||null!=t&&e in Dn(t))}function Tn(e){var t=bn(e);if(!(t in Lt.prototype))return!1;var r=Ot[t];if(e===r)return!0;var n=mn(r);return!!n&&e===n[0]}function Bn(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=Bt}function Cn(e){return e==e&&!to(e)}function Pn(e,t){var r=e[1],n=t[1],i=r|n,o=i<g,s=n==g&&r==h||n==g&&r==m&&e[7].length<=t[8]||n==(g|m)&&r==h;if(!o&&!s)return e;n&c&&(e[2]=t[2],i|=r&c?0:l);var a=t[3];if(a){var u=e[3];e[3]=u?Mr(u,a,t[4]):Ut(a),e[4]=u?Qe(e[3],x):Ut(t[4])}return(a=t[5])&&(u=e[5],e[5]=u?Dr(u,a,t[6]):Ut(a),e[6]=u?Qe(e[5],x):Ut(t[6])),(a=t[7])&&(e[7]=Ut(a)),n&g&&(e[8]=null==e[8]?t[8]:_t(e[8],t[8])),null==e[9]&&(e[9]=t[9]),e[0]=t[0],e[1]=i,e}function On(e,t){e=Dn(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 Rn(e,t){var r={};return hr(e,function(e,n,i){t(e,n,i)&&(r[n]=e)}),r}var Nn,Ln,Kn=(Nn=0,Ln=0,function(e,t){var r=Pi(),n=w-(r-Ln);if(Ln=r,n>0){if(++Nn>=_)return e}else Nn=0;return Ar(e,t)});function jn(e){for(var t=Eo(e),r=t.length,n=r&&e.length,i=!!n&&Bn(n)&&(Xi(e)||Ji(e)),o=-1,s=[];++o<r;){var a=t[o];(i&&An(a,n)||Oe.call(e,a))&&s.push(a)}return s}function Mn(e){return null==e?[]:En(e)?to(e)?e:j(e):Co(e)}function Dn(e){return to(e)?e:j(e)}function Un(e){if(Xi(e))return e;var t=[];return qe(e).replace(ue,function(e,r,n,i){t.push(n?i.replace(he,"$1"):r||e)}),t}function Fn(e){return e instanceof Lt?e.clone():new Nt(e.__wrapped__,e.__chain__,Ut(e.__actions__))}var qn=$i(function(e,t){return Xe(e)&&En(e)?nr(e,cr(t,!1,!0)):[]});function Hn(e,t,r){return e&&e.length?((r?xn(e,t,r):null==t)&&(t=1),xr(e,t<0?0:t)):[]}function zn(e,t,r){var n=e?e.length:0;return n?((r?xn(e,t,r):null==t)&&(t=1),xr(e,0,(t=n-(+t||0))<0?0:t)):[]}var Vn=Xr(),Gn=Xr(!0);function Wn(e){return e?e[0]:o}function $n(e,t,r){var n=e?e.length:0;if(!n)return-1;if("number"==typeof r)r=r<0?vt(n+r,0):r;else if(r){var i=Nr(e,t);return i<n&&(t==t?t===e[i]:e[i]!=e[i])?i:-1}return Ue(e,t,r||0)}var Yn=$i(function(e){for(var t=e.length,n=t,i=r(l),o=vn(),s=o==Ue,a=[];n--;){var u=e[n]=En(u=e[n])?u:[];i[n]=s&&u.length>=120?zr(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?Mt(h,u):o(a,u,0))<0){for(n=t;--n;){var p=i[n];if((p?Mt(p,u):o(e[n],u,0))<0)continue e}h&&h.push(u),a.push(u)}return a});function Jn(e){var t=e?e.length:0;return t?e[t-1]:o}var Xn=$i(function(e,t){var r=Xt(e,t=cr(t));return kr(e,t.sort(Me)),r});function Zn(e){return Hn(e,1)}var Qn=hn(),ei=hn(!0);var ti=$i(function(e){return Cr(cr(e,!1,!0))});function ri(e,t,r,n){if(!e||!e.length)return[];null!=t&&"boolean"!=typeof t&&(r=xn(e,t,n=r)?o:t,t=!1);var i=gn();return null==r&&i===Qt||(r=i(r,n,3)),t&&vn()==Ue?function(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}(e,r):Cr(e,r)}function ni(e){if(!e||!e.length)return[];var t=-1,n=0;e=Ht(e,function(e){if(En(e))return n=vt(e.length,n),!0});for(var i=r(n);++t<n;)i[t]=zt(e,Sr(t));return i}function ii(e,t,r){if(!e||!e.length)return[];var n=ni(e);return null==t?n:(t=Kr(t,r,4),zt(n,function(e){return Gt(e,t,o,!0)}))}var oi=$i(function(e,t){return En(e)?nr(e,t):[]});var si=$i(ni);function ai(e,t){var r=-1,n=e?e.length:0,i={};for(!n||t||Xi(e[0])||(t=[]);++r<n;){var o=e[r];t?i[o]=t[r]:o&&(i[o[0]]=o[1])}return i}var ui=$i(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,ii(e,r,n)});function ci(e){var t=Ot(e);return t.__chain__=!0,t}function fi(e,t,r){return t.call(r,e)}var li=$i(function(e){return e=cr(e),this.thru(function(t){return Dt(Xi(t)?t:[Dn(t)],e)})});var hi=$i(function(e,t){return Xt(e,cr(t))}),pi=Ur(function(e,t,r){Oe.call(e,r)?++e[r]:e[r]=1});function di(e,t,r){var n=Xi(e)?qt:sr;return r&&xn(e,t,r)&&(t=o),"function"==typeof t&&r===o||(t=gn(t,r,3)),n(e,t)}function yi(e,t,r){return(Xi(e)?Ht:ar)(e,t=gn(t,r,3))}var gi=Jr(ir),mi=Jr(or,!0);var bi=en(Ft,ir),vi=en(function(e,t){for(var r=e.length;r--&&!1!==t(e[r],r,e););return e},or),_i=Ur(function(e,t,r){Oe.call(e,r)?e[r].push(t):e[r]=[t]});function wi(e,t,r,n){var i=e?_n(e):0;return Bn(i)||(i=(e=Co(e)).length),r="number"!=typeof r||n&&xn(t,r,n)?0:r<0?vt(i+r,0):r||0,"string"==typeof e||!Xi(e)&&so(e)?r<=i&&e.indexOf(t,r)>-1:!!i&&vn(e,t,r)>-1}var Si=Ur(function(e,t,r){e[r]=t}),ki=$i(function(e,t,n){var i=-1,s="function"==typeof t,a=In(t),u=En(e)?r(e.length):[];return ir(e,function(e){var r=s?t:a&&null!=e?e[t]:o;u[++i]=r?r.apply(e,n):kn(e,t,n)}),u});function Ei(e,t,r){return(Xi(e)?zt:vr)(e,t=gn(t,r,3))}var Ai=Ur(function(e,t,r){e[r?0:1].push(t)},function(){return[[],[]]});var xi=an(Gt,ir),Ii=an(function(e,t,r,n){var i=e.length;for(n&&i&&(r=e[--i]);i--;)r=t(r,e[i],i,e);return r},or);function Ti(e,t,r){if(r?xn(e,t,r):null==t)return(n=(e=Mn(e)).length)>0?e[Er(0,n-1)]:o;var n,i=-1,s=co(e),a=(n=s.length)-1;for(t=_t(t<0?0:+t||0,n);++i<t;){var u=Er(i,a),c=s[u];s[u]=s[i],s[i]=c}return s.length=t,s}function Bi(e,t,r){var n=Xi(e)?Wt:Ir;return r&&xn(e,t,r)&&(t=o),"function"==typeof t&&r===o||(t=gn(t,r,3)),n(e,t)}var Ci=$i(function(e,t){if(null==e)return[];var r=t[2];return r&&xn(t[0],t[1],r)&&(t.length=1),Br(e,cr(t),[])});var Pi=wt||function(){return(new n).getTime()};function Oi(e,t){var r;if("function"!=typeof t){if("function"!=typeof e)throw new Ie(A);var n=e;e=t,t=n}return function(){return--e>0&&(r=t.apply(this,arguments)),e<=1&&(t=o),r}}var Ri=$i(function(e,t,r){var n=c;if(r.length){var i=Qe(r,Ri.placeholder);n|=d}return pn(e,n,t,r,i)}),Ni=$i(function(e,t){for(var r=-1,n=(t=t.length?cr(t):So(e)).length;++r<n;){var i=t[r];e[i]=pn(e[i],c,e)}return e}),Li=$i(function(e,t,r){var n=c|f;if(r.length){var i=Qe(r,Li.placeholder);n|=d}return pn(t,n,e,r,i)}),Ki=Wr(h),ji=Wr(p);function Mi(e,t,r){var n,i,s,a,u,c,f,l=0,h=!1,p=!0;if("function"!=typeof e)throw new Ie(A);if(t=t<0?0:+t||0,!0===r){var d=!0;p=!1}else to(r)&&(d=!!r.leading,h="maxWait"in r&&vt(+r.maxWait||0,t),p="trailing"in r?!!r.trailing:p);function y(t,r){r&&it(r),i=c=f=o,t&&(l=Pi(),s=e.apply(u,n),c||i||(n=u=o))}function g(){var e=t-(Pi()-a);e<=0||e>t?y(f,i):c=ct(g,e)}function m(){y(p,c)}function b(){if(n=arguments,a=Pi(),u=this,f=p&&(c||!d),!1===h)var r=d&&!c;else{i||d||(l=a);var y=h-(a-l),b=y<=0||y>h;b?(i&&(i=it(i)),l=a,s=e.apply(u,n)):i||(i=ct(m,y))}return b&&c?c=it(c):c||t===h||(c=ct(g,t)),r&&(b=!0,s=e.apply(u,n)),!b||c||i||(n=u=o),s}return b.cancel=function(){c&&it(c),i&&it(i),l=0,i=c=f=o},b}var Di=$i(function(e,t){return rr(e,1,t)}),Ui=$i(function(e,t,r){return rr(e,t,r)}),Fi=Qr(),qi=Qr(!0);function Hi(e,t){if("function"!=typeof e||t&&"function"!=typeof t)throw new Ie(A);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 Hi.Cache,r}var zi=$i(function(e,t){if(t=cr(t),"function"!=typeof e||!qt(t,Fe))throw new Ie(A);var r=t.length;return $i(function(n){for(var i=_t(n.length,r);i--;)n[i]=t[i](n[i]);return e.apply(this,n)})});var Vi=sn(d),Gi=sn(y),Wi=$i(function(e,t){return pn(e,m,o,o,o,cr(t))});function $i(e,t){if("function"!=typeof e)throw new Ie(A);return t=vt(t===o?e.length-1:+t||0,0),function(){for(var n=arguments,i=-1,o=vt(n.length-t,0),s=r(o);++i<o;)s[i]=n[t+i];switch(t){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=r(t+1);for(i=-1;++i<t;)a[i]=n[i];return a[t]=s,e.apply(this,a)}}function Yi(e,t){return e>t}function Ji(e){return Xe(e)&&En(e)&&Oe.call(e,"callee")&&!at.call(e,"callee")}var Xi=gt||function(e){return Xe(e)&&Bn(e.length)&&Ne.call(e)==T};function Zi(e,t,r,n){var i=(r="function"==typeof r?Kr(r,n,3):o)?r(e,t):o;return i===o?mr(e,t,r):!!i}function Qi(e){return Xe(e)&&"string"==typeof e.message&&Ne.call(e)==P}function eo(e){return to(e)&&Ne.call(e)==O}function to(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function ro(e){return null!=e&&(eo(e)?Ke.test(Pe.call(e)):Xe(e)&&ge.test(e))}function no(e){return"number"==typeof e||Xe(e)&&Ne.call(e)==N}function io(e){var t,r;return!(!Xe(e)||Ne.call(e)!=L||Ji(e)||!(Oe.call(e,"constructor")||"function"!=typeof(t=e.constructor)||t instanceof t))&&(hr(e,function(e,t){r=t}),r===o||Oe.call(e,r))}function oo(e){return to(e)&&Ne.call(e)==K}function so(e){return"string"==typeof e||Xe(e)&&Ne.call(e)==M}function ao(e){return Xe(e)&&Bn(e.length)&&!!Ee[Ne.call(e)]}function uo(e,t){return e<t}function co(e){var t=e?_n(e):0;return Bn(t)?t?Ut(e):[]:Co(e)}function fo(e){return Zt(e,Eo(e))}var lo=Fr(function e(t,r,n,i,s){if(!to(t))return t;var a=En(r)&&(Xi(r)||ao(r)),u=a?o:ko(r);return Ft(u||r,function(c,f){if(u&&(c=r[f=c]),Xe(c))i||(i=[]),s||(s=[]),function(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,En(c)&&(Xi(c)||ao(c))?l=Xi(f)?f:En(f)?Ut(f):[]:io(c)||Ji(c)?l=Ji(f)?fo(f):io(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)}(t,r,f,e,n,i,s);else{var l=t[f],h=n?n(l,c,f,t,r):o,p=h===o;p&&(h=c),h===o&&(!a||f in t)||!p&&(h==h?h===l:l!=l)||(t[f]=h)}}),t}),ho=Fr(function(e,t,r){return r?Yt(e,t,r):Jt(e,t)});var po=$r(ho,function(e,t){return e===o?t:e}),yo=$r(lo,function e(t,r){return t===o?r:lo(t,r,e)}),go=Zr(pr),mo=Zr(dr),bo=tn(fr),vo=tn(lr),_o=rn(pr),wo=rn(dr);function So(e){return yr(e,Eo(e))}var ko=bt?function(e){var t=null==e?o:e.constructor;return"function"==typeof t&&t.prototype===e||"function"!=typeof e&&En(e)?jn(e):to(e)?bt(e):[]}:jn;function Eo(e){if(null==e)return[];to(e)||(e=j(e));var t=e.length;t=t&&Bn(t)&&(Xi(e)||Ji(e))&&t||0;for(var n=e.constructor,i=-1,o="function"==typeof n&&n.prototype===e,s=r(t),a=t>0;++i<t;)s[i]=i+"";for(var u in e)a&&An(u,t)||"constructor"==u&&(o||!Oe.call(e,u))||s.push(u);return s}var Ao=nn(!0),xo=nn(),Io=$i(function(e,t){if(null==e)return{};if("function"!=typeof t[0])return t=zt(cr(t),xe),On(e,nr(Eo(e),t));var r=Kr(t[0],t[1],3);return Rn(e,function(e,t,n){return!r(e,t,n)})});function To(e){e=Dn(e);for(var t=-1,n=ko(e),i=n.length,o=r(i);++t<i;){var s=n[t];o[t]=[s,e[s]]}return o}var Bo=$i(function(e,t){return null==e?{}:"function"==typeof t[0]?Rn(e,Kr(t[0],t[1],3)):On(e,cr(t))});function Co(e){return Pr(e,ko(e))}var Po=Vr(function(e,t,r){return t=t.toLowerCase(),e+(r?t.charAt(0).toUpperCase()+t.slice(1):t)});function Oo(e){return(e=qe(e))&&e.replace(be,Ge).replace(le,"")}var Ro=Vr(function(e,t,r){return e+(r?"-":"")+t.toLowerCase()});var No=on(),Lo=on(!0);function Ko(e,t){var r="";if(e=qe(e),(t=+t)<1||!e||!mt(t))return r;do{t%2&&(r+=e),t=yt(t/2),e+=e}while(t);return r}var jo=Vr(function(e,t,r){return e+(r?"_":"")+t.toLowerCase()}),Mo=Vr(function(e,t,r){return e+(r?" ":"")+(t.charAt(0).toUpperCase()+t.slice(1))});function Do(e,t,r){var n=e;return(e=qe(e))?(r?xn(n,t,r):null==t)?e.slice(et(e),tt(e)+1):(t+="",e.slice(He(e,t),ze(e,t)+1)):e}function Uo(e,t,r){return r&&xn(e,t,r)&&(t=o),(e=qe(e)).match(t||we)||[]}var Fo=$i(function(e,t){try{return e.apply(o,t)}catch(e){return Qi(e)?e:new i(e)}});function qo(e,t,r){return r&&xn(e,t,r)&&(t=o),Xe(e)?zo(e):Qt(e,t)}function Ho(e){return e}function zo(e){return _r(er(e,!0))}var Vo=$i(function(e,t){return function(r){return kn(r,e,t)}}),Go=$i(function(e,t){return function(r){return kn(e,r,t)}});function Wo(e,t,r){if(null==r){var n=to(t),i=n?ko(t):o,s=i&&i.length?yr(t,i):o;(s?s.length:n)||(s=!1,r=t,t=e,e=this)}s||(s=yr(t,ko(t)));var a=!0,u=-1,c=eo(e),f=s.length;!1===r?a=!1:to(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__);return(n.__actions__=Ut(this.__actions__)).push({func:t,args:arguments,thisArg:e}),n.__chain__=r,n}return t.apply(e,Vt([this.value()],arguments))}}(h))}return e}function $o(){}function Yo(e){return In(e)?Sr(e):function(e){var t=e+"";return e=Un(e),function(r){return gr(r,e,t)}}(e)}var Jo,Xo=ln("ceil"),Zo=ln("floor"),Qo=Yr(Yi,Et),es=Yr(uo,At),ts=ln("round");return Ot.prototype=Rt.prototype,Nt.prototype=tr(Rt.prototype),Nt.prototype.constructor=Nt,Lt.prototype=tr(Rt.prototype),Lt.prototype.constructor=Lt,Kt.prototype.delete=function(e){return this.has(e)&&delete this.__data__[e]},Kt.prototype.get=function(e){return"__proto__"==e?o:this.__data__[e]},Kt.prototype.has=function(e){return"__proto__"!=e&&Oe.call(this.__data__,e)},Kt.prototype.set=function(e,t){return"__proto__"!=e&&(this.__data__[e]=t),this},jt.prototype.push=function(e){var t=this.data;"string"==typeof e||to(e)?t.set.add(e):t.hash[e]=!0},Hi.Cache=Kt,Ot.after=function(e,t){if("function"!=typeof t){if("function"!=typeof e)throw new Ie(A);var r=e;e=t,t=r}return e=mt(e=+e)?e:0,function(){if(--e<1)return t.apply(this,arguments)}},Ot.ary=function(e,t,r){return r&&xn(e,t,r)&&(t=o),t=e&&null==t?e.length:vt(+t||0,0),pn(e,g,o,o,o,o,t)},Ot.assign=ho,Ot.at=hi,Ot.before=Oi,Ot.bind=Ri,Ot.bindAll=Ni,Ot.bindKey=Li,Ot.callback=qo,Ot.chain=ci,Ot.chunk=function(e,t,n){t=(n?xn(e,t,n):null==t)?1:vt(yt(t)||1,1);for(var i=0,o=e?e.length:0,s=-1,a=r(pt(o/t));i<o;)a[++s]=xr(e,i,i+=t);return a},Ot.compact=function(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},Ot.constant=function(e){return function(){return e}},Ot.countBy=pi,Ot.create=function(e,t,r){var n=tr(e);return r&&xn(e,t,r)&&(t=o),t?Jt(n,t):n},Ot.curry=Ki,Ot.curryRight=ji,Ot.debounce=Mi,Ot.defaults=po,Ot.defaultsDeep=yo,Ot.defer=Di,Ot.delay=Ui,Ot.difference=qn,Ot.drop=Hn,Ot.dropRight=zn,Ot.dropRightWhile=function(e,t,r){return e&&e.length?Or(e,gn(t,r,3),!0,!0):[]},Ot.dropWhile=function(e,t,r){return e&&e.length?Or(e,gn(t,r,3),!0):[]},Ot.fill=function(e,t,r,n){var i=e?e.length:0;return i?(r&&"number"!=typeof r&&xn(e,t,r)&&(r=0,n=i),function(e,t,r,n){var i=e.length;for((r=null==r?0:+r||0)<0&&(r=-r>i?0:i+r),(n=n===o||n>i?i:+n||0)<0&&(n+=i),i=r>n?0:n>>>0,r>>>=0;r<i;)e[r++]=t;return e}(e,t,r,n)):[]},Ot.filter=yi,Ot.flatten=function(e,t,r){var n=e?e.length:0;return r&&xn(e,t,r)&&(t=!1),n?cr(e,t):[]},Ot.flattenDeep=function(e){return e&&e.length?cr(e,!0):[]},Ot.flow=Fi,Ot.flowRight=qi,Ot.forEach=bi,Ot.forEachRight=vi,Ot.forIn=bo,Ot.forInRight=vo,Ot.forOwn=_o,Ot.forOwnRight=wo,Ot.functions=So,Ot.groupBy=_i,Ot.indexBy=Si,Ot.initial=function(e){return zn(e,1)},Ot.intersection=Yn,Ot.invert=function(e,t,r){r&&xn(e,t,r)&&(t=o);for(var n=-1,i=ko(e),s=i.length,a={};++n<s;){var u=i[n],c=e[u];t?Oe.call(a,c)?a[c].push(u):a[c]=[u]:a[c]=u}return a},Ot.invoke=ki,Ot.keys=ko,Ot.keysIn=Eo,Ot.map=Ei,Ot.mapKeys=Ao,Ot.mapValues=xo,Ot.matches=zo,Ot.matchesProperty=function(e,t){return wr(e,er(t,!0))},Ot.memoize=Hi,Ot.merge=lo,Ot.method=Vo,Ot.methodOf=Go,Ot.mixin=Wo,Ot.modArgs=zi,Ot.negate=function(e){if("function"!=typeof e)throw new Ie(A);return function(){return!e.apply(this,arguments)}},Ot.omit=Io,Ot.once=function(e){return Oi(2,e)},Ot.pairs=To,Ot.partial=Vi,Ot.partialRight=Gi,Ot.partition=Ai,Ot.pick=Bo,Ot.pluck=function(e,t){return Ei(e,Yo(t))},Ot.property=Yo,Ot.propertyOf=function(e){return function(t){return gr(e,Un(t),t+"")}},Ot.pull=function(){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;)ft.call(t,o,1);return t},Ot.pullAt=Xn,Ot.range=function(e,t,n){n&&xn(e,t,n)&&(t=n=o),e=+e||0,n=null==n?1:+n||0,null==t?(t=e,e=0):t=+t||0;for(var i=-1,s=vt(pt((t-e)/(n||1)),0),a=r(s);++i<s;)a[i]=e,e+=n;return a},Ot.rearg=Wi,Ot.reject=function(e,t,r){var n=Xi(e)?Ht:ar;return t=gn(t,r,3),n(e,function(e,r,n){return!t(e,r,n)})},Ot.remove=function(e,t,r){var n=[];if(!e||!e.length)return n;var i=-1,o=[],s=e.length;for(t=gn(t,r,3);++i<s;){var a=e[i];t(a,i,e)&&(n.push(a),o.push(i))}return kr(e,o),n},Ot.rest=Zn,Ot.restParam=$i,Ot.set=function(e,t,r){if(null==e)return e;for(var n=t+"",i=-1,o=(t=null!=e[n]||In(t,e)?[n]:Un(t)).length,s=o-1,a=e;null!=a&&++i<o;){var u=t[i];to(a)&&(i==s?a[u]=r:null==a[u]&&(a[u]=An(t[i+1])?[]:{})),a=a[u]}return e},Ot.shuffle=function(e){return Ti(e,At)},Ot.slice=function(e,t,r){var n=e?e.length:0;return n?(r&&"number"!=typeof r&&xn(e,t,r)&&(t=0,r=n),xr(e,t,r)):[]},Ot.sortBy=function(e,t,r){if(null==e)return[];r&&xn(e,t,r)&&(t=o);var n=-1;return t=gn(t,r,3),Tr(vr(e,function(e,r,i){return{criteria:t(e,r,i),index:++n,value:e}}),Ve)},Ot.sortByAll=Ci,Ot.sortByOrder=function(e,t,r,n){return null==e?[]:(n&&xn(t,r,n)&&(r=o),Xi(t)||(t=null==t?[]:[t]),Xi(r)||(r=null==r?[]:[r]),Br(e,t,r))},Ot.spread=function(e){if("function"!=typeof e)throw new Ie(A);return function(t){return e.apply(this,t)}},Ot.take=function(e,t,r){return e&&e.length?((r?xn(e,t,r):null==t)&&(t=1),xr(e,0,t<0?0:t)):[]},Ot.takeRight=function(e,t,r){var n=e?e.length:0;return n?((r?xn(e,t,r):null==t)&&(t=1),xr(e,(t=n-(+t||0))<0?0:t)):[]},Ot.takeRightWhile=function(e,t,r){return e&&e.length?Or(e,gn(t,r,3),!1,!0):[]},Ot.takeWhile=function(e,t,r){return e&&e.length?Or(e,gn(t,r,3)):[]},Ot.tap=function(e,t,r){return t.call(r,e),e},Ot.throttle=function(e,t,r){var n=!0,i=!0;if("function"!=typeof e)throw new Ie(A);return!1===r?n=!1:to(r)&&(n="leading"in r?!!r.leading:n,i="trailing"in r?!!r.trailing:i),Mi(e,t,{leading:n,maxWait:+t,trailing:i})},Ot.thru=fi,Ot.times=function(e,t,n){if((e=yt(e))<1||!mt(e))return[];var i=-1,o=r(_t(e,xt));for(t=Kr(t,n,1);++i<e;)i<xt?o[i]=t(i):t(i);return o},Ot.toArray=co,Ot.toPlainObject=fo,Ot.transform=function(e,t,r,n){var i=Xi(e)||ao(e);if(t=gn(t,n,4),null==r)if(i||to(e)){var s=e.constructor;r=i?Xi(e)?new s:[]:tr(eo(s)?s.prototype:o)}else r={};return(i?Ft:pr)(e,function(e,n,i){return t(r,e,n,i)}),r},Ot.union=ti,Ot.uniq=ri,Ot.unzip=ni,Ot.unzipWith=ii,Ot.values=Co,Ot.valuesIn=function(e){return Pr(e,Eo(e))},Ot.where=function(e,t){return yi(e,_r(t))},Ot.without=oi,Ot.wrap=function(e,t){return pn(t=null==t?Ho:t,d,o,[e],[])},Ot.xor=function(){for(var e=-1,t=arguments.length;++e<t;){var r=arguments[e];if(En(r))var n=n?Vt(nr(n,r),nr(r,n)):r}return n?Cr(n):[]},Ot.zip=si,Ot.zipObject=ai,Ot.zipWith=ui,Ot.backflow=qi,Ot.collect=Ei,Ot.compose=qi,Ot.each=bi,Ot.eachRight=vi,Ot.extend=ho,Ot.iteratee=qo,Ot.methods=So,Ot.object=ai,Ot.select=yi,Ot.tail=Zn,Ot.unique=ri,Wo(Ot,Ot),Ot.add=function(e,t){return(+e||0)+(+t||0)},Ot.attempt=Fo,Ot.camelCase=Po,Ot.capitalize=function(e){return(e=qe(e))&&e.charAt(0).toUpperCase()+e.slice(1)},Ot.ceil=Xo,Ot.clone=function(e,t,r,n){return t&&"boolean"!=typeof t&&xn(e,t,r)?t=!1:"function"==typeof t&&(n=r,r=t,t=!1),"function"==typeof r?er(e,t,Kr(r,n,1)):er(e,t)},Ot.cloneDeep=function(e,t,r){return"function"==typeof t?er(e,!0,Kr(t,r,1)):er(e,!0)},Ot.deburr=Oo,Ot.endsWith=function(e,t,r){t+="";var n=(e=qe(e)).length;return r=r===o?n:_t(r<0?0:+r||0,n),(r-=t.length)>=0&&e.indexOf(t,r)==r},Ot.escape=function(e){return(e=qe(e))&&re.test(e)?e.replace(ee,We):e},Ot.escapeRegExp=function(e){return(e=qe(e))&&fe.test(e)?e.replace(ce,$e):e||"(?:)"},Ot.every=di,Ot.find=gi,Ot.findIndex=Vn,Ot.findKey=go,Ot.findLast=mi,Ot.findLastIndex=Gn,Ot.findLastKey=mo,Ot.findWhere=function(e,t){return gi(e,_r(t))},Ot.first=Wn,Ot.floor=Zo,Ot.get=function(e,t,r){var n=null==e?o:gr(e,Un(t),t+"");return n===o?r:n},Ot.gt=Yi,Ot.gte=function(e,t){return e>=t},Ot.has=function(e,t){if(null==e)return!1;var r=Oe.call(e,t);if(!r&&!In(t)){if(null==(e=1==(t=Un(t)).length?e:gr(e,xr(t,0,-1))))return!1;t=Jn(t),r=Oe.call(e,t)}return r||Bn(e.length)&&An(t,e.length)&&(Xi(e)||Ji(e))},Ot.identity=Ho,Ot.includes=wi,Ot.indexOf=$n,Ot.inRange=function(e,t,r){return t=+t||0,r===o?(r=t,t=0):r=+r||0,e>=_t(t,r)&&e<vt(t,r)},Ot.isArguments=Ji,Ot.isArray=Xi,Ot.isBoolean=function(e){return!0===e||!1===e||Xe(e)&&Ne.call(e)==B},Ot.isDate=function(e){return Xe(e)&&Ne.call(e)==C},Ot.isElement=function(e){return!!e&&1===e.nodeType&&Xe(e)&&!io(e)},Ot.isEmpty=function(e){return null==e||(En(e)&&(Xi(e)||so(e)||Ji(e)||Xe(e)&&eo(e.splice))?!e.length:!ko(e).length)},Ot.isEqual=Zi,Ot.isError=Qi,Ot.isFinite=function(e){return"number"==typeof e&&mt(e)},Ot.isFunction=eo,Ot.isMatch=function(e,t,r,n){return r="function"==typeof r?Kr(r,n,3):o,br(e,wn(t),r)},Ot.isNaN=function(e){return no(e)&&e!=+e},Ot.isNative=ro,Ot.isNull=function(e){return null===e},Ot.isNumber=no,Ot.isObject=to,Ot.isPlainObject=io,Ot.isRegExp=oo,Ot.isString=so,Ot.isTypedArray=ao,Ot.isUndefined=function(e){return e===o},Ot.kebabCase=Ro,Ot.last=Jn,Ot.lastIndexOf=function(e,t,r){var n=e?e.length:0;if(!n)return-1;var i=n;if("number"==typeof r)i=(r<0?vt(n+r,0):_t(r||0,n-1))+1;else if(r){var o=e[i=Nr(e,t,!0)-1];return(t==t?t===o:o!=o)?i:-1}if(t!=t)return Je(e,i,!0);for(;i--;)if(e[i]===t)return i;return-1},Ot.lt=uo,Ot.lte=function(e,t){return e<=t},Ot.max=Qo,Ot.min=es,Ot.noConflict=function(){return je._=Le,this},Ot.noop=$o,Ot.now=Pi,Ot.pad=function(e,t,r){t=+t;var n=(e=qe(e)).length;if(n>=t||!mt(t))return e;var i=(t-n)/2,o=yt(i);return(r=cn("",pt(i),r)).slice(0,o)+e+r},Ot.padLeft=No,Ot.padRight=Lo,Ot.parseInt=function(e,t,r){return(r?xn(e,t,r):null==t)?t=0:t&&(t=+t),e=Do(e),St(e,t||(ye.test(e)?16:10))},Ot.random=function(e,t,r){r&&xn(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=kt();return _t(e+s*(t-e+ot("1e-"+((s+"").length-1))),t)}return Er(e,t)},Ot.reduce=xi,Ot.reduceRight=Ii,Ot.repeat=Ko,Ot.result=function(e,t,r){var n=null==e?o:e[t];return n===o&&(null==e||In(t,e)||(n=null==(e=1==(t=Un(t)).length?e:gr(e,xr(t,0,-1)))?o:e[Jn(t)]),n=n===o?r:n),eo(n)?n.call(e):n},Ot.round=ts,Ot.runInContext=e,Ot.size=function(e){var t=e?_n(e):0;return Bn(t)?t:ko(e).length},Ot.snakeCase=jo,Ot.some=Bi,Ot.sortedIndex=Qn,Ot.sortedLastIndex=ei,Ot.startCase=Mo,Ot.startsWith=function(e,t,r){return e=qe(e),r=null==r?0:_t(r<0?0:+r||0,e.length),e.lastIndexOf(t,r)==r},Ot.sum=function(e,t,r){return r&&xn(e,t,r)&&(t=o),1==(t=gn(t,r,3)).length?function(e,t){for(var r=e.length,n=0;r--;)n+=+t(e[r])||0;return n}(Xi(e)?e:Mn(e),t):function(e,t){var r=0;return ir(e,function(e,n,i){r+=+t(e,n,i)||0}),r}(e,t)},Ot.template=function(e,t,r){var n=Ot.templateSettings;r&&xn(e,t,r)&&(t=r=o),e=qe(e);var i,a,u=Yt(Jt({},(t=Yt(Jt({},r||t),n,$t)).imports),n.imports,$t),c=ko(u),f=Pr(u,c),l=0,h=t.interpolate||ve,p="__p += '",d=D((t.escape||ve).source+"|"+h.source+"|"+(h===oe?pe:ve).source+"|"+(t.evaluate||ve).source+"|$","g"),y="//# sourceURL="+("sourceURL"in t?t.sourceURL:"lodash.templateSources["+ ++ke+"]")+"\n";e.replace(d,function(t,r,n,o,s,u){return n||(n=o),p+=e.slice(l,u).replace(_e,Ye),r&&(i=!0,p+="' +\n__e("+r+") +\n'"),s&&(a=!0,p+="';\n"+s+";\n__p += '"),n&&(p+="' +\n((__t = ("+n+")) == null ? '' : __t) +\n'"),l=u+t.length,t}),p+="';\n";var g=t.variable;g||(p="with (obj) {\n"+p+"\n}\n"),p=(a?p.replace(J,""):p).replace(X,"$1").replace(Z,"$1;"),p="function("+(g||"obj")+") {\n"+(g?"":"obj || (obj = {});\n")+"var __t, __p = ''"+(i?", __e = _.escape":"")+(a?", __j = Array.prototype.join;\nfunction print() { __p += __j.call(arguments, '') }\n":";\n")+p+"return __p\n}";var m=Fo(function(){return s(c,y+"return "+p).apply(o,f)});if(m.source=p,Qi(m))throw m;return m},Ot.trim=Do,Ot.trimLeft=function(e,t,r){var n=e;return(e=qe(e))?(r?xn(n,t,r):null==t)?e.slice(et(e)):e.slice(He(e,t+"")):e},Ot.trimRight=function(e,t,r){var n=e;return(e=qe(e))?(r?xn(n,t,r):null==t)?e.slice(0,tt(e)+1):e.slice(0,ze(e,t+"")+1):e},Ot.trunc=function(e,t,r){r&&xn(e,t,r)&&(t=o);var n=b,i=v;if(null!=t)if(to(t)){var s="separator"in t?t.separator:s;n="length"in t?+t.length||0:n,i="omission"in t?qe(t.omission):i}else n=+t||0;if(n>=(e=qe(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(oo(s)){if(e.slice(a).search(s)){var c,f,l=e.slice(0,a);for(s.global||(s=D(s.source,(de.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},Ot.unescape=function(e){return(e=qe(e))&&te.test(e)?e.replace(Q,rt):e},Ot.uniqueId=function(e){var t=++Re;return qe(e)+t},Ot.words=Uo,Ot.all=di,Ot.any=Bi,Ot.contains=wi,Ot.eq=Zi,Ot.detect=gi,Ot.foldl=xi,Ot.foldr=Ii,Ot.head=Wn,Ot.include=wi,Ot.inject=xi,Wo(Ot,(Jo={},pr(Ot,function(e,t){Ot.prototype[t]||(Jo[t]=e)}),Jo),!1),Ot.sample=Ti,Ot.prototype.sample=function(e){return this.__chain__||null!=e?this.thru(function(t){return Ti(t,e)}):Ti(this.value())},Ot.VERSION=u,Ft(["bind","bindKey","curry","curryRight","partial","partialRight"],function(e){Ot[e].placeholder=Ot}),Ft(["drop","take"],function(e,t){Lt.prototype[e]=function(r){var n=this.__filtered__;if(n&&!t)return new Lt(this);r=null==r?1:vt(yt(r)||0,0);var i=this.clone();return n?i.__takeCount__=_t(i.__takeCount__,r):i.__views__.push({size:r,type:e+(i.__dir__<0?"Right":"")}),i},Lt.prototype[e+"Right"]=function(t){return this.reverse()[e](t).reverse()}}),Ft(["filter","map","takeWhile"],function(e,t){var r=t+1,n=r!=E;Lt.prototype[e]=function(e,t){var i=this.clone();return i.__iteratees__.push({iteratee:gn(e,t,1),type:r}),i.__filtered__=i.__filtered__||n,i}}),Ft(["first","last"],function(e,t){var r="take"+(t?"Right":"");Lt.prototype[e]=function(){return this[r](1).value()[0]}}),Ft(["initial","rest"],function(e,t){var r="drop"+(t?"":"Right");Lt.prototype[e]=function(){return this.__filtered__?new Lt(this):this[r](1)}}),Ft(["pluck","where"],function(e,t){var r=t?"filter":"map",n=t?_r:Yo;Lt.prototype[e]=function(e){return this[r](n(e))}}),Lt.prototype.compact=function(){return this.filter(Ho)},Lt.prototype.reject=function(e,t){return e=gn(e,t,1),this.filter(function(t){return!e(t)})},Lt.prototype.slice=function(e,t){e=null==e?0:+e||0;var r=this;return r.__filtered__&&(e>0||t<0)?new Lt(r):(e<0?r=r.takeRight(-e):e&&(r=r.drop(e)),t!==o&&(r=(t=+t||0)<0?r.dropRight(-t):r.take(t-e)),r)},Lt.prototype.takeRightWhile=function(e,t){return this.reverse().takeWhile(e,t).reverse()},Lt.prototype.toArray=function(){return this.take(At)},pr(Lt.prototype,function(e,t){var r=/^(?:filter|map|reject)|While$/.test(t),n=/^(?:first|last)$/.test(t),i=Ot[n?"take"+("last"==t?"Right":""):t];i&&(Ot.prototype[t]=function(){var t=n?[1]:arguments,s=this.__chain__,a=this.__wrapped__,u=!!this.__actions__.length,c=a instanceof Lt,f=t[0],l=c||Xi(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,Vt([e],t))},p={func:fi,args:[h],thisArg:o},d=c&&!u;if(n&&!s)return d?((a=a.clone()).__actions__.push(p),e.call(a)):i.call(o,this.value())[0];if(!n&&l){a=d?a:new Lt(this);var y=e.apply(a,t);return y.__actions__.push(p),new Nt(y,s)}return this.thru(h)})}),Ft(["join","pop","push","replace","shift","sort","splice","split","unshift"],function(e){var t=(/^(?:replace|split)$/.test(e)?Ce:Te)[e],r=/^(?:push|sort|unshift)$/.test(e)?"tap":"thru",n=/^(?:join|pop|replace|shift)$/.test(e);Ot.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(Lt.prototype,function(e,t){var r=Ot[t];if(r){var n=r.name;(Pt[n]||(Pt[n]=[])).push({name:t,func:r})}}),Pt[un(o,f).name]=[{name:"wrapper",func:o}],Lt.prototype.clone=function(){var e=new Lt(this.__wrapped__);return e.__actions__=Ut(this.__actions__),e.__dir__=this.__dir__,e.__filtered__=this.__filtered__,e.__iteratees__=Ut(this.__iteratees__),e.__takeCount__=this.__takeCount__,e.__views__=Ut(this.__views__),e},Lt.prototype.reverse=function(){if(this.__filtered__){var e=new Lt(this);e.__dir__=-1,e.__filtered__=!0}else(e=this.clone()).__dir__*=-1;return e},Lt.prototype.value=function(){var e=this.__wrapped__.value(),t=this.__dir__,r=Xi(e),n=t<0,i=r?e.length:0,o=function(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=_t(t,e+s);break;case"takeRight":e=vt(e,t-s)}}return{start:e,end:t}}(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=_t(u,this.__takeCount__);if(!r||i<S||i==u&&p==u)return Rr(n&&r?e.reverse():e,this.__actions__);var d=[];e:for(;u--&&h<p;){for(var y=-1,g=e[c+=t];++y<l;){var m=f[y],b=m.iteratee,v=m.type,_=b(g);if(v==E)g=_;else if(!_){if(v==k)continue e;break e}}d[h++]=g}return d},Ot.prototype.chain=function(){return ci(this)},Ot.prototype.commit=function(){return new Nt(this.value(),this.__chain__)},Ot.prototype.concat=li,Ot.prototype.plant=function(e){for(var t,r=this;r instanceof Rt;){var n=Fn(r);t?i.__wrapped__=n:t=n;var i=n;r=r.__wrapped__}return i.__wrapped__=e,t},Ot.prototype.reverse=function(){var e=this.__wrapped__,t=function(e){return r&&r.__dir__<0?e:e.reverse()};if(e instanceof Lt){var r=e;return this.__actions__.length&&(r=new Lt(this)),(r=r.reverse()).__actions__.push({func:fi,args:[t],thisArg:o}),new Nt(r,this.__chain__)}return this.thru(t)},Ot.prototype.toString=function(){return this.value()+""},Ot.prototype.run=Ot.prototype.toJSON=Ot.prototype.valueOf=Ot.prototype.value=function(){return Rr(this.__wrapped__,this.__actions__)},Ot.prototype.collect=Ot.prototype.map,Ot.prototype.head=Ot.prototype.first,Ot.prototype.select=Ot.prototype.filter,Ot.prototype.tail=Ot.prototype.rest,Ot}();je._=nt,(i=function(){return nt}.call(t,r,t,e))===o||(e.exports=i)}).call(this)}).call(this,r(27)(e),r(6))},function(e,t,r){(function(t,n){var i=r(13),o=r(916),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)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=[];s.setImmediate=function(t){r.push(t),1===r.length&&window.postMessage(e,"*")},window.addEventListener("message",function(t){if(t.source===window&&t.data===e){t.stopPropagation();var n=r.slice();r.length=0,n.forEach(function(e){e()})}},!0)}if("undefined"!=typeof MutationObserver){var n=Date.now(),i=!0,o=document.createElement("div");r=[];new MutationObserver(function(){var e=r.slice();r.length=0,e.forEach(function(e){e()})}).observe(o,{attributes:!0});var a=s.setImmediate;s.setImmediate=function(e){Date.now()-n>15?(n=Date.now(),a(e)):(r.push(e),1===r.length&&o.setAttribute("a",i=!i))}}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;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)>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=function(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.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=(n=new Uint8Array(e.buffer,e.byteOffset,e.byteLength)).byteLength-n.byteOffset;return this.accommodate(r),new Uint8Array(this.data.buffer,this.write).set(n),this.write+=r,this}if(s.isArrayBuffer(e)){var n=new Uint8Array(e);return this.accommodate(n.byteLength),new Uint8Array(this.data.buffer).set(n,this.write),this.write+=n.byteLength,this}if(e instanceof s.DataBuffer||"object"==typeof e&&"number"==typeof e.read&&"number"==typeof e.write&&s.isArrayBufferView(e.data)){n=new Uint8Array(e.data.byteLength,e.read,e.length());return this.accommodate(n.byteLength),new Uint8Array(e.data.byteLength,this.write).set(n),this.write+=n.byteLength,this}if(e instanceof s.ByteStringBuffer&&(e=e.data,t="binary"),t=t||"binary","string"==typeof e){var i;if("hex"===t)return this.accommodate(Math.ceil(e.length/2)),i=new Uint8Array(this.data.buffer,this.write),this.write+=s.binary.hex.decode(e,i,this.write),this;if("base64"===t)return this.accommodate(3*Math.ceil(e.length/4)),i=new Uint8Array(this.data.buffer,this.write),this.write+=s.binary.base64.decode(e,i,this.write),this;if("utf8"===t&&(e=s.encodeUtf8(e),t="binary"),"binary"===t||"raw"===t)return this.accommodate(e.length),i=new Uint8Array(this.data.buffer,this.write),this.write+=s.binary.raw.decode(i),this;if("utf16"===t)return this.accommodate(2*e.length),i=new Uint16Array(this.data.buffer,this.write),this.write+=s.text.utf16.encode(i),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("binary"===(e=e||"utf8")||"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)>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},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 c="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",f=[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],l="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";s.encode64=function(e,t){for(var r,n,i,o="",s="",a=0;a<e.length;)r=e.charCodeAt(a++),n=e.charCodeAt(a++),i=e.charCodeAt(a++),o+=c.charAt(r>>2),o+=c.charAt((3&r)<<4|n>>4),isNaN(n)?o+="==":(o+=c.charAt((15&n)<<2|i>>6),o+=isNaN(i)?"=":c.charAt(63&i)),t&&o.length>t&&(s+=o.substr(0,t)+"\r\n",o=o.substr(t));return s+o},s.decode64=function(e){e=e.replace(/[^A-Za-z0-9\+\/\=]/g,"");for(var t,r,n,i,o="",s=0;s<e.length;)t=f[e.charCodeAt(s++)-43],r=f[e.charCodeAt(s++)-43],n=f[e.charCodeAt(s++)-43],i=f[e.charCodeAt(s++)-43],o+=String.fromCharCode(t<<2|r>>4),64!==n&&(o+=String.fromCharCode((15&r)<<4|n>>2),64!==i&&(o+=String.fromCharCode((3&n)<<6|i)));return o},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));for(var i=r=r||0,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)));var i=0,o=r=r||0;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;)r=e[a++],n=e[a++],i=e[a++],o+=c.charAt(r>>2),o+=c.charAt((3&r)<<4|n>>4),isNaN(n)?o+="==":(o+=c.charAt((15&n)<<2|i>>6),o+=isNaN(i)?"=":c.charAt(63&i)),t&&o.length>t&&(s+=o.substr(0,t)+"\r\n",o=o.substr(t));return s+o},s.binary.base64.decode=function(e,t,r){var n,i,o,s,a=t;a||(a=new Uint8Array(3*Math.ceil(e.length/4))),e=e.replace(/[^A-Za-z0-9\+\/\=]/g,"");for(var u=0,c=r=r||0;u<e.length;)n=f[e.charCodeAt(u++)-43],i=f[e.charCodeAt(u++)-43],o=f[e.charCodeAt(u++)-43],s=f[e.charCodeAt(u++)-43],a[c++]=n<<2|i>>4,64!==o&&(a[c++]=(15&i)<<4|o>>2,64!==s&&(a[c++]=(3&o)<<6|s));return t?c-r:a.subarray(0,c)},s.binary.base58.encode=function(e,t){return s.binary.baseN.encode(e,l,t)},s.binary.base58.decode=function(e,t){return s.binary.baseN.decode(e,l,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));for(var i=r=r||0,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));for(var i=new Uint16Array(n.buffer),o=r=r||0,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;32&t.charCodeAt(1)&&(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 h=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}},p=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},d=function(e,t,r,n){var i=p(e,t);null===i&&(i={}),i[r]=n,h(e,t,i)},y=function(e,t,r){var n=p(e,t);return null!==n&&(n=r in n?n[r]:null),n},g=function(e,t,r){var n=p(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),h(e,t,n)}},m=function(e,t){h(e,t,null)},b=function(e,t,r){var n,i=null;void 0===r&&(r=["web","flash"]);var o=!1,s=null;for(var a in r){n=r[a];try{if("flash"===n||"both"===n){if(null===t[0])throw new Error("Flash local storage not available.");i=e.apply(this,t),o="flash"===n}"web"!==n&&"both"!==n||(t[0]=localStorage,i=e.apply(this,t),o=!0)}catch(e){s=e}if(o)break}if(!o)throw s;return i};s.setItem=function(e,t,r,n,i){b(d,arguments,i)},s.getItem=function(e,t,r,n){return b(y,arguments,n)},s.removeItem=function(e,t,r,n){b(g,arguments,n)},s.clearItems=function(e,t,r){b(m,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 v=null;s.getQueryVariables=function(e){var t,r=function(e){for(var t={},r=e.split("&"),n=0;n<r.length;n++){var i,o,s=r[n].indexOf("=");s>0?(i=r[n].substring(0,s),o=r[n].substring(s+1)):(i=r[n],o=null),i in t||(t[i]=[]),i in Object.prototype||null===o||t[i].push(unescape(o))}return t};return void 0===e?(null===v&&(v="undefined"!=typeof window&&window.location&&window.location.search?r(window.location.search.substring(1)):{}),t=v):t=r(e),t},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("/");return i.length>0&&""===i[0]&&i.shift(),{pathString:t,queryString:r,path:i,query:""===r?{}:s.getQueryVariables(r)}},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])&&void 0!==r&&(n=n[r]),n},getQueryLast:function(e,t){var n=r.getQuery(e);return n?n[n.length-1]:t}};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)&&(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,r,n=/%./g,i=0,o=[],s=0;t=n.exec(e);){(r=e.substring(s,n.lastIndex-2)).length>0&&o.push(r),s=n.lastIndex;var a=t[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>=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"},s.bytesFromIP=function(e){return-1!==e.indexOf(".")?s.bytesFromIPv4(e):-1!==e.indexOf(":")?s.bytesFromIPv6(e):null},s.bytesFromIPv4=function(e){if(4!==(e=e.split(".")).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){for(var t=0,r=2*(8-(e=e.split(":").filter(function(e){return 0===e.length&&++t,!0})).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 e(n,i,o){if(0===i){var a=Math.floor(n.reduce(function(e,t){return e+t},0)/n.length);return s.cores=Math.max(1,a),URL.revokeObjectURL(r),t(null,s.cores)}!function(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)}(o,function(t,r){n.push(function(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)}(o,r)),e(n,i-1,o)})}([],5,16)}}).call(this,r(7),r(0).Buffer)},function(e,t,r){e.exports={encode:r(646),decode:r(647),encodingLength:r(648)}},function(e,t,r){"use strict";var n=r(66),i=r(18);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){if(!r(24).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(332)).Stream=t,t.Readable=t,t.Writable=r(210),t.Duplex=r(85),t.Transform=r(337),t.PassThrough=r(641)},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;return"function"==typeof i&&i?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){"use strict";(function(t){var n=r(0),i=r(17),o=r(29),s=r(21);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){s.checkArgumentType(e,"Buffer","buffer"),s.checkArgumentType(t,"number","value");for(var r=e.length,n=0;n<r;n++)e[n]=t;return e},copy:function(e){var r=new t(e.length);return e.copy(r),r},isBuffer:function(e){return n.Buffer.isBuffer(e)||e instanceof Uint8Array},emptyBuffer:function(e){s.checkArgumentType(e,"number","bytes");for(var t=new n.Buffer(e),r=0;r<e;r++)t.write("\0",r);return t},concat:n.Buffer.concat,equals:a,equal:a,integerAsSingleByteBuffer:function(e){return s.checkArgumentType(e,"number","integer"),new n.Buffer([255&e])},integerAsBuffer:function(e){s.checkArgumentType(e,"number","integer");var r=[];return r.push(e>>24&255),r.push(e>>16&255),r.push(e>>8&255),r.push(255&e),new t(r)},integerFromBuffer:function(e){return s.checkArgumentType(e,"Buffer","buffer"),e[0]<<24|e[1]<<16|e[2]<<8|e[3]},integerFromSingleByteBuffer:function(e){return s.checkArgumentType(e,"Buffer","buffer"),e[0]},bufferToHex:function(e){return s.checkArgumentType(e,"Buffer","buffer"),e.toString("hex")},reverse:function(e){for(var t=new n.Buffer(e.length),r=0;r<e.length;r++)t[r]=e[e.length-r-1];return t},hexToBuffer:function(e){return i(o.isHexa(e)),new n.Buffer(e,"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(402),i=r(231),o=n.tfJSON,s=n.TfTypeError,a=n.TfPropertyTypeError,u=n.tfSubError,c=n.getValueTypeName,f={arrayOf:function(e){function t(t,r){return!!i.Array(t)&&!i.Nil(t)&&t.every(function(t,n){try{return h(e,t,r)}catch(t){throw u(t,n)}})}return e=l(e),t.toJSON=function(){return"["+o(e)+"]"},t},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){function r(r,n){if(!i.Object(r))return!1;if(i.Nil(r))return!1;for(var o in r){try{t&&h(t,o,n)}catch(r){throw u(r,o,"key")}try{var s=r[o];h(e,s,n)}catch(r){throw u(r,o)}}return!0}return e=l(e),t&&(t=l(t)),r.toJSON=t?function(){return"{"+o(t)+": "+o(e)+"}"}:function(){return"{"+o(e)+"}"},r},object:function(e){var t={};for(var r in e)t[r]=l(e[r]);function n(e,r){if(!i.Object(e))return!1;if(i.Nil(e))return!1;var n;try{for(n in t){h(t[n],e[n],r)}}catch(e){throw u(e,n)}if(r)for(n in e)if(!t[n])throw new a(void 0,n);return!0}return n.toJSON=function(){return o(t)},n},oneOf:function(){var e=[].slice.call(arguments).map(l);function t(t,r){return e.some(function(e){try{return h(e,t,r)}catch(e){return!1}})}return t.toJSON=function(){return e.map(o).join("|")},t},quacksLike:function(e){function t(t){return e===c(t)}return t.toJSON=function(){return e},t},tuple:function(){var e=[].slice.call(arguments).map(l);function t(t,r){return!i.Nil(t)&&!i.Nil(t.length)&&(!r||t.length===e.length)&&e.every(function(e,n){try{return h(e,t[n],r)}catch(e){throw u(e,n)}})}return t.toJSON=function(){return"("+e.map(o).join(", ")+")"},t},value:function(e){function t(t){return t===e}return t.toJSON=function(){return e},t}};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(782);for(p in d)h[p]=d[p];h.async=function e(t,r,n,i){if("function"==typeof n)return e(t,r,!1,n);try{h(t,r,n)}catch(t){return i(t)}i()},h.compile=l,h.TfTypeError=s,h.TfPropertyTypeError=a,e.exports=h},function(e,t){e.exports=function(){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};var r=Object.prototype.hasOwnProperty},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(230),o=r(401),s=r(25),a=r(31),u=r(403),c=r(42),f=r(783),l=c.OP_RESERVED;function h(e){return a.Buffer(e)||function(e){return a.Number(e)&&(e===c.OP_0||e>=c.OP_1&&e<=c.OP_16||e===c.OP_1NEGATE)}(e)}function p(e){return a.Array(e)&&e.every(h)}function d(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 y(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!==d(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=d(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 g(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)+i.number>e.length)return[];var u=e.slice(r,r+i.number);r+=i.number;var f=d(u);void 0!==f?t.push(f):t.push(u)}else t.push(n),r+=1}return t}function m(e){var t=-129&e;return t>0&&t<4}e.exports={compile:y,decompile:g,fromASM:function(e){return s(a.String,e),y(e.split(" ").map(function(e){return void 0!==c[e]?c[e]:(s(a.Hex,e),n.from(e,"hex"))}))},toASM:function(e){return n.isBuffer(e)&&(e=g(e)),e.map(function(e){if(n.isBuffer(e)){var t=d(e);if(void 0===t)return e.toString("hex");e=t}return f[e]}).join(" ")},toStack:function(e){return e=g(e),s(p,e),e.map(function(e){return n.isBuffer(e)?e:e===c.OP_0?n.allocUnsafe(0):u.encode(e-l)})},number:r(403),isCanonicalPubKey:function(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},isCanonicalSignature:function(e){return!!n.isBuffer(e)&&!!m(e[e.length-1])&&i.check(e.slice(0,-1))},isPushOnly:p,isDefinedHashType:m}},function(e,t,r){"use strict";var n=r(18),i=function(e){return!!n.isString(e)&&/^[0-9a-fA-F]+$/.test(e)};e.exports={isValidJSON:function(e){var t;if(!n.isString(e))return!1;try{t=JSON.parse(e)}catch(e){return!1}return"object"==typeof t},isHexa:i,isHexaString:i,cloneArray:function(e){return[].concat(e)},defineImmutable:function(e,t){return Object.keys(t).forEach(function(r){Object.defineProperty(e,r,{configurable:!1,enumerable:!0,value:t[r]})}),e},isNaturalNumber:function(e){return"number"==typeof e&&isFinite(e)&&Math.floor(e)===e&&e>=0}}},function(e,t,r){var n=r(1130);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){var n=r(25),i=Math.pow(2,31)-1;function o(e){return n.String(e)&&e.match(/^(m\/)?(\d+'?\/)*\d+'?$/)}o.toJSON=function(){return"BIP32 derivation path"};var s=21e14;var a=n.quacksLike("BigInteger"),u=n.quacksLike("Point"),c=n.compile({r:a,s:a}),f=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}),l={BigInt:a,BIP32Path:o,Buffer256bit:n.BufferN(32),ECPoint:u,ECSignature:c,Hash160bit:n.BufferN(20),Hash256bit:n.BufferN(32),Network:f,Satoshi:function(e){return n.UInt53(e)&&e<=s},UInt31:function(e){return n.UInt32(e)&&e<=i}};for(var h in n)l[h]=n[h];e.exports=l},function(e,t,r){"use strict";(function(t){var n=r(74),i=r(21),o=r(18),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");return new n(r,16)},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)).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){var o=(i=this.toString(16,2)).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)?128&(e=this.neg().toBuffer())[0]?e=t.concat([new t([128]),e]):e[0]=128|e[0]:128&(e=this.toBuffer())[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){"use strict";var n=r(631),i=r(632);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=v,t.resolve=function(e,t){return v(e,!1,!0).resolve(t)},t.resolveObject=function(e,t){return e?v(e,!1,!0).resolveObject(t):t},t.format=function(e){return i.isString(e)&&(e=v(e)),e instanceof o?e.format():o.prototype.format.call(e)},t.Url=o;var s=/^([a-z0-9.+-]+:)/i,a=/:[0-9]*$/,u=/^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,c=["{","}","|","\\","^","`"].concat(["<",">",'"',"`"," ","\r","\n","\t"]),f=["'"].concat(c),l=["%","/","?",";","#"].concat(f),h=["/","?","#"],p=/^[+a-z0-9A-Z_-]{0,63}$/,d=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,y={javascript:!0,"javascript:":!0},g={javascript:!0,"javascript:":!0},m={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},b=r(209);function v(e,t,r){if(e&&i.isObject(e)&&e instanceof o)return e;var n=new o;return n.parse(e,t,r),n}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);c[0]=c[0].replace(/\\/g,"/");var v=e=c.join(a);if(v=v.trim(),!r&&1===e.split("#").length){var _=u.exec(v);if(_)return this.path=v,this.href=v,this.pathname=_[1],_[2]?(this.search=_[2],this.query=t?b.parse(this.search.substr(1)):this.search.substr(1)):t&&(this.search="",this.query={}),this}var w=s.exec(v);if(w){var S=(w=w[0]).toLowerCase();this.protocol=S,v=v.substr(w.length)}if(r||w||v.match(/^\/\/[^@\/]+@[^@\/]+/)){var k="//"===v.substr(0,2);!k||w&&g[w]||(v=v.substr(2),this.slashes=!0)}if(!g[w]&&(k||w&&!m[w])){for(var E,A,x=-1,I=0;I<h.length;I++){-1!==(T=v.indexOf(h[I]))&&(-1===x||T<x)&&(x=T)}-1!==(A=-1===x?v.lastIndexOf("@"):v.lastIndexOf("@",x))&&(E=v.slice(0,A),v=v.slice(A+1),this.auth=decodeURIComponent(E)),x=-1;for(I=0;I<l.length;I++){var T;-1!==(T=v.indexOf(l[I]))&&(-1===x||T<x)&&(x=T)}-1===x&&(x=v.length),this.host=v.slice(0,x),v=v.slice(x),this.parseHost(),this.hostname=this.hostname||"";var B="["===this.hostname[0]&&"]"===this.hostname[this.hostname.length-1];if(!B)for(var C=this.hostname.split(/\./),P=(I=0,C.length);I<P;I++){var O=C[I];if(O&&!O.match(p)){for(var R="",N=0,L=O.length;N<L;N++)O.charCodeAt(N)>127?R+="x":R+=O[N];if(!R.match(p)){var K=C.slice(0,I),j=C.slice(I+1),M=O.match(d);M&&(K.push(M[1]),j.unshift(M[2])),j.length&&(v="/"+j.join(".")+v),this.hostname=K.join(".");break}}}this.hostname.length>255?this.hostname="":this.hostname=this.hostname.toLowerCase(),B||(this.hostname=n.toASCII(this.hostname));var D=this.port?":"+this.port:"",U=this.hostname||"";this.host=U+D,this.href+=this.host,B&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),"/"!==v[0]&&(v="/"+v))}if(!y[S])for(I=0,P=f.length;I<P;I++){var F=f[I];if(-1!==v.indexOf(F)){var q=encodeURIComponent(F);q===F&&(q=escape(F)),v=v.split(F).join(q)}}var H=v.indexOf("#");-1!==H&&(this.hash=v.substr(H),v=v.slice(0,H));var z=v.indexOf("?");if(-1!==z?(this.search=v.substr(z),this.query=v.substr(z+1),t&&(this.query=b.parse(this.query)),v=v.slice(0,z)):t&&(this.search="",this.query={}),v&&(this.pathname=v),m[S]&&this.hostname&&!this.pathname&&(this.pathname="/"),this.pathname||this.search){D=this.pathname||"";var V=this.search||"";this.path=D+V}return this.href=this.format(),this},o.prototype.format=function(){var e=this.auth||"";e&&(e=(e=encodeURIComponent(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=b.stringify(this.query));var a=this.search||s&&"?"+s||"";return t&&":"!==t.substr(-1)&&(t+=":"),this.slashes||(!t||m[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),t+o+(r=r.replace(/[?#]/g,function(e){return encodeURIComponent(e)}))+(a=a.replace("#","%23"))+n},o.prototype.resolve=function(e){return this.resolveObject(v(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 m[r.protocol]&&r.hostname&&!r.pathname&&(r.path=r.pathname="/"),r.href=r.format(),r}if(e.protocol&&e.protocol!==r.protocol){if(!m[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||g[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||"",b=r.search||"";r.path=y+b}return r.slashes=r.slashes||e.slashes,r.href=r.format(),r}var v=r.pathname&&"/"===r.pathname.charAt(0),_=e.host||e.pathname&&"/"===e.pathname.charAt(0),w=_||v||r.host&&e.pathname,S=w,k=r.pathname&&r.pathname.split("/")||[],E=(d=e.pathname&&e.pathname.split("/")||[],r.protocol&&!m[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)){return E&&(r.hostname=r.host=k.shift(),(B=!!(r.host&&r.host.indexOf("@")>0)&&r.host.split("@"))&&(r.auth=B.shift(),r.host=r.hostname=B.shift())),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 A=k.slice(-1)[0],x=(r.host||e.host||k.length>1)&&("."===A||".."===A)||""===A,I=0,T=k.length;T>=0;T--)"."===(A=k[T])?k.splice(T,1):".."===A?(k.splice(T,1),I++):I&&(k.splice(T,1),I--);if(!w&&!S)for(;I--;I)k.unshift("..");!w||""===k[0]||k[0]&&"/"===k[0].charAt(0)||k.unshift(""),x&&"/"!==k.join("/").substr(-1)&&k.push("");var B,C=""===k[0]||k[0]&&"/"===k[0].charAt(0);return E&&(r.hostname=r.host=C?"":k.length?k.shift():"",(B=!!(r.host&&r.host.indexOf("@")>0)&&r.host.split("@"))&&(r.auth=B.shift(),r.host=r.hostname=B.shift())),(w=w||r.host&&k.length)&&!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])&&(this.port=t.substr(1)),e=e.substr(0,e.length-t.length)),e&&(this.hostname=e)}},function(e,t,r){"use strict";const n=r(365),i=r(693),o=r(221);t.Key=n,t.MemoryDatastore=i,t.utils=o},function(e,t,r){"use strict";const n=r(10)(r(1072)).Data,i=["raw","directory","file","metadata","symlink","hamt-sharded-directory"],o=["directory","hamt-sharded-directory"];function s(e,t){if(!(this instanceof s))return new s(e,t);if(-1===i.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(o.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=n.DataType.Raw;break;case"directory":e=n.DataType.Directory;break;case"file":e=n.DataType.File;break;case"metadata":e=n.DataType.Metadata;break;case"symlink":e=n.DataType.Symlink;break;case"hamt-sharded-directory":e=n.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 i=this.blockSizes;return this.blockSizes&&this.blockSizes.length||(i=void 0),n.encode({Type:e,Data:r,filesize:t,blocksizes:i,hashType:this.hashType,fanout:this.fanout})})}s.unmarshal=(e=>{const t=n.decode(e);t.Data||(t.Data=void 0);const r=new s(i[t.Type],t.Data);return r.blockSizes=t.blocksizes,r}),e.exports=s},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.isAsync=void 0;var n=function(e){return e&&e.__esModule?e:{default:e}}(r(154));var i="function"==typeof Symbol;function o(e){return i&&"AsyncFunction"===e[Symbol.toStringTag]}t.default=function(e){return o(e)?(0,n.default)(e):e},t.isAsync=o},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e,t,r){r=(0,o.default)(r||n.default);var a=(0,s.default)(t);if(!e())return r(null);var u=function(t){if(t)return r(t);if(e())return a(u);var n=(0,i.default)(arguments,1);r.apply(null,[null].concat(n))};a(u)};var n=a(r(62)),i=a(r(102)),o=a(r(103)),s=a(r(36));function a(e){return e&&e.__esModule?e:{default:e}}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;!u.JS_SHA3_NO_NODE_JS&&"object"==typeof n&&n.versions&&n.versions.node?u=i:c&&(u=self);var f=!u.JS_SHA3_NO_COMMON_JS&&"object"==typeof e&&e.exports,l=r(745),h=!u.JS_SHA3_NO_ARRAY_BUFFER&&"undefined"!=typeof ArrayBuffer,p="0123456789abcdef".split(""),d=[4,1024,262144,67108864],y=[0,8,16,24],g=[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],m=[224,256,384,512],b=[128,256],v=["hex","buffer","arrayBuffer","array","digest"],_={128:168,256:136};!u.JS_SHA3_NO_NODE_JS&&Array.isArray||(Array.isArray=function(e){return"[object Array]"===Object.prototype.toString.call(e)}),!h||!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 w=function(e,t,r){return function(n){return new K(e,t,e).update(n)[r]()}},S=function(e,t,r){return function(n,i){return new K(e,t,i).update(n)[r]()}},k=function(e,t,r){return function(t,n,i,o){return T["cshake"+e].update(t,n,i,o)[r]()}},E=function(e,t,r){return function(t,n,i,o){return T["kmac"+e].update(t,n,i,o)[r]()}},A=function(e,t,r,n){for(var i=0;i<v.length;++i){var o=v[i];e[o]=t(r,n,o)}return e},x=function(e,t){var r=w(e,t,"hex");return r.create=function(){return new K(e,t,e)},r.update=function(e){return r.create().update(e)},A(r,w,e,t)},I=[{name:"keccak",padding:[1,256,65536,16777216],bits:m,createMethod:x},{name:"sha3",padding:[6,1536,393216,100663296],bits:m,createMethod:x},{name:"shake",padding:[31,7936,2031616,520093696],bits:b,createMethod:function(e,t){var r=S(e,t,"hex");return r.create=function(r){return new K(e,t,r)},r.update=function(e,t){return r.create(t).update(e)},A(r,S,e,t)}},{name:"cshake",padding:d,bits:b,createMethod:function(e,t){var r=_[e],n=k(e,0,"hex");return n.create=function(n,i,o){return i||o?new K(e,t,n).bytepad([i,o],r):T["shake"+e].create(n)},n.update=function(e,t,r,i){return n.create(t,r,i).update(e)},A(n,k,e,t)}},{name:"kmac",padding:d,bits:b,createMethod:function(e,t){var r=_[e],n=E(e,0,"hex");return n.create=function(n,i,o){return new j(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)},A(n,E,e,t)}}],T={},B=[],C=0;C<I.length;++C)for(var P=I[C],O=P.bits,R=0;R<O.length;++R){var N=P.name+"_"+O[R];if(B.push(N),T[N]=P.createMethod(O[R],P.padding),"sha3"!==P.name){var L=P.name+O[R];B.push(L),T[L]=T[N]}}function K(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 j(e,t,r){K.call(this,e,t,r)}K.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(h&&e.constructor===ArrayBuffer)e=new Uint8Array(e);else if(!(Array.isArray(e)||h&&ArrayBuffer.isView(e)))throw s;t=!0}for(var n,i,o=this.blocks,a=this.byteCount,u=e.length,c=this.blockCount,f=0,l=this.s;f<u;){if(this.reset)for(this.reset=!1,o[0]=this.block,n=1;n<c+1;++n)o[n]=0;if(t)for(n=this.start;f<u&&n<a;++f)o[n>>2]|=e[f]<<y[3&n++];else for(n=this.start;f<u&&n<a;++f)(i=e.charCodeAt(f))<128?o[n>>2]|=i<<y[3&n++]:i<2048?(o[n>>2]|=(192|i>>6)<<y[3&n++],o[n>>2]|=(128|63&i)<<y[3&n++]):i<55296||i>=57344?(o[n>>2]|=(224|i>>12)<<y[3&n++],o[n>>2]|=(128|i>>6&63)<<y[3&n++],o[n>>2]|=(128|63&i)<<y[3&n++]):(i=65536+((1023&i)<<10|1023&e.charCodeAt(++f)),o[n>>2]|=(240|i>>18)<<y[3&n++],o[n>>2]|=(128|i>>12&63)<<y[3&n++],o[n>>2]|=(128|i>>6&63)<<y[3&n++],o[n>>2]|=(128|63&i)<<y[3&n++]);if(this.lastByteIndex=n,n>=a){for(this.start=n-a,this.block=o[c],n=0;n<c;++n)l[n]^=o[n];M(l),this.reset=!0}else this.start=n}return this}},K.prototype.encode=function(e,t){var r=255&e,n=1,i=[r];for(r=255&(e>>=8);r>0;)i.unshift(r),r=255&(e>>=8),++n;return t?i.push(n):i.unshift(n),this.update(i),i.length},K.prototype.encodeString=function(e){var t,r=typeof e;if("string"!==r){if("object"!==r)throw s;if(null===e)throw s;if(h&&e.constructor===ArrayBuffer)e=new Uint8Array(e);else if(!(Array.isArray(e)||h&&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},K.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},K.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var e=this.blocks,t=this.lastByteIndex,r=this.blockCount,n=this.s;if(e[t>>2]|=this.padding[3&t],this.lastByteIndex===this.byteCount)for(e[0]=e[r],t=1;t<r+1;++t)e[t]=0;for(e[r-1]|=2147483648,t=0;t<r;++t)n[t]^=e[t];M(n)}},K.prototype.toString=K.prototype.hex=function(){this.finalize();for(var e,t=this.blockCount,r=this.s,n=this.outputBlocks,i=this.extraBytes,o=0,s=0,a="";s<n;){for(o=0;o<t&&s<n;++o,++s)e=r[o],a+=p[e>>4&15]+p[15&e]+p[e>>12&15]+p[e>>8&15]+p[e>>20&15]+p[e>>16&15]+p[e>>28&15]+p[e>>24&15];s%t==0&&(M(r),o=0)}return i&&(e=r[o],a+=p[e>>4&15]+p[15&e],i>1&&(a+=p[e>>12&15]+p[e>>8&15]),i>2&&(a+=p[e>>20&15]+p[e>>16&15])),a},K.prototype.arrayBuffer=function(){this.finalize();var e,t=this.blockCount,r=this.s,n=this.outputBlocks,i=this.extraBytes,o=0,s=0,a=this.outputBits>>3;e=i?new ArrayBuffer(n+1<<2):new ArrayBuffer(a);for(var u=new Uint32Array(e);s<n;){for(o=0;o<t&&s<n;++o,++s)u[s]=r[o];s%t==0&&M(r)}return i&&(u[o]=r[o],e=e.slice(0,a)),e},K.prototype.buffer=K.prototype.arrayBuffer,K.prototype.digest=K.prototype.array=function(){this.finalize();for(var e,t,r=this.blockCount,n=this.s,i=this.outputBlocks,o=this.extraBytes,s=0,a=0,u=[];a<i;){for(s=0;s<r&&a<i;++s,++a)e=a<<2,t=n[s],u[e]=255&t,u[e+1]=t>>8&255,u[e+2]=t>>16&255,u[e+3]=t>>24&255;a%r==0&&M(n)}return o&&(e=a<<2,t=n[s],u[e]=255&t,o>1&&(u[e+1]=t>>8&255),o>2&&(u[e+2]=t>>16&255)),u},j.prototype=new K,j.prototype.finalize=function(){return this.encode(this.outputBits,!0),K.prototype.finalize.call(this)};var M=function(e){var t,r,n,i,o,s,a,u,c,f,l,h,p,d,y,m,b,v,_,w,S,k,E,A,x,I,T,B,C,P,O,R,N,L,K,j,M,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],t=(h=e[8]^e[18]^e[28]^e[38]^e[48])^(s<<1|a>>>31),r=(p=e[9]^e[19]^e[29]^e[39]^e[49])^(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,K=e[3]<<1|e[2]>>>31,m=e[13]<<12|e[12]>>>20,b=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,j=e[14]<<6|e[15]>>>26,M=e[15]<<6|e[14]>>>26,v=e[25]<<11|e[24]>>>21,_=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^~m&v,e[1]=y^~b&_,e[10]=A^~I&B,e[11]=x^~T&C,e[20]=L^~j&D,e[21]=K^~M&U,e[30]=V^~W&Y,e[31]=G^~$&J,e[40]=te^~ne&oe,e[41]=re^~ie&se,e[2]=m^~v&w,e[3]=b^~_&S,e[12]=I^~B&P,e[13]=T^~C&O,e[22]=j^~D&F,e[23]=M^~U&q,e[32]=W^~Y&X,e[33]=$^~J&Z,e[42]=ne^~oe&ae,e[43]=ie^~se&ue,e[4]=v^~w&k,e[5]=_^~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&K,e[36]=X^~Q&V,e[37]=Z^~ee&G,e[46]=ae^~ce&te,e[47]=ue^~fe&re,e[8]=k^~d&m,e[9]=E^~y&b,e[18]=R^~A&I,e[19]=N^~x&T,e[28]=H^~L&j,e[29]=z^~K&M,e[38]=Q^~V&W,e[39]=ee^~G&$,e[48]=ce^~te&ne,e[49]=fe^~re&ie,e[0]^=g[n],e[1]^=g[n+1]};if(f)e.exports=T;else{for(C=0;C<B.length;++C)u[B[C]]=T[B[C]];l&&(void 0===(o=function(){return T}.call(t,r,t,e))||(e.exports=o))}}()}).call(this,r(7),r(6))},function(e,t,r){e.exports=r(746)},function(e,t,r){(function(t){var n,i=r(748),o=r(388);function s(e,t){return"function"!=typeof t?e:e.then(function(e){n(function(){t(null,e)})},function(e){n(function(){t(e)})})}function a(e){return s(this,e)}function u(e){if(e&&o(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:i.prototype.nodeify=a}function c(e){if(!(this instanceof c))return new c(e);i.call(this,e),u(this)}n="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(i.prototype),c.prototype.constructor=c}).call(this,r(7))},function(e,t,r){var n=r(750),i=r(751);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){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(95),i=r(24),o=r(21),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){(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=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,B=/^\w*$/,C=/^\./,P=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,O=/\\(\\)?/g,R=/^\[object .+?Constructor\]$/,N=/^(?:0|[1-9]\d*)$/,L={};L["[object Float32Array]"]=L["[object Float64Array]"]=L["[object Int8Array]"]=L["[object Int16Array]"]=L["[object Int32Array]"]=L["[object Uint8Array]"]=L["[object Uint8ClampedArray]"]=L["[object Uint16Array]"]=L["[object Uint32Array]"]=!0,L[f]=L[l]=L[x]=L[h]=L[I]=L[p]=L[d]=L[y]=L[m]=L[b]=L[v]=L[w]=L[S]=L[k]=L[A]=!1;var K="object"==typeof e&&e&&e.Object===Object&&e,j="object"==typeof self&&self&&self.Object===Object&&self,M=K||j||Function("return this")(),D="object"==typeof t&&t&&!t.nodeType&&t,U=D&&"object"==typeof r&&r&&!r.nodeType&&r,F=U&&U.exports===D&&K.process,q=function(){try{return F&&F.binding("util")}catch(e){}}(),H=q&&q.isTypedArray;function z(e,t){for(var r=-1,n=e?e.length:0;++r<n;)if(t(e[r],r,e))return!0;return!1}function V(e){var t=!1;if(null!=e&&"function"!=typeof e.toString)try{t=!!(e+"")}catch(e){}return t}function G(e){var t=-1,r=Array(e.size);return e.forEach(function(e,n){r[++t]=[n,e]}),r}function W(e){var t=-1,r=Array(e.size);return e.forEach(function(e){r[++t]=e}),r}var $,Y=Array.prototype,J=Function.prototype,X=Object.prototype,Z=M["__core-js_shared__"],Q=($=/[^.]+$/.exec(Z&&Z.keys&&Z.keys.IE_PROTO||""))?"Symbol(src)_1."+$:"",ee=J.toString,te=X.hasOwnProperty,re=X.toString,ne=RegExp("^"+ee.call(te).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),ie=M.Symbol,oe=M.Uint8Array,se=X.propertyIsEnumerable,ae=Y.splice,ue=function(e,t){return function(r){return e(t(r))}}(Object.keys,Object),ce=qe(M,"DataView"),fe=qe(M,"Map"),le=qe(M,"Promise"),he=qe(M,"Set"),pe=qe(M,"WeakMap"),de=qe(Object,"create"),ye=Je(ce),ge=Je(fe),me=Je(le),be=Je(he),ve=Je(pe),_e=ie?ie.prototype:void 0,we=_e?_e.valueOf:void 0,Se=_e?_e.toString:void 0;function ke(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 Ee(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 Ae(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 xe(e){var t=-1,r=e?e.length:0;for(this.__data__=new Ae;++t<r;)this.add(e[t])}function Ie(e){this.__data__=new Ee(e)}function Te(e,t){var r=et(e)||Qe(e)?function(e,t){for(var r=-1,n=Array(e);++r<e;)n[r]=t(r);return n}(e.length,String):[],n=r.length,i=!!n;for(var o in e)!t&&!te.call(e,o)||i&&("length"==o||ze(o,n))||r.push(o);return r}function Be(e,t){for(var r=e.length;r--;)if(Ze(e[r][0],t))return r;return-1}ke.prototype.clear=function(){this.__data__=de?de(null):{}},ke.prototype.delete=function(e){return this.has(e)&&delete this.__data__[e]},ke.prototype.get=function(e){var t=this.__data__;if(de){var r=t[e];return r===o?void 0:r}return te.call(t,e)?t[e]:void 0},ke.prototype.has=function(e){var t=this.__data__;return de?void 0!==t[e]:te.call(t,e)},ke.prototype.set=function(e,t){return this.__data__[e]=de&&void 0===t?o:t,this},Ee.prototype.clear=function(){this.__data__=[]},Ee.prototype.delete=function(e){var t=this.__data__,r=Be(t,e);return!(r<0||(r==t.length-1?t.pop():ae.call(t,r,1),0))},Ee.prototype.get=function(e){var t=this.__data__,r=Be(t,e);return r<0?void 0:t[r][1]},Ee.prototype.has=function(e){return Be(this.__data__,e)>-1},Ee.prototype.set=function(e,t){var r=this.__data__,n=Be(r,e);return n<0?r.push([e,t]):r[n][1]=t,this},Ae.prototype.clear=function(){this.__data__={hash:new ke,map:new(fe||Ee),string:new ke}},Ae.prototype.delete=function(e){return Fe(this,e).delete(e)},Ae.prototype.get=function(e){return Fe(this,e).get(e)},Ae.prototype.has=function(e){return Fe(this,e).has(e)},Ae.prototype.set=function(e,t){return Fe(this,e).set(e,t),this},xe.prototype.add=xe.prototype.push=function(e){return this.__data__.set(e,o),this},xe.prototype.has=function(e){return this.__data__.has(e)},Ie.prototype.clear=function(){this.__data__=new Ee},Ie.prototype.delete=function(e){return this.__data__.delete(e)},Ie.prototype.get=function(e){return this.__data__.get(e)},Ie.prototype.has=function(e){return this.__data__.has(e)},Ie.prototype.set=function(e,t){var r=this.__data__;if(r instanceof Ee){var i=r.__data__;if(!fe||i.length<n-1)return i.push([e,t]),this;r=this.__data__=new Ae(i)}return r.set(e,t),this};var Ce=function(e,t){return function(r,n){if(null==r)return r;if(!tt(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(e,t){return e&&Pe(e,t,ut)}),Pe=function(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 Oe(e,t){for(var r=0,n=(t=Ve(t,e)?[t]:Me(t)).length;null!=e&&r<n;)e=e[Ye(t[r++])];return r&&r==n?e:void 0}function Re(e,t){return null!=e&&t in Object(e)}function Ne(e,t,r,n,i){return e===t||(null==e||null==t||!it(e)&&!ot(t)?e!=e&&t!=t:function(e,t,r,n,i,o){var s=et(e),u=et(t),c=l,h=l;s||(c=(c=He(e))==f?v:c),u||(h=(h=He(t))==f?v:h);var p=c==v&&!V(e),d=h==v&&!V(t),y=c==h;if(y&&!p)return o||(o=new Ie),s||at(e)?De(e,t,r,n,i,o):Ue(e,t,c,r,n,i,o);if(!(i&a)){var g=p&&te.call(e,"__wrapped__"),m=d&&te.call(t,"__wrapped__");if(g||m){var b=g?e.value():e,_=m?t.value():t;return o||(o=new Ie),r(b,_,n,i,o)}}return!!y&&(o||(o=new Ie),function(e,t,r,n,i,o){var s=i&a,u=ut(e),c=u.length;if(c!=ut(t).length&&!s)return!1;for(var f=c;f--;){var l=u[f];if(!(s?l in t:te.call(t,l)))return!1}var h=o.get(e);if(h&&o.get(t))return h==t;var p=!0;o.set(e,t),o.set(t,e);for(var d=s;++f<c;){var y=e[l=u[f]],g=t[l];if(n)var m=s?n(g,y,l,t,e,o):n(y,g,l,e,t,o);if(!(void 0===m?y===g||r(y,g,n,i,o):m)){p=!1;break}d||(d="constructor"==l)}if(p&&!d){var b=e.constructor,v=t.constructor;b!=v&&"constructor"in e&&"constructor"in t&&!("function"==typeof b&&b instanceof b&&"function"==typeof v&&v instanceof v)&&(p=!1)}return o.delete(e),o.delete(t),p}(e,t,r,n,i,o))}(e,t,Ne,r,n,i))}function Le(e){return!(!it(e)||function(e){return!!Q&&Q in e}(e))&&(rt(e)||V(e)?ne:R).test(Je(e))}function Ke(e){return"function"==typeof e?e:null==e?ct:"object"==typeof e?et(e)?function(e,t){return Ve(e)&&Ge(t)?We(Ye(e),t):function(r){var n=function(e,t,r){var n=null==e?void 0:Oe(e,t);return void 0===n?r:n}(r,e);return void 0===n&&n===t?function(e,t){return null!=e&&function(e,t,r){for(var n,i=-1,o=(t=Ve(t,e)?[t]:Me(t)).length;++i<o;){var s=Ye(t[i]);if(!(n=null!=e&&r(e,s)))break;e=e[s]}return n||!!(o=e?e.length:0)&&nt(o)&&ze(s,o)&&(et(e)||Qe(e))}(e,t,Re)}(r,e):Ne(t,n,void 0,s|a)}}(e[0],e[1]):function(e){var t=function(e){for(var t=ut(e),r=t.length;r--;){var n=t[r],i=e[n];t[r]=[n,i,Ge(i)]}return t}(e);return 1==t.length&&t[0][2]?We(t[0][0],t[0][1]):function(r){return r===e||function(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;){var f=(c=r[i])[0],l=e[f],h=c[1];if(u&&c[2]){if(void 0===l&&!(f in e))return!1}else{var p=new Ie;if(n)var d=n(l,h,f,e,t,p);if(!(void 0===d?Ne(h,l,n,s|a,p):d))return!1}}return!0}(r,e,t)}}(e):function(e){return Ve(e)?function(e){return function(t){return null==t?void 0:t[e]}}(Ye(e)):function(e){return function(t){return Oe(t,e)}}(e)}(e)}function je(e){if(!function(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||X)}(e))return ue(e);var t=[];for(var r in Object(e))te.call(e,r)&&"constructor"!=r&&t.push(r);return t}function Me(e){return et(e)?e:$e(e)}function De(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 xe: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(!z(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 Ue(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 oe(e),new oe(t)));case h:case p:case b:return Ze(+e,+t);case d:return e.name==t.name&&e.message==t.message;case w:case k:return e==t+"";case m:var c=G;case S:var f=o&a;if(c||(c=W),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=De(c(e),c(t),n,i,o,u);return u.delete(e),y;case E:if(we)return we.call(e)==we.call(t)}return!1}function Fe(e,t){var r=e.__data__;return function(e){var t=typeof e;return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e}(t)?r["string"==typeof t?"string":"hash"]:r.map}function qe(e,t){var r=function(e,t){return null==e?void 0:e[t]}(e,t);return Le(r)?r:void 0}var He=function(e){return re.call(e)};function ze(e,t){return!!(t=null==t?c:t)&&("number"==typeof e||N.test(e))&&e>-1&&e%1==0&&e<t}function Ve(e,t){if(et(e))return!1;var r=typeof e;return!("number"!=r&&"symbol"!=r&&"boolean"!=r&&null!=e&&!st(e))||B.test(e)||!T.test(e)||null!=t&&e in Object(t)}function Ge(e){return e==e&&!it(e)}function We(e,t){return function(r){return null!=r&&r[e]===t&&(void 0!==t||e in Object(r))}}(ce&&He(new ce(new ArrayBuffer(1)))!=I||fe&&He(new fe)!=m||le&&He(le.resolve())!=_||he&&He(new he)!=S||pe&&He(new pe)!=A)&&(He=function(e){var t=re.call(e),r=t==v?e.constructor:void 0,n=r?Je(r):void 0;if(n)switch(n){case ye:return I;case ge:return m;case me:return _;case be:return S;case ve:return A}return t});var $e=Xe(function(e){e=function(e){return null==e?"":function(e){if("string"==typeof e)return e;if(st(e))return Se?Se.call(e):"";var t=e+"";return"0"==t&&1/e==-u?"-0":t}(e)}(e);var t=[];return C.test(e)&&t.push(""),e.replace(P,function(e,r,n,i){t.push(n?i.replace(O,"$1"):r||e)}),t});function Ye(e){if("string"==typeof e||st(e))return e;var t=e+"";return"0"==t&&1/e==-u?"-0":t}function Je(e){if(null!=e){try{return ee.call(e)}catch(e){}try{return e+""}catch(e){}}return""}function Xe(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(Xe.Cache||Ae),r}function Ze(e,t){return e===t||e!=e&&t!=t}function Qe(e){return function(e){return ot(e)&&tt(e)}(e)&&te.call(e,"callee")&&(!se.call(e,"callee")||re.call(e)==f)}Xe.Cache=Ae;var et=Array.isArray;function tt(e){return null!=e&&nt(e.length)&&!rt(e)}function rt(e){var t=it(e)?re.call(e):"";return t==y||t==g}function nt(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=c}function it(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function ot(e){return!!e&&"object"==typeof e}function st(e){return"symbol"==typeof e||ot(e)&&re.call(e)==E}var at=H?function(e){return function(t){return e(t)}}(H):function(e){return ot(e)&&nt(e.length)&&!!L[re.call(e)]};function ut(e){return tt(e)?Te(e):je(e)}function ct(e){return e}r.exports=function(e,t){return(et(e)?function(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(e,t){var r=-1,n=tt(e)?Array(e.length):[];return Ce(e,function(e,i,o){n[++r]=t(e,i,o)}),n})(e,Ke(t))}}).call(this,r(6),r(27)(e))},function(e,t,r){"use strict";t.DAGNode=r(166),t.DAGLink=r(91),t.resolver=r(390),t.util=r(226)},function(e,t){e.exports=function(e,t){"function"==typeof e&&(t=e,e=!1);var r,n,i,o=[];function s(e,t){e&&(r=e,n&&f(r)),n=t,c()}function a(e){i=i||e||!0,c()}function u(e){i||(n?f(r,e):o.push(e))}return e?{push:u,end:a,source:s,buffer:o}:(s.push=u,s.end=a,s.buffer=o,s);function c(){n&&(r?f(r):!o.length&&i?f(i):o.length&&f(null,o.shift()))}function f(e,r){var i=n;if(e&&t){var o=t;t=null,o(!0===e?null:e)}n=null,i(e,r)}}},function(e,t,r){"use strict";t.Connection=r(1090)},function(e,t,r){"use strict";const n=r(146);e.exports={addLink:r(325),bufferPullStreamSource:r(1431),countStreamBytes:r(1432),createLock:r(1433),createNode:r(601),endPullStream:r(602),formatCid:r(1448),limitStreamBytes:r(1449),loadNode:r(1450),toSourcesAndDestination:r(1451),toSources:r(603),traverseTo:r(1452),updateMfsRoot:r(1454),updateTree:r(1455),validatePath:r(605),withMfsRoot:r(604),zeros:r(1456),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=function(e,t){(0,n.default)(i.default,e,t)};var n=o(r(354)),i=o(r(215));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=function(e,t,r){(0,n.default)(e,(0,i.default)((0,o.default)(t)),r)};var n=s(r(218)),i=s(r(364)),o=s(r(36));function s(e){return e&&e.__esModule?e:{default:e}}e.exports=t.default},function(e,t,r){"use strict";const n=r(956),i=r(481).ensureMultiaddr,o=r(982),s=r(17);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(1050),i=r(1051);t.encode=n,t.decode=i.decode,t.decodeFromReader=i.decodeFromReader},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(828).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){return e instanceof o||null!==e&&"object"==typeof e&&e.constructor.wordSize===o.wordSize&&Array.isArray(e.words)},o.max=function(e,t){return e.cmp(t)>0?e:t},o.min=function(e,t){return e.cmp(t)<0?e:t},o.prototype._init=function(e,t,r){if("number"==typeof e)return this._initNumber(e,t,r);if("object"==typeof e)return this._initArray(e,t,r);"hex"===t&&(t=16),n(t===(0|t)&&t>=2&&t<=36);var i=0;"-"===(e=e.toString().replace(/\s+/g,""))[0]&&i++,16===t?this._parseHex(e,i):this._parseBase(e,t,i),"-"===e[0]&&(this.negative=1),this.strip(),"le"===r&&this._initArray(this.toArray(),t,r)},o.prototype._initNumber=function(e,t,r){e<0&&(this.negative=1,e=-e),e<67108864?(this.words=[67108863&e],this.length=1):e<4503599627370496?(this.words=[67108863&e,e/67108864&67108863],this.length=2):(n(e<9007199254740992),this.words=[67108863&e,e/67108864&67108863,1],this.length=3),"le"===r&&this._initArray(this.toArray(),t,r)},o.prototype._initArray=function(e,t,r){if(n("number"==typeof e.length),e.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(e.length/3),this.words=new Array(this.length);for(var i=0;i<this.length;i++)this.words[i]=0;var o,s,a=0;if("be"===r)for(i=e.length-1,o=0;i>=0;i-=3)s=e[i]|e[i-1]<<8|e[i-2]<<16,this.words[o]|=s<<a&67108863,this.words[o+1]=s>>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);else if("le"===r)for(i=0,o=0;i<e.length;i+=3)s=e[i]|e[i+1]<<8|e[i+2]<<16,this.words[o]|=s<<a&67108863,this.words[o+1]=s>>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);return this.strip()},o.prototype._parseHex=function(e,t){this.length=Math.ceil((e.length-t)/6),this.words=new Array(this.length);for(var r=0;r<this.length;r++)this.words[r]=0;var n,i,o=0;for(r=e.length-6,n=0;r>=t;r-=6)i=a(e,r,r+6),this.words[n]|=i<<o&67108863,this.words[n+1]|=i>>>26-o&4194303,(o+=24)>=26&&(o-=26,n++);r+6!==t&&(i=a(e,t,r+6),this.words[n]|=i<<o&67108863,this.words[n+1]|=i>>>26-o&4194303),this.strip()},o.prototype._parseBase=function(e,t,r){this.words=[0],this.length=1;for(var n=0,i=1;i<=67108863;i*=t)n++;n--,i=i/t|0;for(var o=e.length-r,s=o%n,a=Math.min(o,o-s)+r,c=0,f=r;f<a;f+=n)c=u(e,f,f+n,t),this.imuln(i),this.words[0]+c<67108864?this.words[0]+=c:this._iaddn(c);if(0!==s){var l=1;for(c=u(e,f,e.length,t),f=0;f<s;f++)l*=t;this.imuln(l),this.words[0]+c<67108864?this.words[0]+=c:this._iaddn(c)}},o.prototype.copy=function(e){e.words=new Array(this.length);for(var t=0;t<this.length;t++)e.words[t]=this.words[t];e.length=this.length,e.negative=this.negative,e.red=this.red},o.prototype.clone=function(){var e=new o(null);return this.copy(e),e},o.prototype._expand=function(e){for(;this.length<e;)this.words[this.length++]=0;return this},o.prototype.strip=function(){for(;this.length>1&&0===this.words[this.length-1];)this.length--;return this._normSign()},o.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},o.prototype.inspect=function(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"};var c=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],f=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],l=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];function h(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;f+=(s=(i=0|e.words[d])*(o=0|t.words[p])+l)/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){var r;if(e=e||10,t=0|t||1,16===e||"hex"===e){r="";for(var i=0,o=0,s=0;s<this.length;s++){var a=this.words[s],u=(16777215&(a<<i|o)).toString(16);r=0!=(o=a>>>24-i&16777215)||s!==this.length-1?c[6-u.length]+u+r:u+r,(i+=2)>=26&&(i-=26,s--)}for(0!==o&&(r=o.toString(16)+r);r.length%t!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}if(e===(0|e)&&e>=2&&e<=36){var h=f[e],p=l[e];r="";var d=this.clone();for(d.negative=0;!d.isZero();){var y=d.modn(p).toString(e);r=(d=d.idivn(p)).isZero()?y+r:c[h-y.length]+y+r}for(this.isZero()&&(r="0"+r);r.length%t!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}n(!1,"Base should be between 2 and 36")},o.prototype.toNumber=function(){var e=this.words[0];return 2===this.length?e+=67108864*this.words[1]:3===this.length&&1===this.words[2]?e+=4503599627370496+67108864*this.words[1]:this.length>2&&n(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-e:e},o.prototype.toJSON=function(){return this.toString(16)},o.prototype.toBuffer=function(e,t){return n(void 0!==s),this.toArrayLike(s,e,t)},o.prototype.toArray=function(e,t){return this.toArrayLike(Array,e,t)},o.prototype.toArrayLike=function(e,t,r){var i=this.byteLength(),o=r||Math.max(1,i);n(i<=o,"byte array longer than desired length"),n(o>0,"Requested array length <= 0"),this.strip();var s,a,u="le"===t,c=new e(o),f=this.clone();if(u){for(a=0;!f.isZero();a++)s=f.andln(255),f.iushrn(8),c[a]=s;for(;a<o;a++)c[a]=0}else{for(a=0;a<o-i;a++)c[a]=0;for(a=0;!f.isZero();a++)s=f.andln(255),f.iushrn(8),c[o-a-1]=s}return c},Math.clz32?o.prototype._countBits=function(e){return 32-Math.clz32(e)}:o.prototype._countBits=function(e){var t=e,r=0;return t>=4096&&(r+=13,t>>>=13),t>=64&&(r+=7,t>>>=7),t>=8&&(r+=4,t>>>=4),t>=2&&(r+=2,t>>>=2),r+t},o.prototype._zeroBits=function(e){if(0===e)return 26;var t=e,r=0;return 0==(8191&t)&&(r+=13,t>>>=13),0==(127&t)&&(r+=7,t>>>=7),0==(15&t)&&(r+=4,t>>>=4),0==(3&t)&&(r+=2,t>>>=2),0==(1&t)&&r++,r},o.prototype.bitLength=function(){var e=this.words[this.length-1],t=this._countBits(e);return 26*(this.length-1)+t},o.prototype.zeroBits=function(){if(this.isZero())return 0;for(var e=0,t=0;t<this.length;t++){var r=this._zeroBits(this.words[t]);if(e+=r,26!==r)break}return e},o.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},o.prototype.toTwos=function(e){return 0!==this.negative?this.abs().inotn(e).iaddn(1):this.clone()},o.prototype.fromTwos=function(e){return this.testn(e-1)?this.notn(e).iaddn(1).ineg():this.clone()},o.prototype.isNeg=function(){return 0!==this.negative},o.prototype.neg=function(){return this.clone().ineg()},o.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},o.prototype.iuor=function(e){for(;this.length<e.length;)this.words[this.length++]=0;for(var t=0;t<e.length;t++)this.words[t]=this.words[t]|e.words[t];return this.strip()},o.prototype.ior=function(e){return n(0==(this.negative|e.negative)),this.iuor(e)},o.prototype.or=function(e){return this.length>e.length?this.clone().ior(e):e.clone().ior(this)},o.prototype.uor=function(e){return this.length>e.length?this.clone().iuor(e):e.clone().iuor(this)},o.prototype.iuand=function(e){var t;t=this.length>e.length?e:this;for(var r=0;r<t.length;r++)this.words[r]=this.words[r]&e.words[r];return this.length=t.length,this.strip()},o.prototype.iand=function(e){return n(0==(this.negative|e.negative)),this.iuand(e)},o.prototype.and=function(e){return this.length>e.length?this.clone().iand(e):e.clone().iand(this)},o.prototype.uand=function(e){return this.length>e.length?this.clone().iuand(e):e.clone().iuand(this)},o.prototype.iuxor=function(e){var t,r;this.length>e.length?(t=this,r=e):(t=e,r=this);for(var n=0;n<r.length;n++)this.words[n]=t.words[n]^r.words[n];if(this!==t)for(;n<t.length;n++)this.words[n]=t.words[n];return this.length=t.length,this.strip()},o.prototype.ixor=function(e){return n(0==(this.negative|e.negative)),this.iuxor(e)},o.prototype.xor=function(e){return this.length>e.length?this.clone().ixor(e):e.clone().ixor(this)},o.prototype.uxor=function(e){return this.length>e.length?this.clone().iuxor(e):e.clone().iuxor(this)},o.prototype.inotn=function(e){n("number"==typeof e&&e>=0);var t=0|Math.ceil(e/26),r=e%26;this._expand(t),r>0&&t--;for(var i=0;i<t;i++)this.words[i]=67108863&~this.words[i];return r>0&&(this.words[i]=~this.words[i]&67108863>>26-r),this.strip()},o.prototype.notn=function(e){return this.clone().inotn(e)},o.prototype.setn=function(e,t){n("number"==typeof e&&e>=0);var r=e/26|0,i=e%26;return this._expand(r+1),this.words[r]=t?this.words[r]|1<<i:this.words[r]&~(1<<i),this.strip()},o.prototype.iadd=function(e){var t,r,n;if(0!==this.negative&&0===e.negative)return this.negative=0,t=this.isub(e),this.negative^=1,this._normSign();if(0===this.negative&&0!==e.negative)return e.negative=0,t=this.isub(e),e.negative=1,t._normSign();this.length>e.length?(r=this,n=e):(r=e,n=this);for(var i=0,o=0;o<n.length;o++)t=(0|r.words[o])+(0|n.words[o])+i,this.words[o]=67108863&t,i=t>>>26;for(;0!==i&&o<r.length;o++)t=(0|r.words[o])+i,this.words[o]=67108863&t,i=t>>>26;if(this.length=r.length,0!==i)this.words[this.length]=i,this.length++;else if(r!==this)for(;o<r.length;o++)this.words[o]=r.words[o];return this},o.prototype.add=function(e){var t;return 0!==e.negative&&0===this.negative?(e.negative=0,t=this.sub(e),e.negative^=1,t):0===e.negative&&0!==this.negative?(this.negative=0,t=e.sub(this),this.negative=1,t):this.length>e.length?this.clone().iadd(e):e.clone().iadd(this)},o.prototype.isub=function(e){if(0!==e.negative){e.negative=0;var t=this.iadd(e);return e.negative=1,t._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(e),this.negative=1,this._normSign();var r,n,i=this.cmp(e);if(0===i)return this.negative=0,this.length=1,this.words[0]=0,this;i>0?(r=this,n=e):(r=e,n=this);for(var o=0,s=0;s<n.length;s++)o=(t=(0|r.words[s])-(0|n.words[s])+o)>>26,this.words[s]=67108863&t;for(;0!==o&&s<r.length;s++)o=(t=(0|r.words[s])+o)>>26,this.words[s]=67108863&t;if(0===o&&s<r.length&&r!==this)for(;s<r.length;s++)this.words[s]=r.words[s];return this.length=Math.max(this.length,s),r!==this&&(this.negative=1),this.strip()},o.prototype.sub=function(e){return this.clone().isub(e)};var p=function(e,t,r){var n,i,o,s=e.words,a=t.words,u=r.words,c=0,f=0|s[0],l=8191&f,h=f>>>13,p=0|s[1],d=8191&p,y=p>>>13,g=0|s[2],m=8191&g,b=g>>>13,v=0|s[3],_=8191&v,w=v>>>13,S=0|s[4],k=8191&S,E=S>>>13,A=0|s[5],x=8191&A,I=A>>>13,T=0|s[6],B=8191&T,C=T>>>13,P=0|s[7],O=8191&P,R=P>>>13,N=0|s[8],L=8191&N,K=N>>>13,j=0|s[9],M=8191&j,D=j>>>13,U=0|a[0],F=8191&U,q=U>>>13,H=0|a[1],z=8191&H,V=H>>>13,G=0|a[2],W=8191&G,$=G>>>13,Y=0|a[3],J=8191&Y,X=Y>>>13,Z=0|a[4],Q=8191&Z,ee=Z>>>13,te=0|a[5],re=8191&te,ne=te>>>13,ie=0|a[6],oe=8191&ie,se=ie>>>13,ae=0|a[7],ue=8191&ae,ce=ae>>>13,fe=0|a[8],le=8191&fe,he=fe>>>13,pe=0|a[9],de=8191&pe,ye=pe>>>13;r.negative=e.negative^t.negative,r.length=19;var ge=(c+(n=Math.imul(l,F))|0)+((8191&(i=(i=Math.imul(l,q))+Math.imul(h,F)|0))<<13)|0;c=((o=Math.imul(h,q))+(i>>>13)|0)+(ge>>>26)|0,ge&=67108863,n=Math.imul(d,F),i=(i=Math.imul(d,q))+Math.imul(y,F)|0,o=Math.imul(y,q);var me=(c+(n=n+Math.imul(l,z)|0)|0)+((8191&(i=(i=i+Math.imul(l,V)|0)+Math.imul(h,z)|0))<<13)|0;c=((o=o+Math.imul(h,V)|0)+(i>>>13)|0)+(me>>>26)|0,me&=67108863,n=Math.imul(m,F),i=(i=Math.imul(m,q))+Math.imul(b,F)|0,o=Math.imul(b,q),n=n+Math.imul(d,z)|0,i=(i=i+Math.imul(d,V)|0)+Math.imul(y,z)|0,o=o+Math.imul(y,V)|0;var be=(c+(n=n+Math.imul(l,W)|0)|0)+((8191&(i=(i=i+Math.imul(l,$)|0)+Math.imul(h,W)|0))<<13)|0;c=((o=o+Math.imul(h,$)|0)+(i>>>13)|0)+(be>>>26)|0,be&=67108863,n=Math.imul(_,F),i=(i=Math.imul(_,q))+Math.imul(w,F)|0,o=Math.imul(w,q),n=n+Math.imul(m,z)|0,i=(i=i+Math.imul(m,V)|0)+Math.imul(b,z)|0,o=o+Math.imul(b,V)|0,n=n+Math.imul(d,W)|0,i=(i=i+Math.imul(d,$)|0)+Math.imul(y,W)|0,o=o+Math.imul(y,$)|0;var ve=(c+(n=n+Math.imul(l,J)|0)|0)+((8191&(i=(i=i+Math.imul(l,X)|0)+Math.imul(h,J)|0))<<13)|0;c=((o=o+Math.imul(h,X)|0)+(i>>>13)|0)+(ve>>>26)|0,ve&=67108863,n=Math.imul(k,F),i=(i=Math.imul(k,q))+Math.imul(E,F)|0,o=Math.imul(E,q),n=n+Math.imul(_,z)|0,i=(i=i+Math.imul(_,V)|0)+Math.imul(w,z)|0,o=o+Math.imul(w,V)|0,n=n+Math.imul(m,W)|0,i=(i=i+Math.imul(m,$)|0)+Math.imul(b,W)|0,o=o+Math.imul(b,$)|0,n=n+Math.imul(d,J)|0,i=(i=i+Math.imul(d,X)|0)+Math.imul(y,J)|0,o=o+Math.imul(y,X)|0;var _e=(c+(n=n+Math.imul(l,Q)|0)|0)+((8191&(i=(i=i+Math.imul(l,ee)|0)+Math.imul(h,Q)|0))<<13)|0;c=((o=o+Math.imul(h,ee)|0)+(i>>>13)|0)+(_e>>>26)|0,_e&=67108863,n=Math.imul(x,F),i=(i=Math.imul(x,q))+Math.imul(I,F)|0,o=Math.imul(I,q),n=n+Math.imul(k,z)|0,i=(i=i+Math.imul(k,V)|0)+Math.imul(E,z)|0,o=o+Math.imul(E,V)|0,n=n+Math.imul(_,W)|0,i=(i=i+Math.imul(_,$)|0)+Math.imul(w,W)|0,o=o+Math.imul(w,$)|0,n=n+Math.imul(m,J)|0,i=(i=i+Math.imul(m,X)|0)+Math.imul(b,J)|0,o=o+Math.imul(b,X)|0,n=n+Math.imul(d,Q)|0,i=(i=i+Math.imul(d,ee)|0)+Math.imul(y,Q)|0,o=o+Math.imul(y,ee)|0;var we=(c+(n=n+Math.imul(l,re)|0)|0)+((8191&(i=(i=i+Math.imul(l,ne)|0)+Math.imul(h,re)|0))<<13)|0;c=((o=o+Math.imul(h,ne)|0)+(i>>>13)|0)+(we>>>26)|0,we&=67108863,n=Math.imul(B,F),i=(i=Math.imul(B,q))+Math.imul(C,F)|0,o=Math.imul(C,q),n=n+Math.imul(x,z)|0,i=(i=i+Math.imul(x,V)|0)+Math.imul(I,z)|0,o=o+Math.imul(I,V)|0,n=n+Math.imul(k,W)|0,i=(i=i+Math.imul(k,$)|0)+Math.imul(E,W)|0,o=o+Math.imul(E,$)|0,n=n+Math.imul(_,J)|0,i=(i=i+Math.imul(_,X)|0)+Math.imul(w,J)|0,o=o+Math.imul(w,X)|0,n=n+Math.imul(m,Q)|0,i=(i=i+Math.imul(m,ee)|0)+Math.imul(b,Q)|0,o=o+Math.imul(b,ee)|0,n=n+Math.imul(d,re)|0,i=(i=i+Math.imul(d,ne)|0)+Math.imul(y,re)|0,o=o+Math.imul(y,ne)|0;var Se=(c+(n=n+Math.imul(l,oe)|0)|0)+((8191&(i=(i=i+Math.imul(l,se)|0)+Math.imul(h,oe)|0))<<13)|0;c=((o=o+Math.imul(h,se)|0)+(i>>>13)|0)+(Se>>>26)|0,Se&=67108863,n=Math.imul(O,F),i=(i=Math.imul(O,q))+Math.imul(R,F)|0,o=Math.imul(R,q),n=n+Math.imul(B,z)|0,i=(i=i+Math.imul(B,V)|0)+Math.imul(C,z)|0,o=o+Math.imul(C,V)|0,n=n+Math.imul(x,W)|0,i=(i=i+Math.imul(x,$)|0)+Math.imul(I,W)|0,o=o+Math.imul(I,$)|0,n=n+Math.imul(k,J)|0,i=(i=i+Math.imul(k,X)|0)+Math.imul(E,J)|0,o=o+Math.imul(E,X)|0,n=n+Math.imul(_,Q)|0,i=(i=i+Math.imul(_,ee)|0)+Math.imul(w,Q)|0,o=o+Math.imul(w,ee)|0,n=n+Math.imul(m,re)|0,i=(i=i+Math.imul(m,ne)|0)+Math.imul(b,re)|0,o=o+Math.imul(b,ne)|0,n=n+Math.imul(d,oe)|0,i=(i=i+Math.imul(d,se)|0)+Math.imul(y,oe)|0,o=o+Math.imul(y,se)|0;var ke=(c+(n=n+Math.imul(l,ue)|0)|0)+((8191&(i=(i=i+Math.imul(l,ce)|0)+Math.imul(h,ue)|0))<<13)|0;c=((o=o+Math.imul(h,ce)|0)+(i>>>13)|0)+(ke>>>26)|0,ke&=67108863,n=Math.imul(L,F),i=(i=Math.imul(L,q))+Math.imul(K,F)|0,o=Math.imul(K,q),n=n+Math.imul(O,z)|0,i=(i=i+Math.imul(O,V)|0)+Math.imul(R,z)|0,o=o+Math.imul(R,V)|0,n=n+Math.imul(B,W)|0,i=(i=i+Math.imul(B,$)|0)+Math.imul(C,W)|0,o=o+Math.imul(C,$)|0,n=n+Math.imul(x,J)|0,i=(i=i+Math.imul(x,X)|0)+Math.imul(I,J)|0,o=o+Math.imul(I,X)|0,n=n+Math.imul(k,Q)|0,i=(i=i+Math.imul(k,ee)|0)+Math.imul(E,Q)|0,o=o+Math.imul(E,ee)|0,n=n+Math.imul(_,re)|0,i=(i=i+Math.imul(_,ne)|0)+Math.imul(w,re)|0,o=o+Math.imul(w,ne)|0,n=n+Math.imul(m,oe)|0,i=(i=i+Math.imul(m,se)|0)+Math.imul(b,oe)|0,o=o+Math.imul(b,se)|0,n=n+Math.imul(d,ue)|0,i=(i=i+Math.imul(d,ce)|0)+Math.imul(y,ue)|0,o=o+Math.imul(y,ce)|0;var Ee=(c+(n=n+Math.imul(l,le)|0)|0)+((8191&(i=(i=i+Math.imul(l,he)|0)+Math.imul(h,le)|0))<<13)|0;c=((o=o+Math.imul(h,he)|0)+(i>>>13)|0)+(Ee>>>26)|0,Ee&=67108863,n=Math.imul(M,F),i=(i=Math.imul(M,q))+Math.imul(D,F)|0,o=Math.imul(D,q),n=n+Math.imul(L,z)|0,i=(i=i+Math.imul(L,V)|0)+Math.imul(K,z)|0,o=o+Math.imul(K,V)|0,n=n+Math.imul(O,W)|0,i=(i=i+Math.imul(O,$)|0)+Math.imul(R,W)|0,o=o+Math.imul(R,$)|0,n=n+Math.imul(B,J)|0,i=(i=i+Math.imul(B,X)|0)+Math.imul(C,J)|0,o=o+Math.imul(C,X)|0,n=n+Math.imul(x,Q)|0,i=(i=i+Math.imul(x,ee)|0)+Math.imul(I,Q)|0,o=o+Math.imul(I,ee)|0,n=n+Math.imul(k,re)|0,i=(i=i+Math.imul(k,ne)|0)+Math.imul(E,re)|0,o=o+Math.imul(E,ne)|0,n=n+Math.imul(_,oe)|0,i=(i=i+Math.imul(_,se)|0)+Math.imul(w,oe)|0,o=o+Math.imul(w,se)|0,n=n+Math.imul(m,ue)|0,i=(i=i+Math.imul(m,ce)|0)+Math.imul(b,ue)|0,o=o+Math.imul(b,ce)|0,n=n+Math.imul(d,le)|0,i=(i=i+Math.imul(d,he)|0)+Math.imul(y,le)|0,o=o+Math.imul(y,he)|0;var Ae=(c+(n=n+Math.imul(l,de)|0)|0)+((8191&(i=(i=i+Math.imul(l,ye)|0)+Math.imul(h,de)|0))<<13)|0;c=((o=o+Math.imul(h,ye)|0)+(i>>>13)|0)+(Ae>>>26)|0,Ae&=67108863,n=Math.imul(M,z),i=(i=Math.imul(M,V))+Math.imul(D,z)|0,o=Math.imul(D,V),n=n+Math.imul(L,W)|0,i=(i=i+Math.imul(L,$)|0)+Math.imul(K,W)|0,o=o+Math.imul(K,$)|0,n=n+Math.imul(O,J)|0,i=(i=i+Math.imul(O,X)|0)+Math.imul(R,J)|0,o=o+Math.imul(R,X)|0,n=n+Math.imul(B,Q)|0,i=(i=i+Math.imul(B,ee)|0)+Math.imul(C,Q)|0,o=o+Math.imul(C,ee)|0,n=n+Math.imul(x,re)|0,i=(i=i+Math.imul(x,ne)|0)+Math.imul(I,re)|0,o=o+Math.imul(I,ne)|0,n=n+Math.imul(k,oe)|0,i=(i=i+Math.imul(k,se)|0)+Math.imul(E,oe)|0,o=o+Math.imul(E,se)|0,n=n+Math.imul(_,ue)|0,i=(i=i+Math.imul(_,ce)|0)+Math.imul(w,ue)|0,o=o+Math.imul(w,ce)|0,n=n+Math.imul(m,le)|0,i=(i=i+Math.imul(m,he)|0)+Math.imul(b,le)|0,o=o+Math.imul(b,he)|0;var xe=(c+(n=n+Math.imul(d,de)|0)|0)+((8191&(i=(i=i+Math.imul(d,ye)|0)+Math.imul(y,de)|0))<<13)|0;c=((o=o+Math.imul(y,ye)|0)+(i>>>13)|0)+(xe>>>26)|0,xe&=67108863,n=Math.imul(M,W),i=(i=Math.imul(M,$))+Math.imul(D,W)|0,o=Math.imul(D,$),n=n+Math.imul(L,J)|0,i=(i=i+Math.imul(L,X)|0)+Math.imul(K,J)|0,o=o+Math.imul(K,X)|0,n=n+Math.imul(O,Q)|0,i=(i=i+Math.imul(O,ee)|0)+Math.imul(R,Q)|0,o=o+Math.imul(R,ee)|0,n=n+Math.imul(B,re)|0,i=(i=i+Math.imul(B,ne)|0)+Math.imul(C,re)|0,o=o+Math.imul(C,ne)|0,n=n+Math.imul(x,oe)|0,i=(i=i+Math.imul(x,se)|0)+Math.imul(I,oe)|0,o=o+Math.imul(I,se)|0,n=n+Math.imul(k,ue)|0,i=(i=i+Math.imul(k,ce)|0)+Math.imul(E,ue)|0,o=o+Math.imul(E,ce)|0,n=n+Math.imul(_,le)|0,i=(i=i+Math.imul(_,he)|0)+Math.imul(w,le)|0,o=o+Math.imul(w,he)|0;var Ie=(c+(n=n+Math.imul(m,de)|0)|0)+((8191&(i=(i=i+Math.imul(m,ye)|0)+Math.imul(b,de)|0))<<13)|0;c=((o=o+Math.imul(b,ye)|0)+(i>>>13)|0)+(Ie>>>26)|0,Ie&=67108863,n=Math.imul(M,J),i=(i=Math.imul(M,X))+Math.imul(D,J)|0,o=Math.imul(D,X),n=n+Math.imul(L,Q)|0,i=(i=i+Math.imul(L,ee)|0)+Math.imul(K,Q)|0,o=o+Math.imul(K,ee)|0,n=n+Math.imul(O,re)|0,i=(i=i+Math.imul(O,ne)|0)+Math.imul(R,re)|0,o=o+Math.imul(R,ne)|0,n=n+Math.imul(B,oe)|0,i=(i=i+Math.imul(B,se)|0)+Math.imul(C,oe)|0,o=o+Math.imul(C,se)|0,n=n+Math.imul(x,ue)|0,i=(i=i+Math.imul(x,ce)|0)+Math.imul(I,ue)|0,o=o+Math.imul(I,ce)|0,n=n+Math.imul(k,le)|0,i=(i=i+Math.imul(k,he)|0)+Math.imul(E,le)|0,o=o+Math.imul(E,he)|0;var Te=(c+(n=n+Math.imul(_,de)|0)|0)+((8191&(i=(i=i+Math.imul(_,ye)|0)+Math.imul(w,de)|0))<<13)|0;c=((o=o+Math.imul(w,ye)|0)+(i>>>13)|0)+(Te>>>26)|0,Te&=67108863,n=Math.imul(M,Q),i=(i=Math.imul(M,ee))+Math.imul(D,Q)|0,o=Math.imul(D,ee),n=n+Math.imul(L,re)|0,i=(i=i+Math.imul(L,ne)|0)+Math.imul(K,re)|0,o=o+Math.imul(K,ne)|0,n=n+Math.imul(O,oe)|0,i=(i=i+Math.imul(O,se)|0)+Math.imul(R,oe)|0,o=o+Math.imul(R,se)|0,n=n+Math.imul(B,ue)|0,i=(i=i+Math.imul(B,ce)|0)+Math.imul(C,ue)|0,o=o+Math.imul(C,ce)|0,n=n+Math.imul(x,le)|0,i=(i=i+Math.imul(x,he)|0)+Math.imul(I,le)|0,o=o+Math.imul(I,he)|0;var Be=(c+(n=n+Math.imul(k,de)|0)|0)+((8191&(i=(i=i+Math.imul(k,ye)|0)+Math.imul(E,de)|0))<<13)|0;c=((o=o+Math.imul(E,ye)|0)+(i>>>13)|0)+(Be>>>26)|0,Be&=67108863,n=Math.imul(M,re),i=(i=Math.imul(M,ne))+Math.imul(D,re)|0,o=Math.imul(D,ne),n=n+Math.imul(L,oe)|0,i=(i=i+Math.imul(L,se)|0)+Math.imul(K,oe)|0,o=o+Math.imul(K,se)|0,n=n+Math.imul(O,ue)|0,i=(i=i+Math.imul(O,ce)|0)+Math.imul(R,ue)|0,o=o+Math.imul(R,ce)|0,n=n+Math.imul(B,le)|0,i=(i=i+Math.imul(B,he)|0)+Math.imul(C,le)|0,o=o+Math.imul(C,he)|0;var Ce=(c+(n=n+Math.imul(x,de)|0)|0)+((8191&(i=(i=i+Math.imul(x,ye)|0)+Math.imul(I,de)|0))<<13)|0;c=((o=o+Math.imul(I,ye)|0)+(i>>>13)|0)+(Ce>>>26)|0,Ce&=67108863,n=Math.imul(M,oe),i=(i=Math.imul(M,se))+Math.imul(D,oe)|0,o=Math.imul(D,se),n=n+Math.imul(L,ue)|0,i=(i=i+Math.imul(L,ce)|0)+Math.imul(K,ue)|0,o=o+Math.imul(K,ce)|0,n=n+Math.imul(O,le)|0,i=(i=i+Math.imul(O,he)|0)+Math.imul(R,le)|0,o=o+Math.imul(R,he)|0;var Pe=(c+(n=n+Math.imul(B,de)|0)|0)+((8191&(i=(i=i+Math.imul(B,ye)|0)+Math.imul(C,de)|0))<<13)|0;c=((o=o+Math.imul(C,ye)|0)+(i>>>13)|0)+(Pe>>>26)|0,Pe&=67108863,n=Math.imul(M,ue),i=(i=Math.imul(M,ce))+Math.imul(D,ue)|0,o=Math.imul(D,ce),n=n+Math.imul(L,le)|0,i=(i=i+Math.imul(L,he)|0)+Math.imul(K,le)|0,o=o+Math.imul(K,he)|0;var Oe=(c+(n=n+Math.imul(O,de)|0)|0)+((8191&(i=(i=i+Math.imul(O,ye)|0)+Math.imul(R,de)|0))<<13)|0;c=((o=o+Math.imul(R,ye)|0)+(i>>>13)|0)+(Oe>>>26)|0,Oe&=67108863,n=Math.imul(M,le),i=(i=Math.imul(M,he))+Math.imul(D,le)|0,o=Math.imul(D,he);var Re=(c+(n=n+Math.imul(L,de)|0)|0)+((8191&(i=(i=i+Math.imul(L,ye)|0)+Math.imul(K,de)|0))<<13)|0;c=((o=o+Math.imul(K,ye)|0)+(i>>>13)|0)+(Re>>>26)|0,Re&=67108863;var Ne=(c+(n=Math.imul(M,de))|0)+((8191&(i=(i=Math.imul(M,ye))+Math.imul(D,de)|0))<<13)|0;return c=((o=Math.imul(D,ye))+(i>>>13)|0)+(Ne>>>26)|0,Ne&=67108863,u[0]=ge,u[1]=me,u[2]=be,u[3]=ve,u[4]=_e,u[5]=we,u[6]=Se,u[7]=ke,u[8]=Ee,u[9]=Ae,u[10]=xe,u[11]=Ie,u[12]=Te,u[13]=Be,u[14]=Ce,u[15]=Pe,u[16]=Oe,u[17]=Re,u[18]=Ne,0!==c&&(u[19]=c,r.length++),r};function d(e,t,r){return(new y).mulp(e,t,r)}function y(e,t){this.x=e,this.y=t}Math.imul||(p=h),o.prototype.mulTo=function(e,t){var r=this.length+e.length;return 10===this.length&&10===e.length?p(this,e,t):r<63?h(this,e,t):r<1024?function(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])*(0|t.words[c]),h=67108863&l;a=67108863&(h=h+a|0),i+=(s=(s=s+(l/67108864|0)|0)+(h>>>26)|0)>>>26,s&=67108863}r.words[o]=a,n=s,s=i}return 0!==n?r.words[o]=n:r.length--,r.strip()}(this,e,t):d(this,e,t)},y.prototype.makeRBT=function(e){for(var t=new Array(e),r=o.prototype._countBits(e)-1,n=0;n<e;n++)t[n]=this.revBin(n,r,e);return t},y.prototype.revBin=function(e,t,r){if(0===e||e===r-1)return e;for(var n=0,i=0;i<t;i++)n|=(1&e)<<t-i-1,e>>=1;return n},y.prototype.permute=function(e,t,r,n,i,o){for(var s=0;s<o;s++)n[s]=t[e[s]],i[s]=r[e[s]]},y.prototype.transform=function(e,t,r,n,i,o){this.permute(o,e,t,r,n,i);for(var s=1;s<i;s<<=1)for(var a=s<<1,u=Math.cos(2*Math.PI/a),c=Math.sin(2*Math.PI/a),f=0;f<i;f+=a)for(var l=u,h=c,p=0;p<s;p++){var d=r[f+p],y=n[f+p],g=r[f+p+s],m=n[f+p+s],b=l*g-h*m;m=l*m+h*g,g=b,r[f+p]=d+g,n[f+p]=y+m,r[f+p+s]=d-g,n[f+p+s]=y-m,p!==a&&(b=u*l-c*h,h=u*h+c*l,l=b)}},y.prototype.guessLen13b=function(e,t){var r=1|Math.max(t,e),n=1&r,i=0;for(r=r/2|0;r;r>>>=1)i++;return 1<<i+1+n},y.prototype.conjugate=function(e,t,r){if(!(r<=1))for(var n=0;n<r/2;n++){var i=e[n];e[n]=e[r-n-1],e[r-n-1]=i,i=t[n],t[n]=-t[r-n-1],t[r-n-1]=-i}},y.prototype.normalize13b=function(e,t){for(var r=0,n=0;n<t/2;n++){var i=8192*Math.round(e[2*n+1]/t)+Math.round(e[2*n]/t)+r;e[n]=67108863&i,r=i<67108864?0:i/67108864|0}return e},y.prototype.convert13b=function(e,t,r,i){for(var o=0,s=0;s<t;s++)o+=0|e[s],r[2*s]=8191&o,o>>>=13,r[2*s+1]=8191&o,o>>>=13;for(s=2*t;s<i;++s)r[s]=0;n(0===o),n(0==(-8192&o))},y.prototype.stub=function(e){for(var t=new Array(e),r=0;r<e;r++)t[r]=0;return t},y.prototype.mulp=function(e,t,r){var n=2*this.guessLen13b(e.length,t.length),i=this.makeRBT(n),o=this.stub(n),s=new Array(n),a=new Array(n),u=new Array(n),c=new Array(n),f=new Array(n),l=new Array(n),h=r.words;h.length=n,this.convert13b(e.words,e.length,s,n),this.convert13b(t.words,t.length,c,n),this.transform(s,o,a,u,n,i),this.transform(c,o,f,l,n,i);for(var p=0;p<n;p++){var d=a[p]*f[p]-u[p]*l[p];u[p]=a[p]*l[p]+u[p]*f[p],a[p]=d}return this.conjugate(a,u,n),this.transform(a,u,h,o,n,i),this.conjugate(h,o,n),this.normalize13b(h,n),r.negative=e.negative^t.negative,r.length=e.length+t.length,r.strip()},o.prototype.mul=function(e){var t=new o(null);return t.words=new Array(this.length+e.length),this.mulTo(e,t)},o.prototype.mulf=function(e){var t=new o(null);return t.words=new Array(this.length+e.length),d(this,e,t)},o.prototype.imul=function(e){return this.clone().mulTo(e,this)},o.prototype.imuln=function(e){n("number"==typeof e),n(e<67108864);for(var t=0,r=0;r<this.length;r++){var i=(0|this.words[r])*e,o=(67108863&i)+(67108863&t);t>>=26,t+=i/67108864|0,t+=o>>>26,this.words[r]=67108863&o}return 0!==t&&(this.words[r]=t,this.length++),this},o.prototype.muln=function(e){return this.clone().imuln(e)},o.prototype.sqr=function(){return this.mul(this)},o.prototype.isqr=function(){return this.imul(this.clone())},o.prototype.pow=function(e){var t=function(e){for(var t=new Array(e.bitLength()),r=0;r<t.length;r++){var n=r/26|0,i=r%26;t[r]=(e.words[n]&1<<i)>>>i}return t}(e);if(0===t.length)return new o(1);for(var r=this,n=0;n<t.length&&0===t[n];n++,r=r.sqr());if(++n<t.length)for(var i=r.sqr();n<t.length;n++,i=i.sqr())0!==t[n]&&(r=r.mul(i));return r},o.prototype.iushln=function(e){n("number"==typeof e&&e>=0);var t,r=e%26,i=(e-r)/26,o=67108863>>>26-r<<26-r;if(0!==r){var s=0;for(t=0;t<this.length;t++){var a=this.words[t]&o,u=(0|this.words[t])-a<<r;this.words[t]=u|s,s=a>>>26-r}s&&(this.words[t]=s,this.length++)}if(0!==i){for(t=this.length-1;t>=0;t--)this.words[t+i]=this.words[t];for(t=0;t<i;t++)this.words[t]=0;this.length+=i}return this.strip()},o.prototype.ishln=function(e){return n(0===this.negative),this.iushln(e)},o.prototype.iushrn=function(e,t,r){var i;n("number"==typeof e&&e>=0),i=t?(t-t%26)/26:0;var o=e%26,s=Math.min((e-o)/26,this.length),a=67108863^67108863>>>o<<o,u=r;if(i-=s,i=Math.max(0,i),u){for(var c=0;c<s;c++)u.words[c]=this.words[c];u.length=s}if(0===s);else if(this.length>s)for(this.length-=s,c=0;c<this.length;c++)this.words[c]=this.words[c+s];else this.words[0]=0,this.length=1;var f=0;for(c=this.length-1;c>=0&&(0!==f||c>=i);c--){var l=0|this.words[c];this.words[c]=f<<26-o|l>>>o,f=l&a}return u&&0!==f&&(u.words[u.length++]=f),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},o.prototype.ishrn=function(e,t,r){return n(0===this.negative),this.iushrn(e,t,r)},o.prototype.shln=function(e){return this.clone().ishln(e)},o.prototype.ushln=function(e){return this.clone().iushln(e)},o.prototype.shrn=function(e){return this.clone().ishrn(e)},o.prototype.ushrn=function(e){return this.clone().iushrn(e)},o.prototype.testn=function(e){n("number"==typeof e&&e>=0);var t=e%26,r=(e-t)/26,i=1<<t;return!(this.length<=r||!(this.words[r]&i))},o.prototype.imaskn=function(e){n("number"==typeof e&&e>=0);var t=e%26,r=(e-t)/26;if(n(0===this.negative,"imaskn works only with positive numbers"),this.length<=r)return this;if(0!==t&&r++,this.length=Math.min(r,this.length),0!==t){var i=67108863^67108863>>>t<<t;this.words[this.length-1]&=i}return this.strip()},o.prototype.maskn=function(e){return this.clone().imaskn(e)},o.prototype.iaddn=function(e){return n("number"==typeof e),n(e<67108864),e<0?this.isubn(-e):0!==this.negative?1===this.length&&(0|this.words[0])<e?(this.words[0]=e-(0|this.words[0]),this.negative=0,this):(this.negative=0,this.isubn(e),this.negative=1,this):this._iaddn(e)},o.prototype._iaddn=function(e){this.words[0]+=e;for(var t=0;t<this.length&&this.words[t]>=67108864;t++)this.words[t]-=67108864,t===this.length-1?this.words[t+1]=1:this.words[t+1]++;return this.length=Math.max(this.length,t+1),this},o.prototype.isubn=function(e){if(n("number"==typeof e),n(e<67108864),e<0)return this.iaddn(-e);if(0!==this.negative)return this.negative=0,this.iaddn(e),this.negative=1,this;if(this.words[0]-=e,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var t=0;t<this.length&&this.words[t]<0;t++)this.words[t]+=67108864,this.words[t+1]-=1;return this.strip()},o.prototype.addn=function(e){return this.clone().iaddn(e)},o.prototype.subn=function(e){return this.clone().isubn(e)},o.prototype.iabs=function(){return this.negative=0,this},o.prototype.abs=function(){return this.clone().iabs()},o.prototype._ishlnsubmul=function(e,t,r){var i,o,s=e.length+r;this._expand(s);var a=0;for(i=0;i<e.length;i++){o=(0|this.words[i+r])+a;var u=(0|e.words[i])*t;a=((o-=67108863&u)>>26)-(u/67108864|0),this.words[i+r]=67108863&o}for(;i<this.length-r;i++)a=(o=(0|this.words[i+r])+a)>>26,this.words[i+r]=67108863&o;if(0===a)return this.strip();for(n(-1===a),a=0,i=0;i<this.length;i++)a=(o=-(0|this.words[i])+a)>>26,this.words[i]=67108863&o;return this.negative=1,this.strip()},o.prototype._wordDiv=function(e,t){var r=(this.length,e.length),n=this.clone(),i=e,s=0|i.words[i.length-1];0!=(r=26-this._countBits(s))&&(i=i.ushln(r),n.iushln(r),s=0|i.words[i.length-1]);var a,u=n.length-i.length;if("mod"!==t){(a=new o(null)).length=u+1,a.words=new Array(a.length);for(var c=0;c<a.length;c++)a.words[c]=0}var f=n.clone()._ishlnsubmul(i,1,u);0===f.negative&&(n=f,a&&(a.words[u]=1));for(var l=u-1;l>=0;l--){var h=67108864*(0|n.words[i.length+l])+(0|n.words[i.length+l-1]);for(h=Math.min(h/s|0,67108863),n._ishlnsubmul(i,h,l);0!==n.negative;)h--,n.negative=0,n._ishlnsubmul(i,1,l),n.isZero()||(n.negative^=1);a&&(a.words[l]=h)}return a&&a.strip(),n.strip(),"div"!==t&&0!==r&&n.iushrn(r),{div:a||null,mod:n}},o.prototype.divmod=function(e,t,r){return n(!e.isZero()),this.isZero()?{div:new o(0),mod:new o(0)}:0!==this.negative&&0===e.negative?(a=this.neg().divmod(e,t),"mod"!==t&&(i=a.div.neg()),"div"!==t&&(s=a.mod.neg(),r&&0!==s.negative&&s.iadd(e)),{div:i,mod:s}):0===this.negative&&0!==e.negative?(a=this.divmod(e.neg(),t),"mod"!==t&&(i=a.div.neg()),{div:i,mod:a.mod}):0!=(this.negative&e.negative)?(a=this.neg().divmod(e.neg(),t),"div"!==t&&(s=a.mod.neg(),r&&0!==s.negative&&s.isub(e)),{div:a.div,mod:s}):e.length>this.length||this.cmp(e)<0?{div:new o(0),mod:this}:1===e.length?"div"===t?{div:this.divn(e.words[0]),mod:null}:"mod"===t?{div:null,mod:new o(this.modn(e.words[0]))}:{div:this.divn(e.words[0]),mod:new o(this.modn(e.words[0]))}:this._wordDiv(e,t);var i,s,a},o.prototype.div=function(e){return this.divmod(e,"div",!1).div},o.prototype.mod=function(e){return this.divmod(e,"mod",!1).mod},o.prototype.umod=function(e){return this.divmod(e,"mod",!0).mod},o.prototype.divRound=function(e){var t=this.divmod(e);if(t.mod.isZero())return t.div;var r=0!==t.div.negative?t.mod.isub(e):t.mod,n=e.ushrn(1),i=e.andln(1),o=r.cmp(n);return o<0||1===i&&0===o?t.div:0!==t.div.negative?t.div.isubn(1):t.div.iaddn(1)},o.prototype.modn=function(e){n(e<=67108863);for(var t=(1<<26)%e,r=0,i=this.length-1;i>=0;i--)r=(t*r+(0|this.words[i]))%e;return r},o.prototype.idivn=function(e){n(e<=67108863);for(var t=0,r=this.length-1;r>=0;r--){var i=(0|this.words[r])+67108864*t;this.words[r]=i/e|0,t=i%e}return this.strip()},o.prototype.divn=function(e){return this.clone().idivn(e)},o.prototype.egcd=function(e){n(0===e.negative),n(!e.isZero());var t=this,r=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var i=new o(1),s=new o(0),a=new o(0),u=new o(1),c=0;t.isEven()&&r.isEven();)t.iushrn(1),r.iushrn(1),++c;for(var f=r.clone(),l=t.clone();!t.isZero();){for(var h=0,p=1;0==(t.words[0]&p)&&h<26;++h,p<<=1);if(h>0)for(t.iushrn(h);h-- >0;)(i.isOdd()||s.isOdd())&&(i.iadd(f),s.isub(l)),i.iushrn(1),s.iushrn(1);for(var d=0,y=1;0==(r.words[0]&y)&&d<26;++d,y<<=1);if(d>0)for(r.iushrn(d);d-- >0;)(a.isOdd()||u.isOdd())&&(a.iadd(f),u.isub(l)),a.iushrn(1),u.iushrn(1);t.cmp(r)>=0?(t.isub(r),i.isub(a),s.isub(u)):(r.isub(t),a.isub(i),u.isub(s))}return{a:a,b:u,gcd:r.iushln(c)}},o.prototype._invmp=function(e){n(0===e.negative),n(!e.isZero());var t=this,r=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var i,s=new o(1),a=new o(0),u=r.clone();t.cmpn(1)>0&&r.cmpn(1)>0;){for(var c=0,f=1;0==(t.words[0]&f)&&c<26;++c,f<<=1);if(c>0)for(t.iushrn(c);c-- >0;)s.isOdd()&&s.iadd(u),s.iushrn(1);for(var l=0,h=1;0==(r.words[0]&h)&&l<26;++l,h<<=1);if(l>0)for(r.iushrn(l);l-- >0;)a.isOdd()&&a.iadd(u),a.iushrn(1);t.cmp(r)>=0?(t.isub(r),s.isub(a)):(r.isub(t),a.isub(s))}return(i=0===t.cmpn(1)?s:a).cmpn(0)<0&&i.iadd(e),i},o.prototype.gcd=function(e){if(this.isZero())return e.abs();if(e.isZero())return this.abs();var t=this.clone(),r=e.clone();t.negative=0,r.negative=0;for(var n=0;t.isEven()&&r.isEven();n++)t.iushrn(1),r.iushrn(1);for(;;){for(;t.isEven();)t.iushrn(1);for(;r.isEven();)r.iushrn(1);var i=t.cmp(r);if(i<0){var o=t;t=r,r=o}else if(0===i||0===r.cmpn(1))break;t.isub(r)}return r.iushln(n)},o.prototype.invm=function(e){return this.egcd(e).a.umod(e)},o.prototype.isEven=function(){return 0==(1&this.words[0])},o.prototype.isOdd=function(){return 1==(1&this.words[0])},o.prototype.andln=function(e){return this.words[0]&e},o.prototype.bincn=function(e){n("number"==typeof e);var t=e%26,r=(e-t)/26,i=1<<t;if(this.length<=r)return this._expand(r+1),this.words[r]|=i,this;for(var o=i,s=r;0!==o&&s<this.length;s++){var a=0|this.words[s];o=(a+=o)>>>26,a&=67108863,this.words[s]=a}return 0!==o&&(this.words[s]=o,this.length++),this},o.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},o.prototype.cmpn=function(e){var t,r=e<0;if(0!==this.negative&&!r)return-1;if(0===this.negative&&r)return 1;if(this.strip(),this.length>1)t=1;else{r&&(e=-e),n(e<=67108863,"Number is too big");var i=0|this.words[0];t=i===e?0:i<e?-1:1}return 0!==this.negative?0|-t:t},o.prototype.cmp=function(e){if(0!==this.negative&&0===e.negative)return-1;if(0===this.negative&&0!==e.negative)return 1;var t=this.ucmp(e);return 0!==this.negative?0|-t:t},o.prototype.ucmp=function(e){if(this.length>e.length)return 1;if(this.length<e.length)return-1;for(var t=0,r=this.length-1;r>=0;r--){var n=0|this.words[r],i=0|e.words[r];if(n!==i){n<i?t=-1:n>i&&(t=1);break}}return t},o.prototype.gtn=function(e){return 1===this.cmpn(e)},o.prototype.gt=function(e){return 1===this.cmp(e)},o.prototype.gten=function(e){return this.cmpn(e)>=0},o.prototype.gte=function(e){return this.cmp(e)>=0},o.prototype.ltn=function(e){return-1===this.cmpn(e)},o.prototype.lt=function(e){return-1===this.cmp(e)},o.prototype.lten=function(e){return this.cmpn(e)<=0},o.prototype.lte=function(e){return this.cmp(e)<=0},o.prototype.eqn=function(e){return 0===this.cmpn(e)},o.prototype.eq=function(e){return 0===this.cmp(e)},o.red=function(e){return new S(e)},o.prototype.toRed=function(e){return n(!this.red,"Already a number in reduction context"),n(0===this.negative,"red works only with positives"),e.convertTo(this)._forceRed(e)},o.prototype.fromRed=function(){return n(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},o.prototype._forceRed=function(e){return this.red=e,this},o.prototype.forceRed=function(e){return n(!this.red,"Already a number in reduction context"),this._forceRed(e)},o.prototype.redAdd=function(e){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,e)},o.prototype.redIAdd=function(e){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,e)},o.prototype.redSub=function(e){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,e)},o.prototype.redISub=function(e){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,e)},o.prototype.redShl=function(e){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,e)},o.prototype.redMul=function(e){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.mul(this,e)},o.prototype.redIMul=function(e){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.imul(this,e)},o.prototype.redSqr=function(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},o.prototype.redISqr=function(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},o.prototype.redSqrt=function(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},o.prototype.redInvm=function(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},o.prototype.redNeg=function(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},o.prototype.redPow=function(e){return n(this.red&&!e.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,e)};var g={k256:null,p224:null,p192:null,p25519:null};function m(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 b(){m.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function v(){m.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function _(){m.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function w(){m.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function S(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 k(e){S.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)}m.prototype._tmp=function(){var e=new o(null);return e.words=new Array(Math.ceil(this.n/13)),e},m.prototype.ireduce=function(e){var t,r=e;do{this.split(r,this.tmp),t=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(t>this.n);var n=t<this.n?-1:r.ucmp(this.p);return 0===n?(r.words[0]=0,r.length=1):n>0?r.isub(this.p):r.strip(),r},m.prototype.split=function(e,t){e.iushrn(this.n,0,t)},m.prototype.imulK=function(e){return e.imul(this.k)},i(b,m),b.prototype.split=function(e,t){for(var r=4194303,n=Math.min(e.length,9),i=0;i<n;i++)t.words[i]=e.words[i];if(t.length=n,e.length<=9)return e.words[0]=0,void(e.length=1);var o=e.words[9];for(t.words[t.length++]=o&r,i=10;i<e.length;i++){var s=0|e.words[i];e.words[i-10]=(s&r)<<4|o>>>22,o=s}o>>>=22,e.words[i-10]=o,0===o&&e.length>10?e.length-=10:e.length-=9},b.prototype.imulK=function(e){e.words[e.length]=0,e.words[e.length+1]=0,e.length+=2;for(var t=0,r=0;r<e.length;r++){var n=0|e.words[r];t+=977*n,e.words[r]=67108863&t,t=64*n+(t/67108864|0)}return 0===e.words[e.length-1]&&(e.length--,0===e.words[e.length-1]&&e.length--),e},i(v,m),i(_,m),i(w,m),w.prototype.imulK=function(e){for(var t=0,r=0;r<e.length;r++){var n=19*(0|e.words[r])+t,i=67108863&n;n>>>=26,e.words[r]=i,t=n}return 0!==t&&(e.words[e.length++]=t),e},o._prime=function(e){if(g[e])return g[e];var t;if("k256"===e)t=new b;else if("p224"===e)t=new v;else if("p192"===e)t=new _;else{if("p25519"!==e)throw new Error("Unknown prime "+e);t=new w}return g[e]=t,t},S.prototype._verify1=function(e){n(0===e.negative,"red works only with positives"),n(e.red,"red works only with red numbers")},S.prototype._verify2=function(e,t){n(0==(e.negative|t.negative),"red works only with positives"),n(e.red&&e.red===t.red,"red works only with red numbers")},S.prototype.imod=function(e){return this.prime?this.prime.ireduce(e)._forceRed(this):e.umod(this.m)._forceRed(this)},S.prototype.neg=function(e){return e.isZero()?e.clone():this.m.sub(e)._forceRed(this)},S.prototype.add=function(e,t){this._verify2(e,t);var r=e.add(t);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},S.prototype.iadd=function(e,t){this._verify2(e,t);var r=e.iadd(t);return r.cmp(this.m)>=0&&r.isub(this.m),r},S.prototype.sub=function(e,t){this._verify2(e,t);var r=e.sub(t);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},S.prototype.isub=function(e,t){this._verify2(e,t);var r=e.isub(t);return r.cmpn(0)<0&&r.iadd(this.m),r},S.prototype.shl=function(e,t){return this._verify1(e),this.imod(e.ushln(t))},S.prototype.imul=function(e,t){return this._verify2(e,t),this.imod(e.imul(t))},S.prototype.mul=function(e,t){return this._verify2(e,t),this.imod(e.mul(t))},S.prototype.isqr=function(e){return this.imul(e,e.clone())},S.prototype.sqr=function(e){return this.mul(e,e)},S.prototype.sqrt=function(e){if(e.isZero())return e.clone();var t=this.m.andln(3);if(n(t%2==1),3===t){var r=this.m.add(new o(1)).iushrn(2);return this.pow(e,r)}for(var i=this.m.subn(1),s=0;!i.isZero()&&0===i.andln(1);)s++,i.iushrn(1);n(!i.isZero());var a=new o(1).toRed(this),u=a.redNeg(),c=this.m.subn(1).iushrn(1),f=this.m.bitLength();for(f=new o(2*f*f).toRed(this);0!==this.pow(f,c).cmp(u);)f.redIAdd(u);for(var l=this.pow(f,i),h=this.pow(e,i.addn(1).iushrn(1)),p=this.pow(e,i),d=s;0!==p.cmp(a);){for(var y=p,g=0;0!==y.cmp(a);g++)y=y.redSqr();n(g<d);var m=this.pow(l,new o(1).iushln(d-g-1));h=h.redMul(m),l=m.redSqr(),p=p.redMul(l),d=g}return h},S.prototype.invm=function(e){var t=e._invmp(this.m);return 0!==t.negative?(t.negative=0,this.imod(t).redNeg()):this.imod(t)},S.prototype.pow=function(e,t){if(t.isZero())return new o(1).toRed(this);if(0===t.cmpn(1))return e.clone();var r=new Array(16);r[0]=new o(1).toRed(this),r[1]=e;for(var n=2;n<r.length;n++)r[n]=this.mul(r[n-1],e);var i=r[0],s=0,a=0,u=t.bitLength()%26;for(0===u&&(u=26),n=t.length-1;n>=0;n--){for(var c=t.words[n],f=u-1;f>=0;f--){var l=c>>f&1;i!==r[0]&&(i=this.sqr(i)),0!==l||0!==s?(s<<=1,s|=l,(4==++a||0===n&&0===f)&&(i=this.mul(i,r[s]),a=0,s=0)):a=0}u=26}return i},S.prototype.convertTo=function(e){var t=e.umod(this.m);return t===e?t.clone():t},S.prototype.convertFrom=function(e){var t=e.clone();return t.red=null,t},o.mont=function(e){return new k(e)},i(k,S),k.prototype.convertTo=function(e){return this.imod(e.ushln(this.shift))},k.prototype.convertFrom=function(e){var t=this.imod(e.mul(this.rinv));return t.red=null,t},k.prototype.imul=function(e,t){if(e.isZero()||t.isZero())return e.words[0]=0,e.length=1,e;var r=e.imul(t),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=r.isub(n).iushrn(this.shift),o=i;return i.cmp(this.m)>=0?o=i.isub(this.m):i.cmpn(0)<0&&(o=i.iadd(this.m)),o._forceRed(this)},k.prototype.mul=function(e,t){if(e.isZero()||t.isZero())return new o(0)._forceRed(this);var r=e.mul(t),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=r.isub(n).iushrn(this.shift),s=i;return i.cmp(this.m)>=0?s=i.isub(this.m):i.cmpn(0)<0&&(s=i.iadd(this.m)),s._forceRed(this)},k.prototype.invm=function(e){return this.imod(e._invmp(this.m).mul(this.r2))._forceRed(this)}}(void 0===e||e,this)}).call(this,r(27)(e))},function(e,t,r){"use strict";var n=t;n.version=r(829).version,n.utils=r(830),n.rand=r(831),n.curve=r(174),n.curves=r(837),n.ec=r(845),n.eddsa=r(849)},function(e,t,r){"use strict";(function(t){var n=r(24),i=r(17),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)).writeUInt8(e,0):e<65536?((r=new t(3)).writeUInt8(253,0),r.writeUInt16LE(e,1)):e<4294967296?((r=new t(5)).writeUInt8(254,0),r.writeUInt32LE(e,1)):((r=new t(9)).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)).writeUInt8(n,0);else if(n<65536)(r=new t(3)).writeUInt8(253,0),r.writeUInt16LE(n,1);else if(n<4294967296)(r=new t(5)).writeUInt8(254,0),r.writeUInt32LE(n,1);else{var i=new o;i.writeUInt8(255),i.writeUInt64LEBN(e);r=i.concat()}return r},e.exports=o}).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){"use strict";if("function"!=typeof Promise)throw"Promise support required";var t=e.crypto||e.msCrypto;if(t){var r=t.subtle||t.webkitSubtle;if(r){var n=e.Crypto||t.constructor||Object,i=e.SubtleCrypto||r.constructor||Object,o=(e.CryptoKey||e.Key||Object,e.navigator.userAgent.indexOf("Edge/")>-1),s=!!e.msCrypto&&!o,a=!t.subtle&&!!t.webkitSubtle;if(s||a){var u={KoZIhvcNAQEB:"1.2.840.113549.1.1.1"},c={"1.2.840.113549.1.1.1":"KoZIhvcNAQEB"};if(["generateKey","importKey","unwrapKey"].forEach(function(e){var n=r[e];r[e]=function(i,o,u){var c,f,l,d,v=[].slice.call(arguments);switch(e){case"generateKey":c=y(i),f=o,l=u;break;case"importKey":c=y(u),f=v[3],l=v[4],"jwk"===i&&((o=m(o)).alg||(o.alg=g(c)),o.key_ops||(o.key_ops="oct"!==o.kty?"d"in o?l.filter(k):l.filter(S):l.slice()),v[1]=function(e){var t=m(e);return s&&(t.extractable=t.ext,delete t.ext),p(unescape(encodeURIComponent(JSON.stringify(t)))).buffer}(o));break;case"unwrapKey":c=v[4],f=v[5],l=v[6],v[2]=u._key}if("generateKey"===e&&"HMAC"===c.name&&c.hash)return c.length=c.length||{"SHA-1":512,"SHA-256":512,"SHA-384":1024,"SHA-512":1024}[c.hash.name],r.importKey("raw",t.getRandomValues(new Uint8Array(c.length+7>>3)),c,f,l);if(a&&"generateKey"===e&&"RSASSA-PKCS1-v1_5"===c.name&&(!c.modulusLength||c.modulusLength>=2048))return(i=y(i)).name="RSAES-PKCS1-v1_5",delete i.hash,r.generateKey(i,!0,["encrypt","decrypt"]).then(function(e){return Promise.all([r.exportKey("jwk",e.publicKey),r.exportKey("jwk",e.privateKey)])}).then(function(e){return e[0].alg=e[1].alg=g(c),e[0].key_ops=l.filter(S),e[1].key_ops=l.filter(k),Promise.all([r.importKey("jwk",e[0],c,!0,e[0].key_ops),r.importKey("jwk",e[1],c,f,e[1].key_ops)])}).then(function(e){return{publicKey:e[0],privateKey:e[1]}});if((a||s&&"SHA-1"===(c.hash||{}).name)&&"importKey"===e&&"jwk"===i&&"HMAC"===c.name&&"oct"===o.kty)return r.importKey("raw",p(h(o.k)),u,v[3],v[4]);if(a&&"importKey"===e&&("spki"===i||"pkcs8"===i))return r.importKey("jwk",b(o),u,v[3],v[4]);if(s&&"unwrapKey"===e)return r.decrypt(v[3],u,o).then(function(e){return r.importKey(i,e,v[4],v[5],v[6])});try{d=n.apply(r,v)}catch(e){return Promise.reject(e)}return s&&(d=new Promise(function(e,t){d.onabort=d.onerror=function(e){t(e)},d.oncomplete=function(t){e(t.target.result)}})),d=d.then(function(e){return"HMAC"===c.name&&(c.length||(c.length=8*e.algorithm.length)),0==c.name.search("RSA")&&(c.modulusLength||(c.modulusLength=(e.publicKey||e).algorithm.modulusLength),c.publicExponent||(c.publicExponent=(e.publicKey||e).algorithm.publicExponent)),e.publicKey&&e.privateKey?{publicKey:new w(e.publicKey,c,f,l.filter(S)),privateKey:new w(e.privateKey,c,f,l.filter(k))}:new w(e,c,f,l)})}}),["exportKey","wrapKey"].forEach(function(e){var t=r[e];r[e]=function(n,i,o){var u,c=[].slice.call(arguments);switch(e){case"exportKey":c[1]=i._key;break;case"wrapKey":c[1]=i._key,c[2]=o._key}if((a||s&&"SHA-1"===(i.algorithm.hash||{}).name)&&"exportKey"===e&&"jwk"===n&&"HMAC"===i.algorithm.name&&(c[0]="raw"),!a||"exportKey"!==e||"spki"!==n&&"pkcs8"!==n||(c[0]="jwk"),s&&"wrapKey"===e)return r.exportKey(n,i).then(function(e){return"jwk"===n&&(e=p(unescape(encodeURIComponent(JSON.stringify(m(e)))))),r.encrypt(c[3],o,e)});try{u=t.apply(r,c)}catch(e){return Promise.reject(e)}return s&&(u=new Promise(function(e,t){u.onabort=u.onerror=function(e){t(e)},u.oncomplete=function(t){e(t.target.result)}})),"exportKey"===e&&"jwk"===n&&(u=u.then(function(e){return(a||s&&"SHA-1"===(i.algorithm.hash||{}).name)&&"HMAC"===i.algorithm.name?{kty:"oct",alg:g(i.algorithm),key_ops:i.usages.slice(),ext:!0,k:l(d(e))}:((e=m(e)).alg||(e.alg=g(i.algorithm)),e.key_ops||(e.key_ops="public"===i.type?i.usages.filter(S):"private"===i.type?i.usages.filter(k):i.usages.slice()),e)})),!a||"exportKey"!==e||"spki"!==n&&"pkcs8"!==n||(u=u.then(function(e){return function(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]=p(h(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(_(t)).buffer),n?r.unshift(new Uint8Array([0])):r[1]={tag:3,value:r[1]},new Uint8Array(_(r)).buffer}(m(e))})),u}}),["encrypt","decrypt","sign","verify"].forEach(function(e){var t=r[e];r[e]=function(n,i,o,a){if(s&&(!o.byteLength||a&&!a.byteLength))throw new Error("Empy input is not allowed");var u,c=[].slice.call(arguments),f=y(n);if(s&&"decrypt"===e&&"AES-GCM"===f.name){var l=n.tagLength>>3;c[2]=(o.buffer||o).slice(0,o.byteLength-l),n.tag=(o.buffer||o).slice(o.byteLength-l)}c[1]=i._key;try{u=t.apply(r,c)}catch(e){return Promise.reject(e)}return s&&(u=new Promise(function(t,r){u.onabort=u.onerror=function(e){r(e)},u.oncomplete=function(r){r=r.target.result;if("encrypt"===e&&r instanceof AesGcmEncryptResult){var n=r.ciphertext,i=r.tag;(r=new Uint8Array(n.byteLength+i.byteLength)).set(new Uint8Array(n),0),r.set(new Uint8Array(i),n.byteLength),r=r.buffer}t(r)}})),u}}),s){var f=r.digest;r.digest=function(e,t){if(!t.byteLength)throw new Error("Empy input is not allowed");var n;try{n=f.call(r,e,t)}catch(e){return Promise.reject(e)}return n=new Promise(function(e,t){n.onabort=n.onerror=function(e){t(e)},n.oncomplete=function(t){e(t.target.result)}})},e.crypto=Object.create(t,{getRandomValues:{value:function(e){return t.getRandomValues(e)}},subtle:{value:r}}),e.CryptoKey=w}a&&(t.subtle=r,e.Crypto=n,e.SubtleCrypto=i,e.CryptoKey=w)}}}function l(e){return btoa(e).replace(/\=+$/,"").replace(/\+/g,"-").replace(/\//g,"_")}function h(e){return e=(e+="===").slice(0,-e.length%4),atob(e.replace(/-/g,"+").replace(/_/g,"/"))}function p(e){for(var t=new Uint8Array(e.length),r=0;r<e.length;r++)t[r]=e.charCodeAt(r);return t}function d(e){return e instanceof ArrayBuffer&&(e=new Uint8Array(e)),String.fromCharCode.apply(String,e)}function y(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=y(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=y(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 g(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 m(e){(e instanceof ArrayBuffer||e instanceof Uint8Array)&&(e=JSON.parse(decodeURIComponent(escape(d(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 b(e){var t=v(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=v(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]]=l(d(o[s]));n.kty="RSA";break;default:throw new TypeError("Unsupported key type")}return n}function v(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,n=e[t.pos++],i=e[t.pos++];if(i>=128){if(i&=127,t.end-t.pos<i)throw new RangeError("Malformed DER");for(var o=0;i--;)o<<=8,o|=e[t.pos++];i=o}if(t.end-t.pos<i)throw new RangeError("Malformed DER");switch(n){case 2:r=e.subarray(t.pos,t.pos+=i);break;case 3:if(e[t.pos++])throw new Error("Unsupported bit string");i--;case 4:r=new Uint8Array(e.subarray(t.pos,t.pos+=i)).buffer;break;case 5:r=null;break;case 6:var s=btoa(d(e.subarray(t.pos,t.pos+=i)));if(!(s in u))throw new Error("Unsupported OBJECT ID "+s);r=u[s];break;case 48:r=[];for(var a=t.pos+i;t.pos<a;)r.push(v(e,t));break;default:throw new Error("Unsupported DER tag 0x"+n.toString(16))}return r}function _(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(o=0;o<n;o++)t.push(e[o])}else if(null===e)r=5,n=0;else if("string"==typeof e&&e in c){var s=p(atob(c[e]));r=6,n=s.length;for(o=0;o<n;o++)t.push(s[o])}else if(e instanceof Array){for(o=0;o<e.length;o++)_(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);r=3,n=(e=new Uint8Array(e.value)).byteLength,t.push(0);for(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 w(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 S(e){return"verify"===e||"encrypt"===e||"wrapKey"===e}function k(e){return"sign"===e||"decrypt"===e||"unwrapKey"===e}}},function(e,t,r){var n=r(906),i=r(914),o=r(442);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=function(){return Object.keys(o)}},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){!function(e,t,r,n){for(var i,o=255&n[0]|(255&n[1])<<8|(255&n[2])<<16|(255&n[3])<<24,s=255&r[0]|(255&r[1])<<8|(255&r[2])<<16|(255&r[3])<<24,a=255&r[4]|(255&r[5])<<8|(255&r[6])<<16|(255&r[7])<<24,u=255&r[8]|(255&r[9])<<8|(255&r[10])<<16|(255&r[11])<<24,c=255&r[12]|(255&r[13])<<8|(255&r[14])<<16|(255&r[15])<<24,f=255&n[4]|(255&n[5])<<8|(255&n[6])<<16|(255&n[7])<<24,l=255&t[0]|(255&t[1])<<8|(255&t[2])<<16|(255&t[3])<<24,h=255&t[4]|(255&t[5])<<8|(255&t[6])<<16|(255&t[7])<<24,p=255&t[8]|(255&t[9])<<8|(255&t[10])<<16|(255&t[11])<<24,d=255&t[12]|(255&t[13])<<8|(255&t[14])<<16|(255&t[15])<<24,y=255&n[8]|(255&n[9])<<8|(255&n[10])<<16|(255&n[11])<<24,g=255&r[16]|(255&r[17])<<8|(255&r[18])<<16|(255&r[19])<<24,m=255&r[20]|(255&r[21])<<8|(255&r[22])<<16|(255&r[23])<<24,b=255&r[24]|(255&r[25])<<8|(255&r[26])<<16|(255&r[27])<<24,v=255&r[28]|(255&r[29])<<8|(255&r[30])<<16|(255&r[31])<<24,_=255&n[12]|(255&n[13])<<8|(255&n[14])<<16|(255&n[15])<<24,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,K=_,j=0;j<20;j+=2)w^=(i=(R^=(i=(B^=(i=(A^=(i=w+R|0)<<7|i>>>25)+w|0)<<9|i>>>23)+A|0)<<13|i>>>19)+B|0)<<18|i>>>14,x^=(i=(S^=(i=(N^=(i=(C^=(i=x+S|0)<<7|i>>>25)+x|0)<<9|i>>>23)+C|0)<<13|i>>>19)+N|0)<<18|i>>>14,P^=(i=(I^=(i=(k^=(i=(L^=(i=P+I|0)<<7|i>>>25)+P|0)<<9|i>>>23)+L|0)<<13|i>>>19)+k|0)<<18|i>>>14,K^=(i=(O^=(i=(T^=(i=(E^=(i=K+O|0)<<7|i>>>25)+K|0)<<9|i>>>23)+E|0)<<13|i>>>19)+T|0)<<18|i>>>14,w^=(i=(E^=(i=(k^=(i=(S^=(i=w+E|0)<<7|i>>>25)+w|0)<<9|i>>>23)+S|0)<<13|i>>>19)+k|0)<<18|i>>>14,x^=(i=(A^=(i=(T^=(i=(I^=(i=x+A|0)<<7|i>>>25)+x|0)<<9|i>>>23)+I|0)<<13|i>>>19)+T|0)<<18|i>>>14,P^=(i=(C^=(i=(B^=(i=(O^=(i=P+C|0)<<7|i>>>25)+P|0)<<9|i>>>23)+O|0)<<13|i>>>19)+B|0)<<18|i>>>14,K^=(i=(L^=(i=(N^=(i=(R^=(i=K+L|0)<<7|i>>>25)+K|0)<<9|i>>>23)+R|0)<<13|i>>>19)+N|0)<<18|i>>>14;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,K=K+_|0,e[0]=w>>>0&255,e[1]=w>>>8&255,e[2]=w>>>16&255,e[3]=w>>>24&255,e[4]=S>>>0&255,e[5]=S>>>8&255,e[6]=S>>>16&255,e[7]=S>>>24&255,e[8]=k>>>0&255,e[9]=k>>>8&255,e[10]=k>>>16&255,e[11]=k>>>24&255,e[12]=E>>>0&255,e[13]=E>>>8&255,e[14]=E>>>16&255,e[15]=E>>>24&255,e[16]=A>>>0&255,e[17]=A>>>8&255,e[18]=A>>>16&255,e[19]=A>>>24&255,e[20]=x>>>0&255,e[21]=x>>>8&255,e[22]=x>>>16&255,e[23]=x>>>24&255,e[24]=I>>>0&255,e[25]=I>>>8&255,e[26]=I>>>16&255,e[27]=I>>>24&255,e[28]=T>>>0&255,e[29]=T>>>8&255,e[30]=T>>>16&255,e[31]=T>>>24&255,e[32]=B>>>0&255,e[33]=B>>>8&255,e[34]=B>>>16&255,e[35]=B>>>24&255,e[36]=C>>>0&255,e[37]=C>>>8&255,e[38]=C>>>16&255,e[39]=C>>>24&255,e[40]=P>>>0&255,e[41]=P>>>8&255,e[42]=P>>>16&255,e[43]=P>>>24&255,e[44]=O>>>0&255,e[45]=O>>>8&255,e[46]=O>>>16&255,e[47]=O>>>24&255,e[48]=R>>>0&255,e[49]=R>>>8&255,e[50]=R>>>16&255,e[51]=R>>>24&255,e[52]=N>>>0&255,e[53]=N>>>8&255,e[54]=N>>>16&255,e[55]=N>>>24&255,e[56]=L>>>0&255,e[57]=L>>>8&255,e[58]=L>>>16&255,e[59]=L>>>24&255,e[60]=K>>>0&255,e[61]=K>>>8&255,e[62]=K>>>16&255,e[63]=K>>>24&255}(e,t,r,n)}function v(e,t,r,n){!function(e,t,r,n){for(var i,o=255&n[0]|(255&n[1])<<8|(255&n[2])<<16|(255&n[3])<<24,s=255&r[0]|(255&r[1])<<8|(255&r[2])<<16|(255&r[3])<<24,a=255&r[4]|(255&r[5])<<8|(255&r[6])<<16|(255&r[7])<<24,u=255&r[8]|(255&r[9])<<8|(255&r[10])<<16|(255&r[11])<<24,c=255&r[12]|(255&r[13])<<8|(255&r[14])<<16|(255&r[15])<<24,f=255&n[4]|(255&n[5])<<8|(255&n[6])<<16|(255&n[7])<<24,l=255&t[0]|(255&t[1])<<8|(255&t[2])<<16|(255&t[3])<<24,h=255&t[4]|(255&t[5])<<8|(255&t[6])<<16|(255&t[7])<<24,p=255&t[8]|(255&t[9])<<8|(255&t[10])<<16|(255&t[11])<<24,d=255&t[12]|(255&t[13])<<8|(255&t[14])<<16|(255&t[15])<<24,y=255&n[8]|(255&n[9])<<8|(255&n[10])<<16|(255&n[11])<<24,g=255&r[16]|(255&r[17])<<8|(255&r[18])<<16|(255&r[19])<<24,m=255&r[20]|(255&r[21])<<8|(255&r[22])<<16|(255&r[23])<<24,b=255&r[24]|(255&r[25])<<8|(255&r[26])<<16|(255&r[27])<<24,v=255&r[28]|(255&r[29])<<8|(255&r[30])<<16|(255&r[31])<<24,_=255&n[12]|(255&n[13])<<8|(255&n[14])<<16|(255&n[15])<<24,w=0;w<20;w+=2)o^=(i=(m^=(i=(p^=(i=(c^=(i=o+m|0)<<7|i>>>25)+o|0)<<9|i>>>23)+c|0)<<13|i>>>19)+p|0)<<18|i>>>14,f^=(i=(s^=(i=(b^=(i=(d^=(i=f+s|0)<<7|i>>>25)+f|0)<<9|i>>>23)+d|0)<<13|i>>>19)+b|0)<<18|i>>>14,y^=(i=(l^=(i=(a^=(i=(v^=(i=y+l|0)<<7|i>>>25)+y|0)<<9|i>>>23)+v|0)<<13|i>>>19)+a|0)<<18|i>>>14,_^=(i=(g^=(i=(h^=(i=(u^=(i=_+g|0)<<7|i>>>25)+_|0)<<9|i>>>23)+u|0)<<13|i>>>19)+h|0)<<18|i>>>14,o^=(i=(u^=(i=(a^=(i=(s^=(i=o+u|0)<<7|i>>>25)+o|0)<<9|i>>>23)+s|0)<<13|i>>>19)+a|0)<<18|i>>>14,f^=(i=(c^=(i=(h^=(i=(l^=(i=f+c|0)<<7|i>>>25)+f|0)<<9|i>>>23)+l|0)<<13|i>>>19)+h|0)<<18|i>>>14,y^=(i=(d^=(i=(p^=(i=(g^=(i=y+d|0)<<7|i>>>25)+y|0)<<9|i>>>23)+g|0)<<13|i>>>19)+p|0)<<18|i>>>14,_^=(i=(v^=(i=(b^=(i=(m^=(i=_+v|0)<<7|i>>>25)+_|0)<<9|i>>>23)+m|0)<<13|i>>>19)+b|0)<<18|i>>>14;e[0]=o>>>0&255,e[1]=o>>>8&255,e[2]=o>>>16&255,e[3]=o>>>24&255,e[4]=f>>>0&255,e[5]=f>>>8&255,e[6]=f>>>16&255,e[7]=f>>>24&255,e[8]=y>>>0&255,e[9]=y>>>8&255,e[10]=y>>>16&255,e[11]=y>>>24&255,e[12]=_>>>0&255,e[13]=_>>>8&255,e[14]=_>>>16&255,e[15]=_>>>24&255,e[16]=l>>>0&255,e[17]=l>>>8&255,e[18]=l>>>16&255,e[19]=l>>>24&255,e[20]=h>>>0&255,e[21]=h>>>8&255,e[22]=h>>>16&255,e[23]=h>>>24&255,e[24]=p>>>0&255,e[25]=p>>>8&255,e[26]=p>>>16&255,e[27]=p>>>24&255,e[28]=d>>>0&255,e[29]=d>>>8&255,e[30]=d>>>16&255,e[31]=d>>>24&255}(e,t,r,n)}var _=new Uint8Array([101,120,112,97,110,100,32,51,50,45,98,121,116,101,32,107]);function w(e,t,r,n,i,o,s){var a,u,c=new Uint8Array(16),f=new Uint8Array(64);for(u=0;u<16;u++)c[u]=0;for(u=0;u<8;u++)c[u]=o[u];for(;i>=64;){for(b(f,c,s,_),u=0;u<64;u++)e[t+u]=r[n+u]^f[u];for(a=1,u=8;u<16;u++)a=a+(255&c[u])|0,c[u]=255&a,a>>>=8;i-=64,t+=64,n+=64}if(i>0)for(b(f,c,s,_),u=0;u<i;u++)e[t+u]=r[n+u]^f[u];return 0}function S(e,t,r,n,i){var o,s,a=new Uint8Array(16),u=new Uint8Array(64);for(s=0;s<16;s++)a[s]=0;for(s=0;s<8;s++)a[s]=n[s];for(;r>=64;){for(b(u,a,i,_),s=0;s<64;s++)e[t+s]=u[s];for(o=1,s=8;s<16;s++)o=o+(255&a[s])|0,a[s]=255&o,o>>>=8;r-=64,t+=64}if(r>0)for(b(u,a,i,_),s=0;s<r;s++)e[t+s]=u[s];return 0}function k(e,t,r,n,i){var o=new Uint8Array(32);v(o,n,i,_);for(var s=new Uint8Array(8),a=0;a<8;a++)s[a]=n[a+16];return S(e,t,r,s,o)}function E(e,t,r,n,i,o,s){var a=new Uint8Array(32);v(a,o,s,_);for(var u=new Uint8Array(8),c=0;c<8;c++)u[c]=o[c+16];return w(e,t,r,n,i,u,a)}var A=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 x(e,t,r,n,i,o){var s=new A(o);return s.update(r,n,i),s.finish(e,t),0}function I(e,t,r,n,i,o){var s=new Uint8Array(16);return x(s,0,r,n,i,o),g(e,t,s,0)}function T(e,t,r,n,i){var o;if(r<32)return-1;for(E(e,0,t,0,r,n,i),x(e,16,e,32,r-32,e),o=0;o<16;o++)e[o]=0;return 0}function B(e,t,r,n,i){var o,s=new Uint8Array(32);if(r<32)return-1;if(k(s,0,32,n,i),0!==I(t,16,t,32,r-32,s))return-1;for(E(e,0,t,0,r,n,i),o=0;o<32;o++)e[o]=0;return 0}function C(e,t){var r;for(r=0;r<16;r++)e[r]=0|t[r]}function P(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 O(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 R(e,r){var n,i,o,s=t(),a=t();for(n=0;n<16;n++)a[n]=r[n];for(P(a),P(a),P(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,O(a,s,1-o)}for(n=0;n<16;n++)e[2*n]=255&a[n],e[2*n+1]=a[n]>>8}function N(e,t){var r=new Uint8Array(32),n=new Uint8Array(32);return R(r,e),R(n,t),m(r,0,n,0)}function L(e){var t=new Uint8Array(32);return R(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 j(e,t,r){for(var n=0;n<16;n++)e[n]=t[n]+r[n]}function M(e,t,r){for(var n=0;n<16;n++)e[n]=t[n]-r[n]}function D(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,K=r[0],j=r[1],M=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];o+=(n=t[0])*K,s+=n*j,a+=n*M,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,s+=(n=t[1])*K,a+=n*j,u+=n*M,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,a+=(n=t[2])*K,u+=n*j,c+=n*M,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,u+=(n=t[3])*K,c+=n*j,f+=n*M,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,c+=(n=t[4])*K,f+=n*j,l+=n*M,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,f+=(n=t[5])*K,l+=n*j,h+=n*M,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,l+=(n=t[6])*K,h+=n*j,p+=n*M,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,h+=(n=t[7])*K,p+=n*j,d+=n*M,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,p+=(n=t[8])*K,d+=n*j,y+=n*M,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,d+=(n=t[9])*K,y+=n*j,g+=n*M,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,y+=(n=t[10])*K,g+=n*j,m+=n*M,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,g+=(n=t[11])*K,m+=n*j,b+=n*M,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,m+=(n=t[12])*K,b+=n*j,v+=n*M,_+=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,b+=(n=t[13])*K,v+=n*j,_+=n*M,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,v+=(n=t[14])*K,_+=n*j,w+=n*M,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])*K,s+=38*(S+=n*M),a+=38*(k+=n*D),u+=38*(E+=n*U),c+=38*(A+=n*F),f+=38*(x+=n*q),l+=38*(I+=n*H),h+=38*(T+=n*z),p+=38*(B+=n*V),d+=38*(C+=n*G),y+=38*(P+=n*W),g+=38*(O+=n*$),m+=38*(R+=n*Y),b+=38*(N+=n*J),v+=38*(L+=n*X),o=(n=(o+=38*(w+=n*j))+(i=1)+65535)-65536*(i=Math.floor(n/65536)),s=(n=s+i+65535)-65536*(i=Math.floor(n/65536)),a=(n=a+i+65535)-65536*(i=Math.floor(n/65536)),u=(n=u+i+65535)-65536*(i=Math.floor(n/65536)),c=(n=c+i+65535)-65536*(i=Math.floor(n/65536)),f=(n=f+i+65535)-65536*(i=Math.floor(n/65536)),l=(n=l+i+65535)-65536*(i=Math.floor(n/65536)),h=(n=h+i+65535)-65536*(i=Math.floor(n/65536)),p=(n=p+i+65535)-65536*(i=Math.floor(n/65536)),d=(n=d+i+65535)-65536*(i=Math.floor(n/65536)),y=(n=y+i+65535)-65536*(i=Math.floor(n/65536)),g=(n=g+i+65535)-65536*(i=Math.floor(n/65536)),m=(n=m+i+65535)-65536*(i=Math.floor(n/65536)),b=(n=b+i+65535)-65536*(i=Math.floor(n/65536)),v=(n=v+i+65535)-65536*(i=Math.floor(n/65536)),_=(n=_+i+65535)-65536*(i=Math.floor(n/65536)),o=(n=(o+=i-1+37*(i-1))+(i=1)+65535)-65536*(i=Math.floor(n/65536)),s=(n=s+i+65535)-65536*(i=Math.floor(n/65536)),a=(n=a+i+65535)-65536*(i=Math.floor(n/65536)),u=(n=u+i+65535)-65536*(i=Math.floor(n/65536)),c=(n=c+i+65535)-65536*(i=Math.floor(n/65536)),f=(n=f+i+65535)-65536*(i=Math.floor(n/65536)),l=(n=l+i+65535)-65536*(i=Math.floor(n/65536)),h=(n=h+i+65535)-65536*(i=Math.floor(n/65536)),p=(n=p+i+65535)-65536*(i=Math.floor(n/65536)),d=(n=d+i+65535)-65536*(i=Math.floor(n/65536)),y=(n=y+i+65535)-65536*(i=Math.floor(n/65536)),g=(n=g+i+65535)-65536*(i=Math.floor(n/65536)),m=(n=m+i+65535)-65536*(i=Math.floor(n/65536)),b=(n=b+i+65535)-65536*(i=Math.floor(n/65536)),v=(n=v+i+65535)-65536*(i=Math.floor(n/65536)),_=(n=_+i+65535)-65536*(i=Math.floor(n/65536)),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 U(e,t){D(e,t,t)}function F(e,r){var n,i=t();for(n=0;n<16;n++)i[n]=r[n];for(n=253;n>=0;n--)U(i,i),2!==n&&4!==n&&D(i,i,r);for(n=0;n<16;n++)e[n]=i[n]}function q(e,r,n){var i,o,s=new Uint8Array(32),a=new Float64Array(80),c=t(),f=t(),l=t(),h=t(),p=t(),d=t();for(o=0;o<31;o++)s[o]=r[o];for(s[31]=127&r[31]|64,s[0]&=248,K(a,n),o=0;o<16;o++)f[o]=a[o],h[o]=c[o]=l[o]=0;for(c[0]=h[0]=1,o=254;o>=0;--o)O(c,f,i=s[o>>>3]>>>(7&o)&1),O(l,h,i),j(p,c,l),M(c,c,l),j(l,f,h),M(f,f,h),U(h,p),U(d,c),D(c,l,c),D(l,f,p),j(p,c,l),M(c,c,l),U(f,c),M(l,h,d),D(c,l,u),j(c,c,h),D(l,l,c),D(c,h,d),D(h,f,a),U(f,p),O(c,f,i),O(l,h,i);for(o=0;o<16;o++)a[o+16]=c[o],a[o+32]=l[o],a[o+48]=f[o],a[o+64]=h[o];var y=a.subarray(32),g=a.subarray(16);return F(y,y),D(g,g,y),R(e,g),0}function H(e,t){return q(e,t,o)}function z(e,t){return n(t,32),H(e,t)}function V(e,t,r){var n=new Uint8Array(32);return q(n,r,t),v(e,i,n,_)}A.prototype.blocks=function(e,t,r){for(var n,i,o,s,a,u,c,f,l,h,p,d,y,g,m,b,v,_,w,S=this.fin?0:2048,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],K=this.r[3],j=this.r[4],M=this.r[5],D=this.r[6],U=this.r[7],F=this.r[8],q=this.r[9];r>=16;)k+=8191&(n=255&e[t+0]|(255&e[t+1])<<8),E+=8191&(n>>>13|(i=255&e[t+2]|(255&e[t+3])<<8)<<3),A+=8191&(i>>>10|(o=255&e[t+4]|(255&e[t+5])<<8)<<6),x+=8191&(o>>>7|(s=255&e[t+6]|(255&e[t+7])<<8)<<9),I+=8191&(s>>>4|(a=255&e[t+8]|(255&e[t+9])<<8)<<12),T+=a>>>1&8191,B+=8191&(a>>>14|(u=255&e[t+10]|(255&e[t+11])<<8)<<2),C+=8191&(u>>>11|(c=255&e[t+12]|(255&e[t+13])<<8)<<5),f=255&e[t+14]|(255&e[t+15])<<8,h=l=0,h+=k*R,h+=E*(5*q),h+=A*(5*F),h+=x*(5*U),l=(h+=I*(5*D))>>>13,h&=8191,h+=T*(5*M),h+=B*(5*j),h+=C*(5*K),h+=(P+=8191&(c>>>8|f<<8))*(5*L),p=l+=(h+=(O+=f>>>5|S)*(5*N))>>>13,p+=k*N,p+=E*R,p+=A*(5*q),p+=x*(5*F),l=(p+=I*(5*U))>>>13,p&=8191,p+=T*(5*D),p+=B*(5*M),p+=C*(5*j),p+=P*(5*K),l+=(p+=O*(5*L))>>>13,p&=8191,d=l,d+=k*L,d+=E*N,d+=A*R,d+=x*(5*q),l=(d+=I*(5*F))>>>13,d&=8191,d+=T*(5*U),d+=B*(5*D),d+=C*(5*M),d+=P*(5*j),y=l+=(d+=O*(5*K))>>>13,y+=k*K,y+=E*L,y+=A*N,y+=x*R,l=(y+=I*(5*q))>>>13,y&=8191,y+=T*(5*F),y+=B*(5*U),y+=C*(5*D),y+=P*(5*M),g=l+=(y+=O*(5*j))>>>13,g+=k*j,g+=E*K,g+=A*L,g+=x*N,l=(g+=I*R)>>>13,g&=8191,g+=T*(5*q),g+=B*(5*F),g+=C*(5*U),g+=P*(5*D),m=l+=(g+=O*(5*M))>>>13,m+=k*M,m+=E*j,m+=A*K,m+=x*L,l=(m+=I*N)>>>13,m&=8191,m+=T*R,m+=B*(5*q),m+=C*(5*F),m+=P*(5*U),b=l+=(m+=O*(5*D))>>>13,b+=k*D,b+=E*M,b+=A*j,b+=x*K,l=(b+=I*L)>>>13,b&=8191,b+=T*N,b+=B*R,b+=C*(5*q),b+=P*(5*F),v=l+=(b+=O*(5*U))>>>13,v+=k*U,v+=E*D,v+=A*M,v+=x*j,l=(v+=I*K)>>>13,v&=8191,v+=T*L,v+=B*N,v+=C*R,v+=P*(5*q),_=l+=(v+=O*(5*F))>>>13,_+=k*F,_+=E*U,_+=A*D,_+=x*M,l=(_+=I*j)>>>13,_&=8191,_+=T*K,_+=B*L,_+=C*N,_+=P*R,w=l+=(_+=O*(5*q))>>>13,w+=k*q,w+=E*F,w+=A*U,w+=x*D,l=(w+=I*M)>>>13,w&=8191,w+=T*j,w+=B*K,w+=C*L,w+=P*N,k=h=8191&(l=(l=((l+=(w+=O*R)>>>13)<<2)+l|0)+(h&=8191)|0),E=p+=l>>>=13,A=d&=8191,x=y&=8191,I=g&=8191,T=m&=8191,B=b&=8191,C=v&=8191,P=_&=8191,O=w&=8191,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},A.prototype.finish=function(e,t){var r,n,i,o,s=new Uint16Array(10);if(this.leftover){for(o=this.leftover,this.buffer[o++]=1;o<16;o++)this.buffer[o]=0;this.fin=1,this.blocks(this.buffer,0,16)}for(r=this.h[1]>>>13,this.h[1]&=8191,o=2;o<10;o++)this.h[o]+=r,r=this.h[o]>>>13,this.h[o]&=8191;for(this.h[0]+=5*r,r=this.h[0]>>>13,this.h[0]&=8191,this.h[1]+=r,r=this.h[1]>>>13,this.h[1]&=8191,this.h[2]+=r,s[0]=this.h[0]+5,r=s[0]>>>13,s[0]&=8191,o=1;o<10;o++)s[o]=this.h[o]+r,r=s[o]>>>13,s[o]&=8191;for(s[9]-=8192,n=(1^r)-1,o=0;o<10;o++)s[o]&=n;for(n=~n,o=0;o<10;o++)this.h[o]=this.h[o]&n|s[o];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),i=this.h[0]+this.pad[0],this.h[0]=65535&i,o=1;o<8;o++)i=(this.h[o]+this.pad[o]|0)+(i>>>16)|0,this.h[o]=65535&i;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},A.prototype.update=function(e,t,r){var n,i;if(this.leftover){for((i=16-this.leftover)>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 G=T,W=B;var $=[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 Y(e,t,r,n){for(var 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=new Int32Array(16),P=new Int32Array(16),O=e[0],R=e[1],N=e[2],L=e[3],K=e[4],j=e[5],M=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],Y=0;n>=128;){for(S=0;S<16;S++)k=8*S+Y,C[S]=r[k+0]<<24|r[k+1]<<16|r[k+2]<<8|r[k+3],P[S]=r[k+4]<<24|r[k+5]<<16|r[k+6]<<8|r[k+7];for(S=0;S<80;S++)if(i=O,o=R,s=N,a=L,u=K,c=j,f=M,l=D,h=U,p=F,d=q,y=H,g=z,m=V,b=G,v=W,x=65535&(A=W),I=A>>>16,T=65535&(E=D),B=E>>>16,x+=65535&(A=(z>>>14|K<<18)^(z>>>18|K<<14)^(K>>>9|z<<23)),I+=A>>>16,T+=65535&(E=(K>>>14|z<<18)^(K>>>18|z<<14)^(z>>>9|K<<23)),B+=E>>>16,x+=65535&(A=z&V^~z&G),I+=A>>>16,T+=65535&(E=K&j^~K&M),B+=E>>>16,E=$[2*S],x+=65535&(A=$[2*S+1]),I+=A>>>16,T+=65535&E,B+=E>>>16,E=C[S%16],I+=(A=P[S%16])>>>16,T+=65535&E,B+=E>>>16,T+=(I+=(x+=65535&A)>>>16)>>>16,x=65535&(A=w=65535&x|I<<16),I=A>>>16,T=65535&(E=_=65535&T|(B+=T>>>16)<<16),B=E>>>16,x+=65535&(A=(U>>>28|O<<4)^(O>>>2|U<<30)^(O>>>7|U<<25)),I+=A>>>16,T+=65535&(E=(O>>>28|U<<4)^(U>>>2|O<<30)^(U>>>7|O<<25)),B+=E>>>16,I+=(A=U&F^U&q^F&q)>>>16,T+=65535&(E=O&R^O&N^R&N),B+=E>>>16,l=65535&(T+=(I+=(x+=65535&A)>>>16)>>>16)|(B+=T>>>16)<<16,v=65535&x|I<<16,x=65535&(A=y),I=A>>>16,T=65535&(E=a),B=E>>>16,I+=(A=w)>>>16,T+=65535&(E=_),B+=E>>>16,R=i,N=o,L=s,K=a=65535&(T+=(I+=(x+=65535&A)>>>16)>>>16)|(B+=T>>>16)<<16,j=u,M=c,D=f,O=l,F=h,q=p,H=d,z=y=65535&x|I<<16,V=g,G=m,W=b,U=v,S%16==15)for(k=0;k<16;k++)E=C[k],x=65535&(A=P[k]),I=A>>>16,T=65535&E,B=E>>>16,E=C[(k+9)%16],x+=65535&(A=P[(k+9)%16]),I+=A>>>16,T+=65535&E,B+=E>>>16,_=C[(k+1)%16],x+=65535&(A=((w=P[(k+1)%16])>>>1|_<<31)^(w>>>8|_<<24)^(w>>>7|_<<25)),I+=A>>>16,T+=65535&(E=(_>>>1|w<<31)^(_>>>8|w<<24)^_>>>7),B+=E>>>16,_=C[(k+14)%16],I+=(A=((w=P[(k+14)%16])>>>19|_<<13)^(_>>>29|w<<3)^(w>>>6|_<<26))>>>16,T+=65535&(E=(_>>>19|w<<13)^(w>>>29|_<<3)^_>>>6),B+=E>>>16,B+=(T+=(I+=(x+=65535&A)>>>16)>>>16)>>>16,C[k]=65535&T|B<<16,P[k]=65535&x|I<<16;x=65535&(A=U),I=A>>>16,T=65535&(E=O),B=E>>>16,E=e[0],I+=(A=t[0])>>>16,T+=65535&E,B+=E>>>16,B+=(T+=(I+=(x+=65535&A)>>>16)>>>16)>>>16,e[0]=O=65535&T|B<<16,t[0]=U=65535&x|I<<16,x=65535&(A=F),I=A>>>16,T=65535&(E=R),B=E>>>16,E=e[1],I+=(A=t[1])>>>16,T+=65535&E,B+=E>>>16,B+=(T+=(I+=(x+=65535&A)>>>16)>>>16)>>>16,e[1]=R=65535&T|B<<16,t[1]=F=65535&x|I<<16,x=65535&(A=q),I=A>>>16,T=65535&(E=N),B=E>>>16,E=e[2],I+=(A=t[2])>>>16,T+=65535&E,B+=E>>>16,B+=(T+=(I+=(x+=65535&A)>>>16)>>>16)>>>16,e[2]=N=65535&T|B<<16,t[2]=q=65535&x|I<<16,x=65535&(A=H),I=A>>>16,T=65535&(E=L),B=E>>>16,E=e[3],I+=(A=t[3])>>>16,T+=65535&E,B+=E>>>16,B+=(T+=(I+=(x+=65535&A)>>>16)>>>16)>>>16,e[3]=L=65535&T|B<<16,t[3]=H=65535&x|I<<16,x=65535&(A=z),I=A>>>16,T=65535&(E=K),B=E>>>16,E=e[4],I+=(A=t[4])>>>16,T+=65535&E,B+=E>>>16,B+=(T+=(I+=(x+=65535&A)>>>16)>>>16)>>>16,e[4]=K=65535&T|B<<16,t[4]=z=65535&x|I<<16,x=65535&(A=V),I=A>>>16,T=65535&(E=j),B=E>>>16,E=e[5],I+=(A=t[5])>>>16,T+=65535&E,B+=E>>>16,B+=(T+=(I+=(x+=65535&A)>>>16)>>>16)>>>16,e[5]=j=65535&T|B<<16,t[5]=V=65535&x|I<<16,x=65535&(A=G),I=A>>>16,T=65535&(E=M),B=E>>>16,E=e[6],I+=(A=t[6])>>>16,T+=65535&E,B+=E>>>16,B+=(T+=(I+=(x+=65535&A)>>>16)>>>16)>>>16,e[6]=M=65535&T|B<<16,t[6]=G=65535&x|I<<16,x=65535&(A=W),I=A>>>16,T=65535&(E=D),B=E>>>16,E=e[7],I+=(A=t[7])>>>16,T+=65535&E,B+=E>>>16,B+=(T+=(I+=(x+=65535&A)>>>16)>>>16)>>>16,e[7]=D=65535&T|B<<16,t[7]=W=65535&x|I<<16,Y+=128,n-=128}return n}function J(e,t,r){var n,i=new Int32Array(8),o=new Int32Array(8),s=new Uint8Array(256),a=r;for(i[0]=1779033703,i[1]=3144134277,i[2]=1013904242,i[3]=2773480762,i[4]=1359893119,i[5]=2600822924,i[6]=528734635,i[7]=1541459225,o[0]=4089235720,o[1]=2227873595,o[2]=4271175723,o[3]=1595750129,o[4]=2917565137,o[5]=725511199,o[6]=4215389547,o[7]=327033209,Y(i,o,t,r),r%=128,n=0;n<r;n++)s[n]=t[a-r+n];for(s[r]=128,s[(r=256-128*(r<112?1:0))-9]=0,d(s,r-8,a/536870912|0,a<<3),Y(i,o,s,r),n=0;n<8;n++)d(e,8*n,i[n],o[n]);return 0}function X(e,r){var n=t(),i=t(),o=t(),s=t(),a=t(),u=t(),c=t(),l=t(),h=t();M(n,e[1],e[0]),M(h,r[1],r[0]),D(n,n,h),j(i,e[0],e[1]),j(h,r[0],r[1]),D(i,i,h),D(o,e[3],r[3]),D(o,o,f),D(s,e[2],r[2]),j(s,s,s),M(a,i,n),M(u,s,o),j(c,s,o),j(l,i,n),D(e[0],a,u),D(e[1],l,c),D(e[2],c,u),D(e[3],a,l)}function Z(e,t,r){var n;for(n=0;n<4;n++)O(e[n],t[n],r)}function Q(e,r){var n=t(),i=t(),o=t();F(o,r[2]),D(n,r[0],o),D(i,r[1],o),R(e,i),e[31]^=L(n)<<7}function ee(e,t,r){var n,i;for(C(e[0],s),C(e[1],a),C(e[2],a),C(e[3],s),i=255;i>=0;--i)Z(e,t,n=r[i/8|0]>>(7&i)&1),X(t,e),X(e,e),Z(e,t,n)}function te(e,r){var n=[t(),t(),t(),t()];C(n[0],l),C(n[1],h),C(n[2],a),D(n[3],l,h),ee(e,n,r)}function re(e,r,i){var o,s=new Uint8Array(64),a=[t(),t(),t(),t()];for(i||n(r,32),J(s,r,32),s[0]&=248,s[31]&=127,s[31]|=64,te(a,s),Q(e,a),o=0;o<32;o++)r[o+32]=e[o];return 0}var ne=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 ie(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]*ne[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)*ne[i],r=t[i]>>8,t[i]&=255;for(i=0;i<32;i++)t[i]-=r*ne[i];for(n=0;n<32;n++)t[n+1]+=t[n]>>8,e[n]=255&t[n]}function oe(e){var t,r=new Float64Array(64);for(t=0;t<64;t++)r[t]=e[t];for(t=0;t<64;t++)e[t]=0;ie(e,r)}function se(e,r,n,i){var o,s,a=new Uint8Array(64),u=new Uint8Array(64),c=new Uint8Array(64),f=new Float64Array(64),l=[t(),t(),t(),t()];J(a,i,32),a[0]&=248,a[31]&=127,a[31]|=64;var h=n+64;for(o=0;o<n;o++)e[64+o]=r[o];for(o=0;o<32;o++)e[32+o]=a[32+o];for(J(c,e.subarray(32),n+32),oe(c),te(l,c),Q(e,l),o=32;o<64;o++)e[o]=i[o];for(J(u,e,n+64),oe(u),o=0;o<64;o++)f[o]=0;for(o=0;o<32;o++)f[o]=c[o];for(o=0;o<32;o++)for(s=0;s<32;s++)f[o+s]+=u[o]*a[s];return ie(e.subarray(32),f),h}function ae(e,r){var n=t(),i=t(),o=t(),u=t(),f=t(),l=t(),h=t();return C(e[2],a),K(e[1],r),U(o,e[1]),D(u,o,c),M(o,o,e[2]),j(u,e[2],u),U(f,u),U(l,f),D(h,l,f),D(n,h,o),D(n,n,u),function(e,r){var n,i=t();for(n=0;n<16;n++)i[n]=r[n];for(n=250;n>=0;n--)U(i,i),1!==n&&D(i,i,r);for(n=0;n<16;n++)e[n]=i[n]}(n,n),D(n,n,o),D(n,n,u),D(n,n,u),D(e[0],n,u),U(i,e[0]),D(i,i,u),N(i,o)&&D(e[0],e[0],p),U(i,e[0]),D(i,i,u),N(i,o)?-1:(L(e[0])===r[31]>>7&&M(e[0],s,e[0]),D(e[3],e[0],e[1]),0)}function ue(e,r,n,i){var o,s=new Uint8Array(32),a=new Uint8Array(64),u=[t(),t(),t(),t()],c=[t(),t(),t(),t()];if(-1,n<64)return-1;if(ae(c,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(J(a,e,n),oe(a),ee(u,c,a),te(c,r.subarray(32)),X(u,c),Q(s,u),n-=64,m(r,0,s,0)){for(o=0;o<n;o++)e[o]=0;return-1}for(o=0;o<n;o++)e[o]=r[o+64];return n}var ce=32,fe=24,le=32,he=32,pe=fe;function de(e,t){if(e.length!==ce)throw new Error("bad key size");if(t.length!==fe)throw new Error("bad nonce size")}function ye(){for(var e=0;e<arguments.length;e++)if(!(arguments[e]instanceof Uint8Array))throw new TypeError("unexpected type, use Uint8Array")}function ge(e){for(var t=0;t<e.length;t++)e[t]=0}e.lowlevel={crypto_core_hsalsa20:v,crypto_stream_xor:E,crypto_stream:k,crypto_stream_salsa20_xor:w,crypto_stream_salsa20:S,crypto_onetimeauth:x,crypto_onetimeauth_verify:I,crypto_verify_16:g,crypto_verify_32:m,crypto_secretbox:T,crypto_secretbox_open:B,crypto_scalarmult:q,crypto_scalarmult_base:H,crypto_box_beforenm:V,crypto_box_afternm:G,crypto_box:function(e,t,r,n,i,o){var s=new Uint8Array(32);return V(s,i,o),G(e,t,r,n,s)},crypto_box_open:function(e,t,r,n,i,o){var s=new Uint8Array(32);return V(s,i,o),W(e,t,r,n,s)},crypto_box_keypair:z,crypto_hash:J,crypto_sign:se,crypto_sign_keypair:re,crypto_sign_open:ue,crypto_secretbox_KEYBYTES:ce,crypto_secretbox_NONCEBYTES:fe,crypto_secretbox_ZEROBYTES:32,crypto_secretbox_BOXZEROBYTES:16,crypto_scalarmult_BYTES:32,crypto_scalarmult_SCALARBYTES:32,crypto_box_PUBLICKEYBYTES:le,crypto_box_SECRETKEYBYTES:he,crypto_box_BEFORENMBYTES:32,crypto_box_NONCEBYTES:pe,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){ye(e,t,r),de(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 T(i,n,n.length,t,r),i.subarray(16)},e.secretbox.open=function(e,t,r){ye(e,t,r),de(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!==B(i,n,n.length,t,r)?null:i.subarray(32)},e.secretbox.keyLength=ce,e.secretbox.nonceLength=fe,e.secretbox.overheadLength=16,e.scalarMult=function(e,t){if(ye(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 q(r,e,t),r},e.scalarMult.base=function(e){if(ye(e),32!==e.length)throw new Error("bad n size");var t=new Uint8Array(32);return H(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){ye(e,t),function(e,t){if(e.length!==le)throw new Error("bad public key size");if(t.length!==he)throw new Error("bad secret key size")}(e,t);var r=new Uint8Array(32);return V(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(le),t=new Uint8Array(he);return z(e,t),{publicKey:e,secretKey:t}},e.box.keyPair.fromSecretKey=function(e){if(ye(e),e.length!==he)throw new Error("bad secret key size");var t=new Uint8Array(le);return H(t,e),{publicKey:t,secretKey:new Uint8Array(e)}},e.box.publicKeyLength=le,e.box.secretKeyLength=he,e.box.sharedKeyLength=32,e.box.nonceLength=pe,e.box.overheadLength=e.secretbox.overheadLength,e.sign=function(e,t){if(ye(e,t),64!==t.length)throw new Error("bad secret key size");var r=new Uint8Array(64+e.length);return se(r,e,e.length,t),r},e.sign.open=function(e,t){if(ye(e,t),32!==t.length)throw new Error("bad public key size");var r=new Uint8Array(e.length),n=ue(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(ye(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,i=new Uint8Array(64+e.length),o=new Uint8Array(64+e.length);for(n=0;n<64;n++)i[n]=t[n];for(n=0;n<e.length;n++)i[n+64]=e[n];return ue(o,i,i.length,r)>=0},e.sign.keyPair=function(){var e=new Uint8Array(32),t=new Uint8Array(64);return re(e,t),{publicKey:e,secretKey:t}},e.sign.keyPair.fromSecretKey=function(e){if(ye(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(ye(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 re(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){ye(e);var t=new Uint8Array(64);return J(t,e,e.length),t},e.hash.hashLength=64,e.verify=function(e,t){return ye(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){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];ge(i)})}else(t=r(941))&&t.randomBytes&&e.setPRNG(function(e,r){var n,i=t.randomBytes(r);for(n=0;n<r;n++)e[n]=i[n];ge(i)})}()}(void 0!==e&&e.exports?e.exports:self.nacl=self.nacl||{})},function(e,t,r){"use strict";const n=r(470);e.exports=((e,t,i)=>{i=i||r(945)(t);class o{constructor(e){i.validatePublicKey(e),this._key=e}verify(e,t,r){a(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){a(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){a(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){a(e),n(this.bytes,"sha2-256",e)}}function a(e){if("function"!=typeof e)throw new Error("callback is required")}return{Secp256k1PublicKey:o,Secp256k1PrivateKey:s,unmarshalSecp256k1PrivateKey:function(e,t){t(null,new s(e),null)},unmarshalSecp256k1PublicKey:function(e){return new o(e)},generateKeyPair:function(e,t){void 0===t&&"function"==typeof e&&(t=e),a(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(e,t,r){"use strict";(function(t){const n=r(44),i=r(26),o=r(984),s=r(269),a=r(20),u=r(14),c=r(61),f=new Error("Sorry, Not Implemented Yet."),l=c.proto(function(e){if(!(this instanceof l))return new l(e);if(null==e&&(e=""),e instanceof t)this.buffer=o.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=o.fromString(e)}else{if(!(e.buffer&&e.protos&&e.protoCodes))throw new Error("addr must be a string, Buffer, or another Multiaddr");this.buffer=o.fromBuffer(e.buffer)}},{className:"Multiaddr",symbolName:"@multiformats/js-multiaddr/multiaddr"});l.prototype.toString=function(){return o.bufferToString(this.buffer)},l.prototype.toOptions=function(){const e={},t=this.toString().split("/");return e.family="ip4"===t[1]?"ipv4":"ipv6",e.host=t[2],e.transport=t[3],e.port=t[4],e},l.prototype.inspect=function(){return"<Multiaddr "+this.buffer.toString("hex")+" - "+o.bufferToString(this.buffer)+">"},l.prototype.protos=function(){return n(this.protoCodes(),function(e){return i(s(e))})},l.prototype.protoCodes=function(){const e=[],t=this.buffer;let r=0;for(;r<t.length;){const n=a.decode(t,r),i=a.decode.bytes,u=s(n);r+=o.sizeForAddr(u,t.slice(r+i))+i,e.push(n)}return e},l.prototype.protoNames=function(){return n(this.protos(),function(e){return e.name})},l.prototype.tuples=function(){return o.bufferToTuples(this.buffer)},l.prototype.stringTuples=function(){const e=o.bufferToTuples(this.buffer);return o.tuplesToStringTuples(e)},l.prototype.encapsulate=function(e){return e=l(e),l(this.toString()+e.toString())},l.prototype.decapsulate=function(e){e=e.toString();const t=this.toString(),r=t.lastIndexOf(e);if(r<0)throw new Error("Address "+this+" does not contain subaddress: "+e);return l(t.slice(0,r))},l.prototype.getPeerId=function(){let e=null;try{e=this.stringTuples().filter(e=>{if(e[0]===s.names.ipfs.code)return!0})[0][1],u.decode(e)}catch(t){e=null}return e},l.prototype.equals=function(e){return this.buffer.equals(e.buffer)},l.prototype.nodeAddress=function(){const e=this.protoCodes(),t=this.protoNames(),r=this.toString().split("/").slice(1);if(r.length<4)throw new Error('multiaddr must have a valid format: "/{ip4, ip6, dns4, dns6}/{address}/{tcp, udp}/{port}".');if(4!==e[0]&&41!==e[0]&&54!==e[0]&&55!==e[0])throw new Error(`no protocol with name: "'${t[0]}'". Must have a valid family name: "{ip4, ip6, dns4, dns6}".`);if("tcp"!==r[2]&&"udp"!==r[2])throw new Error(`no protocol with name: "'${t[1]}'". Must have a valid transport protocol: "{tcp, udp}".`);return{family:41===e[0]||55===e[0]?6:4,address:r[1],port:r[3]}},l.fromNodeAddress=function(e,t){if(!e)throw new Error("requires node address object");if(!t)throw new Error("requires transport protocol");const r="IPv6"===e.family?"ip6":"ip4";return l("/"+[r,e.address,t,e.port].join("/"))},l.prototype.isThinWaistAddress=function(e){const t=(e||this).protos();return!(2!==t.length||4!==t[0].code&&41!==t[0].code||6!==t[1].code&&17!==t[1].code)},l.prototype.fromStupidString=function(e){throw f},l.protocols=s,l.isName=function(e){return!!l.isMultiaddr(e)&&e.protos().some(e=>e.resolvable)},l.resolve=function(e,t){return l.isMultiaddr(e)&&l.isName(e)?t(new Error("not implemented yet")):t(new Error("not a valid name"))},e.exports=l}).call(this,r(0).Buffer)},function(e,t,r){"use strict";e.exports=function(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},e.exports.proto=function(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}},function(e,t){e.exports=function(){}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e,t){(0,i.default)(n.default,e,t)};var n=o(r(218)),i=o(r(354));function o(e){return e&&e.__esModule?e:{default:e}}e.exports=t.default},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("/"))||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}var c=[];for(u=a;u<i.length;u++)c.push("..");return(c=c.concat(o.slice(a))).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(7))},function(e,t,r){"use strict";(function(t){const n=r(12),i=r(744);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,s=n;r&&(s=((e,t)=>{if(e)return n(e);n(null,t.slice(0,r))}));try{i=o.createHash(t)}catch(e){return s(e)}i(e,s)},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(18);var i=function(e,t){var r=function(){if(n.isString(t.message))this.message=function(e,t){return e.replace("{0}",t[0]).replace("{1}",t[1]).replace("{2}",t[2])}(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)).name=e.prototype.name+t.name,e[t.name]=r,t.errors&&o(r,t.errors),r},o=function(e,t){n.each(t,function(t){i(e,t)})},s={Error:function(){this.message="Internal error",this.stack=this.message+"\n"+(new Error).stack}};s.Error.prototype=Object.create(Error.prototype),s.Error.prototype.name="bitcore.Error";var a=r(872);(function(e,t){o(e,t)})(s.Error,a),e.exports=s.Error,e.exports.extend=function(e){return i(s.Error,e)}},function(e,t,r){"use strict";(function(t){var n=r(32),i=r(18),o=r(21),s=r(24),a=r(29),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;return o.checkArgument(a===v-2,new Error("Length of signature incorrect")),{header:r,length:a,rheader:c,rlength:f,rneg:p,rbuf:l,r:h,sheader:d,slength:y,sneg:b,sbuf:g,s:m}},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;return t.concat([new t([48,c,2,a]),o,new t([2,u]),s])},u.prototype.toString=function(){return this.toDER().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(433),e.exports.Interpreter=r(891)},function(e,t,r){var n=r(13);r(98),r(451),r(452),r(19),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))[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))[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(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(81),i=r(5);function o(e){return(e>>>24|e>>>8&65280|e<<8&16711680|(255&e)<<24)>>>0}function s(e){return 1===e.length?"0"+e:e}function a(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}t.inherits=i,t.toArray=function(e,t){if(Array.isArray(e))return e.slice();if(!e)return[];var r=[];if("string"==typeof e)if(t){if("hex"===t)for((e=e.replace(/[^a-z0-9]+/gi,"")).length%2!=0&&(e="0"+e),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},t.toHex=function(e){for(var t="",r=0;r<e.length;r++)t+=s(e[r].toString(16));return t},t.htonl=o,t.toHex32=function(e,t){for(var r="",n=0;n<e.length;n++){var i=e[n];"little"===t&&(i=o(i)),r+=a(i.toString(16))}return r},t.zero2=s,t.zero8=a,t.join32=function(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},t.split32=function(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},t.rotr32=function(e,t){return e>>>t|e<<32-t},t.rotl32=function(e,t){return e<<t|e>>>32-t},t.sum32=function(e,t){return e+t>>>0},t.sum32_3=function(e,t,r){return e+t+r>>>0},t.sum32_4=function(e,t,r,n){return e+t+r+n>>>0},t.sum32_5=function(e,t,r,n,i){return e+t+r+n+i>>>0},t.sum64=function(e,t,r,n){var i=e[t],o=n+e[t+1]>>>0,s=(o<n?1:0)+r+i;e[t]=s>>>0,e[t+1]=o},t.sum64_hi=function(e,t,r,n){return(t+n>>>0<t?1:0)+e+r>>>0},t.sum64_lo=function(e,t,r,n){return t+n>>>0},t.sum64_4_hi=function(e,t,r,n,i,o,s,a){var u=0,c=t;return u+=(c=c+n>>>0)<t?1:0,u+=(c=c+o>>>0)<o?1:0,e+r+i+s+(u+=(c=c+a>>>0)<a?1:0)>>>0},t.sum64_4_lo=function(e,t,r,n,i,o,s,a){return t+n+o+a>>>0},t.sum64_5_hi=function(e,t,r,n,i,o,s,a,u,c){var f=0,l=t;return f+=(l=l+n>>>0)<t?1:0,f+=(l=l+o>>>0)<o?1:0,f+=(l=l+a>>>0)<a?1:0,e+r+i+s+u+(f+=(l=l+c>>>0)<c?1:0)>>>0},t.sum64_5_lo=function(e,t,r,n,i,o,s,a,u,c){return t+n+o+a+c>>>0},t.rotr64_hi=function(e,t,r){return(t<<32-r|e>>>r)>>>0},t.rotr64_lo=function(e,t,r){return(e<<32-r|t>>>r)>>>0},t.shr64_hi=function(e,t,r){return e>>>r},t.shr64_lo=function(e,t,r){return(e<<32-r|t>>>r)>>>0}},function(e,t,r){"use strict";var n=t;n.version=r(873).version,n.utils=r(874),n.rand=r(875),n.hmacDRBG=r(876),n.curve=r(175),n.curves=r(886),n.ec=r(888)},function(e,t,r){"use strict";(function(t){var n=r(32),i=r(108),o=r(43),s=r(29),a=r(96),u=r(18),c=r(21);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){return e instanceof r(176)},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])s=e.slice(1),r=new n(s),(l=f._transformX(!0,r)).compressed=!0;else{if(2!==e[0])throw new TypeError("Invalid DER format public key");s=e.slice(1),r=new n(s),(l=f._transformX(!1,r)).compressed=!0}else{if(s=e.slice(1,33),a=e.slice(33,65),32!==s.length||32!==a.length||65!==e.length)throw new TypeError("Length of x and y must be 32 bytes");r=new n(s),o=new n(a),l.point=new i(r,o),l.compressed=!1}return l},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");return new f(new i(t,r),{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(){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,r=this.point.getX(),n=this.point.getY(),i=r.toBuffer({size:32}),o=n.toBuffer({size:32});if(this.compressed){var s=o[o.length-1]%2;return e=new t(s?[3]:[2]),t.concat([e,i])}return e=new t([4]),t.concat([e,i,o])},f.prototype._getID=function(){return o.sha256ripemd160(this.toBuffer())},f.prototype.toAddress=function(e){return r(97).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){(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){if("number"==typeof e)return e<0&&(this.sign=!0,e=-e),void(e<67108864?(this.words=[67108863&e],this.length=1):e<4503599627370496?(this.words=[67108863&e,e/67108864&67108863],this.length=2):(r(e<9007199254740992),this.words=[67108863&e,e/67108864&67108863,1],this.length=3));if("object"==typeof e)return this._initArray(e,t,n);"hex"===t&&(t=16),r(t===(0|t)&&t>=2&&t<=36);var i=0;"-"===(e=e.toString().replace(/\s+/g,""))[0]&&i++,16===t?this._parseHex(e,i):this._parseBase(e,t,i),"-"===e[0]&&(this.sign=!0),this.strip()},i.prototype._initArray=function(e,t,n){if(r("number"==typeof e.length),e.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(e.length/3),this.words=new Array(this.length);for(var i=0;i<this.length;i++)this.words[i]=0;var o=0;if("be"===n){i=e.length-1;for(var s=0;i>=0;i-=3){var a=e[i]|e[i-1]<<8|e[i-2]<<16;this.words[s]|=a<<o&67108863,this.words[s+1]=a>>>26-o&67108863,(o+=24)>=26&&(o-=26,s++)}}else if("le"===n)for(i=0,s=0;i<e.length;i+=3){a=e[i]|e[i+1]<<8|e[i+2]<<16;this.words[s]|=a<<o&67108863,this.words[s+1]=a>>>26-o&67108863,(o+=24)>=26&&(o-=26,s++)}return this.strip()},i.prototype._parseHex=function(e,t){this.length=Math.ceil((e.length-t)/6),this.words=new Array(this.length);for(var r=0;r<this.length;r++)this.words[r]=0;for(var n=0,i=(r=e.length-6,0);r>=t;r-=6){var s=o(e,r,r+6);this.words[i]|=s<<n&67108863,this.words[i+1]|=s>>>26-n&4194303,(n+=24)>=26&&(n-=26,i++)}if(r+6!==t){s=o(e,t,r+6);this.words[i]|=s<<n&67108863,this.words[i+1]|=s>>>26-n&4194303}this.strip()},i.prototype._parseBase=function(e,t,r){this.words=[0],this.length=1;for(var n=0,i=1;i<=67108863;i*=t)n++;n--,i=i/t|0;for(var o=e.length-r,a=o%n,u=Math.min(o,o-a)+r,c=0,f=r;f<u;f+=n)c=s(e,f,f+n,t),this.imuln(i),this.words[0]+c<67108864?this.words[0]+=c:this._iaddn(c);if(0!==a){var l=1;for(c=s(e,f,e.length,t),f=0;f<a;f++)l*=t;this.imuln(l),this.words[0]+c<67108864?this.words[0]+=c:this._iaddn(c)}},i.prototype.copy=function(e){e.words=new Array(this.length);for(var t=0;t<this.length;t++)e.words[t]=this.words[t];e.length=this.length,e.sign=this.sign,e.red=this.red},i.prototype.clone=function(){var e=new i(null);return this.copy(e),e},i.prototype.strip=function(){for(;this.length>1&&0===this.words[this.length-1];)this.length--;return this._normSign()},i.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.sign=!1),this},i.prototype.inspect=function(){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){if(16===(e=e||10)||"hex"===e){for(var n="",i=0,o=(t=0|t||1,0),s=0;s<this.length;s++){var f=this.words[s],l=(16777215&(f<<i|o)).toString(16);n=0!=(o=f>>>24-i&16777215)||s!==this.length-1?a[6-l.length]+l+n:l+n,(i+=2)>=26&&(i-=26,s--)}for(0!==o&&(n=o.toString(16)+n);n.length%t!=0;)n="0"+n;return this.sign&&(n="-"+n),n}if(e===(0|e)&&e>=2&&e<=36){var h=u[e],p=c[e],d=(n="",this.clone());for(d.sign=!1;0!==d.cmpn(0);){var y=d.modn(p).toString(e);n=0!==(d=d.idivn(p)).cmpn(0)?a[h-y.length]+y+n:y+n}return 0===this.cmpn(0)&&(n="0"+n),this.sign&&(n="-"+n),n}r(!1,"Base should be between 2 and 36")},i.prototype.toJSON=function(){return this.toString(16)},i.prototype.toArray=function(){this.strip();var e=new Array(this.byteLength());e[0]=0;for(var t=this.clone(),r=0;0!==t.cmpn(0);r++){var n=t.andln(255);t.ishrn(8),e[e.length-r-1]=n}return e},Math.clz32?i.prototype._countBits=function(e){return 32-Math.clz32(e)}:i.prototype._countBits=function(e){var t=e,r=0;return t>=4096&&(r+=13,t>>>=13),t>=64&&(r+=7,t>>>=7),t>=8&&(r+=4,t>>>=4),t>=2&&(r+=2,t>>>=2),r+t},i.prototype._zeroBits=function(e){if(0===e)return 26;var t=e,r=0;return 0==(8191&t)&&(r+=13,t>>>=13),0==(127&t)&&(r+=7,t>>>=7),0==(15&t)&&(r+=4,t>>>=4),0==(3&t)&&(r+=2,t>>>=2),0==(1&t)&&r++,r},i.prototype.bitLength=function(){var e=this.words[this.length-1],t=this._countBits(e);return 26*(this.length-1)+t},i.prototype.zeroBits=function(){if(0===this.cmpn(0))return 0;for(var e=0,t=0;t<this.length;t++){var r=this._zeroBits(this.words[t]);if(e+=r,26!==r)break}return e},i.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},i.prototype.neg=function(){if(0===this.cmpn(0))return this.clone();var e=this.clone();return e.sign=!this.sign,e},i.prototype.ior=function(e){for(this.sign=this.sign||e.sign;this.length<e.length;)this.words[this.length++]=0;for(var t=0;t<e.length;t++)this.words[t]=this.words[t]|e.words[t];return this.strip()},i.prototype.or=function(e){return this.length>e.length?this.clone().ior(e):e.clone().ior(this)},i.prototype.iand=function(e){var t;this.sign=this.sign&&e.sign,t=this.length>e.length?e:this;for(var r=0;r<t.length;r++)this.words[r]=this.words[r]&e.words[r];return this.length=t.length,this.strip()},i.prototype.and=function(e){return this.length>e.length?this.clone().iand(e):e.clone().iand(this)},i.prototype.ixor=function(e){var t,r;this.sign=this.sign||e.sign,this.length>e.length?(t=this,r=e):(t=e,r=this);for(var n=0;n<r.length;n++)this.words[n]=t.words[n]^r.words[n];if(this!==t)for(;n<t.length;n++)this.words[n]=t.words[n];return this.length=t.length,this.strip()},i.prototype.xor=function(e){return this.length>e.length?this.clone().ixor(e):e.clone().ixor(this)},i.prototype.setn=function(e,t){r("number"==typeof e&&e>=0);for(var n=e/26|0,i=e%26;this.length<=n;)this.words[this.length++]=0;return this.words[n]=t?this.words[n]|1<<i:this.words[n]&~(1<<i),this.strip()},i.prototype.iadd=function(e){if(this.sign&&!e.sign){this.sign=!1;var t=this.isub(e);return this.sign=!this.sign,this._normSign()}if(!this.sign&&e.sign){e.sign=!1;t=this.isub(e);return e.sign=!0,t._normSign()}var r,n;this.length>e.length?(r=this,n=e):(r=e,n=this);for(var i=0,o=0;o<n.length;o++){t=r.words[o]+n.words[o]+i;this.words[o]=67108863&t,i=t>>>26}for(;0!==i&&o<r.length;o++){t=r.words[o]+i;this.words[o]=67108863&t,i=t>>>26}if(this.length=r.length,0!==i)this.words[this.length]=i,this.length++;else if(r!==this)for(;o<r.length;o++)this.words[o]=r.words[o];return this},i.prototype.add=function(e){if(e.sign&&!this.sign){e.sign=!1;var t=this.sub(e);return e.sign=!0,t}if(!e.sign&&this.sign){this.sign=!1;t=e.sub(this);return this.sign=!0,t}return this.length>e.length?this.clone().iadd(e):e.clone().iadd(this)},i.prototype.isub=function(e){if(e.sign){e.sign=!1;var t=this.iadd(e);return e.sign=!0,t._normSign()}if(this.sign)return this.sign=!1,this.iadd(e),this.sign=!0,this._normSign();var r,n,i=this.cmp(e);if(0===i)return this.sign=!1,this.length=1,this.words[0]=0,this;i>0?(r=this,n=e):(r=e,n=this);for(var o=0,s=0;s<n.length;s++){o=(t=r.words[s]-n.words[s]+o)>>26,this.words[s]=67108863&t}for(;0!==o&&s<r.length;s++){o=(t=r.words[s]+o)>>26,this.words[s]=67108863&t}if(0===o&&s<r.length&&r!==this)for(;s<r.length;s++)this.words[s]=r.words[s];return this.length=Math.max(this.length,s),r!==this&&(this.sign=!0),this.strip()},i.prototype.sub=function(e){return this.clone().isub(e)},i.prototype._smallMulTo=function(e,t){t.sign=e.sign!==this.sign,t.length=this.length+e.length;for(var r=0,n=0;n<t.length-1;n++){for(var i=r>>>26,o=67108863&r,s=Math.min(n,e.length-1),a=Math.max(0,n-this.length+1);a<=s;a++){var u=n-a,c=(0|this.words[u])*(0|e.words[a]),f=67108863&c;o=67108863&(f=f+o|0),i=(i=i+(c/67108864|0)|0)+(f>>>26)|0}t.words[n]=o,r=i}return 0!==r?t.words[n]=r:t.length--,t.strip()},i.prototype._bigMulTo=function(e,t){t.sign=e.sign!==this.sign,t.length=this.length+e.length;for(var r=0,n=0,i=0;i<t.length-1;i++){var o=n;n=0;for(var s=67108863&r,a=Math.min(i,e.length-1),u=Math.max(0,i-this.length+1);u<=a;u++){var c=i-u,f=(0|this.words[c])*(0|e.words[u]),l=67108863&f;s=67108863&(l=l+s|0),n+=(o=(o=o+(f/67108864|0)|0)+(l>>>26)|0)>>>26,o&=67108863}t.words[i]=s,r=o,o=n}return 0!==r?t.words[i]=r:t.length--,t.strip()},i.prototype.mulTo=function(e,t){return this.length+e.length<63?this._smallMulTo(e,t):this._bigMulTo(e,t)},i.prototype.mul=function(e){var t=new i(null);return t.words=new Array(this.length+e.length),this.mulTo(e,t)},i.prototype.imul=function(e){if(0===this.cmpn(0)||0===e.cmpn(0))return this.words[0]=0,this.length=1,this;var t=this.length,r=e.length;this.sign=e.sign!==this.sign,this.length=this.length+e.length,this.words[this.length-1]=0;for(var n=this.length-2;n>=0;n--){for(var i=0,o=0,s=Math.min(n,r-1),a=Math.max(0,n-t+1);a<=s;a++){var u=n-a,c=this.words[u]*e.words[a],f=67108863&c;i+=c/67108864|0,o=67108863&(f+=o),i+=f>>>26}this.words[n]=o,this.words[n+1]+=i,i=0}for(i=0,u=1;u<this.length;u++){var l=this.words[u]+i;this.words[u]=67108863&l,i=l>>>26}return this.strip()},i.prototype.imuln=function(e){r("number"==typeof e);for(var t=0,n=0;n<this.length;n++){var i=this.words[n]*e,o=(67108863&i)+(67108863&t);t>>=26,t+=i/67108864|0,t+=o>>>26,this.words[n]=67108863&o}return 0!==t&&(this.words[n]=t,this.length++),this},i.prototype.sqr=function(){return this.mul(this)},i.prototype.isqr=function(){return this.mul(this)},i.prototype.ishln=function(e){r("number"==typeof e&&e>=0);var t=e%26,n=(e-t)/26,i=67108863>>>26-t<<26-t;if(0!==t){for(var o=0,s=0;s<this.length;s++){var a=this.words[s]&i,u=this.words[s]-a<<t;this.words[s]=u|o,o=a>>>26-t}o&&(this.words[s]=o,this.length++)}if(0!==n){for(s=this.length-1;s>=0;s--)this.words[s+n]=this.words[s];for(s=0;s<n;s++)this.words[s]=0;this.length+=n}return this.strip()},i.prototype.ishrn=function(e,t,n){var i;r("number"==typeof e&&e>=0),i=t?(t-t%26)/26:0;var o=e%26,s=Math.min((e-o)/26,this.length),a=67108863^67108863>>>o<<o,u=n;if(i-=s,i=Math.max(0,i),u){for(var c=0;c<s;c++)u.words[c]=this.words[c];u.length=s}if(0===s);else if(this.length>s){this.length-=s;for(c=0;c<this.length;c++)this.words[c]=this.words[c+s]}else this.words[0]=0,this.length=1;var f=0;for(c=this.length-1;c>=0&&(0!==f||c>=i);c--){var l=this.words[c];this.words[c]=f<<26-o|l>>>o,f=l&a}return u&&0!==f&&(u.words[u.length++]=f),0===this.length&&(this.words[0]=0,this.length=1),this.strip(),this},i.prototype.shln=function(e){return this.clone().ishln(e)},i.prototype.shrn=function(e){return this.clone().ishrn(e)},i.prototype.testn=function(e){r("number"==typeof e&&e>=0);var t=e%26,n=(e-t)/26,i=1<<t;return!(this.length<=n||!(this.words[n]&i))},i.prototype.imaskn=function(e){r("number"==typeof e&&e>=0);var t=e%26,n=(e-t)/26;if(r(!this.sign,"imaskn works only with positive numbers"),0!==t&&n++,this.length=Math.min(n,this.length),0!==t){var i=67108863^67108863>>>t<<t;this.words[this.length-1]&=i}return this.strip()},i.prototype.maskn=function(e){return this.clone().imaskn(e)},i.prototype.iaddn=function(e){return r("number"==typeof e),e<0?this.isubn(-e):this.sign?1===this.length&&this.words[0]<e?(this.words[0]=e-this.words[0],this.sign=!1,this):(this.sign=!1,this.isubn(e),this.sign=!0,this):this._iaddn(e)},i.prototype._iaddn=function(e){this.words[0]+=e;for(var t=0;t<this.length&&this.words[t]>=67108864;t++)this.words[t]-=67108864,t===this.length-1?this.words[t+1]=1:this.words[t+1]++;return this.length=Math.max(this.length,t+1),this},i.prototype.isubn=function(e){if(r("number"==typeof e),e<0)return this.iaddn(-e);if(this.sign)return this.sign=!1,this.iaddn(e),this.sign=!0,this;this.words[0]-=e;for(var t=0;t<this.length&&this.words[t]<0;t++)this.words[t]+=67108864,this.words[t+1]-=1;return this.strip()},i.prototype.addn=function(e){return this.clone().iaddn(e)},i.prototype.subn=function(e){return this.clone().isubn(e)},i.prototype.iabs=function(){return this.sign=!1,this},i.prototype.abs=function(){return this.clone().iabs()},i.prototype._ishlnsubmul=function(e,t,n){var i=e.length+n;if(this.words.length<i){for(var o=new Array(i),s=0;s<this.length;s++)o[s]=this.words[s];this.words=o}else s=this.length;for(this.length=Math.max(this.length,i);s<this.length;s++)this.words[s]=0;var a=0;for(s=0;s<e.length;s++){var u=this.words[s+n]+a,c=e.words[s]*t;a=((u-=67108863&c)>>26)-(c/67108864|0),this.words[s+n]=67108863&u}for(;s<this.length-n;s++){a=(u=this.words[s+n]+a)>>26,this.words[s+n]=67108863&u}if(0===a)return this.strip();r(-1===a),a=0;for(s=0;s<this.length;s++){a=(u=-this.words[s]+a)>>26,this.words[s]=67108863&u}return this.sign=!0,this.strip()},i.prototype._wordDiv=function(e,t){var r=(this.length,e.length),n=this.clone(),o=e,s=o.words[o.length-1];0!=(r=26-this._countBits(s))&&(o=o.shln(r),n.ishln(r),s=o.words[o.length-1]);var a,u=n.length-o.length;if("mod"!==t){(a=new i(null)).length=u+1,a.words=new Array(a.length);for(var c=0;c<a.length;c++)a.words[c]=0}var f=n.clone()._ishlnsubmul(o,1,u);f.sign||(n=f,a&&(a.words[u]=1));for(var l=u-1;l>=0;l--){var h=67108864*n.words[o.length+l]+n.words[o.length+l-1];for(h=Math.min(h/s|0,67108863),n._ishlnsubmul(o,h,l);n.sign;)h--,n.sign=!1,n._ishlnsubmul(o,1,l),0!==n.cmpn(0)&&(n.sign=!n.sign);a&&(a.words[l]=h)}return a&&a.strip(),n.strip(),"div"!==t&&0!==r&&n.ishrn(r),{div:a||null,mod:n}},i.prototype.divmod=function(e,t){if(r(0!==e.cmpn(0)),this.sign&&!e.sign){var n,o=this.neg().divmod(e,t);return"mod"!==t&&(s=o.div.neg()),"div"!==t&&(n=0===o.mod.cmpn(0)?o.mod:e.sub(o.mod)),{div:s,mod:n}}if(!this.sign&&e.sign){var s;o=this.divmod(e.neg(),t);return"mod"!==t&&(s=o.div.neg()),{div:s,mod:o.mod}}return this.sign&&e.sign?this.neg().divmod(e.neg(),t):e.length>this.length||this.cmp(e)<0?{div:new i(0),mod:this}:1===e.length?"div"===t?{div:this.divn(e.words[0]),mod:null}:"mod"===t?{div:null,mod:new i(this.modn(e.words[0]))}:{div:this.divn(e.words[0]),mod:new i(this.modn(e.words[0]))}:this._wordDiv(e,t)},i.prototype.div=function(e){return this.divmod(e,"div").div},i.prototype.mod=function(e){return this.divmod(e,"mod").mod},i.prototype.divRound=function(e){var t=this.divmod(e);if(0===t.mod.cmpn(0))return t.div;var r=t.div.sign?t.mod.isub(e):t.mod,n=e.shrn(1),i=e.andln(1),o=r.cmp(n);return o<0||1===i&&0===o?t.div:t.div.sign?t.div.isubn(1):t.div.iaddn(1)},i.prototype.modn=function(e){r(e<=67108863);for(var t=(1<<26)%e,n=0,i=this.length-1;i>=0;i--)n=(t*n+this.words[i])%e;return n},i.prototype.idivn=function(e){r(e<=67108863);for(var t=0,n=this.length-1;n>=0;n--){var i=this.words[n]+67108864*t;this.words[n]=i/e|0,t=i%e}return this.strip()},i.prototype.divn=function(e){return this.clone().idivn(e)},i.prototype.egcd=function(e){r(!e.sign),r(0!==e.cmpn(0));var t=this,n=e.clone();t=t.sign?t.mod(e):t.clone();for(var o=new i(1),s=new i(0),a=new i(0),u=new i(1),c=0;t.isEven()&&n.isEven();)t.ishrn(1),n.ishrn(1),++c;for(var f=n.clone(),l=t.clone();0!==t.cmpn(0);){for(;t.isEven();)t.ishrn(1),o.isEven()&&s.isEven()?(o.ishrn(1),s.ishrn(1)):(o.iadd(f).ishrn(1),s.isub(l).ishrn(1));for(;n.isEven();)n.ishrn(1),a.isEven()&&u.isEven()?(a.ishrn(1),u.ishrn(1)):(a.iadd(f).ishrn(1),u.isub(l).ishrn(1));t.cmp(n)>=0?(t.isub(n),o.isub(a),s.isub(u)):(n.isub(t),a.isub(o),u.isub(s))}return{a:a,b:u,gcd:n.ishln(c)}},i.prototype._invmp=function(e){r(!e.sign),r(0!==e.cmpn(0));var t=this,n=e.clone();t=t.sign?t.mod(e):t.clone();for(var o=new i(1),s=new i(0),a=n.clone();t.cmpn(1)>0&&n.cmpn(1)>0;){for(;t.isEven();)t.ishrn(1),o.isEven()?o.ishrn(1):o.iadd(a).ishrn(1);for(;n.isEven();)n.ishrn(1),s.isEven()?s.ishrn(1):s.iadd(a).ishrn(1);t.cmp(n)>=0?(t.isub(n),o.isub(s)):(n.isub(t),s.isub(o))}return 0===t.cmpn(1)?o:s},i.prototype.gcd=function(e){if(0===this.cmpn(0))return e.clone();if(0===e.cmpn(0))return this.clone();var t=this.clone(),r=e.clone();t.sign=!1,r.sign=!1;for(var n=0;t.isEven()&&r.isEven();n++)t.ishrn(1),r.ishrn(1);for(;;){for(;t.isEven();)t.ishrn(1);for(;r.isEven();)r.ishrn(1);var i=t.cmp(r);if(i<0){var o=t;t=r,r=o}else if(0===i||0===r.cmpn(1))break;t.isub(r)}return r.ishln(n)},i.prototype.invm=function(e){return this.egcd(e).a.mod(e)},i.prototype.isEven=function(){return 0==(1&this.words[0])},i.prototype.isOdd=function(){return 1==(1&this.words[0])},i.prototype.andln=function(e){return this.words[0]&e},i.prototype.bincn=function(e){r("number"==typeof e);var t=e%26,n=(e-t)/26,i=1<<t;if(this.length<=n){for(var o=this.length;o<n+1;o++)this.words[o]=0;return this.words[n]|=i,this.length=n+1,this}var s=i;for(o=n;0!==s&&o<this.length;o++){var a=this.words[o];s=(a+=s)>>>26,a&=67108863,this.words[o]=a}return 0!==s&&(this.words[o]=s,this.length++),this},i.prototype.cmpn=function(e){var t,r=e<0;if(r&&(e=-e),this.sign&&!r)return-1;if(!this.sign&&r)return 1;if(e&=67108863,this.strip(),this.length>1)t=1;else{var n=this.words[0];t=n===e?0:n<e?-1:1}return this.sign&&(t=-t),t},i.prototype.cmp=function(e){if(this.sign&&!e.sign)return-1;if(!this.sign&&e.sign)return 1;var t=this.ucmp(e);return this.sign?-t:t},i.prototype.ucmp=function(e){if(this.length>e.length)return 1;if(this.length<e.length)return-1;for(var t=0,r=this.length-1;r>=0;r--){var n=this.words[r],i=e.words[r];if(n!==i){n<i?t=-1:n>i&&(t=1);break}}return t},i.red=function(e){return new g(e)},i.prototype.toRed=function(e){return r(!this.red,"Already a number in reduction context"),r(!this.sign,"red works only with positives"),e.convertTo(this)._forceRed(e)},i.prototype.fromRed=function(){return r(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},i.prototype._forceRed=function(e){return this.red=e,this},i.prototype.forceRed=function(e){return r(!this.red,"Already a number in reduction context"),this._forceRed(e)},i.prototype.redAdd=function(e){return r(this.red,"redAdd works only with red numbers"),this.red.add(this,e)},i.prototype.redIAdd=function(e){return r(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,e)},i.prototype.redSub=function(e){return r(this.red,"redSub works only with red numbers"),this.red.sub(this,e)},i.prototype.redISub=function(e){return r(this.red,"redISub works only with red numbers"),this.red.isub(this,e)},i.prototype.redShl=function(e){return r(this.red,"redShl works only with red numbers"),this.red.shl(this,e)},i.prototype.redMul=function(e){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.mul(this,e)},i.prototype.redIMul=function(e){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.imul(this,e)},i.prototype.redSqr=function(){return r(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},i.prototype.redISqr=function(){return r(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},i.prototype.redSqrt=function(){return r(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},i.prototype.redInvm=function(){return r(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},i.prototype.redNeg=function(){return r(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},i.prototype.redPow=function(e){return r(this.red&&!e.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,e)};var 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(){var e=new i(null);return e.words=new Array(Math.ceil(this.n/13)),e},l.prototype.ireduce=function(e){var t,r=e;do{this.split(r,this.tmp),t=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(t>this.n);var n=t<this.n?-1:r.ucmp(this.p);return 0===n?(r.words[0]=0,r.length=1):n>0?r.isub(this.p):r.strip(),r},l.prototype.split=function(e,t){e.ishrn(this.n,0,t)},l.prototype.imulK=function(e){return e.imul(this.k)},n(h,l),h.prototype.split=function(e,t){for(var r=4194303,n=Math.min(e.length,9),i=0;i<n;i++)t.words[i]=e.words[i];if(t.length=n,e.length<=9)return e.words[0]=0,void(e.length=1);var o=e.words[9];t.words[t.length++]=o&r;for(i=10;i<e.length;i++){var s=e.words[i];e.words[i-10]=(s&r)<<4|o>>>22,o=s}e.words[i-10]=o>>>22,e.length-=9},h.prototype.imulK=function(e){var t;e.words[e.length]=0,e.words[e.length+1]=0,e.length+=2;for(var r=0,n=0;n<e.length;n++){var i=e.words[n];t=64*i,t+=(r+=977*i)/67108864|0,r&=67108863,e.words[n]=r,r=t}return 0===e.words[e.length-1]&&(e.length--,0===e.words[e.length-1]&&e.length--),e},n(p,l),n(d,l),n(y,l),y.prototype.imulK=function(e){for(var t=0,r=0;r<e.length;r++){var n=19*e.words[r]+t,i=67108863&n;n>>>=26,e.words[r]=i,t=n}return 0!==t&&(e.words[e.length++]=t),e},i._prime=function(e){if(f[e])return f[e];var t;if("k256"===e)t=new h;else if("p224"===e)t=new p;else if("p192"===e)t=new d;else{if("p25519"!==e)throw new Error("Unknown prime "+e);t=new y}return f[e]=t,t},g.prototype._verify1=function(e){r(!e.sign,"red works only with positives"),r(e.red,"red works only with red numbers")},g.prototype._verify2=function(e,t){r(!e.sign&&!t.sign,"red works only with positives"),r(e.red&&e.red===t.red,"red works only with red numbers")},g.prototype.imod=function(e){return this.prime?this.prime.ireduce(e)._forceRed(this):e.mod(this.m)._forceRed(this)},g.prototype.neg=function(e){var t=e.clone();return t.sign=!t.sign,t.iadd(this.m)._forceRed(this)},g.prototype.add=function(e,t){this._verify2(e,t);var r=e.add(t);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},g.prototype.iadd=function(e,t){this._verify2(e,t);var r=e.iadd(t);return r.cmp(this.m)>=0&&r.isub(this.m),r},g.prototype.sub=function(e,t){this._verify2(e,t);var r=e.sub(t);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},g.prototype.isub=function(e,t){this._verify2(e,t);var r=e.isub(t);return r.cmpn(0)<0&&r.iadd(this.m),r},g.prototype.shl=function(e,t){return this._verify1(e),this.imod(e.shln(t))},g.prototype.imul=function(e,t){return this._verify2(e,t),this.imod(e.imul(t))},g.prototype.mul=function(e,t){return this._verify2(e,t),this.imod(e.mul(t))},g.prototype.isqr=function(e){return this.imul(e,e)},g.prototype.sqr=function(e){return this.mul(e,e)},g.prototype.sqrt=function(e){if(0===e.cmpn(0))return e.clone();var t=this.m.andln(3);if(r(t%2==1),3===t){var n=this.m.add(new i(1)).ishrn(2);return this.pow(e,n)}for(var o=this.m.subn(1),s=0;0!==o.cmpn(0)&&0===o.andln(1);)s++,o.ishrn(1);r(0!==o.cmpn(0));var a=new i(1).toRed(this),u=a.redNeg(),c=this.m.subn(1).ishrn(1),f=this.m.bitLength();for(f=new i(2*f*f).toRed(this);0!==this.pow(f,c).cmp(u);)f.redIAdd(u);for(var l=this.pow(f,o),h=this.pow(e,o.addn(1).ishrn(1)),p=this.pow(e,o),d=s;0!==p.cmp(a);){for(var y=p,g=0;0!==y.cmp(a);g++)y=y.redSqr();r(g<d);var m=this.pow(l,new i(1).ishln(d-g-1));h=h.redMul(m),l=m.redSqr(),p=p.redMul(l),d=g}return h},g.prototype.invm=function(e){var t=e._invmp(this.m);return t.sign?(t.sign=!1,this.imod(t).redNeg()):this.imod(t)},g.prototype.pow=function(e,t){var r=[];if(0===t.cmpn(0))return new i(1);for(var n=t.clone();0!==n.cmpn(0);)r.push(n.andln(1)),n.ishrn(1);for(var o=e,s=0;s<r.length&&0===r[s];s++,o=this.sqr(o));if(++s<r.length)for(n=this.sqr(o);s<r.length;s++,n=this.sqr(n))0!==r[s]&&(o=this.mul(o,n));return o},g.prototype.convertTo=function(e){return e.clone()},g.prototype.convertFrom=function(e){var t=e.clone();return t.red=null,t},i.mont=function(e){return new m(e)},n(m,g),m.prototype.convertTo=function(e){return this.imod(e.shln(this.shift))},m.prototype.convertFrom=function(e){var t=this.imod(e.mul(this.rinv));return t.red=null,t},m.prototype.imul=function(e,t){if(0===e.cmpn(0)||0===t.cmpn(0))return e.words[0]=0,e.length=1,e;var r=e.imul(t),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=r.isub(n).ishrn(this.shift),o=i;return i.cmp(this.m)>=0?o=i.isub(this.m):i.cmpn(0)<0&&(o=i.iadd(this.m)),o._forceRed(this)},m.prototype.mul=function(e,t){if(0===e.cmpn(0)||0===t.cmpn(0))return new i(0)._forceRed(this);var r=e.mul(t),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),o=r.isub(n).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.invm=function(e){return this.imod(e._invmp(this.m).mul(this.r2))._forceRed(this)}}(void 0===e||e,this)}).call(this,r(27)(e))},function(e,t){"function"==typeof Object.create?e.exports=function(e,t){e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})}:e.exports=function(e,t){e.super_=t;var r=function(){};r.prototype=t.prototype,e.prototype=new r,e.prototype.constructor=e}},function(e,t,r){var n=r(13);r(19),r(99);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)return 128&t?e.getInt((127&t)<<3):t};var s=function(e,t){var r=e.getByte();if(t--,128!==r){var n;if(128&r){var i=127&r;o(e,t,i),n=e.getInt(i<<3)}else n=r;if(n<0)throw new Error("Negative length: "+n);return n}};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)),function e(t,r,n,a){var u;o(t,r,2);var c=t.getByte();r--;var f=192&c,l=31&c;u=t.length();var h,p,d=s(t,r);if(r-=u-t.length(),void 0!==d&&d>r){if(a.strict){var y=new Error("Too few bytes to read ASN.1 value.");throw y.available=t.length(),y.remaining=r,y.requested=d,y}d=r}var g=32==(32&c);if(g)if(h=[],void 0===d)for(;;){if(o(t,r,2),t.bytes(2)===String.fromCharCode(0,0)){t.getBytes(2),r-=2;break}u=t.length(),h.push(e(t,r,n+1,a)),r-=u-t.length()}else for(;d>0;)u=t.length(),h.push(e(t,d,n+1,a)),r-=u-t.length(),d-=u-t.length();if(void 0===h&&f===i.Class.UNIVERSAL&&l===i.Type.BITSTRING&&(p=t.bytes(d)),void 0===h&&a.decodeBitStrings&&f===i.Class.UNIVERSAL&&l===i.Type.BITSTRING&&d>1){var m=t.read,b=r,v=0;if(l===i.Type.BITSTRING&&(o(t,r,1),v=t.getByte(),r--),0===v)try{u=t.length();var _=e(t,r,n+1,{verbose:a.verbose,strict:!0,decodeBitStrings:!0}),w=u-t.length();r-=w,l==i.Type.BITSTRING&&w++;var S=_.tagClass;w!==d||S!==i.Class.UNIVERSAL&&S!==i.Class.CONTEXT_SPECIFIC||(h=[_])}catch(t){}void 0===h&&(t.read=m,r=b)}if(void 0===h){if(void 0===d){if(a.strict)throw new Error("Non-constructed ASN.1 object of indefinite length.");d=r}if(l===i.Type.BMPSTRING)for(h="";d>0;d-=2)o(t,r,2),h+=String.fromCharCode(t.getInt16()),r-=2;else h=t.getBytes(d)}var k=void 0===p?null:{bitStringContents:p};return i.create(f,l,g,h,k)}(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(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(a=c.length-1;a>=0;--a)t.putByte(c.charCodeAt(a))}return t.putBuffer(o),t},i.oidToDer=function(e){var t,r,i,o,s=e.split("."),a=n.util.createBuffer();a.putByte(40*parseInt(s[0],10)+parseInt(s[1],10));for(var u=2;u<s.length;++u){t=!0,r=[],i=parseInt(s[u],10);do{o=127&i,i>>>=7,t||(o|=128),r.push(o),t=!1}while(i>0);for(var c=r.length-1;c>=0;--c)a.putByte(r[c])}return a},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;)i<<=7,128&(r=e.getByte())?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)){var f=60*parseInt(e.substr(c+1,2),10)+parseInt(e.substr(c+4,2),10);f*=6e4,"+"===u?t.setTime(+t-f):t.setTime(+t+f)}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);return"+"!==h&&"-"!==h||(c=60*parseInt(e.substr(l+1,2),10)+parseInt(e.substr(l+4,2),10),c*=6e4,"+"===h&&(c*=-1),f=!0),"."===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"},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"},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))?++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+'"');if(s&&r&&(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{if(0!==e.bitStringContents.charCodeAt(0))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 a=/[^\\u0000-\\u00ff]/;i.prettyPrint=function(e,t,r){var o="";t=t||0,r=r||2,t>0&&(o+="\n");for(var s="",u=0;u<t*r;++u)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){var c=0,f="";for(u=0;u<e.value.length;++u)void 0!==e.value[u]&&(c+=1,f+=i.prettyPrint(e.value[u],t+1,r),u+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?(a.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:a.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(13);e.exports=n.md=n.md||{},n.md.algorithms=n.md.algorithms||{}},function(e,t,r){"use strict";const n=r(1008),i=x("dns4"),o=x("dns6"),s=A(x("dnsaddr"),i,o),a=A(x("ip4"),x("ip6")),u=E(a,x("tcp")),c=E(a,x("udp")),f=E(c,x("utp")),l=A(E(s,x("tcp")),s),h=A(E(u,x("ws")),E(l,x("ws"))),p=A(E(u,x("wss")),E(l,x("wss"))),d=A(E(u,x("http")),E(l),E(l,x("http"))),y=A(E(h,x("p2p-webrtc-star"),x("ipfs")),E(p,x("p2p-webrtc-star"),x("ipfs"))),g=A(E(h,x("p2p-websocket-star"),x("ipfs")),E(p,x("p2p-websocket-star"),x("ipfs")),E(h,x("p2p-websocket-star")),E(p,x("p2p-websocket-star"))),m=E(d,x("p2p-webrtc-direct")),b=A(h,p,d,y,m,u,f);let v=A(E(b,x("ipfs")),y,x("ipfs"));const _=A(E(v,x("p2p-circuit"),v),E(v,x("p2p-circuit")),E(x("p2p-circuit"),v),E(b,x("p2p-circuit")),E(x("p2p-circuit"),b),x("p2p-circuit")),w=()=>A(E(_,w),_),S=w(),k=A(E(S,v,S),E(v,S),E(S,v),S,v);function E(){const e=Array.from(arguments);function t(t){return t.length<e.length?null:(e.some(e=>{if(null===(t="function"==typeof e?e().partialMatch(t):e.partialMatch(t)))return!0}),t)}return{input:e,matches:function(e){"string"==typeof e&&(e=n(e));let r=t(e.protoNames());return null!==r&&0===r.length},partialMatch:t}}function A(){const e=Array.from(arguments);function t(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}return{toString:function(){return"{ "+e.join(" ")+" }"},input:e,matches:function(e){"string"==typeof e&&(e=n(e));const r=t(e.protoNames());return null!==r&&0===r.length},partialMatch:t}}function x(e){const t=e;return{toString:function(){return t},matches:function(e){"string"==typeof e&&(e=n(e));const r=e.protoNames();return 1===r.length&&r[0]===t},partialMatch:function(e){return 0===e.length?null:e[0]===t?e.slice(1):null}}}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.WebSockets=h,t.WebSocketsSecure=p,t.WebSocketStar=g,t.WebRTCStar=y,t.WebRTCDirect=m,t.Reliable=b,t.Circuit=S,t.IPFS=k},function(e,t){errors={};errors.CodingError=class extends Error{constructor(e){super(e||"Coding Error"),this.name="CodingError"}};errors.ToBeImplementedError=class extends Error{constructor(e){super("To be implemented: "+e),this.name="ToBeImplementedError"}};errors.TransportError=class extends Error{constructor(e){super(e||"Transport failure"),this.name="TransportError"}};errors.TimeoutError=class extends Error{constructor(e){super(e||"Timed out"),this.name="TimeoutError"}};errors.IntentionallyUnimplementedError=class extends Error{constructor(e){super(e||"Intentionally Unimplemented Function"),this.name="IntentionallyUnimplementedError"}},e.exports=errors},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=o(r(164)),i=o(r(743));function o(e){return e&&e.__esModule?e:{default:e}}t.default=(0,n.default)(i.default),e.exports=t.default},function(e,t){function r(e,t){if(!e)throw new Error(t||"Assertion failed")}e.exports=r,r.equal=function(e,t,r){if(e!=t)throw new Error(r||"Assertion failed: "+e+" != "+t)}},function(e,t,r){"use strict";(function(t){var n=r(18),i=r(21),o=r(24),s=r(32),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,t=this.buf.readUInt32LE(this.pos),r=4294967296*this.buf.readUInt32LE(this.pos+4)+t;if(r<=9007199254740991)e=new s(r);else{var n=Array.prototype.slice.call(this.buf,this.pos,this.pos+8);e=new s(n,10,"le")}return this.pos=this.pos+8,e},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().toNumber();if(t<=Math.pow(2,53))return t;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(){switch(this.buf.readUInt8(this.pos)){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(67),o=r(68),s=r(84),a=r(82),u=r(55),c=r(32),f=r(43),l=r(431),h=r(21),p=r(18),d=function(e,l,h,p){var d,y=r(250),g=r(251),m=y.shallowCopy(e);for((p=new o(p)).removeCodeseparators(),d=0;d<m.inputs.length;d++)m.inputs[d]=new g(m.inputs[d]).setScript(o.empty());if(m.inputs[h]=new g(m.inputs[h]).setScript(p),(31&l)===i.SIGHASH_NONE||(31&l)===i.SIGHASH_SINGLE)for(d=0;d<m.inputs.length;d++)d!==h&&(m.inputs[d].sequenceNumber=0);if((31&l)===i.SIGHASH_NONE)m.outputs=[];else if((31&l)===i.SIGHASH_SINGLE){if(h>=m.outputs.length)return new t("0000000000000000000000000000000000000000000000000000000000000001","hex");for(m.outputs.length=h+1,d=0;d<h;d++)m.outputs[d]=new s({satoshis:c.fromBuffer(new n.Buffer("ffffffffffffffff","hex")),script:o.empty()})}l&i.SIGHASH_ANYONECANPAY&&(m.inputs=[m.inputs[h]]);var b=(new u).write(m.toBuffer()).writeInt32LE(l).toBuffer(),v=f.sha256sha256(b);return new a(v).readReverse()};e.exports={sighash:d,sign:function(e,t,r,n,i){var o=d(e,r,n,i);return l.sign(o,t,"little").set({nhashtype:r})},verify:function(e,t,r,n,i){h.checkArgument(!p.isUndefined(e)),h.checkArgument(!p.isUndefined(t)&&!p.isUndefined(t.nhashtype));var o=d(e,t.nhashtype,n,i);return l.verify(o,t,r,"little")}}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";var n=r(18),i=r(32),o=r(0),s=r(24),a=r(29),u=r(55),c=r(68),f=r(21),l=r(66);function h(e){if(!(this instanceof h))return new h(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(h.prototype,"script",{configurable:!1,enumerable:!0,get:function(){return this._script?this._script:(this.setScriptFromBuffer(this._scriptBuffer),this._script)}}),Object.defineProperty(h.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")}}),h.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"},h.prototype.toObject=h.prototype.toJSON=function(){var e={satoshis:this.satoshis};return e.script=this._scriptBuffer.toString("hex"),e},h.fromObject=function(e){return new h(e)},h.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}},h.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},h.prototype.inspect=function(){var e;return e=this.script?this.script.inspect():this._scriptBuffer.toString("hex"),"<Output ("+this.satoshis+" sats) "+e+">"},h.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 h(t)},h.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=h},function(e,t,r){"use strict";var n=r(150),i=Object.keys||function(e){var t=[];for(var r in e)t.push(r);return t};e.exports=l;var o=r(117);o.inherits=r(5);var s=r(332),a=r(210);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(346);e.exports=function(e,t){if(!e)return function(e,r){return e?n(r,e,t):r(!0)};Array.isArray(e)||(e=Object.keys(e).map(function(t){return e[t]}));var r=0;return function(i,o){if(i)return n(o,i,t);r>=e.length?o(!0):o(null,e[r++])}}},function(e,t,r){"use strict";var n=r(212);e.exports=function(e){return n(function(e,t){return e.push(t),e},[],e)}},function(e,t){var r=Array.isArray;e.exports=r},function(e,t,r){var n=r(214),i=r(356);e.exports=function(e){return null!=e&&i(e.length)&&!n(e)}},function(e,t,r){e.exports=i;var n=r(11).EventEmitter;function i(){n.call(this)}r(5)(i,n),i.Readable=r(22),i.Writable=r(736),i.Duplex=r(737),i.Transform=r(738),i.PassThrough=r(739),i.Stream=i,i.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";(function(n){const i=r(12),o=r(17),s=r(61);(t=e.exports=s(class{constructor(e,t,r){o(r,"A link requires a multihash to point to"),this._name=e||"",this._size=t,"string"==typeof r?this._multihash=i.fromB58String(r):n.isBuffer(r)&&(this._multihash=r)}toString(){return`DAGLink <${i.toB58String(this.multihash)} - name: "${this.name}", size: ${this.size}>`}toJSON(){return{name:this.name,size:this.size,multihash:i.toB58String(this._multihash)}}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._multihash}set multihash(e){throw new Error("Can't set property: 'multihash' is immutable")}},{className:"DAGLink",symbolName:"@ipld/js-ipld-dag-pb/daglink"})).create=r(764),t.util=r(765)}).call(this,r(0).Buffer)},function(e,t,r){var n=r(2).Buffer,i=r(90).Transform,o=r(211).StringDecoder;function s(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}r(5)(s,i),s.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)},s.prototype.setAutoPadding=function(){},s.prototype.getAuthTag=function(){throw new Error("trying to get auth tag in unsupported state")},s.prototype.setAuthTag=function(){throw new Error("trying to set auth tag in unsupported state")},s.prototype.setAAD=function(){throw new Error("trying to set aad in unsupported state")},s.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)}},s.prototype._flush=function(e){var t;try{this.push(this.__final())}catch(e){t=e}e(t)},s.prototype._finalOrDigest=function(e){var t=this.__final()||n.alloc(0);return e&&(t=this._toString(t,e,!0)),t},s.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=s},function(e,t,r){var n=r(413);r(811),e.exports=n},function(e,t,r){"use strict";t.ethAccountSnapshot=r(416),t.ethBlock=r(426),t.ethBlockList=r(856),t.ethStateTrie=r(861),t.ethStorageTrie=r(864),t.ethTx=r(429),t.ethTxTrie=r(867)},function(e,t){},function(e,t,r){"use strict";var n=r(18),i=r(24),o=r(29),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}u.prototype.toString=function(){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 l=c("livenet");f({name:"testnet",alias:"regtest",pubkeyhash:7461,privatekey:239,scripthash:7354,xpubkey:70617039,xprivkey:70615956,zaddr:5814,zkey:44040});var h=c("testnet"),p={PORT:18233,NETWORK_MAGIC:i.integerAsBuffer(4187956406),DNS_SEEDS:["dnsseed.testnet.z.cash"]};for(var d in p)n.isObject(p[d])||(a[p[d]]=h);var y={PORT:18444,NETWORK_MAGIC:i.integerAsBuffer(2867347295),DNS_SEEDS:[]};for(var d in y)n.isObject(y[d])||(a[y[d]]=h);Object.defineProperty(h,"port",{enumerable:!0,configurable:!1,get:function(){return this.regtestEnabled?y.PORT:p.PORT}}),Object.defineProperty(h,"networkMagic",{enumerable:!0,configurable:!1,get:function(){return this.regtestEnabled?y.NETWORK_MAGIC:p.NETWORK_MAGIC}}),Object.defineProperty(h,"dnsSeeds",{enumerable:!0,configurable:!1,get:function(){return this.regtestEnabled?y.DNS_SEEDS:p.DNS_SEEDS}}),e.exports={add:f,remove:function(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]},defaultNetwork:l,livenet:l,mainnet:l,testnet:h,get:c,enableRegtest:function(){h.regtestEnabled=!0},disableRegtest:function(){h.regtestEnabled=!1}}},function(e,t,r){"use strict";(function(t){var n=r(18),i=r(21),o=r(66),s=r(129),a=r(96),u=r(43),c=r(29),f=r(73);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);return l._transformBuffer(n,t,r)},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){return new l(l._transformHash(e).hashBuffer,t,l.PayToPublicKeyHash)},l.fromScriptHash=function(e,t){return i.checkArgument(e,"hash parameter is required"),new l(l._transformHash(e).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){return i.checkState(c.isHexa(e.hash),'Unexpected hash property, "'+e.hash+'", expected to be hex.'),new l(new t(e.hash,"hex"),e.network,e.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");return t.concat([e,this.hashBuffer])},l.prototype.toObject=l.prototype.toJSON=function(){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(68)}).call(this,r(0).Buffer)},function(e,t,r){var n=r(13);function i(e,t){n.cipher.registerAlgorithm(e,function(){return new n.aes.Algorithm(e,t)})}r(257),r(446),r(19),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){f||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,r=e.key;if("string"!=typeof r||16!==r.length&&24!==r.length&&32!==r.length){if(n.util.isArray(r)&&(16===r.length||24===r.length||32===r.length)){t=r,r=n.util.createBuffer();for(var i=0;i<t.length;++i)r.putByte(t[i])}}else r=n.util.createBuffer(r);if(!n.util.isArray(r)){t=r,r=[];var o=t.length();if(16===o||24===o||32===o){o>>>=2;for(i=0;i<o;++i)r.push(t.getInt32())}}if(!n.util.isArray(r)||4!==r.length&&6!==r.length&&8!==r.length)throw new Error("Invalid key parameter.");var s=this.mode.name,a=-1!==["CFB","OFB","CTR","GCM"].indexOf(s);this._w=p(r,e.decrypt&&!a),this._init=!0}},n.aes._expandKey=function(e,t){return f||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,s,a,u,c,f=!1,l=4;function h(){f=!0,a=[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;o=new Array(256),s=new Array(256),u=new Array(4),c=new Array(4);for(t=0;t<4;++t)u[t]=new Array(256),c[t]=new Array(256);var r,n,i,l,h,p,d,y=0,g=0;for(t=0;t<256;++t){l=(l=g^g<<1^g<<2^g<<3^g<<4)>>8^255&l^99,o[y]=l,s[l]=y,p=(h=e[l])<<24^l<<16^l<<8^l^h,d=((r=e[y])^(n=e[r])^(i=e[n]))<<24^(y^i)<<16^(y^n^i)<<8^y^r^i;for(var m=0;m<4;++m)u[m][y]=p,c[m][l]=d,p=p<<24|p>>>8,d=d<<24|d>>>8;0===y?y=g=1:(y=r^e[e[e[r^i]]],g^=e[e[g]])}}function p(e,t){for(var r,n=e.slice(0),i=1,s=n.length,u=l*(s+6+1),f=s;f<u;++f)r=n[f-1],f%s==0?(r=o[r>>>16&255]<<24^o[r>>>8&255]<<16^o[255&r]<<8^o[r>>>24]^a[i]<<24,i++):s>6&&f%s==4&&(r=o[r>>>24]<<24^o[r>>>16&255]<<16^o[r>>>8&255]<<8^o[255&r]),n[f]=n[f-s]^r;if(t){for(var h,p=c[0],d=c[1],y=c[2],g=c[3],m=n.slice(0),b=(f=0,(u=n.length)-l);f<u;f+=l,b-=l)if(0===f||f===u-l)m[f]=n[b],m[f+1]=n[b+3],m[f+2]=n[b+2],m[f+3]=n[b+1];else for(var v=0;v<l;++v)h=n[b+v],m[f+(3&-v)]=p[o[h>>>24]]^d[o[h>>>16&255]]^y[o[h>>>8&255]]^g[o[255&h]];n=m}return n}function d(e,t,r,n){var i,a,f,l,h,p,d,y,g,m,b,v,_=e.length/4-1;n?(i=c[0],a=c[1],f=c[2],l=c[3],h=s):(i=u[0],a=u[1],f=u[2],l=u[3],h=o),p=t[0]^e[0],d=t[n?3:1]^e[1],y=t[2]^e[2],g=t[n?1:3]^e[3];for(var w=3,S=1;S<_;++S)m=i[p>>>24]^a[d>>>16&255]^f[y>>>8&255]^l[255&g]^e[++w],b=i[d>>>24]^a[y>>>16&255]^f[g>>>8&255]^l[255&p]^e[++w],v=i[y>>>24]^a[g>>>16&255]^f[p>>>8&255]^l[255&d]^e[++w],g=i[g>>>24]^a[p>>>16&255]^f[d>>>8&255]^l[255&y]^e[++w],p=m,d=b,y=v;r[0]=h[p>>>24]<<24^h[d>>>16&255]<<16^h[y>>>8&255]<<8^h[255&g]^e[++w],r[n?3:1]=h[d>>>24]<<24^h[y>>>16&255]<<16^h[g>>>8&255]<<8^h[255&p]^e[++w],r[2]=h[y>>>24]<<24^h[g>>>16&255]<<16^h[p>>>8&255]<<8^h[255&d]^e[++w],r[n?1:3]=h[g>>>24]<<24^h[p>>>16&255]<<16^h[d>>>8&255]<<8^h[255&y]^e[++w]}function y(e){var t,r="AES-"+((e=e||{}).mode||"CBC").toUpperCase(),i=(t=e.decrypt?n.cipher.createDecipher(r,e.key):n.cipher.createCipher(r,e.key)).start;return t.start=function(e,r){var o=null;r instanceof n.util.ByteBuffer&&(o=r,r={}),(r=r||{}).output=o,r.iv=e,i.call(t,r)},t}},function(e,t,r){var n=r(13);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(506),i=r(46),o=r(141),s=r(194);e.exports=function(e,t){(function(e){return"function"==typeof e})(e)&&(t=e,e={}),t=function(e){var t=0;return function(r,n,i){t++||e(r,n,i)}}(t||function(){});var r=n(e&&e.timeout||5e3),a=i(function(e){e&&t(e)}),u=s();return{handshake:{read:r.read,abort:function(e){a.end(e),r.abort(e,function(e){}),t(e)},write:a.push,rest:function(){return a.end(),{source:r.read(),sink:u.sink}}},sink:r,source:o([a,u.source])}}},function(e,t,r){const n=r(33),i=r(79),o=r(149);class s{constructor(e,t){t&&console.log("Transports(%o)",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.warn("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(e){return s._connected().find(e=>"HTTP"===e.name)}static ipfs(e){return s._connected().find(e=>"IPFS"===e.name)}static webtorrent(e){return s._connected().find(e=>"WEBTORRENT"===e.name)}static gun(e){return s._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,{verbose:r}){let n=[],o=await Promise.all(e.map(async function(e){try{return await e.p_rawstore(t,{verbose:r})}catch(t){return console.log("Could not rawstore to",e.name,t.message),void n.push(t)}}));if(!(o=o.filter(e=>!!e)).length)throw new i.TransportError(n.map(e=>e.message).join(", "));return o}static async p_rawstore(e,{verbose:t}){let r=this.validFor(void 0,"store").map(([e,t])=>t);if(t&&console.log("Valid for transports:",r.map(e=>e.name)),!r.length)throw new i.TransportError("Transports.p_rawstore: Cant find transport for store");return this._p_rawstore(r,e,{verbose:t})}static async p_rawlist(e,{verbose:t=!1}={}){e=await this.p_resolveNames(e);let r=this.validFor(e,"list");if(!r.length)throw new i.TransportError('Transports.p_rawlist: Cant find transport to "list" urls:'+e.join(","));let n=[],o=await Promise.all(r.map(async function([e,r]){try{return await r.p_rawlist(e,{verbose:t})}catch(t){return console.log("Could not rawlist ",e,"from",r.name,t.message),n.push(t),[]}}));if(n.length>=r.length)throw new i.TransportError(n.map(e=>e.message).join(", "));let s={};return[].concat(...o).filter(e=>!s[e.signature]&&(s[e.signature]=!0))}static async p_rawfetch(e,t){let r=t.verbose;if(!e.length)throw new i.TransportError("Transports.p_rawfetch given an empty list of urls");let n=await this.p_resolveNames(e);if(!n.length)throw new i.TransportError("Transports.p_rawfetch none of the urls resolved: "+e);let o=this.validFor(n,"fetch");if(!o.length)throw new i.TransportError("Transports.p_rawfetch cant find any transport for urls: "+n);let s=[],a=[];for(const[e,n]of o)try{let i=await n.p_rawfetch(e,t);return t.relay&&a.length&&(console.log(`Relaying ${i.length} bytes from ${"string"==typeof e?e:e.href} to ${a.map(e=>e.name)}`),this._p_rawstore(a,i,{verbose:r}).then(e=>console.log(`Relayed to ${e}`))),i}catch(t){a.push(n),s.push(t),console.log("Could not retrieve ",e&&e.href,"from",n&&n.name,t.message)}throw new i.TransportError(s.map(e=>e.message).join(", "))}static async p_rawadd(e,t,{verbose:r=!1}={}){e=await this.p_resolveNames(e);let n=this.validFor(e,"add");if(!n.length)throw new i.TransportError("Transports.p_rawstore: Cant find transport for urls:"+e.join(","));let o=[];if(await Promise.all(n.map(async function([e,n]){try{return void await n.p_rawadd(e,t,{verbose:r})}catch(t){return console.log("Could not rawlist ",e,"from",n.name,t.message),void o.push(t)}})),o.length>=n.length)throw new i.TransportError(o.map(e=>e.message).join(", "))}static listmonitor(e,t,r={}){this.validFor(e,"listmonitor").map(([e,n])=>n.listmonitor(e,t,r))}static async p_newlisturls(e,{verbose:t=!1}={}){let r=await Promise.all(this.validFor(void 0,"newlisturls").map(([r,n])=>n.p_newlisturls(e,{verbose:t})));return[r.map(e=>e[0]),r.map(e=>e[1])]}static async p_f_createReadStream(e,{verbose:t=!1,wanturl:r=!1}={}){let n=this.validFor(e,"createReadStream",{});if(!n.length)throw new i.TransportError("Transports.p_createReadStream cant find any transport for urls: "+e);let o,s=[];for(;(o=n.splice(Math.floor(Math.random()*n.length),1)).length;){let e=o[0][0],n=o[0][1];try{return await n.p_f_createReadStream(e,{verbose:t,wanturl:r})}catch(t){s.push(t),console.log("Could not retrieve ",e.href,"from",n.name,t.message)}}throw new i.TransportError(s.map(e=>e.message).join(", "))}static async p_get(e,t,{verbose:r=!1}={}){let n=this.validFor(e,"get");if(!n.length)throw new i.TransportError("Transports.p_get cant find any transport for urls: "+e);let o=[];for(const[e,i]of n)try{return await i.p_get(e,t,{verbose:r})}catch(t){o.push(t),console.log("Could not retrieve ",e.href,"from",i.name,t.message)}throw new i.TransportError(o.map(e=>e.message).join(", "))}static async p_set(e,t,r,{verbose:n=!1}={}){e=await this.p_resolveNames(e);let o=this.validFor(e,"set");if(!o.length)throw new i.TransportError("Transports.p_set cant find any transport for urls: "+e);let s=[],a=!1;if(await Promise.all(o.map(async function([e,i]){try{await i.p_set(e,t,r,{verbose:n}),a=!0}catch(e){console.log("Could not rawstore to",i.name,e.message),s.push(e)}})),!a)throw new i.TransportError(s.map(e=>e.message).join(", "))}static async p_delete(e,t,{verbose:r=!1}={}){e=await this.p_resolveNames(e);let n=this.validFor(e,"set");if(!n.length)throw new i.TransportError("Transports.p_set cant find any transport for urls: "+e);let o=[],s=!1;if(await Promise.all(n.map(async function([e,n]){try{await n.p_delete(e,t,{verbose:r}),s=!0}catch(e){console.log("Could not rawstore to",n.name,e.message),o.push(e)}})),!s)throw new i.TransportError(o.map(e=>e.message).join(", "))}static async p_keys(e,{verbose:t=!1}={}){e=await this.p_resolveNames(e);let r=this.validFor(e,"keys");if(!r.length)throw new i.TransportError("Transports.p_keys cant find any transport for urls: "+e);let n=[];for(const[e,i]of r)try{return await i.p_keys(e,{verbose:t})}catch(t){n.push(t),console.log("Could not retrieve keys for",e.href,"from",i.name,t.message)}throw new i.TransportError(n.map(e=>e.message).join(", "))}static async p_getall(e,{verbose:t=!1}={}){e=await this.p_resolveNames(e);let r=this.validFor(e,"getall");if(!r.length)throw new i.TransportError("Transports.p_getall cant find any transport for urls: "+e);let n=[];for(const[e,i]of r)try{return await i.p_getall(e,{verbose:t})}catch(t){n.push(t),console.log("Could not retrieve all keys for",e.href,"from",i.name,t.message)}throw new i.TransportError(n.map(e=>e.message).join(", "))}static async p_newdatabase(e,{verbose:t=!1}={}){let r=await Promise.all(this.validFor(void 0,"newdatabase").map(([r,n])=>n.p_newdatabase(e,{verbose:t})));return{privateurls:r.map(e=>e.privateurl),publicurls:r.map(e=>e.publicurl)}}static async p_newtable(e,t,{verbose:r=!1}={}){let n=await Promise.all(this.validFor(void 0,"newtable").map(([n,i])=>i.p_newtable(e,t,{verbose:r})));return{privateurls:n.map(e=>e.privateurl),publicurls:n.map(e=>e.publicurl)}}static async p_connection(e,t){e=await this.p_resolveNames(e),await Promise.all(this.validFor(e,"connection").map(([e,r])=>r.p_connection(e,t)))}static monitor(e,t,{verbose:r=!1,current:n=!1}={}){this.validFor(e,"monitor").map(([e,i])=>i.monitor(e,t,{verbose:r,current:n}))}static addtransport(e){s._transports.push(e)}static setup0(e,t,r,n){let i={http:{urlbase:"http://localhost:4244"}};return e.map(e=>{let n;if(n="LOCAL"===e?this._transportclasses.HTTP:this._transportclasses[e])return n.setup0("LOCAL"===e?i:t,r);{let t=Object.keys(this._transportclasses);return void console.error(`Requested ${e} but ${t.length?t:"No"} transports have been loaded`)}}).filter(e=>!!e)}static async p_setup1(e,t){await Promise.all(this._transports.filter(e=>!this._optionspaused.includes(e.name)).map(r=>r.p_setup1(e,t)))}static async p_setup2(e,t){await Promise.all(this._transports.filter(e=>!this._optionspaused.includes(e.name)).map(r=>r.p_setup2(e,t)))}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])),s.statuscb&&s.statuscb(e)}static async p_connect(e,t){t&&console.group("p_connect ---");try{let r=(e=e||{}).transports;this._optionspaused=(e.paused||[]).map(e=>e.toUpperCase()),r&&r.length||(r=e.defaulttransports||[]),r.length||(r=["HTTP","YJS","IPFS","WEBTORRENT","GUN"]),r=r.map(e=>e.toUpperCase());let n=this.setup0(r,e,t);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",{},n.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(t,this.refreshstatus),await this.p_setup2(t,this.refreshstatus)}catch(e){throw console.error("ERROR in p_connect:",e.message),e}t&&console.groupEnd("p_connect ---")}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 s.http()._url(e.find(e=>e.startsWith("contenthash")||e.startsWith("http")),"content/rawfetch")}static async test(e){e&&console.log("Transports.test")}}s._transports=[],s.namingcb=void 0,s._transportclasses={},e.exports=s},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(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},e.exports=t.default},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){return function(){if(null===e)throw new Error("Callback was already called.");var t=e;e=null,t.apply(this,arguments)}},e.exports=t.default},function(e,t,r){(function(e,n){var i=/%[sdj%]/g;t.format=function(e){if(!b(e)){for(var t=[],r=0;r<arguments.length;r++)t.push(a(arguments[r]));return t.join(" ")}r=1;for(var 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])g(u)||!w(u)?s+=" "+u:s+=" "+a(u);return s},t.deprecate=function(r,i){if(v(e.process))return function(){return t.deprecate(r,i).apply(this,arguments)};if(!0===n.noDeprecation)return r;var o=!1;return function(){if(!o){if(n.throwDeprecation)throw new Error(i);n.traceDeprecation?console.trace(i):console.error(i),o=!0}return r.apply(this,arguments)}};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]),y(r)?n.showHidden=r:r&&t._extend(n,r),v(n.showHidden)&&(n.showHidden=!1),v(n.depth)&&(n.depth=2),v(n.colors)&&(n.colors=!1),v(n.customInspect)&&(n.customInspect=!0),n.colors&&(n.stylize=u),f(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,r,n){if(e.customInspect&&r&&E(r.inspect)&&r.inspect!==t.inspect&&(!r.constructor||r.constructor.prototype!==r)){var i=r.inspect(n,e);return b(i)||(i=f(e,i,n)),i}var o=l(e,r);if(o)return o;var s=Object.keys(r),a=function(e){var t={};return e.forEach(function(e,r){t[e]=!0}),t}(s);if(e.showHidden&&(s=Object.getOwnPropertyNames(r)),k(r)&&(s.indexOf("message")>=0||s.indexOf("description")>=0))return h(r);if(0===s.length){if(E(r)){var u=r.name?": "+r.name:"";return e.stylize("[Function"+u+"]","special")}if(_(r))return e.stylize(RegExp.prototype.toString.call(r),"regexp");if(S(r))return e.stylize(Date.prototype.toString.call(r),"date");if(k(r))return h(r)}var c,y="",g=!1,m=["{","}"];return d(r)&&(g=!0,m=["[","]"]),E(r)&&(y=" [Function"+(r.name?": "+r.name:"")+"]"),_(r)&&(y=" "+RegExp.prototype.toString.call(r)),S(r)&&(y=" "+Date.prototype.toUTCString.call(r)),k(r)&&(y=" "+h(r)),0!==s.length||g&&0!=r.length?n<0?_(r)?e.stylize(RegExp.prototype.toString.call(r),"regexp"):e.stylize("[Object]","special"):(e.seen.push(r),c=g?function(e,t,r,n,i){for(var o=[],s=0,a=t.length;s<a;++s)T(t,String(s))?o.push(p(e,t,r,n,String(s),!0)):o.push("");return i.forEach(function(i){i.match(/^\d+$/)||o.push(p(e,t,r,n,i,!0))}),o}(e,r,n,a,s):s.map(function(t){return p(e,r,n,a,t,g)}),e.seen.pop(),function(e,t,r){return e.reduce(function(e,t){return 0,t.indexOf("\n")>=0&&0,e+t.replace(/\u001b\[\d\d?m/g,"").length+1},0)>60?r[0]+(""===t?"":t+"\n ")+" "+e.join(",\n ")+" "+r[1]:r[0]+t+" "+e.join(", ")+" "+r[1]}(c,y,m)):m[0]+y+m[1]}function l(e,t){if(v(t))return e.stylize("undefined","undefined");if(b(t)){var r="'"+JSON.stringify(t).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return e.stylize(r,"string")}return m(t)?e.stylize(""+t,"number"):y(t)?e.stylize(""+t,"boolean"):g(t)?e.stylize("null","null"):void 0}function h(e){return"["+Error.prototype.toString.call(e)+"]"}function p(e,t,r,n,i,o){var s,a,u;if((u=Object.getOwnPropertyDescriptor(t,i)||{value:t[i]}).get?a=u.set?e.stylize("[Getter/Setter]","special"):e.stylize("[Getter]","special"):u.set&&(a=e.stylize("[Setter]","special")),T(n,i)||(s="["+i+"]"),a||(e.seen.indexOf(u.value)<0?(a=g(r)?f(e,u.value,null):f(e,u.value,r-1)).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")),v(s)){if(o&&i.match(/^\d+$/))return a;(s=JSON.stringify(""+i)).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 d(e){return Array.isArray(e)}function y(e){return"boolean"==typeof e}function g(e){return null===e}function m(e){return"number"==typeof e}function b(e){return"string"==typeof e}function v(e){return void 0===e}function _(e){return w(e)&&"[object RegExp]"===A(e)}function w(e){return"object"==typeof e&&null!==e}function S(e){return w(e)&&"[object Date]"===A(e)}function k(e){return w(e)&&("[object Error]"===A(e)||e instanceof Error)}function E(e){return"function"==typeof e}function A(e){return Object.prototype.toString.call(e)}function x(e){return e<10?"0"+e.toString(10):e.toString(10)}t.debuglog=function(e){if(v(o)&&(o=n.env.NODE_DEBUG||""),e=e.toUpperCase(),!s[e])if(new RegExp("\\b"+e+"\\b","i").test(o)){var r=n.pid;s[e]=function(){var n=t.format.apply(t,arguments);console.error("%s %d: %s",e,r,n)}}else s[e]=function(){};return s[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=d,t.isBoolean=y,t.isNull=g,t.isNullOrUndefined=function(e){return null==e},t.isNumber=m,t.isString=b,t.isSymbol=function(e){return"symbol"==typeof e},t.isUndefined=v,t.isRegExp=_,t.isObject=w,t.isDate=S,t.isError=k,t.isFunction=E,t.isPrimitive=function(e){return null===e||"boolean"==typeof e||"number"==typeof e||"string"==typeof e||"symbol"==typeof e||void 0===e},t.isBuffer=r(688);var I=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function T(e,t){return Object.prototype.hasOwnProperty.call(e,t)}t.log=function(){console.log("%s - %s",function(){var e=new Date,t=[x(e.getHours()),x(e.getMinutes()),x(e.getSeconds())].join(":");return[e.getDate(),I[e.getMonth()],t].join(" ")}(),t.format.apply(t,arguments))},t.inherits=r(689),t._extend=function(e,t){if(!t||!w(t))return e;for(var r=Object.keys(t),n=r.length;n--;)e[r[n]]=t[r[n]];return e}}).call(this,r(6),r(7))},function(e,t,r){var n=r(123);function i(e){return n("rmd160").update(e).digest()}function o(e){return n("sha256").update(e).digest()}e.exports={hash160:function(e){return i(o(e))},hash256:function(e){return o(o(e))},ripemd160:i,sha1:function(e){return n("sha1").update(e).digest()},sha256:o}},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];a+=c,(s+=c)%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){var i=r(2).Buffer,o=t.crypto||t.msCrypto;o&&o.getRandomValues?e.exports=function(e,r){if(e>65536)throw new Error("requested too many random bytes");var s=new t.Uint8Array(e);e>0&&o.getRandomValues(s);var a=i.from(s.buffer);return"function"==typeof r?n.nextTick(function(){r(null,a)}):a}:e.exports=function(){throw new Error("Secure random number generation is not supported by this browser.\nUse Chrome, Firefox or Internet Explorer 11")}}).call(this,r(6),r(7))},function(e,t,r){"use strict";(function(t){var n=r(32),i=r(24),o=r(72).curves.secp256k1,s=o.curve.point.bind(o.curve),a=o.curve.pointFromX.bind(o.curve),u=function(e,t,r){var n=s(e,t,r);return n.validate(),n};u.prototype=Object.getPrototypeOf(o.curve.point()),u.fromX=function(e,t){var r=a(e,t);return r.validate(),r},u.getG=function(){return o.curve.g},u.getN=function(){return new n(o.curve.n.toArray())},u.prototype._getX=u.prototype.getX,u.prototype.getX=function(){return new n(this._getX().toArray())},u.prototype._getY=u.prototype.getY,u.prototype.getY=function(){return new n(this._getY().toArray())},u.prototype.validate=function(){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.");if(0!==a(this.getY().isOdd(),this.getX()).y.cmp(this.y))throw new Error("Invalid y value for curve.");var e=this.getX().gt(n.Minus1)&&this.getX().lt(u.getN()),t=this.getY().gt(n.Minus1)&&this.getY().lt(u.getN());if(!e||!t)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){var r,n=e.getX().toBuffer({size:32}),o=e.getY().toBuffer({size:32}),s=o[o.length-1]%2;return r=new t(s?[3]:[2]),i.concat([r,n])},e.exports=u}).call(this,r(0).Buffer)},function(e,t,r){var n=t;n.utils=r(877),n.common=r(878),n.sha=r(879),n.ripemd=r(880),n.hmac=r(881),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(n){const i=r(12),o=r(111),s=r(17),a=r(4);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).create=function(e,t){"function"==typeof e&&(t=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(438),i=r(904),o=r(915);(t=e.exports).aes=i,t.hmac=n,t.keys=o,t.randomBytes=r(474),t.pbkdf2=r(955)},function(e,t,r){var n=r(13);r(19);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";var o=0,s=-1;for(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,i="-----BEGIN "+e.type+"-----\r\n";if(e.procType&&(i+=o(r={name:"Proc-Type",values:[String(e.procType.version),e.procType.type]})),e.contentDomain&&(i+=o(r={name:"Content-Domain",values:[e.contentDomain]})),e.dekInfo&&(r={name:"DEK-Info",values:[e.dekInfo.algorithm]},e.dekInfo.parameters&&r.values.push(e.dekInfo.parameters),i+=o(r)),e.headers)for(var s=0;s<e.headers.length;++s)i+=o(e.headers[s]);return e.procType&&(i+="\r\n"),(i+=n.util.encode64(e.body,t.maxline||64)+"\r\n")+"-----END "+e.type+"-----\r\n"},i.decode=function(e){for(var t,r=[],i=/\s*-----BEGIN ([A-Z0-9- ]+)-----\r?\n?([\x21-\x7e\s]+?(?:\r?\n\r?\n))?([:A-Za-z0-9+\/=\s]+?)-----END \1-----/g,o=/([\x21-\x7e]+):\s*([\x21-\x7e\s^:]+)/,a=/\r?\n/;t=i.exec(e);){var u={type:t[1],procType:null,contentDomain:null,dekInfo:null,headers:[],body:n.util.decode64(t[3])};if(r.push(u),t[2]){for(var c=t[2].split(a),f=0;t&&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(t=l.match(o)){for(var d={name:t[1],values:[]},y=t[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===r.length)throw new Error("Invalid PEM formatted message.");return r}},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 function(e){for(var t in n.prototype)e[t]=n.prototype[t];return e}(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,n=this._callbacks["$"+e];if(!n)return this;if(1==arguments.length)return delete this._callbacks["$"+e],this;for(var i=0;i<n.length;i++)if((r=n[i])===t||r.fn===t){n.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)for(var n=0,i=(r=r.slice(0)).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,i=r(1100),o=r(520),s=r(1102),a=r(1103),u=r(1104);e&&e.ArrayBuffer&&(n=r(1105));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=i(h),d={type:"error",data:"parser error"},y=r(1106);function g(e,r){return r("b"+t.packets[e.type]+e.data.data)}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);if(l)return function(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)}(e,r,n);var i=new Uint8Array(1);return i[0]=h[e.type],n(new y([i.buffer,e.data]))}function v(e){try{e=u.decode(e,{strict:!1})}catch(e){return!1}return e}function _(e,t,r){for(var n=new Array(e.length),i=a(e.length,r),o=function(e,r,i){t(r,function(t,r){n[e]=r,i(t,n)})},s=0;s<e.length;s++)o(s,e[s],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 b(t,r,i);if(o&&o.base64)return g(t,i);var s=h[t.type];return void 0!==t.data&&(s+=n?u.encode(String(t.data),{strict:!1}):String(t.data)),i(""+s)},t.encodeBase64Packet=function(r,n){var i,o="b"+t.packets[r.type];if(y&&r.data instanceof e.Blob){var s=new FileReader;return s.onload=function(){var e=s.result.split(",")[1];n(o+e)},s.readAsDataURL(r.data)}try{i=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];i=String.fromCharCode.apply(null,u)}return o+=e.btoa(i),n(o)},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&&!1===(e=v(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}i=new Uint8Array(e)[0];var o=s(e,1);return y&&"blob"===r&&(o=new y([o])),{type:p[i],data:o}},t.decodeBase64Packet=function(e,t){var r=p[e.charAt(0)];if(!n)return{type:r,data:{base64:!0,data:e.substr(1)}};var i=n.decode(e.substr(1));return"blob"===t&&y&&(i=new y([i])),{type:r,data:i}},t.encodePayload=function(e,r,n){"function"==typeof r&&(n=r,r=null);var i=o(e);if(r&&i)return y&&!l?t.encodePayloadAsBlob(e,n):t.encodePayloadAsArrayBuffer(e,n);if(!e.length)return n("0:");_(e,function(e,n){t.encodePacket(e,!!i&&r,!1,function(e){n(null,function(e){return e.length+":"+e}(e))})},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(""===a||a!=(o=Number(a)))return n(d,0,1);if(a!=(s=e.substr(u+1,o)).length)return n(d,0,1);if(s.length){if(i=t.decodePacket(s,r,!1),d.type===i.type&&d.data===i.data)return n(d,0,1);if(!1===n(i,u+o,c))return}u+=o,a=""}else a+=f}return""!==a?n(d,0,1):void 0},t.encodePayloadAsArrayBuffer=function(e,r){if(!e.length)return r(new ArrayBuffer(0));_(e,function(e,r){t.encodePacket(e,!0,!0,function(e){return r(null,e)})},function(e,t){var n=t.reduce(function(e,t){var r;return e+(r="string"==typeof t?t.length:t.byteLength).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;var a=r.byteLength.toString();for(s=0;s<a.length;s++)i[o++]=parseInt(a[s]);i[o++]=255;for(n=new Uint8Array(r),s=0;s<n.length;s++)i[o++]=n[s]}),r(i.buffer)})},t.encodePayloadAsBlob=function(e,r){_(e,function(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}var o=(e instanceof ArrayBuffer?e.byteLength:e.size).toString(),s=new Uint8Array(o.length+1);for(i=0;i<o.length;i++)s[i]=parseInt(o[i]);if(s[o.length]=255,y){var a=new y([t.buffer,s.buffer,e]);r(null,a)}})},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,o=[];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=s(i,2+c.length),c=parseInt(c);var l=s(i,0,c);if(u)try{l=String.fromCharCode.apply(null,new Uint8Array(l))}catch(e){var h=new Uint8Array(l);l="";for(f=0;f<h.length;f++)l+=String.fromCharCode(h[f])}o.push(l),i=s(i,c)}var p=o.length;o.forEach(function(e,i){n(t.decodePacket(e,r,!0),i,p)})}}).call(this,r(6))},function(e,t,r){const n=r(33),i=(r(22),r(79));function o(e,t){return new Promise(r=>{setTimeout(()=>{r(t)},e)})}class s{constructor(e,t){}static setup0(e,t){throw new i.IntentionallyUnimplementedError("Intentionally undefined function Transport.setup0 should have been subclassed")}p_setup1(e,t){return this}p_setup2(e,t){return this}static async p_setup(e,t,r){return(await this.setup0(e,t).p_setup1(t,r)).p_setup2(t,r)}togglePaused(e){switch(this.status){case s.STATUS_CONNECTED:this.status=s.STATUS_PAUSED;break;case s.STATUS_PAUSED:this.status=s.STATUS_CONNECTED}e&&e(this)}async p_status(e){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 i.ToBeImplementedError("Intentionally undefined function Transport.p_rawstore should have been subclassed")}async p_rawstoreCaught(e,{verbose:t}){try{return await this.p_rawstore(e,{verbose:t})}catch(e){}}p_store(){throw new i.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,verbose:o=!1}={}){return console.assert(!1,"Intentionally undefined function Transport.p_rawfetch should have been subclassed"),"UNIMPLEMENTED"}p_fetch(){throw new i.ToBeImplementedError("Undefined function Transport.p_fetch - may define higher level semantics here (see Python)")}p_rawadd(e,t,{verbose:r=!1}={}){throw new i.ToBeImplementedError("Undefined function Transport.p_rawadd")}p_rawlist(e,{verbose:t=!1}={}){throw new i.ToBeImplementedError("Undefined function Transport.p_rawlist")}p_list(){throw new Error("Undefined function Transport.p_list")}p_newlisturls(e,{verbose:t=!1}={}){throw new Error("undefined function Transport.p_newlisturls")}p_rawreverse(e,{verbose:t=!1}={}){throw new i.ToBeImplementedError("Undefined function Transport.p_rawreverse")}listmonitor(e,t,{verbose:r=!1,current:n=!1}={}){console.log("Undefined function Transport.listmonitor")}async p_newdatabase(e,{verbose:t=!1}={}){throw new i.ToBeImplementedError("Undefined function Transport.p_newdatabase")}async p_newtable(e,t,{verbose:r=!1}={}){throw new i.ToBeImplementedError("Undefined function Transport.p_newtable")}async p_set(e,t,r,{verbose:n=!1}={}){throw new i.ToBeImplementedError("Undefined function Transport.p_set")}async p_get(e,t,{verbose:r=!1}={}){throw new i.ToBeImplementedError("Undefined function Transport.p_get")}async p_delete(e,t,{verbose:r=!1}={}){throw new i.ToBeImplementedError("Undefined function Transport.p_delete")}async p_keys(e,{verbose:t=!1}={}){throw new i.ToBeImplementedError("Undefined function Transport.p_keys")}async p_getall(e,{verbose:t=!1}={}){throw new i.ToBeImplementedError("Undefined function Transport.p_keys")}static async p_f_createReadStream(e,{wanturl:t=!1,verbose:r=!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]=s.mergeoptions(e[r],n[r]):t[r]=n[r]}}return t}async p_test_list({urlexpectedsubstring:e,verbose:t=!1}={}){t&&console.log(this.name,"p_test_kvt");try{let r=(await this.p_newlisturls("NACL VERIFY:1234567LIST",{verbose:t})).publicurl;t&&console.log("newlisturls=",r),console.assert(!e||r.includes(e)),await this.p_rawadd(r,"testvalue",{verbose:t});let n=await this.p_rawlist(r,{verbose:t});console.assert(1===n.length&&"testvalue"===n[0]),await this.p_rawadd(r,{foo:"bar"},{verbose:t}),n=await this.p_rawlist(r,{verbose:t}),console.assert(2===n.length&&"bar"===n[1].foo),await this.p_rawadd(r,[1,2,3],{verbose:t}),n=await this.p_rawlist(r,{verbose:t}),console.assert(2===n.length&&3===n[2].length&&2===n[2][1]),await o(200),t&&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,t=!1){t&&console.log(this.name,"p_test_kvt");try{let r=(await this.p_newtable("NACL VERIFY:1234567KVT","mytable",{verbose:t})).publicurl;t&&console.log("newtable=",r),console.assert(r.includes(e)),await this.p_set(r,"testkey","testvalue",{verbose:t});let n=await this.p_get(r,"testkey",{verbose:t});console.assert("testvalue"===n),await this.p_set(r,"testkey2",{foo:"bar"},{verbose:t}),n=await this.p_get(r,"testkey2",{verbose:t}),console.assert("bar"===n.foo),await this.p_set(r,"testkey3",[1,2,3],{verbose:t}),n=await this.p_get(r,"testkey3",{verbose:t}),console.assert(2===n[1]),n=await this.p_keys(r,{verbose:t}),console.assert(n.includes("testkey")&&n.includes("testkey3")&&3===n.length),await this.p_delete(r,["testkey"],{verbose:t}),n=await this.p_getall(r,{verbose:t}),t&&console.log("getall=>",n),console.assert("bar"===n.testkey2.foo&&2===n.testkey3[1]&&!n.testkey),await o(200),t&&console.log(this.name,"p_test_kvt complete")}catch(e){throw console.log("Exception thrown in ",this.name,"p_test_kvt:",e.message),e}}}s.STATUS_CONNECTED=0,s.STATUS_FAILED=1,s.STATUS_STARTING=2,s.STATUS_LOADED=3,s.STATUS_PAUSED=4,e.exports=s},function(e,t,r){(function(e){function r(e){return Object.prototype.toString.call(e)}t.isArray=function(e){return Array.isArray?Array.isArray(e):"[object Array]"===r(e)},t.isBoolean=function(e){return"boolean"==typeof e},t.isNull=function(e){return null===e},t.isNullOrUndefined=function(e){return null==e},t.isNumber=function(e){return"number"==typeof e},t.isString=function(e){return"string"==typeof e},t.isSymbol=function(e){return"symbol"==typeof e},t.isUndefined=function(e){return void 0===e},t.isRegExp=function(e){return"[object RegExp]"===r(e)},t.isObject=function(e){return"object"==typeof e&&null!==e},t.isDate=function(e){return"[object Date]"===r(e)},t.isError=function(e){return"[object Error]"===r(e)||e instanceof Error},t.isFunction=function(e){return"function"==typeof e},t.isPrimitive=function(e){return null===e||"boolean"==typeof e||"number"==typeof e||"string"==typeof e||"symbol"==typeof e||void 0===e},t.isBuffer=e.isBuffer}).call(this,r(0).Buffer)},function(e,t,r){"use strict";e.exports=function(e,t){var r,n;function i(o){if(r=o,n)return i.abort();!function i(){for(var o=!0,s=!1;o;)if(s=!1,r(null,function(a,u){if(s=!0,a=a||n){if(o=!1,t)t(!0===a?null:a);else if(a&&!0!==a)throw a}else e&&!1===e(u)||n?(o=!1,r(n||!0,t||function(){})):o||i()}),!s)return void(o=!1)}()}return i.abort=function(e,t){if("function"==typeof e&&(t=e,e=!0),n=e||!0,r)return r(n,t||function(){})},i}},function(e,t){e.exports=function(e){return e&&("string"==typeof e?function(t){return t[e]}:"object"==typeof e&&"function"==typeof e.exec?function(t){var r=e.exec(t);return r&&r[0]}:e)}},function(e,t,r){"use strict";var n=r(349);e.exports=function(e){return e=n(e),function(t){return function r(n,i){for(var o,s=!0;s;)s=!1,o=!0,t(n,function(t,n){if(!t&&!e(n))return o?s=!0:r(t,i);i(t,n)}),o=!1}}}},function(e,t){e.exports=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}},function(e,t,r){var n;!function(i){"use strict";var o,s=20,a=1,u=1e6,c=-7,f=21,l="[big.js] ",h=l+"Invalid ",p=h+"decimal places",d=h+"rounding mode",y=l+"Division by zero",g={},m=void 0,b=/^-?(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i;function v(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]!==m||1&i[o-1]);else if(3===r)n=n||i[o]!==m||o<0;else if(n=!1,0!==r)throw Error(d);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(d);return e}function _(e,t,r,n){var i,o,s=e.constructor,a=!e.c[0];if(r!==m){if(r!==~~r||r<(3==t)||r>u)throw Error(3==t?h+"precision":p);for(r=n-(e=new s(e)).e,e.c.length>++n&&v(e,r,s.RM),2==t&&(n=e.e+r+1);e.c.length<n;)e.c.push(0)}if(i=e.e,r=(o=e.c.join("")).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}g.abs=function(){var e=new this.constructor(this);return e.s=1,e},g.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},g.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(p);if(!i[0])throw Error(y);if(!n[0])return new r(0*o);var a,c,f,l,h,d=i.slice(),g=a=i.length,b=n.length,_=n.slice(0,a),w=_.length,S=e,k=S.c=[],E=0,A=s+(S.e=t.e-e.e)+1;for(S.s=o,o=A<0?0:A,d.unshift(0);w++<a;)_.push(0);do{for(f=0;f<10;f++){if(a!=(w=_.length))l=a>w?1:-1;else for(h=-1,l=0;++h<a;)if(i[h]!=_[h]){l=i[h]>_[h]?1:-1;break}if(!(l<0))break;for(c=w==a?i:d;w;){if(_[--w]<c[w]){for(h=w;h&&!_[--h];)_[h]=9;--_[h],_[w]+=10}_[w]-=c[w]}for(;!_[0];)_.shift()}k[E++]=l?f:++f,_[0]&&l?_[w]=n[g]||0:_=[n[g]]}while((g++<b||_[0]!==m)&&o--);return k[0]||1==E||(k.shift(),S.e--),E>A&&v(S,s,r.RM,_[0]!==m),S},g.eq=function(e){return!this.cmp(e)},g.gt=function(e){return this.cmp(e)>0},g.gte=function(e){return this.cmp(e)>-1},g.lt=function(e){return this.cmp(e)<0},g.lte=function(e){return this.cmp(e)<1},g.minus=g.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},g.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(y);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)))},g.plus=g.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},g.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(h+"exponent");for(i&&(e=-e);1&e&&(n=n.times(t)),e>>=1;)t=t.times(t);return i?r.div(n):n},g.round=function(e,t){var r=this.constructor;if(e===m)e=0;else if(e!==~~e||e<0||e>u)throw Error(p);return v(new r(this),e,t===m?r.RM:t)},g.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(l+"No square root");0===(o=Math.sqrt(n.toString()))||o===1/0?((t=n.c.join("")).length+s&1||(t+="0"),(e=new i(Math.sqrt(t).toString())).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 v(e,i.DP-=4,i.RM)},g.times=g.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},g.toExponential=function(e){return _(this,1,e,e)},g.toFixed=function(e){return _(this,2,e,this.e+e)},g.toPrecision=function(e){return _(this,3,e,e-1)},g.toString=function(){return _(this)},g.valueOf=g.toJSON=function(){return _(this,4)},(o=function e(){function t(r){var n=this;if(!(n instanceof t))return r===m?e():new t(r);r instanceof t?(n.s=r.s,n.e=r.e,n.c=r.c.slice()):function(e,t){var r,n,i;if(0===t&&1/t<0)t="-0";else if(!b.test(t+=""))throw Error(h+"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++)}}(n,r),n.constructor=t}return t.prototype=g,t.DP=s,t.RM=a,t.NE=c,t.PE=f,t.version="5.0.2",t}()).default=o.Big=o,void 0===(n=function(){return o}.call(t,r,t,e))||(e.exports=n)}()},function(e,t,r){"use strict";var n=r(5),i=r(237),o=r(409),s=r(410),a=r(92);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){return"md5"===(e=e.toLowerCase())?new i:"rmd160"===e||"ripemd160"===e?new o:new u(s(e))}},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(71),i=r(81);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){if(e=n.toArray(e,t),this.pending?this.pending=this.pending.concat(e):this.pending=e,this.pendingTotal+=e.length,this.pending.length>=this._delta8){var r=(e=this.pending).length%this._delta8;this.pending=e.slice(e.length-r,e.length),0===this.pending.length&&(this.pending=null),e=n.join32(e,0,e.length-r,this.endian);for(var i=0;i<e.length;i+=this._delta32)this._update(e,i,i+this._delta32)}return this},o.prototype.digest=function(e){return this.update(this._pad()),i(null===this.pending),this._digest(e)},o.prototype._pad=function(){var e=this.pendingTotal,t=this._delta8,r=t-(e+this.padLength)%t,n=new Array(r+this.padLength);n[0]=128;for(var i=1;i<r;i++)n[i]=0;if(e<<=3,"big"===this.endian){for(var o=8;o<this.padLength;o++)n[i++]=0;n[i++]=0,n[i++]=0,n[i++]=0,n[i++]=0,n[i++]=e>>>24&255,n[i++]=e>>>16&255,n[i++]=e>>>8&255,n[i++]=255&e}else for(n[i++]=255&e,n[i++]=e>>>8&255,n[i++]=e>>>16&255,n[i++]=e>>>24&255,n[i++]=0,n[i++]=0,n[i++]=0,n[i++]=0,o=8;o<this.padLength;o++)n[i++]=0;return n}},function(e,t,r){const n=r(17),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=u(e),n=u(t+55+r.length/2);return i.from(n+r,"hex")}function a(e){return"0x"===e.slice(0,2)}function u(e){var t=e.toString(16);return t.length%2&&(t="0"+t),t}function c(e){if(!i.isBuffer(e))if("string"==typeof e)e=a(e)?i.from(function(e){return e.length%2&&(e="0"+e),e}(function(e){return"string"!=typeof e?e:a(e)?e.slice(2):e}(e)),"hex"):i.from(e);else if("number"==typeof e)e=e?function(e){var t=u(e);return i.from(t,"hex")}(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 1===(e=c(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([]);var r=function e(t){var r,n,s,a,u,c=[],f=t[0];if(f<=127)return{data:t.slice(0,1),remainder:t.slice(1)};if(f<=183){if(r=f-127,s=128===f?i.from([]):t.slice(1,r),2===r&&s[0]<128)throw new Error("invalid rlp encoding: byte must be less 0x80");return{data:s,remainder:t.slice(r)}}if(f<=191){if(n=f-182,r=o(t.slice(1,n).toString("hex"),16),(s=t.slice(n,r+n)).length<r)throw new Error("invalid RLP");return{data:s,remainder:t.slice(r+n)}}if(f<=247){for(r=f-191,a=t.slice(1,r);a.length;)u=e(a),c.push(u.data),a=u.remainder;return{data:c,remainder:t.slice(r)}}var l=(n=f-246)+(r=o(t.slice(1,n).toString("hex"),16));if(l>t.length)throw new Error("invalid rlp: total length is larger than the data");if(0===(a=t.slice(n,l)).length)throw new Error("invalid rlp, List has a invalid length");for(;a.length;)u=e(a),c.push(u.data),a=u.remainder;return{data:c,remainder:t.slice(l)}}(e=c(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([]);var t=(e=c(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;return r+o(e.slice(1,r).toString("hex"),16)}},function(e,t,r){"use strict";const n=r(9),i=r(12);e.exports=function(e,t,r){const o=(r=r||{}).hashAlg||"keccak-256",s=void 0===r.version?1:r.version,a=i.encode(t,o);return new n(s,e,a)}},function(e,t,r){"use strict";const n=r(4),i=r(423),o=r(424);e.exports=function(e,t,r){const s=o(e,t);return{resolver:{multicodec:e,defaultHashAlg:"keccak-256",resolve:u,tree:function(e,t,r){"function"==typeof t&&(r=t,t=void 0),t||(t={}),n([t=>s.deserialize(e,t),(e,r)=>a(e,t,r)],r)},isLink:i(u),_resolveFromEthObject:c,_treeFromEthObject:a,_mapFromEthObject:r},util:s};function a(e,t,i){n([n=>r(e,t,n),(e,t)=>t(null,e.map(e=>e.path))],i)}function u(e,t,r){n([t=>s.deserialize(e,t),(e,r)=>c(e,t,r)],r)}function c(e,t,n){if(!t||"/"===t)return n(null,{value:e,remainderPath:""});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));const s=(o=o.filter(e=>e.path.split("/").every((e,t)=>e===i[t]))).sort((e,t)=>e.path.length<t.path.length)[0];if(!s){let e=new Error('Path not found ("'+t+'").');return n(e)}const a=t.slice(s.path.length+1),u={value:s.value,remainderPath:a};return n(null,u)})}}},function(e,t,r){"use strict";(function(t){var n=r(18),i=r(177),o=r(0),s=r(43).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){return n.isString(e)&&(e=new o.Buffer(i.decode(e))),n.isString(t)&&(t=new o.Buffer(i.decode(t))),t||(t=e.slice(-4),e=e.slice(0,-4)),a.checksum(e).toString("hex")===t.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).slice(0,4);if(o.toString("hex")!==a.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(18),i=r(21),o=r(66),s=r(55),a=r(0),u=r(24),c=r(29),f=r(68),l=r(83),h=r(84),p=4294967295;function d(e){return this instanceof d?e?this._fromObject(e):void 0:new d(e)}d.MAXINT=p,d.DEFAULT_SEQNUMBER=4294967295,d.DEFAULT_LOCKTIME_SEQNUMBER=4294967294,d.DEFAULT_RBF_SEQNUMBER=4294967293,Object.defineProperty(d.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)}}),d.fromObject=function(e){return i.checkArgument(n.isObject(e)),(new d)._fromObject(e)},d.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},d.prototype.toObject=d.prototype.toJSON=function(){var e={prevTxId:this.prevTxId.toString("hex"),outputIndex:this.outputIndex,sequenceNumber:this.sequenceNumber,script:this._scriptBuffer.toString("hex")};return this.script&&(e.scriptString=this.script.toString()),this.output&&(e.output=this.output.toObject()),e},d.fromBufferReader=function(e){var t=new d;return t.prevTxId=e.readReverse(32),t.outputIndex=e.readUInt32LE(),t._scriptBuffer=e.readVarLengthBuffer(),t.sequenceNumber=e.readUInt32LE(),t},d.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},d.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},d.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))},d.prototype.isFullySigned=function(){throw new o.AbstractMethodInvoked("Input#isFullySigned")},d.prototype.isFinal=function(){return 4294967295!==this.sequenceNumber},d.prototype.addSignature=function(){throw new o.AbstractMethodInvoked("Input#addSignature")},d.prototype.clearSignatures=function(){throw new o.AbstractMethodInvoked("Input#clearSignatures")},d.prototype.isValidSignature=function(e,t){return t.signature.nhashtype=t.sigtype,l.verify(e,t.signature,t.publicKey,t.inputIndex,this.output.script)},d.prototype.isNull=function(){return"0000000000000000000000000000000000000000000000000000000000000000"===this.prevTxId.toString("hex")&&4294967295===this.outputIndex},d.prototype._estimateSize=function(){return this.toBufferWriter().toBuffer().length},e.exports=d},function(e,t,r){"use strict";(function(t){var n=r(18),i=r(21),o=r(75),s=r(24),a=r(29),u=r(73),c=r(66),f=r(67);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(){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){for(var n=Math.min(e.length,r.length),i=new t(n),o=0;o<n;++o)i[o]=e[o]^r[o];return i}}).call(this,r(0).Buffer)},function(e,t,r){var n=r(13);r(77),r(19),(e.exports=n.hmac=n.hmac||{}).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())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(u=0;u<c;++u){a=s.at(u);r.putByte(54^a),i.putByte(92^a)}if(c<t.blockLength)for(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(13);r(77),r(19);var i=e.exports=n.sha1=n.sha1||{};n.md.sha1=n.md.algorithms.sha1=i,i.create=function(){s||(o=String.fromCharCode(128),o+=n.util.fillString(String.fromCharCode(0),64),s=!0);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 u=o.length;i.messageLength+=u,u=[u/4294967296>>>0,u>>>0];for(var c=i.fullMessageLength.length-1;c>=0;--c)i.fullMessageLength[c]+=u[1],u[1]=u[0]+(i.fullMessageLength[c]/4294967296>>>0),i.fullMessageLength[c]=i.fullMessageLength[c]>>>0,u[0]=u[1]/4294967296>>>0;return t.putBytes(o),a(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 u,c=i.fullMessageLength[i.fullMessageLength.length-1]+i.messageLengthSize&i.blockLength-1;s.putBytes(o.substr(0,i.blockLength-c));for(var f=8*i.fullMessageLength[0],l=0;l<i.fullMessageLength.length-1;++l)f+=(u=8*i.fullMessageLength[l+1])/4294967296>>>0,s.putInt32(f>>>0),f=u>>>0;s.putInt32(f);var h={h0:e.h0,h1:e.h1,h2:e.h2,h3:e.h3,h4:e.h4};a(h,r,s);var p=n.util.createBuffer();return p.putInt32(h.h0),p.putInt32(h.h1),p.putInt32(h.h2),p.putInt32(h.h3),p.putInt32(h.h4),p},i};var o=null,s=!1;function a(e,t,r){for(var n,i,o,s,a,u,c,f=r.length();f>=64;){for(i=e.h0,o=e.h1,s=e.h2,a=e.h3,u=e.h4,c=0;c<16;++c)n=r.getInt32(),t[c]=n,n=(i<<5|i>>>27)+(a^o&(s^a))+u+1518500249+n,u=a,a=s,s=(o<<30|o>>>2)>>>0,o=i,i=n;for(;c<20;++c)n=(n=t[c-3]^t[c-8]^t[c-14]^t[c-16])<<1|n>>>31,t[c]=n,n=(i<<5|i>>>27)+(a^o&(s^a))+u+1518500249+n,u=a,a=s,s=(o<<30|o>>>2)>>>0,o=i,i=n;for(;c<32;++c)n=(n=t[c-3]^t[c-8]^t[c-14]^t[c-16])<<1|n>>>31,t[c]=n,n=(i<<5|i>>>27)+(o^s^a)+u+1859775393+n,u=a,a=s,s=(o<<30|o>>>2)>>>0,o=i,i=n;for(;c<40;++c)n=(n=t[c-6]^t[c-16]^t[c-28]^t[c-32])<<2|n>>>30,t[c]=n,n=(i<<5|i>>>27)+(o^s^a)+u+1859775393+n,u=a,a=s,s=(o<<30|o>>>2)>>>0,o=i,i=n;for(;c<60;++c)n=(n=t[c-6]^t[c-16]^t[c-28]^t[c-32])<<2|n>>>30,t[c]=n,n=(i<<5|i>>>27)+(o&s|a&(o^s))+u+2400959708+n,u=a,a=s,s=(o<<30|o>>>2)>>>0,o=i,i=n;for(;c<80;++c)n=(n=t[c-6]^t[c-16]^t[c-28]^t[c-32])<<2|n>>>30,t[c]=n,n=(i<<5|i>>>27)+(o^s^a)+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,f-=64}}},function(e,t,r){"use strict";const n=t;n.Reporter=r(932).Reporter,n.DecoderBuffer=r(465).DecoderBuffer,n.EncoderBuffer=r(465).EncoderBuffer,n.Node=r(933)},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=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,B=/^\w*$/,C=/^\./,P=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,O=/\\(\\)?/g,R=/^\[object .+?Constructor\]$/,N=/^(?:0|[1-9]\d*)$/,L={};L["[object Float32Array]"]=L["[object Float64Array]"]=L["[object Int8Array]"]=L["[object Int16Array]"]=L["[object Int32Array]"]=L["[object Uint8Array]"]=L["[object Uint8ClampedArray]"]=L["[object Uint16Array]"]=L["[object Uint32Array]"]=!0,L[f]=L[l]=L[x]=L[h]=L[I]=L[p]=L[d]=L[y]=L[m]=L[b]=L[v]=L[w]=L[S]=L[k]=L[A]=!1;var K="object"==typeof e&&e&&e.Object===Object&&e,j="object"==typeof self&&self&&self.Object===Object&&self,M=K||j||Function("return this")(),D="object"==typeof t&&t&&!t.nodeType&&t,U=D&&"object"==typeof r&&r&&!r.nodeType&&r,F=U&&U.exports===D&&K.process,q=function(){try{return F&&F.binding("util")}catch(e){}}(),H=q&&q.isTypedArray;function z(e,t){for(var r=-1,n=e?e.length:0;++r<n;)if(t(e[r],r,e))return!0;return!1}function V(e){var t=!1;if(null!=e&&"function"!=typeof e.toString)try{t=!!(e+"")}catch(e){}return t}function G(e){var t=-1,r=Array(e.size);return e.forEach(function(e,n){r[++t]=[n,e]}),r}function W(e){var t=-1,r=Array(e.size);return e.forEach(function(e){r[++t]=e}),r}var $,Y=Array.prototype,J=Function.prototype,X=Object.prototype,Z=M["__core-js_shared__"],Q=($=/[^.]+$/.exec(Z&&Z.keys&&Z.keys.IE_PROTO||""))?"Symbol(src)_1."+$:"",ee=J.toString,te=X.hasOwnProperty,re=X.toString,ne=RegExp("^"+ee.call(te).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),ie=M.Symbol,oe=M.Uint8Array,se=X.propertyIsEnumerable,ae=Y.splice,ue=function(e,t){return function(r){return e(t(r))}}(Object.keys,Object),ce=qe(M,"DataView"),fe=qe(M,"Map"),le=qe(M,"Promise"),he=qe(M,"Set"),pe=qe(M,"WeakMap"),de=qe(Object,"create"),ye=Je(ce),ge=Je(fe),me=Je(le),be=Je(he),ve=Je(pe),_e=ie?ie.prototype:void 0,we=_e?_e.valueOf:void 0,Se=_e?_e.toString:void 0;function ke(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 Ee(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 Ae(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 xe(e){var t=-1,r=e?e.length:0;for(this.__data__=new Ae;++t<r;)this.add(e[t])}function Ie(e){this.__data__=new Ee(e)}function Te(e,t){var r=et(e)||Qe(e)?function(e,t){for(var r=-1,n=Array(e);++r<e;)n[r]=t(r);return n}(e.length,String):[],n=r.length,i=!!n;for(var o in e)!t&&!te.call(e,o)||i&&("length"==o||ze(o,n))||r.push(o);return r}function Be(e,t){for(var r=e.length;r--;)if(Ze(e[r][0],t))return r;return-1}ke.prototype.clear=function(){this.__data__=de?de(null):{}},ke.prototype.delete=function(e){return this.has(e)&&delete this.__data__[e]},ke.prototype.get=function(e){var t=this.__data__;if(de){var r=t[e];return r===o?void 0:r}return te.call(t,e)?t[e]:void 0},ke.prototype.has=function(e){var t=this.__data__;return de?void 0!==t[e]:te.call(t,e)},ke.prototype.set=function(e,t){return this.__data__[e]=de&&void 0===t?o:t,this},Ee.prototype.clear=function(){this.__data__=[]},Ee.prototype.delete=function(e){var t=this.__data__,r=Be(t,e);return!(r<0||(r==t.length-1?t.pop():ae.call(t,r,1),0))},Ee.prototype.get=function(e){var t=this.__data__,r=Be(t,e);return r<0?void 0:t[r][1]},Ee.prototype.has=function(e){return Be(this.__data__,e)>-1},Ee.prototype.set=function(e,t){var r=this.__data__,n=Be(r,e);return n<0?r.push([e,t]):r[n][1]=t,this},Ae.prototype.clear=function(){this.__data__={hash:new ke,map:new(fe||Ee),string:new ke}},Ae.prototype.delete=function(e){return Fe(this,e).delete(e)},Ae.prototype.get=function(e){return Fe(this,e).get(e)},Ae.prototype.has=function(e){return Fe(this,e).has(e)},Ae.prototype.set=function(e,t){return Fe(this,e).set(e,t),this},xe.prototype.add=xe.prototype.push=function(e){return this.__data__.set(e,o),this},xe.prototype.has=function(e){return this.__data__.has(e)},Ie.prototype.clear=function(){this.__data__=new Ee},Ie.prototype.delete=function(e){return this.__data__.delete(e)},Ie.prototype.get=function(e){return this.__data__.get(e)},Ie.prototype.has=function(e){return this.__data__.has(e)},Ie.prototype.set=function(e,t){var r=this.__data__;if(r instanceof Ee){var i=r.__data__;if(!fe||i.length<n-1)return i.push([e,t]),this;r=this.__data__=new Ae(i)}return r.set(e,t),this};var Ce=function(e,t){return function(r,n){if(null==r)return r;if(!tt(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(e,t){return e&&Pe(e,t,ut)});var Pe=function(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 Oe(e,t){for(var r=0,n=(t=Ve(t,e)?[t]:Me(t)).length;null!=e&&r<n;)e=e[Ye(t[r++])];return r&&r==n?e:void 0}function Re(e,t){return null!=e&&t in Object(e)}function Ne(e,t,r,n,i){return e===t||(null==e||null==t||!it(e)&&!ot(t)?e!=e&&t!=t:function(e,t,r,n,i,o){var s=et(e),u=et(t),c=l,h=l;s||(c=(c=He(e))==f?v:c),u||(h=(h=He(t))==f?v:h);var p=c==v&&!V(e),d=h==v&&!V(t),y=c==h;if(y&&!p)return o||(o=new Ie),s||at(e)?De(e,t,r,n,i,o):Ue(e,t,c,r,n,i,o);if(!(i&a)){var g=p&&te.call(e,"__wrapped__"),m=d&&te.call(t,"__wrapped__");if(g||m){var b=g?e.value():e,_=m?t.value():t;return o||(o=new Ie),r(b,_,n,i,o)}}return!!y&&(o||(o=new Ie),function(e,t,r,n,i,o){var s=i&a,u=ut(e),c=u.length;if(c!=ut(t).length&&!s)return!1;for(var f=c;f--;){var l=u[f];if(!(s?l in t:te.call(t,l)))return!1}var h=o.get(e);if(h&&o.get(t))return h==t;var p=!0;o.set(e,t),o.set(t,e);for(var d=s;++f<c;){var y=e[l=u[f]],g=t[l];if(n)var m=s?n(g,y,l,t,e,o):n(y,g,l,e,t,o);if(!(void 0===m?y===g||r(y,g,n,i,o):m)){p=!1;break}d||(d="constructor"==l)}if(p&&!d){var b=e.constructor,v=t.constructor;b!=v&&"constructor"in e&&"constructor"in t&&!("function"==typeof b&&b instanceof b&&"function"==typeof v&&v instanceof v)&&(p=!1)}return o.delete(e),o.delete(t),p}(e,t,r,n,i,o))}(e,t,Ne,r,n,i))}function Le(e){return!(!it(e)||function(e){return!!Q&&Q in e}(e))&&(rt(e)||V(e)?ne:R).test(Je(e))}function Ke(e){return"function"==typeof e?e:null==e?ct:"object"==typeof e?et(e)?function(e,t){return Ve(e)&&Ge(t)?We(Ye(e),t):function(r){var n=function(e,t,r){var n=null==e?void 0:Oe(e,t);return void 0===n?r:n}(r,e);return void 0===n&&n===t?function(e,t){return null!=e&&function(e,t,r){for(var n,i=-1,o=(t=Ve(t,e)?[t]:Me(t)).length;++i<o;){var s=Ye(t[i]);if(!(n=null!=e&&r(e,s)))break;e=e[s]}return n||!!(o=e?e.length:0)&&nt(o)&&ze(s,o)&&(et(e)||Qe(e))}(e,t,Re)}(r,e):Ne(t,n,void 0,s|a)}}(e[0],e[1]):function(e){var t=function(e){for(var t=ut(e),r=t.length;r--;){var n=t[r],i=e[n];t[r]=[n,i,Ge(i)]}return t}(e);return 1==t.length&&t[0][2]?We(t[0][0],t[0][1]):function(r){return r===e||function(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;){var f=(c=r[i])[0],l=e[f],h=c[1];if(u&&c[2]){if(void 0===l&&!(f in e))return!1}else{var p=new Ie;if(n)var d=n(l,h,f,e,t,p);if(!(void 0===d?Ne(h,l,n,s|a,p):d))return!1}}return!0}(r,e,t)}}(e):function(e){return Ve(e)?function(e){return function(t){return null==t?void 0:t[e]}}(Ye(e)):function(e){return function(t){return Oe(t,e)}}(e)}(e)}function je(e){if(!function(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||X)}(e))return ue(e);var t=[];for(var r in Object(e))te.call(e,r)&&"constructor"!=r&&t.push(r);return t}function Me(e){return et(e)?e:$e(e)}function De(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 xe: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(!z(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 Ue(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 oe(e),new oe(t)));case h:case p:case b:return Ze(+e,+t);case d:return e.name==t.name&&e.message==t.message;case w:case k:return e==t+"";case m:var c=G;case S:var f=o&a;if(c||(c=W),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=De(c(e),c(t),n,i,o,u);return u.delete(e),y;case E:if(we)return we.call(e)==we.call(t)}return!1}function Fe(e,t){var r=e.__data__;return function(e){var t=typeof e;return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e}(t)?r["string"==typeof t?"string":"hash"]:r.map}function qe(e,t){var r=function(e,t){return null==e?void 0:e[t]}(e,t);return Le(r)?r:void 0}var He=function(e){return re.call(e)};function ze(e,t){return!!(t=null==t?c:t)&&("number"==typeof e||N.test(e))&&e>-1&&e%1==0&&e<t}function Ve(e,t){if(et(e))return!1;var r=typeof e;return!("number"!=r&&"symbol"!=r&&"boolean"!=r&&null!=e&&!st(e))||B.test(e)||!T.test(e)||null!=t&&e in Object(t)}function Ge(e){return e==e&&!it(e)}function We(e,t){return function(r){return null!=r&&r[e]===t&&(void 0!==t||e in Object(r))}}(ce&&He(new ce(new ArrayBuffer(1)))!=I||fe&&He(new fe)!=m||le&&He(le.resolve())!=_||he&&He(new he)!=S||pe&&He(new pe)!=A)&&(He=function(e){var t=re.call(e),r=t==v?e.constructor:void 0,n=r?Je(r):void 0;if(n)switch(n){case ye:return I;case ge:return m;case me:return _;case be:return S;case ve:return A}return t});var $e=Xe(function(e){e=function(e){return null==e?"":function(e){if("string"==typeof e)return e;if(st(e))return Se?Se.call(e):"";var t=e+"";return"0"==t&&1/e==-u?"-0":t}(e)}(e);var t=[];return C.test(e)&&t.push(""),e.replace(P,function(e,r,n,i){t.push(n?i.replace(O,"$1"):r||e)}),t});function Ye(e){if("string"==typeof e||st(e))return e;var t=e+"";return"0"==t&&1/e==-u?"-0":t}function Je(e){if(null!=e){try{return ee.call(e)}catch(e){}try{return e+""}catch(e){}}return""}function Xe(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(Xe.Cache||Ae),r}function Ze(e,t){return e===t||e!=e&&t!=t}function Qe(e){return function(e){return ot(e)&&tt(e)}(e)&&te.call(e,"callee")&&(!se.call(e,"callee")||re.call(e)==f)}Xe.Cache=Ae;var et=Array.isArray;function tt(e){return null!=e&&nt(e.length)&&!rt(e)}function rt(e){var t=it(e)?re.call(e):"";return t==y||t==g}function nt(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=c}function it(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function ot(e){return!!e&&"object"==typeof e}function st(e){return"symbol"==typeof e||ot(e)&&re.call(e)==E}var at=H?function(e){return function(t){return e(t)}}(H):function(e){return ot(e)&&nt(e.length)&&!!L[re.call(e)]};function ut(e){return tt(e)?Te(e):je(e)}function ct(e){return e}r.exports=function(e,t){return(et(e)?function(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(e,t){var r=[];return Ce(e,function(e,n,i){t(e,n,i)&&r.push(e)}),r})(e,Ke(t))}}).call(this,r(6),r(27)(e))},function(e,t,r){"use strict";var n=t,i=r(0).Buffer,o=r(368);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,s=e.split(":",8);for(o=0;o<s.length;o++){var a;this.isV4Format(s[o])&&(a=this.toBuffer(s[o]),s[o]=a.slice(0,2).toString("hex")),a&&++o<8&&s.splice(o,0,a.slice(2,4).toString("hex"))}if(""===s[0])for(;s.length<8;)s.unshift("0");else if(""===s[s.length-1])for(;s.length<8;)s.push("0");else if(s.length<8){for(o=0;o<s.length&&""!==s[o];o++);var u=[o,1];for(o=9-s.length;o>0;o--)u.push("0");s.splice.apply(s,u)}for(n=t||new i(r+16),o=0;o<s.length;o++){var c=parseInt(s[o],16);n[r++]=c>>8&255,n[r++]=255&c}}if(!n)throw Error("Invalid ip address: "+e);return n},n.toString=function(e,t,r){t=~~t;var n=[];if(4===(r=r||e.length-t)){for(var i=0;i<r;i++)n.push(e[t+i]);n=n.join(".")}else if(16===r){for(i=0;i<r;i+=2)n.push(e.readUInt16BE(t+i).toString(16));n=(n=(n=n.join(":")).replace(/(^|:)0(:0)*:0(:|$)/,"$1::$3")).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){var r=4;"ipv6"===(t=e>32?"ipv6":u(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(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);var s=i.length-o.length;for(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(r=0;r<10;r++)if(0!==t[r])return!1;var o=t.readUInt16BE(10);if(0!==o&&65535!==o)return!1;for(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("ipv4"!==(e=u(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,i=o.networkInterfaces();if(t=u(t),e&&"private"!==e&&"public"!==e){var s=i[e].filter(function(e){return e.family.toLowerCase()===t});if(0===s.length)return;return s[0].address}return(r=Object.keys(i).map(function(r){var o=i[r].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)).length?r[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(482),t.Address6=r(976),t.v6={helpers:r(488)}},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,n,i,a,c,l,h,p=1,d=e.length,y="",g=[],m=!0,b="";for(n=0;n<d;n++)if("string"===(y=u(e[n])))g[g.length]=e[n];else if("array"===y){if((a=e[n])[2])for(r=t[p],i=0;i<a[2].length;i++){if(!r.hasOwnProperty(a[2][i]))throw new Error(s('[sprintf] property "%s" does not exist',a[2][i]));r=r[a[2][i]]}else r=a[1]?t[a[1]]:t[p++];if(o.not_type.test(a[8])&&o.not_primitive.test(a[8])&&"function"==u(r)&&(r=r()),o.numeric_arg.test(a[8])&&"number"!=u(r)&&isNaN(r))throw new TypeError(s("[sprintf] expecting number but found %s",u(r)));switch(o.number.test(a[8])&&(m=r>=0),a[8]){case"b":r=parseInt(r,10).toString(2);break;case"c":r=String.fromCharCode(parseInt(r,10));break;case"d":case"i":r=parseInt(r,10);break;case"j":r=JSON.stringify(r,null,a[6]?parseInt(a[6]):0);break;case"e":r=a[7]?parseFloat(r).toExponential(a[7]):parseFloat(r).toExponential();break;case"f":r=a[7]?parseFloat(r).toFixed(a[7]):parseFloat(r);break;case"g":r=a[7]?parseFloat(r).toPrecision(a[7]):parseFloat(r);break;case"o":r=r.toString(8);break;case"s":r=String(r),r=a[7]?r.substring(0,a[7]):r;break;case"t":r=String(!!r),r=a[7]?r.substring(0,a[7]):r;break;case"T":r=u(r),r=a[7]?r.substring(0,a[7]):r;break;case"u":r=parseInt(r,10)>>>0;break;case"v":r=r.valueOf(),r=a[7]?r.substring(0,a[7]):r;break;case"x":r=parseInt(r,10).toString(16);break;case"X":r=parseInt(r,10).toString(16).toUpperCase()}o.json.test(a[8])?g[g.length]=r:(!o.number.test(a[8])||m&&!a[3]?b="":(b=m?"+":"-",r=r.toString().replace(o.sign,"")),l=a[4]?"0"===a[4]?"0":a[4].charAt(1):" ",h=a[6]-(b+r).length,c=a[6]&&h>0?f(l,h):"",g[g.length]=a[5]?b+r+c:"0"===l?b+c+r:c+b+r)}return g.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)).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,void 0===(n=function(){return{sprintf:s,vsprintf:a}}.call(t,r,t,e))||(e.exports=n))}("undefined"==typeof window?this:window)},function(e,t,r){(function(t){var n=r(90);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=[],c=new n;c.writable=c.readable=!0,c.write=function(e){return a.length?a.shift()(null,e):u.push(e),a.length||(o=!0),!!a.length},c.end=function(){t?u.length?d():t(r=!0,a.length?a.shift():function(){}):a.length&&a.shift()(!0)},c.source=function(e,t){u.length?(t(null,u.shift()),u.length||c.emit("drain")):((r=r||e)?t(r):a.push(t),o&&(o=!1,c.emit("drain")))},e&&(s=e(c.source)),s&&!t&&(t=s);var f=[],l=!1,h=!1;if(c.sink=function(e){t=e,i(d)},t){c.sink(t);var p=c.pipe.bind(c);c.pipe=function(e,t){var r=p(e,t);return c.paused&&c.resume(),r}}function d(){if(!1,t&&!h){for(;f.length&&!c.paused;)c.emit("data",f.shift());if(!c.paused){if(l)return c.emit("end");h=!0,t(null,function e(n,i){h=!1,c.paused?(!0===n?l=n:n?c.emit("error",n):f.push(i),!0):n&&!0!==(r=n)?c.emit("error",n):(r=r||n)?c.emit("end"):(c.emit("data",i),h=!0,t(null,e))})}}}return c.pause=function(){return c.paused=!0,c},c.resume=function(){return c.paused=!1,d(),c},c.destroy=function(){!r&&t&&t(r=!0,function(){}),r=!0,a.length&&a.shift()(!0),c.emit("close")},c}}).call(this,r(7))},function(e,t){function r(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,n){!function i(){t?r(e,t,n):e.length?e[0]?e[0](null,function(t,o){t?(e.shift(),!0===t?i():r(e,t,n)):n(null,o)}):(e.shift(),i()):n(!0)}()}}},function(e,t,r){"use strict";(function(t){const n=r(44),i=r(26),o=r(1239),s=r(306),a=r(20),u=r(14),c=r(61),f=new Error("Sorry, Not Implemented Yet."),l=c.proto(function(e){if(!(this instanceof l))return new l(e);if(null==e&&(e=""),e instanceof t)this.buffer=o.fromBuffer(e);else if("string"==typeof e||e instanceof String)this.buffer=o.fromString(e);else{if(!(e.buffer&&e.protos&&e.protoCodes))throw new Error("addr must be a string, Buffer, or another Multiaddr");this.buffer=o.fromBuffer(e.buffer)}},{className:"Multiaddr",symbolName:"@multiformats/js-multiaddr/multiaddr"});l.prototype.toString=function(){return o.bufferToString(this.buffer)},l.prototype.toOptions=function(){const e={},t=this.toString().split("/");return e.family="ip4"===t[1]?"ipv4":"ipv6",e.host=t[2],e.transport=t[3],e.port=t[4],e},l.prototype.inspect=function(){return"<Multiaddr "+this.buffer.toString("hex")+" - "+o.bufferToString(this.buffer)+">"},l.prototype.protos=function(){return n(this.protoCodes(),function(e){return i(s(e))})},l.prototype.protoCodes=function(){const e=[],t=this.buffer;let r=0;for(;r<t.length;){const n=a.decode(t,r),i=a.decode.bytes,u=s(n);r+=o.sizeForAddr(u,t.slice(r+i))+i,e.push(n)}return e},l.prototype.protoNames=function(){return n(this.protos(),function(e){return e.name})},l.prototype.tuples=function(){return o.bufferToTuples(this.buffer)},l.prototype.stringTuples=function(){const e=o.bufferToTuples(this.buffer);return o.tuplesToStringTuples(e)},l.prototype.encapsulate=function(e){return e=l(e),l(this.toString()+e.toString())},l.prototype.decapsulate=function(e){e=e.toString();const t=this.toString(),r=t.lastIndexOf(e);if(r<0)throw new Error("Address "+this+" does not contain subaddress: "+e);return l(t.slice(0,r))},l.prototype.getPeerId=function(){let e=null;try{e=this.stringTuples().filter(e=>{if(e[0]===s.names.ipfs.code)return!0})[0][1],u.decode(e)}catch(t){e=null}return e},l.prototype.equals=function(e){return this.buffer.equals(e.buffer)},l.prototype.nodeAddress=function(){if(!this.isThinWaistAddress())throw new Error('Multiaddr must be "thin waist" address for nodeAddress.');const e=this.protoCodes(),t=this.toString().split("/").slice(1);return{family:41===e[0]?"IPv6":"IPv4",address:t[1],port:t[3]}},l.fromNodeAddress=function(e,t){if(!e)throw new Error("requires node address object");if(!t)throw new Error("requires transport protocol");const r="IPv6"===e.family?"ip6":"ip4";return l("/"+[r,e.address,t,e.port].join("/"))},l.prototype.isThinWaistAddress=function(e){const t=(e||this).protos();return!(2!==t.length||4!==t[0].code&&41!==t[0].code||6!==t[1].code&&17!==t[1].code)},l.prototype.fromStupidString=function(e){throw f},l.protocols=s,l.isName=function(e){return!!l.isMultiaddr(e)&&e.protos().some(e=>e.resolvable)},l.resolve=function(e,t){return l.isMultiaddr(e)&&l.isName(e)?t(new Error("not implemented yet")):t(new Error("not a valid name"))},e.exports=l}).call(this,r(0).Buffer)},function(e,t,r){"use strict";const n=r(142),i=r(51),o=r(196),s=r(144);e.exports=function(e){function t(e,t,r){return r=r||(()=>{}),e.write(s.CircuitRelay.encode({type:s.CircuitRelay.Type.STATUS,code:t})),r()}return{getB58String:function(e){let t=null;n.isMultiaddr(e)?t=n(e).getPeerId():i.isPeerInfo(e)&&(t=e.id.toB58String());return t},peerInfoFromMa:function(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},isPeerConnected:function(t){return e.muxedConns[t]||e.conns[t]},validateAddrs:function(e,r,i,o){try{e.dstPeer.addrs.forEach(e=>n(e))}catch(e){return t(r,i===s.CircuitRelay.Type.HOP?s.CircuitRelay.Status.HOP_DST_MULTIADDR_INVALID:s.CircuitRelay.Status.STOP_DST_MULTIADDR_INVALID),o(e)}try{e.srcPeer.addrs.forEach(e=>n(e))}catch(e){return t(r,i===s.CircuitRelay.Type.HOP?s.CircuitRelay.Status.HOP_SRC_MULTIADDR_INVALID:s.CircuitRelay.Status.STOP_SRC_MULTIADDR_INVALID),o(e)}return o(null)},writeResponse:t}}},function(e,t,r){"use strict";const n=r(10);e.exports=n(r(1258))},function(e,t,r){"use strict";t.importer=t.Importer=r(1389),t.exporter=t.Exporter=r(1411)},function(e,t,r){"use strict";const n=r(34).Key;e.exports={FILE_SEPARATOR:"/",MFS_ROOT_KEY:new n("/local/filesroot"),MAX_CHUNK_SIZE:262144,MAX_LINKS:174,FILE_TYPES:{file:0,directory:1}}},function(e,t,r){(function(t){e.exports=function(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}}).call(this,r(7))},function(e,t,r){var n=new(r(1515)),i="undefined"!=typeof window?window:self,o=i.crypto||i.msCrypto||{},s=o.subtle||o.webkitSubtle;function a(e){return n.digest(e)}try{s.digest({name:"sha-1"},new Uint8Array).catch(function(){s=!1})}catch(e){s=!1}e.exports=function(e,t){s?("string"==typeof e&&(e=function(e){for(var t=e.length,r=new Uint8Array(t),n=0;n<t;n++)r[n]=e.charCodeAt(n);return r}(e)),s.digest({name:"sha-1"},e).then(function(e){t(function(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("")}(new Uint8Array(e)))},function(r){t(a(e))})):setTimeout(t,0,a(e))},e.exports.sync=a},function(e,t,r){const n=r(79);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},e.exports=utils},function(e,t,r){"use strict";(function(t){!t.version||0===t.version.indexOf("v0.")||0===t.version.indexOf("v1.")&&0!==t.version.indexOf("v1.8.")?e.exports={nextTick:function(e,r,n,i){if("function"!=typeof e)throw new TypeError('"callback" argument must be a function');var o,s,a=arguments.length;switch(a){case 0:case 1:return t.nextTick(e);case 2:return t.nextTick(function(){e.call(null,r)});case 3:return t.nextTick(function(){e.call(null,r,n)});case 4:return t.nextTick(function(){e.call(null,r,n,i)});default:for(o=new Array(a-1),s=0;s<o.length;)o[s++]=arguments[s];return t.nextTick(function(){e.apply(null,o)})}}}:e.exports=t}).call(this,r(7))},function(e,t,r){"use strict";(function(t){const n=r(9),i=r(61);e.exports=i(class{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")}},{className:"Block",symbolName:"@ipfs/js-ipfs-block/block"})}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(r){(t=e.exports).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";function n(e){return e}var i=r(119);e.exports=function(e){if(!e)return n;e=i(e);var t,r,o=!1;return function(n){return function i(s,a){if(r)return a(r);s?(r=s,n(s,o?function(e){o?t=a:a(s)}:function(e){a(s)})):n(null,function(n,s){n?a(n):r?a(r):(o=!0,e(s,function(e,n){o=!1,r?(a(r),t(r)):e?i(e,a):a(null,n)}))})}}}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){return(0,i.default)(function(t,r){var i;try{i=e.apply(this,t)}catch(e){return r(e)}(0,n.default)(i)&&"function"==typeof i.then?i.then(function(e){a(r,null,e)},function(e){a(r,e.message?e:new Error(e))}):r(null,i)})};var n=s(r(121)),i=s(r(353)),o=s(r(213));function s(e){return e&&e.__esModule?e:{default:e}}function a(e,t,r){try{e(t,r)}catch(e){(0,o.default)(u,e)}}function u(e){throw e}e.exports=t.default},function(e,t,r){"use strict";const n=r(4),i=r(49),o=r(63),s=r(50),a=r(17),u=r(64),c=r(1),f=r(122),l=r(8),h=r(691),p=r(692),d=r(694),y=r(704),g=r(705),m=r(717),b=r(740),v=c("repo"),_=Number.MAX_SAFE_INTEGER,w={memory:r(384),fs:r(384)},S=r(741).repoVersion;function k(e,t){l(e.query({}),l.reduce((e,t)=>e.plus(t.value.byteLength).plus(t.key._buf.byteLength),new f(0),t))}function E(e,t){return r=>{t(r&&!e(r)?r:null)}}function A(e){return E(e=>"Already open"===e.message,e)}e.exports=class{constructor(e,t){a.equal(typeof e,"string","missing repoPath"),this.options=function(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}(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(A(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(A(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(function(e){return E(e=>e&&(e.code===b.ERR_REPO_NOT_INITIALIZED||e.message.startsWith("ENOENT")),e)}(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)=>{const n=new f((r=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=>k(this.datastore,e),keys:e=>k(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})})}},e.exports.repoVersion=S,e.exports.errors=b},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){return function(){if(null!==e){var t=e;e=null,t.apply(this,arguments)}}},e.exports=t.default},function(e,t,r){var n=r(158),i=r(673),o=r(674),s="[object Null]",a="[object Undefined]",u=n?n.toStringTag:void 0;e.exports=function(e){return null==e?void 0===e?a:s:u&&u in Object(e)?i(e):o(e)}},function(e,t,r){var n=r(159).Symbol;e.exports=n},function(e,t,r){var n=r(355),i="object"==typeof self&&self&&self.Object===Object&&self,o=n||i||Function("return this")();e.exports=o},function(e,t){e.exports=function(e){return null!=e&&"object"==typeof e}},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))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";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e,t){var r=(0,i.default)(e);return(0,n.default)(function(e,t){r(e[0],t)},t,1)};var n=o(r(695)),i=o(r(36));function o(e){return e&&e.__esModule?e:{default:e}}e.exports=t.default},function(e,t,r){"use strict";const n=r(8);e.exports=class{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)}}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){return function(t,r,o){return e(n.default,t,(0,i.default)(r),o)}};var n=o(r(218)),i=o(r(36));function o(e){return e&&e.__esModule?e:{default:e}}e.exports=t.default},function(e,t,r){"use strict";(function(t){const n=r(8),i=r(718),o=r(34).utils.asyncFilter,s=r(34).utils.asyncSort,a=r(34).Key,u=r(726);e.exports=class{constructor(e,t){let n;t&&t.db?(n=t.db,delete t.db):n=r(731),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});let 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)})}],c=[];if(null!=e.prefix){const t=e.prefix;c.push((e,r)=>r(null,e.key.toString().startsWith(t)))}if(null!=e.filters&&(c=c.concat(e.filters)),u=u.concat(c.map(e=>o(e))),null!=e.orders&&(u=u.concat(e.orders.map(e=>s(e)))),null!=e.offset){let t=0;u.push(n.filter(()=>t++>=e.offset))}return null!=e.limit&&u.push(n.take(e.limit)),n.apply(null,u)}}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(n){const i=r(12),o=r(17),s=r(61);(t=e.exports=s(class{constructor(e,t,r,s){o(r,"DAGNode needs its serialized format"),o(s,"DAGNode needs its multihash"),"string"==typeof s&&(s=i.fromB58String(s)),this._data=e||n.alloc(0),this._links=t||[],this._serialized=r,this._multihash=s,this._size=this.links.reduce((e,t)=>e+t.size,this.serialized.length),this._json={data:this.data,links:this.links.map(e=>e.toJSON()),multihash:i.toB58String(this.multihash),size:this.size}}toJSON(){return this._json}toString(){return`DAGNode <${i.toB58String(this.multihash)} - 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 this._size}set size(e){throw new Error("Can't set property: 'size' is immutable")}get multihash(){return this._multihash}set multihash(e){throw new Error("Can't set property: 'multihash' is immutable")}},{className:"DAGNode",symbolName:"@ipld/js-ipld-dag-pb/dagnode"})).create=r(167),t.clone=r(766),t.addLink=r(767),t.rmLink=r(768)}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(t){const n=r(65),i=r(752),o=r(226).serialize,s=r(168).linkSort,a=r(166),u=r(91);e.exports=function(e,r,c,f){if("function"==typeof e?(f=e,e=void 0):"string"==typeof e&&(e=t.from(e)),"function"==typeof r&&(f=r,r=[]),"function"==typeof c&&(f=c,c=void 0),!t.isBuffer(e))return f(new Error("Passed 'data' is not a buffer or a string!"));c||(c="sha2-256");const l=r.map(e=>u.isDAGLink(e)?e:u.util.createDagLinkFromB58EncodedHash(e)),h=i(l,s);o({data:e,links:h},(t,r)=>{if(t)return f(t);n(r,c,(t,n)=>{if(t)return f(t);const i=new a(e,h,r,n);f(null,i)})})}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(n){const i=r(91);(t=e.exports).cloneData=function(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},t.cloneLinks=function(e){return e.links.slice()},t.linkSort=function(e,t){const r=n.from(e.name||""),i=n.from(t.name||"");return r.compare(i)},t.toDAGLink=function(e){return new i("",e.size,e.multihash)}}).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=0|e;return e>0||e===t?t:t-1}function b(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 v(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 _(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 w(e){return"[object Array]"==Object.prototype.toString.call(e)}function S(e,t){return(e.length>1?e.charAt(0)+"."+e.slice(1):e)+(t<0?"e":"e+")+t}function k(e,t,r){var n,i;if(t<0){for(i=r+".";++t;i+=r);e=i+e}else if(++t>(n=e.length)){for(i=r,t-=n;--t;i+=r);e+=i}else t<n&&(e=e.slice(0,t)+"."+e.slice(t));return e}(o=function e(t){var r,n,i,o,E,A,x,I,T,B,C=H.prototype,P=new H(1),O=20,R=4,N=-7,L=21,K=-1e7,j=1e7,M=!1,D=1,U=0,F={decimalSeparator:".",groupSeparator:",",groupSize:3,secondaryGroupSize:0,fractionGroupSeparator:" ",fractionGroupSize:0},q="0123456789abcdefghijklmnopqrstuvwxyz";function H(e,t){var r,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)&&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 i(g,y,l);g.s=45==y.charCodeAt(0)?(y=y.slice(1),-1):1}}else{if(_(t,2,q.length,"Base"),y=e+"",10==t)return W(g=new H(e instanceof H?e:y),O+g.e+1,R);if(l="number"==typeof e){if(0*e!=0)return i(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(r=q.slice(0,t),a=c=0,d=y.length;c<d;c++)if(r.indexOf(o=y.charAt(c))<0){if("."==o&&c>a){a=d;continue}return i(g,e+"",l,t)}y=n(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)){if(d=y.length,l&&d>15&&(e>p||e!==u(e)))throw Error(f+g.s*e);if((a=a-c-1)>j)g.c=g.e=null;else if(a<K)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=R:_(r,0,8),!e.c)return e.toString();if(i=e.c[0],s=e.e,null==t)u=b(e.c),u=1==n||2==n&&s<=N?S(u,s):k(u,s,"0");else if(o=(e=W(new H(e),t,r)).e,a=(u=b(e.c)).length,1==n||2==n&&(t<=o||o<=N)){for(;a<t;u+="0",a++);u=S(u,o)}else if(t-=s,u=k(u,o,"0"),o+1>a){if(--t>0)for(u+=".";t--;u+="0");}else if((t+=o-a)>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(w(e[0])&&(e=e[0]),r=new H(e[0]);++i<e.length;){if(!(n=new H(e[i])).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)>j?e.c=e.e=null:r<K?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)<0)o+=h,s=t,y=(f=g[p=0])/m[i-s-1]%10|0;else if((p=a((o+1)/h))>=g.length){if(!n)break e;for(;g.length<=p;g.push(0));f=y=0,i=1,s=(o%=h)-h+1}else{for(f=c=g[p],i=1;c>=10;c/=10,i++);y=(s=(o%=h)-h+i)<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>j?e.c=e.e=null:e.e<K&&(e.c=[e.e=0])}return e}return H.clone=e,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],0,g,t),O=r),e.hasOwnProperty(t="ROUNDING_MODE")&&(_(r=e[t],0,8,t),R=r),e.hasOwnProperty(t="EXPONENTIAL_AT")&&(w(r=e[t])?(_(r[0],-g,0,t),_(r[1],0,g,t),N=r[0],L=r[1]):(_(r,-g,g,t),N=-(L=r<0?-r:r))),e.hasOwnProperty(t="RANGE"))if(w(r=e[t]))_(r[0],-g,-1,t),_(r[1],1,g,t),K=r[0],j=r[1];else{if(_(r,-g,g,t),!r)throw Error(c+t+" cannot be zero: "+r);K=-(j=r<0?-r:r)}if(e.hasOwnProperty(t="CRYPTO")){if((r=e[t])!==!!r)throw Error(c+t+" not true or false: "+r);if(r){if("undefined"==typeof crypto||!crypto||!crypto.getRandomValues&&!crypto.randomBytes)throw M=!r,Error(c+"crypto unavailable");M=r}else M=r}if(e.hasOwnProperty(t="MODULO_MODE")&&(_(r=e[t],0,9,t),D=r),e.hasOwnProperty(t="POW_PRECISION")&&(_(r=e[t],0,g,t),U=r),e.hasOwnProperty(t="FORMAT")){if("object"!=typeof(r=e[t]))throw Error(c+t+" not an object: "+r);F=r}if(e.hasOwnProperty(t="ALPHABET")){if("string"!=typeof(r=e[t])||/^.$|\.|(.).*\1/.test(r))throw Error(c+t+" invalid: "+r);q=r}}return{DECIMAL_PLACES:O,ROUNDING_MODE:R,EXPONENTIAL_AT:[N,L],RANGE:[K,j],CRYPTO:M,MODULO_MODE:D,POW_PRECISION:U,FORMAT:F,ALPHABET:q}},H.isBigNumber=function(e){return e instanceof H||e&&!0===e._isBigNumber||!1},H.maximum=H.max=function(){return V(arguments,C.lt)},H.minimum=H.min=function(){return V(arguments,C.gt)},H.random=(o=9007199254740992,E=Math.random()*o&2097151?function(){return u(Math.random()*o)}:function(){return 8388608*(1073741824*Math.random()|0)+(8388608*Math.random()|0)},function(e){var t,r,n,i,o,s=0,f=[],l=new H(P);if(null==e?e=O:_(e,0,g),i=a(e/h),M)if(crypto.getRandomValues){for(t=crypto.getRandomValues(new Uint32Array(i*=2));s<i;)(o=131072*t[s]+(t[s+1]>>>11))>=9e15?(r=crypto.getRandomValues(new Uint32Array(2)),t[s]=r[0],t[s+1]=r[1]):(f.push(o%1e14),s+=2);s=i/2}else{if(!crypto.randomBytes)throw M=!1,Error(c+"crypto unavailable");for(t=crypto.randomBytes(i*=7);s<i;)(o=281474976710656*(31&t[s])+1099511627776*t[s+1]+4294967296*t[s+2]+16777216*t[s+3]+(t[s+4]<<16)+(t[s+5]<<8)+t[s+6])>=9e15?crypto.randomBytes(7).copy(t,s):(f.push(o%1e14),s+=7);s=i/7}if(!M)for(;s<i;)(o=E())<9e15&&(f[s++]=o%1e14);for(i=f[--s],e%=h,i&&e&&(o=d[h-e],f[s]=u(i/o)*o);0===f[s];f.pop(),s--);if(s<0)f=[n=0];else{for(n=-1;0===f[0];f.splice(0,1),n-=h);for(s=1,o=f[0];o>=10;o/=10,s++);s<h&&(n-=h-s)}return l.e=n,l.c=f,l}),n=function(){var e="0123456789";function t(e,t,r,n){for(var i,o,s=[0],a=0,u=e.length;a<u;){for(o=s.length;o--;s[o]*=t);for(s[0]+=n.indexOf(e.charAt(a++)),i=0;i<s.length;i++)s[i]>r-1&&(null==s[i+1]&&(s[i+1]=0),s[i+1]+=s[i]/r|0,s[i]%=r)}return s.reverse()}return function(n,i,o,s,a){var u,c,f,l,h,p,d,y,g=n.indexOf("."),m=O,v=R;for(g>=0&&(l=U,U=0,n=n.replace(".",""),p=(y=new H(i)).pow(n.length-g),U=l,y.c=t(k(b(p.c),p.e,"0"),10,o,e),y.e=y.c.length),f=l=(d=t(n,i,o,a?(u=q,e):(u=e,q))).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,d=(p=r(p,y,m,v,o)).c,h=p.r,f=p.e),g=d[c=f+m+1],l=o/2,h=h||c<0||null!=d[c+1],h=v<4?(null!=g||h)&&(0==v||v==(p.s<0?3:2)):g>l||g==l&&(4==v||h||6==v&&1&d[c-1]||v==(p.s<0?8:7)),c<1||!d[0])n=h?k(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=k(n,f,u.charAt(0))}return n}}(),r=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--;)a=((i=c*(o=e[u]%y)+(n=f*o+(s=e[u]/y|0)*c)%y*y+a)/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,b,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)).c=[],B=o+(f=n.e-i.e)+1,a||(a=l,f=m(n.e/h)-m(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)))>1&&(P=e(P,y,a),C=e(C,y,a),I=P.length,A=C.length),E=I,S=(w=C.slice(0,I)).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))<0){if(k=w[0],I!=S&&(k=k*a+(w[1]||0)),(y=u(k/x))>1)for(y>=a&&(y=a-1),b=(g=e(P,y,a)).length,S=w.length;1==t(g,w,b,S);)y--,r(g,I<b?T:P,b,a),b=g.length,c=1;else 0==y&&(c=y=1),b=(g=P.slice()).length;if(b<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}}(),A=/^(-?)0([xbo])(?=\w[\w.]*$)/i,x=/^([^.]+)\.$/,I=/^\.([^.]+)$/,T=/^-?(Infinity|NaN)$/,B=/^\s*\+(?=[\w.])|^\s+|\s+$/g,i=function(e,t,r,n){var i,o=r?t:t.replace(B,"");if(!T.test(o)){if(!r&&(o=o.replace(A,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(x,"$1").replace(I,"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},C.absoluteValue=C.abs=function(){var e=new H(this);return e.s<0&&(e.s=1),e},C.comparedTo=function(e,t){return v(this,new H(e,t))},C.decimalPlaces=C.dp=function(e,t){var r,n,i,o=this;if(null!=e)return _(e,0,g),null==t?t=R:_(t,0,8),W(new H(o),e+o.e+1,t);if(!(r=o.c))return null;if(n=((i=r.length-1)-m(this.e/h))*h,i=r[i])for(;i%10==0;i/=10,n--);return n<0&&(n=0),n},C.dividedBy=C.div=function(e,t){return r(this,new H(e,t),O,R)},C.dividedToIntegerBy=C.idiv=function(e,t){return r(this,new H(e,t),0,1)},C.isEqualTo=C.eq=function(e,t){return 0===v(this,new H(e,t))},C.integerValue=function(e){var t=new H(this);return null==e?e=R:_(e,0,8),W(t,t.e+1,e)},C.isGreaterThan=C.gt=function(e,t){return v(this,new H(e,t))>0},C.isGreaterThanOrEqualTo=C.gte=function(e,t){return 1===(t=v(this,new H(e,t)))||0===t},C.isFinite=function(){return!!this.c},C.isInteger=function(){return!!this.c&&m(this.e/h)>this.c.length-2},C.isNaN=function(){return!this.s},C.isNegative=function(){return this.s<0},C.isPositive=function(){return this.s>0},C.isZero=function(){return!!this.c&&0==this.c[0]},C.isLessThan=C.lt=function(e,t){return v(this,new H(e,t))<0},C.isLessThanOrEqualTo=C.lte=function(e,t){return-1===(t=v(this,new H(e,t)))||0===t},C.minus=function(e,t){var r,n,i,o,s=this,a=s.s;if(t=(e=new H(e,t)).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==R?-0:0)}if(u=m(u),c=m(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))>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==R?-1:1,e.c=[e.e=0],e)},C.modulo=C.mod=function(e,t){var n,i,o=this;return e=new H(e,t),!o.c||!e.s||e.c&&!e.c[0]?new H(NaN):!e.c||o.c&&!o.c[0]?new H(o):(9==D?(i=e.s,e.s=1,n=r(o,e,0,3),e.s=i,n.s*=i):n=r(o,e,0,D),o.minus(n.times(e)))},C.multipliedBy=C.times=function(e,t){var r,n,i,o,s,a,u,c,f,p,d,g,b,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=m(w.e/h)+m(e.e/h),e.s*=w.s,(u=S.length)<(p=k.length)&&(b=S,S=k,k=b,i=u,u=p,p=i),i=u+p,b=[];i--;b.push(0));for(v=l,_=y,i=p;--i>=0;){for(r=0,d=k[i]%_,g=k[i]/_|0,o=i+(s=u);o>i;)r=((c=d*(c=S[--s]%_)+(a=g*c+(f=S[s]/_|0)*d)%_*_+b[o]+r)/v|0)+(a/_|0)+g*f,b[o--]=c%v;b[o]=r}return r?++n:b.splice(0,1),G(e,b,n)},C.negated=function(){var e=new H(this);return e.s=-e.s||null,e},C.plus=function(e,t){var r,n=this,i=n.s;if(t=(e=new H(e,t)).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=m(o),s=m(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)<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)},C.precision=C.sd=function(e,t){var r,n,i,o=this;if(null!=e&&e!==!!e)return _(e,1,g),null==t?t=R:_(t,0,8),W(new H(o),e,t);if(!(r=o.c))return null;if(n=(i=r.length-1)*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},C.shiftedBy=function(e){return _(e,-p,p),this.times("1e"+e)},C.squareRoot=C.sqrt=function(){var e,t,n,i,o,s=this,a=s.c,u=s.s,c=s.e,f=O+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(0==(u=Math.sqrt(+s))||u==1/0?(((t=b(a)).length+c)%2==0&&(t+="0"),u=Math.sqrt(t),c=m((c+1)/2)-(c<0||c%2),n=new H(t=u==1/0?"1e"+c:(t=u.toExponential()).slice(0,t.indexOf("e")+1)+c)):n=new H(u+""),n.c[0])for((u=(c=n.e)+f)<3&&(u=0);;)if(o=n,n=l.times(o.plus(r(s,o,f,1))),b(o.c).slice(0,u)===(t=b(n.c)).slice(0,u)){if(n.e<c&&--u,"9999"!=(t=t.slice(u-3,u+1))&&(i||"4999"!=t)){+t&&(+t.slice(1)||"5"!=t.charAt(0))||(W(n,n.e+O+2,1),e=!n.times(n).eq(s));break}if(!i&&(W(o,o.e+O+2,0),o.times(o).eq(s))){n=o;break}f+=4,u+=4,i=1}return W(n,n.e+O+1,R,e)},C.toExponential=function(e,t){return null!=e&&(_(e,0,g),e++),z(this,e,t,1)},C.toFixed=function(e,t){return null!=e&&(_(e,0,g),e=e+this.e+1),z(this,e,t)},C.toFormat=function(e,t){var r=this.toFixed(e,t);if(this.c){var n,i=r.split("."),o=+F.groupSize,s=+F.secondaryGroupSize,a=F.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+F.decimalSeparator+((s=+F.fractionGroupSize)?c.replace(new RegExp("\\d{"+s+"}\\B","g"),"$&"+F.fractionGroupSeparator):c):u}return r},C.toFraction=function(e){var t,n,i,o,s,a,u,f,l,p,y,g,m=this,v=m.c;if(null!=e&&(!(f=new H(e)).isInteger()||f.lt(P)))throw Error(c+"Argument "+(f.isInteger()?"out of range: ":"not an integer: ")+e);if(!v)return m.toString();for(n=new H(P),p=i=new H(P),o=l=new H(P),g=b(v),a=n.e=g.length-m.e-1,n.c[0]=d[(u=a%h)<0?h+u:u],e=!e||f.comparedTo(n)>0?a>0?n:p:f,u=j,j=1/0,f=new H(g),l.c[0]=0;y=r(f,n,0,1),1!=(s=i.plus(y.times(o))).comparedTo(e);)i=o,o=s,p=l.plus(y.times(s=p)),l=s,n=f.minus(y.times(s=n)),f=s;return s=r(e.minus(i),o,0,1),l=l.plus(s.times(p)),i=i.plus(s.times(o)),l.s=p.s=m.s,t=r(p,o,a*=2,R).minus(m).abs().comparedTo(r(l,i,a,R).minus(m).abs())<1?[p.toString(),o.toString()]:[l.toString(),i.toString()],j=u,t},C.toNumber=function(){return+this},C.exponentiatedBy=C.pow=function(e,t){var r,n,i,o,s=this;for(_(e,-p,p),null!=t&&(t=new H(t)),t?e>1&&s.gt(P)&&s.isInteger()&&t.gt(P)&&t.isInteger()?s=s.mod(t):(o=t,t=null):U&&(n=a(U/h+2)),i=new H(P),r=u(e<0?-e:e);;){if(r%2){if(!(i=i.times(s)).c)break;n?i.c.length>n&&(i.c.length=n):t&&(i=i.mod(t))}if(!(r=u(r/2)))break;s=s.times(s),n?s.c&&s.c.length>n&&(s.c.length=n):t&&(s=s.mod(t))}return t?i:(e<0&&(i=P.div(i)),o?i.mod(o):n?W(i,U,R):i)},C.toPrecision=function(e,t){return null!=e&&_(e,1,g),z(this,e,t,2)},C.toString=function(e){var t,r=this,i=r.s,o=r.e;return null===o?i?(t="Infinity",i<0&&(t="-"+t)):t="NaN":(t=b(r.c),null==e?t=o<=N||o>=L?S(t,o):k(t,o,"0"):(_(e,2,q.length,"Base"),t=n(k(t,o,"0"),10,e,i,!0)),i<0&&r.c[0]&&(t="-"+t)),t},C.valueOf=C.toJSON=function(){var e,t=this,r=t.e;return null===r?t.toString():(e=b(t.c),e=r<=N||r>=L?S(e,r):k(e,r,"0"),t.s<0?"-"+e:e)},C._isBigNumber=!0,null!=t&&H.set(t),H}()).default=o.BigNumber=o,void 0===(n=function(){return o}.call(t,r,t,e))||(e.exports=n)}()},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(341),o=r(152),s=r(12),a=r(9);(t=e.exports).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(776),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(818),o=r(824),s=r(17),a=r(126),u=r(53),c=r(123),f=r(2).Buffer;Object.assign(t,r(852)),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=t.zeros(20);return t.bufferToHex(e)},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){for(var r=(e=t.stripHexPrefix(e))[0];e.length>0&&"0"===r.toString();)r=(e=e.slice(1))[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"0x"+(e=t.toBuffer(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 64!==(e=t.toBuffer(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(65!==(e=t.toBuffer(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){return t.zeroAddress()===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=(r=new u(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(){return a.encode(e.raw)},r.forEach(function(r,n){function i(){return e.raw[n]}function o(i){"00"!==(i=t.toBuffer(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(833),n.short=r(834),n.mont=r(835),n.edwards=r(836)},function(e,t,r){"use strict";var n=t;n.base=r(882),n.short=r(883),n.mont=r(884),n.edwards=r(885)},function(e,t,r){"use strict";(function(t){var n=r(18),i=r(97),o=r(129),s=r(32),a=r(29),u=r(96),c=r(108),f=r(73),l=r(179),h=r(21);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);e=(t=s.fromBuffer(r)).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){return{bn:new s(e.bn,"hex"),network:u.get(e.network),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){return new p(p._getRandomBN(),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,r=this.network;return e=this.compressed?t.concat([new t([r.privatekey]),this.bn.toBuffer({size:32}),new t([1])]):t.concat([new t([r.privatekey]),this.bn.toBuffer({size:32})]),o.encode(e)},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(){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(18),i=r(432),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){return o.Buffer.isBuffer(e)&&(e=e.toString()),n.all(n.map(e,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(250),e.exports.Input=r(251),e.exports.Output=r(84),e.exports.UnspentOutput=r(434),e.exports.Signature=r(131),e.exports.Sighash=r(83)},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){return r(95).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");t=window.msCrypto}var r=new Uint8Array(e);return t.getRandomValues(r),new n(r)},i.getPseudoRandomBuffer=function(e){for(var t,r=new n(e),i=0;i<=e;i++){0==i-4*Math.floor(i/4)?(t=4294967296*Math.random(),r[i]=255&t):r[i]=255&(t>>>=8)}return r},e.exports=i}).call(this,r(7),r(0).Buffer)},function(e,t,r){"use strict";(function(t){var n=r(18),i=r(32),o=r(24),s=r(82),a=r(55),u=r(43),c=(r(29),r(21)),f=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&&c.checkState(this.hash===r.hash,"Argument object hash property does not match block hash."),this};f._from=function(e){var t={};if(o.isBuffer(e))t=f._fromBufferReader(s(e));else{if(!n.isObject(e))throw new TypeError("Unrecognized argument for BlockHeader");t=f._fromObject(e)}return t},f._fromObject=function(e){c.checkArgument(e,"data is required");var r=e.prevHash,i=e.merkleRoot,s=e.reserved,a=e.nonce,u=e.solution;return n.isString(e.prevHash)&&(r=o.reverse(new t(e.prevHash,"hex"))),n.isString(e.merkleRoot)&&(i=o.reverse(new t(e.merkleRoot,"hex"))),n.isString(e.reserved)&&(s=o.reverse(new t(e.reserved,"hex"))),n.isString(e.nonce)&&(a=o.reverse(new t(e.nonce,"hex"))),n.isString(e.solution)&&(u=new t(e.solution,"hex")),{hash:e.hash,version:e.version,prevHash:r,merkleRoot:i,reserved:s,time:e.time,timestamp:e.time,bits:e.bits,nonce:a,solution:u}},f.fromObject=function(e){var t=f._fromObject(e);return new f(t)},f.fromRawBlock=function(e){o.isBuffer(e)||(e=new t(e,"binary"));var r=s(e);r.pos=f.Constants.START_OF_HEADER;var n=f._fromBufferReader(r);return new f(n)},f.fromBuffer=function(e){var t=f._fromBufferReader(s(e));return new f(t)},f.fromString=function(e){var r=new t(e,"hex");return f.fromBuffer(r)},f._fromBufferReader=function(e){var t={};t.version=e.readUInt32LE(),t.prevHash=e.read(32),t.merkleRoot=e.read(32),t.reserved=e.read(32),t.time=e.readUInt32LE(),t.bits=e.readUInt32LE(),t.nonce=e.read(32);var r=e.readVarintNum();return t.solution=e.read(r),t},f.fromBufferReader=function(e){var t=f._fromBufferReader(e);return new f(t)},f.prototype.toObject=f.prototype.toJSON=function(){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")}},f.prototype.toBuffer=function(){return this.toBufferWriter().concat()},f.prototype.toString=function(){return this.toBuffer().toString("hex")},f.prototype.toBufferWriter=function(e){return e||(e=new a),e.writeUInt32LE(this.version),e.write(this.prevHash),e.write(this.merkleRoot),e.write(this.reserved),e.writeUInt32LE(this.time),e.writeUInt32LE(this.bits),e.write(this.nonce),e.writeVarintNum(this.solution.length),e.write(this.solution),e},f.prototype.getTargetDifficulty=function(e){e=e||this.bits;for(var t=new i(16777215&e),r=8*((e>>>24)-3);r-- >0;)t=t.mul(new i(2));return t},f.prototype.getDifficulty=function(){var e=this.getTargetDifficulty(537133055).mul(new i(Math.pow(10,8))),t=this.getTargetDifficulty(),r=e.div(t).toString(10),n=r.length-8;return r=r.slice(0,n)+"."+r.slice(n),parseFloat(r)},f.prototype._getHash=function(){var e=this.toBuffer();return u.sha256sha256(e)};var l={configurable:!1,enumerable:!0,get:function(){return this._id||(this._id=s(this._getHash()).readReverse().toString("hex")),this._id},set:n.noop};Object.defineProperty(f.prototype,"id",l),Object.defineProperty(f.prototype,"hash",l),f.prototype.validTimestamp=function(){var e=Math.round((new Date).getTime()/1e3);return!(this.time>e+f.Constants.MAX_TIME_OFFSET)},f.prototype.validProofOfWork=function(){var e=new i(this.id,"hex"),t=this.getTargetDifficulty();return!(e.cmp(t)>0)},f.prototype.inspect=function(){return"<BlockHeader "+this.id+">"},f.Constants={START_OF_HEADER:8,MAX_TIME_OFFSET:7200,LARGEST_HASH:new i("10000000000000000000000000000000000000000000000000000000000000000","hex")},e.exports=f}).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(;0<e.length;e++)e[0]=0}function s(e,t,r,n,i){for(var o,s,a,u,c=r[0],f=r[1],l=r[2],h=r[3],p=e[0]^t[0],d=e[1]^t[1],y=e[2]^t[2],g=e[3]^t[3],m=4,b=1;b<i;b++)o=c[p>>>24]^f[d>>>16&255]^l[y>>>8&255]^h[255&g]^t[m++],s=c[d>>>24]^f[y>>>16&255]^l[g>>>8&255]^h[255&p]^t[m++],a=c[y>>>24]^f[g>>>16&255]^l[p>>>8&255]^h[255&d]^t[m++],u=c[g>>>24]^f[p>>>16&255]^l[d>>>8&255]^h[255&y]^t[m++],p=o,d=s,y=a,g=u;return o=(n[p>>>24]<<24|n[d>>>16&255]<<16|n[y>>>8&255]<<8|n[255&g])^t[m++],s=(n[d>>>24]<<24|n[y>>>16&255]<<16|n[g>>>8&255]<<8|n[255&p])^t[m++],a=(n[y>>>24]<<24|n[g>>>16&255]<<16|n[p>>>8&255]<<8|n[255&d])^t[m++],u=(n[g>>>24]<<24|n[p>>>16&255]<<16|n[d>>>8&255]<<8|n[255&y])^t[m++],[o>>>=0,s>>>=0,a>>>=0,u>>>=0]}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 s(e=i(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){var t=(e=i(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(13);function i(e,t){n.cipher.registerAlgorithm(e,function(){return new n.des.Algorithm(e,t)})}r(257),r(446),r(19),e.exports=n.des=n.des||{},n.des.startEncrypting=function(e,t,r,n){var i=d({key:e,output:r,decrypt:!1,mode:n||(null===t?"ECB":"CBC")});return i.start(t),i},n.des.createEncryptionCipher=function(e,t){return d({key:e,output:null,decrypt:!1,mode:t})},n.des.startDecrypting=function(e,t,r,n){var i=d({key:e,output:r,decrypt:!0,mode:n||(null===t?"ECB":"CBC")});return i.start(t),i},n.des.createDecryptionCipher=function(e,t){return d({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 p(r._keys,e,t,!1)},decrypt:function(e,t){return p(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=function(e){for(var t,r=[0,4,536870912,536870916,65536,65540,536936448,536936452,512,516,536871424,536871428,66048,66052,536936960,536936964],n=[0,1,1048576,1048577,67108864,67108865,68157440,68157441,256,257,1048832,1048833,67109120,67109121,68157696,68157697],i=[0,8,2048,2056,16777216,16777224,16779264,16779272,0,8,2048,2056,16777216,16777224,16779264,16779272],o=[0,2097152,134217728,136314880,8192,2105344,134225920,136323072,131072,2228224,134348800,136445952,139264,2236416,134356992,136454144],s=[0,262144,16,262160,0,262144,16,262160,4096,266240,4112,266256,4096,266240,4112,266256],a=[0,1024,32,1056,0,1024,32,1056,33554432,33555456,33554464,33555488,33554432,33555456,33554464,33555488],u=[0,268435456,524288,268959744,2,268435458,524290,268959746,0,268435456,524288,268959744,2,268435458,524290,268959746],c=[0,65536,2048,67584,536870912,536936448,536872960,536938496,131072,196608,133120,198656,537001984,537067520,537004032,537069568],f=[0,262144,0,262144,2,262146,2,262146,33554432,33816576,33554432,33816576,33554434,33816578,33554434,33816578],l=[0,268435456,8,268435464,0,268435456,8,268435464,1024,268436480,1032,268436488,1024,268436480,1032,268436488],h=[0,32,0,32,1048576,1048608,1048576,1048608,8192,8224,8192,8224,1056768,1056800,1056768,1056800],p=[0,16777216,512,16777728,2097152,18874368,2097664,18874880,67108864,83886080,67109376,83886592,69206016,85983232,69206528,85983744],d=[0,4096,134217728,134221824,524288,528384,134742016,134746112,16,4112,134217744,134221840,524304,528400,134742032,134746128],y=[0,4,256,260,0,4,256,260,1,5,257,261,1,5,257,261],g=e.length()>8?3:1,m=[],b=[0,0,1,1,1,1,1,1,0,1,1,1,1,1,1,0],v=0,_=0;_<g;_++){var w=e.getInt32(),S=e.getInt32();w^=(t=252645135&(w>>>4^S))<<4,w^=t=65535&((S^=t)>>>-16^w),w^=(t=858993459&(w>>>2^(S^=t<<-16)))<<2,w^=t=65535&((S^=t)>>>-16^w),w^=(t=1431655765&(w>>>1^(S^=t<<-16)))<<1,w^=t=16711935&((S^=t)>>>8^w),t=(w^=(t=1431655765&(w>>>1^(S^=t<<8)))<<1)<<8|(S^=t)>>>20&240,w=S<<24|S<<8&16711680|S>>>8&65280|S>>>24&240,S=t;for(var k=0;k<b.length;++k){b[k]?(w=w<<2|w>>>26,S=S<<2|S>>>26):(w=w<<1|w>>>27,S=S<<1|S>>>27);var E=r[(w&=-15)>>>28]|n[w>>>24&15]|i[w>>>20&15]|o[w>>>16&15]|s[w>>>12&15]|a[w>>>8&15]|u[w>>>4&15],A=c[(S&=-15)>>>28]|f[S>>>24&15]|l[S>>>20&15]|h[S>>>16&15]|p[S>>>12&15]|d[S>>>8&15]|y[S>>>4&15];t=65535&(A>>>16^E),m[v++]=E^t,m[v++]=A^t<<16}}return m}(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,t,r,n){var i,p,d=32===e.length?3:9;i=3===d?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];y^=(p=252645135&(y>>>4^g))<<4,y^=(p=65535&(y>>>16^(g^=p)))<<16,y^=p=858993459&((g^=p)>>>2^y),y^=p=16711935&((g^=p<<2)>>>8^y),y=(y^=(p=1431655765&(y>>>1^(g^=p<<8)))<<1)<<1|y>>>31,g=(g^=p)<<1|g>>>31;for(var m=0;m<d;m+=3){for(var b=i[m+1],v=i[m+2],_=i[m];_!=b;_+=v){var w=g^e[_],S=(g>>>4|g<<28)^e[_+1];p=y,y=g,g=p^(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])}p=y,y=g,g=p}g=g>>>1|g<<31,g^=p=1431655765&((y=y>>>1|y<<31)>>>1^g),g^=(p=16711935&(g>>>8^(y^=p<<1)))<<8,g^=(p=858993459&(g>>>2^(y^=p)))<<2,g^=p=65535&((y^=p)>>>16^g),g^=p=252645135&((y^=p<<16)>>>4^g),y^=p<<4,r[0]=y,r[1]=g}function d(e){var t,r="DES-"+((e=e||{}).mode||"CBC").toUpperCase(),i=(t=e.decrypt?n.cipher.createDecipher(r,e.key):n.cipher.createCipher(r,e.key)).start;return t.start=function(e,r){var o=null;r instanceof n.util.ByteBuffer&&(o=r,r={}),(r=r||{}).output=o,r.iv=e,i.call(t,r)},t}},function(e,t,r){var n=r(13);if(r(76),r(184),r(99),r(454),r(455),r(69),r(19),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));for(var s=(e=e.multiply(o.modPow(t.e,t.n)).mod(t.n)).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.multiply(o.modInverse(t.n)).mod(t.n)};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,u=o-3-e.length;if(0===r||1===r){a=0===r?0:255;for(var c=0;c<u;++c)i.putByte(a)}else for(;u>0;){var f=0,l=n.random.getBytes(u);for(c=0;c<u;++c)0===(a=l.charCodeAt(c))?++f:i.putByte(a);u=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}if(0!==s.getByte()||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={});var o={algorithm:{name:(t=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}s.rsa.encrypt=function(e,t,r){var o,s=r,a=Math.ceil(t.n.bitLength()/8);!1!==r&&!0!==r?(s=2===r,o=d(e,t,r)):(o=n.util.createBuffer()).putBytes(e);for(var u=new i(o.toHex(),16),c=p(u,t,s).toString(16),f=n.util.createBuffer(),l=a-Math.ceil(c.length/2);l>0;)f.putByte(0),--l;return f.putBytes(n.util.hexToBytes(c)),f.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).toString(16),f=n.util.createBuffer(),l=s-Math.ceil(c.length/2);l>0;)f.putByte(0),--l;return f.putBytes(n.util.hexToBytes(c)),!1!==o?y(f.getBytes(),t,r):f.getBytes()},s.rsa.createKeyPairGenerationState=function(e,t,r){"string"==typeof e&&(e=parseInt(e,10)),e=e||2048;var o,s=(r=r||{}).prng||n.random,a={nextBytes:function(e){for(var t=s.getBytesSync(e.length),r=0;r<e.length;++r)e[r]=t.charCodeAt(r)}},u=r.algorithm||"PRIMEINC";if("PRIMEINC"!==u)throw new Error("Invalid key generation algorithm: "+u);return(o={algorithm:u,state:0,bits:e,rng:a,eInt:t||65537,e:new i(null),p:null,q:null,qBits:e>>1,pBits:e-(e>>1),pqState:0,num:null,keys:null}).e.fromInt(o.eInt),o},s.rsa.stepKeyPairGenerationState=function(e,t){"algorithm"in e||(e.algorithm="PRIMEINC");var r=new i(null);r.fromInt(30);for(var n,o=0,u=function(e,t){return e|t},c=+new Date,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),u,e.num),e.num.dAddOffset(31-e.num.mod(r).byteValue(),0),o=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[o++%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)}}f+=(n=+new Date)-c,c=n}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){return t=y(t,r,!0),e===o.fromDer(t).value[1].value}}:"NONE"!==n&&"NULL"!==n&&null!==n||(n={verify:function(e,t){return e===y(t,r,!0)}});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,y,g)&&(e=o.fromDer(n.util.createBuffer(y.privateKey))),y={},g=[],!o.validate(e,c,y,g)){var m=new Error("Cannot read private key. ASN.1 object does not contain an RSAPrivateKey.");throw m.errors=g,m}return t=n.util.createBuffer(y.privateKeyModulus).toHex(),r=n.util.createBuffer(y.privateKeyPublicExponent).toHex(),a=n.util.createBuffer(y.privateKeyPrivateExponent).toHex(),f=n.util.createBuffer(y.privateKeyPrime1).toHex(),l=n.util.createBuffer(y.privateKeyPrime2).toHex(),h=n.util.createBuffer(y.privateKeyExponent1).toHex(),p=n.util.createBuffer(y.privateKeyExponent2).toHex(),d=n.util.createBuffer(y.privateKeyCoefficient).toHex(),s.setRsaPrivateKey(new i(t,16),new i(r,16),new i(a,16),new i(f,16),new i(l,16),new i(h,16),new i(p,16),new i(d,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,u=o.derToOid(t.publicKeyOid);if(u!==s.oids.rsaEncryption)throw(a=new Error("Cannot read public key. Unknown OID.")).oid=u,a;e=t.rsaPublicKey}if(r=[],!o.validate(e,f,t,r))throw(a=new Error("Cannot read public key. ASN.1 object does not contain an RSAPublicKey.")).errors=r,a;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,i=r(13);e.exports=i.jsbn=i.jsbn||{};function o(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 s(){return new o(null)}function a(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;i=((u=s*u+((16383&f)<<14)+r.data[n]+i)>>28)+(f>>14)+a*c,r.data[n++]=268435455&u}return i}i.jsbn.BigInteger=o,"undefined"==typeof navigator?(o.prototype.am=a,n=28):"Microsoft Internet Explorer"==navigator.appName?(o.prototype.am=function(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;i=((u=s*u+((32767&f)<<15)+r.data[n]+(1073741823&i))>>>30)+(f>>>15)+a*c+(i>>>30),r.data[n++]=1073741823&u}return i},n=30):"Netscape"!=navigator.appName?(o.prototype.am=function(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},n=26):(o.prototype.am=a,n=28),o.prototype.DB=n,o.prototype.DM=(1<<n)-1,o.prototype.DV=1<<n;o.prototype.FV=Math.pow(2,52),o.prototype.F1=52-n,o.prototype.F2=2*n-52;var u,c,f="0123456789abcdefghijklmnopqrstuvwxyz",l=new Array;for(u="0".charCodeAt(0),c=0;c<=9;++c)l[u++]=c;for(u="a".charCodeAt(0),c=10;c<36;++c)l[u++]=c;for(u="A".charCodeAt(0),c=10;c<36;++c)l[u++]=c;function h(e){return f.charAt(e)}function p(e,t){var r=l[e.charCodeAt(t)];return null==r?-1:r}function d(e){var t=s();return t.fromInt(e),t}function y(e){var t,r=1;return 0!=(t=e>>>16)&&(e=t,r+=16),0!=(t=e>>8)&&(e=t,r+=8),0!=(t=e>>4)&&(e=t,r+=4),0!=(t=e>>2)&&(e=t,r+=2),0!=(t=e>>1)&&(e=t,r+=1),r}function g(e){this.m=e}function m(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 b(e,t){return e&t}function v(e,t){return e|t}function _(e,t){return e^t}function w(e,t){return e&~t}function S(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 k(e){for(var t=0;0!=e;)e&=e-1,++t;return t}function E(){}function A(e){return e}function x(e){this.r2=s(),this.q3=s(),o.ONE.dlShiftTo(2*e.t,this.r2),this.mu=this.r2.divide(e),this.m=e}g.prototype.convert=function(e){return e.s<0||e.compareTo(this.m)>=0?e.mod(this.m):e},g.prototype.revert=function(e){return e},g.prototype.reduce=function(e){e.divRemTo(this.m,null,e)},g.prototype.mulTo=function(e,t,r){e.multiplyTo(t,r),this.reduce(r)},g.prototype.sqrTo=function(e,t){e.squareTo(t),this.reduce(t)},m.prototype.convert=function(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},m.prototype.revert=function(e){var t=s();return e.copyTo(t),this.reduce(t),t},m.prototype.reduce=function(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)},m.prototype.mulTo=function(e,t,r){e.multiplyTo(t,r),this.reduce(r)},m.prototype.sqrTo=function(e,t){e.squareTo(t),this.reduce(t)},o.prototype.copyTo=function(e){for(var t=this.t-1;t>=0;--t)e.data[t]=this.data[t];e.t=this.t,e.s=this.s},o.prototype.fromInt=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},o.prototype.fromString=function(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]:p(e,n);a<0?"-"==e.charAt(n)&&(i=!0):(i=!1,0==s?this.data[this.t++]=a:s+r>this.DB?(this.data[this.t-1]|=(a&(1<<this.DB-s)-1)<<s,this.data[this.t++]=a>>this.DB-s):this.data[this.t-1]|=a<<s,(s+=r)>=this.DB&&(s-=this.DB))}8==r&&0!=(128&e[0])&&(this.s=-1,s>0&&(this.data[this.t-1]|=(1<<this.DB-s)-1<<s)),this.clamp(),i&&o.ZERO.subTo(this,this)},o.prototype.clamp=function(){for(var e=this.s&this.DM;this.t>0&&this.data[this.t-1]==e;)--this.t},o.prototype.dlShiftTo=function(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},o.prototype.drShiftTo=function(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},o.prototype.lShiftTo=function(e,t){var r,n=e%this.DB,i=this.DB-n,o=(1<<i)-1,s=Math.floor(e/this.DB),a=this.s<<n&this.DM;for(r=this.t-1;r>=0;--r)t.data[r+s+1]=this.data[r]>>i|a,a=(this.data[r]&o)<<n;for(r=s-1;r>=0;--r)t.data[r]=0;t.data[s]=a,t.t=this.t+s+1,t.s=this.s,t.clamp()},o.prototype.rShiftTo=function(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()}},o.prototype.subTo=function(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()},o.prototype.multiplyTo=function(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&&o.ZERO.subTo(t,t)},o.prototype.squareTo=function(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()},o.prototype.divRemTo=function(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-y(n.data[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.data[l-1];if(0!=h){var p=h*(1<<this.F1)+(l>1?a.data[l-2]>>this.F2:0),d=this.FV/p,g=(1<<this.F1)/p,m=1<<this.F2,b=r.t,v=b-l,_=null==t?s():t;for(a.dlShiftTo(v,_),r.compareTo(_)>=0&&(r.data[r.t++]=1,r.subTo(_,r)),o.ONE.dlShiftTo(l,_),_.subTo(a,a);a.t<l;)a.data[a.t++]=0;for(;--v>=0;){var w=r.data[--b]==h?this.DM:Math.floor(r.data[b]*d+(r.data[b-1]+m)*g);if((r.data[b]+=a.am(0,w,r,v,0,l))<w)for(a.dlShiftTo(v,_),r.subTo(_,r);r.data[b]<--w;)r.subTo(_,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)}}},o.prototype.invDigit=function(){if(this.t<1)return 0;var e=this.data[0];if(0==(1&e))return 0;var t=3&e;return(t=(t=(t=(t=t*(2-(15&e)*t)&15)*(2-(255&e)*t)&255)*(2-((65535&e)*t&65535))&65535)*(2-e*t%this.DV)%this.DV)>0?this.DV-t:-t},o.prototype.isEven=function(){return 0==(this.t>0?1&this.data[0]:this.s)},o.prototype.exp=function(e,t){if(e>4294967295||e<1)return o.ONE;var r=s(),n=s(),i=t.convert(this),a=y(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)},o.prototype.toString=function(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,n=(1<<t)-1,i=!1,o="",s=this.t,a=this.DB-s*this.DB%t;if(s-- >0)for(a<this.DB&&(r=this.data[s]>>a)>0&&(i=!0,o=h(r));s>=0;)a<t?(r=(this.data[s]&(1<<a)-1)<<t-a,r|=this.data[--s]>>(a+=this.DB-t)):(r=this.data[s]>>(a-=t)&n,a<=0&&(a+=this.DB,--s)),r>0&&(i=!0),i&&(o+=h(r));return i?o:"0"},o.prototype.negate=function(){var e=s();return o.ZERO.subTo(this,e),e},o.prototype.abs=function(){return this.s<0?this.negate():this},o.prototype.compareTo=function(e){var t=this.s-e.s;if(0!=t)return t;var r=this.t;if(0!=(t=r-e.t))return this.s<0?-t:t;for(;--r>=0;)if(0!=(t=this.data[r]-e.data[r]))return t;return 0},o.prototype.bitLength=function(){return this.t<=0?0:this.DB*(this.t-1)+y(this.data[this.t-1]^this.s&this.DM)},o.prototype.mod=function(e){var t=s();return this.abs().divRemTo(e,null,t),this.s<0&&t.compareTo(o.ZERO)>0&&e.subTo(t,t),t},o.prototype.modPowInt=function(e,t){var r;return r=e<256||t.isEven()?new g(t):new m(t),this.exp(e,r)},o.ZERO=d(0),o.ONE=d(1),E.prototype.convert=A,E.prototype.revert=A,E.prototype.mulTo=function(e,t,r){e.multiplyTo(t,r)},E.prototype.sqrTo=function(e,t){e.squareTo(t)},x.prototype.convert=function(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},x.prototype.revert=function(e){return e},x.prototype.reduce=function(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)},x.prototype.mulTo=function(e,t,r){e.multiplyTo(t,r),this.reduce(r)},x.prototype.sqrTo=function(e,t){e.squareTo(t),this.reduce(t)};var I=[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],T=(1<<26)/I[I.length-1];o.prototype.chunkSize=function(e){return Math.floor(Math.LN2*this.DB/Math.log(e))},o.prototype.toRadix=function(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=d(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},o.prototype.fromRadix=function(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=p(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)},o.prototype.fromNumber=function(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),v,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)}},o.prototype.bitwiseTo=function(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()},o.prototype.changeBit=function(e,t){var r=o.ONE.shiftLeft(e);return this.bitwiseTo(r,t,r),r},o.prototype.addTo=function(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()},o.prototype.dMultiply=function(e){this.data[this.t]=this.am(0,e-1,this,0,0,this.t),++this.t,this.clamp()},o.prototype.dAddOffset=function(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]}},o.prototype.multiplyLowerTo=function(e,t,r){var n,i=Math.min(this.t+e.t,t);for(r.s=0,r.t=i;i>0;)r.data[--i]=0;for(n=r.t-this.t;i<n;++i)r.data[i+this.t]=this.am(0,e.data[i],r,i,0,this.t);for(n=Math.min(e.t,t);i<n;++i)this.am(0,e.data[i],r,i,0,t-i);r.clamp()},o.prototype.multiplyUpperTo=function(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)},o.prototype.modInt=function(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},o.prototype.millerRabin=function(e){var t=this.subtract(o.ONE),r=t.getLowestSetBit();if(r<=0)return!1;for(var n,i=t.shiftRight(r),s={nextBytes:function(e){for(var t=0;t<e.length;++t)e[t]=Math.floor(256*Math.random())}},a=0;a<e;++a){do{n=new o(this.bitLength(),s)}while(n.compareTo(o.ONE)<=0||n.compareTo(t)>=0);var u=n.modPow(i,this);if(0!=u.compareTo(o.ONE)&&0!=u.compareTo(t)){for(var c=1;c++<r&&0!=u.compareTo(t);)if(0==(u=u.modPowInt(2,this)).compareTo(o.ONE))return!1;if(0!=u.compareTo(t))return!1}}return!0},o.prototype.clone=function(){var e=s();return this.copyTo(e),e},o.prototype.intValue=function(){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]},o.prototype.byteValue=function(){return 0==this.t?this.s:this.data[0]<<24>>24},o.prototype.shortValue=function(){return 0==this.t?this.s:this.data[0]<<16>>16},o.prototype.signum=function(){return this.s<0?-1:this.t<=0||1==this.t&&this.data[0]<=0?0:1},o.prototype.toByteArray=function(){var e=this.t,t=new Array;t[0]=this.s;var r,n=this.DB-e*this.DB%8,i=0;if(e-- >0)for(n<this.DB&&(r=this.data[e]>>n)!=(this.s&this.DM)>>n&&(t[i++]=r|this.s<<this.DB-n);e>=0;)n<8?(r=(this.data[e]&(1<<n)-1)<<8-n,r|=this.data[--e]>>(n+=this.DB-8)):(r=this.data[e]>>(n-=8)&255,n<=0&&(n+=this.DB,--e)),0!=(128&r)&&(r|=-256),0==i&&(128&this.s)!=(128&r)&&++i,(i>0||r!=this.s)&&(t[i++]=r);return t},o.prototype.equals=function(e){return 0==this.compareTo(e)},o.prototype.min=function(e){return this.compareTo(e)<0?this:e},o.prototype.max=function(e){return this.compareTo(e)>0?this:e},o.prototype.and=function(e){var t=s();return this.bitwiseTo(e,b,t),t},o.prototype.or=function(e){var t=s();return this.bitwiseTo(e,v,t),t},o.prototype.xor=function(e){var t=s();return this.bitwiseTo(e,_,t),t},o.prototype.andNot=function(e){var t=s();return this.bitwiseTo(e,w,t),t},o.prototype.not=function(){for(var e=s(),t=0;t<this.t;++t)e.data[t]=this.DM&~this.data[t];return e.t=this.t,e.s=~this.s,e},o.prototype.shiftLeft=function(e){var t=s();return e<0?this.rShiftTo(-e,t):this.lShiftTo(e,t),t},o.prototype.shiftRight=function(e){var t=s();return e<0?this.lShiftTo(-e,t):this.rShiftTo(e,t),t},o.prototype.getLowestSetBit=function(){for(var e=0;e<this.t;++e)if(0!=this.data[e])return e*this.DB+S(this.data[e]);return this.s<0?this.t*this.DB:-1},o.prototype.bitCount=function(){for(var e=0,t=this.s&this.DM,r=0;r<this.t;++r)e+=k(this.data[r]^t);return e},o.prototype.testBit=function(e){var t=Math.floor(e/this.DB);return t>=this.t?0!=this.s:0!=(this.data[t]&1<<e%this.DB)},o.prototype.setBit=function(e){return this.changeBit(e,v)},o.prototype.clearBit=function(e){return this.changeBit(e,w)},o.prototype.flipBit=function(e){return this.changeBit(e,_)},o.prototype.add=function(e){var t=s();return this.addTo(e,t),t},o.prototype.subtract=function(e){var t=s();return this.subTo(e,t),t},o.prototype.multiply=function(e){var t=s();return this.multiplyTo(e,t),t},o.prototype.divide=function(e){var t=s();return this.divRemTo(e,t,null),t},o.prototype.remainder=function(e){var t=s();return this.divRemTo(e,null,t),t},o.prototype.divideAndRemainder=function(e){var t=s(),r=s();return this.divRemTo(e,t,r),new Array(t,r)},o.prototype.modPow=function(e,t){var r,n,i=e.bitLength(),o=d(1);if(i<=0)return o;r=i<18?1:i<48?3:i<144?4:i<768?5:6,n=i<8?new g(t):t.isEven()?new x(t):new m(t);var a=new Array,u=3,c=r-1,f=(1<<r)-1;if(a[1]=n.convert(this),r>1){var l=s();for(n.sqrTo(a[1],l);u<=f;)a[u]=s(),n.mulTo(l,a[u-2],a[u]),u+=2}var h,p,b=e.t-1,v=!0,_=s();for(i=y(e.data[b])-1;b>=0;){for(i>=c?h=e.data[b]>>i-c&f:(h=(e.data[b]&(1<<i+1)-1)<<c-i,b>0&&(h|=e.data[b-1]>>this.DB+i-c)),u=r;0==(1&h);)h>>=1,--u;if((i-=u)<0&&(i+=this.DB,--b),v)a[h].copyTo(o),v=!1;else{for(;u>1;)n.sqrTo(o,_),n.sqrTo(_,o),u-=2;u>0?n.sqrTo(o,_):(p=o,o=_,_=p),n.mulTo(_,a[h],o)}for(;b>=0&&0==(e.data[b]&1<<i);)n.sqrTo(o,_),p=o,o=_,_=p,--i<0&&(i=this.DB-1,--b)}return n.revert(o)},o.prototype.modInverse=function(e){var t=e.isEven();if(this.isEven()&&t||0==e.signum())return o.ZERO;for(var r=e.clone(),n=this.clone(),i=d(1),s=d(0),a=d(0),u=d(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},o.prototype.pow=function(e){return this.exp(e,new E)},o.prototype.gcd=function(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},o.prototype.isProbablePrime=function(e){var t,r=this.abs();if(1==r.t&&r.data[0]<=I[I.length-1]){for(t=0;t<I.length;++t)if(r.data[0]==I[t])return!0;return!1}if(r.isEven())return!1;for(t=1;t<I.length;){for(var n=I[t],i=t+1;i<I.length&&n<T;)n*=I[i++];for(n=r.modInt(n);t<i;)if(n%I[t++]==0)return!1}return r.millerRabin(e)}},function(e,t,r){"use strict";var n=r(2).Buffer,i=r(950);function o(){this.negative=0,this.words=null,this.length=0}o.fromNumber=function(e){var t=new o;return t.words=[67108863&e],t.length=1,t},o.fromBuffer=function(e){var t=new o;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()},o.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]])},o.prototype.clone=function(){var e=new o;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},o.prototype.strip=function(){for(;this.length>1&&0==(0|this.words[this.length-1]);)this.length--;return this},o.prototype.normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},o.prototype.isEven=function(){return 0==(1&this.words[0])},o.prototype.isOdd=function(){return 1==(1&this.words[0])},o.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},o.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},o.prototype.gtOne=function(){return this.length>1||this.words[0]>1},o.prototype.isOverflow=function(){return this.ucmp(o.n)>=0},o.prototype.isHigh=function(){return 1===this.ucmp(o.nh)},o.prototype.bitLengthGT256=function(){return this.length>10||10===this.length&&this.words[9]>4194303},o.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},o.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},o.prototype.add=function(e){return this.clone().iadd(e)},o.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,r,n=this.ucmp(e);if(0===n)return this.negative=0,this.words[0]=0,this.length=1,this;n>0?(t=this,r=e):(t=e,r=this);for(var i=0,o=0;i<r.length;++i){var s=t.words[i]-r.words[i]+o;o=s>>26,this.words[i]=67108863&s}for(;0!==o&&i<t.length;++i)o=(s=t.words[i]+o)>>26,this.words[i]=67108863&s;if(0===o&&i<t.length&&t!==this)for(;i<t.length;++i)this.words[i]=t.words[i];return this.length=Math.max(this.length,i),t!==this&&(this.negative^=1),this.strip().normSign()},o.prototype.sub=function(e){return this.clone().isub(e)},o.umulTo=function(e,t,r){r.length=e.length+t.length-1;var n=e.words[0]*t.words[0],i=n/67108864|0;r.words[0]=67108863&n;for(var o=1,s=r.length;o<s;o++){for(var a=i>>>26,u=67108863&i,c=Math.max(0,o-e.length+1),f=Math.min(o,t.length-1);c<=f;c++){var l=o-c,h=e.words[l]*t.words[c]+u;a+=h/67108864|0,u=67108863&h}r.words[o]=u,i=a}return 0!==i&&(r.words[r.length++]=i),r.strip()},o.umulTo10x10=Math.imul?i.umulTo10x10:o.umulTo,o.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},o.prototype.umul=function(e){var t=new o;return t.words=new Array(this.length+e.length),10===this.length&&10===e.length?o.umulTo10x10(this,e,t):1===this.length?o.umulnTo(e,this.words[0],t):1===e.length?o.umulnTo(this,e.words[0],t):o.umulTo(this,e,t)},o.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},o.prototype.fireduce=function(){return this.isOverflow()&&this.isub(o.n),this},o.prototype.ureduce=function(){var e=this.clone().isplit(o.tmp).umul(o.nc).iadd(o.tmp);return e.bitLengthGT256()&&(e=e.isplit(o.tmp).umul(o.nc).iadd(o.tmp)).bitLengthGT256()&&(e=e.isplit(o.tmp).umul(o.nc).iadd(o.tmp)),e.fireduce()},o.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},o.prototype.uinvm=function(){for(var e=this.clone(),t=o.n.clone(),r=o.fromNumber(1),n=o.fromNumber(0),i=o.fromNumber(0),s=o.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()||s.isOdd())&&(i.iadd(c),s.isub(f)),i.ishrn(1),s.ishrn(1);e.ucmp(t)>=0?(e.isub(t),r.isub(i),n.isub(s)):(t.isub(e),i.isub(r),s.isub(n))}if(1===i.negative){i.negative=0;var y=i.ureduce();return y.negative^=1,y.normSign().iadd(o.n)}return i.ureduce()},o.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},o.prototype.redIReduce=function(){this.isplit(o.tmp).imulK().iadd(o.tmp),this.bitLengthGT256()&&this.isplit(o.tmp).imulK().iadd(o.tmp);var e=this.ucmp(o.p);return 0===e?(this.words[0]=0,this.length=1):e>0?this.isub(o.p):this.strip(),this},o.prototype.redNeg=function(){return this.isZero()?o.fromNumber(0):o.p.sub(this)},o.prototype.redAdd=function(e){return this.clone().redIAdd(e)},o.prototype.redIAdd=function(e){return this.iadd(e),this.ucmp(o.p)>=0&&this.isub(o.p),this},o.prototype.redIAdd7=function(){return this.iuaddn(7),this.ucmp(o.p)>=0&&this.isub(o.p),this},o.prototype.redSub=function(e){return this.clone().redISub(e)},o.prototype.redISub=function(e){return this.isub(e),0!==this.negative&&this.iadd(o.p),this},o.prototype.redMul=function(e){return this.umul(e).redIReduce()},o.prototype.redSqr=function(){return this.umul(this).redIReduce()},o.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 0===(o=(o=o.redSqr().redSqr().redSqr().redSqr().redMul(r)).redSqr().redSqr().redSqr().redSqr().redSqr().redSqr().redMul(r)).redSqr().ucmp(this)?o:null},o.prototype.redInvm=function(){for(var e,t=this.clone(),r=o.p.clone(),n=o.fromNumber(1),i=o.fromNumber(0);t.gtOne()&&r.gtOne();){for(var s=0,a=1;0==(t.words[0]&a)&&s<26;++s,a<<=1);if(s>0)for(t.ishrn(s);s-- >0;)n.isOdd()&&n.iadd(o.p),n.ishrn(1);for(var u=0,c=1;0==(r.words[0]&c)&&u<26;++u,c<<=1);if(u>0)for(r.ishrn(u);u-- >0;)i.isOdd()&&i.iadd(o.p),i.ishrn(1);t.ucmp(r)>=0?(t.isub(r),n.isub(i)):(r.isub(t),i.isub(n))}return 0!==(e=1===t.length&&1===t.words[0]?n:i).negative&&e.iadd(o.p),0!==e.negative?(e.negative=0,e.redIReduce().redNeg()):e.redIReduce()},o.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},o.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)},o.n=o.fromBuffer(n.from("FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141","hex")),o.nh=o.n.clone().ishrn(1),o.nc=o.fromBuffer(n.from("000000000000000000000000000000014551231950B75FC4402DA1732FC9BEBF","hex")),o.p=o.fromBuffer(n.from("FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFC2F","hex")),o.psn=o.p.sub(o.n),o.tmp=new o,o.tmp.words=new Array(10),o.fromNumber(1).words[3]=0,e.exports=o},function(e,t,r){"use strict";const n=r(10),i=r(151),o=r(1042),s=r(17),a=r(50),u=r(9),c=r(345),f=r(1043),l=r(65),h=n(r(1044)),p=r(1045);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(1046),i=r(1047);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=o(r(1054)),i=o(r(217));function o(e){return e&&e.__esModule?e:{default:e}}t.default=(0,i.default)(n.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=u;var n=r(1)("simple-peer"),i=r(1112),o=r(5),s=r(107),a=r(22);function u(e){var t=this;if(!(t instanceof u))return new u(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||u.channelConfig,t.config=e.config||u.config,t.constraints=t._transformConstraints(e.constraints||u.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?c("No WebRTC support: Specify `opts.wrtc` option in this environment","ERR_WEBRTC_SUPPORT"):c("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 c(e,t){var r=new Error(e);return r.code=t,r}function f(){}o(u,a.Duplex),u.WEBRTC_SUPPORT=!!i(),u.config={iceServers:[{urls:"stun:stun.l.google.com:19302"},{urls:"stun:global.stun.twilio.com:3478?transport=udp"}]},u.constraints={},u.channelConfig={},Object.defineProperty(u.prototype,"bufferSize",{get:function(){return this._channel&&this._channel.bufferedAmount||0}}),u.prototype.address=function(){return{port:this.localPort,family:"IPv4",address:this.localAddress}},u.prototype.signal=function(e){var t=this;if(t.destroyed)throw c("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(c(e,"ERR_SET_REMOTE_DESCRIPTION"))}),e.sdp||e.candidate||e.renegotiate||t.destroy(c("signal() called with invalid signal data","ERR_SIGNALING"))},u.prototype._addIceCandidate=function(e){var t=this;try{t._pc.addIceCandidate(new t._wrtc.RTCIceCandidate(e),f,function(e){t.destroy(c(e,"ERR_ADD_ICE_CANDIDATE"))})}catch(e){t.destroy(c("error adding candidate: "+e.message,"ERR_ADD_ICE_CANDIDATE"))}},u.prototype.send=function(e){this._channel.send(e)},u.prototype.addStream=function(e){var t=this;t._debug("addStream()"),e.getTracks().forEach(function(r){t.addTrack(r,e)})},u.prototype.addTrack=function(e,t){this._debug("addTrack()");var r=this._pc.addTrack(e,t),n=this._senderMap.get(e)||new WeakMap;n.set(t,r),this._senderMap.set(e,n),this._needsNegotiation()},u.prototype.removeTrack=function(e,t){this._debug("removeSender()");var r=this._senderMap.get(e),n=r?r.get(t):null;n||this.destroy(new Error("Cannot remove track that was never added."));try{this._pc.removeTrack(n)}catch(e){"NS_ERROR_UNEXPECTED"===e.name?this._sendersAwaitingStable.push(n):this.destroy(e)}},u.prototype.removeStream=function(e){var t=this;t._debug("removeSenders()"),e.getTracks().forEach(function(r){t.removeTrack(r,e)})},u.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))},u.prototype.negotiate=function(){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},u.prototype.destroy=function(e){this._destroy(e,function(){})},u.prototype._destroy=function(e,t){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()}},u.prototype._setupData=function(e){var t=this;if(!e.channel)return t.destroy(c("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(c(e,"ERR_DATA_CHANNEL"))}},u.prototype._read=function(){},u.prototype._write=function(e,t,r){if(this.destroyed)return r(c("cannot write after peer is destroyed","ERR_DATA_CHANNEL"));if(this.connected){try{this.send(e)}catch(e){return this.destroy(c(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},u.prototype._onFinish=function(){var e=this;function t(){setTimeout(function(){e.destroy()},1e3)}e.destroyed||(e.connected?t():e.once("connect",t))},u.prototype._createOffer=function(){var e=this;e.destroyed||e._pc.createOffer(function(t){function r(){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,function(){e._debug("createOffer success"),e.destroyed||(e.trickle||e._iceComplete?r():e.once("_iceComplete",r))},function(t){e.destroy(c(t,"ERR_SET_LOCAL_DESCRIPTION"))}))},function(t){e.destroy(c(t,"ERR_CREATE_OFFER"))},e.offerConstraints)},u.prototype._createAnswer=function(){var e=this;e.destroyed||e._pc.createAnswer(function(t){function r(){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,function(){e.destroyed||(e.trickle||e._iceComplete?r():e.once("_iceComplete",r))},function(t){e.destroy(c(t,"ERR_SET_LOCAL_DESCRIPTION"))}))},function(t){e.destroy(c(t,"ERR_CREATE_ANSWER"))},e.answerConstraints)},u.prototype._onIceStateChange=function(){if(!this.destroyed){var e=this._pc.iceConnectionState,t=this._pc.iceGatheringState;this._debug("iceStateChange (connection: %s) (gathering: %s)",e,t),this.emit("iceStateChange",e,t),"connected"!==e&&"completed"!==e||(this._pcReady=!0,this._maybeReady()),"failed"===e&&this.destroy(c("Ice connection failed.","ERR_ICE_CONNECTION_FAILURE")),"closed"===e&&this.destroy(new Error("Ice connection closed."))}},u.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,[])},u.prototype._maybeReady=function(){var e=this;e._debug("maybeReady pc %s channel %s",e._pcReady,e._channelReady),!e.connected&&!e._connecting&&e._pcReady&&e._channelReady&&(e._connecting=!0,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&&f(s[e.selectedCandidatePairId]),("googCandidatePair"===e.type&&"true"===e.googActiveConnection||("candidatepair"===e.type||"candidate-pair"===e.type)&&e.selected)&&f(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(c(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 f(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)}})}())},u.prototype._onInterval=function(){!this._cb||!this._channel||this._channel.bufferedAmount>65536||this._onChannelBufferedAmountLow()},u.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))},u.prototype._onIceCandidate=function(e){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")))},u.prototype._onChannelMessage=function(e){if(!this.destroyed){var r=e.data;r instanceof ArrayBuffer&&(r=t.from(r)),this.push(r)}},u.prototype._onChannelBufferedAmountLow=function(){if(!this.destroyed&&this._cb){this._debug("ending backpressure: bufferedAmount %d",this._channel.bufferedAmount);var e=this._cb;this._cb=null,e(null)}},u.prototype._onChannelOpen=function(){this.connected||this.destroyed||(this._debug("on channel open"),this._channelReady=!0,this._maybeReady())},u.prototype._onChannelClose=function(){this.destroyed||(this._debug("on channel close"),this.destroy())},u.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))})},u.prototype._debug=function(){var e=[].slice.call(arguments);e[0]="["+this._id+"] "+e[0],n.apply(null,e)},u.prototype._transformConstraints=function(e){if(0===Object.keys(e).length)return e;if((e.mandatory||e.optional)&&!this._isChromium){var t=Object.assign({},e.optional,e.mandatory);return void 0!==t.OfferToReceiveVideo&&(t.offerToReceiveVideo=t.OfferToReceiveVideo,delete t.OfferToReceiveVideo),void 0!==t.OfferToReceiveAudio&&(t.offerToReceiveAudio=t.OfferToReceiveAudio,delete t.OfferToReceiveAudio),t}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){(function(n){r(70);var i=r(531);function o(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 o(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 s(e,t,r){var s,a,u=!1;function c(){a||(a=!0,r&&r(!0===s?null:s))}function f(){u||(u=!0,h(),s?c():e(s=!0,c))}function l(t){h(),s||e(s=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(){i(function(r){e(null,function(e,n){return s=s||e,!0===e?t._isStdio?c():t.end():(s=s||e)?(o(t),c()):void(t._isStdio?t.write(n,function(){r()}):!1===t.write(n)?t.once("drain",r):r())})})})}function a(e){var t,r=[],n=[],i=!1;function s(){for(;(r.length||t)&&n.length;)n.shift()(r.length?null:t,r.shift());!r.length&&i&&(i=!1,e.resume())}return e.on("data",function(t){r.push(t),s(),r.length&&e.pause&&(i=!0,e.pause())}),e.on("end",function(){t=!0,s()}),e.on("close",function(){t=!0,s()}),e.on("error",function(e){t=e,s()}),function(r,i){if(!i)throw new Error("*must* provide cb");if(r){function a(){for(;n.length;)n.shift()(r);i(r)}if(t)return a();e.once("close",a),o(e)}else n.push(i),s()}}var u=a,c=function(e,t){return function(r){return s(r,e,t)}},f=function(e){return a(e)};(t=e.exports=function(e,t){return e.writable&&e.write?e.readable?function(r){return s(r,e,t),a(e)}:c(e,t):f(e)}).sink=c,t.source=f,t.read=u,t.read1=a,t.read2=function(e){var t,r=!1,n=!1;function i(){var r=e.read();if(null!==r&&t){var n=t;t=null,n(null,r)}}return e.on("readable",function(){n=!0,t&&i()}).on("end",function(){r=!0,t&&t(r)}).on("error",function(e){r=e,t&&t(r)}),function(e,o){t=o,r?o(r):n&&i()}},t.duplex=function(e,t){return{source:f(e),sink:c(e,t)}},t.transform=function(e){return function(t){var r=f(e);return c(e)(t),r}}}).call(this,r(7))},function(e,t,r){var n=r(30),i=function(){},o=function(e,t,r){if("function"==typeof t)return o(e,null,t);t||(t={}),r=n(r||i);var s=e._writableState,a=e._readableState,u=t.readable||!1!==t.readable&&e.readable,c=t.writable||!1!==t.writable&&e.writable,f=function(){e.writable||l()},l=function(){c=!1,u||r.call(e)},h=function(){u=!1,c||r.call(e)},p=function(t){r.call(e,t?new Error("exited with error code: "+t):null)},d=function(t){r.call(e,t)},y=function(){return(!u||a&&a.ended)&&(!c||s&&s.ended)?void 0:r.call(e,new Error("premature close"))},g=function(){e.req.on("finish",l)};return function(e){return e.setHeader&&"function"==typeof e.abort}(e)?(e.on("complete",l),e.on("abort",y),e.req?g():e.on("request",g)):c&&!s&&(e.on("end",f),e.on("close",f)),function(e){return e.stdio&&Array.isArray(e.stdio)&&3===e.stdio.length}(e)&&e.on("exit",p),e.on("end",h),e.on("finish",l),!1!==t.error&&e.on("error",d),e.on("close",y),function(){e.removeListener("complete",l),e.removeListener("abort",y),e.removeListener("request",g),e.req&&e.req.removeListener("finish",l),e.removeListener("end",f),e.removeListener("close",f),e.removeListener("finish",l),e.removeListener("exit",p),e.removeListener("end",h),e.removeListener("error",d),e.removeListener("close",y)}};e.exports=o},function(e,t,r){"use strict";e.exports=function(){var e,t;return{source:function(r,n){e?e(r,n):t=[r,n]},sink:function(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(e,t,r){"use strict";(function(n){const i=r(8),o=r(52),s=r(1);function a(e){const t=(~~(1e9*Math.random())).toString(36);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).writeEncoded=((e,t,r)=>{!function(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])}))}(t,(t,n)=>{if(t)return r(t);e.write(n)})}),t.log={},t.log.dialer=(()=>a("dialer\t")),t.log.listener=(()=>a("listener\t"))}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(n){const i=r(12),o=r(1242),s=r(17),a=r(4);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).create=function(e,t){"function"==typeof e&&(t=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){var n=r(312)(Object,"create");e.exports=n},function(e,t,r){var n=r(313);e.exports=function(e,t){for(var r=e.length;r--;)if(n(e[r][0],t))return r;return-1}},function(e,t,r){var n=r(1336);e.exports=function(e,t){var r=e.__data__;return n(t)?r["string"==typeof t?"string":"hash"]:r.map}},function(e,t,r){"use strict";const n=r(23),i=r(80),o=r(489),s=r(9);t.OFFLINE_ERROR="This command must be run in online mode. Try running 'ipfs daemon' first.";const a=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);e.get(o,function t(r,i,o){if(i)return n(i);if(!r.length)return n(null,o.multihash);const s=r[0],a=o.links.find(e=>e.name===s);if(!a)return n(new Error(`no link named "${s}" under ${o.toJSON().multihash}`));e.get(a.multihash,t.bind(null,r.slice(1)))}.bind(null,a))},n)});t.parseIpfsPath=function(e){const t=new Error("invalid ipfs ref path"),r=(e=e.replace(/^\/ipfs\//,"")).match(/([^/]+(?:\/[^/]+)*)\/?$/);if(!r)throw t;const[n,...i]=r[1].split("/");if(o.cid(n))return{hash:n,links:i};throw t},t.resolvePath=a},function(e,t,r){var n=r(1390);function i(e,t){return(e=e||[]).push(t),e}e.exports=function(e,t,r,o){var s,a;function u(i){var c=null,f=!1,l=0;if(i,s)return i(!!s.abort||s,function(e){o(e),a&&a()});var h=!1,p=n(function(){h||s||(h=!0,i(null,function(e,n){h=!1,function(e,n){s||((s=e)?f||o(!0===s?null:s):(c=t(c,n),l=c&&c.length||0,null!=c&&d(),l<r&&p()))}(e,n)}))});function d(){if(!f){var t=c;c=null,f=!0,l=0,e(t,function(e){f=!1,!0!==s||l?s&&!0!==s?(o(s),a&&a()):e?i(s=!!e.abort||e,o):l?d():p():o(e)})}}u.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,f||(o&&o(e),a&&a(e))})},p()}return t=t||i,u.abort=function(e){s=new Error("aborted before connecting"),a=function(t){e&&e()}},u}},function(e,t,r){var n=r(531);e.exports=function(e,t){return function(r){var i,o,s=[];function a(e){s.push(e)}e=e||function(e){this.queue(e)},t=t||function(){this.queue(null)};var u,c={emit:function(e,t){"data"==e&&a(t),"end"==e&&(i=!0,a(null)),"error"==e&&(o=t)},queue:a};return function(a,f){if(i=i||a,a)return r(a,function(){if(u){var e=u;u=null,e(a)}f(a)});u=f,n(function n(a){if(u)if(f=u,o)u=null,f(o);else if(s.length){var l=s.shift();u=null,f(null===l,l)}else r(i,function(s,l){if(s&&!0!==s)return o=s,a();if(i=i||s)t.call(c);else if(null!==l&&(e.call(c,l),o||i))return r(o||i,function(){u=null,f(o||i)});a(n)})})}}}},function(e,t,r){"use strict";var n,i,o,s=r(1437),a="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_-";function u(){o=!1}function c(e){if(e){if(e!==n){if(e.length!==a.length)throw new Error("Custom alphabet for shortid must be "+a.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 "+a.length+" unique characters. These characters were not unique: "+t.join(", "));n=e,u()}}else n!==a&&(n=a,u())}function f(){return o||(o=function(){n||c(a);for(var e,t=n.split(""),r=[],i=s.nextValue();t.length>0;)i=s.nextValue(),e=Math.floor(i*t.length),r.push(t.splice(e,1)[0]);return r.join("")}())}e.exports={get:function(){return n||a},characters:function(e){return c(e),n},seed:function(e){s.seed(e),i!==e&&(u(),i=e)},lookup:function(e){return f()[e]},shuffled:f}},function(e,t,r){var n=e.exports;n.encode=r(1506),n.decode=r(1507),n.byteLength=n.encodingLength=function(e){return n.encode(e).length}},function(e,t,r){"use strict";e.exports=function(e,t,r){return 0===e.length?e:t?(r||e.sort(t),function(e,t){for(var r=1,n=e.length,i=e[0],o=e[0],s=1;s<n;++s)if(o=i,t(i=e[s],o)){if(s===r){r++;continue}e[r++]=i}return e.length=r,e}(e,t)):(r||e.sort(),function(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])!==i){if(o===t){t++;continue}e[t++]=n}return e.length=t,e}(e))}},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))).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(1564),i=r(208),o=r(330),s=r(1567),a=t,u=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"]};a.encode=function(e,t,r){return a.encodingLength(e),r=r||0,t=t||i(e.length),a._encode(e,t,r)},a._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 c=r+8;if(1===o&&(n.encode(e.length,t,c),c+=8),s.fullBoxes[i]&&(t.writeUInt32BE(e.flags||0,c),t.writeUInt8(e.version||0,c),c+=4),u[i])u[i].forEach(function(r){if(5===r.length){var n=e[r]||[];r=r.substr(0,4),n.forEach(function(e){a._encode(e,t,c),c+=a.encode.bytes})}else e[r]&&(a._encode(e[r],t,c),c+=a.encode.bytes)}),e.otherBoxes&&e.otherBoxes.forEach(function(e){a._encode(e,t,c),c+=a.encode.bytes});else if(s[i]){var f=s[i].encode;f(e,t,c),c+=f.bytes}else{if(!e.buffer)throw new Error("Either `type` must be set to a known type (not'"+i+"') or `buffer` must be set");e.buffer.copy(t,c),c+=e.buffer.length}return a.encode.bytes=c-r,t},a.readHeaders=function(e,t,r){if(t=t||0,(r=r||e.length)-t<8)return 8;var i,o,a=e.readUInt32BE(t),u=e.toString("ascii",t+4,t+8),c=t+8;if(1===a){if(r-t<16)return 16;a=n.decode(e,c),c+=8}return s.fullBoxes[u]&&(i=e.readUInt8(c),o=16777215&e.readUInt32BE(c),c+=4),{length:a,headersLen:c-t,contentLen:a-(c-t),type:u,version:i,flags:o}},a.decode=function(e,t,r){t=t||0,r=r||e.length;var n=a.readHeaders(e,t,r);if(!n||n.length>r-t)throw new Error("Data too short");return a.decodeWithoutHeaders(n,e,t+n.headersLen,t+n.length)},a.decodeWithoutHeaders=function(e,t,r,n){r=r||0,n=n||t.length;var i=e.type,c={};if(u[i]){c.otherBoxes=[];for(var f=u[i],l=r;n-l>=8;){var h=a.decode(t,l,n);if(l+=h.length,f.indexOf(h.type)>=0)c[h.type]=h;else if(f.indexOf(h.type+"s")>=0){var p=h.type+"s";(c[p]=c[p]||[]).push(h)}else c.otherBoxes.push(h)}}else if(s[i]){c=(0,s[i].decode)(t,r,n)}else c.buffer=o(t.slice(r,n));return c.length=e.length,c.contentLen=e.contentLen,c.type=e.type,c.version=e.version,c.flags=e.flags,c},a.encodingLength=function(e){var t=e.type,r=8;if(s.fullBoxes[t]&&(r+=4),u[t])u[t].forEach(function(t){if(5===t.length){var n=e[t]||[];t=t.substr(0,4),n.forEach(function(e){e.type=t,r+=a.encodingLength(e)})}else if(e[t]){var i=e[t];i.type=t,r+=a.encodingLength(i)}}),e.otherBoxes&&e.otherBoxes.forEach(function(e){r+=a.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){(function(t){var n=r(1565),i=r(1566);e.exports=function(e,r,o){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');if(t.alloc)return t.alloc(e,r,o);var s=i(e);return 0===e?s:void 0===r?n(s,0):("string"!=typeof o&&(o=void 0),n(s,r,o))}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";t.decode=t.parse=r(633),t.encode=t.stringify=r(634)},function(e,t,r){"use strict";(function(t,n){var i=r(150);function o(e){var t=this;this.next=null,this.entry=null,this.finish=function(){!function(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}(t,e)}}e.exports=m;var s,a=!t.browser&&["v0.10","v0.9."].indexOf(t.version.slice(0,5))>-1?setImmediate:i.nextTick;m.WritableState=g;var u=r(117);u.inherits=r(5);var c={deprecate:r(640)},f=r(334),l=r(2).Buffer,h=n.Uint8Array||function(){};var p,d=r(336);function y(){}function g(e,t){s=s||r(85),e=e||{};var n=t instanceof s;this.objectMode=!!e.objectMode,n&&(this.objectMode=this.objectMode||!!e.writableObjectMode);var i=e.highWaterMark,a=e.writableHighWaterMark,u=this.objectMode?16:16384;this.highWaterMark=i||0===i?i:n&&(a||0===a)?a:u,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){k(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 o(this)}function m(e){if(s=s||r(85),!(p.call(m,this)||this instanceof s))return new m(e);this._writableState=new g(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)),f.call(this)}function b(e,t){var r=new Error("write after end");e.emit("error",r),i.nextTick(t,r)}function v(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 _(e,t,r,n,i,o){if(!r){var s=function(e,t,r){return e.objectMode||!1===e.decodeStrings||"string"!=typeof t||(t=l.from(t,r)),t}(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 w(e,t,!1,a,n,i,o);return u}function w(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 S(e,t,r,n,o){--t.pendingcb,r?(i.nextTick(o,n),i.nextTick(T,e,t),e._writableState.errorEmitted=!0,e.emit("error",n)):(o(n),e._writableState.errorEmitted=!0,e.emit("error",n),T(e,t))}function k(e,t){var r=e._writableState,n=r.sync,i=r.writecb;if(function(e){e.writing=!1,e.writecb=null,e.length-=e.writelen,e.writelen=0}(r),t)S(e,r,n,t,i);else{var o=x(r);o||r.corked||r.bufferProcessing||!r.bufferedRequest||A(e,r),n?a(E,e,r,o,i):E(e,r,o,i)}}function E(e,t,r,n){r||function(e,t){0===t.length&&t.needDrain&&(t.needDrain=!1,e.emit("drain"))}(e,t),t.pendingcb--,n(),T(e,t)}function A(e,t){t.bufferProcessing=!0;var r=t.bufferedRequest;if(e._writev&&r&&r.next){var n=t.bufferedRequestCount,i=new Array(n),s=t.corkedRequestsFree;s.entry=r;for(var a=0,u=!0;r;)i[a]=r,r.isBuf||(u=!1),r=r.next,a+=1;i.allBuffers=u,w(e,t,!0,t.length,i,"",s.finish),t.pendingcb++,t.lastBufferedRequest=null,s.next?(t.corkedRequestsFree=s.next,s.next=null):t.corkedRequestsFree=new o(t),t.bufferedRequestCount=0}else{for(;r;){var c=r.chunk,f=r.encoding,l=r.callback;if(w(e,t,!1,t.objectMode?1:c.length,c,f,l),r=r.next,t.bufferedRequestCount--,t.writing)break}null===r&&(t.lastBufferedRequest=null)}t.bufferedRequest=r,t.bufferProcessing=!1}function x(e){return e.ending&&0===e.length&&null===e.bufferedRequest&&!e.finished&&!e.writing}function I(e,t){e._final(function(r){t.pendingcb--,r&&e.emit("error",r),t.prefinished=!0,e.emit("prefinish"),T(e,t)})}function T(e,t){var r=x(t);return r&&(function(e,t){t.prefinished||t.finalCalled||("function"==typeof e._final?(t.pendingcb++,t.finalCalled=!0,i.nextTick(I,e,t)):(t.prefinished=!0,e.emit("prefinish")))}(e,t),0===t.pendingcb&&(t.finished=!0,e.emit("finish"))),r}u.inherits(m,f),g.prototype.getBuffer=function(){for(var e=this.bufferedRequest,t=[];e;)t.push(e),e=e.next;return t},function(){try{Object.defineProperty(g.prototype,"buffer",{get:c.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]?(p=Function.prototype[Symbol.hasInstance],Object.defineProperty(m,Symbol.hasInstance,{value:function(e){return!!p.call(this,e)||this===m&&e&&e._writableState instanceof g}})):p=function(e){return e instanceof this},m.prototype.pipe=function(){this.emit("error",new Error("Cannot pipe, not readable"))},m.prototype.write=function(e,t,r){var n=this._writableState,i=!1,o=!n.objectMode&&function(e){return l.isBuffer(e)||e instanceof h}(e);return o&&!l.isBuffer(e)&&(e=function(e){return l.from(e)}(e)),"function"==typeof t&&(r=t,t=null),o?t="buffer":t||(t=n.defaultEncoding),"function"!=typeof r&&(r=y),n.ended?b(this,r):(o||v(this,n,e,r))&&(n.pendingcb++,i=_(this,n,o,e,t,r)),i},m.prototype.cork=function(){this._writableState.corked++},m.prototype.uncork=function(){var e=this._writableState;e.corked&&(e.corked--,e.writing||e.corked||e.finished||e.bufferProcessing||!e.bufferedRequest||A(this,e))},m.prototype.setDefaultEncoding=function(e){if("string"==typeof e&&(e=e.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((e+"").toLowerCase())>-1))throw new TypeError("Unknown encoding: "+e);return this._writableState.defaultEncoding=e,this},Object.defineProperty(m.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),m.prototype._write=function(e,t,r){r(new Error("_write() is not implemented"))},m.prototype._writev=null,m.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||function(e,t,r){t.ending=!0,T(e,t),r&&(t.finished?i.nextTick(r):e.once("finish",r)),t.ended=!0,e.writable=!1}(this,n,r)},Object.defineProperty(m.prototype,"destroyed",{get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(e){this._writableState&&(this._writableState.destroyed=e)}}),m.prototype.destroy=d.destroy,m.prototype._undestroy=d.undestroy,m.prototype._destroy=function(e,t){this.end(),t(e)}}).call(this,r(7),r(6))},function(e,t,r){"use strict";var n=r(2).Buffer,i=n.isEncoding||function(e){switch((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){var t;switch(this.encoding=function(e){var t=function(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}}(e);if("string"!=typeof t&&(n.isEncoding===i||!i(e)))throw new Error("Unknown encoding: "+e);return t||e}(e),this.encoding){case"utf16le":this.text=u,this.end=c,t=4;break;case"utf8":this.fillLast=a,t=4;break;case"base64":this.text=f,this.end=l,t=3;break;default:return this.write=h,void(this.end=p)}this.lastNeed=0,this.lastTotal=0,this.lastChar=n.allocUnsafe(t)}function s(e){return e<=127?0:e>>5==6?2:e>>4==14?3:e>>3==30?4:e>>6==2?-1:-2}function a(e){var t=this.lastTotal-this.lastNeed,r=function(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>"}}(this,e);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 u(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 c(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 f(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 l(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+this.lastChar.toString("base64",0,3-this.lastNeed):t}function h(e){return e.toString(this.encoding)}function p(e){return e&&e.length?this.write(e):""}t.StringDecoder=o,o.prototype.write=function(e){if(0===e.length)return"";var t,r;if(this.lastNeed){if(void 0===(t=this.fillLast(e)))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||""},o.prototype.end=function(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+"<22>":t},o.prototype.text=function(e,t){var r=function(e,t,r){var n=t.length-1;if(n<r)return 0;var i=s(t[n]);return i>=0?(i>0&&(e.lastNeed=i-1),i):--n<r||-2===i?0:(i=s(t[n]))>=0?(i>0&&(e.lastNeed=i-2),i):--n<r||-2===i?0:(i=s(t[n]))>=0?(i>0&&(2===i?i=0:e.lastNeed=i-3),i):0}(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)},o.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";var n=r(118);e.exports=function(e,t,r){r||(r=t,t=null);var i=n(function(r){t=e(t,r)},function(e){r(e,t)});return 2===arguments.length?function(e){e(null,function(n,o){if(n)return r(!0===n?null:n);t=o,i(e)})}:i}},function(e,t,r){"use strict";(function(e){Object.defineProperty(t,"__esModule",{value:!0}),t.hasNextTick=t.hasSetImmediate=void 0,t.fallback=a,t.wrap=u;var n=function(e){return e&&e.__esModule?e:{default:e}}(r(102));var i,o=t.hasSetImmediate="function"==typeof setImmediate&&setImmediate,s=t.hasNextTick="object"==typeof e&&"function"==typeof e.nextTick;function a(e){setTimeout(e,0)}function u(e){return function(t){var r=(0,n.default)(arguments,1);e(function(){t.apply(null,r)})}}i=o?setImmediate:s?e.nextTick:a,t.default=u(i)}).call(this,r(7))},function(e,t,r){var n=r(157),i=r(121),o="[object AsyncFunction]",s="[object Function]",a="[object GeneratorFunction]",u="[object Proxy]";e.exports=function(e){if(!i(e))return!1;var t=n(e);return t==s||t==a||t==o||t==u}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=o(r(357)),i=o(r(217));function o(e){return e&&e.__esModule?e:{default:e}}t.default=(0,i.default)(n.default,1),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){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e,t){return function(r,n,i){return e(r,t,n,i)}},e.exports=t.default},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e,t,r){((0,n.default)(e)?function(e,t,r){r=(0,u.default)(r||a.default);var n=0,o=0,s=e.length;function f(e,t){e?r(e):++o!==s&&t!==i.default||r(null)}for(0===s&&r(null);n<s;n++)t(e[n],n,(0,c.default)(f))}:h)(e,(0,f.default)(t),r)};var n=l(r(89)),i=l(r(216)),o=l(r(357)),s=l(r(217)),a=l(r(62)),u=l(r(156)),c=l(r(103)),f=l(r(36));function l(e){return e&&e.__esModule?e:{default:e}}var h=(0,s.default)(o.default,1/0);e.exports=t.default},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)).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]);switch((t[2]||"ms").toLowerCase()){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){var n=r(366),i=r(367);e.exports=function(e,t,r){var o=t&&r||0;"string"==typeof e&&(t="binary"===e?new Array(16):null,e=null);var s=(e=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)}},function(e,t,r){"use strict";const n=r(8),i=r(161),o=r(64),s=r(368),a=r(220);t.asyncFilter=function(e){let t,r,n=!1;return function(i){return function o(s,a){if(r)return a(r);s?(r=s,i(s,n?()=>{n?t=a:a(s)}:a)):i(null,(i,s)=>{i?a(i):r?a(r):(n=!0,e(s,(e,i)=>{n=!1,r?(a(r),t(r)):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){e.exports=function(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(e,t,r){t.AbstractLevelDOWN=r(727),t.AbstractIterator=r(378),t.AbstractChainedBatch=r(379)},function(e,t,r){t.source=r(161),t.through=r(742),t.sink=r(385),t.duplex=r(386)},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)}};t.depthFirst=function(e,t){var n,i=[];return i.unshift(r(e)),function e(r,o){return i.length?n?o(n):void i[0](r,function(r,s){if(r){if(!0!==r){for(n=r,i.shift();i.length;)i.shift()(r,function(){});return o(r)}return i.shift(),e(null,o)}i.unshift(t(s)),o(r,s)}):o(!0)}},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)})}},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(10)(r(763)),s=r(390),a=r(91),u=r(166),c=r(65),f=r(4);function l(e,t){let r;!u.isDAGNode(e)&&e.links&&(e.links=e.links.map(e=>a.isDAGLink(e)?e:a.util.createDagLinkFromB58EncodedHash(e)));try{r=o.PBNode.encode(function(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}(e))}catch(e){return t(e)}t(null,r)}(t=e.exports).serialize=l,t.deserialize=function(e,t){const r=o.PBNode.decode(e),i=r.Links.map(e=>new a(e.Name,e.Tsize,e.Hash)),s=null==r.Data?n.alloc(0):n.from(r.Data);u.create(s,i,t)},t.cid=function(e,t,r){"function"==typeof t&&(r=t,t={});const n=(t=t||{}).hashAlg||s.defaultHashAlg;let o=t.version;void 0===o&&(o="sha2-256"===n?0:1),f([t=>l(e,t),(e,t)=>c(e,n,t),(e,t)=>t(null,new i(o,s.multicodec,e))],r)}}).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;function a(e){return e<16?"0"+e.toString(16):e.toString(16)}t.parseHalf=function(e){var t,r,n;return n=128&e[0]?-1:1,t=(124&e[0])>>2,r=(3&e[0])<<8|e[1],t?31===t?n*(r?NaN:1/0):n*Math.pow(2,t-25)*(1024+r):5.960464477539063e-8*n*r},t.arrayBufferToBignumber=function(e){const t=e.byteLength;let r="";for(let n=0;n<t;n++)r+=a(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){const n=e.allocUnsafe(4);n.writeFloatBE(r,0);const i=n.readUInt32BE(0);if(0!=(8191&i))return!1;var o=i>>16&32768;const s=i>>23&255,a=8388607&i;if(s>=113&&s<=142)o+=(s-112<<10)+(a>>13);else{if(!(s>=103&&s<113))return!1;if(a&(1<<126-s)-1)return!1;o+=a+8388608>>126-s}return t.writeUInt16BE(o,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(400),i=(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:(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 o=t.split("/"),s=i(n,o[0]);if(null===s)return r(new Error("No such path"),null);let a=o.slice(1).join("/");return void 0!==s["/"]?r(null,{value:s,remainderPath:a}):a.length>0?r(new Error("No such path"),null):r(null,{value:s,remainderPath:""})})},tree:(e,t,r)=>{"function"==typeof t&&(r=t,t=void 0),t=t||{},n.deserialize(e,(e,n)=>{if(e)return r(e);const o=["version","timestamp","difficulty","nonce","parent","tx"];if(!0===t.values){const e={};for(let t of o)e[t]=i(n,t);return r(null,e)}return r(null,o)})}}},function(e,t,r){var n=r(2).Buffer;e.exports={check:function(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]))},decode:function(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)}},encode:function(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}}},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(28).decompile,i=r(233),o=r(785),s=r(234),a=r(235),u=r(790),c=r(793),f=r(795),l=r(797),h={MULTISIG:"multisig",NONSTANDARD:"nonstandard",NULLDATA:"nulldata",P2PK:"pubkey",P2PKH:"pubkeyhash",P2SH:"scripthash",P2WPKH:"witnesspubkeyhash",P2WSH:"witnessscripthash",WITNESS_COMMITMENT:"witnesscommitment"};e.exports={classifyInput:function(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},classifyOutput:function(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},classifyWitness:function(e,t){var r=n(e);return c.input.check(r)?h.P2WPKH:f.input.check(r,t)?h.P2WSH:h.NONSTANDARD},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(784),output:r(404)}},function(e,t,r){e.exports={input:r(786),output:r(787)}},function(e,t,r){e.exports={input:r(788),output:r(789)}},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){return o(e),e<253?1:e<=65535?3:e<=4294967295?5:9}e.exports={encode:function e(t,r,i){if(o(t),r||(r=n.allocUnsafe(s(t))),!n.isBuffer(r))throw new TypeError("buffer must be a Buffer instance");return i||(i=0),t<253?(r.writeUInt8(t,i),e.bytes=1):t<=65535?(r.writeUInt8(253,i),r.writeUInt16LE(t,i+1),e.bytes=3):t<=4294967295?(r.writeUInt8(254,i),r.writeUInt32LE(t,i+1),e.bytes=5):(r.writeUInt8(255,i),r.writeUInt32LE(t>>>0,i+1),r.writeUInt32LE(t/4294967296|0,i+5),e.bytes=9),r},decode:function e(t,r){if(!n.isBuffer(t))throw new TypeError("buffer must be a Buffer instance");r||(r=0);var i=t.readUInt8(r);if(i<253)return e.bytes=1,i;if(253===i)return e.bytes=3,t.readUInt16LE(r+1);if(254===i)return e.bytes=5,t.readUInt32LE(r+1);e.bytes=9;var s=t.readUInt32LE(r+1),a=4294967296*t.readUInt32LE(r+5)+s;return o(a),a},encodingLength:s}},function(e,t,r){"use strict";(function(t){var n=r(5),i=r(408),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;n=l(n=l(n=l(n=l(n=f(n=f(n=f(n=f(n=c(n=c(n=c(n=c(n=u(n=u(n=u(n=u(n,i=u(i,s=u(s,r=u(r,n,i,s,e[0],3614090360,7),n,i,e[1],3905402710,12),r,n,e[2],606105819,17),s,r,e[3],3250441966,22),i=u(i,s=u(s,r=u(r,n,i,s,e[4],4118548399,7),n,i,e[5],1200080426,12),r,n,e[6],2821735955,17),s,r,e[7],4249261313,22),i=u(i,s=u(s,r=u(r,n,i,s,e[8],1770035416,7),n,i,e[9],2336552879,12),r,n,e[10],4294925233,17),s,r,e[11],2304563134,22),i=u(i,s=u(s,r=u(r,n,i,s,e[12],1804603682,7),n,i,e[13],4254626195,12),r,n,e[14],2792965006,17),s,r,e[15],1236535329,22),i=c(i,s=c(s,r=c(r,n,i,s,e[1],4129170786,5),n,i,e[6],3225465664,9),r,n,e[11],643717713,14),s,r,e[0],3921069994,20),i=c(i,s=c(s,r=c(r,n,i,s,e[5],3593408605,5),n,i,e[10],38016083,9),r,n,e[15],3634488961,14),s,r,e[4],3889429448,20),i=c(i,s=c(s,r=c(r,n,i,s,e[9],568446438,5),n,i,e[14],3275163606,9),r,n,e[3],4107603335,14),s,r,e[8],1163531501,20),i=c(i,s=c(s,r=c(r,n,i,s,e[13],2850285829,5),n,i,e[2],4243563512,9),r,n,e[7],1735328473,14),s,r,e[12],2368359562,20),i=f(i,s=f(s,r=f(r,n,i,s,e[5],4294588738,4),n,i,e[8],2272392833,11),r,n,e[11],1839030562,16),s,r,e[14],4259657740,23),i=f(i,s=f(s,r=f(r,n,i,s,e[1],2763975236,4),n,i,e[4],1272893353,11),r,n,e[7],4139469664,16),s,r,e[10],3200236656,23),i=f(i,s=f(s,r=f(r,n,i,s,e[13],681279174,4),n,i,e[0],3936430074,11),r,n,e[3],3572445317,16),s,r,e[6],76029189,23),i=f(i,s=f(s,r=f(r,n,i,s,e[9],3654602809,4),n,i,e[12],3873151461,11),r,n,e[15],530742520,16),s,r,e[2],3299628645,23),i=l(i,s=l(s,r=l(r,n,i,s,e[0],4096336452,6),n,i,e[7],1126891415,10),r,n,e[14],2878612391,15),s,r,e[5],4237533241,21),i=l(i,s=l(s,r=l(r,n,i,s,e[12],1700485571,6),n,i,e[3],2399980690,10),r,n,e[10],4293915773,15),s,r,e[1],2240044497,21),i=l(i,s=l(s,r=l(r,n,i,s,e[8],1873313359,6),n,i,e[15],4264355552,10),r,n,e[6],2734768916,15),s,r,e[13],1309151649,21),i=l(i,s=l(s,r=l(r,n,i,s,e[4],4149444226,6),n,i,e[11],3174756917,10),r,n,e[2],718787259,15),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(105),o=r(28),s=r(407),a=r(42),u=r(25),c=r(31),f=r(236);function l(e){var t=e.length;return f.encodingLength(t)+t}function h(){this.version=1,this.locktime=0,this.ins=[],this.outs=[]}h.DEFAULT_SEQUENCE=4294967295,h.SIGHASH_ALL=1,h.SIGHASH_NONE=2,h.SIGHASH_SINGLE=3,h.SIGHASH_ANYONECANPAY=128,h.ADVANCED_TRANSACTION_MARKER=0,h.ADVANCED_TRANSACTION_FLAG=1;var p=n.allocUnsafe(0),d=[],y=n.from("0000000000000000000000000000000000000000000000000000000000000000","hex"),g=n.from("0000000000000000000000000000000000000000000000000000000000000001","hex"),m=n.from("ffffffffffffffff","hex"),b={script:p,valueBuffer:m};h.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=s.readUInt64LE(e,r);return r+=8,t}function a(){var t=f.decode(e,r);return r+=f.decode.bytes,t}function u(){return n(a())}function c(){for(var e=a(),t=[],r=0;r<e;r++)t.push(u());return t}var l=new h;l.version=function(){var t=e.readInt32LE(r);return r+=4,t}();var p=e.readUInt8(r),y=e.readUInt8(r+1),g=!1;p===h.ADVANCED_TRANSACTION_MARKER&&y===h.ADVANCED_TRANSACTION_FLAG&&(r+=2,g=!0);for(var m=a(),b=0;b<m;++b)l.ins.push({hash:n(32),index:i(),script:u(),sequence:i(),witness:d});var v=a();for(b=0;b<v;++b)l.outs.push({value:o(),script:u()});if(g){for(b=0;b<m;++b)l.ins[b].witness=c();if(!l.hasWitnesses())throw new Error("Transaction has superfluous witness data")}if(l.locktime=i(),t)return l;if(r!==e.length)throw new Error("Transaction has unexpected data");return l},h.fromHex=function(e){return h.fromBuffer(n.from(e,"hex"))},h.isCoinbaseHash=function(e){u(c.Hash256bit,e);for(var t=0;t<32;++t)if(0!==e[t])return!1;return!0},h.prototype.isCoinbase=function(){return 1===this.ins.length&&h.isCoinbaseHash(this.ins[0].hash)},h.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=h.DEFAULT_SEQUENCE),this.ins.push({hash:e,index:t,script:n||p,sequence:r,witness:d})-1},h.prototype.addOutput=function(e,t){return u(c.tuple(c.Buffer,c.Satoshi),arguments),this.outs.push({script:e,value:t})-1},h.prototype.hasWitnesses=function(){return this.ins.some(function(e){return 0!==e.witness.length})},h.prototype.weight=function(){return 3*this.__byteLength(!1)+this.__byteLength(!0)},h.prototype.virtualSize=function(){return Math.ceil(this.weight()/4)},h.prototype.byteLength=function(){return this.__byteLength(!0)},h.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+function(e){var t=e.length;return f.encodingLength(t)+e.reduce(function(e,t){return e+l(t)},0)}(t.witness)},0):0)},h.prototype.clone=function(){var e=new h;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},h.prototype.hashForSignature=function(e,t,r){if(u(c.tuple(c.UInt32,c.Buffer,c.Number),arguments),e>=this.ins.length)return g;var s=o.compile(o.decompile(t).filter(function(e){return e!==a.OP_CODESEPARATOR})),f=this.clone();if((31&r)===h.SIGHASH_NONE)f.outs=[],f.ins.forEach(function(t,r){r!==e&&(t.sequence=0)});else if((31&r)===h.SIGHASH_SINGLE){if(e>=this.outs.length)return g;f.outs.length=e+1;for(var l=0;l<e;l++)f.outs[l]=b;f.ins.forEach(function(t,r){r!==e&&(t.sequence=0)})}r&h.SIGHASH_ANYONECANPAY?(f.ins=[f.ins[e]],f.ins[0].script=s):(f.ins.forEach(function(e){e.script=p}),f.ins[e].script=s);var d=n.allocUnsafe(f.__byteLength(!1)+4);return d.writeInt32LE(r,d.length-4),f.__toBuffer(d,0,!1),i.hash256(d)},h.prototype.hashForWitnessV0=function(e,t,r,o){var a,p;function d(e){p+=e.copy(a,p)}function g(e){p=a.writeUInt32LE(e,p)}function m(e){p=s.writeUInt64LE(a,e,p)}function b(e){(function(e){f.encode(e,a,p),p+=f.encode.bytes})(e.length),d(e)}u(c.tuple(c.UInt32,c.Buffer,c.Satoshi,c.UInt32),arguments);var v=y,_=y,w=y;if(o&h.SIGHASH_ANYONECANPAY||(a=n.allocUnsafe(36*this.ins.length),p=0,this.ins.forEach(function(e){d(e.hash),g(e.index)}),_=i.hash256(a)),o&h.SIGHASH_ANYONECANPAY||(31&o)===h.SIGHASH_SINGLE||(31&o)===h.SIGHASH_NONE||(a=n.allocUnsafe(4*this.ins.length),p=0,this.ins.forEach(function(e){g(e.sequence)}),w=i.hash256(a)),(31&o)!==h.SIGHASH_SINGLE&&(31&o)!==h.SIGHASH_NONE){var S=this.outs.reduce(function(e,t){return e+8+l(t.script)},0);a=n.allocUnsafe(S),p=0,this.outs.forEach(function(e){m(e.value),b(e.script)}),v=i.hash256(a)}else if((31&o)===h.SIGHASH_SINGLE&&e<this.outs.length){var k=this.outs[e];a=n.allocUnsafe(8+l(k.script)),p=0,m(k.value),b(k.script),v=i.hash256(a)}a=n.allocUnsafe(156+l(t)),p=0;var E=this.ins[e];return g(this.version),d(_),d(w),d(E.hash),g(E.index),b(t),m(r),g(E.sequence),d(v),g(this.locktime),g(o),i.hash256(a)},h.prototype.getHash=function(){return i.hash256(this.__toBuffer(void 0,void 0,!1))},h.prototype.getId=function(){return this.getHash().reverse().toString("hex")},h.prototype.toBuffer=function(e,t){return this.__toBuffer(e,t,!0)},h.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=s.writeUInt64LE(e,t,i)}function l(t){f.encode(t,e,i),i+=f.encode.bytes}function p(e){l(e.length),o(e)}!function(t){i=e.writeInt32LE(t,i)}(this.version);var d=r&&this.hasWitnesses();return d&&(a(h.ADVANCED_TRANSACTION_MARKER),a(h.ADVANCED_TRANSACTION_FLAG)),l(this.ins.length),this.ins.forEach(function(e){o(e.hash),u(e.index),p(e.script),u(e.sequence)}),l(this.outs.length),this.outs.forEach(function(e){e.valueBuffer?o(e.valueBuffer):c(e.value),p(e.script)}),d&&this.ins.forEach(function(e){!function(e){l(e.length),e.forEach(p)}(e.witness)}),u(this.locktime),void 0!==t?e.slice(t,i):e},h.prototype.toHex=function(){return this.toBuffer().toString("hex")},h.prototype.setInputScript=function(e,t){u(c.tuple(c.Number,c.Buffer),arguments),this.ins[e].script=t},h.prototype.setWitness=function(e,t){u(c.tuple(c.Number,[c.Buffer]),arguments),this.ins[e].witness=t},e.exports=h},function(e,t,r){var n=r(240),i=r(105),o=r(807),s=r(107),a=r(25),u=r(31),c=r(814),f=r(124),l=r(93),h=r(244),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()))throw new Error("Unknown network version")}else if(t=t||f.bitcoin,n!==t.wif)throw new Error("Invalid network version");return new d(l.fromBuffer(r.privateKey),null,{compressed:r.compressed,network:t})},d.makeRandom=function(e){var t,r=(e=e||{}).rng||s;do{var n=r(32);a(u.Buffer256bit,n),t=l.fromBuffer(n)}while(t.signum()<=0||t.compareTo(p.n)>=0);return new d(t,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(805),o=r(241),s=r(28),a=r(232),u=r(124),c=r(25),f=r(31);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");return{version:t.readUInt8(0),hash:t.slice(1)}}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)}e.exports={fromBase58Check:l,fromBech32:h,fromOutputScript:function(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")},toBase58Check:p,toBech32:d,toOutputScript:function(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")}}},function(e,t,r){"use strict";var n=r(123),i=r(806);e.exports=i(function(e){var t=n("sha256").update(e).digest();return n("sha256").update(t).digest()})},function(e,t,r){"use strict";var n=r(5),i=r(808),o=r(92),s=r(2).Buffer,a=r(809),u=r(409),c=r(410),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;this._alg=e,this._key=t,t.length>r?t=("rmd160"===e?new u:c(e)).update(t).digest():t.length<r&&(t=s.concat([t,f],r));for(var n=this._ipad=s.allocUnsafe(r),i=this._opad=s.allocUnsafe(r),a=0;a<r;a++)n[a]=54^t[a],i[a]=92^t[a];this._hash="rmd160"===e?new u:c(e),this._hash.update(n)}n(l,o),l.prototype._update=function(e){this._hash.update(e)},l.prototype._final=function(){var e=this._hash.digest();return("rmd160"===this._alg?new u:c(this._alg)).update(this._opad).update(e).digest()},e.exports=function(e,t){return"rmd160"===(e=e.toLowerCase())||"ripemd160"===e?new l("rmd160",t):"md5"===e?new i(a,t):new l(e,t)}},function(e,t,r){(function(t){var n=r(230),i=r(25),o=r(31),s=r(93);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");return{compressed:!!(4&t),i:3&t,signature:a.fromRSBuffer(e.slice(1))}},a.fromRSBuffer=function(e){return i(o.BufferN(64),e),new a(s.fromBuffer(e.slice(0,32)),s.fromBuffer(e.slice(32,64)))},a.fromDER=function(e){var t=n.decode(e);return new a(s.fromDERInteger(t.r),s.fromDERInteger(t.s))},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(414),i=r(415),o=r(812);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(71),n.common=r(125),n.sha=r(838),n.ripemd=r(842),n.hmac=r(843),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(50),i=r(4),o=r(154),s=r(126),a=r(862),u=r(127),c=r(128);r(863),r(424),r(423),r(425);function f(e){return e.map(e=>e.toString(16)).join("/")}e.exports=function(e,r){const l=c(e,a,function(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)})})});return l.util.deserialize=o(e=>{const t=s.decode(e);return new a(t)}),l;function h(t,r,i){let o=[];"leaf"===t.type&&o.push({path:f(t.getKey()),value:t.getValue()}),n(t.getChildren(),(t,n)=>{const i=f(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)})}}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";const n=r(430),i=(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:(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 o=t.split("/"),s=i(n,o[0]);if(null===s)return r(new Error("No such path"),null);let a=o.slice(1).join("/");return void 0!==s["/"]?r(null,{value:s,remainderPath:a}):a.length>0?r(new Error("No such path"),null):r(null,{value:s,remainderPath:""})})},tree:(e,t,r)=>{"function"==typeof t&&(r=t,t=void 0),t=t||{},n.deserialize(e,(e,n)=>{if(e)return r(e);const o=["version","timestamp","difficulty","nonce","solution","reserved","parent","tx"];if(!0===t.values){const e={};for(let t of o)e[t]=i(n,t);return r(null,e)}return r(null,o)})}}},function(e,t,r){"use strict";(function(t){var n=r(18),i=r(21),o=r(24),s=r(29);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(18),i=r(21),o=r(0),s=t.compare||r(892),a=r(66),u=r(24),c=r(29),f=r(82),l=r(55),h=r(43),p=r(67),d=r(83),y=r(97),g=r(434),m=r(251),b=m.PublicKeyHash,v=m.PublicKey,_=m.MultiSigScriptHash,w=m.MultiSig,S=r(84),k=r(68),E=r(176),A=r(32),x=r(897);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()}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){return new I(e.toBuffer())};var T={configurable:!1,enumerable:!0,get:function(){return new f(this._getHash()).readReverse().toString("hex")}};Object.defineProperty(I.prototype,"hash",T),Object.defineProperty(I.prototype,"id",T);var B={configurable:!1,enumerable:!0,get:function(){return this._getInputAmount()}};Object.defineProperty(I.prototype,"inputAmount",B),B.get=function(){return this._getOutputAmount()},Object.defineProperty(I.prototype,"outputAmount",B),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,r=this._getUnspentValue();return r<0?e.disableMoreOutputThanInput||(t=new a.Transaction.InvalidOutputAmountSum):t=this._hasFeeError(e,r),t||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]).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(){var e=[];this.inputs.forEach(function(t){e.push(t.toObject())});var t=[];this.outputs.forEach(function(e){t.push(e.toObject())});var r={hash:this.hash,version:this.version,inputs:e,outputs:t,nLockTime:this.nLockTime};if(this.version>=2){var i=[];this.joinSplits.forEach(function(e){i.push(e.toObject())}),r.joinSplits=i,this.joinSplits.length>0&&(r.joinSplitPubKey=u.reverse(this.joinSplitPubKey).toString("hex"),r.joinSplitSig=this.joinSplitSig.toString("hex"))}return this._changeScript&&(r.changeScript=this._changeScript.toString()),n.isUndefined(this._changeIndex)||(r.changeIndex=this._changeIndex),n.isUndefined(this._fee)||(r.fee=this._fee),r},I.prototype.fromObject=function(e){i.checkArgument(n.isObject(e)||e instanceof I);var r,o=this;return r=e instanceof I?r.toObject():e,n.each(r.inputs,function(e){if(e.output&&e.output.script){var t,r=new k(e.output.script);if(r.isPublicKeyHashOut())t=new m.PublicKeyHash(e);else if(r.isScriptHashOut()&&e.publicKeys&&e.threshold)t=new m.MultiSigScriptHash(e,e.publicKeys,e.threshold,e.signatures);else{if(!r.isPublicKeyOut())throw new a.Transaction.Input.UnsupportedScript(e.output.script);t=new m.PublicKey(e)}o.addInput(t)}else o.uncheckedAddInput(new m(e))}),n.each(r.outputs,function(e){o.addOutput(new S(e))}),r.changeIndex&&(this._changeIndex=r.changeIndex),r.changeScript&&(this._changeScript=new k(r.changeScript)),r.fee&&(this._fee=r.fee),this.nLockTime=r.nLockTime,this.version=r.version,this.version>=2&&(n.each(r.joinSplits,function(e){o.joinSplits.push(new x(e))}),o.joinSplits.length>0&&(o.joinSplitPubKey=u.reverse(new t(r.joinSplitPubKey,"hex")),o.joinSplitSig=new t(r.joinSplitSig,"hex"))),this._checkConsistency(e),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}return n.any(this.inputs,function(t){return t.prevTxId.toString("hex")===e.txId&&t.outputIndex===e.outputIndex})?this:(t&&r?this._fromMultisigUtxo(e,t,r):this._fromNonP2SH(e),this)},I.prototype._fromNonP2SH=function(e){var t;t=(e=new g(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)).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()-this.getFee();e>0?(this._changeIndex=this.outputs.length,this._addOutput(new S({script:this._changeScript,satoshis:e}))):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){return t>Math.ceil(e/1e3)*(r||I.FEE_PER_KB)&&(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){if(this.outputs.length!==e.length||0!==n.difference(this.outputs,e).length)throw new a.Transaction.InvalidSorting;if(!n.isUndefined(this._changeIndex)){var t=this.outputs[this._changeIndex];this._changeIndex=n.findIndex(e,t)}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}))<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){n.each(s.getSignatures(r,e,a,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){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)).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}if(this.isCoinbase()){var a=this.inputs[0]._scriptBuffer;if(a.length<2||a.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++){if(this.inputs[e].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(130),e.exports.PublicKey=r(893),e.exports.PublicKeyHash=r(894),e.exports.MultiSig=r(895),e.exports.MultiSigScriptHash=r(896)},function(e,t,r){"use strict";var n=r(18),i=r(66),o=r(21),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;Object.keys(s).forEach(function(e){Object.defineProperty(r,e,{get:function(){return r.to(e)},enumerable:!0})})}Object.keys(s).forEach(function(e){a[e]=e}),a.fromObject=function(e){return o.checkArgument(n.isObject(e),"Argument is expected to be an object"),new a(e.amount,e.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(){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){var n=e+"/"+t+"/"+(r=!!r);if(this._cache[n])return this._cacheHit(n),this._cache[n]},set:function(e,t,r,n){var i=e+"/"+t+"/"+(r=!!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){return e.then(e=>{t(null,e)},e=>{t(e)})}},function(e,t,r){"use strict";e.exports=(()=>{if("undefined"!=typeof self&&(r(56)(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(13);r(19),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)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)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())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(13);r(77),r(19);var i=e.exports=n.md5=n.md5||{};n.md.md5=n.md.algorithms.md5=i,i.create=function(){c||function(){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}();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),f(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&i.blockLength-1;s.putBytes(o.substr(0,i.blockLength-a));for(var u,c=0,l=i.fullMessageLength.length-1;l>=0;--l)c=(u=8*i.fullMessageLength[l]+c)/4294967296>>>0,s.putInt32Le(u>>>0);var h={h0:e.h0,h1:e.h1,h2:e.h2,h3:e.h3};f(h,r,s);var p=n.util.createBuffer();return p.putInt32Le(h.h0),p.putInt32Le(h.h1),p.putInt32Le(h.h2),p.putInt32Le(h.h3),p},i};var o=null,s=null,a=null,u=null,c=!1;function f(e,t,r){for(var n,i,o,c,f,l,h,p=r.length();p>=64;){for(i=e.h0,o=e.h1,c=e.h2,f=e.h3,h=0;h<16;++h)t[h]=r.getInt32Le(),n=i+(f^o&(c^f))+u[h]+t[h],i=f,f=c,c=o,o+=n<<(l=a[h])|n>>>32-l;for(;h<32;++h)n=i+(c^f&(o^c))+u[h]+t[s[h]],i=f,f=c,c=o,o+=n<<(l=a[h])|n>>>32-l;for(;h<48;++h)n=i+(o^c^f)+u[h]+t[s[h]],i=f,f=c,c=o,o+=n<<(l=a[h])|n>>>32-l;for(;h<64;++h)n=i+(c^(o|~f))+u[h]+t[s[h]],i=f,f=c,c=o,o+=n<<(l=a[h])|n>>>32-l;e.h0=e.h0+i|0,e.h1=e.h1+o|0,e.h2=e.h2+c|0,e.h3=e.h3+f|0,p-=64}}},function(e,t,r){(function(t){var n=r(13);r(133),r(77),r(19);var i,o=n.pkcs5=n.pkcs5||{};n.util.isNodejs&&!n.options.usePureJavaScript&&(i=r(450)),e.exports=n.pbkdf2=o.pbkdf2=function(e,r,o,s,a,u){if("function"==typeof a&&(u=a,a=null),n.util.isNodejs&&!n.options.usePureJavaScript&&i.pbkdf2&&(null===a||"object"!=typeof a)&&(i.pbkdf2Sync.length>4||!a||"sha1"===a))return"string"!=typeof a&&(a="sha1"),e=new t(e,"binary"),r=new t(r,"binary"),u?4===i.pbkdf2Sync.length?i.pbkdf2(e,r,o,s,function(e,t){if(e)return u(e);u(null,t.toString("binary"))}):i.pbkdf2(e,r,o,s,a,function(e,t){if(e)return u(e);u(null,t.toString("binary"))}):4===i.pbkdf2Sync.length?i.pbkdf2Sync(e,r,o,s).toString("binary"):i.pbkdf2Sync(e,r,o,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)),d=g=p.digest().getBytes();for(var v=2;v<=o;++v)p.start(null,null),p.update(g),y=p.digest().getBytes(),d=n.util.xorBytes(d,y,c),g=y;m+=b<l?d:d.substr(0,h)}return m}b=1;function _(){if(b>l)return u(null,m);p.start(null,null),p.update(r),p.update(n.util.int32ToBytes(b)),d=g=p.digest().getBytes(),v=2,w()}function w(){if(v<=o)return p.start(null,null),p.update(g),y=p.digest().getBytes(),d=n.util.xorBytes(d,y,c),g=y,++v,n.util.setImmediate(w);m+=b<l?d:d.substr(0,h),++b,_()}_()}}).call(this,r(0).Buffer)},function(e,t,r){var n=r(13);r(98),r(76),r(182),r(77),r(918),r(99),r(112),r(261),r(183),r(19);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,n=null,i=0;null===n&&i<e.attributes.length;++i)r=e.attributes[i],t.type&&t.type===r.type?n=r:t.name&&t.name===r.name?n=r:t.shortName&&t.shortName===r.shortName&&(n=r);return n}o.RDNAttributesAsArray=function(e,t){for(var r,n,o,u=[],c=0;c<e.value.length;++c){r=e.value[c];for(var f=0;f<r.value.length;++f)o={},n=r.value[f],o.type=i.derToOid(n.value[0].value),o.value=n.value[1].value,o.valueTagClass=n.value[1].type,o.type in s&&(o.name=s[o.type],o.name in a&&(o.shortName=a[o.name])),t&&(t.update(o.type),t.update(o.value)),u.push(o)}return u},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,r,o=i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[]),s=e.attributes,a=0;a<s.length;++a){var u=(t=s[a]).value,c=i.Type.PRINTABLESTRING;"valueTagClass"in t&&(c=t.valueTagClass)===i.Type.UTF8&&(u=n.util.encodeUtf8(u)),r=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(t.type).getBytes()),i.create(i.Class.UNIVERSAL,c,!1,u)])]),o.value.push(r)}return o}function g(e){for(var t,r=0;r<e.length;++r){if(void 0===(t=e[r]).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))throw(u=new Error("Attribute type not specified.")).attribute=t,u;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 n=0;n<t.extensions.length;++n)t.value.push(o.certificateExtensionToAsn1(m(t.extensions[n])))}var u;if(void 0===t.value)throw(u=new Error("Attribute value not specified.")).attribute=t,u}}function m(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))throw(w=new Error("Extension ID not specified.")).extension=e,w;e.id=o.oids[e.name]}if(void 0!==e.value)return e;if("keyUsage"===e.name){var r=0,a=0,u=0;e.digitalSignature&&(a|=128,r=7),e.nonRepudiation&&(a|=64,r=6),e.keyEncipherment&&(a|=32,r=5),e.dataEncipherment&&(a|=16,r=4),e.keyAgreement&&(a|=8,r=3),e.keyCertSign&&(a|=4,r=2),e.cRLSign&&(a|=2,r=1),e.encipherOnly&&(a|=1,r=0),e.decipherOnly&&(u|=128,r=7);var c=String.fromCharCode(r);0!==u?c+=String.fromCharCode(a)+String.fromCharCode(u):0!==a&&(c+=String.fromCharCode(a)),e.value=i.create(i.Class.UNIVERSAL,i.Type.BITSTRING,!1,c)}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 f=e.value.value;for(var l in e)!0===e[l]&&(l in s?f.push(i.create(i.Class.UNIVERSAL,i.Type.OID,!1,i.oidToDer(s[l]).getBytes())):-1!==l.indexOf(".")&&f.push(i.create(i.Class.UNIVERSAL,i.Type.OID,!1,i.oidToDer(l).getBytes())))}else if("nsCertType"===e.name){r=0,a=0;e.client&&(a|=128,r=7),e.server&&(a|=64,r=6),e.email&&(a|=32,r=5),e.objsign&&(a|=16,r=4),e.reserved&&(a|=8,r=3),e.sslCA&&(a|=4,r=2),e.emailCA&&(a|=2,r=1),e.objCA&&(a|=1,r=0);c=String.fromCharCode(r);0!==a&&(c+=String.fromCharCode(a)),e.value=i.create(i.Class.UNIVERSAL,i.Type.BITSTRING,!1,c)}else if("subjectAltName"===e.name||"issuerAltName"===e.name){e.value=i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[]);for(var h=0;h<e.altNames.length;++h){c=(b=e.altNames[h]).value;if(7===b.type&&b.ip){if(null===(c=n.util.bytesFromIP(b.ip)))throw(w=new Error('Extension "ip" value is not a valid IPv4 or IPv6 address.')).extension=e,w}else 8===b.type&&(c=b.oid?i.oidToDer(i.oidToDer(b.oid)):i.oidToDer(c));e.value.value.push(i.create(i.Class.CONTEXT_SPECIFIC,b.type,!1,c))}}else if("subjectKeyIdentifier"===e.name&&t.cert){var p=t.cert.generateSubjectKeyIdentifier();e.subjectKeyIdentifier=p.toHex(),e.value=i.create(i.Class.UNIVERSAL,i.Type.OCTETSTRING,!1,p.getBytes())}else if("authorityKeyIdentifier"===e.name&&t.cert){e.value=i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[]);f=e.value.value;if(e.keyIdentifier){var d=!0===e.keyIdentifier?t.cert.generateSubjectKeyIdentifier().getBytes():e.keyIdentifier;f.push(i.create(i.Class.CONTEXT_SPECIFIC,0,!1,d))}if(e.authorityCertIssuer){var g=[i.create(i.Class.CONTEXT_SPECIFIC,4,!0,[y(!0===e.authorityCertIssuer?t.cert.issuer:e.authorityCertIssuer)])];f.push(i.create(i.Class.CONTEXT_SPECIFIC,1,!0,g))}if(e.serialNumber){var m=n.util.hexToBytes(!0===e.serialNumber?t.cert.serialNumber:e.serialNumber);f.push(i.create(i.Class.CONTEXT_SPECIFIC,2,!1,m))}}else if("cRLDistributionPoints"===e.name){e.value=i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[]);f=e.value.value;var b,v=i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[]),_=i.create(i.Class.CONTEXT_SPECIFIC,0,!0,[]);for(h=0;h<e.altNames.length;++h){c=(b=e.altNames[h]).value;if(7===b.type&&b.ip){if(null===(c=n.util.bytesFromIP(b.ip)))throw(w=new Error('Extension "ip" value is not a valid IPv4 or IPv6 address.')).extension=e,w}else 8===b.type&&(c=b.oid?i.oidToDer(i.oidToDer(b.oid)):i.oidToDer(c));_.value.push(i.create(i.Class.CONTEXT_SPECIFIC,b.type,!1,c))}v.value.push(i.create(i.Class.CONTEXT_SPECIFIC,0,!0,[_])),f.push(v)}var w;if(void 0===e.value)throw(w=new Error("Extension value not specified.")).extension=e,w;return e}function b(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,"")}}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){var r,s=(t=t||{}).md||n.md.sha1.create();switch(t.type||"RSAPublicKey"){case"RSAPublicKey":r=i.toDer(o.publicKeyToRSAPublicKey(e)).getBytes();break;case"SubjectPublicKeyInfo":r=i.toDer(o.publicKeyToAsn1(e)).getBytes();break;default:throw new Error('Unknown fingerprint type "'+t.type+'".')}s.start(),s.update(r);var a=s.digest();if("hex"===t.encoding){var u=a.toHex();return t.delimiter?u.match(/.{2}/g).join(t.delimiter):u}if("binary"===t.encoding)return a.getBytes();if(t.encoding)throw new Error('Unknown encoding "'+t.encoding+'".');return a},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){g([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){g([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){g(t),e.subject.attributes=t,delete e.subject.uniqueId,r&&(e.subject.uniqueId=r),e.subject.hash=null},e.setIssuer=function(t,r){g(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)m(t[r],{cert:e});e.extensions=t},e.getExtension=function(t){"string"==typeof t&&(t={name:t});for(var r,n=null,i=0;null===n&&i<e.extensions.length;++i)r=e.extensions[i],t.id&&r.id===t.id?n=r:t.name&&r.name===t.name&&(n=r);return n},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;throw(y=new Error("The parent certificate did not issue the given child certificate; the child certificate's issuer does not match the parent's subject.")).expectedIssuer=a.attributes,y.actualIssuer=u.attributes,y}var c=t.md;if(null===c){if(t.signatureOid in s)switch(s[t.signatureOid]){case"sha1WithRSAEncryption":c=n.md.sha1.create();break;case"md5WithRSAEncryption":c=n.md.md5.create();break;case"sha256WithRSAEncryption":c=n.md.sha256.create();break;case"sha384WithRSAEncryption":c=n.md.sha384.create();break;case"sha512WithRSAEncryption":c=n.md.sha512.create();break;case"RSASSA-PSS":c=n.md.sha256.create()}if(null===c)throw(y=new Error("Could not compute certificate digest. Unknown signature OID.")).signatureOid=t.signatureOid,y;var f=t.tbsCertificate||o.getTBSCertificate(t),l=i.toDer(f);c.update(l.getBytes())}if(null!==c){var h;switch(t.signatureOid){case s.sha1WithRSAEncryption:h=void 0;break;case s["RSASSA-PSS"]:var p,d,y;if(void 0===(p=s[t.signatureParameters.mgf.hash.algorithmOid])||void 0===n.md[p])throw(y=new Error("Unsupported MGF hash function.")).oid=t.signatureParameters.mgf.hash.algorithmOid,y.name=p,y;if(void 0===(d=s[t.signatureParameters.mgf.algorithmOid])||void 0===n.mgf[d])throw(y=new Error("Unsupported MGF function.")).oid=t.signatureParameters.mgf.algorithmOid,y.name=d,y;if(d=n.mgf[d].create(n.md[p].create()),void 0===(p=s[t.signatureParameters.hash.algorithmOid])||void 0===n.md[p])throw{message:"Unsupported RSASSA-PSS hash function.",oid:t.signatureParameters.hash.algorithmOid,name:p};h=n.pss.create(n.md[p].create(),d,t.signatureParameters.saltLength)}r=e.publicKey.verify(c.digest().getBytes(),t.signature,h)}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))throw(h=new Error("Cannot read X.509 certificate. ASN.1 object is not an X509v3 Certificate.")).errors=a,h;if(i.derToOid(r.publicKeyOid)!==o.oids.rsaEncryption)throw new Error("Cannot read public key. OID is not RSA.");var u=o.createCertificate();u.version=r.certVersion?r.certVersion.charCodeAt(0):0;var f=n.util.createBuffer(r.certSerialNumber);u.serialNumber=f.toHex(),u.signatureOid=n.asn1.derToOid(r.certSignatureOid),u.signatureParameters=d(u.signatureOid,r.certSignatureParams,!0),u.siginfo.algorithmOid=n.asn1.derToOid(r.certinfoSignatureOid),u.siginfo.parameters=d(u.siginfo.algorithmOid,r.certinfoSignatureParams,!1),u.signature=r.certSignature;var l=[];if(void 0!==r.certValidity1UTCTime&&l.push(i.utcTimeToDate(r.certValidity1UTCTime)),void 0!==r.certValidity2GeneralizedTime&&l.push(i.generalizedTimeToDate(r.certValidity2GeneralizedTime)),void 0!==r.certValidity3UTCTime&&l.push(i.utcTimeToDate(r.certValidity3UTCTime)),void 0!==r.certValidity4GeneralizedTime&&l.push(i.generalizedTimeToDate(r.certValidity4GeneralizedTime)),l.length>2)throw new Error("Cannot read notBefore/notAfter validity times; more than two times were provided in the certificate.");if(l.length<2)throw new Error("Cannot read notBefore/notAfter validity times; they were not provided as either UTCTime or GeneralizedTime.");if(u.validity.notBefore=l[0],u.validity.notAfter=l[1],u.tbsCertificate=r.tbsCertificate,t){var h;if(u.md=null,u.signatureOid in s)switch(s[u.signatureOid]){case"sha1WithRSAEncryption":u.md=n.md.sha1.create();break;case"md5WithRSAEncryption":u.md=n.md.md5.create();break;case"sha256WithRSAEncryption":u.md=n.md.sha256.create();break;case"sha384WithRSAEncryption":u.md=n.md.sha384.create();break;case"sha512WithRSAEncryption":u.md=n.md.sha512.create();break;case"RSASSA-PSS":u.md=n.md.sha256.create()}if(null===u.md)throw(h=new Error("Could not compute certificate digest. Unknown signature OID.")).signatureOid=u.signatureOid,h;var y=i.toDer(u.tbsCertificate);u.md.update(y.getBytes())}var m=n.md.sha1.create();u.issuer.getField=function(e){return p(u.issuer,e)},u.issuer.addField=function(e){g([e]),u.issuer.attributes.push(e)},u.issuer.attributes=o.RDNAttributesAsArray(r.certIssuer,m),r.certIssuerUniqueId&&(u.issuer.uniqueId=r.certIssuerUniqueId),u.issuer.hash=m.digest().toHex();var b=n.md.sha1.create();return u.subject.getField=function(e){return p(u.subject,e)},u.subject.addField=function(e){g([e]),u.subject.attributes.push(e)},u.subject.attributes=o.RDNAttributesAsArray(r.certSubject,b),r.certSubjectUniqueId&&(u.subject.uniqueId=r.certSubjectUniqueId),u.subject.hash=b.digest().toHex(),r.certExtensions?u.extensions=o.certificateExtensionsFromAsn1(r.certExtensions):u.extensions=[],u.publicKey=o.publicKeyFromAsn1(r.subjectPublicKeyInfo),u},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=0,o=0;(u=i.fromDer(t.value)).value.length>1&&(r=u.value.charCodeAt(1),o=u.value.length>2?u.value.charCodeAt(2):0),t.digitalSignature=128==(128&r),t.nonRepudiation=64==(64&r),t.keyEncipherment=32==(32&r),t.dataEncipherment=16==(16&r),t.keyAgreement=8==(8&r),t.keyCertSign=4==(4&r),t.cRLSign=2==(2&r),t.encipherOnly=1==(1&r),t.decipherOnly=128==(128&o)}else if("basicConstraints"===t.name){(u=i.fromDer(t.value)).value.length>0&&u.value[0].type===i.Type.BOOLEAN?t.cA=0!==u.value[0].value.charCodeAt(0):t.cA=!1;var a=null;u.value.length>0&&u.value[0].type===i.Type.INTEGER?a=u.value[0].value:u.value.length>1&&(a=u.value[1].value),null!==a&&(t.pathLenConstraint=i.derToInteger(a))}else if("extKeyUsage"===t.name)for(var u=i.fromDer(t.value),c=0;c<u.value.length;++c){var f=i.derToOid(u.value[c].value);f in s?t[s[f]]=!0:t[f]=!0}else if("nsCertType"===t.name){r=0;(u=i.fromDer(t.value)).value.length>1&&(r=u.value.charCodeAt(1)),t.client=128==(128&r),t.server=64==(64&r),t.email=32==(32&r),t.objsign=16==(16&r),t.reserved=8==(8&r),t.sslCA=4==(4&r),t.emailCA=2==(2&r),t.objCA=1==(1&r)}else if("subjectAltName"===t.name||"issuerAltName"===t.name){var l;t.altNames=[];u=i.fromDer(t.value);for(var h=0;h<u.value.length;++h){var p={type:(l=u.value[h]).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){u=i.fromDer(t.value);t.subjectKeyIdentifier=n.util.bytesToHex(u.value)}return t},o.certificationRequestFromAsn1=function(e,t){var r={},a=[];if(!i.validate(e,h,r,a))throw(c=new Error("Cannot read PKCS#10 certificate request. ASN.1 object is not a PKCS#10 CertificationRequest.")).errors=a,c;if(i.derToOid(r.publicKeyOid)!==o.oids.rsaEncryption)throw new Error("Cannot read public key. OID is not RSA.");var u=o.createCertificationRequest();if(u.version=r.csrVersion?r.csrVersion.charCodeAt(0):0,u.signatureOid=n.asn1.derToOid(r.csrSignatureOid),u.signatureParameters=d(u.signatureOid,r.csrSignatureParams,!0),u.siginfo.algorithmOid=n.asn1.derToOid(r.csrSignatureOid),u.siginfo.parameters=d(u.siginfo.algorithmOid,r.csrSignatureParams,!1),u.signature=r.csrSignature,u.certificationRequestInfo=r.certificationRequestInfo,t){var c;if(u.md=null,u.signatureOid in s)switch(s[u.signatureOid]){case"sha1WithRSAEncryption":u.md=n.md.sha1.create();break;case"md5WithRSAEncryption":u.md=n.md.md5.create();break;case"sha256WithRSAEncryption":u.md=n.md.sha256.create();break;case"sha384WithRSAEncryption":u.md=n.md.sha384.create();break;case"sha512WithRSAEncryption":u.md=n.md.sha512.create();break;case"RSASSA-PSS":u.md=n.md.sha256.create()}if(null===u.md)throw(c=new Error("Could not compute certification request digest. Unknown signature OID.")).signatureOid=u.signatureOid,c;var f=i.toDer(u.certificationRequestInfo);u.md.update(f.getBytes())}var l=n.md.sha1.create();return u.subject.getField=function(e){return p(u.subject,e)},u.subject.addField=function(e){g([e]),u.subject.attributes.push(e)},u.subject.attributes=o.RDNAttributesAsArray(r.certificationRequestInfoSubject,l),u.subject.hash=l.digest().toHex(),u.publicKey=o.publicKeyFromAsn1(r.subjectPublicKeyInfo),u.getAttribute=function(e){return p(u,e)},u.addAttribute=function(e){g([e]),u.attributes.push(e)},u.attributes=o.CRIAttributesAsArray(r.certificationRequestInfoAttributes||[]),u},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){g([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){g([t]),e.attributes.push(t)},e.md=null,e.setSubject=function(t){g(t),e.subject.attributes=t,e.subject.hash=null},e.setAttributes=function(t){g(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)switch(s[e.signatureOid]){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)throw(h=new Error("Could not compute certification request digest. Unknown signature OID.")).signatureOid=e.signatureOid,h;var a=e.certificationRequestInfo||o.getCertificationRequestInfo(e),u=i.toDer(a);r.update(u.getBytes())}if(null!==r){var c;switch(e.signatureOid){case s.sha1WithRSAEncryption:break;case s["RSASSA-PSS"]:var f,l,h;if(void 0===(f=s[e.signatureParameters.mgf.hash.algorithmOid])||void 0===n.md[f])throw(h=new Error("Unsupported MGF hash function.")).oid=e.signatureParameters.mgf.hash.algorithmOid,h.name=f,h;if(void 0===(l=s[e.signatureParameters.mgf.algorithmOid])||void 0===n.mgf[l])throw(h=new Error("Unsupported MGF function.")).oid=e.signatureParameters.mgf.algorithmOid,h.name=l,h;if(l=n.mgf[l].create(n.md[f].create()),void 0===(f=s[e.signatureParameters.hash.algorithmOid])||void 0===n.md[f])throw(h=new Error("Unsupported RSASSA-PSS hash function.")).oid=e.signatureParameters.hash.algorithmOid,h.name=f,h;c=n.pss.create(n.md[f].create(),l,e.signatureParameters.saltLength)}t=e.publicKey.verify(r.digest().getBytes(),e.signature,c)}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()),b(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){return 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),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}(e)])},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()),b(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()),b(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){return r(e.issuer)},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){if(s===i.toDer(o.certificateToAsn1(t[a])).getBytes())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){c===i.toDer(o.certificateToAsn1(u[f])).getBytes()&&(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){var i=(t=t.slice(0)).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(null===(l=t[0]||e.getIssuer(f))&&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");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&&c-1>b.pathLenConstraint&&(u={message:"Certificate basicConstraints pathLenConstraint violated.",error:o.certificateError.bad_certificate})}var _=null===u||u.error,w=r?r(_,c,i):_;if(!0!==w)throw!0===_&&(u={message:"The application rejected the certificate.",error:o.certificateError.bad_certificate}),(w||0===w)&&("object"!=typeof w||n.util.isArray(w)?"string"==typeof w&&(u.error=w):(w.message&&(u.message=w.message),w.error&&(u.error=w.error))),u;u=null,a=!1,++c}while(t.length>0);return!0}},function(e,t,r){var n=r(13);r(69),r(19),(e.exports=n.pss=n.pss||{}).create=function(e){3===arguments.length&&(e={md:arguments[0],mgf:arguments[1],saltLength:arguments[2]});var t,r=e.md,i=e.mgf,o=r.digestLength,s=e.salt||null;if("string"==typeof s&&(s=n.util.createBuffer(s)),"saltLength"in e)t=e.saltLength;else{if(null===s)throw new Error("Salt length not specified or specific salt not given.");t=s.length()}if(null!==s&&s.length()!==t)throw new Error("Given salt length does not match length of given salt.");var a=e.prng||n.random;return{encode:function(e,u){var c,f,l=u-1,h=Math.ceil(l/8),p=e.digest().getBytes();if(h<o+t+2)throw new Error("Message is too long to encrypt.");f=null===s?a.getBytesSync(t):s.bytes();var d=new n.util.ByteBuffer;d.fillWithByte(0,8),d.putBytes(p),d.putBytes(f),r.start(),r.update(d.getBytes());var y=r.digest().getBytes(),g=new n.util.ByteBuffer;g.fillWithByte(0,h-t-o-2),g.putByte(1),g.putBytes(f);var m=g.getBytes(),b=h-o-1,v=i.generate(y,b),_="";for(c=0;c<b;c++)_+=String.fromCharCode(m.charCodeAt(c)^v.charCodeAt(c));var w=65280>>8*h-l&255;return(_=String.fromCharCode(_.charCodeAt(0)&~w)+_.substr(1))+y+String.fromCharCode(188)},verify:function(e,s,a){var u,c=a-1,f=Math.ceil(c/8);if(s=s.substr(-f),f<o+t+2)throw new Error("Inconsistent parameters to PSS signature verification.");if(188!==s.charCodeAt(f-1))throw new Error("Encoded message does not end in 0xBC.");var l=f-o-1,h=s.substr(0,l),p=s.substr(l,o),d=65280>>8*f-c&255;if(0!=(h.charCodeAt(0)&d))throw new Error("Bits beyond keysize not zero as expected.");var y=i.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-o-t-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(-t),v=new n.util.ByteBuffer;return v.fillWithByte(0,8),v.putBytes(e),v.putBytes(b),r.start(),r.update(v.getBytes()),p===r.digest().getBytes()}}}},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){return e.then(e=>{t(null,e)},e=>{t(e)})}},function(e,t,r){"use strict";e.exports=(()=>{if("undefined"!=typeof self&&(r(56)(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){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(44);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)}function o(e,t,r,n){return{code:e,size:t,name:r,resolvable:Boolean(n)}}i.lengthPrefixedVarSize=-1,i.V=-1,i.table=[[4,32,"ip4"],[6,16,"tcp"],[17,16,"udp"],[33,16,"dccp"],[41,128,"ip6"],[54,-1,"dns4","resolvable"],[55,-1,"dns6","resolvable"],[56,-1,"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=o.apply(null,e);i.codes[t.code]=t,i.names[t.name]=t}),i.object=o,e.exports=i},function(e,t,r){"use strict";const n=r(44);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)}function o(e,t,r,n){return{code:e,size:t,name:r,resolvable:Boolean(n)}}i.lengthPrefixedVarSize=-1,i.V=-1,i.table=[[4,32,"ip4"],[6,16,"tcp"],[17,16,"udp"],[33,16,"dccp"],[41,128,"ip6"],[54,-1,"dns4","resolvable"],[55,-1,"dns6","resolvable"],[56,-1,"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=o.apply(null,e);i.codes[t.code]=t,i.names[t.name]=t}),i.object=o,e.exports=i},function(e,t,r){"use strict";e.exports=function(e,t){return e.then(e=>{t(null,e)},e=>{t(e)})}},function(e,t,r){"use strict";e.exports=(()=>{if("undefined"!=typeof self&&(r(56)(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,t){return"__proto__"===t?void 0:e[t]}var o=e.exports=function(){if(arguments.length<1||"object"!=typeof arguments[0])return!1;if(arguments.length<2)return arguments[0];var e,t,s=arguments[0];return Array.prototype.slice.call(arguments,1).forEach(function(a){"object"!=typeof a||null===a||Array.isArray(a)||Object.keys(a).forEach(function(u){return t=i(s,u),(e=i(a,u))===s?void 0:"object"!=typeof e||null===e?void(s[u]=e):Array.isArray(e)?void(s[u]=function e(t){var i=[];return t.forEach(function(t,s){"object"==typeof t&&null!==t?Array.isArray(t)?i[s]=e(t):r(t)?i[s]=n(t):i[s]=o({},t):i[s]=t}),i}(e)):r(e)?void(s[u]=n(e)):"object"!=typeof t||null===t||Array.isArray(t)?void(s[u]=o({},e)):void(s[u]=o(t,e))})}),s}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";const n=r(44);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)}function o(e,t,r,n){return{code:e,size:t,name:r,resolvable:Boolean(n)}}i.lengthPrefixedVarSize=-1,i.V=-1,i.table=[[4,32,"ip4"],[6,16,"tcp"],[17,16,"udp"],[33,16,"dccp"],[41,128,"ip6"],[54,-1,"dns4","resolvable"],[55,-1,"dns6","resolvable"],[56,-1,"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=o.apply(null,e);i.codes[t.code]=t,i.names[t.name]=t}),i.object=o,e.exports=i},function(e,t,r){"use strict";const n=r(44);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)}function o(e,t,r,n){return{code:e,size:t,name:r,resolvable:Boolean(n)}}i.lengthPrefixedVarSize=-1,i.V=-1,i.table=[[4,32,"ip4"],[6,16,"tcp"],[17,16,"udp"],[33,16,"dccp"],[41,128,"ip6"],[54,-1,"dns4","resolvable"],[55,-1,"dns6","resolvable"],[56,-1,"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=o.apply(null,e);i.codes[t.code]=t,i.names[t.name]=t}),i.object=o,e.exports=i},function(e,t,r){"use strict";e.exports=function(e,t){return e.then(e=>{t(null,e)},e=>{t(e)})}},function(e,t,r){"use strict";e.exports=(()=>{if("undefined"!=typeof self&&(r(56)(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,n){!function(e,r){r(t)}(0,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;function f(e){setTimeout(e,0)}function l(e){return function(t){var r=i(arguments,1);e(function(){t.apply(null,r)})}}var h=l(u?setImmediate:c?e.nextTick:f);function p(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){d(r,null,e)},function(e){d(r,e.message?e:new Error(e))}):r(null,n)})}function d(e,t,r){try{e(t,r)}catch(e){h(y,e)}}function y(e){throw e}var g="function"==typeof Symbol;function m(e){return g&&"AsyncFunction"===e[Symbol.toStringTag]}function b(e){return m(e)?p(e):e}function v(e){return function(t){var r=i(arguments,1),n=s(function(r,n){var i=this;return e(t,function(e,t){b(e).apply(i,r.concat(t))},n)});return r.length?n.apply(this,r):n}}var _="object"==typeof r&&r&&r.Object===Object&&r,w="object"==typeof self&&self&&self.Object===Object&&self,S=_||w||Function("return this")(),k=S.Symbol,E=Object.prototype,A=E.hasOwnProperty,x=E.toString,I=k?k.toStringTag:void 0;var T=Object.prototype.toString;var B="[object Null]",C="[object Undefined]",P=k?k.toStringTag:void 0;function O(e){return null==e?void 0===e?C:B:P&&P in Object(e)?function(e){var t=A.call(e,I),r=e[I];try{e[I]=void 0;var n=!0}catch(e){}var i=x.call(e);return n&&(t?e[I]=r:delete e[I]),i}(e):function(e){return T.call(e)}(e)}var R="[object AsyncFunction]",N="[object Function]",L="[object GeneratorFunction]",K="[object Proxy]";var j=9007199254740991;function M(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=j}function D(e){return null!=e&&M(e.length)&&!function(e){if(!a(e))return!1;var t=O(e);return t==N||t==L||t==R||t==K}(e)}var U={};function F(){}function q(e){return function(){if(null!==e){var t=e;e=null,t.apply(this,arguments)}}}var H="function"==typeof Symbol&&Symbol.iterator,z=function(e){return H&&e[H]&&e[H]()};function V(e){return null!=e&&"object"==typeof e}var G="[object Arguments]";function W(e){return V(e)&&O(e)==G}var $=Object.prototype,Y=$.hasOwnProperty,J=$.propertyIsEnumerable,X=W(function(){return arguments}())?W:function(e){return V(e)&&Y.call(e,"callee")&&!J.call(e,"callee")},Z=Array.isArray;var Q="object"==typeof t&&t&&!t.nodeType&&t,ee=Q&&"object"==typeof n&&n&&!n.nodeType&&n,te=ee&&ee.exports===Q?S.Buffer:void 0,re=(te?te.isBuffer:void 0)||function(){return!1},ne=9007199254740991,ie=/^(?:0|[1-9]\d*)$/;function oe(e,t){var r=typeof e;return!!(t=null==t?ne:t)&&("number"==r||"symbol"!=r&&ie.test(e))&&e>-1&&e%1==0&&e<t}var se={};se["[object Float32Array]"]=se["[object Float64Array]"]=se["[object Int8Array]"]=se["[object Int16Array]"]=se["[object Int32Array]"]=se["[object Uint8Array]"]=se["[object Uint8ClampedArray]"]=se["[object Uint16Array]"]=se["[object Uint32Array]"]=!0,se["[object Arguments]"]=se["[object Array]"]=se["[object ArrayBuffer]"]=se["[object Boolean]"]=se["[object DataView]"]=se["[object Date]"]=se["[object Error]"]=se["[object Function]"]=se["[object Map]"]=se["[object Number]"]=se["[object Object]"]=se["[object RegExp]"]=se["[object Set]"]=se["[object String]"]=se["[object WeakMap]"]=!1;var ae="object"==typeof t&&t&&!t.nodeType&&t,ue=ae&&"object"==typeof n&&n&&!n.nodeType&&n,ce=ue&&ue.exports===ae&&_.process,fe=function(){try{return ue&&ue.require&&ue.require("util").types||ce&&ce.binding&&ce.binding("util")}catch(e){}}(),le=fe&&fe.isTypedArray,he=le?function(e){return function(t){return e(t)}}(le):function(e){return V(e)&&M(e.length)&&!!se[O(e)]},pe=Object.prototype.hasOwnProperty;function de(e,t){var r=Z(e),n=!r&&X(e),i=!r&&!n&&re(e),o=!r&&!n&&!i&&he(e),s=r||n||i||o,a=s?function(e,t){for(var r=-1,n=Array(e);++r<e;)n[r]=t(r);return n}(e.length,String):[],u=a.length;for(var c in e)!t&&!pe.call(e,c)||s&&("length"==c||i&&("offset"==c||"parent"==c)||o&&("buffer"==c||"byteLength"==c||"byteOffset"==c)||oe(c,u))||a.push(c);return a}var ye=Object.prototype;var ge=function(e,t){return function(r){return e(t(r))}}(Object.keys,Object),me=Object.prototype.hasOwnProperty;function be(e){if(!function(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||ye)}(e))return ge(e);var t=[];for(var r in Object(e))me.call(e,r)&&"constructor"!=r&&t.push(r);return t}function ve(e){return D(e)?de(e):be(e)}function _e(e){if(D(e))return function(e){var t=-1,r=e.length;return function(){return++t<r?{value:e[t],key:t}:null}}(e);var t=z(e);return t?function(e){var t=-1;return function(){var r=e.next();return r.done?null:(t++,{value:r.value,key:t})}}(t):function(e){var t=ve(e),r=-1,n=t.length;return function(){var i=t[++r];return r<n?{value:e[i],key:i}:null}}(e)}function we(e){return function(){if(null===e)throw new Error("Callback was already called.");var t=e;e=null,t.apply(this,arguments)}}function Se(e){return function(t,r,n){if(n=q(n||F),e<=0||!t)return n(null);var i=_e(t),o=!1,s=0,a=!1;function u(e,t){if(s-=1,e)o=!0,n(e);else{if(t===U||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,we(u))}a=!1}c()}}function ke(e,t,r,n){Se(t)(e,b(r),n)}function Ee(e,t){return function(r,n,i){return e(r,t,n,i)}}var Ae=Ee(ke,1/0),xe=function(e,t,r){(D(e)?function(e,t,r){r=q(r||F);var n=0,i=0,o=e.length;function s(e,t){e?r(e):++i!==o&&t!==U||r(null)}for(0===o&&r(null);n<o;n++)t(e[n],n,we(s))}:Ae)(e,b(t),r)};function Ie(e){return function(t,r,n){return e(xe,t,b(r),n)}}function Te(e,t,r,n){n=n||F,t=t||[];var i=[],o=0,s=b(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 Be=Ie(Te),Ce=v(Be);function Pe(e){return function(t,r,n,i){return e(Se(r),t,b(n),i)}}var Oe=Pe(Te),Re=Ee(Oe,1),Ne=v(Re);function Le(e,t){for(var r=-1,n=null==e?0:e.length;++r<n&&!1!==t(e[r],r,e););return e}var Ke=function(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 je(e,t){return e&&Ke(e,t,ve)}function Me(e){return e!=e}function De(e,t,r){return t==t?function(e,t,r){for(var n=r-1,i=e.length;++n<i;)if(e[n]===t)return n;return-1}(e,t,r):function(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,Me,r)}var Ue=function(e,t,r){"function"==typeof t&&(r=t,t=null),r=q(r||F);var n=ve(e).length;if(!n)return r(null);t||(t=n);var o={},s=0,a=!1,u=Object.create(null),c=[],f=[],l={};function h(e,t){c.push(function(){!function(e,t){if(!a){var n=we(function(t,n){if(s--,arguments.length>2&&(n=i(arguments,1)),t){var c={};je(o,function(e,t){c[t]=e}),c[e]=n,a=!0,u=Object.create(null),r(t,c)}else o[e]=n,function(e){Le(u[e]||[],function(e){e()}),p()}(e)});s++;var c=b(t[t.length-1]);t.length>1?c(o,n):c(n)}}(e,t)})}function p(){if(0===c.length&&0===s)return r(null,o);for(;c.length&&s<t;){c.shift()()}}function d(t){var r=[];return je(e,function(e,n){Z(e)&&De(e,t,0)>=0&&r.push(n)}),r}je(e,function(t,r){if(!Z(t))return h(r,[t]),void f.push(r);var n=t.slice(0,t.length-1),i=n.length;if(0===i)return h(r,t),void f.push(r);l[r]=i,Le(n,function(o){if(!e[o])throw new Error("async.auto task `"+r+"` has a non-existent dependency `"+o+"` in "+n.join(", "));!function(e,t){var r=u[e];r||(r=u[e]=[]),r.push(t)}(o,function(){0==--i&&h(r,t)})})}),function(){for(var e=0;f.length;)e++,Le(d(f.pop()),function(e){0==--l[e]&&f.push(e)});if(e!==n)throw new Error("async.auto cannot execute tasks due to a recursive dependency")}(),p()};function Fe(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 qe="[object Symbol]";var He=1/0,ze=k?k.prototype:void 0,Ve=ze?ze.toString:void 0;function Ge(e){if("string"==typeof e)return e;if(Z(e))return Fe(e,Ge)+"";if(function(e){return"symbol"==typeof e||V(e)&&O(e)==qe}(e))return Ve?Ve.call(e):"";var t=e+"";return"0"==t&&1/e==-He?"-0":t}function We(e,t,r){var n=e.length;return r=void 0===r?n:r,!t&&r>=n?e:function(e,t,r){var n=-1,i=e.length;t<0&&(t=-t>i?0:i+t),(r=r>i?i: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}(e,t,r)}var $e=RegExp("[\\u200d\\ud800-\\udfff\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff\\ufe0e\\ufe0f]");var Ye="[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]",Je="\\ud83c[\\udffb-\\udfff]",Xe="[^\\ud800-\\udfff]",Ze="(?:\\ud83c[\\udde6-\\uddff]){2}",Qe="[\\ud800-\\udbff][\\udc00-\\udfff]",et="(?:"+Ye+"|"+Je+")?",tt="[\\ufe0e\\ufe0f]?",rt=tt+et+"(?:\\u200d(?:"+[Xe,Ze,Qe].join("|")+")"+tt+et+")*",nt="(?:"+[Xe+Ye+"?",Ye,Ze,Qe,"[\\ud800-\\udfff]"].join("|")+")",it=RegExp(Je+"(?="+Je+")|"+nt+rt,"g");function ot(e){return function(e){return $e.test(e)}(e)?function(e){return e.match(it)||[]}(e):function(e){return e.split("")}(e)}var st=/^\s+|\s+$/g;function at(e,t,r){if((e=function(e){return null==e?"":Ge(e)}(e))&&(r||void 0===t))return e.replace(st,"");if(!e||!(t=Ge(t)))return e;var n=ot(e),i=ot(t);return We(n,function(e,t){for(var r=-1,n=e.length;++r<n&&De(t,e[r],0)>-1;);return r}(n,i),function(e,t){for(var r=e.length;r--&&De(t,e[r],0)>-1;);return r}(n,i)+1).join("")}var ut=/^(?:async\s+)?(function)?\s*[^\(]*\(\s*([^\)]*)\)/m,ct=/,/,ft=/(=.+)?(\s*)$/,lt=/((\/\/.*$)|(\/\*[\s\S]*?\*\/))/gm;function ht(e,t){var r={};je(e,function(e,t){var n,i=m(e),o=!i&&1===e.length||i&&0===e.length;if(Z(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=function(e){return(e=(e=(e=e.toString().replace(lt,"")).match(ut)[2].replace(" ",""))?e.split(ct):[]).map(function(e){return at(e.replace(ft,""))})}(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=Fe(n,function(e){return t[e]});i.push(r),b(e).apply(null,i)}}),Ue(r,t)}function pt(){this.head=this.tail=null,this.length=0}function dt(e,t){e.length=1,e.head=e.tail=t}function yt(e,t,r){if(null==t)t=1;else if(0===t)throw new Error("Concurrency must not be zero");var n=b(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,Z(e)||(e=[e]),0===e.length&&f.idle())return h(function(){f.drain()});for(var n=0,i=e.length;n<i;n++){var o={data:e[n],callback:r||F};t?f._tasks.unshift(o):f._tasks.push(o)}s||(s=!0,h(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=De(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 pt,concurrency:t,payload:r,saturated:F,unsaturated:F,buffer:t/4,empty:F,drain:F,error:F,started:!1,paused:!1,push:function(e,t){a(e,!1,t)},kill:function(){f.drain=F,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=we(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,h(f.process))}};return f}function gt(e,t){return yt(e,1,t)}pt.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},pt.prototype.empty=function(){for(;this.head;)this.shift();return this},pt.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},pt.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},pt.prototype.unshift=function(e){this.head?this.insertBefore(this.head,e):dt(this,e)},pt.prototype.push=function(e){this.tail?this.insertAfter(this.tail,e):dt(this,e)},pt.prototype.shift=function(){return this.head&&this.removeLink(this.head)},pt.prototype.pop=function(){return this.tail&&this.removeLink(this.tail)},pt.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},pt.prototype.remove=function(e){for(var t=this.head;t;){var r=t.next;e(t)&&this.removeLink(t),t=r}return this};var mt=Ee(ke,1);function bt(e,t,r,n){n=q(n||F);var i=b(r);mt(e,function(e,r,n){i(t,e,function(e,r){t=r,n(e)})},function(e){n(e,t)})}function vt(){var e=Fe(arguments,b);return function(){var t=i(arguments),r=this,n=t[t.length-1];"function"==typeof n?t.pop():n=F,bt(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 _t=function(){return vt.apply(null,i(arguments).reverse())},wt=Array.prototype.concat,St=function(e,t,r,n){n=n||F;var o=b(r);Oe(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=wt.apply(r,t[i]));return n(e,r)})},kt=Ee(St,1/0),Et=Ee(St,1),At=function(){var e=i(arguments),t=[null].concat(e);return function(){return arguments[arguments.length-1].apply(this,t)}};function xt(e){return e}function It(e,t){return function(r,n,i,o){o=o||F;var s,a=!1;r(n,function(r,n,o){i(r,function(n,i){n?o(n):e(i)&&!s?(a=!0,s=t(!0,r),o(null,U)):o()})},function(e){e?o(e):o(null,a?s:t(!1))})}}function Tt(e,t){return t}var Bt=Ie(It(xt,Tt)),Ct=Pe(It(xt,Tt)),Pt=Ee(Ct,1);function Ot(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]&&Le(r,function(t){console[e](t)}))}),b(t).apply(null,r)}}var Rt=Ot("dir");function Nt(e,t,r){r=we(r||F);var n=b(e),o=b(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 Lt(e,t,r){r=we(r||F);var n=b(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 Kt(e,t,r){Lt(e,function(){return!t.apply(this,arguments)},r)}function jt(e,t,r){r=we(r||F);var n=b(t),i=b(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 Mt(e){return function(t,r,n){return e(t,n)}}function Dt(e,t,r){xe(e,Mt(b(t)),r)}function Ut(e,t,r,n){Se(t)(e,Mt(b(r)),n)}var Ft=Ee(Ut,1);function qt(e){return m(e)?e:s(function(t,r){var n=!0;t.push(function(){var e=arguments;n?h(function(){r.apply(null,e)}):r.apply(null,e)}),e.apply(this,t),n=!1})}function Ht(e){return!e}var zt=Ie(It(Ht,Ht)),Vt=Pe(It(Ht,Ht)),Gt=Ee(Vt,1);function Wt(e){return function(t){return null==t?void 0:t[e]}}function $t(e,t,r,n){(D(t)?function(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(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,Fe(i.sort(function(e,t){return e.index-t.index}),Wt("value")))})})(e,t,b(r),n||F)}var Yt=Ie($t),Jt=Pe($t),Xt=Ee(Jt,1);function Zt(e,t){var r=we(t||F),n=b(qt(e));!function e(t){if(t)return r(t);n(e)}()}var Qt=function(e,t,r,n){n=n||F;var i=b(r);Oe(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)})},er=Ee(Qt,1/0),tr=Ee(Qt,1),rr=Ot("log");function nr(e,t,r,n){n=q(n||F);var i={},o=b(r);ke(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 ir=Ee(nr,1/0),or=Ee(nr,1);function sr(e,t){return t in e}function ar(e,t){var r=Object.create(null),n=Object.create(null);t=t||xt;var o=b(e),a=s(function(e,s){var a=t.apply(null,e);sr(r,a)?h(function(){s.apply(null,r[a])}):sr(n,a)?n[a].push(s):(n[a]=[s],o.apply(null,e.concat(function(){var e=i(arguments);r[a]=e;var t=n[a];delete n[a];for(var o=0,s=t.length;o<s;o++)t[o].apply(null,e)})))});return a.memo=r,a.unmemoized=e,a}var ur=l(c?e.nextTick:u?setImmediate:f);function cr(e,t,r){r=r||F;var n=D(t)?[]:{};e(t,function(e,t,r){b(e)(function(e,o){arguments.length>2&&(o=i(arguments,1)),n[t]=o,r(e)})},function(e){r(e,n)})}function fr(e,t){cr(xe,e,t)}function lr(e,t,r){cr(Se(t),e,r)}var hr=function(e,t){var r=b(e);return yt(function(e,t){r(e[0],t)},t,1)},pr=function(e,t){var r=hr(e,t);return r.push=function(e,t,n){if(null==n&&(n=F),"function"!=typeof n)throw new Error("task callback must be a function");if(r.started=!0,Z(e)||(e=[e]),0===e.length)return h(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)}h(r.process)},delete r.unshift,r};function dr(e,t){if(t=q(t||F),!Z(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++)b(e[r])(t)}function yr(e,t,r,n){bt(i(e).reverse(),t,r,n)}function gr(e){var t=b(e);return s(function(e,r){return e.push(function(e,t){var n;e?r(null,{error:e}):(n=arguments.length<=2?t:i(arguments,1),r(null,{value:n}))}),t.apply(this,e)})}function mr(e){var t;return Z(e)?t=Fe(e,gr):(t={},je(e,function(e,r){t[r]=gr.call(this,e)})),t}function br(e,t,r,n){$t(e,t,function(e,t){r(e,function(e,r){t(e,!r)})},n)}var vr=Ie(br),_r=Pe(br),wr=Ee(_r,1);function Sr(e){return function(){return e}}function kr(e,t,r){var n=5,i=0,o={times:n,intervalFunc:Sr(i)};if(arguments.length<3&&"function"==typeof e?(r=t||F,t=e):(function(e,t){if("object"==typeof t)e.times=+t.times||n,e.intervalFunc="function"==typeof t.interval?t.interval:Sr(+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}}(o,e),r=r||F),"function"!=typeof t)throw new Error("Invalid arguments for async.retry");var s=b(t),a=1;!function e(){s(function(t){t&&a++<o.times&&("function"!=typeof o.errorFilter||o.errorFilter(t))?setTimeout(e,o.intervalFunc(a)):r.apply(null,arguments)})}()}var Er=function(e,t){t||(t=e,e=null);var r=b(t);return s(function(t,n){function i(e){r.apply(null,t.concat(e))}e?kr(e,i,n):kr(i,n)})};function Ar(e,t){cr(mt,e,t)}var xr=Ie(It(Boolean,xt)),Ir=Pe(It(Boolean,xt)),Tr=Ee(Ir,1);function Br(e,t,r){var n=b(t);function i(e,t){var r=e.criteria,n=t.criteria;return r<n?-1:r>n?1:0}Be(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,Fe(t.sort(i),Wt("value")))})}function Cr(e,t,r){var n=b(e);return s(function(i,o){var s,a=!1;i.push(function(){a||(o.apply(null,arguments),clearTimeout(s))}),s=setTimeout(function(){var t=e.name||"anonymous",n=new Error('Callback function "'+t+'" timed out.');n.code="ETIMEDOUT",r&&(n.info=r),a=!0,o(n)},t),n.apply(null,i)})}var Pr=Math.ceil,Or=Math.max;function Rr(e,t,r,n){var i=b(r);Oe(function(e,t,r,n){for(var i=-1,o=Or(Pr((t-e)/(r||1)),0),s=Array(o);o--;)s[n?o:++i]=e,e+=r;return s}(0,e,1),t,i,n)}var Nr=Ee(Rr,1/0),Lr=Ee(Rr,1);function Kr(e,t,r,n){arguments.length<=3&&(n=r,r=t,t=Z(e)?[]:{}),n=q(n||F);var i=b(r);xe(e,function(e,r,n){i(t,e,r,n)},function(e){n(e,t)})}function jr(e,t){var r,n=null;t=t||F,Ft(e,function(e,t){b(e)(function(e,o){r=arguments.length>2?i(arguments,1):o,n=e,t(!e)})},function(){t(n,r)})}function Mr(e){return function(){return(e.unmemoized||e).apply(null,arguments)}}function Dr(e,t,r){r=we(r||F);var n=b(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 Ur(e,t,r){Dr(function(){return!e.apply(this,arguments)},t,r)}var Fr=function(e,t){if(t=q(t||F),!Z(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=b(e[r++]);t.push(we(o)),n.apply(null,t)}function o(o){if(o||r===e.length)return t.apply(null,arguments);n(i(arguments,1))}n([])},qr={apply:o,applyEach:Ce,applyEachSeries:Ne,asyncify:p,auto:Ue,autoInject:ht,cargo:gt,compose:_t,concat:kt,concatLimit:St,concatSeries:Et,constant:At,detect:Bt,detectLimit:Ct,detectSeries:Pt,dir:Rt,doDuring:Nt,doUntil:Kt,doWhilst:Lt,during:jt,each:Dt,eachLimit:Ut,eachOf:xe,eachOfLimit:ke,eachOfSeries:mt,eachSeries:Ft,ensureAsync:qt,every:zt,everyLimit:Vt,everySeries:Gt,filter:Yt,filterLimit:Jt,filterSeries:Xt,forever:Zt,groupBy:er,groupByLimit:Qt,groupBySeries:tr,log:rr,map:Be,mapLimit:Oe,mapSeries:Re,mapValues:ir,mapValuesLimit:nr,mapValuesSeries:or,memoize:ar,nextTick:ur,parallel:fr,parallelLimit:lr,priorityQueue:pr,queue:hr,race:dr,reduce:bt,reduceRight:yr,reflect:gr,reflectAll:mr,reject:vr,rejectLimit:_r,rejectSeries:wr,retry:kr,retryable:Er,seq:vt,series:Ar,setImmediate:h,some:xr,someLimit:Ir,someSeries:Tr,sortBy:Br,timeout:Cr,times:Nr,timesLimit:Rr,timesSeries:Lr,transform:Kr,tryEach:jr,unmemoize:Mr,until:Ur,waterfall:Fr,whilst:Dr,all:zt,allLimit:Vt,allSeries:Gt,any:xr,anyLimit:Ir,anySeries:Tr,find:Bt,findLimit:Ct,findSeries:Pt,forEach:Dt,forEachSeries:Ft,forEachLimit:Ut,forEachOf:xe,forEachOfSeries:mt,forEachOfLimit:ke,inject:bt,foldl:bt,foldr:yr,select:Yt,selectLimit:Jt,selectSeries:Xt,wrapSync:p};t.default=qr,t.apply=o,t.applyEach=Ce,t.applyEachSeries=Ne,t.asyncify=p,t.auto=Ue,t.autoInject=ht,t.cargo=gt,t.compose=_t,t.concat=kt,t.concatLimit=St,t.concatSeries=Et,t.constant=At,t.detect=Bt,t.detectLimit=Ct,t.detectSeries=Pt,t.dir=Rt,t.doDuring=Nt,t.doUntil=Kt,t.doWhilst=Lt,t.during=jt,t.each=Dt,t.eachLimit=Ut,t.eachOf=xe,t.eachOfLimit=ke,t.eachOfSeries=mt,t.eachSeries=Ft,t.ensureAsync=qt,t.every=zt,t.everyLimit=Vt,t.everySeries=Gt,t.filter=Yt,t.filterLimit=Jt,t.filterSeries=Xt,t.forever=Zt,t.groupBy=er,t.groupByLimit=Qt,t.groupBySeries=tr,t.log=rr,t.map=Be,t.mapLimit=Oe,t.mapSeries=Re,t.mapValues=ir,t.mapValuesLimit=nr,t.mapValuesSeries=or,t.memoize=ar,t.nextTick=ur,t.parallel=fr,t.parallelLimit=lr,t.priorityQueue=pr,t.queue=hr,t.race=dr,t.reduce=bt,t.reduceRight=yr,t.reflect=gr,t.reflectAll=mr,t.reject=vr,t.rejectLimit=_r,t.rejectSeries=wr,t.retry=kr,t.retryable=Er,t.seq=vt,t.series=Ar,t.setImmediate=h,t.some=xr,t.someLimit=Ir,t.someSeries=Tr,t.sortBy=Br,t.timeout=Cr,t.times=Nr,t.timesLimit=Rr,t.timesSeries=Lr,t.transform=Kr,t.tryEach=jr,t.unmemoize=Mr,t.until=Ur,t.waterfall=Fr,t.whilst=Dr,t.all=zt,t.allLimit=Vt,t.allSeries=Gt,t.any=xr,t.anyLimit=Ir,t.anySeries=Tr,t.find=Bt,t.findLimit=Ct,t.findSeries=Pt,t.forEach=Dt,t.forEachSeries=Ft,t.forEachLimit=Ut,t.forEachOf=xe,t.forEachOfSeries=mt,t.forEachOfLimit=ke,t.inject=bt,t.foldl=bt,t.foldr=yr,t.select=Yt,t.selectLimit=Jt,t.selectSeries=Xt,t.wrapSync=p,Object.defineProperty(t,"__esModule",{value:!0})})}).call(this,r(7),r(6),r(27)(e))},function(e,t,r){"use strict";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(114),o=r(1095),s=r(515),a=r(516);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=l;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=function(e){try{return JSON.stringify(e)}catch(e){return!1}}(e.data);if(!1===i)return c;r+=i}return n("encoded %j as %s",e,r),r}function l(){this.reconstructor=null}function h(e){var r=0,i={type:Number(e.charAt(0))};if(null==t.types[i.type])return d("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;){if(","===(u=e.charAt(r)))break;if(i.nsp+=u,r===e.length)break}else i.nsp="/";var a=e.charAt(r+1);if(""!==a&&Number(a)==a){for(i.id="";++r;){var u;if(null==(u=e.charAt(r))||Number(u)!=u){--r;break}if(i.id+=e.charAt(r),r===e.length)break}i.id=Number(i.id)}if(e.charAt(++r)){var c=function(e){try{return JSON.parse(e)}catch(e){return!1}}(e.substr(r));if(!1===c||i.type!==t.ERROR&&!s(c))return d("invalid payload");i.data=c}return n("decoded %s as %j",e,i),i}function p(e){this.reconPack=e,this.buffers=[]}function d(e){return{type:t.ERROR,data:"parser error: "+e}}u.prototype.encode=function(e,r){n("encoding packet %j",e),t.BINARY_EVENT===e.type||t.BINARY_ACK===e.type?function(e,t){o.removeBlobs(e,function(e){var r=o.deconstructPacket(e),n=f(r.packet),i=r.buffers;i.unshift(n),t(i)})}(e,r):r([f(e)])},i(l.prototype),l.prototype.add=function(e){var r;if("string"==typeof e)r=h(e),t.BINARY_EVENT===r.type||t.BINARY_ACK===r.type?(this.reconstructor=new p(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))&&(this.reconstructor=null,this.emit("decoded",r))}},l.prototype.destroy=function(){this.reconstructor&&this.reconstructor.finishedReconstruction()},p.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},p.prototype.finishedReconstruction=function(){this.reconPack=null,this.buffers=[]}},function(e,t,r){(function(t){var n=r(1098);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(6))},function(e,t,r){var n=r(115),i=r(114);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){return e.then(e=>{t(null,e)},e=>{t(e)})}},function(e,t,r){"use strict";e.exports=(()=>{if("undefined"!=typeof self&&(r(56)(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){return e.then(e=>{t(null,e)},e=>{t(e)})}},function(e,t,r){"use strict";e.exports=(()=>{if("undefined"!=typeof self&&(r(56)(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(291),i=r(52),o=r(8),s=r(292),a=r(63);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=>(function(e,t,r){s.hmac.create(e,t,r)})(e.hashT,e.keys.macKey,t),t=>(function(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}`))})(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){r=r||(()=>{}),o(o.values([t]),i.encode({fixed:!0,bytes:4}),o.collect((t,n)=>{if(t)return r(t);e.shake.write(n[0]),r()}))},t.read=function(e,t){i.decodeFromReader(e,{fixed:!0,bytes:4},t)}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(t){const n=r(12),i=r(1165);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,s=n;r&&(s=((e,t)=>{if(e)return n(e);n(null,t.slice(0,r))}));try{i=o.createHash(t)}catch(e){return s(e)}i(e,s)},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(544),i=r(1169),o=r(1171);(t=e.exports).aes=i,t.hmac=n,t.keys=o,t.randomBytes=r(547),t.pbkdf2=r(1179)},function(e,t,r){"use strict";e.exports=function(e,t){return e.then(e=>{t(null,e)},e=>{t(e)})}},function(e,t,r){"use strict";e.exports=(()=>{if("undefined"!=typeof self&&(r(56)(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(10),i=r(1180),o=r(292),s=r(63),a=r(4),u=r(1),c=u("libp2p:secio");c.error=u("libp2p:secio:error");const f=n(r(1181)),l=r(290);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){return e.then(e=>{t(null,e)},e=>{t(e)})}},function(e,t,r){"use strict";e.exports=(()=>{if("undefined"!=typeof self&&(r(56)(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(10);e.exports=n("\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").Identify},function(e,t,r){"use strict";e.exports=function(e,t){return e.then(e=>{t(null,e)},e=>{t(e)})}},function(e,t,r){"use strict";e.exports=(()=>{if("undefined"!=typeof self&&(r(56)(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(1231),t.Dialer=t.dialer=r(1235),t.matchSemver=r(1236),t.matchExact=r(563)},function(e,t){e.exports=function(e){return e}},function(e,t,r){"use strict";const n=r(44);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)}function o(e,t,r,n){return{code:e,size:t,name:r,resolvable:Boolean(n)}}i.lengthPrefixedVarSize=-1,i.V=-1,i.table=[[4,32,"ip4"],[6,16,"tcp"],[17,16,"udp"],[33,16,"dccp"],[41,128,"ip6"],[54,-1,"dns4","resolvable"],[55,-1,"dns6","resolvable"],[56,-1,"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=o.apply(null,e);i.codes[t.code]=t,i.names[t.name]=t}),i.object=o,e.exports=i},function(e,t,r){"use strict";e.exports=function(e,t){return e.then(e=>{t(null,e)},e=>{t(e)})}},function(e,t,r){"use strict";e.exports=(()=>{if("undefined"!=typeof self&&(r(56)(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(8),i=r(52),o=r(100),s=r(1),a=s("libp2p:circuit:stream-handler");a.err=s("libp2p:circuit:error:stream-handler");e.exports=class{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}}},function(e,t,r){"use strict";e.exports={relay:"/libp2p/circuit/relay/0.1.0"}},function(e,t,r){var n=r(1265),i=r(1269);e.exports=function(e,t){var r=i(e,t);return n(r)?r:void 0}},function(e,t){e.exports=function(e,t){return e===t||e!=e&&t!=t}},function(e,t,r){"use strict";e.exports=function(e,t){return e.then(e=>{t(null,e)},e=>{t(e)})}},function(e,t,r){"use strict";e.exports=(()=>{if("undefined"!=typeof self&&(r(56)(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(157),i=r(160),o="[object Symbol]";e.exports=function(e){return"symbol"==typeof e||i(e)&&n(e)==o}},function(e,t,r){"use strict";e.exports=function(e,t){return e.then(e=>{t(null,e)},e=>{t(e)})}},function(e,t,r){"use strict";e.exports=(()=>{if("undefined"!=typeof self&&(r(56)(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(202);e.exports=function(e){const t=e||100;var r=[];return n(function(e){for(r=r.concat(e);r.length>=t;){const e=t,n=r.slice(0,e);r=r.slice(e),this.queue(n)}},function(e){r.length&&(this.queue(r),r=[]),this.queue(null)})}},function(e,t,r){"use strict";e.exports=class{constructor(e,t){this._options=t||{},Object.assign(this,e)}}},function(e,t,r){var n=r(1413);e.exports=function(e,t,r){r=void 0===r||r;var i,o=!1;return function(s){var a,u,c=0,f=0,l=0,h=[],p=!1,d=!1;function y(){if(a){var e=a;if(u)return a=null,e(u);if(Object.hasOwnProperty.call(h,f)){a=null;var r=h[f];delete h[f],f++,e(null,r),t&&g()}else f>=l&&d&&(a=null,e(d))}}var g=n(function(){if(p=!0,d)return y();o||t&&c-t>=f||(o=!0,s(i,function(t,n){if(o=!1,t)l=c,d=t,y();else{var i=c++;e(n,function(e,t){r?h[i]=t:h.push(t),e&&(u=e),y()}),d||g()}}))});return function(e,t){e?s(d=i=e,function(e){if(t)return t(e)}):(a=t,p||g(),y())}}}},function(e,t,r){"use strict";const n=r(9),i=r(45),{DAGNode:o,DAGLink:s}=i,a=r(4);e.exports=((e,t,r)=>(t=Object.assign({},{parent:void 0,child:void 0,name:"",flush:!0},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")))},function(e,t,r){"use strict";const n=r(145).exporter,i=r(70),o=r(87),s=r(4),a=r(35),{traverseTo:u}=r(48),c=r(1)("ipfs:mfs:read-pull-stream"),f={offset:0,length:void 0};e.exports=(e=>(function(t,r,l){"function"==typeof r&&(l=r,r={}),r=Object.assign({},f,r),c(`Reading ${t}`),s([r=>u(e,t,{parents:!1},r),(u,c)=>{const f=u.node;if("file"!==a.unmarshal(f.data).type)return c(new Error(`${t} was not a file`));s([t=>i(n(f.multihash,e.dag,{offset:r.offset,length:r.length}),o(t)),(e,t)=>t(null,e[0].content)],c)}],l)}))},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(1521),i=r(618),o=r(26),s=r(1522),a=r(33),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){var r=u.request(e,t);return r.end(),r},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(6))},function(e,t){var r,n=1,i=function(){n=n+1&65535};e.exports=function(e){r||(r=setInterval(i,250)).unref&&r.unref();var t=4*(e||5),o=[0],s=1,a=n-1&65535;return function(e){var r=n-a&65535;for(r>t&&(r=t),a=n;r--;)s===t&&(s=0),o[s]=o[0===s?t-1:s-1],s++;e&&(o[s-1]+=e);var i=o[s-1],u=o.length<t?0:o[s===t?0:s];return o.length<4?i:4*(i-u)/o.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)}e.exports=function(e,r,o){if("number"==typeof e)throw new TypeError('"value" argument must not be a number');return i(e)?function(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)>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)))}(e,r,o):"string"==typeof e?function(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)}(e,r):n?t.from(e):new t(e)}}).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(150);e.exports=_;var o,s=r(333);_.ReadableState=v;r(11).EventEmitter;var a=function(e,t){return e.listeners(t).length},u=r(334),c=r(2).Buffer,f=t.Uint8Array||function(){};var l=r(117);l.inherits=r(5);var h=r(637),p=void 0;p=h&&h.debuglog?h.debuglog("stream"):function(){};var d,y=r(638),g=r(336);l.inherits(_,u);var m=["error","close","destroy","pause","resume"];function b(e,t,r){if("function"==typeof e.prependListener)return e.prependListener(t,r);e._events&&e._events[t]?s(e._events[t])?e._events[t].unshift(r):e._events[t]=[r,e._events[t]]:e.on(t,r)}function v(e,t){o=o||r(85),e=e||{};var n=t instanceof o;this.objectMode=!!e.objectMode,n&&(this.objectMode=this.objectMode||!!e.readableObjectMode);var i=e.highWaterMark,s=e.readableHighWaterMark,a=this.objectMode?16:16384;this.highWaterMark=i||0===i?i:n&&(s||0===s)?s:a,this.highWaterMark=Math.floor(this.highWaterMark),this.buffer=new y,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&&(d||(d=r(211).StringDecoder),this.decoder=new d(e.encoding),this.encoding=e.encoding)}function _(e){if(o=o||r(85),!(this instanceof _))return new _(e);this._readableState=new v(e,this),this.readable=!0,e&&("function"==typeof e.read&&(this._read=e.read),"function"==typeof e.destroy&&(this._destroy=e.destroy)),u.call(this)}function w(e,t,r,n,i){var o,s=e._readableState;return null===t?(s.reading=!1,function(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,A(e)}}(e,s)):(i||(o=function(e,t){var r;return function(e){return c.isBuffer(e)||e instanceof f}(t)||"string"==typeof t||void 0===t||e.objectMode||(r=new TypeError("Invalid non-string/buffer chunk")),r}(s,t)),o?e.emit("error",o):s.objectMode||t&&t.length>0?("string"==typeof t||s.objectMode||Object.getPrototypeOf(t)===c.prototype||(t=function(e){return c.from(e)}(t)),n?s.endEmitted?e.emit("error",new Error("stream.unshift() after end event")):S(e,s,t,!0):s.ended?e.emit("error",new Error("stream.push() after EOF")):(s.reading=!1,s.decoder&&!r?(t=s.decoder.write(t),s.objectMode||0!==t.length?S(e,s,t,!1):I(e,s)):S(e,s,t,!1))):n||(s.reading=!1)),function(e){return!e.ended&&(e.needReadable||e.length<e.highWaterMark||0===e.length)}(s)}function S(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&&A(e)),I(e,t)}Object.defineProperty(_.prototype,"destroyed",{get:function(){return void 0!==this._readableState&&this._readableState.destroyed},set:function(e){this._readableState&&(this._readableState.destroyed=e)}}),_.prototype.destroy=g.destroy,_.prototype._undestroy=g.undestroy,_.prototype._destroy=function(e,t){this.push(null),t(e)},_.prototype.push=function(e,t){var r,n=this._readableState;return n.objectMode?r=!0:"string"==typeof e&&((t=t||n.defaultEncoding)!==n.encoding&&(e=c.from(e,t),t=""),r=!0),w(this,e,t,!1,r)},_.prototype.unshift=function(e){return w(this,e,null,!0,!1)},_.prototype.isPaused=function(){return!1===this._readableState.flowing},_.prototype.setEncoding=function(e){return d||(d=r(211).StringDecoder),this._readableState.decoder=new d(e),this._readableState.encoding=e,this};var k=8388608;function E(e,t){return e<=0||0===t.length&&t.ended?0:t.objectMode?1:e!=e?t.flowing&&t.length?t.buffer.head.data.length:t.length:(e>t.highWaterMark&&(t.highWaterMark=function(e){return e>=k?e=k:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}function A(e){var t=e._readableState;t.needReadable=!1,t.emittedReadable||(p("emitReadable",t.flowing),t.emittedReadable=!0,t.sync?i.nextTick(x,e):x(e))}function x(e){p("emit readable"),e.emit("readable"),P(e)}function I(e,t){t.readingMore||(t.readingMore=!0,i.nextTick(T,e,t))}function T(e,t){for(var r=t.length;!t.reading&&!t.flowing&&!t.ended&&t.length<t.highWaterMark&&(p("maybeReadMore read 0"),e.read(0),r!==t.length);)r=t.length;t.readingMore=!1}function B(e){p("readable nexttick read 0"),e.read(0)}function C(e,t){t.reading||(p("resume read 0"),e.read(0)),t.resumeScheduled=!1,t.awaitDrain=0,e.emit("resume"),P(e),t.flowing&&!t.reading&&e.read(0)}function P(e){var t=e._readableState;for(p("flow",t.flowing);t.flowing&&null!==e.read(););}function O(e,t){return 0===t.length?null:(t.objectMode?r=t.buffer.shift():!e||e>=t.length?(r=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.head.data:t.buffer.concat(t.length),t.buffer.clear()):r=function(e,t,r){var n;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?function(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),0==(e-=s)){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}(e,t):function(e,t){var r=c.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),0==(e-=s)){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}(e,t),n}(e,t.buffer,t.decoder),r);var r}function R(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(N,t,e))}function N(e,t){e.endEmitted||0!==e.length||(e.endEmitted=!0,t.readable=!1,t.emit("end"))}function L(e,t){for(var r=0,n=e.length;r<n;r++)if(e[r]===t)return r;return-1}_.prototype.read=function(e){p("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 p("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?R(this):A(this),null;if(0===(e=E(e,t))&&t.ended)return 0===t.length&&R(this),null;var n,i=t.needReadable;return p("need readable",i),(0===t.length||t.length-e<t.highWaterMark)&&p("length less than watermark",i=!0),t.ended||t.reading?p("reading or ended",i=!1):i&&(p("do read"),t.reading=!0,t.sync=!0,0===t.length&&(t.needReadable=!0),this._read(t.highWaterMark),t.sync=!1,t.reading||(e=E(r,t))),null===(n=e>0?O(e,t):null)?(t.needReadable=!0,e=0):t.length-=e,0===t.length&&(t.ended||(t.needReadable=!0),r!==e&&t.ended&&R(this)),null!==n&&this.emit("data",n),n},_.prototype._read=function(e){this.emit("error",new Error("_read() is not implemented"))},_.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,p("pipe count=%d opts=%j",o.pipesCount,t);var s=t&&!1===t.end||e===n.stdout||e===n.stderr?_:c;function u(e,t){p("onunpipe"),e===r&&t&&!1===t.hasUnpiped&&(t.hasUnpiped=!0,h())}function c(){p("onend"),e.end()}o.endEmitted?i.nextTick(s):r.once("end",s),e.on("unpipe",u);var f=function(e){return function(){var t=e._readableState;p("pipeOnDrain",t.awaitDrain),t.awaitDrain&&t.awaitDrain--,0===t.awaitDrain&&a(e,"data")&&(t.flowing=!0,P(e))}}(r);e.on("drain",f);var l=!1;function h(){p("cleanup"),e.removeListener("close",m),e.removeListener("finish",v),e.removeListener("drain",f),e.removeListener("error",g),e.removeListener("unpipe",u),r.removeListener("end",c),r.removeListener("end",_),r.removeListener("data",y),l=!0,!o.awaitDrain||e._writableState&&!e._writableState.needDrain||f()}var d=!1;function y(t){p("ondata"),d=!1,!1!==e.write(t)||d||((1===o.pipesCount&&o.pipes===e||o.pipesCount>1&&-1!==L(o.pipes,e))&&!l&&(p("false write response, pause",r._readableState.awaitDrain),r._readableState.awaitDrain++,d=!0),r.pause())}function g(t){p("onerror",t),_(),e.removeListener("error",g),0===a(e,"error")&&e.emit("error",t)}function m(){e.removeListener("finish",v),_()}function v(){p("onfinish"),e.removeListener("close",m),_()}function _(){p("unpipe"),r.unpipe(e)}return r.on("data",y),b(e,"error",g),e.once("close",m),e.once("finish",v),e.emit("pipe",r),o.flowing||(p("pipe resume"),r.resume()),e},_.prototype.unpipe=function(e){var t=this._readableState,r={hasUnpiped:!1};if(0===t.pipesCount)return this;if(1===t.pipesCount)return e&&e!==t.pipes?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=L(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)},_.prototype.on=function(e,t){var r=u.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&&A(this):i.nextTick(B,this))}return r},_.prototype.addListener=_.prototype.on,_.prototype.resume=function(){var e=this._readableState;return e.flowing||(p("resume"),e.flowing=!0,function(e,t){t.resumeScheduled||(t.resumeScheduled=!0,i.nextTick(C,e,t))}(this,e)),this},_.prototype.pause=function(){return p("call pause flowing=%j",this._readableState.flowing),!1!==this._readableState.flowing&&(p("pause"),this._readableState.flowing=!1,this.emit("pause")),this},_.prototype.wrap=function(e){var t=this,r=this._readableState,n=!1;for(var i in e.on("end",function(){if(p("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){p("wrapped data"),r.decoder&&(i=r.decoder.write(i)),(!r.objectMode||null!==i&&void 0!==i)&&(r.objectMode||i&&i.length)&&(t.push(i)||(n=!0,e.pause()))}),e)void 0===this[i]&&"function"==typeof e[i]&&(this[i]=function(t){return function(){return e[t].apply(e,arguments)}}(i));for(var o=0;o<m.length;o++)e.on(m[o],this.emit.bind(this,m[o]));return this._read=function(t){p("wrapped _read",t),n&&(n=!1,e.resume())},this},Object.defineProperty(_.prototype,"readableHighWaterMark",{enumerable:!1,get:function(){return this._readableState.highWaterMark}}),_._fromList=O}).call(this,r(6),r(7))},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(11).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))*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(150);function i(e,t){e.emit("error",t)}e.exports={destroy:function(e,t){var r=this,o=this._readableState&&this._readableState.destroyed,s=this._writableState&&this._writableState.destroyed;return o||s?(t?t(e):!e||this._writableState&&this._writableState.errorEmitted||n.nextTick(i,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(i,r,e),r._writableState&&(r._writableState.errorEmitted=!0)):t&&t(e)}),this)},undestroy:function(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)}}},function(e,t,r){"use strict";e.exports=o;var n=r(85),i=r(117);function o(e){if(!(this instanceof o))return new o(e);n.call(this,e),this._transformState={afterTransform:function(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)}.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",s)}function s(){var e=this;"function"==typeof this._flush?this._flush(function(t,r){a(e,t,r)}):a(this,null,null)}function a(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(5),i.inherits(o,n),o.prototype.push=function(e,t){return this._transformState.needTransform=!1,n.prototype.push.call(this,e,t)},o.prototype._transform=function(e,t,r){throw new Error("_transform() is not implemented")},o.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)}},o.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},o.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(t){const n=r(642),i=r(79);"undefined"==typeof fetch&&(fetch=n,Headers=fetch.Headers,Request=fetch.Request),httptools={},httptools.p_httpfetch=async function(e,r,{verbose:n=!1,wantstream:o=!1}={}){try{n&&console.log("p_httpfetch:",e,JSON.stringify(r));let s=new Request(e,r),a=await async function(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,console.log("Delaying",n,"by",t,"because",e.message),await new Promise(e=>{setTimeout(()=>{e()},t)}),t*=1+Math.random()}throw console.log("Looping",n,"failed"),o!==(window&&window.loopguard)?(console.log("Looping exited because of page change "+n),new Error("Looping exited because of page change "+n)):i}(s,500,12,"fetching "+e);if(a.ok){let e=a.headers.get("Content-Type");return o?a.body:"application/json"===e?a.json():e.startsWith("text")?a.text():new t(await a.arrayBuffer())}throw new i.TransportError(`Transport Error ${a.status}: ${a.statusText}`)}catch(r){throw console.log("Note error from fetch might be misleading especially TypeError can be Cors issue:",e),r instanceof i.TransportError?r:new i.TransportError(`Transport error thrown by ${e}: ${r.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,{verbose:t.verbose,wantstream:t.wantstream})},httptools.p_POST=async function(e,t,r,n){let i={method:"POST",headers:{},body:r,mode:"cors",cache:"default",redirect:"follow",keepalive:!0};return await httptools.p_httpfetch(e,i,{verbose:n})},e.exports=httptools}).call(this,r(0).Buffer)},function(e,t,r){"use strict";e.exports=class{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)}}},function(e,t,r){var n=r(2).Buffer;e.exports=function(e){for(var t={},r=e.length,i=e.charAt(0),o=0;o<e.length;o++){var s=e.charAt(o);if(void 0!==t[s])throw new TypeError(s+" is ambiguous");t[s]=o}function a(e){if("string"!=typeof e)throw new TypeError("Expected String");if(0===e.length)return n.allocUnsafe(0);for(var o=[0],s=0;s<e.length;s++){var a=t[e[s]];if(void 0===a)return;for(var u=0,c=a;u<o.length;++u)c+=o[u]*r,o[u]=255&c,c>>=8;for(;c>0;)o.push(255&c),c>>=8}for(var f=0;e[f]===i&&f<e.length-1;++f)o.push(0);return n.from(o.reverse())}return{encode:function(t){if(0===t.length)return"";for(var n=[0],o=0;o<t.length;++o){for(var s=0,a=t[o];s<n.length;++s)a+=n[s]<<8,n[s]=a%r,a=a/r|0;for(;a>0;)n.push(a%r),a=a/r|0}for(var u="",c=0;0===t[c]&&c<t.length-1;++c)u+=i;for(var f=n.length-1;f>=0;--f)u+=e[n[f]];return u},decodeUnsafe:a,decode:function(e){var t=a(e);if(t)return t;throw new Error("Non-base"+r+" character")}}}},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(n){const i=r(649);(t=e.exports=s).encode=function(e,t){const r=a(e);return s(r.name,n.from(r.encode(t)))},t.decode=function(e){n.isBuffer(e)&&(e=e.toString());const t=e.substring(0,1);"string"==typeof(e=e.substring(1,e.length))&&(e=n.from(e));const r=a(t);return r.name,n.from(r.decode(e.toString()))},t.isEncoded=function(e){n.isBuffer(e)&&(e=e.toString());const t=e.substring(0,1);try{const r=a(t);return r.name}catch(e){return!1}};const o=new Error("Unsupported encoding");function s(e,t){if(!t)throw new Error("requires an encoded buffer");const r=a(e),i=n.from(r.code);return function(e,t){a(e).decode(t.toString())}(r.name,t),n.concat([i,t])}function a(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";const n=r(152),i=r(344).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(20);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")}e.exports={numberToBuffer:o,bufferToNumber:i,varintBufferEncode:function(e){return t.from(n.encode(i(e)))},varintBufferDecode:function(e){return o(n.decode(e))}}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";const n=r(152),i={};e.exports=i;for(let e in n){i[n[e].toString("hex")]=e}},function(e,t){e.exports=function(e,t,r){e(t),r&&r(!0===t?null:t)}},function(e,t,r){"use strict";var n=r(346);e.exports=function(e,t){return function(r,i){if(r)return n(i,r,t);if(null!=e){var o=e;e=null,i(null,o)}else i(!0)}}},function(e,t,r){"use strict";function n(e){return e}var i=r(119);e.exports=function(e){return e?(e=i(e),function(t){return function(r,n){t(r,function(r,i){try{i=r?null:e(i)}catch(e){return t(e,function(){return n(e)})}n(r,i)})}}):n}},function(e,t,r){var n=r(119);function i(e){return e}e.exports=function(e){return"object"==typeof e&&"function"==typeof e.test?function(t){return e.test(t)}:n(e)||i}},function(e,t,r){"use strict";e.exports=function(e,t){var r=!1;function n(e){!r&&t&&(r=!0,t(!0===e?null:e))}return function(t){return function(r,i){return r&&n(r),t(r,function(t,r){t?n(t):e&&e(r),i(t,r)})}}}},function(e,t,r){"use strict";function n(e){return e}var i=r(119),o=r(120);e.exports=function(e,t){e=i(e)||n;var r={};return o(function(n){var i=e(n);return r[i]?!!t:(r[i]=!0,!t)})}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e,t,r){r=(0,o.default)(r||n.default);var a=(0,s.default)(e),u=function(e){if(e)return r(e);var n=(0,i.default)(arguments,1);if(t.apply(this,n))return a(u);r.apply(null,[null].concat(n))};a(u)};var n=a(r(62)),i=a(r(102)),o=a(r(103)),s=a(r(36));function a(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=function(e){return function(){var t=(0,n.default)(arguments),r=t.pop();e.call(this,t,r)}};var n=function(e){return e&&e.__esModule?e:{default:e}}(r(102));e.exports=t.default},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e,t,r){r=r||n.default;var a=(0,i.default)(t)?[]:{};e(t,function(e,t,r){(0,s.default)(e)(function(e,n){arguments.length>2&&(n=(0,o.default)(arguments,1)),a[t]=n,r(e)})},function(e){r(e,a)})};var n=a(r(62)),i=a(r(89)),o=a(r(102)),s=a(r(36));function a(e){return e&&e.__esModule?e:{default:e}}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(6))},function(e,t){var r=9007199254740991;e.exports=function(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=r}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e,t,r,o){(0,n.default)(t)(e,(0,i.default)(r),o)};var n=o(r(358)),i=o(r(36));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=function(e){return function(t,r,u){if(u=(0,i.default)(u||n.default),e<=0||!t)return u(null);var c=(0,o.default)(t),f=!1,l=0,h=!1;function p(e,t){if(l-=1,e)f=!0,u(e);else{if(t===a.default||f&&l<=0)return f=!0,u(null);h||d()}}function d(){for(h=!0;l<e&&!f;){var t=c();if(null===t)return f=!0,void(l<=0&&u(null));l+=1,r(t.value,t.key,(0,s.default)(p))}h=!1}d()}};var n=u(r(62)),i=u(r(156)),o=u(r(675)),s=u(r(103)),a=u(r(216));function u(e){return e&&e.__esModule?e:{default:e}}e.exports=t.default},function(e,t,r){var n=r(360),i=r(685),o=r(89);e.exports=function(e){return o(e)?n(e):i(e)}},function(e,t,r){var n=r(677),i=r(361),o=r(88),s=r(679),a=r(362),u=r(681),c=Object.prototype.hasOwnProperty;e.exports=function(e,t){var r=o(e),f=!r&&i(e),l=!r&&!f&&s(e),h=!r&&!f&&!l&&u(e),p=r||f||l||h,d=p?n(e.length,String):[],y=d.length;for(var g in e)!t&&!c.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}},function(e,t,r){var n=r(678),i=r(160),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){var r=9007199254740991,n=/^(?:0|[1-9]\d*)$/;e.exports=function(e,t){var i=typeof e;return!!(t=null==t?r:t)&&("number"==i||"symbol"!=i&&n.test(e))&&e>-1&&e%1==0&&e<t}},function(e,t){var r=Object.prototype;e.exports=function(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||r)}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){return function(t,r,n){return e(t,n)}},e.exports=t.default},function(e,t,r){"use strict";(function(t){const n=r(220),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 function(e){const t=e.split(":");return t.length<2?"":t.slice(0,-1).join(":")}(this.baseNamespace())}name(){return function(e){const t=e.split(":");return t[t.length-1]}(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}}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(){return r(n),n}}else{var i=new Array(16);e.exports=function(){for(var e,t=0;t<16;t++)0==(3&t)&&(e=4294967296*Math.random()),i[t]=e>>>((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);e.exports=function(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("")}},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){"use strict";const n=r(370),i=r(34).Key,o=r(708),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(0===(e=e.trim()).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));("function"==typeof t.getRaw?t.getRaw.bind(t):t.get.bind(t))(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=function(e,t,r){if((t-=(e+="").length)<=0)return e;if(r||0===r||(r=" ")," "==(r+="")&&t<10)return n[t]+e;for(var i="";1&t&&(i+=r),t>>=1;)r+=r;return i+e};var n=[""," "," "," "," "," "," "," "," "," "]},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=o(r(714)),i=o(r(164));function o(e){return e&&e.__esModule?e:{default:e}}t.default=(0,i.default)(n.default),e.exports=t.default},function(e,t,r){t.AbstractLevelDOWN=r(720),t.AbstractIterator=r(373),t.AbstractChainedBatch=r(374)},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(7))},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(){},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(7))},function(e,t,r){var n=r(376).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(724)(e.exports),e.exports.create=e.exports.custom.createError},function(e,t){e.exports=function(){var e,t=new Promise(function(t,r){e=function(e,n){e?r(e):t(n)}});return e.promise=t,e}},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(7))},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(){},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(7))},function(e,t,r){t.AbstractLevelDOWN=r(381),t.AbstractIterator=r(382),t.AbstractChainedBatch=r(383),t.isLevelDOWN=r(732)},function(e,t,r){(function(t,n){var i=r(26),o=r(382),s=r(383);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,o,s=0,a=e.length;s<a;s++)if("object"==typeof(i=e[s])){if(o=this._checkKey(i.type,"type",this._isBuffer))return n(o);if(o=this._checkKey(i.key,"key",this._isBuffer))return n(o)}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(7),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(7))},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(7))},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;Math.random();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(161),i=r(385);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";(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){e.exports=function(e){return e&&"function"==typeof e.then}},function(e,t,r){(function(t){var r="Input must be an string, Buffer or Uint8Array";function n(e){return(4294967296+e).toString(16).substring(1)}e.exports={normalizeInput:function(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},toHex:function(e){return Array.prototype.map.call(e,function(e){return(e<16?"0":"")+e.toString(16)}).join("")},debugPrint:function(e,t,r){for(var i="\n"+e+" = ",o=0;o<t.length;o+=2){if(32===r)i+=n(t[o]).toUpperCase(),i+=" ",i+=n(t[o+1]).toUpperCase();else{if(64!==r)throw new Error("Invalid size "+r);i+=n(t[o+1]).toUpperCase(),i+=n(t[o]).toUpperCase()}o%6==4?i+="\n"+new Array(e.length+4).join(" "):o<t.length-2&&(i+=" ")}console.log(i)},testSpeed:function(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")}}}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";const n=r(4),i=r(9),o=r(226);(t=e.exports).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}),n(null,{value:o,remainderPath:t=i.slice(3).join("/")})}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(392),t.resolver=r(396)},function(e,t,r){"use strict";(function(n){const i=r(769),o=r(65),s=r(9),a=r(4),u=r(3),c=r(773),f=r(396),l=42;const h=new i.Decoder({tags:{[l]:e=>({"/":e=e.slice(1)})}});function p(e){let t;try{t=c(e)}catch(e){t=!1}if(t)throw new Error("The object passed has circular references");return function e(t){if(!t||n.isBuffer(t)||"string"==typeof t)return t;if(Array.isArray(t))return t.map(e);const r=Object.keys(t);if(1===r.length&&"/"===r[0])return function(e){return"string"==typeof e&&(e=new s(e).buffer),new i.Tagged(l,n.concat([n.from("00","hex"),e]))}(t["/"]);if(r.length>0){let n={};return r.forEach(r=>{"object"==typeof t[r]?n[r]=e(t[r]):n[r]=t[r]}),n}return t}(e)}(t=e.exports).serialize=((e,t)=>{let r;try{const n=p(e);r=i.encode(n)}catch(e){return u(()=>t(e))}u(()=>t(null,r))}),t.deserialize=((e,t)=>{let r;try{r=h.decodeFirst(e)}catch(e){return u(()=>t(e))}u(()=>t(null,r))}),t.cid=((e,r,n)=>{"function"==typeof r&&(n=r,r={});const i=(r=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(335),o=r(169),s=r(771),a=r(228),u=r(170),c=r(394),f=r(395),l=r(33);class h{constructor(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){return"string"==typeof e&&(e=n.from(e,t||"hex")),new h({size:e.length}).decodeFirst(e)}static decodeAll(e,t){return"string"==typeof e&&(e=n.from(e,t||"hex")),new h({size:e.length}).decodeAll(e)}}h.decodeFirst=h.decode,e.exports=h}).call(this,r(6),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("function"!=typeof(r=null!=e?e[this.tag]:void 0)&&"function"!=typeof(r=n["_tag"+this.tag]))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(392),o=r(397);(t=e.exports).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"));i=u=i[e]}})}),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=function(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).map(e=>e.path);r(null,n)})}),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(l){var h={},p=!0,d={node:r?o(l):l,node_:l,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){d.isRoot||(d.parent.node[d.key]=e),d.node=e,t&&(p=!1)},delete:function(e){delete d.parent.node[d.key],e&&(p=!1)},remove:function(e){u(d.parent.node)?d.parent.node.splice(d.key,1):delete d.parent.node[d.key],e&&(p=!1)},keys:null,before:function(e){h.before=e},after:function(e){h.after=e},pre:function(e){h.pre=e},post:function(e){h.post=e},stop:function(){a=!1},block:function(){p=!1}};if(!a)return d;function y(){if("object"==typeof d.node&&null!==d.node){d.keys&&d.node_===d.node||(d.keys=s(d.node)),d.isLeaf=0==d.keys.length;for(var e=0;e<i.length;e++)if(i[e].node_===l){d.circular=i[e];break}}else d.isLeaf=!0,d.keys=null;d.notLeaf=!d.isLeaf,d.notRoot=!d.isRoot}y();var g=t.call(d,d.node);return void 0!==g&&d.update&&d.update(g),h.before&&h.before.call(d,d.node),p?("object"!=typeof d.node||null===d.node||d.circular||(i.push(d),y(),c(d.keys,function(t,i){n.push(t),h.pre&&h.pre.call(d,d.node[t],t);var o=e(d.node[t]);r&&f.call(d.node,t)&&(d.node[t]=o.node),o.isLast=i==d.keys.length-1,o.isFirst=0==i,h.post&&h.post.call(d,o),n.pop()}),i.pop()),h.after&&h.after.call(d,d.node),d):d}(e).node}function o(e){if("object"==typeof e&&null!==e){var t;if(u(e))t=[];else if(function(e){return"[object Date]"===a(e)}(e))t=new Date(e.getTime?e.getTime():e);else if(function(e){return"[object RegExp]"===a(e)}(e))t=new RegExp(e);else if(function(e){return"[object Error]"===a(e)}(e))t={message:e.message};else if(function(e){return"[object Boolean]"===a(e)}(e))t=new Boolean(e);else if(function(e){return"[object Number]"===a(e)}(e))t=new Number(e);else if(function(e){return"[object String]"===a(e)}(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 c(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||!f.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||!f.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];f.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),c(s(n),function(e){a[e]=r(n[e])}),e.pop(),t.pop(),a}return n}(this.value)};var s=Object.keys||function(e){var t=[];for(var r in e)t.push(r);return t};function a(e){return Object.prototype.toString.call(e)}var u=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)},c=function(e,t){if(e.forEach)return e.forEach(t);for(var r=0;r<e.length;r++)t(e[r],r,e)};c(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 f=Object.hasOwnProperty||function(e,t){return t in e}},function(e,t,r){"use strict";(function(n){const i=r(3),o=r(4),s=r(65),a=r(9),u=r(399),c=r(171),f=r(777),l=r(778),h=r(779);(t=e.exports).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().match(/([^ ]+) (\d+)/);if(n)switch(n[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 "+n[1]),null))}else i(()=>t(new Error("invalid object header"),null))}),t.cid=((e,r,n)=>{"function"==typeof r&&(n=r,r={});const i=(r=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(398),o=r(397);(t=e.exports).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"));i=u=i[e]}})}),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=(i=(i=(i=["message","tree"]).concat(s.map(e=>"author/"+e))).concat(s.map(e=>"committer/"+e))).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(781).Block,i=r(9),o=r(12),s=r(65),a=r(4);e.exports={hashToCid:e=>{const t=r(229).defaultHashAlg,n=o.encode(e,t);return new i(1,"bitcoin-block",n)},BITCOIN_BLOCK_HEADER_SIZE:80,cid:(e,t,n)=>{"function"==typeof t&&(n=t,t={});const o=(t=t||{}).hashAlg||r(229).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)},deserialize:(e,t)=>{if(80!==e.length)return t(new Error("Bitcoin block header needs to be 80 bytes"));t(null,n.fromBuffer(e))},serialize:(e,t)=>{let r,n=null;try{r=e.toBuffer(!0)}catch(e){n=e}finally{t(n,r)}}}},function(e,t,r){var n=r(42);function i(e){return e<n.OP_PUSHDATA1?1:e<=255?2:e<=65535?3:5}e.exports={encodingLength:i,encode:function(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},decode:function(e,t){var r,i,o=e.readUInt8(t);if(o<n.OP_PUSHDATA1)r=o,i=1;else if(o===n.OP_PUSHDATA1){if(t+2>e.length)return null;r=e.readUInt8(t+1),i=2}else if(o===n.OP_PUSHDATA2){if(t+3>e.length)return null;r=e.readUInt16LE(t+1),i=3}else{if(t+5>e.length)return null;if(o!==n.OP_PUSHDATA4)throw new Error("Unexpected opcode");r=e.readUInt32LE(t+1),i=5}return{opcode:o,number:r,size:i}}}},function(e,t,r){var n=r(231);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){e?(i=i||o(n),this.message=function(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)}(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}c.prototype=Object.create(Error.prototype),c.prototype.constructor=c,f.prototype=Object.create(Error.prototype),f.prototype.constructor=c,e.exports={TfTypeError:c,TfPropertyTypeError:f,tfCustomError:function(e,t){return new c(e,{},t)},tfSubError:function(e,t,r){return e instanceof f?(t=t+"."+e.__property,e=new f(e.__type,t,e.__label,e.__value,e.__valueTypeName)):e instanceof c&&(e=new f(e.__type,t,r,e.__value,e.__valueTypeName)),Error.captureStackTrace(e),e},tfJSON:a,getValueTypeName:o}},function(e,t,r){var n=r(2).Buffer;e.exports={decode:function(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},encode:function(e){for(var t=Math.abs(e),r=function(e){return e>2147483647?5:e>8388607?4:e>32767?3:e>127?2:e>0?1:0}(t),i=n.allocUnsafe(r),o=e<0,s=0;s<r;++s)i.writeUInt8(255&t,s),t>>=8;return 128&i[r-1]?i.writeUInt8(o?128:0,r-1):o&&(i[r-1]|=128),i}}},function(e,t,r){var n=r(28),i=r(31),o=r(25),s=r(42),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;return!(o<=0)&&!(u>16)&&!(o>u)&&u===r.length-3&&(!!t||r.slice(1,-2).every(n.isCanonicalPubKey))}u.toJSON=function(){return"multi-sig output"},e.exports={check:u,decode:function(e,t){var r=n.decompile(e);return o(u,r,t),{m:r[0]-a,pubKeys:r.slice(1,-2)}},encode:function(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(e,t,r){var n=r(28),i=r(31),o=r(25),s=r(42);function a(e){var t=n.compile(e);return 22===t.length&&t[0]===s.OP_0&&20===t[1]}a.toJSON=function(){return"Witness pubKeyHash output"},e.exports={check:a,decode:function(e){return o(a,e),e.slice(2)},encode:function(e){return o(i.Hash160bit,e),n.compile([s.OP_0,e])}}},function(e,t,r){var n=r(28),i=r(31),o=r(25),s=r(42);function a(e){var t=n.compile(e);return 34===t.length&&t[0]===s.OP_0&&32===t[1]}a.toJSON=function(){return"Witness scriptHash output"},e.exports={check:a,decode:function(e){return o(a,e),e.slice(2)},encode:function(e){return o(i.Hash256bit,e),n.compile([s.OP_0,e])}}},function(e,t,r){var n=r(401),i=r(236);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")}e.exports={pushDataSize:n.encodingLength,readPushDataInt:n.decode,readUInt64LE:function(e,t){var r=e.readUInt32LE(t),n=e.readUInt32LE(t+4);return o((n*=4294967296)+r,9007199254740991),n+r},readVarInt:function(e,t){return{number:i.decode(e,t),size:i.decode.bytes}},varIntBuffer:i.encode,varIntSize:i.encodingLength,writePushDataInt:n.encode,writeUInt64LE:function(e,t,r){return o(t,9007199254740991),e.writeInt32LE(-1&t,r),e.writeUInt32LE(Math.floor(t/4294967296),r+4),r+8},writeVarInt:function(e,t,r){return i.encode(t,e,r),i.encode.bytes}}},function(e,t,r){"use strict";var n=r(2).Buffer,i=r(90).Transform;function o(e){i.call(this),this._block=n.allocUnsafe(e),this._blockSize=e,this._blockOffset=0,this._length=[0,0,0,0],this._finalized=!1}r(5)(o,i),o.prototype._transform=function(e,t,r){var n=null;try{this.update(e,t)}catch(e){n=e}r(n)},o.prototype._flush=function(e){var t=null;try{this.push(this.digest())}catch(e){t=e}e(t)},o.prototype.update=function(e,t){if(function(e,t){if(!n.isBuffer(e)&&"string"!=typeof e)throw new TypeError(t+" must be a string or a buffer")}(e,"Data"),this._finalized)throw new Error("Digest already called");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 s=0,a=8*e.length;a>0;++s)this._length[s]+=a,(a=this._length[s]/4294967296|0)>0&&(this._length[s]-=4294967296*a);return this},o.prototype._update=function(){throw new Error("_update is not implemented")},o.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},o.prototype._digest=function(){throw new Error("_digest is not implemented")},e.exports=o},function(e,t,r){"use strict";var n=r(0).Buffer,i=r(5),o=r(408),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){(t=e.exports=function(e){e=e.toLowerCase();var r=t[e];if(!r)throw new Error(e+" is not supported (we accept pull requests)");return new r}).sha=r(800),t.sha1=r(801),t.sha224=r(802),t.sha256=r(411),t.sha384=r(803),t.sha512=r(412)},function(e,t,r){var n=r(5),i=r(106),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(5),i=r(106),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),R=y(B=t[T-4],C=t[T-4+1]),N=g(C,B),L=t[T-14],K=t[T-14+1],j=t[T-32],M=t[T-32+1],D=O+K|0,U=P+L+m(D,O)|0;U=(U=U+R+m(D=D+N|0,N)|0)+j+m(D=D+M|0,M)|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;Q=(Q=(Q=Q+J+m(Z=Z+X|0,X)|0)+$+m(Z=Z+Y|0,Y)|0)+U+m(Z=Z+D|0,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,a=o+Q+m(E=k+Z|0,k)|0,o=i,k=S,i=n,S=w,n=r,w=_,r=Q+te+m(_=Z+ee|0,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;i.__bigi=r(810).version,n.isBigInteger=function(e,t){return e&&e.__bigi&&(!t||e.__bigi===i.__bigi)},n.prototype.am=function(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},n.prototype.DB=26,n.prototype.DM=67108863;var o=n.prototype.DV=1<<26;n.prototype.FV=Math.pow(2,52),n.prototype.F1=26,n.prototype.F2=0;var s,a,u="0123456789abcdefghijklmnopqrstuvwxyz",c=new Array;for(s="0".charCodeAt(0),a=0;a<=9;++a)c[s++]=a;for(s="a".charCodeAt(0),a=10;a<36;++a)c[s++]=a;for(s="A".charCodeAt(0),a=10;a<36;++a)c[s++]=a;function f(e){return u.charAt(e)}function l(e,t){var r=c[e.charCodeAt(t)];return null==r?-1:r}function h(e){var t=new n;return t.fromInt(e),t}function p(e){var t,r=1;return 0!=(t=e>>>16)&&(e=t,r+=16),0!=(t=e>>8)&&(e=t,r+=8),0!=(t=e>>4)&&(e=t,r+=4),0!=(t=e>>2)&&(e=t,r+=2),0!=(t=e>>1)&&(e=t,r+=1),r}function d(e){this.m=e}function y(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,t){return e&t}function m(e,t){return e|t}function b(e,t){return e^t}function v(e,t){return e&~t}function _(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 w(e){for(var t=0;0!=e;)e&=e-1,++t;return t}function S(){}function k(e){return e}function E(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}d.prototype.convert=function(e){return e.s<0||e.compareTo(this.m)>=0?e.mod(this.m):e},d.prototype.revert=function(e){return e},d.prototype.reduce=function(e){e.divRemTo(this.m,null,e)},d.prototype.mulTo=function(e,t,r){e.multiplyTo(t,r),this.reduce(r)},d.prototype.sqrTo=function(e,t){e.squareTo(t),this.reduce(t)},y.prototype.convert=function(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},y.prototype.revert=function(e){var t=new n;return e.copyTo(t),this.reduce(t),t},y.prototype.reduce=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(e[r=t+this.m.t]+=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)},y.prototype.mulTo=function(e,t,r){e.multiplyTo(t,r),this.reduce(r)},y.prototype.sqrTo=function(e,t){e.squareTo(t),this.reduce(t)},i.copyTo=function(e){for(var t=this.t-1;t>=0;--t)e[t]=this[t];e.t=this.t,e.s=this.s},i.fromInt=function(e){this.t=1,this.s=e<0?-1:0,e>0?this[0]=e:e<-1?this[0]=e+o:this.t=0},i.fromString=function(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 i=e.length,o=!1,s=0;--i>=0;){var a=8==r?255&e[i]:l(e,i);a<0?"-"==e.charAt(i)&&(o=!0):(o=!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)>=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(),o&&n.ZERO.subTo(this,this)},i.clamp=function(){for(var e=this.s&this.DM;this.t>0&&this[this.t-1]==e;)--this.t},i.dlShiftTo=function(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},i.drShiftTo=function(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},i.lShiftTo=function(e,t){var r,n=e%this.DB,i=this.DB-n,o=(1<<i)-1,s=Math.floor(e/this.DB),a=this.s<<n&this.DM;for(r=this.t-1;r>=0;--r)t[r+s+1]=this[r]>>i|a,a=(this[r]&o)<<n;for(r=s-1;r>=0;--r)t[r]=0;t[s]=a,t.t=this.t+s+1,t.s=this.s,t.clamp()},i.rShiftTo=function(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()}},i.subTo=function(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()},i.multiplyTo=function(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)},i.squareTo=function(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()},i.divRemTo=function(e,t,r){var i=e.abs();if(!(i.t<=0)){var o=this.abs();if(o.t<i.t)return null!=t&&t.fromInt(0),void(null!=r&&this.copyTo(r));null==r&&(r=new n);var s=new n,a=this.s,u=e.s,c=this.DB-p(i[i.t-1]);c>0?(i.lShiftTo(c,s),o.lShiftTo(c,r)):(i.copyTo(s),o.copyTo(r));var f=s.t,l=s[f-1];if(0!=l){var h=l*(1<<this.F1)+(f>1?s[f-2]>>this.F2:0),d=this.FV/h,y=(1<<this.F1)/h,g=1<<this.F2,m=r.t,b=m-f,v=null==t?new n:t;for(s.dlShiftTo(b,v),r.compareTo(v)>=0&&(r[r.t++]=1,r.subTo(v,r)),n.ONE.dlShiftTo(f,v),v.subTo(s,s);s.t<f;)s[s.t++]=0;for(;--b>=0;){var _=r[--m]==l?this.DM:Math.floor(r[m]*d+(r[m-1]+g)*y);if((r[m]+=s.am(0,_,r,b,0,f))<_)for(s.dlShiftTo(b,v),r.subTo(v,r);r[m]<--_;)r.subTo(v,r)}null!=t&&(r.drShiftTo(f,t),a!=u&&n.ZERO.subTo(t,t)),r.t=f,r.clamp(),c>0&&r.rShiftTo(c,r),a<0&&n.ZERO.subTo(r,r)}}},i.invDigit=function(){if(this.t<1)return 0;var e=this[0];if(0==(1&e))return 0;var t=3&e;return(t=(t=(t=(t=t*(2-(15&e)*t)&15)*(2-(255&e)*t)&255)*(2-((65535&e)*t&65535))&65535)*(2-e*t%this.DV)%this.DV)>0?this.DV-t:-t},i.isEven=function(){return 0==(this.t>0?1&this[0]:this.s)},i.exp=function(e,t){if(e>4294967295||e<1)return n.ONE;var r=new n,i=new n,o=t.convert(this),s=p(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)},i.toString=function(e){var t;if(this.s<0)return"-"+this.negate().toString(e);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,n=(1<<t)-1,i=!1,o="",s=this.t,a=this.DB-s*this.DB%t;if(s-- >0)for(a<this.DB&&(r=this[s]>>a)>0&&(i=!0,o=f(r));s>=0;)a<t?(r=(this[s]&(1<<a)-1)<<t-a,r|=this[--s]>>(a+=this.DB-t)):(r=this[s]>>(a-=t)&n,a<=0&&(a+=this.DB,--s)),r>0&&(i=!0),i&&(o+=f(r));return i?o:"0"},i.negate=function(){var e=new n;return n.ZERO.subTo(this,e),e},i.abs=function(){return this.s<0?this.negate():this},i.compareTo=function(e){var t=this.s-e.s;if(0!=t)return t;var r=this.t;if(0!=(t=r-e.t))return this.s<0?-t:t;for(;--r>=0;)if(0!=(t=this[r]-e[r]))return t;return 0},i.bitLength=function(){return this.t<=0?0:this.DB*(this.t-1)+p(this[this.t-1]^this.s&this.DM)},i.byteLength=function(){return this.bitLength()>>3},i.mod=function(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},i.modPowInt=function(e,t){var r;return r=e<256||t.isEven()?new d(t):new y(t),this.exp(e,r)},S.prototype.convert=k,S.prototype.revert=k,S.prototype.mulTo=function(e,t,r){e.multiplyTo(t,r)},S.prototype.sqrTo=function(e,t){e.squareTo(t)},E.prototype.convert=function(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},E.prototype.revert=function(e){return e},E.prototype.reduce=function(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)},E.prototype.mulTo=function(e,t,r){e.multiplyTo(t,r),this.reduce(r)},E.prototype.sqrTo=function(e,t){e.squareTo(t),this.reduce(t)};var A=[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],x=(1<<26)/A[A.length-1];i.chunkSize=function(e){return Math.floor(Math.LN2*this.DB/Math.log(e))},i.toRadix=function(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=h(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},i.fromRadix=function(e,t){this.fromInt(0),null==t&&(t=10);for(var r=this.chunkSize(t),i=Math.pow(t,r),o=!1,s=0,a=0,u=0;u<e.length;++u){var c=l(e,u);c<0?"-"==e.charAt(u)&&0==this.signum()&&(o=!0):(a=t*a+c,++s>=r&&(this.dMultiply(i),this.dAddOffset(a,0),s=0,a=0))}s>0&&(this.dMultiply(Math.pow(t,s)),this.dAddOffset(a,0)),o&&n.ZERO.subTo(this,this)},i.fromNumber=function(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(n.ONE.shiftLeft(e-1),m,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 i=new Array,o=7&e;i.length=1+(e>>3),t.nextBytes(i),o>0?i[0]&=(1<<o)-1:i[0]=0,this.fromString(i,256)}},i.bitwiseTo=function(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()},i.changeBit=function(e,t){var r=n.ONE.shiftLeft(e);return this.bitwiseTo(r,t,r),r},i.addTo=function(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()},i.dMultiply=function(e){this[this.t]=this.am(0,e-1,this,0,0,this.t),++this.t,this.clamp()},i.dAddOffset=function(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]}},i.multiplyLowerTo=function(e,t,r){var n,i=Math.min(this.t+e.t,t);for(r.s=0,r.t=i;i>0;)r[--i]=0;for(n=r.t-this.t;i<n;++i)r[i+this.t]=this.am(0,e[i],r,i,0,this.t);for(n=Math.min(e.t,t);i<n;++i)this.am(0,e[i],r,i,0,t-i);r.clamp()},i.multiplyUpperTo=function(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)},i.modInt=function(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},i.millerRabin=function(e){var t=this.subtract(n.ONE),r=t.getLowestSetBit();if(r<=0)return!1;var i=t.shiftRight(r);(e=e+1>>1)>A.length&&(e=A.length);for(var o=new n(null),s=[],a=0;a<e;++a){for(;c=A[Math.floor(Math.random()*A.length)],-1!=s.indexOf(c););s.push(c),o.fromInt(c);var u=o.modPow(i,this);if(0!=u.compareTo(n.ONE)&&0!=u.compareTo(t)){for(var c=1;c++<r&&0!=u.compareTo(t);)if(0==(u=u.modPowInt(2,this)).compareTo(n.ONE))return!1;if(0!=u.compareTo(t))return!1}}return!0},i.clone=function(){var e=new n;return this.copyTo(e),e},i.intValue=function(){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]},i.byteValue=function(){return 0==this.t?this.s:this[0]<<24>>24},i.shortValue=function(){return 0==this.t?this.s:this[0]<<16>>16},i.signum=function(){return this.s<0?-1:this.t<=0||1==this.t&&this[0]<=0?0:1},i.toByteArray=function(){var e=this.t,t=new Array;t[0]=this.s;var r,n=this.DB-e*this.DB%8,i=0;if(e-- >0)for(n<this.DB&&(r=this[e]>>n)!=(this.s&this.DM)>>n&&(t[i++]=r|this.s<<this.DB-n);e>=0;)n<8?(r=(this[e]&(1<<n)-1)<<8-n,r|=this[--e]>>(n+=this.DB-8)):(r=this[e]>>(n-=8)&255,n<=0&&(n+=this.DB,--e)),0!=(128&r)&&(r|=-256),0===i&&(128&this.s)!=(128&r)&&++i,(i>0||r!=this.s)&&(t[i++]=r);return t},i.equals=function(e){return 0==this.compareTo(e)},i.min=function(e){return this.compareTo(e)<0?this:e},i.max=function(e){return this.compareTo(e)>0?this:e},i.and=function(e){var t=new n;return this.bitwiseTo(e,g,t),t},i.or=function(e){var t=new n;return this.bitwiseTo(e,m,t),t},i.xor=function(e){var t=new n;return this.bitwiseTo(e,b,t),t},i.andNot=function(e){var t=new n;return this.bitwiseTo(e,v,t),t},i.not=function(){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},i.shiftLeft=function(e){var t=new n;return e<0?this.rShiftTo(-e,t):this.lShiftTo(e,t),t},i.shiftRight=function(e){var t=new n;return e<0?this.lShiftTo(-e,t):this.rShiftTo(e,t),t},i.getLowestSetBit=function(){for(var e=0;e<this.t;++e)if(0!=this[e])return e*this.DB+_(this[e]);return this.s<0?this.t*this.DB:-1},i.bitCount=function(){for(var e=0,t=this.s&this.DM,r=0;r<this.t;++r)e+=w(this[r]^t);return e},i.testBit=function(e){var t=Math.floor(e/this.DB);return t>=this.t?0!=this.s:0!=(this[t]&1<<e%this.DB)},i.setBit=function(e){return this.changeBit(e,m)},i.clearBit=function(e){return this.changeBit(e,v)},i.flipBit=function(e){return this.changeBit(e,b)},i.add=function(e){var t=new n;return this.addTo(e,t),t},i.subtract=function(e){var t=new n;return this.subTo(e,t),t},i.multiply=function(e){var t=new n;return this.multiplyTo(e,t),t},i.divide=function(e){var t=new n;return this.divRemTo(e,t,null),t},i.remainder=function(e){var t=new n;return this.divRemTo(e,null,t),t},i.divideAndRemainder=function(e){var t=new n,r=new n;return this.divRemTo(e,t,r),new Array(t,r)},i.modPow=function(e,t){var r,i,o=e.bitLength(),s=h(1);if(o<=0)return s;r=o<18?1:o<48?3:o<144?4:o<768?5:6,i=o<8?new d(t):t.isEven()?new E(t):new y(t);var a=new Array,u=3,c=r-1,f=(1<<r)-1;if(a[1]=i.convert(this),r>1){var l=new n;for(i.sqrTo(a[1],l);u<=f;)a[u]=new n,i.mulTo(l,a[u-2],a[u]),u+=2}var g,m,b=e.t-1,v=!0,_=new n;for(o=p(e[b])-1;b>=0;){for(o>=c?g=e[b]>>o-c&f:(g=(e[b]&(1<<o+1)-1)<<c-o,b>0&&(g|=e[b-1]>>this.DB+o-c)),u=r;0==(1&g);)g>>=1,--u;if((o-=u)<0&&(o+=this.DB,--b),v)a[g].copyTo(s),v=!1;else{for(;u>1;)i.sqrTo(s,_),i.sqrTo(_,s),u-=2;u>0?i.sqrTo(s,_):(m=s,s=_,_=m),i.mulTo(_,a[g],s)}for(;b>=0&&0==(e[b]&1<<o);)i.sqrTo(s,_),m=s,s=_,_=m,--o<0&&(o=this.DB-1,--b)}return i.revert(s)},i.modInverse=function(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=h(1),s=h(0),a=h(0),u=h(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},i.pow=function(e){return this.exp(e,new S)},i.gcd=function(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},i.isProbablePrime=function(e){var t,r=this.abs();if(1==r.t&&r[0]<=A[A.length-1]){for(t=0;t<A.length;++t)if(r[0]==A[t])return!0;return!1}if(r.isEven())return!1;for(t=1;t<A.length;){for(var n=A[t],i=t+1;i<A.length&&n<x;)n*=A[i++];for(n=r.modInt(n);t<i;)if(n%A[t++]==0)return!1}return r.millerRabin(e)},i.square=function(){var e=new n;return this.squareTo(e),e},n.ZERO=h(0),n.ONE=h(1),n.valueOf=h,e.exports=n},function(e,t,r){var n=r(17),i=r(2).Buffer,o=r(93),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){return e===this||(this.curve.isInfinity(this)?this.curve.isInfinity(e):this.curve.isInfinity(e)?this.curve.isInfinity(this):0===e.y.multiply(this.z).subtract(this.y.multiply(e.z)).mod(this.curve.p).signum()&&0===e.x.multiply(this.z).subtract(this.x.multiply(e.z)).mod(this.curve.p).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.multiply(this.z).subtract(r.multiply(e.z)).mod(this.curve.p),o=n.multiply(this.z).subtract(t.multiply(e.z)).mod(this.curve.p);if(0===o.signum())return 0===i.signum()?this.twice():this.curve.infinity;var u=o.square(),c=u.multiply(o),f=t.multiply(u),l=i.square().multiply(this.z),h=l.subtract(f.shiftLeft(1)).multiply(e.z).subtract(c).multiply(o).mod(this.curve.p),p=f.multiply(s).multiply(i).subtract(r.multiply(c)).subtract(l.multiply(i)).multiply(e.z).add(i.multiply(c)).mod(this.curve.p),d=c.multiply(this.z).multiply(e.z).mod(this.curve.p);return new a(this.curve,h,p,d)},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)));var u=(o=o.mod(this.curve.p)).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,r=this.affineX,n=this.affineY,o=this.curve.pLength;return e?(t=i.allocUnsafe(1+o)).writeUInt8(n.isEven()?2:3,0):((t=i.allocUnsafe(1+o+o)).writeUInt8(4,0),n.toBuffer(o).copy(t,1+o)),r.toBuffer(o).copy(t,1),t},a.decodeFrom=function(e,t){var r,i=t.readUInt8(0),s=4!==i,u=Math.floor((e.p.bitLength()+7)/8),c=o.fromBuffer(t.slice(1,1+u));if(s){n.equal(t.length,u+1,"Invalid sequence length"),n(2===i||3===i,"Invalid sequence tag");var f=3===i;r=e.pointFromX(f,c)}else{n.equal(t.length,1+u+u,"Invalid sequence length");var l=o.fromBuffer(t.slice(1+u));r=a.fromAffine(e,c,l)}return r.compressed=s,r},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(17),i=r(93),o=r(414);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).modPow(this.pOverFour,this.p),n=r;return r.isEven()^!e&&(n=this.p.subtract(n)),o.fromAffine(this,t,n)},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(817),i=r(127),o=r(128),s=r(854);e.exports=o("eth-account-snapshot",n,function(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)})}).call(this,r(0).Buffer)},function(e,t,r){"use strict";var n=r(825),i=r(826),o=r(245);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))&&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){return 1===e.length?"0"+e:e}function o(e){for(var t="",r=0;r<e.length;r++)t+=i(e[r].toString(16));return t}n.toArray=function(e,t){if(Array.isArray(e))return e.slice();if(!e)return[];var r=[];if("string"!=typeof e){for(var n=0;n<e.length;n++)r[n]=0|e[n];return r}if("hex"===t)for((e=e.replace(/[^a-z0-9]+/gi,"")).length%2!=0&&(e="0"+e),n=0;n<e.length;n+=2)r.push(parseInt(e[n]+e[n+1],16));else for(n=0;n<e.length;n++){var i=e.charCodeAt(n),o=i>>8,s=255&i;o?r.push(o,s):r.push(s)}return r},n.zero2=i,n.toHex=o,n.encode=function(e,t){return"hex"===t?o(e):e}},function(e,t,r){"use strict";var n=r(71).rotr32;function i(e,t,r){return e&t^~e&r}function o(e,t,r){return e&t^e&r^t&r}function s(e,t,r){return e^t^r}t.ft_1=function(e,t,r,n){return 0===e?i(t,r,n):1===e||3===e?s(t,r,n):2===e?o(t,r,n):void 0},t.ch32=i,t.maj32=o,t.p32=s,t.s0_256=function(e){return n(e,2)^n(e,13)^n(e,22)},t.s1_256=function(e){return n(e,6)^n(e,11)^n(e,25)},t.g0_256=function(e){return n(e,7)^n(e,18)^e>>>3},t.g1_256=function(e){return n(e,17)^n(e,19)^e>>>10}},function(e,t,r){"use strict";var n=r(71),i=r(125),o=r(419),s=r(81),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){for(var r=this.W,n=0;n<16;n++)r[n]=e[t+n];for(;n<r.length;n++)r[n]=u(y(r[n-2]),r[n-7],d(r[n-15]),r[n-16]);var i=this.h[0],o=this.h[1],g=this.h[2],m=this.h[3],b=this.h[4],v=this.h[5],_=this.h[6],w=this.h[7];for(s(this.k.length===r.length),n=0;n<r.length;n++){var S=c(w,p(b),f(b,v,_),this.k[n],r[n]),k=a(h(i),l(i,o,g));w=_,_=v,v=b,b=a(m,S),m=g,g=o,o=i,i=a(S,k)}this.h[0]=a(this.h[0],i),this.h[1]=a(this.h[1],o),this.h[2]=a(this.h[2],g),this.h[3]=a(this.h[3],m),this.h[4]=a(this.h[4],b),this.h[5]=a(this.h[5],v),this.h[6]=a(this.h[6],_),this.h[7]=a(this.h[7],w)},b.prototype._digest=function(e){return"hex"===e?n.toHex32(this.h,"big"):n.split32(this.h,"big")}},function(e,t,r){"use strict";var n=r(71),i=r(125),o=r(81),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)^s(t,e,2)^s(t,e,7);return r<0&&(r+=4294967296),r}function A(e,t){var r=a(e,t,28)^a(t,e,2)^a(t,e,7);return r<0&&(r+=4294967296),r}function x(e,t){var r=s(e,t,14)^s(e,t,18)^s(t,e,9);return r<0&&(r+=4294967296),r}function I(e,t){var r=a(e,t,14)^a(e,t,18)^a(t,e,9);return r<0&&(r+=4294967296),r}function T(e,t){var r=s(e,t,1)^s(e,t,8)^u(e,t,7);return r<0&&(r+=4294967296),r}function B(e,t){var r=a(e,t,1)^a(e,t,8)^c(e,t,7);return r<0&&(r+=4294967296),r}function C(e,t){var r=s(e,t,19)^s(t,e,29)^u(e,t,6);return r<0&&(r+=4294967296),r}function P(e,t){var r=a(e,t,19)^a(t,e,29)^c(e,t,6);return r<0&&(r+=4294967296),r}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){for(var r=this.W,n=0;n<32;n++)r[n]=e[t+n];for(;n<r.length;n+=2){var i=C(r[n-4],r[n-3]),o=P(r[n-4],r[n-3]),s=r[n-14],a=r[n-13],u=T(r[n-30],r[n-29]),c=B(r[n-30],r[n-29]),f=r[n-32],l=r[n-31];r[n]=p(i,o,s,a,u,c,f,l),r[n+1]=d(i,o,s,a,u,c,f,l)}},v.prototype._update=function(e,t){this._prepareBlock(e,t);var r=this.W,n=this.h[0],i=this.h[1],s=this.h[2],a=this.h[3],u=this.h[4],c=this.h[5],p=this.h[6],d=this.h[7],m=this.h[8],b=this.h[9],v=this.h[10],T=this.h[11],B=this.h[12],C=this.h[13],P=this.h[14],O=this.h[15];o(this.k.length===r.length);for(var R=0;R<r.length;R+=2){var N=P,L=O,K=x(m,b),j=I(m,b),M=_(m,0,v,0,B),D=w(0,b,0,T,0,C),U=this.k[R],F=this.k[R+1],q=r[R],H=r[R+1],z=y(N,L,K,j,M,D,U,F,q,H),V=g(N,L,K,j,M,D,U,F,q,H);N=E(n,i),L=A(n,i),K=S(n,0,s,0,u),j=k(0,i,0,a,0,c);var G=l(N,L,K,j),W=h(N,L,K,j);P=B,O=C,B=v,C=T,v=m,T=b,m=l(p,d,z,V),b=h(d,d,z,V),p=u,d=c,u=s,c=a,s=n,a=i,n=l(z,V,G,W),i=h(z,V,G,W)}f(this.h,0,n,i),f(this.h,2,s,a),f(this.h,4,u,c),f(this.h,6,p,d),f(this.h,8,m,b),f(this.h,10,v,T),f(this.h,12,B,C),f(this.h,14,P,O)},v.prototype._digest=function(e){return"hex"===e?n.toHex32(this.h,"big"):n.split32(this.h,"big")}},function(e,t){e.exports=function(e){if("string"!=typeof e)throw new Error("[is-hex-prefixed] value must be type 'string', is currently type "+typeof e+", while checking isHexPrefixed.");return"0x"===e.slice(0,2)}},function(e,t){e.exports=function(e){return function(t,r,n){e(t,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)))}}},function(e,t,r){const n=r(425),i=r(154);e.exports=function(e,t){return{deserialize:i(e=>new t(e)),serialize:i(e=>e.serialize()),cid:i((t,r)=>n(e,t,r))}}},function(e,t,r){"use strict";const n=r(127);e.exports=function(e,t,r){const i=t.hash();return n(e,i,r)}},function(e,t,r){"use strict";const n=r(427),i=r(127),o=r(128);e.exports=o("eth-block",n,function(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)})},function(e,t,r){(function(t){const n=r(173),i=r(855),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,c=s.div(new o(i.difficultyBoundDivisor.v)),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),u=s.add(c.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()||u.iadd(new o(2).pow(d)),-1===u.cmp(a)&&(u=a),u},s.prototype.validateDifficulty=function(e){return 0===this.canonicalDifficulty(e).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");if(s.parentBlock=a,0!==new o(s.number).cmp(new o(a.header.number).iaddn(1)))return r("invalid number");if(t){var u=t.sub(new o(a.header.number));if(-1!==u.cmpn(8)||1!==u.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(865),i=r(128);e.exports=i("eth-tx",n,function(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)})},function(e,t,r){"use strict";const n=r(870).BlockHeader,i=r(9),o=r(12),s=r(65),a=r(4);e.exports={hashToCid:e=>{const t=r(248).defaultHashAlg,n=o.encode(e,t);return new i(1,"zcash-block",n)},ZCASH_BLOCK_HEADER_SIZE:1487,cid:(e,t,n)=>{"function"==typeof t&&(n=t,t={});const o=(t=t||{}).hashAlg||r(248).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)},deserialize:(e,t)=>{if(1487!==e.length)return t(new Error("Zcash block header needs to be 1487 bytes"));t(null,n.fromBuffer(e))},serialize:(e,t)=>{let r,n=null;try{r=e.toBuffer()}catch(e){n=e}finally{t(n,r)}}}},function(e,t,r){"use strict";(function(t){var n=r(32),i=r(108),o=r(67),s=r(73),a=r(179),u=r(43),c=r(24),f=r(18),l=r(21),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,t=i.getN();do{e=n.fromBuffer(a.getRandomBuffer(32))}while(!e.lt(t)||!e.gt(n.Zero));return this.k=e,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);if(!p.mul(c).isInfinity())throw new Error("nR is not a valid curve point");var d=t.neg().mod(c),y=r.invm(c),g=p.mul(o).add(f.mul(d)).mul(y);return s.fromPoint(g,this.sig.compressed)},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,o,s,a=i.getN(),u=i.getG(),c=0;do{(!this.k||c>0)&&this.deterministicK(c),c++,r=this.k,o=u.mul(r).x.mod(a),s=r.invm(a).mul(t.add(e.mul(o))).mod(a)}while(o.cmp(n.Zero)<=0||s.cmp(n.Zero)<=0);return{s:s=h.toLowS(s),r:o}},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;e.exports={encode:function(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("")},decode:function(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()}}},function(e,t,r){"use strict";(function(t){var n=r(97),i=r(82),o=r(55),s=r(43),a=r(249),u=r(73),c=r(67),f=r(96),l=r(21),h=r(18),p=r(66),d=r(0),y=r(24),g=r(29),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,o,s=r.readUInt8();s>0&&s<a.OP_PUSHDATA1?(n=s,t.chunks.push({buf:r.read(n),len:n,opcodenum:s})):s===a.OP_PUSHDATA1?(n=r.readUInt8(),o=r.read(n),t.chunks.push({buf:o,len:n,opcodenum:s})):s===a.OP_PUSHDATA2?(n=r.readUInt16LE(),o=r.read(n),t.chunks.push({buf:o,len:n,opcodenum:s})):s===a.OP_PUSHDATA4?(n=r.readUInt32LE(),o=r.read(n),t.chunks.push({buf:o,len:n,opcodenum:s})):t.chunks.push({opcodenum:s})}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).toNumber();if(h.isUndefined(s)){var u=new t(n[i],"hex");r.chunks.push({buf:u,len:u.length,opcodenum:u.length}),i+=1}else s===a.OP_PUSHDATA1||s===a.OP_PUSHDATA2||s===a.OP_PUSHDATA4?(r.chunks.push({buf:new t(n[i+2],"hex"),len:parseInt(n[i+1]),opcodenum:s}),i+=3):(r.chunks.push({opcodenum:s}),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).toNumber();if(h.isUndefined(s)){if(!((s=parseInt(o))>0&&s<a.OP_PUSHDATA1))throw new Error("Invalid script: "+JSON.stringify(e));r.chunks.push({buf:new t(n[i+1].slice(2),"hex"),len:s,opcodenum:s}),i+=2}else if(s===a.OP_PUSHDATA1||s===a.OP_PUSHDATA2||s===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:s}),i+=3}else r.chunks.push({opcodenum:s}),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,t,r=this.chunks[this.chunks.length-1].buf;if(!r)return!1;try{t=m.fromBuffer(r)}catch(e){if(e instanceof p.Script.InvalidBuffer)return!1;throw e}return t.classify()!==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={}).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={}).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={}).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));var i=e=h.map(e,u);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){return l.checkArgument(t instanceof c||y.isBuffer(t)),l.checkArgument(h.isUndefined(r)||h.isNumber(r)),t instanceof c&&(t=t.toBuffer()),(new m).add(y.concat([t,y.integerAsSingleByteBuffer(r||c.SIGHASH_ALL)])).add(new u(e).toBuffer())},m.empty=function(){return new m},m.prototype.toScriptHashOut=function(){return m.buildScriptHashOut(this)},m.fromAddress=function(e){if((e=n(e)).isPayToScriptHash())return m.buildScriptHashOut(e);if(e.isPayToPublicKeyHash())return m.buildPublicKeyHashOut(e);throw new p.Script.UnrecognizedAddress(e)},m.prototype.getAddressInfo=function(e){return this._isInput?this._getInputAddressInfo():this._isOutput?this._getOutputAddressInfo():this._getOutputAddressInfo()||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().toString("hex"),r=0;r<this.chunks.length;r++){t===m({chunks:[this.chunks[r]]}).toBuffer().toString("hex")&&this.chunks.splice(r,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){var o=i.opcodenum;o==a.OP_CHECKSIG||o==a.OP_CHECKSIGVERIFY?r++:o!=a.OP_CHECKMULTISIG&&o!=a.OP_CHECKMULTISIGVERIFY||(e&&n>=a.OP_1&&n<=a.OP_16?r+=t._decodeOP_N(n):r+=20),n=o}),r},e.exports=m}).call(this,r(0).Buffer)},function(e,t,r){"use strict";var n=r(18),i=r(21),o=r(29),s=r(68),a=r(97),u=r(252);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(){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(18),i=r(180),o=r(24),s=r(82),a=r(55),u=r(43),c=(r(29),r(178)),f=r(21);function l(e){if(!(this instanceof l))return new l(e);var t={};if(o.isBuffer(e))t=l._fromBufferReader(s(e));else{if(!n.isObject(e))throw new TypeError("Unrecognized argument for MerkleBlock");t={header:e.header instanceof i?e.header:i.fromObject(e.header),numTransactions:e.numTransactions,hashes:e.hashes,flags:e.flags}}return n.extend(this,t),this._flagBitsUsed=0,this._hashesUsed=0,this}l.fromBuffer=function(e){return l.fromBufferReader(s(e))},l.fromBufferReader=function(e){return new l(l._fromBufferReader(e))},l.prototype.toBuffer=function(){return this.toBufferWriter().concat()},l.prototype.toBufferWriter=function(e){e||(e=new a),e.write(this.header.toBuffer()),e.writeUInt32LE(this.numTransactions),e.writeVarintNum(this.hashes.length);for(var r=0;r<this.hashes.length;r++)e.write(new t(this.hashes[r],"hex"));for(e.writeVarintNum(this.flags.length),r=0;r<this.flags.length;r++)e.writeUInt8(this.flags[r]);return e},l.prototype.toObject=l.prototype.toJSON=function(){return{header:this.header.toObject(),numTransactions:this.numTransactions,hashes:this.hashes,flags:this.flags}},l.prototype.validMerkleTree=function(){if(f.checkState(n.isArray(this.flags),"MerkleBlock flags is not an array"),f.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 e=this._calcTreeHeight(),t={hashesUsed:0,flagBitsUsed:0},r=this._traverseMerkleTree(e,0,t);return t.hashesUsed===this.hashes.length&&o.equals(r,this.header.merkleRoot)},l.prototype._traverseMerkleTree=function(e,r,n){if((n=n||{}).txs=n.txs||[],n.flagBitsUsed=n.flagBitsUsed||0,n.hashesUsed=n.hashesUsed||0,n.flagBitsUsed>8*this.flags.length)return null;var i=this.flags[n.flagBitsUsed>>3]>>>(7&n.flagBitsUsed++)&1;if(0!==e&&i){var o=this._traverseMerkleTree(e-1,2*r,n),s=o;return 2*r+1<this._calcTreeWidth(e-1)&&(s=this._traverseMerkleTree(e-1,2*r+1,n)),u.sha256sha256(new t.concat([o,s]))}if(n.hashesUsed>=this.hashes.length)return null;var a=this.hashes[n.hashesUsed++];return 0===e&&i&&n.txs.push(a),new t(a,"hex")},l.prototype._calcTreeWidth=function(e){return this.numTransactions+(1<<e)-1>>e},l.prototype._calcTreeHeight=function(){for(var e=0;this._calcTreeWidth(e)>1;)e++;return e},l.prototype.hasTransaction=function(e){f.checkArgument(!n.isUndefined(e),"tx cannot be undefined"),f.checkArgument(e instanceof c||"string"==typeof e,'Invalid tx given, tx must be a "string" or "Transaction"');var r=e;e instanceof c&&(r=o.reverse(new t(e.id,"hex")).toString("hex"));var i=[],s=this._calcTreeHeight();return this._traverseMerkleTree(s,0,{txs:i}),-1!==i.indexOf(r)},l._fromBufferReader=function(e){f.checkState(!e.finished(),"No merkleblock data received");var t={};t.header=i.fromBufferReader(e),t.numTransactions=e.readUInt32LE();var r=e.readVarintNum();t.hashes=[];for(var n=0;n<r;n++)t.hashes.push(e.read(32).toString("hex"));var o=e.readVarintNum();for(t.flags=[],n=0;n<o;n++)t.flags.push(e.readUInt8());return t},l.fromObject=function(e){return new l(e)},e.exports=l}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(t){var n=r(17),i=r(0),o=r(18),s=r(21),a=r(32),u=r(177),c=r(129),f=r(43),l=r(96),h=r(253),p=r(108),d=r(176),y=r(179),g=r(66),m=g.HDPrivateKey,b=r(24),v=r(29);function _(e){if(e instanceof _)return e;if(!(this instanceof _))return new _(e);if(!e)return this._generateRandomly();if(l.get(e))return this._generateRandomly(e);if(o.isString(e)||b.isBuffer(e))if(_.isValidSerialized(e))this._buildFromSerialized(e);else if(v.isValidJSON(e))this._buildFromJSON(e);else{if(!b.isBuffer(e)||!_.isValidSerialized(e.toString()))throw _.getSerializedError(e);this._buildFromSerialized(e.toString())}else{if(!o.isObject(e))throw new m.UnrecognizedArgument(e);this._buildFromObject(e)}}_.isValidPath=function(e,t){if(o.isString(e)){var r=_._getDerivationIndexes(e);return null!==r&&o.all(r,_.isValidPath)}return!!o.isNumber(e)&&(e<_.Hardened&&!0===t&&(e+=_.Hardened),e>=0&&e<_.MaxIndex)},_._getDerivationIndexes=function(e){var t=e.split("/");if(o.contains(_.RootElementAlias,e))return[];if(!o.contains(_.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+=_.Hardened),r});return o.any(r,isNaN)?null:r},_.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)},_.prototype._deriveWithNumber=function(e,t){if(!_.isValidPath(e,t))throw new m.InvalidPath(e);t=e>=_.Hardened||t,e<_.Hardened&&!0===t&&(e+=_.Hardened);var r=h.get(this.xprivkey,e,t);if(r)return r;var n,o=b.integerAsBuffer(e);n=t?b.concat([new i.Buffer([0]),this.privateKey.toBuffer(),o]):b.concat([this.publicKey.toBuffer(),o]);var s=f.sha512hmac(n,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 _({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},_.prototype._deriveFromString=function(e){if(!_.isValidPath(e))throw new m.InvalidPath(e);return _._getDerivationIndexes(e).reduce(function(e,t){return e._deriveWithNumber(t)},this)},_.isValidSerialized=function(e,t){return!_.getSerializedError(e,t)},_.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!==_.DataLength)return new m.InvalidLength(e);if(!o.isUndefined(t)){var r=_._validateNetwork(e,t);if(r)return r}return null},_._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},_.fromString=function(e){return s.checkArgument(o.isString(e),"No valid string was provided"),new _(e)},_.fromObject=function(e){return s.checkArgument(o.isObject(e),"No valid argument was provided"),new _(e)},_.prototype._buildFromJSON=function(e){return this._buildFromObject(JSON.parse(e))},_.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)},_.prototype._buildFromSerialized=function(e){var t=c.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),privateKey:t.slice(_.PrivateKeyStart,_.PrivateKeyEnd),checksum:t.slice(_.ChecksumStart,_.ChecksumEnd),xprivkey:e};return this._buildFromBuffers(r)},_.prototype._generateRandomly=function(e){return _.fromSeed(y.getRandomBuffer(64),e)},_.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 _({network:l.get(r)||l.defaultNetwork,depth:0,parentFingerPrint:0,childIndex:0,privateKey:n.slice(0,32),chainCode:n.slice(32,64)})},_.prototype._calcHDPublicKey=function(){if(!this._hdPublicKey){var e=r(437);this._hdPublicKey=new e(this)}},_.prototype._buildFromBuffers=function(e){_._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,s=l.get(b.integerFromBuffer(e.version));o=c.encode(i.Buffer.concat(r)),e.xprivkey=new t(o);var u=new d(a.fromBuffer(e.privateKey),s),h=u.toPublicKey(),p=_.ParentFingerPrintSize,y=f.sha256ripemd160(h.toBuffer()).slice(0,p);return v.defineImmutable(this,{xprivkey:o,network:s,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},_._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",_.VersionSize),t("depth",_.DepthSize),t("parentFingerPrint",_.ParentFingerPrintSize),t("childIndex",_.ChildIndexSize),t("chainCode",_.ChainCodeSize),t("privateKey",_.PrivateKeySize),e.checksum&&e.checksum.length&&t("checksum",_.CheckSumSize)},_.prototype.toString=function(){return this.xprivkey},_.prototype.inspect=function(){return"<HDPrivateKey: "+this.xprivkey+">"},_.prototype.toObject=_.prototype.toJSON=function(){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}},_.fromBuffer=function(e){return new _(e.toString())},_.prototype.toBuffer=function(){return b.copy(this._buffers.xprivkey)},_.DefaultDepth=0,_.DefaultFingerprint=0,_.DefaultChildIndex=0,_.Hardened=2147483648,_.MaxIndex=2*_.Hardened,_.RootElementAlias=["m","M","m'","M'"],_.VersionSize=4,_.DepthSize=1,_.ParentFingerPrintSize=4,_.ChildIndexSize=4,_.ChainCodeSize=32,_.PrivateKeySize=32,_.CheckSumSize=4,_.DataLength=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,_.PrivateKeyStart=_.ChainCodeEnd+1,_.PrivateKeyEnd=_.PrivateKeyStart+_.PrivateKeySize,_.ChecksumStart=_.PrivateKeyEnd,_.ChecksumEnd=_.ChecksumStart+_.CheckSumSize,n(_.ChecksumEnd===_.SerializedByteSize),e.exports=_}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(t){var n=r(18),i=r(21),o=r(32),s=r(177),a=r(129),u=r(43),c=r(436),f=r(253),l=r(96),h=r(108),p=r(73),d=r(66),y=d,g=d.HDPublicKey,m=r(17),b=r(29),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);return c._getDerivationIndexes(e).reduce(function(e,t){return e._deriveWithNumber(t)},this)},_.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,s=l.get(v.integerFromBuffer(e.version));o=a.encode(v.concat(r)),e.xpubkey=new t(o);var c=new p(e.publicKey,{network:s}),f=_.ParentFingerPrintSize,h=u.sha256ripemd160(c.toBuffer()).slice(0,f);return b.defineImmutable(this,{xpubkey:o,network:s,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(){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(254),i=r(255)(),o=r(903),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(907),CBC:r(908),CFB:r(909),CFB8:r(910),CFB1:r(911),OFB:r(912),CTR:r(440),GCM:r(440)},i=r(442);for(var o in i)i[o].module=n[i[o].mode];e.exports=i},function(e,t,r){var n=r(132),i=r(2).Buffer,o=r(441);function s(e){var t=e._cipher.encryptBlockRaw(e._prev);return o(e._prev),t}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){e.exports=function(e){for(var t,r=e.length;r--;){if(255!==(t=e.readUInt8(r))){t++,e.writeUInt8(t,r);break}e.writeUInt8(0,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(92),s=r(5),a=r(913),u=r(132),c=r(441);function f(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 l(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=f(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(l,o),l.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},l.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&&function(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}(e,this._authTag))throw new Error("Unsupported state or unable to authenticate data");this._authTag=e,this._cipher.scrub()},l.prototype.getAuthTag=function(){if(this._decrypt||!i.isBuffer(this._authTag))throw new Error("Attempting to get auth tag in unsupported state");return this._authTag},l.prototype.setAuthTag=function(e){if(!this._decrypt)throw new Error("Attempting to set auth tag in unsupported state");this._authTag=e},l.prototype.setAAD=function(e){if(this._called)throw new Error("Attempting to set AAD in unsupported state");this._ghash.update(e),this._alen+=e.length},e.exports=l},function(e,t,r){var n=r(181),i=r(2).Buffer,o=r(92);function s(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}r(5)(s,o),s.prototype._update=function(e){return this._mode.encrypt(this,e,this._decrypt)},s.prototype._final=function(){this._cipher.scrub()},e.exports=s},function(e,t,r){var n=r(2).Buffer,i=r(237);e.exports=function(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}}},function(e,t,r){var n=r(13);r(19),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(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(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(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(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(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(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(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(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(i=0;i<this._ints;++i)this._partialOutput.putInt32(e.getInt32()^this._outBlock[i]);if(o>0)e.read-=this.blockSize;else for(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(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,r=n.util.createBuffer(e.iv);if(this._cipherLength=0,t="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=r.length();if(12===i)this._j0=[r.getInt32(),r.getInt32(),r.getInt32(),1];else{for(this._j0=[0,0,0,0];r.length()>0;)this._j0=this.ghash(this._hashSubkey,this._j0,[r.getInt32(),r.getInt32(),r.getInt32(),r.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,t=n.util.createBuffer(t),this._aDataLength=a(8*t.length());var o=t.length()%this.blockSize;for(o&&t.fillWithByte(0,this.blockSize-o),this._s=[0,0,0,0];t.length()>0;)this._s=this.ghash(this._hashSubkey,this._s,[t.getInt32(),t.getInt32(),t.getInt32(),t.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(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(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){e[i/32|0]&1<<31-i%32&&(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=e[r/8|0]>>>4*(7-r%8)&15,i=this._m[r][n];t[0]^=i[0],t[1]^=i[1],t[2]^=i[2],t[3]^=i[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=(n-1-s%n)*t;a[s/n|0]=1<<t-1<<u,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(13);r(76),r(133),r(258),r(112),r(448),r(69),r(134),r(19);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(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){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},s=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},a=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))},u=function(e,t,r){e.putInt(r.length(),t<<3),e.putBuffer(r)},c={Versions:{TLS_1_0:{major:3,minor:1},TLS_1_1:{major:3,minor:2},TLS_1_2:{major:3,minor:3}}};c.SupportedVersions=[c.Versions.TLS_1_1,c.Versions.TLS_1_0],c.Version=c.SupportedVersions[0],c.MaxFragment=15360,c.ConnectionEnd={server:0,client:1},c.PRFAlgorithm={tls_prf_sha256:0},c.BulkCipherAlgorithm={none:null,rc4:0,des3:1,aes:2},c.CipherType={stream:0,block:1,aead:2},c.MACAlgorithm={none:null,hmac_md5:0,hmac_sha1:1,hmac_sha256:2,hmac_sha384:3,hmac_sha512:4},c.CompressionMethod={none:0,deflate:1},c.ContentType={change_cipher_spec:20,alert:21,handshake:22,application_data:23,heartbeat:24},c.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},c.Alert={},c.Alert.Level={warning:1,fatal:2},c.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},c.HeartbeatMessageType={heartbeat_request:1,heartbeat_response:2},c.CipherSuites={},c.getCipherSuite=function(e){var t=null;for(var r in c.CipherSuites){var n=c.CipherSuites[r];if(n.id[0]===e.charCodeAt(0)&&n.id[1]===e.charCodeAt(1)){t=n;break}}return t},c.handleUnexpected=function(e,t){!e.open&&e.entity===c.ConnectionEnd.client||e.error(e,{message:"Unexpected message. Received TLS record out of order.",send:!0,alert:{level:c.Alert.Level.fatal,description:c.Alert.Description.unexpected_message}})},c.handleHelloRequest=function(e,t,r){!e.handshaking&&e.handshakes>0&&(c.queue(e,c.createAlert(e,{level:c.Alert.Level.warning,description:c.Alert.Description.no_renegotiation})),c.flush(e)),e.process()},c.parseHelloMessage=function(e,t,r){var i=null,o=e.entity===c.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:c.Alert.Level.fatal,description:c.Alert.Description.illegal_parameter}});else{var s=t.fragment,u=s.length();if(i={version:{major:s.getByte(),minor:s.getByte()},random:n.util.createBuffer(s.getBytes(32)),session_id:a(s,1),extensions:[]},o?(i.cipher_suite=s.getBytes(2),i.compression_method=s.getByte()):(i.cipher_suites=a(s,2),i.compression_methods=a(s,1)),(u=r-(u-s.length()))>0){for(var f=a(s,2);f.length()>0;)i.extensions.push({type:[f.getByte(),f.getByte()],data:a(f,2)});if(!o)for(var l=0;l<i.extensions.length;++l){var h=i.extensions[l];if(0===h.type[0]&&0===h.type[1])for(var p=a(h.data,2);p.length()>0;){if(0!==p.getByte())break;e.session.extensions.server_name.serverNameList.push(a(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:c.Alert.Level.fatal,description:c.Alert.Description.protocol_version}});if(o)e.session.cipherSuite=c.getCipherSuite(i.cipher_suite);else for(var d=n.util.createBuffer(i.cipher_suites.bytes());d.length()>0&&(e.session.cipherSuite=c.getCipherSuite(d.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:c.Alert.Level.fatal,description:c.Alert.Description.handshake_failure},cipherSuite:n.util.bytesToHex(i.cipher_suite)});e.session.compressionMethod=o?i.compression_method:c.CompressionMethod.none}return i},c.createSecurityParameters=function(e,t){var r=e.entity===c.ConnectionEnd.client,n=t.random.bytes(),i=r?e.session.sp.client_random:n,o=r?n:c.createRandom().getBytes();e.session.sp={entity:e.entity,prf_algorithm:c.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}},c.handleServerHello=function(e,t,r){var n=c.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:c.Alert.Level.fatal,description:c.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=d,e.session.resuming=!0,e.session.sp.server_random=n.random.bytes()):(e.expect=f,e.session.resuming=!1,c.createSecurityParameters(e,n)),e.session.id=i,e.process()}},c.handleClientHello=function(e,t,r){var i=c.parseHelloMessage(e,t,r);if(!e.fail){var o=i.session_id.bytes(),s=null;if(e.sessionCache&&(null===(s=e.sessionCache.getSession(o))?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<c.SupportedVersions.length&&!((a=c.SupportedVersions[u]).minor<=i.version.minor);++u);e.version={major:a.major,minor:a.minor},e.session.version=e.version}null!==s?(e.expect=w,e.session.resuming=!0,e.session.sp.client_random=i.random.bytes()):(e.expect=!1!==e.verifyClient?b:v,e.session.resuming=!1,c.createSecurityParameters(e,i)),e.open=!0,c.queue(e,c.createRecord(e,{type:c.ContentType.handshake,data:c.createServerHello(e)})),e.session.resuming?(c.queue(e,c.createRecord(e,{type:c.ContentType.change_cipher_spec,data:c.createChangeCipherSpec()})),e.state.pending=c.createConnectionState(e),e.state.current.write=e.state.pending.write,c.queue(e,c.createRecord(e,{type:c.ContentType.handshake,data:c.createFinished(e)}))):(c.queue(e,c.createRecord(e,{type:c.ContentType.handshake,data:c.createCertificate(e)})),e.fail||(c.queue(e,c.createRecord(e,{type:c.ContentType.handshake,data:c.createServerKeyExchange(e)})),!1!==e.verifyClient&&c.queue(e,c.createRecord(e,{type:c.ContentType.handshake,data:c.createCertificateRequest(e)})),c.queue(e,c.createRecord(e,{type:c.ContentType.handshake,data:c.createServerHelloDone(e)})))),c.flush(e),e.process()}},c.handleCertificate=function(e,t,r){if(r<3)return e.error(e,{message:"Invalid Certificate message. Message too short.",send:!0,alert:{level:c.Alert.Level.fatal,description:c.Alert.Description.illegal_parameter}});var i,o,s=t.fragment,u={certificate_list:a(s,3)},f=[];try{for(;u.certificate_list.length()>0;)i=a(u.certificate_list,3),o=n.asn1.fromDer(i),i=n.pki.certificateFromAsn1(o,!0),f.push(i)}catch(t){return e.error(e,{message:"Could not parse certificate list.",cause:t,send:!0,alert:{level:c.Alert.Level.fatal,description:c.Alert.Description.bad_certificate}})}var h=e.entity===c.ConnectionEnd.client;!h&&!0!==e.verifyClient||0!==f.length?0===f.length?e.expect=h?l:v:(h?e.session.serverCertificate=f[0]:e.session.clientCertificate=f[0],c.verifyCertificateChain(e,f)&&(e.expect=h?l:v)):e.error(e,{message:h?"No server certificate provided.":"No client certificate provided.",send:!0,alert:{level:c.Alert.Level.fatal,description:c.Alert.Description.illegal_parameter}}),e.process()},c.handleServerKeyExchange=function(e,t,r){if(r>0)return e.error(e,{message:"Invalid key parameters. Only RSA is supported.",send:!0,alert:{level:c.Alert.Level.fatal,description:c.Alert.Description.unsupported_certificate}});e.expect=h,e.process()},c.handleClientKeyExchange=function(e,t,r){if(r<48)return e.error(e,{message:"Invalid key parameters. Only RSA is supported.",send:!0,alert:{level:c.Alert.Level.fatal,description:c.Alert.Description.unsupported_certificate}});var i=t.fragment,o={enc_pre_master_secret:a(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:c.Alert.Level.fatal,description:c.Alert.Description.internal_error}})}if(null===s)return e.error(e,{message:"No private key set.",send:!0,alert:{level:c.Alert.Level.fatal,description:c.Alert.Description.internal_error}});try{var u=e.session.sp;u.pre_master_secret=s.decrypt(o.enc_pre_master_secret);var f=e.session.clientHelloVersion;if(f.major!==u.pre_master_secret.charCodeAt(0)||f.minor!==u.pre_master_secret.charCodeAt(1))throw new Error("TLS version rollback attack detected.")}catch(e){u.pre_master_secret=n.random.getBytes(48)}e.expect=w,null!==e.session.clientCertificate&&(e.expect=_),e.process()},c.handleCertificateRequest=function(e,t,r){if(r<3)return e.error(e,{message:"Invalid CertificateRequest. Message too short.",send:!0,alert:{level:c.Alert.Level.fatal,description:c.Alert.Description.illegal_parameter}});var n=t.fragment,i={certificate_types:a(n,1),certificate_authorities:a(n,2)};e.session.certificateRequest=i,e.expect=p,e.process()},c.handleCertificateVerify=function(e,t,r){if(r<2)return e.error(e,{message:"Invalid CertificateVerify. Message too short.",send:!0,alert:{level:c.Alert.Level.fatal,description:c.Alert.Description.illegal_parameter}});var i=t.fragment;i.read-=4;var o=i.bytes();i.read+=4;var s={signature:a(i,2).getBytes()},u=n.util.createBuffer();u.putBuffer(e.session.md5.digest()),u.putBuffer(e.session.sha1.digest()),u=u.getBytes();try{if(!e.session.clientCertificate.publicKey.verify(u,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:c.Alert.Level.fatal,description:c.Alert.Description.handshake_failure}})}e.expect=w,e.process()},c.handleServerHelloDone=function(e,t,r){if(r>0)return e.error(e,{message:"Invalid ServerHelloDone message. Invalid length.",send:!0,alert:{level:c.Alert.Level.fatal,description:c.Alert.Description.record_overflow}});if(null===e.serverCertificate){var i={message:"No server certificate provided. Not enough security.",send:!0,alert:{level:c.Alert.Level.fatal,description:c.Alert.Description.insufficient_security}},o=e.verify(e,i.alert.description,0,[]);if(!0!==o)return(o||0===o)&&("object"!=typeof o||n.util.isArray(o)?"number"==typeof o&&(i.alert.description=o):(o.message&&(i.message=o.message),o.alert&&(i.alert.description=o.alert))),e.error(e,i)}null!==e.session.certificateRequest&&(t=c.createRecord(e,{type:c.ContentType.handshake,data:c.createCertificate(e)}),c.queue(e,t)),t=c.createRecord(e,{type:c.ContentType.handshake,data:c.createClientKeyExchange(e)}),c.queue(e,t),e.expect=m;var s=function(e,t){null!==e.session.certificateRequest&&null!==e.session.clientCertificate&&c.queue(e,c.createRecord(e,{type:c.ContentType.handshake,data:c.createCertificateVerify(e,t)})),c.queue(e,c.createRecord(e,{type:c.ContentType.change_cipher_spec,data:c.createChangeCipherSpec()})),e.state.pending=c.createConnectionState(e),e.state.current.write=e.state.pending.write,c.queue(e,c.createRecord(e,{type:c.ContentType.handshake,data:c.createFinished(e)})),e.expect=d,c.flush(e),e.process()};if(null===e.session.certificateRequest||null===e.session.clientCertificate)return s(e,null);c.getClientSignature(e,s)},c.handleChangeCipherSpec=function(e,t){if(1!==t.fragment.getByte())return e.error(e,{message:"Invalid ChangeCipherSpec message received.",send:!0,alert:{level:c.Alert.Level.fatal,description:c.Alert.Description.illegal_parameter}});var r=e.entity===c.ConnectionEnd.client;(e.session.resuming&&r||!e.session.resuming&&!r)&&(e.state.pending=c.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?y:S,e.process()},c.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()).putBuffer(e.session.md5.digest()),o.putBuffer(e.session.sha1.digest());var u=e.entity===c.ConnectionEnd.client,f=u?"server finished":"client finished",l=e.session.sp;if((o=i(l.master_secret,f,o.getBytes(),12)).getBytes()!==a)return e.error(e,{message:"Invalid verify_data in Finished message.",send:!0,alert:{level:c.Alert.Level.fatal,description:c.Alert.Description.decrypt_error}});e.session.md5.update(s),e.session.sha1.update(s),(e.session.resuming&&u||!e.session.resuming&&!u)&&(c.queue(e,c.createRecord(e,{type:c.ContentType.change_cipher_spec,data:c.createChangeCipherSpec()})),e.state.current.write=e.state.pending.write,e.state.pending=null,c.queue(e,c.createRecord(e,{type:c.ContentType.handshake,data:c.createFinished(e)}))),e.expect=u?g:k,e.handshaking=!1,++e.handshakes,e.peerCertificate=u?e.session.serverCertificate:e.session.clientCertificate,c.flush(e),e.isConnected=!0,e.connected(e),e.process()},c.handleAlert=function(e,t){var r,n=t.fragment,i={level:n.getByte(),description:n.getByte()};switch(i.description){case c.Alert.Description.close_notify:r="Connection closed.";break;case c.Alert.Description.unexpected_message:r="Unexpected message.";break;case c.Alert.Description.bad_record_mac:r="Bad record MAC.";break;case c.Alert.Description.decryption_failed:r="Decryption failed.";break;case c.Alert.Description.record_overflow:r="Record overflow.";break;case c.Alert.Description.decompression_failure:r="Decompression failed.";break;case c.Alert.Description.handshake_failure:r="Handshake failure.";break;case c.Alert.Description.bad_certificate:r="Bad certificate.";break;case c.Alert.Description.unsupported_certificate:r="Unsupported certificate.";break;case c.Alert.Description.certificate_revoked:r="Certificate revoked.";break;case c.Alert.Description.certificate_expired:r="Certificate expired.";break;case c.Alert.Description.certificate_unknown:r="Certificate unknown.";break;case c.Alert.Description.illegal_parameter:r="Illegal parameter.";break;case c.Alert.Description.unknown_ca:r="Unknown certificate authority.";break;case c.Alert.Description.access_denied:r="Access denied.";break;case c.Alert.Description.decode_error:r="Decode error.";break;case c.Alert.Description.decrypt_error:r="Decrypt error.";break;case c.Alert.Description.export_restriction:r="Export restriction.";break;case c.Alert.Description.protocol_version:r="Unsupported protocol version.";break;case c.Alert.Description.insufficient_security:r="Insufficient security.";break;case c.Alert.Description.internal_error:r="Internal error.";break;case c.Alert.Description.user_canceled:r="User canceled.";break;case c.Alert.Description.no_renegotiation:r="Renegotiation not supported.";break;default:r="Unknown error."}if(i.description===c.Alert.Description.close_notify)return e.close();e.error(e,{message:r,send:!1,origin:e.entity===c.ConnectionEnd.client?"server":"client",alert:i}),e.process()},c.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 M[e.entity][e.expect]?(e.entity!==c.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!==c.HandshakeType.hello_request&&i!==c.HandshakeType.certificate_verify&&i!==c.HandshakeType.finished&&(e.session.md5.update(s),e.session.sha1.update(s)),M[e.entity][e.expect][i](e,t,o)):c.handleUnexpected(e,t)},c.handleApplicationData=function(e,t){e.data.putBuffer(t.fragment),e.dataReady(e),e.process()},c.handleHeartbeat=function(e,t){var r=t.fragment,i=r.getByte(),o=r.getInt16(),s=r.getBytes(o);if(i===c.HeartbeatMessageType.heartbeat_request){if(e.handshaking||o>s.length)return e.process();c.queue(e,c.createRecord(e,{type:c.ContentType.heartbeat,data:c.createHeartbeat(c.HeartbeatMessageType.heartbeat_response,s)})),c.flush(e)}else if(i===c.HeartbeatMessageType.heartbeat_response){if(s!==e.expectedHeartbeatPayload)return e.process();e.heartbeatReceived&&e.heartbeatReceived(e,n.util.createBuffer(s))}e.process()};var f=1,l=2,h=3,p=4,d=5,y=6,g=7,m=8,b=1,v=2,_=3,w=4,S=5,k=6,E=c.handleUnexpected,A=c.handleChangeCipherSpec,x=c.handleAlert,I=c.handleHandshake,T=c.handleApplicationData,B=c.handleHeartbeat,C=[];C[c.ConnectionEnd.client]=[[E,x,I,E,B],[E,x,I,E,B],[E,x,I,E,B],[E,x,I,E,B],[E,x,I,E,B],[A,x,E,E,B],[E,x,I,E,B],[E,x,I,T,B],[E,x,I,E,B]],C[c.ConnectionEnd.server]=[[E,x,I,E,B],[E,x,I,E,B],[E,x,I,E,B],[E,x,I,E,B],[A,x,E,E,B],[E,x,I,E,B],[E,x,I,T,B],[E,x,I,E,B]];var P=c.handleHelloRequest,O=c.handleServerHello,R=c.handleCertificate,N=c.handleServerKeyExchange,L=c.handleCertificateRequest,K=c.handleServerHelloDone,j=c.handleFinished,M=[];M[c.ConnectionEnd.client]=[[E,E,O,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E],[P,E,E,E,E,E,E,E,E,E,E,R,N,L,K,E,E,E,E,E,E],[P,E,E,E,E,E,E,E,E,E,E,E,N,L,K,E,E,E,E,E,E],[P,E,E,E,E,E,E,E,E,E,E,E,E,L,K,E,E,E,E,E,E],[P,E,E,E,E,E,E,E,E,E,E,E,E,E,K,E,E,E,E,E,E],[P,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E],[P,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E,j],[P,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E],[P,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E]];var D=c.handleClientHello,U=c.handleClientKeyExchange,F=c.handleCertificateVerify;M[c.ConnectionEnd.server]=[[E,D,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E],[E,E,E,E,E,E,E,E,E,E,E,R,E,E,E,E,E,E,E,E,E],[E,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E,U,E,E,E,E],[E,E,E,E,E,E,E,E,E,E,E,E,E,E,E,F,E,E,E,E,E],[E,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E],[E,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E,j],[E,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E],[E,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E]],c.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===c.Versions.TLS_1_0.major&&e.version.minor===c.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},c.createConnectionState=function(e){var t=e.entity===c.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:c.Alert.Level.fatal,description:c.Alert.Description.decompression_failure}}):e.error(e,{message:"Could not decrypt record or bad MAC.",send:!0,alert:{level:c.Alert.Level.fatal,description:c.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:c.Alert.Level.fatal,description:c.Alert.Description.internal_error}}):e.error(e,{message:"Could not compress record.",send:!1,alert:{level:c.Alert.Level.fatal,description:c.Alert.Description.internal_error}}),!e.fail},e.session){var i=e.session.sp;switch(e.session.cipherSuite.initSecurityParameters(i),i.keys=c.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 c.CompressionMethod.none:break;case c.CompressionMethod.deflate:n.read.compressFunction=s,n.write.compressFunction=o;break;default:throw new Error("Unsupported compression algorithm.")}}return n},c.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},c.createRecord=function(e,t){return t.data?{type:t.type,version:{major:e.version.major,minor:e.version.minor},length:t.data.length(),fragment:t.data}:null},c.createAlert=function(e,t){var r=n.util.createBuffer();return r.putByte(t.level),r.putByte(t.description),c.createRecord(e,{type:c.ContentType.alert,data:r})},c.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(c.CompressionMethod.none);var a=s.length(),f=n.util.createBuffer();if(e.virtualHost){var l=n.util.createBuffer();l.putByte(0),l.putByte(0);var h=n.util.createBuffer();h.putByte(0),u(h,2,n.util.createBuffer(e.virtualHost));var p=n.util.createBuffer();u(p,2,h),u(l,2,p),f.putBuffer(l)}var d=f.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(c.HandshakeType.client_hello),m.putInt24(g),m.putByte(e.version.major),m.putByte(e.version.minor),m.putBytes(e.session.sp.client_random),u(m,1,n.util.createBuffer(y)),u(m,2,t),u(m,1,s),d>0&&u(m,2,f),m},c.createServerHello=function(e){var t=e.session.id,r=t.length+1+2+4+28+2+1,i=n.util.createBuffer();return i.putByte(c.HandshakeType.server_hello),i.putInt24(r),i.putByte(e.version.major),i.putByte(e.version.minor),i.putBytes(e.session.sp.server_random),u(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},c.createCertificate=function(e){var t,r=e.entity===c.ConnectionEnd.client,i=null;e.getCertificate&&(t=r?e.session.certificateRequest:e.session.extensions.server_name.serverNameList,i=e.getCertificate(e,t));var o=n.util.createBuffer();if(null!==i)try{n.util.isArray(i)||(i=[i]);for(var s=null,a=0;a<i.length;++a){var f=n.pem.decode(i[a])[0];if("CERTIFICATE"!==f.type&&"X509 CERTIFICATE"!==f.type&&"TRUSTED CERTIFICATE"!==f.type){var l=new Error('Could not convert certificate from PEM; PEM header type is not "CERTIFICATE", "X509 CERTIFICATE", or "TRUSTED CERTIFICATE".');throw l.headerType=f.type,l}if(f.procType&&"ENCRYPTED"===f.procType.type)throw new Error("Could not convert certificate from PEM; PEM is encrypted.");var h=n.util.createBuffer(f.body);null===s&&(s=n.asn1.fromDer(h.bytes(),!1));var p=n.util.createBuffer();u(p,3,h),o.putBuffer(p)}i=n.pki.certificateFromAsn1(s),r?e.session.clientCertificate=i:e.session.serverCertificate=i}catch(r){return e.error(e,{message:"Could not send certificate list.",cause:r,send:!0,alert:{level:c.Alert.Level.fatal,description:c.Alert.Description.bad_certificate}})}var d=3+o.length(),y=n.util.createBuffer();return y.putByte(c.HandshakeType.certificate),y.putInt24(d),u(y,3,o),y},c.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=(t=e.session.serverCertificate.publicKey.encrypt(r.pre_master_secret)).length+2,o=n.util.createBuffer();return o.putByte(c.HandshakeType.client_key_exchange),o.putInt24(i),o.putInt16(t.length),o.putBytes(t),o},c.createServerKeyExchange=function(e){return n.util.createBuffer()},c.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:c.Alert.Level.fatal,description:c.Alert.Description.internal_error}})}null===i?e.error(e,{message:"No private key set.",send:!0,alert:{level:c.Alert.Level.fatal,description:c.Alert.Description.internal_error}}):t=i.sign(t,null),r(e,t)},e.getSignature(e,r,t)},c.createCertificateVerify=function(e,t){var r=t.length+2,i=n.util.createBuffer();return i.putByte(c.HandshakeType.certificate_verify),i.putInt24(r),i.putInt16(t.length),i.putBytes(t),i},c.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 f=1+t.length()+2+r.length(),l=n.util.createBuffer();return l.putByte(c.HandshakeType.certificate_request),l.putInt24(f),u(l,1,t),u(l,2,r),l},c.createServerHelloDone=function(e){var t=n.util.createBuffer();return t.putByte(c.HandshakeType.server_hello_done),t.putInt24(0),t},c.createChangeCipherSpec=function(){var e=n.util.createBuffer();return e.putByte(1),e},c.createFinished=function(e){var t=n.util.createBuffer();t.putBuffer(e.session.md5.digest()),t.putBuffer(e.session.sha1.digest());var r=e.entity===c.ConnectionEnd.client,o=e.session.sp,s=r?"client finished":"server finished";t=i(o.master_secret,s,t.getBytes(),12);var a=n.util.createBuffer();return a.putByte(c.HandshakeType.finished),a.putInt24(t.length()),a.putBuffer(t),a},c.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},c.queue=function(e,t){if(t&&(0!==t.fragment.length()||t.type!==c.ContentType.handshake&&t.type!==c.ContentType.alert&&t.type!==c.ContentType.change_cipher_spec)){if(t.type===c.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()<=c.MaxFragment)i=[t];else{i=[];for(var o=t.fragment.bytes();o.length>c.MaxFragment;)i.push(c.createRecord(e,{type:t.type,data:n.util.createBuffer(o.slice(0,c.MaxFragment))})),o=o.slice(c.MaxFragment);o.length>0&&i.push(c.createRecord(e,{type:t.type,data:n.util.createBuffer(o)}))}for(var s=0;s<i.length&&!e.fail;++s){var a=i[s];e.state.current.write.update(e,a)&&e.records.push(a)}}},c.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 q=function(e){switch(e){case!0:return!0;case n.pki.certificateError.bad_certificate:return c.Alert.Description.bad_certificate;case n.pki.certificateError.unsupported_certificate:return c.Alert.Description.unsupported_certificate;case n.pki.certificateError.certificate_revoked:return c.Alert.Description.certificate_revoked;case n.pki.certificateError.certificate_expired:return c.Alert.Description.certificate_expired;case n.pki.certificateError.certificate_unknown:return c.Alert.Description.certificate_unknown;case n.pki.certificateError.unknown_ca:return c.Alert.Description.unknown_ca;default:return c.Alert.Description.bad_certificate}};for(var H in c.verifyCertificateChain=function(e,t){try{n.pki.verifyCertificateChain(e.caStore,t,function(t,r,i){q(t);var o=e.verify(e,t,r,i);if(!0!==o){if("object"==typeof o&&!n.util.isArray(o)){var s=new Error("The application rejected the certificate.");throw s.send=!0,s.alert={level:c.Alert.Level.fatal,description:c.Alert.Description.bad_certificate},o.message&&(s.message=o.message),o.alert&&(s.alert.description=o.alert),s}o!==t&&(o=function(e){switch(e){case!0:return!0;case c.Alert.Description.bad_certificate:return n.pki.certificateError.bad_certificate;case c.Alert.Description.unsupported_certificate:return n.pki.certificateError.unsupported_certificate;case c.Alert.Description.certificate_revoked:return n.pki.certificateError.certificate_revoked;case c.Alert.Description.certificate_expired:return n.pki.certificateError.certificate_expired;case c.Alert.Description.certificate_unknown:return n.pki.certificateError.certificate_unknown;case c.Alert.Description.unknown_ca:return n.pki.certificateError.unknown_ca;default:return n.pki.certificateError.bad_certificate}}(o))}return o})}catch(t){var r=t;("object"!=typeof r||n.util.isArray(r))&&(r={send:!0,alert:{level:c.Alert.Level.fatal,description:q(t)}}),"send"in r||(r.send=!0),"alert"in r||(r.alert={level:c.Alert.Level.fatal,description:q(r.error)}),e.error(e,r)}return!e.fail},c.createSessionCache=function(e,t){var r=null;if(e&&e.getSession&&e.setSession&&e.order)r=e;else{for(var i in(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]}i=n.util.bytesToHex(e);r.order.push(i),r.cache[i]=t}}return r},c.createConnection=function(e){var t;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=[],c.CipherSuites)r.push(c.CipherSuites[i]);var o=e.server?c.ConnectionEnd.server:c.ConnectionEnd.client,s=e.sessionCache?c.createSessionCache(e.sessionCache):null,a={version:{major:c.Version.major,minor:c.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===c.ConnectionEnd.client?"client":"server"),r.send&&(c.queue(t,c.createAlert(t,r.alert)),c.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:c.Version.major,minor:c.Version.minor},a.record=null,a.session=null,a.peerCertificate=null,a.state={pending:null,current:null},a.expect=(a.entity,c.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=c.createConnectionState(a)}};a.reset();return a.handshake=function(e){if(a.entity!==c.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;var t=null;(e=e||"").length>0&&(a.sessionCache&&(t=a.sessionCache.getSession(e)),null===t&&(e="")),0===e.length&&a.sessionCache&&null!==(t=a.sessionCache.getSession())&&(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=c.createRandom().getBytes(),a.open=!0,c.queue(a,c.createRecord(a,{type:c.ContentType.handshake,data:c.createClientHello(a)})),c.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=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:c.Alert.Level.fatal,description:c.Alert.Description.protocol_version}})}return t}(a)),a.fail||null===a.record||a.record.ready||(t=function(e){var t=0,r=e.input,n=r.length();return n<e.record.length?t=e.record.length-n:(e.record.fragment.putBytes(r.getBytes(e.record.length)),r.compact(),e.state.current.read.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:c.Alert.Level.fatal,description:c.Alert.Description.unexpected_message}})),e.record.ready=!0)),t}(a)),!a.fail&&null!==a.record&&a.record.ready&&function(e,t){var r=t.type-c.ContentType.change_cipher_spec,n=C[e.entity][e.expect];r in n?n[r](e,t):c.handleUnexpected(e,t)}(a,a.record)),t},a.prepare=function(e){return c.queue(a,c.createRecord(a,{type:c.ContentType.application_data,data:n.util.createBuffer(e)})),c.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,c.queue(a,c.createRecord(a,{type:c.ContentType.heartbeat,data:c.createHeartbeat(c.HeartbeatMessageType.heartbeat_request,e,t)})),c.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,c.queue(a,c.createAlert(a,{level:c.Alert.Level.warning,description:c.Alert.Description.close_notify})),c.flush(a)),a.closed(a)),a.reset(e)},a},e.exports=n.tls=n.tls||{},c)"function"!=typeof c[H]&&(n.tls[H]=c[H]);n.tls.prf_tls1=i,n.tls.hmac_sha1=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()},n.tls.createSessionCache=c.createSessionCache,n.tls.createConnection=c.createConnection},function(e,t,r){var n=r(13);r(76),r(99),r(449),r(112),r(259),r(456),r(261),r(183),r(19),r(260);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(13);if(r(98),r(76),r(182),r(77),r(99),r(259),r(112),r(69),r(453),r(183),r(19),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)])){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()}s.encryptPrivateKeyInfo=function(e,t,r){(r=r||{}).saltSize=r.saltSize||8,r.count=r.count||2048,r.algorithm=r.algorithm||"aes128",r.prfAlgorithm=r.prfAlgorithm||"sha1";var i,u,c,f=n.random.getBytesSync(r.saltSize),l=r.count,h=o.integerToDer(l);if(0===r.algorithm.indexOf("aes")||"des"===r.algorithm){var d,y,g;switch(r.algorithm){case"aes128":i=16,d=16,y=a["aes128-CBC"],g=n.aes.createEncryptionCipher;break;case"aes192":i=24,d=16,y=a["aes192-CBC"],g=n.aes.createEncryptionCipher;break;case"aes256":i=32,d=16,y=a["aes256-CBC"],g=n.aes.createEncryptionCipher;break;case"des":i=8,d=8,y=a.desCBC,g=n.des.createEncryptionCipher;break;default:throw(S=new Error("Cannot encrypt private key. Unknown encryption algorithm.")).algorithm=r.algorithm,S}var m="hmacWith"+r.prfAlgorithm.toUpperCase(),b=p(m),v=n.pkcs5.pbkdf2(t,f,l,i,b),_=n.random.getBytesSync(d);(k=g(v)).start(_),k.update(o.toDer(e)),k.finish(),c=k.output.getBytes();var w=function(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}(f,h,i,m);u=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()),w]),o.create(o.Class.UNIVERSAL,o.Type.SEQUENCE,!0,[o.create(o.Class.UNIVERSAL,o.Type.OID,!1,o.oidToDer(y).getBytes()),o.create(o.Class.UNIVERSAL,o.Type.OCTETSTRING,!1,_)])])])}else{var S;if("3des"!==r.algorithm)throw(S=new Error("Cannot encrypt private key. Unknown encryption algorithm.")).algorithm=r.algorithm,S;i=24;var k,E=new n.util.ByteBuffer(f);v=s.pbe.generatePkcs12Key(t,E,1,l,i),_=s.pbe.generatePkcs12Key(t,E,2,l,i);(k=n.des.createEncryptionCipher(v)).start(_),k.update(o.toDer(e)),k.finish(),c=k.output.getBytes(),u=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,f),o.create(o.Class.UNIVERSAL,o.Type.INTEGER,!1,h.getBytes())])])}return o.create(o.Class.UNIVERSAL,o.Type.SEQUENCE,!0,[u,o.create(o.Class.UNIVERSAL,o.Type.OCTETSTRING,!1,c)])},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||{}).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=f(n.pbe.opensslDeriveBytes(t,u.substr(0,8),c));h.start(u),h.update(o.toDer(s.privateKeyToAsn1(e))),h.finish();var p={type:"RSA PRIVATE KEY",procType:{version:"4",type:"ENCRYPTED"},dekInfo:{algorithm:a,parameters:n.util.bytesToHex(u).toUpperCase()},body:h.output.getBytes()};return n.pem.encode(p)},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)throw(c=new Error('Could not convert private key from PEM; PEM header type is not "ENCRYPTED PRIVATE KEY", "PRIVATE KEY", or "RSA PRIVATE KEY".')).headerType=c,c;if(i.procType&&"ENCRYPTED"===i.procType.type){var a,u;switch(i.dekInfo.algorithm){case"DES-CBC":a=8,u=n.des.createDecryptionCipher;break;case"DES-EDE3-CBC":a=24,u=n.des.createDecryptionCipher;break;case"AES-128-CBC":a=16,u=n.aes.createDecryptionCipher;break;case"AES-192-CBC":a=24,u=n.aes.createDecryptionCipher;break;case"AES-256-CBC":a=32,u=n.aes.createDecryptionCipher;break;case"RC2-40-CBC":a=5,u=function(e){return n.rc2.createDecryptionCipher(e,40)};break;case"RC2-64-CBC":a=8,u=function(e){return n.rc2.createDecryptionCipher(e,64)};break;case"RC2-128-CBC":a=16,u=function(e){return n.rc2.createDecryptionCipher(e,128)};break;default:var c;throw(c=new Error('Could not decrypt private key; unsupported encryption algorithm "'+i.dekInfo.algorithm+'".')).algorithm=i.dekInfo.algorithm,c}var f=n.util.hexToBytes(i.dekInfo.parameters),l=u(n.pbe.opensslDeriveBytes(t,f.substr(0,8),a));if(l.start(f),l.update(n.util.createBuffer(i.body)),!l.finish())return r;r=l.output.getBytes()}else r=i.body;return null!==(r="ENCRYPTED PRIVATE KEY"===i.type?s.decryptPrivateKeyInfo(o.fromDer(r),t):o.fromDer(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={},u=[];if(!o.validate(t,c,a,u))throw(i=new Error("Cannot read password-based-encryption algorithm parameters. ASN.1 object is not a supported EncryptedPrivateKeyInfo.")).errors=u,i;if((e=o.derToOid(a.kdfOid))!==s.oids.pkcs5PBKDF2)throw(i=new Error("Cannot read encrypted private key. Unsupported key derivation function OID.")).oid=e,i.supportedOids=["pkcs5PBKDF2"],i;if((e=o.derToOid(a.encOid))!==s.oids["aes128-CBC"]&&e!==s.oids["aes192-CBC"]&&e!==s.oids["aes256-CBC"]&&e!==s.oids["des-EDE3-CBC"]&&e!==s.oids.desCBC)throw(i=new Error("Cannot read encrypted private key. Unsupported encryption scheme OID.")).oid=e,i.supportedOids=["aes128-CBC","aes192-CBC","aes256-CBC","des-EDE3-CBC","desCBC"],i;var f,l,p=a.kdfSalt,d=n.util.createBuffer(a.kdfIterationCount);switch(d=d.getInt(d.length()<<3),s.oids[e]){case"aes128-CBC":f=16,l=n.aes.createDecryptionCipher;break;case"aes192-CBC":f=24,l=n.aes.createDecryptionCipher;break;case"aes256-CBC":f=32,l=n.aes.createDecryptionCipher;break;case"des-EDE3-CBC":f=24,l=n.des.createDecryptionCipher;break;case"desCBC":f=8,l=n.des.createDecryptionCipher}var y=h(a.prfOid),g=n.pkcs5.pbkdf2(r,p,d,f,y),m=a.encIv,b=l(g);return b.start(m),b},s.pbe.getCipherForPKCS12PBE=function(e,t,r){var i={},a=[];if(!o.validate(t,f,i,a))throw(y=new Error("Cannot read password-based-encryption algorithm parameters. ASN.1 object is not a supported EncryptedPrivateKeyInfo.")).errors=a,y;var u,c,l,p=n.util.createBuffer(i.salt),d=n.util.createBuffer(i.iterations);switch(d=d.getInt(d.length()<<3),e){case s.oids["pbeWithSHAAnd3-KeyTripleDES-CBC"]:u=24,c=8,l=n.des.startDecrypting;break;case s.oids["pbewithSHAAnd40BitRC2-CBC"]:u=5,c=8,l=function(e,t){var r=n.rc2.createDecryptionCipher(e,40);return r.start(t,null),r};break;default:var y;throw(y=new Error("Cannot read PKCS #12 PBE data block. Unsupported OID.")).oid=e,y}var g=h(i.prfOid),m=s.pbe.generatePkcs12Key(r,p,1,d,u,g);return g.start(),l(m,s.pbe.generatePkcs12Key(r,p,2,d,c,g))},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(13);r(77),r(19);var i=e.exports=n.sha256=n.sha256||{};n.md.sha256=n.md.algorithms.sha256=i,i.create=function(){s||(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);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 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,c=i.fullMessageLength[i.fullMessageLength.length-1]+i.messageLengthSize&i.blockLength-1;s.putBytes(o.substr(0,i.blockLength-c));for(var f=8*i.fullMessageLength[0],l=0;l<i.fullMessageLength.length-1;++l)f+=(a=8*i.fullMessageLength[l+1])/4294967296>>>0,s.putInt32(f>>>0),f=a>>>0;s.putInt32(f);var h={h0:e.h0,h1:e.h1,h2:e.h2,h3:e.h3,h4:e.h4,h5:e.h5,h6:e.h6,h7:e.h7};u(h,r,s);var p=n.util.createBuffer();return p.putInt32(h.h0),p.putInt32(h.h1),p.putInt32(h.h2),p.putInt32(h.h3),p.putInt32(h.h4),p.putInt32(h.h5),p.putInt32(h.h6),p.putInt32(h.h7),p},i};var o=null,s=!1,a=null;function u(e,t,r){for(var n,i,o,s,u,c,f,l,h,p,d,y,g,m=r.length();m>=64;){for(u=0;u<16;++u)t[u]=r.getInt32();for(;u<64;++u)n=((n=t[u-2])>>>17|n<<15)^(n>>>19|n<<13)^n>>>10,i=((i=t[u-15])>>>7|i<<25)^(i>>>18|i<<14)^i>>>3,t[u]=n+t[u-7]+i+t[u-16]|0;for(c=e.h0,f=e.h1,l=e.h2,h=e.h3,p=e.h4,d=e.h5,y=e.h6,g=e.h7,u=0;u<64;++u)o=(c>>>2|c<<30)^(c>>>13|c<<19)^(c>>>22|c<<10),s=c&f|l&(c^f),n=g+((p>>>6|p<<26)^(p>>>11|p<<21)^(p>>>25|p<<7))+(y^p&(d^y))+a[u]+t[u],g=y,y=d,d=p,p=h+n>>>0,h=l,l=f,f=c,c=n+(i=o+s)>>>0;e.h0=e.h0+c|0,e.h1=e.h1+f|0,e.h2=e.h2+l|0,e.h3=e.h3+h|0,e.h4=e.h4+p|0,e.h5=e.h5+d|0,e.h6=e.h6+y|0,e.h7=e.h7+g|0,m-=64}}},function(e,t,r){(function(t){var n=r(13);r(19);var i=null;!n.util.isNodejs||n.options.usePureJavaScript||t.versions["node-webkit"]||(i=r(450)),(e.exports=n.prng=n.prng||{}).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),c+=(32767&(u=16807*(l>>16)))<<16,l=4294967295&(c=(2147483647&(c+=u>>15))+(c>>31));for(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();t.key=null,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.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){self.addEventListener("message",function e(r){var n=r.data;n.forge&&n.forge.prng&&(self.removeEventListener("message",e),t(n.forge.prng.err,n.forge.prng.bytes))}),self.postMessage({forge:{prng:{needed:e}}})};else{e.addEventListener("message",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}}})})})}},t}}).call(this,r(7))},function(e,t,r){var n=r(13);r(19);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,o=e,s=e.length(),a=t,u=Math.ceil(a/8),c=255>>(7&a);for(r=s;r<128;r++)o.putByte(i[o.at(r-1)+o.at(r-s)&255]);for(o.setAt(128-u,i[o.at(128-u)&c]),r=127-u;r>=0;r--)o.setAt(r,i[o.at(r+1)^o.at(r+u)]);return o};var u=function(e,t,r){var i,u,c,f,l=!1,h=null,p=null,d=null,y=[];for(e=n.rc2.expandKey(e,t),c=0;c<64;c++)y.push(e.getInt16Le());r?(i=function(e){for(c=0;c<4;c++)e[c]+=y[f]+(e[(c+3)%4]&e[(c+2)%4])+(~e[(c+3)%4]&e[(c+1)%4]),e[c]=s(e[c],o[c]),f++},u=function(e){for(c=0;c<4;c++)e[c]+=y[63&e[(c+3)%4]]}):(i=function(e){for(c=3;c>=0;c--)e[c]=a(e[c],o[c]),e[c]-=y[f]+(e[(c+3)%4]&e[(c+2)%4])+(~e[(c+3)%4]&e[(c+1)%4]),f--},u=function(e){for(c=3;c>=0;c--)e[c]-=y[63&e[(c+3)%4]]});var g=function(e){var t=[];for(c=0;c<4;c++){var n=h.getInt16Le();null!==d&&(r?n^=d.getInt16Le():d.putInt16Le(n)),t.push(65535&n)}f=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(c=0;c<4;c++)null!==d&&(r?d.putInt16Le(t[c]):t[c]^=d.getInt16Le()),p.putInt16Le(t[c])},m=null;return m={start:function(e,t){e&&"string"==typeof e&&(e=n.util.createBuffer(e)),l=!1,h=n.util.createBuffer(),p=t||new n.util.createBuffer,d=e,m.output=p},update:function(e){for(l||h.putBuffer(e);h.length()>=8;)g([[5,i],[1,u],[6,i],[1,u],[5,i]])},finish:function(e){var t=!0;if(r)if(e)t=e(8,h,!r);else{var n=8===h.length()?8:8-h.length();h.fillWithByte(n,n)}if(t&&(l=!0,m.update()),!r&&(t=0===h.length()))if(e)t=e(8,p,!r);else{var i=p.length(),o=p.at(i-1);o>i?t=!1:p.truncate(o)}return t}}};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(13);r(19),r(69),r(134);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)throw(y=new Error("RSAES-OAEP input message length is too long.")).length=t.length,y.maxLength=f,y;i||(i=""),a.update(i,"raw");for(var l=a.digest(),h="",p=f-t.length,d=0;d<p;d++)h+="\0";var y,g=l.getBytes()+h+""+t;if(s){if(s.length!==a.digestLength)throw(y=new Error("Invalid RSAES-OAEP seed. The seed length must match the digest length.")).seedLength=s.length,y.digestLength=a.digestLength,y}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);return"\0"+n.util.xorBytes(s,v,s.length)+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)throw(m=new Error("RSAES-OAEP encoded message length is invalid.")).length=t.length,m.expectedLength=u,m;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 c=s.digest().getBytes(),f=t.charAt(0),l=t.substring(1,s.digestLength+1),h=t.substring(1+s.digestLength),p=o(h,s.digestLength,a),d=o(n.util.xorBytes(l,p,l.length),u-s.digestLength-1,a),y=n.util.xorBytes(h,d,h.length),g=y.substring(0,s.digestLength),m="\0"!==f,b=0;b<s.digestLength;++b)m|=c.charAt(b)!==g.charAt(b);for(var v=1,_=s.digestLength,w=s.digestLength;w<y.length;w++){var S=y.charCodeAt(w);m|=S&(v?65534:0),_+=v&=1&S^1}if(m||1!==y.charCodeAt(_))throw new Error("Invalid RSAES-OAEP padding.");return y.substring(_+1)}},function(e,t,r){var n=r(13);r(19),r(184),r(69),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={});var i=(t=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 function(e,t,r,n){return"workers"in r?c(e,t,r,n):a(e,t,r,n)}(e,s,i.options,r);throw new Error("Invalid prime generation algorithm: "+i.name)}}function a(e,t,r,n){var i=f(e,t),o=function(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}(i.bitLength());"millerRabinTests"in r&&(o=r.millerRabinTests);var s=10;"maxBlockTime"in r&&(s=r.maxBlockTime),u(i,e,t,0,o,s,n)}function u(e,t,r,o,s,a,c){var l=+new Date;do{if(e.bitLength()>t&&(e=f(t,r)),e.isProbablePrime(s))return c(null,e);e.dAddOffset(i[o++%8],0)}while(a<0||+new Date-l<a);n.util.setImmediate(function(){u(e,t,r,o,s,a,c)})}function c(e,t,i,o){if("undefined"==typeof Worker)return a(e,t,i,o);var s=f(e,t),u=i.workers,c=i.workLoad||100,l=30*c/8,h=i.workerScript||"forge/prime.worker.js";if(-1===u)return n.util.estimateCores(function(e,t){e&&(t=2),u=t-1,p()});function p(){u=Math.max(1,u);for(var n=[],i=0;i<u;++i)n[i]=new Worker(h);for(i=0;i<u;++i)n[i].addEventListener("message",p);var a=!1;function p(i){if(!a){0;var u=i.data;if(u.found){for(var h=0;h<n.length;++h)n[h].terminate();return a=!0,o(null,new r(u.prime,16))}s.bitLength()>e&&(s=f(e,t));var p=s.toString(16);i.target.postMessage({hex:p,workLoad:c}),s.dAddOffset(l,0)}}}p()}function f(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(e,t,r){var n=r(13);r(76),r(133),r(99),r(457),r(449),r(69),r(183),r(134),r(19),r(260);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)).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))throw(m=new Error("Cannot read ContentInfo.")).errors=f,m;var l={encrypted:!1},h=null,d=c.content.value[0];switch(i.derToOid(c.contentType)){case o.oids.data:if(d.tagClass!==i.Class.UNIVERSAL||d.type!==i.Type.OCTETSTRING)throw new Error("PKCS#12 SafeContents Data is not an OCTET STRING.");h=p(d).value;break;case o.oids.encryptedData:h=y(d,n),l.encrypted=!0;break;default:var m;throw(m=new Error("Unsupported PKCS#12 contentType.")).contentType=i.derToOid(c.contentType),m}l.safeBags=g(h,r,n),e.safeContents.push(l)}}function y(e,t){var r={},s=[];if(!i.validate(e,n.pkcs7.asn1.encryptedDataValidator,r,s))throw(a=new Error("Cannot read EncryptedContentInfo.")).errors=s,a;var a,u=i.derToOid(r.contentType);if(u!==o.oids.data)throw(a=new Error("PKCS#12 EncryptedContentInfo ContentType is not Data.")).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)).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))throw(g=new Error("Cannot read SafeBag.")).errors=f,g;var h,p,d={type:i.derToOid(u.bagId),attributes:m(u.bagAttributes)};n.push(d);var y=u.bagValue.value[0];switch(d.type){case o.oids.pkcs8ShroudedKeyBag:if(null===(y=o.decryptPrivateKeyInfo(y,r)))throw new Error("Unable to decrypt PKCS#8 ShroudedKeyBag, wrong password?");case o.oids.keyBag:try{d.key=o.privateKeyFromAsn1(y)}catch(e){d.key=null,d.asn1=y}continue;case o.oids.certBag:h=l,p=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{d.cert=o.certificateFromAsn1(r,!0)}catch(e){d.cert=null,d.asn1=r}};break;default:var g;throw(g=new Error("Unsupported PKCS#12 SafeBag type.")).oid=d.type,g}if(void 0!==h&&!i.validate(y,h,u,f))throw(g=new Error("Cannot read PKCS#12 "+h.name)).errors=f,g;p()}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={};if(!i.validate(e,u,a,[]))throw(c=new Error("Cannot read PKCS#12 PFX. ASN.1 object is not an PKCS#12 PFX.")).errors=c,c;var c,f={version:a.version.charCodeAt(0),safeContents:[],getBags:function(e){var t,r={};return"localKeyId"in e?t=e.localKeyId:"localKeyIdHex"in e&&(t=n.util.hexToBytes(e.localKeyIdHex)),void 0===t&&!("friendlyName"in e)&&"bagType"in e&&(r[e.bagType]=h(f.safeContents,null,null,e.bagType)),void 0!==t&&(r.localKeyId=h(f.safeContents,"localKeyId",t,e.bagType)),"friendlyName"in e&&(r.friendlyName=h(f.safeContents,"friendlyName",e.friendlyName,e.bagType)),r},getBagsByFriendlyName:function(e,t){return h(f.safeContents,"friendlyName",e,t)},getBagsByLocalKeyId:function(e,t){return h(f.safeContents,"localKeyId",e,t)}};if(3!==a.version.charCodeAt(0))throw(c=new Error("PKCS#12 PFX of version other than 3 not supported.")).version=a.version.charCodeAt(0),c;if(i.derToOid(a.contentType)!==o.oids.data)throw(c=new Error("Only PKCS#12 PFX in password integrity mode supported.")).oid=i.derToOid(a.contentType),c;var l=a.content.value[0];if(l.tagClass!==i.Class.UNIVERSAL||l.type!==i.Type.OCTETSTRING)throw new Error("PKCS#12 authSafe content data is not an OCTET STRING.");if(l=p(l),a.mac){var y=null,g=0,m=i.derToOid(a.macAlgorithm);switch(m){case o.oids.sha1:y=n.md.sha1.create(),g=20;break;case o.oids.sha256:y=n.md.sha256.create(),g=32;break;case o.oids.sha384:y=n.md.sha384.create(),g=48;break;case o.oids.sha512:y=n.md.sha512.create(),g=64;break;case o.oids.md5:y=n.md.md5.create(),g=16}if(null===y)throw new Error("PKCS#12 uses unsupported MAC algorithm: "+m);var b=new n.util.ByteBuffer(a.macSalt),v="macIterations"in a?parseInt(n.util.bytesToHex(a.macIterations),16):1,_=s.generateKey(r,b,3,v,g,y),w=n.hmac.create();if(w.start(y,_),w.update(l.value),w.getMac().getBytes()!==a.macDigest)throw new Error("PKCS#12 MAC could not be verified. Invalid password?")}return d(f,l.value,t,r),f},s.toPkcs12Asn1=function(e,t,r,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,c=a.localKeyId;if(null!==c)c=n.util.hexToBytes(c);else if(a.generateLocalKeyId)if(t){var f=n.util.isArray(t)?t[0]:t;"string"==typeof f&&(f=o.certificateFromPem(f)),(I=n.md.sha1.create()).update(i.toDer(o.certificateToAsn1(f)).getBytes()),c=I.digest().getBytes()}else c=n.random.getBytes(20);var l=[];null!==c&&l.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,c)])])),"friendlyName"in a&&l.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)])])),l.length>0&&(u=i.create(i.Class.UNIVERSAL,i.Type.SET,!0,l));var h=[],p=[];null!==t&&(p=n.util.isArray(t)?t:[t]);for(var d=[],y=0;y<p.length;++y){"string"==typeof(t=p[y])&&(t=o.certificateFromPem(t));var g=0===y?u:void 0,m=o.certificateToAsn1(t),b=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(m).getBytes())])])]),g]);d.push(b)}if(d.length>0){var v=i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,d),_=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(v).getBytes())])]);h.push(_)}var w=null;if(null!==e){var S=o.wrapRsaPrivateKey(o.privateKeyToAsn1(e));w=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,[S]),u]):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(S,r,a)]),u]);var k=i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[w]),E=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(k).getBytes())])]);h.push(E)}var A,x=i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,h);if(a.useMac){var I=n.md.sha1.create(),T=new n.util.ByteBuffer(n.random.getBytes(a.saltSize)),B=a.count,C=(e=s.generateKey(r,T,3,B,20),n.hmac.create());C.start(I,e),C.update(i.toDer(x).getBytes());var P=C.getMac();A=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())])]),A])},s.generateKey=n.pbe.generatePkcs12Key},function(e,t,r){var n=r(13);r(76),r(19);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(13);r(19),n.mgf=n.mgf||{},(e.exports=n.mgf.mgf1=n.mgf1=n.mgf1||{}).create=function(e){return{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()}}}},function(e,t,r){var n=r(13);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(13);r(77),r(19);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(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,u=p.fullMessageLength[p.fullMessageLength.length-1]+p.messageLengthSize&p.blockLength-1;t.putBytes(s.substr(0,p.blockLength-u));for(var c=8*p.fullMessageLength[0],f=0;f<p.fullMessageLength.length-1;++f)c+=(a=8*p.fullMessageLength[f+1])/4294967296>>>0,t.putInt32(c>>>0),c=a>>>0;t.putInt32(c);var h=new Array(r.length);for(f=0;f<r.length;++f)h[f]=r[f].slice(0);l(h,o,t);var d,y=n.util.createBuffer();d="SHA-512"===e?h.length:"SHA-384"===e?h.length-2:h.length-4;for(f=0;f<d;++f)y.putInt32(h[f][0]),f===d-1&&"SHA-512/224"===e||y.putInt32(h[f][1]);return y},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={})["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,K,j=r.length();j>=128;){for(C=0;C<16;++C)t[C][0]=r.getInt32()>>>0,t[C][1]=r.getInt32()>>>0;for(;C<80;++C)n=(((P=(R=t[C-2])[0])>>>19|(O=R[1])<<13)^(O>>>29|P<<3)^P>>>6)>>>0,i=((P<<13|O>>>19)^(O<<3|P>>>29)^(P<<26|O>>>6))>>>0,o=(((P=(L=t[C-15])[0])>>>1|(O=L[1])<<31)^(P>>>8|O<<24)^P>>>7)>>>0,s=((P<<31|O>>>1)^(P<<24|O>>>8)^(P<<25|O>>>7))>>>0,N=t[C-7],K=t[C-16],O=i+N[1]+s+K[1],t[C][0]=n+N[0]+o+K[0]+(O/4294967296>>>0)>>>0,t[C][1]=O>>>0;for(d=e[0][0],y=e[0][1],g=e[1][0],m=e[1][1],b=e[2][0],v=e[2][1],_=e[3][0],w=e[3][1],S=e[4][0],k=e[4][1],E=e[5][0],A=e[5][1],x=e[6][0],I=e[6][1],T=e[7][0],B=e[7][1],C=0;C<80;++C)f=((S>>>14|k<<18)^(S>>>18|k<<14)^(k>>>9|S<<23))>>>0,l=(x^S&(E^x))>>>0,a=((d>>>28|y<<4)^(y>>>2|d<<30)^(y>>>7|d<<25))>>>0,c=((d<<4|y>>>28)^(y<<30|d>>>2)^(y<<25|d>>>7))>>>0,h=(d&g|b&(d^g))>>>0,p=(y&m|v&(y^m))>>>0,O=B+(((S<<18|k>>>14)^(S<<14|k>>>18)^(k<<23|S>>>9))>>>0)+((I^k&(A^I))>>>0)+u[C][1]+t[C][1],n=T+f+l+u[C][0]+t[C][0]+(O/4294967296>>>0)>>>0,i=O>>>0,o=a+h+((O=c+p)/4294967296>>>0)>>>0,s=O>>>0,T=x,B=I,x=E,I=A,E=S,A=k,S=_+n+((O=w+i)/4294967296>>>0)>>>0,k=O>>>0,_=b,w=v,b=g,v=m,g=d,m=y,d=n+o+((O=i+s)/4294967296>>>0)>>>0,y=O>>>0;O=e[0][1]+y,e[0][0]=e[0][0]+d+(O/4294967296>>>0)>>>0,e[0][1]=O>>>0,O=e[1][1]+m,e[1][0]=e[1][0]+g+(O/4294967296>>>0)>>>0,e[1][1]=O>>>0,O=e[2][1]+v,e[2][0]=e[2][0]+b+(O/4294967296>>>0)>>>0,e[2][1]=O>>>0,O=e[3][1]+w,e[3][0]=e[3][0]+_+(O/4294967296>>>0)>>>0,e[3][1]=O>>>0,O=e[4][1]+k,e[4][0]=e[4][0]+S+(O/4294967296>>>0)>>>0,e[4][1]=O>>>0,O=e[5][1]+A,e[5][0]=e[5][0]+E+(O/4294967296>>>0)>>>0,e[5][1]=O>>>0,O=e[6][1]+I,e[6][0]=e[6][0]+x+(O/4294967296>>>0)>>>0,e[6][1]=O>>>0,O=e[7][1]+B,e[7][0]=e[7][0]+T+(O/4294967296>>>0)>>>0,e[7][1]=O>>>0,j-=128}}},function(e,t,r){var n=r(13);r(19),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];s.flags&n.log.NO_LEVEL_CHECK?s.f(e):t<=i[s.level].index&&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)};var c=["error","warning","info","debug","verbose"];for(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){if(t==n.log.levels[i]){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{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();"console.level"in p&&n.log.setLevel(s,p["console.level"].slice(-1)[0]),"console.lock"in p&&"true"==p["console.lock"].slice(-1)[0]&&n.log.lock(s)}n.log.consoleLogger=s},function(e,t,r){"use strict";(function(t){const n=r(12),i=r(926);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,s=n;r&&(s=((e,t)=>{if(e)return n(e);n(null,t.slice(0,r))}));try{i=o.createHash(t)}catch(e){return s(e)}i(e,s)},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(254),i=r(255)();function o(e){return Promise.all([i.subtle.exportKey("jwk",e.privateKey),i.subtle.exportKey("jwk",e.publicKey)])}t.utils=r(929),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,function(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"])}(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(5),i=r(135).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(){return{offset:this.offset,reporter:i.prototype.save.call(this)}},s.prototype.restore=function(e){const t=new s(this.base);return t.offset=e.offset,t.length=this.offset,this.offset=e.offset,i.prototype.restore.call(this,e.reporter),t},s.prototype.isEmpty=function(){return this.offset===this.length},s.prototype.readUInt8=function(e){return this.offset+1<=this.length?this.base.readUInt8(this.offset++,!0):this.error(e||"DecoderBuffer overrun")},s.prototype.skip=function(e,t){if(!(this.offset+e<=this.length))return this.error(t||"DecoderBuffer overrun");const r=new s(this.base);return r._reporterState=this._reporterState,r.offset=this.offset,r.length=this.offset+e,this.offset+=e,r},s.prototype.raw=function(e){return this.base.slice(e?e.offset:this.offset,this.length)},t.EncoderBuffer=a,a.prototype.join=function(e,t){return e||(e=new o(this.length)),t||(t=0),0===this.length?e:(Array.isArray(this.value)?this.value.forEach(function(r){r.join(e,t),t+=r.length}):("number"==typeof this.value?e[t]=this.value:"string"==typeof this.value?e.write(this.value,t):o.isBuffer(this.value)&&this.value.copy(e,t),t+=this.length),e)}},function(e,t,r){"use strict";const n=t;n._reverse=function(e){const t={};return Object.keys(e).forEach(function(r){(0|r)==r&&(r|=0);const n=e[r];t[n]=r}),t},n.der=r(934)},function(e,t,r){"use strict";const n=r(5),i=r(15),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;return{cls:n,primitive:i,tag:r,tagStr:a.tag[r]}}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){return e instanceof o.DecoderBuffer||(e=new o.DecoderBuffer(e,t)),this.tree._decode(e,t)},n(c,o.Node),c.prototype._peekTag=function(e,t,r){if(e.isEmpty())return!1;const n=e.save(),i=f(e,'Failed to peek tag: "'+t+'"');return e.isError(i)?i:(e.restore(n),i.tag===t||i.tagStr===t||i.tagStr+"of"===t||r)},c.prototype._decodeTag=function(e,t,r){const n=f(e,'Failed to decode tag of "'+t+'"');if(e.isError(n))return n;let i=l(e,n.primitive,'Failed to get length of "'+t+'"');if(e.isError(i))return i;if(!r&&n.tag!==t&&n.tagStr!==t&&n.tagStr+"of"!==t)return e.error('Failed to match tag: "'+t+'"');if(n.primitive||null!==i)return e.skip(i,'Failed to match body of: "'+t+'"');const o=e.save(),s=this._skipUntilEnd(e,'Failed to skip indefinite length body: "'+this.tag+'"');return e.isError(s)?s:(i=e.offset-o.offset,e.restore(o),e.skip(i,'Failed to match body of: "'+t+'"'))},c.prototype._skipUntilEnd=function(e,t){for(;;){const r=f(e,t);if(e.isError(r))return r;const n=l(e,r.primitive,t);if(e.isError(n))return n;let i;if(i=r.primitive||null!==n?e.skip(n):this._skipUntilEnd(e,t),e.isError(i))return i;if("end"===r.tagStr)break}},c.prototype._decodeList=function(e,t,r,n){const i=[];for(;!e.isEmpty();){const t=this._peekTag(e,"end");if(e.isError(t))return t;const o=r.decode(e,"der",n);if(e.isError(o)&&t)break;i.push(o)}return i},c.prototype._decodeStr=function(e,t){if("bitstr"===t){const t=e.readUInt8();return e.isError(t)?t:{unused:t,data:e.raw()}}if("bmpstr"===t){const t=e.raw();if(t.length%2==1)return e.error("Decoding of string type: bmpstr length mismatch");let r="";for(let e=0;e<t.length/2;e++)r+=String.fromCharCode(t.readUInt16BE(2*e));return r}if("numstr"===t){const t=e.raw().toString("ascii");return this._isNumstr(t)?t:e.error("Decoding of string type: numstr unsupported characters")}if("octstr"===t)return e.raw();if("objDesc"===t)return e.raw();if("printstr"===t){const t=e.raw().toString("ascii");return this._isPrintstr(t)?t:e.error("Decoding of string type: printstr unsupported characters")}return/str$/.test(t)?e.raw().toString():e.error("Decoding of string type: "+t+" unsupported")},c.prototype._decodeObjid=function(e,t,r){let n;const i=[];let o=0,s=0;for(;!e.isEmpty();)o<<=7,o|=127&(s=e.readUInt8()),0==(128&s)&&(i.push(o),o=0);128&s&&i.push(o);const a=i[0]/40|0,u=i[0]%40;if(n=r?i:[a,u].concat(i.slice(1)),t){let e=t[n.join(" ")];void 0===e&&(e=t[n.join(".")]),void 0!==e&&(n=e)}return n},c.prototype._decodeTime=function(e,t){const r=e.raw().toString();let n,i,o,s,a,u;if("gentime"===t)n=0|r.slice(0,4),i=0|r.slice(4,6),o=0|r.slice(6,8),s=0|r.slice(8,10),a=0|r.slice(10,12),u=0|r.slice(12,14);else{if("utctime"!==t)return e.error("Decoding "+t+" time is not supported yet");n=0|r.slice(0,2),i=0|r.slice(2,4),o=0|r.slice(4,6),s=0|r.slice(6,8),a=0|r.slice(8,10),u=0|r.slice(10,12),n=n<70?2e3+n:1900+n}return Date.UTC(n,i-1,o,s,a,u,0)},c.prototype._decodeNull=function(){return null},c.prototype._decodeBool=function(e){const t=e.readUInt8();return e.isError(t)?t:0!==t},c.prototype._decodeInt=function(e,t){const r=e.raw();let n=new s(r);return t&&(n=t[n.toString(10)]||n),n},c.prototype._use=function(e,t){return"function"==typeof e&&(e=e(t)),e._getDecoder("der").tree}},function(e,t,r){"use strict";const n=r(5),i=r(0).Buffer,o=r(15),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)}e.exports=u,u.prototype.encode=function(e,t){return this.tree._encode(e,t).join()},n(c,s.Node),c.prototype._encodeComposite=function(e,t,r,n){const o=l(e,t,r,this.reporter);if(n.length<128){const e=new i(2);return e[0]=o,e[1]=n.length,this._createEncoderBuffer([e,n])}let s=1;for(let e=n.length;e>=256;e>>=8)s++;const a=new i(2+s);a[0]=o,a[1]=128|s;for(let e=1+s,t=n.length;t>0;e--,t>>=8)a[e]=255&t;return this._createEncoderBuffer([a,n])},c.prototype._encodeStr=function(e,t){if("bitstr"===t)return this._createEncoderBuffer([0|e.unused,e.data]);if("bmpstr"===t){const t=new i(2*e.length);for(let r=0;r<e.length;r++)t.writeUInt16BE(e.charCodeAt(r),2*r);return this._createEncoderBuffer(t)}return"numstr"===t?this._isNumstr(e)?this._createEncoderBuffer(e):this.reporter.error("Encoding of string type: numstr supports only digits and space"):"printstr"===t?this._isPrintstr(e)?this._createEncoderBuffer(e):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(t)?this._createEncoderBuffer(e):"objDesc"===t?this._createEncoderBuffer(e):this.reporter.error("Encoding of string type: "+t+" unsupported")},c.prototype._encodeObjid=function(e,t,r){if("string"==typeof e){if(!t)return this.reporter.error("string objid given, but no values map found");if(!t.hasOwnProperty(e))return this.reporter.error("objid not found in values map");e=t[e].split(/[\s.]+/g);for(let t=0;t<e.length;t++)e[t]|=0}else if(Array.isArray(e)){e=e.slice();for(let t=0;t<e.length;t++)e[t]|=0}if(!Array.isArray(e))return this.reporter.error("objid() should be either array or string, got: "+JSON.stringify(e));if(!r){if(e[1]>=40)return this.reporter.error("Second objid identifier OOB");e.splice(0,2,40*e[0]+e[1])}let n=0;for(let t=0;t<e.length;t++){let r=e[t];for(n++;r>=128;r>>=7)n++}const o=new i(n);let s=o.length-1;for(let t=e.length-1;t>=0;t--){let r=e[t];for(o[s--]=127&r;(r>>=7)>0;)o[s--]=128|127&r}return this._createEncoderBuffer(o)},c.prototype._encodeTime=function(e,t){let r;const n=new Date(e);return"gentime"===t?r=[f(n.getUTCFullYear()),f(n.getUTCMonth()+1),f(n.getUTCDate()),f(n.getUTCHours()),f(n.getUTCMinutes()),f(n.getUTCSeconds()),"Z"].join(""):"utctime"===t?r=[f(n.getUTCFullYear()%100),f(n.getUTCMonth()+1),f(n.getUTCDate()),f(n.getUTCHours()),f(n.getUTCMinutes()),f(n.getUTCSeconds()),"Z"].join(""):this.reporter.error("Encoding "+t+" time is not supported yet"),this._encodeStr(r,"octstr")},c.prototype._encodeNull=function(){return this._createEncoderBuffer("")},c.prototype._encodeInt=function(e,t){if("string"==typeof e){if(!t)return this.reporter.error("String int or enum given, but no values map");if(!t.hasOwnProperty(e))return this.reporter.error("Values map doesn't contain: "+JSON.stringify(e));e=t[e]}if("number"!=typeof e&&!i.isBuffer(e)){const t=e.toArray();!e.sign&&128&t[0]&&t.unshift(0),e=new i(t)}if(i.isBuffer(e)){let t=e.length;0===e.length&&t++;const r=new i(t);return e.copy(r),0===e.length&&(r[0]=0),this._createEncoderBuffer(r)}if(e<128)return this._createEncoderBuffer(e);if(e<256)return this._createEncoderBuffer([0,e]);let r=1;for(let t=e;t>=256;t>>=8)r++;const n=new Array(r);for(let t=n.length-1;t>=0;t--)n[t]=255&e,e>>=8;return 128&n[0]&&n.unshift(0),this._createEncoderBuffer(new i(n))},c.prototype._encodeBool=function(e){return this._createEncoderBuffer(e?255:0)},c.prototype._use=function(e,t){return"function"==typeof e&&(e=e(t)),e._getEncoder("der").tree},c.prototype._skipDefault=function(e,t,r){const n=this._baseState;let i;if(null===n.default)return!1;const o=e.join();if(void 0===n.defaultBuffer&&(n.defaultBuffer=this._encodeValue(n.default,t,r).join()),o.length!==n.defaultBuffer.length)return!1;for(i=0;i<o.length;i++)if(o[i]!==n.defaultBuffer[i])return!1;return!0}},function(e,t,r){"use strict";(function(e){const n=r(15).bignum;t.toBase64=function(t,r){return t.toArrayLike(e,"be",r).toString("base64").replace(/(=*)$/,"").replace(/\+/g,"-").replace(/\//g,"_")},t.toBn=function(t){return new n(e.from(t,"base64"))}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(t){const n=r(12),i=r(942);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,s=n;r&&(s=((e,t)=>{if(e)return n(e);n(null,t.slice(0,r))}));try{i=o.createHash(t)}catch(e){return s(e)}i(e,s)},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(473);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,r,n=e[0];return 33!==e.length||2!==n&&3!==n?65!==e.length||4!==n&&6!==n&&7!==n?null:(t=i.fromBuffer(e.slice(1,33)),r=i.fromBuffer(e.slice(33,65)),t.ucmp(i.p)>=0||r.ucmp(i.p)>=0?null:6!==n&&7!==n||r.isOdd()===(7===n)?0!==t.redSqr().redMul(t).redIAdd7().ucmp(r.redSqr())?null:new s(t,r):null):(t=i.fromBuffer(e.slice(1,33))).ucmp(i.p)>=0?null:null===(r=t.redSqr().redMul(t).redIAdd7().redSqrt())?null:(3===n!==r.isOdd()&&(r=r.redNeg()),new s(t,r))},s.prototype.toPublicKey=function(e){var t,r=this.x,i=this.y;return e?((t=n.alloc(33))[0]=i.isOdd()?3:2,r.toBuffer().copy(t,1)):((t=n.alloc(65))[0]=4,r.toBuffer().copy(t,1),i.toBuffer().copy(t,33)),t},s.fromECJPoint=function(e){if(e.inf)return new s(null,null);var t=e.z.redInvm(),r=t.redSqr();return new s(e.x.redMul(r),e.y.redMul(r).redMul(t))},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);return new s(r,t.redMul(this.x.redSub(r)).redISub(this.y))},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));return new s(n,r.redMul(this.x.redSub(n)).redISub(this.y))},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);return new i(p,c.redMul(l.redISub(p)).redISub(s.redMul(h)),this.z.redMul(e.z).redMul(u))},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);return new i(h,u.redMul(f.redISub(h)).redISub(o.redMul(l)),this.z.redMul(a))},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=(r=this.y.redMul(this.z)).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(464);e.exports=function(e){if(!e||"number"!=typeof e)throw new Error("first argument must be a Number bigger than 0");return n.getRandomValues(new Uint8Array(e))}},function(e,t,r){"use strict";(function(e){const n=r(263),i=r(264)(),o=r(958),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(12),i=r(963);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,s=n;r&&(s=((e,t)=>{if(e)return n(e);n(null,t.slice(0,r))}));try{i=o.createHash(t)}catch(e){return s(e)}i(e,s)},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(263),i=r(264)();function o(e){return Promise.all([i.subtle.exportKey("jwk",e.privateKey),i.subtle.exportKey("jwk",e.publicKey)])}t.utils=r(966),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,function(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"])}(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(15).bignum;t.toBase64=function(t,r){return t.toArrayLike(e,"be",r).toString("base64").replace(/(=*)$/,"").replace(/\+/g,"-").replace(/\//g,"_")},t.toBn=function(t){return new n(e.from(t,"base64"))}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";const n=r(478);e.exports=function(e){if(!e||"number"!=typeof e)throw new Error("first argument must be a Number bigger than 0");return n.getRandomValues(new Uint8Array(e))}},function(e,t,r){"use strict";const n=r(973);e.exports={ensureMultiaddr:function(e){return n.isMultiaddr(e)?e:n(e)}}},function(e,t,r){"use strict";var n=r(483).BigInteger,i=r(484),o=r(485),s=r(486),a=r(139).sprintf,u=r(266);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,r=o(e.replace(/:/g,""),8,"0"),n=[];for(t=0;t<8;t+=2){var i=r.slice(t,t+2);n.push(parseInt(i,16))}return new c(n.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(e=0;e<u.GROUPS;e+=2){var r=a("%02x%02x",parseInt(this.parsedAddress[e],10),parseInt(this.parsedAddress[e+1],10));t.push(a("%x",parseInt(r,16)))}return t.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 t;function r(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 n(){return new r(null)}var i="undefined"!=typeof navigator;i&&"Microsoft Internet Explorer"==navigator.appName?(r.prototype.am=function(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;i=((u=s*u+((32767&f)<<15)+r[n]+(1073741823&i))>>>30)+(f>>>15)+a*c+(i>>>30),r[n++]=1073741823&u}return i},t=30):i&&"Netscape"!=navigator.appName?(r.prototype.am=function(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},t=26):(r.prototype.am=function(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;i=((u=s*u+((16383&f)<<14)+r[n]+i)>>28)+(f>>14)+a*c,r[n++]=268435455&u}return i},t=28),r.prototype.DB=t,r.prototype.DM=(1<<t)-1,r.prototype.DV=1<<t;r.prototype.FV=Math.pow(2,52),r.prototype.F1=52-t,r.prototype.F2=2*t-52;var o,s,a="0123456789abcdefghijklmnopqrstuvwxyz",u=new Array;for(o="0".charCodeAt(0),s=0;s<=9;++s)u[o++]=s;for(o="a".charCodeAt(0),s=10;s<36;++s)u[o++]=s;for(o="A".charCodeAt(0),s=10;s<36;++s)u[o++]=s;function c(e){return a.charAt(e)}function f(e,t){var r=u[e.charCodeAt(t)];return null==r?-1:r}function l(e){var t=n();return t.fromInt(e),t}function h(e){var t,r=1;return 0!=(t=e>>>16)&&(e=t,r+=16),0!=(t=e>>8)&&(e=t,r+=8),0!=(t=e>>4)&&(e=t,r+=4),0!=(t=e>>2)&&(e=t,r+=2),0!=(t=e>>1)&&(e=t,r+=1),r}function p(e){this.m=e}function d(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 y(e,t){return e&t}function g(e,t){return e|t}function m(e,t){return e^t}function b(e,t){return e&~t}function v(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 _(e){for(var t=0;0!=e;)e&=e-1,++t;return t}function w(){}function S(e){return e}function k(e){this.r2=n(),this.q3=n(),r.ONE.dlShiftTo(2*e.t,this.r2),this.mu=this.r2.divide(e),this.m=e}p.prototype.convert=function(e){return e.s<0||e.compareTo(this.m)>=0?e.mod(this.m):e},p.prototype.revert=function(e){return e},p.prototype.reduce=function(e){e.divRemTo(this.m,null,e)},p.prototype.mulTo=function(e,t,r){e.multiplyTo(t,r),this.reduce(r)},p.prototype.sqrTo=function(e,t){e.squareTo(t),this.reduce(t)},d.prototype.convert=function(e){var t=n();return e.abs().dlShiftTo(this.m.t,t),t.divRemTo(this.m,null,t),e.s<0&&t.compareTo(r.ZERO)>0&&this.m.subTo(t,t),t},d.prototype.revert=function(e){var t=n();return e.copyTo(t),this.reduce(t),t},d.prototype.reduce=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(e[r=t+this.m.t]+=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)},d.prototype.mulTo=function(e,t,r){e.multiplyTo(t,r),this.reduce(r)},d.prototype.sqrTo=function(e,t){e.squareTo(t),this.reduce(t)},r.prototype.copyTo=function(e){for(var t=this.t-1;t>=0;--t)e[t]=this[t];e.t=this.t,e.s=this.s},r.prototype.fromInt=function(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},r.prototype.fromString=function(e,t){var n;if(16==t)n=4;else if(8==t)n=3;else if(256==t)n=8;else if(2==t)n=1;else if(32==t)n=5;else{if(4!=t)return void this.fromRadix(e,t);n=2}this.t=0,this.s=0;for(var i=e.length,o=!1,s=0;--i>=0;){var a=8==n?255&e[i]:f(e,i);a<0?"-"==e.charAt(i)&&(o=!0):(o=!1,0==s?this[this.t++]=a:s+n>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+=n)>=this.DB&&(s-=this.DB))}8==n&&0!=(128&e[0])&&(this.s=-1,s>0&&(this[this.t-1]|=(1<<this.DB-s)-1<<s)),this.clamp(),o&&r.ZERO.subTo(this,this)},r.prototype.clamp=function(){for(var e=this.s&this.DM;this.t>0&&this[this.t-1]==e;)--this.t},r.prototype.dlShiftTo=function(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},r.prototype.drShiftTo=function(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},r.prototype.lShiftTo=function(e,t){var r,n=e%this.DB,i=this.DB-n,o=(1<<i)-1,s=Math.floor(e/this.DB),a=this.s<<n&this.DM;for(r=this.t-1;r>=0;--r)t[r+s+1]=this[r]>>i|a,a=(this[r]&o)<<n;for(r=s-1;r>=0;--r)t[r]=0;t[s]=a,t.t=this.t+s+1,t.s=this.s,t.clamp()},r.prototype.rShiftTo=function(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()}},r.prototype.subTo=function(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()},r.prototype.multiplyTo=function(e,t){var n=this.abs(),i=e.abs(),o=n.t;for(t.t=o+i.t;--o>=0;)t[o]=0;for(o=0;o<i.t;++o)t[o+n.t]=n.am(0,i[o],t,o,0,n.t);t.s=0,t.clamp(),this.s!=e.s&&r.ZERO.subTo(t,t)},r.prototype.squareTo=function(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()},r.prototype.divRemTo=function(e,t,i){var o=e.abs();if(!(o.t<=0)){var s=this.abs();if(s.t<o.t)return null!=t&&t.fromInt(0),void(null!=i&&this.copyTo(i));null==i&&(i=n());var a=n(),u=this.s,c=e.s,f=this.DB-h(o[o.t-1]);f>0?(o.lShiftTo(f,a),s.lShiftTo(f,i)):(o.copyTo(a),s.copyTo(i));var l=a.t,p=a[l-1];if(0!=p){var d=p*(1<<this.F1)+(l>1?a[l-2]>>this.F2:0),y=this.FV/d,g=(1<<this.F1)/d,m=1<<this.F2,b=i.t,v=b-l,_=null==t?n():t;for(a.dlShiftTo(v,_),i.compareTo(_)>=0&&(i[i.t++]=1,i.subTo(_,i)),r.ONE.dlShiftTo(l,_),_.subTo(a,a);a.t<l;)a[a.t++]=0;for(;--v>=0;){var w=i[--b]==p?this.DM:Math.floor(i[b]*y+(i[b-1]+m)*g);if((i[b]+=a.am(0,w,i,v,0,l))<w)for(a.dlShiftTo(v,_),i.subTo(_,i);i[b]<--w;)i.subTo(_,i)}null!=t&&(i.drShiftTo(l,t),u!=c&&r.ZERO.subTo(t,t)),i.t=l,i.clamp(),f>0&&i.rShiftTo(f,i),u<0&&r.ZERO.subTo(i,i)}}},r.prototype.invDigit=function(){if(this.t<1)return 0;var e=this[0];if(0==(1&e))return 0;var t=3&e;return(t=(t=(t=(t=t*(2-(15&e)*t)&15)*(2-(255&e)*t)&255)*(2-((65535&e)*t&65535))&65535)*(2-e*t%this.DV)%this.DV)>0?this.DV-t:-t},r.prototype.isEven=function(){return 0==(this.t>0?1&this[0]:this.s)},r.prototype.exp=function(e,t){if(e>4294967295||e<1)return r.ONE;var i=n(),o=n(),s=t.convert(this),a=h(e)-1;for(s.copyTo(i);--a>=0;)if(t.sqrTo(i,o),(e&1<<a)>0)t.mulTo(o,s,i);else{var u=i;i=o,o=u}return t.revert(i)},r.prototype.toString=function(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,n=(1<<t)-1,i=!1,o="",s=this.t,a=this.DB-s*this.DB%t;if(s-- >0)for(a<this.DB&&(r=this[s]>>a)>0&&(i=!0,o=c(r));s>=0;)a<t?(r=(this[s]&(1<<a)-1)<<t-a,r|=this[--s]>>(a+=this.DB-t)):(r=this[s]>>(a-=t)&n,a<=0&&(a+=this.DB,--s)),r>0&&(i=!0),i&&(o+=c(r));return i?o:"0"},r.prototype.negate=function(){var e=n();return r.ZERO.subTo(this,e),e},r.prototype.abs=function(){return this.s<0?this.negate():this},r.prototype.compareTo=function(e){var t=this.s-e.s;if(0!=t)return t;var r=this.t;if(0!=(t=r-e.t))return this.s<0?-t:t;for(;--r>=0;)if(0!=(t=this[r]-e[r]))return t;return 0},r.prototype.bitLength=function(){return this.t<=0?0:this.DB*(this.t-1)+h(this[this.t-1]^this.s&this.DM)},r.prototype.mod=function(e){var t=n();return this.abs().divRemTo(e,null,t),this.s<0&&t.compareTo(r.ZERO)>0&&e.subTo(t,t),t},r.prototype.modPowInt=function(e,t){var r;return r=e<256||t.isEven()?new p(t):new d(t),this.exp(e,r)},r.ZERO=l(0),r.ONE=l(1),w.prototype.convert=S,w.prototype.revert=S,w.prototype.mulTo=function(e,t,r){e.multiplyTo(t,r)},w.prototype.sqrTo=function(e,t){e.squareTo(t)},k.prototype.convert=function(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=n();return e.copyTo(t),this.reduce(t),t},k.prototype.revert=function(e){return e},k.prototype.reduce=function(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)},k.prototype.mulTo=function(e,t,r){e.multiplyTo(t,r),this.reduce(r)},k.prototype.sqrTo=function(e,t){e.squareTo(t),this.reduce(t)};var E,A,x,I=[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],T=(1<<26)/I[I.length-1];function B(){!function(e){A[x++]^=255&e,A[x++]^=e>>8&255,A[x++]^=e>>16&255,A[x++]^=e>>24&255,x>=K&&(x-=K)}((new Date).getTime())}if(r.prototype.chunkSize=function(e){return Math.floor(Math.LN2*this.DB/Math.log(e))},r.prototype.toRadix=function(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=l(r),o=n(),s=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},r.prototype.fromRadix=function(e,t){this.fromInt(0),null==t&&(t=10);for(var n=this.chunkSize(t),i=Math.pow(t,n),o=!1,s=0,a=0,u=0;u<e.length;++u){var c=f(e,u);c<0?"-"==e.charAt(u)&&0==this.signum()&&(o=!0):(a=t*a+c,++s>=n&&(this.dMultiply(i),this.dAddOffset(a,0),s=0,a=0))}s>0&&(this.dMultiply(Math.pow(t,s)),this.dAddOffset(a,0)),o&&r.ZERO.subTo(this,this)},r.prototype.fromNumber=function(e,t,n){if("number"==typeof t)if(e<2)this.fromInt(1);else for(this.fromNumber(e,n),this.testBit(e-1)||this.bitwiseTo(r.ONE.shiftLeft(e-1),g,this),this.isEven()&&this.dAddOffset(1,0);!this.isProbablePrime(t);)this.dAddOffset(2,0),this.bitLength()>e&&this.subTo(r.ONE.shiftLeft(e-1),this);else{var i=new Array,o=7&e;i.length=1+(e>>3),t.nextBytes(i),o>0?i[0]&=(1<<o)-1:i[0]=0,this.fromString(i,256)}},r.prototype.bitwiseTo=function(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()},r.prototype.changeBit=function(e,t){var n=r.ONE.shiftLeft(e);return this.bitwiseTo(n,t,n),n},r.prototype.addTo=function(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()},r.prototype.dMultiply=function(e){this[this.t]=this.am(0,e-1,this,0,0,this.t),++this.t,this.clamp()},r.prototype.dAddOffset=function(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]}},r.prototype.multiplyLowerTo=function(e,t,r){var n,i=Math.min(this.t+e.t,t);for(r.s=0,r.t=i;i>0;)r[--i]=0;for(n=r.t-this.t;i<n;++i)r[i+this.t]=this.am(0,e[i],r,i,0,this.t);for(n=Math.min(e.t,t);i<n;++i)this.am(0,e[i],r,i,0,t-i);r.clamp()},r.prototype.multiplyUpperTo=function(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)},r.prototype.modInt=function(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},r.prototype.millerRabin=function(e){var t=this.subtract(r.ONE),i=t.getLowestSetBit();if(i<=0)return!1;var o=t.shiftRight(i);(e=e+1>>1)>I.length&&(e=I.length);for(var s=n(),a=0;a<e;++a){s.fromInt(I[Math.floor(Math.random()*I.length)]);var u=s.modPow(o,this);if(0!=u.compareTo(r.ONE)&&0!=u.compareTo(t)){for(var c=1;c++<i&&0!=u.compareTo(t);)if(0==(u=u.modPowInt(2,this)).compareTo(r.ONE))return!1;if(0!=u.compareTo(t))return!1}}return!0},r.prototype.clone=function(){var e=n();return this.copyTo(e),e},r.prototype.intValue=function(){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]},r.prototype.byteValue=function(){return 0==this.t?this.s:this[0]<<24>>24},r.prototype.shortValue=function(){return 0==this.t?this.s:this[0]<<16>>16},r.prototype.signum=function(){return this.s<0?-1:this.t<=0||1==this.t&&this[0]<=0?0:1},r.prototype.toByteArray=function(){var e=this.t,t=new Array;t[0]=this.s;var r,n=this.DB-e*this.DB%8,i=0;if(e-- >0)for(n<this.DB&&(r=this[e]>>n)!=(this.s&this.DM)>>n&&(t[i++]=r|this.s<<this.DB-n);e>=0;)n<8?(r=(this[e]&(1<<n)-1)<<8-n,r|=this[--e]>>(n+=this.DB-8)):(r=this[e]>>(n-=8)&255,n<=0&&(n+=this.DB,--e)),0!=(128&r)&&(r|=-256),0==i&&(128&this.s)!=(128&r)&&++i,(i>0||r!=this.s)&&(t[i++]=r);return t},r.prototype.equals=function(e){return 0==this.compareTo(e)},r.prototype.min=function(e){return this.compareTo(e)<0?this:e},r.prototype.max=function(e){return this.compareTo(e)>0?this:e},r.prototype.and=function(e){var t=n();return this.bitwiseTo(e,y,t),t},r.prototype.or=function(e){var t=n();return this.bitwiseTo(e,g,t),t},r.prototype.xor=function(e){var t=n();return this.bitwiseTo(e,m,t),t},r.prototype.andNot=function(e){var t=n();return this.bitwiseTo(e,b,t),t},r.prototype.not=function(){for(var e=n(),t=0;t<this.t;++t)e[t]=this.DM&~this[t];return e.t=this.t,e.s=~this.s,e},r.prototype.shiftLeft=function(e){var t=n();return e<0?this.rShiftTo(-e,t):this.lShiftTo(e,t),t},r.prototype.shiftRight=function(e){var t=n();return e<0?this.lShiftTo(-e,t):this.rShiftTo(e,t),t},r.prototype.getLowestSetBit=function(){for(var e=0;e<this.t;++e)if(0!=this[e])return e*this.DB+v(this[e]);return this.s<0?this.t*this.DB:-1},r.prototype.bitCount=function(){for(var e=0,t=this.s&this.DM,r=0;r<this.t;++r)e+=_(this[r]^t);return e},r.prototype.testBit=function(e){var t=Math.floor(e/this.DB);return t>=this.t?0!=this.s:0!=(this[t]&1<<e%this.DB)},r.prototype.setBit=function(e){return this.changeBit(e,g)},r.prototype.clearBit=function(e){return this.changeBit(e,b)},r.prototype.flipBit=function(e){return this.changeBit(e,m)},r.prototype.add=function(e){var t=n();return this.addTo(e,t),t},r.prototype.subtract=function(e){var t=n();return this.subTo(e,t),t},r.prototype.multiply=function(e){var t=n();return this.multiplyTo(e,t),t},r.prototype.divide=function(e){var t=n();return this.divRemTo(e,t,null),t},r.prototype.remainder=function(e){var t=n();return this.divRemTo(e,null,t),t},r.prototype.divideAndRemainder=function(e){var t=n(),r=n();return this.divRemTo(e,t,r),new Array(t,r)},r.prototype.modPow=function(e,t){var r,i,o=e.bitLength(),s=l(1);if(o<=0)return s;r=o<18?1:o<48?3:o<144?4:o<768?5:6,i=o<8?new p(t):t.isEven()?new k(t):new d(t);var a=new Array,u=3,c=r-1,f=(1<<r)-1;if(a[1]=i.convert(this),r>1){var y=n();for(i.sqrTo(a[1],y);u<=f;)a[u]=n(),i.mulTo(y,a[u-2],a[u]),u+=2}var g,m,b=e.t-1,v=!0,_=n();for(o=h(e[b])-1;b>=0;){for(o>=c?g=e[b]>>o-c&f:(g=(e[b]&(1<<o+1)-1)<<c-o,b>0&&(g|=e[b-1]>>this.DB+o-c)),u=r;0==(1&g);)g>>=1,--u;if((o-=u)<0&&(o+=this.DB,--b),v)a[g].copyTo(s),v=!1;else{for(;u>1;)i.sqrTo(s,_),i.sqrTo(_,s),u-=2;u>0?i.sqrTo(s,_):(m=s,s=_,_=m),i.mulTo(_,a[g],s)}for(;b>=0&&0==(e[b]&1<<o);)i.sqrTo(s,_),m=s,s=_,_=m,--o<0&&(o=this.DB-1,--b)}return i.revert(s)},r.prototype.modInverse=function(e){var t=e.isEven();if(this.isEven()&&t||0==e.signum())return r.ZERO;for(var n=e.clone(),i=this.clone(),o=l(1),s=l(0),a=l(0),u=l(1);0!=n.signum();){for(;n.isEven();)n.rShiftTo(1,n),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);n.compareTo(i)>=0?(n.subTo(i,n),t&&o.subTo(a,o),s.subTo(u,s)):(i.subTo(n,i),t&&a.subTo(o,a),u.subTo(s,u))}return 0!=i.compareTo(r.ONE)?r.ZERO:u.compareTo(e)>=0?u.subtract(e):u.signum()<0?(u.addTo(e,u),u.signum()<0?u.add(e):u):u},r.prototype.pow=function(e){return this.exp(e,new w)},r.prototype.gcd=function(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},r.prototype.isProbablePrime=function(e){var t,r=this.abs();if(1==r.t&&r[0]<=I[I.length-1]){for(t=0;t<I.length;++t)if(r[0]==I[t])return!0;return!1}if(r.isEven())return!1;for(t=1;t<I.length;){for(var n=I[t],i=t+1;i<I.length&&n<T;)n*=I[i++];for(n=r.modInt(n);t<i;)if(n%I[t++]==0)return!1}return r.millerRabin(e)},r.prototype.square=function(){var e=n();return this.squareTo(e),e},r.prototype.Barrett=k,null==A){var C;if(A=new Array,x=0,"undefined"!=typeof window&&window.crypto)if(window.crypto.getRandomValues){var P=new Uint8Array(32);for(window.crypto.getRandomValues(P),C=0;C<32;++C)A[x++]=P[C]}else if("Netscape"==navigator.appName&&navigator.appVersion<"5"){var O=window.crypto.random(32);for(C=0;C<O.length;++C)A[x++]=255&O.charCodeAt(C)}for(;x<K;)C=Math.floor(65536*Math.random()),A[x++]=C>>>8,A[x++]=255&C;x=0,B()}function R(){if(null==E){for(B(),(E=new L).init(A),x=0;x<A.length;++x)A[x]=0;x=0}return E.next()}function N(){}function L(){this.i=0,this.j=0,this.S=new Array}N.prototype.nextBytes=function(e){var t;for(t=0;t<e.length;++t)e[t]=R()},L.prototype.init=function(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},L.prototype.next=function(){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]};var K=256;e.exports={default:r,BigInteger:r,SecureRandom:N}}).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="\\u0300-\\u036f\\ufe20-\\ufe23",h="["+l+"\\u20d0-\\u20f0]",p="\\ud83c[\\udffb-\\udfff]",d="[^\\ud800-\\udfff]",y="(?:\\ud83c[\\udde6-\\uddff]){2}",g="[\\ud800-\\udbff][\\udc00-\\udfff]",m="(?:"+h+"|"+p+")?",b="[\\ufe0e\\ufe0f]?",v=b+m+"(?:\\u200d(?:"+[d,y,g].join("|")+")"+b+m+")*",_="(?:"+[d+h+"?",h,y,g,"[\\ud800-\\udfff]"].join("|")+")",w=RegExp(p+"(?="+p+")|"+_+v,"g"),S=RegExp("[\\u200d\\ud800-\\udfff"+l+"\\u20d0-\\u20f0\\ufe0e\\ufe0f]"),k=parseInt,E="object"==typeof t&&t&&t.Object===Object&&t,A="object"==typeof self&&self&&self.Object===Object&&self,x=E||A||Function("return this")(),I=function(e){return function(t){return null==t?void 0:t[e]}}("length");function T(e){return S.test(e)}function B(e){return T(e)?function(e){for(var t=w.lastIndex=0;w.test(e);)t++;return t}(e):I(e)}function C(e){return T(e)?function(e){return e.match(w)||[]}(e):function(e){return e.split("")}(e)}var P=Object.prototype.toString,O=x.Symbol,R=Math.ceil,N=Math.floor,L=O?O.prototype:void 0,K=L?L.toString:void 0;function j(e,t){var r="";if(!e||t<1||t>n)return r;do{t%2&&(r+=e),(t=N(t/2))&&(e+=e)}while(t);return r}function M(e){if("string"==typeof e)return e;if(F(e))return K?K.call(e):"";var t=e+"";return"0"==t&&1/e==-r?"-0":t}function D(e,t,r){var n=e.length;return r=void 0===r?n:r,!t&&r>=n?e:function(e,t,r){var n=-1,i=e.length;t<0&&(t=-t>i?0:i+t),(r=r>i?i: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}(e,t,r)}function U(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function F(e){return"symbol"==typeof e||function(e){return!!e&&"object"==typeof e}(e)&&P.call(e)==s}function q(e){return e?(e=function(e){if("number"==typeof e)return e;if(F(e))return o;if(U(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=U(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)?k(e.slice(2),r?2:8):u.test(e)?o:+e}(e))===r||e===-r?(e<0?-1:1)*i:e==e?e:0:0===e?e:0}e.exports=function(e,t,r){e=function(e){return null==e?"":M(e)}(e);var n=(t=function(e){var t=q(e),r=t%1;return t==t?r?t-r:t:0}(t))?B(e):0;return t&&n<t?function(e,t){var r=(t=void 0===t?" ":M(t)).length;if(r<2)return r?j(t,e):t;var n=j(t,R(e/B(t)));return T(t)?D(C(n),0,e).join(""):n.slice(0,e)}(t-n,r)+e:e}}).call(this,r(6))},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.toString,v=m.Symbol,_=Math.floor,w=v?v.prototype:void 0,S=w?w.toString:void 0;function k(e,t){return!!(t=null==t?n:t)&&("number"==typeof e||p.test(e))&&e>-1&&e%1==0&&e<t}function E(e,t,r){if(!A(r))return!1;var n=typeof t;return!!("number"==n?function(e){return null!=e&&function(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=n}(e.length)&&!function(e){var t=A(e)?b.call(e):"";return t==s||t==a}(e)}(r)&&k(t,r.length):"string"==n&&t in r)&&function(e,t){return e===t||e!=e&&t!=t}(r[t],e)}function A(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function x(e){return"symbol"==typeof e||function(e){return!!e&&"object"==typeof e}(e)&&b.call(e)==u}function I(e){return e?(e=function(e){if("number"==typeof e)return e;if(x(e))return o;if(A(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=A(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}(e))===r||e===-r?(e<0?-1:1)*i:e==e?e:0:0===e?e:0}function T(e){return null==e?"":function(e){if("string"==typeof e)return e;if(x(e))return S?S.call(e):"";var t=e+"";return"0"==t&&1/e==-r?"-0":t}(e)}e.exports=function(e,t,r){return t=(r?E(e,t,r):void 0===t)?1:function(e){var t=I(e),r=t%1;return t==t?r?t-r:t:0}(t),function(e,t){var r="";if(!e||t<1||t>n)return r;do{t%2&&(r+=e),(t=_(t/2))&&(e+=e)}while(t);return r}(T(e),t)}}).call(this,r(6))},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=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,P=/^\w*$/,O=/^\./,R=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,N=/^\s+|\s+$/g,L=/\\(\\)?/g,K=/^[-+]0x[0-9a-f]+$/i,j=/^0b[01]+$/i,M=/^\[object .+?Constructor\]$/,D=/^0o[0-7]+$/i,U=/^(?:0|[1-9]\d*)$/,F={};F["[object Float32Array]"]=F["[object Float64Array]"]=F["[object Int8Array]"]=F["[object Int16Array]"]=F["[object Int32Array]"]=F["[object Uint8Array]"]=F["[object Uint8ClampedArray]"]=F["[object Uint16Array]"]=F["[object Uint32Array]"]=!0,F[h]=F[p]=F[T]=F[d]=F[B]=F[y]=F[g]=F[m]=F[v]=F[_]=F[w]=F[k]=F[E]=F[A]=F[I]=!1;var q=parseInt,H="object"==typeof e&&e&&e.Object===Object&&e,z="object"==typeof self&&self&&self.Object===Object&&self,V=H||z||Function("return this")(),G="object"==typeof t&&t&&!t.nodeType&&t,W=G&&"object"==typeof r&&r&&!r.nodeType&&r,$=W&&W.exports===G&&H.process,Y=function(){try{return $&&$.binding("util")}catch(e){}}(),J=Y&&Y.isTypedArray;function X(e,t){for(var r=-1,n=e?e.length:0;++r<n;)if(t(e[r],r,e))return!0;return!1}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){var t=-1,r=Array(e.size);return e.forEach(function(e){r[++t]=e}),r}var te,re=Array.prototype,ne=Function.prototype,ie=Object.prototype,oe=V["__core-js_shared__"],se=(te=/[^.]+$/.exec(oe&&oe.keys&&oe.keys.IE_PROTO||""))?"Symbol(src)_1."+te:"",ae=ne.toString,ue=ie.hasOwnProperty,ce=ie.toString,fe=RegExp("^"+ae.call(ue).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),le=V.Symbol,he=V.Uint8Array,pe=ie.propertyIsEnumerable,de=re.splice,ye=function(e,t){return function(r){return e(t(r))}}(Object.keys,Object),ge=Math.max,me=$e(V,"DataView"),be=$e(V,"Map"),ve=$e(V,"Promise"),_e=$e(V,"Set"),we=$e(V,"WeakMap"),Se=$e(Object,"create"),ke=rt(me),Ee=rt(be),Ae=rt(ve),xe=rt(_e),Ie=rt(we),Te=le?le.prototype:void 0,Be=Te?Te.valueOf:void 0,Ce=Te?Te.toString:void 0;function Pe(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 Oe(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 Re(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 Ne(e){var t=-1,r=e?e.length:0;for(this.__data__=new Re;++t<r;)this.add(e[t])}function Le(e){this.__data__=new Oe(e)}function Ke(e,t){var r=at(e)||st(e)?function(e,t){for(var r=-1,n=Array(e);++r<e;)n[r]=t(r);return n}(e.length,String):[],n=r.length,i=!!n;for(var o in e)!t&&!ue.call(e,o)||i&&("length"==o||Je(o,n))||r.push(o);return r}function je(e,t){for(var r=e.length;r--;)if(ot(e[r][0],t))return r;return-1}function Me(e,t){for(var r=0,n=(t=Xe(t,e)?[t]:ze(t)).length;null!=e&&r<n;)e=e[tt(t[r++])];return r&&r==n?e:void 0}function De(e,t){return null!=e&&t in Object(e)}function Ue(e,t,r,n,i){return e===t||(null==e||null==t||!lt(e)&&!ht(t)?e!=e&&t!=t:function(e,t,r,n,i,o){var s=at(e),u=at(t),c=p,f=p;s||(c=(c=Ye(e))==h?w:c),u||(f=(f=Ye(t))==h?w:f);var l=c==w&&!Z(e),d=f==w&&!Z(t),y=c==f;if(y&&!l)return o||(o=new Le),s||dt(e)?Ve(e,t,r,n,i,o):Ge(e,t,c,r,n,i,o);if(!(i&a)){var g=l&&ue.call(e,"__wrapped__"),m=d&&ue.call(t,"__wrapped__");if(g||m){var b=g?e.value():e,v=m?t.value():t;return o||(o=new Le),r(b,v,n,i,o)}}return!!y&&(o||(o=new Le),function(e,t,r,n,i,o){var s=i&a,u=yt(e),c=u.length;if(c!=yt(t).length&&!s)return!1;for(var f=c;f--;){var l=u[f];if(!(s?l in t:ue.call(t,l)))return!1}var h=o.get(e);if(h&&o.get(t))return h==t;var p=!0;o.set(e,t),o.set(t,e);for(var d=s;++f<c;){var y=e[l=u[f]],g=t[l];if(n)var m=s?n(g,y,l,t,e,o):n(y,g,l,e,t,o);if(!(void 0===m?y===g||r(y,g,n,i,o):m)){p=!1;break}d||(d="constructor"==l)}if(p&&!d){var b=e.constructor,v=t.constructor;b!=v&&"constructor"in e&&"constructor"in t&&!("function"==typeof b&&b instanceof b&&"function"==typeof v&&v instanceof v)&&(p=!1)}return o.delete(e),o.delete(t),p}(e,t,r,n,i,o))}(e,t,Ue,r,n,i))}function Fe(e){return!(!lt(e)||function(e){return!!se&&se in e}(e))&&(ct(e)||Z(e)?fe:M).test(rt(e))}function qe(e){return"function"==typeof e?e:null==e?gt:"object"==typeof e?at(e)?function(e,t){return Xe(e)&&Ze(t)?Qe(tt(e),t):function(r){var n=function(e,t,r){var n=null==e?void 0:Me(e,t);return void 0===n?r:n}(r,e);return void 0===n&&n===t?function(e,t){return null!=e&&function(e,t,r){for(var n,i=-1,o=(t=Xe(t,e)?[t]:ze(t)).length;++i<o;){var s=tt(t[i]);if(!(n=null!=e&&r(e,s)))break;e=e[s]}return n||!!(o=e?e.length:0)&&ft(o)&&Je(s,o)&&(at(e)||st(e))}(e,t,De)}(r,e):Ue(t,n,void 0,s|a)}}(e[0],e[1]):function(e){var t=function(e){for(var t=yt(e),r=t.length;r--;){var n=t[r],i=e[n];t[r]=[n,i,Ze(i)]}return t}(e);return 1==t.length&&t[0][2]?Qe(t[0][0],t[0][1]):function(r){return r===e||function(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;){var f=(c=r[i])[0],l=e[f],h=c[1];if(u&&c[2]){if(void 0===l&&!(f in e))return!1}else{var p=new Le;if(n)var d=n(l,h,f,e,t,p);if(!(void 0===d?Ue(h,l,n,s|a,p):d))return!1}}return!0}(r,e,t)}}(e):function(e){return Xe(e)?function(e){return function(t){return null==t?void 0:t[e]}}(tt(e)):function(e){return function(t){return Me(t,e)}}(e)}(e)}function He(e){if(!function(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||ie)}(e))return ye(e);var t=[];for(var r in Object(e))ue.call(e,r)&&"constructor"!=r&&t.push(r);return t}function ze(e){return at(e)?e:et(e)}function Ve(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 Ne: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(!X(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 Ge(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 he(e),new he(t)));case d:case y:case _:return ot(+e,+t);case g:return e.name==t.name&&e.message==t.message;case k:case A:return e==t+"";case v:var c=Q;case E:var f=o&a;if(c||(c=ee),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=Ve(c(e),c(t),n,i,o,u);return u.delete(e),h;case x:if(Be)return Be.call(e)==Be.call(t)}return!1}function We(e,t){var r=e.__data__;return function(e){var t=typeof e;return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e}(t)?r["string"==typeof t?"string":"hash"]:r.map}function $e(e,t){var r=function(e,t){return null==e?void 0:e[t]}(e,t);return Fe(r)?r:void 0}Pe.prototype.clear=function(){this.__data__=Se?Se(null):{}},Pe.prototype.delete=function(e){return this.has(e)&&delete this.__data__[e]},Pe.prototype.get=function(e){var t=this.__data__;if(Se){var r=t[e];return r===o?void 0:r}return ue.call(t,e)?t[e]:void 0},Pe.prototype.has=function(e){var t=this.__data__;return Se?void 0!==t[e]:ue.call(t,e)},Pe.prototype.set=function(e,t){return this.__data__[e]=Se&&void 0===t?o:t,this},Oe.prototype.clear=function(){this.__data__=[]},Oe.prototype.delete=function(e){var t=this.__data__,r=je(t,e);return!(r<0||(r==t.length-1?t.pop():de.call(t,r,1),0))},Oe.prototype.get=function(e){var t=this.__data__,r=je(t,e);return r<0?void 0:t[r][1]},Oe.prototype.has=function(e){return je(this.__data__,e)>-1},Oe.prototype.set=function(e,t){var r=this.__data__,n=je(r,e);return n<0?r.push([e,t]):r[n][1]=t,this},Re.prototype.clear=function(){this.__data__={hash:new Pe,map:new(be||Oe),string:new Pe}},Re.prototype.delete=function(e){return We(this,e).delete(e)},Re.prototype.get=function(e){return We(this,e).get(e)},Re.prototype.has=function(e){return We(this,e).has(e)},Re.prototype.set=function(e,t){return We(this,e).set(e,t),this},Ne.prototype.add=Ne.prototype.push=function(e){return this.__data__.set(e,o),this},Ne.prototype.has=function(e){return this.__data__.has(e)},Le.prototype.clear=function(){this.__data__=new Oe},Le.prototype.delete=function(e){return this.__data__.delete(e)},Le.prototype.get=function(e){return this.__data__.get(e)},Le.prototype.has=function(e){return this.__data__.has(e)},Le.prototype.set=function(e,t){var r=this.__data__;if(r instanceof Oe){var i=r.__data__;if(!be||i.length<n-1)return i.push([e,t]),this;r=this.__data__=new Re(i)}return r.set(e,t),this};var Ye=function(e){return ce.call(e)};function Je(e,t){return!!(t=null==t?c:t)&&("number"==typeof e||U.test(e))&&e>-1&&e%1==0&&e<t}function Xe(e,t){if(at(e))return!1;var r=typeof e;return!("number"!=r&&"symbol"!=r&&"boolean"!=r&&null!=e&&!pt(e))||P.test(e)||!C.test(e)||null!=t&&e in Object(t)}function Ze(e){return e==e&&!lt(e)}function Qe(e,t){return function(r){return null!=r&&r[e]===t&&(void 0!==t||e in Object(r))}}(me&&Ye(new me(new ArrayBuffer(1)))!=B||be&&Ye(new be)!=v||ve&&Ye(ve.resolve())!=S||_e&&Ye(new _e)!=E||we&&Ye(new we)!=I)&&(Ye=function(e){var t=ce.call(e),r=t==w?e.constructor:void 0,n=r?rt(r):void 0;if(n)switch(n){case ke:return B;case Ee:return v;case Ae:return S;case xe:return E;case Ie:return I}return t});var et=it(function(e){e=function(e){return null==e?"":function(e){if("string"==typeof e)return e;if(pt(e))return Ce?Ce.call(e):"";var t=e+"";return"0"==t&&1/e==-u?"-0":t}(e)}(e);var t=[];return O.test(e)&&t.push(""),e.replace(R,function(e,r,n,i){t.push(n?i.replace(L,"$1"):r||e)}),t});function tt(e){if("string"==typeof e||pt(e))return e;var t=e+"";return"0"==t&&1/e==-u?"-0":t}function rt(e){if(null!=e){try{return ae.call(e)}catch(e){}try{return e+""}catch(e){}}return""}var nt=function(e){return function(t,r,n){var i=Object(t);if(!ut(t)){var o=qe(r);t=yt(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(e,t,r){var n=e?e.length:0;if(!n)return-1;var i=null==r?0:function(e){var t=function(e){return e?(e=function(e){if("number"==typeof e)return e;if(pt(e))return l;if(lt(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=lt(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=e.replace(N,"");var r=j.test(e);return r||D.test(e)?q(e.slice(2),r?2:8):K.test(e)?l:+e}(e))===u||e===-u?(e<0?-1:1)*f:e==e?e:0:0===e?e:0}(e),r=t%1;return t==t?r?t-r:t:0}(r);return i<0&&(i=ge(n+i,0)),function(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,qe(t),i)});function it(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(it.Cache||Re),r}function ot(e,t){return e===t||e!=e&&t!=t}function st(e){return function(e){return ht(e)&&ut(e)}(e)&&ue.call(e,"callee")&&(!pe.call(e,"callee")||ce.call(e)==h)}it.Cache=Re;var at=Array.isArray;function ut(e){return null!=e&&ft(e.length)&&!ct(e)}function ct(e){var t=lt(e)?ce.call(e):"";return t==m||t==b}function ft(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=c}function lt(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function ht(e){return!!e&&"object"==typeof e}function pt(e){return"symbol"==typeof e||ht(e)&&ce.call(e)==x}var dt=J?function(e){return function(t){return e(t)}}(J):function(e){return ht(e)&&ft(e.length)&&!!F[ce.call(e)]};function yt(e){return ut(e)?Ke(e):He(e)}function gt(e){return e}r.exports=nt}).call(this,r(6),r(27)(e))},function(e,t,r){"use strict";var n=r(139).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){return void 0===t&&(t=0),e.split("").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){return e.split(":").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(14),i=r(12),o=r(9),s=/^https?:\/\/[^/]+\/(ip(f|n)s)\/((\w+).*)/,a=/^\/(ip(f|n)s)\/((\w+).*)/;function u(e){try{return o.isCID(new o(e))}catch(e){return!1}}function c(e,t){const r=l(e);if(!r)return!1;const n=r.match(t);return!!n&&("ipfs"===n[1]&&u(n[4]))}function f(e,t){const r=l(e);if(!r)return!1;const n=r.match(t);return!!n&&"ipns"===n[1]}function l(e){return t.isBuffer(e)?n.encode(e):"string"==typeof e&&e}e.exports={multihash:function(e){const r=l(e);try{const o=new t(n.decode(r));return i.decode(o),!0}catch(e){return!1}},cid:u,ipfsUrl:e=>c(e,s),ipnsUrl:e=>f(e,s),url:e=>c(e,s)||f(e,s),urlPattern:s,ipfsPath:e=>c(e,a),ipnsPath:e=>f(e,a),path:e=>c(e,a)||f(e,a),pathPattern:a,urlOrPath:e=>c(e,s)||f(e,s)||c(e,a)||f(e,a)}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(t){const n=r(14),i=r(986),o=r(51);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}e.exports=class{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){return this.get(e).multiaddrs.toArray()}remove(e){const t=s(e);this._peers[t]&&delete this._peers[t]}}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(e){const n=r(270),i=r(271)(),o=r(988),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(12),i=r(993);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,s=n;r&&(s=((e,t)=>{if(e)return n(e);n(null,t.slice(0,r))}));try{i=o.createHash(t)}catch(e){return s(e)}i(e,s)},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(270),i=r(271)();function o(e){return Promise.all([i.subtle.exportKey("jwk",e.privateKey),i.subtle.exportKey("jwk",e.publicKey)])}t.utils=r(996),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,function(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"])}(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(15).bignum;t.toBase64=function(t,r){return t.toArrayLike(e,"be",r).toString("base64").replace(/(=*)$/,"").replace(/\+/g,"-").replace(/\//g,"_")},t.toBn=function(t){return new n(e.from(t,"base64"))}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";const n=r(494);e.exports=function(e){if(!e||"number"!=typeof e)throw new Error("first argument must be a Number bigger than 0");return n.getRandomValues(new Uint8Array(e))}},function(e,t,r){!function(t,r){e.exports=r()}(0,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(){return e.default}:function(){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;var o=(n=n||new Map).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(-1!==(s=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){return e===t};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");f=!!e.replace(g,function(e,t){var n=r.indexOf(t);return++l[n],""})}else if(Array.isArray(e))for(var m=0;m<e.length;++m){for(var b=!1,v=0;v<r.length&&!1===b;++v)b=s(r[v],e[m],a)&&v;!1!==b?++l[b]:f=!0}else for(var _=Object.getOwnPropertyNames(e),w=0;w<_.length;++w){var S=_[w],k=r.indexOf(S);if(-1!==k){if(o&&!s(o[S],e[S],a))return!1;++l[k]}else f=!0}for(var E=!1,A=0;A<l.length;++A)if(E=E||!!l[A],n.once&&l[A]>1||!n.part&&!l[A])return!1;return(!n.only||!f)&&E},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;"string"==typeof(n=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;return Error.prepareStackTrace=r,t.formatStack(i).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){return t.assert("string"==typeof r||e.isBuffer(r),"value must be string or buffer"),(e.isBuffer(r)?r:e.from(r,n||"binary")).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(){if(!t){t=!0;for(var r=arguments.length,n=Array(r),i=0;i<r;i++)n[i]=arguments[i];e.apply(null,n)}};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;)y[d=h.shift()]||(y[d]={}),y=y[d];y[d=h.shift()]=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}}();var o=r(0),s=r(11),a=r(1),u=r(6),c=null,f=null,l={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=l.Any=function(){function e(){(function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")})(this,e),f=f||r(4),this.isJoi=!0,this._type="any",this._settings=null,this._valids=new l.Set,this._invalids=new l.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(){return this},e.prototype.createError=function(e,t,r,n){var i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:this._flags;return u.create(e,t,r,n,i)},e.prototype.createOverrideError=function(e,t,r,n,i,o){return u.create(e,t,r,n,this._flags,i,o)},e.prototype.checkOptions=function(e){var t=r(21).options.validate(e);if(t.error)throw new Error(t.error.details[0].message)},e.prototype.clone=function(){var e=Object.create(Object.getPrototypeOf(this));e.isJoi=!0,e._currentJoi=this._currentJoi,e._type=this._type,e._settings=this._settings,e._baseType=this._baseType,e._valids=this._valids.slice(),e._invalids=this._invalids.slice(),e._tests=this._tests.slice(),e._refs=this._refs.slice(),e._flags=o.clone(this._flags),e._description=this._description,e._unit=this._unit,e._notes=this._notes.slice(),e._tags=this._tags.slice(),e._examples=this._examples.slice(),e._meta=this._meta.slice(),e._inner={};for(var t=Object.keys(this._inner),r=0;r<t.length;++r){var n=t[r];e._inner[n]=this._inner[n]?this._inner[n].slice():null}return e},e.prototype.concat=function(e){o.assert(e instanceof l.Any,"Invalid schema object"),o.assert("any"===this._type||"any"===e._type||e._type===this._type,"Cannot merge type",this._type,"with another type:",e._type);var t=this.clone();if("any"===this._type&&"any"!==e._type){for(var r=e.clone(),n=["_settings","_valids","_invalids","_tests","_refs","_flags","_description","_unit","_notes","_tags","_examples","_meta","_inner"],i=0;i<n.length;++i)r[n[i]]=t[n[i]];t=r}t._settings=t._settings?s.concat(t._settings,e._settings):e._settings,t._valids.merge(e._valids,e._invalids),t._invalids.merge(e._invalids,e._valids),t._tests=t._tests.concat(e._tests),t._refs=t._refs.concat(e._refs),o.merge(t._flags,e._flags),t._description=e._description||t._description,t._unit=e._unit||t._unit,t._notes=t._notes.concat(e._notes),t._tags=t._tags.concat(e._tags),t._examples=t._examples.concat(e._examples),t._meta=t._meta.concat(e._meta);for(var a=Object.keys(e._inner),u="object"===t._type,c=0;c<a.length;++c){var f=a[c],h=e._inner[f];if(h){var p=t._inner[f];if(p)if(u&&"children"===f){for(var d={},y=0;y<p.length;++y)d[p[y].key]=y;for(var g=0;g<h.length;++g){var m=h[g].key;d[m]>=0?p[d[m]]={key:m,schema:p[d[m]].schema.concat(h[g].schema)}:p.push(h[g])}}else t._inner[f]=t._inner[f].concat(h);else t._inner[f]=h.slice()}}return t},e.prototype._test=function(e,t,r,n){var i=this.clone();return i._tests.push({func:r,name:e,arg:t,options:n}),i},e.prototype.options=function(e){o.assert(!e.context,"Cannot override context"),this.checkOptions(e);var t=this.clone();return t._settings=s.concat(t._settings,e),t},e.prototype.strict=function(e){var t=this.clone(),r=void 0!==e&&!e;return t._settings=s.concat(t._settings,{convert:r}),t},e.prototype.raw=function(e){var t=void 0===e||e;if(this._flags.raw===t)return this;var r=this.clone();return r._flags.raw=t,r},e.prototype.error=function(e){o.assert(e&&(e instanceof Error||"function"==typeof e),"Must provide a valid Error object or a function");var t=this.clone();return t._flags.error=e,t},e.prototype.allow=function(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];var n=this.clone();t=o.flatten(t);for(var i=0;i<t.length;++i){var s=t[i];o.assert(void 0!==s,"Cannot call allow/valid/invalid with undefined"),n._invalids.remove(s),n._valids.add(s,n._refs)}return n},e.prototype.valid=function(){var e=this.allow.apply(this,arguments);return e._flags.allowOnly=!0,e},e.prototype.invalid=function(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];var n=this.clone();t=o.flatten(t);for(var i=0;i<t.length;++i){var s=t[i];o.assert(void 0!==s,"Cannot call allow/valid/invalid with undefined"),n._valids.remove(s),n._invalids.add(s,n._refs)}return n},e.prototype.required=function(){if("required"===this._flags.presence)return this;var e=this.clone();return e._flags.presence="required",e},e.prototype.optional=function(){if("optional"===this._flags.presence)return this;var e=this.clone();return e._flags.presence="optional",e},e.prototype.forbidden=function(){if("forbidden"===this._flags.presence)return this;var e=this.clone();return e._flags.presence="forbidden",e},e.prototype.strip=function(){if(this._flags.strip)return this;var e=this.clone();return e._flags.strip=!0,e},e.prototype.applyFunctionToChildren=function(e,t,r,n){if(1!==(e=[].concat(e)).length||""!==e[0]){n=n?n+".":"";var i=(""===e[0]?e.slice(1):e).map(function(e){return n+e});throw new Error("unknown key(s) "+i.join(", "))}return this[t].apply(this,r)},e.prototype.default=function(e,t){"function"!=typeof e||a.isRef(e)||(!e.description&&t&&(e.description=t),this._flags.func||o.assert("string"==typeof e.description&&e.description.length>0,"description must be provided when default value is a function"));var r=this.clone();return r._flags.default=e,a.push(r._refs,e),r},e.prototype.empty=function(e){var t=this.clone();return void 0===e?delete t._flags.empty:t._flags.empty=f.schema(this._currentJoi,e),t},e.prototype.when=function(e,t){o.assert(t&&"object"===(void 0===t?"undefined":n(t)),"Invalid options"),o.assert(void 0!==t.then||void 0!==t.otherwise,'options must have at least one of "then" or "otherwise"');var i=t.hasOwnProperty("then")?this.concat(f.schema(this._currentJoi,t.then)):void 0,s=t.hasOwnProperty("otherwise")?this.concat(f.schema(this._currentJoi,t.otherwise)):void 0;c=c||r(10);var a={then:i,otherwise:s};Object.prototype.hasOwnProperty.call(t,"is")&&(a.is=t.is);var u=c.when(e,a);return u._flags.presence="ignore",u._baseType=this,u},e.prototype.description=function(e){o.assert(e&&"string"==typeof e,"Description must be a non-empty string");var t=this.clone();return t._description=e,t},e.prototype.notes=function(e){o.assert(e&&("string"==typeof e||Array.isArray(e)),"Notes must be a non-empty string or array");var t=this.clone();return t._notes=t._notes.concat(e),t},e.prototype.tags=function(e){o.assert(e&&("string"==typeof e||Array.isArray(e)),"Tags must be a non-empty string or array");var t=this.clone();return t._tags=t._tags.concat(e),t},e.prototype.meta=function(e){o.assert(void 0!==e,"Meta cannot be undefined");var t=this.clone();return t._meta=t._meta.concat(e),t},e.prototype.example=function(){o.assert(1===arguments.length,"Missing example");var e=arguments.length<=0?void 0:arguments[0],t=this.clone();return t._examples.push(e),t},e.prototype.unit=function(e){o.assert(e&&"string"==typeof e,"Unit name must be a non-empty string");var t=this.clone();return t._unit=e,t},e.prototype._prepareEmptyValue=function(e){return"string"==typeof e&&this._flags.trim?e.trim():e},e.prototype._validate=function(e,t,r,n){var i=this,c=e;t=t||{key:"",path:[],parent:null,reference:n},this._settings&&(r=s.concat(r,this._settings));var f=[],h=function(){var n=void 0;if(void 0!==e)n=i._flags.raw?c:e;else if(r.noDefaults)n=e;else if(a.isRef(i._flags.default))n=i._flags.default(t.parent,r);else if("function"!=typeof i._flags.default||i._flags.func&&!i._flags.default.description)n=o.clone(i._flags.default);else{var s=void 0;null!==t.parent&&i._flags.default.length>0&&(s=[o.clone(t.parent),r]);var u=l._try(i._flags.default,s);n=u.value,u.error&&f.push(i.createError("any.default",{error:u.error},t,r))}if(f.length&&"function"==typeof i._flags.error){var h=i._flags.error.call(i,f);f="string"==typeof h?[i.createOverrideError("override",{reason:f},t,r,h)]:[].concat(h).map(function(e){return e instanceof Error?e:i.createOverrideError(e.type||"override",e.context,t,r,e.message,e.template)})}return{value:i._flags.strip?void 0:n,finalValue:n,errors:f.length?f:null}};if(this._coerce){var p=this._coerce.call(this,e,t,r);if(p.errors)return e=p.value,f=f.concat(p.errors),h();e=p.value}this._flags.empty&&!this._flags.empty._validate(this._prepareEmptyValue(e),null,l.defaults).errors&&(e=void 0);var d=this._flags.presence||r.presence;if("optional"===d){if(void 0===e){if(!this._flags.hasOwnProperty("default")||void 0!==this._flags.default||"object"!==this._type)return h();e={}}}else{if("required"===d&&void 0===e)return f.push(this.createError("any.required",null,t,r)),h();if("forbidden"===d)return void 0===e?h():(f.push(this.createError("any.unknown",null,t,r)),h())}if(this._valids.has(e,t,r,this._flags.insensitive))return h();if(this._invalids.has(e,t,r,this._flags.insensitive)&&(f.push(this.createError(""===e?"any.empty":"any.invalid",{value:e,invalids:this._invalids.values({stripUndefined:!0})},t,r)),r.abortEarly||void 0===e))return h();if(this._base){var y=this._base.call(this,e,t,r);if(y.errors)return e=y.value,f=f.concat(y.errors),h();if(y.value!==e){if(e=y.value,this._valids.has(e,t,r,this._flags.insensitive))return h();if(this._invalids.has(e,t,r,this._flags.insensitive)&&(f.push(this.createError(""===e?"any.empty":"any.invalid",{value:e,invalids:this._invalids.values({stripUndefined:!0})},t,r)),r.abortEarly))return h()}}if(this._flags.allowOnly&&(f.push(this.createError("any.allowOnly",{value:e,valids:this._valids.values({stripUndefined:!0})},t,r)),r.abortEarly))return h();for(var g=0;g<this._tests.length;++g){var m=this._tests[g].func.call(this,e,t,r);if(m instanceof u.Err){if(f.push(m),r.abortEarly)return h()}else e=m}return h()},e.prototype._validateWithOptions=function(e,t,r){t&&this.checkOptions(t);var n=s.concat(l.defaults,t),i=this._validate(e,null,n),o=u.process(i.errors,e);return r?r(o,i.value):{error:o,value:i.value,then:function(e,t){return o?Promise.reject(o).catch(t):Promise.resolve(i.value).then(e)},catch:function(e){return o?Promise.reject(o).catch(e):Promise.resolve(i.value)}}},e.prototype.validate=function(e,t,r){return"function"==typeof t?this._validateWithOptions(e,null,t):this._validateWithOptions(e,t,r)},e.prototype.describe=function(){var e=this,t={type:this._type},r=Object.keys(this._flags);if(r.length)if(["empty","default","lazy","label"].some(function(t){return e._flags.hasOwnProperty(t)})){t.flags={};for(var n=0;n<r.length;++n){var i=r[n];"empty"===i?t.flags[i]=this._flags[i].describe():"default"===i?a.isRef(this._flags[i])?t.flags[i]=this._flags[i].toString():"function"==typeof this._flags[i]?t.flags[i]={description:this._flags[i].description,function:this._flags[i]}:t.flags[i]=this._flags[i]:"lazy"===i||"label"===i||(t.flags[i]=this._flags[i])}}else t.flags=this._flags;this._settings&&(t.options=o.clone(this._settings)),this._baseType&&(t.base=this._baseType.describe()),this._description&&(t.description=this._description),this._notes.length&&(t.notes=this._notes),this._tags.length&&(t.tags=this._tags),this._meta.length&&(t.meta=this._meta),this._examples.length&&(t.examples=this._examples),this._unit&&(t.unit=this._unit);var s=this._valids.values();s.length&&(t.valids=s.map(function(e){return a.isRef(e)?e.toString():e}));var u=this._invalids.values();u.length&&(t.invalids=u.map(function(e){return a.isRef(e)?e.toString():e})),t.rules=[];for(var c=0;c<this._tests.length;++c){var f=this._tests[c],l={name:f.name};void 0!==f.arg&&(l.arg=a.isRef(f.arg)?f.arg.toString():f.arg);var h=f.options;if(h){if(h.hasRef){l.arg={};for(var p=Object.keys(f.arg),d=0;d<p.length;++d){var y=p[d],g=f.arg[y];l.arg[y]=a.isRef(g)?g.toString():g}}"string"==typeof h.description?l.description=h.description:"function"==typeof h.description&&(l.description=h.description(l.arg))}t.rules.push(l)}t.rules.length||delete t.rules;var m=this._getLabel();return m&&(t.label=m),t},e.prototype.label=function(e){o.assert(e&&"string"==typeof e,"Label name must be a non-empty string");var t=this.clone();return t._flags.label=e,t},e.prototype._getLabel=function(e){return this._flags.label||e},i(e,[{key:"schemaType",get:function(){return this._type}}]),e}(),l.Any.prototype.isImmutable=!0,l.Any.prototype.only=l.Any.prototype.equal=l.Any.prototype.valid,l.Any.prototype.disallow=l.Any.prototype.not=l.Any.prototype.invalid,l.Any.prototype.exist=l.Any.prototype.required,l._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(){return u.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function a(e,t){if(s()<t)throw new RangeError("Invalid typed array length");return u.TYPED_ARRAY_SUPPORT?(e=new Uint8Array(t)).__proto__=u.prototype:(null===e&&(e=new u(t)),e.length=t),e}function u(e,t,r){if(!(u.TYPED_ARRAY_SUPPORT||this instanceof u))return new u(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 l(this,e)}return c(this,e,t,r)}function c(e,t,r,n){if("number"==typeof t)throw new TypeError('"value" argument must not be a number');return"undefined"!=typeof ArrayBuffer&&t instanceof ArrayBuffer?function(e,t,r,n){if(t.byteLength,r<0||t.byteLength<r)throw new RangeError("'offset' is out of bounds");if(t.byteLength<r+(n||0))throw new RangeError("'length' is out of bounds");return t=void 0===r&&void 0===n?new Uint8Array(t):void 0===n?new Uint8Array(t,r):new Uint8Array(t,r,n),u.TYPED_ARRAY_SUPPORT?(e=t).__proto__=u.prototype:e=h(e,t),e}(e,t,r,n):"string"==typeof t?function(e,t,r){if("string"==typeof r&&""!==r||(r="utf8"),!u.isEncoding(r))throw new TypeError('"encoding" must be a valid string encoding');var n=0|d(t,r),i=(e=a(e,n)).write(t,r);return i!==n&&(e=e.slice(0,i)),e}(e,t,r):function(e,t){if(u.isBuffer(t)){var r=0|p(t.length);return 0===(e=a(e,r)).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||function(e){return e!=e}(t.length)?a(e,0):h(e,t);if("Buffer"===t.type&&o(t.data))return h(e,t.data)}throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}(e,t)}function f(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 l(e,t){if(f(t),e=a(e,t<0?0:0|p(t)),!u.TYPED_ARRAY_SUPPORT)for(var r=0;r<t;++r)e[r]=0;return e}function h(e,t){var r=t.length<0?0:0|p(t.length);e=a(e,r);for(var n=0;n<r;n+=1)e[n]=255&t[n];return e}function p(e){if(e>=s())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+s().toString(16)+" bytes");return 0|e}function d(e,t){if(u.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 U(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return F(e).length;default:if(n)return U(e).length;t=(""+t).toLowerCase(),n=!0}}function y(e,t,r){var n=e[t];e[t]=e[r],e[r]=n}function g(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=u.from(t,n)),u.isBuffer(t))return 0===t.length?-1:m(e,t,r,n,i);if("number"==typeof t)return t&=255,u.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(e,t,r):Uint8Array.prototype.lastIndexOf.call(e,t,r):m(e,[t],r,n,i);throw new TypeError("val must be string, number or Buffer")}function m(e,t,r,n,i){var o,s=1,a=e.length,u=t.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(e.length<2||t.length<2)return-1;s=2,a/=2,u/=2,r/=2}function c(e,t){return 1===s?e[t]:e.readUInt16BE(t*s)}if(i){var f=-1;for(o=r;o<a;o++)if(c(e,o)===c(t,-1===f?0:o-f)){if(-1===f&&(f=o),o-f+1===u)return f*s}else-1!==f&&(o-=o-f),f=-1}else for(r+u>a&&(r=a-u),o=r;o>=0;o--){for(var l=!0,h=0;h<u;h++)if(c(e,o+h)!==c(t,h)){l=!1;break}if(l)return o}return-1}function b(e,t,r,n){r=Number(r)||0;var i=e.length-r;n?(n=Number(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 v(e,t,r,n){return q(U(t,e.length-r),e,r,n)}function _(e,t,r,n){return q(function(e){for(var t=[],r=0;r<e.length;++r)t.push(255&e.charCodeAt(r));return t}(t),e,r,n)}function w(e,t,r,n){return _(e,t,r,n)}function S(e,t,r,n){return q(F(t),e,r,n)}function k(e,t,r,n){return q(function(e,t){for(var r,n,i,o=[],s=0;s<e.length&&!((t-=2)<0);++s)n=(r=e.charCodeAt(s))>>8,i=r%256,o.push(i),o.push(n);return o}(t,e.length-r),e,r,n)}function E(e,t,r){return 0===t&&r===e.length?n.fromByteArray(e):n.fromByteArray(e.slice(t,r))}function A(e,t,r){r=Math.min(e.length,r);for(var n=[],i=t;i<r;){var o,s,a,u,c=e[i],f=null,l=c>239?4:c>223?3:c>191?2:1;if(i+l<=r)switch(l){case 1:c<128&&(f=c);break;case 2:128==(192&(o=e[i+1]))&&(u=(31&c)<<6|63&o)>127&&(f=u);break;case 3:o=e[i+1],s=e[i+2],128==(192&o)&&128==(192&s)&&(u=(15&c)<<12|(63&o)<<6|63&s)>2047&&(u<55296||u>57343)&&(f=u);break;case 4:o=e[i+1],s=e[i+2],a=e[i+3],128==(192&o)&&128==(192&s)&&128==(192&a)&&(u=(15&c)<<18|(63&o)<<12|(63&s)<<6|63&a)>65535&&u<1114112&&(f=u)}null===f?(f=65533,l=1):f>65535&&(f-=65536,n.push(f>>>10&1023|55296),f=56320|1023&f),n.push(f),i+=l}return function(e){var t=e.length;if(t<=x)return String.fromCharCode.apply(String,e);for(var r="",n=0;n<t;)r+=String.fromCharCode.apply(String,e.slice(n,n+=x));return r}(n)}t.Buffer=u,t.SlowBuffer=function(e){return+e!=e&&(e=0),u.alloc(+e)},t.INSPECT_MAX_BYTES=50,u.TYPED_ARRAY_SUPPORT=void 0!==e.TYPED_ARRAY_SUPPORT?e.TYPED_ARRAY_SUPPORT:function(){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}}(),t.kMaxLength=s(),u.poolSize=8192,u._augment=function(e){return e.__proto__=u.prototype,e},u.from=function(e,t,r){return c(null,e,t,r)},u.TYPED_ARRAY_SUPPORT&&(u.prototype.__proto__=Uint8Array.prototype,u.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&u[Symbol.species]===u&&Object.defineProperty(u,Symbol.species,{value:null,configurable:!0})),u.alloc=function(e,t,r){return function(e,t,r,n){return f(t),t<=0?a(e,t):void 0!==r?"string"==typeof n?a(e,t).fill(r,n):a(e,t).fill(r):a(e,t)}(null,e,t,r)},u.allocUnsafe=function(e){return l(null,e)},u.allocUnsafeSlow=function(e){return l(null,e)},u.isBuffer=function(e){return!(null==e||!e._isBuffer)},u.compare=function(e,t){if(!u.isBuffer(e)||!u.isBuffer(t))throw new TypeError("Arguments must be Buffers");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},u.isEncoding=function(e){switch(String(e).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},u.concat=function(e,t){if(!o(e))throw new TypeError('"list" argument must be an Array of Buffers');if(0===e.length)return u.alloc(0);var r;if(void 0===t)for(t=0,r=0;r<e.length;++r)t+=e[r].length;var n=u.allocUnsafe(t),i=0;for(r=0;r<e.length;++r){var s=e[r];if(!u.isBuffer(s))throw new TypeError('"list" argument must be an Array of Buffers');s.copy(n,i),i+=s.length}return n},u.byteLength=d,u.prototype._isBuffer=!0,u.prototype.swap16=function(){var e=this.length;if(e%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var t=0;t<e;t+=2)y(this,t,t+1);return this},u.prototype.swap32=function(){var e=this.length;if(e%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var t=0;t<e;t+=4)y(this,t,t+3),y(this,t+1,t+2);return this},u.prototype.swap64=function(){var e=this.length;if(e%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var t=0;t<e;t+=8)y(this,t,t+7),y(this,t+1,t+6),y(this,t+2,t+5),y(this,t+3,t+4);return this},u.prototype.toString=function(){var e=0|this.length;return 0===e?"":0===arguments.length?A(this,0,e):function(e,t,r){var n=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if((r>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return B(this,t,r);case"utf8":case"utf-8":return A(this,t,r);case"ascii":return I(this,t,r);case"latin1":case"binary":return T(this,t,r);case"base64":return E(this,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return C(this,t,r);default:if(n)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),n=!0}}.apply(this,arguments)},u.prototype.equals=function(e){if(!u.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e||0===u.compare(this,e)},u.prototype.inspect=function(){var e="",r=t.INSPECT_MAX_BYTES;return this.length>0&&(e=this.toString("hex",0,r).match(/.{2}/g).join(" "),this.length>r&&(e+=" ... ")),"<Buffer "+e+">"},u.prototype.compare=function(e,t,r,n,i){if(!u.isBuffer(e))throw new TypeError("Argument must be a Buffer");if(void 0===t&&(t=0),void 0===r&&(r=e?e.length:0),void 0===n&&(n=0),void 0===i&&(i=this.length),t<0||r>e.length||n<0||i>this.length)throw new RangeError("out of range index");if(n>=i&&t>=r)return 0;if(n>=i)return-1;if(t>=r)return 1;if(t>>>=0,r>>>=0,n>>>=0,i>>>=0,this===e)return 0;for(var o=i-n,s=r-t,a=Math.min(o,s),c=this.slice(n,i),f=e.slice(t,r),l=0;l<a;++l)if(c[l]!==f[l]){o=c[l],s=f[l];break}return o<s?-1:s<o?1:0},u.prototype.includes=function(e,t,r){return-1!==this.indexOf(e,t,r)},u.prototype.indexOf=function(e,t,r){return g(this,e,t,r,!0)},u.prototype.lastIndexOf=function(e,t,r){return g(this,e,t,r,!1)},u.prototype.write=function(e,t,r,n){if(void 0===t)n="utf8",r=this.length,t=0;else if(void 0===r&&"string"==typeof t)n=t,r=this.length,t=0;else{if(!isFinite(t))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");t|=0,isFinite(r)?(r|=0,void 0===n&&(n="utf8")):(n=r,r=void 0)}var i=this.length-t;if((void 0===r||r>i)&&(r=i),e.length>0&&(r<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var o=!1;;)switch(n){case"hex":return b(this,e,t,r);case"utf8":case"utf-8":return v(this,e,t,r);case"ascii":return _(this,e,t,r);case"latin1":case"binary":return w(this,e,t,r);case"base64":return S(this,e,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return k(this,e,t,r);default:if(o)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),o=!0}},u.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var x=4096;function I(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 T(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 B(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+=D(e[o]);return i}function C(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 P(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 O(e,t,r,n,i,o){if(!u.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 R(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 N(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 L(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 K(e,t,r,n,o){return o||L(e,0,r,4),i.write(e,t,r,n,23,4),r+4}function j(e,t,r,n,o){return o||L(e,0,r,8),i.write(e,t,r,n,52,8),r+8}u.prototype.slice=function(e,t){var r,n=this.length;if(e=~~e,t=void 0===t?n:~~t,e<0?(e+=n)<0&&(e=0):e>n&&(e=n),t<0?(t+=n)<0&&(t=0):t>n&&(t=n),t<e&&(t=e),u.TYPED_ARRAY_SUPPORT)(r=this.subarray(e,t)).__proto__=u.prototype;else{var i=t-e;r=new u(i,void 0);for(var o=0;o<i;++o)r[o]=this[o+e]}return r},u.prototype.readUIntLE=function(e,t,r){e|=0,t|=0,r||P(e,t,this.length);for(var n=this[e],i=1,o=0;++o<t&&(i*=256);)n+=this[e+o]*i;return n},u.prototype.readUIntBE=function(e,t,r){e|=0,t|=0,r||P(e,t,this.length);for(var n=this[e+--t],i=1;t>0&&(i*=256);)n+=this[e+--t]*i;return n},u.prototype.readUInt8=function(e,t){return t||P(e,1,this.length),this[e]},u.prototype.readUInt16LE=function(e,t){return t||P(e,2,this.length),this[e]|this[e+1]<<8},u.prototype.readUInt16BE=function(e,t){return t||P(e,2,this.length),this[e]<<8|this[e+1]},u.prototype.readUInt32LE=function(e,t){return t||P(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},u.prototype.readUInt32BE=function(e,t){return t||P(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},u.prototype.readIntLE=function(e,t,r){e|=0,t|=0,r||P(e,t,this.length);for(var n=this[e],i=1,o=0;++o<t&&(i*=256);)n+=this[e+o]*i;return n>=(i*=128)&&(n-=Math.pow(2,8*t)),n},u.prototype.readIntBE=function(e,t,r){e|=0,t|=0,r||P(e,t,this.length);for(var n=t,i=1,o=this[e+--n];n>0&&(i*=256);)o+=this[e+--n]*i;return o>=(i*=128)&&(o-=Math.pow(2,8*t)),o},u.prototype.readInt8=function(e,t){return t||P(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},u.prototype.readInt16LE=function(e,t){t||P(e,2,this.length);var r=this[e]|this[e+1]<<8;return 32768&r?4294901760|r:r},u.prototype.readInt16BE=function(e,t){t||P(e,2,this.length);var r=this[e+1]|this[e]<<8;return 32768&r?4294901760|r:r},u.prototype.readInt32LE=function(e,t){return t||P(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},u.prototype.readInt32BE=function(e,t){return t||P(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},u.prototype.readFloatLE=function(e,t){return t||P(e,4,this.length),i.read(this,e,!0,23,4)},u.prototype.readFloatBE=function(e,t){return t||P(e,4,this.length),i.read(this,e,!1,23,4)},u.prototype.readDoubleLE=function(e,t){return t||P(e,8,this.length),i.read(this,e,!0,52,8)},u.prototype.readDoubleBE=function(e,t){return t||P(e,8,this.length),i.read(this,e,!1,52,8)},u.prototype.writeUIntLE=function(e,t,r,n){e=+e,t|=0,r|=0,n||O(this,e,t,r,Math.pow(2,8*r)-1,0);var i=1,o=0;for(this[t]=255&e;++o<r&&(i*=256);)this[t+o]=e/i&255;return t+r},u.prototype.writeUIntBE=function(e,t,r,n){e=+e,t|=0,r|=0,n||O(this,e,t,r,Math.pow(2,8*r)-1,0);var i=r-1,o=1;for(this[t+i]=255&e;--i>=0&&(o*=256);)this[t+i]=e/o&255;return t+r},u.prototype.writeUInt8=function(e,t,r){return e=+e,t|=0,r||O(this,e,t,1,255,0),u.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[t]=255&e,t+1},u.prototype.writeUInt16LE=function(e,t,r){return e=+e,t|=0,r||O(this,e,t,2,65535,0),u.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):R(this,e,t,!0),t+2},u.prototype.writeUInt16BE=function(e,t,r){return e=+e,t|=0,r||O(this,e,t,2,65535,0),u.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):R(this,e,t,!1),t+2},u.prototype.writeUInt32LE=function(e,t,r){return e=+e,t|=0,r||O(this,e,t,4,4294967295,0),u.TYPED_ARRAY_SUPPORT?(this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e):N(this,e,t,!0),t+4},u.prototype.writeUInt32BE=function(e,t,r){return e=+e,t|=0,r||O(this,e,t,4,4294967295,0),u.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):N(this,e,t,!1),t+4},u.prototype.writeIntLE=function(e,t,r,n){if(e=+e,t|=0,!n){var i=Math.pow(2,8*r-1);O(this,e,t,r,i-1,-i)}var o=0,s=1,a=0;for(this[t]=255&e;++o<r&&(s*=256);)e<0&&0===a&&0!==this[t+o-1]&&(a=1),this[t+o]=(e/s>>0)-a&255;return t+r},u.prototype.writeIntBE=function(e,t,r,n){if(e=+e,t|=0,!n){var i=Math.pow(2,8*r-1);O(this,e,t,r,i-1,-i)}var o=r-1,s=1,a=0;for(this[t+o]=255&e;--o>=0&&(s*=256);)e<0&&0===a&&0!==this[t+o+1]&&(a=1),this[t+o]=(e/s>>0)-a&255;return t+r},u.prototype.writeInt8=function(e,t,r){return e=+e,t|=0,r||O(this,e,t,1,127,-128),u.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),e<0&&(e=255+e+1),this[t]=255&e,t+1},u.prototype.writeInt16LE=function(e,t,r){return e=+e,t|=0,r||O(this,e,t,2,32767,-32768),u.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):R(this,e,t,!0),t+2},u.prototype.writeInt16BE=function(e,t,r){return e=+e,t|=0,r||O(this,e,t,2,32767,-32768),u.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):R(this,e,t,!1),t+2},u.prototype.writeInt32LE=function(e,t,r){return e=+e,t|=0,r||O(this,e,t,4,2147483647,-2147483648),u.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24):N(this,e,t,!0),t+4},u.prototype.writeInt32BE=function(e,t,r){return e=+e,t|=0,r||O(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),u.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):N(this,e,t,!1),t+4},u.prototype.writeFloatLE=function(e,t,r){return K(this,e,t,!0,r)},u.prototype.writeFloatBE=function(e,t,r){return K(this,e,t,!1,r)},u.prototype.writeDoubleLE=function(e,t,r){return j(this,e,t,!0,r)},u.prototype.writeDoubleBE=function(e,t,r){return j(this,e,t,!1,r)},u.prototype.copy=function(e,t,r,n){if(r||(r=0),n||0===n||(n=this.length),t>=e.length&&(t=e.length),t||(t=0),n>0&&n<r&&(n=r),n===r)return 0;if(0===e.length||0===this.length)return 0;if(t<0)throw new RangeError("targetStart out of bounds");if(r<0||r>=this.length)throw new RangeError("sourceStart out of bounds");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),e.length-t<n-r&&(n=e.length-t+r);var i,o=n-r;if(this===e&&r<t&&t<n)for(i=o-1;i>=0;--i)e[i+t]=this[i+r];else if(o<1e3||!u.TYPED_ARRAY_SUPPORT)for(i=0;i<o;++i)e[i+t]=this[i+r];else Uint8Array.prototype.set.call(e,this.subarray(r,r+o),t);return o},u.prototype.fill=function(e,t,r,n){if("string"==typeof e){if("string"==typeof t?(n=t,t=0,r=this.length):"string"==typeof r&&(n=r,r=this.length),1===e.length){var i=e.charCodeAt(0);i<256&&(e=i)}if(void 0!==n&&"string"!=typeof n)throw new TypeError("encoding must be a string");if("string"==typeof n&&!u.isEncoding(n))throw new TypeError("Unknown encoding: "+n)}else"number"==typeof e&&(e&=255);if(t<0||this.length<t||this.length<r)throw new RangeError("Out of range index");if(r<=t)return this;var o;if(t>>>=0,r=void 0===r?this.length:r>>>0,e||(e=0),"number"==typeof e)for(o=t;o<r;++o)this[o]=e;else{var s=u.isBuffer(e)?e:U(new u(e,n).toString()),a=s.length;for(o=0;o<r-t;++o)this[o+t]=s[o%a]}return this};var M=/[^+\/0-9A-Za-z-_]/g;function D(e){return e<16?"0"+e.toString(16):e.toString(16)}function U(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))>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 F(e){return n.toByteArray(function(e){if((e=function(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")}(e).replace(M,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function q(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}}).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};var i=r(0),o=r(20),s={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="",a=0;a<e.length;++a)o=o+(o.length?", ":"")+s.stringify(e[a],r);return r?"["+o+"]":o}return e.toString()}return JSON.stringify(e)}};t.Err=function(){function e(t,r,n,i,s,a,u){(function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")})(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=i,this.flags=s,this.message=a,this.template=u;var c=this.options.language;this.flags.label?this.context.label=this.flags.label:!c||""!==this.context.label&&null!==this.context.label||(this.context.label=c.root||o.errors.root)}return e.prototype.toString=function(){var e=this;if(this.message)return this.message;var t=void 0;this.template&&(t=this.template);var r=this.options.language;if(void 0===(t=t||i.reach(r,this.type)||i.reach(o.errors,this.type)))return'Error code "'+this.type+'" is not defined, your custom type is missing the correct language definition';var n=i.reach(r,"messages.wrapArrays");if("boolean"!=typeof n&&(n=o.errors.messages.wrapArrays),null===t){var a=s.stringify(this.context.reason,n);return n?a.slice(1,-1):a}var u=/\{\{\!?label\}\}/.test(t),c=t.length>2&&"!"===t[0]&&"!"===t[1];if(c&&(t=t.slice(2)),!u&&!c){var f=i.reach(r,"key");t="string"==typeof f?f+t:i.reach(o.errors,"key")+t}return t.replace(/\{\{(\!?)([^}]+)\}\}/g,function(t,r,o){var a=i.reach(e.context,o),u=s.stringify(a,n);return r&&e.options.escapeHtml?i.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})}}(e);if(i)return i;var o=new Error(r);return o.isJoi=!0,o.name="ValidationError",o.details=n,o._object=t,o.annotate=s.annotate,o},s.safeStringify=function(e,t){return JSON.stringify(e,s.serializer(),t)},s.serializer=function(){var e=[],t=[];return function(r,i){if(t.length>0){var o=t.indexOf(this);~o?(t.length=o+1,e.length=o+1,e[o]=r):(t.push(this),e.push(r)),~t.indexOf(i)&&(i=function(r,n){return t[0]===n?"[Circular ~]":"[Circular ~."+e.slice(0,t.indexOf(n)).join(".")+"]"}.call(this,r,i))}else t.push(i);if(i){var a=i[s.annotations];if(a){if(Array.isArray(i)){for(var u=[],c=0;c<i.length;++c)a.errors[c]&&u.push("_$idx$_"+a.errors[c].sort().join(", ")+"_$end$_"),u.push(i[c]);i=u}else{for(var f=Object.keys(a.errors),l=0;l<f.length;++l){var h=f[l];i[h+"_$key$_"+a.errors[h].sort().join(", ")+"_$end$_"]=i[h],i[h]=void 0}for(var p=Object.keys(a.missing),d=0;d<p.length;++d){var y=p[d];i["_$miss$_"+y+"|"+a.missing[y]+"_$end$_"]="__missing__"}}return i}}return i===1/0||i===-1/0||Number.isNaN(i)||"function"==typeof i||"symbol"===(void 0===i?"undefined":n(i))?"["+i.toString()+"]":i}},s.annotate=function(e){var t=e?"":"[31m",r=e?"":"[41m",o=e?"":"[0m";if("object"!==n(this._object))return this.details[0].message;for(var a=i.clone(this._object||{}),u=this.details.length-1;u>=0;--u)for(var c=u+1,f=this.details[u],l=f.path,h=a,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[s.annotations]=h[s.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=s.safeStringify(a,2).replace(/_\$key\$_([, \d]+)_\$end\$_\"/g,function(e,r){return'" '+t+"["+r+"]"+o}).replace(/\"_\$miss\$_([^\|]+)\|(\d+)_\$end\$_\"\: \"__missing__\"/g,function(e,n,i){return r+'"'+n+'"'+o+t+" ["+i+"]: -- missing --"+o}).replace(/\s*\"_\$idx\$_([, \d]+)_\$end\$_\",?\n(.*)/g,function(e,r,n){return"\n"+n+" "+t+"["+r+"]"+o}).replace(/"\[(NaN|Symbol.*|-?Infinity|function.*|\(.*)\]"/g,function(e,t){return t});b=b+"\n"+t;for(var v=0;v<this.details.length;++v){b=b+"\n["+(v+1)+"] "+this.details[v].message}return b+o}},function(e,t){var r,n,i=e.exports={};function o(){throw new Error("setTimeout has not been defined")}function s(){throw new Error("clearTimeout has not been defined")}function a(e){if(r===setTimeout)return setTimeout(e,0);if((r===o||!r)&&setTimeout)return r=setTimeout,setTimeout(e,0);try{return r(e,0)}catch(t){try{return r.call(null,e,0)}catch(t){return r.call(this,e,0)}}}!function(){try{r="function"==typeof setTimeout?setTimeout:o}catch(e){r=o}try{n="function"==typeof clearTimeout?clearTimeout:s}catch(e){n=s}}();var u,c=[],f=!1,l=-1;function h(){f&&u&&(f=!1,u.length?c=u.concat(c):l=-1,c.length&&p())}function p(){if(!f){var e=a(h);f=!0;for(var t=c.length;t;){for(u=c,c=[];++l<t;)u&&u[l].run();l=-1,t=c.length}u=null,f=!1,function(e){if(n===clearTimeout)return clearTimeout(e);if((n===s||!n)&&clearTimeout)return n=clearTimeout,clearTimeout(e);try{n(e)}catch(t){try{return n.call(null,e)}catch(t){return n.call(this,e)}}}(e)}}function d(e,t){this.fun=e,this.array=t}function y(){}i.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 d(e,t)),1!==c.length||f||a(p)},d.prototype.run=function(){this.fun.apply(null,this.array)},i.title="browser",i.browser=!0,i.env={},i.argv=[],i.version="",i.versions={},i.on=y,i.addListener=y,i.once=y,i.off=y,i.removeListener=y,i.removeAllListeners=y,i.emit=y,i.prependListener=y,i.prependOnceListener=y,i.listeners=function(e){return[]},i.binding=function(e){throw new Error("process.binding is not supported")},i.cwd=function(){return"/"},i.chdir=function(e){throw new Error("process.chdir is not supported")},i.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){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):function(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)}}(e,t))}var o=r(0),s=r(2),a=r(4),u=r(6),c=r(26),f=r(1),l=r(11),h={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 o.assert(this,"Must be invoked on a Joi instance."),this._defaults&&(e=this._defaults(e)),e._currentJoi=this,(r=e)._init.apply(r,function(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)}(t))},root:function(){var e=new s,t=e.clone();return s.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 o.assert(0===r.length,"Joi.any() does not allow arguments."),h.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 h.callWithDefaults.call(this,h.alternatives,t)},t.array=function(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];return o.assert(0===t.length,"Joi.array() does not allow arguments."),h.callWithDefaults.call(this,h.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 o.assert(0===t.length,"Joi.boolean() does not allow arguments."),h.callWithDefaults.call(this,h.boolean,t)},t.binary=function(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];return o.assert(0===t.length,"Joi.binary() does not allow arguments."),h.callWithDefaults.call(this,h.binary,t)},t.date=function(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];return o.assert(0===t.length,"Joi.date() does not allow arguments."),h.callWithDefaults.call(this,h.date,t)},t.func=function(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];return o.assert(0===t.length,"Joi.func() does not allow arguments."),h.callWithDefaults.call(this,h.func,t)},t.number=function(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];return o.assert(0===t.length,"Joi.number() does not allow arguments."),h.callWithDefaults.call(this,h.number,t)},t.object=function(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];return h.callWithDefaults.call(this,h.object,t)},t.string=function(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];return o.assert(0===t.length,"Joi.string() does not allow arguments."),h.callWithDefaults.call(this,h.string,t)},t.ref=function(){return f.create.apply(f,arguments)},t.isRef=function(e){return f.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]:{};return t.compile(arguments.length<=1?void 0:arguments[1])._validateWithOptions(r,a,o)},t.describe=function(){return(arguments.length?t.compile(arguments.length<=0?void 0:arguments[0]):e).describe()},t.compile=function(e){try{return a.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){return o.assert(e&&e instanceof s,"you must provide a joi schema"),o.assert(Array.isArray(t)||"string"==typeof t,"path must be a string or an array of strings"),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)}}(e,"string"==typeof t?t?t.split("."):[]:t.slice())},t.lazy=function(e){return c.set(e)},t.defaults=function(e){var t=this;o.assert("function"==typeof e,"Defaults must be a function");var r=Object.create(this.any());return r=e(r),o.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),o.assert(r instanceof t.constructor,"defaults() must return a schema")),r=e(r),o.assert(r instanceof t.constructor,"defaults() must return a schema"),r},r},t.extend=function(){for(var e=this,r=arguments.length,c=Array(r),p=0;p<r;p++)c[p]=arguments[p];var d=o.flatten(c);o.assert(d.length>0,"You need to provide at least one extension"),this.assert(d,t.extensionsSchema);var y=Object.create(this.any());n(y,this);for(var g=function(r){var c=d[r];"function"==typeof c&&(c=c(y)),e.assert(c,t.extensionSchema);var p=(c.base||e.any()).clone(),g=p.constructor,m=function(e){function t(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var r=function(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}(this,e.call(this));return c.base&&n(r,p),r._type=c.name,c.language&&(r._settings=l.concat(r._settings,{language:function(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}({},c.name,c.language)})),r}return i(t,e),t}(g);if(c.coerce&&(m.prototype._coerce=function(e,t,r){if(g.prototype._coerce){var n=g.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 u.Err?{value:e,errors:i}:{value:i}}),c.pre&&(m.prototype._base=function(e,t,r){if(g.prototype._base){var n=g.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 u.Err?{value:e,errors:i}:{value:i}}),c.rules)for(var b=function(t){var r=c.rules[t],n=r.params?r.params instanceof s?r.params._inner.children.map(function(e){return e.key}):Object.keys(r.params):[],i=r.params?a.schema(e,r.params):null;m.prototype[r.name]=function(){for(var e=arguments.length,t=Array(e),a=0;a<e;a++)t[a]=arguments[a];if(t.length>n.length)throw new Error("Unexpected number of arguments");for(var u=!1,c={},l=0;l<n.length;++l)c[n[l]]=t[l],!u&&f.isRef(t[l])&&(u=!0);i&&(c=y.attempt(c,i));var h=void 0;if(r.validate){h=this._test(r.name,c,function(e,t,n){return r.validate.call(this,c,e,t,n)},{description:r.description,hasRef:u})}else h=this.clone();if(r.setup){var p=r.setup.call(h,c);void 0!==p&&(o.assert(p instanceof s,"Setup of extension Joi."+this._type+"()."+r.name+"() must return undefined or a Joi object"),h=p)}return h}},v=0;v<c.rules.length;++v)b(v);c.describe&&(m.prototype.describe=function(){var e=g.prototype.describe.call(this);return c.describe.call(this,e)});var _=new m;y[c.name]=function(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];return h.callWithDefaults.call(this,_,t)}},m=0;m<d.length;++m)g(m);return y},t.extensionSchema=h.object.keys({base:h.object.type(s,"Joi object"),name:h.string.required(),coerce:h.func.arity(3),pre:h.func.arity(3),language:h.object,describe:h.func.arity(1),rules:h.array.items(h.object.keys({name:h.string.required(),setup:h.func.arity(1),validate:h.func.arity(4),params:[h.object.pattern(/.*/,h.object.type(s,"Joi object")),h.object.type(h.object.constructor,"Joi object")],description:[h.string,h.func.arity(1)]}).or("setup","validate"))}).strict(),t.extensionsSchema=h.array.items([h.object,h.func.arity(1)]).strict(),t.version=r(36).version,t}};e.exports=h.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)}var o=r(1),s=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){(function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")})(this,e),this._set=new Set(t),this._hasRef=!1}return e.prototype.add=function(e,t){var r=o.isRef(e);return!r&&this.has(e,null,null,!1)?this:(void 0!==t&&o.push(t,e),this._set.add(e),this._hasRef|=r,this)},e.prototype.merge=function e(t,r){var n=!0,i=!1,o=void 0;try{for(var s,a=t._set[Symbol.iterator]();!(n=(s=a.next()).done);n=!0){var u=s.value;this.add(u)}}catch(e){i=!0,o=e}finally{try{!n&&a.return&&a.return()}finally{if(i)throw o}}var c=!0,f=!1,l=void 0;try{for(var h,p=r._set[Symbol.iterator]();!(c=(h=p.next()).done);c=!0){var d=h.value;this.remove(d)}}catch(e){f=!0,l=e}finally{try{!c&&p.return&&p.return()}finally{if(f)throw l}}return this},e.prototype.remove=function(e){return this._set.delete(e),this},e.prototype.has=function e(t,r,n,i){if(!this._set.size)return!1;var a=this._set.has(t);if(a)return a;var u=s(t,i);if(!u){if(r&&this._hasRef){var c=!0,f=!1,l=void 0;try{for(var h,p=this._set[Symbol.iterator]();!(c=(h=p.next()).done);c=!0){var d=h.value;if(o.isRef(d)&&(t===(d=d(r.reference||r.parent,n))||Array.isArray(d)&&d.includes(t)))return!0}}catch(e){f=!0,l=e}finally{try{!c&&p.return&&p.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 s=!(!r||!this._hasRef),a=function(e){return t===e||i(e)},u=!0,c=!1,f=void 0;try{for(var l,h=this._set[Symbol.iterator]();!(u=(l=h.next()).done);u=!0){var p=l.value;if(s&&o.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&&h.return&&h.return()}finally{if(c)throw f}}return!1},e.prototype.values=function(e){if(e&&e.stripUndefined){var t=[],r=!0,n=!1,i=void 0;try{for(var o,s=this._set[Symbol.iterator]();!(r=(o=s.next()).done);r=!0){var a=o.value;void 0!==a&&t.push(a)}}catch(t){n=!0,i=t}finally{try{!r&&s.return&&s.return()}finally{if(n)throw i}}return t}return Array.from(this._set)},e.prototype.slice=function(){var t=new e(this._set);return t._hasRef=this._hasRef,t},e.prototype.concat=function(t){var r=new e([].concat(i(this._set),i(t._set)));return r._hasRef=!!(this._hasRef|t._hasRef),r},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){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):function(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)}}(e,t))}var o=r(0),s=r(2),a=r(4),u=r(1),c={};c.Alternatives=function(e){function t(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var r=function(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}(this,e.call(this));return r._type="alternatives",r._invalids.remove(null),r._inner.matches=[],r}return i(t,e),t.prototype._init=function(){return arguments.length?this.try.apply(this,arguments):this},t.prototype._base=function(e,t,r){for(var n=[],i=this._inner.matches.length,o=this._baseType,s=0;s<i;++s){var a=this._inner.matches[s];if(a.schema){var u=a.schema._validate(e,t,r);if(!u.errors)return u;n=n.concat(u.errors)}else{var c=a.peek||a.is,f=a.is?a.ref(t.reference||t.parent,r):e;if(c._validate(f,null,r,t.parent).errors){if(a.otherwise)return a.otherwise._validate(e,t,r)}else if(a.then)return a.then._validate(e,t,r);if(s===i-1&&o)return o._validate(e,t,r)}}return n.length?{errors:this.createError("alternatives.child",{reason:n},t,r)}:{errors:this.createError("alternatives.base",null,t,r)}},t.prototype.try=function(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];t=o.flatten(t),o.assert(t.length,"Cannot add other alternatives without at least one schema");for(var n=this.clone(),i=0;i<t.length;++i){var s=a.schema(this._currentJoi,t[i]);s._refs.length&&(n._refs=n._refs.concat(s._refs)),n._inner.matches.push({schema:s})}return n},t.prototype.when=function(e,t){var r=!1;o.assert(u.isRef(e)||"string"==typeof e||(r=e instanceof s),"Invalid condition:",e),o.assert(t,"Missing options"),o.assert("object"===(void 0===t?"undefined":n(t)),"Invalid options"),r?o.assert(!t.hasOwnProperty("is"),'"is" can not be used with a schema condition'):o.assert(t.hasOwnProperty("is"),'Missing "is" directive'),o.assert(void 0!==t.then||void 0!==t.otherwise,'options must have at least one of "then" or "otherwise"');var i=this.clone(),c=void 0;r||(c=a.schema(this._currentJoi,t.is),null!==t.is&&(u.isRef(t.is)||t.is instanceof s)||(c=c.required()));var f={ref:r?null:a.ref(e),peek:r?e:null,is:c,then:void 0!==t.then?a.schema(this._currentJoi,t.then):void 0,otherwise:void 0!==t.otherwise?a.schema(this._currentJoi,t.otherwise):void 0};return i._baseType&&(f.then=f.then&&i._baseType.concat(f.then),f.otherwise=f.otherwise&&i._baseType.concat(f.otherwise)),r||(u.push(i._refs,f.ref),i._refs=i._refs.concat(f.is._refs)),f.then&&f.then._refs&&(i._refs=i._refs.concat(f.then._refs)),f.otherwise&&f.otherwise._refs&&(i._refs=i._refs.concat(f.otherwise._refs)),i._inner.matches.push(f),i},t.prototype.describe=function(){for(var e=s.prototype.describe.call(this),t=[],r=0;r<this._inner.matches.length;++r){var n=this._inner.matches[r];if(n.schema)t.push(n.schema.describe());else{var i=n.is?{ref:n.ref.toString(),is:n.is.describe()}:{peek:n.peek.describe()};n.then&&(i.then=n.then.describe()),n.otherwise&&(i.otherwise=n.otherwise.describe()),t.push(i)}}return e.alternatives=t,e},t}(s),e.exports=new c.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){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):function(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)}}(e,t))}var i,o=r(2),s=r(1),a=r(0),u={};u.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)?)?)?)?$/,u.invalidDate=new Date(""),u.isIsoDate=(i=u.isoDate.toString(),function(e){return e&&e.toString()===i}),u.Date=function(e){function t(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var r=function(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}(this,e.call(this));return r._type="date",r}return n(t,e),t.prototype._base=function(e,t,r){var n={value:r.convert&&u.Date.toDate(e,this._flags.format,this._flags.timestamp,this._flags.multiplier)||e};if(n.value instanceof Date&&!isNaN(n.value.getTime()))n.errors=null;else if(r.convert){var i;i=u.isIsoDate(this._flags.format)?"isoDate":this._flags.timestamp?"timestamp."+this._flags.timestamp:"base",n.errors=this.createError("date."+i,null,t,r)}else n.errors=this.createError("date.strict",null,t,r);return n},t.toDate=function(e,t,r,n){if(e instanceof Date)return e;if("string"==typeof e||"number"==typeof e&&!isNaN(e)&&isFinite(e)){"string"==typeof e&&/^[+-]?\d+(\.\d+)?$/.test(e)&&(e=parseFloat(e));var i=void 0;if(i=t&&u.isIsoDate(t)?t.test(e)?new Date(e):u.invalidDate:r&&n?/^\s*$/.test(e)?u.invalidDate:new Date(e*n):new Date(e),!isNaN(i.getTime()))return i}return null},t.prototype.iso=function(){if(this._flags.format===u.isoDate)return this;var e=this.clone();return e._flags.format=u.isoDate,e},t.prototype.timestamp=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"javascript",t=["javascript","unix"];if(a.assert(t.includes(e),'"type" must be one of "'+t.join('", "')+'"'),this._flags.timestamp===e)return this;var r=this.clone();return r._flags.timestamp=e,r._flags.multiplier="unix"===e?1e3:1,r},t.prototype._isIsoDate=function(e){return u.isoDate.test(e)},t}(o),u.compare=function(e,t){return function(r){var n="now"===r,i=s.isRef(r);return n||i||(r=u.Date.toDate(r)),a.assert(r,"Invalid date format"),this._test(e,r,function(o,s,a){var c=void 0;if(n)c=Date.now();else if(i){if(!(c=u.Date.toDate(r(s.reference||s.parent,a))))return this.createError("date.ref",{ref:r.key},s,a);c=c.getTime()}else c=r.getTime();return t(o.getTime(),c)?o:this.createError("date."+e,{limit:new Date(c)},s,a)})}},u.Date.prototype.min=u.compare("min",function(e,t){return e>=t}),u.Date.prototype.max=u.compare("max",function(e,t){return e<=t}),u.Date.prototype.greater=u.compare("greater",function(e,t){return e>t}),u.Date.prototype.less=u.compare("less",function(e,t){return e<t}),e.exports=new u.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){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):function(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)}}(e,t))}var o=r(0),s=r(31),a=r(2),u=r(6),c=r(4),f={};f.Object=function(e){function t(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var r=function(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}(this,e.call(this));return r._type="object",r._inner.children=null,r._inner.renames=[],r._inner.dependencies=[],r._inner.patterns=[],r}return i(t,e),t.prototype._init=function(){return arguments.length?this.keys.apply(this,arguments):this},t.prototype._base=function(e,t,r){var i=e,s=[],a=function(){return{value:i,errors:s.length?s:null}};"string"==typeof e&&r.convert&&(e=f.safeParse(e));var c=this._flags.func?"function":"object";if(!e||(void 0===e?"undefined":n(e))!==c||Array.isArray(e))return s.push(this.createError(c+".base",null,t,r)),a();if(!(this._inner.renames.length||this._inner.dependencies.length||this._inner.children||this._inner.patterns.length))return i=e,a();if(i===e){"object"===c?i=Object.create(Object.getPrototypeOf(e)):(i=function(){for(var t=arguments.length,r=Array(t),n=0;n<t;n++)r[n]=arguments[n];return e.apply(this,r)}).prototype=o.clone(e.prototype);for(var l=Object.keys(e),h=0;h<l.length;++h)i[l[h]]=e[l[h]]}else i=e;for(var p={},d=0;d<this._inner.renames.length;++d){var y=this._inner.renames[d];if(y.isRegExp){for(var g=Object.keys(i),m=[],b=0;b<g.length;++b)y.from.test(g[b])&&m.push(g[b]);var v=m.every(function(e){return void 0===i[e]});if(y.options.ignoreUndefined&&v)continue;if(!y.options.multiple&&p[y.to]&&(s.push(this.createError("object.rename.regex.multiple",{from:m,to:y.to},t,r)),r.abortEarly))return a();if(Object.prototype.hasOwnProperty.call(i,y.to)&&!y.options.override&&!p[y.to]&&(s.push(this.createError("object.rename.regex.override",{from:m,to:y.to},t,r)),r.abortEarly))return a();if(v?delete i[y.to]:i[y.to]=i[m[m.length-1]],p[y.to]=!0,!y.options.alias)for(var _=0;_<m.length;++_)delete i[m[_]]}else{if(y.options.ignoreUndefined&&void 0===i[y.from])continue;if(!y.options.multiple&&p[y.to]&&(s.push(this.createError("object.rename.multiple",{from:y.from,to:y.to},t,r)),r.abortEarly))return a();if(Object.prototype.hasOwnProperty.call(i,y.to)&&!y.options.override&&!p[y.to]&&(s.push(this.createError("object.rename.override",{from:y.from,to:y.to},t,r)),r.abortEarly))return a();void 0===i[y.from]?delete i[y.to]:i[y.to]=i[y.from],p[y.to]=!0,y.options.alias||delete i[y.from]}}if(!this._inner.children&&!this._inner.patterns.length&&!this._inner.dependencies.length)return a();var w=new Set(Object.keys(i));if(this._inner.children){for(var S=[],k=0;k<this._inner.children.length;++k){var E=this._inner.children[k],A=E.key,x=i[A];w.delete(A);var I={key:A,path:t.path.concat(A),parent:i,reference:t.reference},T=E.schema._validate(x,I,r);if(T.errors){if(s.push(this.createError("object.child",{key:A,child:E.schema._getLabel(A),reason:T.errors},I,r)),r.abortEarly)return a()}else E.schema._flags.strip||void 0===T.value&&T.value!==x?(S.push(A),i[A]=T.finalValue):void 0!==T.value&&(i[A]=T.value)}for(var B=0;B<S.length;++B)delete i[S[B]]}if(w.size&&this._inner.patterns.length){var C=!0,P=!1,O=void 0;try{for(var R,N=w[Symbol.iterator]();!(C=(R=N.next()).done);C=!0)for(var L=R.value,K={key:L,path:t.path.concat(L),parent:i,reference:t.reference},j=i[L],M=0;M<this._inner.patterns.length;++M){var D=this._inner.patterns[M];if(D.regex?D.regex.test(L):!D.schema.validate(L).error){w.delete(L);var U=D.rule._validate(j,K,r);if(U.errors&&(s.push(this.createError("object.child",{key:L,child:D.rule._getLabel(L),reason:U.errors},K,r)),r.abortEarly))return a();i[L]=U.value}}}catch(re){P=!0,O=re}finally{try{!C&&N.return&&N.return()}finally{if(P)throw O}}}if(w.size&&(this._inner.children||this._inner.patterns.length)){if(r.stripUnknown&&!0!==this._flags.allowUnknown||r.skipFunctions){var F=!(!r.stripUnknown||!0!==r.stripUnknown&&!r.stripUnknown.objects),q=!0,H=!1,z=void 0;try{for(var V,G=w[Symbol.iterator]();!(q=(V=G.next()).done);q=!0){var W=V.value;F?(delete i[W],w.delete(W)):"function"==typeof i[W]&&w.delete(W)}}catch(re){H=!0,z=re}finally{try{!q&&G.return&&G.return()}finally{if(H)throw z}}}if(void 0!==this._flags.allowUnknown?!this._flags.allowUnknown:!r.allowUnknown){var $=!0,Y=!1,J=void 0;try{for(var X,Z=w[Symbol.iterator]();!($=(X=Z.next()).done);$=!0){var Q=X.value;s.push(this.createError("object.allowUnknown",{child:Q},{key:Q,path:t.path.concat(Q)},r,{}))}}catch(re){Y=!0,J=re}finally{try{!$&&Z.return&&Z.return()}finally{if(Y)throw J}}}}for(var ee=0;ee<this._inner.dependencies.length;++ee){var te=this._inner.dependencies[ee],re=f[te.type].call(this,null!==te.key&&i[te.key],te.peers,i,{key:te.key,path:null===te.key?t.path:t.path.concat(te.key)},r);if(re instanceof u.Err&&(s.push(re),r.abortEarly))return a()}return a()},t.prototype.keys=function e(t){o.assert(null===t||void 0===t||"object"===(void 0===t?"undefined":n(t)),"Object schema must be a valid object"),o.assert(!(t&&t instanceof a),"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 u=new s;if(r._inner.children)for(var f=0;f<r._inner.children.length;++f){var l=r._inner.children[f];i.includes(l.key)||u.add(l,{after:l._refs,group:l.key})}for(var h=0;h<i.length;++h){var p=i[h],d=t[p];try{var y=c.schema(this._currentJoi,d);u.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=u.nodes,r},t.prototype.append=function(e){return null===e||void 0===e||0===Object.keys(e).length?this:this.keys(e)},t.prototype.unknown=function(e){var t=!1!==e;if(this._flags.allowUnknown===t)return this;var r=this.clone();return r._flags.allowUnknown=t,r},t.prototype.length=function(e){return o.assert(Number.isSafeInteger(e)&&e>=0,"limit must be a positive integer"),this._test("length",e,function(t,r,n){return Object.keys(t).length===e?t:this.createError("object.length",{limit:e},r,n)})},t.prototype.min=function(e){return o.assert(Number.isSafeInteger(e)&&e>=0,"limit must be a positive integer"),this._test("min",e,function(t,r,n){return Object.keys(t).length>=e?t:this.createError("object.min",{limit:e},r,n)})},t.prototype.max=function(e){return o.assert(Number.isSafeInteger(e)&&e>=0,"limit must be a positive integer"),this._test("max",e,function(t,r,n){return Object.keys(t).length<=e?t:this.createError("object.max",{limit:e},r,n)})},t.prototype.pattern=function e(t,r){var n=t instanceof RegExp;o.assert(n||t instanceof a,"pattern must be a regex or schema"),o.assert(void 0!==r,"Invalid rule"),n&&(t=new RegExp(t.source,t.ignoreCase?"i":void 0));try{r=c.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(){return this._test("schema",null,function(e,t,r){return e instanceof a?e:this.createError("object.schema",null,t,r)})},t.prototype.with=function(e,t){return o.assert(2===arguments.length,"Invalid number of arguments, expected 2."),this._dependency("with",e,t)},t.prototype.without=function(e,t){return o.assert(2===arguments.length,"Invalid number of arguments, expected 2."),this._dependency("without",e,t)},t.prototype.xor=function(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];return t=o.flatten(t),this._dependency("xor",null,t)},t.prototype.or=function(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];return t=o.flatten(t),this._dependency("or",null,t)},t.prototype.and=function(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];return t=o.flatten(t),this._dependency("and",null,t)},t.prototype.nand=function(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];return t=o.flatten(t),this._dependency("nand",null,t)},t.prototype.requiredKeys=function(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];return t=o.flatten(t),this.applyFunctionToChildren(t,"required")},t.prototype.optionalKeys=function(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];return t=o.flatten(t),this.applyFunctionToChildren(t,"optional")},t.prototype.forbiddenKeys=function(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];return t=o.flatten(t),this.applyFunctionToChildren(t,"forbidden")},t.prototype.rename=function(e,t,r){o.assert("string"==typeof e||e instanceof RegExp,"Rename missing the from argument"),o.assert("string"==typeof t,"Rename missing the to argument"),o.assert(t!==e,"Cannot rename key to same name:",e);for(var n=0;n<this._inner.renames.length;++n)o.assert(this._inner.renames[n].from!==e,"Cannot rename the same key multiple times");var i=this.clone();return i._inner.renames.push({from:e,to:t,options:o.applyToDefaults(f.renameDefaults,r||{}),isRegExp:e instanceof RegExp}),i},t.prototype.applyFunctionToChildren=function(e,t,r,n){e=[].concat(e),o.assert(e.length>0,"expected at least one children");var i=f.groupChildren(e),s=void 0;if(""in i?(s=this[t].apply(this,r),delete i[""]):s=this.clone(),s._inner.children){n=n?n+".":"";for(var a=0;a<s._inner.children.length;++a){var u=s._inner.children[a],c=i[u.key];c&&(s._inner.children[a]={key:u.key,_refs:u._refs,schema:u.schema.applyFunctionToChildren(c,t,r,n+u.key)},delete i[u.key])}}var l=Object.keys(i);return o.assert(0===l.length,"unknown key(s)",l.join(", ")),s},t.prototype._dependency=function(e,t,r){r=[].concat(r);for(var n=0;n<r.length;++n)o.assert("string"==typeof r[n],e,"peers must be a string or array of strings");var i=this.clone();return i._inner.dependencies.push({type:e,key:t,peers:r}),i},t.prototype.describe=function(e){var t=a.prototype.describe.call(this);if(t.rules)for(var r=0;r<t.rules.length;++r){var i=t.rules[r];i.arg&&"object"===n(i.arg)&&i.arg.schema&&i.arg.ref&&(i.arg={schema:i.arg.schema.describe(),ref:i.arg.ref.toString()})}if(this._inner.children&&!e){t.children={};for(var s=0;s<this._inner.children.length;++s){var u=this._inner.children[s];t.children[u.key]=u.schema.describe()}}if(this._inner.dependencies.length&&(t.dependencies=o.clone(this._inner.dependencies)),this._inner.patterns.length){t.patterns=[];for(var c=0;c<this._inner.patterns.length;++c){var f=this._inner.patterns[c];f.regex?t.patterns.push({regex:f.regex.toString(),rule:f.rule.describe()}):t.patterns.push({schema:f.schema.describe(),rule:f.rule.describe()})}}return this._inner.renames.length>0&&(t.renames=o.clone(this._inner.renames)),t},t.prototype.assert=function e(t,r,n){t=c.ref(t),o.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=c.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],s=t.path.join(".");return this._test("assert",{schema:r,ref:t},function(e,a,u){if(!r._validate(t(e),null,u,e).errors)return e;var c=o.merge({},a);return c.key=i,c.path=t.path,this.createError("object.assert",{ref:s,message:n},c,u)})},t.prototype.type=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:e.name;o.assert("function"==typeof e,"type must be a constructor function");var r={name:t,ctor:e};return this._test("type",r,function(t,n,i){return t instanceof e?t:this.createError("object.type",{type:r.name},n,i)})},t}(a),f.safeParse=function(e){try{return JSON.parse(e)}catch(e){}return e},f.renameDefaults={alias:!1,multiple:!1,override:!1},f.groupChildren=function(e){e.sort();for(var t={},r=0;r<e.length;++r){var n=e[r];o.assert("string"==typeof n,"children must be strings");var i=n.split(".")[0];(t[i]=t[i]||[]).push(n.substring(i.length+1))}return t},f.keysToLabels=function(e,t){var r=e._inner.children;if(!r)return t;var n=function(e){var t=r.find(function(t){return t.key===e});return t?t.schema._getLabel(e):e};return Array.isArray(t)?t.map(n):n(t)},f.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:f.keysToLabels(this,n.key),peer:s,peerWithLabel:f.keysToLabels(this,s)},n,i)}return e},f.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:f.keysToLabels(this,n.key),peer:s,peerWithLabel:f.keysToLabels(this,s)},n,i)}return e},f.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:f.keysToLabels(this,t)};return 0===o.length?this.createError("object.missing",u,n,i):this.createError("object.xor",u,n,i)},f.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:f.keysToLabels(this,t)},n,i)},f.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)}if(o.length!==a&&s.length!==a)return this.createError("object.and",{present:s,presentWithLabels:f.keysToLabels(this,s),missing:o,missingWithLabels:f.keysToLabels(this,o)},n,i)},f.nand=function(e,t,r,n,i){for(var s=[],a=0;a<t.length;++a){var u=t[a];Object.prototype.hasOwnProperty.call(r,u)&&void 0!==r[u]&&s.push(u)}var c=o.clone(t),l=c.splice(0,1)[0];return s.length===t.length?this.createError("object.nand",{main:l,mainWithLabel:f.keysToLabels(this,l),peers:c,peersWithLabels:f.keysToLabels(this,c)},n,i):null},e.exports=new f.Object},function(e,t,r){"use strict";var n={rfc3986:{},generate:function(){var e="|";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 t="a-zA-Z0-9-\\._~",r="!\\$&'\\(\\)\\*\\+,;=",i="%0-9A-Fa-f",o=t+i+r+":@",s="["+o+"]",a="(?: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="(?:"+a+"\\.){3}"+a;var u="[0-9A-Fa-f]{1,4}",c="(?:"+u+":"+u+"|"+n.rfc3986.IPv4address+")",f="(?:"+u+":){6}"+c,l="::(?:"+u+":){5}"+c,h="(?:"+u+")?::(?:"+u+":){4}"+c,p="(?:(?:"+u+":){0,1}"+u+")?::(?:"+u+":){3}"+c,d="(?:(?:"+u+":){0,2}"+u+")?::(?:"+u+":){2}"+c,y="(?:(?:"+u+":){0,3}"+u+")?::"+u+":"+c,g="(?:(?:"+u+":){0,4}"+u+")?::"+c;n.rfc3986.IPv6address="(?:"+f+e+l+e+h+e+p+e+d+e+y+e+g+e+"(?:(?:[0-9A-Fa-f]{1,4}:){0,5}[0-9A-Fa-f]{1,4})?::[0-9A-Fa-f]{1,4}"+e+"(?:(?:[0-9A-Fa-f]{1,4}:){0,6}[0-9A-Fa-f]{1,4})?::)",n.rfc3986.IPvFuture="v[0-9A-Fa-f]+\\.["+t+r+":]+",n.rfc3986.scheme="[a-zA-Z][a-zA-Z0-9+-\\.]*";var m="(?:["+t+i+r+":]*@)?(?:\\[(?:"+n.rfc3986.IPv6address+e+n.rfc3986.IPvFuture+")\\]"+e+n.rfc3986.IPv4address+e+"[a-zA-Z0-9-\\._~%0-9A-Fa-f!\\$&'\\(\\)\\*\\+,;=]{0,255})(?::[0-9]*)?",b=s+"+",v="(?:\\/"+s+"*)*",_="\\/(?:"+b+v+")?";n.rfc3986.hierPart="(?:(?:\\/\\/"+m+v+")"+e+_+e+"[a-zA-Z0-9-\\._~%0-9A-Fa-f!\\$&'\\(\\)\\*\\+,;=:@]+(?:\\/[a-zA-Z0-9-\\._~%0-9A-Fa-f!\\$&'\\(\\)\\*\\+,;=:@]*)*)",n.rfc3986.relativeRef="(?:(?:\\/\\/"+m+v+")"+e+_+e+"[a-zA-Z0-9-\\._~%0-9A-Fa-f!\\$&'\\(\\)\\*\\+,;=@]+(?:\\/[a-zA-Z0-9-\\._~%0-9A-Fa-f!\\$&'\\(\\)\\*\\+,;=:@]*)*"+e+")",n.rfc3986.query="["+o+"\\/\\?]*(?=#|$)",n.rfc3986.fragment="["+o+"\\/\\?]*"}};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(!b(e)){for(var t=[],r=0;r<arguments.length;r++)t.push(a(arguments[r]));return t.join(" ")}r=1;for(var 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])g(u)||!w(u)?s+=" "+u:s+=" "+a(u);return s},t.deprecate=function(r,i){if(v(e.process))return function(){return t.deprecate(r,i).apply(this,arguments)};if(!0===n.noDeprecation)return r;var o=!1;return function(){if(!o){if(n.throwDeprecation)throw new Error(i);n.traceDeprecation?console.trace(i):console.error(i),o=!0}return r.apply(this,arguments)}};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]),y(r)?n.showHidden=r:r&&t._extend(n,r),v(n.showHidden)&&(n.showHidden=!1),v(n.depth)&&(n.depth=2),v(n.colors)&&(n.colors=!1),v(n.customInspect)&&(n.customInspect=!0),n.colors&&(n.stylize=u),f(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,r,n){if(e.customInspect&&r&&E(r.inspect)&&r.inspect!==t.inspect&&(!r.constructor||r.constructor.prototype!==r)){var i=r.inspect(n,e);return b(i)||(i=f(e,i,n)),i}var o=l(e,r);if(o)return o;var s=Object.keys(r),a=function(e){var t={};return e.forEach(function(e,r){t[e]=!0}),t}(s);if(e.showHidden&&(s=Object.getOwnPropertyNames(r)),k(r)&&(s.indexOf("message")>=0||s.indexOf("description")>=0))return h(r);if(0===s.length){if(E(r)){var u=r.name?": "+r.name:"";return e.stylize("[Function"+u+"]","special")}if(_(r))return e.stylize(RegExp.prototype.toString.call(r),"regexp");if(S(r))return e.stylize(Date.prototype.toString.call(r),"date");if(k(r))return h(r)}var c,y="",g=!1,m=["{","}"];return d(r)&&(g=!0,m=["[","]"]),E(r)&&(y=" [Function"+(r.name?": "+r.name:"")+"]"),_(r)&&(y=" "+RegExp.prototype.toString.call(r)),S(r)&&(y=" "+Date.prototype.toUTCString.call(r)),k(r)&&(y=" "+h(r)),0!==s.length||g&&0!=r.length?n<0?_(r)?e.stylize(RegExp.prototype.toString.call(r),"regexp"):e.stylize("[Object]","special"):(e.seen.push(r),c=g?function(e,t,r,n,i){for(var o=[],s=0,a=t.length;s<a;++s)T(t,String(s))?o.push(p(e,t,r,n,String(s),!0)):o.push("");return i.forEach(function(i){i.match(/^\d+$/)||o.push(p(e,t,r,n,i,!0))}),o}(e,r,n,a,s):s.map(function(t){return p(e,r,n,a,t,g)}),e.seen.pop(),function(e,t,r){return e.reduce(function(e,t){return 0,t.indexOf("\n")>=0&&0,e+t.replace(/\u001b\[\d\d?m/g,"").length+1},0)>60?r[0]+(""===t?"":t+"\n ")+" "+e.join(",\n ")+" "+r[1]:r[0]+t+" "+e.join(", ")+" "+r[1]}(c,y,m)):m[0]+y+m[1]}function l(e,t){if(v(t))return e.stylize("undefined","undefined");if(b(t)){var r="'"+JSON.stringify(t).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return e.stylize(r,"string")}return m(t)?e.stylize(""+t,"number"):y(t)?e.stylize(""+t,"boolean"):g(t)?e.stylize("null","null"):void 0}function h(e){return"["+Error.prototype.toString.call(e)+"]"}function p(e,t,r,n,i,o){var s,a,u;if((u=Object.getOwnPropertyDescriptor(t,i)||{value:t[i]}).get?a=u.set?e.stylize("[Getter/Setter]","special"):e.stylize("[Getter]","special"):u.set&&(a=e.stylize("[Setter]","special")),T(n,i)||(s="["+i+"]"),a||(e.seen.indexOf(u.value)<0?(a=g(r)?f(e,u.value,null):f(e,u.value,r-1)).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")),v(s)){if(o&&i.match(/^\d+$/))return a;(s=JSON.stringify(""+i)).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 d(e){return Array.isArray(e)}function y(e){return"boolean"==typeof e}function g(e){return null===e}function m(e){return"number"==typeof e}function b(e){return"string"==typeof e}function v(e){return void 0===e}function _(e){return w(e)&&"[object RegExp]"===A(e)}function w(e){return"object"==typeof e&&null!==e}function S(e){return w(e)&&"[object Date]"===A(e)}function k(e){return w(e)&&("[object Error]"===A(e)||e instanceof Error)}function E(e){return"function"==typeof e}function A(e){return Object.prototype.toString.call(e)}function x(e){return e<10?"0"+e.toString(10):e.toString(10)}t.debuglog=function(e){if(v(o)&&(o=n.env.NODE_DEBUG||""),e=e.toUpperCase(),!s[e])if(new RegExp("\\b"+e+"\\b","i").test(o)){var r=n.pid;s[e]=function(){var n=t.format.apply(t,arguments);console.error("%s %d: %s",e,r,n)}}else s[e]=function(){};return s[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=d,t.isBoolean=y,t.isNull=g,t.isNullOrUndefined=function(e){return null==e},t.isNumber=m,t.isString=b,t.isSymbol=function(e){return"symbol"==typeof e},t.isUndefined=v,t.isRegExp=_,t.isObject=w,t.isDate=S,t.isError=k,t.isFunction=E,t.isPrimitive=function(e){return null===e||"boolean"==typeof e||"number"==typeof e||"string"==typeof e||"symbol"==typeof e||void 0===e},t.isBuffer=r(40);var I=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function T(e,t){return Object.prototype.hasOwnProperty.call(e,t)}t.log=function(){console.log("%s - %s",function(){var e=new Date,t=[x(e.getHours()),x(e.getMinutes()),x(e.getSeconds())].join(":");return[e.getDate(),I[e.getMonth()],t].join(" ")}(),t.format.apply(t,arguments))},t.inherits=r(39),t._extend=function(e,t){if(!t||!w(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(){}.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=m,h=/\s*function\s+([^\(\s]*)\s*/;function p(e){if(o.isFunction(e)){if(u)return e.name;var t=e.toString().match(h);return t&&t[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);return"[Function"+(t?": "+t:"")+"]"}function g(e,t,r,n,i){throw new l.AssertionError({message:r,actual:e,expected:t,operator:n,stackStartFunction:i})}function m(e,t){e||g(e,!0,t,"==",l.ok)}function b(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;var a=(s=s||{actual:[],expected:[]}).actual.indexOf(e);return-1!==a&&a===s.expected.indexOf(t)||(s.actual.push(e),s.expected.push(t),_(e,t,r,s))}return r?e===t:e==t}function v(e){return"[object Arguments]"==Object.prototype.toString.call(e)}function _(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=v(e),s=v(t);if(i&&!s||!i&&s)return!1;if(i)return b(e=a.call(e),t=a.call(t),r);var u,c,f=k(e),l=k(t);if(f.length!==l.length)return!1;for(f.sort(),l.sort(),c=f.length-1;c>=0;c--)if(f[c]!==l[c])return!1;for(c=f.length-1;c>=0;c--)if(!b(e[u=f[c]],t[u],r,n))return!1;return!0}function w(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 S(e,t,r,n){var i;if("function"!=typeof t)throw new TypeError('"block" argument must be a function');"string"==typeof r&&(n=r,r=null),i=function(e){var t;try{e()}catch(e){t=e}return t}(t),n=(r&&r.name?" ("+r.name+").":".")+(n?" "+n:"."),e&&!i&&g(i,r,"Missing expected exception"+n);var s="string"==typeof n,a=!e&&o.isError(i),u=!e&&i&&!r;if((a&&s&&w(i,r)||u)&&g(i,r,"Got unwanted exception"+n),e&&i&&r&&!w(i,r)||!e&&i)throw i}l.AssertionError=function(e){this.name="AssertionError",this.actual=e.actual,this.expected=e.expected,this.operator=e.operator,e.message?(this.message=e.message,this.generatedMessage=!1):(this.message=function(e){return d(y(e.actual),128)+" "+e.operator+" "+d(y(e.expected),128)}(this),this.generatedMessage=!0);var t=e.stackStartFunction||g;if(Error.captureStackTrace)Error.captureStackTrace(this,t);else{var r=new Error;if(r.stack){var n=r.stack,i=p(t),o=n.indexOf("\n"+i);if(o>=0){var s=n.indexOf("\n",o+1);n=n.substring(s+1)}this.stack=n}}},o.inherits(l.AssertionError,Error),l.fail=g,l.ok=m,l.equal=function(e,t,r){e!=t&&g(e,t,r,"==",l.equal)},l.notEqual=function(e,t,r){e==t&&g(e,t,r,"!=",l.notEqual)},l.deepEqual=function(e,t,r){b(e,t,!1)||g(e,t,r,"deepEqual",l.deepEqual)},l.deepStrictEqual=function(e,t,r){b(e,t,!0)||g(e,t,r,"deepStrictEqual",l.deepStrictEqual)},l.notDeepEqual=function(e,t,r){b(e,t,!1)&&g(e,t,r,"notDeepEqual",l.notDeepEqual)},l.notDeepStrictEqual=function e(t,r,n){b(t,r,!0)&&g(t,r,n,"notDeepStrictEqual",e)},l.strictEqual=function(e,t,r){e!==t&&g(e,t,r,"===",l.strictEqual)},l.notStrictEqual=function(e,t,r){e===t&&g(e,t,r,"!==",l.notStrictEqual)},l.throws=function(e,t,r){S(!0,e,t,r)},l.doesNotThrow=function(e,t,r){S(!1,e,t,r)},l.ifError=function(e){if(e)throw e};var k=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=void 0;return e.replace(/[<>&\u2028\u2029]/g,function(e){return 60===(t=e.charCodeAt(0))?"\\u003c":62===t?"\\u003e":38===t?"\\u0026":8232===t?"\\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){e>c&&(c=e)};void 0!==r.allowUnicode&&!r.allowUnicode&&/[^\x00-\x7f]/.test(t)&&f(o.diagnoses.undesiredNonAscii);for(var l={now:o.components.localpart,prev:o.components.localpart,stack:[o.components.localpart]},h="",p={local:"",domain:""},d={locals:[""],domains:[""]},y=0,g=0,m=0,b=void 0,v=!1,_=!1,w=t.length,S=void 0,k=0;k<w;k+=S.length){switch(S=String.fromCodePoint(t.codePointAt(k)),l.now){case o.components.localpart:switch(S){case"(":0===g?f(0===y?o.diagnoses.cfwsComment:o.diagnoses.deprecatedComment):(f(o.diagnoses.cfwsComment),_=!0),l.stack.push(l.now),l.now=o.components.contextComment;break;case".":0===g?f(0===y?o.diagnoses.errDotStart:o.diagnoses.errConsecutiveDots):(_&&f(o.diagnoses.deprecatedLocalPart),_=!1,g=0,++y,p.local+=S,d.locals[y]="");break;case'"':0===g?(f(0===y?o.diagnoses.rfc5321QuotedString:o.diagnoses.deprecatedLocalPart),p.local+=S,d.locals[y]+=S,g+=e.byteLength(S,"utf8"),_=!0,l.stack.push(l.now),l.now=o.components.contextQuotedString):f(o.diagnoses.errExpectingATEXT);break;case"\r":if(w===++k||"\n"!==t[k]){f(o.diagnoses.errCRNoLF);break}case" ":case"\t":0===g?f(0===y?o.diagnoses.cfwsFWS:o.diagnoses.deprecatedFWS):_=!0,l.stack.push(l.now),l.now=o.components.contextFWS,h=S;break;case"@":if(1!==l.stack.length)throw new Error("unexpected item on context stack");0===p.local.length?f(o.diagnoses.errNoLocalPart):0===g?f(o.diagnoses.errDotEnd):e.byteLength(p.local,"utf8")>64?f(o.diagnoses.rfc5322LocalTooLong):l.prev!==o.components.contextComment&&l.prev!==o.components.contextFWS||f(o.diagnoses.deprecatedCFWSNearAt),l.now=o.components.domain,l.stack[0]=o.components.domain,y=0,g=0,_=!1;break;default:if(_)switch(l.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: "+l.prev)}else l.prev=l.now,b=S.codePointAt(0),(o.specials(b)||o.c0Controls(b)||o.c1Controls(b))&&f(o.diagnoses.errExpectingATEXT),p.local+=S,d.locals[y]+=S,g+=e.byteLength(S,"utf8")}break;case o.components.domain:switch(S){case"(":0===g?f(0===y?o.diagnoses.deprecatedCFWSNearAt:o.diagnoses.deprecatedComment):(_=!0,f(o.diagnoses.cfwsComment)),l.stack.push(l.now),l.now=o.components.contextComment;break;case".":var E=i.encode(d.domains[y]).length;0===g?f(0===y?o.diagnoses.errDotStart:o.diagnoses.errConsecutiveDots):v?f(o.diagnoses.errDomainHyphenEnd):E>63&&f(o.diagnoses.rfc5322LabelTooLong),_=!1,g=0,++y,d.domains[y]="",p.domain+=S;break;case"[":0===p.domain.length?(_=!0,g+=e.byteLength(S,"utf8"),l.stack.push(l.now),l.now=o.components.literal,p.domain+=S,d.domains[y]+=S,p.literal=""):f(o.diagnoses.errExpectingATEXT);break;case"\r":if(w===++k||"\n"!==t[k]){f(o.diagnoses.errCRNoLF);break}case" ":case"\t":0===g?f(0===y?o.diagnoses.deprecatedCFWSNearAt:o.diagnoses.deprecatedFWS):(f(o.diagnoses.cfwsFWS),_=!0),l.stack.push(l.now),l.now=o.components.contextFWS,h=S;break;default:if(_)switch(l.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: "+l.prev)}b=S.codePointAt(0),v=!1,o.specials(b)||o.c0Controls(b)||o.c1Controls(b)?f(o.diagnoses.errExpectingATEXT):"-"===S?(0===g&&f(o.diagnoses.errDomainHyphenStart),v=!0):(b<48||b>122&&b<192||b>57&&b<65||b>90&&b<97)&&f(o.diagnoses.rfc5322Domain),p.domain+=S,d.domains[y]+=S,g+=e.byteLength(S,"utf8")}break;case o.components.literal:switch(S){case"]":if(c<o.categories.deprecated){var A=-1,x=p.literal,I=o.regex.ipV4.exec(x);if(I&&0!==(A=I.index)&&(x=x.slice(0,A)+"0:0"),0===A)f(o.diagnoses.rfc5321AddressLiteral);else if("ipv6:"!==x.slice(0,5).toLowerCase())f(o.diagnoses.rfc5322DomainLiteral);else{var T=x.slice(5),B=o.maxIPv6Groups,C=T.split(":");~(A=T.indexOf("::"))?A!==T.lastIndexOf("::")?f(o.diagnoses.rfc5322IPv62x2xColon):(0!==A&&A!==T.length-2||++B,C.length>B?f(o.diagnoses.rfc5322IPv6MaxGroups):C.length===B&&f(o.diagnoses.deprecatedIPv6)):C.length!==B&&f(o.diagnoses.rfc5322IPv6GroupCount),":"===T[0]&&":"!==T[1]?f(o.diagnoses.rfc5322IPv6ColonStart):":"===T[T.length-1]&&":"!==T[T.length-2]?f(o.diagnoses.rfc5322IPv6ColonEnd):o.checkIpV6(C)?f(o.diagnoses.rfc5321AddressLiteral):f(o.diagnoses.rfc5322IPv6BadCharacter)}}else f(o.diagnoses.rfc5322DomainLiteral);p.domain+=S,d.domains[y]+=S,g+=e.byteLength(S,"utf8"),l.prev=l.now,l.now=l.stack.pop();break;case"\\":f(o.diagnoses.rfc5322DomainLiteralOBSDText),l.stack.push(l.now),l.now=o.components.contextQuotedPair;break;case"\r":if(w===++k||"\n"!==t[k]){f(o.diagnoses.errCRNoLF);break}case" ":case"\t":f(o.diagnoses.cfwsFWS),l.stack.push(l.now),l.now=o.components.contextFWS,h=S;break;default:if(127!==(b=S.codePointAt(0))&&o.c1Controls(b)||0===b||"["===S){f(o.diagnoses.errExpectingDTEXT);break}(o.c0Controls(b)||127===b)&&f(o.diagnoses.rfc5322DomainLiteralOBSDText),p.literal+=S,p.domain+=S,d.domains[y]+=S,g+=e.byteLength(S,"utf8")}break;case o.components.contextQuotedString:switch(S){case"\\":l.stack.push(l.now),l.now=o.components.contextQuotedPair;break;case"\r":if(w===++k||"\n"!==t[k]){f(o.diagnoses.errCRNoLF);break}case"\t":p.local+=" ",d.locals[y]+=" ",g+=e.byteLength(S,"utf8"),f(o.diagnoses.cfwsFWS),l.stack.push(l.now),l.now=o.components.contextFWS,h=S;break;case'"':p.local+=S,d.locals[y]+=S,g+=e.byteLength(S,"utf8"),l.prev=l.now,l.now=l.stack.pop();break;default:127!==(b=S.codePointAt(0))&&o.c1Controls(b)||0===b||10===b?f(o.diagnoses.errExpectingQTEXT):(o.c0Controls(b)||127===b)&&f(o.diagnoses.deprecatedQTEXT),p.local+=S,d.locals[y]+=S,g+=e.byteLength(S,"utf8")}break;case o.components.contextQuotedPair:127!==(b=S.codePointAt(0))&&o.c1Controls(b)?f(o.diagnoses.errExpectingQPair):(b<31&&9!==b||127===b)&&f(o.diagnoses.deprecatedQP),l.prev=l.now,l.now=l.stack.pop();var P="\\"+S;switch(l.now){case o.components.contextComment:break;case o.components.contextQuotedString:p.local+=P,d.locals[y]+=P,g+=2;break;case o.components.literal:p.domain+=P,d.domains[y]+=P,g+=2;break;default:throw new Error("quoted pair logic invoked in an invalid context: "+l.now)}break;case o.components.contextComment:switch(S){case"(":l.stack.push(l.now),l.now=o.components.contextComment;break;case")":l.prev=l.now,l.now=l.stack.pop();break;case"\\":l.stack.push(l.now),l.now=o.components.contextQuotedPair;break;case"\r":if(w===++k||"\n"!==t[k]){f(o.diagnoses.errCRNoLF);break}case" ":case"\t":f(o.diagnoses.cfwsFWS),l.stack.push(l.now),l.now=o.components.contextFWS,h=S;break;default:if(0===(b=S.codePointAt(0))||10===b||127!==b&&o.c1Controls(b)){f(o.diagnoses.errExpectingCTEXT);break}(o.c0Controls(b)||127===b)&&f(o.diagnoses.deprecatedCTEXT)}break;case o.components.contextFWS:if("\r"===h){if("\r"===S){f(o.diagnoses.errFWSCRLFx2);break}++m>1?f(o.diagnoses.deprecatedFWS):m=1}switch(S){case"\r":w!==++k&&"\n"===t[k]||f(o.diagnoses.errCRNoLF);break;case" ":case"\t":break;default:"\r"===h&&f(o.diagnoses.errFWSCRLFEnd),m=0,l.prev=l.now,l.now=l.stack.pop(),--k}h=S;break;default:throw new Error("unknown context: "+l.now)}if(c>o.categories.rfc5322)break}if(c<o.categories.rfc5322){var O=i.encode(p.domain).length;if(l.now===o.components.contextQuotedString)f(o.diagnoses.errUnclosedQuotedString);else if(l.now===o.components.contextQuotedPair)f(o.diagnoses.errBackslashEnd);else if(l.now===o.components.contextComment)f(o.diagnoses.errUnclosedComment);else if(l.now===o.components.literal)f(o.diagnoses.errUnclosedDomainLiteral);else if("\r"===S)f(o.diagnoses.errFWSCRLFEnd);else if(0===p.domain.length)f(o.diagnoses.errNoDomain);else if(0===g)f(o.diagnoses.errDotEnd);else if(v)f(o.diagnoses.errDomainHyphenEnd);else if(O>255)f(o.diagnoses.rfc5322DomainTooLong);else if(e.byteLength(p.local,"utf8")+O+1>254)f(o.diagnoses.rfc5322TooLong);else if(g>63)f(o.diagnoses.rfc5322LabelTooLong);else if(r.minDomainAtoms&&d.domains.length<r.minDomainAtoms)f(o.diagnoses.errDomainTooShort);else if(r.tldWhitelist||r.tldBlacklist){var R=d.domains[y];o.validDomain(R,r)||f(o.diagnoses.errUnknownTLD)}}c<o.categories.dnsWarn&&d.domains[y].codePointAt(0)<=57&&f(o.diagnoses.rfc5321TLDNumeric),c<u&&(c=o.diagnoses.valid);var N=a?c:c<o.defaultThreshold;return s&&s(N),N},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){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):function(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)}}(e,t))}var o=r(2),s=r(4),a=r(1),u=r(0),c={fastSplice:function(e,t){for(var r=t;r<e.length;)e[r++]=e[r];--e.length}};c.Array=function(e){function t(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var r=function(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}(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 i(t,e),t.prototype._base=function(e,t,r){var n={value:e};"string"==typeof e&&r.convert&&c.safeParse(e,n);var i=Array.isArray(n.value),o=i;if(r.convert&&this._flags.single&&!i&&(n.value=[n.value],i=!0),!i)return n.errors=this.createError("array.base",null,t,r),n;if((this._inner.inclusions.length||this._inner.exclusions.length||this._inner.requireds.length||this._inner.ordereds.length||!this._flags.sparse)&&(o&&(n.value=n.value.slice(0)),n.errors=this._checkItems.call(this,n.value,o,t,r),n.errors&&o&&r.convert&&this._flags.single)){var s=n.errors;n.value=[n.value],n.errors=this._checkItems.call(this,n.value,o,t,r),n.errors&&(n.errors=s,n.value=n.value[0])}return n},t.prototype._checkItems=function(e,t,r,n){for(var i=[],o=void 0,s=this._inner.requireds.slice(),a=this._inner.ordereds.slice(),u=this._inner.inclusions.concat(s),f=e.length,l=0;l<f;++l){o=!1;var h=e[l],p=!1,d={key:t?l:r.key,path:t?r.path.concat(l):r.path,parent:r.parent,reference:r.reference},y=void 0;if(this._flags.sparse||void 0!==h){for(var g=0;g<this._inner.exclusions.length;++g)if(!(y=this._inner.exclusions[g]._validate(h,d,{})).errors){if(i.push(this.createError(t?"array.excludes":"array.excludesSingle",{pos:l,value:h},{key:r.key,path:d.path},n)),o=!0,n.abortEarly)return i;a.shift();break}if(!o){if(this._inner.ordereds.length){if(a.length>0){var m=a.shift();if((y=m._validate(h,d,n)).errors){if(i.push(this.createError("array.ordered",{pos:l,reason:y.errors,value:h},{key:r.key,path:d.path},n)),n.abortEarly)return i}else if(m._flags.strip)c.fastSplice(e,l),--l,--f;else{if(!this._flags.sparse&&void 0===y.value){if(i.push(this.createError("array.sparse",null,{key:r.key,path:d.path,pos:l},n)),n.abortEarly)return i;continue}e[l]=y.value}continue}if(!this._inner.items.length){if(i.push(this.createError("array.orderedLength",{pos:l,limit:this._inner.ordereds.length},{key:r.key,path:d.path},n)),n.abortEarly)return i;continue}}for(var b=[],v=s.length,_=0;_<v;++_)if(!(y=b[_]=s[_]._validate(h,d,n)).errors){if(e[l]=y.value,p=!0,c.fastSplice(s,_),--_,--v,!this._flags.sparse&&void 0===y.value&&(i.push(this.createError("array.sparse",null,{key:r.key,path:d.path,pos:l},n)),n.abortEarly))return i;break}if(!p){var w=!(!n.stripUnknown||!0!==n.stripUnknown&&!n.stripUnknown.arrays);v=u.length;for(var S=0;S<v;++S){var k=u[S],E=s.indexOf(k);if(-1!==E)y=b[E];else if(!(y=k._validate(h,d,n)).errors){k._flags.strip?(c.fastSplice(e,l),--l,--f):this._flags.sparse||void 0!==y.value?e[l]=y.value:(i.push(this.createError("array.sparse",null,{key:r.key,path:d.path,pos:l},n)),o=!0),p=!0;break}if(1===v){if(w){c.fastSplice(e,l),--l,--f,p=!0;break}if(i.push(this.createError(t?"array.includesOne":"array.includesOneSingle",{pos:l,reason:y.errors,value:h},{key:r.key,path:d.path},n)),o=!0,n.abortEarly)return i;break}}if(!o&&this._inner.inclusions.length&&!p){if(w){c.fastSplice(e,l),--l,--f;continue}if(i.push(this.createError(t?"array.includes":"array.includesSingle",{pos:l,value:h},{key:r.key,path:d.path},n)),n.abortEarly)return i}}}}else{if(i.push(this.createError("array.sparse",null,{key:r.key,path:d.path,pos:l},n)),n.abortEarly)return i;a.shift()}}return s.length&&this._fillMissedErrors.call(this,i,s,r,n),a.length&&this._fillOrderedErrors.call(this,i,a,r,n),i.length?i:null},t.prototype.describe=function(){var e=o.prototype.describe.call(this);if(this._inner.ordereds.length){e.orderedItems=[];for(var t=0;t<this._inner.ordereds.length;++t)e.orderedItems.push(this._inner.ordereds[t].describe())}if(this._inner.items.length){e.items=[];for(var r=0;r<this._inner.items.length;++r)e.items.push(this._inner.items[r].describe())}return e},t.prototype.items=function(){for(var e=this,t=this.clone(),r=arguments.length,n=Array(r),i=0;i<r;i++)n[i]=arguments[i];return u.flatten(n).forEach(function(r,n){try{r=s.schema(e._currentJoi,r)}catch(r){throw r.hasOwnProperty("path")?r.path=n+"."+r.path:r.path=n,r.message=r.message+"("+r.path+")",r}t._inner.items.push(r),"required"===r._flags.presence?t._inner.requireds.push(r):"forbidden"===r._flags.presence?t._inner.exclusions.push(r.optional()):t._inner.inclusions.push(r)}),t},t.prototype.ordered=function(){for(var e=this,t=this.clone(),r=arguments.length,n=Array(r),i=0;i<r;i++)n[i]=arguments[i];return u.flatten(n).forEach(function(r,n){try{r=s.schema(e._currentJoi,r)}catch(r){throw r.hasOwnProperty("path")?r.path=n+"."+r.path:r.path=n,r.message=r.message+"("+r.path+")",r}t._inner.ordereds.push(r)}),t},t.prototype.min=function(e){var t=a.isRef(e);return u.assert(Number.isSafeInteger(e)&&e>=0||t,"limit must be a positive integer or reference"),this._test("min",e,function(r,n,i){var o=void 0;if(t){if(o=e(n.reference||n.parent,i),!(Number.isSafeInteger(o)&&o>=0))return this.createError("array.ref",{ref:e.key},n,i)}else o=e;return r.length>=o?r:this.createError("array.min",{limit:e,value:r},n,i)})},t.prototype.max=function(e){var t=a.isRef(e);return u.assert(Number.isSafeInteger(e)&&e>=0||t,"limit must be a positive integer or reference"),this._test("max",e,function(r,n,i){var o=void 0;if(t){if(o=e(n.reference||n.parent,i),!(Number.isSafeInteger(o)&&o>=0))return this.createError("array.ref",{ref:e.key},n,i)}else o=e;return r.length<=o?r:this.createError("array.max",{limit:e,value:r},n,i)})},t.prototype.length=function(e){var t=a.isRef(e);return u.assert(Number.isSafeInteger(e)&&e>=0||t,"limit must be a positive integer or reference"),this._test("length",e,function(r,n,i){var o=void 0;if(t){if(o=e(n.reference||n.parent,i),!(Number.isSafeInteger(o)&&o>=0))return this.createError("array.ref",{ref:e.key},n,i)}else o=e;return r.length===o?r:this.createError("array.length",{limit:e,value:r},n,i)})},t.prototype.unique=function(e){u.assert(void 0===e||"function"==typeof e||"string"==typeof e,"comparator must be a function or a string");var t={};return"string"==typeof e?t.path=e:"function"==typeof e&&(t.comparator=e),this._test("unique",t,function(e,r,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=t.comparator||u.deepEqual,a=0;a<e.length;++a){var c=t.path?u.reach(e[a],t.path):e[a],f=t.comparator?o.custom:o[void 0===c?"undefined":n(c)];if(f)if(f instanceof Map){for(var l=f.entries(),h=void 0;!(h=l.next()).done;)if(s(h.value[0],c)){var p={key:r.key,path:r.path.concat(a),parent:r.parent,reference:r.reference},d={pos:a,value:e[a],dupePos:h.value[1],dupeValue:e[h.value[1]]};return t.path&&(d.path=t.path),this.createError("array.unique",d,p,i)}f.set(c,a)}else{if(void 0!==f[c]){var y={key:r.key,path:r.path.concat(a),parent:r.parent,reference:r.reference},g={pos:a,value:e[a],dupePos:f[c],dupeValue:e[f[c]]};return t.path&&(g.path=t.path),this.createError("array.unique",g,y,i)}f[c]=a}}return e})},t.prototype.sparse=function(e){var t=void 0===e||!!e;if(this._flags.sparse===t)return this;var r=this.clone();return r._flags.sparse=t,r},t.prototype.single=function(e){var t=void 0===e||!!e;if(this._flags.single===t)return this;var r=this.clone();return r._flags.single=t,r},t.prototype._fillMissedErrors=function(e,t,r,n){for(var i=[],o=0,s=0;s<t.length;++s){var a=t[s]._getLabel();a?i.push(a):++o}i.length?o?e.push(this.createError("array.includesRequiredBoth",{knownMisses:i,unknownMisses:o},{key:r.key,path:r.path},n)):e.push(this.createError("array.includesRequiredKnowns",{knownMisses:i},{key:r.key,path:r.path},n)):e.push(this.createError("array.includesRequiredUnknowns",{unknownMisses:o},{key:r.key,path:r.path},n))},t.prototype._fillOrderedErrors=function(e,t,r,n){for(var i=[],o=0;o<t.length;++o){"required"===u.reach(t[o],"_flags.presence")&&i.push(t[o])}i.length&&this._fillMissedErrors.call(this,e,i,r,n)},t}(o),c.safeParse=function(e,t){try{var r=JSON.parse(e);Array.isArray(r)&&(t.value=r)}catch(e){}},e.exports=new c.Array},function(e,t,r){"use strict";(function(t){function n(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):function(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)}}(e,t))}var i=r(2),o=r(0),s={};s.Binary=function(e){function r(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,r);var t=function(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}(this,e.call(this));return t._type="binary",t}return n(r,e),r.prototype._base=function(e,r,n){var i={value:e};if("string"==typeof e&&n.convert)try{i.value=t.from(e,this._flags.encoding)}catch(e){}return i.errors=t.isBuffer(i.value)?null:this.createError("binary.base",null,r,n),i},r.prototype.encoding=function(e){if(o.assert(t.isEncoding(e),"Invalid encoding:",e),this._flags.encoding===e)return this;var r=this.clone();return r._flags.encoding=e,r},r.prototype.min=function(e){return o.assert(Number.isSafeInteger(e)&&e>=0,"limit must be a positive integer"),this._test("min",e,function(t,r,n){return t.length>=e?t:this.createError("binary.min",{limit:e,value:t},r,n)})},r.prototype.max=function(e){return o.assert(Number.isSafeInteger(e)&&e>=0,"limit must be a positive integer"),this._test("max",e,function(t,r,n){return t.length<=e?t:this.createError("binary.max",{limit:e,value:t},r,n)})},r.prototype.length=function(e){return o.assert(Number.isSafeInteger(e)&&e>=0,"limit must be a positive integer"),this._test("length",e,function(t,r,n){return t.length===e?t:this.createError("binary.length",{limit:e,value:t},r,n)})},r}(i),e.exports=new s.Binary}).call(t,r(3).Buffer)},function(e,t,r){"use strict";function n(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):function(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)}}(e,t))}var i=r(2),o=r(0),s={Set:r(9)};s.Boolean=function(e){function t(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var r=function(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}(this,e.call(this));return r._type="boolean",r._flags.insensitive=!0,r._inner.truthySet=new s.Set,r._inner.falsySet=new s.Set,r}return n(t,e),t.prototype._base=function(e,t,r){var n={value:e};if("string"==typeof e&&r.convert){var i=this._flags.insensitive?e.toLowerCase():e;n.value="true"===i||"false"!==i&&e}return"boolean"!=typeof n.value&&(n.value=!!this._inner.truthySet.has(e,null,null,this._flags.insensitive)||!this._inner.falsySet.has(e,null,null,this._flags.insensitive)&&e),n.errors="boolean"==typeof n.value?null:this.createError("boolean.base",null,t,r),n},t.prototype.truthy=function(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];var n=this.clone();t=o.flatten(t);for(var i=0;i<t.length;++i){var s=t[i];o.assert(void 0!==s,"Cannot call truthy with undefined"),n._inner.truthySet.add(s)}return n},t.prototype.falsy=function(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];var n=this.clone();t=o.flatten(t);for(var i=0;i<t.length;++i){var s=t[i];o.assert(void 0!==s,"Cannot call falsy with undefined"),n._inner.falsySet.add(s)}return n},t.prototype.insensitive=function(e){var t=void 0===e||!!e;if(this._flags.insensitive===t)return this;var r=this.clone();return r._flags.insensitive=t,r},t.prototype.describe=function(){var e=i.prototype.describe.call(this);return e.truthy=[!0].concat(this._inner.truthySet.values()),e.falsy=[!1].concat(this._inner.falsySet.values()),e},t}(i),e.exports=new s.Boolean},function(e,t,r){"use strict";function n(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):function(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)}}(e,t))}var i=r(0),o=r(13),s=r(1),a={};a.Func=function(e){function t(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var r=function(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}(this,e.call(this));return r._flags.func=!0,r}return n(t,e),t.prototype.arity=function(e){return i.assert(Number.isSafeInteger(e)&&e>=0,"n must be a positive integer"),this._test("arity",e,function(t,r,n){return t.length===e?t:this.createError("function.arity",{n:e},r,n)})},t.prototype.minArity=function(e){return i.assert(Number.isSafeInteger(e)&&e>0,"n must be a strict positive integer"),this._test("minArity",e,function(t,r,n){return t.length>=e?t:this.createError("function.minArity",{n:e},r,n)})},t.prototype.maxArity=function(e){return i.assert(Number.isSafeInteger(e)&&e>=0,"n must be a positive integer"),this._test("maxArity",e,function(t,r,n){return t.length<=e?t:this.createError("function.maxArity",{n:e},r,n)})},t.prototype.ref=function(){return this._test("ref",null,function(e,t,r){return s.isRef(e)?e:this.createError("function.ref",null,t,r)})},t.prototype.class=function(){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}(o.constructor),e.exports=new a.Func},function(e,t,r){"use strict";function n(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):function(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)}}(e,t))}var i=r(2),o=r(0),s={};s.Lazy=function(e){function t(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var r=function(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}(this,e.call(this));return r._type="lazy",r}return n(t,e),t.prototype._base=function(e,t,r){var n={value:e},o=this._flags.lazy;if(!o)return n.errors=this.createError("lazy.base",null,t,r),n;var s=o();return s instanceof i?s._validate(e,t,r):(n.errors=this.createError("lazy.schema",null,t,r),n)},t.prototype.set=function(e){o.assert("function"==typeof e,"You must provide a function as first argument");var t=this.clone();return t._flags.lazy=e,t},t}(i),e.exports=new s.Lazy},function(e,t,r){"use strict";function n(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):function(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)}}(e,t))}var i=r(2),o=r(1),s=r(0),a={precisionRx:/(?:\.(\d+))?(?:[eE]([+-]?\d+))?$/};a.Number=function(e){function t(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var r=function(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}(this,e.call(this));return r._type="number",r._invalids.add(1/0),r._invalids.add(-1/0),r}return n(t,e),t.prototype._base=function(e,t,r){var n={errors:null,value:e};if("string"==typeof e&&r.convert){var i=parseFloat(e);n.value=isNaN(i)||!isFinite(e)?NaN:i}var o="number"==typeof n.value&&!isNaN(n.value);if(r.convert&&"precision"in this._flags&&o){var s=Math.pow(10,this._flags.precision);n.value=Math.round(n.value*s)/s}return n.errors=o?null:this.createError("number.base",null,t,r),n},t.prototype.multiple=function(e){var t=o.isRef(e);return t||(s.assert("number"==typeof e&&isFinite(e),"multiple must be a number"),s.assert(e>0,"multiple must be greater than 0")),this._test("multiple",e,function(r,n,i){var o=t?e(n.reference||n.parent,i):e;return!t||"number"==typeof o&&isFinite(o)?r%o==0?r:this.createError("number.multiple",{multiple:e,value:r},n,i):this.createError("number.ref",{ref:e.key},n,i)})},t.prototype.integer=function(){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(){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(){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){s.assert(Number.isSafeInteger(e),"limit must be an integer"),s.assert(!("precision"in this._flags),"precision already set");var t=this._test("precision",e,function(t,r,n){var i=t.toString().match(a.precisionRx);return Math.max((i[1]?i[1].length:0)-(i[2]?parseInt(i[2],10):0),0)<=e?t:this.createError("number.precision",{limit:e,value:t},r,n)});return t._flags.precision=e,t},t.prototype.port=function(){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}(i),a.compare=function(e,t){return function(r){var n=o.isRef(r),i="number"==typeof r&&!isNaN(r);return s.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("number"!=typeof(a=r(o.reference||o.parent,s))||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)})}},a.Number.prototype.min=a.compare("min",function(e,t){return e>=t}),a.Number.prototype.max=a.compare("max",function(e,t){return e<=t}),a.Number.prototype.greater=a.compare("greater",function(e,t){return e>t}),a.Number.prototype.less=a.compare("less",function(e,t){return e<t}),e.exports=new a.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){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):function(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)}}(e,t))}var o=r(15),s=r(0),a=void 0,u=r(2),c=r(1),f=r(12),l=r(30),h=r(29),p={uriRegex:l.createUriRegex(),ipRegex:h.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"]};p.String=function(e){function t(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var r=function(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}(this,e.call(this));return r._type="string",r._invalids.add(""),r}return i(t,e),t.prototype._base=function(e,t,r){if("string"==typeof e&&r.convert){if(this._flags.normalize&&(e=e.normalize(this._flags.normalize)),this._flags.case&&(e="upper"===this._flags.case?e.toLocaleUpperCase():e.toLocaleLowerCase()),this._flags.trim&&(e=e.trim()),this._inner.replacements)for(var n=0;n<this._inner.replacements.length;++n){var i=this._inner.replacements[n];e=e.replace(i.pattern,i.replacement)}if(this._flags.truncate)for(var o=0;o<this._tests.length;++o){var s=this._tests[o];if("max"===s.name){e=e.slice(0,s.arg);break}}this._flags.byteAligned&&e.length%2!=0&&(e="0"+e)}return{value:e,errors:"string"==typeof e?null:this.createError("string.base",{value:e},t,r)}},t.prototype.insensitive=function(){if(this._flags.insensitive)return this;var e=this.clone();return e._flags.insensitive=!0,e},t.prototype.creditCard=function(){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}return i%10==0&&i>0?e:this.createError("string.creditCard",{value:e},t,r)})},t.prototype.regex=function(e,t){s.assert(e instanceof RegExp,"pattern must be a RegExp");var r={pattern:new RegExp(e.source,e.ignoreCase?"i":void 0)};"string"==typeof t?r.name=t:"object"===(void 0===t?"undefined":n(t))&&(r.invert=!!t.invert,t.name&&(r.name=t.name));var i=["string.regex",r.invert?".invert":"",r.name?".name":".base"].join("");return this._test("regex",r,function(e,t,n){return r.pattern.test(e)^r.invert?e:this.createError(i,{name:r.name,pattern:r.pattern,value:e},t,n)})},t.prototype.alphanum=function(){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(){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){return e&&(s.assert("object"===(void 0===e?"undefined":n(e)),"email options must be an object"),s.assert(void 0===e.checkDNS,"checkDNS option is not supported"),s.assert(void 0===e.tldWhitelist||"object"===n(e.tldWhitelist),"tldWhitelist must be an array or object"),s.assert(void 0===e.minDomainAtoms||Number.isSafeInteger(e.minDomainAtoms)&&e.minDomainAtoms>0,"minDomainAtoms must be a positive integer"),s.assert(void 0===e.errorLevel||"boolean"==typeof e.errorLevel||Number.isSafeInteger(e.errorLevel)&&e.errorLevel>=0,"errorLevel must be a non-negative integer or boolean")),this._test("email",e,function(t,n,i){a=a||r(19);try{var o=a.validate(t,e);if(!0===o||0===o)return t}catch(t){}return this.createError("string.email",{value:t},n,i)})},t.prototype.ip=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=p.ipRegex;s.assert("object"===(void 0===e?"undefined":n(e)),"options must be an object"),e.cidr?(s.assert("string"==typeof e.cidr,"cidr must be a string"),e.cidr=e.cidr.toLowerCase(),s.assert(s.contain(p.cidrPresences,e.cidr),"cidr must be one of "+p.cidrPresences.join(", ")),e.version||"optional"===e.cidr||(t=h.createIpRegex(["ipv4","ipv6","ipvfuture"],e.cidr))):e.cidr="optional";var r=void 0;if(e.version){Array.isArray(e.version)||(e.version=[e.version]),s.assert(e.version.length>=1,"version must have at least 1 version specified"),r=[];for(var i=0;i<e.version.length;++i){var o=e.version[i];s.assert("string"==typeof o,"version at position "+i+" must be a string"),o=o.toLowerCase(),s.assert(h.versions[o],"version at position "+i+" must be one of "+Object.keys(h.versions).join(", ")),r.push(o)}r=s.unique(r),t=h.createIpRegex(r,e.cidr)}return this._test("ip",e,function(n,i,o){return t.test(n)?n:r?this.createError("string.ipVersion",{value:n,cidr:e.cidr,version:r},i,o):this.createError("string.ip",{value:n,cidr:e.cidr},i,o)})},t.prototype.uri=function(e){var t="",r=!1,i=!1,o=p.uriRegex;if(e){if(s.assert("object"===(void 0===e?"undefined":n(e)),"options must be an object"),e.scheme){s.assert(e.scheme instanceof RegExp||"string"==typeof e.scheme||Array.isArray(e.scheme),"scheme must be a RegExp, String, or Array"),Array.isArray(e.scheme)||(e.scheme=[e.scheme]),s.assert(e.scheme.length>=1,"scheme must have at least 1 scheme specified");for(var a=0;a<e.scheme.length;++a){var u=e.scheme[a];s.assert(u instanceof RegExp||"string"==typeof u,"scheme at position "+a+" must be a RegExp or String"),t+=t?"|":"",u instanceof RegExp?t+=u.source:(s.assert(/[a-zA-Z][a-zA-Z0-9+-\.]*/.test(u),"scheme at position "+a+" must be a valid scheme"),t+=s.escapeRegex(u))}}e.allowRelative&&(r=!0),e.relativeOnly&&(i=!0)}return(t||r||i)&&(o=l.createUriRegex(t,r,i)),this._test("uri",e,function(e,r,n){return o.test(e)?e:i?this.createError("string.uriRelativeOnly",{value:e},r,n):t?this.createError("string.uriCustomScheme",{scheme:t,value:e},r,n):this.createError("string.uri",{value:e},r,n)})},t.prototype.isoDate=function(){return this._test("isoDate",void 0,function(e,t,r){if(f._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){var t="";if(e&&e.version){Array.isArray(e.version)||(e.version=[e.version]),s.assert(e.version.length>=1,"version must have at least 1 valid version specified");for(var r=new Set,n=0;n<e.version.length;++n){var i=e.version[n];s.assert("string"==typeof i,"version at position "+n+" must be a string"),i=i.toLowerCase();var o=p.guidVersions[i];s.assert(o,"version at position "+n+" must be one of "+Object.keys(p.guidVersions).join(", ")),s.assert(!r.has(o),"version at position "+n+" must not be a duplicate."),t+=o,r.add(o)}}var a=new RegExp("^([\\[{\\(]?)[0-9A-F]{8}([:-]?)[0-9A-F]{4}\\2?["+(t||"0-9A-F")+"][0-9A-F]{3}\\2?["+(t?"89AB":"0-9A-F")+"][0-9A-F]{3}\\2?[0-9A-F]{12}([\\]}\\)]?)$","i");return this._test("guid",e,function(e,t,r){var n=a.exec(e);return n?p.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(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};s.assert("object"===(void 0===e?"undefined":n(e)),"hex options must be an object"),s.assert(void 0===e.byteAligned||"boolean"==typeof e.byteAligned,"byteAligned must be boolean");var t=!0===e.byteAligned,r=/^[a-f0-9]+$/i,i=this._test("hex",r,function(e,n,i){return r.test(e)?t&&e.length%2!=0?this.createError("string.hexAlign",{value:e},n,i):e:this.createError("string.hex",{value:e},n,i)});return t&&(i._flags.byteAligned=!0),i},t.prototype.base64=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};s.assert("object"===(void 0===e?"undefined":n(e)),"base64 options must be an object"),s.assert(void 0===e.paddingRequired||"boolean"==typeof e.paddingRequired,"paddingRequired must be boolean");var t=(!1===e.paddingRequired?e.paddingRequired:(e.paddingRequired,1))?/^(?:[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",t,function(e,r,n){return t.test(e)?e:this.createError("string.base64",{value:e},r,n)})},t.prototype.hostname=function(){var e=/^(([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(t,r,n){return t.length<=255&&e.test(t)||o.isIPv6(t)?t:this.createError("string.hostname",{value:t},r,n)})},t.prototype.normalize=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"NFC";s.assert(s.contain(p.normalizationForms,e),"normalization form must be one of "+p.normalizationForms.join(", "));var t=this._test("normalize",e,function(t,r,n){return n.convert||t===t.normalize(e)?t:this.createError("string.normalize",{value:t,form:e},r,n)});return t._flags.normalize=e,t},t.prototype.lowercase=function(){var e=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 e._flags.case="lower",e},t.prototype.uppercase=function(){var e=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 e._flags.case="upper",e},t.prototype.trim=function(){var e=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 e._flags.trim=!0,e},t.prototype.replace=function(e,t){"string"==typeof e&&(e=new RegExp(s.escapeRegex(e),"g")),s.assert(e instanceof RegExp,"pattern must be a RegExp"),s.assert("string"==typeof t,"replacement must be a String");var r=this.clone();return r._inner.replacements||(r._inner.replacements=[]),r._inner.replacements.push({pattern:e,replacement:t}),r},t.prototype.truncate=function(e){var t=void 0===e||!!e;if(this._flags.truncate===t)return this;var r=this.clone();return r._flags.truncate=t,r},t}(u),p.compare=function(e,r){return function(n,i){var o=c.isRef(n);return s.assert(Number.isSafeInteger(n)&&n>=0||o,"limit must be a positive integer or reference"),s.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)})}},p.String.prototype.min=p.compare("min",function(e,r,n){return(n?t.byteLength(e,n):e.length)>=r}),p.String.prototype.max=p.compare("max",function(e,r,n){return(n?t.byteLength(e,n):e.length)<=r}),p.String.prototype.length=p.compare("length",function(e,r,n){return(n?t.byteLength(e,n):e.length)===r}),p.String.prototype.uuid=p.String.prototype.guid,e.exports=new p.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){var i=n.scheme,o=void 0;if(r)o="(?:"+n.relativeRef+")";else{e&&(i="(?:"+e+")");var s="(?:"+i+":"+n.hierPart+")";o=t?"(?:"+s+"|"+n.relativeRef+")":s}return new RegExp("^"+o+"(?:\\?"+n.query+")?(?:#"+n.fragment+")?$")}}};e.exports=i.Uri},function(e,t,r){"use strict";var n=r(0),i={};e.exports=i.Topo=function(){this._items=[],this.nodes=[]},i.Topo.prototype.add=function(e,t){var r=this,i=[].concat((t=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={},K=0;K<this._items.length;++K){var j=this._items[K];L[j.seq]=j}var M=[];this._items=T.map(function(e){var t=L[e];return M.push(t.node),t}),this.nodes=M}},function(e,t,r){"use strict";var n=r(8);e.exports=n},function(e,t,r){"use strict";t.byteLength=function(e){return 3*e.length/4-c(e)},t.toByteArray=function(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},t.fromByteArray=function(e){for(var t,r=e.length,i=r%3,o="",s=[],a=0,u=r-i;a<u;a+=16383)s.push(l(e,a,a+16383>u?u:a+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("")};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 n[e>>18&63]+n[e>>12&63]+n[e>>6&63]+n[63&e]}function l(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(f(n));return i.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))*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("/"))||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}var c=[];for(u=a;u<i.length;u++)c.push("..");return(c=c.concat(o.slice(a))).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){"object"==typeof t&&t&&t.nodeType,"object"==typeof e&&e&&e.nodeType;var s="object"==typeof n&&n;s.global!==s&&s.window!==s&&s.self;var a,u=2147483647,c=36,f=1,l=26,h=38,p=700,d=72,y=128,g="-",m=/^xn--/,b=/[^\x20-\x7E]/,v=/[\x2E\u3002\uFF0E\uFF61]/g,_={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},w=c-f,S=Math.floor,k=String.fromCharCode;function E(e){throw new RangeError(_[e])}function A(e,t){for(var r=e.length,n=[];r--;)n[r]=t(e[r]);return n}function x(e,t){var r=e.split("@"),n="";return r.length>1&&(n=r[0]+"@",e=r[1]),n+A((e=e.replace(v,".")).split("."),t).join(".")}function I(e){for(var t,r,n=[],i=0,o=e.length;i<o;)(t=e.charCodeAt(i++))>=55296&&t<=56319&&i<o?56320==(64512&(r=e.charCodeAt(i++)))?n.push(((1023&t)<<10)+(1023&r)+65536):(n.push(t),i--):n.push(t);return n}function T(e){return A(e,function(e){var t="";return e>65535&&(t+=k((e-=65536)>>>10&1023|55296),e=56320|1023&e),t+k(e)}).join("")}function B(e){return e-48<10?e-22:e-65<26?e-65:e-97<26?e-97:c}function C(e,t){return e+22+75*(e<26)-((0!=t)<<5)}function P(e,t,r){var n=0;for(e=r?S(e/p):e>>1,e+=S(e/t);e>w*l>>1;n+=c)e=S(e/w);return S(n+(w+1)*e/(e+h))}function O(e){var t,r,n,i,o,s,a,h,p,m,b=[],v=e.length,_=0,w=y,k=d;for((r=e.lastIndexOf(g))<0&&(r=0),n=0;n<r;++n)e.charCodeAt(n)>=128&&E("not-basic"),b.push(e.charCodeAt(n));for(i=r>0?r+1:0;i<v;){for(o=_,s=1,a=c;i>=v&&E("invalid-input"),((h=B(e.charCodeAt(i++)))>=c||h>S((u-_)/s))&&E("overflow"),_+=h*s,!(h<(p=a<=k?f:a>=k+l?l:a-k));a+=c)s>S(u/(m=c-p))&&E("overflow"),s*=m;k=P(_-o,t=b.length+1,0==o),S(_/t)>u-w&&E("overflow"),w+=S(_/t),_%=t,b.splice(_++,0,w)}return T(b)}function R(e){var t,r,n,i,o,s,a,h,p,m,b,v,_,w,A,x=[];for(v=(e=I(e)).length,t=y,r=0,o=d,s=0;s<v;++s)(b=e[s])<128&&x.push(k(b));for(n=i=x.length,i&&x.push(g);n<v;){for(a=u,s=0;s<v;++s)(b=e[s])>=t&&b<a&&(a=b);for(a-t>S((u-r)/(_=n+1))&&E("overflow"),r+=(a-t)*_,t=a,s=0;s<v;++s)if((b=e[s])<t&&++r>u&&E("overflow"),b==t){for(h=r,p=c;!(h<(m=p<=o?f:p>=o+l?l:p-o));p+=c)A=h-m,w=c-m,x.push(k(C(m+A%w,0))),h=S(A/w);x.push(k(C(h,0))),o=P(r,_,n==i),r=0,++n}++r,++t}return x.join("")}a={version:"1.4.1",ucs2:{decode:I,encode:T},decode:O,encode:R,toASCII:function(e){return x(e,function(e){return b.test(e)?"xn--"+R(e):e})},toUnicode:function(e){return x(e,function(e){return m.test(e)?O(e.slice(4).toLowerCase()):e})}},void 0===(i=function(){return a}.call(t,r,t,e))||(e.exports=i)}()}).call(t,r(41)(e),r(5))},function(e,t){"function"==typeof Object.create?e.exports=function(e,t){e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})}:e.exports=function(e,t){e.super_=t;var r=function(){};r.prototype=t.prototype,e.prototype=new r,e.prototype.constructor=e}},function(e,t){e.exports=function(e){return e&&"object"==typeof e&&"function"==typeof e.copy&&"function"==typeof e.fill&&"function"==typeof e.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";e.exports=r(1014)},function(e,t,r){"use strict";(function(e){const n=r(276),i=r(277)(),o=r(1021),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(12),i=r(1026);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,s=n;r&&(s=((e,t)=>{if(e)return n(e);n(null,t.slice(0,r))}));try{i=o.createHash(t)}catch(e){return s(e)}i(e,s)},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(276),i=r(277)();function o(e){return Promise.all([i.subtle.exportKey("jwk",e.privateKey),i.subtle.exportKey("jwk",e.publicKey)])}t.utils=r(1029),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,function(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"])}(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(15).bignum;t.toBase64=function(t,r){return t.toArrayLike(e,"be",r).toString("base64").replace(/(=*)$/,"").replace(/\+/g,"-").replace(/\//g,"_")},t.toBn=function(t){return new n(e.from(t,"base64"))}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";const n=r(502);e.exports=function(e){if(!e||"number"!=typeof e)throw new Error("first argument must be a Number bigger than 0");return n.getRandomValues(new Uint8Array(e))}},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.toString,d=Math.max,y=Math.min,g=function(){return h.Date.now()};function m(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function b(e){if("number"==typeof e)return e;if(function(e){return"symbol"==typeof e||function(e){return!!e&&"object"==typeof e}(e)&&p.call(e)==i}(e))return n;if(m(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=m(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=function(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 v(t){var r=i,n=o;return i=o=void 0,f=t,a=e.apply(n,r)}function _(e){var r=e-c;return void 0===c||r>=t||r<0||h&&e-f>=s}function w(){var e=g();if(_(e))return S(e);u=setTimeout(w,function(e){var r=t-(e-c);return h?y(r,s-(e-f)):r}(e))}function S(e){return u=void 0,p&&i?v(e):(i=o=void 0,a)}function k(){var e=g(),r=_(e);if(i=arguments,o=this,c=e,r){if(void 0===u)return function(e){return f=e,u=setTimeout(w,t),l?v(e):a}(c);if(h)return u=setTimeout(w,t),v(c)}return void 0===u&&(u=setTimeout(w,t)),a}return t=b(t)||0,m(n)&&(l=!!n.leading,s=(h="maxWait"in n)?d(b(n.maxWait)||0,t):s,p="trailing"in n?!!n.trailing:p),k.cancel=function(){void 0!==u&&clearTimeout(u),f=0,i=c=o=u=void 0},k.flush=function(){return void 0===u?a:S(g())},k}}).call(this,r(6))},function(e,t,r){"use strict";var n=r(1052);function i(e){return"function"==typeof e}function o(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,s,a,u,c=[],f=!1,l=n();function h(){for(;c.length;)if(null==c[0].length&&l.has(1))c.shift().cb(null,l.get());else if(l.has(c[0].length)){var e=c.shift();e.cb(null,l.get(e.length))}else if(1==s&&c[0].length&&l.length<c[0].length){var t="stream ended with:"+l.length+" but wanted:"+c[0].length;c.shift().cb(new Error(t))}else{if(!s)return!!c.length;c.shift().cb(s)}return c.length||!l.has(1)||u}function p(){h()&&!f&&(!t||f||a||(f=!0,r(null,function(e,t){if(f=!1,e)return s=e,h();l.add(t),p()})))}function d(n){if(u){for(;c.length;)c.shift().cb(u);return cb&&cb(u)}r=o(n,e),t=n,p()}return d.abort=function(e,r){u=e||!0,t?(f=!0,t(u,function(){for(;c.length;)c.shift().cb(u);r&&r(u)})):r()},d.read=function(r,n,s){if(i(n)&&(s=n,n=e),!i(s))return a=!0,function(e,r){if(f||l.has(1)){if(e)return t(e,r);c.push({length:null,cb:r}),p()}else o(t,n)(e,function(e,t){r(e,t)})};c.push({length:function(e){return Number.isFinite(e)}(r)?r:null,cb:s}),p()},d}},function(e,t){var r=9007199254740991,n="[object Arguments]",i="[object Function]",o="[object GeneratorFunction]",s=/^(?:0|[1-9]\d*)$/;function a(e,t){return function(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}(t,function(t){return e[t]})}var u=Object.prototype,c=u.hasOwnProperty,f=u.toString,l=u.propertyIsEnumerable,h=function(e,t){return function(r){return e(t(r))}}(Object.keys,Object);function p(e,t){var r=m(e)||g(e)?function(e,t){for(var r=-1,n=Array(e);++r<e;)n[r]=t(r);return n}(e.length,String):[],n=r.length,i=!!n;for(var o in e)!t&&!c.call(e,o)||i&&("length"==o||y(o,n))||r.push(o);return r}function d(e){if(!function(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||u)}(e))return h(e);var t=[];for(var r in Object(e))c.call(e,r)&&"constructor"!=r&&t.push(r);return t}function y(e,t){return!!(t=null==t?r:t)&&("number"==typeof e||s.test(e))&&e>-1&&e%1==0&&e<t}function g(e){return function(e){return function(e){return!!e&&"object"==typeof e}(e)&&b(e)}(e)&&c.call(e,"callee")&&(!l.call(e,"callee")||f.call(e)==n)}var m=Array.isArray;function b(e){return null!=e&&function(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=r}(e.length)&&!function(e){var t=function(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}(e)?f.call(e):"";return t==i||t==o}(e)}e.exports=function(e){return e?a(e,function(e){return b(e)?p(e):d(e)}(e)):[]}},function(e,t,r){"use strict";const n=Math.exp;e.exports=function(e){if("number"!=typeof e)throw new Error("must provide a timespan to the moving average constructor");if(e<=0)throw new Error("must provide a timespan > 0 to the moving average constructor");let t,r,i=0,o=0,s=0,a={};function u(t,r){return 1-n(-(t-r)/e)}return a.push=function(e,n){if(r){const a=u(e,r),c=n-t;t=a*n+(1-a)*t,i=(1-a)*(i+c*(a*c)),o=Math.sqrt(i),s=t+a*c}else t=n;r=e},a.movingAverage=function(){return t},a.variance=function(){return i},a.deviation=function(){return o},a.forecast=function(){return s},a}},function(e){e.exports={_from:"git://github.com/ipfs/js-ipfs.git#master",_id:"ipfs@0.30.1",_inBundle:!1,_integrity:"",_location:"/ipfs",_phantomChildren:{},_requested:{type:"git",raw:"git://github.com/ipfs/js-ipfs.git#master",rawSpec:"git://github.com/ipfs/js-ipfs.git#master",saveSpec:"git://github.com/ipfs/js-ipfs.git#master",fetchSpec:"git://github.com/ipfs/js-ipfs.git",gitCommittish:"master"},_requiredBy:["#USER","/"],_resolved:"git://github.com/ipfs/js-ipfs.git#1f63e8c6c0659b7465d24aadc17c6d3f31a422c7",_spec:"git://github.com/ipfs/js-ipfs.git#master",_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/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:"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 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:"seungwon-kang",email:"ksw3894@gmail.com"},{name:"tcme",email:"hi@this-connect.me"},{name:"Łukasz Magiera",email:"magik6k@users.noreply.github.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","file-type":"^8.0.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":"^22.2.1","ipfs-bitswap":"~0.20.2","ipfs-block":"~0.7.1","ipfs-block-service":"~0.14.0","ipfs-http-response":"~0.1.2","ipfs-mfs":"~0.2.2","ipfs-multipart":"~0.1.0","ipfs-repo":"~0.22.1","ipfs-unixfs":"~0.1.15","ipfs-unixfs-engine":"~0.31.3",ipld:"~0.17.3","ipld-dag-cbor":"~0.12.1","ipld-dag-pb":"~0.14.5","is-ipfs":"~0.3.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.22.0","libp2p-bootstrap":"~0.9.3","libp2p-circuit":"~0.2.0","libp2p-floodsub":"~0.15.0","libp2p-kad-dht":"~0.10.0","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.18",mkdirp:"~0.5.1",multiaddr:"^5.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.0.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.72.0","ipfsd-ctl":"~0.37.5",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.30.1"}},function(e,t,r){"use strict";const n=r(23),i=r(155).repoVersion;e.exports=function(e){return{init:(e,t,r)=>{},version:n(t=>{e._repo._isInitialized(r=>{if(r){return[/Key not found in database \[\/version\]/,/ENOENT/,/repo is not initialized yet/].some(e=>e.test(r.message))?t(null,i):t(r)}e._repo.version.get(t)})}),gc:n((e,t)=>{"function"==typeof e&&(t=e,e={}),t(new Error("Not implemented"))}),stat:n((t,r)=>{"function"==typeof t&&(r=t,t={}),e._repo.stat(t,(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:()=>e._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/wss0.bootstrap.libp2p.io/tcp/443/wss/ipfs/QmZMxNdpMkewiVZLMRxaNxUeZpDUb34pWjZ1kZvsd16Zic","/dns4/wss1.bootstrap.libp2p.io/tcp/443/wss/ipfs/Qmbut9Ywz9YEDrz8ySBSgWyJk41Uvm2QJPhwDJzJyGFsD6"]}))},function(e,t,r){"use strict";const n=r(1080),i=r(78),o=r(61),s=r(1089),a=r(47).Connection,u=r(1091),c=r(1)("libp2p:websockets:dialer"),f=r(1092);e.exports=o(class{dial(e,t,r){"function"==typeof t&&(r=t,t={}),r=r||function(){};const i=u(e);c("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={}),f(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)))}},{className:"WebSockets",symbolName:"@libp2p/js-libp2p-websockets/websockets"})},function(e,t,r){var n=r(1094),i=r(281),o=r(517),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,i=n(e),u=i.source,c=i.id,f=i.path,l=a[c]&&f in a[c].nsps;return t.forceNew||t["force new connection"]||!1===t.multiplex||l?(s("ignoring socket cache for %s",u),r=o(u,t)):(a[c]||(s("new io instance for %s",u),a[c]=o(u,t)),r=a[c]),i.query&&!t.query&&(t.query=i.query),r.socket(i.path,t)}t.protocol=i.protocol,t.connect=u,t.Manager=r(517),t.Socket=r(522)},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){var t=e,i=e.indexOf("["),o=e.indexOf("]");-1!=i&&-1!=o&&(e=e.substring(0,i)+e.substring(i,o).replace(/:/g,";")+e.substring(o,e.length));for(var s=r.exec(e||""),a={},u=14;u--;)a[n[u]]=s[u]||"";return-1!=i&&-1!=o&&(a.source=t,a.host=a.host.substring(1,a.host.length-1).replace(/;/g,":"),a.authority=a.authority.replace("[","").replace("]","").replace(/;/g,":"),a.ipv6uri=!0),a}},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=function(e){return r&&t.Buffer.isBuffer(e)||n&&(e instanceof t.ArrayBuffer||i(e))};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}}).call(this,r(6))},function(e,t,r){var n=r(1096),i=r(522),o=r(114),s=r(281),a=r(523),u=r(524),c=r(1)("socket.io-client:manager"),f=r(262),l=r(1111),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||{}).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++){this.subs.shift().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(282),i=r(1099),o=r(1107),s=r(1108);t.polling=function(t){var r=!1,s=!1,a=!1!==t.jsonp;if(e.location){var u="https:"===location.protocol,c=location.port;c||(c=u?443:80),r=t.hostname!==location.hostname||c!==t.port,s=t.secure!==u}if(t.xdomain=r,t.xscheme=s,"open"in new n(t)&&!t.forceJSONP)return new i(t);if(!a)throw new Error("JSONP disabled");return new o(t)},t.websocket=s}).call(this,r(6))},function(e,t,r){var n=r(283),i=r(189),o=r(115),s=r(190),a=r(521),u=r(1)("engine.io-client:polling");e.exports=f;var c=null!=new(r(282))({xdomain:!1}).responseType;function f(e){var t=e&&e.forceBase64;c&&!t||(this.supportsBinary=!1),n.call(this,e)}s(f,n),f.prototype.name="polling",f.prototype.doOpen=function(){this.poll()},f.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()},f.prototype.poll=function(){u("polling"),this.polling=!0,this.doPoll(),this.emit("poll")},f.prototype.onData=function(e){var t=this;u("polling got data %s",e);o.decodePayload(e,this.socket.binaryType,function(e,r,n){if("opening"===t.readyState&&t.onOpen(),"close"===e.type)return t.onClose(),!1;t.onPacket(e)}),"closed"!==this.readyState&&(this.polling=!1,this.emit("pollComplete"),"open"===this.readyState?this.poll():u('ignoring poll - transport state "%s"',this.readyState))},f.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))},f.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)})},f.prototype.uri=function(){var e=this.query||{},t=this.secure?"https":"http",r="";return!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),t+"://"+(-1!==this.hostname.indexOf(":")?"["+this.hostname+"]":this.hostname)+r+this.path+e}},function(e,t,r){(function(t){var n=r(1101),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);e.exports=function e(r){if(!r||"object"!=typeof r)return!1;if(n(r)){for(var i=0,a=r.length;i<a;i++)if(e(r[i]))return!0;return!1}if("function"==typeof t&&t.isBuffer&&t.isBuffer(r)||"function"==typeof ArrayBuffer&&r instanceof ArrayBuffer||o&&r instanceof Blob||s&&r instanceof File)return!0;if(r.toJSON&&"function"==typeof r.toJSON&&1===arguments.length)return e(r.toJSON(),!0);for(var u in r)if(Object.prototype.hasOwnProperty.call(r,u)&&e(r[u]))return!0;return!1}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";var n,i="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_".split(""),o=64,s={},a=0,u=0;function c(e){var t="";do{t=i[e%o]+t,e=Math.floor(e/o)}while(e>0);return t}function f(){var e=c(+new Date);return e!==n?(a=0,n=e):e+"."+c(a++)}for(;u<o;u++)s[i[u]]=u;f.encode=c,f.decode=function(e){var t=0;for(u=0;u<e.length;u++)t=t*o+s[e.charAt(u)];return t},e.exports=f},function(e,t,r){var n=r(281),i=r(114),o=r(1110),s=r(523),a=r(524),u=r(1)("socket.io-client:socket"),c=r(189),f=r(520);e.exports=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){e.exports=function(e,t,r){return e.on(t,r),{destroy:function(){e.removeListener(t,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(284),i=r(285)(),o=r(1115),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(12),i=r(1120);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,s=n;r&&(s=((e,t)=>{if(e)return n(e);n(null,t.slice(0,r))}));try{i=o.createHash(t)}catch(e){return s(e)}i(e,s)},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(284),i=r(285)();function o(e){return Promise.all([i.subtle.exportKey("jwk",e.privateKey),i.subtle.exportKey("jwk",e.publicKey)])}t.utils=r(1123),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,function(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"])}(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(15).bignum;t.toBase64=function(t,r){return t.toArrayLike(e,"be",r).toString("base64").replace(/(=*)$/,"").replace(/\+/g,"-").replace(/\//g,"_")},t.toBn=function(t){return new n(e.from(t,"base64"))}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";const n=r(528);e.exports=function(e){if(!e||"number"!=typeof e)throw new Error("first argument must be a Number bigger than 0");return n.getRandomValues(new Uint8Array(e))}},function(e,t){e.exports=function(e){!function t(){var r=!0,n=!1;do{n=!0,r=!1,e.call(this,function(){n?r=!0:t()}),n=!1}while(r)}()}},function(e,t,r){"use strict";(function(n){const i=r(12),o=r(1134),s=r(17),a=r(4);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).create=function(e,t){"function"==typeof e&&(t=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(287),i=r(288)(),o=r(1135),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(12),i=r(1140);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,s=n;r&&(s=((e,t)=>{if(e)return n(e);n(null,t.slice(0,r))}));try{i=o.createHash(t)}catch(e){return s(e)}i(e,s)},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(287),i=r(288)();function o(e){return Promise.all([i.subtle.exportKey("jwk",e.privateKey),i.subtle.exportKey("jwk",e.publicKey)])}t.utils=r(1143),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,function(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"])}(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(15).bignum;t.toBase64=function(t,r){return t.toArrayLike(e,"be",r).toString("base64").replace(/(=*)$/,"").replace(/\+/g,"-").replace(/\//g,"_")},t.toBn=function(t){return new n(e.from(t,"base64"))}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";const n=r(536);e.exports=function(e){if(!e||"number"!=typeof e)throw new Error("first argument must be a Number bigger than 0");return n.getRandomValues(new Uint8Array(e))}},function(e,t,r){"use strict";(function(n){const i=r(60),o=r(532),s=r(111),a=r(78);const u={string:e=>"string"==typeof e,object:e=>"object"==typeof e,multiaddr:e=>{if(u.string(e))try{return i(e),!0}catch(e){return!1}},function:e=>"function"==typeof e};function c(e,t){if(!Array.isArray(t))throw new Error("Data is not an array");e.forEach((e,r)=>{if(!u[e])throw console.error("Type %s does not exist",e),new Error("Type "+e+" does not exist");if(!u[e](t[r]))throw new Error("Data at index "+r+" is invalid for type "+e)})}(t=e.exports).cleanUrlSIO=function(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="ws"===i&&80===s||"wss"===i&&443===s?"":s;return("wss"===i?"https":"http")+"://"+a+(u?":"+u:"")},t.validate=c,t.Protocol=function(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{c(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)}})})})},t.getIdAndValidate=function(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.validateMa=(e=>a.WebSocketStar.matches(i(e)))}).call(this,r(0).Buffer)},function(e,t,r){var n=r(1153),i=r(220),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){(function(t){var n=r(30),i=r(193),o=r(1161),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,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 f=!1;return function(t){if(!a&&!f)return f=!0,c(e)?e.close(s):function(e){return e.setHeader&&u(e.abort)}(e)?e.abort():u(e.destroy)?e.destroy():void o(t||new Error("stream was destroyed"))}},l=function(e){e()},h=function(e,t){return e.pipe(t)};e.exports=function(){var e,t=Array.prototype.slice.call(arguments),r=u(t[t.length-1]||s)&&t.pop()||s;if(Array.isArray(t[0])&&(t=t[0]),t.length<2)throw new Error("pump requires two streams per minimum");var n=t.map(function(i,o){var s=o<t.length-1;return f(i,s,o>0,function(t){e||(e=t),t&&n.forEach(l),s||(n.forEach(l),r(e))})});return t.reduce(h)}}).call(this,r(7))},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(293),i=r(294)(),o=r(1168),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(293),i=r(294)();function o(e){return Promise.all([i.subtle.exportKey("jwk",e.privateKey),i.subtle.exportKey("jwk",e.publicKey)])}t.utils=r(1173),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,function(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"])}(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(15).bignum;t.toBase64=function(t,r){return t.toArrayLike(e,"be",r).toString("base64").replace(/(=*)$/,"").replace(/\+/g,"-").replace(/\//g,"_")},t.toBn=function(t){return new n(e.from(t,"base64"))}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";const n=r(545);e.exports=function(e){if(!e||"number"!=typeof e)throw new Error("first argument must be a Number bigger than 0");return n.getRandomValues(new Uint8Array(e))}},function(e,t,r){"use strict";(function(e){const n=r(297),i=r(298)(),o=r(1189),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(12),i=r(1194);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,s=n;r&&(s=((e,t)=>{if(e)return n(e);n(null,t.slice(0,r))}));try{i=o.createHash(t)}catch(e){return s(e)}i(e,s)},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(297),i=r(298)();function o(e){return Promise.all([i.subtle.exportKey("jwk",e.privateKey),i.subtle.exportKey("jwk",e.publicKey)])}t.utils=r(1197),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,function(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"])}(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(15).bignum;t.toBase64=function(t,r){return t.toArrayLike(e,"be",r).toString("base64").replace(/(=*)$/,"").replace(/\+/g,"-").replace(/\//g,"_")},t.toBn=function(t){return new n(e.from(t,"base64"))}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";const n=r(551);e.exports=function(e){if(!e||"number"!=typeof e)throw new Error("first argument must be a Number bigger than 0");return n.getRandomValues(new Uint8Array(e))}},function(e,t,r){"use strict";(function(e){const n=r(301),i=r(302)(),o=r(1216),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(12),i=r(1221);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,s=n;r&&(s=((e,t)=>{if(e)return n(e);n(null,t.slice(0,r))}));try{i=o.createHash(t)}catch(e){return s(e)}i(e,s)},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(301),i=r(302)();function o(e){return Promise.all([i.subtle.exportKey("jwk",e.privateKey),i.subtle.exportKey("jwk",e.publicKey)])}t.utils=r(1224),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,function(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"])}(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(15).bignum;t.toBase64=function(t,r){return t.toArrayLike(e,"be",r).toString("base64").replace(/(=*)$/,"").replace(/\+/g,"-").replace(/\//g,"_")},t.toBn=function(t){return new n(e.from(t,"base64"))}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";const n=r(557);e.exports=function(e){if(!e||"number"!=typeof e)throw new Error("first argument must be a Number bigger than 0");return n.getRandomValues(new Uint8Array(e))}},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)?function(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}(e):function(e){return p.call(e)}(e)}e.exports=function(e){if(!function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}(e))return!1;var t=g(e);return t==n||t==i||t==r||t==s}}).call(this,r(6))},function(e,t,r){"use strict";(function(t){const n=r(100),i=r(52),o=r(195).writeEncoded;e.exports=function(e,r,s){const a=n({timeout:6e4},r),u=a.handshake;return s("writing multicodec: "+e),o(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());s("received ack: "+i),r(null,u.rest())}),a}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e,t){return function(r,o,s,a){a=a||n.default;var u,c=!1;r(o,function(r,n,o){s(r,function(n,s){n?o(n):e(s)&&!u?(c=!0,u=t(!0,r),o(null,i.default)):o()})},function(e){e?a(e):a(null,c?u:t(!1))})}};var n=o(r(62)),i=o(r(216));function o(e){return e&&e.__esModule?e:{default:e}}e.exports=t.default},function(e,t,r){"use strict";e.exports=function(e,t,r){r(null,e===t)}},function(e,t,r){"use strict";e.exports.PROTOCOL_ID="/multistream/1.0.0"},function(e,t,r){"use strict";e.exports=r(1238)},function(e,t,r){"use strict";(function(e){const n=r(307),i=r(308)(),o=r(1243),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(12),i=r(1248);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,s=n;r&&(s=((e,t)=>{if(e)return n(e);n(null,t.slice(0,r))}));try{i=o.createHash(t)}catch(e){return s(e)}i(e,s)},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(307),i=r(308)();function o(e){return Promise.all([i.subtle.exportKey("jwk",e.privateKey),i.subtle.exportKey("jwk",e.publicKey)])}t.utils=r(1251),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,function(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"])}(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(15).bignum;t.toBase64=function(t,r){return t.toArrayLike(e,"be",r).toString("base64").replace(/(=*)$/,"").replace(/\+/g,"-").replace(/\//g,"_")},t.toBn=function(t){return new n(e.from(t,"base64"))}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";const n=r(569);e.exports=function(e){if(!e||"number"!=typeof e)throw new Error("first argument must be a Number bigger than 0");return n.getRandomValues(new Uint8Array(e))}},function(e,t,r){(function(e,t){!function(e,r){"use strict";if(!e.setImmediate){var n,i=1,o={},s=!1,a=e.document,u=Object.getPrototypeOf&&Object.getPrototypeOf(e);u=u&&u.setTimeout?u:e,"[object process]"==={}.toString.call(e.process)?n=function(e){t.nextTick(function(){f(e)})}:function(){if(e.postMessage&&!e.importScripts){var t=!0,r=e.onmessage;return e.onmessage=function(){t=!1},e.postMessage("","*"),e.onmessage=r,t}}()?function(){var t="setImmediate$"+Math.random()+"$",r=function(r){r.source===e&&"string"==typeof r.data&&0===r.data.indexOf(t)&&f(+r.data.slice(t.length))};e.addEventListener?e.addEventListener("message",r,!1):e.attachEvent("onmessage",r),n=function(r){e.postMessage(t+r,"*")}}():e.MessageChannel?function(){var e=new MessageChannel;e.port1.onmessage=function(e){f(e.data)},n=function(t){e.port2.postMessage(t)}}():a&&"onreadystatechange"in a.createElement("script")?function(){var e=a.documentElement;n=function(t){var r=a.createElement("script");r.onreadystatechange=function(){f(t),r.onreadystatechange=null,e.removeChild(r),r=null},e.appendChild(r)}}():n=function(e){setTimeout(f,0,e)},u.setImmediate=function(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 s={callback:e,args:t};return o[i]=s,n(i),i++},u.clearImmediate=c}function c(e){delete o[e]}function f(e){if(s)setTimeout(f,0,e);else{var t=o[e];if(t){s=!0;try{!function(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)}}(t)}finally{c(e),s=!1}}}}}("undefined"==typeof self?void 0===e?this:e:self)}).call(this,r(6),r(7))},function(e,t,r){var n=r(574);e.exports=function(e,t,r){"__proto__"==t&&n?n(e,t,{configurable:!0,enumerable:!0,value:r,writable:!0}):e[t]=r}},function(e,t,r){var n=r(312),i=function(){try{var e=n(Object,"defineProperty");return e({},"",{}),e}catch(e){}}();e.exports=i},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(1282),i=r(51),o=r(60);e.exports=function(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")}},function(e,t,r){"use strict";(function(e){const n=r(314),i=r(315)(),o=r(1284),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(12),i=r(1289);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,s=n;r&&(s=((e,t)=>{if(e)return n(e);n(null,t.slice(0,r))}));try{i=o.createHash(t)}catch(e){return s(e)}i(e,s)},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(314),i=r(315)();function o(e){return Promise.all([i.subtle.exportKey("jwk",e.privateKey),i.subtle.exportKey("jwk",e.publicKey)])}t.utils=r(1292),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,function(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"])}(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(15).bignum;t.toBase64=function(t,r){return t.toArrayLike(e,"be",r).toString("base64").replace(/(=*)$/,"").replace(/\+/g,"-").replace(/\//g,"_")},t.toBn=function(t){return new n(e.from(t,"base64"))}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";const n=r(580);e.exports=function(e){if(!e||"number"!=typeof e)throw new Error("first argument must be a Number bigger than 0");return n.getRandomValues(new Uint8Array(e))}},function(e,t,r){"use strict";const n=r(47).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(1314);e.exports=function(e,t,r){var i=null==e?void 0:n(e,t);return void 0===i?r:i}},function(e,t,r){(function(n){function i(){var e;try{e=t.storage.debug}catch(e){}return!e&&void 0!==n&&"env"in n&&(e=n.env.DEBUG),e}(t=e.exports=r(1344)).log=function(){return"object"==typeof console&&console.log&&Function.prototype.apply.call(console.log,console,arguments)},t.formatArgs=function(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&&"%c"===e&&(o=++i)}),e.splice(o,0,n)}},t.save=function(e){try{null==e?t.storage.removeItem("debug"):t.storage.debug=e}catch(e){}},t.load=i,t.useColors=function(){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+)/)},t.storage="undefined"!=typeof chrome&&void 0!==chrome.storage?chrome.storage.local:function(){try{return window.localStorage}catch(e){}}(),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(i())}).call(this,r(7))},function(e,t,r){"use strict";const n=r(10),i=n(r(1354)),o=n(r(1355));(t=e.exports).rpc=i,t.td=o},function(e,t,r){"use strict";(function(e){const n=r(319),i=r(320)(),o=r(1361),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(12),i=r(1366);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,s=n;r&&(s=((e,t)=>{if(e)return n(e);n(null,t.slice(0,r))}));try{i=o.createHash(t)}catch(e){return s(e)}i(e,s)},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(319),i=r(320)();function o(e){return Promise.all([i.subtle.exportKey("jwk",e.privateKey),i.subtle.exportKey("jwk",e.publicKey)])}t.utils=r(1369),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,function(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"])}(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(15).bignum;t.toBase64=function(t,r){return t.toArrayLike(e,"be",r).toString("base64").replace(/(=*)$/,"").replace(/\+/g,"-").replace(/\//g,"_")},t.toBn=function(t){return new n(e.from(t,"base64"))}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";const n=r(590);e.exports=function(e){if(!e||"number"!=typeof e)throw new Error("first argument must be a Number bigger than 0");return n.getRandomValues(new Uint8Array(e))}},function(e,t,r){"use strict";var n=r(1377);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){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";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 r(e)&&2===e.length}function i(e){return r(e)&&1===e.length}t.isDuplex=function(e){return"object"==typeof e&&n(e.source)&&i(e.sink)},t.isSource=n,t.isSink=i},function(e,t,r){"use strict";const n=r(200).OFFLINE_ERROR,i=r(23),o=r(3),s=r(122),a=r(9),u=r(110);function c(e){return Array.from(e).map(e=>({"/":e[1].cid.toBaseEncodedString()}))}e.exports=function(e){return{wantlist:i((t,r)=>{if(r||(r=t,t=void 0),!e.isOnline())return o(()=>r(new Error(n)));let i;if(t){try{t=u.createFromB58String(t)}catch(e){t=null}if(!t)return o(()=>r(new Error("Invalid peerId")));i=e._bitswap.wantlistForPeer(t)}else i=e._bitswap.getWantlist();return i=c(i),o(()=>r(null,{Keys:i}))}),stat:i(t=>{if(!e.isOnline())return o(()=>t(new Error(n)));const r=e._bitswap.stat().snapshot;t(null,{provideBufLen:parseInt(r.providesBufferLength.toString()),blocksReceived:new s(r.blocksReceived),wantlist:c(e._bitswap.getWantlist()),peers:e._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((t,r)=>e.isOnline()?(Array.isArray(t)||(t=[t]),t=t.map(e=>a.isCID(e)?e:new a(e)),o(()=>r(null,e._bitswap.unwant(t)))):o(()=>r(new Error(n))))}}},function(e,t,r){"use strict";e.exports=r(1436)},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(4),{DAGNode:i}=r(45),o={format:"dag-pb",hashAlg:"sha2-256"};e.exports=((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)})},function(e,t,r){"use strict";e.exports=(e=>{return e(!0)})},function(e,t,r){"use strict";const n=r(64);e.exports=function(e,t){const r=(e=e.slice()).filter(e=>"function"==typeof e).pop(),i=Object.assign({},t,e.filter(e=>"object"==typeof e).pop()||{});return Array.isArray(e[0])&&(e=e[0]),{sources:e.filter(e=>"string"==typeof e).map(e=>({path:e=e.trim(),name:n.basename(e),dir:n.dirname(e)})),options:i,callback:r}}},function(e,t,r){"use strict";const n=r(9),i=r(1)("ipfs:mfs:utils:with-mfs-root"),o=r(4),{MFS_ROOT_KEY:s}=r(146);e.exports=((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)})},function(e,t,r){"use strict";const{FILE_SEPARATOR:n}=r(146);e.exports=((e,t)=>{if(!(e=(e||"").trim()))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})})},function(e,t,r){"use strict";const n=r(35).unmarshal,{traverseTo:i,formatCid:o}=r(48),s=r(4),a=r(1)("ipfs:mfs:stat"),u={hash:!1,size:!1,withLocal:!1,cidBase:"base58btc"};e.exports=(e=>(function(t,r,c){"function"==typeof r&&(c=r,r={}),r=Object.assign({},u,r),a(`Fetching stats for ${t}`),s([r=>i(e,t,{withCreateHint:!1},r),({node:e},t)=>{if(r.hash)return t(null,{hash:o(e.multihash,r.cidBase)});if(r.size)return t(null,{size:e.size});const i=n(e.data);let s=e.links.length;"file"===i.type&&(s=i.blockSizes.length),t(null,{hash:o(e.multihash,r.cidBase),size:i.fileSize()||0,cumulativeSize:e.size,blocks:s,type:i.type,local:void 0,sizeLocal:void 0,withLocality:!1})}],c)}))},function(e,t,r){"use strict";const n=r(4),i=r(63),o=r(49),s=r(35),{traverseTo:a,addLink:u,updateTree:c,updateMfsRoot:f,toSourcesAndDestination:l}=r(48),h=r(606),p=r(1)("ipfs:mfs:cp"),d={parents:!1,flush:!0,format:"dag-pb",hashAlg:"sha2-256"};e.exports=(e=>(function(){const t=Array.from(arguments),{sources:r,destination:n,options:i,callback:o}=l(t,d);return r.length?n?(i.parents=i.p||i.parents,void a(e,n.path,{},(t,a)=>{if(t)return 1===r.length?(p("Only one source, copying to a file"),y(e,r.pop(),n,i,o)):(p("Multiple sources, copying to a directory"),g(e,r,n,i,o));if("directory"===s.unmarshal(a.node.data).type)return g(e,r,n,i,o);o(new Error("directory already has entry by that name"))})):o(new Error("Please supply a destination")):o(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(35),i=r(4),o=r(49),{DAGNode:s}=r(45),a=r(9),{traverseTo:u,updateTree:c,updateMfsRoot:f,toSources:l,FILE_SEPARATOR:h}=r(48),p={recursive:!1};e.exports=(e=>(function(){const t=Array.from(arguments),{sources:r,options:n,callback:i}=l(t,p);if(!r.length)return i(new Error("Please supply at least one path to remove"));o(r.map(t=>r=>d(e,t.path,n,r)),e=>i(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)=>{if("directory"===n.unmarshal(o.node.data).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(4),i=r(70),o=r(86),s=r(87),a=r(145).importer,{loadNode:u}=r(48);e.exports=((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)})},function(e,t,r){(function(t){var n=r(1469).strict;e.exports=function(e){if(n(e)){var r=t.from(e.buffer);return e.byteLength!==e.buffer.byteLength&&(r=r.slice(e.byteOffset,e.byteOffset+e.byteLength)),r}return t.from(e)}}).call(this,r(0).Buffer)},function(e,t,r){(function(e,r){var n=200,i="__lodash_hash_undefined__",o=9007199254740991,s="[object Arguments]",a="[object Boolean]",u="[object Date]",c="[object Function]",f="[object GeneratorFunction]",l="[object Map]",h="[object Number]",p="[object Object]",d="[object Promise]",y="[object RegExp]",g="[object Set]",m="[object String]",b="[object Symbol]",v="[object WeakMap]",_="[object ArrayBuffer]",w="[object DataView]",S="[object Float32Array]",k="[object Float64Array]",E="[object Int8Array]",A="[object Int16Array]",x="[object Int32Array]",I="[object Uint8Array]",T="[object Uint8ClampedArray]",B="[object Uint16Array]",C="[object Uint32Array]",P=/\w*$/,O=/^\[object .+?Constructor\]$/,R=/^(?:0|[1-9]\d*)$/,N={};N[s]=N["[object Array]"]=N[_]=N[w]=N[a]=N[u]=N[S]=N[k]=N[E]=N[A]=N[x]=N[l]=N[h]=N[p]=N[y]=N[g]=N[m]=N[b]=N[I]=N[T]=N[B]=N[C]=!0,N["[object Error]"]=N[c]=N[v]=!1;var L="object"==typeof e&&e&&e.Object===Object&&e,K="object"==typeof self&&self&&self.Object===Object&&self,j=L||K||Function("return this")(),M="object"==typeof t&&t&&!t.nodeType&&t,D=M&&"object"==typeof r&&r&&!r.nodeType&&r,U=D&&D.exports===M;function F(e,t){return e.set(t[0],t[1]),e}function q(e,t){return e.add(t),e}function H(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 z(e){var t=!1;if(null!=e&&"function"!=typeof e.toString)try{t=!!(e+"")}catch(e){}return t}function V(e){var t=-1,r=Array(e.size);return e.forEach(function(e,n){r[++t]=[n,e]}),r}function G(e,t){return function(r){return e(t(r))}}function W(e){var t=-1,r=Array(e.size);return e.forEach(function(e){r[++t]=e}),r}var $,Y=Array.prototype,J=Function.prototype,X=Object.prototype,Z=j["__core-js_shared__"],Q=($=/[^.]+$/.exec(Z&&Z.keys&&Z.keys.IE_PROTO||""))?"Symbol(src)_1."+$:"",ee=J.toString,te=X.hasOwnProperty,re=X.toString,ne=RegExp("^"+ee.call(te).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),ie=U?j.Buffer:void 0,oe=j.Symbol,se=j.Uint8Array,ae=G(Object.getPrototypeOf,Object),ue=Object.create,ce=X.propertyIsEnumerable,fe=Y.splice,le=Object.getOwnPropertySymbols,he=ie?ie.isBuffer:void 0,pe=G(Object.keys,Object),de=De(j,"DataView"),ye=De(j,"Map"),ge=De(j,"Promise"),me=De(j,"Set"),be=De(j,"WeakMap"),ve=De(Object,"create"),_e=Ve(de),we=Ve(ye),Se=Ve(ge),ke=Ve(me),Ee=Ve(be),Ae=oe?oe.prototype:void 0,xe=Ae?Ae.valueOf:void 0;function Ie(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 Te(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 Be(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 Ce(e){this.__data__=new Te(e)}function Pe(e,t){var r=We(e)||function(e){return function(e){return function(e){return!!e&&"object"==typeof e}(e)&&$e(e)}(e)&&te.call(e,"callee")&&(!ce.call(e,"callee")||re.call(e)==s)}(e)?function(e,t){for(var r=-1,n=Array(e);++r<e;)n[r]=t(r);return n}(e.length,String):[],n=r.length,i=!!n;for(var o in e)!t&&!te.call(e,o)||i&&("length"==o||He(o,n))||r.push(o);return r}function Oe(e,t,r){var n=e[t];te.call(e,t)&&Ge(n,r)&&(void 0!==r||t in e)||(e[t]=r)}function Re(e,t){for(var r=e.length;r--;)if(Ge(e[r][0],t))return r;return-1}function Ne(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(!Xe(e))return e;var l=We(e);if(l){if(u=function(e){var t=e.length,r=e.constructor(t);return t&&"string"==typeof e[0]&&te.call(e,"index")&&(r.index=e.index,r.input=e.input),r}(e),!t)return function(e,t){var r=-1,n=e.length;for(t||(t=Array(n));++r<n;)t[r]=e[r];return t}(e,u)}else{var h=Fe(e),d=h==c||h==f;if(Ye(e))return function(e,t){if(t)return e.slice();var r=new e.constructor(e.length);return e.copy(r),r}(e,t);if(h==p||h==s||d&&!o){if(z(e))return o?e:{};if(u=function(e){return"function"!=typeof e.constructor||ze(e)?{}:function(e){return Xe(e)?ue(e):{}}(ae(e))}(d?{}:e),!t)return function(e,t){return je(e,Ue(e),t)}(e,function(e,t){return e&&je(t,Ze(t),e)}(u,e))}else{if(!N[h])return o?e:{};u=qe(e,h,Ne,t)}}a||(a=new Ce);var y=a.get(e);if(y)return y;if(a.set(e,u),!l)var g=r?function(e){return function(e,t,r){var n=t(e);return We(e)?n:function(e,t){for(var r=-1,n=t.length,i=e.length;++r<n;)e[i+r]=t[r];return e}(n,r(e))}(e,Ze,Ue)}(e):Ze(e);return function(e,t){for(var r=-1,n=e?e.length:0;++r<n&&!1!==t(e[r],r,e););}(g||e,function(i,o){g&&(i=e[o=i]),Oe(u,o,Ne(i,t,r,n,o,e,a))}),u}function Le(e){return!(!Xe(e)||function(e){return!!Q&&Q in e}(e))&&(Je(e)||z(e)?ne:O).test(Ve(e))}function Ke(e){var t=new e.constructor(e.byteLength);return new se(t).set(new se(e)),t}function je(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;Oe(r,s,void 0===a?e[s]:a)}return r}function Me(e,t){var r=e.__data__;return function(e){var t=typeof e;return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e}(t)?r["string"==typeof t?"string":"hash"]:r.map}function De(e,t){var r=function(e,t){return null==e?void 0:e[t]}(e,t);return Le(r)?r:void 0}Ie.prototype.clear=function(){this.__data__=ve?ve(null):{}},Ie.prototype.delete=function(e){return this.has(e)&&delete this.__data__[e]},Ie.prototype.get=function(e){var t=this.__data__;if(ve){var r=t[e];return r===i?void 0:r}return te.call(t,e)?t[e]:void 0},Ie.prototype.has=function(e){var t=this.__data__;return ve?void 0!==t[e]:te.call(t,e)},Ie.prototype.set=function(e,t){return this.__data__[e]=ve&&void 0===t?i:t,this},Te.prototype.clear=function(){this.__data__=[]},Te.prototype.delete=function(e){var t=this.__data__,r=Re(t,e);return!(r<0||(r==t.length-1?t.pop():fe.call(t,r,1),0))},Te.prototype.get=function(e){var t=this.__data__,r=Re(t,e);return r<0?void 0:t[r][1]},Te.prototype.has=function(e){return Re(this.__data__,e)>-1},Te.prototype.set=function(e,t){var r=this.__data__,n=Re(r,e);return n<0?r.push([e,t]):r[n][1]=t,this},Be.prototype.clear=function(){this.__data__={hash:new Ie,map:new(ye||Te),string:new Ie}},Be.prototype.delete=function(e){return Me(this,e).delete(e)},Be.prototype.get=function(e){return Me(this,e).get(e)},Be.prototype.has=function(e){return Me(this,e).has(e)},Be.prototype.set=function(e,t){return Me(this,e).set(e,t),this},Ce.prototype.clear=function(){this.__data__=new Te},Ce.prototype.delete=function(e){return this.__data__.delete(e)},Ce.prototype.get=function(e){return this.__data__.get(e)},Ce.prototype.has=function(e){return this.__data__.has(e)},Ce.prototype.set=function(e,t){var r=this.__data__;if(r instanceof Te){var i=r.__data__;if(!ye||i.length<n-1)return i.push([e,t]),this;r=this.__data__=new Be(i)}return r.set(e,t),this};var Ue=le?G(le,Object):function(){return[]},Fe=function(e){return re.call(e)};function qe(e,t,r,n){var i=e.constructor;switch(t){case _:return Ke(e);case a:case u:return new i(+e);case w:return function(e,t){var r=t?Ke(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.byteLength)}(e,n);case S:case k:case E:case A:case x:case I:case T:case B:case C:return function(e,t){var r=t?Ke(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.length)}(e,n);case l:return function(e,t,r){return H(t?r(V(e),!0):V(e),F,new e.constructor)}(e,n,r);case h:case m:return new i(e);case y:return function(e){var t=new e.constructor(e.source,P.exec(e));return t.lastIndex=e.lastIndex,t}(e);case g:return function(e,t,r){return H(t?r(W(e),!0):W(e),q,new e.constructor)}(e,n,r);case b:return function(e){return xe?Object(xe.call(e)):{}}(e)}}function He(e,t){return!!(t=null==t?o:t)&&("number"==typeof e||R.test(e))&&e>-1&&e%1==0&&e<t}function ze(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||X)}function Ve(e){if(null!=e){try{return ee.call(e)}catch(e){}try{return e+""}catch(e){}}return""}function Ge(e,t){return e===t||e!=e&&t!=t}(de&&Fe(new de(new ArrayBuffer(1)))!=w||ye&&Fe(new ye)!=l||ge&&Fe(ge.resolve())!=d||me&&Fe(new me)!=g||be&&Fe(new be)!=v)&&(Fe=function(e){var t=re.call(e),r=t==p?e.constructor:void 0,n=r?Ve(r):void 0;if(n)switch(n){case _e:return w;case we:return l;case Se:return d;case ke:return g;case Ee:return v}return t});var We=Array.isArray;function $e(e){return null!=e&&function(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=o}(e.length)&&!Je(e)}var Ye=he||function(){return!1};function Je(e){var t=Xe(e)?re.call(e):"";return t==c||t==f}function Xe(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function Ze(e){return $e(e)?Pe(e):function(e){if(!ze(e))return pe(e);var t=[];for(var r in Object(e))te.call(e,r)&&"constructor"!=r&&t.push(r);return t}(e)}r.exports=function(e){return Ne(e,!0,!0)}}).call(this,r(6),r(27)(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(5),i=r(22).Transform,o=r(1508);function s(e,t){if(!(this instanceof s))return new s(e,t);i.call(this),t||(t={}),"object"==typeof e&&(e=(t=e).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(5),i=r(22);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()}t._current=e,t._forward(),e.on("readable",r),e.once("end",function i(){t._current=null,e.removeListener("readable",r),e.removeListener("end",i),e.removeListener("close",n),t._next()}),e.once("close",n)},o.prototype._attachErrorListener=function(e){var t=this;e&&e.once("error",function r(n){e.removeListener("error",r),t.destroy(n)})}},function(e,t,r){(function(t,n){var i=r(204),o=r(1518),s=r(95),a=r(1519),u=r(1523),c=r(64),f=r(148),l=r(205);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 function(e){t.isBuffer(e)&&(e=i.decode(e)),d(e.info,"info"),d(e.info["name.utf-8"]||e.info.name,"info.name"),d(e.info["piece length"],"info['piece length']"),d(e.info.pieces,"info.pieces"),e.info.files?e.info.files.forEach(function(e){d("number"==typeof e.length,"info.files[0].length"),d(e["path.utf-8"]||e.path,"info.files[0].path")}):d("number"==typeof e.info.length,"info.length");var r={};r.info=e.info,r.infoBuffer=i.encode(e.info),r.infoHash=f.sync(r.infoBuffer),r.infoHashBuffer=t.from(r.infoHash,"hex"),r.name=(e.info["name.utf-8"]||e.info.name).toString(),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()),r.announce=[],Array.isArray(e["announce-list"])&&e["announce-list"].length>0?e["announce-list"].forEach(function(e){e.forEach(function(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(function(e){return e.toString()}),l(r.announce),l(r.urlList);var n=e.info.files||[e.info];r.files=n.map(function(e,t){var i=[].concat(r.name,e["path.utf-8"]||e.path||[]).map(function(e){return 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(p,0)}}),r.length=n.reduce(p,0);var 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=function(e){for(var t=[],r=0;r<e.length;r+=20)t.push(e.slice(r,r+20).toString("hex"));return t}(e.info.pieces),r}(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){return e+t.length}function d(e,t){if(!e)throw new Error("Torrent is missing required field: "+t)}e.exports=h,e.exports.remote=function(e,t){var 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(function(){t(null,r)}):function(e){return"undefined"!=typeof Blob&&e instanceof Blob}(e)?o(e,function(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)"}},function(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,function(e,r){if(e)return t(new Error("Invalid torrent identifier"));i(r)}):n.nextTick(function(){t(new Error("Invalid torrent identifier"))})},e.exports.toMagnetURI=u.encode,e.exports.toTorrentFile=function(e){var r={info:e.info};return r["announce-list"]=(e.announce||[]).map(function(e){return r.announce||(r.announce=e),[e=t.from(e,"utf8")]}),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)},t.alloc(0)}).call(this,r(0).Buffer,r(7))},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(6))},function(e,t,r){(function(e,n,i){var o=r(617),s=r(5),a=r(22),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 e(){l.read().then(function(t){if(!c._destroyed){if(t.done)return i.clearTimeout(u),void c.push(null);c.push(new n(t.value)),e()}}).catch(function(e){i.clearTimeout(u),c._destroyed||c.emit("error",e)})}()}else{if(c._xhr=t,c._pos=0,c.url=t.responseURL,c.statusCode=t.status,c.statusMessage=t.statusText,t.getAllResponseHeaders().split(/\r?\n/).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 h=c.rawHeaders["mime-type"];if(h){var p=h.match(/;\s*charset=([^;])(;|$)/);p&&(c._charset=p[1].toLowerCase())}c._charset||(c._charset="utf-8")}}};s(c,a.Readable),c.prototype._read=function(){var e=this._resumeFetch;e&&(this._resumeFetch=null,e())},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(7),r(0).Buffer,r(6))},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(328),i=r(33),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(622);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")},i(t,r(1534))},function(e,t){e.exports=function(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};var r=Object.prototype.hasOwnProperty},function(e,t,r){(function(t){e.exports=l;const n=r(327),i=r(1542),o=r(328),s=r(620),a=r(30),u=r(209),c=r(33),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"),delete e.body,delete e.form,h&&(e.method||(e.method="POST"),f(h)||(e.headers["content-length"]=t.byteLength(h)),e.json&&(e.headers["content-type"]="application/json")),e.json&&(e.headers.accept="application/json"),e.method&&(e.method=e.method.toUpperCase());const p=("https:"===e.protocol?s:o).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 p.on("timeout",()=>{p.abort(),r(new Error("Request timed out"))}),p.on("error",r),f(h)?h.on("error",r).pipe(p):p.end(h),p}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(5),i=r(22),o=r(619),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),r._streams.slice().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){return new c(this,e)},u.prototype.error=function(e){this.detailedError||(this.detailedError=e),this._dumpDebugData();try{this._mediaSource.endOfStream("decode")}catch(e){}},u.prototype._dumpDebugData=function(){this._debug&&(this._debug=!1,this._streams.forEach(function(e,t){!function(e,t){var r=document.createElement("a");r.href=window.URL.createObjectURL(new window.Blob(e)),r.download=t,r.click()}(e._debugBuffers,"mediasource-stream-"+t)}))},n(c,i.Writable),c.prototype._onSourceOpen=function(){this.destroyed||(this._mediaSource.removeEventListener("sourceopen",this._openHandler),this._createSourceBuffer())},c.prototype.destroy=function(e){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(){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 e=this._cb;this._cb=null,e()}}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(){if(!this.destroyed&&this._sourceBuffer&&!this._sourceBuffer.updating&&!("open"===this._mediaSource.readyState&&this._getBufferDuration()>this._bufferDuration)&&this._cb){var e=this._cb;this._cb=null,e()}};c.prototype._getBufferDuration=function(){for(var e=this._sourceBuffer.buffered,t=this._elem.currentTime,r=-1,n=0;n<e.length;n++){var i=e.start(n),o=e.end(n)+0;if(i>t)break;(r>=0||t<=o)&&(r=o)}var s=r-t;return s<0&&(s=0),s}},function(e,t,r){var n=r(626);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(30);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){e.exports=function(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}}},function(e,t,r){e.exports=k;var n=r(627),i=r(204),o=r(206),s=r(2).Buffer,a=r(1)("bittorrent-protocol"),u=r(26),c=r(5),f=r(107),l=r(329),h=r(22),p=4e5,d=s.from("BitTorrent protocol"),y=s.from([0,0,0,0]),g=s.from([0,0,0,1,0]),m=s.from([0,0,0,1,1]),b=s.from([0,0,0,1,2]),v=s.from([0,0,0,1,3]),_=[0,0,0,0,0,0,0,0],w=[0,0,0,3,9,0,0];function S(e,t,r,n){this.piece=e,this.offset=t,this.length=r,this.callback=n}function k(){if(!(this instanceof k))return new k;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 E(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(k,h.Duplex),k.prototype.setKeepAlive=function(e){var t=this;t._debug("setKeepAlive %s",e),clearInterval(t._keepAliveInterval),!1!==e&&(t._keepAliveInterval=setInterval(function(){t.keepAlive()},55e3))},k.prototype.setTimeout=function(e,t){this._debug("setTimeout ms=%d unref=%s",e,t),this._clearTimeout(),this._timeoutMs=e,this._timeoutUnref=!!t,this._updateTimeout()},k.prototype.destroy=function(){this.destroyed||(this.destroyed=!0,this._debug("destroy"),this.emit("close"),this.end())},k.prototype.end=function(){this._debug("end"),this._onUninterested(),this._onChoke(),h.Duplex.prototype.end.apply(this,arguments)},k.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},k.prototype.keepAlive=function(){this._debug("keep-alive"),this._push(y)},k.prototype.handshake=function(e,t,r){var n,i;if("string"==typeof e?(e=e.toLowerCase(),n=s.from(e,"hex")):e=(n=e).toString("hex"),"string"==typeof t?i=s.from(t,"hex"):t=(i=t).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(_);o[5]|=16,r&&r.dht&&(o[7]|=1),this._push(s.concat([d,o,n,i])),this._handshakeSent=!0,this.peerExtensions.extended&&!this._extendedHandshakeSent&&this._sendExtendedHandshake()},k.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},k.prototype.choke=function(){if(!this.amChoking){for(this.amChoking=!0,this._debug("choke");this.peerRequests.length;)this.peerRequests.pop();this._push(g)}},k.prototype.unchoke=function(){this.amChoking&&(this.amChoking=!1,this._debug("unchoke"),this._push(m))},k.prototype.interested=function(){this.amInterested||(this.amInterested=!0,this._debug("interested"),this._push(b))},k.prototype.uninterested=function(){this.amInterested&&(this.amInterested=!1,this._debug("uninterested"),this._push(v))},k.prototype.have=function(e){this._debug("have %d",e),this._message(4,[e],null)},k.prototype.bitfield=function(e){this._debug("bitfield"),s.isBuffer(e)||(e=e.buffer),this._message(5,[],e)},k.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 S(e,t,r,n)),this._updateTimeout(),void this._message(6,[e,t,r],null))},k.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)},k.prototype.cancel=function(e,t,r){this._debug("cancel index=%d offset=%d length=%d",e,t,r),this._callback(E(this.requests,e,t,r),new Error("request was cancelled"),null),this._message(8,[e,t,r],null)},k.prototype.port=function(e){this._debug("port %d",e);var t=s.from(w);t.writeUInt16BE(e,5),this._push(t)},k.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]))},k.prototype._read=function(){},k.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)},k.prototype._push=function(e){if(!this._finished)return this.push(e)},k.prototype._onKeepAlive=function(){this._debug("got keep-alive"),this.emit("keep-alive")},k.prototype._onHandshake=function(e,t,r){var n,i=e.toString("hex"),o=t.toString("hex");for(n in this._debug("got handshake i=%s p=%s exts=%o",i,o,r),this.peerId=o,this.peerIdBuffer=t,this.peerExtensions=r,this.emit("handshake",i,o,r),this._ext)this._ext[n].onHandshake(i,o,r);r.extended&&this._handshakeSent&&!this._extendedHandshakeSent&&this._sendExtendedHandshake()},k.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)},k.prototype._onUnchoke=function(){this.peerChoking=!1,this._debug("got unchoke"),this.emit("unchoke")},k.prototype._onInterested=function(){this.peerInterested=!0,this._debug("got interested"),this.emit("interested")},k.prototype._onUninterested=function(){this.peerInterested=!1,this._debug("got uninterested"),this.emit("uninterested")},k.prototype._onHave=function(e){this.peerPieces.get(e)||(this._debug("got have %d",e),this.peerPieces.set(e,!0),this.emit("have",e))},k.prototype._onBitField=function(e){this.peerPieces=new o(e),this._debug("got bitfield"),this.emit("bitfield",this.peerPieces)},k.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===E(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 S(e,t,r,i);n.peerRequests.push(o),n.emit("request",e,t,r,i)}},k.prototype._onPiece=function(e,t,r){this._debug("got piece index=%d offset=%d",e,t),this._callback(E(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)},k.prototype._onCancel=function(e,t,r){this._debug("got cancel index=%d offset=%d length=%d",e,t,r),E(this.peerRequests,e,t,r),this.emit("cancel",e,t,r)},k.prototype._onPort=function(e){this._debug("got port %d",e),this.emit("port",e)},k.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)},k.prototype._onTimeout=function(){this._debug("request timed out"),this._callback(this.requests.shift(),new Error("request has timed out"),null),this.emit("timeout")},k.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)},k.prototype._callback=function(e,t,r){e&&(this._clearTimeout(),this.peerChoking||this._finished||this._updateTimeout(),e.callback(t,r))},k.prototype._clearTimeout=function(){this._timeout&&(clearTimeout(this._timeout),this._timeout=null)},k.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())},k.prototype._parse=function(e,t){this._parserSize=e,this._parser=t},k.prototype._onMessageLength=function(e){var t=e.readUInt32BE(0);t>0?this._parse(t,this._onMessage):(this._onKeepAlive(),this._parse(4,this._onMessageLength))},k.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)}},k.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)})})},k.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)},k.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);var n=(r=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}if(t.obj.has(r,"?")){if(!function(e,t){for(var r,n=-1,i=0;r=t[i++];)if(!~(n=e.indexOf(r,n+1)))return!1;return!0}(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])?-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 a(e,r,t=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,h,p,d,y=0,g=r(u);if(e.r=null,i&&o(a)&&(p=i(a),d=!0),n(a)||p)for(l=(p||a).length;y<l;y++){var m=y+t.list.index;if(g){if((h=d?u.call(c||this,a[p[y]],p[y],e):u.call(c||this,a[y],m,e))!==f)return h}else if(u===a[d?p[y]:y])return p?p[y]:m}else for(y in a)if(g){if(s(a,y)&&(h=c?u.call(c,a[y],y,e):u(a[y],y,e))!==f)return h}else if(u===a[y])return y;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};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 i={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(i.back=t.last||t).to=i,t.last=i}return(t=t.to)&&void 0!==r&&t.next(r),t}})(i,"./onto"),i(function(e){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 t=JSON.stringify;e.exports=function(e,r,n,i,o){if(e<r)return{defer:!0};if(r<n)return{historical:!0};if(n<r)return{converge:!0,incoming:!0};if(r===n){if((i=t(i)||"")===(o=t(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 "+r+" to "+n+"!"}}})(i,"./HAM"),i(function(e){var t=i("./type"),r={is:function(e){return void 0!==e&&(null===e||e!==1/0&&(!!(a(e)||o(e)||s(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&&a(e)?void(r.id=e):r.id=!1}r.rel.is=function(t){if(t&&t[n]&&!t._&&c(t)){var r={};if(l(t,e,r),r.id)return r.id}return!1}}(),r.rel.ify=function(e){return f({},n,e)},t.obj.has._=".";var n=r.link._,o=t.bi.is,s=t.num.is,a=t.text.is,u=t.obj,c=u.is,f=u.put,l=u.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||f]}};n.soul.ify=function(e,t){return t="string"==typeof t?{soul:t}:t||{},(e=e||{})._=e._||{},e._[f]=t.soul||e._[f]||c(),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,i=this.o;i.map?void 0===(n=i.map.call(this.as,e,""+t,i.node))?a(i.node,t):i.node&&(i.node[t]=n):r.is(e)&&(i.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,void 0,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.random,f=n.soul._;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;c&&c.timing&&c.timing.navigationStart||(c=!1);n._=">",n.drift=0,n.is=function(e,t,r){var i=t&&e&&e[v]&&e[v][n._]||r;if(i)return m(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[v]){if(!s)return;e=r.soul.ify(e,s)}var a=h(e[v],n._);return f!==t&&t!==v&&(m(i)&&(a[t]=i),f!==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){v!==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=b(t=t||r)?t:null,s&&!t?(r=m(r)?r:n(),s[v]=s[v]||{},y(s,e,{o:s,s:r}),s):(i=i||d(r)?r:o,r=m(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 f,l=t.obj,h=l.as,p=l.has,d=l.is,y=l.map,g=l.copy,m=t.num.is,b=t.fn.is,v=r._;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=function(e,t){for(var r,n=e.seen,i=n.length;i--;)if(r=n[i],t.obj===r.obj)return r;n.push(t)}(e,t))?o:(t.env=e,t.soul=a,n.ify(t.obj,i,t)&&(e.graph[r.rel.is(t.rel)]=t.node),t)}function i(t,i,o){var a,u,h=this,p=h.env;if(n._===i&&f(t,r.rel._))return o._;if(a=l(t,i,o,h,p)){if(i||(h.node=h.node||o||{},f(t,n._)&&n.soul(t)&&(h.node._=d(t._)),h.node=n.soul.ify(h.node,r.rel.is(h.rel)),h.rel=h.rel||r.rel.ify(n.soul(h.node))),(u=p.map)&&(u.call(p.as||{},t,i,o,h),f(o,i))){if(t=o[i],s===t)return void c(o,i);if(!(a=l(t,i,o,h,p)))return}if(!i)return h.node;if(!0===a)return t;if((u=e(p,{obj:t,path:h.path.concat(i)})).node)return u.rel}}function a(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 l(e,n,i,o,s){var a;return!!r.is(e)||(u(e)?1:(a=s.invalid)?l(e=a.call(s.as||{},e,n,i),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."))))}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.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}}}();t.fn.is;var s,a=t.obj,u=a.is,c=a.del,f=a.has,l=a.empty,h=a.put,p=a.map,d=a.copy;e.exports=o})(i,"./graph"),i(function(e){i("./onto"),e.exports=function(e,t){if(this.on){if(!(e instanceof Function)){if(!e||!t)return;var r=e["#"]||e,n=(this.tag||empty)[r];if(!n)return;return n=this.on(r,t),clearTimeout(n.err),!0}r=t&&t["#"]||Math.random().toString(36).slice(2);if(!e)return r;var i=this.on(r,e,t);return i.err=i.err||setTimeout(function(){i.next({err:"Error: No ACK received yet.",lack:!0}),i.off()},(this.opt||{}).lack||9e3),r}}})(i,"./ask"),i(function(e){var t=i("./type");var r=t.time.is;e.exports=function(e){var n={s:{}};return e=e||{max:1e3,age:9e3},n.check=function(e){var t;return!!(t=n.s[e])&&(t.pass?t.pass=!1:n.track(e))},n.track=function(i,o){var s=n.s[i]||(n.s[i]={});return s.was=r(),o&&(s.pass=!0),n.to||(n.to=setTimeout(function(){var i=r();t.obj.map(n.s,function(r,o){e.age>i-r.was||t.obj.del(n.s,o)}),n.to=null},e.age+9)),s},n}})(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,i,o=this,a=o.as,u=a.at||a,c=u.$;(i=r["#"])||(i=r["#"]=f(9)),(n=u.dup).check(i)?a.out===r.out&&(r.out=s,o.to.next(r)):(n.track(i),u.ask(r["@"],r)||(r.get&&t.on.get(r,c),r.put&&t.on.put(r,c)),o.to.next(r),a.out||(r.out=e,u.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);if(!s)return o.err="Error: No state on '"+r+"' in node '"+i+"'!";var a=o.graph[i]||v,u=t.state.is(a,r,!0),c=a[r],f=t.HAM(o.machine,s,u,e,c);f.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):f.defer&&(o.defer=s<(o.defer||1/0)?s:o.defer)}function r(e,t){var r=this,s=r.$._,a=(s.next||v)[t];if(!a){if(!(s.opt||v).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),y(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,y(e.put,i,e),y(r.souls,function(e){if(e)return e})||r.c||(r.c=1,this.off(),y(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.$._;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.put,i=this.$._;i.put=t.state.to(n,r,i.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 a=i._,u={$:i,graph:a.graph,put:{},map:{},souls:{},machine:t.state(),ack:n["@"],cat:a,stop:{}};if(t.graph.is(n.put,null,e,u)||(u.err="Error: Invalid graph!"),u.err)return a.on("in",{"@":n["#"],err:t.log(u.err)});y(u.put,r,u),u.async||y(u.map,o,u),s!==u.defer&&setTimeout(function(){t.on.put(n,i)},u.defer-u.machine),u.diff&&a.on("put",d(n,{put:u.diff}))},t.on.get=function(e,r){var n=r._,i=e.get[m],o=n.graph[i],s=e.get[b],a=(n.next||(n.next={}))[i];if(!o||!a)return n.on("get",e);if(s){if(!p(o,s))return n.on("get",e);o=t.state.to(o,s)}else o=t.obj.copy(o);o=t.graph.node(o),a.ack,n.on("in",{"@":e["#"],how:"mem",put:o,$:r}),n.on("get",e)}}(),t.chain.opt=function(e){e=e||{};var r=this._,n=e.peers||e;return h(e)||(e={}),h(r.opt)||(r.opt=e),c(n)&&(n=[n]),a(n)&&(n=y(n,function(e,t,r){r(e,{url:e})}),h(r.opt.peers)||(r.opt.peers={}),r.opt.peers=d(n,r.opt.peers)),r.opt.peers=r.opt.peers||{},d(e,r.opt),t.on("opt",r),r.opt.uuid=r.opt.uuid||function(){return g()+f(12)},this};var s,a=t.list.is,u=t.text,c=u.is,f=u.random,l=t.obj,h=l.is,p=l.has,d=l.to,y=l.map,g=(l.copy,t.state.lex),m=t.val.rel._,b=".",v=(t.node._,t.val.link.is,{});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);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){if(-1===(e=e||1)||1/0===e)return this._.root.$;if(1===e)return(this._.back||this._).$;var o=this._;if("string"==typeof e&&(e=e.split(".")),e instanceof Array){for(var s=0,a=e.length,u=o;s<a;s++)u=(u||n)[e[s]];return r!==u?i?this:u:(u=o.back)?u.$.back(e,i):void 0}if(e instanceof Function){var c;for(u={back:o};(u=u.back)&&r===(c=e(u,i)););return c}return t.num.is(e)?(o.back||o).$.back(e-1):this};var r,n={}})(i,"./back"),i(function(e){var t=i("./root");function r(e){var r,n,i,o=this.as,s=o.back,a=o.root;if(e.I||(e.I=o.$),e.$||(e.$=o.$),this.to.next(e),n=e.get){if(n["#"]||o.soul){if(n["#"]=n["#"]||o.soul,e["#"]||(e["#"]=b(9)),s=a.$.get(n["#"])._,n=n["."]){if(d(s.put,n)&&((i=(r=s.$.get(n)._).ack)||(r.ack=-1),s.on("in",{$:s.$,put:t.state.to(s.put,n),get:s.get}),i))return}else{if((i=s.ack)||(s.ack=-1),d(s,"put")&&s.on("in",s),i)return;e.$=s.$}return a.ask(f,e),a.on("in",e)}if(a.now&&(a.now[o.id]=a.now[o.id]||!0,o.pass={}),n["."])return o.get?(e={get:{".":o.get},$:o.$},s.ask||(s.ask={}),s.ask[o.get]=e.$._,s.on("out",e)):(e={get:{},$:o.$},s.on("out",e));if(o.ack=o.ack||-1,o.get)return e.$=o.$,n["."]=o.get,(s.ask||(s.ask={}))[o.get]=e.$._,s.on("out",e)}return s.on("out",e)}function n(e){var r,n,i=this,a=i.as,f=a.root,p=(e.$||h)._||h,b=e.put;if(a.get&&e.get!==a.get&&(e=g(e,{get:a.get})),a.has&&p!==a&&(e=g(e,{$:a.$}),p.ack&&(a.ack=p.ack)),l===b){if(n=p.put,i.to.next(e),a.soul)return;if(l===n&&l!==p.put)return;return s(a,e,i),a.has&&c(a,e),y(p.echo,a.id),void y(a.map,p.id)}if(a.soul)return i.to.next(e),s(a,e,i),void(a.next&&m(b,u,{msg:e,cat:a}));if(!(r=t.val.link.is(b)))return t.val.is(b)?(a.has||a.soul?c(a,e):(p.has||p.soul)&&((p.echo||(p.echo={}))[a.id]=p.echo[p.id]||a,(a.map||(a.map={}))[p.id]=a.map[p.id]||{at:p}),i.to.next(e),void s(a,e,i)):(a.has&&p!==a&&d(p,"put")&&(a.put=p.put),(r=t.node.soul(b))&&p.has&&(p.put=a.root.$.get(r)._.put),n=(f.stop||{})[p.id],i.to.next(e),o(a,e,p,r),s(a,e,i),void(a.next&&m(b,u,{msg:e,cat:a})));f.stop;(n=(n=f.stop||{})[p.id]||(n[p.id]={})).is=n.is||p.put,n[a.id]=p.put||!0,i.to.next(e),o(a,e,p,r),s(a,e,i)}t.chain.chain=function(e){var i,o=this,s=o._,a=new(e||o).constructor(o),u=a._;return u.root=i=s.root,u.id=++i.once,u.back=o._,u.on=t.on,u.on("in",n,u),u.on("out",r,u),a};function o(e,r,n,i){if(i&&v!==e.get){var s=e.root.$.get(i)._;e.has?n=s:n.has&&o(n,r,n,i),n!==e&&(n.$||(n={}),(n.echo||(n.echo={}))[e.id]=n.echo[e.id]||e,e.has&&!(e.map||h)[n.id]&&c(e,r),(i!==(s=n.id?(e.map||(e.map={}))[n.id]=e.map[n.id]||{at:n}:{}).link||s.pass||e.pass)&&(e.pass&&(t.obj.map(e.map,function(e){e.pass=!0}),y(e,"pass")),s.pass&&y(s,"pass"),e.has&&(e.link=i),function(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"),m(n||e.next,function(e,t){e.on("out",{get:{"#":r,".":t}})}),t.obj.del(e,"ask"))}(e,s.link=i)))}}function s(e,t,r){e.echo&&m(e.echo,a,t)}function a(e){e&&e.on&&e.on("in",this)}function u(e,r){var n,i,o,s=this.cat.next||h,a=this.msg;(v!==r||s[r])&&(i=s[r])&&(i.has?(l!==i.put&&t.val.link.is(e)||(i.put=e),n=i.$):(o=a.$)&&(o=(n=a.$.get(r))._,l!==o.put&&t.val.link.is(e)||(o.put=e)),i.on("in",{put:e,get:r,$:n,via:a}))}function c(e,r){if(e.has||e.soul){var n=e.map;e.root;e.map=null,e.has&&(e.link=null),(e.pass||r["@"]||null!==n)&&(l===n&&t.val.link.is(e.put)||(m(n,function(t){(t=t.at)&&y(t.echo,e.id)}),n=e.put,m(e.next,function(t,r){if(l===n&&l!==e.put)return!0;t.put=l,t.ack&&(t.ack=-1),t.on("in",{get:r,$:t.$,put:l})})))}}function f(e,r){var n=this.as,i=n.get||h,o=n.$._,s=(e.put||h)[i["#"]];if(o.ack&&(o.ack=o.ack+1||1),!e.put||i["."]&&!d(s,o.get)){if(o.put!==l)return;o.on("in",{get:o.get,put:o.put=l,$:o.$,"@":e["@"]})}else v!=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 l,h={},p=t.obj,d=p.has,y=(p.put,p.del),g=p.to,m=p.map,b=t.text.random,v=(t.val.rel._,t.node._)})(i,"./chain"),i(function(e){var t=i("./root");function r(e,t,r,n){var i,o=e._;return(i=o.soul)?(t(i,n,o),e):(i=o.link)?(t(i,n,o),e):(e.get(function(e,r){r.rid(e);var o=(o=e.$)&&o._||{};i=o.link||o.soul||c.is(e.put)||f(e.put),t(i,n,e,r)},{out:{get:{".":!0}}}),e)}function n(e){var t,r=this,n=r.as,i=n.at.root,o=(e.$||{})._||{},u=e.put||o.put;if((t=i.now)&&r!==t[n.now])return r.to.next(e);if(r.seen&&o.id&&r.seen[o.id])return r.to.next(e);if((t=u)&&t[c._]&&(t=c.is(t))&&(t=(e.$$=o.root.gun.get(t))._,s!==t.put&&(e=a(e,{put:u=t.put}))),(t=i.mum)&&o.id){if(t[o.id])return;s===u||c.is(u)||(t[o.id]=!0)}n.use(e,r),r.stun?r.stun=null:r.to.next(e)}function o(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;if((r=this.seen||(this.seen={}))[e])return!0;r[e]=!0}}t.chain.get=function(e,i,s){var a;if("string"!=typeof e){if(e instanceof Function){if(!0===i)return r(this,e,0,s);var f,h=(a=this)._,p=h.root,d=p.now;(s=i||{}).at=h,s.use=e,s.out=s.out||{},s.out.get=s.out.get||{},(f=h.on("in",n,s)).rid=o,(p.now={$:1})[s.now=h.id]=f;var y=p.mum;return p.mum={},h.on("out",s.out),p.mum=y,p.now=d,a}return u(e)?this.get(""+e,i,s):(d=c.is(e))?this.get(d,i,s):((s=this.chain())._.err={err:t.log("Invalid get request!",e)},i&&i.call(s,s._.err),s)}var g=this._;return(a=(g.next||l)[e])||(a=function(e,t){var r=t._,n=r.next,i=t.chain()._;return n||(n=r.next={}),n[i.get=e]=i,t===r.root.$?i.soul=e:(r.soul||r.has)&&(i.has=e),i}(e,this)),a=a.$,(d=g.stun)&&(a._.stun=a._.stun||d),i&&i instanceof Function&&a.get(i,s),a};t.obj.has;var s,a=t.obj.to,u=t.num.is,c=t.val.link,f=t.node.soul,l=(t.node._,{})})(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){e&&e()}function s(){var e=this;e.graph&&!g(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;p.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?p.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,0),u=r.length;a<u;a++)n=n.get(r[a]);s&&(n=e);var f=n._.dub;if(f||(f=t.node.soul(i.obj)))return n.back(-1).get(f),void i.soul(f);(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 o=(r=r.as).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,a=i.$._,u=a.put,c=r.opt||{};if(!(s=r.ref)||!s._.now){if(o&&(o.stun=!0),r.ref!==r.$){if(!(s=r.$._.get||a.get))return void n.log("Please report this as an issue! Put.no.get");r.data=y({},s,r.data),s=null}if(h===u){if(!a.get)return;e||(s=a.$.back(function(e){if(e.link||e.soul)return e.link||e.soul;r.data=y({},e.get,r.data)})),s=s||a.get,a=a.root.$.get(s)._,r.soul=s,u=r.data}r.not||(r.soul=r.soul||e)||(r.path&&d(r.data)?r.soul=(c.uuid||r.via.back("opt.uuid")||t.text.random)():(_==a.get&&(r.soul=(a.put||m)["#"]||a.dub),r.soul=r.soul||a.soul||a.soul||(c.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,a=this,u=a._,c=u.root.$;return(i=i||{}).data=e,i.via=i.$=i.via||i.$||a,"string"==typeof n?i.soul=n:i.ack=i.ack||n,u.soul&&(i.soul=u.soul),i.soul||c===a?d(i.data)?(i.soul=i.soul||(i.not=t.node.soul(i.data)||(i.via.back("opt.uuid")||t.text.random)()),i.soul?(i.$=a=c.get(i.soul),i.ref=i.$,r(i),a):(i.via.back("opt.uuid")(function(e,r){if(e)return t.log(e);(i.ref||i.$).put(i.data,i.soul=r,i)}),a)):((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(),a):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)!');a.put(t.val.rel.ify(e),n,i)},!0),a):(i.ref=i.ref||c._===(s=u.back)?a:s.$,i.ref._.soul&&t.val.is(i.data)&&u.get?(i.data=y({},u.get,i.data),i.ref.put(i.data,i.soul,i),a):(i.ref.get(l,!0,{as:i}),i.out||(i.res=i.res||o,i.$._.stun=i.ref._.stun),a))};var h,p=t.obj,d=p.is,y=p.put,g=p.map,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,n=this,i=e.$,s=((i||{})._||{}).put||e.put;n.at;if(o!==s){if(r=e.$$){if(r=e.$$._,o===r.put)return;s=r.put}n.change&&(s=e.put),n.as?n.ok.call(n.as,e,t):n.ok.call(i,s,e.get,e,t)}}function n(e,t,r){var i,s,a=this.as,u=(a.at,e.$),c=u._,f=c.put||e.put;if(s=e.$$){if(i=s=e.$$._,o===s.put)return;f=s.put}(s=t.wait)&&(s=s[c.id])&&clearTimeout(s),r||o!==f&&!c.soul&&!c.link&&(!i||0<i.ack)?(t.rid(e),a.ok.call(u||a.$,f,e.get)):s=(t.wait={})[c.id]=setTimeout(function(){n.call({as:a},e,t,s||1)},a.wait||99)}t.chain.on=function(e,t,n,i){var o,s=this,a=s._;if("string"==typeof e)return t?(o=a.on(e,t,n||a,i),n&&n.$&&(n.subs||(n.subs=[])).push(o),s):a.on(e);var u=t;return(u=!0===u?{change:!0}:u||{}).at=a,u.ok=e,s.get(r,u),s},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,s=i._,a=s.put;if(0<s.ack&&o!==a)return(e||c).call(i,a,s.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 u=i.chain();return u._.nix=i.once(function(){u._.on("in",i._)}),u}return(r=r||{}).ok=e,r.at=s,r.out={"#":t.text.random(9)},i.get(n,{as:r}),r.async=!0,i},t.chain.off=function(){var e,t=this._,r=t.back;if(r)return(e=r.next)&&e[t.get]&&u(e,t.get),(e=r.ask)&&u(e,t.get),(e=r.put)&&u(e,t.get),(e=t.soul)&&u(r.root.graph,e),(e=t.map)&&a(e,function(e){e.link&&r.root.$.get(e.link).off()}),(e=t.next)&&a(e,function(e){e.$.off()}),t.on("off",{}),this};var o,s=t.obj,a=s.map,u=(s.has,s.del),c=(s.to,t.val.link,function(){})})(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(a!==t){var r=this.msg.$,n=this.at,i=r.get(t)._;(i.echo||(i.echo={}))[n.id]=i.echo[n.id]||n}}t.chain.map=function(e,n,i){var o,a=this,u=a._;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."),o=a.chain(),a.map().on(function(r,n,i,a){var u=(e||s).call(this,r,n,i,a);void 0!==u&&(r===u||t.is(u)?o._.on("in",u._):o._.on("in",{get:n,put:u}))}),o):(o=u.each)?o:(u.each=o=a.chain(),o._.nix=a.back("nix"),a.on("in",r,o._),o)};var o=t.obj.map,s=function(){},a=t.node._})(i,"./map"),i(function(e){var t=i("./index");t.chain.set=function(e,r,n){var i,o=this;if(r=r||function(){},(n=n||{}).item=n.item||e,i=t.node.soul(e))return o.set(o.back(-1).get(i),r,n);if(!t.is(e)){var s=o.back("opt.uuid")();return s&&t.obj.is(e)?o.set(o._.root.$.put(e,s),r,n):o.get(t.state.lex()+t.text.random(7)).put(e,r,n)}return e.get(function(e,i,s){if(!e)return r.call(o,{err:t.log('Only a node can be linked! Not "'+s.put+'"!')});o.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(){};"undefined"!=typeof window&&(t=window);var n=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);if(!1===r.localStorage)return t.next(e);r.file=r.file||"gun/";var i,o,s=Gun.obj.ify(n.getItem("gap/"+r.file))||{},a=Gun.obj.empty;function u(e){if(!e.err&&e.ok){var t=e["@"];setTimeout(function(){Gun.obj.map(s,function(e,r){Gun.obj.map(e,function(r,n){t===r&&delete e[n]}),a(e)&&delete s[r]}),f()},r.wait||1)}}a(s)||e.on("localStorage",function(t){this.off();var r={};Gun.obj.map(s,function(e,n){Gun.obj.map(e,function(e,i){r[n]=Gun.state.to(t[n],i,r[n])})}),setTimeout(function(){e.on("out",{put:r,"#":e.ask(u),I:e.$})},10)}),e.on("out",function(e){e.lS||(e.I&&e.put&&!e["@"]&&!a(r.peers)&&(i=e["#"],Gun.graph.is(e.put,null,c),o||(o=setTimeout(f,r.wait||1))),this.to.next(e))}),e.on("ack",u),t.next(e);var c=function(e,t,r,n){(s[n]||(s[n]={}))[t]=i},f=function(){clearTimeout(o),o=!1;try{n.setItem("gap/"+r.file,JSON.stringify(s))}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.file=t.file||t.prefix||"gun/";e.graph;var r,i={},o=0,s=Gun.obj.ify(n.getItem(t.file))||{};e.on("localStorage",s),e.on("put",function(e){if(this.to.next(e),Gun.graph.is(e.put,null,a),e["@"]||(i[e["#"]]=!0),(o+=1)>=(t.batch||1e3))return u();r||(r=setTimeout(u,t.wait||1))}),e.on("get",function(r){this.to.next(r);var n,i,o,a=r.get;function u(){if(a&&(n=a["#"])){var u=a["."];(i=s[n]||o)&&u&&(i=Gun.state.to(i,u)),(i||Gun.obj.empty(t.peers))&&e.on("in",{"@":r["#"],put:Gun.graph.node(i),how:"lS",lS:r.I})}}Gun.debug?setTimeout(u,1):u()});var a=function(e,t,r,n){s[n]=Gun.state.to(r,t,s[n])},u=function(a){var c;o=0,clearTimeout(r),r=!1;var f=i;i={},a&&(s=a);try{n.setItem(t.file,JSON.stringify(s))}catch(a){Gun.log(c=a||"localStorage failure"),e.on("localStorage:error",{err:c,file:t.file,flush:s,retry:u})}(c||Gun.obj.empty(t.peers))&&Gun.obj.map(f,function(t,r){e.on("in",{"@":r,err:c,ok:0})})}}})}})(i,"./adapters/localStorage"),i(function(e){var t=i("../type");function r(e){var i=function(){};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),void(r["##"]=t["##"]);i.say(t)},i.hear=function(r,n){if(r){var o,s,a,u=e.dup,c=r[0];try{a=JSON.parse(r)}catch(e){}if("{"===c){if(!a)return;if(u.check(o=a["#"]))return;if(u.track(o,!0).it=a,(c=a["@"])&&a.put&&(c+=s=a["##"]||(a["##"]=i.hash(a)))!=o){if(u.check(c))return;(c=u.s)[s]=c[o]}return(a.mesh=function(){}).via=n,(c=a["><"])&&(a.mesh.to=t.obj.map(c.split(","),function(e,t,r){r(e,!0)})),void e.on("in",a)}if("["!==c);else{if(!a)return;for(var f,l=0;f=a[l++];)i.hear(f,n)}}},function(){function r(e,t){var r=t.wire;try{r.send?r.readyState===r.OPEN?r.send(e):(t.queue=t.queue||[]).push(e):t.say&&t.say(e)}catch(r){(t.queue=t.queue||[]).push(e)}}i.say=function(n,s){var a,u,c;s?(s.wire||e.opt.wire&&e.opt.wire(s))&&(u=n.mesh||o,s!==u.via&&((c=u.raw)||(c=i.raw(n)),(a=n["@"])&&(a=e.dup.s[a])&&(a=a.it)&&a.get&&a["##"]&&a["##"]===n["##"]||(a=u.to)&&(a[s.url]||a[s.id])||(s.batch?s.batch.push(c):(s.batch=[],setTimeout(function(){var e=s.batch;e&&(s.batch=null,e.length&&r(JSON.stringify(e),s))},e.opt.gap||e.opt.wait||1),r(c,s))))):t.obj.map(e.opt.peers,function(e){i.say(n,e)})}}(),function(){function o(e,r){var n;return r instanceof Object?(t.obj.map(Object.keys(r).sort(),s,{to:n={},on:r}),n):r}function s(e){this.to[e]=this.on[e]}i.raw=function(r){if(!r)return"";var s,c,f,l=e.dup,h=r.mesh||{};if(f=h.raw)return f;if("string"==typeof r)return r;r["@"]&&(f=r.put)&&((c=r["##"])||(s=a(f,o)||"",c=i.hash(r,s),r["##"]=c),(f=l.s)[c=r["@"]+c]=f[r["#"]],r["#"]=c||r["#"],s&&((r=t.obj.to(r)).put=u));var p=0,d=[];t.obj.map(e.opt.peers,function(e){if(d.push(e.url||e.id),++p>9)return!0}),r["><"]=d.join();var y=a(r);return n!==s&&(y=y.replace('"'+u+'"',s)),h&&(h.raw=y),y},i.hash=function(e,n){return r.hash(n||a(e.put,o)||"")||e["#"]||t.text.random(9)};var a=JSON.stringify,u=":])([:"}(),i.hi=function(r){e.on("hi",r);var n=r.queue;r.queue=[],t.obj.map(n,function(e){i.say(e,r)})},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;r<n;++r)t=(t<<5)-t+e.charCodeAt(r),t|=0;return t};var n,o={};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);t.on("create",function(e){this.to.next(e),t.on("out",s.out)}),n.wire=n.wire||a}}function a(e){if(e&&e.url){var r=e.url.replace("http","ws"),o=e.wire=new n.WebSocket(r);return o.onclose=function(){t.on("bye",e),u(e)},o.onerror=function(t){u(e),t&&t.code},o.onopen=function(){s.hi(e)},o.onmessage=function(t){t&&(i.inLength=(i.inLength||0)+(t.data||t).length,s.hear(t.data||t,e))},o}}function u(e){clearTimeout(e.defer),e.defer=setTimeout(function(){a(e)},2e3)}})})(i,"./adapters/websocket")}()}).call(this,r(6),r(27)(e))},function(e,t,r){const n=r(101);r(635),r(643),r(1475),r(1503),r(1576),"undefined"!=typeof window&&(window.DwebTransports=n),e.exports=n},function(e,t,r){(function(e,n){var i;/*! https://mths.be/punycode v1.4.1 by @mathias */!function(o){"object"==typeof t&&t&&t.nodeType,"object"==typeof e&&e&&e.nodeType;var s="object"==typeof n&&n;s.global!==s&&s.window!==s&&s.self;var a,u=2147483647,c=36,f=1,l=26,h=38,p=700,d=72,y=128,g="-",m=/^xn--/,b=/[^\x20-\x7E]/,v=/[\x2E\u3002\uFF0E\uFF61]/g,_={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},w=c-f,S=Math.floor,k=String.fromCharCode;function E(e){throw new RangeError(_[e])}function A(e,t){for(var r=e.length,n=[];r--;)n[r]=t(e[r]);return n}function x(e,t){var r=e.split("@"),n="";return r.length>1&&(n=r[0]+"@",e=r[1]),n+A((e=e.replace(v,".")).split("."),t).join(".")}function I(e){for(var t,r,n=[],i=0,o=e.length;i<o;)(t=e.charCodeAt(i++))>=55296&&t<=56319&&i<o?56320==(64512&(r=e.charCodeAt(i++)))?n.push(((1023&t)<<10)+(1023&r)+65536):(n.push(t),i--):n.push(t);return n}function T(e){return A(e,function(e){var t="";return e>65535&&(t+=k((e-=65536)>>>10&1023|55296),e=56320|1023&e),t+k(e)}).join("")}function B(e){return e-48<10?e-22:e-65<26?e-65:e-97<26?e-97:c}function C(e,t){return e+22+75*(e<26)-((0!=t)<<5)}function P(e,t,r){var n=0;for(e=r?S(e/p):e>>1,e+=S(e/t);e>w*l>>1;n+=c)e=S(e/w);return S(n+(w+1)*e/(e+h))}function O(e){var t,r,n,i,o,s,a,h,p,m,b=[],v=e.length,_=0,w=y,k=d;for((r=e.lastIndexOf(g))<0&&(r=0),n=0;n<r;++n)e.charCodeAt(n)>=128&&E("not-basic"),b.push(e.charCodeAt(n));for(i=r>0?r+1:0;i<v;){for(o=_,s=1,a=c;i>=v&&E("invalid-input"),((h=B(e.charCodeAt(i++)))>=c||h>S((u-_)/s))&&E("overflow"),_+=h*s,!(h<(p=a<=k?f:a>=k+l?l:a-k));a+=c)s>S(u/(m=c-p))&&E("overflow"),s*=m;k=P(_-o,t=b.length+1,0==o),S(_/t)>u-w&&E("overflow"),w+=S(_/t),_%=t,b.splice(_++,0,w)}return T(b)}function R(e){var t,r,n,i,o,s,a,h,p,m,b,v,_,w,A,x=[];for(v=(e=I(e)).length,t=y,r=0,o=d,s=0;s<v;++s)(b=e[s])<128&&x.push(k(b));for(n=i=x.length,i&&x.push(g);n<v;){for(a=u,s=0;s<v;++s)(b=e[s])>=t&&b<a&&(a=b);for(a-t>S((u-r)/(_=n+1))&&E("overflow"),r+=(a-t)*_,t=a,s=0;s<v;++s)if((b=e[s])<t&&++r>u&&E("overflow"),b==t){for(h=r,p=c;!(h<(m=p<=o?f:p>=o+l?l:p-o));p+=c)A=h-m,w=c-m,x.push(k(C(m+A%w,0))),h=S(A/w);x.push(k(C(h,0))),o=P(r,_,n==i),r=0,++n}++r,++t}return x.join("")}a={version:"1.4.1",ucs2:{decode:I,encode:T},decode:O,encode:R,toASCII:function(e){return x(e,function(e){return b.test(e)?"xn--"+R(e):e})},toUnicode:function(e){return x(e,function(e){return m.test(e)?O(e.slice(4).toLowerCase()):e})}},void 0===(i=function(){return a}.call(t,r,t,e))||(e.exports=i)}()}).call(this,r(27)(e),r(6))},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,h,p,d,y=e[f].replace(a,"%20"),g=y.indexOf(r);g>=0?(l=y.substr(0,g),h=y.substr(g+1)):(l=y,h=""),p=decodeURIComponent(l),d=decodeURIComponent(h),n(s,p)?i(s[p])?s[p].push(d):s[p]=[s[p],d]:s[p]=d}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){const n=r(116),i=r(101),o=r(338),s=r(33),a=r(22);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 u extends n{constructor(e,t){super(e,t),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,t){let r=n.mergeoptions({http:defaulthttpoptions},e);try{let n=new u(r,t);return i.addtransport(n),n}catch(e){throw console.log("Exception thrown in TransportHTTP.p_setup",e.message),e}}async p_setup1(e,t){return this.status=n.STATUS_STARTING,t&&t(this),await this.p_status(e),t&&t(this),this}async p_status(e){try{this.info=await this.p_info(e),this.status=n.STATUS_CONNECTED}catch(e){console.log(this.name,": Error in p_status.info",e.message),this.status=n.STATUS_FAILED}return super.p_status(e)}_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=e.replace("contenthash:/contenthash",this._cmdurl(t))).replace("getall/table",t))+(r?"?"+r:"")}async p_rawfetch(e,t={}){if(e.href.includes("contenthash//")&&console.error("XXX@91",e),("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,{verbose:t=!1}={}){if(!e)throw new errors.CodingError("TransportHTTP.p_rawlist: requires url");return o.p_GET(this._url(e,servercommands.rawlist),{verbose:t})}rawreverse(){throw new errors.ToBeImplementedError("Undefined function TransportHTTP.rawreverse")}async p_rawstore(e,{verbose:t=!1}={}){console.assert(e,"TransportHttp.p_rawstore: requires data");let r=await o.p_POST(this._cmdurl(servercommands.rawstore),"application/octet-stream",e,t);return`contenthash:/contenthash/${s.parse(r).pathname.split("/").slice(-1)}`}p_rawadd(e,t,{verbose:r=!1}={}){if(!e||!t)throw new errors.CodingError("TransportHTTP.p_rawadd: invalid parms",e,t);r&&console.log("rawadd",e,t);let n=JSON.stringify(t.preflight(Object.assign({},t)))+"\n";return o.p_POST(this._url(e,servercommands.rawadd),"application/json",n,r)}p_newlisturls(e,{verbose:t=!1}={}){let r=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 r||(r=`contenthash:/contenthash/${e.keypair.verifyexportmultihashsha256_58()}`),[r,r]}async p_f_createReadStream(e,{verbose:t=!1,wanturl:r=!1}={}){t&&console.log(this.name,"p_f_createreadstream",s.parse(e).href);try{let n=this;return r?e:function(r){return n.p_createReadStream(e,r,t)}}catch(t){throw console.warn(`p_f_createReadStream failed on ${s.parse(e).href} ${t.message}`),t}}async createReadStream(e,t,r){let n;r&&console.log(this.name,"createreadstream",s.parse(e).href,t);try{return n=new a.PassThrough,o.p_GET(this._url(e,servercommands.rawfetch),Object.assign({wantstream:!0},t)).then(e=>e.pipe(n)),n}catch(e){console.log(this.name,"createReadStream caught error",e),"function"==typeof n.destroy?n.destroy(e):n.emit("error",e)}}async p_createReadStream(e,t,r){r&&console.log(this.name,"createreadstream",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,{verbose:t=!1}={}){e.hasOwnProperty("keypair")&&(e=e.keypair.signingexport());let r=`${this.urlbase}/getall/table/${encodeURIComponent(e)}`;return{publicurl:r,privateurl:r}}async p_newtable(e,t,{verbose:r=!1}={}){if(!e)throw new errors.CodingError("p_newtable currently requires a pubkey");let n=await this.p_newdatabase(e,{verbose:r});return{privateurl:`${n.privateurl}/${t}`,publicurl:`${n.publicurl}/${t}`}}async p_set(e,t,r,{verbose:n=!1}={}){if(!e||!t)throw new errors.CodingError("TransportHTTP.p_set: invalid parms",e,keyvalyes);if(n&&console.log("p_set",e,t,r),"string"==typeof t){let i=JSON.stringify([{key:t,value:r}]);await o.p_POST(this._url(e,servercommands.set),"application/json",i,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,n)}}_keyparm(e){return`key=${encodeURIComponent(e)}`}async p_get(e,t,{verbose:r=!1}={}){if(!e&&t)throw new errors.CodingError("TransportHTTP.p_get: requires url and at least one key");let n=Array.isArray(t)?t.map(e=>this._keyparm(e)).join("&"):this._keyparm(t),i=await o.p_GET(this._url(e,servercommands.get,n),{verbose:r});return Array.isArray(t)?i:i[t]}async p_delete(e,t,{verbose:r=!1}={}){if(!e&&t)throw new errors.CodingError("TransportHTTP.p_get: requires url and at least one key");let n=t.map(e=>this._keyparm(e)).join("&");await o.p_GET(this._url(e,servercommands.delete,n),{verbose:r})}async p_keys(e,{verbose:t=!1}={}){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),{verbose:t})}async p_getall(e,{verbose:t=!1}={}){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),{verbose:t})}p_info(e){return o.p_GET(`${this.urlbase}/info`,{verbose:e})}static async p_test(e={},t=!1){t&&console.log("TransportHTTP.test");try{let r=await this.p_setup(e,t);t&&console.log("HTTP connected");let i=await r.p_info(t);t&&console.log("TransportHTTP info=",i),i=await r.p_status(t),console.assert(i===n.STATUS_CONNECTED),await r.p_test_kvt("NACL%20VERIFY",t)}catch(e){throw console.log("Exception thrown in TransportHTTP.test:",e.message),e}}static async test(){return this}}i._transportclasses.HTTP=u,e.exports=u},function(e,t,r){"use strict";t.byteLength=function(e){var t=c(e),r=t[0],n=t[1];return 3*(r+n)/4-n},t.toByteArray=function(e){for(var t,r=c(e),n=r[0],s=r[1],a=new o(function(e,t,r){return 3*(t+r)/4-r}(0,n,s)),u=0,f=s>0?n-4:n,l=0;l<f;l+=4)t=i[e.charCodeAt(l)]<<18|i[e.charCodeAt(l+1)]<<12|i[e.charCodeAt(l+2)]<<6|i[e.charCodeAt(l+3)],a[u++]=t>>16&255,a[u++]=t>>8&255,a[u++]=255&t;return 2===s&&(t=i[e.charCodeAt(l)]<<2|i[e.charCodeAt(l+1)]>>4,a[u++]=255&t),1===s&&(t=i[e.charCodeAt(l)]<<10|i[e.charCodeAt(l+1)]<<4|i[e.charCodeAt(l+2)]>>2,a[u++]=t>>8&255,a[u++]=255&t),a},t.fromByteArray=function(e){for(var t,r=e.length,i=r%3,o=[],s=0,a=r-i;s<a;s+=16383)o.push(l(e,s,s+16383>a?a:s+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("")};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("=");return-1===r&&(r=t),[r,r===t?0:4-r%4]}function f(e){return n[e>>18&63]+n[e>>12&63]+n[e>>6&63]+n[63&e]}function l(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(f(n));return i.join("")}i["-".charCodeAt(0)]=62,i["_".charCodeAt(0)]=63},function(e,t){},function(e,t,r){"use strict";var n=r(2).Buffer,i=r(639);function o(e,t,r){e.copy(t,r)}e.exports=function(){function e(){(function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")})(this,e),this.head=null,this.tail=null,this.length=0}return e.prototype.push=function(e){var t={data:e,next:null};this.length>0?this.tail.next=t:this.head=t,this.tail=t,++this.length},e.prototype.unshift=function(e){var t={data:e,next:this.head};0===this.length&&(this.tail=t),this.head=t,++this.length},e.prototype.shift=function(){if(0!==this.length){var e=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,e}},e.prototype.clear=function(){this.head=this.tail=null,this.length=0},e.prototype.join=function(e){if(0===this.length)return"";for(var t=this.head,r=""+t.data;t=t.next;)r+=e+t.data;return r},e.prototype.concat=function(e){if(0===this.length)return n.alloc(0);if(1===this.length)return this.head.data;for(var t=n.allocUnsafe(e>>>0),r=this.head,i=0;r;)o(r.data,t,i),i+=r.data.length,r=r.next;return t},e}(),i&&i.inspect&&i.inspect.custom&&(e.exports.prototype[i.inspect.custom]=function(){var e=i.inspect({length:this.length});return this.constructor.name+" "+e})},function(e,t){},function(e,t,r){(function(t){function r(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=function(e,t){if(r("noDeprecation"))return e;var n=!1;return function(){if(!n){if(r("throwDeprecation"))throw new Error(t);r("traceDeprecation")?console.trace(t):console.warn(t),n=!0}return e.apply(this,arguments)}}}).call(this,r(6))},function(e,t,r){"use strict";e.exports=o;var n=r(337),i=r(117);function o(e){if(!(this instanceof o))return new o(e);n.call(this,e)}i.inherits=r(5),i.inherits(o,n),o.prototype._transform=function(e,t,r){r(null,e)}},function(e,t){},function(e,t,r){(function(t){const n=r(338),i=r(644),o=r(9),s=(r(35),r(33)),a=(r(22),r(79)),u=r(116),c=r(101),f=r(149),l={repo:"/tmp/dweb_ipfsv2700",config:{Bootstrap:["/dns4/dweb.me/tcp/4245/wss/ipfs/QmPNgKEjC7wkpu3aHUzKKhZmbEfiGzL5TP1L8zZoHJyXZW"]},EXPERIMENTAL:{pubsub:!0}};class h extends u{constructor(e,t){super(e,t),this.ipfs=void 0,this.options=e,this.name="IPFS",this.supportURLs=["ipfs"],this.supportFunctions=["fetch","store","createReadStream"],this.status=u.STATUS_LOADED}p_ipfsstart(e){const t=this;return new Promise((e,t)=>{this.ipfs=new i(this.options),this.ipfs.on("ready",()=>{e()}),this.ipfs.on("error",e=>t(e))}).then(()=>t.ipfs.version()).then(e=>console.log("IPFS READY",e)).catch(e=>{throw console.log("Error caught in p_ipfsstart"),e})}static setup0(e,t){const r=u.mergeoptions(l,e.ipfs);t&&console.log("IPFS loading options %o",r);const n=new h(r,t);return c.addtransport(n),n}async p_setup1(e,t){try{e&&console.log("IPFS starting and connecting"),this.status=u.STATUS_STARTING,t&&t(this),await this.p_ipfsstart(e),this.status=await this.p_status(e)}catch(e){console.error(this.name,"failed to connect",e),this.status=u.STATUS_FAILED}return t&&t(this),this}async p_status(e){return this.status=await this.ipfs.isOnline()?u.STATUS_CONNECTED:u.STATUS_FAILED,super.p_status(e)}static urlFrom(e){if(e instanceof o)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 a.CodingError("TransportIPFS.urlFrom: Cant convert to url from",e)}static cidFrom(e){if(e instanceof o)return e;if("string"==typeof e&&(e=s.parse(e)),e&&e.pathname){const t=e.pathname.split("/");if(!["ipfs:","dweb:"].includes(e.protocol)||"ipfs"!==t[1]||t.length<3)throw new a.TransportError("TransportIPFS.cidFrom bad format for url should be dweb: or ipfs:/ipfs/...: "+e.href);if(t.length>3)throw new a.TransportError("TransportIPFS.cidFrom not supporting paths in url yet, should be dweb: or ipfs:/ipfs/...: "+e.href);return new o(t[2])}throw new a.CodingError("TransportIPFS.cidFrom: Cant convert url",e)}static _stringFrom(e){return e instanceof o?"/ipfs/"+e.toBaseEncodedString():"object"==typeof e&&e.path?e.path:void 0}static ipfsFrom(e){if((e=this._stringFrom(e)).indexOf("/ipfs/")>-1)return e.slice(e.indexOf("/ipfs/"));throw new a.CodingError(`TransportIPFS.ipfsFrom: Cant convert url ${e} into a path starting /ipfs/`)}static ipfsGatewayFrom(e){if((e=this._stringFrom(e)).indexOf("/ipfs/")>-1)return"https://ipfs.io"+e.slice(e.indexOf("/ipfs/"));throw new a.CodingError(`TransportIPFS.ipfsGatewayFrom: Cant convert url ${e} into a path starting /ipfs/`)}static multihashFrom(e){if(e instanceof o)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 a.CodingError(`Cant turn ${e} into a multihash`)}async p_rawfetch(e,{verbose:t=!1,timeoutMS:r=6e4,relay:i=!1}={}){if(t&&console.log("IPFS p_rawfetch",s.parse(e).href),!e)throw new a.CodingError("TransportIPFS.p_rawfetch: requires url");const o=h.cidFrom(e),u=h.ipfsFrom(e);try{const i=await f.p_timeout(this.ipfs.dag.get(o),r,"Timed out IPFS fetch of "+h._stringFrom(o));if(i.remainderPath.length)throw new a.TransportError("Not yet supporting paths in p_rawfetch");let c;return"DAGNode"===i.value.constructor.name?(t&&console.log("IPFS p_rawfetch looks like its a file",s.parse(e).href),c=await this.ipfs.files.cat(u)):c=i.value,t&&console.log(`IPFS fetched ${c.length} from ${u}`),c}catch(t){console.log("Caught misc error in TransportIPFS.p_rawfetch trying IPFS",t.message);try{let t=h.ipfsGatewayFrom(e);return await f.p_timeout(n.p_GET(t),r,"Timed out IPFS fetch of "+t)}catch(e){throw console.log("Caught misc error in TransportIPFS.p_rawfetch trying gateway",e.message),e}}}async p_rawstore(e,{verbose:r}){console.assert(e,"TransportIPFS.p_rawstore: requires data");const n=e instanceof t?e:new t(e),i=(await this.ipfs.files.add(n,{"cid-version":1,hashAlg:"sha2-256"}))[0];return h.urlFrom(i)}async p_f_createReadStream(e,{verbose:t=!1,wanturl:r=!1}={}){let n;t&&console.log(this.name,"p_f_createreadstream %o",e);try{let i=e.pathname.split("/ipfs/")[1];if(i.includes("/"))throw new CodingError("Should not be seeing URLS with a path here:"+e);let o=this;return r?e:function(e){t&&console.log("TransportIPFS createreadstream %o %o",i,e);const r=e?e.start:0,s=e&&e.end?r+e.end+1:void 0;return n&&n.destroy&&n.destroy(),(n=o.ipfs.files.catReadableStream(i,{offset:r,length:s&&s-r})).on("error",e=>console.error(e)),n}}catch(t){throw n&&n.destroy&&n.destroy(),console.log(`p_f_createReadStream failed on ${e} ${t.message}`),t}}static async p_test(e,t){t&&console.log("TransportIPFS.test");try{const r=await this.p_setup(e,t);t&&console.log(r.name,"setup");const n=await r.p_status(t);let i;console.assert(n===u.STATUS_CONNECTED);const o="The quick brown fox",s="ipfs:/ipfs/zdpuAscRnisRkYnEyJAp1LydQ3po25rCEDPPEDMymYRfN1yPK",a=await r.p_rawstore(o,{verbose:t});t&&console.log("rawstore returned",a);const c=h.cidFrom(a);console.assert(a===s,"url should match url from rawstore");a.split("/")[2];const f=h.urlFrom(c);console.assert(a===f,"Should round trip"),i=a;const l=await r.p_rawfetch(i,{verbose:t});return console.assert(l.toString()===o,"Should fetch block stored above"),r}catch(e){throw console.log("Exception thrown in TransportIPFS.test:",e.message),e}}}c._transportclasses.IPFS=h,e.exports=h}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(t){const n=r(339),i=r(645),o=r(110),s=r(51),a=r(391),u=r(45),c=r(111),f=r(489),l=r(60),h=r(12),p=r(490),d=r(342),y=r(9),g=r(1),m=r(273),b=r(11),v=r(1003),_=r(1011),w=r(1012),S=r(1471);class k extends b{constructor(e){super(),this._options={init:!0,start:!0,EXPERIMENTAL:{}},e=v.validate(e||{}),m(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=S(e.repo):this._repo=e.repo,this.log=g("jsipfs"),this.log.err=g("jsipfs:err"),this.types={Buffer:t,PeerId:o,PeerInfo:s,multiaddr:l,multibase:d,multihash:h,CID:y,dagPB:u,dagCBOR:a},this._peerInfoBook=new p,this._peerInfo=void 0,this._libp2pNode=void 0,this._bitswap=void 0,this._blockService=new n(this._repo),this._ipld=new i(this._blockService),this._pubsub=void 0,this.init=w.init(this),this.preStart=w.preStart(this),this.start=w.start(this),this.stop=w.stop(this),this.shutdown=this.stop,this.isOnline=w.isOnline(this),this.version=w.version(this),this.id=w.id(this),this.repo=w.repo(this),this.bootstrap=w.bootstrap(this),this.config=w.config(this),this.block=w.block(this),this.object=w.object(this),this.dag=w.dag(this),this.libp2p=w.libp2p(this),this.swarm=w.swarm(this),this.files=w.files(this),this.bitswap=w.bitswap(this),this.pin=w.pin(this),this.ping=w.ping(this),this.pingPullStream=w.pingPullStream(this),this.pingReadableStream=w.pingReadableStream(this),this.pubsub=w.pubsub(this),this.dht=w.dht(this),this.dns=w.dns(this),this.key=w.key(this),this.stats=w.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(1472)(this),this.ls=this.files.lsImmutable,this.lsReadableStream=this.files.lsReadableStreamImmutable,this.lsPullStream=this.files.lsPullStreamImmutable,this.util={crypto:c,isIPFS:f};const b=w.mfs(this,this._options);Object.keys(b).forEach(e=>{this.files[e]=b[e]}),_(this)}}(e.exports=k).createNode=(e=>new k(e))}).call(this,r(0).Buffer)},function(e,t,r){"use strict";const n=r(151),i=r(8),o=r(9),s=r(672),a=r(155),u=r(339),c=r(64).join,f=r(64).sep,l=r(224).source,h=r(225),p=r(80),d=r(49),y=r(4),g=r(34).MemoryDatastore,m=r(45),b=r(391),v=r(775),_=r(780),w=r(94).ethAccountSnapshot,S=r(94).ethBlock,k=r(94).ethBlockList,E=r(94).ethStateTrie,A=r(94).ethStorageTrie,x=r(94).ethTx,I=r(94).ethTxTrie,T=r(868),B=r(869);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||{}).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.slice(t.length+1)}),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=function e(t,o,s){o=o||[];for(var a=s=s||0;t>=i;)o[s++]=255&t|r,t/=128;for(;t&n;)o[s++]=255&t|r,t>>>=7;return o[s]=0|t,e.bytes=s-a+1,o};var r=128,n=-128,i=Math.pow(2,31)},function(e,t){e.exports=function e(t,i){var o,s=0,a=0,u=i=i||0,c=t.length;do{if(u>=c)throw e.bytes=0,new RangeError("Could not decode varint");o=t[u++],s+=a<28?(o&n)<<a:(o&n)*Math.pow(2,a),a+=7}while(o>=r);return e.bytes=u-i,s};var r=128,n=127},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(650),i=r(340),o=r(651),s=r(652),a=r(653),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";e.exports=class{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}}},function(e,t,r){"use strict";(function(t){e.exports=function(e){return{encode:e=>"string"==typeof e?t.from(e).toString("hex"):e.toString("hex"),decode(r){for(let t of r)if(e.indexOf(t)<0)throw new Error("invalid base16 character");return t.from(r,"hex")}}}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(t){e.exports=function(e){return{encode:r=>(function(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})("string"==typeof r?t.from(r):r,e),decode(t){for(let r of t)if(e.indexOf(r)<0)throw new Error("invalid base32 character");return function(e,t){let r=(e=e.replace(new RegExp("=","g"),"")).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)>=8&&(s[o++]=i>>>n-8&255,n-=8);return s.buffer}(t,e)}}}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(t){e.exports=function(e){const r=e.indexOf("=")>-1,n=e.indexOf("-")>-1&&e.indexOf("_")>-1;return{encode(e){let i="";i="string"==typeof e?t.from(e).toString("base64"):e.toString("base64"),n&&(i=(i=i.replace("+","-")).replace("/","_"));const o=i.indexOf("=");return o>0&&!r&&(i=i.substring(0,o)),i},decode(r){n&&(r=(r=r.replace("+","-")).replace("/","_"));for(let t of r)if(e.indexOf(t)<0)throw new Error("invalid base64 character");return t.from(r,"base64")}}}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(n){const i=r(20),o=r(343),s=r(345),a=r(344);(t=e.exports).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(12);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(657),once:r(347),values:r(86),count:r(658),infinite:r(659),empty:r(660),error:r(661)}},function(e,t,r){"use strict";var n=r(86);e.exports=function(e){return n(Object.keys(e))}},function(e,t,r){"use strict";e.exports=function(e){var t=0;return e=e||1/0,function(r,n){return r?n&&n(r):t>e?n(!0):void n(null,t++)}}},function(e,t,r){"use strict";e.exports=function(e){return e=e||Math.random,function(t,r){return t?r&&r(t):r(null,e())}}},function(e,t,r){"use strict";e.exports=function(){return function(e,t){t(!0)}}},function(e,t,r){"use strict";e.exports=function(e){return function(t,r){r(e)}}},function(e,t,r){"use strict";e.exports={drain:r(118),onEnd:r(663),log:r(664),find:r(665),reduce:r(212),collect:r(87),concat:r(666)}},function(e,t,r){"use strict";var n=r(118);e.exports=function(e){return n(null,e)}},function(e,t,r){"use strict";var n=r(118);e.exports=function(e){return n(function(e){console.log(e)},e)}},function(e,t,r){"use strict";function n(e){return e}var i=r(119),o=r(118);e.exports=function(e,t){var r=!1;return t?e=i(e)||n:(t=e,e=n),o(function(n){if(e(n))return r=!0,t(null,n),!1},function(e){r||t(!0===e?null:e,null)})}},function(e,t,r){"use strict";var n=r(212);e.exports=function(e){return n(function(e,t){return e+t},"",e)}},function(e,t,r){"use strict";e.exports={map:r(348),asyncMap:r(153),filter:r(120),filterNot:r(668),through:r(350),take:r(669),unique:r(351),nonUnique:r(670),flatten:r(671)}},function(e,t,r){"use strict";var n=r(349),i=r(120);e.exports=function(e){return e=n(e),i(function(t){return!e(t)})}},function(e,t,r){"use strict";e.exports=function(e,t){var r=(t=t||{}).last||!1,n=!1;if("number"==typeof e){r=!0;var i=e;e=function(){return--i}}return function(t){function i(e){t(!0,function(t){r=!1,e(t||!0)})}return function(o,s){n&&!o?r?i(s):s(n):(n=o)?t(n,s):t(null,function(t,o){(n=n||t)?s(n):e(o)?s(null,o):(n=!0,r?s(null,o):i(s))})}}}},function(e,t,r){"use strict";var n=r(351);e.exports=function(e){return n(e,!0)}},function(e,t,r){"use strict";var n=r(86),i=r(347);e.exports=function(){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=function(e,t,r){(0,n.default)(e,function(){return!t.apply(this,arguments)},r)};var n=function(e){return e&&e.__esModule?e:{default:e}}(r(352));e.exports=t.default},function(e,t,r){var n=r(158),i=Object.prototype,o=i.hasOwnProperty,s=i.toString,a=n?n.toStringTag:void 0;e.exports=function(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}},function(e,t){var r=Object.prototype.toString;e.exports=function(e){return r.call(e)}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){if((0,n.default)(e))return function(e){var t=-1,r=e.length;return function(){return++t<r?{value:e[t],key:t}:null}}(e);var t=(0,i.default)(e);return t?function(e){var t=-1;return function(){var r=e.next();return r.done?null:(t++,{value:r.value,key:t})}}(t):function(e){var t=(0,o.default)(e),r=-1,n=t.length;return function(){var i=t[++r];return r<n?{value:e[i],key:i}:null}}(e)};var n=s(r(89)),i=s(r(676)),o=s(r(359));function s(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=function(e){return n&&e[n]&&e[n]()};var n="function"==typeof Symbol&&Symbol.iterator;e.exports=t.default},function(e,t){e.exports=function(e,t){for(var r=-1,n=Array(e);++r<e;)n[r]=t(r);return n}},function(e,t,r){var n=r(157),i=r(160),o="[object Arguments]";e.exports=function(e){return i(e)&&n(e)==o}},function(e,t,r){(function(e){var n=r(159),i=r(680),o="object"==typeof t&&t&&!t.nodeType&&t,s=o&&"object"==typeof e&&e&&!e.nodeType&&e,a=s&&s.exports===o?n.Buffer:void 0,u=(a?a.isBuffer:void 0)||i;e.exports=u}).call(this,r(27)(e))},function(e,t){e.exports=function(){return!1}},function(e,t,r){var n=r(682),i=r(683),o=r(684),s=o&&o.isTypedArray,a=s?i(s):n;e.exports=a},function(e,t,r){var n=r(157),i=r(356),o=r(160),s={};s["[object Float32Array]"]=s["[object Float64Array]"]=s["[object Int8Array]"]=s["[object Int16Array]"]=s["[object Int32Array]"]=s["[object Uint8Array]"]=s["[object Uint8ClampedArray]"]=s["[object Uint16Array]"]=s["[object Uint32Array]"]=!0,s["[object Arguments]"]=s["[object Array]"]=s["[object ArrayBuffer]"]=s["[object Boolean]"]=s["[object DataView]"]=s["[object Date]"]=s["[object Error]"]=s["[object Function]"]=s["[object Map]"]=s["[object Number]"]=s["[object Object]"]=s["[object RegExp]"]=s["[object Set]"]=s["[object String]"]=s["[object WeakMap]"]=!1,e.exports=function(e){return o(e)&&i(e.length)&&!!s[n(e)]}},function(e,t){e.exports=function(e){return function(t){return e(t)}}},function(e,t,r){(function(e){var n=r(355),i="object"==typeof t&&t&&!t.nodeType&&t,o=i&&"object"==typeof e&&e&&!e.nodeType&&e,s=o&&o.exports===i&&n.process,a=function(){try{return o&&o.require&&o.require("util").types||s&&s.binding&&s.binding("util")}catch(e){}}();e.exports=a}).call(this,r(27)(e))},function(e,t,r){var n=r(363),i=r(686),o=Object.prototype.hasOwnProperty;e.exports=function(e){if(!n(e))return i(e);var t=[];for(var r in Object(e))o.call(e,r)&&"constructor"!=r&&t.push(r);return t}},function(e,t,r){var n=r(687)(Object.keys,Object);e.exports=n},function(e,t){e.exports=function(e,t){return function(r){return e(t(r))}}},function(e,t){e.exports=function(e){return e&&"object"==typeof e&&"function"==typeof e.copy&&"function"==typeof e.fill&&"function"==typeof e.readUInt8}},function(e,t){"function"==typeof Object.create?e.exports=function(e,t){e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})}:e.exports=function(e,t){e.super_=t;var r=function(){};r.prototype=t.prototype,e.prototype=new r,e.prototype.constructor=e}},function(e,t,r){function n(e){var r;function n(){if(n.enabled){var e=n,i=+new Date,o=i-(r||i);e.diff=o,e.prev=r,e.curr=i,r=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),(n.log||t.log||console.log.bind(console)).apply(e,s)}}return n.namespace=e,n.enabled=t.enabled(e),n.useColors=t.useColors(),n.color=function(e){var r,n=0;for(r in e)n=(n<<5)-n+e.charCodeAt(r),n|=0;return t.colors[Math.abs(n)%t.colors.length]}(e),n.destroy=i,"function"==typeof t.init&&t.init(n),t.instances.push(n),n}function i(){var e=t.instances.indexOf(this);return-1!==e&&(t.instances.splice(e,1),!0)}(t=e.exports=n.debug=n.default=n).coerce=function(e){return e instanceof Error?e.stack||e.message:e},t.disable=function(){t.enable("")},t.enable=function(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,".*?"))[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)}},t.enabled=function(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},t.humanize=r(219),t.instances=[],t.names=[],t.skips=[],t.formatters={}},function(e,t,r){"use strict";t.create=function(e,t,r){return new(0,r.storageBackends[e])(t,Object.assign({},r.storageBackendOptions[e]||{}))}},function(e,t,r){"use strict";(function(t){const n=r(34).Key,i=r(1)("repo:version"),o=new n("version");e.exports=(e=>({exists(t){e.has(o,t)},get(t){e.get(o,(e,r)=>{if(e)return t(e);t(null,parseInt(r.toString().trim(),10))})},set(r,n){e.put(o,t.from(String(r)),n)},check(e,t){this.get((r,n)=>r?t(r):(i("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(221).asyncFilter,s=r(221).asyncSort,a=r(365);e.exports=class{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)}}},function(e,t,r){"use strict";const n=r(34).Key,i=r(162),o=r(4),s=r(701),a=r(702),u=r(703),c=r(2).Buffer,f=new n("config");e.exports=(e=>{const t=i(function(e,t){const i=e.key,s=e.value;i?o([e=>r.get(e),(e,t)=>t(null,a(e,i,s)),n],t):n(s,t)},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(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=function(e,t,r){if(null==t)t=1;else if(0===t)throw new Error("Concurrency must not be zero");var f=(0,c.default)(e),l=0,h=[],p=!1;function d(e,t,r){if(null!=r&&"function"!=typeof r)throw new Error("task callback must be a function");if(m.started=!0,(0,i.default)(e)||(e=[e]),0===e.length&&m.idle())return(0,a.default)(function(){m.drain()});for(var n=0,s=e.length;n<s;n++){var u={data:e[n],callback:r||o.default};t?m._tasks.unshift(u):m._tasks.push(u)}p||(p=!0,(0,a.default)(function(){p=!1,m.process()}))}function y(e){return function(t){l-=1;for(var r=0,i=e.length;r<i;r++){var o=e[r],s=(0,n.default)(h,o,0);0===s?h.shift():s>0&&h.splice(s,1),o.callback.apply(o,arguments),null!=t&&m.error(t,o.data)}l<=m.concurrency-m.buffer&&m.unsaturated(),m.idle()&&m.drain(),m.process()}}var g=!1,m={_tasks:new u.default,concurrency:t,payload:r,saturated:o.default,unsaturated:o.default,buffer:t/4,empty:o.default,drain:o.default,error:o.default,started:!1,paused:!1,push:function(e,t){d(e,!1,t)},kill:function(){m.drain=o.default,m._tasks.empty()},unshift:function(e,t){d(e,!0,t)},remove:function(e){m._tasks.remove(e)},process:function(){if(!g){for(g=!0;!m.paused&&l<m.concurrency&&m._tasks.length;){var e=[],t=[],r=m._tasks.length;m.payload&&(r=Math.min(r,m.payload));for(var n=0;n<r;n++){var i=m._tasks.shift();e.push(i),h.push(i),t.push(i.data)}l+=1,0===m._tasks.length&&m.empty(),l===m.concurrency&&m.saturated();var o=(0,s.default)(y(e));f(t,o)}g=!1}},length:function(){return m._tasks.length},running:function(){return l},workersList:function(){return h},idle:function(){return m._tasks.length+l===0},pause:function(){m.paused=!0},resume:function(){!1!==m.paused&&(m.paused=!1,(0,a.default)(m.process))}};return m};var n=f(r(696)),i=f(r(88)),o=f(r(62)),s=f(r(103)),a=f(r(213)),u=f(r(700)),c=f(r(36));function f(e){return e&&e.__esModule?e:{default:e}}e.exports=t.default},function(e,t,r){var n=r(697),i=r(698),o=r(699);e.exports=function(e,t,r){return t==t?o(e,t,r):n(e,i,r)}},function(e,t){e.exports=function(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(e,t){e.exports=function(e){return e!=e}},function(e,t){e.exports=function(e,t,r){for(var n=r-1,i=e.length;++n<i;)if(e[n]===t)return n;return-1}},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){(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=/^\[object .+?Constructor\]$/,d="object"==typeof t&&t&&t.Object===Object&&t,y="object"==typeof self&&self&&self.Object===Object&&self,g=d||y||Function("return this")();var m,b=Array.prototype,v=Function.prototype,_=Object.prototype,w=g["__core-js_shared__"],S=(m=/[^.]+$/.exec(w&&w.keys&&w.keys.IE_PROTO||""))?"Symbol(src)_1."+m:"",k=v.toString,E=_.hasOwnProperty,A=_.toString,x=RegExp("^"+k.call(E).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),I=g.Symbol,T=b.splice,B=U(g,"Map"),C=U(Object,"create"),P=I?I.prototype:void 0,O=P?P.toString:void 0;function R(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 N(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 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 K(e,t){for(var r=e.length;r--;)if(z(e[r][0],t))return r;return-1}function j(e,t){for(var r=0,n=(t=function(e,t){if(V(e))return!1;var r=typeof e;return!("number"!=r&&"symbol"!=r&&"boolean"!=r&&null!=e&&!W(e))||c.test(e)||!u.test(e)||null!=t&&e in Object(t)}(t,e)?[t]:function(e){return V(e)?e:F(e)}(t)).length;null!=e&&r<n;)e=e[q(t[r++])];return r&&r==n?e:void 0}function M(e){return!(!G(e)||function(e){return!!S&&S in e}(e))&&(function(e){var t=G(e)?A.call(e):"";return t==o||t==s}(e)||function(e){var t=!1;if(null!=e&&"function"!=typeof e.toString)try{t=!!(e+"")}catch(e){}return t}(e)?x:p).test(function(e){if(null!=e){try{return k.call(e)}catch(e){}try{return e+""}catch(e){}}return""}(e))}function D(e,t){var r=e.__data__;return function(e){var t=typeof e;return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e}(t)?r["string"==typeof t?"string":"hash"]:r.map}function U(e,t){var r=function(e,t){return null==e?void 0:e[t]}(e,t);return M(r)?r:void 0}R.prototype.clear=function(){this.__data__=C?C(null):{}},R.prototype.delete=function(e){return this.has(e)&&delete this.__data__[e]},R.prototype.get=function(e){var t=this.__data__;if(C){var r=t[e];return r===n?void 0:r}return E.call(t,e)?t[e]:void 0},R.prototype.has=function(e){var t=this.__data__;return C?void 0!==t[e]:E.call(t,e)},R.prototype.set=function(e,t){return this.__data__[e]=C&&void 0===t?n:t,this},N.prototype.clear=function(){this.__data__=[]},N.prototype.delete=function(e){var t=this.__data__,r=K(t,e);return!(r<0||(r==t.length-1?t.pop():T.call(t,r,1),0))},N.prototype.get=function(e){var t=this.__data__,r=K(t,e);return r<0?void 0:t[r][1]},N.prototype.has=function(e){return K(this.__data__,e)>-1},N.prototype.set=function(e,t){var r=this.__data__,n=K(r,e);return n<0?r.push([e,t]):r[n][1]=t,this},L.prototype.clear=function(){this.__data__={hash:new R,map:new(B||N),string:new R}},L.prototype.delete=function(e){return D(this,e).delete(e)},L.prototype.get=function(e){return D(this,e).get(e)},L.prototype.has=function(e){return D(this,e).has(e)},L.prototype.set=function(e,t){return D(this,e).set(e,t),this};var F=H(function(e){e=function(e){return null==e?"":function(e){if("string"==typeof e)return e;if(W(e))return O?O.call(e):"";var t=e+"";return"0"==t&&1/e==-i?"-0":t}(e)}(e);var t=[];return f.test(e)&&t.push(""),e.replace(l,function(e,r,n,i){t.push(n?i.replace(h,"$1"):r||e)}),t});function q(e){if("string"==typeof e||W(e))return e;var t=e+"";return"0"==t&&1/e==-i?"-0":t}function H(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(H.Cache||L),n}function z(e,t){return e===t||e!=e&&t!=t}H.Cache=L;var V=Array.isArray;function G(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function W(e){return"symbol"==typeof e||function(e){return!!e&&"object"==typeof e}(e)&&A.call(e)==a}e.exports=function(e,t,r){var n=null==e?void 0:j(e,t);return void 0===n?r:n}}).call(this,r(6))},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=/^\[object .+?Constructor\]$/,y=/^(?:0|[1-9]\d*)$/,g="object"==typeof t&&t&&t.Object===Object&&t,m="object"==typeof self&&self&&self.Object===Object&&self,b=g||m||Function("return this")();var v,_=Array.prototype,w=Function.prototype,S=Object.prototype,k=b["__core-js_shared__"],E=(v=/[^.]+$/.exec(k&&k.keys&&k.keys.IE_PROTO||""))?"Symbol(src)_1."+v:"",A=w.toString,x=S.hasOwnProperty,I=S.toString,T=RegExp("^"+A.call(x).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),B=b.Symbol,C=_.splice,P=H(b,"Map"),O=H(Object,"create"),R=B?B.prototype:void 0,N=R?R.toString:void 0;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 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 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(e,t,r){var n=e[t];x.call(e,t)&&Y(n,r)&&(void 0!==r||t in e)||(e[t]=r)}function D(e,t){for(var r=e.length;r--;)if(Y(e[r][0],t))return r;return-1}function U(e){return!(!X(e)||function(e){return!!E&&E in e}(e))&&(function(e){var t=X(e)?I.call(e):"";return t==s||t==a}(e)||function(e){var t=!1;if(null!=e&&"function"!=typeof e.toString)try{t=!!(e+"")}catch(e){}return t}(e)?T:d).test(function(e){if(null!=e){try{return A.call(e)}catch(e){}try{return e+""}catch(e){}}return""}(e))}function F(e,t,r,n){if(!X(e))return e;for(var i=-1,o=(t=V(t,e)?[t]:function(e){return J(e)?e:G(e)}(t)).length,s=o-1,a=e;null!=a&&++i<o;){var u=W(t[i]),c=r;if(i!=s){var f=a[u];void 0===(c=n?n(f,u,a):void 0)&&(c=X(f)?f:z(t[i+1])?[]:{})}M(a,u,c),a=a[u]}return e}function q(e,t){var r=e.__data__;return function(e){var t=typeof e;return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e}(t)?r["string"==typeof t?"string":"hash"]:r.map}function H(e,t){var r=function(e,t){return null==e?void 0:e[t]}(e,t);return U(r)?r:void 0}function z(e,t){return!!(t=null==t?o:t)&&("number"==typeof e||y.test(e))&&e>-1&&e%1==0&&e<t}function V(e,t){if(J(e))return!1;var r=typeof e;return!("number"!=r&&"symbol"!=r&&"boolean"!=r&&null!=e&&!Z(e))||f.test(e)||!c.test(e)||null!=t&&e in Object(t)}L.prototype.clear=function(){this.__data__=O?O(null):{}},L.prototype.delete=function(e){return this.has(e)&&delete this.__data__[e]},L.prototype.get=function(e){var t=this.__data__;if(O){var r=t[e];return r===n?void 0:r}return x.call(t,e)?t[e]:void 0},L.prototype.has=function(e){var t=this.__data__;return O?void 0!==t[e]:x.call(t,e)},L.prototype.set=function(e,t){return this.__data__[e]=O&&void 0===t?n:t,this},K.prototype.clear=function(){this.__data__=[]},K.prototype.delete=function(e){var t=this.__data__,r=D(t,e);return!(r<0||(r==t.length-1?t.pop():C.call(t,r,1),0))},K.prototype.get=function(e){var t=this.__data__,r=D(t,e);return r<0?void 0:t[r][1]},K.prototype.has=function(e){return D(this.__data__,e)>-1},K.prototype.set=function(e,t){var r=this.__data__,n=D(r,e);return n<0?r.push([e,t]):r[n][1]=t,this},j.prototype.clear=function(){this.__data__={hash:new L,map:new(P||K),string:new L}},j.prototype.delete=function(e){return q(this,e).delete(e)},j.prototype.get=function(e){return q(this,e).get(e)},j.prototype.has=function(e){return q(this,e).has(e)},j.prototype.set=function(e,t){return q(this,e).set(e,t),this};var G=$(function(e){e=function(e){return null==e?"":function(e){if("string"==typeof e)return e;if(Z(e))return N?N.call(e):"";var t=e+"";return"0"==t&&1/e==-i?"-0":t}(e)}(e);var t=[];return l.test(e)&&t.push(""),e.replace(h,function(e,r,n,i){t.push(n?i.replace(p,"$1"):r||e)}),t});function W(e){if("string"==typeof e||Z(e))return e;var t=e+"";return"0"==t&&1/e==-i?"-0":t}function $(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($.Cache||j),n}function Y(e,t){return e===t||e!=e&&t!=t}$.Cache=j;var J=Array.isArray;function X(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function Z(e){return"symbol"==typeof e||function(e){return!!e&&"object"==typeof e}(e)&&I.call(e)==u}e.exports=function(e,t,r){return null==e?e:F(e,t,r)}}).call(this,r(6))},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=/^\[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")();var _,w=Array.prototype,S=Function.prototype,k=Object.prototype,E=v["__core-js_shared__"],A=(_=/[^.]+$/.exec(E&&E.keys&&E.keys.IE_PROTO||""))?"Symbol(src)_1."+_:"",x=S.toString,I=k.hasOwnProperty,T=k.toString,B=RegExp("^"+x.call(I).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),C=v.Symbol,P=k.propertyIsEnumerable,O=w.splice,R=z(v,"Map"),N=z(Object,"create"),L=C?C.prototype:void 0,K=L?L.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(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(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 U(e,t){for(var r=e.length;r--;)if(J(e[r][0],t))return r;return-1}function F(e,t){return null!=e&&I.call(e,t)}function q(e){return!(!te(e)||function(e){return!!A&&A in e}(e))&&(Q(e)||function(e){var t=!1;if(null!=e&&"function"!=typeof e.toString)try{t=!!(e+"")}catch(e){}return t}(e)?B:y).test(function(e){if(null!=e){try{return x.call(e)}catch(e){}try{return e+""}catch(e){}}return""}(e))}function H(e,t){var r=e.__data__;return function(e){var t=typeof e;return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e}(t)?r["string"==typeof t?"string":"hash"]:r.map}function z(e,t){var r=function(e,t){return null==e?void 0:e[t]}(e,t);return q(r)?r:void 0}function V(e,t,r){for(var n,i=-1,o=(t=function(e,t){if(Z(e))return!1;var r=typeof e;return!("number"!=r&&"symbol"!=r&&"boolean"!=r&&null!=e&&!ne(e))||l.test(e)||!f.test(e)||null!=t&&e in Object(t)}(t,e)?[t]:function(e){return Z(e)?e:W(e)}(t)).length;++i<o;){var s=$(t[i]);if(!(n=null!=e&&r(e,s)))break;e=e[s]}return n||!!(o=e?e.length:0)&&ee(o)&&G(s,o)&&(Z(e)||X(e))}function G(e,t){return!!(t=null==t?o:t)&&("number"==typeof e||g.test(e))&&e>-1&&e%1==0&&e<t}j.prototype.clear=function(){this.__data__=N?N(null):{}},j.prototype.delete=function(e){return this.has(e)&&delete this.__data__[e]},j.prototype.get=function(e){var t=this.__data__;if(N){var r=t[e];return r===n?void 0:r}return I.call(t,e)?t[e]:void 0},j.prototype.has=function(e){var t=this.__data__;return N?void 0!==t[e]:I.call(t,e)},j.prototype.set=function(e,t){return this.__data__[e]=N&&void 0===t?n:t,this},M.prototype.clear=function(){this.__data__=[]},M.prototype.delete=function(e){var t=this.__data__,r=U(t,e);return!(r<0||(r==t.length-1?t.pop():O.call(t,r,1),0))},M.prototype.get=function(e){var t=this.__data__,r=U(t,e);return r<0?void 0:t[r][1]},M.prototype.has=function(e){return U(this.__data__,e)>-1},M.prototype.set=function(e,t){var r=this.__data__,n=U(r,e);return n<0?r.push([e,t]):r[n][1]=t,this},D.prototype.clear=function(){this.__data__={hash:new j,map:new(R||M),string:new j}},D.prototype.delete=function(e){return H(this,e).delete(e)},D.prototype.get=function(e){return H(this,e).get(e)},D.prototype.has=function(e){return H(this,e).has(e)},D.prototype.set=function(e,t){return H(this,e).set(e,t),this};var W=Y(function(e){e=function(e){return null==e?"":function(e){if("string"==typeof e)return e;if(ne(e))return K?K.call(e):"";var t=e+"";return"0"==t&&1/e==-i?"-0":t}(e)}(e);var t=[];return h.test(e)&&t.push(""),e.replace(p,function(e,r,n,i){t.push(n?i.replace(d,"$1"):r||e)}),t});function $(e){if("string"==typeof e||ne(e))return e;var t=e+"";return"0"==t&&1/e==-i?"-0":t}function Y(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(Y.Cache||D),n}function J(e,t){return e===t||e!=e&&t!=t}function X(e){return function(e){return re(e)&&function(e){return null!=e&&ee(e.length)&&!Q(e)}(e)}(e)&&I.call(e,"callee")&&(!P.call(e,"callee")||T.call(e)==s)}Y.Cache=D;var Z=Array.isArray;function Q(e){var t=te(e)?T.call(e):"";return t==a||t==u}function ee(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=o}function te(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function re(e){return!!e&&"object"==typeof e}function ne(e){return"symbol"==typeof e||re(e)&&T.call(e)==c}e.exports=function(e,t){return null!=e&&V(e,t,F)}}).call(this,r(6))},function(e,t,r){"use strict";const n=r(34).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(706),i=n.ShardingDatastore,o=r(34).Key,s=r(713),a=r(151),u=r(3),c=r(371),f=r(9),l=r(8),h=e=>(e=>{const t=new s.Encoder;return new o("/"+t.write(e).finalize(),!1)})(e.buffer);e.exports=((e,t,r)=>{!function(e,t,r){if(t.sharding){const t=new n.shard.NextToLast(2);i.createOrOpen(e,t,r)}else u(()=>r(null,e))}(e,t,(e,t)=>{if(e)return r(e);r(null,function(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=h(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=h(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:h(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(h(t),r)},delete(t,r){if(!f.isCID(t))return u(()=>{r(new Error("Not a valid cid"))});e.delete(h(t),r)},close(t){e.close(t)}}}(t))})})},function(e,t,r){"use strict";const n=r(163),i=r(707),o=r(709),s=r(711),a=r(712),u=r(369);t.KeytransformDatastore=n,t.ShardingDatastore=i,t.MountDatastore=o,t.TieredDatastore=s,t.NamespaceDatastore=a,t.shard=u},function(e,t,r){"use strict";(function(t){const n=r(4),i=r(63),o=r(34).Key,s=r(369),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();return t===u.toString()||t===c.toString()?e:new o(this.shard.fun(t)).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(50),i=r(710),o=r(8),s=r(34).Key,a=r(34).utils,u=a.asyncFilter,c=a.asyncSort,f=a.replaceStartWith,l=r(163);e.exports=class{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)}}},function(e,t){e.exports=function(e){var t,r,n=!!e,i=(e||[]).map(s),o=0;function s(e){return{ready:!1,reading:!1,ended:!1,read:e,data:null}}function a(){if(r){!function(){for(var e=i.length;e--;)i[e].ended&&i.splice(e,1)}();var e=i.length,s=r;if(0===e&&(t||n))return r=null,void s(t||!0);for(var a=0;a<e;a++){var u=i[(o+a)%e];if(u.ready&&!u.ended){var c=u.data;return u.ready=!1,u.data=null,o++,r=null,s(null,c)}}}}function u(){for(var e=i.length;e--;)!function(r){if(e>i.length)throw new Error("this should never happen");if(!(r.reading||r.ended||r.ready)){r.reading=!0;var n=!0;r.read(t,function e(i,o){r.data=o,r.ready=!0,r.reading=!1,!0===i||t?r.ended=!0:i&&(t=r.ended=i),t&&!i&&r.read(t,e),n||a()}),n=!1}}(i[e]);a()}function c(e,n){t=t||e,r=n,u()}return c.add=function(e){if(!e)return n=!0,u();i.push(s(e)),u()},c.cap=function(e){c.add(null)},c}},function(e,t,r){"use strict";const n=r(50),i=r(37);e.exports=class{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=>{this.stores[o++].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=>{this.stores[o++].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)}}},function(e,t,r){"use strict";const n=r(34).Key,i=r(163);e.exports=class 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)}}},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)>0?i|=o<<n:n<0?(r.push(i|o>>-n),i=o<<(n+=8)&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,r,n,i=this.shift,o=this.carry;for(n=0;n<e.length;n++)t=o|(r=e[n])>>i,this.buf+=this.alphabet[31&t],i>5&&(t=r>>(i-=5),this.buf+=this.alphabet[31&t]),o=r<<(i=5-i),i=8-i;return this.shift=i,this.carry=o,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){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e,t,r,i){(0,n.default)(e,t,function(e,t){r(e,function(e,r){t(e,!r)})},i)};var n=function(e){return e&&e.__esModule?e:{default:e}}(r(715));e.exports=t.default},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e,t,r,n){((0,i.default)(t)?function(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)})}:c)(e,t,(0,a.default)(r),n||s.default)};var n=u(r(222)),i=u(r(89)),o=u(r(716)),s=u(r(62)),a=u(r(36));function u(e){return e&&e.__esModule?e:{default:e}}function c(e,t,r,i){var s=[];e(t,function(e,t,n){r(e,function(r,i){r?n(r):(i&&s.push({index:t,value:e}),n())})},function(e){e?i(e):i(null,(0,n.default)(s.sort(function(e,t){return e.index-t.index}),(0,o.default)("value")))})}e.exports=t.default},function(e,t){e.exports=function(e){return function(t){return null==t?void 0:t[e]}}},function(e,t,r){"use strict";e.exports={lock:"memory",storageBackends:{root:r(165),blocks:r(165),keys:r(165),datastore:r(165)},storageBackendOptions:{root:{extension:""},blocks:{sharding:!1},keys:{sharding:!1}}}},function(e,t,r){(function(t){var n=r(11).EventEmitter,i=r(104).inherits,o=r(26),s=r(719),a=r(722),u=r(723),c=r(375),f=r(17),l=r(377),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,n=this;return e||(r=(e=l()).promise),this.isOpen()?(t.nextTick(e,null,n),r):this._isOpening()?(this.once("open",function(){e(null,n)}),r):(this.emit("opening"),this.db.open(this.options,function(t){if(t)return e(new y(t));n.db=n._db,e(null,n),n.emit("open"),n.emit("ready")}),r)},m.prototype.close=function(e){var r,n=this;return e||(r=(e=l()).promise),this.isOpen()?(this.db.close(function(){n.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(){n.close(e)}),r},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))||(n=(r=l()).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,o=this;return(n=b(r,n))||(i=(n=l()).promise),_(this,n)?i:(r=v(r),this.db.put(e,t,r,function(r){if(r)return n(new h(r));o.emit("put",e,t),n()}),i)},m.prototype.del=function(e,t,r){if(null===e||void 0===e)throw new h("del() requires a key argument");var n,i=this;return(r=b(t,r))||(n=(r=l()).promise),_(this,r)?n:(t=v(t),this.db.del(e,t,function(t){if(t)return r(new h(t));i.emit("del",e),r()}),n)},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,i=this;return(r=b(t,r))||(n=(r=l()).promise),_(this,r)?n:(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));i.emit("batch",e),r()}),n)},m.prototype.readStream=m.prototype.createReadStream=function(e){return"number"!=typeof(e=o({keys:!0,values:!0},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(7))},function(e,t,r){var n=r(104),i=r(372).AbstractLevelDOWN,o=r(721),s="put get del batch".split(" ");function a(e){i.call(this,""),this._db=e,this._operations=[],this._iterators=[],u(this)}function u(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=[],function(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)})}(r),t()})},a.prototype._close=function(e){var t=this;this._db.close(function(r){if(r)return e(r);u(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(26),o=r(373),s=r(374),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){return-1!==u.indexOf(e)}function l(e){return""===e||null==e||function(e){return n.isBuffer(e)&&0===e.length}(e)}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=function(e){var t={};for(var r in e)a.call(e,r)&&(f(r)&&l(e[r])||(t[r]=e[r]));return t}(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(7),r(0).Buffer)},function(e,t,r){var n=r(104),i=r(372).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(5),i=r(22).Readable,o=r(26);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(375).WriteError,i=r(377);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,r=this._levelup,o=this.ops;e||(t=(e=i()).promise);try{this.batch.write(function(t){if(t)return e(new n(t));r.emit("batch",o),e()})}catch(e){throw new n(e)}return t},e.exports=o},function(e,t,r){var n=r(725);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)}o.prototype=new Error,e.exports=function(e){var t=function(t,r){return function(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}(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;r=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};return function(t,r,n,i){var o;if(i=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}}(n,i),"object"==typeof r){for(o in r)Object.hasOwnProperty.call(r,o)&&(i.value=r[o],e(t,o,i));return t}return e(t,r,i)}},void 0!==e&&e.exports?e.exports=r():this.prr=r()},function(e,t,r){"use strict";var n=r(223).AbstractLevelDOWN,i=r(223).AbstractChainedBatch,o=r(223).AbstractIterator,s=r(5),a=r(26),u=r(728),c=r(730).EncodingError;function f(e,t){if(!(this instanceof f))return new f(e,t);n.call(this,""),void 0===(t=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)).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(26),o=r(378),s=r(379),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){return-1!==u.indexOf(e)}function l(e){return""===e||null==e||function(e){return n.isBuffer(e)&&0===e.length}(e)}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=function(e){var t={};for(var r in e)a.call(e,r)&&(f(r)&&l(e[r])||(t[r]=e[r]));return t}(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(7),r(0).Buffer)},function(e,t,r){var n=r(729);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){function r(e){return e}function n(t){return void 0===t||null===t||e.isBuffer(t)}t.utf8=t["utf-8"]={encode:function(e){return n(e)?e:String(e)},decode:r,buffer:!1,type:"utf8"},t.json={encode:JSON.stringify,decode:JSON.parse,buffer:!1,type:"json"},t.binary={encode:function(t){return n(t)?t:e.from(t)},decode:r,buffer:!0,type:"binary"},t.none={encode:r,decode:r,buffer:!1,type:"id"},t.id=t.none,["hex","ascii","base64","ucs2","ucs-2","utf16le","utf-16le"].forEach(function(r){t[r]={encode:function(t){return n(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(376).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(380).AbstractLevelDOWN,o=r(104),s=r(733),a=r(26);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)i(this._idbOpts.idb);else{var n=indexedDB.open(this.location);n.onerror=function(e){t(e.target.error)},n.onsuccess=function(){i(n.result)}}function i(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(){o.result.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){var i=e;"binary"!==(r=a(this._idbOpts,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){"binary"!==(t=a(this._idbOpts,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);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){"binary"!==(r=a(this._idbOpts,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);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){"binary"!==a(t,e).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).deleteObjectStore(r.storeName)},o.onsuccess=function(){(e=o.result).close(),0===e.objectStoreNames.length?i(r.location):t()}}else t();else i(r.location)}}}).call(this,r(0).Buffer,r(7))},function(e,t,r){var n=r(381);e.exports=function(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]})}},function(e,t,r){(function(t,n){var i=r(104),o=r(380).AbstractIterator,s=r(734),a=r(735),u=r(90),c=r(26),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(7))},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)&&((a=i(n,o))<0||0===a&&c(e)))return!1;var a,u=h(e);return!r(u)||!((a=i(n,u))>0||0===a&&f(e))},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(90),i=r(26);e.exports=function(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;return o._cursorsOpened=0,function n(){var i,a,u,c,f,l=r.direction||"next",h=r.range||{};i=h.lower,a=h.upper,u=!!h.lowerOpen,c=!!h.upperOpen,s&&("next"===l?(u=!0,i=s):(c=!0,a=s)),i&&a?f=IDBKeyRange.bound(i,a,u,c):i?f=IDBKeyRange.lowerBound(i,u):a&&(f=IDBKeyRange.upperBound(a,c));var p=e.transaction(t,"readonly"),d=p.objectStore(t);o._cursorsOpened++;var y=d.openCursor(f,r.direction);function g(e){try{e.continue()}catch(e){"TransactionInactiveError"!==e.name||r.snapshot?o.emit("error",e):n()}}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)}}(),o}},function(e,t,r){e.exports=r(210)},function(e,t,r){e.exports=r(85)},function(e,t,r){e.exports=r(22).Transform},function(e,t,r){e.exports=r(22).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))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";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e,t,r,o){o=o||n.default,t=t||[];var s=[],a=0,u=(0,i.default)(r);e(t,function(e,t,r){var n=a++;u(e,function(e,t){s[n]=t,r(e)})},function(e){o(e,s)})};var n=o(r(62)),i=o(r(36));function o(e){return e&&e.__esModule?e:{default:e}}e.exports=t.default},function(e,t,r){"use strict";(function(t){const n=r(38),i=r(39),o=r(387),s=r(747),a=o.toCallback,u=o.toBuf,c=o.fromString,f=o.fromNumberTo32BitBuf;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(749),dblSha2256:(e,r)=>{s.sha2256(e,(e,n)=>{e&&r(e),s.sha2256(t.from(n),r)})}}}).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=o(e^=e>>>16,2246822507),(e=o(e^=e>>>13,3266489909))^e>>>16}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 32==(t%=64)?[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 0==(t%=64)?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 h(e=c(e=h(e=c(e=h(e,[0,e[0]>>>1]),[4283543511,3981806797]),[0,e[0]>>>1]),[3301882366,444984403]),[0,e[0]>>>1])}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)i=o(i=s(i^=u=o(u=s(u=o(u=255&e.charCodeAt(l)|(255&e.charCodeAt(l+1))<<8|(255&e.charCodeAt(l+2))<<16|(255&e.charCodeAt(l+3))<<24,c),15),f),13),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:i^=u=o(u=s(u=o(u^=255&e.charCodeAt(l),c),15),f)}return(i=a(i^=e.length))>>>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,i=s(i^=l=o(l=s(l=o(l,y),15),g),19),i=o(i+=u,5)+1444728091,u=s(u^=h=o(h=s(h=o(h,g),16),m),17),u=o(u+=c,5)+197830471,c=s(c^=p=o(p=s(p=o(p,m),17),b),15),c=o(c+=f,5)+2530024501,f=s(f^=d=o(d=s(d=o(d,b),18),y),13),f=o(f+=i,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:f^=d=o(d=s(d=o(d^=e.charCodeAt(v+12),b),18),y);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:c^=p=o(p=s(p=o(p^=e.charCodeAt(v+8),m),17),b);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:u^=h=o(h=s(h=o(h^=e.charCodeAt(v+4),g),16),m);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:i^=l=o(l=s(l=o(l^=e.charCodeAt(v),y),15),g)}return i^=e.length,i+=u^=e.length,i+=c^=e.length,u+=i+=f^=e.length,c+=i,f+=i,i=a(i),i+=u=a(u),i+=c=a(c),u+=i+=f=a(f),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],i=u(c(i=u(i=f(i=h(i,s=c(s=f(s=c(s,d),31),y)),27),o),[0,5]),[0,1390208809]),o=u(c(o=u(o=f(o=h(o,a=c(a=f(a=c(a,y),33),d)),31),i),[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:o=h(o,a=c(a=f(a=c(a=h(a,[0,e.charCodeAt(g+8)]),y),33),d));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:i=h(i,s=c(s=f(s=c(s=h(s,[0,e.charCodeAt(g)]),d),31),y))}return i=h(i,[0,e.length]),o=u(o=h(o,[0,e.length]),i=u(i,o)),i=p(i),o=u(o=p(o),i=u(i,o)),("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}()},function(e,t,r){"use strict";(function(t){const n=r(40),i=self.crypto?self.crypto.subtle||self.crypto.webkitSubtle:self.msCrypto?self.msCrypto.subtle:void 0;function o(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)}}e.exports={sha1:function(e,t){o("SHA-1")(e,t)},sha2256:function(e,t){o("SHA-256")(e,t)},sha2512:function(e,t){o("SHA-512")(e,t)}}}).call(this,r(0).Buffer)},function(e,t,r){(function(t){var n,i=r(388);n="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):function(){var e,t=new s(function(t){e=t});return{resolver:e,promise:t}}();var t,r=!1,a=!1,u=[],c=!1;function f(e){u.length?(c=!0,u.shift()(e||!1)):c=!1}this.then=function(e,i){return new s(function(o){u.push(function(r){var s=a?e:i;if("function"==typeof s){function u(){var e;try{e=s(t)}catch(e){return o.reject(e),f()}o.fulfill(e),f(!0)}r?u():n(u)}else a?(o.fulfill(t),f(r)):(o.reject(t),f(r))}),r&&!c&&f()})},function(){function n(e){r||(r=!0,a=!1,t=e,f())}for(var s={fulfill:function e(o){r||(i(o)?o.then(e,n):(r=a=!0,t=o,f()))},reject:n},u=0;u<o.length;u++)o[u](this,s);if("function"==typeof e)try{e(s)}catch(e){s.reject(e)}}()}e.exports=s,s.use=function(e){o.push(e)}}).call(this,r(7))},function(e,t,r){"use strict";(function(t){const n=r(41),i=r(387).toCallback,o={init:n.blake2bInit,update:n.blake2bUpdate,digest:n.blake2bFinal},s={init:n.blake2sInit,update:n.blake2sUpdate,digest:n.blake2sFinal},a=(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[45569+t]=a(t+1,o);for(let t=0;t<32;t++)e[45633+t]=a(t+1,s)})}).call(this,r(0).Buffer)},function(e,t,r){var n=r(389);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=l[s],c=l[s+1],h=l[a],p=l[a+1];i(f,e,t),o(f,e,u,c);var d=f[n]^f[e],y=f[n+1]^f[e+1];f[n]=y,f[n+1]=d,i(f,r,n),d=f[t]^f[r],y=f[t+1]^f[r+1],f[t]=d>>>24^y<<8,f[t+1]=y>>>24^d<<8,i(f,e,t),o(f,e,h,p),d=f[n]^f[e],y=f[n+1]^f[e+1],f[n]=d>>>16^y<<16,f[n+1]=y>>>16^d<<16,i(f,r,n),d=f[t]^f[r],y=f[t+1]^f[r+1],f[t]=y>>>31^d<<1,f[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=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,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].map(function(e){return 2*e})),f=new Uint32Array(32),l=new Uint32Array(32);function h(e,t){var r=0;for(r=0;r<16;r++)f[r]=e.h[r],f[r+16]=u[r];for(f[24]=f[24]^e.t,f[25]=f[25]^e.t/4294967296,t&&(f[28]=~f[28],f[29]=~f[29]),r=0;r<32;r++)l[r]=s(e.b,4*r);for(r=0;r<12;r++)a(0,8,16,24,c[16*r+0],c[16*r+1]),a(2,10,18,26,c[16*r+2],c[16*r+3]),a(4,12,20,28,c[16*r+4],c[16*r+5]),a(6,14,22,30,c[16*r+6],c[16*r+7]),a(0,10,20,30,c[16*r+8],c[16*r+9]),a(2,12,22,24,c[16*r+10],c[16*r+11]),a(4,14,16,26,c[16*r+12],c[16*r+13]),a(6,8,18,28,c[16*r+14],c[16*r+15]);for(r=0;r<16;r++)e.h[r]=e.h[r]^f[r]^f[r+16]}function p(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&&(d(r,t),r.c=128),r}function d(e,t){for(var r=0;r<t.length;r++)128===e.c&&(e.t+=e.c,h(e,!1),e.c=0),e.b[e.c++]=t[r]}function y(e){for(e.t+=e.c;e.c<128;)e.b[e.c++]=0;h(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 g(e,t,r){r=r||64,e=n.normalizeInput(e);var i=p(r,t);return d(i,e),y(i)}e.exports={blake2b:g,blake2bHex:function(e,t,r){var i=g(e,t,r);return n.toHex(i)},blake2bInit:p,blake2bUpdate:d,blake2bFinal:y}},function(e,t,r){var n=r(389);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)}e.exports={blake2s:y,blake2sHex:function(e,t,r){var i=y(e,t,r);return n.toHex(i)},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;n=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,o,s,a,u,c=e.length,f=0,l=2*r;for(i=0;i<c;i+=l)for(s=(o=i+r)+r,o>c&&(o=c),s>c&&(s=c),a=i,u=o;;)if(a<o&&u<s)t(e[a],e[u])<=0?n[f++]=e[a++]:n[f++]=e[u++];else if(a<o)n[f++]=e[a++];else{if(!(u<s))break;n[f++]=e[u++]}};return e},e.exports=n()},function(e,t,r){var n=r(754),i=r(756);e.exports=n,e.exports.parse=n,e.exports.stringify=i},function(e,t,r){var n=r(755),i=["int32","int64","uint32","uint64","sint32","sint64","bool","fixed64","sfixed64","double","fixed32","sfixed32","float"],o=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")},s=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=o(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")},a=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(s(e));break;case"enum":t.enums.push(d(e));break;case"message":t.messages.push(f(e));break;case"extensions":t.extensions=c(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=s(e);n.oneof=r,t.fields.push(n)}e.shift();break;case"extend":t.extends.push(u(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(s(e))}return t},u=function(e){return{name:e[1],message:f(e)}},c=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}},f=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=a(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")},l=function(e){e.shift();var t=e.shift();if(";"!==e[0])throw new Error("Expected ; but found "+e[0]);return e.shift(),t},h=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},p=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=o(e)),e.shift(),{name:t,val:r}},d=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=p(e);r.values[n.name]=n.val}else t=y(e),r.options[t.name]=t.value}throw new Error("No closing tag for enum")},y=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=g(e));break;default:throw new Error("Unexpected token in option: "+e[0])}}},g=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=g(e)),r[i]=o,";"===e[0]&&e.shift();break;case"{":if(e.shift(),o=g(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")},m=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},b=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=y(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(v(e));break;default:throw new Error("Unexpected token in service: "+e[0])}}throw new Error("No closing tag for service")},v=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=y(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")};e.exports=function(e){for(var t=n(e.toString()),r=0;r<t.length;r++){var o;if(/^("|')([^'"]*)$/.test(t[r]))for(o=1===t[r].length?r+1:r;o<t.length;o++)if(/^([^'"]*)("|')$/.test(t[o])){t=t.slice(0,r).concat(t.slice(r,o+1).join("")).concat(t.slice(o+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=l(t);break;case"syntax":if(!a)throw new Error("Protobuf syntax version should be first thing in file");s.syntax=h(t);break;case"message":s.messages.push(f(t));break;case"enum":s.enums.push(d(t));break;case"option":var c=y(t);if(s.options[c.name])throw new Error("Duplicate option "+c.name);s.options[c.name]=c.value;break;case"import":s.imports.push(m(t));break;case"extend":s.extends.push(u(t));break;case"service":s.services||(s.services=[]),s.services.push(b(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,o,a;if(t.options&&"true"===t.options.packed&&-1===i.indexOf(t.type)){if(-1===t.type.indexOf(".")){if(e.enums&&e.enums.some(function(e){return e.name===t.type}))return}else{if((r=t.type.split(".")).length>2)throw new Error("what is this?");if(n=r[0],o=r[1],s.messages.some(function(e){if(e.name===n)return a=e,e}),a&&a.enums&&a.enums.some(function(e){return e.name===o}))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}},function(e,t){e.exports=function(e){var t=function(e){return e.trim()};return e.replace(/([;,{}()=:[\]<>]|\/\*|\*\/)/g," $1 ").split(/\n/).map(t).filter(Boolean).map(function(e){var t=e.indexOf("//");return t>-1?e.slice(0,t):e}).map(t).filter(Boolean).join("\n").split(/\s+|\n+/gm).filter(function(){var e=!1;return function(t){return"/*"===t?(e=!0,!1):"*/"===t?(e=!1,!1):!e}}())}},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(",");return r&&(r=" ["+r+"]"),e.value+r},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,[])).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){return Object.keys(e).forEach(function(r){var n=e[r],i=typeof n;"object"===i?Array.isArray(n)?n.forEach(function(e){(e=a(e,[])).length&&t.push(r+" {",e,"}")}):(n=a(n,[])).length&&t.push(r+" {",n,"}"):("string"===i&&(n='"'+n+'"'),t.push(r+": "+n))}),t},u=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},c=function(e){return function(t){return Array.isArray(t)?t.map(c(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){!function(e,t){t.push("service "+e.name+" {"),e.options||(e.options={}),s(e.options,t),e.methods||(e.methods=[]),e.methods.forEach(function(e){t.push(u(e,[]))}),t.push("}","")}(e,t)}),t.map(c("")).join("\n")}},function(e,t,r){"use strict";var n=r(758),i=r(760),o=r(761),s=r(762),a=r(20);e.exports=function(e,t){var r={},u={},c={},f=function(e,t){e.enums&&e.enums.forEach(function(e){e.id=t+(t?".":"")+e.name,u[e.id]=e,f(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}}),f(n,n.id)})};f(e,"");var l=function(e){var t=Object.keys(e.values||[]).map(function(t){return parseInt(e.values[t].value,10)});return n.make(0,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},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},a.encodingLength)},h=function(e,t){e.messages.forEach(function(r){t[r.name]=p(r.name,e.id)}),e.enums.forEach(function(e){t[e.name]=function(e){if(!e)return null;var t={};return Object.keys(e).forEach(function(r){t[r]=e[r].value}),t}(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 p(t.type,e.id)}),a=s(e,n,r),u=o(e,p,n,r,a),c=i(e,p,n);return u.bytes=c.bytes=0,t.buffer=!0,t.encode=u,t.decode=c,t.encodingLength=a,t},p=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]||u[t]},null);if(!1===o)return s;if(!s)throw new Error("Could not resolve "+e);return s.values?l(s):c[s.id]||h(s,c[s.id]={})};return(e.enums||[]).concat((e.messages||[]).map(function(e){return p(e.id)}))}},function(e,t,r){"use strict";var n,i,o,s=r(20),a=r(759),u=r(2).Buffer,c=function(e,t,r,n){return t.bytes=r.bytes=0,{type:e,encode:t,decode:r,encodingLength:n}};t.make=c,t.bytes=(n=function(e){return u.isBuffer(e)?e.length:u.byteLength(e)},c(2,i=function(e,t,r){var o=r,a=n(e);return s.encode(a,t,r),r+=s.encode.bytes,u.isBuffer(e)?e.copy(t,r):t.write(e,r,a),r+=a,i.bytes=r-o,t},o=function(e,t){var r=t,n=s.decode(e,t);t+=s.decode.bytes;var i=e.slice(t,t+n);return t+=i.length,o.bytes=t-r,i},function(e){var t=n(e);return s.encodingLength(t)+t})),t.string=function(){var e=function(t,r,n){var i=n,o=u.byteLength(t);return s.encode(o,r,n,"utf-8"),n+=s.encode.bytes,r.write(t,n,o),n+=o,e.bytes=n-i,r},t=function(e,r){var n=r,i=s.decode(e,r);r+=s.decode.bytes;var o=e.toString("utf-8",r,r+i);return r+=i,t.bytes=r-n,o};return c(2,e,t,function(e){var t=u.byteLength(e);return s.encodingLength(t)+t})}(),t.bool=function(){var e=function(t,r,n){return r[n]=t?1:0,e.bytes=1,r},t=function(e,r){var n=e[r]>0;return t.bytes=1,n};return c(0,e,t,function(e){return 1})}(),t.int32=function(){var e=function(t,r){var n=s.decode(t,r);return e.bytes=s.decode.bytes,n>2147483647?n-4294967296:n};return c(0,s.encode,e,function(e){return s.encodingLength(e<0?e+4294967296:e)})}(),t.int64=function(){var e=function(t,r){var n=s.decode(t,r);if(n>=Math.pow(2,63)){for(var i=9;255===t[r+i-1];)i--;i=i||9;var o=u.allocUnsafe(i);t.copy(o,0,r,r+i),o[i-1]=127&o[i-1],n=-1*s.decode(o,0),e.bytes=10}else e.bytes=s.decode.bytes;return n},t=function(e,r,n){if(e<0){var i=n+9;for(s.encode(-1*e,r,n),r[n+=s.encode.bytes-1]=128|r[n];n<i-1;)r[++n]=255;r[i]=1,t.bytes=10}else s.encode(e,r,n),t.bytes=s.encode.bytes;return r};return c(0,t,e,function(e){return e<0?10:s.encodingLength(e)})}(),t.sint32=t.sint64=c(0,a.encode,a.decode,a.encodingLength),t.uint32=t.uint64=t.enum=t.varint=c(0,s.encode,s.decode,s.encodingLength),t.fixed64=t.sfixed64=function(){var e=function(t,r,n){return t.copy(r,n),e.bytes=8,r},t=function(e,r){var n=e.slice(r,r+8);return t.bytes=8,n};return c(1,e,t,function(e){return 8})}(),t.double=function(){var e=function(t,r,n){return r.writeDoubleLE(t,n),e.bytes=8,r},t=function(e,r){var n=e.readDoubleLE(r);return t.bytes=8,n};return c(1,e,t,function(e){return 8})}(),t.fixed32=function(){var e=function(t,r,n){return r.writeUInt32LE(t,n),e.bytes=4,r},t=function(e,r){var n=e.readUInt32LE(r);return t.bytes=4,n};return c(5,e,t,function(e){return 4})}(),t.sfixed32=function(){var e=function(t,r,n){return r.writeInt32LE(t,n),e.bytes=4,r},t=function(e,r){var n=e.readInt32LE(r);return t.bytes=4,n};return c(5,e,t,function(e){return 4})}(),t.float=function(){var e=function(t,r,n){return r.writeFloatLE(t,n),e.bytes=4,r},t=function(e,r){var n=e.readFloatLE(r);return t.bytes=4,n};return c(5,e,t,function(e){return 4})}()},function(e,t,r){var n=r(20);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(20),i=r(227).defined;var o=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)}},s=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=function(e,t,r){for(var a=[],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&&a.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}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,g=h,m={};;){if(p<=h){var b,v,_="",w=0;for(w=0;w<a.length;w++)if(_=a[w],!i(m[_]))throw new Error("Decoded message is not valid, missing required field: "+_);for(w=0;w<r.length;w++)if(d=e.fields[w],v=f[w][0],b=f[w][1],_=d.name,!i(m[_])){var S=!1;if(d.oneof)for(var k=Object.keys(m),E=0;E<k.length;E++)if(c.indexOf(k[E])>-1){S=!0;break}S||(b?d.repeated?m[_]=[]:(v=v&&b[v]?b[v].value:b[Object.keys(b)[0]].value,m[_]=parseInt(v||0,10)):m[_]=s(d,v))}return t.bytes=h-g,m}var A=n.decode(l,h);h+=n.decode.bytes;var x=u[A>>3];if(null!=x){var I=r[x];if((d=e.fields[x]).packed){var T=n.decode(l,h);for(T+=h+=n.decode.bytes;h<T;)h=y(I,d,m,l,h)}else h=y(I,d,m,l,h)}else h=o(7&A,l,h)}}}},function(e,t,r){"use strict";(function(t){var n=r(227).defined,i=r(20);e.exports=function(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,x=f[m].p,I=f[m].h,T=S.packed;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(T){var C=0;for(E=0;E<k.length;E++)n(k[E])&&(C+=w.encodingLength(k[E]));if(C){for(E=0;E<I.length;E++)h[d++]=x[E];i.encode(C,h,d),d+=i.encode.bytes}}if(S.repeated)for(E=0;E<k.length;E++)A=k[E],n(A)&&(d=p(h,d,I,w,T,A));else d=p(h,d,I,w,T,k)}else if(S.required)throw new Error(S.name+" is required")}return r.bytes=d-y,h}}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";var n=r(227).defined,i=r(20);e.exports=function(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){var c=0,f=0,l=0;for(f=0;f<o.length;f++){var h=o[f],p=r[h],d=!1;for(l=0;l<p.length;l++)if(n(u[p[l]])){if(d)throw new Error("only one of the properties defined in oneof "+h+" can be set");d=!0}}for(f=0;f<s;f++){var y,g=t[f],m=e.fields[f],b=u[m.name],v=a[f];if(n(b)){if(m.map){var _=Object.keys(b);for(l=0;l<_.length;l++)_[l]={key:_[l],value:b[_[l]]};b=_}if(m.packed){var w=0;for(l=0;l<b.length;l++)n(b[l])&&(w+=y=g.encodingLength(b[l]),g.message&&(w+=i.encodingLength(y)));w&&(c+=v+w+i.encodingLength(w))}else if(m.repeated)for(l=0;l<b.length;l++)n(b[l])&&(c+=v+(y=g.encodingLength(b[l]))+(g.message?i.encodingLength(y):0));else c+=v+(y=g.encodingLength(b))+(g.message?i.encodingLength(y):0)}else if(m.required)throw new Error(m.name+" is required")}return c}}},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(91);e.exports=function(e,t,r,i){i(null,new n(e,t,r))}},function(e,t,r){"use strict";const n=r(91);e.exports.createDagLinkFromB58EncodedHash=function(e){return new n(e.name?e.name:e.Name,e.size?e.size:e.Size,e.hash||e.Hash||e.multihash)}},function(e,t,r){"use strict";const n=r(168),i=n.cloneLinks,o=n.cloneData,s=r(167);e.exports=function(e,t){const r=o(e),n=i(e);s(r,n,t)}},function(e,t,r){"use strict";const n=r(168),i=n.cloneLinks,o=n.cloneData,s=n.toDAGLink,a=r(91),u=r(166),c=r(167);e.exports=function(e,t,r){const n=i(e),f=o(e);if(a.isDAGLink(t));else if(u.isDAGNode(t))t=s(t);else{t.multihash=t.multihash||t.hash;try{t=new a(t.name,t.size,t.multihash)}catch(e){return r(e)}}n.push(t),c(f,n,r)}},function(e,t,r){"use strict";(function(t){const n=r(168),i=n.cloneLinks,o=n.cloneData,s=r(167);e.exports=function(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)}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";t.Diagnose=r(770),t.Decoder=r(393),t.Encoder=r(772),t.Simple=r(394),t.Tagged=r(395),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(393),i=r(228);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){return`${super.createFloatSingle(e,t,r,n)}_2`}createFloatDouble(e,t,r,n,i,o,s,a){return`${super.createFloatDouble(e,t,r,n,i,o,s,a)}_3`}createByteString(e,t){const r=e.join(", ");return-1===t?`(_ ${r})`:`h'${r}`}createByteStringFromHeap(e,r){return`h'${t.from(super.createByteStringFromHeap(e,r)).toString("hex")}'`}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){return`"${t.from(super.createUtf8StringFromHeap(e,r)).toString("utf8")}"`}static diagnose(e,r){return"string"==typeof e&&(e=t.from(e,r||"hex")),(new o).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){"use asm";var n=new e.Uint8Array(r);var i=t.pushInt;var o=t.pushInt32;var s=t.pushInt32Neg;var a=t.pushInt64;var u=t.pushInt64Neg;var c=t.pushFloat;var f=t.pushFloatSingle;var l=t.pushFloatDouble;var h=t.pushTrue;var p=t.pushFalse;var d=t.pushUndefined;var y=t.pushNull;var g=t.pushInfinity;var m=t.pushInfinityNeg;var b=t.pushNaN;var v=t.pushNaNNeg;var _=t.pushArrayStart;var w=t.pushArrayStartFixed;var S=t.pushArrayStartFixed32;var k=t.pushArrayStartFixed64;var E=t.pushObjectStart;var A=t.pushObjectStartFixed;var x=t.pushObjectStartFixed32;var I=t.pushObjectStartFixed64;var T=t.pushByteString;var B=t.pushByteStringStart;var C=t.pushUtf8String;var P=t.pushUtf8StringStart;var O=t.pushSimpleUnassigned;var R=t.pushTagStart;var N=t.pushTagStart4;var L=t.pushTagStart8;var K=t.pushTagUnassigned;var j=t.pushBreak;var M=e.Math.pow;var D=0;var U=0;var F=0;function q(e){e=e|0;D=0;U=e;while((D|0)<(U|0)){F=Je[n[D]&255](n[D]|0)|0;if((F|0)>0){break}}return F|0}function H(e){e=e|0;if(((D|0)+(e|0)|0)<(U|0)){return 0}return 1}function z(e){e=e|0;return n[e|0]<<8|n[e+1|0]|0}function V(e){e=e|0;return n[e|0]<<24|n[e+1|0]<<16|n[e+2|0]<<8|n[e+3|0]|0}function G(e){e=e|0;i(e|0);D=D+1|0;return 0}function W(e){e=e|0;if(H(1)|0){return 1}i(n[D+1|0]|0);D=D+2|0;return 0}function $(e){e=e|0;if(H(2)|0){return 1}i(z(D+1|0)|0);D=D+3|0;return 0}function Y(e){e=e|0;if(H(4)|0){return 1}o(z(D+1|0)|0,z(D+3|0)|0);D=D+5|0;return 0}function J(e){e=e|0;if(H(8)|0){return 1}a(z(D+1|0)|0,z(D+3|0)|0,z(D+5|0)|0,z(D+7|0)|0);D=D+9|0;return 0}function X(e){e=e|0;i(-1-(e-32|0)|0);D=D+1|0;return 0}function Z(e){e=e|0;if(H(1)|0){return 1}i(-1-(n[D+1|0]|0)|0);D=D+2|0;return 0}function Q(e){e=e|0;var t=0;if(H(2)|0){return 1}t=z(D+1|0)|0;i(-1-(t|0)|0);D=D+3|0;return 0}function ee(e){e=e|0;if(H(4)|0){return 1}s(z(D+1|0)|0,z(D+3|0)|0);D=D+5|0;return 0}function te(e){e=e|0;if(H(8)|0){return 1}u(z(D+1|0)|0,z(D+3|0)|0,z(D+5|0)|0,z(D+7|0)|0);D=D+9|0;return 0}function re(e){e=e|0;var t=0;var r=0;var n=0;n=e-64|0;if(H(n|0)|0){return 1}t=D+1|0;r=(D+1|0)+(n|0)|0;T(t|0,r|0);D=r|0;return 0}function ne(e){e=e|0;var t=0;var r=0;var i=0;if(H(1)|0){return 1}i=n[D+1|0]|0;t=D+2|0;r=(D+2|0)+(i|0)|0;if(H(i+1|0)|0){return 1}T(t|0,r|0);D=r|0;return 0}function ie(e){e=e|0;var t=0;var r=0;var n=0;if(H(2)|0){return 1}n=z(D+1|0)|0;t=D+3|0;r=(D+3|0)+(n|0)|0;if(H(n+2|0)|0){return 1}T(t|0,r|0);D=r|0;return 0}function oe(e){e=e|0;var t=0;var r=0;var n=0;if(H(4)|0){return 1}n=V(D+1|0)|0;t=D+5|0;r=(D+5|0)+(n|0)|0;if(H(n+4|0)|0){return 1}T(t|0,r|0);D=r|0;return 0}function se(e){e=e|0;return 1}function ae(e){e=e|0;B();D=D+1|0;return 0}function ue(e){e=e|0;var t=0;var r=0;var n=0;n=e-96|0;if(H(n|0)|0){return 1}t=D+1|0;r=(D+1|0)+(n|0)|0;C(t|0,r|0);D=r|0;return 0}function ce(e){e=e|0;var t=0;var r=0;var i=0;if(H(1)|0){return 1}i=n[D+1|0]|0;t=D+2|0;r=(D+2|0)+(i|0)|0;if(H(i+1|0)|0){return 1}C(t|0,r|0);D=r|0;return 0}function fe(e){e=e|0;var t=0;var r=0;var n=0;if(H(2)|0){return 1}n=z(D+1|0)|0;t=D+3|0;r=(D+3|0)+(n|0)|0;if(H(n+2|0)|0){return 1}C(t|0,r|0);D=r|0;return 0}function le(e){e=e|0;var t=0;var r=0;var n=0;if(H(4)|0){return 1}n=V(D+1|0)|0;t=D+5|0;r=(D+5|0)+(n|0)|0;if(H(n+4|0)|0){return 1}C(t|0,r|0);D=r|0;return 0}function he(e){e=e|0;return 1}function pe(e){e=e|0;P();D=D+1|0;return 0}function de(e){e=e|0;w(e-128|0);D=D+1|0;return 0}function ye(e){e=e|0;if(H(1)|0){return 1}w(n[D+1|0]|0);D=D+2|0;return 0}function ge(e){e=e|0;if(H(2)|0){return 1}w(z(D+1|0)|0);D=D+3|0;return 0}function me(e){e=e|0;if(H(4)|0){return 1}S(z(D+1|0)|0,z(D+3|0)|0);D=D+5|0;return 0}function be(e){e=e|0;if(H(8)|0){return 1}k(z(D+1|0)|0,z(D+3|0)|0,z(D+5|0)|0,z(D+7|0)|0);D=D+9|0;return 0}function ve(e){e=e|0;_();D=D+1|0;return 0}function _e(e){e=e|0;var t=0;t=e-160|0;if(H(t|0)|0){return 1}A(t|0);D=D+1|0;return 0}function we(e){e=e|0;if(H(1)|0){return 1}A(n[D+1|0]|0);D=D+2|0;return 0}function Se(e){e=e|0;if(H(2)|0){return 1}A(z(D+1|0)|0);D=D+3|0;return 0}function ke(e){e=e|0;if(H(4)|0){return 1}x(z(D+1|0)|0,z(D+3|0)|0);D=D+5|0;return 0}function Ee(e){e=e|0;if(H(8)|0){return 1}I(z(D+1|0)|0,z(D+3|0)|0,z(D+5|0)|0,z(D+7|0)|0);D=D+9|0;return 0}function Ae(e){e=e|0;E();D=D+1|0;return 0}function xe(e){e=e|0;R(e-192|0|0);D=D+1|0;return 0}function Ie(e){e|0;R(e|0);D=D+1|0;return 0}function Te(e){e|0;R(e|0);D=D+1|0;return 0}function Be(e){e|0;R(e|0);D=D+1|0;return 0}function Ce(e){e|0;R(e|0);D=D+1|0;return 0}function Pe(e){e=e|0;R(e-192|0|0);D=D+1|0;return 0}function Oe(e){e|0;R(e|0);D=D+1|0;return 0}function Re(e){e|0;R(e|0);D=D+1|0;return 0}function Ne(e){e|0;R(e|0);D=D+1|0;return 0}function Le(e){e=e|0;if(H(1)|0){return 1}R(n[D+1|0]|0);D=D+2|0;return 0}function Ke(e){e=e|0;if(H(2)|0){return 1}R(z(D+1|0)|0);D=D+3|0;return 0}function je(e){e=e|0;if(H(4)|0){return 1}N(z(D+1|0)|0,z(D+3|0)|0);D=D+5|0;return 0}function Me(e){e=e|0;if(H(8)|0){return 1}L(z(D+1|0)|0,z(D+3|0)|0,z(D+5|0)|0,z(D+7|0)|0);D=D+9|0;return 0}function De(e){e=e|0;O((e|0)-224|0);D=D+1|0;return 0}function Ue(e){e=e|0;p();D=D+1|0;return 0}function Fe(e){e=e|0;h();D=D+1|0;return 0}function qe(e){e=e|0;y();D=D+1|0;return 0}function He(e){e=e|0;d();D=D+1|0;return 0}function ze(e){e=e|0;if(H(1)|0){return 1}O(n[D+1|0]|0);D=D+2|0;return 0}function Ve(e){e=e|0;var t=0;var r=0;var i=1.0;var o=0.0;var s=0.0;var a=0.0;if(H(2)|0){return 1}t=n[D+1|0]|0;r=n[D+2|0]|0;if((t|0)&0x80){i=-1.0}o=+(((t|0)&0x7C)>>2);s=+(((t|0)&0x03)<<8|r);if(+o==0.0){c(+(+i*+5.9604644775390625e-8*+s))}else if(+o==31.0){if(+i==1.0){if(+s>0.0){b()}else{g()}}else{if(+s>0.0){v()}else{m()}}}else{c(+(+i*M(+2,+(+o-25.0))*+(1024.0+s)))}D=D+3|0;return 0}function Ge(e){e=e|0;if(H(4)|0){return 1}f(n[D+1|0]|0,n[D+2|0]|0,n[D+3|0]|0,n[D+4|0]|0);D=D+5|0;return 0}function We(e){e=e|0;if(H(8)|0){return 1}l(n[D+1|0]|0,n[D+2|0]|0,n[D+3|0]|0,n[D+4|0]|0,n[D+5|0]|0,n[D+6|0]|0,n[D+7|0]|0,n[D+8|0]|0);D=D+9|0;return 0}function $e(e){e=e|0;return 1}function Ye(e){e=e|0;j();D=D+1|0;return 0}var Je=[G,G,G,G,G,G,G,G,G,G,G,G,G,G,G,G,G,G,G,G,G,G,G,G,W,$,Y,J,$e,$e,$e,$e,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,Z,Q,ee,te,$e,$e,$e,$e,re,re,re,re,re,re,re,re,re,re,re,re,re,re,re,re,re,re,re,re,re,re,re,re,ne,ie,oe,se,$e,$e,$e,ae,ue,ue,ue,ue,ue,ue,ue,ue,ue,ue,ue,ue,ue,ue,ue,ue,ue,ue,ue,ue,ue,ue,ue,ue,ce,fe,le,he,$e,$e,$e,pe,de,de,de,de,de,de,de,de,de,de,de,de,de,de,de,de,de,de,de,de,de,de,de,de,ye,ge,me,be,$e,$e,$e,ve,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,we,Se,ke,Ee,$e,$e,$e,Ae,xe,xe,xe,xe,xe,xe,Pe,Pe,Pe,Pe,Pe,Pe,Pe,Pe,Pe,Pe,Pe,Pe,Pe,Pe,Pe,Pe,Pe,Pe,Le,Ke,je,Me,$e,$e,$e,$e,De,De,De,De,De,De,De,De,De,De,De,De,De,De,De,De,De,De,De,De,Ue,Fe,qe,He,ze,Ve,Ge,We,$e,$e,$e,Ye];return{parse:q}}},function(e,t,r){"use strict";(function(t){const n=r(33),i=r(169),o=r(228),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");class k{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++){if(this.semanticTypes[n][0]===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]=k.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){switch(function(e){return{}.toString.call(e).slice(8,-1)}(e)){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 k;if(!t.pushAny(e))throw new Error("Failed to encode input");return t.finalize()}}e.exports=k}).call(this,r(0).Buffer)},function(e,t,r){var n=r(774);e.exports=function(e){if(!(e instanceof Object))throw new TypeError('"obj" must be an object (or inherit from it)');return function e(t,r){for(var i in r=new n(t,r),t){var o=t[i];if(o instanceof Object&&(r.contains(o)||e(o,r)))return!0}return!1}(e)}},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(398),t.resolver=r(399)},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(e){return"number"==typeof e&&isFinite(e)&&function(e){return"number"==typeof e&&isFinite(e)&&Math.floor(e)===e}(e)}function i(e,t){if("number"!=typeof e)throw new Error(t?r.INVALID_OFFSET_NON_NUMBER:r.INVALID_LENGTH_NON_NUMBER);if(!n(e)||e<0)throw new Error(t?r.INVALID_OFFSET:r.INVALID_LENGTH)}t.ERRORS=r,t.checkEncoding=function(t){if(!e.isEncoding(t))throw new Error(r.INVALID_ENCODING)},t.isFiniteInteger=n,t.checkLengthValue=function(e){i(e,!1)},t.checkOffsetValue=function(e){i(e,!0)},t.checkTargetOffset=function(e,t){if(e<0||e>t.length)throw new Error(r.INVALID_TARGET_OFFSET)}}).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).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).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).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(229),t.util=r(400)},function(e,t,r){var n=r(28),i=r(232);for(var o in i)n[o]=i[o];e.exports={bufferutils:r(407),Block:r(799),ECPair:r(239),ECSignature:r(243),HDNode:r(815),Transaction:r(238),TransactionBuilder:r(816),address:r(240),crypto:r(105),networks:r(124),opcodes:r(42),script:n}},function(e,t,r){(function(t){var n=r(231),i=r(402);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;var p={ArrayN:u,Buffer:o,BufferN:c,Finite:function(e){return"number"==typeof e&&isFinite(e)},Hex:s,HexN:f,Int8:function(e){return e<<24>>24===e},Int16:function(e){return e<<16>>16===e},Int32:function(e){return(0|e)===e},StringN:l,UInt8:function(e){return(255&e)===e},UInt16:function(e){return(65535&e)===e},UInt32:function(e){return e>>>0===e},UInt53:function(e){return"number"==typeof e&&e>=0&&e<=h&&Math.floor(e)===e}};for(var d in p)p[d].toJSON=function(e){return e}.bind(null,d);e.exports=p}).call(this,r(0).Buffer)},function(e,t,r){var n=r(42),i={};for(var o in n){i[n[o]]=o}e.exports=i},function(e,t,r){var n=r(2).Buffer,i=r(28),o=r(404),s=r(25),a=r(42);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 s(s.Array,e),s(c,e,t),e.slice(1)}e.exports={check:c,decode:function(e,t){return h(i.decompile(e),t)},decodeStack:h,encode:function(e,t){return i.compile(l(e,t))},encodeStack:l}},function(e,t,r){var n=r(28),i=r(31),o=r(25),s=r(42);function a(e){var t=n.compile(e);return t.length>1&&t[0]===s.OP_RETURN}a.toJSON=function(){return"null data output"},e.exports={output:{check:a,decode:function(e){return o(a,e),e.slice(2)},encode:function(e){return o(i.Buffer,e),n.compile([s.OP_RETURN,e])}}}},function(e,t,r){var n=r(28),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 i(i.Array,e),i(o,e),e[0]}o.toJSON=function(){return"pubKey input"},e.exports={check:o,decode:function(e){return a(n.decompile(e))},decodeStack:a,encode:function(e){return n.compile(s(e))},encodeStack:s}},function(e,t,r){var n=r(28),i=r(25),o=r(42);function s(e){var t=n.decompile(e);return 2===t.length&&n.isCanonicalPubKey(t[0])&&t[1]===o.OP_CHECKSIG}s.toJSON=function(){return"pubKey output"},e.exports={check:s,decode:function(e){var t=n.decompile(e);return i(s,t),t[0]},encode:function(e){return i(n.isCanonicalPubKey,e),n.compile([e,o.OP_CHECKSIG])}}},function(e,t,r){var n=r(28),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){return i(i.Array,e),i(o,e),{signature:e[0],pubKey:e[1]}}o.toJSON=function(){return"pubKeyHash input"},e.exports={check:o,decode:function(e){return a(n.decompile(e))},decodeStack:a,encode:function(e,t){return n.compile(s(e,t))},encodeStack:s}},function(e,t,r){var n=r(28),i=r(31),o=r(25),s=r(42);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}a.toJSON=function(){return"pubKeyHash output"},e.exports={check:a,decode:function(e){return o(a,e),e.slice(3,23)},encode:function(e){return o(i.Hash160bit,e),n.compile([s.OP_DUP,s.OP_HASH160,e,s.OP_EQUALVERIFY,s.OP_CHECKSIG])}}},function(e,t,r){e.exports={input:r(791),output:r(792)}},function(e,t,r){var n=r(2).Buffer,i=r(28),o=r(25),s=r(233),a=r(234),u=r(235),c=r(405),f=r(406);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){return o(o.Array,e),o(l,e),{redeemScriptStack:e.slice(0,-1),redeemScript:e[e.length-1]}}l.toJSON=function(){return"scriptHash input"},e.exports={check:l,decode:function(e){var t=p(i.decompile(e));return t.redeemScriptSig=i.compile(t.redeemScriptStack),delete t.redeemScriptStack,t},decodeStack:p,encode:function(e,t){var r=i.decompile(e);return i.compile(h(r,t))},encodeStack:h}},function(e,t,r){var n=r(28),i=r(31),o=r(25),s=r(42);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}a.toJSON=function(){return"scriptHash output"},e.exports={check:a,decode:function(e){return o(a,e),e.slice(2,22)},encode:function(e){return o(i.Hash160bit,e),n.compile([s.OP_HASH160,e,s.OP_EQUAL])}}},function(e,t,r){e.exports={input:r(794),output:r(405)}},function(e,t,r){var n=r(28),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])}s.toJSON=function(){return"witnessPubKeyHash input"},e.exports={check:s,decodeStack:function(e){return i(i.Array,e),i(s,e),{signature:e[0],pubKey:e[1]}},encodeStack:function(e,t){return i({signature:n.isCanonicalSignature,pubKey:o},{signature:e,pubKey:t}),[e,t]}}},function(e,t,r){e.exports={input:r(796),output:r(406)}},function(e,t,r){(function(t){var n=r(28),i=r(31),o=r(25),s=r(233),a=r(234),u=r(235);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))}c.toJSON=function(){return"witnessScriptHash input"},e.exports={check:c,decodeStack:function(e){return o(o.Array,e),o(c,e),{witnessData:e.slice(0,-1),witnessScript:e[e.length-1]}},encodeStack:function(e,t){return o({witnessData:[i.Buffer],witnessScript:i.Buffer},{witnessData:e,witnessScript:t}),[].concat(e,t)}}}).call(this,r(0).Buffer)},function(e,t,r){e.exports={output:r(798)}},function(e,t,r){var n=r(2).Buffer,i=r(28),o=r(31),s=r(25),a=r(42),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)}c.toJSON=function(){return"Witness commitment output"},e.exports={check:c,decode:function(e){return s(c,e),i.decompile(e)[1].slice(4,36)},encode:function(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(e,t,r){var n=r(2).Buffer,i=r(105),o=r(804),s=r(25),a=r(31),u=r(236),c=r(238);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}var i=new f;if(i.version=function(){var r=e.readInt32LE(t);return t+=4,r}(),i.prevHash=r(32),i.merkleRoot=r(32),i.timestamp=n(),i.bits=n(),i.nonce=n(),80===e.length)return i;function o(){var r=c.fromBuffer(e.slice(t),!0);return t+=r.byteLength(),r}var s=function(){var r=u.decode(e,t);return t+=u.decode.bytes,r}();i.transactions=[];for(var a=0;a<s;++a){var l=o();i.transactions.push(l)}return i},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.writeUInt32LE(e,r),r+=4}return function(e){t.writeInt32LE(e,r),r+=4}(this.version),i(this.prevHash),i(this.merkleRoot),o(this.timestamp),o(this.bits),o(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(5),i=r(106),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(5),i=r(106),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(5),i=r(411),o=r(106),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(5),i=r(412),o=r(106),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){if(!Array.isArray(e))throw TypeError("Expected values Array");if("function"!=typeof r)throw TypeError("Expected digest Function");for(var n=e.length,i=e.concat();n>1;){for(var o=0,s=0;s<n;s+=2,++o){var a=i[s],u=s+1===n?a:i[s+1],c=t.concat([a,u]);i[o]=r(c)}n=o}return i[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,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}e.exports={decode:function(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);var o=(e=r).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}},encode:function(e,t,r){if(r=r||90,e.length+7+t.length>r)throw new TypeError("Exceeds length limit");for(var i=u(e=e.toLowerCase()),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},toWords:function(e){return c(e,8,5,!0)},fromWords:function(e){return c(e,5,8,!1)}}},function(e,t,r){"use strict";var n=r(14),i=r(2).Buffer;e.exports=function(e){function t(t){var r=t.slice(0,-4),n=t.slice(-4),i=e(r);if(!(n[0]^i[0]|n[1]^i[1]|n[2]^i[2]|n[3]^i[3]))return r}return{encode:function(t){var r=e(t);return n.encode(i.concat([t,r],t.length+4))},decode:function(e){var r=t(n.decode(e));if(!r)throw new Error("Invalid checksum");return r},decodeUnsafe:function(e){var r=n.decodeUnsafe(e);if(r)return t(r)}}}},function(e,t,r){var n=r(2).Buffer,i=r(242),o=r(25),s=r(31),a=r(93),u=r(243),c=n.alloc(1,0),f=n.alloc(1,1),l=r(244).getCurveByName("secp256k1");function h(e,t,r){o(s.tuple(s.Hash256bit,s.Buffer256bit,s.Function),arguments);var u=n.alloc(32,0),h=n.alloc(32,1);u=i("sha256",u).update(h).update(c).update(t).update(e).digest(),h=i("sha256",u).update(h).digest(),u=i("sha256",u).update(h).update(f).update(t).update(e).digest(),h=i("sha256",u).update(h).digest(),h=i("sha256",u).update(h).digest();for(var p=a.fromBuffer(h);p.signum()<=0||p.compareTo(l.n)>=0||!r(p);)u=i("sha256",u).update(h).update(c).digest(),h=i("sha256",u).update(h).digest(),h=i("sha256",u).update(h).digest(),p=a.fromBuffer(h);return p}var p=l.n.shiftRight(1);e.exports={deterministicGenerateK:h,sign:function(e,t){o(s.tuple(s.Hash256bit,s.BigInt),arguments);var r,n,i=t.toBuffer(32),c=a.fromBuffer(e),f=l.n,d=l.G;return h(e,i,function(e){var i=d.multiply(e);return!l.isInfinity(i)&&0!==(r=i.affineX.mod(f)).signum()&&0!==(n=e.modInverse(f).multiply(c.add(t.multiply(r))).mod(f)).signum()}),n.compareTo(p)>0&&(n=f.subtract(n)),new u(r,n)},verify:function(e,t,r){o(s.tuple(s.Hash256bit,s.ECSignature,s.ECPoint),arguments);var n=l.n,i=l.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),h=c.modInverse(n),p=f.multiply(h).mod(n),d=u.multiply(h).mod(n),y=i.multiplyTwo(p,r,d);return!l.isInfinity(y)&&y.affineX.mod(n).equals(u)},__curve:l}},function(e,t,r){"use strict";var n=r(5),i=r(2).Buffer,o=r(92),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(237);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(17),n=r(413);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(93),i=r(813),o=r(415);e.exports=function(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)}},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(241);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}e.exports={decode:function(e,t){return i(n.decode(e),t)},decodeRaw:i,encode:function(e,t,r){return"number"==typeof e?n.encode(o(e,t,r)):n.encode(o(e.version,e.privateKey,e.compressed))},encodeRaw:o}}).call(this,r(0).Buffer)},function(e,t,r){var n=r(2).Buffer,i=r(241),o=r(105),s=r(242),a=r(25),u=r(31),c=r(124),f=r(93),l=r(239),h=r(244),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);return new d(new l(o,null,{network:t}),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,o=r.readUInt32BE(0);if(Array.isArray(t)){if(!(n=t.filter(function(e){return o===e.bip32.private||o===e.bip32.public}).pop()))throw new Error("Unknown network version")}else n=t||c.bitcoin;if(o!==n.bip32.private&&o!==n.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,g=r.slice(13,45);if(o===n.bip32.private){if(0!==r.readUInt8(45))throw new Error("Invalid private key");var m=f.fromBuffer(r.slice(46,78));y=new l(m,null,{network:n})}else{var b=h.Point.decodeFrom(p,r.slice(45,78));p.validate(b),y=new l(null,b,{network:n})}var v=new d(y,g);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 d(new l(null,this.keyPair.Q,{network:this.keyPair.network}),this.chainCode);return e.depth=this.depth,e.index=this.index,e.parentFingerprint=this.parentFingerprint,e},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,o=s("sha512",this.chainCode).update(r).digest(),c=o.slice(0,32),h=o.slice(32),y=f.fromBuffer(c);if(y.compareTo(p.n)>=0)return this.derive(e+1);if(this.isNeutered()){var g=p.G.multiply(y).add(this.keyPair.Q);if(p.isInfinity(g))return this.derive(e+1);i=new l(null,g,{network:this.keyPair.network})}else{var m=y.add(this.keyPair.d).mod(p.n);if(0===m.signum())return this.derive(e+1);i=new l(m,null,{network:this.keyPair.network})}var b=new d(i,h);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(240),o=r(105),s=r(28),a=r(232),u=r(124),c=r(42),f=r(25),l=r(31),h=a.types,p=[a.types.P2PKH,a.types.P2PK,a.types.MULTISIG],d=p.concat([a.types.P2WPKH,a.types.P2WSH]),y=r(239),g=r(243),m=r(238);function b(e){return-1!==p.indexOf(e)}function v(e){return-1!==d.indexOf(e)}function _(e,t){if(0===e.length&&0===t.length)return{};var r,n,i,u,c,f,l,p,d,y,g=!1,m=!1,_=!1,w=s.decompile(e);a.classifyInput(w,!0)===h.P2SH&&(_=!0,c=w[w.length-1],p=a.classifyOutput(c),r=a.scriptHash.output.encode(o.hash160(c)),n=h.P2SH,u=c);var S=a.classifyWitness(t,!0);if(S===h.P2WSH){if(f=t[t.length-1],l=a.classifyOutput(f),m=!0,g=!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(d=a.witnessScriptHash.output.encode(o.sha256(f)),!c.equals(d))throw new Error("Redeem script didn't match witnessScript")}if(!b(a.classifyOutput(f)))throw new Error("unsupported witness script");u=f,i=l,y=t.slice(0,-1)}else if(S===h.P2WPKH){g=!0;var k=t[t.length-1],E=o.hash160(k);if(0===e.length){if(r=a.witnessPubKeyHash.output.encode(E),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(d=a.witnessPubKeyHash.output.encode(E),!c.equals(d))throw new Error("Redeem script did not have the right witness program")}i=h.P2PKH,y=t}else if(c){if(!v(p))throw new Error("Bad redeemscript!");u=c,i=p,y=w.slice(0,-1)}else n=i=a.classifyInput(e),y=w;var A=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:r&&(n=a.multisig.output.decode(r).pubKeys),i=t.slice(1).map(function(e){return 0===e.length?void 0:e})}return{pubKeys:n,signatures:i}}(i,y,u),x={pubKeys:A.pubKeys,signatures:A.signatures,prevOutScript:r,prevOutType:n,signType:i,signScript:u,witness:Boolean(g)};return _&&(x.redeemScript=c,x.redeemScriptType=p),m&&(x.witnessScript=f,x.witnessScriptType=l),x}function w(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 S(e,t){if(e.prevOutType){if(e.prevOutType!==h.P2SH)throw new Error("PrevOutScript must be P2SH");if(!s.decompile(e.prevOutScript)[1].equals(t))throw new Error("Inconsistent hash160(RedeemScript)")}}function k(e,t,r,n,i){var u,c,f,l,p,d,y,g,m,b=!1,v=!1,_=!1;if(r&&i){if(p=o.hash160(r),y=o.sha256(i),S(e,p),!r.equals(a.witnessScriptHash.output.encode(y)))throw new Error("Witness script inconsistent with redeem script");if(!(u=w(i,void 0,t)).pubKeys)throw new Error('WitnessScript not supported "'+s.toASM(r)+'"');c=a.types.P2SH,f=a.scriptHash.output.encode(p),b=v=_=!0,l=a.types.P2WSH,g=d=u.scriptType,m=i}else if(r){if(S(e,p=o.hash160(r)),!(u=w(r,void 0,t)).pubKeys)throw new Error('RedeemScript not supported "'+s.toASM(r)+'"');c=a.types.P2SH,f=a.scriptHash.output.encode(p),b=!0,m=r,v=(g=l=u.scriptType)===a.types.P2WPKH}else if(i){if(function(e,t){if(e.prevOutType){if(e.prevOutType!==h.P2WSH)throw new Error("PrevOutScript must be P2WSH");if(!s.decompile(e.prevOutScript)[1].equals(t))throw new Error("Inconsistent sha25(WitnessScript)")}}(e,y=o.sha256(i)),!(u=w(i,void 0,t)).pubKeys)throw new Error('WitnessScript not supported "'+s.toASM(r)+'"');c=a.types.P2WSH,f=a.witnessScriptHash.output.encode(y),v=_=!0,g=d=u.scriptType,m=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=w(e.prevOutScript,e.prevOutType,t)).pubKeys)return;v=e.prevOutType===h.P2WPKH,g=c,m=f}else u=w(f=a.pubKeyHash.output.encode(o.hash160(t)),h.P2PKH,t),v=!1,g=c=h.P2PKH,m=f;g===h.P2WPKH&&(m=a.pubKeyHash.output.encode(a.witnessPubKeyHash.output.decode(m))),b&&(e.redeemScript=r,e.redeemScriptType=l),_&&(e.witnessScript=i,e.witnessScriptType=d),e.pubKeys=u.pubKeys,e.signatures=u.signatures,e.signScript=m,e.signType=g,e.prevOutScript=f,e.prevOutType=c,e.witness=v}function E(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 A(e,t){this.prevTxMap={},this.network=e||u.bitcoin,this.maximumFeeRate=t||2500,this.inputs=[],this.tx=new m}function x(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 I(e){return e.readUInt8(e.length-1)}A.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},A.prototype.setVersion=function(e){f(l.UInt32,e),this.tx.version=e},A.fromTransaction=function(e,t){var r=new A(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){!function(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,s=y.fromPublicKeyBuffer(i);return n.some(function(i,a){if(!i)return!1;var u=g.parseScriptSignature(i),c=t.hashForSignature(r,e.redeemScript,u.hashType);return!!s.verify(c,u.signature)&&(n[a]=void 0,o=i,!0)}),o})}}(t,e,r)}),r},A.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})},A.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=_(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=w(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},A.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)},A.prototype.build=function(){return this.__build(!1)},A.prototype.buildIncomplete=function(){return this.__build(!0)},A.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){if(!(r.witnessScriptType||r.redeemScriptType||r.prevOutType||e))throw new Error("Transaction is not complete");var i=function(e,t){var r=e.prevOutType,n=[],i=[];b(r)&&(n=E(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=E(e.redeemScriptType,e.signatures,e.pubKeys,t)),e.redeemScriptType&&(o=!0,r=e.redeemScriptType)}switch(r){case a.types.P2WPKH:i=E(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=E(e.witnessScriptType,e.signatures,e.pubKeys,t)).push(e.witnessScript),r=e.witnessScriptType)}return o&&n.push(e.redeemScript),{type:r,script:s.compile(n),witness:i}}(r,e);if(!e&&!b(i.type)&&i.type!==a.types.P2WPKH)throw new Error(i.type+" not supported");t.setInputScript(n,i.script),t.setWitness(n,i.witness)}),!e&&this.__overMaximumFees(t.virtualSize()))throw new Error("Transaction has absurd fees");return t},A.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,c=t.publicKey||t.getPublicKeyBuffer();if(!x(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(x(a)||k(a,c,r,0,s),!x(a))throw Error(a.prevOutType+" not supported")}if(u=a.witness?this.tx.hashForWitnessV0(e,a.signScript,a.value,i):this.tx.hashForSignature(e,a.signScript,i),!a.pubKeys.some(function(e,r){if(!c.equals(e))return!1;if(a.signatures[r])throw new Error("Signature already exists");if(33!==c.length&&a.signType===h.P2WPKH)throw new Error("BIP143 rejects uncompressed public keys in P2WPKH or P2WSH");var o=t.sign(u);return n.isBuffer(o)&&(o=g.fromRSBuffer(o)),a.signatures[r]=o.toScriptSignature(i),!0}))throw new Error("Key pair cannot sign for this input")},A.prototype.__canModifyInputs=function(){return this.inputs.every(function(e){return void 0===e.signatures||e.signatures.every(function(e){return!e||I(e)&m.SIGHASH_ANYONECANPAY})})},A.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=31&I(r);return n===m.SIGHASH_NONE||(n===m.SIGHASH_SINGLE?e<=t:void 0)})})},A.prototype.__overMaximumFees=function(e){return(this.inputs.reduce(function(e,t){return e+(t.value>>>0)},0)-this.tx.outs.reduce(function(e,t){return e+t.value},0))/e>this.maximumFeeRate},e.exports=A},function(e,t,r){const n=r(173),i=r(126),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(819)(r(822))},function(e,t,r){"use strict";var n=r(820),i=r(821);e.exports=function(e){var t=n(e),r=i(e);return function(e,n){switch("string"==typeof e?e.toLowerCase():e){case"keccak224":return new t(1152,448,null,224,n);case"keccak256":return new t(1088,512,null,256,n);case"keccak384":return new t(832,768,null,384,n);case"keccak512":return new t(576,1024,null,512,n);case"sha3-224":return new t(1152,448,6,224,n);case"sha3-256":return new t(1088,512,6,256,n);case"sha3-384":return new t(832,768,6,384,n);case"sha3-512":return new t(576,1024,6,512,n);case"shake128":return new r(1344,256,31,n);case"shake256":return new r(1088,512,31,n);default:throw new Error("Invald algorithm: "+e)}}}},function(e,t,r){"use strict";var n=r(2).Buffer,i=r(90).Transform,o=r(5);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(90).Transform,o=r(5);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(823);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,K=e[5]^d,j=e[14]^p,M=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=K<<30|L>>>2,Oe=L<<30|K>>>2,Re=j<<6|M>>>26,Ne=M<<6|j>>>26,Le=U<<11|D>>>21,Ke=D<<11|U>>>21,je=F<<15|q>>>17,Me=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&Ke,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^~Ke&$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&je,e[33]=de^~xe&Me,e[42]=He^~tt&me,e[43]=ze^~rt&be,e[4]=Le^~We&ot,e[5]=Ke^~$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^~je&Ye,e[35]=xe^~Me&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]=je^~Ye&Xe,e[37]=Me^~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(417)(r(827))},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(230),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])&&!(t<(r+=1)+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(!(t<(r+=n)+i||t<r+3||2!==e[r]||1!==e[r+1]||1!==e[r+2]||t<(r+=3)+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)>i)&&2===e[o++]){var a=e[o++];if(128&a){if(o+(s=a-128)>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(o+(s=c-128)>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(123),o=r(53),s=r(54).ec,a=r(245),u=new s("secp256k1"),c=u.curve;function f(e){var t=e[0];switch(t){case 2:case 3:return 33!==e.length?null:function(e,t){var r=new o(t);if(r.cmp(c.p)>=0)return null;var n=(r=r.toRed(c.red)).redSqr().redIMul(r).redIAdd(c.b).redSqrt();return 3===e!==n.isOdd()&&(n=n.redNeg()),u.keyPair({pub:{x:r,y:n}})}(t,e.slice(1,33));case 4:case 6:case 7:return 65!==e.length?null:function(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}(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=f(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!==f(e)},t.publicKeyTweakAdd=function(e,t,r){var i=f(e);if(null===i)throw new Error(a.EC_PUBLIC_KEY_PARSE_FAIL);if((t=new o(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=f(e);if(null===i)throw new Error(a.EC_PUBLIC_KEY_PARSE_FAIL);if((t=new o(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]=f(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 l=f(r);if(null===l)throw new Error(a.EC_PUBLIC_KEY_PARSE_FAIL);return u.verify(e,n,{x:l.pub.x,y:l.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=f(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.0",_inBundle:!1,_integrity:"sha1-ysmvh2LIWDYYcAPI3+GT5eLq5d8=",_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.0.tgz",_shasum:"cac9af8762c85836187003c8dfe193e5e2eae5df",_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.0"}},function(e,t,r){"use strict";var n=t,i=r(53),o=r(81),s=r(418);n.assert=o,n.toArray=s.toArray,n.zero2=s.zero2,n.toHex=s.toHex,n.encode=s.encode,n.getNAF=function(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},n.getJSF=function(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,s,a,u=e.andln(3)+n&3,c=t.andln(3)+i&3;3===u&&(u=-1),3===c&&(c=-1),o=0==(1&u)?0:3!=(a=e.andln(7)+n&7)&&5!==a||2!==c?u:-u,r[0].push(o),s=0==(1&c)?0:3!=(a=t.andln(7)+i&7)&&5!==a||2!==u?c:-c,r[1].push(s),2*n===o+1&&(n=1-n),2*i===s+1&&(i=1-i),e.iushrn(1),t.iushrn(1)}return r},n.cachedProperty=function(e,t,r){var n="_"+t;e.prototype[t]=function(){return void 0!==this[n]?this[n]:this[n]=r.call(this)}},n.parseBytes=function(e){return"string"==typeof e?n.toArray(e,"hex"):e},n.intFromLE=function(e){return new i(e,"hex","le")}},function(e,t,r){var n;function i(e){this.rand=e}if(e.exports=function(e){return n||(n=new i(null)),n.generate(e)},e.exports.Rand=i,i.prototype.generate=function(e){return this._rand(e)},i.prototype._rand=function(e){if(this.rand.getBytes)return this.rand.getBytes(e);for(var t=new Uint8Array(e),r=0;r<t.length;r++)t[r]=this.rand.getByte();return t},"object"==typeof self)self.crypto&&self.crypto.getRandomValues?i.prototype._rand=function(e){var t=new Uint8Array(e);return self.crypto.getRandomValues(t),t}:self.msCrypto&&self.msCrypto.getRandomValues?i.prototype._rand=function(e){var t=new Uint8Array(e);return self.msCrypto.getRandomValues(t),t}:"object"==typeof window&&(i.prototype._rand=function(){throw new Error("Not implemented yet")});else try{var o=r(832);if("function"!=typeof o.randomBytes)throw new Error("Not supported");i.prototype._rand=function(e){return o.randomBytes(e)}}catch(e){}},function(e,t){},function(e,t,r){"use strict";var n=r(53),i=r(54).utils,o=i.getNAF,s=i.getJSF,a=i.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);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 c(e,t){this.curve=e,this.type=t,this.precomputed=null}e.exports=u,u.prototype.point=function(){throw new Error("Not implemented")},u.prototype.validate=function(){throw new Error("Not implemented")},u.prototype._fixedNafMul=function(e,t){a(e.precomputed);var r=e._getDoubles(),n=o(t,1),i=(1<<r.step+1)-(r.step%2==0?2:1);i/=3;for(var s=[],u=0;u<n.length;u+=r.step){var c=0;for(t=u+r.step-1;t>=u;t--)c=(c<<1)+n[t];s.push(c)}for(var f=this.jpoint(null,null,null),l=this.jpoint(null,null,null),h=i;h>0;h--){for(u=0;u<s.length;u++){(c=s[u])===h?l=l.mixedAdd(r.points[u]):c===-h&&(l=l.mixedAdd(r.points[u].neg()))}f=f.add(l)}return f.toP()},u.prototype._wnafMul=function(e,t){var r=4,n=e._getNAFPoints(r);r=n.wnd;for(var i=n.points,s=o(t,r),u=this.jpoint(null,null,null),c=s.length-1;c>=0;c--){for(t=0;c>=0&&0===s[c];c--)t++;if(c>=0&&t++,u=u.dblp(t),c<0)break;var f=s[c];a(0!==f),u="affine"===e.type?f>0?u.mixedAdd(i[f-1>>1]):u.mixedAdd(i[-f-1>>1].neg()):f>0?u.add(i[f-1>>1]):u.add(i[-f-1>>1].neg())}return"affine"===e.type?u.toP():u},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<n;l++){var h=(A=t[l])._getNAFPoints(e);a[l]=h.wnd,u[l]=h.points}for(l=n-1;l>=1;l-=2){var p=l-1,d=l;if(1===a[p]&&1===a[d]){var y=[t[p],null,null,t[d]];0===t[p].y.cmp(t[d].y)?(y[1]=t[p].add(t[d]),y[2]=t[p].toJ().mixedAdd(t[d].neg())):0===t[p].y.cmp(t[d].y.redNeg())?(y[1]=t[p].toJ().mixedAdd(t[d]),y[2]=t[p].add(t[d].neg())):(y[1]=t[p].toJ().mixedAdd(t[d]),y[2]=t[p].toJ().mixedAdd(t[d].neg()));var g=[-3,-1,-5,-7,0,7,5,1,3],m=s(r[p],r[d]);f=Math.max(m[0].length,f),c[p]=new Array(f),c[d]=new Array(f);for(var b=0;b<f;b++){var v=0|m[0][b],_=0|m[1][b];c[p][b]=g[3*(v+1)+(_+1)],c[d][b]=0,u[p]=y}}else c[p]=o(r[p],a[p]),c[d]=o(r[d],a[d]),f=Math.max(c[p].length,f),f=Math.max(c[d].length,f)}var w=this.jpoint(null,null,null),S=this._wnafT4;for(l=f;l>=0;l--){for(var k=0;l>=0;){var E=!0;for(b=0;b<n;b++)S[b]=0|c[b][l],0!==S[b]&&(E=!1);if(!E)break;k++,l--}if(l>=0&&k++,w=w.dblp(k),l<0)break;for(b=0;b<n;b++){var A,x=S[b];0!==x&&(x>0?A=u[b][x-1>>1]:x<0&&(A=u[b][-x-1>>1].neg()),w="affine"===A.type?w.mixedAdd(A):w.add(A))}}for(l=0;l<n;l++)u[l]=null;return i?w:w.toP()},u.BasePoint=c,c.prototype.eq=function(){throw new Error("Not implemented")},c.prototype.validate=function(){return this.curve.validate(this)},u.prototype.decodePoint=function(e,t){e=i.toArray(e,t);var r=this.p.byteLength();if((4===e[0]||6===e[0]||7===e[0])&&e.length-1==2*r)return 6===e[0]?a(e[e.length-1]%2==0):7===e[0]&&a(e[e.length-1]%2==1),this.point(e.slice(1,1+r),e.slice(1+r,1+2*r));if((2===e[0]||3===e[0])&&e.length-1===r)return this.pointFromX(e.slice(1,1+r),3===e[0]);throw new Error("Unknown point format")},c.prototype.encodeCompressed=function(e){return this.encode(e,!0)},c.prototype._encode=function(e){var t=this.curve.p.byteLength(),r=this.getX().toArray("be",t);return e?[this.getY().isEven()?2:3].concat(r):[4].concat(r,this.getY().toArray("be",t))},c.prototype.encode=function(e,t){return i.encode(this._encode(t),e)},c.prototype.precompute=function(e){if(this.precomputed)return this;var t={doubles:null,naf:null,beta:null};return t.naf=this._getNAFPoints(8),t.doubles=this._getDoubles(4,e),t.beta=this._getBeta(),this.precomputed=t,this},c.prototype._hasDoubles=function(e){if(!this.precomputed)return!1;var t=this.precomputed.doubles;return!!t&&t.points.length>=Math.ceil((e.bitLength()+1)/t.step)},c.prototype._getDoubles=function(e,t){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var r=[this],n=this,i=0;i<t;i+=e){for(var o=0;o<e;o++)n=n.dbl();r.push(n)}return{step:e,points:r}},c.prototype._getNAFPoints=function(e){if(this.precomputed&&this.precomputed.naf)return this.precomputed.naf;for(var t=[this],r=(1<<e)-1,n=1===r?null:this.dbl(),i=1;i<r;i++)t[i]=t[i-1].add(n);return{wnd:e,points:t}},c.prototype._getBeta=function(){return null},c.prototype.dblp=function(e){for(var t=this,r=0;r<e;r++)t=t.dbl();return t}},function(e,t,r){"use strict";var n=r(174),i=r(54),o=r(53),s=r(5),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){if(this.zeroA&&this.g&&this.n&&1===this.p.modn(3)){var t,r;if(e.beta)t=new o(e.beta,16).toRed(this.red);else{var n=this._getEndoRoots(this.p);t=(t=n[0].cmp(n[1])<0?n[0]:n[1]).toRed(this.red)}if(e.lambda)r=new o(e.lambda,16);else{var i=this._getEndoRoots(this.n);0===this.g.mul(i[0]).x.cmp(this.g.x.redMul(t))?r=i[0]:(r=i[1],u(0===this.g.mul(r).x.cmp(this.g.x.redMul(t))))}return{beta:t,lambda:r,basis:e.basis?e.basis.map(function(e){return{a:new o(e.a,16),b:new o(e.b,16)}}):this._getEndoBasis(r)}}},c.prototype._getEndoRoots=function(e){var t=e===this.p?this.red:o.mont(e),r=new o(2).toRed(t).redInvm(),n=r.redNeg(),i=new o(3).toRed(t).redNeg().redSqrt().redMul(r);return[n.redAdd(i).fromRed(),n.redSub(i).fromRed()]},c.prototype._getEndoBasis=function(e){for(var t,r,n,i,s,a,u,c,f,l=this.n.ushrn(Math.floor(this.n.bitLength()/2)),h=e,p=this.n.clone(),d=new o(1),y=new o(0),g=new o(0),m=new o(1),b=0;0!==h.cmpn(0);){var v=p.div(h);c=p.sub(v.mul(h)),f=g.sub(v.mul(d));var _=m.sub(v.mul(y));if(!n&&c.cmp(l)<0)t=u.neg(),r=d,n=c.neg(),i=f;else if(n&&2==++b)break;u=c,p=h,h=c,g=d,d=f,m=y,y=_}s=c.neg(),a=f;var w=n.sqr().add(i.sqr());return s.sqr().add(a.sqr()).cmp(w)>=0&&(s=t,a=r),n.negative&&(n=n.neg(),i=i.neg()),s.negative&&(s=s.neg(),a=a.neg()),[{a:n,b:i},{a:s,b:a}]},c.prototype._endoSplit=function(e){var t=this.endo.basis,r=t[0],n=t[1],i=n.b.mul(e).divRound(this.n),o=r.b.neg().mul(e).divRound(this.n),s=i.mul(r.a),a=o.mul(n.a),u=i.mul(r.b),c=o.mul(n.b);return{k1:e.sub(s).sub(a),k2:u.add(c).neg()}},c.prototype.pointFromX=function(e,t){(e=new o(e,16)).red||(e=e.toRed(this.red));var r=e.redSqr().redMul(e).redIAdd(e.redMul(this.a)).redIAdd(this.b),n=r.redSqrt();if(0!==n.redSqr().redSub(r).cmp(this.zero))throw new Error("invalid point");var i=n.fromRed().isOdd();return(t&&!i||!t&&i)&&(n=n.redNeg()),this.point(e,n)},c.prototype.validate=function(e){if(e.inf)return!0;var t=e.x,r=e.y,n=this.a.redMul(t),i=t.redSqr().redMul(t).redIAdd(n).redIAdd(this.b);return 0===r.redSqr().redISub(i).cmpn(0)},c.prototype._endoWnafMulAdd=function(e,t,r){for(var n=this._endoWnafT1,i=this._endoWnafT2,o=0;o<e.length;o++){var s=this._endoSplit(t[o]),a=e[o],u=a._getBeta();s.k1.negative&&(s.k1.ineg(),a=a.neg(!0)),s.k2.negative&&(s.k2.ineg(),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,r),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){return new f(this,e,t,r)},c.prototype.pointFromJSON=function(e,t){return f.fromJSON(this,e,t)},f.prototype._getBeta=function(){if(this.curve.endo){var e=this.precomputed;if(e&&e.beta)return e.beta;var t=this.curve.point(this.x.redMul(this.curve.endo.beta),this.y);if(e){var r=this.curve,n=function(e){return r.point(e.x.redMul(r.endo.beta),e.y)};e.beta=t,t.precomputed={beta:null,naf:e.naf&&{wnd:e.naf.wnd,points:e.naf.points.map(n)},doubles:e.doubles&&{step:e.doubles.step,points:e.doubles.points.map(n)}}}return t}},f.prototype.toJSON=function(){return this.precomputed?[this.x,this.y,this.precomputed&&{doubles:this.precomputed.doubles&&{step:this.precomputed.doubles.step,points:this.precomputed.doubles.points.slice(1)},naf:this.precomputed.naf&&{wnd:this.precomputed.naf.wnd,points:this.precomputed.naf.points.slice(1)}}]:[this.x,this.y]},f.fromJSON=function(e,t,r){"string"==typeof t&&(t=JSON.parse(t));var n=e.point(t[0],t[1],r);if(!t[2])return n;function i(t){return e.point(t[0],t[1],r)}var o=t[2];return n.precomputed={beta:null,doubles:o.doubles&&{step:o.doubles.step,points:[n].concat(o.doubles.points.map(i))},naf:o.naf&&{wnd:o.naf.wnd,points:[n].concat(o.naf.points.map(i))}},n},f.prototype.inspect=function(){return this.isInfinity()?"<EC Point Infinity>":"<EC Point x: "+this.x.fromRed().toString(16,2)+" y: "+this.y.fromRed().toString(16,2)+">"},f.prototype.isInfinity=function(){return this.inf},f.prototype.add=function(e){if(this.inf)return e;if(e.inf)return this;if(this.eq(e))return this.dbl();if(this.neg().eq(e))return this.curve.point(null,null);if(0===this.x.cmp(e.x))return this.curve.point(null,null);var t=this.y.redSub(e.y);0!==t.cmpn(0)&&(t=t.redMul(this.x.redSub(e.x).redInvm()));var r=t.redSqr().redISub(this.x).redISub(e.x),n=t.redMul(this.x.redSub(r)).redISub(this.y);return this.curve.point(r,n)},f.prototype.dbl=function(){if(this.inf)return this;var e=this.y.redAdd(this.y);if(0===e.cmpn(0))return this.curve.point(null,null);var t=this.curve.a,r=this.x.redSqr(),n=e.redInvm(),i=r.redAdd(r).redIAdd(r).redIAdd(t).redMul(n),o=i.redSqr().redISub(this.x.redAdd(this.x)),s=i.redMul(this.x.redSub(o)).redISub(this.y);return this.curve.point(o,s)},f.prototype.getX=function(){return this.x.fromRed()},f.prototype.getY=function(){return this.y.fromRed()},f.prototype.mul=function(e){return e=new o(e,16),this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve.endo?this.curve._endoWnafMulAdd([this],[e]):this.curve._wnafMul(this,e)},f.prototype.mulAdd=function(e,t,r){var n=[this,t],i=[e,r];return this.curve.endo?this.curve._endoWnafMulAdd(n,i):this.curve._wnafMulAdd(1,n,i,2)},f.prototype.jmulAdd=function(e,t,r){var n=[this,t],i=[e,r];return this.curve.endo?this.curve._endoWnafMulAdd(n,i,!0):this.curve._wnafMulAdd(1,n,i,2,!0)},f.prototype.eq=function(e){return this===e||this.inf===e.inf&&(this.inf||0===this.x.cmp(e.x)&&0===this.y.cmp(e.y))},f.prototype.neg=function(e){if(this.inf)return this;var t=this.curve.point(this.x,this.y.redNeg());if(e&&this.precomputed){var r=this.precomputed,n=function(e){return e.neg()};t.precomputed={naf:r.naf&&{wnd:r.naf.wnd,points:r.naf.points.map(n)},doubles:r.doubles&&{step:r.doubles.step,points:r.doubles.points.map(n)}}}return t},f.prototype.toJ=function(){return this.inf?this.curve.jpoint(null,null,null):this.curve.jpoint(this.x,this.y,this.curve.one)},s(l,a.BasePoint),c.prototype.jpoint=function(e,t,r){return new l(this,e,t,r)},l.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var e=this.z.redInvm(),t=e.redSqr(),r=this.x.redMul(t),n=this.y.redMul(t).redMul(e);return this.curve.point(r,n)},l.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},l.prototype.add=function(e){if(this.isInfinity())return e;if(e.isInfinity())return this;var t=e.z.redSqr(),r=this.z.redSqr(),n=this.x.redMul(t),i=e.x.redMul(r),o=this.y.redMul(t.redMul(e.z)),s=e.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(e.z).redMul(a);return this.curve.jpoint(h,p,d)},l.prototype.mixedAdd=function(e){if(this.isInfinity())return e.toJ();if(e.isInfinity())return this;var t=this.z.redSqr(),r=this.x,n=e.x.redMul(t),i=this.y,o=e.y.redMul(t).redMul(this.z),s=r.redSub(n),a=i.redSub(o);if(0===s.cmpn(0))return 0!==a.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var u=s.redSqr(),c=u.redMul(s),f=r.redMul(u),l=a.redSqr().redIAdd(c).redISub(f).redISub(f),h=a.redMul(f.redISub(l)).redISub(i.redMul(c)),p=this.z.redMul(s);return this.curve.jpoint(l,h,p)},l.prototype.dblp=function(e){if(0===e)return this;if(this.isInfinity())return this;if(!e)return this.dbl();if(this.curve.zeroA||this.curve.threeA){for(var t=this,r=0;r<e;r++)t=t.dbl();return t}var n=this.curve.a,i=this.curve.tinv,o=this.x,s=this.y,a=this.z,u=a.redSqr().redSqr(),c=s.redAdd(s);for(r=0;r<e;r++){var f=o.redSqr(),l=c.redSqr(),h=l.redSqr(),p=f.redAdd(f).redIAdd(f).redIAdd(n.redMul(u)),d=o.redMul(l),y=p.redSqr().redISub(d.redAdd(d)),g=d.redISub(y),m=p.redMul(g);m=m.redIAdd(m).redISub(h);var b=c.redMul(a);r+1<e&&(u=u.redMul(h)),o=y,a=b,c=m}return this.curve.jpoint(o,c.redMul(i),a)},l.prototype.dbl=function(){return this.isInfinity()?this:this.curve.zeroA?this._zeroDbl():this.curve.threeA?this._threeDbl():this._dbl()},l.prototype._zeroDbl=function(){var e,t,r;if(this.zOne){var n=this.x.redSqr(),i=this.y.redSqr(),o=i.redSqr(),s=this.x.redAdd(i).redSqr().redISub(n).redISub(o);s=s.redIAdd(s);var a=n.redAdd(n).redIAdd(n),u=a.redSqr().redISub(s).redISub(s),c=o.redIAdd(o);c=(c=c.redIAdd(c)).redIAdd(c),e=u,t=a.redMul(s.redISub(u)).redISub(c),r=this.y.redAdd(this.y)}else{var f=this.x.redSqr(),l=this.y.redSqr(),h=l.redSqr(),p=this.x.redAdd(l).redSqr().redISub(f).redISub(h);p=p.redIAdd(p);var d=f.redAdd(f).redIAdd(f),y=d.redSqr(),g=h.redIAdd(h);g=(g=g.redIAdd(g)).redIAdd(g),e=y.redISub(p).redISub(p),t=d.redMul(p.redISub(e)).redISub(g),r=(r=this.y.redMul(this.z)).redIAdd(r)}return this.curve.jpoint(e,t,r)},l.prototype._threeDbl=function(){var e,t,r;if(this.zOne){var n=this.x.redSqr(),i=this.y.redSqr(),o=i.redSqr(),s=this.x.redAdd(i).redSqr().redISub(n).redISub(o);s=s.redIAdd(s);var a=n.redAdd(n).redIAdd(n).redIAdd(this.curve.a),u=a.redSqr().redISub(s).redISub(s);e=u;var c=o.redIAdd(o);c=(c=c.redIAdd(c)).redIAdd(c),t=a.redMul(s.redISub(u)).redISub(c),r=this.y.redAdd(this.y)}else{var f=this.z.redSqr(),l=this.y.redSqr(),h=this.x.redMul(l),p=this.x.redSub(f).redMul(this.x.redAdd(f));p=p.redAdd(p).redIAdd(p);var d=h.redIAdd(h),y=(d=d.redIAdd(d)).redAdd(d);e=p.redSqr().redISub(y),r=this.y.redAdd(this.z).redSqr().redISub(l).redISub(f);var g=l.redSqr();g=(g=(g=g.redIAdd(g)).redIAdd(g)).redIAdd(g),t=p.redMul(d.redISub(e)).redISub(g)}return this.curve.jpoint(e,t,r)},l.prototype._dbl=function(){var e=this.curve.a,t=this.x,r=this.y,n=this.z,i=n.redSqr().redSqr(),o=t.redSqr(),s=r.redSqr(),a=o.redAdd(o).redIAdd(o).redIAdd(e.redMul(i)),u=t.redAdd(t),c=(u=u.redIAdd(u)).redMul(s),f=a.redSqr().redISub(c.redAdd(c)),l=c.redISub(f),h=s.redSqr();h=(h=(h=h.redIAdd(h)).redIAdd(h)).redIAdd(h);var p=a.redMul(l).redISub(h),d=r.redAdd(r).redMul(n);return this.curve.jpoint(f,p,d)},l.prototype.trpl=function(){if(!this.curve.zeroA)return this.dbl().add(this);var e=this.x.redSqr(),t=this.y.redSqr(),r=this.z.redSqr(),n=t.redSqr(),i=e.redAdd(e).redIAdd(e),o=i.redSqr(),s=this.x.redAdd(t).redSqr().redISub(e).redISub(n),a=(s=(s=(s=s.redIAdd(s)).redAdd(s).redIAdd(s)).redISub(o)).redSqr(),u=n.redIAdd(n);u=(u=(u=u.redIAdd(u)).redIAdd(u)).redIAdd(u);var c=i.redIAdd(s).redSqr().redISub(o).redISub(a).redISub(u),f=t.redMul(c);f=(f=f.redIAdd(f)).redIAdd(f);var l=this.x.redMul(a).redISub(f);l=(l=l.redIAdd(l)).redIAdd(l);var h=this.y.redMul(c.redMul(u.redISub(c)).redISub(s.redMul(a)));h=(h=(h=h.redIAdd(h)).redIAdd(h)).redIAdd(h);var p=this.z.redAdd(s).redSqr().redISub(r).redISub(a);return this.curve.jpoint(l,h,p)},l.prototype.mul=function(e,t){return e=new o(e,t),this.curve._wnafMul(this,e)},l.prototype.eq=function(e){if("affine"===e.type)return this.eq(e.toJ());if(this===e)return!0;var t=this.z.redSqr(),r=e.z.redSqr();if(0!==this.x.redMul(r).redISub(e.x.redMul(t)).cmpn(0))return!1;var n=t.redMul(this.z),i=r.redMul(e.z);return 0===this.y.redMul(i).redISub(e.y.redMul(n)).cmpn(0)},l.prototype.eqXToP=function(e){var t=this.z.redSqr(),r=e.toRed(this.curve.red).redMul(t);if(0===this.x.cmp(r))return!0;for(var n=e.clone(),i=this.curve.redN.redMul(t);;){if(n.iadd(this.curve.n),n.cmp(this.curve.p)>=0)return!1;if(r.redIAdd(i),0===this.x.cmp(r))return!0}return!1},l.prototype.inspect=function(){return this.isInfinity()?"<EC JPoint Infinity>":"<EC JPoint x: "+this.x.toString(16,2)+" y: "+this.y.toString(16,2)+" z: "+this.z.toString(16,2)+">"},l.prototype.isInfinity=function(){return 0===this.z.cmpn(0)}},function(e,t,r){"use strict";var n=r(174),i=r(53),o=r(5),s=n.base,a=r(54).utils;function u(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 c(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(u,s),e.exports=u,u.prototype.validate=function(e){var t=e.normalize().x,r=t.redSqr(),n=r.redMul(t).redAdd(r.redMul(this.a)).redAdd(t);return 0===n.redSqrt().redSqr().cmp(n)},o(c,s.BasePoint),u.prototype.decodePoint=function(e,t){return this.point(a.toArray(e,t),1)},u.prototype.point=function(e,t){return new c(this,e,t)},u.prototype.pointFromJSON=function(e){return c.fromJSON(this,e)},c.prototype.precompute=function(){},c.prototype._encode=function(){return this.getX().toArray("be",this.curve.p.byteLength())},c.fromJSON=function(e,t){return new c(e,t[0],t[1]||e.one)},c.prototype.inspect=function(){return this.isInfinity()?"<EC Point Infinity>":"<EC Point x: "+this.x.fromRed().toString(16,2)+" z: "+this.z.fromRed().toString(16,2)+">"},c.prototype.isInfinity=function(){return 0===this.z.cmpn(0)},c.prototype.dbl=function(){var e=this.x.redAdd(this.z).redSqr(),t=this.x.redSub(this.z).redSqr(),r=e.redSub(t),n=e.redMul(t),i=r.redMul(t.redAdd(this.curve.a24.redMul(r)));return this.curve.point(n,i)},c.prototype.add=function(){throw new Error("Not supported on Montgomery curve")},c.prototype.diffAdd=function(e,t){var r=this.x.redAdd(this.z),n=this.x.redSub(this.z),i=e.x.redAdd(e.z),o=e.x.redSub(e.z).redMul(r),s=i.redMul(n),a=t.z.redMul(o.redAdd(s).redSqr()),u=t.x.redMul(o.redISub(s).redSqr());return this.curve.point(a,u)},c.prototype.mul=function(e){for(var t=e.clone(),r=this,n=this.curve.point(null,null),i=[];0!==t.cmpn(0);t.iushrn(1))i.push(t.andln(1));for(var o=i.length-1;o>=0;o--)0===i[o]?(r=r.diffAdd(n,this),n=n.dbl()):(n=r.diffAdd(n,this),r=r.dbl());return n},c.prototype.mulAdd=function(){throw new Error("Not supported on Montgomery curve")},c.prototype.jumlAdd=function(){throw new Error("Not supported on Montgomery curve")},c.prototype.eq=function(e){return 0===this.getX().cmp(e.getX())},c.prototype.normalize=function(){return this.x=this.x.redMul(this.z.redInvm()),this.z=this.curve.one,this},c.prototype.getX=function(){return this.normalize(),this.x.fromRed()}},function(e,t,r){"use strict";var n=r(174),i=r(54),o=r(53),s=r(5),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){return this.mOneA?e.redNeg():this.a.redMul(e)},c.prototype._mulC=function(e){return this.oneC?e:this.c.redMul(e)},c.prototype.jpoint=function(e,t,r,n){return this.point(e,t,r,n)},c.prototype.pointFromX=function(e,t){(e=new o(e,16)).red||(e=e.toRed(this.red));var r=e.redSqr(),n=this.c2.redSub(this.a.redMul(r)),i=this.one.redSub(this.c2.redMul(this.d).redMul(r)),s=n.redMul(i.redInvm()),a=s.redSqrt();if(0!==a.redSqr().redSub(s).cmp(this.zero))throw new Error("invalid point");var u=a.fromRed().isOdd();return(t&&!u||!t&&u)&&(a=a.redNeg()),this.point(e,a)},c.prototype.pointFromY=function(e,t){(e=new o(e,16)).red||(e=e.toRed(this.red));var r=e.redSqr(),n=r.redSub(this.one),i=r.redMul(this.d).redAdd(this.one),s=n.redMul(i.redInvm());if(0===s.cmp(this.zero)){if(t)throw new Error("invalid point");return this.point(this.zero,e)}var a=s.redSqrt();if(0!==a.redSqr().redSub(s).cmp(this.zero))throw new Error("invalid point");return a.isOdd()!==t&&(a=a.redNeg()),this.point(a,e)},c.prototype.validate=function(e){if(e.isInfinity())return!0;e.normalize();var t=e.x.redSqr(),r=e.y.redSqr(),n=t.redMul(this.a).redAdd(r),i=this.c2.redMul(this.one.redAdd(this.d.redMul(t).redMul(r)));return 0===n.cmp(i)},s(f,a.BasePoint),c.prototype.pointFromJSON=function(e){return f.fromJSON(this,e)},c.prototype.point=function(e,t,r,n){return new f(this,e,t,r,n)},f.fromJSON=function(e,t){return new f(e,t[0],t[1],t[2])},f.prototype.inspect=function(){return this.isInfinity()?"<EC Point Infinity>":"<EC Point x: "+this.x.fromRed().toString(16,2)+" y: "+this.y.fromRed().toString(16,2)+" z: "+this.z.fromRed().toString(16,2)+">"},f.prototype.isInfinity=function(){return 0===this.x.cmpn(0)&&0===this.y.cmp(this.z)},f.prototype._extDbl=function(){var e=this.x.redSqr(),t=this.y.redSqr(),r=this.z.redSqr();r=r.redIAdd(r);var n=this.curve._mulA(e),i=this.x.redAdd(this.y).redSqr().redISub(e).redISub(t),o=n.redAdd(t),s=o.redSub(r),a=n.redSub(t),u=i.redMul(s),c=o.redMul(a),f=i.redMul(a),l=s.redMul(o);return this.curve.point(u,c,l,f)},f.prototype._projDbl=function(){var e,t,r,n=this.x.redAdd(this.y).redSqr(),i=this.x.redSqr(),o=this.y.redSqr();if(this.curve.twisted){var s=(c=this.curve._mulA(i)).redAdd(o);if(this.zOne)e=n.redSub(i).redSub(o).redMul(s.redSub(this.curve.two)),t=s.redMul(c.redSub(o)),r=s.redSqr().redSub(s).redSub(s);else{var a=this.z.redSqr(),u=s.redSub(a).redISub(a);e=n.redSub(i).redISub(o).redMul(u),t=s.redMul(c.redSub(o)),r=s.redMul(u)}}else{var c=i.redAdd(o);a=this.curve._mulC(this.c.redMul(this.z)).redSqr(),u=c.redSub(a).redSub(a);e=this.curve._mulC(n.redISub(c)).redMul(u),t=this.curve._mulC(c).redMul(i.redISub(o)),r=c.redMul(u)}return this.curve.point(e,t,r)},f.prototype.dbl=function(){return this.isInfinity()?this:this.curve.extended?this._extDbl():this._projDbl()},f.prototype._extAdd=function(e){var t=this.y.redSub(this.x).redMul(e.y.redSub(e.x)),r=this.y.redAdd(this.x).redMul(e.y.redAdd(e.x)),n=this.t.redMul(this.curve.dd).redMul(e.t),i=this.z.redMul(e.z.redAdd(e.z)),o=r.redSub(t),s=i.redSub(n),a=i.redAdd(n),u=r.redAdd(t),c=o.redMul(s),f=a.redMul(u),l=o.redMul(u),h=s.redMul(a);return this.curve.point(c,f,h,l)},f.prototype._projAdd=function(e){var t,r,n=this.z.redMul(e.z),i=n.redSqr(),o=this.x.redMul(e.x),s=this.y.redMul(e.y),a=this.curve.d.redMul(o).redMul(s),u=i.redSub(a),c=i.redAdd(a),f=this.x.redAdd(this.y).redMul(e.x.redAdd(e.y)).redISub(o).redISub(s),l=n.redMul(u).redMul(f);return this.curve.twisted?(t=n.redMul(c).redMul(s.redSub(this.curve._mulA(o))),r=u.redMul(c)):(t=n.redMul(c).redMul(s.redSub(o)),r=this.curve._mulC(u).redMul(c)),this.curve.point(l,t,r)},f.prototype.add=function(e){return this.isInfinity()?e:e.isInfinity()?this:this.curve.extended?this._extAdd(e):this._projAdd(e)},f.prototype.mul=function(e){return this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve._wnafMul(this,e)},f.prototype.mulAdd=function(e,t,r){return this.curve._wnafMulAdd(1,[this,t],[e,r],2,!1)},f.prototype.jmulAdd=function(e,t,r){return this.curve._wnafMulAdd(1,[this,t],[e,r],2,!0)},f.prototype.normalize=function(){if(this.zOne)return this;var e=this.z.redInvm();return this.x=this.x.redMul(e),this.y=this.y.redMul(e),this.t&&(this.t=this.t.redMul(e)),this.z=this.curve.one,this.zOne=!0,this},f.prototype.neg=function(){return this.curve.point(this.x.redNeg(),this.y,this.z,this.t&&this.t.redNeg())},f.prototype.getX=function(){return this.normalize(),this.x.fromRed()},f.prototype.getY=function(){return this.normalize(),this.y.fromRed()},f.prototype.eq=function(e){return this===e||0===this.getX().cmp(e.getX())&&0===this.getY().cmp(e.getY())},f.prototype.eqXToP=function(e){var t=e.toRed(this.curve.red).redMul(this.z);if(0===this.x.cmp(t))return!0;for(var r=e.clone(),n=this.curve.redN.redMul(this.z);;){if(r.iadd(this.curve.n),r.cmp(this.curve.p)>=0)return!1;if(t.redIAdd(n),0===this.x.cmp(t))return!0}return!1},f.prototype.toP=f.prototype.normalize,f.prototype.mixedAdd=f.prototype.add},function(e,t,r){"use strict";var n,i=t,o=r(246),s=r(54),a=s.utils.assert;function u(e){"short"===e.type?this.curve=new s.curve.short(e):"edwards"===e.type?this.curve=new s.curve.edwards(e):this.curve=new s.curve.mont(e),this.g=this.curve.g,this.n=this.curve.n,this.hash=e.hash,a(this.g.validate(),"Invalid curve"),a(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}function c(e,t){Object.defineProperty(i,e,{configurable:!0,enumerable:!0,get:function(){var r=new u(t);return Object.defineProperty(i,e,{configurable:!0,enumerable:!0,value:r}),r}})}i.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:o.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:o.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:o.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:o.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:o.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:o.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:o.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});try{n=r(844)}catch(e){n=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:o.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",n]})},function(e,t,r){"use strict";t.sha1=r(839),t.sha224=r(840),t.sha256=r(420),t.sha384=r(841),t.sha512=r(421)},function(e,t,r){"use strict";var n=r(71),i=r(125),o=r(419),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){for(var r=this.W,n=0;n<16;n++)r[n]=e[t+n];for(;n<r.length;n++)r[n]=s(r[n-3]^r[n-8]^r[n-14]^r[n-16],1);var i=this.h[0],o=this.h[1],f=this.h[2],h=this.h[3],p=this.h[4];for(n=0;n<r.length;n++){var d=~~(n/20),y=u(s(i,5),c(d,o,f,h),p,r[n],l[d]);p=h,h=f,f=s(o,30),o=i,i=y}this.h[0]=a(this.h[0],i),this.h[1]=a(this.h[1],o),this.h[2]=a(this.h[2],f),this.h[3]=a(this.h[3],h),this.h[4]=a(this.h[4],p)},h.prototype._digest=function(e){return"hex"===e?n.toHex32(this.h,"big"):n.split32(this.h,"big")}},function(e,t,r){"use strict";var n=r(71),i=r(420);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){return"hex"===e?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(71),i=r(421);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){return"hex"===e?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(71),i=r(125),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){for(var r=this.h[0],n=this.h[1],i=this.h[2],c=this.h[3],f=this.h[4],b=r,v=n,_=i,w=c,S=f,k=0;k<80;k++){var E=s(o(u(r,l(k,n,i,c),e[d[k]+t],h(k)),g[k]),f);r=f,f=c,c=o(i,10),i=n,n=E,E=s(o(u(b,l(79-k,v,_,w),e[y[k]+t],p(k)),m[k]),S),b=S,S=w,w=o(_,10),_=v,v=E}E=a(this.h[1],i,w),this.h[1]=a(this.h[2],c,S),this.h[2]=a(this.h[3],f,b),this.h[3]=a(this.h[4],r,v),this.h[4]=a(this.h[0],n,_),this.h[0]=E},f.prototype._digest=function(e){return"hex"===e?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(71),i=r(81);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){e.length>this.blockSize&&(e=(new this.Hash).update(e).digest()),i(e.length<=this.blockSize);for(var t=e.length;t<this.blockSize;t++)e.push(0);for(t=0;t<e.length;t++)e[t]^=54;for(this.inner=(new this.Hash).update(e),t=0;t<e.length;t++)e[t]^=106;this.outer=(new this.Hash).update(e)},o.prototype.update=function(e,t){return this.inner.update(e,t),this},o.prototype.digest=function(e){return this.outer.update(this.inner.digest()),this.outer.digest(e)}},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(53),i=r(846),o=r(54),s=o.utils.assert,a=r(847),u=r(848);function c(e){if(!(this instanceof c))return new c(e);"string"==typeof e&&(s(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=c,c.prototype.keyPair=function(e){return new a(this,e)},c.prototype.keyFromPrivate=function(e,t){return a.fromPrivate(this,e,t)},c.prototype.keyFromPublic=function(e,t){return a.fromPublic(this,e,t)},c.prototype.genKeyPair=function(e){e||(e={});for(var t=new i({hash:this.hash,pers:e.pers,persEnc:e.persEnc||"utf8",entropy:e.entropy||o.rand(this.hash.hmacStrength),entropyEnc:e.entropy&&e.entropyEnc||"utf8",nonce:this.n.toArray()}),r=this.n.byteLength(),s=this.n.sub(new n(2));;){var a=new n(t.generate(r));if(!(a.cmp(s)>0))return a.iaddn(1),this.keyFromPrivate(a)}},c.prototype._truncateToN=function(e,t){var r=8*e.byteLength()-this.n.bitLength();return r>0&&(e=e.ushrn(r)),!t&&e.cmp(this.n)>=0?e.sub(this.n):e},c.prototype.sign=function(e,t,r,o){"object"==typeof r&&(o=r,r=null),o||(o={}),t=this.keyFromPrivate(t,r),e=this._truncateToN(new n(e,16));for(var s=this.n.byteLength(),a=t.getPrivate().toArray("be",s),c=e.toArray("be",s),f=new i({hash:this.hash,entropy:a,nonce:c,pers:o.pers,persEnc:o.persEnc||"utf8"}),l=this.n.sub(new n(1)),h=0;;h++){var p=o.k?o.k(h):new n(f.generate(this.n.byteLength()));if(!((p=this._truncateToN(p,!0)).cmpn(1)<=0||p.cmp(l)>=0)){var d=this.g.mul(p);if(!d.isInfinity()){var y=d.getX(),g=y.umod(this.n);if(0!==g.cmpn(0)){var m=p.invm(this.n).mul(g.mul(t.getPrivate()).iadd(e));if(0!==(m=m.umod(this.n)).cmpn(0)){var b=(d.getY().isOdd()?1:0)|(0!==y.cmp(g)?2:0);return o.canonical&&m.cmp(this.nh)>0&&(m=this.n.sub(m),b^=1),new u({r:g,s:m,recoveryParam:b})}}}}}},c.prototype.verify=function(e,t,r,i){e=this._truncateToN(new n(e,16)),r=this.keyFromPublic(r,i);var o=(t=new u(t,"hex")).r,s=t.s;if(o.cmpn(1)<0||o.cmp(this.n)>=0)return!1;if(s.cmpn(1)<0||s.cmp(this.n)>=0)return!1;var a,c=s.invm(this.n),f=c.mul(e).umod(this.n),l=c.mul(o).umod(this.n);return this.curve._maxwellTrick?!(a=this.g.jmulAdd(f,r.getPublic(),l)).isInfinity()&&a.eqXToP(o):!(a=this.g.mulAdd(f,r.getPublic(),l)).isInfinity()&&0===a.getX().umod(this.n).cmp(o)},c.prototype.recoverPubKey=function(e,t,r,i){s((3&r)===r,"The recovery param is more than two bits"),t=new u(t,i);var o=this.n,a=new n(e),c=t.r,f=t.s,l=1&r,h=r>>1;if(c.cmp(this.curve.p.umod(this.curve.n))>=0&&h)throw new Error("Unable to find sencond key candinate");c=h?this.curve.pointFromX(c.add(this.curve.n),l):this.curve.pointFromX(c,l);var p=t.r.invm(o),d=o.sub(a).mul(p).umod(o),y=f.mul(p).umod(o);return this.g.mulAdd(d,c,y)},c.prototype.getKeyRecoveryParam=function(e,t,r,n){if(null!==(t=new u(t,n)).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(246),i=r(418),o=r(81);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){var n=e.concat(t).concat(r);this.K=new Array(this.outLen/8),this.V=new Array(this.outLen/8);for(var i=0;i<this.V.length;i++)this.K[i]=0,this.V[i]=1;this._update(n),this._reseed=1,this.reseedInterval=281474976710656},s.prototype._hmac=function(){return new n.hmac(this.hash,this.K)},s.prototype._update=function(e){var t=this._hmac().update(this.V).update([0]);e&&(t=t.update(e)),this.K=t.digest(),this.V=this._hmac().update(this.V).digest(),e&&(this.K=this._hmac().update(this.V).update([1]).update(e).digest(),this.V=this._hmac().update(this.V).digest())},s.prototype.reseed=function(e,t,r,n){"string"!=typeof t&&(n=r,r=t,t=null),e=i.toArray(e,t),r=i.toArray(r,n),o(e.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(e.concat(r||[])),this._reseed=1},s.prototype.generate=function(e,t,r,n){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");"string"!=typeof t&&(n=r,r=t,t=null),r&&(r=i.toArray(r,n||"hex"),this._update(r));for(var o=[];o.length<e;)this.V=this._hmac().update(this.V).digest(),o=o.concat(this.V);var s=o.slice(0,e);return this._update(r),this._reseed++,i.encode(s,t)}},function(e,t,r){"use strict";var n=r(53),i=r(54).utils.assert;function o(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=o,o.fromPublic=function(e,t,r){return t instanceof o?t:new o(e,{pub:t,pubEnc:r})},o.fromPrivate=function(e,t,r){return t instanceof o?t:new o(e,{priv:t,privEnc:r})},o.prototype.validate=function(){var e=this.getPublic();return e.isInfinity()?{result:!1,reason:"Invalid public key"}:e.validate()?e.mul(this.ec.curve.n).isInfinity()?{result:!0,reason:null}:{result:!1,reason:"Public key * N != O"}:{result:!1,reason:"Public key is not a point"}},o.prototype.getPublic=function(e,t){return"string"==typeof e&&(t=e,e=null),this.pub||(this.pub=this.ec.g.mul(this.priv)),t?this.pub.encode(t,e):this.pub},o.prototype.getPrivate=function(e){return"hex"===e?this.priv.toString(16,2):this.priv},o.prototype._importPrivate=function(e,t){this.priv=new n(e,t||16),this.priv=this.priv.umod(this.ec.curve.n)},o.prototype._importPublic=function(e,t){if(e.x||e.y)return"mont"===this.ec.curve.type?i(e.x,"Need x coordinate"):"short"!==this.ec.curve.type&&"edwards"!==this.ec.curve.type||i(e.x&&e.y,"Need both x and y coordinate"),void(this.pub=this.ec.curve.point(e.x,e.y));this.pub=this.ec.curve.decodePoint(e,t)},o.prototype.derive=function(e){return e.mul(this.priv).getX()},o.prototype.sign=function(e,t,r){return this.ec.sign(e,this,t,r)},o.prototype.verify=function(e,t){return this.ec.verify(e,t,this)},o.prototype.inspect=function(){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(53),i=r(54).utils,o=i.assert;function s(e,t){if(e instanceof s)return e;this._importDER(e,t)||(o(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 a(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 u(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 c(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=s,s.prototype._importDER=function(e,t){e=i.toArray(e,t);var r=new function(){this.place=0};if(48!==e[r.place++])return!1;if(a(e,r)+r.place!==e.length)return!1;if(2!==e[r.place++])return!1;var o=a(e,r),s=e.slice(r.place,o+r.place);if(r.place+=o,2!==e[r.place++])return!1;var u=a(e,r);if(e.length!==u+r.place)return!1;var c=e.slice(r.place,u+r.place);return 0===s[0]&&128&s[1]&&(s=s.slice(1)),0===c[0]&&128&c[1]&&(c=c.slice(1)),this.r=new n(s),this.s=new n(c),this.recoveryParam=null,!0},s.prototype.toDER=function(e){var t=this.r.toArray(),r=this.s.toArray();for(128&t[0]&&(t=[0].concat(t)),128&r[0]&&(r=[0].concat(r)),t=u(t),r=u(r);!(r[0]||128&r[1]);)r=r.slice(1);var n=[2];c(n,t.length),(n=n.concat(t)).push(2),c(n,r.length);var o=n.concat(r),s=[48];return c(s,o.length),s=s.concat(o),i.encode(s,e)}},function(e,t,r){"use strict";var n=r(246),i=r(54),o=i.utils,s=o.assert,a=o.parseBytes,u=r(850),c=r(851);function f(e){if(s("ed25519"===e,"only tested with ed25519 so far"),!(this instanceof f))return new f(e);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){e=a(e);var r=this.keyFromSecret(t),n=this.hashInt(r.messagePrefix(),e),i=this.g.mul(n),o=this.encodePoint(i),s=this.hashInt(o,r.pubBytes(),e).mul(r.priv()),u=n.add(s).umod(this.curve.n);return this.makeSignature({R:i,S:u,Rencoded:o})},f.prototype.verify=function(e,t,r){e=a(e),t=this.makeSignature(t);var n=this.keyFromPublic(r),i=this.hashInt(t.Rencoded(),n.pubBytes(),e),o=this.g.mul(t.S());return t.R().add(n.pub().mul(i)).eq(o)},f.prototype.hashInt=function(){for(var e=this.hash(),t=0;t<arguments.length;t++)e.update(arguments[t]);return o.intFromLE(e.digest()).umod(this.curve.n)},f.prototype.keyFromPublic=function(e){return u.fromPublic(this,e)},f.prototype.keyFromSecret=function(e){return u.fromSecret(this,e)},f.prototype.makeSignature=function(e){return e instanceof c?e:new c(this,e)},f.prototype.encodePoint=function(e){var t=e.getY().toArray("le",this.encodingLength);return t[this.encodingLength-1]|=e.getX().isOdd()?128:0,t},f.prototype.decodePoint=function(e){var t=(e=o.parseBytes(e)).length-1,r=e.slice(0,t).concat(-129&e[t]),n=0!=(128&e[t]),i=o.intFromLE(r);return this.curve.pointFromY(i,n)},f.prototype.encodeInt=function(e){return e.toArray("le",this.encodingLength)},f.prototype.decodeInt=function(e){return o.intFromLE(e)},f.prototype.isPoint=function(e){return e instanceof this.pointClass}},function(e,t,r){"use strict";var n=r(54).utils,i=n.assert,o=n.parseBytes,s=n.cachedProperty;function a(e,t){this.eddsa=e,this._secret=o(t.secret),e.isPoint(t.pub)?this._pub=t.pub:this._pubBytes=o(t.pub)}a.fromPublic=function(e,t){return t instanceof a?t:new a(e,{pub:t})},a.fromSecret=function(e,t){return t instanceof a?t:new a(e,{secret:t})},a.prototype.secret=function(){return this._secret},s(a,"pubBytes",function(){return this.eddsa.encodePoint(this.pub())}),s(a,"pub",function(){return this._pubBytes?this.eddsa.decodePoint(this._pubBytes):this.eddsa.g.mul(this.priv())}),s(a,"privBytes",function(){var e=this.eddsa,t=this.hash(),r=e.encodingLength-1,n=t.slice(0,e.encodingLength);return n[0]&=248,n[r]&=127,n[r]|=64,n}),s(a,"priv",function(){return this.eddsa.decodeInt(this.privBytes())}),s(a,"hash",function(){return this.eddsa.hash().update(this.secret()).digest()}),s(a,"messagePrefix",function(){return this.hash().slice(this.eddsa.encodingLength)}),a.prototype.sign=function(e){return i(this._secret,"KeyPair can only verify"),this.eddsa.sign(e,this)},a.prototype.verify=function(e,t){return this.eddsa.verify(e,t,this)},a.prototype.getSecret=function(e){return i(this._secret,"KeyPair is public only"),n.encode(this.secret(),e)},a.prototype.getPublic=function(e){return n.encode(this.pubBytes(),e)},e.exports=a},function(e,t,r){"use strict";var n=r(53),i=r(54).utils,o=i.assert,s=i.cachedProperty,a=i.parseBytes;function u(e,t){this.eddsa=e,"object"!=typeof t&&(t=a(t)),Array.isArray(t)&&(t={R:t.slice(0,e.encodingLength),S:t.slice(e.encodingLength)}),o(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}s(u,"S",function(){return this.eddsa.decodeInt(this.Sencoded())}),s(u,"R",function(){return this.eddsa.decodePoint(this.Rencoded())}),s(u,"Rencoded",function(){return this.eddsa.encodePoint(this.R())}),s(u,"Sencoded",function(){return this.eddsa.encodeInt(this.S())}),u.prototype.toBytes=function(){return this.Rencoded().concat(this.Sencoded())},u.prototype.toHex=function(){return i.encode(this.toBytes(),"hex").toUpperCase()},e.exports=u},function(e,t,r){"use strict";(function(t){var n=r(422),i=r(853);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){return"0x"+e.toString(16)}e.exports={arrayContainsArray:function(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})},intToBuffer:function(e){var r=s(e);return new t(o(r.slice(2)),"hex")},getBinarySize:function(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")},isHexPrefixed:n,stripHexPrefix:i,padToEven:o,intToHex:s,fromAscii:function(e){for(var t="",r=0;r<e.length;r++){var n=e.charCodeAt(r).toString(16);t+=n.length<2?"0"+n:n}return"0x"+t},fromUtf8:function(e){return"0x"+o(new t(e,"utf8").toString("hex")).replace(/^0+|0+$/g,"")},toAscii:function(e){var t="",r=0,n=e.length;for("0x"===e.substring(0,2)&&(r=2);r<n;r+=2){var i=parseInt(e.substr(r,2),16);t+=String.fromCharCode(i)}return t},toUtf8:function(e){return new t(o(i(e).replace(/^0+|0+$/g,"")),"hex").toString("utf8")},getKeys:function(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},isHexString:function(e,t){return!("string"!=typeof e||!e.match(/^0x[0-9A-Fa-f]*$/)||t&&e.length!==2+2*t)}}}).call(this,r(0).Buffer)},function(e,t,r){var n=r(422);e.exports=function(e){return"string"!=typeof e?e:n(e)?e.slice(2):e}},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(4),i=r(50),o=r(154),s=r(126),a=r(427),u=r(857),c=r(127),f=r(426).resolver,l=r(128)("eth-block-list",void 0,function(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)})}),h=l.util;h.serialize=o(e=>{const t=e.map(e=>e.raw);return s.encode(t)}),h.deserialize=o(e=>{return s.decode(e).map(e=>new a(e))}),h.cid=((e,t,r)=>{"function"==typeof t&&(r=t,t={});const i=(t=t||{}).hashAlg||"keccak-256";void 0===t.version||t.version;n([t=>h.serialize(e,t),(e,t)=>u.digest(e,i,t),o(e=>c("eth-block-list",e,t))],r)}),e.exports=l},function(e,t,r){"use strict";(function(t){const n=r(12),i=r(858);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,s=n;r&&(s=((e,t)=>{if(e)return n(e);n(null,t.slice(0,r))}));try{i=o.createHash(t)}catch(e){return s(e)}i(e,s)},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(38),i=r(39),o=r(428),s=r(859),a=o.toCallback,u=o.toBuf,c=o.fromString,f=o.fromNumberTo32BitBuf;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(860),dblSha2256:(e,r)=>{s.sha2256(e,(e,n)=>{e&&r(e),s.sha2256(t.from(n),r)})}}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(t){const n=r(40),i=self.crypto?self.crypto.subtle||self.crypto.webkitSubtle:self.msCrypto?self.msCrypto.subtle:void 0;function o(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)}}e.exports={sha1:function(e,t){o("SHA-1")(e,t)},sha2256:function(e,t){o("SHA-256")(e,t)},sha2512:function(e,t){o("SHA-512")(e,t)}}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(t){const n=r(41),i=r(428).toCallback,o={init:n.blake2bInit,update:n.blake2bUpdate,digest:n.blake2bFinal},s={init:n.blake2sInit,update:n.blake2sUpdate,digest:n.blake2sFinal},a=(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[45569+t]=a(t+1,o);for(let t=0;t<32;t++)e[45633+t]=a(t+1,s)})}).call(this,r(0).Buffer)},function(e,t,r){"use strict";const n=r(416),i=r(247)("eth-state-trie",n);e.exports=i},function(e,t,r){(function(t){const n=r(126),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[0]%2?e.slice(1):e.slice(2)}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,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){return 17===e.length?"branch":2===e.length?u(c(e[0]))?"leaf":"extention":void 0}e.exports=o,o.isRawNode=function(e){return Array.isArray(e)&&!t.isBuffer(e)},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=s(e=t.isBuffer(e)?c(e):e.slice(0),"leaf"===this.type),this.raw[0]=f(e))},o.prototype.getKey=function(){if("branch"!==this.type){var e=this.raw[0];return a(c(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+="]"},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;t<16;t++){var r=this.getValue(t);r&&e.push([[t],r])}}return e}}).call(this,r(0).Buffer)},function(e,t){e.exports=function(e){return Boolean(e["/"])}},function(e,t,r){"use strict";const n=r(247)("eth-storage-trie");e.exports=n},function(e,t,r){"use strict";(function(t){var n=r(173),i=r(866),o=n.BN,s=new o("7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a0",16),a=function(){function e(r){(function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")})(this,e),r=r||{};var i=[{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([])}];n.defineProperties(this,i,r),Object.defineProperty(this,"from",{enumerable:!0,configurable:!0,get:this.getSenderAddress.bind(this)});var o=n.bufferToInt(this.v),s=Math.floor((o-35)/2);s<0&&(s=0),this._chainId=s||r.chainId||0,this._homestead=!0}return e.prototype.toCreationAddress=function(){return""===this.to.toString("hex")},e.prototype.hash=function(e){void 0===e&&(e=!0);var t=void 0;if(e)t=this.raw;else if(this._chainId>0){var r=this.raw.slice();this.v=this._chainId,this.r=0,this.s=0,t=this.raw,this.raw=r}else t=this.raw.slice(0,6);return n.rlphash(t)},e.prototype.getChainId=function(){return this._chainId},e.prototype.getSenderAddress=function(){if(this._from)return this._from;var e=this.getSenderPublicKey();return this._from=n.publicToAddress(e),this._from},e.prototype.getSenderPublicKey=function(){if(!(this._senderPubKey&&this._senderPubKey.length||this.verifySignature()))throw new Error("Invalid Signature");return this._senderPubKey},e.prototype.verifySignature=function(){var e=this.hash(!1);if(this._homestead&&1===new o(this.s).cmp(s))return!1;try{var t=n.bufferToInt(this.v);this._chainId>0&&(t-=2*this._chainId+8),this._senderPubKey=n.ecrecover(e,t,this.r,this.s)}catch(e){return!1}return!!this._senderPubKey},e.prototype.sign=function(e){var t=this.hash(!1),r=n.ecsign(t,e);this._chainId>0&&(r.v+=2*this._chainId+8),Object.assign(this,r)},e.prototype.getDataFee=function(){for(var e=this.raw[5],t=new o(0),r=0;r<e.length;r++)0===e[r]?t.iaddn(i.txDataZeroGas.v):t.iaddn(i.txDataNonZeroGas.v);return t},e.prototype.getBaseFee=function(){var e=this.getDataFee().iaddn(i.txGas.v);return this._homestead&&this.toCreationAddress()&&e.iaddn(i.txCreation.v),e},e.prototype.getUpfrontCost=function(){return new o(this.gasLimit).imul(new o(this.gasPrice)).iadd(new o(this.value))},e.prototype.validate=function(e){var t=[];return this.verifySignature()||t.push("Invalid Signature"),this.getBaseFee().cmp(new o(this.gasLimit))>0&&t.push(["gas limit is too low. Need at least "+this.getBaseFee()]),void 0===e||!1===e?0===t.length:t.join(" ")},e}();e.exports=a}).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(429),i=r(247)("eth-tx-trie",n);e.exports=i},function(e,t,r){"use strict";const n=r(9),i=r(65);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={});const o=(t=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(248),t.util=r(430)},function(e,t,r){"use strict";(function(t,n){var i=e.exports;i.version="v"+r(871).version,i.versionGuard=function(e){if(void 0!==e);},i.versionGuard(t._bitcore),t._bitcore=i.version,i.crypto={},i.crypto.BN=r(32),i.crypto.ECDSA=r(431),i.crypto.Hash=r(43),i.crypto.Random=r(179),i.crypto.Point=r(108),i.crypto.Signature=r(67),i.encoding={},i.encoding.Base58=r(177),i.encoding.Base58Check=r(129),i.encoding.BufferReader=r(82),i.encoding.BufferWriter=r(55),i.encoding.Varint=r(899),i.util={},i.util.buffer=r(24),i.util.js=r(29),i.util.preconditions=r(21),i.errors=r(66),i.Address=r(97),i.Block=r(900),i.MerkleBlock=r(435),i.BlockHeader=r(180),i.HDPrivateKey=r(436),i.HDPublicKey=r(437),i.Networks=r(96),i.Opcode=r(249),i.PrivateKey=r(176),i.PublicKey=r(73),i.Script=r(68),i.Transaction=r(178),i.URI=r(902),i.Unit=r(252),i.deps={},i.deps.bnjs=r(74),i.deps.bs58=r(432),i.deps.Buffer=n,i.deps.elliptic=r(72),i.deps._=r(18),i._HDKeyCache=r(253),i.Transaction.sighash=r(83)}).call(this,r(6),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";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: http://bitcore.io/"+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:"http://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){return 1===e.length?"0"+e:e}function o(e){for(var t="",r=0;r<e.length;r++)t+=i(e[r].toString(16));return t}n.assert=function(e,t){if(!e)throw new Error(t||"Assertion failed")},n.toArray=function(e,t){if(Array.isArray(e))return e.slice();if(!e)return[];var r=[];if("string"!=typeof e){for(var n=0;n<e.length;n++)r[n]=0|e[n];return r}if(t){if("hex"===t)for((e=e.replace(/[^a-z0-9]+/gi,"")).length%2!=0&&(e="0"+e),n=0;n<e.length;n+=2)r.push(parseInt(e[n]+e[n+1],16))}else for(n=0;n<e.length;n++){var i=e.charCodeAt(n),o=i>>8,s=255&i;o?r.push(o,s):r.push(s)}return r},n.zero2=i,n.toHex=o,n.encode=function(e,t){return"hex"===t?o(e):e},n.getNAF=function(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},n.getJSF=function(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,s,a,u=e.andln(3)+n&3,c=t.andln(3)+i&3;3===u&&(u=-1),3===c&&(c=-1),o=0==(1&u)?0:3!=(a=e.andln(7)+n&7)&&5!==a||2!==c?u:-u,r[0].push(o),s=0==(1&c)?0:3!=(a=t.andln(7)+i&7)&&5!==a||2!==u?c:-c,r[1].push(s),2*n===o+1&&(n=1-n),2*i===s+1&&(i=1-i),e.ishrn(1),t.ishrn(1)}return r}},function(e,t,r){var n;function i(e){this.rand=e}if(e.exports=function(e){return n||(n=new i(null)),n.generate(e)},e.exports.Rand=i,i.prototype.generate=function(e){return this._rand(e)},"object"==typeof window)window.crypto&&window.crypto.getRandomValues?i.prototype._rand=function(e){var t=new Uint8Array(e);return window.crypto.getRandomValues(t),t}:window.msCrypto&&window.msCrypto.getRandomValues?i.prototype._rand=function(e){var t=new Uint8Array(e);return window.msCrypto.getRandomValues(t),t}:i.prototype._rand=function(){throw new Error("Not implemented yet")};else try{var o=r(95);i.prototype._rand=function(e){return o.randomBytes(e)}}catch(e){i.prototype._rand=function(e){for(var t=new Uint8Array(e),r=0;r<t.length;r++)t[r]=this.rand.getByte();return t}}},function(e,t,r){"use strict";var n=r(109),i=r(72).utils,o=i.assert;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),r=i.toArray(e.nonce,e.nonceEnc),n=i.toArray(e.pers,e.persEnc);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){var n=e.concat(t).concat(r);this.K=new Array(this.outLen/8),this.V=new Array(this.outLen/8);for(var i=0;i<this.V.length;i++)this.K[i]=0,this.V[i]=1;this._update(n),this.reseed=1,this.reseedInterval=281474976710656},s.prototype._hmac=function(){return new n.hmac(this.hash,this.K)},s.prototype._update=function(e){var t=this._hmac().update(this.V).update([0]);e&&(t=t.update(e)),this.K=t.digest(),this.V=this._hmac().update(this.V).digest(),e&&(this.K=this._hmac().update(this.V).update([1]).update(e).digest(),this.V=this._hmac().update(this.V).digest())},s.prototype.reseed=function(e,t,r,n){"string"!=typeof t&&(n=r,r=t,t=null),e=i.toBuffer(e,t),r=i.toBuffer(r,n),o(e.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(e.concat(r||[])),this.reseed=1},s.prototype.generate=function(e,t,r,n){if(this.reseed>this.reseedInterval)throw new Error("Reseed is required");"string"!=typeof t&&(n=r,r=t,t=null),r&&(r=i.toArray(r,n),this._update(r));for(var o=[];o.length<e;)this.V=this._hmac().update(this.V).digest(),o=o.concat(this.V);var s=o.slice(0,e);return this._update(r),this.reseed++,i.encode(s,t)}},function(e,t,r){var n=t,i=r(75);function o(e){return(e>>>24|e>>>8&65280|e<<8&16711680|(255&e)<<24)>>>0}function s(e){return 1===e.length?"0"+e:e}function a(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 u(e,t){if(!e)throw new Error(t||"Assertion failed")}n.toArray=function(e,t){if(Array.isArray(e))return e.slice();if(!e)return[];var r=[];if("string"==typeof e)if(t){if("hex"===t){(e=e.replace(/[^a-z0-9]+/gi,"")).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(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},n.toHex=function(e){for(var t="",r=0;r<e.length;r++)t+=s(e[r].toString(16));return t},n.htonl=o,n.toHex32=function(e,t){for(var r="",n=0;n<e.length;n++){var i=e[n];"little"===t&&(i=o(i)),r+=a(i.toString(16))}return r},n.zero2=s,n.zero8=a,n.join32=function(e,t,r,n){var i=r-t;u(i%4==0);for(var o=new Array(i/4),s=0,a=t;s<o.length;s++,a+=4){var c;c="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]=c>>>0}return o},n.split32=function(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},n.rotr32=function(e,t){return e>>>t|e<<32-t},n.rotl32=function(e,t){return e<<t|e>>>32-t},n.sum32=function(e,t){return e+t>>>0},n.sum32_3=function(e,t,r){return e+t+r>>>0},n.sum32_4=function(e,t,r,n){return e+t+r+n>>>0},n.sum32_5=function(e,t,r,n,i){return e+t+r+n+i>>>0},n.assert=u,n.inherits=i,t.sum64=function(e,t,r,n){var i=e[t],o=n+e[t+1]>>>0,s=(o<n?1:0)+r+i;e[t]=s>>>0,e[t+1]=o},t.sum64_hi=function(e,t,r,n){return(t+n>>>0<t?1:0)+e+r>>>0},t.sum64_lo=function(e,t,r,n){return t+n>>>0},t.sum64_4_hi=function(e,t,r,n,i,o,s,a){var u=0,c=t;return u+=(c=c+n>>>0)<t?1:0,u+=(c=c+o>>>0)<o?1:0,e+r+i+s+(u+=(c=c+a>>>0)<a?1:0)>>>0},t.sum64_4_lo=function(e,t,r,n,i,o,s,a){return t+n+o+a>>>0},t.sum64_5_hi=function(e,t,r,n,i,o,s,a,u,c){var f=0,l=t;return f+=(l=l+n>>>0)<t?1:0,f+=(l=l+o>>>0)<o?1:0,f+=(l=l+a>>>0)<a?1:0,e+r+i+s+u+(f+=(l=l+c>>>0)<c?1:0)>>>0},t.sum64_5_lo=function(e,t,r,n,i,o,s,a,u,c){return t+n+o+a+c>>>0},t.rotr64_hi=function(e,t,r){return(t<<32-r|e>>>r)>>>0},t.rotr64_lo=function(e,t,r){return(e<<32-r|t>>>r)>>>0},t.shr64_hi=function(e,t,r){return e>>>r},t.shr64_lo=function(e,t,r){return(e<<32-r|t>>>r)>>>0}},function(e,t,r){var n=r(109).utils,i=n.assert;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){if(e=n.toArray(e,t),this.pending?this.pending=this.pending.concat(e):this.pending=e,this.pendingTotal+=e.length,this.pending.length>=this._delta8){var r=(e=this.pending).length%this._delta8;this.pending=e.slice(e.length-r,e.length),0===this.pending.length&&(this.pending=null),e=n.join32(e,0,e.length-r,this.endian);for(var i=0;i<e.length;i+=this._delta32)this._update(e,i,i+this._delta32)}return this},o.prototype.digest=function(e){return this.update(this._pad()),i(null===this.pending),this._digest(e)},o.prototype._pad=function(){var e=this.pendingTotal,t=this._delta8,r=t-(e+this.padLength)%t,n=new Array(r+this.padLength);n[0]=128;for(var i=1;i<r;i++)n[i]=0;if(e<<=3,"big"===this.endian){for(var o=8;o<this.padLength;o++)n[i++]=0;n[i++]=0,n[i++]=0,n[i++]=0,n[i++]=0,n[i++]=e>>>24&255,n[i++]=e>>>16&255,n[i++]=e>>>8&255,n[i++]=255&e}else{n[i++]=255&e,n[i++]=e>>>8&255,n[i++]=e>>>16&255,n[i++]=e>>>24&255,n[i++]=0,n[i++]=0,n[i++]=0,n[i++]=0;for(o=8;o<this.padLength;o++)n[i++]=0}return n}},function(e,t,r){var n=r(109),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){return s(e,2)^s(e,13)^s(e,22)}function N(e){return s(e,6)^s(e,11)^s(e,25)}function L(e){return s(e,7)^s(e,18)^e>>>3}function K(e){return s(e,17)^s(e,19)^e>>>10}function j(e,t,r,n){return 0===e?P(t,r,n):1===e||3===e?function(e,t,r){return e^t^r}(t,r,n):2===e?O(t,r,n):void 0}function M(e,t,r,n,i,o){var s=e&r^~e&i;return s<0&&(s+=4294967296),s}function D(e,t,r,n,i,o){var s=t&n^~t&o;return s<0&&(s+=4294967296),s}function U(e,t,r,n,i,o){var s=e&r^e&i^r&i;return s<0&&(s+=4294967296),s}function F(e,t,r,n,i,o){var s=t&n^t&o^n&o;return s<0&&(s+=4294967296),s}function q(e,t){var r=l(e,t,28)^l(t,e,2)^l(t,e,7);return r<0&&(r+=4294967296),r}function H(e,t){var r=h(e,t,28)^h(t,e,2)^h(t,e,7);return r<0&&(r+=4294967296),r}function z(e,t){var r=l(e,t,14)^l(e,t,18)^l(t,e,9);return r<0&&(r+=4294967296),r}function V(e,t){var r=h(e,t,14)^h(e,t,18)^h(t,e,9);return r<0&&(r+=4294967296),r}function G(e,t){var r=l(e,t,1)^l(e,t,8)^p(e,t,7);return r<0&&(r+=4294967296),r}function W(e,t){var r=h(e,t,1)^h(e,t,8)^d(e,t,7);return r<0&&(r+=4294967296),r}function $(e,t){var r=l(e,t,19)^l(t,e,29)^p(e,t,6);return r<0&&(r+=4294967296),r}function Y(e,t){var r=h(e,t,19)^h(t,e,29)^d(e,t,6);return r<0&&(r+=4294967296),r}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){for(var r=this.W,n=0;n<16;n++)r[n]=e[t+n];for(;n<r.length;n++)r[n]=c(K(r[n-2]),r[n-7],L(r[n-15]),r[n-16]);var i=this.h[0],s=this.h[1],a=this.h[2],l=this.h[3],h=this.h[4],p=this.h[5],d=this.h[6],y=this.h[7];o(this.k.length===r.length);for(n=0;n<r.length;n++){var g=f(y,N(h),P(h,p,d),this.k[n],r[n]),m=u(R(i),O(i,s,a));y=d,d=p,p=h,h=u(l,g),l=a,a=s,s=i,i=u(g,m)}this.h[0]=u(this.h[0],i),this.h[1]=u(this.h[1],s),this.h[2]=u(this.h[2],a),this.h[3]=u(this.h[3],l),this.h[4]=u(this.h[4],h),this.h[5]=u(this.h[5],p),this.h[6]=u(this.h[6],d),this.h[7]=u(this.h[7],y)},x.prototype._digest=function(e){return"hex"===e?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){return"hex"===e?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){for(var r=this.W,n=0;n<32;n++)r[n]=e[t+n];for(;n<r.length;n+=2){var i=$(r[n-4],r[n-3]),o=Y(r[n-4],r[n-3]),s=r[n-14],a=r[n-13],u=G(r[n-30],r[n-29]),c=W(r[n-30],r[n-29]),f=r[n-32],l=r[n-31];r[n]=b(i,o,s,a,u,c,f,l),r[n+1]=v(i,o,s,a,u,c,f,l)}},T.prototype._update=function(e,t){this._prepareBlock(e,t);var r=this.W,n=this.h[0],i=this.h[1],s=this.h[2],a=this.h[3],u=this.h[4],c=this.h[5],f=this.h[6],l=this.h[7],h=this.h[8],p=this.h[9],d=this.h[10],b=this.h[11],v=this.h[12],S=this.h[13],k=this.h[14],E=this.h[15];o(this.k.length===r.length);for(var A=0;A<r.length;A+=2){var x=k,I=E,T=z(h,p),B=V(h,p),C=M(h,0,d,0,v),P=D(0,p,0,b,0,S),O=this.k[A],R=this.k[A+1],N=r[A],L=r[A+1],K=_(x,I,T,B,C,P,O,R,N,L),j=w(x,I,T,B,C,P,O,R,N,L),G=(x=q(n,i),I=H(n,i),T=U(n,0,s,0,u),B=F(0,i,0,a,0,c),g(x,I,T,B)),W=m(x,I,T,B);k=v,E=S,v=d,S=b,d=h,b=p,h=g(f,l,K,j),p=m(l,l,K,j),f=u,l=c,u=s,c=a,s=n,a=i,n=g(K,j,G,W),i=m(K,j,G,W)}y(this.h,0,n,i),y(this.h,2,s,a),y(this.h,4,u,c),y(this.h,6,f,l),y(this.h,8,h,p),y(this.h,10,d,b),y(this.h,12,v,S),y(this.h,14,k,E)},T.prototype._digest=function(e){return"hex"===e?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){return"hex"===e?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){for(var r=this.W,n=0;n<16;n++)r[n]=e[t+n];for(;n<r.length;n++)r[n]=a(r[n-3]^r[n-8]^r[n-14]^r[n-16],1);var i=this.h[0],o=this.h[1],s=this.h[2],c=this.h[3],l=this.h[4];for(n=0;n<r.length;n++){var h=~~(n/20),p=f(a(i,5),j(h,o,s,c),l,r[n],A[h]);l=c,c=s,s=a(o,30),o=i,i=p}this.h[0]=u(this.h[0],i),this.h[1]=u(this.h[1],o),this.h[2]=u(this.h[2],s),this.h[3]=u(this.h[3],c),this.h[4]=u(this.h[4],l)},C.prototype._digest=function(e){return"hex"===e?i.toHex32(this.h,"big"):i.split32(this.h,"big")}},function(e,t,r){var n=r(109),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){for(var r=this.h[0],n=this.h[1],i=this.h[2],c=this.h[3],f=this.h[4],b=r,v=n,_=i,w=c,S=f,k=0;k<80;k++){var E=s(o(u(r,l(k,n,i,c),e[d[k]+t],h(k)),g[k]),f);r=f,f=c,c=o(i,10),i=n,n=E,E=s(o(u(b,l(79-k,v,_,w),e[y[k]+t],p(k)),m[k]),S),b=S,S=w,w=o(_,10),_=v,v=E}E=a(this.h[1],i,w),this.h[1]=a(this.h[2],c,S),this.h[2]=a(this.h[3],f,b),this.h[3]=a(this.h[4],r,v),this.h[4]=a(this.h[0],n,_),this.h[0]=E},f.prototype._digest=function(e){return"hex"===e?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=r(109).utils,i=n.assert;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){e.length>this.blockSize&&(e=(new this.Hash).update(e).digest()),i(e.length<=this.blockSize);for(var t=e.length;t<this.blockSize;t++)e.push(0);for(t=0;t<e.length;t++)e[t]^=54;this.inner=(new this.Hash).update(e);for(t=0;t<e.length;t++)e[t]^=106;this.outer=(new this.Hash).update(e)},o.prototype.update=function(e,t){return this.inner.update(e,t),this},o.prototype.digest=function(e){return this.outer.update(this.inner.digest()),this.outer.digest(e)}},function(e,t,r){"use strict";var n=r(74),i=r(72),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(){throw new Error("Not implemented")},u.prototype.validate=function(){throw new Error("Not implemented")},u.prototype._fixedNafMul=function(e,t){var r=e._getDoubles(),n=o(t,1),i=(1<<r.step+1)-(r.step%2==0?2:1);i/=3;for(var s=[],a=0;a<n.length;a+=r.step){var u=0;for(t=a+r.step-1;t>=a;t--)u=(u<<1)+n[t];s.push(u)}for(var c=this.jpoint(null,null,null),f=this.jpoint(null,null,null),l=i;l>0;l--){for(a=0;a<s.length;a++){(u=s[a])===l?f=f.mixedAdd(r.points[a]):u===-l&&(f=f.mixedAdd(r.points[a].neg()))}c=c.add(f)}return c.toP()},u.prototype._wnafMul=function(e,t){var r=4,n=e._getNAFPoints(r);r=n.wnd;for(var i=n.points,s=o(t,r),u=this.jpoint(null,null,null),c=s.length-1;c>=0;c--){for(t=0;c>=0&&0===s[c];c--)t++;if(c>=0&&t++,u=u.dblp(t),c<0)break;var f=s[c];a(0!==f),u="affine"===e.type?f>0?u.mixedAdd(i[f-1>>1]):u.mixedAdd(i[-f-1>>1].neg()):f>0?u.add(i[f-1>>1]):u.add(i[-f-1>>1].neg())}return"affine"===e.type?u.toP():u},u.prototype._wnafMulAdd=function(e,t,r,n){for(var i=this._wnafT1,a=this._wnafT2,u=this._wnafT3,c=0,f=0;f<n;f++){var l=(E=t[f])._getNAFPoints(e);i[f]=l.wnd,a[f]=l.points}for(f=n-1;f>=1;f-=2){var h=f-1,p=f;if(1===i[h]&&1===i[p]){var d=[t[h],null,null,t[p]];0===t[h].y.cmp(t[p].y)?(d[1]=t[h].add(t[p]),d[2]=t[h].toJ().mixedAdd(t[p].neg())):0===t[h].y.cmp(t[p].y.redNeg())?(d[1]=t[h].toJ().mixedAdd(t[p]),d[2]=t[h].add(t[p].neg())):(d[1]=t[h].toJ().mixedAdd(t[p]),d[2]=t[h].toJ().mixedAdd(t[p].neg()));var y=[-3,-1,-5,-7,0,7,5,1,3],g=s(r[h],r[p]);c=Math.max(g[0].length,c),u[h]=new Array(c),u[p]=new Array(c);for(var m=0;m<c;m++){var b=0|g[0][m],v=0|g[1][m];u[h][m]=y[3*(b+1)+(v+1)],u[p][m]=0,a[h]=d}}else u[h]=o(r[h],i[h]),u[p]=o(r[p],i[p]),c=Math.max(u[h].length,c),c=Math.max(u[p].length,c)}var _=this.jpoint(null,null,null),w=this._wnafT4;for(f=c;f>=0;f--){for(var S=0;f>=0;){var k=!0;for(m=0;m<n;m++)w[m]=0|u[m][f],0!==w[m]&&(k=!1);if(!k)break;S++,f--}if(f>=0&&S++,_=_.dblp(S),f<0)break;for(m=0;m<n;m++){var E,A=w[m];0!==A&&(A>0?E=a[m][A-1>>1]:A<0&&(E=a[m][-A-1>>1].neg()),_="affine"===E.type?_.mixedAdd(E):_.add(E))}}for(f=0;f<n;f++)a[f]=null;return _.toP()},u.BasePoint=c,c.prototype.validate=function(){return this.curve.validate(this)},c.prototype.precompute=function(e){if(this.precomputed)return this;var t={doubles:null,naf:null,beta:null};return t.naf=this._getNAFPoints(8),t.doubles=this._getDoubles(4,e),t.beta=this._getBeta(),this.precomputed=t,this},c.prototype._getDoubles=function(e,t){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var r=[this],n=this,i=0;i<t;i+=e){for(var o=0;o<e;o++)n=n.dbl();r.push(n)}return{step:e,points:r}},c.prototype._getNAFPoints=function(e){if(this.precomputed&&this.precomputed.naf)return this.precomputed.naf;for(var t=[this],r=(1<<e)-1,n=1===r?null:this.dbl(),i=1;i<r;i++)t[i]=t[i-1].add(n);return{wnd:e,points:t}},c.prototype._getBeta=function(){return null},c.prototype.dblp=function(e){for(var t=this,r=0;r<e;r++)t=t.dbl();return t}},function(e,t,r){"use strict";var n=r(175),i=r(72),o=r(74),s=r(75),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){if(this.zeroA&&this.g&&this.n&&1===this.p.modn(3)){var t,r;if(e.beta)t=new o(e.beta,16).toRed(this.red);else{var n=this._getEndoRoots(this.p);t=(t=n[0].cmp(n[1])<0?n[0]:n[1]).toRed(this.red)}if(e.lambda)r=new o(e.lambda,16);else{var i=this._getEndoRoots(this.n);0===this.g.mul(i[0]).x.cmp(this.g.x.redMul(t))?r=i[0]:(r=i[1],u(0===this.g.mul(r).x.cmp(this.g.x.redMul(t))))}return{beta:t,lambda:r,basis:e.basis?e.basis.map(function(e){return{a:new o(e.a,16),b:new o(e.b,16)}}):this._getEndoBasis(r)}}},c.prototype._getEndoRoots=function(e){var t=e===this.p?this.red:o.mont(e),r=new o(2).toRed(t).redInvm(),n=r.redNeg(),i=new o(3).toRed(t).redNeg().redSqrt().redMul(r);return[n.redAdd(i).fromRed(),n.redSub(i).fromRed()]},c.prototype._getEndoBasis=function(e){for(var t,r,n,i,s,a,u,c,f,l=this.n.shrn(Math.floor(this.n.bitLength()/2)),h=e,p=this.n.clone(),d=new o(1),y=new o(0),g=new o(0),m=new o(1),b=0;0!==h.cmpn(0);){var v=p.div(h);c=p.sub(v.mul(h)),f=g.sub(v.mul(d));var _=m.sub(v.mul(y));if(!n&&c.cmp(l)<0)t=u.neg(),r=d,n=c.neg(),i=f;else if(n&&2==++b)break;u=c,p=h,h=c,g=d,d=f,m=y,y=_}s=c.neg(),a=f;var w=n.sqr().add(i.sqr());return s.sqr().add(a.sqr()).cmp(w)>=0&&(s=t,a=r),n.sign&&(n=n.neg(),i=i.neg()),s.sign&&(s=s.neg(),a=a.neg()),[{a:n,b:i},{a:s,b:a}]},c.prototype._endoSplit=function(e){var t=this.endo.basis,r=t[0],n=t[1],i=n.b.mul(e).divRound(this.n),o=r.b.neg().mul(e).divRound(this.n),s=i.mul(r.a),a=o.mul(n.a),u=i.mul(r.b),c=o.mul(n.b);return{k1:e.sub(s).sub(a),k2:u.add(c).neg()}},c.prototype.pointFromX=function(e,t){(t=new o(t,16)).red||(t=t.toRed(this.red));var r=t.redSqr().redMul(t).redIAdd(t.redMul(this.a)).redIAdd(this.b).redSqrt(),n=r.fromRed().isOdd();return(e&&!n||!e&&n)&&(r=r.redNeg()),this.point(t,r)},c.prototype.validate=function(e){if(e.inf)return!0;var t=e.x,r=e.y,n=this.a.redMul(t),i=t.redSqr().redMul(t).redIAdd(n).redIAdd(this.b);return 0===r.redSqr().redISub(i).cmpn(0)},c.prototype._endoWnafMulAdd=function(e,t){for(var r=this._endoWnafT1,n=this._endoWnafT2,i=0;i<e.length;i++){var o=this._endoSplit(t[i]),s=e[i],a=s._getBeta();o.k1.sign&&(o.k1.sign=!o.k1.sign,s=s.neg(!0)),o.k2.sign&&(o.k2.sign=!o.k2.sign,a=a.neg(!0)),r[2*i]=s,r[2*i+1]=a,n[2*i]=o.k1,n[2*i+1]=o.k2}for(var u=this._wnafMulAdd(1,r,n,2*i),c=0;c<2*i;c++)r[c]=null,n[c]=null;return u},s(f,a.BasePoint),c.prototype.point=function(e,t,r){return new f(this,e,t,r)},c.prototype.pointFromJSON=function(e,t){return f.fromJSON(this,e,t)},f.prototype._getBeta=function(){if(this.curve.endo){var e=this.precomputed;if(e&&e.beta)return e.beta;var t=this.curve.point(this.x.redMul(this.curve.endo.beta),this.y);if(e){var r=this.curve,n=function(e){return r.point(e.x.redMul(r.endo.beta),e.y)};e.beta=t,t.precomputed={beta:null,naf:e.naf&&{wnd:e.naf.wnd,points:e.naf.points.map(n)},doubles:e.doubles&&{step:e.doubles.step,points:e.doubles.points.map(n)}}}return t}},f.prototype.toJSON=function(){return this.precomputed?[this.x,this.y,this.precomputed&&{doubles:this.precomputed.doubles&&{step:this.precomputed.doubles.step,points:this.precomputed.doubles.points.slice(1)},naf:this.precomputed.naf&&{wnd:this.precomputed.naf.wnd,points:this.precomputed.naf.points.slice(1)}}]:[this.x,this.y]},f.fromJSON=function(e,t,r){"string"==typeof t&&(t=JSON.parse(t));var n=e.point(t[0],t[1],r);if(!t[2])return n;function i(t){return e.point(t[0],t[1],r)}var o=t[2];return n.precomputed={beta:null,doubles:o.doubles&&{step:o.doubles.step,points:[n].concat(o.doubles.points.map(i))},naf:o.naf&&{wnd:o.naf.wnd,points:[n].concat(o.naf.points.map(i))}},n},f.prototype.inspect=function(){return this.isInfinity()?"<EC Point Infinity>":"<EC Point x: "+this.x.fromRed().toString(16,2)+" y: "+this.y.fromRed().toString(16,2)+">"},f.prototype.isInfinity=function(){return this.inf},f.prototype.add=function(e){if(this.inf)return e;if(e.inf)return this;if(this.eq(e))return this.dbl();if(this.neg().eq(e))return this.curve.point(null,null);if(0===this.x.cmp(e.x))return this.curve.point(null,null);var t=this.y.redSub(e.y);0!==t.cmpn(0)&&(t=t.redMul(this.x.redSub(e.x).redInvm()));var r=t.redSqr().redISub(this.x).redISub(e.x),n=t.redMul(this.x.redSub(r)).redISub(this.y);return this.curve.point(r,n)},f.prototype.dbl=function(){if(this.inf)return this;var e=this.y.redAdd(this.y);if(0===e.cmpn(0))return this.curve.point(null,null);var t=this.curve.a,r=this.x.redSqr(),n=e.redInvm(),i=r.redAdd(r).redIAdd(r).redIAdd(t).redMul(n),o=i.redSqr().redISub(this.x.redAdd(this.x)),s=i.redMul(this.x.redSub(o)).redISub(this.y);return this.curve.point(o,s)},f.prototype.getX=function(){return this.x.fromRed()},f.prototype.getY=function(){return this.y.fromRed()},f.prototype.mul=function(e){return e=new o(e,16),this.precomputed&&this.precomputed.doubles?this.curve._fixedNafMul(this,e):this.curve.endo?this.curve._endoWnafMulAdd([this],[e]):this.curve._wnafMul(this,e)},f.prototype.mulAdd=function(e,t,r){var n=[this,t],i=[e,r];return this.curve.endo?this.curve._endoWnafMulAdd(n,i):this.curve._wnafMulAdd(1,n,i,2)},f.prototype.eq=function(e){return this===e||this.inf===e.inf&&(this.inf||0===this.x.cmp(e.x)&&0===this.y.cmp(e.y))},f.prototype.neg=function(e){if(this.inf)return this;var t=this.curve.point(this.x,this.y.redNeg());if(e&&this.precomputed){var r=this.precomputed,n=function(e){return e.neg()};t.precomputed={naf:r.naf&&{wnd:r.naf.wnd,points:r.naf.points.map(n)},doubles:r.doubles&&{step:r.doubles.step,points:r.doubles.points.map(n)}}}return t},f.prototype.toJ=function(){return this.inf?this.curve.jpoint(null,null,null):this.curve.jpoint(this.x,this.y,this.curve.one)},s(l,a.BasePoint),c.prototype.jpoint=function(e,t,r){return new l(this,e,t,r)},l.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var e=this.z.redInvm(),t=e.redSqr(),r=this.x.redMul(t),n=this.y.redMul(t).redMul(e);return this.curve.point(r,n)},l.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},l.prototype.add=function(e){if(this.isInfinity())return e;if(e.isInfinity())return this;var t=e.z.redSqr(),r=this.z.redSqr(),n=this.x.redMul(t),i=e.x.redMul(r),o=this.y.redMul(t.redMul(e.z)),s=e.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(e.z).redMul(a);return this.curve.jpoint(h,p,d)},l.prototype.mixedAdd=function(e){if(this.isInfinity())return e.toJ();if(e.isInfinity())return this;var t=this.z.redSqr(),r=this.x,n=e.x.redMul(t),i=this.y,o=e.y.redMul(t).redMul(this.z),s=r.redSub(n),a=i.redSub(o);if(0===s.cmpn(0))return 0!==a.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var u=s.redSqr(),c=u.redMul(s),f=r.redMul(u),l=a.redSqr().redIAdd(c).redISub(f).redISub(f),h=a.redMul(f.redISub(l)).redISub(i.redMul(c)),p=this.z.redMul(s);return this.curve.jpoint(l,h,p)},l.prototype.dblp=function(e){if(0===e)return this;if(this.isInfinity())return this;if(!e)return this.dbl();if(this.curve.zeroA||this.curve.threeA){for(var t=this,r=0;r<e;r++)t=t.dbl();return t}var n=this.curve.a,i=this.curve.tinv,o=this.x,s=this.y,a=this.z,u=a.redSqr().redSqr(),c=s.redAdd(s);for(r=0;r<e;r++){var f=o.redSqr(),l=c.redSqr(),h=l.redSqr(),p=f.redAdd(f).redIAdd(f).redIAdd(n.redMul(u)),d=o.redMul(l),y=p.redSqr().redISub(d.redAdd(d)),g=d.redISub(y),m=p.redMul(g);m=m.redIAdd(m).redISub(h);var b=c.redMul(a);r+1<e&&(u=u.redMul(h)),o=y,a=b,c=m}return this.curve.jpoint(o,c.redMul(i),a)},l.prototype.dbl=function(){return this.isInfinity()?this:this.curve.zeroA?this._zeroDbl():this.curve.threeA?this._threeDbl():this._dbl()},l.prototype._zeroDbl=function(){var e,t,r;if(this.zOne){var n=this.x.redSqr(),i=this.y.redSqr(),o=i.redSqr(),s=this.x.redAdd(i).redSqr().redISub(n).redISub(o);s=s.redIAdd(s);var a=n.redAdd(n).redIAdd(n),u=a.redSqr().redISub(s).redISub(s),c=o.redIAdd(o);c=(c=c.redIAdd(c)).redIAdd(c),e=u,t=a.redMul(s.redISub(u)).redISub(c),r=this.y.redAdd(this.y)}else{var f=this.x.redSqr(),l=this.y.redSqr(),h=l.redSqr(),p=this.x.redAdd(l).redSqr().redISub(f).redISub(h);p=p.redIAdd(p);var d=f.redAdd(f).redIAdd(f),y=d.redSqr(),g=h.redIAdd(h);g=(g=g.redIAdd(g)).redIAdd(g),e=y.redISub(p).redISub(p),t=d.redMul(p.redISub(e)).redISub(g),r=(r=this.y.redMul(this.z)).redIAdd(r)}return this.curve.jpoint(e,t,r)},l.prototype._threeDbl=function(){var e,t,r;if(this.zOne){var n=this.x.redSqr(),i=this.y.redSqr(),o=i.redSqr(),s=this.x.redAdd(i).redSqr().redISub(n).redISub(o);s=s.redIAdd(s);var a=n.redAdd(n).redIAdd(n).redIAdd(this.curve.a),u=a.redSqr().redISub(s).redISub(s);e=u;var c=o.redIAdd(o);c=(c=c.redIAdd(c)).redIAdd(c),t=a.redMul(s.redISub(u)).redISub(c),r=this.y.redAdd(this.y)}else{var f=this.z.redSqr(),l=this.y.redSqr(),h=this.x.redMul(l),p=this.x.redSub(f).redMul(this.x.redAdd(f));p=p.redAdd(p).redIAdd(p);var d=h.redIAdd(h),y=(d=d.redIAdd(d)).redAdd(d);e=p.redSqr().redISub(y),r=this.y.redAdd(this.z).redSqr().redISub(l).redISub(f);var g=l.redSqr();g=(g=(g=g.redIAdd(g)).redIAdd(g)).redIAdd(g),t=p.redMul(d.redISub(e)).redISub(g)}return this.curve.jpoint(e,t,r)},l.prototype._dbl=function(){var e=this.curve.a,t=this.x,r=this.y,n=this.z,i=n.redSqr().redSqr(),o=t.redSqr(),s=r.redSqr(),a=o.redAdd(o).redIAdd(o).redIAdd(e.redMul(i)),u=t.redAdd(t),c=(u=u.redIAdd(u)).redMul(s),f=a.redSqr().redISub(c.redAdd(c)),l=c.redISub(f),h=s.redSqr();h=(h=(h=h.redIAdd(h)).redIAdd(h)).redIAdd(h);var p=a.redMul(l).redISub(h),d=r.redAdd(r).redMul(n);return this.curve.jpoint(f,p,d)},l.prototype.trpl=function(){if(!this.curve.zeroA)return this.dbl().add(this);var e=this.x.redSqr(),t=this.y.redSqr(),r=this.z.redSqr(),n=t.redSqr(),i=e.redAdd(e).redIAdd(e),o=i.redSqr(),s=this.x.redAdd(t).redSqr().redISub(e).redISub(n),a=(s=(s=(s=s.redIAdd(s)).redAdd(s).redIAdd(s)).redISub(o)).redSqr(),u=n.redIAdd(n);u=(u=(u=u.redIAdd(u)).redIAdd(u)).redIAdd(u);var c=i.redIAdd(s).redSqr().redISub(o).redISub(a).redISub(u),f=t.redMul(c);f=(f=f.redIAdd(f)).redIAdd(f);var l=this.x.redMul(a).redISub(f);l=(l=l.redIAdd(l)).redIAdd(l);var h=this.y.redMul(c.redMul(u.redISub(c)).redISub(s.redMul(a)));h=(h=(h=h.redIAdd(h)).redIAdd(h)).redIAdd(h);var p=this.z.redAdd(s).redSqr().redISub(r).redISub(a);return this.curve.jpoint(l,h,p)},l.prototype.mul=function(e,t){return e=new o(e,t),this.curve._wnafMul(this,e)},l.prototype.eq=function(e){if("affine"===e.type)return this.eq(e.toJ());if(this===e)return!0;var t=this.z.redSqr(),r=e.z.redSqr();if(0!==this.x.redMul(r).redISub(e.x.redMul(t)).cmpn(0))return!1;var n=t.redMul(this.z),i=r.redMul(e.z);return 0===this.y.redMul(i).redISub(e.y.redMul(n)).cmpn(0)},l.prototype.inspect=function(){return this.isInfinity()?"<EC JPoint Infinity>":"<EC JPoint x: "+this.x.toString(16,2)+" y: "+this.y.toString(16,2)+" z: "+this.z.toString(16,2)+">"},l.prototype.isInfinity=function(){return 0===this.z.cmpn(0)}},function(e,t,r){"use strict";var n=r(175),i=r(74),o=r(75),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){var t=e.normalize().x,r=t.redSqr(),n=r.redMul(t).redAdd(r.redMul(this.a)).redAdd(t);return 0===n.redSqrt().redSqr().cmp(n)},o(u,s.BasePoint),a.prototype.point=function(e,t){return new u(this,e,t)},a.prototype.pointFromJSON=function(e){return u.fromJSON(this,e)},u.prototype.precompute=function(){},u.fromJSON=function(e,t){return new u(e,t[0],t[1]||e.one)},u.prototype.inspect=function(){return this.isInfinity()?"<EC Point Infinity>":"<EC Point x: "+this.x.fromRed().toString(16,2)+" z: "+this.z.fromRed().toString(16,2)+">"},u.prototype.isInfinity=function(){return 0===this.z.cmpn(0)},u.prototype.dbl=function(){var e=this.x.redAdd(this.z).redSqr(),t=this.x.redSub(this.z).redSqr(),r=e.redSub(t),n=e.redMul(t),i=r.redMul(t.redAdd(this.curve.a24.redMul(r)));return this.curve.point(n,i)},u.prototype.add=function(){throw new Error("Not supported on Montgomery curve")},u.prototype.diffAdd=function(e,t){var r=this.x.redAdd(this.z),n=this.x.redSub(this.z),i=e.x.redAdd(e.z),o=e.x.redSub(e.z).redMul(r),s=i.redMul(n),a=t.z.redMul(o.redAdd(s).redSqr()),u=t.x.redMul(o.redISub(s).redSqr());return this.curve.point(a,u)},u.prototype.mul=function(e){for(var t=e.clone(),r=this,n=this.curve.point(null,null),i=[];0!==t.cmpn(0);t.ishrn(1))i.push(t.andln(1));for(var o=i.length-1;o>=0;o--)0===i[o]?(r=r.diffAdd(n,this),n=n.dbl()):(n=r.diffAdd(n,this),r=r.dbl());return n},u.prototype.mulAdd=function(){throw new Error("Not supported on Montgomery curve")},u.prototype.normalize=function(){return this.x=this.x.redMul(this.z.redInvm()),this.z=this.curve.one,this},u.prototype.getX=function(){return this.normalize(),this.x.fromRed()}},function(e,t,r){"use strict";var n=r(175),i=r(72),o=r(74),s=r(75),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){return this.mOneA?e.redNeg():this.a.redMul(e)},c.prototype._mulC=function(e){return this.oneC?e:this.c.redMul(e)},c.prototype.jpoint=function(e,t,r,n){return this.point(e,t,r,n)},c.prototype.pointFromX=function(e,t){(t=new o(t,16)).red||(t=t.toRed(this.red));var r=t.redSqr(),i=this.c2.redSub(this.a.redMul(r)),s=this.one.redSub(this.c2.redMul(this.d).redMul(r)),a=i.redMul(s.redInvm()).redSqrt(),u=a.fromRed().isOdd();return(e&&!u||!e&&u)&&(a=a.redNeg()),this.point(t,a,n.one)},c.prototype.validate=function(e){if(e.isInfinity())return!0;e.normalize();var t=e.x.redSqr(),r=e.y.redSqr(),n=t.redMul(this.a).redAdd(r),i=this.c2.redMul(this.one.redAdd(this.d.redMul(t).redMul(r)));return 0===n.cmp(i)},s(f,a.BasePoint),c.prototype.pointFromJSON=function(e){return f.fromJSON(this,e)},c.prototype.point=function(e,t,r,n){return new f(this,e,t,r,n)},f.fromJSON=function(e,t){return new f(e,t[0],t[1],t[2])},f.prototype.inspect=function(){return this.isInfinity()?"<EC Point Infinity>":"<EC Point x: "+this.x.fromRed().toString(16,2)+" y: "+this.y.fromRed().toString(16,2)+" z: "+this.z.fromRed().toString(16,2)+">"},f.prototype.isInfinity=function(){return 0===this.x.cmpn(0)&&0===this.y.cmp(this.z)},f.prototype._extDbl=function(){var e=this.x.redSqr(),t=this.y.redSqr(),r=this.z.redSqr();r=r.redIAdd(r);var n=this.curve._mulA(e),i=this.x.redAdd(this.y).redSqr().redISub(e).redISub(t),o=n.redAdd(t),s=o.redSub(r),a=n.redSub(t),u=i.redMul(s),c=o.redMul(a),f=i.redMul(a),l=s.redMul(o);return this.curve.point(u,c,l,f)},f.prototype._projDbl=function(){var e,t,r,n=this.x.redAdd(this.y).redSqr(),i=this.x.redSqr(),o=this.y.redSqr();if(this.curve.twisted){var s=(c=this.curve._mulA(i)).redAdd(o);if(this.zOne)e=n.redSub(i).redSub(o).redMul(s.redSub(this.curve.two)),t=s.redMul(c.redSub(o)),r=s.redSqr().redSub(s).redSub(s);else{var a=this.z.redSqr(),u=s.redSub(a).redISub(a);e=n.redSub(i).redISub(o).redMul(u),t=s.redMul(c.redSub(o)),r=s.redMul(u)}}else{var c=i.redAdd(o);a=this.curve._mulC(this.c.redMul(this.z)).redSqr(),u=c.redSub(a).redSub(a);e=this.curve._mulC(n.redISub(c)).redMul(u),t=this.curve._mulC(c).redMul(i.redISub(o)),r=c.redMul(u)}return this.curve.point(e,t,r)},f.prototype.dbl=function(){return this.isInfinity()?this:this.curve.extended?this._extDbl():this._projDbl()},f.prototype._extAdd=function(e){var t=this.y.redSub(this.x).redMul(e.y.redSub(e.x)),r=this.y.redAdd(this.x).redMul(e.y.redAdd(e.x)),n=this.t.redMul(this.curve.dd).redMul(e.t),i=this.z.redMul(e.z.redAdd(e.z)),o=r.redSub(t),s=i.redSub(n),a=i.redAdd(n),u=r.redAdd(t),c=o.redMul(s),f=a.redMul(u),l=o.redMul(u),h=s.redMul(a);return this.curve.point(c,f,h,l)},f.prototype._projAdd=function(e){var t,r,n=this.z.redMul(e.z),i=n.redSqr(),o=this.x.redMul(e.x),s=this.y.redMul(e.y),a=this.curve.d.redMul(o).redMul(s),u=i.redSub(a),c=i.redAdd(a),f=this.x.redAdd(this.y).redMul(e.x.redAdd(e.y)).redISub(o).redISub(s),l=n.redMul(u).redMul(f);return this.curve.twisted?(t=n.redMul(c).redMul(s.redSub(this.curve._mulA(o))),r=u.redMul(c)):(t=n.redMul(c).redMul(s.redSub(o)),r=this.curve._mulC(u).redMul(c)),this.curve.point(l,t,r)},f.prototype.add=function(e){return this.isInfinity()?e:e.isInfinity()?this:this.curve.extended?this._extAdd(e):this._projAdd(e)},f.prototype.mul=function(e){return this.precomputed&&this.precomputed.doubles?this.curve._fixedNafMul(this,e):this.curve._wnafMul(this,e)},f.prototype.mulAdd=function(e,t,r){return this.curve._wnafMulAdd(1,[this,t],[e,r],2)},f.prototype.normalize=function(){if(this.zOne)return this;var e=this.z.redInvm();return this.x=this.x.redMul(e),this.y=this.y.redMul(e),this.t&&(this.t=this.t.redMul(e)),this.z=this.curve.one,this.zOne=!0,this},f.prototype.neg=function(){return this.curve.point(this.x.redNeg(),this.y,this.z,this.t&&this.t.redNeg())},f.prototype.getX=function(){return this.normalize(),this.x.fromRed()},f.prototype.getY=function(){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,i=t,o=r(109),s=r(72),a=s.utils.assert;function u(e){"short"===e.type?this.curve=new s.curve.short(e):"edwards"===e.type?this.curve=new s.curve.edwards(e):this.curve=new s.curve.mont(e),this.g=this.curve.g,this.n=this.curve.n,this.hash=e.hash,a(this.g.validate(),"Invalid curve"),a(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}function c(e,t){Object.defineProperty(i,e,{configurable:!0,enumerable:!0,get:function(){var r=new u(t);return Object.defineProperty(i,e,{configurable:!0,enumerable:!0,value:r}),r}})}i.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:o.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:o.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:o.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:o.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:o.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});try{n=r(887)}catch(e){n=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:o.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",n]})},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(74),i=r(72),o=i.utils.assert,s=r(889),a=r(890);function u(e){if(!(this instanceof u))return new u(e);"string"==typeof e&&(o(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=u,u.prototype.keyPair=function(e){return new s(this,e)},u.prototype.keyFromPrivate=function(e,t){return s.fromPrivate(this,e,t)},u.prototype.keyFromPublic=function(e,t){return s.fromPublic(this,e,t)},u.prototype.genKeyPair=function(e){e||(e={});for(var t=new i.hmacDRBG({hash:this.hash,pers:e.pers,entropy:e.entropy||i.rand(this.hash.hmacStrength),nonce:this.n.toArray()}),r=this.n.byteLength(),o=this.n.sub(new n(2));;){var s=new n(t.generate(r));if(!(s.cmp(o)>0))return s.iaddn(1),this.keyFromPrivate(s)}},u.prototype._truncateToN=function(e,t){var r=8*e.byteLength()-this.n.bitLength();return r>0&&(e=e.shrn(r)),!t&&e.cmp(this.n)>=0?e.sub(this.n):e},u.prototype.sign=function(e,t,r,o){"object"==typeof r&&(o=r,r=null),o||(o={}),t=this.keyFromPrivate(t,r),e=this._truncateToN(new n(e,16));for(var s=this.n.byteLength(),u=t.getPrivate().toArray(),c=u.length;c<21;c++)u.unshift(0);var f=e.toArray();for(c=f.length;c<s;c++)f.unshift(0);for(var l=new i.hmacDRBG({hash:this.hash,entropy:u,nonce:f}),h=this.n.sub(new n(1));;){var p=new n(l.generate(this.n.byteLength()));if(!((p=this._truncateToN(p,!0)).cmpn(1)<=0||p.cmp(h)>=0)){var d=this.g.mul(p);if(!d.isInfinity()){var y=d.getX().mod(this.n);if(0!==y.cmpn(0)){var g=p.invm(this.n).mul(y.mul(t.getPrivate()).iadd(e)).mod(this.n);if(0!==g.cmpn(0))return o.canonical&&g.cmp(this.nh)>0&&(g=this.n.sub(g)),new a({r:y,s:g})}}}}},u.prototype.verify=function(e,t,r,i){e=this._truncateToN(new n(e,16)),r=this.keyFromPublic(r,i);var o=(t=new a(t,"hex")).r,s=t.s;if(o.cmpn(1)<0||o.cmp(this.n)>=0)return!1;if(s.cmpn(1)<0||s.cmp(this.n)>=0)return!1;var u=s.invm(this.n),c=u.mul(e).mod(this.n),f=u.mul(o).mod(this.n),l=this.g.mulAdd(c,r.getPublic(),f);return!l.isInfinity()&&0===l.getX().mod(this.n).cmp(o)}},function(e,t,r){"use strict";var n=r(74),i=r(72).utils;function o(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=o,o.fromPublic=function(e,t,r){return t instanceof o?t:new o(e,{pub:t,pubEnc:r})},o.fromPrivate=function(e,t,r){return t instanceof o?t:new o(e,{priv:t,privEnc:r})},o.prototype.validate=function(){var e=this.getPublic();return e.isInfinity()?{result:!1,reason:"Invalid public key"}:e.validate()?e.mul(this.ec.curve.n).isInfinity()?{result:!0,reason:null}:{result:!1,reason:"Public key * N != O"}:{result:!1,reason:"Public key is not a point"}},o.prototype.getPublic=function(e,t){if(this.pub||(this.pub=this.ec.g.mul(this.priv)),"string"==typeof e&&(t=e,e=null),!t)return this.pub;for(var r=this.ec.curve.p.byteLength(),n=this.pub.getX().toArray(),o=n.length;o<r;o++)n.unshift(0);if("mont"!==this.ec.curve.type)if(e)a=[this.pub.getY().isEven()?2:3].concat(n);else{var s=this.pub.getY().toArray();for(o=s.length;o<r;o++)s.unshift(0);var a=[4].concat(n,s)}else a=n;return i.encode(a,t)},o.prototype.getPrivate=function(e){return"hex"===e?this.priv.toString(16,2):this.priv},o.prototype._importPrivate=function(e,t){this.priv=new n(e,t||16),this.priv=this.priv.mod(this.ec.curve.n)},o.prototype._importPublic=function(e,t){if(!e.x&&!e.y)return e=i.toArray(e,t),"mont"!==this.ec.curve.type?this._importPublicShort(e):this._importPublicMont(e);this.pub=this.ec.curve.point(e.x,e.y)},o.prototype._importPublicShort=function(e){var t=this.ec.curve.p.byteLength();4===e[0]&&e.length-1==2*t?this.pub=this.ec.curve.point(e.slice(1,1+t),e.slice(1+t,1+2*t)):2!==e[0]&&3!==e[0]||e.length-1!==t||(this.pub=this.ec.curve.pointFromX(3===e[0],e.slice(1,1+t)))},o.prototype._importPublicMont=function(e){this.pub=this.ec.curve.point(e,1)},o.prototype.derive=function(e){return e.mul(this.priv).getX()},o.prototype.sign=function(e){return this.ec.sign(e,this)},o.prototype.verify=function(e,t){return this.ec.verify(e,t,this)},o.prototype.inspect=function(){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(74),i=r(72).utils,o=i.assert;function s(e,t){if(e instanceof s)return e;this._importDER(e,t)||(o(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=s,s.prototype._importDER=function(e,t){if((e=i.toArray(e,t)).length<6||48!==e[0]||2!==e[2])return!1;if(1+e[1]>e.length)return!1;var r=e[3];if(r>=128)return!1;if(4+r+2>=e.length)return!1;if(2!==e[4+r])return!1;var o=e[5+r];return!(o>=128||4+r+2+o>e.length||(this.r=new n(e.slice(4,4+r)),this.s=new n(e.slice(4+r+2,4+r+2+o)),0))},s.prototype.toDER=function(e){var t=this.r.toArray(),r=this.s.toArray();128&t[0]&&(t=[0].concat(t)),128&r[0]&&(r=[0].concat(r));var n=[48,t.length+r.length+4,2,t.length];return n=n.concat(t,[2,r.length],r),i.encode(n,e)}},function(e,t,r){"use strict";(function(t){var n=r(18),i=r(433),o=r(249),s=r(32),a=r(43),u=r(67),c=r(73),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,c=r(178);if(n.isUndefined(o)&&(o=new c),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&&(u=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===u.length)throw new Error("internal error - stack copy empty");var p=u[u.length-1],d=i.fromBuffer(p);return u.pop(),this.initialize(),this.set({script:d,stack:u,tx:o,nin:s,flags:a}),!(!this.evaluate()||(0===u.length?(this.errstr="SCRIPT_ERR_EVAL_FALSE_NO_P2SH_STACK",1):!f.castToBool(u[u.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_BN=new s(f.LOCKTIME_THRESHOLD=5e8),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){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(!u.fromTxFormat(e).hasLowS())return this.errstr="SCRIPT_ERR_SIG_DER_HIGH_S",!1}else if(0!=(this.flags&f.SCRIPT_VERIFY_STRICTENC)&&!u.fromTxFormat(e).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;if(!this.step())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,t,r,l,h,p,d,y,g,m,b,v,_,w,S,k,E,A=0!=(this.flags&f.SCRIPT_VERIFY_MINIMALDATA),x=-1===this.vfExec.indexOf(!1),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(x&&0<=T&&T<=o.OP_PUSHDATA4){if(A&&!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(x||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:h=T-(o.OP_1-1),e=new s(h).toScriptNumBuffer(),this.stack.push(e);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],A,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(k=!1,x){if(this.stack.length<1)return this.errstr="SCRIPT_ERR_UNBALANCED_CONDITIONAL",!1;e=this.stack.pop(),k=f.castToBool(e),T===o.OP_NOTIF&&(k=!k)}this.vfExec.push(k);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(e=this.stack[this.stack.length-1],!(k=f.castToBool(e)))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;t=this.stack[this.stack.length-2],r=this.stack[this.stack.length-1],this.stack.push(t),this.stack.push(r);break;case o.OP_3DUP:if(this.stack.length<3)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;t=this.stack[this.stack.length-3],r=this.stack[this.stack.length-2];var C=this.stack[this.stack.length-1];this.stack.push(t),this.stack.push(r),this.stack.push(C);break;case o.OP_2OVER:if(this.stack.length<4)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;t=this.stack[this.stack.length-4],r=this.stack[this.stack.length-3],this.stack.push(t),this.stack.push(r);break;case o.OP_2ROT:if(this.stack.length<6)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;l=this.stack.splice(this.stack.length-6,2),this.stack.push(l[0]),this.stack.push(l[1]);break;case o.OP_2SWAP:if(this.stack.length<4)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;l=this.stack.splice(this.stack.length-4,2),this.stack.push(l[0]),this.stack.push(l[1]);break;case o.OP_IFDUP:if(this.stack.length<1)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;e=this.stack[this.stack.length-1],(k=f.castToBool(e))&&this.stack.push(e);break;case o.OP_DEPTH:e=new s(this.stack.length).toScriptNumBuffer(),this.stack.push(e);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(e=this.stack[this.stack.length-1],h=(y=s.fromScriptNumBuffer(e,A)).toNumber(),this.stack.pop(),h<0||h>=this.stack.length)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;e=this.stack[this.stack.length-h-1],T===o.OP_ROLL&&this.stack.splice(this.stack.length-h-1,1),this.stack.push(e);break;case o.OP_ROT:if(this.stack.length<3)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;p=this.stack[this.stack.length-3],d=this.stack[this.stack.length-2];var P=this.stack[this.stack.length-1];this.stack[this.stack.length-3]=d,this.stack[this.stack.length-2]=P,this.stack[this.stack.length-1]=p;break;case o.OP_SWAP:if(this.stack.length<2)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;p=this.stack[this.stack.length-2],d=this.stack[this.stack.length-1],this.stack[this.stack.length-2]=d,this.stack[this.stack.length-1]=p;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;y=new s(this.stack[this.stack.length-1].length),this.stack.push(y.toScriptNumBuffer());break;case o.OP_EQUAL:case o.OP_EQUALVERIFY:if(this.stack.length<2)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;t=this.stack[this.stack.length-2],r=this.stack[this.stack.length-1];var O=t.toString("hex")===r.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(e=this.stack[this.stack.length-1],y=s.fromScriptNumBuffer(e,A),T){case o.OP_1ADD:y=y.add(s.One);break;case o.OP_1SUB:y=y.sub(s.One);break;case o.OP_NEGATE:y=y.neg();break;case o.OP_ABS:y.cmp(s.Zero)<0&&(y=y.neg());break;case o.OP_NOT:y=new s((0===y.cmp(s.Zero))+0);break;case o.OP_0NOTEQUAL:y=new s((0!==y.cmp(s.Zero))+0)}this.stack.pop(),this.stack.push(y.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(g=s.fromScriptNumBuffer(this.stack[this.stack.length-2],A),m=s.fromScriptNumBuffer(this.stack[this.stack.length-1],A),y=new s(0),T){case o.OP_ADD:y=g.add(m);break;case o.OP_SUB:y=g.sub(m);break;case o.OP_BOOLAND:y=new s((0!==g.cmp(s.Zero)&&0!==m.cmp(s.Zero))+0);break;case o.OP_BOOLOR:y=new s((0!==g.cmp(s.Zero)||0!==m.cmp(s.Zero))+0);break;case o.OP_NUMEQUAL:case o.OP_NUMEQUALVERIFY:y=new s((0===g.cmp(m))+0);break;case o.OP_NUMNOTEQUAL:y=new s((0!==g.cmp(m))+0);break;case o.OP_LESSTHAN:y=new s((g.cmp(m)<0)+0);break;case o.OP_GREATERTHAN:y=new s((g.cmp(m)>0)+0);break;case o.OP_LESSTHANOREQUAL:y=new s((g.cmp(m)<=0)+0);break;case o.OP_GREATERTHANOREQUAL:y=new s((g.cmp(m)>=0)+0);break;case o.OP_MIN:y=g.cmp(m)<0?g:m;break;case o.OP_MAX:y=g.cmp(m)>0?g:m}if(this.stack.pop(),this.stack.pop(),this.stack.push(y.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;g=s.fromScriptNumBuffer(this.stack[this.stack.length-3],A),m=s.fromScriptNumBuffer(this.stack[this.stack.length-2],A);var R=s.fromScriptNumBuffer(this.stack[this.stack.length-1],A);k=m.cmp(g)<=0&&g.cmp(R)<0,this.stack.pop(),this.stack.pop(),this.stack.pop(),this.stack.push(k?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;e=this.stack[this.stack.length-1],T===o.OP_RIPEMD160?N=a.ripemd160(e):T===o.OP_SHA1?N=a.sha1(e):T===o.OP_SHA256?N=a.sha256(e):T===o.OP_HASH160?N=a.sha256ripemd160(e):T===o.OP_HASH256&&(N=a.sha256sha256(e)),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;b=this.stack[this.stack.length-2],v=this.stack[this.stack.length-1],_=(new i).set({chunks:this.script.chunks.slice(this.pbegincodehash)});var L=(new i).add(b);if(_.findAndDelete(L),!this.checkSignatureEncoding(b)||!this.checkPubkeyEncoding(v))return!1;try{w=u.fromTxFormat(b),S=c.fromBuffer(v,!1),E=this.tx.verifySignature(w,S,this.nin,_)}catch(A){E=!1}if(this.stack.pop(),this.stack.pop(),this.stack.push(E?f.true:f.false),T===o.OP_CHECKSIGVERIFY){if(!E)return this.errstr="SCRIPT_ERR_CHECKSIGVERIFY",!1;this.stack.pop()}break;case o.OP_CHECKMULTISIG:case o.OP_CHECKMULTISIGVERIFY:var K=1;if(this.stack.length<K)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;var j=s.fromScriptNumBuffer(this.stack[this.stack.length-K],A).toNumber();if(j<0||j>20)return this.errstr="SCRIPT_ERR_PUBKEY_COUNT",!1;if(this.nOpCount+=j,this.nOpCount>201)return this.errstr="SCRIPT_ERR_OP_COUNT",!1;var M=++K;if(K+=j,this.stack.length<K)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;var D=s.fromScriptNumBuffer(this.stack[this.stack.length-K],A).toNumber();if(D<0||D>j)return this.errstr="SCRIPT_ERR_SIG_COUNT",!1;var U=++K;if(K+=D,this.stack.length<K)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;_=(new i).set({chunks:this.script.chunks.slice(this.pbegincodehash)});for(var F=0;F<D;F++)b=this.stack[this.stack.length-U-F],_.findAndDelete((new i).add(b));for(E=!0;E&&D>0;){if(b=this.stack[this.stack.length-U],v=this.stack[this.stack.length-M],!this.checkSignatureEncoding(b)||!this.checkPubkeyEncoding(v))return!1;var q;try{w=u.fromTxFormat(b),S=c.fromBuffer(v,!1),q=this.tx.verifySignature(w,S,this.nin,_)}catch(A){q=!1}q&&(U++,D--),M++,D>--j&&(E=!1)}for(;K-- >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(E?f.true:f.false),T===o.OP_CHECKMULTISIGVERIFY){if(!E)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&&0==(r=e[n]<t[n]?-1:e[n]>t[n]?1:0);++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(75),i=r(21),o=(r(24),r(130)),s=r(84),a=r(83),u=r(68),c=r(67),f=r(131);function l(){o.apply(this,arguments)}n(l,o),l.prototype.getSignatures=function(e,t,r,n){i.checkState(this.output instanceof s),n=n||c.SIGHASH_ALL;var o=t.toPublicKey();return o.toString()===this.output.script.getPublicKey().toString("hex")?[new f({publicKey:o,prevTxId:this.prevTxId,outputIndex:this.outputIndex,inputIndex:r,signature:a.sign(e,t,n,r,this.output.script),sigtype:n})]:[]},l.prototype.addSignature=function(e,t){return i.checkState(this.isValidSignature(e,t),"Signature is invalid"),this.setScript(u.buildPublicKeyIn(t.signature.toDER(),t.sigtype)),this},l.prototype.clearSignatures=function(){return this.setScript(u.empty()),this},l.prototype.isFullySigned=function(){return this.script.isPublicKeyIn()},l.SCRIPT_MAX_SIZE=73,l.prototype._estimateSize=function(){return l.SCRIPT_MAX_SIZE},e.exports=l},function(e,t,r){"use strict";var n=r(75),i=r(21),o=r(24),s=r(43),a=r(130),u=r(84),c=r(83),f=r(68),l=r(67),h=r(131);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(18),i=r(75),o=(r(250),r(130)),s=r(84),a=r(21),u=r(68),c=r(67),f=r(83),l=(r(73),r(24)),h=r(131);function p(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")}),a.checkState(u.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){s.publicKeyIndex[e.toString()]=t}),this.threshold=r,this.signatures=i?this._deserializeSignatures(i):new Array(this.publicKeys.length)}i(p,o),p.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},p.prototype._deserializeSignatures=function(e){return n.map(e,function(e){if(e)return new h(e)})},p.prototype._serializeSignatures=function(){return n.map(this.signatures,function(e){if(e)return e.toObject()})},p.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 h({publicKey:t.publicKey,prevTxId:o.prevTxId,outputIndex:o.outputIndex,inputIndex:r,signature:f.sign(e,t,i,r,o.output.script),sigtype:i}))}),u},p.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},p.prototype._updateScript=function(){return this.setScript(u.buildMultisigIn(this.publicKeys,this.threshold,this._createSignatures())),this},p.prototype._createSignatures=function(){return n.map(n.filter(this.signatures,function(e){return!n.isUndefined(e)}),function(e){return l.concat([e.signature.toDER(),l.integerAsSingleByteBuffer(e.sigtype)])})},p.prototype.clearSignatures=function(){this.signatures=new Array(this.publicKeys.length),this._updateScript()},p.prototype.isFullySigned=function(){return this.countSignatures()===this.threshold},p.prototype.countMissingSignatures=function(){return this.threshold-this.countSignatures()},p.prototype.countSignatures=function(){return n.reduce(this.signatures,function(e,t){return e+!!t},0)},p.prototype.publicKeysWithoutSignature=function(){var e=this;return n.filter(this.publicKeys,function(t){return!e.signatures[e.publicKeyIndex[t.toString()]]})},p.prototype.isValidSignature=function(e,t){return t.signature.nhashtype=t.sigtype,f.verify(e,t.signature,t.publicKey,t.inputIndex,this.output.script)},p.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 h({signature:c.fromTxFormat(n),publicKey:i,prevTxId:t.prevTxId,outputIndex:t.outputIndex,inputIndex:r,sigtype:c.SIGHASH_ALL});return s.signature.nhashtype=s.sigtype,!f.verify(e,s.signature,s.publicKey,s.inputIndex,t.output.script)||(o=s,!1)}),o||null})},p.OPCODES_SIZE=1,p.SIGNATURE_SIZE=73,p.prototype._estimateSize=function(){return p.OPCODES_SIZE+this.threshold*p.SIGNATURE_SIZE},e.exports=p},function(e,t,r){"use strict";var n=r(18),i=r(75),o=r(130),s=r(84),a=r(21),u=r(68),c=r(67),f=r(83),l=(r(73),r(24)),h=r(131);function p(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(p,o),p.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},p.prototype._deserializeSignatures=function(e){return n.map(e,function(e){if(e)return new h(e)})},p.prototype._serializeSignatures=function(){return n.map(this.signatures,function(e){if(e)return e.toObject()})},p.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 h({publicKey:t.publicKey,prevTxId:o.prevTxId,outputIndex:o.outputIndex,inputIndex:r,signature:f.sign(e,t,i,r,o.redeemScript),sigtype:i}))}),u},p.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},p.prototype._updateScript=function(){return this.setScript(u.buildP2SHMultisigIn(this.publicKeys,this.threshold,this._createSignatures(),{cachedMultisig:this.redeemScript})),this},p.prototype._createSignatures=function(){return n.map(n.filter(this.signatures,function(e){return!n.isUndefined(e)}),function(e){return l.concat([e.signature.toDER(),l.integerAsSingleByteBuffer(e.sigtype)])})},p.prototype.clearSignatures=function(){this.signatures=new Array(this.publicKeys.length),this._updateScript()},p.prototype.isFullySigned=function(){return this.countSignatures()===this.threshold},p.prototype.countMissingSignatures=function(){return this.threshold-this.countSignatures()},p.prototype.countSignatures=function(){return n.reduce(this.signatures,function(e,t){return e+!!t},0)},p.prototype.publicKeysWithoutSignature=function(){var e=this;return n.filter(this.publicKeys,function(t){return!e.signatures[e.publicKeyIndex[t.toString()]]})},p.prototype.isValidSignature=function(e,t){return t.signature.nhashtype=t.sigtype,f.verify(e,t.signature,t.publicKey,t.inputIndex,this.redeemScript)},p.OPCODES_SIZE=7,p.SIGNATURE_SIZE=74,p.PUBKEY_SIZE=34,p.prototype._estimateSize=function(){return p.OPCODES_SIZE+this.threshold*p.SIGNATURE_SIZE+this.publicKeys.length*p.PUBKEY_SIZE},e.exports=p},function(e,t,r){"use strict";var n=r(18),i=r(21),o=r(32),s=r(0),a=r(55),u=r(24),c=r(29),f=r(898);function l(e){return this instanceof l?(this.nullifiers=[],this.commitments=[],this.ciphertexts=[],this.macs=[],e?this._fromObject(e):void 0):new l(e)}Object.defineProperty(l.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(l.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")}}),l.fromObject=function(e){return i.checkArgument(n.isObject(e)),(new l)._fromObject(e)},l.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},l.prototype.toObject=l.prototype.toJSON=function(){var e=[];n.each(this.nullifiers,function(t){e.push(u.reverse(t).toString("hex"))});var t=[];n.each(this.commitments,function(e){t.push(u.reverse(e).toString("hex"))});var r=[];n.each(this.ciphertexts,function(e){r.push(e.toString("hex"))});var i=[];return n.each(this.macs,function(e){i.push(u.reverse(e).toString("hex"))}),{vpub_old:this.vpub_old,vpub_new:this.vpub_new,anchor:u.reverse(this.anchor).toString("hex"),nullifiers:e,commitments:t,ephemeralKey:u.reverse(this.ephemeralKey).toString("hex"),ciphertexts:r,randomSeed:u.reverse(this.randomSeed).toString("hex"),macs:i,proof:this.proof.toObject()}},l.fromBufferReader=function(e){var t,r=new l;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},l.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=l},function(e,t,r){"use strict";var n=r(21),i=r(0),o=r(55);function s(e){return this instanceof s?e?this._fromObject(e):void 0:new s(e)}function a(e){return this instanceof a?e?this._fromObject(e):void 0:new a(e)}function u(e){return this instanceof u?e?this._fromObject(e):void 0:new u(e)}s.fromObject=function(e){return n.checkArgument(_.isObject(e)),(new s)._fromObject(e)},s.prototype._fromObject=function(e){return this.y_lsb=e.y_lsb,this.x=new i.Buffer(e.x,"hex"),this},s.prototype.toObject=s.prototype.toJSON=function(){return{y_lsb:this.y_lsb,x:this.x.toString("hex")}},s.fromBufferReader=function(e){var t=new s,r=e.readUInt8();return t.y_lsb=1&r,t.x=e.read(32),t},s.prototype.toBufferWriter=function(e){return e||(e=new o),e.writeUInt8(2|this.y_lsb),e.write(this.x),e},a.fromObject=function(e){return n.checkArgument(_.isObject(e)),(new a)._fromObject(e)},a.prototype._fromObject=function(e){return this.y_gt=e.y_gt,this.x=new i.Buffer(e.x,"hex"),this},a.prototype.toObject=a.prototype.toJSON=function(){return{y_gt:this.y_gt,x:this.x.toString("hex")}},a.fromBufferReader=function(e){var t=new a,r=e.readUInt8();return t.y_gt=1&r,t.x=e.read(64),t},a.prototype.toBufferWriter=function(e){return e||(e=new o),e.writeUInt8(10|this.y_gt),e.write(this.x),e},u.fromObject=function(e){return n.checkArgument(_.isObject(e)),(new u)._fromObject(e)},u.prototype._fromObject=function(e){return this.g_A=s.fromObject(e.g_A),this.g_A_prime=s.fromObject(e.g_A_prime),this.g_B=a.fromObject(e.g_B),this.g_B_prime=s.fromObject(e.g_B_prime),this.g_C=s.fromObject(e.g_C),this.g_C_prime=s.fromObject(e.g_C_prime),this.g_K=s.fromObject(e.g_K),this.g_H=s.fromObject(e.g_H),this},u.prototype.toObject=u.prototype.toJSON=function(){return{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()}},u.fromBufferReader=function(e){var t=new u;return t.g_A=s.fromBufferReader(e),t.g_A_prime=s.fromBufferReader(e),t.g_B=a.fromBufferReader(e),t.g_B_prime=s.fromBufferReader(e),t.g_C=s.fromBufferReader(e),t.g_C_prime=s.fromBufferReader(e),t.g_K=s.fromBufferReader(e),t.g_H=s.fromBufferReader(e),t},u.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=u},function(e,t,r){"use strict";(function(t){var n=r(55),i=r(82),o=r(32),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(901),e.exports.BlockHeader=r(180),e.exports.MerkleBlock=r(435)},function(e,t,r){"use strict";(function(t){var n=r(18),i=r(180),o=r(32),s=r(24),a=r(82),u=r(55),c=r(43),f=r(178),l=r(21);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){var t={};if(s.isBuffer(e))t=h._fromBufferReader(a(e));else{if(!n.isObject(e))throw new TypeError("Unrecognized argument for Block");t=h._fromObject(e)}return t},h._fromObject=function(e){var t=[];return e.transactions.forEach(function(e){e instanceof f?t.push(e):t.push(f().fromObject(e))}),{header:i.fromObject(e.header),transactions:t}},h.fromObject=function(e){return new h(h._fromObject(e))},h._fromBufferReader=function(e){var t={};l.checkState(!e.finished(),"No block data received"),t.header=i.fromBufferReader(e);var r=e.readVarintNum();t.transactions=[];for(var n=0;n<r;n++)t.transactions.push(f().fromBufferReader(e));return t},h.fromBufferReader=function(e){return l.checkArgument(e,"br is required"),new h(h._fromBufferReader(e))},h.fromBuffer=function(e){return h.fromBufferReader(new a(e))},h.fromString=function(e){var r=new t(e,"hex");return h.fromBuffer(r)},h.fromRawBlock=function(e){s.isBuffer(e)||(e=new t(e,"binary"));var r=a(e);return r.pos=h.Values.START_OF_BLOCK,new h(h._fromBufferReader(r))},h.prototype.toObject=h.prototype.toJSON=function(){var e=[];return this.transactions.forEach(function(t){e.push(t.toObject())}),{header:this.header.toObject(),transactions:e}},h.prototype.toBuffer=function(){return this.toBufferWriter().concat()},h.prototype.toString=function(){return this.toBuffer().toString("hex")},h.prototype.toBufferWriter=function(e){e||(e=new u),e.write(this.header.toBuffer()),e.writeVarintNum(this.transactions.length);for(var t=0;t<this.transactions.length;t++)this.transactions[t].toBufferWriter(e);return e},h.prototype.getTransactionHashes=function(){var e=[];if(0===this.transactions.length)return[h.Values.NULL_HASH];for(var t=0;t<this.transactions.length;t++)e.push(this.transactions[t]._getHash());return e},h.prototype.getMerkleTree=function(){for(var e=this.getTransactionHashes(),r=0,n=this.transactions.length;n>1;n=Math.floor((n+1)/2)){for(var i=0;i<n;i+=2){var o=Math.min(i+1,n-1),s=t.concat([e[r+i],e[r+o]]);e.push(c.sha256sha256(s))}r+=n}return e},h.prototype.getMerkleRoot=function(){var e=this.getMerkleTree();return e[e.length-1]},h.prototype.validMerkleRoot=function(){var e=new o(this.header.merkleRoot.toString("hex"),"hex"),t=new o(this.getMerkleRoot().toString("hex"),"hex");return 0===e.cmp(t)},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(){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(18),i=r(33),o=r(97),s=r(252),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){if("string"!=typeof e)throw new TypeError("Expected a string");return new a(e)},a.fromObject=function(e){return new a(e)},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);(a.Members.indexOf(t)>-1?this:this.extras)[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(){for(var e={},t=0;t<a.Members.length;t++){var r=a.Members[t];this.hasOwnProperty(r)&&void 0!==this[r]&&(e[r]=this[r].toString())}return n.extend(e,this.extras),e},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(905),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);r(null,{encrypt(e,t){t(null,s.update(e))},decrypt(e,t){t(null,a.update(e))}})}},function(e,t,r){"use strict";const n=r(57);e.exports={createCipheriv:n.createCipheriv,createDecipheriv:n.createDecipheriv}},function(e,t,r){var n=r(439),i=r(443),o=r(2).Buffer,s=r(444),a=r(92),u=r(181),c=r(445);function f(e,t,r){a.call(this),this._cache=new h,this._cipher=new u.AES(t),this._prev=o.from(r),this._mode=e,this._autopadding=!0}r(5)(f,a),f.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 l=o.alloc(16,16);function h(){this.cache=o.allocUnsafe(0)}function p(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 f(a.module,t,r)}f.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(l))throw this._cipher.scrub(),new Error("data not multiple of block length")},f.prototype.setAutoPadding=function(e){return this._autopadding=!!e,this},h.prototype.add=function(e){this.cache=o.concat([this.cache,e])},h.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},h.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=p,t.createCipher=function(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 p(e,i.key,i.iv)}},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(132);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(132);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,s=n.allocUnsafe(0);t.length;){if(0===e._cache.length&&(e._cache=e._cipher.encryptBlock(e._prev),e._prev=n.allocUnsafe(0)),!(e._cache.length<=t.length)){s=n.concat([s,o(e,t,r)]);break}i=e._cache.length,s=n.concat([s,o(e,t.slice(0,i),r)]),t=t.slice(i)}return s}},function(e,t,r){var n=r(2).Buffer;function i(e,t,r){var i=e._cipher.encryptBlock(e._prev)[0]^t;return e._prev=n.concat([e._prev.slice(1),n.from([r?t:i])]),i}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,s,a=-1,u=0;++a<8;)n=e._cipher.encryptBlock(e._prev),i=t&1<<7-a?128:0,u+=(128&(s=n[0]^i))>>a%8,e._prev=o(e._prev,r?i:s);return u}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(132);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){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 s(e){this.h=e,this.state=n.alloc(16,0),this.cache=n.allocUnsafe(0)}s.prototype.ghash=function(e){for(var t=-1;++t<e.length;)this.state[t]^=e[t];this._multiply()},s.prototype._multiply=function(){for(var e,t,r=function(e){return[e.readUInt32BE(0),e.readUInt32BE(4),e.readUInt32BE(8),e.readUInt32BE(12)]}(this.h),n=[0,0,0,0],i=-1;++i<128;){for(0!=(this.state[~~(i/8)]&1<<7-i%8)&&(n[0]^=r[0],n[1]^=r[1],n[2]^=r[2],n[3]^=r[3]),t=0!=(1&r[3]),e=3;e>0;e--)r[e]=r[e]>>>1|(1&r[e-1])<<31;r[0]=r[0]>>>1,t&&(r[0]=r[0]^225<<24)}this.state=o(n)},s.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)},s.prototype.final=function(e,t){return this.cache.length&&this.ghash(n.concat([this.cache,i],16)),this.ghash(o([0,e,0,t])),this.state},e.exports=s},function(e,t,r){var n=r(443),i=r(2).Buffer,o=r(439),s=r(444),a=r(92),u=r(181),c=r(445);function f(e,t,r){a.call(this),this._cache=new l,this._last=void 0,this._cipher=new u.AES(t),this._prev=i.from(r),this._mode=e,this._autopadding=!0}function l(){this.cache=i.allocUnsafe(0)}function h(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 f(a.module,t,r)}r(5)(f,a),f.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)},f.prototype._final=function(){var e=this._cache.flush();if(this._autopadding)return function(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)}(this._mode.decrypt(this,e));if(e)throw new Error("data not multiple of block length")},f.prototype.setAutoPadding=function(e){return this._autopadding=!!e,this},l.prototype.add=function(e){this.cache=i.concat([this.cache,e])},l.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},l.prototype.flush=function(){if(this.cache.length)return this.cache},t.createDecipher=function(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 h(e,n.key,n.iv)},t.createDecipheriv=h},function(e,t,r){"use strict";(function(n){const i=r(10)(r(256)),o=r(16);t=e.exports;const s={rsa:r(925),ed25519:r(939),secp256k1:r(59)(i,r(474))};function a(e){return void 0!==s[e.toLowerCase()]}t.supportedKeys=s,t.keysPBM=i,t.keyStretcher=r(952),t.generateEphemeralKeyPair=r(953),t.generateKeyPair=((e,t,r)=>{let n=s[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=s[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=i.PublicKey.decode(e),r=t.Data;switch(t.Type){case i.KeyType.RSA:return s.rsa.unmarshalRsaPublicKey(r);case i.KeyType.Ed25519:return s.ed25519.unmarshalEd25519PublicKey(r);case i.KeyType.Secp256k1:if(s.secp256k1)return s.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(!a(t=(t||"rsa").toLowerCase()))throw new Error("invalid or unsupported key type");return e.bytes}),t.unmarshalPrivateKey=((e,t)=>{let r;try{r=i.PrivateKey.decode(e)}catch(e){return t(e)}const n=r.Data;switch(r.Type){case i.KeyType.RSA:return s.rsa.unmarshalRsaPrivateKey(n,t);case i.KeyType.Ed25519:return s.ed25519.unmarshalEd25519PrivateKey(n,t);case i.KeyType.Secp256k1:return s.secp256k1?s.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(!a(t=(t||"rsa").toLowerCase()))throw new Error("invalid or unsupported key type");return e.bytes}),t.import=((e,t,r)=>{try{const i=o.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 a=o.asn1.toDer(o.pki.privateKeyToAsn1(i));return a=n.from(a.getBytes(),"binary"),s.rsa.unmarshalRsaPrivateKey(a,r)}catch(e){r(e)}})}).call(this,r(0).Buffer)},function(e,t,r){(function(t){var r={};e.exports=r;var n={};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 i=0,o=t.length,s=t.charAt(0),a=[0];for(i=0;i<e.length;++i){for(var u=0,c=e[i];u<a.length;++u)c+=a[u]<<8,a[u]=c%o,c=c/o|0;for(;c>0;)a.push(c%o),c=c/o|0}for(i=0;0===e[i]&&i<e.length-1;++i)n+=s;for(i=a.length-1;i>=0;--i)n+=t[a[i]]}else n=function(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}(e,t);if(r){var f=new RegExp(".{1,"+r+"}","g");n=n.match(f).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,"");var s=r.length,a=r.charAt(0),u=[0];for(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(13);r(98),r(447);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=c,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,o=!1,s=t.macFunction(t.macKey,t.sequenceNumber,e);e.fragment.putBytes(s),t.updateSequenceNumber(),r=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:r}),e.version.minor>=i.Versions.TLS_1_1.minor&&u.output.putBytes(r),u.update(e.fragment),u.finish(a)&&(e.fragment=u.output,e.length=e.fragment.length(),o=!0),o}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};function c(e,t){var r,o=!1;0,r=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:r}),s.update(e.fragment),o=s.finish(u);var a=t.macLength,c=n.random.getBytesSync(a),f=s.output.length();f>=a?(e.fragment=s.output.getBytes(f-a),c=s.output.getBytes(a)):e.fragment=s.output.getBytes(),e.fragment=n.util.createBuffer(e.fragment),e.length=e.fragment.length();var l=t.macFunction(t.macKey,t.sequenceNumber,e);return t.updateSequenceNumber(),function(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),t===(r=i.digest().getBytes())}(t.macKey,c,l)&&o}},function(e,t,r){var n=r(13);r(458),e.exports=n.mgf=n.mgf||{},n.mgf.mgf1=n.mgf1},function(e,t,r){(function(t){var n=r(13);if(r(184),r(69),r(460),r(19),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){var t=(e=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 function(e,t){var r,n=[R(),R(),R(),R()],i=m(t,32);for(i[0]&=248,i[31]&=127,i[31]|=64,B(n,i),S(e,n),r=0;r<32;++r)t[r+32]=e[r]}(r,i),{publicKey:r,privateKey:i}},a.publicKeyFromPrivateKey=function(e){var t=u({message:(e=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){var t=u(e=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);!function(e,t,r,n){var i,o,s=new Float64Array(64),a=[R(),R(),R(),R()],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(v(f),B(a,f),S(e,a),i=32;i<64;++i)e[i]=n[i];var l=m(e,r+64);for(v(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];b(e.subarray(32),s)}(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){var t=u(e=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,o=new s(a.constants.SIGN_BYTE_LENGTH+t.length),c=new s(a.constants.SIGN_BYTE_LENGTH+t.length);for(i=0;i<a.constants.SIGN_BYTE_LENGTH;++i)o[i]=r[i];for(i=0;i<t.length;++i)o[i+a.constants.SIGN_BYTE_LENGTH]=t[i];return function(e,t,r,n){var i,o=new s(32),a=[R(),R(),R(),R()],u=[R(),R(),R(),R()];if(-1,r<64)return-1;if(E(u,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 c=m(e,r);if(v(c),T(a,u,c),B(u,t.subarray(32)),_(a,u),S(o,a),r-=64,x(t,0,o,0)){for(i=0;i<r;++i)e[i]=0;return-1}for(i=0;i<r;++i)e[i]=t[i+64];return r}(c,o,o.length,n)>=0};var c=R(),f=R([1]),l=R([30883,4953,19914,30187,55467,16705,2637,112,59544,30585,16505,36039,65139,11119,27886,20995]),h=R([61785,9906,39828,60374,45398,33411,5274,224,53552,61171,33010,6542,64743,22239,55772,9222]),p=R([54554,36645,11616,51542,42930,38181,51040,26924,56412,64982,57905,49316,21502,52590,14035,8553]),d=R([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=R([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,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 v(e){for(var t=new Float64Array(64),r=0;r<64;++r)t[r]=e[r],e[r]=0;b(e,t)}function _(e,t){var r=R(),n=R(),i=R(),o=R(),s=R(),a=R(),u=R(),c=R(),f=R();L(r,e[1],e[0]),L(f,t[1],t[0]),j(r,r,f),N(n,e[0],e[1]),N(f,t[0],t[1]),j(n,n,f),j(i,e[3],t[3]),j(i,i,h),j(o,e[2],t[2]),N(o,o,o),L(s,n,r),L(a,o,i),N(u,o,i),N(c,n,r),j(e[0],s,a),j(e[1],c,u),j(e[2],u,a),j(e[3],s,c)}function w(e,t,r){for(var n=0;n<4;++n)O(e[n],t[n],r)}function S(e,t){var r=R(),n=R(),i=R();(function(e,t){var r,n=R();for(r=0;r<16;++r)n[r]=t[r];for(r=253;r>=0;--r)K(n,n),2!==r&&4!==r&&j(n,n,t);for(r=0;r<16;++r)e[r]=n[r]})(i,t[2]),j(r,t[0],i),j(n,t[1],i),k(e,n),e[31]^=I(r)<<7}function k(e,t){var r,n,i,o=R(),s=R();for(r=0;r<16;++r)s[r]=t[r];for(P(s),P(s),P(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,O(s,o,1-i)}for(r=0;r<16;r++)e[2*r]=255&s[r],e[2*r+1]=s[r]>>8}function E(e,t){var r=R(),n=R(),i=R(),o=R(),s=R(),a=R(),u=R();return C(e[2],f),function(e,t){var r;for(r=0;r<16;++r)e[r]=t[2*r]+(t[2*r+1]<<8);e[15]&=32767}(e[1],t),K(i,e[1]),j(o,i,l),L(i,i,e[2]),N(o,e[2],o),K(s,o),K(a,s),j(u,a,s),j(r,u,i),j(r,r,o),function(e,t){var r,n=R();for(r=0;r<16;++r)n[r]=t[r];for(r=250;r>=0;--r)K(n,n),1!==r&&j(n,n,t);for(r=0;r<16;++r)e[r]=n[r]}(r,r),j(r,r,i),j(r,r,o),j(r,r,o),j(e[0],r,o),K(n,e[0]),j(n,n,o),A(n,i)&&j(e[0],e[0],g),K(n,e[0]),j(n,n,o),A(n,i)?-1:(I(e[0])===t[31]>>7&&L(e[0],c,e[0]),j(e[3],e[0],e[1]),0)}function A(e,t){var r=new s(32),n=new s(32);return k(r,e),k(n,t),x(r,0,n,0)}function x(e,t,r,n){return function(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}(e,t,r,n,32)}function I(e){var t=new s(32);return k(t,e),1&t[0]}function T(e,t,r){var n,i;for(C(e[0],c),C(e[1],f),C(e[2],f),C(e[3],c),i=255;i>=0;--i)w(e,t,n=r[i/8|0]>>(7&i)&1),_(t,e),_(e,e),w(e,t,n)}function B(e,t){var r=[R(),R(),R(),R()];C(r[0],p),C(r[1],d),C(r[2],f),j(r[3],p,d),T(e,r,t)}function C(e,t){var r;for(r=0;r<16;r++)e[r]=0|t[r]}function P(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 O(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 R(e){var t,r=new Float64Array(16);if(e)for(t=0;t<e.length;++t)r[t]=e[t];return r}function N(e,t,r){for(var n=0;n<16;++n)e[n]=t[n]+r[n]}function L(e,t,r){for(var n=0;n<16;++n)e[n]=t[n]-r[n]}function K(e,t){j(e,t,t)}function j(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,K=r[0],j=r[1],M=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];o+=(n=t[0])*K,s+=n*j,a+=n*M,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,s+=(n=t[1])*K,a+=n*j,u+=n*M,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,a+=(n=t[2])*K,u+=n*j,c+=n*M,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,u+=(n=t[3])*K,c+=n*j,f+=n*M,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,c+=(n=t[4])*K,f+=n*j,l+=n*M,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,f+=(n=t[5])*K,l+=n*j,h+=n*M,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,l+=(n=t[6])*K,h+=n*j,p+=n*M,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,h+=(n=t[7])*K,p+=n*j,d+=n*M,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,p+=(n=t[8])*K,d+=n*j,y+=n*M,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,d+=(n=t[9])*K,y+=n*j,g+=n*M,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,y+=(n=t[10])*K,g+=n*j,m+=n*M,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,g+=(n=t[11])*K,m+=n*j,b+=n*M,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,m+=(n=t[12])*K,b+=n*j,v+=n*M,_+=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,b+=(n=t[13])*K,v+=n*j,_+=n*M,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,v+=(n=t[14])*K,_+=n*j,w+=n*M,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])*K,s+=38*(S+=n*M),a+=38*(k+=n*D),u+=38*(E+=n*U),c+=38*(A+=n*F),f+=38*(x+=n*q),l+=38*(I+=n*H),h+=38*(T+=n*z),p+=38*(B+=n*V),d+=38*(C+=n*G),y+=38*(P+=n*W),g+=38*(O+=n*$),m+=38*(R+=n*Y),b+=38*(N+=n*J),v+=38*(L+=n*X),o=(n=(o+=38*(w+=n*j))+(i=1)+65535)-65536*(i=Math.floor(n/65536)),s=(n=s+i+65535)-65536*(i=Math.floor(n/65536)),a=(n=a+i+65535)-65536*(i=Math.floor(n/65536)),u=(n=u+i+65535)-65536*(i=Math.floor(n/65536)),c=(n=c+i+65535)-65536*(i=Math.floor(n/65536)),f=(n=f+i+65535)-65536*(i=Math.floor(n/65536)),l=(n=l+i+65535)-65536*(i=Math.floor(n/65536)),h=(n=h+i+65535)-65536*(i=Math.floor(n/65536)),p=(n=p+i+65535)-65536*(i=Math.floor(n/65536)),d=(n=d+i+65535)-65536*(i=Math.floor(n/65536)),y=(n=y+i+65535)-65536*(i=Math.floor(n/65536)),g=(n=g+i+65535)-65536*(i=Math.floor(n/65536)),m=(n=m+i+65535)-65536*(i=Math.floor(n/65536)),b=(n=b+i+65535)-65536*(i=Math.floor(n/65536)),v=(n=v+i+65535)-65536*(i=Math.floor(n/65536)),_=(n=_+i+65535)-65536*(i=Math.floor(n/65536)),o=(n=(o+=i-1+37*(i-1))+(i=1)+65535)-65536*(i=Math.floor(n/65536)),s=(n=s+i+65535)-65536*(i=Math.floor(n/65536)),a=(n=a+i+65535)-65536*(i=Math.floor(n/65536)),u=(n=u+i+65535)-65536*(i=Math.floor(n/65536)),c=(n=c+i+65535)-65536*(i=Math.floor(n/65536)),f=(n=f+i+65535)-65536*(i=Math.floor(n/65536)),l=(n=l+i+65535)-65536*(i=Math.floor(n/65536)),h=(n=h+i+65535)-65536*(i=Math.floor(n/65536)),p=(n=p+i+65535)-65536*(i=Math.floor(n/65536)),d=(n=d+i+65535)-65536*(i=Math.floor(n/65536)),y=(n=y+i+65535)-65536*(i=Math.floor(n/65536)),g=(n=g+i+65535)-65536*(i=Math.floor(n/65536)),m=(n=m+i+65535)-65536*(i=Math.floor(n/65536)),b=(n=b+i+65535)-65536*(i=Math.floor(n/65536)),v=(n=v+i+65535)-65536*(i=Math.floor(n/65536)),_=(n=_+i+65535)-65536*(i=Math.floor(n/65536)),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(13);r(19),r(69),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){var r=(t=t||{}).prng||n.random;return{encrypt:function(t,o){var s,a=Math.ceil(t.n.bitLength()/8);do{s=new i(n.util.bytesToHex(r.getBytesSync(a)),16).mod(t.n)}while(s.equals(i.ZERO));var u=a-(s=n.util.hexToBytes(s.toString(16))).length;return u>0&&(s=n.util.fillString(String.fromCharCode(0),u)+s),{encapsulation:t.encrypt(s,"NONE"),key:e.generate(s,o)}},decrypt:function(t,r,n){var i=t.decrypt(r,"NONE");return e.generate(i,n)}}},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(77),r(258),r(134),r(451),r(460)},function(e,t,r){var n=r(13);r(98),r(76),r(182),r(99),r(112),r(457),r(69),r(19),r(260);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){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(f(s))}t.value.push(r)}return t}function c(e){for(var t=[],r=0;r<e.length;++r)t.push(u(e[r]));return t}function f(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 l(e,t,r){var o={};if(!i.validate(t,r,o,[])){var s=new Error("Cannot read PKCS#7 message. ASN.1 object is not a supported PKCS#7 message.");throw s.errors=s,s}if(i.derToOid(o.contentType)!==n.pki.oids.data)throw new Error("Unsupported PKCS#7 message. Only wrapped ContentType Data supported.");if(o.encryptedContent){var a="";if(n.util.isArray(o.encryptedContent))for(var u=0;u<o.encryptedContent.length;++u){if(o.encryptedContent[u].type!==i.Type.OCTETSTRING)throw new Error("Malformed PKCS#7 message, expecting encrypted content constructed of only OCTET STRING objects.");a+=o.encryptedContent[u].value}else a=o.encryptedContent;e.encryptedContent={algorithm:i.derToOid(o.encAlgorithm),parameter:n.util.createBuffer(o.encParameter.value),content:n.util.createBuffer(a)}}if(o.content){a="";if(n.util.isArray(o.content))for(u=0;u<o.content.length;++u){if(o.content[u].type!==i.Type.OCTETSTRING)throw new Error("Malformed PKCS#7 message, expecting content constructed of only OCTET STRING objects.");a+=o.content[u].value}else a=o.content;e.content=n.util.createBuffer(a)}return e.version=o.version.charCodeAt(0),e.rawCapture=o,o}function h(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,u=i.derToOid(t.contentType);switch(u){case n.pki.oids.envelopedData:a=o.createEnvelopedData();break;case n.pki.oids.encryptedData:a=o.createEncryptedData();break;case n.pki.oids.signedData:a=o.createSignedData();break;default:throw new Error("Cannot read PKCS#7 message. ContentType with OID "+u+" is not (yet) supported.")}return a.fromAsn1(t.content.value[0]),a},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(l(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(){var t;"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?t=e.content.bytes():"string"==typeof e.content&&(t=n.util.encodeUtf8(e.content)),e.contentInfo.value.push(i.create(i.Class.CONTEXT_SPECIFIC,0,!0,[i.create(i.Class.UNIVERSAL,i.Type.OCTETSTRING,!1,t)])))),0!==e.signers.length&&function(t){if(e.contentInfo.value.length<2)throw new Error("Could not sign PKCS#7 message; there is no content to sign.");var r=i.derToOid(e.contentInfo.value[0].value),o=e.contentInfo.value[1];o=o.value[0];var s=i.toDer(o);for(var a in s.getByte(),i.getBerValueLength(s),s=s.getBytes(),t)t[a].start().update(s);for(var u=new Date,l=0;l<e.signers.length;++l){var h=e.signers[l];if(0===h.authenticatedAttributes.length){if(r!==n.pki.oids.data)throw new Error("Invalid signer; authenticatedAttributes must be present when the ContentInfo content type is not PKCS#7 Data.")}else{h.authenticatedAttributesAsn1=i.create(i.Class.CONTEXT_SPECIFIC,0,!0,[]);for(var p=i.create(i.Class.UNIVERSAL,i.Type.SET,!0,[]),d=0;d<h.authenticatedAttributes.length;++d){var y=h.authenticatedAttributes[d];y.type===n.pki.oids.messageDigest?y.value=t[h.digestAlgorithm].digest():y.type===n.pki.oids.signingTime&&(y.value||(y.value=u)),p.value.push(f(y)),h.authenticatedAttributesAsn1.value.push(f(y))}s=i.toDer(p).getBytes(),h.md.start().update(s)}h.signature=h.key.sign(h.md,"RSASSA-PKCS1-V1_5")}e.signerInfos=c(e.signers)}(function(){for(var t={},r=0;r<e.signers.length;++r){var o=e.signers[r];(s=o.digestAlgorithm)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}())},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.")}}},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){l(e,t,o.asn1.encryptedDataValidator)},decrypt:function(t){void 0!==t&&(e.encryptedContent.key=t),h(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=l(e,t,o.asn1.envelopedDataValidator);e.recipients=function(e){for(var t=[],r=0;r<e.length;++r)t.push(s(e[r]));return t}(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,function(e){for(var t=[],r=0;r<e.length;++r)t.push(a(e[r]));return t}(e.recipients)),i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,function(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())])]}(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)}h(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)}}}}}},function(e,t,r){var n=r(13);r(98),r(133),r(258),r(134),r(19);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||"";var i=""===(t=t||"")?"none":"aes256-cbc",u="PuTTY-User-Key-File-2: ssh-rsa\r\n";u+="Encryption: "+i+"\r\n",u+="Comment: "+r+"\r\n";var c=n.util.createBuffer();s(c,"ssh-rsa"),o(c,e.e),o(c,e.n);var f=n.util.encode64(c.bytes(),64),l=Math.floor(f.length/66)+1;u+="Public-Lines: "+l+"\r\n",u+=f;var h,p=n.util.createBuffer();if(o(p,e.d),o(p,e.p),o(p,e.q),o(p,e.qInv),t){var d=p.length()+16-1;d-=d%16;var y=a(p.bytes());y.truncate(y.length()-d+p.length()),p.putBuffer(y);var g=n.util.createBuffer();g.putBuffer(a("\0\0\0\0",t)),g.putBuffer(a("\0\0\0",t));var m=n.aes.createEncryptionCipher(g.truncate(8),"CBC");m.start(n.util.createBuffer().fillWithByte(0,16)),m.update(p.copy()),m.finish();var b=m.output;b.truncate(16),h=n.util.encode64(b.bytes(),64)}else h=n.util.encode64(p.bytes(),64);u+="\r\nPrivate-Lines: "+(l=Math.floor(h.length/66)+1)+"\r\n",u+=h;var v=a("putty-private-key-file-mac-key",t),_=n.util.createBuffer();s(_,"ssh-rsa"),s(_,i),s(_,r),_.putInt32(c.length()),_.putBuffer(c),_.putInt32(p.length()),_.putBuffer(p);var w=n.hmac.create();return w.start("sha1",v),w.update(_.bytes()),u+"\r\nPrivate-MAC: "+w.digest().toHex()+"\r\n"},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){var r=(t=t||{}).md||n.md.md5.create(),i=n.util.createBuffer();s(i,"ssh-rsa"),o(i,e.e),o(i,e.n),r.start(),r.update(i.getBytes());var a=r.digest();if("hex"===t.encoding){var u=a.toHex();return t.delimiter?u.match(/.{2}/g).join(t.delimiter):u}if("binary"===t.encoding)return a.getBytes();if(t.encoding)throw new Error('Unknown encoding "'+t.encoding+'".');return a}},function(e,t,r){var n=r(13);r(459),r(461),r(19);var i="forge.task",o={},s=0;n.debug.set(i,"tasks",o);var a={};n.debug.set(i,"queues",a);var u="ready",c="running",f="blocked",l="sleeping",h="done",p="error",d={ready:{}};d.ready.stop=u,d.ready.start=c,d.ready.cancel=h,d.ready.fail=p,d.running={},d.running.stop=u,d.running.start=c,d.running.block=f,d.running.unblock=c,d.running.sleep=l,d.running.wakeup=c,d.running.cancel=h,d.running.fail=p,d.blocked={},d.blocked.stop=f,d.blocked.start=f,d.blocked.block=f,d.blocked.unblock=f,d.blocked.sleep=f,d.blocked.wakeup=f,d.blocked.cancel=h,d.blocked.fail=p,d.sleeping={},d.sleeping.stop=l,d.sleeping.start=l,d.sleeping.block=l,d.sleeping.unblock=l,d.sleeping.sleep=l,d.sleeping.wakeup=l,d.sleeping.cancel=h,d.sleeping.fail=p,d.done={},d.done.stop=h,d.done.start=h,d.done.block=h,d.done.unblock=h,d.done.sleep=h,d.done.wakeup=h,d.done.cancel=h,d.done.fail=p,d.error={},d.error.stop=p,d.error.start=p,d.error.block=p,d.error.unblock=p,d.error.sleep=p,d.error.wakeup=p,d.error.cancel=p,d.error.fail=p;var y=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=u,this.blocks=0,this.timeoutId=null,this.swapTime=null,this.userData=null,this.id=s++,o[this.id]=this};y.prototype.debug=function(e){e=e||"",n.log.debug(i,e,"[%s][%s] task:",this.id,this.name,this,"subtasks:",this.subtasks.length,"queue:",a)},y.prototype.next=function(e,t){"function"==typeof e&&(t=e,e=this.name);var r=new y({run:t,name:e,parent:this});return r.state=c,r.type=this.type,r.successCallback=this.successCallback||null,r.failureCallback=this.failureCallback||null,this.subtasks.push(r),this},y.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++){o(e+"__parallel-"+r.id+"-"+s,s)}})},y.prototype.stop=function(){this.state=d[this.state].stop},y.prototype.start=function(){this.error=!1,this.state=d[this.state].start,this.state===c&&(this.start=new Date,this.run(this),g(this,0))},y.prototype.block=function(e){e=void 0===e?1:e,this.blocks+=e,this.blocks>0&&(this.state=d[this.state].block)},y.prototype.unblock=function(e){return e=void 0===e?1:e,this.blocks-=e,0===this.blocks&&this.state!==h&&(this.state=c,g(this,0)),this.blocks},y.prototype.sleep=function(e){e=void 0===e?0:e,this.state=d[this.state].sleep;var t=this;this.timeoutId=setTimeout(function(){t.timeoutId=null,t.state=c,g(t,0)},e)},y.prototype.wait=function(e){e.wait(this)},y.prototype.wakeup=function(){this.state===l&&(cancelTimeout(this.timeoutId),this.timeoutId=null,this.state=c,g(this,0))},y.prototype.cancel=function(){this.state=d[this.state].cancel,this.permitsNeeded=0,null!==this.timeoutId&&(cancelTimeout(this.timeoutId),this.timeoutId=null),this.subtasks=[]},y.prototype.fail=function(e){if(this.error=!0,m(this,!0),e)e.error=this.error,e.swapTime=this.swapTime,e.userData=this.userData,g(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;m(t,!0)}this.failureCallback&&this.failureCallback(this)}};var g=function(e,t){var r=t>30||+new Date-e.swapTime>20,n=function(t){if(t++,e.state===c)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||g(n,t)}else m(e),e.error||null!==e.parent&&(e.parent.error=e.error,e.parent.swapTime=e.swapTime,e.parent.userData=e.userData,g(e.parent,t))};r?setTimeout(n,0):n(t)},m=function(e,t){e.state=h,delete o[e.id],null===e.parent&&(e.type in a?0===a[e.type].length?n.log.error(i,"[%s][%s] task queue empty [%s]",e.id,e.name,e.type):a[e.type][0]!==e?n.log.error(i,"[%s][%s] task not first in queue [%s]",e.id,e.name,e.type):(a[e.type].shift(),0===a[e.type].length?delete a[e.type]:a[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 y({run:e.run,name:e.name||"?"});t.type=e.type,t.successCallback=e.success||null,t.failureCallback=e.failure||null,t.type in a?a[e.type].push(t):(a[t.type]=[t],function(e){e.error=!1,e.state=d[e.state].start,setTimeout(function(){e.state===c&&(e.swapTime=+new Date,e.run(e),g(e,0))},0)}(t))},n.task.cancel=function(e){e in a&&(a[e]=[a[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(462),i=r(10),o=r(14),s=r(464),a=i(r(256)),u=r(16),c=r(3);class f{constructor(e){this._key=e}verify(e,t,r){h(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){h(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){h(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){h(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"),h(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){if("function"!=typeof e)throw new Error("callback is required")}e.exports={RsaPublicKey:f,RsaPrivateKey:l,unmarshalRsaPublicKey:function(e){const t=s.utils.pkixToJwk(e);return new f(t)},unmarshalRsaPrivateKey:function(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))})},generateKeyPair:function(e,t){s.generateKey(e,(e,r)=>{if(e)return t(e);t(null,new l(r.privateKey,r.publicKey))})},fromJwk:function(e,t){s.unmarshalPrivateKey(e,(e,r)=>{if(e)return t(e);t(null,new l(r.privateKey,r.publicKey))})}}},function(e,t,r){"use strict";(function(t){const n=r(38),i=r(39),o=r(463),s=r(927),a=o.toCallback,u=o.toBuf,c=o.fromString,f=o.fromNumberTo32BitBuf;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(928),dblSha2256:(e,r)=>{s.sha2256(e,(e,n)=>{e&&r(e),s.sha2256(t.from(n),r)})}}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(t){const n=r(40),i=self.crypto?self.crypto.subtle||self.crypto.webkitSubtle:self.msCrypto?self.msCrypto.subtle:void 0;function o(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)}}e.exports={sha1:function(e,t){o("SHA-1")(e,t)},sha2256:function(e,t){o("SHA-256")(e,t)},sha2512:function(e,t){o("SHA-512")(e,t)}}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(t){const n=r(41),i=r(463).toCallback,o={init:n.blake2bInit,update:n.blake2bUpdate,digest:n.blake2bFinal},s={init:n.blake2sInit,update:n.blake2sUpdate,digest:n.blake2sFinal},a=(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[45569+t]=a(t+1,o);for(let t=0;t<32;t++)e[45633+t]=a(t+1,s)})}).call(this,r(0).Buffer)},function(e,t,r){"use strict";const n=r(15),i=r(469),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(15),i=r(5);function o(e,t){this.name=e,this.body=t,this.decoders={},this.encoders={}}t.define=function(e,t){return new o(e,t)},o.prototype._createNamed=function(e){let t;try{t=r(931).runInThisContext("(function "+this.name+"(entity) {\n this._initNamed(entity);\n})")}catch(e){t=function(e){this._initNamed(e)}}return i(t,e),t.prototype._initNamed=function(t){e.call(this,t)},new t(this)},o.prototype._getDecoder=function(e){return e=e||"der",this.decoders.hasOwnProperty(e)||(this.decoders[e]=this._createNamed(n.decoders[e])),this.decoders[e]},o.prototype.decode=function(e,t,r){return this._getDecoder(t).decode(e,r)},o.prototype._getEncoder=function(e){return e=e||"der",this.encoders.hasOwnProperty(e)||(this.encoders[e]=this._createNamed(n.encoders[e])),this.encoders[e]},o.prototype.encode=function(e,t,r){return this._getEncoder(t).encode(e,r)}},function(module,exports,__webpack_require__){var indexOf=__webpack_require__(262),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){if(!(this instanceof Script))return new Script(e);this.code=e};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(5);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){return e instanceof o},i.prototype.save=function(){const e=this._reporterState;return{obj:e.obj,pathLen:e.path.length}},i.prototype.restore=function(e){const t=this._reporterState;t.obj=e.obj,t.path=t.path.slice(0,e.pathLen)},i.prototype.enterKey=function(e){return this._reporterState.path.push(e)},i.prototype.exitKey=function(e){const t=this._reporterState;t.path=t.path.slice(0,e-1)},i.prototype.leaveKey=function(e,t,r){const n=this._reporterState;this.exitKey(e),null!==n.obj&&(n.obj[t]=r)},i.prototype.path=function(){return this._reporterState.path.join("/")},i.prototype.enterObject=function(){const e=this._reporterState,t=e.obj;return e.obj={},t},i.prototype.leaveObject=function(e){const t=this._reporterState,r=t.obj;return t.obj=e,r},i.prototype.error=function(e){let t;const r=this._reporterState,n=e instanceof o;if(t=n?e:new o(r.path.map(function(e){return"["+JSON.stringify(e)+"]"}).join(""),e.message||e,e.stack),!r.options.partial)throw t;return n||r.errors.push(t),t},i.prototype.wrapResult=function(e){const t=this._reporterState;return t.options.partial?{result:this.isError(e)?null:e,errors:t.errors}:e},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(135).Reporter,i=r(135).EncoderBuffer,o=r(135).DecoderBuffer,s=r(81),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);function c(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=c;const f=["enc","parent","children","tag","args","reverseArgs","choice","optional","any","obj","use","alteredUse","key","default","explicit","implicit","contains"];c.prototype.clone=function(){const e=this._baseState,t={};f.forEach(function(r){t[r]=e[r]});const r=new this.constructor(t.parent);return r._baseState=t,r},c.prototype._wrap=function(){const e=this._baseState;u.forEach(function(t){this[t]=function(){const r=new this.constructor(this);return e.children.push(r),r[t].apply(r,arguments)}},this)},c.prototype._init=function(e){const t=this._baseState;s(null===t.parent),e.call(this),t.children=t.children.filter(function(e){return e._baseState.parent===this},this),s.equal(t.children.length,1,"Root node can have only one child")},c.prototype._useArgs=function(e){const t=this._baseState,r=e.filter(function(e){return e instanceof this.constructor},this);e=e.filter(function(e){return!(e instanceof this.constructor)},this),0!==r.length&&(s(null===t.children),t.children=r,r.forEach(function(e){e._baseState.parent=this},this)),0!==e.length&&(s(null===t.args),t.args=e,t.reverseArgs=e.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}))},["_peekTag","_decodeTag","_use","_decodeStr","_decodeObjid","_decodeTime","_decodeNull","_decodeInt","_decodeBool","_decodeList","_encodeComposite","_encodeStr","_encodeObjid","_encodeTime","_encodeNull","_encodeInt","_encodeBool"].forEach(function(e){c.prototype[e]=function(){const t=this._baseState;throw new Error(e+" not implemented for encoding: "+t.enc)}}),a.forEach(function(e){c.prototype[e]=function(){const t=this._baseState,r=Array.prototype.slice.call(arguments);return s(null===t.tag),t.tag=e,this._useArgs(r),this}}),c.prototype.use=function(e){s(e);const t=this._baseState;return s(null===t.use),t.use=e,this},c.prototype.optional=function(){return this._baseState.optional=!0,this},c.prototype.def=function(e){const t=this._baseState;return s(null===t.default),t.default=e,t.optional=!0,this},c.prototype.explicit=function(e){const t=this._baseState;return s(null===t.explicit&&null===t.implicit),t.explicit=e,this},c.prototype.implicit=function(e){const t=this._baseState;return s(null===t.explicit&&null===t.implicit),t.implicit=e,this},c.prototype.obj=function(){const e=this._baseState,t=Array.prototype.slice.call(arguments);return e.obj=!0,0!==t.length&&this._useArgs(t),this},c.prototype.key=function(e){const t=this._baseState;return s(null===t.key),t.key=e,this},c.prototype.any=function(){return this._baseState.any=!0,this},c.prototype.choice=function(e){const t=this._baseState;return s(null===t.choice),t.choice=e,this._useArgs(Object.keys(e).map(function(t){return e[t]})),this},c.prototype.contains=function(e){const t=this._baseState;return s(null===t.use),t.contains=e,this},c.prototype._decode=function(e,t){const r=this._baseState;if(null===r.parent)return e.wrapResult(r.children[0]._decode(e,t));let n,i=r.default,s=!0,a=null;if(null!==r.key&&(a=e.enterKey(r.key)),r.optional){let n=null;if(null!==r.explicit?n=r.explicit:null!==r.implicit?n=r.implicit:null!==r.tag&&(n=r.tag),null!==n||r.any){if(s=this._peekTag(e,n,r.any),e.isError(s))return s}else{const n=e.save();try{null===r.choice?this._decodeGeneric(r.tag,e,t):this._decodeChoice(e,t),s=!0}catch(e){s=!1}e.restore(n)}}if(r.obj&&s&&(n=e.enterObject()),s){if(null!==r.explicit){const t=this._decodeTag(e,r.explicit);if(e.isError(t))return t;e=t}const n=e.offset;if(null===r.use&&null===r.choice){let t;r.any&&(t=e.save());const n=this._decodeTag(e,null!==r.implicit?r.implicit:r.tag,r.any);if(e.isError(n))return n;r.any?i=e.raw(t):e=n}if(t&&t.track&&null!==r.tag&&t.track(e.path(),n,e.length,"tagged"),t&&t.track&&null!==r.tag&&t.track(e.path(),e.offset,e.length,"content"),r.any||(i=null===r.choice?this._decodeGeneric(r.tag,e,t):this._decodeChoice(e,t)),e.isError(i))return i;if(r.any||null!==r.choice||null===r.children||r.children.forEach(function(r){r._decode(e,t)}),r.contains&&("octstr"===r.tag||"bitstr"===r.tag)){const n=new o(i);i=this._getUse(r.contains,e._reporterState.obj)._decode(n,t)}}return r.obj&&s&&(i=e.leaveObject(n)),null===r.key||null===i&&!0!==s?null!==a&&e.exitKey(a):e.leaveKey(a,r.key,i),i},c.prototype._decodeGeneric=function(e,t,r){const n=this._baseState;return"seq"===e||"set"===e?null:"seqof"===e||"setof"===e?this._decodeList(t,e,n.args[0],r):/str$/.test(e)?this._decodeStr(t,e,r):"objid"===e&&n.args?this._decodeObjid(t,n.args[0],n.args[1],r):"objid"===e?this._decodeObjid(t,null,null,r):"gentime"===e||"utctime"===e?this._decodeTime(t,e,r):"null_"===e?this._decodeNull(t,r):"bool"===e?this._decodeBool(t,r):"objDesc"===e?this._decodeStr(t,e,r):"int"===e||"enum"===e?this._decodeInt(t,n.args&&n.args[0],r):null!==n.use?this._getUse(n.use,t._reporterState.obj)._decode(t,r):t.error("unknown tag: "+e)},c.prototype._getUse=function(e,t){const r=this._baseState;return r.useDecoder=this._use(e,t),s(null===r.useDecoder._baseState.parent),r.useDecoder=r.useDecoder._baseState.children[0],r.implicit!==r.useDecoder._baseState.implicit&&(r.useDecoder=r.useDecoder.clone(),r.useDecoder._baseState.implicit=r.implicit),r.useDecoder},c.prototype._decodeChoice=function(e,t){const r=this._baseState;let n=null,i=!1;return Object.keys(r.choice).some(function(o){const s=e.save(),a=r.choice[o];try{const r=a._decode(e,t);if(e.isError(r))return!1;n={type:o,value:r},i=!0}catch(o){return e.restore(s),!1}return!0},this),i?n:e.error("Choice not matched")},c.prototype._createEncoderBuffer=function(e){return new i(e,this.reporter)},c.prototype._encode=function(e,t,r){const n=this._baseState;if(null!==n.default&&n.default===e)return;const i=this._encodeValue(e,t,r);return void 0===i||this._skipDefault(i,t,r)?void 0:i},c.prototype._encodeValue=function(e,t,r){const i=this._baseState;if(null===i.parent)return i.children[0]._encode(e,t||new n);let o=null;if(this.reporter=t,i.optional&&void 0===e){if(null===i.default)return;e=i.default}let s=null,a=!1;if(i.any)o=this._createEncoderBuffer(e);else if(i.choice)o=this._encodeChoice(e,t);else if(i.contains)s=this._getUse(i.contains,r)._encode(e,t),a=!0;else if(i.children)s=i.children.map(function(r){if("null_"===r._baseState.tag)return r._encode(null,t,e);if(null===r._baseState.key)return t.error("Child should have a key");const n=t.enterKey(r._baseState.key);if("object"!=typeof e)return t.error("Child expected, but input is not object");const i=r._encode(e[r._baseState.key],t,e);return t.leaveKey(n),i},this).filter(function(e){return e}),s=this._createEncoderBuffer(s);else if("seqof"===i.tag||"setof"===i.tag){if(!i.args||1!==i.args.length)return t.error("Too many args for : "+i.tag);if(!Array.isArray(e))return t.error("seqof/setof, but data is not Array");const r=this.clone();r._baseState.implicit=null,s=this._createEncoderBuffer(e.map(function(r){const n=this._baseState;return this._getUse(n.args[0],e)._encode(r,t)},r))}else null!==i.use?o=this._getUse(i.use,r)._encode(e,t):(s=this._encodePrimitive(i.tag,e),a=!0);if(!i.any&&null===i.choice){const e=null!==i.implicit?i.implicit:i.tag,r=null===i.implicit?"universal":"context";null===e?null===i.use&&t.error("Tag could be omitted only for .use()"):null===i.use&&(o=this._encodeComposite(e,a,r,s))}return null!==i.explicit&&(o=this._encodeComposite(i.explicit,!1,"context",o)),o},c.prototype._encodeChoice=function(e,t){const r=this._baseState,n=r.choice[e.type];return n||s(!1,e.type+" not found in "+JSON.stringify(Object.keys(r.choice))),n._encode(e.value,t)},c.prototype._encodePrimitive=function(e,t){const r=this._baseState;if(/str$/.test(e))return this._encodeStr(t,e);if("objid"===e&&r.args)return this._encodeObjid(t,r.reverseArgs[0],r.args[1]);if("objid"===e)return this._encodeObjid(t,null,null);if("gentime"===e||"utctime"===e)return this._encodeTime(t,e);if("null_"===e)return this._encodeNull();if("int"===e||"enum"===e)return this._encodeInt(t,r.args&&r.reverseArgs[0]);if("bool"===e)return this._encodeBool(t);if("objDesc"===e)return this._encodeStr(t,e);throw new Error("Unsupported tag: "+e)},c.prototype._isNumstr=function(e){return/^[0-9 ]*$/.test(e)},c.prototype._isPrintstr=function(e){return/^[A-Za-z0-9 '()+,-./:=?]*$/.test(e)}},function(e,t,r){"use strict";const n=r(466);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(467),n.pem=r(936)},function(e,t,r){"use strict";const n=r(5),i=r(0).Buffer,o=r(467);function s(e){o.call(this,e),this.enc="pem"}n(s,o),e.exports=s,s.prototype.decode=function(e,t){const r=e.toString().split(/[\r\n]+/g),n=t.label.toUpperCase(),s=/^-----(BEGIN|END) ([^-]+)-----$/;let a=-1,u=-1;for(let e=0;e<r.length;e++){const t=r[e].match(s);if(null!==t&&t[2]===n){if(-1!==a){if("END"!==t[1])break;u=e;break}if("BEGIN"!==t[1])break;a=e}}if(-1===a||-1===u)throw new Error("PEM section not found for: "+n);const c=r.slice(a+1,u).join("");c.replace(/[^a-z0-9+/=]+/gi,"");const f=new i(c,"base64");return o.prototype.decode.call(this,f,t)}},function(e,t,r){"use strict";const n=t;n.der=r(468),n.pem=r(938)},function(e,t,r){"use strict";const n=r(5),i=r(468);function o(e){i.call(this,e),this.enc="pem"}n(o,i),e.exports=o,o.prototype.encode=function(e,t){const r=i.prototype.encode.call(this,e).toString("base64"),n=["-----BEGIN "+t.label+"-----"];for(let e=0;e<r.length;e+=64)n.push(r.slice(e,e+64));return n.push("-----END "+t.label+"-----"),n.join("\n")}},function(e,t,r){"use strict";(function(t){const n=r(462),i=r(10),o=r(14),s=r(940),a=i(r(256));class u{constructor(e){this._key=l(e,s.publicKeyLength)}verify(e,t,r){f(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){f(e),n(this.bytes,"sha2-256",e)}}class c{constructor(e,t){this._key=l(e,s.privateKeyLength),this._publicKey=l(t,s.publicKeyLength)}sign(e,t){f(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){f(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){if("function"!=typeof e)throw new Error("callback is required")}function l(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:function(e,t){try{e=l(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))},unmarshalEd25519PublicKey:function(e){return e=l(e,s.publicKeyLength),new u(e)},generateKeyPair:function(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)})},generateKeyPairFromSeed:function(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)})}}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(e){const n=r(58),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(38),i=r(39),o=r(471),s=r(943),a=o.toCallback,u=o.toBuf,c=o.fromString,f=o.fromNumberTo32BitBuf;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(944),dblSha2256:(e,r)=>{s.sha2256(e,(e,n)=>{e&&r(e),s.sha2256(t.from(n),r)})}}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(t){const n=r(40),i=self.crypto?self.crypto.subtle||self.crypto.webkitSubtle:self.msCrypto?self.msCrypto.subtle:void 0;function o(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)}}e.exports={sha1:function(e,t){o("SHA-1")(e,t)},sha2256:function(e,t){o("SHA-256")(e,t)},sha2512:function(e,t){o("SHA-512")(e,t)}}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(t){const n=r(41),i=r(471).toCallback,o={init:n.blake2bInit,update:n.blake2bUpdate,digest:n.blake2bFinal},s={init:n.blake2sInit,update:n.blake2sUpdate,digest:n.blake2sFinal},a=(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[45569+t]=a(t+1,o);for(let t=0;t<32;t++)e[45633+t]=a(t+1,s)})}).call(this,r(0).Buffer)},function(e,t,r){"use strict";const n=r(946),i=r(470),o=r(3),s="sha2-256";e.exports=(e=>{function t(e){if(!n.privateKeyVerify(e))throw new Error("Invalid private key")}return{generateKey:function(t){let r;do{r=e(32)}while(!n.privateKeyVerify(r));((e,r)=>o(()=>t(e,r)))(null,r)},privateKeyLength:32,hashAndSign:function(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)}})},hashAndVerify:function(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)}})},compressPublicKey:function(e){if(!n.publicKeyVerify(e))throw new Error("Invalid public key");return n.publicKeyConvert(e,!0)},decompressPublicKey:function(e){return n.publicKeyConvert(e,!1)},validatePrivateKey:t,validatePublicKey:function(e){if(!n.publicKeyVerify(e))throw new Error("Invalid public key")},computePublicKey:function(e){return t(e),n.publicKeyCreate(e)}}})},function(e,t,r){"use strict";e.exports=r(417)(r(947))},function(e,t,r){"use strict";var n=r(2).Buffer,i=r(123),o=r(948),s=r(245),a=r(185),u=r(472),c=r(951);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)).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)).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();return u.fromECJPoint(c.mulAdd(y,p,g)).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(242),i=r(949),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,i,o,s=e.words,a=t.words,u=r.words,c=0,f=0|s[0],l=8191&f,h=f>>>13,p=0|s[1],d=8191&p,y=p>>>13,g=0|s[2],m=8191&g,b=g>>>13,v=0|s[3],_=8191&v,w=v>>>13,S=0|s[4],k=8191&S,E=S>>>13,A=0|s[5],x=8191&A,I=A>>>13,T=0|s[6],B=8191&T,C=T>>>13,P=0|s[7],O=8191&P,R=P>>>13,N=0|s[8],L=8191&N,K=N>>>13,j=0|s[9],M=8191&j,D=j>>>13,U=0|a[0],F=8191&U,q=U>>>13,H=0|a[1],z=8191&H,V=H>>>13,G=0|a[2],W=8191&G,$=G>>>13,Y=0|a[3],J=8191&Y,X=Y>>>13,Z=0|a[4],Q=8191&Z,ee=Z>>>13,te=0|a[5],re=8191&te,ne=te>>>13,ie=0|a[6],oe=8191&ie,se=ie>>>13,ae=0|a[7],ue=8191&ae,ce=ae>>>13,fe=0|a[8],le=8191&fe,he=fe>>>13,pe=0|a[9],de=8191&pe,ye=pe>>>13;r.length=19,n=Math.imul(l,F),i=Math.imul(l,q);var ge=c+n+((8191&(i+=Math.imul(h,F)))<<13);c=(o=Math.imul(h,q))+(i>>>13)+(ge>>>26),ge&=67108863,n=Math.imul(d,F),i=Math.imul(d,q),i+=Math.imul(y,F),o=Math.imul(y,q),n+=Math.imul(l,z),i+=Math.imul(l,V);var me=c+n+((8191&(i+=Math.imul(h,z)))<<13);c=(o+=Math.imul(h,V))+(i>>>13)+(me>>>26),me&=67108863,n=Math.imul(m,F),i=Math.imul(m,q),i+=Math.imul(b,F),o=Math.imul(b,q),n+=Math.imul(d,z),i+=Math.imul(d,V),i+=Math.imul(y,z),o+=Math.imul(y,V),n+=Math.imul(l,W),i+=Math.imul(l,$);var be=c+n+((8191&(i+=Math.imul(h,W)))<<13);c=(o+=Math.imul(h,$))+(i>>>13)+(be>>>26),be&=67108863,n=Math.imul(_,F),i=Math.imul(_,q),i+=Math.imul(w,F),o=Math.imul(w,q),n+=Math.imul(m,z),i+=Math.imul(m,V),i+=Math.imul(b,z),o+=Math.imul(b,V),n+=Math.imul(d,W),i+=Math.imul(d,$),i+=Math.imul(y,W),o+=Math.imul(y,$),n+=Math.imul(l,J),i+=Math.imul(l,X);var ve=c+n+((8191&(i+=Math.imul(h,J)))<<13);c=(o+=Math.imul(h,X))+(i>>>13)+(ve>>>26),ve&=67108863,n=Math.imul(k,F),i=Math.imul(k,q),i+=Math.imul(E,F),o=Math.imul(E,q),n+=Math.imul(_,z),i+=Math.imul(_,V),i+=Math.imul(w,z),o+=Math.imul(w,V),n+=Math.imul(m,W),i+=Math.imul(m,$),i+=Math.imul(b,W),o+=Math.imul(b,$),n+=Math.imul(d,J),i+=Math.imul(d,X),i+=Math.imul(y,J),o+=Math.imul(y,X),n+=Math.imul(l,Q),i+=Math.imul(l,ee);var _e=c+n+((8191&(i+=Math.imul(h,Q)))<<13);c=(o+=Math.imul(h,ee))+(i>>>13)+(_e>>>26),_e&=67108863,n=Math.imul(x,F),i=Math.imul(x,q),i+=Math.imul(I,F),o=Math.imul(I,q),n+=Math.imul(k,z),i+=Math.imul(k,V),i+=Math.imul(E,z),o+=Math.imul(E,V),n+=Math.imul(_,W),i+=Math.imul(_,$),i+=Math.imul(w,W),o+=Math.imul(w,$),n+=Math.imul(m,J),i+=Math.imul(m,X),i+=Math.imul(b,J),o+=Math.imul(b,X),n+=Math.imul(d,Q),i+=Math.imul(d,ee),i+=Math.imul(y,Q),o+=Math.imul(y,ee),n+=Math.imul(l,re),i+=Math.imul(l,ne);var we=c+n+((8191&(i+=Math.imul(h,re)))<<13);c=(o+=Math.imul(h,ne))+(i>>>13)+(we>>>26),we&=67108863,n=Math.imul(B,F),i=Math.imul(B,q),i+=Math.imul(C,F),o=Math.imul(C,q),n+=Math.imul(x,z),i+=Math.imul(x,V),i+=Math.imul(I,z),o+=Math.imul(I,V),n+=Math.imul(k,W),i+=Math.imul(k,$),i+=Math.imul(E,W),o+=Math.imul(E,$),n+=Math.imul(_,J),i+=Math.imul(_,X),i+=Math.imul(w,J),o+=Math.imul(w,X),n+=Math.imul(m,Q),i+=Math.imul(m,ee),i+=Math.imul(b,Q),o+=Math.imul(b,ee),n+=Math.imul(d,re),i+=Math.imul(d,ne),i+=Math.imul(y,re),o+=Math.imul(y,ne),n+=Math.imul(l,oe),i+=Math.imul(l,se);var Se=c+n+((8191&(i+=Math.imul(h,oe)))<<13);c=(o+=Math.imul(h,se))+(i>>>13)+(Se>>>26),Se&=67108863,n=Math.imul(O,F),i=Math.imul(O,q),i+=Math.imul(R,F),o=Math.imul(R,q),n+=Math.imul(B,z),i+=Math.imul(B,V),i+=Math.imul(C,z),o+=Math.imul(C,V),n+=Math.imul(x,W),i+=Math.imul(x,$),i+=Math.imul(I,W),o+=Math.imul(I,$),n+=Math.imul(k,J),i+=Math.imul(k,X),i+=Math.imul(E,J),o+=Math.imul(E,X),n+=Math.imul(_,Q),i+=Math.imul(_,ee),i+=Math.imul(w,Q),o+=Math.imul(w,ee),n+=Math.imul(m,re),i+=Math.imul(m,ne),i+=Math.imul(b,re),o+=Math.imul(b,ne),n+=Math.imul(d,oe),i+=Math.imul(d,se),i+=Math.imul(y,oe),o+=Math.imul(y,se),n+=Math.imul(l,ue),i+=Math.imul(l,ce);var ke=c+n+((8191&(i+=Math.imul(h,ue)))<<13);c=(o+=Math.imul(h,ce))+(i>>>13)+(ke>>>26),ke&=67108863,n=Math.imul(L,F),i=Math.imul(L,q),i+=Math.imul(K,F),o=Math.imul(K,q),n+=Math.imul(O,z),i+=Math.imul(O,V),i+=Math.imul(R,z),o+=Math.imul(R,V),n+=Math.imul(B,W),i+=Math.imul(B,$),i+=Math.imul(C,W),o+=Math.imul(C,$),n+=Math.imul(x,J),i+=Math.imul(x,X),i+=Math.imul(I,J),o+=Math.imul(I,X),n+=Math.imul(k,Q),i+=Math.imul(k,ee),i+=Math.imul(E,Q),o+=Math.imul(E,ee),n+=Math.imul(_,re),i+=Math.imul(_,ne),i+=Math.imul(w,re),o+=Math.imul(w,ne),n+=Math.imul(m,oe),i+=Math.imul(m,se),i+=Math.imul(b,oe),o+=Math.imul(b,se),n+=Math.imul(d,ue),i+=Math.imul(d,ce),i+=Math.imul(y,ue),o+=Math.imul(y,ce),n+=Math.imul(l,le),i+=Math.imul(l,he);var Ee=c+n+((8191&(i+=Math.imul(h,le)))<<13);c=(o+=Math.imul(h,he))+(i>>>13)+(Ee>>>26),Ee&=67108863,n=Math.imul(M,F),i=Math.imul(M,q),i+=Math.imul(D,F),o=Math.imul(D,q),n+=Math.imul(L,z),i+=Math.imul(L,V),i+=Math.imul(K,z),o+=Math.imul(K,V),n+=Math.imul(O,W),i+=Math.imul(O,$),i+=Math.imul(R,W),o+=Math.imul(R,$),n+=Math.imul(B,J),i+=Math.imul(B,X),i+=Math.imul(C,J),o+=Math.imul(C,X),n+=Math.imul(x,Q),i+=Math.imul(x,ee),i+=Math.imul(I,Q),o+=Math.imul(I,ee),n+=Math.imul(k,re),i+=Math.imul(k,ne),i+=Math.imul(E,re),o+=Math.imul(E,ne),n+=Math.imul(_,oe),i+=Math.imul(_,se),i+=Math.imul(w,oe),o+=Math.imul(w,se),n+=Math.imul(m,ue),i+=Math.imul(m,ce),i+=Math.imul(b,ue),o+=Math.imul(b,ce),n+=Math.imul(d,le),i+=Math.imul(d,he),i+=Math.imul(y,le),o+=Math.imul(y,he),n+=Math.imul(l,de),i+=Math.imul(l,ye);var Ae=c+n+((8191&(i+=Math.imul(h,de)))<<13);c=(o+=Math.imul(h,ye))+(i>>>13)+(Ae>>>26),Ae&=67108863,n=Math.imul(M,z),i=Math.imul(M,V),i+=Math.imul(D,z),o=Math.imul(D,V),n+=Math.imul(L,W),i+=Math.imul(L,$),i+=Math.imul(K,W),o+=Math.imul(K,$),n+=Math.imul(O,J),i+=Math.imul(O,X),i+=Math.imul(R,J),o+=Math.imul(R,X),n+=Math.imul(B,Q),i+=Math.imul(B,ee),i+=Math.imul(C,Q),o+=Math.imul(C,ee),n+=Math.imul(x,re),i+=Math.imul(x,ne),i+=Math.imul(I,re),o+=Math.imul(I,ne),n+=Math.imul(k,oe),i+=Math.imul(k,se),i+=Math.imul(E,oe),o+=Math.imul(E,se),n+=Math.imul(_,ue),i+=Math.imul(_,ce),i+=Math.imul(w,ue),o+=Math.imul(w,ce),n+=Math.imul(m,le),i+=Math.imul(m,he),i+=Math.imul(b,le),o+=Math.imul(b,he),n+=Math.imul(d,de),i+=Math.imul(d,ye);var xe=c+n+((8191&(i+=Math.imul(y,de)))<<13);c=(o+=Math.imul(y,ye))+(i>>>13)+(xe>>>26),xe&=67108863,n=Math.imul(M,W),i=Math.imul(M,$),i+=Math.imul(D,W),o=Math.imul(D,$),n+=Math.imul(L,J),i+=Math.imul(L,X),i+=Math.imul(K,J),o+=Math.imul(K,X),n+=Math.imul(O,Q),i+=Math.imul(O,ee),i+=Math.imul(R,Q),o+=Math.imul(R,ee),n+=Math.imul(B,re),i+=Math.imul(B,ne),i+=Math.imul(C,re),o+=Math.imul(C,ne),n+=Math.imul(x,oe),i+=Math.imul(x,se),i+=Math.imul(I,oe),o+=Math.imul(I,se),n+=Math.imul(k,ue),i+=Math.imul(k,ce),i+=Math.imul(E,ue),o+=Math.imul(E,ce),n+=Math.imul(_,le),i+=Math.imul(_,he),i+=Math.imul(w,le),o+=Math.imul(w,he),n+=Math.imul(m,de),i+=Math.imul(m,ye);var Ie=c+n+((8191&(i+=Math.imul(b,de)))<<13);c=(o+=Math.imul(b,ye))+(i>>>13)+(Ie>>>26),Ie&=67108863,n=Math.imul(M,J),i=Math.imul(M,X),i+=Math.imul(D,J),o=Math.imul(D,X),n+=Math.imul(L,Q),i+=Math.imul(L,ee),i+=Math.imul(K,Q),o+=Math.imul(K,ee),n+=Math.imul(O,re),i+=Math.imul(O,ne),i+=Math.imul(R,re),o+=Math.imul(R,ne),n+=Math.imul(B,oe),i+=Math.imul(B,se),i+=Math.imul(C,oe),o+=Math.imul(C,se),n+=Math.imul(x,ue),i+=Math.imul(x,ce),i+=Math.imul(I,ue),o+=Math.imul(I,ce),n+=Math.imul(k,le),i+=Math.imul(k,he),i+=Math.imul(E,le),o+=Math.imul(E,he),n+=Math.imul(_,de),i+=Math.imul(_,ye);var Te=c+n+((8191&(i+=Math.imul(w,de)))<<13);c=(o+=Math.imul(w,ye))+(i>>>13)+(Te>>>26),Te&=67108863,n=Math.imul(M,Q),i=Math.imul(M,ee),i+=Math.imul(D,Q),o=Math.imul(D,ee),n+=Math.imul(L,re),i+=Math.imul(L,ne),i+=Math.imul(K,re),o+=Math.imul(K,ne),n+=Math.imul(O,oe),i+=Math.imul(O,se),i+=Math.imul(R,oe),o+=Math.imul(R,se),n+=Math.imul(B,ue),i+=Math.imul(B,ce),i+=Math.imul(C,ue),o+=Math.imul(C,ce),n+=Math.imul(x,le),i+=Math.imul(x,he),i+=Math.imul(I,le),o+=Math.imul(I,he),n+=Math.imul(k,de),i+=Math.imul(k,ye);var Be=c+n+((8191&(i+=Math.imul(E,de)))<<13);c=(o+=Math.imul(E,ye))+(i>>>13)+(Be>>>26),Be&=67108863,n=Math.imul(M,re),i=Math.imul(M,ne),i+=Math.imul(D,re),o=Math.imul(D,ne),n+=Math.imul(L,oe),i+=Math.imul(L,se),i+=Math.imul(K,oe),o+=Math.imul(K,se),n+=Math.imul(O,ue),i+=Math.imul(O,ce),i+=Math.imul(R,ue),o+=Math.imul(R,ce),n+=Math.imul(B,le),i+=Math.imul(B,he),i+=Math.imul(C,le),o+=Math.imul(C,he),n+=Math.imul(x,de),i+=Math.imul(x,ye);var Ce=c+n+((8191&(i+=Math.imul(I,de)))<<13);c=(o+=Math.imul(I,ye))+(i>>>13)+(Ce>>>26),Ce&=67108863,n=Math.imul(M,oe),i=Math.imul(M,se),i+=Math.imul(D,oe),o=Math.imul(D,se),n+=Math.imul(L,ue),i+=Math.imul(L,ce),i+=Math.imul(K,ue),o+=Math.imul(K,ce),n+=Math.imul(O,le),i+=Math.imul(O,he),i+=Math.imul(R,le),o+=Math.imul(R,he),n+=Math.imul(B,de),i+=Math.imul(B,ye);var Pe=c+n+((8191&(i+=Math.imul(C,de)))<<13);c=(o+=Math.imul(C,ye))+(i>>>13)+(Pe>>>26),Pe&=67108863,n=Math.imul(M,ue),i=Math.imul(M,ce),i+=Math.imul(D,ue),o=Math.imul(D,ce),n+=Math.imul(L,le),i+=Math.imul(L,he),i+=Math.imul(K,le),o+=Math.imul(K,he),n+=Math.imul(O,de),i+=Math.imul(O,ye);var Oe=c+n+((8191&(i+=Math.imul(R,de)))<<13);c=(o+=Math.imul(R,ye))+(i>>>13)+(Oe>>>26),Oe&=67108863,n=Math.imul(M,le),i=Math.imul(M,he),i+=Math.imul(D,le),o=Math.imul(D,he),n+=Math.imul(L,de),i+=Math.imul(L,ye);var Re=c+n+((8191&(i+=Math.imul(K,de)))<<13);c=(o+=Math.imul(K,ye))+(i>>>13)+(Re>>>26),Re&=67108863,n=Math.imul(M,de),i=Math.imul(M,ye);var Ne=c+n+((8191&(i+=Math.imul(D,de)))<<13);return c=(o=Math.imul(D,ye))+(i>>>13)+(Ne>>>26),Ne&=67108863,u[0]=ge,u[1]=me,u[2]=be,u[3]=ve,u[4]=_e,u[5]=we,u[6]=Se,u[7]=ke,u[8]=Ee,u[9]=Ae,u[10]=xe,u[11]=Ie,u[12]=Te,u[13]=Be,u[14]=Ce,u[15]=Pe,u[16]=Oe,u[17]=Re,u[18]=Ne,0!==c&&(u[19]=c,r.length++),r}},function(e,t,r){"use strict";var n=r(2).Buffer,i=r(185),o=r(472),s=r(473);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=new Array(1+Math.ceil(64.25)),r=t[0]=e,n=1;n<t.length;++n){for(var i=0;i<4;i++)r=r.dbl();t[n]=r}this.precomputed={naf:e._getNAFPoints(7),doubles:{step:4,points:t,negpoints:t.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,d=c[h];0!==d&&(d>0?p=o[h][d>>1]:d<0&&(p=o[h][-d>>1].neg()),u=void 0===p.z?u.mixedAdd(p):u.add(p))}}return u},e.exports=new a},function(e,t,r){"use strict";(function(t){const n=r(37),i=r(438),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=t.from("key expansion"),h=2*(f+c+20);i.create(r,s,(e,r)=>{if(e)return a(e);r.digest(l,(e,i)=>{if(e)return a(e);let o=[],s=0;n(()=>s<h,function(e){r.digest(t.concat([i,l]),(t,n)=>{if(t)return e(t);let a=n.length;s+a>h&&(a=h-s),o.push(n),s+=a,r.digest(i,(t,r)=>{if(t)return e(t);i=r,e()})})},function(e){if(e)return a(e);const r=h/2,n=t.concat(o),i=n.slice(0,r),s=n.slice(r,h),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)})})})})})}).call(this,r(0).Buffer)},function(e,t,r){"use strict";const n=r(954);e.exports=((e,t)=>{n.generateEphmeralKeyPair(e,t)})},function(e,t,r){"use strict";(function(e){const n=r(255)(),i=r(254),o=r(15).bignum,s=r(469),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(16),i={sha1:"sha1","sha2-256":"sha256","sha2-512":"sha512"};e.exports=function(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)}},function(e,t,r){"use strict";(function(n){const i=r(12),o=r(957),s=r(17),a=r(4);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).create=function(e,t){"function"==typeof e&&(t=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(475),i=r(959),o=r(961);(t=e.exports).aes=i,t.hmac=n,t.keys=o,t.randomBytes=r(480),t.pbkdf2=r(972)},function(e,t,r){"use strict";e.exports={SHA1:20,SHA256:32,SHA512:64}},function(e,t,r){"use strict";const n=r(960),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);r(null,{encrypt(e,t){t(null,s.update(e))},decrypt(e,t){t(null,a.update(e))}})}},function(e,t,r){"use strict";const n=r(57);e.exports={createCipheriv:n.createCipheriv,createDecipheriv:n.createDecipheriv}},function(e,t,r){"use strict";(function(n){const i=r(10)(r(265)),o=r(16);t=e.exports;const s={rsa:r(962),ed25519:r(967),secp256k1:r(59)(i,r(480))};function a(e){return void 0!==s[e.toLowerCase()]}t.supportedKeys=s,t.keysPBM=i,t.keyStretcher=r(969),t.generateEphemeralKeyPair=r(970),t.generateKeyPair=((e,t,r)=>{let n=s[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=s[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=i.PublicKey.decode(e),r=t.Data;switch(t.Type){case i.KeyType.RSA:return s.rsa.unmarshalRsaPublicKey(r);case i.KeyType.Ed25519:return s.ed25519.unmarshalEd25519PublicKey(r);case i.KeyType.Secp256k1:if(s.secp256k1)return s.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(!a(t=(t||"rsa").toLowerCase()))throw new Error("invalid or unsupported key type");return e.bytes}),t.unmarshalPrivateKey=((e,t)=>{let r;try{r=i.PrivateKey.decode(e)}catch(e){return t(e)}const n=r.Data;switch(r.Type){case i.KeyType.RSA:return s.rsa.unmarshalRsaPrivateKey(n,t);case i.KeyType.Ed25519:return s.ed25519.unmarshalEd25519PrivateKey(n,t);case i.KeyType.Secp256k1:return s.secp256k1?s.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(!a(t=(t||"rsa").toLowerCase()))throw new Error("invalid or unsupported key type");return e.bytes}),t.import=((e,t,r)=>{try{const i=o.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 a=o.asn1.toDer(o.pki.privateKeyToAsn1(i));return a=n.from(a.getBytes(),"binary"),s.rsa.unmarshalRsaPrivateKey(a,r)}catch(e){r(e)}})}).call(this,r(0).Buffer)},function(e,t,r){"use strict";const n=r(476),i=r(10),o=r(14),s=r(478),a=i(r(265)),u=r(16),c=r(3);class f{constructor(e){this._key=e}verify(e,t,r){h(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){h(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){h(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){h(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"),h(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){if("function"!=typeof e)throw new Error("callback is required")}e.exports={RsaPublicKey:f,RsaPrivateKey:l,unmarshalRsaPublicKey:function(e){const t=s.utils.pkixToJwk(e);return new f(t)},unmarshalRsaPrivateKey:function(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))})},generateKeyPair:function(e,t){s.generateKey(e,(e,r)=>{if(e)return t(e);t(null,new l(r.privateKey,r.publicKey))})},fromJwk:function(e,t){s.unmarshalPrivateKey(e,(e,r)=>{if(e)return t(e);t(null,new l(r.privateKey,r.publicKey))})}}},function(e,t,r){"use strict";(function(t){const n=r(38),i=r(39),o=r(477),s=r(964),a=o.toCallback,u=o.toBuf,c=o.fromString,f=o.fromNumberTo32BitBuf;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(965),dblSha2256:(e,r)=>{s.sha2256(e,(e,n)=>{e&&r(e),s.sha2256(t.from(n),r)})}}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(t){const n=r(40),i=self.crypto?self.crypto.subtle||self.crypto.webkitSubtle:self.msCrypto?self.msCrypto.subtle:void 0;function o(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)}}e.exports={sha1:function(e,t){o("SHA-1")(e,t)},sha2256:function(e,t){o("SHA-256")(e,t)},sha2512:function(e,t){o("SHA-512")(e,t)}}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(t){const n=r(41),i=r(477).toCallback,o={init:n.blake2bInit,update:n.blake2bUpdate,digest:n.blake2bFinal},s={init:n.blake2sInit,update:n.blake2sUpdate,digest:n.blake2sFinal},a=(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[45569+t]=a(t+1,o);for(let t=0;t<32;t++)e[45633+t]=a(t+1,s)})}).call(this,r(0).Buffer)},function(e,t,r){"use strict";const n=r(15),i=r(479),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(476),i=r(10),o=r(14),s=r(968),a=i(r(265));class u{constructor(e){this._key=l(e,s.publicKeyLength)}verify(e,t,r){f(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){f(e),n(this.bytes,"sha2-256",e)}}class c{constructor(e,t){this._key=l(e,s.privateKeyLength),this._publicKey=l(t,s.publicKeyLength)}sign(e,t){f(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){f(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){if("function"!=typeof e)throw new Error("callback is required")}function l(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:function(e,t){try{e=l(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))},unmarshalEd25519PublicKey:function(e){return e=l(e,s.publicKeyLength),new u(e)},generateKeyPair:function(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)})},generateKeyPairFromSeed:function(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)})}}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(e){const n=r(58),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(37),i=r(475),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=t.from("key expansion"),h=2*(f+c+20);i.create(r,s,(e,r)=>{if(e)return a(e);r.digest(l,(e,i)=>{if(e)return a(e);let o=[],s=0;n(()=>s<h,function(e){r.digest(t.concat([i,l]),(t,n)=>{if(t)return e(t);let a=n.length;s+a>h&&(a=h-s),o.push(n),s+=a,r.digest(i,(t,r)=>{if(t)return e(t);i=r,e()})})},function(e){if(e)return a(e);const r=h/2,n=t.concat(o),i=n.slice(0,r),s=n.slice(r,h),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)})})})})})}).call(this,r(0).Buffer)},function(e,t,r){"use strict";const n=r(971);e.exports=((e,t)=>{n.generateEphmeralKeyPair(e,t)})},function(e,t,r){"use strict";(function(e){const n=r(264)(),i=r(263),o=r(15).bignum,s=r(479),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(16),i={sha1:"sha1","sha2-256":"sha256","sha2-512":"sha512"};e.exports=function(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)}},function(e,t,r){"use strict";(function(t){const n=r(44),i=r(26),o=r(974),s=r(268),a=r(20),u=r(14),c=r(61),f=new Error("Sorry, Not Implemented Yet."),l=c.proto(function(e){if(!(this instanceof l))return new l(e);if(null==e&&(e=""),e instanceof t)this.buffer=o.fromBuffer(e);else if("string"==typeof e||e instanceof String)this.buffer=o.fromString(e);else{if(!(e.buffer&&e.protos&&e.protoCodes))throw new Error("addr must be a string, Buffer, or another Multiaddr");this.buffer=o.fromBuffer(e.buffer)}},{className:"Multiaddr",symbolName:"@multiformats/js-multiaddr/multiaddr"});l.prototype.toString=function(){return o.bufferToString(this.buffer)},l.prototype.toOptions=function(){const e={},t=this.toString().split("/");return e.family="ip4"===t[1]?"ipv4":"ipv6",e.host=t[2],e.transport=t[3],e.port=t[4],e},l.prototype.inspect=function(){return"<Multiaddr "+this.buffer.toString("hex")+" - "+o.bufferToString(this.buffer)+">"},l.prototype.protos=function(){return n(this.protoCodes(),function(e){return i(s(e))})},l.prototype.protoCodes=function(){const e=[],t=this.buffer;let r=0;for(;r<t.length;){const n=a.decode(t,r),i=a.decode.bytes,u=s(n);r+=o.sizeForAddr(u,t.slice(r+i))+i,e.push(n)}return e},l.prototype.protoNames=function(){return n(this.protos(),function(e){return e.name})},l.prototype.tuples=function(){return o.bufferToTuples(this.buffer)},l.prototype.stringTuples=function(){const e=o.bufferToTuples(this.buffer);return o.tuplesToStringTuples(e)},l.prototype.encapsulate=function(e){return e=l(e),l(this.toString()+e.toString())},l.prototype.decapsulate=function(e){e=e.toString();const t=this.toString(),r=t.lastIndexOf(e);if(r<0)throw new Error("Address "+this+" does not contain subaddress: "+e);return l(t.slice(0,r))},l.prototype.getPeerId=function(){let e=null;try{e=this.stringTuples().filter(e=>{if(e[0]===s.names.ipfs.code)return!0})[0][1],u.decode(e)}catch(t){e=null}return e},l.prototype.equals=function(e){return this.buffer.equals(e.buffer)},l.prototype.nodeAddress=function(){if(!this.isThinWaistAddress())throw new Error('Multiaddr must be "thin waist" address for nodeAddress.');const e=this.protoCodes(),t=this.toString().split("/").slice(1);return{family:41===e[0]?"IPv6":"IPv4",address:t[1],port:t[3]}},l.fromNodeAddress=function(e,t){if(!e)throw new Error("requires node address object");if(!t)throw new Error("requires transport protocol");const r="IPv6"===e.family?"ip6":"ip4";return l("/"+[r,e.address,t,e.port].join("/"))},l.prototype.isThinWaistAddress=function(e){const t=(e||this).protos();return!(2!==t.length||4!==t[0].code&&41!==t[0].code||6!==t[1].code&&17!==t[1].code)},l.prototype.fromStupidString=function(e){throw f},l.protocols=s,l.isName=function(e){return!!l.isMultiaddr(e)&&e.protos().some(e=>e.resolvable)},l.resolve=function(e,t){return l.isMultiaddr(e)&&l.isName(e)?t(new Error("not implemented yet")):t(new Error("not a valid name"))},e.exports=l}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(t){const n=r(44),i=r(136),o=r(975),s=r(268),a=r(20);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];if(0!==s(i).size){if(++n>=r.length)throw v("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=_(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=_(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=_(e);return e.length>1?[t.code,o.toString(t.code,e[1])]:[t.code]})}function h(e){return g(t.concat(n(e,function(e){const r=_(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;return a.decode(t)+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=p(s(n),e.slice(r+i));if(0===o){t.push([n]),r+=i;continue}const u=e.slice(r+i,r+i+o);if((r+=o+i)>e.length)throw v("Invalid address buffer: "+e.toString("hex"));t.push([n,u])}return t}function y(e){return h(f(u(e=b(e))))}function g(e){const r=m(e);if(r)throw r;return t.from(e)}function m(e){try{d(e)}catch(e){return e}}function b(e){return"/"+i(e.trim().split("/")).join("/")}function v(e){return new Error("Error parsing address: "+e)}function _(e){return s(e[0])}e.exports={stringToStringTuples:u,stringTuplesToString:c,tuplesToStringTuples:l,stringTuplesToTuples:f,bufferToTuples:d,tuplesToBuffer:h,bufferToString:function(e){return c(l(d(e)))},stringToBuffer:y,fromString:function(e){return y(e)},fromBuffer:g,validateBuffer:m,isValidBuffer:function(e){return void 0===m(e)},cleanPath:b,ParseError:v,protoFromTuple:_,sizeForAddr:p}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(t){const n=r(137),i=r(138),o=r(268),s=r(14),a=r(20);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)}e.exports=u,u.toString=function(e,t){switch((e=o(e)).code){case 4:case 41:return n.toString(t);case 6:case 17:case 33:case 132:return function(e){return e.readUInt16BE(0)}(t);case 54:case 55:case 56:return function(e){const t=a.decode(e);if((e=e.slice(a.decode.bytes)).length!==t)throw new Error("inconsistent lengths");return e.toString()}(t);case 421:return function(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)}(t);default:return t.toString("hex")}},u.toBuffer=function(e,r){switch((e=o(e)).code){case 4:return c(new i.Address4(r));case 41:return c(new i.Address6(r));case 6:case 17:case 33:case 132:return function(e){const r=t.alloc(2);return r.writeUInt16BE(e,0),r}(parseInt(r,10));case 54:case 55:case 56:return function(e){const r=t.from(e),n=t.from(a.encode(r.length));return t.concat([n,r])}(r);case 421:return function(e){const r=t.from(s.decode(e)),n=t.from(a.encode(r.length));return t.concat([n,r])}(r);default:return t.from(r,"hex")}}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";var n=r(483).BigInteger,i=r(487),o=r(977),s=r(978),a=r(485),u=r(486),c=r(139).sprintf,f=r(266),l=r(267),h=r(482);function p(e){return(e=e.replace(/^(0{1,})([1-9]+)$/,'<span class="parse-error">$1</span>$2')).replace(/^(0{1,})(0)$/,'<span class="parse-error">$1</span>$2')}function d(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 y(e){return c("%04x",parseInt(e,16))}function g(e){return 255&e}s(d.prototype,r(979)),s(d.prototype,r(980)),s(d.prototype,r(981)),d.fromBigInteger=function(e){var t,r=a(e.toString(16),32,"0"),n=[];for(t=0;t<l.GROUPS;t++)n.push(r.slice(4*t,4*(t+1)));return new d(n.join(":"))},d.fromURL=function(e){var t,r,n;if(-1!==e.indexOf("[")&&-1!==e.indexOf("]:")){if(null===(n=l.RE_URL_WITH_PORT.exec(e)))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]+:\/\//,""),null===(n=l.RE_URL.exec(e)))return{error:"failed to parse address from URL",address:null,port:null};t=n[1]}else t=e;return r?((r=parseInt(r,10))<0||r>65536)&&(r=null):r=null,{address:new d(t),port:r}},d.fromAddress4=function(e){e=new h(e);var t=l.BITS-(f.BITS-e.subnetMask);return new d("::ffff:"+e.correctForm()+"/"+t)},d.fromArpa=function(e){var t=e.replace(/(\.ip6\.arpa)?\.$/,"");if(63!==t.length)return{error:"Not Valid 'ip6.arpa' form",address:null};t=t.split(".").reverse();for(var r=7;r>0;r--){var n=4*r;t.splice(n,0,":")}return new d(t=t.join(""))},d.prototype.microsoftTranscription=function(){return c("%s.ipv6-literal.net",this.correctForm().replace(/:/g,"-"))},d.prototype.mask=function(e){return void 0===e&&(e=this.subnetMask),this.getBitsBase2(0,e)},d.prototype.possibleSubnets=function(e){void 0===e&&(e=128);var t=l.BITS-this.subnetMask-Math.abs(e-l.BITS);return t<0?"0":function(e){for(var t=/(\d+)(\d{3})/;t.test(e);)e=e.replace(t,"$1,$2");return e}(new n("2",10).pow(t).toString(10))},d.prototype.startAddress=function(){var e=new n(this.mask()+u(0,l.BITS-this.subnetMask),2);return d.fromBigInteger(e)},d.prototype.endAddress=function(){var e=new n(this.mask()+u(1,l.BITS-this.subnetMask),2);return d.fromBigInteger(e)},d.prototype.getScope=function(){var e=l.SCOPES[this.getBits(12,16)];return"Global unicast"===this.getType()&&"Link local"!==e&&(e="Global"),e},d.prototype.getType=function(){var e=this;return i(l.TYPES,function(t,r){return e.isInSubnet(new d(r))})||"Global unicast"},d.prototype.getBits=function(e,t){return new n(this.getBitsBase2(e,t),2)},d.prototype.getBitsBase2=function(e,t){return this.binaryZeroPad().slice(e,t)},d.prototype.getBitsBase16=function(e,t){var r=t-e;return r%4!=0?null:a(this.getBits(e,t).toString(16),r/4,"0")},d.prototype.getBitsPastSubnet=function(){return this.getBitsBase2(this.subnetMask,l.BITS)},d.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."},d.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=function(e,t){var r,n=[],i=[];for(r=0;r<e.length;r++)r<t[0]?n.push(e[r]):r>t[1]&&i.push(e[r]);return n.concat(["compact"]).concat(i)}(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=u.replace(/^compact$/,"::")).replace(/^compact|compact$/,":")).replace(/compact/,"")},d.prototype.binaryZeroPad=function(){return a(this.bigInteger().toString(2),l.BITS,"0")},d.prototype.parse4in6=function(e){var t=e.split(":"),r=t.slice(-1)[0].match(f.RE_ADDRESS);if(r){for(var n=new h(r[0]),i=0;i<n.groups;i++)if(/^0[0-9]+/.test(n.parsedAddress[i]))return this.valid=!1,this.error="IPv4 addresses can not have leading zeroes.",this.parseError=e.replace(f.RE_ADDRESS,n.parsedAddress.map(p).join(".")),null;this.v4=!0,t[t.length-1]=n.toGroup6(),e=t.join(":")}return e},d.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))})).length!==this.groups?(this.valid=!1,this.error="Incorrect number of groups found",null):(this.valid=!0,n)},d.prototype.canonicalForm=function(){return this.valid?this.parsedAddress.map(y).join(":"):null},d.prototype.decimal=function(){return this.valid?this.parsedAddress.map(function(e){return c("%05d",parseInt(e,16))}).join(":"):null},d.prototype.bigInteger=function(){return this.valid?new n(this.parsedAddress.map(y).join(""),16):null},d.prototype.to4=function(){var e=this.binaryZeroPad().split("");return h.fromHex(new n(e.slice(96,128).join(""),2).toString(16))},d.prototype.to4in6=function(){var e=this.to4(),t=new d(this.parsedAddress.slice(0,6).join(":"),6),r=t.correctForm(),n="";return/:$/.test(r)||(n=":"),t.correctForm()+n+e.address},d.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}},d.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}},d.prototype.to6to4=function(){return this.is4()?new d(["2002",this.getBitsBase16(96,112),this.getBitsBase16(112,128),"","/16"].join(":")):null},d.prototype.toByteArray=function(){var e=this.bigInteger().toByteArray();return 17===e.length&&0===e[0]?e.slice(1):e},d.prototype.toUnsignedByteArray=function(){return this.toByteArray().map(g)},d.fromByteArray=function(e){return this.fromUnsignedByteArray(e.map(g))},d.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 d.fromBigInteger(r)},e.exports=d},function(e,t){var r="[object Symbol]",n=Object.prototype.toString;function i(e,t){return e>t}function o(e){return"symbol"==typeof e||function(e){return!!e&&"object"==typeof e}(e)&&n.call(e)==r}function s(e){return e}e.exports=function(e){return e&&e.length?function(e,t,r){for(var n=-1,i=e.length;++n<i;){var s=e[n],a=t(s);if(null!=a&&(void 0===u?a==a&&!o(a):r(a,u)))var u=a,c=s}return c}(e,s,i):void 0}},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 AsyncFunction]",f="[object Function]",l="[object GeneratorFunction]",h="[object Null]",p="[object Object]",d="[object Proxy]",y="[object Undefined]",g=/^\[object .+?Constructor\]$/,m=/^(?:0|[1-9]\d*)$/,b={};b["[object Float32Array]"]=b["[object Float64Array]"]=b["[object Int8Array]"]=b["[object Int16Array]"]=b["[object Int32Array]"]=b["[object Uint8Array]"]=b["[object Uint8ClampedArray]"]=b["[object Uint16Array]"]=b["[object Uint32Array]"]=!0,b[u]=b["[object Array]"]=b["[object ArrayBuffer]"]=b["[object Boolean]"]=b["[object DataView]"]=b["[object Date]"]=b["[object Error]"]=b[f]=b["[object Map]"]=b["[object Number]"]=b[p]=b["[object RegExp]"]=b["[object Set]"]=b["[object String]"]=b["[object WeakMap]"]=!1;var v="object"==typeof e&&e&&e.Object===Object&&e,_="object"==typeof self&&self&&self.Object===Object&&self,w=v||_||Function("return this")(),S="object"==typeof t&&t&&!t.nodeType&&t,k=S&&"object"==typeof r&&r&&!r.nodeType&&r,E=k&&k.exports===S,A=E&&v.process,x=function(){try{return A&&A.binding&&A.binding("util")}catch(e){}}(),I=x&&x.isTypedArray;function T(e,t){return"__proto__"==t?void 0:e[t]}var B,C=Array.prototype,P=Function.prototype,O=Object.prototype,R=w["__core-js_shared__"],N=P.toString,L=O.hasOwnProperty,K=(B=/[^.]+$/.exec(R&&R.keys&&R.keys.IE_PROTO||""))?"Symbol(src)_1."+B:"",j=O.toString,M=N.call(Object),D=RegExp("^"+N.call(L).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),U=E?w.Buffer:void 0,F=w.Symbol,q=w.Uint8Array,H=U?U.allocUnsafe:void 0,z=function(e,t){return function(r){return e(t(r))}}(Object.getPrototypeOf,Object),V=Object.create,G=O.propertyIsEnumerable,W=C.splice,$=F?F.toStringTag:void 0,Y=function(){try{var e=ve(Object,"defineProperty");return e({},"",{}),e}catch(e){}}(),J=U?U.isBuffer:void 0,X=Math.max,Z=Date.now,Q=ve(w,"Map"),ee=ve(Object,"create"),te=function(){function e(){}return function(t){if(!Ce(t))return{};if(V)return V(t);e.prototype=t;var r=new e;return e.prototype=void 0,r}}();function re(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 ne(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 ie(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 oe(e){var t=this.__data__=new ne(e);this.size=t.size}function se(e,t){var r=Ae(e),n=!r&&Ee(e),i=!r&&!n&&Ie(e),o=!r&&!n&&!i&&Oe(e),s=r||n||i||o,a=s?function(e,t){for(var r=-1,n=Array(e);++r<e;)n[r]=t(r);return n}(e.length,String):[],u=a.length;for(var c in e)!t&&!L.call(e,c)||s&&("length"==c||i&&("offset"==c||"parent"==c)||o&&("buffer"==c||"byteLength"==c||"byteOffset"==c)||_e(c,u))||a.push(c);return a}function ae(e,t,r){(void 0===r||ke(e[t],r))&&(void 0!==r||t in e)||fe(e,t,r)}function ue(e,t,r){var n=e[t];L.call(e,t)&&ke(n,r)&&(void 0!==r||t in e)||fe(e,t,r)}function ce(e,t){for(var r=e.length;r--;)if(ke(e[r][0],t))return r;return-1}function fe(e,t,r){"__proto__"==t&&Y?Y(e,t,{configurable:!0,enumerable:!0,value:r,writable:!0}):e[t]=r}re.prototype.clear=function(){this.__data__=ee?ee(null):{},this.size=0},re.prototype.delete=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t},re.prototype.get=function(e){var t=this.__data__;if(ee){var r=t[e];return r===i?void 0:r}return L.call(t,e)?t[e]:void 0},re.prototype.has=function(e){var t=this.__data__;return ee?void 0!==t[e]:L.call(t,e)},re.prototype.set=function(e,t){var r=this.__data__;return this.size+=this.has(e)?0:1,r[e]=ee&&void 0===t?i:t,this},ne.prototype.clear=function(){this.__data__=[],this.size=0},ne.prototype.delete=function(e){var t=this.__data__,r=ce(t,e);return!(r<0||(r==t.length-1?t.pop():W.call(t,r,1),--this.size,0))},ne.prototype.get=function(e){var t=this.__data__,r=ce(t,e);return r<0?void 0:t[r][1]},ne.prototype.has=function(e){return ce(this.__data__,e)>-1},ne.prototype.set=function(e,t){var r=this.__data__,n=ce(r,e);return n<0?(++this.size,r.push([e,t])):r[n][1]=t,this},ie.prototype.clear=function(){this.size=0,this.__data__={hash:new re,map:new(Q||ne),string:new re}},ie.prototype.delete=function(e){var t=be(this,e).delete(e);return this.size-=t?1:0,t},ie.prototype.get=function(e){return be(this,e).get(e)},ie.prototype.has=function(e){return be(this,e).has(e)},ie.prototype.set=function(e,t){var r=be(this,e),n=r.size;return r.set(e,t),this.size+=r.size==n?0:1,this},oe.prototype.clear=function(){this.__data__=new ne,this.size=0},oe.prototype.delete=function(e){var t=this.__data__,r=t.delete(e);return this.size=t.size,r},oe.prototype.get=function(e){return this.__data__.get(e)},oe.prototype.has=function(e){return this.__data__.has(e)},oe.prototype.set=function(e,t){var r=this.__data__;if(r instanceof ne){var i=r.__data__;if(!Q||i.length<n-1)return i.push([e,t]),this.size=++r.size,this;r=this.__data__=new ie(i)}return r.set(e,t),this.size=r.size,this};var le=function(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 he(e){return null==e?void 0===e?y:h:$&&$ in Object(e)?function(e){var t=L.call(e,$),r=e[$];try{e[$]=void 0;var n=!0}catch(e){}var i=j.call(e);return n&&(t?e[$]=r:delete e[$]),i}(e):function(e){return j.call(e)}(e)}function pe(e){return Pe(e)&&he(e)==u}function de(e){return!(!Ce(e)||function(e){return!!K&&K in e}(e))&&(Te(e)?D:g).test(function(e){if(null!=e){try{return N.call(e)}catch(e){}try{return e+""}catch(e){}}return""}(e))}function ye(e){if(!Ce(e))return function(e){var t=[];if(null!=e)for(var r in Object(e))t.push(r);return t}(e);var t=we(e),r=[];for(var n in e)("constructor"!=n||!t&&L.call(e,n))&&r.push(n);return r}function ge(e,t,r,n,i){e!==t&&le(t,function(o,s){if(Ce(o))i||(i=new oe),function(e,t,r,n,i,o,s){var a=T(e,r),u=T(t,r),c=s.get(u);if(c)ae(e,r,c);else{var f=o?o(a,u,r+"",e,t,s):void 0,l=void 0===f;if(l){var h=Ae(u),d=!h&&Ie(u),y=!h&&!d&&Oe(u);f=u,h||d||y?Ae(a)?f=a:function(e){return Pe(e)&&xe(e)}(a)?f=function(e,t){var r=-1,n=e.length;for(t||(t=Array(n));++r<n;)t[r]=e[r];return t}(a):d?(l=!1,f=function(e,t){if(t)return e.slice();var r=e.length,n=H?H(r):new e.constructor(r);return e.copy(n),n}(u,!0)):y?(l=!1,f=function(e,t){var r=t?function(e){var t=new e.constructor(e.byteLength);return new q(t).set(new q(e)),t}(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.length)}(u,!0)):f=[]:function(e){if(!Pe(e)||he(e)!=p)return!1;var t=z(e);if(null===t)return!0;var r=L.call(t,"constructor")&&t.constructor;return"function"==typeof r&&r instanceof r&&N.call(r)==M}(u)||Ee(u)?(f=a,Ee(a)?f=function(e){return function(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?fe(r,a,u):ue(r,a,u)}return r}(e,Re(e))}(a):(!Ce(a)||n&&Te(a))&&(f=function(e){return"function"!=typeof e.constructor||we(e)?{}:te(z(e))}(u))):l=!1}l&&(s.set(u,f),i(f,u,n,o,s),s.delete(u)),ae(e,r,f)}}(e,t,s,r,ge,n,i);else{var a=n?n(T(e,s),o,s+"",e,t,i):void 0;void 0===a&&(a=o),ae(e,s,a)}},Re)}function me(e,t){return Se(function(e,t,r){return t=X(void 0===t?e.length-1:t,0),function(){for(var n=arguments,i=-1,o=X(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),function(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)}(e,this,a)}}(e,t,Le),e+"")}function be(e,t){var r=e.__data__;return function(e){var t=typeof e;return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e}(t)?r["string"==typeof t?"string":"hash"]:r.map}function ve(e,t){var r=function(e,t){return null==e?void 0:e[t]}(e,t);return de(r)?r:void 0}function _e(e,t){var r=typeof e;return!!(t=null==t?a:t)&&("number"==r||"symbol"!=r&&m.test(e))&&e>-1&&e%1==0&&e<t}function we(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||O)}var Se=function(e){var t=0,r=0;return function(){var n=Z(),i=s-(n-r);if(r=n,i>0){if(++t>=o)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}(Y?function(e,t){return Y(e,"toString",{configurable:!0,enumerable:!1,value:function(e){return function(){return e}}(t),writable:!0})}:Le);function ke(e,t){return e===t||e!=e&&t!=t}var Ee=pe(function(){return arguments}())?pe:function(e){return Pe(e)&&L.call(e,"callee")&&!G.call(e,"callee")},Ae=Array.isArray;function xe(e){return null!=e&&Be(e.length)&&!Te(e)}var Ie=J||function(){return!1};function Te(e){if(!Ce(e))return!1;var t=he(e);return t==f||t==l||t==c||t==d}function Be(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=a}function Ce(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}function Pe(e){return null!=e&&"object"==typeof e}var Oe=I?function(e){return function(t){return e(t)}}(I):function(e){return Pe(e)&&Be(e.length)&&!!b[he(e)]};function Re(e){return xe(e)?se(e,!0):ye(e)}var Ne=function(e){return me(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&&function(e,t,r){if(!Ce(r))return!1;var n=typeof t;return!!("number"==n?xe(r)&&_e(t,r.length):"string"==n&&t in r)&&ke(r[t],e)}(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(e,t,r){ge(e,t,r)});function Le(e){return e}r.exports=Ne}).call(this,r(6),r(27)(e))},function(e,t,r){"use strict";var n=r(484),i=r(267);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(266),i=r(488),o=r(139).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,t=this.address.match(n.RE_ADDRESS);if(t){var r=t[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(e=this.elisionBegin;e<this.elisionBegin+this.elidedGroups;e++)u.push(o("group-%d",e));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(139).sprintf,i=r(267);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){0===parseInt(e,16)&&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(481).ensureMultiaddr,i=r(983);e.exports=class{constructor(e){this._multiaddrs=e||[],this._observedMultiaddrs=[]}add(e){e=n(e),this.has(e)||this._multiaddrs.push(e)}addSafe(e){e=n(e),this._observedMultiaddrs.some((t,r)=>{if(t.equals(e))return this.add(e),this._observedMultiaddrs.splice(r,1),!0})||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())}}},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=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,B=/^\w*$/,C=/^\./,P=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,O=/\\(\\)?/g,R=/^\[object .+?Constructor\]$/,N=/^(?:0|[1-9]\d*)$/,L={};L["[object Float32Array]"]=L["[object Float64Array]"]=L["[object Int8Array]"]=L["[object Int16Array]"]=L["[object Int32Array]"]=L["[object Uint8Array]"]=L["[object Uint8ClampedArray]"]=L["[object Uint16Array]"]=L["[object Uint32Array]"]=!0,L[f]=L[l]=L[x]=L[h]=L[I]=L[p]=L[d]=L[y]=L[m]=L[b]=L[v]=L[w]=L[S]=L[k]=L[A]=!1;var K="object"==typeof e&&e&&e.Object===Object&&e,j="object"==typeof self&&self&&self.Object===Object&&self,M=K||j||Function("return this")(),D="object"==typeof t&&t&&!t.nodeType&&t,U=D&&"object"==typeof r&&r&&!r.nodeType&&r,F=U&&U.exports===D&&K.process,q=function(){try{return F&&F.binding("util")}catch(e){}}(),H=q&&q.isTypedArray;function z(e,t){return!(!e||!e.length)&&function(e,t,r){if(t!=t)return function(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,W,r);for(var n=r-1,i=e.length;++n<i;)if(e[n]===t)return n;return-1}(e,t,0)>-1}function V(e,t,r){for(var n=-1,i=e?e.length:0;++n<i;)if(r(t,e[n]))return!0;return!1}function G(e,t){for(var r=-1,n=e?e.length:0;++r<n;)if(t(e[r],r,e))return!0;return!1}function W(e){return e!=e}function $(e,t){return e.has(t)}function Y(e){var t=!1;if(null!=e&&"function"!=typeof e.toString)try{t=!!(e+"")}catch(e){}return t}function J(e){var t=-1,r=Array(e.size);return e.forEach(function(e,n){r[++t]=[n,e]}),r}function X(e){var t=-1,r=Array(e.size);return e.forEach(function(e){r[++t]=e}),r}var Z,Q=Array.prototype,ee=Function.prototype,te=Object.prototype,re=M["__core-js_shared__"],ne=(Z=/[^.]+$/.exec(re&&re.keys&&re.keys.IE_PROTO||""))?"Symbol(src)_1."+Z:"",ie=ee.toString,oe=te.hasOwnProperty,se=te.toString,ae=RegExp("^"+ie.call(oe).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),ue=M.Symbol,ce=M.Uint8Array,fe=te.propertyIsEnumerable,le=Q.splice,he=function(e,t){return function(r){return e(t(r))}}(Object.keys,Object),pe=Ve(M,"DataView"),de=Ve(M,"Map"),ye=Ve(M,"Promise"),ge=Ve(M,"Set"),me=Ve(M,"WeakMap"),be=Ve(Object,"create"),ve=Qe(pe),_e=Qe(de),we=Qe(ye),Se=Qe(ge),ke=Qe(me),Ee=ue?ue.prototype:void 0,Ae=Ee?Ee.valueOf:void 0,xe=Ee?Ee.toString:void 0;function Ie(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 Te(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 Be(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 Ce(e){var t=-1,r=e?e.length:0;for(this.__data__=new Be;++t<r;)this.add(e[t])}function Pe(e){this.__data__=new Te(e)}function Oe(e,t){var r=nt(e)||rt(e)?function(e,t){for(var r=-1,n=Array(e);++r<e;)n[r]=t(r);return n}(e.length,String):[],n=r.length,i=!!n;for(var o in e)!t&&!oe.call(e,o)||i&&("length"==o||We(o,n))||r.push(o);return r}function Re(e,t){for(var r=e.length;r--;)if(tt(e[r][0],t))return r;return-1}function Ne(e,t){for(var r=0,n=(t=$e(t,e)?[t]:Ue(t)).length;null!=e&&r<n;)e=e[Ze(t[r++])];return r&&r==n?e:void 0}function Le(e,t){return null!=e&&t in Object(e)}function Ke(e,t,r,n,i){return e===t||(null==e||null==t||!at(e)&&!ut(t)?e!=e&&t!=t:function(e,t,r,n,i,o){var s=nt(e),u=nt(t),c=l,h=l;s||(c=(c=Ge(e))==f?v:c),u||(h=(h=Ge(t))==f?v:h);var p=c==v&&!Y(e),d=h==v&&!Y(t),y=c==h;if(y&&!p)return o||(o=new Pe),s||ft(e)?qe(e,t,r,n,i,o):He(e,t,c,r,n,i,o);if(!(i&a)){var g=p&&oe.call(e,"__wrapped__"),m=d&&oe.call(t,"__wrapped__");if(g||m){var b=g?e.value():e,_=m?t.value():t;return o||(o=new Pe),r(b,_,n,i,o)}}return!!y&&(o||(o=new Pe),function(e,t,r,n,i,o){var s=i&a,u=lt(e),c=u.length;if(c!=lt(t).length&&!s)return!1;for(var f=c;f--;){var l=u[f];if(!(s?l in t:oe.call(t,l)))return!1}var h=o.get(e);if(h&&o.get(t))return h==t;var p=!0;o.set(e,t),o.set(t,e);for(var d=s;++f<c;){var y=e[l=u[f]],g=t[l];if(n)var m=s?n(g,y,l,t,e,o):n(y,g,l,e,t,o);if(!(void 0===m?y===g||r(y,g,n,i,o):m)){p=!1;break}d||(d="constructor"==l)}if(p&&!d){var b=e.constructor,v=t.constructor;b!=v&&"constructor"in e&&"constructor"in t&&!("function"==typeof b&&b instanceof b&&"function"==typeof v&&v instanceof v)&&(p=!1)}return o.delete(e),o.delete(t),p}(e,t,r,n,i,o))}(e,t,Ke,r,n,i))}function je(e){return!(!at(e)||function(e){return!!ne&&ne in e}(e))&&(ot(e)||Y(e)?ae:R).test(Qe(e))}function Me(e){return"function"==typeof e?e:null==e?ht:"object"==typeof e?nt(e)?function(e,t){return $e(e)&&Ye(t)?Je(Ze(e),t):function(r){var n=function(e,t,r){var n=null==e?void 0:Ne(e,t);return void 0===n?r:n}(r,e);return void 0===n&&n===t?function(e,t){return null!=e&&function(e,t,r){for(var n,i=-1,o=(t=$e(t,e)?[t]:Ue(t)).length;++i<o;){var s=Ze(t[i]);if(!(n=null!=e&&r(e,s)))break;e=e[s]}return n||!!(o=e?e.length:0)&&st(o)&&We(s,o)&&(nt(e)||rt(e))}(e,t,Le)}(r,e):Ke(t,n,void 0,s|a)}}(e[0],e[1]):function(e){var t=function(e){for(var t=lt(e),r=t.length;r--;){var n=t[r],i=e[n];t[r]=[n,i,Ye(i)]}return t}(e);return 1==t.length&&t[0][2]?Je(t[0][0],t[0][1]):function(r){return r===e||function(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;){var f=(c=r[i])[0],l=e[f],h=c[1];if(u&&c[2]){if(void 0===l&&!(f in e))return!1}else{var p=new Pe;if(n)var d=n(l,h,f,e,t,p);if(!(void 0===d?Ke(h,l,n,s|a,p):d))return!1}}return!0}(r,e,t)}}(e):function(e){return $e(e)?function(e){return function(t){return null==t?void 0:t[e]}}(Ze(e)):function(e){return function(t){return Ne(t,e)}}(e)}(e)}function De(e){if(!function(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||te)}(e))return he(e);var t=[];for(var r in Object(e))oe.call(e,r)&&"constructor"!=r&&t.push(r);return t}function Ue(e){return nt(e)?e:Xe(e)}Ie.prototype.clear=function(){this.__data__=be?be(null):{}},Ie.prototype.delete=function(e){return this.has(e)&&delete this.__data__[e]},Ie.prototype.get=function(e){var t=this.__data__;if(be){var r=t[e];return r===o?void 0:r}return oe.call(t,e)?t[e]:void 0},Ie.prototype.has=function(e){var t=this.__data__;return be?void 0!==t[e]:oe.call(t,e)},Ie.prototype.set=function(e,t){return this.__data__[e]=be&&void 0===t?o:t,this},Te.prototype.clear=function(){this.__data__=[]},Te.prototype.delete=function(e){var t=this.__data__,r=Re(t,e);return!(r<0||(r==t.length-1?t.pop():le.call(t,r,1),0))},Te.prototype.get=function(e){var t=this.__data__,r=Re(t,e);return r<0?void 0:t[r][1]},Te.prototype.has=function(e){return Re(this.__data__,e)>-1},Te.prototype.set=function(e,t){var r=this.__data__,n=Re(r,e);return n<0?r.push([e,t]):r[n][1]=t,this},Be.prototype.clear=function(){this.__data__={hash:new Ie,map:new(de||Te),string:new Ie}},Be.prototype.delete=function(e){return ze(this,e).delete(e)},Be.prototype.get=function(e){return ze(this,e).get(e)},Be.prototype.has=function(e){return ze(this,e).has(e)},Be.prototype.set=function(e,t){return ze(this,e).set(e,t),this},Ce.prototype.add=Ce.prototype.push=function(e){return this.__data__.set(e,o),this},Ce.prototype.has=function(e){return this.__data__.has(e)},Pe.prototype.clear=function(){this.__data__=new Te},Pe.prototype.delete=function(e){return this.__data__.delete(e)},Pe.prototype.get=function(e){return this.__data__.get(e)},Pe.prototype.has=function(e){return this.__data__.has(e)},Pe.prototype.set=function(e,t){var r=this.__data__;if(r instanceof Te){var i=r.__data__;if(!de||i.length<n-1)return i.push([e,t]),this;r=this.__data__=new Be(i)}return r.set(e,t),this};var Fe=ge&&1/X(new ge([,-0]))[1]==u?function(e){return new ge(e)}:function(){};function qe(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 Ce: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(!G(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 He(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 ce(e),new ce(t)));case h:case p:case b:return tt(+e,+t);case d:return e.name==t.name&&e.message==t.message;case w:case k:return e==t+"";case m:var c=J;case S:var f=o&a;if(c||(c=X),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=qe(c(e),c(t),n,i,o,u);return u.delete(e),y;case E:if(Ae)return Ae.call(e)==Ae.call(t)}return!1}function ze(e,t){var r=e.__data__;return function(e){var t=typeof e;return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e}(t)?r["string"==typeof t?"string":"hash"]:r.map}function Ve(e,t){var r=function(e,t){return null==e?void 0:e[t]}(e,t);return je(r)?r:void 0}var Ge=function(e){return se.call(e)};function We(e,t){return!!(t=null==t?c:t)&&("number"==typeof e||N.test(e))&&e>-1&&e%1==0&&e<t}function $e(e,t){if(nt(e))return!1;var r=typeof e;return!("number"!=r&&"symbol"!=r&&"boolean"!=r&&null!=e&&!ct(e))||B.test(e)||!T.test(e)||null!=t&&e in Object(t)}function Ye(e){return e==e&&!at(e)}function Je(e,t){return function(r){return null!=r&&r[e]===t&&(void 0!==t||e in Object(r))}}(pe&&Ge(new pe(new ArrayBuffer(1)))!=I||de&&Ge(new de)!=m||ye&&Ge(ye.resolve())!=_||ge&&Ge(new ge)!=S||me&&Ge(new me)!=A)&&(Ge=function(e){var t=se.call(e),r=t==v?e.constructor:void 0,n=r?Qe(r):void 0;if(n)switch(n){case ve:return I;case _e:return m;case we:return _;case Se:return S;case ke:return A}return t});var Xe=et(function(e){e=function(e){return null==e?"":function(e){if("string"==typeof e)return e;if(ct(e))return xe?xe.call(e):"";var t=e+"";return"0"==t&&1/e==-u?"-0":t}(e)}(e);var t=[];return C.test(e)&&t.push(""),e.replace(P,function(e,r,n,i){t.push(n?i.replace(O,"$1"):r||e)}),t});function Ze(e){if("string"==typeof e||ct(e))return e;var t=e+"";return"0"==t&&1/e==-u?"-0":t}function Qe(e){if(null!=e){try{return ie.call(e)}catch(e){}try{return e+""}catch(e){}}return""}function et(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(et.Cache||Be),r}function tt(e,t){return e===t||e!=e&&t!=t}function rt(e){return function(e){return ut(e)&&it(e)}(e)&&oe.call(e,"callee")&&(!fe.call(e,"callee")||se.call(e)==f)}et.Cache=Be;var nt=Array.isArray;function it(e){return null!=e&&st(e.length)&&!ot(e)}function ot(e){var t=at(e)?se.call(e):"";return t==y||t==g}function st(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=c}function at(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function ut(e){return!!e&&"object"==typeof e}function ct(e){return"symbol"==typeof e||ut(e)&&se.call(e)==E}var ft=H?function(e){return function(t){return e(t)}}(H):function(e){return ut(e)&&st(e.length)&&!!L[se.call(e)]};function lt(e){return it(e)?Oe(e):De(e)}function ht(e){return e}r.exports=function(e,t){return e&&e.length?function(e,t,r){var i=-1,o=z,s=e.length,a=!0,u=[],c=u;if(r)a=!1,o=V;else if(s>=n){var f=t?null:Fe(e);if(f)return X(f);a=!1,o=$,c=new Ce}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}(e,Me(t)):[]}}).call(this,r(6),r(27)(e))},function(e,t,r){"use strict";(function(t){const n=r(44),i=r(136),o=r(985),s=r(269),a=r(20);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];if(0!==s(i).size){if(++n>=r.length)throw v("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=_(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=_(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=_(e);return e.length>1?[t.code,o.toString(t.code,e[1])]:[t.code]})}function h(e){return g(t.concat(n(e,function(e){const r=_(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;return a.decode(t)+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=p(s(n),e.slice(r+i));if(0===o){t.push([n]),r+=i;continue}const u=e.slice(r+i,r+i+o);if((r+=o+i)>e.length)throw v("Invalid address buffer: "+e.toString("hex"));t.push([n,u])}return t}function y(e){return h(f(u(e=b(e))))}function g(e){const r=m(e);if(r)throw r;return t.from(e)}function m(e){try{d(e)}catch(e){return e}}function b(e){return"/"+i(e.trim().split("/")).join("/")}function v(e){return new Error("Error parsing address: "+e)}function _(e){return s(e[0])}e.exports={stringToStringTuples:u,stringTuplesToString:c,tuplesToStringTuples:l,stringTuplesToTuples:f,bufferToTuples:d,tuplesToBuffer:h,bufferToString:function(e){return c(l(d(e)))},stringToBuffer:y,fromString:function(e){return y(e)},fromBuffer:g,validateBuffer:m,isValidBuffer:function(e){return void 0===m(e)},cleanPath:b,ParseError:v,protoFromTuple:_,sizeForAddr:p}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(t){const n=r(137),i=r(138),o=r(269),s=r(14),a=r(20);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)}e.exports=u,u.toString=function(e,t){switch((e=o(e)).code){case 4:case 41:return n.toString(t);case 6:case 17:case 33:case 132:return function(e){return e.readUInt16BE(0)}(t);case 54:case 55:case 56:return function(e){const t=a.decode(e);if((e=e.slice(a.decode.bytes)).length!==t)throw new Error("inconsistent lengths");return e.toString()}(t);case 421:return function(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)}(t);default:return t.toString("hex")}},u.toBuffer=function(e,r){switch((e=o(e)).code){case 4:return c(new i.Address4(r));case 41:return c(new i.Address6(r));case 6:case 17:case 33:case 132:return function(e){const r=t.alloc(2);return r.writeUInt16BE(e,0),r}(parseInt(r,10));case 54:case 55:case 56:return function(e){const r=t.from(e),n=t.from(a.encode(r.length));return t.concat([n,r])}(r);case 421:return function(e){const r=t.from(s.decode(e)),n=t.from(a.encode(r.length));return t.concat([n,r])}(r);default:return t.from(r,"hex")}}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(n){const i=r(12),o=r(987),s=r(17),a=r(4);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).create=function(e,t){"function"==typeof e&&(t=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(491),i=r(989),o=r(991);(t=e.exports).aes=i,t.hmac=n,t.keys=o,t.randomBytes=r(496),t.pbkdf2=r(1002)},function(e,t,r){"use strict";e.exports={SHA1:20,SHA256:32,SHA512:64}},function(e,t,r){"use strict";const n=r(990),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);r(null,{encrypt(e,t){t(null,s.update(e))},decrypt(e,t){t(null,a.update(e))}})}},function(e,t,r){"use strict";const n=r(57);e.exports={createCipheriv:n.createCipheriv,createDecipheriv:n.createDecipheriv}},function(e,t,r){"use strict";(function(n){const i=r(10)(r(272)),o=r(16);t=e.exports;const s={rsa:r(992),ed25519:r(997),secp256k1:r(59)(i,r(496))};function a(e){return void 0!==s[e.toLowerCase()]}t.supportedKeys=s,t.keysPBM=i,t.keyStretcher=r(999),t.generateEphemeralKeyPair=r(1e3),t.generateKeyPair=((e,t,r)=>{let n=s[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=s[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=i.PublicKey.decode(e),r=t.Data;switch(t.Type){case i.KeyType.RSA:return s.rsa.unmarshalRsaPublicKey(r);case i.KeyType.Ed25519:return s.ed25519.unmarshalEd25519PublicKey(r);case i.KeyType.Secp256k1:if(s.secp256k1)return s.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(!a(t=(t||"rsa").toLowerCase()))throw new Error("invalid or unsupported key type");return e.bytes}),t.unmarshalPrivateKey=((e,t)=>{let r;try{r=i.PrivateKey.decode(e)}catch(e){return t(e)}const n=r.Data;switch(r.Type){case i.KeyType.RSA:return s.rsa.unmarshalRsaPrivateKey(n,t);case i.KeyType.Ed25519:return s.ed25519.unmarshalEd25519PrivateKey(n,t);case i.KeyType.Secp256k1:return s.secp256k1?s.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(!a(t=(t||"rsa").toLowerCase()))throw new Error("invalid or unsupported key type");return e.bytes}),t.import=((e,t,r)=>{try{const i=o.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 a=o.asn1.toDer(o.pki.privateKeyToAsn1(i));return a=n.from(a.getBytes(),"binary"),s.rsa.unmarshalRsaPrivateKey(a,r)}catch(e){r(e)}})}).call(this,r(0).Buffer)},function(e,t,r){"use strict";const n=r(492),i=r(10),o=r(14),s=r(494),a=i(r(272)),u=r(16),c=r(3);class f{constructor(e){this._key=e}verify(e,t,r){h(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){h(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){h(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){h(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"),h(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){if("function"!=typeof e)throw new Error("callback is required")}e.exports={RsaPublicKey:f,RsaPrivateKey:l,unmarshalRsaPublicKey:function(e){const t=s.utils.pkixToJwk(e);return new f(t)},unmarshalRsaPrivateKey:function(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))})},generateKeyPair:function(e,t){s.generateKey(e,(e,r)=>{if(e)return t(e);t(null,new l(r.privateKey,r.publicKey))})},fromJwk:function(e,t){s.unmarshalPrivateKey(e,(e,r)=>{if(e)return t(e);t(null,new l(r.privateKey,r.publicKey))})}}},function(e,t,r){"use strict";(function(t){const n=r(38),i=r(39),o=r(493),s=r(994),a=o.toCallback,u=o.toBuf,c=o.fromString,f=o.fromNumberTo32BitBuf;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(995),dblSha2256:(e,r)=>{s.sha2256(e,(e,n)=>{e&&r(e),s.sha2256(t.from(n),r)})}}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(t){const n=r(40),i=self.crypto?self.crypto.subtle||self.crypto.webkitSubtle:self.msCrypto?self.msCrypto.subtle:void 0;function o(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)}}e.exports={sha1:function(e,t){o("SHA-1")(e,t)},sha2256:function(e,t){o("SHA-256")(e,t)},sha2512:function(e,t){o("SHA-512")(e,t)}}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(t){const n=r(41),i=r(493).toCallback,o={init:n.blake2bInit,update:n.blake2bUpdate,digest:n.blake2bFinal},s={init:n.blake2sInit,update:n.blake2sUpdate,digest:n.blake2sFinal},a=(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[45569+t]=a(t+1,o);for(let t=0;t<32;t++)e[45633+t]=a(t+1,s)})}).call(this,r(0).Buffer)},function(e,t,r){"use strict";const n=r(15),i=r(495),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(492),i=r(10),o=r(14),s=r(998),a=i(r(272));class u{constructor(e){this._key=l(e,s.publicKeyLength)}verify(e,t,r){f(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){f(e),n(this.bytes,"sha2-256",e)}}class c{constructor(e,t){this._key=l(e,s.privateKeyLength),this._publicKey=l(t,s.publicKeyLength)}sign(e,t){f(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){f(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){if("function"!=typeof e)throw new Error("callback is required")}function l(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:function(e,t){try{e=l(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))},unmarshalEd25519PublicKey:function(e){return e=l(e,s.publicKeyLength),new u(e)},generateKeyPair:function(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)})},generateKeyPairFromSeed:function(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)})}}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(e){const n=r(58),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(37),i=r(491),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=t.from("key expansion"),h=2*(f+c+20);i.create(r,s,(e,r)=>{if(e)return a(e);r.digest(l,(e,i)=>{if(e)return a(e);let o=[],s=0;n(()=>s<h,function(e){r.digest(t.concat([i,l]),(t,n)=>{if(t)return e(t);let a=n.length;s+a>h&&(a=h-s),o.push(n),s+=a,r.digest(i,(t,r)=>{if(t)return e(t);i=r,e()})})},function(e){if(e)return a(e);const r=h/2,n=t.concat(o),i=n.slice(0,r),s=n.slice(r,h),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)})})})})})}).call(this,r(0).Buffer)},function(e,t,r){"use strict";const n=r(1001);e.exports=((e,t)=>{n.generateEphmeralKeyPair(e,t)})},function(e,t,r){"use strict";(function(e){const n=r(271)(),i=r(270),o=r(15).bignum,s=r(495),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(16),i={sha1:"sha1","sha2-256":"sha256","sha2-512":"sha512"};e.exports=function(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)}},function(e,t,r){"use strict";const n=r(497).extend(r(1004)),i=n.object().keys({repo:n.alternatives().try(n.object(),n.string()).allow(null),repoOwner:n.boolean().default(!0),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(1005),i=r(78);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(t){const n=r(44),i=r(26),o=r(1006),s=r(274),a=r(20),u=r(14),c=r(61),f=new Error("Sorry, Not Implemented Yet."),l=c.proto(function(e){if(!(this instanceof l))return new l(e);if(null==e&&(e=""),e instanceof t)this.buffer=o.fromBuffer(e);else if("string"==typeof e||e instanceof String)this.buffer=o.fromString(e);else{if(!(e.buffer&&e.protos&&e.protoCodes))throw new Error("addr must be a string, Buffer, or another Multiaddr");this.buffer=o.fromBuffer(e.buffer)}},{className:"Multiaddr",symbolName:"@multiformats/js-multiaddr/multiaddr"});l.prototype.toString=function(){return o.bufferToString(this.buffer)},l.prototype.toOptions=function(){const e={},t=this.toString().split("/");return e.family="ip4"===t[1]?"ipv4":"ipv6",e.host=t[2],e.transport=t[3],e.port=t[4],e},l.prototype.inspect=function(){return"<Multiaddr "+this.buffer.toString("hex")+" - "+o.bufferToString(this.buffer)+">"},l.prototype.protos=function(){return n(this.protoCodes(),function(e){return i(s(e))})},l.prototype.protoCodes=function(){const e=[],t=this.buffer;let r=0;for(;r<t.length;){const n=a.decode(t,r),i=a.decode.bytes,u=s(n);r+=o.sizeForAddr(u,t.slice(r+i))+i,e.push(n)}return e},l.prototype.protoNames=function(){return n(this.protos(),function(e){return e.name})},l.prototype.tuples=function(){return o.bufferToTuples(this.buffer)},l.prototype.stringTuples=function(){const e=o.bufferToTuples(this.buffer);return o.tuplesToStringTuples(e)},l.prototype.encapsulate=function(e){return e=l(e),l(this.toString()+e.toString())},l.prototype.decapsulate=function(e){e=e.toString();const t=this.toString(),r=t.lastIndexOf(e);if(r<0)throw new Error("Address "+this+" does not contain subaddress: "+e);return l(t.slice(0,r))},l.prototype.getPeerId=function(){let e=null;try{e=this.stringTuples().filter(e=>{if(e[0]===s.names.ipfs.code)return!0})[0][1],u.decode(e)}catch(t){e=null}return e},l.prototype.equals=function(e){return this.buffer.equals(e.buffer)},l.prototype.nodeAddress=function(){if(!this.isThinWaistAddress())throw new Error('Multiaddr must be "thin waist" address for nodeAddress.');const e=this.protoCodes(),t=this.toString().split("/").slice(1);return{family:41===e[0]?"IPv6":"IPv4",address:t[1],port:t[3]}},l.fromNodeAddress=function(e,t){if(!e)throw new Error("requires node address object");if(!t)throw new Error("requires transport protocol");const r="IPv6"===e.family?"ip6":"ip4";return l("/"+[r,e.address,t,e.port].join("/"))},l.prototype.isThinWaistAddress=function(e){const t=(e||this).protos();return!(2!==t.length||4!==t[0].code&&41!==t[0].code||6!==t[1].code&&17!==t[1].code)},l.prototype.fromStupidString=function(e){throw f},l.protocols=s,l.isName=function(e){return!!l.isMultiaddr(e)&&e.protos().some(e=>e.resolvable)},l.resolve=function(e,t){return l.isMultiaddr(e)&&l.isName(e)?t(new Error("not implemented yet")):t(new Error("not a valid name"))},e.exports=l}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(t){const n=r(44),i=r(136),o=r(1007),s=r(274),a=r(20);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];if(0!==s(i).size){if(++n>=r.length)throw v("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=_(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=_(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=_(e);return e.length>1?[t.code,o.toString(t.code,e[1])]:[t.code]})}function h(e){return g(t.concat(n(e,function(e){const r=_(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;return a.decode(t)+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=p(s(n),e.slice(r+i));if(0===o){t.push([n]),r+=i;continue}const u=e.slice(r+i,r+i+o);if((r+=o+i)>e.length)throw v("Invalid address buffer: "+e.toString("hex"));t.push([n,u])}return t}function y(e){return h(f(u(e=b(e))))}function g(e){const r=m(e);if(r)throw r;return t.from(e)}function m(e){try{d(e)}catch(e){return e}}function b(e){return"/"+i(e.trim().split("/")).join("/")}function v(e){return new Error("Error parsing address: "+e)}function _(e){return s(e[0])}e.exports={stringToStringTuples:u,stringTuplesToString:c,tuplesToStringTuples:l,stringTuplesToTuples:f,bufferToTuples:d,tuplesToBuffer:h,bufferToString:function(e){return c(l(d(e)))},stringToBuffer:y,fromString:function(e){return y(e)},fromBuffer:g,validateBuffer:m,isValidBuffer:function(e){return void 0===m(e)},cleanPath:b,ParseError:v,protoFromTuple:_,sizeForAddr:p}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(t){const n=r(137),i=r(138),o=r(274),s=r(14),a=r(20);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)}e.exports=u,u.toString=function(e,t){switch((e=o(e)).code){case 4:case 41:return n.toString(t);case 6:case 17:case 33:case 132:return function(e){return e.readUInt16BE(0)}(t);case 54:case 55:case 56:return function(e){const t=a.decode(e);if((e=e.slice(a.decode.bytes)).length!==t)throw new Error("inconsistent lengths");return e.toString()}(t);case 421:return function(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)}(t);default:return t.toString("hex")}},u.toBuffer=function(e,r){switch((e=o(e)).code){case 4:return c(new i.Address4(r));case 41:return c(new i.Address6(r));case 6:case 17:case 33:case 132:return function(e){const r=t.alloc(2);return r.writeUInt16BE(e,0),r}(parseInt(r,10));case 54:case 55:case 56:return function(e){const r=t.from(e),n=t.from(a.encode(r.length));return t.concat([n,r])}(r);case 421:return function(e){const r=t.from(s.decode(e)),n=t.from(a.encode(r.length));return t.concat([n,r])}(r);default:return t.from(r,"hex")}}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(t){const n=r(44),i=r(26),o=r(1009),s=r(275),a=r(20),u=r(14),c=r(61),f=new Error("Sorry, Not Implemented Yet."),l=c.proto(function(e){if(!(this instanceof l))return new l(e);if(null==e&&(e=""),e instanceof t)this.buffer=o.fromBuffer(e);else if("string"==typeof e||e instanceof String)this.buffer=o.fromString(e);else{if(!(e.buffer&&e.protos&&e.protoCodes))throw new Error("addr must be a string, Buffer, or another Multiaddr");this.buffer=o.fromBuffer(e.buffer)}},{className:"Multiaddr",symbolName:"@multiformats/js-multiaddr/multiaddr"});l.prototype.toString=function(){return o.bufferToString(this.buffer)},l.prototype.toOptions=function(){const e={},t=this.toString().split("/");return e.family="ip4"===t[1]?"ipv4":"ipv6",e.host=t[2],e.transport=t[3],e.port=t[4],e},l.prototype.inspect=function(){return"<Multiaddr "+this.buffer.toString("hex")+" - "+o.bufferToString(this.buffer)+">"},l.prototype.protos=function(){return n(this.protoCodes(),function(e){return i(s(e))})},l.prototype.protoCodes=function(){const e=[],t=this.buffer;let r=0;for(;r<t.length;){const n=a.decode(t,r),i=a.decode.bytes,u=s(n);r+=o.sizeForAddr(u,t.slice(r+i))+i,e.push(n)}return e},l.prototype.protoNames=function(){return n(this.protos(),function(e){return e.name})},l.prototype.tuples=function(){return o.bufferToTuples(this.buffer)},l.prototype.stringTuples=function(){const e=o.bufferToTuples(this.buffer);return o.tuplesToStringTuples(e)},l.prototype.encapsulate=function(e){return e=l(e),l(this.toString()+e.toString())},l.prototype.decapsulate=function(e){e=e.toString();const t=this.toString(),r=t.lastIndexOf(e);if(r<0)throw new Error("Address "+this+" does not contain subaddress: "+e);return l(t.slice(0,r))},l.prototype.getPeerId=function(){let e=null;try{e=this.stringTuples().filter(e=>{if(e[0]===s.names.ipfs.code)return!0})[0][1],u.decode(e)}catch(t){e=null}return e},l.prototype.equals=function(e){return this.buffer.equals(e.buffer)},l.prototype.nodeAddress=function(){if(!this.isThinWaistAddress())throw new Error('Multiaddr must be "thin waist" address for nodeAddress.');const e=this.protoCodes(),t=this.toString().split("/").slice(1);return{family:41===e[0]?"IPv6":"IPv4",address:t[1],port:t[3]}},l.fromNodeAddress=function(e,t){if(!e)throw new Error("requires node address object");if(!t)throw new Error("requires transport protocol");const r="IPv6"===e.family?"ip6":"ip4";return l("/"+[r,e.address,t,e.port].join("/"))},l.prototype.isThinWaistAddress=function(e){const t=(e||this).protos();return!(2!==t.length||4!==t[0].code&&41!==t[0].code||6!==t[1].code&&17!==t[1].code)},l.prototype.fromStupidString=function(e){throw f},l.protocols=s,l.isName=function(e){return!!l.isMultiaddr(e)&&e.protos().some(e=>e.resolvable)},l.resolve=function(e,t){return l.isMultiaddr(e)&&l.isName(e)?t(new Error("not implemented yet")):t(new Error("not a valid name"))},e.exports=l}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(t){const n=r(44),i=r(136),o=r(1010),s=r(275),a=r(20);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];if(0!==s(i).size){if(++n>=r.length)throw v("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=_(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=_(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=_(e);return e.length>1?[t.code,o.toString(t.code,e[1])]:[t.code]})}function h(e){return g(t.concat(n(e,function(e){const r=_(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;return a.decode(t)+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=p(s(n),e.slice(r+i));if(0===o){t.push([n]),r+=i;continue}const u=e.slice(r+i,r+i+o);if((r+=o+i)>e.length)throw v("Invalid address buffer: "+e.toString("hex"));t.push([n,u])}return t}function y(e){return h(f(u(e=b(e))))}function g(e){const r=m(e);if(r)throw r;return t.from(e)}function m(e){try{d(e)}catch(e){return e}}function b(e){return"/"+i(e.trim().split("/")).join("/")}function v(e){return new Error("Error parsing address: "+e)}function _(e){return s(e[0])}e.exports={stringToStringTuples:u,stringTuplesToString:c,tuplesToStringTuples:l,stringTuplesToTuples:f,bufferToTuples:d,tuplesToBuffer:h,bufferToString:function(e){return c(l(d(e)))},stringToBuffer:y,fromString:function(e){return y(e)},fromBuffer:g,validateBuffer:m,isValidBuffer:function(e){return void 0===m(e)},cleanPath:b,ParseError:v,protoFromTuple:_,sizeForAddr:p}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(t){const n=r(137),i=r(138),o=r(275),s=r(14),a=r(20);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)}e.exports=u,u.toString=function(e,t){switch((e=o(e)).code){case 4:case 41:return n.toString(t);case 6:case 17:case 33:case 132:return function(e){return e.readUInt16BE(0)}(t);case 54:case 55:case 56:return function(e){const t=a.decode(e);if((e=e.slice(a.decode.bytes)).length!==t)throw new Error("inconsistent lengths");return e.toString()}(t);case 421:return function(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)}(t);default:return t.toString("hex")}},u.toBuffer=function(e,r){switch((e=o(e)).code){case 4:return c(new i.Address4(r));case 41:return c(new i.Address6(r));case 6:case 17:case 33:case 132:return function(e){const r=t.alloc(2);return r.writeUInt16BE(e,0),r}(parseInt(r,10));case 54:case 55:case 56:return function(e){const r=t.from(e),n=t.from(a.encode(r.length));return t.concat([n,r])}(r);case 421:return function(e){const r=t.from(s.decode(e)),n=t.from(a.encode(r.length));return t.concat([n,r])}(r);default:return t.from(r,"hex")}}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";const n=r(4),i=r(155).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=>i(e));if(r){const r=Object.assign({bits:2048,pass:e._options.pass},"object"==typeof t.init?t.init:{});return e.init(r,e=>i(e))}i()},t=>{if(!i)return t();e.start(t)}],t=>{if(t)return e.emit("error",t);e.log("booted"),e.emit("ready")})})},function(e,t,r){"use strict";t.preStart=r(1013),t.start=r(1039),t.stop=r(1062),t.isOnline=r(1063),t.version=r(1064),t.id=r(1065),t.repo=r(510),t.init=r(1066),t.bootstrap=r(1068),t.config=r(1069),t.block=r(1070),t.object=r(1071),t.dag=r(1073),t.libp2p=r(1078),t.swarm=r(1378),t.ping=r(1381),t.pingPullStream=r(1382),t.pingReadableStream=r(1383),t.pin=r(1384),t.files=r(1388),t.bitswap=r(597),t.pubsub=r(1420),t.dht=r(1421),t.dns=r(1424),t.key=r(1426),t.stats=r(1427),t.mfs=r(1429)},function(e,t,r){"use strict";const n=r(110),i=r(51),o=r(60),s=r(4),a=r(498),u=r(273),c=r(1038);e.exports=function(e){return t=>{e.log("pre-start");const r=e._options.pass;s([t=>e._repo.config.get(t),(t,r)=>{if(!e._options.config)return r(null,t);u(t,e._options.config),e.config.replace(t,e=>{if(e)return r(e);r(null,t)})},(t,r)=>{if(t.Keychain)return r(null,t);t.Keychain=a.generateOptions(),e.config.set("Keychain",t.Keychain,n=>{e.log("using default keychain options"),r(n,t)})},(t,n)=>{if(e._keychain);else if(r){const n=Object.assign({passPhrase:r},t.Keychain);e._keychain=new a(e._repo.keys,n),e.log("keychain constructed")}else e._keychain=new c,e.log("no keychain, use --pass");n(null,t)},(e,t)=>{const r=e.Identity.PrivKey;n.createFromPrivKey(r,(r,n)=>{t(r,e,n)})},(t,n,i)=>{if(!r)return i(null,t,n);e._keychain.findKeyByName("self",r=>{if(r)return e.log('Creating "self" key'),e._keychain.importPeer("self",n,e=>i(e,t,n));i(null,t,n)})},(t,r,n)=>{e.log("peer created"),e._peerInfo=new i(r),t.Addresses&&t.Addresses.Swarm&&t.Addresses.Swarm.forEach(t=>{let r=o(t);r.getPeerId()&&(r=r.encapsulate("/ipfs/"+e._peerInfo.id.toB58String())),e._peerInfo.multiaddrs.add(r)}),n()},t=>e.pin._load(t)],t)}}},function(e,t,r){"use strict";const n=r(1015),i=r(1019),o=r(1020),s=r(34),a=r(8),u=r(1036),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=800*Math.random()+200;"string"==typeof t&&(t=new Error(t)),setTimeout(e,r,t,null)}function y(e){return new s.Key(c+e)}function g(e){return new s.Key(f+e)}e.exports=class{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={prefix:f};a(this.store.query(t),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())})}}},function(e,t,r){"use strict";var n=r(1016),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(1017),i=r(1018);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){if("string"!=typeof t)throw new Error("Input must be string");for(var o,s,a=t.length,u=0,c=0;c<a;c+=1){if(o=t.charCodeAt(c),s=t[c],n(o)&&i(t.charCodeAt(c+1))&&(s+=t[c+=1]),(u+=e(s))===r)return t.slice(0,c+1);if(u>r)return t.slice(0,c-s.length+1)}return t}},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){if("string"!=typeof e)throw new Error("Input must be string");for(var t=e.length,r=0,o=null,s=null,a=0;a<t;a++)i(o=e.charCodeAt(a))?null!=s&&n(s)?r+=1:r+=3:o<=127?r+=1:o>=128&&o<=2047?r+=2:o>=2048&&o<=65535&&(r+=3),s=o;return r}},function(e,t,r){"use strict";var n=function(e){return function(e){return!!e&&"object"==typeof e}(e)&&!function(e){var t=Object.prototype.toString.call(e);return"[object RegExp]"===t||"[object Date]"===t||function(e){return e.$$typeof===i}(e)}(e)};var i="function"==typeof Symbol&&Symbol.for?Symbol.for("react.element"):60103;function o(e,t){return t&&!0===t.clone&&n(e)?u(function(e){return Array.isArray(e)?[]:{}}(e),e,t):e}function s(e,t,r){var i=e.slice();return t.forEach(function(t,s){void 0===i[s]?i[s]=o(t,r):n(t)?i[s]=u(e[s],t,r):-1===e.indexOf(t)&&i.push(o(t,r))}),i}function a(e,t,r){var i={};return n(e)&&Object.keys(e).forEach(function(t){i[t]=o(e[t],r)}),Object.keys(t).forEach(function(s){n(t[s])&&e[s]?i[s]=u(e[s],t[s],r):i[s]=o(t[s],r)}),i}function u(e,t,r){var n=Array.isArray(t);return n===Array.isArray(e)?n?((r||{arrayMerge:s}).arrayMerge||s)(e,t,r):a(e,t,r):o(t,r)}u.all=function(e,t){if(!Array.isArray(e)||e.length<2)throw new Error("first argument should be an array with at least two elements");return e.reduce(function(e,r){return u(e,r,t)})};var c=u;e.exports=c},function(e,t,r){"use strict";const n=r(499),i=r(1022),o=r(1024);(t=e.exports).aes=i,t.hmac=n,t.keys=o,t.randomBytes=r(504),t.pbkdf2=r(1035)},function(e,t,r){"use strict";e.exports={SHA1:20,SHA256:32,SHA512:64}},function(e,t,r){"use strict";const n=r(1023),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);r(null,{encrypt(e,t){t(null,s.update(e))},decrypt(e,t){t(null,a.update(e))}})}},function(e,t,r){"use strict";const n=r(57);e.exports={createCipheriv:n.createCipheriv,createDecipheriv:n.createDecipheriv}},function(e,t,r){"use strict";(function(n){const i=r(10)(r(278)),o=r(16);t=e.exports;const s={rsa:r(1025),ed25519:r(1030),secp256k1:r(59)(i,r(504))};function a(e){return void 0!==s[e.toLowerCase()]}t.supportedKeys=s,t.keysPBM=i,t.keyStretcher=r(1032),t.generateEphemeralKeyPair=r(1033),t.generateKeyPair=((e,t,r)=>{let n=s[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=s[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=i.PublicKey.decode(e),r=t.Data;switch(t.Type){case i.KeyType.RSA:return s.rsa.unmarshalRsaPublicKey(r);case i.KeyType.Ed25519:return s.ed25519.unmarshalEd25519PublicKey(r);case i.KeyType.Secp256k1:if(s.secp256k1)return s.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(!a(t=(t||"rsa").toLowerCase()))throw new Error("invalid or unsupported key type");return e.bytes}),t.unmarshalPrivateKey=((e,t)=>{let r;try{r=i.PrivateKey.decode(e)}catch(e){return t(e)}const n=r.Data;switch(r.Type){case i.KeyType.RSA:return s.rsa.unmarshalRsaPrivateKey(n,t);case i.KeyType.Ed25519:return s.ed25519.unmarshalEd25519PrivateKey(n,t);case i.KeyType.Secp256k1:return s.secp256k1?s.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(!a(t=(t||"rsa").toLowerCase()))throw new Error("invalid or unsupported key type");return e.bytes}),t.import=((e,t,r)=>{try{const i=o.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 a=o.asn1.toDer(o.pki.privateKeyToAsn1(i));return a=n.from(a.getBytes(),"binary"),s.rsa.unmarshalRsaPrivateKey(a,r)}catch(e){r(e)}})}).call(this,r(0).Buffer)},function(e,t,r){"use strict";const n=r(500),i=r(10),o=r(14),s=r(502),a=i(r(278)),u=r(16),c=r(3);class f{constructor(e){this._key=e}verify(e,t,r){h(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){h(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){h(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){h(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"),h(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){if("function"!=typeof e)throw new Error("callback is required")}e.exports={RsaPublicKey:f,RsaPrivateKey:l,unmarshalRsaPublicKey:function(e){const t=s.utils.pkixToJwk(e);return new f(t)},unmarshalRsaPrivateKey:function(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))})},generateKeyPair:function(e,t){s.generateKey(e,(e,r)=>{if(e)return t(e);t(null,new l(r.privateKey,r.publicKey))})},fromJwk:function(e,t){s.unmarshalPrivateKey(e,(e,r)=>{if(e)return t(e);t(null,new l(r.privateKey,r.publicKey))})}}},function(e,t,r){"use strict";(function(t){const n=r(38),i=r(39),o=r(501),s=r(1027),a=o.toCallback,u=o.toBuf,c=o.fromString,f=o.fromNumberTo32BitBuf;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(1028),dblSha2256:(e,r)=>{s.sha2256(e,(e,n)=>{e&&r(e),s.sha2256(t.from(n),r)})}}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(t){const n=r(40),i=self.crypto?self.crypto.subtle||self.crypto.webkitSubtle:self.msCrypto?self.msCrypto.subtle:void 0;function o(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)}}e.exports={sha1:function(e,t){o("SHA-1")(e,t)},sha2256:function(e,t){o("SHA-256")(e,t)},sha2512:function(e,t){o("SHA-512")(e,t)}}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(t){const n=r(41),i=r(501).toCallback,o={init:n.blake2bInit,update:n.blake2bUpdate,digest:n.blake2bFinal},s={init:n.blake2sInit,update:n.blake2sUpdate,digest:n.blake2sFinal},a=(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[45569+t]=a(t+1,o);for(let t=0;t<32;t++)e[45633+t]=a(t+1,s)})}).call(this,r(0).Buffer)},function(e,t,r){"use strict";const n=r(15),i=r(503),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(500),i=r(10),o=r(14),s=r(1031),a=i(r(278));class u{constructor(e){this._key=l(e,s.publicKeyLength)}verify(e,t,r){f(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){f(e),n(this.bytes,"sha2-256",e)}}class c{constructor(e,t){this._key=l(e,s.privateKeyLength),this._publicKey=l(t,s.publicKeyLength)}sign(e,t){f(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){f(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){if("function"!=typeof e)throw new Error("callback is required")}function l(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:function(e,t){try{e=l(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))},unmarshalEd25519PublicKey:function(e){return e=l(e,s.publicKeyLength),new u(e)},generateKeyPair:function(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)})},generateKeyPairFromSeed:function(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)})}}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(e){const n=r(58),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(37),i=r(499),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=t.from("key expansion"),h=2*(f+c+20);i.create(r,s,(e,r)=>{if(e)return a(e);r.digest(l,(e,i)=>{if(e)return a(e);let o=[],s=0;n(()=>s<h,function(e){r.digest(t.concat([i,l]),(t,n)=>{if(t)return e(t);let a=n.length;s+a>h&&(a=h-s),o.push(n),s+=a,r.digest(i,(t,r)=>{if(t)return e(t);i=r,e()})})},function(e){if(e)return a(e);const r=h/2,n=t.concat(o),i=n.slice(0,r),s=n.slice(r,h),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)})})})})})}).call(this,r(0).Buffer)},function(e,t,r){"use strict";const n=r(1034);e.exports=((e,t)=>{n.generateEphmeralKeyPair(e,t)})},function(e,t,r){"use strict";(function(e){const n=r(277)(),i=r(276),o=r(15).bignum,s=r(503),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(16),i={sha1:"sha1","sha2-256":"sha256","sha2-512":"sha512"};e.exports=function(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)}},function(e,t,r){"use strict";(function(t){const n=r(279),i=r(16),o=r(1037);e.exports=class{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(", "))).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"))})})}}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";const n=r(16).pki;e.exports.certificateForKey=((e,t,r)=>{const i=n.setRsaPublicKey(t.n,t.e),o=n.createCertificate();o.publicKey=i,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")}e.exports=class{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()}}},function(e,t,r){"use strict";const n=r(49),i=r(1040),o=r(3),s=r(23);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),t()}],r)}))},function(e,t,r){"use strict";const n=r(4),i=r(371),o=r(50),s=r(49),a=r(80),u=r(1041),c=r(1049),f=r(1053),l=r(1059),h=r(113).logger,p=r(1060),d={statsEnabled:!1,statsComputeThrottleTimeout:1e3,statsComputeThrottleMaxQueueSize:1e3},y=["blocksReceived","dataReceived","dupBlksReceived","dupDataReceived","blocksSent","dataSent","providesBufferLength","wantListLength","peerCount"];e.exports=class{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)}}},function(e,t,r){"use strict";const n=r(3),i=r(186),o=r(187),s=r(280),a=r(1048),u=r(113).logger;e.exports=class{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 .+?Constructor\]$/,I=/^(?:0|[1-9]\d*)$/,T={};T["[object Float32Array]"]=T["[object Float64Array]"]=T["[object Int8Array]"]=T["[object Int16Array]"]=T["[object Int32Array]"]=T["[object Uint8Array]"]=T["[object Uint8ClampedArray]"]=T["[object Uint16Array]"]=T["[object Uint32Array]"]=!0,T[u]=T[c]=T[E]=T[f]=T[A]=T[l]=T[h]=T[p]=T[y]=T[g]=T[m]=T[v]=T[_]=T[w]=T[k]=!1;var B="object"==typeof e&&e&&e.Object===Object&&e,C="object"==typeof self&&self&&self.Object===Object&&self,P=B||C||Function("return this")(),O="object"==typeof t&&t&&!t.nodeType&&t,R=O&&"object"==typeof r&&r&&!r.nodeType&&r,N=R&&R.exports===O&&B.process,L=function(){try{return N&&N.binding("util")}catch(e){}}(),K=L&&L.isTypedArray;function j(e,t){for(var r=-1,n=e?e.length:0;++r<n;)if(t(e[r],r,e))return!0;return!1}function M(e){var t=!1;if(null!=e&&"function"!=typeof e.toString)try{t=!!(e+"")}catch(e){}return t}function D(e){var t=-1,r=Array(e.size);return e.forEach(function(e,n){r[++t]=[n,e]}),r}function U(e){var t=-1,r=Array(e.size);return e.forEach(function(e){r[++t]=e}),r}var F,q=Array.prototype,H=Function.prototype,z=Object.prototype,V=P["__core-js_shared__"],G=(F=/[^.]+$/.exec(V&&V.keys&&V.keys.IE_PROTO||""))?"Symbol(src)_1."+F:"",W=H.toString,$=z.hasOwnProperty,Y=z.toString,J=RegExp("^"+W.call($).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),X=P.Symbol,Z=P.Uint8Array,Q=z.propertyIsEnumerable,ee=q.splice,te=function(e,t){return function(r){return e(t(r))}}(Object.keys,Object),re=Te(P,"DataView"),ne=Te(P,"Map"),ie=Te(P,"Promise"),oe=Te(P,"Set"),se=Te(P,"WeakMap"),ae=Te(Object,"create"),ue=Pe(re),ce=Pe(ne),fe=Pe(ie),le=Pe(oe),he=Pe(se),pe=X?X.prototype:void 0,de=pe?pe.valueOf:void 0;function ye(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(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(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 be(e){var t=-1,r=e?e.length:0;for(this.__data__=new me;++t<r;)this.add(e[t])}function ve(e){this.__data__=new ge(e)}function _e(e,t){var r=Re(e)||function(e){return function(e){return Me(e)&&Ne(e)}(e)&&$.call(e,"callee")&&(!Q.call(e,"callee")||Y.call(e)==u)}(e)?function(e,t){for(var r=-1,n=Array(e);++r<e;)n[r]=t(r);return n}(e.length,String):[],n=r.length,i=!!n;for(var o in e)!t&&!$.call(e,o)||i&&("length"==o||Ce(o,n))||r.push(o);return r}function we(e,t){for(var r=e.length;r--;)if(Oe(e[r][0],t))return r;return-1}function Se(e,t,r,n,i){return e===t||(null==e||null==t||!je(e)&&!Me(t)?e!=e&&t!=t:function(e,t,r,n,i,o){var a=Re(e),f=Re(t),l=c,h=c;a||(l=(l=Be(e))==u?m:l),f||(h=(h=Be(t))==u?m:h);var p=l==m&&!M(e),d=h==m&&!M(t),y=l==h;if(y&&!p)return o||(o=new ve),a||De(e)?Ae(e,t,r,n,i,o):xe(e,t,l,r,n,i,o);if(!(i&s)){var g=p&&$.call(e,"__wrapped__"),b=d&&$.call(t,"__wrapped__");if(g||b){var v=g?e.value():e,_=b?t.value():t;return o||(o=new ve),r(v,_,n,i,o)}}return!!y&&(o||(o=new ve),function(e,t,r,n,i,o){var a=i&s,u=Ue(e),c=u.length;if(c!=Ue(t).length&&!a)return!1;for(var f=c;f--;){var l=u[f];if(!(a?l in t:$.call(t,l)))return!1}var h=o.get(e);if(h&&o.get(t))return h==t;var p=!0;o.set(e,t),o.set(t,e);for(var d=a;++f<c;){var y=e[l=u[f]],g=t[l];if(n)var m=a?n(g,y,l,t,e,o):n(y,g,l,e,t,o);if(!(void 0===m?y===g||r(y,g,n,i,o):m)){p=!1;break}d||(d="constructor"==l)}if(p&&!d){var b=e.constructor,v=t.constructor;b!=v&&"constructor"in e&&"constructor"in t&&!("function"==typeof b&&b instanceof b&&"function"==typeof v&&v instanceof v)&&(p=!1)}return o.delete(e),o.delete(t),p}(e,t,r,n,i,o))}(e,t,Se,r,n,i))}function ke(e){return!(!je(e)||function(e){return!!G&&G in e}(e))&&(Le(e)||M(e)?J:x).test(Pe(e))}function Ee(e){if(!function(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||z)}(e))return te(e);var t=[];for(var r in Object(e))$.call(e,r)&&"constructor"!=r&&t.push(r);return t}function Ae(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 be: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(!j(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 xe(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 Z(e),new Z(t)));case f:case l:case g:return Oe(+e,+t);case h:return e.name==t.name&&e.message==t.message;case v:case w:return e==t+"";case y:var c=D;case _:var p=a&s;if(c||(c=U),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=Ae(c(e),c(t),n,i,a,u);return u.delete(e),m;case S:if(de)return de.call(e)==de.call(t)}return!1}function Ie(e,t){var r=e.__data__;return function(e){var t=typeof e;return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e}(t)?r["string"==typeof t?"string":"hash"]:r.map}function Te(e,t){var r=function(e,t){return null==e?void 0:e[t]}(e,t);return ke(r)?r:void 0}ye.prototype.clear=function(){this.__data__=ae?ae(null):{}},ye.prototype.delete=function(e){return this.has(e)&&delete this.__data__[e]},ye.prototype.get=function(e){var t=this.__data__;if(ae){var r=t[e];return r===i?void 0:r}return $.call(t,e)?t[e]:void 0},ye.prototype.has=function(e){var t=this.__data__;return ae?void 0!==t[e]:$.call(t,e)},ye.prototype.set=function(e,t){return this.__data__[e]=ae&&void 0===t?i:t,this},ge.prototype.clear=function(){this.__data__=[]},ge.prototype.delete=function(e){var t=this.__data__,r=we(t,e);return!(r<0||(r==t.length-1?t.pop():ee.call(t,r,1),0))},ge.prototype.get=function(e){var t=this.__data__,r=we(t,e);return r<0?void 0:t[r][1]},ge.prototype.has=function(e){return we(this.__data__,e)>-1},ge.prototype.set=function(e,t){var r=this.__data__,n=we(r,e);return n<0?r.push([e,t]):r[n][1]=t,this},me.prototype.clear=function(){this.__data__={hash:new ye,map:new(ne||ge),string:new ye}},me.prototype.delete=function(e){return Ie(this,e).delete(e)},me.prototype.get=function(e){return Ie(this,e).get(e)},me.prototype.has=function(e){return Ie(this,e).has(e)},me.prototype.set=function(e,t){return Ie(this,e).set(e,t),this},be.prototype.add=be.prototype.push=function(e){return this.__data__.set(e,i),this},be.prototype.has=function(e){return this.__data__.has(e)},ve.prototype.clear=function(){this.__data__=new ge},ve.prototype.delete=function(e){return this.__data__.delete(e)},ve.prototype.get=function(e){return this.__data__.get(e)},ve.prototype.has=function(e){return this.__data__.has(e)},ve.prototype.set=function(e,t){var r=this.__data__;if(r instanceof ge){var i=r.__data__;if(!ne||i.length<n-1)return i.push([e,t]),this;r=this.__data__=new me(i)}return r.set(e,t),this};var Be=function(e){return Y.call(e)};function Ce(e,t){return!!(t=null==t?a:t)&&("number"==typeof e||I.test(e))&&e>-1&&e%1==0&&e<t}function Pe(e){if(null!=e){try{return W.call(e)}catch(e){}try{return e+""}catch(e){}}return""}function Oe(e,t){return e===t||e!=e&&t!=t}(re&&Be(new re(new ArrayBuffer(1)))!=A||ne&&Be(new ne)!=y||ie&&Be(ie.resolve())!=b||oe&&Be(new oe)!=_||se&&Be(new se)!=k)&&(Be=function(e){var t=Y.call(e),r=t==m?e.constructor:void 0,n=r?Pe(r):void 0;if(n)switch(n){case ue:return A;case ce:return y;case fe:return b;case le:return _;case he:return k}return t});var Re=Array.isArray;function Ne(e){return null!=e&&Ke(e.length)&&!Le(e)}function Le(e){var t=je(e)?Y.call(e):"";return t==p||t==d}function Ke(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=a}function je(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function Me(e){return!!e&&"object"==typeof e}var De=K?function(e){return function(t){return e(t)}}(K):function(e){return Me(e)&&Ke(e.length)&&!!T[Y.call(e)]};function Ue(e){return Ne(e)?_e(e):Ee(e)}r.exports=function(e,t,r){var n=(r="function"==typeof r?r:void 0)?r(e,t):void 0;return void 0===n?Se(e,t,r):!!n}}).call(this,r(6),r(27)(e))},function(e,t,r){"use strict";(function(t){const n=r(20);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(17);e.exports=class{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](){return`BitswapMessageEntry ${this.cid.toBaseEncodedString()} <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=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,B=/^\w*$/,C=/^\./,P=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,O=/\\(\\)?/g,R=/^\[object .+?Constructor\]$/,N=/^(?:0|[1-9]\d*)$/,L={};L["[object Float32Array]"]=L["[object Float64Array]"]=L["[object Int8Array]"]=L["[object Int16Array]"]=L["[object Int32Array]"]=L["[object Uint8Array]"]=L["[object Uint8ClampedArray]"]=L["[object Uint16Array]"]=L["[object Uint32Array]"]=!0,L[f]=L[l]=L[x]=L[h]=L[I]=L[p]=L[d]=L[y]=L[m]=L[b]=L[v]=L[w]=L[S]=L[k]=L[A]=!1;var K="object"==typeof e&&e&&e.Object===Object&&e,j="object"==typeof self&&self&&self.Object===Object&&self,M=K||j||Function("return this")(),D="object"==typeof t&&t&&!t.nodeType&&t,U=D&&"object"==typeof r&&r&&!r.nodeType&&r,F=U&&U.exports===D&&K.process,q=function(){try{return F&&F.binding("util")}catch(e){}}(),H=q&&q.isTypedArray;function z(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 V(e,t){for(var r=-1,n=t.length,i=e.length;++r<n;)e[i+r]=t[r];return e}function G(e,t){for(var r=-1,n=e?e.length:0;++r<n;)if(t(e[r],r,e))return!0;return!1}function W(e){return function(t){return e(t)}}function $(e){var t=!1;if(null!=e&&"function"!=typeof e.toString)try{t=!!(e+"")}catch(e){}return t}function Y(e){var t=-1,r=Array(e.size);return e.forEach(function(e,n){r[++t]=[n,e]}),r}function J(e){var t=-1,r=Array(e.size);return e.forEach(function(e){r[++t]=e}),r}var X,Z=Array.prototype,Q=Function.prototype,ee=Object.prototype,te=M["__core-js_shared__"],re=(X=/[^.]+$/.exec(te&&te.keys&&te.keys.IE_PROTO||""))?"Symbol(src)_1."+X:"",ne=Q.toString,ie=ee.hasOwnProperty,oe=ee.toString,se=RegExp("^"+ne.call(ie).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),ae=M.Symbol,ue=M.Uint8Array,ce=ee.propertyIsEnumerable,fe=Z.splice,le=ae?ae.isConcatSpreadable:void 0,he=function(e,t){return function(r){return e(t(r))}}(Object.keys,Object),pe=Math.max,de=Ye(M,"DataView"),ye=Ye(M,"Map"),ge=Ye(M,"Promise"),me=Ye(M,"Set"),be=Ye(M,"WeakMap"),ve=Ye(Object,"create"),_e=ot(de),we=ot(ye),Se=ot(ge),ke=ot(me),Ee=ot(be),Ae=ae?ae.prototype:void 0,xe=Ae?Ae.valueOf:void 0,Ie=Ae?Ae.toString:void 0;function Te(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 Be(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 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(e){var t=-1,r=e?e.length:0;for(this.__data__=new Ce;++t<r;)this.add(e[t])}function Oe(e){this.__data__=new Be(e)}function Re(e,t){var r=ft(e)||ct(e)?function(e,t){for(var r=-1,n=Array(e);++r<e;)n[r]=t(r);return n}(e.length,String):[],n=r.length,i=!!n;for(var o in e)!t&&!ie.call(e,o)||i&&("length"==o||Ze(o,n))||r.push(o);return r}function Ne(e,t){for(var r=e.length;r--;)if(ut(e[r][0],t))return r;return-1}Te.prototype.clear=function(){this.__data__=ve?ve(null):{}},Te.prototype.delete=function(e){return this.has(e)&&delete this.__data__[e]},Te.prototype.get=function(e){var t=this.__data__;if(ve){var r=t[e];return r===o?void 0:r}return ie.call(t,e)?t[e]:void 0},Te.prototype.has=function(e){var t=this.__data__;return ve?void 0!==t[e]:ie.call(t,e)},Te.prototype.set=function(e,t){return this.__data__[e]=ve&&void 0===t?o:t,this},Be.prototype.clear=function(){this.__data__=[]},Be.prototype.delete=function(e){var t=this.__data__,r=Ne(t,e);return!(r<0||(r==t.length-1?t.pop():fe.call(t,r,1),0))},Be.prototype.get=function(e){var t=this.__data__,r=Ne(t,e);return r<0?void 0:t[r][1]},Be.prototype.has=function(e){return Ne(this.__data__,e)>-1},Be.prototype.set=function(e,t){var r=this.__data__,n=Ne(r,e);return n<0?r.push([e,t]):r[n][1]=t,this},Ce.prototype.clear=function(){this.__data__={hash:new Te,map:new(ye||Be),string:new Te}},Ce.prototype.delete=function(e){return $e(this,e).delete(e)},Ce.prototype.get=function(e){return $e(this,e).get(e)},Ce.prototype.has=function(e){return $e(this,e).has(e)},Ce.prototype.set=function(e,t){return $e(this,e).set(e,t),this},Pe.prototype.add=Pe.prototype.push=function(e){return this.__data__.set(e,o),this},Pe.prototype.has=function(e){return this.__data__.has(e)},Oe.prototype.clear=function(){this.__data__=new Be},Oe.prototype.delete=function(e){return this.__data__.delete(e)},Oe.prototype.get=function(e){return this.__data__.get(e)},Oe.prototype.has=function(e){return this.__data__.has(e)},Oe.prototype.set=function(e,t){var r=this.__data__;if(r instanceof Be){var i=r.__data__;if(!ye||i.length<n-1)return i.push([e,t]),this;r=this.__data__=new Ce(i)}return r.set(e,t),this};var Le=function(e,t){return function(r,n){if(null==r)return r;if(!lt(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(e,t){return e&&Ke(e,t,bt)});var Ke=function(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 je(e,t){for(var r=0,n=(t=et(t,e)?[t]:ze(t)).length;null!=e&&r<n;)e=e[it(t[r++])];return r&&r==n?e:void 0}function Me(e,t){return null!=e&&t in Object(e)}function De(e,t,r,n,i){return e===t||(null==e||null==t||!dt(e)&&!yt(t)?e!=e&&t!=t:function(e,t,r,n,i,o){var s=ft(e),u=ft(t),c=l,h=l;s||(c=(c=Je(e))==f?v:c),u||(h=(h=Je(t))==f?v:h);var p=c==v&&!$(e),d=h==v&&!$(t),y=c==h;if(y&&!p)return o||(o=new Oe),s||mt(e)?Ge(e,t,r,n,i,o):We(e,t,c,r,n,i,o);if(!(i&a)){var g=p&&ie.call(e,"__wrapped__"),m=d&&ie.call(t,"__wrapped__");if(g||m){var b=g?e.value():e,_=m?t.value():t;return o||(o=new Oe),r(b,_,n,i,o)}}return!!y&&(o||(o=new Oe),function(e,t,r,n,i,o){var s=i&a,u=bt(e),c=u.length;if(c!=bt(t).length&&!s)return!1;for(var f=c;f--;){var l=u[f];if(!(s?l in t:ie.call(t,l)))return!1}var h=o.get(e);if(h&&o.get(t))return h==t;var p=!0;o.set(e,t),o.set(t,e);for(var d=s;++f<c;){var y=e[l=u[f]],g=t[l];if(n)var m=s?n(g,y,l,t,e,o):n(y,g,l,e,t,o);if(!(void 0===m?y===g||r(y,g,n,i,o):m)){p=!1;break}d||(d="constructor"==l)}if(p&&!d){var b=e.constructor,v=t.constructor;b!=v&&"constructor"in e&&"constructor"in t&&!("function"==typeof b&&b instanceof b&&"function"==typeof v&&v instanceof v)&&(p=!1)}return o.delete(e),o.delete(t),p}(e,t,r,n,i,o))}(e,t,De,r,n,i))}function Ue(e){return!(!dt(e)||function(e){return!!re&&re in e}(e))&&(ht(e)||$(e)?se:R).test(ot(e))}function Fe(e){return"function"==typeof e?e:null==e?vt:"object"==typeof e?ft(e)?function(e,t){return et(e)&&tt(t)?rt(it(e),t):function(r){var n=function(e,t,r){var n=null==e?void 0:je(e,t);return void 0===n?r:n}(r,e);return void 0===n&&n===t?function(e,t){return null!=e&&function(e,t,r){for(var n,i=-1,o=(t=et(t,e)?[t]:ze(t)).length;++i<o;){var s=it(t[i]);if(!(n=null!=e&&r(e,s)))break;e=e[s]}return n||!!(o=e?e.length:0)&&pt(o)&&Ze(s,o)&&(ft(e)||ct(e))}(e,t,Me)}(r,e):De(t,n,void 0,s|a)}}(e[0],e[1]):function(e){var t=function(e){for(var t=bt(e),r=t.length;r--;){var n=t[r],i=e[n];t[r]=[n,i,tt(i)]}return t}(e);return 1==t.length&&t[0][2]?rt(t[0][0],t[0][1]):function(r){return r===e||function(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;){var f=(c=r[i])[0],l=e[f],h=c[1];if(u&&c[2]){if(void 0===l&&!(f in e))return!1}else{var p=new Oe;if(n)var d=n(l,h,f,e,t,p);if(!(void 0===d?De(h,l,n,s|a,p):d))return!1}}return!0}(r,e,t)}}(e):function(e){return et(e)?function(e){return function(t){return null==t?void 0:t[e]}}(it(e)):function(e){return function(t){return je(t,e)}}(e)}(e)}function qe(e){if(!function(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||ee)}(e))return he(e);var t=[];for(var r in Object(e))ie.call(e,r)&&"constructor"!=r&&t.push(r);return t}function He(e,t,r){var n=-1;return t=z(t.length?t:[vt],W(Fe)),function(e,t){var r=e.length;for(e.sort(t);r--;)e[r]=e[r].value;return e}(function(e,t){var r=-1,n=lt(e)?Array(e.length):[];return Le(e,function(e,i,o){n[++r]=t(e,i,o)}),n}(e,function(e,r,i){return{criteria:z(t,function(t){return t(e)}),index:++n,value:e}}),function(e,t){return function(e,t,r){for(var n=-1,i=e.criteria,o=t.criteria,s=i.length,a=r.length;++n<s;){var u=Ve(i[n],o[n]);if(u)return n>=a?u:u*("desc"==r[n]?-1:1)}return e.index-t.index}(e,t,r)})}function ze(e){return ft(e)?e:nt(e)}function Ve(e,t){if(e!==t){var r=void 0!==e,n=null===e,i=e==e,o=gt(e),s=void 0!==t,a=null===t,u=t==t,c=gt(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 Ge(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 Pe: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(!G(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 We(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 ue(e),new ue(t)));case h:case p:case b:return ut(+e,+t);case d:return e.name==t.name&&e.message==t.message;case w:case k:return e==t+"";case m:var c=Y;case S:var f=o&a;if(c||(c=J),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=Ge(c(e),c(t),n,i,o,u);return u.delete(e),y;case E:if(xe)return xe.call(e)==xe.call(t)}return!1}function $e(e,t){var r=e.__data__;return function(e){var t=typeof e;return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e}(t)?r["string"==typeof t?"string":"hash"]:r.map}function Ye(e,t){var r=function(e,t){return null==e?void 0:e[t]}(e,t);return Ue(r)?r:void 0}var Je=function(e){return oe.call(e)};function Xe(e){return ft(e)||ct(e)||!!(le&&e&&e[le])}function Ze(e,t){return!!(t=null==t?c:t)&&("number"==typeof e||N.test(e))&&e>-1&&e%1==0&&e<t}function Qe(e,t,r){if(!dt(r))return!1;var n=typeof t;return!!("number"==n?lt(r)&&Ze(t,r.length):"string"==n&&t in r)&&ut(r[t],e)}function et(e,t){if(ft(e))return!1;var r=typeof e;return!("number"!=r&&"symbol"!=r&&"boolean"!=r&&null!=e&&!gt(e))||B.test(e)||!T.test(e)||null!=t&&e in Object(t)}function tt(e){return e==e&&!dt(e)}function rt(e,t){return function(r){return null!=r&&r[e]===t&&(void 0!==t||e in Object(r))}}(de&&Je(new de(new ArrayBuffer(1)))!=I||ye&&Je(new ye)!=m||ge&&Je(ge.resolve())!=_||me&&Je(new me)!=S||be&&Je(new be)!=A)&&(Je=function(e){var t=oe.call(e),r=t==v?e.constructor:void 0,n=r?ot(r):void 0;if(n)switch(n){case _e:return I;case we:return m;case Se:return _;case ke:return S;case Ee:return A}return t});var nt=at(function(e){e=function(e){return null==e?"":function(e){if("string"==typeof e)return e;if(gt(e))return Ie?Ie.call(e):"";var t=e+"";return"0"==t&&1/e==-u?"-0":t}(e)}(e);var t=[];return C.test(e)&&t.push(""),e.replace(P,function(e,r,n,i){t.push(n?i.replace(O,"$1"):r||e)}),t});function it(e){if("string"==typeof e||gt(e))return e;var t=e+"";return"0"==t&&1/e==-u?"-0":t}function ot(e){if(null!=e){try{return ne.call(e)}catch(e){}try{return e+""}catch(e){}}return""}var st=function(e,t){return t=pe(void 0===t?e.length-1:t,0),function(){for(var r=arguments,n=-1,i=pe(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,function(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)}(e,this,s)}}(function(e,t){if(null==e)return[];var r=t.length;return r>1&&Qe(e,t[0],t[1])?t=[]:r>2&&Qe(t[0],t[1],t[2])&&(t=[t[0]]),He(e,function e(t,r,n,i,o){var s=-1,a=t.length;for(n||(n=Xe),o||(o=[]);++s<a;){var u=t[s];r>0&&n(u)?r>1?e(u,r-1,n,i,o):V(o,u):i||(o[o.length]=u)}return o}(t,1),[])});function at(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(at.Cache||Ce),r}function ut(e,t){return e===t||e!=e&&t!=t}function ct(e){return function(e){return yt(e)&<(e)}(e)&&ie.call(e,"callee")&&(!ce.call(e,"callee")||oe.call(e)==f)}at.Cache=Ce;var ft=Array.isArray;function lt(e){return null!=e&&pt(e.length)&&!ht(e)}function ht(e){var t=dt(e)?oe.call(e):"";return t==y||t==g}function pt(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=c}function dt(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function yt(e){return!!e&&"object"==typeof e}function gt(e){return"symbol"==typeof e||yt(e)&&oe.call(e)==E}var mt=H?W(H):function(e){return yt(e)&&pt(e.length)&&!!L[oe.call(e)]};function bt(e){return lt(e)?Re(e):qe(e)}function vt(e){return e}r.exports=st}).call(this,r(6),r(27)(e))},function(e,t,r){"use strict";const n=r(17),i=r(9);e.exports=class{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](){return`WantlistEntry <key: ${this.cid.toBaseEncodedString()}, priority: ${this.priority}, refs: ${this._refCounter}>`}equals(e){return this._refCounter===e._refCounter&&this.cid.equals(e.cid)&&this.priority===e.priority}}},function(e,t,r){"use strict";const n=r(505),i=r(186),o=r(113).logger;e.exports=class{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(52),i=r(8),o=r(4),s=r(50),a=r(3),u=r(186),c=r(280),f=r(113).logger,l="/ipfs/bitswap/1.0.0",h="/ipfs/bitswap/1.1.0";function p(e,t,r){i(i.values([t]),n.encode(),e,i.onEnd(r))}e.exports=class{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))}p(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(e,t,r){"use strict";const n=r(2).Buffer;e.exports=function(e){e=Object.assign({fixed:!1},e||{});const t=r(20);let i=e.fixed?null:o(),s=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)).writeInt32BE(u.length,0):(t.encode(u.length,i,s),s+=t.encode.bytes,f=i.slice(s-t.encode.bytes,s),i.length-s<100&&(i=o(),s=0)),c(null,n.concat([f,u]))})}};const i=10240;function o(){return n.alloc(i)}},function(e,t,r){"use strict";const n=r(20),i=r(506),o=r(2).Buffer,s=r(46);t.decode=function(e){let t=new i,r=s(e=>{t.abort(e)});return n=>{return t(n),function n(){c(t,e,(e,t)=>{if(e)return r.end(e);r.push(t),n()})}(),r}},t.decodeFromReader=function(e,t,r){"function"==typeof t&&(r=t,t={}),c(e,t,function(e,t){if(e)return r(!0===e?new Error("Unexpected end of input from reader."):e);r(null,t)})};const a=e=>!(128&e),u=4194304;function c(e,t,r){(t=Object.assign({fixed:!1,maxLength:u},t||{})).fixed?function(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+"!"));f(e,o,r)})}(e,t.maxLength,r):function(e,t,r){let i=[];0===i.length&&function s(){e.read(1,(u,c)=>{if(u)return r(u);if(i.push(c),c&&!a(c[0]))return void s();const l=n.decode(o.concat(i));if(l>t)return r(new Error("size longer than max permitted length of "+t+"!"));f(e,l,(e,t)=>e?r(e):(i=[],t.length<l?r(new Error("Message length does not match prefix specified length.")):void r(null,t)))})}()}(e,t.maxLength,r)}function f(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;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(50),i=r(188),o=r(4),s=r(3),a=r(80),u=r(505),c=r(1055),f=r(487),l=r(507),h=r(1056),p=r(1057),d=r(186),y=r(187),g=r(1058),m=r(113).logger,b=524288;e.exports=class{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){if(t.reduce((e,t)=>e+t.data.byteLength,0)<b)return this._sendSafeBlocks(e,t,r);let n=0,o=[],s=t.length;i(t,(t,r)=>{if(s--,o.push(t),(n+=t.data.byteLength)>=b||0===s){n=0;const t=o.slice();o=[],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).map(e=>e.cid),r=c(t,(e,t)=>e.equals(t)),i=h(e,e=>e.target.toB58String());o([e=>a(r,(e,t)=>{this.blockstore.get(e,t)},e),(e,r)=>n(l(i),(r,n)=>{const i=r[0].target,o=t.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())}}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e,t,r,s){(0,n.default)(t)(e,(0,i.default)((0,o.default)(r)),s)};var n=s(r(358)),i=s(r(364)),o=s(r(36));function s(e){return e&&e.__esModule?e:{default:e}}e.exports=t.default},function(e,t,r){(function(t){var r=200,n="__lodash_hash_undefined__",i="[object Function]",o="[object GeneratorFunction]",s=/^\[object .+?Constructor\]$/,a="object"==typeof t&&t&&t.Object===Object&&t,u="object"==typeof self&&self&&self.Object===Object&&self,c=a||u||Function("return this")();function f(e,t){return!(!e||!e.length)&&function(e,t,r){if(t!=t)return function(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,h,r);for(var n=r-1,i=e.length;++n<i;)if(e[n]===t)return n;return-1}(e,t,0)>-1}function l(e,t,r){for(var n=-1,i=e?e.length:0;++n<i;)if(r(t,e[n]))return!0;return!1}function h(e){return e!=e}function p(e,t){return e.has(t)}function d(e){var t=-1,r=Array(e.size);return e.forEach(function(e){r[++t]=e}),r}var y,g=Array.prototype,m=Function.prototype,b=Object.prototype,v=c["__core-js_shared__"],_=(y=/[^.]+$/.exec(v&&v.keys&&v.keys.IE_PROTO||""))?"Symbol(src)_1."+y:"",w=m.toString,S=b.hasOwnProperty,k=b.toString,E=RegExp("^"+w.call(S).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),A=g.splice,x=j(c,"Map"),I=j(c,"Set"),T=j(Object,"create");function B(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 C(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 P(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 O(e){var t=-1,r=e?e.length:0;for(this.__data__=new P;++t<r;)this.add(e[t])}function R(e,t){for(var r=e.length;r--;)if(M(e[r][0],t))return r;return-1}function N(e){return!(!D(e)||function(e){return!!_&&_ in e}(e))&&(function(e){var t=D(e)?k.call(e):"";return t==i||t==o}(e)||function(e){var t=!1;if(null!=e&&"function"!=typeof e.toString)try{t=!!(e+"")}catch(e){}return t}(e)?E:s).test(function(e){if(null!=e){try{return w.call(e)}catch(e){}try{return e+""}catch(e){}}return""}(e))}B.prototype.clear=function(){this.__data__=T?T(null):{}},B.prototype.delete=function(e){return this.has(e)&&delete this.__data__[e]},B.prototype.get=function(e){var t=this.__data__;if(T){var r=t[e];return r===n?void 0:r}return S.call(t,e)?t[e]:void 0},B.prototype.has=function(e){var t=this.__data__;return T?void 0!==t[e]:S.call(t,e)},B.prototype.set=function(e,t){return this.__data__[e]=T&&void 0===t?n:t,this},C.prototype.clear=function(){this.__data__=[]},C.prototype.delete=function(e){var t=this.__data__,r=R(t,e);return!(r<0||(r==t.length-1?t.pop():A.call(t,r,1),0))},C.prototype.get=function(e){var t=this.__data__,r=R(t,e);return r<0?void 0:t[r][1]},C.prototype.has=function(e){return R(this.__data__,e)>-1},C.prototype.set=function(e,t){var r=this.__data__,n=R(r,e);return n<0?r.push([e,t]):r[n][1]=t,this},P.prototype.clear=function(){this.__data__={hash:new B,map:new(x||C),string:new B}},P.prototype.delete=function(e){return K(this,e).delete(e)},P.prototype.get=function(e){return K(this,e).get(e)},P.prototype.has=function(e){return K(this,e).has(e)},P.prototype.set=function(e,t){return K(this,e).set(e,t),this},O.prototype.add=O.prototype.push=function(e){return this.__data__.set(e,n),this},O.prototype.has=function(e){return this.__data__.has(e)};var L=I&&1/d(new I([,-0]))[1]==1/0?function(e){return new I(e)}:function(){};function K(e,t){var r=e.__data__;return function(e){var t=typeof e;return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e}(t)?r["string"==typeof t?"string":"hash"]:r.map}function j(e,t){var r=function(e,t){return null==e?void 0:e[t]}(e,t);return N(r)?r:void 0}function M(e,t){return e===t||e!=e&&t!=t}function D(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}e.exports=function(e,t){return e&&e.length?function(e,t,n){var i=-1,o=f,s=e.length,a=!0,u=[],c=u;if(n)a=!1,o=l;else if(s>=r){var h=t?null:L(e);if(h)return d(h);a=!1,o=p,c=new O}else c=t?[]:u;e:for(;++i<s;){var y=e[i],g=t?t(y):y;if(y=n||0!==y?y:0,a&&g==g){for(var m=c.length;m--;)if(c[m]===g)continue e;t&&c.push(g),u.push(y)}else o(c,g,n)||(c!==u&&c.push(g),u.push(y))}return u}(e,void 0,t):[]}}).call(this,r(6))},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=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,B=/^\w*$/,C=/^\./,P=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,O=/\\(\\)?/g,R=/^\[object .+?Constructor\]$/,N=/^(?:0|[1-9]\d*)$/,L={};L["[object Float32Array]"]=L["[object Float64Array]"]=L["[object Int8Array]"]=L["[object Int16Array]"]=L["[object Int32Array]"]=L["[object Uint8Array]"]=L["[object Uint8ClampedArray]"]=L["[object Uint16Array]"]=L["[object Uint32Array]"]=!0,L[f]=L[l]=L[x]=L[h]=L[I]=L[p]=L[d]=L[y]=L[m]=L[b]=L[v]=L[w]=L[S]=L[k]=L[A]=!1;var K="object"==typeof e&&e&&e.Object===Object&&e,j="object"==typeof self&&self&&self.Object===Object&&self,M=K||j||Function("return this")(),D="object"==typeof t&&t&&!t.nodeType&&t,U=D&&"object"==typeof r&&r&&!r.nodeType&&r,F=U&&U.exports===D&&K.process,q=function(){try{return F&&F.binding("util")}catch(e){}}(),H=q&&q.isTypedArray;function z(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 V(e,t){for(var r=-1,n=e?e.length:0;++r<n;)if(t(e[r],r,e))return!0;return!1}function G(e){var t=!1;if(null!=e&&"function"!=typeof e.toString)try{t=!!(e+"")}catch(e){}return t}function W(e){var t=-1,r=Array(e.size);return e.forEach(function(e,n){r[++t]=[n,e]}),r}function $(e){var t=-1,r=Array(e.size);return e.forEach(function(e){r[++t]=e}),r}var Y,J=Array.prototype,X=Function.prototype,Z=Object.prototype,Q=M["__core-js_shared__"],ee=(Y=/[^.]+$/.exec(Q&&Q.keys&&Q.keys.IE_PROTO||""))?"Symbol(src)_1."+Y:"",te=X.toString,re=Z.hasOwnProperty,ne=Z.toString,ie=RegExp("^"+te.call(re).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),oe=M.Symbol,se=M.Uint8Array,ae=Z.propertyIsEnumerable,ue=J.splice,ce=function(e,t){return function(r){return e(t(r))}}(Object.keys,Object),fe=ze(M,"DataView"),le=ze(M,"Map"),he=ze(M,"Promise"),pe=ze(M,"Set"),de=ze(M,"WeakMap"),ye=ze(Object,"create"),ge=Ze(fe),me=Ze(le),be=Ze(he),ve=Ze(pe),_e=Ze(de),we=oe?oe.prototype:void 0,Se=we?we.valueOf:void 0,ke=we?we.toString:void 0;function Ee(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 Ae(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 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 Ie(e){var t=-1,r=e?e.length:0;for(this.__data__=new xe;++t<r;)this.add(e[t])}function Te(e){this.__data__=new Ae(e)}function Be(e,t){var r=nt(e)||rt(e)?function(e,t){for(var r=-1,n=Array(e);++r<e;)n[r]=t(r);return n}(e.length,String):[],n=r.length,i=!!n;for(var o in e)!t&&!re.call(e,o)||i&&("length"==o||Ge(o,n))||r.push(o);return r}function Ce(e,t){for(var r=e.length;r--;)if(tt(e[r][0],t))return r;return-1}function Pe(e,t,r,n){return Oe(e,function(e,i,o){t(n,e,r(e),o)}),n}Ee.prototype.clear=function(){this.__data__=ye?ye(null):{}},Ee.prototype.delete=function(e){return this.has(e)&&delete this.__data__[e]},Ee.prototype.get=function(e){var t=this.__data__;if(ye){var r=t[e];return r===o?void 0:r}return re.call(t,e)?t[e]:void 0},Ee.prototype.has=function(e){var t=this.__data__;return ye?void 0!==t[e]:re.call(t,e)},Ee.prototype.set=function(e,t){return this.__data__[e]=ye&&void 0===t?o:t,this},Ae.prototype.clear=function(){this.__data__=[]},Ae.prototype.delete=function(e){var t=this.__data__,r=Ce(t,e);return!(r<0||(r==t.length-1?t.pop():ue.call(t,r,1),0))},Ae.prototype.get=function(e){var t=this.__data__,r=Ce(t,e);return r<0?void 0:t[r][1]},Ae.prototype.has=function(e){return Ce(this.__data__,e)>-1},Ae.prototype.set=function(e,t){var r=this.__data__,n=Ce(r,e);return n<0?r.push([e,t]):r[n][1]=t,this},xe.prototype.clear=function(){this.__data__={hash:new Ee,map:new(le||Ae),string:new Ee}},xe.prototype.delete=function(e){return He(this,e).delete(e)},xe.prototype.get=function(e){return He(this,e).get(e)},xe.prototype.has=function(e){return He(this,e).has(e)},xe.prototype.set=function(e,t){return He(this,e).set(e,t),this},Ie.prototype.add=Ie.prototype.push=function(e){return this.__data__.set(e,o),this},Ie.prototype.has=function(e){return this.__data__.has(e)},Te.prototype.clear=function(){this.__data__=new Ae},Te.prototype.delete=function(e){return this.__data__.delete(e)},Te.prototype.get=function(e){return this.__data__.get(e)},Te.prototype.has=function(e){return this.__data__.has(e)},Te.prototype.set=function(e,t){var r=this.__data__;if(r instanceof Ae){var i=r.__data__;if(!le||i.length<n-1)return i.push([e,t]),this;r=this.__data__=new xe(i)}return r.set(e,t),this};var Oe=function(e,t){return function(r,n){if(null==r)return r;if(!it(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(e,t){return e&&Re(e,t,lt)}),Re=function(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 Ne(e,t){for(var r=0,n=(t=We(t,e)?[t]:Ue(t)).length;null!=e&&r<n;)e=e[Xe(t[r++])];return r&&r==n?e:void 0}function Le(e,t){return null!=e&&t in Object(e)}function Ke(e,t,r,n,i){return e===t||(null==e||null==t||!at(e)&&!ut(t)?e!=e&&t!=t:function(e,t,r,n,i,o){var s=nt(e),u=nt(t),c=l,h=l;s||(c=(c=Ve(e))==f?v:c),u||(h=(h=Ve(t))==f?v:h);var p=c==v&&!G(e),d=h==v&&!G(t),y=c==h;if(y&&!p)return o||(o=new Te),s||ft(e)?Fe(e,t,r,n,i,o):qe(e,t,c,r,n,i,o);if(!(i&a)){var g=p&&re.call(e,"__wrapped__"),m=d&&re.call(t,"__wrapped__");if(g||m){var b=g?e.value():e,_=m?t.value():t;return o||(o=new Te),r(b,_,n,i,o)}}return!!y&&(o||(o=new Te),function(e,t,r,n,i,o){var s=i&a,u=lt(e),c=u.length;if(c!=lt(t).length&&!s)return!1;for(var f=c;f--;){var l=u[f];if(!(s?l in t:re.call(t,l)))return!1}var h=o.get(e);if(h&&o.get(t))return h==t;var p=!0;o.set(e,t),o.set(t,e);for(var d=s;++f<c;){var y=e[l=u[f]],g=t[l];if(n)var m=s?n(g,y,l,t,e,o):n(y,g,l,e,t,o);if(!(void 0===m?y===g||r(y,g,n,i,o):m)){p=!1;break}d||(d="constructor"==l)}if(p&&!d){var b=e.constructor,v=t.constructor;b!=v&&"constructor"in e&&"constructor"in t&&!("function"==typeof b&&b instanceof b&&"function"==typeof v&&v instanceof v)&&(p=!1)}return o.delete(e),o.delete(t),p}(e,t,r,n,i,o))}(e,t,Ke,r,n,i))}function je(e){return!(!at(e)||function(e){return!!ee&&ee in e}(e))&&(ot(e)||G(e)?ie:R).test(Ze(e))}function Me(e){return"function"==typeof e?e:null==e?ht:"object"==typeof e?nt(e)?function(e,t){return We(e)&&$e(t)?Ye(Xe(e),t):function(r){var n=function(e,t,r){var n=null==e?void 0:Ne(e,t);return void 0===n?r:n}(r,e);return void 0===n&&n===t?function(e,t){return null!=e&&function(e,t,r){for(var n,i=-1,o=(t=We(t,e)?[t]:Ue(t)).length;++i<o;){var s=Xe(t[i]);if(!(n=null!=e&&r(e,s)))break;e=e[s]}return n||!!(o=e?e.length:0)&&st(o)&&Ge(s,o)&&(nt(e)||rt(e))}(e,t,Le)}(r,e):Ke(t,n,void 0,s|a)}}(e[0],e[1]):function(e){var t=function(e){for(var t=lt(e),r=t.length;r--;){var n=t[r],i=e[n];t[r]=[n,i,$e(i)]}return t}(e);return 1==t.length&&t[0][2]?Ye(t[0][0],t[0][1]):function(r){return r===e||function(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;){var f=(c=r[i])[0],l=e[f],h=c[1];if(u&&c[2]){if(void 0===l&&!(f in e))return!1}else{var p=new Te;if(n)var d=n(l,h,f,e,t,p);if(!(void 0===d?Ke(h,l,n,s|a,p):d))return!1}}return!0}(r,e,t)}}(e):function(e){return We(e)?function(e){return function(t){return null==t?void 0:t[e]}}(Xe(e)):function(e){return function(t){return Ne(t,e)}}(e)}(e)}function De(e){if(!function(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||Z)}(e))return ce(e);var t=[];for(var r in Object(e))re.call(e,r)&&"constructor"!=r&&t.push(r);return t}function Ue(e){return nt(e)?e:Je(e)}function Fe(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 Ie: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(!V(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 qe(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 tt(+e,+t);case d:return e.name==t.name&&e.message==t.message;case w:case k:return e==t+"";case m:var c=W;case S:var f=o&a;if(c||(c=$),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=Fe(c(e),c(t),n,i,o,u);return u.delete(e),y;case E:if(Se)return Se.call(e)==Se.call(t)}return!1}function He(e,t){var r=e.__data__;return function(e){var t=typeof e;return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e}(t)?r["string"==typeof t?"string":"hash"]:r.map}function ze(e,t){var r=function(e,t){return null==e?void 0:e[t]}(e,t);return je(r)?r:void 0}var Ve=function(e){return ne.call(e)};function Ge(e,t){return!!(t=null==t?c:t)&&("number"==typeof e||N.test(e))&&e>-1&&e%1==0&&e<t}function We(e,t){if(nt(e))return!1;var r=typeof e;return!("number"!=r&&"symbol"!=r&&"boolean"!=r&&null!=e&&!ct(e))||B.test(e)||!T.test(e)||null!=t&&e in Object(t)}function $e(e){return e==e&&!at(e)}function Ye(e,t){return function(r){return null!=r&&r[e]===t&&(void 0!==t||e in Object(r))}}(fe&&Ve(new fe(new ArrayBuffer(1)))!=I||le&&Ve(new le)!=m||he&&Ve(he.resolve())!=_||pe&&Ve(new pe)!=S||de&&Ve(new de)!=A)&&(Ve=function(e){var t=ne.call(e),r=t==v?e.constructor:void 0,n=r?Ze(r):void 0;if(n)switch(n){case ge:return I;case me:return m;case be:return _;case ve:return S;case _e:return A}return t});var Je=et(function(e){e=function(e){return null==e?"":function(e){if("string"==typeof e)return e;if(ct(e))return ke?ke.call(e):"";var t=e+"";return"0"==t&&1/e==-u?"-0":t}(e)}(e);var t=[];return C.test(e)&&t.push(""),e.replace(P,function(e,r,n,i){t.push(n?i.replace(O,"$1"):r||e)}),t});function Xe(e){if("string"==typeof e||ct(e))return e;var t=e+"";return"0"==t&&1/e==-u?"-0":t}function Ze(e){if(null!=e){try{return te.call(e)}catch(e){}try{return e+""}catch(e){}}return""}var Qe=function(e,t){return function(r,n){var i=nt(r)?z:Pe,o=t?t():{};return i(r,e,Me(n),o)}}(function(e,t,r){re.call(e,r)?e[r].push(t):e[r]=[t]});function et(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(et.Cache||xe),r}function tt(e,t){return e===t||e!=e&&t!=t}function rt(e){return function(e){return ut(e)&&it(e)}(e)&&re.call(e,"callee")&&(!ae.call(e,"callee")||ne.call(e)==f)}et.Cache=xe;var nt=Array.isArray;function it(e){return null!=e&&st(e.length)&&!ot(e)}function ot(e){var t=at(e)?ne.call(e):"";return t==y||t==g}function st(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=c}function at(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function ut(e){return!!e&&"object"==typeof e}function ct(e){return"symbol"==typeof e||ut(e)&&ne.call(e)==E}var ft=H?function(e){return function(t){return e(t)}}(H):function(e){return ut(e)&&st(e.length)&&!!L[ne.call(e)]};function lt(e){return it(e)?Be(e):De(e)}function ht(e){return e}r.exports=Qe}).call(this,r(6),r(27)(e))},function(e,t){function r(e,t,r){if(t!=t)return function(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,i,r);for(var n=r-1,o=e.length;++n<o;)if(e[n]===t)return n;return-1}function n(e,t,r,n){for(var i=r-1,o=e.length;++i<o;)if(n(e[i],t))return i;return-1}function i(e){return e!=e}var o=Array.prototype.splice;function s(e,t,i,s){var a=s?n:r,u=-1,c=t.length,f=e;for(e===t&&(t=function(e,t){var r=-1,n=e.length;for(t||(t=Array(n));++r<n;)t[r]=e[r];return t}(t)),i&&(f=function(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}(e,function(e){return function(t){return e(t)}}(i)));++u<c;)for(var l=0,h=t[u],p=i?i(h):h;(l=a(f,p,l,s))>-1;)f!==e&&o.call(f,l,1),o.call(e,l,1);return e}e.exports=function(e,t,r){return e&&e.length&&t&&t.length?s(e,t,void 0,r):e}},function(e,t,r){"use strict";const n=r(187);e.exports=class{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)}}},function(e,t,r){"use strict";const n=r(11).EventEmitter,i=r(280),o=r(113).logger,s=e=>`unwant:${e}`,a=e=>`block:${e}`;e.exports=class 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])}}},function(e,t,r){"use strict";const n=r(11),i=r(1061),o={movingAverageIntervals:[6e4,3e5,9e5]};e.exports=class 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))}}},function(e,t,r){"use strict";const n=r(11),i=r(122),o=r(508);e.exports=class 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=>{(this._movingAverages[e][t]=o(t)).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}}},function(e,t,r){"use strict";const n=r(49),i=r(23);e.exports=(e=>i(t=>{if(t=t||function(){},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()));e.state.stop(),e._blockService.unsetExchange(),e._bitswap.stop(),n([t=>e.libp2p.stop(t),t=>e._repo.close(t)],r=>{if(r)return e.emit("error",r),t(r);e.state.stopped(),e.emit("stop"),t()})}))},function(e,t,r){"use strict";e.exports=function(e){return()=>Boolean(e._bitswap&&e._libp2pNode&&e._libp2pNode.isStarted())}},function(e,t,r){"use strict";const n=r(509),i=r(23);e.exports=function(e){return i((t,r)=>{"function"==typeof t&&(r=t,t={}),e.repo.version((e,t)=>{e&&r(e),r(null,{version:n.version,repo:t,commit:""})})})}},function(e,t,r){"use strict";const n=r(23),i=r(3),o=r(509).version;e.exports=function(e){return n((t,r)=>{"function"==typeof t&&(r=t,t={}),i(()=>r(null,{id:e._peerInfo.id.toB58String(),publicKey:e._peerInfo.id.pubKey.bytes.toString("base64"),addresses:e._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(110),i=r(4),o=r(63),s=r(23),a=r(511),u=r(498),c=r(1067);e.exports=function(e){return s((t,r)=>{"function"==typeof t&&(r=t,t={});const s=(t,n)=>{if(t)return e.emit("error",t),r(t);e.preStart(t=>{if(t)return e.emit("error",t),r(t);e.state.initialized(),e.emit("init"),r(null,n)})};if("uninitialized"!==e.state.state())return s(new Error("Not able to init from state: "+e.state.state()));if(e.state.init(),e.log("init"),t.repo)return e._repo=t.repo,s(null,!0);t.emptyRepo=t.emptyRepo||!1,t.bits=Number(t.bits)||2048,t.log=t.log||function(){};const f=a();let l;i([t=>e._repo.exists(t),(r,i)=>{if(e.log("repo exists?",r),!0===r)return i(new Error("repo already exists"));t.log(`generating ${t.bits}-bit RSA keypair...`,!1),e.log("generating peer id: %s bits",t.bits),n.create({bits:t.bits},i)},(r,n)=>{e.log("identity generated"),f.Identity={PeerID:r.toB58String(),PrivKey:r.privKey.bytes.toString("base64")},t.pass&&(l=r.privKey,f.Keychain=u.generateOptions()),t.log("done"),t.log("peer identity: "+f.Identity.PeerID),e._repo.init(f,n)},(t,r)=>e._repo.open(r),r=>{if(e.log("repo opened"),t.pass){e.log("creating keychain");const n=Object.assign({passPhrase:t.pass},f.Keychain);e._keychain=new u(e._repo.keys,n),e._keychain.importPeer("self",{privKey:l},r)}else r(null,!0)},(r,n)=>{if(t.emptyRepo)return n(null,!0);const i=[t=>e.object.new("unixfs-dir",t)];"function"==typeof c&&i.push(r=>c(e,t.log,r)),e.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(511),i=r(78).IPFS.matches,o=r(23);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){return{list:o(t=>{e._repo.config.get((e,r)=>{if(e)return t(e);t(null,{Peers:r.Bootstrap})})}),add:o((t,r,i)=>{if("function"==typeof r&&(i=r,r={default:!1}),t&&!s(t))return setImmediate(()=>i(a(t)));e._repo.config.get((o,s)=>{if(o)return i(o);r.default?s.Bootstrap=n().Bootstrap:t&&-1===s.Bootstrap.indexOf(t)&&s.Bootstrap.push(t),e._repo.config.set(s,e=>{if(e)return i(e);i(null,{Peers:r.default?n().Bootstrap:[t]})})})}),rm:o((t,r,n)=>{if("function"==typeof r&&(n=r,r={all:!1}),t&&!s(t))return setImmediate(()=>n(a(t)));e._repo.config.get((i,o)=>{if(i)return n(i);r.all?o.Bootstrap=[]:o.Bootstrap=o.Bootstrap.filter(e=>e!==t),e._repo.config.set(o,e=>{if(e)return n(e);const i=[];!r.all&&t&&i.push(t),n(null,{Peers:i})})})})}}},function(e,t,r){"use strict";const n=r(23);e.exports=function(e){return{get:n((t,r)=>("function"==typeof t&&(r=t,t=void 0),e._repo.config.get(t,r))),set:n((t,r,n)=>{e._repo.config.set(t,r,n)}),replace:n((t,r)=>{e._repo.config.set(t,r)})}}},function(e,t,r){"use strict";const n=r(151),i=r(12),o=r(65),s=r(9),a=r(4),u=r(23);function c(e){return s.isCID(e)?e:new s(e)}e.exports=function(e){return{get:u((t,r)=>{t=c(t),e._blockService.get(t,r)}),put:u((t,r,i)=>{if(i=i||function(){},"function"==typeof r&&(i=r,r={}),Array.isArray(t))return i(new Error("Array is not supported"));a([e=>{if(n.isBlock(t))return e(null,t);if(r.cid&&s.isCID(r.cid))return e(null,new n(t,r.cid));const i=r.mhtype||"sha2-256",a=r.format||"dag-pb",u=r.version||0;o(t,i,(r,i)=>{if(r)return e(r);e(null,new n(t,new s(u,a,i)))})},(t,r)=>e._blockService.put(t,e=>{if(e)return r(e);r(null,t)})],i)}),rm:u((t,r)=>{t=c(t),e._blockService.delete(t,r)}),stat:u((t,r)=>{t=c(t),e._blockService.get(t,(e,n)=>{if(e)return r(e);r(null,{key:i.toB58String(t.multihash),size:n.data.length})})})}}},function(e,t,r){"use strict";(function(t){const n=r(4),i=r(23),o=r(45),s=o.DAGNode,a=o.DAGLink,u=r(9),c=r(12),f=r(35),l=r(17);function h(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 p(e,t,r){switch(t){case"json":return d(e,r);case"protobuf":return function(e,t){o.util.deserialize(e,t)}(e,r);default:r(new Error(`unkown encoding: ${t}`))}}function d(e,r){let n,i;try{const o=JSON.parse(e.toString());i=(o.Links||[]).map(e=>new a(e.Name||e.name,e.Size||e.size,c.fromB58String(e.Hash||e.hash||e.multihash))),n=t.from(o.Data)}catch(e){return r(new Error("failed to parse JSON: "+e))}s.create(n,i,r)}e.exports=function(e){function r(t){return(r,i,o)=>{"function"==typeof i&&(o=i,i={}),n([t=>{e.object.get(r,i,t)},(r,n)=>{t(r,(t,r)=>{if(t)return n(t);e._ipld.put(r,{cid:new u(r.multihash)},e=>{n(e,r)})})}],o)}}return{new:i((r,n)=>{let i;"function"==typeof r&&(n=r,r=void 0),r?(l("unixfs-dir"===r,"unkown template"),i=new f("directory").marshal()):i=t.alloc(0),s.create(i,(t,r)=>{if(t)return n(t);e._ipld.put(r,{cid:new u(r.multihash)},e=>{if(e)return n(e);n(null,r)})})}),put:i((r,n,i)=>{"function"==typeof n&&(i=n,n={});const o=n.enc;let a;if(t.isBuffer(r))o?p(r,o,(e,t)=>{if(e)return i(e);a=t,c()}):s.create(r,(e,t)=>{if(e)return i(e);a=t,c()});else if(r.multihash)a=r,c();else{if("object"!=typeof r)return i(new Error("obj not recognized"));s.create(r.Data,r.Links,(e,t)=>{if(e)return i(e);a=t,c()})}function c(){e._ipld.put(a,{cid:new u(a.multihash)},t=>{if(t)return i(t);e.object.get(a.multihash,i)})}}),get:i((t,r,n)=>{let i;"function"==typeof r&&(n=r,r={});try{i=h(t,r.enc)}catch(t){return n(t)}let o=new u(i);1===r.cidVersion&&(o=o.toV1()),e._ipld.get(o,(e,t)=>{if(e)return n(e);const r=t.value;n(null,r)})}),data:i((t,r,n)=>{"function"==typeof r&&(n=r,r={}),e.object.get(t,r,(e,t)=>{if(e)return n(e);n(null,t.data)})}),links:i((t,r,n)=>{"function"==typeof r&&(n=r,r={}),e.object.get(t,r,(e,t)=>{if(e)return n(e);n(null,t.links)})}),stat:i((t,r,n)=>{"function"==typeof r&&(n=r,r={}),e.object.get(t,r,(e,t)=>{if(e)return n(e);o.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:i({addLink(e,t,n,i){r((e,r)=>{s.addLink(e,t,r)})(e,n,i)},rmLink(e,t,n,i){r((e,r)=>{a.isDAGLink(t)&&(t=t._name),s.rmLink(e,t,r)})(e,n,i)},appendData(e,n,i,o){r((e,r)=>{const i=t.concat([e.data,n]);s.create(i,e.links,r)})(e,i,o)},setData(e,t,n,i){r((e,r)=>{s.create(t,e.links,r)})(e,n,i)}})}}}).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(23),i=r(9),o=r(8),s=r(80),a=r(1074);e.exports=function(e){return{put:n((t,r,n)=>{if("function"==typeof r)n=r;else{if(r.cid&&(r.format||r.hashAlg))return n(new Error("Can't put dag node. Please provide either `cid` OR `format` and `hashAlg` options."));if(r.format&&!r.hashAlg||!r.format&&r.hashAlg)return n(new Error("Can't put dag node. Please provide `format` AND `hashAlg` options."))}r=r.cid?r:Object.assign({},{format:"dag-cbor",hashAlg:"sha2-256"},r),e._ipld.put(t,r,n)}),get:n((r,n,o,s)=>{if("function"==typeof n&&(s=n,n=void 0),"function"==typeof o&&(s=o,o={}),o=o||{},"string"==typeof r){const e=r.split("/");r=new i(e[0]),e.shift(),n=e.length>0?e.join("/"):"/"}else if(t.isBuffer(r))try{r=new i(r)}catch(r){return s(r)}e._ipld.get(r,n,o,s)}),tree:n((t,r,n,s)=>{if("object"==typeof r&&(s=n,n=r,r=void 0),"function"==typeof r&&(s=r,r=void 0),"function"==typeof n&&(s=n,n={}),n=n||{},"string"==typeof t){const e=t.split("/");t=new i(e[0]),e.shift(),r=e.length>0?e.join("/"):void 0}o(e._ipld.treeStream(t,r,n),o.collect(s))}),_getRecursive:n((t,r)=>{e.dag.get(new i(t),(t,n)=>{if(t)return r(t);s(n.value.links,(t,r)=>{e.dag._getRecursive(t.multihash,r)},(e,t)=>{if(e)return r(e);r(null,a([n.value,t]))})})})}}}).call(this,r(0).Buffer)},function(e,t,r){var n=r(1075),i=1/0;e.exports=function(e){return null!=e&&e.length?n(e,i):[]}},function(e,t,r){var n=r(1076),i=r(1077);e.exports=function e(t,r,o,s,a){var u=-1,c=t.length;for(o||(o=i),a||(a=[]);++u<c;){var f=t[u];r>0&&o(f)?r>1?e(f,r-1,o,s,a):n(a,f):s||(a[a.length]=f)}return a}},function(e,t){e.exports=function(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){var n=r(158),i=r(361),o=r(88),s=n?n.isConcatSpreadable:void 0;e.exports=function(e){return o(e)||i(e)||!!(s&&e&&e[s])}},function(e,t,r){"use strict";const n=r(1079),i=r(23),o=r(584),s=r(593);e.exports=function(e){return{start:i(t=>{e.config.get(function(r,i){if(r)return t(r);const a={peerInfo:e._peerInfo,peerBook:e._peerInfoBook,config:{peerDiscovery:{mdns:{enabled:o(e._options,"config.Discovery.MDNS.Enabled",o(i,"Discovery.MDNS.Enabled",!0))},webRTCStar:{enabled:o(e._options,"config.Discovery.webRTCStar.Enabled",o(i,"Discovery.webRTCStar.Enabled",!0))},bootstrap:{list:o(e._options,"config.Bootstrap",o(i,"Bootstrap",[]))}},relay:{enabled:o(e._options,"relay.enabled",o(i,"relay.enabled",!1)),hop:{enabled:o(e._options,"relay.hop.enabled",o(i,"relay.hop.enabled",!1)),active:o(e._options,"relay.hop.active",o(i,"relay.hop.active",!1))}},EXPERIMENTAL:{dht:o(e._options,"EXPERIMENTAL.dht",!1),pubsub:o(e._options,"EXPERIMENTAL.pubsub",!1)}},connectionManager:o(e._options,"connectionManager",o(i,"connectionManager",{}))},u=s(o(e._options,"libp2p",{}),a);e._libp2pNode=new n(u),e._libp2pNode.on("peer:discovery",t=>{const r=()=>{e._peerInfoBook.put(t),e._libp2pNode.dial(t,()=>{})};e.isOnline()?r():e._libp2pNode.once("start",r)}),e._libp2pNode.on("peer:connect",t=>{e._peerInfoBook.put(t)}),e._libp2pNode.start(r=>{if(r)return t(r);e._libp2pNode.peerInfo.multiaddrs.forEach(e=>{console.log("Swarm listening on",e.toString())}),t()})})}),stop:i(t=>{e._libp2pNode.stop(t)})}}},function(e,t,r){"use strict";const n=r(512),i=r(1093),o=r(1133),s=r(1154),a=r(1162),u=r(1186),c=r(1204),f=r(593);e.exports=class 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))}}},function(e,t,r){"use strict";var n=r(1081),i=r(1083),o=r(1087);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(1082):WebSocket},function(e,t){},function(e,t,r){var n=r(1084),i=r(1085);e.exports=function(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}}},function(e,t,r){var n=r(2).Buffer;e.exports=function(e,t){var r,i,o=[],s=!1;return e.addEventListener("message",function(e){var t=e.data;if(function(e){return e instanceof ArrayBuffer||null!=e&&null!=e.constructor&&"ArrayBuffer"===e.constructor.name&&"number"==typeof e.byteLength}(t)&&(t=n.from(t)),r)return r(null,t);o.push(t)}),e.addEventListener("close",function(e){i||r&&r(i=!0)}),e.addEventListener("error",function(e){i||(i=e,s||(s=!0,t&&t(e)),r&&r(i))}),e.addEventListener("open",function(e){s||i||(s=!0)}),function(t,n){if(r=null,i)return n(i);t?(r=n,e.close()):o.length>0?n(null,o.shift()):r=n}}},function(e,t,r){(function(t){var n=r(1086),i="undefined"!=typeof setImmediate?setImmediate:t.nextTick;e.exports=function(e,t){return function(r){var o=!1!==(t=t||{}).closeOnEnd,s="function"==typeof t?t:t.onClose;r(null,function t(a,u){a?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(n){if(n)return r(n,function(){});e.send(u),i(function(){r(null,t)})})})}}}).call(this,r(7))},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(1088),i={http:"ws",https:"wss"};e.exports=function(e,t){return n(e,t,i,"ws")}},function(e,t,r){var n=r(33);e.exports=function(e,t,r,i){var o;return r=r||{},o=(e=n.parse(e,!1,!0)).protocol?e.protocol:(r[o=t.protocol?t.protocol.replace(/:$/,""):"http"]||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){return e!=e}function b(e,t){return function(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}(t,function(t){return e[t]})}var v=Object.prototype,_=v.hasOwnProperty,w=v.toString,S=v.propertyIsEnumerable,k=function(e,t){return function(r){return e(t(r))}}(Object.keys,Object),E=Math.max;function A(e,t){var r=T(e)||function(e){return function(e){return P(e)&&B(e)}(e)&&_.call(e,"callee")&&(!S.call(e,"callee")||w.call(e)==s)}(e)?function(e,t){for(var r=-1,n=Array(e);++r<e;)n[r]=t(r);return n}(e.length,String):[],n=r.length,i=!!n;for(var o in e)!t&&!_.call(e,o)||i&&("length"==o||I(o,n))||r.push(o);return r}function x(e){if(!function(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||v)}(e))return k(e);var t=[];for(var r in Object(e))_.call(e,r)&&"constructor"!=r&&t.push(r);return t}function I(e,t){return!!(t=null==t?n:t)&&("number"==typeof e||y.test(e))&&e>-1&&e%1==0&&e<t}var T=Array.isArray;function B(e){return null!=e&&function(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=n}(e.length)&&!function(e){var t=C(e)?w.call(e):"";return t==a||t==u}(e)}function C(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function P(e){return!!e&&"object"==typeof e}function O(e){return e?(e=function(e){if("number"==typeof e)return e;if(function(e){return"symbol"==typeof e||P(e)&&w.call(e)==f}(e))return o;if(C(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=C(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}(e))===r||e===-r?(e<0?-1:1)*i:e==e?e:0:0===e?e:0}e.exports=function(e,t,r,n){e=B(e)?e:function(e){return e?b(e,function(e){return B(e)?A(e):x(e)}(e)):[]}(e),r=r&&!n?function(e){var t=O(e),r=t%1;return t==t?r?t-r:t:0}(r):0;var i=e.length;return r<0&&(r=E(i+r,0)),function(e){return"string"==typeof e||!T(e)&&P(e)&&w.call(e)==c}(e)?r<=i&&e.indexOf(t,r)>-1:!!i&&function(e,t,r){if(t!=t)return function(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,m,r);for(var n=r-1,i=e.length;++n<i;)if(e[n]===t)return n;return-1}(e,t,r)>-1}},function(e,t,r){"use strict";const n=r(386);e.exports=class{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)("libp2p:websockets:dialer");e.exports=function(e){const t=e.toString().split("/");let r,i;try{r=e.protoNames().filter(e=>"ws"===e||"wss"===e)[0]}catch(e){throw n(e),new Error("Not a valid websocket address",e)}try{i=e.stringTuples().filter(t=>{if(t[0]===e.protos().filter(e=>"tcp"===e.name)[0].code)return!0})[0][1]}catch(e){n("No port, skipping")}return`${r}://${t[2]}${!i||80===i&&443===i?"":`:${i}`}`}},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)("libp2p:webrtc-star"),i=r(60),o=r(78),s=r(61),a=r(513),u=r(11).EventEmitter,c=r(191),f=r(1113),l=r(51),h=r(47).Connection,p=r(192),d=r(30),y=r(3),g=r(1131),m=r(1132),b=m.cleanUrlSIO,v=m.cleanMultiaddr,_=d(()=>{}),w={transports:["websocket"],"force new connection":!0};e.exports=s(class{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 u,this.discovery.tag="webRTCStar",this.discovery.start=(e=>{y(e)}),this.discovery.stop=(e=>{y(e)}),this.listenersRefs={},this._peerDiscovered=this._peerDiscovered.bind(this)}dial(e,t,r){"function"==typeof t&&(r=t,t={}),r=r?d(r):_;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 c(o),a=new h(p.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 u;return r.listen=((e,i)=>{if(i=i?d(i):_,!g.support&&!this.wrtc)return y(()=>i(new Error("no WebRTC support")));this.maSelf=e;const o=b(e);n("Dialing to Signalling Server on: "+o),r.io=a.connect(o,w),r.io.once("connect_error",i),r.io.once("error",e=>{r.emit("error",e),r.emit("close")}),r.io.on("ws-handshake",function(e){if(e.answer||e.err)return;const n={trickle:!1};s.wrtc&&(n.wrtc=s.wrtc);const i=new c(n),o=new h(p.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.io.on("ws-peer",this._peerDiscovered),r.io.on("connect",()=>{r.io.emit("ss-join",e.toString())}),r.io.once("connect",()=>{r.emit("listening"),i()});const s=this}),r.close=(e=>{e=e?d(e):_,r.io.emit("ss-leave"),y(()=>{r.emit("close"),e()})}),r.getAddrs=(e=>{y(()=>e(null,[this.maSelf]))}),this.listenersRefs[i.toString()]=r,r}filter(e){return Array.isArray(e)||(e=[e]),e.filter(e=>!(e.protoNames().indexOf("p2p-circuit")>-1)&&o.WebRTCStar.matches(e))}_peerDiscovered(e){n("Peer Discovered:",e);const t=(e=v(e)).split("/ipfs/"),r=t[t.length-1],o=f.createFromB58String(r),s=new l(o);s.multiaddrs.add(i(e)),this.discovery.emit("peer",s)}},{className:"WebRTCStar",symbolName:"@libp2p/js-libp2p-webrtc-star/webrtcstar"})},function(e,t,r){(function(t){var n=r(514),i=r(1)("socket.io-client:url");e.exports=function(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(":")?"["+o.host+"]":o.host;return o.id=o.protocol+"://"+s+":"+o.port,o.href=o.protocol+"://"+s+(r&&r.port===o.port?"":":"+o.port),o}}).call(this,r(6))},function(e,t,r){(function(e){var n=r(515),i=r(516),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)){o={};for(var a in e)o[a]=u(e[a],t);return o}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=function e(t,r){if(!t)return t;if(t&&t._placeholder)return r[t.num];if(n(t))for(var i=0;i<t.length;i++)t[i]=e(t[i],r);else if("object"==typeof t)for(var o in t)t[o]=e(t[o],r);return t}(e.data,t),e.attachments=void 0,e},t.removeBlobs=function(e,t){var r=0,o=e;(function e(u,c,f){if(!u)return u;if(s&&u instanceof Blob||a&&u instanceof File){r++;var l=new FileReader;l.onload=function(){f?f[c]=this.result:o=this.result,--r||t(o)},l.readAsArrayBuffer(u)}else if(n(u))for(var h=0;h<u.length;h++)e(u[h],h,u);else if("object"==typeof u&&!i(u))for(var p in u)e(u[p],p,u)})(o),r||t(o)}}).call(this,r(6))},function(e,t,r){e.exports=r(1097),e.exports.parser=r(115)},function(e,t,r){(function(t){var n=r(518),i=r(114),o=r(1)("engine.io-client:socket"),s=r(262),a=r(115),u=r(514),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()}e.exports=f,f.priorWebsocketSuccess=!1,i(f.prototype),f.protocol=a.protocol,f.Socket=f,f.Transport=r(283),f.transports=r(518),f.parser=r(115),f.prototype.createTransport=function(e){o('creating transport "%s"',e);var t=function(e){var t={};for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r]);return t}(this.query);t.EIO=a.protocol,t.transport=e;var r=this.transportOptions[e]||{};return this.id&&(t.sid=this.id),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})},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||{}).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);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(6))},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(282),i=r(519),o=r(114),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||{}).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(6))},function(e,t){e.exports=Object.keys||function(e){var t=[],r=Object.prototype.hasOwnProperty;for(var n in e)r.call(e,n)&&t.push(n);return t}},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.exports=function(e,t,n){var i=!1;return n=n||r,o.count=e,0===e?t():o;function o(e,r){if(o.count<=0)throw new Error("after called too many times");--o.count,e?(i=!0,t(e),t=n):0!==o.count||i||t(null,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,"object"==typeof n&&n);a.global!==a&&a.window;var u,c,f,l=String.fromCharCode;function h(e){for(var t,r,n=[],i=0,o=e.length;i<o;)(t=e.charCodeAt(i++))>=55296&&t<=56319&&i<o?56320==(64512&(r=e.charCodeAt(i++)))?n.push(((1023&t)<<10)+(1023&r)+65536):(n.push(t),i--):n.push(t);return n}function p(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 d(e,t){return l(e>>t&63|128)}function y(e,t){if(0==(4294967168&e))return l(e);var r="";return 0==(4294965248&e)?r=l(e>>6&31|192):0==(4294901760&e)?(p(e,t)||(e=65533),r=l(e>>12&15|224),r+=d(e,6)):0==(4292870144&e)&&(r=l(e>>18&7|240),r+=d(e,12),r+=d(e,6)),r+l(63&e|128)}function g(){if(f>=c)throw Error("Invalid byte index");var e=255&u[f];if(f++,128==(192&e))return 63&e;throw Error("Invalid continuation byte")}function m(e){var t,r;if(f>c)throw Error("Invalid byte index");if(f==c)return!1;if(t=255&u[f],f++,0==(128&t))return t;if(192==(224&t)){if((r=(31&t)<<6|g())>=128)return r;throw Error("Invalid continuation byte")}if(224==(240&t)){if((r=(15&t)<<12|g()<<6|g())>=2048)return p(r,e)?r:65533;throw Error("Invalid continuation byte")}if(240==(248&t)&&(r=(7&t)<<18|g()<<12|g()<<6|g())>=65536&&r<=1114111)return r;throw Error("Invalid UTF-8 detected")}var b={version:"2.1.2",encode:function(e,t){for(var r=!1!==(t=t||{}).strict,n=h(e),i=n.length,o=-1,s="";++o<i;)s+=y(n[o],r);return s},decode:function(e,t){var r=!1!==(t=t||{}).strict;u=h(e),c=u.length,f=0;for(var n,i=[];!1!==(n=m(r));)i.push(n);return function(e){for(var t,r=e.length,n=-1,i="";++n<r;)(t=e[n])>65535&&(i+=l((t-=65536)>>>10&1023|55296),t=56320|1023&t),i+=l(t);return i}(i)}};void 0===(i=function(){return b}.call(t,r,t,e))||(e.exports=i)}()}).call(this,r(27)(e),r(6))},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,n=new Uint8Array(t),i=n.length,o="";for(r=0;r<i;r+=3)o+=e[n[r]>>2],o+=e[(3&n[r])<<4|n[r+1]>>4],o+=e[(15&n[r+1])<<2|n[r+2]>>6],o+=e[63&n[r+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,n,i,o,s,a=.75*e.length,u=e.length,c=0;"="===e[e.length-1]&&(a--,"="===e[e.length-2]&&a--);var f=new ArrayBuffer(a),l=new Uint8Array(f);for(t=0;t<u;t+=4)n=r[e.charCodeAt(t)],i=r[e.charCodeAt(t+1)],o=r[e.charCodeAt(t+2)],s=r[e.charCodeAt(t+3)],l[c++]=n<<2|i>>4,l[c++]=(15&i)<<4|o>>2,l[c++]=(3&o)<<6|63&s;return f}}()},function(e,t,r){(function(t){var r=t.BlobBuilder||t.WebKitBlobBuilder||t.MSBlobBuilder||t.MozBlobBuilder,n=function(){try{return 2===new Blob(["hi"]).size}catch(e){return!1}}(),i=n&&function(){try{return 2===new Blob([new Uint8Array([1,2])]).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}}}e.exports=n?i?t.Blob:function(e,t){return s(e),new Blob(e,t||{})}:o?function(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()}:void 0}).call(this,r(6))},function(e,t,r){(function(t){var n=r(519),i=r(190);e.exports=c;var o,s=/\n/g,a=/\\n/g;function u(){}function c(e){n.call(this,e),this.query=this.query||{},o||(t.___eio||(t.___eio=[]),o=t.___eio),this.index=o.length;var r=this;o.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,"undefined"!=typeof navigator&&/gecko/i.test(navigator.userAgent)&&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,i=document.createElement("form"),o=document.createElement("textarea"),u=this.iframeId="eio_iframe_"+this.index;i.className="socketio",i.style.position="absolute",i.style.top="-1000px",i.style.left="-1000px",i.target=u,i.method="POST",i.setAttribute("accept-charset","utf-8"),o.name="d",i.appendChild(o),document.body.appendChild(i),this.form=i,this.area=o}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+'">';n=document.createElement(e)}catch(e){(n=document.createElement("iframe")).name=r.iframeId,n.src="javascript:0"}n.id=r.iframeId,r.form.appendChild(n),r.iframe=n}this.form.action=this.uri(),f(),e=e.replace(a,"\\\n"),this.area.value=e.replace(s,"\\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(6))},function(e,t,r){(function(t){var n,i=r(283),o=r(115),s=r(189),a=r(190),u=r(521),c=r(1)("engine.io-client:websocket"),f=t.WebSocket||t.MozWebSocket;if("undefined"==typeof window)try{n=r(1109)}catch(e){}var l=f;function h(e){e&&e.forceBase64&&(this.supportsBinary=!1),this.perMessageDeflate=e.perMessageDeflate,this.usingBrowserWebSocket=f&&!e.forceNode,this.protocols=e.protocols,this.usingBrowserWebSocket||(l=n),i.call(this,e)}l||"undefined"!=typeof window||(l=n),e.exports=h,a(h,i),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,i=0,s=n;i<s;i++)!function(e){o.encodePacket(e,r.supportsBinary,function(i){if(!r.usingBrowserWebSocket){var o={};e.options&&(o.compress=e.options.compress),r.perMessageDeflate&&("string"==typeof i?t.Buffer.byteLength(i):i.length)<r.perMessageDeflate.threshold&&(o.compress=!1)}try{r.usingBrowserWebSocket?r.ws.send(i):r.ws.send(i,o)}catch(e){c("websocket closed before onclose event")}--n||(r.emit("flush"),setTimeout(function(){r.writable=!0,r.emit("drain")},0))})}(e[i])},h.prototype.onClose=function(){i.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="";return this.port&&("wss"===t&&443!==Number(this.port)||"ws"===t&&80!==Number(this.port))&&(r=":"+this.port),this.timestampRequests&&(e[this.timestampParam]=u()),this.supportsBinary||(e.b64=1),(e=s.encode(e)).length&&(e="?"+e),t+"://"+(-1!==this.hostname.indexOf(":")?"["+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(6))},function(e,t){},function(e,t){e.exports=function(e,t){for(var r=[],n=(t=t||0)||0;n<e.length;n++)r[n-t]=e[n];return 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(){if("undefined"==typeof window)return null;var e={RTCPeerConnection:window.RTCPeerConnection||window.mozRTCPeerConnection||window.webkitRTCPeerConnection,RTCSessionDescription:window.RTCSessionDescription||window.mozRTCSessionDescription||window.webkitRTCSessionDescription,RTCIceCandidate:window.RTCIceCandidate||window.mozRTCIceCandidate||window.webkitRTCIceCandidate};return e.RTCPeerConnection?e:null}},function(e,t,r){"use strict";(function(n){const i=r(12),o=r(1114),s=r(17),a=r(4);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).create=function(e,t){"function"==typeof e&&(t=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(525),i=r(1116),o=r(1118);(t=e.exports).aes=i,t.hmac=n,t.keys=o,t.randomBytes=r(530),t.pbkdf2=r(1129)},function(e,t,r){"use strict";e.exports={SHA1:20,SHA256:32,SHA512:64}},function(e,t,r){"use strict";const n=r(1117),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);r(null,{encrypt(e,t){t(null,s.update(e))},decrypt(e,t){t(null,a.update(e))}})}},function(e,t,r){"use strict";const n=r(57);e.exports={createCipheriv:n.createCipheriv,createDecipheriv:n.createDecipheriv}},function(e,t,r){"use strict";(function(n){const i=r(10)(r(286)),o=r(16);t=e.exports;const s={rsa:r(1119),ed25519:r(1124),secp256k1:r(59)(i,r(530))};function a(e){return void 0!==s[e.toLowerCase()]}t.supportedKeys=s,t.keysPBM=i,t.keyStretcher=r(1126),t.generateEphemeralKeyPair=r(1127),t.generateKeyPair=((e,t,r)=>{let n=s[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=s[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=i.PublicKey.decode(e),r=t.Data;switch(t.Type){case i.KeyType.RSA:return s.rsa.unmarshalRsaPublicKey(r);case i.KeyType.Ed25519:return s.ed25519.unmarshalEd25519PublicKey(r);case i.KeyType.Secp256k1:if(s.secp256k1)return s.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(!a(t=(t||"rsa").toLowerCase()))throw new Error("invalid or unsupported key type");return e.bytes}),t.unmarshalPrivateKey=((e,t)=>{let r;try{r=i.PrivateKey.decode(e)}catch(e){return t(e)}const n=r.Data;switch(r.Type){case i.KeyType.RSA:return s.rsa.unmarshalRsaPrivateKey(n,t);case i.KeyType.Ed25519:return s.ed25519.unmarshalEd25519PrivateKey(n,t);case i.KeyType.Secp256k1:return s.secp256k1?s.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(!a(t=(t||"rsa").toLowerCase()))throw new Error("invalid or unsupported key type");return e.bytes}),t.import=((e,t,r)=>{try{const i=o.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 a=o.asn1.toDer(o.pki.privateKeyToAsn1(i));return a=n.from(a.getBytes(),"binary"),s.rsa.unmarshalRsaPrivateKey(a,r)}catch(e){r(e)}})}).call(this,r(0).Buffer)},function(e,t,r){"use strict";const n=r(526),i=r(10),o=r(14),s=r(528),a=i(r(286)),u=r(16),c=r(3);class f{constructor(e){this._key=e}verify(e,t,r){h(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){h(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){h(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){h(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"),h(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){if("function"!=typeof e)throw new Error("callback is required")}e.exports={RsaPublicKey:f,RsaPrivateKey:l,unmarshalRsaPublicKey:function(e){const t=s.utils.pkixToJwk(e);return new f(t)},unmarshalRsaPrivateKey:function(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))})},generateKeyPair:function(e,t){s.generateKey(e,(e,r)=>{if(e)return t(e);t(null,new l(r.privateKey,r.publicKey))})},fromJwk:function(e,t){s.unmarshalPrivateKey(e,(e,r)=>{if(e)return t(e);t(null,new l(r.privateKey,r.publicKey))})}}},function(e,t,r){"use strict";(function(t){const n=r(38),i=r(39),o=r(527),s=r(1121),a=o.toCallback,u=o.toBuf,c=o.fromString,f=o.fromNumberTo32BitBuf;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(1122),dblSha2256:(e,r)=>{s.sha2256(e,(e,n)=>{e&&r(e),s.sha2256(t.from(n),r)})}}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(t){const n=r(40),i=self.crypto?self.crypto.subtle||self.crypto.webkitSubtle:self.msCrypto?self.msCrypto.subtle:void 0;function o(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)}}e.exports={sha1:function(e,t){o("SHA-1")(e,t)},sha2256:function(e,t){o("SHA-256")(e,t)},sha2512:function(e,t){o("SHA-512")(e,t)}}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(t){const n=r(41),i=r(527).toCallback,o={init:n.blake2bInit,update:n.blake2bUpdate,digest:n.blake2bFinal},s={init:n.blake2sInit,update:n.blake2sUpdate,digest:n.blake2sFinal},a=(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[45569+t]=a(t+1,o);for(let t=0;t<32;t++)e[45633+t]=a(t+1,s)})}).call(this,r(0).Buffer)},function(e,t,r){"use strict";const n=r(15),i=r(529),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(526),i=r(10),o=r(14),s=r(1125),a=i(r(286));class u{constructor(e){this._key=l(e,s.publicKeyLength)}verify(e,t,r){f(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){f(e),n(this.bytes,"sha2-256",e)}}class c{constructor(e,t){this._key=l(e,s.privateKeyLength),this._publicKey=l(t,s.publicKeyLength)}sign(e,t){f(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){f(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){if("function"!=typeof e)throw new Error("callback is required")}function l(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:function(e,t){try{e=l(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))},unmarshalEd25519PublicKey:function(e){return e=l(e,s.publicKeyLength),new u(e)},generateKeyPair:function(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)})},generateKeyPairFromSeed:function(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)})}}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(e){const n=r(58),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(37),i=r(525),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=t.from("key expansion"),h=2*(f+c+20);i.create(r,s,(e,r)=>{if(e)return a(e);r.digest(l,(e,i)=>{if(e)return a(e);let o=[],s=0;n(()=>s<h,function(e){r.digest(t.concat([i,l]),(t,n)=>{if(t)return e(t);let a=n.length;s+a>h&&(a=h-s),o.push(n),s+=a,r.digest(i,(t,r)=>{if(t)return e(t);i=r,e()})})},function(e){if(e)return a(e);const r=h/2,n=t.concat(o),i=n.slice(0,r),s=n.slice(r,h),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)})})})})})}).call(this,r(0).Buffer)},function(e,t,r){"use strict";const n=r(1128);e.exports=((e,t)=>{n.generateEphmeralKeyPair(e,t)})},function(e,t,r){"use strict";(function(e){const n=r(285)(),i=r(284),o=r(15).bignum,s=r(529),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(16),i={sha1:"sha1","sha2-256":"sha256","sha2-512":"sha512"};e.exports=function(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)}},function(e,t){e.exports=function e(t,r){if(t&&r)return e(t)(r);if("function"!=typeof t)throw new TypeError("need wrapper function");return Object.keys(t).forEach(function(e){n[e]=t[e]}),n;function n(){for(var e=new Array(arguments.length),r=0;r<e.length;r++)e[r]=arguments[r];var n=t.apply(this,e),i=e[e.length-1];return"function"==typeof n&&n!==i&&Object.keys(i).forEach(function(e){n[e]=i[e]}),n}}},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(60);(t=e.exports).cleanUrlSIO=function(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]},t.cleanMultiaddr=function(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];e=(r=(r=(r=r.decapsulate("ipfs")).encapsulate("/p2p-webrtc-star")).encapsulate(`/ipfs/${i[1]}`)).toString()}return e}},function(e,t,r){"use strict";const n=r(1)("libp2p:websocket-star"),i=r(60),o=r(11).EventEmitter,s=r(532),a=r(51),u=r(47).Connection,c=r(3),f=r(539),l=r(1150),h=f.cleanUrlSIO,p=r(78),d=r(61);e.exports=d(class{constructor(e){e=e||{},this.id=e.id,this.flag=e.allowJoinWithDisabledChallenge,this.discovery=new o,this.discovery.tag="websocketStar",this.discovery.start=(e=>{c(e)}),this.discovery.stop=(e=>{c(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=h(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 u)}createListener(e,t){"function"==typeof e&&(t=e,e={});const r=new l({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=>p.WebSocketStar.matches(e))}_peerDiscovered(e){n("Peer Discovered:",e);const t=e.split("/ipfs/").pop(),r=s.createFromB58String(t),o=new a(r);o.multiaddrs.add(i(e)),this.discovery.emit("peer",o)}},{className:"WebsocketStar",symbolName:"@libp2p/js-libp2p-websocket-star/websocketstar"})},function(e,t,r){"use strict";const n=r(533),i=r(1136),o=r(1138);(t=e.exports).aes=i,t.hmac=n,t.keys=o,t.randomBytes=r(538),t.pbkdf2=r(1149)},function(e,t,r){"use strict";e.exports={SHA1:20,SHA256:32,SHA512:64}},function(e,t,r){"use strict";const n=r(1137),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);r(null,{encrypt(e,t){t(null,s.update(e))},decrypt(e,t){t(null,a.update(e))}})}},function(e,t,r){"use strict";const n=r(57);e.exports={createCipheriv:n.createCipheriv,createDecipheriv:n.createDecipheriv}},function(e,t,r){"use strict";(function(n){const i=r(10)(r(289)),o=r(16);t=e.exports;const s={rsa:r(1139),ed25519:r(1144),secp256k1:r(59)(i,r(538))};function a(e){return void 0!==s[e.toLowerCase()]}t.supportedKeys=s,t.keysPBM=i,t.keyStretcher=r(1146),t.generateEphemeralKeyPair=r(1147),t.generateKeyPair=((e,t,r)=>{let n=s[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=s[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=i.PublicKey.decode(e),r=t.Data;switch(t.Type){case i.KeyType.RSA:return s.rsa.unmarshalRsaPublicKey(r);case i.KeyType.Ed25519:return s.ed25519.unmarshalEd25519PublicKey(r);case i.KeyType.Secp256k1:if(s.secp256k1)return s.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(!a(t=(t||"rsa").toLowerCase()))throw new Error("invalid or unsupported key type");return e.bytes}),t.unmarshalPrivateKey=((e,t)=>{let r;try{r=i.PrivateKey.decode(e)}catch(e){return t(e)}const n=r.Data;switch(r.Type){case i.KeyType.RSA:return s.rsa.unmarshalRsaPrivateKey(n,t);case i.KeyType.Ed25519:return s.ed25519.unmarshalEd25519PrivateKey(n,t);case i.KeyType.Secp256k1:return s.secp256k1?s.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(!a(t=(t||"rsa").toLowerCase()))throw new Error("invalid or unsupported key type");return e.bytes}),t.import=((e,t,r)=>{try{const i=o.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 a=o.asn1.toDer(o.pki.privateKeyToAsn1(i));return a=n.from(a.getBytes(),"binary"),s.rsa.unmarshalRsaPrivateKey(a,r)}catch(e){r(e)}})}).call(this,r(0).Buffer)},function(e,t,r){"use strict";const n=r(534),i=r(10),o=r(14),s=r(536),a=i(r(289)),u=r(16),c=r(3);class f{constructor(e){this._key=e}verify(e,t,r){h(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){h(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){h(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){h(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"),h(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){if("function"!=typeof e)throw new Error("callback is required")}e.exports={RsaPublicKey:f,RsaPrivateKey:l,unmarshalRsaPublicKey:function(e){const t=s.utils.pkixToJwk(e);return new f(t)},unmarshalRsaPrivateKey:function(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))})},generateKeyPair:function(e,t){s.generateKey(e,(e,r)=>{if(e)return t(e);t(null,new l(r.privateKey,r.publicKey))})},fromJwk:function(e,t){s.unmarshalPrivateKey(e,(e,r)=>{if(e)return t(e);t(null,new l(r.privateKey,r.publicKey))})}}},function(e,t,r){"use strict";(function(t){const n=r(38),i=r(39),o=r(535),s=r(1141),a=o.toCallback,u=o.toBuf,c=o.fromString,f=o.fromNumberTo32BitBuf;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(1142),dblSha2256:(e,r)=>{s.sha2256(e,(e,n)=>{e&&r(e),s.sha2256(t.from(n),r)})}}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(t){const n=r(40),i=self.crypto?self.crypto.subtle||self.crypto.webkitSubtle:self.msCrypto?self.msCrypto.subtle:void 0;function o(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)}}e.exports={sha1:function(e,t){o("SHA-1")(e,t)},sha2256:function(e,t){o("SHA-256")(e,t)},sha2512:function(e,t){o("SHA-512")(e,t)}}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(t){const n=r(41),i=r(535).toCallback,o={init:n.blake2bInit,update:n.blake2bUpdate,digest:n.blake2bFinal},s={init:n.blake2sInit,update:n.blake2sUpdate,digest:n.blake2sFinal},a=(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[45569+t]=a(t+1,o);for(let t=0;t<32;t++)e[45633+t]=a(t+1,s)})}).call(this,r(0).Buffer)},function(e,t,r){"use strict";const n=r(15),i=r(537),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(534),i=r(10),o=r(14),s=r(1145),a=i(r(289));class u{constructor(e){this._key=l(e,s.publicKeyLength)}verify(e,t,r){f(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){f(e),n(this.bytes,"sha2-256",e)}}class c{constructor(e,t){this._key=l(e,s.privateKeyLength),this._publicKey=l(t,s.publicKeyLength)}sign(e,t){f(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){f(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){if("function"!=typeof e)throw new Error("callback is required")}function l(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:function(e,t){try{e=l(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))},unmarshalEd25519PublicKey:function(e){return e=l(e,s.publicKeyLength),new u(e)},generateKeyPair:function(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)})},generateKeyPairFromSeed:function(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)})}}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(e){const n=r(58),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(37),i=r(533),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=t.from("key expansion"),h=2*(f+c+20);i.create(r,s,(e,r)=>{if(e)return a(e);r.digest(l,(e,i)=>{if(e)return a(e);let o=[],s=0;n(()=>s<h,function(e){r.digest(t.concat([i,l]),(t,n)=>{if(t)return e(t);let a=n.length;s+a>h&&(a=h-s),o.push(n),s+=a,r.digest(i,(t,r)=>{if(t)return e(t);i=r,e()})})},function(e){if(e)return a(e);const r=h/2,n=t.concat(o),i=n.slice(0,r),s=n.slice(r,h),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)})})})})})}).call(this,r(0).Buffer)},function(e,t,r){"use strict";const n=r(1148);e.exports=((e,t)=>{n.generateEphmeralKeyPair(e,t)})},function(e,t,r){"use strict";(function(e){const n=r(288)(),i=r(287),o=r(15).bignum,s=r(537),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(16),i={sha1:"sha1","sha2-256":"sha256","sha2-512":"sha512"};e.exports=function(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)}},function(e,t,r){"use strict";(function(t){const n=r(1)("libp2p:websocket-star:listener"),i=r(60),o=r(513),s=r(1151),a=r(540),u=r(49),c=r(11).EventEmitter,f=r(47).Connection,l=r(30),h=r(3),p=r(539),d=p.cleanUrlSIO,y=r(111),g=l(()=>{}),m={transports:["websocket"],"force new connection":!0};e.exports=class extends c{constructor(e){super(),this.id=e.id,this.log=n.bind(n,"listener#offline"),this.canCrypto=Boolean(e.id),this._handler=e.handler||g,this.listeners_list=e.listeners||{},this.flag=e.flag}_up(e){if(e=e?l(e):g,this.io)return e();this.log=n.bind(n,"listener#"+this.server),this.log("dialing to signalling server");const t=this.io=o.connect(this.server,m);s(t,{codec:"buffer"}),t.once("error",e),t.once("connect_error",e),t.once("connect",e);const r=new p.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?y.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?l(e):g,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 o=i(r),s=this.io.createSource(t+".dialer"),a=this.io.createSink(t+".listener");n();const u=new f({sink:a,source:s},{getObservedAddrs:e=>e(null,[o])});this.emit("connection",u),this._handler(u)}listen(e,t){this.ma=e,this.server=d(e),this.listeners_list[this.server]=this,t=t?l(t):g,u([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){h(()=>e(null,this.ma?[this.ma]:[]))}close(e){e=e?l(e):g,this._down(),e()}dial(e,t,r){"function"==typeof t&&(r=t,t={});const o=i(e),s=new f(null),u=a(),c=this.log.bind(n,"dial#"+u);r=r?l(r):g;let h=this.io;if(!h)return r(new Error("Not listening"));const p=h.createSink(u+".dialer");return c("dialing",e.toString()),h.emit("ss-dial",this.ma.toString(),e.toString(),u,e=>{if(e)return r(e instanceof Error?e:new Error(e));c(e?"error: "+e.toString():"success");const t=h.createSource(u+".listener");s.setInnerConn({sink:p,source:t},{getObservedAddrs:e=>e(null,[o])}),r(null,s)}),s}}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(t){const n=r(1152),i=r(540),o=r(8),s=(e,t)=>"socket.io-pull-stream."+e+(t?"."+t:""),a=r(1)("socket.io-pull-stream");function u(e,t){if(null==t)return t;try{return e(t)}catch(e){return console.error("Codec Error"),console.error(e),!1}}const c={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 f(e){if(e||(e="plain"),"object"==typeof e)return e;const t=c[e];if(!t)throw new Error("Invalid codec "+e);return t}function l(e,t,r){const i=n(),o=e.sioplog.bind(e.sioplog,"source("+t+")"),a=f(r.codec).decode;function c(){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"),c(),i.append({end:e})}),e.on(s("queue",t),e=>{o("queue data"),i.append({data:u(a,e)})}),e.once("disconnect",()=>{c(),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 h(e,t,r){const i=n(),o=e.sioplog.bind(e.sioplog," sink("+t+")"),a=f(r.codec).encode;let c;function l(e){i.append({err:e}),c=e}return o("create sink"),e.once(s("accept",t),()=>{o("start transmission"),function r(){i.get((n,c)=>{let{data:f,err:l}=c||{};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),u(a,f)),r()})}()}),e.once("disconnect",()=>l(!0)),function(e){e(null,function t(r,n){return r?l(r):c?e(c,t):(i.append({data:n}),void e(null,t))})}}e.exports=function(e,t){e.createSink||(e.sioplog=e.id?a.bind(a,"["+e.id+"]"):a,e.createSink=((r,n)=>{r||(r=i());const o=h(e,r,t||n);return o.id=r,o}),e.createSource=((r,n)=>{const i=l(e,r,t||n);return i.id=r,i}),e.createProxy=((t,r,n)=>{o(e.createSource(t,n),r.createSink(t,n))}))}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";const n=r(11).EventEmitter;e.exports=function(){const e=new n;let t,r=[];function i(){e.removeAllListeners("err"),e.removeAllListeners("data")}return{append:n=>{if(t)return t;r.push(n),e.emit("data")},prepend:e=>{if(t)return t;r.unshift(e)},error:r=>{t=r,e.emit("err",r)},get:n=>(i(),t?n(t):r.length?n(null,r.shift()):(e.once("err",e=>{i(),n(e)}),void e.once("data",()=>(i(),n(null,r.shift()))))),height:()=>r.length}}},function(e,t,r){var n,i,o=r(366),s=r(367),a=0,u=0;e.exports=function(e,t,r){var c=t&&r||0,f=t||[],l=(e=e||{}).node||n,h=void 0!==e.clockseq?e.clockseq:i;if(null==l||null==h){var p=o();null==l&&(l=n=[1|p[0],p[1],p[2],p[3],p[4],p[5]]),null==h&&(h=i=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,i=h;var m=(1e4*(268435455&(d+=122192928e5))+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||s(f)}},function(e,t,r){"use strict";const n=r(140),i=r(1155),o=r(541),s=r(1159),a=r(542);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).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(22),i=r(20),o=r(1156),s=r(1),a=r(1158),u=t.from([0]),c=t.alloc(0);let f=t.alloc(10240),l=0;e.exports=class 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()}}}}).call(this,r(0).Buffer)},function(e,t,r){(function(t,n){var i=r(22),o=r(193),s=r(5),a=r(1157),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){return function(r){r?function(e,t){e._autoDestroy&&e.destroy(t)}(e,"premature close"===r.message?null:r):t&&!e._ended&&e.end()}},l=function(e){return new i.Readable({objectMode:!0,highWaterMark:16}).wrap(e)},h=function(e,t,r){if(!(this instanceof h))return new h(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(h,i.Duplex),h.obj=function(e,t,r){return r||(r={}),r.objectMode=!0,r.highWaterMark=16,new h(e,t,r)},h.prototype.cork=function(){1==++this._corked&&this.emit("cork")},h.prototype.uncork=function(){this._corked&&0==--this._corked&&this.emit("uncork")},h.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},f(this,this._forwardEnd)),i=function(){var e=t._ondrain;t._ondrain=null,e&&e()};this._unwrite&&n.nextTick(i),this._writable=e,this._writable.on("drain",i),this._unwrite=function(){t._writable.removeListener("drain",i),r()},this.uncork()}else this.end()},h.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},f(this)),n=function(){t._forward()},i=function(){t.push(null)};this._drained=!0,this._readable=e,this._readable2=e._readableState?e:l(e),this._readable2.on("readable",n),this._readable2.on("end",i),this._unread=function(){t._readable2.removeListener("readable",n),t._readable2.removeListener("end",i),r()},this._forward()}},h.prototype._read=function(){this._drained=!0,this._forward()},h.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}},h.prototype.destroy=function(e){if(!this.destroyed){this.destroyed=!0;var t=this;n.nextTick(function(){t._destroy(e)})}},h.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")},h.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()},h.prototype._finish=function(e){var t=this;this.emit("preend"),c(this,function(){!function(e,t){e?e._writableState&&e._writableState.finished?t():e._writableState?e.end(t):(e.end(),t()):t()}(t._forwardEnd&&t._writable,function(){!1===t._writableState.prefinished&&(t._writableState.prefinished=!0),t.emit("prefinish"),c(t,e)})})},h.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=h}).call(this,r(0).Buffer,r(7))},function(e,t){e.exports=function(e){var t=e._readableState;return t?t.objectMode?e.read():e.read(function(e){return e.buffer.length?e.buffer.head?e.buffer.head.data.length:e.buffer[0].length:e.length}(t)):null}},function(e,t,r){"use strict";(function(t){const n=r(22),i=r(1);e.exports=class 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){this.log("write: ",e.length),this._opened?this.destroyed?r():(this._lazy&&this.initiator&&this._open(),this._multiplex._send(this._dataHeader,e)?r():this._multiplex._ondrain.push(r)):this.once("open",()=>{this._write(e,t,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")}}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";const n=r(11).EventEmitter,i=r(47).Connection,o=r(192),s=r(8),a=r(1160),u=r(3),c=r(541);function f(){}function l(e){return{source:s(e.source,a(e=>{if("Channel destroyed"!==e.message)return!1})),sink:e.sink}}e.exports=class 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()}}},function(e,t){e.exports=function(e){var t;return e=e||function(){},function(r){return function(n,i){r(n,function(r,n){if(t)return i(!0);if(r&&!0!==r){var o=e(r);return!1===o?i(r):o&&!0!==o?(t=!0,i(null,o)):i(!0)}i(r,n)})}}}},function(e,t){},function(e,t,r){"use strict";const n=r(8),i=r(47).Connection,o=r(17),s=r(51),a=r(1),u=r(30),c=a("libp2p:secio");c.error=a("libp2p:secio:error");const f=r(1163),l=r(1185);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=new l(e,r,3e5,a);const p=new i(void 0,t);return n(t,f(h,function(e){if(e)return a(e);t.getPeerInfo((e,r)=>{p.setInnerConn(new i(h.secure,t)),e&&p.setPeerInfo(new s(h.id.remote)),a()})}),t),p}}},function(e,t,r){"use strict";const n=r(49),i=r(1164),o=r(1182),s=r(1183);e.exports=function(e,t){return n([t=>i(e,t),t=>o(e,t),t=>s(e,t)],r=>{e.cleanSecrets(),r&&(!0===r&&(r=new Error("Stream ended prematurely")),e.shake.abort(r)),t(r)}),e.stream}},function(e,t,r){"use strict";const n=r(1),i=r(4),o=r(290),s=r(296),a=n("libp2p:secio");a.error=n("libp2p:secio:error"),e.exports=function(e,t){a("1. propose - start"),a("1. propose - writing proposal"),o.write(e,s.createProposal(e)),i([t=>o.read(e.shake,t),(t,r)=>{a("1. propose - reading proposal",t),s.identify(e,t,r)},t=>s.selectProtocols(e,t)],e=>{if(e)return t(e);a("1. propose - finish"),t()})}},function(e,t,r){"use strict";(function(t){const n=r(38),i=r(39),o=r(543),s=r(1166),a=o.toCallback,u=o.toBuf,c=o.fromString,f=o.fromNumberTo32BitBuf;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(1167),dblSha2256:(e,r)=>{s.sha2256(e,(e,n)=>{e&&r(e),s.sha2256(t.from(n),r)})}}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(t){const n=r(40),i=self.crypto?self.crypto.subtle||self.crypto.webkitSubtle:self.msCrypto?self.msCrypto.subtle:void 0;function o(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)}}e.exports={sha1:function(e,t){o("SHA-1")(e,t)},sha2256:function(e,t){o("SHA-256")(e,t)},sha2512:function(e,t){o("SHA-512")(e,t)}}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(t){const n=r(41),i=r(543).toCallback,o={init:n.blake2bInit,update:n.blake2bUpdate,digest:n.blake2bFinal},s={init:n.blake2sInit,update:n.blake2sUpdate,digest:n.blake2sFinal},a=(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[45569+t]=a(t+1,o);for(let t=0;t<32;t++)e[45633+t]=a(t+1,s)})}).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(1170),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);r(null,{encrypt(e,t){t(null,s.update(e))},decrypt(e,t){t(null,a.update(e))}})}},function(e,t,r){"use strict";const n=r(57);e.exports={createCipheriv:n.createCipheriv,createDecipheriv:n.createDecipheriv}},function(e,t,r){"use strict";(function(n){const i=r(10)(r(295)),o=r(16);t=e.exports;const s={rsa:r(1172),ed25519:r(1174),secp256k1:r(59)(i,r(547))};function a(e){return void 0!==s[e.toLowerCase()]}t.supportedKeys=s,t.keysPBM=i,t.keyStretcher=r(1176),t.generateEphemeralKeyPair=r(1177),t.generateKeyPair=((e,t,r)=>{let n=s[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=s[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=i.PublicKey.decode(e),r=t.Data;switch(t.Type){case i.KeyType.RSA:return s.rsa.unmarshalRsaPublicKey(r);case i.KeyType.Ed25519:return s.ed25519.unmarshalEd25519PublicKey(r);case i.KeyType.Secp256k1:if(s.secp256k1)return s.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(!a(t=(t||"rsa").toLowerCase()))throw new Error("invalid or unsupported key type");return e.bytes}),t.unmarshalPrivateKey=((e,t)=>{let r;try{r=i.PrivateKey.decode(e)}catch(e){return t(e)}const n=r.Data;switch(r.Type){case i.KeyType.RSA:return s.rsa.unmarshalRsaPrivateKey(n,t);case i.KeyType.Ed25519:return s.ed25519.unmarshalEd25519PrivateKey(n,t);case i.KeyType.Secp256k1:return s.secp256k1?s.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(!a(t=(t||"rsa").toLowerCase()))throw new Error("invalid or unsupported key type");return e.bytes}),t.import=((e,t,r)=>{try{const i=o.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 a=o.asn1.toDer(o.pki.privateKeyToAsn1(i));return a=n.from(a.getBytes(),"binary"),s.rsa.unmarshalRsaPrivateKey(a,r)}catch(e){r(e)}})}).call(this,r(0).Buffer)},function(e,t,r){"use strict";const n=r(291),i=r(10),o=r(14),s=r(545),a=i(r(295)),u=r(16),c=r(3);class f{constructor(e){this._key=e}verify(e,t,r){h(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){h(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){h(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){h(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"),h(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){if("function"!=typeof e)throw new Error("callback is required")}e.exports={RsaPublicKey:f,RsaPrivateKey:l,unmarshalRsaPublicKey:function(e){const t=s.utils.pkixToJwk(e);return new f(t)},unmarshalRsaPrivateKey:function(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))})},generateKeyPair:function(e,t){s.generateKey(e,(e,r)=>{if(e)return t(e);t(null,new l(r.privateKey,r.publicKey))})},fromJwk:function(e,t){s.unmarshalPrivateKey(e,(e,r)=>{if(e)return t(e);t(null,new l(r.privateKey,r.publicKey))})}}},function(e,t,r){"use strict";const n=r(15),i=r(546),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(291),i=r(10),o=r(14),s=r(1175),a=i(r(295));class u{constructor(e){this._key=l(e,s.publicKeyLength)}verify(e,t,r){f(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){f(e),n(this.bytes,"sha2-256",e)}}class c{constructor(e,t){this._key=l(e,s.privateKeyLength),this._publicKey=l(t,s.publicKeyLength)}sign(e,t){f(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){f(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){if("function"!=typeof e)throw new Error("callback is required")}function l(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:function(e,t){try{e=l(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))},unmarshalEd25519PublicKey:function(e){return e=l(e,s.publicKeyLength),new u(e)},generateKeyPair:function(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)})},generateKeyPairFromSeed:function(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)})}}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(e){const n=r(58),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(37),i=r(544),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=t.from("key expansion"),h=2*(f+c+20);i.create(r,s,(e,r)=>{if(e)return a(e);r.digest(l,(e,i)=>{if(e)return a(e);let o=[],s=0;n(()=>s<h,function(e){r.digest(t.concat([i,l]),(t,n)=>{if(t)return e(t);let a=n.length;s+a>h&&(a=h-s),o.push(n),s+=a,r.digest(i,(t,r)=>{if(t)return e(t);i=r,e()})})},function(e){if(e)return a(e);const r=h/2,n=t.concat(o),i=n.slice(0,r),s=n.slice(r,h),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)})})})})})}).call(this,r(0).Buffer)},function(e,t,r){"use strict";const n=r(1178);e.exports=((e,t)=>{n.generateEphmeralKeyPair(e,t)})},function(e,t,r){"use strict";(function(e){const n=r(294)(),i=r(293),o=r(15).bignum,s=r(546),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(16),i={sha1:"sha1","sha2-256":"sha256","sha2-512":"sha512"};e.exports=function(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)}},function(e,t,r){"use strict";(function(n){const i=r(12),o=r(292),s=r(17),a=r(4);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).create=function(e,t){"function"==typeof e&&(t=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(4),o=r(290),s=r(296),a=n("libp2p:secio");a.error=n("libp2p:secio:error"),e.exports=function(e,t){a("2. exchange - start"),a("2. exchange - writing exchange"),i([t=>s.createExchange(e,t),(t,r)=>{o.write(e,t),o.read(e.shake,r)},(t,r)=>{a("2. exchange - reading exchange"),s.verify(e,t,r)},t=>s.generateKeys(e,t)],e=>{if(e)return t(e);a("2. exchange - finish"),t()})}},function(e,t,r){"use strict";const n=r(8),i=r(100),o=r(1),s=o("libp2p:secio");s.error=o("libp2p:secio:error");const a=r(1184),u=r(296);e.exports=function(e,t){s("3. finish - start");const r=e.protocols,o=e.shake.rest(),c=i({timeout:e.timeout},e=>{if(e)throw e});n(o,a.createUnboxStream(r.remote.cipher,r.remote.mac),c,a.createBoxStream(r.local.cipher,r.local.mac),o),c.handshake.write(e.proposal.in.rand),c.handshake.read(e.proposal.in.rand.length,(r,i)=>{const o=r=>{s.error(r),e.secure.resolve({source:n.error(r),sink(e){}}),t(r)};if(r)return o(r);try{u.verifyNonce(e,i)}catch(r){return o(r)}s("3. finish - finish"),e.secure.resolve(c.handshake.rest()),t()})}},function(e,t,r){"use strict";(function(e){const n=r(8),i=r(52),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(100),i=r(224);e.exports=class{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}}}},function(e,t,r){"use strict";const n=r(1187),i=r(51),o=r(60),s=r(78),a=r(11).EventEmitter,u=r(1),c=r(3),f=u("libp2p:railing");f.error=u("libp2p:railing:error");(e.exports=class 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(!function(e){try{return s.IPFS.matches(e)}catch(e){return!1}}(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)}}).tag="bootstrap"},function(e,t,r){"use strict";(function(n){const i=r(12),o=r(1188),s=r(17),a=r(4);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).create=function(e,t){"function"==typeof e&&(t=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(548),i=r(1190),o=r(1192);(t=e.exports).aes=i,t.hmac=n,t.keys=o,t.randomBytes=r(553),t.pbkdf2=r(1203)},function(e,t,r){"use strict";e.exports={SHA1:20,SHA256:32,SHA512:64}},function(e,t,r){"use strict";const n=r(1191),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);r(null,{encrypt(e,t){t(null,s.update(e))},decrypt(e,t){t(null,a.update(e))}})}},function(e,t,r){"use strict";const n=r(57);e.exports={createCipheriv:n.createCipheriv,createDecipheriv:n.createDecipheriv}},function(e,t,r){"use strict";(function(n){const i=r(10)(r(299)),o=r(16);t=e.exports;const s={rsa:r(1193),ed25519:r(1198),secp256k1:r(59)(i,r(553))};function a(e){return void 0!==s[e.toLowerCase()]}t.supportedKeys=s,t.keysPBM=i,t.keyStretcher=r(1200),t.generateEphemeralKeyPair=r(1201),t.generateKeyPair=((e,t,r)=>{let n=s[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=s[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=i.PublicKey.decode(e),r=t.Data;switch(t.Type){case i.KeyType.RSA:return s.rsa.unmarshalRsaPublicKey(r);case i.KeyType.Ed25519:return s.ed25519.unmarshalEd25519PublicKey(r);case i.KeyType.Secp256k1:if(s.secp256k1)return s.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(!a(t=(t||"rsa").toLowerCase()))throw new Error("invalid or unsupported key type");return e.bytes}),t.unmarshalPrivateKey=((e,t)=>{let r;try{r=i.PrivateKey.decode(e)}catch(e){return t(e)}const n=r.Data;switch(r.Type){case i.KeyType.RSA:return s.rsa.unmarshalRsaPrivateKey(n,t);case i.KeyType.Ed25519:return s.ed25519.unmarshalEd25519PrivateKey(n,t);case i.KeyType.Secp256k1:return s.secp256k1?s.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(!a(t=(t||"rsa").toLowerCase()))throw new Error("invalid or unsupported key type");return e.bytes}),t.import=((e,t,r)=>{try{const i=o.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 a=o.asn1.toDer(o.pki.privateKeyToAsn1(i));return a=n.from(a.getBytes(),"binary"),s.rsa.unmarshalRsaPrivateKey(a,r)}catch(e){r(e)}})}).call(this,r(0).Buffer)},function(e,t,r){"use strict";const n=r(549),i=r(10),o=r(14),s=r(551),a=i(r(299)),u=r(16),c=r(3);class f{constructor(e){this._key=e}verify(e,t,r){h(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){h(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){h(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){h(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"),h(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){if("function"!=typeof e)throw new Error("callback is required")}e.exports={RsaPublicKey:f,RsaPrivateKey:l,unmarshalRsaPublicKey:function(e){const t=s.utils.pkixToJwk(e);return new f(t)},unmarshalRsaPrivateKey:function(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))})},generateKeyPair:function(e,t){s.generateKey(e,(e,r)=>{if(e)return t(e);t(null,new l(r.privateKey,r.publicKey))})},fromJwk:function(e,t){s.unmarshalPrivateKey(e,(e,r)=>{if(e)return t(e);t(null,new l(r.privateKey,r.publicKey))})}}},function(e,t,r){"use strict";(function(t){const n=r(38),i=r(39),o=r(550),s=r(1195),a=o.toCallback,u=o.toBuf,c=o.fromString,f=o.fromNumberTo32BitBuf;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(1196),dblSha2256:(e,r)=>{s.sha2256(e,(e,n)=>{e&&r(e),s.sha2256(t.from(n),r)})}}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(t){const n=r(40),i=self.crypto?self.crypto.subtle||self.crypto.webkitSubtle:self.msCrypto?self.msCrypto.subtle:void 0;function o(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)}}e.exports={sha1:function(e,t){o("SHA-1")(e,t)},sha2256:function(e,t){o("SHA-256")(e,t)},sha2512:function(e,t){o("SHA-512")(e,t)}}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(t){const n=r(41),i=r(550).toCallback,o={init:n.blake2bInit,update:n.blake2bUpdate,digest:n.blake2bFinal},s={init:n.blake2sInit,update:n.blake2sUpdate,digest:n.blake2sFinal},a=(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[45569+t]=a(t+1,o);for(let t=0;t<32;t++)e[45633+t]=a(t+1,s)})}).call(this,r(0).Buffer)},function(e,t,r){"use strict";const n=r(15),i=r(552),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(549),i=r(10),o=r(14),s=r(1199),a=i(r(299));class u{constructor(e){this._key=l(e,s.publicKeyLength)}verify(e,t,r){f(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){f(e),n(this.bytes,"sha2-256",e)}}class c{constructor(e,t){this._key=l(e,s.privateKeyLength),this._publicKey=l(t,s.publicKeyLength)}sign(e,t){f(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){f(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){if("function"!=typeof e)throw new Error("callback is required")}function l(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:function(e,t){try{e=l(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))},unmarshalEd25519PublicKey:function(e){return e=l(e,s.publicKeyLength),new u(e)},generateKeyPair:function(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)})},generateKeyPairFromSeed:function(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)})}}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(e){const n=r(58),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(37),i=r(548),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=t.from("key expansion"),h=2*(f+c+20);i.create(r,s,(e,r)=>{if(e)return a(e);r.digest(l,(e,i)=>{if(e)return a(e);let o=[],s=0;n(()=>s<h,function(e){r.digest(t.concat([i,l]),(t,n)=>{if(t)return e(t);let a=n.length;s+a>h&&(a=h-s),o.push(n),s+=a,r.digest(i,(t,r)=>{if(t)return e(t);i=r,e()})})},function(e){if(e)return a(e);const r=h/2,n=t.concat(o),i=n.slice(0,r),s=n.slice(r,h),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)})})})})})}).call(this,r(0).Buffer)},function(e,t,r){"use strict";const n=r(1202);e.exports=((e,t)=>{n.generateEphmeralKeyPair(e,t)})},function(e,t,r){"use strict";(function(e){const n=r(298)(),i=r(297),o=r(15).bignum,s=r(552),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(16),i={sha1:"sha1","sha2-256":"sha256","sha2-512":"sha512"};e.exports=function(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)}},function(e,t,r){"use strict";const n=r(11).EventEmitter,i=r(17),o=r(50),s=r(49),a=r(63),u=r(490),c=r(1205),f=r(1307),l=r(512),h=r(1311),p=r(1345),d=r(1346),y=r(1347),g=r(1348),m=r(1358),b=r(1376).validate;e.exports;const v="The libp2p node is not started yet";e.exports=class extends n{constructor(e){if(super(),e=b(e),this.peerInfo=e.peerInfo,this.peerBook=e.peerBook||new u,this._modules=e.modules,this._config=e.config,this._isStarted=!1,this._transport=[],this._discovery=[],this._switch=new c(this.peerInfo,this.peerBook,e.switch),this.stats=this._switch.stats,this.connectionManager=new h(this,e.connectionManager),this._modules.streamMuxer&&(this._modules.streamMuxer.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)})),this._modules.connEncryption&&this._modules.connEncryption.forEach(e=>{this._switch.connection.crypto(e.tag,e.encrypt)}),this._config.EXPERIMENTAL.dht){const e=this._modules.dht;this._dht=new e(this._switch,{kBucketSize:this._config.dht.kBucketSize||20,datastore:y.datastore})}this._config.EXPERIMENTAL.pubsub&&(this.pubsub=g(this)),this.peerRouting=p(this),this.contentRouting=d(this),this.dht=y(this),this._getPeerInfo=m(this),f.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).filter(i).length>0?this._switch.transport.add(r.tag||r.constructor.name,r):l.isWebSockets(r)&&(t=r),this._transport.push(r)}),s([e=>this._switch.start(e),e=>{t&&this._switch.transport.add(t.tag||t.constructor.name,t),this._modules.peerDiscovery?o(this._modules.peerDiscovery,(e,t)=>{let r={};if(e.tag&&this._config.peerDiscovery&&this._config.peerDiscovery[e.tag]&&(r=this._config.peerDiscovery[e.tag]),null==r.enabled||r.enabled){let n;(n="function"==typeof e?new e(Object.assign({},r,{peerInfo:this.peerInfo})):e).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=>{this.peerInfo.multiaddrs.toArray().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){s([e=>{if(this._modules.peerDiscovery)return a(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._switch.stop(e),e=>{this.emit("stop"),e()}],t=>{this._isStarted=!1,e(t)})}isStarted(){return this._isStarted}dial(e,t){i(this.isStarted(),v),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){i(this.isStarted(),v),"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){i(this.isStarted(),v),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(v));this._getPeerInfo(e,(e,r)=>{if(e)return t(e);t(null,new f(this._switch,r))})}handle(e,t,r){this._switch.handle(e,t,r)}unhandle(e){this._switch.unhandle(e)}}},function(e,t,r){"use strict";const n=r(11).EventEmitter,i=r(50),o=r(49),s=r(1206),a=r(1210),u=r(576),c=r(1299),f=r(1300),l=r(575),h=r(1301),p=r(1302),d=r(17),y=r(1306);e.exports=class 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();return Object.keys(this.transports).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).id.toB58String();if(this.muxedConns[r]){const e=this.muxedConns[r].muxer;e.once("close",()=>{delete this.muxedConns[r],t()}),e.end()}else t()}hasTransports(){const e=Object.keys(this.transports).filter(e=>"Circuit"!==e);return e&&e.length>0}},e.exports.errors=y},function(e,t,r){"use strict";const n=r(63),i=r(30),o=r(1)("libp2p:switch:transport"),s=r(1207),a=8,u=3e4;class c{constructor(e){this.switch=e,this.dialer=new s(a,u)}add(e,t){if(o("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=c.dialables(n,i),o("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=c.dialables(a,this.switch._peerInfo.multiaddrs.distinct());a.listeners||(a.listeners=[]);let f=[];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);f=f.concat(t),a.listeners.push(o),n()})})});n(l,e=>{if(e)return o(e);this.switch._peerInfo.multiaddrs.replace(u,f),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=c},function(e,t,r){"use strict";const n=r(80),i=r(1),o=r(30),s=i("libp2p:swarm:dialer"),a=r(1208);e.exports=class{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)}}},function(e,t,r){"use strict";const n=r(47).Connection,i=r(8),o=r(1209),s=r(162),a=r(1)("libp2p:swarm:dialer:queue");e.exports=class{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){a("work"),this._dialWithTimeout(e,t,(e,s)=>e?(a("work:error"),o(null,{error:e})):r.cancel?(a("work:cancel"),i(i.empty(),s),o(null,{cancel:!0})):(r.cancel=!0,a("work:success"),(new n).setInnerConn(s),void 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)}}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e,t,r){var o=(0,i.default)(e);return(0,n.default)(function(n,i){var s,a=!1;n.push(function(){a||(i.apply(null,arguments),clearTimeout(s))}),s=setTimeout(function(){var t=e.name||"anonymous",n=new Error('Callback function "'+t+'" timed out.');n.code="ETIMEDOUT",r&&(n.info=r),a=!0,i(n)},t),o.apply(null,n)})};var n=o(r(353)),i=o(r(36));function o(e){return e&&e.__esModule?e:{default:e}}e.exports=t.default},function(e,t,r){"use strict";const n=r(1211),i=r(304),o=r(4),s=r(1)("libp2p:switch:connection"),a=r(30),u=r(3),c=r(565),f=r(575);e.exports=class{constructor(e){this.switch=e}addStreamMuxer(e){this.switch.muxers[e.multicodec]=e,this.switch.handle(e.multicodec,(t,r)=>{const c=e.listener(r);return c.on("stream",this.switch.protocolMuxer(null)),this.switch.identify&&r.getPeerInfo((e,t)=>{!e&&t||s("crypto peerInfo wasnt found"),r.getPeerInfo=(e=>{const r=c.newStream(),s=new i.Dialer;e=a(e),o([e=>s.handle(r,e),e=>s.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 c.end(()=>{n&&u(()=>this.switch.emit("peer-mux-closed",n)),e(t,null)});n&&r.setPeerInfo(n),e(t,n)})}),r.getPeerInfo((e,t)=>{if(e)return s("identify not successful");const r=t.id.toB58String();this.switch.muxedConns[r]={muxer:c},t.multiaddrs.size>0?t.connect(t.multiaddrs.toArray()[0]):t.connect(`/ipfs/${r}`),t=this.switch._peerBook.put(t),c.on("close",()=>{delete this.switch.muxedConns[r],t.disconnect(),t=this.switch._peerBook.put(t),s(`closed connection to ${r}`),u(()=>this.switch.emit("peer-mux-closed",t))}),u(()=>this.switch.emit("peer-mux-established",t))})}),r})}crypto(e,t){e||t||(e=f.tag,t=f.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||{}).enabled&&(e.hop||Object.assign(e,{hop:{enabled:!1,active:!1}}),this.switch.transport.add(c.tag,new c(this.switch,e)))}reuse(){this.switch.identify=!0,this.switch.handle(n.multicodec,(e,t)=>{n.listener(t,this.switch._peerInfo)})}}},function(e,t,r){"use strict";(t=e.exports).multicodec="/ipfs/id/1.0.0",t.listener=r(1212),t.dialer=r(1213),t.message=r(300)},function(e,t,r){"use strict";(function(t){const n=r(8),i=r(52),o=r(300);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(51),i=r(1214),o=r(60),s=r(8),a=r(52),u=r(300);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=function(e){if(!function(e){return e.observedAddr&&e.observedAddr.length>0}(e))return[];let t=e.observedAddr;return Array.isArray(t)||(t=[t]),t.map(e=>o(e))}(a)}catch(e){return r(e)}r(null,s,u)})}))})},function(e,t,r){"use strict";(function(n){const i=r(12),o=r(1215),s=r(17),a=r(4);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).create=function(e,t){"function"==typeof e&&(t=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(554),i=r(1217),o=r(1219);(t=e.exports).aes=i,t.hmac=n,t.keys=o,t.randomBytes=r(559),t.pbkdf2=r(1230)},function(e,t,r){"use strict";e.exports={SHA1:20,SHA256:32,SHA512:64}},function(e,t,r){"use strict";const n=r(1218),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);r(null,{encrypt(e,t){t(null,s.update(e))},decrypt(e,t){t(null,a.update(e))}})}},function(e,t,r){"use strict";const n=r(57);e.exports={createCipheriv:n.createCipheriv,createDecipheriv:n.createDecipheriv}},function(e,t,r){"use strict";(function(n){const i=r(10)(r(303)),o=r(16);t=e.exports;const s={rsa:r(1220),ed25519:r(1225),secp256k1:r(59)(i,r(559))};function a(e){return void 0!==s[e.toLowerCase()]}t.supportedKeys=s,t.keysPBM=i,t.keyStretcher=r(1227),t.generateEphemeralKeyPair=r(1228),t.generateKeyPair=((e,t,r)=>{let n=s[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=s[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=i.PublicKey.decode(e),r=t.Data;switch(t.Type){case i.KeyType.RSA:return s.rsa.unmarshalRsaPublicKey(r);case i.KeyType.Ed25519:return s.ed25519.unmarshalEd25519PublicKey(r);case i.KeyType.Secp256k1:if(s.secp256k1)return s.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(!a(t=(t||"rsa").toLowerCase()))throw new Error("invalid or unsupported key type");return e.bytes}),t.unmarshalPrivateKey=((e,t)=>{let r;try{r=i.PrivateKey.decode(e)}catch(e){return t(e)}const n=r.Data;switch(r.Type){case i.KeyType.RSA:return s.rsa.unmarshalRsaPrivateKey(n,t);case i.KeyType.Ed25519:return s.ed25519.unmarshalEd25519PrivateKey(n,t);case i.KeyType.Secp256k1:return s.secp256k1?s.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(!a(t=(t||"rsa").toLowerCase()))throw new Error("invalid or unsupported key type");return e.bytes}),t.import=((e,t,r)=>{try{const i=o.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 a=o.asn1.toDer(o.pki.privateKeyToAsn1(i));return a=n.from(a.getBytes(),"binary"),s.rsa.unmarshalRsaPrivateKey(a,r)}catch(e){r(e)}})}).call(this,r(0).Buffer)},function(e,t,r){"use strict";const n=r(555),i=r(10),o=r(14),s=r(557),a=i(r(303)),u=r(16),c=r(3);class f{constructor(e){this._key=e}verify(e,t,r){h(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){h(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){h(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){h(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"),h(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){if("function"!=typeof e)throw new Error("callback is required")}e.exports={RsaPublicKey:f,RsaPrivateKey:l,unmarshalRsaPublicKey:function(e){const t=s.utils.pkixToJwk(e);return new f(t)},unmarshalRsaPrivateKey:function(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))})},generateKeyPair:function(e,t){s.generateKey(e,(e,r)=>{if(e)return t(e);t(null,new l(r.privateKey,r.publicKey))})},fromJwk:function(e,t){s.unmarshalPrivateKey(e,(e,r)=>{if(e)return t(e);t(null,new l(r.privateKey,r.publicKey))})}}},function(e,t,r){"use strict";(function(t){const n=r(38),i=r(39),o=r(556),s=r(1222),a=o.toCallback,u=o.toBuf,c=o.fromString,f=o.fromNumberTo32BitBuf;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(1223),dblSha2256:(e,r)=>{s.sha2256(e,(e,n)=>{e&&r(e),s.sha2256(t.from(n),r)})}}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(t){const n=r(40),i=self.crypto?self.crypto.subtle||self.crypto.webkitSubtle:self.msCrypto?self.msCrypto.subtle:void 0;function o(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)}}e.exports={sha1:function(e,t){o("SHA-1")(e,t)},sha2256:function(e,t){o("SHA-256")(e,t)},sha2512:function(e,t){o("SHA-512")(e,t)}}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(t){const n=r(41),i=r(556).toCallback,o={init:n.blake2bInit,update:n.blake2bUpdate,digest:n.blake2bFinal},s={init:n.blake2sInit,update:n.blake2sUpdate,digest:n.blake2sFinal},a=(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[45569+t]=a(t+1,o);for(let t=0;t<32;t++)e[45633+t]=a(t+1,s)})}).call(this,r(0).Buffer)},function(e,t,r){"use strict";const n=r(15),i=r(558),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(555),i=r(10),o=r(14),s=r(1226),a=i(r(303));class u{constructor(e){this._key=l(e,s.publicKeyLength)}verify(e,t,r){f(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){f(e),n(this.bytes,"sha2-256",e)}}class c{constructor(e,t){this._key=l(e,s.privateKeyLength),this._publicKey=l(t,s.publicKeyLength)}sign(e,t){f(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){f(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){if("function"!=typeof e)throw new Error("callback is required")}function l(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:function(e,t){try{e=l(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))},unmarshalEd25519PublicKey:function(e){return e=l(e,s.publicKeyLength),new u(e)},generateKeyPair:function(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)})},generateKeyPairFromSeed:function(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)})}}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(e){const n=r(58),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(37),i=r(554),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=t.from("key expansion"),h=2*(f+c+20);i.create(r,s,(e,r)=>{if(e)return a(e);r.digest(l,(e,i)=>{if(e)return a(e);let o=[],s=0;n(()=>s<h,function(e){r.digest(t.concat([i,l]),(t,n)=>{if(t)return e(t);let a=n.length;s+a>h&&(a=h-s),o.push(n),s+=a,r.digest(i,(t,r)=>{if(t)return e(t);i=r,e()})})},function(e){if(e)return a(e);const r=h/2,n=t.concat(o),i=n.slice(0,r),s=n.slice(r,h),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)})})})})})}).call(this,r(0).Buffer)},function(e,t,r){"use strict";const n=r(1229);e.exports=((e,t)=>{n.generateEphmeralKeyPair(e,t)})},function(e,t,r){"use strict";(function(e){const n=r(302)(),i=r(301),o=r(15).bignum,s=r(558),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(16),i={sha1:"sha1","sha2-256":"sha256","sha2-512":"sha512"};e.exports=function(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)}},function(e,t,r){"use strict";const n=r(8),i=r(560),o=r(17),s=r(561),a=r(1232),u=r(1234),c=r(563),f=r(195),l=r(47).Connection,h=r(564).PROTOCOL_ID;e.exports=class{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}}}},function(e,t,r){"use strict";(function(t){const n=r(100),i=r(52),o=r(47).Connection,s=r(195).writeEncoded,a=r(1233);function u(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=function(e,r,a){const c=e=>{a.error(e)},f=n({timeout:6e4},c),l=f.handshake;return function n(){i.decodeFromReader(l,(i,f)=>{if(i)return c(i);a("received:",f.toString());const h=f.toString().slice(0,-1);u(h,r,(i,u)=>{if(i)return c(i);const p=u;if(p){a("send ack back of: "+h),s(l,f,c);const t=new o(l.rest(),e);r[p].handlerFunc(h,t)}else a("not supported protocol: "+h),s(l,t.from("na\n")),n()})})}(),f}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=s(r(562)),i=s(r(164)),o=s(r(305));function s(e){return e&&e.__esModule?e:{default:e}}t.default=(0,i.default)((0,n.default)(Boolean,o.default)),e.exports=t.default},function(e,t,r){"use strict";(function(t){const n=r(8),i=r(52),o=r(20);e.exports=function(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");return e+o.encodingLength(n.length)},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)}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";const n=r(20),i=r(8),o=r(52),s=r(47).Connection,a=r(195),u=r(561),c=r(30),f=r(564).PROTOCOL_ID;function l(e){return e.toString().slice(0,-1)}e.exports=class{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);i(e,r,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(),function(e){let t=0;return i.take(e=>(n.decode(e),t=n.decode(e,n.decode.bytes),!0))}(),i.map(l),i.collect((t,r)=>{if(t)return e(t);e(null,r.slice(1))}))},this.log);i(this.conn,t,this.conn)}}},function(e,t,r){"use strict";const n=r(1237);e.exports=function(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);r(null,n.satisfies(a,"~"+c))}},function(e,t,r){(function(r){var n;t=e.exports=$,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=t.re=[],a=t.src=[],u=0,c=u++;a[c]="0|[1-9]\\d*";var f=u++;a[f]="[0-9]+";var l=u++;a[l]="\\d*[a-zA-Z-][a-zA-Z0-9-]*";var h=u++;a[h]="("+a[c]+")\\.("+a[c]+")\\.("+a[c]+")";var p=u++;a[p]="("+a[f]+")\\.("+a[f]+")\\.("+a[f]+")";var d=u++;a[d]="(?:"+a[c]+"|"+a[l]+")";var y=u++;a[y]="(?:"+a[f]+"|"+a[l]+")";var g=u++;a[g]="(?:-("+a[d]+"(?:\\."+a[d]+")*))";var m=u++;a[m]="(?:-?("+a[y]+"(?:\\."+a[y]+")*))";var b=u++;a[b]="[0-9A-Za-z-]+";var v=u++;a[v]="(?:\\+("+a[b]+"(?:\\."+a[b]+")*))";var _=u++,w="v?"+a[h]+a[g]+"?"+a[v]+"?";a[_]="^"+w+"$";var S="[v=\\s]*"+a[p]+a[m]+"?"+a[v]+"?",k=u++;a[k]="^"+S+"$";var E=u++;a[E]="((?:<|>)?=?)";var A=u++;a[A]=a[f]+"|x|X|\\*";var x=u++;a[x]=a[c]+"|x|X|\\*";var I=u++;a[I]="[v=\\s]*("+a[x]+")(?:\\.("+a[x]+")(?:\\.("+a[x]+")(?:"+a[g]+")?"+a[v]+"?)?)?";var T=u++;a[T]="[v=\\s]*("+a[A]+")(?:\\.("+a[A]+")(?:\\.("+a[A]+")(?:"+a[m]+")?"+a[v]+"?)?)?";var B=u++;a[B]="^"+a[E]+"\\s*"+a[I]+"$";var C=u++;a[C]="^"+a[E]+"\\s*"+a[T]+"$";var P=u++;a[P]="(?:^|[^\\d])(\\d{1,16})(?:\\.(\\d{1,16}))?(?:\\.(\\d{1,16}))?(?:$|[^\\d])";var O=u++;a[O]="(?:~>?)";var R=u++;a[R]="(\\s*)"+a[O]+"\\s+",s[R]=new RegExp(a[R],"g");var N=u++;a[N]="^"+a[O]+a[I]+"$";var L=u++;a[L]="^"+a[O]+a[T]+"$";var K=u++;a[K]="(?:\\^)";var j=u++;a[j]="(\\s*)"+a[K]+"\\s+",s[j]=new RegExp(a[j],"g");var M=u++;a[M]="^"+a[K]+a[I]+"$";var D=u++;a[D]="^"+a[K]+a[T]+"$";var U=u++;a[U]="^"+a[E]+"\\s*("+S+")$|^$";var F=u++;a[F]="^"+a[E]+"\\s*("+w+")$|^$";var q=u++;a[q]="(\\s*)"+a[E]+"\\s*("+S+"|"+a[I]+")",s[q]=new RegExp(a[q],"g");var H=u++;a[H]="^\\s*("+a[I]+")\\s+-\\s+("+a[I]+")\\s*$";var z=u++;a[z]="^\\s*("+a[T]+")\\s+-\\s+("+a[T]+")\\s*$";var V=u++;a[V]="(<|>)?=?\\s*\\*";for(var G=0;G<u;G++)n(G,a[G]),s[G]||(s[G]=new RegExp(a[G]));function W(e,t){if(e instanceof $)return e;if("string"!=typeof e)return null;if(e.length>i)return null;if(!(t?s[k]:s[_]).test(e))return null;try{return new $(e,t)}catch(e){return null}}function $(e,t){if(e instanceof $){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 $))return new $(e,t);n("SemVer",e,t),this.loose=t;var r=e.trim().match(t?s[k]:s[_]);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()}t.parse=W,t.valid=function(e,t){var r=W(e,t);return r?r.version:null},t.clean=function(e,t){var r=W(e.trim().replace(/^[=v]+/,""),t);return r?r.version:null},t.SemVer=$,$.prototype.format=function(){return this.version=this.major+"."+this.minor+"."+this.patch,this.prerelease.length&&(this.version+="-"+this.prerelease.join(".")),this.version},$.prototype.toString=function(){return this.version},$.prototype.compare=function(e){return n("SemVer.compare",this.version,this.loose,e),e instanceof $||(e=new $(e,this.loose)),this.compareMain(e)||this.comparePre(e)},$.prototype.compareMain=function(e){return e instanceof $||(e=new $(e,this.loose)),J(this.major,e.major)||J(this.minor,e.minor)||J(this.patch,e.patch)},$.prototype.comparePre=function(e){if(e instanceof $||(e=new $(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 J(r,i)}while(++t)},$.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=function(e,t,r,n){"string"==typeof r&&(n=r,r=void 0);try{return new $(e,r).inc(t,n).version}catch(e){return null}},t.diff=function(e,t){if(ee(e,t))return null;var r=W(e),n=W(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.compareIdentifiers=J;var Y=/^[0-9]+$/;function J(e,t){var r=Y.test(e),n=Y.test(t);return r&&n&&(e=+e,t=+t),r&&!n?-1:n&&!r?1:e<t?-1:e>t?1:0}function X(e,t,r){return new $(e,r).compare(new $(t,r))}function Z(e,t,r){return X(e,t,r)>0}function Q(e,t,r){return X(e,t,r)<0}function ee(e,t,r){return 0===X(e,t,r)}function te(e,t,r){return 0!==X(e,t,r)}function re(e,t,r){return X(e,t,r)>=0}function ne(e,t,r){return X(e,t,r)<=0}function ie(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=ee(e,r,n);break;case"!=":i=te(e,r,n);break;case">":i=Z(e,r,n);break;case">=":i=re(e,r,n);break;case"<":i=Q(e,r,n);break;case"<=":i=ne(e,r,n);break;default:throw new TypeError("Invalid operator: "+t)}return i}function oe(e,t){if(e instanceof oe){if(e.loose===t)return e;e=e.value}if(!(this instanceof oe))return new oe(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=function(e,t){return J(t,e)},t.major=function(e,t){return new $(e,t).major},t.minor=function(e,t){return new $(e,t).minor},t.patch=function(e,t){return new $(e,t).patch},t.compare=X,t.compareLoose=function(e,t){return X(e,t,!0)},t.rcompare=function(e,t,r){return X(t,e,r)},t.sort=function(e,r){return e.sort(function(e,n){return t.compare(e,n,r)})},t.rsort=function(e,r){return e.sort(function(e,n){return t.rcompare(e,n,r)})},t.gt=Z,t.lt=Q,t.eq=ee,t.neq=te,t.gte=re,t.lte=ne,t.cmp=ie,t.Comparator=oe;var se={};function ae(e,t){if(e instanceof ae)return e.loose===t?e:new ae(e.raw,t);if(e instanceof oe)return new ae(e.value,t);if(!(this instanceof ae))return new ae(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 ue(e,t){return n("comp",e),e=function(e,t){return e.trim().split(/\s+/).map(function(e){return function(e,t){n("caret",e,t);var r=t?s[D]:s[M];return e.replace(r,function(t,r,i,o,s){var a;return n("caret",e,t,r,i,o,s),ce(r)?a="":ce(i)?a=">="+r+".0.0 <"+(+r+1)+".0.0":ce(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})}(e,t)}).join(" ")}(e,t),n("caret",e),e=function(e,t){return e.trim().split(/\s+/).map(function(e){return function(e,t){var r=t?s[L]:s[N];return e.replace(r,function(t,r,i,o,s){var a;return n("tilde",e,t,r,i,o,s),ce(r)?a="":ce(i)?a=">="+r+".0.0 <"+(+r+1)+".0.0":ce(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})}(e,t)}).join(" ")}(e,t),n("tildes",e),e=function(e,t){return n("replaceXRanges",e,t),e.split(/\s+/).map(function(e){return function(e,t){e=e.trim();var r=t?s[C]:s[B];return e.replace(r,function(t,r,i,o,s,a){n("xRange",e,t,r,i,o,s,a);var u=ce(i),c=u||ce(o),f=c||ce(s);return"="===r&&f&&(r=""),u?t=">"===r||"<"===r?"<0.0.0":"*":r&&f?(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})}(e,t)}).join(" ")}(e,t),n("xrange",e),e=function(e,t){return n("replaceStars",e,t),e.trim().replace(s[V],"")}(e,t),n("stars",e),e}function ce(e){return!e||"x"===e.toLowerCase()||"*"===e}function fe(e,t,r,n,i,o,s,a,u,c,f,l,h){return((t=ce(r)?"":ce(n)?">="+r+".0.0":ce(i)?">="+r+"."+n+".0":">="+t)+" "+(a=ce(u)?"":ce(c)?"<"+(+u+1)+".0.0":ce(f)?"<"+u+"."+(+c+1)+".0":l?"<="+u+"."+c+"."+f+"-"+l:"<="+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(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 he(e,t,r){try{t=new ae(t,r)}catch(e){return!1}return t.test(e)}function pe(e,t,r,n){var i,o,s,a,u;switch(e=new $(e,n),t=new ae(t,n),r){case">":i=Z,o=ne,s=Q,a=">",u=">=";break;case"<":i=Q,o=re,s=Z,a="<",u="<=";break;default:throw new TypeError('Must provide a hilo val of "<" or ">"')}if(he(e,t,n))return!1;for(var c=0;c<t.set.length;++c){var f=null,l=null;if(t.set[c].forEach(function(e){e.semver===se&&(e=new oe(">=0.0.0")),f=f||e,l=l||e,i(e.semver,f.semver,n)?f=e:s(e.semver,l.semver,n)&&(l=e)}),f.operator===a||f.operator===u)return!1;if((!l.operator||l.operator===a)&&o(e,l.semver))return!1;if(l.operator===u&&s(e,l.semver))return!1}return!0}oe.prototype.parse=function(e){var t=this.loose?s[U]:s[F],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 $(r[2],this.loose):this.semver=se},oe.prototype.toString=function(){return this.value},oe.prototype.test=function(e){return n("Comparator.test",e,this.loose),this.semver===se||("string"==typeof e&&(e=new $(e,this.loose)),ie(e,this.operator,this.semver,this.loose))},oe.prototype.intersects=function(e,t){if(!(e instanceof oe))throw new TypeError("a Comparator is required");var r;if(""===this.operator)return r=new ae(e.value,t),he(this.value,r,t);if(""===e.operator)return r=new ae(this.value,t),he(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=ie(this.semver,"<",e.semver,t)&&(">="===this.operator||">"===this.operator)&&("<="===e.operator||"<"===e.operator),u=ie(this.semver,">",e.semver,t)&&("<="===this.operator||"<"===this.operator)&&(">="===e.operator||">"===e.operator);return n||i||o&&s||a||u},t.Range=ae,ae.prototype.format=function(){return this.range=this.set.map(function(e){return e.join(" ").trim()}).join("||").trim(),this.range},ae.prototype.toString=function(){return this.range},ae.prototype.parseRange=function(e){var t=this.loose;e=e.trim(),n("range",e,t);var r=t?s[z]:s[H];e=e.replace(r,fe),n("hyphen replace",e),e=e.replace(s[q],"$1$2$3"),n("comparator trim",e,s[q]),e=(e=(e=e.replace(s[R],"$1~")).replace(s[j],"$1^")).split(/\s+/).join(" ");var i=t?s[U]:s[F],o=e.split(" ").map(function(e){return ue(e,t)}).join(" ").split(/\s+/);return this.loose&&(o=o.filter(function(e){return!!e.match(i)})),o.map(function(e){return new oe(e,t)})},ae.prototype.intersects=function(e,t){if(!(e instanceof ae))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=function(e,t){return new ae(e,t).set.map(function(e){return e.map(function(e){return e.value}).join(" ").trim().split(" ")})},ae.prototype.test=function(e){if(!e)return!1;"string"==typeof e&&(e=new $(e,this.loose));for(var t=0;t<this.set.length;t++)if(le(this.set[t],e))return!0;return!1},t.satisfies=he,t.maxSatisfying=function(e,t,r){var n=null,i=null;try{var o=new ae(t,r)}catch(e){return null}return e.forEach(function(e){o.test(e)&&(n&&-1!==i.compare(e)||(i=new $(n=e,r)))}),n},t.minSatisfying=function(e,t,r){var n=null,i=null;try{var o=new ae(t,r)}catch(e){return null}return e.forEach(function(e){o.test(e)&&(n&&1!==i.compare(e)||(i=new $(n=e,r)))}),n},t.validRange=function(e,t){try{return new ae(e,t).range||"*"}catch(e){return null}},t.ltr=function(e,t,r){return pe(e,t,"<",r)},t.gtr=function(e,t,r){return pe(e,t,">",r)},t.outside=pe,t.prerelease=function(e,t){var r=W(e,t);return r&&r.prerelease.length?r.prerelease:null},t.intersects=function(e,t,r){return e=new ae(e,r),t=new ae(t,r),e.intersects(t)},t.coerce=function(e){if(e instanceof $)return e;if("string"!=typeof e)return null;var t=e.match(s[P]);return null==t?null:W((t[1]||"0")+"."+(t[2]||"0")+"."+(t[3]||"0"))}}).call(this,r(7))},function(e,t,r){"use strict";const n=r(78),i=r(142),o=r(1241),s=r(143),a=r(1);a("libp2p:circuit:transportdialer").err=a("libp2p:circuit:error:transportdialer");const u=r(1259);e.exports=class{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=>{e.toString().split("/p2p-circuit").filter(e=>e.length).forEach(e=>{this.dialer._dialRelay(this.utils.peerInfoFromMa(i(e)))})})}dial(e,t,r){return this.dialer.dial(e,t,r)}createListener(e,t){"function"==typeof e&&(t=e,e=this.options||{});const r=u(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))}}},function(e,t,r){"use strict";(function(t){const n=r(44),i=r(136),o=r(1240),s=r(306),a=r(20);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];if(0!==s(i).size){if(++n>=r.length)throw v("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=_(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=_(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=_(e);return e.length>1?[t.code,o.toString(t.code,e[1])]:[t.code]})}function h(e){return g(t.concat(n(e,function(e){const r=_(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;return a.decode(t)+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=p(s(n),e.slice(r+i));if(0===o){t.push([n]),r+=i;continue}const u=e.slice(r+i,r+i+o);if((r+=o+i)>e.length)throw v("Invalid address buffer: "+e.toString("hex"));t.push([n,u])}return t}function y(e){return h(f(u(e=b(e))))}function g(e){const r=m(e);if(r)throw r;return t.from(e)}function m(e){try{d(e)}catch(e){return e}}function b(e){return"/"+i(e.trim().split("/")).join("/")}function v(e){return new Error("Error parsing address: "+e)}function _(e){return s(e[0])}e.exports={stringToStringTuples:u,stringTuplesToString:c,tuplesToStringTuples:l,stringTuplesToTuples:f,bufferToTuples:d,tuplesToBuffer:h,bufferToString:function(e){return c(l(d(e)))},stringToBuffer:y,fromString:function(e){return y(e)},fromBuffer:g,validateBuffer:m,isValidBuffer:function(e){return void 0===m(e)},cleanPath:b,ParseError:v,protoFromTuple:_,sizeForAddr:p}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(t){const n=r(137),i=r(138),o=r(306),s=r(14),a=r(20);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)}e.exports=u,u.toString=function(e,t){switch((e=o(e)).code){case 4:case 41:return n.toString(t);case 6:case 17:case 33:case 132:return function(e){return e.readUInt16BE(0)}(t);case 54:case 55:case 56:return function(e){const t=a.decode(e);if((e=e.slice(a.decode.bytes)).length!==t)throw new Error("inconsistent lengths");return e.toString()}(t);case 421:return function(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)}(t);default:return t.toString("hex")}},u.toBuffer=function(e,r){switch((e=o(e)).code){case 4:return c(new i.Address4(r));case 41:return c(new i.Address6(r));case 6:case 17:case 33:case 132:return function(e){const r=t.alloc(2);return r.writeUInt16BE(e,0),r}(parseInt(r,10));case 54:case 55:case 56:return function(e){const r=t.from(e),n=t.from(a.encode(r.length));return t.concat([n,r])}(r);case 421:return function(e){const r=t.from(s.decode(e)),n=t.from(a.encode(r.length));return t.concat([n,r])}(r);default:return t.from(r,"hex")}}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";const n=r(47).Connection,i=r(560),o=r(142),s=r(30),a=r(4),u=r(143),c=r(310),f=r(196),l=r(1),h=l("libp2p:circuit:dialer");h.err=l("libp2p:circuit:error:dialer");const p=r(311),d=r(144);e.exports=class{constructor(e,t){this.swarm=e,this.relayPeers=new Map,this.options=t,this.utils=u(e)}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 i=r.split("p2p-circuit"),s="/"===i[0]?null:o(i[0]),a=o(i[1]||i[0]),u=new n;return setImmediate(this._dialPeer.bind(this),a,s,(e,r)=>{if(e)return h.err(e),t(e);u.setInnerConn(r),t(null,u)}),u}canHop(e,t){if(t=s(t||(()=>{})),!this.relayPeers.get(this.utils.getB58String(e))){let r;a([t=>this._dialRelay(e,t),(e,t)=>{r=e,t()},e=>r.write(d.CircuitRelay.encode({type:d.CircuitRelay.Type.CAN_HOP}),e),e=>r.read(e),(t,r)=>{if(d.CircuitRelay.decode(t).code!==d.CircuitRelay.Status.SUCCESS)return h(`HOP not supported, skipping - ${this.utils.getB58String(e)}`);h(`HOP supported adding as relay - ${this.utils.getB58String(e)}`),this.relayPeers.set(this.utils.getB58String(e),e),r(null)}],t)}return t(null)}_dialPeer(e,t,r){if(i(t)&&(r=t,t=null),r||(r=(()=>{})),e=o(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=o(t);const i=this.swarm._peerInfo.multiaddrs.toArray();let s;a([t=>e instanceof n?t(null,new c(e)):this._dialRelay(this.utils.peerInfoFromMa(e),t),(e,t)=>{s=e,t(null)},e=>{h(`negotiating relay for peer ${t.getPeerId()}`),s.write(d.CircuitRelay.encode({type:d.CircuitRelay.Type.HOP,srcPeer:{id:this.swarm._peerInfo.id.id,addrs:i.map(e=>e.buffer)},dstPeer:{id:f.createFromB58String(t.getPeerId()).id,addrs:[t.buffer]}}),e)},e=>s.read(e),(e,t)=>{const r=d.CircuitRelay.decode(e);return r.type!==d.CircuitRelay.Type.STATUS?t(new Error("Got invalid message type - "+`expected ${d.CircuitRelay.Type.STATUS} got ${r.type}`)):r.code!==d.CircuitRelay.Status.SUCCESS?t(new Error(`Got ${r.code} error code trying to dial over relay`)):void t(null,new n(s.rest()))}],r)}_dialRelay(e,t){t=s(t||(()=>{})),this.swarm.dial(e,p.relay,s((e,r)=>{if(e)return h.err(e),t(e);t(null,new c(r))}))}}},function(e,t,r){"use strict";const n=r(566),i=r(1244),o=r(1246);(t=e.exports).aes=i,t.hmac=n,t.keys=o,t.randomBytes=r(571),t.pbkdf2=r(1257)},function(e,t,r){"use strict";e.exports={SHA1:20,SHA256:32,SHA512:64}},function(e,t,r){"use strict";const n=r(1245),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);r(null,{encrypt(e,t){t(null,s.update(e))},decrypt(e,t){t(null,a.update(e))}})}},function(e,t,r){"use strict";const n=r(57);e.exports={createCipheriv:n.createCipheriv,createDecipheriv:n.createDecipheriv}},function(e,t,r){"use strict";(function(n){const i=r(10)(r(309)),o=r(16);t=e.exports;const s={rsa:r(1247),ed25519:r(1252),secp256k1:r(59)(i,r(571))};function a(e){return void 0!==s[e.toLowerCase()]}t.supportedKeys=s,t.keysPBM=i,t.keyStretcher=r(1254),t.generateEphemeralKeyPair=r(1255),t.generateKeyPair=((e,t,r)=>{let n=s[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=s[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=i.PublicKey.decode(e),r=t.Data;switch(t.Type){case i.KeyType.RSA:return s.rsa.unmarshalRsaPublicKey(r);case i.KeyType.Ed25519:return s.ed25519.unmarshalEd25519PublicKey(r);case i.KeyType.Secp256k1:if(s.secp256k1)return s.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(!a(t=(t||"rsa").toLowerCase()))throw new Error("invalid or unsupported key type");return e.bytes}),t.unmarshalPrivateKey=((e,t)=>{let r;try{r=i.PrivateKey.decode(e)}catch(e){return t(e)}const n=r.Data;switch(r.Type){case i.KeyType.RSA:return s.rsa.unmarshalRsaPrivateKey(n,t);case i.KeyType.Ed25519:return s.ed25519.unmarshalEd25519PrivateKey(n,t);case i.KeyType.Secp256k1:return s.secp256k1?s.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(!a(t=(t||"rsa").toLowerCase()))throw new Error("invalid or unsupported key type");return e.bytes}),t.import=((e,t,r)=>{try{const i=o.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 a=o.asn1.toDer(o.pki.privateKeyToAsn1(i));return a=n.from(a.getBytes(),"binary"),s.rsa.unmarshalRsaPrivateKey(a,r)}catch(e){r(e)}})}).call(this,r(0).Buffer)},function(e,t,r){"use strict";const n=r(567),i=r(10),o=r(14),s=r(569),a=i(r(309)),u=r(16),c=r(3);class f{constructor(e){this._key=e}verify(e,t,r){h(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){h(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){h(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){h(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"),h(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){if("function"!=typeof e)throw new Error("callback is required")}e.exports={RsaPublicKey:f,RsaPrivateKey:l,unmarshalRsaPublicKey:function(e){const t=s.utils.pkixToJwk(e);return new f(t)},unmarshalRsaPrivateKey:function(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))})},generateKeyPair:function(e,t){s.generateKey(e,(e,r)=>{if(e)return t(e);t(null,new l(r.privateKey,r.publicKey))})},fromJwk:function(e,t){s.unmarshalPrivateKey(e,(e,r)=>{if(e)return t(e);t(null,new l(r.privateKey,r.publicKey))})}}},function(e,t,r){"use strict";(function(t){const n=r(38),i=r(39),o=r(568),s=r(1249),a=o.toCallback,u=o.toBuf,c=o.fromString,f=o.fromNumberTo32BitBuf;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(1250),dblSha2256:(e,r)=>{s.sha2256(e,(e,n)=>{e&&r(e),s.sha2256(t.from(n),r)})}}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(t){const n=r(40),i=self.crypto?self.crypto.subtle||self.crypto.webkitSubtle:self.msCrypto?self.msCrypto.subtle:void 0;function o(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)}}e.exports={sha1:function(e,t){o("SHA-1")(e,t)},sha2256:function(e,t){o("SHA-256")(e,t)},sha2512:function(e,t){o("SHA-512")(e,t)}}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(t){const n=r(41),i=r(568).toCallback,o={init:n.blake2bInit,update:n.blake2bUpdate,digest:n.blake2bFinal},s={init:n.blake2sInit,update:n.blake2sUpdate,digest:n.blake2sFinal},a=(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[45569+t]=a(t+1,o);for(let t=0;t<32;t++)e[45633+t]=a(t+1,s)})}).call(this,r(0).Buffer)},function(e,t,r){"use strict";const n=r(15),i=r(570),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(567),i=r(10),o=r(14),s=r(1253),a=i(r(309));class u{constructor(e){this._key=l(e,s.publicKeyLength)}verify(e,t,r){f(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){f(e),n(this.bytes,"sha2-256",e)}}class c{constructor(e,t){this._key=l(e,s.privateKeyLength),this._publicKey=l(t,s.publicKeyLength)}sign(e,t){f(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){f(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){if("function"!=typeof e)throw new Error("callback is required")}function l(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:function(e,t){try{e=l(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))},unmarshalEd25519PublicKey:function(e){return e=l(e,s.publicKeyLength),new u(e)},generateKeyPair:function(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)})},generateKeyPairFromSeed:function(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)})}}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(e){const n=r(58),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(37),i=r(566),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=t.from("key expansion"),h=2*(f+c+20);i.create(r,s,(e,r)=>{if(e)return a(e);r.digest(l,(e,i)=>{if(e)return a(e);let o=[],s=0;n(()=>s<h,function(e){r.digest(t.concat([i,l]),(t,n)=>{if(t)return e(t);let a=n.length;s+a>h&&(a=h-s),o.push(n),s+=a,r.digest(i,(t,r)=>{if(t)return e(t);i=r,e()})})},function(e){if(e)return a(e);const r=h/2,n=t.concat(o),i=n.slice(0,r),s=n.slice(r,h),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)})})})})})}).call(this,r(0).Buffer)},function(e,t,r){"use strict";const n=r(1256);e.exports=((e,t)=>{n.generateEphmeralKeyPair(e,t)})},function(e,t,r){"use strict";(function(e){const n=r(308)(),i=r(307),o=r(15).bignum,s=r(570),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(16),i={sha1:"sha1","sha2-256":"sha256","sha2-512":"sha512"};e.exports=function(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)}},function(e,t,r){"use strict";e.exports="\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";const n=r(3),i=r(311),o=r(11).EventEmitter,s=r(142),a=r(78),u=r(1260),c=r(1261),f=r(144),l=r(143),h=r(310),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.stop),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()}`;t.toString()!==r?a.Circuit.matches(t)?i.push(t.encapsulate(`/ipfs/${e._peerInfo.id.toB58String()}`)):t.getPeerId()?i.push(s("/p2p-circuit").encapsulate(t)):i.push(s("/p2p-circuit").encapsulate(`${t}/ipfs/${e._peerInfo.id.toB58String()}`)):i.push(s(r))}),t(null,i)}),p})},function(e,t,r){"use strict";const n=r(3),i=r(11).EventEmitter,o=r(47).Connection,s=r(143),a=r(51),u=r(196),c=r(144),f=r(49),l=r(1),h=l("libp2p:circuit:stop");h.err=l("libp2p:circuit:error:stop");function p(e){return"string"==typeof e?u.createFromB58String(e):u.createFromBytes(e)}e.exports=class extends i{constructor(e){super(),this.swarm=e,this.utils=s(e)}handle(e,t,r){r=r||(()=>{}),f([r=>this.utils.validateAddrs(e,t,c.CircuitRelay.Type.STOP,r),e=>this.utils.writeResponse(t,c.CircuitRelay.Status.Success,e)],i=>{if(i)return r(),h(i);const s=new a(p(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)})}}},function(e,t,r){"use strict";r(572),r(2);const n=r(8),i=r(1),o=r(51),s=r(196),a=r(11).EventEmitter,u=r(30),c=r(143),f=r(310),l=r(1262),h=r(144),p=r(142),d=r(311),y=i("libp2p:swarm:circuit:relay");y.err=i("libp2p:swarm:circuit:error:relay");e.exports=class extends a{constructor(e,t){super(),this.swarm=e,this.peerInfo=this.swarm._peerInfo,this.utils=c(e),this.config=l({active:!1,enabled:!1},t,(e,t)=>void 0!==t&&t),this.active=this.config.active}handle(e,t){if(!this.config.enabled)return this.utils.writeResponse(t,h.CircuitRelay.Status.HOP_CANT_SPEAK_RELAY);if(e.type===h.CircuitRelay.Type.CAN_HOP)return this.utils.writeResponse(t,h.CircuitRelay.Status.SUCCESS);if(s.createFromBytes(e.dstPeer.id).toB58String()===this.peerInfo.id.toB58String())return this.utils.writeResponse(t,h.CircuitRelay.Status.HOP_CANT_RELAY_TO_SELF);const r=s.createFromBytes(e.dstPeer.id).toB58String();if(!e.dstPeer.addrs.length){const t=p(`/p2p-circuit/ipfs/${r}`).buffer;e.dstPeer.addrs.push(t)}this.utils.validateAddrs(e,t,h.CircuitRelay.Type.HOP,n=>{if(n)return y(n);let i;try{if(!(i=this.swarm._peerBook.get(r)).isConnected()&&!this.active)throw new Error("No Connection to peer")}catch(n){if(!this.active)return y.err(n),setImmediate(()=>this.emit("circuit:error",n)),this.utils.writeResponse(t,h.CircuitRelay.Status.HOP_NO_CONN_TO_DST)}return this._circuit(t.rest(),e,e=>{e&&(y.err(e),setImmediate(()=>this.emit("circuit:error",e))),setImmediate(()=>this.emit("circuit:success"))})})}_circuit(e,t,r){this._dialPeer(t.dstPeer,(i,o)=>{const s=new f(e);return i?(this.utils.writeResponse(s,h.CircuitRelay.Status.HOP_CANT_DIAL_DST),n(n.empty(),s.rest()),y.err(i),r(i)):this.utils.writeResponse(s,h.CircuitRelay.Status.SUCCESS,i=>{if(i)return y.err(i),r(i);const a=new f(o),u=Object.assign({},t,{type:h.CircuitRelay.Type.STOP});a.write(h.CircuitRelay.encode(u),t=>{if(t){const i=new f(e);return this.utils.writeResponse(i,h.CircuitRelay.Status.HOP_CANT_OPEN_DST_STREAM),n(n.empty(),i.rest()),y.err(t),r(t)}a.read((e,t)=>{if(e)return y.err(e),r(e);const i=h.CircuitRelay.decode(t),o=s.rest();i.code===h.CircuitRelay.Status.SUCCESS?(n(o,a.rest(),o),r()):n(n.empty(),o)})})})})}_dialPeer(e,t){const r=new o(s.createFromBytes(e.id));e.addrs.forEach(e=>r.multiaddrs.add(e)),this.swarm.dial(r,d.relay,u((e,r)=>{if(e)return y.err(e),t(e);t(null,r)}))}}},function(e,t,r){var n=r(1263),i=r(1270),o=r(1279),s=i(function(e,t,r,i){n(t,o(t),e,i)});e.exports=s},function(e,t,r){var n=r(1264),i=r(573);e.exports=function(e,t,r,o){var s=!r;r||(r={});for(var a=-1,u=t.length;++a<u;){var c=t[a],f=o?o(r[c],e[c],c,r,e):void 0;void 0===f&&(f=e[c]),s?i(r,c,f):n(r,c,f)}return r}},function(e,t,r){var n=r(573),i=r(313),o=Object.prototype.hasOwnProperty;e.exports=function(e,t,r){var s=e[t];o.call(e,t)&&i(s,r)&&(void 0!==r||t in e)||n(e,t,r)}},function(e,t,r){var n=r(214),i=r(1266),o=r(121),s=r(1268),a=/^\[object .+?Constructor\]$/,u=Function.prototype,c=Object.prototype,f=u.toString,l=c.hasOwnProperty,h=RegExp("^"+f.call(l).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");e.exports=function(e){return!(!o(e)||i(e))&&(n(e)?h:a).test(s(e))}},function(e,t,r){var n,i=r(1267),o=(n=/[^.]+$/.exec(i&&i.keys&&i.keys.IE_PROTO||""))?"Symbol(src)_1."+n:"";e.exports=function(e){return!!o&&o in e}},function(e,t,r){var n=r(159)["__core-js_shared__"];e.exports=n},function(e,t){var r=Function.prototype.toString;e.exports=function(e){if(null!=e){try{return r.call(e)}catch(e){}try{return e+""}catch(e){}}return""}},function(e,t){e.exports=function(e,t){return null==e?void 0:e[t]}},function(e,t,r){var n=r(1271),i=r(1278);e.exports=function(e){return n(function(t,r){var n=-1,o=r.length,s=o>1?r[o-1]:void 0,a=o>2?r[2]:void 0;for(s=e.length>3&&"function"==typeof s?(o--,s):void 0,a&&i(r[0],r[1],a)&&(s=o<3?void 0:s,o=1),t=Object(t);++n<o;){var u=r[n];u&&e(t,u,n,s)}return t})}},function(e,t,r){var n=r(305),i=r(1272),o=r(1274);e.exports=function(e,t){return o(i(e,t,n),e+"")}},function(e,t,r){var n=r(1273),i=Math.max;e.exports=function(e,t,r){return t=i(void 0===t?e.length-1:t,0),function(){for(var o=arguments,s=-1,a=i(o.length-t,0),u=Array(a);++s<a;)u[s]=o[t+s];s=-1;for(var c=Array(t+1);++s<t;)c[s]=o[s];return c[t]=r(u),n(e,this,c)}}},function(e,t){e.exports=function(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(e,t,r){var n=r(1275),i=r(1277)(n);e.exports=i},function(e,t,r){var n=r(1276),i=r(574),o=r(305),s=i?function(e,t){return i(e,"toString",{configurable:!0,enumerable:!1,value:n(t),writable:!0})}:o;e.exports=s},function(e,t){e.exports=function(e){return function(){return e}}},function(e,t){var r=800,n=16,i=Date.now;e.exports=function(e){var t=0,o=0;return function(){var s=i(),a=n-(s-o);if(o=s,a>0){if(++t>=r)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}},function(e,t,r){var n=r(313),i=r(89),o=r(362),s=r(121);e.exports=function(e,t,r){if(!s(r))return!1;var a=typeof t;return!!("number"==a?i(r)&&o(t,r.length):"string"==a&&t in r)&&n(r[t],e)}},function(e,t,r){var n=r(360),i=r(1280),o=r(89);e.exports=function(e){return o(e)?n(e,!0):i(e)}},function(e,t,r){var n=r(121),i=r(363),o=r(1281),s=Object.prototype.hasOwnProperty;e.exports=function(e){if(!n(e))return o(e);var t=i(e),r=[];for(var a in e)("constructor"!=a||!t&&s.call(e,a))&&r.push(a);return r}},function(e,t){e.exports=function(e){var t=[];if(null!=e)for(var r in Object(e))t.push(r);return t}},function(e,t,r){"use strict";(function(n){const i=r(12),o=r(1283),s=r(17),a=r(4);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).create=function(e,t){"function"==typeof e&&(t=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(577),i=r(1285),o=r(1287);(t=e.exports).aes=i,t.hmac=n,t.keys=o,t.randomBytes=r(582),t.pbkdf2=r(1298)},function(e,t,r){"use strict";e.exports={SHA1:20,SHA256:32,SHA512:64}},function(e,t,r){"use strict";const n=r(1286),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);r(null,{encrypt(e,t){t(null,s.update(e))},decrypt(e,t){t(null,a.update(e))}})}},function(e,t,r){"use strict";const n=r(57);e.exports={createCipheriv:n.createCipheriv,createDecipheriv:n.createDecipheriv}},function(e,t,r){"use strict";(function(n){const i=r(10)(r(316)),o=r(16);t=e.exports;const s={rsa:r(1288),ed25519:r(1293),secp256k1:r(59)(i,r(582))};function a(e){return void 0!==s[e.toLowerCase()]}t.supportedKeys=s,t.keysPBM=i,t.keyStretcher=r(1295),t.generateEphemeralKeyPair=r(1296),t.generateKeyPair=((e,t,r)=>{let n=s[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=s[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=i.PublicKey.decode(e),r=t.Data;switch(t.Type){case i.KeyType.RSA:return s.rsa.unmarshalRsaPublicKey(r);case i.KeyType.Ed25519:return s.ed25519.unmarshalEd25519PublicKey(r);case i.KeyType.Secp256k1:if(s.secp256k1)return s.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(!a(t=(t||"rsa").toLowerCase()))throw new Error("invalid or unsupported key type");return e.bytes}),t.unmarshalPrivateKey=((e,t)=>{let r;try{r=i.PrivateKey.decode(e)}catch(e){return t(e)}const n=r.Data;switch(r.Type){case i.KeyType.RSA:return s.rsa.unmarshalRsaPrivateKey(n,t);case i.KeyType.Ed25519:return s.ed25519.unmarshalEd25519PrivateKey(n,t);case i.KeyType.Secp256k1:return s.secp256k1?s.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(!a(t=(t||"rsa").toLowerCase()))throw new Error("invalid or unsupported key type");return e.bytes}),t.import=((e,t,r)=>{try{const i=o.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 a=o.asn1.toDer(o.pki.privateKeyToAsn1(i));return a=n.from(a.getBytes(),"binary"),s.rsa.unmarshalRsaPrivateKey(a,r)}catch(e){r(e)}})}).call(this,r(0).Buffer)},function(e,t,r){"use strict";const n=r(578),i=r(10),o=r(14),s=r(580),a=i(r(316)),u=r(16),c=r(3);class f{constructor(e){this._key=e}verify(e,t,r){h(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){h(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){h(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){h(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"),h(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){if("function"!=typeof e)throw new Error("callback is required")}e.exports={RsaPublicKey:f,RsaPrivateKey:l,unmarshalRsaPublicKey:function(e){const t=s.utils.pkixToJwk(e);return new f(t)},unmarshalRsaPrivateKey:function(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))})},generateKeyPair:function(e,t){s.generateKey(e,(e,r)=>{if(e)return t(e);t(null,new l(r.privateKey,r.publicKey))})},fromJwk:function(e,t){s.unmarshalPrivateKey(e,(e,r)=>{if(e)return t(e);t(null,new l(r.privateKey,r.publicKey))})}}},function(e,t,r){"use strict";(function(t){const n=r(38),i=r(39),o=r(579),s=r(1290),a=o.toCallback,u=o.toBuf,c=o.fromString,f=o.fromNumberTo32BitBuf;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(1291),dblSha2256:(e,r)=>{s.sha2256(e,(e,n)=>{e&&r(e),s.sha2256(t.from(n),r)})}}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(t){const n=r(40),i=self.crypto?self.crypto.subtle||self.crypto.webkitSubtle:self.msCrypto?self.msCrypto.subtle:void 0;function o(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)}}e.exports={sha1:function(e,t){o("SHA-1")(e,t)},sha2256:function(e,t){o("SHA-256")(e,t)},sha2512:function(e,t){o("SHA-512")(e,t)}}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(t){const n=r(41),i=r(579).toCallback,o={init:n.blake2bInit,update:n.blake2bUpdate,digest:n.blake2bFinal},s={init:n.blake2sInit,update:n.blake2sUpdate,digest:n.blake2sFinal},a=(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[45569+t]=a(t+1,o);for(let t=0;t<32;t++)e[45633+t]=a(t+1,s)})}).call(this,r(0).Buffer)},function(e,t,r){"use strict";const n=r(15),i=r(581),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(578),i=r(10),o=r(14),s=r(1294),a=i(r(316));class u{constructor(e){this._key=l(e,s.publicKeyLength)}verify(e,t,r){f(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){f(e),n(this.bytes,"sha2-256",e)}}class c{constructor(e,t){this._key=l(e,s.privateKeyLength),this._publicKey=l(t,s.publicKeyLength)}sign(e,t){f(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){f(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){if("function"!=typeof e)throw new Error("callback is required")}function l(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:function(e,t){try{e=l(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))},unmarshalEd25519PublicKey:function(e){return e=l(e,s.publicKeyLength),new u(e)},generateKeyPair:function(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)})},generateKeyPairFromSeed:function(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)})}}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(e){const n=r(58),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(37),i=r(577),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=t.from("key expansion"),h=2*(f+c+20);i.create(r,s,(e,r)=>{if(e)return a(e);r.digest(l,(e,i)=>{if(e)return a(e);let o=[],s=0;n(()=>s<h,function(e){r.digest(t.concat([i,l]),(t,n)=>{if(t)return e(t);let a=n.length;s+a>h&&(a=h-s),o.push(n),s+=a,r.digest(i,(t,r)=>{if(t)return e(t);i=r,e()})})},function(e){if(e)return a(e);const r=h/2,n=t.concat(o),i=n.slice(0,r),s=n.slice(r,h),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)})})})})})}).call(this,r(0).Buffer)},function(e,t,r){"use strict";const n=r(1297);e.exports=((e,t)=>{n.generateEphmeralKeyPair(e,t)})},function(e,t,r){"use strict";(function(e){const n=r(315)(),i=r(314),o=r(15).bignum,s=r(581),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(16),i={sha1:"sha1","sha2-256":"sha256","sha2-512":"sha512"};e.exports=function(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)}},function(e,t,r){"use strict";const n=r(304),i=r(47).Connection,o=r(3),s=r(565),a=r(4),u=r(1)("libp2p:switch:dial"),c=r(576),f=r(583),l="Unexpected end of input from reader.";function h(e,t,r,n){e.select(t,(e,t)=>{if(!0===e)return n(new Error(l));r(e,t)})}function p(e,t,r,n){e.handle(t,e=>{if(!0===e)return n(new Error(l));r(e)})}class d{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===l||!0===e)return u("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(u("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];return this.switch.muxedConns[e]?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?(u("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;p(a,e,e=>{if(e)return r(new Error("multistream not supported"));const n=e=>{u("selecting %s",e),h(a,e,(i,a)=>{if(i)return 0===s.length?r(new Error("could not upgrade to stream muxing")):n(s.shift());const c=f(null,e,a,this.switch.observer),l=this.switch.muxers[e].dialer(c);this.switch.muxedConns[t]={muxer:l},l.once("close",()=>{delete this.switch.muxedConns[t],this.peerInfo.disconnect(),this.switch._peerInfo.disconnect(),u(`closed connection to ${t}`),o(()=>this.switch.emit("peer-mux-closed",this.peerInfo))}),l.on("stream",e=>{e.setPeerInfo(this.peerInfo),this.switch.protocolMuxer(null)(e)}),o(()=>this.switch.emit("peer-mux-established",this.peerInfo)),r(null,l)},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 c=this.peerInfo.id.toB58String();if(!a){if(!r){const t=`Circuit not enabled and all transports failed to dial peer ${c}!`;return e(new Error(t))}if(n)return e(new Error(`No available transports to dial peer ${c}!`));u("Falling back to dialing over circuit"),this.peerInfo.multiaddrs.add(`/p2p-circuit/ipfs/${c}`),n=!0,a=s.tag}u(`dialing transport ${a}`),this.switch.transport.dial(a,this.peerInfo,(r,n)=>{if(r)return u(r),i(t.shift());const o=f(a,null,n,this.switch.observer);e(null,o)})};i(t.shift())}_encryptConnection(e,t){const r=new n.Dialer;p(r,e,e=>{if(e)return t(e);const n=this.switch._peerInfo.id;u("selecting crypto: %s",this.switch.crypto.tag),h(r,this.switch.crypto.tag,(e,r)=>{if(e)return t(e);const i=f(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;p(r,e,e=>{if(e)return t(e);h(r,this.protocol,(e,r)=>{if(e)return u("could not perform protocol handshake: ",e),t(e);const n=f(null,this.protocol,r,this.switch.observer);t(null,n)},t)},t)}}e.exports=function(e){return(t,r,n)=>{"function"==typeof r&&(n=r,r=null),n=n||function(){};const i=c(t,e._peerBook);return new d(e,i,e._peerInfo,r,n).dial()}}},function(e,t,r){"use strict";const n=r(304),i=r(583),o=r(1)("libp2p:switch:protocol-muxer");e.exports=function(e,t){return r=>s=>{const a=r?i(r,null,s,t):s,u=new n.Listener;Object.keys(e).forEach(r=>{if(!r)return;u.addHandler(r,(r,n)=>{o(`registering handler with protocol ${r}`);const s=e[r];if(s){const e=s&&s.handlerFunc;e&&e(s,i(null,r,n,t))}},e[r].matchFunc)}),u.handle(a,e=>{})}}},function(e,t,r){"use strict";const n=r(8),i=r(11);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(11),i=r(1303),o=r(1304),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:function(){c.stop();for(let e of h.values())e.stop();for(let e of p.values())e.stop()},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",y);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))?l.delete(e):t=new i(a,r),t.on("update",y),t.start(),h.set(e,t)),t.push(f,s)}if(t){let e=p.get(t);e||((e=new i(a,r)).on("update",y),p.set(t,e)),e.push(f,s)}if(n){let e=d.get(n);e||((e=new i(a,r)).on("update",y),d.set(n,e)),e.push(f,s)}}),e.on("peer:closed",e=>{const t=h.get(e);t&&(t.removeListener("update",y),t.stop(),h.delete(e),l.set(e,t))}),f;function y(){f.emit("update")}})},function(e,t,r){"use strict";const n=r(11),i=r(122).Big,o=r(508);e.exports=class 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=>{(this._movingAverages[e][t]=o(t)).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;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}}},function(e,t,r){"use strict";const n=r(1305);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>=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(1308);(t=e.exports=r(1309)).mount=n.mount,t.unmount=n.unmount},function(e,t,r){"use strict";const n=r(8),i=r(100),o=r(317),s=o.PROTOCOL,a=o.PING_LENGTH,u=r(1),c=u("libp2p-ping");c.error=u("libp2p-ping:error"),(t=e.exports).mount=function(e){e.handle(s,(e,t)=>{const r=i({timeout:0}),o=r.handshake;n(t,r,t),function e(){o.read(a,(t,r)=>{if(!0!==t)return t?c.error(t):(o.write(r),e())})}()})},t.unmount=function(e){e.unhandle(s)}},function(e,t,r){"use strict";const n=r(11).EventEmitter,i=r(8),o=r(100),s=r(317),a=r(1310).rnd,u=r(1),c=u("libp2p-ping");c.error=u("libp2p-ping:error");const f=s.PROTOCOL,l=s.PING_LENGTH;e.exports=class extends n{constructor(e,t){super(),this._stopped=!1,this.peer=t,this.swarm=e}start(){c("dialing %s to %s",f,this.peer.id.toB58String()),this.swarm.dial(this.peer,f,(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 e(){let t=new Date,r=a(l);n.shake.write(r),n.shake.read(l,(i,o)=>{let s=new Date;if(i||!r.equals(o)){const e=new Error("Received wrong ping ack");return n.emit("error",e)}n.emit("ping",s-t),n._stopped||e()})}()})}stop(){!this._stopped&&this.shake&&(this._stopped=!0,i(i.empty(),this.shake.rest()))}}},function(e,t,r){"use strict";const n=r(111),i=r(317);e.exports.rnd=(e=>(e||(e=i.PING_LENGTH),n.randomBytes(e)))},function(e,t,r){"use strict";const n=r(11),i=r(1312).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};function a(e,t){return e[1]-t[1]}function u(e){return e.name.toLowerCase()}e.exports=class extends n{constructor(e,t){if(super(),this._libp2p=e,this._options=Object.assign({},s,t),this._options.maxPeersPerProtocol=function(e){return e||(e={}),Object.keys(e).forEach(t=>{const r=e[t];delete e[t],e[t.toLowerCase()]=r}),e}(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),function(e){const t=new Set;return e.multiaddrs.forEach(e=>{e.protos().map(u).forEach(e=>{t.add(e)})}),Array.from(t)}(e).forEach(e=>{this._peerCountPerProtocol[e]||(this._peerCountPerProtocol[e]=0),this._peerCountPerProtocol[e]++;let r=this._peerProtocols[t];r||(r=this._peerProtocols[t]=new Set),r.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=>{this._peerCountPerProtocol[e]&&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),t>this._options[e]&&(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),t>this._options.maxPeersPerProtocol[e]&&(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(a);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(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=r(1313).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=u(r(11)),o=u(r(584)),s=u(r(214)),a=u(r(1343));function u(e){return e&&e.__esModule?e:{default:e}}var c=r(585)("latency-monitor:LatencyMonitor"),f=function(t){function r(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=t.latencyCheckIntervalMs,i=t.dataEmitIntervalMs,s=t.asyncTestFn,u=t.latencyRandomPercentage;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,r);var f=function(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}(this,(r.__proto__||Object.getPrototypeOf(r)).call(this)),l=f;return l.latencyCheckIntervalMs=n||500,l.latencyRandomPercentage=u||10,l._latecyCheckMultiply=l.latencyRandomPercentage/100*2*l.latencyCheckIntervalMs,l._latecyCheckSubtract=l._latecyCheckMultiply/2,l.dataEmitIntervalMs=null===i||0===i?void 0:i||5e3,c("latencyCheckIntervalMs: %s dataEmitIntervalMs: %s",l.latencyCheckIntervalMs,l.dataEmitIntervalMs),l.dataEmitIntervalMs?c("Expecting ~%s events per summary",l.latencyCheckIntervalMs/l.dataEmitIntervalMs):c("Not emitting summaries"),l.asyncTestFn=s,e&&e.hrtime?(c("Using process.hrtime for timing"),l.now=e.hrtime,l.getDeltaMS=function(e){var t=l.now(e);return 1e3*t[0]+t[1]/1e6}):"undefined"!=typeof window&&(0,o.default)(window,"performance.now")?(c("Using performance.now for timing"),l.now=window.performance.now.bind(window.performance),l.getDeltaMS=function(e){return Math.round(l.now()-e)}):(c("Using Date.now for timing"),l.now=Date.now,l.getDeltaMS=function(e){return l.now()-e}),l._latencyData=l._initLatencyData(),"undefined"!=typeof window&&(l._visibilityChangeEmitter=new a.default,l._visibilityChangeEmitter.on("visibilityChange",function(e){e?l._startTimers():(l._emitSummary(),l._stopTimers())})),l._visibilityChangeEmitter&&!l._visibilityChangeEmitter.isVisible()||l._startTimers(),f}return function(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)}(r,i.default),n(r,[{key:"_startTimers",value:function(){var e=this;this._checkLatencyID||(this._checkLatency(),this.dataEmitIntervalMs&&(this._emitIntervalID=setInterval(function(){return e._emitSummary()},this.dataEmitIntervalMs),(0,s.default)(this._emitIntervalID.unref)&&this._emitIntervalID.unref()))}},{key:"_stopTimers",value:function(){this._checkLatencyID&&(clearTimeout(this._checkLatencyID),this._checkLatencyID=void 0),this._emitIntervalID&&(clearInterval(this._emitIntervalID),this._emitIntervalID=void 0)}},{key:"_emitSummary",value:function(){var e=this.getSummary();e.events>0&&this.emit("data",e)}},{key:"getSummary",value:function(){var e={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(),c("Summary: %O",e),e}},{key:"_checkLatency",value:function(){var e=this,t=this,r=Math.random()*t._latecyCheckMultiply-t._latecyCheckSubtract,n={deltaOffset:Math.ceil(t.latencyCheckIntervalMs+r),startTime:t.now()},i=function(){if(e._checkLatencyID){var r=t.getDeltaMS(n.startTime)-n.deltaOffset;t._checkLatency(),t._latencyData.events++,t._latencyData.minMs=Math.min(t._latencyData.minMs,r),t._latencyData.maxMs=Math.max(t._latencyData.maxMs,r),t._latencyData.totalMs+=r,c("MS: %s Data: %O",r,t._latencyData)}};c("localData: %O",n),this._checkLatencyID=setTimeout(function(){t.asyncTestFn?(n.deltaOffset=0,n.startTime=t.now(),t.asyncTestFn(i)):(n.deltaOffset-=1,i())},n.deltaOffset),(0,s.default)(this._checkLatencyID.unref)&&this._checkLatencyID.unref()}},{key:"_initLatencyData",value:function(){return{startTime:this.now(),minMs:Number.POSITIVE_INFINITY,maxMs:Number.NEGATIVE_INFINITY,events:0,totalMs:0}}}]),r}();t.default=f}).call(this,r(7))},function(e,t,r){var n=r(1315),i=r(1342);e.exports=function(e,t){for(var r=0,o=(t=n(t,e)).length;null!=e&&r<o;)e=e[i(t[r++])];return r&&r==o?e:void 0}},function(e,t,r){var n=r(88),i=r(1316),o=r(1317),s=r(1340);e.exports=function(e,t){return n(e)?e:i(e,t)?[e]:o(s(e))}},function(e,t,r){var n=r(88),i=r(318),o=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,s=/^\w*$/;e.exports=function(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)}},function(e,t,r){var n=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,i=/\\(\\)?/g,o=r(1318)(function(e){var t=[];return 46===e.charCodeAt(0)&&t.push(""),e.replace(n,function(e,r,n,o){t.push(n?o.replace(i,"$1"):r||e)}),t});e.exports=o},function(e,t,r){var n=r(1319),i=500;e.exports=function(e){var t=n(e,function(e){return r.size===i&&r.clear(),e}),r=t.cache;return t}},function(e,t,r){var n=r(1320),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(1321),i=r(1335),o=r(1337),s=r(1338),a=r(1339);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(1322),i=r(1328),o=r(1334);e.exports=function(){this.size=0,this.__data__={hash:new n,map:new(o||i),string:new n}}},function(e,t,r){var n=r(1323),i=r(1324),o=r(1325),s=r(1326),a=r(1327);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(197);e.exports=function(){this.__data__=n?n(null):{},this.size=0}},function(e,t){e.exports=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}},function(e,t,r){var n=r(197),i="__lodash_hash_undefined__",o=Object.prototype.hasOwnProperty;e.exports=function(e){var t=this.__data__;if(n){var r=t[e];return r===i?void 0:r}return o.call(t,e)?t[e]:void 0}},function(e,t,r){var n=r(197),i=Object.prototype.hasOwnProperty;e.exports=function(e){var t=this.__data__;return n?void 0!==t[e]:i.call(t,e)}},function(e,t,r){var n=r(197),i="__lodash_hash_undefined__";e.exports=function(e,t){var r=this.__data__;return this.size+=this.has(e)?0:1,r[e]=n&&void 0===t?i:t,this}},function(e,t,r){var n=r(1329),i=r(1330),o=r(1331),s=r(1332),a=r(1333);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){e.exports=function(){this.__data__=[],this.size=0}},function(e,t,r){var n=r(198),i=Array.prototype.splice;e.exports=function(e){var t=this.__data__,r=n(t,e);return!(r<0||(r==t.length-1?t.pop():i.call(t,r,1),--this.size,0))}},function(e,t,r){var n=r(198);e.exports=function(e){var t=this.__data__,r=n(t,e);return r<0?void 0:t[r][1]}},function(e,t,r){var n=r(198);e.exports=function(e){return n(this.__data__,e)>-1}},function(e,t,r){var n=r(198);e.exports=function(e,t){var r=this.__data__,i=n(r,e);return i<0?(++this.size,r.push([e,t])):r[i][1]=t,this}},function(e,t,r){var n=r(312)(r(159),"Map");e.exports=n},function(e,t,r){var n=r(199);e.exports=function(e){var t=n(this,e).delete(e);return this.size-=t?1:0,t}},function(e,t){e.exports=function(e){var t=typeof e;return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e}},function(e,t,r){var n=r(199);e.exports=function(e){return n(this,e).get(e)}},function(e,t,r){var n=r(199);e.exports=function(e){return n(this,e).has(e)}},function(e,t,r){var n=r(199);e.exports=function(e,t){var r=n(this,e),i=r.size;return r.set(e,t),this.size+=r.size==i?0:1,this}},function(e,t,r){var n=r(1341);e.exports=function(e){return null==e?"":n(e)}},function(e,t,r){var n=r(158),i=r(222),o=r(88),s=r(318),a=1/0,u=n?n.prototype:void 0,c=u?u.toString:void 0;e.exports=function e(t){if("string"==typeof t)return t;if(o(t))return i(t,e)+"";if(s(t))return c?c.call(t):"";var r=t+"";return"0"==r&&1/t==-a?"-0":r}},function(e,t,r){var n=r(318),i=1/0;e.exports=function(e){if("string"==typeof e||n(e))return e;var t=e+"";return"0"==t&&1/e==-i?"-0":t}},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=function(e){return e&&e.__esModule?e:{default:e}}(r(11));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}var s=r(585)("latency-monitor:VisibilityChangeEmitter"),a=function(e){function t(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var e=o(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));return"undefined"==typeof document?(s('This is not a browser, no "document" found. Stopping.'),o(e)):(e._initializeVisibilityVarNames(),e._addVisibilityChangeListener(),e)}return function(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)}(t,i.default),n(t,[{key:"_initializeVisibilityVarNames",value:function(){var e=void 0,t=void 0;void 0!==document.hidden?(e="hidden",t="visibilitychange"):void 0!==document.mozHidden?(e="mozHidden",t="mozvisibilitychange"):void 0!==document.msHidden?(e="msHidden",t="msvisibilitychange"):void 0!==document.webkitHidden&&(e="webkitHidden",t="webkitvisibilitychange"),this._hidden=e,this._visibilityChange=t}},{key:"_addVisibilityChangeListener",value:function(){void 0===document.addEventListener||void 0===document[this._hidden]?s("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(){if(void 0!==this._hidden&&void 0!==document[this._hidden])return!document[this._hidden]}},{key:"_handleVisibilityChange",value:function(){var e=!document[this._hidden];s(e?"Page Visible":"Page Hidden"),this.emit("visibilityChange",e)}}]),t}();t.default=a},function(e,t,r){var n;function i(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),(r.log||t.log||console.log.bind(console)).apply(e,s)}}return r.namespace=e,r.enabled=t.enabled(e),r.useColors=t.useColors(),r.color=function(e){var r,n=0;for(r in e)n=(n<<5)-n+e.charCodeAt(r),n|=0;return t.colors[Math.abs(n)%t.colors.length]}(e),"function"==typeof t.init&&t.init(r),r}(t=e.exports=i.debug=i.default=i).coerce=function(e){return e instanceof Error?e.stack||e.message:e},t.disable=function(){t.enable("")},t.enable=function(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,".*?"))[0]?t.skips.push(new RegExp("^"+e.substr(1)+"$")):t.names.push(new RegExp("^"+e+"$")))},t.enabled=function(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},t.humanize=r(219),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(1349).NOT_STARTED_YET,o=r(1350);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(e){0===r.listenerCount(t)&&r.subscribe(t),r.on(t,s),n(e)}(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(11),i=r(1351),o=r(507),s=r(8),a=r(52),u=r(17),c=r(50),f=r(1353),l=r(1356),h=r(586),p=r(1357),d=r(2).Buffer,y=p.log,g=p.multicodec,m=l.ensureArray,b=r(3);e.exports=class 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(){};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.map(t=>{const n=l.randomSeqno();return this.cache.put(l.msgId(r,n)),{from:r,data:t,seqno:new d(n),topicIDs:e}});this._emitMessages(e,n),this._forwardMessages(e,n)}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)).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)).forEach(e=>this.subscriptions.delete(e)),this.peers.forEach(e=>t(e)))}}},function(e,t,r){"use strict";const n=r(1352);e.exports=function e(t){if(!(this instanceof e))return new e(t);const r=(t=t||{}).validity||30,i=new Map,o=n(()=>{i.forEach((e,t)=>{const n=e.validity||r;(function(e){const t=(new Date).getTime()-e.getTime();return Math.floor(t/1e3)})(e.timestamp)>n&&i.delete(t)})},200);this.put=((e,t,r)=>{this.has(e)||i.set(e,{value:t,timestamp:new Date,validity:r}),o()}),this.get=(e=>{if(i.has(e))return i.get(e).value;throw new Error("key does not exist")}),this.has=(e=>i.has(e))}},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.toString,d=Math.max,y=Math.min,g=function(){return h.Date.now()};function m(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 m(t){var r=i,n=o;return i=o=void 0,f=t,a=e.apply(n,r)}function _(e){var r=e-c;return void 0===c||r>=t||r<0||h&&e-f>=s}function w(){var e=g();if(_(e))return S(e);u=setTimeout(w,function(e){var r=t-(e-c);return h?y(r,s-(e-f)):r}(e))}function S(e){return u=void 0,p&&i?m(e):(i=o=void 0,a)}function k(){var e=g(),r=_(e);if(i=arguments,o=this,c=e,r){if(void 0===u)return function(e){return f=e,u=setTimeout(w,t),l?m(e):a}(c);if(h)return u=setTimeout(w,t),m(c)}return void 0===u&&(u=setTimeout(w,t)),a}return t=v(t)||0,b(n)&&(l=!!n.leading,s=(h="maxWait"in n)?d(v(n.maxWait)||0,t):s,p="trailing"in n?!!n.trailing:p),k.cancel=function(){void 0!==u&&clearTimeout(u),f=0,i=c=o=u=void 0},k.flush=function(){return void 0===u?a:S(g())},k}function b(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function v(e){if("number"==typeof e)return e;if(function(e){return"symbol"==typeof e||function(e){return!!e&&"object"==typeof e}(e)&&p.call(e)==i}(e))return n;if(b(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=b(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=function(e,t,n){var i=!0,o=!0;if("function"!=typeof e)throw new TypeError(r);return b(n)&&(i="leading"in n?!!n.leading:i,o="trailing"in n?!!n.trailing:o),m(e,t,{leading:i,maxWait:t,trailing:o})}}).call(this,r(6))},function(e,t,r){"use strict";const n=r(52),i=r(46),o=r(8),s=r(3),a=r(11),u=r(586).rpc.RPC;e.exports=class 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()})}}},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(111),o=r(14);(t=e.exports).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(1359),i=r(51),o=r(60);e.exports=(e=>(function(t,r){let s;if(i.isPeerInfo(t))s=t;else if(o.isMultiaddr(t)||"string"==typeof t){"string"==typeof t&&(t=o(t));const r=t.getPeerId();if(!r)throw new Error("peer multiaddr instance or string must include peerId");try{s=e.peerBook.get(r)}catch(e){s=new i(n.createFromB58String(r))}s.multiaddrs.add(t)}else{if(!n.isPeerId(t))return setImmediate(()=>r(new Error("peer type not recognized")));{const n=t.toB58String();try{s=e.peerBook.get(n)}catch(n){return e.peerRouting.findPeer(t,r)}}}setImmediate(()=>r(null,s))}))},function(e,t,r){"use strict";(function(n){const i=r(12),o=r(1360),s=r(17),a=r(4);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).create=function(e,t){"function"==typeof e&&(t=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(587),i=r(1362),o=r(1364);(t=e.exports).aes=i,t.hmac=n,t.keys=o,t.randomBytes=r(592),t.pbkdf2=r(1375)},function(e,t,r){"use strict";e.exports={SHA1:20,SHA256:32,SHA512:64}},function(e,t,r){"use strict";const n=r(1363),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);r(null,{encrypt(e,t){t(null,s.update(e))},decrypt(e,t){t(null,a.update(e))}})}},function(e,t,r){"use strict";const n=r(57);e.exports={createCipheriv:n.createCipheriv,createDecipheriv:n.createDecipheriv}},function(e,t,r){"use strict";(function(n){const i=r(10)(r(321)),o=r(16);t=e.exports;const s={rsa:r(1365),ed25519:r(1370),secp256k1:r(59)(i,r(592))};function a(e){return void 0!==s[e.toLowerCase()]}t.supportedKeys=s,t.keysPBM=i,t.keyStretcher=r(1372),t.generateEphemeralKeyPair=r(1373),t.generateKeyPair=((e,t,r)=>{let n=s[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=s[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=i.PublicKey.decode(e),r=t.Data;switch(t.Type){case i.KeyType.RSA:return s.rsa.unmarshalRsaPublicKey(r);case i.KeyType.Ed25519:return s.ed25519.unmarshalEd25519PublicKey(r);case i.KeyType.Secp256k1:if(s.secp256k1)return s.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(!a(t=(t||"rsa").toLowerCase()))throw new Error("invalid or unsupported key type");return e.bytes}),t.unmarshalPrivateKey=((e,t)=>{let r;try{r=i.PrivateKey.decode(e)}catch(e){return t(e)}const n=r.Data;switch(r.Type){case i.KeyType.RSA:return s.rsa.unmarshalRsaPrivateKey(n,t);case i.KeyType.Ed25519:return s.ed25519.unmarshalEd25519PrivateKey(n,t);case i.KeyType.Secp256k1:return s.secp256k1?s.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(!a(t=(t||"rsa").toLowerCase()))throw new Error("invalid or unsupported key type");return e.bytes}),t.import=((e,t,r)=>{try{const i=o.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 a=o.asn1.toDer(o.pki.privateKeyToAsn1(i));return a=n.from(a.getBytes(),"binary"),s.rsa.unmarshalRsaPrivateKey(a,r)}catch(e){r(e)}})}).call(this,r(0).Buffer)},function(e,t,r){"use strict";const n=r(588),i=r(10),o=r(14),s=r(590),a=i(r(321)),u=r(16),c=r(3);class f{constructor(e){this._key=e}verify(e,t,r){h(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){h(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){h(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){h(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"),h(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){if("function"!=typeof e)throw new Error("callback is required")}e.exports={RsaPublicKey:f,RsaPrivateKey:l,unmarshalRsaPublicKey:function(e){const t=s.utils.pkixToJwk(e);return new f(t)},unmarshalRsaPrivateKey:function(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))})},generateKeyPair:function(e,t){s.generateKey(e,(e,r)=>{if(e)return t(e);t(null,new l(r.privateKey,r.publicKey))})},fromJwk:function(e,t){s.unmarshalPrivateKey(e,(e,r)=>{if(e)return t(e);t(null,new l(r.privateKey,r.publicKey))})}}},function(e,t,r){"use strict";(function(t){const n=r(38),i=r(39),o=r(589),s=r(1367),a=o.toCallback,u=o.toBuf,c=o.fromString,f=o.fromNumberTo32BitBuf;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(1368),dblSha2256:(e,r)=>{s.sha2256(e,(e,n)=>{e&&r(e),s.sha2256(t.from(n),r)})}}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(t){const n=r(40),i=self.crypto?self.crypto.subtle||self.crypto.webkitSubtle:self.msCrypto?self.msCrypto.subtle:void 0;function o(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)}}e.exports={sha1:function(e,t){o("SHA-1")(e,t)},sha2256:function(e,t){o("SHA-256")(e,t)},sha2512:function(e,t){o("SHA-512")(e,t)}}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(t){const n=r(41),i=r(589).toCallback,o={init:n.blake2bInit,update:n.blake2bUpdate,digest:n.blake2bFinal},s={init:n.blake2sInit,update:n.blake2sUpdate,digest:n.blake2sFinal},a=(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[45569+t]=a(t+1,o);for(let t=0;t<32;t++)e[45633+t]=a(t+1,s)})}).call(this,r(0).Buffer)},function(e,t,r){"use strict";const n=r(15),i=r(591),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(588),i=r(10),o=r(14),s=r(1371),a=i(r(321));class u{constructor(e){this._key=l(e,s.publicKeyLength)}verify(e,t,r){f(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){f(e),n(this.bytes,"sha2-256",e)}}class c{constructor(e,t){this._key=l(e,s.privateKeyLength),this._publicKey=l(t,s.publicKeyLength)}sign(e,t){f(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){f(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){if("function"!=typeof e)throw new Error("callback is required")}function l(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:function(e,t){try{e=l(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))},unmarshalEd25519PublicKey:function(e){return e=l(e,s.publicKeyLength),new u(e)},generateKeyPair:function(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)})},generateKeyPairFromSeed:function(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)})}}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(e){const n=r(58),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(37),i=r(587),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=t.from("key expansion"),h=2*(f+c+20);i.create(r,s,(e,r)=>{if(e)return a(e);r.digest(l,(e,i)=>{if(e)return a(e);let o=[],s=0;n(()=>s<h,function(e){r.digest(t.concat([i,l]),(t,n)=>{if(t)return e(t);let a=n.length;s+a>h&&(a=h-s),o.push(n),s+=a,r.digest(i,(t,r)=>{if(t)return e(t);i=r,e()})})},function(e){if(e)return a(e);const r=h/2,n=t.concat(o),i=n.slice(0,r),s=n.slice(r,h),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)})})})})})}).call(this,r(0).Buffer)},function(e,t,r){"use strict";const n=r(1374);e.exports=((e,t)=>{n.generateEphmeralKeyPair(e,t)})},function(e,t,r){"use strict";(function(e){const n=r(320)(),i=r(319),o=r(15).bignum,s=r(591),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(16),i={sha1:"sha1","sha2-256":"sha256","sha2-512":"sha512"};e.exports=function(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)}},function(e,t,r){"use strict";const n=r(497),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),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)).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
|
||
*/
|
||
/**
|
||
* @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=200,a="Unsupported core-js use. Try https://npms.io/search?q=ponyfill.",u="Expected a function",c="__lodash_hash_undefined__",f=500,l="__lodash_placeholder__",h=1,p=2,d=4,y=1,g=2,m=1,b=2,v=4,_=8,w=16,S=32,k=64,E=128,A=256,x=512,I=30,T="...",B=800,C=16,P=1,O=2,R=1/0,N=9007199254740991,L=1.7976931348623157e308,K=NaN,j=4294967295,M=j-1,D=j>>>1,U=[["ary",E],["bind",m],["bindKey",b],["curry",_],["curryRight",w],["flip",x],["partial",S],["partialRight",k],["rearg",A]],F="[object Arguments]",q="[object Array]",H="[object AsyncFunction]",z="[object Boolean]",V="[object Date]",G="[object DOMException]",W="[object Error]",$="[object Function]",Y="[object GeneratorFunction]",J="[object Map]",X="[object Number]",Z="[object Null]",Q="[object Object]",ee="[object Promise]",te="[object Proxy]",re="[object RegExp]",ne="[object Set]",ie="[object String]",oe="[object Symbol]",se="[object Undefined]",ae="[object WeakMap]",ue="[object WeakSet]",ce="[object ArrayBuffer]",fe="[object DataView]",le="[object Float32Array]",he="[object Float64Array]",pe="[object Int8Array]",de="[object Int16Array]",ye="[object Int32Array]",ge="[object Uint8Array]",me="[object Uint8ClampedArray]",be="[object Uint16Array]",ve="[object Uint32Array]",_e=/\b__p \+= '';/g,we=/\b(__p \+=) '' \+/g,Se=/(__e\(.*?\)|\b__t\)) \+\n'';/g,ke=/&(?:amp|lt|gt|quot|#39);/g,Ee=/[&<>"']/g,Ae=RegExp(ke.source),xe=RegExp(Ee.source),Ie=/<%-([\s\S]+?)%>/g,Te=/<%([\s\S]+?)%>/g,Be=/<%=([\s\S]+?)%>/g,Ce=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Pe=/^\w*$/,Oe=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Re=/[\\^$.*+?()[\]{}|]/g,Ne=RegExp(Re.source),Le=/^\s+|\s+$/g,Ke=/^\s+/,je=/\s+$/,Me=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,De=/\{\n\/\* \[wrapped with (.+)\] \*/,Ue=/,? & /,Fe=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,qe=/\\(\\)?/g,He=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,ze=/\w*$/,Ve=/^[-+]0x[0-9a-f]+$/i,Ge=/^0b[01]+$/i,We=/^\[object .+?Constructor\]$/,$e=/^0o[0-7]+$/i,Ye=/^(?:0|[1-9]\d*)$/,Je=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,Xe=/($^)/,Ze=/['\n\r\u2028\u2029\\]/g,Qe="\\ud800-\\udfff",et="\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff",tt="a-z\\xdf-\\xf6\\xf8-\\xff",rt="A-Z\\xc0-\\xd6\\xd8-\\xde",nt="\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\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",it="["+nt+"]",ot="["+et+"]",st="\\d+",at="["+tt+"]",ut="[^"+Qe+nt+st+"\\u2700-\\u27bf"+tt+rt+"]",ct="\\ud83c[\\udffb-\\udfff]",ft="[^\\ud800-\\udfff]",lt="(?:\\ud83c[\\udde6-\\uddff]){2}",ht="[\\ud800-\\udbff][\\udc00-\\udfff]",pt="["+rt+"]",dt="(?:"+at+"|"+ut+")",yt="(?:"+pt+"|"+ut+")",gt="(?:['’](?:d|ll|m|re|s|t|ve))?",mt="(?:['’](?:D|LL|M|RE|S|T|VE))?",bt="(?:"+ot+"|"+ct+")?",vt="[\\ufe0e\\ufe0f]?",_t=vt+bt+"(?:\\u200d(?:"+[ft,lt,ht].join("|")+")"+vt+bt+")*",wt="(?:"+["[\\u2700-\\u27bf]",lt,ht].join("|")+")"+_t,St="(?:"+[ft+ot+"?",ot,lt,ht,"[\\ud800-\\udfff]"].join("|")+")",kt=RegExp("['’]","g"),Et=RegExp(ot,"g"),At=RegExp(ct+"(?="+ct+")|"+St+_t,"g"),xt=RegExp([pt+"?"+at+"+"+gt+"(?="+[it,pt,"$"].join("|")+")",yt+"+"+mt+"(?="+[it,pt+dt,"$"].join("|")+")",pt+"?"+dt+"+"+gt,pt+"+"+mt,"\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])","\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",st,wt].join("|"),"g"),It=RegExp("[\\u200d"+Qe+et+"\\ufe0e\\ufe0f]"),Tt=/[a-z][A-Z]|[A-Z]{2,}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,Bt=["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"],Ct=-1,Pt={};Pt[le]=Pt[he]=Pt[pe]=Pt[de]=Pt[ye]=Pt[ge]=Pt[me]=Pt[be]=Pt[ve]=!0,Pt[F]=Pt[q]=Pt[ce]=Pt[z]=Pt[fe]=Pt[V]=Pt[W]=Pt[$]=Pt[J]=Pt[X]=Pt[Q]=Pt[re]=Pt[ne]=Pt[ie]=Pt[ae]=!1;var Ot={};Ot[F]=Ot[q]=Ot[ce]=Ot[fe]=Ot[z]=Ot[V]=Ot[le]=Ot[he]=Ot[pe]=Ot[de]=Ot[ye]=Ot[J]=Ot[X]=Ot[Q]=Ot[re]=Ot[ne]=Ot[ie]=Ot[oe]=Ot[ge]=Ot[me]=Ot[be]=Ot[ve]=!0,Ot[W]=Ot[$]=Ot[ae]=!1;var Rt={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},Nt=parseFloat,Lt=parseInt,Kt="object"==typeof e&&e&&e.Object===Object&&e,jt="object"==typeof self&&self&&self.Object===Object&&self,Mt=Kt||jt||Function("return this")(),Dt="object"==typeof t&&t&&!t.nodeType&&t,Ut=Dt&&"object"==typeof n&&n&&!n.nodeType&&n,Ft=Ut&&Ut.exports===Dt,qt=Ft&&Kt.process,Ht=function(){try{return Ut&&Ut.require&&Ut.require("util").types||qt&&qt.binding&&qt.binding("util")}catch(e){}}(),zt=Ht&&Ht.isArrayBuffer,Vt=Ht&&Ht.isDate,Gt=Ht&&Ht.isMap,Wt=Ht&&Ht.isRegExp,$t=Ht&&Ht.isSet,Yt=Ht&&Ht.isTypedArray;function Jt(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 Xt(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 Zt(e,t){for(var r=-1,n=null==e?0:e.length;++r<n&&!1!==t(e[r],r,e););return e}function Qt(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 er(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 tr(e,t){return!(null==e||!e.length)&&hr(e,t,0)>-1}function rr(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 nr(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 or(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 sr(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 ar(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 ur=gr("length");function cr(e){return e.match(Fe)||[]}function fr(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 hr(e,t,r){return t==t?function(e,t,r){for(var n=r-1,i=e.length;++n<i;)if(e[n]===t)return n;return-1}(e,t,r):lr(e,dr,r)}function pr(e,t,r,n){for(var i=r-1,o=e.length;++i<o;)if(n(e[i],t))return i;return-1}function dr(e){return e!=e}function yr(e,t){var r=null==e?0:e.length;return r?vr(e,t)/r:K}function gr(e){return function(t){return null==t?o:t[e]}}function mr(e){return function(t){return null==e?o:e[t]}}function br(e,t,r,n,i){return i(e,function(e,i,o){r=n?(n=!1,e):t(r,e,i,o)}),r}function vr(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 _r(e,t){for(var r=-1,n=Array(e);++r<e;)n[r]=t(r);return n}function wr(e){return function(t){return e(t)}}function Sr(e,t){return nr(t,function(t){return e[t]})}function kr(e,t){return e.has(t)}function Er(e,t){for(var r=-1,n=e.length;++r<n&&hr(t,e[r],0)>-1;);return r}function Ar(e,t){for(var r=e.length;r--&&hr(t,e[r],0)>-1;);return r}var xr=mr({"À":"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"}),Ir=mr({"&":"&","<":"<",">":">",'"':""","'":"'"});function Tr(e){return"\\"+Rt[e]}function Br(e){return It.test(e)}function Cr(e){return Tt.test(e)}function Pr(e){var t=-1,r=Array(e.size);return e.forEach(function(e,n){r[++t]=[n,e]}),r}function Or(e,t){return function(r){return e(t(r))}}function Rr(e,t){for(var r=-1,n=e.length,i=0,o=[];++r<n;){var s=e[r];s!==t&&s!==l||(e[r]=l,o[i++]=r)}return o}function Nr(e,t){return"__proto__"==t?o:e[t]}function Lr(e){var t=-1,r=Array(e.size);return e.forEach(function(e){r[++t]=e}),r}function Kr(e){return Br(e)?function(e){for(var t=At.lastIndex=0;At.test(e);)++t;return t}(e):ur(e)}function jr(e){return Br(e)?function(e){return e.match(At)||[]}(e):function(e){return e.split("")}(e)}var Mr=mr({"&":"&","<":"<",">":">",""":'"',"'":"'"});function Dr(e){return e.match(xt)||[]}var Ur=function e(t){var r,n=(t=null==t?Mt:Ur.defaults(Mt.Object(),t,Ur.pick(Mt,Bt))).Array,i=t.Date,Fe=t.Error,Qe=t.Function,et=t.Math,tt=t.Object,rt=t.RegExp,nt=t.String,it=t.TypeError,ot=n.prototype,st=Qe.prototype,at=tt.prototype,ut=t["__core-js_shared__"],ct=st.toString,ft=at.hasOwnProperty,lt=0,ht=(r=/[^.]+$/.exec(ut&&ut.keys&&ut.keys.IE_PROTO||""))?"Symbol(src)_1."+r:"",pt=at.toString,dt=ct.call(tt),yt=Mt._,gt=rt("^"+ct.call(ft).replace(Re,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),mt=Ft?t.Buffer:o,bt=t.Symbol,vt=t.Uint8Array,_t=mt?mt.allocUnsafe:o,wt=Or(tt.getPrototypeOf,tt),St=tt.create,At=at.propertyIsEnumerable,xt=ot.splice,It=bt?bt.isConcatSpreadable:o,Tt=bt?bt.iterator:o,Rt=bt?bt.toStringTag:o,Kt=function(){try{var e=Do(tt,"defineProperty");return e({},"",{}),e}catch(e){}}(),jt=t.clearTimeout!==Mt.clearTimeout&&t.clearTimeout,Dt=i&&i.now!==Mt.Date.now&&i.now,Ut=t.setTimeout!==Mt.setTimeout&&t.setTimeout,qt=et.ceil,Ht=et.floor,ur=tt.getOwnPropertySymbols,mr=mt?mt.isBuffer:o,Fr=t.isFinite,qr=ot.join,Hr=Or(tt.keys,tt),zr=et.max,Vr=et.min,Gr=i.now,Wr=t.parseInt,$r=et.random,Yr=ot.reverse,Jr=Do(t,"DataView"),Xr=Do(t,"Map"),Zr=Do(t,"Promise"),Qr=Do(t,"Set"),en=Do(t,"WeakMap"),tn=Do(tt,"create"),rn=en&&new en,nn={},on=hs(Jr),sn=hs(Xr),an=hs(Zr),un=hs(Qr),cn=hs(en),fn=bt?bt.prototype:o,ln=fn?fn.valueOf:o,hn=fn?fn.toString:o;function pn(e){if(Ba(e)&&!ba(e)&&!(e instanceof mn)){if(e instanceof gn)return e;if(ft.call(e,"__wrapped__"))return ps(e)}return new gn(e)}var dn=function(){function e(){}return function(t){if(!Ta(t))return{};if(St)return St(t);e.prototype=t;var r=new e;return e.prototype=o,r}}();function yn(){}function gn(e,t){this.__wrapped__=e,this.__actions__=[],this.__chain__=!!t,this.__index__=0,this.__values__=o}function mn(e){this.__wrapped__=e,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=j,this.__views__=[]}function bn(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 vn(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 _n(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 wn(e){var t=-1,r=null==e?0:e.length;for(this.__data__=new _n;++t<r;)this.add(e[t])}function Sn(e){var t=this.__data__=new vn(e);this.size=t.size}function kn(e,t){var r=ba(e),n=!r&&ma(e),i=!r&&!n&&Sa(e),o=!r&&!n&&!i&&ja(e),s=r||n||i||o,a=s?_r(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)||Go(c,u))||a.push(c);return a}function En(e){var t=e.length;return t?e[vi(0,t-1)]:o}function An(e,t,r){(r===o||da(e[t],r))&&(r!==o||t in e)||Cn(e,t,r)}function xn(e,t,r){var n=e[t];ft.call(e,t)&&da(n,r)&&(r!==o||t in e)||Cn(e,t,r)}function In(e,t){for(var r=e.length;r--;)if(da(e[r][0],t))return r;return-1}function Tn(e,t,r,n){return jn(e,function(e,i,o){t(n,e,r(e),o)}),n}function Bn(e,t){return e&&Qi(t,ou(t),e)}function Cn(e,t,r){"__proto__"==t&&Kt?Kt(e,t,{configurable:!0,enumerable:!0,value:r,writable:!0}):e[t]=r}function Pn(e,t){for(var r=-1,i=t.length,s=n(i),a=null==e;++r<i;)s[r]=a?o:eu(e,t[r]);return s}function On(e,t,r){return e==e&&(r!==o&&(e=e<=r?e:r),t!==o&&(e=e>=t?e:t)),e}function Rn(e,t,r,n,i,s){var a,u=t&h,c=t&p,f=t&d;if(r&&(a=i?r(e,n,i,s):r(e)),a!==o)return a;if(!Ta(e))return e;var l=ba(e);if(l){if(a=function(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}(e),!u)return Zi(e,a)}else{var y=qo(e),g=y==$||y==Y;if(Sa(e))return Gi(e,u);if(y==Q||y==F||g&&!i){if(a=c||g?{}:zo(e),!u)return c?function(e,t){return Qi(e,Fo(e),t)}(e,function(e,t){return e&&Qi(t,su(t),e)}(a,e)):function(e,t){return Qi(e,Uo(e),t)}(e,Bn(a,e))}else{if(!Ot[y])return i?e:{};a=function(e,t,r){var n=e.constructor;switch(t){case ce:return Wi(e);case z:case V:return new n(+e);case fe:return function(e,t){var r=t?Wi(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.byteLength)}(e,r);case le:case he:case pe:case de:case ye:case ge:case me:case be:case ve:return $i(e,r);case J:return new n;case X:case ie:return new n(e);case re:return function(e){var t=new e.constructor(e.source,ze.exec(e));return t.lastIndex=e.lastIndex,t}(e);case ne:return new n;case oe:return function(e){return ln?tt(ln.call(e)):{}}(e)}}(e,y,u)}}s||(s=new Sn);var m=s.get(e);if(m)return m;if(s.set(e,a),Na(e))return e.forEach(function(n){a.add(Rn(n,t,r,n,e,s))}),a;if(Ca(e))return e.forEach(function(n,i){a.set(i,Rn(n,t,r,i,e,s))}),a;var b=l?o:(f?c?Oo:Po:c?su:ou)(e);return Zt(b||e,function(n,i){b&&(n=e[i=n]),xn(a,i,Rn(n,t,r,i,e,s))}),a}function Nn(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 Ln(e,t,r){if("function"!=typeof e)throw new it(u);return os(function(){e.apply(o,r)},t)}function Kn(e,t,r,n){var i=-1,o=tr,a=!0,u=e.length,c=[],f=t.length;if(!u)return c;r&&(t=nr(t,wr(r))),n?(o=rr,a=!1):t.length>=s&&(o=kr,a=!1,t=new wn(t));e:for(;++i<u;){var l=e[i],h=null==r?l:r(l);if(l=n||0!==l?l:0,a&&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}pn.templateSettings={escape:Ie,evaluate:Te,interpolate:Be,variable:"",imports:{_:pn}},pn.prototype=yn.prototype,pn.prototype.constructor=pn,gn.prototype=dn(yn.prototype),gn.prototype.constructor=gn,mn.prototype=dn(yn.prototype),mn.prototype.constructor=mn,bn.prototype.clear=function(){this.__data__=tn?tn(null):{},this.size=0},bn.prototype.delete=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t},bn.prototype.get=function(e){var t=this.__data__;if(tn){var r=t[e];return r===c?o:r}return ft.call(t,e)?t[e]:o},bn.prototype.has=function(e){var t=this.__data__;return tn?t[e]!==o:ft.call(t,e)},bn.prototype.set=function(e,t){var r=this.__data__;return this.size+=this.has(e)?0:1,r[e]=tn&&t===o?c:t,this},vn.prototype.clear=function(){this.__data__=[],this.size=0},vn.prototype.delete=function(e){var t=this.__data__,r=In(t,e);return!(r<0||(r==t.length-1?t.pop():xt.call(t,r,1),--this.size,0))},vn.prototype.get=function(e){var t=this.__data__,r=In(t,e);return r<0?o:t[r][1]},vn.prototype.has=function(e){return In(this.__data__,e)>-1},vn.prototype.set=function(e,t){var r=this.__data__,n=In(r,e);return n<0?(++this.size,r.push([e,t])):r[n][1]=t,this},_n.prototype.clear=function(){this.size=0,this.__data__={hash:new bn,map:new(Xr||vn),string:new bn}},_n.prototype.delete=function(e){var t=jo(this,e).delete(e);return this.size-=t?1:0,t},_n.prototype.get=function(e){return jo(this,e).get(e)},_n.prototype.has=function(e){return jo(this,e).has(e)},_n.prototype.set=function(e,t){var r=jo(this,e),n=r.size;return r.set(e,t),this.size+=r.size==n?0:1,this},wn.prototype.add=wn.prototype.push=function(e){return this.__data__.set(e,c),this},wn.prototype.has=function(e){return this.__data__.has(e)},Sn.prototype.clear=function(){this.__data__=new vn,this.size=0},Sn.prototype.delete=function(e){var t=this.__data__,r=t.delete(e);return this.size=t.size,r},Sn.prototype.get=function(e){return this.__data__.get(e)},Sn.prototype.has=function(e){return this.__data__.has(e)},Sn.prototype.set=function(e,t){var r=this.__data__;if(r instanceof vn){var n=r.__data__;if(!Xr||n.length<s-1)return n.push([e,t]),this.size=++r.size,this;r=this.__data__=new _n(n)}return r.set(e,t),this.size=r.size,this};var jn=ro(Vn),Mn=ro(Gn,!0);function Dn(e,t){var r=!0;return jn(e,function(e,n,i){return r=!!t(e,n,i)}),r}function Un(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&&!Ka(a):r(a,u)))var u=a,c=s}return c}function Fn(e,t){var r=[];return jn(e,function(e,n,i){t(e,n,i)&&r.push(e)}),r}function qn(e,t,r,n,i){var o=-1,s=e.length;for(r||(r=Vo),i||(i=[]);++o<s;){var a=e[o];t>0&&r(a)?t>1?qn(a,t-1,r,n,i):ir(i,a):n||(i[i.length]=a)}return i}var Hn=no(),zn=no(!0);function Vn(e,t){return e&&Hn(e,t,ou)}function Gn(e,t){return e&&zn(e,t,ou)}function Wn(e,t){return er(t,function(t){return Aa(e[t])})}function $n(e,t){for(var r=0,n=(t=qi(t,e)).length;null!=e&&r<n;)e=e[ls(t[r++])];return r&&r==n?e:o}function Yn(e,t,r){var n=t(e);return ba(e)?n:ir(n,r(e))}function Jn(e){return null==e?e===o?se:Z:Rt&&Rt in tt(e)?function(e){var t=ft.call(e,Rt),r=e[Rt];try{e[Rt]=o;var n=!0}catch(e){}var i=pt.call(e);return n&&(t?e[Rt]=r:delete e[Rt]),i}(e):function(e){return pt.call(e)}(e)}function Xn(e,t){return e>t}function Zn(e,t){return null!=e&&ft.call(e,t)}function Qn(e,t){return null!=e&&t in tt(e)}function ei(e,t,r){for(var i=r?rr:tr,s=e[0].length,a=e.length,u=a,c=n(a),f=1/0,l=[];u--;){var h=e[u];u&&t&&(h=nr(h,wr(t))),f=Vr(h.length,f),c[u]=!r&&(t||s>=120&&h.length>=120)?new wn(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=r||0!==y?y:0,!(d?kr(d,g):i(l,g,r))){for(u=a;--u;){var m=c[u];if(!(m?kr(m,g):i(e[u],g,r)))continue e}d&&d.push(g),l.push(y)}}return l}function ti(e,t,r){var n=null==(e=rs(e,t=qi(t,e)))?e:e[ls(Es(t))];return null==n?o:Jt(n,e,r)}function ri(e){return Ba(e)&&Jn(e)==F}function ni(e,t,r,n,i){return e===t||(null==e||null==t||!Ba(e)&&!Ba(t)?e!=e&&t!=t:function(e,t,r,n,i,o){var s=ba(e),a=ba(t),u=s?q:qo(e),c=a?q:qo(t),f=(u=u==F?Q:u)==Q,l=(c=c==F?Q:c)==Q,h=u==c;if(h&&Sa(e)){if(!Sa(t))return!1;s=!0,f=!1}if(h&&!f)return o||(o=new Sn),s||ja(e)?Io(e,t,r,n,i,o):To(e,t,u,r,n,i,o);if(!(r&y)){var p=f&&ft.call(e,"__wrapped__"),d=l&&ft.call(t,"__wrapped__");if(p||d){var g=p?e.value():e,m=d?t.value():t;return o||(o=new Sn),i(g,m,r,n,o)}}return!!h&&(o||(o=new Sn),Bo(e,t,r,n,i,o))}(e,t,r,n,ni,i))}function ii(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;){var c=(u=r[i])[0],f=e[c],l=u[1];if(a&&u[2]){if(f===o&&!(c in e))return!1}else{var h=new Sn;if(n)var p=n(f,l,c,e,t,h);if(!(p===o?ni(l,f,y|g,n,h):p))return!1}}return!0}function oi(e){return!(!Ta(e)||function(e){return!!ht&&ht in e}(e))&&(Aa(e)?gt:We).test(hs(e))}function si(e){return"function"==typeof e?e:null==e?Pu:"object"==typeof e?ba(e)?hi(e[0],e[1]):li(e):Uu(e)}function ai(e){if(!Xo(e))return Hr(e);var t=[];for(var r in tt(e))ft.call(e,r)&&"constructor"!=r&&t.push(r);return t}function ui(e){if(!Ta(e))return function(e){var t=[];if(null!=e)for(var r in tt(e))t.push(r);return t}(e);var t=Xo(e),r=[];for(var n in e)("constructor"!=n||!t&&ft.call(e,n))&&r.push(n);return r}function ci(e,t){return e<t}function fi(e,t){var r=-1,i=_a(e)?n(e.length):[];return jn(e,function(e,n,o){i[++r]=t(e,n,o)}),i}function li(e){var t=Mo(e);return 1==t.length&&t[0][2]?Qo(t[0][0],t[0][1]):function(r){return r===e||ii(r,e,t)}}function hi(e,t){return $o(e)&&Zo(t)?Qo(ls(e),t):function(r){var n=eu(r,e);return n===o&&n===t?tu(r,e):ni(t,n,y|g)}}function pi(e,t,r,n,i){e!==t&&Hn(t,function(s,a){if(Ta(s))i||(i=new Sn),function(e,t,r,n,i,s,a){var u=Nr(e,r),c=Nr(t,r),f=a.get(c);if(f)An(e,r,f);else{var l=s?s(u,c,r+"",e,t,a):o,h=l===o;if(h){var p=ba(c),d=!p&&Sa(c),y=!p&&!d&&ja(c);l=c,p||d||y?ba(u)?l=u:wa(u)?l=Zi(u):d?(h=!1,l=Gi(c,!0)):y?(h=!1,l=$i(c,!0)):l=[]:Oa(c)||ma(c)?(l=u,ma(u)?l=Va(u):(!Ta(u)||n&&Aa(u))&&(l=zo(c))):h=!1}h&&(a.set(c,l),i(l,c,n,s,a),a.delete(c)),An(e,r,l)}}(e,t,a,r,pi,n,i);else{var u=n?n(Nr(e,a),s,a+"",e,t,i):o;u===o&&(u=s),An(e,a,u)}},su)}function di(e,t){var r=e.length;if(r)return Go(t+=t<0?r:0,r)?e[t]:o}function yi(e,t,r){var n=-1;return t=nr(t.length?t:[Pu],wr(Ko())),function(e,t){var r=e.length;for(e.sort(t);r--;)e[r]=e[r].value;return e}(fi(e,function(e,r,i){return{criteria:nr(t,function(t){return t(e)}),index:++n,value:e}}),function(e,t){return function(e,t,r){for(var n=-1,i=e.criteria,o=t.criteria,s=i.length,a=r.length;++n<s;){var u=Yi(i[n],o[n]);if(u)return n>=a?u:u*("desc"==r[n]?-1:1)}return e.index-t.index}(e,t,r)})}function gi(e,t,r){for(var n=-1,i=t.length,o={};++n<i;){var s=t[n],a=$n(e,s);r(a,s)&&ki(o,qi(s,e),a)}return o}function mi(e,t,r,n){var i=n?pr:hr,o=-1,s=t.length,a=e;for(e===t&&(t=Zi(t)),r&&(a=nr(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&&xt.call(a,u,1),xt.call(e,u,1);return e}function bi(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;Go(i)?xt.call(e,i,1):Ni(e,i)}}return e}function vi(e,t){return e+Ht($r()*(t-e+1))}function _i(e,t,r,i){for(var o=-1,s=zr(qt((t-e)/(r||1)),0),a=n(s);s--;)a[i?s:++o]=e,e+=r;return a}function wi(e,t){var r="";if(!e||t<1||t>N)return r;do{t%2&&(r+=e),(t=Ht(t/2))&&(e+=e)}while(t);return r}function Si(e,t){return ss(ts(e,t,Pu),e+"")}function ki(e,t,r,n){if(!Ta(e))return e;for(var i=-1,s=(t=qi(t,e)).length,a=s-1,u=e;null!=u&&++i<s;){var c=ls(t[i]),f=r;if(i!=a){var l=u[c];(f=n?n(l,c,u):o)===o&&(f=Ta(l)?l:Go(t[i+1])?[]:{})}xn(u,c,f),u=u[c]}return e}var Ei=rn?function(e,t){return rn.set(e,t),e}:Pu,Ai=Kt?function(e,t){return Kt(e,"toString",{configurable:!0,enumerable:!1,value:Tu(t),writable:!0})}:Pu;function xi(e,t,r){var i=-1,o=e.length;t<0&&(t=-t>o?0:o+t),(r=r>o?o:r)<0&&(r+=o),o=t>r?0:r-t>>>0,t>>>=0;for(var s=n(o);++i<o;)s[i]=e[i+t];return s}function Ii(e,t){var r;return jn(e,function(e,n,i){return!(r=t(e,n,i))}),!!r}function Ti(e,t,r){var n=0,i=null==e?n:e.length;if("number"==typeof t&&t==t&&i<=D){for(;n<i;){var o=n+i>>>1,s=e[o];null!==s&&!Ka(s)&&(r?s<=t:s<t)?n=o+1:i=o}return i}return Bi(e,t,Pu,r)}function Bi(e,t,r,n){t=r(t);for(var i=0,s=null==e?0:e.length,a=t!=t,u=null===t,c=Ka(t),f=t===o;i<s;){var l=Ht((i+s)/2),h=r(e[l]),p=h!==o,d=null===h,y=h==h,g=Ka(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 Vr(s,M)}function Ci(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||!da(a,u)){var u=a;o[i++]=0===s?0:s}}return o}function Pi(e){return"number"==typeof e?e:Ka(e)?K:+e}function Oi(e){if("string"==typeof e)return e;if(ba(e))return nr(e,Oi)+"";if(Ka(e))return hn?hn.call(e):"";var t=e+"";return"0"==t&&1/e==-R?"-0":t}function Ri(e,t,r){var n=-1,i=tr,o=e.length,a=!0,u=[],c=u;if(r)a=!1,i=rr;else if(o>=s){var f=t?null:wo(e);if(f)return Lr(f);a=!1,i=kr,c=new wn}else c=t?[]:u;e:for(;++n<o;){var l=e[n],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 i(c,h,r)||(c!==u&&c.push(h),u.push(l))}return u}function Ni(e,t){return null==(e=rs(e,t=qi(t,e)))||delete e[ls(Es(t))]}function Li(e,t,r,n){return ki(e,t,r($n(e,t)),n)}function Ki(e,t,r,n){for(var i=e.length,o=n?i:-1;(n?o--:++o<i)&&t(e[o],o,e););return r?xi(e,n?0:o,n?o+1:i):xi(e,n?o+1:0,n?i:o)}function ji(e,t){var r=e;return r instanceof mn&&(r=r.value()),or(t,function(e,t){return t.func.apply(t.thisArg,ir([e],t.args))},r)}function Mi(e,t,r){var i=e.length;if(i<2)return i?Ri(e[0]):[];for(var o=-1,s=n(i);++o<i;)for(var a=e[o],u=-1;++u<i;)u!=o&&(s[o]=Kn(s[o]||a,e[u],t,r));return Ri(qn(s,1),t,r)}function Di(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 Ui(e){return wa(e)?e:[]}function Fi(e){return"function"==typeof e?e:Pu}function qi(e,t){return ba(e)?e:$o(e,t)?[e]:fs(Ga(e))}var Hi=Si;function zi(e,t,r){var n=e.length;return r=r===o?n:r,!t&&r>=n?e:xi(e,t,r)}var Vi=jt||function(e){return Mt.clearTimeout(e)};function Gi(e,t){if(t)return e.slice();var r=e.length,n=_t?_t(r):new e.constructor(r);return e.copy(n),n}function Wi(e){var t=new e.constructor(e.byteLength);return new vt(t).set(new vt(e)),t}function $i(e,t){var r=t?Wi(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.length)}function Yi(e,t){if(e!==t){var r=e!==o,n=null===e,i=e==e,s=Ka(e),a=t!==o,u=null===t,c=t==t,f=Ka(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 Ji(e,t,r,i){for(var o=-1,s=e.length,a=r.length,u=-1,c=t.length,f=zr(s-a,0),l=n(c+f),h=!i;++u<c;)l[u]=t[u];for(;++o<a;)(h||o<s)&&(l[r[o]]=e[o]);for(;f--;)l[u++]=e[o++];return l}function Xi(e,t,r,i){for(var o=-1,s=e.length,a=-1,u=r.length,c=-1,f=t.length,l=zr(s-u,0),h=n(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+r[a]]=e[o++]);return h}function Zi(e,t){var r=-1,i=e.length;for(t||(t=n(i));++r<i;)t[r]=e[r];return t}function Qi(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?Cn(r,u,c):xn(r,u,c)}return r}function eo(e,t){return function(r,n){var i=ba(r)?Xt:Tn,o=t?t():{};return i(r,e,Ko(n,2),o)}}function to(e){return Si(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&&Wo(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 ro(e,t){return function(r,n){if(null==r)return r;if(!_a(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 no(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 io(e){return function(t){var r=Br(t=Ga(t))?jr(t):o,n=r?r[0]:t.charAt(0),i=r?zi(r,1).join(""):t.slice(1);return n[e]()+i}}function oo(e){return function(t){return or(Au(mu(t).replace(kt,"")),e,"")}}function so(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=dn(e.prototype),n=e.apply(r,t);return Ta(n)?n:r}}function ao(e,t,r){var i=so(e);return function s(){for(var a=arguments.length,u=n(a),c=a,f=Lo(s);c--;)u[c]=arguments[c];var l=a<3&&u[0]!==f&&u[a-1]!==f?[]:Rr(u,f);return(a-=l.length)<r?vo(e,t,fo,s.placeholder,o,u,l,o,o,r-a):Jt(this&&this!==Mt&&this instanceof s?i:e,this,u)}}function uo(e){return function(t,r,n){var i=tt(t);if(!_a(t)){var s=Ko(r,3);t=ou(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 co(e){return Co(function(t){var r=t.length,n=r,i=gn.prototype.thru;for(e&&t.reverse();n--;){var s=t[n];if("function"!=typeof s)throw new it(u);if(i&&!a&&"wrapper"==No(s))var a=new gn([],!0)}for(n=a?n:r;++n<r;){var c=No(s=t[n]),f="wrapper"==c?Ro(s):o;a=f&&Yo(f[0])&&f[1]==(E|_|S|A)&&!f[4].length&&1==f[9]?a[No(f[0])].apply(a,f[3]):1==s.length&&Yo(s)?a[c]():a.thru(s)}return function(){var e=arguments,n=e[0];if(a&&1==e.length&&ba(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 fo(e,t,r,i,s,a,u,c,f,l){var h=t&E,p=t&m,d=t&b,y=t&(_|w),g=t&x,v=d?o:so(e);return function o(){for(var m=arguments.length,b=n(m),_=m;_--;)b[_]=arguments[_];if(y)var w=Lo(o),S=function(e,t){for(var r=e.length,n=0;r--;)e[r]===t&&++n;return n}(b,w);if(i&&(b=Ji(b,i,s,y)),a&&(b=Xi(b,a,u,y)),m-=S,y&&m<l){var k=Rr(b,w);return vo(e,t,fo,o.placeholder,r,b,k,c,f,l-m)}var E=p?r:this,A=d?E[e]:e;return m=b.length,c?b=ns(b,c):g&&m>1&&b.reverse(),h&&f<m&&(b.length=f),this&&this!==Mt&&this instanceof o&&(A=v||so(A)),A.apply(E,b)}}function lo(e,t){return function(r,n){return function(e,t,r,n){return Vn(e,function(e,i,o){t(n,r(e),i,o)}),n}(r,e,t(n),{})}}function ho(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=Oi(r),n=Oi(n)):(r=Pi(r),n=Pi(n)),i=e(r,n)}return i}}function po(e){return Co(function(t){return t=nr(t,wr(Ko())),Si(function(r){var n=this;return e(t,function(e){return Jt(e,n,r)})})})}function yo(e,t){var r=(t=t===o?" ":Oi(t)).length;if(r<2)return r?wi(t,e):t;var n=wi(t,qt(e/Kr(t)));return Br(t)?zi(jr(n),0,e).join(""):n.slice(0,e)}function go(e,t,r,i){var o=t&m,s=so(e);return function t(){for(var a=-1,u=arguments.length,c=-1,f=i.length,l=n(f+u),h=this&&this!==Mt&&this instanceof t?s:e;++c<f;)l[c]=i[c];for(;u--;)l[c++]=arguments[++a];return Jt(h,o?r:this,l)}}function mo(e){return function(t,r,n){return n&&"number"!=typeof n&&Wo(t,r,n)&&(r=n=o),t=Fa(t),r===o?(r=t,t=0):r=Fa(r),_i(t,r,n=n===o?t<r?1:-1:Fa(n),e)}}function bo(e){return function(t,r){return"string"==typeof t&&"string"==typeof r||(t=za(t),r=za(r)),e(t,r)}}function vo(e,t,r,n,i,s,a,u,c,f){var l=t&_;t|=l?S:k,(t&=~(l?k:S))&v||(t&=~(m|b));var h=[e,t,i,l?s:o,l?a:o,l?o:s,l?o:a,u,c,f],p=r.apply(o,h);return Yo(e)&&is(p,h),p.placeholder=n,as(p,e,t)}function _o(e){var t=et[e];return function(e,r){if(e=za(e),r=null==r?0:Vr(qa(r),292)){var n=(Ga(e)+"e").split("e");return+((n=(Ga(t(n[0]+"e"+(+n[1]+r)))+"e").split("e"))[0]+"e"+(+n[1]-r))}return t(e)}}var wo=Qr&&1/Lr(new Qr([,-0]))[1]==R?function(e){return new Qr(e)}:Ku;function So(e){return function(t){var r=qo(t);return r==J?Pr(t):r==ne?function(e){var t=-1,r=Array(e.size);return e.forEach(function(e){r[++t]=[e,e]}),r}(t):function(e,t){return nr(t,function(t){return[t,e[t]]})}(t,e(t))}}function ko(e,t,r,n,i,s,a,c){var f=t&b;if(!f&&"function"!=typeof e)throw new it(u);var l=n?n.length:0;if(l||(t&=~(S|k),n=i=o),a=a===o?a:zr(qa(a),0),c=c===o?c:qa(c),l-=i?i.length:0,t&k){var h=n,p=i;n=i=o}var d=f?o:Ro(e),y=[e,t,r,n,i,h,p,s,a,c];if(d&&es(y,d),e=y[0],t=y[1],r=y[2],n=y[3],i=y[4],!(c=y[9]=y[9]===o?f?0:e.length:zr(y[9]-l,0))&&t&(_|w)&&(t&=~(_|w)),t&&t!=m)g=t==_||t==w?ao(e,t,c):t!=S&&t!=(m|S)||i.length?fo.apply(o,y):go(e,t,r,n);else var g=function(e,t,r){var n=t&m,i=so(e);return function t(){return(this&&this!==Mt&&this instanceof t?i:e).apply(n?r:this,arguments)}}(e,t,r);return as((d?Ei:is)(g,y),e,t)}function Eo(e,t,r,n){return e===o||da(e,at[r])&&!ft.call(n,r)?t:e}function Ao(e,t,r,n,i,s){return Ta(e)&&Ta(t)&&(s.set(t,e),pi(e,t,o,Ao,s),s.delete(t)),e}function xo(e){return Oa(e)?o:e}function Io(e,t,r,n,i,s){var a=r&y,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&g?new wn:o;for(s.set(e,t),s.set(t,e);++l<u;){var d=e[l],m=t[l];if(n)var b=a?n(m,d,l,t,e,s):n(d,m,l,e,t,s);if(b!==o){if(b)continue;h=!1;break}if(p){if(!ar(t,function(e,t){if(!kr(p,t)&&(d===e||i(d,e,r,n,s)))return p.push(t)})){h=!1;break}}else if(d!==m&&!i(d,m,r,n,s)){h=!1;break}}return s.delete(e),s.delete(t),h}function To(e,t,r,n,i,o,s){switch(r){case fe:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case ce:return!(e.byteLength!=t.byteLength||!o(new vt(e),new vt(t)));case z:case V:case X:return da(+e,+t);case W:return e.name==t.name&&e.message==t.message;case re:case ie:return e==t+"";case J:var a=Pr;case ne:var u=n&y;if(a||(a=Lr),e.size!=t.size&&!u)return!1;var c=s.get(e);if(c)return c==t;n|=g,s.set(e,t);var f=Io(a(e),a(t),n,i,o,s);return s.delete(e),f;case oe:if(ln)return ln.call(e)==ln.call(t)}return!1}function Bo(e,t,r,n,i,s){var a=r&y,u=Po(e),c=u.length;if(c!=Po(t).length&&!a)return!1;for(var f=c;f--;){var l=u[f];if(!(a?l in t:ft.call(t,l)))return!1}var h=s.get(e);if(h&&s.get(t))return h==t;var p=!0;s.set(e,t),s.set(t,e);for(var d=a;++f<c;){var g=e[l=u[f]],m=t[l];if(n)var b=a?n(m,g,l,t,e,s):n(g,m,l,e,t,s);if(!(b===o?g===m||i(g,m,r,n,s):b)){p=!1;break}d||(d="constructor"==l)}if(p&&!d){var v=e.constructor,_=t.constructor;v!=_&&"constructor"in e&&"constructor"in t&&!("function"==typeof v&&v instanceof v&&"function"==typeof _&&_ instanceof _)&&(p=!1)}return s.delete(e),s.delete(t),p}function Co(e){return ss(ts(e,o,vs),e+"")}function Po(e){return Yn(e,ou,Uo)}function Oo(e){return Yn(e,su,Fo)}var Ro=rn?function(e){return rn.get(e)}:Ku;function No(e){for(var t=e.name+"",r=nn[t],n=ft.call(nn,t)?r.length:0;n--;){var i=r[n],o=i.func;if(null==o||o==e)return i.name}return t}function Lo(e){return(ft.call(pn,"placeholder")?pn:e).placeholder}function Ko(){var e=pn.iteratee||Ou;return e=e===Ou?si:e,arguments.length?e(arguments[0],arguments[1]):e}function jo(e,t){var r=e.__data__;return function(e){var t=typeof e;return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e}(t)?r["string"==typeof t?"string":"hash"]:r.map}function Mo(e){for(var t=ou(e),r=t.length;r--;){var n=t[r],i=e[n];t[r]=[n,i,Zo(i)]}return t}function Do(e,t){var r=function(e,t){return null==e?o:e[t]}(e,t);return oi(r)?r:o}var Uo=ur?function(e){return null==e?[]:(e=tt(e),er(ur(e),function(t){return At.call(e,t)}))}:Hu,Fo=ur?function(e){for(var t=[];e;)ir(t,Uo(e)),e=wt(e);return t}:Hu,qo=Jn;function Ho(e,t,r){for(var n=-1,i=(t=qi(t,e)).length,o=!1;++n<i;){var s=ls(t[n]);if(!(o=null!=e&&r(e,s)))break;e=e[s]}return o||++n!=i?o:!!(i=null==e?0:e.length)&&Ia(i)&&Go(s,i)&&(ba(e)||ma(e))}function zo(e){return"function"!=typeof e.constructor||Xo(e)?{}:dn(wt(e))}function Vo(e){return ba(e)||ma(e)||!!(It&&e&&e[It])}function Go(e,t){var r=typeof e;return!!(t=null==t?N:t)&&("number"==r||"symbol"!=r&&Ye.test(e))&&e>-1&&e%1==0&&e<t}function Wo(e,t,r){if(!Ta(r))return!1;var n=typeof t;return!!("number"==n?_a(r)&&Go(t,r.length):"string"==n&&t in r)&&da(r[t],e)}function $o(e,t){if(ba(e))return!1;var r=typeof e;return!("number"!=r&&"symbol"!=r&&"boolean"!=r&&null!=e&&!Ka(e))||Pe.test(e)||!Ce.test(e)||null!=t&&e in tt(t)}function Yo(e){var t=No(e),r=pn[t];if("function"!=typeof r||!(t in mn.prototype))return!1;if(e===r)return!0;var n=Ro(r);return!!n&&e===n[0]}(Jr&&qo(new Jr(new ArrayBuffer(1)))!=fe||Xr&&qo(new Xr)!=J||Zr&&qo(Zr.resolve())!=ee||Qr&&qo(new Qr)!=ne||en&&qo(new en)!=ae)&&(qo=function(e){var t=Jn(e),r=t==Q?e.constructor:o,n=r?hs(r):"";if(n)switch(n){case on:return fe;case sn:return J;case an:return ee;case un:return ne;case cn:return ae}return t});var Jo=ut?Aa:zu;function Xo(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||at)}function Zo(e){return e==e&&!Ta(e)}function Qo(e,t){return function(r){return null!=r&&r[e]===t&&(t!==o||e in tt(r))}}function es(e,t){var r=e[1],n=t[1],i=r|n,o=i<(m|b|E),s=n==E&&r==_||n==E&&r==A&&e[7].length<=t[8]||n==(E|A)&&t[7].length<=t[8]&&r==_;if(!o&&!s)return e;n&m&&(e[2]=t[2],i|=r&m?0:v);var a=t[3];if(a){var u=e[3];e[3]=u?Ji(u,a,t[4]):a,e[4]=u?Rr(e[3],l):t[4]}return(a=t[5])&&(u=e[5],e[5]=u?Xi(u,a,t[6]):a,e[6]=u?Rr(e[5],l):t[6]),(a=t[7])&&(e[7]=a),n&E&&(e[8]=null==e[8]?t[8]:Vr(e[8],t[8])),null==e[9]&&(e[9]=t[9]),e[0]=t[0],e[1]=i,e}function ts(e,t,r){return t=zr(t===o?e.length-1:t,0),function(){for(var i=arguments,o=-1,s=zr(i.length-t,0),a=n(s);++o<s;)a[o]=i[t+o];o=-1;for(var u=n(t+1);++o<t;)u[o]=i[o];return u[t]=r(a),Jt(e,this,u)}}function rs(e,t){return t.length<2?e:$n(e,xi(t,0,-1))}function ns(e,t){for(var r=e.length,n=Vr(t.length,r),i=Zi(e);n--;){var s=t[n];e[n]=Go(s,r)?i[s]:o}return e}var is=us(Ei),os=Ut||function(e,t){return Mt.setTimeout(e,t)},ss=us(Ai);function as(e,t,r){var n=t+"";return ss(e,function(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(Me,"{\n/* [wrapped with "+t+"] */\n")}(n,function(e,t){return Zt(U,function(r){var n="_."+r[0];t&r[1]&&!tr(e,n)&&e.push(n)}),e.sort()}(function(e){var t=e.match(De);return t?t[1].split(Ue):[]}(n),r)))}function us(e){var t=0,r=0;return function(){var n=Gr(),i=C-(n-r);if(r=n,i>0){if(++t>=B)return arguments[0]}else t=0;return e.apply(o,arguments)}}function cs(e,t){var r=-1,n=e.length,i=n-1;for(t=t===o?n:t;++r<t;){var s=vi(r,i),a=e[s];e[s]=e[r],e[r]=a}return e.length=t,e}var fs=function(e){var t=ua(e,function(e){return r.size===f&&r.clear(),e}),r=t.cache;return t}(function(e){var t=[];return 46===e.charCodeAt(0)&&t.push(""),e.replace(Oe,function(e,r,n,i){t.push(n?i.replace(qe,"$1"):r||e)}),t});function ls(e){if("string"==typeof e||Ka(e))return e;var t=e+"";return"0"==t&&1/e==-R?"-0":t}function hs(e){if(null!=e){try{return ct.call(e)}catch(e){}try{return e+""}catch(e){}}return""}function ps(e){if(e instanceof mn)return e.clone();var t=new gn(e.__wrapped__,e.__chain__);return t.__actions__=Zi(e.__actions__),t.__index__=e.__index__,t.__values__=e.__values__,t}var ds=Si(function(e,t){return wa(e)?Kn(e,qn(t,1,wa,!0)):[]}),ys=Si(function(e,t){var r=Es(t);return wa(r)&&(r=o),wa(e)?Kn(e,qn(t,1,wa,!0),Ko(r,2)):[]}),gs=Si(function(e,t){var r=Es(t);return wa(r)&&(r=o),wa(e)?Kn(e,qn(t,1,wa,!0),o,r):[]});function ms(e,t,r){var n=null==e?0:e.length;if(!n)return-1;var i=null==r?0:qa(r);return i<0&&(i=zr(n+i,0)),lr(e,Ko(t,3),i)}function bs(e,t,r){var n=null==e?0:e.length;if(!n)return-1;var i=n-1;return r!==o&&(i=qa(r),i=r<0?zr(n+i,0):Vr(i,n-1)),lr(e,Ko(t,3),i,!0)}function vs(e){return null!=e&&e.length?qn(e,1):[]}function _s(e){return e&&e.length?e[0]:o}var ws=Si(function(e){var t=nr(e,Ui);return t.length&&t[0]===e[0]?ei(t):[]}),Ss=Si(function(e){var t=Es(e),r=nr(e,Ui);return t===Es(r)?t=o:r.pop(),r.length&&r[0]===e[0]?ei(r,Ko(t,2)):[]}),ks=Si(function(e){var t=Es(e),r=nr(e,Ui);return(t="function"==typeof t?t:o)&&r.pop(),r.length&&r[0]===e[0]?ei(r,o,t):[]});function Es(e){var t=null==e?0:e.length;return t?e[t-1]:o}var As=Si(xs);function xs(e,t){return e&&e.length&&t&&t.length?mi(e,t):e}var Is=Co(function(e,t){var r=null==e?0:e.length,n=Pn(e,t);return bi(e,nr(t,function(e){return Go(e,r)?+e:e}).sort(Yi)),n});function Ts(e){return null==e?e:Yr.call(e)}var Bs=Si(function(e){return Ri(qn(e,1,wa,!0))}),Cs=Si(function(e){var t=Es(e);return wa(t)&&(t=o),Ri(qn(e,1,wa,!0),Ko(t,2))}),Ps=Si(function(e){var t=Es(e);return t="function"==typeof t?t:o,Ri(qn(e,1,wa,!0),o,t)});function Os(e){if(!e||!e.length)return[];var t=0;return e=er(e,function(e){if(wa(e))return t=zr(e.length,t),!0}),_r(t,function(t){return nr(e,gr(t))})}function Rs(e,t){if(!e||!e.length)return[];var r=Os(e);return null==t?r:nr(r,function(e){return Jt(t,o,e)})}var Ns=Si(function(e,t){return wa(e)?Kn(e,t):[]}),Ls=Si(function(e){return Mi(er(e,wa))}),Ks=Si(function(e){var t=Es(e);return wa(t)&&(t=o),Mi(er(e,wa),Ko(t,2))}),js=Si(function(e){var t=Es(e);return t="function"==typeof t?t:o,Mi(er(e,wa),o,t)}),Ms=Si(Os);var Ds=Si(function(e){var t=e.length,r=t>1?e[t-1]:o;return Rs(e,r="function"==typeof r?(e.pop(),r):o)});function Us(e){var t=pn(e);return t.__chain__=!0,t}function Fs(e,t){return t(e)}var qs=Co(function(e){var t=e.length,r=t?e[0]:0,n=this.__wrapped__,i=function(t){return Pn(t,e)};return!(t>1||this.__actions__.length)&&n instanceof mn&&Go(r)?((n=n.slice(r,+r+(t?1:0))).__actions__.push({func:Fs,args:[i],thisArg:o}),new gn(n,this.__chain__).thru(function(e){return t&&!e.length&&e.push(o),e})):this.thru(i)});var Hs=eo(function(e,t,r){ft.call(e,r)?++e[r]:Cn(e,r,1)});var zs=uo(ms),Vs=uo(bs);function Gs(e,t){return(ba(e)?Zt:jn)(e,Ko(t,3))}function Ws(e,t){return(ba(e)?function(e,t){for(var r=null==e?0:e.length;r--&&!1!==t(e[r],r,e););return e}:Mn)(e,Ko(t,3))}var $s=eo(function(e,t,r){ft.call(e,r)?e[r].push(t):Cn(e,r,[t])});var Ys=Si(function(e,t,r){var i=-1,o="function"==typeof t,s=_a(e)?n(e.length):[];return jn(e,function(e){s[++i]=o?Jt(t,e,r):ti(e,t,r)}),s}),Js=eo(function(e,t,r){Cn(e,r,t)});function Xs(e,t){return(ba(e)?nr:fi)(e,Ko(t,3))}var Zs=eo(function(e,t,r){e[r?0:1].push(t)},function(){return[[],[]]});var Qs=Si(function(e,t){if(null==e)return[];var r=t.length;return r>1&&Wo(e,t[0],t[1])?t=[]:r>2&&Wo(t[0],t[1],t[2])&&(t=[t[0]]),yi(e,qn(t,1),[])}),ea=Dt||function(){return Mt.Date.now()};function ta(e,t,r){return t=r?o:t,t=e&&null==t?e.length:t,ko(e,E,o,o,o,o,t)}function ra(e,t){var r;if("function"!=typeof t)throw new it(u);return e=qa(e),function(){return--e>0&&(r=t.apply(this,arguments)),e<=1&&(t=o),r}}var na=Si(function(e,t,r){var n=m;if(r.length){var i=Rr(r,Lo(na));n|=S}return ko(e,n,t,r,i)}),ia=Si(function(e,t,r){var n=m|b;if(r.length){var i=Rr(r,Lo(ia));n|=S}return ko(t,n,e,r,i)});function oa(e,t,r){var n,i,s,a,c,f,l=0,h=!1,p=!1,d=!0;if("function"!=typeof e)throw new it(u);function y(t){var r=n,s=i;return n=i=o,l=t,a=e.apply(s,r)}function g(e){var r=e-f;return f===o||r>=t||r<0||p&&e-l>=s}function m(){var e=ea();if(g(e))return b(e);c=os(m,function(e){var r=t-(e-f);return p?Vr(r,s-(e-l)):r}(e))}function b(e){return c=o,d&&n?y(e):(n=i=o,a)}function v(){var e=ea(),r=g(e);if(n=arguments,i=this,f=e,r){if(c===o)return function(e){return l=e,c=os(m,t),h?y(e):a}(f);if(p)return c=os(m,t),y(f)}return c===o&&(c=os(m,t)),a}return t=za(t)||0,Ta(r)&&(h=!!r.leading,s=(p="maxWait"in r)?zr(za(r.maxWait)||0,t):s,d="trailing"in r?!!r.trailing:d),v.cancel=function(){c!==o&&Vi(c),l=0,n=f=i=c=o},v.flush=function(){return c===o?a:b(ea())},v}var sa=Si(function(e,t){return Ln(e,1,t)}),aa=Si(function(e,t,r){return Ln(e,za(t)||0,r)});function ua(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new it(u);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(ua.Cache||_n),r}function ca(e){if("function"!=typeof e)throw new it(u);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)}}ua.Cache=_n;var fa=Hi(function(e,t){var r=(t=1==t.length&&ba(t[0])?nr(t[0],wr(Ko())):nr(qn(t,1),wr(Ko()))).length;return Si(function(n){for(var i=-1,o=Vr(n.length,r);++i<o;)n[i]=t[i].call(this,n[i]);return Jt(e,this,n)})}),la=Si(function(e,t){var r=Rr(t,Lo(la));return ko(e,S,o,t,r)}),ha=Si(function(e,t){var r=Rr(t,Lo(ha));return ko(e,k,o,t,r)}),pa=Co(function(e,t){return ko(e,A,o,o,o,t)});function da(e,t){return e===t||e!=e&&t!=t}var ya=bo(Xn),ga=bo(function(e,t){return e>=t}),ma=ri(function(){return arguments}())?ri:function(e){return Ba(e)&&ft.call(e,"callee")&&!At.call(e,"callee")},ba=n.isArray,va=zt?wr(zt):function(e){return Ba(e)&&Jn(e)==ce};function _a(e){return null!=e&&Ia(e.length)&&!Aa(e)}function wa(e){return Ba(e)&&_a(e)}var Sa=mr||zu,ka=Vt?wr(Vt):function(e){return Ba(e)&&Jn(e)==V};function Ea(e){if(!Ba(e))return!1;var t=Jn(e);return t==W||t==G||"string"==typeof e.message&&"string"==typeof e.name&&!Oa(e)}function Aa(e){if(!Ta(e))return!1;var t=Jn(e);return t==$||t==Y||t==H||t==te}function xa(e){return"number"==typeof e&&e==qa(e)}function Ia(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=N}function Ta(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}function Ba(e){return null!=e&&"object"==typeof e}var Ca=Gt?wr(Gt):function(e){return Ba(e)&&qo(e)==J};function Pa(e){return"number"==typeof e||Ba(e)&&Jn(e)==X}function Oa(e){if(!Ba(e)||Jn(e)!=Q)return!1;var t=wt(e);if(null===t)return!0;var r=ft.call(t,"constructor")&&t.constructor;return"function"==typeof r&&r instanceof r&&ct.call(r)==dt}var Ra=Wt?wr(Wt):function(e){return Ba(e)&&Jn(e)==re};var Na=$t?wr($t):function(e){return Ba(e)&&qo(e)==ne};function La(e){return"string"==typeof e||!ba(e)&&Ba(e)&&Jn(e)==ie}function Ka(e){return"symbol"==typeof e||Ba(e)&&Jn(e)==oe}var ja=Yt?wr(Yt):function(e){return Ba(e)&&Ia(e.length)&&!!Pt[Jn(e)]};var Ma=bo(ci),Da=bo(function(e,t){return e<=t});function Ua(e){if(!e)return[];if(_a(e))return La(e)?jr(e):Zi(e);if(Tt&&e[Tt])return function(e){for(var t,r=[];!(t=e.next()).done;)r.push(t.value);return r}(e[Tt]());var t=qo(e);return(t==J?Pr:t==ne?Lr:du)(e)}function Fa(e){return e?(e=za(e))===R||e===-R?(e<0?-1:1)*L:e==e?e:0:0===e?e:0}function qa(e){var t=Fa(e),r=t%1;return t==t?r?t-r:t:0}function Ha(e){return e?On(qa(e),0,j):0}function za(e){if("number"==typeof e)return e;if(Ka(e))return K;if(Ta(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=Ta(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=e.replace(Le,"");var r=Ge.test(e);return r||$e.test(e)?Lt(e.slice(2),r?2:8):Ve.test(e)?K:+e}function Va(e){return Qi(e,su(e))}function Ga(e){return null==e?"":Oi(e)}var Wa=to(function(e,t){if(Xo(t)||_a(t))Qi(t,ou(t),e);else for(var r in t)ft.call(t,r)&&xn(e,r,t[r])}),$a=to(function(e,t){Qi(t,su(t),e)}),Ya=to(function(e,t,r,n){Qi(t,su(t),e,n)}),Ja=to(function(e,t,r,n){Qi(t,ou(t),e,n)}),Xa=Co(Pn);var Za=Si(function(e,t){e=tt(e);var r=-1,n=t.length,i=n>2?t[2]:o;for(i&&Wo(t[0],t[1],i)&&(n=1);++r<n;)for(var s=t[r],a=su(s),u=-1,c=a.length;++u<c;){var f=a[u],l=e[f];(l===o||da(l,at[f])&&!ft.call(e,f))&&(e[f]=s[f])}return e}),Qa=Si(function(e){return e.push(o,Ao),Jt(uu,o,e)});function eu(e,t,r){var n=null==e?o:$n(e,t);return n===o?r:n}function tu(e,t){return null!=e&&Ho(e,t,Qn)}var ru=lo(function(e,t,r){null!=t&&"function"!=typeof t.toString&&(t=pt.call(t)),e[t]=r},Tu(Pu)),nu=lo(function(e,t,r){null!=t&&"function"!=typeof t.toString&&(t=pt.call(t)),ft.call(e,t)?e[t].push(r):e[t]=[r]},Ko),iu=Si(ti);function ou(e){return _a(e)?kn(e):ai(e)}function su(e){return _a(e)?kn(e,!0):ui(e)}var au=to(function(e,t,r){pi(e,t,r)}),uu=to(function(e,t,r,n){pi(e,t,r,n)}),cu=Co(function(e,t){var r={};if(null==e)return r;var n=!1;t=nr(t,function(t){return t=qi(t,e),n||(n=t.length>1),t}),Qi(e,Oo(e),r),n&&(r=Rn(r,h|p|d,xo));for(var i=t.length;i--;)Ni(r,t[i]);return r});var fu=Co(function(e,t){return null==e?{}:function(e,t){return gi(e,t,function(t,r){return tu(e,r)})}(e,t)});function lu(e,t){if(null==e)return{};var r=nr(Oo(e),function(e){return[e]});return t=Ko(t),gi(e,r,function(e,r){return t(e,r[0])})}var hu=So(ou),pu=So(su);function du(e){return null==e?[]:Sr(e,ou(e))}var yu=oo(function(e,t,r){return t=t.toLowerCase(),e+(r?gu(t):t)});function gu(e){return Eu(Ga(e).toLowerCase())}function mu(e){return(e=Ga(e))&&e.replace(Je,xr).replace(Et,"")}var bu=oo(function(e,t,r){return e+(r?"-":"")+t.toLowerCase()}),vu=oo(function(e,t,r){return e+(r?" ":"")+t.toLowerCase()}),_u=io("toLowerCase");var wu=oo(function(e,t,r){return e+(r?"_":"")+t.toLowerCase()});var Su=oo(function(e,t,r){return e+(r?" ":"")+Eu(t)});var ku=oo(function(e,t,r){return e+(r?" ":"")+t.toUpperCase()}),Eu=io("toUpperCase");function Au(e,t,r){return e=Ga(e),(t=r?o:t)===o?Cr(e)?Dr(e):cr(e):e.match(t)||[]}var xu=Si(function(e,t){try{return Jt(e,o,t)}catch(e){return Ea(e)?e:new Fe(e)}}),Iu=Co(function(e,t){return Zt(t,function(t){t=ls(t),Cn(e,t,na(e[t],e))}),e});function Tu(e){return function(){return e}}var Bu=co(),Cu=co(!0);function Pu(e){return e}function Ou(e){return si("function"==typeof e?e:Rn(e,h))}var Ru=Si(function(e,t){return function(r){return ti(r,e,t)}}),Nu=Si(function(e,t){return function(r){return ti(e,r,t)}});function Lu(e,t,r){var n=ou(t),i=Wn(t,n);null!=r||Ta(t)&&(i.length||!n.length)||(r=t,t=e,e=this,i=Wn(t,ou(t)));var o=!(Ta(r)&&"chain"in r&&!r.chain),s=Aa(e);return Zt(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__);return(r.__actions__=Zi(this.__actions__)).push({func:n,args:arguments,thisArg:e}),r.__chain__=t,r}return n.apply(e,ir([this.value()],arguments))})}),e}function Ku(){}var ju=po(nr),Mu=po(Qt),Du=po(ar);function Uu(e){return $o(e)?gr(ls(e)):function(e){return function(t){return $n(t,e)}}(e)}var Fu=mo(),qu=mo(!0);function Hu(){return[]}function zu(){return!1}var Vu=ho(function(e,t){return e+t},0),Gu=_o("ceil"),Wu=ho(function(e,t){return e/t},1),$u=_o("floor");var Yu,Ju=ho(function(e,t){return e*t},1),Xu=_o("round"),Zu=ho(function(e,t){return e-t},0);return pn.after=function(e,t){if("function"!=typeof t)throw new it(u);return e=qa(e),function(){if(--e<1)return t.apply(this,arguments)}},pn.ary=ta,pn.assign=Wa,pn.assignIn=$a,pn.assignInWith=Ya,pn.assignWith=Ja,pn.at=Xa,pn.before=ra,pn.bind=na,pn.bindAll=Iu,pn.bindKey=ia,pn.castArray=function(){if(!arguments.length)return[];var e=arguments[0];return ba(e)?e:[e]},pn.chain=Us,pn.chunk=function(e,t,r){t=(r?Wo(e,t,r):t===o)?1:zr(qa(t),0);var i=null==e?0:e.length;if(!i||t<1)return[];for(var s=0,a=0,u=n(qt(i/t));s<i;)u[a++]=xi(e,s,s+=t);return u},pn.compact=function(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},pn.concat=function(){var e=arguments.length;if(!e)return[];for(var t=n(e-1),r=arguments[0],i=e;i--;)t[i-1]=arguments[i];return ir(ba(r)?Zi(r):[r],qn(t,1))},pn.cond=function(e){var t=null==e?0:e.length,r=Ko();return e=t?nr(e,function(e){if("function"!=typeof e[1])throw new it(u);return[r(e[0]),e[1]]}):[],Si(function(r){for(var n=-1;++n<t;){var i=e[n];if(Jt(i[0],this,r))return Jt(i[1],this,r)}})},pn.conforms=function(e){return function(e){var t=ou(e);return function(r){return Nn(r,e,t)}}(Rn(e,h))},pn.constant=Tu,pn.countBy=Hs,pn.create=function(e,t){var r=dn(e);return null==t?r:Bn(r,t)},pn.curry=function e(t,r,n){var i=ko(t,_,o,o,o,o,o,r=n?o:r);return i.placeholder=e.placeholder,i},pn.curryRight=function e(t,r,n){var i=ko(t,w,o,o,o,o,o,r=n?o:r);return i.placeholder=e.placeholder,i},pn.debounce=oa,pn.defaults=Za,pn.defaultsDeep=Qa,pn.defer=sa,pn.delay=aa,pn.difference=ds,pn.differenceBy=ys,pn.differenceWith=gs,pn.drop=function(e,t,r){var n=null==e?0:e.length;return n?xi(e,(t=r||t===o?1:qa(t))<0?0:t,n):[]},pn.dropRight=function(e,t,r){var n=null==e?0:e.length;return n?xi(e,0,(t=n-(t=r||t===o?1:qa(t)))<0?0:t):[]},pn.dropRightWhile=function(e,t){return e&&e.length?Ki(e,Ko(t,3),!0,!0):[]},pn.dropWhile=function(e,t){return e&&e.length?Ki(e,Ko(t,3),!0):[]},pn.fill=function(e,t,r,n){var i=null==e?0:e.length;return i?(r&&"number"!=typeof r&&Wo(e,t,r)&&(r=0,n=i),function(e,t,r,n){var i=e.length;for((r=qa(r))<0&&(r=-r>i?0:i+r),(n=n===o||n>i?i:qa(n))<0&&(n+=i),n=r>n?0:Ha(n);r<n;)e[r++]=t;return e}(e,t,r,n)):[]},pn.filter=function(e,t){return(ba(e)?er:Fn)(e,Ko(t,3))},pn.flatMap=function(e,t){return qn(Xs(e,t),1)},pn.flatMapDeep=function(e,t){return qn(Xs(e,t),R)},pn.flatMapDepth=function(e,t,r){return r=r===o?1:qa(r),qn(Xs(e,t),r)},pn.flatten=vs,pn.flattenDeep=function(e){return null!=e&&e.length?qn(e,R):[]},pn.flattenDepth=function(e,t){return null!=e&&e.length?qn(e,t=t===o?1:qa(t)):[]},pn.flip=function(e){return ko(e,x)},pn.flow=Bu,pn.flowRight=Cu,pn.fromPairs=function(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},pn.functions=function(e){return null==e?[]:Wn(e,ou(e))},pn.functionsIn=function(e){return null==e?[]:Wn(e,su(e))},pn.groupBy=$s,pn.initial=function(e){return null!=e&&e.length?xi(e,0,-1):[]},pn.intersection=ws,pn.intersectionBy=Ss,pn.intersectionWith=ks,pn.invert=ru,pn.invertBy=nu,pn.invokeMap=Ys,pn.iteratee=Ou,pn.keyBy=Js,pn.keys=ou,pn.keysIn=su,pn.map=Xs,pn.mapKeys=function(e,t){var r={};return t=Ko(t,3),Vn(e,function(e,n,i){Cn(r,t(e,n,i),e)}),r},pn.mapValues=function(e,t){var r={};return t=Ko(t,3),Vn(e,function(e,n,i){Cn(r,n,t(e,n,i))}),r},pn.matches=function(e){return li(Rn(e,h))},pn.matchesProperty=function(e,t){return hi(e,Rn(t,h))},pn.memoize=ua,pn.merge=au,pn.mergeWith=uu,pn.method=Ru,pn.methodOf=Nu,pn.mixin=Lu,pn.negate=ca,pn.nthArg=function(e){return e=qa(e),Si(function(t){return di(t,e)})},pn.omit=cu,pn.omitBy=function(e,t){return lu(e,ca(Ko(t)))},pn.once=function(e){return ra(2,e)},pn.orderBy=function(e,t,r,n){return null==e?[]:(ba(t)||(t=null==t?[]:[t]),ba(r=n?o:r)||(r=null==r?[]:[r]),yi(e,t,r))},pn.over=ju,pn.overArgs=fa,pn.overEvery=Mu,pn.overSome=Du,pn.partial=la,pn.partialRight=ha,pn.partition=Zs,pn.pick=fu,pn.pickBy=lu,pn.property=Uu,pn.propertyOf=function(e){return function(t){return null==e?o:$n(e,t)}},pn.pull=As,pn.pullAll=xs,pn.pullAllBy=function(e,t,r){return e&&e.length&&t&&t.length?mi(e,t,Ko(r,2)):e},pn.pullAllWith=function(e,t,r){return e&&e.length&&t&&t.length?mi(e,t,o,r):e},pn.pullAt=Is,pn.range=Fu,pn.rangeRight=qu,pn.rearg=pa,pn.reject=function(e,t){return(ba(e)?er:Fn)(e,ca(Ko(t,3)))},pn.remove=function(e,t){var r=[];if(!e||!e.length)return r;var n=-1,i=[],o=e.length;for(t=Ko(t,3);++n<o;){var s=e[n];t(s,n,e)&&(r.push(s),i.push(n))}return bi(e,i),r},pn.rest=function(e,t){if("function"!=typeof e)throw new it(u);return Si(e,t=t===o?t:qa(t))},pn.reverse=Ts,pn.sampleSize=function(e,t,r){return t=(r?Wo(e,t,r):t===o)?1:qa(t),(ba(e)?function(e,t){return cs(Zi(e),On(t,0,e.length))}:function(e,t){var r=du(e);return cs(r,On(t,0,r.length))})(e,t)},pn.set=function(e,t,r){return null==e?e:ki(e,t,r)},pn.setWith=function(e,t,r,n){return n="function"==typeof n?n:o,null==e?e:ki(e,t,r,n)},pn.shuffle=function(e){return(ba(e)?function(e){return cs(Zi(e))}:function(e){return cs(du(e))})(e)},pn.slice=function(e,t,r){var n=null==e?0:e.length;return n?(r&&"number"!=typeof r&&Wo(e,t,r)?(t=0,r=n):(t=null==t?0:qa(t),r=r===o?n:qa(r)),xi(e,t,r)):[]},pn.sortBy=Qs,pn.sortedUniq=function(e){return e&&e.length?Ci(e):[]},pn.sortedUniqBy=function(e,t){return e&&e.length?Ci(e,Ko(t,2)):[]},pn.split=function(e,t,r){return r&&"number"!=typeof r&&Wo(e,t,r)&&(t=r=o),(r=r===o?j:r>>>0)?(e=Ga(e))&&("string"==typeof t||null!=t&&!Ra(t))&&!(t=Oi(t))&&Br(e)?zi(jr(e),0,r):e.split(t,r):[]},pn.spread=function(e,t){if("function"!=typeof e)throw new it(u);return t=null==t?0:zr(qa(t),0),Si(function(r){var n=r[t],i=zi(r,0,t);return n&&ir(i,n),Jt(e,this,i)})},pn.tail=function(e){var t=null==e?0:e.length;return t?xi(e,1,t):[]},pn.take=function(e,t,r){return e&&e.length?xi(e,0,(t=r||t===o?1:qa(t))<0?0:t):[]},pn.takeRight=function(e,t,r){var n=null==e?0:e.length;return n?xi(e,(t=n-(t=r||t===o?1:qa(t)))<0?0:t,n):[]},pn.takeRightWhile=function(e,t){return e&&e.length?Ki(e,Ko(t,3),!1,!0):[]},pn.takeWhile=function(e,t){return e&&e.length?Ki(e,Ko(t,3)):[]},pn.tap=function(e,t){return t(e),e},pn.throttle=function(e,t,r){var n=!0,i=!0;if("function"!=typeof e)throw new it(u);return Ta(r)&&(n="leading"in r?!!r.leading:n,i="trailing"in r?!!r.trailing:i),oa(e,t,{leading:n,maxWait:t,trailing:i})},pn.thru=Fs,pn.toArray=Ua,pn.toPairs=hu,pn.toPairsIn=pu,pn.toPath=function(e){return ba(e)?nr(e,ls):Ka(e)?[e]:Zi(fs(Ga(e)))},pn.toPlainObject=Va,pn.transform=function(e,t,r){var n=ba(e),i=n||Sa(e)||ja(e);if(t=Ko(t,4),null==r){var o=e&&e.constructor;r=i?n?new o:[]:Ta(e)&&Aa(o)?dn(wt(e)):{}}return(i?Zt:Vn)(e,function(e,n,i){return t(r,e,n,i)}),r},pn.unary=function(e){return ta(e,1)},pn.union=Bs,pn.unionBy=Cs,pn.unionWith=Ps,pn.uniq=function(e){return e&&e.length?Ri(e):[]},pn.uniqBy=function(e,t){return e&&e.length?Ri(e,Ko(t,2)):[]},pn.uniqWith=function(e,t){return t="function"==typeof t?t:o,e&&e.length?Ri(e,o,t):[]},pn.unset=function(e,t){return null==e||Ni(e,t)},pn.unzip=Os,pn.unzipWith=Rs,pn.update=function(e,t,r){return null==e?e:Li(e,t,Fi(r))},pn.updateWith=function(e,t,r,n){return n="function"==typeof n?n:o,null==e?e:Li(e,t,Fi(r),n)},pn.values=du,pn.valuesIn=function(e){return null==e?[]:Sr(e,su(e))},pn.without=Ns,pn.words=Au,pn.wrap=function(e,t){return la(Fi(t),e)},pn.xor=Ls,pn.xorBy=Ks,pn.xorWith=js,pn.zip=Ms,pn.zipObject=function(e,t){return Di(e||[],t||[],xn)},pn.zipObjectDeep=function(e,t){return Di(e||[],t||[],ki)},pn.zipWith=Ds,pn.entries=hu,pn.entriesIn=pu,pn.extend=$a,pn.extendWith=Ya,Lu(pn,pn),pn.add=Vu,pn.attempt=xu,pn.camelCase=yu,pn.capitalize=gu,pn.ceil=Gu,pn.clamp=function(e,t,r){return r===o&&(r=t,t=o),r!==o&&(r=(r=za(r))==r?r:0),t!==o&&(t=(t=za(t))==t?t:0),On(za(e),t,r)},pn.clone=function(e){return Rn(e,d)},pn.cloneDeep=function(e){return Rn(e,h|d)},pn.cloneDeepWith=function(e,t){return Rn(e,h|d,t="function"==typeof t?t:o)},pn.cloneWith=function(e,t){return Rn(e,d,t="function"==typeof t?t:o)},pn.conformsTo=function(e,t){return null==t||Nn(e,t,ou(t))},pn.deburr=mu,pn.defaultTo=function(e,t){return null==e||e!=e?t:e},pn.divide=Wu,pn.endsWith=function(e,t,r){e=Ga(e),t=Oi(t);var n=e.length,i=r=r===o?n:On(qa(r),0,n);return(r-=t.length)>=0&&e.slice(r,i)==t},pn.eq=da,pn.escape=function(e){return(e=Ga(e))&&xe.test(e)?e.replace(Ee,Ir):e},pn.escapeRegExp=function(e){return(e=Ga(e))&&Ne.test(e)?e.replace(Re,"\\$&"):e},pn.every=function(e,t,r){var n=ba(e)?Qt:Dn;return r&&Wo(e,t,r)&&(t=o),n(e,Ko(t,3))},pn.find=zs,pn.findIndex=ms,pn.findKey=function(e,t){return fr(e,Ko(t,3),Vn)},pn.findLast=Vs,pn.findLastIndex=bs,pn.findLastKey=function(e,t){return fr(e,Ko(t,3),Gn)},pn.floor=$u,pn.forEach=Gs,pn.forEachRight=Ws,pn.forIn=function(e,t){return null==e?e:Hn(e,Ko(t,3),su)},pn.forInRight=function(e,t){return null==e?e:zn(e,Ko(t,3),su)},pn.forOwn=function(e,t){return e&&Vn(e,Ko(t,3))},pn.forOwnRight=function(e,t){return e&&Gn(e,Ko(t,3))},pn.get=eu,pn.gt=ya,pn.gte=ga,pn.has=function(e,t){return null!=e&&Ho(e,t,Zn)},pn.hasIn=tu,pn.head=_s,pn.identity=Pu,pn.includes=function(e,t,r,n){e=_a(e)?e:du(e),r=r&&!n?qa(r):0;var i=e.length;return r<0&&(r=zr(i+r,0)),La(e)?r<=i&&e.indexOf(t,r)>-1:!!i&&hr(e,t,r)>-1},pn.indexOf=function(e,t,r){var n=null==e?0:e.length;if(!n)return-1;var i=null==r?0:qa(r);return i<0&&(i=zr(n+i,0)),hr(e,t,i)},pn.inRange=function(e,t,r){return t=Fa(t),r===o?(r=t,t=0):r=Fa(r),function(e,t,r){return e>=Vr(t,r)&&e<zr(t,r)}(e=za(e),t,r)},pn.invoke=iu,pn.isArguments=ma,pn.isArray=ba,pn.isArrayBuffer=va,pn.isArrayLike=_a,pn.isArrayLikeObject=wa,pn.isBoolean=function(e){return!0===e||!1===e||Ba(e)&&Jn(e)==z},pn.isBuffer=Sa,pn.isDate=ka,pn.isElement=function(e){return Ba(e)&&1===e.nodeType&&!Oa(e)},pn.isEmpty=function(e){if(null==e)return!0;if(_a(e)&&(ba(e)||"string"==typeof e||"function"==typeof e.splice||Sa(e)||ja(e)||ma(e)))return!e.length;var t=qo(e);if(t==J||t==ne)return!e.size;if(Xo(e))return!ai(e).length;for(var r in e)if(ft.call(e,r))return!1;return!0},pn.isEqual=function(e,t){return ni(e,t)},pn.isEqualWith=function(e,t,r){var n=(r="function"==typeof r?r:o)?r(e,t):o;return n===o?ni(e,t,o,r):!!n},pn.isError=Ea,pn.isFinite=function(e){return"number"==typeof e&&Fr(e)},pn.isFunction=Aa,pn.isInteger=xa,pn.isLength=Ia,pn.isMap=Ca,pn.isMatch=function(e,t){return e===t||ii(e,t,Mo(t))},pn.isMatchWith=function(e,t,r){return r="function"==typeof r?r:o,ii(e,t,Mo(t),r)},pn.isNaN=function(e){return Pa(e)&&e!=+e},pn.isNative=function(e){if(Jo(e))throw new Fe(a);return oi(e)},pn.isNil=function(e){return null==e},pn.isNull=function(e){return null===e},pn.isNumber=Pa,pn.isObject=Ta,pn.isObjectLike=Ba,pn.isPlainObject=Oa,pn.isRegExp=Ra,pn.isSafeInteger=function(e){return xa(e)&&e>=-N&&e<=N},pn.isSet=Na,pn.isString=La,pn.isSymbol=Ka,pn.isTypedArray=ja,pn.isUndefined=function(e){return e===o},pn.isWeakMap=function(e){return Ba(e)&&qo(e)==ae},pn.isWeakSet=function(e){return Ba(e)&&Jn(e)==ue},pn.join=function(e,t){return null==e?"":qr.call(e,t)},pn.kebabCase=bu,pn.last=Es,pn.lastIndexOf=function(e,t,r){var n=null==e?0:e.length;if(!n)return-1;var i=n;return r!==o&&(i=(i=qa(r))<0?zr(n+i,0):Vr(i,n-1)),t==t?function(e,t,r){for(var n=r+1;n--;)if(e[n]===t)return n;return n}(e,t,i):lr(e,dr,i,!0)},pn.lowerCase=vu,pn.lowerFirst=_u,pn.lt=Ma,pn.lte=Da,pn.max=function(e){return e&&e.length?Un(e,Pu,Xn):o},pn.maxBy=function(e,t){return e&&e.length?Un(e,Ko(t,2),Xn):o},pn.mean=function(e){return yr(e,Pu)},pn.meanBy=function(e,t){return yr(e,Ko(t,2))},pn.min=function(e){return e&&e.length?Un(e,Pu,ci):o},pn.minBy=function(e,t){return e&&e.length?Un(e,Ko(t,2),ci):o},pn.stubArray=Hu,pn.stubFalse=zu,pn.stubObject=function(){return{}},pn.stubString=function(){return""},pn.stubTrue=function(){return!0},pn.multiply=Ju,pn.nth=function(e,t){return e&&e.length?di(e,qa(t)):o},pn.noConflict=function(){return Mt._===this&&(Mt._=yt),this},pn.noop=Ku,pn.now=ea,pn.pad=function(e,t,r){e=Ga(e);var n=(t=qa(t))?Kr(e):0;if(!t||n>=t)return e;var i=(t-n)/2;return yo(Ht(i),r)+e+yo(qt(i),r)},pn.padEnd=function(e,t,r){e=Ga(e);var n=(t=qa(t))?Kr(e):0;return t&&n<t?e+yo(t-n,r):e},pn.padStart=function(e,t,r){e=Ga(e);var n=(t=qa(t))?Kr(e):0;return t&&n<t?yo(t-n,r)+e:e},pn.parseInt=function(e,t,r){return r||null==t?t=0:t&&(t=+t),Wr(Ga(e).replace(Ke,""),t||0)},pn.random=function(e,t,r){if(r&&"boolean"!=typeof r&&Wo(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=Fa(e),t===o?(t=e,e=0):t=Fa(t)),e>t){var n=e;e=t,t=n}if(r||e%1||t%1){var i=$r();return Vr(e+i*(t-e+Nt("1e-"+((i+"").length-1))),t)}return vi(e,t)},pn.reduce=function(e,t,r){var n=ba(e)?or:br,i=arguments.length<3;return n(e,Ko(t,4),r,i,jn)},pn.reduceRight=function(e,t,r){var n=ba(e)?sr:br,i=arguments.length<3;return n(e,Ko(t,4),r,i,Mn)},pn.repeat=function(e,t,r){return t=(r?Wo(e,t,r):t===o)?1:qa(t),wi(Ga(e),t)},pn.replace=function(){var e=arguments,t=Ga(e[0]);return e.length<3?t:t.replace(e[1],e[2])},pn.result=function(e,t,r){var n=-1,i=(t=qi(t,e)).length;for(i||(i=1,e=o);++n<i;){var s=null==e?o:e[ls(t[n])];s===o&&(n=i,s=r),e=Aa(s)?s.call(e):s}return e},pn.round=Xu,pn.runInContext=e,pn.sample=function(e){return(ba(e)?En:function(e){return En(du(e))})(e)},pn.size=function(e){if(null==e)return 0;if(_a(e))return La(e)?Kr(e):e.length;var t=qo(e);return t==J||t==ne?e.size:ai(e).length},pn.snakeCase=wu,pn.some=function(e,t,r){var n=ba(e)?ar:Ii;return r&&Wo(e,t,r)&&(t=o),n(e,Ko(t,3))},pn.sortedIndex=function(e,t){return Ti(e,t)},pn.sortedIndexBy=function(e,t,r){return Bi(e,t,Ko(r,2))},pn.sortedIndexOf=function(e,t){var r=null==e?0:e.length;if(r){var n=Ti(e,t);if(n<r&&da(e[n],t))return n}return-1},pn.sortedLastIndex=function(e,t){return Ti(e,t,!0)},pn.sortedLastIndexBy=function(e,t,r){return Bi(e,t,Ko(r,2),!0)},pn.sortedLastIndexOf=function(e,t){if(null!=e&&e.length){var r=Ti(e,t,!0)-1;if(da(e[r],t))return r}return-1},pn.startCase=Su,pn.startsWith=function(e,t,r){return e=Ga(e),r=null==r?0:On(qa(r),0,e.length),t=Oi(t),e.slice(r,r+t.length)==t},pn.subtract=Zu,pn.sum=function(e){return e&&e.length?vr(e,Pu):0},pn.sumBy=function(e,t){return e&&e.length?vr(e,Ko(t,2)):0},pn.template=function(e,t,r){var n=pn.templateSettings;r&&Wo(e,t,r)&&(t=o),e=Ga(e),t=Ya({},t,n,Eo);var i,s,a=Ya({},t.imports,n.imports,Eo),u=ou(a),c=Sr(a,u),f=0,l=t.interpolate||Xe,h="__p += '",p=rt((t.escape||Xe).source+"|"+l.source+"|"+(l===Be?He:Xe).source+"|"+(t.evaluate||Xe).source+"|$","g"),d="//# sourceURL="+("sourceURL"in t?t.sourceURL:"lodash.templateSources["+ ++Ct+"]")+"\n";e.replace(p,function(t,r,n,o,a,u){return n||(n=o),h+=e.slice(f,u).replace(Ze,Tr),r&&(i=!0,h+="' +\n__e("+r+") +\n'"),a&&(s=!0,h+="';\n"+a+";\n__p += '"),n&&(h+="' +\n((__t = ("+n+")) == null ? '' : __t) +\n'"),f=u+t.length,t}),h+="';\n";var y=t.variable;y||(h="with (obj) {\n"+h+"\n}\n"),h=(s?h.replace(_e,""):h).replace(we,"$1").replace(Se,"$1;"),h="function("+(y||"obj")+") {\n"+(y?"":"obj || (obj = {});\n")+"var __t, __p = ''"+(i?", __e = _.escape":"")+(s?", __j = Array.prototype.join;\nfunction print() { __p += __j.call(arguments, '') }\n":";\n")+h+"return __p\n}";var g=xu(function(){return Qe(u,d+"return "+h).apply(o,c)});if(g.source=h,Ea(g))throw g;return g},pn.times=function(e,t){if((e=qa(e))<1||e>N)return[];var r=j,n=Vr(e,j);t=Ko(t),e-=j;for(var i=_r(n,t);++r<e;)t(r);return i},pn.toFinite=Fa,pn.toInteger=qa,pn.toLength=Ha,pn.toLower=function(e){return Ga(e).toLowerCase()},pn.toNumber=za,pn.toSafeInteger=function(e){return e?On(qa(e),-N,N):0===e?e:0},pn.toString=Ga,pn.toUpper=function(e){return Ga(e).toUpperCase()},pn.trim=function(e,t,r){if((e=Ga(e))&&(r||t===o))return e.replace(Le,"");if(!e||!(t=Oi(t)))return e;var n=jr(e),i=jr(t);return zi(n,Er(n,i),Ar(n,i)+1).join("")},pn.trimEnd=function(e,t,r){if((e=Ga(e))&&(r||t===o))return e.replace(je,"");if(!e||!(t=Oi(t)))return e;var n=jr(e);return zi(n,0,Ar(n,jr(t))+1).join("")},pn.trimStart=function(e,t,r){if((e=Ga(e))&&(r||t===o))return e.replace(Ke,"");if(!e||!(t=Oi(t)))return e;var n=jr(e);return zi(n,Er(n,jr(t))).join("")},pn.truncate=function(e,t){var r=I,n=T;if(Ta(t)){var i="separator"in t?t.separator:i;r="length"in t?qa(t.length):r,n="omission"in t?Oi(t.omission):n}var s=(e=Ga(e)).length;if(Br(e)){var a=jr(e);s=a.length}if(r>=s)return e;var u=r-Kr(n);if(u<1)return n;var c=a?zi(a,0,u).join(""):e.slice(0,u);if(i===o)return c+n;if(a&&(u+=c.length-u),Ra(i)){if(e.slice(u).search(i)){var f,l=c;for(i.global||(i=rt(i.source,Ga(ze.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(Oi(i),u)!=u){var p=c.lastIndexOf(i);p>-1&&(c=c.slice(0,p))}return c+n},pn.unescape=function(e){return(e=Ga(e))&&Ae.test(e)?e.replace(ke,Mr):e},pn.uniqueId=function(e){var t=++lt;return Ga(e)+t},pn.upperCase=ku,pn.upperFirst=Eu,pn.each=Gs,pn.eachRight=Ws,pn.first=_s,Lu(pn,(Yu={},Vn(pn,function(e,t){ft.call(pn.prototype,t)||(Yu[t]=e)}),Yu),{chain:!1}),pn.VERSION="4.17.10",Zt(["bind","bindKey","curry","curryRight","partial","partialRight"],function(e){pn[e].placeholder=pn}),Zt(["drop","take"],function(e,t){mn.prototype[e]=function(r){r=r===o?1:zr(qa(r),0);var n=this.__filtered__&&!t?new mn(this):this.clone();return n.__filtered__?n.__takeCount__=Vr(r,n.__takeCount__):n.__views__.push({size:Vr(r,j),type:e+(n.__dir__<0?"Right":"")}),n},mn.prototype[e+"Right"]=function(t){return this.reverse()[e](t).reverse()}}),Zt(["filter","map","takeWhile"],function(e,t){var r=t+1,n=r==P||3==r;mn.prototype[e]=function(e){var t=this.clone();return t.__iteratees__.push({iteratee:Ko(e,3),type:r}),t.__filtered__=t.__filtered__||n,t}}),Zt(["head","last"],function(e,t){var r="take"+(t?"Right":"");mn.prototype[e]=function(){return this[r](1).value()[0]}}),Zt(["initial","tail"],function(e,t){var r="drop"+(t?"":"Right");mn.prototype[e]=function(){return this.__filtered__?new mn(this):this[r](1)}}),mn.prototype.compact=function(){return this.filter(Pu)},mn.prototype.find=function(e){return this.filter(e).head()},mn.prototype.findLast=function(e){return this.reverse().find(e)},mn.prototype.invokeMap=Si(function(e,t){return"function"==typeof e?new mn(this):this.map(function(r){return ti(r,e,t)})}),mn.prototype.reject=function(e){return this.filter(ca(Ko(e)))},mn.prototype.slice=function(e,t){e=qa(e);var r=this;return r.__filtered__&&(e>0||t<0)?new mn(r):(e<0?r=r.takeRight(-e):e&&(r=r.drop(e)),t!==o&&(r=(t=qa(t))<0?r.dropRight(-t):r.take(t-e)),r)},mn.prototype.takeRightWhile=function(e){return this.reverse().takeWhile(e).reverse()},mn.prototype.toArray=function(){return this.take(j)},Vn(mn.prototype,function(e,t){var r=/^(?:filter|find|map|reject)|While$/.test(t),n=/^(?:head|last)$/.test(t),i=pn[n?"take"+("last"==t?"Right":""):t],s=n||/^find/.test(t);i&&(pn.prototype[t]=function(){var t=this.__wrapped__,a=n?[1]:arguments,u=t instanceof mn,c=a[0],f=u||ba(t),l=function(e){var t=i.apply(pn,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 mn(this);var g=e.apply(t,a);return g.__actions__.push({func:Fs,args:[l],thisArg:o}),new gn(g,h)}return d&&y?e.apply(this,a):(g=this.thru(l),d?n?g.value()[0]:g.value():g)})}),Zt(["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);pn.prototype[e]=function(){var e=arguments;if(n&&!this.__chain__){var i=this.value();return t.apply(ba(i)?i:[],e)}return this[r](function(r){return t.apply(ba(r)?r:[],e)})}}),Vn(mn.prototype,function(e,t){var r=pn[t];if(r){var n=r.name+"";(nn[n]||(nn[n]=[])).push({name:t,func:r})}}),nn[fo(o,b).name]=[{name:"wrapper",func:o}],mn.prototype.clone=function(){var e=new mn(this.__wrapped__);return e.__actions__=Zi(this.__actions__),e.__dir__=this.__dir__,e.__filtered__=this.__filtered__,e.__iteratees__=Zi(this.__iteratees__),e.__takeCount__=this.__takeCount__,e.__views__=Zi(this.__views__),e},mn.prototype.reverse=function(){if(this.__filtered__){var e=new mn(this);e.__dir__=-1,e.__filtered__=!0}else(e=this.clone()).__dir__*=-1;return e},mn.prototype.value=function(){var e=this.__wrapped__.value(),t=this.__dir__,r=ba(e),n=t<0,i=r?e.length:0,o=function(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=Vr(t,e+s);break;case"takeRight":e=zr(e,t-s)}}return{start:e,end:t}}(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=Vr(u,this.__takeCount__);if(!r||!n&&i==u&&p==u)return ji(e,this.__actions__);var d=[];e:for(;u--&&h<p;){for(var y=-1,g=e[c+=t];++y<l;){var m=f[y],b=m.iteratee,v=m.type,_=b(g);if(v==O)g=_;else if(!_){if(v==P)continue e;break e}}d[h++]=g}return d},pn.prototype.at=qs,pn.prototype.chain=function(){return Us(this)},pn.prototype.commit=function(){return new gn(this.value(),this.__chain__)},pn.prototype.next=function(){this.__values__===o&&(this.__values__=Ua(this.value()));var e=this.__index__>=this.__values__.length;return{done:e,value:e?o:this.__values__[this.__index__++]}},pn.prototype.plant=function(e){for(var t,r=this;r instanceof yn;){var n=ps(r);n.__index__=0,n.__values__=o,t?i.__wrapped__=n:t=n;var i=n;r=r.__wrapped__}return i.__wrapped__=e,t},pn.prototype.reverse=function(){var e=this.__wrapped__;if(e instanceof mn){var t=e;return this.__actions__.length&&(t=new mn(this)),(t=t.reverse()).__actions__.push({func:Fs,args:[Ts],thisArg:o}),new gn(t,this.__chain__)}return this.thru(Ts)},pn.prototype.toJSON=pn.prototype.valueOf=pn.prototype.value=function(){return ji(this.__wrapped__,this.__actions__)},pn.prototype.first=pn.prototype.head,Tt&&(pn.prototype[Tt]=function(){return this}),pn}();Mt._=Ur,(i=function(){return Ur}.call(t,r,t,n))===o||(n.exports=i)}).call(this)}).call(this,r(6),r(27)(e))},function(e,t,r){"use strict";const n=r(60),i=r(23),o=r(1379),s=r(200).OFFLINE_ERROR;e.exports=function(e){return{peers:i((t,r)=>{if("function"==typeof t&&(r=t,t={}),!e.isOnline())return r(new Error(s));const n=t.v||t.verbose,i=[];o(e._peerInfoBook.getAll()).forEach(e=>{const t=e.isConnected();if(!t)return;const r={addr:t,peer:e.id};n&&(r.latency="unknown"),i.push(r)}),r(null,i)}),addrs:i(t=>{if(!e.isOnline())return t(new Error(s));t(null,o(e._peerInfoBook.getAll()))}),localAddrs:i(t=>{if(!e.isOnline())return t(new Error(s));t(null,e._libp2pNode.peerInfo.multiaddrs.toArray())}),connect:i((t,r)=>{if(!e.isOnline())return r(new Error(s));"string"==typeof t&&(t=n(t)),e._libp2pNode.dial(t,r)}),disconnect:i((t,r)=>{if(!e.isOnline())return r(new Error(s));"string"==typeof t&&(t=n(t)),e._libp2pNode.hangUp(t,r)}),filters:i(e=>e(new Error("Not implemented")))}}},function(e,t,r){var n=r(1380),i=r(359);e.exports=function(e){return null==e?[]:n(e,i(e))}},function(e,t,r){var n=r(222);e.exports=function(e,t){return n(t,function(t){return e[t]})}},function(e,t,r){"use strict";const n=r(23),i=r(70);e.exports=function(e){return n((t,r,n)=>{i(e.pingPullStream(t,r),i.collect(n))})}},function(e,t,r){"use strict";const n=r(1),i=r(200).OFFLINE_ERROR,o=r(110),s=r(8),a=r(46),u=r(4),c=n("jsipfs:pingPullStream");function f(e){return Object.assign({success:!0,time:0,text:""},e)}c.error=n("jsipfs:pingPullStream:error"),e.exports=function(e){return(t,r)=>{if(!e.isOnline())return s.error(new Error(i));r=Object.assign({count:10},r);const n=a();return u([r=>(function(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)})(e._libp2pNode,n,t,r),(t,i)=>(function(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>=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()})})(e._libp2pNode,n,r.count,t,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(140);e.exports=function(e){return(t,r)=>n.source(e.pingPullStream(t,r))}},function(e,t,r){"use strict";(function(t){const n=r(23),{DAGNode:i,DAGLink:o}=r(45),s=r(9),a=r(279),{Key:u}=r(34),c=r(1385),{resolvePath:f}=r(200),l=300,h=new u("/local/pins");function p(e){return new s(e).toBaseEncodedString()}e.exports=(e=>{const r=e._repo,u=e.dag,d=c(u),y={direct:"direct",recursive:"recursive",indirect:"indirect",all:"all"};let g=new Set,m=new Set;const b=()=>Array.from(g).map(e=>new s(e).buffer),v=()=>Array.from(m).map(e=>new s(e).buffer);function _(n){let c,f,l;a.series([e=>a.waterfall([e=>d.storeSet(b(),e),(e,t)=>o.create(y.direct,e.size,e.multihash,t),(e,t)=>{c=e,t(null)}],e),e=>a.waterfall([e=>d.storeSet(v(),e),(e,t)=>o.create(y.recursive,e.size,e.multihash,t),(e,t)=>{f=e,t(null)}],e),e=>i.create(t.alloc(0),(t,r)=>{if(t)return e(t);u.put(r,{cid:new s(r.multihash)},e)}),e=>i.create(t.alloc(0),[c,f],(t,r)=>{if(t)return e(t);l=r,u.put(l,{cid:new s(l.multihash)},e)}),e=>r.closed?r.open(e):e(null,null),e=>r.datastore.put(h,l.multihash,e)],(t,r)=>t?n(t):(e.log(`Flushed pins with root: ${l}`),n(null,l)))}const w={add:n((t,r,n)=>{"function"==typeof r&&(n=r,r=null);const i=!r||r.recursive;f(e.object,t,(e,t)=>{if(e)return n(e);a.map(t,(e,t)=>{const r=p(e);if(i){if(m.has(r))return t(null,r);u._getRecursive(r,e=>e?t(e):t(null,r))}else{if(m.has(r))return t(new Error(`${r} already pinned recursively`));if(g.has(r))return t(null,r);u.get(new s(e),e=>e?t(e):t(null,r))}},(e,t)=>{if(e)return n(e);const r=i?m:g;t.forEach(e=>r.add(e)),_((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),f(e.object,t,(t,r)=>{if(t)return n(t);a.map(r,(e,t)=>{w._isPinnedWithType(e,y.all,(r,n)=>{if(r)return t(r);const{pinned:o,reason:s}=n,a=p(e);if(!o)return t(new Error(`${a} is not pinned`));switch(s){case y.recursive:return i?t(null,a):t(new Error(`${a} is pinned recursively`));case y.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&&m.has(e)?m.delete(e):g.delete(e)}),_((t,i)=>t?n(t):(e.log(`Removed pins: ${r}`),n(null,r.map(e=>({hash:e})))))})})}),ls:n((t,r,n)=>{let i=y.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&&(i=r.type.toLowerCase()),!y[i])return n(new Error(`Invalid type '${i}', must be one of {direct, indirect, recursive, all}`));if(t)f(e.object,t,(e,t)=>{if(e)return n(e);a.mapSeries(t,(e,t)=>{w._isPinnedWithType(e,y.all,(r,n)=>{if(r)return t(r);const{pinned:i,reason:o}=n,s=p(e);if(!i)return t(new Error(`Path ${s} is not pinned`));switch(o){case y.direct:case y.recursive:return t(null,{hash:s,type:o});default:return t(null,{hash:s,type:`${y.indirect} through ${o}`})}})},n)});else{let e=[];if(i!==y.direct&&i!==y.all||(e=e.concat(Array.from(g).map(e=>({type:y.direct,hash:e})))),i!==y.recursive&&i!==y.all||(e=e.concat(Array.from(m).map(e=>({type:y.recursive,hash:e})))),i!==y.indirect&&i!==y.all)return n(null,e);!function(e){const t=new Set;a.eachLimit(v(),l,(e,r)=>{u._getRecursive(e,(e,n)=>{if(e)return r(e);n.map(({multihash:e})=>p(e)).filter(e=>!m.has(e)).forEach(e=>t.add(e)),r()})},r=>{if(r)return e(r);e(null,Array.from(t))})}((t,r)=>t?n(t):(e=e.filter(({hash:e})=>!r.includes(e)||r.includes(e)&&!g.has(e)).concat(r.map(e=>({type:y.indirect,hash:e}))),n(null,e)))}}),_isPinnedWithType:n((e,t,r)=>{const n=p(e),{recursive:i,direct:o,all:c}=y;if((t===i||t===c)&&m.has(n))return r(null,{pinned:!0,reason:i});if(t===i)return r(null,{pinned:!1});if((t===o||t===c)&&g.has(n))return r(null,{pinned:!0,reason:o});if(t===o)return r(null,{pinned:!1});let f;a.someLimit(v(),l,(t,r)=>{u.get(new s(t),(t,n)=>{if(t)return r(t);d.hasDescendant(n.value,e,(e,t)=>{t&&(f=p(n.value.multihash)),r(e,t)})})},(e,t)=>e?r(e):r(null,{pinned:t,reason:f}))}),_load:n(t=>{a.waterfall([e=>r.closed?r.datastore.open(e):e(null,null),(e,t)=>r.datastore.has(h,t),(e,t)=>e?t():t(new Error("No pins to load")),e=>r.datastore.get(h,e),(e,t)=>u.get(new s(e),t)],(r,n)=>{if(r)return"No pins to load"===r.message?(e.log("No pins to load"),t()):t(r);a.parallel([e=>d.loadSet(n.value,y.recursive,e),e=>d.loadSet(n.value,y.direct,e)],(r,n)=>{if(r)return t(r);const[i,o]=n;return g=new Set(o.map(p)),m=new Set(i.map(p)),e.log("Loaded pins from the datastore"),t(null)})})})};return w})}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(t){const n=r(12),i=r(9),o=r(10),s=r(1386),a=r(20),{DAGNode:u,DAGLink:c}=r(45),f=r(279),l=r(1387),h=n.fromB58String("QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n"),p=256,d=8192,y=o(l);function g(e){return new i(e).toBaseEncodedString()}function m(e,r){const n=t.alloc(4);n.writeUInt32LE(e,0);const i=t.concat([n,t.from(g(r))]);return s(i.toString("binary"))}e.exports=function(e){const r={hasDescendant:(r,n,o)=>{const s={};return(i.isCID(n)||t.isBuffer(n))&&(n=g(n)),function t(r,i){f.some(r.links,({multihash:r},i)=>{const o=g(r);return o===n?i(null,!0):o in s?i(null,!1):(s[o]=!0,void e.get(r,(e,r)=>{if(e)return i(e);t(r.value,i)}))},i)}(r,o)},storeSet:(t,n)=>{const o=t.map(e=>({key:e,data:null}));r.storeItems(o,(t,r)=>{if(t)return n(t);const o={cid:new i(r.multihash)};e.put(r,o,(e,t)=>{if(e)return n(e);n(null,r)})})},storeItems:(r,n)=>{return function r(n,o,s){const l=y.Set.encode({version:1,fanout:p,seed:o}),g=t.concat([t.from(a.encode(l.length)),l]),b=[];for(let e=0;e<p;e++)b.push(new c("",1,h));if(n.length<=d){const e=n.map(e=>({link:new c("",1,e.key),data:e.data||t.alloc(0)})).sort((e,r)=>t.compare(e.link.multihash,r.link.multihash)),r=b.concat(e.map(e=>e.link)),i=t.concat([g].concat(e.map(e=>e.data)));u.create(i,r,(e,t)=>e?s(e):s(null,t))}else{const e=n.reduce((e,t)=>{const r=m(o,t.key)%p;return e[r]=r in e?e[r].concat([t]):[t],e},{});f.eachOf(e,(e,t,n)=>{r(e,o+1,(e,r)=>v(e,r,t,n))},e=>{if(e)return s(e);u.create(g,b,(e,t)=>e?s(e):s(null,t))})}function v(t,r,n,o){if(t)return o(t);e.put(r,{cid:new i(r._multihash)},e=>{if(e)return o(e);b[n]=new c("",r.size,r.multihash),o(null)})}}(r,0,n)},loadSet:(t,n,i)=>{const o=t.links.find(e=>e.name===n);if(!o)return i(new Error("No link found with name "+n));e.get(o.multihash,(e,t)=>{if(e)return i(e);const n=[];r.walkItems(t.value,e=>n.push(e.multihash),e=>e?i(e):i(null,n))})},walkItems:(t,n,i)=>{let o;try{o=function(e){const t=e.data,r=a.decode(t),n=a.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=y.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)}}(t)}catch(e){return i(e)}f.eachOf(t.links,(t,i,s)=>{if(i<o.header.fanout){const i=t.multihash;if(!h.equals(i))return e.get(i,(e,t)=>{if(e)return s(e);r.walkItems(t.value,n,s)})}else n(t,i,o.data);s(null)},i)}};return r}}).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(145),o=i.importer,s=i.exporter,a=r(23),u=r(8),c=r(1419),f=r(46),l=r(140),h=r(192),p=r(224),d=r(4),y=r(595),g=r(596).isSource,m=r(22).Duplex,b=r(0).Buffer,v=r(9),_=r(12).toB58String,w="wrapper/";function S(){}function k(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(w.length):r.path||o,hash:o,size:e.size})}],n)}function E(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=w+r.path),r})}function A(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){function r(t){const r=Object.assign({},{shardSplitThreshold:e._options.EXPERIMENTAL.sharding?1e3:1/0},t);r.hashAlg&&1!==r.cidVersion&&(r.cidVersion=1);let n=0;const i=r.progress||S;return r.progress=(e=>{i(n+=e)}),u(u.map(E.bind(null,r)),u.flatten(),o(e._ipld,r),u.asyncMap(k.bind(null,e,r)),u.asyncMap(function(e,t,r,n){const i=!("pin"in t)||t.pin,o=!r.path.includes("/");if(i&&o&&!t.onlyHash&&!t.hashAlg)return e.pin.add(r.hash,e=>n(e,r));n(null,r)}.bind(null,e,r)))}function i(t,r){if("function"==typeof t)throw new Error("You must supply an ipfsPath");const n=A((t=A(t)).split("/").slice(1).join("/")),i=e=>n&&e.path===n||e.path===t,o=p.source();return u(s(t,e._ipld,r),u.collect((e,t)=>{if(e)return o.abort(e);if(t&&t.length>1&&(t=t.filter(i)),!t||!t.length)return o.abort(new Error("No such file"));const r=t[0],n=r.content;if(!n&&"dir"===r.type)return o.abort(new Error("this dag node is a directory"));o.resolve(n)})),o}function h(t,r){const i=A(t),o=r&&r.recursive,a=i.split("/").length,c=o?n.Infinity:a,f=Object.assign({},{maxDepth:c},r);return u(s(t,e._ipld,f),u.filter(e=>o?e.depth>=a:e.depth===a),u.map(e=>{const t=new v(e.hash);return delete(e=Object.assign({},e,{hash:t.toBaseEncodedString()})).content,e}))}return{add:(()=>{const e=a((e,n={},i)=>{if("function"==typeof n?(i=n,n={}):i&&"function"==typeof i||(i=S),!(t.isBuffer(e)||y.readable(e)||Array.isArray(e)||b.isBuffer(e)||"object"==typeof e||g(e)))return i(new Error("first arg must be a buffer, readable stream, pull stream, an object or array of objects"));n.hashAlg&&1!==n.cidVersion&&(n.cidVersion=1),u(u.values([e]),r(n),c((e,t)=>e.path<t.path?1:e.path>t.path?-1:0),u.collect(i))});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(),n=new class 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;)this._waitingPullFlush.shift()();e?e instanceof Error&&this.emit("error",e):this.push(t)})}_write(e,t,r){this._waitingPullFlush.push(r),this._pushable.push(e)}}(u(t,r(e)),t);return n.once("finish",()=>t.end()),n},addPullStream:r,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(i(e,r),u.collect((e,r)=>{if(e)return n(e);n(null,t.concat(r))}))}),catReadableStream:(e,t)=>l.source(i(e,t)),catPullStream:(e,t)=>i(e,t),get:a((r,n,i)=>{if("function"==typeof n&&(i=n,n={}),"function"!=typeof i)throw new Error("Please supply a callback to ipfs.files.get");u(s(r,e._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:(t,r)=>l.source(u(s(t,e._ipld,r),u.map(e=>(e.content&&(e.content=l.source(e.content),e.content.pause()),e)))),getPullStream:(t,r)=>s(t,e._ipld,r),lsImmutable:a((e,t,r)=>{"function"==typeof t&&(r=t,t={}),u(h(e,t),u.collect((e,t)=>{e?r(e):r(null,t)}))}),lsReadableStreamImmutable:(e,t)=>l.source(h(e,t)),lsPullStreamImmutable:h}}}).call(this,r(0).Buffer,r(6))},function(e,t,r){"use strict";(function(t){const n=r(594),i=r(8),o=r(201),s=r(46),a=r(17),u=r(3),c=r(1391),f=r(1400),l={fixed:r(1409)},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||t.nextTick(()=>{for(;g.length;)g.shift()()}),e)),_),{sink:m.sink,source:_.source,flush:function(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(7))},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(17),i=r(1392),o=r(1393),s={flat:r(1395),balanced:r(1396),trickle:r(1398)},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(46),i=r(201);e.exports=function(e,t,r){const o=n(),s=i(e(o),null,r.highWaterMark,e=>o.end(e));return{source:o,sink:s}}},function(e,t,r){"use strict";(function(t){const n=r(273),i=r(35),o=r(8),s=r(202),a=r(63),u=r(4),c=r(45),f=r(9),l=r(65),h=r(1394),p=c.DAGNode,d={chunkerOptions:{maxChunkSize:262144},rawLeaves:!1,hashAlg:"sha2-256",leafType:"file",cidVersion:0};e.exports=function(e,r,c,y){const g=n({},d,y);return g.cidVersion=g.cidVersion||g.cidVersion,g.hashAlg=g.hashAlg||d.hashAlg,"sha2-256"!==g.hashAlg&&(g.cidVersion=1),function(e){return function(t,n){a(t.map(t=>n=>{if(!t.content)return function(e,t){const n=new i("directory");u([e=>p.create(n.marshal(),[],g.hashAlg,e),(e,t)=>{if(g.onlyHash)return t(null,e);e.cid=new f(g.cidVersion,"dag-pb",e.multihash),r.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})})}(t,(t,r)=>{if(t)return n(t);r&&e.push(r),n()});m(t,(t,r)=>{if(t)return n(t);r&&e.push(r),n()})}),n)}};function m(n,a){if(t.isBuffer(n.content)&&(n.content=o.values([n.content])),"function"!=typeof n.content)return a(new Error("invalid content"));const u=c(h(n,r,g),g);let d,y=0;o(n.content,e(g.chunkerOptions),o.map(e=>(g.progress&&"function"==typeof g.progress&&g.progress(e.byteLength),t.from(e))),o.asyncMap((e,t)=>{if(g.rawLeaves)return l(e,g.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(g.leafType,e);p.create(r.marshal(),[],g.hashAlg,(e,n)=>{if(e)return t(e);t(null,{multihash:n.multihash,size:n.size,leafSize:r.fileSize(),cid:new f(g.cidVersion,"dag-pb",n.multihash),data:n})})}),o.asyncMap((e,t)=>{if(g.onlyHash)return t(null,e);r.put(e.data,{cid:e.cid},r=>t(r,e))}),o.map(e=>({path:n.path,multihash:e.cid.buffer,size:e.size,leafSize:e.leafSize,name:"",cid:e.cid})),s(function(e){y++,d&&this.queue(d),d=e},function(){d&&(1===y&&(d.single=!0),this.queue(d)),this.queue(null)}),u,o.collect((e,t)=>{e?a(e):a(null,t[0])}))}}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";const n=r(4),i=r(45),o=r(35),s=r(9),a=i.DAGLink,u=i.DAGNode;e.exports=function(e,t,r){return function(i,c){if(1===i.length&&i[0].single&&r.reduceSingleLeafToSelf){const a=i[0];return"file"!==r.leafType||r.rawLeaves?n([e=>t.get(a.cid,e),(e,t)=>{const n=e.value.data,i=new o("file",n);u.create(i.marshal(),[],r.hashAlg,(e,r)=>{t(e,{DAGNode:r,fileNode:i})})},(e,n)=>{if(r.onlyHash)return n(null,e);let i=new s(e.DAGNode.multihash);1===r.cidVersion&&(i=i.toV1()),t.put(e.DAGNode,{cid:i},t=>n(t,e))},(t,r)=>{r(null,{path:e.path,multihash:t.DAGNode.multihash,size:t.DAGNode.size,leafSize:t.fileNode.fileSize(),name:a.name})}],c):c(null,{path:e.path,multihash:a.multihash,size:a.size,leafSize:a.leafSize,name:a.name})}const f=new o("file"),l=i.map(e=>{f.addBlockSize(e.leafSize);let t=e.cid;return t||(t=new s(r.cidVersion,"dag-pb",e.multihash)),new a(e.name,e.size,t.buffer)});n([e=>u.create(f.marshal(),l,r.hashAlg,e),(e,n)=>{const i=new s(r.cidVersion,"dag-pb",e.multihash);if(r.onlyHash)return n(null,{node:e,cid:i});t.put(e,{cid:i},t=>n(t,{node:e,cid:i}))}],(t,r)=>{if(t)return c(t);c(null,{name:"",path:e.path,multihash:r.cid.buffer,size:r.node.size,leafSize:f.fileSize()})})}}},function(e,t,r){"use strict";const n=r(8),i=r(46),o=r(194),s=r(322);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(1397),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(46),o=r(194),s=r(322);e.exports=function(e,t){const r=o(),a=r.source,u=i();return function r(i,o){let a=i;Array.isArray(a)&&(a=n.values(a)),n(a,s(t.maxChildrenPerNode),n.asyncMap(e),n.collect(function(e,t){e?o(e):t.length>1?r(t,o):o(null,t)}))}(a,(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(1399),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(46),o=r(322),s=r(194),a=r(202),u=r(201),c=r(594);e.exports=function(e,t){const r=s(),f=i(),l=c(()=>{});let h=0;return n(r.source,l,function(r,s){let c,f=0,d=0,y=!1;const g=i();return{source:g,sink:u(function(t,s){let u=!1;const f=t[0];d&&!c&&(c=i(),n(c,p(r+1,d-1),a(function(e){this.queue(e)},function(e){e?this.emit("error",e):(u||(u=!0,h++,l.pause()),this.queue(null))}),o(1/0),n.asyncMap(e),n.collect((e,t)=>{h--,e?g.end(e):(t.forEach(e=>{g.push(e)}),m())}))),c?c.push(f):(g.push(f),m()),s()},null,1,function(e){e?g.end(e):c?y||(y=!0,c.end()):g.end()})};function m(){c=null,f++,(0===d&&f===t.maxChildrenPerNode||d>0&&f===t.layerRepeat)&&(f=0,d++),(!y&&s>=0&&d>s||y&&!h)&&(y=!0,g.end()),h||l.resume()}}(0,-1),o(1/0),n.asyncMap(e),n.collect((e,t)=>{e?f.end(e):1===t.length?(f.push(t[0]),f.end()):t.length>1?f.end(new Error("expected a maximum of 1 roots and got "+t.length)):f.end()})),{sink:r.sink,source:f};function p(r,s){let c=0,f=0,d,y=!1;const g=i();return{source:g,sink:u(m,null,1,v)};function m(t,s){let u=!1;const c=t[0];f&&!d&&(d=i(),n(d,p(r+1,f-1),a(function(e){this.queue(e)},function(e){e?this.emit("error",e):(u||(u=!0,h++,l.pause()),this.queue(null))}),o(1/0),n.asyncMap(e),n.collect((e,t)=>{h--,e?g.end(e):(t.forEach(e=>{g.push(e)}),b())}))),d?d.push(c):(g.push(c),b()),s()}function b(){d=null,c++,(0===f&&c===t.maxChildrenPerNode||f>0&&c===t.layerRepeat)&&(c=0,f++),(!y&&s>=0&&f>s||y&&!h)&&(y=!0,g.end()),h||l.resume()}function v(e){e?g.end(e):d?y||(y=!0,d.end()):g.end()}}}},function(e,t,r){"use strict";(function(t){const n=r(188),i=r(215),o=r(4),s=r(162),a=r(201),u=r(46),c=r(1401),f=r(1402),l=r(323);e.exports=function(e,r){const d=Object.assign({},h,r),y=s(function(e,t){const r=e.args.concat(function(){e.cb.apply(null,arguments),t()});e.fn.apply(null,r)},1);let g=function(){const e=a(function(e,r){n(e,(e,r)=>{y.push({fn:b,args:[e],cb:n=>{n?r(n):(t.push(e),r())}})},r)},null,1,function(e){v(r=>{t.end(r||e)})}),t=u();return{sink:e,source:t}}(),m=c({path:"",root:!0,dir:!0,dirty:!1,flat:!0},d);return{flush:v,stream:function(){return g}};function b(e,t){const r=(e.path||"").split("/").filter(p);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,d.shardSplitThreshold,d,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},d));const s=n;n=o,s.put(t,o,i)})},t)}function v(e){y.push({fn:_,args:["",m],cb:(t,r)=>{t?e(t):e(null,r&&r.multihash)}})}function _(e,r,n){if(r.dir){if(r.root&&r.childCount()>1&&!d.wrap)return void n(new Error("detected more than one root"));r.eachChildSeries((t,r,n)=>{_(e?e+"/"+t:t,r,n)},t=>{t?n(t):w(e,r,n)})}else t.nextTick(n)}function w(t,r,n){!r.root||d.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)})}};const h={wrap:!1,shardSplitThreshold:1e3,onlyHash:!1};function p(e){return Boolean(e)}}).call(this,r(7))},function(e,t,r){"use strict";(function(t){const n=r(188),i=r(4),o=r(9),s=r(45),a=r(35),u=s.DAGLink,c=s.DAGNode,f=r(323);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)}}e.exports=function(e,t){return new l(e,t)}}).call(this,r(7))},function(e,t,r){"use strict";const n=r(4),i=r(1403);function o(e,t,r,n){e.flat&&e.directChildrenCount()>=t?function(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,r,n):n(null,e)}e.exports=function e(t,r,i,s,a){o(r,i,s,(o,u)=>{if(o)return void a(o);const c=u.parent;c?n([e=>{u!==r?(t&&(t.parent=u),c.put(u.parentKey,u,e)):e()},t=>{c?e(u,c,i,s,t):t(null,u)}],a):a(null,u)})}},function(e,t,r){"use strict";(function(t){const n=r(370),i=r(37),o=r(4),s=r(9),a=r(45),u=r(35),c=a.DAGLink,f=a.DAGNode,l=r(65),h=r(323),p=r(1404),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){m(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,r,a,l,h,d){const y=r._children;let g=0;const b=[];function v(t,r,i){const o=n(r.toString(16).toUpperCase(),2,"0");if(p.isBucket(t))m(e,t,a,l,null,(e,t)=>{e?i(e):(b.push(new c(o,t.size,t.multihash)),i())});else{const e=t.value,r=o+t.key;b.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):_(b)})}e.exports=function(e,t){return new g(e,t)}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";const n=r(1405);e.exports=function(e){return new n(e)},e.exports.isBucket=n.isBucket},function(e,t,r){"use strict";(function(t){const n=r(1406),i=r(80),o=r(188),s=r(1407),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){!function e(t,r,n,o){i(t._children.compactArray(),(i,o)=>{i instanceof u?e(i,r,n,o):r(i,(e,r)=>{e?o(e):o(null,{bitField:t._children.bitField(),children:r})})},(e,t)=>{e?o(e):n(t,o)})}(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{t(null,{bucket:this,pos:n,hash:r})}})}_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}e.exports=u}).call(this,r(7))},function(e,t,r){"use strict";function n(e,t){return e+i(t)}function i(e){let t=e;return 16843009*((t=(858993459&(t-=t>>1&1431655765))+(t>>2&858993459))+(t>>4)&252645135)>>24}function o(e,t){return e[0]-t[0]}function s(e){return e[1]}e.exports=class{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;){n=e(n,this.get(r),r),r++}return n}find(e){let t,r,n=0;for(;n<this.length&&!t;)t=e(r=this.get(n)),n++;return t?r:void 0}_internalPositionFor(e,t){const r=this._bytePosFor(e,t);if(r>=this._bitArrays.length)return-1;const o=this._bitArrays[r],s=e-7*r;return(o&1<<s)>0?this._bitArrays.slice(0,r).reduce(n,0)+i(o&~(4294967295<<s+1))-1:-1}_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(o)}bitField(){const e=[];let t,r=8,n=0,i=0;const o=this._bitArrays.slice();for(;o.length||n;){0===n&&(t=o.shift(),n=7);const s=Math.min(n,r);i|=(t&~(255<<s))<<8-r,t>>>=s,n-=s,(r-=s)&&(n||o.length)||(e.push(i),i=0,r=8)}for(var s=e.length-1;s>0;s--){if(0!==e[s])break;e.pop()}return e}compactArray(){return this._sortData(),this._data.map(s)}}},function(e,t,r){"use strict";(function(t,n){const i=r(37),o=r(1408);e.exports=function(e){return function(t){return t instanceof s?t:new s(t,e)}};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(7))},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){return(e&s(t,r))>>>t}function s(e,t){return n[e]&i[Math.min(t+e-1,7)]}e.exports=class{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);r=(r<<i)+o(e,n-i,i),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=r(1410);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(202);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){var s;r||(r={}),"object"==typeof e&&(e=(r=e).size),e=e||512,s=!r.nopad&&(void 0===r.zeroPadding||r.zeroPadding);var a=[],u=0,c=0,f=!1;return n(function(r){for("number"==typeof r&&(r=t.from([r])),u+=r.length,a.push(r);u>=e;){for(var n,s,l,h=0,p=[],d=0;h<e;)n=a[d],s=Math.min(c+e-h,n.length),h+=(l=o(n,c,s)).length,p.push(l),s===n.length?(d++,c=0):c+=l.length;a=a.slice(d),u-=h,this.queue(i(p)),f=!0}},function(n){if(r.emitEmpty&&!f||u){if(s){var o=t.alloc(e-u);o.fill(0),a.push(o)}a&&(a.length>0&&(a[0]=a[0].slice(c)),this.queue(i(a)),a=null)}this.queue(null)})}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(t){const n=r(8),i=r(9),o=r(1412).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{base:r=new i(r).toBaseEncodedString(),rest:n.split("/").filter(Boolean)}}const a={maxDepth:1/0,offset:void 0,length:void 0};e.exports=((e,t,r)=>{let u;r=Object.assign({},a,r);try{u=s(e)}catch(e){return n.error(e)}const c=function(e){return e.reduce((e,t)=>(e.length&&(e+="/"),e+t),"")}([u.base].concat(u.rest.slice(0,u.rest.length-1))).length;return n(n.values([{multihash:new i(u.base),name:u.base,path:u.base,pathRest:u.rest,depth:0}]),o(t,r),n.filter(Boolean),n.map(e=>({depth:e.depth,name:e.name,path:function(e){if(!u.rest.length)return e.path;let t=e.path.substring(c);return"/"===t.charAt(0)&&(t=t.substring(1)),t||(t=u.rest[u.rest.length-1]||u.base),t}(e),size:e.size,hash:e.hash||e.multihash,content:e.content,type:e.type})))})}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(t){const n=r(35),i=r(8),o=r(324),s=r(9),a={directory:r(1414),"hamt-sharded-directory":r(1415),file:r(1417),object:r(1418)};function u(e){return t.isBuffer(e.data)?n.unmarshal(e.data).type:"object"}function c(e){return e}e.exports=Object.assign({createResolver:function e(t,r,n,f){return n||(n=0),n>r.maxDepth?i.map(c):i(o((e,n)=>"number"!=typeof e.depth?i.error(new Error("no depth")):e.object?n(null,l(e.object,e,r.offset,r.length)):void t.get(new s(e.multihash),(t,i)=>{if(t)return n(t);n(null,l(i.value,e,r.offset,r.length))})),i.flatten(),i.filter(Boolean),i.filter(e=>e.depth<=r.maxDepth));function l(e,r,n,i){return h(e,r.name,r.path,r.pathRest,r.size,t,r.parent||f,r.depth,n,i)}function h(t,n,o,s,c,f,l,h,p,d){const y=u(t),g=a[y];return g?g(t,n,o,s,e(f,r,h,t),c,f,l,h,p,d):i.error(new Error("Unkown node type "+y))}},typeOf:u},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(141);e.exports=function(e,t,r,o,s,a,u,c,f){const l=o[0],h={name:t,depth:f,path:r,hash:e.multihash,size:e.size,type:"dir"},p=[n(n.values(e.links),n.map(e=>({depth:f+1,size:e.size,name:e.name,path:r+"/"+e.name,multihash:e.multihash,linkName:e.name,pathRest:o.slice(1),type:"dir"})),n.filter(e=>void 0===l||e.linkName===l),s)];return o.length||p.unshift(n.values([h])),i(p)}},function(e,t,r){"use strict";const n=r(8),i=r(141),o=r(1416);e.exports=function(e,t,r,s,a,u,c,f,l){let h;f&&f.path===r||(h={name:t,depth:l,path:r,hash:o(e.multihash),size:e.size,type:"dir"});const p=[n(n.values(e.links),n.map(e=>{const t=e.name.substring(2),n=t?r+"/"+t:r;let i=!0;return t&&s.length&&(i=t===s[0]),i?{depth:l+1,name:t,path:n,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)}},function(e,t,r){"use strict";(function(t){const n=r(12);e.exports=(e=>t.isBuffer(e)?n.toB58String(e):e)}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(t){const n=r(225),i=r(35),o=r(9),s=r(8),a=r(324);function u(e,r,u,f,l){if(f===u||0===l)return s.once(t.alloc(0));const h=f+l;let p=0;return s(n.depthFirst({node:r,start:0,end:u},function({node:r}){if(t.isBuffer(r))return s.empty();const n=i.unmarshal(r.data);Boolean(n.data&&n.data.length)&&r.links.length&&(p+=n.data.length);const u=r.links.map((e,t)=>{const r={link:e,start:p,end:p+n.blockSizes[t]};return p=r.end,r}).filter(e=>f>=e.start&&f<e.end||h>e.start&&h<=e.end||f<e.start&&h>e.end);return u.length&&(p=u[0].start),s(s.values(u),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}))}))}),s.map(function({node:e,start:r}){try{if(t.isBuffer(e))return c(e,r,f,h);const n=i.unmarshal(e.data);return n.data?c(n.data,r,f,h):t.alloc(0)}catch(e){throw new Error(`Failed to unmarshal node - ${e.message}`)}}),s.filter(Boolean))}function c(e,r,n,i){const o=e.length;return n>=r+o?t.alloc(0):(i-r<o&&(e=e.slice(0,i-r)),n>r&&n<r+o&&(e=e.slice(n-r)),e)}e.exports=((e,r,n,o,a,c,f,l,h,p,d)=>{const y=o[0];if(void 0!==y&&y!==n)return s.empty();const g=i.unmarshal(e.data),m=c||g.fileSize();if(p<0)return s.error(new Error("Offset must be greater than 0"));if(p>m)return s.error(new Error("Offset must be less than the file size"));if(d<0)return s.error(new Error("Length must be greater than or equal to 0"));if(0===d)return s.once(t.alloc(0));p||(p=0),(!d||p+d>m)&&(d=m-p);const b=u(f,e,m,p,d);return s.values([{depth:h,content:b,name:r,path:n,hash:e.multihash,size:m,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)=>{let l;if(o.length){const t=o[0],a=r+"/"+t;if(!(l=e[t]))return i.error("not found");const u=n.isCID(l);return i(i.values([{depth:f,name:t,path:a,pathRest:o.slice(1),multihash:u&&l,object:!u&&l,parent:c}]),s)}return i.error(new Error("invalid node type"))})},function(e,t,r){var n=r(161),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(23),i=r(3);e.exports=function(e){return{subscribe:(t,r,n,i)=>{if("function"==typeof n&&(i=n,n={}),!i)return new Promise((i,o)=>{e._libp2pNode.pubsub.subscribe(t,n,r,e=>{if(e)return o(e);i()})});e._libp2pNode.pubsub.subscribe(t,n,r,i)},unsubscribe:(t,r,n)=>{if(e._libp2pNode.pubsub.unsubscribe(t,r),!n)return Promise.resolve();i(()=>n())},publish:n((t,r,n)=>{e._libp2pNode.pubsub.publish(t,r,n)}),ls:n(t=>{e._libp2pNode.pubsub.ls(t)}),peers:n((t,r)=>{e._libp2pNode.pubsub.peers(t,r)}),setMaxListeners(t){e._libp2pNode.pubsub.setMaxListeners(t)}}}},function(e,t,r){"use strict";(function(t){const n=r(23),i=r(1422),o=r(110),s=r(9),a=r(50);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)=>{"string"==typeof t&&(t=new s(t)),e._libp2pNode.contentRouting.findProviders(t,r)}),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=s(r(562)),i=s(r(164)),o=s(r(1423));function s(e){return e&&e.__esModule?e:{default:e}}t.default=(0,i.default)((0,n.default)(o.default,o.default)),e.exports=t.default},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){return!e},e.exports=t.default},function(e,t,r){"use strict";const n=r(1425),i=r(23);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)=>{let n=`https://ipfs.io/api/v0/dns?arg=${e=encodeURIComponent(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(23);e.exports=function(e){return{gen:n((t,r,n)=>{e._keychain.createKey(t,r.type,r.size,n)}),info:n((t,r)=>{e._keychain.findKeyByName(t,r)}),list:n(t=>{e._keychain.listKeys(t)}),rm:n((t,r)=>{e._keychain.removeKey(t,r)}),rename:n((t,r,n)=>{e._keychain.renameKey(t,r,(e,r)=>{if(e)return n(e);const i={was:t,now:r.name,id:r.id,overwrite:!1};n(null,i)})}),import:n((t,r,n,i)=>{e._keychain.importKey(t,r,n,i)}),export:n((t,r,n)=>{e._keychain.exportKey(t,r,n)})}}},function(e,t,r){"use strict";const n=r(23),i=r(122),o=r(46),s=r(1428),a=r(140);function u(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({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)}):r({totalIn:new i(0),totalOut:new i(0),rateIn:new i(0),rateOut:new i(0)})})}e.exports=function(e){const t=t=>{t=t||{};let r=null,n=o(!0,()=>{r&&clearInterval(r)});return t.poll?s(t.interval||"1s",(i,o)=>{if(i)throw i;r=setInterval(()=>{u(e,t).then(e=>n.push(e)).catch(e=>n.end(e))},o)}):u(e,t).then(e=>{n.push(e),n.end()}).catch(e=>n.end(e)),n.source};return{bitswap:r(597)(e).stat,repo:r(510)(e).stat,bw:n((t,r)=>{"function"==typeof t&&(r=t,t={}),u(e,t).then(e=>r(null,e)).catch(e=>r(e))}),bwReadableStream:e=>a.source(t(e)),bwPullStream:t}}},function(e,t,r){"use strict";const n=r(23),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};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+function(e){let t=e.match(s)[0];return e=e.substring(0,e.length-t.length),parseFloat(e)*a[t]}(t),0)):t(new Error("invalid time"))})},function(e,t,r){"use strict";e.exports=r(1430)},function(e,t,r){"use strict";const n=r(23),{createLock:i}=r(48),o={ls:r(1457),read:r(1458),readPullStream:r(326),readReadableStream:r(1459),stat:r(606)},s={cp:r(607),flush:r(1460),mkdir:r(1461),mv:r(1462),rm:r(608),write:r(1463)},a=(e,t,r,i)=>{Object.keys(r).forEach(o=>{r.hasOwnProperty(o)&&(t[o]=n(i(r[o](e))))})},u={repoOwner:!0};e.exports=((e,t)=>{const{repoOwner:r}=Object.assign({},u||{},t),n=i(r),c={};return a(e,c,o,e=>n.readLock(e)),a(e,c,s,e=>n.writeLock(e)),c})},function(e,t,r){"use strict";(function(t){e.exports=(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])).length<i)return n(i,o);const a=r.slice(0,i);r=r.slice(i),o(null,a)})};return n})}).call(this,r(0).Buffer)},function(e,t,r){"use strict";const n=r(350);e.exports=(e=>{let t=0;return n(e=>{t+=e.length},()=>{e(t)})})},function(e,t,r){"use strict";const n=r(1434),i=r(1)("ipfs:mfs:lock");e.exports=(e=>{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)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`),o)return o(t);throw i(`Callback already invoked for ${e} operation`),t})};return{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)})}})},function(e,t,r){(function(t){const n=r(1435),i=r(1445),o=r(1446),{timeout:s}=r(1447),a=r(600),u={};let c;const f={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({},f,t),c||(c=n(t)||i(t)).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]=((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){const e=n=new o({concurrency:t.concurrency,autoStart:!1});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)))}})(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(6))},function(e,t,r){(function(t){const n=r(11).EventEmitter,i=r(598),{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(599);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(1444),!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(7))},function(e,t,r){"use strict";var n=r(203),i=r(1438),o=r(1442),s=r(1443)||0;function a(){return i(s)}e.exports=a,e.exports.generate=a,e.exports.seed=function(t){return n.seed(t),e.exports},e.exports.worker=function(t){return s=t,e.exports},e.exports.characters=function(e){return void 0!==e&&n.characters(e),n.shuffled()},e.exports.isValid=o},function(e,t,r){"use strict";var n=1;e.exports={nextValue:function(){return(n=(9301*n+49297)%233280)/233280},seed:function(e){n=e}}},function(e,t,r){"use strict";var n,i,o=r(1439),s=(r(203),1459707606518),a=6;e.exports=function(e){var t="",r=Math.floor(.001*(Date.now()-s));return r===i?n++:(n=0,i=r),t+=o(a),t+=o(e),n>0&&(t+=o(n)),t+o(r)}},function(e,t,r){"use strict";var n=r(203),i=r(1440),o=r(1441);e.exports=function(e){for(var t,r=0,s="";!t;)s+=o(i,n.get(),1),t=e<Math.pow(16,r+1),r++;return s}},function(e,t,r){"use strict";var n,i="object"==typeof window&&(window.crypto||window.msCrypto);n=i&&i.getRandomValues?function(e){return i.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=n},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]).length===r)return o}}},function(e,t,r){"use strict";var n=r(203);e.exports=function(e){return!(!e||"string"!=typeof e||e.length<6||new RegExp("[^"+n.get().replace(/[|\\{}()[\]^$+*?.-]/g,"\\$&")+"]").test(e))}},function(e,t,r){"use strict";e.exports=0},function(e,t){},function(e,t,r){(function(t){const n=r(11).EventEmitter,i=r(598),{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(599),l=r(600),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=>{if(!!(e=Object.assign({},d,e)).global.document||e.singleProcess){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(6))},function(e,t,r){"use strict";class n{constructor(){this._queue=[]}enqueue(e,t){const r={priority:(t=Object.assign({priority:0},t)).priority,run:e};if(this.size&&this._queue[this.size-1].priority>=t.priority)return void this._queue.push(r);const n=function(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}(this._queue,r,(e,t)=>t.priority-e.priority);this._queue.splice(n,0,r)}dequeue(){return this._queue.shift().run}get size(){return this._queue.length}}e.exports=class{constructor(e){if(!("number"==typeof(e=Object.assign({concurrency:1/0,autoStart:!0,queueClass:n},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}}},function(e,t,r){"use strict";var n;e.exports.timeout=function(e,t){var r,i=new n;return Promise.race([e,new Promise(function(e,n){r=setTimeout(function(){n(i)},t)})]).then(function(e){return clearTimeout(r),e},function(e){throw clearTimeout(r),e})};(n=e.exports.TimeoutError=function(){Error.call(this),this.stack=Error().stack,this.message="Timeout"}).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(153),i=r(602);e.exports=(e=>{let t=0;return n((r,n)=>{t>e&&i(n),t+r.length>e&&(r=r.slice(0,e-t)),t+=r.length,n(null,r)})})},function(e,t,r){"use strict";const n=r(4),i=r(9),o=r(1)("ipfs:mfs:utils:load-node");e.exports=((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)})},function(e,t,r){"use strict";const n=r(603);e.exports=function(e,t){const{sources:r,options:i,callback:o}=n(e,t);return{sources:r,destination:r.pop(),options:i,callback:o}}},function(e,t,r){"use strict";const n=r(9),i=r(1)("ipfs:mfs:utils:traverse-to"),o=r(35),s=r(4),a=r(1453),u=r(604),c=r(605),f=r(325),{FILE_SEPARATOR:l}=r(146),h=r(601),p={parents:!1,flush:!0,createLastComponent:!1,withCreateHint:!0},d=(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)},y=(e,t,r,c)=>{s([t=>u(e,t),(u,c)=>{const p=t.path.split(l).filter(Boolean),d=[];s([t=>e.dag.get(u,t),(u,c)=>{const y=u.value;d.push({name:l,node:y,parent:null}),a(p.map((e,t)=>({pathSegment:e,index:t})),{name:l,node:y,parent:null},(a,{pathSegment:u,index:c},l)=>{const y=a.node.links.find(e=>e.name===u);if(!y){const y=c===p.length-1;if(i(`index ${c} pathSegments.length ${p.length} pathSegment ${u} lastComponent ${y}`,r),y&&!r.createLastComponent)return l(new Error(`Path ${t.path} did not exist`));if(!y&&!r.parents){let e=`Cannot find ${t.path} - ${u} did not exist`;return r.withCreateHint&&(e+=": Try again with the --parents flag to create it"),l(new Error(e))}return 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)=>{d.push(t),l(e,t)})}let g=y.hash||y.multihash;const m=new n(g);e.dag.get(m,(e,t)=>{if(e)return l(e);const r=t.value,n={name:u,node:r,parent:a};d.push(n),l(null,n)})},c)}],c)}],c)};e.exports=((e,t,r,n)=>{r=Object.assign({},p,r),i("Traversing to",t),s([e=>c(t,e),(t,n)=>"mfs"===t.type?y(e,t,r,n):d(e,t,r,n)],n)})},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e,t,r,a){a=(0,o.default)(a||i.default);var u=(0,s.default)(r);(0,n.default)(e,function(e,r,n){u(t,e,function(e,r){t=r,n(e)})},function(e){a(e,t)})};var n=a(r(215)),i=a(r(62)),o=a(r(156)),s=a(r(36));function a(e){return e&&e.__esModule?e:{default:e}}e.exports=t.default},function(e,t,r){"use strict";const n=r(1)("ipfs:mfs:utils:update-mfs:root"),i=r(4),o=r(9),{MFS_ROOT_KEY:s}=r(146);e.exports=((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))})},function(e,t,r){"use strict";const n=r(352),i=r(325);e.exports=((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)})},function(e,t,r){"use strict";(function(t){e.exports=((e=1/0,r=4096)=>{let n=0;return(i,o)=>{if(i)return o&&o(i);if(n>=e)return o(!0);let s=r;n+s>e&&(s=e-n),n+=s,o(null,t.alloc(s,0))}})}).call(this,r(0).Buffer)},function(e,t,r){"use strict";const n=r(4),i=r(80),o=r(35),{traverseTo:s,loadNode:a,formatCid:u,FILE_SEPARATOR:c,FILE_TYPES:f}=r(48),l={long:!1,cidBase:"base58btc"};e.exports=(e=>(function(t,r,h){"function"==typeof t&&(h=t,t=c,r={}),"function"==typeof r&&(h=r,r={}),(r=Object.assign({},l,r)).long=r.l||r.long,n([r=>s(e,t,{},r),(t,s)=>{const c=o.unmarshal(t.node.data);"directory"===c.type?i(t.node.links,(t,i)=>{n([r=>a(e,t,r),(e,n)=>{const i=o.unmarshal(e.data);n(null,{name:t.name,type:i.type,hash:u(e.multihash,r.cidBase),size:i.fileSize()||0})}],i)},s):s(null,[{name:t.name,type:c.type,hash:u(t.node.multihash,r.cidBase),size:c.fileSize()||0}])},(e,t)=>t(null,e.map(e=>(f.hasOwnProperty(e.type)&&(e.type=f[e.type]),r.long||(e.type=0,e.size=0,e.hash=""),e))),(e,t)=>{if(r.long)return t(null,e.sort((e,t)=>t.name.localeCompare(e.name)));t(null,e)}],h)}))},function(e,t,r){"use strict";(function(t){const n=r(70),i=r(87),o=r(4),s=r(326);e.exports=(e=>(function(r,a,u){"function"==typeof a&&(u=a,a={}),o([t=>s(e)(r,a,t),(e,t)=>n(e,i(t)),(e,r)=>{r(null,t.concat(e))}],u)}))}).call(this,r(0).Buffer)},function(e,t,r){"use strict";const n=r(4),i=r(326),o=r(140);e.exports=(e=>(function(t,r,s){"function"==typeof r&&(s=r,r={}),n([n=>i(e)(t,r,n),(e,t)=>t(null,o.source(e))],s)}))},function(e,t,r){"use strict";const n=r(4),{traverseTo:i,FILE_SEPARATOR:o}=r(48),s={};e.exports=(e=>(function(t,r,a){"function"==typeof r&&(a=r,r={}),"function"==typeof t&&(a=t,r={},t=o),t||(t=o),r=Object.assign({},s,r),n([r=>i(e,t,{},r),(e,t)=>{t()}],a)}))},function(e,t,r){"use strict";const n=r(4),i=r(1)("ipfs:mfs:mkdir"),{updateMfsRoot:o,updateTree:s,traverseTo:a,FILE_SEPARATOR:u}=r(48),c={parents:!1,hash:void 0,cidVersion:0};e.exports=(e=>(function(t,r,f){return"function"==typeof r&&(f=r,r={}),(r=Object.assign({},c,r)).parents=r.p||r.parents,r.cidVersion=r.cidVersion||0,t?(t=t.trim())===u?f(r.parents?null:new Error(`cannot create directory '${u}': Already exists`)):(i(`Creating ${t}`),void n([r=>{a(e,t,{parents:!1,createLastComponent:!1},e=>e?e.message.includes("did not exist")?(i(`${t} did not exist`),r()):r(e):(i(`${t} already exists`),r(new Error("file already exists"))))},n=>a(e,t,{parents:r.parents,flush:r.flush,createLastComponent:!0},n),(t,r)=>s(e,t,r),(t,r)=>o(e,t.node.multihash,r)],e=>{e&&e.message.includes("file already exists")&&r.parents&&(e=null),f(e)})):f(new Error("no path given to Mkdir"))}))},function(e,t,r){"use strict";const n=r(49),{toSources:i}=r(48),o=r(607),s=r(608),a={parents:!1,recursive:!1,flush:!0,format:"dag-pb",hashAlg:"sha2-256"};e.exports=(e=>(function(){let t=Array.from(arguments);Array.isArray(t[0])&&(t=t[0].concat(t.slice(1)));const{sources:r,options:u,callback:c}=i(t,a),f=r.map(e=>e.path).concat(u),l=r.slice(0,-1).map(e=>e.path).concat(Object.assign(u,{recursive:!0}));n([t=>o(e).apply(null,f.concat(t)),t=>s(e).apply(null,l.concat(t))],c)}))},function(e,t,r){"use strict";(function(t,n){const i=r(23),o=r(9),s=r(4),a=r(63),{updateMfsRoot:u,validatePath:c,traverseTo:f,addLink:l,updateTree:h,limitStreamBytes:p}=r(48),d=r(86),y=r(1)("ipfs:mfs:write"),g=r(609),m=r(1464),b=r(192),v=r(595),_=r(1467),w=r(596),S=r(141),k=r(70),E=r(1470),A={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"},x=(e,r,i)=>e?t.isBuffer(e)?(y("Content was a buffer"),r.length=r.length||e.length,i(null,d([e]))):"string"==typeof e||e instanceof String?(y("Content was a path"),s([t=>r.length?t(null,{size:r.length}):E.stat(e,t),(t,n)=>{r.length=t.size,n(null,b.source(E.createReadStream(e)))}],i)):(n.Blob&&e instanceof n.Blob&&(y("Content was an HTML5 Blob"),r.length=r.length||e.size,e=_(e)),v(e)?(y("Content was a Node stream"),i(null,b.source(e))):w.isSource(e)?(y("Content was a pull-stream"),i(null,e)):void i(new Error(`Don't know how to convert ${e} into a pull stream source`))):i(new Error("paths must start with a leading /"));e.exports=function(e){return i((t,r,n,i)=>("function"==typeof n&&(i=n,n={}),(n=Object.assign({},A,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 s([e=>{a([e=>x(r,n,e),e=>c(t,e)],e)},([t,r],i)=>{s([i=>f(e,r.directory,Object.assign({},n,{createLastComponent:n.parents}),(e,r)=>i(e,t,r)),(t,i,o)=>{I(e,n,r,t,i,o)}],i)}],e=>i(e))):i()))};const I=(e,r,n,i,a,c)=>{s([s=>{const u=a.node.links.reduce((e,t)=>t.name===n.name?t:e,null);if(u){const t=new o(u.multihash);y(`Updating linked DAGNode ${t.toBaseEncodedString()}`),m(e,t,i,r,s)}else{if(!r.create)return s(new Error("file does not exist"));r.offset&&(r.length+=r.offset,i=S([d([t.alloc(r.offset,0)]),i])),i=k(i,p(r.length)),y("Importing file",n.name),g(e,i,r,s)}},(t,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)],c)}}).call(this,r(0).Buffer,r(6))},function(e,t,r){"use strict";const n=r(35),{unmarshal:i}=n,o=r(70),s=r(141),a=r(87),u=r(46),c=r(348),f=r(120),l=r(4),h=r(63),p=r(1)("ipfs:mfs:write:update-node"),{limitStreamBytes:d,countStreamBytes:y,createNode:g,zeros:m,loadNode:b}=r(48),v=r(609),_=r(1465),w=r(1466),{DAGLink:S}=r(45);e.exports=((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).fileSize();p(`Updating bytes ${A}-${x} of ${T} bytes from ${t.toBaseEncodedString()} with source`);let B=0;A>T&&(p(`Adding ${B=A-T} 0s to the start of the block`),r=s([m(B),r]));const C=u(),P=u();o(r,f(Boolean),d(n.length+B),y(e=>{x===1/0&&(x=E+e)}),c(e=>{p(`Writing ${e.length} at ${I} of ${T}`),I<T?I+e.length>T?(C.push(e.slice(0,T-I)),P.push(e.slice(T-I))):C.push(e):P.push(e),I+=e.length}),a(e=>{C.end(e),P.end()})),l([t=>{h([t=>_(e,b,T,A,x,C,n,t),t=>v(e,P,n,t)],t)},([t,r],o)=>{const s=i((t=t||b).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)})},function(e,t,r){"use strict";(function(t){const n=r(4),i=r(70),o=r(86),s=r(153),a=r(120),u=r(87),c=r(324),f=r(1)("ipfs:mfs:write:update-tree"),l=r(35),h=r(9),{unmarshal:p}=l,{leafFirst:d}=r(225),{DAGLink:y}=r(45),{createNode:g,loadNode:m,bufferPullStreamSource:b}=r(48);e.exports=((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;let i=w-_;f.data.length<i&&(_+=f.data.length);const o=t.from(f.data);i===1/0&&(i=void 0),e.copy(o,n,0,i),r(null,new l(f.type,o).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),c(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)})}).call(this,r(0).Buffer)},function(e,t,r){"use strict";const n=r(145).exporter,i=r(145).importer,o=r(70),s=r(86),a=r(153),u=r(87),c=r(1)("ipfs:mfs:write:truncate-node"),{loadNode:f}=r(48);e.exports=((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())}))})},function(e,t,r){var n=r(1468),i=r(610);e.exports=function(e,t){var r=(t=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){var t=e.target.result;t instanceof ArrayBuffer&&(t=i(new Uint8Array(e.target.result))),n(null,t)};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(22).Readable,i=r(5);e.exports=s,s.ctor=a,s.obj=function(e,t){return("function"==typeof e||Array.isArray(e))&&(t=e,e={}),(e=c(e)).objectMode=!0,e.highWaterMark=16,s(e,t)};var o=a();function s(e,t){("object"!=typeof e||Array.isArray(e))&&(t=e,e={});var r=new o(e);return r._from=Array.isArray(t)?function(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)}}(t):t||u,r}function a(e,r){function o(t){if(!(this instanceof o))return new o(t);this._reading=!1,this._callback=function(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)}},this.destroyed=!1,n.call(this,t||e);var r=this,i=this._readableState.highWaterMark}return"function"==typeof e&&(r=e,e={}),e=c(e),i(o,n),o.prototype._from=r||u,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 u(){}function c(e){return e||{}}}).call(this,r(7))},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(155);e.exports=(e=>{return new n(e||"ipfs")})},function(e,t,r){"use strict";const n=r(1),i=n("jsipfs:state");i.error=n("jsipfs:state:error");const o=r(1473);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(11).EventEmitter,i=r(17),o=r(1474);e.exports=function(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 s._graph=o.reachable(t),s._emitter=r,s._events=t,s._state=e,s.emit=s,s.on=function(e,t){r.on(e,t)},s;function s(e){const t=s._events[s._state][e];if(!function(e,t,r){if(!t)return!1;if(!e)return!0;const n=r[e];return!(!n||!n[t])&&1===n[t].length}(s._state,t,s._graph)){const t="invalid transition: "+s._state+" -> "+e;return r.emit("error",t)}const n=s._state+":leave",i=t+":enter";return s._state?void(r._events[n]?r.emit(n,o):o()):o();function o(){r._events[i]?r.emit(i,a):a()}function a(){s._state=t,r.emit(t),r.emit("done")}}}},function(e,t){function r(e,t){for(var r in e){t(e[r],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)}).concat(t.filter(function(t){return!i(e,t)})).sort()}t.validate=function(e){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};var a=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){r(t[e],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){(function(e){for(var t in e)return!1;return!0})(e)&&t.push(r)}),t};t.livelock=function(e,t){var n=[];return r(a(e),function(e,o){i(t,o)||r(t,function(t){e[t]||i(n,o)||n.push(o)})}),n.sort()};function u(e){var t=[];return r(e,function(e,n){r(e,function(e,r){i(t,r)||t.push(r)})}),t.sort()}t.combine=function(e,t,r,i){var a={},c=s(u(e),u(t));return function r(i,s){var u,f=i+"-"+s;a[f]||(a[f]={}),u=a[f];var l=n(e[i]),h=n(t[s]);return o(l,h).forEach(function(n){u[n]=e[i][n]+"-"+t[s][n],a[u[n]]||r(e[i][n],t[s][n])}),o(c,l).forEach(function(t){u[t]=e[i][t]+"-"+s,a[u[t]]||r(e[i][t],s)}),o(c,h).forEach(function(e){u[e]=i+"-"+t[s][e],a[u[e]]||r(i,t[s][e])}),a[f]}(r,i),a}},function(e,t,r){const n=r(33),i=r(1476);r(1486)(i),r(1488)(i),r(1489)(i),r(1491)(i),r(1492)(i),r(1502)(i);const o=r(79),s=r(116),a=r(101),u=r(149);let c={db:{name:"indexeddb"},connector:{name:"ipfs"}};class f extends s{constructor(e,t){super(e,t),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=s.STATUS_LOADED}async p__y(e,t,r){"string"!=typeof e&&(e=e.href),console.assert(e.startsWith("yjs:/yjs/"));try{if(this.yarrays[e])return r&&console.log("Found Y for",e),this.yarrays[e];{let n=s.mergeoptions(this.options,{connector:{room:e}},t);return r&&console.log("Creating Y for",e),this.yarrays[e]=await i(n)}}catch(e){throw console.log("Failed to initialize Y"),e}}async p__yarray(e,t){return this.p__y(e,{share:{array:"Array"}})}async p_connection(e,t){return this.p__y(e,{share:{map:"Map"}})}static setup0(e,t){let r=s.mergeoptions(c,e.yjs);t&&console.log("YJS options %o",r);let n=new f(r,t);return a.addtransport(n),n}async p_setup2(e,t){try{this.status=s.STATUS_STARTING,t&&t(this),this.options.connector.ipfs=a.ipfs(e).ipfs,this.yarrays={},await this.p_status(e)}catch(e){console.error(this.name,"failed to start",e),this.status=s.STATUS_FAILED}return t&&t(this),this}async p_status(e){return this.status=await this.options.connector.ipfs.isOnline()?s.STATUS_CONNECTED:s.STATUS_FAILED,super.p_status(e)}async p_rawlist(e,{verbose:t=!1}={}){try{let r=(await this.p__yarray(e,t)).share.array.toArray();return t&&console.log("p_rawlist found",...u.consolearr(r)),r}catch(e){throw console.log("TransportYJS.p_rawlist failed",e.message),e}}listmonitor(e,t,{verbose:r=!1,current:n=!1}={}){let i=this.yarrays["string"==typeof e?e:e.href];console.assert(i,"Should always exist before calling listmonitor - async call p__yarray(url) to create"),n&&i.share.array.toArray.map(t),i.share.array.observe(e=>{"insert"===e.type&&(r&&console.log("resources inserted",e.values),e.values.map(t))})}rawreverse(){throw new o.ToBeImplementedError("Undefined function TransportYJS.rawreverse")}async p_rawadd(e,t,{verbose:r=!1}={}){console.assert(e&&t.urls.length&&t.signature&&t.signedby.length,"TransportYJS.p_rawadd args",e,t),r&&console.log("TransportYJS.p_rawadd","string"==typeof e?e:e.href,t);let n=t.preflight(Object.assign({},t));(await this.p__yarray(e,r)).share.array.push([n])}p_newlisturls(e,{verbose:t=!1}={}){let r=e._publicurls.map(e=>n.parse(e)).find(e=>"ipfs"===e.protocol&&e.pathname.includes("/ipfs/")||"yjs:"===e.protocol);return r||(r=`yjs:/yjs/${e.keypair.verifyexportmultihashsha256_58()}`),[r,r]}async p_newdatabase(e,{verbose:t=!1}={}){e.hasOwnProperty("keypair")&&(e=e.keypair.signingexport());let r=`yjs:/yjs/${encodeURIComponent(e)}`;return{publicurl:r,privateurl:r}}async p_newtable(e,t,{verbose:r=!1}={}){if(!e)throw new o.CodingError("p_newtable currently requires a pubkey");let n=await this.p_newdatabase(e,{verbose:r});return{privateurl:`${n.privateurl}/${t}`,publicurl:`${n.publicurl}/${t}`}}async p_set(e,t,r,{verbose:n=!1}={}){let i=await this.p_connection(e,n);"string"==typeof t?i.share.map.set(t,JSON.stringify(r)):Object.keys(t).map(e=>i.share.map.set(e,t[e]))}_p_get(e,t,{verbose:r=!1}={}){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,{verbose:r=!1}={}){return this._p_get(await this.p_connection(e,r),t,{verbose:r})}async p_delete(e,t,{verbose:r=!1}={}){let n=await this.p_connection(e,r);"string"==typeof t?n.share.map.delete(t):t.map(e=>n.share.map.delete(e))}async p_keys(e,{verbose:t=!1}={}){return(await this.p_connection(e,t)).share.map.keys()}async p_getall(e,{verbose:t=!1}={}){let r=await this.p_connection(e,t),n=r.share.map.keys();return this._p_get(r,n,{verbose:t})}async p_rawfetch(e,{verbose:t=!1}={}){return{table:"keyvaluetable",_map:await this.p_getall(e,{verbose:t})}}async monitor(e,t,{verbose:r=!1,current:n=!1}={}){e="string"==typeof e?e:e.href;let i=this.yarrays[e];if(!i)throw new o.CodingError("Should always exist before calling monitor - async call p__yarray(url) to create");n&&i.share.map.keys().forEach(e=>{let r=i.share.map.get[e];t({type:"set",key:e,value:"string"==typeof r?JSON.parse(r):r})}),i.share.map.observe(n=>{if(["add","update"].includes(n.type)&&(r&&console.log("YJS monitor:",e,n.type,n.name,n.value),"update"!==n.type||n.oldValue!==n.value)){let e={type:{add:"set",update:"set",delete:"delete"}[n.type],value:JSON.parse(n.value),key:n.name};t(e)}})}static async p_test(e={},t=!1){t&&console.log("TransportHTTP.test");try{let r=await this.p_setup(e,t);t&&console.log("HTTP connected");let n=await r.p_info(t);t&&console.log("TransportHTTP info=",n),n=await r.p_status(t),console.assert(n===s.STATUS_CONNECTED),await r.p_test_kvt("NACL%20VERIFY",t)}catch(e){throw console.log("Exception thrown in TransportHTTP.test:",e.message),e}}}f.Y=i,a._transportclasses.YJS=f,e.exports=f},function(e,t,r){"use strict";r(1477)(i),r(1478)(i),r(1479)(i),r(1480)(i),r(1481)(i),r(1482)(i),i.debug=r(1483);var n={};function i(e){e.hasOwnProperty("sourceDir")&&(i.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=i.utils.copyObject(e)).connector=i.utils.copyObject(e.connector),e.db=i.utils.copyObject(e.db),e.share=i.utils.copyObject(e.share),setTimeout(function(){i.requestModules(t).then(function(){var t=new o(e);t.db.whenUserIdSet(function(){t.init(function(){r(t)})})}).catch(n)},0))})}e.exports=i,i.requiringModules=n,i.extend=function(e,t){if(2===arguments.length&&"string"==typeof e)t instanceof i.utils.CustomTypeDefinition?i[e]=t.parseArguments:i[e]=t,null!=n[e]&&(n[e].resolve(),delete n[e]);else for(var r=0;r<arguments.length;r++){var o=arguments[r];if("function"!=typeof o)throw new Error("Expected function!");o(i)}},i.requestModules=function(e){var t;t=null===i.sourceDir?null:i.sourceDir||"/bower_components";for(var o="undefined"!=typeof regeneratorRuntime?".js":".es6",s=[],a=0;a<e.length;a++){var u=e[a].split("(")[0],c="y-"+u.toLowerCase();if(null==i[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+o,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(1485)(c)(i);else s.push(n[e[a]].promise)}return Promise.all(s)};class o{constructor(e,t){this.options=e,this.db=new i[e.db.name](this,e.db),this.connector=new i[e.connector.name](this,e.connector),this.connected=!0}init(e){var t=this.options,r={};this.share=r,this.db.requestTransaction(function*(){for(var n in t.share){var o=t.share[n].split("("),s=o.splice(0,1),a=i[s],u=a.typeDefinition,c=["_",u.struct+"_"+s+"_"+n+"_"+o],f=[];if(1===o.length){try{f=JSON.parse("["+o[0].split(")")[0]+"]")}catch(e){throw new Error("Was not able to parse type definition! (share."+n+")")}if(null==a.typeDefinition.parseArguments)throw new Error(s+" does not expect arguments!");f=u.parseArguments(f[0])[1]}r[n]=yield*this.store.initType.call(this,c,f)}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"write"===e}e.exports=function(e){e.AbstractConnector=class{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={type:"sync step 1",stateSet:yield*this.getStateSet(),deleteSet:yield*this.getDeleteSet(),protocolVersion:r.protocolVersion,auth:r.authInfo};r.send(e,t)})):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 n=this.checkAuth(t.auth,this.y,e);this.connections[e].auth=n,n.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(n=>{if("sync step 1"===t.type&&function(e){return"read"===e||"write"===e}(n)){let i=this,o=t;this.y.db.requestTransaction(function*(){var t=yield*this.getStateSet();r(n)&&(yield*this.applyDeleteSet(o.deleteSet));var s={type:"sync step 2",stateSet:t,deleteSet:yield*this.getDeleteSet(),protocolVersion:this.protocolVersion,auth:this.authInfo};s.os=yield*this.getOperations(o.stateSet),i.send(e,s),this.forwardToSyncingClients?(i.syncingClients.push(e),setTimeout(function(){i.syncingClients=i.syncingClients.filter(function(t){return t!==e}),i.send(e,{type:"sync done"})},5e3)):i.send(e,{type:"sync done"})})}else if("sync step 2"===t.type&&r(n)){var i=this.y.db,o={};o.promise=new Promise(function(e){o.resolve=e}),this.syncStep2=o.promise;let e=t;i.requestTransaction(function*(){yield*this.applyDeleteSet(e.deleteSet),null!=e.osUntransformed?yield*this.applyOperationsUntransformed(e.osUntransformed,e.stateSet):this.store.apply(e.os),o.resolve()})}else if("sync done"===t.type){var s=this;this.syncStep2.then(function(){s._setSyncedWith(e)})}else if("update"===t.type&&r(n)){if(this.forwardToSyncingClients)for(var a of this.syncingClients)this.send(a,t);if(this.y.db.forwardAppliedOperations){var u=t.ops.filter(function(e){return"Delete"===e.struct});u.length>0&&this.broadcastOps(u)}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)}}}}},function(e,t,r){"use strict";e.exports=function(e){e.AbstractDatabase=class{constructor(e,t){this.y=e,this.dbOpts=t;var r,n=this;this.userId=null,this.userIdPromise=new Promise(function(e){r=e}),this.userIdPromise.resolve=r,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=function e(){return n.whenTransactionsFinished().then(function(){return n.gc1.length>0||n.gc2.length>0?(n.y.connector.isSynced||console.warn("gc should be empty when not synced!"),new Promise(t=>{n.requestTransaction(function*(){if(null!=n.y.connector&&n.y.connector.isSynced){for(var r=0;r<n.gc2.length;r++){var i=n.gc2[r];yield*this.garbageCollectOperation(i)}n.gc2=n.gc1,n.gc1=[]}n.gcTimeout>0&&(n.gcInterval=setTimeout(e,n.gcTimeout)),t()})})):(n.gcTimeout>0&&(n.gcInterval=setTimeout(e,n.gcTimeout)),Promise.resolve())})},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(){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);if(null==("string"==typeof o[1]?yield*this.getOperation(o):yield*this.getInsertion(o)))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;(yield*this.isGarbageCollected(i))||(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&&(yield*t.isDeleted(r.parent)))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 f=null!=r.content?r.content.length:1,l=r.id;for(let e=0;e<f;e++){var h=[l[0],l[1]+e];if(yield*t.isDeleted(h)){var p={struct:"Delete",target:h};yield*this.tryExecute.call(t,p)}}}}}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}}}},function(e,t,r){"use strict";e.exports=function(e){e.Transaction=class{*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)).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]&&(o=(i=yield*this.getInsertionCleanStart(e)).content.length),i.id[1]+o>e[1]+t&&(o=(i=yield*this.getInsertionCleanEnd([e[0],e[1]+t-1])).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])<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)>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&&(yield*this.isDeleted(e.parent))){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 t=0;t<e.requires.length;t++)yield*this.deleteOperation(e.requires[t]);return yield*this.setOperation(e),void this.store.gc1.push(e.id)}if(e.deleted){var r=null;null!=e.left&&(r=yield*this.getInsertion(e.left)),yield*this.store.addToGarbageCollector.call(this,e,r)}}))}*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&&i.push(r.opContent),null!=r.requires&&(i=i.concat(r.requires));for(var o=0;o<i.length;o++){var s=yield*this.getOperation(i[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(i[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)).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&&(n=yield*this.getOperation(r.parent)),null!=n){var d=!1;null!=r.parentSub?e.utils.compareIds(n.map[r.parentSub],r.id)&&(d=!0,null!=r.right?n.map[r.parentSub]=r.right:delete n.map[r.parentSub]):(e.utils.compareIds(n.start,r.id)&&(d=!0,n.start=r.right),e.utils.matchesId(r,n.end)&&(d=!0,n.end=r.left)),d&&(yield*this.setOperation(n))}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),n=null!=(r=yield*this.os.findNext(r.id))&&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("Insert"!==(n=e.Struct[n.struct].encode(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)).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)).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()}}}},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,a,u=n=yield*t.Insert.getDistanceToOrigin.call(this,r);if(null!=r.left)s=yield*this.getInsertionCleanEnd(r.left),e.utils.compareIds(r.left,r.origin)||null==s.right||i.push(s.right),s=null==s.right?null:yield*this.getOperation(s.right);else{a=yield*this.getOperation(r.parent);let e=r.parentSub?a.map[r.parentSub]:a.start;s=null==e?null:yield*this.getOperation(e)}for(null!=r.right&&(i.push(r.right),yield*this.getInsertionCleanStart(r.right));null!=s&&!e.utils.compareIds(s.id,r.right);){var c=yield*t.Insert.getDistanceToOrigin.call(this,s);if(c===n)s.id[0]<r.id[0]&&(r.left=e.utils.getLastId(s),u=n+1);else{if(!(c<n))break;n-u<=c&&(r.left=e.utils.getLastId(s),u=n+1)}n++,s=null!=s.right?yield*this.getInsertion(s.right):null}var f=null,l=null;for(null==a&&(a=yield*this.getOperation(r.parent)),null!=r.left?(f=yield*this.getInsertion(r.left),r.right=f.right,f.right=r.id,yield*this.setOperation(f)):r.right=r.parentSub?a.map[r.parentSub]||null:a.start,null!=r.right&&((l=yield*this.getOperation(r.right)).left=e.utils.getLastId(r),null!=l.gc&&(null!=l.content&&l.content.length>1&&(l=yield*this.getInsertionCleanEnd(l.id)),this.store.removeFromGarbageCollector(l)),yield*this.setOperation(l)),null!=r.parentSub?(null==f&&(a.map[r.parentSub]=r.id,yield*this.setOperation(a)),null!=r.right&&(yield*this.deleteOperation(r.right,1,!0)),null!=r.left&&(yield*this.deleteOperation(r.id,1,!0))):null!=l&&null!=f||(null==l&&(a.end=e.utils.getLastId(r)),null==f&&(a.start=r.id),yield*this.setOperation(a)),n=0;n<i.length;n++){var h=yield*this.getOperation(i[n]);yield*this.tryCombineWithLeft(h)}}},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;e.utils.EventHandler=class 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;null==e.key?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)}(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){var i=this.waiting.length;if(yield*r.apply(t,n),this.waiting.splice(i),this.awaiting>0&&this.awaiting--,0===this.awaiting&&this.waiting.length>0){for(let r=0;r<this.waiting.length;r++){var o=this.waiting[r];if("Insert"===o.struct){var s=yield*t.getInsertion(o.id);if(null!=s.parentSub&&null!=s.left)this.waiting.splice(r,1),r--;else if(e.utils.compareIds(s.id,o.id))if(null==s.left)o.left=null;else{for(var a=yield*t.getInsertion(s.left);null!=a.deleted;){if(null==a.left){a=null;break}a=yield*t.getInsertion(a.left)}o.left=null!=a?e.utils.getLastId(a):null}else o.left=[o.id[0],o.id[1]-1]}}if(null!=this._pullChanges&&this._pullChanges(),0===this.awaiting){var u=[],c=[];this.waiting.forEach(function(e){"Delete"===e.struct?c.push(e):u.push(e)}),this.waiting=[],u=function(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}(u);for(var f=0;f<u.length;f++){if(0!==this.awaiting){this.waiting=this.waiting.concat(u.slice(f));break}this.onevent(u[f])}for(f=0;f<c.length;f++){if(0!==this.awaiting){this.waiting=this.waiting.concat(c.slice(f));break}this.onevent(c[f])}}}}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(){if(this.awaiting>0&&this.awaiting--,0===this.awaiting&&this.waiting.length>0){var t=[],r=[];this.waiting.forEach(function(e){"Delete"===e.struct?r.push(e):t.push(e)}),(t=function(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}(t)).forEach(this.onevent),r.forEach(this.onevent),this.waiting=[]}}};e.utils.CustomType=class{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[]}};function r(e){var t={};for(var r in e)t[r]=e[r];return t}function n(e){for(var t=new Array(e),r=0;r<t.length;r++)t[r]={id:[null,null]};return t}e.utils.CustomTypeDefinition=class{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}},e.utils.isTypeDefinition=function(t){if(null!=t){if(t instanceof e.utils.CustomTypeDefinition)return[t];if(t.constructor===Array&&t[0]instanceof e.utils.CustomTypeDefinition)return t;if(t instanceof Function&&t.typeDefinition instanceof e.utils.CustomTypeDefinition)return[t.typeDefinition]}return!1},e.utils.copyObject=r,e.utils.copyOperation=function(e){return null!=(e=r(e)).content&&(e.content=e.content.map(function(e){return e})),e},e.utils.smaller=function(e,t){return e[0]<t[0]||e[0]===t[0]&&(e[1]<t[1]||typeof e[1]<typeof t[1])},e.utils.inDeletionRange=function(e,t){return e.target[0]===t[0]&&e.target[1]<=t[1]&&t[1]<e.target[1]+(e.length||1)},e.utils.compareIds=function(e,t){return null==e||null==t?e===t:e[0]===t[0]&&e[1]===t[1]},e.utils.matchesId=function(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},e.utils.getLastId=function(e){return null==e.content||1===e.content.length?e.id:[e.id[0],e.id[1]+e.content.length-1]},e.utils.createSmallLookupBuffer=function(e){return class extends e{constructor(e,t){super(e,t),this.writeBuffer=n(5),this.readBuffer=n(10)}*find(e,t){var r,n,i;for(r=this.readBuffer.length-1;r>=0;r--)if((n=this.readBuffer[r]).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]).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,r,n=e.id;for(t=this.writeBuffer.length-1;t>=0;t--)if((r=this.writeBuffer[t]).id[1]===n[1]&&r.id[0]===n[0]){for(;t<this.writeBuffer.length-1;t++)this.writeBuffer[t]=this.writeBuffer[t+1];this.writeBuffer[this.writeBuffer.length-1]=e;break}if(t<0){var i=this.writeBuffer[0];for(null!==i.id[0]&&(yield*super.put(i)),t=0;t<this.writeBuffer.length-1;t++)this.writeBuffer[t]=this.writeBuffer[t+1];this.writeBuffer[this.writeBuffer.length-1]=e}for(t=0;t<this.readBuffer.length-1;t++)(r=this.readBuffer[t+1]).id[1]===n[1]&&r.id[0]===n[0]?this.readBuffer[t]=e:this.readBuffer[t]=r;this.readBuffer[this.readBuffer.length-1]=e}*delete(e){var t,r;for(t=0;t<this.readBuffer.length;t++)(r=this.readBuffer[t]).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]})}}}},e.utils.generateGuid=function e(t){return t?(t^16*Math.random()>>t/4).toString(16):([1e7]+-1e3+-4e3+-8e3+-1e11).replace(/[018]/g,e)}}},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(){var e=[];for(var r in t.buffers){let i=t.buffers[r];var n=!1;for(let e in i)if(i[e].length>0){n=!0;break}n&&e.push(r)}if(e.length>0){var i=getRandom(e);let r=t.buffers[i],n=getRandom(Object.keys(r));var o=r[n].shift();0===r[n].length&&delete r[n];var s=t.users[i];return s.receiveMessage(o[0],o[1]).then(function(){return s.y.db.whenTransactionsFinished()},function(){})}return!1},flushAll:function(){return new Promise(function(e){t.whenTransactionsFinished().then(function r(){var n=t.flushOne();if(n){for(;n;)n=t.flushOne();t.whenTransactionsFinished().then(r)}else(n=t.flushOne())?n.then(function(){t.whenTransactionsFinished().then(r)}):e()})})}};e.utils.globalRoom=t;var r=0;e.Test=class 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()})}}}},function(e,t,r){(function(n){function i(){var e;try{e=t.storage.debug}catch(e){}return!e&&void 0!==n&&"env"in n&&(e=n.env.DEBUG),e}(t=e.exports=r(1484)).log=function(){return"object"==typeof console&&console.log&&Function.prototype.apply.call(console.log,console,arguments)},t.formatArgs=function(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&&"%c"===e&&(o=++i)}),e.splice(o,0,n)}},t.save=function(e){try{null==e?t.storage.removeItem("debug"):t.storage.debug=e}catch(e){}},t.load=i,t.useColors=function(){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+)/)},t.storage="undefined"!=typeof chrome&&void 0!==chrome.storage?chrome.storage.local:function(){try{return window.localStorage}catch(e){}}(),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(i())}).call(this,r(7))},function(e,t,r){var n;function i(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),(r.log||t.log||console.log.bind(console)).apply(e,s)}}return r.namespace=e,r.enabled=t.enabled(e),r.useColors=t.useColors(),r.color=function(e){var r,n=0;for(r in e)n=(n<<5)-n+e.charCodeAt(r),n|=0;return t.colors[Math.abs(n)%t.colors.length]}(e),"function"==typeof t.init&&t.init(r),r}(t=e.exports=i.debug=i.default=i).coerce=function(e){return e instanceof Error?e.stack||e.message:e},t.disable=function(){t.enable("")},t.enable=function(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,".*?"))[0]?t.skips.push(new RegExp("^"+e.substr(1)+"$")):t.names.push(new RegExp("^"+e+"$")))},t.enabled=function(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},t.humanize=r(219),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=1485},function(e,t,r){"use strict";function n(e){r(1487)(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);e.extend("memory",class extends e.AbstractDatabase{constructor(e,t){super(e,t),this.os=new i,this.ds=new n,this.ss=new i}logTable(){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.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}}e.utils.RBTree=class{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})).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(){}}}},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)}))<=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,u={left:o,origin:o,parent:this._model,struct:"Insert"},c=[];s<r.length;){var f=r[s++];if(a=e.utils.isTypeDefinition(f)){if(c.length>0){s--;break}break}c.push(f)}if(c.length>0)u.content=c,u.id=this.os.getNextOpId(c.length);else{var l=this.os.getNextOpId(1);this.os.createType(a,l),u.opContent=l,u.id=this.os.getNextOpId(1)}i.push(u),o=u.id}var h=this.eventHandler;this.os.requestTransaction(function*(){var e;e=null!=n?(yield*this.getInsertionCleanEnd(n)).right:(yield*this.getOperation(i[0].parent)).start;for(var t=0;t<i.length;t++){i[t].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+=s){var s,a=this._content[t+o].id;for(s=1;o+s<r&&e.utils.compareIds(this._content[t+o+s].id,[a[0],a[1]+s]);s++);i.push({target:a,struct:"Delete",length:s})}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,n=t.left;null!=n&&(r=yield*e.getInsertion(n)).deleted;)n=r.left;t.left=n,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){var i=[],o=[];yield*e.Struct.List.map.call(this,n,function(e){e.hasOwnProperty("opContent")?(i.push({id:e.id,type:e.opContent}),o.push(e.opContent)):e.content.forEach(function(t,r){i.push({id:[e.id[0],e.id[1]+r],val:e.content[r]})})});for(var s=0;s<o.length;s++){(yield*this.store.initType.call(this,o[s]))._parent=n.id}return new t(r,n.id,i)},createType:function(e,r){return new t(e,r.id,[])}}))}e.exports=n,"undefined"!=typeof Y&&n(Y)},function(e,t,r){"use strict";var n=r(1490),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,i=!0;function o(e){if(i){i=!1;try{e()}catch(e){throw i=!0,new Error(e)}i=!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(),n="undefined"!=typeof ace&&null==t.aceClass?ace:t.aceClass;var a=(t.aceRequire||n.require)("ace/range").Range;function u(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 a(n.row,n.column,i.row,i.column);r.remove(e)}})}this.observe(u),this.aceInstances.push({editor:e,yCallback:u,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),r.editor.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){null==(t=t||window).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,a,u,c,f=this;function l(e){o(()=>{var t;if("insert"===e.type){t=e.index;var r=s(function(e){return e<=t?e:e+=1});a(r)}else"delete"===e.type&&(t=e.index,r=s(function(e){return e<t?e:e-=1}),a(r))})}e.value=this.toString(),null!=e.selectionStart&&null!=e.setSelectionRange?(s=function(t){var r=e.selectionStart,n=e.selectionEnd;return null!=t&&(r=t(r),n=t(n)),{left:r,right:n}},a=function(t){u(f.toString()),e.setSelectionRange(t.left,t.right)},u=function(t){e.value=t},c=function(){return e.value}):(s=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},a=function(r){u(f.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)}},u=function(t){e.innerText=t},c=function(){return e.innerText}),u(this.toString()),this.observe(l);var h=function(){o(function(){for(var e=s(function(e){return e}),t=f.toString(),r=c(),i=n(t,r,e.left),o=0,a=0;a<i.length;a++){var u=i[a];0===u[0]?o+=u[1].length:-1===u[0]?f.delete(o,u[1].length):(f.insert(o,u[1]),o+=u[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){var i=[];return yield*e.Struct.List.map.call(this,n,function(e){if(e.hasOwnProperty("opContent"))throw new Error("Text must not contain types!");e.content.forEach(function(t,r){i.push({id:[e.id[0],e.id[1]+r],val:e.content[r]})})}),new t(r,n.id,i)},createType:function(e,r){return new t(e,r.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);n=f(e=e.substring(n),t=t.substring(n));var a=e.substring(e.length-n),u=s(e=e.substring(0,e.length-n),t=t.substring(0,t.length-n));return o&&u.unshift([i,o]),a&&u.push([i,a]),h(u),null!=r&&(u=function(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),g(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]),g(n,o,3)}return e}(u,r)),y(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){for(var w=a+_,S=(I=_==-v||_!=v&&f[w-1]<f[w+1]?f[w+1]:f[w-1]+1)-_;I<i&&S<o&&e.charAt(I)==t.charAt(S);)I++,S++;if(f[w]=I,I>i)g+=2;else if(S>o)y+=2;else if(d){if((A=a+p-_)>=0&&A<c&&-1!=l[A]&&I>=(E=i-l[A]))return u(e,t,I,S)}}for(var k=-v+m;k<=v-b;k+=2){for(var E,A=a+k,x=(E=k==-v||k!=v&&l[A-1]<l[A+1]?l[A+1]:l[A-1]+1)-k;E<i&&x<o&&e.charAt(i-E-1)==t.charAt(o-x-1);)E++,x++;if(l[A]=E,E>i)b+=2;else if(x>o)m+=2;else if(!d){if((w=a+p-k)>=0&&w<c&&-1!=f[w]){var I;S=a+(I=f[w])-w;if(I>=(E=i-E))return u(e,t,I,S)}}}}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)?o=r=i: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)?o=r=i: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,i,o,s,a=e.substring(r,r+Math.floor(e.length/4)),u=-1,l="";-1!=(u=t.indexOf(a,u+1));){var h=c(e.substring(r),t.substring(u)),p=f(e.substring(0,r),t.substring(0,u));l.length<p+h&&(l=t.substring(u-p,u)+t.substring(u,u+h),n=e.substring(0,r-p),i=e.substring(r+h),o=t.substring(0,u-p),s=t.substring(u+h))}return 2*l.length>=e.length?[n,i,o,s,l]:null}var o,s,a,u,l,h=i(r,n,Math.ceil(r.length/4)),p=i(r,n,Math.ceil(r.length/2));return h||p?(o=p?h&&h[4].length>p[4].length?h:p:h,e.length>t.length?(s=o[0],a=o[1],u=o[2],l=o[3]):(u=o[0],l=o[1],s=o[2],a=o[3]),[s,a,u,l,o[4]]):null}function h(e){e.push([i,""]);for(var t,o=0,s=0,a=0,u="",l="";o<e.length;)switch(e[o][0]){case n:a++,l+=e[o][1],o++;break;case r:s++,u+=e[o][1],o++;break;case i:s+a>1?(0!==s&&0!==a&&(0!==(t=c(l,u))&&(o-s-a>0&&e[o-s-a-1][0]==i?e[o-s-a-1][1]+=l.substring(0,t):(e.splice(0,0,[i,l.substring(0,t)]),o++),l=l.substring(t),u=u.substring(t)),0!==(t=f(l,u))&&(e[o][1]=l.substring(l.length-t)+e[o][1],l=l.substring(0,l.length-t),u=u.substring(0,u.length-t))),0===s?e.splice(o-a,s+a,[n,l]):0===a?e.splice(o-s,s+a,[r,u]):e.splice(o-s-a,s+a,[r,u],[n,l]),o=o-s-a+(s?1:0)+(a?1:0)+1):0!==o&&e[o-1][0]==i?(e[o-1][1]+=e[o][1],e.splice(o,1)):o++,a=0,s=0,u="",l=""}""===e[e.length-1][1]&&e.pop();var p=!1;for(o=1;o<e.length-1;)e[o-1][0]==i&&e[o+1][0]==i&&(e[o][1].substring(e[o][1].length-e[o-1][1].length)==e[o-1][1]?(e[o][1]=e[o-1][1]+e[o][1].substring(0,e[o][1].length-e[o-1][1].length),e[o+1][1]=e[o-1][1]+e[o+1][1],e.splice(o-1,1),p=!0):e[o][1].substring(0,e[o+1][1].length)==e[o+1][1]&&(e[o-1][1]+=e[o+1][1],e[o][1]=e[o][1].substring(e[o+1][1].length)+e[o+1][1],e.splice(o+1,1),p=!0)),o++;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){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;var u=[];for(a=0;a<e.length;a+=1)e[a][1].length>0&&u.push(e[a]);return u}function g(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;null!==t.left||e.utils.compareIds(t.id,this.map[n])||(null!=t.opContent?((i=this.os.getType(t.opContent))._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,o=this;if(r.length<1)return n(this),function(){};if(1===r.length)return i=r[0],n(o.get(i)),this.observe(function(e){e.name===i&&n(o.get(i))}),function(){o.unobserve(n)};var s,a=function(){var i=o.get(r[0]);i instanceof t||(i=o.set(r[0],e.Map)),s=i.observePath(r.slice(1),n)},u=function(e){e.name===r[0]&&(null!=s&&s(),"add"!==e.type&&"update"!==e.type||a())};return o.observe(u),a(),function(){null!=s&&s(),o.unobserve(u)}}*_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){var n={},i={},o=r.map;for(var s in o){var a=yield*this.getOperation(o[s]);a.deleted||(null!=a.opContent?(i[s]=a.opContent,(yield*this.store.initType.call(this,a.opContent))._parent=r.id):n[s]=a.content[0])}return new t(e,r,n,i)},createType:function(e,r){return new t(e,r,{},{})}}))}e.exports=n,"undefined"!=typeof Y&&n(Y)},function(e,t,r){"use strict";const n=r(1)("y-ipfs-connector"),i=r(11),o=r(1493),s=r(162),a=r(2).Buffer,u=r(1500),c=r(1501);function f(e){e.extend("ipfs",class 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=function(e){return JSON.stringify(e)}(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.exports=f,"undefined"!=typeof Y&&f(Y)},function(e,t,r){"use strict";(function(t){const n=r(1494),i=r(11),o=r(1496),s=r(611),a=r(612),u=r(1497),c=r(613),f=r(1499),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)).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(611),i=r(1)("hyperdiff"),o=r(1495),s=e=>-1!==e;function a(e,t){return e.indexOf(t)}function u(e,t,r){return e.findIndex(function(e){return function(e,t,r){return r.every(r=>t[r]===e[r])}(e,t,r)})}function c(e,t){return{first:e,second:n(t)}}function f(e,t){return t?u:a}e.exports=function(e,t,r){const n=r?[].concat(r):[],{first:a,second:u}=c(e,t),l=f(0,r);i("preconditions first=%j second=%j findIndex=%s",a,u,l.name);const h=a.reduce(function(e,t,r){const a=l(u,t,n),c=s(a)?"common":"removed";return e[c].push(t),o(u,a),i("index=%s value=%s collection=%s",r,t,c),e},{common:[],removed:[]});return h.added=u,i("added=%j removed=%j common%j",h.added,h.removed,h.common),h}},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=/^\[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){for(var r=-1,n=t.length,i=e.length;++r<n;)e[i+r]=t[r];return e}var w,S=Array.prototype,k=Function.prototype,E=Object.prototype,A=v["__core-js_shared__"],x=(w=/[^.]+$/.exec(A&&A.keys&&A.keys.IE_PROTO||""))?"Symbol(src)_1."+w:"",I=k.toString,T=E.hasOwnProperty,B=E.toString,C=RegExp("^"+I.call(T).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),P=v.Symbol,O=E.propertyIsEnumerable,R=S.splice,N=P?P.isConcatSpreadable:void 0,L=Math.max,K=Y(v,"Map"),j=Y(Object,"create"),M=P?P.prototype:void 0,D=M?M.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(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(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(e,t){for(var r=e.length;r--;)if(oe(e[r][0],t))return r;return-1}function z(e,t){for(var r=0,n=(t=Z(t,e)?[t]:G(t)).length;null!=e&&r<n;)e=e[te(t[r++])];return r&&r==n?e:void 0}function V(e){return!(!ue(e)||function(e){return!!x&&x in e}(e))&&(ae(e)||function(e){var t=!1;if(null!=e&&"function"!=typeof e.toString)try{t=!!(e+"")}catch(e){}return t}(e)?C:y).test(function(e){if(null!=e){try{return I.call(e)}catch(e){}try{return e+""}catch(e){}}return""}(e))}function G(e){return se(e)?e:ee(e)}function W(e,t){if(e!==t){var r=void 0!==e,n=null===e,i=e==e,o=fe(e),s=void 0!==t,a=null===t,u=t==t,c=fe(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,t){var r=e.__data__;return function(e){var t=typeof e;return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e}(t)?r["string"==typeof t?"string":"hash"]:r.map}function Y(e,t){var r=function(e,t){return null==e?void 0:e[t]}(e,t);return V(r)?r:void 0}function J(e){return se(e)||function(e){return function(e){return ce(e)&&function(e){return null!=e&&function(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=o}(e.length)&&!ae(e)}(e)}(e)&&T.call(e,"callee")&&(!O.call(e,"callee")||B.call(e)==s)}(e)||!!(N&&e&&e[N])}function X(e,t){return!!(t=null==t?o:t)&&("number"==typeof e||g.test(e))&&e>-1&&e%1==0&&e<t}function Z(e,t){if(se(e))return!1;var r=typeof e;return!("number"!=r&&"symbol"!=r&&"boolean"!=r&&null!=e&&!fe(e))||l.test(e)||!f.test(e)||null!=t&&e in Object(t)}function Q(e,t){return 1==t.length?e:z(e,function(e,t,r){var n=-1,i=e.length;t<0&&(t=-t>i?0:i+t),(r=r>i?i: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}(t,0,-1))}U.prototype.clear=function(){this.__data__=j?j(null):{}},U.prototype.delete=function(e){return this.has(e)&&delete this.__data__[e]},U.prototype.get=function(e){var t=this.__data__;if(j){var r=t[e];return r===n?void 0:r}return T.call(t,e)?t[e]:void 0},U.prototype.has=function(e){var t=this.__data__;return j?void 0!==t[e]:T.call(t,e)},U.prototype.set=function(e,t){return this.__data__[e]=j&&void 0===t?n:t,this},F.prototype.clear=function(){this.__data__=[]},F.prototype.delete=function(e){var t=this.__data__,r=H(t,e);return!(r<0||(r==t.length-1?t.pop():R.call(t,r,1),0))},F.prototype.get=function(e){var t=this.__data__,r=H(t,e);return r<0?void 0:t[r][1]},F.prototype.has=function(e){return H(this.__data__,e)>-1},F.prototype.set=function(e,t){var r=this.__data__,n=H(r,e);return n<0?r.push([e,t]):r[n][1]=t,this},q.prototype.clear=function(){this.__data__={hash:new U,map:new(K||F),string:new U}},q.prototype.delete=function(e){return $(this,e).delete(e)},q.prototype.get=function(e){return $(this,e).get(e)},q.prototype.has=function(e){return $(this,e).has(e)},q.prototype.set=function(e,t){return $(this,e).set(e,t),this};var ee=ie(function(e){e=function(e){return null==e?"":function(e){if("string"==typeof e)return e;if(fe(e))return D?D.call(e):"";var t=e+"";return"0"==t&&1/e==-i?"-0":t}(e)}(e);var t=[];return h.test(e)&&t.push(""),e.replace(p,function(e,r,n,i){t.push(n?i.replace(d,"$1"):r||e)}),t});function te(e){if("string"==typeof e||fe(e))return e;var t=e+"";return"0"==t&&1/e==-i?"-0":t}function re(e){var t=e?e.length:0;return t?e[t-1]:void 0}var ne=function(e,t){return t=L(void 0===t?e.length-1:t,0),function(){for(var r=arguments,n=-1,i=L(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,function(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)}(e,this,s)}}(function(e,t){t=function e(t,r,n,i,o){var s=-1,a=t.length;for(n||(n=J),o||(o=[]);++s<a;){var u=t[s];r>0&&n(u)?r>1?e(u,r-1,n,i,o):_(o,u):i||(o[o.length]=u)}return o}(t,1);var r=e?e.length:0,n=function(e,t){for(var r=-1,n=null==e,i=t.length,o=Array(i);++r<i;)o[r]=n?void 0:le(e,t[r]);return o}(e,t);return function(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(X(i))R.call(e,i,1);else if(Z(i,e))delete e[te(i)];else{var s=G(i),a=Q(e,s);null!=a&&delete a[te(re(s))]}}}}(e,function(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}(t,function(e){return X(e,r)?+e:e}).sort(W)),n});function ie(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(ie.Cache||q),n}function oe(e,t){return e===t||e!=e&&t!=t}ie.Cache=q;var se=Array.isArray;function ae(e){var t=ue(e)?B.call(e):"";return t==a||t==u}function ue(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function ce(e){return!!e&&"object"==typeof e}function fe(e){return"symbol"==typeof e||ce(e)&&B.call(e)==c}function le(e,t,r){var n=null==e?void 0:z(e,t);return void 0===n?r:n}e.exports=ne}).call(this,r(6))},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(){e._onTimeout&&e._onTimeout()},t))},r(572),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(6))},function(e,t,r){"use strict";const n=r(11),i=r(8),o=r(46),s=r(612),a=r(613),u=r(1498);e.exports=class 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(t){const n=r(8),i=new(r(11));e.exports={handler:function(e,r){r.getPeerInfo((e,o)=>{if(e)return void console.log(e);const s=o.id.toB58String();n(r,n.map(e=>{let r;try{r=JSON.parse(e.toString())}catch(e){return void i.emit("warning",e.message)}if(s!==r.from)return void i.emit("warning","no peerid match "+r.from);const n=r.topicIDs;if(Array.isArray(n))return r.data=t.from(r.data,"hex"),r.seqno=t.from(r.seqno,"hex"),n.forEach(e=>{i.emit(e,r)}),r;i.emit("warning","no topic IDs")}),n.onEnd(()=>{}))})},emitter:i}}).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(){e.utils.createStoreClone=function(e){return class 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()}}};var t=e.utils.createSmallLookupBuffer(class{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,o=null;for(null!=t&&null!=r?o=IDBKeyRange.bound(t,r):null!=t?o=IDBKeyRange.lowerBound(t):null!=r&&(o=IDBKeyRange.upperBound(r)),i=null!=o?this.store.openCursor(o):this.store.openCursor();null!=(yield i);)yield*n.call(e,i.result.value),i.result.continue()}*flush(){}});class r extends e.Transaction{constructor(e){super(e);var r=e.db.transaction(["OperationStore","StateStore","DeleteStore"],"readwrite");this.store=e,this.ss=new t(r,"StateStore"),this.os=new t(r,"OperationStore"),this.ds=new t(r,"DeleteStore")}}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",class 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 r(this):null,n=this,i=e.call(t);!function o(s){var a=s.value;s.done?null!=(e=n.getNextRequest())&&(null==t&&null!=n.db&&(t=new r(n)),o((i=e.call(t)).next())):a.constructor===IDBRequest?(a.onsuccess=function(){var e=a.result;null!=e&&e.constructor===IDBCursorWithValue&&(e=e.value),o(i.next(e))},a.onerror=function(e){i.throw(e)}):a.constructor===IDBCursor?(a.onsuccess=function(){o(i.next(null!=a.result?a.result.value:null))},a.onerror=function(e){i.throw(e)}):a.constructor===IDBOpenDBRequest?(a.onsuccess=function(e){var t=e.target.result;o(i.next(t))},a.onerror=function(){i.throw("Couldn't open IndexedDB database!")},a.onupgradeneeded=function(e){var t=e.target.result;"undefined"!=typeof localStorage&&delete localStorage[JSON.stringify(["Yjs_indexeddb",n.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"})}):i.throw("You must not yield this type!")}(i.next())}*destroy(){this.db.close()}deleteDB(){return e.utils.localCommunication.removeObserver(this.options.namespace,this.communicationObserver),indexedDB.deleteDatabase(this.options.namespace),Promise.resolve()}})})}e.exports=i,"undefined"!=typeof Y&&i(Y)},function(e,t,r){(function(t){const n=r(1504),i=r(22),o=r(33),s=r(79),a=r(116),u=r(101);let c={};class f extends a{constructor(e,t){super(e,t),this.webtorrent=void 0,this.options=e,this.name="WEBTORRENT",this.supportURLs=["magnet"],this.supportFunctions=["fetch","createReadStream"],this.status=a.STATUS_LOADED}p_webtorrentstart(e){return new Promise((e,t)=>{this.webtorrent=new n(this.options),this.webtorrent.once("ready",()=>{console.log("WEBTORRENT READY"),e()}),this.webtorrent.once("error",e=>t(e)),this.webtorrent.on("warning",e=>{console.warn("WebTorrent Torrent WARNING: "+e.message)})})}static setup0(e,t){let r=a.mergeoptions(c,e.webtorrent);t&&console.log("WebTorrent options %o",r);let n=new f(r,t);return u.addtransport(n),n}async p_setup1(e,t){try{this.status=a.STATUS_STARTING,t&&t(this),await this.p_webtorrentstart(e),await this.p_status(e)}catch(e){console.error(this.name,"failed to connect",e),this.status=a.STATUS_FAILED}return t&&t(this),this}async p_status(e){return this.webtorrent&&this.webtorrent.ready?this.status=a.STATUS_CONNECTED:this.webtorrent?this.status=a.STATUS_STARTING:this.status=a.STATUS_FAILED,super.p_status(e)}webtorrentparseurl(e){if(!e)throw new s.CodingError("TransportWEBTORRENT.p_rawfetch: requires url");const t="string"==typeof e?e:e.href,r=t.indexOf("/");if(-1===r)throw new s.CodingError("TransportWEBTORRENT.p_rawfetch: invalid url - missing path component. Should look like magnet:xyzabc/path/to/file");return{torrentId:t.slice(0,r),path:t.slice(r+1)}}async p_webtorrentadd(e){return new Promise((t,r)=>{let n=this.webtorrent.get(e);n||((n=this.webtorrent.add(e)).once("error",e=>{r(new s.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 s.TransportError("Requested file ("+t+") not found within torrent ");return n}p_rawfetch(e,{verbose:t=!1}={}){return new Promise((r,n)=>{t&&console.log("WebTorrent p_rawfetch",e);const{torrentId:i,path:o}=this.webtorrentparseurl(e);this.p_webtorrentadd(i).then(e=>{e.deselect(0,e.pieces.length-1,!1),this.webtorrentfindfile(e,o).getBuffer((t,i)=>{if(t)return n(new s.TransportError("Torrent encountered a fatal error "+t.message+" ("+e.name+")"));r(i)})}).catch(e=>n(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(t){throw console.log(`p_fileFrom failed on ${e} ${t.message}`),t}}async p_f_createReadStream(e,{verbose:t=!1,wanturl:r=!1}={}){t&&console.log(this.name,"p_f_createreadstream",o.parse(e).href);try{let n=await this._p_fileTorrentFromUrl(e),i=this;return r?e:function(e){return i.createReadStream(n,e,t)}}catch(t){throw console.log(`p_f_createReadStream failed on ${e} ${t.message}`),t}}createReadStream(e,t,r){let n;r&&console.log(this.name,"createreadstream",e.name,t);try{return n=new i.PassThrough,e.createReadStream(t).pipe(n),n}catch(e){console.log("TransportWEBTORRENT caught error",e),"function"==typeof n.destroy?n.destroy(e):n.emit("error",e)}}async p_createReadableStream(e,t,r){let n=await this._p_fileTorrentFromUrl(e);return new ReadableStream({start(r){console.log("start",e,t);const i=n.createReadStream(t);i.on("data",e=>{r.enqueue(e)}),i.on("end",()=>{r.close()})},cancel(r){throw new s.TransportError(`cancelled ${e}, ${t} ${r}`)}})}static async p_test(e,r){try{let i=await this.p_setup(e,r);r&&console.log(i.name,"setup");let o=await i.p_status(r);console.assert(o===a.STATUS_CONNECTED);let s="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",u=await i.p_rawfetch(s,{verbose:r});n(u=u.toString());const c=await i.createReadStream(s,r),f=[];function n(e){console.assert(-1!==e.indexOf("00:00:02,000 --\x3e 00:00:05,000"),"Should fetch 'Big Buck Bunny.en.srt' from the torrent"),console.assert(e.length,129,"'Big Buck Bunny.en.srt' was "+e.length)}c.on("data",e=>{f.push(e)}),c.on("end",()=>{n(t.concat(f).toString())})}catch(e){throw console.log("Exception thrown in TransportWEBTORRENT.p_test:",e.message),e}}}u._transportclasses.WEBTORRENT=f,e.exports=f}).call(this,r(0).Buffer)},function(e,t,r){(function(t,n){e.exports=A;var i=r(2).Buffer,o=r(327),s=r(1505),a=r(1)("webtorrent"),u=r(1516),c=r(11).EventEmitter,f=r(26),l=r(5),h=r(1517),p=r(147),d=r(616),y=r(64),g=r(191),m=r(107),b=r(329),v=r(1526),_=r(1527),w=r(1528),S=r(331).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)}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});return e.reduce(function(e,t){return e+t.downloaded},0)/(e.reduce(function(e,t){return e+(t.length||0)},0)||1)}}),Object.defineProperty(A.prototype,"ratio",{get:function(){return this.torrents.reduce(function(e,t){return e+t.uploaded},0)/(this.torrents.reduce(function(e,t){return e+t.received},0)||1)}}),A.prototype.get=function(e){var t,r,n=this.torrents.length;if(e instanceof w){for(t=0;t<n;t++)if((r=this.torrents[t])===e)return r}else{var i;try{i=d(e)}catch(e){}if(!i)return null;if(!i.infoHash)throw new Error("Invalid torrent identifier");for(t=0;t<n;t++)if((r=this.torrents[t]).infoHash===i.infoHash)return r}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))}return n.torrents.push(i),i.once("_infoHash",o),i.once("ready",s),i.once("close",function e(){i.removeListener("_infoHash",o),i.removeListener("ready",s),i.removeListener("close",e)}),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,a=n.add(null,t,function(e){var t=[function(t){e.load(i,t)}];n.dht&&t.push(function(t){e.once("dhtAnnounce",t)}),p(t,function(t){if(!n.destroyed)return t?e._destroy(t):void function(e){n._debug("on seed"),"function"==typeof r&&r(e),e.emit("seed"),n.emit("seed",e)}(e)})});return function(e){return"undefined"!=typeof FileList&&e instanceof FileList}(e)&&(e=Array.prototype.slice.call(e)),Array.isArray(e)||(e=[e]),p(e.map(function(e){return function(t){!function(e){return"object"==typeof e&&null!=e&&"function"==typeof e.pipe}(e)?t(null,e):o(e,t)}}),function(e,r){if(!n.destroyed)return e?a._destroy(e):void s.parseInput(r,t,function(e,o){if(!n.destroyed){if(e)return a._destroy(e);i=o.map(function(e){return e.getStream}),s(r,t,function(e,t){if(!n.destroyed){if(e)return a._destroy(e);var r=n.get(t);r?a._destroy(new Error("Cannot add duplicate torrent "+r.infoHash)):a._onTorrentId(t)}})}})}),a},A.prototype.remove=function(e,t){if(this._debug("remove"),!this.get(e))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(6),r(7))},function(e,t,r){(function(t,n,i){e.exports=function e(t,r,n){if("function"==typeof r)return e(t,null,r);_(t,r=r?c(r):{},function(e,t,i){if(e)return n(e);r.singleFileTorrent=i,E(t,r,n)})},e.exports.parseInput=function e(t,r,n){if("function"==typeof r)return e(t,null,r);_(t,r=r?c(r):{},n)},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(204),s=r(614),a=r(1509),u=r(64),c=r(26),f=r(1511),l=r(1512),h=r(95),p=r(1513),d=r(1514),y=r(615),g=r(30),m=r(147),b=r(148),v=r(22);function _(e,r,i){if(function(e){return"undefined"!=typeof FileList&&e instanceof FileList}(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)}),1!==(e=e.map(function(e){return x(e)&&"string"==typeof e.path&&"function"==typeof h.stat?e.path: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 S(t)&&d.not(t)}),o&&e.forEach(function(e){var r=(t.isBuffer(e)||I(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(x(e))n.getStream=function(e){return function(){return new f(e)}}(e),n.length=e.size;else if(t.isBuffer(e))n.getStream=function(e){return function(){var t=new v.PassThrough;return t.end(e),t}}(e),n.length=e.length;else{if(!I(e)){if("string"==typeof e){if("function"!=typeof h.stat)throw new Error("filesystem paths do not work in the browser");return void function(e,t,r){!function e(t,r,n){h.stat(t,function(i,o){if(i)return n(i);o.isDirectory()?h.readdir(t,function(i,o){if(i)return n(i);m(o.filter(S).filter(d.not).map(function(n){return function(i){e(u.join(t,n),r,i)}}),n)}):o.isFile()&&r(t,n)})}(e,w,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=function(e){return function(){return h.createReadStream(e)}}(t.path),t.path=t.path.replace(e,"").split(u.sep)}),r(null,i)})}(e,s>1||a,r)}throw new Error("invalid input type")}n.getStream=function(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}}(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 w(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 S(e){return"."!==e[0]}function k(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 E(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(A,0));u.info["piece length"]=c,k(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 A(e,t){return e+t.length}function x(e){return"undefined"!=typeof Blob&&e instanceof Blob}function I(e){return"object"==typeof e&&null!=e&&"function"==typeof e.pipe}}).call(this,r(0).Buffer,r(7),r(6))},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)*r+(t%r<<0);e.push(n.from("i"+o+"e")),o===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 "'+o+'"'),console.trace())},i.dict=function(e,t){e.push(s);for(var r,n=0,a=Object.keys(t).sort(),u=a.length;n<u;n++)null!=t[r=a[n]]&&(i.string(e,r),i._encode(e,t[r]));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){function r(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 n(e,r,i,o){return null==e||0===e.length?null:("number"!=typeof r&&null==o&&(o=r,r=void 0),"number"!=typeof i&&null==o&&(o=i,i=void 0),n.position=0,n.encoding=o||null,n.data=t.isBuffer(e)?e.slice(r,i):new t(e),n.bytes=n.data.length,n.next())}n.bytes=0,n.position=0,n.data=null,n.encoding=null,n.next=function(){switch(n.data[n.position]){case 100:return n.dictionary();case 108:return n.list();case 105:return n.integer();default:return n.buffer()}},n.find=function(e){for(var t=n.position,r=n.data.length,i=n.data;t<r;){if(i[t]===e)return t;t++}throw new Error('Invalid data: Missing delimiter "'+String.fromCharCode(e)+'" [0x'+e.toString(16)+"]")},n.dictionary=function(){n.position++;for(var e={};101!==n.data[n.position];)e[n.buffer()]=n.next();return n.position++,e},n.list=function(){n.position++;for(var e=[];101!==n.data[n.position];)e.push(n.next());return n.position++,e},n.integer=function(){var e=n.find(101),t=r(n.data,n.position+1,e);return n.position+=e+1-n.position,t},n.buffer=function(){var e=n.find(58),t=r(n.data,n.position,e),i=++e+t;return n.position=i,n.encoding?n.data.toString(n.encoding,e,i):n.data.slice(e,i)},e.exports=n}).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(1510),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;e.exports=function(e,t,n){for(var i,o,s,a=1/0,u=0,c=t.length-1;u<=c&&((s=t[i=u+(c-u>>1)]-e)<0?u=i+1:s>0&&(c=i-1),(s=r(s))<a&&(a=s,o=i),t[i]!==e););return n?o:t[o]}},function(e,t,r){var n=r(22).Readable,i=r(5),o=r(610);function s(e,t){var r=this;if(!(this instanceof s))return new s(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(s,n),e.exports=s,s.prototype._generateHeaderBlocks=function(e,t,r){r(null,[])},s.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(o(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))},s.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){return(t="number"==typeof t?t:1/0)?function e(r,n){return r.reduce(function(r,i){return Array.isArray(i)&&n<t?r.concat(e(i,n+1)):r.concat(i)},[])}(e,1):Array.isArray(e)?e.map(function(e){return e}):e}},function(e,t,r){"use strict";var n=r(95);function i(e){return n.existsSync(e)&&n.statSync(e).isFile()}e.exports=function(e,t){if(!t)return i(e);n.stat(e,function(e,r){return e?t(e):t(null,r.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){e.exports=r()}("undefined"!=typeof self&&self,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(){return e.default}:function(){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){var n=r(5),i=r(1),o=i.toHex,s=i.ceilHeapSize,a=r(6),u=function(e){for(e+=9;e%64>0;e+=1);return e},c=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},f=function(){function e(t){if(function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),(t=t||65536)%64>0)throw new Error("Chunk size must be a multiple of 128 bit");this._offset=0,this._maxChunkLen=t,this._padMaxChunkLen=u(t),this._heap=new ArrayBuffer(s(this._padMaxChunkLen+320+20)),this._h32=new Int32Array(this._heap),this._h8=new Int8Array(this._heap),this._core=new n({Int32Array:Int32Array},{},this._heap)}return e.prototype._initState=function(e,t){this._offset=0;var r=new Int32Array(e,t+320,5);r[0]=1732584193,r[1]=-271733879,r[2]=-1732584194,r[3]=271733878,r[4]=-1009589776},e.prototype._padChunk=function(e,t){var r=u(e),n=new Int32Array(this._heap,0,r>>2);return 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}(n,e),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}(n,e,t),r},e.prototype._write=function(e,t,r,n){a(e,this._h8,this._h32,t,r,n||0)},e.prototype._coreCall=function(e,t,r,n,i){var o=r;this._write(e,t,r),i&&(o=this._padChunk(r,n)),this._core.hash(o,this._padMaxChunkLen)},e.prototype.rawDigest=function(e){var t=e.byteLength||e.length||e.size||0;this._initState(this._heap,this._padMaxChunkLen);var r=0,n=this._maxChunkLen;for(r=0;t>r+n;r+=n)this._coreCall(e,r,n,t,!1);return this._coreCall(e,r,t-r,t,!0),c(this._heap,this._padMaxChunkLen)},e.prototype.digest=function(e){return o(this.rawDigest(e).buffer)},e.prototype.digestFromString=function(e){return this.digest(e)},e.prototype.digestFromBuffer=function(e){return this.digest(e)},e.prototype.digestFromArrayBuffer=function(e){return this.digest(e)},e.prototype.resetState=function(){return this._initState(this._heap,this._padMaxChunkLen),this},e.prototype.append=function(e){var t=0,r=e.byteLength||e.length||e.size||0,n=this._offset%this._maxChunkLen,i=void 0;for(this._offset+=r;t<r;)i=Math.min(r-t,this._maxChunkLen-n),this._write(e,t,i,n),t+=i,(n+=i)===this._maxChunkLen&&(this._core.hash(this._maxChunkLen,this._padMaxChunkLen),n=0);return this},e.prototype.getState=function(){var e=void 0;if(this._offset%this._maxChunkLen)e=this._heap.slice(0);else{var t=new Int32Array(this._heap,this._padMaxChunkLen+320,5);e=t.buffer.slice(t.byteOffset,t.byteOffset+t.byteLength)}return{offset:this._offset,heap:e}},e.prototype.setState=function(e){return this._offset=e.offset,20===e.heap.byteLength?new Int32Array(this._heap,this._padMaxChunkLen+320,5).set(new Int32Array(e.heap)):this._h32.set(new Int32Array(e.heap)),this},e.prototype.rawEnd=function(){var e=this._offset,t=e%this._maxChunkLen,r=this._padChunk(t,e);this._core.hash(r,this._padMaxChunkLen);var n=c(this._heap,this._padMaxChunkLen);return this._initState(this._heap,this._padMaxChunkLen),n},e.prototype.end=function(){return o(this.rawEnd().buffer)},e}();e.exports=f,e.exports._core=n},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,r,n,i,o){var s=new self.FileReader;s.onloadend=function(){if(s.error)return o(s.error);var a=s.result;r+=s.result.byteLength;try{e.append(a)}catch(e){return void o(e)}r<i.size?t(e,r,n,i,o):o(null,e.end())},s.readAsArrayBuffer(i.slice(r,r+n))},n=!0;return self.onmessage=function(r){if(n){var i=r.data.data,o=r.data.file,s=r.data.id;if(void 0!==s&&(o||i)){var a=r.data.blockSize||4194304,u=new e(a);u.resetState();var c=function(e,t){e?self.postMessage({id:s,error:e.name}):self.postMessage({id:s,hash:t})};i&&function(e,t,r){try{r(null,e.digest(t))}catch(e){return r(e)}}(u,i,c),o&&t(u,0,a,o,c)}}},function(){n=!1}}},function(e,t,r){var n=r(4),i=r(0),o=r(7),s=r(2),a=r(1).isDedicatedWorkerScope,u="undefined"!=typeof self&&a(self);i.disableWorkerBehaviour=u?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(){return e.default}:function(){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,l=c[1],h=new RegExp("(\\\\n|\\W)"+s(l)+o,"g");f=h.exec(u);)"dll-reference"!==f[3]&&a[n].push(f[3]);for(h=new RegExp("\\("+s(l)+'\\("(dll-reference\\s('+i+'))"\\)\\)'+o,"g");f=h.exec(u);)e[f[2]]||(a[n].push(f[1]),e[f[2]]=r(f[1]).m),a[f[2]]=a[f[2]]||[],a[f[2]].push(f[4]);return a}function u(e){return Object.keys(e).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].pop();if(i[c]=i[c]||{},!i[c][f]&&e[c][f]){i[c][f]=!0,n[c]=n[c]||[],n[c].push(f);for(var l=a(e,e[c][f],c),h=Object.keys(l),p=0;p<h.length;p++)r[h[p]]=r[h[p]]||[],r[h[p]]=r[h[p]].concat(l[h[p]])}}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).createObjectURL(a),f=new window.Worker(u);return f.objectURL=u,f}},function(e,t){e.exports=function(e,t,r){"use asm";var n=new e.Int32Array(r);function i(e,t){e=e|0;t=t|0;var r=0,i=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=n[t+320>>2]|0;a=n[t+324>>2]|0;c=n[t+328>>2]|0;l=n[t+332>>2]|0;p=n[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(i=0;(i|0)<64;i=i+4|0){g=n[r+i>>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;n[e+i>>2]=g}for(i=e+64|0;(i|0)<(e+80|0);i=i+4|0){g=(n[i-12>>2]^n[i-32>>2]^n[i-56>>2]^n[i-64>>2])<<1|(n[i-12>>2]^n[i-32>>2]^n[i-56>>2]^n[i-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;n[i>>2]=g}for(i=e+80|0;(i|0)<(e+160|0);i=i+4|0){g=(n[i-12>>2]^n[i-32>>2]^n[i-56>>2]^n[i-64>>2])<<1|(n[i-12>>2]^n[i-32>>2]^n[i-56>>2]^n[i-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;n[i>>2]=g}for(i=e+160|0;(i|0)<(e+240|0);i=i+4|0){g=(n[i-12>>2]^n[i-32>>2]^n[i-56>>2]^n[i-64>>2])<<1|(n[i-12>>2]^n[i-32>>2]^n[i-56>>2]^n[i-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;n[i>>2]=g}for(i=e+240|0;(i|0)<(e+320|0);i=i+4|0){g=(n[i-12>>2]^n[i-32>>2]^n[i-56>>2]^n[i-64>>2])<<1|(n[i-12>>2]^n[i-32>>2]^n[i-56>>2]^n[i-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;n[i>>2]=g}o=o+s|0;a=a+u|0;c=c+f|0;l=l+h|0;p=p+d|0}n[t+320>>2]=o;n[t+324>>2]=a;n[t+328>>2]=c;n[t+332>>2]=l;n[t+336>>2]=p}return{hash:i}}},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[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]}}},o=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,s,a,u){if("string"==typeof e)return 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)}}}(e,t,n,s,a,u);if(e instanceof Array)return i(e,t,n,s,a,u);if(r&&r.Buffer&&r.Buffer.isBuffer(e))return i(e,t,n,s,a,u);if(e instanceof ArrayBuffer)return i(new Uint8Array(e),t,n,s,a,u);if(e.buffer instanceof ArrayBuffer)return i(new Uint8Array(e.buffer,e.byteOffset,e.byteLength),t,n,s,a,u);if(e instanceof Blob)return o(e,t,n,s,a,u);throw new Error("Unsupported data type.")}},function(e,t,r){var n=r(0),i=r(1).toHex,o=function(){function e(){(function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")})(this,e),this._rusha=new n,this._rusha.resetState()}return e.prototype.update=function(e){return this._rusha.append(e),this},e.prototype.digest=function(e){var t=this._rusha.rawEnd().buffer;if(!e)return t;if("hex"===e)return i(t);throw new Error("unsupported digest encoding")},e}();e.exports=function(){return new o}}])})},function(e,t){},function(e,t){},function(e,t,r){(function(t){e.exports=function(e,r){if("undefined"==typeof Blob||!(e instanceof Blob))throw new Error("first argument must be a Blob");if("function"!=typeof r)throw new Error("second argument must be a function");var n=new FileReader;n.addEventListener("loadend",function e(i){n.removeEventListener("loadend",e,!1),i.error?r(i.error):r(null,t.from(n.result))},!1),n.readAsArrayBuffer(e)}}).call(this,r(0).Buffer)},function(e,t,r){(function(t){e.exports=l;const n=r(327),i=r(1520),o=r(328),s=r(620),a=r(30),u=r(209),c=r(33),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"),delete e.body,delete e.form,h&&(e.method||(e.method="POST"),f(h)||(e.headers["content-length"]=t.byteLength(h)),e.json&&(e.headers["content-type"]="application/json")),e.json&&(e.headers.accept="application/json"),e.method&&(e.method=e.method.toUpperCase());const p=("https:"===e.protocol?s:o).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 p.on("timeout",()=>{p.abort(),r(new Error("Request timed out"))}),p.on("error",r),f(h)?h.on("error",r).pipe(p):p.end(h),p}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(617),s=r(5),a=r(618),u=r(22),c=r(619),f=a.IncomingMessage,l=a.readyStates;var h=e.exports=function(e){var r,n=this;u.Writable.call(n),n._opts=e,n._body=[],n._headers={},e.auth&&n.setHeader("Authorization","Basic "+new t(e.auth).toString("base64")),Object.keys(e.headers).forEach(function(t){n.setHeader(t,e.headers[t])});var i=!0;if("disable-fetch"===e.mode||"requestTimeout"in e&&!o.abortController)i=!1,r=!0;else if("prefer-streaming"===e.mode)r=!1;else if("allow-wrong-content-type"===e.mode)r=!o.overrideMimeType;else{if(e.mode&&"default"!==e.mode&&"prefer-fast"!==e.mode)throw new Error("Invalid value for opts.mode");r=!0}n._mode=function(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"}(r,i),n._fetchTimer=null,n.on("finish",function(){n._onFinish()})};s(h,u.Writable),h.prototype.setHeader=function(e,t){var r=e.toLowerCase();-1===p.indexOf(r)&&(this._headers[r]={name:e,value:t})},h.prototype.getHeader=function(e){var t=this._headers[e.toLowerCase()];return t?t.value:null},h.prototype.removeHeader=function(e){delete this._headers[e.toLowerCase()]},h.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;if(o.abortController){var h=new AbortController;f=h.signal,e._fetchAbortController=h,"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 p=e._xhr=new n.XMLHttpRequest;try{p.open(e._opts.method,e._opts.url,!0)}catch(t){return void i.nextTick(function(){e.emit("error",t)})}"responseType"in p&&(p.responseType=e._mode.split(":")[0]),"withCredentials"in p&&(p.withCredentials=!!r.withCredentials),"text"===e._mode&&"overrideMimeType"in p&&p.overrideMimeType("text/plain; charset=x-user-defined"),"requestTimeout"in r&&(p.timeout=r.requestTimeout,p.ontimeout=function(){e.emit("requestTimeout")}),u.forEach(function(e){p.setRequestHeader(e[0],e[1])}),e._response=null,p.onreadystatechange=function(){switch(p.readyState){case l.LOADING:case l.DONE:e._onXHRProgress()}},"moz-chunked-arraybuffer"===e._mode&&(p.onprogress=function(){e._onXHRProgress()}),p.onerror=function(){e._destroyed||e.emit("error",new Error("XHR error"))};try{p.send(a)}catch(t){return void i.nextTick(function(){e.emit("error",t)})}}}},h.prototype._onXHRProgress=function(){(function(e){try{var t=e.status;return null!==t&&0!==t}catch(e){return!1}})(this._xhr)&&!this._destroyed&&(this._response||this._connect(),this._response._onXHRProgress())},h.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))},h.prototype._write=function(e,t,r){this._body.push(e),r()},h.prototype.abort=h.prototype.destroy=function(){this._destroyed=!0,n.clearTimeout(this._fetchTimer),this._response&&(this._response._destroyed=!0),this._xhr?this._xhr.abort():this._fetchAbortController&&this._fetchAbortController.abort()},h.prototype.end=function(e,t,r){"function"==typeof e&&(r=e,e=void 0),u.Writable.prototype.end.call(this,e,t,r)},h.prototype.flushHeaders=function(){},h.prototype.setTimeout=function(){},h.prototype.setNoDelay=function(){},h.prototype.setSocketKeepAlive=function(){};var p=["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(6),r(7))},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){e.exports=a,e.exports.decode=a,e.exports.encode=function(e){(e=o(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);var t="magnet:?";return Object.keys(e).filter(function(e){return 2===e.length}).forEach(function(r,n){(Array.isArray(e[r])?e[r]:[e[r]]).forEach(function(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};var n=r(1524),i=r(2).Buffer,o=r(26),s=r(205);function a(e){var t,r={},o=e.split("magnet:?")[1];return(o&&o.length>=0?o.split("&"):[]).forEach(function(e){var t=e.split("=");if(2===t.length){var n=t[0],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{var o=r[n];r[n]=[o,i]}else r[n]=i}}),r.xt&&(Array.isArray(r.xt)?r.xt:[r.xt]).forEach(function(e){if(t=e.match(/^urn:btih:(.{40})/))r.infoHash=t[1].toLowerCase();else if(t=e.match(/^urn:btih:(.{32})/)){var o=n.decode(t[1]);r.infoHash=i.from(o,"binary").toString("hex")}}),r.infoHash&&(r.infoHashBuffer=i.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)),s(r.announce),s(r.urlList),r}},function(e,t,r){var n=r(1525);t.encode=n.encode,t.decode=n.decode},function(e,t,r){"use strict";(function(e){var r=[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];t.encode=function(t){e.isBuffer(t)||(t=new e(t));for(var r=0,n=0,i=0,o=0,s=new e(8*function(e){var t=Math.floor(e.length/5);return e.length%5==0?t:t+1}(t));r<t.length;){var a=t[r];i>3?(o=(o=a&255>>i)<<(i=(i+5)%8)|(r+1<t.length?t[r+1]:0)>>8-i,r++):(o=a>>8-(i+5)&31,0==(i=(i+5)%8)&&r++),s[n]="ABCDEFGHIJKLMNOPQRSTUVWXYZ234567".charCodeAt(o),n++}for(r=n;r<s.length;r++)s[r]=61;return s},t.decode=function(t){var n,i=0,o=0,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<r.length))throw new Error("Invalid input - it is not base32 encoded string");o=r[c],i<=3?0==(i=(i+5)%8)?(n|=o,a[s]=n,s++,n=0):n|=255&o<<8-i:(n|=255&o>>>(i=(i+5)%8),a[s]=n,s++,n=255&o<<8-i)}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)>0?new Array(t+(/\./.test(r)?2:1)).join(n)+r:r+"")}},function(e,t){},function(e,t,r){(function(t,n){e.exports=F;var i,o=r(1529),s=r(206),a=r(1530),u=r(1)("webtorrent:torrent"),c=r(1531),f=r(11).EventEmitter,l=r(26),h=r(622),p=r(95),d=r(1541),y=r(623),g=r(1543),m=r(5),b=r(615),v=r(1544),_=r(1545),w=r(147),S=r(1546),k=r(616),E=r(64),A=r(1547),x=r(542),I=r(1548),T=r(148),B=r(329),C=r(205),P=r(1549),O=r(1550),R=r(1551),N=r(1572),L=r(1574),K=r(1575),j=5e3,M=3*A.BLOCK_LENGTH,D=[1e3,5e3,15e3],U="WebTorrent/"+r(331).version+" (https://webtorrent.io)";try{i=E.join(p.statSync("/tmp")&&"/tmp","webtorrent")}catch(e){i=E.join("function"==typeof _.tmpdir?_.tmpdir():"/","webtorrent")}function F(e,t,r){f.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||d,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=B(),this._uploadSpeed=B(),this._servers=[],this._xsRequests=[],this._fileModtimes=r.fileModtimes,null!==e&&this._onTorrentId(e),this._debug("new torrent")}function q(e,t){return 2+Math.ceil(t*e.downloadSpeed()/A.BLOCK_LENGTH)}function H(){}m(F,f),Object.defineProperty(F.prototype,"timeRemaining",{get:function(){return this.done?0:0===this.downloadSpeed?1/0:(this.length-this.downloaded)/this.downloadSpeed*1e3}}),Object.defineProperty(F.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(F.prototype,"downloadSpeed",{get:function(){return this._downloadSpeed()}}),Object.defineProperty(F.prototype,"uploadSpeed",{get:function(){return this._uploadSpeed()}}),Object.defineProperty(F.prototype,"progress",{get:function(){return this.length?this.downloaded/this.length:0}}),Object.defineProperty(F.prototype,"ratio",{get:function(){return this.uploaded/(this.received||1)}}),Object.defineProperty(F.prototype,"numPeers",{get:function(){return this.wires.length}}),Object.defineProperty(F.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(F.prototype,"_numQueued",{get:function(){return this._queue.length+(this._peersLength-this._numConns)}}),Object.defineProperty(F.prototype,"_numConns",{get:function(){var e=0;for(var t in this._peers)this._peers[t].connected&&(e+=1);return e}}),Object.defineProperty(F.prototype,"swarm",{get:function(){return console.warn("WebTorrent: `torrent.swarm` is deprecated. Use `torrent` directly instead."),this}}),F.prototype._onTorrentId=function(e){var r=this;if(!r.destroyed){var n;try{n=k(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)})):k.remote(e,function(e,t){if(!r.destroyed)return e?r._destroy(e):void r._onParsedTorrent(t)})}},F.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=E.join(i,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()})))}},F.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)),C(e.announce),C(e.urlList),h(this,e),this.magnetURI=k.toMagnetURI(e),this.torrentFile=k.toTorrentFile(e)},F.prototype._onListening=function(){var e=this;if(!e.discovery&&!e.destroyed){var t=e.client.tracker;t&&(t=l(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&&h(t,e.client.tracker.getAnnounceOpts()),e._getAnnounceOpts&&h(t,e._getAnnounceOpts()),t}})),e.discovery=new c({infoHash:e.infoHash,announce:e.announce,peerId:e.client.peerId,dht:!e.private&&e.client.dht,tracker:t,port:e.client.torrentPort,userAgent:U}),e.discovery.on("error",function(t){e._destroy(t)}),e.discovery.on("peer",function(t){"string"==typeof t&&e.done||e.addPeer(t)}),e.discovery.on("trackerAnnounce",function(){e.emit("trackerAnnounce"),0===e.numPeers&&e.emit("noPeers","tracker")}),e.discovery.on("dhtAnnounce",function(){e.emit("dhtAnnounce"),0===e.numPeers&&e.emit("noPeers","dht")}),e.discovery.on("warning",function(t){e.emit("warning",t)}),e.info?e._onMetadata(e):e.xs&&e._getMetadataFromServer()}},F.prototype._getMetadataFromServer=function(){var e=this,t=(Array.isArray(e.xs)?e.xs:[e.xs]).map(function(e){return function(t){r(e,t)}});function r(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,i={url:t,method:"GET",headers:{"user-agent":U}};try{n=y.concat(i,function(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=k(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))})}catch(i){return e.emit("warning",new Error("skipping invalid url xs param: "+t)),r(null)}e._xsRequests.push(n)}w(t)},F.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=k(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 L(t),t.store=new g(new t._store(t.pieceLength,{torrent:{infoHash:t.infoHash},files:t.files.map(function(e){return{path:E.join(t.path,e.path),length:e.length,offset:e.offset}}),length:t.length})),t.files=t.files.map(function(e){return new R(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 A(n)}),t._reservations=t.pieces.map(function(){return[]}),t.bitfield=new s(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===d?t.getFileModtimes(function(e,r){if(e)return t._destroy(e);if(t.files.map(function(e,n){return r[n]===t._fileModtimes[n]}).every(function(e){return e})){for(var n=0;n<t.pieces.length;n++)t._markVerified(n);t._onStore()}else t._verifyPieces()}):t._verifyPieces(),t.emit("metadata")}},F.prototype.getFileModtimes=function(e){var t=this,r=[];S(t.files.map(function(e,n){return function(i){p.stat(E.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)})},F.prototype._verifyPieces=function(){var e=this;S(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 T(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()})},F.prototype._markVerified=function(e){this.pieces[e]=null,this._reservations[e]=null,this.bitfield.set(e,!0)},F.prototype._onStore=function(){this.destroyed||(this._debug("on store"),this.ready=!0,this.emit("ready"),this._checkDone(),this._updateSelections())},F.prototype.destroy=function(e){this._destroy(null,e)},F.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 R&&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)}),w(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}},F.prototype.addPeer=function(e){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 t;if("string"==typeof e){var r;try{r=o(e)}catch(t){return this._debug("ignoring peer: invalid %s",e),this.emit("invalidPeer",e),!1}t=r[0]}else"string"==typeof e.remoteAddress&&(t=e.remoteAddress);if(t&&this.client.blocked.contains(t))return this._debug("ignoring peer: blocked %s",e),"string"!=typeof e&&e.destroy(),this.emit("blockedPeer",e),!1}var n=!!this._addPeer(e);return n?this.emit("peer",e):this.emit("invalidPeer",e),n},F.prototype._addPeer=function(e){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 t,r=e&&e.id||e;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),t="string"==typeof e?N.createTCPOutgoingPeer(e,this):N.createWebRTCPeer(e,this),this._peers[t.id]=t,this._peersLength+=1,"string"==typeof e&&(this._queue.push(t),this._drain()),t)},F.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=N.createWebSeedPeer(e,this);this._peers[t.id]=t,this._peersLength+=1,this.emit("peer",e)},F.prototype._addIncomingPeer=function(e){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))},F.prototype.removePeer=function(e){var t=e&&e.id||e;(e=this._peers[t])&&(this._debug("removePeer %s",t),delete this._peers[t],this._peersLength-=1,e.destroy(),this._drain())},F.prototype.select=function(e,t,r,n){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||H}),this._selections.sort(function(e,t){return t.priority-e.priority}),this._updateSelections()},F.prototype.deselect=function(e,t,r){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 n=0;n<this._selections.length;++n){var i=this._selections[n];if(i.from===e&&i.to===t&&i.priority===r){this._selections.splice(n,1);break}}this._updateSelections()},F.prototype.critical=function(e,t){if(this.destroyed)throw new Error("torrent is destroyed");this._debug("critical %s-%s",e,t);for(var r=e;r<=t;++r)this._critical[r]=!0;this._updateSelections()},F.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 i=o(r);e.remoteAddress=i[0],e.remotePort=i[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(P(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 O||n.private||(e.use(O()),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)})},F.prototype._onWireWithMetadata=function(e){var t,r=this,n=null;function i(){r.destroyed||e.destroyed||(r._numQueued>2*(r._numConns-r.numPeers)&&e.amInterested?e.destroy():(n=setTimeout(i,j)).unref&&n.unref())}function o(){if(e.peerPieces.buffer.length===r.bitfield.buffer.length){for(t=0;t<r.pieces.length;++t)if(!e.peerPieces.get(t))return;e.isSeeder=!0,e.choke()}}e.on("bitfield",function(){o(),r._update()}),e.on("have",function(){o(),r._update()}),e.once("interested",function(){e.unchoke()}),e.once("close",function(){clearTimeout(n)}),e.on("choke",function(){clearTimeout(n),(n=setTimeout(i,j)).unref&&n.unref()}),e.on("unchoke",function(){clearTimeout(n),r._update()}),e.on("request",function(t,n,i,o){if(i>131072)return e.destroy();r.pieces[t]||r.store.get(t,{offset:n,length:i},o)}),e.bitfield(r.bitfield),e.interested(),e.peerExtensions.dht&&r.client.dht&&r.client.dht.listening&&e.port(r.client.dht.address().port),"webSeed"!==e.type&&(n=setTimeout(i,j)).unref&&n.unref(),e.isSeeder=!1,o()},F.prototype._updateSelections=function(){var e=this;e.ready&&!e.destroyed&&(t.nextTick(function(){e._gcSelections()}),e._updateInterest(),e._update())},F.prototype._gcSelections=function(){for(var e=0;e<this._selections.length;++e){for(var t=this._selections[e],r=t.offset;this.bitfield.get(t.from+t.offset)&&t.from+t.offset<t.to;)t.offset+=1;r!==t.offset&&t.notify(),t.to===t.from+t.offset&&this.bitfield.get(t.from+t.offset)&&(this._selections.splice(e,1),e-=1,t.notify(),this._updateInterest())}this._selections.length||this.emit("idle")},F.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"))},F.prototype._update=function(){if(!this.destroyed)for(var e,t=I(this.wires);e=t();)this._updateWire(e)},F.prototype._updateWire=function(e){var t=this;if(!e.peerChoking){if(!e.downloaded)return function(){if(!e.requests.length)for(var r=t._selections.length;r--;){var n,o=t._selections[r];if("rarest"===t.strategy)for(var s=o.from+o.offset,a=o.to,u=a-s+1,c={},f=0,l=i(s,a,c);f<u&&!((n=t._rarityMap.getRarestPiece(l))<0);){if(t._request(e,n,!1))return;c[n]=!0,f+=1}else for(n=o.to;n>=o.from+o.offset;--n)if(e.peerPieces.get(n)&&t._request(e,n,!1))return}}();var r=q(e,.5);if(!(e.requests.length>=r)){var n=q(e,1);s(!1)||s(!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(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 s(r){if(e.requests.length>=n)return!0;for(var s=function(){var r=e.downloadSpeed()||1;if(r>M)return function(){return!0};var n=Math.max(1,e.requests.length)*A.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<M)&&!(u<=r)&&a.peerPieces.get(e)&&!((s-=u*n)>0))return i--,!1}return!0}}(),a=0;a<t._selections.length;a++){var u,c=t._selections[a];if("rarest"===t.strategy)for(var f=c.from+c.offset,l=c.to,h=l-f+1,p={},d=0,y=i(f,l,p,s);d<h&&!((u=t._rarityMap.getRarestPiece(y))<0);){for(;t._request(e,u,t._critical[u]||r););if(!(e.requests.length<n))return c.priority&&o(a),!0;p[u]=!0,d++}else for(u=c.from+c.offset;u<=c.to;u++)if(e.peerPieces.get(u)&&s(u)){for(;t._request(e,u,t._critical[u]||r););if(!(e.requests.length<n))return c.priority&&o(a),!0}}return!1}},F.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(function(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});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[function(e){return Math.random()*e|0}(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())})}},F.prototype._hotswap=function(e,t){var r=e.downloadSpeed();if(r<A.BLOCK_LENGTH)return!1;if(!this._reservations[t])return!1;var n=this._reservations[t];if(!n)return!1;var i,o,s=1/0;for(o=0;o<n.length;o++){var a=n[o];if(a&&a!==e){var u=a.downloadSpeed();u>=M||2*u>r||u>s||(i=a,s=u)}}if(!i)return!1;for(o=0;o<n.length;o++)n[o]===i&&(n[o]=null);for(o=0;o<i.requests.length;o++){var c=i.requests[o];c.piece===t&&this.pieces[t].cancel(c.offset/A.BLOCK_LENGTH|0)}return this.emit("hotswap",i,e,t),!0},F.prototype._request=function(e,r,n){var i=this,o=e.requests.length,s="webSeed"===e.type;if(i.bitfield.get(r))return!1;if(o>=(s?Math.min(function(e,t,r){return 1+Math.ceil(t*e.downloadSpeed()/r)}(e,1,i.pieceLength),i.maxWebConns):q(e,1)))return!1;var a=i.pieces[r],u=s?a.reserveRemaining():a.reserve();if(-1===u&&n&&i._hotswap(e,r)&&(u=s?a.reserveRemaining():a.reserve()),-1===u)return!1;var c=i._reservations[r];c||(c=i._reservations[r]=[]);var f=c.indexOf(null);-1===f&&(f=c.length),c[f]=e;var l=a.chunkOffset(u),h=s?a.chunkLengthRemaining(u):a.chunkLength(u);function p(){t.nextTick(function(){i._update()})}return e.request(r,l,h,function t(n,o){if(!i.destroyed){if(!i.ready)return i.once("ready",function(){t(n,o)});if(c[f]===e&&(c[f]=null),a!==i.pieces[r])return p();if(n)return i._debug("error getting piece %s (offset: %s length: %s) from %s: %s",r,l,h,e.remoteAddress+":"+e.remotePort,n.message),s?a.cancelRemaining(u):a.cancel(u),void p();if(i._debug("got piece %s (offset: %s length: %s) from %s",r,l,h,e.remoteAddress+":"+e.remotePort),!a.set(u,o,e))return p();var d=a.flush();T(d,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,d),i.wires.forEach(function(e){e.have(r)}),i._checkDone()&&!i.destroyed&&i.discovery.complete()}else i.pieces[r]=new A(a.length),i.emit("warning",new Error("Piece "+r+" failed verification"));p()}})}}),!0},F.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}},F.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=H);var n=new b(e),i=new a(r.store,r.pieceLength);x(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)})},F.prototype.createServer=function(e){if("function"!=typeof K)throw new Error("node.js-only method");if(this.destroyed)throw new Error("torrent is destroyed");var t=new K(this,e);return this._servers.push(t),t},F.prototype.pause=function(){this.destroyed||(this._debug("pause"),this.paused=!0)},F.prototype.resume=function(){this.destroyed||(this._debug("resume"),this.paused=!1,this._drain())},F.prototype._debug=function(){if(!this.destroyed){var e=[].slice.call(arguments);e[0]="["+this.client._debugId+"] ["+this._debugId+"] "+e[0],u.apply(null,e)}},F.prototype._drain=function(){var e=this;if(this._debug("_drain numConns %s maxConns %s",e._numConns,e.client.maxConns),!("function"!=typeof v.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=o(t.addr),n={host:r[0],port:r[1]},i=t.conn=v.connect(n);i.once("connect",function(){t.onConnect()}),i.once("error",function(e){t.destroy(e)}),t.startConnectTimeout(),i.on("close",function(){if(!e.destroyed)if(t.retries>=D.length)e._debug("conn %s closed: will not re-add (max %s attempts)",t.addr,D.length);else{var r=D[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(){var r=e._addPeer(t.addr);r&&(r.retries=t.retries+1)},r);n.unref&&n.unref()}})}}},F.prototype._validAddr=function(e){var t;try{t=o(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(7),r(6))},function(e,t){var r=/^\[?([^\]]+)\]?:(\d+)$/,n={},i=0;e.exports=function(t){if(1e5===i&&e.exports.reset(),!n[t]){var o=r.exec(t);if(!o)throw new Error("invalid addr: "+t);n[t]=[o[1],Number(o[2])],i+=1}return n[t]},e.exports.reset=function(){n={},i=0}},function(e,t,r){e.exports=s;var n=r(614),i=r(5),o=r(22);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)))throw new Error("Second argument must be a chunk length");i._blockstream=new n(t,{zeroPadding:!1}),i._blockstream.on("data",function(t){i.destroyed||(e.put(a,t),a+=1)}).on("error",function(e){i.destroy(e)});var a=0;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(1532),o=r(11).EventEmitter,s=r(26),a=r(5),u=r(147),c=r(1533);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;e._dhtAnnouncing||(n("dht announce"),e._dhtAnnouncing=!0,clearTimeout(e._dhtTimeout),e.dht.announce(e.infoHash,e._port,function(t){e._dhtAnnouncing=!1,n("dht announce complete"),t&&e.emit("warning",t),e.emit("dhtAnnounce"),e.destroyed||(e._dhtTimeout=setTimeout(function(){e._dhtAnnounce()},e._intervalMs+Math.floor(Math.random()*e._intervalMs/5)),e._dhtTimeout.unref&&e._dhtTimeout.unref())}))}}).call(this,r(7))},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(11).EventEmitter,s=r(26),a=r(5),u=r(30),c=r(147),f=r(191),l=r(205),h=r(33),p=r(621),d=r(1535),y=r(1536),g=r(1537);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.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=new m(s(e,{infoHash:Array.isArray(e.infoHash)?e.infoHash[0]:e.infoHash,peerId:n.from("01234567890123456789"),port:6881}));r.once("error",t),r.once("warning",t);var i=Array.isArray(e.infoHash)?e.infoHash.length:1,o={};return r.on("scrape",function(e){if(i-=1,o[e.infoHash]=e,0===i){r.destroy();var n=Object.keys(o);1===n.length?t(null,o[n[0]]):t(null,o)}}),e.infoHash=Array.isArray(e.infoHash)?e.infoHash.map(function(e){return n.from(e,"hex")}):n.from(e.infoHash,"hex"),r.scrape({infoHash:e.infoHash}),r},m.prototype.start=function(e){i("send `start`"),(e=this._defaultAnnounceOpts(e)).event="started",this._announce(e),this._trackers.forEach(function(e){e.setInterval()})},m.prototype.stop=function(e){i("send `stop`"),(e=this._defaultAnnounceOpts(e)).event="stopped",this._announce(e)},m.prototype.complete=function(e){i("send `complete`"),e||(e={}),(e=this._defaultAnnounceOpts(e)).event="completed",this._announce(e)},m.prototype.update=function(e){i("send `update`"),(e=this._defaultAnnounceOpts(e)).event&&delete e.event,this._announce(e)},m.prototype._announce=function(e){this._trackers.forEach(function(t){t.announce(e)})},m.prototype.scrape=function(e){i("send `scrape`"),e||(e={}),this._trackers.forEach(function(t){t.scrape(e)})},m.prototype.setInterval=function(e){i("setInterval %d",e),this._trackers.forEach(function(t){t.setInterval(e)})},m.prototype.destroy=function(e){if(!this.destroyed){this.destroyed=!0,i("destroy");var t=this._trackers.map(function(e){return function(t){e.destroy(t)}});c(t,e),this._trackers=[],this._getAnnounceOpts=null}},m.prototype._defaultAnnounceOpts=function(e){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(7))},function(e,t){},function(e,t){},function(e,t){},function(e,t,r){e.exports=p;var n=r(1)("bittorrent-tracker:websocket-tracker"),i=r(26),o=r(5),s=r(191),a=r(107),u=r(1538),c=r(621),f=r(1540),l={},h=5e4;function p(e,t,r){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 d(){}o(p,f),p.prototype.DEFAULT_ANNOUNCE_INTERVAL=3e4,p.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)})},p.prototype.scrape=function(e){var t=this;if(!t.destroyed&&!t.reconnecting)if(t.socket.connected){var r={action:"scrape",info_hash: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};t._send(r)}else t.socket.once("connect",function(){t.scrape(e)})},p.prototype.destroy=function(e){if(e||(e=d),this.destroyed)return e(null);for(var t in this.destroyed=!0,clearInterval(this.interval),clearTimeout(this.reconnectTimer),this.peers){var r=this.peers[t];clearTimeout(r.trackerTimeout),r.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 n=l[this.announceUrl];if(delete l[this.announceUrl],n.on("error",d),n.once("close",e),!this.expectingResponse)return o();var i=setTimeout(o,c.DESTROY_TIMEOUT);function o(){i&&(clearTimeout(i),i=null),n.removeListener("data",o),n.destroy(),n=null}n.once("data",o)},p.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)},p.prototype._onSocketConnect=function(){this.destroyed||this.reconnecting&&(this.reconnecting=!1,this.retries=0,this.announce(this.client._defaultAnnounceOpts()))},p.prototype._onSocketData=function(e){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))}},p.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,a=e["tracker id"];if(a&&(t._trackerId=a),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)"),(s=t._createPeer()).id=c.binaryToHex(e.peer_id),s.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)}),s.signal(e.offer),t.client.emit("peer",s)),e.answer&&e.peer_id){var f=c.binaryToHex(e.offer_id);(s=t.peers[f])?(s.id=c.binaryToHex(e.peer_id),s.signal(e.answer),t.client.emit("peer",s),clearTimeout(s.trackerTimeout),s.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)},p.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"))},p.prototype._onSocketClose=function(){this.destroyed||(this.destroy(),this._startReconnectTimer())},p.prototype._onSocketError=function(e){this.destroyed||(this.destroy(),this.client.emit("warning",e),this._startReconnectTimer())},p.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)},p.prototype._send=function(e){if(!this.destroyed){this.expectingResponse=!0;var t=JSON.stringify(e);n("send %s",t),this.socket.send(t)}},p.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()},h),t.trackerTimeout.unref&&t.trackerTimeout.unref()}function u(){i.length===e&&(n("generated %s offers",e),t(i))}u()},p.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",function e(){r.removeListener("error",n),r.removeListener("connect",e)}),r;function n(e){t.client.emit("warning",new Error("Connection error: "+e.message)),r.destroy()}}},function(e,t,r){(function(t){e.exports=f;var n=r(2).Buffer,i=r(1)("simple-websocket"),o=r(5),s=r(107),a=r(22),u=r(1539),c="function"!=typeof u?WebSocket:u;function f(e){var r=this;if(!(r instanceof f))return new f(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(f,a.Duplex),f.WEBSOCKET_SUPPORT=!!c,f.prototype.send=function(e){this._ws.send(e)},f.prototype.destroy=function(e){this._destroy(e,function(){})},f.prototype._destroy=function(e,t){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 r=this._ws,n=function(){r.onclose=null};if(r.readyState===c.CLOSED)n();else try{r.onclose=n,r.close()}catch(e){n()}r.onopen=null,r.onmessage=null,r.onerror=function(){}}if(this._ws=null,e){if("undefined"!=typeof DOMException&&e instanceof DOMException){var i=e.code;(e=new Error(e.message)).code=i}this.emit("error",e)}this.emit("close"),t()}},f.prototype._read=function(){},f.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},f.prototype._onFinish=function(){var e=this;function t(){setTimeout(function(){e.destroy()},1e3)}e.destroyed||(e.connected?t():e.once("connect",t))},f.prototype._onMessage=function(e){if(!this.destroyed){var t=e.data;t instanceof ArrayBuffer&&(t=n.from(t)),this.push(t)}},f.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")}},f.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)}},f.prototype._onClose=function(){this.destroyed||(this._debug("on close"),this.destroy())},f.prototype._debug=function(){var e=[].slice.call(arguments);e[0]="["+this._id+"] "+e[0],i.apply(null,e)}}).call(this,r(7))},function(e,t){},function(e,t,r){e.exports=i;var n=r(11).EventEmitter;function i(e,t){n.call(this),this.client=e,this.announceUrl=t,this.interval=null,this.destroyed=!1}r(5)(i,n),i.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(7))},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(7))},function(e,t){},function(e,t){},function(e,t,r){(function(t){e.exports=function(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}}).call(this,r(7))},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){e.exports=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}}},function(e,t,r){var n=r(204),i=r(206),o=r(2).Buffer,s=r(1)("ut_metadata"),a=r(11).EventEmitter,u=r(5),c=r(148),f=1e3;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:f}),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}e&&(this.setMetadata(this.metadata)||this._failedMetadata())},t.prototype._failedMetadata=function(){this._bitfield=new i(0,{grow:f}),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(193),i=r(11).EventEmitter,o=r(1552),s=r(5),a=r(64),u=r(1553),c=r(22),f=r(626),l=r(625),h=r(1571);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(7))},function(e,t,r){e.exports=s;var n=r(1)("webtorrent:file-stream"),i=r(5),o=r(22);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=function(e,t,r,n){"function"==typeof r&&(n=r,r={}),r||(r={}),n||(n=function(){}),v(e),w(r),"string"==typeof t&&(t=document.querySelector(t)),m(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)},t.append=function(e,t,r,n){if("function"==typeof r&&(n=r,r={}),r||(r={}),n||(n=function(){}),v(e),w(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){var r=document.createElement(e);return t.appendChild(r),r}m(e,function(e){return"video"===e||"audio"===e?function(e){var n=i(e);return r.autoplay&&(n.autoplay=!0),r.muted&&(n.muted=!0),r.controls&&(n.controls=!0),t.appendChild(n),n}(e):i(e)},r,function(e,t){e&&t&&t.remove(),n(e,t)})},t.mime=r(1554);var n=r(1)("render-media"),i=r(1555),o=r(624),s=r(64),a=r(625),u=r(1556),c=[".m4a",".m4v",".mp4"],f=[".m4v",".mkv",".mp4",".webm"],l=[].concat(f,[".m4a",".mp3"]),h=[".aac",".oga",".ogg",".wav",".flac"],p=[".bmp",".gif",".jpeg",".jpg",".png",".svg"],d=[".css",".html",".js",".md",".pdf",".txt"],y=2e8,g="undefined"!=typeof window&&window.MediaSource;function m(e,t,r,a){var y,m=s.extname(e.name).toLowerCase(),v=0;function w(){y.removeEventListener("loadstart",w),r.autoplay&&y.play()}function S(){y.removeEventListener("canplay",S),a(null,y)}function k(){b(e,function(e,r){if(e)return E(e);".pdf"!==m?((y=t("iframe")).sandbox="allow-forms allow-scripts",y.src=r):((y=t("object")).setAttribute("typemustmatch",!0),y.setAttribute("type","application/pdf"),y.setAttribute("data",r)),a(null,y)})}function E(t){t.message='Error rendering file "'+e.name+'": '+t.message,n(t.message),a(t)}l.indexOf(m)>=0?function(){var i=f.indexOf(m)>=0?"video":"audio";function s(){n("Use MediaSource API for "+e.name),p(),y.addEventListener("error",h),y.addEventListener("loadstart",w),y.addEventListener("canplay",S);var t=new o(y).createWriteStream(_(e.name));e.createReadStream().pipe(t),v&&(y.currentTime=v)}function a(){n("Use Blob URL for "+e.name),p(),y.addEventListener("error",E),y.addEventListener("loadstart",w),y.addEventListener("canplay",S),b(e,function(e,t){if(e)return E(e);y.src=t,v&&(y.currentTime=v)})}function l(e){n("videostream error: fallback to MediaSource API: %o",e.message||e),y.removeEventListener("error",l),y.removeEventListener("canplay",S),s()}function h(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),E(new Error("File length too large for Blob URL approach: "+e.length+" (max: "+r.maxBlobLength+")"));y.removeEventListener("error",h),y.removeEventListener("canplay",S),a()}function p(){y||(y=t(i)).addEventListener("progress",function(){v=y.currentTime})}g?c.indexOf(m)>=0?(n("Use `videostream` package for "+e.name),p(),y.addEventListener("error",l),y.addEventListener("loadstart",w),y.addEventListener("canplay",S),u(e,y)):s():a()}():h.indexOf(m)>=0?(y=t("audio"),b(e,function(e,t){if(e)return E(e);y.addEventListener("error",E),y.addEventListener("loadstart",w),y.addEventListener("canplay",S),y.src=t})):p.indexOf(m)>=0?(y=t("img"),b(e,function(t,r){if(t)return E(t);y.src=r,y.alt=e.name,a(null,y)})):d.indexOf(m)>=0?k():function(){n('Unknown file extension "%s" - will attempt to render into iframe',m);var t="";e.createReadStream({start:0,end:1e3}).setEncoding("utf8").on("data",function(e){t+=e}).on("end",function(){i(t)?(n('File extension "%s" appears ascii, so will render.',m),k()):(n('File extension "%s" appears non-ascii, will not render.',m),a(new Error('Unsupported file type "'+m+'": Cannot append to DOM')))}).on("error",a)}()}function b(e,r){var n=s.extname(e.name).toLowerCase();a(e.createReadStream(),t.mime[n],r)}function v(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 _(e){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"'}[s.extname(e).toLowerCase()]}function w(e){null==e.autoplay&&(e.autoplay=!1),null==e.muted&&(e.muted=!1),null==e.controls&&(e.controls=!0),null==e.maxBlobLength&&(e.maxBlobLength=y)}},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){e.exports=function(e){for(var t=0,r=e.length;t<r;++t)if(e.charCodeAt(t)>127)return!1;return!0}},function(e,t,r){var n=r(624),i=r(1557),o=r(1559);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(){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){var n=r(30),i=r(193),o=r(1558),s=function(){},a=function(e){return"function"==typeof e},u=function(e){return!!o&&(e instanceof(o.ReadStream||s)||e instanceof(o.WriteStream||s))&&a(e.close)},c=function(e,t,r,o){o=n(o);var c=!1;e.on("close",function(){c=!0}),i(e,{readable:t,writable:r},function(e){if(e)return o(e);c=!0,o()});var f=!1;return function(t){if(!c&&!f)return f=!0,u(e)?e.close(s):function(e){return e.setHeader&&a(e.abort)}(e)?e.abort():a(e.destroy)?e.destroy():void o(t||new Error("stream was destroyed"))}},f=function(e){e()},l=function(e,t){return e.pipe(t)};e.exports=function(){var e,t=Array.prototype.slice.call(arguments),r=a(t[t.length-1]||s)&&t.pop()||s;if(Array.isArray(t[0])&&(t=t[0]),t.length<2)throw new Error("pump requires two streams per minimum");var n=t.map(function(i,o){var s=o<t.length-1;return c(i,s,o>0,function(t){e||(e=t),t&&n.forEach(f),s||(n.forEach(f),r(e))})});return t.reduce(l)}},function(e,t){},function(e,t,r){(function(t){var n=r(1560),i=r(11).EventEmitter,o=r(5),s=r(1561),a=r(207),u=r(1570);function c(e){i.call(this),this._tracks=[],this._fragmentSequence=1,this._file=e,this._decoder=null,this._findMoov(0)}function f(e,t){this._entries=e,this._countName=t||"count",this._index=0,this._offset=0,this.value=this._entries[0]}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(){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=e.traks;this._tracks=[],this._hasVideo=!1,this._hasAudio=!1;for(var n=0;n<r.length;n++){var i,o,s=r[n],u=s.mdia.minf.stbl,c=u.stsd.entries[0],l=s.mdia.hdlr.handlerType;if("vide"===l&&"avc1"===c.type){if(this._hasVideo)continue;this._hasVideo=!0,i="avc1",c.avcC&&(i+="."+c.avcC.mimeCodec),o='video/mp4; codecs="'+i+'"'}else{if("soun"!==l||"mp4a"!==c.type)continue;if(this._hasAudio)continue;this._hasAudio=!0,i="mp4a",c.esds&&c.esds.mimeCodec&&(i+="."+c.esds.mimeCodec),o='audio/mp4; codecs="'+i+'"'}var h=[],p=0,d=0,y=0,g=0,m=0,b=0,v=new f(u.stts.entries),_=null;u.ctts&&(_=new f(u.ctts.entries));for(var w=0;;){var S=u.stsc.entries[m],k=u.stsz.entries[p],E=v.value.duration,A=_?_.value.compositionOffset:0,x=!0;if(u.stss&&(x=u.stss.entries[w]===p+1),h.push({size:k,duration:E,dts:b,presentationOffset:A,sync:x,offset:g+u.stco.entries[y]}),++p>=u.stsz.entries.length)break;if(g+=k,++d>=S.samplesPerChunk){d=0,g=0,y++;var I=u.stsc.entries[m+1];I&&y+1>=I.firstChunk&&m++}b+=E,v.inc(),_&&_.inc(),x&&w++}s.mdia.mdhd.duration=0,s.tkhd.duration=0;var T=S.sampleDescriptionId,B={type:"moov",mvhd:e.mvhd,traks:[{tkhd:s.tkhd,mdia:{mdhd:s.mdia.mdhd,hdlr:s.mdia.hdlr,elng:s.mdia.elng,minf:{vmhd:s.mdia.minf.vmhd,smhd:s.mdia.minf.smhd,dinf:s.mdia.minf.dinf,stbl:{stsd:u.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:s.tkhd.trackId,defaultSampleDescriptionIndex:T,defaultSampleDuration:0,defaultSampleSize:0,defaultSampleFlags:0}]}};this._tracks.push({trackId:s.tkhd.trackId,timeScale:s.mdia.mdhd.timeScale,samples:h,currSample:null,currTime:null,moov:B,mime:o})}if(0!==this._tracks.length){e.mvhd.duration=0,this._ftyp={type:"ftyp",brand:"iso5",brandVersion:0,compatibleBrands:["iso5"]};var C=a.encode(this._ftyp),P=this._tracks.map(function(e){var r=a.encode(e.moov);return{mime:e.mime,init:t.concat([C,r])}});this.emit("ready",P)}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();(-1===r||a.ranges[0].start<r)&&(r=a.ranges[0].start),function e(r){o.destroyed||o.box(r.moof,function(s){if(s)return t.emit("error",s);o.destroyed||n.inStream.slice(r.ranges).pipe(o.mediaData(r.length,function(r){if(r)return t.emit("error",r);if(!o.destroyed){var n=t._generateFragment(i);if(!n)return o.finalize();e(n)}}))})}(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._tracks[e],i=Math.floor(r.timeScale*t),o=n(r.samples,i,function(e,t){return e.dts+e.presentationOffset-t});for(-1===o?o=0:o<0&&(o=-o-2);!r.samples[o].sync;)o--;return o};c.prototype._generateFragment=function(e,t){var r,n=this._tracks[e];if((r=void 0!==t?this._findSampleBefore(e,t):n.currSample)>=n.samples.length)return null;for(var i=n.samples[r].dts,o=0,s=[],a=r;a<n.samples.length;a++){var u=n.samples[a];if(u.sync&&u.dts-i>=1*n.timeScale)break;o+=u.size;var c=s.length-1;c<0||s[c].end!==u.offset?s.push({start:u.offset,end:u.offset+u.size}):s[c].end+=u.size}return n.currSample=a,{moof:this._generateMoof(e,r,a),ranges:s,length:o}},c.prototype._generateMoof=function(e,t,r){for(var n=this._tracks[e],i=[],o=t;o<r;o++){var s=n.samples[o];i.push({sampleDuration:s.duration,sampleSize:s.size,sampleFlags:s.sync?33554432:16842752,sampleCompositionTimeOffset:s.presentationOffset})}var u={type:"moof",mfhd:{sequenceNumber:this._fragmentSequence++},trafs:[{tfhd:{flags:131072,trackId:n.trackId},tfdt:{baseMediaDecodeTime:n.samples[t].dts},trun:{flags:3841,dataOffset:8,entries:i}}]};return u.trafs[0].trun.dataOffset+=a.encodingLength(u),u}}).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)<0||n>=e.length)throw new RangeError("invalid lower bound");if(void 0===i)i=e.length-1;else if((i|=0)<n||i>=e.length)throw new RangeError("invalid upper bound");for(;n<=i;)if((s=+r(e[o=n+(i-n>>1)],t,o,e))<0)n=o+1;else{if(!(s>0))return o;i=o-1}return~n}},function(e,t,r){t.decode=r(1562),t.encode=r(1569)},function(e,t,r){(function(t){var n=r(22),i=r(5),o=r(1563),s=r(207),a=r(208),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))})}(8)},c.prototype.stream=function(){if(!this._headers)throw new Error("this function can only be called once after 'box' is emitted");var e=this._headers;return this._headers=null,this._stream(e.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){e.exports=function(e,t){var r=null;return e.on(t,function(e){if(r){var t=r;r=null,t(e)}}),function(e){r=e}}},function(e,t,r){(function(e){t.encodingLength=function(){return 8},t.encode=function(t,r,n){r||(r=new e(8)),n||(n=0);var i=Math.floor(t/4294967295),o=t-4294967295*i;return r.writeUInt32BE(i,n),r.writeUInt32BE(o,n+4),r},t.decode=function(t,r){return r||(r=0),t||(t=new e(4)),r||(r=0),4294967295*t.readUInt32BE(r)+t.readUInt32BE(r+4)},t.encode.bytes=8,t.decode.bytes=8}).call(this,r(0).Buffer)},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,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)>r&&e.fill(t,r,n),e}e.exports=function(e,i,o,s,a){if(r)return e.fill(i,o,s,a);if("number"==typeof i)return n(e,i,o,s);if("string"==typeof i){if("string"==typeof o?(a=o,o=0,s=e.length):"string"==typeof s&&(a=s,s=e.length),void 0!==a&&"string"!=typeof a)throw new TypeError("encoding must be a string");if("latin1"===a&&(a="binary"),"string"==typeof a&&!t.isEncoding(a))throw new TypeError("Unknown encoding: "+a);if(""===i)return n(e,0,o,s);if(function(e){return 1===e.length&&e.charCodeAt(0)<256}(i))return n(e,i.charCodeAt(0),o,s);i=new t(i,a)}return t.isBuffer(i)?function(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}(e,i,o,s):n(e,0,o,s)}}).call(this,r(0).Buffer)},function(e,t,r){(function(t){e.exports=function(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)}}).call(this,r(0).Buffer)},function(e,t,r){var n=r(207),i=r(1568),o=r(208),s=r(330),a=20828448e5;function u(e,t,r){for(var n=t;n<r;n++)e[n]=0}function c(e,t,r){t.writeUInt32BE(Math.floor((e.getTime()+a)/1e3),r)}function f(e,t,r){t.writeUInt16BE(Math.floor(e)%65536,r),t.writeUInt16BE(Math.floor(256*e*256)%65536,r+2)}function l(e,t,r){e||(e=[0,0,0,0,0,0,0,0,0]);for(var n=0;n<e.length;n++)f(e[n],t,r+4*n)}function h(e){for(var t=new Array(e.length/4),r=0;r<t.length;r++)t[r]=d(e,4*r);return t}function p(e,t){return new Date(1e3*e.readUInt32BE(t)-a)}function d(e,t){return e.readUInt16BE(t)+e.readUInt16BE(t+2)/65536}t.fullBoxes={},["mvhd","tkhd","mdhd","vmhd","smhd","stsd","esds","stsz","stco","stss","stts","ctts","stsc","dref","elst","hdlr","mehd","trex","mfhd","tfhd","tfdt","trun"].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){for(var r=(e=e.slice(t)).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),c(e.ctime||new Date,r,0),c(e.mtime||new Date,r,4),r.writeUInt32BE(e.timeScale||0,8),r.writeUInt32BE(e.duration||0,12),f(e.preferredRate||0,r,16),function(e,t,r){t[r]=Math.floor(e)%256,t[r+1]=Math.floor(256*e)%256}(e.preferredVolume||0,r,20),u(r,22,32),l(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{ctime:p(e=e.slice(t),0),mtime:p(e,4),timeScale:e.readUInt32BE(8),duration:e.readUInt32BE(12),preferredRate:d(e,16),preferredVolume:function(e,t){return e[t]+e[t+1]/256}(e,20),matrix:h(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),c(e.ctime||new Date,r,0),c(e.mtime||new Date,r,4),r.writeUInt32BE(e.trackId||0,8),u(r,12,16),r.writeUInt32BE(e.duration||0,16),u(r,20,28),r.writeUInt16BE(e.layer||0,28),r.writeUInt16BE(e.alternateGroup||0,30),r.writeUInt16BE(e.volume||0,32),l(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{ctime:p(e=e.slice(t),0),mtime:p(e,4),trackId:e.readUInt32BE(8),duration:e.readUInt32BE(16),layer:e.readUInt16BE(28),alternateGroup:e.readUInt16BE(30),volume:e.readUInt16BE(32),matrix:h(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 r=r?r.slice(n):o(20),c(e.ctime||new Date,r,0),c(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){return{ctime:p(e=e.slice(t),0),mtime:p(e,4),timeScale:e.readUInt32BE(8),duration:e.readUInt32BE(12),language:e.readUInt16BE(16),quality:e.readUInt16BE(18)}},t.mdhd.encodingLength=function(e){return 20},t.vmhd={},t.vmhd.encode=function(e,r,n){(r=r?r.slice(n):o(8)).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{graphicsMode:(e=e.slice(t)).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)).writeUInt16BE(e.balance||0,0),u(r,2,4),t.smhd.encode.bytes=4,r},t.smhd.decode=function(e,t){return{balance:(e=e.slice(t)).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){for(var i=(e=e.slice(t)).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){u(r=r?r.slice(i):o(t.VisualSampleEntry.encodingLength(e)),0,6),r.writeUInt16BE(e.dataReferenceIndex||0,6),u(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),u(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 c=78;(e.children||[]).forEach(function(e){n.encode(e,r,c),c+=n.encode.bytes}),t.VisualSampleEntry.encode.bytes=c},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;return(e.children||[]).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{mimeCodec:(e=e.slice(t,r)).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){u(r=r?r.slice(i):o(t.AudioSampleEntry.encodingLength(e)),0,6),r.writeUInt16BE(e.dataReferenceIndex||0,6),u(r,8,16),r.writeUInt16BE(e.channelCount||2,16),r.writeUInt16BE(e.sampleSize||16,18),u(r,20,24),r.writeUInt32BE(e.sampleRate||0,24);var s=28;(e.children||[]).forEach(function(e){n.encode(e,r,s),s+=n.encode.bytes}),t.AudioSampleEntry.encode.bytes=s},t.AudioSampleEntry.decode=function(e,t,r){for(var i=r-t,o={dataReferenceIndex:(e=e.slice(t,r)).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;return(e.children||[]).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:{}).DecoderConfigDescriptor||{},a=o.oti||0,u=o.DecoderSpecificInfo,c=u?(248&u.buffer.readUInt8(0))>>3:0,f=null;return a&&(f=a.toString(16),c&&(f+="."+c)),{mimeCodec:f,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))).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){for(var r=(e=e.slice(t)).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))).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){for(var r=(e=e.slice(t)).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.stts={},t.stts.encode=function(e,r,n){var i=e.entries||[];(r=r?r.slice(n):o(t.stts.encodingLength(e))).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){for(var r=(e=e.slice(t)).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))).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){for(var r=(e=e.slice(t)).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))).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){for(var r=(e=e.slice(t)).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){for(var r=(e=e.slice(t)).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))).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),f(i[s].mediaRate||0,r,a+8)}return t.elst.encode.bytes=4+12*i.length,r},t.elst.decode=function(e,t){for(var r=(e=e.slice(t)).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:d(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"),function(e,t,r){var n=s(e,"utf8");n.copy(t,r),t[r+n.length]=0}(e.name||"",r,20),t.hdlr.encode.bytes=i,r},t.hdlr.decode=function(e,t,r){return{handlerType:(e=e.slice(t)).toString("ascii",4,8),name:function(e,t,r){var n;for(n=0;n<r&&0!==e[t+n];n++);return e.toString("utf8",t,t+n)}(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)).writeUInt32BE(e.fragmentDuration||0,0),t.mehd.encode.bytes=4,r},t.mehd.decode=function(e,t){return{fragmentDuration:(e=e.slice(t)).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)).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{trackId:(e=e.slice(t)).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)).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)).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)).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)).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,r.writeUInt32BE(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(330),i={3:"ESDescriptor",4:"DecoderConfigDescriptor",5:"DecoderSpecificInfo",6:"SLConfigDescriptor"};t.Descriptor={},t.Descriptor.decode=function(e,r,o){var s,a,u=e.readUInt8(r),c=r+1,f=0;do{f=f<<7|127&(s=e.readUInt8(c++))}while(128&s);var l=i[u];return(a=t[l]?t[l].decode(e,c,o):{buffer:n(e.slice(c,c+f))}).tag=u,a.tagName=l,a.length=c-r+f,a.contentsLen=f,a},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,s[i[a.tag]||"Descriptor"+a.tag]=a}return s},t.ESDescriptor={},t.ESDescriptor.decode=function(e,r,n){var i=e.readUInt8(r+2),o=r+3;return 128&i&&(o+=2),64&i&&(o+=e.readUInt8(o)+1),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(22),i=r(5),o=r(207),s=r(208);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=function(){e._want&&(e._want=!1,e._read())},this._onend=function(){e._stream=null};var e=this}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{if(n=o.encode(e,n),this.push(n))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(7))},function(e,t,r){var n=r(5),i=r(22);function o(e,t){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=!0;;){if(this.destroyed)return;if(0===this._queue.length)return this._buffer=e,void(this._cb=r);this._buffer=null;var i,o=this._queue[0],s=Math.max(o.start-this._position,0),a=o.end-this._position;if(s>=e.length)return this._position+=e.length,r(null);if(a>e.length){this._position+=e.length,i=0===s?e:e.slice(s),n=o.stream.write(i)&&n;break}this._position+=a,i=0===s&&a===e.length?e:e.slice(s,a),n=o.stream.write(i)&&n,o.last&&o.stream.end(),e=e.slice(a),this._queue.shift()}n?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){this.destroyed||(this.destroyed=!0,e&&this.emit("error",e))}},function(e,t,r){(function(t){var n=r(30);e.exports=function(e,r,i){i=n(i);var o=t.alloc(r),s=0;e.on("data",function(e){e.copy(o,s),s+=e.length}).on("end",function(){i(null,o)}).on("error",i)}}).call(this,r(0).Buffer)},function(e,t,r){var n=r(627),i=r(1)("webtorrent:peer"),o=r(628),s=r(1573);function a(e,t){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 u(){}t.createWebRTCPeer=function(e,t){var r=new a(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 a(t,"tcpIncoming");return r.conn=e,r.addr=t,r.onConnect(),r},t.createTCPOutgoingPeer=function(e,t){var r=new a(e,"tcpOutgoing");return r.addr=e,r.swarm=t,r},t.createWebSeedPeer=function(e,t){var r=new a(e,"webSeed");return r.swarm=t,r.conn=new s(e,t),r.onConnect(),r},a.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()}},a.prototype.onHandshake=function(e,t){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 r=this.addr;!r&&this.conn.remoteAddress&&this.conn.remotePort&&(r=this.conn.remoteAddress+":"+this.conn.remotePort),this.swarm._onWire(this.wire,r),this.swarm&&!this.swarm.destroyed&&(this.sentHandshake||this.handshake())}},a.prototype.handshake=function(){var e={dht:!this.swarm.private&&!!this.swarm.client.dht};this.wire.handshake(this.swarm.infoHash,this.swarm.client.peerId,e),this.sentHandshake=!0},a.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()},a.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()},a.prototype.destroy=function(e){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 t=this.swarm,r=this.conn,o=this.wire;this.swarm=null,this.conn=null,this.wire=null,t&&o&&n(t.wires,t.wires.indexOf(o)),r&&(r.on("error",u),r.destroy()),o&&o.destroy(),t&&t.removePeer(this.id)}}},function(e,t,r){e.exports=l;var n=r(206),i=r(2).Buffer,o=r(1)("webtorrent:webconn"),s=r(623),a=r(5),u=r(148),c=r(628),f=r(331).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,u=this,c=e*u._torrent.pieceLength+t,l=c+r-1,h=u._torrent.files;if(h.length<=1)a=[{url:u.url,start:c,end:l}];else{var p=h.filter(function(e){return e.offset<=l&&e.offset+e.length>c});if(p.length<1)return n(new Error("Could not find file corresponnding to web seed range request"));a=p.map(function(e){var t=e.offset+e.length-1;return{url:u.url+("/"===u.url[u.url.length-1]?"":"/")+e.path,fileOffsetInRange:Math.max(e.offset-c,0),start:Math.max(c-e.offset,0),end:Math.min(t,l-e.offset)}})}var d,y=0,g=!1;a.length>1&&(d=i.alloc(r)),a.forEach(function(i){var u=i.url,c=i.start,l=i.end;o("Requesting url=%s pieceIndex=%d offset=%d length=%d start=%d end=%d",u,e,t,r,c,l);var h={url:u,method:"GET",headers:{"user-agent":"WebTorrent/"+f+" (https://webtorrent.io)",range:"bytes="+c+"-"+l}};function p(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===a.length?n(null,t):(t.copy(d,i.fileOffsetInRange),++y===a.length&&n(null,d))}s.concat(h,function(e,t,r){if(!g)return e?"undefined"==typeof window||u.startsWith(window.location.origin+"/")?(g=!0,n(e)):s.head(u,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===u)return g=!0,n(e);h.url=r.url,s.concat(h,function(e,t,r){if(!g)return e?(g=!0,n(e)):void p(t,r)})}}):void p(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(t){const n=r(33);t.env.GUN_ENV="false";const i=r(629);r(1577);const o=r(79),s=r(116),a=r(101),u=r(149);let c={peers:["https://dweb.me:4246/gun"]};class f extends s{constructor(e,t){super(e,t),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=s.STATUS_LOADED}connection(e,t){let r=(e=n.parse(e)).pathname.split("/");return r.shift(),r.shift(),t&&console.log("Path=",r),this.gun.path(r)}static setup0(e,t){let r=s.mergeoptions(c,e.gun);console.log("GUN options %o",r);let n=new f(r,t);return n.gun=new i(n.options),a.addtransport(n),n}async p_setup1(e,t){try{this.status=s.STATUS_STARTING,t&&t(this),await this.p_status(e)}catch(e){console.error(this.name,"failed to start",e),this.status=s.STATUS_FAILED}return t&&t(this),this}async p_status(e){return this.status=s.STATUS_CONNECTED,this.status}async p_rawfetch(e,{verbose:t=!1}={}){e=n.parse(e);let r=this.connection(e,t),i=await this._p_once(r);if(!i)throw new o.TransportError("GUN unable to retrieve: "+e.href);return"string"==typeof i?JSON.parse(i):i}async p_rawlist(e,{verbose:t=!1}={}){try{let r=this.connection(e,t),n=await this._p_once(r),i=n?Object.keys(n).filter(e=>"_"!==e).sort().map(e=>n[e]):[];return t&&console.log("GUN.p_rawlist found",...u.consolearr(i)),i}catch(e){throw console.log("TransportGUN.p_rawlist failed",e.message),e}}listmonitor(e,t,{verbose:r=!1,current:n=!1}={}){let i=this.connection(e,r);n?i.map().on((e,r)=>t("set",r,JSON.parse(e))):i.once(e=>{this.monitored=e?Object.keys(e):[],i.map().on((e,r)=>{this.monitored.includes(r)||"_"===r||(this.monitored.push(r),t(JSON.parse(e)))})})}async p_rawadd(e,t,{verbose:r=!1}={}){console.assert(e&&t.urls.length&&t.signature&&t.signedby.length,"TransportGUN.p_rawadd args",e,t),r&&console.log("TransportGUN.p_rawadd","string"==typeof e?e:e.href,t),this.connection(e,r).set(JSON.stringify(t.preflight(Object.assign({},t))))}async p_newlisturls(e,{verbose:t=!1}={}){let r=await this._p_newgun(e,{verbose:t});return[r,r]}async _p_newgun(e,{verbose:t=!1}={}){return e.hasOwnProperty("keypair")&&(e=e.keypair.signingexport()),`gun:/gun/${encodeURIComponent(e)}`}async p_newdatabase(e,{verbose:t=!1}={}){let r=await this._p_newgun(e,{verbose:t});return{publicurl:r,privateurl:r}}async p_newtable(e,t,{verbose:r=!1}={}){if(!e)throw new o.CodingError("p_newtable currently requires a pubkey");let n=await this.p_newdatabase(e,{verbose:r});return{privateurl:`${n.privateurl}/${t}`,publicurl:`${n.publicurl}/${t}`}}async p_set(e,t,r,{verbose:n=!1}={}){let i=this.connection(e,n);"string"==typeof t?i.path(t).put(JSON.stringify(r)):(console.assert(!Array.isArray(t),"TransportGUN - shouldnt be passsing an array as the keyvalues"),i.put(Object.keys(t).reduce(function(e,r){return e[r]=JSON.stringify(t[r]),e},{})))}async p_get(e,t,{verbose:r=!1}={}){let n=this.connection(e,r);if(Array.isArray(t))throw new o.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(n.get(t));return"string"==typeof e?JSON.parse(e):e}}async p_delete(e,t,{verbose:r=!1}={}){let n=this.connection(e,r);"string"==typeof t?n.path(t).put(null):t.map(e=>n.path(e).put(null))}_p_once(e){return new Promise((t,r)=>e.once(t))}async p_keys(e,{verbose:t=!1}={}){let r=await this._p_once(this.connection(e,t));return Object.keys(r).filter(e=>"_"!==e&&null!==r[e])}async p_getall(e,{verbose:t=!1}={}){let r=await this._p_once(this.connection(e,t));return Object.keys(r).filter(e=>"_"!==e&&null!==r[e]).reduce(function(e,t){return e[t]=JSON.parse(r[t]),e},{})}async monitor(e,t,{verbose:r=!1,current:n=!1}={}){let i=this.connection(e,r);n?i.map().on((e,r)=>t("set",r,JSON.parse(e))):i.once(e=>{this.monitored=Object.assign({},e),i.map().on((e,r)=>{e!==this.monitored[r]&&"_"!==r&&(this.monitored[r]=e,t("set",r,JSON.parse(e)))})})}static async p_test(e){e&&console.log("TransportGUN.test");try{let t=this.setup0({},e);await t.p_setup1(e),await t.p_setup2(e),t.p_test_kvt("gun:/gun/NACL",{verbose:e})}catch(e){throw console.log("Exception thrown in TransportGUN.test:",e.message),e}}static async demo_bugs(){let e=new i;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))}}a._transportclasses.GUN=f,e.exports=f}).call(this,r(7))},function(e,t,r){("undefined"!=typeof window?window.Gun:r(629)).chain.path=function(e,t){var r,n=this;if("string"==typeof e){if(1===(r=e.split(t||".")).length)return this.get(e);e=r}if(e instanceof Array){if(e.length>1){n=this;for(var i=0,o=e.length;i<o;i++)n=n.get(e[i])}else n=this.get(e[0]);return n}return e||0==e?n=this.get(""+e):this}}]); |