From 15e9ed8f23be49e616ef7057e37753d458763612 Mon Sep 17 00:00:00 2001 From: haad Date: Sun, 31 Dec 2017 17:57:49 +0200 Subject: [PATCH] Remove dist/ from git repo --- dist/orbitdb.min.js | 1 - 1 file changed, 1 deletion(-) delete mode 100644 dist/orbitdb.min.js diff --git a/dist/orbitdb.min.js b/dist/orbitdb.min.js deleted file mode 100644 index 7396e6b..0000000 --- a/dist/orbitdb.min.js +++ /dev/null @@ -1 +0,0 @@ -var OrbitDB=function(e){function t(n){if(r[n])return r[n].exports;var i=r[n]={i:n,l:!1,exports:{}};return e[n].call(i.exports,i,i.exports,t),i.l=!0,i.exports}var r={};return t.m=e,t.c=r,t.d=function(e,r,n){t.o(e,r)||Object.defineProperty(e,r,{configurable:!1,enumerable:!0,get:n})},t.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(r,"a",r),r},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=57)}([function(e,t,r){"use strict";(function(e){function n(){return o.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function i(e,t){if(n()=n())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+n().toString(16)+" bytes");return 0|e}function h(e,t){if(o.isBuffer(e))return e.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(e)||e instanceof ArrayBuffer))return e.byteLength;"string"!=typeof e&&(e=""+e);var r=e.length;if(0===r)return 0;for(var n=!1;;)switch(t){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":case void 0:return j(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return R(e).length;default:if(n)return j(e).length;t=(""+t).toLowerCase(),n=!0}}function d(e,t,r){var n=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if(r>>>=0,t>>>=0,r<=t)return"";for(e||(e="utf8");;)switch(e){case"hex":return function(e,t,r){var n=e.length;(!t||t<0)&&(t=0);(!r||r<0||r>n)&&(r=n);for(var i="",o=t;o2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,isNaN(r)&&(r=i?0:e.length-1),r<0&&(r=e.length+r),r>=e.length){if(i)return-1;r=e.length-1}else if(r<0){if(!i)return-1;r=0}if("string"==typeof t&&(t=o.from(t,n)),o.isBuffer(t))return 0===t.length?-1:b(e,t,r,n,i);if("number"==typeof t)return t&=255,o.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(e,t,r):Uint8Array.prototype.lastIndexOf.call(e,t,r):b(e,[t],r,n,i);throw new TypeError("val must be string, number or Buffer")}function b(e,t,r,n,i){function o(e,t){return 1===s?e[t]:e.readUInt16BE(t*s)}var s=1,a=e.length,f=t.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(e.length<2||t.length<2)return-1;s=2,a/=2,f/=2,r/=2}var c;if(i){var u=-1;for(c=r;ca&&(r=a-f),c=r;c>=0;c--){for(var h=!0,d=0;di&&(n=i):n=i;var o=t.length;if(o%2!=0)throw new TypeError("Invalid hex string");n>o/2&&(n=o/2);for(var s=0;s>8,i=r%256,o.push(i),o.push(n);return o}(t,e.length-r),e,r,n)}function S(e,t,r){r=Math.min(e.length,r);for(var n=[],i=t;i239?4:o>223?3:o>191?2:1;if(i+a<=r){var f,c,u,h;switch(a){case 1:o<128&&(s=o);break;case 2:128==(192&(f=e[i+1]))&&(h=(31&o)<<6|63&f)>127&&(s=h);break;case 3:f=e[i+1],c=e[i+2],128==(192&f)&&128==(192&c)&&(h=(15&o)<<12|(63&f)<<6|63&c)>2047&&(h<55296||h>57343)&&(s=h);break;case 4:f=e[i+1],c=e[i+2],u=e[i+3],128==(192&f)&&128==(192&c)&&128==(192&u)&&(h=(15&o)<<18|(63&f)<<12|(63&c)<<6|63&u)>65535&&h<1114112&&(s=h)}}null===s?(s=65533,a=1):s>65535&&(s-=65536,n.push(s>>>10&1023|55296),s=56320|1023&s),n.push(s),i+=a}return function(e){var t=e.length;if(t<=L)return String.fromCharCode.apply(String,e);var r="",n=0;for(;nr)throw new RangeError("Trying to access beyond buffer length")}function x(e,t,r,n,i,s){if(!o.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>i||te.length)throw new RangeError("Index out of range")}function M(e,t,r,n){t<0&&(t=65535+t+1);for(var i=0,o=Math.min(e.length-r,2);i>>8*(n?i:1-i)}function E(e,t,r,n){t<0&&(t=4294967295+t+1);for(var i=0,o=Math.min(e.length-r,4);i>>8*(n?i:3-i)&255}function A(e,t,r,n,i,o){if(r+n>e.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function I(e,t,r,n,i){return i||A(e,0,r,4),N.write(e,t,r,n,23,4),r+4}function O(e,t,r,n,i){return i||A(e,0,r,8),N.write(e,t,r,n,52,8),r+8}function j(e,t){t=t||1/0;for(var r,n=e.length,i=null,o=[],s=0;s55295&&r<57344){if(!i){if(r>56319){(t-=3)>-1&&o.push(239,191,189);continue}if(s+1===n){(t-=3)>-1&&o.push(239,191,189);continue}i=r;continue}if(r<56320){(t-=3)>-1&&o.push(239,191,189),i=r;continue}r=65536+(i-55296<<10|r-56320)}else i&&(t-=3)>-1&&o.push(239,191,189);if(i=null,r<128){if((t-=1)<0)break;o.push(r)}else if(r<2048){if((t-=2)<0)break;o.push(r>>6|192,63&r|128)}else if(r<65536){if((t-=3)<0)break;o.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;o.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return o}function R(e){return C.toByteArray(function(e){if((e=function(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")}(e).replace(T,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function P(e,t,r,n){for(var i=0;i=t.length||i>=e.length);++i)t[i+r]=e[i];return i}var C=r(58),N=r(59),B=r(30);t.Buffer=o,t.SlowBuffer=function(e){return+e!=e&&(e=0),o.alloc(+e)},t.INSPECT_MAX_BYTES=50,o.TYPED_ARRAY_SUPPORT=void 0!==e.TYPED_ARRAY_SUPPORT?e.TYPED_ARRAY_SUPPORT:function(){try{var e=new Uint8Array(1);return e.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===e.foo()&&"function"==typeof e.subarray&&0===e.subarray(1,1).byteLength}catch(e){return!1}}(),t.kMaxLength=n(),o.poolSize=8192,o._augment=function(e){return e.__proto__=o.prototype,e},o.from=function(e,t,r){return s(null,e,t,r)},o.TYPED_ARRAY_SUPPORT&&(o.prototype.__proto__=Uint8Array.prototype,o.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&o[Symbol.species]===o&&Object.defineProperty(o,Symbol.species,{value:null,configurable:!0})),o.alloc=function(e,t,r){return function(e,t,r,n){return a(t),t<=0?i(e,t):void 0!==r?"string"==typeof n?i(e,t).fill(r,n):i(e,t).fill(r):i(e,t)}(null,e,t,r)},o.allocUnsafe=function(e){return f(null,e)},o.allocUnsafeSlow=function(e){return f(null,e)},o.isBuffer=function(e){return!(null==e||!e._isBuffer)},o.compare=function(e,t){if(!o.isBuffer(e)||!o.isBuffer(t))throw new TypeError("Arguments must be Buffers");if(e===t)return 0;for(var r=e.length,n=t.length,i=0,s=Math.min(r,n);i0&&(e=this.toString("hex",0,r).match(/.{2}/g).join(" "),this.length>r&&(e+=" ... ")),""},o.prototype.compare=function(e,t,r,n,i){if(!o.isBuffer(e))throw new TypeError("Argument must be a Buffer");if(void 0===t&&(t=0),void 0===r&&(r=e?e.length:0),void 0===n&&(n=0),void 0===i&&(i=this.length),t<0||r>e.length||n<0||i>this.length)throw new RangeError("out of range index");if(n>=i&&t>=r)return 0;if(n>=i)return-1;if(t>=r)return 1;if(t>>>=0,r>>>=0,n>>>=0,i>>>=0,this===e)return 0;for(var s=i-n,a=r-t,f=Math.min(s,a),c=this.slice(n,i),u=e.slice(t,r),h=0;hi)&&(r=i),e.length>0&&(r<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var o=!1;;)switch(n){case"hex":return g(this,e,t,r);case"utf8":case"utf-8":return y(this,e,t,r);case"ascii":return m(this,e,t,r);case"latin1":case"binary":return v(this,e,t,r);case"base64":return w(this,e,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return _(this,e,t,r);default:if(o)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),o=!0}},o.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var L=4096;o.prototype.slice=function(e,t){var r=this.length;e=~~e,t=void 0===t?r:~~t,e<0?(e+=r)<0&&(e=0):e>r&&(e=r),t<0?(t+=r)<0&&(t=0):t>r&&(t=r),t0&&(i*=256);)n+=this[e+--t]*i;return n},o.prototype.readUInt8=function(e,t){return t||k(e,1,this.length),this[e]},o.prototype.readUInt16LE=function(e,t){return t||k(e,2,this.length),this[e]|this[e+1]<<8},o.prototype.readUInt16BE=function(e,t){return t||k(e,2,this.length),this[e]<<8|this[e+1]},o.prototype.readUInt32LE=function(e,t){return t||k(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},o.prototype.readUInt32BE=function(e,t){return t||k(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},o.prototype.readIntLE=function(e,t,r){e|=0,t|=0,r||k(e,t,this.length);for(var n=this[e],i=1,o=0;++o=i&&(n-=Math.pow(2,8*t)),n},o.prototype.readIntBE=function(e,t,r){e|=0,t|=0,r||k(e,t,this.length);for(var n=t,i=1,o=this[e+--n];n>0&&(i*=256);)o+=this[e+--n]*i;return i*=128,o>=i&&(o-=Math.pow(2,8*t)),o},o.prototype.readInt8=function(e,t){return t||k(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},o.prototype.readInt16LE=function(e,t){t||k(e,2,this.length);var r=this[e]|this[e+1]<<8;return 32768&r?4294901760|r:r},o.prototype.readInt16BE=function(e,t){t||k(e,2,this.length);var r=this[e+1]|this[e]<<8;return 32768&r?4294901760|r:r},o.prototype.readInt32LE=function(e,t){return t||k(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},o.prototype.readInt32BE=function(e,t){return t||k(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},o.prototype.readFloatLE=function(e,t){return t||k(e,4,this.length),N.read(this,e,!0,23,4)},o.prototype.readFloatBE=function(e,t){return t||k(e,4,this.length),N.read(this,e,!1,23,4)},o.prototype.readDoubleLE=function(e,t){return t||k(e,8,this.length),N.read(this,e,!0,52,8)},o.prototype.readDoubleBE=function(e,t){return t||k(e,8,this.length),N.read(this,e,!1,52,8)},o.prototype.writeUIntLE=function(e,t,r,n){if(e=+e,t|=0,r|=0,!n){x(this,e,t,r,Math.pow(2,8*r)-1,0)}var i=1,o=0;for(this[t]=255&e;++o=0&&(o*=256);)this[t+i]=e/o&255;return t+r},o.prototype.writeUInt8=function(e,t,r){return e=+e,t|=0,r||x(this,e,t,1,255,0),o.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[t]=255&e,t+1},o.prototype.writeUInt16LE=function(e,t,r){return e=+e,t|=0,r||x(this,e,t,2,65535,0),o.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):M(this,e,t,!0),t+2},o.prototype.writeUInt16BE=function(e,t,r){return e=+e,t|=0,r||x(this,e,t,2,65535,0),o.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):M(this,e,t,!1),t+2},o.prototype.writeUInt32LE=function(e,t,r){return e=+e,t|=0,r||x(this,e,t,4,4294967295,0),o.TYPED_ARRAY_SUPPORT?(this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e):E(this,e,t,!0),t+4},o.prototype.writeUInt32BE=function(e,t,r){return e=+e,t|=0,r||x(this,e,t,4,4294967295,0),o.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):E(this,e,t,!1),t+4},o.prototype.writeIntLE=function(e,t,r,n){if(e=+e,t|=0,!n){var i=Math.pow(2,8*r-1);x(this,e,t,r,i-1,-i)}var o=0,s=1,a=0;for(this[t]=255&e;++o>0)-a&255;return t+r},o.prototype.writeIntBE=function(e,t,r,n){if(e=+e,t|=0,!n){var i=Math.pow(2,8*r-1);x(this,e,t,r,i-1,-i)}var o=r-1,s=1,a=0;for(this[t+o]=255&e;--o>=0&&(s*=256);)e<0&&0===a&&0!==this[t+o+1]&&(a=1),this[t+o]=(e/s>>0)-a&255;return t+r},o.prototype.writeInt8=function(e,t,r){return e=+e,t|=0,r||x(this,e,t,1,127,-128),o.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),e<0&&(e=255+e+1),this[t]=255&e,t+1},o.prototype.writeInt16LE=function(e,t,r){return e=+e,t|=0,r||x(this,e,t,2,32767,-32768),o.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):M(this,e,t,!0),t+2},o.prototype.writeInt16BE=function(e,t,r){return e=+e,t|=0,r||x(this,e,t,2,32767,-32768),o.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):M(this,e,t,!1),t+2},o.prototype.writeInt32LE=function(e,t,r){return e=+e,t|=0,r||x(this,e,t,4,2147483647,-2147483648),o.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24):E(this,e,t,!0),t+4},o.prototype.writeInt32BE=function(e,t,r){return e=+e,t|=0,r||x(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),o.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):E(this,e,t,!1),t+4},o.prototype.writeFloatLE=function(e,t,r){return I(this,e,t,!0,r)},o.prototype.writeFloatBE=function(e,t,r){return I(this,e,t,!1,r)},o.prototype.writeDoubleLE=function(e,t,r){return O(this,e,t,!0,r)},o.prototype.writeDoubleBE=function(e,t,r){return O(this,e,t,!1,r)},o.prototype.copy=function(e,t,r,n){if(r||(r=0),n||0===n||(n=this.length),t>=e.length&&(t=e.length),t||(t=0),n>0&&n=this.length)throw new RangeError("sourceStart out of bounds");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),e.length-t=0;--i)e[i+t]=this[i+r];else if(s<1e3||!o.TYPED_ARRAY_SUPPORT)for(i=0;i>>=0,r=void 0===r?this.length:r>>>0,e||(e=0);var s;if("number"==typeof e)for(s=t;s1)for(var r=1;r>>24|e>>>8&65280|e<<8&16711680|(255&e)<<24)>>>0}function i(e){return 1===e.length?"0"+e:e}function o(e){return 7===e.length?"0"+e:6===e.length?"00"+e:5===e.length?"000"+e:4===e.length?"0000"+e:3===e.length?"00000"+e:2===e.length?"000000"+e:1===e.length?"0000000"+e:e}var s=r(9),a=r(4);t.inherits=a,t.toArray=function(e,t){if(Array.isArray(e))return e.slice();if(!e)return[];var r=[];if("string"==typeof e)if(t){if("hex"===t)for((e=e.replace(/[^a-z0-9]+/gi,"")).length%2!=0&&(e="0"+e),n=0;n>8,s=255&i;o?r.push(o,s):r.push(s)}else for(n=0;n>>0}return o},t.split32=function(e,t){for(var r=new Array(4*e.length),n=0,i=0;n>>24,r[i+1]=o>>>16&255,r[i+2]=o>>>8&255,r[i+3]=255&o):(r[i+3]=o>>>24,r[i+2]=o>>>16&255,r[i+1]=o>>>8&255,r[i]=255&o)}return r},t.rotr32=function(e,t){return e>>>t|e<<32-t},t.rotl32=function(e,t){return e<>>32-t},t.sum32=function(e,t){return e+t>>>0},t.sum32_3=function(e,t,r){return e+t+r>>>0},t.sum32_4=function(e,t,r,n){return e+t+r+n>>>0},t.sum32_5=function(e,t,r,n,i){return e+t+r+n+i>>>0},t.sum64=function(e,t,r,n){var i=e[t],o=n+e[t+1]>>>0,s=(o>>0,e[t+1]=o},t.sum64_hi=function(e,t,r,n){return(t+n>>>0>>0},t.sum64_lo=function(e,t,r,n){return t+n>>>0},t.sum64_4_hi=function(e,t,r,n,i,o,s,a){var f=0,c=t;return f+=(c=c+n>>>0)>>0)>>0)>>0},t.sum64_4_lo=function(e,t,r,n,i,o,s,a){return t+n+o+a>>>0},t.sum64_5_hi=function(e,t,r,n,i,o,s,a,f,c){var u=0,h=t;return u+=(h=h+n>>>0)>>0)>>0)>>0)>>0},t.sum64_5_lo=function(e,t,r,n,i,o,s,a,f,c){return t+n+o+a+c>>>0},t.rotr64_hi=function(e,t,r){return(t<<32-r|e>>>r)>>>0},t.rotr64_lo=function(e,t,r){return(e<<32-r|t>>>r)>>>0},t.shr64_hi=function(e,t,r){return e>>>r},t.shr64_lo=function(e,t,r){return(e<<32-r|t>>>r)>>>0}},function(e,t){"function"==typeof Object.create?e.exports=function(e,t){e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})}:e.exports=function(e,t){e.super_=t;var r=function(){};r.prototype=t.prototype,e.prototype=new r,e.prototype.constructor=e}},function(e,t,r){(function(e){!function(e,t){"use strict";function n(e,t){if(!e)throw new Error(t||"Assertion failed")}function i(e,t){e.super_=t;var r=function(){};r.prototype=t.prototype,e.prototype=new r,e.prototype.constructor=e}function o(e,t,r){if(o.isBN(e))return e;this.negative=0,this.words=null,this.length=0,this.red=null,null!==e&&("le"!==t&&"be"!==t||(r=t,t=10),this._init(e||0,t||10,r||"be"))}function s(e,t,r){for(var n=0,i=Math.min(e.length,r),o=t;o=49&&s<=54?s-49+10:s>=17&&s<=22?s-17+10:15&s}return n}function a(e,t,r,n){for(var i=0,o=Math.min(e.length,r),s=t;s=49?a-49+10:a>=17?a-17+10:a}return i}function f(e,t,r){r.negative=t.negative^e.negative;var n=e.length+t.length|0;r.length=n,n=n-1|0;var i=0|e.words[0],o=0|t.words[0],s=i*o,a=67108863&s,f=s/67108864|0;r.words[0]=a;for(var c=1;c>>26,h=67108863&f,d=Math.min(c,t.length-1),l=Math.max(0,c-e.length+1);l<=d;l++){var p=c-l|0;u+=(s=(i=0|e.words[p])*(o=0|t.words[l])+h)/67108864|0,h=67108863&s}r.words[c]=0|h,f=0|u}return 0!==f?r.words[c]=0|f:r.length--,r.strip()}function c(e,t,r){return(new u).mulp(e,t,r)}function u(e,t){this.x=e,this.y=t}function h(e,t){this.name=e,this.p=new o(t,16),this.n=this.p.bitLength(),this.k=new o(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function d(){h.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function l(){h.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function p(){h.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function b(){h.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function g(e){if("string"==typeof e){var t=o._prime(e);this.m=t.p,this.prime=t}else n(e.gtn(1),"modulus must be greater than 1"),this.m=e,this.prime=null}function y(e){g.call(this,e),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new o(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}"object"==typeof e?e.exports=o:t.BN=o,o.BN=o,o.wordSize=26;var m;try{m=r(142).Buffer}catch(e){}o.isBN=function(e){return e instanceof o||null!==e&&"object"==typeof e&&e.constructor.wordSize===o.wordSize&&Array.isArray(e.words)},o.max=function(e,t){return e.cmp(t)>0?e:t},o.min=function(e,t){return e.cmp(t)<0?e:t},o.prototype._init=function(e,t,r){if("number"==typeof e)return this._initNumber(e,t,r);if("object"==typeof e)return this._initArray(e,t,r);"hex"===t&&(t=16),n(t===(0|t)&&t>=2&&t<=36);var i=0;"-"===(e=e.toString().replace(/\s+/g,""))[0]&&i++,16===t?this._parseHex(e,i):this._parseBase(e,t,i),"-"===e[0]&&(this.negative=1),this.strip(),"le"===r&&this._initArray(this.toArray(),t,r)},o.prototype._initNumber=function(e,t,r){e<0&&(this.negative=1,e=-e),e<67108864?(this.words=[67108863&e],this.length=1):e<4503599627370496?(this.words=[67108863&e,e/67108864&67108863],this.length=2):(n(e<9007199254740992),this.words=[67108863&e,e/67108864&67108863,1],this.length=3),"le"===r&&this._initArray(this.toArray(),t,r)},o.prototype._initArray=function(e,t,r){if(n("number"==typeof e.length),e.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(e.length/3),this.words=new Array(this.length);for(var i=0;i=0;i-=3)s=e[i]|e[i-1]<<8|e[i-2]<<16,this.words[o]|=s<>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);else if("le"===r)for(i=0,o=0;i>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);return this.strip()},o.prototype._parseHex=function(e,t){this.length=Math.ceil((e.length-t)/6),this.words=new Array(this.length);for(var r=0;r=t;r-=6)i=s(e,r,r+6),this.words[n]|=i<>>26-o&4194303,(o+=24)>=26&&(o-=26,n++);r+6!==t&&(i=s(e,t,r+6),this.words[n]|=i<>>26-o&4194303),this.strip()},o.prototype._parseBase=function(e,t,r){this.words=[0],this.length=1;for(var n=0,i=1;i<=67108863;i*=t)n++;n--,i=i/t|0;for(var o=e.length-r,s=o%n,f=Math.min(o,o-s)+r,c=0,u=r;u1&&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?""};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"],w=[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],_=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];o.prototype.toString=function(e,t){e=e||10,t=0|t||1;var r;if(16===e||"hex"===e){r="";for(var i=0,o=0,s=0;s>>24-i&16777215)||s!==this.length-1?v[6-f.length]+f+r:f+r,(i+=2)>=26&&(i-=26,s--)}for(0!==o&&(r=o.toString(16)+r);r.length%t!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}if(e===(0|e)&&e>=2&&e<=36){var c=w[e],u=_[e];r="";var h=this.clone();for(h.negative=0;!h.isZero();){var d=h.modn(u).toString(e);r=(h=h.idivn(u)).isZero()?d+r:v[c-d.length]+d+r}for(this.isZero()&&(r="0"+r);r.length%t!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}n(!1,"Base should be between 2 and 36")},o.prototype.toNumber=function(){var e=this.words[0];return 2===this.length?e+=67108864*this.words[1]:3===this.length&&1===this.words[2]?e+=4503599627370496+67108864*this.words[1]:this.length>2&&n(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-e:e},o.prototype.toJSON=function(){return this.toString(16)},o.prototype.toBuffer=function(e,t){return n(void 0!==m),this.toArrayLike(m,e,t)},o.prototype.toArray=function(e,t){return this.toArrayLike(Array,e,t)},o.prototype.toArrayLike=function(e,t,r){var i=this.byteLength(),o=r||Math.max(1,i);n(i<=o,"byte array longer than desired length"),n(o>0,"Requested array length <= 0"),this.strip();var s,a,f="le"===t,c=new e(o),u=this.clone();if(f){for(a=0;!u.isZero();a++)s=u.andln(255),u.iushrn(8),c[a]=s;for(;a=4096&&(r+=13,t>>>=13),t>=64&&(r+=7,t>>>=7),t>=8&&(r+=4,t>>>=4),t>=2&&(r+=2,t>>>=2),r+t},o.prototype._zeroBits=function(e){if(0===e)return 26;var t=e,r=0;return 0==(8191&t)&&(r+=13,t>>>=13),0==(127&t)&&(r+=7,t>>>=7),0==(15&t)&&(r+=4,t>>>=4),0==(3&t)&&(r+=2,t>>>=2),0==(1&t)&&r++,r},o.prototype.bitLength=function(){var e=this.words[this.length-1],t=this._countBits(e);return 26*(this.length-1)+t},o.prototype.zeroBits=function(){if(this.isZero())return 0;for(var e=0,t=0;te.length?this.clone().ior(e):e.clone().ior(this)},o.prototype.uor=function(e){return this.length>e.length?this.clone().iuor(e):e.clone().iuor(this)},o.prototype.iuand=function(e){var t;t=this.length>e.length?e:this;for(var r=0;re.length?this.clone().iand(e):e.clone().iand(this)},o.prototype.uand=function(e){return this.length>e.length?this.clone().iuand(e):e.clone().iuand(this)},o.prototype.iuxor=function(e){var t,r;this.length>e.length?(t=this,r=e):(t=e,r=this);for(var n=0;ne.length?this.clone().ixor(e):e.clone().ixor(this)},o.prototype.uxor=function(e){return this.length>e.length?this.clone().iuxor(e):e.clone().iuxor(this)},o.prototype.inotn=function(e){n("number"==typeof e&&e>=0);var t=0|Math.ceil(e/26),r=e%26;this._expand(t),r>0&&t--;for(var i=0;i0&&(this.words[i]=~this.words[i]&67108863>>26-r),this.strip()},o.prototype.notn=function(e){return this.clone().inotn(e)},o.prototype.setn=function(e,t){n("number"==typeof e&&e>=0);var r=e/26|0,i=e%26;return this._expand(r+1),this.words[r]=t?this.words[r]|1<e.length?(r=this,n=e):(r=e,n=this);for(var i=0,o=0;o>>26;for(;0!==i&&o>>26;if(this.length=r.length,0!==i)this.words[this.length]=i,this.length++;else if(r!==this)for(;oe.length?this.clone().iadd(e):e.clone().iadd(this)},o.prototype.isub=function(e){if(0!==e.negative){e.negative=0;var t=this.iadd(e);return e.negative=1,t._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(e),this.negative=1,this._normSign();var r=this.cmp(e);if(0===r)return this.negative=0,this.length=1,this.words[0]=0,this;var n,i;r>0?(n=this,i=e):(n=e,i=this);for(var o=0,s=0;s>26,this.words[s]=67108863&t;for(;0!==o&&s>26,this.words[s]=67108863&t;if(0===o&&s>>13,l=0|s[1],p=8191&l,b=l>>>13,g=0|s[2],y=8191&g,m=g>>>13,v=0|s[3],w=8191&v,_=v>>>13,S=0|s[4],k=8191&S,x=S>>>13,M=0|s[5],E=8191&M,A=M>>>13,I=0|s[6],O=8191&I,j=I>>>13,R=0|s[7],P=8191&R,C=R>>>13,N=0|s[8],B=8191&N,L=N>>>13,T=0|s[9],q=8191&T,D=T>>>13,z=0|a[0],F=8191&z,U=z>>>13,$=0|a[1],J=8191&$,W=$>>>13,Y=0|a[2],K=8191&Y,V=Y>>>13,H=0|a[3],G=8191&H,Z=H>>>13,X=0|a[4],Q=8191&X,ee=X>>>13,te=0|a[5],re=8191&te,ne=te>>>13,ie=0|a[6],oe=8191&ie,se=ie>>>13,ae=0|a[7],fe=8191&ae,ce=ae>>>13,ue=0|a[8],he=8191&ue,de=ue>>>13,le=0|a[9],pe=8191&le,be=le>>>13;r.negative=e.negative^t.negative,r.length=19;var ge=(c+(n=Math.imul(h,F))|0)+((8191&(i=(i=Math.imul(h,U))+Math.imul(d,F)|0))<<13)|0;c=((o=Math.imul(d,U))+(i>>>13)|0)+(ge>>>26)|0,ge&=67108863,n=Math.imul(p,F),i=(i=Math.imul(p,U))+Math.imul(b,F)|0,o=Math.imul(b,U);var ye=(c+(n=n+Math.imul(h,J)|0)|0)+((8191&(i=(i=i+Math.imul(h,W)|0)+Math.imul(d,J)|0))<<13)|0;c=((o=o+Math.imul(d,W)|0)+(i>>>13)|0)+(ye>>>26)|0,ye&=67108863,n=Math.imul(y,F),i=(i=Math.imul(y,U))+Math.imul(m,F)|0,o=Math.imul(m,U),n=n+Math.imul(p,J)|0,i=(i=i+Math.imul(p,W)|0)+Math.imul(b,J)|0,o=o+Math.imul(b,W)|0;var me=(c+(n=n+Math.imul(h,K)|0)|0)+((8191&(i=(i=i+Math.imul(h,V)|0)+Math.imul(d,K)|0))<<13)|0;c=((o=o+Math.imul(d,V)|0)+(i>>>13)|0)+(me>>>26)|0,me&=67108863,n=Math.imul(w,F),i=(i=Math.imul(w,U))+Math.imul(_,F)|0,o=Math.imul(_,U),n=n+Math.imul(y,J)|0,i=(i=i+Math.imul(y,W)|0)+Math.imul(m,J)|0,o=o+Math.imul(m,W)|0,n=n+Math.imul(p,K)|0,i=(i=i+Math.imul(p,V)|0)+Math.imul(b,K)|0,o=o+Math.imul(b,V)|0;var ve=(c+(n=n+Math.imul(h,G)|0)|0)+((8191&(i=(i=i+Math.imul(h,Z)|0)+Math.imul(d,G)|0))<<13)|0;c=((o=o+Math.imul(d,Z)|0)+(i>>>13)|0)+(ve>>>26)|0,ve&=67108863,n=Math.imul(k,F),i=(i=Math.imul(k,U))+Math.imul(x,F)|0,o=Math.imul(x,U),n=n+Math.imul(w,J)|0,i=(i=i+Math.imul(w,W)|0)+Math.imul(_,J)|0,o=o+Math.imul(_,W)|0,n=n+Math.imul(y,K)|0,i=(i=i+Math.imul(y,V)|0)+Math.imul(m,K)|0,o=o+Math.imul(m,V)|0,n=n+Math.imul(p,G)|0,i=(i=i+Math.imul(p,Z)|0)+Math.imul(b,G)|0,o=o+Math.imul(b,Z)|0;var we=(c+(n=n+Math.imul(h,Q)|0)|0)+((8191&(i=(i=i+Math.imul(h,ee)|0)+Math.imul(d,Q)|0))<<13)|0;c=((o=o+Math.imul(d,ee)|0)+(i>>>13)|0)+(we>>>26)|0,we&=67108863,n=Math.imul(E,F),i=(i=Math.imul(E,U))+Math.imul(A,F)|0,o=Math.imul(A,U),n=n+Math.imul(k,J)|0,i=(i=i+Math.imul(k,W)|0)+Math.imul(x,J)|0,o=o+Math.imul(x,W)|0,n=n+Math.imul(w,K)|0,i=(i=i+Math.imul(w,V)|0)+Math.imul(_,K)|0,o=o+Math.imul(_,V)|0,n=n+Math.imul(y,G)|0,i=(i=i+Math.imul(y,Z)|0)+Math.imul(m,G)|0,o=o+Math.imul(m,Z)|0,n=n+Math.imul(p,Q)|0,i=(i=i+Math.imul(p,ee)|0)+Math.imul(b,Q)|0,o=o+Math.imul(b,ee)|0;var _e=(c+(n=n+Math.imul(h,re)|0)|0)+((8191&(i=(i=i+Math.imul(h,ne)|0)+Math.imul(d,re)|0))<<13)|0;c=((o=o+Math.imul(d,ne)|0)+(i>>>13)|0)+(_e>>>26)|0,_e&=67108863,n=Math.imul(O,F),i=(i=Math.imul(O,U))+Math.imul(j,F)|0,o=Math.imul(j,U),n=n+Math.imul(E,J)|0,i=(i=i+Math.imul(E,W)|0)+Math.imul(A,J)|0,o=o+Math.imul(A,W)|0,n=n+Math.imul(k,K)|0,i=(i=i+Math.imul(k,V)|0)+Math.imul(x,K)|0,o=o+Math.imul(x,V)|0,n=n+Math.imul(w,G)|0,i=(i=i+Math.imul(w,Z)|0)+Math.imul(_,G)|0,o=o+Math.imul(_,Z)|0,n=n+Math.imul(y,Q)|0,i=(i=i+Math.imul(y,ee)|0)+Math.imul(m,Q)|0,o=o+Math.imul(m,ee)|0,n=n+Math.imul(p,re)|0,i=(i=i+Math.imul(p,ne)|0)+Math.imul(b,re)|0,o=o+Math.imul(b,ne)|0;var Se=(c+(n=n+Math.imul(h,oe)|0)|0)+((8191&(i=(i=i+Math.imul(h,se)|0)+Math.imul(d,oe)|0))<<13)|0;c=((o=o+Math.imul(d,se)|0)+(i>>>13)|0)+(Se>>>26)|0,Se&=67108863,n=Math.imul(P,F),i=(i=Math.imul(P,U))+Math.imul(C,F)|0,o=Math.imul(C,U),n=n+Math.imul(O,J)|0,i=(i=i+Math.imul(O,W)|0)+Math.imul(j,J)|0,o=o+Math.imul(j,W)|0,n=n+Math.imul(E,K)|0,i=(i=i+Math.imul(E,V)|0)+Math.imul(A,K)|0,o=o+Math.imul(A,V)|0,n=n+Math.imul(k,G)|0,i=(i=i+Math.imul(k,Z)|0)+Math.imul(x,G)|0,o=o+Math.imul(x,Z)|0,n=n+Math.imul(w,Q)|0,i=(i=i+Math.imul(w,ee)|0)+Math.imul(_,Q)|0,o=o+Math.imul(_,ee)|0,n=n+Math.imul(y,re)|0,i=(i=i+Math.imul(y,ne)|0)+Math.imul(m,re)|0,o=o+Math.imul(m,ne)|0,n=n+Math.imul(p,oe)|0,i=(i=i+Math.imul(p,se)|0)+Math.imul(b,oe)|0,o=o+Math.imul(b,se)|0;var ke=(c+(n=n+Math.imul(h,fe)|0)|0)+((8191&(i=(i=i+Math.imul(h,ce)|0)+Math.imul(d,fe)|0))<<13)|0;c=((o=o+Math.imul(d,ce)|0)+(i>>>13)|0)+(ke>>>26)|0,ke&=67108863,n=Math.imul(B,F),i=(i=Math.imul(B,U))+Math.imul(L,F)|0,o=Math.imul(L,U),n=n+Math.imul(P,J)|0,i=(i=i+Math.imul(P,W)|0)+Math.imul(C,J)|0,o=o+Math.imul(C,W)|0,n=n+Math.imul(O,K)|0,i=(i=i+Math.imul(O,V)|0)+Math.imul(j,K)|0,o=o+Math.imul(j,V)|0,n=n+Math.imul(E,G)|0,i=(i=i+Math.imul(E,Z)|0)+Math.imul(A,G)|0,o=o+Math.imul(A,Z)|0,n=n+Math.imul(k,Q)|0,i=(i=i+Math.imul(k,ee)|0)+Math.imul(x,Q)|0,o=o+Math.imul(x,ee)|0,n=n+Math.imul(w,re)|0,i=(i=i+Math.imul(w,ne)|0)+Math.imul(_,re)|0,o=o+Math.imul(_,ne)|0,n=n+Math.imul(y,oe)|0,i=(i=i+Math.imul(y,se)|0)+Math.imul(m,oe)|0,o=o+Math.imul(m,se)|0,n=n+Math.imul(p,fe)|0,i=(i=i+Math.imul(p,ce)|0)+Math.imul(b,fe)|0,o=o+Math.imul(b,ce)|0;var xe=(c+(n=n+Math.imul(h,he)|0)|0)+((8191&(i=(i=i+Math.imul(h,de)|0)+Math.imul(d,he)|0))<<13)|0;c=((o=o+Math.imul(d,de)|0)+(i>>>13)|0)+(xe>>>26)|0,xe&=67108863,n=Math.imul(q,F),i=(i=Math.imul(q,U))+Math.imul(D,F)|0,o=Math.imul(D,U),n=n+Math.imul(B,J)|0,i=(i=i+Math.imul(B,W)|0)+Math.imul(L,J)|0,o=o+Math.imul(L,W)|0,n=n+Math.imul(P,K)|0,i=(i=i+Math.imul(P,V)|0)+Math.imul(C,K)|0,o=o+Math.imul(C,V)|0,n=n+Math.imul(O,G)|0,i=(i=i+Math.imul(O,Z)|0)+Math.imul(j,G)|0,o=o+Math.imul(j,Z)|0,n=n+Math.imul(E,Q)|0,i=(i=i+Math.imul(E,ee)|0)+Math.imul(A,Q)|0,o=o+Math.imul(A,ee)|0,n=n+Math.imul(k,re)|0,i=(i=i+Math.imul(k,ne)|0)+Math.imul(x,re)|0,o=o+Math.imul(x,ne)|0,n=n+Math.imul(w,oe)|0,i=(i=i+Math.imul(w,se)|0)+Math.imul(_,oe)|0,o=o+Math.imul(_,se)|0,n=n+Math.imul(y,fe)|0,i=(i=i+Math.imul(y,ce)|0)+Math.imul(m,fe)|0,o=o+Math.imul(m,ce)|0,n=n+Math.imul(p,he)|0,i=(i=i+Math.imul(p,de)|0)+Math.imul(b,he)|0,o=o+Math.imul(b,de)|0;var Me=(c+(n=n+Math.imul(h,pe)|0)|0)+((8191&(i=(i=i+Math.imul(h,be)|0)+Math.imul(d,pe)|0))<<13)|0;c=((o=o+Math.imul(d,be)|0)+(i>>>13)|0)+(Me>>>26)|0,Me&=67108863,n=Math.imul(q,J),i=(i=Math.imul(q,W))+Math.imul(D,J)|0,o=Math.imul(D,W),n=n+Math.imul(B,K)|0,i=(i=i+Math.imul(B,V)|0)+Math.imul(L,K)|0,o=o+Math.imul(L,V)|0,n=n+Math.imul(P,G)|0,i=(i=i+Math.imul(P,Z)|0)+Math.imul(C,G)|0,o=o+Math.imul(C,Z)|0,n=n+Math.imul(O,Q)|0,i=(i=i+Math.imul(O,ee)|0)+Math.imul(j,Q)|0,o=o+Math.imul(j,ee)|0,n=n+Math.imul(E,re)|0,i=(i=i+Math.imul(E,ne)|0)+Math.imul(A,re)|0,o=o+Math.imul(A,ne)|0,n=n+Math.imul(k,oe)|0,i=(i=i+Math.imul(k,se)|0)+Math.imul(x,oe)|0,o=o+Math.imul(x,se)|0,n=n+Math.imul(w,fe)|0,i=(i=i+Math.imul(w,ce)|0)+Math.imul(_,fe)|0,o=o+Math.imul(_,ce)|0,n=n+Math.imul(y,he)|0,i=(i=i+Math.imul(y,de)|0)+Math.imul(m,he)|0,o=o+Math.imul(m,de)|0;var Ee=(c+(n=n+Math.imul(p,pe)|0)|0)+((8191&(i=(i=i+Math.imul(p,be)|0)+Math.imul(b,pe)|0))<<13)|0;c=((o=o+Math.imul(b,be)|0)+(i>>>13)|0)+(Ee>>>26)|0,Ee&=67108863,n=Math.imul(q,K),i=(i=Math.imul(q,V))+Math.imul(D,K)|0,o=Math.imul(D,V),n=n+Math.imul(B,G)|0,i=(i=i+Math.imul(B,Z)|0)+Math.imul(L,G)|0,o=o+Math.imul(L,Z)|0,n=n+Math.imul(P,Q)|0,i=(i=i+Math.imul(P,ee)|0)+Math.imul(C,Q)|0,o=o+Math.imul(C,ee)|0,n=n+Math.imul(O,re)|0,i=(i=i+Math.imul(O,ne)|0)+Math.imul(j,re)|0,o=o+Math.imul(j,ne)|0,n=n+Math.imul(E,oe)|0,i=(i=i+Math.imul(E,se)|0)+Math.imul(A,oe)|0,o=o+Math.imul(A,se)|0,n=n+Math.imul(k,fe)|0,i=(i=i+Math.imul(k,ce)|0)+Math.imul(x,fe)|0,o=o+Math.imul(x,ce)|0,n=n+Math.imul(w,he)|0,i=(i=i+Math.imul(w,de)|0)+Math.imul(_,he)|0,o=o+Math.imul(_,de)|0;var Ae=(c+(n=n+Math.imul(y,pe)|0)|0)+((8191&(i=(i=i+Math.imul(y,be)|0)+Math.imul(m,pe)|0))<<13)|0;c=((o=o+Math.imul(m,be)|0)+(i>>>13)|0)+(Ae>>>26)|0,Ae&=67108863,n=Math.imul(q,G),i=(i=Math.imul(q,Z))+Math.imul(D,G)|0,o=Math.imul(D,Z),n=n+Math.imul(B,Q)|0,i=(i=i+Math.imul(B,ee)|0)+Math.imul(L,Q)|0,o=o+Math.imul(L,ee)|0,n=n+Math.imul(P,re)|0,i=(i=i+Math.imul(P,ne)|0)+Math.imul(C,re)|0,o=o+Math.imul(C,ne)|0,n=n+Math.imul(O,oe)|0,i=(i=i+Math.imul(O,se)|0)+Math.imul(j,oe)|0,o=o+Math.imul(j,se)|0,n=n+Math.imul(E,fe)|0,i=(i=i+Math.imul(E,ce)|0)+Math.imul(A,fe)|0,o=o+Math.imul(A,ce)|0,n=n+Math.imul(k,he)|0,i=(i=i+Math.imul(k,de)|0)+Math.imul(x,he)|0,o=o+Math.imul(x,de)|0;var Ie=(c+(n=n+Math.imul(w,pe)|0)|0)+((8191&(i=(i=i+Math.imul(w,be)|0)+Math.imul(_,pe)|0))<<13)|0;c=((o=o+Math.imul(_,be)|0)+(i>>>13)|0)+(Ie>>>26)|0,Ie&=67108863,n=Math.imul(q,Q),i=(i=Math.imul(q,ee))+Math.imul(D,Q)|0,o=Math.imul(D,ee),n=n+Math.imul(B,re)|0,i=(i=i+Math.imul(B,ne)|0)+Math.imul(L,re)|0,o=o+Math.imul(L,ne)|0,n=n+Math.imul(P,oe)|0,i=(i=i+Math.imul(P,se)|0)+Math.imul(C,oe)|0,o=o+Math.imul(C,se)|0,n=n+Math.imul(O,fe)|0,i=(i=i+Math.imul(O,ce)|0)+Math.imul(j,fe)|0,o=o+Math.imul(j,ce)|0,n=n+Math.imul(E,he)|0,i=(i=i+Math.imul(E,de)|0)+Math.imul(A,he)|0,o=o+Math.imul(A,de)|0;var Oe=(c+(n=n+Math.imul(k,pe)|0)|0)+((8191&(i=(i=i+Math.imul(k,be)|0)+Math.imul(x,pe)|0))<<13)|0;c=((o=o+Math.imul(x,be)|0)+(i>>>13)|0)+(Oe>>>26)|0,Oe&=67108863,n=Math.imul(q,re),i=(i=Math.imul(q,ne))+Math.imul(D,re)|0,o=Math.imul(D,ne),n=n+Math.imul(B,oe)|0,i=(i=i+Math.imul(B,se)|0)+Math.imul(L,oe)|0,o=o+Math.imul(L,se)|0,n=n+Math.imul(P,fe)|0,i=(i=i+Math.imul(P,ce)|0)+Math.imul(C,fe)|0,o=o+Math.imul(C,ce)|0,n=n+Math.imul(O,he)|0,i=(i=i+Math.imul(O,de)|0)+Math.imul(j,he)|0,o=o+Math.imul(j,de)|0;var je=(c+(n=n+Math.imul(E,pe)|0)|0)+((8191&(i=(i=i+Math.imul(E,be)|0)+Math.imul(A,pe)|0))<<13)|0;c=((o=o+Math.imul(A,be)|0)+(i>>>13)|0)+(je>>>26)|0,je&=67108863,n=Math.imul(q,oe),i=(i=Math.imul(q,se))+Math.imul(D,oe)|0,o=Math.imul(D,se),n=n+Math.imul(B,fe)|0,i=(i=i+Math.imul(B,ce)|0)+Math.imul(L,fe)|0,o=o+Math.imul(L,ce)|0,n=n+Math.imul(P,he)|0,i=(i=i+Math.imul(P,de)|0)+Math.imul(C,he)|0,o=o+Math.imul(C,de)|0;var Re=(c+(n=n+Math.imul(O,pe)|0)|0)+((8191&(i=(i=i+Math.imul(O,be)|0)+Math.imul(j,pe)|0))<<13)|0;c=((o=o+Math.imul(j,be)|0)+(i>>>13)|0)+(Re>>>26)|0,Re&=67108863,n=Math.imul(q,fe),i=(i=Math.imul(q,ce))+Math.imul(D,fe)|0,o=Math.imul(D,ce),n=n+Math.imul(B,he)|0,i=(i=i+Math.imul(B,de)|0)+Math.imul(L,he)|0,o=o+Math.imul(L,de)|0;var Pe=(c+(n=n+Math.imul(P,pe)|0)|0)+((8191&(i=(i=i+Math.imul(P,be)|0)+Math.imul(C,pe)|0))<<13)|0;c=((o=o+Math.imul(C,be)|0)+(i>>>13)|0)+(Pe>>>26)|0,Pe&=67108863,n=Math.imul(q,he),i=(i=Math.imul(q,de))+Math.imul(D,he)|0,o=Math.imul(D,de);var Ce=(c+(n=n+Math.imul(B,pe)|0)|0)+((8191&(i=(i=i+Math.imul(B,be)|0)+Math.imul(L,pe)|0))<<13)|0;c=((o=o+Math.imul(L,be)|0)+(i>>>13)|0)+(Ce>>>26)|0,Ce&=67108863;var Ne=(c+(n=Math.imul(q,pe))|0)+((8191&(i=(i=Math.imul(q,be))+Math.imul(D,pe)|0))<<13)|0;return c=((o=Math.imul(D,be))+(i>>>13)|0)+(Ne>>>26)|0,Ne&=67108863,f[0]=ge,f[1]=ye,f[2]=me,f[3]=ve,f[4]=we,f[5]=_e,f[6]=Se,f[7]=ke,f[8]=xe,f[9]=Me,f[10]=Ee,f[11]=Ae,f[12]=Ie,f[13]=Oe,f[14]=je,f[15]=Re,f[16]=Pe,f[17]=Ce,f[18]=Ne,0!==c&&(f[19]=c,r.length++),r};Math.imul||(S=f),o.prototype.mulTo=function(e,t){var r=this.length+e.length;return 10===this.length&&10===e.length?S(this,e,t):r<63?f(this,e,t):r<1024?function(e,t,r){r.negative=t.negative^e.negative,r.length=e.length+t.length;for(var n=0,i=0,o=0;o>>26)|0)>>>26,s&=67108863}r.words[o]=a,n=s,s=i}return 0!==n?r.words[o]=n:r.length--,r.strip()}(this,e,t):c(this,e,t)},u.prototype.makeRBT=function(e){for(var t=new Array(e),r=o.prototype._countBits(e)-1,n=0;n>=1;return n},u.prototype.permute=function(e,t,r,n,i,o){for(var s=0;s>>=1)i++;return 1<>>=13,r[2*s+1]=8191&o,o>>>=13;for(s=2*t;s>=26,t+=i/67108864|0,t+=o>>>26,this.words[r]=67108863&o}return 0!==t&&(this.words[r]=t,this.length++),this},o.prototype.muln=function(e){return this.clone().imuln(e)},o.prototype.sqr=function(){return this.mul(this)},o.prototype.isqr=function(){return this.imul(this.clone())},o.prototype.pow=function(e){var t=function(e){for(var t=new Array(e.bitLength()),r=0;r>>i}return t}(e);if(0===t.length)return new o(1);for(var r=this,n=0;n=0);var t,r=e%26,i=(e-r)/26,o=67108863>>>26-r<<26-r;if(0!==r){var s=0;for(t=0;t>>26-r}s&&(this.words[t]=s,this.length++)}if(0!==i){for(t=this.length-1;t>=0;t--)this.words[t+i]=this.words[t];for(t=0;t=0);var i;i=t?(t-t%26)/26:0;var o=e%26,s=Math.min((e-o)/26,this.length),a=67108863^67108863>>>o<s)for(this.length-=s,c=0;c=0&&(0!==u||c>=i);c--){var h=0|this.words[c];this.words[c]=u<<26-o|h>>>o,u=h&a}return f&&0!==u&&(f.words[f.length++]=u),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},o.prototype.ishrn=function(e,t,r){return n(0===this.negative),this.iushrn(e,t,r)},o.prototype.shln=function(e){return this.clone().ishln(e)},o.prototype.ushln=function(e){return this.clone().iushln(e)},o.prototype.shrn=function(e){return this.clone().ishrn(e)},o.prototype.ushrn=function(e){return this.clone().iushrn(e)},o.prototype.testn=function(e){n("number"==typeof e&&e>=0);var t=e%26,r=(e-t)/26,i=1<=0);var t=e%26,r=(e-t)/26;if(n(0===this.negative,"imaskn works only with positive numbers"),this.length<=r)return this;if(0!==t&&r++,this.length=Math.min(r,this.length),0!==t){var i=67108863^67108863>>>t<=67108864;t++)this.words[t]-=67108864,t===this.length-1?this.words[t+1]=1:this.words[t+1]++;return this.length=Math.max(this.length,t+1),this},o.prototype.isubn=function(e){if(n("number"==typeof e),n(e<67108864),e<0)return this.iaddn(-e);if(0!==this.negative)return this.negative=0,this.iaddn(e),this.negative=1,this;if(this.words[0]-=e,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var t=0;t>26)-(f/67108864|0),this.words[i+r]=67108863&s}for(;i>26,this.words[i+r]=67108863&s;if(0===a)return this.strip();for(n(-1===a),a=0,i=0;i>26,this.words[i]=67108863&s;return this.negative=1,this.strip()},o.prototype._wordDiv=function(e,t){var r=this.length-e.length,n=this.clone(),i=e,s=0|i.words[i.length-1];0!==(r=26-this._countBits(s))&&(i=i.ushln(r),n.iushln(r),s=0|i.words[i.length-1]);var a,f=n.length-i.length;if("mod"!==t){(a=new o(null)).length=f+1,a.words=new Array(a.length);for(var c=0;c=0;h--){var d=67108864*(0|n.words[i.length+h])+(0|n.words[i.length+h-1]);for(d=Math.min(d/s|0,67108863),n._ishlnsubmul(i,d,h);0!==n.negative;)d--,n.negative=0,n._ishlnsubmul(i,1,h),n.isZero()||(n.negative^=1);a&&(a.words[h]=d)}return a&&a.strip(),n.strip(),"div"!==t&&0!==r&&n.iushrn(r),{div:a||null,mod:n}},o.prototype.divmod=function(e,t,r){if(n(!e.isZero()),this.isZero())return{div:new o(0),mod:new o(0)};var i,s,a;return 0!==this.negative&&0===e.negative?(a=this.neg().divmod(e,t),"mod"!==t&&(i=a.div.neg()),"div"!==t&&(s=a.mod.neg(),r&&0!==s.negative&&s.iadd(e)),{div:i,mod:s}):0===this.negative&&0!==e.negative?(a=this.divmod(e.neg(),t),"mod"!==t&&(i=a.div.neg()),{div:i,mod:a.mod}):0!=(this.negative&e.negative)?(a=this.neg().divmod(e.neg(),t),"div"!==t&&(s=a.mod.neg(),r&&0!==s.negative&&s.isub(e)),{div:a.div,mod:s}):e.length>this.length||this.cmp(e)<0?{div:new o(0),mod:this}:1===e.length?"div"===t?{div:this.divn(e.words[0]),mod:null}:"mod"===t?{div:null,mod:new o(this.modn(e.words[0]))}:{div:this.divn(e.words[0]),mod:new o(this.modn(e.words[0]))}:this._wordDiv(e,t)},o.prototype.div=function(e){return this.divmod(e,"div",!1).div},o.prototype.mod=function(e){return this.divmod(e,"mod",!1).mod},o.prototype.umod=function(e){return this.divmod(e,"mod",!0).mod},o.prototype.divRound=function(e){var t=this.divmod(e);if(t.mod.isZero())return t.div;var r=0!==t.div.negative?t.mod.isub(e):t.mod,n=e.ushrn(1),i=e.andln(1),o=r.cmp(n);return o<0||1===i&&0===o?t.div:0!==t.div.negative?t.div.isubn(1):t.div.iaddn(1)},o.prototype.modn=function(e){n(e<=67108863);for(var t=(1<<26)%e,r=0,i=this.length-1;i>=0;i--)r=(t*r+(0|this.words[i]))%e;return r},o.prototype.idivn=function(e){n(e<=67108863);for(var t=0,r=this.length-1;r>=0;r--){var i=(0|this.words[r])+67108864*t;this.words[r]=i/e|0,t=i%e}return this.strip()},o.prototype.divn=function(e){return this.clone().idivn(e)},o.prototype.egcd=function(e){n(0===e.negative),n(!e.isZero());var t=this,r=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var i=new o(1),s=new o(0),a=new o(0),f=new o(1),c=0;t.isEven()&&r.isEven();)t.iushrn(1),r.iushrn(1),++c;for(var u=r.clone(),h=t.clone();!t.isZero();){for(var d=0,l=1;0==(t.words[0]&l)&&d<26;++d,l<<=1);if(d>0)for(t.iushrn(d);d-- >0;)(i.isOdd()||s.isOdd())&&(i.iadd(u),s.isub(h)),i.iushrn(1),s.iushrn(1);for(var p=0,b=1;0==(r.words[0]&b)&&p<26;++p,b<<=1);if(p>0)for(r.iushrn(p);p-- >0;)(a.isOdd()||f.isOdd())&&(a.iadd(u),f.isub(h)),a.iushrn(1),f.iushrn(1);t.cmp(r)>=0?(t.isub(r),i.isub(a),s.isub(f)):(r.isub(t),a.isub(i),f.isub(s))}return{a:a,b:f,gcd:r.iushln(c)}},o.prototype._invmp=function(e){n(0===e.negative),n(!e.isZero());var t=this,r=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var i=new o(1),s=new o(0),a=r.clone();t.cmpn(1)>0&&r.cmpn(1)>0;){for(var f=0,c=1;0==(t.words[0]&c)&&f<26;++f,c<<=1);if(f>0)for(t.iushrn(f);f-- >0;)i.isOdd()&&i.iadd(a),i.iushrn(1);for(var u=0,h=1;0==(r.words[0]&h)&&u<26;++u,h<<=1);if(u>0)for(r.iushrn(u);u-- >0;)s.isOdd()&&s.iadd(a),s.iushrn(1);t.cmp(r)>=0?(t.isub(r),i.isub(s)):(r.isub(t),s.isub(i))}var d;return(d=0===t.cmpn(1)?i:s).cmpn(0)<0&&d.iadd(e),d},o.prototype.gcd=function(e){if(this.isZero())return e.abs();if(e.isZero())return this.abs();var t=this.clone(),r=e.clone();t.negative=0,r.negative=0;for(var n=0;t.isEven()&&r.isEven();n++)t.iushrn(1),r.iushrn(1);for(;;){for(;t.isEven();)t.iushrn(1);for(;r.isEven();)r.iushrn(1);var i=t.cmp(r);if(i<0){var o=t;t=r,r=o}else if(0===i||0===r.cmpn(1))break;t.isub(r)}return r.iushln(n)},o.prototype.invm=function(e){return this.egcd(e).a.umod(e)},o.prototype.isEven=function(){return 0==(1&this.words[0])},o.prototype.isOdd=function(){return 1==(1&this.words[0])},o.prototype.andln=function(e){return this.words[0]&e},o.prototype.bincn=function(e){n("number"==typeof e);var t=e%26,r=(e-t)/26,i=1<>>26,a&=67108863,this.words[s]=a}return 0!==o&&(this.words[s]=o,this.length++),this},o.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},o.prototype.cmpn=function(e){var t=e<0;if(0!==this.negative&&!t)return-1;if(0===this.negative&&t)return 1;this.strip();var r;if(this.length>1)r=1;else{t&&(e=-e),n(e<=67108863,"Number is too big");var i=0|this.words[0];r=i===e?0:ie.length)return 1;if(this.length=0;r--){var n=0|this.words[r],i=0|e.words[r];if(n!==i){ni&&(t=1);break}}return t},o.prototype.gtn=function(e){return 1===this.cmpn(e)},o.prototype.gt=function(e){return 1===this.cmp(e)},o.prototype.gten=function(e){return this.cmpn(e)>=0},o.prototype.gte=function(e){return this.cmp(e)>=0},o.prototype.ltn=function(e){return-1===this.cmpn(e)},o.prototype.lt=function(e){return-1===this.cmp(e)},o.prototype.lten=function(e){return this.cmpn(e)<=0},o.prototype.lte=function(e){return this.cmp(e)<=0},o.prototype.eqn=function(e){return 0===this.cmpn(e)},o.prototype.eq=function(e){return 0===this.cmp(e)},o.red=function(e){return new g(e)},o.prototype.toRed=function(e){return n(!this.red,"Already a number in reduction context"),n(0===this.negative,"red works only with positives"),e.convertTo(this)._forceRed(e)},o.prototype.fromRed=function(){return n(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},o.prototype._forceRed=function(e){return this.red=e,this},o.prototype.forceRed=function(e){return n(!this.red,"Already a number in reduction context"),this._forceRed(e)},o.prototype.redAdd=function(e){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,e)},o.prototype.redIAdd=function(e){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,e)},o.prototype.redSub=function(e){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,e)},o.prototype.redISub=function(e){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,e)},o.prototype.redShl=function(e){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,e)},o.prototype.redMul=function(e){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.mul(this,e)},o.prototype.redIMul=function(e){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.imul(this,e)},o.prototype.redSqr=function(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},o.prototype.redISqr=function(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},o.prototype.redSqrt=function(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},o.prototype.redInvm=function(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},o.prototype.redNeg=function(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},o.prototype.redPow=function(e){return n(this.red&&!e.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,e)};var k={k256:null,p224:null,p192:null,p25519:null};h.prototype._tmp=function(){var e=new o(null);return e.words=new Array(Math.ceil(this.n/13)),e},h.prototype.ireduce=function(e){var t,r=e;do{this.split(r,this.tmp),t=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(t>this.n);var n=t0?r.isub(this.p):r.strip(),r},h.prototype.split=function(e,t){e.iushrn(this.n,0,t)},h.prototype.imulK=function(e){return e.imul(this.k)},i(d,h),d.prototype.split=function(e,t){for(var r=Math.min(e.length,9),n=0;n>>22,i=o}i>>>=22,e.words[n-10]=i,0===i&&e.length>10?e.length-=10:e.length-=9},d.prototype.imulK=function(e){e.words[e.length]=0,e.words[e.length+1]=0,e.length+=2;for(var t=0,r=0;r>>=26,e.words[r]=i,t=n}return 0!==t&&(e.words[e.length++]=t),e},o._prime=function(e){if(k[e])return k[e];var t;if("k256"===e)t=new d;else if("p224"===e)t=new l;else if("p192"===e)t=new p;else{if("p25519"!==e)throw new Error("Unknown prime "+e);t=new b}return k[e]=t,t},g.prototype._verify1=function(e){n(0===e.negative,"red works only with positives"),n(e.red,"red works only with red numbers")},g.prototype._verify2=function(e,t){n(0==(e.negative|t.negative),"red works only with positives"),n(e.red&&e.red===t.red,"red works only with red numbers")},g.prototype.imod=function(e){return this.prime?this.prime.ireduce(e)._forceRed(this):e.umod(this.m)._forceRed(this)},g.prototype.neg=function(e){return e.isZero()?e.clone():this.m.sub(e)._forceRed(this)},g.prototype.add=function(e,t){this._verify2(e,t);var r=e.add(t);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},g.prototype.iadd=function(e,t){this._verify2(e,t);var r=e.iadd(t);return r.cmp(this.m)>=0&&r.isub(this.m),r},g.prototype.sub=function(e,t){this._verify2(e,t);var r=e.sub(t);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},g.prototype.isub=function(e,t){this._verify2(e,t);var r=e.isub(t);return r.cmpn(0)<0&&r.iadd(this.m),r},g.prototype.shl=function(e,t){return this._verify1(e),this.imod(e.ushln(t))},g.prototype.imul=function(e,t){return this._verify2(e,t),this.imod(e.imul(t))},g.prototype.mul=function(e,t){return this._verify2(e,t),this.imod(e.mul(t))},g.prototype.isqr=function(e){return this.imul(e,e.clone())},g.prototype.sqr=function(e){return this.mul(e,e)},g.prototype.sqrt=function(e){if(e.isZero())return e.clone();var t=this.m.andln(3);if(n(t%2==1),3===t){var r=this.m.add(new o(1)).iushrn(2);return this.pow(e,r)}for(var i=this.m.subn(1),s=0;!i.isZero()&&0===i.andln(1);)s++,i.iushrn(1);n(!i.isZero());var a=new o(1).toRed(this),f=a.redNeg(),c=this.m.subn(1).iushrn(1),u=this.m.bitLength();for(u=new o(2*u*u).toRed(this);0!==this.pow(u,c).cmp(f);)u.redIAdd(f);for(var h=this.pow(u,i),d=this.pow(e,i.addn(1).iushrn(1)),l=this.pow(e,i),p=s;0!==l.cmp(a);){for(var b=l,g=0;0!==b.cmp(a);g++)b=b.redSqr();n(g=0;n--){for(var c=t.words[n],u=f-1;u>=0;u--){var h=c>>u&1;i!==r[0]&&(i=this.sqr(i)),0!==h||0!==s?(s<<=1,s|=h,(4===++a||0===n&&0===u)&&(i=this.mul(i,r[s]),a=0,s=0)):a=0}f=26}return i},g.prototype.convertTo=function(e){var t=e.umod(this.m);return t===e?t.clone():t},g.prototype.convertFrom=function(e){var t=e.clone();return t.red=null,t},o.mont=function(e){return new y(e)},i(y,g),y.prototype.convertTo=function(e){return this.imod(e.ushln(this.shift))},y.prototype.convertFrom=function(e){var t=this.imod(e.mul(this.rinv));return t.red=null,t},y.prototype.imul=function(e,t){if(e.isZero()||t.isZero())return e.words[0]=0,e.length=1,e;var r=e.imul(t),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=r.isub(n).iushrn(this.shift),o=i;return i.cmp(this.m)>=0?o=i.isub(this.m):i.cmpn(0)<0&&(o=i.iadd(this.m)),o._forceRed(this)},y.prototype.mul=function(e,t){if(e.isZero()||t.isZero())return new o(0)._forceRed(this);var r=e.mul(t),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=r.isub(n).iushrn(this.shift),s=i;return i.cmp(this.m)>=0?s=i.isub(this.m):i.cmpn(0)<0&&(s=i.iadd(this.m)),s._forceRed(this)},y.prototype.invm=function(e){return this.imod(e._invmp(this.m).mul(this.r2))._forceRed(this)}}(void 0===e||e,this)}).call(t,r(44)(e))},function(e,t){var r;r=function(){return this}();try{r=r||Function("return this")()||(0,eval)("this")}catch(e){"object"==typeof window&&(r=window)}e.exports=r},function(e,t){function r(){this._events=this._events||{},this._maxListeners=this._maxListeners||void 0}function n(e){return"function"==typeof e}function i(e){return"object"==typeof e&&null!==e}function o(e){return void 0===e}e.exports=r,r.EventEmitter=r,r.prototype._events=void 0,r.prototype._maxListeners=void 0,r.defaultMaxListeners=10,r.prototype.setMaxListeners=function(e){if(!function(e){return"number"==typeof e}(e)||e<0||isNaN(e))throw TypeError("n must be a positive number");return this._maxListeners=e,this},r.prototype.emit=function(e){var t,r,s,a,f,c;if(this._events||(this._events={}),"error"===e&&(!this._events.error||i(this._events.error)&&!this._events.error.length)){if((t=arguments[1])instanceof Error)throw t;var u=new Error('Uncaught, unspecified "error" event. ('+t+")");throw u.context=t,u}if(r=this._events[e],o(r))return!1;if(n(r))switch(arguments.length){case 1:r.call(this);break;case 2:r.call(this,arguments[1]);break;case 3:r.call(this,arguments[1],arguments[2]);break;default:a=Array.prototype.slice.call(arguments,1),r.apply(this,a)}else if(i(r))for(a=Array.prototype.slice.call(arguments,1),s=(c=r.slice()).length,f=0;f0&&this._events[e].length>s&&(this._events[e].warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",this._events[e].length),"function"==typeof console.trace&&console.trace()),this},r.prototype.on=r.prototype.addListener,r.prototype.once=function(e,t){function r(){this.removeListener(e,r),i||(i=!0,t.apply(this,arguments))}if(!n(t))throw TypeError("listener must be a function");var i=!1;return r.listener=t,this.on(e,r),this},r.prototype.removeListener=function(e,t){var r,o,s,a;if(!n(t))throw TypeError("listener must be a function");if(!this._events||!this._events[e])return this;if(r=this._events[e],s=r.length,o=-1,r===t||n(r.listener)&&r.listener===t)delete this._events[e],this._events.removeListener&&this.emit("removeListener",e,t);else if(i(r)){for(a=s;a-- >0;)if(r[a]===t||r[a].listener&&r[a].listener===t){o=a;break}if(o<0)return this;1===r.length?(r.length=0,delete this._events[e]):r.splice(o,1),this._events.removeListener&&this.emit("removeListener",e,t)}return this},r.prototype.removeAllListeners=function(e){var t,r;if(!this._events)return this;if(!this._events.removeListener)return 0===arguments.length?this._events={}:this._events[e]&&delete this._events[e],this;if(0===arguments.length){for(t in this._events)"removeListener"!==t&&this.removeAllListeners(t);return this.removeAllListeners("removeListener"),this._events={},this}if(r=this._events[e],n(r))this.removeListener(e,r);else if(r)for(;r.length;)this.removeListener(e,r[r.length-1]);return delete this._events[e],this},r.prototype.listeners=function(e){return this._events&&this._events[e]?n(this._events[e])?[this._events[e]]:this._events[e].slice():[]},r.prototype.listenerCount=function(e){if(this._events){var t=this._events[e];if(n(t))return 1;if(t)return t.length}return 0},r.listenerCount=function(e,t){return e.listenerCount(t)}},function(e,t,r){function n(e,t){for(var r in e)t[r]=e[r]}function i(e,t,r){return s(e,t,r)}var o=r(0),s=o.Buffer;s.from&&s.alloc&&s.allocUnsafe&&s.allocUnsafeSlow?e.exports=o:(n(o,t),t.Buffer=i),n(s,i),i.from=function(e,t,r){if("number"==typeof e)throw new TypeError("Argument must not be a number");return s(e,t,r)},i.alloc=function(e,t,r){if("number"!=typeof e)throw new TypeError("Argument must be a number");var n=s(e);return void 0!==t?"string"==typeof r?n.fill(t,r):n.fill(t):n.fill(0),n},i.allocUnsafe=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return s(e)},i.allocUnsafeSlow=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return o.SlowBuffer(e)}},function(e,t){function r(e,t){if(!e)throw new Error(t||"Assertion failed")}e.exports=r,r.equal=function(e,t,r){if(e!=t)throw new Error(r||"Assertion failed: "+e+" != "+t)}},function(e,t,r){"use strict";function n(e){if(!(this instanceof n))return new n(e);c.call(this,e),u.call(this,e),e&&!1===e.readable&&(this.readable=!1),e&&!1===e.writable&&(this.writable=!1),this.allowHalfOpen=!0,e&&!1===e.allowHalfOpen&&(this.allowHalfOpen=!1),this.once("end",i)}function i(){this.allowHalfOpen||this._writableState.ended||s(o,this)}function o(e){e.end()}var s=r(17),a=Object.keys||function(e){var t=[];for(var r in e)t.push(r);return t};e.exports=n;var f=r(12);f.inherits=r(4);var c=r(32),u=r(35);f.inherits(n,c);for(var h=a(u.prototype),d=0;d=0;n--){var i=e[n];"."===i?e.splice(n,1):".."===i?(e.splice(n,1),r++):r&&(e.splice(n,1),r--)}if(t)for(;r--;r)e.unshift("..");return e}function n(e,t){if(e.filter)return e.filter(t);for(var r=[],n=0;n=-1&&!i;o--){var s=o>=0?arguments[o]:e.cwd();if("string"!=typeof s)throw new TypeError("Arguments to path.resolve must be strings");s&&(t=s+"/"+t,i="/"===s.charAt(0))}return t=r(n(t.split("/"),function(e){return!!e}),!i).join("/"),(i?"/":"")+t||"."},t.normalize=function(e){var i=t.isAbsolute(e),o="/"===s(e,-1);return(e=r(n(e.split("/"),function(e){return!!e}),!i).join("/"))||i||(e="."),e&&o&&(e+="/"),(i?"/":"")+e},t.isAbsolute=function(e){return"/"===e.charAt(0)},t.join=function(){var e=Array.prototype.slice.call(arguments,0);return t.normalize(n(e,function(e,t){if("string"!=typeof e)throw new TypeError("Arguments to path.join must be strings");return e}).join("/"))},t.relative=function(e,r){function n(e){for(var t=0;t=0&&""===e[r];r--);return t>r?[]:e.slice(t,r-t+1)}e=t.resolve(e).substr(1),r=t.resolve(r).substr(1);for(var i=n(e.split("/")),o=n(r.split("/")),s=Math.min(i.length,o.length),a=s,f=0;f=this._delta8){var r=(e=this.pending).length%this._delta8;this.pending=e.slice(e.length-r,e.length),0===this.pending.length&&(this.pending=null),e=i.join32(e,0,e.length-r,this.endian);for(var n=0;n>>24&255,n[i++]=e>>>16&255,n[i++]=e>>>8&255,n[i++]=255&e}else for(n[i++]=255&e,n[i++]=e>>>8&255,n[i++]=e>>>16&255,n[i++]=e>>>24&255,n[i++]=0,n[i++]=0,n[i++]=0,n[i++]=0,o=8;o{this._replicationInfo.queued++,this._replicationInfo.max=Math.max.apply(null,[this._replicationInfo.max,this._oplog.length,e.clock?e.clock.time:0]),this.events.emit("replicate",this.address.toString(),e)}),this._loader.on("load.progress",(e,t,r,n,i)=>{this._replicationInfo.buffered>i?this._replicationInfo.progress=this._replicationInfo.progress+i:this._replicationInfo.progress=Math.max.apply(null,[this._oplog.length,this._replicationInfo.progress,this._oplog.length+i]),this._replicationInfo.buffered=i,this._replicationInfo.max=Math.max.apply(null,[this._replicationInfo.max,this._replicationInfo.progress]),this.events.emit("replicate.progress",this.address.toString(),t,r,this._replicationInfo.progress,n)}),this._loader.on("load.end",async(e,t)=>{try{for(let t of e)await this._oplog.join(t,-1,this._oplog.id);this._replicationInfo.max=Math.max(this._replicationInfo.max,this._oplog.length),this._index.updateIndex(this._oplog),this._replicationInfo.progress=Math.max.apply(null,[this._replicationInfo.progress,this._oplog.length]),this._replicationInfo.queued-=e.length,this.events.emit("replicated",this.address.toString(),e.length)}catch(e){console.error(e)}})}catch(e){console.error("Store Error:",e)}}get all(){return Array.isArray(this._index._index)?this._index._index:Object.keys(this._index._index).map(e=>this._index._index[e])}get type(){return this._type}get key(){return this._key}async close(){return this._replicationInfo={buffered:0,queued:0,progress:0,max:0},this._stats={snapshot:{bytesLoaded:-1},syncRequestsReceieved:0},this.events.removeAllListeners("load"),this.events.removeAllListeners("load.progress"),this.events.removeAllListeners("replicate"),this.events.removeAllListeners("replicate.progress"),this.events.removeAllListeners("replicated"),this.events.removeAllListeners("ready"),this.events.removeAllListeners("write"),await this._cache.close(),this.events.emit("closed",this.address.toString()),Promise.resolve()}async drop(){await this.close(),await this._cache.destroy(),this._index=new this.options.Index(this.id),this._oplog=new s(this._ipfs,this.id,null,null,null,this._key,this.access.write),this._cache=this.options.cache}async load(e){e=e||this.options.maxHistory;const t=await this._cache.get("_localHeads")||[],r=await this._cache.get("_remoteHeads")||[],n=t.concat(r);n.length>0&&this.events.emit("load",this.address.toString(),n),await o(n,async t=>{this._replicationInfo.max=Math.max(this._replicationInfo.max,t.clock.time);let r=await s.fromEntryHash(this._ipfs,t.hash,this._oplog.id,e,this._oplog.values,this.key,this.access.write,this._onLoadProgress.bind(this));await this._oplog.join(r,e,this._oplog.id),this._replicationInfo.progress=Math.max.apply(null,[this._replicationInfo.progress,this._oplog.length]),this._replicationInfo.max=Math.max.apply(null,[this._replicationInfo.max,this._replicationInfo.progress])}),n.length>0&&this._index.updateIndex(this._oplog),this.events.emit("ready",this.address.toString(),this._oplog.heads)}sync(e){if(this._stats.syncRequestsReceieved+=1,u.debug(`Sync request #${this._stats.syncRequestsReceieved} ${e.length}`),0!==e.length)return o(e,e=>{if(!e)return console.warn("Warning: Given input entry was 'null'."),Promise.resolve(null);if(!this.access.write.includes(e.key)&&!this.access.write.includes("*"))return console.warn("Warning: Given input entry is not allowed in this log and was discarded (no write access)."),Promise.resolve(null);const r=Object.assign({},e);return r.hash=null,this._ipfs.object.put(t.from(JSON.stringify(r))).then(e=>e.toJSON().multihash).then(t=>(t!==e.hash&&console.warn("\"WARNING! Head hash didn't match the contents"),t)).then(()=>e)}).then(async t=>(await this._cache.set("_remoteHeads",e),u.debug(`Saved heads ${e.length} [${t.map(e=>e.hash).join(", ")}]`),this._loader.load(t.filter(e=>null!==e))))}loadMoreFrom(e,t){this._loader.load(t)}async saveSnapshot(){const e=this._loader.getQueue();let r=this._oplog.toSnapshot(),n=new t(JSON.stringify({id:r.id,heads:r.heads,size:r.values.length,type:this.type}));const o=new i;let s=new Uint16Array([n.length]),a=new t(s.buffer);o.push(a),o.push(n),r.values.forEach(e=>{let r=new t(JSON.stringify(e)),n=new Uint16Array([r.length]);o.push(new t(n.buffer)),o.push(r)}),o.push(null);const f={path:this.address.toString(),content:o},c=await this._ipfs.files.add(f);return await this._cache.set("snapshot",c[c.length-1]),await this._cache.set("queue",e),u.debug(`Saved snapshot: ${c[c.length-1].hash}, queue length: ${e.length}`),c}async loadFromSnapshot(e){this.events.emit("load",this.address.toString());const r=await this._cache.get("queue");this.sync(r||[]);const n=await this._cache.get("snapshot");if(!n)throw new Error(`Snapshot for ${this.address} not found!`);{const e=await this._ipfs.files.catReadableStream(n.hash),r=(e,t,r,n)=>{this._replicationInfo.max=Math.max(this._replicationInfo.max,t.clock.time),this._replicationInfo.progress=Math.max.apply(null,[this._replicationInfo.progress,r,this._oplog.length]),this._onLoadProgress(e,t,this._replicationInfo.progress,this._replicationInfo.max)},i=await(()=>new Promise((r,n)=>{let i=new t(0),o=[];e.on("data",e=>{if(this._byteSize+=e.length,o.length<2e4)o.push(e);else{const e=t.concat(o);i=t.concat([i,e]),o=[]}}),e.on("end",()=>{function e(e){for(var t=new ArrayBuffer(e.length),r=new Uint8Array(t),n=0;n0){const e=t.concat(o);i=t.concat([i,e])}const n=parseInt(new Uint16Array(e(i.slice(0,2))));let s;try{s=JSON.parse(i.slice(2,n+2))}catch(e){}let a=[],f=2+n;for(;fMath.max(e,t.clock.time),0)),r({values:a,id:s.id,heads:s.heads,type:s.type})):(this._replicationInfo.max=0,r({values:a,id:null,heads:null,type:null}))})}))();if(i){const e=await s.fromJSON(this._ipfs,i,-1,this._key,this.access.write,1e3,r);await this._oplog.join(e,-1,this._oplog.id),this._replicationInfo.max=Math.max.apply(null,[this._replicationInfo.max,this._replicationInfo.progress,this._oplog.length]),this._replicationInfo.progress=Math.max(this._replicationInfo.progress,this._oplog.length),this._index.updateIndex(this._oplog),this.events.emit("replicated",this.address.toString())}this.events.emit("ready",this.address.toString(),this._oplog.heads)}return this}async _addOperation(e,t,r,n){if(this._oplog){const t=await this._oplog.append(e,this.options.referenceCount);return this._replicationInfo.progress++,this._replicationInfo.max=Math.max.apply(null,[this._replicationInfo.max,this._replicationInfo.progress,t.clock.time]),this.address.toString(),await this._cache.set("_localHeads",[t]),this._index.updateIndex(this._oplog),this.events.emit("write",this.address.toString(),t,this._oplog.heads),n&&n(t),t.hash}}_addOperationBatch(e,t,r,n){throw new Error("Not implemented!")}_onLoadProgress(e,t,r,n){this.events.emit("load.progress",this.address.toString(),e,t,Math.max(this._oplog.length,r),Math.max(this._oplog.length||0,this._replicationInfo.max||0))}}}).call(t,r(0).Buffer)},function(e,t,r){"use strict";(function(t){function r(e,r,n,i){if("function"!=typeof e)throw new TypeError('"callback" argument must be a function');var o,s,a=arguments.length;switch(a){case 0:case 1:return t.nextTick(e);case 2:return t.nextTick(function(){e.call(null,r)});case 3:return t.nextTick(function(){e.call(null,r,n)});case 4:return t.nextTick(function(){e.call(null,r,n,i)});default:for(o=new Array(a-1),s=0;snew Promise((n,i)=>{if(r=Object.assign({concurrency:1/0},r),"function"!=typeof t)throw new TypeError("Mapper function is required");const o=r.concurrency;if(!("number"==typeof o&&o>=1))throw new TypeError(`Expected \`concurrency\` to be a number from 1 and up, got \`${o}\` (${typeof o})`);const s=[],a=e[Symbol.iterator]();let f=!1,c=!1,u=0,h=0;const d=()=>{if(f)return;const e=a.next(),r=h;if(h++,e.done)return c=!0,void(0===u&&n(s));u++,Promise.resolve(e.value).then(e=>t(e,r)).then(e=>{s[r]=e,u--,d()},e=>{f=!0,i(e)})};for(let e=0;e{f=e},setLogfile:e=>{c=e},create:(e,r)=>{return new class{constructor(e,t){this.category=e;let r={};Object.assign(r,l),Object.assign(r,t),this.options=r}debug(){this._shouldLog(a.DEBUG)&&this._write(a.DEBUG,i.apply(null,arguments))}log(){this._shouldLog(a.DEBUG)&&this.debug.apply(this,arguments)}info(){this._shouldLog(a.INFO)&&this._write(a.INFO,i.apply(null,arguments))}warn(){this._shouldLog(a.WARN)&&this._write(a.WARN,i.apply(null,arguments))}error(){this._shouldLog(a.ERROR)&&this._write(a.ERROR,i.apply(null,arguments))}_write(e,t){(this.options.filename||c)&&!this.fileWriter&&s&&(this.fileWriter=n.openSync(this.options.filename||c,this.options.appendFile?"a+":"w+"));let r=this._format(e,t),i=this._createLogMessage(e,t),o=this._createLogMessage(e,t,r.timestamp,r.level,r.category,r.text);this.fileWriter&&s&&n.writeSync(this.fileWriter,i+"\n",null,"utf-8"),s||!this.options.useColors?(console.log(o),u.emit("data",this.category,e,t)):e===a.ERROR?this.options.showTimestamp&&this.options.showLevel?console.error(o,r.timestamp,r.level,r.category,r.text):this.options.showTimestamp&&!this.options.showLevel?console.error(o,r.timestamp,r.category,r.text):!this.options.showTimestamp&&this.options.showLevel?console.error(o,r.level,r.category,r.text):console.error(o,r.category,r.text):this.options.showTimestamp&&this.options.showLevel?console.log(o,r.timestamp,r.level,r.category,r.text):this.options.showTimestamp&&!this.options.showLevel?console.log(o,r.timestamp,r.category,r.text):!this.options.showTimestamp&&this.options.showLevel?console.log(o,r.level,r.category,r.text):console.log(o,r.category,r.text)}_format(e,t){let r="",n="",i="",o=": ";if(this.options.useColors){const t=Object.keys(a).map(e=>a[e]).indexOf(e),f=this.options.color;s?(this.options.showTimestamp&&(r="[3"+h.Grey+"m"),this.options.showLevel&&(n="[3"+d[t]+";22m"),i="[3"+f+";1m",o=": "):(this.options.showTimestamp&&(r="color:"+h.Grey),this.options.showLevel&&(n="color:"+d[t]),i="color:"+f+"; font-weight: bold")}return{timestamp:r,level:n,category:i,text:o}}_createLogMessage(e,t,r,n,i,o){r=r||"",n=n||"",i=i||"",o=o||": ",!s&&this.options.useColors&&(this.options.showTimestamp&&(r="%c"),this.options.showLevel&&(n="%c"),i="%c",o=": %c");let f="";return this.options.showTimestamp&&(f+=(new Date).toISOString()+" "),f=r+f,this.options.showLevel&&(f+=n+"["+e+"]"+(e===a.INFO||e===a.WARN?" ":"")+" "),f+=i+this.category,f+=o+t}_shouldLog(e){let r=void 0!==t&&void 0!==Object({NODE_ENV:void 0})&&void 0!==Object({NODE_ENV:void 0}).LOG?Object({NODE_ENV:void 0}).LOG.toUpperCase():null;const n=(r="undefined"!=typeof window&&window.LOG?window.LOG.toUpperCase():r)||f,i=Object.keys(a).map(e=>a[e]);return i.indexOf(e)>=i.indexOf(n)}}(e,r)},forceBrowserMode:e=>s=!e,events:u}}).call(t,r(2))},function(e,t,r){"use strict";var n=t;n.base=r(145),n.short=r(146),n.mont=r(147),n.edwards=r(148)},function(e,t,r){"use strict";(function(t){const n=r(22),i=r(23),o=()=>new Error("Ipfs instance not defined");class s{static async create(e,t,r,a=[],f,c){if(!i(e))throw o();if(!i(t))throw new Error("Entry requires an id");if(!i(r))throw new Error("Entry requires data");if(!i(a)||!Array.isArray(a))throw new Error("'next' argument is not an array");let u={hash:null,id:t,payload:r,next:a.filter(i).map(e=>e.hash?e.hash:e),v:0,clock:new n(t,f?f.time:null)};return e.keystore&&c&&(u=await s.signEntry(e.keystore,u,c)),u.hash=await s.toMultihash(e,u),u}static async signEntry(e,r,n){const i=await e.sign(n,new t(JSON.stringify(r)));return r.sig=i,r.key=n.getPublic("hex"),r}static async verifyEntry(e,r){const n=Object.assign({},{hash:null,id:e.id,payload:e.payload,next:e.next,v:e.v,clock:e.clock}),i=await r.importPublicKey(e.key);await r.verify(e.sig,i,new t(JSON.stringify(n)))}static toMultihash(e,r){if(!e)throw o();const n=t.from(JSON.stringify(r));return e.object.put(n).then(e=>e.toJSON().multihash)}static fromMultihash(e,t){if(!e)throw o();if(!t)throw new Error(`Invalid hash: ${t}`);return e.object.get(t,{enc:"base58"}).then(e=>JSON.parse(e.toJSON().data)).then(e=>{let r={hash:t,id:e.id,payload:e.payload,next:e.next,v:e.v,clock:e.clock};return e.sig&&Object.assign(r,{sig:e.sig}),e.key&&Object.assign(r,{key:e.key}),r})}static isEntry(e){return void 0!==e.id&&void 0!==e.next&&void 0!==e.hash&&void 0!==e.payload&&void 0!==e.v&&void 0!==e.clock}static compare(e,t){var r=n.compare(e.clock,t.clock);return 0===r?e.clock.id-1}static findChildren(e,t){for(var r=[],n=t.find(t=>s.isParent(e,t)),i=e;n;)r.push(n),i=n,n=t.find(e=>s.isParent(i,e));return r=r.sort((e,t)=>e.clock.time>e.clock.time)}}e.exports=s}).call(t,r(0).Buffer)},function(e,t,r){"use strict";class n{constructor(e,t){this.id=e,this.time=t||0}tick(){return new n(this.id,++this.time)}merge(e){return this.time=Math.max(this.time,e.time),new n(this.id,this.time)}clone(){return new n(this.id,this.time)}static compare(e,t){var r=e.time-t.time;return 0===r&&e.id!==t.id?e.idvoid 0!==e&&null!==e)},function(e,t,r){(function(e,n){function i(e,r){var n={seen:[],stylize:s};return arguments.length>=3&&(n.depth=arguments[2]),arguments.length>=4&&(n.colors=arguments[3]),h(r)?n.showHidden=r:r&&t._extend(n,r),b(n.showHidden)&&(n.showHidden=!1),b(n.depth)&&(n.depth=2),b(n.colors)&&(n.colors=!1),b(n.customInspect)&&(n.customInspect=!0),n.colors&&(n.stylize=o),a(n,e,n.depth)}function o(e,t){var r=i.styles[t];return r?"["+i.colors[r][0]+"m"+e+"["+i.colors[r][1]+"m":e}function s(e,t){return e}function a(e,r,n){if(e.customInspect&&r&&w(r.inspect)&&r.inspect!==t.inspect&&(!r.constructor||r.constructor.prototype!==r)){var i=r.inspect(n,e);return p(i)||(i=a(e,i,n)),i}var o=function(e,t){if(b(t))return e.stylize("undefined","undefined");if(p(t)){var r="'"+JSON.stringify(t).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return e.stylize(r,"string")}if(l(t))return e.stylize(""+t,"number");if(h(t))return e.stylize(""+t,"boolean");if(d(t))return e.stylize("null","null")}(e,r);if(o)return o;var s=Object.keys(r),y=function(e){var t={};return e.forEach(function(e,r){t[e]=!0}),t}(s);if(e.showHidden&&(s=Object.getOwnPropertyNames(r)),v(r)&&(s.indexOf("message")>=0||s.indexOf("description")>=0))return f(r);if(0===s.length){if(w(r)){var _=r.name?": "+r.name:"";return e.stylize("[Function"+_+"]","special")}if(g(r))return e.stylize(RegExp.prototype.toString.call(r),"regexp");if(m(r))return e.stylize(Date.prototype.toString.call(r),"date");if(v(r))return f(r)}var S="",x=!1,M=["{","}"];if(u(r)&&(x=!0,M=["[","]"]),w(r)){S=" [Function"+(r.name?": "+r.name:"")+"]"}if(g(r)&&(S=" "+RegExp.prototype.toString.call(r)),m(r)&&(S=" "+Date.prototype.toUTCString.call(r)),v(r)&&(S=" "+f(r)),0===s.length&&(!x||0==r.length))return M[0]+S+M[1];if(n<0)return g(r)?e.stylize(RegExp.prototype.toString.call(r),"regexp"):e.stylize("[Object]","special");e.seen.push(r);var E;return E=x?function(e,t,r,n,i){for(var o=[],s=0,a=t.length;s=0&&0,e+t.replace(/\u001b\[\d\d?m/g,"").length+1},0)>60)return r[0]+(""===t?"":t+"\n ")+" "+e.join(",\n ")+" "+r[1];return r[0]+t+" "+e.join(", ")+" "+r[1]}(E,S,M)}function f(e){return"["+Error.prototype.toString.call(e)+"]"}function c(e,t,r,n,i,o){var s,f,c;if((c=Object.getOwnPropertyDescriptor(t,i)||{value:t[i]}).get?f=c.set?e.stylize("[Getter/Setter]","special"):e.stylize("[Getter]","special"):c.set&&(f=e.stylize("[Setter]","special")),k(n,i)||(s="["+i+"]"),f||(e.seen.indexOf(c.value)<0?(f=d(r)?a(e,c.value,null):a(e,c.value,r-1)).indexOf("\n")>-1&&(f=o?f.split("\n").map(function(e){return" "+e}).join("\n").substr(2):"\n"+f.split("\n").map(function(e){return" "+e}).join("\n")):f=e.stylize("[Circular]","special")),b(s)){if(o&&i.match(/^\d+$/))return f;(s=JSON.stringify(""+i)).match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(s=s.substr(1,s.length-2),s=e.stylize(s,"name")):(s=s.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),s=e.stylize(s,"string"))}return s+": "+f}function u(e){return Array.isArray(e)}function h(e){return"boolean"==typeof e}function d(e){return null===e}function l(e){return"number"==typeof e}function p(e){return"string"==typeof e}function b(e){return void 0===e}function g(e){return y(e)&&"[object RegExp]"===_(e)}function y(e){return"object"==typeof e&&null!==e}function m(e){return y(e)&&"[object Date]"===_(e)}function v(e){return y(e)&&("[object Error]"===_(e)||e instanceof Error)}function w(e){return"function"==typeof e}function _(e){return Object.prototype.toString.call(e)}function S(e){return e<10?"0"+e.toString(10):e.toString(10)}function k(e,t){return Object.prototype.hasOwnProperty.call(e,t)}var x=/%[sdj%]/g;t.format=function(e){if(!p(e)){for(var t=[],r=0;r=o)return e;switch(e){case"%s":return String(n[r++]);case"%d":return Number(n[r++]);case"%j":try{return JSON.stringify(n[r++])}catch(e){return"[Circular]"}default:return e}}),a=n[r];r=e.length?o(!0):o(null,e[r++])}}},function(e,t,r){"use strict";var n=r(13);e.exports=function(e,t,r){r||(r=t,t=null);var i=n(function(r){t=e(t,r)},function(e){r(e,t)});return 2===arguments.length?function(e){e(null,function(n,o){if(n)return r(!0===n?null:n);t=o,i(e)})}:i}},function(e,t,r){"use strict";var n=r(49);e.exports=function(e){return e=n(e),function(t){return function r(n,i){for(var o,s=!0;s;)s=!1,o=!0,t(n,function(t,n){if(!t&&!e(n))return o?s=!0:r(t,i);i(t,n)}),o=!1}}}},function(e,t,r){var n=t;n.utils=r(3),n.common=r(15),n.sha=r(150),n.ripemd=r(154),n.hmac=r(155),n.sha1=n.sha.sha1,n.sha256=n.sha.sha256,n.sha224=n.sha.sha224,n.sha384=n.sha.sha384,n.sha512=n.sha.sha512,n.ripemd160=n.ripemd.ripemd160},function(e,t,r){"use strict";const n=r(16),i=r(78);e.exports=class extends n{constructor(e,t,r,n={}){void 0===n.Index&&Object.assign(n,{Index:i}),super(e,t,r,n),this._type="eventlog"}add(e){return this._addOperation({op:"ADD",key:null,value:e})}get(e){return this.iterator({gte:e,limit:1}).collect()[0]}iterator(e){const t=this._query(e);let r=0;return{[Symbol.iterator](){return this},next(){let e={value:null,done:!0};return rt}}_query(e){e||(e={});const t=e.limit?e.limit>-1?e.limit:this._index.get().length:1,r=this._index.get().slice();let n=[];return n=e.gt||e.gte?this._read(r,e.gt?e.gt:e.gte,t,!!e.gte):this._read(r.reverse(),e.lt?e.lt:e.lte,t,e.lte||!e.lt).reverse()}_read(e,t,r,n){const i=e.map(e=>e.hash).indexOf(t);let o=Math.max(i,0);return o+=n?0:1,e.slice(o).slice(0,r)}}},function(e,t){var r={}.toString;e.exports=Array.isArray||function(e){return"[object Array]"==r.call(e)}},function(e,t,r){(t=e.exports=r(32)).Stream=t,t.Readable=t,t.Writable=r(35),t.Duplex=r(10),t.Transform=r(38),t.PassThrough=r(64)},function(e,t,r){"use strict";(function(t,n){function i(e,t){_=_||r(10),e=e||{},this.objectMode=!!e.objectMode,t instanceof _&&(this.objectMode=this.objectMode||!!e.readableObjectMode);var n=e.highWaterMark,i=this.objectMode?16:16384;this.highWaterMark=n||0===n?n:i,this.highWaterMark=Math.floor(this.highWaterMark),this.buffer=new R,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.destroyed=!1,this.defaultEncoding=e.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,e.encoding&&(j||(j=r(37).StringDecoder),this.decoder=new j(e.encoding),this.encoding=e.encoding)}function o(e){if(_=_||r(10),!(this instanceof o))return new o(e);this._readableState=new i(e,this),this.readable=!0,e&&("function"==typeof e.read&&(this._read=e.read),"function"==typeof e.destroy&&(this._destroy=e.destroy)),x.call(this)}function s(e,t,r,n,i){var o=e._readableState;if(null===t)o.reading=!1,function(e,t){if(t.ended)return;if(t.decoder){var r=t.decoder.end();r&&r.length&&(t.buffer.push(r),t.length+=t.objectMode?1:r.length)}t.ended=!0,c(e)}(e,o);else{var s;i||(s=function(e,t){var r;(function(e){return M.isBuffer(e)||e instanceof E})(t)||"string"==typeof t||void 0===t||e.objectMode||(r=new TypeError("Invalid non-string/buffer chunk"));return r}(o,t)),s?e.emit("error",s):o.objectMode||t&&t.length>0?("string"==typeof t||o.objectMode||Object.getPrototypeOf(t)===M.prototype||(t=function(e){return M.from(e)}(t)),n?o.endEmitted?e.emit("error",new Error("stream.unshift() after end event")):a(e,o,t,!0):o.ended?e.emit("error",new Error("stream.push() after EOF")):(o.reading=!1,o.decoder&&!r?(t=o.decoder.write(t),o.objectMode||0!==t.length?a(e,o,t,!1):h(e,o)):a(e,o,t,!1))):n||(o.reading=!1)}return function(e){return!e.ended&&(e.needReadable||e.lengtht.highWaterMark&&(t.highWaterMark=function(e){return e>=N?e=N:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}function c(e){var t=e._readableState;t.needReadable=!1,t.emittedReadable||(O("emitReadable",t.flowing),t.emittedReadable=!0,t.sync?w(u,e):u(e))}function u(e){O("emit readable"),e.emit("readable"),b(e)}function h(e,t){t.readingMore||(t.readingMore=!0,w(d,e,t))}function d(e,t){for(var r=t.length;!t.reading&&!t.flowing&&!t.ended&&t.length=t.length?(r=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.head.data:t.buffer.concat(t.length),t.buffer.clear()):r=function(e,t,r){var n;eo.length?o.length:e;if(s===o.length?i+=o:i+=o.slice(0,e),0===(e-=s)){s===o.length?(++n,r.next?t.head=r.next:t.head=t.tail=null):(t.head=r,r.data=o.slice(s));break}++n}return t.length-=n,i}(e,t):function(e,t){var r=M.allocUnsafe(e),n=t.head,i=1;n.data.copy(r),e-=n.data.length;for(;n=n.next;){var o=n.data,s=e>o.length?o.length:e;if(o.copy(r,r.length-e,0,s),0===(e-=s)){s===o.length?(++i,n.next?t.head=n.next:t.head=t.tail=null):(t.head=n,n.data=o.slice(s));break}++i}return t.length-=i,r}(e,t);return n}(e,t.buffer,t.decoder),r}function y(e){var t=e._readableState;if(t.length>0)throw new Error('"endReadable()" called on non-empty stream');t.endEmitted||(t.ended=!0,w(m,t,e))}function m(e,t){e.endEmitted||0!==e.length||(e.endEmitted=!0,t.readable=!1,t.emit("end"))}function v(e,t){for(var r=0,n=e.length;r=t.highWaterMark||t.ended))return O("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?y(this):c(this),null;if(0===(e=f(e,t))&&t.ended)return 0===t.length&&y(this),null;var n=t.needReadable;O("need readable",n),(0===t.length||t.length-e0?g(e,t):null)?(t.needReadable=!0,e=0):t.length-=e,0===t.length&&(t.ended||(t.needReadable=!0),r!==e&&t.ended&&y(this)),null!==i&&this.emit("data",i),i},o.prototype._read=function(e){this.emit("error",new Error("_read() is not implemented"))},o.prototype.pipe=function(e,t){function r(t,n){O("onunpipe"),t===u&&n&&!1===n.hasUnpiped&&(n.hasUnpiped=!0,O("cleanup"),e.removeListener("close",a),e.removeListener("finish",f),e.removeListener("drain",l),e.removeListener("error",s),e.removeListener("unpipe",r),u.removeListener("end",i),u.removeListener("end",c),u.removeListener("data",o),p=!0,!h.awaitDrain||e._writableState&&!e._writableState.needDrain||l())}function i(){O("onend"),e.end()}function o(t){O("ondata"),g=!1;!1!==e.write(t)||g||((1===h.pipesCount&&h.pipes===e||h.pipesCount>1&&-1!==v(h.pipes,e))&&!p&&(O("false write response, pause",u._readableState.awaitDrain),u._readableState.awaitDrain++,g=!0),u.pause())}function s(t){O("onerror",t),c(),e.removeListener("error",s),0===k(e,"error")&&e.emit("error",t)}function a(){e.removeListener("finish",f),c()}function f(){O("onfinish"),e.removeListener("close",a),c()}function c(){O("unpipe"),u.unpipe(e)}var u=this,h=this._readableState;switch(h.pipesCount){case 0:h.pipes=e;break;case 1:h.pipes=[h.pipes,e];break;default:h.pipes.push(e)}h.pipesCount+=1,O("pipe count=%d opts=%j",h.pipesCount,t);var d=(!t||!1!==t.end)&&e!==n.stdout&&e!==n.stderr?i:c;h.endEmitted?w(d):u.once("end",d),e.on("unpipe",r);var l=function(e){return function(){var t=e._readableState;O("pipeOnDrain",t.awaitDrain),t.awaitDrain&&t.awaitDrain--,0===t.awaitDrain&&k(e,"data")&&(t.flowing=!0,b(e))}}(u);e.on("drain",l);var p=!1,g=!1;return u.on("data",o),function(e,t,r){if("function"==typeof e.prependListener)return e.prependListener(t,r);e._events&&e._events[t]?S(e._events[t])?e._events[t].unshift(r):e._events[t]=[r,e._events[t]]:e.on(t,r)}(e,"error",s),e.once("close",a),e.once("finish",f),e.emit("pipe",u),h.flowing||(O("pipe resume"),u.resume()),e},o.prototype.unpipe=function(e){var t=this._readableState,r={hasUnpiped:!1};if(0===t.pipesCount)return this;if(1===t.pipesCount)return e&&e!==t.pipes?this:(e||(e=t.pipes),t.pipes=null,t.pipesCount=0,t.flowing=!1,e&&e.emit("unpipe",this,r),this);if(!e){var n=t.pipes,i=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var o=0;o-1?n:g;f.WritableState=a;var v=r(12);v.inherits=r(4);var w={deprecate:r(63)},_=r(33),S=r(8).Buffer,k=i.Uint8Array||function(){},x=r(34);v.inherits(f,_),a.prototype.getBuffer=function(){for(var e=this.bufferedRequest,t=[];e;)t.push(e),e=e.next;return t},function(){try{Object.defineProperty(a.prototype,"buffer",{get:w.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch(e){}}();var M;"function"==typeof Symbol&&Symbol.hasInstance&&"function"==typeof Function.prototype[Symbol.hasInstance]?(M=Function.prototype[Symbol.hasInstance],Object.defineProperty(f,Symbol.hasInstance,{value:function(e){return!!M.call(this,e)||e&&e._writableState instanceof a}})):M=function(e){return e instanceof this},f.prototype.pipe=function(){this.emit("error",new Error("Cannot pipe, not readable"))},f.prototype.write=function(e,t,r){var n=this._writableState,i=!1,o=function(e){return S.isBuffer(e)||e instanceof k}(e)&&!n.objectMode;return o&&!S.isBuffer(e)&&(e=function(e){return S.from(e)}(e)),"function"==typeof t&&(r=t,t=null),o?t="buffer":t||(t=n.defaultEncoding),"function"!=typeof r&&(r=s),n.ended?function(e,t){var r=new Error("write after end");e.emit("error",r),g(t,r)}(this,r):(o||function(e,t,r,n){var i=!0,o=!1;return null===r?o=new TypeError("May not write null values to stream"):"string"==typeof r||void 0===r||t.objectMode||(o=new TypeError("Invalid non-string/buffer chunk")),o&&(e.emit("error",o),g(n,o),i=!1),i}(this,n,e,r))&&(n.pendingcb++,i=c(this,n,o,e,t,r)),i},f.prototype.cork=function(){this._writableState.corked++},f.prototype.uncork=function(){var e=this._writableState;e.corked&&(e.corked--,e.writing||e.corked||e.finished||e.bufferProcessing||!e.bufferedRequest||d(this,e))},f.prototype.setDefaultEncoding=function(e){if("string"==typeof e&&(e=e.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((e+"").toLowerCase())>-1))throw new TypeError("Unknown encoding: "+e);return this._writableState.defaultEncoding=e,this},f.prototype._write=function(e,t,r){r(new Error("_write() is not implemented"))},f.prototype._writev=null,f.prototype.end=function(e,t,r){var n=this._writableState;"function"==typeof e?(r=e,e=null,t=null):"function"==typeof t&&(r=t,t=null),null!==e&&void 0!==e&&this.write(e,t),n.corked&&(n.corked=1,this.uncork()),n.ending||n.finished||function(e,t,r){t.ending=!0,b(e,t),r&&(t.finished?g(r):e.once("finish",r)),t.ended=!0,e.writable=!1}(this,n,r)},Object.defineProperty(f.prototype,"destroyed",{get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(e){this._writableState&&(this._writableState.destroyed=e)}}),f.prototype.destroy=x.destroy,f.prototype._undestroy=x.undestroy,f.prototype._destroy=function(e,t){this.end(),t(e)}}).call(t,r(2),r(36).setImmediate,r(6))},function(e,t,r){function n(e,t){this._id=e,this._clearFn=t}var i=Function.prototype.apply;t.setTimeout=function(){return new n(i.call(setTimeout,window,arguments),clearTimeout)},t.setInterval=function(){return new n(i.call(setInterval,window,arguments),clearInterval)},t.clearTimeout=t.clearInterval=function(e){e&&e.close()},n.prototype.unref=n.prototype.ref=function(){},n.prototype.close=function(){this._clearFn.call(window,this._id)},t.enroll=function(e,t){clearTimeout(e._idleTimeoutId),e._idleTimeout=t},t.unenroll=function(e){clearTimeout(e._idleTimeoutId),e._idleTimeout=-1},t._unrefActive=t.active=function(e){clearTimeout(e._idleTimeoutId);var t=e._idleTimeout;t>=0&&(e._idleTimeoutId=setTimeout(function(){e._onTimeout&&e._onTimeout()},t))},r(62),t.setImmediate=setImmediate,t.clearImmediate=clearImmediate},function(e,t,r){"use strict";function n(e){this.encoding=function(e){var t=function(e){if(!e)return"utf8";for(var t;;)switch(e){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return e;default:if(t)return;e=(""+e).toLowerCase(),t=!0}}(e);if("string"!=typeof t&&(d.isEncoding===l||!l(e)))throw new Error("Unknown encoding: "+e);return t||e}(e);var t;switch(this.encoding){case"utf16le":this.text=s,this.end=a,t=4;break;case"utf8":this.fillLast=o,t=4;break;case"base64":this.text=f,this.end=c,t=3;break;default:return this.write=u,void(this.end=h)}this.lastNeed=0,this.lastTotal=0,this.lastChar=d.allocUnsafe(t)}function i(e){return e<=127?0:e>>5==6?2:e>>4==14?3:e>>3==30?4:-1}function o(e){var t=this.lastTotal-this.lastNeed,r=function(e,t,r){if(128!=(192&t[0]))return e.lastNeed=0,"�".repeat(r);if(e.lastNeed>1&&t.length>1){if(128!=(192&t[1]))return e.lastNeed=1,"�".repeat(r+1);if(e.lastNeed>2&&t.length>2&&128!=(192&t[2]))return e.lastNeed=2,"�".repeat(r+2)}}(this,e,t);return void 0!==r?r:this.lastNeed<=e.length?(e.copy(this.lastChar,t,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal)):(e.copy(this.lastChar,t,0,e.length),void(this.lastNeed-=e.length))}function s(e,t){if((e.length-t)%2==0){var r=e.toString("utf16le",t);if(r){var n=r.charCodeAt(r.length-1);if(n>=55296&&n<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1],r.slice(0,-1)}return r}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=e[e.length-1],e.toString("utf16le",t,e.length-1)}function a(e){var t=e&&e.length?this.write(e):"";if(this.lastNeed){var r=this.lastTotal-this.lastNeed;return t+this.lastChar.toString("utf16le",0,r)}return t}function f(e,t){var r=(e.length-t)%3;return 0===r?e.toString("base64",t):(this.lastNeed=3-r,this.lastTotal=3,1===r?this.lastChar[0]=e[e.length-1]:(this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1]),e.toString("base64",t,e.length-r))}function c(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+this.lastChar.toString("base64",0,3-this.lastNeed):t}function u(e){return e.toString(this.encoding)}function h(e){return e&&e.length?this.write(e):""}var d=r(8).Buffer,l=d.isEncoding||function(e){switch((e=""+e)&&e.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};t.StringDecoder=n,n.prototype.write=function(e){if(0===e.length)return"";var t,r;if(this.lastNeed){if(void 0===(t=this.fillLast(e)))return"";r=this.lastNeed,this.lastNeed=0}else r=0;return r=0?(o>0&&(e.lastNeed=o-1),o):--n=0?(o>0&&(e.lastNeed=o-2),o):--n=0?(o>0&&(2===o?o=0:e.lastNeed=o-3),o):0}(this,e,t);if(!this.lastNeed)return e.toString("utf8",t);this.lastTotal=r;var n=e.length-(r-this.lastNeed);return e.copy(this.lastChar,0,n),e.toString("utf8",t,n)},n.prototype.fillLast=function(e){if(this.lastNeed<=e.length)return e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,e.length),this.lastNeed-=e.length}},function(e,t,r){"use strict";function n(e){this.afterTransform=function(t,r){return function(e,t,r){var n=e._transformState;n.transforming=!1;var i=n.writecb;if(!i)return e.emit("error",new Error("write callback called multiple times"));n.writechunk=null,n.writecb=null,null!==r&&void 0!==r&&e.push(r);i(t);var o=e._readableState;o.reading=!1,(o.needReadable||o.length(new Date).getTime().toString(),d=e=>e.hash,l=(e,t)=>e.concat(t),p=e=>e.next,b=(e,t)=>Math.max(e,t.clock.time),g=(e,t)=>(e[t.hash]=t,e);class y extends i{constructor(e,t,r,n,i,o,s=[]){if(!c(e))throw a.ImmutableDBNotDefinedError();if(c(r)&&!Array.isArray(r))throw new Error("'entries' argument must be an array of Entry instances");if(c(n)&&!Array.isArray(n))throw new Error("'heads' argument must be an array");super(),this._storage=e,this._id=t||h(),this._keystore=this._storage.keystore,this._key=o,this._keys=Array.isArray(s)?s:[s],r=r||[],this._entryIndex=r.reduce(g,{}),n=n||y.findHeads(r),this._headsIndex=n.reduce(g,{}),this._nextsIndex={},r.forEach(e=>e.next.forEach(t=>this._nextsIndex[t]=e.hash)),this._length=r?r.length:0;const u=Math.max(i?i.time:0,this.heads.reduce(b,0));this._clock=new f(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 y.findTails(this.values)}get tailHashes(){return y.findTailHashes(this.values)}get(e){return this._entryIndex[e]}has(e){return void 0!==this._entryIndex[e.hash||e]}traverse(e,t){let r=e.map(p).reduce(l,[]),n={},i={},o=0;const s=e=>{i[e]||n[e]||(r.push(e),n[e]=!0)};for(e.forEach(e=>{i[e.hash]=e.hash,n[e.hash]=!0,o++});r.length>0&&othis._nextsIndex[e]=i.hash),this._headsIndex={},this._headsIndex[i.hash]=i,this._length++,i}async join(e,t=-1,r){if(!c(e))throw a.LogNotDefinedError();if(!y.isLog(e))throw a.NotALogError();const i=async e=>{this._keys.map(e=>e.getPublic?e.getPublic("hex"):e);return(await n(e,async e=>{if(!e.key)throw new Error("Entry doesn't have a public key");if(!e.sig)throw new Error("Entry doesn't have a signature");if(1===this._keys.length&&this._keys[0]===this._key&&e.id!==this.id)throw new Error("Entry doesn't belong in this log (wrong ID)");if(this._keys.length>0&&!this._keys.includes("*")&&!((e,t)=>e.find(e=>e===t.key))(this._keys.concat([this._key]),e))return console.warn("Warning: Input log contains entries that are not allowed in this log. Logs weren't joined."),!1;try{await o.verifyEntry(e,this._keystore)}catch(t){return console.log(t),console.log("Couldn't verify entry:\n",e),!1}return!0})).every(e=>!0===e)};r=r||[e,this].sort((e,t)=>e.id>t.id)[0].id;const s=((e,t)=>{let r=Object.keys(e._headsIndex),n={},i={};const o=e=>{n[e]||t.get(e)||(r.push(e),n[e]=!0)};for(;r.length>0;){const s=r.shift(),a=e.get(s);a&&!t.get(s)&&(i[a.hash]=a,n[a.hash]=!0,a.next.forEach(o))}return i})(e,this);if(this._key){if(!await i(Object.values(s)))return this}this._entryIndex=Object.assign(this._entryIndex,s);if(Object.values(s).forEach(e=>e.next.forEach(t=>this._nextsIndex[t]=e.hash)),this._length+=Object.values(s).length,t>-1){let e=this.values;e=e.slice(-t),this._entryIndex=e.reduce(g,{}),this._length=Object.values(this._entryIndex).length}const u=Object.values(s).map(p).reduce(l,[]),h=y.findHeads(Object.values(Object.assign({},this._headsIndex,e._headsIndex))).filter(e=>!u.find(t=>t===e.hash)).filter(e=>!this._nextsIndex[e.hash]).reduce(g,{});this._headsIndex=h;const d=Object.values(this._headsIndex).reduce(b,0),m=new f(this.id,Math.max(this.clock.time,d));return this._id=r,this._clock=m,this}toJSON(){return{id:this.id,heads:this.heads.map(d)}}toSnapshot(){return{id:this.id,heads:this.heads,values:this.values}}toBuffer(){return t.from(JSON.stringify(this.toJSON()))}toString(e){return this.values.slice().reverse().map((t,r)=>{const n=o.findChildren(t,this.values).length;let i=new Array(Math.max(n-1,0));return i=n>1?i.fill(" "):i,(i=n>0?i.concat(["└─"]):i).join("")+(e?e(t.payload):t.payload)}).join("\n")}static isLog(e){return void 0!==e.id&&void 0!==e.heads&&void 0!==e._entryIndex}toMultihash(){return s.toMultihash(this._storage,this)}static fromMultihash(e,t,r=-1,n,i,o){if(!c(e))throw a.ImmutableDBNotDefinedError();if(!c(t))throw new Error(`Invalid hash: ${t}`);return s.fromMultihash(e,t,r,n,o).then(t=>new y(e,t.id,t.values,t.heads,t.clock,i))}static fromEntryHash(e,t,r,n=-1,i,o,f,u){if(!c(e))throw a.ImmutableDBNotDefinedError();if(!c(t))throw new Error("'hash' must be defined");return s.fromEntryHash(e,t,r,n,i,u).then(t=>new y(e,r,t.values,null,null,o,f))}static fromJSON(e,t,r=-1,n,i,o,f){if(!c(e))throw a.ImmutableDBNotDefinedError();return s.fromJSON(e,t,r,n,o,f).then(t=>new y(e,t.id,t.values,null,null,n,i))}static fromEntry(e,t,r=-1,n,i){if(!c(e))throw a.ImmutableDBNotDefinedError();if(!c(t))throw new Error("'sourceEntries' must be defined");return s.fromEntry(e,t,r,n,i).then(t=>new y(e,t.id,t.values))}static expandFrom(e,t,r,n=-1){if(!c(e))throw a.ImmutableDBNotDefinedError();if(!c(t))throw a.LogNotDefinedError();if(!c(r))throw new Error("'entries' must be given as argument");if(!y.isLog(t))throw a.NotALogError();return s.expandFrom(e,t,r,n).then(r=>new y(e,t.id,r.values,null,t.clock))}static expand(e,t,r){if(!c(e))throw a.ImmutableDBNotDefinedError();if(!c(t))throw a.LogNotDefinedError();if(!y.isLog(t))throw a.NotALogError();return s.expand(e,t,r).then(r=>new y(e,t.id,r.values,t.heads,t.clock))}static findHeads(e){var t=e.reduce((e,t,r,n)=>{return t.next.forEach(r=>e[r]=t.hash),e},{});return e.filter(e=>void 0===t[e.hash]).sort((e,t)=>e.id>t.id)}static findTails(e){var t={},r=[],n={},i=[];e.forEach(e=>{0===e.next.length&&r.push(e);e.next.forEach(r=>{t[r]||(t[r]=[]),t[r].push(e)}),i=i.concat(e.next),n[e.hash]=!0});const s=i.filter(e=>void 0===n[e]).map(e=>t[e]).reduce((e,t,r,n)=>e.concat(u(t,"hash")),[]).concat(r);return u(s,"hash").sort(o.compare)}static findTailHashes(e){var t={};return e.forEach(e=>t[e.hash]=!0),e.reduce((e,r,n,i)=>{return r.next.reverse().forEach(r=>{void 0===t[r]&&e.splice(0,0,r)}),e},[])}}e.exports=y}).call(t,r(0).Buffer)},function(e,t,r){"use strict";e.exports={ImmutableDBNotDefinedError:()=>new Error("ImmutableDB instance not defined"),LogNotDefinedError:()=>new Error("Log instance not defined"),NotALogError:()=>new Error("Given argument is not an instance of Log")}},function(e,t,r){"use strict";e.exports=function(e,t){let r={};return e.forEach(e=>r[t?e[t]:e]=e),Object.keys(r).map(e=>r[e])}},function(e,t,r){"use strict";const{deepEqual:n}=r(85),i=(e,t)=>e+t;class o{constructor(e,t){this.id=e,this._counters=t||{},this._counters[this.id]=this._counters[this.id]?this._counters[this.id]:0}get value(){return Object.values(this._counters).reduce(i,0)}increment(e){e&&e<1||(void 0!==e&&null!==e||(e=1),this._counters[this.id]=this._counters[this.id]+e)}merge(e){Object.entries(e._counters).forEach(([e,t])=>{this._counters[e]=Math.max(this._counters[e]||0,t)})}toJSON(){return{id:this.id,counters:this._counters}}isEqual(e){return o.isEqual(this,e)}static from(e){return new o(e.id,e.counters)}static isEqual(e,t){return e.id===t.id&&n(e._counters,t._counters)}}e.exports=o},function(e,t,r){(function(e,r){function n(e,t){return e.set(t[0],t[1]),e}function i(e,t){return e.add(t),e}function o(e,t,r,n){var i=-1,o=e?e.length:0;for(n&&o&&(r=e[++i]);++i-1&&e%1==0&&e-1&&e%1==0&&e<=P}(e.length)&&!A(e)}function A(e){var t=I(e)?_e.call(e):"";return t==L||t==T}function I(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function O(e){return E(e)?p(e):function(e){if(!k(e))return Pe(e);var t=[];for(var r in Object(e))we.call(e,r)&&"constructor"!=r&&t.push(r);return t}(e)}var j=200,R="__lodash_hash_undefined__",P=9007199254740991,C="[object Arguments]",N="[object Boolean]",B="[object Date]",L="[object Function]",T="[object GeneratorFunction]",q="[object Map]",D="[object Number]",z="[object Object]",F="[object Promise]",U="[object RegExp]",$="[object Set]",J="[object String]",W="[object Symbol]",Y="[object WeakMap]",K="[object ArrayBuffer]",V="[object DataView]",H="[object Float32Array]",G="[object Float64Array]",Z="[object Int8Array]",X="[object Int16Array]",Q="[object Int32Array]",ee="[object Uint8Array]",te="[object Uint8ClampedArray]",re="[object Uint16Array]",ne="[object Uint32Array]",ie=/\w*$/,oe=/^\[object .+?Constructor\]$/,se=/^(?:0|[1-9]\d*)$/,ae={};ae[C]=ae["[object Array]"]=ae[K]=ae[V]=ae[N]=ae[B]=ae[H]=ae[G]=ae[Z]=ae[X]=ae[Q]=ae[q]=ae[D]=ae[z]=ae[U]=ae[$]=ae[J]=ae[W]=ae[ee]=ae[te]=ae[re]=ae[ne]=!0,ae["[object Error]"]=ae[L]=ae[Y]=!1;var fe="object"==typeof e&&e&&e.Object===Object&&e,ce="object"==typeof self&&self&&self.Object===Object&&self,ue=fe||ce||Function("return this")(),he="object"==typeof t&&t&&!t.nodeType&&t,de=he&&"object"==typeof r&&r&&!r.nodeType&&r,le=de&&de.exports===he,pe=Array.prototype,be=Function.prototype,ge=Object.prototype,ye=ue["__core-js_shared__"],me=function(){var e=/[^.]+$/.exec(ye&&ye.keys&&ye.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}(),ve=be.toString,we=ge.hasOwnProperty,_e=ge.toString,Se=RegExp("^"+ve.call(we).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),ke=le?ue.Buffer:void 0,xe=ue.Symbol,Me=ue.Uint8Array,Ee=f(Object.getPrototypeOf,Object),Ae=Object.create,Ie=ge.propertyIsEnumerable,Oe=pe.splice,je=Object.getOwnPropertySymbols,Re=ke?ke.isBuffer:void 0,Pe=f(Object.keys,Object),Ce=S(ue,"DataView"),Ne=S(ue,"Map"),Be=S(ue,"Promise"),Le=S(ue,"Set"),Te=S(ue,"WeakMap"),qe=S(Object,"create"),De=x(Ce),ze=x(Ne),Fe=x(Be),Ue=x(Le),$e=x(Te),Je=xe?xe.prototype:void 0,We=Je?Je.valueOf:void 0;u.prototype.clear=function(){this.__data__=qe?qe(null):{}},u.prototype.delete=function(e){return this.has(e)&&delete this.__data__[e]},u.prototype.get=function(e){var t=this.__data__;if(qe){var r=t[e];return r===R?void 0:r}return we.call(t,e)?t[e]:void 0},u.prototype.has=function(e){var t=this.__data__;return qe?void 0!==t[e]:we.call(t,e)},u.prototype.set=function(e,t){return this.__data__[e]=qe&&void 0===t?R:t,this},h.prototype.clear=function(){this.__data__=[]},h.prototype.delete=function(e){var t=this.__data__,r=g(t,e);return!(r<0||(r==t.length-1?t.pop():Oe.call(t,r,1),0))},h.prototype.get=function(e){var t=this.__data__,r=g(t,e);return r<0?void 0:t[r][1]},h.prototype.has=function(e){return g(this.__data__,e)>-1},h.prototype.set=function(e,t){var r=this.__data__,n=g(r,e);return n<0?r.push([e,t]):r[n][1]=t,this},d.prototype.clear=function(){this.__data__={hash:new u,map:new(Ne||h),string:new u}},d.prototype.delete=function(e){return _(this,e).delete(e)},d.prototype.get=function(e){return _(this,e).get(e)},d.prototype.has=function(e){return _(this,e).has(e)},d.prototype.set=function(e,t){return _(this,e).set(e,t),this},l.prototype.clear=function(){this.__data__=new h},l.prototype.delete=function(e){return this.__data__.delete(e)},l.prototype.get=function(e){return this.__data__.get(e)},l.prototype.has=function(e){return this.__data__.has(e)},l.prototype.set=function(e,t){var r=this.__data__;if(r instanceof h){var n=r.__data__;if(!Ne||n.length{let t=e;return n.isBuffer(t)||(t=n.from(t)),t})},function(e,t,r){(function(t,n){function i(e){if(!arguments.length||void 0===e)throw new Error("constructor requires at least a location argument");if("string"!=typeof e)throw new Error("constructor requires a location string argument");this.location=e}var o=r(124),s=r(125),a=r(126);i.prototype.open=function(e,r){if("function"==typeof e&&(r=e),"function"!=typeof r)throw new Error("open() requires a callback argument");if("object"!=typeof e&&(e={}),"function"==typeof this._open)return this._open(e,r);t.nextTick(r)},i.prototype.close=function(e){if("function"!=typeof e)throw new Error("close() requires a callback argument");if("function"==typeof this._close)return this._close(e);t.nextTick(e)},i.prototype.get=function(e,r,n){var i;if("function"==typeof r&&(n=r),"function"!=typeof n)throw new Error("get() requires a callback argument");return(i=this._checkKeyValue(e,"key",this._isBuffer))?n(i):(this._isBuffer(e)||(e=String(e)),"object"!=typeof r&&(r={}),"function"==typeof this._get?this._get(e,r,n):void t.nextTick(function(){n(new Error("NotFound"))}))},i.prototype.put=function(e,r,n,i){var o;if("function"==typeof n&&(i=n),"function"!=typeof i)throw new Error("put() requires a callback argument");return(o=this._checkKeyValue(e,"key",this._isBuffer))?i(o):(o=this._checkKeyValue(r,"value",this._isBuffer))?i(o):(this._isBuffer(e)||(e=String(e)),this._isBuffer(r)||t.browser||(r=String(r)),"object"!=typeof n&&(n={}),"function"==typeof this._put?this._put(e,r,n,i):void t.nextTick(i))},i.prototype.del=function(e,r,n){var i;if("function"==typeof r&&(n=r),"function"!=typeof n)throw new Error("del() requires a callback argument");return(i=this._checkKeyValue(e,"key",this._isBuffer))?n(i):(this._isBuffer(e)||(e=String(e)),"object"!=typeof r&&(r={}),"function"==typeof this._del?this._del(e,r,n):void t.nextTick(n))},i.prototype.batch=function(e,r,n){if(!arguments.length)return this._chainedBatch();if("function"==typeof r&&(n=r),"function"!=typeof n)throw new Error("batch(array) requires a callback argument");if(!Array.isArray(e))return n(new Error("batch(array) requires an array argument"));"object"!=typeof r&&(r={});for(var i,o,s=0,a=e.length;s>8,s=255&i;o?r.push(o,s):r.push(s)}return r},o.zero2=n,o.toHex=i,o.encode=function(e,t){return"hex"===t?i(e):e}},function(e,t,r){"use strict";function n(e,t,r){return e&t^~e&r}function i(e,t,r){return e&t^e&r^t&r}function o(e,t,r){return e^t^r}var s=r(3).rotr32;t.ft_1=function(e,t,r,s){return 0===e?n(t,r,s):1===e||3===e?o(t,r,s):2===e?i(t,r,s):void 0},t.ch32=n,t.maj32=i,t.p32=o,t.s0_256=function(e){return s(e,2)^s(e,13)^s(e,22)},t.s1_256=function(e){return s(e,6)^s(e,11)^s(e,25)},t.g0_256=function(e){return s(e,7)^s(e,18)^e>>>3},t.g1_256=function(e){return s(e,17)^s(e,19)^e>>>10}},function(e,t,r){"use strict";function n(){if(!(this instanceof n))return new n;y.call(this),this.h=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],this.k=m,this.W=new Array(64)}var i=r(3),o=r(15),s=r(54),a=r(9),f=i.sum32,c=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,g=s.g1_256,y=o.BlockHash,m=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298];i.inherits(n,y),e.exports=n,n.blockSize=512,n.outSize=256,n.hmacStrength=192,n.padLength=64,n.prototype._update=function(e,t){for(var r=this.W,n=0;n<16;n++)r[n]=e[t+n];for(;ne.hash),null,2)),await r.sync(t)}catch(e){g.error(e)}}_onPeerConnected(e,t,r){g.debug(`New peer '${t}' connected to '${e}'`);const n=this.stores[e];if(n){let i=n._oplog.heads;i.length>0&&(g.debug(`Send latest heads of '${e}':\n`,JSON.stringify(i.map(e=>e.hash),null,2)),r.sendTo(t,JSON.stringify(i))),n.events.emit("peer",t)}}_onClosed(e){g.debug(`Database '${e}' was closed`),this.stores[e].events.removeAllListeners("closed"),this._pubsub&&this._pubsub.unsubscribe(e),delete this.stores[e]}async create(e,t,r={}){if(g.debug("create()"),!m.isValidType(t))throw new Error(`Invalid database type '${t}'`);const i=r.directory||this.directory;if(g.debug(`Creating database '${e}' as ${t} in '${i}'`),l.isValid(e))throw new Error("Given database name is an address. Please give only the name of the database!");const o=new d(this._ipfs);r&&r.write&&r.write.length>0?r.write.forEach(e=>o.add("write",e)):o.add("write",this.key.getPublic("hex"));const s=await o.save(),a=await p(this._ipfs,e,t,s),f=l.parse(n.join("/orbitdb",a,e));if(await this._loadCache(i,f).then(e=>e?e.get(n.join(f.toString(),"_manifest")):null).then(e=>void 0!==e&&null!==e)&&!r.overwrite)throw new Error(`Database '${f}' already exists!`);return await this._saveDBManifest(i,f),g.debug(`Created database '${f}'`),this.open(f,r)}async open(e,t={}){g.debug("open()"),t=Object.assign({localOnly:!1,create:!1},t),g.debug(`Open database '${e}'`);const r=t.directory||this.directory;if(g.debug(`Look from '${r}'`),!l.isValid(e)){if(t.create){if(t.create&&!t.type)throw new Error(`Database type not provided! Provide a type with 'options.type' (${y.join("|")})`);return g.warn(`Not a valid OrbitDB address '${e}', creating the database`),t.overwrite=!t.overwrite||t.overwrite,this.create(e,t.type,t)}throw new Error("'options.create' set to 'false'. If you want to create a database, set 'options.create' to 'true'.")}const i=l.parse(e),o=await this._loadCache(r,i).then(e=>e?e.get(n.join(i.toString(),"_manifest")):null).then(e=>void 0!==e&&null!==e);if(g.debug((o?"Found":"Didn't find")+` database '${i}'`),t.localOnly&&!o)throw g.error(`Database '${i}' doesn't exist!`),new Error(`Database '${i}' doesn't exist!`);g.debug(`Loading Manifest for '${i}'`);const s=await this._ipfs.object.get(i.root),a=JSON.parse(s.toJSON().data);if(g.debug(`Manifest for '${i}':\n${JSON.stringify(a,null,2)}`),t.type&&a.type!==t.type)throw new Error(`Database '${i}' is type '${a.type}' but was opened as '${t.type}'`);return await this._saveDBManifest(r,i),t=Object.assign({},t,{accessControllerAddress:a.accessController}),this._openDatabase(i,a.type,t)}async _saveDBManifest(e,t){const r=await this._loadCache(e,t);await r.set(n.join(t.toString(),"_manifest"),t.root),g.debug(`Saved manifest to IPFS as '${t.root}'`)}async _loadCache(e,t){let r;try{r=await u.load(e,t)}catch(e){console.log(e),g.error("Couldn't load Cache:",e)}return r}async _openDatabase(e,t,r){if("counter"===t)return this._createStore(a,e,r);if("eventlog"===t)return this._createStore(i,e,r);if("feed"===t)return this._createStore(o,e,r);if("docstore"===t)return this._createStore(f,e,r);if("keyvalue"===t)return this._createStore(s,e,r);throw new Error(`Invalid database type '${t}'`)}static isValidType(e){return y.includes(e)}static create(){return new Error("Not implemented yet!")}static open(){return new Error("Not implemented yet!")}}e.exports=m},function(e,t,r){"use strict";function n(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");return"="===e[t-2]?2:"="===e[t-1]?1:0}function i(e){return s[e>>18&63]+s[e>>12&63]+s[e>>6&63]+s[63&e]}function o(e,t,r){for(var n,o=[],s=t;s0?c-4:c;var u=0;for(t=0;t>16&255,s[u++]=i>>8&255,s[u++]=255&i;return 2===o?(i=a[e.charCodeAt(t)]<<2|a[e.charCodeAt(t+1)]>>4,s[u++]=255&i):1===o&&(i=a[e.charCodeAt(t)]<<10|a[e.charCodeAt(t+1)]<<4|a[e.charCodeAt(t+2)]>>2,s[u++]=i>>8&255,s[u++]=255&i),s},t.fromByteArray=function(e){for(var t,r=e.length,n=r%3,i="",a=[],f=0,c=r-n;fc?c:f+16383));return 1===n?(t=e[r-1],i+=s[t>>2],i+=s[t<<4&63],i+="=="):2===n&&(t=(e[r-2]<<8)+e[r-1],i+=s[t>>10],i+=s[t>>4&63],i+=s[t<<2&63],i+="="),a.push(i),a.join("")};for(var s=[],a=[],f="undefined"!=typeof Uint8Array?Uint8Array:Array,c="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",u=0,h=c.length;u>1,u=-7,h=r?i-1:0,d=r?-1:1,l=e[t+h];for(h+=d,o=l&(1<<-u)-1,l>>=-u,u+=a;u>0;o=256*o+e[t+h],h+=d,u-=8);for(s=o&(1<<-u)-1,o>>=-u,u+=n;u>0;s=256*s+e[t+h],h+=d,u-=8);if(0===o)o=1-c;else{if(o===f)return s?NaN:1/0*(l?-1:1);s+=Math.pow(2,n),o-=c}return(l?-1:1)*s*Math.pow(2,o-n)},t.write=function(e,t,r,n,i,o){var s,a,f,c=8*o-i-1,u=(1<>1,d=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,l=n?0:o-1,p=n?1:-1,b=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(a=isNaN(t)?1:0,s=u):(s=Math.floor(Math.log(t)/Math.LN2),t*(f=Math.pow(2,-s))<1&&(s--,f*=2),(t+=s+h>=1?d/f:d*Math.pow(2,1-h))*f>=2&&(s++,f/=2),s+h>=u?(a=0,s=u):s+h>=1?(a=(t*f-1)*Math.pow(2,i),s+=h):(a=t*Math.pow(2,h-1)*Math.pow(2,i),s=0));i>=8;e[r+l]=255&a,l+=p,a/=256,i-=8);for(s=s<0;e[r+l]=255&s,l+=p,s/=256,c-=8);e[r+l-p]|=128*b}},function(e,t){},function(e,t,r){"use strict";function n(e,t,r){e.copy(t,r)}var i=r(8).Buffer;e.exports=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.head=null,this.tail=null,this.length=0}return e.prototype.push=function(e){var t={data:e,next:null};this.length>0?this.tail.next=t:this.head=t,this.tail=t,++this.length},e.prototype.unshift=function(e){var t={data:e,next:this.head};0===this.length&&(this.tail=t),this.head=t,++this.length},e.prototype.shift=function(){if(0!==this.length){var e=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,e}},e.prototype.clear=function(){this.head=this.tail=null,this.length=0},e.prototype.join=function(e){if(0===this.length)return"";for(var t=this.head,r=""+t.data;t=t.next;)r+=e+t.data;return r},e.prototype.concat=function(e){if(0===this.length)return i.alloc(0);if(1===this.length)return this.head.data;for(var t=i.allocUnsafe(e>>>0),r=this.head,o=0;r;)n(r.data,t,o),o+=r.data.length,r=r.next;return t},e}()},function(e,t,r){(function(e,t){!function(e,r){"use strict";function n(e){delete a[e]}function i(e){if(f)setTimeout(i,0,e);else{var t=a[e];if(t){f=!0;try{!function(e){var t=e.callback,n=e.args;switch(n.length){case 0:t();break;case 1:t(n[0]);break;case 2:t(n[0],n[1]);break;case 3:t(n[0],n[1],n[2]);break;default:t.apply(r,n)}}(t)}finally{n(e),f=!1}}}}if(!e.setImmediate){var o,s=1,a={},f=!1,c=e.document,u=Object.getPrototypeOf&&Object.getPrototypeOf(e);u=u&&u.setTimeout?u:e,"[object process]"==={}.toString.call(e.process)?o=function(e){t.nextTick(function(){i(e)})}:function(){if(e.postMessage&&!e.importScripts){var t=!0,r=e.onmessage;return e.onmessage=function(){t=!1},e.postMessage("","*"),e.onmessage=r,t}}()?function(){var t="setImmediate$"+Math.random()+"$",r=function(r){r.source===e&&"string"==typeof r.data&&0===r.data.indexOf(t)&&i(+r.data.slice(t.length))};e.addEventListener?e.addEventListener("message",r,!1):e.attachEvent("onmessage",r),o=function(r){e.postMessage(t+r,"*")}}():e.MessageChannel?function(){var e=new MessageChannel;e.port1.onmessage=function(e){i(e.data)},o=function(t){e.port2.postMessage(t)}}():c&&"onreadystatechange"in c.createElement("script")?function(){var e=c.documentElement;o=function(t){var r=c.createElement("script");r.onreadystatechange=function(){i(t),r.onreadystatechange=null,e.removeChild(r),r=null},e.appendChild(r)}}():o=function(e){setTimeout(i,0,e)},u.setImmediate=function(e){"function"!=typeof e&&(e=new Function(""+e));for(var t=new Array(arguments.length-1),r=0;rn(e,(e,r,n)=>t(r,n)).then(()=>e))},function(e,t,r){"use strict";e.exports=((e,t,r)=>new Promise((n,i)=>{const o=e[Symbol.iterator]();let s=0;const a=e=>{const r=o.next();r.done?n(e):Promise.all([e,r.value]).then(e=>{a(t(e[0],e[1],s++))}).catch(i)};a(r)}))},function(e,t,r){"use strict";e.exports=class{constuctor(e){}append(e){}merge(e){}get(e){}has(e){}get values(){}get length(){}}},function(e,t,r){"use strict";r(18);const n=r(21),i=r(69),o=r(22),s=r(40),a=r(23),f=r(41),c=r(71),u=r(72),h=(e,t)=>e.slice(e.length-t,e.length);e.exports=class{static toMultihash(e,t){if(!a(e))throw s.ImmutableDBNotDefinedError();if(!a(t))throw s.LogNotDefinedError();if(t.values.length<1)throw new Error("Can't serialize an empty log");return e.object.put(t.toBuffer()).then(e=>e.toJSON().multihash)}static fromMultihash(e,t,r=-1,f,c){if(!a(e))throw s.ImmutableDBNotDefinedError();if(!a(t))throw new Error(`Invalid hash: ${t}`);return e.object.get(t,{enc:"base58"}).then(e=>JSON.parse(e.toJSON().data)).then(t=>{if(!t.heads||!t.id)throw s.NotALogError();return i.fetchAll(e,t.heads,r,f,null,c).then(e=>{const r=e.reduce((e,t)=>t.clock.time>e.time?new o(t.clock.id,t.clock.time):e,new o(t.id)),i=e.slice().sort(n.compare),s=i.filter(e=>t.heads.includes(e.hash));return{id:t.id,values:i,heads:s,clock:r}})})}static fromEntryHash(e,t,r,n=-1,o,f){if(!a(e))throw s.IpfsNotDefinedError();if(!a(t))throw new Error("'entryHash' must be defined");n=n>-1?Math.max(n,1):n;const c=o;return i.fetchParallel(e,[t],n,c,null,null,f).then(e=>({values:n>-1?h(e,n):e}))}static fromJSON(e,t,r=-1,o,f,c){if(!a(e))throw s.ImmutableDBNotDefinedError();return i.fetchParallel(e,t.heads.map(e=>e.hash),r,[],16,f,c).then(e=>{const r=e.slice().sort(n.compare);return e.filter(e=>t.heads.includes(e.hash)),{id:t.id,values:r,heads:t.heads}})}static fromEntry(e,t,r=-1,o,c,h,d){if(!a(e))throw s.ImmutableDBNotDefinedError();if(!a(t))throw new Error("'sourceEntries' must be defined");if(!Array.isArray(t)&&!n.isEntry(t))throw new Error("'sourceEntries' argument must be an array of Entry instances or a single Entry");Array.isArray(t)||(t=[t]),r=r>-1?Math.max(r,t.length):r;const l=o?o.map(e=>e.hash?e.hash:e):o,p=t.map(e=>e.hash);return i.fetchParallel(e,p,r,l,null,null,d).then(e=>{var i=t.concat(e),o=f(i,"hash").sort(n.compare);const s=o.slice(r>-1?-r:-o.length),a=((e,t)=>{var r=e.slice(t.length,e.length);return t.concat(r)})(s,u(s,t,"hash"));return{id:a[a.length-1].id,values:a}})}static expandFrom(e,t,r,n=-1){if(!a(e))throw s.ImmutableDBNotDefinedError();if(!a(t))throw s.LogNotDefinedError();if(!a(r))throw new Error("'entries' must be given as argument");Array.isArray(r)||(r=[r]);const o=r.map(e=>e.next).filter(e=>e.length>0);return 0===o.length?Promise.resolve({values:t.values}):i.fetchParallel(e,o,n,t.values).then(e=>({values:t.merge(e.slice(0,n))}))}static expand(e,t,r=-1){if(!a(e))throw s.ImmutableDBNotDefinedError();if(!a(t))throw s.LogNotDefinedError();return 0===t.tailHashes.length?Promise.resolve({values:t.values}):i.fetchParallel(e,t.tailHashes,r,t.values).then(e=>{const i=r>-1?t.values.length+r:-1,o=t.values.concat(e).sort(n.compare),s=i>-1?o.slice(-i):o.slice(),a=u(s,t.values,"hash").sort(n.compare),h=u(t.values,s,"hash").sort(n.compare),d=c(t.values,s,"hash").sort(n.compare),l=i-(d.length+a.length),p=(e,t)=>{var r=[];return r=e.concat(t),f(r,"hash").sort(n.compare)};return{values:p(a,p(d,l>-1?h.slice(-l):h))}})}}},function(e,t,r){"use strict";const n=r(70),i=r(18),o=r(21);class s{static fetchParallel(e,t,r,n=[],o,a,f){const c=(e,t)=>e.concat(t);return i(t,t=>s.fetchAll(e,t,r,n,a,f),{concurrency:Math.max(o||t.length,1)}).then(e=>e.reduce(c,[]))}static fetchAll(e,t,r,i=[],s=null,a){let f=[],c={},u=Array.isArray(t)?t.slice():[t];const h=e=>u.push(e);i.forEach(e=>c[e.hash]=e);return n(()=>u.length>0&&(f.length{const t=u.shift();return c[t]?Promise.resolve():new Promise((r,n)=>{const i=s?setTimeout(()=>{console.warn(`Warning: Couldn't fetch entry '${t}', request timed out (${s}ms)`),r()},s):null;0,o.fromMultihash(e,t).then(e=>{clearTimeout(i),o.isEntry(e)&&(e.next.forEach(h),f.push(e),c[t]=e,0,a&&a(t,e,f.length))}).then(r).catch(e=>{r()})})}).then(()=>f)}}e.exports=s},function(e,t,r){"use strict";const n=e=>new Promise(t=>{t(e())});e.exports=((e,t)=>n(function r(){if(e())return n(t).then(r)}))},function(e,t,r){"use strict";e.exports=function(e,t,r){var n={},i={};return e.forEach(e=>i[r?e[r]:e]=!0),t.reduce((e,t)=>{var o=void 0!==i[r?t[r]:t],s=void 0!==n[r?t[r]:t];return o&&!s&&(e.push(t),n[r?t[r]:t]=!0),e},[])}},function(e,t,r){"use strict";e.exports=function(e,t,r){var n={},i={};return e.forEach(e=>i[r?e[r]:e]=!0),t.reduce((e,t)=>{var o=void 0!==i[r?t[r]:t],s=void 0!==n[r?t[r]:t];return o||s||(e.push(t),n[r?t[r]:t]=!0),e},[])}},function(e,t,r){"use strict";e.exports=class{constructor(e){this.id=e,this._index=[]}get(){return this._index}updateIndex(e,t){this._index=e.values}}},function(e,t,r){const n=r(7).EventEmitter,i=r(18),o=r(39),s=r(19),a=s.create("orbit-db.replicator",{color:s.Colors.Cyan});s.setLogLevel("ERROR");const f=e=>e.next,c=(e,t)=>e.concat(t),u=e=>null!==e&&void 0!==e,h=(e,t)=>(e[t]=t,e),d=1;e.exports=class extends n{constructor(e,t){super(),this._store=e,this._fetching={},this._stats={tasksRequested:0,tasksStarted:0,tasksProcessed:0,a:0,b:0,c:0,d:0},this._buffer=[],this._concurrency=t||128,this._queue={},this._q=new Set,this._flushTimer=setInterval(()=>{0===this.tasksRunning&&Object.keys(this._queue).length>0&&(a.error("Had to flush the queue!",Object.keys(this._queue).length,"items in the queue, ",this.tasksRequested,this.tasksFinished," tasks requested/finished"),setTimeout(()=>this._processQueue(),0))},3e3)}get tasksRequested(){return this._stats.tasksRequested}get tasksStarted(){return this._stats.tasksStarted}get tasksRunning(){return this._stats.tasksStarted-this._stats.tasksProcessed}get tasksQueued(){return Object.keys(this._queue).length-this.tasksRunning}get tasksFinished(){return this._stats.tasksProcessed}getQueue(){return Object.values(this._queue)}load(e){this._stats.a+=1;const t=e=>!this._store._oplog.has(e.hash||e)&&!this._queue[e.hash||e];try{e.filter(u).filter(t).forEach(this._addToQueue.bind(this)),setTimeout(()=>this._processQueue(),0)}catch(e){console.error(e)}this._stats.a--}_addToQueue(e){this._stats.b++;const t=e.hash||e;this._store._oplog.has(t)||this._fetching[t]||this._queue[t]?this._stats.b--:(this._stats.tasksRequested+=1,this._queue[t]=e,this._stats.b--)}async _processQueue(){if(this._stats.c++,this.tasksRunningdelete this._queue[e.hash||e]),i(t,e=>this._processOne(e)).then(e=>e.reduce(c,[]).reduce(h,{})).then(e=>{const r=Object.values(e).filter(u);if(t.length>0&&this._buffer.length>0||0===this.tasksRunning&&this._buffer.length>0){const e=this._buffer.slice();this._buffer=[],this.emit("load.end",e)}r.length>0&&this.load(r),this._stats.c--})}}async _processOne(e){this._stats.d++;const t=e.hash||e;if(this._store._oplog.has(t)||this._fetching[t])return void this._stats.d--;this._fetching[t]=t,this.emit("load.added",e),this._stats.tasksStarted+=1;const r=await o.fromEntryHash(this._store._ipfs,t,this._store._oplog.id,d,[],this._store.key,this._store.access.write);this._buffer.push(r);const n=r.values[0];return delete this._queue[t],this._stats.tasksProcessed+=1,this.emit("load.progress",this._id,t,n,null,this._buffer.length),this._stats.d--,r.values.map(f).reduce(c,[])}}},function(e,t){e.exports={}},function(e,t){e.exports=function(e){return e&&"object"==typeof e&&"function"==typeof e.copy&&"function"==typeof e.fill&&"function"==typeof e.readUInt8}},function(e,t){"function"==typeof Object.create?e.exports=function(e,t){e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})}:e.exports=function(e,t){e.super_=t;var r=function(){};r.prototype=t.prototype,e.prototype=new r,e.prototype.constructor=e}},function(e,t,r){"use strict";e.exports=class{constructor(){this._index=null}get(){return this._index?this._index.values:[]}updateIndex(e){this._index=e}}},function(e,t,r){"use strict";const n=r(29),i=r(80);e.exports=class extends n{constructor(e,t,r,n){n||(n={}),n.Index||Object.assign(n,{Index:i}),super(e,t,r,n),this._type="feed"}remove(e){return this.del(e)}del(e){const t={op:"DEL",key:null,value:e};return this._addOperation(t)}}},function(e,t,r){"use strict";e.exports=class{constructor(){this._index={}}get(){return Object.keys(this._index).map(e=>this._index[e])}updateIndex(e){this._index={},e.values.reduce((e,t)=>(e.includes(t.hash)||(e.push(t.hash),"ADD"===t.payload.op?this._index[t.hash]=t:"DEL"===t.payload.op&&delete this._index[t.payload.value]),e),[])}}},function(e,t,r){"use strict";const n=r(16),i=r(82);e.exports=class extends n{constructor(e,t,r,n){let o=Object.assign({},{Index:i});Object.assign(o,n),super(e,t,r,o),this._type="keyvalue"}get(e){return this._index.get(e)}set(e,t){return this.put(e,t)}put(e,t){return this._addOperation({op:"PUT",key:e,value:t})}del(e){return this._addOperation({op:"DEL",key:e,value:null})}}},function(e,t,r){"use strict";e.exports=class{constructor(){this._index={}}get(e){return this._index[e]}updateIndex(e){e.values.slice().reverse().reduce((e,t)=>(e.includes(t.payload.key)||(e.push(t.payload.key),"PUT"===t.payload.op?this._index[t.payload.key]=t.payload.value:"DEL"===t.payload.op&&delete this._index[t.payload.key]),e),[])}}},function(e,t,r){"use strict";const n=r(16),i=r(84),o=r(42);e.exports=class extends n{constructor(e,t,r,n={}){n.Index||Object.assign(n,{Index:i}),super(e,t,r,n),this._type="counter"}get value(){return this._index.get().value}inc(e){const t=new o(this.id,Object.assign({},this._index.get()._counters));return t.increment(e),this._addOperation({op:"COUNTER",key:null,value:t.toJSON()})}}},function(e,t,r){"use strict";const n=r(42);e.exports=class{constructor(e){this._index=new n(e)}get(){return this._index}updateIndex(e){this._index&&e.values.filter(e=>e&&"COUNTER"===e.payload.op).map(e=>n.from(e.payload.value)).forEach(e=>this._index.merge(e))}}},function(e,t,r){"use strict";t.deepEqual=((e,t)=>{const r=Object.getOwnPropertyNames(e),n=Object.getOwnPropertyNames(t);if(r.length!==n.length)return!1;for(let n=0;ne.toString().split(t).join(r));e.exports=class extends n{constructor(e,t,r,n){n||(n={}),n.indexBy||Object.assign(n,{indexBy:"_id"}),n.Index||Object.assign(n,{Index:i}),super(e,t,r,n),this._type="docstore"}get(e,t=!1){const r=(e=e.toString()).split(" ");return e=r.length>1?s(e,"."," ").toLowerCase():e.toLowerCase(),Object.keys(this._index._index).filter(n=>t?-1!==n.indexOf(e):(t=>r.length>1?-1!==s(t,"."," ").toLowerCase().indexOf(e):-1!==t.toLowerCase().indexOf(e))(n)).map(e=>this._index.get(e))}query(e){return Object.keys(this._index._index).map(e=>this._index.get(e)).filter(t=>e(t))}batchPut(e,t){return o(e,(r,n)=>this._addOperationBatch({op:"PUT",key:r[this.options.indexBy],value:r},!0,n===e.length-1,t),{concurrency:1}).then(()=>this.saveSnapshot())}put(e){if(!e[this.options.indexBy])throw new Error(`The provided document doesn't contain field '${this.options.indexBy}'`);return this._addOperation({op:"PUT",key:e[this.options.indexBy],value:e})}del(e){if(!this._index.get(e))throw new Error(`No entry with key '${e}' in the database`);return this._addOperation({op:"DEL",key:e,value:null})}}},function(e,t,r){"use strict";e.exports=class{constructor(){this._index={}}get(e){return this._index[e]}updateIndex(e,t){e.values.slice().reverse().reduce((e,r,n)=>(!0!==e[r.payload.key]&&(e[r.payload.key]=!0,"PUT"===r.payload.op?this._index[r.payload.key]=r.payload.value:"DEL"===r.payload.op&&delete this._index[r.payload.key]),t&&t(r,n),e),{})}}},function(e,t,r){"use strict";e.exports=((e,t,r)=>new Promise((n,i)=>{const o=(r=Object.assign({concurrency:1/0},r)).concurrency;if(o<1)throw new TypeError("Expected `concurrency` to be a number from 1 and up");const s=[],a=e[Symbol.iterator]();let f=!1,c=!1,u=0,h=0;const d=()=>{if(f)return;const e=a.next(),r=h;if(h++,e.done)return c=!0,void(0===u&&n(s));u++,Promise.resolve(e.value).then(e=>t(e,r)).then(e=>{s[r]=e,u--,d()},e=>{f=!0,i(e)})};for(let e=0;e{o.error("Pubsub Error:",e)}),i.on("message",e=>{this._handleMessage(e)}),i.on("peer joined",t=>{o.debug("Peer connected:",e,e===i._topic),this._subscriptions[e]?this._subscriptions[e].onNewPeer(e,t,i):(o.warn("Peer joined a room we don't have a subscription for"),o.warn(t,i._topic,e))}),i.on("subscribed",()=>{this._subscriptions[e]={room:i,onMessage:t,onNewPeer:r},a++,o.debug("Topics open:",a)})}}unsubscribe(e){this._subscriptions[e]&&(this._subscriptions[e].room.leave(),this._subscriptions[e].room=null,delete this._subscriptions[e],o.debug(`Unsubscribed from '${e}'`),a--,o.debug("Topics open:",a))}publish(e,r){this._subscriptions[e]&&this._subscriptions[e].room&&this._ipfs.pubsub&&this._subscriptions[e].room.broadcast(t.from(JSON.stringify(r)))}disconnect(){Object.keys(this._subscriptions).forEach(e=>this.unsubscribe(e)),this._subscriptions={}}_handleMessage(e){if(e.from===this._id)return;let t,r,n;try{n=e.topicIDs[0],t=JSON.parse(e.data),r=this._subscriptions[n]}catch(t){o.error(t),o.error("Couldn't parse pubsub message:",e)}r&&r.onMessage&&t&&r.onMessage(n,t)}}}).call(t,r(0).Buffer)},function(e,t,r){"use strict";const n=r(92),i=r(7),o=r(36),s=r(43),a=r(8).Buffer,f=r(45),c=r(97),u=r(51),h=r(120),d={pollInterval:1e3};e.exports=((e,t,r)=>new class extends i{constructor(e,t,r){if(super(),this._ipfs=e,this._topic=t,this._options=Object.assign({},s(d),s(r)),this._peers=[],this._connections={},this._handleDirectMessage=this._handleDirectMessage.bind(this),!this._ipfs.pubsub)throw new Error("This IPFS node does not have pubsub.");this._ipfs.isOnline()?this._start():this._ipfs.on("ready",this._start.bind(this)),this._ipfs.on("stop",this.leave.bind(this))}getPeers(){return this._peers.slice(0)}hasPeer(e){return this._peers.indexOf(e)>=0}leave(){o.clearInterval(),Object.keys(this._connections).forEach(e=>{this._connections[e].stop()}),h.emitter.removeListener(this._topic,this._handleDirectMessage),this.emit("stop")}broadcast(e){let t=u(e);this._ipfs.pubsub.publish(this._topic,t,e=>{e&&this.emit("error",e)})}sendTo(e,t){let r=this._connections[e];r||((r=new c(e,this._ipfs,this)).on("error",e=>this.emit("error",e)),this._connections[e]=r,r.once("disconnect",()=>{delete this._connections[e],this._peers=this._peers.filter(t=>t!==e),this.emit("peer left",e)}));const n=a.from([0]),i={to:e,from:this._ipfs._peerInfo.id.toB58String(),data:a.from(t).toString("hex"),seqno:n.toString("hex"),topicIDs:[this._topic],topicCIDs:[this._topic]};r.push(a.from(JSON.stringify(i)))}_start(){this._interval=o.setInterval(this._pollPeers.bind(this),this._options.pollInterval);const e=this._onMessage.bind(this);this._ipfs.pubsub.subscribe(this._topic,e,e=>{e?this.emit("error",e):this.emit("subscribed",this._topic)}),this.once("stop",()=>{this._ipfs.pubsub.unsubscribe(this._topic,e)}),this._ipfs._libp2pNode.handle(f,h.handler),h.emitter.on(this._topic,this._handleDirectMessage)}_pollPeers(){this._ipfs.pubsub.peers(this._topic,(e,t)=>{if(e)return void this.emit("error",e);const r=t.sort();this._emitChanges(r)&&(this._peers=r)})}_emitChanges(e){const t=n(this._peers,e);return t.added.forEach(e=>this.emit("peer joined",e)),t.removed.forEach(e=>this.emit("peer left",e)),t.added.length>0||t.removed.length>0}_onMessage(e){this.emit("message",e)}_handleDirectMessage(e){if(e.to===this._ipfs._peerInfo.id.toB58String()){const t=Object.assign({},e);delete t.to,this.emit("message",t)}}}(e,t,r))},function(e,t,r){"use strict";function n(e,t,r){return e.indexOf(t)}function i(e,t,r){return e.findIndex(function(e){return function(e,t,r){return r.every(r=>t[r]===e[r])}(e,t,r)})}const o=r(43),s=r(93)("hyperdiff"),a=r(96),f=e=>-1!==e;e.exports=function(e,t,r){const{first:c,second:u}=function(e,t){return{first:e,second:o(t)}}(e,t),h=function(e){return e?i:n}(r);s("preconditions first=%j second=%j findIndex=%s",c,u,h.name);const d=c.reduce(function(e,t,n){const i=h(u,t,r),o=f(i)?"common":"removed";return e[o].push(t),a(u,i),s("index=%s value=%s collection=%s",n,t,o),e},{common:[],removed:[]});return d.added=u,s("added=%j removed=%j common%j",d.added,d.removed,d.common),d}},function(e,t,r){(function(n){function i(){var e;try{e=t.storage.debug}catch(e){}return!e&&void 0!==n&&"env"in n&&(e=Object({NODE_ENV:void 0}).DEBUG),e}(t=e.exports=r(94)).log=function(){return"object"==typeof console&&console.log&&Function.prototype.apply.call(console.log,console,arguments)},t.formatArgs=function(e){var r=this.useColors;if(e[0]=(r?"%c":"")+this.namespace+(r?" %c":" ")+e[0]+(r?"%c ":" ")+"+"+t.humanize(this.diff),r){var n="color: "+this.color;e.splice(1,0,n,"color: inherit");var i=0,o=0;e[0].replace(/%[a-zA-Z%]/g,function(e){"%%"!==e&&(i++,"%c"===e&&(o=i))}),e.splice(o,0,n)}},t.save=function(e){try{null==e?t.storage.removeItem("debug"):t.storage.debug=e}catch(e){}},t.load=i,t.useColors=function(){return!("undefined"==typeof window||!window.process||"renderer"!==window.process.type)||("undefined"==typeof navigator||!navigator.userAgent||!navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))&&("undefined"!=typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"undefined"!=typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/))},t.storage="undefined"!=typeof chrome&&void 0!==chrome.storage?chrome.storage.local:function(){try{return window.localStorage}catch(e){}}(),t.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],t.formatters.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}},t.enable(i())}).call(t,r(2))},function(e,t,r){function n(e){function r(){if(r.enabled){var e=r,i=+new Date,o=i-(n||i);e.diff=o,e.prev=n,e.curr=i,n=i;for(var s=new Array(arguments.length),a=0;a0)return function(e){if(!((e=String(e)).length>100)){var t=/^((?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|years?|yrs?|y)?$/i.exec(e);if(t){var r=parseFloat(t[1]);switch((t[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return r*a;case"days":case"day":case"d":return r*s;case"hours":case"hour":case"hrs":case"hr":case"h":return r*o;case"minutes":case"minute":case"mins":case"min":case"m":return r*i;case"seconds":case"second":case"secs":case"sec":case"s":return r*n;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return r;default:return}}}}(e);if("number"===f&&!1===isNaN(e))return t.long?function(e){return r(e,s,"day")||r(e,o,"hour")||r(e,i,"minute")||r(e,n,"second")||e+" ms"}(e):function(e){return e>=s?Math.round(e/s)+"d":e>=o?Math.round(e/o)+"h":e>=i?Math.round(e/i)+"m":e>=n?Math.round(e/n)+"s":e+"ms"}(e);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))}},function(e,t,r){(function(t){function r(e,t){for(var r=-1,n=t.length,i=e.length;++r0&&n(c)?t>1?f(c,t-1,n,i,o):r(o,c):i||(o[o.length]=c)}return o}function c(e,t){for(var r=0,n=(t=m(t,e)?[t]:d(t)).length;null!=e&&ri?0:i+t);(r=r>i?i:r)<0&&(r+=i);i=t>r?0:r-t>>>0,t>>>=0;var o=Array(i);for(;++nt||o&&s&&f&&!a&&!c||n&&s&&f||!r&&f||!i)return 1;if(!n&&!o&&!c&&e-1&&e%1==0&&e<=O}(e.length)&&!_(e)}(e)}(e)&&G.call(e,"callee")&&(!ee.call(e,"callee")||Z.call(e)==j)}(e)||!!(re&&e&&e[re])}function y(e,t){return!!(t=null==t?O:t)&&("number"==typeof e||z.test(e))&&e>-1&&e%1==0&&e-1},i.prototype.set=function(e,t){var r=this.__data__,n=s(r,e);return n<0?r.push([e,t]):r[n][1]=t,this},o.prototype.clear=function(){this.__data__={hash:new n,map:new(ie||i),string:new n}},o.prototype.delete=function(e){return p(this,e).delete(e)},o.prototype.get=function(e){return p(this,e).get(e)},o.prototype.has=function(e){return p(this,e).has(e)},o.prototype.set=function(e,t){return p(this,e).set(e,t),this};var fe=w(function(e){e=M(e);var t=[];return L.test(e)&&t.push(""),e.replace(T,function(e,r,n,i){t.push(n?i.replace(q,"$1"):r||e)}),t}),ce=function(e,t){return t=ne(void 0===t?e.length-1:t,0),function(){for(var r=arguments,n=-1,i=ne(r.length-t,0),o=Array(i);++nthis.push(e)),this._getConnection())}stop(){this._connection&&this._connection.end()}_getConnection(){this._connecting=!0,this._getPeerAddresses(this._id,(e,t)=>{e?this.emit("error",e):t.length?this._ipfs._libp2pNode.dial(t[0],s,(e,t)=>{if(e)return void this.emit("error",e);this._connecting=!1;const r=o(!1,e=>{this._closed=!0,e&&this.emit("error",e)});this._connection=r,i(r,t,i.onEnd(e=>{delete this._connection,e&&!this._closed&&this.emit("error",e)})),this.emit("connect",r)}):this.emit("error",new Error("could not connect to "+this._id))})}_getPeerAddresses(e,t){this._ipfs.swarm.peers((r,n)=>{r?t(r):t(null,n.filter(t=>t.peer.id.toB58String()===e).map(e=>e.peer))})}}},function(e,t,r){"use strict";e.exports={keys:r(99),once:r(48),values:r(25),count:r(100),infinite:r(101),empty:r(102),error:r(103)}},function(e,t,r){"use strict";var n=r(25);e.exports=function(e){return n(Object.keys(e))}},function(e,t,r){"use strict";e.exports=function(e){var t=0;return e=e||1/0,function(r,n){return r?n&&n(r):t>e?n(!0):void n(null,t++)}}},function(e,t,r){"use strict";e.exports=function(e){return e=e||Math.random,function(t,r){return t?r&&r(t):r(null,e())}}},function(e,t,r){"use strict";e.exports=function(){return function(e,t){t(!0)}}},function(e,t,r){"use strict";e.exports=function(e){return function(t,r){r(e)}}},function(e,t,r){"use strict";e.exports={drain:r(13),onEnd:r(105),log:r(106),find:r(107),reduce:r(26),collect:r(108),concat:r(109)}},function(e,t,r){"use strict";var n=r(13);e.exports=function(e){return n(null,e)}},function(e,t,r){"use strict";var n=r(13);e.exports=function(e){return n(function(e){console.log(e)},e)}},function(e,t,r){"use strict";function n(e){return e}var i=r(14),o=r(13);e.exports=function(e,t){var r=!1;return t?e=i(e)||n:(t=e,e=n),o(function(n){if(e(n))return r=!0,t(null,n),!1},function(e){r||t(!0===e?null:e,null)})}},function(e,t,r){"use strict";var n=r(26);e.exports=function(e){return n(function(e,t){return e.push(t),e},[],e)}},function(e,t,r){"use strict";var n=r(26);e.exports=function(e){return n(function(e,t){return e+t},"",e)}},function(e,t,r){"use strict";e.exports={map:r(111),asyncMap:r(112),filter:r(27),filterNot:r(113),through:r(114),take:r(115),unique:r(50),nonUnique:r(116),flatten:r(117)}},function(e,t,r){"use strict";function n(e){return e}var i=r(14);e.exports=function(e){return e?(e=i(e),function(t){return function(r,n){t(r,function(r,i){try{i=r?null:e(i)}catch(e){return t(e,function(){return n(e)})}n(r,i)})}}):n}},function(e,t,r){"use strict";function n(e){return e}var i=r(14);e.exports=function(e){if(!e)return n;e=i(e);var t,r,o=!1;return function(n){return function i(s,a){if(r)return a(r);s?(r=s,n(s,o?function(){o?t=a:a(s)}:a)):n(null,function(n,s){n?a(n):r?a(r):(o=!0,e(s,function(e,n){o=!1,r?(a(r),t(r)):e?i(e,a):a(null,n)}))})}}}},function(e,t,r){"use strict";var n=r(49),i=r(27);e.exports=function(e){return e=n(e),i(function(t){return!e(t)})}},function(e,t,r){"use strict";e.exports=function(e,t){function r(e){!n&&t&&(n=!0,t(!0===e?null:e))}var n=!1;return function(t){return function(n,i){return n&&r(n),t(n,function(t,n){t?r(t):e&&e(n),i(t,n)})}}}},function(e,t,r){"use strict";e.exports=function(e,t){var r=(t=t||{}).last||!1,n=!1;if("number"==typeof e){r=!0;var i=e;e=function(){return--i}}return function(t){function i(e){t(!0,function(t){r=!1,e(t||!0)})}return function(o,s){n?r?i(s):s(n):(n=o)?t(n,s):t(null,function(t,o){(n=n||t)?s(n):e(o)?s(null,o):(n=!0,r?s(null,o):i(s))})}}}},function(e,t,r){"use strict";var n=r(50);e.exports=function(e){return n(e,!0)}},function(e,t,r){"use strict";var n=r(25),i=r(48);e.exports=function(){return function(e){var t;return function(r,o){function s(){t(null,function(t,r){!0===t?a():t?e(!0,function(e){o(t)}):o(null,r)})}function a(){t=null,e(null,function(e,r){if(e)return o(e);Array.isArray(r)||r&&"object"==typeof r?r=n(r):"function"!=typeof r&&(r=i(r)),t=r,s()})}r?t?t(r,function(t){e(t||r,o)}):e(r,o):t?s():a()}}}},function(e,t,r){"use strict";e.exports=function e(t){var r=arguments.length;if("function"==typeof t&&1===t.length){for(var n=new Array(r),i=0;i{if(e)return void console.log(e);const s=r.id.toB58String();n(t,n.map(e=>{let t;try{t=JSON.parse(e.toString())}catch(e){return void o.emit("warning",e.message)}if(s!==t.from)return void o.emit("warning","no peerid match "+t.from);const r=t.topicIDs;if(Array.isArray(r))return t.data=i.from(t.data,"hex"),t.seqno=i.from(t.seqno,"hex"),r.forEach(e=>{o.emit(e,t)}),t;o.emit("warning","no topic IDs")}),n.onEnd(()=>{}))})},emitter:o}},function(e,t,r){const n=r(122),i=r(137);e.exports=i(n)},function(e,t,r){(function(t){function n(e){if(!(this instanceof n))return new n(e);if(!e)throw new Error("constructor requires at least a location argument");this.IDBOptions={},this.location=e}e.exports=n;var i=r(123),o=r(52).AbstractLevelDOWN,s=r(24),a=r(127),f=r(129),c=r(130),u=r(136);s.inherits(n,o),n.prototype._open=function(e,t){var r=this,n={storeName:this.location,autoIncrement:!1,keyPath:null,onStoreReady:function(){t&&t(null,r.idb)},onError:function(e){t&&t(e)}};c(n,e),this.IDBOptions=n,this.idb=new i(n)},n.prototype._get=function(e,r,n){this.idb.get(e,function(i){if(void 0===i)return n(new Error("NotFound"));var o=!0;return!1===r.asBuffer&&(o=!1),r.raw&&(o=!1),o&&(i=i instanceof Uint8Array?u(i):new t(String(i))),n(null,i,e)},n)},n.prototype._del=function(e,t,r){this.idb.remove(e,r,r)},n.prototype._put=function(e,r,n,i){r instanceof ArrayBuffer&&(r=u(new Uint8Array(r)));var o=this.convertEncoding(e,r,n);t.isBuffer(o.value)&&("function"==typeof r.toArrayBuffer?o.value=new Uint8Array(r.toArrayBuffer()):o.value=new Uint8Array(r)),this.idb.put(o.key,o.value,function(){i()},i)},n.prototype.convertEncoding=function(e,t,r){if(r.raw)return{key:e,value:t};if(t){var n=t.toString();"NaN"===n&&(t="NaN")}var i=r.valueEncoding,o={key:e,value:t};return!t||i&&"binary"===i||"object"!=typeof o.value&&(o.value=n),o},n.prototype.iterator=function(e){return"object"!=typeof e&&(e={}),new a(this.idb,e)},n.prototype._batch=function(e,t,r){var n,i,o,s,a=[];if(0===e.length)return setTimeout(r,0);for(n=0;n0&&this._count++>=this._limit&&(n=!1),n&&this.callback(!1,t.key,t.value),t&&t.continue()},n.prototype._next=function(e){return e?this._keyRangeError?e():(this._started||(this.createIterator(),this._started=!0),void(this.callback=e)):new Error("next() requires a callback argument")}},function(e,t,r){(function(e){function r(e,t){return Object.hasOwnProperty.call(e,t)}function n(e){return void 0!==e&&""!==e}function r(e,t){return Object.hasOwnProperty.call(e,t)}function i(e,t){return Object.hasOwnProperty.call(e,t)&&t}t.compare=function(t,r){if(e.isBuffer(t)){for(var n=Math.min(t.length,r.length),i=0;ir?1:0};var o=t.lowerBoundKey=function(e){return i(e,"gt")||i(e,"gte")||i(e,"min")||(e.reverse?i(e,"end"):i(e,"start"))||void 0},s=t.lowerBound=function(e,t){var r=o(e);return r?e[r]:t},a=t.lowerBoundInclusive=function(e){return!r(e,"gt")},f=t.upperBoundInclusive=function(e){return!r(e,"lt")},c=t.lowerBoundExclusive=function(e){return!a(e)},u=t.upperBoundExclusive=function(e){return!f(e)},h=t.upperBoundKey=function(e){return i(e,"lt")||i(e,"lte")||i(e,"max")||(e.reverse?i(e,"start"):i(e,"end"))||void 0},d=t.upperBound=function(e,t){var r=h(e);return r?e[r]:t};t.start=function(e,t){return e.reverse?d(e,t):s(e,t)},t.end=function(e,t){return e.reverse?s(e,t):d(e,t)},t.startInclusive=function(e){return e.reverse?f(e):a(e)},t.endInclusive=function(e){return e.reverse?a(e):f(e)},t.toLtgt=function(e,n,i,o,s){n=n||{},i=i||function(e){return e};var a=arguments.length>3,f=t.lowerBoundKey(e),c=t.upperBoundKey(e);return f?"gt"===f?n.gt=i(e.gt,!1):n.gte=i(e[f],!1):a&&(n.gte=i(o,!1)),c?"lt"===c?n.lt=i(e.lt,!0):n.lte=i(e[c],!0):a&&(n.lte=i(s,!0)),null!=e.reverse&&(n.reverse=!!e.reverse),r(n,"max")&&delete n.max,r(n,"min")&&delete n.min,r(n,"start")&&delete n.start,r(n,"end")&&delete n.end,n},t.contains=function(e,r,i){i=i||t.compare;var o=s(e);if(n(o)){if((f=i(r,o))<0||0===f&&c(e))return!1}var a=d(e);if(n(a)){var f;if((f=i(r,a))>0||0===f&&u(e))return!1}return!0},t.filter=function(e,r){return function(n){return t.contains(e,n,r)}}}).call(t,r(0).Buffer)},function(e,t,r){var n=r(0).Buffer;e.exports=function(e){return n.isBuffer(e)||/\[object (.+Array|Array.+)\]/.test(Object.prototype.toString.call(e))}},function(e,t,r){var n=r(131),i=r(135);e.exports=function(){for(var e={},t=0;t2?arguments[2]:null;if(a===+a)for(i=0;i=0&&"[object Function]"===r.call(e.callee)),n}},function(e,t){e.exports=function(e){return null!==e&&("object"==typeof e||"function"==typeof e)}},function(e,t,r){(function(t){e.exports=function(e){return"function"==typeof t._augment&&t.TYPED_ARRAY_SUPPORT?t._augment(e):new t(e)}}).call(t,r(0).Buffer)},function(e,t,r){"use strict";const n=r(11);let i={};e.exports=((e,t)=>({load:async(r,o)=>{const s=n.join(o.root,o.path),a=n.join(r,s);let f=i[a];return f||(t&&t.sync&&t.sync(a),f=new class{constructor(e,t){this.path=t||"./orbitdb",this._storage=e,this._store=null}async open(){return this.store?Promise.resolve():new Promise((e,t)=>{const r=this._storage(this.path);r.open(n=>{if(n)return t(n);this._store=r,e()})})}async close(){return this._store?new Promise(e=>{this._store.close(t=>{if(t)return reject(t);this._store=null,delete i[this.path],e()})}):Promise.resolve()}async destroy(){return new Promise((e,t)=>{this._storage.destroy(this.path,r=>{if(r)return t(r);e()})})}async get(e){return this._store||await this.open(),new Promise((t,r)=>{this._store.get(e,(e,n)=>{if(e&&-1===e.toString().indexOf("NotFoundError: Key not found in database")&&-1===e.toString().indexOf("NotFound"))return r(e);t(n?JSON.parse(n):null)})})}async set(e,t){return this._store||await this.open(),new Promise((r,n)=>{this._store.put(e,JSON.stringify(t),e=>{if(e&&-1===e.toString().indexOf("NotFoundError: Key not found in database")&&-1===e.toString().indexOf("NotFound"))return n(e);r()})})}async del(e){return this._store||await this.open(),new Promise((t,r)=>{this._store.del(e,e=>{if(e&&-1===e.toString().indexOf("NotFoundError: Key not found in database")&&-1===e.toString().indexOf("NotFound"))return r(e);t()})})}}(e,a),await f.open(),i[a]=f),f},close:async()=>{await Promise.all(Object.values(i),e=>e.close()),i={}}}))},function(e,t,r){const n=r(139);e.exports=n()},function(e,t,r){"use strict";const n=new(0,r(1).ec)("secp256k1");e.exports=((e,t)=>({create:(r="./keystore")=>{t&&t.sync&&t.sync(r);return new class{constructor(e){this._storage=e}createKey(e){const t=n.genKeyPair(),r=t.getPublic("hex"),i=t.getPrivate("hex");return this._storage.setItem(e,JSON.stringify({publicKey:r,privateKey:i})),t}getKey(e){let t=JSON.parse(this._storage.getItem(e));if(t)return n.keyPair({pub:t.publicKey,priv:t.privateKey,privEnc:"hex",pubEnc:"hex"})}generateKey(){return Promise.resolve(n.genKeyPair())}exportPublicKey(e){return Promise.resolve(e.getPublic("hex"))}exportPrivateKey(e){return Promise.resolve(e.getPrivate("hex"))}importPublicKey(e){return Promise.resolve(n.keyFromPublic(e,"hex"))}importPrivateKey(e){return Promise.resolve(n.keyFromPrivate(e,"hex"))}sign(e,t){const r=n.sign(t,e);return Promise.resolve(r.toDER("hex"))}verify(e,t,r){let i=!1;return i=n.verify(r,e,t),Promise.resolve(i)}}(e?new e(r):localStorage)}}))},function(e,t){e.exports={_from:"elliptic@^6.4.0",_id:"elliptic@6.4.0",_inBundle:!1,_integrity:"sha1-ysmvh2LIWDYYcAPI3+GT5eLq5d8=",_location:"/elliptic",_phantomChildren:{},_requested:{type:"range",registry:!0,raw:"elliptic@^6.4.0",name:"elliptic",escapedName:"elliptic",rawSpec:"^6.4.0",saveSpec:null,fetchSpec:"^6.4.0"},_requiredBy:["/browserify-sign","/create-ecdh","/orbit-db-keystore","/secp256k1"],_resolved:"https://registry.npmjs.org/elliptic/-/elliptic-6.4.0.tgz",_shasum:"cac9af8762c85836187003c8dfe193e5e2eae5df",_spec:"elliptic@^6.4.0",_where:"/Users/samuli/code/orbit-db/node_modules/orbit-db-keystore",author:{name:"Fedor Indutny",email:"fedor@indutny.com"},bugs:{url:"https://github.com/indutny/elliptic/issues"},bundleDependencies:!1,dependencies:{"bn.js":"^4.4.0",brorand:"^1.0.1","hash.js":"^1.0.0","hmac-drbg":"^1.0.0",inherits:"^2.0.1","minimalistic-assert":"^1.0.0","minimalistic-crypto-utils":"^1.0.0"},deprecated:!1,description:"EC cryptography",devDependencies:{brfs:"^1.4.3",coveralls:"^2.11.3",grunt:"^0.4.5","grunt-browserify":"^5.0.0","grunt-cli":"^1.2.0","grunt-contrib-connect":"^1.0.0","grunt-contrib-copy":"^1.0.0","grunt-contrib-uglify":"^1.0.1","grunt-mocha-istanbul":"^3.0.1","grunt-saucelabs":"^8.6.2",istanbul:"^0.4.2",jscs:"^2.9.0",jshint:"^2.6.0",mocha:"^2.1.0"},files:["lib"],homepage:"https://github.com/indutny/elliptic",keywords:["EC","Elliptic","curve","Cryptography"],license:"MIT",main:"lib/elliptic.js",name:"elliptic",repository:{type:"git",url:"git+ssh://git@github.com/indutny/elliptic.git"},scripts:{jscs:"jscs benchmarks/*.js lib/*.js lib/**/*.js lib/**/**/*.js test/index.js",jshint:"jscs benchmarks/*.js lib/*.js lib/**/*.js lib/**/**/*.js test/index.js",lint:"npm run jscs && npm run jshint",test:"npm run lint && npm run unit",unit:"istanbul test _mocha --reporter=spec test/index.js",version:"grunt dist && git add dist/"},version:"6.4.0"}},function(e,t,r){"use strict";var n=t,i=r(5),o=r(9),s=r(53);n.assert=o,n.toArray=s.toArray,n.zero2=s.zero2,n.toHex=s.toHex,n.encode=s.encode,n.getNAF=function(e,t){for(var r=[],n=1<=0;){var o;if(i.isOdd()){var s=i.andln(n-1);o=s>(n>>1)-1?(n>>1)-s:s,i.isubn(o)}else o=0;r.push(o);for(var a=0!==i.cmpn(0)&&0===i.andln(n-1)?t+1:1,f=1;f0||t.cmpn(-i)>0;){var o=e.andln(3)+n&3,s=t.andln(3)+i&3;3===o&&(o=-1),3===s&&(s=-1);var a;a=0==(1&o)?0:3!=(c=e.andln(7)+n&7)&&5!==c||2!==s?o:-o,r[0].push(a);var f;if(0==(1&s))f=0;else{var c;f=3!=(c=t.andln(7)+i&7)&&5!==c||2!==o?s:-s}r[1].push(f),2*n===a+1&&(n=1-n),2*i===f+1&&(i=1-i),e.iushrn(1),t.iushrn(1)}return r},n.cachedProperty=function(e,t,r){var n="_"+t;e.prototype[t]=function(){return void 0!==this[n]?this[n]:this[n]=r.call(this)}},n.parseBytes=function(e){return"string"==typeof e?n.toArray(e,"hex"):e},n.intFromLE=function(e){return new i(e,"hex","le")}},function(e,t){},function(e,t,r){function n(e){this.rand=e}var i;if(e.exports=function(e){return i||(i=new n(null)),i.generate(e)},e.exports.Rand=n,n.prototype.generate=function(e){return this._rand(e)},n.prototype._rand=function(e){if(this.rand.getBytes)return this.rand.getBytes(e);for(var t=new Uint8Array(e),r=0;r0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}function i(e,t){this.curve=e,this.type=t,this.precomputed=null}var o=r(5),s=r(1).utils,a=s.getNAF,f=s.getJSF,c=s.assert;e.exports=n,n.prototype.point=function(){throw new Error("Not implemented")},n.prototype.validate=function(){throw new Error("Not implemented")},n.prototype._fixedNafMul=function(e,t){c(e.precomputed);var r=e._getDoubles(),n=a(t,1),i=(1<=s;t--)f=(f<<1)+n[t];o.push(f)}for(var u=this.jpoint(null,null,null),h=this.jpoint(null,null,null),d=i;d>0;d--){for(s=0;s=0;f--){for(t=0;f>=0&&0===o[f];f--)t++;if(f>=0&&t++,s=s.dblp(t),f<0)break;var u=o[f];c(0!==u),s="affine"===e.type?u>0?s.mixedAdd(i[u-1>>1]):s.mixedAdd(i[-u-1>>1].neg()):u>0?s.add(i[u-1>>1]):s.add(i[-u-1>>1].neg())}return"affine"===e.type?s.toP():s},n.prototype._wnafMulAdd=function(e,t,r,n,i){for(var o=this._wnafT1,s=this._wnafT2,c=this._wnafT3,u=0,h=0;h=1;h-=2){var l=h-1,p=h;if(1===o[l]&&1===o[p]){var b=[t[l],null,null,t[p]];0===t[l].y.cmp(t[p].y)?(b[1]=t[l].add(t[p]),b[2]=t[l].toJ().mixedAdd(t[p].neg())):0===t[l].y.cmp(t[p].y.redNeg())?(b[1]=t[l].toJ().mixedAdd(t[p]),b[2]=t[l].add(t[p].neg())):(b[1]=t[l].toJ().mixedAdd(t[p]),b[2]=t[l].toJ().mixedAdd(t[p].neg()));var g=[-3,-1,-5,-7,0,7,5,1,3],y=f(r[l],r[p]);u=Math.max(y[0].length,u),c[l]=new Array(u),c[p]=new Array(u);for(var m=0;m=0;h--){for(var k=0;h>=0;){var x=!0;for(m=0;m=0&&k++,_=_.dblp(k),h<0)break;for(m=0;m0?M=s[m][E-1>>1]:E<0&&(M=s[m][-E-1>>1].neg()),_="affine"===M.type?_.mixedAdd(M):_.add(M))}}for(h=0;h=Math.ceil((e.bitLength()+1)/t.step)},i.prototype._getDoubles=function(e,t){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var r=[this],n=this,i=0;i=0&&(o=t,s=r),n.negative&&(n=n.neg(),i=i.neg()),o.negative&&(o=o.neg(),s=s.neg()),[{a:n,b:i},{a:o,b:s}]},n.prototype._endoSplit=function(e){var t=this.endo.basis,r=t[0],n=t[1],i=n.b.mul(e).divRound(this.n),o=r.b.neg().mul(e).divRound(this.n),s=i.mul(r.a),a=o.mul(n.a),f=i.mul(r.b),c=o.mul(n.b);return{k1:e.sub(s).sub(a),k2:f.add(c).neg()}},n.prototype.pointFromX=function(e,t){(e=new f(e,16)).red||(e=e.toRed(this.red));var r=e.redSqr().redMul(e).redIAdd(e.redMul(this.a)).redIAdd(this.b),n=r.redSqrt();if(0!==n.redSqr().redSub(r).cmp(this.zero))throw new Error("invalid point");var i=n.fromRed().isOdd();return(t&&!i||!t&&i)&&(n=n.redNeg()),this.point(e,n)},n.prototype.validate=function(e){if(e.inf)return!0;var t=e.x,r=e.y,n=this.a.redMul(t),i=t.redSqr().redMul(t).redIAdd(n).redIAdd(this.b);return 0===r.redSqr().redISub(i).cmpn(0)},n.prototype._endoWnafMulAdd=function(e,t,r){for(var n=this._endoWnafT1,i=this._endoWnafT2,o=0;o":""},i.prototype.isInfinity=function(){return this.inf},i.prototype.add=function(e){if(this.inf)return e;if(e.inf)return this;if(this.eq(e))return this.dbl();if(this.neg().eq(e))return this.curve.point(null,null);if(0===this.x.cmp(e.x))return this.curve.point(null,null);var t=this.y.redSub(e.y);0!==t.cmpn(0)&&(t=t.redMul(this.x.redSub(e.x).redInvm()));var r=t.redSqr().redISub(this.x).redISub(e.x),n=t.redMul(this.x.redSub(r)).redISub(this.y);return this.curve.point(r,n)},i.prototype.dbl=function(){if(this.inf)return this;var e=this.y.redAdd(this.y);if(0===e.cmpn(0))return this.curve.point(null,null);var t=this.curve.a,r=this.x.redSqr(),n=e.redInvm(),i=r.redAdd(r).redIAdd(r).redIAdd(t).redMul(n),o=i.redSqr().redISub(this.x.redAdd(this.x)),s=i.redMul(this.x.redSub(o)).redISub(this.y);return this.curve.point(o,s)},i.prototype.getX=function(){return this.x.fromRed()},i.prototype.getY=function(){return this.y.fromRed()},i.prototype.mul=function(e){return e=new f(e,16),this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve.endo?this.curve._endoWnafMulAdd([this],[e]):this.curve._wnafMul(this,e)},i.prototype.mulAdd=function(e,t,r){var n=[this,t],i=[e,r];return this.curve.endo?this.curve._endoWnafMulAdd(n,i):this.curve._wnafMulAdd(1,n,i,2)},i.prototype.jmulAdd=function(e,t,r){var n=[this,t],i=[e,r];return this.curve.endo?this.curve._endoWnafMulAdd(n,i,!0):this.curve._wnafMulAdd(1,n,i,2,!0)},i.prototype.eq=function(e){return this===e||this.inf===e.inf&&(this.inf||0===this.x.cmp(e.x)&&0===this.y.cmp(e.y))},i.prototype.neg=function(e){if(this.inf)return this;var t=this.curve.point(this.x,this.y.redNeg());if(e&&this.precomputed){var r=this.precomputed,n=function(e){return e.neg()};t.precomputed={naf:r.naf&&{wnd:r.naf.wnd,points:r.naf.points.map(n)},doubles:r.doubles&&{step:r.doubles.step,points:r.doubles.points.map(n)}}}return t},i.prototype.toJ=function(){if(this.inf)return this.curve.jpoint(null,null,null);return this.curve.jpoint(this.x,this.y,this.curve.one)},c(o,u.BasePoint),n.prototype.jpoint=function(e,t,r){return new o(this,e,t,r)},o.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var e=this.z.redInvm(),t=e.redSqr(),r=this.x.redMul(t),n=this.y.redMul(t).redMul(e);return this.curve.point(r,n)},o.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},o.prototype.add=function(e){if(this.isInfinity())return e;if(e.isInfinity())return this;var t=e.z.redSqr(),r=this.z.redSqr(),n=this.x.redMul(t),i=e.x.redMul(r),o=this.y.redMul(t.redMul(e.z)),s=e.y.redMul(r.redMul(this.z)),a=n.redSub(i),f=o.redSub(s);if(0===a.cmpn(0))return 0!==f.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var c=a.redSqr(),u=c.redMul(a),h=n.redMul(c),d=f.redSqr().redIAdd(u).redISub(h).redISub(h),l=f.redMul(h.redISub(d)).redISub(o.redMul(u)),p=this.z.redMul(e.z).redMul(a);return this.curve.jpoint(d,l,p)},o.prototype.mixedAdd=function(e){if(this.isInfinity())return e.toJ();if(e.isInfinity())return this;var t=this.z.redSqr(),r=this.x,n=e.x.redMul(t),i=this.y,o=e.y.redMul(t).redMul(this.z),s=r.redSub(n),a=i.redSub(o);if(0===s.cmpn(0))return 0!==a.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var f=s.redSqr(),c=f.redMul(s),u=r.redMul(f),h=a.redSqr().redIAdd(c).redISub(u).redISub(u),d=a.redMul(u.redISub(h)).redISub(i.redMul(c)),l=this.z.redMul(s);return this.curve.jpoint(h,d,l)},o.prototype.dblp=function(e){if(0===e)return this;if(this.isInfinity())return this;if(!e)return this.dbl();if(this.curve.zeroA||this.curve.threeA){for(var t=this,r=0;r=0)return!1;if(r.redIAdd(i),0===this.x.cmp(r))return!0}return!1},o.prototype.inspect=function(){return this.isInfinity()?"":""},o.prototype.isInfinity=function(){return 0===this.z.cmpn(0)}},function(e,t,r){"use strict";function n(e){f.call(this,"mont",e),this.a=new s(e.a,16).toRed(this.red),this.b=new s(e.b,16).toRed(this.red),this.i4=new s(4).toRed(this.red).redInvm(),this.two=new s(2).toRed(this.red),this.a24=this.i4.redMul(this.a.redAdd(this.two))}function i(e,t,r){f.BasePoint.call(this,e,"projective"),null===t&&null===r?(this.x=this.curve.one,this.z=this.curve.zero):(this.x=new s(t,16),this.z=new s(r,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)))}var o=r(20),s=r(5),a=r(4),f=o.base,c=r(1).utils;a(n,f),e.exports=n,n.prototype.validate=function(e){var t=e.normalize().x,r=t.redSqr(),n=r.redMul(t).redAdd(r.redMul(this.a)).redAdd(t);return 0===n.redSqrt().redSqr().cmp(n)},a(i,f.BasePoint),n.prototype.decodePoint=function(e,t){return this.point(c.toArray(e,t),1)},n.prototype.point=function(e,t){return new i(this,e,t)},n.prototype.pointFromJSON=function(e){return i.fromJSON(this,e)},i.prototype.precompute=function(){},i.prototype._encode=function(){return this.getX().toArray("be",this.curve.p.byteLength())},i.fromJSON=function(e,t){return new i(e,t[0],t[1]||e.one)},i.prototype.inspect=function(){return this.isInfinity()?"":""},i.prototype.isInfinity=function(){return 0===this.z.cmpn(0)},i.prototype.dbl=function(){var e=this.x.redAdd(this.z).redSqr(),t=this.x.redSub(this.z).redSqr(),r=e.redSub(t),n=e.redMul(t),i=r.redMul(t.redAdd(this.curve.a24.redMul(r)));return this.curve.point(n,i)},i.prototype.add=function(){throw new Error("Not supported on Montgomery curve")},i.prototype.diffAdd=function(e,t){var r=this.x.redAdd(this.z),n=this.x.redSub(this.z),i=e.x.redAdd(e.z),o=e.x.redSub(e.z).redMul(r),s=i.redMul(n),a=t.z.redMul(o.redAdd(s).redSqr()),f=t.x.redMul(o.redISub(s).redSqr());return this.curve.point(a,f)},i.prototype.mul=function(e){for(var t=e.clone(),r=this,n=this.curve.point(null,null),i=[];0!==t.cmpn(0);t.iushrn(1))i.push(t.andln(1));for(var o=i.length-1;o>=0;o--)0===i[o]?(r=r.diffAdd(n,this),n=n.dbl()):(n=r.diffAdd(n,this),r=r.dbl());return n},i.prototype.mulAdd=function(){throw new Error("Not supported on Montgomery curve")},i.prototype.jumlAdd=function(){throw new Error("Not supported on Montgomery curve")},i.prototype.eq=function(e){return 0===this.getX().cmp(e.getX())},i.prototype.normalize=function(){return this.x=this.x.redMul(this.z.redInvm()),this.z=this.curve.one,this},i.prototype.getX=function(){return this.normalize(),this.x.fromRed()}},function(e,t,r){"use strict";function n(e){this.twisted=1!=(0|e.a),this.mOneA=this.twisted&&-1==(0|e.a),this.extended=this.mOneA,c.call(this,"edwards",e),this.a=new a(e.a,16).umod(this.red.m),this.a=this.a.toRed(this.red),this.c=new a(e.c,16).toRed(this.red),this.c2=this.c.redSqr(),this.d=new a(e.d,16).toRed(this.red),this.dd=this.d.redAdd(this.d),u(!this.twisted||0===this.c.fromRed().cmpn(1)),this.oneC=1==(0|e.c)}function i(e,t,r,n,i){c.BasePoint.call(this,e,"projective"),null===t&&null===r&&null===n?(this.x=this.curve.zero,this.y=this.curve.one,this.z=this.curve.one,this.t=this.curve.zero,this.zOne=!0):(this.x=new a(t,16),this.y=new a(r,16),this.z=n?new a(n,16):this.curve.one,this.t=i&&new a(i,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.t&&!this.t.red&&(this.t=this.t.toRed(this.curve.red)),this.zOne=this.z===this.curve.one,this.curve.extended&&!this.t&&(this.t=this.x.redMul(this.y),this.zOne||(this.t=this.t.redMul(this.z.redInvm()))))}var o=r(20),s=r(1),a=r(5),f=r(4),c=o.base,u=s.utils.assert;f(n,c),e.exports=n,n.prototype._mulA=function(e){return this.mOneA?e.redNeg():this.a.redMul(e)},n.prototype._mulC=function(e){return this.oneC?e:this.c.redMul(e)},n.prototype.jpoint=function(e,t,r,n){return this.point(e,t,r,n)},n.prototype.pointFromX=function(e,t){(e=new a(e,16)).red||(e=e.toRed(this.red));var r=e.redSqr(),n=this.c2.redSub(this.a.redMul(r)),i=this.one.redSub(this.c2.redMul(this.d).redMul(r)),o=n.redMul(i.redInvm()),s=o.redSqrt();if(0!==s.redSqr().redSub(o).cmp(this.zero))throw new Error("invalid point");var f=s.fromRed().isOdd();return(t&&!f||!t&&f)&&(s=s.redNeg()),this.point(e,s)},n.prototype.pointFromY=function(e,t){(e=new a(e,16)).red||(e=e.toRed(this.red));var r=e.redSqr(),n=r.redSub(this.one),i=r.redMul(this.d).redAdd(this.one),o=n.redMul(i.redInvm());if(0===o.cmp(this.zero)){if(t)throw new Error("invalid point");return this.point(this.zero,e)}var s=o.redSqrt();if(0!==s.redSqr().redSub(o).cmp(this.zero))throw new Error("invalid point");return s.isOdd()!==t&&(s=s.redNeg()),this.point(s,e)},n.prototype.validate=function(e){if(e.isInfinity())return!0;e.normalize();var t=e.x.redSqr(),r=e.y.redSqr(),n=t.redMul(this.a).redAdd(r),i=this.c2.redMul(this.one.redAdd(this.d.redMul(t).redMul(r)));return 0===n.cmp(i)},f(i,c.BasePoint),n.prototype.pointFromJSON=function(e){return i.fromJSON(this,e)},n.prototype.point=function(e,t,r,n){return new i(this,e,t,r,n)},i.fromJSON=function(e,t){return new i(e,t[0],t[1],t[2])},i.prototype.inspect=function(){return this.isInfinity()?"":""},i.prototype.isInfinity=function(){return 0===this.x.cmpn(0)&&0===this.y.cmp(this.z)},i.prototype._extDbl=function(){var e=this.x.redSqr(),t=this.y.redSqr(),r=this.z.redSqr();r=r.redIAdd(r);var n=this.curve._mulA(e),i=this.x.redAdd(this.y).redSqr().redISub(e).redISub(t),o=n.redAdd(t),s=o.redSub(r),a=n.redSub(t),f=i.redMul(s),c=o.redMul(a),u=i.redMul(a),h=s.redMul(o);return this.curve.point(f,c,h,u)},i.prototype._projDbl=function(){var e,t,r,n=this.x.redAdd(this.y).redSqr(),i=this.x.redSqr(),o=this.y.redSqr();if(this.curve.twisted){var s=(c=this.curve._mulA(i)).redAdd(o);if(this.zOne)e=n.redSub(i).redSub(o).redMul(s.redSub(this.curve.two)),t=s.redMul(c.redSub(o)),r=s.redSqr().redSub(s).redSub(s);else{var a=this.z.redSqr(),f=s.redSub(a).redISub(a);e=n.redSub(i).redISub(o).redMul(f),t=s.redMul(c.redSub(o)),r=s.redMul(f)}}else{var c=i.redAdd(o);a=this.curve._mulC(this.c.redMul(this.z)).redSqr(),f=c.redSub(a).redSub(a);e=this.curve._mulC(n.redISub(c)).redMul(f),t=this.curve._mulC(c).redMul(i.redISub(o)),r=c.redMul(f)}return this.curve.point(e,t,r)},i.prototype.dbl=function(){return this.isInfinity()?this:this.curve.extended?this._extDbl():this._projDbl()},i.prototype._extAdd=function(e){var t=this.y.redSub(this.x).redMul(e.y.redSub(e.x)),r=this.y.redAdd(this.x).redMul(e.y.redAdd(e.x)),n=this.t.redMul(this.curve.dd).redMul(e.t),i=this.z.redMul(e.z.redAdd(e.z)),o=r.redSub(t),s=i.redSub(n),a=i.redAdd(n),f=r.redAdd(t),c=o.redMul(s),u=a.redMul(f),h=o.redMul(f),d=s.redMul(a);return this.curve.point(c,u,d,h)},i.prototype._projAdd=function(e){var t,r,n=this.z.redMul(e.z),i=n.redSqr(),o=this.x.redMul(e.x),s=this.y.redMul(e.y),a=this.curve.d.redMul(o).redMul(s),f=i.redSub(a),c=i.redAdd(a),u=this.x.redAdd(this.y).redMul(e.x.redAdd(e.y)).redISub(o).redISub(s),h=n.redMul(f).redMul(u);return this.curve.twisted?(t=n.redMul(c).redMul(s.redSub(this.curve._mulA(o))),r=f.redMul(c)):(t=n.redMul(c).redMul(s.redSub(o)),r=this.curve._mulC(f).redMul(c)),this.curve.point(h,t,r)},i.prototype.add=function(e){return this.isInfinity()?e:e.isInfinity()?this:this.curve.extended?this._extAdd(e):this._projAdd(e)},i.prototype.mul=function(e){return this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve._wnafMul(this,e)},i.prototype.mulAdd=function(e,t,r){return this.curve._wnafMulAdd(1,[this,t],[e,r],2,!1)},i.prototype.jmulAdd=function(e,t,r){return this.curve._wnafMulAdd(1,[this,t],[e,r],2,!0)},i.prototype.normalize=function(){if(this.zOne)return this;var e=this.z.redInvm();return this.x=this.x.redMul(e),this.y=this.y.redMul(e),this.t&&(this.t=this.t.redMul(e)),this.z=this.curve.one,this.zOne=!0,this},i.prototype.neg=function(){return this.curve.point(this.x.redNeg(),this.y,this.z,this.t&&this.t.redNeg())},i.prototype.getX=function(){return this.normalize(),this.x.fromRed()},i.prototype.getY=function(){return this.normalize(),this.y.fromRed()},i.prototype.eq=function(e){return this===e||0===this.getX().cmp(e.getX())&&0===this.getY().cmp(e.getY())},i.prototype.eqXToP=function(e){var t=e.toRed(this.curve.red).redMul(this.z);if(0===this.x.cmp(t))return!0;for(var r=e.clone(),n=this.curve.redN.redMul(this.z);;){if(r.iadd(this.curve.n),r.cmp(this.curve.p)>=0)return!1;if(t.redIAdd(n),0===this.x.cmp(t))return!0}return!1},i.prototype.toP=i.prototype.normalize,i.prototype.mixedAdd=i.prototype.add},function(e,t,r){"use strict";function n(e){"short"===e.type?this.curve=new a.curve.short(e):"edwards"===e.type?this.curve=new a.curve.edwards(e):this.curve=new a.curve.mont(e),this.g=this.curve.g,this.n=this.curve.n,this.hash=e.hash,f(this.g.validate(),"Invalid curve"),f(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}function i(e,t){Object.defineProperty(o,e,{configurable:!0,enumerable:!0,get:function(){var r=new n(t);return Object.defineProperty(o,e,{configurable:!0,enumerable:!0,value:r}),r}})}var o=t,s=r(28),a=r(1),f=a.utils.assert;o.PresetCurve=n,i("p192",{type:"short",prime:"p192",p:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff",a:"ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc",b:"64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1",n:"ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831",hash:s.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),i("p224",{type:"short",prime:"p224",p:"ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001",a:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe",b:"b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4",n:"ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d",hash:s.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),i("p256",{type:"short",prime:null,p:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff",a:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc",b:"5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b",n:"ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551",hash:s.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),i("p384",{type:"short",prime:null,p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 ffffffff",a:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 fffffffc",b:"b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f 5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef",n:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 f4372ddf 581a0db2 48b0a77a ecec196a ccc52973",hash:s.sha384,gRed:!1,g:["aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 5502f25d bf55296c 3a545e38 72760ab7","3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 0a60b1ce 1d7e819d 7a431d7c 90ea0e5f"]}),i("p521",{type:"short",prime:null,p:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff",a:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffc",b:"00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b 99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd 3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00",n:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409",hash:s.sha512,gRed:!1,g:["000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66","00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 3fad0761 353c7086 a272c240 88be9476 9fd16650"]}),i("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:s.sha256,gRed:!1,g:["9"]}),i("ed25519",{type:"edwards",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"-1",c:"1",d:"52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:s.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});var c;try{c=r(156)}catch(e){c=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",c]})},function(e,t,r){"use strict";t.sha1=r(151),t.sha224=r(152),t.sha256=r(55),t.sha384=r(153),t.sha512=r(56)},function(e,t,r){"use strict";function n(){if(!(this instanceof n))return new n;h.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.W=new Array(80)}var i=r(3),o=r(15),s=r(54),a=i.rotl32,f=i.sum32,c=i.sum32_5,u=s.ft_1,h=o.BlockHash,d=[1518500249,1859775393,2400959708,3395469782];i.inherits(n,h),e.exports=n,n.blockSize=512,n.outSize=160,n.hmacStrength=80,n.padLength=64,n.prototype._update=function(e,t){for(var r=this.W,n=0;n<16;n++)r[n]=e[t+n];for(;nthis.blockSize&&(e=(new this.Hash).update(e).digest()),o(e.length<=this.blockSize);for(var t=e.length;t0))return a.iaddn(1),this.keyFromPrivate(a)}},n.prototype._truncateToN=function(e,t){var r=8*e.byteLength()-this.n.bitLength();return r>0&&(e=e.ushrn(r)),!t&&e.cmp(this.n)>=0?e.sub(this.n):e},n.prototype.sign=function(e,t,r,n){"object"==typeof r&&(n=r,r=null),n||(n={}),t=this.keyFromPrivate(t,r),e=this._truncateToN(new i(e,16));for(var s=this.n.byteLength(),a=t.getPrivate().toArray("be",s),f=e.toArray("be",s),u=new o({hash:this.hash,entropy:a,nonce:f,pers:n.pers,persEnc:n.persEnc||"utf8"}),h=this.n.sub(new i(1)),d=0;;d++){var l=n.k?n.k(d):new i(u.generate(this.n.byteLength()));if(!((l=this._truncateToN(l,!0)).cmpn(1)<=0||l.cmp(h)>=0)){var p=this.g.mul(l);if(!p.isInfinity()){var b=p.getX(),g=b.umod(this.n);if(0!==g.cmpn(0)){var y=l.invm(this.n).mul(g.mul(t.getPrivate()).iadd(e));if(0!==(y=y.umod(this.n)).cmpn(0)){var m=(p.getY().isOdd()?1:0)|(0!==b.cmp(g)?2:0);return n.canonical&&y.cmp(this.nh)>0&&(y=this.n.sub(y),m^=1),new c({r:g,s:y,recoveryParam:m})}}}}}},n.prototype.verify=function(e,t,r,n){e=this._truncateToN(new i(e,16)),r=this.keyFromPublic(r,n);var o=(t=new c(t,"hex")).r,s=t.s;if(o.cmpn(1)<0||o.cmp(this.n)>=0)return!1;if(s.cmpn(1)<0||s.cmp(this.n)>=0)return!1;var a=s.invm(this.n),f=a.mul(e).umod(this.n),u=a.mul(o).umod(this.n);if(!this.curve._maxwellTrick){return!(h=this.g.mulAdd(f,r.getPublic(),u)).isInfinity()&&0===h.getX().umod(this.n).cmp(o)}var h;return!(h=this.g.jmulAdd(f,r.getPublic(),u)).isInfinity()&&h.eqXToP(o)},n.prototype.recoverPubKey=function(e,t,r,n){a((3&r)===r,"The recovery param is more than two bits"),t=new c(t,n);var o=this.n,s=new i(e),f=t.r,u=t.s,h=1&r,d=r>>1;if(f.cmp(this.curve.p.umod(this.curve.n))>=0&&d)throw new Error("Unable to find sencond key candinate");f=d?this.curve.pointFromX(f.add(this.curve.n),h):this.curve.pointFromX(f,h);var l=t.r.invm(o),p=o.sub(s).mul(l).umod(o),b=u.mul(l).umod(o);return this.g.mulAdd(p,f,b)},n.prototype.getKeyRecoveryParam=function(e,t,r,n){if(null!==(t=new c(t,n)).recoveryParam)return t.recoveryParam;for(var i=0;i<4;i++){var o;try{o=this.recoverPubKey(e,t,i)}catch(e){continue}if(o.eq(r))return i}throw new Error("Unable to find valid recovery factor")}},function(e,t,r){"use strict";function n(e){if(!(this instanceof n))return new n(e);this.hash=e.hash,this.predResist=!!e.predResist,this.outLen=this.hash.outSize,this.minEntropy=e.minEntropy||this.hash.hmacStrength,this._reseed=null,this.reseedInterval=null,this.K=null,this.V=null;var t=o.toArray(e.entropy,e.entropyEnc||"hex"),r=o.toArray(e.nonce,e.nonceEnc||"hex"),i=o.toArray(e.pers,e.persEnc||"hex");s(t.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(t,r,i)}var i=r(28),o=r(53),s=r(9);e.exports=n,n.prototype._init=function(e,t,r){var n=e.concat(t).concat(r);this.K=new Array(this.outLen/8),this.V=new Array(this.outLen/8);for(var i=0;i=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(e.concat(r||[])),this._reseed=1},n.prototype.generate=function(e,t,r,n){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");"string"!=typeof t&&(n=r,r=t,t=null),r&&(r=o.toArray(r,n||"hex"),this._update(r));for(var i=[];i.length"}},function(e,t,r){"use strict";function n(e,t){if(e instanceof n)return e;this._importDER(e,t)||(c(e.r&&e.s,"Signature without r or s"),this.r=new a(e.r,16),this.s=new a(e.s,16),void 0===e.recoveryParam?this.recoveryParam=null:this.recoveryParam=e.recoveryParam)}function i(e,t){var r=e[t.place++];if(!(128&r))return r;for(var n=15&r,i=0,o=0,s=t.place;o>>3);for(e.push(128|r);--r;)e.push(t>>>(r<<3)&255);e.push(t)}}var a=r(5),f=r(1).utils,c=f.assert;e.exports=n,n.prototype._importDER=function(e,t){e=f.toArray(e,t);var r=new function(){this.place=0};if(48!==e[r.place++])return!1;if(i(e,r)+r.place!==e.length)return!1;if(2!==e[r.place++])return!1;var n=i(e,r),o=e.slice(r.place,n+r.place);if(r.place+=n,2!==e[r.place++])return!1;var s=i(e,r);if(e.length!==s+r.place)return!1;var c=e.slice(r.place,s+r.place);return 0===o[0]&&128&o[1]&&(o=o.slice(1)),0===c[0]&&128&c[1]&&(c=c.slice(1)),this.r=new a(o),this.s=new a(c),this.recoveryParam=null,!0},n.prototype.toDER=function(e){var t=this.r.toArray(),r=this.s.toArray();for(128&t[0]&&(t=[0].concat(t)),128&r[0]&&(r=[0].concat(r)),t=o(t),r=o(r);!(r[0]||128&r[1]);)r=r.slice(1);var n=[2];s(n,t.length),(n=n.concat(t)).push(2),s(n,r.length);var i=n.concat(r),a=[48];return s(a,i.length),a=a.concat(i),f.encode(a,e)}},function(e,t,r){"use strict";function n(e){if(a("ed25519"===e,"only tested with ed25519 so far"),!(this instanceof n))return new n(e);e=o.curves[e].curve;this.curve=e,this.g=e.g,this.g.precompute(e.n.bitLength()+1),this.pointClass=e.point().constructor,this.encodingLength=Math.ceil(e.n.bitLength()/8),this.hash=i.sha512}var i=r(28),o=r(1),s=o.utils,a=s.assert,f=s.parseBytes,c=r(162),u=r(163);e.exports=n,n.prototype.sign=function(e,t){e=f(e);var r=this.keyFromSecret(t),n=this.hashInt(r.messagePrefix(),e),i=this.g.mul(n),o=this.encodePoint(i),s=this.hashInt(o,r.pubBytes(),e).mul(r.priv()),a=n.add(s).umod(this.curve.n);return this.makeSignature({R:i,S:a,Rencoded:o})},n.prototype.verify=function(e,t,r){e=f(e),t=this.makeSignature(t);var n=this.keyFromPublic(r),i=this.hashInt(t.Rencoded(),n.pubBytes(),e),o=this.g.mul(t.S());return t.R().add(n.pub().mul(i)).eq(o)},n.prototype.hashInt=function(){for(var e=this.hash(),t=0;te.reduce((e,r)=>(r!==t&&e.push(r),e),[]);switch(e){case"admin":this._access.admin=r(this._access.admin);break;case"write":this._access.write=r(this._access.write);break;case"read":this._access.read=r(this._access.read)}}}},function(e,t,r){"use strict";const n=r(11),i=r(167);class o{constructor(e,t){this.root=e,this.path=t}toString(){return n.join("/orbitdb",this.root,this.path)}static isValid(e){const t=e.toString().split("/").filter((t,r)=>!((0===r||1===r)&&0===e.toString().indexOf("/orbit")&&"orbitdb"===t)).filter(e=>""!==e&&" "!==e),r=t[0].indexOf("Qm")>-1?i.fromB58String(t[0]):null;try{i.validate(r)}catch(e){return!1}return null!==r}static parse(e){if(!e)throw new Error(`Not a valid OrbitDB address: ${e}`);if(!o.isValid(e))throw new Error(`Not a valid OrbitDB address: ${e}`);const t=e.toString().split("/").filter((t,r)=>!((0===r||1===r)&&0===e.toString().indexOf("/orbit")&&"orbitdb"===t)).filter(e=>""!==e&&" "!==e);return new o(t[0],t.slice(1,t.length).join("/"))}}e.exports=o},function(e,t,r){"use strict";(function(e){function n(e){t.decode(e)}const i=r(168),o=r(170);t.names=o.names,t.codes=o.codes,t.defaultLengths=o.defaultLengths;const s=r(171);t.toHexString=function(t){if(!e.isBuffer(t))throw new Error("must be passed a buffer");return t.toString("hex")},t.fromHexString=function(t){return e.from(t,"hex")},t.toB58String=function(t){if(!e.isBuffer(t))throw new Error("must be passed a buffer");return i.encode(t)},t.fromB58String=function(t){let r=t;return e.isBuffer(t)&&(r=t.toString()),e.from(i.decode(r))},t.decode=function(r){if(!e.isBuffer(r))throw new Error("multihash must be a Buffer");if(r.length<3)throw new Error("multihash too short. must be > 3 bytes.");let n=s.decode(r);if(!t.isValidCode(n))throw new Error(`multihash unknown function code: 0x${n.toString(16)}`);r=r.slice(s.decode.bytes);let i=s.decode(r);if(i<1)throw new Error(`multihash invalid length: 0x${i.toString(16)}`);if((r=r.slice(s.decode.bytes)).length!==i)throw new Error(`multihash length inconsistent: 0x${r.toString("hex")}`);return{code:n,name:o.codes[n],length:i,digest:r}},t.encode=function(r,n,i){if(!r||!n)throw new Error("multihash encode requires at least two args: digest, code");const o=t.coerceCode(n);if(!e.isBuffer(r))throw new Error("digest should be a Buffer");if(null==i&&(i=r.length),i&&r.length!==i)throw new Error("digest length should be equal to specified length.");return e.concat([e.from(s.encode(o)),e.from(s.encode(i)),r])},t.coerceCode=function(e){let r=e;if("string"==typeof e){if(!o.names[e])throw new Error(`Unrecognized hash function named: ${e}`);r=o.names[e]}if("number"!=typeof r)throw new Error(`Hash function code should be a number. Got: ${r}`);if(!o.codes[r]&&!t.isAppCode(r))throw new Error(`Unrecognized function code: ${r}`);return r},t.isAppCode=function(e){return e>0&&e<16},t.isValidCode=function(e){return!!t.isAppCode(e)||!!o.codes[e]},t.validate=n,t.prefix=function(e){return n(e),e.slice(0,2)}}).call(t,r(0).Buffer)},function(e,t,r){var n=r(169);e.exports=n("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz")},function(e,t,r){var n=r(8).Buffer;e.exports=function(e){function t(e){if("string"!=typeof e)throw new TypeError("Expected String");if(0===e.length)return n.allocUnsafe(0);for(var t=[0],s=0;s>=8;for(;c>0;)t.push(255&c),c>>=8}for(var u=0;e[u]===o&&u0;)r.push(a%i),a=a/i|0}for(var f="",c=0;0===t[c]&&c=0;--u)f+=e[r[u]];return f},decodeUnsafe:t,decode:function(e){var r=t(e);if(r)return r;throw new Error("Non-base"+i+" character")}}}},function(e,t,r){"use strict";t.names=Object.freeze({sha1:17,"sha2-256":18,"sha2-512":19,"sha3-224":23,"sha3-256":22,"sha3-384":21,"sha3-512":20,"shake-128":24,"shake-256":25,"keccak-224":26,"keccak-256":27,"keccak-384":28,"keccak-512":29,"murmur3-128":34,"murmur3-32":35,"blake2b-8":45569,"blake2b-16":45570,"blake2b-24":45571,"blake2b-32":45572,"blake2b-40":45573,"blake2b-48":45574,"blake2b-56":45575,"blake2b-64":45576,"blake2b-72":45577,"blake2b-80":45578,"blake2b-88":45579,"blake2b-96":45580,"blake2b-104":45581,"blake2b-112":45582,"blake2b-120":45583,"blake2b-128":45584,"blake2b-136":45585,"blake2b-144":45586,"blake2b-152":45587,"blake2b-160":45588,"blake2b-168":45589,"blake2b-176":45590,"blake2b-184":45591,"blake2b-192":45592,"blake2b-200":45593,"blake2b-208":45594,"blake2b-216":45595,"blake2b-224":45596,"blake2b-232":45597,"blake2b-240":45598,"blake2b-248":45599,"blake2b-256":45600,"blake2b-264":45601,"blake2b-272":45602,"blake2b-280":45603,"blake2b-288":45604,"blake2b-296":45605,"blake2b-304":45606,"blake2b-312":45607,"blake2b-320":45608,"blake2b-328":45609,"blake2b-336":45610,"blake2b-344":45611,"blake2b-352":45612,"blake2b-360":45613,"blake2b-368":45614,"blake2b-376":45615,"blake2b-384":45616,"blake2b-392":45617,"blake2b-400":45618,"blake2b-408":45619,"blake2b-416":45620,"blake2b-424":45621,"blake2b-432":45622,"blake2b-440":45623,"blake2b-448":45624,"blake2b-456":45625,"blake2b-464":45626,"blake2b-472":45627,"blake2b-480":45628,"blake2b-488":45629,"blake2b-496":45630,"blake2b-504":45631,"blake2b-512":45632,"blake2s-8":45633,"blake2s-16":45634,"blake2s-24":45635,"blake2s-32":45636,"blake2s-40":45637,"blake2s-48":45638,"blake2s-56":45639,"blake2s-64":45640,"blake2s-72":45641,"blake2s-80":45642,"blake2s-88":45643,"blake2s-96":45644,"blake2s-104":45645,"blake2s-112":45646,"blake2s-120":45647,"blake2s-128":45648,"blake2s-136":45649,"blake2s-144":45650,"blake2s-152":45651,"blake2s-160":45652,"blake2s-168":45653,"blake2s-176":45654,"blake2s-184":45655,"blake2s-192":45656,"blake2s-200":45657,"blake2s-208":45658,"blake2s-216":45659,"blake2s-224":45660,"blake2s-232":45661,"blake2s-240":45662,"blake2s-248":45663,"blake2s-256":45664,"Skein256-8":45825,"Skein256-16":45826,"Skein256-24":45827,"Skein256-32":45828,"Skein256-40":45829,"Skein256-48":45830,"Skein256-56":45831,"Skein256-64":45832,"Skein256-72":45833,"Skein256-80":45834,"Skein256-88":45835,"Skein256-96":45836,"Skein256-104":45837,"Skein256-112":45838,"Skein256-120":45839,"Skein256-128":45840,"Skein256-136":45841,"Skein256-144":45842,"Skein256-152":45843,"Skein256-160":45844,"Skein256-168":45845,"Skein256-176":45846,"Skein256-184":45847,"Skein256-192":45848,"Skein256-200":45849,"Skein256-208":45850,"Skein256-216":45851,"Skein256-224":45852,"Skein256-232":45853,"Skein256-240":45854,"Skein256-248":45855,"Skein256-256":45856,"Skein512-8":45857,"Skein512-16":45858,"Skein512-24":45859,"Skein512-32":45860,"Skein512-40":45861,"Skein512-48":45862,"Skein512-56":45863,"Skein512-64":45864,"Skein512-72":45865,"Skein512-80":45866,"Skein512-88":45867,"Skein512-96":45868,"Skein512-104":45869,"Skein512-112":45870,"Skein512-120":45871,"Skein512-128":45872,"Skein512-136":45873,"Skein512-144":45874,"Skein512-152":45875,"Skein512-160":45876,"Skein512-168":45877,"Skein512-176":45878,"Skein512-184":45879,"Skein512-192":45880,"Skein512-200":45881,"Skein512-208":45882,"Skein512-216":45883,"Skein512-224":45884,"Skein512-232":45885,"Skein512-240":45886,"Skein512-248":45887,"Skein512-256":45888,"Skein512-264":45889,"Skein512-272":45890,"Skein512-280":45891,"Skein512-288":45892,"Skein512-296":45893,"Skein512-304":45894,"Skein512-312":45895,"Skein512-320":45896,"Skein512-328":45897,"Skein512-336":45898,"Skein512-344":45899,"Skein512-352":45900,"Skein512-360":45901,"Skein512-368":45902,"Skein512-376":45903,"Skein512-384":45904,"Skein512-392":45905,"Skein512-400":45906,"Skein512-408":45907,"Skein512-416":45908,"Skein512-424":45909,"Skein512-432":45910,"Skein512-440":45911,"Skein512-448":45912,"Skein512-456":45913,"Skein512-464":45914,"Skein512-472":45915,"Skein512-480":45916,"Skein512-488":45917,"Skein512-496":45918,"Skein512-504":45919,"Skein512-512":45920,"Skein1024-8":45921,"Skein1024-16":45922,"Skein1024-24":45923,"Skein1024-32":45924,"Skein1024-40":45925,"Skein1024-48":45926,"Skein1024-56":45927,"Skein1024-64":45928,"Skein1024-72":45929,"Skein1024-80":45930,"Skein1024-88":45931,"Skein1024-96":45932,"Skein1024-104":45933,"Skein1024-112":45934,"Skein1024-120":45935,"Skein1024-128":45936,"Skein1024-136":45937,"Skein1024-144":45938,"Skein1024-152":45939,"Skein1024-160":45940,"Skein1024-168":45941,"Skein1024-176":45942,"Skein1024-184":45943,"Skein1024-192":45944,"Skein1024-200":45945,"Skein1024-208":45946,"Skein1024-216":45947,"Skein1024-224":45948,"Skein1024-232":45949,"Skein1024-240":45950,"Skein1024-248":45951,"Skein1024-256":45952,"Skein1024-264":45953,"Skein1024-272":45954,"Skein1024-280":45955,"Skein1024-288":45956,"Skein1024-296":45957,"Skein1024-304":45958,"Skein1024-312":45959,"Skein1024-320":45960,"Skein1024-328":45961,"Skein1024-336":45962,"Skein1024-344":45963,"Skein1024-352":45964,"Skein1024-360":45965,"Skein1024-368":45966,"Skein1024-376":45967,"Skein1024-384":45968,"Skein1024-392":45969,"Skein1024-400":45970,"Skein1024-408":45971,"Skein1024-416":45972,"Skein1024-424":45973,"Skein1024-432":45974,"Skein1024-440":45975,"Skein1024-448":45976,"Skein1024-456":45977,"Skein1024-464":45978,"Skein1024-472":45979,"Skein1024-480":45980,"Skein1024-488":45981,"Skein1024-496":45982,"Skein1024-504":45983,"Skein1024-512":45984,"Skein1024-520":45985,"Skein1024-528":45986,"Skein1024-536":45987,"Skein1024-544":45988,"Skein1024-552":45989,"Skein1024-560":45990,"Skein1024-568":45991,"Skein1024-576":45992,"Skein1024-584":45993,"Skein1024-592":45994,"Skein1024-600":45995,"Skein1024-608":45996,"Skein1024-616":45997,"Skein1024-624":45998,"Skein1024-632":45999,"Skein1024-640":46e3,"Skein1024-648":46001,"Skein1024-656":46002,"Skein1024-664":46003,"Skein1024-672":46004,"Skein1024-680":46005,"Skein1024-688":46006,"Skein1024-696":46007,"Skein1024-704":46008,"Skein1024-712":46009,"Skein1024-720":46010,"Skein1024-728":46011,"Skein1024-736":46012,"Skein1024-744":46013,"Skein1024-752":46014,"Skein1024-760":46015,"Skein1024-768":46016,"Skein1024-776":46017,"Skein1024-784":46018,"Skein1024-792":46019,"Skein1024-800":46020,"Skein1024-808":46021,"Skein1024-816":46022,"Skein1024-824":46023,"Skein1024-832":46024,"Skein1024-840":46025,"Skein1024-848":46026,"Skein1024-856":46027,"Skein1024-864":46028,"Skein1024-872":46029,"Skein1024-880":46030,"Skein1024-888":46031,"Skein1024-896":46032,"Skein1024-904":46033,"Skein1024-912":46034,"Skein1024-920":46035,"Skein1024-928":46036,"Skein1024-936":46037,"Skein1024-944":46038,"Skein1024-952":46039,"Skein1024-960":46040,"Skein1024-968":46041,"Skein1024-976":46042,"Skein1024-984":46043,"Skein1024-992":46044,"Skein1024-1000":46045,"Skein1024-1008":46046,"Skein1024-1016":46047,"Skein1024-1024":46048}),t.codes=Object.freeze({17:"sha1",18:"sha2-256",19:"sha2-512",23:"sha3-224",22:"sha3-256",21:"sha3-384",20:"sha3-512",24:"shake-128",25:"shake-256",26:"keccak-224",27:"keccak-256",28:"keccak-384",29:"keccak-512",34:"murmur3-128",35:"murmur3-32",45569:"blake2b-8",45570:"blake2b-16",45571:"blake2b-24",45572:"blake2b-32",45573:"blake2b-40",45574:"blake2b-48",45575:"blake2b-56",45576:"blake2b-64",45577:"blake2b-72",45578:"blake2b-80",45579:"blake2b-88",45580:"blake2b-96",45581:"blake2b-104",45582:"blake2b-112",45583:"blake2b-120",45584:"blake2b-128",45585:"blake2b-136",45586:"blake2b-144",45587:"blake2b-152",45588:"blake2b-160",45589:"blake2b-168",45590:"blake2b-176",45591:"blake2b-184",45592:"blake2b-192",45593:"blake2b-200",45594:"blake2b-208",45595:"blake2b-216",45596:"blake2b-224",45597:"blake2b-232",45598:"blake2b-240",45599:"blake2b-248",45600:"blake2b-256",45601:"blake2b-264",45602:"blake2b-272",45603:"blake2b-280",45604:"blake2b-288",45605:"blake2b-296",45606:"blake2b-304",45607:"blake2b-312",45608:"blake2b-320",45609:"blake2b-328",45610:"blake2b-336",45611:"blake2b-344",45612:"blake2b-352",45613:"blake2b-360",45614:"blake2b-368",45615:"blake2b-376",45616:"blake2b-384",45617:"blake2b-392",45618:"blake2b-400",45619:"blake2b-408",45620:"blake2b-416",45621:"blake2b-424",45622:"blake2b-432",45623:"blake2b-440",45624:"blake2b-448",45625:"blake2b-456",45626:"blake2b-464",45627:"blake2b-472",45628:"blake2b-480",45629:"blake2b-488",45630:"blake2b-496",45631:"blake2b-504",45632:"blake2b-512",45633:"blake2s-8",45634:"blake2s-16",45635:"blake2s-24",45636:"blake2s-32",45637:"blake2s-40",45638:"blake2s-48",45639:"blake2s-56",45640:"blake2s-64",45641:"blake2s-72",45642:"blake2s-80",45643:"blake2s-88",45644:"blake2s-96",45645:"blake2s-104",45646:"blake2s-112",45647:"blake2s-120",45648:"blake2s-128",45649:"blake2s-136",45650:"blake2s-144",45651:"blake2s-152",45652:"blake2s-160",45653:"blake2s-168",45654:"blake2s-176",45655:"blake2s-184",45656:"blake2s-192",45657:"blake2s-200",45658:"blake2s-208",45659:"blake2s-216",45660:"blake2s-224",45661:"blake2s-232",45662:"blake2s-240",45663:"blake2s-248",45664:"blake2s-256",45825:"Skein256-8",45826:"Skein256-16",45827:"Skein256-24",45828:"Skein256-32",45829:"Skein256-40",45830:"Skein256-48",45831:"Skein256-56",45832:"Skein256-64",45833:"Skein256-72",45834:"Skein256-80",45835:"Skein256-88",45836:"Skein256-96",45837:"Skein256-104",45838:"Skein256-112",45839:"Skein256-120",45840:"Skein256-128",45841:"Skein256-136",45842:"Skein256-144",45843:"Skein256-152",45844:"Skein256-160",45845:"Skein256-168",45846:"Skein256-176",45847:"Skein256-184",45848:"Skein256-192",45849:"Skein256-200",45850:"Skein256-208",45851:"Skein256-216",45852:"Skein256-224",45853:"Skein256-232",45854:"Skein256-240",45855:"Skein256-248",45856:"Skein256-256",45857:"Skein512-8",45858:"Skein512-16",45859:"Skein512-24",45860:"Skein512-32",45861:"Skein512-40",45862:"Skein512-48",45863:"Skein512-56",45864:"Skein512-64",45865:"Skein512-72",45866:"Skein512-80",45867:"Skein512-88",45868:"Skein512-96",45869:"Skein512-104",45870:"Skein512-112",45871:"Skein512-120",45872:"Skein512-128",45873:"Skein512-136",45874:"Skein512-144",45875:"Skein512-152",45876:"Skein512-160",45877:"Skein512-168",45878:"Skein512-176",45879:"Skein512-184",45880:"Skein512-192",45881:"Skein512-200",45882:"Skein512-208",45883:"Skein512-216",45884:"Skein512-224",45885:"Skein512-232",45886:"Skein512-240",45887:"Skein512-248",45888:"Skein512-256",45889:"Skein512-264",45890:"Skein512-272",45891:"Skein512-280",45892:"Skein512-288",45893:"Skein512-296",45894:"Skein512-304",45895:"Skein512-312",45896:"Skein512-320",45897:"Skein512-328",45898:"Skein512-336",45899:"Skein512-344",45900:"Skein512-352",45901:"Skein512-360",45902:"Skein512-368",45903:"Skein512-376",45904:"Skein512-384",45905:"Skein512-392",45906:"Skein512-400",45907:"Skein512-408",45908:"Skein512-416",45909:"Skein512-424",45910:"Skein512-432",45911:"Skein512-440",45912:"Skein512-448",45913:"Skein512-456",45914:"Skein512-464",45915:"Skein512-472",45916:"Skein512-480",45917:"Skein512-488",45918:"Skein512-496",45919:"Skein512-504",45920:"Skein512-512",45921:"Skein1024-8",45922:"Skein1024-16",45923:"Skein1024-24",45924:"Skein1024-32",45925:"Skein1024-40",45926:"Skein1024-48",45927:"Skein1024-56",45928:"Skein1024-64",45929:"Skein1024-72",45930:"Skein1024-80",45931:"Skein1024-88",45932:"Skein1024-96",45933:"Skein1024-104",45934:"Skein1024-112",45935:"Skein1024-120",45936:"Skein1024-128",45937:"Skein1024-136",45938:"Skein1024-144",45939:"Skein1024-152",45940:"Skein1024-160",45941:"Skein1024-168",45942:"Skein1024-176",45943:"Skein1024-184",45944:"Skein1024-192",45945:"Skein1024-200",45946:"Skein1024-208",45947:"Skein1024-216",45948:"Skein1024-224",45949:"Skein1024-232",45950:"Skein1024-240",45951:"Skein1024-248",45952:"Skein1024-256",45953:"Skein1024-264",45954:"Skein1024-272",45955:"Skein1024-280",45956:"Skein1024-288",45957:"Skein1024-296",45958:"Skein1024-304",45959:"Skein1024-312",45960:"Skein1024-320",45961:"Skein1024-328",45962:"Skein1024-336",45963:"Skein1024-344",45964:"Skein1024-352",45965:"Skein1024-360",45966:"Skein1024-368",45967:"Skein1024-376",45968:"Skein1024-384",45969:"Skein1024-392",45970:"Skein1024-400",45971:"Skein1024-408",45972:"Skein1024-416",45973:"Skein1024-424",45974:"Skein1024-432",45975:"Skein1024-440",45976:"Skein1024-448",45977:"Skein1024-456",45978:"Skein1024-464",45979:"Skein1024-472",45980:"Skein1024-480",45981:"Skein1024-488",45982:"Skein1024-496",45983:"Skein1024-504",45984:"Skein1024-512",45985:"Skein1024-520",45986:"Skein1024-528",45987:"Skein1024-536",45988:"Skein1024-544",45989:"Skein1024-552",45990:"Skein1024-560",45991:"Skein1024-568",45992:"Skein1024-576",45993:"Skein1024-584",45994:"Skein1024-592",45995:"Skein1024-600",45996:"Skein1024-608",45997:"Skein1024-616",45998:"Skein1024-624",45999:"Skein1024-632",46e3:"Skein1024-640",46001:"Skein1024-648",46002:"Skein1024-656",46003:"Skein1024-664",46004:"Skein1024-672",46005:"Skein1024-680",46006:"Skein1024-688",46007:"Skein1024-696",46008:"Skein1024-704",46009:"Skein1024-712",46010:"Skein1024-720",46011:"Skein1024-728",46012:"Skein1024-736",46013:"Skein1024-744",46014:"Skein1024-752",46015:"Skein1024-760",46016:"Skein1024-768",46017:"Skein1024-776",46018:"Skein1024-784",46019:"Skein1024-792",46020:"Skein1024-800",46021:"Skein1024-808",46022:"Skein1024-816",46023:"Skein1024-824",46024:"Skein1024-832",46025:"Skein1024-840",46026:"Skein1024-848",46027:"Skein1024-856",46028:"Skein1024-864",46029:"Skein1024-872",46030:"Skein1024-880",46031:"Skein1024-888",46032:"Skein1024-896",46033:"Skein1024-904",46034:"Skein1024-912",46035:"Skein1024-920",46036:"Skein1024-928",46037:"Skein1024-936",46038:"Skein1024-944",46039:"Skein1024-952",46040:"Skein1024-960",46041:"Skein1024-968",46042:"Skein1024-976",46043:"Skein1024-984",46044:"Skein1024-992",46045:"Skein1024-1000",46046:"Skein1024-1008",46047:"Skein1024-1016",46048:"Skein1024-1024"}),t.defaultLengths=Object.freeze({17:20,18:32,19:64,23:28,22:32,21:48,20:64,24:32,25:64,26:28,27:32,28:48,29:64,34:32,45569:1,45570:2,45571:3,45572:4,45573:5,45574:6,45575:7,45576:8,45577:9,45578:10,45579:11,45580:12,45581:13,45582:14,45583:15,45584:16,45585:17,45586:18,45587:19,45588:20,45589:21,45590:22,45591:23,45592:24,45593:25,45594:26,45595:27,45596:28,45597:29,45598:30,45599:31,45600:32,45601:33,45602:34,45603:35,45604:36,45605:37,45606:38,45607:39,45608:40,45609:41,45610:42,45611:43,45612:44,45613:45,45614:46,45615:47,45616:48,45617:49,45618:50,45619:51,45620:52,45621:53,45622:54,45623:55,45624:56,45625:57,45626:58,45627:59,45628:60,45629:61,45630:62,45631:63,45632:64,45633:1,45634:2,45635:3,45636:4,45637:5,45638:6,45639:7,45640:8,45641:9,45642:10,45643:11,45644:12,45645:13,45646:14,45647:15,45648:16,45649:17,45650:18,45651:19,45652:20,45653:21,45654:22,45655:23,45656:24,45657:25,45658:26,45659:27,45660:28,45661:29,45662:30,45663:31,45664:32,45825:1,45826:2,45827:3,45828:4,45829:5,45830:6,45831:7,45832:8,45833:9,45834:10,45835:11,45836:12,45837:13,45838:14,45839:15,45840:16,45841:17,45842:18,45843:19,45844:20,45845:21,45846:22,45847:23,45848:24,45849:25,45850:26,45851:27,45852:28,45853:29,45854:30,45855:31,45856:32,45857:1,45858:2,45859:3,45860:4,45861:5,45862:6,45863:7,45864:8,45865:9,45866:10,45867:11,45868:12,45869:13,45870:14,45871:15,45872:16,45873:17,45874:18,45875:19,45876:20,45877:21,45878:22,45879:23,45880:24,45881:25,45882:26,45883:27,45884:28,45885:29,45886:30,45887:31,45888:32,45889:33,45890:34,45891:35,45892:36,45893:37,45894:38,45895:39,45896:40,45897:41,45898:42,45899:43,45900:44,45901:45,45902:46,45903:47,45904:48,45905:49,45906:50,45907:51,45908:52,45909:53,45910:54,45911:55,45912:56,45913:57,45914:58,45915:59,45916:60,45917:61,45918:62,45919:63,45920:64,45921:1,45922:2,45923:3,45924:4,45925:5,45926:6,45927:7,45928:8,45929:9,45930:10,45931:11,45932:12,45933:13,45934:14,45935:15,45936:16,45937:17,45938:18,45939:19,45940:20,45941:21,45942:22,45943:23,45944:24,45945:25,45946:26,45947:27,45948:28,45949:29,45950:30,45951:31,45952:32,45953:33,45954:34,45955:35,45956:36,45957:37,45958:38,45959:39,45960:40,45961:41,45962:42,45963:43,45964:44,45965:45,45966:46,45967:47,45968:48,45969:49,45970:50,45971:51,45972:52,45973:53,45974:54,45975:55,45976:56,45977:57,45978:58,45979:59,45980:60,45981:61,45982:62,45983:63,45984:64,45985:65,45986:66,45987:67,45988:68,45989:69,45990:70,45991:71,45992:72,45993:73,45994:74,45995:75,45996:76,45997:77,45998:78,45999:79,46e3:80,46001:81,46002:82,46003:83,46004:84,46005:85,46006:86,46007:87,46008:88,46009:89,46010:90,46011:91,46012:92,46013:93,46014:94,46015:95,46016:96,46017:97,46018:98,46019:99,46020:100,46021:101,46022:102,46023:103,46024:104,46025:105,46026:106,46027:107,46028:108,46029:109,46030:110,46031:111,46032:112,46033:113,46034:114,46035:115,46036:116,46037:117,46038:118,46039:119,46040:120,46041:121,46042:122,46043:123,46044:124,46045:125,46046:126,46047:127,46048:128})},function(e,t,r){e.exports={encode:r(172),decode:r(173),encodingLength:r(174)}},function(e,t){function r(e,t,s){t=t||[];for(var a=s=s||0;e>=o;)t[s++]=255&e|n,e/=128;for(;e&i;)t[s++]=255&e|n,e>>>=7;return t[s]=0|e,r.bytes=s-a+1,t}e.exports=r;var n=128,i=-128,o=Math.pow(2,31)},function(e,t){function r(e,t){var o,s=0,a=0,f=t=t||0,c=e.length;do{if(f>=c)throw r.bytes=0,new RangeError("Could not decode varint");o=e[f++],s+=a<28?(o&i)<=n);return r.bytes=f-t,s}e.exports=r;var n=128,i=127},function(e,t){var r=Math.pow(2,7),n=Math.pow(2,14),i=Math.pow(2,21),o=Math.pow(2,28),s=Math.pow(2,35),a=Math.pow(2,42),f=Math.pow(2,49),c=Math.pow(2,56),u=Math.pow(2,63);e.exports=function(e){return e{const s={name:r,type:i,accessController:n.join("/ipfs",o)};return(await e.object.put(t.from(JSON.stringify(s)))).toJSON().multihash.toString()})}).call(t,r(0).Buffer)}]); \ No newline at end of file