1 line
366 KiB
JavaScript
1 line
366 KiB
JavaScript
var OrbitDB=function(e){function t(n){if(r[n])return r[n].exports;var i=r[n]={i:n,l:!1,exports:{}};return e[n].call(i.exports,i,i.exports,t),i.l=!0,i.exports}var r={};return t.m=e,t.c=r,t.d=function(e,r,n){t.o(e,r)||Object.defineProperty(e,r,{configurable:!1,enumerable:!0,get:n})},t.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(r,"a",r),r},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=69)}([function(e,t){function r(){throw new Error("setTimeout has not been defined")}function n(){throw new Error("clearTimeout has not been defined")}function i(e){if(f===setTimeout)return setTimeout(e,0);if((f===r||!f)&&setTimeout)return f=setTimeout,setTimeout(e,0);try{return f(e,0)}catch(t){try{return f.call(null,e,0)}catch(t){return f.call(this,e,0)}}}function o(){p&&d&&(p=!1,d.length?l=d.concat(l):b=-1,l.length&&s())}function s(){if(!p){var e=i(o);p=!0;for(var t=l.length;t;){for(d=l,l=[];++b<t;)d&&d[b].run();b=-1,t=l.length}d=null,p=!1,function(e){if(u===clearTimeout)return clearTimeout(e);if((u===n||!u)&&clearTimeout)return u=clearTimeout,clearTimeout(e);try{u(e)}catch(t){try{return u.call(null,e)}catch(t){return u.call(this,e)}}}(e)}}function a(e,t){this.fun=e,this.array=t}function c(){}var f,u,h=e.exports={};!function(){try{f="function"==typeof setTimeout?setTimeout:r}catch(e){f=r}try{u="function"==typeof clearTimeout?clearTimeout:n}catch(e){u=n}}();var d,l=[],p=!1,b=-1;h.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];l.push(new a(e,t)),1!==l.length||p||i(s)},a.prototype.run=function(){this.fun.apply(null,this.array)},h.title="browser",h.browser=!0,h.env={},h.argv=[],h.version="",h.versions={},h.on=c,h.addListener=c,h.once=c,h.off=c,h.removeListener=c,h.removeAllListeners=c,h.emit=c,h.prependListener=c,h.prependOnceListener=c,h.listeners=function(e){return[]},h.binding=function(e){throw new Error("process.binding is not supported")},h.cwd=function(){return"/"},h.chdir=function(e){throw new Error("process.chdir is not supported")},h.umask=function(){return 0}},function(e,t,r){"use strict";(function(e){function n(){return o.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function i(e,t){if(n()<t)throw new RangeError("Invalid typed array length");return o.TYPED_ARRAY_SUPPORT?(e=new Uint8Array(t)).__proto__=o.prototype:(null===e&&(e=new o(t)),e.length=t),e}function o(e,t,r){if(!(o.TYPED_ARRAY_SUPPORT||this instanceof o))return new o(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 c(this,e)}return s(this,e,t,r)}function s(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");t=void 0===r&&void 0===n?new Uint8Array(t):void 0===n?new Uint8Array(t,r):new Uint8Array(t,r,n);o.TYPED_ARRAY_SUPPORT?(e=t).__proto__=o.prototype:e=f(e,t);return e}(e,t,r,n):"string"==typeof t?function(e,t,r){"string"==typeof r&&""!==r||(r="utf8");if(!o.isEncoding(r))throw new TypeError('"encoding" must be a valid string encoding');var n=0|h(t,r),s=(e=i(e,n)).write(t,r);s!==n&&(e=e.slice(0,s));return e}(e,t,r):function(e,t){if(o.isBuffer(t)){var r=0|u(t.length);return 0===(e=i(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)?i(e,0):f(e,t);if("Buffer"===t.type&&T(t.data))return f(e,t.data)}throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}(e,t)}function a(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 c(e,t){if(a(t),e=i(e,t<0?0:0|u(t)),!o.TYPED_ARRAY_SUPPORT)for(var r=0;r<t;++r)e[r]=0;return e}function f(e,t){var r=t.length<0?0:0|u(t.length);e=i(e,r);for(var n=0;n<r;n+=1)e[n]=255&t[n];return e}function u(e){if(e>=n())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+n().toString(16)+" bytes");return 0|e}function h(e,t){if(o.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 N(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return R(e).length;default:if(n)return N(e).length;t=(""+t).toLowerCase(),n=!0}}function d(e,t,r){var n=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if(r>>>=0,t>>>=0,r<=t)return"";for(e||(e="utf8");;)switch(e){case"hex":return function(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+=function(e){return e<16?"0"+e.toString(16):e.toString(16)}(e[o]);return i}(this,t,r);case"utf8":case"utf-8":return S(this,t,r);case"ascii":return function(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}(this,t,r);case"latin1":case"binary":return function(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}(this,t,r);case"base64":return function(e,t,r){return 0===t&&r===e.length?C.fromByteArray(e):C.fromByteArray(e.slice(t,r))}(this,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return function(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}(this,t,r);default:if(n)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),n=!0}}function l(e,t,r){var n=e[t];e[t]=e[r],e[r]=n}function p(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=o.from(t,n)),o.isBuffer(t))return 0===t.length?-1:b(e,t,r,n,i);if("number"==typeof t)return t&=255,o.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(e,t,r):Uint8Array.prototype.lastIndexOf.call(e,t,r):b(e,[t],r,n,i);throw new TypeError("val must be string, number or Buffer")}function b(e,t,r,n,i){function o(e,t){return 1===s?e[t]:e.readUInt16BE(t*s)}var s=1,a=e.length,c=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,c/=2,r/=2}var f;if(i){var u=-1;for(f=r;f<a;f++)if(o(e,f)===o(t,-1===u?0:f-u)){if(-1===u&&(u=f),f-u+1===c)return u*s}else-1!==u&&(f-=f-u),u=-1}else for(r+c>a&&(r=a-c),f=r;f>=0;f--){for(var h=!0,d=0;d<c;d++)if(o(e,f+d)!==o(t,d)){h=!1;break}if(h)return f}return-1}function y(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 g(e,t,r,n){return P(N(t,e.length-r),e,r,n)}function m(e,t,r,n){return P(function(e){for(var t=[],r=0;r<e.length;++r)t.push(255&e.charCodeAt(r));return t}(t),e,r,n)}function v(e,t,r,n){return m(e,t,r,n)}function _(e,t,r,n){return P(R(t),e,r,n)}function w(e,t,r,n){return P(function(e,t){for(var r,n,i,o=[],s=0;s<e.length&&!((t-=2)<0);++s)r=e.charCodeAt(s),n=r>>8,i=r%256,o.push(i),o.push(n);return o}(t,e.length-r),e,r,n)}function S(e,t,r){r=Math.min(e.length,r);for(var n=[],i=t;i<r;){var o=e[i],s=null,a=o>239?4:o>223?3:o>191?2:1;if(i+a<=r){var c,f,u,h;switch(a){case 1:o<128&&(s=o);break;case 2:128==(192&(c=e[i+1]))&&(h=(31&o)<<6|63&c)>127&&(s=h);break;case 3:c=e[i+1],f=e[i+2],128==(192&c)&&128==(192&f)&&(h=(15&o)<<12|(63&c)<<6|63&f)>2047&&(h<55296||h>57343)&&(s=h);break;case 4:c=e[i+1],f=e[i+2],u=e[i+3],128==(192&c)&&128==(192&f)&&128==(192&u)&&(h=(15&o)<<18|(63&c)<<12|(63&f)<<6|63&u)>65535&&h<1114112&&(s=h)}}null===s?(s=65533,a=1):s>65535&&(s-=65536,n.push(s>>>10&1023|55296),s=56320|1023&s),n.push(s),i+=a}return function(e){var t=e.length;if(t<=L)return String.fromCharCode.apply(String,e);var r="",n=0;for(;n<t;)r+=String.fromCharCode.apply(String,e.slice(n,n+=L));return r}(n)}function k(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 E(e,t,r,n,i,s){if(!o.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>i||t<s)throw new RangeError('"value" argument is out of bounds');if(r+n>e.length)throw new RangeError("Index out of range")}function x(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 M(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 A(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 O(e,t,r,n,i){return i||A(e,0,r,4),j.write(e,t,r,n,23,4),r+4}function I(e,t,r,n,i){return i||A(e,0,r,8),j.write(e,t,r,n,52,8),r+8}function N(e,t){t=t||1/0;for(var r,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 R(e){return C.toByteArray(function(e){if((e=function(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")}(e).replace(B,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function P(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}var C=r(70),j=r(71),T=r(35);t.Buffer=o,t.SlowBuffer=function(e){return+e!=e&&(e=0),o.alloc(+e)},t.INSPECT_MAX_BYTES=50,o.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=n(),o.poolSize=8192,o._augment=function(e){return e.__proto__=o.prototype,e},o.from=function(e,t,r){return s(null,e,t,r)},o.TYPED_ARRAY_SUPPORT&&(o.prototype.__proto__=Uint8Array.prototype,o.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&o[Symbol.species]===o&&Object.defineProperty(o,Symbol.species,{value:null,configurable:!0})),o.alloc=function(e,t,r){return function(e,t,r,n){return a(t),t<=0?i(e,t):void 0!==r?"string"==typeof n?i(e,t).fill(r,n):i(e,t).fill(r):i(e,t)}(null,e,t,r)},o.allocUnsafe=function(e){return c(null,e)},o.allocUnsafeSlow=function(e){return c(null,e)},o.isBuffer=function(e){return!(null==e||!e._isBuffer)},o.compare=function(e,t){if(!o.isBuffer(e)||!o.isBuffer(t))throw new TypeError("Arguments must be Buffers");if(e===t)return 0;for(var r=e.length,n=t.length,i=0,s=Math.min(r,n);i<s;++i)if(e[i]!==t[i]){r=e[i],n=t[i];break}return r<n?-1:n<r?1:0},o.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}},o.concat=function(e,t){if(!T(e))throw new TypeError('"list" argument must be an Array of Buffers');if(0===e.length)return o.alloc(0);var r;if(void 0===t)for(t=0,r=0;r<e.length;++r)t+=e[r].length;var n=o.allocUnsafe(t),i=0;for(r=0;r<e.length;++r){var s=e[r];if(!o.isBuffer(s))throw new TypeError('"list" argument must be an Array of Buffers');s.copy(n,i),i+=s.length}return n},o.byteLength=h,o.prototype._isBuffer=!0,o.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)l(this,t,t+1);return this},o.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)l(this,t,t+3),l(this,t+1,t+2);return this},o.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)l(this,t,t+7),l(this,t+1,t+6),l(this,t+2,t+5),l(this,t+3,t+4);return this},o.prototype.toString=function(){var e=0|this.length;return 0===e?"":0===arguments.length?S(this,0,e):d.apply(this,arguments)},o.prototype.equals=function(e){if(!o.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e||0===o.compare(this,e)},o.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+">"},o.prototype.compare=function(e,t,r,n,i){if(!o.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 s=i-n,a=r-t,c=Math.min(s,a),f=this.slice(n,i),u=e.slice(t,r),h=0;h<c;++h)if(f[h]!==u[h]){s=f[h],a=u[h];break}return s<a?-1:a<s?1:0},o.prototype.includes=function(e,t,r){return-1!==this.indexOf(e,t,r)},o.prototype.indexOf=function(e,t,r){return p(this,e,t,r,!0)},o.prototype.lastIndexOf=function(e,t,r){return p(this,e,t,r,!1)},o.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 y(this,e,t,r);case"utf8":case"utf-8":return g(this,e,t,r);case"ascii":return m(this,e,t,r);case"latin1":case"binary":return v(this,e,t,r);case"base64":return _(this,e,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return w(this,e,t,r);default:if(o)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),o=!0}},o.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var L=4096;o.prototype.slice=function(e,t){var r=this.length;e=~~e,t=void 0===t?r:~~t,e<0?(e+=r)<0&&(e=0):e>r&&(e=r),t<0?(t+=r)<0&&(t=0):t>r&&(t=r),t<e&&(t=e);var n;if(o.TYPED_ARRAY_SUPPORT)(n=this.subarray(e,t)).__proto__=o.prototype;else{var i=t-e;n=new o(i,void 0);for(var s=0;s<i;++s)n[s]=this[s+e]}return n},o.prototype.readUIntLE=function(e,t,r){e|=0,t|=0,r||k(e,t,this.length);for(var n=this[e],i=1,o=0;++o<t&&(i*=256);)n+=this[e+o]*i;return n},o.prototype.readUIntBE=function(e,t,r){e|=0,t|=0,r||k(e,t,this.length);for(var n=this[e+--t],i=1;t>0&&(i*=256);)n+=this[e+--t]*i;return n},o.prototype.readUInt8=function(e,t){return t||k(e,1,this.length),this[e]},o.prototype.readUInt16LE=function(e,t){return t||k(e,2,this.length),this[e]|this[e+1]<<8},o.prototype.readUInt16BE=function(e,t){return t||k(e,2,this.length),this[e]<<8|this[e+1]},o.prototype.readUInt32LE=function(e,t){return t||k(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},o.prototype.readUInt32BE=function(e,t){return t||k(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},o.prototype.readIntLE=function(e,t,r){e|=0,t|=0,r||k(e,t,this.length);for(var n=this[e],i=1,o=0;++o<t&&(i*=256);)n+=this[e+o]*i;return i*=128,n>=i&&(n-=Math.pow(2,8*t)),n},o.prototype.readIntBE=function(e,t,r){e|=0,t|=0,r||k(e,t,this.length);for(var n=t,i=1,o=this[e+--n];n>0&&(i*=256);)o+=this[e+--n]*i;return i*=128,o>=i&&(o-=Math.pow(2,8*t)),o},o.prototype.readInt8=function(e,t){return t||k(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},o.prototype.readInt16LE=function(e,t){t||k(e,2,this.length);var r=this[e]|this[e+1]<<8;return 32768&r?4294901760|r:r},o.prototype.readInt16BE=function(e,t){t||k(e,2,this.length);var r=this[e+1]|this[e]<<8;return 32768&r?4294901760|r:r},o.prototype.readInt32LE=function(e,t){return t||k(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},o.prototype.readInt32BE=function(e,t){return t||k(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},o.prototype.readFloatLE=function(e,t){return t||k(e,4,this.length),j.read(this,e,!0,23,4)},o.prototype.readFloatBE=function(e,t){return t||k(e,4,this.length),j.read(this,e,!1,23,4)},o.prototype.readDoubleLE=function(e,t){return t||k(e,8,this.length),j.read(this,e,!0,52,8)},o.prototype.readDoubleBE=function(e,t){return t||k(e,8,this.length),j.read(this,e,!1,52,8)},o.prototype.writeUIntLE=function(e,t,r,n){if(e=+e,t|=0,r|=0,!n){E(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},o.prototype.writeUIntBE=function(e,t,r,n){if(e=+e,t|=0,r|=0,!n){E(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},o.prototype.writeUInt8=function(e,t,r){return e=+e,t|=0,r||E(this,e,t,1,255,0),o.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[t]=255&e,t+1},o.prototype.writeUInt16LE=function(e,t,r){return e=+e,t|=0,r||E(this,e,t,2,65535,0),o.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):x(this,e,t,!0),t+2},o.prototype.writeUInt16BE=function(e,t,r){return e=+e,t|=0,r||E(this,e,t,2,65535,0),o.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):x(this,e,t,!1),t+2},o.prototype.writeUInt32LE=function(e,t,r){return e=+e,t|=0,r||E(this,e,t,4,4294967295,0),o.TYPED_ARRAY_SUPPORT?(this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e):M(this,e,t,!0),t+4},o.prototype.writeUInt32BE=function(e,t,r){return e=+e,t|=0,r||E(this,e,t,4,4294967295,0),o.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):M(this,e,t,!1),t+4},o.prototype.writeIntLE=function(e,t,r,n){if(e=+e,t|=0,!n){var i=Math.pow(2,8*r-1);E(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},o.prototype.writeIntBE=function(e,t,r,n){if(e=+e,t|=0,!n){var i=Math.pow(2,8*r-1);E(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},o.prototype.writeInt8=function(e,t,r){return e=+e,t|=0,r||E(this,e,t,1,127,-128),o.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),e<0&&(e=255+e+1),this[t]=255&e,t+1},o.prototype.writeInt16LE=function(e,t,r){return e=+e,t|=0,r||E(this,e,t,2,32767,-32768),o.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):x(this,e,t,!0),t+2},o.prototype.writeInt16BE=function(e,t,r){return e=+e,t|=0,r||E(this,e,t,2,32767,-32768),o.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):x(this,e,t,!1),t+2},o.prototype.writeInt32LE=function(e,t,r){return e=+e,t|=0,r||E(this,e,t,4,2147483647,-2147483648),o.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24):M(this,e,t,!0),t+4},o.prototype.writeInt32BE=function(e,t,r){return e=+e,t|=0,r||E(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),o.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):M(this,e,t,!1),t+4},o.prototype.writeFloatLE=function(e,t,r){return O(this,e,t,!0,r)},o.prototype.writeFloatBE=function(e,t,r){return O(this,e,t,!1,r)},o.prototype.writeDoubleLE=function(e,t,r){return I(this,e,t,!0,r)},o.prototype.writeDoubleBE=function(e,t,r){return I(this,e,t,!1,r)},o.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,s=n-r;if(this===e&&r<t&&t<n)for(i=s-1;i>=0;--i)e[i+t]=this[i+r];else if(s<1e3||!o.TYPED_ARRAY_SUPPORT)for(i=0;i<s;++i)e[i+t]=this[i+r];else Uint8Array.prototype.set.call(e,this.subarray(r,r+s),t);return s},o.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&&!o.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;t>>>=0,r=void 0===r?this.length:r>>>0,e||(e=0);var s;if("number"==typeof e)for(s=t;s<r;++s)this[s]=e;else{var a=o.isBuffer(e)?e:N(new o(e,n).toString()),c=a.length;for(s=0;s<r-t;++s)this[s+t]=a[s%c]}return this};var B=/[^+\/0-9A-Za-z-_]/g}).call(t,r(7))},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,c,f;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 u=new Error('Uncaught, unspecified "error" event. ('+t+")");throw u.context=t,u}if(r=this._events[e],o(r))return!1;if(n(r))switch(arguments.length){case 1:r.call(this);break;case 2:r.call(this,arguments[1]);break;case 3:r.call(this,arguments[1],arguments[2]);break;default:a=Array.prototype.slice.call(arguments,1),r.apply(this,a)}else if(i(r))for(a=Array.prototype.slice.call(arguments,1),s=(f=r.slice()).length,c=0;c<s;c++)f[c].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){function r(){this.removeListener(e,r),i||(i=!0,t.apply(this,arguments))}if(!n(t))throw TypeError("listener must be a function");var i=!1;return r.listener=t,this.on(e,r),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(r=this._events[e],s=r.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(r=this._events[e],n(r))this.removeListener(e,r);else if(r)for(;r.length;)this.removeListener(e,r[r.length-1]);return delete this._events[e],this},r.prototype.listeners=function(e){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";var n=t;n.version=r(85).version,n.utils=r(86),n.rand=r(88),n.curve=r(22),n.curves=r(94),n.ec=r(102),n.eddsa=r(106)},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){"use strict";function n(e){return(e>>>24|e>>>8&65280|e<<8&16711680|(255&e)<<24)>>>0}function i(e){return 1===e.length?"0"+e:e}function o(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}var s=r(11),a=r(4);t.inherits=a,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+=i(e[r].toString(16));return t},t.htonl=n,t.toHex32=function(e,t){for(var r="",i=0;i<e.length;i++){var s=e[i];"little"===t&&(s=n(s)),r+=o(s.toString(16))}return r},t.zero2=i,t.zero8=o,t.join32=function(e,t,r,n){var i=r-t;s(i%4==0);for(var o=new Array(i/4),a=0,c=t;a<o.length;a++,c+=4){var f;f="big"===n?e[c]<<24|e[c+1]<<16|e[c+2]<<8|e[c+3]:e[c+3]<<24|e[c+2]<<16|e[c+1]<<8|e[c],o[a]=f>>>0}return o},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 c=0,f=t;return c+=(f=f+n>>>0)<t?1:0,c+=(f=f+o>>>0)<o?1:0,e+r+i+s+(c+=(f=f+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,c,f){var u=0,h=t;return u+=(h=h+n>>>0)<t?1:0,u+=(h=h+o>>>0)<o?1:0,u+=(h=h+a>>>0)<a?1:0,e+r+i+s+c+(u+=(h=h+f>>>0)<f?1:0)>>>0},t.sum64_5_lo=function(e,t,r,n,i,o,s,a,c,f){return t+n+o+a+f>>>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){(function(e,n){function i(e,r){var n={seen:[],stylize:s};return arguments.length>=3&&(n.depth=arguments[2]),arguments.length>=4&&(n.colors=arguments[3]),h(r)?n.showHidden=r:r&&t._extend(n,r),b(n.showHidden)&&(n.showHidden=!1),b(n.depth)&&(n.depth=2),b(n.colors)&&(n.colors=!1),b(n.customInspect)&&(n.customInspect=!0),n.colors&&(n.stylize=o),a(n,e,n.depth)}function o(e,t){var r=i.styles[t];return r?"["+i.colors[r][0]+"m"+e+"["+i.colors[r][1]+"m":e}function s(e,t){return e}function a(e,r,n){if(e.customInspect&&r&&_(r.inspect)&&r.inspect!==t.inspect&&(!r.constructor||r.constructor.prototype!==r)){var i=r.inspect(n,e);return p(i)||(i=a(e,i,n)),i}var o=function(e,t){if(b(t))return e.stylize("undefined","undefined");if(p(t)){var r="'"+JSON.stringify(t).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return e.stylize(r,"string")}if(l(t))return e.stylize(""+t,"number");if(h(t))return e.stylize(""+t,"boolean");if(d(t))return e.stylize("null","null")}(e,r);if(o)return o;var s=Object.keys(r),g=function(e){var t={};return e.forEach(function(e,r){t[e]=!0}),t}(s);if(e.showHidden&&(s=Object.getOwnPropertyNames(r)),v(r)&&(s.indexOf("message")>=0||s.indexOf("description")>=0))return c(r);if(0===s.length){if(_(r)){var w=r.name?": "+r.name:"";return e.stylize("[Function"+w+"]","special")}if(y(r))return e.stylize(RegExp.prototype.toString.call(r),"regexp");if(m(r))return e.stylize(Date.prototype.toString.call(r),"date");if(v(r))return c(r)}var S="",E=!1,x=["{","}"];if(u(r)&&(E=!0,x=["[","]"]),_(r)){S=" [Function"+(r.name?": "+r.name:"")+"]"}if(y(r)&&(S=" "+RegExp.prototype.toString.call(r)),m(r)&&(S=" "+Date.prototype.toUTCString.call(r)),v(r)&&(S=" "+c(r)),0===s.length&&(!E||0==r.length))return x[0]+S+x[1];if(n<0)return y(r)?e.stylize(RegExp.prototype.toString.call(r),"regexp"):e.stylize("[Object]","special");e.seen.push(r);var M;return M=E?function(e,t,r,n,i){for(var o=[],s=0,a=t.length;s<a;++s)k(t,String(s))?o.push(f(e,t,r,n,String(s),!0)):o.push("");return i.forEach(function(i){i.match(/^\d+$/)||o.push(f(e,t,r,n,i,!0))}),o}(e,r,n,g,s):s.map(function(t){return f(e,r,n,g,t,E)}),e.seen.pop(),function(e,t,r){var n=0;if(e.reduce(function(e,t){return n++,t.indexOf("\n")>=0&&n++,e+t.replace(/\u001b\[\d\d?m/g,"").length+1},0)>60)return r[0]+(""===t?"":t+"\n ")+" "+e.join(",\n ")+" "+r[1];return r[0]+t+" "+e.join(", ")+" "+r[1]}(M,S,x)}function c(e){return"["+Error.prototype.toString.call(e)+"]"}function f(e,t,r,n,i,o){var s,c,f;if((f=Object.getOwnPropertyDescriptor(t,i)||{value:t[i]}).get?c=f.set?e.stylize("[Getter/Setter]","special"):e.stylize("[Getter]","special"):f.set&&(c=e.stylize("[Setter]","special")),k(n,i)||(s="["+i+"]"),c||(e.seen.indexOf(f.value)<0?(c=d(r)?a(e,f.value,null):a(e,f.value,r-1)).indexOf("\n")>-1&&(c=o?c.split("\n").map(function(e){return" "+e}).join("\n").substr(2):"\n"+c.split("\n").map(function(e){return" "+e}).join("\n")):c=e.stylize("[Circular]","special")),b(s)){if(o&&i.match(/^\d+$/))return c;(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+": "+c}function u(e){return Array.isArray(e)}function h(e){return"boolean"==typeof e}function d(e){return null===e}function l(e){return"number"==typeof e}function p(e){return"string"==typeof e}function b(e){return void 0===e}function y(e){return g(e)&&"[object RegExp]"===w(e)}function g(e){return"object"==typeof e&&null!==e}function m(e){return g(e)&&"[object Date]"===w(e)}function v(e){return g(e)&&("[object Error]"===w(e)||e instanceof Error)}function _(e){return"function"==typeof e}function w(e){return Object.prototype.toString.call(e)}function S(e){return e<10?"0"+e.toString(10):e.toString(10)}function k(e,t){return Object.prototype.hasOwnProperty.call(e,t)}var E=/%[sdj%]/g;t.format=function(e){if(!p(e)){for(var t=[],r=0;r<arguments.length;r++)t.push(i(arguments[r]));return t.join(" ")}r=1;for(var n=arguments,o=n.length,s=String(e).replace(E,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}}),a=n[r];r<o;a=n[++r])d(a)||!g(a)?s+=" "+a:s+=" "+i(a);return s},t.deprecate=function(r,i){if(b(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 x,M={};t.debuglog=function(e){if(b(x)&&(x=Object({NODE_ENV:void 0}).NODE_DEBUG||""),e=e.toUpperCase(),!M[e])if(new RegExp("\\b"+e+"\\b","i").test(x)){var r=n.pid;M[e]=function(){var n=t.format.apply(t,arguments);console.error("%s %d: %s",e,r,n)}}else M[e]=function(){};return M[e]},t.inspect=i,i.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]},i.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"},t.isArray=u,t.isBoolean=h,t.isNull=d,t.isNullOrUndefined=function(e){return null==e},t.isNumber=l,t.isString=p,t.isSymbol=function(e){return"symbol"==typeof e},t.isUndefined=b,t.isRegExp=y,t.isObject=g,t.isDate=m,t.isError=v,t.isFunction=_,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(120);var A=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];t.log=function(){console.log("%s - %s",function(){var e=new Date,t=[S(e.getHours()),S(e.getMinutes()),S(e.getSeconds())].join(":");return[e.getDate(),A[e.getMonth()],t].join(" ")}(),t.format.apply(t,arguments))},t.inherits=r(121),t._extend=function(e,t){if(!t||!g(t))return e;for(var r=Object.keys(t),n=r.length;n--;)e[r[n]]=t[r[n]];return e}}).call(t,r(7),r(0))},function(e,t){var r;r=function(){return this}();try{r=r||Function("return this")()||(0,eval)("this")}catch(e){"object"==typeof window&&(r=window)}e.exports=r},function(e,t,r){(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"))}function s(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 a(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}function c(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,c=s/67108864|0;r.words[0]=a;for(var f=1;f<n;f++){for(var u=c>>>26,h=67108863&c,d=Math.min(f,t.length-1),l=Math.max(0,f-e.length+1);l<=d;l++){var p=f-l|0;u+=(s=(i=0|e.words[p])*(o=0|t.words[l])+h)/67108864|0,h=67108863&s}r.words[f]=0|h,c=0|u}return 0!==c?r.words[f]=0|c:r.length--,r.strip()}function f(e,t,r){return(new u).mulp(e,t,r)}function u(e,t){this.x=e,this.y=t}function h(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 d(){h.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function l(){h.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function p(){h.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function b(){h.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function y(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 g(e){y.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)}"object"==typeof e?e.exports=o:t.BN=o,o.BN=o,o.wordSize=26;var m;try{m=r(87).Buffer}catch(e){}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=s(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=s(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,c=Math.min(o,o-s)+r,f=0,u=r;u<c;u+=n)f=a(e,u,u+n,t),this.imuln(i),this.words[0]+f<67108864?this.words[0]+=f:this._iaddn(f);if(0!==s){var h=1;for(f=a(e,u,e.length,t),u=0;u<s;u++)h*=t;this.imuln(h),this.words[0]+f<67108864?this.words[0]+=f:this._iaddn(f)}},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 v=["","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"],_=[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],w=[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];o.prototype.toString=function(e,t){e=e||10,t=0|t||1;var r;if(16===e||"hex"===e){r="";for(var i=0,o=0,s=0;s<this.length;s++){var a=this.words[s],c=(16777215&(a<<i|o)).toString(16);r=0!==(o=a>>>24-i&16777215)||s!==this.length-1?v[6-c.length]+c+r:c+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 f=_[e],u=w[e];r="";var h=this.clone();for(h.negative=0;!h.isZero();){var d=h.modn(u).toString(e);r=(h=h.idivn(u)).isZero()?d+r:v[f-d.length]+d+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!==m),this.toArrayLike(m,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,c="le"===t,f=new e(o),u=this.clone();if(c){for(a=0;!u.isZero();a++)s=u.andln(255),u.iushrn(8),f[a]=s;for(;a<o;a++)f[a]=0}else{for(a=0;a<o-i;a++)f[a]=0;for(a=0;!u.isZero();a++)s=u.andln(255),u.iushrn(8),f[o-a-1]=s}return f},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;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();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=(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=this.cmp(e);if(0===r)return this.negative=0,this.length=1,this.words[0]=0,this;var n,i;r>0?(n=this,i=e):(n=e,i=this);for(var o=0,s=0;s<i.length;s++)o=(t=(0|n.words[s])-(0|i.words[s])+o)>>26,this.words[s]=67108863&t;for(;0!==o&&s<n.length;s++)o=(t=(0|n.words[s])+o)>>26,this.words[s]=67108863&t;if(0===o&&s<n.length&&n!==this)for(;s<n.length;s++)this.words[s]=n.words[s];return this.length=Math.max(this.length,s),n!==this&&(this.negative=1),this.strip()},o.prototype.sub=function(e){return this.clone().isub(e)};var S=function(e,t,r){var n,i,o,s=e.words,a=t.words,c=r.words,f=0,u=0|s[0],h=8191&u,d=u>>>13,l=0|s[1],p=8191&l,b=l>>>13,y=0|s[2],g=8191&y,m=y>>>13,v=0|s[3],_=8191&v,w=v>>>13,S=0|s[4],k=8191&S,E=S>>>13,x=0|s[5],M=8191&x,A=x>>>13,O=0|s[6],I=8191&O,N=O>>>13,R=0|s[7],P=8191&R,C=R>>>13,j=0|s[8],T=8191&j,L=j>>>13,B=0|s[9],D=8191&B,q=B>>>13,F=0|a[0],z=8191&F,U=F>>>13,K=0|a[1],G=8191&K,W=K>>>13,H=0|a[2],Y=8191&H,V=H>>>13,J=0|a[3],$=8191&J,X=J>>>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],ce=8191&ae,fe=ae>>>13,ue=0|a[8],he=8191&ue,de=ue>>>13,le=0|a[9],pe=8191&le,be=le>>>13;r.negative=e.negative^t.negative,r.length=19;var ye=(f+(n=Math.imul(h,z))|0)+((8191&(i=(i=Math.imul(h,U))+Math.imul(d,z)|0))<<13)|0;f=((o=Math.imul(d,U))+(i>>>13)|0)+(ye>>>26)|0,ye&=67108863,n=Math.imul(p,z),i=(i=Math.imul(p,U))+Math.imul(b,z)|0,o=Math.imul(b,U);var ge=(f+(n=n+Math.imul(h,G)|0)|0)+((8191&(i=(i=i+Math.imul(h,W)|0)+Math.imul(d,G)|0))<<13)|0;f=((o=o+Math.imul(d,W)|0)+(i>>>13)|0)+(ge>>>26)|0,ge&=67108863,n=Math.imul(g,z),i=(i=Math.imul(g,U))+Math.imul(m,z)|0,o=Math.imul(m,U),n=n+Math.imul(p,G)|0,i=(i=i+Math.imul(p,W)|0)+Math.imul(b,G)|0,o=o+Math.imul(b,W)|0;var me=(f+(n=n+Math.imul(h,Y)|0)|0)+((8191&(i=(i=i+Math.imul(h,V)|0)+Math.imul(d,Y)|0))<<13)|0;f=((o=o+Math.imul(d,V)|0)+(i>>>13)|0)+(me>>>26)|0,me&=67108863,n=Math.imul(_,z),i=(i=Math.imul(_,U))+Math.imul(w,z)|0,o=Math.imul(w,U),n=n+Math.imul(g,G)|0,i=(i=i+Math.imul(g,W)|0)+Math.imul(m,G)|0,o=o+Math.imul(m,W)|0,n=n+Math.imul(p,Y)|0,i=(i=i+Math.imul(p,V)|0)+Math.imul(b,Y)|0,o=o+Math.imul(b,V)|0;var ve=(f+(n=n+Math.imul(h,$)|0)|0)+((8191&(i=(i=i+Math.imul(h,X)|0)+Math.imul(d,$)|0))<<13)|0;f=((o=o+Math.imul(d,X)|0)+(i>>>13)|0)+(ve>>>26)|0,ve&=67108863,n=Math.imul(k,z),i=(i=Math.imul(k,U))+Math.imul(E,z)|0,o=Math.imul(E,U),n=n+Math.imul(_,G)|0,i=(i=i+Math.imul(_,W)|0)+Math.imul(w,G)|0,o=o+Math.imul(w,W)|0,n=n+Math.imul(g,Y)|0,i=(i=i+Math.imul(g,V)|0)+Math.imul(m,Y)|0,o=o+Math.imul(m,V)|0,n=n+Math.imul(p,$)|0,i=(i=i+Math.imul(p,X)|0)+Math.imul(b,$)|0,o=o+Math.imul(b,X)|0;var _e=(f+(n=n+Math.imul(h,Q)|0)|0)+((8191&(i=(i=i+Math.imul(h,ee)|0)+Math.imul(d,Q)|0))<<13)|0;f=((o=o+Math.imul(d,ee)|0)+(i>>>13)|0)+(_e>>>26)|0,_e&=67108863,n=Math.imul(M,z),i=(i=Math.imul(M,U))+Math.imul(A,z)|0,o=Math.imul(A,U),n=n+Math.imul(k,G)|0,i=(i=i+Math.imul(k,W)|0)+Math.imul(E,G)|0,o=o+Math.imul(E,W)|0,n=n+Math.imul(_,Y)|0,i=(i=i+Math.imul(_,V)|0)+Math.imul(w,Y)|0,o=o+Math.imul(w,V)|0,n=n+Math.imul(g,$)|0,i=(i=i+Math.imul(g,X)|0)+Math.imul(m,$)|0,o=o+Math.imul(m,X)|0,n=n+Math.imul(p,Q)|0,i=(i=i+Math.imul(p,ee)|0)+Math.imul(b,Q)|0,o=o+Math.imul(b,ee)|0;var we=(f+(n=n+Math.imul(h,re)|0)|0)+((8191&(i=(i=i+Math.imul(h,ne)|0)+Math.imul(d,re)|0))<<13)|0;f=((o=o+Math.imul(d,ne)|0)+(i>>>13)|0)+(we>>>26)|0,we&=67108863,n=Math.imul(I,z),i=(i=Math.imul(I,U))+Math.imul(N,z)|0,o=Math.imul(N,U),n=n+Math.imul(M,G)|0,i=(i=i+Math.imul(M,W)|0)+Math.imul(A,G)|0,o=o+Math.imul(A,W)|0,n=n+Math.imul(k,Y)|0,i=(i=i+Math.imul(k,V)|0)+Math.imul(E,Y)|0,o=o+Math.imul(E,V)|0,n=n+Math.imul(_,$)|0,i=(i=i+Math.imul(_,X)|0)+Math.imul(w,$)|0,o=o+Math.imul(w,X)|0,n=n+Math.imul(g,Q)|0,i=(i=i+Math.imul(g,ee)|0)+Math.imul(m,Q)|0,o=o+Math.imul(m,ee)|0,n=n+Math.imul(p,re)|0,i=(i=i+Math.imul(p,ne)|0)+Math.imul(b,re)|0,o=o+Math.imul(b,ne)|0;var Se=(f+(n=n+Math.imul(h,oe)|0)|0)+((8191&(i=(i=i+Math.imul(h,se)|0)+Math.imul(d,oe)|0))<<13)|0;f=((o=o+Math.imul(d,se)|0)+(i>>>13)|0)+(Se>>>26)|0,Se&=67108863,n=Math.imul(P,z),i=(i=Math.imul(P,U))+Math.imul(C,z)|0,o=Math.imul(C,U),n=n+Math.imul(I,G)|0,i=(i=i+Math.imul(I,W)|0)+Math.imul(N,G)|0,o=o+Math.imul(N,W)|0,n=n+Math.imul(M,Y)|0,i=(i=i+Math.imul(M,V)|0)+Math.imul(A,Y)|0,o=o+Math.imul(A,V)|0,n=n+Math.imul(k,$)|0,i=(i=i+Math.imul(k,X)|0)+Math.imul(E,$)|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(g,re)|0,i=(i=i+Math.imul(g,ne)|0)+Math.imul(m,re)|0,o=o+Math.imul(m,ne)|0,n=n+Math.imul(p,oe)|0,i=(i=i+Math.imul(p,se)|0)+Math.imul(b,oe)|0,o=o+Math.imul(b,se)|0;var ke=(f+(n=n+Math.imul(h,ce)|0)|0)+((8191&(i=(i=i+Math.imul(h,fe)|0)+Math.imul(d,ce)|0))<<13)|0;f=((o=o+Math.imul(d,fe)|0)+(i>>>13)|0)+(ke>>>26)|0,ke&=67108863,n=Math.imul(T,z),i=(i=Math.imul(T,U))+Math.imul(L,z)|0,o=Math.imul(L,U),n=n+Math.imul(P,G)|0,i=(i=i+Math.imul(P,W)|0)+Math.imul(C,G)|0,o=o+Math.imul(C,W)|0,n=n+Math.imul(I,Y)|0,i=(i=i+Math.imul(I,V)|0)+Math.imul(N,Y)|0,o=o+Math.imul(N,V)|0,n=n+Math.imul(M,$)|0,i=(i=i+Math.imul(M,X)|0)+Math.imul(A,$)|0,o=o+Math.imul(A,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(g,oe)|0,i=(i=i+Math.imul(g,se)|0)+Math.imul(m,oe)|0,o=o+Math.imul(m,se)|0,n=n+Math.imul(p,ce)|0,i=(i=i+Math.imul(p,fe)|0)+Math.imul(b,ce)|0,o=o+Math.imul(b,fe)|0;var Ee=(f+(n=n+Math.imul(h,he)|0)|0)+((8191&(i=(i=i+Math.imul(h,de)|0)+Math.imul(d,he)|0))<<13)|0;f=((o=o+Math.imul(d,de)|0)+(i>>>13)|0)+(Ee>>>26)|0,Ee&=67108863,n=Math.imul(D,z),i=(i=Math.imul(D,U))+Math.imul(q,z)|0,o=Math.imul(q,U),n=n+Math.imul(T,G)|0,i=(i=i+Math.imul(T,W)|0)+Math.imul(L,G)|0,o=o+Math.imul(L,W)|0,n=n+Math.imul(P,Y)|0,i=(i=i+Math.imul(P,V)|0)+Math.imul(C,Y)|0,o=o+Math.imul(C,V)|0,n=n+Math.imul(I,$)|0,i=(i=i+Math.imul(I,X)|0)+Math.imul(N,$)|0,o=o+Math.imul(N,X)|0,n=n+Math.imul(M,Q)|0,i=(i=i+Math.imul(M,ee)|0)+Math.imul(A,Q)|0,o=o+Math.imul(A,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(g,ce)|0,i=(i=i+Math.imul(g,fe)|0)+Math.imul(m,ce)|0,o=o+Math.imul(m,fe)|0,n=n+Math.imul(p,he)|0,i=(i=i+Math.imul(p,de)|0)+Math.imul(b,he)|0,o=o+Math.imul(b,de)|0;var xe=(f+(n=n+Math.imul(h,pe)|0)|0)+((8191&(i=(i=i+Math.imul(h,be)|0)+Math.imul(d,pe)|0))<<13)|0;f=((o=o+Math.imul(d,be)|0)+(i>>>13)|0)+(xe>>>26)|0,xe&=67108863,n=Math.imul(D,G),i=(i=Math.imul(D,W))+Math.imul(q,G)|0,o=Math.imul(q,W),n=n+Math.imul(T,Y)|0,i=(i=i+Math.imul(T,V)|0)+Math.imul(L,Y)|0,o=o+Math.imul(L,V)|0,n=n+Math.imul(P,$)|0,i=(i=i+Math.imul(P,X)|0)+Math.imul(C,$)|0,o=o+Math.imul(C,X)|0,n=n+Math.imul(I,Q)|0,i=(i=i+Math.imul(I,ee)|0)+Math.imul(N,Q)|0,o=o+Math.imul(N,ee)|0,n=n+Math.imul(M,re)|0,i=(i=i+Math.imul(M,ne)|0)+Math.imul(A,re)|0,o=o+Math.imul(A,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(_,ce)|0,i=(i=i+Math.imul(_,fe)|0)+Math.imul(w,ce)|0,o=o+Math.imul(w,fe)|0,n=n+Math.imul(g,he)|0,i=(i=i+Math.imul(g,de)|0)+Math.imul(m,he)|0,o=o+Math.imul(m,de)|0;var Me=(f+(n=n+Math.imul(p,pe)|0)|0)+((8191&(i=(i=i+Math.imul(p,be)|0)+Math.imul(b,pe)|0))<<13)|0;f=((o=o+Math.imul(b,be)|0)+(i>>>13)|0)+(Me>>>26)|0,Me&=67108863,n=Math.imul(D,Y),i=(i=Math.imul(D,V))+Math.imul(q,Y)|0,o=Math.imul(q,V),n=n+Math.imul(T,$)|0,i=(i=i+Math.imul(T,X)|0)+Math.imul(L,$)|0,o=o+Math.imul(L,X)|0,n=n+Math.imul(P,Q)|0,i=(i=i+Math.imul(P,ee)|0)+Math.imul(C,Q)|0,o=o+Math.imul(C,ee)|0,n=n+Math.imul(I,re)|0,i=(i=i+Math.imul(I,ne)|0)+Math.imul(N,re)|0,o=o+Math.imul(N,ne)|0,n=n+Math.imul(M,oe)|0,i=(i=i+Math.imul(M,se)|0)+Math.imul(A,oe)|0,o=o+Math.imul(A,se)|0,n=n+Math.imul(k,ce)|0,i=(i=i+Math.imul(k,fe)|0)+Math.imul(E,ce)|0,o=o+Math.imul(E,fe)|0,n=n+Math.imul(_,he)|0,i=(i=i+Math.imul(_,de)|0)+Math.imul(w,he)|0,o=o+Math.imul(w,de)|0;var Ae=(f+(n=n+Math.imul(g,pe)|0)|0)+((8191&(i=(i=i+Math.imul(g,be)|0)+Math.imul(m,pe)|0))<<13)|0;f=((o=o+Math.imul(m,be)|0)+(i>>>13)|0)+(Ae>>>26)|0,Ae&=67108863,n=Math.imul(D,$),i=(i=Math.imul(D,X))+Math.imul(q,$)|0,o=Math.imul(q,X),n=n+Math.imul(T,Q)|0,i=(i=i+Math.imul(T,ee)|0)+Math.imul(L,Q)|0,o=o+Math.imul(L,ee)|0,n=n+Math.imul(P,re)|0,i=(i=i+Math.imul(P,ne)|0)+Math.imul(C,re)|0,o=o+Math.imul(C,ne)|0,n=n+Math.imul(I,oe)|0,i=(i=i+Math.imul(I,se)|0)+Math.imul(N,oe)|0,o=o+Math.imul(N,se)|0,n=n+Math.imul(M,ce)|0,i=(i=i+Math.imul(M,fe)|0)+Math.imul(A,ce)|0,o=o+Math.imul(A,fe)|0,n=n+Math.imul(k,he)|0,i=(i=i+Math.imul(k,de)|0)+Math.imul(E,he)|0,o=o+Math.imul(E,de)|0;var Oe=(f+(n=n+Math.imul(_,pe)|0)|0)+((8191&(i=(i=i+Math.imul(_,be)|0)+Math.imul(w,pe)|0))<<13)|0;f=((o=o+Math.imul(w,be)|0)+(i>>>13)|0)+(Oe>>>26)|0,Oe&=67108863,n=Math.imul(D,Q),i=(i=Math.imul(D,ee))+Math.imul(q,Q)|0,o=Math.imul(q,ee),n=n+Math.imul(T,re)|0,i=(i=i+Math.imul(T,ne)|0)+Math.imul(L,re)|0,o=o+Math.imul(L,ne)|0,n=n+Math.imul(P,oe)|0,i=(i=i+Math.imul(P,se)|0)+Math.imul(C,oe)|0,o=o+Math.imul(C,se)|0,n=n+Math.imul(I,ce)|0,i=(i=i+Math.imul(I,fe)|0)+Math.imul(N,ce)|0,o=o+Math.imul(N,fe)|0,n=n+Math.imul(M,he)|0,i=(i=i+Math.imul(M,de)|0)+Math.imul(A,he)|0,o=o+Math.imul(A,de)|0;var Ie=(f+(n=n+Math.imul(k,pe)|0)|0)+((8191&(i=(i=i+Math.imul(k,be)|0)+Math.imul(E,pe)|0))<<13)|0;f=((o=o+Math.imul(E,be)|0)+(i>>>13)|0)+(Ie>>>26)|0,Ie&=67108863,n=Math.imul(D,re),i=(i=Math.imul(D,ne))+Math.imul(q,re)|0,o=Math.imul(q,ne),n=n+Math.imul(T,oe)|0,i=(i=i+Math.imul(T,se)|0)+Math.imul(L,oe)|0,o=o+Math.imul(L,se)|0,n=n+Math.imul(P,ce)|0,i=(i=i+Math.imul(P,fe)|0)+Math.imul(C,ce)|0,o=o+Math.imul(C,fe)|0,n=n+Math.imul(I,he)|0,i=(i=i+Math.imul(I,de)|0)+Math.imul(N,he)|0,o=o+Math.imul(N,de)|0;var Ne=(f+(n=n+Math.imul(M,pe)|0)|0)+((8191&(i=(i=i+Math.imul(M,be)|0)+Math.imul(A,pe)|0))<<13)|0;f=((o=o+Math.imul(A,be)|0)+(i>>>13)|0)+(Ne>>>26)|0,Ne&=67108863,n=Math.imul(D,oe),i=(i=Math.imul(D,se))+Math.imul(q,oe)|0,o=Math.imul(q,se),n=n+Math.imul(T,ce)|0,i=(i=i+Math.imul(T,fe)|0)+Math.imul(L,ce)|0,o=o+Math.imul(L,fe)|0,n=n+Math.imul(P,he)|0,i=(i=i+Math.imul(P,de)|0)+Math.imul(C,he)|0,o=o+Math.imul(C,de)|0;var Re=(f+(n=n+Math.imul(I,pe)|0)|0)+((8191&(i=(i=i+Math.imul(I,be)|0)+Math.imul(N,pe)|0))<<13)|0;f=((o=o+Math.imul(N,be)|0)+(i>>>13)|0)+(Re>>>26)|0,Re&=67108863,n=Math.imul(D,ce),i=(i=Math.imul(D,fe))+Math.imul(q,ce)|0,o=Math.imul(q,fe),n=n+Math.imul(T,he)|0,i=(i=i+Math.imul(T,de)|0)+Math.imul(L,he)|0,o=o+Math.imul(L,de)|0;var Pe=(f+(n=n+Math.imul(P,pe)|0)|0)+((8191&(i=(i=i+Math.imul(P,be)|0)+Math.imul(C,pe)|0))<<13)|0;f=((o=o+Math.imul(C,be)|0)+(i>>>13)|0)+(Pe>>>26)|0,Pe&=67108863,n=Math.imul(D,he),i=(i=Math.imul(D,de))+Math.imul(q,he)|0,o=Math.imul(q,de);var Ce=(f+(n=n+Math.imul(T,pe)|0)|0)+((8191&(i=(i=i+Math.imul(T,be)|0)+Math.imul(L,pe)|0))<<13)|0;f=((o=o+Math.imul(L,be)|0)+(i>>>13)|0)+(Ce>>>26)|0,Ce&=67108863;var je=(f+(n=Math.imul(D,pe))|0)+((8191&(i=(i=Math.imul(D,be))+Math.imul(q,pe)|0))<<13)|0;return f=((o=Math.imul(q,be))+(i>>>13)|0)+(je>>>26)|0,je&=67108863,c[0]=ye,c[1]=ge,c[2]=me,c[3]=ve,c[4]=_e,c[5]=we,c[6]=Se,c[7]=ke,c[8]=Ee,c[9]=xe,c[10]=Me,c[11]=Ae,c[12]=Oe,c[13]=Ie,c[14]=Ne,c[15]=Re,c[16]=Pe,c[17]=Ce,c[18]=je,0!==f&&(c[19]=f,r.length++),r};Math.imul||(S=c),o.prototype.mulTo=function(e,t){var r=this.length+e.length;return 10===this.length&&10===e.length?S(this,e,t):r<63?c(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,c=Math.min(o,t.length-1),f=Math.max(0,o-e.length+1);f<=c;f++){var u=o-f,h=(0|e.words[u])*(0|t.words[f]),d=67108863&h;a=67108863&(d=d+a|0),i+=(s=(s=s+(h/67108864|0)|0)+(d>>>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):f(this,e,t)},u.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},u.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},u.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]]},u.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,c=Math.cos(2*Math.PI/a),f=Math.sin(2*Math.PI/a),u=0;u<i;u+=a)for(var h=c,d=f,l=0;l<s;l++){var p=r[u+l],b=n[u+l],y=r[u+l+s],g=n[u+l+s],m=h*y-d*g;g=h*g+d*y,y=m,r[u+l]=p+y,n[u+l]=b+g,r[u+l+s]=p-y,n[u+l+s]=b-g,l!==a&&(m=c*h-f*d,d=c*d+f*h,h=m)}},u.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},u.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}},u.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},u.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))},u.prototype.stub=function(e){for(var t=new Array(e),r=0;r<e;r++)t[r]=0;return t},u.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),c=new Array(n),f=new Array(n),u=new Array(n),h=new Array(n),d=r.words;d.length=n,this.convert13b(e.words,e.length,s,n),this.convert13b(t.words,t.length,f,n),this.transform(s,o,a,c,n,i),this.transform(f,o,u,h,n,i);for(var l=0;l<n;l++){var p=a[l]*u[l]-c[l]*h[l];c[l]=a[l]*h[l]+c[l]*u[l],a[l]=p}return this.conjugate(a,c,n),this.transform(a,c,d,o,n,i),this.conjugate(d,o,n),this.normalize13b(d,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),f(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,c=(0|this.words[t])-a<<r;this.words[t]=c|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){n("number"==typeof e&&e>=0);var i;i=t?(t-t%26)/26:0;var o=e%26,s=Math.min((e-o)/26,this.length),a=67108863^67108863>>>o<<o,c=r;if(i-=s,i=Math.max(0,i),c){for(var f=0;f<s;f++)c.words[f]=this.words[f];c.length=s}if(0===s);else if(this.length>s)for(this.length-=s,f=0;f<this.length;f++)this.words[f]=this.words[f+s];else this.words[0]=0,this.length=1;var u=0;for(f=this.length-1;f>=0&&(0!==u||f>=i);f--){var h=0|this.words[f];this.words[f]=u<<26-o|h>>>o,u=h&a}return c&&0!==u&&(c.words[c.length++]=u),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;if(this.length<=r)return!1;return!!(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=e.length+r;this._expand(o);var s,a=0;for(i=0;i<e.length;i++){s=(0|this.words[i+r])+a;var c=(0|e.words[i])*t;a=((s-=67108863&c)>>26)-(c/67108864|0),this.words[i+r]=67108863&s}for(;i<this.length-r;i++)a=(s=(0|this.words[i+r])+a)>>26,this.words[i+r]=67108863&s;if(0===a)return this.strip();for(n(-1===a),a=0,i=0;i<this.length;i++)a=(s=-(0|this.words[i])+a)>>26,this.words[i]=67108863&s;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,c=n.length-i.length;if("mod"!==t){(a=new o(null)).length=c+1,a.words=new Array(a.length);for(var f=0;f<a.length;f++)a.words[f]=0}var u=n.clone()._ishlnsubmul(i,1,c);0===u.negative&&(n=u,a&&(a.words[c]=1));for(var h=c-1;h>=0;h--){var d=67108864*(0|n.words[i.length+h])+(0|n.words[i.length+h-1]);for(d=Math.min(d/s|0,67108863),n._ishlnsubmul(i,d,h);0!==n.negative;)d--,n.negative=0,n._ishlnsubmul(i,1,h),n.isZero()||(n.negative^=1);a&&(a.words[h]=d)}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){if(n(!e.isZero()),this.isZero())return{div:new o(0),mod:new o(0)};var i,s,a;return 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)},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),c=new o(1),f=0;t.isEven()&&r.isEven();)t.iushrn(1),r.iushrn(1),++f;for(var u=r.clone(),h=t.clone();!t.isZero();){for(var d=0,l=1;0==(t.words[0]&l)&&d<26;++d,l<<=1);if(d>0)for(t.iushrn(d);d-- >0;)(i.isOdd()||s.isOdd())&&(i.iadd(u),s.isub(h)),i.iushrn(1),s.iushrn(1);for(var p=0,b=1;0==(r.words[0]&b)&&p<26;++p,b<<=1);if(p>0)for(r.iushrn(p);p-- >0;)(a.isOdd()||c.isOdd())&&(a.iadd(u),c.isub(h)),a.iushrn(1),c.iushrn(1);t.cmp(r)>=0?(t.isub(r),i.isub(a),s.isub(c)):(r.isub(t),a.isub(i),c.isub(s))}return{a:a,b:c,gcd:r.iushln(f)}},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=new o(1),s=new o(0),a=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;)i.isOdd()&&i.iadd(a),i.iushrn(1);for(var u=0,h=1;0==(r.words[0]&h)&&u<26;++u,h<<=1);if(u>0)for(r.iushrn(u);u-- >0;)s.isOdd()&&s.iadd(a),s.iushrn(1);t.cmp(r)>=0?(t.isub(r),i.isub(s)):(r.isub(t),s.isub(i))}var d;return(d=0===t.cmpn(1)?i:s).cmpn(0)<0&&d.iadd(e),d},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=e<0;if(0!==this.negative&&!t)return-1;if(0===this.negative&&t)return 1;this.strip();var r;if(this.length>1)r=1;else{t&&(e=-e),n(e<=67108863,"Number is too big");var i=0|this.words[0];r=i===e?0:i<e?-1:1}return 0!==this.negative?0|-r:r},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 y(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 k={k256:null,p224:null,p192:null,p25519:null};h.prototype._tmp=function(){var e=new o(null);return e.words=new Array(Math.ceil(this.n/13)),e},h.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},h.prototype.split=function(e,t){e.iushrn(this.n,0,t)},h.prototype.imulK=function(e){return e.imul(this.k)},i(d,h),d.prototype.split=function(e,t){for(var r=Math.min(e.length,9),n=0;n<r;n++)t.words[n]=e.words[n];if(t.length=r,e.length<=9)return e.words[0]=0,void(e.length=1);var i=e.words[9];for(t.words[t.length++]=4194303&i,n=10;n<e.length;n++){var o=0|e.words[n];e.words[n-10]=(4194303&o)<<4|i>>>22,i=o}i>>>=22,e.words[n-10]=i,0===i&&e.length>10?e.length-=10:e.length-=9},d.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(l,h),i(p,h),i(b,h),b.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(k[e])return k[e];var t;if("k256"===e)t=new d;else if("p224"===e)t=new l;else if("p192"===e)t=new p;else{if("p25519"!==e)throw new Error("Unknown prime "+e);t=new b}return k[e]=t,t},y.prototype._verify1=function(e){n(0===e.negative,"red works only with positives"),n(e.red,"red works only with red numbers")},y.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")},y.prototype.imod=function(e){return this.prime?this.prime.ireduce(e)._forceRed(this):e.umod(this.m)._forceRed(this)},y.prototype.neg=function(e){return e.isZero()?e.clone():this.m.sub(e)._forceRed(this)},y.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)},y.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},y.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)},y.prototype.isub=function(e,t){this._verify2(e,t);var r=e.isub(t);return r.cmpn(0)<0&&r.iadd(this.m),r},y.prototype.shl=function(e,t){return this._verify1(e),this.imod(e.ushln(t))},y.prototype.imul=function(e,t){return this._verify2(e,t),this.imod(e.imul(t))},y.prototype.mul=function(e,t){return this._verify2(e,t),this.imod(e.mul(t))},y.prototype.isqr=function(e){return this.imul(e,e.clone())},y.prototype.sqr=function(e){return this.mul(e,e)},y.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),c=a.redNeg(),f=this.m.subn(1).iushrn(1),u=this.m.bitLength();for(u=new o(2*u*u).toRed(this);0!==this.pow(u,f).cmp(c);)u.redIAdd(c);for(var h=this.pow(u,i),d=this.pow(e,i.addn(1).iushrn(1)),l=this.pow(e,i),p=s;0!==l.cmp(a);){for(var b=l,y=0;0!==b.cmp(a);y++)b=b.redSqr();n(y<p);var g=this.pow(h,new o(1).iushln(p-y-1));d=d.redMul(g),h=g.redSqr(),l=l.redMul(h),p=y}return d},y.prototype.invm=function(e){var t=e._invmp(this.m);return 0!==t.negative?(t.negative=0,this.imod(t).redNeg()):this.imod(t)},y.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,c=t.bitLength()%26;for(0===c&&(c=26),n=t.length-1;n>=0;n--){for(var f=t.words[n],u=c-1;u>=0;u--){var h=f>>u&1;i!==r[0]&&(i=this.sqr(i)),0!==h||0!==s?(s<<=1,s|=h,(4===++a||0===n&&0===u)&&(i=this.mul(i,r[s]),a=0,s=0)):a=0}c=26}return i},y.prototype.convertTo=function(e){var t=e.umod(this.m);return t===e?t.clone():t},y.prototype.convertFrom=function(e){var t=e.clone();return t.red=null,t},o.mont=function(e){return new g(e)},i(g,y),g.prototype.convertTo=function(e){return this.imod(e.ushln(this.shift))},g.prototype.convertFrom=function(e){var t=this.imod(e.mul(this.rinv));return t.red=null,t},g.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)},g.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)},g.prototype.invm=function(e){return this.imod(e._invmp(this.m).mul(this.r2))._forceRed(this)}}(void 0===e||e,this)}).call(t,r(46)(e))},function(e,t,r){function n(e,t){for(var r in e)t[r]=e[r]}function i(e,t,r){return s(e,t,r)}var o=r(1),s=o.Buffer;s.from&&s.alloc&&s.allocUnsafe&&s.allocUnsafeSlow?e.exports=o:(n(o,t),t.Buffer=i),n(s,i),i.from=function(e,t,r){if("number"==typeof e)throw new TypeError("Argument must not be a number");return s(e,t,r)},i.alloc=function(e,t,r){if("number"!=typeof e)throw new TypeError("Argument must be a number");var n=s(e);return void 0!==t?"string"==typeof r?n.fill(t,r):n.fill(t):n.fill(0),n},i.allocUnsafe=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return s(e)},i.allocUnsafeSlow=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return o.SlowBuffer(e)}},function(e,t,r){"use strict";function n(e){if(!(this instanceof n))return new n(e);f.call(this,e),u.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",i)}function i(){this.allowHalfOpen||this._writableState.ended||s(o,this)}function o(e){e.end()}var s=r(21),a=Object.keys||function(e){var t=[];for(var r in e)t.push(r);return t};e.exports=n;var c=r(15);c.inherits=r(4);var f=r(36),u=r(23);c.inherits(n,f);for(var h=a(u.prototype),d=0;d<h.length;d++){var l=h[d];n.prototype[l]||(n.prototype[l]=u.prototype[l])}Object.defineProperty(n.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)}}),n.prototype._destroy=function(e,t){this.push(null),this.end(),s(t,e)}},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){(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}function n(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}var i=/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/,o=function(e){return i.exec(e).slice(1)};t.resolve=function(){for(var t="",i=!1,o=arguments.length-1;o>=-1&&!i;o--){var s=o>=0?arguments[o]:e.cwd();if("string"!=typeof s)throw new TypeError("Arguments to path.resolve must be strings");s&&(t=s+"/"+t,i="/"===s.charAt(0))}return t=r(n(t.split("/"),function(e){return!!e}),!i).join("/"),(i?"/":"")+t||"."},t.normalize=function(e){var i=t.isAbsolute(e),o="/"===s(e,-1);return(e=r(n(e.split("/"),function(e){return!!e}),!i).join("/"))||i||(e="."),e&&o&&(e+="/"),(i?"/":"")+e},t.isAbsolute=function(e){return"/"===e.charAt(0)},t.join=function(){var e=Array.prototype.slice.call(arguments,0);return t.normalize(n(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,c=0;c<s;c++)if(i[c]!==o[c]){a=c;break}var f=[];for(c=a;c<i.length;c++)f.push("..");return(f=f.concat(o.slice(a))).join("/")},t.sep="/",t.delimiter=":",t.dirname=function(e){var t=o(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=o(e)[2];return t&&r.substr(-1*t.length)===t&&(r=r.substr(0,r.length-t.length)),r},t.extname=function(e){return o(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(0))},function(e,t,r){(t=e.exports=r(36)).Stream=t,t.Readable=t,t.Writable=r(23),t.Duplex=r(10),t.Transform=r(41),t.PassThrough=r(76)},function(e,t){e.exports={}},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(t,r(1).Buffer)},function(e,t,r){"use strict";function n(){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}var i=r(5),o=r(11);t.BlockHash=n,n.prototype.update=function(e,t){if(e=i.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=i.join32(e,0,e.length-r,this.endian);for(var n=0;n<e.length;n+=this._delta32)this._update(e,n,n+this._delta32)}return this},n.prototype.digest=function(e){return this.update(this._pad()),o(null===this.pending),this._digest(e)},n.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){"use strict";e.exports=function(e,t){function r(o){if(n=o,i)return r.abort();!function r(){for(var o=!0,s=!1;o;)if(s=!1,n(null,function(a,c){if(s=!0,a=a||i){if(o=!1,t)t(!0===a?null:a);else if(a&&!0!==a)throw a}else e&&!1===e(c)||i?(o=!1,n(i||!0,t||function(){})):o||r()}),!s)return void(o=!1)}()}var n,i;return r.abort=function(e,t){if("function"==typeof e&&(t=e,e=!0),i=e||!0,n)return n(i,t||function(){})},r}},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){t.AbstractLevelDOWN=r(64),t.AbstractIterator=r(65),t.AbstractChainedBatch=r(66),t.isLevelDOWN=r(177)},function(e,t,r){"use strict";(function(t){const n=r(12),i=r(2).EventEmitter,o=r(13),s=r(77),a=r(42),c=r(45),f=r(126),u=r(127),h=r(128),d={Index:f,maxHistory:-1,path:"./orbitdb",replicate:!0};e.exports=class{constructor(e,t,r,o){let s=Object.assign({},d);Object.assign(s,o),this.options=s,this._type="store",this.id=t,this.address=r,this.dbname=r.path||"",this.events=new i,this._ipfs=e,this._cache=o.cache,this._index=new this.options.Index(this.id),this._keystore=o&&o.keystore?o.keystore:new c(n.join(this.options.path,this.id,"/keystore")),this._key=o&&o.key?o.key:this._keystore.getKey(t)||this._keystore.createKey(t),this._ipfs.keystore=this._keystore;const f={admin:[this._key.getPublic("hex")],read:[],write:[this._key.getPublic("hex")]};this.access=o.accessController||f,this._oplog=new a(this._ipfs,this.id,null,null,null,this._key,this.access.write),this._replicationInfo={progress:0,max:0,have:{}},this._stats={snapshot:{bytesLoaded:-1},syncRequestsReceieved:0};try{this._loader=new u(this),this._loader.on("load.added",e=>{this._replicationInfo.max=Math.max.apply(null,[this._replicationInfo.max,this._oplog.length,e.clock?e.clock.time:0]),this.events.emit("replicate",this.address.toString())}),this._loader.on("load.start",(e,t)=>{this._replicationInfo.max=Math.max.apply(null,[this._replicationInfo.max,this._oplog.length,e.clock?e.clock.time:0])}),this._loader.on("load.progress",(e,t,r,n,i)=>{this._replicationInfo.progress=Math.max.apply(null,[this._replicationInfo.progress,this._oplog.length]),this.events.emit("replicate.progress",this.address.toString(),t,r,this._replicationInfo.progress,this._replicationInfo.have)}),this._loader.on("load.end",async(e,t)=>{try{await this._oplog.join(e,-1,this._oplog.id),this._replicator.replicate(this._oplog),this._index.updateIndex(this._oplog),this._calculateReplicationInfo(t),this.events.emit("replicated",this.address.toString())}catch(e){console.error(e)}}),this._replicator=new h(this._loader),this._replicator.replicate(this._oplog),this.options.replicate&&this._replicator.start()}catch(e){console.error("Store Error:",e)}}_calculateReplicationInfo(e){this._replicationInfo.progress=Math.min(this._oplog.length,Math.max(this._replicationInfo.progress,this._oplog.length)),this._replicationInfo.max=Math.max(this._replicationInfo.max,this._oplog.length),e&&(this._replicationInfo.have=Object.assign(this._replicationInfo.have,e))}get all(){return Array.isArray(this._index._index)?this._index._index:Object.keys(this._index._index).map(e=>this._index._index[e])}get type(){return this._type}get key(){return this._key}async close(){return this._loader.stop(),this._replicator.stop(),this._replicationInfo={progress:0,max:0,have:{}},this._stats={snapshot:{bytesLoaded:-1},syncRequestsReceieved:0},this.events.removeAllListeners("load"),this.events.removeAllListeners("load.progress"),this.events.removeAllListeners("replicate"),this.events.removeAllListeners("replicate.progress"),this.events.removeAllListeners("replicated"),this.events.removeAllListeners("ready"),this.events.removeAllListeners("write"),await this._cache.close(),this.events.emit("closed",this.address.toString()),Promise.resolve()}async drop(){await this._cache.del(this.address.toString()+"/_manifest",null),await this._cache.del(this.address.toString(),null),await this._cache.del("_localHeads",null),await this._cache.del("_remoteHeads",null),await this._cache.del("snapshot",null),await this._cache.del("queue",null),await this.close(),this._index=new this.options.Index(this.id),this._oplog=new a(this._ipfs,this.id,null,null,null,this._key,this.access.write),this._cache=this.options&&this.options.cache?this.options.cache:new Cache(this.options.path,this.dbname)}async load(e){this._replicator.stop(),e=e||this.options.maxHistory;const t=await this._cache.get("_localHeads")||[],r=await this._cache.get("_remoteHeads")||[],n=t.concat(r);n.length>0&&this.events.emit("load",this.address.toString(),n),await s(n,async t=>{this._replicationInfo.max=Math.max(this._replicationInfo.max,t.clock.time);let r=await a.fromEntryHash(this._ipfs,t.hash,this._oplog.id,e,this._oplog.values,this.key,this.access.write,this._onLoadProgress.bind(this));await this._oplog.join(r,e,this._oplog.id),this._replicationInfo.progress=Math.max.apply(null,[this._replicationInfo.progress,this._oplog.length])}),n.length>0&&this._index.updateIndex(this._oplog),this.options.replicate&&(this._replicator.replicate(this._oplog),this._replicator.start()),this.events.emit("ready",this.address.toString(),this._oplog.heads)}sync(e,r,n,i=!0,o=-1,a=0){return this._stats.syncRequestsReceieved+=1,s(e,e=>{if(!e)return console.warn("Warning: Given input entry was 'null'."),Promise.resolve(null);if(!this.access.write.includes(e.key)&&!this.access.write.includes("*"))return console.warn("Warning: Given input entry is not allowed in this log and was discarded (no write access)."),Promise.resolve(null);const r=Object.assign({},e);return r.hash=null,this._ipfs.object.put(t.from(JSON.stringify(r))).then(e=>e.toJSON().multihash).then(t=>(t!==e.hash&&console.warn("\"WARNING! Head hash didn't match the contents"),t)).then(()=>e)}).then(async t=>(await this._cache.set("_remoteHeads",e),this._loader.load(t.filter(e=>null!==e))))}loadMoreFrom(e,t){this._loader.load(t)}async saveSnapshot(){const e=Object.keys(this._loader._fetching).map(e=>this._loader._fetching[e]).concat(this._loader._queue.map(e=>e));let r=this._oplog.toSnapshot(),n=new t(JSON.stringify({id:r.id,heads:r.heads,size:r.values.length,type:this.type}));const i=new o;let s=new Uint16Array([n.length]),a=new t(s.buffer);i.push(a),i.push(n),r.values.forEach(e=>{let r=new t(JSON.stringify(e)),n=new Uint16Array([r.length]);i.push(new t(n.buffer)),i.push(r)}),i.push(null);const c={path:this.address.toString(),content:i},f=await this._ipfs.files.add(c);return await this._cache.set("snapshot",f[f.length-1]),await this._cache.set("queue",e),f}async loadFromSnapshot(e){this.events.emit("load",this.address.toString());const r=await this._cache.get("queue");this.sync(r||[]);const n=await this._cache.get("snapshot");if(!n)throw new Error(`Snapshot for ${this.address} not found!`);{const e=await this._ipfs.files.catReadableStream(n.hash),r=await(()=>new Promise((r,n)=>{let i=new t(0),o=[];e.on("data",e=>{if(this._byteSize+=e.length,o.length<2e3)o.push(e);else{const e=t.concat(o);i=t.concat([i,e]),o=[]}}),e.on("end",()=>{function e(e){for(var t=new ArrayBuffer(e.length),r=new Uint8Array(t),n=0;n<e.length;++n)r[n]=e[n];return t}if(o.length>0){const e=t.concat(o);i=t.concat([i,e])}const n=parseInt(new Uint16Array(e(i.slice(0,2)))),s=JSON.parse(i.slice(2,n+2));let a=[],c=2+n;for(;c<i.length;){const t=parseInt(new Uint16Array(e(i.slice(c,c+2))));c+=2;const r=i.slice(c,c+t);try{const e=JSON.parse(r);a.push(e)}catch(e){}c+=t}this._type=s.type,this._replicationInfo.max=Math.max(this._replicationInfo.max,a.reduce((e,t)=>Math.max(e,t.clock.time),0)),r({values:a,id:s.id,heads:s.heads,type:s.type})})}))(),i=await a.fromJSON(this._ipfs,r,-1,this._key,this.access.write,1e3,(e,t,r,n)=>{this._replicationInfo.max=Math.max(this._replicationInfo.max,t.clock.time),this._replicationInfo.progress=Math.max.apply(null,[this._replicationInfo.progress,r,this._oplog.length]),this._onLoadProgress(e,t,this._replicationInfo.progress,this._replicationInfo.max)});await this._oplog.join(i,-1,this._oplog.id),this._oplog.values.forEach(e=>this._replicationInfo.have[e.clock.time]=!0),this._replicationInfo.max=Math.max(this._replicationInfo.max,this._oplog.length),this._replicationInfo.progress=Math.max(this._replicationInfo.progress,this._oplog.length),this._replicator.replicate(this._oplog),this._index.updateIndex(this._oplog),this.events.emit("ready",this.address.toString(),this._oplog.heads),this.events.emit("replicated",this.address.toString())}return this}async _addOperation(e,t,r,n){if(this._oplog){const t=await this._oplog.append(e);return this._replicationInfo.max=Math.max(this._replicationInfo.max,t.clock.time),this._replicationInfo.progress++,this.address.toString(),await this._cache.set("_localHeads",[t]),this._index.updateIndex(this._oplog),this.events.emit("write",this.address.toString(),t,this._oplog.heads),n&&n(t),t.hash}}_addOperationBatch(e,t,r,n){throw new Error("Not implemented!")}_onLoadProgress(e,t,r,n){this.events.emit("load.progress",this.address.toString(),e,t,Math.max(this._oplog.length,r),Math.max(this._oplog.length||0,this._replicationInfo.max||0))}}}).call(t,r(1).Buffer)},function(e,t,r){"use strict";(function(t){function r(e,r,n,i){if("function"!=typeof e)throw new TypeError('"callback" argument must be a function');var o,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)})}}!t.version||0===t.version.indexOf("v0.")||0===t.version.indexOf("v1.")&&0!==t.version.indexOf("v1.8.")?e.exports=r:e.exports=t.nextTick}).call(t,r(0))},function(e,t,r){"use strict";var n=t;n.base=r(90),n.short=r(91),n.mont=r(92),n.edwards=r(93)},function(e,t,r){"use strict";(function(t,n,i){function o(e){var t=this;this.next=null,this.entry=null,this.finish=function(){!function(e,t,r){var n=e.entry;e.entry=null;for(;n;){var i=n.callback;t.pendingcb--,i(r),n=n.next}t.corkedRequestsFree?t.corkedRequestsFree.next=e:t.corkedRequestsFree=e}(t,e)}}function s(){}function a(e,t){g=g||r(10),e=e||{},this.objectMode=!!e.objectMode,t instanceof g&&(this.objectMode=this.objectMode||!!e.writableObjectMode);var n=e.highWaterMark,i=this.objectMode?16:16384;this.highWaterMark=n||0===n?n:i,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 s=!1===e.decodeStrings;this.decodeStrings=!s,this.defaultEncoding=e.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(e){!function(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)!function(e,t,r,n,i){--t.pendingcb,r?(y(i,n),y(b,e,t),e._writableState.errorEmitted=!0,e.emit("error",n)):(i(n),e._writableState.errorEmitted=!0,e.emit("error",n),b(e,t))}(e,r,n,t,i);else{var o=l(r);o||r.corked||r.bufferProcessing||!r.bufferedRequest||d(e,r),n?m(h,e,r,o,i):h(e,r,o,i)}}(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 c(e){if(g=g||r(10),!(x.call(c,this)||this instanceof g))return new c(e);this._writableState=new a(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)),w.call(this)}function f(e,t,r,n,i,o){if(!r){var s=function(e,t,r){return e.objectMode||!1===e.decodeStrings||"string"!=typeof t||(t=S.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 c=t.length<t.highWaterMark;if(c||(t.needDrain=!0),t.writing||t.corked){var f=t.lastBufferedRequest;t.lastBufferedRequest={chunk:n,encoding:i,isBuf:r,callback:o,next:null},f?f.next=t.lastBufferedRequest:t.bufferedRequest=t.lastBufferedRequest,t.bufferedRequestCount+=1}else u(e,t,!1,a,n,i,o);return c}function u(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 h(e,t,r,n){r||function(e,t){0===t.length&&t.needDrain&&(t.needDrain=!1,e.emit("drain"))}(e,t),t.pendingcb--,n(),b(e,t)}function d(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,c=!0;r;)i[a]=r,r.isBuf||(c=!1),r=r.next,a+=1;i.allBuffers=c,u(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)}else{for(;r;){var f=r.chunk,h=r.encoding,d=r.callback;if(u(e,t,!1,t.objectMode?1:f.length,f,h,d),r=r.next,t.writing)break}null===r&&(t.lastBufferedRequest=null)}t.bufferedRequestCount=0,t.bufferedRequest=r,t.bufferProcessing=!1}function l(e){return e.ending&&0===e.length&&null===e.bufferedRequest&&!e.finished&&!e.writing}function p(e,t){e._final(function(r){t.pendingcb--,r&&e.emit("error",r),t.prefinished=!0,e.emit("prefinish"),b(e,t)})}function b(e,t){var r=l(t);return r&&(!function(e,t){t.prefinished||t.finalCalled||("function"==typeof e._final?(t.pendingcb++,t.finalCalled=!0,y(p,e,t)):(t.prefinished=!0,e.emit("prefinish")))}(e,t),0===t.pendingcb&&(t.finished=!0,e.emit("finish"))),r}var y=r(21);e.exports=c;var g,m=!t.browser&&["v0.10","v0.9."].indexOf(t.version.slice(0,5))>-1?n:y;c.WritableState=a;var v=r(15);v.inherits=r(4);var _={deprecate:r(75)},w=r(37),S=r(9).Buffer,k=i.Uint8Array||function(){},E=r(38);v.inherits(c,w),a.prototype.getBuffer=function(){for(var e=this.bufferedRequest,t=[];e;)t.push(e),e=e.next;return t},function(){try{Object.defineProperty(a.prototype,"buffer",{get:_.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch(e){}}();var x;"function"==typeof Symbol&&Symbol.hasInstance&&"function"==typeof Function.prototype[Symbol.hasInstance]?(x=Function.prototype[Symbol.hasInstance],Object.defineProperty(c,Symbol.hasInstance,{value:function(e){return!!x.call(this,e)||e&&e._writableState instanceof a}})):x=function(e){return e instanceof this},c.prototype.pipe=function(){this.emit("error",new Error("Cannot pipe, not readable"))},c.prototype.write=function(e,t,r){var n=this._writableState,i=!1,o=function(e){return S.isBuffer(e)||e instanceof k}(e)&&!n.objectMode;return o&&!S.isBuffer(e)&&(e=function(e){return S.from(e)}(e)),"function"==typeof t&&(r=t,t=null),o?t="buffer":t||(t=n.defaultEncoding),"function"!=typeof r&&(r=s),n.ended?function(e,t){var r=new Error("write after end");e.emit("error",r),y(t,r)}(this,r):(o||function(e,t,r,n){var i=!0,o=!1;return null===r?o=new TypeError("May not write null values to stream"):"string"==typeof r||void 0===r||t.objectMode||(o=new TypeError("Invalid non-string/buffer chunk")),o&&(e.emit("error",o),y(n,o),i=!1),i}(this,n,e,r))&&(n.pendingcb++,i=f(this,n,o,e,t,r)),i},c.prototype.cork=function(){this._writableState.corked++},c.prototype.uncork=function(){var e=this._writableState;e.corked&&(e.corked--,e.writing||e.corked||e.finished||e.bufferProcessing||!e.bufferedRequest||d(this,e))},c.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},c.prototype._write=function(e,t,r){r(new Error("_write() is not implemented"))},c.prototype._writev=null,c.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,b(e,t),r&&(t.finished?y(r):e.once("finish",r)),t.ended=!0,e.writable=!1}(this,n,r)},Object.defineProperty(c.prototype,"destroyed",{get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(e){this._writableState&&(this._writableState.destroyed=e)}}),c.prototype.destroy=E.destroy,c.prototype._undestroy=E.undestroy,c.prototype._destroy=function(e,t){this.end(),t(e)}}).call(t,r(0),r(39).setImmediate,r(7))},function(e,t,r){"use strict";e.exports=((e,t,r)=>new Promise((n,i)=>{if(r=Object.assign({concurrency:1/0},r),"function"!=typeof t)throw new TypeError("Mapper function is required");const o=r.concurrency;if(!("number"==typeof o&&o>=1))throw new TypeError(`Expected \`concurrency\` to be a number from 1 and up, got \`${o}\` (${typeof o})`);const s=[],a=e[Symbol.iterator]();let c=!1,f=!1,u=0,h=0;const d=()=>{if(c)return;const e=a.next(),r=h;if(h++,e.done)return f=!0,void(0===u&&n(s));u++,Promise.resolve(e.value).then(e=>t(e,r)).then(e=>{s[r]=e,u--,d()},e=>{c=!0,i(e)})};for(let e=0;e<o&&(d(),!f);e++);}))},function(e,t,r){"use strict";(function(t){const n=r(26),i=r(27),o=()=>new Error("Ipfs instance not defined");class s{static async create(e,t,r,a=[],c,f){if(!i(e))throw o();if(!i(t))throw new Error("Entry requires an id");if(!i(r))throw new Error("Entry requires data");if(!i(a)||!Array.isArray(a))throw new Error("'next' argument is not an array");let u={hash:null,id:t,payload:r,next:a.filter(i).map(e=>e.hash?e.hash:e),v:0,clock:new n(t,c?c.time:null)};return e.keystore&&f&&(u=await s.signEntry(e.keystore,u,f)),u.hash=await s.toMultihash(e,u),u}static async signEntry(e,r,n){const i=await e.sign(n,new t(JSON.stringify(r)));return r.sig=i,r.key=n.getPublic("hex"),r}static async verifyEntry(e,r){const n=Object.assign({},{hash:null,id:e.id,payload:e.payload,next:e.next,v:e.v,clock:e.clock}),i=await r.importPublicKey(e.key);await r.verify(e.sig,i,new t(JSON.stringify(n)))}static toMultihash(e,r){if(!e)throw o();const n=t.from(JSON.stringify(r));return e.object.put(n).then(e=>e.toJSON().multihash)}static fromMultihash(e,t){if(!e)throw o();if(!t)throw new Error(`Invalid hash: ${t}`);return e.object.get(t,{enc:"base58"}).then(e=>JSON.parse(e.toJSON().data)).then(e=>{let r={hash:t,id:e.id,payload:e.payload,next:e.next,v:e.v,clock:e.clock};return e.sig&&Object.assign(r,{sig:e.sig}),e.key&&Object.assign(r,{key:e.key}),r})}static isEntry(e){return void 0!==e.id&&void 0!==e.next&&void 0!==e.hash&&void 0!==e.payload&&void 0!==e.v&&void 0!==e.clock}static compare(e,t){var r=n.compare(e.clock,t.clock);return 0===r?e.clock.id<t.clock.id?-1:1:r}static isEqual(e,t){return e.hash===t.hash}static isParent(e,t){return t.next.indexOf(e.hash)>-1}static findChildren(e,t){for(var r=[],n=t.find(t=>s.isParent(e,t)),i=e;n;)r.push(n),i=n,n=t.find(e=>s.isParent(i,e));return r=r.sort((e,t)=>e.clock.time>e.clock.time)}}e.exports=s}).call(t,r(1).Buffer)},function(e,t,r){"use strict";class n{constructor(e,t){this.id=e,this.time=t||0}tick(){return new n(this.id,++this.time)}merge(e){return this.time=Math.max(this.time,e.time),new n(this.id,this.time)}clone(){return new n(this.id,this.time)}static compare(e,t){var r=e.time-t.time;return 0===r&&e.id!==t.id?e.id<t.id?-1:1:r}}e.exports=n},function(e,t,r){"use strict";e.exports=(e=>void 0!==e&&null!==e)},function(e,t,r){var n=t;n.utils=r(5),n.common=r(16),n.sha=r(95),n.ripemd=r(99),n.hmac=r(100),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";var n=r(58);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(17);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";var n=r(60);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(){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,r){var n=r(181).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){"use strict";const n=r(20),i=r(129);e.exports=class extends n{constructor(e,t,r,n={}){void 0===n.Index&&Object.assign(n,{Index:i}),super(e,t,r,n),this._type="eventlog"}add(e){return this._addOperation({op:"ADD",key:null,value:e})}get(e){return this.iterator({gte:e,limit:1}).collect()[0]}iterator(e){const t=this._query(e);let r=0;return{[Symbol.iterator](){return this},next(){let e={value:null,done:!0};return r<t.length&&(e={value:t[r],done:!1},r++),e},collect:()=>t}}_query(e){e||(e={});const t=e.limit?e.limit>-1?e.limit:this._index.get().length:1,r=this._index.get().slice();let n=[];return n=e.gt||e.gte?this._read(r,e.gt?e.gt:e.gte,t,!!e.gte):this._read(r.reverse(),e.lt?e.lt:e.lte,t,e.lte||!e.lt).reverse()}_read(e,t,r,n){const i=e.map(e=>e.hash).indexOf(t);let o=Math.max(i,0);return o+=n?0:1,e.slice(o).slice(0,r)}}},function(e,t){var r={}.toString;e.exports=Array.isArray||function(e){return"[object Array]"==r.call(e)}},function(e,t,r){"use strict";(function(t,n){function i(e,t){w=w||r(10),e=e||{},this.objectMode=!!e.objectMode,t instanceof w&&(this.objectMode=this.objectMode||!!e.readableObjectMode);var n=e.highWaterMark,i=this.objectMode?16:16384;this.highWaterMark=n||0===n?n:i,this.highWaterMark=Math.floor(this.highWaterMark),this.buffer=new R,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&&(N||(N=r(40).StringDecoder),this.decoder=new N(e.encoding),this.encoding=e.encoding)}function o(e){if(w=w||r(10),!(this instanceof o))return new o(e);this._readableState=new i(e,this),this.readable=!0,e&&("function"==typeof e.read&&(this._read=e.read),"function"==typeof e.destroy&&(this._destroy=e.destroy)),E.call(this)}function s(e,t,r,n,i){var o=e._readableState;if(null===t)o.reading=!1,function(e,t){if(t.ended)return;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,f(e)}(e,o);else{var s;i||(s=function(e,t){var r;(function(e){return x.isBuffer(e)||e instanceof M})(t)||"string"==typeof t||void 0===t||e.objectMode||(r=new TypeError("Invalid non-string/buffer chunk"));return r}(o,t)),s?e.emit("error",s):o.objectMode||t&&t.length>0?("string"==typeof t||o.objectMode||Object.getPrototypeOf(t)===x.prototype||(t=function(e){return x.from(e)}(t)),n?o.endEmitted?e.emit("error",new Error("stream.unshift() after end event")):a(e,o,t,!0):o.ended?e.emit("error",new Error("stream.push() after EOF")):(o.reading=!1,o.decoder&&!r?(t=o.decoder.write(t),o.objectMode||0!==t.length?a(e,o,t,!1):h(e,o)):a(e,o,t,!1))):n||(o.reading=!1)}return function(e){return!e.ended&&(e.needReadable||e.length<e.highWaterMark||0===e.length)}(o)}function a(e,t,r,n){t.flowing&&0===t.length&&!t.sync?(e.emit("data",r),e.read(0)):(t.length+=t.objectMode?1:r.length,n?t.buffer.unshift(r):t.buffer.push(r),t.needReadable&&f(e)),h(e,t)}function c(e,t){return e<=0||0===t.length&&t.ended?0:t.objectMode?1:e!=e?t.flowing&&t.length?t.buffer.head.data.length:t.length:(e>t.highWaterMark&&(t.highWaterMark=function(e){return e>=j?e=j:(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 f(e){var t=e._readableState;t.needReadable=!1,t.emittedReadable||(I("emitReadable",t.flowing),t.emittedReadable=!0,t.sync?_(u,e):u(e))}function u(e){I("emit readable"),e.emit("readable"),b(e)}function h(e,t){t.readingMore||(t.readingMore=!0,_(d,e,t))}function d(e,t){for(var r=t.length;!t.reading&&!t.flowing&&!t.ended&&t.length<t.highWaterMark&&(I("maybeReadMore read 0"),e.read(0),r!==t.length);)r=t.length;t.readingMore=!1}function l(e){I("readable nexttick read 0"),e.read(0)}function p(e,t){t.reading||(I("resume read 0"),e.read(0)),t.resumeScheduled=!1,t.awaitDrain=0,e.emit("resume"),b(e),t.flowing&&!t.reading&&e.read(0)}function b(e){var t=e._readableState;for(I("flow",t.flowing);t.flowing&&null!==e.read(););}function y(e,t){if(0===t.length)return null;var r;return 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;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;e-=i.length;for(;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=x.allocUnsafe(e),n=t.head,i=1;n.data.copy(r),e-=n.data.length;for(;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);return n}(e,t.buffer,t.decoder),r}function g(e){var t=e._readableState;if(t.length>0)throw new Error('"endReadable()" called on non-empty stream');t.endEmitted||(t.ended=!0,_(m,t,e))}function m(e,t){e.endEmitted||0!==e.length||(e.endEmitted=!0,t.readable=!1,t.emit("end"))}function v(e,t){for(var r=0,n=e.length;r<n;r++)if(e[r]===t)return r;return-1}var _=r(21);e.exports=o;var w,S=r(35);o.ReadableState=i;r(2).EventEmitter;var k=function(e,t){return e.listeners(t).length},E=r(37),x=r(9).Buffer,M=t.Uint8Array||function(){},A=r(15);A.inherits=r(4);var O=r(72),I=void 0;I=O&&O.debuglog?O.debuglog("stream"):function(){};var N,R=r(73),P=r(38);A.inherits(o,E);var C=["error","close","destroy","pause","resume"];Object.defineProperty(o.prototype,"destroyed",{get:function(){return void 0!==this._readableState&&this._readableState.destroyed},set:function(e){this._readableState&&(this._readableState.destroyed=e)}}),o.prototype.destroy=P.destroy,o.prototype._undestroy=P.undestroy,o.prototype._destroy=function(e,t){this.push(null),t(e)},o.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=x.from(e,t),t=""),r=!0),s(this,e,t,!1,r)},o.prototype.unshift=function(e){return s(this,e,null,!0,!1)},o.prototype.isPaused=function(){return!1===this._readableState.flowing},o.prototype.setEncoding=function(e){return N||(N=r(40).StringDecoder),this._readableState.decoder=new N(e),this._readableState.encoding=e,this};var j=8388608;o.prototype.read=function(e){I("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 I("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?g(this):f(this),null;if(0===(e=c(e,t))&&t.ended)return 0===t.length&&g(this),null;var n=t.needReadable;I("need readable",n),(0===t.length||t.length-e<t.highWaterMark)&&I("length less than watermark",n=!0),t.ended||t.reading?I("reading or ended",n=!1):n&&(I("do read"),t.reading=!0,t.sync=!0,0===t.length&&(t.needReadable=!0),this._read(t.highWaterMark),t.sync=!1,t.reading||(e=c(r,t)));var i;return null===(i=e>0?y(e,t):null)?(t.needReadable=!0,e=0):t.length-=e,0===t.length&&(t.ended||(t.needReadable=!0),r!==e&&t.ended&&g(this)),null!==i&&this.emit("data",i),i},o.prototype._read=function(e){this.emit("error",new Error("_read() is not implemented"))},o.prototype.pipe=function(e,t){function r(t,n){I("onunpipe"),t===u&&n&&!1===n.hasUnpiped&&(n.hasUnpiped=!0,I("cleanup"),e.removeListener("close",a),e.removeListener("finish",c),e.removeListener("drain",l),e.removeListener("error",s),e.removeListener("unpipe",r),u.removeListener("end",i),u.removeListener("end",f),u.removeListener("data",o),p=!0,!h.awaitDrain||e._writableState&&!e._writableState.needDrain||l())}function i(){I("onend"),e.end()}function o(t){I("ondata"),y=!1;!1!==e.write(t)||y||((1===h.pipesCount&&h.pipes===e||h.pipesCount>1&&-1!==v(h.pipes,e))&&!p&&(I("false write response, pause",u._readableState.awaitDrain),u._readableState.awaitDrain++,y=!0),u.pause())}function s(t){I("onerror",t),f(),e.removeListener("error",s),0===k(e,"error")&&e.emit("error",t)}function a(){e.removeListener("finish",c),f()}function c(){I("onfinish"),e.removeListener("close",a),f()}function f(){I("unpipe"),u.unpipe(e)}var u=this,h=this._readableState;switch(h.pipesCount){case 0:h.pipes=e;break;case 1:h.pipes=[h.pipes,e];break;default:h.pipes.push(e)}h.pipesCount+=1,I("pipe count=%d opts=%j",h.pipesCount,t);var d=(!t||!1!==t.end)&&e!==n.stdout&&e!==n.stderr?i:f;h.endEmitted?_(d):u.once("end",d),e.on("unpipe",r);var l=function(e){return function(){var t=e._readableState;I("pipeOnDrain",t.awaitDrain),t.awaitDrain&&t.awaitDrain--,0===t.awaitDrain&&k(e,"data")&&(t.flowing=!0,b(e))}}(u);e.on("drain",l);var p=!1,y=!1;return u.on("data",o),function(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)}(e,"error",s),e.once("close",a),e.once("finish",c),e.emit("pipe",u),h.flowing||(I("pipe resume"),u.resume()),e},o.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=v(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)},o.prototype.on=function(e,t){var r=E.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&&f(this):_(l,this))}return r},o.prototype.addListener=o.prototype.on,o.prototype.resume=function(){var e=this._readableState;return e.flowing||(I("resume"),e.flowing=!0,function(e,t){t.resumeScheduled||(t.resumeScheduled=!0,_(p,e,t))}(this,e)),this},o.prototype.pause=function(){return I("call pause flowing=%j",this._readableState.flowing),!1!==this._readableState.flowing&&(I("pause"),this._readableState.flowing=!1,this.emit("pause")),this},o.prototype.wrap=function(e){var t=this._readableState,r=!1,n=this;e.on("end",function(){if(I("wrapped end"),t.decoder&&!t.ended){var e=t.decoder.end();e&&e.length&&n.push(e)}n.push(null)}),e.on("data",function(i){if(I("wrapped data"),t.decoder&&(i=t.decoder.write(i)),(!t.objectMode||null!==i&&void 0!==i)&&(t.objectMode||i&&i.length)){n.push(i)||(r=!0,e.pause())}});for(var i in 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<C.length;o++)e.on(C[o],n.emit.bind(n,C[o]));return n._read=function(t){I("wrapped _read",t),r&&(r=!1,e.resume())},n},o._fromList=y}).call(t,r(7),r(0))},function(e,t,r){e.exports=r(2).EventEmitter},function(e,t,r){"use strict";function n(e,t){e.emit("error",t)}var i=r(21);e.exports={destroy:function(e,t){var r=this,o=this._readableState&&this._readableState.destroyed,s=this._writableState&&this._writableState.destroyed;o||s?t?t(e):!e||this._writableState&&this._writableState.errorEmitted||i(n,this,e):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(e||null,function(e){!t&&e?(i(n,r,e),r._writableState&&(r._writableState.errorEmitted=!0)):t&&t(e)}))},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){function n(e,t){this._id=e,this._clearFn=t}var i=Function.prototype.apply;t.setTimeout=function(){return new n(i.call(setTimeout,window,arguments),clearTimeout)},t.setInterval=function(){return new n(i.call(setInterval,window,arguments),clearInterval)},t.clearTimeout=t.clearInterval=function(e){e&&e.close()},n.prototype.unref=n.prototype.ref=function(){},n.prototype.close=function(){this._clearFn.call(window,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(74),t.setImmediate=setImmediate,t.clearImmediate=clearImmediate},function(e,t,r){"use strict";function n(e){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&&(d.isEncoding===l||!l(e)))throw new Error("Unknown encoding: "+e);return t||e}(e);var t;switch(this.encoding){case"utf16le":this.text=s,this.end=a,t=4;break;case"utf8":this.fillLast=o,t=4;break;case"base64":this.text=c,this.end=f,t=3;break;default:return this.write=u,void(this.end=h)}this.lastNeed=0,this.lastTotal=0,this.lastChar=d.allocUnsafe(t)}function i(e){return e<=127?0:e>>5==6?2:e>>4==14?3:e>>3==30?4:-1}function o(e){var t=this.lastTotal-this.lastNeed,r=function(e,t,r){if(128!=(192&t[0]))return e.lastNeed=0,"<22>".repeat(r);if(e.lastNeed>1&&t.length>1){if(128!=(192&t[1]))return e.lastNeed=1,"<22>".repeat(r+1);if(e.lastNeed>2&&t.length>2&&128!=(192&t[2]))return e.lastNeed=2,"<22>".repeat(r+2)}}(this,e,t);return void 0!==r?r:this.lastNeed<=e.length?(e.copy(this.lastChar,t,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal)):(e.copy(this.lastChar,t,0,e.length),void(this.lastNeed-=e.length))}function s(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 a(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 c(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 f(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+this.lastChar.toString("base64",0,3-this.lastNeed):t}function u(e){return e.toString(this.encoding)}function h(e){return e&&e.length?this.write(e):""}var d=r(9).Buffer,l=d.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}};t.StringDecoder=n,n.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||""},n.prototype.end=function(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+"<22>".repeat(this.lastTotal-this.lastNeed):t},n.prototype.text=function(e,t){var r=function(e,t,r){var n=t.length-1;if(n<r)return 0;var o=i(t[n]);return o>=0?(o>0&&(e.lastNeed=o-1),o):--n<r?0:(o=i(t[n]))>=0?(o>0&&(e.lastNeed=o-2),o):--n<r?0:(o=i(t[n]))>=0?(o>0&&(2===o?o=0:e.lastNeed=o-3),o):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)},n.prototype.fillLast=function(e){if(this.lastNeed<=e.length)return e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,e.length),this.lastNeed-=e.length}},function(e,t,r){"use strict";function n(e){this.afterTransform=function(t,r){return function(e,t,r){var n=e._transformState;n.transforming=!1;var i=n.writecb;if(!i)return e.emit("error",new Error("write callback called multiple times"));n.writechunk=null,n.writecb=null,null!==r&&void 0!==r&&e.push(r);i(t);var o=e._readableState;o.reading=!1,(o.needReadable||o.length<o.highWaterMark)&&e._read(o.highWaterMark)}(e,t,r)},this.needTransform=!1,this.transforming=!1,this.writecb=null,this.writechunk=null,this.writeencoding=null}function i(e){if(!(this instanceof i))return new i(e);s.call(this,e),this._transformState=new n(this);var t=this;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.once("prefinish",function(){"function"==typeof this._flush?this._flush(function(e,r){o(t,e,r)}):o(t)})}function o(e,t,r){if(t)return e.emit("error",t);null!==r&&void 0!==r&&e.push(r);var n=e._writableState,i=e._transformState;if(n.length)throw new Error("Calling transform done when ws.length != 0");if(i.transforming)throw new Error("Calling transform done when still transforming");return e.push(null)}e.exports=i;var s=r(10),a=r(15);a.inherits=r(4),a.inherits(i,s),i.prototype.push=function(e,t){return this._transformState.needTransform=!1,s.prototype.push.call(this,e,t)},i.prototype._transform=function(e,t,r){throw new Error("_transform() is not implemented")},i.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)}},i.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},i.prototype._destroy=function(e,t){var r=this;s.prototype._destroy.call(this,e,function(e){t(e),r.emit("close")})}},function(e,t,r){"use strict";(function(t){const n=r(24),i=r(79),o=r(25),s=r(80),a=r(43),c=r(26),f=r(27),u=r(44),h=()=>(new Date).getTime().toString();class d extends i{constructor(e,t,r,n,i,o,s=[]){if(!f(e))throw a.ImmutableDBNotDefinedError();if(f(r)&&!Array.isArray(r))throw new Error("'entries' argument must be an array of Entry instances");if(f(n)&&!Array.isArray(n))throw new Error("'heads' argument must be an array");super(),this._storage=e,this._id=t||h(),this._keystore=this._storage.keystore,this._key=o,this._keys=Array.isArray(s)?s:[s],r=r||[],this._entryIndex=r.reduce((e,t)=>(e[t.hash]=t,e),{}),n=n||d.findHeads(r),this._headsIndex=n.reduce((e,t)=>(e[t.hash]=t,e),{}),this._length=r?r.length:0;const u=Math.max(i?i.time:0,this.heads.reduce((e,t)=>Math.max(e,t.clock.time),0));this._clock=new c(this.id,u)}get id(){return this._id}get clock(){return this._clock}get length(){return this._length}get values(){return Object.values(this._entryIndex).sort(o.compare)||[]}get heads(){return Object.values(this._headsIndex)||[]}get tails(){return d.findTails(this.values)}get tailHashes(){return d.findTailHashes(this.values)}get(e){return this._entryIndex[e]}has(e){return void 0!==this._entryIndex[e.hash||e]}async append(e){if(this._key&&!this._keys.includes(this._key.getPublic("hex"))&&!this._keys.includes("*"))throw new Error("Not allowed to write");const t=Math.max(this.clock.time,this.heads.reduce((e,t)=>Math.max(e,t.clock.time),0))+1;this._clock=new c(this.clock.id,t);const r=await o.create(this._storage,this.id,e,Object.values(this._headsIndex),this.clock,this._key);return this._entryIndex[r.hash]=r,this._headsIndex={},this._headsIndex[r.hash]=r,this._length++,r}async join(e,t=-1,r){if(!f(e))throw a.LogNotDefinedError();if(!d.isLog(e))throw a.NotALogError();const i=async e=>{this._keys.map(e=>e.getPublic?e.getPublic("hex"):e);return(await n(e,async e=>{if(!e.key)throw new Error("Entry doesn't have a public key");if(!e.sig)throw new Error("Entry doesn't have a signature");if(1===this._keys.length&&this._keys[0]===this._key&&e.id!==this.id)throw new Error("Entry doesn't belong in this log (wrong ID)");if(this._keys.length>0&&!this._keys.includes("*")&&!((e,t)=>e.find(e=>e===t.key))(this._keys.concat([this._key]),e))return console.warn("Warning: Input log contains entries that are not allowed in this log. Logs weren't joined."),!1;try{await o.verifyEntry(e,this._keystore)}catch(t){return console.log(t),console.log("Couldn't verify entry:\n",e),!1}return!0})).every(e=>!0===e)},s=(e,t)=>(e[t.hash]=t,e);r=r||[e,this].sort((e,t)=>e.id>t.id)[0].id;const u=((e,t)=>{let r=Object.keys(e._headsIndex),n={},i={};for(;r.length>0;){const o=r.shift(),s=e.get(o);s&&!t.get(o)&&(i[s.hash]=s,n[s.hash]=!0,s.next.forEach(e=>{n[e]||t.get(e)||(r.push(e),n[e]=!0)}))}return i})(e,this);if(this._key){if(!await i(Object.values(u)))return this}if(this._entryIndex=Object.assign(this._entryIndex,u),this._length+=Object.values(u).length,t>-1){let e=this.values;e=e.slice(-t),this._entryIndex=e.reduce(s,{}),this._length=Object.values(this._entryIndex).length}const h=d.findHeads(Object.values(Object.assign({},this._headsIndex,e._headsIndex)));this._headsIndex=h.reduce(s,{});const l=Object.values(this._headsIndex).reduce((e,t)=>e=Math.max(e,t.clock.time),0),p=new c(this.id,Math.max(this.clock.time,l));return this._id=r,this._clock=p,this}toJSON(){return{id:this.id,heads:this.heads.map(e=>e.hash)}}toSnapshot(){return{id:this.id,heads:this.heads,values:this.values}}toBuffer(){return t.from(JSON.stringify(this.toJSON()))}toString(e){return this.values.slice().reverse().map((t,r)=>{const n=o.findChildren(t,this.values).length;let i=new Array(Math.max(n-1,0));return i=n>1?i.fill(" "):i,(i=n>0?i.concat(["└─"]):i).join("")+(e?e(t.payload):t.payload)}).join("\n")}static isLog(e){return void 0!==e.id&&void 0!==e.heads&&void 0!==e._entryIndex}toMultihash(){return s.toMultihash(this._storage,this)}static fromMultihash(e,t,r=-1,n,i,o){if(!f(e))throw a.ImmutableDBNotDefinedError();if(!f(t))throw new Error(`Invalid hash: ${t}`);return s.fromMultihash(e,t,r,n,o).then(t=>new d(e,t.id,t.values,t.heads,t.clock,i))}static fromEntryHash(e,t,r,n=-1,i,o,c,u){if(!f(e))throw a.ImmutableDBNotDefinedError();if(!f(t))throw new Error("'hash' must be defined");return s.fromEntryHash(e,t,r,n,i,u).then(t=>new d(e,r,t.values,null,null,o,c))}static fromJSON(e,t,r=-1,n,i,o,c){if(!f(e))throw a.ImmutableDBNotDefinedError();return s.fromJSON(e,t,r,n,o,c).then(t=>new d(e,t.id,t.values,null,null,n,i))}static fromEntry(e,t,r=-1,n,i){if(!f(e))throw a.ImmutableDBNotDefinedError();if(!f(t))throw new Error("'sourceEntries' must be defined");return s.fromEntry(e,t,r,n,i).then(t=>new d(e,t.id,t.values))}static expandFrom(e,t,r,n=-1){if(!f(e))throw a.ImmutableDBNotDefinedError();if(!f(t))throw a.LogNotDefinedError();if(!f(r))throw new Error("'entries' must be given as argument");if(!d.isLog(t))throw a.NotALogError();return s.expandFrom(e,t,r,n).then(r=>new d(e,t.id,r.values,null,t.clock))}static expand(e,t,r){if(!f(e))throw a.ImmutableDBNotDefinedError();if(!f(t))throw a.LogNotDefinedError();if(!d.isLog(t))throw a.NotALogError();return s.expand(e,t,r).then(r=>new d(e,t.id,r.values,t.heads,t.clock))}static findHeads(e){var t=e.reduce((e,t,r,n)=>{return t.next.forEach(r=>e[r]=t.hash),e},{});return e.filter(e=>void 0===t[e.hash]).sort((e,t)=>e.id>t.id)}static findTails(e){var t={},r=[],n={},i=[];e.forEach(e=>{0===e.next.length&&r.push(e);e.next.forEach(r=>{t[r]||(t[r]=[]),t[r].push(e)}),i=i.concat(e.next),n[e.hash]=!0});const s=i.filter(e=>void 0===n[e]).map(e=>t[e]).reduce((e,t,r,n)=>e.concat(u(t,"hash")),[]).concat(r);return u(s,"hash").sort(o.compare)}static findTailHashes(e){var t={};return e.forEach(e=>t[e.hash]=!0),e.reduce((e,r,n,i)=>{return r.next.reverse().forEach(r=>{void 0===t[r]&&e.splice(0,0,r)}),e},[])}}e.exports=d}).call(t,r(1).Buffer)},function(e,t,r){"use strict";e.exports={ImmutableDBNotDefinedError:()=>new Error("ImmutableDB instance not defined"),LogNotDefinedError:()=>new Error("Log instance not defined"),NotALogError:()=>new Error("Given argument is not an instance of Log")}},function(e,t,r){"use strict";e.exports=function(e,t){let r={};return e.forEach(e=>r[t?e[t]:e]=e),Object.keys(r).map(e=>r[e])}},function(e,t,r){"use strict";(function(t){const n=r(14),i=new(0,r(3).ec)("secp256k1");e.exports=class{constructor(e="./keystore"){if("undefined"==typeof localStorage||null===localStorage){n.sync(e);const t=r(109).LocalStorage;this._storage=new t(e)}else this._storage=localStorage}createKey(e){const t=i.genKeyPair(),r=t.getPublic("hex"),n=t.getPrivate("hex");return this._storage.setItem(e,JSON.stringify({publicKey:r,privateKey:n})),t}getKey(e){let t=JSON.parse(this._storage.getItem(e));if(t)return i.keyPair({pub:t.publicKey,priv:t.privateKey,privEnc:"hex",pubEnc:"hex"})}static importKeyFromIpfs(e,t){return e.object.get(t,{enc:"base58"}).then(e=>JSON.parse(e.toJSON().Data)).then(e=>OrbitCrypto.importPublicKey(e))}static exportPublicKeyToIpfs(e,r){return r.getPublic("hex"),OrbitCrypto.exportPublicKey(r).then(e=>JSON.stringify(e,null,2)).then(e=>new t(e)).then(t=>e.object.put(t)).then(e=>e.toJSON().multihash)}static getKey(e){let t,r,n,o=JSON.parse(keystore.getItem(e));return o?OrbitCrypto.importPrivateKey(o.privateKey).then(e=>n=e).then(()=>OrbitCrypto.importPublicKey(o.publicKey)).then(e=>r=e).then(()=>i.keyPair({pub:r,priv:n})):OrbitCrypto.generateKey().then(e=>t=e).then(()=>OrbitCrypto.exportPrivateKey(t)).then(e=>n=e).then(()=>OrbitCrypto.exportPublicKey(t)).then(e=>r=e).then(()=>(keystore.setItem(e,JSON.stringify({publicKey:r,privateKey:n})),i.keyPair({pub:r,priv:n})))}generateKey(){return Promise.resolve(i.genKeyPair())}exportPublicKey(e){return Promise.resolve(e.getPublic("hex"))}exportPrivateKey(e){return Promise.resolve(e.getPrivate("hex"))}importPublicKey(e){return Promise.resolve(i.keyFromPublic(e,"hex"))}importPrivateKey(e){return Promise.resolve(i.keyFromPrivate(e,"hex"))}sign(e,t){const r=i.sign(t,e);return Promise.resolve(r.toDER("hex"))}verify(e,t,r){let n=!1;return n=i.verify(r,e,t),Promise.resolve(n)}}}).call(t,r(1).Buffer)},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";function n(e){return 1===e.length?"0"+e:e}function i(e){for(var t="",r=0;r<e.length;r++)t+=n(e[r].toString(16));return t}var o=t;o.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},o.zero2=n,o.toHex=i,o.encode=function(e,t){return"hex"===t?i(e):e}},function(e,t,r){"use strict";function n(e,t,r){return e&t^~e&r}function i(e,t,r){return e&t^e&r^t&r}function o(e,t,r){return e^t^r}var s=r(5).rotr32;t.ft_1=function(e,t,r,s){return 0===e?n(t,r,s):1===e||3===e?o(t,r,s):2===e?i(t,r,s):void 0},t.ch32=n,t.maj32=i,t.p32=o,t.s0_256=function(e){return s(e,2)^s(e,13)^s(e,22)},t.s1_256=function(e){return s(e,6)^s(e,11)^s(e,25)},t.g0_256=function(e){return s(e,7)^s(e,18)^e>>>3},t.g1_256=function(e){return s(e,17)^s(e,19)^e>>>10}},function(e,t,r){"use strict";function n(){if(!(this instanceof n))return new n;g.call(this),this.h=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],this.k=m,this.W=new Array(64)}var i=r(5),o=r(16),s=r(48),a=r(11),c=i.sum32,f=i.sum32_4,u=i.sum32_5,h=s.ch32,d=s.maj32,l=s.s0_256,p=s.s1_256,b=s.g0_256,y=s.g1_256,g=o.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];i.inherits(n,g),e.exports=n,n.blockSize=512,n.outSize=256,n.hmacStrength=192,n.padLength=64,n.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]=f(y(r[n-2]),r[n-7],b(r[n-15]),r[n-16]);var i=this.h[0],o=this.h[1],s=this.h[2],g=this.h[3],m=this.h[4],v=this.h[5],_=this.h[6],w=this.h[7];for(a(this.k.length===r.length),n=0;n<r.length;n++){var S=u(w,p(m),h(m,v,_),this.k[n],r[n]),k=c(l(i),d(i,o,s));w=_,_=v,v=m,m=c(g,S),g=s,s=o,o=i,i=c(S,k)}this.h[0]=c(this.h[0],i),this.h[1]=c(this.h[1],o),this.h[2]=c(this.h[2],s),this.h[3]=c(this.h[3],g),this.h[4]=c(this.h[4],m),this.h[5]=c(this.h[5],v),this.h[6]=c(this.h[6],_),this.h[7]=c(this.h[7],w)},n.prototype._digest=function(e){return"hex"===e?i.toHex32(this.h,"big"):i.split32(this.h,"big")}},function(e,t,r){"use strict";function n(){if(!(this instanceof n))return new n;m.call(this),this.h=[1779033703,4089235720,3144134277,2227873595,1013904242,4271175723,2773480762,1595750129,1359893119,2917565137,2600822924,725511199,528734635,4215389547,1541459225,327033209],this.k=v,this.W=new Array(160)}var i=r(5),o=r(16),s=r(11),a=i.rotr64_hi,c=i.rotr64_lo,f=i.shr64_hi,u=i.shr64_lo,h=i.sum64,d=i.sum64_hi,l=i.sum64_lo,p=i.sum64_4_hi,b=i.sum64_4_lo,y=i.sum64_5_hi,g=i.sum64_5_lo,m=o.BlockHash,v=[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];i.inherits(n,m),e.exports=n,n.blockSize=1024,n.outSize=512,n.hmacStrength=192,n.padLength=128,n.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=function(e,t){var r=a(e,t,19)^a(t,e,29)^f(e,t,6);return r<0&&(r+=4294967296),r}(r[n-4],r[n-3]),o=function(e,t){var r=c(e,t,19)^c(t,e,29)^u(e,t,6);return r<0&&(r+=4294967296),r}(r[n-4],r[n-3]),s=r[n-14],h=r[n-13],d=function(e,t){var r=a(e,t,1)^a(e,t,8)^f(e,t,7);return r<0&&(r+=4294967296),r}(r[n-30],r[n-29]),l=function(e,t){var r=c(e,t,1)^c(e,t,8)^u(e,t,7);return r<0&&(r+=4294967296),r}(r[n-30],r[n-29]),y=r[n-32],g=r[n-31];r[n]=p(i,o,s,h,d,l,y,g),r[n+1]=b(i,o,s,h,d,l,y,g)}},n.prototype._update=function(e,t){this._prepareBlock(e,t);var r=this.W,n=this.h[0],i=this.h[1],o=this.h[2],f=this.h[3],u=this.h[4],p=this.h[5],b=this.h[6],m=this.h[7],v=this.h[8],_=this.h[9],w=this.h[10],S=this.h[11],k=this.h[12],E=this.h[13],x=this.h[14],M=this.h[15];s(this.k.length===r.length);for(var A=0;A<r.length;A+=2){var O=x,I=M,N=function(e,t){var r=a(e,t,14)^a(e,t,18)^a(t,e,9);return r<0&&(r+=4294967296),r}(v,_),R=function(e,t){var r=c(e,t,14)^c(e,t,18)^c(t,e,9);return r<0&&(r+=4294967296),r}(v,_),P=function(e,t,r,n,i){var o=e&r^~e&i;return o<0&&(o+=4294967296),o}(v,0,w,0,k),C=function(e,t,r,n,i,o){var s=t&n^~t&o;return s<0&&(s+=4294967296),s}(0,_,0,S,0,E),j=this.k[A],T=this.k[A+1],L=r[A],B=r[A+1],D=y(O,I,N,R,P,C,j,T,L,B),q=g(O,I,N,R,P,C,j,T,L,B);O=function(e,t){var r=a(e,t,28)^a(t,e,2)^a(t,e,7);return r<0&&(r+=4294967296),r}(n,i),I=function(e,t){var r=c(e,t,28)^c(t,e,2)^c(t,e,7);return r<0&&(r+=4294967296),r}(n,i),N=function(e,t,r,n,i){var o=e&r^e&i^r&i;return o<0&&(o+=4294967296),o}(n,0,o,0,u),R=function(e,t,r,n,i,o){var s=t&n^t&o^n&o;return s<0&&(s+=4294967296),s}(0,i,0,f,0,p);var F=d(O,I,N,R),z=l(O,I,N,R);x=k,M=E,k=w,E=S,w=v,S=_,v=d(b,m,D,q),_=l(m,m,D,q),b=u,m=p,u=o,p=f,o=n,f=i,n=d(D,q,F,z),i=l(D,q,F,z)}h(this.h,0,n,i),h(this.h,2,o,f),h(this.h,4,u,p),h(this.h,6,b,m),h(this.h,8,v,_),h(this.h,10,w,S),h(this.h,12,k,E),h(this.h,14,x,M)},n.prototype._digest=function(e){return"hex"===e?i.toHex32(this.h,"big"):i.split32(this.h,"big")}},function(e,t,r){"use strict";var n=r(14);e.exports=function(e){if(null===e||"object"!=typeof e)return e;if(e instanceof Object)var t={__proto__:e.__proto__};else t=Object.create(null);return Object.getOwnPropertyNames(e).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(e,r))}),t}(n)},function(e,t,r){"use strict";(function(t){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)}function o(e){return Object.prototype.toString.call(e)}function s(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))))}function a(e){if(g.isFunction(e)){if(_)return e.name;var t=e.toString().match(S);return t&&t[1]}}function c(e,t){return"string"==typeof e?e.length<t?e:e.slice(0,t):e}function f(e){if(_||!g.isFunction(e))return g.inspect(e);var t=a(e);return"[Function"+(t?": "+t:"")+"]"}function u(e,t,r,n,i){throw new w.AssertionError({message:r,actual:e,expected:t,operator:n,stackStartFunction:i})}function h(e,t){e||u(e,!0,t,"==",w.ok)}function d(e,t,r,a){if(e===t)return!0;if(i(e)&&i(t))return 0===n(e,t);if(g.isDate(e)&&g.isDate(t))return e.getTime()===t.getTime();if(g.isRegExp(e)&&g.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(s(e)&&s(t)&&o(e)===o(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 c=(a=a||{actual:[],expected:[]}).actual.indexOf(e);return-1!==c&&c===a.expected.indexOf(t)||(a.actual.push(e),a.expected.push(t),function(e,t,r,n){if(null===e||void 0===e||null===t||void 0===t)return!1;if(g.isPrimitive(e)||g.isPrimitive(t))return e===t;if(r&&Object.getPrototypeOf(e)!==Object.getPrototypeOf(t))return!1;var i=l(e),o=l(t);if(i&&!o||!i&&o)return!1;if(i)return e=v.call(e),t=v.call(t),d(e,t,r);var s,a,c=k(e),f=k(t);if(c.length!==f.length)return!1;for(c.sort(),f.sort(),a=c.length-1;a>=0;a--)if(c[a]!==f[a])return!1;for(a=c.length-1;a>=0;a--)if(s=c[a],!d(e[s],t[s],r,n))return!1;return!0}(e,t,r,a))}return r?e===t:e==t}function l(e){return"[object Arguments]"==Object.prototype.toString.call(e)}function p(e,t,r){d(e,t,!0)&&u(e,t,r,"notDeepStrictEqual",p)}function b(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 y(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&&u(i,r,"Missing expected exception"+n);var o="string"==typeof n,s=!e&&g.isError(i),a=!e&&i&&!r;if((s&&o&&b(i,r)||a)&&u(i,r,"Got unwanted exception"+n),e&&i&&r&&!b(i,r)||!e&&i)throw i}var g=r(6),m=Object.prototype.hasOwnProperty,v=Array.prototype.slice,_="foo"===function(){}.name,w=e.exports=h,S=/\s*function\s+([^\(\s]*)\s*/;w.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 c(f(e.actual),128)+" "+e.operator+" "+c(f(e.expected),128)}(this),this.generatedMessage=!0);var t=e.stackStartFunction||u;if(Error.captureStackTrace)Error.captureStackTrace(this,t);else{var r=new Error;if(r.stack){var n=r.stack,i=a(t),o=n.indexOf("\n"+i);if(o>=0){var s=n.indexOf("\n",o+1);n=n.substring(s+1)}this.stack=n}}},g.inherits(w.AssertionError,Error),w.fail=u,w.ok=h,w.equal=function(e,t,r){e!=t&&u(e,t,r,"==",w.equal)},w.notEqual=function(e,t,r){e==t&&u(e,t,r,"!=",w.notEqual)},w.deepEqual=function(e,t,r){d(e,t,!1)||u(e,t,r,"deepEqual",w.deepEqual)},w.deepStrictEqual=function(e,t,r){d(e,t,!0)||u(e,t,r,"deepStrictEqual",w.deepStrictEqual)},w.notDeepEqual=function(e,t,r){d(e,t,!1)&&u(e,t,r,"notDeepEqual",w.notDeepEqual)},w.notDeepStrictEqual=p,w.strictEqual=function(e,t,r){e!==t&&u(e,t,r,"===",w.strictEqual)},w.notStrictEqual=function(e,t,r){e===t&&u(e,t,r,"!==",w.notStrictEqual)},w.throws=function(e,t,r){y(!0,e,t,r)},w.doesNotThrow=function(e,t,r){y(!1,e,t,r)},w.ifError=function(e){if(e)throw e};var k=Object.keys||function(e){var t=[];for(var r in e)m.call(e,r)&&t.push(r);return t}}).call(t,r(7))},function(e,t){e.exports=function(){var e,t=Array.prototype.slice.call(arguments),r=null;return"object"==typeof t[0]?(r=t.shift(),"string"==typeof(e=t.shift())&&(e=r[e])):e=t.shift(),function(n){e.apply(r,t.concat(n))}}},function(e,t,r){"use strict";const{deepEqual:n}=r(136),i=(e,t)=>e+t;class o{constructor(e,t){this.id=e,this._counters=t||{},this._counters[this.id]=this._counters[this.id]?this._counters[this.id]:0}get value(){return Object.values(this._counters).reduce(i,0)}increment(e){e&&e<1||(void 0!==e&&null!==e||(e=1),this._counters[this.id]=this._counters[this.id]+e)}merge(e){Object.entries(e._counters).forEach(([e,t])=>{this._counters[e]=Math.max(this._counters[e]||0,t)})}toJSON(){return{id:this.id,counters:this._counters}}isEqual(e){return o.isEqual(this,e)}static from(e){return new o(e.id,e.counters)}static isEqual(e,t){return e.id===t.id&&n(e._counters,t._counters)}}e.exports=o},function(e,t,r){(function(e,r){function n(e,t){return e.set(t[0],t[1]),e}function i(e,t){return e.add(t),e}function o(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 s(e){var t=!1;if(null!=e&&"function"!=typeof e.toString)try{t=!!(e+"")}catch(e){}return t}function a(e){var t=-1,r=Array(e.size);return e.forEach(function(e,n){r[++t]=[n,e]}),r}function c(e,t){return function(r){return e(t(r))}}function f(e){var t=-1,r=Array(e.size);return e.forEach(function(e){r[++t]=e}),r}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 h(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 l(e){this.__data__=new h(e)}function p(e,t){var r=Ve(e)||function(e){return function(e){return function(e){return!!e&&"object"==typeof e}(e)&&M(e)}(e)&&_e.call(e,"callee")&&(!Oe.call(e,"callee")||we.call(e)==C)}(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&&!_e.call(e,o)||i&&("length"==o||function(e,t){return!!(t=null==t?P:t)&&("number"==typeof e||se.test(e))&&e>-1&&e%1==0&&e<t}(o,n))||r.push(o);return r}function b(e,t,r){var n=e[t];_e.call(e,t)&&x(n,r)&&(void 0!==r||t in e)||(e[t]=r)}function y(e,t){for(var r=e.length;r--;)if(x(e[r][0],t))return r;return-1}function g(e,t,r,c,u,h,d){var p;if(c&&(p=h?c(e,u,h,d):c(e)),void 0!==p)return p;if(!O(e))return e;var y=Ve(e);if(y){if(p=function(e){var t=e.length,r=e.constructor(t);t&&"string"==typeof e[0]&&_e.call(e,"index")&&(r.index=e.index,r.input=e.input);return r}(e),!t)return function(e,t){var r=-1,n=e.length;t||(t=Array(n));for(;++r<n;)t[r]=e[r];return t}(e,p)}else{var m=Ye(e),w=m==L||m==B;if(Je(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(m==F||m==C||w&&!h){if(s(e))return h?e:{};if(p=function(e){return"function"!=typeof e.constructor||k(e)?{}:function(e){return O(e)?Ae(e):{}}(Me(e))}(w?{}:e),!t)return function(e,t){return _(e,He(e),t)}(e,function(e,t){return e&&_(t,I(t),e)}(p,e))}else{if(!ae[m])return h?e:{};p=function(e,t,r,s){var c=e.constructor;switch(t){case Y:return v(e);case j:case T:return new c(+e);case V:return function(e,t){var r=t?v(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.byteLength)}(e,s);case J:case $:case X:case Z:case Q:case ee:case te:case re:case ne:return function(e,t){var r=t?v(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.length)}(e,s);case D:return function(e,t,r){return o(t?r(a(e),!0):a(e),n,new e.constructor)}(e,s,r);case q:case G:return new c(e);case U:return function(e){var t=new e.constructor(e.source,ie.exec(e));return t.lastIndex=e.lastIndex,t}(e);case K:return function(e,t,r){return o(t?r(f(e),!0):f(e),i,new e.constructor)}(e,s,r);case W:return function(e){return We?Object(We.call(e)):{}}(e)}}(e,m,g,t)}}d||(d=new l);var S=d.get(e);if(S)return S;if(d.set(e,p),!y)var E=r?function(e){return function(e,t,r){var n=t(e);return Ve(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,I,He)}(e):I(e);return function(e,t){for(var r=-1,n=e?e.length:0;++r<n&&!1!==t(e[r],r,e););}(E||e,function(n,i){E&&(n=e[i=n]),b(p,i,g(n,t,r,c,i,e,d))}),p}function m(e){if(!O(e)||function(e){return!!me&&me in e}(e))return!1;return(A(e)||s(e)?Se:oe).test(E(e))}function v(e){var t=new e.constructor(e.byteLength);return new xe(t).set(new xe(e)),t}function _(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;b(r,s,void 0===a?e[s]:a)}return r}function w(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 S(e,t){var r=function(e,t){return null==e?void 0:e[t]}(e,t);return m(r)?r:void 0}function k(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||ye)}function E(e){if(null!=e){try{return ve.call(e)}catch(e){}try{return e+""}catch(e){}}return""}function x(e,t){return e===t||e!=e&&t!=t}function M(e){return null!=e&&function(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=P}(e.length)&&!A(e)}function A(e){var t=O(e)?we.call(e):"";return t==L||t==B}function O(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function I(e){return M(e)?p(e):function(e){if(!k(e))return Pe(e);var t=[];for(var r in Object(e))_e.call(e,r)&&"constructor"!=r&&t.push(r);return t}(e)}var N=200,R="__lodash_hash_undefined__",P=9007199254740991,C="[object Arguments]",j="[object Boolean]",T="[object Date]",L="[object Function]",B="[object GeneratorFunction]",D="[object Map]",q="[object Number]",F="[object Object]",z="[object Promise]",U="[object RegExp]",K="[object Set]",G="[object String]",W="[object Symbol]",H="[object WeakMap]",Y="[object ArrayBuffer]",V="[object DataView]",J="[object Float32Array]",$="[object Float64Array]",X="[object Int8Array]",Z="[object Int16Array]",Q="[object Int32Array]",ee="[object Uint8Array]",te="[object Uint8ClampedArray]",re="[object Uint16Array]",ne="[object Uint32Array]",ie=/\w*$/,oe=/^\[object .+?Constructor\]$/,se=/^(?:0|[1-9]\d*)$/,ae={};ae[C]=ae["[object Array]"]=ae[Y]=ae[V]=ae[j]=ae[T]=ae[J]=ae[$]=ae[X]=ae[Z]=ae[Q]=ae[D]=ae[q]=ae[F]=ae[U]=ae[K]=ae[G]=ae[W]=ae[ee]=ae[te]=ae[re]=ae[ne]=!0,ae["[object Error]"]=ae[L]=ae[H]=!1;var ce="object"==typeof e&&e&&e.Object===Object&&e,fe="object"==typeof self&&self&&self.Object===Object&&self,ue=ce||fe||Function("return this")(),he="object"==typeof t&&t&&!t.nodeType&&t,de=he&&"object"==typeof r&&r&&!r.nodeType&&r,le=de&&de.exports===he,pe=Array.prototype,be=Function.prototype,ye=Object.prototype,ge=ue["__core-js_shared__"],me=function(){var e=/[^.]+$/.exec(ge&&ge.keys&&ge.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}(),ve=be.toString,_e=ye.hasOwnProperty,we=ye.toString,Se=RegExp("^"+ve.call(_e).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),ke=le?ue.Buffer:void 0,Ee=ue.Symbol,xe=ue.Uint8Array,Me=c(Object.getPrototypeOf,Object),Ae=Object.create,Oe=ye.propertyIsEnumerable,Ie=pe.splice,Ne=Object.getOwnPropertySymbols,Re=ke?ke.isBuffer:void 0,Pe=c(Object.keys,Object),Ce=S(ue,"DataView"),je=S(ue,"Map"),Te=S(ue,"Promise"),Le=S(ue,"Set"),Be=S(ue,"WeakMap"),De=S(Object,"create"),qe=E(Ce),Fe=E(je),ze=E(Te),Ue=E(Le),Ke=E(Be),Ge=Ee?Ee.prototype:void 0,We=Ge?Ge.valueOf:void 0;u.prototype.clear=function(){this.__data__=De?De(null):{}},u.prototype.delete=function(e){return this.has(e)&&delete this.__data__[e]},u.prototype.get=function(e){var t=this.__data__;if(De){var r=t[e];return r===R?void 0:r}return _e.call(t,e)?t[e]:void 0},u.prototype.has=function(e){var t=this.__data__;return De?void 0!==t[e]:_e.call(t,e)},u.prototype.set=function(e,t){return this.__data__[e]=De&&void 0===t?R:t,this},h.prototype.clear=function(){this.__data__=[]},h.prototype.delete=function(e){var t=this.__data__,r=y(t,e);return!(r<0||(r==t.length-1?t.pop():Ie.call(t,r,1),0))},h.prototype.get=function(e){var t=this.__data__,r=y(t,e);return r<0?void 0:t[r][1]},h.prototype.has=function(e){return y(this.__data__,e)>-1},h.prototype.set=function(e,t){var r=this.__data__,n=y(r,e);return n<0?r.push([e,t]):r[n][1]=t,this},d.prototype.clear=function(){this.__data__={hash:new u,map:new(je||h),string:new u}},d.prototype.delete=function(e){return w(this,e).delete(e)},d.prototype.get=function(e){return w(this,e).get(e)},d.prototype.has=function(e){return w(this,e).has(e)},d.prototype.set=function(e,t){return w(this,e).set(e,t),this},l.prototype.clear=function(){this.__data__=new h},l.prototype.delete=function(e){return this.__data__.delete(e)},l.prototype.get=function(e){return this.__data__.get(e)},l.prototype.has=function(e){return this.__data__.has(e)},l.prototype.set=function(e,t){var r=this.__data__;if(r instanceof h){var n=r.__data__;if(!je||n.length<N-1)return n.push([e,t]),this;r=this.__data__=new d(n)}return r.set(e,t),this};var He=Ne?c(Ne,Object):function(){return[]},Ye=function(e){return we.call(e)};(Ce&&Ye(new Ce(new ArrayBuffer(1)))!=V||je&&Ye(new je)!=D||Te&&Ye(Te.resolve())!=z||Le&&Ye(new Le)!=K||Be&&Ye(new Be)!=H)&&(Ye=function(e){var t=we.call(e),r=t==F?e.constructor:void 0,n=r?E(r):void 0;if(n)switch(n){case qe:return V;case Fe:return D;case ze:return z;case Ue:return K;case Ke:return H}return t});var Ve=Array.isArray,Je=Re||function(){return!1};r.exports=function(e){return g(e,!0,!0)}}).call(t,r(7),r(46)(e))},function(e,t,r){"use strict";e.exports="ipfs-pubsub-room/v2"},function(e,t,r){"use strict";var n=r(149),i=r(155),o=r(161);(t=e.exports=r(169)).pull=t;for(var s in 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){e.exports=function(e,t,r){e(t),r&&r(!0===t?null:t)}},function(e,t,r){"use strict";var n=r(58);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){var n=r(18);e.exports=function(e){return"object"==typeof e&&"function"==typeof e.test?function(t){return e.test(t)}:n(e)||function(e){return e}}},function(e,t,r){"use strict";var n=r(18),i=r(31);e.exports=function(e,t){e=n(e)||function(e){return e};var r={};return i(function(n){var i=e(n);return r[i]?!!t:(r[i]=!0,!t)})}},function(e,t,r){"use strict";const n=r(9).Buffer;e.exports=(e=>{let t=e;return n.isBuffer(t)||(t=n.from(t)),t})},function(e,t,r){"use strict";(function(t){const n=r(14),i=r(6).format,o=r(2).EventEmitter;let s=!!t.version;const a={DEBUG:"DEBUG",INFO:"INFO",WARN:"WARN",ERROR:"ERROR",NONE:"NONE"};let c=a.DEBUG,f=null,u=new o,h={Black:0,Red:1,Green:2,Yellow:3,Blue:4,Magenta:5,Cyan:6,Grey:7,White:9,Default:9};s||(h={Black:"Black",Red:"IndianRed",Green:"LimeGreen",Yellow:"Orange",Blue:"RoyalBlue",Magenta:"Orchid",Cyan:"SkyBlue",Grey:"DimGrey",White:"White",Default:"Black"});const d=[h.Cyan,h.Green,h.Yellow,h.Red,h.Default],l={useColors:!0,color:h.Default,showTimestamp:!0,showLevel:!0,filename:f,appendFile:!0};e.exports={Colors:h,LogLevels:a,setLogLevel:e=>{c=e},setLogfile:e=>{f=e},create:(e,r)=>{return new class{constructor(e,t){this.category=e;let r={};Object.assign(r,l),Object.assign(r,t),this.options=r}debug(){this._shouldLog(a.DEBUG)&&this._write(a.DEBUG,i.apply(null,arguments))}log(){this._shouldLog(a.DEBUG)&&this.debug.apply(this,arguments)}info(){this._shouldLog(a.INFO)&&this._write(a.INFO,i.apply(null,arguments))}warn(){this._shouldLog(a.WARN)&&this._write(a.WARN,i.apply(null,arguments))}error(){this._shouldLog(a.ERROR)&&this._write(a.ERROR,i.apply(null,arguments))}_write(e,t){(this.options.filename||f)&&!this.fileWriter&&s&&(this.fileWriter=n.openSync(this.options.filename||f,this.options.appendFile?"a+":"w+"));let r=this._format(e,t),i=this._createLogMessage(e,t),o=this._createLogMessage(e,t,r.timestamp,r.level,r.category,r.text);this.fileWriter&&s&&n.writeSync(this.fileWriter,i+"\n",null,"utf-8"),s||!this.options.useColors?(console.log(o),u.emit("data",this.category,e,t)):e===a.ERROR?this.options.showTimestamp&&this.options.showLevel?console.error(o,r.timestamp,r.level,r.category,r.text):this.options.showTimestamp&&!this.options.showLevel?console.error(o,r.timestamp,r.category,r.text):!this.options.showTimestamp&&this.options.showLevel?console.error(o,r.level,r.category,r.text):console.error(o,r.category,r.text):this.options.showTimestamp&&this.options.showLevel?console.log(o,r.timestamp,r.level,r.category,r.text):this.options.showTimestamp&&!this.options.showLevel?console.log(o,r.timestamp,r.category,r.text):!this.options.showTimestamp&&this.options.showLevel?console.log(o,r.level,r.category,r.text):console.log(o,r.category,r.text)}_format(e,t){let r="",n="",i="",o=": ";if(this.options.useColors){const t=Object.keys(a).map(e=>a[e]).indexOf(e),c=this.options.color;s?(this.options.showTimestamp&&(r="[3"+h.Grey+"m"),this.options.showLevel&&(n="[3"+d[t]+";22m"),i="[3"+c+";1m",o="[0m: "):(this.options.showTimestamp&&(r="color:"+h.Grey),this.options.showLevel&&(n="color:"+d[t]),i="color:"+c+"; font-weight: bold")}return{timestamp:r,level:n,category:i,text:o}}_createLogMessage(e,t,r,n,i,o){r=r||"",n=n||"",i=i||"",o=o||": ",!s&&this.options.useColors&&(this.options.showTimestamp&&(r="%c"),this.options.showLevel&&(n="%c"),i="%c",o=": %c");let c="";return this.options.showTimestamp&&(c+=(new Date).toISOString()+" "),c=r+c,this.options.showLevel&&(c+=n+"["+e+"]"+(e===a.INFO||e===a.WARN?" ":"")+" "),c+=i+this.category,c+=o+t}_shouldLog(e){let r=void 0!==t&&void 0!==Object({NODE_ENV:void 0})&&void 0!==Object({NODE_ENV:void 0}).LOG?Object({NODE_ENV:void 0}).LOG.toUpperCase():null;const n=(r="undefined"!=typeof window&&window.LOG?window.LOG.toUpperCase():r)||c,i=Object.keys(a).map(e=>a[e]);return i.indexOf(e)>=i.indexOf(n)}}(e,r)},forceBrowserMode:e=>s=!e,events:u}}).call(t,r(0))},function(e,t,r){(function(t,n){function i(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"}var o=r(32),s=r(65),a=r(66);i.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))},i.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))},i.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"))?n(i):(e=this._serializeKey(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"))}))},i.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"))?i(o):(e=this._serializeKey(e),r=this._serializeValue(r),"object"!=typeof n&&(n={}),"function"==typeof this._put?this._put(e,r,n,i):void t.nextTick(i))},i.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"))?n(i):(e=this._serializeKey(e),"object"!=typeof r&&(r={}),"function"==typeof this._del?this._del(e,r,n):void t.nextTick(n))},i.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"))return n(o);if(o=this._checkKey(i.key,"key"))return n(o)}if("function"==typeof this._batch)return this._batch(e,r,n);t.nextTick(n)},i.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(e=this._serializeKey(e),r=this._serializeKey(r),"function"==typeof this._approximateSize)return this._approximateSize(e,r,n);t.nextTick(function(){n(null,0)})},i.prototype._setupIteratorOptions=function(e){var t=this;return e=o(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},i.prototype.iterator=function(e){return"object"!=typeof e&&(e={}),e=this._setupIteratorOptions(e),"function"==typeof this._iterator?this._iterator(e):new s(this)},i.prototype._chainedBatch=function(){return new a(this)},i.prototype._isBuffer=function(e){return n.isBuffer(e)},i.prototype._serializeKey=function(e){return this._isBuffer(e)?e:String(e)},i.prototype._serializeValue=function(e){return null==e?"":this._isBuffer(e)||t.browser?e:String(e)},i.prototype._checkKey=function(e,t){return null===e||void 0===e?new Error(t+" cannot be `null` or `undefined`"):this._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=i}).call(t,r(0),r(1).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(t,r(0))},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",this._db._isBuffer);if(r)throw r;return e=this._serializeKey(e),t=this._serializeValue(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 e=this._serializeKey(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(t,r(0))},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,n){function i(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}var o=r(189),s=r(190),a=r(191);i.prototype.open=function(e,r){if("function"==typeof e&&(r=e),"function"!=typeof r)throw new Error("open() requires a callback argument");if("object"!=typeof e&&(e={}),"function"==typeof this._open)return this._open(e,r);t.nextTick(r)},i.prototype.close=function(e){if("function"!=typeof e)throw new Error("close() requires a callback argument");if("function"==typeof this._close)return this._close(e);t.nextTick(e)},i.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._checkKeyValue(e,"key",this._isBuffer))?n(i):(this._isBuffer(e)||(e=String(e)),"object"!=typeof r&&(r={}),"function"==typeof this._get?this._get(e,r,n):void t.nextTick(function(){n(new Error("NotFound"))}))},i.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._checkKeyValue(e,"key",this._isBuffer))?i(o):(o=this._checkKeyValue(r,"value",this._isBuffer))?i(o):(this._isBuffer(e)||(e=String(e)),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))},i.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._checkKeyValue(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))},i.prototype.batch=function(e,r,n){if(!arguments.length)return this._chainedBatch();if("function"==typeof r&&(n=r),"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"));"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._checkKeyValue(i.type,"type",this._isBuffer))return n(o);if(o=this._checkKeyValue(i.key,"key",this._isBuffer))return n(o);if("put"==i.type&&(o=this._checkKeyValue(i.value,"value",this._isBuffer)))return n(o)}if("function"==typeof this._batch)return this._batch(e,r,n);t.nextTick(n)},i.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)})},i.prototype._setupIteratorOptions=function(e){var t=this;return e=o(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.reverse&&e.lt&&(e.start=e.lt),e.reverse&&e.lte&&(e.start=e.lte),!e.reverse&&e.gt&&(e.start=e.gt),!e.reverse&&e.gte&&(e.start=e.gte),(e.reverse&&e.lt&&!e.lte||!e.reverse&&e.gt&&!e.gte)&&(e.exclusiveStart=!0),e},i.prototype.iterator=function(e){return"object"!=typeof e&&(e={}),e=this._setupIteratorOptions(e),"function"==typeof this._iterator?this._iterator(e):new s(this)},i.prototype._chainedBatch=function(){return new a(this)},i.prototype._isBuffer=function(e){return n.isBuffer(e)},i.prototype._checkKeyValue=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.AbstractLevelDOWN=i,e.exports.AbstractIterator=s,e.exports.AbstractChainedBatch=a}).call(t,r(0),r(1).Buffer)},function(e,t,r){"use strict";const n=r(12),i=r(34),o=r(130),s=r(132),a=r(134),c=r(137),f=r(140),u=r(172),h=r(45),d=r(202),l=r(204),p=r(213),b=r(63),y=b.create("orbit-db");b.setLogLevel("NONE");const g=["eventlog","feed","docstore","counter","keyvalue"];class m{constructor(e,t,r={}){this._ipfs=e,this.id=r.peerId||(this._ipfs._peerInfo?this._ipfs._peerInfo.id._idB58String:"default"),this._pubsub=r&&r.broker?new r.broker(this._ipfs):new f(this._ipfs,this.id),this.stores={},this.types=g,this.directory=t||"./orbitdb",this.keystore=new h(n.join(this.directory,this.id,"/keystore")),this.key=this.keystore.getKey(this.id)||this.keystore.createKey(this.id)}async feed(e,t={}){return t=Object.assign({create:!0,type:"feed"},t),this.open(e,t)}async log(e,t){return t=Object.assign({create:!0,type:"eventlog"},t),this.open(e,t)}async eventlog(e,t={}){return this.log(e,t)}async keyvalue(e,t){return t=Object.assign({create:!0,type:"keyvalue"},t),this.open(e,t)}async kvstore(e,t){return this.keyvalue(e,t)}async counter(e,t={}){return t=Object.assign({create:!0,type:"counter"},t),this.open(e,t)}async docs(e,t={}){return t=Object.assign({create:!0,type:"docstore"},t),this.open(e,t)}async docstore(e,t={}){return this.docs(e,t)}async disconnect(){const e=Object.values(this.stores);for(let t of e)await t.close(),delete this.stores[t.address.toString()];this._pubsub&&this._pubsub.disconnect(),this.stores={}}async stop(){await this.disconnect()}async _createStore(e,t,r){const n=t.toString();let i;r.accessControllerAddress&&(i=new d(this._ipfs),await i.load(r.accessControllerAddress));const o=await this._loadCache(this.directory,t),s=Object.assign({replicate:!0},r,{accessController:i,keystore:this.keystore,cache:o}),a=new e(this._ipfs,this.id,t,s);return a.events.on("write",this._onWrite.bind(this)),a.events.on("closed",this._onClosed.bind(this)),this.stores[n]=a,s.replicate&&this._pubsub&&this._pubsub.subscribe(n,this._onMessage.bind(this),this._onPeerConnected.bind(this)),a}_onWrite(e,t,r){if(!r)throw new Error("'heads' not defined");this._pubsub&&this._pubsub.publish(e,r)}async _onMessage(e,t){const r=this.stores[e];try{y.debug(`Received heads for '${e}':\n`,JSON.stringify(t,null,2)),await r.sync(t)}catch(e){y.error(e)}}_onPeerConnected(e,t,r){y.debug(`New peer '${t}' connected to '${e}'`);const n=this.stores[e];if(n){let i=n._oplog.heads;i.length>0&&(y.debug(`Send latest heads of '${e}':\n`,JSON.stringify(i,null,2)),r.sendTo(t,JSON.stringify(i))),n.events.emit("peer",t)}}_onClosed(e){y.debug(`Database '${e}' was closed`),this.stores[e].events.removeAllListeners("closed"),this._pubsub&&this._pubsub.unsubscribe(e),delete this.stores[e]}async create(e,t,r={}){if(y.debug("create()"),!m.isValidType(t))throw new Error(`Invalid database type '${t}'`);const i=r.directory||this.directory;if(y.debug(`Creating database '${e}' as ${t} in '${i}'`),l.isValid(e))throw new Error("Given database name is an address. Please give only the name of the database!");const o=new d(this._ipfs);r&&r.write&&r.write.length>0?r.write.forEach(e=>o.add("write",e)):o.add("write",this.key.getPublic("hex"));const s=await o.save(),a=await p(this._ipfs,e,t,s),c=l.parse(n.join("/orbitdb",a,e));if(await this._loadCache(i,c).then(e=>e?e.get(n.join(c.toString(),"_manifest")):null).then(e=>void 0!==e&&null!==e)&&!r.overwrite)throw new Error(`Database '${c}' already exists!`);return await this._saveDBManifest(i,c),y.debug(`Created database '${c}'`),this.open(c,r)}async open(e,t={}){y.debug("open()"),t=Object.assign({localOnly:!1,create:!1},t),y.debug(`Open database '${e}'`);const r=t.directory||this.directory;if(y.debug(`Look from '${r}'`),!l.isValid(e)){if(t.create){if(t.create&&!t.type)throw new Error(`Database type not provided! Provide a type with 'options.type' (${g.join("|")})`);return y.warn(`Not a valid OrbitDB address '${e}', creating the database`),t.overwrite=!t.overwrite||t.overwrite,this.create(e,t.type,t)}throw new Error("'options.create' set to 'false'. If you want to create a database, set 'options.create' to 'true'.")}const i=l.parse(e),o=await this._loadCache(r,i).then(e=>e?e.get(n.join(i.toString(),"_manifest")):null).then(e=>void 0!==e&&null!==e);if(y.debug((o?"Found":"Didn't find")+` database '${i}'`),t.localOnly&&!o)throw y.error(`Database '${i}' doesn't exist!`),new Error(`Database '${i}' doesn't exist!`);y.debug(`Loading Manifest for '${i}'`);const s=await this._ipfs.object.get(i.root),a=JSON.parse(s.toJSON().data);if(y.debug(`Manifest for '${i}':\n${JSON.stringify(a,null,2)}`),t.type&&a.type!==t.type)throw new Error(`Database '${i}' is type '${a.type}' but was opened as '${t.type}'`);return await this._saveDBManifest(r,i),t=Object.assign({},t,{accessControllerAddress:a.accessController}),this._openDatabase(i,a.type,t)}async _saveDBManifest(e,t){const r=await this._loadCache(e,t);await r.set(n.join(t.toString(),"_manifest"),t.root),y.debug(`Saved manifest to IPFS as '${t.root}'`)}async _loadCache(e,t){let r;try{r=await u.load(e,t)}catch(e){y.warn("Couldn't load Cache:",e)}return r}async _openDatabase(e,t,r){if("counter"===t)return this._createStore(a,e,r);if("eventlog"===t)return this._createStore(i,e,r);if("feed"===t)return this._createStore(o,e,r);if("docstore"===t)return this._createStore(c,e,r);if("keyvalue"===t)return this._createStore(s,e,r);throw new Error(`Invalid database type '${t}'`)}static isValidType(e){return g.includes(e)}static create(){return new Error("Not implemented yet!")}static open(){return new Error("Not implemented yet!")}}e.exports=m},function(e,t,r){"use strict";function n(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 i(e){return s[e>>18&63]+s[e>>12&63]+s[e>>6&63]+s[63&e]}function o(e,t,r){for(var n,o=[],s=t;s<r;s+=3)n=(e[s]<<16)+(e[s+1]<<8)+e[s+2],o.push(i(n));return o.join("")}t.byteLength=function(e){return 3*e.length/4-n(e)},t.toByteArray=function(e){var t,r,i,o,s,f=e.length;o=n(e),s=new c(3*f/4-o),r=o>0?f-4:f;var u=0;for(t=0;t<r;t+=4)i=a[e.charCodeAt(t)]<<18|a[e.charCodeAt(t+1)]<<12|a[e.charCodeAt(t+2)]<<6|a[e.charCodeAt(t+3)],s[u++]=i>>16&255,s[u++]=i>>8&255,s[u++]=255&i;return 2===o?(i=a[e.charCodeAt(t)]<<2|a[e.charCodeAt(t+1)]>>4,s[u++]=255&i):1===o&&(i=a[e.charCodeAt(t)]<<10|a[e.charCodeAt(t+1)]<<4|a[e.charCodeAt(t+2)]>>2,s[u++]=i>>8&255,s[u++]=255&i),s},t.fromByteArray=function(e){for(var t,r=e.length,n=r%3,i="",a=[],c=0,f=r-n;c<f;c+=16383)a.push(o(e,c,c+16383>f?f:c+16383));return 1===n?(t=e[r-1],i+=s[t>>2],i+=s[t<<4&63],i+="=="):2===n&&(t=(e[r-2]<<8)+e[r-1],i+=s[t>>10],i+=s[t>>4&63],i+=s[t<<2&63],i+="="),a.push(i),a.join("")};for(var s=[],a=[],c="undefined"!=typeof Uint8Array?Uint8Array:Array,f="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",u=0,h=f.length;u<h;++u)s[u]=f[u],a[f.charCodeAt(u)]=u;a["-".charCodeAt(0)]=62,a["_".charCodeAt(0)]=63},function(e,t){t.read=function(e,t,r,n,i){var o,s,a=8*i-n-1,c=(1<<a)-1,f=c>>1,u=-7,h=r?i-1:0,d=r?-1:1,l=e[t+h];for(h+=d,o=l&(1<<-u)-1,l>>=-u,u+=a;u>0;o=256*o+e[t+h],h+=d,u-=8);for(s=o&(1<<-u)-1,o>>=-u,u+=n;u>0;s=256*s+e[t+h],h+=d,u-=8);if(0===o)o=1-f;else{if(o===c)return s?NaN:1/0*(l?-1:1);s+=Math.pow(2,n),o-=f}return(l?-1:1)*s*Math.pow(2,o-n)},t.write=function(e,t,r,n,i,o){var s,a,c,f=8*o-i-1,u=(1<<f)-1,h=u>>1,d=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,l=n?0:o-1,p=n?1:-1,b=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=u):(s=Math.floor(Math.log(t)/Math.LN2),t*(c=Math.pow(2,-s))<1&&(s--,c*=2),(t+=s+h>=1?d/c:d*Math.pow(2,1-h))*c>=2&&(s++,c/=2),s+h>=u?(a=0,s=u):s+h>=1?(a=(t*c-1)*Math.pow(2,i),s+=h):(a=t*Math.pow(2,h-1)*Math.pow(2,i),s=0));i>=8;e[r+l]=255&a,l+=p,a/=256,i-=8);for(s=s<<i|a,f+=i;f>0;e[r+l]=255&s,l+=p,s/=256,f-=8);e[r+l-p]|=128*b}},function(e,t){},function(e,t,r){"use strict";function n(e,t,r){e.copy(t,r)}var i=r(9).Buffer;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 i.alloc(0);if(1===this.length)return this.head.data;for(var t=i.allocUnsafe(e>>>0),r=this.head,o=0;r;)n(r.data,t,o),o+=r.data.length,r=r.next;return t},e}()},function(e,t,r){(function(e,t){!function(e,r){"use strict";function n(e){delete a[e]}function i(e){if(c)setTimeout(i,0,e);else{var t=a[e];if(t){c=!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{n(e),c=!1}}}}if(!e.setImmediate){var o,s=1,a={},c=!1,f=e.document,u=Object.getPrototypeOf&&Object.getPrototypeOf(e);u=u&&u.setTimeout?u:e,"[object process]"==={}.toString.call(e.process)?o=function(e){t.nextTick(function(){i(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)&&i(+r.data.slice(t.length))};e.addEventListener?e.addEventListener("message",r,!1):e.attachEvent("onmessage",r),o=function(r){e.postMessage(t+r,"*")}}():e.MessageChannel?function(){var e=new MessageChannel;e.port1.onmessage=function(e){i(e.data)},o=function(t){e.port2.postMessage(t)}}():f&&"onreadystatechange"in f.createElement("script")?function(){var e=f.documentElement;o=function(t){var r=f.createElement("script");r.onreadystatechange=function(){i(t),r.onreadystatechange=null,e.removeChild(r),r=null},e.appendChild(r)}}():o=function(e){setTimeout(i,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 n={callback:e,args:t};return a[s]=n,o(s),s++},u.clearImmediate=n}}("undefined"==typeof self?void 0===e?this:e:self)}).call(t,r(7),r(0))},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(t,r(7))},function(e,t,r){"use strict";function n(e){if(!(this instanceof n))return new n(e);i.call(this,e)}e.exports=n;var i=r(41),o=r(15);o.inherits=r(4),o.inherits(n,i),n.prototype._transform=function(e,t,r){r(null,e)}},function(e,t,r){"use strict";const n=r(78);e.exports=((e,t)=>n(e,(e,r,n)=>t(r,n)).then(()=>e))},function(e,t,r){"use strict";e.exports=((e,t,r)=>new Promise((n,i)=>{const o=e[Symbol.iterator]();let s=0;const a=e=>{const r=o.next();r.done?n(e):Promise.all([e,r.value]).then(e=>{a(t(e[0],e[1],s++))}).catch(i)};a(r)}))},function(e,t,r){"use strict";e.exports=class{constuctor(e){}append(e){}merge(e){}get(e){}has(e){}get values(){}get length(){}}},function(e,t,r){"use strict";r(24);const n=r(25),i=r(81),o=r(26),s=r(43),a=r(27),c=r(44),f=r(83),u=r(84),h=(e,t)=>e.slice(e.length-t,e.length);e.exports=class{static toMultihash(e,t){if(!a(e))throw s.ImmutableDBNotDefinedError();if(!a(t))throw s.LogNotDefinedError();if(t.values.length<1)throw new Error("Can't serialize an empty log");return e.object.put(t.toBuffer()).then(e=>e.toJSON().multihash)}static fromMultihash(e,t,r=-1,c,f){if(!a(e))throw s.ImmutableDBNotDefinedError();if(!a(t))throw new Error(`Invalid hash: ${t}`);return e.object.get(t,{enc:"base58"}).then(e=>JSON.parse(e.toJSON().data)).then(t=>{if(!t.heads||!t.id)throw s.NotALogError();return i.fetchAll(e,t.heads,r,c,null,f).then(e=>{const r=e.reduce((e,t)=>t.clock.time>e.time?new o(t.clock.id,t.clock.time):e,new o(t.id)),i=e.slice().sort(n.compare),s=i.filter(e=>t.heads.includes(e.hash));return{id:t.id,values:i,heads:s,clock:r}})})}static fromEntryHash(e,t,r,n=-1,o,c){if(!a(e))throw s.IpfsNotDefinedError();if(!a(t))throw new Error("'entryHash' must be defined");n=n>-1?Math.max(n,1):n;const f=o;return i.fetchParallel(e,[t],n,f,null,null,c).then(e=>({values:n>-1?h(e,n):e}))}static fromJSON(e,t,r=-1,o,c,f){if(!a(e))throw s.ImmutableDBNotDefinedError();return i.fetchParallel(e,t.heads.map(e=>e.hash),r,[],16,c,f).then(e=>{const r=e.slice().sort(n.compare);return e.filter(e=>t.heads.includes(e.hash)),{id:t.id,values:r,heads:t.heads}})}static fromEntry(e,t,r=-1,o,f,h,d){if(!a(e))throw s.ImmutableDBNotDefinedError();if(!a(t))throw new Error("'sourceEntries' must be defined");if(!Array.isArray(t)&&!n.isEntry(t))throw new Error("'sourceEntries' argument must be an array of Entry instances or a single Entry");Array.isArray(t)||(t=[t]),r=r>-1?Math.max(r,t.length):r;const l=o?o.map(e=>e.hash?e.hash:e):o,p=t.map(e=>e.hash);return i.fetchParallel(e,p,r,l,null,null,d).then(e=>{var i=t.concat(e),o=c(i,"hash").sort(n.compare);const s=o.slice(r>-1?-r:-o.length),a=((e,t)=>{var r=e.slice(t.length,e.length);return t.concat(r)})(s,u(s,t,"hash"));return{id:a[a.length-1].id,values:a}})}static expandFrom(e,t,r,n=-1){if(!a(e))throw s.ImmutableDBNotDefinedError();if(!a(t))throw s.LogNotDefinedError();if(!a(r))throw new Error("'entries' must be given as argument");Array.isArray(r)||(r=[r]);const o=r.map(e=>e.next).filter(e=>e.length>0);return 0===o.length?Promise.resolve({values:t.values}):i.fetchParallel(e,o,n,t.values).then(e=>({values:t.merge(e.slice(0,n))}))}static expand(e,t,r=-1){if(!a(e))throw s.ImmutableDBNotDefinedError();if(!a(t))throw s.LogNotDefinedError();return 0===t.tailHashes.length?Promise.resolve({values:t.values}):i.fetchParallel(e,t.tailHashes,r,t.values).then(e=>{const i=r>-1?t.values.length+r:-1,o=t.values.concat(e).sort(n.compare),s=i>-1?o.slice(-i):o.slice(),a=u(s,t.values,"hash").sort(n.compare),h=u(t.values,s,"hash").sort(n.compare),d=f(t.values,s,"hash").sort(n.compare),l=i-(d.length+a.length),p=(e,t)=>{var r=[];return r=e.concat(t),c(r,"hash").sort(n.compare)};return{values:p(a,p(d,l>-1?h.slice(-l):h))}})}}},function(e,t,r){"use strict";const n=r(82),i=r(24),o=r(25);let s=0,a=0;class c{static fetchParallel(e,t,r,n=[],o,s,a){const f=(e,t)=>e.concat(t);return i(t,t=>c.fetchAll(e,t,r,n,s,a),{concurrency:Math.max(o||t.length,1)}).then(e=>e.reduce(f,[]))}static fetchAll(e,t,r,i=[],c=null,f){let u=[],h={},d=Array.isArray(t)?t.slice():[t];const l=e=>d.push(e);i.forEach(e=>h[e.hash]=e);return n(()=>d.length>0&&(u.length<r||r<0),()=>{const t=d.shift();return h[t]?Promise.resolve():new Promise((r,n)=>{const i=c?setTimeout(()=>{console.warn(`Warning: Couldn't fetch entry '${t}', request timed out (${c}ms)`),r()},c):null;s++,o.fromMultihash(e,t).then(e=>{clearTimeout(i),o.isEntry(e)&&(e.next.forEach(l),u.push(e),h[t]=e,a++,f&&f(t,e,u.length))}).then(r).catch(e=>{r()})})}).then(()=>u)}}e.exports=c},function(e,t,r){"use strict";const n=e=>new Promise(t=>{t(e())});e.exports=((e,t)=>n(function r(){if(e())return n(t).then(r)}))},function(e,t,r){"use strict";e.exports=function(e,t,r){var n={},i={};return e.forEach(e=>i[r?e[r]:e]=!0),t.reduce((e,t)=>{var o=void 0!==i[r?t[r]:t],s=void 0!==n[r?t[r]:t];return o&&!s&&(e.push(t),n[r?t[r]:t]=!0),e},[])}},function(e,t,r){"use strict";e.exports=function(e,t,r){var n={},i={};return e.forEach(e=>i[r?e[r]:e]=!0),t.reduce((e,t)=>{var o=void 0!==i[r?t[r]:t],s=void 0!==n[r?t[r]:t];return o||s||(e.push(t),n[r?t[r]:t]=!0),e},[])}},function(e,t){e.exports={_from:"elliptic@^6.4.0",_id:"elliptic@6.4.0",_inBundle:!1,_integrity:"sha1-ysmvh2LIWDYYcAPI3+GT5eLq5d8=",_location:"/elliptic",_phantomChildren:{},_requested:{type:"range",registry:!0,raw:"elliptic@^6.4.0",name:"elliptic",escapedName:"elliptic",rawSpec:"^6.4.0",saveSpec:null,fetchSpec:"^6.4.0"},_requiredBy:["/browserify-sign","/create-ecdh","/orbit-db-keystore","/secp256k1"],_resolved:"https://registry.npmjs.org/elliptic/-/elliptic-6.4.0.tgz",_shasum:"cac9af8762c85836187003c8dfe193e5e2eae5df",_spec:"elliptic@^6.4.0",_where:"/Users/samuli/code/orbit-db/node_modules/orbit-db-keystore",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(8),o=r(11),s=r(47);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,c=1;c<a;c++)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=e.andln(3)+n&3,s=t.andln(3)+i&3;3===o&&(o=-1),3===s&&(s=-1);var a;a=0==(1&o)?0:3!=(f=e.andln(7)+n&7)&&5!==f||2!==s?o:-o,r[0].push(a);var c;if(0==(1&s))c=0;else{var f;c=3!=(f=t.andln(7)+i&7)&&5!==f||2!==o?s:-s}r[1].push(c),2*n===a+1&&(n=1-n),2*i===c+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){},function(e,t,r){function n(e){this.rand=e}var i;if(e.exports=function(e){return i||(i=new n(null)),i.generate(e)},e.exports.Rand=n,n.prototype.generate=function(e){return this._rand(e)},n.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?n.prototype._rand=function(e){var t=new Uint8Array(e);return self.crypto.getRandomValues(t),t}:self.msCrypto&&self.msCrypto.getRandomValues?n.prototype._rand=function(e){var t=new Uint8Array(e);return self.msCrypto.getRandomValues(t),t}:"object"==typeof window&&(n.prototype._rand=function(){throw new Error("Not implemented yet")});else try{var o=r(89);if("function"!=typeof o.randomBytes)throw new Error("Not supported");n.prototype._rand=function(e){return o.randomBytes(e)}}catch(e){}},function(e,t){},function(e,t,r){"use strict";function n(e,t){this.type=e,this.p=new o(t.p,16),this.red=t.prime?o.red(t.prime):o.mont(this.p),this.zero=new o(0).toRed(this.red),this.one=new o(1).toRed(this.red),this.two=new o(2).toRed(this.red),this.n=t.n&&new o(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 i(e,t){this.curve=e,this.type=t,this.precomputed=null}var o=r(8),s=r(3).utils,a=s.getNAF,c=s.getJSF,f=s.assert;e.exports=n,n.prototype.point=function(){throw new Error("Not implemented")},n.prototype.validate=function(){throw new Error("Not implemented")},n.prototype._fixedNafMul=function(e,t){f(e.precomputed);var r=e._getDoubles(),n=a(t,1),i=(1<<r.step+1)-(r.step%2==0?2:1);i/=3;for(var o=[],s=0;s<n.length;s+=r.step){var c=0;for(t=s+r.step-1;t>=s;t--)c=(c<<1)+n[t];o.push(c)}for(var u=this.jpoint(null,null,null),h=this.jpoint(null,null,null),d=i;d>0;d--){for(s=0;s<o.length;s++){(c=o[s])===d?h=h.mixedAdd(r.points[s]):c===-d&&(h=h.mixedAdd(r.points[s].neg()))}u=u.add(h)}return u.toP()},n.prototype._wnafMul=function(e,t){var r=4,n=e._getNAFPoints(r);r=n.wnd;for(var i=n.points,o=a(t,r),s=this.jpoint(null,null,null),c=o.length-1;c>=0;c--){for(t=0;c>=0&&0===o[c];c--)t++;if(c>=0&&t++,s=s.dblp(t),c<0)break;var u=o[c];f(0!==u),s="affine"===e.type?u>0?s.mixedAdd(i[u-1>>1]):s.mixedAdd(i[-u-1>>1].neg()):u>0?s.add(i[u-1>>1]):s.add(i[-u-1>>1].neg())}return"affine"===e.type?s.toP():s},n.prototype._wnafMulAdd=function(e,t,r,n,i){for(var o=this._wnafT1,s=this._wnafT2,f=this._wnafT3,u=0,h=0;h<n;h++){var d=(x=t[h])._getNAFPoints(e);o[h]=d.wnd,s[h]=d.points}for(h=n-1;h>=1;h-=2){var l=h-1,p=h;if(1===o[l]&&1===o[p]){var b=[t[l],null,null,t[p]];0===t[l].y.cmp(t[p].y)?(b[1]=t[l].add(t[p]),b[2]=t[l].toJ().mixedAdd(t[p].neg())):0===t[l].y.cmp(t[p].y.redNeg())?(b[1]=t[l].toJ().mixedAdd(t[p]),b[2]=t[l].add(t[p].neg())):(b[1]=t[l].toJ().mixedAdd(t[p]),b[2]=t[l].toJ().mixedAdd(t[p].neg()));var y=[-3,-1,-5,-7,0,7,5,1,3],g=c(r[l],r[p]);u=Math.max(g[0].length,u),f[l]=new Array(u),f[p]=new Array(u);for(var m=0;m<u;m++){var v=0|g[0][m],_=0|g[1][m];f[l][m]=y[3*(v+1)+(_+1)],f[p][m]=0,s[l]=b}}else f[l]=a(r[l],o[l]),f[p]=a(r[p],o[p]),u=Math.max(f[l].length,u),u=Math.max(f[p].length,u)}var w=this.jpoint(null,null,null),S=this._wnafT4;for(h=u;h>=0;h--){for(var k=0;h>=0;){var E=!0;for(m=0;m<n;m++)S[m]=0|f[m][h],0!==S[m]&&(E=!1);if(!E)break;k++,h--}if(h>=0&&k++,w=w.dblp(k),h<0)break;for(m=0;m<n;m++){var x,M=S[m];0!==M&&(M>0?x=s[m][M-1>>1]:M<0&&(x=s[m][-M-1>>1].neg()),w="affine"===x.type?w.mixedAdd(x):w.add(x))}}for(h=0;h<n;h++)s[h]=null;return i?w:w.toP()},n.BasePoint=i,i.prototype.eq=function(){throw new Error("Not implemented")},i.prototype.validate=function(){return this.curve.validate(this)},n.prototype.decodePoint=function(e,t){e=s.toArray(e,t);var r=this.p.byteLength();if((4===e[0]||6===e[0]||7===e[0])&&e.length-1==2*r){6===e[0]?f(e[e.length-1]%2==0):7===e[0]&&f(e[e.length-1]%2==1);return 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")},i.prototype.encodeCompressed=function(e){return this.encode(e,!0)},i.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))},i.prototype.encode=function(e,t){return s.encode(this._encode(t),e)},i.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},i.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)},i.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}},i.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}},i.prototype._getBeta=function(){return null},i.prototype.dblp=function(e){for(var t=this,r=0;r<e;r++)t=t.dbl();return t}},function(e,t,r){"use strict";function n(e){u.call(this,"short",e),this.a=new c(e.a,16).toRed(this.red),this.b=new c(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 i(e,t,r,n){u.BasePoint.call(this,e,"affine"),null===t&&null===r?(this.x=null,this.y=null,this.inf=!0):(this.x=new c(t,16),this.y=new c(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 o(e,t,r,n){u.BasePoint.call(this,e,"jacobian"),null===t&&null===r&&null===n?(this.x=this.curve.one,this.y=this.curve.one,this.z=new c(0)):(this.x=new c(t,16),this.y=new c(r,16),this.z=new c(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}var s=r(22),a=r(3),c=r(8),f=r(4),u=s.base,h=a.utils.assert;f(n,u),e.exports=n,n.prototype._getEndomorphism=function(e){if(this.zeroA&&this.g&&this.n&&1===this.p.modn(3)){var t,r;if(e.beta)t=new c(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 c(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],h(0===this.g.mul(r).x.cmp(this.g.x.redMul(t))))}var o;return o=e.basis?e.basis.map(function(e){return{a:new c(e.a,16),b:new c(e.b,16)}}):this._getEndoBasis(r),{beta:t,lambda:r,basis:o}}},n.prototype._getEndoRoots=function(e){var t=e===this.p?this.red:c.mont(e),r=new c(2).toRed(t).redInvm(),n=r.redNeg(),i=new c(3).toRed(t).redNeg().redSqrt().redMul(r);return[n.redAdd(i).fromRed(),n.redSub(i).fromRed()]},n.prototype._getEndoBasis=function(e){for(var t,r,n,i,o,s,a,f,u,h=this.n.ushrn(Math.floor(this.n.bitLength()/2)),d=e,l=this.n.clone(),p=new c(1),b=new c(0),y=new c(0),g=new c(1),m=0;0!==d.cmpn(0);){var v=l.div(d);f=l.sub(v.mul(d)),u=y.sub(v.mul(p));var _=g.sub(v.mul(b));if(!n&&f.cmp(h)<0)t=a.neg(),r=p,n=f.neg(),i=u;else if(n&&2==++m)break;a=f,l=d,d=f,y=p,p=u,g=b,b=_}o=f.neg(),s=u;var w=n.sqr().add(i.sqr());return o.sqr().add(s.sqr()).cmp(w)>=0&&(o=t,s=r),n.negative&&(n=n.neg(),i=i.neg()),o.negative&&(o=o.neg(),s=s.neg()),[{a:n,b:i},{a:o,b:s}]},n.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),c=i.mul(r.b),f=o.mul(n.b);return{k1:e.sub(s).sub(a),k2:c.add(f).neg()}},n.prototype.pointFromX=function(e,t){(e=new c(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)},n.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)},n.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],c=a._getBeta();s.k1.negative&&(s.k1.ineg(),a=a.neg(!0)),s.k2.negative&&(s.k2.ineg(),c=c.neg(!0)),n[2*o]=a,n[2*o+1]=c,i[2*o]=s.k1,i[2*o+1]=s.k2}for(var f=this._wnafMulAdd(1,n,i,2*o,r),u=0;u<2*o;u++)n[u]=null,i[u]=null;return f},f(i,u.BasePoint),n.prototype.point=function(e,t,r){return new i(this,e,t,r)},n.prototype.pointFromJSON=function(e,t){return i.fromJSON(this,e,t)},i.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}},i.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]},i.fromJSON=function(e,t,r){function n(t){return e.point(t[0],t[1],r)}"string"==typeof t&&(t=JSON.parse(t));var i=e.point(t[0],t[1],r);if(!t[2])return i;var o=t[2];return i.precomputed={beta:null,doubles:o.doubles&&{step:o.doubles.step,points:[i].concat(o.doubles.points.map(n))},naf:o.naf&&{wnd:o.naf.wnd,points:[i].concat(o.naf.points.map(n))}},i},i.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)+">"},i.prototype.isInfinity=function(){return this.inf},i.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)},i.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)},i.prototype.getX=function(){return this.x.fromRed()},i.prototype.getY=function(){return this.y.fromRed()},i.prototype.mul=function(e){return e=new c(e,16),this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve.endo?this.curve._endoWnafMulAdd([this],[e]):this.curve._wnafMul(this,e)},i.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)},i.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)},i.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))},i.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},i.prototype.toJ=function(){if(this.inf)return this.curve.jpoint(null,null,null);return this.curve.jpoint(this.x,this.y,this.curve.one)},f(o,u.BasePoint),n.prototype.jpoint=function(e,t,r){return new o(this,e,t,r)},o.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)},o.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},o.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),c=o.redSub(s);if(0===a.cmpn(0))return 0!==c.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var f=a.redSqr(),u=f.redMul(a),h=n.redMul(f),d=c.redSqr().redIAdd(u).redISub(h).redISub(h),l=c.redMul(h.redISub(d)).redISub(o.redMul(u)),p=this.z.redMul(e.z).redMul(a);return this.curve.jpoint(d,l,p)},o.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 c=s.redSqr(),f=c.redMul(s),u=r.redMul(c),h=a.redSqr().redIAdd(f).redISub(u).redISub(u),d=a.redMul(u.redISub(h)).redISub(i.redMul(f)),l=this.z.redMul(s);return this.curve.jpoint(h,d,l)},o.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,c=a.redSqr().redSqr(),f=s.redAdd(s);for(r=0;r<e;r++){var u=o.redSqr(),h=f.redSqr(),d=h.redSqr(),l=u.redAdd(u).redIAdd(u).redIAdd(n.redMul(c)),p=o.redMul(h),b=l.redSqr().redISub(p.redAdd(p)),y=p.redISub(b),g=l.redMul(y);g=g.redIAdd(g).redISub(d);var m=f.redMul(a);r+1<e&&(c=c.redMul(d)),o=b,a=m,f=g}return this.curve.jpoint(o,f.redMul(i),a)},o.prototype.dbl=function(){return this.isInfinity()?this:this.curve.zeroA?this._zeroDbl():this.curve.threeA?this._threeDbl():this._dbl()},o.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),c=a.redSqr().redISub(s).redISub(s),f=o.redIAdd(o);f=(f=f.redIAdd(f)).redIAdd(f),e=c,t=a.redMul(s.redISub(c)).redISub(f),r=this.y.redAdd(this.y)}else{var u=this.x.redSqr(),h=this.y.redSqr(),d=h.redSqr(),l=this.x.redAdd(h).redSqr().redISub(u).redISub(d);l=l.redIAdd(l);var p=u.redAdd(u).redIAdd(u),b=p.redSqr(),y=d.redIAdd(d);y=(y=y.redIAdd(y)).redIAdd(y),e=b.redISub(l).redISub(l),t=p.redMul(l.redISub(e)).redISub(y),r=(r=this.y.redMul(this.z)).redIAdd(r)}return this.curve.jpoint(e,t,r)},o.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),c=a.redSqr().redISub(s).redISub(s);e=c;var f=o.redIAdd(o);f=(f=f.redIAdd(f)).redIAdd(f),t=a.redMul(s.redISub(c)).redISub(f),r=this.y.redAdd(this.y)}else{var u=this.z.redSqr(),h=this.y.redSqr(),d=this.x.redMul(h),l=this.x.redSub(u).redMul(this.x.redAdd(u));l=l.redAdd(l).redIAdd(l);var p=d.redIAdd(d),b=(p=p.redIAdd(p)).redAdd(p);e=l.redSqr().redISub(b),r=this.y.redAdd(this.z).redSqr().redISub(h).redISub(u);var y=h.redSqr();y=(y=(y=y.redIAdd(y)).redIAdd(y)).redIAdd(y),t=l.redMul(p.redISub(e)).redISub(y)}return this.curve.jpoint(e,t,r)},o.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)),c=t.redAdd(t),f=(c=c.redIAdd(c)).redMul(s),u=a.redSqr().redISub(f.redAdd(f)),h=f.redISub(u),d=s.redSqr();d=(d=(d=d.redIAdd(d)).redIAdd(d)).redIAdd(d);var l=a.redMul(h).redISub(d),p=r.redAdd(r).redMul(n);return this.curve.jpoint(u,l,p)},o.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(),c=n.redIAdd(n);c=(c=(c=c.redIAdd(c)).redIAdd(c)).redIAdd(c);var f=i.redIAdd(s).redSqr().redISub(o).redISub(a).redISub(c),u=t.redMul(f);u=(u=u.redIAdd(u)).redIAdd(u);var h=this.x.redMul(a).redISub(u);h=(h=h.redIAdd(h)).redIAdd(h);var d=this.y.redMul(f.redMul(c.redISub(f)).redISub(s.redMul(a)));d=(d=(d=d.redIAdd(d)).redIAdd(d)).redIAdd(d);var l=this.z.redAdd(s).redSqr().redISub(r).redISub(a);return this.curve.jpoint(h,d,l)},o.prototype.mul=function(e,t){return e=new c(e,t),this.curve._wnafMul(this,e)},o.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)},o.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},o.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)+">"},o.prototype.isInfinity=function(){return 0===this.z.cmpn(0)}},function(e,t,r){"use strict";function n(e){c.call(this,"mont",e),this.a=new s(e.a,16).toRed(this.red),this.b=new s(e.b,16).toRed(this.red),this.i4=new s(4).toRed(this.red).redInvm(),this.two=new s(2).toRed(this.red),this.a24=this.i4.redMul(this.a.redAdd(this.two))}function i(e,t,r){c.BasePoint.call(this,e,"projective"),null===t&&null===r?(this.x=this.curve.one,this.z=this.curve.zero):(this.x=new s(t,16),this.z=new s(r,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)))}var o=r(22),s=r(8),a=r(4),c=o.base,f=r(3).utils;a(n,c),e.exports=n,n.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)},a(i,c.BasePoint),n.prototype.decodePoint=function(e,t){return this.point(f.toArray(e,t),1)},n.prototype.point=function(e,t){return new i(this,e,t)},n.prototype.pointFromJSON=function(e){return i.fromJSON(this,e)},i.prototype.precompute=function(){},i.prototype._encode=function(){return this.getX().toArray("be",this.curve.p.byteLength())},i.fromJSON=function(e,t){return new i(e,t[0],t[1]||e.one)},i.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)+">"},i.prototype.isInfinity=function(){return 0===this.z.cmpn(0)},i.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)},i.prototype.add=function(){throw new Error("Not supported on Montgomery curve")},i.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()),c=t.x.redMul(o.redISub(s).redSqr());return this.curve.point(a,c)},i.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},i.prototype.mulAdd=function(){throw new Error("Not supported on Montgomery curve")},i.prototype.jumlAdd=function(){throw new Error("Not supported on Montgomery curve")},i.prototype.eq=function(e){return 0===this.getX().cmp(e.getX())},i.prototype.normalize=function(){return this.x=this.x.redMul(this.z.redInvm()),this.z=this.curve.one,this},i.prototype.getX=function(){return this.normalize(),this.x.fromRed()}},function(e,t,r){"use strict";function n(e){this.twisted=1!=(0|e.a),this.mOneA=this.twisted&&-1==(0|e.a),this.extended=this.mOneA,f.call(this,"edwards",e),this.a=new a(e.a,16).umod(this.red.m),this.a=this.a.toRed(this.red),this.c=new a(e.c,16).toRed(this.red),this.c2=this.c.redSqr(),this.d=new a(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 i(e,t,r,n,i){f.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 a(t,16),this.y=new a(r,16),this.z=n?new a(n,16):this.curve.one,this.t=i&&new a(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()))))}var o=r(22),s=r(3),a=r(8),c=r(4),f=o.base,u=s.utils.assert;c(n,f),e.exports=n,n.prototype._mulA=function(e){return this.mOneA?e.redNeg():this.a.redMul(e)},n.prototype._mulC=function(e){return this.oneC?e:this.c.redMul(e)},n.prototype.jpoint=function(e,t,r,n){return this.point(e,t,r,n)},n.prototype.pointFromX=function(e,t){(e=new a(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)),o=n.redMul(i.redInvm()),s=o.redSqrt();if(0!==s.redSqr().redSub(o).cmp(this.zero))throw new Error("invalid point");var c=s.fromRed().isOdd();return(t&&!c||!t&&c)&&(s=s.redNeg()),this.point(e,s)},n.prototype.pointFromY=function(e,t){(e=new a(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),o=n.redMul(i.redInvm());if(0===o.cmp(this.zero)){if(t)throw new Error("invalid point");return this.point(this.zero,e)}var s=o.redSqrt();if(0!==s.redSqr().redSub(o).cmp(this.zero))throw new Error("invalid point");return s.isOdd()!==t&&(s=s.redNeg()),this.point(s,e)},n.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)},c(i,f.BasePoint),n.prototype.pointFromJSON=function(e){return i.fromJSON(this,e)},n.prototype.point=function(e,t,r,n){return new i(this,e,t,r,n)},i.fromJSON=function(e,t){return new i(e,t[0],t[1],t[2])},i.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)+">"},i.prototype.isInfinity=function(){return 0===this.x.cmpn(0)&&0===this.y.cmp(this.z)},i.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),c=i.redMul(s),f=o.redMul(a),u=i.redMul(a),h=s.redMul(o);return this.curve.point(c,f,h,u)},i.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=(f=this.curve._mulA(i)).redAdd(o);if(this.zOne)e=n.redSub(i).redSub(o).redMul(s.redSub(this.curve.two)),t=s.redMul(f.redSub(o)),r=s.redSqr().redSub(s).redSub(s);else{var a=this.z.redSqr(),c=s.redSub(a).redISub(a);e=n.redSub(i).redISub(o).redMul(c),t=s.redMul(f.redSub(o)),r=s.redMul(c)}}else{var f=i.redAdd(o);a=this.curve._mulC(this.c.redMul(this.z)).redSqr(),c=f.redSub(a).redSub(a);e=this.curve._mulC(n.redISub(f)).redMul(c),t=this.curve._mulC(f).redMul(i.redISub(o)),r=f.redMul(c)}return this.curve.point(e,t,r)},i.prototype.dbl=function(){return this.isInfinity()?this:this.curve.extended?this._extDbl():this._projDbl()},i.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),c=r.redAdd(t),f=o.redMul(s),u=a.redMul(c),h=o.redMul(c),d=s.redMul(a);return this.curve.point(f,u,d,h)},i.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),c=i.redSub(a),f=i.redAdd(a),u=this.x.redAdd(this.y).redMul(e.x.redAdd(e.y)).redISub(o).redISub(s),h=n.redMul(c).redMul(u);return this.curve.twisted?(t=n.redMul(f).redMul(s.redSub(this.curve._mulA(o))),r=c.redMul(f)):(t=n.redMul(f).redMul(s.redSub(o)),r=this.curve._mulC(c).redMul(f)),this.curve.point(h,t,r)},i.prototype.add=function(e){return this.isInfinity()?e:e.isInfinity()?this:this.curve.extended?this._extAdd(e):this._projAdd(e)},i.prototype.mul=function(e){return this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve._wnafMul(this,e)},i.prototype.mulAdd=function(e,t,r){return this.curve._wnafMulAdd(1,[this,t],[e,r],2,!1)},i.prototype.jmulAdd=function(e,t,r){return this.curve._wnafMulAdd(1,[this,t],[e,r],2,!0)},i.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},i.prototype.neg=function(){return this.curve.point(this.x.redNeg(),this.y,this.z,this.t&&this.t.redNeg())},i.prototype.getX=function(){return this.normalize(),this.x.fromRed()},i.prototype.getY=function(){return this.normalize(),this.y.fromRed()},i.prototype.eq=function(e){return this===e||0===this.getX().cmp(e.getX())&&0===this.getY().cmp(e.getY())},i.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},i.prototype.toP=i.prototype.normalize,i.prototype.mixedAdd=i.prototype.add},function(e,t,r){"use strict";function n(e){"short"===e.type?this.curve=new a.curve.short(e):"edwards"===e.type?this.curve=new a.curve.edwards(e):this.curve=new a.curve.mont(e),this.g=this.curve.g,this.n=this.curve.n,this.hash=e.hash,c(this.g.validate(),"Invalid curve"),c(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}function i(e,t){Object.defineProperty(o,e,{configurable:!0,enumerable:!0,get:function(){var r=new n(t);return Object.defineProperty(o,e,{configurable:!0,enumerable:!0,value:r}),r}})}var o=t,s=r(28),a=r(3),c=a.utils.assert;o.PresetCurve=n,i("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:s.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),i("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:s.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),i("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:s.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),i("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:s.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"]}),i("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:s.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"]}),i("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:s.sha256,gRed:!1,g:["9"]}),i("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:s.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});var f;try{f=r(101)}catch(e){f=void 0}i("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:s.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",f]})},function(e,t,r){"use strict";t.sha1=r(96),t.sha224=r(97),t.sha256=r(49),t.sha384=r(98),t.sha512=r(50)},function(e,t,r){"use strict";function n(){if(!(this instanceof n))return new n;h.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.W=new Array(80)}var i=r(5),o=r(16),s=r(48),a=i.rotl32,c=i.sum32,f=i.sum32_5,u=s.ft_1,h=o.BlockHash,d=[1518500249,1859775393,2400959708,3395469782];i.inherits(n,h),e.exports=n,n.blockSize=512,n.outSize=160,n.hmacStrength=80,n.padLength=64,n.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],h=this.h[3],l=this.h[4];for(n=0;n<r.length;n++){var p=~~(n/20),b=f(a(i,5),u(p,o,s,h),l,r[n],d[p]);l=h,h=s,s=a(o,30),o=i,i=b}this.h[0]=c(this.h[0],i),this.h[1]=c(this.h[1],o),this.h[2]=c(this.h[2],s),this.h[3]=c(this.h[3],h),this.h[4]=c(this.h[4],l)},n.prototype._digest=function(e){return"hex"===e?i.toHex32(this.h,"big"):i.split32(this.h,"big")}},function(e,t,r){"use strict";function n(){if(!(this instanceof n))return new n;o.call(this),this.h=[3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428]}var i=r(5),o=r(49);i.inherits(n,o),e.exports=n,n.blockSize=512,n.outSize=224,n.hmacStrength=192,n.padLength=64,n.prototype._digest=function(e){return"hex"===e?i.toHex32(this.h.slice(0,7),"big"):i.split32(this.h.slice(0,7),"big")}},function(e,t,r){"use strict";function n(){if(!(this instanceof n))return new n;o.call(this),this.h=[3418070365,3238371032,1654270250,914150663,2438529370,812702999,355462360,4144912697,1731405415,4290775857,2394180231,1750603025,3675008525,1694076839,1203062813,3204075428]}var i=r(5),o=r(50);i.inherits(n,o),e.exports=n,n.blockSize=1024,n.outSize=384,n.hmacStrength=192,n.padLength=128,n.prototype._digest=function(e){return"hex"===e?i.toHex32(this.h.slice(0,12),"big"):i.split32(this.h.slice(0,12),"big")}},function(e,t,r){"use strict";function n(){if(!(this instanceof n))return new n;h.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.endian="little"}function i(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)}var o=r(5),s=r(16),a=o.rotl32,c=o.sum32,f=o.sum32_3,u=o.sum32_4,h=s.BlockHash;o.inherits(n,h),t.ripemd160=n,n.blockSize=512,n.outSize=160,n.hmacStrength=192,n.padLength=64,n.prototype._update=function(e,t){for(var r=this.h[0],n=this.h[1],o=this.h[2],s=this.h[3],h=this.h[4],y=r,g=n,m=o,v=s,_=h,w=0;w<80;w++){var S=c(a(u(r,i(w,n,o,s),e[d[w]+t],function(e){return e<=15?0:e<=31?1518500249:e<=47?1859775393:e<=63?2400959708:2840853838}(w)),p[w]),h);r=h,h=s,s=a(o,10),o=n,n=S,S=c(a(u(y,i(79-w,g,m,v),e[l[w]+t],function(e){return e<=15?1352829926:e<=31?1548603684:e<=47?1836072691:e<=63?2053994217:0}(w)),b[w]),_),y=_,_=v,v=a(m,10),m=g,g=S}S=f(this.h[1],o,v),this.h[1]=f(this.h[2],s,_),this.h[2]=f(this.h[3],h,y),this.h[3]=f(this.h[4],r,g),this.h[4]=f(this.h[0],n,m),this.h[0]=S},n.prototype._digest=function(e){return"hex"===e?o.toHex32(this.h,"little"):o.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],l=[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],p=[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],b=[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";function n(e,t,r){if(!(this instanceof n))return new n(e,t,r);this.Hash=e,this.blockSize=e.blockSize/8,this.outSize=e.outSize/8,this.inner=null,this.outer=null,this._init(i.toArray(t,r))}var i=r(5),o=r(11);e.exports=n,n.prototype._init=function(e){e.length>this.blockSize&&(e=(new this.Hash).update(e).digest()),o(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)},n.prototype.update=function(e,t){return this.inner.update(e,t),this},n.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";function n(e){if(!(this instanceof n))return new n(e);"string"==typeof e&&(a(s.curves.hasOwnProperty(e),"Unknown curve "+e),e=s.curves[e]),e instanceof s.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}var i=r(8),o=r(103),s=r(3),a=s.utils.assert,c=r(104),f=r(105);e.exports=n,n.prototype.keyPair=function(e){return new c(this,e)},n.prototype.keyFromPrivate=function(e,t){return c.fromPrivate(this,e,t)},n.prototype.keyFromPublic=function(e,t){return c.fromPublic(this,e,t)},n.prototype.genKeyPair=function(e){e||(e={});for(var t=new o({hash:this.hash,pers:e.pers,persEnc:e.persEnc||"utf8",entropy:e.entropy||s.rand(this.hash.hmacStrength),entropyEnc:e.entropy&&e.entropyEnc||"utf8",nonce:this.n.toArray()}),r=this.n.byteLength(),n=this.n.sub(new i(2));;){var a=new i(t.generate(r));if(!(a.cmp(n)>0))return a.iaddn(1),this.keyFromPrivate(a)}},n.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},n.prototype.sign=function(e,t,r,n){"object"==typeof r&&(n=r,r=null),n||(n={}),t=this.keyFromPrivate(t,r),e=this._truncateToN(new i(e,16));for(var s=this.n.byteLength(),a=t.getPrivate().toArray("be",s),c=e.toArray("be",s),u=new o({hash:this.hash,entropy:a,nonce:c,pers:n.pers,persEnc:n.persEnc||"utf8"}),h=this.n.sub(new i(1)),d=0;;d++){var l=n.k?n.k(d):new i(u.generate(this.n.byteLength()));if(!((l=this._truncateToN(l,!0)).cmpn(1)<=0||l.cmp(h)>=0)){var p=this.g.mul(l);if(!p.isInfinity()){var b=p.getX(),y=b.umod(this.n);if(0!==y.cmpn(0)){var g=l.invm(this.n).mul(y.mul(t.getPrivate()).iadd(e));if(0!==(g=g.umod(this.n)).cmpn(0)){var m=(p.getY().isOdd()?1:0)|(0!==b.cmp(y)?2:0);return n.canonical&&g.cmp(this.nh)>0&&(g=this.n.sub(g),m^=1),new f({r:y,s:g,recoveryParam:m})}}}}}},n.prototype.verify=function(e,t,r,n){e=this._truncateToN(new i(e,16)),r=this.keyFromPublic(r,n);var o=(t=new f(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=s.invm(this.n),c=a.mul(e).umod(this.n),u=a.mul(o).umod(this.n);if(!this.curve._maxwellTrick){return!(h=this.g.mulAdd(c,r.getPublic(),u)).isInfinity()&&0===h.getX().umod(this.n).cmp(o)}var h;return!(h=this.g.jmulAdd(c,r.getPublic(),u)).isInfinity()&&h.eqXToP(o)},n.prototype.recoverPubKey=function(e,t,r,n){a((3&r)===r,"The recovery param is more than two bits"),t=new f(t,n);var o=this.n,s=new i(e),c=t.r,u=t.s,h=1&r,d=r>>1;if(c.cmp(this.curve.p.umod(this.curve.n))>=0&&d)throw new Error("Unable to find sencond key candinate");c=d?this.curve.pointFromX(c.add(this.curve.n),h):this.curve.pointFromX(c,h);var l=t.r.invm(o),p=o.sub(s).mul(l).umod(o),b=u.mul(l).umod(o);return this.g.mulAdd(p,c,b)},n.prototype.getKeyRecoveryParam=function(e,t,r,n){if(null!==(t=new f(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";function n(e){if(!(this instanceof n))return new n(e);this.hash=e.hash,this.predResist=!!e.predResist,this.outLen=this.hash.outSize,this.minEntropy=e.minEntropy||this.hash.hmacStrength,this._reseed=null,this.reseedInterval=null,this.K=null,this.V=null;var t=o.toArray(e.entropy,e.entropyEnc||"hex"),r=o.toArray(e.nonce,e.nonceEnc||"hex"),i=o.toArray(e.pers,e.persEnc||"hex");s(t.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(t,r,i)}var i=r(28),o=r(47),s=r(11);e.exports=n,n.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},n.prototype._hmac=function(){return new i.hmac(this.hash,this.K)},n.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())},n.prototype.reseed=function(e,t,r,n){"string"!=typeof t&&(n=r,r=t,t=null),e=o.toArray(e,t),r=o.toArray(r,n),s(e.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(e.concat(r||[])),this._reseed=1},n.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=o.toArray(r,n||"hex"),this._update(r));for(var i=[];i.length<e;)this.V=this._hmac().update(this.V).digest(),i=i.concat(this.V);var s=i.slice(0,e);return this._update(r),this._reseed++,o.encode(s,t)}},function(e,t,r){"use strict";function n(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)}var i=r(8),o=r(3).utils.assert;e.exports=n,n.fromPublic=function(e,t,r){return t instanceof n?t:new n(e,{pub:t,pubEnc:r})},n.fromPrivate=function(e,t,r){return t instanceof n?t:new n(e,{priv:t,privEnc:r})},n.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"}},n.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},n.prototype.getPrivate=function(e){return"hex"===e?this.priv.toString(16,2):this.priv},n.prototype._importPrivate=function(e,t){this.priv=new i(e,t||16),this.priv=this.priv.umod(this.ec.curve.n)},n.prototype._importPublic=function(e,t){if(e.x||e.y)return"mont"===this.ec.curve.type?o(e.x,"Need x coordinate"):"short"!==this.ec.curve.type&&"edwards"!==this.ec.curve.type||o(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)},n.prototype.derive=function(e){return e.mul(this.priv).getX()},n.prototype.sign=function(e,t,r){return this.ec.sign(e,this,t,r)},n.prototype.verify=function(e,t){return this.ec.verify(e,t,this)},n.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";function n(e,t){if(e instanceof n)return e;this._importDER(e,t)||(f(e.r&&e.s,"Signature without r or s"),this.r=new a(e.r,16),this.s=new a(e.s,16),void 0===e.recoveryParam?this.recoveryParam=null:this.recoveryParam=e.recoveryParam)}function i(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 o(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 s(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)}}var a=r(8),c=r(3).utils,f=c.assert;e.exports=n,n.prototype._importDER=function(e,t){e=c.toArray(e,t);var r=new function(){this.place=0};if(48!==e[r.place++])return!1;if(i(e,r)+r.place!==e.length)return!1;if(2!==e[r.place++])return!1;var n=i(e,r),o=e.slice(r.place,n+r.place);if(r.place+=n,2!==e[r.place++])return!1;var s=i(e,r);if(e.length!==s+r.place)return!1;var f=e.slice(r.place,s+r.place);return 0===o[0]&&128&o[1]&&(o=o.slice(1)),0===f[0]&&128&f[1]&&(f=f.slice(1)),this.r=new a(o),this.s=new a(f),this.recoveryParam=null,!0},n.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=o(t),r=o(r);!(r[0]||128&r[1]);)r=r.slice(1);var n=[2];s(n,t.length),(n=n.concat(t)).push(2),s(n,r.length);var i=n.concat(r),a=[48];return s(a,i.length),a=a.concat(i),c.encode(a,e)}},function(e,t,r){"use strict";function n(e){if(a("ed25519"===e,"only tested with ed25519 so far"),!(this instanceof n))return new n(e);e=o.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=i.sha512}var i=r(28),o=r(3),s=o.utils,a=s.assert,c=s.parseBytes,f=r(107),u=r(108);e.exports=n,n.prototype.sign=function(e,t){e=c(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()),a=n.add(s).umod(this.curve.n);return this.makeSignature({R:i,S:a,Rencoded:o})},n.prototype.verify=function(e,t,r){e=c(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)},n.prototype.hashInt=function(){for(var e=this.hash(),t=0;t<arguments.length;t++)e.update(arguments[t]);return s.intFromLE(e.digest()).umod(this.curve.n)},n.prototype.keyFromPublic=function(e){return f.fromPublic(this,e)},n.prototype.keyFromSecret=function(e){return f.fromSecret(this,e)},n.prototype.makeSignature=function(e){return e instanceof u?e:new u(this,e)},n.prototype.encodePoint=function(e){var t=e.getY().toArray("le",this.encodingLength);return t[this.encodingLength-1]|=e.getX().isOdd()?128:0,t},n.prototype.decodePoint=function(e){var t=(e=s.parseBytes(e)).length-1,r=e.slice(0,t).concat(-129&e[t]),n=0!=(128&e[t]),i=s.intFromLE(r);return this.curve.pointFromY(i,n)},n.prototype.encodeInt=function(e){return e.toArray("le",this.encodingLength)},n.prototype.decodeInt=function(e){return s.intFromLE(e)},n.prototype.isPoint=function(e){return e instanceof this.pointClass}},function(e,t,r){"use strict";function n(e,t){this.eddsa=e,this._secret=s(t.secret),e.isPoint(t.pub)?this._pub=t.pub:this._pubBytes=s(t.pub)}var i=r(3).utils,o=i.assert,s=i.parseBytes,a=i.cachedProperty;n.fromPublic=function(e,t){return t instanceof n?t:new n(e,{pub:t})},n.fromSecret=function(e,t){return t instanceof n?t:new n(e,{secret:t})},n.prototype.secret=function(){return this._secret},a(n,"pubBytes",function(){return this.eddsa.encodePoint(this.pub())}),a(n,"pub",function(){return this._pubBytes?this.eddsa.decodePoint(this._pubBytes):this.eddsa.g.mul(this.priv())}),a(n,"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}),a(n,"priv",function(){return this.eddsa.decodeInt(this.privBytes())}),a(n,"hash",function(){return this.eddsa.hash().update(this.secret()).digest()}),a(n,"messagePrefix",function(){return this.hash().slice(this.eddsa.encodingLength)}),n.prototype.sign=function(e){return o(this._secret,"KeyPair can only verify"),this.eddsa.sign(e,this)},n.prototype.verify=function(e,t){return this.eddsa.verify(e,t,this)},n.prototype.getSecret=function(e){return o(this._secret,"KeyPair is public only"),i.encode(this.secret(),e)},n.prototype.getPublic=function(e){return i.encode(this.pubBytes(),e)},e.exports=n},function(e,t,r){"use strict";function n(e,t){this.eddsa=e,"object"!=typeof t&&(t=c(t)),Array.isArray(t)&&(t={R:t.slice(0,e.encodingLength),S:t.slice(e.encodingLength)}),s(t.R&&t.S,"Signature without R or S"),e.isPoint(t.R)&&(this._R=t.R),t.S instanceof i&&(this._S=t.S),this._Rencoded=Array.isArray(t.R)?t.R:t.Rencoded,this._Sencoded=Array.isArray(t.S)?t.S:t.Sencoded}var i=r(8),o=r(3).utils,s=o.assert,a=o.cachedProperty,c=o.parseBytes;a(n,"S",function(){return this.eddsa.decodeInt(this.Sencoded())}),a(n,"R",function(){return this.eddsa.decodePoint(this.Rencoded())}),a(n,"Rencoded",function(){return this.eddsa.encodePoint(this.R())}),a(n,"Sencoded",function(){return this.eddsa.encodeInt(this.S())}),n.prototype.toBytes=function(){return this.Rencoded().concat(this.Sencoded())},n.prototype.toHex=function(){return o.encode(this.toBytes(),"hex").toUpperCase()},e.exports=n},function(e,t,r){(function(e){(function(){var n,i,o,s,a,c,f,u,h,d,l,p,b,y,g=function(e,t){function r(){this.constructor=e}for(var n in t)m.call(t,n)&&(e[n]=t[n]);return r.prototype=t.prototype,e.prototype=new r,e.__super__=t.prototype,e},m={}.hasOwnProperty;b=r(12),p=r(14),l=r(2),y=r(110).sync,i="---.EMPTY_STRING.---",f=function(e){var t,r,n,i,o;for(o=[],t=0,r=(i=p.readdirSync(e)).length;t<r;t++)n=i[t],o.push(h(b.join(e,n)));return o},h=function(e){return p.statSync(e).isDirectory()?(f(e),p.rmdirSync(e)):p.unlinkSync(e)},u=function(e){return""===e?i:e.toString()},a=function(e){function t(e){this.message=null!=e?e:"Unknown error.",null!=Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}return g(t,e),t.prototype.toString=function(){return this.name+": "+this.message},t}(Error),c=function(){return function(e,t,r,n,i){this.key=e,this.oldValue=t,this.newValue=r,this.url=n,this.storageArea=null!=i?i:"localStorage"}}(),s=function(){function e(t,r){if(this.key=t,this.index=r,!(this instanceof e))return new e(this.key,this.index)}return e}(),d=function(){var e;return e=function(){},e.prototype=Object.create(null),new e},o=function(t){function r(t,i){return this._location=t,this.quota=null!=i?i:5242880,this instanceof r?(this._location=b.resolve(this._location),null!=n[this._location]?n[this._location]:(this.length=0,this._bytesInUse=0,this._keys=[],this._metaKeyMap=d(),this._eventUrl="pid:"+e.pid,this._init(),this._QUOTA_EXCEEDED_ERR=a,n[this._location]=this,n[this._location])):new r(this._location,this.quota)}var n;return g(r,t),n={},r.prototype._init=function(){var e,t,r,n,i,o,a,c;try{if(null!=(c=p.statSync(this._location))&&!c.isDirectory())throw new Error("A file exists at the location '"+this._location+"' when trying to create/open localStorage");for(this._bytesInUse=0,this.length=0,i=n=0,a=(r=p.readdirSync(this._location)).length;n<a;i=++n)o=r[i],t=decodeURIComponent(o),this._keys.push(t),e=new s(o,i),this._metaKeyMap[t]=e,null!=(null!=(c=this._getStat(o))?c.size:void 0)&&(e.size=c.size,this._bytesInUse+=c.size);this.length=r.length}catch(e){p.mkdirSync(this._location)}},r.prototype.setItem=function(e,t){var r,n,i,o,f,h,d,p,g,m;if(f=l.EventEmitter.listenerCount(this,"storage"),p=null,f&&(p=this.getItem(e)),e=u(e),r=encodeURIComponent(e),o=b.join(this._location,r),g=t.toString(),m=g.length,h=this._metaKeyMap[e],i=!!h,d=i?h.size:0,this._bytesInUse-d+m>this.quota)throw new a;if(y(o,g,"utf8"),i||((h=new s(r,this._keys.push(e)-1)).size=m,this._metaKeyMap[e]=h,this.length+=1,this._bytesInUse+=m),f)return n=new c(e,p,t,this._eventUrl),this.emit("storage",n)},r.prototype.getItem=function(e){var t,r;return e=u(e),(r=this._metaKeyMap[e])?(t=b.join(this._location,r.key),p.readFileSync(t,"utf8")):null},r.prototype._getStat=function(e){var t;e=u(e),t=b.join(this._location,encodeURIComponent(e));try{return p.statSync(t)}catch(e){return null}},r.prototype.removeItem=function(e){var t,r,n,i,o,s,a,f;if(e=u(e),s=this._metaKeyMap[e]){a=null,(n=l.EventEmitter.listenerCount(this,"storage"))&&(a=this.getItem(e)),delete this._metaKeyMap[e],this.length-=1,this._bytesInUse-=s.size,r=b.join(this._location,s.key),this._keys.splice(s.index,1),f=this._metaKeyMap;for(i in f)f[i],(o=this._metaKeyMap[i]).index>s.index&&(o.index-=1);if(h(r),n)return t=new c(e,a,null,this._eventUrl),this.emit("storage",t)}},r.prototype.key=function(e){return this._keys[e]},r.prototype.clear=function(){var e;if(f(this._location),this._metaKeyMap=d(),this._keys=[],this.length=0,this._bytesInUse=0,l.EventEmitter.listenerCount(this,"storage"))return e=new c(null,null,null,this._eventUrl),this.emit("storage",e)},r.prototype._getBytesInUse=function(){return this._bytesInUse},r.prototype._deleteLocation=function(){return delete n[this._location],h(this._location),this._metaKeyMap={},this._keys=[],this.length=0,this._bytesInUse=0},r}(l.EventEmitter),n=function(e){function t(){return t.__super__.constructor.apply(this,arguments)}return g(t,o),t.prototype.setItem=function(e,r){var n;return n=JSON.stringify(r),t.__super__.setItem.call(this,e,n)},t.prototype.getItem=function(e){return JSON.parse(t.__super__.getItem.call(this,e))},t}(),t.LocalStorage=o,t.JSONStorage=n,t.QUOTA_EXCEEDED_ERR=a}).call(this)}).call(t,r(0))},function(e,t,r){"use strict";(function(t,n,i){function o(e){return e+"."+c(t).hash(String(n.pid)).hash(String(++u)).result()}e.exports=function(e,t,r,c){r instanceof Function&&(c=r,r=null),r||(r={}),s.realpath(e,function(u,h){!function(e,t,r,c){function u(){a([[h,d,t,r.mode,r.encoding||"utf8"],r.chown&&[s,s.chown,d,r.chown.uid,r.chown.gid],r.mode&&[s,s.chmod,d,r.mode],[s,s.rename,d,e]],function(e){e?s.unlink(d,function(){c(e)}):c()})}function h(e,t,n,o,a){s.open(e,"w",r.mode,function(e,r){function n(e){if(e)return a(e);s.fsync(r,function(e){if(e)return a(e);s.close(r,a)})}return e?a(e):i.isBuffer(t)?s.write(r,t,0,t.length,0,n):null!=t?s.write(r,String(t),0,String(o),n):n()})}var d=o(e);r.mode&&r.chown?u():s.stat(e,function(e,t){return e||!t?u():((r=f({},r)).mode||(r.mode=t.mode),!r.chown&&n.getuid&&(r.chown={uid:t.uid,gid:t.gid}),u())})}(h||e,t,r,c)})},e.exports.sync=function(e,t,r){r||(r={});try{e=s.realpathSync(e)}catch(e){}var a=o(e);try{if(!r.mode||!r.chown)try{var c=s.statSync(e);(r=f({},r)).mode||(r.mode=c.mode),!r.chown&&n.getuid&&(r.chown={uid:c.uid,gid:c.gid})}catch(e){}var u=s.openSync(a,"w",r.mode);i.isBuffer(t)?s.writeSync(u,t,0,t.length,0):null!=t&&s.writeSync(u,String(t),0,String(r.encoding||"utf8")),s.fsyncSync(u),s.closeSync(u),r.chown&&s.chownSync(a,r.chown.uid,r.chown.gid),r.mode&&s.chmodSync(a,r.mode),s.renameSync(a,e)}catch(e){try{s.unlinkSync(a)}catch(e){}throw e}},e.exports._getTmpname=o;var s=r(111),a=r(122).chain,c=r(125),f=Object.assign||r(6)._extend,u=0}).call(t,"/index.js",r(0),r(1).Buffer)},function(e,t,r){(function(t){function n(e){function r(t){return p.apply(e,t)}function s(e,t){return this instanceof s?(y.apply(this,arguments),this):s.apply(Object.create(s.prototype),arguments)}function f(e,t){return this instanceof f?(g.apply(this,arguments),this):f.apply(Object.create(f.prototype),arguments)}function u(e,t,r,n){function s(e,t,r,n){return m(e,t,r,function(a,c){!a||"EMFILE"!==a.code&&"ENFILE"!==a.code?("function"==typeof n&&n.apply(this,arguments),o()):i([s,[e,t,r,n]])})}return"function"==typeof r&&(n=r,r=null),s(e,t,r,n)}a(e),e.gracefulify=n,e.FileReadStream=s,e.FileWriteStream=f,e.createReadStream=function(e,t){return new s(e,t)},e.createWriteStream=function(e,t){return new f(e,t)};var h=e.readFile;e.readFile=function(e,t,r){function n(e,t,r){return h(e,t,function(s){!s||"EMFILE"!==s.code&&"ENFILE"!==s.code?("function"==typeof r&&r.apply(this,arguments),o()):i([n,[e,t,r]])})}return"function"==typeof t&&(r=t,t=null),n(e,t,r)};var d=e.writeFile;e.writeFile=function(e,t,r,n){function s(e,t,r,n){return d(e,t,r,function(a){!a||"EMFILE"!==a.code&&"ENFILE"!==a.code?("function"==typeof n&&n.apply(this,arguments),o()):i([s,[e,t,r,n]])})}return"function"==typeof r&&(n=r,r=null),s(e,t,r,n)};var l=e.appendFile;l&&(e.appendFile=function(e,t,r,n){function s(e,t,r,n){return l(e,t,r,function(a){!a||"EMFILE"!==a.code&&"ENFILE"!==a.code?("function"==typeof n&&n.apply(this,arguments),o()):i([s,[e,t,r,n]])})}return"function"==typeof r&&(n=r,r=null),s(e,t,r,n)});var p=e.readdir;if(e.readdir=function(e,t,n){var s=[e];return"function"!=typeof t?s.push(t):n=t,s.push(function(e,t){t&&t.sort&&t.sort(),!e||"EMFILE"!==e.code&&"ENFILE"!==e.code?("function"==typeof n&&n.apply(this,arguments),o()):i([r,[s]])}),r(s)},"v0.8"===t.version.substr(0,4)){var b=c(e);s=b.ReadStream,f=b.WriteStream}var y=e.ReadStream;(s.prototype=Object.create(y.prototype)).open=function(){var e=this;u(e.path,e.flags,e.mode,function(t,r){t?(e.autoClose&&e.destroy(),e.emit("error",t)):(e.fd=r,e.emit("open",r),e.read())})};var g=e.WriteStream;(f.prototype=Object.create(g.prototype)).open=function(){var e=this;u(e.path,e.flags,e.mode,function(t,r){t?(e.destroy(),e.emit("error",t)):(e.fd=r,e.emit("open",r))})},e.ReadStream=s,e.WriteStream=f;var m=e.open;return e.open=u,e}function i(e){h("ENQUEUE",e[0].name,e[1]),f.push(e)}function o(){var e=f.shift();e&&(h("RETRY",e[0].name,e[1]),e[0].apply(null,e[1]))}var s=r(14),a=r(112),c=r(114),f=[],u=r(6),h=function(){};u.debuglog?h=u.debuglog("gfs4"):/\bgfs4\b/i.test(Object({NODE_ENV:void 0}).NODE_DEBUG||"")&&(h=function(){var e=u.format.apply(u,arguments);e="GFS4: "+e.split(/\n/).join("\nGFS4: "),console.error(e)}),/\bgfs4\b/i.test(Object({NODE_ENV:void 0}).NODE_DEBUG||"")&&t.on("exit",function(){h(f),r(52).equal(f.length,0)}),e.exports=n(r(51)),Object({NODE_ENV:void 0}).TEST_GRACEFUL_FS_GLOBAL_PATCH&&(e.exports=n(s)),e.exports.close=s.close=function(e){return function(t,r){return e.call(s,t,function(e){e||o(),"function"==typeof r&&r.apply(this,arguments)})}}(s.close),e.exports.closeSync=s.closeSync=function(e){return function(t){var r=e.apply(s,arguments);return o(),r}}(s.closeSync)}).call(t,r(0))},function(e,t,r){(function(t){function n(e){return e?function(t,r,n){return e.call(u,t,r,function(e){f(e)&&(e=null),n&&n.apply(this,arguments)})}:e}function i(e){return e?function(t,r){try{return e.call(u,t,r)}catch(e){if(!f(e))throw e}}:e}function o(e){return e?function(t,r,n,i){return e.call(u,t,r,n,function(e){f(e)&&(e=null),i&&i.apply(this,arguments)})}:e}function s(e){return e?function(t,r,n){try{return e.call(u,t,r,n)}catch(e){if(!f(e))throw e}}:e}function a(e){return e?function(t,r){return e.call(u,t,function(e,t){if(!t)return r.apply(this,arguments);t.uid<0&&(t.uid+=4294967296),t.gid<0&&(t.gid+=4294967296),r&&r.apply(this,arguments)})}:e}function c(e){return e?function(t){var r=e.call(u,t);return r.uid<0&&(r.uid+=4294967296),r.gid<0&&(r.gid+=4294967296),r}:e}function f(e){if(!e)return!0;if("ENOSYS"===e.code)return!0;return!(t.getuid&&0===t.getuid()||"EINVAL"!==e.code&&"EPERM"!==e.code)}var u=r(51),h=r(113),d=t.cwd,l=null,p=Object({NODE_ENV:void 0}).GRACEFUL_FS_PLATFORM||t.platform;t.cwd=function(){return l||(l=d.call(t)),l};try{t.cwd()}catch(e){}var b=t.chdir;t.chdir=function(e){l=null,b.call(t,e)},e.exports=function(e){h.hasOwnProperty("O_SYMLINK")&&t.version.match(/^v0\.6\.[0-2]|^v0\.5\./)&&function(e){e.lchmod=function(t,r,n){e.open(t,h.O_WRONLY|h.O_SYMLINK,r,function(t,i){t?n&&n(t):e.fchmod(i,r,function(t){e.close(i,function(e){n&&n(t||e)})})})},e.lchmodSync=function(t,r){var n,i=e.openSync(t,h.O_WRONLY|h.O_SYMLINK,r),o=!0;try{n=e.fchmodSync(i,r),o=!1}finally{if(o)try{e.closeSync(i)}catch(e){}else e.closeSync(i)}return n}}(e),e.lutimes||function(e){h.hasOwnProperty("O_SYMLINK")?(e.lutimes=function(t,r,n,i){e.open(t,h.O_SYMLINK,function(t,o){t?i&&i(t):e.futimes(o,r,n,function(t){e.close(o,function(e){i&&i(t||e)})})})},e.lutimesSync=function(t,r,n){var i,o=e.openSync(t,h.O_SYMLINK),s=!0;try{i=e.futimesSync(o,r,n),s=!1}finally{if(s)try{e.closeSync(o)}catch(e){}else e.closeSync(o)}return i}):(e.lutimes=function(e,r,n,i){i&&t.nextTick(i)},e.lutimesSync=function(){})}(e),e.chown=o(e.chown),e.fchown=o(e.fchown),e.lchown=o(e.lchown),e.chmod=n(e.chmod),e.fchmod=n(e.fchmod),e.lchmod=n(e.lchmod),e.chownSync=s(e.chownSync),e.fchownSync=s(e.fchownSync),e.lchownSync=s(e.lchownSync),e.chmodSync=i(e.chmodSync),e.fchmodSync=i(e.fchmodSync),e.lchmodSync=i(e.lchmodSync),e.stat=a(e.stat),e.fstat=a(e.fstat),e.lstat=a(e.lstat),e.statSync=c(e.statSync),e.fstatSync=c(e.fstatSync),e.lstatSync=c(e.lstatSync),e.lchmod||(e.lchmod=function(e,r,n){n&&t.nextTick(n)},e.lchmodSync=function(){}),e.lchown||(e.lchown=function(e,r,n,i){i&&t.nextTick(i)},e.lchownSync=function(){}),"win32"===p&&(e.rename=function(t){return function(r,n,i){var o=Date.now(),s=0;t(r,n,function a(c){if(c&&("EACCES"===c.code||"EPERM"===c.code)&&Date.now()-o<6e4)return setTimeout(function(){e.stat(n,function(e,o){e&&"ENOENT"===e.code?t(r,n,a):i(c)})},s),void(s<100&&(s+=10));i&&i(c)})}}(e.rename)),e.read=function(t){return function(r,n,i,o,s,a){var c;if(a&&"function"==typeof a){var f=0;c=function(u,h,d){if(u&&"EAGAIN"===u.code&&f<10)return f++,t.call(e,r,n,i,o,s,c);a.apply(this,arguments)}}return t.call(e,r,n,i,o,s,c)}}(e.read),e.readSync=function(t){return function(r,n,i,o,s){for(var a=0;;)try{return t.call(e,r,n,i,o,s)}catch(e){if("EAGAIN"===e.code&&a<10){a++;continue}throw e}}}(e.readSync)}}).call(t,r(0))},function(e,t){e.exports={O_RDONLY:0,O_WRONLY:1,O_RDWR:2,S_IFMT:61440,S_IFREG:32768,S_IFDIR:16384,S_IFCHR:8192,S_IFBLK:24576,S_IFIFO:4096,S_IFLNK:40960,S_IFSOCK:49152,O_CREAT:512,O_EXCL:2048,O_NOCTTY:131072,O_TRUNC:1024,O_APPEND:8,O_DIRECTORY:1048576,O_NOFOLLOW:256,O_SYNC:128,O_SYMLINK:2097152,O_NONBLOCK:4,S_IRWXU:448,S_IRUSR:256,S_IWUSR:128,S_IXUSR:64,S_IRWXG:56,S_IRGRP:32,S_IWGRP:16,S_IXGRP:8,S_IRWXO:7,S_IROTH:4,S_IWOTH:2,S_IXOTH:1,E2BIG:7,EACCES:13,EADDRINUSE:48,EADDRNOTAVAIL:49,EAFNOSUPPORT:47,EAGAIN:35,EALREADY:37,EBADF:9,EBADMSG:94,EBUSY:16,ECANCELED:89,ECHILD:10,ECONNABORTED:53,ECONNREFUSED:61,ECONNRESET:54,EDEADLK:11,EDESTADDRREQ:39,EDOM:33,EDQUOT:69,EEXIST:17,EFAULT:14,EFBIG:27,EHOSTUNREACH:65,EIDRM:90,EILSEQ:92,EINPROGRESS:36,EINTR:4,EINVAL:22,EIO:5,EISCONN:56,EISDIR:21,ELOOP:62,EMFILE:24,EMLINK:31,EMSGSIZE:40,EMULTIHOP:95,ENAMETOOLONG:63,ENETDOWN:50,ENETRESET:52,ENETUNREACH:51,ENFILE:23,ENOBUFS:55,ENODATA:96,ENODEV:19,ENOENT:2,ENOEXEC:8,ENOLCK:77,ENOLINK:97,ENOMEM:12,ENOMSG:91,ENOPROTOOPT:42,ENOSPC:28,ENOSR:98,ENOSTR:99,ENOSYS:78,ENOTCONN:57,ENOTDIR:20,ENOTEMPTY:66,ENOTSOCK:38,ENOTSUP:45,ENOTTY:25,ENXIO:6,EOPNOTSUPP:102,EOVERFLOW:84,EPERM:1,EPIPE:32,EPROTO:100,EPROTONOSUPPORT:43,EPROTOTYPE:41,ERANGE:34,EROFS:30,ESPIPE:29,ESRCH:3,ESTALE:70,ETIME:101,ETIMEDOUT:60,ETXTBSY:26,EWOULDBLOCK:35,EXDEV:18,SIGHUP:1,SIGINT:2,SIGQUIT:3,SIGILL:4,SIGTRAP:5,SIGABRT:6,SIGIOT:6,SIGBUS:10,SIGFPE:8,SIGKILL:9,SIGUSR1:30,SIGSEGV:11,SIGUSR2:31,SIGPIPE:13,SIGALRM:14,SIGTERM:15,SIGCHLD:20,SIGCONT:19,SIGSTOP:17,SIGTSTP:18,SIGTTIN:21,SIGTTOU:22,SIGURG:16,SIGXCPU:24,SIGXFSZ:25,SIGVTALRM:26,SIGPROF:27,SIGWINCH:28,SIGIO:23,SIGSYS:12,SSL_OP_ALL:2147486719,SSL_OP_ALLOW_UNSAFE_LEGACY_RENEGOTIATION:262144,SSL_OP_CIPHER_SERVER_PREFERENCE:4194304,SSL_OP_CISCO_ANYCONNECT:32768,SSL_OP_COOKIE_EXCHANGE:8192,SSL_OP_CRYPTOPRO_TLSEXT_BUG:2147483648,SSL_OP_DONT_INSERT_EMPTY_FRAGMENTS:2048,SSL_OP_EPHEMERAL_RSA:0,SSL_OP_LEGACY_SERVER_CONNECT:4,SSL_OP_MICROSOFT_BIG_SSLV3_BUFFER:32,SSL_OP_MICROSOFT_SESS_ID_BUG:1,SSL_OP_MSIE_SSLV2_RSA_PADDING:0,SSL_OP_NETSCAPE_CA_DN_BUG:536870912,SSL_OP_NETSCAPE_CHALLENGE_BUG:2,SSL_OP_NETSCAPE_DEMO_CIPHER_CHANGE_BUG:1073741824,SSL_OP_NETSCAPE_REUSE_CIPHER_CHANGE_BUG:8,SSL_OP_NO_COMPRESSION:131072,SSL_OP_NO_QUERY_MTU:4096,SSL_OP_NO_SESSION_RESUMPTION_ON_RENEGOTIATION:65536,SSL_OP_NO_SSLv2:16777216,SSL_OP_NO_SSLv3:33554432,SSL_OP_NO_TICKET:16384,SSL_OP_NO_TLSv1:67108864,SSL_OP_NO_TLSv1_1:268435456,SSL_OP_NO_TLSv1_2:134217728,SSL_OP_PKCS1_CHECK_1:0,SSL_OP_PKCS1_CHECK_2:0,SSL_OP_SINGLE_DH_USE:1048576,SSL_OP_SINGLE_ECDH_USE:524288,SSL_OP_SSLEAY_080_CLIENT_DH_BUG:128,SSL_OP_SSLREF2_REUSE_CERT_TYPE_BUG:0,SSL_OP_TLS_BLOCK_PADDING_BUG:512,SSL_OP_TLS_D5_BUG:256,SSL_OP_TLS_ROLLBACK_BUG:8388608,ENGINE_METHOD_DSA:2,ENGINE_METHOD_DH:4,ENGINE_METHOD_RAND:8,ENGINE_METHOD_ECDH:16,ENGINE_METHOD_ECDSA:32,ENGINE_METHOD_CIPHERS:64,ENGINE_METHOD_DIGESTS:128,ENGINE_METHOD_STORE:256,ENGINE_METHOD_PKEY_METHS:512,ENGINE_METHOD_PKEY_ASN1_METHS:1024,ENGINE_METHOD_ALL:65535,ENGINE_METHOD_NONE:0,DH_CHECK_P_NOT_SAFE_PRIME:2,DH_CHECK_P_NOT_PRIME:1,DH_UNABLE_TO_CHECK_GENERATOR:4,DH_NOT_SUITABLE_GENERATOR:8,NPN_ENABLED:1,RSA_PKCS1_PADDING:1,RSA_SSLV23_PADDING:2,RSA_NO_PADDING:3,RSA_PKCS1_OAEP_PADDING:4,RSA_X931_PADDING:5,RSA_PKCS1_PSS_PADDING:6,POINT_CONVERSION_COMPRESSED:2,POINT_CONVERSION_UNCOMPRESSED:4,POINT_CONVERSION_HYBRID:6,F_OK:0,R_OK:4,W_OK:2,X_OK:1,UV_UDP_REUSEADDR:4}},function(e,t,r){(function(t){var n=r(115).Stream;e.exports=function(e){function r(i,o){if(!(this instanceof r))return new r(i,o);n.call(this);var s=this;this.path=i,this.fd=null,this.readable=!0,this.paused=!1,this.flags="r",this.mode=438,this.bufferSize=65536,o=o||{};for(var a=Object.keys(o),c=0,f=a.length;c<f;c++){var u=a[c];this[u]=o[u]}if(this.encoding&&this.setEncoding(this.encoding),void 0!==this.start){if("number"!=typeof this.start)throw TypeError("start must be a Number");if(void 0===this.end)this.end=1/0;else if("number"!=typeof this.end)throw TypeError("end must be a Number");if(this.start>this.end)throw new Error("start must be <= end");this.pos=this.start}null===this.fd?e.open(this.path,this.flags,this.mode,function(e,t){if(e)return s.emit("error",e),void(s.readable=!1);s.fd=t,s.emit("open",t),s._read()}):t.nextTick(function(){s._read()})}function i(t,r){if(!(this instanceof i))return new i(t,r);n.call(this),this.path=t,this.fd=null,this.writable=!0,this.flags="w",this.encoding="binary",this.mode=438,this.bytesWritten=0,r=r||{};for(var o=Object.keys(r),s=0,a=o.length;s<a;s++){var c=o[s];this[c]=r[c]}if(void 0!==this.start){if("number"!=typeof this.start)throw TypeError("start must be a Number");if(this.start<0)throw new Error("start must be >= zero");this.pos=this.start}this.busy=!1,this._queue=[],null===this.fd&&(this._open=e.open,this._queue.push([this._open,this.path,this.flags,this.mode,void 0]),this.flush())}return{ReadStream:r,WriteStream:i}}}).call(t,r(0))},function(e,t,r){function n(){i.call(this)}e.exports=n;var i=r(2).EventEmitter;r(4)(n,i),n.Readable=r(13),n.Writable=r(116),n.Duplex=r(117),n.Transform=r(118),n.PassThrough=r(119),n.Stream=n,n.prototype.pipe=function(e,t){function r(t){e.writable&&!1===e.write(t)&&f.pause&&f.pause()}function n(){f.readable&&f.resume&&f.resume()}function o(){u||(u=!0,e.end())}function s(){u||(u=!0,"function"==typeof e.destroy&&e.destroy())}function a(e){if(c(),0===i.listenerCount(this,"error"))throw e}function c(){f.removeListener("data",r),e.removeListener("drain",n),f.removeListener("end",o),f.removeListener("close",s),f.removeListener("error",a),e.removeListener("error",a),f.removeListener("end",c),f.removeListener("close",c),e.removeListener("close",c)}var f=this;f.on("data",r),e.on("drain",n),e._isStdio||t&&!1===t.end||(f.on("end",o),f.on("close",s));var u=!1;return f.on("error",a),e.on("error",a),f.on("end",c),f.on("close",c),e.on("close",c),e.emit("pipe",f),e}},function(e,t,r){e.exports=r(23)},function(e,t,r){e.exports=r(10)},function(e,t,r){e.exports=r(13).Transform},function(e,t,r){e.exports=r(13).PassThrough},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){t.asyncMap=r(123),t.bindActor=r(53),t.chain=r(124)},function(e,t,r){(function(t){e.exports=function(){function e(u){u&&!a&&(a=u);for(var h=arguments.length,d=1;d<h;d++)void 0!==arguments[d]&&(s[d-1]=(s[d-1]||[]).concat(arguments[d]));if(n.length>c){var l=n.slice(c);f+=(n.length-c)*o,c=n.length,t.nextTick(function(){l.forEach(function(t){r.forEach(function(r){r(t,e)})})})}0==--f&&i.apply(null,[a].concat(s))}var r=Array.prototype.slice.call(arguments),n=r.shift()||[],i=r.pop();if("function"!=typeof i)throw new Error("No callback provided to asyncMap");if(!n)return i(null,[]);Array.isArray(n)||(n=[n]);var o=r.length,s=[],a=null,c=n.length,f=c*o;if(!f)return i(null,[]);n.forEach(function(t){r.forEach(function(r){r(t,e)})})}}).call(t,r(0))},function(e,t,r){function n(e,t){var r=[];!function o(s,a){return s>=a?t(null,r):(Array.isArray(e[s])&&(e[s]=i.apply(null,e[s].map(function(e){return e===n.first?r[0]:e===n.last?r[r.length-1]:e}))),e[s]?void e[s](function(e,n){if(e)return t(e,r);void 0!==n&&(r=r.concat(n)),o(s+1,a)}):o(s+1,a))}(0,e.length)}e.exports=n;var i=r(53);n.first={},n.last={}},function(e,t,r){!function(){function t(e,n){var i=this instanceof t?this:r;if(i.reset(n),"string"==typeof e&&e.length>0&&i.hash(e),i!==this)return i}var r;t.prototype.hash=function(e){var t,r,n,i,o;switch(o=e.length,this.len+=o,r=this.k1,n=0,this.rem){case 0:r^=o>n?65535&e.charCodeAt(n++):0;case 1:r^=o>n?(65535&e.charCodeAt(n++))<<8:0;case 2:r^=o>n?(65535&e.charCodeAt(n++))<<16:0;case 3:r^=o>n?(255&e.charCodeAt(n))<<24:0,r^=o>n?(65280&e.charCodeAt(n++))>>8:0}if(this.rem=o+this.rem&3,(o-=this.rem)>0){for(t=this.h1;r=11601*r+3432906752*(65535&r)&4294967295,r=r<<15|r>>>17,r=13715*r+461832192*(65535&r)&4294967295,t^=r,t=t<<13|t>>>19,t=5*t+3864292196&4294967295,!(n>=o);)r=65535&e.charCodeAt(n++)^(65535&e.charCodeAt(n++))<<8^(65535&e.charCodeAt(n++))<<16,r^=(255&(i=e.charCodeAt(n++)))<<24^(65280&i)>>8;switch(r=0,this.rem){case 3:r^=(65535&e.charCodeAt(n+2))<<16;case 2:r^=(65535&e.charCodeAt(n+1))<<8;case 1:r^=65535&e.charCodeAt(n)}this.h1=t}return this.k1=r,this},t.prototype.result=function(){var e,t;return e=this.k1,t=this.h1,e>0&&(t^=e=13715*(e=(e=11601*e+3432906752*(65535&e)&4294967295)<<15|e>>>17)+461832192*(65535&e)&4294967295),t^=this.len,t^=t>>>16,t=51819*t+2246770688*(65535&t)&4294967295,t^=t>>>13,t=44597*t+3266445312*(65535&t)&4294967295,(t^=t>>>16)>>>0},t.prototype.reset=function(e){return this.h1="number"==typeof e?e:0,this.rem=this.k1=this.len=0,this},r=new t,e.exports=t}()},function(e,t,r){"use strict";e.exports=class{constructor(e){this.id=e,this._index=[]}get(){return this._index}updateIndex(e,t){this._index=e.ops}}},function(e,t,r){const n=r(2).EventEmitter,i=r(42),o=1;e.exports=class extends n{constructor(e,t=8){super(),this._store=e,this._concurrency=t,this._queue=[],this._fetching={},this._tasksRunning=0,this._have={},this._stats={tasksProcessed:0,tasksRequested:0},this._timer=setInterval(()=>{this._queue.length>0&&this._tasksRunning<this._concurrency&&this._processLoop()},2)}stop(){clearInterval(this._timer)}load(e){try{this._stats.tasksRequested+=1,e.filter(e=>null!==e&&void 0!==e).sort((e,t)=>(e.clock?e.clock.time:0)-(t.clock?t.clock.time:0)).forEach(e=>{this._store._oplog.has(e.hash||e)||this._queue.find(t=>(t.hash||t)===(e.hash||e))||(this._queue.splice(0,0,e),this.emit("load.added",e))})}catch(e){console.error(e)}}async _processLoop(){if(this._queue.length>0&&this._tasksRunning<this._concurrency){this._tasksRunning++;try{const e=(()=>{this._queue=this._queue.filter(e=>!this._fetching[e.hash||e]);const e=this._queue.shift();return e&&(this._fetching[e.hash||e]=e),e})();if(e){const t=e.hash||e,r=this._store._oplog.values;this._have=Object.assign({},this._have,this._store._replicationInfo.have),this.emit("load.start",e,this._have);const n=await i.fromEntryHash(this._store._ipfs,t,this._store._oplog.id,o,r,this._store.key,this._store.access.write,this._onSyncProgress.bind(this));this._stats.tasksProcessed+=1,delete this._fetching[t],n.values.forEach(e=>{e.next.length>0&&this.load(e.next)}),this.emit("load.end",n,this._have)}}catch(e){console.error("LOADER-ERROR:",e),this.emit("error",e)}this._tasksRunning--,this.emit("load.complete",this._have)}}_onSyncProgress(e,t,r){this._have[t.clock.time]||(this._have[t.clock.time]=!0,this.emit("load.progress",this._id,e,t,r,this._have))}}},function(e,t,r){"use strict";const n=r(2).EventEmitter;e.exports=class extends n{constructor(e,t=1e3){super(),this._loader=e,this._oplog=null,this._interval=t,this._timer=null}start(){this._timer=setInterval(()=>this._checkReplicationStatus(),this._interval)}stop(){clearInterval(this._timer)}replicate(e){this._oplog=e}async _checkReplicationStatus(){this._oplog&&0===this._loader._queue.length&&this._oplog.tails.filter(e=>e.next.length>0).sort((e,t)=>e.clock.time-t.clock.time).reduce((e,t)=>e.concat(t.next),[]).reduce((e,t)=>(e.includes(t)||e.push(t),e),[]).forEach(e=>{this._loader.load([e])})}}},function(e,t,r){"use strict";e.exports=class{constructor(){this._index=[]}get(){return this._index.values?this._index.values:[]}updateIndex(e){this._index=e}}},function(e,t,r){"use strict";const n=r(34),i=r(131);e.exports=class extends n{constructor(e,t,r,n){n||(n={}),n.Index||Object.assign(n,{Index:i}),super(e,t,r,n),this._type="feed"}remove(e){return this.del(e)}del(e){const t={op:"DEL",key:null,value:e};return this._addOperation(t)}}},function(e,t,r){"use strict";e.exports=class{constructor(){this._index={}}get(){return Object.keys(this._index).map(e=>this._index[e])}updateIndex(e){this._index={},e.values.reduce((e,t)=>(e.includes(t.hash)||(e.push(t.hash),"ADD"===t.payload.op?this._index[t.hash]=t:"DEL"===t.payload.op&&delete this._index[t.payload.value]),e),[])}}},function(e,t,r){"use strict";const n=r(20),i=r(133);e.exports=class extends n{constructor(e,t,r,n){let o=Object.assign({},{Index:i});Object.assign(o,n),super(e,t,r,o),this._type="keyvalue"}get(e){return this._index.get(e)}set(e,t){return this.put(e,t)}put(e,t){return this._addOperation({op:"PUT",key:e,value:t})}del(e){return this._addOperation({op:"DEL",key:e,value:null})}}},function(e,t,r){"use strict";e.exports=class{constructor(){this._index={}}get(e){return this._index[e]}updateIndex(e){e.values.slice().reverse().reduce((e,t)=>(e.includes(t.payload.key)||(e.push(t.payload.key),"PUT"===t.payload.op?this._index[t.payload.key]=t.payload.value:"DEL"===t.payload.op&&delete this._index[t.payload.key]),e),[])}}},function(e,t,r){"use strict";const n=r(20),i=r(135),o=r(54);e.exports=class extends n{constructor(e,t,r,n={}){n.Index||Object.assign(n,{Index:i}),super(e,t,r,n),this._type="counter"}get value(){return this._index.get().value}inc(e){const t=new o(this.id,Object.assign({},this._index.get()._counters));return t.increment(e),this._addOperation({op:"COUNTER",key:null,value:t.toJSON()})}}},function(e,t,r){"use strict";const n=r(54);e.exports=class{constructor(e){this._index=new n(e)}get(){return this._index}updateIndex(e){this._index&&e.values.filter(e=>e&&"COUNTER"===e.payload.op).map(e=>n.from(e.payload.value)).forEach(e=>this._index.merge(e))}}},function(e,t,r){"use strict";t.deepEqual=((e,t)=>{const r=Object.getOwnPropertyNames(e),n=Object.getOwnPropertyNames(t);if(r.length!==n.length)return!1;for(let n=0;n<r.length;n++){const i=r[n];if(e[i]!==t[i])return!1}return!0});class n{constructor(e,t,r){this.value=e,this.added=new Set(t),this.removed=new Set(r)}static create(e,t,r){return new n(e,t,r)}static from(e){return n.create(e.value,e.added,e.removed)}}t.OperationTuple3=n},function(e,t,r){"use strict";const n=r(20),i=r(138),o=r(139),s=(r(13),(e,t,r)=>e.toString().split(t).join(r));e.exports=class extends n{constructor(e,t,r,n){n||(n={}),n.indexBy||Object.assign(n,{indexBy:"_id"}),n.Index||Object.assign(n,{Index:i}),super(e,t,r,n),this._type="docstore"}get(e,t=!1){const r=(e=e.toString()).split(" ");return e=r.length>1?s(e,"."," ").toLowerCase():e.toLowerCase(),Object.keys(this._index._index).filter(n=>t?-1!==n.indexOf(e):(t=>r.length>1?-1!==s(t,"."," ").toLowerCase().indexOf(e):-1!==t.toLowerCase().indexOf(e))(n)).map(e=>this._index.get(e))}query(e){return Object.keys(this._index._index).map(e=>this._index.get(e)).filter(t=>e(t))}batchPut(e,t){return o(e,(r,n)=>this._addOperationBatch({op:"PUT",key:r[this.options.indexBy],value:r},!0,n===e.length-1,t),{concurrency:1}).then(()=>this.saveSnapshot())}put(e){if(!e[this.options.indexBy])throw new Error(`The provided document doesn't contain field '${this.options.indexBy}'`);return this._addOperation({op:"PUT",key:e[this.options.indexBy],value:e})}del(e){if(!this._index.get(e))throw new Error(`No entry with key '${e}' in the database`);return this._addOperation({op:"DEL",key:e,value:null})}}},function(e,t,r){"use strict";e.exports=class{constructor(){this._index={}}get(e){return this._index[e]}updateIndex(e,t){e.values.slice().reverse().reduce((e,r,n)=>(!0!==e[r.payload.key]&&(e[r.payload.key]=!0,"PUT"===r.payload.op?this._index[r.payload.key]=r.payload.value:"DEL"===r.payload.op&&delete this._index[r.payload.key]),t&&t(r,n),e),{})}}},function(e,t,r){"use strict";e.exports=((e,t,r)=>new Promise((n,i)=>{const o=(r=Object.assign({concurrency:1/0},r)).concurrency;if(o<1)throw new TypeError("Expected `concurrency` to be a number from 1 and up");const s=[],a=e[Symbol.iterator]();let c=!1,f=!1,u=0,h=0;const d=()=>{if(c)return;const e=a.next(),r=h;if(h++,e.done)return f=!0,void(0===u&&n(s));u++,Promise.resolve(e.value).then(e=>t(e,r)).then(e=>{s[r]=e,u--,d()},e=>{c=!0,i(e)})};for(let e=0;e<o&&(d(),!f);e++);}))},function(e,t,r){e.exports=r(141)},function(e,t,r){"use strict";(function(t){const n=r(142),i=r(63),o=i.create("orbit-db.ipfs-pubsub");i.setLogLevel("ERROR");const s=256;let a=0;e.exports=class{constructor(e,t){this._ipfs=e,this._id=t,this._subscriptions={},null===this._ipfs.pubsub&&o.error("The provided version of ipfs doesn't have pubsub support. Messages will not be exchanged."),this._handleMessage=this._handleMessage.bind(this),this._ipfs.setMaxListeners&&this._ipfs.setMaxListeners(s)}subscribe(e,t,r){if(!this._subscriptions[e]){const i=n(this._ipfs,e);i.on("error",e=>{o.error("Pubsub Error:",e)}),i.on("message",e=>{this._handleMessage(e)}),i.on("peer joined",t=>{this._subscriptions[e].onNewPeer(e,t,i)}),i.on("subscribed",()=>{this._subscriptions[e]={room:i,onMessage:t,onNewPeer:r},a++,o.debug("Topics open:",a)})}}unsubscribe(e){this._subscriptions[e]&&(this._subscriptions[e].room.leave(),this._subscriptions[e].room=null,delete this._subscriptions[e],o.debug(`Unsubscribed from '${e}'`),a--,o.debug("Topics open:",a))}publish(e,r){this._subscriptions[e]&&this._subscriptions[e].room&&this._ipfs.pubsub&&this._subscriptions[e].room.broadcast(t.from(JSON.stringify(r)))}disconnect(){Object.keys(this._subscriptions).forEach(e=>this.unsubscribe(e)),this._subscriptions={}}_handleMessage(e){if(e.from===this._id)return;let t,r,n;try{n=e.topicIDs[0],t=JSON.parse(e.data),r=this._subscriptions[n]}catch(t){o.error(t),o.error("Couldn't parse pubsub message:",e)}r&&r.onMessage&&t&&r.onMessage(n,t)}}}).call(t,r(1).Buffer)},function(e,t,r){"use strict";const n=r(143),i=r(2),o=r(39),s=r(55),a=r(9).Buffer,c=r(56),f=r(148),u=r(62),h=r(171),d={pollInterval:1e3};e.exports=((e,t,r)=>new class extends i{constructor(e,t,r){if(super(),this._ipfs=e,this._topic=t,this._options=Object.assign({},s(d),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(){o.clearInterval(),Object.keys(this._connections).forEach(e=>{this._connections[e].stop()}),h.emitter.removeListener(this._topic,this._handleDirectMessage),this.emit("stop")}broadcast(e){let t=u(e);this._ipfs.pubsub.publish(this._topic,t,e=>{e&&this.emit("error",e)})}sendTo(e,t){let r=this._connections[e];r||((r=new f(e,this._ipfs,this)).on("error",e=>this.emit("error",e)),this._connections[e]=r);const n=a.from([0]),i={to:e,from:this._ipfs._peerInfo.id.toB58String(),data:a.from(t).toString("hex"),seqno:n.toString("hex"),topicIDs:[this._topic],topicCIDs:[this._topic]};r.push(a.from(JSON.stringify(i)))}_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("stop",()=>{this._ipfs.pubsub.unsubscribe(this._topic,e)}),this._ipfs._libp2pNode.handle(c,h.handler),h.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)}}}(e,t,r))},function(e,t,r){"use strict";const n=r(55),i=r(144)("hyperdiff"),o=r(147),s=e=>-1!==e;e.exports=function(e,t,r){const{first:a,second:c}=function(e,t){return{first:e,second:n(t)}}(e,t),f=function(e){return e?function(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(e,t,r){return e.indexOf(t)}}(r);i("preconditions first=%j second=%j findIndex=%s",a,c,f.name);const u=a.reduce(function(e,t,n){const a=f(c,t,r),u=s(a)?"common":"removed";return e[u].push(t),o(c,a),i("index=%s value=%s collection=%s",n,t,u),e},{common:[],removed:[]});return u.added=c,i("added=%j removed=%j common%j",u.added,u.removed,u.common),u}},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=Object({NODE_ENV:void 0}).DEBUG),e}(t=e.exports=r(145)).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&&(i++,"%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(t,r(0))},function(e,t,r){function n(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 c=0;s[0]=s[0].replace(/%([a-zA-Z%])/g,function(r,n){if("%%"===r)return r;c++;var i=t.formatters[n];if("function"==typeof i){var o=s[c];r=i.call(e,o),s.splice(c,1),c--}return r}),t.formatArgs.call(e,s);(r.log||t.log||console.log.bind(console)).apply(e,s)}}var n;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),r.destroy=i,"function"==typeof t.init&&t.init(r),t.instances.push(r),r}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){t.save(e),t.names=[],t.skips=[];var r,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(146),t.instances=[],t.names=[],t.skips=[],t.formatters={}},function(e,t){function r(e,t,r){if(!(e<t))return e<1.5*t?Math.floor(e/t)+" "+r:Math.ceil(e/t)+" "+r+"s"}var n=1e3,i=60*n,o=60*i,s=24*o,a=365.25*s;e.exports=function(e,t){t=t||{};var c=typeof e;if("string"===c&&e.length>0)return function(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 r=parseFloat(t[1]);switch((t[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return r*a;case"days":case"day":case"d":return r*s;case"hours":case"hour":case"hrs":case"hr":case"h":return r*o;case"minutes":case"minute":case"mins":case"min":case"m":return r*i;case"seconds":case"second":case"secs":case"sec":case"s":return r*n;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return r;default:return}}}}(e);if("number"===c&&!1===isNaN(e))return t.long?function(e){return r(e,s,"day")||r(e,o,"hour")||r(e,i,"minute")||r(e,n,"second")||e+" ms"}(e):function(e){return e>=s?Math.round(e/s)+"d":e>=o?Math.round(e/o)+"h":e>=i?Math.round(e/i)+"m":e>=n?Math.round(e/n)+"s":e+"ms"}(e);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))}},function(e,t,r){(function(t){function r(e,t){for(var r=-1,n=t.length,i=e.length;++r<n;)e[i+r]=t[r];return e}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 i(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.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}function s(e,t){for(var r=e.length;r--;)if(function(e,t){return e===t||e!=e&&t!=t}(e[r][0],t))return r;return-1}function a(e,t){for(var r=-1,n=null==e,i=t.length,o=Array(i);++r<i;)o[r]=n?void 0:function(e,t,r){var n=null==e?void 0:f(e,t);return void 0===n?r:n}(e,t[r]);return o}function c(e,t,n,i,o){var s=-1,a=e.length;for(n||(n=y),o||(o=[]);++s<a;){var f=e[s];t>0&&n(f)?t>1?c(f,t-1,n,i,o):r(o,f):i||(o[o.length]=f)}return o}function f(e,t){for(var r=0,n=(t=m(t,e)?[t]:d(t)).length;null!=e&&r<n;)e=e[v(t[r++])];return r&&r==n?e:void 0}function u(e){if(!S(e)||function(e){return!!V&&V in e}(e))return!1;return(w(e)||function(e){var t=!1;if(null!=e&&"function"!=typeof e.toString)try{t=!!(e+"")}catch(e){}return t}(e)?Z:q).test(function(e){if(null!=e){try{return J.call(e)}catch(e){}try{return e+""}catch(e){}}return""}(e))}function h(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(g(i))te.call(e,i,1);else if(m(i,e))delete e[v(i)];else{var s=d(i),a=function(e,t){return 1==t.length?e:f(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;var o=Array(i);for(;++n<i;)o[n]=e[n+t];return o}(t,0,-1))}(e,s);null!=a&&delete a[v(function(e){var t=e?e.length:0;return t?e[t-1]:void 0}(s))]}}}return e}function d(e){return ue(e)?e:ce(e)}function l(e,t){if(e!==t){var r=void 0!==e,n=null===e,i=e==e,o=E(e),s=void 0!==t,a=null===t,c=t==t,f=E(t);if(!a&&!f&&!o&&e>t||o&&s&&c&&!a&&!f||n&&s&&c||!r&&c||!i)return 1;if(!n&&!o&&!f&&e<t||f&&r&&i&&!n&&!o||a&&r&&i||!s&&i||!c)return-1}return 0}function p(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 b(e,t){var r=function(e,t){return null==e?void 0:e[t]}(e,t);return u(r)?r:void 0}function y(e){return ue(e)||function(e){return function(e){return k(e)&&function(e){return null!=e&&function(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=I}(e.length)&&!w(e)}(e)}(e)&&$.call(e,"callee")&&(!ee.call(e,"callee")||X.call(e)==N)}(e)||!!(re&&e&&e[re])}function g(e,t){return!!(t=null==t?I:t)&&("number"==typeof e||F.test(e))&&e>-1&&e%1==0&&e<t}function m(e,t){if(ue(e))return!1;var r=typeof e;return!("number"!=r&&"symbol"!=r&&"boolean"!=r&&null!=e&&!E(e))||(T.test(e)||!j.test(e)||null!=t&&e in Object(t))}function v(e){if("string"==typeof e||E(e))return e;var t=e+"";return"0"==t&&1/e==-O?"-0":t}function _(e,t){if("function"!=typeof e||t&&"function"!=typeof t)throw new TypeError(M);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(_.Cache||o),r}function w(e){var t=S(e)?X.call(e):"";return t==R||t==P}function S(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function k(e){return!!e&&"object"==typeof e}function E(e){return"symbol"==typeof e||k(e)&&X.call(e)==C}function x(e){return null==e?"":function(e){if("string"==typeof e)return e;if(E(e))return ae?ae.call(e):"";var t=e+"";return"0"==t&&1/e==-O?"-0":t}(e)}var M="Expected a function",A="__lodash_hash_undefined__",O=1/0,I=9007199254740991,N="[object Arguments]",R="[object Function]",P="[object GeneratorFunction]",C="[object Symbol]",j=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,T=/^\w*$/,L=/^\./,B=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,D=/\\(\\)?/g,q=/^\[object .+?Constructor\]$/,F=/^(?:0|[1-9]\d*)$/,z="object"==typeof t&&t&&t.Object===Object&&t,U="object"==typeof self&&self&&self.Object===Object&&self,K=z||U||Function("return this")(),G=Array.prototype,W=Function.prototype,H=Object.prototype,Y=K["__core-js_shared__"],V=function(){var e=/[^.]+$/.exec(Y&&Y.keys&&Y.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}(),J=W.toString,$=H.hasOwnProperty,X=H.toString,Z=RegExp("^"+J.call($).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Q=K.Symbol,ee=H.propertyIsEnumerable,te=G.splice,re=Q?Q.isConcatSpreadable:void 0,ne=Math.max,ie=b(K,"Map"),oe=b(Object,"create"),se=Q?Q.prototype:void 0,ae=se?se.toString:void 0;n.prototype.clear=function(){this.__data__=oe?oe(null):{}},n.prototype.delete=function(e){return this.has(e)&&delete this.__data__[e]},n.prototype.get=function(e){var t=this.__data__;if(oe){var r=t[e];return r===A?void 0:r}return $.call(t,e)?t[e]:void 0},n.prototype.has=function(e){var t=this.__data__;return oe?void 0!==t[e]:$.call(t,e)},n.prototype.set=function(e,t){return this.__data__[e]=oe&&void 0===t?A:t,this},i.prototype.clear=function(){this.__data__=[]},i.prototype.delete=function(e){var t=this.__data__,r=s(t,e);return!(r<0||(r==t.length-1?t.pop():te.call(t,r,1),0))},i.prototype.get=function(e){var t=this.__data__,r=s(t,e);return r<0?void 0:t[r][1]},i.prototype.has=function(e){return s(this.__data__,e)>-1},i.prototype.set=function(e,t){var r=this.__data__,n=s(r,e);return n<0?r.push([e,t]):r[n][1]=t,this},o.prototype.clear=function(){this.__data__={hash:new n,map:new(ie||i),string:new n}},o.prototype.delete=function(e){return p(this,e).delete(e)},o.prototype.get=function(e){return p(this,e).get(e)},o.prototype.has=function(e){return p(this,e).has(e)},o.prototype.set=function(e,t){return p(this,e).set(e,t),this};var ce=_(function(e){e=x(e);var t=[];return L.test(e)&&t.push(""),e.replace(B,function(e,r,n,i){t.push(n?i.replace(D,"$1"):r||e)}),t}),fe=function(e,t){return t=ne(void 0===t?e.length-1:t,0),function(){for(var r=arguments,n=-1,i=ne(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=c(t,1);var r=e?e.length:0,n=a(e,t);return h(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 g(e,r)?+e:e}).sort(l)),n});_.Cache=o;var ue=Array.isArray;e.exports=fe}).call(t,r(7))},function(e,t,r){"use strict";const n=r(2),i=r(57),o=r(170),s=r(56),a=r(62);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._connecting||(this.once("connect",()=>this.push(e)),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.dial(t[0],s,(e,t)=>{if(e)return void this.emit("error",e);this._connecting=!1;const r=o();this._connection=r,i(r,t,i.onEnd(e=>{delete this._connection,e&&this.emit("error",e)})),this.emit("connect",r)}):this.emit("error",new Error("could not connect to "+this._id))})}_getPeerAddresses(e,t){this._ipfs.swarm.peers((r,n)=>{r?t(r):t(null,n.filter(t=>t.peer.id.toB58String()===e).map(e=>e.peer))})}}},function(e,t,r){"use strict";e.exports={keys:r(150),once:r(59),values:r(29),count:r(151),infinite:r(152),empty:r(153),error:r(154)}},function(e,t,r){"use strict";var n=r(29);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(17),onEnd:r(156),log:r(157),find:r(158),reduce:r(30),collect:r(159),concat:r(160)}},function(e,t,r){"use strict";var n=r(17);e.exports=function(e){return n(null,e)}},function(e,t,r){"use strict";var n=r(17);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(18),o=r(17);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(30);e.exports=function(e){return n(function(e,t){return e.push(t),e},[],e)}},function(e,t,r){"use strict";var n=r(30);e.exports=function(e){return n(function(e,t){return e+t},"",e)}},function(e,t,r){"use strict";e.exports={map:r(162),asyncMap:r(163),filter:r(31),filterNot:r(164),through:r(165),take:r(166),unique:r(61),nonUnique:r(167),flatten:r(168)}},function(e,t,r){"use strict";function n(e){return e}var i=r(18);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){"use strict";function n(e){return e}var i=r(18);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,o?n(s,function(){o?t=a:a(s)}):n(s,a)):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";var n=r(60),i=r(31);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){function r(e){!n&&t&&(n=!0,t(!0===e?null:e))}var n=!1;return function(t){return function(n,i){return n&&r(n),t(n,function(t,n){t?r(t):e&&e(n),i(t,n)})}}}},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?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(61);e.exports=function(e){return n(e,!0)}},function(e,t,r){"use strict";var n=r(29),i=r(59);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";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){e.exports=function(e,t){function r(e,t){e&&(a=e,c&&s(a)),c=t,o()}function n(e){f=f||e||!0,o()}function i(e){f||(c?s(a,e):(u.push(e),o()))}function o(){c&&(a?s(a):!u.length&&f?s(f):u.length&&s(null,u.shift()))}function s(e,r){var n=c;if(e&&t){var i=t;t=null,i(!0===e?null:e)}c=null,n(e,r)}"function"==typeof e&&(t=e,e=!1);var a,c,f,u=[];return e?{push:i,end:n,source:r}:(r.push=i,r.end=n,r)}},function(e,t,r){"use strict";const n=r(57),i=r(9).Buffer,o=new(r(2));e.exports={handler:function(e,t){t.getPeerInfo((e,r)=>{if(e)return this.emit("error",e);const s=r.id.toB58String();n(t,n.map(e=>{let t;try{t=JSON.parse(e.toString())}catch(e){return void o.emit("warning",e.message)}if(s!==t.from)return void o.emit("warning","no peerid match "+t.from);const r=t.topicIDs;if(Array.isArray(r))return t.data=i.from(t.data,"hex"),t.seqno=i.from(t.seqno,"hex"),r.forEach(e=>{o.emit(e,t)}),t;o.emit("warning","no topic IDs")}),n.onEnd(e=>{e&&o.emit("error",e)}))})},emitter:o}},function(e,t,r){"use strict";const n=r(12),i=r(14),o=r(173);let s={};class a{static async load(e,t){const r=n.join(t.root,t.path),i=n.join(e,r);let o=s[i];return o||(o=new a(i,t.toString()),s[i]=o,await o.load()),o}static async close(){return Promise.all(Object.values(s),e=>e.close()).then(()=>s={})}constructor(e,t){this.path=e||"./orbitdb",this.id=t,this._store=null,this._cache={}}async close(){this._store&&await this._store.close(),this._store=null}async get(e){return this._store||await this.load(),new Promise((t,r)=>{this._store.get(e,(e,n)=>{if(e&&-1===e.toString().indexOf("NotFoundError: Key not found in database"))return r(e);t(n?JSON.parse(n):null)})})}async set(e,t){return this._store||await this.load(),this._store.put(e,JSON.stringify(t))}async del(e){return this._store||await this.load(),new Promise((t,r)=>{this._store.del(e,(e,n)=>{if(e&&-1===e.toString().indexOf("NotFoundError: Key not found in database"))return r(e);t()})})}async load(){return new Promise((e,t)=>{i.sync&&i.sync(this.path),o(this.path,(t,r)=>{this._store=r,e()})})}}e.exports=a},function(e,t,r){e.exports=r(174)(r(187))},function(e,t,r){const n=r(175),i=r(184);e.exports=function(e){function t(t,r,o){return"function"==typeof r&&(o=r),"object"==typeof r&&null!==r||(r={}),n(i(e(t),r),r,o)}return["destroy","repair"].forEach(function(r){"function"==typeof e[r]&&(t[r]=function(t,n){e[r](t,n||function(){})})}),t}},function(e,t,r){(function(t){function n(e,r,i){if(!(this instanceof n))return new n(e,r,i);var s;if(a.call(this),this.setMaxListeners(1/0),"function"==typeof r&&(i=r,r={}),r=r||{},!e||"object"!=typeof e){if(s=new _("Must provide db"),"function"==typeof i)return t.nextTick(i,s);throw s}p.equal(typeof e.status,"string",".status required, old abstract-leveldown"),this.options=o(r),this._db=e,this.db=new u(e),this.open(i)}function i(e,t){return"function"==typeof e?e:t}function o(e){return"object"==typeof e&&null!==e?e:{}}function s(e,r){if(!e._isOpening()&&!e.isOpen())return t.nextTick(r,new g("Database is not open")),!0}var a=r(2).EventEmitter,c=r(6).inherits,f=r(32),u=r(176),h=r(179),d=r(180),l=r(33),p=r(52),b=r(67),y=l.WriteError,g=l.ReadError,m=l.NotFoundError,v=l.OpenError,_=l.InitializationError;n.prototype.emit=a.prototype.emit,n.prototype.once=a.prototype.once,c(n,a),n.prototype.open=function(e){var r,n=this;return e||(r=(e=b()).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 v(t));n.db=n._db,e(null,n),n.emit("open"),n.emit("ready")}),r)},n.prototype.close=function(e){var r,n=this;return e||(r=(e=b()).promise),this.isOpen()?(this.db.close(function(){n.emit("closed"),e.apply(null,arguments)}),this.emit("closing"),this.db=new u(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},n.prototype.isOpen=function(){return"open"===this.db.status},n.prototype._isOpening=function(){return"opening"===this.db.status},n.prototype.isClosed=function(){return/^clos|new/.test(this.db.status)},n.prototype.get=function(e,t,r){if(null===e||void 0===e)throw new g("get() requires a key argument");var n;return(r=i(t,r))||(n=(r=b()).promise),s(this,r)?n:(t=o(t),this.db.get(e,t,function(t,n){if(t)return t=/notfound/i.test(t)||t.notFound?new m("Key not found in database ["+e+"]",t):new g(t),r(t);r(null,n)}),n)},n.prototype.put=function(e,t,r,n){if(null===e||void 0===e)throw new y("put() requires a key argument");var a,c=this;return(n=i(r,n))||(a=(n=b()).promise),s(this,n)?a:(r=o(r),this.db.put(e,t,r,function(r){if(r)return n(new y(r));c.emit("put",e,t),n()}),a)},n.prototype.del=function(e,t,r){if(null===e||void 0===e)throw new y("del() requires a key argument");var n,a=this;return(r=i(t,r))||(n=(r=b()).promise),s(this,r)?n:(t=o(t),this.db.del(e,t,function(t){if(t)return r(new y(t));a.emit("del",e),r()}),n)},n.prototype.batch=function(e,t,r){if(!arguments.length)return new d(this);if(!Array.isArray(e))throw new y("batch() requires an array argument");var n,a=this;return(r=i(t,r))||(n=(r=b()).promise),s(this,r)?n:(t=o(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 y(t));a.emit("batch",e),r()}),n)},n.prototype.readStream=n.prototype.createReadStream=function(e){return"number"!=typeof(e=f({keys:!0,values:!0},e)).limit&&(e.limit=-1),new h(this.db.iterator(e),e)},n.prototype.keyStream=n.prototype.createKeyStream=function(e){return this.createReadStream(f(e,{keys:!0,values:!1}))},n.prototype.valueStream=n.prototype.createValueStream=function(e){return this.createReadStream(f(e,{keys:!1,values:!0}))},n.prototype.toString=function(){return"LevelUP"},n.errors=l,e.exports=n.default=n}).call(t,r(0))},function(e,t,r){(function(t){function n(e){s.call(this,""),this._db=e,this._operations=[],this._iterators=[]}function i(e){c.forEach(function(t){e["_"+t]=function(){this._operations.push({method:t,args:arguments})}}),e._iterator=function(e){var t=new a(e);return this._iterators.push(t),t}}var o=r(6),s=r(19).AbstractLevelDOWN,a=r(178),c="put get del batch approximateSize".split(" ");o.inherits(n,s),n.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){c.concat("iterator").forEach(function(t){e["_"+t]=function(){return this._db[t].apply(this._db,arguments)}})}(r),t()})},n.prototype._close=function(e){var t=this;this._db.close(function(r){if(r)return e(r);i(t),e()})},i(n.prototype),n.prototype._isBuffer=function(e){return t.isBuffer(e)},n.prototype._serializeKey=function(e){return e},n.prototype._serializeValue=function(e){return e},e.exports=n,e.exports.DeferredIterator=a}).call(t,r(1).Buffer)},function(e,t,r){var n=r(64);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 n(e){o.call(this,e),this._options=e,this._iterator=null,this._operations=[]}var i=r(6),o=r(19).AbstractIterator;i.inherits(n,o),n.prototype.setDb=function(e){var t=this._iterator=e.iterator(this._options);this._operations.forEach(function(e){t[e.method].apply(t,e.args)})},n.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){n.prototype["_"+e]=function(){this._operation(e,arguments)}}),e.exports=n},function(e,t,r){function n(e,t){if(!(this instanceof n))return new n(e,t);t=t||{},o.call(this,s(t,{objectMode:!0})),this._iterator=e,this._destroyed=!1,this._options=t,this.on("end",this._cleanup.bind(this))}var i=r(4),o=r(13).Readable,s=r(32);e.exports=n,i(n,o),n.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}))})},n.prototype.destroy=n.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){function n(e){this._levelup=e,this.batch=e.db.batch(),this.ops=[],this.length=0}var i=r(33).WriteError,o=r(67);n.prototype.put=function(e,t){try{this.batch.put(e,t)}catch(e){throw new i(e)}return this.ops.push({type:"put",key:e,value:t}),this.length++,this},n.prototype.del=function(e){try{this.batch.del(e)}catch(e){throw new i(e)}return this.ops.push({type:"del",key:e}),this.length++,this},n.prototype.clear=function(){try{this.batch.clear()}catch(e){throw new i(e)}return this.ops=[],this.length=0,this},n.prototype.write=function(e){var t,r=this._levelup,n=this.ops;e||(t=(e=o()).promise);try{this.batch.write(function(t){if(t)return e(new i(t));r.emit("batch",n),e()})}catch(e){throw new i(e)}return t},e.exports=n},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(182)(e.exports),e.exports.create=e.exports.custom.createError},function(e,t,r){function n(e,t,r){o(this,{type:e,name:e,cause:"string"!=typeof t?t:r,message:t&&"string"!=typeof t?t.message:t},"ewr")}function i(e,t){Error.call(this),Error.captureStackTrace&&Error.captureStackTrace(this,arguments.callee),n.call(this,"CustomError",e,t)}var o=r(183);i.prototype=new Error,e.exports=function(e){var t=function(t,r){return function(e,t,r){var o=function(r,i){n.call(this,t,r,i),"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,arguments.callee)};return o.prototype=r?new r:new i,o}(e,t,r)};return{CustomError:i,FilesystemError:t("FilesystemError"),createError:t}}},function(e,t){!function(t,r,n){void 0!==e&&e.exports?e.exports=n():r.prr=n()}(0,this,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)}})},function(e,t,r){"use strict";function n(e,t){if(!(this instanceof n))return new n(e,t);s.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 i(e,t){c.call(this,e),this.codec=e.codec,this.opts=this.codec.encodeLtgt(t),this.it=e.db.iterator(this.opts)}function o(e,t){a.call(this,e),this.codec=e.codec,this.batch=e.db.batch()}var s=r(19).AbstractLevelDOWN,a=r(19).AbstractChainedBatch,c=r(19).AbstractIterator,f=r(6).inherits,u=r(185),h=r(33).EncodingError;e.exports=n.default=n,f(n,s),n.prototype._serializeKey=n.prototype._serializeValue=function(e){return e},n.prototype._open=function(e,t){this.db.open(e,t)},n.prototype._close=function(e){this.db.close(e)},n.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)},n.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 h(e))}r(null,i)})},n.prototype._del=function(e,t,r){e=this.codec.encodeKey(e,t),this.db.del(e,t,r)},n.prototype._chainedBatch=function(){return new o(this)},n.prototype._batch=function(e,t,r){e=this.codec.encodeBatch(e,t),this.db.batch(e,t,r)},n.prototype._iterator=function(e){return e.keyAsBuffer=this.codec.keyAsBuffer(e),e.valueAsBuffer=this.codec.valueAsBuffer(e),new i(this,e)},n.prototype.approximateSize=function(e,t,r,n){return this.db.approximateSize(e,t,r,n)},f(i,c),i.prototype._next=function(e){var t=this;this.it.next(function(r,n,i){if(r)return e(r);try{void 0!==n&&(n=t.codec.decodeKey(n,t.opts)),void 0!==i&&(i=t.codec.decodeValue(i,t.opts))}catch(r){return e(new h(r))}e(null,n,i)})},i.prototype._end=function(e){this.it.end(e)},f(o,a),o.prototype._put=function(e,t){e=this.codec.encodeKey(e),t=this.codec.encodeValue(t),this.batch.put(e,t)},o.prototype._del=function(e){e=this.codec.encodeKey(e),this.batch.del(e)},o.prototype._clear=function(){this.batch.clear()},o.prototype._write=function(e,t){this.batch.write(e,t)}},function(e,t,r){function n(e){this.opts=e||{},this.encodings=i}var i=r(186);e.exports=n,n.prototype._encoding=function(e){return"string"==typeof e&&(e=i[e]),e||(e=i.id),e},n.prototype._keyEncoding=function(e,t){return this._encoding(t&&t.keyEncoding||e&&e.keyEncoding||this.opts.keyEncoding)},n.prototype._valueEncoding=function(e,t){return this._encoding(t&&(t.valueEncoding||t.encoding)||e&&(e.valueEncoding||e.encoding)||this.opts.valueEncoding||this.opts.encoding)},n.prototype.encodeKey=function(e,t,r){return this._keyEncoding(t,r).encode(e)},n.prototype.encodeValue=function(e,t,r){return this._valueEncoding(t,r).encode(e)},n.prototype.decodeKey=function(e,t){return this._keyEncoding(t).decode(e)},n.prototype.decodeValue=function(e,t){return this._valueEncoding(t).decode(e)},n.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"];n.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},n.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(){}},n.prototype.keyAsBuffer=function(e){return this._keyEncoding(e).buffer},n.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:new e(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:new e(t,r)},decode:function(e){return e.toString(r)},buffer:!0,type:r}})}).call(t,r(1).Buffer)},function(e,t,r){(function(t){function n(e){if(!(this instanceof n))return new n(e);if(!e)throw new Error("constructor requires at least a location argument");this.IDBOptions={},this.location=e}e.exports=n;var i=r(188),o=r(68).AbstractLevelDOWN,s=r(6),a=r(192),c=r(194),f=r(195),u=r(201);s.inherits(n,o),n.prototype._open=function(e,t){var r=this,n={storeName:this.location,autoIncrement:!1,keyPath:null,onStoreReady:function(){t&&t(null,r.idb)},onError:function(e){t&&t(e)}};f(n,e),this.IDBOptions=n,this.idb=new i(n)},n.prototype._get=function(e,r,n){this.idb.get(e,function(i){if(void 0===i)return n(new Error("NotFound"));var o=!0;return!1===r.asBuffer&&(o=!1),r.raw&&(o=!1),o&&(i=i instanceof Uint8Array?u(i):new t(String(i))),n(null,i,e)},n)},n.prototype._del=function(e,t,r){this.idb.remove(e,r,r)},n.prototype._put=function(e,r,n,i){r instanceof ArrayBuffer&&(r=u(new Uint8Array(r)));var o=this.convertEncoding(e,r,n);t.isBuffer(o.value)&&("function"==typeof r.toArrayBuffer?o.value=new Uint8Array(r.toArrayBuffer()):o.value=new Uint8Array(r)),this.idb.put(o.key,o.value,function(){i()},i)},n.prototype.convertEncoding=function(e,t,r){if(r.raw)return{key:e,value:t};if(t){var n=t.toString();"NaN"===n&&(t="NaN")}var i=r.valueEncoding,o={key:e,value:t};return!t||i&&"binary"===i||"object"!=typeof o.value&&(o.value=n),o},n.prototype.iterator=function(e){return"object"!=typeof e&&(e={}),new a(this.idb,e)},n.prototype._batch=function(e,t,r){var n,i,o,s,a=[];if(0===e.length)return setTimeout(r,0);for(n=0;n<e.length;n++){o={},s=e[n],a[n]=o;var c=this.convertEncoding(s.key,s.value,t);s.key=c.key,s.value=c.value;for(i in s)"type"===i&&"del"==s[i]?o[i]="remove":o[i]=s[i]}return this.idb.batch(a,function(){r()},r)},n.prototype._close=function(e){this.idb.db.close(),e()},n.prototype._approximateSize=function(e,t,r){var n=new Error("Not implemented");if(r)return r(n);throw n},n.prototype._isBuffer=function(e){return t.isBuffer(e)},n.destroy=function(e,t){if("object"==typeof e)var r=e.IDBOptions.storePrefix||"IDBWrapper-",n=e.location;else r="IDBWrapper-",n=e;var i=indexedDB.deleteDatabase(r+n);i.onsuccess=function(){t()},i.onerror=function(e){t(e)}};n.prototype._checkKeyValue=function(e,t){return null===e||void 0===e?new Error(t+" cannot be `null` or `undefined`"):null===e||void 0===e?new Error(t+" cannot be `null` or `undefined`"):c(e)&&0===e.byteLength?new Error(t+" cannot be an empty ArrayBuffer"):""===String(e)?new Error(t+" cannot be an empty String"):0===e.length?new Error(t+" cannot be an empty Array"):void 0}}).call(t,r(1).Buffer)},function(e,t,r){var n,i;!function(o,s,a){"use strict";void 0===(i="function"==typeof(n=s)?n.call(t,r,t,e):n)||(e.exports=i)}(0,function(){"use strict";function e(e,t){var r,n;for(r in t)(n=t[r])!==s[r]&&n!==e[r]&&(e[r]=n);return e}var t=function(e){throw e},r=function(){},n={storeName:"Store",storePrefix:"IDBWrapper-",dbVersion:1,keyPath:"id",autoIncrement:!0,onStoreReady:function(){},onError:t,indexes:[],implementationPreference:["indexedDB","webkitIndexedDB","mozIndexedDB","shimIndexedDB"]},i=function(e,t){void 0===t&&"function"==typeof e&&(t=e),"[object Object]"!=Object.prototype.toString.call(e)&&(e={});for(var r in n)this[r]=void 0!==e[r]?e[r]:n[r];this.dbName=this.storePrefix+this.storeName,this.dbVersion=parseInt(this.dbVersion,10)||1,t&&(this.onStoreReady=t);var i="object"==typeof window?window:self,o=this.implementationPreference.filter(function(e){return e in i});this.implementation=o[0],this.idb=i[this.implementation],this.keyRange=i.IDBKeyRange||i.webkitIDBKeyRange||i.mozIDBKeyRange,this.consts={READ_ONLY:"readonly",READ_WRITE:"readwrite",VERSION_CHANGE:"versionchange",NEXT:"next",NEXT_NO_DUPLICATE:"nextunique",PREV:"prev",PREV_NO_DUPLICATE:"prevunique"},this.openDB()},o={constructor:i,version:"1.7.2",db:null,dbName:null,dbVersion:null,store:null,storeName:null,storePrefix:null,keyPath:null,autoIncrement:null,indexes:null,implementationPreference:null,implementation:"",onStoreReady:null,onError:null,_insertIdCount:0,openDB:function(){var e=this.idb.open(this.dbName,this.dbVersion),t=!1;e.onerror=function(e){if(function(e){return"error"in e.target?"VersionError"==e.target.error.name:"errorCode"in e.target&&12==e.target.errorCode}(e))this.onError(new Error("The version number provided is lower than the existing one."));else{var t;if(e.target.error)t=e.target.error;else{var r="IndexedDB unknown error occurred when opening DB "+this.dbName+" version "+this.dbVersion;"errorCode"in e.target&&(r+=" with error code "+e.target.errorCode),t=new Error(r)}this.onError(t)}}.bind(this),e.onsuccess=function(e){if(!t)if(this.db)this.onStoreReady();else if(this.db=e.target.result,"string"!=typeof this.db.version)if(this.db.objectStoreNames.contains(this.storeName)){var r=this.db.transaction([this.storeName],this.consts.READ_ONLY);this.store=r.objectStore(this.storeName);var n=Array.prototype.slice.call(this.getIndexList());this.indexes.forEach(function(e){var r=e.name;if(!r)return t=!0,void this.onError(new Error("Cannot create index: No index name given."));if(this.normalizeIndexData(e),this.hasIndex(r)){var i=this.store.index(r);this.indexComplies(i,e)||(t=!0,this.onError(new Error('Cannot modify index "'+r+'" for current version. Please bump version number to '+(this.dbVersion+1)+"."))),n.splice(n.indexOf(r),1)}else t=!0,this.onError(new Error('Cannot create new index "'+r+'" for current version. Please bump version number to '+(this.dbVersion+1)+"."))},this),n.length&&(t=!0,this.onError(new Error('Cannot delete index(es) "'+n.toString()+'" for current version. Please bump version number to '+(this.dbVersion+1)+"."))),t||this.onStoreReady()}else this.onError(new Error("Object store couldn't be created."));else this.onError(new Error("The IndexedDB implementation in this browser is outdated. Please upgrade your browser."))}.bind(this),e.onupgradeneeded=function(e){if(this.db=e.target.result,this.db.objectStoreNames.contains(this.storeName))this.store=e.target.transaction.objectStore(this.storeName);else{var r={autoIncrement:this.autoIncrement};null!==this.keyPath&&(r.keyPath=this.keyPath),this.store=this.db.createObjectStore(this.storeName,r)}var n=Array.prototype.slice.call(this.getIndexList());this.indexes.forEach(function(e){var r=e.name;if(r||(t=!0,this.onError(new Error("Cannot create index: No index name given."))),this.normalizeIndexData(e),this.hasIndex(r)){var i=this.store.index(r);this.indexComplies(i,e)||(this.store.deleteIndex(r),this.store.createIndex(r,e.keyPath,{unique:e.unique,multiEntry:e.multiEntry})),n.splice(n.indexOf(r),1)}else this.store.createIndex(r,e.keyPath,{unique:e.unique,multiEntry:e.multiEntry})},this),n.length&&n.forEach(function(e){this.store.deleteIndex(e)},this)}.bind(this)},deleteDatabase:function(e,t){if(this.idb.deleteDatabase){this.db.close();var r=this.idb.deleteDatabase(this.dbName);r.onsuccess=e,r.onerror=t}else t(new Error("Browser does not support IndexedDB deleteDatabase!"))},put:function(e,n,i,o){null!==this.keyPath&&(o=i,i=n,n=e),o||(o=t),i||(i=r);var s,a=!1,c=null,f=this.db.transaction([this.storeName],this.consts.READ_WRITE);return f.oncomplete=function(){(a?i:o)(c)},f.onabort=o,f.onerror=o,null!==this.keyPath?(this._addIdPropertyIfNeeded(n),s=f.objectStore(this.storeName).put(n)):s=f.objectStore(this.storeName).put(n,e),s.onsuccess=function(e){a=!0,c=e.target.result},s.onerror=o,f},get:function(e,n,i){i||(i=t),n||(n=r);var o=!1,s=null,a=this.db.transaction([this.storeName],this.consts.READ_ONLY);a.oncomplete=function(){(o?n:i)(s)},a.onabort=i,a.onerror=i;var c=a.objectStore(this.storeName).get(e);return c.onsuccess=function(e){o=!0,s=e.target.result},c.onerror=i,a},remove:function(e,n,i){i||(i=t),n||(n=r);var o=!1,s=null,a=this.db.transaction([this.storeName],this.consts.READ_WRITE);a.oncomplete=function(){(o?n:i)(s)},a.onabort=i,a.onerror=i;var c=a.objectStore(this.storeName).delete(e);return c.onsuccess=function(e){o=!0,s=e.target.result},c.onerror=i,a},batch:function(e,n,i){if(i||(i=t),n||(n=r),"[object Array]"!=Object.prototype.toString.call(e))i(new Error("dataArray argument must be of type Array."));else if(0===e.length)return n(!0);var o=e.length,s=!1,a=!1,c=this.db.transaction([this.storeName],this.consts.READ_WRITE);c.oncomplete=function(){(a?n:i)(a)},c.onabort=i,c.onerror=i;var f=function(){0!==--o||s||(s=!0,a=!0)};return e.forEach(function(e){var t=e.type,r=e.key,n=e.value,o=function(e){c.abort(),s||(s=!0,i(e,t,r))};if("remove"==t){var a=c.objectStore(this.storeName).delete(r);a.onsuccess=f,a.onerror=o}else if("put"==t){var u;null!==this.keyPath?(this._addIdPropertyIfNeeded(n),u=c.objectStore(this.storeName).put(n)):u=c.objectStore(this.storeName).put(n,r),u.onsuccess=f,u.onerror=o}},this),c},putBatch:function(e,t,r){var n=e.map(function(e){return{type:"put",value:e}});return this.batch(n,t,r)},upsertBatch:function(e,n,i,o){"function"==typeof n&&(o=i=n,n={}),o||(o=t),i||(i=r),n||(n={}),"[object Array]"!=Object.prototype.toString.call(e)&&o(new Error("dataArray argument must be of type Array."));var s=n.keyField||this.keyPath,a=e.length,c=!1,f=!1,u=0,h=this.db.transaction([this.storeName],this.consts.READ_WRITE);h.oncomplete=function(){f?i(e):o(!1)},h.onabort=o,h.onerror=o;var d=function(t){e[u++][s]=t.target.result,0!==--a||c||(c=!0,f=!0)};return e.forEach(function(e){var t,r=e.key;null!==this.keyPath?(this._addIdPropertyIfNeeded(e),t=h.objectStore(this.storeName).put(e)):t=h.objectStore(this.storeName).put(e,r),t.onsuccess=d,t.onerror=function(e){h.abort(),c||(c=!0,o(e))}},this),h},removeBatch:function(e,t,r){var n=e.map(function(e){return{type:"remove",key:e}});return this.batch(n,t,r)},getBatch:function(e,n,i,o){if(i||(i=t),n||(n=r),o||(o="sparse"),"[object Array]"!=Object.prototype.toString.call(e))i(new Error("keyArray argument must be of type Array."));else if(0===e.length)return n([]);var s=[],a=e.length,c=!1,f=!1,u=null,h=this.db.transaction([this.storeName],this.consts.READ_ONLY);h.oncomplete=function(){(f?n:i)(u)},h.onabort=i,h.onerror=i;var d=function(e){e.target.result||"dense"==o?s.push(e.target.result):"sparse"==o&&s.length++,0===--a&&(c=!0,f=!0,u=s)};return e.forEach(function(e){var t=h.objectStore(this.storeName).get(e);t.onsuccess=d,t.onerror=function(e){c=!0,u=e,i(e),h.abort()}},this),h},getAll:function(e,n){n||(n=t),e||(e=r);var i=this.db.transaction([this.storeName],this.consts.READ_ONLY),o=i.objectStore(this.storeName);return o.getAll?this._getAllNative(i,o,e,n):this._getAllCursor(i,o,e,n),i},_getAllNative:function(e,t,r,n){var i=!1,o=null;e.oncomplete=function(){(i?r:n)(o)},e.onabort=n,e.onerror=n;var s=t.getAll();s.onsuccess=function(e){i=!0,o=e.target.result},s.onerror=n},_getAllCursor:function(e,t,r,n){var i=[],o=!1,s=null;e.oncomplete=function(){(o?r:n)(s)},e.onabort=n,e.onerror=n;var a=t.openCursor();a.onsuccess=function(e){var t=e.target.result;t?(i.push(t.value),t.continue()):(o=!0,s=i)},a.onError=n},clear:function(e,n){n||(n=t),e||(e=r);var i=!1,o=null,s=this.db.transaction([this.storeName],this.consts.READ_WRITE);s.oncomplete=function(){(i?e:n)(o)},s.onabort=n,s.onerror=n;var a=s.objectStore(this.storeName).clear();return a.onsuccess=function(e){i=!0,o=e.target.result},a.onerror=n,s},_addIdPropertyIfNeeded:function(e){void 0===e[this.keyPath]&&(e[this.keyPath]=this._insertIdCount+++Date.now())},getIndexList:function(){return this.store.indexNames},hasIndex:function(e){return this.store.indexNames.contains(e)},normalizeIndexData:function(e){e.keyPath=e.keyPath||e.name,e.unique=!!e.unique,e.multiEntry=!!e.multiEntry},indexComplies:function(e,t){return["keyPath","unique","multiEntry"].every(function(r){if("multiEntry"==r&&void 0===e[r]&&!1===t[r])return!0;if("keyPath"==r&&"[object Array]"==Object.prototype.toString.call(t[r])){var n=t.keyPath,i=e.keyPath;if("string"==typeof i)return n.toString()==i;if("function"!=typeof i.contains&&"function"!=typeof i.indexOf)return!1;if(i.length!==n.length)return!1;for(var o=0,s=n.length;o<s;o++)if(!(i.contains&&i.contains(n[o])||i.indexOf(-1!==n[o])))return!1;return!0}return t[r]==e[r]})},iterate:function(r,n){var i="desc"==(n=e({index:null,order:"ASC",autoContinue:!0,filterDuplicates:!1,keyRange:null,writeAccess:!1,onEnd:null,onError:t,limit:1/0,offset:0,allowItemRejection:!1},n||{})).order.toLowerCase()?"PREV":"NEXT";n.filterDuplicates&&(i+="_NO_DUPLICATE");var o=!1,s=this.db.transaction([this.storeName],this.consts[n.writeAccess?"READ_WRITE":"READ_ONLY"]),a=s.objectStore(this.storeName);n.index&&(a=a.index(n.index));var c=0;s.oncomplete=function(){o?n.onEnd?n.onEnd():r(null):n.onError(null)},s.onabort=n.onError,s.onerror=n.onError;var f=a.openCursor(n.keyRange,this.consts[i]);return f.onerror=n.onError,f.onsuccess=function(e){var t=e.target.result;if(t)if(n.offset)t.advance(n.offset),n.offset=0;else{var i=r(t.value,t,s);n.allowItemRejection&&!1===i||c++,n.autoContinue&&(c+n.offset<n.limit?t.continue():o=!0)}else o=!0},s},query:function(e,t){var r=[],n=0;return t=t||{},t.autoContinue=!0,t.writeAccess=!1,t.allowItemRejection=!!t.filter,t.onEnd=function(){e(r,n)},this.iterate(function(e){n++;var i=!t.filter||t.filter(e);return!1!==i&&r.push(e),i},t)},count:function(r,n){var i=(n=e({index:null,keyRange:null},n||{})).onError||t,o=!1,s=null,a=this.db.transaction([this.storeName],this.consts.READ_ONLY);a.oncomplete=function(){(o?r:i)(s)},a.onabort=i,a.onerror=i;var c=a.objectStore(this.storeName);n.index&&(c=c.index(n.index));var f=c.count(n.keyRange);return f.onsuccess=function(e){o=!0,s=e.target.result},f.onError=i,a},makeKeyRange:function(e){var t,r=void 0!==e.lower,n=void 0!==e.upper;switch(!0){case void 0!==e.only:t=this.keyRange.only(e.only);break;case r&&n:t=this.keyRange.bound(e.lower,e.upper,e.excludeLower,e.excludeUpper);break;case r:t=this.keyRange.lowerBound(e.lower,e.excludeLower);break;case n:t=this.keyRange.upperBound(e.upper,e.excludeUpper);break;default:throw new Error('Cannot create KeyRange. Provide one or both of "lower" or "upper" value, or an "only" value.')}return t}},s={};return i.prototype=o,i.version=o.version,i})},function(e,t){e.exports=function(){for(var e={},t=0;t<arguments.length;t++){var r=arguments[t];for(var n in r)r.hasOwnProperty(n)&&(e[n]=r[n])}return 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?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(t,r(0))},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._checkKeyValue(e,"key",this._db._isBuffer);if(r)throw r;if(r=this._db._checkKeyValue(t,"value",this._db._isBuffer))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._checkKeyValue(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(t,r(0))},function(e,t,r){function n(e,t){t||(t={}),this.options=t,o.call(this,e),this._order=t.reverse?"DESC":"ASC",this._limit=t.limit,this._count=0,this._done=!1;var r=s.lowerBound(t),n=s.upperBound(t);try{this._keyRange=r||n?this.db.makeKeyRange({lower:r,upper:n,excludeLower:s.lowerBoundExclusive(t),excludeUpper:s.upperBoundExclusive(t)}):null}catch(e){this._keyRangeError=!0}this.callback=null}var i=r(6),o=r(68).AbstractIterator,s=r(193);e.exports=n,i.inherits(n,o),n.prototype.createIterator=function(){var e=this;e.iterator=e.db.iterate(function(){e.onItem.apply(e,arguments)},{keyRange:e._keyRange,autoContinue:!1,order:e._order,onError:function(e){console.log("horrible error",e)}})},n.prototype.onItem=function(e,t,r){if(!t&&this.callback)return this.callback(),void(this.callback=!1);var n=!0;this._limit&&this._limit>0&&this._count++>=this._limit&&(n=!1),n&&this.callback(!1,t.key,t.value),t&&t.continue()},n.prototype._next=function(e){return e?this._keyRangeError?e():(this._started||(this.createIterator(),this._started=!0),void(this.callback=e)):new Error("next() requires a callback argument")}},function(e,t,r){(function(e){function r(e,t){return Object.hasOwnProperty.call(e,t)}function n(e){return void 0!==e&&""!==e}function r(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!r(e,"gt")},c=t.upperBoundInclusive=function(e){return!r(e,"lt")},f=t.lowerBoundExclusive=function(e){return!a(e)},u=t.upperBoundExclusive=function(e){return!c(e)},h=t.upperBoundKey=function(e){return i(e,"lt")||i(e,"lte")||i(e,"max")||(e.reverse?i(e,"start"):i(e,"end"))||void 0},d=t.upperBound=function(e,t){var r=h(e);return r?e[r]:t};t.start=function(e,t){return e.reverse?d(e,t):s(e,t)},t.end=function(e,t){return e.reverse?s(e,t):d(e,t)},t.startInclusive=function(e){return e.reverse?c(e):a(e)},t.endInclusive=function(e){return e.reverse?a(e):c(e)},t.toLtgt=function(e,n,i,o,s){n=n||{},i=i||function(e){return e};var a=arguments.length>3,c=t.lowerBoundKey(e),f=t.upperBoundKey(e);return c?"gt"===c?n.gt=i(e.gt,!1):n.gte=i(e[c],!1):a&&(n.gte=i(o,!1)),f?"lt"===f?n.lt=i(e.lt,!0):n.lte=i(e[f],!0):a&&(n.lte=i(s,!0)),null!=e.reverse&&(n.reverse=!!e.reverse),r(n,"max")&&delete n.max,r(n,"min")&&delete n.min,r(n,"start")&&delete n.start,r(n,"end")&&delete n.end,n},t.contains=function(e,r,i){i=i||t.compare;var o=s(e);if(n(o)){if((c=i(r,o))<0||0===c&&f(e))return!1}var a=d(e);if(n(a)){var c;if((c=i(r,a))>0||0===c&&u(e))return!1}return!0},t.filter=function(e,r){return function(n){return t.contains(e,n,r)}}}).call(t,r(1).Buffer)},function(e,t,r){var n=r(1).Buffer;e.exports=function(e){return n.isBuffer(e)||/\[object (.+Array|Array.+)\]/.test(Object.prototype.toString.call(e))}},function(e,t,r){var n=r(196),i=r(200);e.exports=function(){for(var e={},t=0;t<arguments.length;t++){var r=arguments[t];if(i(r))for(var o=n(r),s=0;s<o.length;s++){var a=o[s];e[a]=r[a]}}return e}},function(e,t,r){e.exports=Object.keys||r(197)},function(e,t,r){!function(){"use strict";var t,n=Object.prototype.hasOwnProperty,i=Object.prototype.toString,o=r(198),s=r(199),a=!{toString:null}.propertyIsEnumerable("toString"),c=function(){}.propertyIsEnumerable("prototype"),f=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"];t=function(e){var t=null!==e&&"object"==typeof e,r="[object Function]"===i.call(e),u=s(e),h=[];if(!t&&!r&&!u)throw new TypeError("Object.keys called on a non-object");if(u)o(e,function(e){h.push(e)});else{var d,l=c&&r;for(d in e)l&&"prototype"===d||!n.call(e,d)||h.push(d)}if(a){var p=e.constructor,b=p&&p.prototype===e;o(f,function(t){b&&"constructor"===t||!n.call(e,t)||h.push(t)})}return h},e.exports=t}()},function(e,t){var r=Object.prototype.hasOwnProperty,n=Object.prototype.toString;e.exports=function(e,t){if(!function(e){var t="function"==typeof e&&!(e instanceof RegExp)||"[object Function]"===n.call(e);return t||"undefined"==typeof window||(t=e===window.setTimeout||e===window.alert||e===window.confirm||e===window.prompt),t}(t))throw new TypeError("iterator must be a function");var i,o,s="string"==typeof e,a=e.length,c=arguments.length>2?arguments[2]:null;if(a===+a)for(i=0;i<a;i++)null===c?t(s?e.charAt(i):e[i],i,e):t.call(c,s?e.charAt(i):e[i],i,e);else for(o in e)r.call(e,o)&&(null===c?t(e[o],o,e):t.call(c,e[o],o,e))}},function(e,t){var r=Object.prototype.toString;e.exports=function(e){var t=r.call(e),n="[object Arguments]"===t;return n||(n="[object Array]"!==t&&null!==e&&"object"==typeof e&&"number"==typeof e.length&&e.length>=0&&"[object Function]"===r.call(e.callee)),n}},function(e,t){e.exports=function(e){return null!==e&&("object"==typeof e||"function"==typeof e)}},function(e,t,r){(function(t){e.exports=function(e){return"function"==typeof t._augment&&t.TYPED_ARRAY_SUPPORT?t._augment(e):new t(e)}}).call(t,r(1).Buffer)},function(e,t,r){"use strict";(function(t){const n=r(203);e.exports=class extends n{constructor(e){super(),this._ipfs=e}async load(e){0===e.indexOf("/ipfs")&&(e=e.split("/")[2]);try{const t=await this._ipfs.object.get(e),r=JSON.parse(t.toJSON().data);this._access=r}catch(e){console.log("ACCESS ERROR:",e)}}async save(){let e;try{const r=JSON.stringify(this._access,null,2);e=(await this._ipfs.object.put(new t(r))).toJSON().multihash.toString()}catch(e){console.log("ACCESS ERROR:",e)}return e}}}).call(t,r(1).Buffer)},function(e,t,r){"use strict";e.exports=class{constructor(){this._access={admin:[],write:[],read:[]}}async load(e){}async save(){}get admin(){return this._access.admin}get write(){return this._access.write.concat(this._access.admin)}get read(){return this._access.read}add(e,t){switch(e){case"admin":this._access.admin.push(t);break;case"write":this._access.write.push(t);break;case"read":this._access.read.push(t)}}remove(e,t){const r=(e,r)=>e.reduce((e,r)=>(r!==t&&e.push(r),e),[]);switch(e){case"admin":this._access.admin=r(this._access.admin);break;case"write":this._access.write=r(this._access.write);break;case"read":this._access.read=r(this._access.read)}}}},function(e,t,r){"use strict";const n=r(12),i=r(205);class o{constructor(e,t){this.root=e,this.path=t}toString(){return n.join("/orbitdb",this.root,this.path)}static isValid(e){const t=e.toString().split("/").filter((t,r)=>!((0===r||1===r)&&0===e.toString().indexOf("/orbit")&&"orbitdb"===t)).filter(e=>""!==e&&" "!==e),r=t[0].indexOf("Qm")>-1?i.fromB58String(t[0]):null;try{i.validate(r)}catch(e){return!1}return null!==r}static parse(e){if(!e)throw new Error(`Not a valid OrbitDB address: ${e}`);if(!o.isValid(e))throw new Error(`Not a valid OrbitDB address: ${e}`);const t=e.toString().split("/").filter((t,r)=>!((0===r||1===r)&&0===e.toString().indexOf("/orbit")&&"orbitdb"===t)).filter(e=>""!==e&&" "!==e);return new o(t[0],t.slice(1,t.length).join("/"))}}e.exports=o},function(e,t,r){"use strict";(function(e){function n(e){t.decode(e)}const i=r(206),o=r(208);t.names=o.names,t.codes=o.codes,t.defaultLengths=o.defaultLengths;const s=r(209);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 i.encode(t)},t.fromB58String=function(t){let r=t;return e.isBuffer(t)&&(r=t.toString()),e.from(i.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=s.decode(r);if(!t.isValidCode(n))throw new Error(`multihash unknown function code: 0x${n.toString(16)}`);r=r.slice(s.decode.bytes);let i=s.decode(r);if(i<1)throw new Error(`multihash invalid length: 0x${i.toString(16)}`);if((r=r.slice(s.decode.bytes)).length!==i)throw new Error(`multihash length inconsistent: 0x${r.toString("hex")}`);return{code:n,name:o.codes[n],length:i,digest:r}},t.encode=function(r,n,i){if(!r||!n)throw new Error("multihash encode requires at least two args: digest, code");const o=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(s.encode(o)),e.from(s.encode(i)),r])},t.coerceCode=function(e){let r=e;if("string"==typeof e){if(!o.names[e])throw new Error(`Unrecognized hash function named: ${e}`);r=o.names[e]}if("number"!=typeof r)throw new Error(`Hash function code should be a number. Got: ${r}`);if(!o.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)||!!o.codes[e]},t.validate=n,t.prefix=function(e){return n(e),e.slice(0,2)}}).call(t,r(1).Buffer)},function(e,t,r){var n=r(207);e.exports=n("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz")},function(e,t,r){var n=r(9).Buffer;e.exports=function(e){function t(e){if("string"!=typeof e)throw new TypeError("Expected String");if(0===e.length)return n.allocUnsafe(0);for(var t=[0],s=0;s<e.length;s++){var a=r[e[s]];if(void 0===a)return;for(var c=0,f=a;c<t.length;++c)f+=t[c]*i,t[c]=255&f,f>>=8;for(;f>0;)t.push(255&f),f>>=8}for(var u=0;e[u]===o&&u<e.length-1;++u)t.push(0);return n.from(t.reverse())}for(var r={},i=e.length,o=e.charAt(0),s=0;s<e.length;s++){var a=e.charAt(s);if(void 0!==r[a])throw new TypeError(a+" is ambiguous");r[a]=s}return{encode:function(t){if(0===t.length)return"";for(var r=[0],n=0;n<t.length;++n){for(var o=0,s=t[n];o<r.length;++o)s+=r[o]<<8,r[o]=s%i,s=s/i|0;for(;s>0;)r.push(s%i),s=s/i|0}for(var a="",c=0;0===t[c]&&c<t.length-1;++c)a+=e[0];for(var f=r.length-1;f>=0;--f)a+=e[r[f]];return a},decodeUnsafe:t,decode:function(e){var r=t(e);if(r)return r;throw new Error("Non-base"+i+" character")}}}},function(e,t,r){"use strict";t.names=Object.freeze({sha1:17,"sha2-256":18,"sha2-512":19,"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",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",46e3:"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,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,46e3: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){e.exports={encode:r(210),decode:r(211),encodingLength:r(212)}},function(e,t){function r(e,t,s){t=t||[];for(var a=s=s||0;e>=o;)t[s++]=255&e|n,e/=128;for(;e&i;)t[s++]=255&e|n,e>>>=7;return t[s]=0|e,r.bytes=s-a+1,t}e.exports=r;var n=128,i=-128,o=Math.pow(2,31)},function(e,t){function r(e,t){var o,s=0,a=0,c=t=t||0,f=e.length;do{if(c>=f)throw r.bytes=0,new RangeError("Could not decode varint");o=e[c++],s+=a<28?(o&i)<<a:(o&i)*Math.pow(2,a),a+=7}while(o>=n);return r.bytes=c-t,s}e.exports=r;var n=128,i=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),c=Math.pow(2,49),f=Math.pow(2,56),u=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<c?7:e<f?8:e<u?9:10}},function(e,t,r){(function(t){const n=r(12);e.exports=(async(e,r,i,o)=>{const s={name:r,type:i,accessController:n.join("/ipfs",o)};return(await e.object.put(t.from(JSON.stringify(s)))).toJSON().multihash.toString()})}).call(t,r(1).Buffer)}]); |