1 line
376 KiB
JavaScript
1 line
376 KiB
JavaScript
var OrbitDB=function(t){function e(r){if(n[r])return n[r].exports;var i=n[r]={i:r,l:!1,exports:{}};return t[r].call(i.exports,i,i.exports,e),i.l=!0,i.exports}var n={};return e.m=t,e.c=n,e.d=function(t,n,r){e.o(t,n)||Object.defineProperty(t,n,{configurable:!1,enumerable:!0,get:r})},e.n=function(t){var n=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(n,"a",n),n},e.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},e.p="",e(e.s=61)}([function(t,e){function n(){throw new Error("setTimeout has not been defined")}function r(){throw new Error("clearTimeout has not been defined")}function i(t){if(f===setTimeout)return setTimeout(t,0);if((f===n||!f)&&setTimeout)return f=setTimeout,setTimeout(t,0);try{return f(t,0)}catch(e){try{return f.call(null,t,0)}catch(e){return f.call(this,t,0)}}}function o(){p&&d&&(p=!1,d.length?l=d.concat(l):b=-1,l.length&&s())}function s(){if(!p){var t=i(o);p=!0;for(var e=l.length;e;){for(d=l,l=[];++b<e;)d&&d[b].run();b=-1,e=l.length}d=null,p=!1,function(t){if(u===clearTimeout)return clearTimeout(t);if((u===r||!u)&&clearTimeout)return u=clearTimeout,clearTimeout(t);try{u(t)}catch(e){try{return u.call(null,t)}catch(e){return u.call(this,t)}}}(t)}}function a(t,e){this.fun=t,this.array=e}function c(){}var f,u,h=t.exports={};!function(){try{f="function"==typeof setTimeout?setTimeout:n}catch(t){f=n}try{u="function"==typeof clearTimeout?clearTimeout:r}catch(t){u=r}}();var d,l=[],p=!1,b=-1;h.nextTick=function(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)e[n-1]=arguments[n];l.push(new a(t,e)),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(t){return[]},h.binding=function(t){throw new Error("process.binding is not supported")},h.cwd=function(){return"/"},h.chdir=function(t){throw new Error("process.chdir is not supported")},h.umask=function(){return 0}},function(t,e,n){"use strict";(function(t){function r(){return o.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function i(t,e){if(r()<e)throw new RangeError("Invalid typed array length");return o.TYPED_ARRAY_SUPPORT?(t=new Uint8Array(e)).__proto__=o.prototype:(null===t&&(t=new o(e)),t.length=e),t}function o(t,e,n){if(!(o.TYPED_ARRAY_SUPPORT||this instanceof o))return new o(t,e,n);if("number"==typeof t){if("string"==typeof e)throw new Error("If encoding is specified then the first argument must be a string");return c(this,t)}return s(this,t,e,n)}function s(t,e,n,r){if("number"==typeof e)throw new TypeError('"value" argument must not be a number');return"undefined"!=typeof ArrayBuffer&&e instanceof ArrayBuffer?function(t,e,n,r){if(e.byteLength,n<0||e.byteLength<n)throw new RangeError("'offset' is out of bounds");if(e.byteLength<n+(r||0))throw new RangeError("'length' is out of bounds");e=void 0===n&&void 0===r?new Uint8Array(e):void 0===r?new Uint8Array(e,n):new Uint8Array(e,n,r);o.TYPED_ARRAY_SUPPORT?(t=e).__proto__=o.prototype:t=f(t,e);return t}(t,e,n,r):"string"==typeof e?function(t,e,n){"string"==typeof n&&""!==n||(n="utf8");if(!o.isEncoding(n))throw new TypeError('"encoding" must be a valid string encoding');var r=0|h(e,n),s=(t=i(t,r)).write(e,n);s!==r&&(t=t.slice(0,s));return t}(t,e,n):function(t,e){if(o.isBuffer(e)){var n=0|u(e.length);return 0===(t=i(t,n)).length?t:(e.copy(t,0,0,n),t)}if(e){if("undefined"!=typeof ArrayBuffer&&e.buffer instanceof ArrayBuffer||"length"in e)return"number"!=typeof e.length||function(t){return t!=t}(e.length)?i(t,0):f(t,e);if("Buffer"===e.type&&T(e.data))return f(t,e.data)}throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}(t,e)}function a(t){if("number"!=typeof t)throw new TypeError('"size" argument must be a number');if(t<0)throw new RangeError('"size" argument must not be negative')}function c(t,e){if(a(e),t=i(t,e<0?0:0|u(e)),!o.TYPED_ARRAY_SUPPORT)for(var n=0;n<e;++n)t[n]=0;return t}function f(t,e){var n=e.length<0?0:0|u(e.length);t=i(t,n);for(var r=0;r<n;r+=1)t[r]=255&e[r];return t}function u(t){if(t>=r())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+r().toString(16)+" bytes");return 0|t}function h(t,e){if(o.isBuffer(t))return t.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(t)||t instanceof ArrayBuffer))return t.byteLength;"string"!=typeof t&&(t=""+t);var n=t.length;if(0===n)return 0;for(var r=!1;;)switch(e){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":case void 0:return P(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return C(t).length;default:if(r)return P(t).length;e=(""+e).toLowerCase(),r=!0}}function d(t,e,n){var r=!1;if((void 0===e||e<0)&&(e=0),e>this.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if(n>>>=0,e>>>=0,n<=e)return"";for(t||(t="utf8");;)switch(t){case"hex":return function(t,e,n){var r=t.length;(!e||e<0)&&(e=0);(!n||n<0||n>r)&&(n=r);for(var i="",o=e;o<n;++o)i+=function(t){return t<16?"0"+t.toString(16):t.toString(16)}(t[o]);return i}(this,e,n);case"utf8":case"utf-8":return S(this,e,n);case"ascii":return function(t,e,n){var r="";n=Math.min(t.length,n);for(var i=e;i<n;++i)r+=String.fromCharCode(127&t[i]);return r}(this,e,n);case"latin1":case"binary":return function(t,e,n){var r="";n=Math.min(t.length,n);for(var i=e;i<n;++i)r+=String.fromCharCode(t[i]);return r}(this,e,n);case"base64":return function(t,e,n){return 0===e&&n===t.length?R.fromByteArray(t):R.fromByteArray(t.slice(e,n))}(this,e,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return function(t,e,n){for(var r=t.slice(e,n),i="",o=0;o<r.length;o+=2)i+=String.fromCharCode(r[o]+256*r[o+1]);return i}(this,e,n);default:if(r)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),r=!0}}function l(t,e,n){var r=t[e];t[e]=t[n],t[n]=r}function p(t,e,n,r,i){if(0===t.length)return-1;if("string"==typeof n?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),n=+n,isNaN(n)&&(n=i?0:t.length-1),n<0&&(n=t.length+n),n>=t.length){if(i)return-1;n=t.length-1}else if(n<0){if(!i)return-1;n=0}if("string"==typeof e&&(e=o.from(e,r)),o.isBuffer(e))return 0===e.length?-1:b(t,e,n,r,i);if("number"==typeof e)return e&=255,o.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(t,e,n):Uint8Array.prototype.lastIndexOf.call(t,e,n):b(t,[e],n,r,i);throw new TypeError("val must be string, number or Buffer")}function b(t,e,n,r,i){function o(t,e){return 1===s?t[e]:t.readUInt16BE(e*s)}var s=1,a=t.length,c=e.length;if(void 0!==r&&("ucs2"===(r=String(r).toLowerCase())||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(t.length<2||e.length<2)return-1;s=2,a/=2,c/=2,n/=2}var f;if(i){var u=-1;for(f=n;f<a;f++)if(o(t,f)===o(e,-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(n+c>a&&(n=a-c),f=n;f>=0;f--){for(var h=!0,d=0;d<c;d++)if(o(t,f+d)!==o(e,d)){h=!1;break}if(h)return f}return-1}function y(t,e,n,r){n=Number(n)||0;var i=t.length-n;r?(r=Number(r))>i&&(r=i):r=i;var o=e.length;if(o%2!=0)throw new TypeError("Invalid hex string");r>o/2&&(r=o/2);for(var s=0;s<r;++s){var a=parseInt(e.substr(2*s,2),16);if(isNaN(a))return s;t[n+s]=a}return s}function m(t,e,n,r){return N(P(e,t.length-n),t,n,r)}function g(t,e,n,r){return N(function(t){for(var e=[],n=0;n<t.length;++n)e.push(255&t.charCodeAt(n));return e}(e),t,n,r)}function v(t,e,n,r){return g(t,e,n,r)}function _(t,e,n,r){return N(C(e),t,n,r)}function w(t,e,n,r){return N(function(t,e){for(var n,r,i,o=[],s=0;s<t.length&&!((e-=2)<0);++s)n=t.charCodeAt(s),r=n>>8,i=n%256,o.push(i),o.push(r);return o}(e,t.length-n),t,n,r)}function S(t,e,n){n=Math.min(t.length,n);for(var r=[],i=e;i<n;){var o=t[i],s=null,a=o>239?4:o>223?3:o>191?2:1;if(i+a<=n){var c,f,u,h;switch(a){case 1:o<128&&(s=o);break;case 2:128==(192&(c=t[i+1]))&&(h=(31&o)<<6|63&c)>127&&(s=h);break;case 3:c=t[i+1],f=t[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=t[i+1],f=t[i+2],u=t[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,r.push(s>>>10&1023|55296),s=56320|1023&s),r.push(s),i+=a}return function(t){var e=t.length;if(e<=L)return String.fromCharCode.apply(String,t);var n="",r=0;for(;r<e;)n+=String.fromCharCode.apply(String,t.slice(r,r+=L));return n}(r)}function k(t,e,n){if(t%1!=0||t<0)throw new RangeError("offset is not uint");if(t+e>n)throw new RangeError("Trying to access beyond buffer length")}function x(t,e,n,r,i,s){if(!o.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>i||e<s)throw new RangeError('"value" argument is out of bounds');if(n+r>t.length)throw new RangeError("Index out of range")}function E(t,e,n,r){e<0&&(e=65535+e+1);for(var i=0,o=Math.min(t.length-n,2);i<o;++i)t[n+i]=(e&255<<8*(r?i:1-i))>>>8*(r?i:1-i)}function M(t,e,n,r){e<0&&(e=4294967295+e+1);for(var i=0,o=Math.min(t.length-n,4);i<o;++i)t[n+i]=e>>>8*(r?i:3-i)&255}function A(t,e,n,r,i,o){if(n+r>t.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function O(t,e,n,r,i){return i||A(t,0,n,4),j.write(t,e,n,r,23,4),n+4}function I(t,e,n,r,i){return i||A(t,0,n,8),j.write(t,e,n,r,52,8),n+8}function P(t,e){e=e||1/0;for(var n,r=t.length,i=null,o=[],s=0;s<r;++s){if((n=t.charCodeAt(s))>55295&&n<57344){if(!i){if(n>56319){(e-=3)>-1&&o.push(239,191,189);continue}if(s+1===r){(e-=3)>-1&&o.push(239,191,189);continue}i=n;continue}if(n<56320){(e-=3)>-1&&o.push(239,191,189),i=n;continue}n=65536+(i-55296<<10|n-56320)}else i&&(e-=3)>-1&&o.push(239,191,189);if(i=null,n<128){if((e-=1)<0)break;o.push(n)}else if(n<2048){if((e-=2)<0)break;o.push(n>>6|192,63&n|128)}else if(n<65536){if((e-=3)<0)break;o.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((e-=4)<0)break;o.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return o}function C(t){return R.toByteArray(function(t){if((t=function(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}(t).replace(D,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function N(t,e,n,r){for(var i=0;i<r&&!(i+n>=e.length||i>=t.length);++i)e[i+n]=t[i];return i}var R=n(63),j=n(64),T=n(33);e.Buffer=o,e.SlowBuffer=function(t){return+t!=t&&(t=0),o.alloc(+t)},e.INSPECT_MAX_BYTES=50,o.TYPED_ARRAY_SUPPORT=void 0!==t.TYPED_ARRAY_SUPPORT?t.TYPED_ARRAY_SUPPORT:function(){try{var t=new Uint8Array(1);return t.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===t.foo()&&"function"==typeof t.subarray&&0===t.subarray(1,1).byteLength}catch(t){return!1}}(),e.kMaxLength=r(),o.poolSize=8192,o._augment=function(t){return t.__proto__=o.prototype,t},o.from=function(t,e,n){return s(null,t,e,n)},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(t,e,n){return function(t,e,n,r){return a(e),e<=0?i(t,e):void 0!==n?"string"==typeof r?i(t,e).fill(n,r):i(t,e).fill(n):i(t,e)}(null,t,e,n)},o.allocUnsafe=function(t){return c(null,t)},o.allocUnsafeSlow=function(t){return c(null,t)},o.isBuffer=function(t){return!(null==t||!t._isBuffer)},o.compare=function(t,e){if(!o.isBuffer(t)||!o.isBuffer(e))throw new TypeError("Arguments must be Buffers");if(t===e)return 0;for(var n=t.length,r=e.length,i=0,s=Math.min(n,r);i<s;++i)if(t[i]!==e[i]){n=t[i],r=e[i];break}return n<r?-1:r<n?1:0},o.isEncoding=function(t){switch(String(t).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},o.concat=function(t,e){if(!T(t))throw new TypeError('"list" argument must be an Array of Buffers');if(0===t.length)return o.alloc(0);var n;if(void 0===e)for(e=0,n=0;n<t.length;++n)e+=t[n].length;var r=o.allocUnsafe(e),i=0;for(n=0;n<t.length;++n){var s=t[n];if(!o.isBuffer(s))throw new TypeError('"list" argument must be an Array of Buffers');s.copy(r,i),i+=s.length}return r},o.byteLength=h,o.prototype._isBuffer=!0,o.prototype.swap16=function(){var t=this.length;if(t%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var e=0;e<t;e+=2)l(this,e,e+1);return this},o.prototype.swap32=function(){var t=this.length;if(t%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var e=0;e<t;e+=4)l(this,e,e+3),l(this,e+1,e+2);return this},o.prototype.swap64=function(){var t=this.length;if(t%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var e=0;e<t;e+=8)l(this,e,e+7),l(this,e+1,e+6),l(this,e+2,e+5),l(this,e+3,e+4);return this},o.prototype.toString=function(){var t=0|this.length;return 0===t?"":0===arguments.length?S(this,0,t):d.apply(this,arguments)},o.prototype.equals=function(t){if(!o.isBuffer(t))throw new TypeError("Argument must be a Buffer");return this===t||0===o.compare(this,t)},o.prototype.inspect=function(){var t="",n=e.INSPECT_MAX_BYTES;return this.length>0&&(t=this.toString("hex",0,n).match(/.{2}/g).join(" "),this.length>n&&(t+=" ... ")),"<Buffer "+t+">"},o.prototype.compare=function(t,e,n,r,i){if(!o.isBuffer(t))throw new TypeError("Argument must be a Buffer");if(void 0===e&&(e=0),void 0===n&&(n=t?t.length:0),void 0===r&&(r=0),void 0===i&&(i=this.length),e<0||n>t.length||r<0||i>this.length)throw new RangeError("out of range index");if(r>=i&&e>=n)return 0;if(r>=i)return-1;if(e>=n)return 1;if(e>>>=0,n>>>=0,r>>>=0,i>>>=0,this===t)return 0;for(var s=i-r,a=n-e,c=Math.min(s,a),f=this.slice(r,i),u=t.slice(e,n),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(t,e,n){return-1!==this.indexOf(t,e,n)},o.prototype.indexOf=function(t,e,n){return p(this,t,e,n,!0)},o.prototype.lastIndexOf=function(t,e,n){return p(this,t,e,n,!1)},o.prototype.write=function(t,e,n,r){if(void 0===e)r="utf8",n=this.length,e=0;else if(void 0===n&&"string"==typeof e)r=e,n=this.length,e=0;else{if(!isFinite(e))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");e|=0,isFinite(n)?(n|=0,void 0===r&&(r="utf8")):(r=n,n=void 0)}var i=this.length-e;if((void 0===n||n>i)&&(n=i),t.length>0&&(n<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");r||(r="utf8");for(var o=!1;;)switch(r){case"hex":return y(this,t,e,n);case"utf8":case"utf-8":return m(this,t,e,n);case"ascii":return g(this,t,e,n);case"latin1":case"binary":return v(this,t,e,n);case"base64":return _(this,t,e,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return w(this,t,e,n);default:if(o)throw new TypeError("Unknown encoding: "+r);r=(""+r).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(t,e){var n=this.length;t=~~t,e=void 0===e?n:~~e,t<0?(t+=n)<0&&(t=0):t>n&&(t=n),e<0?(e+=n)<0&&(e=0):e>n&&(e=n),e<t&&(e=t);var r;if(o.TYPED_ARRAY_SUPPORT)(r=this.subarray(t,e)).__proto__=o.prototype;else{var i=e-t;r=new o(i,void 0);for(var s=0;s<i;++s)r[s]=this[s+t]}return r},o.prototype.readUIntLE=function(t,e,n){t|=0,e|=0,n||k(t,e,this.length);for(var r=this[t],i=1,o=0;++o<e&&(i*=256);)r+=this[t+o]*i;return r},o.prototype.readUIntBE=function(t,e,n){t|=0,e|=0,n||k(t,e,this.length);for(var r=this[t+--e],i=1;e>0&&(i*=256);)r+=this[t+--e]*i;return r},o.prototype.readUInt8=function(t,e){return e||k(t,1,this.length),this[t]},o.prototype.readUInt16LE=function(t,e){return e||k(t,2,this.length),this[t]|this[t+1]<<8},o.prototype.readUInt16BE=function(t,e){return e||k(t,2,this.length),this[t]<<8|this[t+1]},o.prototype.readUInt32LE=function(t,e){return e||k(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},o.prototype.readUInt32BE=function(t,e){return e||k(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},o.prototype.readIntLE=function(t,e,n){t|=0,e|=0,n||k(t,e,this.length);for(var r=this[t],i=1,o=0;++o<e&&(i*=256);)r+=this[t+o]*i;return i*=128,r>=i&&(r-=Math.pow(2,8*e)),r},o.prototype.readIntBE=function(t,e,n){t|=0,e|=0,n||k(t,e,this.length);for(var r=e,i=1,o=this[t+--r];r>0&&(i*=256);)o+=this[t+--r]*i;return i*=128,o>=i&&(o-=Math.pow(2,8*e)),o},o.prototype.readInt8=function(t,e){return e||k(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},o.prototype.readInt16LE=function(t,e){e||k(t,2,this.length);var n=this[t]|this[t+1]<<8;return 32768&n?4294901760|n:n},o.prototype.readInt16BE=function(t,e){e||k(t,2,this.length);var n=this[t+1]|this[t]<<8;return 32768&n?4294901760|n:n},o.prototype.readInt32LE=function(t,e){return e||k(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},o.prototype.readInt32BE=function(t,e){return e||k(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},o.prototype.readFloatLE=function(t,e){return e||k(t,4,this.length),j.read(this,t,!0,23,4)},o.prototype.readFloatBE=function(t,e){return e||k(t,4,this.length),j.read(this,t,!1,23,4)},o.prototype.readDoubleLE=function(t,e){return e||k(t,8,this.length),j.read(this,t,!0,52,8)},o.prototype.readDoubleBE=function(t,e){return e||k(t,8,this.length),j.read(this,t,!1,52,8)},o.prototype.writeUIntLE=function(t,e,n,r){if(t=+t,e|=0,n|=0,!r){x(this,t,e,n,Math.pow(2,8*n)-1,0)}var i=1,o=0;for(this[e]=255&t;++o<n&&(i*=256);)this[e+o]=t/i&255;return e+n},o.prototype.writeUIntBE=function(t,e,n,r){if(t=+t,e|=0,n|=0,!r){x(this,t,e,n,Math.pow(2,8*n)-1,0)}var i=n-1,o=1;for(this[e+i]=255&t;--i>=0&&(o*=256);)this[e+i]=t/o&255;return e+n},o.prototype.writeUInt8=function(t,e,n){return t=+t,e|=0,n||x(this,t,e,1,255,0),o.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),this[e]=255&t,e+1},o.prototype.writeUInt16LE=function(t,e,n){return t=+t,e|=0,n||x(this,t,e,2,65535,0),o.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):E(this,t,e,!0),e+2},o.prototype.writeUInt16BE=function(t,e,n){return t=+t,e|=0,n||x(this,t,e,2,65535,0),o.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):E(this,t,e,!1),e+2},o.prototype.writeUInt32LE=function(t,e,n){return t=+t,e|=0,n||x(this,t,e,4,4294967295,0),o.TYPED_ARRAY_SUPPORT?(this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t):M(this,t,e,!0),e+4},o.prototype.writeUInt32BE=function(t,e,n){return t=+t,e|=0,n||x(this,t,e,4,4294967295,0),o.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):M(this,t,e,!1),e+4},o.prototype.writeIntLE=function(t,e,n,r){if(t=+t,e|=0,!r){var i=Math.pow(2,8*n-1);x(this,t,e,n,i-1,-i)}var o=0,s=1,a=0;for(this[e]=255&t;++o<n&&(s*=256);)t<0&&0===a&&0!==this[e+o-1]&&(a=1),this[e+o]=(t/s>>0)-a&255;return e+n},o.prototype.writeIntBE=function(t,e,n,r){if(t=+t,e|=0,!r){var i=Math.pow(2,8*n-1);x(this,t,e,n,i-1,-i)}var o=n-1,s=1,a=0;for(this[e+o]=255&t;--o>=0&&(s*=256);)t<0&&0===a&&0!==this[e+o+1]&&(a=1),this[e+o]=(t/s>>0)-a&255;return e+n},o.prototype.writeInt8=function(t,e,n){return t=+t,e|=0,n||x(this,t,e,1,127,-128),o.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),t<0&&(t=255+t+1),this[e]=255&t,e+1},o.prototype.writeInt16LE=function(t,e,n){return t=+t,e|=0,n||x(this,t,e,2,32767,-32768),o.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):E(this,t,e,!0),e+2},o.prototype.writeInt16BE=function(t,e,n){return t=+t,e|=0,n||x(this,t,e,2,32767,-32768),o.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):E(this,t,e,!1),e+2},o.prototype.writeInt32LE=function(t,e,n){return t=+t,e|=0,n||x(this,t,e,4,2147483647,-2147483648),o.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24):M(this,t,e,!0),e+4},o.prototype.writeInt32BE=function(t,e,n){return t=+t,e|=0,n||x(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),o.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):M(this,t,e,!1),e+4},o.prototype.writeFloatLE=function(t,e,n){return O(this,t,e,!0,n)},o.prototype.writeFloatBE=function(t,e,n){return O(this,t,e,!1,n)},o.prototype.writeDoubleLE=function(t,e,n){return I(this,t,e,!0,n)},o.prototype.writeDoubleBE=function(t,e,n){return I(this,t,e,!1,n)},o.prototype.copy=function(t,e,n,r){if(n||(n=0),r||0===r||(r=this.length),e>=t.length&&(e=t.length),e||(e=0),r>0&&r<n&&(r=n),r===n)return 0;if(0===t.length||0===this.length)return 0;if(e<0)throw new RangeError("targetStart out of bounds");if(n<0||n>=this.length)throw new RangeError("sourceStart out of bounds");if(r<0)throw new RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),t.length-e<r-n&&(r=t.length-e+n);var i,s=r-n;if(this===t&&n<e&&e<r)for(i=s-1;i>=0;--i)t[i+e]=this[i+n];else if(s<1e3||!o.TYPED_ARRAY_SUPPORT)for(i=0;i<s;++i)t[i+e]=this[i+n];else Uint8Array.prototype.set.call(t,this.subarray(n,n+s),e);return s},o.prototype.fill=function(t,e,n,r){if("string"==typeof t){if("string"==typeof e?(r=e,e=0,n=this.length):"string"==typeof n&&(r=n,n=this.length),1===t.length){var i=t.charCodeAt(0);i<256&&(t=i)}if(void 0!==r&&"string"!=typeof r)throw new TypeError("encoding must be a string");if("string"==typeof r&&!o.isEncoding(r))throw new TypeError("Unknown encoding: "+r)}else"number"==typeof t&&(t&=255);if(e<0||this.length<e||this.length<n)throw new RangeError("Out of range index");if(n<=e)return this;e>>>=0,n=void 0===n?this.length:n>>>0,t||(t=0);var s;if("number"==typeof t)for(s=e;s<n;++s)this[s]=t;else{var a=o.isBuffer(t)?t:P(new o(t,r).toString()),c=a.length;for(s=0;s<n-e;++s)this[s+e]=a[s%c]}return this};var D=/[^+\/0-9A-Za-z-_]/g}).call(e,n(3))},function(t,e,n){"use strict";var r=e;r.version=n(109).version,r.utils=n(110),r.rand=n(112),r.curve=n(23),r.curves=n(118),r.ec=n(126),r.eddsa=n(130)},function(t,e){var n;n=function(){return this}();try{n=n||Function("return this")()||(0,eval)("this")}catch(t){"object"==typeof window&&(n=window)}t.exports=n},function(t,e){function n(){this._events=this._events||{},this._maxListeners=this._maxListeners||void 0}function r(t){return"function"==typeof t}function i(t){return"object"==typeof t&&null!==t}function o(t){return void 0===t}t.exports=n,n.EventEmitter=n,n.prototype._events=void 0,n.prototype._maxListeners=void 0,n.defaultMaxListeners=10,n.prototype.setMaxListeners=function(t){if(!function(t){return"number"==typeof t}(t)||t<0||isNaN(t))throw TypeError("n must be a positive number");return this._maxListeners=t,this},n.prototype.emit=function(t){var e,n,s,a,c,f;if(this._events||(this._events={}),"error"===t&&(!this._events.error||i(this._events.error)&&!this._events.error.length)){if((e=arguments[1])instanceof Error)throw e;var u=new Error('Uncaught, unspecified "error" event. ('+e+")");throw u.context=e,u}if(n=this._events[t],o(n))return!1;if(r(n))switch(arguments.length){case 1:n.call(this);break;case 2:n.call(this,arguments[1]);break;case 3:n.call(this,arguments[1],arguments[2]);break;default:a=Array.prototype.slice.call(arguments,1),n.apply(this,a)}else if(i(n))for(a=Array.prototype.slice.call(arguments,1),s=(f=n.slice()).length,c=0;c<s;c++)f[c].apply(this,a);return!0},n.prototype.addListener=function(t,e){var s;if(!r(e))throw TypeError("listener must be a function");return this._events||(this._events={}),this._events.newListener&&this.emit("newListener",t,r(e.listener)?e.listener:e),this._events[t]?i(this._events[t])?this._events[t].push(e):this._events[t]=[this._events[t],e]:this._events[t]=e,i(this._events[t])&&!this._events[t].warned&&(s=o(this._maxListeners)?n.defaultMaxListeners:this._maxListeners)&&s>0&&this._events[t].length>s&&(this._events[t].warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",this._events[t].length),"function"==typeof console.trace&&console.trace()),this},n.prototype.on=n.prototype.addListener,n.prototype.once=function(t,e){function n(){this.removeListener(t,n),i||(i=!0,e.apply(this,arguments))}if(!r(e))throw TypeError("listener must be a function");var i=!1;return n.listener=e,this.on(t,n),this},n.prototype.removeListener=function(t,e){var n,o,s,a;if(!r(e))throw TypeError("listener must be a function");if(!this._events||!this._events[t])return this;if(n=this._events[t],s=n.length,o=-1,n===e||r(n.listener)&&n.listener===e)delete this._events[t],this._events.removeListener&&this.emit("removeListener",t,e);else if(i(n)){for(a=s;a-- >0;)if(n[a]===e||n[a].listener&&n[a].listener===e){o=a;break}if(o<0)return this;1===n.length?(n.length=0,delete this._events[t]):n.splice(o,1),this._events.removeListener&&this.emit("removeListener",t,e)}return this},n.prototype.removeAllListeners=function(t){var e,n;if(!this._events)return this;if(!this._events.removeListener)return 0===arguments.length?this._events={}:this._events[t]&&delete this._events[t],this;if(0===arguments.length){for(e in this._events)"removeListener"!==e&&this.removeAllListeners(e);return this.removeAllListeners("removeListener"),this._events={},this}if(n=this._events[t],r(n))this.removeListener(t,n);else if(n)for(;n.length;)this.removeListener(t,n[n.length-1]);return delete this._events[t],this},n.prototype.listeners=function(t){return this._events&&this._events[t]?r(this._events[t])?[this._events[t]]:this._events[t].slice():[]},n.prototype.listenerCount=function(t){if(this._events){var e=this._events[t];if(r(e))return 1;if(e)return e.length}return 0},n.listenerCount=function(t,e){return t.listenerCount(e)}},function(t,e){"function"==typeof Object.create?t.exports=function(t,e){t.super_=e,t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}})}:t.exports=function(t,e){t.super_=e;var n=function(){};n.prototype=e.prototype,t.prototype=new n,t.prototype.constructor=t}},function(t,e,n){"use strict";function r(t){return(t>>>24|t>>>8&65280|t<<8&16711680|(255&t)<<24)>>>0}function i(t){return 1===t.length?"0"+t:t}function o(t){return 7===t.length?"0"+t:6===t.length?"00"+t:5===t.length?"000"+t:4===t.length?"0000"+t:3===t.length?"00000"+t:2===t.length?"000000"+t:1===t.length?"0000000"+t:t}var s=n(9),a=n(5);e.inherits=a,e.toArray=function(t,e){if(Array.isArray(t))return t.slice();if(!t)return[];var n=[];if("string"==typeof t)if(e){if("hex"===e)for((t=t.replace(/[^a-z0-9]+/gi,"")).length%2!=0&&(t="0"+t),r=0;r<t.length;r+=2)n.push(parseInt(t[r]+t[r+1],16))}else for(var r=0;r<t.length;r++){var i=t.charCodeAt(r),o=i>>8,s=255&i;o?n.push(o,s):n.push(s)}else for(r=0;r<t.length;r++)n[r]=0|t[r];return n},e.toHex=function(t){for(var e="",n=0;n<t.length;n++)e+=i(t[n].toString(16));return e},e.htonl=r,e.toHex32=function(t,e){for(var n="",i=0;i<t.length;i++){var s=t[i];"little"===e&&(s=r(s)),n+=o(s.toString(16))}return n},e.zero2=i,e.zero8=o,e.join32=function(t,e,n,r){var i=n-e;s(i%4==0);for(var o=new Array(i/4),a=0,c=e;a<o.length;a++,c+=4){var f;f="big"===r?t[c]<<24|t[c+1]<<16|t[c+2]<<8|t[c+3]:t[c+3]<<24|t[c+2]<<16|t[c+1]<<8|t[c],o[a]=f>>>0}return o},e.split32=function(t,e){for(var n=new Array(4*t.length),r=0,i=0;r<t.length;r++,i+=4){var o=t[r];"big"===e?(n[i]=o>>>24,n[i+1]=o>>>16&255,n[i+2]=o>>>8&255,n[i+3]=255&o):(n[i+3]=o>>>24,n[i+2]=o>>>16&255,n[i+1]=o>>>8&255,n[i]=255&o)}return n},e.rotr32=function(t,e){return t>>>e|t<<32-e},e.rotl32=function(t,e){return t<<e|t>>>32-e},e.sum32=function(t,e){return t+e>>>0},e.sum32_3=function(t,e,n){return t+e+n>>>0},e.sum32_4=function(t,e,n,r){return t+e+n+r>>>0},e.sum32_5=function(t,e,n,r,i){return t+e+n+r+i>>>0},e.sum64=function(t,e,n,r){var i=t[e],o=r+t[e+1]>>>0,s=(o<r?1:0)+n+i;t[e]=s>>>0,t[e+1]=o},e.sum64_hi=function(t,e,n,r){return(e+r>>>0<e?1:0)+t+n>>>0},e.sum64_lo=function(t,e,n,r){return e+r>>>0},e.sum64_4_hi=function(t,e,n,r,i,o,s,a){var c=0,f=e;return c+=(f=f+r>>>0)<e?1:0,c+=(f=f+o>>>0)<o?1:0,t+n+i+s+(c+=(f=f+a>>>0)<a?1:0)>>>0},e.sum64_4_lo=function(t,e,n,r,i,o,s,a){return e+r+o+a>>>0},e.sum64_5_hi=function(t,e,n,r,i,o,s,a,c,f){var u=0,h=e;return u+=(h=h+r>>>0)<e?1:0,u+=(h=h+o>>>0)<o?1:0,u+=(h=h+a>>>0)<a?1:0,t+n+i+s+c+(u+=(h=h+f>>>0)<f?1:0)>>>0},e.sum64_5_lo=function(t,e,n,r,i,o,s,a,c,f){return e+r+o+a+f>>>0},e.rotr64_hi=function(t,e,n){return(e<<32-n|t>>>n)>>>0},e.rotr64_lo=function(t,e,n){return(t<<32-n|e>>>n)>>>0},e.shr64_hi=function(t,e,n){return t>>>n},e.shr64_lo=function(t,e,n){return(t<<32-n|e>>>n)>>>0}},function(t,e,n){(function(t){!function(t,e){"use strict";function r(t,e){if(!t)throw new Error(e||"Assertion failed")}function i(t,e){t.super_=e;var n=function(){};n.prototype=e.prototype,t.prototype=new n,t.prototype.constructor=t}function o(t,e,n){if(o.isBN(t))return t;this.negative=0,this.words=null,this.length=0,this.red=null,null!==t&&("le"!==e&&"be"!==e||(n=e,e=10),this._init(t||0,e||10,n||"be"))}function s(t,e,n){for(var r=0,i=Math.min(t.length,n),o=e;o<i;o++){var s=t.charCodeAt(o)-48;r<<=4,r|=s>=49&&s<=54?s-49+10:s>=17&&s<=22?s-17+10:15&s}return r}function a(t,e,n,r){for(var i=0,o=Math.min(t.length,n),s=e;s<o;s++){var a=t.charCodeAt(s)-48;i*=r,i+=a>=49?a-49+10:a>=17?a-17+10:a}return i}function c(t,e,n){n.negative=e.negative^t.negative;var r=t.length+e.length|0;n.length=r,r=r-1|0;var i=0|t.words[0],o=0|e.words[0],s=i*o,a=67108863&s,c=s/67108864|0;n.words[0]=a;for(var f=1;f<r;f++){for(var u=c>>>26,h=67108863&c,d=Math.min(f,e.length-1),l=Math.max(0,f-t.length+1);l<=d;l++){var p=f-l|0;u+=(s=(i=0|t.words[p])*(o=0|e.words[l])+h)/67108864|0,h=67108863&s}n.words[f]=0|h,c=0|u}return 0!==c?n.words[f]=0|c:n.length--,n.strip()}function f(t,e,n){return(new u).mulp(t,e,n)}function u(t,e){this.x=t,this.y=e}function h(t,e){this.name=t,this.p=new o(e,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(t){if("string"==typeof t){var e=o._prime(t);this.m=e.p,this.prime=e}else r(t.gtn(1),"modulus must be greater than 1"),this.m=t,this.prime=null}function m(t){y.call(this,t),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 t?t.exports=o:e.BN=o,o.BN=o,o.wordSize=26;var g;try{g=n(111).Buffer}catch(t){}o.isBN=function(t){return t instanceof o||null!==t&&"object"==typeof t&&t.constructor.wordSize===o.wordSize&&Array.isArray(t.words)},o.max=function(t,e){return t.cmp(e)>0?t:e},o.min=function(t,e){return t.cmp(e)<0?t:e},o.prototype._init=function(t,e,n){if("number"==typeof t)return this._initNumber(t,e,n);if("object"==typeof t)return this._initArray(t,e,n);"hex"===e&&(e=16),r(e===(0|e)&&e>=2&&e<=36);var i=0;"-"===(t=t.toString().replace(/\s+/g,""))[0]&&i++,16===e?this._parseHex(t,i):this._parseBase(t,e,i),"-"===t[0]&&(this.negative=1),this.strip(),"le"===n&&this._initArray(this.toArray(),e,n)},o.prototype._initNumber=function(t,e,n){t<0&&(this.negative=1,t=-t),t<67108864?(this.words=[67108863&t],this.length=1):t<4503599627370496?(this.words=[67108863&t,t/67108864&67108863],this.length=2):(r(t<9007199254740992),this.words=[67108863&t,t/67108864&67108863,1],this.length=3),"le"===n&&this._initArray(this.toArray(),e,n)},o.prototype._initArray=function(t,e,n){if(r("number"==typeof t.length),t.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(t.length/3),this.words=new Array(this.length);for(var i=0;i<this.length;i++)this.words[i]=0;var o,s,a=0;if("be"===n)for(i=t.length-1,o=0;i>=0;i-=3)s=t[i]|t[i-1]<<8|t[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"===n)for(i=0,o=0;i<t.length;i+=3)s=t[i]|t[i+1]<<8|t[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(t,e){this.length=Math.ceil((t.length-e)/6),this.words=new Array(this.length);for(var n=0;n<this.length;n++)this.words[n]=0;var r,i,o=0;for(n=t.length-6,r=0;n>=e;n-=6)i=s(t,n,n+6),this.words[r]|=i<<o&67108863,this.words[r+1]|=i>>>26-o&4194303,(o+=24)>=26&&(o-=26,r++);n+6!==e&&(i=s(t,e,n+6),this.words[r]|=i<<o&67108863,this.words[r+1]|=i>>>26-o&4194303),this.strip()},o.prototype._parseBase=function(t,e,n){this.words=[0],this.length=1;for(var r=0,i=1;i<=67108863;i*=e)r++;r--,i=i/e|0;for(var o=t.length-n,s=o%r,c=Math.min(o,o-s)+n,f=0,u=n;u<c;u+=r)f=a(t,u,u+r,e),this.imuln(i),this.words[0]+f<67108864?this.words[0]+=f:this._iaddn(f);if(0!==s){var h=1;for(f=a(t,u,t.length,e),u=0;u<s;u++)h*=e;this.imuln(h),this.words[0]+f<67108864?this.words[0]+=f:this._iaddn(f)}},o.prototype.copy=function(t){t.words=new Array(this.length);for(var e=0;e<this.length;e++)t.words[e]=this.words[e];t.length=this.length,t.negative=this.negative,t.red=this.red},o.prototype.clone=function(){var t=new o(null);return this.copy(t),t},o.prototype._expand=function(t){for(;this.length<t;)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(t,e){t=t||10,e=0|e||1;var n;if(16===t||"hex"===t){n="";for(var i=0,o=0,s=0;s<this.length;s++){var a=this.words[s],c=(16777215&(a<<i|o)).toString(16);n=0!==(o=a>>>24-i&16777215)||s!==this.length-1?v[6-c.length]+c+n:c+n,(i+=2)>=26&&(i-=26,s--)}for(0!==o&&(n=o.toString(16)+n);n.length%e!=0;)n="0"+n;return 0!==this.negative&&(n="-"+n),n}if(t===(0|t)&&t>=2&&t<=36){var f=_[t],u=w[t];n="";var h=this.clone();for(h.negative=0;!h.isZero();){var d=h.modn(u).toString(t);n=(h=h.idivn(u)).isZero()?d+n:v[f-d.length]+d+n}for(this.isZero()&&(n="0"+n);n.length%e!=0;)n="0"+n;return 0!==this.negative&&(n="-"+n),n}r(!1,"Base should be between 2 and 36")},o.prototype.toNumber=function(){var t=this.words[0];return 2===this.length?t+=67108864*this.words[1]:3===this.length&&1===this.words[2]?t+=4503599627370496+67108864*this.words[1]:this.length>2&&r(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-t:t},o.prototype.toJSON=function(){return this.toString(16)},o.prototype.toBuffer=function(t,e){return r(void 0!==g),this.toArrayLike(g,t,e)},o.prototype.toArray=function(t,e){return this.toArrayLike(Array,t,e)},o.prototype.toArrayLike=function(t,e,n){var i=this.byteLength(),o=n||Math.max(1,i);r(i<=o,"byte array longer than desired length"),r(o>0,"Requested array length <= 0"),this.strip();var s,a,c="le"===e,f=new t(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(t){return 32-Math.clz32(t)}:o.prototype._countBits=function(t){var e=t,n=0;return e>=4096&&(n+=13,e>>>=13),e>=64&&(n+=7,e>>>=7),e>=8&&(n+=4,e>>>=4),e>=2&&(n+=2,e>>>=2),n+e},o.prototype._zeroBits=function(t){if(0===t)return 26;var e=t,n=0;return 0==(8191&e)&&(n+=13,e>>>=13),0==(127&e)&&(n+=7,e>>>=7),0==(15&e)&&(n+=4,e>>>=4),0==(3&e)&&(n+=2,e>>>=2),0==(1&e)&&n++,n},o.prototype.bitLength=function(){var t=this.words[this.length-1],e=this._countBits(t);return 26*(this.length-1)+e},o.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,e=0;e<this.length;e++){var n=this._zeroBits(this.words[e]);if(t+=n,26!==n)break}return t},o.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},o.prototype.toTwos=function(t){return 0!==this.negative?this.abs().inotn(t).iaddn(1):this.clone()},o.prototype.fromTwos=function(t){return this.testn(t-1)?this.notn(t).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(t){for(;this.length<t.length;)this.words[this.length++]=0;for(var e=0;e<t.length;e++)this.words[e]=this.words[e]|t.words[e];return this.strip()},o.prototype.ior=function(t){return r(0==(this.negative|t.negative)),this.iuor(t)},o.prototype.or=function(t){return this.length>t.length?this.clone().ior(t):t.clone().ior(this)},o.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},o.prototype.iuand=function(t){var e;e=this.length>t.length?t:this;for(var n=0;n<e.length;n++)this.words[n]=this.words[n]&t.words[n];return this.length=e.length,this.strip()},o.prototype.iand=function(t){return r(0==(this.negative|t.negative)),this.iuand(t)},o.prototype.and=function(t){return this.length>t.length?this.clone().iand(t):t.clone().iand(this)},o.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},o.prototype.iuxor=function(t){var e,n;this.length>t.length?(e=this,n=t):(e=t,n=this);for(var r=0;r<n.length;r++)this.words[r]=e.words[r]^n.words[r];if(this!==e)for(;r<e.length;r++)this.words[r]=e.words[r];return this.length=e.length,this.strip()},o.prototype.ixor=function(t){return r(0==(this.negative|t.negative)),this.iuxor(t)},o.prototype.xor=function(t){return this.length>t.length?this.clone().ixor(t):t.clone().ixor(this)},o.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},o.prototype.inotn=function(t){r("number"==typeof t&&t>=0);var e=0|Math.ceil(t/26),n=t%26;this._expand(e),n>0&&e--;for(var i=0;i<e;i++)this.words[i]=67108863&~this.words[i];return n>0&&(this.words[i]=~this.words[i]&67108863>>26-n),this.strip()},o.prototype.notn=function(t){return this.clone().inotn(t)},o.prototype.setn=function(t,e){r("number"==typeof t&&t>=0);var n=t/26|0,i=t%26;return this._expand(n+1),this.words[n]=e?this.words[n]|1<<i:this.words[n]&~(1<<i),this.strip()},o.prototype.iadd=function(t){var e;if(0!==this.negative&&0===t.negative)return this.negative=0,e=this.isub(t),this.negative^=1,this._normSign();if(0===this.negative&&0!==t.negative)return t.negative=0,e=this.isub(t),t.negative=1,e._normSign();var n,r;this.length>t.length?(n=this,r=t):(n=t,r=this);for(var i=0,o=0;o<r.length;o++)e=(0|n.words[o])+(0|r.words[o])+i,this.words[o]=67108863&e,i=e>>>26;for(;0!==i&&o<n.length;o++)e=(0|n.words[o])+i,this.words[o]=67108863&e,i=e>>>26;if(this.length=n.length,0!==i)this.words[this.length]=i,this.length++;else if(n!==this)for(;o<n.length;o++)this.words[o]=n.words[o];return this},o.prototype.add=function(t){var e;return 0!==t.negative&&0===this.negative?(t.negative=0,e=this.sub(t),t.negative^=1,e):0===t.negative&&0!==this.negative?(this.negative=0,e=t.sub(this),this.negative=1,e):this.length>t.length?this.clone().iadd(t):t.clone().iadd(this)},o.prototype.isub=function(t){if(0!==t.negative){t.negative=0;var e=this.iadd(t);return t.negative=1,e._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var n=this.cmp(t);if(0===n)return this.negative=0,this.length=1,this.words[0]=0,this;var r,i;n>0?(r=this,i=t):(r=t,i=this);for(var o=0,s=0;s<i.length;s++)o=(e=(0|r.words[s])-(0|i.words[s])+o)>>26,this.words[s]=67108863&e;for(;0!==o&&s<r.length;s++)o=(e=(0|r.words[s])+o)>>26,this.words[s]=67108863&e;if(0===o&&s<r.length&&r!==this)for(;s<r.length;s++)this.words[s]=r.words[s];return this.length=Math.max(this.length,s),r!==this&&(this.negative=1),this.strip()},o.prototype.sub=function(t){return this.clone().isub(t)};var S=function(t,e,n){var r,i,o,s=t.words,a=e.words,c=n.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],m=8191&y,g=y>>>13,v=0|s[3],_=8191&v,w=v>>>13,S=0|s[4],k=8191&S,x=S>>>13,E=0|s[5],M=8191&E,A=E>>>13,O=0|s[6],I=8191&O,P=O>>>13,C=0|s[7],N=8191&C,R=C>>>13,j=0|s[8],T=8191&j,L=j>>>13,D=0|s[9],B=8191&D,F=D>>>13,q=0|a[0],U=8191&q,z=q>>>13,K=0|a[1],G=8191&K,H=K>>>13,Y=0|a[2],W=8191&Y,J=Y>>>13,$=0|a[3],V=8191&$,X=$>>>13,Z=0|a[4],Q=8191&Z,tt=Z>>>13,et=0|a[5],nt=8191&et,rt=et>>>13,it=0|a[6],ot=8191&it,st=it>>>13,at=0|a[7],ct=8191&at,ft=at>>>13,ut=0|a[8],ht=8191&ut,dt=ut>>>13,lt=0|a[9],pt=8191<,bt=lt>>>13;n.negative=t.negative^e.negative,n.length=19;var yt=(f+(r=Math.imul(h,U))|0)+((8191&(i=(i=Math.imul(h,z))+Math.imul(d,U)|0))<<13)|0;f=((o=Math.imul(d,z))+(i>>>13)|0)+(yt>>>26)|0,yt&=67108863,r=Math.imul(p,U),i=(i=Math.imul(p,z))+Math.imul(b,U)|0,o=Math.imul(b,z);var mt=(f+(r=r+Math.imul(h,G)|0)|0)+((8191&(i=(i=i+Math.imul(h,H)|0)+Math.imul(d,G)|0))<<13)|0;f=((o=o+Math.imul(d,H)|0)+(i>>>13)|0)+(mt>>>26)|0,mt&=67108863,r=Math.imul(m,U),i=(i=Math.imul(m,z))+Math.imul(g,U)|0,o=Math.imul(g,z),r=r+Math.imul(p,G)|0,i=(i=i+Math.imul(p,H)|0)+Math.imul(b,G)|0,o=o+Math.imul(b,H)|0;var gt=(f+(r=r+Math.imul(h,W)|0)|0)+((8191&(i=(i=i+Math.imul(h,J)|0)+Math.imul(d,W)|0))<<13)|0;f=((o=o+Math.imul(d,J)|0)+(i>>>13)|0)+(gt>>>26)|0,gt&=67108863,r=Math.imul(_,U),i=(i=Math.imul(_,z))+Math.imul(w,U)|0,o=Math.imul(w,z),r=r+Math.imul(m,G)|0,i=(i=i+Math.imul(m,H)|0)+Math.imul(g,G)|0,o=o+Math.imul(g,H)|0,r=r+Math.imul(p,W)|0,i=(i=i+Math.imul(p,J)|0)+Math.imul(b,W)|0,o=o+Math.imul(b,J)|0;var vt=(f+(r=r+Math.imul(h,V)|0)|0)+((8191&(i=(i=i+Math.imul(h,X)|0)+Math.imul(d,V)|0))<<13)|0;f=((o=o+Math.imul(d,X)|0)+(i>>>13)|0)+(vt>>>26)|0,vt&=67108863,r=Math.imul(k,U),i=(i=Math.imul(k,z))+Math.imul(x,U)|0,o=Math.imul(x,z),r=r+Math.imul(_,G)|0,i=(i=i+Math.imul(_,H)|0)+Math.imul(w,G)|0,o=o+Math.imul(w,H)|0,r=r+Math.imul(m,W)|0,i=(i=i+Math.imul(m,J)|0)+Math.imul(g,W)|0,o=o+Math.imul(g,J)|0,r=r+Math.imul(p,V)|0,i=(i=i+Math.imul(p,X)|0)+Math.imul(b,V)|0,o=o+Math.imul(b,X)|0;var _t=(f+(r=r+Math.imul(h,Q)|0)|0)+((8191&(i=(i=i+Math.imul(h,tt)|0)+Math.imul(d,Q)|0))<<13)|0;f=((o=o+Math.imul(d,tt)|0)+(i>>>13)|0)+(_t>>>26)|0,_t&=67108863,r=Math.imul(M,U),i=(i=Math.imul(M,z))+Math.imul(A,U)|0,o=Math.imul(A,z),r=r+Math.imul(k,G)|0,i=(i=i+Math.imul(k,H)|0)+Math.imul(x,G)|0,o=o+Math.imul(x,H)|0,r=r+Math.imul(_,W)|0,i=(i=i+Math.imul(_,J)|0)+Math.imul(w,W)|0,o=o+Math.imul(w,J)|0,r=r+Math.imul(m,V)|0,i=(i=i+Math.imul(m,X)|0)+Math.imul(g,V)|0,o=o+Math.imul(g,X)|0,r=r+Math.imul(p,Q)|0,i=(i=i+Math.imul(p,tt)|0)+Math.imul(b,Q)|0,o=o+Math.imul(b,tt)|0;var wt=(f+(r=r+Math.imul(h,nt)|0)|0)+((8191&(i=(i=i+Math.imul(h,rt)|0)+Math.imul(d,nt)|0))<<13)|0;f=((o=o+Math.imul(d,rt)|0)+(i>>>13)|0)+(wt>>>26)|0,wt&=67108863,r=Math.imul(I,U),i=(i=Math.imul(I,z))+Math.imul(P,U)|0,o=Math.imul(P,z),r=r+Math.imul(M,G)|0,i=(i=i+Math.imul(M,H)|0)+Math.imul(A,G)|0,o=o+Math.imul(A,H)|0,r=r+Math.imul(k,W)|0,i=(i=i+Math.imul(k,J)|0)+Math.imul(x,W)|0,o=o+Math.imul(x,J)|0,r=r+Math.imul(_,V)|0,i=(i=i+Math.imul(_,X)|0)+Math.imul(w,V)|0,o=o+Math.imul(w,X)|0,r=r+Math.imul(m,Q)|0,i=(i=i+Math.imul(m,tt)|0)+Math.imul(g,Q)|0,o=o+Math.imul(g,tt)|0,r=r+Math.imul(p,nt)|0,i=(i=i+Math.imul(p,rt)|0)+Math.imul(b,nt)|0,o=o+Math.imul(b,rt)|0;var St=(f+(r=r+Math.imul(h,ot)|0)|0)+((8191&(i=(i=i+Math.imul(h,st)|0)+Math.imul(d,ot)|0))<<13)|0;f=((o=o+Math.imul(d,st)|0)+(i>>>13)|0)+(St>>>26)|0,St&=67108863,r=Math.imul(N,U),i=(i=Math.imul(N,z))+Math.imul(R,U)|0,o=Math.imul(R,z),r=r+Math.imul(I,G)|0,i=(i=i+Math.imul(I,H)|0)+Math.imul(P,G)|0,o=o+Math.imul(P,H)|0,r=r+Math.imul(M,W)|0,i=(i=i+Math.imul(M,J)|0)+Math.imul(A,W)|0,o=o+Math.imul(A,J)|0,r=r+Math.imul(k,V)|0,i=(i=i+Math.imul(k,X)|0)+Math.imul(x,V)|0,o=o+Math.imul(x,X)|0,r=r+Math.imul(_,Q)|0,i=(i=i+Math.imul(_,tt)|0)+Math.imul(w,Q)|0,o=o+Math.imul(w,tt)|0,r=r+Math.imul(m,nt)|0,i=(i=i+Math.imul(m,rt)|0)+Math.imul(g,nt)|0,o=o+Math.imul(g,rt)|0,r=r+Math.imul(p,ot)|0,i=(i=i+Math.imul(p,st)|0)+Math.imul(b,ot)|0,o=o+Math.imul(b,st)|0;var kt=(f+(r=r+Math.imul(h,ct)|0)|0)+((8191&(i=(i=i+Math.imul(h,ft)|0)+Math.imul(d,ct)|0))<<13)|0;f=((o=o+Math.imul(d,ft)|0)+(i>>>13)|0)+(kt>>>26)|0,kt&=67108863,r=Math.imul(T,U),i=(i=Math.imul(T,z))+Math.imul(L,U)|0,o=Math.imul(L,z),r=r+Math.imul(N,G)|0,i=(i=i+Math.imul(N,H)|0)+Math.imul(R,G)|0,o=o+Math.imul(R,H)|0,r=r+Math.imul(I,W)|0,i=(i=i+Math.imul(I,J)|0)+Math.imul(P,W)|0,o=o+Math.imul(P,J)|0,r=r+Math.imul(M,V)|0,i=(i=i+Math.imul(M,X)|0)+Math.imul(A,V)|0,o=o+Math.imul(A,X)|0,r=r+Math.imul(k,Q)|0,i=(i=i+Math.imul(k,tt)|0)+Math.imul(x,Q)|0,o=o+Math.imul(x,tt)|0,r=r+Math.imul(_,nt)|0,i=(i=i+Math.imul(_,rt)|0)+Math.imul(w,nt)|0,o=o+Math.imul(w,rt)|0,r=r+Math.imul(m,ot)|0,i=(i=i+Math.imul(m,st)|0)+Math.imul(g,ot)|0,o=o+Math.imul(g,st)|0,r=r+Math.imul(p,ct)|0,i=(i=i+Math.imul(p,ft)|0)+Math.imul(b,ct)|0,o=o+Math.imul(b,ft)|0;var xt=(f+(r=r+Math.imul(h,ht)|0)|0)+((8191&(i=(i=i+Math.imul(h,dt)|0)+Math.imul(d,ht)|0))<<13)|0;f=((o=o+Math.imul(d,dt)|0)+(i>>>13)|0)+(xt>>>26)|0,xt&=67108863,r=Math.imul(B,U),i=(i=Math.imul(B,z))+Math.imul(F,U)|0,o=Math.imul(F,z),r=r+Math.imul(T,G)|0,i=(i=i+Math.imul(T,H)|0)+Math.imul(L,G)|0,o=o+Math.imul(L,H)|0,r=r+Math.imul(N,W)|0,i=(i=i+Math.imul(N,J)|0)+Math.imul(R,W)|0,o=o+Math.imul(R,J)|0,r=r+Math.imul(I,V)|0,i=(i=i+Math.imul(I,X)|0)+Math.imul(P,V)|0,o=o+Math.imul(P,X)|0,r=r+Math.imul(M,Q)|0,i=(i=i+Math.imul(M,tt)|0)+Math.imul(A,Q)|0,o=o+Math.imul(A,tt)|0,r=r+Math.imul(k,nt)|0,i=(i=i+Math.imul(k,rt)|0)+Math.imul(x,nt)|0,o=o+Math.imul(x,rt)|0,r=r+Math.imul(_,ot)|0,i=(i=i+Math.imul(_,st)|0)+Math.imul(w,ot)|0,o=o+Math.imul(w,st)|0,r=r+Math.imul(m,ct)|0,i=(i=i+Math.imul(m,ft)|0)+Math.imul(g,ct)|0,o=o+Math.imul(g,ft)|0,r=r+Math.imul(p,ht)|0,i=(i=i+Math.imul(p,dt)|0)+Math.imul(b,ht)|0,o=o+Math.imul(b,dt)|0;var Et=(f+(r=r+Math.imul(h,pt)|0)|0)+((8191&(i=(i=i+Math.imul(h,bt)|0)+Math.imul(d,pt)|0))<<13)|0;f=((o=o+Math.imul(d,bt)|0)+(i>>>13)|0)+(Et>>>26)|0,Et&=67108863,r=Math.imul(B,G),i=(i=Math.imul(B,H))+Math.imul(F,G)|0,o=Math.imul(F,H),r=r+Math.imul(T,W)|0,i=(i=i+Math.imul(T,J)|0)+Math.imul(L,W)|0,o=o+Math.imul(L,J)|0,r=r+Math.imul(N,V)|0,i=(i=i+Math.imul(N,X)|0)+Math.imul(R,V)|0,o=o+Math.imul(R,X)|0,r=r+Math.imul(I,Q)|0,i=(i=i+Math.imul(I,tt)|0)+Math.imul(P,Q)|0,o=o+Math.imul(P,tt)|0,r=r+Math.imul(M,nt)|0,i=(i=i+Math.imul(M,rt)|0)+Math.imul(A,nt)|0,o=o+Math.imul(A,rt)|0,r=r+Math.imul(k,ot)|0,i=(i=i+Math.imul(k,st)|0)+Math.imul(x,ot)|0,o=o+Math.imul(x,st)|0,r=r+Math.imul(_,ct)|0,i=(i=i+Math.imul(_,ft)|0)+Math.imul(w,ct)|0,o=o+Math.imul(w,ft)|0,r=r+Math.imul(m,ht)|0,i=(i=i+Math.imul(m,dt)|0)+Math.imul(g,ht)|0,o=o+Math.imul(g,dt)|0;var Mt=(f+(r=r+Math.imul(p,pt)|0)|0)+((8191&(i=(i=i+Math.imul(p,bt)|0)+Math.imul(b,pt)|0))<<13)|0;f=((o=o+Math.imul(b,bt)|0)+(i>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,r=Math.imul(B,W),i=(i=Math.imul(B,J))+Math.imul(F,W)|0,o=Math.imul(F,J),r=r+Math.imul(T,V)|0,i=(i=i+Math.imul(T,X)|0)+Math.imul(L,V)|0,o=o+Math.imul(L,X)|0,r=r+Math.imul(N,Q)|0,i=(i=i+Math.imul(N,tt)|0)+Math.imul(R,Q)|0,o=o+Math.imul(R,tt)|0,r=r+Math.imul(I,nt)|0,i=(i=i+Math.imul(I,rt)|0)+Math.imul(P,nt)|0,o=o+Math.imul(P,rt)|0,r=r+Math.imul(M,ot)|0,i=(i=i+Math.imul(M,st)|0)+Math.imul(A,ot)|0,o=o+Math.imul(A,st)|0,r=r+Math.imul(k,ct)|0,i=(i=i+Math.imul(k,ft)|0)+Math.imul(x,ct)|0,o=o+Math.imul(x,ft)|0,r=r+Math.imul(_,ht)|0,i=(i=i+Math.imul(_,dt)|0)+Math.imul(w,ht)|0,o=o+Math.imul(w,dt)|0;var At=(f+(r=r+Math.imul(m,pt)|0)|0)+((8191&(i=(i=i+Math.imul(m,bt)|0)+Math.imul(g,pt)|0))<<13)|0;f=((o=o+Math.imul(g,bt)|0)+(i>>>13)|0)+(At>>>26)|0,At&=67108863,r=Math.imul(B,V),i=(i=Math.imul(B,X))+Math.imul(F,V)|0,o=Math.imul(F,X),r=r+Math.imul(T,Q)|0,i=(i=i+Math.imul(T,tt)|0)+Math.imul(L,Q)|0,o=o+Math.imul(L,tt)|0,r=r+Math.imul(N,nt)|0,i=(i=i+Math.imul(N,rt)|0)+Math.imul(R,nt)|0,o=o+Math.imul(R,rt)|0,r=r+Math.imul(I,ot)|0,i=(i=i+Math.imul(I,st)|0)+Math.imul(P,ot)|0,o=o+Math.imul(P,st)|0,r=r+Math.imul(M,ct)|0,i=(i=i+Math.imul(M,ft)|0)+Math.imul(A,ct)|0,o=o+Math.imul(A,ft)|0,r=r+Math.imul(k,ht)|0,i=(i=i+Math.imul(k,dt)|0)+Math.imul(x,ht)|0,o=o+Math.imul(x,dt)|0;var Ot=(f+(r=r+Math.imul(_,pt)|0)|0)+((8191&(i=(i=i+Math.imul(_,bt)|0)+Math.imul(w,pt)|0))<<13)|0;f=((o=o+Math.imul(w,bt)|0)+(i>>>13)|0)+(Ot>>>26)|0,Ot&=67108863,r=Math.imul(B,Q),i=(i=Math.imul(B,tt))+Math.imul(F,Q)|0,o=Math.imul(F,tt),r=r+Math.imul(T,nt)|0,i=(i=i+Math.imul(T,rt)|0)+Math.imul(L,nt)|0,o=o+Math.imul(L,rt)|0,r=r+Math.imul(N,ot)|0,i=(i=i+Math.imul(N,st)|0)+Math.imul(R,ot)|0,o=o+Math.imul(R,st)|0,r=r+Math.imul(I,ct)|0,i=(i=i+Math.imul(I,ft)|0)+Math.imul(P,ct)|0,o=o+Math.imul(P,ft)|0,r=r+Math.imul(M,ht)|0,i=(i=i+Math.imul(M,dt)|0)+Math.imul(A,ht)|0,o=o+Math.imul(A,dt)|0;var It=(f+(r=r+Math.imul(k,pt)|0)|0)+((8191&(i=(i=i+Math.imul(k,bt)|0)+Math.imul(x,pt)|0))<<13)|0;f=((o=o+Math.imul(x,bt)|0)+(i>>>13)|0)+(It>>>26)|0,It&=67108863,r=Math.imul(B,nt),i=(i=Math.imul(B,rt))+Math.imul(F,nt)|0,o=Math.imul(F,rt),r=r+Math.imul(T,ot)|0,i=(i=i+Math.imul(T,st)|0)+Math.imul(L,ot)|0,o=o+Math.imul(L,st)|0,r=r+Math.imul(N,ct)|0,i=(i=i+Math.imul(N,ft)|0)+Math.imul(R,ct)|0,o=o+Math.imul(R,ft)|0,r=r+Math.imul(I,ht)|0,i=(i=i+Math.imul(I,dt)|0)+Math.imul(P,ht)|0,o=o+Math.imul(P,dt)|0;var Pt=(f+(r=r+Math.imul(M,pt)|0)|0)+((8191&(i=(i=i+Math.imul(M,bt)|0)+Math.imul(A,pt)|0))<<13)|0;f=((o=o+Math.imul(A,bt)|0)+(i>>>13)|0)+(Pt>>>26)|0,Pt&=67108863,r=Math.imul(B,ot),i=(i=Math.imul(B,st))+Math.imul(F,ot)|0,o=Math.imul(F,st),r=r+Math.imul(T,ct)|0,i=(i=i+Math.imul(T,ft)|0)+Math.imul(L,ct)|0,o=o+Math.imul(L,ft)|0,r=r+Math.imul(N,ht)|0,i=(i=i+Math.imul(N,dt)|0)+Math.imul(R,ht)|0,o=o+Math.imul(R,dt)|0;var Ct=(f+(r=r+Math.imul(I,pt)|0)|0)+((8191&(i=(i=i+Math.imul(I,bt)|0)+Math.imul(P,pt)|0))<<13)|0;f=((o=o+Math.imul(P,bt)|0)+(i>>>13)|0)+(Ct>>>26)|0,Ct&=67108863,r=Math.imul(B,ct),i=(i=Math.imul(B,ft))+Math.imul(F,ct)|0,o=Math.imul(F,ft),r=r+Math.imul(T,ht)|0,i=(i=i+Math.imul(T,dt)|0)+Math.imul(L,ht)|0,o=o+Math.imul(L,dt)|0;var Nt=(f+(r=r+Math.imul(N,pt)|0)|0)+((8191&(i=(i=i+Math.imul(N,bt)|0)+Math.imul(R,pt)|0))<<13)|0;f=((o=o+Math.imul(R,bt)|0)+(i>>>13)|0)+(Nt>>>26)|0,Nt&=67108863,r=Math.imul(B,ht),i=(i=Math.imul(B,dt))+Math.imul(F,ht)|0,o=Math.imul(F,dt);var Rt=(f+(r=r+Math.imul(T,pt)|0)|0)+((8191&(i=(i=i+Math.imul(T,bt)|0)+Math.imul(L,pt)|0))<<13)|0;f=((o=o+Math.imul(L,bt)|0)+(i>>>13)|0)+(Rt>>>26)|0,Rt&=67108863;var jt=(f+(r=Math.imul(B,pt))|0)+((8191&(i=(i=Math.imul(B,bt))+Math.imul(F,pt)|0))<<13)|0;return f=((o=Math.imul(F,bt))+(i>>>13)|0)+(jt>>>26)|0,jt&=67108863,c[0]=yt,c[1]=mt,c[2]=gt,c[3]=vt,c[4]=_t,c[5]=wt,c[6]=St,c[7]=kt,c[8]=xt,c[9]=Et,c[10]=Mt,c[11]=At,c[12]=Ot,c[13]=It,c[14]=Pt,c[15]=Ct,c[16]=Nt,c[17]=Rt,c[18]=jt,0!==f&&(c[19]=f,n.length++),n};Math.imul||(S=c),o.prototype.mulTo=function(t,e){var n=this.length+t.length;return 10===this.length&&10===t.length?S(this,t,e):n<63?c(this,t,e):n<1024?function(t,e,n){n.negative=e.negative^t.negative,n.length=t.length+e.length;for(var r=0,i=0,o=0;o<n.length-1;o++){var s=i;i=0;for(var a=67108863&r,c=Math.min(o,e.length-1),f=Math.max(0,o-t.length+1);f<=c;f++){var u=o-f,h=(0|t.words[u])*(0|e.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}n.words[o]=a,r=s,s=i}return 0!==r?n.words[o]=r:n.length--,n.strip()}(this,t,e):f(this,t,e)},u.prototype.makeRBT=function(t){for(var e=new Array(t),n=o.prototype._countBits(t)-1,r=0;r<t;r++)e[r]=this.revBin(r,n,t);return e},u.prototype.revBin=function(t,e,n){if(0===t||t===n-1)return t;for(var r=0,i=0;i<e;i++)r|=(1&t)<<e-i-1,t>>=1;return r},u.prototype.permute=function(t,e,n,r,i,o){for(var s=0;s<o;s++)r[s]=e[t[s]],i[s]=n[t[s]]},u.prototype.transform=function(t,e,n,r,i,o){this.permute(o,t,e,n,r,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=n[u+l],b=r[u+l],y=n[u+l+s],m=r[u+l+s],g=h*y-d*m;m=h*m+d*y,y=g,n[u+l]=p+y,r[u+l]=b+m,n[u+l+s]=p-y,r[u+l+s]=b-m,l!==a&&(g=c*h-f*d,d=c*d+f*h,h=g)}},u.prototype.guessLen13b=function(t,e){var n=1|Math.max(e,t),r=1&n,i=0;for(n=n/2|0;n;n>>>=1)i++;return 1<<i+1+r},u.prototype.conjugate=function(t,e,n){if(!(n<=1))for(var r=0;r<n/2;r++){var i=t[r];t[r]=t[n-r-1],t[n-r-1]=i,i=e[r],e[r]=-e[n-r-1],e[n-r-1]=-i}},u.prototype.normalize13b=function(t,e){for(var n=0,r=0;r<e/2;r++){var i=8192*Math.round(t[2*r+1]/e)+Math.round(t[2*r]/e)+n;t[r]=67108863&i,n=i<67108864?0:i/67108864|0}return t},u.prototype.convert13b=function(t,e,n,i){for(var o=0,s=0;s<e;s++)o+=0|t[s],n[2*s]=8191&o,o>>>=13,n[2*s+1]=8191&o,o>>>=13;for(s=2*e;s<i;++s)n[s]=0;r(0===o),r(0==(-8192&o))},u.prototype.stub=function(t){for(var e=new Array(t),n=0;n<t;n++)e[n]=0;return e},u.prototype.mulp=function(t,e,n){var r=2*this.guessLen13b(t.length,e.length),i=this.makeRBT(r),o=this.stub(r),s=new Array(r),a=new Array(r),c=new Array(r),f=new Array(r),u=new Array(r),h=new Array(r),d=n.words;d.length=r,this.convert13b(t.words,t.length,s,r),this.convert13b(e.words,e.length,f,r),this.transform(s,o,a,c,r,i),this.transform(f,o,u,h,r,i);for(var l=0;l<r;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,r),this.transform(a,c,d,o,r,i),this.conjugate(d,o,r),this.normalize13b(d,r),n.negative=t.negative^e.negative,n.length=t.length+e.length,n.strip()},o.prototype.mul=function(t){var e=new o(null);return e.words=new Array(this.length+t.length),this.mulTo(t,e)},o.prototype.mulf=function(t){var e=new o(null);return e.words=new Array(this.length+t.length),f(this,t,e)},o.prototype.imul=function(t){return this.clone().mulTo(t,this)},o.prototype.imuln=function(t){r("number"==typeof t),r(t<67108864);for(var e=0,n=0;n<this.length;n++){var i=(0|this.words[n])*t,o=(67108863&i)+(67108863&e);e>>=26,e+=i/67108864|0,e+=o>>>26,this.words[n]=67108863&o}return 0!==e&&(this.words[n]=e,this.length++),this},o.prototype.muln=function(t){return this.clone().imuln(t)},o.prototype.sqr=function(){return this.mul(this)},o.prototype.isqr=function(){return this.imul(this.clone())},o.prototype.pow=function(t){var e=function(t){for(var e=new Array(t.bitLength()),n=0;n<e.length;n++){var r=n/26|0,i=n%26;e[n]=(t.words[r]&1<<i)>>>i}return e}(t);if(0===e.length)return new o(1);for(var n=this,r=0;r<e.length&&0===e[r];r++,n=n.sqr());if(++r<e.length)for(var i=n.sqr();r<e.length;r++,i=i.sqr())0!==e[r]&&(n=n.mul(i));return n},o.prototype.iushln=function(t){r("number"==typeof t&&t>=0);var e,n=t%26,i=(t-n)/26,o=67108863>>>26-n<<26-n;if(0!==n){var s=0;for(e=0;e<this.length;e++){var a=this.words[e]&o,c=(0|this.words[e])-a<<n;this.words[e]=c|s,s=a>>>26-n}s&&(this.words[e]=s,this.length++)}if(0!==i){for(e=this.length-1;e>=0;e--)this.words[e+i]=this.words[e];for(e=0;e<i;e++)this.words[e]=0;this.length+=i}return this.strip()},o.prototype.ishln=function(t){return r(0===this.negative),this.iushln(t)},o.prototype.iushrn=function(t,e,n){r("number"==typeof t&&t>=0);var i;i=e?(e-e%26)/26:0;var o=t%26,s=Math.min((t-o)/26,this.length),a=67108863^67108863>>>o<<o,c=n;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(t,e,n){return r(0===this.negative),this.iushrn(t,e,n)},o.prototype.shln=function(t){return this.clone().ishln(t)},o.prototype.ushln=function(t){return this.clone().iushln(t)},o.prototype.shrn=function(t){return this.clone().ishrn(t)},o.prototype.ushrn=function(t){return this.clone().iushrn(t)},o.prototype.testn=function(t){r("number"==typeof t&&t>=0);var e=t%26,n=(t-e)/26,i=1<<e;if(this.length<=n)return!1;return!!(this.words[n]&i)},o.prototype.imaskn=function(t){r("number"==typeof t&&t>=0);var e=t%26,n=(t-e)/26;if(r(0===this.negative,"imaskn works only with positive numbers"),this.length<=n)return this;if(0!==e&&n++,this.length=Math.min(n,this.length),0!==e){var i=67108863^67108863>>>e<<e;this.words[this.length-1]&=i}return this.strip()},o.prototype.maskn=function(t){return this.clone().imaskn(t)},o.prototype.iaddn=function(t){return r("number"==typeof t),r(t<67108864),t<0?this.isubn(-t):0!==this.negative?1===this.length&&(0|this.words[0])<t?(this.words[0]=t-(0|this.words[0]),this.negative=0,this):(this.negative=0,this.isubn(t),this.negative=1,this):this._iaddn(t)},o.prototype._iaddn=function(t){this.words[0]+=t;for(var e=0;e<this.length&&this.words[e]>=67108864;e++)this.words[e]-=67108864,e===this.length-1?this.words[e+1]=1:this.words[e+1]++;return this.length=Math.max(this.length,e+1),this},o.prototype.isubn=function(t){if(r("number"==typeof t),r(t<67108864),t<0)return this.iaddn(-t);if(0!==this.negative)return this.negative=0,this.iaddn(t),this.negative=1,this;if(this.words[0]-=t,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var e=0;e<this.length&&this.words[e]<0;e++)this.words[e]+=67108864,this.words[e+1]-=1;return this.strip()},o.prototype.addn=function(t){return this.clone().iaddn(t)},o.prototype.subn=function(t){return this.clone().isubn(t)},o.prototype.iabs=function(){return this.negative=0,this},o.prototype.abs=function(){return this.clone().iabs()},o.prototype._ishlnsubmul=function(t,e,n){var i,o=t.length+n;this._expand(o);var s,a=0;for(i=0;i<t.length;i++){s=(0|this.words[i+n])+a;var c=(0|t.words[i])*e;a=((s-=67108863&c)>>26)-(c/67108864|0),this.words[i+n]=67108863&s}for(;i<this.length-n;i++)a=(s=(0|this.words[i+n])+a)>>26,this.words[i+n]=67108863&s;if(0===a)return this.strip();for(r(-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(t,e){var n=this.length-t.length,r=this.clone(),i=t,s=0|i.words[i.length-1];0!==(n=26-this._countBits(s))&&(i=i.ushln(n),r.iushln(n),s=0|i.words[i.length-1]);var a,c=r.length-i.length;if("mod"!==e){(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=r.clone()._ishlnsubmul(i,1,c);0===u.negative&&(r=u,a&&(a.words[c]=1));for(var h=c-1;h>=0;h--){var d=67108864*(0|r.words[i.length+h])+(0|r.words[i.length+h-1]);for(d=Math.min(d/s|0,67108863),r._ishlnsubmul(i,d,h);0!==r.negative;)d--,r.negative=0,r._ishlnsubmul(i,1,h),r.isZero()||(r.negative^=1);a&&(a.words[h]=d)}return a&&a.strip(),r.strip(),"div"!==e&&0!==n&&r.iushrn(n),{div:a||null,mod:r}},o.prototype.divmod=function(t,e,n){if(r(!t.isZero()),this.isZero())return{div:new o(0),mod:new o(0)};var i,s,a;return 0!==this.negative&&0===t.negative?(a=this.neg().divmod(t,e),"mod"!==e&&(i=a.div.neg()),"div"!==e&&(s=a.mod.neg(),n&&0!==s.negative&&s.iadd(t)),{div:i,mod:s}):0===this.negative&&0!==t.negative?(a=this.divmod(t.neg(),e),"mod"!==e&&(i=a.div.neg()),{div:i,mod:a.mod}):0!=(this.negative&t.negative)?(a=this.neg().divmod(t.neg(),e),"div"!==e&&(s=a.mod.neg(),n&&0!==s.negative&&s.isub(t)),{div:a.div,mod:s}):t.length>this.length||this.cmp(t)<0?{div:new o(0),mod:this}:1===t.length?"div"===e?{div:this.divn(t.words[0]),mod:null}:"mod"===e?{div:null,mod:new o(this.modn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new o(this.modn(t.words[0]))}:this._wordDiv(t,e)},o.prototype.div=function(t){return this.divmod(t,"div",!1).div},o.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},o.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},o.prototype.divRound=function(t){var e=this.divmod(t);if(e.mod.isZero())return e.div;var n=0!==e.div.negative?e.mod.isub(t):e.mod,r=t.ushrn(1),i=t.andln(1),o=n.cmp(r);return o<0||1===i&&0===o?e.div:0!==e.div.negative?e.div.isubn(1):e.div.iaddn(1)},o.prototype.modn=function(t){r(t<=67108863);for(var e=(1<<26)%t,n=0,i=this.length-1;i>=0;i--)n=(e*n+(0|this.words[i]))%t;return n},o.prototype.idivn=function(t){r(t<=67108863);for(var e=0,n=this.length-1;n>=0;n--){var i=(0|this.words[n])+67108864*e;this.words[n]=i/t|0,e=i%t}return this.strip()},o.prototype.divn=function(t){return this.clone().idivn(t)},o.prototype.egcd=function(t){r(0===t.negative),r(!t.isZero());var e=this,n=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var i=new o(1),s=new o(0),a=new o(0),c=new o(1),f=0;e.isEven()&&n.isEven();)e.iushrn(1),n.iushrn(1),++f;for(var u=n.clone(),h=e.clone();!e.isZero();){for(var d=0,l=1;0==(e.words[0]&l)&&d<26;++d,l<<=1);if(d>0)for(e.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==(n.words[0]&b)&&p<26;++p,b<<=1);if(p>0)for(n.iushrn(p);p-- >0;)(a.isOdd()||c.isOdd())&&(a.iadd(u),c.isub(h)),a.iushrn(1),c.iushrn(1);e.cmp(n)>=0?(e.isub(n),i.isub(a),s.isub(c)):(n.isub(e),a.isub(i),c.isub(s))}return{a:a,b:c,gcd:n.iushln(f)}},o.prototype._invmp=function(t){r(0===t.negative),r(!t.isZero());var e=this,n=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var i=new o(1),s=new o(0),a=n.clone();e.cmpn(1)>0&&n.cmpn(1)>0;){for(var c=0,f=1;0==(e.words[0]&f)&&c<26;++c,f<<=1);if(c>0)for(e.iushrn(c);c-- >0;)i.isOdd()&&i.iadd(a),i.iushrn(1);for(var u=0,h=1;0==(n.words[0]&h)&&u<26;++u,h<<=1);if(u>0)for(n.iushrn(u);u-- >0;)s.isOdd()&&s.iadd(a),s.iushrn(1);e.cmp(n)>=0?(e.isub(n),i.isub(s)):(n.isub(e),s.isub(i))}var d;return(d=0===e.cmpn(1)?i:s).cmpn(0)<0&&d.iadd(t),d},o.prototype.gcd=function(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var e=this.clone(),n=t.clone();e.negative=0,n.negative=0;for(var r=0;e.isEven()&&n.isEven();r++)e.iushrn(1),n.iushrn(1);for(;;){for(;e.isEven();)e.iushrn(1);for(;n.isEven();)n.iushrn(1);var i=e.cmp(n);if(i<0){var o=e;e=n,n=o}else if(0===i||0===n.cmpn(1))break;e.isub(n)}return n.iushln(r)},o.prototype.invm=function(t){return this.egcd(t).a.umod(t)},o.prototype.isEven=function(){return 0==(1&this.words[0])},o.prototype.isOdd=function(){return 1==(1&this.words[0])},o.prototype.andln=function(t){return this.words[0]&t},o.prototype.bincn=function(t){r("number"==typeof t);var e=t%26,n=(t-e)/26,i=1<<e;if(this.length<=n)return this._expand(n+1),this.words[n]|=i,this;for(var o=i,s=n;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(t){var e=t<0;if(0!==this.negative&&!e)return-1;if(0===this.negative&&e)return 1;this.strip();var n;if(this.length>1)n=1;else{e&&(t=-t),r(t<=67108863,"Number is too big");var i=0|this.words[0];n=i===t?0:i<t?-1:1}return 0!==this.negative?0|-n:n},o.prototype.cmp=function(t){if(0!==this.negative&&0===t.negative)return-1;if(0===this.negative&&0!==t.negative)return 1;var e=this.ucmp(t);return 0!==this.negative?0|-e:e},o.prototype.ucmp=function(t){if(this.length>t.length)return 1;if(this.length<t.length)return-1;for(var e=0,n=this.length-1;n>=0;n--){var r=0|this.words[n],i=0|t.words[n];if(r!==i){r<i?e=-1:r>i&&(e=1);break}}return e},o.prototype.gtn=function(t){return 1===this.cmpn(t)},o.prototype.gt=function(t){return 1===this.cmp(t)},o.prototype.gten=function(t){return this.cmpn(t)>=0},o.prototype.gte=function(t){return this.cmp(t)>=0},o.prototype.ltn=function(t){return-1===this.cmpn(t)},o.prototype.lt=function(t){return-1===this.cmp(t)},o.prototype.lten=function(t){return this.cmpn(t)<=0},o.prototype.lte=function(t){return this.cmp(t)<=0},o.prototype.eqn=function(t){return 0===this.cmpn(t)},o.prototype.eq=function(t){return 0===this.cmp(t)},o.red=function(t){return new y(t)},o.prototype.toRed=function(t){return r(!this.red,"Already a number in reduction context"),r(0===this.negative,"red works only with positives"),t.convertTo(this)._forceRed(t)},o.prototype.fromRed=function(){return r(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},o.prototype._forceRed=function(t){return this.red=t,this},o.prototype.forceRed=function(t){return r(!this.red,"Already a number in reduction context"),this._forceRed(t)},o.prototype.redAdd=function(t){return r(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},o.prototype.redIAdd=function(t){return r(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},o.prototype.redSub=function(t){return r(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},o.prototype.redISub=function(t){return r(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},o.prototype.redShl=function(t){return r(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},o.prototype.redMul=function(t){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},o.prototype.redIMul=function(t){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},o.prototype.redSqr=function(){return r(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},o.prototype.redISqr=function(){return r(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},o.prototype.redSqrt=function(){return r(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},o.prototype.redInvm=function(){return r(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},o.prototype.redNeg=function(){return r(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},o.prototype.redPow=function(t){return r(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var k={k256:null,p224:null,p192:null,p25519:null};h.prototype._tmp=function(){var t=new o(null);return t.words=new Array(Math.ceil(this.n/13)),t},h.prototype.ireduce=function(t){var e,n=t;do{this.split(n,this.tmp),e=(n=(n=this.imulK(n)).iadd(this.tmp)).bitLength()}while(e>this.n);var r=e<this.n?-1:n.ucmp(this.p);return 0===r?(n.words[0]=0,n.length=1):r>0?n.isub(this.p):n.strip(),n},h.prototype.split=function(t,e){t.iushrn(this.n,0,e)},h.prototype.imulK=function(t){return t.imul(this.k)},i(d,h),d.prototype.split=function(t,e){for(var n=Math.min(t.length,9),r=0;r<n;r++)e.words[r]=t.words[r];if(e.length=n,t.length<=9)return t.words[0]=0,void(t.length=1);var i=t.words[9];for(e.words[e.length++]=4194303&i,r=10;r<t.length;r++){var o=0|t.words[r];t.words[r-10]=(4194303&o)<<4|i>>>22,i=o}i>>>=22,t.words[r-10]=i,0===i&&t.length>10?t.length-=10:t.length-=9},d.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var e=0,n=0;n<t.length;n++){var r=0|t.words[n];e+=977*r,t.words[n]=67108863&e,e=64*r+(e/67108864|0)}return 0===t.words[t.length-1]&&(t.length--,0===t.words[t.length-1]&&t.length--),t},i(l,h),i(p,h),i(b,h),b.prototype.imulK=function(t){for(var e=0,n=0;n<t.length;n++){var r=19*(0|t.words[n])+e,i=67108863&r;r>>>=26,t.words[n]=i,e=r}return 0!==e&&(t.words[t.length++]=e),t},o._prime=function(t){if(k[t])return k[t];var e;if("k256"===t)e=new d;else if("p224"===t)e=new l;else if("p192"===t)e=new p;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new b}return k[t]=e,e},y.prototype._verify1=function(t){r(0===t.negative,"red works only with positives"),r(t.red,"red works only with red numbers")},y.prototype._verify2=function(t,e){r(0==(t.negative|e.negative),"red works only with positives"),r(t.red&&t.red===e.red,"red works only with red numbers")},y.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):t.umod(this.m)._forceRed(this)},y.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},y.prototype.add=function(t,e){this._verify2(t,e);var n=t.add(e);return n.cmp(this.m)>=0&&n.isub(this.m),n._forceRed(this)},y.prototype.iadd=function(t,e){this._verify2(t,e);var n=t.iadd(e);return n.cmp(this.m)>=0&&n.isub(this.m),n},y.prototype.sub=function(t,e){this._verify2(t,e);var n=t.sub(e);return n.cmpn(0)<0&&n.iadd(this.m),n._forceRed(this)},y.prototype.isub=function(t,e){this._verify2(t,e);var n=t.isub(e);return n.cmpn(0)<0&&n.iadd(this.m),n},y.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},y.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},y.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},y.prototype.isqr=function(t){return this.imul(t,t.clone())},y.prototype.sqr=function(t){return this.mul(t,t)},y.prototype.sqrt=function(t){if(t.isZero())return t.clone();var e=this.m.andln(3);if(r(e%2==1),3===e){var n=this.m.add(new o(1)).iushrn(2);return this.pow(t,n)}for(var i=this.m.subn(1),s=0;!i.isZero()&&0===i.andln(1);)s++,i.iushrn(1);r(!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(t,i.addn(1).iushrn(1)),l=this.pow(t,i),p=s;0!==l.cmp(a);){for(var b=l,y=0;0!==b.cmp(a);y++)b=b.redSqr();r(y<p);var m=this.pow(h,new o(1).iushln(p-y-1));d=d.redMul(m),h=m.redSqr(),l=l.redMul(h),p=y}return d},y.prototype.invm=function(t){var e=t._invmp(this.m);return 0!==e.negative?(e.negative=0,this.imod(e).redNeg()):this.imod(e)},y.prototype.pow=function(t,e){if(e.isZero())return new o(1).toRed(this);if(0===e.cmpn(1))return t.clone();var n=new Array(16);n[0]=new o(1).toRed(this),n[1]=t;for(var r=2;r<n.length;r++)n[r]=this.mul(n[r-1],t);var i=n[0],s=0,a=0,c=e.bitLength()%26;for(0===c&&(c=26),r=e.length-1;r>=0;r--){for(var f=e.words[r],u=c-1;u>=0;u--){var h=f>>u&1;i!==n[0]&&(i=this.sqr(i)),0!==h||0!==s?(s<<=1,s|=h,(4===++a||0===r&&0===u)&&(i=this.mul(i,n[s]),a=0,s=0)):a=0}c=26}return i},y.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},y.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},o.mont=function(t){return new m(t)},i(m,y),m.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},m.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},m.prototype.imul=function(t,e){if(t.isZero()||e.isZero())return t.words[0]=0,t.length=1,t;var n=t.imul(e),r=n.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=n.isub(r).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)},m.prototype.mul=function(t,e){if(t.isZero()||e.isZero())return new o(0)._forceRed(this);var n=t.mul(e),r=n.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=n.isub(r).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)},m.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(void 0===t||t,this)}).call(e,n(50)(t))},function(t,e,n){"use strict";function r(t){if(!(this instanceof r))return new r(t);f.call(this,t),u.call(this,t),t&&!1===t.readable&&(this.readable=!1),t&&!1===t.writable&&(this.writable=!1),this.allowHalfOpen=!0,t&&!1===t.allowHalfOpen&&(this.allowHalfOpen=!1),this.once("end",i)}function i(){this.allowHalfOpen||this._writableState.ended||s(o,this)}function o(t){t.end()}var s=n(20),a=Object.keys||function(t){var e=[];for(var n in t)e.push(n);return e};t.exports=r;var c=n(14);c.inherits=n(5);var f=n(35),u=n(25);c.inherits(r,f);for(var h=a(u.prototype),d=0;d<h.length;d++){var l=h[d];r.prototype[l]||(r.prototype[l]=u.prototype[l])}Object.defineProperty(r.prototype,"destroyed",{get:function(){return void 0!==this._readableState&&void 0!==this._writableState&&(this._readableState.destroyed&&this._writableState.destroyed)},set:function(t){void 0!==this._readableState&&void 0!==this._writableState&&(this._readableState.destroyed=t,this._writableState.destroyed=t)}}),r.prototype._destroy=function(t,e){this.push(null),this.end(),s(e,t)}},function(t,e){function n(t,e){if(!t)throw new Error(e||"Assertion failed")}t.exports=n,n.equal=function(t,e,n){if(t!=e)throw new Error(n||"Assertion failed: "+t+" != "+e)}},function(t,e,n){function r(t,e){for(var n in t)e[n]=t[n]}function i(t,e,n){return s(t,e,n)}var o=n(1),s=o.Buffer;s.from&&s.alloc&&s.allocUnsafe&&s.allocUnsafeSlow?t.exports=o:(r(o,e),e.Buffer=i),r(s,i),i.from=function(t,e,n){if("number"==typeof t)throw new TypeError("Argument must not be a number");return s(t,e,n)},i.alloc=function(t,e,n){if("number"!=typeof t)throw new TypeError("Argument must be a number");var r=s(t);return void 0!==e?"string"==typeof n?r.fill(e,n):r.fill(e):r.fill(0),r},i.allocUnsafe=function(t){if("number"!=typeof t)throw new TypeError("Argument must be a number");return s(t)},i.allocUnsafeSlow=function(t){if("number"!=typeof t)throw new TypeError("Argument must be a number");return o.SlowBuffer(t)}},function(t,e,n){function r(t,e){this._id=t,this._clearFn=e}var i=Function.prototype.apply;e.setTimeout=function(){return new r(i.call(setTimeout,window,arguments),clearTimeout)},e.setInterval=function(){return new r(i.call(setInterval,window,arguments),clearInterval)},e.clearTimeout=e.clearInterval=function(t){t&&t.close()},r.prototype.unref=r.prototype.ref=function(){},r.prototype.close=function(){this._clearFn.call(window,this._id)},e.enroll=function(t,e){clearTimeout(t._idleTimeoutId),t._idleTimeout=e},e.unenroll=function(t){clearTimeout(t._idleTimeoutId),t._idleTimeout=-1},e._unrefActive=e.active=function(t){clearTimeout(t._idleTimeoutId);var e=t._idleTimeout;e>=0&&(t._idleTimeoutId=setTimeout(function(){t._onTimeout&&t._onTimeout()},e))},n(62),e.setImmediate=setImmediate,e.clearImmediate=clearImmediate},function(t,e,n){(function(t){function n(t,e){for(var n=0,r=t.length-1;r>=0;r--){var i=t[r];"."===i?t.splice(r,1):".."===i?(t.splice(r,1),n++):n&&(t.splice(r,1),n--)}if(e)for(;n--;n)t.unshift("..");return t}function r(t,e){if(t.filter)return t.filter(e);for(var n=[],r=0;r<t.length;r++)e(t[r],r,t)&&n.push(t[r]);return n}var i=/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/,o=function(t){return i.exec(t).slice(1)};e.resolve=function(){for(var e="",i=!1,o=arguments.length-1;o>=-1&&!i;o--){var s=o>=0?arguments[o]:t.cwd();if("string"!=typeof s)throw new TypeError("Arguments to path.resolve must be strings");s&&(e=s+"/"+e,i="/"===s.charAt(0))}return e=n(r(e.split("/"),function(t){return!!t}),!i).join("/"),(i?"/":"")+e||"."},e.normalize=function(t){var i=e.isAbsolute(t),o="/"===s(t,-1);return(t=n(r(t.split("/"),function(t){return!!t}),!i).join("/"))||i||(t="."),t&&o&&(t+="/"),(i?"/":"")+t},e.isAbsolute=function(t){return"/"===t.charAt(0)},e.join=function(){var t=Array.prototype.slice.call(arguments,0);return e.normalize(r(t,function(t,e){if("string"!=typeof t)throw new TypeError("Arguments to path.join must be strings");return t}).join("/"))},e.relative=function(t,n){function r(t){for(var e=0;e<t.length&&""===t[e];e++);for(var n=t.length-1;n>=0&&""===t[n];n--);return e>n?[]:t.slice(e,n-e+1)}t=e.resolve(t).substr(1),n=e.resolve(n).substr(1);for(var i=r(t.split("/")),o=r(n.split("/")),s=Math.min(i.length,o.length),a=s,c=0;c<s;c++)if(i[c]!==o[c]){a=c;break}for(var f=[],c=a;c<i.length;c++)f.push("..");return(f=f.concat(o.slice(a))).join("/")},e.sep="/",e.delimiter=":",e.dirname=function(t){var e=o(t),n=e[0],r=e[1];return n||r?(r&&(r=r.substr(0,r.length-1)),n+r):"."},e.basename=function(t,e){var n=o(t)[2];return e&&n.substr(-1*e.length)===e&&(n=n.substr(0,n.length-e.length)),n},e.extname=function(t){return o(t)[3]};var s="b"==="ab".substr(-1)?function(t,e,n){return t.substr(e,n)}:function(t,e,n){return e<0&&(e=t.length+e),t.substr(e,n)}}).call(e,n(0))},function(t,e,n){(e=t.exports=n(35)).Stream=e,e.Readable=e,e.Writable=n(25),e.Duplex=n(8),e.Transform=n(39),e.PassThrough=n(68)},function(t,e,n){(function(t){function n(t){return Object.prototype.toString.call(t)}e.isArray=function(t){return Array.isArray?Array.isArray(t):"[object Array]"===n(t)},e.isBoolean=function(t){return"boolean"==typeof t},e.isNull=function(t){return null===t},e.isNullOrUndefined=function(t){return null==t},e.isNumber=function(t){return"number"==typeof t},e.isString=function(t){return"string"==typeof t},e.isSymbol=function(t){return"symbol"==typeof t},e.isUndefined=function(t){return void 0===t},e.isRegExp=function(t){return"[object RegExp]"===n(t)},e.isObject=function(t){return"object"==typeof t&&null!==t},e.isDate=function(t){return"[object Date]"===n(t)},e.isError=function(t){return"[object Error]"===n(t)||t instanceof Error},e.isFunction=function(t){return"function"==typeof t},e.isPrimitive=function(t){return null===t||"boolean"==typeof t||"number"==typeof t||"string"==typeof t||"symbol"==typeof t||void 0===t},e.isBuffer=t.isBuffer}).call(e,n(1).Buffer)},function(t,e,n){"use strict";t.exports=function(t,e){function n(o){if(r=o,i)return n.abort();!function n(){for(var o=!0,s=!1;o;)if(s=!1,r(null,function(a,c){if(s=!0,a=a||i){if(o=!1,e)e(!0===a?null:a);else if(a&&!0!==a)throw a}else t&&!1===t(c)||i?(o=!1,r(i||!0,e||function(){})):o||n()}),!s)return void(o=!1)}()}var r,i;return n.abort=function(t,e){if("function"==typeof t&&(e=t,t=!0),i=t||!0,r)return r(i,e||function(){})},n}},function(t,e){t.exports=function(t){return t&&("string"==typeof t?function(e){return e[t]}:"object"==typeof t&&"function"==typeof t.exec?function(e){var n=t.exec(e);return n&&n[0]}:t)}},function(t,e){t.exports={}},function(t,e,n){"use strict";function r(){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=n(6),o=n(9);e.BlockHash=r,r.prototype.update=function(t,e){if(t=i.toArray(t,e),this.pending?this.pending=this.pending.concat(t):this.pending=t,this.pendingTotal+=t.length,this.pending.length>=this._delta8){var n=(t=this.pending).length%this._delta8;this.pending=t.slice(t.length-n,t.length),0===this.pending.length&&(this.pending=null),t=i.join32(t,0,t.length-n,this.endian);for(var r=0;r<t.length;r+=this._delta32)this._update(t,r,r+this._delta32)}return this},r.prototype.digest=function(t){return this.update(this._pad()),o(null===this.pending),this._digest(t)},r.prototype._pad=function(){var t=this.pendingTotal,e=this._delta8,n=e-(t+this.padLength)%e,r=new Array(n+this.padLength);r[0]=128;for(var i=1;i<n;i++)r[i]=0;if(t<<=3,"big"===this.endian){for(var o=8;o<this.padLength;o++)r[i++]=0;r[i++]=0,r[i++]=0,r[i++]=0,r[i++]=0,r[i++]=t>>>24&255,r[i++]=t>>>16&255,r[i++]=t>>>8&255,r[i++]=255&t}else for(r[i++]=255&t,r[i++]=t>>>8&255,r[i++]=t>>>16&255,r[i++]=t>>>24&255,r[i++]=0,r[i++]=0,r[i++]=0,r[i++]=0,o=8;o<this.padLength;o++)r[i++]=0;return r}},function(t,e,n){"use strict";(function(e){const r=n(12),i=n(4).EventEmitter,o=n(13),s=n(69),a=n(40),c=n(43),f=n(49),u=n(151),h=n(152),d=n(153),l={Index:u,maxHistory:-1,path:"./orbitdb",replicate:!0};class p{constructor(t,e,n,o){let s=Object.assign({},l);Object.assign(s,o),this.options=s,this._type="store",this.id=e,this.address=n,this.dbname=n.path||"",this.events=new i,this._ipfs=t,this._cache=o&&o.cache?o.cache:new c(this.options.path,this.dbname),this._index=new this.options.Index(this.id),this._keystore=o&&o.keystore?o.keystore:new f(r.join(this.options.path,this.id,"/keystore")),this._ipfs.keystore=this._keystore,this._key=this._keystore.getKey(e)||this._keystore.createKey(e);const u={admin:[this._key.getPublic("hex")],read:[],write:[this._key.getPublic("hex")]};this.access=o.accessController||u,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 h(this),this._loader.on("load.added",t=>{this._replicationInfo.max=Math.max.apply(null,[this._replicationInfo.max,this._oplog.length,t.clock?t.clock.time:0]),this.events.emit("replicate",this.address.toString())}),this._loader.on("load.start",(t,e)=>{this._replicationInfo.max=Math.max.apply(null,[this._replicationInfo.max,this._oplog.length,t.clock?t.clock.time:0])}),this._loader.on("load.progress",(t,e,n,r,i)=>{this._replicationInfo.progress=Math.max.apply(null,[this._replicationInfo.progress,this._oplog.length]),this.events.emit("replicate.progress",this.address.toString(),e,n,this._replicationInfo.progress,this._replicationInfo.have)}),this._loader.on("load.end",async(t,e)=>{try{await this._oplog.join(t,-1,this._oplog.id),this._replicator.replicate(this._oplog),this._index.updateIndex(this._oplog),this._calculateReplicationInfo(e),this.events.emit("replicated",this.address.toString())}catch(t){console.error(t)}}),this._replicator=new d(this._loader),this._replicator.replicate(this._oplog),this.options.replicate&&this._replicator.start()}catch(t){console.error("Store Error:",t)}}_calculateReplicationInfo(t){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),t&&(this._replicationInfo.have=Object.assign(this._replicationInfo.have,t))}get all(){return Array.isArray(this._index._index)?this._index._index:Object.keys(this._index._index).map(t=>this._index._index[t])}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"),this.events.emit("closed",this.address.toString()),Promise.resolve()}async drop(){const t=this.address.toString();await this._cache.set(t,{}),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 c(this.options.path,this.dbname)}async load(t){this._replicator.stop();try{await this._cache.load()}catch(t){console.warn("Couldn't load Cache:",t)}const e=this._cache.get(this.address.toString())||e,n=e.localHeads||[],r=e.remoteHeads||[];if(this._replicationInfo.max=Math.max(this._replicationInfo.max,n.concat(r).reduce((t,e)=>Math.max(t,e.clock.time),0)),n||r){this.events.emit("load",this.address.toString()),t=t||this.options.maxHistory;let e,i;if(n&&n.length>0)for(const r of n){e=await a.fromEntryHash(this._ipfs,r.hash,this._oplog.id,t,this._oplog.values,this.key,this.access.write,this._onLoadProgress.bind(this)),await this._oplog.join(e,-1,this._oplog.id);const n=this._oplog.values[this._oplog.length-1];this._replicationInfo.max=Math.max.apply(null,[this._replicationInfo.max,this._oplog.length,this._oplog.values[this._oplog.length-1].clock.time,0]),this._replicationInfo.progress=Math.max.apply(null,[this._replicationInfo.progress,this._oplog.length]),this._onLoadProgress(n.hash,n,this._replicationInfo.progress,this._replicationInfo.max)}if(r&&r.length>0){this._replicationInfo.max=Math.max.apply(null,[this._replicationInfo.max,this._oplog.length,r[0].clock.time,0]);for(const e of r){i=await a.fromEntryHash(this._ipfs,e.hash,this._oplog.id,t,this._oplog.values,this.key,this.access.write,this._onLoadProgress.bind(this)),await this._oplog.join(i,-1,this._oplog.id);const n=this._oplog.values[this._oplog.length-1];this._replicationInfo.max=Math.max.apply(null,[this._replicationInfo.max,this._oplog.length,this._oplog.values[this._oplog.length-1].clock.time,0]),this._replicationInfo.progress=Math.max.apply(null,[this._replicationInfo.progress,this._oplog.length]),this._onLoadProgress(n.hash,n,this._replicationInfo.progress,this._replicationInfo.max)}}const o=this._oplog.values[this._oplog.length-1];o&&this._onLoadProgress(o.hash,o,this._replicationInfo.progress,this._replicationInfo.max),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(t,n,r,i=!0,o=-1,a=0){this._stats.syncRequestsReceieved+=1;return s(t,t=>{if(!t)return console.warn("Warning: Given input entry was 'null'."),Promise.resolve(null);if(!this.access.write.includes(t.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 n=Object.assign({},t);return n.hash=null,this._ipfs.object.put(e.from(JSON.stringify(n))).then(t=>t.toJSON().multihash).then(e=>(e!==t.hash&&console.warn("\"WARNING! Head hash didn't match the contents"),e)).then(()=>t)}).then(async e=>{const n=this.address.toString();let r=Object.assign({},this._cache.get(n),{remoteHeads:t});return await this._cache.set(n,r),this._loader.load(e.filter(t=>null!==t))})}loadMoreFrom(t,e){this._loader.load(e)}async saveSnapshot(){const t=Object.keys(this._loader._fetching).map(t=>this._loader._fetching[t]).concat(this._loader._queue.map(t=>t));let n=this._oplog.toSnapshot(),r=new e(JSON.stringify({id:n.id,heads:n.heads,size:n.values.length,type:this.type}));const i=new o;let s=new Uint16Array([r.length]),a=new e(s.buffer);i.push(a),i.push(r),n.values.forEach(t=>{let n=new e(JSON.stringify(t)),r=new Uint16Array([n.length]);i.push(new e(r.buffer)),i.push(n)}),i.push(null);const c={path:this.address.toString(),content:i},f=await this._ipfs.files.add(c),u=this.address.toString();let h=Object.assign({},this._cache.get(u),{snapshot:f[f.length-1],queue:t,type:this.type,max:this._replicationInfo.max});return await this._cache.set(u,h),f}async loadFromSnapshot(t){this.events.emit("load",this.address.toString()),await this._cache.load();const n=this._cache.get(this.address.toString());if(this._replicationInfo.max=Math.max(this._replicationInfo.max,n.max||0),this.sync(n.queue||[]),!n.snapshot)throw new Error(`Snapshot for ${this.address} not found!`);{const t=await this._ipfs.files.cat(n.snapshot.hash),r=await(()=>new Promise((n,r)=>{let i=new e(0),o=[];t.on("data",t=>{if(this._byteSize+=t.length,o.length<2e3)o.push(t);else{const t=e.concat(o);i=e.concat([i,t]),o=[]}}),t.on("end",()=>{function t(t){for(var e=new ArrayBuffer(t.length),n=new Uint8Array(e),r=0;r<t.length;++r)n[r]=t[r];return e}if(o.length>0){const t=e.concat(o);i=e.concat([i,t])}const r=parseInt(new Uint16Array(t(i.slice(0,2)))),s=JSON.parse(i.slice(2,r+2));let a=[],c=2+r;for(;c<i.length;){const e=parseInt(new Uint16Array(t(i.slice(c,c+2))));c+=2;const n=i.slice(c,c+e);try{const t=JSON.parse(n);a.push(t)}catch(t){}c+=e}this._type=s.type,this._replicationInfo.max=Math.max(this._replicationInfo.max,a.reduce((t,e)=>Math.max(t,e.clock.time),0)),n({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,(t,e,n,r)=>{this._replicationInfo.max=Math.max(this._replicationInfo.max,e.clock.time),this._replicationInfo.progress=Math.max.apply(null,[this._replicationInfo.progress,n,this._oplog.length]),this._onLoadProgress(t,e,this._replicationInfo.progress,this._replicationInfo.max)});await this._oplog.join(i,-1,this._oplog.id),this._oplog.values.forEach(t=>this._replicationInfo.have[t.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(t,e,n,r){if(this._oplog){const e=await this._oplog.append(t);this._replicationInfo.max=Math.max(this._replicationInfo.max,e.clock.time),this._replicationInfo.progress++;const n=this.address.toString();let i=Object.assign({},this._cache.get(n),{localHeads:[e],max:this._replicationInfo.max});return await this._cache.set(n,i),this._index.updateIndex(this._oplog),this.events.emit("write",this.address.toString(),e,this._oplog.heads),r&&r(e),e.hash}}_addOperationBatch(t,e,n,r){throw new Error("Not implemented!")}_onLoadProgress(t,e,n,r){this.events.emit("load.progress",this.address.toString(),t,e,Math.max(this._oplog.length,n),Math.max(this._oplog.length||0,this._replicationInfo.max||0))}}t.exports=p}).call(e,n(1).Buffer)},function(t,e,n){"use strict";(function(e){function n(t,n,r,i){if("function"!=typeof t)throw new TypeError('"callback" argument must be a function');var o,s,a=arguments.length;switch(a){case 0:case 1:return e.nextTick(t);case 2:return e.nextTick(function(){t.call(null,n)});case 3:return e.nextTick(function(){t.call(null,n,r)});case 4:return e.nextTick(function(){t.call(null,n,r,i)});default:for(o=new Array(a-1),s=0;s<o.length;)o[s++]=arguments[s];return e.nextTick(function(){t.apply(null,o)})}}!e.version||0===e.version.indexOf("v0.")||0===e.version.indexOf("v1.")&&0!==e.version.indexOf("v1.8.")?t.exports=n:t.exports=e.nextTick}).call(e,n(0))},function(t,e,n){"use strict";t.exports=((t,e,n)=>new Promise((r,i)=>{if(n=Object.assign({concurrency:1/0},n),"function"!=typeof e)throw new TypeError("Mapper function is required");const o=n.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=t[Symbol.iterator]();let c=!1,f=!1,u=0,h=0;const d=()=>{if(c)return;const t=a.next(),n=h;if(h++,t.done)return f=!0,void(0===u&&r(s));u++,Promise.resolve(t.value).then(t=>e(t,n)).then(t=>{s[n]=t,u--,d()},t=>{c=!0,i(t)})};for(let t=0;t<o&&(d(),!f);t++);}))},function(t,e,n){"use strict";var r=n(77),i=n(83),o=n(89);(e=t.exports=n(97)).pull=e;for(var s in r)e[s]=r[s];for(var s in o)e[s]=o[s];for(var s in i)e[s]=i[s]},function(t,e,n){"use strict";var r=e;r.base=n(114),r.short=n(115),r.mont=n(116),r.edwards=n(117)},function(t,e,n){(function(t,r){function i(t,n){var r={seen:[],stylize:s};return arguments.length>=3&&(r.depth=arguments[2]),arguments.length>=4&&(r.colors=arguments[3]),h(n)?r.showHidden=n:n&&e._extend(r,n),b(r.showHidden)&&(r.showHidden=!1),b(r.depth)&&(r.depth=2),b(r.colors)&&(r.colors=!1),b(r.customInspect)&&(r.customInspect=!0),r.colors&&(r.stylize=o),a(r,t,r.depth)}function o(t,e){var n=i.styles[e];return n?"["+i.colors[n][0]+"m"+t+"["+i.colors[n][1]+"m":t}function s(t,e){return t}function a(t,n,r){if(t.customInspect&&n&&_(n.inspect)&&n.inspect!==e.inspect&&(!n.constructor||n.constructor.prototype!==n)){var i=n.inspect(r,t);return p(i)||(i=a(t,i,r)),i}var o=function(t,e){if(b(e))return t.stylize("undefined","undefined");if(p(e)){var n="'"+JSON.stringify(e).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return t.stylize(n,"string")}if(l(e))return t.stylize(""+e,"number");if(h(e))return t.stylize(""+e,"boolean");if(d(e))return t.stylize("null","null")}(t,n);if(o)return o;var s=Object.keys(n),m=function(t){var e={};return t.forEach(function(t,n){e[t]=!0}),e}(s);if(t.showHidden&&(s=Object.getOwnPropertyNames(n)),v(n)&&(s.indexOf("message")>=0||s.indexOf("description")>=0))return c(n);if(0===s.length){if(_(n)){var w=n.name?": "+n.name:"";return t.stylize("[Function"+w+"]","special")}if(y(n))return t.stylize(RegExp.prototype.toString.call(n),"regexp");if(g(n))return t.stylize(Date.prototype.toString.call(n),"date");if(v(n))return c(n)}var S="",x=!1,E=["{","}"];if(u(n)&&(x=!0,E=["[","]"]),_(n)){S=" [Function"+(n.name?": "+n.name:"")+"]"}if(y(n)&&(S=" "+RegExp.prototype.toString.call(n)),g(n)&&(S=" "+Date.prototype.toUTCString.call(n)),v(n)&&(S=" "+c(n)),0===s.length&&(!x||0==n.length))return E[0]+S+E[1];if(r<0)return y(n)?t.stylize(RegExp.prototype.toString.call(n),"regexp"):t.stylize("[Object]","special");t.seen.push(n);var M;return M=x?function(t,e,n,r,i){for(var o=[],s=0,a=e.length;s<a;++s)k(e,String(s))?o.push(f(t,e,n,r,String(s),!0)):o.push("");return i.forEach(function(i){i.match(/^\d+$/)||o.push(f(t,e,n,r,i,!0))}),o}(t,n,r,m,s):s.map(function(e){return f(t,n,r,m,e,x)}),t.seen.pop(),function(t,e,n){var r=0;if(t.reduce(function(t,e){return r++,e.indexOf("\n")>=0&&r++,t+e.replace(/\u001b\[\d\d?m/g,"").length+1},0)>60)return n[0]+(""===e?"":e+"\n ")+" "+t.join(",\n ")+" "+n[1];return n[0]+e+" "+t.join(", ")+" "+n[1]}(M,S,E)}function c(t){return"["+Error.prototype.toString.call(t)+"]"}function f(t,e,n,r,i,o){var s,c,f;if((f=Object.getOwnPropertyDescriptor(e,i)||{value:e[i]}).get?c=f.set?t.stylize("[Getter/Setter]","special"):t.stylize("[Getter]","special"):f.set&&(c=t.stylize("[Setter]","special")),k(r,i)||(s="["+i+"]"),c||(t.seen.indexOf(f.value)<0?(c=d(n)?a(t,f.value,null):a(t,f.value,n-1)).indexOf("\n")>-1&&(c=o?c.split("\n").map(function(t){return" "+t}).join("\n").substr(2):"\n"+c.split("\n").map(function(t){return" "+t}).join("\n")):c=t.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=t.stylize(s,"name")):(s=s.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),s=t.stylize(s,"string"))}return s+": "+c}function u(t){return Array.isArray(t)}function h(t){return"boolean"==typeof t}function d(t){return null===t}function l(t){return"number"==typeof t}function p(t){return"string"==typeof t}function b(t){return void 0===t}function y(t){return m(t)&&"[object RegExp]"===w(t)}function m(t){return"object"==typeof t&&null!==t}function g(t){return m(t)&&"[object Date]"===w(t)}function v(t){return m(t)&&("[object Error]"===w(t)||t instanceof Error)}function _(t){return"function"==typeof t}function w(t){return Object.prototype.toString.call(t)}function S(t){return t<10?"0"+t.toString(10):t.toString(10)}function k(t,e){return Object.prototype.hasOwnProperty.call(t,e)}var x=/%[sdj%]/g;e.format=function(t){if(!p(t)){for(var e=[],n=0;n<arguments.length;n++)e.push(i(arguments[n]));return e.join(" ")}for(var n=1,r=arguments,o=r.length,s=String(t).replace(x,function(t){if("%%"===t)return"%";if(n>=o)return t;switch(t){case"%s":return String(r[n++]);case"%d":return Number(r[n++]);case"%j":try{return JSON.stringify(r[n++])}catch(t){return"[Circular]"}default:return t}}),a=r[n];n<o;a=r[++n])d(a)||!m(a)?s+=" "+a:s+=" "+i(a);return s},e.deprecate=function(n,i){if(b(t.process))return function(){return e.deprecate(n,i).apply(this,arguments)};if(!0===r.noDeprecation)return n;var o=!1;return function(){if(!o){if(r.throwDeprecation)throw new Error(i);r.traceDeprecation?console.trace(i):console.error(i),o=!0}return n.apply(this,arguments)}};var E,M={};e.debuglog=function(t){if(b(E)&&(E=Object({NODE_ENV:void 0}).NODE_DEBUG||""),t=t.toUpperCase(),!M[t])if(new RegExp("\\b"+t+"\\b","i").test(E)){var n=r.pid;M[t]=function(){var r=e.format.apply(e,arguments);console.error("%s %d: %s",t,n,r)}}else M[t]=function(){};return M[t]},e.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"},e.isArray=u,e.isBoolean=h,e.isNull=d,e.isNullOrUndefined=function(t){return null==t},e.isNumber=l,e.isString=p,e.isSymbol=function(t){return"symbol"==typeof t},e.isUndefined=b,e.isRegExp=y,e.isObject=m,e.isDate=g,e.isError=v,e.isFunction=_,e.isPrimitive=function(t){return null===t||"boolean"==typeof t||"number"==typeof t||"string"==typeof t||"symbol"==typeof t||void 0===t},e.isBuffer=n(144);var A=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];e.log=function(){console.log("%s - %s",function(){var t=new Date,e=[S(t.getHours()),S(t.getMinutes()),S(t.getSeconds())].join(":");return[t.getDate(),A[t.getMonth()],e].join(" ")}(),e.format.apply(e,arguments))},e.inherits=n(145),e._extend=function(t,e){if(!e||!m(e))return t;for(var n=Object.keys(e),r=n.length;r--;)t[n[r]]=e[n[r]];return t}}).call(e,n(3),n(0))},function(t,e,n){"use strict";(function(e,r,i){function o(t){var e=this;this.next=null,this.entry=null,this.finish=function(){!function(t,e,n){var r=t.entry;t.entry=null;for(;r;){var i=r.callback;e.pendingcb--,i(n),r=r.next}e.corkedRequestsFree?e.corkedRequestsFree.next=t:e.corkedRequestsFree=t}(e,t)}}function s(){}function a(t,e){m=m||n(8),t=t||{},this.objectMode=!!t.objectMode,e instanceof m&&(this.objectMode=this.objectMode||!!t.writableObjectMode);var r=t.highWaterMark,i=this.objectMode?16:16384;this.highWaterMark=r||0===r?r: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===t.decodeStrings;this.decodeStrings=!s,this.defaultEncoding=t.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(t){!function(t,e){var n=t._writableState,r=n.sync,i=n.writecb;if(function(t){t.writing=!1,t.writecb=null,t.length-=t.writelen,t.writelen=0}(n),e)!function(t,e,n,r,i){--e.pendingcb,n?(y(i,r),y(b,t,e),t._writableState.errorEmitted=!0,t.emit("error",r)):(i(r),t._writableState.errorEmitted=!0,t.emit("error",r),b(t,e))}(t,n,r,e,i);else{var o=l(n);o||n.corked||n.bufferProcessing||!n.bufferedRequest||d(t,n),r?g(h,t,n,o,i):h(t,n,o,i)}}(e,t)},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(t){if(m=m||n(8),!(E.call(c,this)||this instanceof m))return new c(t);this._writableState=new a(t,this),this.writable=!0,t&&("function"==typeof t.write&&(this._write=t.write),"function"==typeof t.writev&&(this._writev=t.writev),"function"==typeof t.destroy&&(this._destroy=t.destroy),"function"==typeof t.final&&(this._final=t.final)),w.call(this)}function f(t,e,n,r,i,o){if(!n){var s=function(t,e,n){return t.objectMode||!1===t.decodeStrings||"string"!=typeof e||(e=S.from(e,n)),e}(e,r,i);r!==s&&(n=!0,i="buffer",r=s)}var a=e.objectMode?1:r.length;e.length+=a;var c=e.length<e.highWaterMark;if(c||(e.needDrain=!0),e.writing||e.corked){var f=e.lastBufferedRequest;e.lastBufferedRequest={chunk:r,encoding:i,isBuf:n,callback:o,next:null},f?f.next=e.lastBufferedRequest:e.bufferedRequest=e.lastBufferedRequest,e.bufferedRequestCount+=1}else u(t,e,!1,a,r,i,o);return c}function u(t,e,n,r,i,o,s){e.writelen=r,e.writecb=s,e.writing=!0,e.sync=!0,n?t._writev(i,e.onwrite):t._write(i,o,e.onwrite),e.sync=!1}function h(t,e,n,r){n||function(t,e){0===e.length&&e.needDrain&&(e.needDrain=!1,t.emit("drain"))}(t,e),e.pendingcb--,r(),b(t,e)}function d(t,e){e.bufferProcessing=!0;var n=e.bufferedRequest;if(t._writev&&n&&n.next){var r=e.bufferedRequestCount,i=new Array(r),s=e.corkedRequestsFree;s.entry=n;for(var a=0,c=!0;n;)i[a]=n,n.isBuf||(c=!1),n=n.next,a+=1;i.allBuffers=c,u(t,e,!0,e.length,i,"",s.finish),e.pendingcb++,e.lastBufferedRequest=null,s.next?(e.corkedRequestsFree=s.next,s.next=null):e.corkedRequestsFree=new o(e)}else{for(;n;){var f=n.chunk,h=n.encoding,d=n.callback;if(u(t,e,!1,e.objectMode?1:f.length,f,h,d),n=n.next,e.writing)break}null===n&&(e.lastBufferedRequest=null)}e.bufferedRequestCount=0,e.bufferedRequest=n,e.bufferProcessing=!1}function l(t){return t.ending&&0===t.length&&null===t.bufferedRequest&&!t.finished&&!t.writing}function p(t,e){t._final(function(n){e.pendingcb--,n&&t.emit("error",n),e.prefinished=!0,t.emit("prefinish"),b(t,e)})}function b(t,e){var n=l(e);return n&&(!function(t,e){e.prefinished||e.finalCalled||("function"==typeof t._final?(e.pendingcb++,e.finalCalled=!0,y(p,t,e)):(e.prefinished=!0,t.emit("prefinish")))}(t,e),0===e.pendingcb&&(e.finished=!0,t.emit("finish"))),n}var y=n(20);t.exports=c;var m,g=!e.browser&&["v0.10","v0.9."].indexOf(e.version.slice(0,5))>-1?r:y;c.WritableState=a;var v=n(14);v.inherits=n(5);var _={deprecate:n(67)},w=n(36),S=n(10).Buffer,k=i.Uint8Array||function(){},x=n(37);v.inherits(c,w),a.prototype.getBuffer=function(){for(var t=this.bufferedRequest,e=[];t;)e.push(t),t=t.next;return e},function(){try{Object.defineProperty(a.prototype,"buffer",{get:_.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch(t){}}();var E;"function"==typeof Symbol&&Symbol.hasInstance&&"function"==typeof Function.prototype[Symbol.hasInstance]?(E=Function.prototype[Symbol.hasInstance],Object.defineProperty(c,Symbol.hasInstance,{value:function(t){return!!E.call(this,t)||t&&t._writableState instanceof a}})):E=function(t){return t instanceof this},c.prototype.pipe=function(){this.emit("error",new Error("Cannot pipe, not readable"))},c.prototype.write=function(t,e,n){var r=this._writableState,i=!1,o=function(t){return S.isBuffer(t)||t instanceof k}(t)&&!r.objectMode;return o&&!S.isBuffer(t)&&(t=function(t){return S.from(t)}(t)),"function"==typeof e&&(n=e,e=null),o?e="buffer":e||(e=r.defaultEncoding),"function"!=typeof n&&(n=s),r.ended?function(t,e){var n=new Error("write after end");t.emit("error",n),y(e,n)}(this,n):(o||function(t,e,n,r){var i=!0,o=!1;return null===n?o=new TypeError("May not write null values to stream"):"string"==typeof n||void 0===n||e.objectMode||(o=new TypeError("Invalid non-string/buffer chunk")),o&&(t.emit("error",o),y(r,o),i=!1),i}(this,r,t,n))&&(r.pendingcb++,i=f(this,r,o,t,e,n)),i},c.prototype.cork=function(){this._writableState.corked++},c.prototype.uncork=function(){var t=this._writableState;t.corked&&(t.corked--,t.writing||t.corked||t.finished||t.bufferProcessing||!t.bufferedRequest||d(this,t))},c.prototype.setDefaultEncoding=function(t){if("string"==typeof t&&(t=t.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((t+"").toLowerCase())>-1))throw new TypeError("Unknown encoding: "+t);return this._writableState.defaultEncoding=t,this},c.prototype._write=function(t,e,n){n(new Error("_write() is not implemented"))},c.prototype._writev=null,c.prototype.end=function(t,e,n){var r=this._writableState;"function"==typeof t?(n=t,t=null,e=null):"function"==typeof e&&(n=e,e=null),null!==t&&void 0!==t&&this.write(t,e),r.corked&&(r.corked=1,this.uncork()),r.ending||r.finished||function(t,e,n){e.ending=!0,b(t,e),n&&(e.finished?y(n):t.once("finish",n)),e.ended=!0,t.writable=!1}(this,r,n)},Object.defineProperty(c.prototype,"destroyed",{get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(t){this._writableState&&(this._writableState.destroyed=t)}}),c.prototype.destroy=x.destroy,c.prototype._undestroy=x.undestroy,c.prototype._destroy=function(t,e){this.end(),e(t)}}).call(e,n(0),n(11).setImmediate,n(3))},function(t,e,n){"use strict";(function(e){const r=n(27),i=n(28),o=()=>new Error("Ipfs instance not defined");class s{static async create(t,e,n,a=[],c,f){if(!i(t))throw o();if(!i(e))throw new Error("Entry requires an id");if(!i(n))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:e,payload:n,next:a.filter(i).map(t=>t.hash?t.hash:t),v:0,clock:new r(e,c?c.time:null)};return t.keystore&&f&&(u=await s.signEntry(t.keystore,u,f)),u.hash=await s.toMultihash(t,u),u}static async signEntry(t,n,r){const i=await t.sign(r,new e(JSON.stringify(n)));return n.sig=i,n.key=r.getPublic("hex"),n}static async verifyEntry(t,n){const r=Object.assign({},{hash:null,id:t.id,payload:t.payload,next:t.next,v:t.v,clock:t.clock}),i=await n.importPublicKey(t.key);await n.verify(t.sig,i,new e(JSON.stringify(r)))}static toMultihash(t,n){if(!t)throw o();const r=e.from(JSON.stringify(n));return t.object.put(r).then(t=>t.toJSON().multihash)}static fromMultihash(t,e){if(!t)throw o();if(!e)throw new Error(`Invalid hash: ${e}`);return t.object.get(e,{enc:"base58"}).then(t=>JSON.parse(t.toJSON().data)).then(t=>{let n={hash:e,id:t.id,payload:t.payload,next:t.next,v:t.v,clock:t.clock};return t.sig&&Object.assign(n,{sig:t.sig}),t.key&&Object.assign(n,{key:t.key}),n})}static isEntry(t){return void 0!==t.id&&void 0!==t.next&&void 0!==t.hash&&void 0!==t.payload&&void 0!==t.v&&void 0!==t.clock}static compare(t,e){var n=r.compare(t.clock,e.clock);return 0===n?t.clock.id<e.clock.id?-1:1:n}static isEqual(t,e){return t.hash===e.hash}static isParent(t,e){return e.next.indexOf(t.hash)>-1}static findChildren(t,e){for(var n=[],r=e.find(e=>s.isParent(t,e)),i=t;r;)n.push(r),i=r,r=e.find(t=>s.isParent(i,t));return n=n.sort((t,e)=>t.clock.time>t.clock.time)}}t.exports=s}).call(e,n(1).Buffer)},function(t,e,n){"use strict";class r{constructor(t,e){this.id=t,this.time=e||0}tick(){return new r(this.id,++this.time)}merge(t){return this.time=Math.max(this.time,t.time),new r(this.id,this.time)}clone(){return new r(this.id,this.time)}static compare(t,e){var n=t.time-e.time;return 0===n&&t.id!==e.id?t.id<e.id?-1:1:n}}t.exports=r},function(t,e,n){"use strict";t.exports=(t=>void 0!==t&&null!==t)},function(t,e,n){"use strict";var r=n(44);t.exports=function(t,e){if(!t)return function(t,n){return t?r(n,t,e):n(!0)};Array.isArray(t)||(t=Object.keys(t).map(function(e){return t[e]}));var n=0;return function(i,o){if(i)return r(o,i,e);n>=t.length?o(!0):o(null,t[n++])}}},function(t,e,n){"use strict";var r=n(15);t.exports=function(t,e,n){n||(n=e,e=null);var i=r(function(n){e=t(e,n)},function(t){n(t,e)});return 2===arguments.length?function(t){t(null,function(r,o){if(r)return n(!0===r?null:r);e=o,i(t)})}:i}},function(t,e,n){"use strict";var r=n(46);t.exports=function(t){return t=r(t),function(e){return function n(r,i){for(var o,s=!0;s;)s=!1,o=!0,e(r,function(e,r){if(!e&&!t(r))return o?s=!0:n(e,i);i(e,r)}),o=!1}}}},function(t,e,n){var r=e;r.utils=n(6),r.common=n(18),r.sha=n(119),r.ripemd=n(123),r.hmac=n(124),r.sha1=r.sha.sha1,r.sha256=r.sha.sha256,r.sha224=r.sha.sha224,r.sha384=r.sha.sha384,r.sha512=r.sha.sha512,r.ripemd160=r.ripemd.ripemd160},function(t,e){var n={}.toString;t.exports=Array.isArray||function(t){return"[object Array]"==n.call(t)}},function(t,e,n){"use strict";const r=n(19),i=n(154);class o extends r{constructor(t,e,n,r={}){void 0===r.Index&&Object.assign(r,{Index:i}),super(t,e,n,r),this._type="eventlog"}add(t){return this._addOperation({op:"ADD",key:null,value:t})}get(t){return this.iterator({gte:t,limit:1}).collect()[0]}iterator(t){const e=this._query(t);let n=0;return{[Symbol.iterator](){return this},next(){let t={value:null,done:!0};return n<e.length&&(t={value:e[n],done:!1},n++),t},collect:()=>e}}_query(t){t||(t={});const e=t.limit?t.limit>-1?t.limit:this._index.get().length:1,n=this._index.get().slice();let r=[];return r=t.gt||t.gte?this._read(n,t.gt?t.gt:t.gte,e,!!t.gte):this._read(n.reverse(),t.lt?t.lt:t.lte,e,t.lte||!t.lt).reverse()}_read(t,e,n,r){const i=t.map(t=>t.hash).indexOf(e);let o=Math.max(i,0);o+=r?0:1;return t.slice(o).slice(0,n)}}t.exports=o},function(t,e,n){"use strict";(function(e,r){function i(t,e){w=w||n(8),t=t||{},this.objectMode=!!t.objectMode,e instanceof w&&(this.objectMode=this.objectMode||!!t.readableObjectMode);var r=t.highWaterMark,i=this.objectMode?16:16384;this.highWaterMark=r||0===r?r:i,this.highWaterMark=Math.floor(this.highWaterMark),this.buffer=new C,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=t.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,t.encoding&&(P||(P=n(38).StringDecoder),this.decoder=new P(t.encoding),this.encoding=t.encoding)}function o(t){if(w=w||n(8),!(this instanceof o))return new o(t);this._readableState=new i(t,this),this.readable=!0,t&&("function"==typeof t.read&&(this._read=t.read),"function"==typeof t.destroy&&(this._destroy=t.destroy)),x.call(this)}function s(t,e,n,r,i){var o=t._readableState;if(null===e)o.reading=!1,function(t,e){if(e.ended)return;if(e.decoder){var n=e.decoder.end();n&&n.length&&(e.buffer.push(n),e.length+=e.objectMode?1:n.length)}e.ended=!0,f(t)}(t,o);else{var s;i||(s=function(t,e){var n;(function(t){return E.isBuffer(t)||t instanceof M})(e)||"string"==typeof e||void 0===e||t.objectMode||(n=new TypeError("Invalid non-string/buffer chunk"));return n}(o,e)),s?t.emit("error",s):o.objectMode||e&&e.length>0?("string"==typeof e||o.objectMode||Object.getPrototypeOf(e)===E.prototype||(e=function(t){return E.from(t)}(e)),r?o.endEmitted?t.emit("error",new Error("stream.unshift() after end event")):a(t,o,e,!0):o.ended?t.emit("error",new Error("stream.push() after EOF")):(o.reading=!1,o.decoder&&!n?(e=o.decoder.write(e),o.objectMode||0!==e.length?a(t,o,e,!1):h(t,o)):a(t,o,e,!1))):r||(o.reading=!1)}return function(t){return!t.ended&&(t.needReadable||t.length<t.highWaterMark||0===t.length)}(o)}function a(t,e,n,r){e.flowing&&0===e.length&&!e.sync?(t.emit("data",n),t.read(0)):(e.length+=e.objectMode?1:n.length,r?e.buffer.unshift(n):e.buffer.push(n),e.needReadable&&f(t)),h(t,e)}function c(t,e){return t<=0||0===e.length&&e.ended?0:e.objectMode?1:t!=t?e.flowing&&e.length?e.buffer.head.data.length:e.length:(t>e.highWaterMark&&(e.highWaterMark=function(t){return t>=j?t=j:(t--,t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,t|=t>>>16,t++),t}(t)),t<=e.length?t:e.ended?e.length:(e.needReadable=!0,0))}function f(t){var e=t._readableState;e.needReadable=!1,e.emittedReadable||(I("emitReadable",e.flowing),e.emittedReadable=!0,e.sync?_(u,t):u(t))}function u(t){I("emit readable"),t.emit("readable"),b(t)}function h(t,e){e.readingMore||(e.readingMore=!0,_(d,t,e))}function d(t,e){for(var n=e.length;!e.reading&&!e.flowing&&!e.ended&&e.length<e.highWaterMark&&(I("maybeReadMore read 0"),t.read(0),n!==e.length);)n=e.length;e.readingMore=!1}function l(t){I("readable nexttick read 0"),t.read(0)}function p(t,e){e.reading||(I("resume read 0"),t.read(0)),e.resumeScheduled=!1,e.awaitDrain=0,t.emit("resume"),b(t),e.flowing&&!e.reading&&t.read(0)}function b(t){var e=t._readableState;for(I("flow",e.flowing);e.flowing&&null!==t.read(););}function y(t,e){if(0===e.length)return null;var n;return e.objectMode?n=e.buffer.shift():!t||t>=e.length?(n=e.decoder?e.buffer.join(""):1===e.buffer.length?e.buffer.head.data:e.buffer.concat(e.length),e.buffer.clear()):n=function(t,e,n){var r;t<e.head.data.length?(r=e.head.data.slice(0,t),e.head.data=e.head.data.slice(t)):r=t===e.head.data.length?e.shift():n?function(t,e){var n=e.head,r=1,i=n.data;t-=i.length;for(;n=n.next;){var o=n.data,s=t>o.length?o.length:t;if(s===o.length?i+=o:i+=o.slice(0,t),0===(t-=s)){s===o.length?(++r,n.next?e.head=n.next:e.head=e.tail=null):(e.head=n,n.data=o.slice(s));break}++r}return e.length-=r,i}(t,e):function(t,e){var n=E.allocUnsafe(t),r=e.head,i=1;r.data.copy(n),t-=r.data.length;for(;r=r.next;){var o=r.data,s=t>o.length?o.length:t;if(o.copy(n,n.length-t,0,s),0===(t-=s)){s===o.length?(++i,r.next?e.head=r.next:e.head=e.tail=null):(e.head=r,r.data=o.slice(s));break}++i}return e.length-=i,n}(t,e);return r}(t,e.buffer,e.decoder),n}function m(t){var e=t._readableState;if(e.length>0)throw new Error('"endReadable()" called on non-empty stream');e.endEmitted||(e.ended=!0,_(g,e,t))}function g(t,e){t.endEmitted||0!==t.length||(t.endEmitted=!0,e.readable=!1,e.emit("end"))}function v(t,e){for(var n=0,r=t.length;n<r;n++)if(t[n]===e)return n;return-1}var _=n(20);t.exports=o;var w,S=n(33);o.ReadableState=i;n(4).EventEmitter;var k=function(t,e){return t.listeners(e).length},x=n(36),E=n(10).Buffer,M=e.Uint8Array||function(){},A=n(14);A.inherits=n(5);var O=n(65),I=void 0;I=O&&O.debuglog?O.debuglog("stream"):function(){};var P,C=n(66),N=n(37);A.inherits(o,x);var R=["error","close","destroy","pause","resume"];Object.defineProperty(o.prototype,"destroyed",{get:function(){return void 0!==this._readableState&&this._readableState.destroyed},set:function(t){this._readableState&&(this._readableState.destroyed=t)}}),o.prototype.destroy=N.destroy,o.prototype._undestroy=N.undestroy,o.prototype._destroy=function(t,e){this.push(null),e(t)},o.prototype.push=function(t,e){var n,r=this._readableState;return r.objectMode?n=!0:"string"==typeof t&&((e=e||r.defaultEncoding)!==r.encoding&&(t=E.from(t,e),e=""),n=!0),s(this,t,e,!1,n)},o.prototype.unshift=function(t){return s(this,t,null,!0,!1)},o.prototype.isPaused=function(){return!1===this._readableState.flowing},o.prototype.setEncoding=function(t){return P||(P=n(38).StringDecoder),this._readableState.decoder=new P(t),this._readableState.encoding=t,this};var j=8388608;o.prototype.read=function(t){I("read",t),t=parseInt(t,10);var e=this._readableState,n=t;if(0!==t&&(e.emittedReadable=!1),0===t&&e.needReadable&&(e.length>=e.highWaterMark||e.ended))return I("read: emitReadable",e.length,e.ended),0===e.length&&e.ended?m(this):f(this),null;if(0===(t=c(t,e))&&e.ended)return 0===e.length&&m(this),null;var r=e.needReadable;I("need readable",r),(0===e.length||e.length-t<e.highWaterMark)&&I("length less than watermark",r=!0),e.ended||e.reading?I("reading or ended",r=!1):r&&(I("do read"),e.reading=!0,e.sync=!0,0===e.length&&(e.needReadable=!0),this._read(e.highWaterMark),e.sync=!1,e.reading||(t=c(n,e)));var i;return null===(i=t>0?y(t,e):null)?(e.needReadable=!0,t=0):e.length-=t,0===e.length&&(e.ended||(e.needReadable=!0),n!==t&&e.ended&&m(this)),null!==i&&this.emit("data",i),i},o.prototype._read=function(t){this.emit("error",new Error("_read() is not implemented"))},o.prototype.pipe=function(t,e){function n(e,r){I("onunpipe"),e===u&&r&&!1===r.hasUnpiped&&(r.hasUnpiped=!0,I("cleanup"),t.removeListener("close",a),t.removeListener("finish",c),t.removeListener("drain",l),t.removeListener("error",s),t.removeListener("unpipe",n),u.removeListener("end",i),u.removeListener("end",f),u.removeListener("data",o),p=!0,!h.awaitDrain||t._writableState&&!t._writableState.needDrain||l())}function i(){I("onend"),t.end()}function o(e){I("ondata"),y=!1;!1!==t.write(e)||y||((1===h.pipesCount&&h.pipes===t||h.pipesCount>1&&-1!==v(h.pipes,t))&&!p&&(I("false write response, pause",u._readableState.awaitDrain),u._readableState.awaitDrain++,y=!0),u.pause())}function s(e){I("onerror",e),f(),t.removeListener("error",s),0===k(t,"error")&&t.emit("error",e)}function a(){t.removeListener("finish",c),f()}function c(){I("onfinish"),t.removeListener("close",a),f()}function f(){I("unpipe"),u.unpipe(t)}var u=this,h=this._readableState;switch(h.pipesCount){case 0:h.pipes=t;break;case 1:h.pipes=[h.pipes,t];break;default:h.pipes.push(t)}h.pipesCount+=1,I("pipe count=%d opts=%j",h.pipesCount,e);var d=(!e||!1!==e.end)&&t!==r.stdout&&t!==r.stderr?i:f;h.endEmitted?_(d):u.once("end",d),t.on("unpipe",n);var l=function(t){return function(){var e=t._readableState;I("pipeOnDrain",e.awaitDrain),e.awaitDrain&&e.awaitDrain--,0===e.awaitDrain&&k(t,"data")&&(e.flowing=!0,b(t))}}(u);t.on("drain",l);var p=!1,y=!1;return u.on("data",o),function(t,e,n){if("function"==typeof t.prependListener)return t.prependListener(e,n);t._events&&t._events[e]?S(t._events[e])?t._events[e].unshift(n):t._events[e]=[n,t._events[e]]:t.on(e,n)}(t,"error",s),t.once("close",a),t.once("finish",c),t.emit("pipe",u),h.flowing||(I("pipe resume"),u.resume()),t},o.prototype.unpipe=function(t){var e=this._readableState,n={hasUnpiped:!1};if(0===e.pipesCount)return this;if(1===e.pipesCount)return t&&t!==e.pipes?this:(t||(t=e.pipes),e.pipes=null,e.pipesCount=0,e.flowing=!1,t&&t.emit("unpipe",this,n),this);if(!t){var r=e.pipes,i=e.pipesCount;e.pipes=null,e.pipesCount=0,e.flowing=!1;for(var o=0;o<i;o++)r[o].emit("unpipe",this,n);return this}var s=v(e.pipes,t);return-1===s?this:(e.pipes.splice(s,1),e.pipesCount-=1,1===e.pipesCount&&(e.pipes=e.pipes[0]),t.emit("unpipe",this,n),this)},o.prototype.on=function(t,e){var n=x.prototype.on.call(this,t,e);if("data"===t)!1!==this._readableState.flowing&&this.resume();else if("readable"===t){var r=this._readableState;r.endEmitted||r.readableListening||(r.readableListening=r.needReadable=!0,r.emittedReadable=!1,r.reading?r.length&&f(this):_(l,this))}return n},o.prototype.addListener=o.prototype.on,o.prototype.resume=function(){var t=this._readableState;return t.flowing||(I("resume"),t.flowing=!0,function(t,e){e.resumeScheduled||(e.resumeScheduled=!0,_(p,t,e))}(this,t)),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(t){var e=this._readableState,n=!1,r=this;t.on("end",function(){if(I("wrapped end"),e.decoder&&!e.ended){var t=e.decoder.end();t&&t.length&&r.push(t)}r.push(null)}),t.on("data",function(i){if(I("wrapped data"),e.decoder&&(i=e.decoder.write(i)),(!e.objectMode||null!==i&&void 0!==i)&&(e.objectMode||i&&i.length)){r.push(i)||(n=!0,t.pause())}});for(var i in t)void 0===this[i]&&"function"==typeof t[i]&&(this[i]=function(e){return function(){return t[e].apply(t,arguments)}}(i));for(var o=0;o<R.length;o++)t.on(R[o],r.emit.bind(r,R[o]));return r._read=function(e){I("wrapped _read",e),n&&(n=!1,t.resume())},r},o._fromList=y}).call(e,n(3),n(0))},function(t,e,n){t.exports=n(4).EventEmitter},function(t,e,n){"use strict";function r(t,e){t.emit("error",e)}var i=n(20);t.exports={destroy:function(t,e){var n=this,o=this._readableState&&this._readableState.destroyed,s=this._writableState&&this._writableState.destroyed;o||s?e?e(t):!t||this._writableState&&this._writableState.errorEmitted||i(r,this,t):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(t||null,function(t){!e&&t?(i(r,n,t),n._writableState&&(n._writableState.errorEmitted=!0)):e&&e(t)}))},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(t,e,n){"use strict";function r(t){this.encoding=function(t){var e=function(t){if(!t)return"utf8";for(var e;;)switch(t){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 t;default:if(e)return;t=(""+t).toLowerCase(),e=!0}}(t);if("string"!=typeof e&&(d.isEncoding===l||!l(t)))throw new Error("Unknown encoding: "+t);return e||t}(t);var e;switch(this.encoding){case"utf16le":this.text=s,this.end=a,e=4;break;case"utf8":this.fillLast=o,e=4;break;case"base64":this.text=c,this.end=f,e=3;break;default:return this.write=u,void(this.end=h)}this.lastNeed=0,this.lastTotal=0,this.lastChar=d.allocUnsafe(e)}function i(t){return t<=127?0:t>>5==6?2:t>>4==14?3:t>>3==30?4:-1}function o(t){var e=this.lastTotal-this.lastNeed,n=function(t,e,n){if(128!=(192&e[0]))return t.lastNeed=0,"<22>".repeat(n);if(t.lastNeed>1&&e.length>1){if(128!=(192&e[1]))return t.lastNeed=1,"<22>".repeat(n+1);if(t.lastNeed>2&&e.length>2&&128!=(192&e[2]))return t.lastNeed=2,"<22>".repeat(n+2)}}(this,t,e);return void 0!==n?n:this.lastNeed<=t.length?(t.copy(this.lastChar,e,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal)):(t.copy(this.lastChar,e,0,t.length),void(this.lastNeed-=t.length))}function s(t,e){if((t.length-e)%2==0){var n=t.toString("utf16le",e);if(n){var r=n.charCodeAt(n.length-1);if(r>=55296&&r<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=t[t.length-2],this.lastChar[1]=t[t.length-1],n.slice(0,-1)}return n}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=t[t.length-1],t.toString("utf16le",e,t.length-1)}function a(t){var e=t&&t.length?this.write(t):"";if(this.lastNeed){var n=this.lastTotal-this.lastNeed;return e+this.lastChar.toString("utf16le",0,n)}return e}function c(t,e){var n=(t.length-e)%3;return 0===n?t.toString("base64",e):(this.lastNeed=3-n,this.lastTotal=3,1===n?this.lastChar[0]=t[t.length-1]:(this.lastChar[0]=t[t.length-2],this.lastChar[1]=t[t.length-1]),t.toString("base64",e,t.length-n))}function f(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+this.lastChar.toString("base64",0,3-this.lastNeed):e}function u(t){return t.toString(this.encoding)}function h(t){return t&&t.length?this.write(t):""}var d=n(10).Buffer,l=d.isEncoding||function(t){switch((t=""+t)&&t.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}};e.StringDecoder=r,r.prototype.write=function(t){if(0===t.length)return"";var e,n;if(this.lastNeed){if(void 0===(e=this.fillLast(t)))return"";n=this.lastNeed,this.lastNeed=0}else n=0;return n<t.length?e?e+this.text(t,n):this.text(t,n):e||""},r.prototype.end=function(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+"<22>".repeat(this.lastTotal-this.lastNeed):e},r.prototype.text=function(t,e){var n=function(t,e,n){var r=e.length-1;if(r<n)return 0;var o=i(e[r]);return o>=0?(o>0&&(t.lastNeed=o-1),o):--r<n?0:(o=i(e[r]))>=0?(o>0&&(t.lastNeed=o-2),o):--r<n?0:(o=i(e[r]))>=0?(o>0&&(2===o?o=0:t.lastNeed=o-3),o):0}(this,t,e);if(!this.lastNeed)return t.toString("utf8",e);this.lastTotal=n;var r=t.length-(n-this.lastNeed);return t.copy(this.lastChar,0,r),t.toString("utf8",e,r)},r.prototype.fillLast=function(t){if(this.lastNeed<=t.length)return t.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);t.copy(this.lastChar,this.lastTotal-this.lastNeed,0,t.length),this.lastNeed-=t.length}},function(t,e,n){"use strict";function r(t){this.afterTransform=function(e,n){return function(t,e,n){var r=t._transformState;r.transforming=!1;var i=r.writecb;if(!i)return t.emit("error",new Error("write callback called multiple times"));r.writechunk=null,r.writecb=null,null!==n&&void 0!==n&&t.push(n);i(e);var o=t._readableState;o.reading=!1,(o.needReadable||o.length<o.highWaterMark)&&t._read(o.highWaterMark)}(t,e,n)},this.needTransform=!1,this.transforming=!1,this.writecb=null,this.writechunk=null,this.writeencoding=null}function i(t){if(!(this instanceof i))return new i(t);s.call(this,t),this._transformState=new r(this);var e=this;this._readableState.needReadable=!0,this._readableState.sync=!1,t&&("function"==typeof t.transform&&(this._transform=t.transform),"function"==typeof t.flush&&(this._flush=t.flush)),this.once("prefinish",function(){"function"==typeof this._flush?this._flush(function(t,n){o(e,t,n)}):o(e)})}function o(t,e,n){if(e)return t.emit("error",e);null!==n&&void 0!==n&&t.push(n);var r=t._writableState,i=t._transformState;if(r.length)throw new Error("Calling transform done when ws.length != 0");if(i.transforming)throw new Error("Calling transform done when still transforming");return t.push(null)}t.exports=i;var s=n(8),a=n(14);a.inherits=n(5),a.inherits(i,s),i.prototype.push=function(t,e){return this._transformState.needTransform=!1,s.prototype.push.call(this,t,e)},i.prototype._transform=function(t,e,n){throw new Error("_transform() is not implemented")},i.prototype._write=function(t,e,n){var r=this._transformState;if(r.writecb=n,r.writechunk=t,r.writeencoding=e,!r.transforming){var i=this._readableState;(r.needTransform||i.needReadable||i.length<i.highWaterMark)&&this._read(i.highWaterMark)}},i.prototype._read=function(t){var e=this._transformState;null!==e.writechunk&&e.writecb&&!e.transforming?(e.transforming=!0,this._transform(e.writechunk,e.writeencoding,e.afterTransform)):e.needTransform=!0},i.prototype._destroy=function(t,e){var n=this;s.prototype._destroy.call(this,t,function(t){e(t),n.emit("close")})}},function(t,e,n){"use strict";(function(e){const r=n(21),i=n(71),o=n(26),s=n(72),a=n(41),c=n(27),f=n(28),u=n(42);class h extends i{constructor(t,e,n,r,i,o,s=[]){if(!f(t))throw a.ImmutableDBNotDefinedError();if(f(n)&&!Array.isArray(n))throw new Error("'entries' argument must be an array of Entry instances");if(f(r)&&!Array.isArray(r))throw new Error("'heads' argument must be an array");super(),this._storage=t,this._id=e||(new Date).getTime().toString(),this._keystore=this._storage.keystore,this._key=o,this._keys=Array.isArray(s)?s:[s],n=n||[],this._entryIndex=n.reduce((t,e)=>(t[e.hash]=e,t),{}),r=r||h.findHeads(n),this._headsIndex=r.reduce((t,e)=>(t[e.hash]=e,t),{}),this._length=n?n.length:0;const u=Math.max(i?i.time:0,this.heads.reduce((t,e)=>Math.max(t,e.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 h.findTails(this.values)}get tailHashes(){return h.findTailHashes(this.values)}get(t){return this._entryIndex[t]}has(t){return void 0!==this._entryIndex[t.hash||t]}async append(t){if(this._key&&!this._keys.includes(this._key.getPublic("hex"))&&!this._keys.includes("*"))throw new Error("Not allowed to write");const e=Math.max(this.clock.time,this.heads.reduce((t,e)=>Math.max(t,e.clock.time),0))+1;this._clock=new c(this.clock.id,e);const n=await o.create(this._storage,this.id,t,Object.values(this._headsIndex),this.clock,this._key);return this._entryIndex[n.hash]=n,this._headsIndex={},this._headsIndex[n.hash]=n,this._length++,n}async join(t,e=-1,n){if(!f(t))throw a.LogNotDefinedError();if(!h.isLog(t))throw a.NotALogError();const i=async t=>{this._keys.map(t=>t.getPublic?t.getPublic("hex"):t);return(await r(t,async t=>{if(!t.key)throw new Error("Entry doesn't have a public key");if(!t.sig)throw new Error("Entry doesn't have a signature");if(1===this._keys.length&&this._keys[0]===this._key&&t.id!==this.id)throw new Error("Entry doesn't belong in this log (wrong ID)");if(this._keys.length>0&&!this._keys.includes("*")&&!((t,e)=>t.find(t=>t===e.key))(this._keys.concat([this._key]),t))return console.warn("Warning: Input log contains entries that are not allowed in this log. Logs weren't joined."),!1;try{await o.verifyEntry(t,this._keystore)}catch(e){return console.log(e),console.log("Couldn't verify entry:\n",t),!1}return!0})).every(t=>!0===t)},s=(t,e)=>(t[e.hash]=e,t);n=n||[t,this].sort((t,e)=>t.id>e.id)[0].id;const u=((t,e)=>{let n=Object.keys(t._headsIndex),r={},i={};for(;n.length>0;){const o=n.shift(),s=t.get(o);s&&!e.get(o)&&(i[s.hash]=s,r[s.hash]=!0,s.next.forEach(t=>{r[t]||e.get(t)||(n.push(t),r[t]=!0)}))}return i})(t,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,e>-1){let t=this.values;t=t.slice(-e),this._entryIndex=t.reduce(s,{}),this._length=Object.values(this._entryIndex).length}const d=h.findHeads(Object.values(Object.assign({},this._headsIndex,t._headsIndex)));this._headsIndex=d.reduce(s,{});const l=Object.values(this._headsIndex).reduce((t,e)=>t=Math.max(t,e.clock.time),0),p=new c(this.id,Math.max(this.clock.time,l));return this._id=n,this._clock=p,this}toJSON(){return{id:this.id,heads:this.heads.map(t=>t.hash)}}toSnapshot(){return{id:this.id,heads:this.heads,values:this.values}}toBuffer(){return e.from(JSON.stringify(this.toJSON()))}toString(t){return this.values.slice().reverse().map((e,n)=>{const r=o.findChildren(e,this.values).length;let i=new Array(Math.max(r-1,0));return i=r>1?i.fill(" "):i,(i=r>0?i.concat(["└─"]):i).join("")+(t?t(e.payload):e.payload)}).join("\n")}static isLog(t){return void 0!==t.id&&void 0!==t.heads&&void 0!==t._entryIndex}toMultihash(){return s.toMultihash(this._storage,this)}static fromMultihash(t,e,n=-1,r,i,o){if(!f(t))throw a.ImmutableDBNotDefinedError();if(!f(e))throw new Error(`Invalid hash: ${e}`);return s.fromMultihash(t,e,n,r,o).then(e=>new h(t,e.id,e.values,e.heads,e.clock,i))}static fromEntryHash(t,e,n,r=-1,i,o,c,u){if(!f(t))throw a.ImmutableDBNotDefinedError();if(!f(e))throw new Error("'hash' must be defined");return s.fromEntryHash(t,e,n,r,i,u).then(e=>new h(t,n,e.values,null,null,o,c))}static fromJSON(t,e,n=-1,r,i,o,c){if(!f(t))throw a.ImmutableDBNotDefinedError();return s.fromJSON(t,e,n,r,o,c).then(e=>new h(t,e.id,e.values,null,null,r,i))}static fromEntry(t,e,n=-1,r,i){if(!f(t))throw a.ImmutableDBNotDefinedError();if(!f(e))throw new Error("'sourceEntries' must be defined");return s.fromEntry(t,e,n,r,i).then(e=>new h(t,e.id,e.values))}static expandFrom(t,e,n,r=-1){if(!f(t))throw a.ImmutableDBNotDefinedError();if(!f(e))throw a.LogNotDefinedError();if(!f(n))throw new Error("'entries' must be given as argument");if(!h.isLog(e))throw a.NotALogError();return s.expandFrom(t,e,n,r).then(n=>new h(t,e.id,n.values,null,e.clock))}static expand(t,e,n){if(!f(t))throw a.ImmutableDBNotDefinedError();if(!f(e))throw a.LogNotDefinedError();if(!h.isLog(e))throw a.NotALogError();return s.expand(t,e,n).then(n=>new h(t,e.id,n.values,e.heads,e.clock))}static findHeads(t){var e=t.reduce((t,e,n,r)=>{return e.next.forEach(n=>t[n]=e.hash),t},{});return t.filter(t=>void 0===e[t.hash]).sort((t,e)=>t.id>e.id)}static findTails(t){var e={},n=[],r={},i=[];t.forEach(t=>{0===t.next.length&&n.push(t);t.next.forEach(n=>{e[n]||(e[n]=[]),e[n].push(t)}),i=i.concat(t.next),r[t.hash]=!0});const s=i.filter(t=>void 0===r[t]).map(t=>e[t]).reduce((t,e,n,r)=>t.concat(u(e,"hash")),[]).concat(n);return u(s,"hash").sort(o.compare)}static findTailHashes(t){var e={};return t.forEach(t=>e[t.hash]=!0),t.reduce((t,n,r,i)=>{return n.next.reverse().forEach(n=>{void 0===e[n]&&t.splice(0,0,n)}),t},[])}}t.exports=h}).call(e,n(1).Buffer)},function(t,e,n){"use strict";t.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(t,e,n){"use strict";t.exports=function(t,e){let n={};return t.forEach(t=>n[e?t[e]:t]=t),Object.keys(n).map(t=>n[t])}},function(t,e,n){"use strict";(function(e){const r=n(22),i=n(98),o=n(107);class s{constructor(t,e="data"){this.path=t||"./orbitdb",this.filename=e+".orbitdb",this._store=new i(this.path),this._cache={},this._lock=new o}get(t){return this._cache[t]}set(t,e){return new Promise((n,i)=>{if(this._cache[t]===e)return n(e);this._cache[t]=e,this._lock(this.filename,t=>{r(r.values([this._cache]),r.map(t=>JSON.stringify(t,null,2)),this._store.write(this.filename,t(t=>{if(t)return i(t);n(e)})))})})}load(){return this._cache={},new Promise((t,n)=>{this._store.exists(this.filename,(i,o)=>{if(i||!o)return t();this._lock(this.filename,i=>{r(this._store.read(this.filename),r.collect(i((r,i)=>{if(r)return n(r);try{this._cache=JSON.parse(e.concat(i).toString()||"{}")}catch(t){return n(t)}t()})))})})})}reset(){this._cache={},this._store=null}}t.exports=s}).call(e,n(1).Buffer)},function(t,e){t.exports=function(t,e,n){t(e),n&&n(!0===e?null:e)}},function(t,e,n){"use strict";var r=n(44);t.exports=function(t,e){return function(n,i){if(n)return r(i,n,e);if(null!=t){var o=t;t=null,i(null,o)}else i(!0)}}},function(t,e,n){var r=n(16);t.exports=function(t){return"object"==typeof t&&"function"==typeof t.test?function(e){return t.test(e)}:r(t)||function(t){return t}}},function(t,e,n){"use strict";var r=n(16),i=n(31);t.exports=function(t,e){t=r(t)||function(t){return t};var n={};return i(function(r){var i=t(r);return n[i]?!!e:(n[i]=!0,!e)})}},function(t,e){t.exports=function(t,e){function n(t,e){t&&(a=t,c&&s(a)),c=e,o()}function r(t){f=f||t||!0,o()}function i(t){f||(c?s(a,t):(u.push(t),o()))}function o(){c&&(a?s(a):!u.length&&f?s(f):u.length&&s(null,u.shift()))}function s(t,n){var r=c;if(t&&e){var i=e;e=null,i(!0===t?null:t)}c=null,r(t,n)}"function"==typeof t&&(e=t,t=!1);var a,c,f,u=[];return t?{push:i,end:r,source:n}:(n.push=i,n.end=r,n)}},function(t,e,n){"use strict";(function(e){const r=n(108),i=new(0,n(2).ec)("secp256k1");class o{constructor(t="./keystore"){if("undefined"==typeof localStorage||null===localStorage){r.sync(t);const e=n(133).LocalStorage;this._storage=new e(t)}else this._storage=localStorage}createKey(t){const e=i.genKeyPair(),n=e.getPublic("hex"),r=e.getPrivate("hex");return this._storage.setItem(t,JSON.stringify({publicKey:n,privateKey:r})),e}getKey(t){let e=JSON.parse(this._storage.getItem(t));if(!e)return;return i.keyPair({pub:e.publicKey,priv:e.privateKey,privEnc:"hex",pubEnc:"hex"})}static importKeyFromIpfs(t,e){return t.object.get(e,{enc:"base58"}).then(t=>JSON.parse(t.toJSON().Data)).then(t=>OrbitCrypto.importPublicKey(t))}static exportPublicKeyToIpfs(t,n){n.getPublic("hex");return OrbitCrypto.exportPublicKey(n).then(t=>JSON.stringify(t,null,2)).then(t=>new e(t)).then(e=>t.object.put(e)).then(t=>t.toJSON().multihash)}static getKey(t){let e,n,r,o=JSON.parse(keystore.getItem(t));return o?OrbitCrypto.importPrivateKey(o.privateKey).then(t=>r=t).then(()=>OrbitCrypto.importPublicKey(o.publicKey)).then(t=>n=t).then(()=>i.keyPair({pub:n,priv:r})):OrbitCrypto.generateKey().then(t=>e=t).then(()=>OrbitCrypto.exportPrivateKey(e)).then(t=>r=t).then(()=>OrbitCrypto.exportPublicKey(e)).then(t=>n=t).then(()=>(keystore.setItem(t,JSON.stringify({publicKey:n,privateKey:r})),i.keyPair({pub:n,priv:r})))}generateKey(){return Promise.resolve(i.genKeyPair())}exportPublicKey(t){return Promise.resolve(t.getPublic("hex"))}exportPrivateKey(t){return Promise.resolve(t.getPrivate("hex"))}importPublicKey(t){return Promise.resolve(i.keyFromPublic(t,"hex"))}importPrivateKey(t){return Promise.resolve(i.keyFromPrivate(t,"hex"))}sign(t,e){const n=i.sign(e,t);return Promise.resolve(n.toDER("hex"))}verify(t,e,n){let r=!1;return r=i.verify(n,t,e),Promise.resolve(r)}}t.exports=o}).call(e,n(1).Buffer)},function(t,e){t.exports=function(t){return t.webpackPolyfill||(t.deprecate=function(){},t.paths=[],t.children||(t.children=[]),Object.defineProperty(t,"loaded",{enumerable:!0,get:function(){return t.l}}),Object.defineProperty(t,"id",{enumerable:!0,get:function(){return t.i}}),t.webpackPolyfill=1),t}},function(t,e,n){"use strict";function r(t){return 1===t.length?"0"+t:t}function i(t){for(var e="",n=0;n<t.length;n++)e+=r(t[n].toString(16));return e}var o=e;o.toArray=function(t,e){if(Array.isArray(t))return t.slice();if(!t)return[];var n=[];if("string"!=typeof t){for(r=0;r<t.length;r++)n[r]=0|t[r];return n}if("hex"===e)for((t=t.replace(/[^a-z0-9]+/gi,"")).length%2!=0&&(t="0"+t),r=0;r<t.length;r+=2)n.push(parseInt(t[r]+t[r+1],16));else for(var r=0;r<t.length;r++){var i=t.charCodeAt(r),o=i>>8,s=255&i;o?n.push(o,s):n.push(s)}return n},o.zero2=r,o.toHex=i,o.encode=function(t,e){return"hex"===e?i(t):t}},function(t,e,n){"use strict";function r(t,e,n){return t&e^~t&n}function i(t,e,n){return t&e^t&n^e&n}function o(t,e,n){return t^e^n}var s=n(6).rotr32;e.ft_1=function(t,e,n,s){return 0===t?r(e,n,s):1===t||3===t?o(e,n,s):2===t?i(e,n,s):void 0},e.ch32=r,e.maj32=i,e.p32=o,e.s0_256=function(t){return s(t,2)^s(t,13)^s(t,22)},e.s1_256=function(t){return s(t,6)^s(t,11)^s(t,25)},e.g0_256=function(t){return s(t,7)^s(t,18)^t>>>3},e.g1_256=function(t){return s(t,17)^s(t,19)^t>>>10}},function(t,e,n){"use strict";function r(){if(!(this instanceof r))return new r;m.call(this),this.h=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],this.k=g,this.W=new Array(64)}var i=n(6),o=n(18),s=n(52),a=n(9),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,m=o.BlockHash,g=[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(r,m),t.exports=r,r.blockSize=512,r.outSize=256,r.hmacStrength=192,r.padLength=64,r.prototype._update=function(t,e){for(var n=this.W,r=0;r<16;r++)n[r]=t[e+r];for(;r<n.length;r++)n[r]=f(y(n[r-2]),n[r-7],b(n[r-15]),n[r-16]);var i=this.h[0],o=this.h[1],s=this.h[2],m=this.h[3],g=this.h[4],v=this.h[5],_=this.h[6],w=this.h[7];for(a(this.k.length===n.length),r=0;r<n.length;r++){var S=u(w,p(g),h(g,v,_),this.k[r],n[r]),k=c(l(i),d(i,o,s));w=_,_=v,v=g,g=c(m,S),m=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],m),this.h[4]=c(this.h[4],g),this.h[5]=c(this.h[5],v),this.h[6]=c(this.h[6],_),this.h[7]=c(this.h[7],w)},r.prototype._digest=function(t){return"hex"===t?i.toHex32(this.h,"big"):i.split32(this.h,"big")}},function(t,e,n){"use strict";function r(){if(!(this instanceof r))return new r;g.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=n(6),o=n(18),s=n(9),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,m=i.sum64_5_lo,g=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(r,g),t.exports=r,r.blockSize=1024,r.outSize=512,r.hmacStrength=192,r.padLength=128,r.prototype._prepareBlock=function(t,e){for(var n=this.W,r=0;r<32;r++)n[r]=t[e+r];for(;r<n.length;r+=2){var i=function(t,e){var n=a(t,e,19)^a(e,t,29)^f(t,e,6);return n<0&&(n+=4294967296),n}(n[r-4],n[r-3]),o=function(t,e){var n=c(t,e,19)^c(e,t,29)^u(t,e,6);return n<0&&(n+=4294967296),n}(n[r-4],n[r-3]),s=n[r-14],h=n[r-13],d=function(t,e){var n=a(t,e,1)^a(t,e,8)^f(t,e,7);return n<0&&(n+=4294967296),n}(n[r-30],n[r-29]),l=function(t,e){var n=c(t,e,1)^c(t,e,8)^u(t,e,7);return n<0&&(n+=4294967296),n}(n[r-30],n[r-29]),y=n[r-32],m=n[r-31];n[r]=p(i,o,s,h,d,l,y,m),n[r+1]=b(i,o,s,h,d,l,y,m)}},r.prototype._update=function(t,e){this._prepareBlock(t,e);var n=this.W,r=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],g=this.h[7],v=this.h[8],_=this.h[9],w=this.h[10],S=this.h[11],k=this.h[12],x=this.h[13],E=this.h[14],M=this.h[15];s(this.k.length===n.length);for(var A=0;A<n.length;A+=2){var O=E,I=M,P=function(t,e){var n=a(t,e,14)^a(t,e,18)^a(e,t,9);return n<0&&(n+=4294967296),n}(v,_),C=function(t,e){var n=c(t,e,14)^c(t,e,18)^c(e,t,9);return n<0&&(n+=4294967296),n}(v,_),N=function(t,e,n,r,i){var o=t&n^~t&i;return o<0&&(o+=4294967296),o}(v,0,w,0,k),R=function(t,e,n,r,i,o){var s=e&r^~e&o;return s<0&&(s+=4294967296),s}(0,_,0,S,0,x),j=this.k[A],T=this.k[A+1],L=n[A],D=n[A+1],B=y(O,I,P,C,N,R,j,T,L,D),F=m(O,I,P,C,N,R,j,T,L,D);O=function(t,e){var n=a(t,e,28)^a(e,t,2)^a(e,t,7);return n<0&&(n+=4294967296),n}(r,i),I=function(t,e){var n=c(t,e,28)^c(e,t,2)^c(e,t,7);return n<0&&(n+=4294967296),n}(r,i),P=function(t,e,n,r,i){var o=t&n^t&i^n&i;return o<0&&(o+=4294967296),o}(r,0,o,0,u),C=function(t,e,n,r,i,o){var s=e&r^e&o^r&o;return s<0&&(s+=4294967296),s}(0,i,0,f,0,p);var q=d(O,I,P,C),U=l(O,I,P,C);E=k,M=x,k=w,x=S,w=v,S=_,v=d(b,g,B,F),_=l(g,g,B,F),b=u,g=p,u=o,p=f,o=r,f=i,r=d(B,F,q,U),i=l(B,F,q,U)}h(this.h,0,r,i),h(this.h,2,o,f),h(this.h,4,u,p),h(this.h,6,b,g),h(this.h,8,v,_),h(this.h,10,w,S),h(this.h,12,k,x),h(this.h,14,E,M)},r.prototype._digest=function(t){return"hex"===t?i.toHex32(this.h,"big"):i.split32(this.h,"big")}},function(t,e,n){"use strict";var r=n(17);t.exports=function(t){if(null===t||"object"!=typeof t)return t;if(t instanceof Object)e={__proto__:t.__proto__};else var e=Object.create(null);return Object.getOwnPropertyNames(t).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}),e}(r)},function(t,e){t.exports=function(){var t,e=Array.prototype.slice.call(arguments),n=null;return"object"==typeof e[0]?(n=e.shift(),"string"==typeof(t=e.shift())&&(t=n[t])):t=e.shift(),function(r){t.apply(n,e.concat(r))}}},function(t,e,n){(function(t,n){function r(t,e){return t.set(e[0],e[1]),t}function i(t,e){return t.add(e),t}function o(t,e,n,r){var i=-1,o=t?t.length:0;for(r&&o&&(n=t[++i]);++i<o;)n=e(n,t[i],i,t);return n}function s(t){var e=!1;if(null!=t&&"function"!=typeof t.toString)try{e=!!(t+"")}catch(t){}return e}function a(t){var e=-1,n=Array(t.size);return t.forEach(function(t,r){n[++e]=[r,t]}),n}function c(t,e){return function(n){return t(e(n))}}function f(t){var e=-1,n=Array(t.size);return t.forEach(function(t){n[++e]=t}),n}function u(t){var e=-1,n=t?t.length:0;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}function h(t){var e=-1,n=t?t.length:0;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}function d(t){var e=-1,n=t?t.length:0;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}function l(t){this.__data__=new h(t)}function p(t,e){var n=Jt(t)||function(t){return function(t){return function(t){return!!t&&"object"==typeof t}(t)&&M(t)}(t)&&_t.call(t,"callee")&&(!Ot.call(t,"callee")||wt.call(t)==R)}(t)?function(t,e){for(var n=-1,r=Array(t);++n<t;)r[n]=e(n);return r}(t.length,String):[],r=n.length,i=!!r;for(var o in t)!e&&!_t.call(t,o)||i&&("length"==o||function(t,e){return!!(e=null==e?N:e)&&("number"==typeof t||st.test(t))&&t>-1&&t%1==0&&t<e}(o,r))||n.push(o);return n}function b(t,e,n){var r=t[e];_t.call(t,e)&&E(r,n)&&(void 0!==n||e in t)||(t[e]=n)}function y(t,e){for(var n=t.length;n--;)if(E(t[n][0],e))return n;return-1}function m(t,e,n,c,u,h,d){var p;if(c&&(p=h?c(t,u,h,d):c(t)),void 0!==p)return p;if(!O(t))return t;var y=Jt(t);if(y){if(p=function(t){var e=t.length,n=t.constructor(e);e&&"string"==typeof t[0]&&_t.call(t,"index")&&(n.index=t.index,n.input=t.input);return n}(t),!e)return function(t,e){var n=-1,r=t.length;e||(e=Array(r));for(;++n<r;)e[n]=t[n];return e}(t,p)}else{var g=Wt(t),w=g==L||g==D;if($t(t))return function(t,e){if(e)return t.slice();var n=new t.constructor(t.length);return t.copy(n),n}(t,e);if(g==q||g==R||w&&!h){if(s(t))return h?t:{};if(p=function(t){return"function"!=typeof t.constructor||k(t)?{}:function(t){return O(t)?At(t):{}}(Mt(t))}(w?{}:t),!e)return function(t,e){return _(t,Yt(t),e)}(t,function(t,e){return t&&_(e,I(e),t)}(p,t))}else{if(!at[g])return h?t:{};p=function(t,e,n,s){var c=t.constructor;switch(e){case W:return v(t);case j:case T:return new c(+t);case J:return function(t,e){var n=e?v(t.buffer):t.buffer;return new t.constructor(n,t.byteOffset,t.byteLength)}(t,s);case $:case V:case X:case Z:case Q:case tt:case et:case nt:case rt:return function(t,e){var n=e?v(t.buffer):t.buffer;return new t.constructor(n,t.byteOffset,t.length)}(t,s);case B:return function(t,e,n){return o(e?n(a(t),!0):a(t),r,new t.constructor)}(t,s,n);case F:case G:return new c(t);case z:return function(t){var e=new t.constructor(t.source,it.exec(t));return e.lastIndex=t.lastIndex,e}(t);case K:return function(t,e,n){return o(e?n(f(t),!0):f(t),i,new t.constructor)}(t,s,n);case H:return function(t){return Ht?Object(Ht.call(t)):{}}(t)}}(t,g,m,e)}}d||(d=new l);var S=d.get(t);if(S)return S;if(d.set(t,p),!y)var x=n?function(t){return function(t,e,n){var r=e(t);return Jt(t)?r:function(t,e){for(var n=-1,r=e.length,i=t.length;++n<r;)t[i+n]=e[n];return t}(r,n(t))}(t,I,Yt)}(t):I(t);return function(t,e){for(var n=-1,r=t?t.length:0;++n<r&&!1!==e(t[n],n,t););}(x||t,function(r,i){x&&(r=t[i=r]),b(p,i,m(r,e,n,c,i,t,d))}),p}function g(t){if(!O(t)||function(t){return!!gt&> in t}(t))return!1;return(A(t)||s(t)?St:ot).test(x(t))}function v(t){var e=new t.constructor(t.byteLength);return new Et(e).set(new Et(t)),e}function _(t,e,n,r){n||(n={});for(var i=-1,o=e.length;++i<o;){var s=e[i],a=r?r(n[s],t[s],s,n,t):void 0;b(n,s,void 0===a?t[s]:a)}return n}function w(t,e){var n=t.__data__;return function(t){var e=typeof t;return"string"==e||"number"==e||"symbol"==e||"boolean"==e?"__proto__"!==t:null===t}(e)?n["string"==typeof e?"string":"hash"]:n.map}function S(t,e){var n=function(t,e){return null==t?void 0:t[e]}(t,e);return g(n)?n:void 0}function k(t){var e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||yt)}function x(t){if(null!=t){try{return vt.call(t)}catch(t){}try{return t+""}catch(t){}}return""}function E(t,e){return t===e||t!=t&&e!=e}function M(t){return null!=t&&function(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=N}(t.length)&&!A(t)}function A(t){var e=O(t)?wt.call(t):"";return e==L||e==D}function O(t){var e=typeof t;return!!t&&("object"==e||"function"==e)}function I(t){return M(t)?p(t):function(t){if(!k(t))return Nt(t);var e=[];for(var n in Object(t))_t.call(t,n)&&"constructor"!=n&&e.push(n);return e}(t)}var P=200,C="__lodash_hash_undefined__",N=9007199254740991,R="[object Arguments]",j="[object Boolean]",T="[object Date]",L="[object Function]",D="[object GeneratorFunction]",B="[object Map]",F="[object Number]",q="[object Object]",U="[object Promise]",z="[object RegExp]",K="[object Set]",G="[object String]",H="[object Symbol]",Y="[object WeakMap]",W="[object ArrayBuffer]",J="[object DataView]",$="[object Float32Array]",V="[object Float64Array]",X="[object Int8Array]",Z="[object Int16Array]",Q="[object Int32Array]",tt="[object Uint8Array]",et="[object Uint8ClampedArray]",nt="[object Uint16Array]",rt="[object Uint32Array]",it=/\w*$/,ot=/^\[object .+?Constructor\]$/,st=/^(?:0|[1-9]\d*)$/,at={};at[R]=at["[object Array]"]=at[W]=at[J]=at[j]=at[T]=at[$]=at[V]=at[X]=at[Z]=at[Q]=at[B]=at[F]=at[q]=at[z]=at[K]=at[G]=at[H]=at[tt]=at[et]=at[nt]=at[rt]=!0,at["[object Error]"]=at[L]=at[Y]=!1;var ct="object"==typeof t&&t&&t.Object===Object&&t,ft="object"==typeof self&&self&&self.Object===Object&&self,ut=ct||ft||Function("return this")(),ht="object"==typeof e&&e&&!e.nodeType&&e,dt=ht&&"object"==typeof n&&n&&!n.nodeType&&n,lt=dt&&dt.exports===ht,pt=Array.prototype,bt=Function.prototype,yt=Object.prototype,mt=ut["__core-js_shared__"],gt=function(){var t=/[^.]+$/.exec(mt&&mt.keys&&mt.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""}(),vt=bt.toString,_t=yt.hasOwnProperty,wt=yt.toString,St=RegExp("^"+vt.call(_t).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),kt=lt?ut.Buffer:void 0,xt=ut.Symbol,Et=ut.Uint8Array,Mt=c(Object.getPrototypeOf,Object),At=Object.create,Ot=yt.propertyIsEnumerable,It=pt.splice,Pt=Object.getOwnPropertySymbols,Ct=kt?kt.isBuffer:void 0,Nt=c(Object.keys,Object),Rt=S(ut,"DataView"),jt=S(ut,"Map"),Tt=S(ut,"Promise"),Lt=S(ut,"Set"),Dt=S(ut,"WeakMap"),Bt=S(Object,"create"),Ft=x(Rt),qt=x(jt),Ut=x(Tt),zt=x(Lt),Kt=x(Dt),Gt=xt?xt.prototype:void 0,Ht=Gt?Gt.valueOf:void 0;u.prototype.clear=function(){this.__data__=Bt?Bt(null):{}},u.prototype.delete=function(t){return this.has(t)&&delete this.__data__[t]},u.prototype.get=function(t){var e=this.__data__;if(Bt){var n=e[t];return n===C?void 0:n}return _t.call(e,t)?e[t]:void 0},u.prototype.has=function(t){var e=this.__data__;return Bt?void 0!==e[t]:_t.call(e,t)},u.prototype.set=function(t,e){return this.__data__[t]=Bt&&void 0===e?C:e,this},h.prototype.clear=function(){this.__data__=[]},h.prototype.delete=function(t){var e=this.__data__,n=y(e,t);return!(n<0||(n==e.length-1?e.pop():It.call(e,n,1),0))},h.prototype.get=function(t){var e=this.__data__,n=y(e,t);return n<0?void 0:e[n][1]},h.prototype.has=function(t){return y(this.__data__,t)>-1},h.prototype.set=function(t,e){var n=this.__data__,r=y(n,t);return r<0?n.push([t,e]):n[r][1]=e,this},d.prototype.clear=function(){this.__data__={hash:new u,map:new(jt||h),string:new u}},d.prototype.delete=function(t){return w(this,t).delete(t)},d.prototype.get=function(t){return w(this,t).get(t)},d.prototype.has=function(t){return w(this,t).has(t)},d.prototype.set=function(t,e){return w(this,t).set(t,e),this},l.prototype.clear=function(){this.__data__=new h},l.prototype.delete=function(t){return this.__data__.delete(t)},l.prototype.get=function(t){return this.__data__.get(t)},l.prototype.has=function(t){return this.__data__.has(t)},l.prototype.set=function(t,e){var n=this.__data__;if(n instanceof h){var r=n.__data__;if(!jt||r.length<P-1)return r.push([t,e]),this;n=this.__data__=new d(r)}return n.set(t,e),this};var Yt=Pt?c(Pt,Object):function(){return[]},Wt=function(t){return wt.call(t)};(Rt&&Wt(new Rt(new ArrayBuffer(1)))!=J||jt&&Wt(new jt)!=B||Tt&&Wt(Tt.resolve())!=U||Lt&&Wt(new Lt)!=K||Dt&&Wt(new Dt)!=Y)&&(Wt=function(t){var e=wt.call(t),n=e==q?t.constructor:void 0,r=n?x(n):void 0;if(r)switch(r){case Ft:return J;case qt:return B;case Ut:return U;case zt:return K;case Kt:return Y}return e});var Jt=Array.isArray,$t=Ct||function(){return!1};n.exports=function(t){return m(t,!0,!0)}}).call(e,n(3),n(50)(t))},function(t,e,n){"use strict";t.exports="ipfs-pubsub-room/v1"},function(t,e,n){"use strict";const r=n(10).Buffer;t.exports=(t=>{let e=t;return r.isBuffer(e)||(e=r.from(e)),e})},function(t,e,n){"use strict";(function(e){const r=n(17),i=n(24).format,o=n(4).EventEmitter;let s=!!e.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};class p{constructor(t,e){this.category=t;let n={};Object.assign(n,l),Object.assign(n,e),this.options=n}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(t,e){(this.options.filename||f)&&!this.fileWriter&&s&&(this.fileWriter=r.openSync(this.options.filename||f,this.options.appendFile?"a+":"w+"));let n=this._format(t,e),i=this._createLogMessage(t,e),o=this._createLogMessage(t,e,n.timestamp,n.level,n.category,n.text);this.fileWriter&&s&&r.writeSync(this.fileWriter,i+"\n",null,"utf-8"),s||!this.options.useColors?(console.log(o),u.emit("data",this.category,t,e)):t===a.ERROR?this.options.showTimestamp&&this.options.showLevel?console.error(o,n.timestamp,n.level,n.category,n.text):this.options.showTimestamp&&!this.options.showLevel?console.error(o,n.timestamp,n.category,n.text):!this.options.showTimestamp&&this.options.showLevel?console.error(o,n.level,n.category,n.text):console.error(o,n.category,n.text):this.options.showTimestamp&&this.options.showLevel?console.log(o,n.timestamp,n.level,n.category,n.text):this.options.showTimestamp&&!this.options.showLevel?console.log(o,n.timestamp,n.category,n.text):!this.options.showTimestamp&&this.options.showLevel?console.log(o,n.level,n.category,n.text):console.log(o,n.category,n.text)}_format(t,e){let n="",r="",i="",o=": ";if(this.options.useColors){const e=Object.keys(a).map(t=>a[t]).indexOf(t),c=this.options.color;s?(this.options.showTimestamp&&(n="[3"+h.Grey+"m"),this.options.showLevel&&(r="[3"+d[e]+";22m"),i="[3"+c+";1m",o="[0m: "):(this.options.showTimestamp&&(n="color:"+h.Grey),this.options.showLevel&&(r="color:"+d[e]),i="color:"+c+"; font-weight: bold")}return{timestamp:n,level:r,category:i,text:o}}_createLogMessage(t,e,n,r,i,o){n=n||"",r=r||"",i=i||"",o=o||": ",!s&&this.options.useColors&&(this.options.showTimestamp&&(n="%c"),this.options.showLevel&&(r="%c"),i="%c",o=": %c");let c="";return this.options.showTimestamp&&(c+=(new Date).toISOString()+" "),c=n+c,this.options.showLevel&&(c+=r+"["+t+"]"+(t===a.INFO||t===a.WARN?" ":"")+" "),c+=i+this.category,c+=o+e}_shouldLog(t){let n=void 0!==e&&void 0!==Object({NODE_ENV:void 0})&&void 0!==Object({NODE_ENV:void 0}).LOG?Object({NODE_ENV:void 0}).LOG.toUpperCase():null;const r=(n="undefined"!=typeof window&&window.LOG?window.LOG.toUpperCase():n)||c,i=Object.keys(a).map(t=>a[t]);return i.indexOf(t)>=i.indexOf(r)}}t.exports={Colors:h,LogLevels:a,setLogLevel:t=>{c=t},setLogfile:t=>{f=t},create:(t,e)=>{return new p(t,e)},forceBrowserMode:t=>s=!t,events:u}}).call(e,n(0))},function(t,e,n){"use strict";(function(e,r){const i=n(12),o=n(34),s=n(155),a=n(157),c=n(159),f=n(163),u=n(165),h=n(43),d=n(49),l=n(174),p=n(176),b=n(60),y=b.create("orbit-db");b.setLogLevel("NONE");const m=["eventlog","feed","docstore","counter","keyvalue"];class g{constructor(t,e,n={}){this._ipfs=t,this.id=n.peerId||(this._ipfs._peerInfo?this._ipfs._peerInfo.id._idB58String:"default"),this._pubsub=n&&n.broker?new n.broker(this._ipfs):new u(this._ipfs,this.id),this.stores={},this.types=m,this.directory=e||"./orbitdb",this.keystore=new d(i.join(this.directory,this.id,"/keystore")),this.key=this.keystore.getKey(this.id)||this.keystore.createKey(this.id)}async feed(t,e={}){return e=Object.assign({create:!0,type:"feed"},e),this.open(t,e)}async log(t,e){return e=Object.assign({create:!0,type:"eventlog"},e),this.open(t,e)}async eventlog(t,e={}){return this.log(t,e)}async keyvalue(t,e){return e=Object.assign({create:!0,type:"keyvalue"},e),this.open(t,e)}async kvstore(t,e){return this.keyvalue(t,e)}async counter(t,e={}){return e=Object.assign({create:!0,type:"counter"},e),this.open(t,e)}async docs(t,e={}){return e=Object.assign({create:!0,type:"docstore"},e),this.open(t,e)}async docstore(t,e={}){return this.docs(t,e)}async disconnect(){const t=Object.values(this.stores);for(let e of t)await e.close(),delete this.stores[e.address.toString()];this._pubsub&&this._pubsub.disconnect(),this.stores={}}async stop(){await this.disconnect()}async _createStore(t,e,n){const r=e.toString();let i;n.accessControllerAddress&&(i=new l(this._ipfs),await i.load(n.accessControllerAddress));const o=Object.assign({replicate:!0},n,{accessController:i,keystore:this.keystore,cache:this._cache}),s=new t(this._ipfs,this.id,e,o);return s.events.on("write",this._onWrite.bind(this)),s.events.on("closed",this._onClosed.bind(this)),this.stores[r]=s,o.replicate&&this._pubsub&&this._pubsub.subscribe(r,this._onMessage.bind(this),this._onPeerConnected.bind(this)),s}_onWrite(t,n,r){if(!r)throw new Error("'heads' not defined");this._pubsub&&e(()=>this._pubsub.publish(t,r))}async _onMessage(t,e){const n=this.stores[t];try{y.debug(`Received heads for '${t}':\n`,JSON.stringify(e,null,2)),await n.sync(e)}catch(t){y.error(t)}}_onPeerConnected(t,e,n){y.debug(`New peer '${e}' connected to '${t}'`);const i=this.stores[t];if(i){let t=i._oplog.heads;t.length>0&&(y.debug("Send latest heads:\n",JSON.stringify(t,null,2)),n.sendTo(e,new r(JSON.stringify(t)))),i.events.emit("peer",e)}}_onClosed(t){y.debug(`Database '${t}' was closed`),this.stores[t].events.removeAllListeners("closed"),this._pubsub&&this._pubsub.unsubscribe(t),delete this.stores[t]}async create(t,e,n={}){if(!g.isValidType(e))throw new Error(`Invalid database type '${e}'`);const o=n.directory||this.directory;if(y.debug(`Creating database '${t}' as ${e} in '${o}'`),p.isValid(t))throw new Error("Given database name is an address. Please give only the name of the database!");const s=new l(this._ipfs);n&&n.write?n.write.forEach(t=>s.add("write",t)):s.add("write",this.key.getPublic("hex"));const a=await s.save(),c={name:t,type:e,accessController:i.join("/ipfs",a)},f=(await this._ipfs.object.put(new r(JSON.stringify(c)))).toJSON().multihash.toString(),u=i.join("/orbitdb",f,t),d=p.parse(u);try{const t=i.join(d.root,d.path);this._cache=new h(i.join(o),t),await this._cache.load()}catch(t){y.warn("Couldn't load Cache:",t)}let b=await this._cache.get(d.toString());if(b&&b.manifest&&!n.overwrite)throw new Error(`Database '${d}' already exists!`);return b=Object.assign({},this._cache.get(d.toString()),{manifest:d.root}),await this._cache.set(d.toString(),b),y.debug(`Saved manifest to IPFS as '${d.root}'`),y.debug(`Created database '${d}'`),this.open(d,n)}async open(t,e={}){e=Object.assign({localOnly:!1,create:!1},e),y.debug(`Open database '${t}'`);const n=e.directory||this.directory;if(y.debug(`Look from '${n}'`),!p.isValid(t)){if(e.create){if(e.create&&!e.type)throw new Error(`Database type not provided! Provide a type with 'options.type' (${m.join("|")})`);return y.warn(`Not a valid OrbitDB address '${t}', creating the database`),e.overwrite=!e.overwrite||e.overwrite,this.create(t,e.type,e)}throw new Error("'options.create' set to 'false'. If you want to create a database, set 'options.create' to 'true'.")}const r=p.parse(t);try{const t=i.join(r.root,r.path);this._cache=new h(i.join(n),t),await this._cache.load()}catch(t){console.warn(t),y.warn("Couldn't load Cache:",t)}let o=await this._cache.get(r.toString());const s=o&&o.manifest;if(y.debug((s?"Found":"Didn't find")+` database '${r}'`),e.localOnly&&!s)throw y.error(`Database '${r}' doesn't exist!`),new Error(`Database '${r}' doesn't exist!`);y.debug(`Loading Manifest for '${r}'`);const a=await this._ipfs.object.get(r.root),c=JSON.parse(a.toJSON().data);if(y.debug(`Manifest for '${r}':\n${JSON.stringify(c,null,2)}`),e.type&&c.type!==e.type)throw new Error(`Database '${r}' is type '${c.type}' but was opened as '${e.type}'`);return o=Object.assign({},this._cache.get(r.toString()),{manifest:r.root}),await this._cache.set(r.toString(),o),y.debug(`Saved manifest to IPFS as '${r.root}'`),e=Object.assign({},e,{accessControllerAddress:c.accessController}),this._openDatabase(r,c.type,e)}async _openDatabase(t,e,n){if("counter"===e)return this._createStore(c,t,n);if("eventlog"===e)return this._createStore(o,t,n);if("feed"===e)return this._createStore(s,t,n);if("docstore"===e)return this._createStore(f,t,n);if("keyvalue"===e)return this._createStore(a,t,n);throw new Error(`Invalid database type '${e}'`)}static isValidType(t){return m.includes(t)}static create(){return new Error("Not implemented yet!")}static open(){return new Error("Not implemented yet!")}}t.exports=g}).call(e,n(11).setImmediate,n(1).Buffer)},function(t,e,n){(function(t,e){!function(t,n){"use strict";function r(t){delete a[t]}function i(t){if(c)setTimeout(i,0,t);else{var e=a[t];if(e){c=!0;try{!function(t){var e=t.callback,r=t.args;switch(r.length){case 0:e();break;case 1:e(r[0]);break;case 2:e(r[0],r[1]);break;case 3:e(r[0],r[1],r[2]);break;default:e.apply(n,r)}}(e)}finally{r(t),c=!1}}}}if(!t.setImmediate){var o,s=1,a={},c=!1,f=t.document,u=Object.getPrototypeOf&&Object.getPrototypeOf(t);u=u&&u.setTimeout?u:t,"[object process]"==={}.toString.call(t.process)?o=function(t){e.nextTick(function(){i(t)})}:function(){if(t.postMessage&&!t.importScripts){var e=!0,n=t.onmessage;return t.onmessage=function(){e=!1},t.postMessage("","*"),t.onmessage=n,e}}()?function(){var e="setImmediate$"+Math.random()+"$",n=function(n){n.source===t&&"string"==typeof n.data&&0===n.data.indexOf(e)&&i(+n.data.slice(e.length))};t.addEventListener?t.addEventListener("message",n,!1):t.attachEvent("onmessage",n),o=function(n){t.postMessage(e+n,"*")}}():t.MessageChannel?function(){var t=new MessageChannel;t.port1.onmessage=function(t){i(t.data)},o=function(e){t.port2.postMessage(e)}}():f&&"onreadystatechange"in f.createElement("script")?function(){var t=f.documentElement;o=function(e){var n=f.createElement("script");n.onreadystatechange=function(){i(e),n.onreadystatechange=null,t.removeChild(n),n=null},t.appendChild(n)}}():o=function(t){setTimeout(i,0,t)},u.setImmediate=function(t){"function"!=typeof t&&(t=new Function(""+t));for(var e=new Array(arguments.length-1),n=0;n<e.length;n++)e[n]=arguments[n+1];var r={callback:t,args:e};return a[s]=r,o(s),s++},u.clearImmediate=r}}("undefined"==typeof self?void 0===t?this:t:self)}).call(e,n(3),n(0))},function(t,e,n){"use strict";function r(t){var e=t.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");return"="===t[e-2]?2:"="===t[e-1]?1:0}function i(t){return s[t>>18&63]+s[t>>12&63]+s[t>>6&63]+s[63&t]}function o(t,e,n){for(var r,o=[],s=e;s<n;s+=3)r=(t[s]<<16)+(t[s+1]<<8)+t[s+2],o.push(i(r));return o.join("")}e.byteLength=function(t){return 3*t.length/4-r(t)},e.toByteArray=function(t){var e,n,i,o,s,f=t.length;o=r(t),s=new c(3*f/4-o),n=o>0?f-4:f;var u=0;for(e=0;e<n;e+=4)i=a[t.charCodeAt(e)]<<18|a[t.charCodeAt(e+1)]<<12|a[t.charCodeAt(e+2)]<<6|a[t.charCodeAt(e+3)],s[u++]=i>>16&255,s[u++]=i>>8&255,s[u++]=255&i;return 2===o?(i=a[t.charCodeAt(e)]<<2|a[t.charCodeAt(e+1)]>>4,s[u++]=255&i):1===o&&(i=a[t.charCodeAt(e)]<<10|a[t.charCodeAt(e+1)]<<4|a[t.charCodeAt(e+2)]>>2,s[u++]=i>>8&255,s[u++]=255&i),s},e.fromByteArray=function(t){for(var e,n=t.length,r=n%3,i="",a=[],c=0,f=n-r;c<f;c+=16383)a.push(o(t,c,c+16383>f?f:c+16383));return 1===r?(e=t[n-1],i+=s[e>>2],i+=s[e<<4&63],i+="=="):2===r&&(e=(t[n-2]<<8)+t[n-1],i+=s[e>>10],i+=s[e>>4&63],i+=s[e<<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(t,e){e.read=function(t,e,n,r,i){var o,s,a=8*i-r-1,c=(1<<a)-1,f=c>>1,u=-7,h=n?i-1:0,d=n?-1:1,l=t[e+h];for(h+=d,o=l&(1<<-u)-1,l>>=-u,u+=a;u>0;o=256*o+t[e+h],h+=d,u-=8);for(s=o&(1<<-u)-1,o>>=-u,u+=r;u>0;s=256*s+t[e+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,r),o-=f}return(l?-1:1)*s*Math.pow(2,o-r)},e.write=function(t,e,n,r,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=r?0:o-1,p=r?1:-1,b=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(a=isNaN(e)?1:0,s=u):(s=Math.floor(Math.log(e)/Math.LN2),e*(c=Math.pow(2,-s))<1&&(s--,c*=2),(e+=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=(e*c-1)*Math.pow(2,i),s+=h):(a=e*Math.pow(2,h-1)*Math.pow(2,i),s=0));i>=8;t[n+l]=255&a,l+=p,a/=256,i-=8);for(s=s<<i|a,f+=i;f>0;t[n+l]=255&s,l+=p,s/=256,f-=8);t[n+l-p]|=128*b}},function(t,e){},function(t,e,n){"use strict";function r(t,e,n){t.copy(e,n)}var i=n(10).Buffer;t.exports=function(){function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.head=null,this.tail=null,this.length=0}return t.prototype.push=function(t){var e={data:t,next:null};this.length>0?this.tail.next=e:this.head=e,this.tail=e,++this.length},t.prototype.unshift=function(t){var e={data:t,next:this.head};0===this.length&&(this.tail=e),this.head=e,++this.length},t.prototype.shift=function(){if(0!==this.length){var t=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,t}},t.prototype.clear=function(){this.head=this.tail=null,this.length=0},t.prototype.join=function(t){if(0===this.length)return"";for(var e=this.head,n=""+e.data;e=e.next;)n+=t+e.data;return n},t.prototype.concat=function(t){if(0===this.length)return i.alloc(0);if(1===this.length)return this.head.data;for(var e=i.allocUnsafe(t>>>0),n=this.head,o=0;n;)r(n.data,e,o),o+=n.data.length,n=n.next;return e},t}()},function(t,e,n){(function(e){function n(t){try{if(!e.localStorage)return!1}catch(t){return!1}var n=e.localStorage[t];return null!=n&&"true"===String(n).toLowerCase()}t.exports=function(t,e){if(n("noDeprecation"))return t;var r=!1;return function(){if(!r){if(n("throwDeprecation"))throw new Error(e);n("traceDeprecation")?console.trace(e):console.warn(e),r=!0}return t.apply(this,arguments)}}}).call(e,n(3))},function(t,e,n){"use strict";function r(t){if(!(this instanceof r))return new r(t);i.call(this,t)}t.exports=r;var i=n(39),o=n(14);o.inherits=n(5),o.inherits(r,i),r.prototype._transform=function(t,e,n){n(null,t)}},function(t,e,n){"use strict";const r=n(70);t.exports=((t,e)=>r(t,(t,n,r)=>e(n,r)).then(()=>t))},function(t,e,n){"use strict";t.exports=((t,e,n)=>new Promise((r,i)=>{const o=t[Symbol.iterator]();let s=0;const a=t=>{const n=o.next();n.done?r(t):Promise.all([t,n.value]).then(t=>{a(e(t[0],t[1],s++))}).catch(i)};a(n)}))},function(t,e,n){"use strict";class r{constuctor(t){}append(t){}merge(t){}get(t){}has(t){}get values(){}get length(){}}t.exports=r},function(t,e,n){"use strict";n(21);const r=n(26),i=n(73),o=n(27),s=n(41),a=n(28),c=n(42),f=n(75),u=n(76);class h{static toMultihash(t,e){if(!a(t))throw s.ImmutableDBNotDefinedError();if(!a(e))throw s.LogNotDefinedError();if(e.values.length<1)throw new Error("Can't serialize an empty log");return t.object.put(e.toBuffer()).then(t=>t.toJSON().multihash)}static fromMultihash(t,e,n=-1,c,f){if(!a(t))throw s.ImmutableDBNotDefinedError();if(!a(e))throw new Error(`Invalid hash: ${e}`);return t.object.get(e,{enc:"base58"}).then(t=>JSON.parse(t.toJSON().data)).then(e=>{if(!e.heads||!e.id)throw s.NotALogError();return i.fetchAll(t,e.heads,n,c,null,f).then(t=>{const n=t.reduce((t,e)=>e.clock.time>t.time?new o(e.clock.id,e.clock.time):t,new o(e.id)),i=t.slice().sort(r.compare),s=i.filter(t=>e.heads.includes(t.hash));return{id:e.id,values:i,heads:s,clock:n}})})}static fromEntryHash(t,e,n,r=-1,o,c){if(!a(t))throw s.IpfsNotDefinedError();if(!a(e))throw new Error("'entryHash' must be defined");r=r>-1?Math.max(r,1):r;const f=o;return i.fetchParallel(t,[e],r,f,null,null,c).then(t=>{return{values:r>-1?((t,e)=>t.slice(t.length-e,t.length))(t,r):t}})}static fromJSON(t,e,n=-1,o,c,f){if(!a(t))throw s.ImmutableDBNotDefinedError();return i.fetchParallel(t,e.heads.map(t=>t.hash),n,[],16,c,f).then(t=>{const n=t.slice().sort(r.compare);t.filter(t=>e.heads.includes(t.hash));return{id:e.id,values:n,heads:e.heads}})}static fromEntry(t,e,n=-1,o,f,h,d){if(!a(t))throw s.ImmutableDBNotDefinedError();if(!a(e))throw new Error("'sourceEntries' must be defined");if(!Array.isArray(e)&&!r.isEntry(e))throw new Error("'sourceEntries' argument must be an array of Entry instances or a single Entry");Array.isArray(e)||(e=[e]),n=n>-1?Math.max(n,e.length):n;const l=o?o.map(t=>t.hash?t.hash:t):o,p=e.map(t=>t.hash);return i.fetchParallel(t,p,n,l,null,null,d).then(t=>{var i=e.concat(t),o=c(i,"hash").sort(r.compare);const s=o.slice(n>-1?-n:-o.length),a=((t,e)=>{var n=t.slice(e.length,t.length);return e.concat(n)})(s,u(s,e,"hash"));return{id:a[a.length-1].id,values:a}})}static expandFrom(t,e,n,r=-1){if(!a(t))throw s.ImmutableDBNotDefinedError();if(!a(e))throw s.LogNotDefinedError();if(!a(n))throw new Error("'entries' must be given as argument");Array.isArray(n)||(n=[n]);const o=n.map(t=>t.next).filter(t=>t.length>0);return 0===o.length?Promise.resolve({values:e.values}):i.fetchParallel(t,o,r,e.values).then(t=>{return{values:e.merge(t.slice(0,r))}})}static expand(t,e,n=-1){if(!a(t))throw s.ImmutableDBNotDefinedError();if(!a(e))throw s.LogNotDefinedError();return 0===e.tailHashes.length?Promise.resolve({values:e.values}):i.fetchParallel(t,e.tailHashes,n,e.values).then(t=>{const i=n>-1?e.values.length+n:-1,o=e.values.concat(t).sort(r.compare),s=i>-1?o.slice(-i):o.slice(),a=u(s,e.values,"hash").sort(r.compare),h=u(e.values,s,"hash").sort(r.compare),d=f(e.values,s,"hash").sort(r.compare),l=i-(d.length+a.length),p=(t,e)=>{var n=[];n=t.concat(e);return c(n,"hash").sort(r.compare)};return{values:p(a,p(d,l>-1?h.slice(-l):h))}})}}t.exports=h},function(t,e,n){"use strict";const r=n(74),i=n(21),o=n(26);let s=0,a=0;class c{static fetchParallel(t,e,n,r=[],o,s,a){const f=(t,e)=>t.concat(e);return i(e,e=>c.fetchAll(t,e,n,r,s,a),{concurrency:Math.max(o||e.length,1)}).then(t=>t.reduce(f,[]))}static fetchAll(t,e,n,i=[],c=null,f){let u=[],h={},d=Array.isArray(e)?e.slice():[e];const l=t=>d.push(t);i.forEach(t=>h[t.hash]=t);return r(()=>d.length>0&&(u.length<n||n<0),()=>{const e=d.shift();return h[e]?Promise.resolve():new Promise((n,r)=>{const i=c?setTimeout(()=>{console.warn(`Warning: Couldn't fetch entry '${e}', request timed out (${c}ms)`),n()},c):null;s++,o.fromMultihash(t,e).then(t=>{clearTimeout(i),o.isEntry(t)&&(t.next.forEach(l),u.push(t),h[e]=t,a++,f&&f(e,t,u.length))}).then(n).catch(t=>{n()})})}).then(()=>u)}}t.exports=c},function(t,e,n){"use strict";const r=t=>new Promise(e=>{e(t())});t.exports=((t,e)=>r(function n(){if(t())return r(e).then(n)}))},function(t,e,n){"use strict";t.exports=function(t,e,n){var r={},i={};return t.forEach(t=>i[n?t[n]:t]=!0),e.reduce((t,e)=>{var o=void 0!==i[n?e[n]:e],s=void 0!==r[n?e[n]:e];return o&&!s&&(t.push(e),r[n?e[n]:e]=!0),t},[])}},function(t,e,n){"use strict";t.exports=function(t,e,n){var r={},i={};return t.forEach(t=>i[n?t[n]:t]=!0),e.reduce((t,e)=>{var o=void 0!==i[n?e[n]:e],s=void 0!==r[n?e[n]:e];return o||s||(t.push(e),r[n?e[n]:e]=!0),t},[])}},function(t,e,n){"use strict";t.exports={keys:n(78),once:n(45),values:n(29),count:n(79),infinite:n(80),empty:n(81),error:n(82)}},function(t,e,n){"use strict";var r=n(29);t.exports=function(t){return r(Object.keys(t))}},function(t,e,n){"use strict";t.exports=function(t){var e=0;return t=t||1/0,function(n,r){return n?r&&r(n):e>t?r(!0):void r(null,e++)}}},function(t,e,n){"use strict";t.exports=function(t){return t=t||Math.random,function(e,n){return e?n&&n(e):n(null,t())}}},function(t,e,n){"use strict";t.exports=function(){return function(t,e){e(!0)}}},function(t,e,n){"use strict";t.exports=function(t){return function(e,n){n(t)}}},function(t,e,n){"use strict";t.exports={drain:n(15),onEnd:n(84),log:n(85),find:n(86),reduce:n(30),collect:n(87),concat:n(88)}},function(t,e,n){"use strict";var r=n(15);t.exports=function(t){return r(null,t)}},function(t,e,n){"use strict";var r=n(15);t.exports=function(t){return r(function(t){console.log(t)},t)}},function(t,e,n){"use strict";function r(t){return t}var i=n(16),o=n(15);t.exports=function(t,e){var n=!1;return e?t=i(t)||r:(e=t,t=r),o(function(r){if(t(r))return n=!0,e(null,r),!1},function(t){n||e(!0===t?null:t,null)})}},function(t,e,n){"use strict";var r=n(30);t.exports=function(t){return r(function(t,e){return t.push(e),t},[],t)}},function(t,e,n){"use strict";var r=n(30);t.exports=function(t){return r(function(t,e){return t+e},"",t)}},function(t,e,n){"use strict";t.exports={map:n(90),asyncMap:n(91),filter:n(31),filterNot:n(92),through:n(93),take:n(94),unique:n(47),nonUnique:n(95),flatten:n(96)}},function(t,e,n){"use strict";function r(t){return t}var i=n(16);t.exports=function(t){return t?(t=i(t),function(e){return function(n,r){e(n,function(n,i){try{i=n?null:t(i)}catch(t){return e(t,function(){return r(t)})}r(n,i)})}}):r}},function(t,e,n){"use strict";function r(t){return t}var i=n(16);t.exports=function(t){if(!t)return r;t=i(t);var e,n,o=!1;return function(r){return function i(s,a){if(n)return a(n);s?(n=s,o?r(s,function(){o?e=a:a(s)}):r(s,a)):r(null,function(r,s){r?a(r):n?a(n):(o=!0,t(s,function(t,r){o=!1,n?(a(n),e(n)):t?i(t,a):a(null,r)}))})}}}},function(t,e,n){"use strict";var r=n(46),i=n(31);t.exports=function(t){return t=r(t),i(function(e){return!t(e)})}},function(t,e,n){"use strict";t.exports=function(t,e){function n(t){!r&&e&&(r=!0,e(!0===t?null:t))}var r=!1;return function(e){return function(r,i){return r&&n(r),e(r,function(e,r){e?n(e):t&&t(r),i(e,r)})}}}},function(t,e,n){"use strict";t.exports=function(t,e){var n=(e=e||{}).last||!1,r=!1;if("number"==typeof t){n=!0;var i=t;t=function(){return--i}}return function(e){function i(t){e(!0,function(e){n=!1,t(e||!0)})}return function(o,s){r?n?i(s):s(r):(r=o)?e(r,s):e(null,function(e,o){(r=r||e)?s(r):t(o)?s(null,o):(r=!0,n?s(null,o):i(s))})}}}},function(t,e,n){"use strict";var r=n(47);t.exports=function(t){return r(t,!0)}},function(t,e,n){"use strict";var r=n(29),i=n(45);t.exports=function(){return function(t){var e;return function(n,o){function s(){e(null,function(e,n){!0===e?a():e?t(!0,function(t){o(e)}):o(null,n)})}function a(){e=null,t(null,function(t,n){if(t)return o(t);Array.isArray(n)||n&&"object"==typeof n?n=r(n):"function"!=typeof n&&(n=i(n)),e=n,s()})}n?e?e(n,function(e){t(e||n,o)}):t(n,o):e?s():a()}}}},function(t,e,n){"use strict";t.exports=function t(e){var n=arguments.length;if("function"==typeof e&&1===e.length){for(var r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return function(e){if(null==r)throw new TypeError("partial sink should only be called once!");var i=r;switch(r=null,n){case 1:return t(e,i[0]);case 2:return t(e,i[0],i[1]);case 3:return t(e,i[0],i[1],i[2]);case 4:return t(e,i[0],i[1],i[2],i[3]);default:return i.unshift(e),t.apply(null,i)}}}var o=e;o&&"function"==typeof o.source&&(o=o.source);for(i=1;i<n;i++){var s=arguments[i];"function"==typeof s?o=s(o):s&&"object"==typeof s&&(s.sink(o),o=s.source)}return o}},function(t,e,n){"use strict";(function(e){function r(t){return t.length-1}function i(t){return t[r(t)]}function o(t){return e.isBuffer(t)?t:e.from(t)}var s=function(){function t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}(),a=n(99),c=n(100),f=n(48),u=n(102),h=n(104),d=n(105).recent,l=n(22);t.exports=function(){function t(e){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.path=e||"pull-blob-store-"+Math.random().toString().slice(2,10),this.db=new a(this.path),this.db.version(1).stores(function(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}({},this.path,"++,key,blob"))}return s(t,[{key:"write",value:function(t,n){var s=this;n=n||function(){};var a=h();return t?(this.remove(t,function(f){if(f)return n(f);var u=s.table;a.resolve(l(d(100,10),c(function(e,n){var r=e.map(function(e){return{key:t,blob:e}});u.bulkPut(r).then(function(){return n()}).catch(n)},function(t,n){return t=t||[],Array.isArray(n)||(n=[n]),n=n.map(o),!t.length||i(t).length>99?t.push(e.concat(n)):t[r(t)]=e.concat(i(t).concat(n)),t},100,n)))}),a):(n(new Error("Missing key")),a)}},{key:"read",value:function(t){var e=this,n=f();return t?(this.exists(t,function(r,i){return r?n.end(r):i?void e.table.where("key").equals(t).each(function(t){return n.push(u(t.blob))}).catch(function(t){return n.end(t)}).then(function(){return n.end()}):n.end(new Error("Not found"))}),n):(n.end(new Error("Missing key")),n)}},{key:"exists",value:function(t,e){if(e=e||function(){},!t)return e(new Error("Missing key"));this.table.where("key").equals(t).count().then(function(t){return e(null,Boolean(t))}).catch(e)}},{key:"remove",value:function(t,e){if(e=e||function(){},!t)return e(new Error("Missing key"));var n=this.table.where("key").equals(t);n.count(function(t){return t>0?n.delete():null}).then(function(){return e()}).catch(e)}},{key:"table",get:function(){return this.db[this.path]}}]),t}()}).call(e,n(1).Buffer)},function(t,e,n){(function(e,n){!function(e,n){t.exports=n()}(0,function(){"use strict";function t(t,e){return"object"!=typeof e?t:(gt(e).forEach(function(n){t[n]=e[n]}),t)}function r(t,e){return St.call(t,e)}function i(t,e){"function"==typeof e&&(e=e(wt(t))),gt(e).forEach(function(n){o(t,n,e[n])})}function o(e,n,i,o){Object.defineProperty(e,n,t(i&&r(i,"get")&&"function"==typeof i.get?{get:i.get,set:i.set,configurable:!0}:{value:i,configurable:!0,writable:!0},o))}function s(t){return{from:function(e){return t.prototype=Object.create(e.prototype),o(t.prototype,"constructor",t),{extend:i.bind(null,t.prototype)}}}}function a(t,e){var n;return kt(t,e)||(n=wt(t))&&a(n,e)}function c(t,e,n){return xt.call(t,e,n)}function f(t,e){return e(t)}function u(t){var e=setTimeout(t,1e3);clearTimeout(e)}function h(t){if(!t)throw new Error("Assertion Failed")}function d(t){_t.setImmediate?n(t):setTimeout(t,0)}function l(t,e){return t.reduce(function(t,n,r){var i=e(n,r);return i&&(t[i[0]]=i[1]),t},{})}function p(t,e){return function(){try{t.apply(this,arguments)}catch(t){e(t)}}}function b(t,e,n){try{t.apply(null,n)}catch(t){e&&e(t)}}function y(t,e){if(r(t,e))return t[e];if(!e)return t;if("string"!=typeof e){for(var n=[],i=0,o=e.length;i<o;++i){var s=y(t,e[i]);n.push(s)}return n}var a=e.indexOf(".");if(-1!==a){var c=t[e.substr(0,a)];return void 0===c?void 0:y(c,e.substr(a+1))}}function m(t,e,n){if(t&&void 0!==e&&!("isFrozen"in Object&&Object.isFrozen(t)))if("string"!=typeof e&&"length"in e){h("string"!=typeof n&&"length"in n);for(var r=0,i=e.length;r<i;++r)m(t,e[r],n[r])}else{var o=e.indexOf(".");if(-1!==o){var s=e.substr(0,o),a=e.substr(o+1);if(""===a)void 0===n?delete t[s]:t[s]=n;else{var c=t[s];c||(c=t[s]={}),m(c,a,n)}}else void 0===n?delete t[e]:t[e]=n}}function g(t){var e={};for(var n in t)r(t,n)&&(e[n]=t[n]);return e}function v(t){if(!t||"object"!=typeof t)return t;var e;if(vt(t)){e=[];for(var n=0,i=t.length;n<i;++n)e.push(v(t[n]))}else if(t instanceof Date)(e=new Date).setTime(t.getTime());else{e=t.constructor?Object.create(t.constructor.prototype):{};for(var o in t)r(t,o)&&(e[o]=v(t[o]))}return e}function _(t,e,n,i){return n=n||{},i=i||"",gt(t).forEach(function(o){if(r(e,o)){var s=t[o],a=e[o];"object"==typeof s&&"object"==typeof a&&s&&a&&s.constructor===a.constructor?_(s,a,n,i+o+"."):s!==a&&(n[i+o]=e[o])}else n[i+o]=void 0}),gt(e).forEach(function(o){r(t,o)||(n[i+o]=e[o])}),n}function w(t){var e,n,r,i;if(1===arguments.length){if(vt(t))return t.slice();if(this===At&&"string"==typeof t)return[t];if(i=Mt(t)){for(n=[];!(r=i.next()).done;)n.push(r.value);return n}if(null==t)return[t];if("number"==typeof(e=t.length)){for(n=new Array(e);e--;)n[e]=t[e];return n}return[t]}for(e=arguments.length,n=new Array(e);e--;)n[e]=arguments[e];return n}function S(){}function k(t){return t}function x(t,e){return null==t||t===k?e:function(n){return e(t(n))}}function E(t,e){return function(){t.apply(this,arguments),e.apply(this,arguments)}}function M(t,e){return t===S?e:function(){var n=t.apply(this,arguments);void 0!==n&&(arguments[0]=n);var r=this.onsuccess,i=this.onerror;this.onsuccess=null,this.onerror=null;var o=e.apply(this,arguments);return r&&(this.onsuccess=this.onsuccess?E(r,this.onsuccess):r),i&&(this.onerror=this.onerror?E(i,this.onerror):i),void 0!==o?o:n}}function A(t,e){return t===S?e:function(){t.apply(this,arguments);var n=this.onsuccess,r=this.onerror;this.onsuccess=this.onerror=null,e.apply(this,arguments),n&&(this.onsuccess=this.onsuccess?E(n,this.onsuccess):n),r&&(this.onerror=this.onerror?E(r,this.onerror):r)}}function O(e,n){return e===S?n:function(r){var i=e.apply(this,arguments);t(r,i);var o=this.onsuccess,s=this.onerror;this.onsuccess=null,this.onerror=null;var a=n.apply(this,arguments);return o&&(this.onsuccess=this.onsuccess?E(o,this.onsuccess):o),s&&(this.onerror=this.onerror?E(s,this.onerror):s),void 0===i?void 0===a?void 0:a:t(i,a)}}function I(t,e){return t===S?e:function(){return!1!==e.apply(this,arguments)&&t.apply(this,arguments)}}function P(t,e){return t===S?e:function(){var n=t.apply(this,arguments);if(n&&"function"==typeof n.then){for(var r=this,i=arguments.length,o=new Array(i);i--;)o[i]=arguments[i];return n.then(function(){return e.apply(r,o)})}return e.apply(this,arguments)}}function C(t,e){It=t,Pt=e}function N(){if(Ct)try{throw new Error}catch(t){return t}return new Error}function R(t,e){var n=t.stack;return n?(e=e||0,0===n.indexOf(t.name)&&(e+=(t.name+t.message).split("\n").length),n.split("\n").slice(e).filter(Pt).map(function(t){return"\n"+t}).join("")):""}function j(t,e){return function(){return console.warn(t+" is deprecated. See https://github.com/dfahlander/Dexie.js/wiki/Deprecations. "+R(N(),1)),e.apply(this,arguments)}}function T(t,e){this._e=N(),this.name=t,this.message=e}function L(t,e,n,r){this._e=N(),this.failures=e,this.failedKeys=r,this.successCount=n}function D(t,e){this._e=N(),this.name="BulkError",this.failures=e,this.message=function(t,e){return t+". Errors: "+e.map(function(t){return t.toString()}).filter(function(t,e,n){return n.indexOf(t)===e}).join("\n")}(t,e)}function B(t){function e(t,i,o){if("object"==typeof t)return function(t){gt(t).forEach(function(n){var r=t[n];if(vt(r))e(n,t[n][0],t[n][1]);else{if("asap"!==r)throw new Dt.InvalidArgument("Invalid event config");var i=e(n,k,function(){for(var t=arguments.length,e=new Array(t);t--;)e[t]=arguments[t];i.subscribers.forEach(function(t){d(function(){t.apply(null,e)})})})}})}(t);i||(i=I),o||(o=S);var s={subscribers:[],fire:o,subscribe:function(t){-1===s.subscribers.indexOf(t)&&(s.subscribers.push(t),s.fire=i(s.fire,t))},unsubscribe:function(t){s.subscribers=s.subscribers.filter(function(e){return e!==t}),s.fire=s.subscribers.reduce(i,o)}};return n[t]=r[t]=s,s}var n={},r=function(e,r){if(r){for(var i=arguments.length,o=new Array(i-1);--i;)o[i-1]=arguments[i];return n[e].subscribe.apply(null,o),t}if("string"==typeof e)return n[e]};r.addEventType=e;for(var i=1,o=arguments.length;i<o;++i)e(arguments[i]);return r}function F(t){if("object"!=typeof this)throw new TypeError("Promises must be constructed via new");this._listeners=[],this.onuncatched=S,this._lib=!1;var e=this._PSD=Xt;if(It&&(this._stackHolder=N(),this._prev=null,this._numPrev=0,W(this,$t)),"function"!=typeof t){if(t!==qt)throw new TypeError("Not a function");return this._state=arguments[1],this._value=arguments[2],void(!1===this._state&&z(this,this._value))}this._state=null,this._value=null,++e.ref,U(this,t)}function q(t,e,n,r){this.onFulfilled="function"==typeof t?t:null,this.onRejected="function"==typeof e?e:null,this.resolve=n,this.reject=r,this.psd=Xt}function U(t,e){try{e(function(e){if(null===t._state){if(e===t)throw new TypeError("A promise cannot be resolved with itself.");var n=t._lib&&$();e&&"function"==typeof e.then?U(t,function(t,n){e instanceof F?e._then(t,n):e.then(t,n)}):(t._state=!0,t._value=e,K(t)),n&&V()}},z.bind(null,t))}catch(e){z(t,e)}}function z(t,e){if(Jt.push(e),null===t._state){var n=t._lib&&$();e=Vt(e),t._state=!1,t._value=e,It&&null!==e&&"object"==typeof e&&!e._promise&&b(function(){var n=a(e,"stack");e._promise=t,o(e,"stack",{get:function(){return zt?n&&(n.get?n.get.apply(e):n.value):t.stack}})}),function(t){Wt.some(function(e){return e._value===t._value})||Wt.push(t)}(t),K(t),n&&V()}}function K(t){var e=t._listeners;t._listeners=[];for(var n=0,r=e.length;n<r;++n)G(t,e[n]);var i=t._PSD;--i.ref||i.finalize(),0===Qt&&(++Qt,Gt(function(){0==--Qt&&X()},[]))}function G(t,e){if(null!==t._state){var n=t._state?e.onFulfilled:e.onRejected;if(null===n)return(t._state?e.resolve:e.reject)(t._value);++e.psd.ref,++Qt,Gt(H,[n,t,e])}else t._listeners.push(e)}function H(t,e,n){var r=Xt,i=n.psd;try{i!==r&&(Xt=i),$t=e;var o,s=e._value;e._state?o=t(s):(Jt.length&&(Jt=[]),o=t(s),-1===Jt.indexOf(s)&&function(t){var e=Wt.length;for(;e;)if(Wt[--e]._value===t._value)return void Wt.splice(e,1)}(e)),n.resolve(o)}catch(t){n.reject(t)}finally{i!==r&&(Xt=r),$t=null,0==--Qt&&X(),--i.ref||i.finalize()}}function Y(t,e,n){if(e.length===n)return e;var r="";if(!1===t._state){var i,o,s=t._value;null!=s?(i=s.name||"Error",o=s.message||s,r=R(s,0)):(i=s,o=""),e.push(i+(o?": "+o:"")+r)}return It&&((r=R(t._stackHolder,2))&&-1===e.indexOf(r)&&e.push(r),t._prev&&Y(t._prev,e,n)),e}function W(t,e){var n=e?e._numPrev+1:0;n<Ut&&(t._prev=e,t._numPrev=n)}function J(){$()&&V()}function $(){var t=Ht;return Ht=!1,Yt=!1,t}function V(){var t,e,n;do{for(;Zt.length>0;)for(t=Zt,Zt=[],n=t.length,e=0;e<n;++e){var r=t[e];r[0].apply(null,r[1])}}while(Zt.length>0);Ht=!0,Yt=!0}function X(){var t=Wt;Wt=[],t.forEach(function(t){t._PSD.onunhandled.call(null,t._value,t)});for(var e=te.slice(0),n=e.length;n;)e[--n]()}function Z(t){return new F(qt,!1,t)}function Q(t,e){var n=Xt;return function(){var r=$(),i=Xt;try{return i!==n&&(Xt=n),t.apply(this,arguments)}catch(t){e&&e(t)}finally{i!==n&&(Xt=i),r&&V()}}}function tt(t,e,n,r){var i=Xt,o=Object.create(i);o.parent=i,o.ref=0,o.global=!1,++i.ref,o.finalize=function(){--this.parent.ref||this.parent.finalize()};var s=et(o,t,e,n,r);return 0===o.ref&&o.finalize(),s}function et(t,e,n,r,i){var o=Xt;try{return t!==o&&(Xt=t),e(n,r,i)}finally{t!==o&&(Xt=o)}}function nt(e,n){var r;try{r=n.onuncatched(e)}catch(t){}if(!1!==r)try{var i,o={promise:n,reason:e};if(_t.document&&document.createEvent?((i=document.createEvent("Event")).initEvent(ne,!0,!0),t(i,o)):_t.CustomEvent&&t(i=new CustomEvent(ne,{detail:o}),o),i&&_t.dispatchEvent&&(dispatchEvent(i),!_t.PromiseRejectionEvent&&_t.onunhandledrejection))try{_t.onunhandledrejection(i)}catch(t){}i.defaultPrevented||F.on.error.fire(e,n)}catch(t){}}function rt(t,e){var n=F.reject(t);return e?n.uncaught(e):n}function it(e,n){function a(t){this._cfg={version:t,storesSource:null,dbschema:{},tables:{},contentUpgrade:null},this.stores({})}function d(t,e,n){var r=Ht._createTransaction(Gt,Lt,jt);r.create(e),r._completion.catch(n);var i=r._reject.bind(r);tt(function(){Xt.trans=r,0===t?(gt(jt).forEach(function(t){E(e,t,jt[t].primKey,jt[t].indexes)}),F.follow(function(){return Ht.on.populate.fire(r)}).catch(i)):function(t,e,n){function r(){return i.length?F.resolve(i.shift()(e.idbtrans)).then(r):F.resolve()}var i=[],o=Tt.filter(function(e){return e._cfg.version===t})[0];if(!o)throw new Dt.Upgrade("Dexie specification of currently installed DB version is missing");jt=Ht._dbSchema=o._cfg.dbschema;var s=!1;Tt.filter(function(e){return e._cfg.version>t}).forEach(function(t){i.push(function(){var r=jt,i=t._cfg.dbschema;_t(r,n),_t(i,n),jt=Ht._dbSchema=i;var o=function(t,e){var n={del:[],add:[],change:[]};for(var r in t)e[r]||n.del.push(r);for(r in e){var i=t[r],o=e[r];if(i){var s={name:r,def:o,recreate:!1,del:[],add:[],change:[]};if(i.primKey.src!==o.primKey.src)s.recreate=!0,n.change.push(s);else{var a=i.idxByName,c=o.idxByName;for(var f in a)c[f]||s.del.push(f);for(f in c){var u=a[f],h=c[f];u?u.src!==h.src&&s.change.push(h):s.add.push(h)}(s.del.length>0||s.add.length>0||s.change.length>0)&&n.change.push(s)}}else n.add.push([r,o])}return n}(r,i);if(o.add.forEach(function(t){E(n,t[0],t[1].primKey,t[1].indexes)}),o.change.forEach(function(t){if(t.recreate)throw new Dt.Upgrade("Not yet support for changing primary key");var e=n.objectStore(t.name);t.add.forEach(function(t){I(e,t)}),t.change.forEach(function(t){e.deleteIndex(t.name),I(e,t)}),t.del.forEach(function(t){e.deleteIndex(t)})}),t._cfg.contentUpgrade)return s=!0,F.follow(function(){t._cfg.contentUpgrade(e)})}),i.push(function(e){if(!s||!fe){!function(t,e){for(var n=0;n<e.db.objectStoreNames.length;++n){var r=e.db.objectStoreNames[n];null==t[r]&&e.db.deleteObjectStore(r)}}(t._cfg.dbschema,e)}})});return r().then(function(){!function(t,e){gt(t).forEach(function(n){e.db.objectStoreNames.contains(n)||E(e,n,t[n].primKey,t[n].indexes)})}(jt,n)})}(t,r,e).catch(i)})}function E(t,e,n,r){var i=t.db.createObjectStore(e,n.keyPath?{keyPath:n.keyPath,autoIncrement:n.auto}:{autoIncrement:n.auto});return r.forEach(function(t){I(i,t)}),i}function I(t,e){t.createIndex(e.name,e.keyPath,{unique:e.unique,multiEntry:e.multi})}function C(t){return Ht.on.error.fire(t)}function R(t,e,n){if(zt||Xt.letThrough){var r=Ht._createTransaction(t,e,jt);return r._promise(t,function(t,e){tt(function(){Xt.trans=r,n(t,e,r)})}).then(function(t){return r._completion.then(function(){return t})})}if(!Ut){if(!Ct)return rt(new Dt.DatabaseClosed,C);Ht.open().catch(S)}return Yt.then(function(){return R(t,e,n)})}function T(t,e,n){this.name=t,this.schema=e,this.hook=Bt[t]?Bt[t].hook:B(null,{creating:[M,S],reading:[x,k],updating:[O,S],deleting:[A,S]}),this._collClass=n||H}function q(t,e,n){T.call(this,t,e,n||W)}function U(t,e,n){return(n?ut:ft)(function(n){t.push(n),e&&e()})}function z(t,e,n,r,i){return new F(function(o,s){var a=n.length,c=a-1;if(0===a)return o();if(r){var f,u=ut(s),h=ct(null);b(function(){for(var r=0;r<a;++r){f={onsuccess:null,onerror:null};var s=n[r];i.call(f,s[0],s[1],e);var d=t.delete(s[0]);d._hookCtx=f,d.onerror=u,d.onsuccess=r===c?ct(o):h}},function(t){throw f.onerror&&f.onerror(t),t})}else for(var d=0;d<a;++d){var l=t.delete(n[d]);l.onerror=Q(ft(s)),d===c&&(l.onsuccess=Q(function(){return o()}))}}).uncaught(C)}function K(t,e,n,r){var i=this;this.db=Ht,this.mode=t,this.storeNames=e,this.idbtrans=null,this.on=B(this,"complete","error","abort"),this.parent=r||null,this.active=!0,this._tables=null,this._reculock=0,this._blockedFuncs=[],this._psd=null,this._dbschema=n,this._resolve=null,this._reject=null,this._completion=new F(function(t,e){i._resolve=t,i._reject=e}).uncaught(C),this._completion.then(function(){i.on.complete.fire()},function(t){return i.on.error.fire(t),i.parent?i.parent._reject(t):i.active&&i.idbtrans&&i.idbtrans.abort(),i.active=!1,rt(t)})}function G(t,e,n){this._ctx={table:t,index:":id"===e?null:e,collClass:t._collClass,or:n}}function H(t,e){var n=null,r=null;if(e)try{n=e()}catch(t){r=t}var i=t._ctx,o=i.table;this._ctx={table:o,index:i.index,isPrimKey:!i.index||o.schema.primKey.keyPath&&i.index===o.schema.primKey.name,range:n,keysOnly:!1,dir:"next",unique:"",algorithm:null,filter:null,replayFilter:null,justLimit:!0,isMatch:null,offset:0,limit:1/0,error:r,or:i.or,valueMapper:o.hook.reading.fire}}function Y(t,e){return!(t.filter||t.algorithm||t.or)&&(e?t.justLimit:!t.replayFilter)}function W(){H.apply(this,arguments)}function J(t,e){return t._cfg.version-e._cfg.version}function $(t,e,n,r){e.forEach(function(e){var i=Ht._tableFactory(n,r[e]);t.forEach(function(t){e in t||(t[e]=i)})})}function V(t,e,n,r,i,o){var s=Q(o?function(t,e,r){return n(o(t),e,r)}:n,i);t.onerror||(t.onerror=ft(i)),t.onsuccess=e?p(function(){var n=t.result;if(n){var o=function(){n.continue()};e(n,function(t){o=t},r,i)&&s(n.value,n,function(t){o=t}),o()}else r()},i):p(function(){var e=t.result;if(e){var n=function(){e.continue()};s(e.value,e,function(t){n=t}),n()}else r()},i)}function X(t,e){return Nt.cmp(t,e)}function Z(t,e){return Nt.cmp(t,e)}function nt(t,e){return Nt.cmp(e,t)}function ot(t,e){return t?e?function(){return t.apply(this,arguments)&&e.apply(this,arguments)}:t:e}function _t(t,e){for(var n=e.db.objectStoreNames,r=0;r<n.length;++r){var i=n[r],o=e.objectStore(i);xt="getAll"in o;for(var s=0;s<o.indexNames.length;++s){var a=o.indexNames[s],f=o.index(a).keyPath,u="string"==typeof f?f:"["+c(f).join("+")+"]";if(t[i]){var h=t[i].idxByName[u];h&&(h.name=a)}}}}function wt(t){Ht.on("blocked").fire(t),ae.filter(function(t){return t.name===Ht.name&&t!==Ht&&!t._vcFired}).map(function(e){return e.on("versionchange").fire(t)})}var St,kt,xt,Et=it.dependencies,Mt=t({addons:it.addons,autoOpen:!0,indexedDB:Et.indexedDB,IDBKeyRange:Et.IDBKeyRange},n),Pt=Mt.addons,Ct=Mt.autoOpen,Nt=Mt.indexedDB,Rt=Mt.IDBKeyRange,jt=this._dbSchema={},Tt=[],Lt=[],Bt={},Ft=null,qt=null,Ut=!1,zt=!1,Kt="readonly",Gt="readwrite",Ht=this,Yt=new F(function(t){St=t}),Wt=new F(function(t,e){kt=e}),Jt=!0,$t=!!mt(Nt);this.version=function(t){if(Ft||Ut)throw new Dt.Schema("Cannot add version when database is open");this.verno=Math.max(this.verno,t);var e=Tt.filter(function(e){return e._cfg.version===t})[0];return e||(e=new a(t),Tt.push(e),Tt.sort(J),e)},t(a.prototype,{stores:function(e){this._cfg.storesSource=this._cfg.storesSource?t(this._cfg.storesSource,e):e;var n={};Tt.forEach(function(e){t(n,e._cfg.storesSource)});var r=this._cfg.dbschema={};return this._parseStoresSpec(n,r),jt=Ht._dbSchema=r,function(t){t.forEach(function(t){for(var e in t)t[e]instanceof T&&delete t[e]})}([Bt,Ht,K.prototype]),$([Bt,Ht,K.prototype,this._cfg.tables],gt(r),Gt,r),Lt=gt(r),this},upgrade:function(t){var e=this;return de(function(){t(Ht._createTransaction(Gt,gt(e._cfg.dbschema),e._cfg.dbschema))}),this._cfg.contentUpgrade=t,this},_parseStoresSpec:function(t,e){gt(t).forEach(function(n){if(null!==t[n]){var r={},i=function(t){var e=[];return t.split(",").forEach(function(t){var n=(t=t.trim()).replace(/([&*]|\+\+)/g,""),r=/^\[/.test(n)?n.match(/^\[(.*)\]$/)[1].split("+"):n;e.push(new pt(n,r||null,/\&/.test(t),/\*/.test(t),/\+\+/.test(t),vt(r),/\./.test(t)))}),e}(t[n]),o=i.shift();if(o.multi)throw new Dt.Schema("Primary key cannot be multi-valued");o.keyPath&&m(r,o.keyPath,o.auto?0:o.keyPath),i.forEach(function(t){if(t.auto)throw new Dt.Schema("Only primary key can be marked as autoIncrement (++)");if(!t.keyPath)throw new Dt.Schema("Index must have a name and cannot be an empty string");m(r,t.keyPath,t.compound?t.keyPath.map(function(){return""}):"")}),e[n]=new bt(n,o,i,r)}})}}),this._allTables=Bt,this._tableFactory=function(t,e){return t===Kt?new T(e.name,e,H):new q(e.name,e)},this._createTransaction=function(t,e,n,r){return new K(t,e,n,r)},this._whenReady=function(t){return new F(le||zt||Xt.letThrough?t:function(e,n){if(!Ut){if(!Ct)return void n(new Dt.DatabaseClosed);Ht.open().catch(S)}Yt.then(function(){t(e,n)})}).uncaught(C)},this.verno=0,this.open=function(){if(Ut||Ft)return Yt.then(function(){return qt?rt(qt,C):Ht});It&&(Wt._stackHolder=N()),Ut=!0,qt=null,zt=!1;var t=St,n=null;return F.race([Wt,new F(function(t,r){if(u(function(){return t()}),Tt.length>0&&(Jt=!1),!Nt)throw new Dt.MissingAPI("indexedDB API not found. If using IE10+, make sure to run your code on a server URL (not locally). If using old Safari versions, make sure to include indexedDB polyfill.");var i=Jt?Nt.open(e):Nt.open(e,Math.round(10*Ht.verno));if(!i)throw new Dt.MissingAPI("IndexedDB API not available");i.onerror=Q(ft(r)),i.onblocked=Q(wt),i.onupgradeneeded=Q(function(t){if(n=i.transaction,Jt&&!Ht._allowEmptyDB){i.onerror=ht,n.abort(),i.result.close();var o=Nt.deleteDatabase(e);o.onsuccess=o.onerror=Q(function(){r(new Dt.NoSuchDatabase("Database "+e+" doesnt exist"))})}else{n.onerror=Q(ft(r));d((t.oldVersion>Math.pow(2,62)?0:t.oldVersion)/10,n,r)}},r),i.onsuccess=Q(function(){if(n=null,Ft=i.result,ae.push(Ht),Jt)!function(){if(Ht.verno=Ft.version/10,Ht._dbSchema=jt={},0!==(Lt=c(Ft.objectStoreNames,0)).length){var t=Ft.transaction(yt(Lt),"readonly");Lt.forEach(function(e){for(var n=t.objectStore(e),r=n.keyPath,i=r&&"string"==typeof r&&-1!==r.indexOf("."),o=new pt(r,r||"",!1,!1,!!n.autoIncrement,r&&"string"!=typeof r,i),s=[],a=0;a<n.indexNames.length;++a){var c=n.index(n.indexNames[a]);i=(r=c.keyPath)&&"string"==typeof r&&-1!==r.indexOf(".");var f=new pt(c.name,r,!!c.unique,!!c.multiEntry,!1,r&&"string"!=typeof r,i);s.push(f)}jt[e]=new bt(e,o,s,{})}),$([Bt,K.prototype],gt(jt),Gt,jt)}}();else if(Ft.objectStoreNames.length>0)try{_t(jt,Ft.transaction(yt(Ft.objectStoreNames),Kt))}catch(t){}Ft.onversionchange=Q(function(t){Ht._vcFired=!0,Ht.on("versionchange").fire(t)}),$t||dt(function(t){if(-1===t.indexOf(e))return t.push(e)}),t()},r)})]).then(function(){return it.vip(Ht.on.ready.fire)}).then(function(){return Ut=!1,Ht}).catch(function(t){try{n&&n.abort()}catch(t){}return Ut=!1,Ht.close(),qt=t,rt(qt,C)}).finally(function(){zt=!0,t()})},this.close=function(){var t=ae.indexOf(Ht);if(t>=0&&ae.splice(t,1),Ft){try{Ft.close()}catch(t){}Ft=null}Ct=!1,qt=new Dt.DatabaseClosed,Ut&&kt(qt),Yt=new F(function(t){St=t}),Wt=new F(function(t,e){kt=e})},this.delete=function(){var t=arguments.length>0;return new F(function(n,r){function i(){Ht.close();var t=Nt.deleteDatabase(e);t.onsuccess=Q(function(){$t||dt(function(t){var n=t.indexOf(e);if(n>=0)return t.splice(n,1)}),n()}),t.onerror=Q(ft(r)),t.onblocked=wt}if(t)throw new Dt.InvalidArgument("Arguments not allowed in db.delete()");Ut?Yt.then(i):i()}).uncaught(C)},this.backendDB=function(){return Ft},this.isOpen=function(){return null!==Ft},this.hasFailed=function(){return null!==qt},this.dynamicallyOpened=function(){return Jt},this.name=e,o(this,"tables",{get:function(){return gt(Bt).map(function(t){return Bt[t]})}}),this.on=B(this,"error","populate","blocked","versionchange",{ready:[P,S]}),this.on.error.subscribe=j("Dexie.on.error",this.on.error.subscribe),this.on.error.unsubscribe=j("Dexie.on.error.unsubscribe",this.on.error.unsubscribe),this.on.ready.subscribe=f(this.on.ready.subscribe,function(t){return function(e,n){it.vip(function(){zt?(qt||F.resolve().then(e),n&&t(e)):(t(e),n||t(function t(){Ht.on.ready.unsubscribe(e),Ht.on.ready.unsubscribe(t)}))})}}),de(function(){Ht.on("populate").fire(Ht._createTransaction(Gt,Lt,jt)),Ht.on("error").fire(new Error)}),this.transaction=function(t,e,n){function i(e){var i=Xt;e(F.resolve().then(function(){return tt(function(){Xt.transless=Xt.transless||i;var e=Ht._createTransaction(t,u,jt,c);Xt.trans=e,c?e.idbtrans=c.idbtrans:e.create();var o=u.map(function(t){return Bt[t]});o.push(e);var s;return F.follow(function(){if(s=n.apply(e,o))if("function"==typeof s.next&&"function"==typeof s.throw)s=lt(s);else if("function"==typeof s.then&&!r(s,"_PSD"))throw new Dt.IncompatiblePromise("Incompatible Promise returned from transaction scope (read more at http://tinyurl.com/znyqjqc). Transaction scope: "+n.toString())}).uncaught(C).then(function(){return c&&e._resolve(),e._completion}).then(function(){return s}).catch(function(t){return e._reject(t),rt(t)})})}))}var o=arguments.length;if(o<2)throw new Dt.InvalidArgument("Too few arguments");for(var s=new Array(o-1);--o;)s[o-1]=arguments[o];n=s.pop();var a=function(t){return Ot.apply([],t)}(s),c=Xt.trans;c&&c.db===Ht&&-1===t.indexOf("!")||(c=null);var f=-1!==t.indexOf("?");t=t.replace("!","").replace("?","");try{var u=a.map(function(t){var e=t instanceof T?t.name:t;if("string"!=typeof e)throw new TypeError("Invalid table argument to Dexie.transaction(). Only Table or String are allowed");return e});if("r"==t||t==Kt)t=Kt;else{if("rw"!=t&&t!=Gt)throw new Dt.InvalidArgument("Invalid transaction mode: "+t);t=Gt}if(c){if(c.mode===Kt&&t===Gt){if(!f)throw new Dt.SubTransaction("Cannot enter a sub-transaction with READWRITE mode when parent transaction is READONLY");c=null}c&&u.forEach(function(t){if(c&&-1===c.storeNames.indexOf(t)){if(!f)throw new Dt.SubTransaction("Table "+t+" not included in parent transaction.");c=null}})}}catch(t){return c?c._promise(null,function(e,n){n(t)}):rt(t,C)}return c?c._promise(t,i,"lock"):Ht._whenReady(i)},this.table=function(t){if(le&&Jt)return new q(t);if(!r(Bt,t))throw new Dt.InvalidTable("Table "+t+" does not exist");return Bt[t]},i(T.prototype,{_trans:function(t,e,n){var r=Xt.trans;return r&&r.db===Ht?r._promise(t,e,n):R(t,[this.name],e)},_idbstore:function(t,e,n){function r(t,n,r){e(t,n,r.idbtrans.objectStore(o),r)}if(le)return new F(e);var i=Xt.trans,o=this.name;return i&&i.db===Ht?i._promise(t,r,n):R(t,[this.name],r)},get:function(t,e){var n=this;return this._idbstore(Kt,function(e,r,i){le&&e(n.schema.instanceTemplate);var o=i.get(t);o.onerror=ft(r),o.onsuccess=Q(function(){e(n.hook.reading.fire(o.result))},r)}).then(e)},where:function(t){return new G(this,t)},count:function(t){return this.toCollection().count(t)},offset:function(t){return this.toCollection().offset(t)},limit:function(t){return this.toCollection().limit(t)},reverse:function(){return this.toCollection().reverse()},filter:function(t){return this.toCollection().and(t)},each:function(t){return this.toCollection().each(t)},toArray:function(t){return this.toCollection().toArray(t)},orderBy:function(t){return new this._collClass(new G(this,t))},toCollection:function(){return new this._collClass(new G(this))},mapToClass:function(t,e){this.schema.mappedClass=t;var n=Object.create(t.prototype);e&&st(n,e),this.schema.instanceTemplate=n;var i=function(e){if(!e)return e;var n=Object.create(t.prototype);for(var i in e)if(r(e,i))try{n[i]=e[i]}catch(t){}return n};return this.schema.readHook&&this.hook.reading.unsubscribe(this.schema.readHook),this.schema.readHook=i,this.hook("reading",i),t},defineClass:function(t){return this.mapToClass(it.defineClass(t),t)}}),s(q).from(T).extend({bulkDelete:function(t){return this.hook.deleting.fire===S?this._idbstore(Gt,function(e,n,r,i){e(z(r,i,t,!1,S))}):this.where(":id").anyOf(t).delete().then(function(){})},bulkPut:function(t,e){var n=this;return this._idbstore(Gt,function(r,i,o){if(!o.keyPath&&!n.schema.primKey.auto&&!e)throw new Dt.InvalidArgument("bulkPut() with non-inbound keys requires keys array in second argument");if(o.keyPath&&e)throw new Dt.InvalidArgument("bulkPut(): keys argument invalid on tables with inbound keys");if(e&&e.length!==t.length)throw new Dt.InvalidArgument("Arguments objects and keys must have the same length");if(0===t.length)return r();var s,a,c=function(t){0===f.length?r(t):i(new D(n.name+".bulkPut(): "+f.length+" of "+u+" operations failed",f))},f=[],u=t.length,h=n;if(n.hook.creating.fire===S&&n.hook.updating.fire===S){a=U(f);for(var d=0,p=t.length;d<p;++d)(s=e?o.put(t[d],e[d]):o.put(t[d])).onerror=a;s.onerror=U(f,c),s.onsuccess=at(c)}else{var b=e||o.keyPath&&t.map(function(t){return y(t,o.keyPath)}),m=b&&l(b,function(e,n){return null!=e&&[e,t[n]]});(b?h.where(":id").anyOf(b.filter(function(t){return null!=t})).modify(function(){this.value=m[this.primKey],m[this.primKey]=null}).catch(L,function(t){f=t.failures}).then(function(){for(var n=[],r=e&&[],i=b.length-1;i>=0;--i){var o=b[i];(null==o||m[o])&&(n.push(t[i]),e&&r.push(o),null!=o&&(m[o]=null))}return n.reverse(),e&&r.reverse(),h.bulkAdd(n,r)}).then(function(t){var e=b[b.length-1];return null!=e?e:t}):h.bulkAdd(t)).then(c).catch(D,function(t){f=f.concat(t.failures),c()}).catch(i)}},"locked")},bulkAdd:function(t,e){var n=this,r=this.hook.creating.fire;return this._idbstore(Gt,function(i,o,s,a){function c(t){0===d.length?i(t):o(new D(n.name+".bulkAdd(): "+d.length+" of "+l+" operations failed",d))}if(!s.keyPath&&!n.schema.primKey.auto&&!e)throw new Dt.InvalidArgument("bulkAdd() with non-inbound keys requires keys array in second argument");if(s.keyPath&&e)throw new Dt.InvalidArgument("bulkAdd(): keys argument invalid on tables with inbound keys");if(e&&e.length!==t.length)throw new Dt.InvalidArgument("Arguments objects and keys must have the same length");if(0===t.length)return i();var f,u,h,d=[],l=t.length;if(r!==S){var p,g=s.keyPath;u=U(d,null,!0),h=ct(null),b(function(){for(var n=0,i=t.length;n<i;++n){p={onerror:null,onsuccess:null};var o=e&&e[n],c=t[n],d=e?o:g?y(c,g):void 0,l=r.call(p,d,c,a);null==d&&null!=l&&(g?m(c=v(c),g,l):o=l),(f=null!=o?s.add(c,o):s.add(c))._hookCtx=p,n<i-1&&(f.onerror=u,p.onsuccess&&(f.onsuccess=h))}},function(t){throw p.onerror&&p.onerror(t),t}),f.onerror=U(d,c,!0),f.onsuccess=ct(c)}else{u=U(d);for(var _=0,w=t.length;_<w;++_)(f=e?s.add(t[_],e[_]):s.add(t[_])).onerror=u;f.onerror=U(d,c),f.onsuccess=at(c)}})},add:function(t,e){var n=this.hook.creating.fire;return this._idbstore(Gt,function(r,i,o,s){var a={onsuccess:null,onerror:null};if(n!==S){var c=null!=e?e:o.keyPath?y(t,o.keyPath):void 0,f=n.call(a,c,t,s);null==c&&null!=f&&(o.keyPath?m(t,o.keyPath,f):e=f)}try{var u=null!=e?o.add(t,e):o.add(t);u._hookCtx=a,u.onerror=ut(i),u.onsuccess=ct(function(e){var n=o.keyPath;n&&m(t,n,e),r(e)})}catch(t){throw a.onerror&&a.onerror(t),t}})},put:function(t,e){var n=this,r=this.hook.creating.fire,i=this.hook.updating.fire;return r!==S||i!==S?this._trans(Gt,function(r,i,o){var s=void 0!==e?e:n.schema.primKey.keyPath&&y(t,n.schema.primKey.keyPath);null==s?n.add(t).then(r,i):(o._lock(),t=v(t),n.where(":id").equals(s).modify(function(){this.value=t}).then(function(r){return 0===r?n.add(t,e):s}).finally(function(){o._unlock()}).then(r,i))}):this._idbstore(Gt,function(n,r,i){var o=void 0!==e?i.put(t,e):i.put(t);o.onerror=ft(r),o.onsuccess=function(e){var r=i.keyPath;r&&m(t,r,e.target.result),n(o.result)}})},delete:function(t){return this.hook.deleting.subscribers.length?this.where(":id").equals(t).delete():this._idbstore(Gt,function(e,n,r){var i=r.delete(t);i.onerror=ft(n),i.onsuccess=function(){e(i.result)}})},clear:function(){return this.hook.deleting.subscribers.length?this.toCollection().delete():this._idbstore(Gt,function(t,e,n){var r=n.clear();r.onerror=ft(e),r.onsuccess=function(){t(r.result)}})},update:function(t,e){if("object"!=typeof e||vt(e))throw new Dt.InvalidArgument("Modifications must be an object.");if("object"!=typeof t||vt(t))return this.where(":id").equals(t).modify(e);gt(e).forEach(function(n){m(t,n,e[n])});var n=y(t,this.schema.primKey.keyPath);return void 0===n?rt(new Dt.InvalidArgument("Given object does not contain its primary key"),C):this.where(":id").equals(n).modify(e)}}),i(K.prototype,{_lock:function(){return h(!Xt.global),++this._reculock,1!==this._reculock||Xt.global||(Xt.lockOwnerFor=this),this},_unlock:function(){if(h(!Xt.global),0==--this._reculock)for(Xt.global||(Xt.lockOwnerFor=null);this._blockedFuncs.length>0&&!this._locked();){var t=this._blockedFuncs.shift();try{et(t[1],t[0])}catch(t){}}return this},_locked:function(){return this._reculock&&Xt.lockOwnerFor!==this},create:function(t){var e=this;if(h(!this.idbtrans),!t&&!Ft)switch(qt&&qt.name){case"DatabaseClosedError":throw new Dt.DatabaseClosed(qt);case"MissingAPIError":throw new Dt.MissingAPI(qt.message,qt);default:throw new Dt.OpenFailed(qt)}if(!this.active)throw new Dt.TransactionInactive;return h(null===this._completion._state),t=this.idbtrans=t||Ft.transaction(yt(this.storeNames),this.mode),t.onerror=Q(function(n){ht(n),e._reject(t.error)}),t.onabort=Q(function(t){ht(t),e.active&&e._reject(new Dt.Abort),e.active=!1,e.on("abort").fire(t)}),t.oncomplete=Q(function(){e.active=!1,e._resolve()}),this},_promise:function(t,e,n){var r=this,i=r._locked()?new F(function(i,o){r._blockedFuncs.push([function(){r._promise(t,e,n).then(i,o)},Xt])}):tt(function(){var i=r.active?new F(function(i,o){if(t===Gt&&r.mode!==Gt)throw new Dt.ReadOnly("Transaction is readonly");!r.idbtrans&&t&&r.create(),n&&r._lock(),e(i,o,r)}):rt(new Dt.TransactionInactive);return r.active&&n&&i.finally(function(){r._unlock()}),i});return i._lib=!0,i.uncaught(C)},abort:function(){this.active&&this._reject(new Dt.Abort),this.active=!1},tables:{get:j("Transaction.tables",function(){return l(this.storeNames,function(t){return[t,Bt[t]]})})},complete:j("Transaction.complete()",function(t){return this.on("complete",t)}),error:j("Transaction.error()",function(t){return this.on("error",t)}),table:j("Transaction.table()",function(t){if(-1===this.storeNames.indexOf(t))throw new Dt.InvalidTable("Table "+t+" not in transaction");return Bt[t]})}),i(G.prototype,function(){function t(t,e,n){var r=t instanceof G?new t._ctx.collClass(t):t;return r._ctx.error=n?new n(e):new TypeError(e),r}function e(t){return new t._ctx.collClass(t,function(){return Rt.only("")}).limit(0)}function n(t,e,n,r,i,o){for(var s=Math.min(t.length,r.length),a=-1,c=0;c<s;++c){var f=e[c];if(f!==r[c])return i(t[c],n[c])<0?t.substr(0,c)+n[c]+n.substr(c+1):i(t[c],r[c])<0?t.substr(0,c)+r[c]+n.substr(c+1):a>=0?t.substr(0,a)+e[a]+n.substr(a+1):null;i(t[c],f)<0&&(a=c)}return s<r.length&&"next"===o?t+n.substr(t.length):s<t.length&&"prev"===o?t.substr(0,n.length):a<0?null:t.substr(0,a)+r[a]+n.substr(a+1)}function r(e,r,i,o){function s(t){a=function(t){return"next"===t?function(t){return t.toUpperCase()}:function(t){return t.toLowerCase()}}(t),c=function(t){return"next"===t?function(t){return t.toLowerCase()}:function(t){return t.toUpperCase()}}(t),f="next"===t?function(t,e){return t<e?-1:t===e?0:1}:function(t,e){return t>e?-1:t===e?0:1};var e=i.map(function(t){return{lower:c(t),upper:a(t)}}).sort(function(t,e){return f(t.lower,e.lower)});u=e.map(function(t){return t.upper}),h=e.map(function(t){return t.lower}),d=t,l="next"===t?"":o}var a,c,f,u,h,d,l,p=i.length;if(!i.every(function(t){return"string"==typeof t}))return t(e,se);s("next");var b=new e._ctx.collClass(e,function(){return Rt.bound(u[0],h[p-1]+o)});b._ondirectionchange=function(t){s(t)};var y=0;return b._addAlgorithm(function(t,e,i){var o=t.key;if("string"!=typeof o)return!1;var s=c(o);if(r(s,h,y))return!0;for(var a=null,b=y;b<p;++b){var m=n(o,s,u[b],h[b],f,d);null===m&&null===a?y=b+1:(null===a||f(a,m)>0)&&(a=m)}return e(null!==a?function(){t.continue(a+l)}:i),!1}),b}return{between:function(n,r,i,o){i=!1!==i,o=!0===o;try{return X(n,r)>0||0===X(n,r)&&(i||o)&&(!i||!o)?e(this):new this._ctx.collClass(this,function(){return Rt.bound(n,r,!i,!o)})}catch(e){return t(this,oe)}},equals:function(t){return new this._ctx.collClass(this,function(){return Rt.only(t)})},above:function(t){return new this._ctx.collClass(this,function(){return Rt.lowerBound(t,!0)})},aboveOrEqual:function(t){return new this._ctx.collClass(this,function(){return Rt.lowerBound(t)})},below:function(t){return new this._ctx.collClass(this,function(){return Rt.upperBound(t,!0)})},belowOrEqual:function(t){return new this._ctx.collClass(this,function(){return Rt.upperBound(t)})},startsWith:function(e){return"string"!=typeof e?t(this,se):this.between(e,e+re,!0,!0)},startsWithIgnoreCase:function(t){return""===t?this.startsWith(t):r(this,function(t,e){return 0===t.indexOf(e[0])},[t],re)},equalsIgnoreCase:function(t){return r(this,function(t,e){return t===e[0]},[t],"")},anyOfIgnoreCase:function(){var t=w.apply(At,arguments);return 0===t.length?e(this):r(this,function(t,e){return-1!==e.indexOf(t)},t,"")},startsWithAnyOfIgnoreCase:function(){var t=w.apply(At,arguments);return 0===t.length?e(this):r(this,function(t,e){return e.some(function(e){return 0===t.indexOf(e)})},t,re)},anyOf:function(){var n=w.apply(At,arguments),r=Z;try{n.sort(r)}catch(e){return t(this,oe)}if(0===n.length)return e(this);var i=new this._ctx.collClass(this,function(){return Rt.bound(n[0],n[n.length-1])});i._ondirectionchange=function(t){r="next"===t?Z:nt,n.sort(r)};var o=0;return i._addAlgorithm(function(t,e,i){for(var s=t.key;r(s,n[o])>0;)if(++o===n.length)return e(i),!1;return 0===r(s,n[o])||(e(function(){t.continue(n[o])}),!1)}),i},notEqual:function(t){return this.inAnyRange([[-1/0,t],[t,ie]],{includeLowers:!1,includeUppers:!1})},noneOf:function(){var e=w.apply(At,arguments);if(0===e.length)return new this._ctx.collClass(this);try{e.sort(Z)}catch(e){return t(this,oe)}var n=e.reduce(function(t,e){return t?t.concat([[t[t.length-1][1],e]]):[[-1/0,e]]},null);return n.push([e[e.length-1],ie]),this.inAnyRange(n,{includeLowers:!1,includeUppers:!1})},inAnyRange:function(n,r){function i(t,e){for(var n=0,r=t.length;n<r;++n){var i=t[n];if(X(e[0],i[1])<0&&X(e[1],i[0])>0){i[0]=function(t,e){return X(t,e)<0?t:e}(i[0],e[0]),i[1]=function(t,e){return X(t,e)>0?t:e}(i[1],e[1]);break}}return n===r&&t.push(e),t}function o(t,e){return u(t[0],e[0])}var s=this._ctx;if(0===n.length)return e(this);if(!n.every(function(t){return void 0!==t[0]&&void 0!==t[1]&&Z(t[0],t[1])<=0}))return t(this,"First argument to inAnyRange() must be an Array of two-value Arrays [lower,upper] where upper must not be lower than lower",Dt.InvalidArgument);var a,c=!r||!1!==r.includeLowers,f=r&&!0===r.includeUppers,u=Z;try{(a=n.reduce(i,[])).sort(o)}catch(e){return t(this,oe)}var h=0,d=f?function(t){return Z(t,a[h][1])>0}:function(t){return Z(t,a[h][1])>=0},l=c?function(t){return nt(t,a[h][0])>0}:function(t){return nt(t,a[h][0])>=0},p=d,b=new s.collClass(this,function(){return Rt.bound(a[0][0],a[a.length-1][1],!c,!f)});return b._ondirectionchange=function(t){"next"===t?(p=d,u=Z):(p=l,u=nt),a.sort(o)},b._addAlgorithm(function(t,e,n){for(var r=t.key;p(r);)if(++h===a.length)return e(n),!1;return!!function(t){return!d(t)&&!l(t)}(r)||0!==X(r,a[h][1])&&0!==X(r,a[h][0])&&(e(function(){u===Z?t.continue(a[h][0]):t.continue(a[h][1])}),!1)}),b},startsWithAnyOf:function(){var n=w.apply(At,arguments);return n.every(function(t){return"string"==typeof t})?0===n.length?e(this):this.inAnyRange(n.map(function(t){return[t,t+re]})):t(this,"startsWithAnyOf() only works with strings")}}}),i(H.prototype,function(){function e(t,e){t.filter=ot(t.filter,e)}function n(t,e,n){var r=t.replayFilter;t.replayFilter=r?function(){return ot(r(),e())}:e,t.justLimit=n&&!r}function i(t,e){if(t.isPrimKey)return e;var n=t.table.schema.idxByName[t.index];if(!n)throw new Dt.Schema("KeyPath "+t.index+" on object store "+e.name+" is not indexed");return e.index(n.name)}function o(t,e){var n=i(t,e);return t.keysOnly&&"openKeyCursor"in n?n.openKeyCursor(t.range||null,t.dir+t.unique):n.openCursor(t.range||null,t.dir+t.unique)}function s(t,e,n,i,s){var a=t.replayFilter?ot(t.filter,t.replayFilter()):t.filter;t.or?function(){function c(){2==++h&&n()}function f(t,n,o){if(!a||a(n,o,c,i)){var s=n.primaryKey.toString();r(u,s)||(u[s]=!0,e(t,n,o))}}var u={},h=0;t.or._iterate(f,c,i,s),V(o(t,s),t.algorithm,f,c,i,!t.keysOnly&&t.valueMapper)}():V(o(t,s),ot(t.algorithm,a),e,n,i,!t.keysOnly&&t.valueMapper)}function a(t){return t.table.schema.instanceTemplate}return{_read:function(t,e){var n=this._ctx;return n.error?n.table._trans(null,function(t,e){e(n.error)}):n.table._idbstore(Kt,t).then(e)},_write:function(t){var e=this._ctx;return e.error?e.table._trans(null,function(t,n){n(e.error)}):e.table._idbstore(Gt,t,"locked")},_addAlgorithm:function(t){var e=this._ctx;e.algorithm=ot(e.algorithm,t)},_iterate:function(t,e,n,r){return s(this._ctx,t,e,n,r)},clone:function(e){var n=Object.create(this.constructor.prototype),r=Object.create(this._ctx);return e&&t(r,e),n._ctx=r,n},raw:function(){return this._ctx.valueMapper=null,this},each:function(t){var e=this._ctx;if(le){var n=a(e),r=e.table.schema.primKey.keyPath,i=y(n,e.index?e.table.schema.idxByName[e.index].keyPath:r),o=y(n,r);t(n,{key:i,primaryKey:o})}return this._read(function(n,r,i){s(e,t,n,r,i)})},count:function(t){if(le)return F.resolve(0).then(t);var e=this._ctx;if(Y(e,!0))return this._read(function(t,n,r){var o=i(e,r),s=e.range?o.count(e.range):o.count();s.onerror=ft(n),s.onsuccess=function(n){t(Math.min(n.target.result,e.limit))}},t);var n=0;return this._read(function(t,r,i){s(e,function(){return++n,!1},function(){t(n)},r,i)},t)},sortBy:function(t,e){function n(t,e){return e?n(t[i[e]],e-1):t[o]}function r(t,e){var r=n(t,s),i=n(e,s);return r<i?-a:r>i?a:0}var i=t.split(".").reverse(),o=i[0],s=i.length-1,a="next"===this._ctx.dir?1:-1;return this.toArray(function(t){return t.sort(r)}).then(e)},toArray:function(t){var e=this._ctx;return this._read(function(t,n,r){if(le&&t([a(e)]),xt&&"next"===e.dir&&Y(e,!0)&&e.limit>0){var o=e.table.hook.reading.fire,c=i(e,r),f=e.limit<1/0?c.getAll(e.range,e.limit):c.getAll(e.range);f.onerror=ft(n),f.onsuccess=o===k?at(t):Q(at(function(e){try{t(e.map(o))}catch(t){n(t)}}))}else{var u=[];s(e,function(t){u.push(t)},function(){t(u)},n,r)}},t)},offset:function(t){var e=this._ctx;return t<=0?this:(e.offset+=t,Y(e)?n(e,function(){var e=t;return function(t,n){return 0===e||(1===e?(--e,!1):(n(function(){t.advance(e),e=0}),!1))}}):n(e,function(){var e=t;return function(){return--e<0}}),this)},limit:function(t){return this._ctx.limit=Math.min(this._ctx.limit,t),n(this._ctx,function(){var e=t;return function(t,n,r){return--e<=0&&n(r),e>=0}},!0),this},until:function(t,n){var r=this._ctx;return le&&t(a(r)),e(this._ctx,function(e,r,i){return!t(e.value)||(r(i),n)}),this},first:function(t){return this.limit(1).toArray(function(t){return t[0]}).then(t)},last:function(t){return this.reverse().first(t)},filter:function(t){return le&&t(a(this._ctx)),e(this._ctx,function(e){return t(e.value)}),function(t,e){t.isMatch=ot(t.isMatch,e)}(this._ctx,t),this},and:function(t){return this.filter(t)},or:function(t){return new G(this._ctx.table,t,this)},reverse:function(){return this._ctx.dir="prev"===this._ctx.dir?"next":"prev",this._ondirectionchange&&this._ondirectionchange(this._ctx.dir),this},desc:function(){return this.reverse()},eachKey:function(t){var e=this._ctx;return e.keysOnly=!e.isMatch,this.each(function(e,n){t(n.key,n)})},eachUniqueKey:function(t){return this._ctx.unique="unique",this.eachKey(t)},eachPrimaryKey:function(t){var e=this._ctx;return e.keysOnly=!e.isMatch,this.each(function(e,n){t(n.primaryKey,n)})},keys:function(t){var e=this._ctx;e.keysOnly=!e.isMatch;var n=[];return this.each(function(t,e){n.push(e.key)}).then(function(){return n}).then(t)},primaryKeys:function(t){var e=this._ctx;if(xt&&"next"===e.dir&&Y(e,!0)&&e.limit>0)return this._read(function(t,n,r){var o=i(e,r),s=e.limit<1/0?o.getAllKeys(e.range,e.limit):o.getAllKeys(e.range);s.onerror=ft(n),s.onsuccess=at(t)}).then(t);e.keysOnly=!e.isMatch;var n=[];return this.each(function(t,e){n.push(e.primaryKey)}).then(function(){return n}).then(t)},uniqueKeys:function(t){return this._ctx.unique="unique",this.keys(t)},firstKey:function(t){return this.limit(1).keys(function(t){return t[0]}).then(t)},lastKey:function(t){return this.reverse().firstKey(t)},distinct:function(){var t=this._ctx,n=t.index&&t.table.schema.idxByName[t.index];if(!n||!n.multi)return this;var i={};return e(this._ctx,function(t){var e=t.primaryKey.toString(),n=r(i,e);return i[e]=!0,!n}),this}}}),s(W).from(H).extend({modify:function(e){var n=this,i=this._ctx,o=i.table.hook,s=o.updating.fire,a=o.deleting.fire;return le&&"function"==typeof e&&e.call({value:i.table.schema.instanceTemplate},i.table.schema.instanceTemplate),this._write(function(i,o,c,f){function u(t){return t&&(M.push(t),A.push(O)),o(new L("Error modifying one or more objects",M,x,A))}function h(){E&&x+M.length===k&&(M.length>0?u():i(x))}var d;if("function"==typeof e)d=s===S&&a===S?e:function(t){var n=v(t);if(!1===e.call(this,t,this))return!1;if(r(this,"value")){var i=_(n,this.value),o=s.call(this,i,this.primKey,n,f);o&&(t=this.value,gt(o).forEach(function(e){m(t,e,o[e])}))}else a.call(this,this.primKey,t,f)};else if(s===S){var l=gt(e),p=l.length;d=function(t){for(var n=!1,r=0;r<p;++r){var i=l[r],o=e[i];y(t,i)!==o&&(m(t,i,o),n=!0)}return n}}else{var w=e;e=g(w),d=function(n){var r=!1,i=s.call(this,e,this.primKey,v(n),f);return i&&t(e,i),gt(e).forEach(function(t){var i=e[t];y(n,t)!==i&&(m(n,t,i),r=!0)}),i&&(e=g(w)),r}}var k=0,x=0,E=!1,M=[],A=[],O=null;n.clone().raw()._iterate(function(t,e){function n(t){return M.push(t),A.push(i.primKey),h(),!0}O=e.primaryKey;var i={primKey:e.primaryKey,value:t,onsuccess:null,onerror:null};if(!1!==d.call(i,t,i)){var o=!r(i,"value");++k,b(function(){var t=o?e.delete():e.update(i.value);t._hookCtx=i,t.onerror=ut(n),t.onsuccess=ct(function(){++x,h()})},n)}else i.onsuccess&&i.onsuccess(i.value)},function(){E=!0,h()},u,c)})},delete:function(){var t=this,e=this._ctx,n=e.range,r=e.table.hook.deleting.fire,i=r!==S;if(!i&&Y(e)&&(e.isPrimKey&&!ue||!n))return this._write(function(t,e,r){var i=ft(e),o=n?r.count(n):r.count();o.onerror=i,o.onsuccess=function(){var s=o.result;b(function(){var e=n?r.delete(n):r.clear();e.onerror=i,e.onsuccess=function(){return t(s)}},function(t){return e(t)})}});var o=i?2e3:1e4;return this._write(function(n,s,a,c){var f=0,u=t.clone({keysOnly:!e.isMatch&&!i}).distinct().limit(o).raw(),h=[],d=function(){return u.each(i?function(t,e){h.push([e.primaryKey,e.value])}:function(t,e){h.push(e.primaryKey)}).then(function(){return i?h.sort(function(t,e){return Z(t[0],e[0])}):h.sort(Z),z(a,c,h,i,r)}).then(function(){var t=h.length;return f+=t,h=[],t<o?f:d()})};n(d())})}}),t(this,{Collection:H,Table:T,Transaction:K,Version:a,WhereClause:G,WriteableCollection:W,WriteableTable:q}),Ht.on("versionchange",function(t){t.newVersion>0?console.warn("Another connection wants to upgrade database '"+Ht.name+"'. Closing db now to resume the upgrade."):console.warn("Another connection wants to delete database '"+Ht.name+"'. Closing db now to resume the delete request."),Ht.close()}),Ht.on("blocked",function(t){!t.newVersion||t.newVersion<t.oldVersion?console.warn("Dexie.delete('"+Ht.name+"') was blocked"):console.warn("Upgrade '"+Ht.name+"' blocked by other connection holding version "+t.oldVersion/10)}),Pt.forEach(function(t){t(Ht)})}function ot(t){if("function"==typeof t)return new t;if(vt(t))return[ot(t[0])];if(t&&"object"==typeof t){var e={};return st(e,t),e}return t}function st(t,e){return gt(e).forEach(function(n){var r=ot(e[n]);t[n]=r}),t}function at(t){return function(e){t(e.target.result)}}function ct(t){return Q(function(e){var n=e.target,r=n.result,i=n._hookCtx,o=i&&i.onsuccess;o&&o(r),t&&t(r)},t)}function ft(t){return function(e){return ht(e),t(e.target.error),!1}}function ut(t){return Q(function(e){var n=e.target,r=n.error,i=n._hookCtx,o=i&&i.onerror;return o&&o(r),ht(e),t(r),!1})}function ht(t){t.stopPropagation&&t.stopPropagation(),t.preventDefault&&t.preventDefault()}function dt(t){var e,n=it.dependencies.localStorage;if(!n)return t([]);try{e=JSON.parse(n.getItem("Dexie.DatabaseNames")||"[]")}catch(t){e=[]}t(e)&&n.setItem("Dexie.DatabaseNames",JSON.stringify(e))}function lt(t){function e(t){return function(e){var n=t(e),o=n.value;return n.done?o:o&&"function"==typeof o.then?o.then(r,i):vt(o)?F.all(o).then(r,i):r(o)}}var n=function(e){return t.next(e)},r=e(n),i=e(function(e){return t.throw(e)});return e(n)()}function pt(t,e,n,r,i,o,s){this.name=t,this.keyPath=e,this.unique=n,this.multi=r,this.auto=i,this.compound=o,this.dotted=s;var a="string"==typeof e?e:e&&"["+[].join.call(e,"+")+"]";this.src=(n?"&":"")+(r?"*":"")+(i?"++":"")+a}function bt(t,e,n,r){this.name=t,this.primKey=e||new pt,this.indexes=n||[new pt],this.instanceTemplate=r,this.mappedClass=null,this.idxByName=l(n,function(t){return[t.name,t]})}function yt(t){return 1===t.length?t[0]:t}function mt(t){var e=t&&(t.getDatabaseNames||t.webkitGetDatabaseNames);return e&&e.bind(t)}var gt=Object.keys,vt=Array.isArray,_t="undefined"!=typeof self?self:"undefined"!=typeof window?window:e,wt=Object.getPrototypeOf,St={}.hasOwnProperty,kt=Object.getOwnPropertyDescriptor,xt=[].slice,Et="undefined"!=typeof Symbol&&Symbol.iterator,Mt=Et?function(t){var e;return null!=t&&(e=t[Et])&&e.apply(t)}:function(){return null},At={},Ot=[].concat,It="undefined"!=typeof location&&/^(http|https):\/\/(localhost|127\.0\.0\.1)/.test(location.href),Pt=function(){return!0},Ct=!new Error("").stack,Nt=["Unknown","Constraint","Data","TransactionInactive","ReadOnly","Version","NotFound","InvalidState","InvalidAccess","Abort","Timeout","QuotaExceeded","Syntax","DataClone"],Rt=["Modify","Bulk","OpenFailed","VersionChange","Schema","Upgrade","InvalidTable","MissingAPI","NoSuchDatabase","InvalidArgument","SubTransaction","Unsupported","Internal","DatabaseClosed","IncompatiblePromise"].concat(Nt),jt={VersionChanged:"Database version changed by other database connection",DatabaseClosed:"Database has been closed",Abort:"Transaction aborted",TransactionInactive:"Transaction has already completed or failed"};s(T).from(Error).extend({stack:{get:function(){return this._stack||(this._stack=this.name+": "+this.message+R(this._e,2))}},toString:function(){return this.name+": "+this.message}}),s(L).from(T),s(D).from(T);var Tt=Rt.reduce(function(t,e){return t[e]=e+"Error",t},{}),Lt=T,Dt=Rt.reduce(function(t,e){function n(t,n){this._e=N(),this.name=r,t?"string"==typeof t?(this.message=t,this.inner=n||null):"object"==typeof t&&(this.message=t.name+" "+t.message,this.inner=t):(this.message=jt[e]||r,this.inner=null)}var r=e+"Error";return s(n).from(Lt),t[e]=n,t},{});Dt.Syntax=SyntaxError,Dt.Type=TypeError,Dt.Range=RangeError;var Bt=Nt.reduce(function(t,e){return t[e+"Error"]=Dt[e],t},{}),Ft=Rt.reduce(function(t,e){return-1===["Syntax","Type","Range"].indexOf(e)&&(t[e+"Error"]=Dt[e]),t},{});Ft.ModifyError=L,Ft.DexieError=T,Ft.BulkError=D;var qt={},Ut=100,zt=!1,Kt=_t.setImmediate?n.bind(null,J):_t.MutationObserver?function(){var t=document.createElement("div");new MutationObserver(function(){J(),t=null}).observe(t,{attributes:!0}),t.setAttribute("i","1")}:function(){setTimeout(J,0)},Gt=function(t,e){Zt.push([t,e]),Yt&&(Kt(),Yt=!1)},Ht=!0,Yt=!0,Wt=[],Jt=[],$t=null,Vt=k,Xt={global:!0,ref:0,unhandleds:[],onunhandled:nt,finalize:function(){this.unhandleds.forEach(function(t){try{nt(t[0],t[1])}catch(t){}})}},Zt=[],Qt=0,te=[];i(F.prototype,{then:function(t,e){var n=this,r=new F(function(r,i){G(n,new q(t,e,r,i))});return It&&(!this._prev||null===this._state)&&W(r,this),r},_then:function(t,e){G(this,new q(null,null,t,e))},catch:function(t){if(1===arguments.length)return this.then(null,t);var e=arguments[0],n=arguments[1];return"function"==typeof e?this.then(null,function(t){return t instanceof e?n(t):Z(t)}):this.then(null,function(t){return t&&t.name===e?n(t):Z(t)})},finally:function(t){return this.then(function(e){return t(),e},function(e){return t(),Z(e)})},uncaught:function(t){var e=this;return this.onuncatched=I(this.onuncatched,t),!1===this._state&&-1===Wt.indexOf(this)&&Wt.some(function(t,n,r){return t._value===e._value&&(r[n]=e)}),this},stack:{get:function(){if(this._stack)return this._stack;try{zt=!0;var t=Y(this,[],20).join("\nFrom previous: ");return null!==this._state&&(this._stack=t),t}finally{zt=!1}}}}),i(F,{all:function(){var t=w.apply(null,arguments);return new F(function(e,n){0===t.length&&e([]);var r=t.length;t.forEach(function(i,o){return F.resolve(i).then(function(n){t[o]=n,--r||e(t)},n)})})},resolve:function(t){return t instanceof F?t:t&&"function"==typeof t.then?new F(function(e,n){t.then(e,n)}):new F(qt,!0,t)},reject:Z,race:function(){var t=w.apply(null,arguments);return new F(function(e,n){t.map(function(t){return F.resolve(t).then(e,n)})})},PSD:{get:function(){return Xt},set:function(t){return Xt=t}},newPSD:tt,usePSD:et,scheduler:{get:function(){return Gt},set:function(t){Gt=t}},rejectionMapper:{get:function(){return Vt},set:function(t){Vt=t}},follow:function(t){return new F(function(e,n){return tt(function(e,n){var r=Xt;r.unhandleds=[],r.onunhandled=n,r.finalize=E(function(){var t=this;!function(t){function e(){t(),te.splice(te.indexOf(e),1)}te.push(e),++Qt,Gt(function(){0==--Qt&&X()},[])}(function(){0===t.unhandleds.length?e():n(t.unhandleds[0])})},r.finalize),t()},e,n)})},on:B(null,{error:[I,function(t){console.warn("Unhandled rejection: "+(t.stack||t))}]})});var ee=F.on.error;ee.subscribe=j("Promise.on('error')",ee.subscribe),ee.unsubscribe=j("Promise.on('error').unsubscribe",ee.unsubscribe);var ne="unhandledrejection";u(function(){Gt=function(t,e){setTimeout(function(){t.apply(null,e)},0)}});var re=String.fromCharCode(65535),ie=function(){try{return IDBKeyRange.only([[]]),[[]]}catch(t){return re}}(),oe="Invalid key provided. Keys must be of type string, number, Date or Array<string | number | Date>.",se="String expected.",ae=[],ce="undefined"!=typeof navigator&&/(MSIE|Trident|Edge)/.test(navigator.userAgent),fe=ce,ue=ce,he=function(t){return!/(dexie\.js|dexie\.min\.js)/.test(t)};C(It,he);var de=function(){},le=!1,pe=_t.idbModules&&_t.idbModules.shimIndexedDB?_t.idbModules:{};return i(it,Ft),i(it,{delete:function(t){var e=new it(t),n=e.delete();return n.onblocked=function(t){return e.on("blocked",t),this},n},exists:function(t){return new it(t).open().then(function(t){return t.close(),!0}).catch(it.NoSuchDatabaseError,function(){return!1})},getDatabaseNames:function(t){return new F(function(t,e){var n=mt(indexedDB);if(n){var r=n();r.onsuccess=function(e){t(c(e.target.result,0))},r.onerror=ft(e)}else dt(function(e){return t(e),!1})}).then(t)},defineClass:function(e){return function(n){n?t(this,n):le&&st(this,e)}},applyStructure:st,ignoreTransaction:function(t){return Xt.trans?et(Xt.transless,t):t()},vip:function(t){return tt(function(){return Xt.letThrough=!0,t()})},async:function(t){return function(){try{var e=lt(t.apply(this,arguments));return e&&"function"==typeof e.then?e:F.resolve(e)}catch(t){return rt(t)}}},spawn:function(t,e,n){try{var r=lt(t.apply(n,e||[]));return r&&"function"==typeof r.then?r:F.resolve(r)}catch(t){return rt(t)}},currentTransaction:{get:function(){return Xt.trans||null}},Promise:F,debug:{get:function(){return It},set:function(t){C(t,"dexie"===t?function(){return!0}:he)}},derive:s,extend:t,props:i,override:f,Events:B,events:{get:j(function(){return B})},getByKeyPath:y,setByKeyPath:m,delByKeyPath:function(t,e){"string"==typeof e?m(t,e,void 0):"length"in e&&[].map.call(e,function(e){m(t,e,void 0)})},shallowClone:g,deepClone:v,getObjectDiff:_,asap:d,maxKey:ie,addons:[],connections:ae,MultiModifyError:Dt.Modify,errnames:Tt,IndexSpec:pt,TableSchema:bt,dependencies:{indexedDB:pe.shimIndexedDB||_t.indexedDB||_t.mozIndexedDB||_t.webkitIndexedDB||_t.msIndexedDB,IDBKeyRange:pe.IDBKeyRange||_t.IDBKeyRange||_t.webkitIDBKeyRange},semVer:"1.5.1",version:"1.5.1".split(".").map(function(t){return parseInt(t)}).reduce(function(t,e,n){return t+e/Math.pow(10,2*n)}),fakeAutoComplete:de,default:it}),b(function(){it.dependencies.localStorage=null!=("undefined"!=typeof chrome&&null!==chrome?chrome.storage:void 0)?null:_t.localStorage}),F.rejectionMapper=function(t,e){if(!t||t instanceof T||t instanceof TypeError||t instanceof SyntaxError||!t.name||!Bt[t.name])return t;var n=new Bt[t.name](e||t.message,t);return"stack"in t&&o(n,"stack",{get:function(){return this.inner.stack}}),n},u(function(){it.fakeAutoComplete=de=u,it.fake=le=!0}),it})}).call(e,n(3),n(11).setImmediate)},function(t,e,n){var r=n(101);t.exports=function(t,e,n,i){function o(f){function u(){if(!d){var e=h;h=null,d=!0,l=0,t(e,function(t){d=!1,!0!==s||l?s&&!0!==s?(i(s),a&&a()):t?f(s=!!t.abort||t,i):l?u():b():i(t)})}}var h=null,d=!1,l=0;if(c=f,s)return f(!!s.abort||s,function(t){i(t),a&&a()});var p=!1,b=r(function(){p||s||(p=!0,f(null,function(t,r){p=!1,function(r,o){s||((s=t)?d||i(!0===s?null:s):(h=e(h,o),l=h&&h.length||0,null!=h&&u(),l<n&&b()))}(0,r)}))});o.abort=function(t){a=function(e){t&&t()};var e=new Error("aborted");e.abort=!0,f(s=e,function(t){t=!0===t?null:t,d||(i&&i(t),a&&a(t))})},b()}e=e||function(t,e){return(t=t||[]).push(e),t};var s,a,c;return o.abort=function(t){s=new Error("aborted before connecting"),a=function(e){t&&t()}},o}},function(t,e){t.exports=function(t){var e=!1,n=0;return function(){if(n=!0,!e){for(e=!0;n;)n=!1,t();e=!1}}}},function(t,e,n){(function(e){var r=n(103).strict;t.exports=function(t){if(r(t)){var n=new e(t.buffer);return t.byteLength!==t.buffer.byteLength&&(n=n.slice(t.byteOffset,t.byteOffset+t.byteLength)),n}return new e(t)}}).call(e,n(1).Buffer)},function(t,e){function n(t){return r(t)||i(t)}function r(t){return t instanceof Int8Array||t instanceof Int16Array||t instanceof Int32Array||t instanceof Uint8Array||t instanceof Uint8ClampedArray||t instanceof Uint16Array||t instanceof Uint32Array||t instanceof Float32Array||t instanceof Float64Array}function i(t){return s[o.call(t)]}t.exports=n,n.strict=r,n.loose=i;var o=Object.prototype.toString,s={"[object Int8Array]":!0,"[object Int16Array]":!0,"[object Int32Array]":!0,"[object Uint8Array]":!0,"[object Uint8ClampedArray]":!0,"[object Uint16Array]":!0,"[object Uint32Array]":!0,"[object Float32Array]":!0,"[object Float64Array]":!0}},function(t,e){t.exports=function(t){function e(e){if(!e)throw new Error("must be passed a readable");n=e,r&&t(n)}var n,r=!1;Math.random();return e.resolve=e.ready=e.start=function(i){return r=!0,t=i||t,n&&t(n),e},e}},function(t,e,n){var r=n(106),i=t.exports=function(t,e){return function(n){e=e||function(t,e){return{start:t,data:e}};var i=[],o=[],s=null,a=0;return function(c,f){if(o.length)return f(null,o.shift());if(s)return f(s);a++;n(c,r(function(r,a){var c,u=!1;return r&&(s=r),s||(c=t(a,function(t,n){u||(u=!0,delete i[i.indexOf(c)],o.push(e(a,n)))})),c?i.push(c):u=!0,i.forEach(function(t,e){t(r,a)}),o.length?f(null,o.shift()):s?f(s):void n(null,this)}))}}};i.recent=function(t,e){var n=null;return i(function(r,i){function o(){var t=n;n=null,clearTimeout(s),i(null,t)}if(!n){n=[];var s;return e&&(s=setTimeout(o,e)),function(e,r){if(e)return o();n.push(r),null!=t&&n.length>=t&&o()}}},function(t,e){return e})},i.sliding=function(t,e){e=e||10;var n=0;return i(function(r,i){var o,s=0;n++;return function(n,r){n||(o=t(o,r),e<=++s&&i(null,o))}})}},function(t,e){t.exports=function(t){return function e(n,r,i){var o=!0,s=!1;do{s=!0,o=!1,t.call(function(t,a,c){s?(n=t,r=a,i=c,o=!0):e(t,a,c)},n,r,i),s=!1}while(o)}}},function(t,e,n){(function(e){t.exports=function(){function t(t,e){return function(r){return function(){n(t,e),r&&r.apply(null,arguments)}}}function n(e,n){var r=a[e].indexOf(n);~r&&(a[e].splice(r,1),o(e)?s(function(){a[e][0](t(e,a[e][0]))}):delete a[e])}function r(t,e){return o(t)?(a[t].push(e),!1):(a[t]=[e],!0)}function i(e,i){if(Array.isArray(e)){var o=e.length,s={};function a(t){return function(){var e=[].slice.call(arguments);for(var r in s)n(r,s[r]);t.apply(this,e)}}e.forEach(function(t){function e(){n++||--o||i(a)}var n=0;s[t]=e,r(t,e)&&e()})}else r(e,i)&&i(t(e,i))}function o(t){return!!Array.isArray(a[t])&&!!a[t].length}var s=void 0===e?setTimeout:e,a={};return i.isLocked=o,i}}).call(e,n(11).setImmediate)},function(t,e,n){(function(e){function r(t,n,a,c){"function"==typeof n?(a=n,n={}):n&&"object"==typeof n||(n={mode:n});var f=n.mode,u=n.fs||o;void 0===f&&(f=s&~e.umask()),c||(c=null);var h=a||function(){};t=i.resolve(t),u.mkdir(t,f,function(e){if(!e)return c=c||t,h(null,c);switch(e.code){case"ENOENT":r(i.dirname(t),n,function(e,i){e?h(e,i):r(t,n,h,i)});break;default:u.stat(t,function(t,n){t||!n.isDirectory()?h(e,c):h(null,c)})}})}var i=n(12),o=n(17),s=parseInt("0777",8);t.exports=r.mkdirp=r.mkdirP=r,r.sync=function t(n,r,a){r&&"object"==typeof r||(r={mode:r});var c=r.mode,f=r.fs||o;void 0===c&&(c=s&~e.umask()),a||(a=null),n=i.resolve(n);try{f.mkdirSync(n,c),a=a||n}catch(e){switch(e.code){case"ENOENT":t(n,r,a=t(i.dirname(n),r,a));break;default:var u;try{u=f.statSync(n)}catch(t){throw e}if(!u.isDirectory())throw e}}return a}}).call(e,n(0))},function(t,e){t.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(t,e,n){"use strict";var r=e,i=n(7),o=n(9),s=n(51);r.assert=o,r.toArray=s.toArray,r.zero2=s.zero2,r.toHex=s.toHex,r.encode=s.encode,r.getNAF=function(t,e){for(var n=[],r=1<<e+1,i=t.clone();i.cmpn(1)>=0;){var o;if(i.isOdd()){var s=i.andln(r-1);o=s>(r>>1)-1?(r>>1)-s:s,i.isubn(o)}else o=0;n.push(o);for(var a=0!==i.cmpn(0)&&0===i.andln(r-1)?e+1:1,c=1;c<a;c++)n.push(0);i.iushrn(a)}return n},r.getJSF=function(t,e){var n=[[],[]];t=t.clone(),e=e.clone();for(var r=0,i=0;t.cmpn(-r)>0||e.cmpn(-i)>0;){var o=t.andln(3)+r&3,s=e.andln(3)+i&3;3===o&&(o=-1),3===s&&(s=-1);var a;a=0==(1&o)?0:3!=(f=t.andln(7)+r&7)&&5!==f||2!==s?o:-o,n[0].push(a);var c;if(0==(1&s))c=0;else{var f=e.andln(7)+i&7;c=3!==f&&5!==f||2!==o?s:-s}n[1].push(c),2*r===a+1&&(r=1-r),2*i===c+1&&(i=1-i),t.iushrn(1),e.iushrn(1)}return n},r.cachedProperty=function(t,e,n){var r="_"+e;t.prototype[e]=function(){return void 0!==this[r]?this[r]:this[r]=n.call(this)}},r.parseBytes=function(t){return"string"==typeof t?r.toArray(t,"hex"):t},r.intFromLE=function(t){return new i(t,"hex","le")}},function(t,e){},function(t,e,n){function r(t){this.rand=t}var i;if(t.exports=function(t){return i||(i=new r(null)),i.generate(t)},t.exports.Rand=r,r.prototype.generate=function(t){return this._rand(t)},r.prototype._rand=function(t){if(this.rand.getBytes)return this.rand.getBytes(t);for(var e=new Uint8Array(t),n=0;n<e.length;n++)e[n]=this.rand.getByte();return e},"object"==typeof self)self.crypto&&self.crypto.getRandomValues?r.prototype._rand=function(t){var e=new Uint8Array(t);return self.crypto.getRandomValues(e),e}:self.msCrypto&&self.msCrypto.getRandomValues?r.prototype._rand=function(t){var e=new Uint8Array(t);return self.msCrypto.getRandomValues(e),e}:"object"==typeof window&&(r.prototype._rand=function(){throw new Error("Not implemented yet")});else try{var o=n(113);if("function"!=typeof o.randomBytes)throw new Error("Not supported");r.prototype._rand=function(t){return o.randomBytes(t)}}catch(t){}},function(t,e){},function(t,e,n){"use strict";function r(t,e){this.type=t,this.p=new o(e.p,16),this.red=e.prime?o.red(e.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=e.n&&new o(e.n,16),this.g=e.g&&this.pointFromJSON(e.g,e.gRed),this._wnafT1=new Array(4),this._wnafT2=new Array(4),this._wnafT3=new Array(4),this._wnafT4=new Array(4);var n=this.n&&this.p.div(this.n);!n||n.cmpn(100)>0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}function i(t,e){this.curve=t,this.type=e,this.precomputed=null}var o=n(7),s=n(2).utils,a=s.getNAF,c=s.getJSF,f=s.assert;t.exports=r,r.prototype.point=function(){throw new Error("Not implemented")},r.prototype.validate=function(){throw new Error("Not implemented")},r.prototype._fixedNafMul=function(t,e){f(t.precomputed);var n=t._getDoubles(),r=a(e,1),i=(1<<n.step+1)-(n.step%2==0?2:1);i/=3;for(var o=[],s=0;s<r.length;s+=n.step){for(var c=0,e=s+n.step-1;e>=s;e--)c=(c<<1)+r[e];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(n.points[s]):c===-d&&(h=h.mixedAdd(n.points[s].neg()))}u=u.add(h)}return u.toP()},r.prototype._wnafMul=function(t,e){var n=4,r=t._getNAFPoints(n);n=r.wnd;for(var i=r.points,o=a(e,n),s=this.jpoint(null,null,null),c=o.length-1;c>=0;c--){for(e=0;c>=0&&0===o[c];c--)e++;if(c>=0&&e++,s=s.dblp(e),c<0)break;var u=o[c];f(0!==u),s="affine"===t.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"===t.type?s.toP():s},r.prototype._wnafMulAdd=function(t,e,n,r,i){for(var o=this._wnafT1,s=this._wnafT2,f=this._wnafT3,u=0,h=0;h<r;h++){var d=(E=e[h])._getNAFPoints(t);o[h]=d.wnd,s[h]=d.points}for(h=r-1;h>=1;h-=2){var l=h-1,p=h;if(1===o[l]&&1===o[p]){var b=[e[l],null,null,e[p]];0===e[l].y.cmp(e[p].y)?(b[1]=e[l].add(e[p]),b[2]=e[l].toJ().mixedAdd(e[p].neg())):0===e[l].y.cmp(e[p].y.redNeg())?(b[1]=e[l].toJ().mixedAdd(e[p]),b[2]=e[l].add(e[p].neg())):(b[1]=e[l].toJ().mixedAdd(e[p]),b[2]=e[l].toJ().mixedAdd(e[p].neg()));var y=[-3,-1,-5,-7,0,7,5,1,3],m=c(n[l],n[p]);u=Math.max(m[0].length,u),f[l]=new Array(u),f[p]=new Array(u);for(x=0;x<u;x++){var g=0|m[0][x],v=0|m[1][x];f[l][x]=y[3*(g+1)+(v+1)],f[p][x]=0,s[l]=b}}else f[l]=a(n[l],o[l]),f[p]=a(n[p],o[p]),u=Math.max(f[l].length,u),u=Math.max(f[p].length,u)}for(var _=this.jpoint(null,null,null),w=this._wnafT4,h=u;h>=0;h--){for(var S=0;h>=0;){for(var k=!0,x=0;x<r;x++)w[x]=0|f[x][h],0!==w[x]&&(k=!1);if(!k)break;S++,h--}if(h>=0&&S++,_=_.dblp(S),h<0)break;for(x=0;x<r;x++){var E,M=w[x];0!==M&&(M>0?E=s[x][M-1>>1]:M<0&&(E=s[x][-M-1>>1].neg()),_="affine"===E.type?_.mixedAdd(E):_.add(E))}}for(h=0;h<r;h++)s[h]=null;return i?_:_.toP()},r.BasePoint=i,i.prototype.eq=function(){throw new Error("Not implemented")},i.prototype.validate=function(){return this.curve.validate(this)},r.prototype.decodePoint=function(t,e){t=s.toArray(t,e);var n=this.p.byteLength();if((4===t[0]||6===t[0]||7===t[0])&&t.length-1==2*n){6===t[0]?f(t[t.length-1]%2==0):7===t[0]&&f(t[t.length-1]%2==1);return this.point(t.slice(1,1+n),t.slice(1+n,1+2*n))}if((2===t[0]||3===t[0])&&t.length-1===n)return this.pointFromX(t.slice(1,1+n),3===t[0]);throw new Error("Unknown point format")},i.prototype.encodeCompressed=function(t){return this.encode(t,!0)},i.prototype._encode=function(t){var e=this.curve.p.byteLength(),n=this.getX().toArray("be",e);return t?[this.getY().isEven()?2:3].concat(n):[4].concat(n,this.getY().toArray("be",e))},i.prototype.encode=function(t,e){return s.encode(this._encode(e),t)},i.prototype.precompute=function(t){if(this.precomputed)return this;var e={doubles:null,naf:null,beta:null};return e.naf=this._getNAFPoints(8),e.doubles=this._getDoubles(4,t),e.beta=this._getBeta(),this.precomputed=e,this},i.prototype._hasDoubles=function(t){if(!this.precomputed)return!1;var e=this.precomputed.doubles;return!!e&&e.points.length>=Math.ceil((t.bitLength()+1)/e.step)},i.prototype._getDoubles=function(t,e){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var n=[this],r=this,i=0;i<e;i+=t){for(var o=0;o<t;o++)r=r.dbl();n.push(r)}return{step:t,points:n}},i.prototype._getNAFPoints=function(t){if(this.precomputed&&this.precomputed.naf)return this.precomputed.naf;for(var e=[this],n=(1<<t)-1,r=1===n?null:this.dbl(),i=1;i<n;i++)e[i]=e[i-1].add(r);return{wnd:t,points:e}},i.prototype._getBeta=function(){return null},i.prototype.dblp=function(t){for(var e=this,n=0;n<t;n++)e=e.dbl();return e}},function(t,e,n){"use strict";function r(t){u.call(this,"short",t),this.a=new c(t.a,16).toRed(this.red),this.b=new c(t.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(t),this._endoWnafT1=new Array(4),this._endoWnafT2=new Array(4)}function i(t,e,n,r){u.BasePoint.call(this,t,"affine"),null===e&&null===n?(this.x=null,this.y=null,this.inf=!0):(this.x=new c(e,16),this.y=new c(n,16),r&&(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(t,e,n,r){u.BasePoint.call(this,t,"jacobian"),null===e&&null===n&&null===r?(this.x=this.curve.one,this.y=this.curve.one,this.z=new c(0)):(this.x=new c(e,16),this.y=new c(n,16),this.z=new c(r,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=n(23),a=n(2),c=n(7),f=n(5),u=s.base,h=a.utils.assert;f(r,u),t.exports=r,r.prototype._getEndomorphism=function(t){if(this.zeroA&&this.g&&this.n&&1===this.p.modn(3)){var e,n;if(t.beta)e=new c(t.beta,16).toRed(this.red);else{var r=this._getEndoRoots(this.p);e=(e=r[0].cmp(r[1])<0?r[0]:r[1]).toRed(this.red)}if(t.lambda)n=new c(t.lambda,16);else{var i=this._getEndoRoots(this.n);0===this.g.mul(i[0]).x.cmp(this.g.x.redMul(e))?n=i[0]:(n=i[1],h(0===this.g.mul(n).x.cmp(this.g.x.redMul(e))))}var o;return o=t.basis?t.basis.map(function(t){return{a:new c(t.a,16),b:new c(t.b,16)}}):this._getEndoBasis(n),{beta:e,lambda:n,basis:o}}},r.prototype._getEndoRoots=function(t){var e=t===this.p?this.red:c.mont(t),n=new c(2).toRed(e).redInvm(),r=n.redNeg(),i=new c(3).toRed(e).redNeg().redSqrt().redMul(n);return[r.redAdd(i).fromRed(),r.redSub(i).fromRed()]},r.prototype._getEndoBasis=function(t){for(var e,n,r,i,o,s,a,f,u,h=this.n.ushrn(Math.floor(this.n.bitLength()/2)),d=t,l=this.n.clone(),p=new c(1),b=new c(0),y=new c(0),m=new c(1),g=0;0!==d.cmpn(0);){var v=l.div(d);f=l.sub(v.mul(d)),u=y.sub(v.mul(p));var _=m.sub(v.mul(b));if(!r&&f.cmp(h)<0)e=a.neg(),n=p,r=f.neg(),i=u;else if(r&&2==++g)break;a=f,l=d,d=f,y=p,p=u,m=b,b=_}o=f.neg(),s=u;var w=r.sqr().add(i.sqr());return o.sqr().add(s.sqr()).cmp(w)>=0&&(o=e,s=n),r.negative&&(r=r.neg(),i=i.neg()),o.negative&&(o=o.neg(),s=s.neg()),[{a:r,b:i},{a:o,b:s}]},r.prototype._endoSplit=function(t){var e=this.endo.basis,n=e[0],r=e[1],i=r.b.mul(t).divRound(this.n),o=n.b.neg().mul(t).divRound(this.n),s=i.mul(n.a),a=o.mul(r.a),c=i.mul(n.b),f=o.mul(r.b);return{k1:t.sub(s).sub(a),k2:c.add(f).neg()}},r.prototype.pointFromX=function(t,e){(t=new c(t,16)).red||(t=t.toRed(this.red));var n=t.redSqr().redMul(t).redIAdd(t.redMul(this.a)).redIAdd(this.b),r=n.redSqrt();if(0!==r.redSqr().redSub(n).cmp(this.zero))throw new Error("invalid point");var i=r.fromRed().isOdd();return(e&&!i||!e&&i)&&(r=r.redNeg()),this.point(t,r)},r.prototype.validate=function(t){if(t.inf)return!0;var e=t.x,n=t.y,r=this.a.redMul(e),i=e.redSqr().redMul(e).redIAdd(r).redIAdd(this.b);return 0===n.redSqr().redISub(i).cmpn(0)},r.prototype._endoWnafMulAdd=function(t,e,n){for(var r=this._endoWnafT1,i=this._endoWnafT2,o=0;o<t.length;o++){var s=this._endoSplit(e[o]),a=t[o],c=a._getBeta();s.k1.negative&&(s.k1.ineg(),a=a.neg(!0)),s.k2.negative&&(s.k2.ineg(),c=c.neg(!0)),r[2*o]=a,r[2*o+1]=c,i[2*o]=s.k1,i[2*o+1]=s.k2}for(var f=this._wnafMulAdd(1,r,i,2*o,n),u=0;u<2*o;u++)r[u]=null,i[u]=null;return f},f(i,u.BasePoint),r.prototype.point=function(t,e,n){return new i(this,t,e,n)},r.prototype.pointFromJSON=function(t,e){return i.fromJSON(this,t,e)},i.prototype._getBeta=function(){if(this.curve.endo){var t=this.precomputed;if(t&&t.beta)return t.beta;var e=this.curve.point(this.x.redMul(this.curve.endo.beta),this.y);if(t){var n=this.curve,r=function(t){return n.point(t.x.redMul(n.endo.beta),t.y)};t.beta=e,e.precomputed={beta:null,naf:t.naf&&{wnd:t.naf.wnd,points:t.naf.points.map(r)},doubles:t.doubles&&{step:t.doubles.step,points:t.doubles.points.map(r)}}}return e}},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(t,e,n){function r(e){return t.point(e[0],e[1],n)}"string"==typeof e&&(e=JSON.parse(e));var i=t.point(e[0],e[1],n);if(!e[2])return i;var o=e[2];return i.precomputed={beta:null,doubles:o.doubles&&{step:o.doubles.step,points:[i].concat(o.doubles.points.map(r))},naf:o.naf&&{wnd:o.naf.wnd,points:[i].concat(o.naf.points.map(r))}},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(t){if(this.inf)return t;if(t.inf)return this;if(this.eq(t))return this.dbl();if(this.neg().eq(t))return this.curve.point(null,null);if(0===this.x.cmp(t.x))return this.curve.point(null,null);var e=this.y.redSub(t.y);0!==e.cmpn(0)&&(e=e.redMul(this.x.redSub(t.x).redInvm()));var n=e.redSqr().redISub(this.x).redISub(t.x),r=e.redMul(this.x.redSub(n)).redISub(this.y);return this.curve.point(n,r)},i.prototype.dbl=function(){if(this.inf)return this;var t=this.y.redAdd(this.y);if(0===t.cmpn(0))return this.curve.point(null,null);var e=this.curve.a,n=this.x.redSqr(),r=t.redInvm(),i=n.redAdd(n).redIAdd(n).redIAdd(e).redMul(r),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(t){return t=new c(t,16),this._hasDoubles(t)?this.curve._fixedNafMul(this,t):this.curve.endo?this.curve._endoWnafMulAdd([this],[t]):this.curve._wnafMul(this,t)},i.prototype.mulAdd=function(t,e,n){var r=[this,e],i=[t,n];return this.curve.endo?this.curve._endoWnafMulAdd(r,i):this.curve._wnafMulAdd(1,r,i,2)},i.prototype.jmulAdd=function(t,e,n){var r=[this,e],i=[t,n];return this.curve.endo?this.curve._endoWnafMulAdd(r,i,!0):this.curve._wnafMulAdd(1,r,i,2,!0)},i.prototype.eq=function(t){return this===t||this.inf===t.inf&&(this.inf||0===this.x.cmp(t.x)&&0===this.y.cmp(t.y))},i.prototype.neg=function(t){if(this.inf)return this;var e=this.curve.point(this.x,this.y.redNeg());if(t&&this.precomputed){var n=this.precomputed,r=function(t){return t.neg()};e.precomputed={naf:n.naf&&{wnd:n.naf.wnd,points:n.naf.points.map(r)},doubles:n.doubles&&{step:n.doubles.step,points:n.doubles.points.map(r)}}}return e},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),r.prototype.jpoint=function(t,e,n){return new o(this,t,e,n)},o.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var t=this.z.redInvm(),e=t.redSqr(),n=this.x.redMul(e),r=this.y.redMul(e).redMul(t);return this.curve.point(n,r)},o.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},o.prototype.add=function(t){if(this.isInfinity())return t;if(t.isInfinity())return this;var e=t.z.redSqr(),n=this.z.redSqr(),r=this.x.redMul(e),i=t.x.redMul(n),o=this.y.redMul(e.redMul(t.z)),s=t.y.redMul(n.redMul(this.z)),a=r.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=r.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(t.z).redMul(a);return this.curve.jpoint(d,l,p)},o.prototype.mixedAdd=function(t){if(this.isInfinity())return t.toJ();if(t.isInfinity())return this;var e=this.z.redSqr(),n=this.x,r=t.x.redMul(e),i=this.y,o=t.y.redMul(e).redMul(this.z),s=n.redSub(r),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=n.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(t){if(0===t)return this;if(this.isInfinity())return this;if(!t)return this.dbl();if(this.curve.zeroA||this.curve.threeA){for(var e=this,n=0;n<t;n++)e=e.dbl();return e}for(var r=this.curve.a,i=this.curve.tinv,o=this.x,s=this.y,a=this.z,c=a.redSqr().redSqr(),f=s.redAdd(s),n=0;n<t;n++){var u=o.redSqr(),h=f.redSqr(),d=h.redSqr(),l=u.redAdd(u).redIAdd(u).redIAdd(r.redMul(c)),p=o.redMul(h),b=l.redSqr().redISub(p.redAdd(p)),y=p.redISub(b),m=l.redMul(y);m=m.redIAdd(m).redISub(d);var g=f.redMul(a);n+1<t&&(c=c.redMul(d)),o=b,a=g,f=m}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 t,e,n;if(this.zOne){var r=this.x.redSqr(),i=this.y.redSqr(),o=i.redSqr(),s=this.x.redAdd(i).redSqr().redISub(r).redISub(o);s=s.redIAdd(s);var a=r.redAdd(r).redIAdd(r),c=a.redSqr().redISub(s).redISub(s),f=o.redIAdd(o);f=(f=f.redIAdd(f)).redIAdd(f),t=c,e=a.redMul(s.redISub(c)).redISub(f),n=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),t=b.redISub(l).redISub(l),e=p.redMul(l.redISub(t)).redISub(y),n=(n=this.y.redMul(this.z)).redIAdd(n)}return this.curve.jpoint(t,e,n)},o.prototype._threeDbl=function(){var t,e,n;if(this.zOne){var r=this.x.redSqr(),i=this.y.redSqr(),o=i.redSqr(),s=this.x.redAdd(i).redSqr().redISub(r).redISub(o);s=s.redIAdd(s);var a=r.redAdd(r).redIAdd(r).redIAdd(this.curve.a),c=a.redSqr().redISub(s).redISub(s);t=c;var f=o.redIAdd(o);f=(f=f.redIAdd(f)).redIAdd(f),e=a.redMul(s.redISub(c)).redISub(f),n=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);t=l.redSqr().redISub(b),n=this.y.redAdd(this.z).redSqr().redISub(h).redISub(u);var y=h.redSqr();y=(y=(y=y.redIAdd(y)).redIAdd(y)).redIAdd(y),e=l.redMul(p.redISub(t)).redISub(y)}return this.curve.jpoint(t,e,n)},o.prototype._dbl=function(){var t=this.curve.a,e=this.x,n=this.y,r=this.z,i=r.redSqr().redSqr(),o=e.redSqr(),s=n.redSqr(),a=o.redAdd(o).redIAdd(o).redIAdd(t.redMul(i)),c=e.redAdd(e),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=n.redAdd(n).redMul(r);return this.curve.jpoint(u,l,p)},o.prototype.trpl=function(){if(!this.curve.zeroA)return this.dbl().add(this);var t=this.x.redSqr(),e=this.y.redSqr(),n=this.z.redSqr(),r=e.redSqr(),i=t.redAdd(t).redIAdd(t),o=i.redSqr(),s=this.x.redAdd(e).redSqr().redISub(t).redISub(r),a=(s=(s=(s=s.redIAdd(s)).redAdd(s).redIAdd(s)).redISub(o)).redSqr(),c=r.redIAdd(r);c=(c=(c=c.redIAdd(c)).redIAdd(c)).redIAdd(c);var f=i.redIAdd(s).redSqr().redISub(o).redISub(a).redISub(c),u=e.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(n).redISub(a);return this.curve.jpoint(h,d,l)},o.prototype.mul=function(t,e){return t=new c(t,e),this.curve._wnafMul(this,t)},o.prototype.eq=function(t){if("affine"===t.type)return this.eq(t.toJ());if(this===t)return!0;var e=this.z.redSqr(),n=t.z.redSqr();if(0!==this.x.redMul(n).redISub(t.x.redMul(e)).cmpn(0))return!1;var r=e.redMul(this.z),i=n.redMul(t.z);return 0===this.y.redMul(i).redISub(t.y.redMul(r)).cmpn(0)},o.prototype.eqXToP=function(t){var e=this.z.redSqr(),n=t.toRed(this.curve.red).redMul(e);if(0===this.x.cmp(n))return!0;for(var r=t.clone(),i=this.curve.redN.redMul(e);;){if(r.iadd(this.curve.n),r.cmp(this.curve.p)>=0)return!1;if(n.redIAdd(i),0===this.x.cmp(n))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(t,e,n){"use strict";function r(t){c.call(this,"mont",t),this.a=new s(t.a,16).toRed(this.red),this.b=new s(t.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(t,e,n){c.BasePoint.call(this,t,"projective"),null===e&&null===n?(this.x=this.curve.one,this.z=this.curve.zero):(this.x=new s(e,16),this.z=new s(n,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=n(23),s=n(7),a=n(5),c=o.base,f=n(2).utils;a(r,c),t.exports=r,r.prototype.validate=function(t){var e=t.normalize().x,n=e.redSqr(),r=n.redMul(e).redAdd(n.redMul(this.a)).redAdd(e);return 0===r.redSqrt().redSqr().cmp(r)},a(i,c.BasePoint),r.prototype.decodePoint=function(t,e){return this.point(f.toArray(t,e),1)},r.prototype.point=function(t,e){return new i(this,t,e)},r.prototype.pointFromJSON=function(t){return i.fromJSON(this,t)},i.prototype.precompute=function(){},i.prototype._encode=function(){return this.getX().toArray("be",this.curve.p.byteLength())},i.fromJSON=function(t,e){return new i(t,e[0],e[1]||t.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 t=this.x.redAdd(this.z).redSqr(),e=this.x.redSub(this.z).redSqr(),n=t.redSub(e),r=t.redMul(e),i=n.redMul(e.redAdd(this.curve.a24.redMul(n)));return this.curve.point(r,i)},i.prototype.add=function(){throw new Error("Not supported on Montgomery curve")},i.prototype.diffAdd=function(t,e){var n=this.x.redAdd(this.z),r=this.x.redSub(this.z),i=t.x.redAdd(t.z),o=t.x.redSub(t.z).redMul(n),s=i.redMul(r),a=e.z.redMul(o.redAdd(s).redSqr()),c=e.x.redMul(o.redISub(s).redSqr());return this.curve.point(a,c)},i.prototype.mul=function(t){for(var e=t.clone(),n=this,r=this.curve.point(null,null),i=this,o=[];0!==e.cmpn(0);e.iushrn(1))o.push(e.andln(1));for(var s=o.length-1;s>=0;s--)0===o[s]?(n=n.diffAdd(r,i),r=r.dbl()):(r=n.diffAdd(r,i),n=n.dbl());return r},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(t){return 0===this.getX().cmp(t.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(t,e,n){"use strict";function r(t){this.twisted=1!=(0|t.a),this.mOneA=this.twisted&&-1==(0|t.a),this.extended=this.mOneA,f.call(this,"edwards",t),this.a=new a(t.a,16).umod(this.red.m),this.a=this.a.toRed(this.red),this.c=new a(t.c,16).toRed(this.red),this.c2=this.c.redSqr(),this.d=new a(t.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|t.c)}function i(t,e,n,r,i){f.BasePoint.call(this,t,"projective"),null===e&&null===n&&null===r?(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(e,16),this.y=new a(n,16),this.z=r?new a(r,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=n(23),s=n(2),a=n(7),c=n(5),f=o.base,u=s.utils.assert;c(r,f),t.exports=r,r.prototype._mulA=function(t){return this.mOneA?t.redNeg():this.a.redMul(t)},r.prototype._mulC=function(t){return this.oneC?t:this.c.redMul(t)},r.prototype.jpoint=function(t,e,n,r){return this.point(t,e,n,r)},r.prototype.pointFromX=function(t,e){(t=new a(t,16)).red||(t=t.toRed(this.red));var n=t.redSqr(),r=this.c2.redSub(this.a.redMul(n)),i=this.one.redSub(this.c2.redMul(this.d).redMul(n)),o=r.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(e&&!c||!e&&c)&&(s=s.redNeg()),this.point(t,s)},r.prototype.pointFromY=function(t,e){(t=new a(t,16)).red||(t=t.toRed(this.red));var n=t.redSqr(),r=n.redSub(this.one),i=n.redMul(this.d).redAdd(this.one),o=r.redMul(i.redInvm());if(0===o.cmp(this.zero)){if(e)throw new Error("invalid point");return this.point(this.zero,t)}var s=o.redSqrt();if(0!==s.redSqr().redSub(o).cmp(this.zero))throw new Error("invalid point");return s.isOdd()!==e&&(s=s.redNeg()),this.point(s,t)},r.prototype.validate=function(t){if(t.isInfinity())return!0;t.normalize();var e=t.x.redSqr(),n=t.y.redSqr(),r=e.redMul(this.a).redAdd(n),i=this.c2.redMul(this.one.redAdd(this.d.redMul(e).redMul(n)));return 0===r.cmp(i)},c(i,f.BasePoint),r.prototype.pointFromJSON=function(t){return i.fromJSON(this,t)},r.prototype.point=function(t,e,n,r){return new i(this,t,e,n,r)},i.fromJSON=function(t,e){return new i(t,e[0],e[1],e[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 t=this.x.redSqr(),e=this.y.redSqr(),n=this.z.redSqr();n=n.redIAdd(n);var r=this.curve._mulA(t),i=this.x.redAdd(this.y).redSqr().redISub(t).redISub(e),o=r.redAdd(e),s=o.redSub(n),a=r.redSub(e),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 t,e,n,r=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)t=r.redSub(i).redSub(o).redMul(s.redSub(this.curve.two)),e=s.redMul(f.redSub(o)),n=s.redSqr().redSub(s).redSub(s);else{var a=this.z.redSqr(),c=s.redSub(a).redISub(a);t=r.redSub(i).redISub(o).redMul(c),e=s.redMul(f.redSub(o)),n=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);t=this.curve._mulC(r.redISub(f)).redMul(c),e=this.curve._mulC(f).redMul(i.redISub(o)),n=f.redMul(c)}return this.curve.point(t,e,n)},i.prototype.dbl=function(){return this.isInfinity()?this:this.curve.extended?this._extDbl():this._projDbl()},i.prototype._extAdd=function(t){var e=this.y.redSub(this.x).redMul(t.y.redSub(t.x)),n=this.y.redAdd(this.x).redMul(t.y.redAdd(t.x)),r=this.t.redMul(this.curve.dd).redMul(t.t),i=this.z.redMul(t.z.redAdd(t.z)),o=n.redSub(e),s=i.redSub(r),a=i.redAdd(r),c=n.redAdd(e),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(t){var e,n,r=this.z.redMul(t.z),i=r.redSqr(),o=this.x.redMul(t.x),s=this.y.redMul(t.y),a=this.curve.d.redMul(o).redMul(s),c=i.redSub(a),f=i.redAdd(a),u=this.x.redAdd(this.y).redMul(t.x.redAdd(t.y)).redISub(o).redISub(s),h=r.redMul(c).redMul(u);return this.curve.twisted?(e=r.redMul(f).redMul(s.redSub(this.curve._mulA(o))),n=c.redMul(f)):(e=r.redMul(f).redMul(s.redSub(o)),n=this.curve._mulC(c).redMul(f)),this.curve.point(h,e,n)},i.prototype.add=function(t){return this.isInfinity()?t:t.isInfinity()?this:this.curve.extended?this._extAdd(t):this._projAdd(t)},i.prototype.mul=function(t){return this._hasDoubles(t)?this.curve._fixedNafMul(this,t):this.curve._wnafMul(this,t)},i.prototype.mulAdd=function(t,e,n){return this.curve._wnafMulAdd(1,[this,e],[t,n],2,!1)},i.prototype.jmulAdd=function(t,e,n){return this.curve._wnafMulAdd(1,[this,e],[t,n],2,!0)},i.prototype.normalize=function(){if(this.zOne)return this;var t=this.z.redInvm();return this.x=this.x.redMul(t),this.y=this.y.redMul(t),this.t&&(this.t=this.t.redMul(t)),this.z=this.curve.one,this.zOne=!0,this},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(t){return this===t||0===this.getX().cmp(t.getX())&&0===this.getY().cmp(t.getY())},i.prototype.eqXToP=function(t){var e=t.toRed(this.curve.red).redMul(this.z);if(0===this.x.cmp(e))return!0;for(var n=t.clone(),r=this.curve.redN.redMul(this.z);;){if(n.iadd(this.curve.n),n.cmp(this.curve.p)>=0)return!1;if(e.redIAdd(r),0===this.x.cmp(e))return!0}return!1},i.prototype.toP=i.prototype.normalize,i.prototype.mixedAdd=i.prototype.add},function(t,e,n){"use strict";function r(t){"short"===t.type?this.curve=new a.curve.short(t):"edwards"===t.type?this.curve=new a.curve.edwards(t):this.curve=new a.curve.mont(t),this.g=this.curve.g,this.n=this.curve.n,this.hash=t.hash,c(this.g.validate(),"Invalid curve"),c(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}function i(t,e){Object.defineProperty(o,t,{configurable:!0,enumerable:!0,get:function(){var n=new r(e);return Object.defineProperty(o,t,{configurable:!0,enumerable:!0,value:n}),n}})}var o=e,s=n(32),a=n(2),c=a.utils.assert;o.PresetCurve=r,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=n(125)}catch(t){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(t,e,n){"use strict";e.sha1=n(120),e.sha224=n(121),e.sha256=n(53),e.sha384=n(122),e.sha512=n(54)},function(t,e,n){"use strict";function r(){if(!(this instanceof r))return new r;h.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.W=new Array(80)}var i=n(6),o=n(18),s=n(52),a=i.rotl32,c=i.sum32,f=i.sum32_5,u=s.ft_1,h=o.BlockHash,d=[1518500249,1859775393,2400959708,3395469782];i.inherits(r,h),t.exports=r,r.blockSize=512,r.outSize=160,r.hmacStrength=80,r.padLength=64,r.prototype._update=function(t,e){for(var n=this.W,r=0;r<16;r++)n[r]=t[e+r];for(;r<n.length;r++)n[r]=a(n[r-3]^n[r-8]^n[r-14]^n[r-16],1);var i=this.h[0],o=this.h[1],s=this.h[2],h=this.h[3],l=this.h[4];for(r=0;r<n.length;r++){var p=~~(r/20),b=f(a(i,5),u(p,o,s,h),l,n[r],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)},r.prototype._digest=function(t){return"hex"===t?i.toHex32(this.h,"big"):i.split32(this.h,"big")}},function(t,e,n){"use strict";function r(){if(!(this instanceof r))return new r;o.call(this),this.h=[3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428]}var i=n(6),o=n(53);i.inherits(r,o),t.exports=r,r.blockSize=512,r.outSize=224,r.hmacStrength=192,r.padLength=64,r.prototype._digest=function(t){return"hex"===t?i.toHex32(this.h.slice(0,7),"big"):i.split32(this.h.slice(0,7),"big")}},function(t,e,n){"use strict";function r(){if(!(this instanceof r))return new r;o.call(this),this.h=[3418070365,3238371032,1654270250,914150663,2438529370,812702999,355462360,4144912697,1731405415,4290775857,2394180231,1750603025,3675008525,1694076839,1203062813,3204075428]}var i=n(6),o=n(54);i.inherits(r,o),t.exports=r,r.blockSize=1024,r.outSize=384,r.hmacStrength=192,r.padLength=128,r.prototype._digest=function(t){return"hex"===t?i.toHex32(this.h.slice(0,12),"big"):i.split32(this.h.slice(0,12),"big")}},function(t,e,n){"use strict";function r(){if(!(this instanceof r))return new r;h.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.endian="little"}function i(t,e,n,r){return t<=15?e^n^r:t<=31?e&n|~e&r:t<=47?(e|~n)^r:t<=63?e&r|n&~r:e^(n|~r)}var o=n(6),s=n(18),a=o.rotl32,c=o.sum32,f=o.sum32_3,u=o.sum32_4,h=s.BlockHash;o.inherits(r,h),e.ripemd160=r,r.blockSize=512,r.outSize=160,r.hmacStrength=192,r.padLength=64,r.prototype._update=function(t,e){for(var n=this.h[0],r=this.h[1],o=this.h[2],s=this.h[3],h=this.h[4],y=n,m=r,g=o,v=s,_=h,w=0;w<80;w++){var S=c(a(u(n,i(w,r,o,s),t[d[w]+e],function(t){return t<=15?0:t<=31?1518500249:t<=47?1859775393:t<=63?2400959708:2840853838}(w)),p[w]),h);n=h,h=s,s=a(o,10),o=r,r=S,S=c(a(u(y,i(79-w,m,g,v),t[l[w]+e],function(t){return t<=15?1352829926:t<=31?1548603684:t<=47?1836072691:t<=63?2053994217:0}(w)),b[w]),_),y=_,_=v,v=a(g,10),g=m,m=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],n,m),this.h[4]=f(this.h[0],r,g),this.h[0]=S},r.prototype._digest=function(t){return"hex"===t?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(t,e,n){"use strict";function r(t,e,n){if(!(this instanceof r))return new r(t,e,n);this.Hash=t,this.blockSize=t.blockSize/8,this.outSize=t.outSize/8,this.inner=null,this.outer=null,this._init(i.toArray(e,n))}var i=n(6),o=n(9);t.exports=r,r.prototype._init=function(t){t.length>this.blockSize&&(t=(new this.Hash).update(t).digest()),o(t.length<=this.blockSize);for(var e=t.length;e<this.blockSize;e++)t.push(0);for(e=0;e<t.length;e++)t[e]^=54;for(this.inner=(new this.Hash).update(t),e=0;e<t.length;e++)t[e]^=106;this.outer=(new this.Hash).update(t)},r.prototype.update=function(t,e){return this.inner.update(t,e),this},r.prototype.digest=function(t){return this.outer.update(this.inner.digest()),this.outer.digest(t)}},function(t,e){t.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(t,e,n){"use strict";function r(t){if(!(this instanceof r))return new r(t);"string"==typeof t&&(a(s.curves.hasOwnProperty(t),"Unknown curve "+t),t=s.curves[t]),t instanceof s.curves.PresetCurve&&(t={curve:t}),this.curve=t.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=t.curve.g,this.g.precompute(t.curve.n.bitLength()+1),this.hash=t.hash||t.curve.hash}var i=n(7),o=n(127),s=n(2),a=s.utils.assert,c=n(128),f=n(129);t.exports=r,r.prototype.keyPair=function(t){return new c(this,t)},r.prototype.keyFromPrivate=function(t,e){return c.fromPrivate(this,t,e)},r.prototype.keyFromPublic=function(t,e){return c.fromPublic(this,t,e)},r.prototype.genKeyPair=function(t){t||(t={});for(var e=new o({hash:this.hash,pers:t.pers,persEnc:t.persEnc||"utf8",entropy:t.entropy||s.rand(this.hash.hmacStrength),entropyEnc:t.entropy&&t.entropyEnc||"utf8",nonce:this.n.toArray()}),n=this.n.byteLength(),r=this.n.sub(new i(2));;){var a=new i(e.generate(n));if(!(a.cmp(r)>0))return a.iaddn(1),this.keyFromPrivate(a)}},r.prototype._truncateToN=function(t,e){var n=8*t.byteLength()-this.n.bitLength();return n>0&&(t=t.ushrn(n)),!e&&t.cmp(this.n)>=0?t.sub(this.n):t},r.prototype.sign=function(t,e,n,r){"object"==typeof n&&(r=n,n=null),r||(r={}),e=this.keyFromPrivate(e,n),t=this._truncateToN(new i(t,16));for(var s=this.n.byteLength(),a=e.getPrivate().toArray("be",s),c=t.toArray("be",s),u=new o({hash:this.hash,entropy:a,nonce:c,pers:r.pers,persEnc:r.persEnc||"utf8"}),h=this.n.sub(new i(1)),d=0;!0;d++){var l=r.k?r.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 m=l.invm(this.n).mul(y.mul(e.getPrivate()).iadd(t));if(0!==(m=m.umod(this.n)).cmpn(0)){var g=(p.getY().isOdd()?1:0)|(0!==b.cmp(y)?2:0);return r.canonical&&m.cmp(this.nh)>0&&(m=this.n.sub(m),g^=1),new f({r:y,s:m,recoveryParam:g})}}}}}},r.prototype.verify=function(t,e,n,r){t=this._truncateToN(new i(t,16)),n=this.keyFromPublic(n,r);var o=(e=new f(e,"hex")).r,s=e.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(t).umod(this.n),u=a.mul(o).umod(this.n);if(!this.curve._maxwellTrick){return!(h=this.g.mulAdd(c,n.getPublic(),u)).isInfinity()&&0===h.getX().umod(this.n).cmp(o)}var h=this.g.jmulAdd(c,n.getPublic(),u);return!h.isInfinity()&&h.eqXToP(o)},r.prototype.recoverPubKey=function(t,e,n,r){a((3&n)===n,"The recovery param is more than two bits"),e=new f(e,r);var o=this.n,s=new i(t),c=e.r,u=e.s,h=1&n,d=n>>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=e.r.invm(o),p=o.sub(s).mul(l).umod(o),b=u.mul(l).umod(o);return this.g.mulAdd(p,c,b)},r.prototype.getKeyRecoveryParam=function(t,e,n,r){if(null!==(e=new f(e,r)).recoveryParam)return e.recoveryParam;for(var i=0;i<4;i++){var o;try{o=this.recoverPubKey(t,e,i)}catch(t){continue}if(o.eq(n))return i}throw new Error("Unable to find valid recovery factor")}},function(t,e,n){"use strict";function r(t){if(!(this instanceof r))return new r(t);this.hash=t.hash,this.predResist=!!t.predResist,this.outLen=this.hash.outSize,this.minEntropy=t.minEntropy||this.hash.hmacStrength,this._reseed=null,this.reseedInterval=null,this.K=null,this.V=null;var e=o.toArray(t.entropy,t.entropyEnc||"hex"),n=o.toArray(t.nonce,t.nonceEnc||"hex"),i=o.toArray(t.pers,t.persEnc||"hex");s(e.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(e,n,i)}var i=n(32),o=n(51),s=n(9);t.exports=r,r.prototype._init=function(t,e,n){var r=t.concat(e).concat(n);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(r),this._reseed=1,this.reseedInterval=281474976710656},r.prototype._hmac=function(){return new i.hmac(this.hash,this.K)},r.prototype._update=function(t){var e=this._hmac().update(this.V).update([0]);t&&(e=e.update(t)),this.K=e.digest(),this.V=this._hmac().update(this.V).digest(),t&&(this.K=this._hmac().update(this.V).update([1]).update(t).digest(),this.V=this._hmac().update(this.V).digest())},r.prototype.reseed=function(t,e,n,r){"string"!=typeof e&&(r=n,n=e,e=null),t=o.toArray(t,e),n=o.toArray(n,r),s(t.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(t.concat(n||[])),this._reseed=1},r.prototype.generate=function(t,e,n,r){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");"string"!=typeof e&&(r=n,n=e,e=null),n&&(n=o.toArray(n,r||"hex"),this._update(n));for(var i=[];i.length<t;)this.V=this._hmac().update(this.V).digest(),i=i.concat(this.V);var s=i.slice(0,t);return this._update(n),this._reseed++,o.encode(s,e)}},function(t,e,n){"use strict";function r(t,e){this.ec=t,this.priv=null,this.pub=null,e.priv&&this._importPrivate(e.priv,e.privEnc),e.pub&&this._importPublic(e.pub,e.pubEnc)}var i=n(7),o=n(2).utils.assert;t.exports=r,r.fromPublic=function(t,e,n){return e instanceof r?e:new r(t,{pub:e,pubEnc:n})},r.fromPrivate=function(t,e,n){return e instanceof r?e:new r(t,{priv:e,privEnc:n})},r.prototype.validate=function(){var t=this.getPublic();return t.isInfinity()?{result:!1,reason:"Invalid public key"}:t.validate()?t.mul(this.ec.curve.n).isInfinity()?{result:!0,reason:null}:{result:!1,reason:"Public key * N != O"}:{result:!1,reason:"Public key is not a point"}},r.prototype.getPublic=function(t,e){return"string"==typeof t&&(e=t,t=null),this.pub||(this.pub=this.ec.g.mul(this.priv)),e?this.pub.encode(e,t):this.pub},r.prototype.getPrivate=function(t){return"hex"===t?this.priv.toString(16,2):this.priv},r.prototype._importPrivate=function(t,e){this.priv=new i(t,e||16),this.priv=this.priv.umod(this.ec.curve.n)},r.prototype._importPublic=function(t,e){if(t.x||t.y)return"mont"===this.ec.curve.type?o(t.x,"Need x coordinate"):"short"!==this.ec.curve.type&&"edwards"!==this.ec.curve.type||o(t.x&&t.y,"Need both x and y coordinate"),void(this.pub=this.ec.curve.point(t.x,t.y));this.pub=this.ec.curve.decodePoint(t,e)},r.prototype.derive=function(t){return t.mul(this.priv).getX()},r.prototype.sign=function(t,e,n){return this.ec.sign(t,this,e,n)},r.prototype.verify=function(t,e){return this.ec.verify(t,e,this)},r.prototype.inspect=function(){return"<Key priv: "+(this.priv&&this.priv.toString(16,2))+" pub: "+(this.pub&&this.pub.inspect())+" >"}},function(t,e,n){"use strict";function r(t,e){if(t instanceof r)return t;this._importDER(t,e)||(f(t.r&&t.s,"Signature without r or s"),this.r=new a(t.r,16),this.s=new a(t.s,16),void 0===t.recoveryParam?this.recoveryParam=null:this.recoveryParam=t.recoveryParam)}function i(t,e){var n=t[e.place++];if(!(128&n))return n;for(var r=15&n,i=0,o=0,s=e.place;o<r;o++,s++)i<<=8,i|=t[s];return e.place=s,i}function o(t){for(var e=0,n=t.length-1;!t[e]&&!(128&t[e+1])&&e<n;)e++;return 0===e?t:t.slice(e)}function s(t,e){if(e<128)t.push(e);else{var n=1+(Math.log(e)/Math.LN2>>>3);for(t.push(128|n);--n;)t.push(e>>>(n<<3)&255);t.push(e)}}var a=n(7),c=n(2).utils,f=c.assert;t.exports=r,r.prototype._importDER=function(t,e){t=c.toArray(t,e);var n=new function(){this.place=0};if(48!==t[n.place++])return!1;if(i(t,n)+n.place!==t.length)return!1;if(2!==t[n.place++])return!1;var r=i(t,n),o=t.slice(n.place,r+n.place);if(n.place+=r,2!==t[n.place++])return!1;var s=i(t,n);if(t.length!==s+n.place)return!1;var f=t.slice(n.place,s+n.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},r.prototype.toDER=function(t){var e=this.r.toArray(),n=this.s.toArray();for(128&e[0]&&(e=[0].concat(e)),128&n[0]&&(n=[0].concat(n)),e=o(e),n=o(n);!(n[0]||128&n[1]);)n=n.slice(1);var r=[2];s(r,e.length),(r=r.concat(e)).push(2),s(r,n.length);var i=r.concat(n),a=[48];return s(a,i.length),a=a.concat(i),c.encode(a,t)}},function(t,e,n){"use strict";function r(t){if(a("ed25519"===t,"only tested with ed25519 so far"),!(this instanceof r))return new r(t);t=o.curves[t].curve;this.curve=t,this.g=t.g,this.g.precompute(t.n.bitLength()+1),this.pointClass=t.point().constructor,this.encodingLength=Math.ceil(t.n.bitLength()/8),this.hash=i.sha512}var i=n(32),o=n(2),s=o.utils,a=s.assert,c=s.parseBytes,f=n(131),u=n(132);t.exports=r,r.prototype.sign=function(t,e){t=c(t);var n=this.keyFromSecret(e),r=this.hashInt(n.messagePrefix(),t),i=this.g.mul(r),o=this.encodePoint(i),s=this.hashInt(o,n.pubBytes(),t).mul(n.priv()),a=r.add(s).umod(this.curve.n);return this.makeSignature({R:i,S:a,Rencoded:o})},r.prototype.verify=function(t,e,n){t=c(t),e=this.makeSignature(e);var r=this.keyFromPublic(n),i=this.hashInt(e.Rencoded(),r.pubBytes(),t),o=this.g.mul(e.S());return e.R().add(r.pub().mul(i)).eq(o)},r.prototype.hashInt=function(){for(var t=this.hash(),e=0;e<arguments.length;e++)t.update(arguments[e]);return s.intFromLE(t.digest()).umod(this.curve.n)},r.prototype.keyFromPublic=function(t){return f.fromPublic(this,t)},r.prototype.keyFromSecret=function(t){return f.fromSecret(this,t)},r.prototype.makeSignature=function(t){return t instanceof u?t:new u(this,t)},r.prototype.encodePoint=function(t){var e=t.getY().toArray("le",this.encodingLength);return e[this.encodingLength-1]|=t.getX().isOdd()?128:0,e},r.prototype.decodePoint=function(t){var e=(t=s.parseBytes(t)).length-1,n=t.slice(0,e).concat(-129&t[e]),r=0!=(128&t[e]),i=s.intFromLE(n);return this.curve.pointFromY(i,r)},r.prototype.encodeInt=function(t){return t.toArray("le",this.encodingLength)},r.prototype.decodeInt=function(t){return s.intFromLE(t)},r.prototype.isPoint=function(t){return t instanceof this.pointClass}},function(t,e,n){"use strict";function r(t,e){this.eddsa=t,this._secret=s(e.secret),t.isPoint(e.pub)?this._pub=e.pub:this._pubBytes=s(e.pub)}var i=n(2).utils,o=i.assert,s=i.parseBytes,a=i.cachedProperty;r.fromPublic=function(t,e){return e instanceof r?e:new r(t,{pub:e})},r.fromSecret=function(t,e){return e instanceof r?e:new r(t,{secret:e})},r.prototype.secret=function(){return this._secret},a(r,"pubBytes",function(){return this.eddsa.encodePoint(this.pub())}),a(r,"pub",function(){return this._pubBytes?this.eddsa.decodePoint(this._pubBytes):this.eddsa.g.mul(this.priv())}),a(r,"privBytes",function(){var t=this.eddsa,e=this.hash(),n=t.encodingLength-1,r=e.slice(0,t.encodingLength);return r[0]&=248,r[n]&=127,r[n]|=64,r}),a(r,"priv",function(){return this.eddsa.decodeInt(this.privBytes())}),a(r,"hash",function(){return this.eddsa.hash().update(this.secret()).digest()}),a(r,"messagePrefix",function(){return this.hash().slice(this.eddsa.encodingLength)}),r.prototype.sign=function(t){return o(this._secret,"KeyPair can only verify"),this.eddsa.sign(t,this)},r.prototype.verify=function(t,e){return this.eddsa.verify(t,e,this)},r.prototype.getSecret=function(t){return o(this._secret,"KeyPair is public only"),i.encode(this.secret(),t)},r.prototype.getPublic=function(t){return i.encode(this.pubBytes(),t)},t.exports=r},function(t,e,n){"use strict";function r(t,e){this.eddsa=t,"object"!=typeof e&&(e=c(e)),Array.isArray(e)&&(e={R:e.slice(0,t.encodingLength),S:e.slice(t.encodingLength)}),s(e.R&&e.S,"Signature without R or S"),t.isPoint(e.R)&&(this._R=e.R),e.S instanceof i&&(this._S=e.S),this._Rencoded=Array.isArray(e.R)?e.R:e.Rencoded,this._Sencoded=Array.isArray(e.S)?e.S:e.Sencoded}var i=n(7),o=n(2).utils,s=o.assert,a=o.cachedProperty,c=o.parseBytes;a(r,"S",function(){return this.eddsa.decodeInt(this.Sencoded())}),a(r,"R",function(){return this.eddsa.decodePoint(this.Rencoded())}),a(r,"Rencoded",function(){return this.eddsa.encodePoint(this.R())}),a(r,"Sencoded",function(){return this.eddsa.encodeInt(this.S())}),r.prototype.toBytes=function(){return this.Rencoded().concat(this.Sencoded())},r.prototype.toHex=function(){return o.encode(this.toBytes(),"hex").toUpperCase()},t.exports=r},function(t,e,n){(function(t){(function(){var r,i,o,s,a,c,f,u,h,d,l,p,b,y,m=function(t,e){function n(){this.constructor=t}for(var r in e)g.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},g={}.hasOwnProperty;b=n(12),p=n(17),l=n(4),y=n(134).sync,i="---.EMPTY_STRING.---",f=function(t){var e,n,r,i,o;for(o=[],e=0,n=(i=p.readdirSync(t)).length;e<n;e++)r=i[e],o.push(h(b.join(t,r)));return o},h=function(t){return p.statSync(t).isDirectory()?(f(t),p.rmdirSync(t)):p.unlinkSync(t)},u=function(t){return""===t?i:t.toString()},a=function(t){function e(t){this.message=null!=t?t:"Unknown error.",null!=Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}return m(e,t),e.prototype.toString=function(){return this.name+": "+this.message},e}(Error),c=function(){return function(t,e,n,r,i){this.key=t,this.oldValue=e,this.newValue=n,this.url=r,this.storageArea=null!=i?i:"localStorage"}}(),s=function(){function t(e,n){if(this.key=e,this.index=n,!(this instanceof t))return new t(this.key,this.index)}return t}(),d=function(){var t;return t=function(){},t.prototype=Object.create(null),new t},o=function(e){function n(e,i){return this._location=e,this.quota=null!=i?i:5242880,this instanceof n?(this._location=b.resolve(this._location),null!=r[this._location]?r[this._location]:(this.length=0,this._bytesInUse=0,this._keys=[],this._metaKeyMap=d(),this._eventUrl="pid:"+t.pid,this._init(),this._QUOTA_EXCEEDED_ERR=a,r[this._location]=this,r[this._location])):new n(this._location,this.quota)}var r;return m(n,e),r={},n.prototype._init=function(){var t,e,n,r,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=r=0,a=(n=p.readdirSync(this._location)).length;r<a;i=++r)o=n[i],e=decodeURIComponent(o),this._keys.push(e),t=new s(o,i),this._metaKeyMap[e]=t,null!=(null!=(c=this._getStat(o))?c.size:void 0)&&(t.size=c.size,this._bytesInUse+=c.size);this.length=n.length}catch(t){p.mkdirSync(this._location)}},n.prototype.setItem=function(t,e){var n,r,i,o,f,h,d,p,m,g;if(f=l.EventEmitter.listenerCount(this,"storage"),p=null,f&&(p=this.getItem(t)),t=u(t),n=encodeURIComponent(t),o=b.join(this._location,n),m=e.toString(),g=m.length,h=this._metaKeyMap[t],i=!!h,d=i?h.size:0,this._bytesInUse-d+g>this.quota)throw new a;if(y(o,m,"utf8"),i||((h=new s(n,this._keys.push(t)-1)).size=g,this._metaKeyMap[t]=h,this.length+=1,this._bytesInUse+=g),f)return r=new c(t,p,e,this._eventUrl),this.emit("storage",r)},n.prototype.getItem=function(t){var e,n;return t=u(t),(n=this._metaKeyMap[t])?(e=b.join(this._location,n.key),p.readFileSync(e,"utf8")):null},n.prototype._getStat=function(t){var e;t=u(t),e=b.join(this._location,encodeURIComponent(t));try{return p.statSync(e)}catch(t){return null}},n.prototype.removeItem=function(t){var e,n,r,i,o,s,a,f;if(t=u(t),s=this._metaKeyMap[t]){a=null,(r=l.EventEmitter.listenerCount(this,"storage"))&&(a=this.getItem(t)),delete this._metaKeyMap[t],this.length-=1,this._bytesInUse-=s.size,n=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(n),r)return e=new c(t,a,null,this._eventUrl),this.emit("storage",e)}},n.prototype.key=function(t){return this._keys[t]},n.prototype.clear=function(){var t;if(f(this._location),this._metaKeyMap=d(),this._keys=[],this.length=0,this._bytesInUse=0,l.EventEmitter.listenerCount(this,"storage"))return t=new c(null,null,null,this._eventUrl),this.emit("storage",t)},n.prototype._getBytesInUse=function(){return this._bytesInUse},n.prototype._deleteLocation=function(){return delete r[this._location],h(this._location),this._metaKeyMap={},this._keys=[],this.length=0,this._bytesInUse=0},n}(l.EventEmitter),r=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return m(e,o),e.prototype.setItem=function(t,n){var r;return r=JSON.stringify(n),e.__super__.setItem.call(this,t,r)},e.prototype.getItem=function(t){return JSON.parse(e.__super__.getItem.call(this,t))},e}(),e.LocalStorage=o,e.JSONStorage=r,e.QUOTA_EXCEEDED_ERR=a}).call(this)}).call(e,n(0))},function(t,e,n){"use strict";(function(e,r,i){function o(t){return t+"."+c(e).hash(String(r.pid)).hash(String(++u)).result()}t.exports=function(t,e,n,c){n instanceof Function&&(c=n,n=null),n||(n={}),s.realpath(t,function(u,h){!function(t,e,n,c){function u(){a([[h,d,e,n.mode,n.encoding||"utf8"],n.chown&&[s,s.chown,d,n.chown.uid,n.chown.gid],n.mode&&[s,s.chmod,d,n.mode],[s,s.rename,d,t]],function(t){t?s.unlink(d,function(){c(t)}):c()})}function h(t,e,r,o,a){s.open(t,"w",n.mode,function(t,n){function r(t){if(t)return a(t);s.fsync(n,function(t){if(t)return a(t);s.close(n,a)})}return t?a(t):i.isBuffer(e)?s.write(n,e,0,e.length,0,r):null!=e?s.write(n,String(e),0,String(o),r):r()})}var d=o(t);n.mode&&n.chown?u():s.stat(t,function(t,e){return t||!e?u():((n=f({},n)).mode||(n.mode=e.mode),!n.chown&&r.getuid&&(n.chown={uid:e.uid,gid:e.gid}),u())})}(h||t,e,n,c)})},t.exports.sync=function(t,e,n){n||(n={});try{t=s.realpathSync(t)}catch(t){}var a=o(t);try{if(!n.mode||!n.chown)try{var c=s.statSync(t);(n=f({},n)).mode||(n.mode=c.mode),!n.chown&&r.getuid&&(n.chown={uid:c.uid,gid:c.gid})}catch(t){}var u=s.openSync(a,"w",n.mode);i.isBuffer(e)?s.writeSync(u,e,0,e.length,0):null!=e&&s.writeSync(u,String(e),0,String(n.encoding||"utf8")),s.fsyncSync(u),s.closeSync(u),n.chown&&s.chownSync(a,n.chown.uid,n.chown.gid),n.mode&&s.chmodSync(a,n.mode),s.renameSync(a,t)}catch(t){try{s.unlinkSync(a)}catch(t){}throw t}},t.exports._getTmpname=o;var s=n(135),a=n(147).chain,c=n(150),f=Object.assign||n(24)._extend,u=0}).call(e,"/index.js",n(0),n(1).Buffer)},function(t,e,n){(function(e){function r(t){function n(e){return p.apply(t,e)}function s(t,e){return this instanceof s?(y.apply(this,arguments),this):s.apply(Object.create(s.prototype),arguments)}function f(t,e){return this instanceof f?(m.apply(this,arguments),this):f.apply(Object.create(f.prototype),arguments)}function u(t,e,n,r){function s(t,e,n,r){return g(t,e,n,function(a,c){!a||"EMFILE"!==a.code&&"ENFILE"!==a.code?("function"==typeof r&&r.apply(this,arguments),o()):i([s,[t,e,n,r]])})}return"function"==typeof n&&(r=n,n=null),s(t,e,n,r)}a(t),t.gracefulify=r,t.FileReadStream=s,t.FileWriteStream=f,t.createReadStream=function(t,e){return new s(t,e)},t.createWriteStream=function(t,e){return new f(t,e)};var h=t.readFile;t.readFile=function(t,e,n){function r(t,e,n){return h(t,e,function(s){!s||"EMFILE"!==s.code&&"ENFILE"!==s.code?("function"==typeof n&&n.apply(this,arguments),o()):i([r,[t,e,n]])})}return"function"==typeof e&&(n=e,e=null),r(t,e,n)};var d=t.writeFile;t.writeFile=function(t,e,n,r){function s(t,e,n,r){return d(t,e,n,function(a){!a||"EMFILE"!==a.code&&"ENFILE"!==a.code?("function"==typeof r&&r.apply(this,arguments),o()):i([s,[t,e,n,r]])})}return"function"==typeof n&&(r=n,n=null),s(t,e,n,r)};var l=t.appendFile;l&&(t.appendFile=function(t,e,n,r){function s(t,e,n,r){return l(t,e,n,function(a){!a||"EMFILE"!==a.code&&"ENFILE"!==a.code?("function"==typeof r&&r.apply(this,arguments),o()):i([s,[t,e,n,r]])})}return"function"==typeof n&&(r=n,n=null),s(t,e,n,r)});var p=t.readdir;if(t.readdir=function(t,e,r){var s=[t];return"function"!=typeof e?s.push(e):r=e,s.push(function(t,e){e&&e.sort&&e.sort(),!t||"EMFILE"!==t.code&&"ENFILE"!==t.code?("function"==typeof r&&r.apply(this,arguments),o()):i([n,[s]])}),n(s)},"v0.8"===e.version.substr(0,4)){var b=c(t);s=b.ReadStream,f=b.WriteStream}var y=t.ReadStream;(s.prototype=Object.create(y.prototype)).open=function(){var t=this;u(t.path,t.flags,t.mode,function(e,n){e?(t.autoClose&&t.destroy(),t.emit("error",e)):(t.fd=n,t.emit("open",n),t.read())})};var m=t.WriteStream;(f.prototype=Object.create(m.prototype)).open=function(){var t=this;u(t.path,t.flags,t.mode,function(e,n){e?(t.destroy(),t.emit("error",e)):(t.fd=n,t.emit("open",n))})},t.ReadStream=s,t.WriteStream=f;var g=t.open;return t.open=u,t}function i(t){h("ENQUEUE",t[0].name,t[1]),f.push(t)}function o(){var t=f.shift();t&&(h("RETRY",t[0].name,t[1]),t[0].apply(null,t[1]))}var s=n(17),a=n(136),c=n(138),f=[],u=n(24),h=function(){};u.debuglog?h=u.debuglog("gfs4"):/\bgfs4\b/i.test(Object({NODE_ENV:void 0}).NODE_DEBUG||"")&&(h=function(){var t=u.format.apply(u,arguments);t="GFS4: "+t.split(/\n/).join("\nGFS4: "),console.error(t)}),/\bgfs4\b/i.test(Object({NODE_ENV:void 0}).NODE_DEBUG||"")&&e.on("exit",function(){h(f),n(146).equal(f.length,0)}),t.exports=r(n(55)),Object({NODE_ENV:void 0}).TEST_GRACEFUL_FS_GLOBAL_PATCH&&(t.exports=r(s)),t.exports.close=s.close=function(t){return function(e,n){return t.call(s,e,function(t){t||o(),"function"==typeof n&&n.apply(this,arguments)})}}(s.close),t.exports.closeSync=s.closeSync=function(t){return function(e){var n=t.apply(s,arguments);return o(),n}}(s.closeSync)}).call(e,n(0))},function(t,e,n){(function(e){function r(t){return t?function(e,n,r){return t.call(u,e,n,function(t){f(t)&&(t=null),r&&r.apply(this,arguments)})}:t}function i(t){return t?function(e,n){try{return t.call(u,e,n)}catch(t){if(!f(t))throw t}}:t}function o(t){return t?function(e,n,r,i){return t.call(u,e,n,r,function(t){f(t)&&(t=null),i&&i.apply(this,arguments)})}:t}function s(t){return t?function(e,n,r){try{return t.call(u,e,n,r)}catch(t){if(!f(t))throw t}}:t}function a(t){return t?function(e,n){return t.call(u,e,function(t,e){if(!e)return n.apply(this,arguments);e.uid<0&&(e.uid+=4294967296),e.gid<0&&(e.gid+=4294967296),n&&n.apply(this,arguments)})}:t}function c(t){return t?function(e){var n=t.call(u,e);return n.uid<0&&(n.uid+=4294967296),n.gid<0&&(n.gid+=4294967296),n}:t}function f(t){if(!t)return!0;if("ENOSYS"===t.code)return!0;return!(e.getuid&&0===e.getuid()||"EINVAL"!==t.code&&"EPERM"!==t.code)}var u=n(55),h=n(137),d=e.cwd,l=null,p=Object({NODE_ENV:void 0}).GRACEFUL_FS_PLATFORM||e.platform;e.cwd=function(){return l||(l=d.call(e)),l};try{e.cwd()}catch(t){}var b=e.chdir;e.chdir=function(t){l=null,b.call(e,t)},t.exports=function(t){h.hasOwnProperty("O_SYMLINK")&&e.version.match(/^v0\.6\.[0-2]|^v0\.5\./)&&function(t){t.lchmod=function(e,n,r){t.open(e,h.O_WRONLY|h.O_SYMLINK,n,function(e,i){e?r&&r(e):t.fchmod(i,n,function(e){t.close(i,function(t){r&&r(e||t)})})})},t.lchmodSync=function(e,n){var r,i=t.openSync(e,h.O_WRONLY|h.O_SYMLINK,n),o=!0;try{r=t.fchmodSync(i,n),o=!1}finally{if(o)try{t.closeSync(i)}catch(t){}else t.closeSync(i)}return r}}(t),t.lutimes||function(t){h.hasOwnProperty("O_SYMLINK")?(t.lutimes=function(e,n,r,i){t.open(e,h.O_SYMLINK,function(e,o){e?i&&i(e):t.futimes(o,n,r,function(e){t.close(o,function(t){i&&i(e||t)})})})},t.lutimesSync=function(e,n,r){var i,o=t.openSync(e,h.O_SYMLINK),s=!0;try{i=t.futimesSync(o,n,r),s=!1}finally{if(s)try{t.closeSync(o)}catch(t){}else t.closeSync(o)}return i}):(t.lutimes=function(t,n,r,i){i&&e.nextTick(i)},t.lutimesSync=function(){})}(t),t.chown=o(t.chown),t.fchown=o(t.fchown),t.lchown=o(t.lchown),t.chmod=r(t.chmod),t.fchmod=r(t.fchmod),t.lchmod=r(t.lchmod),t.chownSync=s(t.chownSync),t.fchownSync=s(t.fchownSync),t.lchownSync=s(t.lchownSync),t.chmodSync=i(t.chmodSync),t.fchmodSync=i(t.fchmodSync),t.lchmodSync=i(t.lchmodSync),t.stat=a(t.stat),t.fstat=a(t.fstat),t.lstat=a(t.lstat),t.statSync=c(t.statSync),t.fstatSync=c(t.fstatSync),t.lstatSync=c(t.lstatSync),t.lchmod||(t.lchmod=function(t,n,r){r&&e.nextTick(r)},t.lchmodSync=function(){}),t.lchown||(t.lchown=function(t,n,r,i){i&&e.nextTick(i)},t.lchownSync=function(){}),"win32"===p&&(t.rename=function(e){return function(n,r,i){var o=Date.now(),s=0;e(n,r,function a(c){if(c&&("EACCES"===c.code||"EPERM"===c.code)&&Date.now()-o<6e4)return setTimeout(function(){t.stat(r,function(t,o){t&&"ENOENT"===t.code?e(n,r,a):i(c)})},s),void(s<100&&(s+=10));i&&i(c)})}}(t.rename)),t.read=function(e){return function(n,r,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++,e.call(t,n,r,i,o,s,c);a.apply(this,arguments)}}return e.call(t,n,r,i,o,s,c)}}(t.read),t.readSync=function(e){return function(n,r,i,o,s){for(var a=0;;)try{return e.call(t,n,r,i,o,s)}catch(t){if("EAGAIN"===t.code&&a<10){a++;continue}throw t}}}(t.readSync)}}).call(e,n(0))},function(t,e){t.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(t,e,n){(function(e){var r=n(139).Stream;t.exports=function(t){function n(i,o){if(!(this instanceof n))return new n(i,o);r.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?t.open(this.path,this.flags,this.mode,function(t,e){if(t)return s.emit("error",t),void(s.readable=!1);s.fd=e,s.emit("open",e),s._read()}):e.nextTick(function(){s._read()})}function i(e,n){if(!(this instanceof i))return new i(e,n);r.call(this),this.path=e,this.fd=null,this.writable=!0,this.flags="w",this.encoding="binary",this.mode=438,this.bytesWritten=0,n=n||{};for(var o=Object.keys(n),s=0,a=o.length;s<a;s++){var c=o[s];this[c]=n[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=t.open,this._queue.push([this._open,this.path,this.flags,this.mode,void 0]),this.flush())}return{ReadStream:n,WriteStream:i}}}).call(e,n(0))},function(t,e,n){function r(){i.call(this)}t.exports=r;var i=n(4).EventEmitter;n(5)(r,i),r.Readable=n(13),r.Writable=n(140),r.Duplex=n(141),r.Transform=n(142),r.PassThrough=n(143),r.Stream=r,r.prototype.pipe=function(t,e){function n(e){t.writable&&!1===t.write(e)&&f.pause&&f.pause()}function r(){f.readable&&f.resume&&f.resume()}function o(){u||(u=!0,t.end())}function s(){u||(u=!0,"function"==typeof t.destroy&&t.destroy())}function a(t){if(c(),0===i.listenerCount(this,"error"))throw t}function c(){f.removeListener("data",n),t.removeListener("drain",r),f.removeListener("end",o),f.removeListener("close",s),f.removeListener("error",a),t.removeListener("error",a),f.removeListener("end",c),f.removeListener("close",c),t.removeListener("close",c)}var f=this;f.on("data",n),t.on("drain",r),t._isStdio||e&&!1===e.end||(f.on("end",o),f.on("close",s));var u=!1;return f.on("error",a),t.on("error",a),f.on("end",c),f.on("close",c),t.on("close",c),t.emit("pipe",f),t}},function(t,e,n){t.exports=n(25)},function(t,e,n){t.exports=n(8)},function(t,e,n){t.exports=n(13).Transform},function(t,e,n){t.exports=n(13).PassThrough},function(t,e){t.exports=function(t){return t&&"object"==typeof t&&"function"==typeof t.copy&&"function"==typeof t.fill&&"function"==typeof t.readUInt8}},function(t,e){"function"==typeof Object.create?t.exports=function(t,e){t.super_=e,t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}})}:t.exports=function(t,e){t.super_=e;var n=function(){};n.prototype=e.prototype,t.prototype=new n,t.prototype.constructor=t}},function(t,e,n){"use strict";(function(e){function r(t,e){if(t===e)return 0;for(var n=t.length,r=e.length,i=0,o=Math.min(n,r);i<o;++i)if(t[i]!==e[i]){n=t[i],r=e[i];break}return n<r?-1:r<n?1:0}function i(t){return e.Buffer&&"function"==typeof e.Buffer.isBuffer?e.Buffer.isBuffer(t):!(null==t||!t._isBuffer)}function o(t){return Object.prototype.toString.call(t)}function s(t){return!i(t)&&("function"==typeof e.ArrayBuffer&&("function"==typeof ArrayBuffer.isView?ArrayBuffer.isView(t):!!t&&(t instanceof DataView||!!(t.buffer&&t.buffer instanceof ArrayBuffer))))}function a(t){if(m.isFunction(t)){if(_)return t.name;var e=t.toString().match(S);return e&&e[1]}}function c(t,e){return"string"==typeof t?t.length<e?t:t.slice(0,e):t}function f(t){if(_||!m.isFunction(t))return m.inspect(t);var e=a(t);return"[Function"+(e?": "+e:"")+"]"}function u(t,e,n,r,i){throw new w.AssertionError({message:n,actual:t,expected:e,operator:r,stackStartFunction:i})}function h(t,e){t||u(t,!0,e,"==",w.ok)}function d(t,e,n,a){if(t===e)return!0;if(i(t)&&i(e))return 0===r(t,e);if(m.isDate(t)&&m.isDate(e))return t.getTime()===e.getTime();if(m.isRegExp(t)&&m.isRegExp(e))return t.source===e.source&&t.global===e.global&&t.multiline===e.multiline&&t.lastIndex===e.lastIndex&&t.ignoreCase===e.ignoreCase;if(null!==t&&"object"==typeof t||null!==e&&"object"==typeof e){if(s(t)&&s(e)&&o(t)===o(e)&&!(t instanceof Float32Array||t instanceof Float64Array))return 0===r(new Uint8Array(t.buffer),new Uint8Array(e.buffer));if(i(t)!==i(e))return!1;var c=(a=a||{actual:[],expected:[]}).actual.indexOf(t);return-1!==c&&c===a.expected.indexOf(e)||(a.actual.push(t),a.expected.push(e),function(t,e,n,r){if(null===t||void 0===t||null===e||void 0===e)return!1;if(m.isPrimitive(t)||m.isPrimitive(e))return t===e;if(n&&Object.getPrototypeOf(t)!==Object.getPrototypeOf(e))return!1;var i=l(t),o=l(e);if(i&&!o||!i&&o)return!1;if(i)return t=v.call(t),e=v.call(e),d(t,e,n);var s,a,c=k(t),f=k(e);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(t[s],e[s],n,r))return!1;return!0}(t,e,n,a))}return n?t===e:t==e}function l(t){return"[object Arguments]"==Object.prototype.toString.call(t)}function p(t,e,n){d(t,e,!0)&&u(t,e,n,"notDeepStrictEqual",p)}function b(t,e){if(!t||!e)return!1;if("[object RegExp]"==Object.prototype.toString.call(e))return e.test(t);try{if(t instanceof e)return!0}catch(t){}return!Error.isPrototypeOf(e)&&!0===e.call({},t)}function y(t,e,n,r){var i;if("function"!=typeof e)throw new TypeError('"block" argument must be a function');"string"==typeof n&&(r=n,n=null),i=function(t){var e;try{t()}catch(t){e=t}return e}(e),r=(n&&n.name?" ("+n.name+").":".")+(r?" "+r:"."),t&&!i&&u(i,n,"Missing expected exception"+r);var o="string"==typeof r,s=!t&&m.isError(i),a=!t&&i&&!n;if((s&&o&&b(i,n)||a)&&u(i,n,"Got unwanted exception"+r),t&&i&&n&&!b(i,n)||!t&&i)throw i}var m=n(24),g=Object.prototype.hasOwnProperty,v=Array.prototype.slice,_="foo"===function(){}.name,w=t.exports=h,S=/\s*function\s+([^\(\s]*)\s*/;w.AssertionError=function(t){this.name="AssertionError",this.actual=t.actual,this.expected=t.expected,this.operator=t.operator,t.message?(this.message=t.message,this.generatedMessage=!1):(this.message=function(t){return c(f(t.actual),128)+" "+t.operator+" "+c(f(t.expected),128)}(this),this.generatedMessage=!0);var e=t.stackStartFunction||u;if(Error.captureStackTrace)Error.captureStackTrace(this,e);else{var n=new Error;if(n.stack){var r=n.stack,i=a(e),o=r.indexOf("\n"+i);if(o>=0){var s=r.indexOf("\n",o+1);r=r.substring(s+1)}this.stack=r}}},m.inherits(w.AssertionError,Error),w.fail=u,w.ok=h,w.equal=function(t,e,n){t!=e&&u(t,e,n,"==",w.equal)},w.notEqual=function(t,e,n){t==e&&u(t,e,n,"!=",w.notEqual)},w.deepEqual=function(t,e,n){d(t,e,!1)||u(t,e,n,"deepEqual",w.deepEqual)},w.deepStrictEqual=function(t,e,n){d(t,e,!0)||u(t,e,n,"deepStrictEqual",w.deepStrictEqual)},w.notDeepEqual=function(t,e,n){d(t,e,!1)&&u(t,e,n,"notDeepEqual",w.notDeepEqual)},w.notDeepStrictEqual=p,w.strictEqual=function(t,e,n){t!==e&&u(t,e,n,"===",w.strictEqual)},w.notStrictEqual=function(t,e,n){t===e&&u(t,e,n,"!==",w.notStrictEqual)},w.throws=function(t,e,n){y(!0,t,e,n)},w.doesNotThrow=function(t,e,n){y(!1,t,e,n)},w.ifError=function(t){if(t)throw t};var k=Object.keys||function(t){var e=[];for(var n in t)g.call(t,n)&&e.push(n);return e}}).call(e,n(3))},function(t,e,n){e.asyncMap=n(148),e.bindActor=n(56),e.chain=n(149)},function(t,e,n){(function(e){t.exports=function(){function t(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(r.length>c){var l=r.slice(c);f+=(r.length-c)*o,c=r.length,e.nextTick(function(){l.forEach(function(e){n.forEach(function(n){n(e,t)})})})}0==--f&&i.apply(null,[a].concat(s))}var n=Array.prototype.slice.call(arguments),r=n.shift()||[],i=n.pop();if("function"!=typeof i)throw new Error("No callback provided to asyncMap");if(!r)return i(null,[]);Array.isArray(r)||(r=[r]);var o=n.length,s=[],a=null,c=r.length,f=c*o;if(!f)return i(null,[]);r.forEach(function(e){n.forEach(function(n){n(e,t)})})}}).call(e,n(0))},function(t,e,n){function r(t,e){var n=[];!function o(s,a){return s>=a?e(null,n):(Array.isArray(t[s])&&(t[s]=i.apply(null,t[s].map(function(t){return t===r.first?n[0]:t===r.last?n[n.length-1]:t}))),t[s]?void t[s](function(t,r){if(t)return e(t,n);void 0!==r&&(n=n.concat(r)),o(s+1,a)}):o(s+1,a))}(0,t.length)}t.exports=r;var i=n(56);r.first={},r.last={}},function(t,e,n){!function(){function e(t,r){var i=this instanceof e?this:n;if(i.reset(r),"string"==typeof t&&t.length>0&&i.hash(t),i!==this)return i}var n;e.prototype.hash=function(t){var e,n,r,i,o;switch(o=t.length,this.len+=o,n=this.k1,r=0,this.rem){case 0:n^=o>r?65535&t.charCodeAt(r++):0;case 1:n^=o>r?(65535&t.charCodeAt(r++))<<8:0;case 2:n^=o>r?(65535&t.charCodeAt(r++))<<16:0;case 3:n^=o>r?(255&t.charCodeAt(r))<<24:0,n^=o>r?(65280&t.charCodeAt(r++))>>8:0}if(this.rem=o+this.rem&3,(o-=this.rem)>0){for(e=this.h1;;){if(n=11601*n+3432906752*(65535&n)&4294967295,n=n<<15|n>>>17,n=13715*n+461832192*(65535&n)&4294967295,e^=n,e=e<<13|e>>>19,e=5*e+3864292196&4294967295,r>=o)break;n=65535&t.charCodeAt(r++)^(65535&t.charCodeAt(r++))<<8^(65535&t.charCodeAt(r++))<<16,n^=(255&(i=t.charCodeAt(r++)))<<24^(65280&i)>>8}switch(n=0,this.rem){case 3:n^=(65535&t.charCodeAt(r+2))<<16;case 2:n^=(65535&t.charCodeAt(r+1))<<8;case 1:n^=65535&t.charCodeAt(r)}this.h1=e}return this.k1=n,this},e.prototype.result=function(){var t,e;return t=this.k1,e=this.h1,t>0&&(e^=t=13715*(t=(t=11601*t+3432906752*(65535&t)&4294967295)<<15|t>>>17)+461832192*(65535&t)&4294967295),e^=this.len,e^=e>>>16,e=51819*e+2246770688*(65535&e)&4294967295,e^=e>>>13,e=44597*e+3266445312*(65535&e)&4294967295,(e^=e>>>16)>>>0},e.prototype.reset=function(t){return this.h1="number"==typeof t?t:0,this.rem=this.k1=this.len=0,this},n=new e,t.exports=e}()},function(t,e,n){"use strict";class r{constructor(t){this.id=t,this._index=[]}get(){return this._index}updateIndex(t,e){this._index=t.ops}}t.exports=r},function(t,e,n){const r=n(4).EventEmitter,i=n(40);class o extends r{constructor(t,e=8){super(),this._store=t,this._concurrency=e,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(t){try{this._stats.tasksRequested+=1,t.filter(t=>null!==t&&void 0!==t).sort((t,e)=>(t.clock?t.clock.time:0)-(e.clock?e.clock.time:0)).forEach(t=>{this._store._oplog.has(t.hash||t)||this._queue.find(e=>(e.hash||e)===(t.hash||t))||(this._queue.splice(0,0,t),this.emit("load.added",t))})}catch(t){console.error(t)}}async _processLoop(){if(this._queue.length>0&&this._tasksRunning<this._concurrency){this._tasksRunning++;try{const t=(()=>{this._queue=this._queue.filter(t=>!this._fetching[t.hash||t]);const t=this._queue.shift();return t&&(this._fetching[t.hash||t]=t),t})();if(t){const e=t.hash||t,n=this._store._oplog.values;this._have=Object.assign({},this._have,this._store._replicationInfo.have),this.emit("load.start",t,this._have);const r=await i.fromEntryHash(this._store._ipfs,e,this._store._oplog.id,1,n,this._store.key,this._store.access.write,this._onSyncProgress.bind(this));this._stats.tasksProcessed+=1,delete this._fetching[e],r.values.forEach(t=>{t.next.length>0&&this.load(t.next)}),this.emit("load.end",r,this._have)}}catch(t){console.error("LOADER-ERROR:",t),this.emit("error",t)}this._tasksRunning--,this.emit("load.complete",this._have)}}_onSyncProgress(t,e,n){this._have[e.clock.time]||(this._have[e.clock.time]=!0,this.emit("load.progress",this._id,t,e,n,this._have))}}t.exports=o},function(t,e,n){"use strict";const r=n(4).EventEmitter;class i extends r{constructor(t,e=1e3){super(),this._loader=t,this._oplog=null,this._interval=e,this._timer=null}start(){this._timer=setInterval(()=>this._checkReplicationStatus(),this._interval)}stop(){clearInterval(this._timer)}replicate(t){this._oplog=t}async _checkReplicationStatus(){if(this._oplog&&0===this._loader._queue.length){this._oplog.tails.filter(t=>t.next.length>0).sort((t,e)=>t.clock.time-e.clock.time).reduce((t,e)=>t.concat(e.next),[]).reduce((t,e)=>(t.includes(e)||t.push(e),t),[]).forEach(t=>{this._loader.load([t])})}}}t.exports=i},function(t,e,n){"use strict";class r{constructor(){this._index=[]}get(){return this._index.values?this._index.values:[]}updateIndex(t){this._index=t}}t.exports=r},function(t,e,n){"use strict";const r=n(34),i=n(156);class o extends r{constructor(t,e,n,r){r||(r={}),r.Index||Object.assign(r,{Index:i}),super(t,e,n,r),this._type="feed"}remove(t){return this.del(t)}del(t){const e={op:"DEL",key:null,value:t};return this._addOperation(e)}}t.exports=o},function(t,e,n){"use strict";class r{constructor(){this._index={}}get(){return Object.keys(this._index).map(t=>this._index[t])}updateIndex(t){this._index={},t.values.reduce((t,e)=>(t.includes(e.hash)||(t.push(e.hash),"ADD"===e.payload.op?this._index[e.hash]=e:"DEL"===e.payload.op&&delete this._index[e.payload.value]),t),[])}}t.exports=r},function(t,e,n){"use strict";const r=n(19),i=n(158);class o extends r{constructor(t,e,n,r){let o=Object.assign({},{Index:i});Object.assign(o,r),super(t,e,n,o),this._type="keyvalue"}get(t){return this._index.get(t)}set(t,e){return this.put(t,e)}put(t,e){return this._addOperation({op:"PUT",key:t,value:e})}del(t){return this._addOperation({op:"DEL",key:t,value:null})}}t.exports=o},function(t,e,n){"use strict";class r{constructor(){this._index={}}get(t){return this._index[t]}updateIndex(t){t.values.slice().reverse().reduce((t,e)=>(t.includes(e.payload.key)||(t.push(e.payload.key),"PUT"===e.payload.op?this._index[e.payload.key]=e.payload.value:"DEL"===e.payload.op&&delete this._index[e.payload.key]),t),[])}}t.exports=r},function(t,e,n){"use strict";const r=n(19),i=n(160);class o extends r{constructor(t,e,n,r={}){r.Index||Object.assign(r,{Index:i}),super(t,e,n,r),this._type="counter"}get value(){return this._index.get().value}inc(t){const e=this._index.get();if(e)return e.increment(t),this._addOperation({op:"COUNTER",key:null,value:e.payload})}}t.exports=o},function(t,e,n){"use strict";const r=n(161);class i{constructor(t){this._index=new r(t)}get(){return this._index}updateIndex(t){this._index&&t.values.filter(t=>t&&"COUNTER"===t.payload.op).map(t=>r.from(t.payload.value)).forEach(t=>this._index.merge(t))}}t.exports=i},function(t,e,n){"use strict";const r=n(162).isEqual;class i{constructor(t,e){this.id=t,this._counters=e||{},this._counters[this.id]=this._counters[this.id]?this._counters[this.id]:0}increment(t){t||(t=1),this._counters[this.id]=this._counters[this.id]+t}get value(){return Object.keys(this._counters).map(t=>this._counters[t]).reduce((t,e)=>t+e,0)}get payload(){return{id:this.id,counters:this._counters}}compare(t){return t.id===this.id&&r(t._counters,this._counters)}merge(t){Object.keys(t._counters).forEach(e=>{this._counters[e]=Math.max(this._counters[e]?this._counters[e]:0,t._counters[e])})}static from(t){return new i(t.id,t.counters)}}t.exports=i},function(t,e,n){"use strict";e.isEqual=((t,e)=>{const n=Object.getOwnPropertyNames(t),r=Object.getOwnPropertyNames(e);if(n.length!==r.length)return!1;for(let r=0;r<n.length;r++){const i=n[r];if(t[i]!==e[i])return!1}return!0})},function(t,e,n){"use strict";const r=n(19),i=n(164),o=n(21),s=(n(13),(t,e,n)=>t.toString().split(e).join(n));class a extends r{constructor(t,e,n,r){r||(r={}),r.indexBy||Object.assign(r,{indexBy:"_id"}),r.Index||Object.assign(r,{Index:i}),super(t,e,n,r),this._type="docstore"}get(t,e=!1){const n=(t=t.toString()).split(" ");t=n.length>1?s(t,"."," ").toLowerCase():t.toLowerCase();return Object.keys(this._index._index).filter(r=>e?-1!==r.indexOf(t):(e=>n.length>1?-1!==s(e,"."," ").toLowerCase().indexOf(t):-1!==e.toLowerCase().indexOf(t))(r)).map(t=>this._index.get(t))}query(t){return Object.keys(this._index._index).map(t=>this._index.get(t)).filter(e=>t(e))}batchPut(t,e){return o(t,(n,r)=>this._addOperationBatch({op:"PUT",key:n[this.options.indexBy],value:n},!0,r===t.length-1,e),{concurrency:1}).then(()=>this.saveSnapshot())}put(t){if(!t[this.options.indexBy])throw new Error(`The provided document doesn't contain field '${this.options.indexBy}'`);return this._addOperation({op:"PUT",key:t[this.options.indexBy],value:t})}del(t){if(!this._index.get(t))throw new Error(`No entry with key '${t}' in the database`);return this._addOperation({op:"DEL",key:t,value:null})}}t.exports=a},function(t,e,n){"use strict";class r{constructor(){this._index={}}get(t){return this._index[t]}updateIndex(t,e){t.values.slice().reverse().reduce((t,n,r)=>(!0!==t[n.payload.key]&&(t[n.payload.key]=!0,"PUT"===n.payload.op?this._index[n.payload.key]=n.payload.value:"DEL"===n.payload.op&&delete this._index[n.payload.key]),e&&e(n,r),t),{})}}t.exports=r},function(t,e,n){t.exports=n(166)},function(t,e,n){"use strict";(function(e){const r=n(167),i=n(60),o=i.create("orbit-db.ipfs-pubsub");i.setLogLevel("ERROR");let s=0;class a{constructor(t,e){this._ipfs=t,this._id=e,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(256)}subscribe(t,e,n){if(!this._subscriptions[t]){const i=r(this._ipfs,t);i.on("error",t=>{o.error("Pubsub Error:",t)}),i.on("message",t=>{this._handleMessage(t)}),i.on("peer joined",e=>{this._subscriptions[t].onNewPeer(t,e,i)}),i.on("subscribed",()=>{this._subscriptions[t]={room:i,onMessage:e,onNewPeer:n},s++,o.debug("Topics open:",s)})}}unsubscribe(t){this._subscriptions[t]&&(this._subscriptions[t].room.leave(),this._subscriptions[t].room=null,delete this._subscriptions[t],o.debug(`Unsubscribed from '${t}'`),s--,o.debug("Topics open:",s))}publish(t,n){this._subscriptions[t]&&this._subscriptions[t].room&&this._ipfs.pubsub&&this._subscriptions[t].room.broadcast(new e(JSON.stringify(n)))}disconnect(){Object.keys(this._subscriptions).forEach(t=>this.unsubscribe(t)),this._subscriptions={}}_handleMessage(t){if(t.from===this._id)return;const e=t.topicCIDs[0];let n,r;try{n=JSON.parse(t.data),r=this._subscriptions[e]}catch(e){console.error("Couldn't parse pubsub message:",t.data)}r&&r.onMessage&&n&&r.onMessage(e,n)}}t.exports=a}).call(e,n(1).Buffer)},function(t,e,n){"use strict";(function(e){const r=n(168),i=n(4),o=n(11),s=n(57),a=n(22),c=n(58),f=n(173),u=n(59),h={pollInterval:1e3};t.exports=((t,e,n)=>new d(t,e,n));class d extends i{constructor(t,e,n){if(super(),this._ipfs=t,this._topic=e,this._options=Object.assign({},s(h),s(n)),this._peers=[],this._connections={},!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(t){return this._peers.indexOf(t)>=0}leave(){o.clearInterval(),clearInterval(this._interval),Object.keys(this._connections).forEach(t=>{this._connections[t].stop(),delete this._connections[t]}),this.emit("stop")}broadcast(t){let e=u(t);this._ipfs.pubsub.publish(this._topic,e,t=>{t&&this.emit("error",t)})}sendTo(t,e){let n=this._connections[t];n||((n=new f(t,this._ipfs,this)).on("error",t=>this.emit("error",t)),this._connections[t]=n),n.push(e)}_start(){this._interval=o.setInterval(this._pollPeers.bind(this),this._options.pollInterval);const t=this._onMessage.bind(this);this._ipfs.pubsub.subscribe(this._topic,t,t=>{t?this.emit("error",t):this.emit("subscribed",this._topic)}),this.once("stop",()=>{this._ipfs.state.stopped()&&this._ipfs.pubsub.unsubscribe(this._topic,t)}),this._ipfs._libp2pNode.handle(c,this._handleDirectConnection.bind(this))}_pollPeers(){this._ipfs.pubsub.peers(this._topic,(t,e)=>{if(t)return void this.emit("error",t);const n=e.sort();this._emitChanges(n)&&(this._peers=n)})}_emitChanges(t){const e=r(this._peers,t);return e.added.forEach(t=>this.emit("peer joined",t)),e.removed.forEach(t=>this.emit("peer left",t)),e.added.length>0||e.removed.length>0}_onMessage(t){this.emit("message",t)}_handleDirectConnection(t,n){n.getPeerInfo((t,r)=>{if(t)throw t;const i=r.id.toB58String();a(n,a.map(t=>{const n=e.from([0]);return this.emit("message",{from:i,data:t,seqno:n,topicCIDs:[this._topic]}),t}),a.onEnd(t=>{t&&this.emit("warning",t)}))})}}}).call(e,n(1).Buffer)},function(t,e,n){"use strict";const r=n(57),i=n(169)("hyperdiff"),o=n(172),s=t=>-1!==t;t.exports=function(t,e,n){const{first:a,second:c}={first:t,second:r(e)},f=n?function(t,e,n){return t.findIndex(function(t){return function(t,e,r){return n.every(n=>e[n]===t[n])}(t,e)})}:function(t,e,n){return t.indexOf(e)};i("preconditions first=%j second=%j findIndex=%s",a,c,f.name);const u=a.reduce(function(t,e,r){const a=f(c,e,n),u=s(a)?"common":"removed";return t[u].push(e),o(c,a),i("index=%s value=%s collection=%s",r,e,u),t},{common:[],removed:[]});return u.added=c,i("added=%j removed=%j common%j",u.added,u.removed,u.common),u}},function(t,e,n){(function(r){function i(){var t;try{t=e.storage.debug}catch(t){}return!t&&void 0!==r&&"env"in r&&(t=Object({NODE_ENV:void 0}).DEBUG),t}(e=t.exports=n(170)).log=function(){return"object"==typeof console&&console.log&&Function.prototype.apply.call(console.log,console,arguments)},e.formatArgs=function(t){var n=this.useColors;if(t[0]=(n?"%c":"")+this.namespace+(n?" %c":" ")+t[0]+(n?"%c ":" ")+"+"+e.humanize(this.diff),n){var r="color: "+this.color;t.splice(1,0,r,"color: inherit");var i=0,o=0;t[0].replace(/%[a-zA-Z%]/g,function(t){"%%"!==t&&(i++,"%c"===t&&(o=i))}),t.splice(o,0,r)}},e.save=function(t){try{null==t?e.storage.removeItem("debug"):e.storage.debug=t}catch(t){}},e.load=i,e.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+)/))},e.storage="undefined"!=typeof chrome&&void 0!==chrome.storage?chrome.storage.local:function(){try{return window.localStorage}catch(t){}}(),e.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"],e.formatters.j=function(t){try{return JSON.stringify(t)}catch(t){return"[UnexpectedJSONParseError]: "+t.message}},e.enable(i())}).call(e,n(0))},function(t,e,n){function r(t){function n(){if(n.enabled){var t=n,i=+new Date,o=i-(r||i);t.diff=o,t.prev=r,t.curr=i,r=i;for(var s=new Array(arguments.length),a=0;a<s.length;a++)s[a]=arguments[a];s[0]=e.coerce(s[0]),"string"!=typeof s[0]&&s.unshift("%O");var c=0;s[0]=s[0].replace(/%([a-zA-Z%])/g,function(n,r){if("%%"===n)return n;c++;var i=e.formatters[r];if("function"==typeof i){var o=s[c];n=i.call(t,o),s.splice(c,1),c--}return n}),e.formatArgs.call(t,s);(n.log||e.log||console.log.bind(console)).apply(t,s)}}var r;return n.namespace=t,n.enabled=e.enabled(t),n.useColors=e.useColors(),n.color=function(t){var n,r=0;for(n in t)r=(r<<5)-r+t.charCodeAt(n),r|=0;return e.colors[Math.abs(r)%e.colors.length]}(t),n.destroy=i,"function"==typeof e.init&&e.init(n),e.instances.push(n),n}function i(){var t=e.instances.indexOf(this);return-1!==t&&(e.instances.splice(t,1),!0)}(e=t.exports=r.debug=r.default=r).coerce=function(t){return t instanceof Error?t.stack||t.message:t},e.disable=function(){e.enable("")},e.enable=function(t){e.save(t),e.names=[],e.skips=[];var n,r=("string"==typeof t?t:"").split(/[\s,]+/),i=r.length;for(n=0;n<i;n++)r[n]&&("-"===(t=r[n].replace(/\*/g,".*?"))[0]?e.skips.push(new RegExp("^"+t.substr(1)+"$")):e.names.push(new RegExp("^"+t+"$")));for(n=0;n<e.instances.length;n++){var o=e.instances[n];o.enabled=e.enabled(o.namespace)}},e.enabled=function(t){if("*"===t[t.length-1])return!0;var n,r;for(n=0,r=e.skips.length;n<r;n++)if(e.skips[n].test(t))return!1;for(n=0,r=e.names.length;n<r;n++)if(e.names[n].test(t))return!0;return!1},e.humanize=n(171),e.instances=[],e.names=[],e.skips=[],e.formatters={}},function(t,e){function n(t,e,n){if(!(t<e))return t<1.5*e?Math.floor(t/e)+" "+n:Math.ceil(t/e)+" "+n+"s"}var r=1e3,i=60*r,o=60*i,s=24*o,a=365.25*s;t.exports=function(t,e){e=e||{};var c=typeof t;if("string"===c&&t.length>0)return function(t){if(!((t=String(t)).length>100)){var e=/^((?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|years?|yrs?|y)?$/i.exec(t);if(e){var n=parseFloat(e[1]);switch((e[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return n*a;case"days":case"day":case"d":return n*s;case"hours":case"hour":case"hrs":case"hr":case"h":return n*o;case"minutes":case"minute":case"mins":case"min":case"m":return n*i;case"seconds":case"second":case"secs":case"sec":case"s":return n*r;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return n;default:return}}}}(t);if("number"===c&&!1===isNaN(t))return e.long?function(t){return n(t,s,"day")||n(t,o,"hour")||n(t,i,"minute")||n(t,r,"second")||t+" ms"}(t):function(t){return t>=s?Math.round(t/s)+"d":t>=o?Math.round(t/o)+"h":t>=i?Math.round(t/i)+"m":t>=r?Math.round(t/r)+"s":t+"ms"}(t);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(t))}},function(t,e,n){(function(e){function n(t,e){for(var n=-1,r=e.length,i=t.length;++n<r;)t[i+n]=e[n];return t}function r(t){var e=-1,n=t?t.length:0;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}function i(t){var e=-1,n=t?t.length:0;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}function o(t){var e=-1,n=t?t.length:0;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}function s(t,e){for(var n=t.length;n--;)if(function(t,e){return t===e||t!=t&&e!=e}(t[n][0],e))return n;return-1}function a(t,e){for(var n=-1,r=null==t,i=e.length,o=Array(i);++n<i;)o[n]=r?void 0:function(t,e,n){var r=null==t?void 0:f(t,e);return void 0===r?n:r}(t,e[n]);return o}function c(t,e,r,i,o){var s=-1,a=t.length;for(r||(r=y),o||(o=[]);++s<a;){var f=t[s];e>0&&r(f)?e>1?c(f,e-1,r,i,o):n(o,f):i||(o[o.length]=f)}return o}function f(t,e){for(var n=0,r=(e=g(e,t)?[e]:d(e)).length;null!=t&&n<r;)t=t[v(e[n++])];return n&&n==r?t:void 0}function u(t){if(!S(t)||function(t){return!!J&&J in t}(t))return!1;return(w(t)||function(t){var e=!1;if(null!=t&&"function"!=typeof t.toString)try{e=!!(t+"")}catch(t){}return e}(t)?Z:F).test(function(t){if(null!=t){try{return $.call(t)}catch(t){}try{return t+""}catch(t){}}return""}(t))}function h(t,e){for(var n=t?e.length:0,r=n-1;n--;){var i=e[n];if(n==r||i!==o){var o=i;if(m(i))et.call(t,i,1);else if(g(i,t))delete t[v(i)];else{var s=d(i),a=function(t,e){return 1==e.length?t:f(t,function(t,e,n){var r=-1,i=t.length;e<0&&(e=-e>i?0:i+e);(n=n>i?i:n)<0&&(n+=i);i=e>n?0:n-e>>>0,e>>>=0;var o=Array(i);for(;++r<i;)o[r]=t[r+e];return o}(e,0,-1))}(t,s);null!=a&&delete a[v(function(t){var e=t?t.length:0;return e?t[e-1]:void 0}(s))]}}}return t}function d(t){return ut(t)?t:ct(t)}function l(t,e){if(t!==e){var n=void 0!==t,r=null===t,i=t==t,o=x(t),s=void 0!==e,a=null===e,c=e==e,f=x(e);if(!a&&!f&&!o&&t>e||o&&s&&c&&!a&&!f||r&&s&&c||!n&&c||!i)return 1;if(!r&&!o&&!f&&t<e||f&&n&&i&&!r&&!o||a&&n&&i||!s&&i||!c)return-1}return 0}function p(t,e){var n=t.__data__;return function(t){var e=typeof t;return"string"==e||"number"==e||"symbol"==e||"boolean"==e?"__proto__"!==t:null===t}(e)?n["string"==typeof e?"string":"hash"]:n.map}function b(t,e){var n=function(t,e){return null==t?void 0:t[e]}(t,e);return u(n)?n:void 0}function y(t){return ut(t)||function(t){return function(t){return k(t)&&function(t){return null!=t&&function(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=I}(t.length)&&!w(t)}(t)}(t)&&V.call(t,"callee")&&(!tt.call(t,"callee")||X.call(t)==P)}(t)||!!(nt&&t&&t[nt])}function m(t,e){return!!(e=null==e?I:e)&&("number"==typeof t||q.test(t))&&t>-1&&t%1==0&&t<e}function g(t,e){if(ut(t))return!1;var n=typeof t;return!("number"!=n&&"symbol"!=n&&"boolean"!=n&&null!=t&&!x(t))||(T.test(t)||!j.test(t)||null!=e&&t in Object(e))}function v(t){if("string"==typeof t||x(t))return t;var e=t+"";return"0"==e&&1/t==-O?"-0":e}function _(t,e){if("function"!=typeof t||e&&"function"!=typeof e)throw new TypeError(M);var n=function(){var r=arguments,i=e?e.apply(this,r):r[0],o=n.cache;if(o.has(i))return o.get(i);var s=t.apply(this,r);return n.cache=o.set(i,s),s};return n.cache=new(_.Cache||o),n}function w(t){var e=S(t)?X.call(t):"";return e==C||e==N}function S(t){var e=typeof t;return!!t&&("object"==e||"function"==e)}function k(t){return!!t&&"object"==typeof t}function x(t){return"symbol"==typeof t||k(t)&&X.call(t)==R}function E(t){return null==t?"":function(t){if("string"==typeof t)return t;if(x(t))return at?at.call(t):"";var e=t+"";return"0"==e&&1/t==-O?"-0":e}(t)}var M="Expected a function",A="__lodash_hash_undefined__",O=1/0,I=9007199254740991,P="[object Arguments]",C="[object Function]",N="[object GeneratorFunction]",R="[object Symbol]",j=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,T=/^\w*$/,L=/^\./,D=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,B=/\\(\\)?/g,F=/^\[object .+?Constructor\]$/,q=/^(?:0|[1-9]\d*)$/,U="object"==typeof e&&e&&e.Object===Object&&e,z="object"==typeof self&&self&&self.Object===Object&&self,K=U||z||Function("return this")(),G=Array.prototype,H=Function.prototype,Y=Object.prototype,W=K["__core-js_shared__"],J=function(){var t=/[^.]+$/.exec(W&&W.keys&&W.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""}(),$=H.toString,V=Y.hasOwnProperty,X=Y.toString,Z=RegExp("^"+$.call(V).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Q=K.Symbol,tt=Y.propertyIsEnumerable,et=G.splice,nt=Q?Q.isConcatSpreadable:void 0,rt=Math.max,it=b(K,"Map"),ot=b(Object,"create"),st=Q?Q.prototype:void 0,at=st?st.toString:void 0;r.prototype.clear=function(){this.__data__=ot?ot(null):{}},r.prototype.delete=function(t){return this.has(t)&&delete this.__data__[t]},r.prototype.get=function(t){var e=this.__data__;if(ot){var n=e[t];return n===A?void 0:n}return V.call(e,t)?e[t]:void 0},r.prototype.has=function(t){var e=this.__data__;return ot?void 0!==e[t]:V.call(e,t)},r.prototype.set=function(t,e){return this.__data__[t]=ot&&void 0===e?A:e,this},i.prototype.clear=function(){this.__data__=[]},i.prototype.delete=function(t){var e=this.__data__,n=s(e,t);return!(n<0||(n==e.length-1?e.pop():et.call(e,n,1),0))},i.prototype.get=function(t){var e=this.__data__,n=s(e,t);return n<0?void 0:e[n][1]},i.prototype.has=function(t){return s(this.__data__,t)>-1},i.prototype.set=function(t,e){var n=this.__data__,r=s(n,t);return r<0?n.push([t,e]):n[r][1]=e,this},o.prototype.clear=function(){this.__data__={hash:new r,map:new(it||i),string:new r}},o.prototype.delete=function(t){return p(this,t).delete(t)},o.prototype.get=function(t){return p(this,t).get(t)},o.prototype.has=function(t){return p(this,t).has(t)},o.prototype.set=function(t,e){return p(this,t).set(t,e),this};var ct=_(function(t){t=E(t);var e=[];return L.test(t)&&e.push(""),t.replace(D,function(t,n,r,i){e.push(r?i.replace(B,"$1"):n||t)}),e}),ft=function(t,e){return e=rt(void 0===e?t.length-1:e,0),function(){for(var n=arguments,r=-1,i=rt(n.length-e,0),o=Array(i);++r<i;)o[r]=n[e+r];r=-1;for(var s=Array(e+1);++r<e;)s[r]=n[r];return s[e]=o,function(t,e,n){switch(n.length){case 0:return t.call(e);case 1:return t.call(e,n[0]);case 2:return t.call(e,n[0],n[1]);case 3:return t.call(e,n[0],n[1],n[2])}return t.apply(e,n)}(t,this,s)}}(function(t,e){e=c(e,1);var n=t?t.length:0,r=a(t,e);return h(t,function(t,e){for(var n=-1,r=t?t.length:0,i=Array(r);++n<r;)i[n]=e(t[n],n,t);return i}(e,function(t){return m(t,n)?+t:t}).sort(l)),r});_.Cache=o;var ut=Array.isArray;t.exports=ft}).call(e,n(3))},function(t,e,n){"use strict";const r=n(4),i=n(22),o=n(48),s=n(58),a=n(59);t.exports=class extends r{constructor(t,e,n){super(),this._id=t,this._ipfs=e,this._room=n,this._connection=null,this._connecting=!1,this._closed=!1}push(t){this._connection?this._connection.push(a(t)):(this._connecting||this._getConnection(),this.once("connect",()=>{this.push(t)}))}stop(){this._connection&&this._connection.end()}_getConnection(){this._connecting=!0,this._getPeerAddresses(this._id,(t,e)=>{t?this.emit("error",t):e.length?this._ipfs._libp2pNode.dial(e[0],s,(t,e)=>{if(t)return void this.emit("error",t);this._connecting=!1;const n=o(!1,t=>{this._closed=!0,t&&this.emit("error",t)});this._connection=n,i(n,e,i.onEnd(t=>{delete this._connection,t&&!this._closed&&this.emit("error",t)})),this.emit("connect",n)}):this.emit("error",new Error("could not connect to "+this._id))})}_getPeerAddresses(t,e){this._ipfs.swarm.peers((n,r)=>{n?e(n):e(null,r.filter(e=>e.peer.id.toB58String()===t).map(t=>t.peer))})}}},function(t,e,n){"use strict";(function(e){const r=n(175);class i extends r{constructor(t){super(),this._ipfs=t}async load(t){0===t.indexOf("/ipfs")&&(t=t.split("/")[2]);try{const e=await this._ipfs.object.get(t),n=JSON.parse(e.toJSON().data);this._access=n}catch(t){console.log("ACCESS ERROR:",t)}}async save(){let t;try{const n=JSON.stringify(this._access,null,2);t=(await this._ipfs.object.put(new e(n))).toJSON().multihash.toString()}catch(t){console.log("ACCESS ERROR:",t)}return t}}t.exports=i}).call(e,n(1).Buffer)},function(t,e,n){"use strict";class r{constructor(){this._access={admin:[],write:[],read:[]}}async load(t){}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(t,e){switch(t){case"admin":this._access.admin.push(e);break;case"write":this._access.write.push(e);break;case"read":this._access.read.push(e)}}remove(t,e){const n=(t,n)=>{return t.reduce((t,n)=>(n!==e&&t.push(n),t),[])};switch(t){case"admin":this._access.admin=n(this._access.admin);break;case"write":this._access.write=n(this._access.write);break;case"read":this._access.read=n(this._access.read)}}}t.exports=r},function(t,e,n){"use strict";const r=n(12),i=n(177);class o{constructor(t,e){this.root=t,this.path=e}toString(){return r.join("/orbitdb",this.root,this.path)}static isValid(t){const e=t.toString().split("/").filter((e,n)=>!((0===n||1===n)&&0===t.toString().indexOf("/orbit")&&"orbitdb"===e)).filter(t=>""!==t&&" "!==t),n=e[0].indexOf("Qm")>-1?i.fromB58String(e[0]):null;try{i.validate(n)}catch(t){return!1}return null!==n}static parse(t){if(!t)throw new Error(`Not a valid OrbitDB address: ${t}`);if(!o.isValid(t))throw new Error(`Not a valid OrbitDB address: ${t}`);const e=t.toString().split("/").filter((e,n)=>!((0===n||1===n)&&0===t.toString().indexOf("/orbit")&&"orbitdb"===e)).filter(t=>""!==t&&" "!==t);return new o(e[0],e.slice(1,e.length).join("/"))}}t.exports=o},function(t,e,n){"use strict";(function(t){function r(t){e.decode(t)}const i=n(178),o=n(180);e.names=o.names,e.codes=o.codes,e.defaultLengths=o.defaultLengths;const s=n(181);e.toHexString=function(e){if(!t.isBuffer(e))throw new Error("must be passed a buffer");return e.toString("hex")},e.fromHexString=function(e){return t.from(e,"hex")},e.toB58String=function(e){if(!t.isBuffer(e))throw new Error("must be passed a buffer");return i.encode(e)},e.fromB58String=function(e){let n=e;return t.isBuffer(e)&&(n=e.toString()),t.from(i.decode(n))},e.decode=function(n){if(!t.isBuffer(n))throw new Error("multihash must be a Buffer");if(n.length<3)throw new Error("multihash too short. must be > 3 bytes.");let r=s.decode(n);if(!e.isValidCode(r))throw new Error(`multihash unknown function code: 0x${r.toString(16)}`);n=n.slice(s.decode.bytes);let i=s.decode(n);if(i<1)throw new Error(`multihash invalid length: 0x${i.toString(16)}`);if((n=n.slice(s.decode.bytes)).length!==i)throw new Error(`multihash length inconsistent: 0x${n.toString("hex")}`);return{code:r,name:o.codes[r],length:i,digest:n}},e.encode=function(n,r,i){if(!n||!r)throw new Error("multihash encode requires at least two args: digest, code");const o=e.coerceCode(r);if(!t.isBuffer(n))throw new Error("digest should be a Buffer");if(null==i&&(i=n.length),i&&n.length!==i)throw new Error("digest length should be equal to specified length.");return t.concat([t.from(s.encode(o)),t.from(s.encode(i)),n])},e.coerceCode=function(t){let n=t;if("string"==typeof t){if(!o.names[t])throw new Error(`Unrecognized hash function named: ${t}`);n=o.names[t]}if("number"!=typeof n)throw new Error(`Hash function code should be a number. Got: ${n}`);if(!o.codes[n]&&!e.isAppCode(n))throw new Error(`Unrecognized function code: ${n}`);return n},e.isAppCode=function(t){return t>0&&t<16},e.isValidCode=function(t){return!!e.isAppCode(t)||!!o.codes[t]},e.validate=r,e.prefix=function(t){return r(t),t.slice(0,2)}}).call(e,n(1).Buffer)},function(t,e,n){var r=n(179);t.exports=r("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz")},function(t,e,n){var r=n(10).Buffer;t.exports=function(t){function e(t){if(0===t.length)return r.allocUnsafe(0);for(var e=[0],s=0;s<t.length;s++){var a=n[t[s]];if(void 0===a)return;for(var c=0,f=a;c<e.length;++c)f+=e[c]*i,e[c]=255&f,f>>=8;for(;f>0;)e.push(255&f),f>>=8}for(var u=0;t[u]===o&&u<t.length-1;++u)e.push(0);return r.from(e.reverse())}for(var n={},i=t.length,o=t.charAt(0),s=0;s<t.length;s++){var a=t.charAt(s);if(void 0!==n[a])throw new TypeError(a+" is ambiguous");n[a]=s}return{encode:function(e){if(0===e.length)return"";for(var n=[0],r=0;r<e.length;++r){for(var o=0,s=e[r];o<n.length;++o)s+=n[o]<<8,n[o]=s%i,s=s/i|0;for(;s>0;)n.push(s%i),s=s/i|0}for(var a="",c=0;0===e[c]&&c<e.length-1;++c)a+=t[0];for(var f=n.length-1;f>=0;--f)a+=t[n[f]];return a},decodeUnsafe:e,decode:function(t){var n=e(t);if(n)return n;throw new Error("Non-base"+i+" character")}}}},function(t,e,n){"use strict";e.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}),e.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"}),e.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(t,e,n){t.exports={encode:n(182),decode:n(183),encodingLength:n(184)}},function(t,e){function n(t,e,s){e=e||[];for(var a=s=s||0;t>=o;)e[s++]=255&t|r,t/=128;for(;t&i;)e[s++]=255&t|r,t>>>=7;return e[s]=0|t,n.bytes=s-a+1,e}t.exports=n;var r=128,i=-128,o=Math.pow(2,31)},function(t,e){function n(t,e){var o,s=0,a=0,c=e=e||0,f=t.length;do{if(c>=f)throw n.bytes=0,new RangeError("Could not decode varint");o=t[c++],s+=a<28?(o&i)<<a:(o&i)*Math.pow(2,a),a+=7}while(o>=r);return n.bytes=c-e,s}t.exports=n;var r=128,i=127},function(t,e){var n=Math.pow(2,7),r=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);t.exports=function(t){return t<n?1:t<r?2:t<i?3:t<o?4:t<s?5:t<a?6:t<c?7:t<f?8:t<u?9:10}}]); |