From 7adb8946938988d0fb6b89c13db48c1813ba194f Mon Sep 17 00:00:00 2001 From: Mark Henderson Date: Mon, 11 May 2020 14:45:08 -0400 Subject: [PATCH] 3.3.0 --- dist/orbit-db-store.min.js | 6 +-- package-lock.json | 26 +++++----- src/Store.js | 30 +++++------ test/events.spec.js | 103 +++++++++++++++++++------------------ 4 files changed, 83 insertions(+), 82 deletions(-) diff --git a/dist/orbit-db-store.min.js b/dist/orbit-db-store.min.js index 934856c..db5a7aa 100644 --- a/dist/orbit-db-store.min.js +++ b/dist/orbit-db-store.min.js @@ -5,9 +5,9 @@ var Store=function(e){var t={};function n(r){if(t[r])return t[r].exports;var i=t * @author Feross Aboukhadijeh * @license MIT */ -var r=n(60),i=n(61),s=n(25);function o(){return u.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function a(e,t){if(o()=o())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+o().toString(16)+" bytes");return 0|e}function p(e,t){if(u.isBuffer(e))return e.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(e)||e instanceof ArrayBuffer))return e.byteLength;"string"!=typeof e&&(e=""+e);var n=e.length;if(0===n)return 0;for(var r=!1;;)switch(t){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":case void 0:return q(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return z(e).length;default:if(r)return q(e).length;t=(""+t).toLowerCase(),r=!0}}function b(e,t,n){var r=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if((n>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return j(this,t,n);case"utf8":case"utf-8":return O(this,t,n);case"ascii":return A(this,t,n);case"latin1":case"binary":return R(this,t,n);case"base64":return x(this,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return C(this,t,n);default:if(r)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),r=!0}}function g(e,t,n){var r=e[t];e[t]=e[n],e[n]=r}function y(e,t,n,r,i){if(0===e.length)return-1;if("string"==typeof n?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),n=+n,isNaN(n)&&(n=i?0:e.length-1),n<0&&(n=e.length+n),n>=e.length){if(i)return-1;n=e.length-1}else if(n<0){if(!i)return-1;n=0}if("string"==typeof t&&(t=u.from(t,r)),u.isBuffer(t))return 0===t.length?-1:m(e,t,n,r,i);if("number"==typeof t)return t&=255,u.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(e,t,n):Uint8Array.prototype.lastIndexOf.call(e,t,n):m(e,[t],n,r,i);throw new TypeError("val must be string, number or Buffer")}function m(e,t,n,r,i){var s,o=1,a=e.length,u=t.length;if(void 0!==r&&("ucs2"===(r=String(r).toLowerCase())||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(e.length<2||t.length<2)return-1;o=2,a/=2,u/=2,n/=2}function c(e,t){return 1===o?e[t]:e.readUInt16BE(t*o)}if(i){var l=-1;for(s=n;sa&&(n=a-u),s=n;s>=0;s--){for(var h=!0,f=0;fi&&(r=i):r=i;var s=t.length;if(s%2!=0)throw new TypeError("Invalid hex string");r>s/2&&(r=s/2);for(var o=0;o>8,i=n%256,s.push(i),s.push(r);return s}(t,e.length-n),e,n,r)}function x(e,t,n){return 0===t&&n===e.length?r.fromByteArray(e):r.fromByteArray(e.slice(t,n))}function O(e,t,n){n=Math.min(e.length,n);for(var r=[],i=t;i239?4:c>223?3:c>191?2:1;if(i+h<=n)switch(h){case 1:c<128&&(l=c);break;case 2:128==(192&(s=e[i+1]))&&(u=(31&c)<<6|63&s)>127&&(l=u);break;case 3:s=e[i+1],o=e[i+2],128==(192&s)&&128==(192&o)&&(u=(15&c)<<12|(63&s)<<6|63&o)>2047&&(u<55296||u>57343)&&(l=u);break;case 4:s=e[i+1],o=e[i+2],a=e[i+3],128==(192&s)&&128==(192&o)&&128==(192&a)&&(u=(15&c)<<18|(63&s)<<12|(63&o)<<6|63&a)>65535&&u<1114112&&(l=u)}null===l?(l=65533,h=1):l>65535&&(l-=65536,r.push(l>>>10&1023|55296),l=56320|1023&l),r.push(l),i+=h}return function(e){var t=e.length;if(t<=4096)return String.fromCharCode.apply(String,e);var n="",r=0;for(;r0&&(e=this.toString("hex",0,n).match(/.{2}/g).join(" "),this.length>n&&(e+=" ... ")),""},u.prototype.compare=function(e,t,n,r,i){if(!u.isBuffer(e))throw new TypeError("Argument must be a Buffer");if(void 0===t&&(t=0),void 0===n&&(n=e?e.length:0),void 0===r&&(r=0),void 0===i&&(i=this.length),t<0||n>e.length||r<0||i>this.length)throw new RangeError("out of range index");if(r>=i&&t>=n)return 0;if(r>=i)return-1;if(t>=n)return 1;if(this===e)return 0;for(var s=(i>>>=0)-(r>>>=0),o=(n>>>=0)-(t>>>=0),a=Math.min(s,o),c=this.slice(r,i),l=e.slice(t,n),h=0;hi)&&(n=i),e.length>0&&(n<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");r||(r="utf8");for(var s=!1;;)switch(r){case"hex":return k(this,e,t,n);case"utf8":case"utf-8":return v(this,e,t,n);case"ascii":return w(this,e,t,n);case"latin1":case"binary":return S(this,e,t,n);case"base64":return _(this,e,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return E(this,e,t,n);default:if(s)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),s=!0}},u.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function A(e,t,n){var r="";n=Math.min(e.length,n);for(var i=t;ir)&&(n=r);for(var i="",s=t;sn)throw new RangeError("Trying to access beyond buffer length")}function P(e,t,n,r,i,s){if(!u.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 L(e,t,n,r){t<0&&(t=65535+t+1);for(var i=0,s=Math.min(e.length-n,2);i>>8*(r?i:1-i)}function I(e,t,n,r){t<0&&(t=4294967295+t+1);for(var i=0,s=Math.min(e.length-n,4);i>>8*(r?i:3-i)&255}function M(e,t,n,r,i,s){if(n+r>e.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function B(e,t,n,r,s){return s||M(e,0,n,4),i.write(e,t,n,r,23,4),n+4}function D(e,t,n,r,s){return s||M(e,0,n,8),i.write(e,t,n,r,52,8),n+8}u.prototype.slice=function(e,t){var n,r=this.length;if((e=~~e)<0?(e+=r)<0&&(e=0):e>r&&(e=r),(t=void 0===t?r:~~t)<0?(t+=r)<0&&(t=0):t>r&&(t=r),t0&&(i*=256);)r+=this[e+--t]*i;return r},u.prototype.readUInt8=function(e,t){return t||T(e,1,this.length),this[e]},u.prototype.readUInt16LE=function(e,t){return t||T(e,2,this.length),this[e]|this[e+1]<<8},u.prototype.readUInt16BE=function(e,t){return t||T(e,2,this.length),this[e]<<8|this[e+1]},u.prototype.readUInt32LE=function(e,t){return t||T(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},u.prototype.readUInt32BE=function(e,t){return t||T(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},u.prototype.readIntLE=function(e,t,n){e|=0,t|=0,n||T(e,t,this.length);for(var r=this[e],i=1,s=0;++s=(i*=128)&&(r-=Math.pow(2,8*t)),r},u.prototype.readIntBE=function(e,t,n){e|=0,t|=0,n||T(e,t,this.length);for(var r=t,i=1,s=this[e+--r];r>0&&(i*=256);)s+=this[e+--r]*i;return s>=(i*=128)&&(s-=Math.pow(2,8*t)),s},u.prototype.readInt8=function(e,t){return t||T(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},u.prototype.readInt16LE=function(e,t){t||T(e,2,this.length);var n=this[e]|this[e+1]<<8;return 32768&n?4294901760|n:n},u.prototype.readInt16BE=function(e,t){t||T(e,2,this.length);var n=this[e+1]|this[e]<<8;return 32768&n?4294901760|n:n},u.prototype.readInt32LE=function(e,t){return t||T(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},u.prototype.readInt32BE=function(e,t){return t||T(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},u.prototype.readFloatLE=function(e,t){return t||T(e,4,this.length),i.read(this,e,!0,23,4)},u.prototype.readFloatBE=function(e,t){return t||T(e,4,this.length),i.read(this,e,!1,23,4)},u.prototype.readDoubleLE=function(e,t){return t||T(e,8,this.length),i.read(this,e,!0,52,8)},u.prototype.readDoubleBE=function(e,t){return t||T(e,8,this.length),i.read(this,e,!1,52,8)},u.prototype.writeUIntLE=function(e,t,n,r){(e=+e,t|=0,n|=0,r)||P(this,e,t,n,Math.pow(2,8*n)-1,0);var i=1,s=0;for(this[t]=255&e;++s=0&&(s*=256);)this[t+i]=e/s&255;return t+n},u.prototype.writeUInt8=function(e,t,n){return e=+e,t|=0,n||P(this,e,t,1,255,0),u.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[t]=255&e,t+1},u.prototype.writeUInt16LE=function(e,t,n){return e=+e,t|=0,n||P(this,e,t,2,65535,0),u.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):L(this,e,t,!0),t+2},u.prototype.writeUInt16BE=function(e,t,n){return e=+e,t|=0,n||P(this,e,t,2,65535,0),u.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):L(this,e,t,!1),t+2},u.prototype.writeUInt32LE=function(e,t,n){return e=+e,t|=0,n||P(this,e,t,4,4294967295,0),u.TYPED_ARRAY_SUPPORT?(this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e):I(this,e,t,!0),t+4},u.prototype.writeUInt32BE=function(e,t,n){return e=+e,t|=0,n||P(this,e,t,4,4294967295,0),u.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):I(this,e,t,!1),t+4},u.prototype.writeIntLE=function(e,t,n,r){if(e=+e,t|=0,!r){var i=Math.pow(2,8*n-1);P(this,e,t,n,i-1,-i)}var s=0,o=1,a=0;for(this[t]=255&e;++s>0)-a&255;return t+n},u.prototype.writeIntBE=function(e,t,n,r){if(e=+e,t|=0,!r){var i=Math.pow(2,8*n-1);P(this,e,t,n,i-1,-i)}var s=n-1,o=1,a=0;for(this[t+s]=255&e;--s>=0&&(o*=256);)e<0&&0===a&&0!==this[t+s+1]&&(a=1),this[t+s]=(e/o>>0)-a&255;return t+n},u.prototype.writeInt8=function(e,t,n){return e=+e,t|=0,n||P(this,e,t,1,127,-128),u.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),e<0&&(e=255+e+1),this[t]=255&e,t+1},u.prototype.writeInt16LE=function(e,t,n){return e=+e,t|=0,n||P(this,e,t,2,32767,-32768),u.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):L(this,e,t,!0),t+2},u.prototype.writeInt16BE=function(e,t,n){return e=+e,t|=0,n||P(this,e,t,2,32767,-32768),u.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):L(this,e,t,!1),t+2},u.prototype.writeInt32LE=function(e,t,n){return e=+e,t|=0,n||P(this,e,t,4,2147483647,-2147483648),u.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24):I(this,e,t,!0),t+4},u.prototype.writeInt32BE=function(e,t,n){return e=+e,t|=0,n||P(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),u.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):I(this,e,t,!1),t+4},u.prototype.writeFloatLE=function(e,t,n){return B(this,e,t,!0,n)},u.prototype.writeFloatBE=function(e,t,n){return B(this,e,t,!1,n)},u.prototype.writeDoubleLE=function(e,t,n){return D(this,e,t,!0,n)},u.prototype.writeDoubleBE=function(e,t,n){return D(this,e,t,!1,n)},u.prototype.copy=function(e,t,n,r){if(n||(n=0),r||0===r||(r=this.length),t>=e.length&&(t=e.length),t||(t=0),r>0&&r=this.length)throw new RangeError("sourceStart out of bounds");if(r<0)throw new RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),e.length-t=0;--i)e[i+t]=this[i+n];else if(s<1e3||!u.TYPED_ARRAY_SUPPORT)for(i=0;i>>=0,n=void 0===n?this.length:n>>>0,e||(e=0),"number"==typeof e)for(s=t;s55295&&n<57344){if(!i){if(n>56319){(t-=3)>-1&&s.push(239,191,189);continue}if(o+1===r){(t-=3)>-1&&s.push(239,191,189);continue}i=n;continue}if(n<56320){(t-=3)>-1&&s.push(239,191,189),i=n;continue}n=65536+(i-55296<<10|n-56320)}else i&&(t-=3)>-1&&s.push(239,191,189);if(i=null,n<128){if((t-=1)<0)break;s.push(n)}else if(n<2048){if((t-=2)<0)break;s.push(n>>6|192,63&n|128)}else if(n<65536){if((t-=3)<0)break;s.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;s.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return s}function z(e){return r.toByteArray(function(e){if((e=function(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")}(e).replace(N,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function F(e,t,n,r){for(var i=0;i=t.length||i>=e.length);++i)t[i+n]=e[i];return i}}).call(this,n(3))},function(e,t){var n,r,i=e.exports={};function s(){throw new Error("setTimeout has not been defined")}function o(){throw new Error("clearTimeout has not been defined")}function a(e){if(n===setTimeout)return setTimeout(e,0);if((n===s||!n)&&setTimeout)return n=setTimeout,setTimeout(e,0);try{return n(e,0)}catch(t){try{return n.call(null,e,0)}catch(t){return n.call(this,e,0)}}}!function(){try{n="function"==typeof setTimeout?setTimeout:s}catch(e){n=s}try{r="function"==typeof clearTimeout?clearTimeout:o}catch(e){r=o}}();var u,c=[],l=!1,h=-1;function f(){l&&u&&(l=!1,u.length?c=u.concat(c):h=-1,c.length&&d())}function d(){if(!l){var e=a(f);l=!0;for(var t=c.length;t;){for(u=c,c=[];++h1)for(var n=1;n0&&o.length>i&&!o.warned){o.warned=!0;var u=new Error("Possible EventEmitter memory leak detected. "+o.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");u.name="MaxListenersExceededWarning",u.emitter=e,u.type=t,u.count=o.length,a=u,console&&console.warn&&console.warn(a)}return e}function f(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function d(e,t,n){var r={fired:!1,wrapFn:void 0,target:e,type:t,listener:n},i=f.bind(r);return i.listener=n,r.wrapFn=i,i}function p(e,t,n){var r=e._events;if(void 0===r)return[];var i=r[t];return void 0===i?[]:"function"==typeof i?n?[i.listener||i]:[i]:n?function(e){for(var t=new Array(e.length),n=0;n0&&(o=t[0]),o instanceof Error)throw o;var a=new Error("Unhandled error."+(o?" ("+o.message+")":""));throw a.context=o,a}var u=i[e];if(void 0===u)return!1;if("function"==typeof u)s(u,this,t);else{var c=u.length,l=g(u,c);for(n=0;n=0;s--)if(n[s]===t||n[s].listener===t){o=n[s].listener,i=s;break}if(i<0)return this;0===i?n.shift():function(e,t){for(;t+1=0;r--)this.removeListener(e,t[r]);return this},a.prototype.listeners=function(e){return p(this,e,!0)},a.prototype.rawListeners=function(e){return p(this,e,!1)},a.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):b.call(e,t)},a.prototype.listenerCount=b,a.prototype.eventNames=function(){return this._eventsCount>0?r(this._events):[]}},function(e,t,n){"use strict";e.exports={isArray:Array.isArray,assign:Object.assign,isObject:e=>"object"==typeof e,isFunction:e=>"function"==typeof e,isBoolean:e=>"boolean"==typeof e,isRegex:e=>e instanceof RegExp,keys:Object.keys}},function(e,t,n){"use strict";var r=n(14),i=Object.keys||function(e){var t=[];for(var n in e)t.push(n);return t};e.exports=h;var s=Object.create(n(13));s.inherits=n(2);var o=n(26),a=n(29);s.inherits(h,o);for(var u=i(a.prototype),c=0;c2?"one of ".concat(t," ").concat(e.slice(0,n-1).join(", "),", or ")+e[n-1]:2===n?"one of ".concat(t," ").concat(e[0]," or ").concat(e[1]):"of ".concat(t," ").concat(e[0])}return"of ".concat(t," ").concat(String(e))}i("ERR_INVALID_OPT_VALUE",(function(e,t){return'The value "'+t+'" is invalid for option "'+e+'"'}),TypeError),i("ERR_INVALID_ARG_TYPE",(function(e,t,n){var r,i,o,a;if("string"==typeof t&&(i="not ",t.substr(!o||o<0?0:+o,i.length)===i)?(r="must not be",t=t.replace(/^not /,"")):r="must be",function(e,t,n){return(void 0===n||n>e.length)&&(n=e.length),e.substring(n-t.length,n)===t}(e," argument"))a="The ".concat(e," ").concat(r," ").concat(s(t,"type"));else{var u=function(e,t,n){return"number"!=typeof n&&(n=0),!(n+t.length>e.length)&&-1!==e.indexOf(t,n)}(e,".")?"property":"argument";a='The "'.concat(e,'" ').concat(u," ").concat(r," ").concat(s(t,"type"))}return a+=". Received type ".concat(typeof n)}),TypeError),i("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),i("ERR_METHOD_NOT_IMPLEMENTED",(function(e){return"The "+e+" method is not implemented"})),i("ERR_STREAM_PREMATURE_CLOSE","Premature close"),i("ERR_STREAM_DESTROYED",(function(e){return"Cannot call "+e+" after a stream was destroyed"})),i("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),i("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),i("ERR_STREAM_WRITE_AFTER_END","write after end"),i("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),i("ERR_UNKNOWN_ENCODING",(function(e){return"Unknown encoding: "+e}),TypeError),i("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),e.exports.codes=r},function(e,t,n){"use strict";(function(t){var r=Object.keys||function(e){var t=[];for(var n in e)t.push(n);return t};e.exports=c;var i=n(34),s=n(38);n(2)(c,i);for(var o=r(s.prototype),a=0;a 2 bytes.");const n=s.decode(e);if(!t.isValidCode(n))throw new Error("multihash unknown function code: 0x"+n.toString(16));e=e.slice(s.decode.bytes);const i=s.decode(e);if(i<0)throw new Error("multihash invalid length: "+i);if((e=e.slice(s.decode.bytes)).length!==i)throw new Error("multihash length inconsistent: 0x"+e.toString("hex"));return{code:n,name:o.codes[n],length:i,digest:e}},t.encode=function(e,n,i){if(!e||void 0===n)throw new Error("multihash encode requires at least two args: digest, code");const o=t.coerceCode(n);if(!r.isBuffer(e))throw new Error("digest should be a Buffer");if(null==i&&(i=e.length),i&&e.length!==i)throw new Error("digest length should be equal to specified length.");return r.concat([r.from(s.encode(o)),r.from(s.encode(i)),e])},t.coerceCode=function(e){let n=e;if("string"==typeof e){if(void 0===o.names[e])throw new Error("Unrecognized hash function named: "+e);n=o.names[e]}if("number"!=typeof n)throw new Error("Hash function code should be a number. Got: "+n);if(void 0===o.codes[n]&&!t.isAppCode(n))throw new Error("Unrecognized function code: "+n);return n},t.isAppCode=function(e){return e>0&&e<16},t.isValidCode=function(e){return!!t.isAppCode(e)||!!o.codes[e]},t.validate=a,t.prefix=function(e){return a(e),e.slice(0,2)}},function(e){e.exports=JSON.parse('{"identity":0,"ip4":4,"tcp":6,"sha1":17,"sha2-256":18,"sha2-512":19,"sha3-512":20,"sha3-384":21,"sha3-256":22,"sha3-224":23,"shake-128":24,"shake-256":25,"keccak-224":26,"keccak-256":27,"keccak-384":28,"keccak-512":29,"dccp":33,"murmur3-128":34,"murmur3-32":35,"ip6":41,"ip6zone":42,"path":47,"multicodec":48,"multihash":49,"multiaddr":50,"multibase":51,"dns":53,"dns4":54,"dns6":55,"dnsaddr":56,"protobuf":80,"cbor":81,"raw":85,"dbl-sha2-256":86,"rlp":96,"bencode":99,"dag-pb":112,"dag-cbor":113,"libp2p-key":114,"git-raw":120,"torrent-info":123,"torrent-file":124,"leofcoin-block":129,"leofcoin-tx":130,"leofcoin-pr":131,"sctp":132,"eth-block":144,"eth-block-list":145,"eth-tx-trie":146,"eth-tx":147,"eth-tx-receipt-trie":148,"eth-tx-receipt":149,"eth-state-trie":150,"eth-account-snapshot":151,"eth-storage-trie":152,"bitcoin-block":176,"bitcoin-tx":177,"zcash-block":192,"zcash-tx":193,"stellar-block":208,"stellar-tx":209,"md4":212,"md5":213,"bmt":214,"decred-block":224,"decred-tx":225,"ipld-ns":226,"ipfs-ns":227,"swarm-ns":228,"ipns-ns":229,"zeronet":230,"ed25519-pub":237,"dash-block":240,"dash-tx":241,"swarm-manifest":250,"swarm-feed":251,"udp":273,"p2p-webrtc-star":275,"p2p-webrtc-direct":276,"p2p-stardust":277,"p2p-circuit":290,"dag-json":297,"udt":301,"utp":302,"unix":400,"p2p":421,"ipfs":421,"https":443,"onion":444,"onion3":445,"garlic64":446,"garlic32":447,"tls":448,"quic":460,"ws":477,"wss":478,"p2p-websocket-star":479,"http":480,"json":512,"messagepack":513,"x11":4352,"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":46000,"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,"holochain-adr-v0":8417572,"holochain-adr-v1":8483108,"holochain-key-v0":9728292,"holochain-key-v1":9793828,"holochain-sig-v0":10645796,"holochain-sig-v1":10711332}')},function(e,t,n){"use strict";const r=n(17),i=n(16),{Buffer:s}=n(0);e.exports=i(class{constructor(e,t,n){if(!n)throw new Error("A link requires a cid to point to");this._name=e||"",this._nameBuf=null,this._size=t,this._cid=new r(n)}toString(){return`DAGLink <${this._cid.toBaseEncodedString()} - name: "${this.Name}", size: ${this.Tsize}>`}toJSON(){return this._json||(this._json=Object.freeze({name:this.Name,size:this.Tsize,cid:this.Hash.toBaseEncodedString()})),Object.assign({},this._json)}get Name(){return this._name}get nameAsBuffer(){return null!==this._nameBuf||(this._nameBuf=s.from(this._name)),this._nameBuf}set Name(e){throw new Error("Can't set property: 'name' is immutable")}get Tsize(){return this._size}set Tsize(e){throw new Error("Can't set property: 'size' is immutable")}get Hash(){return this._cid}set Hash(e){throw new Error("Can't set property: 'cid' is immutable")}},{className:"DAGLink",symbolName:"@ipld/js-ipld-dag-pb/daglink"})},function(e,t,n){(function(e){function n(e){return Object.prototype.toString.call(e)}t.isArray=function(e){return Array.isArray?Array.isArray(e):"[object Array]"===n(e)},t.isBoolean=function(e){return"boolean"==typeof e},t.isNull=function(e){return null===e},t.isNullOrUndefined=function(e){return null==e},t.isNumber=function(e){return"number"==typeof e},t.isString=function(e){return"string"==typeof e},t.isSymbol=function(e){return"symbol"==typeof e},t.isUndefined=function(e){return void 0===e},t.isRegExp=function(e){return"[object RegExp]"===n(e)},t.isObject=function(e){return"object"==typeof e&&null!==e},t.isDate=function(e){return"[object Date]"===n(e)},t.isError=function(e){return"[object Error]"===n(e)||e instanceof Error},t.isFunction=function(e){return"function"==typeof e},t.isPrimitive=function(e){return null===e||"boolean"==typeof e||"number"==typeof e||"string"==typeof e||"symbol"==typeof e||void 0===e},t.isBuffer=e.isBuffer}).call(this,n(0).Buffer)},function(e,t,n){"use strict";(function(t){void 0===t||!t.version||0===t.version.indexOf("v0.")||0===t.version.indexOf("v1.")&&0!==t.version.indexOf("v1.8.")?e.exports={nextTick:function(e,n,r,i){if("function"!=typeof e)throw new TypeError('"callback" argument must be a function');var s,o,a=arguments.length;switch(a){case 0:case 1:return t.nextTick(e);case 2:return t.nextTick((function(){e.call(null,n)}));case 3:return t.nextTick((function(){e.call(null,n,r)}));case 4:return t.nextTick((function(){e.call(null,n,r,i)}));default:for(s=new Array(a-1),o=0;o>5==6?2:e>>4==14?3:e>>3==30?4:e>>6==2?-1:-2}function a(e){var t=this.lastTotal-this.lastNeed,n=function(e,t,n){if(128!=(192&t[0]))return e.lastNeed=0,"�";if(e.lastNeed>1&&t.length>1){if(128!=(192&t[1]))return e.lastNeed=1,"�";if(e.lastNeed>2&&t.length>2&&128!=(192&t[2]))return e.lastNeed=2,"�"}}(this,e);return void 0!==n?n:this.lastNeed<=e.length?(e.copy(this.lastChar,t,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal)):(e.copy(this.lastChar,t,0,e.length),void(this.lastNeed-=e.length))}function u(e,t){if((e.length-t)%2==0){var n=e.toString("utf16le",t);if(n){var r=n.charCodeAt(n.length-1);if(r>=55296&&r<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1],n.slice(0,-1)}return n}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=e[e.length-1],e.toString("utf16le",t,e.length-1)}function c(e){var t=e&&e.length?this.write(e):"";if(this.lastNeed){var n=this.lastTotal-this.lastNeed;return t+this.lastChar.toString("utf16le",0,n)}return t}function l(e,t){var n=(e.length-t)%3;return 0===n?e.toString("base64",t):(this.lastNeed=3-n,this.lastTotal=3,1===n?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-n))}function h(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+this.lastChar.toString("base64",0,3-this.lastNeed):t}function f(e){return e.toString(this.encoding)}function d(e){return e&&e.length?this.write(e):""}t.StringDecoder=s,s.prototype.write=function(e){if(0===e.length)return"";var t,n;if(this.lastNeed){if(void 0===(t=this.fillLast(e)))return"";n=this.lastNeed,this.lastNeed=0}else n=0;return n=0)return i>0&&(e.lastNeed=i-1),i;if(--r=0)return i>0&&(e.lastNeed=i-2),i;if(--r=0)return i>0&&(2===i?i=0:e.lastNeed=i-3),i;return 0}(this,e,t);if(!this.lastNeed)return e.toString("utf8",t);this.lastTotal=n;var r=e.length-(n-this.lastNeed);return e.copy(this.lastChar,0,r),e.toString("utf8",t,r)},s.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,n){"use strict";e.exports=function(e,{className:t,symbolName:n}){const r=Symbol.for(n),i={[t]:class extends e{constructor(...e){super(...e),Object.defineProperty(this,r,{value:!0})}get[Symbol.toStringTag](){return t}}}[t];return i["is"+t]=e=>!(!e||!e[r]),i},e.exports.proto=function(e,{className:t,symbolName:n,withoutNew:r}){const i=Symbol.for(n),s={[t]:function(...t){if(r&&!(this instanceof s))return new s(...t);const n=e.call(this,...t)||this;return n&&!n[i]&&Object.defineProperty(n,i,{value:!0}),n}}[t];return s.prototype=Object.create(e.prototype),s.prototype.constructor=s,Object.defineProperty(s.prototype,Symbol.toStringTag,{get:()=>t}),s["is"+t]=e=>!(!e||!e[i]),s}},function(e,t,n){"use strict";const{Buffer:r}=n(0),i=n(10),s=n(44),o=n(23),a=n(11),u=n(120),c=n(16);class l{constructor(e,t,n,a){if(h.isCID(e)){const t=e;return this.version=t.version,this.codec=t.codec,this.multihash=r.from(t.multihash),void(this.multibaseName=t.multibaseName||(0===t.version?"base58btc":"base32"))}if("string"==typeof e){const t=s.isEncoded(e);if(t){const n=s.decode(e);this.version=parseInt(n.slice(0,1).toString("hex"),16),this.codec=o.getCodec(n.slice(1)),this.multihash=o.rmPrefix(n.slice(1)),this.multibaseName=t}else this.version=0,this.codec="dag-pb",this.multihash=i.fromB58String(e),this.multibaseName="base58btc";return l.validateCID(this),void Object.defineProperty(this,"string",{value:e})}if(r.isBuffer(e)){const t=e.slice(0,1),n=parseInt(t.toString("hex"),16);if(1===n){const t=e;this.version=n,this.codec=o.getCodec(t.slice(1)),this.multihash=o.rmPrefix(t.slice(1)),this.multibaseName="base32"}else this.version=0,this.codec="dag-pb",this.multihash=e,this.multibaseName="base58btc";l.validateCID(this)}else this.version=e,this.codec=t,this.multihash=n,this.multibaseName=a||(0===e?"base58btc":"base32"),l.validateCID(this)}get buffer(){let e=this._buffer;if(!e){if(0===this.version)e=this.multihash;else{if(1!==this.version)throw new Error("unsupported version");e=r.concat([r.from("01","hex"),o.getCodeVarint(this.codec),this.multihash])}Object.defineProperty(this,"_buffer",{value:e})}return e}get prefix(){return r.concat([r.from("0"+this.version,"hex"),o.getCodeVarint(this.codec),i.prefix(this.multihash)])}toV0(){if("dag-pb"!==this.codec)throw new Error("Cannot convert a non dag-pb CID to CIDv0");const{name:e,length:t}=i.decode(this.multihash);if("sha2-256"!==e)throw new Error("Cannot convert non sha2-256 multihash CID to CIDv0");if(32!==t)throw new Error("Cannot convert non 32 byte multihash CID to CIDv0");return new h(0,this.codec,this.multihash)}toV1(){return new h(1,this.codec,this.multihash)}toBaseEncodedString(e=this.multibaseName){if(this.string&&e===this.multibaseName)return this.string;let t=null;if(0===this.version){if("base58btc"!==e)throw new Error("not supported with CIDv0, to support different bases, please migrate the instance do CIDv1, you can do that through cid.toV1()");t=i.toB58String(this.multihash)}else{if(1!==this.version)throw new Error("unsupported version");t=s.encode(e,this.buffer).toString()}return e===this.multibaseName&&Object.defineProperty(this,"string",{value:t}),t}[Symbol.for("nodejs.util.inspect.custom")](){return"CID("+this.toString()+")"}toString(e){return this.toBaseEncodedString(e)}toJSON(){return{codec:this.codec,version:this.version,hash:this.multihash}}equals(e){return this.codec===e.codec&&this.version===e.version&&this.multihash.equals(e.multihash)}static validateCID(e){const t=u.checkCIDComponents(e);if(t)throw new Error(t)}}const h=c(l,{className:"CID",symbolName:"@ipld/js-cid/CID"});h.codecs=a,e.exports=h},function(e,t,n){var r=n(0),i=r.Buffer;function s(e,t){for(var n in e)t[n]=e[n]}function o(e,t,n){return i(e,t,n)}i.from&&i.alloc&&i.allocUnsafe&&i.allocUnsafeSlow?e.exports=r:(s(r,t),t.Buffer=o),s(i,o),o.from=function(e,t,n){if("number"==typeof e)throw new TypeError("Argument must not be a number");return i(e,t,n)},o.alloc=function(e,t,n){if("number"!=typeof e)throw new TypeError("Argument must be a number");var r=i(e);return void 0!==t?"string"==typeof n?r.fill(t,n):r.fill(t):r.fill(0),r},o.allocUnsafe=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return i(e)},o.allocUnsafeSlow=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return r.SlowBuffer(e)}},function(e,t,n){"use strict";var r=n(8).codes.ERR_STREAM_PREMATURE_CLOSE;function i(){}e.exports=function e(t,n,s){if("function"==typeof n)return e(t,null,n);n||(n={}),s=function(e){var t=!1;return function(){if(!t){t=!0;for(var n=arguments.length,r=new Array(n),i=0;inew Error("Ipfs instance not defined"),u=["next","refs"],c=e=>0===e?"dag-pb":"dag-cbor",l=e=>h.isEntry(e)?c(e.v):c(e);class h{static async create(e,t,n,s,o=[],u,c=[],l){if(!i(e))throw a();if(!i(t))throw new Error("Identity is required, cannot create entry");if(!i(n))throw new Error("Entry requires an id");if(!i(s))throw new Error("Entry requires data");if(!i(o)||!Array.isArray(o))throw new Error("'next' argument is not an array");const f={hash:null,id:n,payload:s,next:o.filter(i).map(e=>e.hash?e.hash:e),refs:c,v:2,clock:u||new r(t.publicKey)},d=await t.provider.sign(t,h.toBuffer(f));return f.key=t.publicKey,f.identity=t.toJSON(),f.sig=d,f.hash=await h.toMultihash(e,f,l),f}static async verify(e,t){if(!e)throw new Error("Identity-provider is required, cannot verify entry");if(!h.isEntry(t))throw new Error("Invalid Log entry");if(!t.key)throw new Error("Entry doesn't have a key");if(!t.sig)throw new Error("Entry doesn't have a signature");const n=h.toEntry(t,{presigned:!0}),r=t.v<1?"v0":"v1";return e.verify(t.sig,t.key,h.toBuffer(n),r)}static toBuffer(e){const n=0===e.v?JSON.stringify(e):o(e);return t.from(n)}static async toMultihash(e,t,n=!1){if(!e)throw a();if(!h.isEntry(t))throw new Error("Invalid object format, cannot generate entry hash");const r=h.toEntry(t);return s.write(e,l(r.v),r,{links:u,pin:n})}static toEntry(e,{presigned:t=!1,includeHash:n=!1}={}){const i={hash:n?e.hash:null,id:e.id,payload:e.payload,next:e.next},s=e.v;return s>1&&(i.refs=e.refs),i.v=e.v,i.clock=new r(e.clock.id,e.clock.time),t||(i.key=e.key,s>0&&(i.identity=e.identity),i.sig=e.sig),i}static async fromMultihash(e,t){if(!e)throw a();if(!t)throw new Error("Invalid hash: "+t);const n=await s.read(e,t,{links:u}),r=h.toEntry(n);return r.hash=t,r}static isEntry(e){return e&&void 0!==e.id&&void 0!==e.next&&void 0!==e.payload&&void 0!==e.v&&void 0!==e.hash&&void 0!==e.clock&&(void 0!==e.refs||e.v<2)}static compare(e,t){var n=r.compare(e.clock,t.clock);return 0===n?e.clock.id-1}static findChildren(e,t){for(var n=[],r=t.find(t=>h.isParent(e,t)),i=e;r;)n.push(r),i=r,r=t.find(e=>h.isParent(i,e));return n=n.sort((e,t)=>e.clock.time>t.clock.time)}}e.exports=h,e.exports.IPLD_LINKS=u,e.exports.getWriteFormat=l}).call(this,n(0).Buffer)},function(e,t,n){"use strict";class r{constructor(e,t){this.id=e,this.time=t||0}tick(){return new r(this.id,++this.time)}merge(e){return this.time=Math.max(this.time,e.time),new r(this.id,this.time)}clone(){return new r(this.id,this.time)}static compare(e,t){var n=e.time-t.time;return 0===n&&e.id!==t.id?e.id{let n;if(r.isBuffer(e))n=a.varintBufferEncode(e);else{if(!o[e])throw new Error("multicodec not recognized");n=o[e]}return r.concat([n,t])},t.rmPrefix=e=>(i.decode(e),e.slice(i.decode.bytes)),t.getCodec=e=>{const t=i.decode(e),n=s.get(t);if(void 0===n)throw new Error(`Code ${t} not found`);return n},t.getName=e=>s.get(e),t.getNumber=e=>{const t=o[e];if(void 0===t)throw new Error("Codec `"+e+"` not found");return a.varintBufferDecode(t)[0]},t.getCode=e=>i.decode(e),t.getCodeVarint=e=>{const t=o[e];if(void 0===t)throw new Error("Codec `"+e+"` not found");return t},t.getVarint=e=>i.encode(e);const u=n(114);Object.assign(t,u),t.print=n(115)},function(e,t,n){"use strict";t.defined=function(e){return null!=e&&("number"!=typeof e||!isNaN(e))}},function(e,t){var n={}.toString;e.exports=Array.isArray||function(e){return"[object Array]"==n.call(e)}},function(e,t,n){"use strict";(function(t,r){var i=n(14);e.exports=k;var s,o=n(25);k.ReadableState=m;n(5).EventEmitter;var a=function(e,t){return e.listeners(t).length},u=n(27),c=n(18).Buffer,l=t.Uint8Array||function(){};var h=Object.create(n(13));h.inherits=n(2);var f=n(64),d=void 0;d=f&&f.debuglog?f.debuglog("stream"):function(){};var p,b=n(65),g=n(28);h.inherits(k,u);var y=["error","close","destroy","pause","resume"];function m(e,t){e=e||{};var r=t instanceof(s=s||n(7));this.objectMode=!!e.objectMode,r&&(this.objectMode=this.objectMode||!!e.readableObjectMode);var i=e.highWaterMark,o=e.readableHighWaterMark,a=this.objectMode?16:16384;this.highWaterMark=i||0===i?i:r&&(o||0===o)?o:a,this.highWaterMark=Math.floor(this.highWaterMark),this.buffer=new b,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&&(p||(p=n(15).StringDecoder),this.decoder=new p(e.encoding),this.encoding=e.encoding)}function k(e){if(s=s||n(7),!(this instanceof k))return new k(e);this._readableState=new m(e,this),this.readable=!0,e&&("function"==typeof e.read&&(this._read=e.read),"function"==typeof e.destroy&&(this._destroy=e.destroy)),u.call(this)}function v(e,t,n,r,i){var s,o=e._readableState;null===t?(o.reading=!1,function(e,t){if(t.ended)return;if(t.decoder){var n=t.decoder.end();n&&n.length&&(t.buffer.push(n),t.length+=t.objectMode?1:n.length)}t.ended=!0,_(e)}(e,o)):(i||(s=function(e,t){var n;r=t,c.isBuffer(r)||r instanceof l||"string"==typeof t||void 0===t||e.objectMode||(n=new TypeError("Invalid non-string/buffer chunk"));var r;return n}(o,t)),s?e.emit("error",s):o.objectMode||t&&t.length>0?("string"==typeof t||o.objectMode||Object.getPrototypeOf(t)===c.prototype||(t=function(e){return c.from(e)}(t)),r?o.endEmitted?e.emit("error",new Error("stream.unshift() after end event")):w(e,o,t,!0):o.ended?e.emit("error",new Error("stream.push() after EOF")):(o.reading=!1,o.decoder&&!n?(t=o.decoder.write(t),o.objectMode||0!==t.length?w(e,o,t,!1):x(e,o)):w(e,o,t,!1))):r||(o.reading=!1));return function(e){return!e.ended&&(e.needReadable||e.lengtht.highWaterMark&&(t.highWaterMark=function(e){return e>=8388608?e=8388608:(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 _(e){var t=e._readableState;t.needReadable=!1,t.emittedReadable||(d("emitReadable",t.flowing),t.emittedReadable=!0,t.sync?i.nextTick(E,e):E(e))}function E(e){d("emit readable"),e.emit("readable"),j(e)}function x(e,t){t.readingMore||(t.readingMore=!0,i.nextTick(O,e,t))}function O(e,t){for(var n=t.length;!t.reading&&!t.flowing&&!t.ended&&t.length=t.length?(n=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.head.data:t.buffer.concat(t.length),t.buffer.clear()):n=function(e,t,n){var r;es.length?s.length:e;if(o===s.length?i+=s:i+=s.slice(0,e),0===(e-=o)){o===s.length?(++r,n.next?t.head=n.next:t.head=t.tail=null):(t.head=n,n.data=s.slice(o));break}++r}return t.length-=r,i}(e,t):function(e,t){var n=c.allocUnsafe(e),r=t.head,i=1;r.data.copy(n),e-=r.data.length;for(;r=r.next;){var s=r.data,o=e>s.length?s.length:e;if(s.copy(n,n.length-e,0,o),0===(e-=o)){o===s.length?(++i,r.next?t.head=r.next:t.head=t.tail=null):(t.head=r,r.data=s.slice(o));break}++i}return t.length-=i,n}(e,t);return r}(e,t.buffer,t.decoder),n);var n}function T(e){var t=e._readableState;if(t.length>0)throw new Error('"endReadable()" called on non-empty stream');t.endEmitted||(t.ended=!0,i.nextTick(P,t,e))}function P(e,t){e.endEmitted||0!==e.length||(e.endEmitted=!0,t.readable=!1,t.emit("end"))}function L(e,t){for(var n=0,r=e.length;n=t.highWaterMark||t.ended))return d("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?T(this):_(this),null;if(0===(e=S(e,t))&&t.ended)return 0===t.length&&T(this),null;var r,i=t.needReadable;return d("need readable",i),(0===t.length||t.length-e0?C(e,t):null)?(t.needReadable=!0,e=0):t.length-=e,0===t.length&&(t.ended||(t.needReadable=!0),n!==e&&t.ended&&T(this)),null!==r&&this.emit("data",r),r},k.prototype._read=function(e){this.emit("error",new Error("_read() is not implemented"))},k.prototype.pipe=function(e,t){var n=this,s=this._readableState;switch(s.pipesCount){case 0:s.pipes=e;break;case 1:s.pipes=[s.pipes,e];break;default:s.pipes.push(e)}s.pipesCount+=1,d("pipe count=%d opts=%j",s.pipesCount,t);var u=(!t||!1!==t.end)&&e!==r.stdout&&e!==r.stderr?l:k;function c(t,r){d("onunpipe"),t===n&&r&&!1===r.hasUnpiped&&(r.hasUnpiped=!0,d("cleanup"),e.removeListener("close",y),e.removeListener("finish",m),e.removeListener("drain",h),e.removeListener("error",g),e.removeListener("unpipe",c),n.removeListener("end",l),n.removeListener("end",k),n.removeListener("data",b),f=!0,!s.awaitDrain||e._writableState&&!e._writableState.needDrain||h())}function l(){d("onend"),e.end()}s.endEmitted?i.nextTick(u):n.once("end",u),e.on("unpipe",c);var h=function(e){return function(){var t=e._readableState;d("pipeOnDrain",t.awaitDrain),t.awaitDrain&&t.awaitDrain--,0===t.awaitDrain&&a(e,"data")&&(t.flowing=!0,j(e))}}(n);e.on("drain",h);var f=!1;var p=!1;function b(t){d("ondata"),p=!1,!1!==e.write(t)||p||((1===s.pipesCount&&s.pipes===e||s.pipesCount>1&&-1!==L(s.pipes,e))&&!f&&(d("false write response, pause",n._readableState.awaitDrain),n._readableState.awaitDrain++,p=!0),n.pause())}function g(t){d("onerror",t),k(),e.removeListener("error",g),0===a(e,"error")&&e.emit("error",t)}function y(){e.removeListener("finish",m),k()}function m(){d("onfinish"),e.removeListener("close",y),k()}function k(){d("unpipe"),n.unpipe(e)}return n.on("data",b),function(e,t,n){if("function"==typeof e.prependListener)return e.prependListener(t,n);e._events&&e._events[t]?o(e._events[t])?e._events[t].unshift(n):e._events[t]=[n,e._events[t]]:e.on(t,n)}(e,"error",g),e.once("close",y),e.once("finish",m),e.emit("pipe",n),s.flowing||(d("pipe resume"),n.resume()),e},k.prototype.unpipe=function(e){var t=this._readableState,n={hasUnpiped:!1};if(0===t.pipesCount)return this;if(1===t.pipesCount)return e&&e!==t.pipes||(e||(e=t.pipes),t.pipes=null,t.pipesCount=0,t.flowing=!1,e&&e.emit("unpipe",this,n)),this;if(!e){var r=t.pipes,i=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var s=0;s-1?r:s.nextTick;m.WritableState=y;var c=Object.create(n(13));c.inherits=n(2);var l={deprecate:n(30)},h=n(27),f=n(18).Buffer,d=i.Uint8Array||function(){};var p,b=n(28);function g(){}function y(e,t){a=a||n(7),e=e||{};var r=t instanceof a;this.objectMode=!!e.objectMode,r&&(this.objectMode=this.objectMode||!!e.writableObjectMode);var i=e.highWaterMark,c=e.writableHighWaterMark,l=this.objectMode?16:16384;this.highWaterMark=i||0===i?i:r&&(c||0===c)?c:l,this.highWaterMark=Math.floor(this.highWaterMark),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var h=!1===e.decodeStrings;this.decodeStrings=!h,this.defaultEncoding=e.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(e){!function(e,t){var n=e._writableState,r=n.sync,i=n.writecb;if(function(e){e.writing=!1,e.writecb=null,e.length-=e.writelen,e.writelen=0}(n),t)!function(e,t,n,r,i){--t.pendingcb,n?(s.nextTick(i,r),s.nextTick(E,e,t),e._writableState.errorEmitted=!0,e.emit("error",r)):(i(r),e._writableState.errorEmitted=!0,e.emit("error",r),E(e,t))}(e,n,r,t,i);else{var o=S(n);o||n.corked||n.bufferProcessing||!n.bufferedRequest||w(e,n),r?u(v,e,n,o,i):v(e,n,o,i)}}(t,e)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.bufferedRequestCount=0,this.corkedRequestsFree=new o(this)}function m(e){if(a=a||n(7),!(p.call(m,this)||this instanceof a))return new m(e);this._writableState=new y(e,this),this.writable=!0,e&&("function"==typeof e.write&&(this._write=e.write),"function"==typeof e.writev&&(this._writev=e.writev),"function"==typeof e.destroy&&(this._destroy=e.destroy),"function"==typeof e.final&&(this._final=e.final)),h.call(this)}function k(e,t,n,r,i,s,o){t.writelen=r,t.writecb=o,t.writing=!0,t.sync=!0,n?e._writev(i,t.onwrite):e._write(i,s,t.onwrite),t.sync=!1}function v(e,t,n,r){n||function(e,t){0===t.length&&t.needDrain&&(t.needDrain=!1,e.emit("drain"))}(e,t),t.pendingcb--,r(),E(e,t)}function w(e,t){t.bufferProcessing=!0;var n=t.bufferedRequest;if(e._writev&&n&&n.next){var r=t.bufferedRequestCount,i=new Array(r),s=t.corkedRequestsFree;s.entry=n;for(var a=0,u=!0;n;)i[a]=n,n.isBuf||(u=!1),n=n.next,a+=1;i.allBuffers=u,k(e,t,!0,t.length,i,"",s.finish),t.pendingcb++,t.lastBufferedRequest=null,s.next?(t.corkedRequestsFree=s.next,s.next=null):t.corkedRequestsFree=new o(t),t.bufferedRequestCount=0}else{for(;n;){var c=n.chunk,l=n.encoding,h=n.callback;if(k(e,t,!1,t.objectMode?1:c.length,c,l,h),n=n.next,t.bufferedRequestCount--,t.writing)break}null===n&&(t.lastBufferedRequest=null)}t.bufferedRequest=n,t.bufferProcessing=!1}function S(e){return e.ending&&0===e.length&&null===e.bufferedRequest&&!e.finished&&!e.writing}function _(e,t){e._final((function(n){t.pendingcb--,n&&e.emit("error",n),t.prefinished=!0,e.emit("prefinish"),E(e,t)}))}function E(e,t){var n=S(t);return n&&(!function(e,t){t.prefinished||t.finalCalled||("function"==typeof e._final?(t.pendingcb++,t.finalCalled=!0,s.nextTick(_,e,t)):(t.prefinished=!0,e.emit("prefinish")))}(e,t),0===t.pendingcb&&(t.finished=!0,e.emit("finish"))),n}c.inherits(m,h),y.prototype.getBuffer=function(){for(var e=this.bufferedRequest,t=[];e;)t.push(e),e=e.next;return t},function(){try{Object.defineProperty(y.prototype,"buffer",{get:l.deprecate((function(){return this.getBuffer()}),"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch(e){}}(),"function"==typeof Symbol&&Symbol.hasInstance&&"function"==typeof Function.prototype[Symbol.hasInstance]?(p=Function.prototype[Symbol.hasInstance],Object.defineProperty(m,Symbol.hasInstance,{value:function(e){return!!p.call(this,e)||this===m&&(e&&e._writableState instanceof y)}})):p=function(e){return e instanceof this},m.prototype.pipe=function(){this.emit("error",new Error("Cannot pipe, not readable"))},m.prototype.write=function(e,t,n){var r,i=this._writableState,o=!1,a=!i.objectMode&&(r=e,f.isBuffer(r)||r instanceof d);return a&&!f.isBuffer(e)&&(e=function(e){return f.from(e)}(e)),"function"==typeof t&&(n=t,t=null),a?t="buffer":t||(t=i.defaultEncoding),"function"!=typeof n&&(n=g),i.ended?function(e,t){var n=new Error("write after end");e.emit("error",n),s.nextTick(t,n)}(this,n):(a||function(e,t,n,r){var i=!0,o=!1;return null===n?o=new TypeError("May not write null values to stream"):"string"==typeof n||void 0===n||t.objectMode||(o=new TypeError("Invalid non-string/buffer chunk")),o&&(e.emit("error",o),s.nextTick(r,o),i=!1),i}(this,i,e,n))&&(i.pendingcb++,o=function(e,t,n,r,i,s){if(!n){var o=function(e,t,n){e.objectMode||!1===e.decodeStrings||"string"!=typeof t||(t=f.from(t,n));return t}(t,r,i);r!==o&&(n=!0,i="buffer",r=o)}var a=t.objectMode?1:r.length;t.length+=a;var u=t.length-1))throw new TypeError("Unknown encoding: "+e);return this._writableState.defaultEncoding=e,this},Object.defineProperty(m.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),m.prototype._write=function(e,t,n){n(new Error("_write() is not implemented"))},m.prototype._writev=null,m.prototype.end=function(e,t,n){var r=this._writableState;"function"==typeof e?(n=e,e=null,t=null):"function"==typeof t&&(n=t,t=null),null!=e&&this.write(e,t),r.corked&&(r.corked=1,this.uncork()),r.ending||r.finished||function(e,t,n){t.ending=!0,E(e,t),n&&(t.finished?s.nextTick(n):e.once("finish",n));t.ended=!0,e.writable=!1}(this,r,n)},Object.defineProperty(m.prototype,"destroyed",{get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(e){this._writableState&&(this._writableState.destroyed=e)}}),m.prototype.destroy=b.destroy,m.prototype._undestroy=b.undestroy,m.prototype._destroy=function(e,t){this.end(),t(e)}}).call(this,n(1),n(67).setImmediate,n(3))},function(e,t,n){(function(t){function n(e){try{if(!t.localStorage)return!1}catch(e){return!1}var n=t.localStorage[e];return null!=n&&"true"===String(n).toLowerCase()}e.exports=function(e,t){if(n("noDeprecation"))return e;var r=!1;return function(){if(!r){if(n("throwDeprecation"))throw new Error(t);n("traceDeprecation")?console.trace(t):console.warn(t),r=!0}return e.apply(this,arguments)}}}).call(this,n(3))},function(e,t,n){ +var r=n(60),i=n(61),s=n(25);function o(){return u.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function a(e,t){if(o()=o())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+o().toString(16)+" bytes");return 0|e}function p(e,t){if(u.isBuffer(e))return e.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(e)||e instanceof ArrayBuffer))return e.byteLength;"string"!=typeof e&&(e=""+e);var n=e.length;if(0===n)return 0;for(var r=!1;;)switch(t){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":case void 0:return q(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return z(e).length;default:if(r)return q(e).length;t=(""+t).toLowerCase(),r=!0}}function b(e,t,n){var r=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if((n>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return j(this,t,n);case"utf8":case"utf-8":return O(this,t,n);case"ascii":return A(this,t,n);case"latin1":case"binary":return R(this,t,n);case"base64":return x(this,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return C(this,t,n);default:if(r)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),r=!0}}function g(e,t,n){var r=e[t];e[t]=e[n],e[n]=r}function y(e,t,n,r,i){if(0===e.length)return-1;if("string"==typeof n?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),n=+n,isNaN(n)&&(n=i?0:e.length-1),n<0&&(n=e.length+n),n>=e.length){if(i)return-1;n=e.length-1}else if(n<0){if(!i)return-1;n=0}if("string"==typeof t&&(t=u.from(t,r)),u.isBuffer(t))return 0===t.length?-1:m(e,t,n,r,i);if("number"==typeof t)return t&=255,u.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(e,t,n):Uint8Array.prototype.lastIndexOf.call(e,t,n):m(e,[t],n,r,i);throw new TypeError("val must be string, number or Buffer")}function m(e,t,n,r,i){var s,o=1,a=e.length,u=t.length;if(void 0!==r&&("ucs2"===(r=String(r).toLowerCase())||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(e.length<2||t.length<2)return-1;o=2,a/=2,u/=2,n/=2}function c(e,t){return 1===o?e[t]:e.readUInt16BE(t*o)}if(i){var l=-1;for(s=n;sa&&(n=a-u),s=n;s>=0;s--){for(var h=!0,f=0;fi&&(r=i):r=i;var s=t.length;if(s%2!=0)throw new TypeError("Invalid hex string");r>s/2&&(r=s/2);for(var o=0;o>8,i=n%256,s.push(i),s.push(r);return s}(t,e.length-n),e,n,r)}function x(e,t,n){return 0===t&&n===e.length?r.fromByteArray(e):r.fromByteArray(e.slice(t,n))}function O(e,t,n){n=Math.min(e.length,n);for(var r=[],i=t;i239?4:c>223?3:c>191?2:1;if(i+h<=n)switch(h){case 1:c<128&&(l=c);break;case 2:128==(192&(s=e[i+1]))&&(u=(31&c)<<6|63&s)>127&&(l=u);break;case 3:s=e[i+1],o=e[i+2],128==(192&s)&&128==(192&o)&&(u=(15&c)<<12|(63&s)<<6|63&o)>2047&&(u<55296||u>57343)&&(l=u);break;case 4:s=e[i+1],o=e[i+2],a=e[i+3],128==(192&s)&&128==(192&o)&&128==(192&a)&&(u=(15&c)<<18|(63&s)<<12|(63&o)<<6|63&a)>65535&&u<1114112&&(l=u)}null===l?(l=65533,h=1):l>65535&&(l-=65536,r.push(l>>>10&1023|55296),l=56320|1023&l),r.push(l),i+=h}return function(e){var t=e.length;if(t<=4096)return String.fromCharCode.apply(String,e);var n="",r=0;for(;r0&&(e=this.toString("hex",0,n).match(/.{2}/g).join(" "),this.length>n&&(e+=" ... ")),""},u.prototype.compare=function(e,t,n,r,i){if(!u.isBuffer(e))throw new TypeError("Argument must be a Buffer");if(void 0===t&&(t=0),void 0===n&&(n=e?e.length:0),void 0===r&&(r=0),void 0===i&&(i=this.length),t<0||n>e.length||r<0||i>this.length)throw new RangeError("out of range index");if(r>=i&&t>=n)return 0;if(r>=i)return-1;if(t>=n)return 1;if(this===e)return 0;for(var s=(i>>>=0)-(r>>>=0),o=(n>>>=0)-(t>>>=0),a=Math.min(s,o),c=this.slice(r,i),l=e.slice(t,n),h=0;hi)&&(n=i),e.length>0&&(n<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");r||(r="utf8");for(var s=!1;;)switch(r){case"hex":return k(this,e,t,n);case"utf8":case"utf-8":return v(this,e,t,n);case"ascii":return w(this,e,t,n);case"latin1":case"binary":return S(this,e,t,n);case"base64":return _(this,e,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return E(this,e,t,n);default:if(s)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),s=!0}},u.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function A(e,t,n){var r="";n=Math.min(e.length,n);for(var i=t;ir)&&(n=r);for(var i="",s=t;sn)throw new RangeError("Trying to access beyond buffer length")}function P(e,t,n,r,i,s){if(!u.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 I(e,t,n,r){t<0&&(t=65535+t+1);for(var i=0,s=Math.min(e.length-n,2);i>>8*(r?i:1-i)}function L(e,t,n,r){t<0&&(t=4294967295+t+1);for(var i=0,s=Math.min(e.length-n,4);i>>8*(r?i:3-i)&255}function M(e,t,n,r,i,s){if(n+r>e.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function B(e,t,n,r,s){return s||M(e,0,n,4),i.write(e,t,n,r,23,4),n+4}function D(e,t,n,r,s){return s||M(e,0,n,8),i.write(e,t,n,r,52,8),n+8}u.prototype.slice=function(e,t){var n,r=this.length;if((e=~~e)<0?(e+=r)<0&&(e=0):e>r&&(e=r),(t=void 0===t?r:~~t)<0?(t+=r)<0&&(t=0):t>r&&(t=r),t0&&(i*=256);)r+=this[e+--t]*i;return r},u.prototype.readUInt8=function(e,t){return t||T(e,1,this.length),this[e]},u.prototype.readUInt16LE=function(e,t){return t||T(e,2,this.length),this[e]|this[e+1]<<8},u.prototype.readUInt16BE=function(e,t){return t||T(e,2,this.length),this[e]<<8|this[e+1]},u.prototype.readUInt32LE=function(e,t){return t||T(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},u.prototype.readUInt32BE=function(e,t){return t||T(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},u.prototype.readIntLE=function(e,t,n){e|=0,t|=0,n||T(e,t,this.length);for(var r=this[e],i=1,s=0;++s=(i*=128)&&(r-=Math.pow(2,8*t)),r},u.prototype.readIntBE=function(e,t,n){e|=0,t|=0,n||T(e,t,this.length);for(var r=t,i=1,s=this[e+--r];r>0&&(i*=256);)s+=this[e+--r]*i;return s>=(i*=128)&&(s-=Math.pow(2,8*t)),s},u.prototype.readInt8=function(e,t){return t||T(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},u.prototype.readInt16LE=function(e,t){t||T(e,2,this.length);var n=this[e]|this[e+1]<<8;return 32768&n?4294901760|n:n},u.prototype.readInt16BE=function(e,t){t||T(e,2,this.length);var n=this[e+1]|this[e]<<8;return 32768&n?4294901760|n:n},u.prototype.readInt32LE=function(e,t){return t||T(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},u.prototype.readInt32BE=function(e,t){return t||T(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},u.prototype.readFloatLE=function(e,t){return t||T(e,4,this.length),i.read(this,e,!0,23,4)},u.prototype.readFloatBE=function(e,t){return t||T(e,4,this.length),i.read(this,e,!1,23,4)},u.prototype.readDoubleLE=function(e,t){return t||T(e,8,this.length),i.read(this,e,!0,52,8)},u.prototype.readDoubleBE=function(e,t){return t||T(e,8,this.length),i.read(this,e,!1,52,8)},u.prototype.writeUIntLE=function(e,t,n,r){(e=+e,t|=0,n|=0,r)||P(this,e,t,n,Math.pow(2,8*n)-1,0);var i=1,s=0;for(this[t]=255&e;++s=0&&(s*=256);)this[t+i]=e/s&255;return t+n},u.prototype.writeUInt8=function(e,t,n){return e=+e,t|=0,n||P(this,e,t,1,255,0),u.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[t]=255&e,t+1},u.prototype.writeUInt16LE=function(e,t,n){return e=+e,t|=0,n||P(this,e,t,2,65535,0),u.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):I(this,e,t,!0),t+2},u.prototype.writeUInt16BE=function(e,t,n){return e=+e,t|=0,n||P(this,e,t,2,65535,0),u.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):I(this,e,t,!1),t+2},u.prototype.writeUInt32LE=function(e,t,n){return e=+e,t|=0,n||P(this,e,t,4,4294967295,0),u.TYPED_ARRAY_SUPPORT?(this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e):L(this,e,t,!0),t+4},u.prototype.writeUInt32BE=function(e,t,n){return e=+e,t|=0,n||P(this,e,t,4,4294967295,0),u.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):L(this,e,t,!1),t+4},u.prototype.writeIntLE=function(e,t,n,r){if(e=+e,t|=0,!r){var i=Math.pow(2,8*n-1);P(this,e,t,n,i-1,-i)}var s=0,o=1,a=0;for(this[t]=255&e;++s>0)-a&255;return t+n},u.prototype.writeIntBE=function(e,t,n,r){if(e=+e,t|=0,!r){var i=Math.pow(2,8*n-1);P(this,e,t,n,i-1,-i)}var s=n-1,o=1,a=0;for(this[t+s]=255&e;--s>=0&&(o*=256);)e<0&&0===a&&0!==this[t+s+1]&&(a=1),this[t+s]=(e/o>>0)-a&255;return t+n},u.prototype.writeInt8=function(e,t,n){return e=+e,t|=0,n||P(this,e,t,1,127,-128),u.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),e<0&&(e=255+e+1),this[t]=255&e,t+1},u.prototype.writeInt16LE=function(e,t,n){return e=+e,t|=0,n||P(this,e,t,2,32767,-32768),u.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):I(this,e,t,!0),t+2},u.prototype.writeInt16BE=function(e,t,n){return e=+e,t|=0,n||P(this,e,t,2,32767,-32768),u.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):I(this,e,t,!1),t+2},u.prototype.writeInt32LE=function(e,t,n){return e=+e,t|=0,n||P(this,e,t,4,2147483647,-2147483648),u.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24):L(this,e,t,!0),t+4},u.prototype.writeInt32BE=function(e,t,n){return e=+e,t|=0,n||P(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),u.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):L(this,e,t,!1),t+4},u.prototype.writeFloatLE=function(e,t,n){return B(this,e,t,!0,n)},u.prototype.writeFloatBE=function(e,t,n){return B(this,e,t,!1,n)},u.prototype.writeDoubleLE=function(e,t,n){return D(this,e,t,!0,n)},u.prototype.writeDoubleBE=function(e,t,n){return D(this,e,t,!1,n)},u.prototype.copy=function(e,t,n,r){if(n||(n=0),r||0===r||(r=this.length),t>=e.length&&(t=e.length),t||(t=0),r>0&&r=this.length)throw new RangeError("sourceStart out of bounds");if(r<0)throw new RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),e.length-t=0;--i)e[i+t]=this[i+n];else if(s<1e3||!u.TYPED_ARRAY_SUPPORT)for(i=0;i>>=0,n=void 0===n?this.length:n>>>0,e||(e=0),"number"==typeof e)for(s=t;s55295&&n<57344){if(!i){if(n>56319){(t-=3)>-1&&s.push(239,191,189);continue}if(o+1===r){(t-=3)>-1&&s.push(239,191,189);continue}i=n;continue}if(n<56320){(t-=3)>-1&&s.push(239,191,189),i=n;continue}n=65536+(i-55296<<10|n-56320)}else i&&(t-=3)>-1&&s.push(239,191,189);if(i=null,n<128){if((t-=1)<0)break;s.push(n)}else if(n<2048){if((t-=2)<0)break;s.push(n>>6|192,63&n|128)}else if(n<65536){if((t-=3)<0)break;s.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;s.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return s}function z(e){return r.toByteArray(function(e){if((e=function(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")}(e).replace(N,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function F(e,t,n,r){for(var i=0;i=t.length||i>=e.length);++i)t[i+n]=e[i];return i}}).call(this,n(3))},function(e,t){var n,r,i=e.exports={};function s(){throw new Error("setTimeout has not been defined")}function o(){throw new Error("clearTimeout has not been defined")}function a(e){if(n===setTimeout)return setTimeout(e,0);if((n===s||!n)&&setTimeout)return n=setTimeout,setTimeout(e,0);try{return n(e,0)}catch(t){try{return n.call(null,e,0)}catch(t){return n.call(this,e,0)}}}!function(){try{n="function"==typeof setTimeout?setTimeout:s}catch(e){n=s}try{r="function"==typeof clearTimeout?clearTimeout:o}catch(e){r=o}}();var u,c=[],l=!1,h=-1;function f(){l&&u&&(l=!1,u.length?c=u.concat(c):h=-1,c.length&&d())}function d(){if(!l){var e=a(f);l=!0;for(var t=c.length;t;){for(u=c,c=[];++h1)for(var n=1;n0&&o.length>i&&!o.warned){o.warned=!0;var u=new Error("Possible EventEmitter memory leak detected. "+o.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");u.name="MaxListenersExceededWarning",u.emitter=e,u.type=t,u.count=o.length,a=u,console&&console.warn&&console.warn(a)}return e}function f(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function d(e,t,n){var r={fired:!1,wrapFn:void 0,target:e,type:t,listener:n},i=f.bind(r);return i.listener=n,r.wrapFn=i,i}function p(e,t,n){var r=e._events;if(void 0===r)return[];var i=r[t];return void 0===i?[]:"function"==typeof i?n?[i.listener||i]:[i]:n?function(e){for(var t=new Array(e.length),n=0;n0&&(o=t[0]),o instanceof Error)throw o;var a=new Error("Unhandled error."+(o?" ("+o.message+")":""));throw a.context=o,a}var u=i[e];if(void 0===u)return!1;if("function"==typeof u)s(u,this,t);else{var c=u.length,l=g(u,c);for(n=0;n=0;s--)if(n[s]===t||n[s].listener===t){o=n[s].listener,i=s;break}if(i<0)return this;0===i?n.shift():function(e,t){for(;t+1=0;r--)this.removeListener(e,t[r]);return this},a.prototype.listeners=function(e){return p(this,e,!0)},a.prototype.rawListeners=function(e){return p(this,e,!1)},a.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):b.call(e,t)},a.prototype.listenerCount=b,a.prototype.eventNames=function(){return this._eventsCount>0?r(this._events):[]}},function(e,t,n){"use strict";e.exports={isArray:Array.isArray,assign:Object.assign,isObject:e=>"object"==typeof e,isFunction:e=>"function"==typeof e,isBoolean:e=>"boolean"==typeof e,isRegex:e=>e instanceof RegExp,keys:Object.keys}},function(e,t,n){"use strict";var r=n(14),i=Object.keys||function(e){var t=[];for(var n in e)t.push(n);return t};e.exports=h;var s=Object.create(n(13));s.inherits=n(2);var o=n(26),a=n(29);s.inherits(h,o);for(var u=i(a.prototype),c=0;c2?"one of ".concat(t," ").concat(e.slice(0,n-1).join(", "),", or ")+e[n-1]:2===n?"one of ".concat(t," ").concat(e[0]," or ").concat(e[1]):"of ".concat(t," ").concat(e[0])}return"of ".concat(t," ").concat(String(e))}i("ERR_INVALID_OPT_VALUE",(function(e,t){return'The value "'+t+'" is invalid for option "'+e+'"'}),TypeError),i("ERR_INVALID_ARG_TYPE",(function(e,t,n){var r,i,o,a;if("string"==typeof t&&(i="not ",t.substr(!o||o<0?0:+o,i.length)===i)?(r="must not be",t=t.replace(/^not /,"")):r="must be",function(e,t,n){return(void 0===n||n>e.length)&&(n=e.length),e.substring(n-t.length,n)===t}(e," argument"))a="The ".concat(e," ").concat(r," ").concat(s(t,"type"));else{var u=function(e,t,n){return"number"!=typeof n&&(n=0),!(n+t.length>e.length)&&-1!==e.indexOf(t,n)}(e,".")?"property":"argument";a='The "'.concat(e,'" ').concat(u," ").concat(r," ").concat(s(t,"type"))}return a+=". Received type ".concat(typeof n)}),TypeError),i("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),i("ERR_METHOD_NOT_IMPLEMENTED",(function(e){return"The "+e+" method is not implemented"})),i("ERR_STREAM_PREMATURE_CLOSE","Premature close"),i("ERR_STREAM_DESTROYED",(function(e){return"Cannot call "+e+" after a stream was destroyed"})),i("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),i("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),i("ERR_STREAM_WRITE_AFTER_END","write after end"),i("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),i("ERR_UNKNOWN_ENCODING",(function(e){return"Unknown encoding: "+e}),TypeError),i("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),e.exports.codes=r},function(e,t,n){"use strict";(function(t){var r=Object.keys||function(e){var t=[];for(var n in e)t.push(n);return t};e.exports=c;var i=n(34),s=n(38);n(2)(c,i);for(var o=r(s.prototype),a=0;a 2 bytes.");const n=s.decode(e);if(!t.isValidCode(n))throw new Error("multihash unknown function code: 0x"+n.toString(16));e=e.slice(s.decode.bytes);const i=s.decode(e);if(i<0)throw new Error("multihash invalid length: "+i);if((e=e.slice(s.decode.bytes)).length!==i)throw new Error("multihash length inconsistent: 0x"+e.toString("hex"));return{code:n,name:o.codes[n],length:i,digest:e}},t.encode=function(e,n,i){if(!e||void 0===n)throw new Error("multihash encode requires at least two args: digest, code");const o=t.coerceCode(n);if(!r.isBuffer(e))throw new Error("digest should be a Buffer");if(null==i&&(i=e.length),i&&e.length!==i)throw new Error("digest length should be equal to specified length.");return r.concat([r.from(s.encode(o)),r.from(s.encode(i)),e])},t.coerceCode=function(e){let n=e;if("string"==typeof e){if(void 0===o.names[e])throw new Error("Unrecognized hash function named: "+e);n=o.names[e]}if("number"!=typeof n)throw new Error("Hash function code should be a number. Got: "+n);if(void 0===o.codes[n]&&!t.isAppCode(n))throw new Error("Unrecognized function code: "+n);return n},t.isAppCode=function(e){return e>0&&e<16},t.isValidCode=function(e){return!!t.isAppCode(e)||!!o.codes[e]},t.validate=a,t.prefix=function(e){return a(e),e.slice(0,2)}},function(e){e.exports=JSON.parse('{"identity":0,"ip4":4,"tcp":6,"sha1":17,"sha2-256":18,"sha2-512":19,"sha3-512":20,"sha3-384":21,"sha3-256":22,"sha3-224":23,"shake-128":24,"shake-256":25,"keccak-224":26,"keccak-256":27,"keccak-384":28,"keccak-512":29,"dccp":33,"murmur3-128":34,"murmur3-32":35,"ip6":41,"ip6zone":42,"path":47,"multicodec":48,"multihash":49,"multiaddr":50,"multibase":51,"dns":53,"dns4":54,"dns6":55,"dnsaddr":56,"protobuf":80,"cbor":81,"raw":85,"dbl-sha2-256":86,"rlp":96,"bencode":99,"dag-pb":112,"dag-cbor":113,"libp2p-key":114,"git-raw":120,"torrent-info":123,"torrent-file":124,"leofcoin-block":129,"leofcoin-tx":130,"leofcoin-pr":131,"sctp":132,"eth-block":144,"eth-block-list":145,"eth-tx-trie":146,"eth-tx":147,"eth-tx-receipt-trie":148,"eth-tx-receipt":149,"eth-state-trie":150,"eth-account-snapshot":151,"eth-storage-trie":152,"bitcoin-block":176,"bitcoin-tx":177,"zcash-block":192,"zcash-tx":193,"stellar-block":208,"stellar-tx":209,"md4":212,"md5":213,"bmt":214,"decred-block":224,"decred-tx":225,"ipld-ns":226,"ipfs-ns":227,"swarm-ns":228,"ipns-ns":229,"zeronet":230,"ed25519-pub":237,"dash-block":240,"dash-tx":241,"swarm-manifest":250,"swarm-feed":251,"udp":273,"p2p-webrtc-star":275,"p2p-webrtc-direct":276,"p2p-stardust":277,"p2p-circuit":290,"dag-json":297,"udt":301,"utp":302,"unix":400,"p2p":421,"ipfs":421,"https":443,"onion":444,"onion3":445,"garlic64":446,"garlic32":447,"tls":448,"quic":460,"ws":477,"wss":478,"p2p-websocket-star":479,"http":480,"json":512,"messagepack":513,"x11":4352,"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":46000,"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,"holochain-adr-v0":8417572,"holochain-adr-v1":8483108,"holochain-key-v0":9728292,"holochain-key-v1":9793828,"holochain-sig-v0":10645796,"holochain-sig-v1":10711332}')},function(e,t,n){"use strict";const r=n(17),i=n(16),{Buffer:s}=n(0);e.exports=i(class{constructor(e,t,n){if(!n)throw new Error("A link requires a cid to point to");this._name=e||"",this._nameBuf=null,this._size=t,this._cid=new r(n)}toString(){return`DAGLink <${this._cid.toBaseEncodedString()} - name: "${this.Name}", size: ${this.Tsize}>`}toJSON(){return this._json||(this._json=Object.freeze({name:this.Name,size:this.Tsize,cid:this.Hash.toBaseEncodedString()})),Object.assign({},this._json)}get Name(){return this._name}get nameAsBuffer(){return null!==this._nameBuf||(this._nameBuf=s.from(this._name)),this._nameBuf}set Name(e){throw new Error("Can't set property: 'name' is immutable")}get Tsize(){return this._size}set Tsize(e){throw new Error("Can't set property: 'size' is immutable")}get Hash(){return this._cid}set Hash(e){throw new Error("Can't set property: 'cid' is immutable")}},{className:"DAGLink",symbolName:"@ipld/js-ipld-dag-pb/daglink"})},function(e,t,n){(function(e){function n(e){return Object.prototype.toString.call(e)}t.isArray=function(e){return Array.isArray?Array.isArray(e):"[object Array]"===n(e)},t.isBoolean=function(e){return"boolean"==typeof e},t.isNull=function(e){return null===e},t.isNullOrUndefined=function(e){return null==e},t.isNumber=function(e){return"number"==typeof e},t.isString=function(e){return"string"==typeof e},t.isSymbol=function(e){return"symbol"==typeof e},t.isUndefined=function(e){return void 0===e},t.isRegExp=function(e){return"[object RegExp]"===n(e)},t.isObject=function(e){return"object"==typeof e&&null!==e},t.isDate=function(e){return"[object Date]"===n(e)},t.isError=function(e){return"[object Error]"===n(e)||e instanceof Error},t.isFunction=function(e){return"function"==typeof e},t.isPrimitive=function(e){return null===e||"boolean"==typeof e||"number"==typeof e||"string"==typeof e||"symbol"==typeof e||void 0===e},t.isBuffer=e.isBuffer}).call(this,n(0).Buffer)},function(e,t,n){"use strict";(function(t){void 0===t||!t.version||0===t.version.indexOf("v0.")||0===t.version.indexOf("v1.")&&0!==t.version.indexOf("v1.8.")?e.exports={nextTick:function(e,n,r,i){if("function"!=typeof e)throw new TypeError('"callback" argument must be a function');var s,o,a=arguments.length;switch(a){case 0:case 1:return t.nextTick(e);case 2:return t.nextTick((function(){e.call(null,n)}));case 3:return t.nextTick((function(){e.call(null,n,r)}));case 4:return t.nextTick((function(){e.call(null,n,r,i)}));default:for(s=new Array(a-1),o=0;o>5==6?2:e>>4==14?3:e>>3==30?4:e>>6==2?-1:-2}function a(e){var t=this.lastTotal-this.lastNeed,n=function(e,t,n){if(128!=(192&t[0]))return e.lastNeed=0,"�";if(e.lastNeed>1&&t.length>1){if(128!=(192&t[1]))return e.lastNeed=1,"�";if(e.lastNeed>2&&t.length>2&&128!=(192&t[2]))return e.lastNeed=2,"�"}}(this,e);return void 0!==n?n:this.lastNeed<=e.length?(e.copy(this.lastChar,t,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal)):(e.copy(this.lastChar,t,0,e.length),void(this.lastNeed-=e.length))}function u(e,t){if((e.length-t)%2==0){var n=e.toString("utf16le",t);if(n){var r=n.charCodeAt(n.length-1);if(r>=55296&&r<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1],n.slice(0,-1)}return n}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=e[e.length-1],e.toString("utf16le",t,e.length-1)}function c(e){var t=e&&e.length?this.write(e):"";if(this.lastNeed){var n=this.lastTotal-this.lastNeed;return t+this.lastChar.toString("utf16le",0,n)}return t}function l(e,t){var n=(e.length-t)%3;return 0===n?e.toString("base64",t):(this.lastNeed=3-n,this.lastTotal=3,1===n?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-n))}function h(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+this.lastChar.toString("base64",0,3-this.lastNeed):t}function f(e){return e.toString(this.encoding)}function d(e){return e&&e.length?this.write(e):""}t.StringDecoder=s,s.prototype.write=function(e){if(0===e.length)return"";var t,n;if(this.lastNeed){if(void 0===(t=this.fillLast(e)))return"";n=this.lastNeed,this.lastNeed=0}else n=0;return n=0)return i>0&&(e.lastNeed=i-1),i;if(--r=0)return i>0&&(e.lastNeed=i-2),i;if(--r=0)return i>0&&(2===i?i=0:e.lastNeed=i-3),i;return 0}(this,e,t);if(!this.lastNeed)return e.toString("utf8",t);this.lastTotal=n;var r=e.length-(n-this.lastNeed);return e.copy(this.lastChar,0,r),e.toString("utf8",t,r)},s.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,n){"use strict";e.exports=function(e,{className:t,symbolName:n}){const r=Symbol.for(n),i={[t]:class extends e{constructor(...e){super(...e),Object.defineProperty(this,r,{value:!0})}get[Symbol.toStringTag](){return t}}}[t];return i["is"+t]=e=>!(!e||!e[r]),i},e.exports.proto=function(e,{className:t,symbolName:n,withoutNew:r}){const i=Symbol.for(n),s={[t]:function(...t){if(r&&!(this instanceof s))return new s(...t);const n=e.call(this,...t)||this;return n&&!n[i]&&Object.defineProperty(n,i,{value:!0}),n}}[t];return s.prototype=Object.create(e.prototype),s.prototype.constructor=s,Object.defineProperty(s.prototype,Symbol.toStringTag,{get:()=>t}),s["is"+t]=e=>!(!e||!e[i]),s}},function(e,t,n){"use strict";const{Buffer:r}=n(0),i=n(10),s=n(44),o=n(23),a=n(11),u=n(120),c=n(16);class l{constructor(e,t,n,a){if(h.isCID(e)){const t=e;return this.version=t.version,this.codec=t.codec,this.multihash=r.from(t.multihash),void(this.multibaseName=t.multibaseName||(0===t.version?"base58btc":"base32"))}if("string"==typeof e){const t=s.isEncoded(e);if(t){const n=s.decode(e);this.version=parseInt(n.slice(0,1).toString("hex"),16),this.codec=o.getCodec(n.slice(1)),this.multihash=o.rmPrefix(n.slice(1)),this.multibaseName=t}else this.version=0,this.codec="dag-pb",this.multihash=i.fromB58String(e),this.multibaseName="base58btc";return l.validateCID(this),void Object.defineProperty(this,"string",{value:e})}if(r.isBuffer(e)){const t=e.slice(0,1),n=parseInt(t.toString("hex"),16);if(1===n){const t=e;this.version=n,this.codec=o.getCodec(t.slice(1)),this.multihash=o.rmPrefix(t.slice(1)),this.multibaseName="base32"}else this.version=0,this.codec="dag-pb",this.multihash=e,this.multibaseName="base58btc";l.validateCID(this)}else this.version=e,this.codec=t,this.multihash=n,this.multibaseName=a||(0===e?"base58btc":"base32"),l.validateCID(this)}get buffer(){let e=this._buffer;if(!e){if(0===this.version)e=this.multihash;else{if(1!==this.version)throw new Error("unsupported version");e=r.concat([r.from("01","hex"),o.getCodeVarint(this.codec),this.multihash])}Object.defineProperty(this,"_buffer",{value:e})}return e}get prefix(){return r.concat([r.from("0"+this.version,"hex"),o.getCodeVarint(this.codec),i.prefix(this.multihash)])}toV0(){if("dag-pb"!==this.codec)throw new Error("Cannot convert a non dag-pb CID to CIDv0");const{name:e,length:t}=i.decode(this.multihash);if("sha2-256"!==e)throw new Error("Cannot convert non sha2-256 multihash CID to CIDv0");if(32!==t)throw new Error("Cannot convert non 32 byte multihash CID to CIDv0");return new h(0,this.codec,this.multihash)}toV1(){return new h(1,this.codec,this.multihash)}toBaseEncodedString(e=this.multibaseName){if(this.string&&e===this.multibaseName)return this.string;let t=null;if(0===this.version){if("base58btc"!==e)throw new Error("not supported with CIDv0, to support different bases, please migrate the instance do CIDv1, you can do that through cid.toV1()");t=i.toB58String(this.multihash)}else{if(1!==this.version)throw new Error("unsupported version");t=s.encode(e,this.buffer).toString()}return e===this.multibaseName&&Object.defineProperty(this,"string",{value:t}),t}[Symbol.for("nodejs.util.inspect.custom")](){return"CID("+this.toString()+")"}toString(e){return this.toBaseEncodedString(e)}toJSON(){return{codec:this.codec,version:this.version,hash:this.multihash}}equals(e){return this.codec===e.codec&&this.version===e.version&&this.multihash.equals(e.multihash)}static validateCID(e){const t=u.checkCIDComponents(e);if(t)throw new Error(t)}}const h=c(l,{className:"CID",symbolName:"@ipld/js-cid/CID"});h.codecs=a,e.exports=h},function(e,t,n){var r=n(0),i=r.Buffer;function s(e,t){for(var n in e)t[n]=e[n]}function o(e,t,n){return i(e,t,n)}i.from&&i.alloc&&i.allocUnsafe&&i.allocUnsafeSlow?e.exports=r:(s(r,t),t.Buffer=o),s(i,o),o.from=function(e,t,n){if("number"==typeof e)throw new TypeError("Argument must not be a number");return i(e,t,n)},o.alloc=function(e,t,n){if("number"!=typeof e)throw new TypeError("Argument must be a number");var r=i(e);return void 0!==t?"string"==typeof n?r.fill(t,n):r.fill(t):r.fill(0),r},o.allocUnsafe=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return i(e)},o.allocUnsafeSlow=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return r.SlowBuffer(e)}},function(e,t,n){"use strict";var r=n(8).codes.ERR_STREAM_PREMATURE_CLOSE;function i(){}e.exports=function e(t,n,s){if("function"==typeof n)return e(t,null,n);n||(n={}),s=function(e){var t=!1;return function(){if(!t){t=!0;for(var n=arguments.length,r=new Array(n),i=0;inew Error("Ipfs instance not defined"),u=["next","refs"],c=e=>0===e?"dag-pb":"dag-cbor",l=e=>h.isEntry(e)?c(e.v):c(e);class h{static async create(e,t,n,s,o=[],u,c=[],l){if(!i(e))throw a();if(!i(t))throw new Error("Identity is required, cannot create entry");if(!i(n))throw new Error("Entry requires an id");if(!i(s))throw new Error("Entry requires data");if(!i(o)||!Array.isArray(o))throw new Error("'next' argument is not an array");const f={hash:null,id:n,payload:s,next:o.filter(i).map(e=>e.hash?e.hash:e),refs:c,v:2,clock:u||new r(t.publicKey)},d=await t.provider.sign(t,h.toBuffer(f));return f.key=t.publicKey,f.identity=t.toJSON(),f.sig=d,f.hash=await h.toMultihash(e,f,l),f}static async verify(e,t){if(!e)throw new Error("Identity-provider is required, cannot verify entry");if(!h.isEntry(t))throw new Error("Invalid Log entry");if(!t.key)throw new Error("Entry doesn't have a key");if(!t.sig)throw new Error("Entry doesn't have a signature");const n=h.toEntry(t,{presigned:!0}),r=t.v<1?"v0":"v1";return e.verify(t.sig,t.key,h.toBuffer(n),r)}static toBuffer(e){const n=0===e.v?JSON.stringify(e):o(e);return t.from(n)}static async toMultihash(e,t,n=!1){if(!e)throw a();if(!h.isEntry(t))throw new Error("Invalid object format, cannot generate entry hash");const r=h.toEntry(t);return s.write(e,l(r.v),r,{links:u,pin:n})}static toEntry(e,{presigned:t=!1,includeHash:n=!1}={}){const i={hash:n?e.hash:null,id:e.id,payload:e.payload,next:e.next},s=e.v;return s>1&&(i.refs=e.refs),i.v=e.v,i.clock=new r(e.clock.id,e.clock.time),t||(i.key=e.key,s>0&&(i.identity=e.identity),i.sig=e.sig),i}static async fromMultihash(e,t){if(!e)throw a();if(!t)throw new Error("Invalid hash: "+t);const n=await s.read(e,t,{links:u}),r=h.toEntry(n);return r.hash=t,r}static isEntry(e){return e&&void 0!==e.id&&void 0!==e.next&&void 0!==e.payload&&void 0!==e.v&&void 0!==e.hash&&void 0!==e.clock&&(void 0!==e.refs||e.v<2)}static compare(e,t){var n=r.compare(e.clock,t.clock);return 0===n?e.clock.id-1}static findChildren(e,t){for(var n=[],r=t.find(t=>h.isParent(e,t)),i=e;r;)n.push(r),i=r,r=t.find(e=>h.isParent(i,e));return n=n.sort((e,t)=>e.clock.time>t.clock.time)}}e.exports=h,e.exports.IPLD_LINKS=u,e.exports.getWriteFormat=l}).call(this,n(0).Buffer)},function(e,t,n){"use strict";class r{constructor(e,t){this.id=e,this.time=t||0}tick(){return new r(this.id,++this.time)}merge(e){return this.time=Math.max(this.time,e.time),new r(this.id,this.time)}clone(){return new r(this.id,this.time)}static compare(e,t){var n=e.time-t.time;return 0===n&&e.id!==t.id?e.id{let n;if(r.isBuffer(e))n=a.varintBufferEncode(e);else{if(!o[e])throw new Error("multicodec not recognized");n=o[e]}return r.concat([n,t])},t.rmPrefix=e=>(i.decode(e),e.slice(i.decode.bytes)),t.getCodec=e=>{const t=i.decode(e),n=s.get(t);if(void 0===n)throw new Error(`Code ${t} not found`);return n},t.getName=e=>s.get(e),t.getNumber=e=>{const t=o[e];if(void 0===t)throw new Error("Codec `"+e+"` not found");return a.varintBufferDecode(t)[0]},t.getCode=e=>i.decode(e),t.getCodeVarint=e=>{const t=o[e];if(void 0===t)throw new Error("Codec `"+e+"` not found");return t},t.getVarint=e=>i.encode(e);const u=n(114);Object.assign(t,u),t.print=n(115)},function(e,t,n){"use strict";t.defined=function(e){return null!=e&&("number"!=typeof e||!isNaN(e))}},function(e,t){var n={}.toString;e.exports=Array.isArray||function(e){return"[object Array]"==n.call(e)}},function(e,t,n){"use strict";(function(t,r){var i=n(14);e.exports=k;var s,o=n(25);k.ReadableState=m;n(5).EventEmitter;var a=function(e,t){return e.listeners(t).length},u=n(27),c=n(18).Buffer,l=t.Uint8Array||function(){};var h=Object.create(n(13));h.inherits=n(2);var f=n(64),d=void 0;d=f&&f.debuglog?f.debuglog("stream"):function(){};var p,b=n(65),g=n(28);h.inherits(k,u);var y=["error","close","destroy","pause","resume"];function m(e,t){e=e||{};var r=t instanceof(s=s||n(7));this.objectMode=!!e.objectMode,r&&(this.objectMode=this.objectMode||!!e.readableObjectMode);var i=e.highWaterMark,o=e.readableHighWaterMark,a=this.objectMode?16:16384;this.highWaterMark=i||0===i?i:r&&(o||0===o)?o:a,this.highWaterMark=Math.floor(this.highWaterMark),this.buffer=new b,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&&(p||(p=n(15).StringDecoder),this.decoder=new p(e.encoding),this.encoding=e.encoding)}function k(e){if(s=s||n(7),!(this instanceof k))return new k(e);this._readableState=new m(e,this),this.readable=!0,e&&("function"==typeof e.read&&(this._read=e.read),"function"==typeof e.destroy&&(this._destroy=e.destroy)),u.call(this)}function v(e,t,n,r,i){var s,o=e._readableState;null===t?(o.reading=!1,function(e,t){if(t.ended)return;if(t.decoder){var n=t.decoder.end();n&&n.length&&(t.buffer.push(n),t.length+=t.objectMode?1:n.length)}t.ended=!0,_(e)}(e,o)):(i||(s=function(e,t){var n;r=t,c.isBuffer(r)||r instanceof l||"string"==typeof t||void 0===t||e.objectMode||(n=new TypeError("Invalid non-string/buffer chunk"));var r;return n}(o,t)),s?e.emit("error",s):o.objectMode||t&&t.length>0?("string"==typeof t||o.objectMode||Object.getPrototypeOf(t)===c.prototype||(t=function(e){return c.from(e)}(t)),r?o.endEmitted?e.emit("error",new Error("stream.unshift() after end event")):w(e,o,t,!0):o.ended?e.emit("error",new Error("stream.push() after EOF")):(o.reading=!1,o.decoder&&!n?(t=o.decoder.write(t),o.objectMode||0!==t.length?w(e,o,t,!1):x(e,o)):w(e,o,t,!1))):r||(o.reading=!1));return function(e){return!e.ended&&(e.needReadable||e.lengtht.highWaterMark&&(t.highWaterMark=function(e){return e>=8388608?e=8388608:(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 _(e){var t=e._readableState;t.needReadable=!1,t.emittedReadable||(d("emitReadable",t.flowing),t.emittedReadable=!0,t.sync?i.nextTick(E,e):E(e))}function E(e){d("emit readable"),e.emit("readable"),j(e)}function x(e,t){t.readingMore||(t.readingMore=!0,i.nextTick(O,e,t))}function O(e,t){for(var n=t.length;!t.reading&&!t.flowing&&!t.ended&&t.length=t.length?(n=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.head.data:t.buffer.concat(t.length),t.buffer.clear()):n=function(e,t,n){var r;es.length?s.length:e;if(o===s.length?i+=s:i+=s.slice(0,e),0===(e-=o)){o===s.length?(++r,n.next?t.head=n.next:t.head=t.tail=null):(t.head=n,n.data=s.slice(o));break}++r}return t.length-=r,i}(e,t):function(e,t){var n=c.allocUnsafe(e),r=t.head,i=1;r.data.copy(n),e-=r.data.length;for(;r=r.next;){var s=r.data,o=e>s.length?s.length:e;if(s.copy(n,n.length-e,0,o),0===(e-=o)){o===s.length?(++i,r.next?t.head=r.next:t.head=t.tail=null):(t.head=r,r.data=s.slice(o));break}++i}return t.length-=i,n}(e,t);return r}(e,t.buffer,t.decoder),n);var n}function T(e){var t=e._readableState;if(t.length>0)throw new Error('"endReadable()" called on non-empty stream');t.endEmitted||(t.ended=!0,i.nextTick(P,t,e))}function P(e,t){e.endEmitted||0!==e.length||(e.endEmitted=!0,t.readable=!1,t.emit("end"))}function I(e,t){for(var n=0,r=e.length;n=t.highWaterMark||t.ended))return d("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?T(this):_(this),null;if(0===(e=S(e,t))&&t.ended)return 0===t.length&&T(this),null;var r,i=t.needReadable;return d("need readable",i),(0===t.length||t.length-e0?C(e,t):null)?(t.needReadable=!0,e=0):t.length-=e,0===t.length&&(t.ended||(t.needReadable=!0),n!==e&&t.ended&&T(this)),null!==r&&this.emit("data",r),r},k.prototype._read=function(e){this.emit("error",new Error("_read() is not implemented"))},k.prototype.pipe=function(e,t){var n=this,s=this._readableState;switch(s.pipesCount){case 0:s.pipes=e;break;case 1:s.pipes=[s.pipes,e];break;default:s.pipes.push(e)}s.pipesCount+=1,d("pipe count=%d opts=%j",s.pipesCount,t);var u=(!t||!1!==t.end)&&e!==r.stdout&&e!==r.stderr?l:k;function c(t,r){d("onunpipe"),t===n&&r&&!1===r.hasUnpiped&&(r.hasUnpiped=!0,d("cleanup"),e.removeListener("close",y),e.removeListener("finish",m),e.removeListener("drain",h),e.removeListener("error",g),e.removeListener("unpipe",c),n.removeListener("end",l),n.removeListener("end",k),n.removeListener("data",b),f=!0,!s.awaitDrain||e._writableState&&!e._writableState.needDrain||h())}function l(){d("onend"),e.end()}s.endEmitted?i.nextTick(u):n.once("end",u),e.on("unpipe",c);var h=function(e){return function(){var t=e._readableState;d("pipeOnDrain",t.awaitDrain),t.awaitDrain&&t.awaitDrain--,0===t.awaitDrain&&a(e,"data")&&(t.flowing=!0,j(e))}}(n);e.on("drain",h);var f=!1;var p=!1;function b(t){d("ondata"),p=!1,!1!==e.write(t)||p||((1===s.pipesCount&&s.pipes===e||s.pipesCount>1&&-1!==I(s.pipes,e))&&!f&&(d("false write response, pause",n._readableState.awaitDrain),n._readableState.awaitDrain++,p=!0),n.pause())}function g(t){d("onerror",t),k(),e.removeListener("error",g),0===a(e,"error")&&e.emit("error",t)}function y(){e.removeListener("finish",m),k()}function m(){d("onfinish"),e.removeListener("close",y),k()}function k(){d("unpipe"),n.unpipe(e)}return n.on("data",b),function(e,t,n){if("function"==typeof e.prependListener)return e.prependListener(t,n);e._events&&e._events[t]?o(e._events[t])?e._events[t].unshift(n):e._events[t]=[n,e._events[t]]:e.on(t,n)}(e,"error",g),e.once("close",y),e.once("finish",m),e.emit("pipe",n),s.flowing||(d("pipe resume"),n.resume()),e},k.prototype.unpipe=function(e){var t=this._readableState,n={hasUnpiped:!1};if(0===t.pipesCount)return this;if(1===t.pipesCount)return e&&e!==t.pipes||(e||(e=t.pipes),t.pipes=null,t.pipesCount=0,t.flowing=!1,e&&e.emit("unpipe",this,n)),this;if(!e){var r=t.pipes,i=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var s=0;s-1?r:s.nextTick;m.WritableState=y;var c=Object.create(n(13));c.inherits=n(2);var l={deprecate:n(30)},h=n(27),f=n(18).Buffer,d=i.Uint8Array||function(){};var p,b=n(28);function g(){}function y(e,t){a=a||n(7),e=e||{};var r=t instanceof a;this.objectMode=!!e.objectMode,r&&(this.objectMode=this.objectMode||!!e.writableObjectMode);var i=e.highWaterMark,c=e.writableHighWaterMark,l=this.objectMode?16:16384;this.highWaterMark=i||0===i?i:r&&(c||0===c)?c:l,this.highWaterMark=Math.floor(this.highWaterMark),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var h=!1===e.decodeStrings;this.decodeStrings=!h,this.defaultEncoding=e.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(e){!function(e,t){var n=e._writableState,r=n.sync,i=n.writecb;if(function(e){e.writing=!1,e.writecb=null,e.length-=e.writelen,e.writelen=0}(n),t)!function(e,t,n,r,i){--t.pendingcb,n?(s.nextTick(i,r),s.nextTick(E,e,t),e._writableState.errorEmitted=!0,e.emit("error",r)):(i(r),e._writableState.errorEmitted=!0,e.emit("error",r),E(e,t))}(e,n,r,t,i);else{var o=S(n);o||n.corked||n.bufferProcessing||!n.bufferedRequest||w(e,n),r?u(v,e,n,o,i):v(e,n,o,i)}}(t,e)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.bufferedRequestCount=0,this.corkedRequestsFree=new o(this)}function m(e){if(a=a||n(7),!(p.call(m,this)||this instanceof a))return new m(e);this._writableState=new y(e,this),this.writable=!0,e&&("function"==typeof e.write&&(this._write=e.write),"function"==typeof e.writev&&(this._writev=e.writev),"function"==typeof e.destroy&&(this._destroy=e.destroy),"function"==typeof e.final&&(this._final=e.final)),h.call(this)}function k(e,t,n,r,i,s,o){t.writelen=r,t.writecb=o,t.writing=!0,t.sync=!0,n?e._writev(i,t.onwrite):e._write(i,s,t.onwrite),t.sync=!1}function v(e,t,n,r){n||function(e,t){0===t.length&&t.needDrain&&(t.needDrain=!1,e.emit("drain"))}(e,t),t.pendingcb--,r(),E(e,t)}function w(e,t){t.bufferProcessing=!0;var n=t.bufferedRequest;if(e._writev&&n&&n.next){var r=t.bufferedRequestCount,i=new Array(r),s=t.corkedRequestsFree;s.entry=n;for(var a=0,u=!0;n;)i[a]=n,n.isBuf||(u=!1),n=n.next,a+=1;i.allBuffers=u,k(e,t,!0,t.length,i,"",s.finish),t.pendingcb++,t.lastBufferedRequest=null,s.next?(t.corkedRequestsFree=s.next,s.next=null):t.corkedRequestsFree=new o(t),t.bufferedRequestCount=0}else{for(;n;){var c=n.chunk,l=n.encoding,h=n.callback;if(k(e,t,!1,t.objectMode?1:c.length,c,l,h),n=n.next,t.bufferedRequestCount--,t.writing)break}null===n&&(t.lastBufferedRequest=null)}t.bufferedRequest=n,t.bufferProcessing=!1}function S(e){return e.ending&&0===e.length&&null===e.bufferedRequest&&!e.finished&&!e.writing}function _(e,t){e._final((function(n){t.pendingcb--,n&&e.emit("error",n),t.prefinished=!0,e.emit("prefinish"),E(e,t)}))}function E(e,t){var n=S(t);return n&&(!function(e,t){t.prefinished||t.finalCalled||("function"==typeof e._final?(t.pendingcb++,t.finalCalled=!0,s.nextTick(_,e,t)):(t.prefinished=!0,e.emit("prefinish")))}(e,t),0===t.pendingcb&&(t.finished=!0,e.emit("finish"))),n}c.inherits(m,h),y.prototype.getBuffer=function(){for(var e=this.bufferedRequest,t=[];e;)t.push(e),e=e.next;return t},function(){try{Object.defineProperty(y.prototype,"buffer",{get:l.deprecate((function(){return this.getBuffer()}),"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch(e){}}(),"function"==typeof Symbol&&Symbol.hasInstance&&"function"==typeof Function.prototype[Symbol.hasInstance]?(p=Function.prototype[Symbol.hasInstance],Object.defineProperty(m,Symbol.hasInstance,{value:function(e){return!!p.call(this,e)||this===m&&(e&&e._writableState instanceof y)}})):p=function(e){return e instanceof this},m.prototype.pipe=function(){this.emit("error",new Error("Cannot pipe, not readable"))},m.prototype.write=function(e,t,n){var r,i=this._writableState,o=!1,a=!i.objectMode&&(r=e,f.isBuffer(r)||r instanceof d);return a&&!f.isBuffer(e)&&(e=function(e){return f.from(e)}(e)),"function"==typeof t&&(n=t,t=null),a?t="buffer":t||(t=i.defaultEncoding),"function"!=typeof n&&(n=g),i.ended?function(e,t){var n=new Error("write after end");e.emit("error",n),s.nextTick(t,n)}(this,n):(a||function(e,t,n,r){var i=!0,o=!1;return null===n?o=new TypeError("May not write null values to stream"):"string"==typeof n||void 0===n||t.objectMode||(o=new TypeError("Invalid non-string/buffer chunk")),o&&(e.emit("error",o),s.nextTick(r,o),i=!1),i}(this,i,e,n))&&(i.pendingcb++,o=function(e,t,n,r,i,s){if(!n){var o=function(e,t,n){e.objectMode||!1===e.decodeStrings||"string"!=typeof t||(t=f.from(t,n));return t}(t,r,i);r!==o&&(n=!0,i="buffer",r=o)}var a=t.objectMode?1:r.length;t.length+=a;var u=t.length-1))throw new TypeError("Unknown encoding: "+e);return this._writableState.defaultEncoding=e,this},Object.defineProperty(m.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),m.prototype._write=function(e,t,n){n(new Error("_write() is not implemented"))},m.prototype._writev=null,m.prototype.end=function(e,t,n){var r=this._writableState;"function"==typeof e?(n=e,e=null,t=null):"function"==typeof t&&(n=t,t=null),null!=e&&this.write(e,t),r.corked&&(r.corked=1,this.uncork()),r.ending||r.finished||function(e,t,n){t.ending=!0,E(e,t),n&&(t.finished?s.nextTick(n):e.once("finish",n));t.ended=!0,e.writable=!1}(this,r,n)},Object.defineProperty(m.prototype,"destroyed",{get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(e){this._writableState&&(this._writableState.destroyed=e)}}),m.prototype.destroy=b.destroy,m.prototype._undestroy=b.undestroy,m.prototype._destroy=function(e,t){this.end(),t(e)}}).call(this,n(1),n(67).setImmediate,n(3))},function(e,t,n){(function(t){function n(e){try{if(!t.localStorage)return!1}catch(e){return!1}var n=t.localStorage[e];return null!=n&&"true"===String(n).toLowerCase()}e.exports=function(e,t){if(n("noDeprecation"))return e;var r=!1;return function(){if(!r){if(n("throwDeprecation"))throw new Error(t);n("traceDeprecation")?console.trace(t):console.warn(t),r=!0}return e.apply(this,arguments)}}}).call(this,n(3))},function(e,t,n){ /*! safe-buffer. MIT License. Feross Aboukhadijeh */ -var r=n(0),i=r.Buffer;function s(e,t){for(var n in e)t[n]=e[n]}function o(e,t,n){return i(e,t,n)}i.from&&i.alloc&&i.allocUnsafe&&i.allocUnsafeSlow?e.exports=r:(s(r,t),t.Buffer=o),o.prototype=Object.create(i.prototype),s(i,o),o.from=function(e,t,n){if("number"==typeof e)throw new TypeError("Argument must not be a number");return i(e,t,n)},o.alloc=function(e,t,n){if("number"!=typeof e)throw new TypeError("Argument must be a number");var r=i(e);return void 0!==t?"string"==typeof n?r.fill(t,n):r.fill(t):r.fill(0),r},o.allocUnsafe=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return i(e)},o.allocUnsafeSlow=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return r.SlowBuffer(e)}},function(e,t,n){"use strict";e.exports=o;var r=n(7),i=Object.create(n(13));function s(e,t){var n=this._transformState;n.transforming=!1;var r=n.writecb;if(!r)return this.emit("error",new Error("write callback called multiple times"));n.writechunk=null,n.writecb=null,null!=t&&this.push(t),r(e);var i=this._readableState;i.reading=!1,(i.needReadable||i.lengthn(),n)},final(e){c.push(u).then(()=>e(),e)}}:{});const h=new l(t);return e.sink&&e.sink({[Symbol.asyncIterator](){return this},async next(){const e=await c.shift();return e===u?{done:!0}:{value:e}},throw:async e=>(h.destroy(e),{done:!0}),return:async()=>(h.destroy(),{done:!0})}),h}}).call(this,n(0).Buffer)},function(e,t,n){"use strict";(function(t,r){var i;e.exports=x,x.ReadableState=E;n(5).EventEmitter;var s=function(e,t){return e.listeners(t).length},o=n(35),a=n(0).Buffer,u=t.Uint8Array||function(){};var c,l=n(73);c=l&&l.debuglog?l.debuglog("stream"):function(){};var h,f,d,p=n(74),b=n(36),g=n(37).getHighWaterMark,y=n(8).codes,m=y.ERR_INVALID_ARG_TYPE,k=y.ERR_STREAM_PUSH_AFTER_EOF,v=y.ERR_METHOD_NOT_IMPLEMENTED,w=y.ERR_STREAM_UNSHIFT_AFTER_END_EVENT;n(2)(x,o);var S=b.errorOrDestroy,_=["error","close","destroy","pause","resume"];function E(e,t,r){i=i||n(9),e=e||{},"boolean"!=typeof r&&(r=t instanceof i),this.objectMode=!!e.objectMode,r&&(this.objectMode=this.objectMode||!!e.readableObjectMode),this.highWaterMark=g(this,e,"readableHighWaterMark",r),this.buffer=new p,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.paused=!0,this.emitClose=!1!==e.emitClose,this.autoDestroy=!!e.autoDestroy,this.destroyed=!1,this.defaultEncoding=e.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,e.encoding&&(h||(h=n(15).StringDecoder),this.decoder=new h(e.encoding),this.encoding=e.encoding)}function x(e){if(i=i||n(9),!(this instanceof x))return new x(e);var t=this instanceof i;this._readableState=new E(e,this,t),this.readable=!0,e&&("function"==typeof e.read&&(this._read=e.read),"function"==typeof e.destroy&&(this._destroy=e.destroy)),o.call(this)}function O(e,t,n,r,i){c("readableAddChunk",t);var s,o=e._readableState;if(null===t)o.reading=!1,function(e,t){if(c("onEofChunk"),t.ended)return;if(t.decoder){var n=t.decoder.end();n&&n.length&&(t.buffer.push(n),t.length+=t.objectMode?1:n.length)}t.ended=!0,t.sync?j(e):(t.needReadable=!1,t.emittedReadable||(t.emittedReadable=!0,C(e)))}(e,o);else if(i||(s=function(e,t){var n;r=t,a.isBuffer(r)||r instanceof u||"string"==typeof t||void 0===t||e.objectMode||(n=new m("chunk",["string","Buffer","Uint8Array"],t));var r;return n}(o,t)),s)S(e,s);else if(o.objectMode||t&&t.length>0)if("string"==typeof t||o.objectMode||Object.getPrototypeOf(t)===a.prototype||(t=function(e){return a.from(e)}(t)),r)o.endEmitted?S(e,new w):A(e,o,t,!0);else if(o.ended)S(e,new k);else{if(o.destroyed)return!1;o.reading=!1,o.decoder&&!n?(t=o.decoder.write(t),o.objectMode||0!==t.length?A(e,o,t,!1):T(e,o)):A(e,o,t,!1)}else r||(o.reading=!1,T(e,o));return!o.ended&&(o.lengtht.highWaterMark&&(t.highWaterMark=function(e){return e>=1073741824?e=1073741824:(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 j(e){var t=e._readableState;c("emitReadable",t.needReadable,t.emittedReadable),t.needReadable=!1,t.emittedReadable||(c("emitReadable",t.flowing),t.emittedReadable=!0,r.nextTick(C,e))}function C(e){var t=e._readableState;c("emitReadable_",t.destroyed,t.length,t.ended),t.destroyed||!t.length&&!t.ended||(e.emit("readable"),t.emittedReadable=!1),t.needReadable=!t.flowing&&!t.ended&&t.length<=t.highWaterMark,B(e)}function T(e,t){t.readingMore||(t.readingMore=!0,r.nextTick(P,e,t))}function P(e,t){for(;!t.reading&&!t.ended&&(t.length0,t.resumeScheduled&&!t.paused?t.flowing=!0:e.listenerCount("data")>0&&e.resume()}function I(e){c("readable nexttick read 0"),e.read(0)}function M(e,t){c("resume",t.reading),t.reading||e.read(0),t.resumeScheduled=!1,e.emit("resume"),B(e),t.flowing&&!t.reading&&e.read(0)}function B(e){var t=e._readableState;for(c("flow",t.flowing);t.flowing&&null!==e.read(););}function D(e,t){return 0===t.length?null:(t.objectMode?n=t.buffer.shift():!e||e>=t.length?(n=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.first():t.buffer.concat(t.length),t.buffer.clear()):n=t.buffer.consume(e,t.decoder),n);var n}function N(e){var t=e._readableState;c("endReadable",t.endEmitted),t.endEmitted||(t.ended=!0,r.nextTick(U,t,e))}function U(e,t){if(c("endReadableNT",e.endEmitted,e.length),!e.endEmitted&&0===e.length&&(e.endEmitted=!0,t.readable=!1,t.emit("end"),e.autoDestroy)){var n=t._writableState;(!n||n.autoDestroy&&n.finished)&&t.destroy()}}function q(e,t){for(var n=0,r=e.length;n=t.highWaterMark:t.length>0)||t.ended))return c("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?N(this):j(this),null;if(0===(e=R(e,t))&&t.ended)return 0===t.length&&N(this),null;var r,i=t.needReadable;return c("need readable",i),(0===t.length||t.length-e0?D(e,t):null)?(t.needReadable=t.length<=t.highWaterMark,e=0):(t.length-=e,t.awaitDrain=0),0===t.length&&(t.ended||(t.needReadable=!0),n!==e&&t.ended&&N(this)),null!==r&&this.emit("data",r),r},x.prototype._read=function(e){S(this,new v("_read()"))},x.prototype.pipe=function(e,t){var n=this,i=this._readableState;switch(i.pipesCount){case 0:i.pipes=e;break;case 1:i.pipes=[i.pipes,e];break;default:i.pipes.push(e)}i.pipesCount+=1,c("pipe count=%d opts=%j",i.pipesCount,t);var o=(!t||!1!==t.end)&&e!==r.stdout&&e!==r.stderr?u:g;function a(t,r){c("onunpipe"),t===n&&r&&!1===r.hasUnpiped&&(r.hasUnpiped=!0,c("cleanup"),e.removeListener("close",p),e.removeListener("finish",b),e.removeListener("drain",l),e.removeListener("error",d),e.removeListener("unpipe",a),n.removeListener("end",u),n.removeListener("end",g),n.removeListener("data",f),h=!0,!i.awaitDrain||e._writableState&&!e._writableState.needDrain||l())}function u(){c("onend"),e.end()}i.endEmitted?r.nextTick(o):n.once("end",o),e.on("unpipe",a);var l=function(e){return function(){var t=e._readableState;c("pipeOnDrain",t.awaitDrain),t.awaitDrain&&t.awaitDrain--,0===t.awaitDrain&&s(e,"data")&&(t.flowing=!0,B(e))}}(n);e.on("drain",l);var h=!1;function f(t){c("ondata");var r=e.write(t);c("dest.write",r),!1===r&&((1===i.pipesCount&&i.pipes===e||i.pipesCount>1&&-1!==q(i.pipes,e))&&!h&&(c("false write response, pause",i.awaitDrain),i.awaitDrain++),n.pause())}function d(t){c("onerror",t),g(),e.removeListener("error",d),0===s(e,"error")&&S(e,t)}function p(){e.removeListener("finish",b),g()}function b(){c("onfinish"),e.removeListener("close",p),g()}function g(){c("unpipe"),n.unpipe(e)}return n.on("data",f),function(e,t,n){if("function"==typeof e.prependListener)return e.prependListener(t,n);e._events&&e._events[t]?Array.isArray(e._events[t])?e._events[t].unshift(n):e._events[t]=[n,e._events[t]]:e.on(t,n)}(e,"error",d),e.once("close",p),e.once("finish",b),e.emit("pipe",n),i.flowing||(c("pipe resume"),n.resume()),e},x.prototype.unpipe=function(e){var t=this._readableState,n={hasUnpiped:!1};if(0===t.pipesCount)return this;if(1===t.pipesCount)return e&&e!==t.pipes||(e||(e=t.pipes),t.pipes=null,t.pipesCount=0,t.flowing=!1,e&&e.emit("unpipe",this,n)),this;if(!e){var r=t.pipes,i=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var s=0;s0,!1!==i.flowing&&this.resume()):"readable"===e&&(i.endEmitted||i.readableListening||(i.readableListening=i.needReadable=!0,i.flowing=!1,i.emittedReadable=!1,c("on readable",i.length,i.reading),i.length?j(this):i.reading||r.nextTick(I,this))),n},x.prototype.addListener=x.prototype.on,x.prototype.removeListener=function(e,t){var n=o.prototype.removeListener.call(this,e,t);return"readable"===e&&r.nextTick(L,this),n},x.prototype.removeAllListeners=function(e){var t=o.prototype.removeAllListeners.apply(this,arguments);return"readable"!==e&&void 0!==e||r.nextTick(L,this),t},x.prototype.resume=function(){var e=this._readableState;return e.flowing||(c("resume"),e.flowing=!e.readableListening,function(e,t){t.resumeScheduled||(t.resumeScheduled=!0,r.nextTick(M,e,t))}(this,e)),e.paused=!1,this},x.prototype.pause=function(){return c("call pause flowing=%j",this._readableState.flowing),!1!==this._readableState.flowing&&(c("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this},x.prototype.wrap=function(e){var t=this,n=this._readableState,r=!1;for(var i in e.on("end",(function(){if(c("wrapped end"),n.decoder&&!n.ended){var e=n.decoder.end();e&&e.length&&t.push(e)}t.push(null)})),e.on("data",(function(i){(c("wrapped data"),n.decoder&&(i=n.decoder.write(i)),n.objectMode&&null==i)||(n.objectMode||i&&i.length)&&(t.push(i)||(r=!0,e.pause()))})),e)void 0===this[i]&&"function"==typeof e[i]&&(this[i]=function(t){return function(){return e[t].apply(e,arguments)}}(i));for(var s=0;s<_.length;s++)e.on(_[s],this.emit.bind(this,_[s]));return this._read=function(t){c("wrapped _read",t),r&&(r=!1,e.resume())},this},"function"==typeof Symbol&&(x.prototype[Symbol.asyncIterator]=function(){return void 0===f&&(f=n(76)),f(this)}),Object.defineProperty(x.prototype,"readableHighWaterMark",{enumerable:!1,get:function(){return this._readableState.highWaterMark}}),Object.defineProperty(x.prototype,"readableBuffer",{enumerable:!1,get:function(){return this._readableState&&this._readableState.buffer}}),Object.defineProperty(x.prototype,"readableFlowing",{enumerable:!1,get:function(){return this._readableState.flowing},set:function(e){this._readableState&&(this._readableState.flowing=e)}}),x._fromList=D,Object.defineProperty(x.prototype,"readableLength",{enumerable:!1,get:function(){return this._readableState.length}}),"function"==typeof Symbol&&(x.from=function(e,t){return void 0===d&&(d=n(77)),d(x,e,t)})}).call(this,n(3),n(1))},function(e,t,n){e.exports=n(5).EventEmitter},function(e,t,n){"use strict";(function(t){function n(e,t){i(e,t),r(e)}function r(e){e._writableState&&!e._writableState.emitClose||e._readableState&&!e._readableState.emitClose||e.emit("close")}function i(e,t){e.emit("error",t)}e.exports={destroy:function(e,s){var o=this,a=this._readableState&&this._readableState.destroyed,u=this._writableState&&this._writableState.destroyed;return a||u?(s?s(e):e&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,t.nextTick(i,this,e)):t.nextTick(i,this,e)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(e||null,(function(e){!s&&e?o._writableState?o._writableState.errorEmitted?t.nextTick(r,o):(o._writableState.errorEmitted=!0,t.nextTick(n,o,e)):t.nextTick(n,o,e):s?(t.nextTick(r,o),s(e)):t.nextTick(r,o)})),this)},undestroy:function(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)},errorOrDestroy:function(e,t){var n=e._readableState,r=e._writableState;n&&n.autoDestroy||r&&r.autoDestroy?e.destroy(t):e.emit("error",t)}}}).call(this,n(1))},function(e,t,n){"use strict";var r=n(8).codes.ERR_INVALID_OPT_VALUE;e.exports={getHighWaterMark:function(e,t,n,i){var s=function(e,t,n){return null!=e.highWaterMark?e.highWaterMark:t?e[n]:null}(t,i,n);if(null!=s){if(!isFinite(s)||Math.floor(s)!==s||s<0)throw new r(i?n:"highWaterMark",s);return Math.floor(s)}return e.objectMode?16:16384}}},function(e,t,n){"use strict";(function(t,r){function i(e){var t=this;this.next=null,this.entry=null,this.finish=function(){!function(e,t,n){var r=e.entry;e.entry=null;for(;r;){var i=r.callback;t.pendingcb--,i(n),r=r.next}t.corkedRequestsFree.next=e}(t,e)}}var s;e.exports=x,x.WritableState=E;var o={deprecate:n(30)},a=n(35),u=n(0).Buffer,c=t.Uint8Array||function(){};var l,h=n(36),f=n(37).getHighWaterMark,d=n(8).codes,p=d.ERR_INVALID_ARG_TYPE,b=d.ERR_METHOD_NOT_IMPLEMENTED,g=d.ERR_MULTIPLE_CALLBACK,y=d.ERR_STREAM_CANNOT_PIPE,m=d.ERR_STREAM_DESTROYED,k=d.ERR_STREAM_NULL_VALUES,v=d.ERR_STREAM_WRITE_AFTER_END,w=d.ERR_UNKNOWN_ENCODING,S=h.errorOrDestroy;function _(){}function E(e,t,o){s=s||n(9),e=e||{},"boolean"!=typeof o&&(o=t instanceof s),this.objectMode=!!e.objectMode,o&&(this.objectMode=this.objectMode||!!e.writableObjectMode),this.highWaterMark=f(this,e,"writableHighWaterMark",o),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var a=!1===e.decodeStrings;this.decodeStrings=!a,this.defaultEncoding=e.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(e){!function(e,t){var n=e._writableState,i=n.sync,s=n.writecb;if("function"!=typeof s)throw new g;if(function(e){e.writing=!1,e.writecb=null,e.length-=e.writelen,e.writelen=0}(n),t)!function(e,t,n,i,s){--t.pendingcb,n?(r.nextTick(s,i),r.nextTick(T,e,t),e._writableState.errorEmitted=!0,S(e,i)):(s(i),e._writableState.errorEmitted=!0,S(e,i),T(e,t))}(e,n,i,t,s);else{var o=j(n)||e.destroyed;o||n.corked||n.bufferProcessing||!n.bufferedRequest||R(e,n),i?r.nextTick(A,e,n,o,s):A(e,n,o,s)}}(t,e)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=!1!==e.emitClose,this.autoDestroy=!!e.autoDestroy,this.bufferedRequestCount=0,this.corkedRequestsFree=new i(this)}function x(e){var t=this instanceof(s=s||n(9));if(!t&&!l.call(x,this))return new x(e);this._writableState=new E(e,this,t),this.writable=!0,e&&("function"==typeof e.write&&(this._write=e.write),"function"==typeof e.writev&&(this._writev=e.writev),"function"==typeof e.destroy&&(this._destroy=e.destroy),"function"==typeof e.final&&(this._final=e.final)),a.call(this)}function O(e,t,n,r,i,s,o){t.writelen=r,t.writecb=o,t.writing=!0,t.sync=!0,t.destroyed?t.onwrite(new m("write")):n?e._writev(i,t.onwrite):e._write(i,s,t.onwrite),t.sync=!1}function A(e,t,n,r){n||function(e,t){0===t.length&&t.needDrain&&(t.needDrain=!1,e.emit("drain"))}(e,t),t.pendingcb--,r(),T(e,t)}function R(e,t){t.bufferProcessing=!0;var n=t.bufferedRequest;if(e._writev&&n&&n.next){var r=t.bufferedRequestCount,s=new Array(r),o=t.corkedRequestsFree;o.entry=n;for(var a=0,u=!0;n;)s[a]=n,n.isBuf||(u=!1),n=n.next,a+=1;s.allBuffers=u,O(e,t,!0,t.length,s,"",o.finish),t.pendingcb++,t.lastBufferedRequest=null,o.next?(t.corkedRequestsFree=o.next,o.next=null):t.corkedRequestsFree=new i(t),t.bufferedRequestCount=0}else{for(;n;){var c=n.chunk,l=n.encoding,h=n.callback;if(O(e,t,!1,t.objectMode?1:c.length,c,l,h),n=n.next,t.bufferedRequestCount--,t.writing)break}null===n&&(t.lastBufferedRequest=null)}t.bufferedRequest=n,t.bufferProcessing=!1}function j(e){return e.ending&&0===e.length&&null===e.bufferedRequest&&!e.finished&&!e.writing}function C(e,t){e._final((function(n){t.pendingcb--,n&&S(e,n),t.prefinished=!0,e.emit("prefinish"),T(e,t)}))}function T(e,t){var n=j(t);if(n&&(function(e,t){t.prefinished||t.finalCalled||("function"!=typeof e._final||t.destroyed?(t.prefinished=!0,e.emit("prefinish")):(t.pendingcb++,t.finalCalled=!0,r.nextTick(C,e,t)))}(e,t),0===t.pendingcb&&(t.finished=!0,e.emit("finish"),t.autoDestroy))){var i=e._readableState;(!i||i.autoDestroy&&i.endEmitted)&&e.destroy()}return n}n(2)(x,a),E.prototype.getBuffer=function(){for(var e=this.bufferedRequest,t=[];e;)t.push(e),e=e.next;return t},function(){try{Object.defineProperty(E.prototype,"buffer",{get:o.deprecate((function(){return this.getBuffer()}),"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch(e){}}(),"function"==typeof Symbol&&Symbol.hasInstance&&"function"==typeof Function.prototype[Symbol.hasInstance]?(l=Function.prototype[Symbol.hasInstance],Object.defineProperty(x,Symbol.hasInstance,{value:function(e){return!!l.call(this,e)||this===x&&(e&&e._writableState instanceof E)}})):l=function(e){return e instanceof this},x.prototype.pipe=function(){S(this,new y)},x.prototype.write=function(e,t,n){var i,s=this._writableState,o=!1,a=!s.objectMode&&(i=e,u.isBuffer(i)||i instanceof c);return a&&!u.isBuffer(e)&&(e=function(e){return u.from(e)}(e)),"function"==typeof t&&(n=t,t=null),a?t="buffer":t||(t=s.defaultEncoding),"function"!=typeof n&&(n=_),s.ending?function(e,t){var n=new v;S(e,n),r.nextTick(t,n)}(this,n):(a||function(e,t,n,i){var s;return null===n?s=new k:"string"==typeof n||t.objectMode||(s=new p("chunk",["string","Buffer"],n)),!s||(S(e,s),r.nextTick(i,s),!1)}(this,s,e,n))&&(s.pendingcb++,o=function(e,t,n,r,i,s){if(!n){var o=function(e,t,n){e.objectMode||!1===e.decodeStrings||"string"!=typeof t||(t=u.from(t,n));return t}(t,r,i);r!==o&&(n=!0,i="buffer",r=o)}var a=t.objectMode?1:r.length;t.length+=a;var c=t.length-1))throw new w(e);return this._writableState.defaultEncoding=e,this},Object.defineProperty(x.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(x.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),x.prototype._write=function(e,t,n){n(new b("_write()"))},x.prototype._writev=null,x.prototype.end=function(e,t,n){var i=this._writableState;return"function"==typeof e?(n=e,e=null,t=null):"function"==typeof t&&(n=t,t=null),null!=e&&this.write(e,t),i.corked&&(i.corked=1,this.uncork()),i.ending||function(e,t,n){t.ending=!0,T(e,t),n&&(t.finished?r.nextTick(n):e.once("finish",n));t.ended=!0,e.writable=!1}(this,i,n),this},Object.defineProperty(x.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(x.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(e){this._writableState&&(this._writableState.destroyed=e)}}),x.prototype.destroy=h.destroy,x.prototype._undestroy=h.undestroy,x.prototype._destroy=function(e,t){t(e)}}).call(this,n(3),n(1))},function(e,t,n){"use strict";e.exports=l;var r=n(8).codes,i=r.ERR_METHOD_NOT_IMPLEMENTED,s=r.ERR_MULTIPLE_CALLBACK,o=r.ERR_TRANSFORM_ALREADY_TRANSFORMING,a=r.ERR_TRANSFORM_WITH_LENGTH_0,u=n(9);function c(e,t){var n=this._transformState;n.transforming=!1;var r=n.writecb;if(null===r)return this.emit("error",new s);n.writechunk=null,n.writecb=null,null!=t&&this.push(t),r(e);var i=this._readableState;i.reading=!1,(i.needReadable||i.length{const e={};return e.promise=new Promise((t,n)=>{e.resolve=t,e.reject=n}),e}},function(e,t,n){"use strict";(function(t){const r=n(42),i=n(92),s=n(20),o=n(151),a=n(57),u=n(21),c=n(56),{LastWriteWins:l,NoZeroes:h}=c,f=n(154),{isDefined:d,findUniques:p}=n(22),b=n(155),g=e=>e.hash,y=(e,t)=>e.concat(t),m=e=>e.next,k=(e,t)=>Math.max(e,t.clock.time),v=(e,t)=>(e[t.hash]=t,e);class w extends i{constructor(e,t,{logId:n,access:r,entries:i,heads:s,clock:o,sortFn:c,concurrency:p}={}){if(!d(e))throw a.IPFSNotDefinedError();if(!d(t))throw new Error("Identity is required");if(d(r)||(r=new f),d(i)&&!Array.isArray(i))throw new Error("'entries' argument must be an array of Entry instances");if(d(s)&&!Array.isArray(s))throw new Error("'heads' argument must be an array");d(c)||(c=l),super(),this._sortFn=h(c),this._storage=e,this._id=n||(new Date).getTime().toString(),this._access=r,this._identity=t;const g=(i||[]).reduce(v,{});this._entryIndex=new b(g),i=Object.values(g)||[],s=s||w.findHeads(i),this._headsIndex=s.reduce(v,{}),this._nextsIndex={};i.forEach(e=>e.next.forEach(t=>this._nextsIndex[t]=e.hash)),this._length=i.length;const y=Math.max(o?o.time:0,this.heads.reduce(k,0));this._clock=new u(this._identity.publicKey,y),this.joinConcurrency=p||16}get id(){return this._id}get clock(){return this._clock}get length(){return this._length}get values(){return Object.values(this.traverse(this.heads)).reverse()}get heads(){return Object.values(this._headsIndex).sort(this._sortFn).reverse()}get tails(){return w.findTails(this.values)}get tailHashes(){return w.findTailHashes(this.values)}setIdentity(e){this._identity=e;const t=Math.max(this.clock.time,this.heads.reduce(k,0));this._clock=new u(this._identity.publicKey,t)}get(e){return this._entryIndex.get(e)}has(e){return void 0!==this._entryIndex.get(e.hash||e)}traverse(e,t=-1,n){let r=e.sort(this._sortFn).reverse(),i={},s={},o=0;const a=e=>this.get(e),u=e=>{e&&!i[e.hash]&&(r=[e,...r].sort(this._sortFn).reverse(),i[e.hash]=!0)};for(;r.length>0&&(o{let t=new Set;for(let n=1;n<=e;n*=2){const e=Math.min(n-1,i.length-1);t.add(i[e])}return t})(Math.min(t,i.length));i.length!a.includes(e)),l=await s.create(this._storage,this._identity,this.id,e,a,this.clock,c,n);if(!await this._access.canAppend(l,this._identity.provider))throw new Error(`Could not append entry, key "${this._identity.id}" is not allowed to write to the log`);return this._entryIndex.set(l.hash,l),a.forEach(e=>this._nextsIndex[e]=l.hash),this._headsIndex={},this._headsIndex[l.hash]=l,this._length++,l}iterator({gt:e,gte:t,lt:n,lte:r,amount:i=-1}={}){if(0===i)return function*(){}();if("string"==typeof r&&(r=[this.get(r)]),"string"==typeof n&&(n=[this.get(this.get(n).next)]),r&&!Array.isArray(r))throw a.LtOrLteMustBeStringOrArray();if(n&&!Array.isArray(n))throw a.LtOrLteMustBeStringOrArray();let s=(r||n||this.heads).filter(d),o=t?this.get(t).hash:e?this.get(e).hash:null,u=o?-1:i||-1,c=this.traverse(s,u,o),l=Object.values(c);return e&&l.pop(),(e||t)&&i>-1&&(l=l.slice(l.length-i,l.length)),function*(){for(let e in l)yield l[e]}()}async join(e,t=-1){if(!d(e))throw a.LogNotDefinedError();if(!w.isLog(e))throw a.NotALogError();if(this.id!==e.id)return;const n=w.difference(e,this),i=this._identity.provider,o=async e=>{if(!await this._access.canAppend(e,i))throw new Error(`Could not append entry, key "${e.identity.id}" is not allowed to write to the log`)},c=Object.values(n);await r(c,async e=>{await o(e),await(async e=>{const t=await s.verify(i,e),n=e.identity?e.identity.publicKey:e.key;if(!t)throw new Error(`Could not validate signature "${e.sig}" for entry "${e.hash}" and key "${n}"`)})(e)},{concurrency:this.joinConcurrency});Object.values(n).forEach(e=>{this.get(e.hash)||this._length++,e.next.forEach(t=>this._nextsIndex[t]=e.hash)}),this._entryIndex.add(n);const l=Object.values(n).map(m).reduce(y,[]),h=w.findHeads(Object.values(Object.assign({},this._headsIndex,e._headsIndex))).filter(e=>!l.find(t=>t===e.hash)).filter(e=>!this._nextsIndex[e.hash]).reduce(v,{});if(this._headsIndex=h,t>-1){let e=this.values;e=e.slice(-t),this._entryIndex=null,this._entryIndex=new b(e.reduce(v,{})),this._headsIndex=w.findHeads(e).reduce(v,{}),this._length=this._entryIndex.length}const f=Object.values(this._headsIndex).reduce(k,0);return this._clock=new u(this.clock.id,Math.max(this.clock.time,f)),this}toJSON(){return{id:this.id,heads:this.heads.sort(this._sortFn).reverse().map(g)}}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,n)=>{const r=s.findChildren(t,this.values).length;let i=new Array(Math.max(r-1,0));return i=r>1?i.fill(" "):i,i=r>0?i.concat(["└─"]):i,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({format:e}={}){return o.toMultihash(this._storage,this,{format:e})}static async fromMultihash(e,t,n,{access:r,length:i=-1,exclude:s=[],timeout:a,concurrency:u,sortFn:c,onProgressCallback:l}={}){const{logId:h,entries:f,heads:d}=await o.fromMultihash(e,n,{length:i,exclude:s,timeout:a,onProgressCallback:l,concurrency:u,sortFn:c});return new w(e,t,{logId:h,access:r,entries:f,heads:d,sortFn:c})}static async fromEntryHash(e,t,n,{logId:r,access:i,length:s=-1,exclude:a=[],timeout:u,concurrency:c,sortFn:l,onProgressCallback:h}={}){const{entries:f}=await o.fromEntryHash(e,n,{length:s,exclude:a,timeout:u,concurrency:c,onProgressCallback:h});return new w(e,t,{logId:r,access:i,entries:f,sortFn:l})}static async fromJSON(e,t,n,{access:r,length:i=-1,timeout:s,sortFn:a,onProgressCallback:u}={}){const{logId:c,entries:l}=await o.fromJSON(e,n,{length:i,timeout:s,onProgressCallback:u});return new w(e,t,{logId:c,access:r,entries:l,sortFn:a})}static async fromEntry(e,t,n,{access:r,length:i=-1,exclude:s=[],timeout:a,concurrency:u,sortFn:c,onProgressCallback:l}={}){const{logId:h,entries:f}=await o.fromEntry(e,n,{length:i,exclude:s,timeout:a,concurrency:u,onProgressCallback:l});return new w(e,t,{logId:h,access:r,entries:f,sortFn:c})}static findHeads(e){var t=e.reduce((e,t,n,r)=>(t.next.forEach(n=>e[n]=t.hash),e),{});return e.filter(e=>void 0===t[e.hash]).sort((e,t)=>e.clock.id>t.clock.id)}static findTails(e){var t={},n=[],r={},i=[];e.forEach(e=>{0===e.next.length&&n.push(e);e.next.forEach(n=>{t[n]||(t[n]=[]),t[n].push(e)}),i=i.concat(e.next),r[e.hash]=!0});const o=i.filter(e=>void 0===r[e]).map(e=>t[e]).reduce((e,t,n,r)=>e.concat(p(t,"hash")),[]).concat(n);return p(o,"hash").sort(s.compare)}static findTailHashes(e){var t={};return e.forEach(e=>t[e.hash]=!0),e.reduce((e,n,r,i)=>(n.next.reverse().forEach(n=>{void 0===t[n]&&e.splice(0,0,n)}),e),[])}static difference(e,t){let n=Object.keys(e._headsIndex),r={},i={};const s=e=>{r[e]||t.get(e)||(n.push(e),r[e]=!0)};for(;n.length>0;){const o=n.shift(),a=e.get(o);a&&!t.get(o)&&a.id===t.id&&(i[a.hash]=a,r[a.hash]=!0,a.next.forEach(s))}return i}}e.exports=w,e.exports.Sorting=c,e.exports.Entry=s,e.exports.AccessController=f}).call(this,n(0).Buffer)},function(e,t,n){"use strict";e.exports=(e,t,n)=>new Promise((r,i)=>{if(n=Object.assign({concurrency:1/0},n),"function"!=typeof t)throw new TypeError("Mapper function is required");const s=n.concurrency;if(!("number"==typeof s&&s>=1))throw new TypeError(`Expected \`concurrency\` to be a number from 1 and up, got \`${s}\` (${typeof s})`);const o=[],a=e[Symbol.iterator]();let u=!1,c=!1,l=0,h=0;const f=()=>{if(u)return;const e=a.next(),n=h;if(h++,e.done)return c=!0,void(0===l&&r(o));l++,Promise.resolve(e.value).then(e=>t(e,n)).then(e=>{o[n]=e,l--,f()},e=>{u=!0,i(e)})};for(let e=0;ee?Array.isArray(e)?e.map(s):new r(e):e,o=(e,t)=>{if(!e||"string"==typeof e)return e;if(Array.isArray(e))return e.map(o);if(e["/"])return e["/"];const n=t.base||"base58btc";return e.toBaseEncodedString(n)},a={"dag-pb":{read:async(e,t)=>{const n=(await e.dag.get(t)).value;return JSON.parse(n.toJSON().data)},write:async(e,n,r)=>{const s=t.from(JSON.stringify(n)),o=new i.DAGNode(s),a=(await e.dag.put(o,{format:"dag-pb",hashAlg:"sha2-256"})).toV0().toBaseEncodedString();return(r.pin||!1)&&await e.pin.add(a),a}},"dag-cbor":{write:async(e,t,n)=>{const r=Object.assign({},t);(n.links||[]).forEach(e=>{r[e]&&(r[e]=s(r[e]))});const i=n.base||"base58btc",o=n.onlyHash||!1,a=(await e.dag.put(r,{onlyHash:o})).toBaseEncodedString(i);return(n.pin||!1)&&await e.pin.add(a),a},read:async(e,t,n)=>{const r=(await e.dag.get(t)).value;return(n.links||[]).forEach(e=>{r[e]&&(r[e]=o(r[e],n))}),r}},raw:{write:async(e,t,n)=>{const r=n.onlyHash||!1,s=n.base||"base58btc",o=Object.assign({},{onlyHash:r},n.format?{format:n.format,hashAlg:"sha2-256"}:{});"dag-pb"===o.format&&(t=new i.DAGNode(t));const a=(await e.dag.put(t,o)).toBaseEncodedString(s);return(n.pin||!1)&&await e.pin.add(a),a}}};e.exports={read:(e,t,n={})=>{t=new r(t);const i=a[t.codec];if(!i)throw new Error("Unsupported codec");return i.read(e,t,n)},write:(e,t,n,r={})=>{const i=a[t];if(!i)throw new Error("Unsupported codec");return i.write(e,n,r)}}}).call(this,n(0).Buffer)},function(e,t,n){"use strict";const{Buffer:r}=n(0),i=n(97);function s(e,t){if(!t)throw new Error("requires an encoded buffer");const n=o(e),i=r.from(n.code);return function(e,t){o(e).decode(t.toString())}(n.name,t),r.concat([i,t])}function o(e){let t;if(i.names[e])t=i.names[e];else{if(!i.codes[e])throw new Error("Unsupported encoding");t=i.codes[e]}if(!t.isImplemented())throw new Error("Base "+e+" is not implemented yet");return t}(t=e.exports=s).encode=function(e,t){const n=o(e);return s(n.name,r.from(n.encode(t)))},t.decode=function(e){r.isBuffer(e)&&(e=e.toString());const t=e.substring(0,1);"string"==typeof(e=e.substring(1,e.length))&&(e=r.from(e));const n=o(t);return r.from(n.decode(e.toString()))},t.isEncoded=function(e){r.isBuffer(e)&&(e=e.toString());if("[object String]"!==Object.prototype.toString.call(e))return!1;const t=e.substring(0,1);try{return o(t).name}catch(e){return!1}},t.names=Object.freeze(Object.keys(i.names)),t.codes=Object.freeze(Object.keys(i.codes))},function(e,t,n){"use strict";var r=n(31).Buffer;e.exports=function(e){if(e.length>=255)throw new TypeError("Alphabet too long");for(var t=new Uint8Array(256),n=0;n>>0,l=new Uint8Array(o);e[n];){var h=t[e.charCodeAt(n)];if(255===h)return;for(var f=0,d=o-1;(0!==h||f>>0,l[d]=h%256>>>0,h=h/256>>>0;if(0!==h)throw new Error("Non-zero carry");s=f,n++}if(" "!==e[n]){for(var p=o-s;p!==o&&0===l[p];)p++;var b=r.allocUnsafe(i+(o-p));b.fill(0,0,i);for(var g=i;p!==o;)b[g++]=l[p++];return b}}}return{encode:function(t){if((Array.isArray(t)||t instanceof Uint8Array)&&(t=r.from(t)),!r.isBuffer(t))throw new TypeError("Expected Buffer");if(0===t.length)return"";for(var n=0,i=0,s=0,o=t.length;s!==o&&0===t[s];)s++,n++;for(var c=(o-s)*l+1>>>0,h=new Uint8Array(c);s!==o;){for(var f=t[s],d=0,p=c-1;(0!==f||d>>0,h[p]=f%a>>>0,f=f/a>>>0;if(0!==f)throw new Error("Non-zero carry");i=d,s++}for(var b=c-i;b!==c&&0===h[b];)b++;for(var g=u.repeat(n);bo.isDAGLink(e)?e:o.util.createDagLinkFromB58EncodedHash(e)),t=s(t),this._data=e,this._links=t,this._serializedSize=n,this._size=null}toJSON(){return this._json||(this._json=Object.freeze({data:this.Data,links:this._links.map(e=>e.toJSON()),size:this.size})),Object.assign({},this._json)}toString(){return`DAGNode `}_invalidateCached(){this._serializedSize=null,this._size=null}addLink(e){return this._invalidateCached(),c(this,e)}rmLink(e){return this._invalidateCached(),l(this,e)}toDAGLink(e){return u(this,e)}serialize(){return a({Data:this._data,Links:this._links})}get size(){return null===this._size&&(null===this._serializedSize&&(this._serializedSize=this.serialize().length),this._size=this._links.reduce((e,t)=>e+t.Tsize,this._serializedSize)),this._size}set size(e){throw new Error("Can't set property: 'size' is immutable")}get Data(){return this._data}set Data(e){throw new Error("Can't set property: 'Data' is immutable")}get Links(){return this._links.map(e=>({Name:e.Name,Tsize:e.Tsize,Hash:e.Hash}))}set Links(e){throw new Error("Can't set property: 'Links' is immutable")}},{className:"DAGNode",symbolName:"@ipld/js-ipld-dag-pb/dagnode"})},function(e,t,n){"use strict";const{Buffer:r}=n(0),i=n(119),s=(e,t)=>r.compare(e.nameAsBuffer,t.nameAsBuffer);e.exports=e=>i(e,s)},function(e,t,n){"use strict";const r=n(50)(n(51)),i=n(12);t=e.exports;const s=e=>{const t=e.Data,n=e.Links||[];return r.PBNode.encode((e=>{const t={};return e.Data&&e.Data.length>0?t.Data=e.Data:t.Data=null,e.Links&&e.Links.length>0?t.Links=e.Links.map(e=>({Hash:e.Hash.buffer,Name:e.Name,Tsize:e.Tsize})):t.Links=null,t})({Data:t,Links:n}))};t.serializeDAGNode=s,t.serializeDAGNodeLike=(e,t=[])=>{const n={Data:e};return n.Links=t.map(e=>i.isDAGLink(e)?e:i.util.createDagLinkFromB58EncodedHash(e)),s(n)}},function(e,t,n){"use strict";var r=n(121);const{Buffer:i}=n(0);var s=n(125);e.exports=function(e,t){if(t||(t={}),!e)throw new Error("Pass in a .proto string or a protobuf-schema parsed object");var n="object"!=typeof e||i.isBuffer(e)?r.parse(e):e,o=function(){var e=this;s(n,t.encodings||{}).forEach((function(t){e[t.name]=function(e){if(!e)return null;var t={};return Object.keys(e).forEach((function(n){t[n]=e[n].value})),t}(t.values)||t}))};return o.prototype.toString=function(){return r.stringify(n)},o.prototype.toJSON=function(){return n},new o}},function(e,t,n){"use strict";e.exports="// An IPFS MerkleDAG Link\nmessage PBLink {\n\n // multihash of the target object\n optional bytes Hash = 1;\n\n // utf string name. should be unique per object\n optional string Name = 2;\n\n // cumulative size of target object\n optional uint64 Tsize = 3;\n}\n\n// An IPFS MerkleDAG Node\nmessage PBNode {\n\n // refs to other objects\n repeated PBLink Links = 2;\n\n // opaque user data\n optional bytes Data = 1;\n}"},function(e,t,n){"use strict";const r=n(17),i=n(23),s=n(132);(t=e.exports).codec=i.DAG_PB,t.defaultHashAlg=i.SHA2_256;t.cid=async(e,n)=>{const o={cidVersion:1,hashAlg:t.defaultHashAlg},a=Object.assign(o,n),u=await s(e,a.hashAlg),c=i.print[t.codec];return new r(a.cidVersion,c,u)}},function(e,t,n){(function(t){function n(e){return(4294967296+e).toString(16).substring(1)}e.exports={normalizeInput:function(e){var n;if(e instanceof Uint8Array)n=e;else if(e instanceof t)n=new Uint8Array(e);else{if("string"!=typeof e)throw new Error("Input must be an string, Buffer or Uint8Array");n=new Uint8Array(t.from(e,"utf8"))}return n},toHex:function(e){return Array.prototype.map.call(e,(function(e){return(e<16?"0":"")+e.toString(16)})).join("")},debugPrint:function(e,t,r){for(var i="\n"+e+" = ",s=0;so.isDAGNode(e)?e.serialize():a(e.Data,e.Links),t.deserialize=e=>{const t=i.PBNode.decode(e),n=t.Links.map(e=>new s(e.Name,e.Tsize,e.Hash)),a=null==t.Data?r.alloc(0):t.Data;return new o(a,n,e.length)},t.cid=(e,t)=>u.cid(e,t)},function(e,t,n){"use strict";const r=n(21);function i(e,t,n){const i=r.compare(e.clock,t.clock);return 0===i?n(e,t):i}function s(e,t,n){return e.clock.id===t.clock.id?n(e,t):e.clock.ide,r=(e,t)=>s(e,t,n);return((e,t)=>i(e,t,r))(e,t)},t.SortByEntryHash=function(e,t){const n=(e,t)=>e.hashs(e,t,n);return((e,t)=>i(e,t,r))(e,t)},t.NoZeroes=function(e){const t=`Your log's tiebreaker function, ${e.name}, has returned zero and therefore cannot be`;return(n,r)=>{const i=e(n,r);if(0===i)throw Error(t);return i}}},function(e,t,n){"use strict";e.exports={IPFSNotDefinedError:()=>new Error("IPFS instance not defined"),LogNotDefinedError:()=>new Error("Log instance not defined"),NotALogError:()=>new Error("Given argument is not an instance of Log"),CannotJoinWithDifferentId:()=>new Error("Can't join logs with different IDs"),LtOrLteMustBeStringOrArray:()=>new Error("lt or lte must be a string or array of Entries")}},function(e,t,n){"use strict";(function(t){const r=n(163),i=n(164).format,s=n(5).EventEmitter;let o=!(t.type&&"renderer"===t.type||!t.version);const a={DEBUG:"DEBUG",INFO:"INFO",WARN:"WARN",ERROR:"ERROR",NONE:"NONE"};let u=a.DEBUG,c=null,l=new s,h={Black:0,Red:1,Green:2,Yellow:3,Blue:4,Magenta:5,Cyan:6,Grey:7,White:9,Default:9};o||(h={Black:"Black",Red:"IndianRed",Green:"LimeGreen",Yellow:"Orange",Blue:"RoyalBlue",Magenta:"Orchid",Cyan:"SkyBlue",Grey:"DimGrey",White:"White",Default:"Black"});const f=[h.Cyan,h.Green,h.Yellow,h.Red,h.Default],d={useColors:!0,color:h.Default,showTimestamp:!0,useLocalTime:!1,showLevel:!0,filename:c,appendFile:!0};class p{constructor(e,t){this.category=e;let n={};Object.assign(n,d),Object.assign(n,t),this.options=n,this.debug=this.debug.bind(this),this.log=this.log.bind(this),this.info=this.info.bind(this),this.warn=this.warn.bind(this),this.error=this.error.bind(this)}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&&o&&(this.fileWriter=r.openSync(this.options.filename||c,this.options.appendFile?"a+":"w+"));let n=this._format(e,t),i=this._createLogMessage(e,t),s=this._createLogMessage(e,t,n.timestamp,n.level,n.category,n.text);this.fileWriter&&o&&r.writeSync(this.fileWriter,i+"\n",null,"utf-8"),o||!this.options.useColors?(console.log(s),l.emit("data",this.category,e,t)):e===a.ERROR?this.options.showTimestamp&&this.options.showLevel?console.error(s,n.timestamp,n.level,n.category,n.text):this.options.showTimestamp&&!this.options.showLevel?console.error(s,n.timestamp,n.category,n.text):!this.options.showTimestamp&&this.options.showLevel?console.error(s,n.level,n.category,n.text):console.error(s,n.category,n.text):this.options.showTimestamp&&this.options.showLevel?console.log(s,n.timestamp,n.level,n.category,n.text):this.options.showTimestamp&&!this.options.showLevel?console.log(s,n.timestamp,n.category,n.text):!this.options.showTimestamp&&this.options.showLevel?console.log(s,n.level,n.category,n.text):console.log(s,n.category,n.text)}_format(e,t){let n="",r="",i="",s=": ";if(this.options.useColors){const t=Object.keys(a).map(e=>a[e]).indexOf(e),u=this.options.color;o?(this.options.showTimestamp&&(n="[3"+h.Grey+"m"),this.options.showLevel&&(r="[3"+f[t]+";22m"),i="[3"+u+";1m",s=": "):(this.options.showTimestamp&&(n="color:"+h.Grey),this.options.showLevel&&(r="color:"+f[t]),i="color:"+u+"; font-weight: bold")}return{timestamp:n,level:r,category:i,text:s}}_createLogMessage(e,t,n,r,i,s){n=n||"",r=r||"",i=i||"",s=s||": ",!o&&this.options.useColors&&(this.options.showTimestamp&&(n="%c"),this.options.showLevel&&(r="%c"),i="%c",s=": %c");let u="";return this.options.showTimestamp&&!this.options.useLocalTime&&(u+=(new Date).toISOString()+" "),this.options.showTimestamp&&this.options.useLocalTime&&(u+=(new Date).toLocaleString()+" "),u=n+u,this.options.showLevel&&(u+=r+"["+e+"]"+(e===a.INFO||e===a.WARN?" ":"")+" "),u+=i+this.category,u+=s+t,u}_shouldLog(e){let n=void 0!==t&&void 0!==t.env&&void 0!==t.env.LOG?t.env.LOG.toUpperCase():null;n="undefined"!=typeof window&&window.LOG?window.LOG.toUpperCase():n;const r=n||u,i=Object.keys(a).map(e=>a[e]);return i.indexOf(e)>=i.indexOf(r)}}e.exports={Colors:h,LogLevels:a,setLogLevel:e=>{u=e},setLogfile:e=>{c=e},create:(e,t)=>new p(e,t),forceBrowserMode:e=>o=!e,events:l}}).call(this,n(1))},function(e,t,n){"use strict";(function(t){const r=n(62),i=n(5).EventEmitter,s=n(63),o=n(70),a=n(84),{default:u}=n(86),c=n(41),l=c.Entry,h=n(156),f=n(157),d=n(167),p=n(58),b=p.create("orbit-db.store",{color:p.Colors.Blue});p.setLogLevel("ERROR");const g=n(43),y={Index:h,maxHistory:-1,fetchEntryTimeout:null,replicate:!0,referenceCount:32,replicationConcurrency:128,syncLocal:!1,sortFn:void 0};e.exports=class{constructor(e,t,n,s){if(!t)throw new Error("Identity required");const o=Object.assign({},y);Object.assign(o,s),this.options=o,this._type="store",this.id=n.toString(),this.identity=t,this.address=n,this.dbname=n.path||"",this.events=new i,this.remoteHeadsPath=r.join(this.id,"_remoteHeads"),this.localHeadsPath=r.join(this.id,"_localHeads"),this.snapshotPath=r.join(this.id,"snapshot"),this.queuePath=r.join(this.id,"queue"),this.manifestPath=r.join(this.id,"_manifest"),this._ipfs=e,this._cache=s.cache;const a={canAppend:e=>e.identity.publicKey===t.publicKey};this.access=s.accessController||a,this._oplog=new c(this._ipfs,this.identity,{logId:this.id,access:this.access,sortFn:this.options.sortFn}),this._opqueue=new u({concurrency:1}),this._index=new this.options.Index(this.address.root),this._replicationStatus=new d,this._stats={snapshot:{bytesLoaded:-1},syncRequestsReceieved:0};try{this._replicator=new f(this,this.options.replicationConcurrency),this._loader=this._replicator,this._replicator.on("load.added",e=>{this._replicationStatus.queued++,this._recalculateReplicationMax(e.clock?e.clock.time:0),this.events.emit("replicate",this.address.toString(),e)}),this._replicator.on("load.progress",(e,t,n,r,i)=>{this._replicationStatus.buffered>i?this._recalculateReplicationProgress(this.replicationStatus.progress+i):this._recalculateReplicationProgress(this._oplog.length+i),this._replicationStatus.buffered=i,this._recalculateReplicationMax(this.replicationStatus.progress),this.events.emit("replicate.progress",this.address.toString(),t,n,this.replicationStatus.progress,this.replicationStatus.max)});const e=async(e,t)=>{try{for(const t of e)await this._oplog.join(t);this._replicationStatus.queued-=e.length,this._replicationStatus.buffered=this._replicator._buffer.length,await this._updateIndex();const t=this._oplog.heads;await this._cache.set(this.remoteHeadsPath,t),b.debug(`Saved heads ${t.length} [${t.map(e=>e.hash).join(", ")}]`),this.events.emit("replicated",this.address.toString(),e.length)}catch(e){console.error(e)}};this._replicator.on("load.end",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 index(){return this._index._index}get type(){return this._type}get key(){return this._key}get replicationStatus(){return this._replicationStatus}setIdentity(e){this.identity=e,this._oplog.setIdentity(e)}async close(){return this.options.onClose&&await this.options.onClose(this),await this._opqueue.onIdle(),this._replicator.stop(),this._replicationStatus.reset(),this._stats={snapshot:{bytesLoaded:-1},syncRequestsReceieved:0},this.events.removeAllListeners("load"),this.events.removeAllListeners("load.progress"),this.events.removeAllListeners("replicate"),this.events.removeAllListeners("replicate.progress"),this.events.removeAllListeners("replicated"),this.events.removeAllListeners("ready"),this.events.removeAllListeners("write"),this.events.removeAllListeners("peer"),this.events.emit("closed",this.address.toString()),Promise.resolve()}async drop(){this.options.onDrop&&await this.options.onDrop(this),await this._cache.del(this.localHeadsPath),await this._cache.del(this.remoteHeadsPath),await this._cache.del(this.snapshotPath),await this._cache.del(this.queuePath),await this._cache.del(this.manifestPath),await this.close(),this._index=new this.options.Index(this.address.root),this._oplog=new c(this._ipfs,this.identity,{logId:this.id,access:this.access,sortFn:this.options.sortFn}),this._cache=this.options.cache}async load(e,{fetchEntryTimeout:t}={}){e=e||this.options.maxHistory,t=t||this.options.fetchEntryTimeout,this.options.onLoad&&await this.options.onLoad(this);const n=await this._cache.get(this.localHeadsPath)||[],r=await this._cache.get(this.remoteHeadsPath)||[],i=n.concat(r);i.length>0&&this.events.emit("load",this.address.toString(),i),i.forEach(e=>this._recalculateReplicationMax(e.clock.time));const s=await c.fromEntryHash(this._ipfs,this.identity,i.map(e=>e.hash),{logId:this._oplog.id,access:this.access,sortFn:this.options.sortFn,length:e,exclude:this._oplog.values,onProgressCallback:this._onLoadProgress.bind(this),timeout:t});await this._oplog.join(s,e),i.length>0&&await this._updateIndex(),this.events.emit("ready",this.address.toString(),this._oplog.heads)}async sync(e){if(this._stats.syncRequestsReceieved+=1,b.debug(`Sync request #${this._stats.syncRequestsReceieved} ${e.length}`),0===e.length)return;const t=await a(e,async e=>{if(!e)return console.warn("Warning: Given input entry was 'null'."),Promise.resolve(null);const t=this.identity.provider;if(!t)throw new Error("Identity-provider is required, cannot verify entry");if(!await this.access.canAppend(e,t))return console.warn("Warning: Given input entry is not allowed in this log and was discarded (no write access)."),Promise.resolve(null);const n=l.toEntry(e);return await g.write(this._ipfs,l.getWriteFormat(n),n,{links:l.IPLD_LINKS,onlyHash:!0})!==e.hash&&console.warn("\"WARNING! Head hash didn't match the contents"),e});return await this._replicator.load(t.filter(e=>null!==e)),this._replicator._buffer.length||Object.values(this._replicator._queue).length?new Promise(e=>{const t=(n,r,i,s,o)=>{s===o&&(this.events.off("replicate.progress",t),this.events.once("replicated",e))};this.events.on("replicate.progress",t)}):void 0}loadMoreFrom(e,t){this._replicator.load(t)}async saveSnapshot(){const e=this._replicator.getQueue(),n=this._oplog.toSnapshot(),r=t.from(JSON.stringify({id:n.id,heads:n.heads,size:n.values.length,type:this.type})),i=new s,o=new Uint16Array([r.length]),a=t.from(o.buffer);i.push(a),i.push(r);n.values.forEach(e=>{const n=t.from(JSON.stringify(e)),r=new Uint16Array([n.length]);i.push(t.from(r.buffer)),i.push(n)}),i.push(null);const u=i.read(1/0);let c=this._ipfs.files.add?await this._ipfs.files.add(u):await this._ipfs.add(u);if(!Array.isArray(c)){const e=[];for await(const t of c)t.hash=t.cid.toString(),e.push(t);c=e}return await this._cache.set(this.snapshotPath,c[c.length-1]),await this._cache.set(this.queuePath,e),b.debug(`Saved snapshot: ${c[c.length-1].hash}, queue length: ${e.length}`),c}async loadFromSnapshot(e){this.options.onLoad&&await this.options.onLoad(this),this.events.emit("load",this.address.toString());const n=(e,t)=>Math.max(e,t.clock.time),r=await this._cache.get(this.queuePath);this.sync(r||[]);const i=await this._cache.get(this.snapshotPath);if(!i)throw new Error(`Snapshot for ${this.address} not found!`);{const e=this._ipfs.files.catReadableStream?await this._ipfs.files.catReadableStream(i.hash):this._ipfs.catReadableStream?await this._ipfs.catReadableStream(i.hash):o.readable(this._ipfs.cat(i.hash)),r=()=>new Promise((n,r)=>{let i=t.alloc(0),s=[];e.on("data",e=>{if(this._byteSize+=e.length,s.length<2e4)s.push(e);else{const e=t.concat(s);i=t.concat([i,e]),s=[]}}),e.on("end",()=>{if(s.length>0){const e=t.concat(s);i=t.concat([i,e])}function e(e){for(var t=new ArrayBuffer(e.length),n=new Uint8Array(t),r=0;r{this._recalculateReplicationStatus(n,t.clock.time),this._onLoadProgress(e,t)},a=await r();if(this._recalculateReplicationMax(a.values.reduce(n,0)),a){const e=await c.fromJSON(this._ipfs,this.identity,a,{access:this.access,sortFn:this.options.sortFn,length:-1,timeout:1e3,onProgressCallback:s});await this._oplog.join(e),await this._updateIndex(),this.events.emit("replicated",this.address.toString())}this.events.emit("ready",this.address.toString(),this._oplog.heads)}return this}async _updateIndex(){this._recalculateReplicationMax(),await this._index.updateIndex(this._oplog),this._recalculateReplicationProgress()}async syncLocal(){const e=await this._cache.get(this.localHeadsPath)||[],t=await this._cache.get(this.remoteHeadsPath)||[],n=e.concat(t);for(let e=0;e0?o-4:o;for(n=0;n>16&255,u[l++]=t>>8&255,u[l++]=255&t;2===a&&(t=i[e.charCodeAt(n)]<<2|i[e.charCodeAt(n+1)]>>4,u[l++]=255&t);1===a&&(t=i[e.charCodeAt(n)]<<10|i[e.charCodeAt(n+1)]<<4|i[e.charCodeAt(n+2)]>>2,u[l++]=t>>8&255,u[l++]=255&t);return u},t.fromByteArray=function(e){for(var t,n=e.length,i=n%3,s=[],o=0,a=n-i;oa?a:o+16383));1===i?(t=e[n-1],s.push(r[t>>2]+r[t<<4&63]+"==")):2===i&&(t=(e[n-2]<<8)+e[n-1],s.push(r[t>>10]+r[t>>4&63]+r[t<<2&63]+"="));return s.join("")};for(var r=[],i=[],s="undefined"!=typeof Uint8Array?Uint8Array:Array,o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",a=0,u=o.length;a0)throw new Error("Invalid string. Length must be a multiple of 4");var n=e.indexOf("=");return-1===n&&(n=t),[n,n===t?0:4-n%4]}function l(e,t,n){for(var i,s,o=[],a=t;a>18&63]+r[s>>12&63]+r[s>>6&63]+r[63&s]);return o.join("")}i["-".charCodeAt(0)]=62,i["_".charCodeAt(0)]=63},function(e,t){t.read=function(e,t,n,r,i){var s,o,a=8*i-r-1,u=(1<>1,l=-7,h=n?i-1:0,f=n?-1:1,d=e[t+h];for(h+=f,s=d&(1<<-l)-1,d>>=-l,l+=a;l>0;s=256*s+e[t+h],h+=f,l-=8);for(o=s&(1<<-l)-1,s>>=-l,l+=r;l>0;o=256*o+e[t+h],h+=f,l-=8);if(0===s)s=1-c;else{if(s===u)return o?NaN:1/0*(d?-1:1);o+=Math.pow(2,r),s-=c}return(d?-1:1)*o*Math.pow(2,s-r)},t.write=function(e,t,n,r,i,s){var o,a,u,c=8*s-i-1,l=(1<>1,f=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,d=r?0:s-1,p=r?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,o=l):(o=Math.floor(Math.log(t)/Math.LN2),t*(u=Math.pow(2,-o))<1&&(o--,u*=2),(t+=o+h>=1?f/u:f*Math.pow(2,1-h))*u>=2&&(o++,u/=2),o+h>=l?(a=0,o=l):o+h>=1?(a=(t*u-1)*Math.pow(2,i),o+=h):(a=t*Math.pow(2,h-1)*Math.pow(2,i),o=0));i>=8;e[n+d]=255&a,d+=p,a/=256,i-=8);for(o=o<0;e[n+d]=255&o,d+=p,o/=256,c-=8);e[n+d-p]|=128*b}},function(e,t,n){(function(e){function n(e,t){for(var n=0,r=e.length-1;r>=0;r--){var i=e[r];"."===i?e.splice(r,1):".."===i?(e.splice(r,1),n++):n&&(e.splice(r,1),n--)}if(t)for(;n--;n)e.unshift("..");return e}function r(e,t){if(e.filter)return e.filter(t);for(var n=[],r=0;r=-1&&!i;s--){var o=s>=0?arguments[s]:e.cwd();if("string"!=typeof o)throw new TypeError("Arguments to path.resolve must be strings");o&&(t=o+"/"+t,i="/"===o.charAt(0))}return(i?"/":"")+(t=n(r(t.split("/"),(function(e){return!!e})),!i).join("/"))||"."},t.normalize=function(e){var s=t.isAbsolute(e),o="/"===i(e,-1);return(e=n(r(e.split("/"),(function(e){return!!e})),!s).join("/"))||s||(e="."),e&&o&&(e+="/"),(s?"/":"")+e},t.isAbsolute=function(e){return"/"===e.charAt(0)},t.join=function(){var e=Array.prototype.slice.call(arguments,0);return t.normalize(r(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,n){function r(e){for(var t=0;t=0&&""===e[n];n--);return t>n?[]:e.slice(t,n-t+1)}e=t.resolve(e).substr(1),n=t.resolve(n).substr(1);for(var i=r(e.split("/")),s=r(n.split("/")),o=Math.min(i.length,s.length),a=o,u=0;u=1;--s)if(47===(t=e.charCodeAt(s))){if(!i){r=s;break}}else i=!1;return-1===r?n?"/":".":n&&1===r?"/":e.slice(0,r)},t.basename=function(e,t){var n=function(e){"string"!=typeof e&&(e+="");var t,n=0,r=-1,i=!0;for(t=e.length-1;t>=0;--t)if(47===e.charCodeAt(t)){if(!i){n=t+1;break}}else-1===r&&(i=!1,r=t+1);return-1===r?"":e.slice(n,r)}(e);return t&&n.substr(-1*t.length)===t&&(n=n.substr(0,n.length-t.length)),n},t.extname=function(e){"string"!=typeof e&&(e+="");for(var t=-1,n=0,r=-1,i=!0,s=0,o=e.length-1;o>=0;--o){var a=e.charCodeAt(o);if(47!==a)-1===r&&(i=!1,r=o+1),46===a?-1===t?t=o:1!==s&&(s=1):-1!==t&&(s=-1);else if(!i){n=o+1;break}}return-1===t||-1===r||0===s||1===s&&t===r-1&&t===n+1?"":e.slice(t,r)};var i="b"==="ab".substr(-1)?function(e,t,n){return e.substr(t,n)}:function(e,t,n){return t<0&&(t=e.length+t),e.substr(t,n)}}).call(this,n(1))},function(e,t,n){(t=e.exports=n(26)).Stream=t,t.Readable=t,t.Writable=n(29),t.Duplex=n(7),t.Transform=n(32),t.PassThrough=n(69)},function(e,t){},function(e,t,n){"use strict";var r=n(18).Buffer,i=n(66);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,n=""+t.data;t=t.next;)n+=e+t.data;return n},e.prototype.concat=function(e){if(0===this.length)return r.alloc(0);if(1===this.length)return this.head.data;for(var t,n,i,s=r.allocUnsafe(e>>>0),o=this.head,a=0;o;)t=o.data,n=s,i=a,t.copy(n,i),a+=o.data.length,o=o.next;return s},e}(),i&&i.inspect&&i.inspect.custom&&(e.exports.prototype[i.inspect.custom]=function(){var e=i.inspect({length:this.length});return this.constructor.name+" "+e})},function(e,t){},function(e,t,n){(function(e){var r=void 0!==e&&e||"undefined"!=typeof self&&self||window,i=Function.prototype.apply;function s(e,t){this._id=e,this._clearFn=t}t.setTimeout=function(){return new s(i.call(setTimeout,r,arguments),clearTimeout)},t.setInterval=function(){return new s(i.call(setInterval,r,arguments),clearInterval)},t.clearTimeout=t.clearInterval=function(e){e&&e.close()},s.prototype.unref=s.prototype.ref=function(){},s.prototype.close=function(){this._clearFn.call(r,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))},n(68),t.setImmediate="undefined"!=typeof self&&self.setImmediate||void 0!==e&&e.setImmediate||this&&this.setImmediate,t.clearImmediate="undefined"!=typeof self&&self.clearImmediate||void 0!==e&&e.clearImmediate||this&&this.clearImmediate}).call(this,n(3))},function(e,t,n){(function(e,t){!function(e,n){"use strict";if(!e.setImmediate){var r,i,s,o,a,u=1,c={},l=!1,h=e.document,f=Object.getPrototypeOf&&Object.getPrototypeOf(e);f=f&&f.setTimeout?f:e,"[object process]"==={}.toString.call(e.process)?r=function(){var e=d(arguments);return t.nextTick(p(b,e)),e}:!function(){if(e.postMessage&&!e.importScripts){var t=!0,n=e.onmessage;return e.onmessage=function(){t=!1},e.postMessage("","*"),e.onmessage=n,t}}()?e.MessageChannel?((s=new MessageChannel).port1.onmessage=function(e){b(e.data)},r=function(){var e=d(arguments);return s.port2.postMessage(e),e}):h&&"onreadystatechange"in h.createElement("script")?(i=h.documentElement,r=function(){var e=d(arguments),t=h.createElement("script");return t.onreadystatechange=function(){b(e),t.onreadystatechange=null,i.removeChild(t),t=null},i.appendChild(t),e}):r=function(){var e=d(arguments);return setTimeout(p(b,e),0),e}:(o="setImmediate$"+Math.random()+"$",a=function(t){t.source===e&&"string"==typeof t.data&&0===t.data.indexOf(o)&&b(+t.data.slice(o.length))},e.addEventListener?e.addEventListener("message",a,!1):e.attachEvent("onmessage",a),r=function(){var t=d(arguments);return e.postMessage(o+t,"*"),t}),f.setImmediate=r,f.clearImmediate=g}function d(e){return c[u]=p.apply(void 0,e),u++}function p(e){var t=[].slice.call(arguments,1);return function(){"function"==typeof e?e.apply(void 0,t):new Function(""+e)()}}function b(e){if(l)setTimeout(p(b,e),0);else{var t=c[e];if(t){l=!0;try{t()}finally{g(e),l=!1}}}}function g(e){delete c[e]}}("undefined"==typeof self?void 0===e?this:e:self)}).call(this,n(3),n(1))},function(e,t,n){"use strict";e.exports=s;var r=n(32),i=Object.create(n(13));function s(e){if(!(this instanceof s))return new s(e);r.call(this,e)}i.inherits=n(2),i.inherits(s,r),s.prototype._transform=function(e,t,n){n(null,e)}},function(e,t,n){"use strict";const r=n(71),i=n(33);function s(e,t){return i({source:e},t)}e.exports=s,e.exports.readable=s,e.exports.writable=function(e,t){return i({sink:e},t)},e.exports.transform=r,e.exports.duplex=i},function(e,t,n){const r=n(33),i=n(40);e.exports=function(e,t){const{promise:n,resolve:s}=i(),o=async function*(){const e=await n;for await(const t of e)yield t}();return r({sink:t=>s(e(t)),source:o},t)}},function(e,t,n){(t=e.exports=n(34)).Stream=t,t.Readable=t,t.Writable=n(38),t.Duplex=n(9),t.Transform=n(39),t.PassThrough=n(78),t.finished=n(19),t.pipeline=n(79)},function(e,t){},function(e,t,n){"use strict";function r(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function i(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function s(e,t){for(var n=0;n0?this.tail.next=t:this.head=t,this.tail=t,++this.length}},{key:"unshift",value:function(e){var t={data:e,next:this.head};0===this.length&&(this.tail=t),this.head=t,++this.length}},{key:"shift",value: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}}},{key:"clear",value:function(){this.head=this.tail=null,this.length=0}},{key:"join",value:function(e){if(0===this.length)return"";for(var t=this.head,n=""+t.data;t=t.next;)n+=e+t.data;return n}},{key:"concat",value:function(e){if(0===this.length)return o.alloc(0);for(var t,n,r,i=o.allocUnsafe(e>>>0),s=this.head,a=0;s;)t=s.data,n=i,r=a,o.prototype.copy.call(t,n,r),a+=s.data.length,s=s.next;return i}},{key:"consume",value:function(e,t){var n;return ei.length?i.length:e;if(s===i.length?r+=i:r+=i.slice(0,e),0==(e-=s)){s===i.length?(++n,t.next?this.head=t.next:this.head=this.tail=null):(this.head=t,t.data=i.slice(s));break}++n}return this.length-=n,r}},{key:"_getBuffer",value:function(e){var t=o.allocUnsafe(e),n=this.head,r=1;for(n.data.copy(t),e-=n.data.length;n=n.next;){var i=n.data,s=e>i.length?i.length:e;if(i.copy(t,t.length-e,0,s),0==(e-=s)){s===i.length?(++r,n.next?this.head=n.next:this.head=this.tail=null):(this.head=n,n.data=i.slice(s));break}++r}return this.length-=r,t}},{key:u,value:function(e,t){return a(this,function(e){for(var t=1;t0,(function(e){r||(r=e),e&&o.forEach(c),s||(o.forEach(c),i(r))}))}));return t.reduce(l)}},function(e,t){e.exports=function(e){if(e){if("function"==typeof e[Symbol.iterator])return e[Symbol.iterator]();if("function"==typeof e[Symbol.asyncIterator])return e[Symbol.asyncIterator]();if("function"==typeof e.next)return e}throw new Error("argument is not an iterator or iterable")}},function(e,t,n){const r=n(82),i=n(40);e.exports=class{constructor(){this._buffer=new r,this._waitingConsumers=new r}push(e){const{promise:t,resolve:n}=i();return this._buffer.push({chunk:e,resolve:n}),this._consume(),t}_consume(){for(;!this._waitingConsumers.isEmpty()&&!this._buffer.isEmpty();){const e=this._waitingConsumers.shift(),t=this._buffer.shift();e.resolve(t.chunk),t.resolve()}}shift(){const{promise:e,resolve:t}=i();return this._waitingConsumers.push({resolve:t}),this._consume(),e}isEmpty(){return this._buffer.isEmpty()}}},function(e,t,n){const r=n(83);e.exports=class{constructor(e){this.hwm=e||16,this.head=new r(this.hwm),this.tail=this.head}push(e){if(!this.head.push(e)){const t=this.head;this.head=t.next=new r(2*this.head.buffer.length),this.head.push(e)}}shift(){const e=this.tail.shift();if(void 0===e&&this.tail.next){const e=this.tail.next;return this.tail.next=null,this.tail=e,this.tail.shift()}return e}isEmpty(){return this.head.isEmpty()}}},function(e,t){e.exports=class{constructor(e){if(!(e>0)||0!=(e-1&e))throw new Error("Max size for a FixedFIFO should be a power of two");this.buffer=new Array(e),this.mask=e-1,this.top=0,this.btm=0,this.next=null}push(e){return void 0===this.buffer[this.top]&&(this.buffer[this.top]=e,this.top=this.top+1&this.mask,!0)}shift(){const e=this.buffer[this.btm];if(void 0!==e)return this.buffer[this.btm]=void 0,this.btm=this.btm+1&this.mask,e}isEmpty(){return void 0===this.buffer[this.btm]}}},function(e,t,n){"use strict";const r=n(85);e.exports=(e,t)=>r(e,(e,n,r)=>t(n,r)).then(()=>e)},function(e,t,n){"use strict";e.exports=(e,t,n)=>new Promise((r,i)=>{const s=e[Symbol.iterator]();let o=0;const a=e=>{const n=s.next();n.done?r(e):Promise.all([e,n.value]).then(e=>{a(t(e[0],e[1],o++))}).catch(i)};a(n)})},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const r=n(87),i=n(88),s=n(90),o=()=>{},a=new i.TimeoutError;t.default=class extends r{constructor(e){var t,n,r,i;if(super(),Object.defineProperty(this,"_carryoverConcurrencyCount",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_isIntervalIgnored",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_intervalCount",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"_intervalCap",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_interval",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_intervalEnd",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"_intervalId",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_timeoutId",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_queue",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_queueClass",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_pendingCount",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"_concurrency",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_isPaused",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_resolveEmpty",{enumerable:!0,configurable:!0,writable:!0,value:o}),Object.defineProperty(this,"_resolveIdle",{enumerable:!0,configurable:!0,writable:!0,value:o}),Object.defineProperty(this,"_timeout",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_throwOnTimeout",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),!("number"==typeof(e=Object.assign({carryoverConcurrencyCount:!1,intervalCap:1/0,interval:0,concurrency:1/0,autoStart:!0,queueClass:s.default},e)).intervalCap&&e.intervalCap>=1))throw new TypeError(`Expected \`intervalCap\` to be a number from 1 and up, got \`${null!==(n=null===(t=e.intervalCap)||void 0===t?void 0:t.toString())&&void 0!==n?n:""}\` (${typeof e.intervalCap})`);if(void 0===e.interval||!(Number.isFinite(e.interval)&&e.interval>=0))throw new TypeError(`Expected \`interval\` to be a finite number >= 0, got \`${null!==(i=null===(r=e.interval)||void 0===r?void 0:r.toString())&&void 0!==i?i:""}\` (${typeof e.interval})`);this._carryoverConcurrencyCount=e.carryoverConcurrencyCount,this._isIntervalIgnored=e.intervalCap===1/0||0===e.interval,this._intervalCap=e.intervalCap,this._interval=e.interval,this._queue=new e.queueClass,this._queueClass=e.queueClass,this.concurrency=e.concurrency,this._timeout=e.timeout,this._throwOnTimeout=!0===e.throwOnTimeout,this._isPaused=!1===e.autoStart}get _doesIntervalAllowAnother(){return this._isIntervalIgnored||this._intervalCount{this._onResumeInterval()},t)),!0;this._intervalCount=this._carryoverConcurrencyCount?this._pendingCount:0}return!1}_tryToStartAnother(){if(0===this._queue.size)return this._intervalId&&clearInterval(this._intervalId),this._intervalId=void 0,this._resolvePromises(),!1;if(!this._isPaused){const e=!this._isIntervalPaused();if(this._doesIntervalAllowAnother&&this._doesConcurrentAllowAnother)return this.emit("active"),this._queue.dequeue()(),e&&this._initializeIntervalIfNeeded(),!0}return!1}_initializeIntervalIfNeeded(){this._isIntervalIgnored||void 0!==this._intervalId||(this._intervalId=setInterval(()=>{this._onInterval()},this._interval),this._intervalEnd=Date.now()+this._interval)}_onInterval(){0===this._intervalCount&&0===this._pendingCount&&this._intervalId&&(clearInterval(this._intervalId),this._intervalId=void 0),this._intervalCount=this._carryoverConcurrencyCount?this._pendingCount:0,this._processQueue()}_processQueue(){for(;this._tryToStartAnother(););}get concurrency(){return this._concurrency}set concurrency(e){if(!("number"==typeof e&&e>=1))throw new TypeError(`Expected \`concurrency\` to be a number from 1 and up, got \`${e}\` (${typeof e})`);this._concurrency=e,this._processQueue()}async add(e,t={}){return new Promise((n,r)=>{this._queue.enqueue(async()=>{this._pendingCount++,this._intervalCount++;try{const s=void 0===this._timeout&&void 0===t.timeout?e():i.default(Promise.resolve(e()),void 0===t.timeout?this._timeout:t.timeout,()=>{(void 0===t.throwOnTimeout?this._throwOnTimeout:t.throwOnTimeout)&&r(a)});n(await s)}catch(e){r(e)}this._next()},t),this._tryToStartAnother()})}async addAll(e,t){return Promise.all(e.map(async e=>this.add(e,t)))}start(){return this._isPaused?(this._isPaused=!1,this._processQueue(),this):this}pause(){this._isPaused=!0}clear(){this._queue=new this._queueClass}async onEmpty(){if(0!==this._queue.size)return new Promise(e=>{const t=this._resolveEmpty;this._resolveEmpty=()=>{t(),e()}})}async onIdle(){if(0!==this._pendingCount||0!==this._queue.size)return new Promise(e=>{const t=this._resolveIdle;this._resolveIdle=()=>{t(),e()}})}get size(){return this._queue.size}sizeBy(e){return this._queue.filter(e).length}get pending(){return this._pendingCount}get isPaused(){return this._isPaused}get timeout(){return this._timeout}set timeout(e){this._timeout=e}}},function(e,t,n){"use strict";var r=Object.prototype.hasOwnProperty,i="~";function s(){}function o(e,t,n){this.fn=e,this.context=t,this.once=n||!1}function a(e,t,n,r,s){if("function"!=typeof n)throw new TypeError("The listener must be a function");var a=new o(n,r||e,s),u=i?i+t:t;return e._events[u]?e._events[u].fn?e._events[u]=[e._events[u],a]:e._events[u].push(a):(e._events[u]=a,e._eventsCount++),e}function u(e,t){0==--e._eventsCount?e._events=new s:delete e._events[t]}function c(){this._events=new s,this._eventsCount=0}Object.create&&(s.prototype=Object.create(null),(new s).__proto__||(i=!1)),c.prototype.eventNames=function(){var e,t,n=[];if(0===this._eventsCount)return n;for(t in e=this._events)r.call(e,t)&&n.push(i?t.slice(1):t);return Object.getOwnPropertySymbols?n.concat(Object.getOwnPropertySymbols(e)):n},c.prototype.listeners=function(e){var t=i?i+e:e,n=this._events[t];if(!n)return[];if(n.fn)return[n.fn];for(var r=0,s=n.length,o=new Array(s);rnew Promise((s,o)=>{if("number"!=typeof t||t<0)throw new TypeError("Expected `milliseconds` to be a positive number");if(t===1/0)return void s(e);const a=setTimeout(()=>{if("function"==typeof n){try{s(n())}catch(e){o(e)}return}const r=n instanceof Error?n:new i("string"==typeof n?n:`Promise timed out after ${t} milliseconds`);"function"==typeof e.cancel&&e.cancel(),o(r)},t);r(e.then(s,o),()=>{clearTimeout(a)})});e.exports=s,e.exports.default=s,e.exports.TimeoutError=i},function(e,t,n){"use strict";e.exports=(e,t)=>(t=t||(()=>{}),e.then(e=>new Promise(e=>{e(t())}).then(()=>e),e=>new Promise(e=>{e(t())}).then(()=>{throw e})))},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const r=n(91);t.default=class{constructor(){Object.defineProperty(this,"_queue",{enumerable:!0,configurable:!0,writable:!0,value:[]})}enqueue(e,t){const n={priority:(t=Object.assign({priority:0},t)).priority,run:e};if(this.size&&this._queue[this.size-1].priority>=t.priority)return void this._queue.push(n);const i=r.default(this._queue,n,(e,t)=>t.priority-e.priority);this._queue.splice(i,0,n)}dequeue(){const e=this._queue.shift();return null==e?void 0:e.run}filter(e){return this._queue.filter(t=>t.priority===e.priority).map(e=>e.run)}get size(){return this._queue.length}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e,t,n){let r=0,i=e.length;for(;i>0;){const s=i/2|0;let o=r+s;n(e[o],t)<=0?(r=++o,i-=s+1):i=s}return r}},function(e,t,n){"use strict";e.exports=class{constructor(e){}append(e){}merge(e){}get(e){}has(e){}get values(){}get length(){}}},function(e,t,n){"use strict";e.exports=function(e,t,n){var r={},i={};return e.forEach(e=>i[n?e[n]:e]=!0),t.reduce((e,t)=>{var s=void 0!==i[n?t[n]:t],o=void 0!==r[n?t[n]:t];return s||o||(e.push(t),r[n?t[n]:t]=!0),e},[])}},function(e,t,n){"use strict";e.exports=function(e,t){let n={};return e.forEach(e=>n[t?e[t]:e]=e),Object.keys(n).map(e=>n[e])}},function(e,t,n){"use strict";e.exports=e=>null!=e},function(e,t,n){"use strict";const{Buffer:r}=n(0),i=n(10),s=n(106),o=n(23),a=n(11),u=n(116),c=n(16);class l{constructor(e,t,n,a){if(h.isCID(e)){const t=e;return this.version=t.version,this.codec=t.codec,this.multihash=r.from(t.multihash),void(this.multibaseName=t.multibaseName||(0===t.version?"base58btc":"base32"))}if("string"==typeof e){const t=s.isEncoded(e);if(t){const n=s.decode(e);this.version=parseInt(n.slice(0,1).toString("hex"),16),this.codec=o.getCodec(n.slice(1)),this.multihash=o.rmPrefix(n.slice(1)),this.multibaseName=t}else this.version=0,this.codec="dag-pb",this.multihash=i.fromB58String(e),this.multibaseName="base58btc";return l.validateCID(this),void Object.defineProperty(this,"string",{value:e})}if(r.isBuffer(e)){const t=e.slice(0,1),n=parseInt(t.toString("hex"),16);if(1===n){const t=e;this.version=n,this.codec=o.getCodec(t.slice(1)),this.multihash=o.rmPrefix(t.slice(1)),this.multibaseName="base32"}else this.version=0,this.codec="dag-pb",this.multihash=e,this.multibaseName="base58btc";l.validateCID(this)}else this.version=e,this.codec=t,this.multihash=n,this.multibaseName=a||(0===e?"base58btc":"base32"),l.validateCID(this)}get buffer(){let e=this._buffer;if(!e){if(0===this.version)e=this.multihash;else{if(1!==this.version)throw new Error("unsupported version");e=r.concat([r.from("01","hex"),o.getCodeVarint(this.codec),this.multihash])}Object.defineProperty(this,"_buffer",{value:e})}return e}get prefix(){return r.concat([r.from("0"+this.version,"hex"),o.getCodeVarint(this.codec),i.prefix(this.multihash)])}toV0(){if("dag-pb"!==this.codec)throw new Error("Cannot convert a non dag-pb CID to CIDv0");const{name:e,length:t}=i.decode(this.multihash);if("sha2-256"!==e)throw new Error("Cannot convert non sha2-256 multihash CID to CIDv0");if(32!==t)throw new Error("Cannot convert non 32 byte multihash CID to CIDv0");return new h(0,this.codec,this.multihash)}toV1(){return new h(1,this.codec,this.multihash)}toBaseEncodedString(e=this.multibaseName){if(this.string&&e===this.multibaseName)return this.string;let t=null;if(0===this.version){if("base58btc"!==e)throw new Error("not supported with CIDv0, to support different bases, please migrate the instance do CIDv1, you can do that through cid.toV1()");t=i.toB58String(this.multihash)}else{if(1!==this.version)throw new Error("unsupported version");t=s.encode(e,this.buffer).toString()}return e===this.multibaseName&&Object.defineProperty(this,"string",{value:t}),t}[Symbol.for("nodejs.util.inspect.custom")](){return"CID("+this.toString()+")"}toString(e){return this.toBaseEncodedString(e)}toJSON(){return{codec:this.codec,version:this.version,hash:this.multihash}}equals(e){return this.codec===e.codec&&this.version===e.version&&this.multihash.equals(e.multihash)}static validateCID(e){const t=u.checkCIDComponents(e);if(t)throw new Error(t)}}const h=c(l,{className:"CID",symbolName:"@ipld/js-cid/CID"});h.codecs=a,e.exports=h},function(e,t,n){"use strict";const r=n(98),i=n(45),s=n(99),o=n(100),a=n(101),u=[["base1","1","","1"],["base2","0",i,"01"],["base8","7",i,"01234567"],["base10","9",i,"0123456789"],["base16","f",s,"0123456789abcdef"],["base32","b",o,"abcdefghijklmnopqrstuvwxyz234567"],["base32pad","c",o,"abcdefghijklmnopqrstuvwxyz234567="],["base32hex","v",o,"0123456789abcdefghijklmnopqrstuv"],["base32hexpad","t",o,"0123456789abcdefghijklmnopqrstuv="],["base32z","h",o,"ybndrfg8ejkmcpqxot1uwisza345h769"],["base58flickr","Z",i,"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"],["base58btc","z",i,"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"],["base64","m",a,"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"],["base64pad","M",a,"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="],["base64url","u",a,"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"],["base64urlpad","U",a,"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_="]],c=u.reduce((e,t)=>(e[t[0]]=new r(t[0],t[1],t[2],t[3]),e),{}),l=u.reduce((e,t)=>(e[t[1]]=c[t[0]],e),{});e.exports={names:c,codes:l}},function(e,t,n){"use strict";e.exports=class{constructor(e,t,n,r){this.name=e,this.code=t,this.alphabet=r,n&&r&&(this.engine=n(r))}encode(e){return this.engine.encode(e)}decode(e){return this.engine.decode(e)}isImplemented(){return this.engine}}},function(e,t,n){"use strict";const{Buffer:r}=n(0);e.exports=function(e){return{encode:e=>"string"==typeof e?r.from(e).toString("hex"):e.toString("hex"),decode(t){for(const n of t)if(e.indexOf(n)<0)throw new Error("invalid base16 character");return r.from(t,"hex")}}}},function(e,t,n){"use strict";function r(e,t){const n=e.byteLength,r=new Uint8Array(e),i=t.indexOf("=")===t.length-1;i&&(t=t.substring(0,t.length-1));let s=0,o=0,a="";for(let e=0;e=5;)a+=t[o>>>s-5&31],s-=5;if(s>0&&(a+=t[o<<5-s&31]),i)for(;a.length%8!=0;)a+="=";return a}e.exports=function(e){return{encode:t=>r("string"==typeof t?Uint8Array.from(t):t,e),decode(t){for(const n of t)if(e.indexOf(n)<0)throw new Error("invalid base32 character");return function(e,t){const n=(e=e.replace(new RegExp("=","g"),"")).length;let r=0,i=0,s=0;const o=new Uint8Array(5*n/8|0);for(let a=0;a=8&&(o[s++]=i>>>r-8&255,r-=8);return o.buffer}(t,e)}}}},function(e,t,n){"use strict";const{Buffer:r}=n(0);e.exports=function(e){const t=e.indexOf("=")>-1,n=e.indexOf("-")>-1&&e.indexOf("_")>-1;return{encode(e){let i="";i="string"==typeof e?r.from(e).toString("base64"):e.toString("base64"),n&&(i=i.replace(/\+/g,"-").replace(/\//g,"_"));const s=i.indexOf("=");return s>0&&!t&&(i=i.substring(0,s)),i},decode(t){for(const n of t)if(e.indexOf(n)<0)throw new Error("invalid base64 character");return r.from(t,"base64")}}}},function(e,t){e.exports=function e(t,r,i){r=r||[];var s=i=i||0;for(;t>=n;)r[i++]=255&t|128,t/=128;for(;-128&t;)r[i++]=255&t|128,t>>>=7;return r[i]=0|t,e.bytes=i-s+1,r};var n=Math.pow(2,31)},function(e,t){e.exports=function e(t,n){var r,i=0,s=0,o=n=n||0,a=t.length;do{if(o>=a)throw e.bytes=0,new RangeError("Could not decode varint");r=t[o++],i+=s<28?(127&r)<=128);return e.bytes=o-n,i}},function(e,t){var n=Math.pow(2,7),r=Math.pow(2,14),i=Math.pow(2,21),s=Math.pow(2,28),o=Math.pow(2,35),a=Math.pow(2,42),u=Math.pow(2,49),c=Math.pow(2,56),l=Math.pow(2,63);e.exports=function(e){return e(e[t[0]]=new r(t[0],t[1],t[2],t[3]),e),{}),l=u.reduce((e,t)=>(e[t[1]]=c[t[0]],e),{});e.exports={names:c,codes:l}},function(e,t,n){"use strict";e.exports=class{constructor(e,t,n,r){this.name=e,this.code=t,this.alphabet=r,n&&r&&(this.engine=n(r))}encode(e){return this.engine.encode(e)}decode(e){return this.engine.decode(e)}isImplemented(){return this.engine}}},function(e,t,n){"use strict";const{Buffer:r}=n(0);e.exports=function(e){return{encode:e=>"string"==typeof e?r.from(e).toString("hex"):e.toString("hex"),decode(t){for(const n of t)if(e.indexOf(n)<0)throw new Error("invalid base16 character");return r.from(t,"hex")}}}},function(e,t,n){"use strict";function r(e,t){const n=e.byteLength,r=new Uint8Array(e),i=t.indexOf("=")===t.length-1;i&&(t=t.substring(0,t.length-1));let s=0,o=0,a="";for(let e=0;e=5;)a+=t[o>>>s-5&31],s-=5;if(s>0&&(a+=t[o<<5-s&31]),i)for(;a.length%8!=0;)a+="=";return a}e.exports=function(e){return{encode:t=>r("string"==typeof t?Uint8Array.from(t):t,e),decode(t){for(const n of t)if(e.indexOf(n)<0)throw new Error("invalid base32 character");return function(e,t){const n=(e=e.replace(new RegExp("=","g"),"")).length;let r=0,i=0,s=0;const o=new Uint8Array(5*n/8|0);for(let a=0;a=8&&(o[s++]=i>>>r-8&255,r-=8);return o.buffer}(t,e)}}}},function(e,t,n){"use strict";const{Buffer:r}=n(0);e.exports=function(e){const t=e.indexOf("=")>-1,n=e.indexOf("-")>-1&&e.indexOf("_")>-1;return{encode(e){let i="";i="string"==typeof e?r.from(e).toString("base64"):e.toString("base64"),n&&(i=i.replace(/\+/g,"-").replace(/\//g,"_"));const s=i.indexOf("=");return s>0&&!t&&(i=i.substring(0,s)),i},decode(t){for(const n of t)if(e.indexOf(n)<0)throw new Error("invalid base64 character");return r.from(t,"base64")}}}},function(e,t,n){"use strict";const r=n(11),i=new Map;for(const e in r){const t=r[e];i.set(t,e)}e.exports=Object.freeze(i)},function(e,t,n){"use strict";const r=n(11),i=n(46).varintEncode,s={};for(const e in r){const t=r[e];s[e]=i(t)}e.exports=Object.freeze(s)},function(e,t,n){"use strict";const r=n(11),i={};for(const[e,t]of Object.entries(r))i[e.toUpperCase().replace(/-/g,"_")]=t;e.exports=Object.freeze(i)},function(e,t,n){"use strict";const r=n(11),i={};for(const[e,t]of Object.entries(r))void 0===i[t]&&(i[t]=e);e.exports=Object.freeze(i)},function(e,t,n){"use strict";const r=n(10),{Buffer:i}=n(0);var s={checkCIDComponents:function(e){if(null==e)return"null values are not valid CIDs";if(0!==e.version&&1!==e.version)return"Invalid version, must be a number equal to 1 or 0";if("string"!=typeof e.codec)return"codec must be string";if(0===e.version){if("dag-pb"!==e.codec)return"codec must be 'dag-pb' for CIDv0";if("base58btc"!==e.multibaseName)return"multibaseName must be 'base58btc' for CIDv0"}if(!i.isBuffer(e.multihash))return"multihash must be a Buffer";try{r.validate(e.multihash)}catch(e){let t=e.message;return t||(t="Multihash validation failed"),t}}};e.exports=s},function(e,t,n){"use strict";t.DAGNode=n(118),t.DAGLink=n(54),t.resolver=n(148),t.util=n(55),t.codec=t.util.codec,t.defaultHashAlg=t.util.defaultHashAlg},function(e,t,n){"use strict";e.exports=n(47)},function(e,t,n){ +var r=n(0),i=r.Buffer;function s(e,t){for(var n in e)t[n]=e[n]}function o(e,t,n){return i(e,t,n)}i.from&&i.alloc&&i.allocUnsafe&&i.allocUnsafeSlow?e.exports=r:(s(r,t),t.Buffer=o),o.prototype=Object.create(i.prototype),s(i,o),o.from=function(e,t,n){if("number"==typeof e)throw new TypeError("Argument must not be a number");return i(e,t,n)},o.alloc=function(e,t,n){if("number"!=typeof e)throw new TypeError("Argument must be a number");var r=i(e);return void 0!==t?"string"==typeof n?r.fill(t,n):r.fill(t):r.fill(0),r},o.allocUnsafe=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return i(e)},o.allocUnsafeSlow=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return r.SlowBuffer(e)}},function(e,t,n){"use strict";e.exports=o;var r=n(7),i=Object.create(n(13));function s(e,t){var n=this._transformState;n.transforming=!1;var r=n.writecb;if(!r)return this.emit("error",new Error("write callback called multiple times"));n.writechunk=null,n.writecb=null,null!=t&&this.push(t),r(e);var i=this._readableState;i.reading=!1,(i.needReadable||i.lengthn(),n)},final(e){c.push(u).then(()=>e(),e)}}:{});const h=new l(t);return e.sink&&e.sink({[Symbol.asyncIterator](){return this},async next(){const e=await c.shift();return e===u?{done:!0}:{value:e}},throw:async e=>(h.destroy(e),{done:!0}),return:async()=>(h.destroy(),{done:!0})}),h}}).call(this,n(0).Buffer)},function(e,t,n){"use strict";(function(t,r){var i;e.exports=x,x.ReadableState=E;n(5).EventEmitter;var s=function(e,t){return e.listeners(t).length},o=n(35),a=n(0).Buffer,u=t.Uint8Array||function(){};var c,l=n(73);c=l&&l.debuglog?l.debuglog("stream"):function(){};var h,f,d,p=n(74),b=n(36),g=n(37).getHighWaterMark,y=n(8).codes,m=y.ERR_INVALID_ARG_TYPE,k=y.ERR_STREAM_PUSH_AFTER_EOF,v=y.ERR_METHOD_NOT_IMPLEMENTED,w=y.ERR_STREAM_UNSHIFT_AFTER_END_EVENT;n(2)(x,o);var S=b.errorOrDestroy,_=["error","close","destroy","pause","resume"];function E(e,t,r){i=i||n(9),e=e||{},"boolean"!=typeof r&&(r=t instanceof i),this.objectMode=!!e.objectMode,r&&(this.objectMode=this.objectMode||!!e.readableObjectMode),this.highWaterMark=g(this,e,"readableHighWaterMark",r),this.buffer=new p,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.paused=!0,this.emitClose=!1!==e.emitClose,this.autoDestroy=!!e.autoDestroy,this.destroyed=!1,this.defaultEncoding=e.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,e.encoding&&(h||(h=n(15).StringDecoder),this.decoder=new h(e.encoding),this.encoding=e.encoding)}function x(e){if(i=i||n(9),!(this instanceof x))return new x(e);var t=this instanceof i;this._readableState=new E(e,this,t),this.readable=!0,e&&("function"==typeof e.read&&(this._read=e.read),"function"==typeof e.destroy&&(this._destroy=e.destroy)),o.call(this)}function O(e,t,n,r,i){c("readableAddChunk",t);var s,o=e._readableState;if(null===t)o.reading=!1,function(e,t){if(c("onEofChunk"),t.ended)return;if(t.decoder){var n=t.decoder.end();n&&n.length&&(t.buffer.push(n),t.length+=t.objectMode?1:n.length)}t.ended=!0,t.sync?j(e):(t.needReadable=!1,t.emittedReadable||(t.emittedReadable=!0,C(e)))}(e,o);else if(i||(s=function(e,t){var n;r=t,a.isBuffer(r)||r instanceof u||"string"==typeof t||void 0===t||e.objectMode||(n=new m("chunk",["string","Buffer","Uint8Array"],t));var r;return n}(o,t)),s)S(e,s);else if(o.objectMode||t&&t.length>0)if("string"==typeof t||o.objectMode||Object.getPrototypeOf(t)===a.prototype||(t=function(e){return a.from(e)}(t)),r)o.endEmitted?S(e,new w):A(e,o,t,!0);else if(o.ended)S(e,new k);else{if(o.destroyed)return!1;o.reading=!1,o.decoder&&!n?(t=o.decoder.write(t),o.objectMode||0!==t.length?A(e,o,t,!1):T(e,o)):A(e,o,t,!1)}else r||(o.reading=!1,T(e,o));return!o.ended&&(o.lengtht.highWaterMark&&(t.highWaterMark=function(e){return e>=1073741824?e=1073741824:(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 j(e){var t=e._readableState;c("emitReadable",t.needReadable,t.emittedReadable),t.needReadable=!1,t.emittedReadable||(c("emitReadable",t.flowing),t.emittedReadable=!0,r.nextTick(C,e))}function C(e){var t=e._readableState;c("emitReadable_",t.destroyed,t.length,t.ended),t.destroyed||!t.length&&!t.ended||(e.emit("readable"),t.emittedReadable=!1),t.needReadable=!t.flowing&&!t.ended&&t.length<=t.highWaterMark,B(e)}function T(e,t){t.readingMore||(t.readingMore=!0,r.nextTick(P,e,t))}function P(e,t){for(;!t.reading&&!t.ended&&(t.length0,t.resumeScheduled&&!t.paused?t.flowing=!0:e.listenerCount("data")>0&&e.resume()}function L(e){c("readable nexttick read 0"),e.read(0)}function M(e,t){c("resume",t.reading),t.reading||e.read(0),t.resumeScheduled=!1,e.emit("resume"),B(e),t.flowing&&!t.reading&&e.read(0)}function B(e){var t=e._readableState;for(c("flow",t.flowing);t.flowing&&null!==e.read(););}function D(e,t){return 0===t.length?null:(t.objectMode?n=t.buffer.shift():!e||e>=t.length?(n=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.first():t.buffer.concat(t.length),t.buffer.clear()):n=t.buffer.consume(e,t.decoder),n);var n}function N(e){var t=e._readableState;c("endReadable",t.endEmitted),t.endEmitted||(t.ended=!0,r.nextTick(U,t,e))}function U(e,t){if(c("endReadableNT",e.endEmitted,e.length),!e.endEmitted&&0===e.length&&(e.endEmitted=!0,t.readable=!1,t.emit("end"),e.autoDestroy)){var n=t._writableState;(!n||n.autoDestroy&&n.finished)&&t.destroy()}}function q(e,t){for(var n=0,r=e.length;n=t.highWaterMark:t.length>0)||t.ended))return c("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?N(this):j(this),null;if(0===(e=R(e,t))&&t.ended)return 0===t.length&&N(this),null;var r,i=t.needReadable;return c("need readable",i),(0===t.length||t.length-e0?D(e,t):null)?(t.needReadable=t.length<=t.highWaterMark,e=0):(t.length-=e,t.awaitDrain=0),0===t.length&&(t.ended||(t.needReadable=!0),n!==e&&t.ended&&N(this)),null!==r&&this.emit("data",r),r},x.prototype._read=function(e){S(this,new v("_read()"))},x.prototype.pipe=function(e,t){var n=this,i=this._readableState;switch(i.pipesCount){case 0:i.pipes=e;break;case 1:i.pipes=[i.pipes,e];break;default:i.pipes.push(e)}i.pipesCount+=1,c("pipe count=%d opts=%j",i.pipesCount,t);var o=(!t||!1!==t.end)&&e!==r.stdout&&e!==r.stderr?u:g;function a(t,r){c("onunpipe"),t===n&&r&&!1===r.hasUnpiped&&(r.hasUnpiped=!0,c("cleanup"),e.removeListener("close",p),e.removeListener("finish",b),e.removeListener("drain",l),e.removeListener("error",d),e.removeListener("unpipe",a),n.removeListener("end",u),n.removeListener("end",g),n.removeListener("data",f),h=!0,!i.awaitDrain||e._writableState&&!e._writableState.needDrain||l())}function u(){c("onend"),e.end()}i.endEmitted?r.nextTick(o):n.once("end",o),e.on("unpipe",a);var l=function(e){return function(){var t=e._readableState;c("pipeOnDrain",t.awaitDrain),t.awaitDrain&&t.awaitDrain--,0===t.awaitDrain&&s(e,"data")&&(t.flowing=!0,B(e))}}(n);e.on("drain",l);var h=!1;function f(t){c("ondata");var r=e.write(t);c("dest.write",r),!1===r&&((1===i.pipesCount&&i.pipes===e||i.pipesCount>1&&-1!==q(i.pipes,e))&&!h&&(c("false write response, pause",i.awaitDrain),i.awaitDrain++),n.pause())}function d(t){c("onerror",t),g(),e.removeListener("error",d),0===s(e,"error")&&S(e,t)}function p(){e.removeListener("finish",b),g()}function b(){c("onfinish"),e.removeListener("close",p),g()}function g(){c("unpipe"),n.unpipe(e)}return n.on("data",f),function(e,t,n){if("function"==typeof e.prependListener)return e.prependListener(t,n);e._events&&e._events[t]?Array.isArray(e._events[t])?e._events[t].unshift(n):e._events[t]=[n,e._events[t]]:e.on(t,n)}(e,"error",d),e.once("close",p),e.once("finish",b),e.emit("pipe",n),i.flowing||(c("pipe resume"),n.resume()),e},x.prototype.unpipe=function(e){var t=this._readableState,n={hasUnpiped:!1};if(0===t.pipesCount)return this;if(1===t.pipesCount)return e&&e!==t.pipes||(e||(e=t.pipes),t.pipes=null,t.pipesCount=0,t.flowing=!1,e&&e.emit("unpipe",this,n)),this;if(!e){var r=t.pipes,i=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var s=0;s0,!1!==i.flowing&&this.resume()):"readable"===e&&(i.endEmitted||i.readableListening||(i.readableListening=i.needReadable=!0,i.flowing=!1,i.emittedReadable=!1,c("on readable",i.length,i.reading),i.length?j(this):i.reading||r.nextTick(L,this))),n},x.prototype.addListener=x.prototype.on,x.prototype.removeListener=function(e,t){var n=o.prototype.removeListener.call(this,e,t);return"readable"===e&&r.nextTick(I,this),n},x.prototype.removeAllListeners=function(e){var t=o.prototype.removeAllListeners.apply(this,arguments);return"readable"!==e&&void 0!==e||r.nextTick(I,this),t},x.prototype.resume=function(){var e=this._readableState;return e.flowing||(c("resume"),e.flowing=!e.readableListening,function(e,t){t.resumeScheduled||(t.resumeScheduled=!0,r.nextTick(M,e,t))}(this,e)),e.paused=!1,this},x.prototype.pause=function(){return c("call pause flowing=%j",this._readableState.flowing),!1!==this._readableState.flowing&&(c("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this},x.prototype.wrap=function(e){var t=this,n=this._readableState,r=!1;for(var i in e.on("end",(function(){if(c("wrapped end"),n.decoder&&!n.ended){var e=n.decoder.end();e&&e.length&&t.push(e)}t.push(null)})),e.on("data",(function(i){(c("wrapped data"),n.decoder&&(i=n.decoder.write(i)),n.objectMode&&null==i)||(n.objectMode||i&&i.length)&&(t.push(i)||(r=!0,e.pause()))})),e)void 0===this[i]&&"function"==typeof e[i]&&(this[i]=function(t){return function(){return e[t].apply(e,arguments)}}(i));for(var s=0;s<_.length;s++)e.on(_[s],this.emit.bind(this,_[s]));return this._read=function(t){c("wrapped _read",t),r&&(r=!1,e.resume())},this},"function"==typeof Symbol&&(x.prototype[Symbol.asyncIterator]=function(){return void 0===f&&(f=n(76)),f(this)}),Object.defineProperty(x.prototype,"readableHighWaterMark",{enumerable:!1,get:function(){return this._readableState.highWaterMark}}),Object.defineProperty(x.prototype,"readableBuffer",{enumerable:!1,get:function(){return this._readableState&&this._readableState.buffer}}),Object.defineProperty(x.prototype,"readableFlowing",{enumerable:!1,get:function(){return this._readableState.flowing},set:function(e){this._readableState&&(this._readableState.flowing=e)}}),x._fromList=D,Object.defineProperty(x.prototype,"readableLength",{enumerable:!1,get:function(){return this._readableState.length}}),"function"==typeof Symbol&&(x.from=function(e,t){return void 0===d&&(d=n(77)),d(x,e,t)})}).call(this,n(3),n(1))},function(e,t,n){e.exports=n(5).EventEmitter},function(e,t,n){"use strict";(function(t){function n(e,t){i(e,t),r(e)}function r(e){e._writableState&&!e._writableState.emitClose||e._readableState&&!e._readableState.emitClose||e.emit("close")}function i(e,t){e.emit("error",t)}e.exports={destroy:function(e,s){var o=this,a=this._readableState&&this._readableState.destroyed,u=this._writableState&&this._writableState.destroyed;return a||u?(s?s(e):e&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,t.nextTick(i,this,e)):t.nextTick(i,this,e)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(e||null,(function(e){!s&&e?o._writableState?o._writableState.errorEmitted?t.nextTick(r,o):(o._writableState.errorEmitted=!0,t.nextTick(n,o,e)):t.nextTick(n,o,e):s?(t.nextTick(r,o),s(e)):t.nextTick(r,o)})),this)},undestroy:function(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)},errorOrDestroy:function(e,t){var n=e._readableState,r=e._writableState;n&&n.autoDestroy||r&&r.autoDestroy?e.destroy(t):e.emit("error",t)}}}).call(this,n(1))},function(e,t,n){"use strict";var r=n(8).codes.ERR_INVALID_OPT_VALUE;e.exports={getHighWaterMark:function(e,t,n,i){var s=function(e,t,n){return null!=e.highWaterMark?e.highWaterMark:t?e[n]:null}(t,i,n);if(null!=s){if(!isFinite(s)||Math.floor(s)!==s||s<0)throw new r(i?n:"highWaterMark",s);return Math.floor(s)}return e.objectMode?16:16384}}},function(e,t,n){"use strict";(function(t,r){function i(e){var t=this;this.next=null,this.entry=null,this.finish=function(){!function(e,t,n){var r=e.entry;e.entry=null;for(;r;){var i=r.callback;t.pendingcb--,i(n),r=r.next}t.corkedRequestsFree.next=e}(t,e)}}var s;e.exports=x,x.WritableState=E;var o={deprecate:n(30)},a=n(35),u=n(0).Buffer,c=t.Uint8Array||function(){};var l,h=n(36),f=n(37).getHighWaterMark,d=n(8).codes,p=d.ERR_INVALID_ARG_TYPE,b=d.ERR_METHOD_NOT_IMPLEMENTED,g=d.ERR_MULTIPLE_CALLBACK,y=d.ERR_STREAM_CANNOT_PIPE,m=d.ERR_STREAM_DESTROYED,k=d.ERR_STREAM_NULL_VALUES,v=d.ERR_STREAM_WRITE_AFTER_END,w=d.ERR_UNKNOWN_ENCODING,S=h.errorOrDestroy;function _(){}function E(e,t,o){s=s||n(9),e=e||{},"boolean"!=typeof o&&(o=t instanceof s),this.objectMode=!!e.objectMode,o&&(this.objectMode=this.objectMode||!!e.writableObjectMode),this.highWaterMark=f(this,e,"writableHighWaterMark",o),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var a=!1===e.decodeStrings;this.decodeStrings=!a,this.defaultEncoding=e.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(e){!function(e,t){var n=e._writableState,i=n.sync,s=n.writecb;if("function"!=typeof s)throw new g;if(function(e){e.writing=!1,e.writecb=null,e.length-=e.writelen,e.writelen=0}(n),t)!function(e,t,n,i,s){--t.pendingcb,n?(r.nextTick(s,i),r.nextTick(T,e,t),e._writableState.errorEmitted=!0,S(e,i)):(s(i),e._writableState.errorEmitted=!0,S(e,i),T(e,t))}(e,n,i,t,s);else{var o=j(n)||e.destroyed;o||n.corked||n.bufferProcessing||!n.bufferedRequest||R(e,n),i?r.nextTick(A,e,n,o,s):A(e,n,o,s)}}(t,e)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=!1!==e.emitClose,this.autoDestroy=!!e.autoDestroy,this.bufferedRequestCount=0,this.corkedRequestsFree=new i(this)}function x(e){var t=this instanceof(s=s||n(9));if(!t&&!l.call(x,this))return new x(e);this._writableState=new E(e,this,t),this.writable=!0,e&&("function"==typeof e.write&&(this._write=e.write),"function"==typeof e.writev&&(this._writev=e.writev),"function"==typeof e.destroy&&(this._destroy=e.destroy),"function"==typeof e.final&&(this._final=e.final)),a.call(this)}function O(e,t,n,r,i,s,o){t.writelen=r,t.writecb=o,t.writing=!0,t.sync=!0,t.destroyed?t.onwrite(new m("write")):n?e._writev(i,t.onwrite):e._write(i,s,t.onwrite),t.sync=!1}function A(e,t,n,r){n||function(e,t){0===t.length&&t.needDrain&&(t.needDrain=!1,e.emit("drain"))}(e,t),t.pendingcb--,r(),T(e,t)}function R(e,t){t.bufferProcessing=!0;var n=t.bufferedRequest;if(e._writev&&n&&n.next){var r=t.bufferedRequestCount,s=new Array(r),o=t.corkedRequestsFree;o.entry=n;for(var a=0,u=!0;n;)s[a]=n,n.isBuf||(u=!1),n=n.next,a+=1;s.allBuffers=u,O(e,t,!0,t.length,s,"",o.finish),t.pendingcb++,t.lastBufferedRequest=null,o.next?(t.corkedRequestsFree=o.next,o.next=null):t.corkedRequestsFree=new i(t),t.bufferedRequestCount=0}else{for(;n;){var c=n.chunk,l=n.encoding,h=n.callback;if(O(e,t,!1,t.objectMode?1:c.length,c,l,h),n=n.next,t.bufferedRequestCount--,t.writing)break}null===n&&(t.lastBufferedRequest=null)}t.bufferedRequest=n,t.bufferProcessing=!1}function j(e){return e.ending&&0===e.length&&null===e.bufferedRequest&&!e.finished&&!e.writing}function C(e,t){e._final((function(n){t.pendingcb--,n&&S(e,n),t.prefinished=!0,e.emit("prefinish"),T(e,t)}))}function T(e,t){var n=j(t);if(n&&(function(e,t){t.prefinished||t.finalCalled||("function"!=typeof e._final||t.destroyed?(t.prefinished=!0,e.emit("prefinish")):(t.pendingcb++,t.finalCalled=!0,r.nextTick(C,e,t)))}(e,t),0===t.pendingcb&&(t.finished=!0,e.emit("finish"),t.autoDestroy))){var i=e._readableState;(!i||i.autoDestroy&&i.endEmitted)&&e.destroy()}return n}n(2)(x,a),E.prototype.getBuffer=function(){for(var e=this.bufferedRequest,t=[];e;)t.push(e),e=e.next;return t},function(){try{Object.defineProperty(E.prototype,"buffer",{get:o.deprecate((function(){return this.getBuffer()}),"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch(e){}}(),"function"==typeof Symbol&&Symbol.hasInstance&&"function"==typeof Function.prototype[Symbol.hasInstance]?(l=Function.prototype[Symbol.hasInstance],Object.defineProperty(x,Symbol.hasInstance,{value:function(e){return!!l.call(this,e)||this===x&&(e&&e._writableState instanceof E)}})):l=function(e){return e instanceof this},x.prototype.pipe=function(){S(this,new y)},x.prototype.write=function(e,t,n){var i,s=this._writableState,o=!1,a=!s.objectMode&&(i=e,u.isBuffer(i)||i instanceof c);return a&&!u.isBuffer(e)&&(e=function(e){return u.from(e)}(e)),"function"==typeof t&&(n=t,t=null),a?t="buffer":t||(t=s.defaultEncoding),"function"!=typeof n&&(n=_),s.ending?function(e,t){var n=new v;S(e,n),r.nextTick(t,n)}(this,n):(a||function(e,t,n,i){var s;return null===n?s=new k:"string"==typeof n||t.objectMode||(s=new p("chunk",["string","Buffer"],n)),!s||(S(e,s),r.nextTick(i,s),!1)}(this,s,e,n))&&(s.pendingcb++,o=function(e,t,n,r,i,s){if(!n){var o=function(e,t,n){e.objectMode||!1===e.decodeStrings||"string"!=typeof t||(t=u.from(t,n));return t}(t,r,i);r!==o&&(n=!0,i="buffer",r=o)}var a=t.objectMode?1:r.length;t.length+=a;var c=t.length-1))throw new w(e);return this._writableState.defaultEncoding=e,this},Object.defineProperty(x.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(x.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),x.prototype._write=function(e,t,n){n(new b("_write()"))},x.prototype._writev=null,x.prototype.end=function(e,t,n){var i=this._writableState;return"function"==typeof e?(n=e,e=null,t=null):"function"==typeof t&&(n=t,t=null),null!=e&&this.write(e,t),i.corked&&(i.corked=1,this.uncork()),i.ending||function(e,t,n){t.ending=!0,T(e,t),n&&(t.finished?r.nextTick(n):e.once("finish",n));t.ended=!0,e.writable=!1}(this,i,n),this},Object.defineProperty(x.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(x.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(e){this._writableState&&(this._writableState.destroyed=e)}}),x.prototype.destroy=h.destroy,x.prototype._undestroy=h.undestroy,x.prototype._destroy=function(e,t){t(e)}}).call(this,n(3),n(1))},function(e,t,n){"use strict";e.exports=l;var r=n(8).codes,i=r.ERR_METHOD_NOT_IMPLEMENTED,s=r.ERR_MULTIPLE_CALLBACK,o=r.ERR_TRANSFORM_ALREADY_TRANSFORMING,a=r.ERR_TRANSFORM_WITH_LENGTH_0,u=n(9);function c(e,t){var n=this._transformState;n.transforming=!1;var r=n.writecb;if(null===r)return this.emit("error",new s);n.writechunk=null,n.writecb=null,null!=t&&this.push(t),r(e);var i=this._readableState;i.reading=!1,(i.needReadable||i.length{const e={};return e.promise=new Promise((t,n)=>{e.resolve=t,e.reject=n}),e}},function(e,t,n){"use strict";(function(t){const r=n(42),i=n(92),s=n(20),o=n(151),a=n(57),u=n(21),c=n(56),{LastWriteWins:l,NoZeroes:h}=c,f=n(154),{isDefined:d,findUniques:p}=n(22),b=n(155),g=e=>e.hash,y=(e,t)=>e.concat(t),m=e=>e.next,k=(e,t)=>Math.max(e,t.clock.time),v=(e,t)=>(e[t.hash]=t,e);class w extends i{constructor(e,t,{logId:n,access:r,entries:i,heads:s,clock:o,sortFn:c,concurrency:p}={}){if(!d(e))throw a.IPFSNotDefinedError();if(!d(t))throw new Error("Identity is required");if(d(r)||(r=new f),d(i)&&!Array.isArray(i))throw new Error("'entries' argument must be an array of Entry instances");if(d(s)&&!Array.isArray(s))throw new Error("'heads' argument must be an array");d(c)||(c=l),super(),this._sortFn=h(c),this._storage=e,this._id=n||(new Date).getTime().toString(),this._access=r,this._identity=t;const g=(i||[]).reduce(v,{});this._entryIndex=new b(g),i=Object.values(g)||[],s=s||w.findHeads(i),this._headsIndex=s.reduce(v,{}),this._nextsIndex={};i.forEach(e=>e.next.forEach(t=>this._nextsIndex[t]=e.hash)),this._length=i.length;const y=Math.max(o?o.time:0,this.heads.reduce(k,0));this._clock=new u(this._identity.publicKey,y),this.joinConcurrency=p||16}get id(){return this._id}get clock(){return this._clock}get length(){return this._length}get values(){return Object.values(this.traverse(this.heads)).reverse()}get heads(){return Object.values(this._headsIndex).sort(this._sortFn).reverse()}get tails(){return w.findTails(this.values)}get tailHashes(){return w.findTailHashes(this.values)}setIdentity(e){this._identity=e;const t=Math.max(this.clock.time,this.heads.reduce(k,0));this._clock=new u(this._identity.publicKey,t)}get(e){return this._entryIndex.get(e)}has(e){return void 0!==this._entryIndex.get(e.hash||e)}traverse(e,t=-1,n){let r=e.sort(this._sortFn).reverse(),i={},s={},o=0;const a=e=>this.get(e),u=e=>{e&&!i[e.hash]&&(r=[e,...r].sort(this._sortFn).reverse(),i[e.hash]=!0)};for(;r.length>0&&(o{let t=new Set;for(let n=1;n<=e;n*=2){const e=Math.min(n-1,i.length-1);t.add(i[e])}return t})(Math.min(t,i.length));i.length!a.includes(e)),l=await s.create(this._storage,this._identity,this.id,e,a,this.clock,c,n);if(!await this._access.canAppend(l,this._identity.provider))throw new Error(`Could not append entry, key "${this._identity.id}" is not allowed to write to the log`);return this._entryIndex.set(l.hash,l),a.forEach(e=>this._nextsIndex[e]=l.hash),this._headsIndex={},this._headsIndex[l.hash]=l,this._length++,l}iterator({gt:e,gte:t,lt:n,lte:r,amount:i=-1}={}){if(0===i)return function*(){}();if("string"==typeof r&&(r=[this.get(r)]),"string"==typeof n&&(n=[this.get(this.get(n).next)]),r&&!Array.isArray(r))throw a.LtOrLteMustBeStringOrArray();if(n&&!Array.isArray(n))throw a.LtOrLteMustBeStringOrArray();let s=(r||n||this.heads).filter(d),o=t?this.get(t).hash:e?this.get(e).hash:null,u=o?-1:i||-1,c=this.traverse(s,u,o),l=Object.values(c);return e&&l.pop(),(e||t)&&i>-1&&(l=l.slice(l.length-i,l.length)),function*(){for(let e in l)yield l[e]}()}async join(e,t=-1){if(!d(e))throw a.LogNotDefinedError();if(!w.isLog(e))throw a.NotALogError();if(this.id!==e.id)return;const n=w.difference(e,this),i=this._identity.provider,o=async e=>{if(!await this._access.canAppend(e,i))throw new Error(`Could not append entry, key "${e.identity.id}" is not allowed to write to the log`)},c=Object.values(n);await r(c,async e=>{await o(e),await(async e=>{const t=await s.verify(i,e),n=e.identity?e.identity.publicKey:e.key;if(!t)throw new Error(`Could not validate signature "${e.sig}" for entry "${e.hash}" and key "${n}"`)})(e)},{concurrency:this.joinConcurrency});Object.values(n).forEach(e=>{this.get(e.hash)||this._length++,e.next.forEach(t=>this._nextsIndex[t]=e.hash)}),this._entryIndex.add(n);const l=Object.values(n).map(m).reduce(y,[]),h=w.findHeads(Object.values(Object.assign({},this._headsIndex,e._headsIndex))).filter(e=>!l.find(t=>t===e.hash)).filter(e=>!this._nextsIndex[e.hash]).reduce(v,{});if(this._headsIndex=h,t>-1){let e=this.values;e=e.slice(-t),this._entryIndex=null,this._entryIndex=new b(e.reduce(v,{})),this._headsIndex=w.findHeads(e).reduce(v,{}),this._length=this._entryIndex.length}const f=Object.values(this._headsIndex).reduce(k,0);return this._clock=new u(this.clock.id,Math.max(this.clock.time,f)),this}toJSON(){return{id:this.id,heads:this.heads.sort(this._sortFn).reverse().map(g)}}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,n)=>{const r=s.findChildren(t,this.values).length;let i=new Array(Math.max(r-1,0));return i=r>1?i.fill(" "):i,i=r>0?i.concat(["└─"]):i,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({format:e}={}){return o.toMultihash(this._storage,this,{format:e})}static async fromMultihash(e,t,n,{access:r,length:i=-1,exclude:s=[],timeout:a,concurrency:u,sortFn:c,onProgressCallback:l}={}){const{logId:h,entries:f,heads:d}=await o.fromMultihash(e,n,{length:i,exclude:s,timeout:a,onProgressCallback:l,concurrency:u,sortFn:c});return new w(e,t,{logId:h,access:r,entries:f,heads:d,sortFn:c})}static async fromEntryHash(e,t,n,{logId:r,access:i,length:s=-1,exclude:a=[],timeout:u,concurrency:c,sortFn:l,onProgressCallback:h}={}){const{entries:f}=await o.fromEntryHash(e,n,{length:s,exclude:a,timeout:u,concurrency:c,onProgressCallback:h});return new w(e,t,{logId:r,access:i,entries:f,sortFn:l})}static async fromJSON(e,t,n,{access:r,length:i=-1,timeout:s,sortFn:a,onProgressCallback:u}={}){const{logId:c,entries:l}=await o.fromJSON(e,n,{length:i,timeout:s,onProgressCallback:u});return new w(e,t,{logId:c,access:r,entries:l,sortFn:a})}static async fromEntry(e,t,n,{access:r,length:i=-1,exclude:s=[],timeout:a,concurrency:u,sortFn:c,onProgressCallback:l}={}){const{logId:h,entries:f}=await o.fromEntry(e,n,{length:i,exclude:s,timeout:a,concurrency:u,onProgressCallback:l});return new w(e,t,{logId:h,access:r,entries:f,sortFn:c})}static findHeads(e){var t=e.reduce((e,t,n,r)=>(t.next.forEach(n=>e[n]=t.hash),e),{});return e.filter(e=>void 0===t[e.hash]).sort((e,t)=>e.clock.id>t.clock.id)}static findTails(e){var t={},n=[],r={},i=[];e.forEach(e=>{0===e.next.length&&n.push(e);e.next.forEach(n=>{t[n]||(t[n]=[]),t[n].push(e)}),i=i.concat(e.next),r[e.hash]=!0});const o=i.filter(e=>void 0===r[e]).map(e=>t[e]).reduce((e,t,n,r)=>e.concat(p(t,"hash")),[]).concat(n);return p(o,"hash").sort(s.compare)}static findTailHashes(e){var t={};return e.forEach(e=>t[e.hash]=!0),e.reduce((e,n,r,i)=>(n.next.reverse().forEach(n=>{void 0===t[n]&&e.splice(0,0,n)}),e),[])}static difference(e,t){let n=Object.keys(e._headsIndex),r={},i={};const s=e=>{r[e]||t.get(e)||(n.push(e),r[e]=!0)};for(;n.length>0;){const o=n.shift(),a=e.get(o);a&&!t.get(o)&&a.id===t.id&&(i[a.hash]=a,r[a.hash]=!0,a.next.forEach(s))}return i}}e.exports=w,e.exports.Sorting=c,e.exports.Entry=s,e.exports.AccessController=f}).call(this,n(0).Buffer)},function(e,t,n){"use strict";e.exports=(e,t,n)=>new Promise((r,i)=>{if(n=Object.assign({concurrency:1/0},n),"function"!=typeof t)throw new TypeError("Mapper function is required");const s=n.concurrency;if(!("number"==typeof s&&s>=1))throw new TypeError(`Expected \`concurrency\` to be a number from 1 and up, got \`${s}\` (${typeof s})`);const o=[],a=e[Symbol.iterator]();let u=!1,c=!1,l=0,h=0;const f=()=>{if(u)return;const e=a.next(),n=h;if(h++,e.done)return c=!0,void(0===l&&r(o));l++,Promise.resolve(e.value).then(e=>t(e,n)).then(e=>{o[n]=e,l--,f()},e=>{u=!0,i(e)})};for(let e=0;ee?Array.isArray(e)?e.map(s):new r(e):e,o=(e,t)=>{if(!e||"string"==typeof e)return e;if(Array.isArray(e))return e.map(o);if(e["/"])return e["/"];const n=t.base||"base58btc";return e.toBaseEncodedString(n)},a={"dag-pb":{read:async(e,t)=>{const n=(await e.dag.get(t)).value;return JSON.parse(n.toJSON().data)},write:async(e,n,r)=>{const s=t.from(JSON.stringify(n)),o=new i.DAGNode(s),a=(await e.dag.put(o,{format:"dag-pb",hashAlg:"sha2-256"})).toV0().toBaseEncodedString();return(r.pin||!1)&&await e.pin.add(a),a}},"dag-cbor":{write:async(e,t,n)=>{const r=Object.assign({},t);(n.links||[]).forEach(e=>{r[e]&&(r[e]=s(r[e]))});const i=n.base||"base58btc",o=n.onlyHash||!1,a=(await e.dag.put(r,{onlyHash:o})).toBaseEncodedString(i);return(n.pin||!1)&&await e.pin.add(a),a},read:async(e,t,n)=>{const r=(await e.dag.get(t)).value;return(n.links||[]).forEach(e=>{r[e]&&(r[e]=o(r[e],n))}),r}},raw:{write:async(e,t,n)=>{const r=n.onlyHash||!1,s=n.base||"base58btc",o=Object.assign({},{onlyHash:r},n.format?{format:n.format,hashAlg:"sha2-256"}:{});"dag-pb"===o.format&&(t=new i.DAGNode(t));const a=(await e.dag.put(t,o)).toBaseEncodedString(s);return(n.pin||!1)&&await e.pin.add(a),a}}};e.exports={read:(e,t,n={})=>{t=new r(t);const i=a[t.codec];if(!i)throw new Error("Unsupported codec");return i.read(e,t,n)},write:(e,t,n,r={})=>{const i=a[t];if(!i)throw new Error("Unsupported codec");return i.write(e,n,r)}}}).call(this,n(0).Buffer)},function(e,t,n){"use strict";const{Buffer:r}=n(0),i=n(97);function s(e,t){if(!t)throw new Error("requires an encoded buffer");const n=o(e),i=r.from(n.code);return function(e,t){o(e).decode(t.toString())}(n.name,t),r.concat([i,t])}function o(e){let t;if(i.names[e])t=i.names[e];else{if(!i.codes[e])throw new Error("Unsupported encoding");t=i.codes[e]}if(!t.isImplemented())throw new Error("Base "+e+" is not implemented yet");return t}(t=e.exports=s).encode=function(e,t){const n=o(e);return s(n.name,r.from(n.encode(t)))},t.decode=function(e){r.isBuffer(e)&&(e=e.toString());const t=e.substring(0,1);"string"==typeof(e=e.substring(1,e.length))&&(e=r.from(e));const n=o(t);return r.from(n.decode(e.toString()))},t.isEncoded=function(e){r.isBuffer(e)&&(e=e.toString());if("[object String]"!==Object.prototype.toString.call(e))return!1;const t=e.substring(0,1);try{return o(t).name}catch(e){return!1}},t.names=Object.freeze(Object.keys(i.names)),t.codes=Object.freeze(Object.keys(i.codes))},function(e,t,n){"use strict";var r=n(31).Buffer;e.exports=function(e){if(e.length>=255)throw new TypeError("Alphabet too long");for(var t=new Uint8Array(256),n=0;n>>0,l=new Uint8Array(o);e[n];){var h=t[e.charCodeAt(n)];if(255===h)return;for(var f=0,d=o-1;(0!==h||f>>0,l[d]=h%256>>>0,h=h/256>>>0;if(0!==h)throw new Error("Non-zero carry");s=f,n++}if(" "!==e[n]){for(var p=o-s;p!==o&&0===l[p];)p++;var b=r.allocUnsafe(i+(o-p));b.fill(0,0,i);for(var g=i;p!==o;)b[g++]=l[p++];return b}}}return{encode:function(t){if((Array.isArray(t)||t instanceof Uint8Array)&&(t=r.from(t)),!r.isBuffer(t))throw new TypeError("Expected Buffer");if(0===t.length)return"";for(var n=0,i=0,s=0,o=t.length;s!==o&&0===t[s];)s++,n++;for(var c=(o-s)*l+1>>>0,h=new Uint8Array(c);s!==o;){for(var f=t[s],d=0,p=c-1;(0!==f||d>>0,h[p]=f%a>>>0,f=f/a>>>0;if(0!==f)throw new Error("Non-zero carry");i=d,s++}for(var b=c-i;b!==c&&0===h[b];)b++;for(var g=u.repeat(n);bo.isDAGLink(e)?e:o.util.createDagLinkFromB58EncodedHash(e)),t=s(t),this._data=e,this._links=t,this._serializedSize=n,this._size=null}toJSON(){return this._json||(this._json=Object.freeze({data:this.Data,links:this._links.map(e=>e.toJSON()),size:this.size})),Object.assign({},this._json)}toString(){return`DAGNode `}_invalidateCached(){this._serializedSize=null,this._size=null}addLink(e){return this._invalidateCached(),c(this,e)}rmLink(e){return this._invalidateCached(),l(this,e)}toDAGLink(e){return u(this,e)}serialize(){return a({Data:this._data,Links:this._links})}get size(){return null===this._size&&(null===this._serializedSize&&(this._serializedSize=this.serialize().length),this._size=this._links.reduce((e,t)=>e+t.Tsize,this._serializedSize)),this._size}set size(e){throw new Error("Can't set property: 'size' is immutable")}get Data(){return this._data}set Data(e){throw new Error("Can't set property: 'Data' is immutable")}get Links(){return this._links.map(e=>({Name:e.Name,Tsize:e.Tsize,Hash:e.Hash}))}set Links(e){throw new Error("Can't set property: 'Links' is immutable")}},{className:"DAGNode",symbolName:"@ipld/js-ipld-dag-pb/dagnode"})},function(e,t,n){"use strict";const{Buffer:r}=n(0),i=n(119),s=(e,t)=>r.compare(e.nameAsBuffer,t.nameAsBuffer);e.exports=e=>i(e,s)},function(e,t,n){"use strict";const r=n(50)(n(51)),i=n(12);t=e.exports;const s=e=>{const t=e.Data,n=e.Links||[];return r.PBNode.encode((e=>{const t={};return e.Data&&e.Data.length>0?t.Data=e.Data:t.Data=null,e.Links&&e.Links.length>0?t.Links=e.Links.map(e=>({Hash:e.Hash.buffer,Name:e.Name,Tsize:e.Tsize})):t.Links=null,t})({Data:t,Links:n}))};t.serializeDAGNode=s,t.serializeDAGNodeLike=(e,t=[])=>{const n={Data:e};return n.Links=t.map(e=>i.isDAGLink(e)?e:i.util.createDagLinkFromB58EncodedHash(e)),s(n)}},function(e,t,n){"use strict";var r=n(121);const{Buffer:i}=n(0);var s=n(125);e.exports=function(e,t){if(t||(t={}),!e)throw new Error("Pass in a .proto string or a protobuf-schema parsed object");var n="object"!=typeof e||i.isBuffer(e)?r.parse(e):e,o=function(){var e=this;s(n,t.encodings||{}).forEach((function(t){e[t.name]=function(e){if(!e)return null;var t={};return Object.keys(e).forEach((function(n){t[n]=e[n].value})),t}(t.values)||t}))};return o.prototype.toString=function(){return r.stringify(n)},o.prototype.toJSON=function(){return n},new o}},function(e,t,n){"use strict";e.exports="// An IPFS MerkleDAG Link\nmessage PBLink {\n\n // multihash of the target object\n optional bytes Hash = 1;\n\n // utf string name. should be unique per object\n optional string Name = 2;\n\n // cumulative size of target object\n optional uint64 Tsize = 3;\n}\n\n// An IPFS MerkleDAG Node\nmessage PBNode {\n\n // refs to other objects\n repeated PBLink Links = 2;\n\n // opaque user data\n optional bytes Data = 1;\n}"},function(e,t,n){"use strict";const r=n(17),i=n(23),s=n(132);(t=e.exports).codec=i.DAG_PB,t.defaultHashAlg=i.SHA2_256;t.cid=async(e,n)=>{const o={cidVersion:1,hashAlg:t.defaultHashAlg},a=Object.assign(o,n),u=await s(e,a.hashAlg),c=i.print[t.codec];return new r(a.cidVersion,c,u)}},function(e,t,n){(function(t){function n(e){return(4294967296+e).toString(16).substring(1)}e.exports={normalizeInput:function(e){var n;if(e instanceof Uint8Array)n=e;else if(e instanceof t)n=new Uint8Array(e);else{if("string"!=typeof e)throw new Error("Input must be an string, Buffer or Uint8Array");n=new Uint8Array(t.from(e,"utf8"))}return n},toHex:function(e){return Array.prototype.map.call(e,(function(e){return(e<16?"0":"")+e.toString(16)})).join("")},debugPrint:function(e,t,r){for(var i="\n"+e+" = ",s=0;so.isDAGNode(e)?e.serialize():a(e.Data,e.Links),t.deserialize=e=>{const t=i.PBNode.decode(e),n=t.Links.map(e=>new s(e.Name,e.Tsize,e.Hash)),a=null==t.Data?r.alloc(0):t.Data;return new o(a,n,e.length)},t.cid=(e,t)=>u.cid(e,t)},function(e,t,n){"use strict";const r=n(21);function i(e,t,n){const i=r.compare(e.clock,t.clock);return 0===i?n(e,t):i}function s(e,t,n){return e.clock.id===t.clock.id?n(e,t):e.clock.ide,r=(e,t)=>s(e,t,n);return((e,t)=>i(e,t,r))(e,t)},t.SortByEntryHash=function(e,t){const n=(e,t)=>e.hashs(e,t,n);return((e,t)=>i(e,t,r))(e,t)},t.NoZeroes=function(e){const t=`Your log's tiebreaker function, ${e.name}, has returned zero and therefore cannot be`;return(n,r)=>{const i=e(n,r);if(0===i)throw Error(t);return i}}},function(e,t,n){"use strict";e.exports={IPFSNotDefinedError:()=>new Error("IPFS instance not defined"),LogNotDefinedError:()=>new Error("Log instance not defined"),NotALogError:()=>new Error("Given argument is not an instance of Log"),CannotJoinWithDifferentId:()=>new Error("Can't join logs with different IDs"),LtOrLteMustBeStringOrArray:()=>new Error("lt or lte must be a string or array of Entries")}},function(e,t,n){"use strict";(function(t){const r=n(163),i=n(164).format,s=n(5).EventEmitter;let o=!(t.type&&"renderer"===t.type||!t.version);const a={DEBUG:"DEBUG",INFO:"INFO",WARN:"WARN",ERROR:"ERROR",NONE:"NONE"};let u=a.DEBUG,c=null,l=new s,h={Black:0,Red:1,Green:2,Yellow:3,Blue:4,Magenta:5,Cyan:6,Grey:7,White:9,Default:9};o||(h={Black:"Black",Red:"IndianRed",Green:"LimeGreen",Yellow:"Orange",Blue:"RoyalBlue",Magenta:"Orchid",Cyan:"SkyBlue",Grey:"DimGrey",White:"White",Default:"Black"});const f=[h.Cyan,h.Green,h.Yellow,h.Red,h.Default],d={useColors:!0,color:h.Default,showTimestamp:!0,useLocalTime:!1,showLevel:!0,filename:c,appendFile:!0};class p{constructor(e,t){this.category=e;let n={};Object.assign(n,d),Object.assign(n,t),this.options=n,this.debug=this.debug.bind(this),this.log=this.log.bind(this),this.info=this.info.bind(this),this.warn=this.warn.bind(this),this.error=this.error.bind(this)}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&&o&&(this.fileWriter=r.openSync(this.options.filename||c,this.options.appendFile?"a+":"w+"));let n=this._format(e,t),i=this._createLogMessage(e,t),s=this._createLogMessage(e,t,n.timestamp,n.level,n.category,n.text);this.fileWriter&&o&&r.writeSync(this.fileWriter,i+"\n",null,"utf-8"),o||!this.options.useColors?(console.log(s),l.emit("data",this.category,e,t)):e===a.ERROR?this.options.showTimestamp&&this.options.showLevel?console.error(s,n.timestamp,n.level,n.category,n.text):this.options.showTimestamp&&!this.options.showLevel?console.error(s,n.timestamp,n.category,n.text):!this.options.showTimestamp&&this.options.showLevel?console.error(s,n.level,n.category,n.text):console.error(s,n.category,n.text):this.options.showTimestamp&&this.options.showLevel?console.log(s,n.timestamp,n.level,n.category,n.text):this.options.showTimestamp&&!this.options.showLevel?console.log(s,n.timestamp,n.category,n.text):!this.options.showTimestamp&&this.options.showLevel?console.log(s,n.level,n.category,n.text):console.log(s,n.category,n.text)}_format(e,t){let n="",r="",i="",s=": ";if(this.options.useColors){const t=Object.keys(a).map(e=>a[e]).indexOf(e),u=this.options.color;o?(this.options.showTimestamp&&(n="[3"+h.Grey+"m"),this.options.showLevel&&(r="[3"+f[t]+";22m"),i="[3"+u+";1m",s=": "):(this.options.showTimestamp&&(n="color:"+h.Grey),this.options.showLevel&&(r="color:"+f[t]),i="color:"+u+"; font-weight: bold")}return{timestamp:n,level:r,category:i,text:s}}_createLogMessage(e,t,n,r,i,s){n=n||"",r=r||"",i=i||"",s=s||": ",!o&&this.options.useColors&&(this.options.showTimestamp&&(n="%c"),this.options.showLevel&&(r="%c"),i="%c",s=": %c");let u="";return this.options.showTimestamp&&!this.options.useLocalTime&&(u+=(new Date).toISOString()+" "),this.options.showTimestamp&&this.options.useLocalTime&&(u+=(new Date).toLocaleString()+" "),u=n+u,this.options.showLevel&&(u+=r+"["+e+"]"+(e===a.INFO||e===a.WARN?" ":"")+" "),u+=i+this.category,u+=s+t,u}_shouldLog(e){let n=void 0!==t&&void 0!==t.env&&void 0!==t.env.LOG?t.env.LOG.toUpperCase():null;n="undefined"!=typeof window&&window.LOG?window.LOG.toUpperCase():n;const r=n||u,i=Object.keys(a).map(e=>a[e]);return i.indexOf(e)>=i.indexOf(r)}}e.exports={Colors:h,LogLevels:a,setLogLevel:e=>{u=e},setLogfile:e=>{c=e},create:(e,t)=>new p(e,t),forceBrowserMode:e=>o=!e,events:l}}).call(this,n(1))},function(e,t,n){"use strict";(function(t){const r=n(62),i=n(5).EventEmitter,s=n(63),o=n(70),a=n(84),{default:u}=n(86),c=n(41),l=c.Entry,h=n(156),f=n(157),d=n(167),p=n(58),b=p.create("orbit-db.store",{color:p.Colors.Blue});p.setLogLevel("ERROR");const g=n(43),y={Index:h,maxHistory:-1,fetchEntryTimeout:null,replicate:!0,referenceCount:32,replicationConcurrency:128,syncLocal:!1,sortFn:void 0};e.exports=class{constructor(e,t,n,s){if(!t)throw new Error("Identity required");const o=Object.assign({},y);Object.assign(o,s),this.options=o,this._type="store",this.id=n.toString(),this.identity=t,this.address=n,this.dbname=n.path||"",this.events=new i,this.remoteHeadsPath=r.join(this.id,"_remoteHeads"),this.localHeadsPath=r.join(this.id,"_localHeads"),this.snapshotPath=r.join(this.id,"snapshot"),this.queuePath=r.join(this.id,"queue"),this.manifestPath=r.join(this.id,"_manifest"),this._ipfs=e,this._cache=s.cache;const a={canAppend:e=>e.identity.publicKey===t.publicKey};this.access=s.accessController||a,this._oplog=new c(this._ipfs,this.identity,{logId:this.id,access:this.access,sortFn:this.options.sortFn}),this._opqueue=new u({concurrency:1}),this._index=new this.options.Index(this.address.root),this._replicationStatus=new d,this._stats={snapshot:{bytesLoaded:-1},syncRequestsReceieved:0};try{this._replicator=new f(this,this.options.replicationConcurrency),this._loader=this._replicator,this._replicator.on("load.added",e=>{this._replicationStatus.queued++,this._recalculateReplicationMax(e.clock?e.clock.time:0),this.events.emit("replicate",this.address.toString(),e)}),this._replicator.on("load.progress",(e,t,n,r,i)=>{this._replicationStatus.buffered>i?this._recalculateReplicationProgress(this.replicationStatus.progress+i):this._recalculateReplicationProgress(this._oplog.length+i),this._replicationStatus.buffered=i,this._recalculateReplicationMax(this.replicationStatus.progress),this.events.emit("replicate.progress",this.address.toString(),t,n,this.replicationStatus.progress,this.replicationStatus.max)});const e=async(e,t)=>{try{for(const t of e)await this._oplog.join(t);this._replicationStatus.queued-=e.length,this._replicationStatus.buffered=this._replicator._buffer.length,await this._updateIndex();const t=this._oplog.heads;await this._cache.set(this.remoteHeadsPath,t),b.debug(`Saved heads ${t.length} [${t.map(e=>e.hash).join(", ")}]`),this.events.emit("replicated",this.address.toString(),e.length)}catch(e){console.error(e)}};this._replicator.on("load.end",e)}catch(e){console.error("Store Error:",e)}this.events.on("replicated.progress",(e,t,n,r,i)=>{this._procEntry(n)}),this.events.on("write",(e,t,n)=>{this._procEntry(t)})}get all(){return Array.isArray(this._index._index)?this._index._index:Object.keys(this._index._index).map(e=>this._index._index[e])}get index(){return this._index._index}get type(){return this._type}get key(){return this._key}get replicationStatus(){return this._replicationStatus}setIdentity(e){this.identity=e,this._oplog.setIdentity(e)}async close(){for(var e in this.options.onClose&&await this.options.onClose(this),await this._opqueue.onIdle(),this._replicator.stop(),this._replicationStatus.reset(),this._stats={snapshot:{bytesLoaded:-1},syncRequestsReceieved:0},this.events._events)this.events.removeAllListeners(e);return this.events.emit("closed",this.address.toString()),Promise.resolve()}async drop(){this.options.onDrop&&await this.options.onDrop(this),await this._cache.del(this.localHeadsPath),await this._cache.del(this.remoteHeadsPath),await this._cache.del(this.snapshotPath),await this._cache.del(this.queuePath),await this._cache.del(this.manifestPath),await this.close(),this._index=new this.options.Index(this.address.root),this._oplog=new c(this._ipfs,this.identity,{logId:this.id,access:this.access,sortFn:this.options.sortFn}),this._cache=this.options.cache}async load(e,{fetchEntryTimeout:t}={}){e=e||this.options.maxHistory,t=t||this.options.fetchEntryTimeout,this.options.onLoad&&await this.options.onLoad(this);const n=await this._cache.get(this.localHeadsPath)||[],r=await this._cache.get(this.remoteHeadsPath)||[],i=n.concat(r);i.length>0&&this.events.emit("load",this.address.toString(),i),i.forEach(e=>this._recalculateReplicationMax(e.clock.time));const s=await c.fromEntryHash(this._ipfs,this.identity,i.map(e=>e.hash),{logId:this._oplog.id,access:this.access,sortFn:this.options.sortFn,length:e,exclude:this._oplog.values,onProgressCallback:this._onLoadProgress.bind(this),timeout:t});await this._oplog.join(s,e),i.length>0&&await this._updateIndex(),this.events.emit("ready",this.address.toString(),this._oplog.heads)}async sync(e){if(this._stats.syncRequestsReceieved+=1,b.debug(`Sync request #${this._stats.syncRequestsReceieved} ${e.length}`),0===e.length)return;const t=await a(e,async e=>{if(!e)return console.warn("Warning: Given input entry was 'null'."),Promise.resolve(null);const t=this.identity.provider;if(!t)throw new Error("Identity-provider is required, cannot verify entry");if(!await this.access.canAppend(e,t))return console.warn("Warning: Given input entry is not allowed in this log and was discarded (no write access)."),Promise.resolve(null);const n=l.toEntry(e);return await g.write(this._ipfs,l.getWriteFormat(n),n,{links:l.IPLD_LINKS,onlyHash:!0})!==e.hash&&console.warn("\"WARNING! Head hash didn't match the contents"),e});return await this._replicator.load(t.filter(e=>null!==e)),this._replicator._buffer.length||Object.values(this._replicator._queue).length?new Promise(e=>{const t=(n,r,i,s,o)=>{s===o&&(this.events.off("replicate.progress",t),this.events.once("replicated",e))};this.events.on("replicate.progress",t)}):void 0}loadMoreFrom(e,t){this._replicator.load(t)}async saveSnapshot(){const e=this._replicator.getQueue(),n=this._oplog.toSnapshot(),r=t.from(JSON.stringify({id:n.id,heads:n.heads,size:n.values.length,type:this.type})),i=new s,o=new Uint16Array([r.length]),a=t.from(o.buffer);i.push(a),i.push(r);n.values.forEach(e=>{const n=t.from(JSON.stringify(e)),r=new Uint16Array([n.length]);i.push(t.from(r.buffer)),i.push(n)}),i.push(null);const u=i.read(1/0);let c=this._ipfs.files.add?await this._ipfs.files.add(u):await this._ipfs.add(u);if(!Array.isArray(c)){const e=[];for await(const t of c)t.hash=t.cid.toString(),e.push(t);c=e}return await this._cache.set(this.snapshotPath,c[c.length-1]),await this._cache.set(this.queuePath,e),b.debug(`Saved snapshot: ${c[c.length-1].hash}, queue length: ${e.length}`),c}async loadFromSnapshot(e){this.options.onLoad&&await this.options.onLoad(this),this.events.emit("load",this.address.toString());const n=(e,t)=>Math.max(e,t.clock.time),r=await this._cache.get(this.queuePath);this.sync(r||[]);const i=await this._cache.get(this.snapshotPath);if(!i)throw new Error(`Snapshot for ${this.address} not found!`);{const e=this._ipfs.files.catReadableStream?await this._ipfs.files.catReadableStream(i.hash):this._ipfs.catReadableStream?await this._ipfs.catReadableStream(i.hash):o.readable(this._ipfs.cat(i.hash)),r=()=>new Promise((n,r)=>{let i=t.alloc(0),s=[];e.on("data",e=>{if(this._byteSize+=e.length,s.length<2e4)s.push(e);else{const e=t.concat(s);i=t.concat([i,e]),s=[]}}),e.on("end",()=>{if(s.length>0){const e=t.concat(s);i=t.concat([i,e])}function e(e){for(var t=new ArrayBuffer(e.length),n=new Uint8Array(t),r=0;r{this._recalculateReplicationStatus(n,t.clock.time),this._onLoadProgress(e,t)},a=await r();if(this._recalculateReplicationMax(a.values.reduce(n,0)),a){const e=await c.fromJSON(this._ipfs,this.identity,a,{access:this.access,sortFn:this.options.sortFn,length:-1,timeout:1e3,onProgressCallback:s});await this._oplog.join(e),await this._updateIndex(),this.events.emit("replicated",this.address.toString())}this.events.emit("ready",this.address.toString(),this._oplog.heads)}return this}async _updateIndex(){this._recalculateReplicationMax(),await this._index.updateIndex(this._oplog),this._recalculateReplicationProgress()}async syncLocal(){const e=await this._cache.get(this.localHeadsPath)||[],t=await this._cache.get(this.remoteHeadsPath)||[],n=e.concat(t);for(let e=0;e0?o-4:o;for(n=0;n>16&255,u[l++]=t>>8&255,u[l++]=255&t;2===a&&(t=i[e.charCodeAt(n)]<<2|i[e.charCodeAt(n+1)]>>4,u[l++]=255&t);1===a&&(t=i[e.charCodeAt(n)]<<10|i[e.charCodeAt(n+1)]<<4|i[e.charCodeAt(n+2)]>>2,u[l++]=t>>8&255,u[l++]=255&t);return u},t.fromByteArray=function(e){for(var t,n=e.length,i=n%3,s=[],o=0,a=n-i;oa?a:o+16383));1===i?(t=e[n-1],s.push(r[t>>2]+r[t<<4&63]+"==")):2===i&&(t=(e[n-2]<<8)+e[n-1],s.push(r[t>>10]+r[t>>4&63]+r[t<<2&63]+"="));return s.join("")};for(var r=[],i=[],s="undefined"!=typeof Uint8Array?Uint8Array:Array,o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",a=0,u=o.length;a0)throw new Error("Invalid string. Length must be a multiple of 4");var n=e.indexOf("=");return-1===n&&(n=t),[n,n===t?0:4-n%4]}function l(e,t,n){for(var i,s,o=[],a=t;a>18&63]+r[s>>12&63]+r[s>>6&63]+r[63&s]);return o.join("")}i["-".charCodeAt(0)]=62,i["_".charCodeAt(0)]=63},function(e,t){t.read=function(e,t,n,r,i){var s,o,a=8*i-r-1,u=(1<>1,l=-7,h=n?i-1:0,f=n?-1:1,d=e[t+h];for(h+=f,s=d&(1<<-l)-1,d>>=-l,l+=a;l>0;s=256*s+e[t+h],h+=f,l-=8);for(o=s&(1<<-l)-1,s>>=-l,l+=r;l>0;o=256*o+e[t+h],h+=f,l-=8);if(0===s)s=1-c;else{if(s===u)return o?NaN:1/0*(d?-1:1);o+=Math.pow(2,r),s-=c}return(d?-1:1)*o*Math.pow(2,s-r)},t.write=function(e,t,n,r,i,s){var o,a,u,c=8*s-i-1,l=(1<>1,f=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,d=r?0:s-1,p=r?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,o=l):(o=Math.floor(Math.log(t)/Math.LN2),t*(u=Math.pow(2,-o))<1&&(o--,u*=2),(t+=o+h>=1?f/u:f*Math.pow(2,1-h))*u>=2&&(o++,u/=2),o+h>=l?(a=0,o=l):o+h>=1?(a=(t*u-1)*Math.pow(2,i),o+=h):(a=t*Math.pow(2,h-1)*Math.pow(2,i),o=0));i>=8;e[n+d]=255&a,d+=p,a/=256,i-=8);for(o=o<0;e[n+d]=255&o,d+=p,o/=256,c-=8);e[n+d-p]|=128*b}},function(e,t,n){(function(e){function n(e,t){for(var n=0,r=e.length-1;r>=0;r--){var i=e[r];"."===i?e.splice(r,1):".."===i?(e.splice(r,1),n++):n&&(e.splice(r,1),n--)}if(t)for(;n--;n)e.unshift("..");return e}function r(e,t){if(e.filter)return e.filter(t);for(var n=[],r=0;r=-1&&!i;s--){var o=s>=0?arguments[s]:e.cwd();if("string"!=typeof o)throw new TypeError("Arguments to path.resolve must be strings");o&&(t=o+"/"+t,i="/"===o.charAt(0))}return(i?"/":"")+(t=n(r(t.split("/"),(function(e){return!!e})),!i).join("/"))||"."},t.normalize=function(e){var s=t.isAbsolute(e),o="/"===i(e,-1);return(e=n(r(e.split("/"),(function(e){return!!e})),!s).join("/"))||s||(e="."),e&&o&&(e+="/"),(s?"/":"")+e},t.isAbsolute=function(e){return"/"===e.charAt(0)},t.join=function(){var e=Array.prototype.slice.call(arguments,0);return t.normalize(r(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,n){function r(e){for(var t=0;t=0&&""===e[n];n--);return t>n?[]:e.slice(t,n-t+1)}e=t.resolve(e).substr(1),n=t.resolve(n).substr(1);for(var i=r(e.split("/")),s=r(n.split("/")),o=Math.min(i.length,s.length),a=o,u=0;u=1;--s)if(47===(t=e.charCodeAt(s))){if(!i){r=s;break}}else i=!1;return-1===r?n?"/":".":n&&1===r?"/":e.slice(0,r)},t.basename=function(e,t){var n=function(e){"string"!=typeof e&&(e+="");var t,n=0,r=-1,i=!0;for(t=e.length-1;t>=0;--t)if(47===e.charCodeAt(t)){if(!i){n=t+1;break}}else-1===r&&(i=!1,r=t+1);return-1===r?"":e.slice(n,r)}(e);return t&&n.substr(-1*t.length)===t&&(n=n.substr(0,n.length-t.length)),n},t.extname=function(e){"string"!=typeof e&&(e+="");for(var t=-1,n=0,r=-1,i=!0,s=0,o=e.length-1;o>=0;--o){var a=e.charCodeAt(o);if(47!==a)-1===r&&(i=!1,r=o+1),46===a?-1===t?t=o:1!==s&&(s=1):-1!==t&&(s=-1);else if(!i){n=o+1;break}}return-1===t||-1===r||0===s||1===s&&t===r-1&&t===n+1?"":e.slice(t,r)};var i="b"==="ab".substr(-1)?function(e,t,n){return e.substr(t,n)}:function(e,t,n){return t<0&&(t=e.length+t),e.substr(t,n)}}).call(this,n(1))},function(e,t,n){(t=e.exports=n(26)).Stream=t,t.Readable=t,t.Writable=n(29),t.Duplex=n(7),t.Transform=n(32),t.PassThrough=n(69)},function(e,t){},function(e,t,n){"use strict";var r=n(18).Buffer,i=n(66);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,n=""+t.data;t=t.next;)n+=e+t.data;return n},e.prototype.concat=function(e){if(0===this.length)return r.alloc(0);if(1===this.length)return this.head.data;for(var t,n,i,s=r.allocUnsafe(e>>>0),o=this.head,a=0;o;)t=o.data,n=s,i=a,t.copy(n,i),a+=o.data.length,o=o.next;return s},e}(),i&&i.inspect&&i.inspect.custom&&(e.exports.prototype[i.inspect.custom]=function(){var e=i.inspect({length:this.length});return this.constructor.name+" "+e})},function(e,t){},function(e,t,n){(function(e){var r=void 0!==e&&e||"undefined"!=typeof self&&self||window,i=Function.prototype.apply;function s(e,t){this._id=e,this._clearFn=t}t.setTimeout=function(){return new s(i.call(setTimeout,r,arguments),clearTimeout)},t.setInterval=function(){return new s(i.call(setInterval,r,arguments),clearInterval)},t.clearTimeout=t.clearInterval=function(e){e&&e.close()},s.prototype.unref=s.prototype.ref=function(){},s.prototype.close=function(){this._clearFn.call(r,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))},n(68),t.setImmediate="undefined"!=typeof self&&self.setImmediate||void 0!==e&&e.setImmediate||this&&this.setImmediate,t.clearImmediate="undefined"!=typeof self&&self.clearImmediate||void 0!==e&&e.clearImmediate||this&&this.clearImmediate}).call(this,n(3))},function(e,t,n){(function(e,t){!function(e,n){"use strict";if(!e.setImmediate){var r,i,s,o,a,u=1,c={},l=!1,h=e.document,f=Object.getPrototypeOf&&Object.getPrototypeOf(e);f=f&&f.setTimeout?f:e,"[object process]"==={}.toString.call(e.process)?r=function(){var e=d(arguments);return t.nextTick(p(b,e)),e}:!function(){if(e.postMessage&&!e.importScripts){var t=!0,n=e.onmessage;return e.onmessage=function(){t=!1},e.postMessage("","*"),e.onmessage=n,t}}()?e.MessageChannel?((s=new MessageChannel).port1.onmessage=function(e){b(e.data)},r=function(){var e=d(arguments);return s.port2.postMessage(e),e}):h&&"onreadystatechange"in h.createElement("script")?(i=h.documentElement,r=function(){var e=d(arguments),t=h.createElement("script");return t.onreadystatechange=function(){b(e),t.onreadystatechange=null,i.removeChild(t),t=null},i.appendChild(t),e}):r=function(){var e=d(arguments);return setTimeout(p(b,e),0),e}:(o="setImmediate$"+Math.random()+"$",a=function(t){t.source===e&&"string"==typeof t.data&&0===t.data.indexOf(o)&&b(+t.data.slice(o.length))},e.addEventListener?e.addEventListener("message",a,!1):e.attachEvent("onmessage",a),r=function(){var t=d(arguments);return e.postMessage(o+t,"*"),t}),f.setImmediate=r,f.clearImmediate=g}function d(e){return c[u]=p.apply(void 0,e),u++}function p(e){var t=[].slice.call(arguments,1);return function(){"function"==typeof e?e.apply(void 0,t):new Function(""+e)()}}function b(e){if(l)setTimeout(p(b,e),0);else{var t=c[e];if(t){l=!0;try{t()}finally{g(e),l=!1}}}}function g(e){delete c[e]}}("undefined"==typeof self?void 0===e?this:e:self)}).call(this,n(3),n(1))},function(e,t,n){"use strict";e.exports=s;var r=n(32),i=Object.create(n(13));function s(e){if(!(this instanceof s))return new s(e);r.call(this,e)}i.inherits=n(2),i.inherits(s,r),s.prototype._transform=function(e,t,n){n(null,e)}},function(e,t,n){"use strict";const r=n(71),i=n(33);function s(e,t){return i({source:e},t)}e.exports=s,e.exports.readable=s,e.exports.writable=function(e,t){return i({sink:e},t)},e.exports.transform=r,e.exports.duplex=i},function(e,t,n){const r=n(33),i=n(40);e.exports=function(e,t){const{promise:n,resolve:s}=i(),o=async function*(){const e=await n;for await(const t of e)yield t}();return r({sink:t=>s(e(t)),source:o},t)}},function(e,t,n){(t=e.exports=n(34)).Stream=t,t.Readable=t,t.Writable=n(38),t.Duplex=n(9),t.Transform=n(39),t.PassThrough=n(78),t.finished=n(19),t.pipeline=n(79)},function(e,t){},function(e,t,n){"use strict";function r(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function i(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function s(e,t){for(var n=0;n0?this.tail.next=t:this.head=t,this.tail=t,++this.length}},{key:"unshift",value:function(e){var t={data:e,next:this.head};0===this.length&&(this.tail=t),this.head=t,++this.length}},{key:"shift",value: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}}},{key:"clear",value:function(){this.head=this.tail=null,this.length=0}},{key:"join",value:function(e){if(0===this.length)return"";for(var t=this.head,n=""+t.data;t=t.next;)n+=e+t.data;return n}},{key:"concat",value:function(e){if(0===this.length)return o.alloc(0);for(var t,n,r,i=o.allocUnsafe(e>>>0),s=this.head,a=0;s;)t=s.data,n=i,r=a,o.prototype.copy.call(t,n,r),a+=s.data.length,s=s.next;return i}},{key:"consume",value:function(e,t){var n;return ei.length?i.length:e;if(s===i.length?r+=i:r+=i.slice(0,e),0==(e-=s)){s===i.length?(++n,t.next?this.head=t.next:this.head=this.tail=null):(this.head=t,t.data=i.slice(s));break}++n}return this.length-=n,r}},{key:"_getBuffer",value:function(e){var t=o.allocUnsafe(e),n=this.head,r=1;for(n.data.copy(t),e-=n.data.length;n=n.next;){var i=n.data,s=e>i.length?i.length:e;if(i.copy(t,t.length-e,0,s),0==(e-=s)){s===i.length?(++r,n.next?this.head=n.next:this.head=this.tail=null):(this.head=n,n.data=i.slice(s));break}++r}return this.length-=r,t}},{key:u,value:function(e,t){return a(this,function(e){for(var t=1;t0,(function(e){r||(r=e),e&&o.forEach(c),s||(o.forEach(c),i(r))}))}));return t.reduce(l)}},function(e,t){e.exports=function(e){if(e){if("function"==typeof e[Symbol.iterator])return e[Symbol.iterator]();if("function"==typeof e[Symbol.asyncIterator])return e[Symbol.asyncIterator]();if("function"==typeof e.next)return e}throw new Error("argument is not an iterator or iterable")}},function(e,t,n){const r=n(82),i=n(40);e.exports=class{constructor(){this._buffer=new r,this._waitingConsumers=new r}push(e){const{promise:t,resolve:n}=i();return this._buffer.push({chunk:e,resolve:n}),this._consume(),t}_consume(){for(;!this._waitingConsumers.isEmpty()&&!this._buffer.isEmpty();){const e=this._waitingConsumers.shift(),t=this._buffer.shift();e.resolve(t.chunk),t.resolve()}}shift(){const{promise:e,resolve:t}=i();return this._waitingConsumers.push({resolve:t}),this._consume(),e}isEmpty(){return this._buffer.isEmpty()}}},function(e,t,n){const r=n(83);e.exports=class{constructor(e){this.hwm=e||16,this.head=new r(this.hwm),this.tail=this.head}push(e){if(!this.head.push(e)){const t=this.head;this.head=t.next=new r(2*this.head.buffer.length),this.head.push(e)}}shift(){const e=this.tail.shift();if(void 0===e&&this.tail.next){const e=this.tail.next;return this.tail.next=null,this.tail=e,this.tail.shift()}return e}isEmpty(){return this.head.isEmpty()}}},function(e,t){e.exports=class{constructor(e){if(!(e>0)||0!=(e-1&e))throw new Error("Max size for a FixedFIFO should be a power of two");this.buffer=new Array(e),this.mask=e-1,this.top=0,this.btm=0,this.next=null}push(e){return void 0===this.buffer[this.top]&&(this.buffer[this.top]=e,this.top=this.top+1&this.mask,!0)}shift(){const e=this.buffer[this.btm];if(void 0!==e)return this.buffer[this.btm]=void 0,this.btm=this.btm+1&this.mask,e}isEmpty(){return void 0===this.buffer[this.btm]}}},function(e,t,n){"use strict";const r=n(85);e.exports=(e,t)=>r(e,(e,n,r)=>t(n,r)).then(()=>e)},function(e,t,n){"use strict";e.exports=(e,t,n)=>new Promise((r,i)=>{const s=e[Symbol.iterator]();let o=0;const a=e=>{const n=s.next();n.done?r(e):Promise.all([e,n.value]).then(e=>{a(t(e[0],e[1],o++))}).catch(i)};a(n)})},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const r=n(87),i=n(88),s=n(90),o=()=>{},a=new i.TimeoutError;t.default=class extends r{constructor(e){var t,n,r,i;if(super(),Object.defineProperty(this,"_carryoverConcurrencyCount",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_isIntervalIgnored",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_intervalCount",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"_intervalCap",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_interval",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_intervalEnd",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"_intervalId",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_timeoutId",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_queue",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_queueClass",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_pendingCount",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"_concurrency",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_isPaused",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_resolveEmpty",{enumerable:!0,configurable:!0,writable:!0,value:o}),Object.defineProperty(this,"_resolveIdle",{enumerable:!0,configurable:!0,writable:!0,value:o}),Object.defineProperty(this,"_timeout",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_throwOnTimeout",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),!("number"==typeof(e=Object.assign({carryoverConcurrencyCount:!1,intervalCap:1/0,interval:0,concurrency:1/0,autoStart:!0,queueClass:s.default},e)).intervalCap&&e.intervalCap>=1))throw new TypeError(`Expected \`intervalCap\` to be a number from 1 and up, got \`${null!==(n=null===(t=e.intervalCap)||void 0===t?void 0:t.toString())&&void 0!==n?n:""}\` (${typeof e.intervalCap})`);if(void 0===e.interval||!(Number.isFinite(e.interval)&&e.interval>=0))throw new TypeError(`Expected \`interval\` to be a finite number >= 0, got \`${null!==(i=null===(r=e.interval)||void 0===r?void 0:r.toString())&&void 0!==i?i:""}\` (${typeof e.interval})`);this._carryoverConcurrencyCount=e.carryoverConcurrencyCount,this._isIntervalIgnored=e.intervalCap===1/0||0===e.interval,this._intervalCap=e.intervalCap,this._interval=e.interval,this._queue=new e.queueClass,this._queueClass=e.queueClass,this.concurrency=e.concurrency,this._timeout=e.timeout,this._throwOnTimeout=!0===e.throwOnTimeout,this._isPaused=!1===e.autoStart}get _doesIntervalAllowAnother(){return this._isIntervalIgnored||this._intervalCount{this._onResumeInterval()},t)),!0;this._intervalCount=this._carryoverConcurrencyCount?this._pendingCount:0}return!1}_tryToStartAnother(){if(0===this._queue.size)return this._intervalId&&clearInterval(this._intervalId),this._intervalId=void 0,this._resolvePromises(),!1;if(!this._isPaused){const e=!this._isIntervalPaused();if(this._doesIntervalAllowAnother&&this._doesConcurrentAllowAnother)return this.emit("active"),this._queue.dequeue()(),e&&this._initializeIntervalIfNeeded(),!0}return!1}_initializeIntervalIfNeeded(){this._isIntervalIgnored||void 0!==this._intervalId||(this._intervalId=setInterval(()=>{this._onInterval()},this._interval),this._intervalEnd=Date.now()+this._interval)}_onInterval(){0===this._intervalCount&&0===this._pendingCount&&this._intervalId&&(clearInterval(this._intervalId),this._intervalId=void 0),this._intervalCount=this._carryoverConcurrencyCount?this._pendingCount:0,this._processQueue()}_processQueue(){for(;this._tryToStartAnother(););}get concurrency(){return this._concurrency}set concurrency(e){if(!("number"==typeof e&&e>=1))throw new TypeError(`Expected \`concurrency\` to be a number from 1 and up, got \`${e}\` (${typeof e})`);this._concurrency=e,this._processQueue()}async add(e,t={}){return new Promise((n,r)=>{this._queue.enqueue(async()=>{this._pendingCount++,this._intervalCount++;try{const s=void 0===this._timeout&&void 0===t.timeout?e():i.default(Promise.resolve(e()),void 0===t.timeout?this._timeout:t.timeout,()=>{(void 0===t.throwOnTimeout?this._throwOnTimeout:t.throwOnTimeout)&&r(a)});n(await s)}catch(e){r(e)}this._next()},t),this._tryToStartAnother()})}async addAll(e,t){return Promise.all(e.map(async e=>this.add(e,t)))}start(){return this._isPaused?(this._isPaused=!1,this._processQueue(),this):this}pause(){this._isPaused=!0}clear(){this._queue=new this._queueClass}async onEmpty(){if(0!==this._queue.size)return new Promise(e=>{const t=this._resolveEmpty;this._resolveEmpty=()=>{t(),e()}})}async onIdle(){if(0!==this._pendingCount||0!==this._queue.size)return new Promise(e=>{const t=this._resolveIdle;this._resolveIdle=()=>{t(),e()}})}get size(){return this._queue.size}sizeBy(e){return this._queue.filter(e).length}get pending(){return this._pendingCount}get isPaused(){return this._isPaused}get timeout(){return this._timeout}set timeout(e){this._timeout=e}}},function(e,t,n){"use strict";var r=Object.prototype.hasOwnProperty,i="~";function s(){}function o(e,t,n){this.fn=e,this.context=t,this.once=n||!1}function a(e,t,n,r,s){if("function"!=typeof n)throw new TypeError("The listener must be a function");var a=new o(n,r||e,s),u=i?i+t:t;return e._events[u]?e._events[u].fn?e._events[u]=[e._events[u],a]:e._events[u].push(a):(e._events[u]=a,e._eventsCount++),e}function u(e,t){0==--e._eventsCount?e._events=new s:delete e._events[t]}function c(){this._events=new s,this._eventsCount=0}Object.create&&(s.prototype=Object.create(null),(new s).__proto__||(i=!1)),c.prototype.eventNames=function(){var e,t,n=[];if(0===this._eventsCount)return n;for(t in e=this._events)r.call(e,t)&&n.push(i?t.slice(1):t);return Object.getOwnPropertySymbols?n.concat(Object.getOwnPropertySymbols(e)):n},c.prototype.listeners=function(e){var t=i?i+e:e,n=this._events[t];if(!n)return[];if(n.fn)return[n.fn];for(var r=0,s=n.length,o=new Array(s);rnew Promise((s,o)=>{if("number"!=typeof t||t<0)throw new TypeError("Expected `milliseconds` to be a positive number");if(t===1/0)return void s(e);const a=setTimeout(()=>{if("function"==typeof n){try{s(n())}catch(e){o(e)}return}const r=n instanceof Error?n:new i("string"==typeof n?n:`Promise timed out after ${t} milliseconds`);"function"==typeof e.cancel&&e.cancel(),o(r)},t);r(e.then(s,o),()=>{clearTimeout(a)})});e.exports=s,e.exports.default=s,e.exports.TimeoutError=i},function(e,t,n){"use strict";e.exports=(e,t)=>(t=t||(()=>{}),e.then(e=>new Promise(e=>{e(t())}).then(()=>e),e=>new Promise(e=>{e(t())}).then(()=>{throw e})))},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const r=n(91);t.default=class{constructor(){Object.defineProperty(this,"_queue",{enumerable:!0,configurable:!0,writable:!0,value:[]})}enqueue(e,t){const n={priority:(t=Object.assign({priority:0},t)).priority,run:e};if(this.size&&this._queue[this.size-1].priority>=t.priority)return void this._queue.push(n);const i=r.default(this._queue,n,(e,t)=>t.priority-e.priority);this._queue.splice(i,0,n)}dequeue(){const e=this._queue.shift();return null==e?void 0:e.run}filter(e){return this._queue.filter(t=>t.priority===e.priority).map(e=>e.run)}get size(){return this._queue.length}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e,t,n){let r=0,i=e.length;for(;i>0;){const s=i/2|0;let o=r+s;n(e[o],t)<=0?(r=++o,i-=s+1):i=s}return r}},function(e,t,n){"use strict";e.exports=class{constructor(e){}append(e){}merge(e){}get(e){}has(e){}get values(){}get length(){}}},function(e,t,n){"use strict";e.exports=function(e,t,n){var r={},i={};return e.forEach(e=>i[n?e[n]:e]=!0),t.reduce((e,t)=>{var s=void 0!==i[n?t[n]:t],o=void 0!==r[n?t[n]:t];return s||o||(e.push(t),r[n?t[n]:t]=!0),e},[])}},function(e,t,n){"use strict";e.exports=function(e,t){let n={};return e.forEach(e=>n[t?e[t]:e]=e),Object.keys(n).map(e=>n[e])}},function(e,t,n){"use strict";e.exports=e=>null!=e},function(e,t,n){"use strict";const{Buffer:r}=n(0),i=n(10),s=n(106),o=n(23),a=n(11),u=n(116),c=n(16);class l{constructor(e,t,n,a){if(h.isCID(e)){const t=e;return this.version=t.version,this.codec=t.codec,this.multihash=r.from(t.multihash),void(this.multibaseName=t.multibaseName||(0===t.version?"base58btc":"base32"))}if("string"==typeof e){const t=s.isEncoded(e);if(t){const n=s.decode(e);this.version=parseInt(n.slice(0,1).toString("hex"),16),this.codec=o.getCodec(n.slice(1)),this.multihash=o.rmPrefix(n.slice(1)),this.multibaseName=t}else this.version=0,this.codec="dag-pb",this.multihash=i.fromB58String(e),this.multibaseName="base58btc";return l.validateCID(this),void Object.defineProperty(this,"string",{value:e})}if(r.isBuffer(e)){const t=e.slice(0,1),n=parseInt(t.toString("hex"),16);if(1===n){const t=e;this.version=n,this.codec=o.getCodec(t.slice(1)),this.multihash=o.rmPrefix(t.slice(1)),this.multibaseName="base32"}else this.version=0,this.codec="dag-pb",this.multihash=e,this.multibaseName="base58btc";l.validateCID(this)}else this.version=e,this.codec=t,this.multihash=n,this.multibaseName=a||(0===e?"base58btc":"base32"),l.validateCID(this)}get buffer(){let e=this._buffer;if(!e){if(0===this.version)e=this.multihash;else{if(1!==this.version)throw new Error("unsupported version");e=r.concat([r.from("01","hex"),o.getCodeVarint(this.codec),this.multihash])}Object.defineProperty(this,"_buffer",{value:e})}return e}get prefix(){return r.concat([r.from("0"+this.version,"hex"),o.getCodeVarint(this.codec),i.prefix(this.multihash)])}toV0(){if("dag-pb"!==this.codec)throw new Error("Cannot convert a non dag-pb CID to CIDv0");const{name:e,length:t}=i.decode(this.multihash);if("sha2-256"!==e)throw new Error("Cannot convert non sha2-256 multihash CID to CIDv0");if(32!==t)throw new Error("Cannot convert non 32 byte multihash CID to CIDv0");return new h(0,this.codec,this.multihash)}toV1(){return new h(1,this.codec,this.multihash)}toBaseEncodedString(e=this.multibaseName){if(this.string&&e===this.multibaseName)return this.string;let t=null;if(0===this.version){if("base58btc"!==e)throw new Error("not supported with CIDv0, to support different bases, please migrate the instance do CIDv1, you can do that through cid.toV1()");t=i.toB58String(this.multihash)}else{if(1!==this.version)throw new Error("unsupported version");t=s.encode(e,this.buffer).toString()}return e===this.multibaseName&&Object.defineProperty(this,"string",{value:t}),t}[Symbol.for("nodejs.util.inspect.custom")](){return"CID("+this.toString()+")"}toString(e){return this.toBaseEncodedString(e)}toJSON(){return{codec:this.codec,version:this.version,hash:this.multihash}}equals(e){return this.codec===e.codec&&this.version===e.version&&this.multihash.equals(e.multihash)}static validateCID(e){const t=u.checkCIDComponents(e);if(t)throw new Error(t)}}const h=c(l,{className:"CID",symbolName:"@ipld/js-cid/CID"});h.codecs=a,e.exports=h},function(e,t,n){"use strict";const r=n(98),i=n(45),s=n(99),o=n(100),a=n(101),u=[["base1","1","","1"],["base2","0",i,"01"],["base8","7",i,"01234567"],["base10","9",i,"0123456789"],["base16","f",s,"0123456789abcdef"],["base32","b",o,"abcdefghijklmnopqrstuvwxyz234567"],["base32pad","c",o,"abcdefghijklmnopqrstuvwxyz234567="],["base32hex","v",o,"0123456789abcdefghijklmnopqrstuv"],["base32hexpad","t",o,"0123456789abcdefghijklmnopqrstuv="],["base32z","h",o,"ybndrfg8ejkmcpqxot1uwisza345h769"],["base58flickr","Z",i,"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"],["base58btc","z",i,"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"],["base64","m",a,"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"],["base64pad","M",a,"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="],["base64url","u",a,"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"],["base64urlpad","U",a,"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_="]],c=u.reduce((e,t)=>(e[t[0]]=new r(t[0],t[1],t[2],t[3]),e),{}),l=u.reduce((e,t)=>(e[t[1]]=c[t[0]],e),{});e.exports={names:c,codes:l}},function(e,t,n){"use strict";e.exports=class{constructor(e,t,n,r){this.name=e,this.code=t,this.alphabet=r,n&&r&&(this.engine=n(r))}encode(e){return this.engine.encode(e)}decode(e){return this.engine.decode(e)}isImplemented(){return this.engine}}},function(e,t,n){"use strict";const{Buffer:r}=n(0);e.exports=function(e){return{encode:e=>"string"==typeof e?r.from(e).toString("hex"):e.toString("hex"),decode(t){for(const n of t)if(e.indexOf(n)<0)throw new Error("invalid base16 character");return r.from(t,"hex")}}}},function(e,t,n){"use strict";function r(e,t){const n=e.byteLength,r=new Uint8Array(e),i=t.indexOf("=")===t.length-1;i&&(t=t.substring(0,t.length-1));let s=0,o=0,a="";for(let e=0;e=5;)a+=t[o>>>s-5&31],s-=5;if(s>0&&(a+=t[o<<5-s&31]),i)for(;a.length%8!=0;)a+="=";return a}e.exports=function(e){return{encode:t=>r("string"==typeof t?Uint8Array.from(t):t,e),decode(t){for(const n of t)if(e.indexOf(n)<0)throw new Error("invalid base32 character");return function(e,t){const n=(e=e.replace(new RegExp("=","g"),"")).length;let r=0,i=0,s=0;const o=new Uint8Array(5*n/8|0);for(let a=0;a=8&&(o[s++]=i>>>r-8&255,r-=8);return o.buffer}(t,e)}}}},function(e,t,n){"use strict";const{Buffer:r}=n(0);e.exports=function(e){const t=e.indexOf("=")>-1,n=e.indexOf("-")>-1&&e.indexOf("_")>-1;return{encode(e){let i="";i="string"==typeof e?r.from(e).toString("base64"):e.toString("base64"),n&&(i=i.replace(/\+/g,"-").replace(/\//g,"_"));const s=i.indexOf("=");return s>0&&!t&&(i=i.substring(0,s)),i},decode(t){for(const n of t)if(e.indexOf(n)<0)throw new Error("invalid base64 character");return r.from(t,"base64")}}}},function(e,t){e.exports=function e(t,r,i){r=r||[];var s=i=i||0;for(;t>=n;)r[i++]=255&t|128,t/=128;for(;-128&t;)r[i++]=255&t|128,t>>>=7;return r[i]=0|t,e.bytes=i-s+1,r};var n=Math.pow(2,31)},function(e,t){e.exports=function e(t,n){var r,i=0,s=0,o=n=n||0,a=t.length;do{if(o>=a)throw e.bytes=0,new RangeError("Could not decode varint");r=t[o++],i+=s<28?(127&r)<=128);return e.bytes=o-n,i}},function(e,t){var n=Math.pow(2,7),r=Math.pow(2,14),i=Math.pow(2,21),s=Math.pow(2,28),o=Math.pow(2,35),a=Math.pow(2,42),u=Math.pow(2,49),c=Math.pow(2,56),l=Math.pow(2,63);e.exports=function(e){return e(e[t[0]]=new r(t[0],t[1],t[2],t[3]),e),{}),l=u.reduce((e,t)=>(e[t[1]]=c[t[0]],e),{});e.exports={names:c,codes:l}},function(e,t,n){"use strict";e.exports=class{constructor(e,t,n,r){this.name=e,this.code=t,this.alphabet=r,n&&r&&(this.engine=n(r))}encode(e){return this.engine.encode(e)}decode(e){return this.engine.decode(e)}isImplemented(){return this.engine}}},function(e,t,n){"use strict";const{Buffer:r}=n(0);e.exports=function(e){return{encode:e=>"string"==typeof e?r.from(e).toString("hex"):e.toString("hex"),decode(t){for(const n of t)if(e.indexOf(n)<0)throw new Error("invalid base16 character");return r.from(t,"hex")}}}},function(e,t,n){"use strict";function r(e,t){const n=e.byteLength,r=new Uint8Array(e),i=t.indexOf("=")===t.length-1;i&&(t=t.substring(0,t.length-1));let s=0,o=0,a="";for(let e=0;e=5;)a+=t[o>>>s-5&31],s-=5;if(s>0&&(a+=t[o<<5-s&31]),i)for(;a.length%8!=0;)a+="=";return a}e.exports=function(e){return{encode:t=>r("string"==typeof t?Uint8Array.from(t):t,e),decode(t){for(const n of t)if(e.indexOf(n)<0)throw new Error("invalid base32 character");return function(e,t){const n=(e=e.replace(new RegExp("=","g"),"")).length;let r=0,i=0,s=0;const o=new Uint8Array(5*n/8|0);for(let a=0;a=8&&(o[s++]=i>>>r-8&255,r-=8);return o.buffer}(t,e)}}}},function(e,t,n){"use strict";const{Buffer:r}=n(0);e.exports=function(e){const t=e.indexOf("=")>-1,n=e.indexOf("-")>-1&&e.indexOf("_")>-1;return{encode(e){let i="";i="string"==typeof e?r.from(e).toString("base64"):e.toString("base64"),n&&(i=i.replace(/\+/g,"-").replace(/\//g,"_"));const s=i.indexOf("=");return s>0&&!t&&(i=i.substring(0,s)),i},decode(t){for(const n of t)if(e.indexOf(n)<0)throw new Error("invalid base64 character");return r.from(t,"base64")}}}},function(e,t,n){"use strict";const r=n(11),i=new Map;for(const e in r){const t=r[e];i.set(t,e)}e.exports=Object.freeze(i)},function(e,t,n){"use strict";const r=n(11),i=n(46).varintEncode,s={};for(const e in r){const t=r[e];s[e]=i(t)}e.exports=Object.freeze(s)},function(e,t,n){"use strict";const r=n(11),i={};for(const[e,t]of Object.entries(r))i[e.toUpperCase().replace(/-/g,"_")]=t;e.exports=Object.freeze(i)},function(e,t,n){"use strict";const r=n(11),i={};for(const[e,t]of Object.entries(r))void 0===i[t]&&(i[t]=e);e.exports=Object.freeze(i)},function(e,t,n){"use strict";const r=n(10),{Buffer:i}=n(0);var s={checkCIDComponents:function(e){if(null==e)return"null values are not valid CIDs";if(0!==e.version&&1!==e.version)return"Invalid version, must be a number equal to 1 or 0";if("string"!=typeof e.codec)return"codec must be string";if(0===e.version){if("dag-pb"!==e.codec)return"codec must be 'dag-pb' for CIDv0";if("base58btc"!==e.multibaseName)return"multibaseName must be 'base58btc' for CIDv0"}if(!i.isBuffer(e.multihash))return"multihash must be a Buffer";try{r.validate(e.multihash)}catch(e){let t=e.message;return t||(t="Multihash validation failed"),t}}};e.exports=s},function(e,t,n){"use strict";t.DAGNode=n(118),t.DAGLink=n(54),t.resolver=n(148),t.util=n(55),t.codec=t.util.codec,t.defaultHashAlg=t.util.defaultHashAlg},function(e,t,n){"use strict";e.exports=n(47)},function(e,t,n){ //! stable.js 0.1.8, https://github.com/Two-Screen/stable //! © 2018 Angry Bytes and contributors. MIT licensed. e.exports=function(){"use strict";var e=function(e,n){return t(e.slice(),n)};function t(e,t){"function"!=typeof t&&(t=function(e,t){return String(e).localeCompare(t)});var r=e.length;if(r<=1)return e;for(var i=new Array(r),s=1;sc&&(s=c),o>c&&(o=c),a=i,u=s;;)if(a"!==e[0])throw new Error("Unexpected token in map type: "+e[0]);e.shift(),t.name=e.shift();break;case"repeated":case"required":case"optional":var n=e.shift();t.required="required"===n,t.repeated="repeated"===n,t.type=e.shift(),t.name=e.shift();break;case"[":t.options=s(e);break;case";":if(null===t.name)throw new Error("Missing field name");if(null===t.type)throw new Error("Missing type in message field: "+t.name);if(-1===t.tag)throw new Error("Missing tag number in message field: "+t.name);return e.shift(),t;default:throw new Error("Unexpected token in message field: "+e[0])}throw new Error("No ; found for message field")},a=function(e){for(var t={enums:[],options:{},messages:[],fields:[],extends:[],extensions:null};e.length;)switch(e[0]){case"map":case"repeated":case"optional":case"required":t.fields.push(o(e));break;case"enum":t.enums.push(p(e));break;case"message":t.messages.push(l(e));break;case"extensions":t.extensions=c(e);break;case"oneof":e.shift();var n=e.shift();if("{"!==e[0])throw new Error("Unexpected token in oneof: "+e[0]);for(e.shift();"}"!==e[0];){e.unshift("optional");var r=o(e);r.oneof=n,t.fields.push(r)}e.shift();break;case"extend":t.extends.push(u(e));break;case";":e.shift();break;case"reserved":for(e.shift();";"!==e[0];)e.shift();break;case"option":var i=b(e);if(void 0!==t.options[i.name])throw new Error("Duplicate option "+i.name);t.options[i.name]=i.value;break;default:e.unshift("optional"),t.fields.push(o(e))}return t},u=function(e){return{name:e[1],message:l(e)}},c=function(e){e.shift();var t=Number(e.shift());if(isNaN(t))throw new Error("Invalid from in extensions definition");if("to"!==e.shift())throw new Error("Expected keyword 'to' in extensions definition");var n=e.shift();if("max"===n&&(n=536870911),n=Number(n),isNaN(n))throw new Error("Invalid to in extensions definition");if(";"!==e.shift())throw new Error("Missing ; in extensions definition");return{from:t,to:n}},l=function(e){e.shift();var t=1,n=[],r={name:e.shift(),options:{},enums:[],extends:[],messages:[],fields:[]};if("{"!==e[0])throw new Error("Expected { but found "+e[0]);for(e.shift();e.length;){if("{"===e[0]?t++:"}"===e[0]&&t--,!t)return e.shift(),n=a(n),r.enums=n.enums,r.messages=n.messages,r.fields=n.fields,r.extends=n.extends,r.extensions=n.extensions,r.options=n.options,r;n.push(e.shift())}if(t)throw new Error("No closing tag for message")},h=function(e){e.shift();var t=e.shift();if(";"!==e[0])throw new Error("Expected ; but found "+e[0]);return e.shift(),t},f=function(e){if(e.shift(),"="!==e[0])throw new Error("Expected = but found "+e[0]);e.shift();var t=e.shift();switch(t){case'"proto2"':t=2;break;case'"proto3"':t=3;break;default:throw new Error("Expected protobuf syntax version but found "+t)}if(";"!==e[0])throw new Error("Expected ; but found "+e[0]);return e.shift(),t},d=function(e){if(e.length<4)throw new Error("Invalid enum value: "+e.slice(0,3).join(" "));if("="!==e[1])throw new Error("Expected = but found "+e[1]);if(";"!==e[3]&&"["!==e[3])throw new Error("Expected ; or [ but found "+e[1]);var t=e.shift();e.shift();var n={value:null,options:{}};return n.value=Number(e.shift()),"["===e[0]&&(n.options=s(e)),e.shift(),{name:t,val:n}},p=function(e){e.shift();var t={},n={name:e.shift(),values:{},options:{}};if("{"!==e[0])throw new Error("Expected { but found "+e[0]);for(e.shift();e.length;){if("}"===e[0])return e.shift(),";"===e[0]&&e.shift(),n;if("option"!==e[0]){var r=d(e);n.values[r.name]=r.val}else t=b(e),n.options[t.name]=t.value}throw new Error("No closing tag for enum")},b=function(e){for(var t=null,n=null,r=function(e){return"true"===e||"false"!==e&&e.replace(/^"+|"+$/gm,"")};e.length;){if(";"===e[0])return e.shift(),{name:t,value:n};switch(e[0]){case"option":e.shift();var i="("===e[0];if(i&&e.shift(),t=e.shift(),i){if(")"!==e[0])throw new Error("Expected ) but found "+e[0]);e.shift()}"."===e[0][0]&&(t+=e.shift());break;case"=":if(e.shift(),null===t)throw new Error("Expected key for option with value: "+e[0]);if(n=r(e.shift()),"optimize_for"===t&&!/^(SPEED|CODE_SIZE|LITE_RUNTIME)$/.test(n))throw new Error("Unexpected value for option optimize_for: "+n);"{"===n&&(n=g(e));break;default:throw new Error("Unexpected token in option: "+e[0])}}},g=function(e){for(var t=function(e){return"true"===e||"false"!==e&&e.replace(/^"+|"+$/gm,"")},n={};e.length;){if("}"===e[0])return e.shift(),n;var r="("===e[0];r&&e.shift();var i=e.shift();if(r){if(")"!==e[0])throw new Error("Expected ) but found "+e[0]);e.shift()}var s=null;switch(e[0]){case":":if(void 0!==n[i])throw new Error("Duplicate option map key "+i);e.shift(),"{"===(s=t(e.shift()))&&(s=g(e)),n[i]=s,";"===e[0]&&e.shift();break;case"{":if(e.shift(),s=g(e),void 0===n[i]&&(n[i]=[]),!Array.isArray(n[i]))throw new Error("Duplicate option map key "+i);n[i].push(s);break;default:throw new Error("Unexpected token in option map: "+e[0])}}throw new Error("No closing tag for option map")},y=function(e){e.shift();var t=e.shift().replace(/^"+|"+$/gm,"");if(";"!==e[0])throw new Error("Unexpected token: "+e[0]+'. Expected ";"');return e.shift(),t},m=function(e){e.shift();var t={name:e.shift(),methods:[],options:{}};if("{"!==e[0])throw new Error("Expected { but found "+e[0]);for(e.shift();e.length;){if("}"===e[0])return e.shift(),";"===e[0]&&e.shift(),t;switch(e[0]){case"option":var n=b(e);if(void 0!==t.options[n.name])throw new Error("Duplicate option "+n.name);t.options[n.name]=n.value;break;case"rpc":t.methods.push(k(e));break;default:throw new Error("Unexpected token in service: "+e[0])}}throw new Error("No closing tag for service")},k=function(e){e.shift();var t={name:e.shift(),input_type:null,output_type:null,client_streaming:!1,server_streaming:!1,options:{}};if("("!==e[0])throw new Error("Expected ( but found "+e[0]);if(e.shift(),"stream"===e[0]&&(e.shift(),t.client_streaming=!0),t.input_type=e.shift(),")"!==e[0])throw new Error("Expected ) but found "+e[0]);if(e.shift(),"returns"!==e[0])throw new Error("Expected returns but found "+e[0]);if(e.shift(),"("!==e[0])throw new Error("Expected ( but found "+e[0]);if(e.shift(),"stream"===e[0]&&(e.shift(),t.server_streaming=!0),t.output_type=e.shift(),")"!==e[0])throw new Error("Expected ) but found "+e[0]);if(e.shift(),";"===e[0])return e.shift(),t;if("{"!==e[0])throw new Error("Expected { but found "+e[0]);for(e.shift();e.length;){if("}"===e[0])return e.shift(),";"===e[0]&&e.shift(),t;if("option"!==e[0])throw new Error("Unexpected token in rpc options: "+e[0]);var n=b(e);if(void 0!==t.options[n.name])throw new Error("Duplicate option "+n.name);t.options[n.name]=n.value}throw new Error("No closing tag for rpc")};e.exports=function(e){for(var t=r(e.toString()),n=0;nt.extensions.to)throw new Error(t.name+" does not declare "+e.tag+" as an extension number");t.fields.push(e)}))}))})),o.messages.forEach((function(e){e.fields.forEach((function(t){var n,r,s,a;if(t.options&&"true"===t.options.packed&&-1===i.indexOf(t.type)){if(-1===t.type.indexOf(".")){if(e.enums&&e.enums.some((function(e){return e.name===t.type})))return}else{if((n=t.type.split(".")).length>2)throw new Error("what is this?");if(r=n[0],s=n[1],o.messages.some((function(e){if(e.name===r)return a=e,e})),a&&a.enums&&a.enums.some((function(e){return e.name===s})))return}throw new Error("Fields of type "+t.type+' cannot be declared [packed=true]. Only repeated fields of primitive numeric types (types which use the varint, 32-bit, or 64-bit wire types) can be declared "packed". See https://developers.google.com/protocol-buffers/docs/encoding#optional')}}))})),o}},function(e,t){e.exports=function(e){var t,n=function(e){return e.trim()};return e.replace(/([;,{}()=:[\]<>]|\/\*|\*\/)/g," $1 ").split(/\n/).map(n).filter(Boolean).map((function(e){var t=e.indexOf("//");return t>-1?e.slice(0,t):e})).map(n).filter(Boolean).join("\n").split(/\s+|\n+/gm).filter((t=!1,function(e){return"/*"===e?(t=!0,!1):"*/"===e?(t=!1,!1):!t}))}},function(e,t){var n=function(e,t){var n=e.repeated?"repeated":e.required?"required":"optional";"map"===e.type&&(n="map<"+e.map.from+","+e.map.to+">"),e.oneof&&(n="");var r=Object.keys(e.options||{}).map((function(t){return t+" = "+e.options[t]})).join(",");return r&&(r=" ["+r+"]"),t.push((n?n+" ":"")+("map"===e.map?"":e.type+" ")+e.name+" = "+e.tag+r+";"),t},r=function(e,t){t.push("message "+e.name+" {"),e.options||(e.options={}),o(e.options,t),e.enums||(e.enums=[]),e.enums.forEach((function(e){t.push(i(e,[]))})),e.messages||(e.messages=[]),e.messages.forEach((function(e){t.push(r(e,[]))}));var s={};return e.fields||(e.fields=[]),e.fields.forEach((function(e){e.oneof?(s[e.oneof]||(s[e.oneof]=[]),s[e.oneof].push(n(e,[]))):t.push(n(e,[]))})),Object.keys(s).forEach((function(e){s[e].unshift("oneof "+e+" {"),s[e].push("}"),t.push(s[e])})),t.push("}",""),t},i=function(e,t){t.push("enum "+e.name+" {"),e.options||(e.options={});var n=o(e.options,[]);return n.length>1&&t.push(n.slice(0,-1)),Object.keys(e.values).map((function(n){var r=s(e.values[n]);t.push([n+" = "+r+";"])})),t.push("}",""),t},s=function(e,t){var n=Object.keys(e.options||{}).map((function(t){return t+" = "+e.options[t]})).join(",");return n&&(n=" ["+n+"]"),e.value+n},o=function(e,t){var n=Object.keys(e);return n.forEach((function(n){var r=e[n];~n.indexOf(".")&&(n="("+n+")");var i=typeof r;"object"===i?(r=a(r,[])).length&&t.push("option "+n+" = {",r,"};"):("string"===i&&"optimize_for"!==n&&(r='"'+r+'"'),t.push("option "+n+" = "+r+";"))})),n.length>0&&t.push(""),t},a=function(e,t){return Object.keys(e).forEach((function(n){var r=e[n],i=typeof r;"object"===i?Array.isArray(r)?r.forEach((function(e){(e=a(e,[])).length&&t.push(n+" {",e,"}")})):(r=a(r,[])).length&&t.push(n+" {",r,"}"):("string"===i&&(r='"'+r+'"'),t.push(n+": "+r))})),t},u=function(e,t){var n="rpc "+e.name+"(";e.client_streaming&&(n+="stream "),n+=e.input_type+") returns (",e.server_streaming&&(n+="stream "),n+=e.output_type+")",e.options||(e.options={});var r=o(e.options,[]);return r.length>1?t.push(n+" {",r.slice(0,-1),"}"):t.push(n+";"),t},c=function(e){return function(t){return Array.isArray(t)?t.map(c(e+" ")).join("\n"):e+t}};e.exports=function(e){var t=[];return t.push('syntax = "proto'+e.syntax+'";',""),e.package&&t.push("package "+e.package+";",""),e.options||(e.options={}),o(e.options,t),e.enums||(e.enums=[]),e.enums.forEach((function(e){i(e,t)})),e.messages||(e.messages=[]),e.messages.forEach((function(e){r(e,t)})),e.services&&e.services.forEach((function(e){!function(e,t){t.push("service "+e.name+" {"),e.options||(e.options={}),o(e.options,t),e.methods||(e.methods=[]),e.methods.forEach((function(e){t.push(u(e,[]))})),t.push("}","")}(e,t)})),t.map(c("")).join("\n")}},function(e,t,n){"use strict";var r=n(126),i=n(128),s=n(129),o=n(130),a=n(4);e.exports=function(e,t){var n={},u={},c={},l=function(e,t){e.enums&&e.enums.forEach((function(e){e.id=t+(t?".":"")+e.name,u[e.id]=e,l(e,e.id)})),e.messages&&e.messages.forEach((function(r){r.id=t+(t?".":"")+r.name,n[r.id]=r,r.fields.forEach((function(r){if(r.map){var i="Map_"+r.map.from+"_"+r.map.to,s={name:i,enums:[],messages:[],fields:[{name:"key",type:r.map.from,tag:1,repeated:!1,required:!0},{name:"value",type:r.map.to,tag:2,repeated:!1,required:!1}],extensions:null,id:t+(t?".":"")+i};n[s.id]||(n[s.id]=s,e.messages.push(s)),r.type=i,r.repeated=!0}})),l(r,r.id)}))};l(e,"");var h=function(e,t){e.messages.forEach((function(n){t[n.name]=f(n.name,e.id)})),e.enums.forEach((function(e){t[e.name]=function(e){if(!e)return null;var t={};return Object.keys(e).forEach((function(n){t[n]=e[n].value})),t}(e.values)})),t.type=2,t.message=!0,t.name=e.name;var n={};e.fields.forEach((function(e){e.oneof&&(n[e.oneof]||(n[e.oneof]=[]),n[e.oneof].push(e.name))}));var r=e.fields.map((function(t){return f(t.type,e.id)})),a=o(e,r,n),u=s(e,f,r,n,a),c=i(e,f,r);return u.bytes=c.bytes=0,t.buffer=!0,t.encode=u,t.decode=c,t.encodingLength=a,t},f=function(e,i,s){if(t&&t[e])return t[e];if(r[e])return r[e];var o,l,f=(i?i+"."+e:e).split(".").map((function(t,n,r){return r.slice(0,n).concat(e).join(".")})).reverse().reduce((function(e,t){return e||n[t]||u[t]}),null);if(!1===s)return f;if(!f)throw new Error("Could not resolve "+e);return f.values?(o=f,l=Object.keys(o.values||[]).map((function(e){return parseInt(o.values[e].value,10)})),r.make(0,(function e(t,n,r){if(!l.length||-1===l.indexOf(t))throw new Error("Invalid enum value: "+t);return a.encode(t,n,r),e.bytes=a.encode.bytes,n}),(function e(t,n){var r=a.decode(t,n);if(!l.length||-1===l.indexOf(r))throw new Error("Invalid enum value: "+r);return e.bytes=a.decode.bytes,r}),a.encodingLength)):c[f.id]||h(f,c[f.id]={})};return(e.enums||[]).concat((e.messages||[]).map((function(e){return f(e.id)})))}},function(e,t,n){"use strict";var r=n(4),i=n(127);const{Buffer:s}=n(0);var o,a,u,c=function(e,t,n,r){return t.bytes=n.bytes=0,{type:e,encode:t,decode:n,encodingLength:r}};t.make=c,t.bytes=(o=function(e){return s.isBuffer(e)?e.length:s.byteLength(e)},c(2,a=function(e,t,n){var i=n,u=o(e);return r.encode(u,t,n),n+=r.encode.bytes,s.isBuffer(e)?e.copy(t,n):t.write(e,n,u),n+=u,a.bytes=n-i,t},u=function(e,t){var n=t,i=r.decode(e,t);t+=r.decode.bytes;var s=e.slice(t,t+i);return t+=s.length,u.bytes=t-n,s},(function(e){var t=o(e);return r.encodingLength(t)+t}))),t.string=function(){var e=function(t,n,i){var o=i,a=s.byteLength(t);return r.encode(a,n,i,"utf-8"),i+=r.encode.bytes,n.write(t,i,a),i+=a,e.bytes=i-o,n},t=function(e,n){var i=n,s=r.decode(e,n);n+=r.decode.bytes;var o=e.toString("utf-8",n,n+s);return n+=s,t.bytes=n-i,o};return c(2,e,t,(function(e){var t=s.byteLength(e);return r.encodingLength(t)+t}))}(),t.bool=function(){var e=function(t,n,r){return n[r]=t?1:0,e.bytes=1,n},t=function(e,n){var r=e[n]>0;return t.bytes=1,r};return c(0,e,t,(function(e){return 1}))}(),t.int32=function(){var e=function(t,n){var i=r.decode(t,n);return e.bytes=r.decode.bytes,i>2147483647?i-4294967296:i},t=function(e,n,i){return r.encode(e<0?e+4294967296:e,n,i),t.bytes=r.encode.bytes,n};return c(0,t,e,(function(e){return r.encodingLength(e<0?e+4294967296:e)}))}(),t.int64=function(){var e=function(t,n){var i=r.decode(t,n);if(i>=Math.pow(2,63)){for(var o=9;255===t[n+o-1];)o--;o=o||9;var a=s.allocUnsafe(o);t.copy(a,0,n,n+o),a[o-1]=127&a[o-1],i=-1*r.decode(a,0),e.bytes=10}else e.bytes=r.decode.bytes;return i},t=function(e,n,i){if(e<0){var s=i+9;for(r.encode(-1*e,n,i),n[i+=r.encode.bytes-1]=128|n[i];i=0?2*t:-2*t-1;var s=r.encode(t,n,i);return e.bytes=r.encode.bytes,s},t.decode=function e(t,n){var i=r.decode(t,n);return e.bytes=r.decode.bytes,1&i?(i+1)/-2:i/2},t.encodingLength=function(e){return r.encodingLength(e>=0?2*e:-2*e-1)}},function(e,t,n){"use strict";var r=n(4),i=n(24).defined;function s(e){return`${e.substring(0,1).toUpperCase()}${e.substring(1)}`}function o(e,t,n,r){if(Object.prototype.hasOwnProperty.call(e,t))return;const i=s(t);Object.defineProperties(e,{[t]:{enumerable:!0,configurable:!0,set:e=>{n=e},get:()=>void 0===n?r:n},["has"+i]:{configurable:!0,value:()=>void 0!==n},["set"+i]:{configurable:!0,value:e=>{n=e}},["get"+i]:{configurable:!0,value:()=>n},["clear"+i]:{configurable:!0,value:()=>{n=void 0,e[t]=void 0}}})}var a=function(e,t,n){switch(e){case 0:return r.decode(t,n),n+r.decode.bytes;case 1:return n+8;case 2:var i=r.decode(t,n);return n+r.decode.bytes+i;case 3:case 4:throw new Error("Groups are not supported");case 5:return n+4;default:throw new Error("Unknown wire type: "+e)}},u=function(e){if(e.map)return{};if(e.repeated)return[];switch(e.type){case"string":return"";case"bool":return!1;case"float":case"double":case"sfixed32":case"fixed32":case"varint":case"enum":case"uint64":case"uint32":case"int64":case"int32":case"sint64":case"sint32":return 0;default:return null}},c=function(e,t){if(void 0===t)return t;switch(e.type){case"bool":return"true"===t;case"float":case"double":case"sfixed32":case"fixed32":case"varint":case"enum":case"uint64":case"uint32":case"int64":case"int32":case"sint64":case"sint32":return parseInt(t,10);default:return t}};e.exports=function(e,t,n){for(var l=[],h={},f=[],d=[],p=0;p-1){const e=s(l[h]);delete n["has"+e],delete n["get"+e],delete n["set"+e],delete n["clear"+e],delete n[l[h]]}let d;if(e.message){var p=r.decode(i,a);a+=r.decode.bytes;var b=e.decode(i,a,a+p);t.map?(d=n[c]||{},d[b.key]=b.value):t.repeated?(d=n[c]||[],d.push(b)):d=b}else t.repeated?(d=n[c]||[],d.push(e.decode(i,a))):d=e.decode(i,a);return o(n,c,d),a+=e.decode.bytes}return function t(s,p,b){if(null==p&&(p=0),null==b&&(b=s.length),!(b<=s.length&&p<=s.length))throw new Error("Decoded message is not valid");for(var g,y=p,k={};;){if(b<=p){var v,w,S="",_=0;for(_=0;_-1){E=!0;break}E||(v?g.repeated?w=[]:(w=w&&v[w]?v[w].value:v[Object.keys(v)[0]].value,w=parseInt(w||0,10)):(t=u(g),w=c(g,w)),o(k,S,w,t))}}return t.bytes=p-y,k}var A=r.decode(s,p);p+=r.decode.bytes;var R=h[A>>3];if(null!=R){var j=n[R];if((g=e.fields[R]).packed){var C=r.decode(s,p);for(C+=p+=r.decode.bytes;p-1){if(m)throw new Error("only one of the properties defined in oneof "+k+" can be set");m=!0}}for(y=0;y{const n=await i.cid(e.serialize(),t);return new r(t.name||"",e.size,n)}},function(e,t,n){"use strict";const{Buffer:r}=n(0),i=n(133),s=n(10),o=n(134);async function a(e,t,n){const r=await a.digest(e,t,n);return s.encode(r,t,n)}a.Buffer=r,a.multihash=s,a.digest=async(e,t,n)=>{const r=a.createHash(t),i=await r(e);return n?i.slice(0,n):i},a.createHash=function(e){if(!e)throw i(new Error("hash algorithm must be specified"),"ERR_HASH_ALGORITHM_NOT_SPECIFIED");if(e=s.coerceCode(e),!a.functions[e])throw i(new Error(`multihash function '${e}' not yet supported`),"ERR_HASH_ALGORITHM_NOT_SUPPORTED");return a.functions[e]},a.functions={0:o.identity,17:o.sha1,18:o.sha2256,19:o.sha2512,20:o.sha3512,21:o.sha3384,22:o.sha3256,23:o.sha3224,24:o.shake128,25:o.shake256,26:o.keccak224,27:o.keccak256,28:o.keccak384,29:o.keccak512,34:o.murmur3128,35:o.murmur332,86:o.dblSha2256},o.addBlake(a.functions),a.validate=async(e,t)=>{const n=await a(e,s.decode(t).name);return 0===r.compare(t,n)},e.exports=a},function(e,t,n){"use strict";e.exports=function(e,t,n){var r;if(!(e instanceof Error))throw new TypeError("Please pass an Error to err-code");if("object"==typeof t?n=t:null!=t&&(e.code=t),n)for(r in n)e[r]=n[r];return e}},function(e,t,n){"use strict";const{Buffer:r}=n(0),i=n(135),s=n(137),{factory:o}=n(139),{fromNumberTo32BitBuf:a}=n(140),u=e=>async t=>{switch(e){case"sha3-224":return r.from(i.sha3_224.arrayBuffer(t));case"sha3-256":return r.from(i.sha3_256.arrayBuffer(t));case"sha3-384":return r.from(i.sha3_384.arrayBuffer(t));case"sha3-512":return r.from(i.sha3_512.arrayBuffer(t));case"shake-128":return r.from(i.shake128.create(128).update(t).arrayBuffer());case"shake-256":return r.from(i.shake256.create(256).update(t).arrayBuffer());case"keccak-224":return r.from(i.keccak224.arrayBuffer(t));case"keccak-256":return r.from(i.keccak256.arrayBuffer(t));case"keccak-384":return r.from(i.keccak384.arrayBuffer(t));case"keccak-512":return r.from(i.keccak512.arrayBuffer(t));case"murmur3-128":return r.from(s.x64.hash128(t),"hex");case"murmur3-32":return a(s.x86.hash32(t));default:throw new TypeError(e+" is not a supported algorithm")}};e.exports={identity:e=>r.from(e),sha1:o("sha1"),sha2256:o("sha2-256"),sha2512:o("sha2-512"),dblSha2256:o("dbl-sha2-256"),sha3224:u("sha3-224"),sha3256:u("sha3-256"),sha3384:u("sha3-384"),sha3512:u("sha3-512"),shake128:u("shake-128"),shake256:u("shake-256"),keccak224:u("keccak-224"),keccak256:u("keccak-256"),keccak384:u("keccak-384"),keccak512:u("keccak-512"),murmur3128:u("murmur3-128"),murmur332:u("murmur3-32"),addBlake:n(141)}},function(e,t,n){(function(r,i){var s; @@ -18,5 +18,5 @@ e.exports=function(){"use strict";var e=function(e,n){return t(e.slice(),n)};fun * @author Chen, Yi-Cyuan [emn178@gmail.com] * @copyright Chen, Yi-Cyuan 2015-2018 * @license MIT - */!function(){"use strict";var o="input is invalid type",a="object"==typeof window,u=a?window:{};u.JS_SHA3_NO_WINDOW&&(a=!1);var c=!a&&"object"==typeof self;!u.JS_SHA3_NO_NODE_JS&&"object"==typeof r&&r.versions&&r.versions.node?u=i:c&&(u=self);var l=!u.JS_SHA3_NO_COMMON_JS&&"object"==typeof e&&e.exports,h=n(136),f=!u.JS_SHA3_NO_ARRAY_BUFFER&&"undefined"!=typeof ArrayBuffer,d="0123456789abcdef".split(""),p=[4,1024,262144,67108864],b=[0,8,16,24],g=[1,0,32898,0,32906,2147483648,2147516416,2147483648,32907,0,2147483649,0,2147516545,2147483648,32777,2147483648,138,0,136,0,2147516425,0,2147483658,0,2147516555,0,139,2147483648,32905,2147483648,32771,2147483648,32770,2147483648,128,2147483648,32778,0,2147483658,2147483648,2147516545,2147483648,32896,2147483648,2147483649,0,2147516424,2147483648],y=[224,256,384,512],m=[128,256],k=["hex","buffer","arrayBuffer","array","digest"],v={128:168,256:136};!u.JS_SHA3_NO_NODE_JS&&Array.isArray||(Array.isArray=function(e){return"[object Array]"===Object.prototype.toString.call(e)}),!f||!u.JS_SHA3_NO_ARRAY_BUFFER_IS_VIEW&&ArrayBuffer.isView||(ArrayBuffer.isView=function(e){return"object"==typeof e&&e.buffer&&e.buffer.constructor===ArrayBuffer});for(var w=function(e,t,n){return function(r){return new B(e,t,e).update(r)[n]()}},S=function(e,t,n){return function(r,i){return new B(e,t,i).update(r)[n]()}},_=function(e,t,n){return function(t,r,i,s){return R["cshake"+e].update(t,r,i,s)[n]()}},E=function(e,t,n){return function(t,r,i,s){return R["kmac"+e].update(t,r,i,s)[n]()}},x=function(e,t,n,r){for(var i=0;i>5,this.byteCount=this.blockCount<<2,this.outputBlocks=n>>5,this.extraBytes=(31&n)>>3;for(var r=0;r<50;++r)this.s[r]=0}function D(e,t,n){B.call(this,e,t,n)}B.prototype.update=function(e){if(this.finalized)throw new Error("finalize already called");var t,n=typeof e;if("string"!==n){if("object"!==n)throw new Error(o);if(null===e)throw new Error(o);if(f&&e.constructor===ArrayBuffer)e=new Uint8Array(e);else if(!(Array.isArray(e)||f&&ArrayBuffer.isView(e)))throw new Error(o);t=!0}for(var r,i,s=this.blocks,a=this.byteCount,u=e.length,c=this.blockCount,l=0,h=this.s;l>2]|=e[l]<>2]|=i<>2]|=(192|i>>6)<>2]|=(128|63&i)<=57344?(s[r>>2]|=(224|i>>12)<>2]|=(128|i>>6&63)<>2]|=(128|63&i)<>2]|=(240|i>>18)<>2]|=(128|i>>12&63)<>2]|=(128|i>>6&63)<>2]|=(128|63&i)<=a){for(this.start=r-a,this.block=s[c],r=0;r>=8);n>0;)i.unshift(n),n=255&(e>>=8),++r;return t?i.push(r):i.unshift(r),this.update(i),i.length},B.prototype.encodeString=function(e){var t,n=typeof e;if("string"!==n){if("object"!==n)throw new Error(o);if(null===e)throw new Error(o);if(f&&e.constructor===ArrayBuffer)e=new Uint8Array(e);else if(!(Array.isArray(e)||f&&ArrayBuffer.isView(e)))throw new Error(o);t=!0}var r=0,i=e.length;if(t)r=i;else for(var s=0;s=57344?r+=3:(a=65536+((1023&a)<<10|1023&e.charCodeAt(++s)),r+=4)}return r+=this.encode(8*r),this.update(e),r},B.prototype.bytepad=function(e,t){for(var n=this.encode(t),r=0;r>2]|=this.padding[3&t],this.lastByteIndex===this.byteCount)for(e[0]=e[n],t=1;t>4&15]+d[15&e]+d[e>>12&15]+d[e>>8&15]+d[e>>20&15]+d[e>>16&15]+d[e>>28&15]+d[e>>24&15];o%t==0&&(N(n),s=0)}return i&&(e=n[s],a+=d[e>>4&15]+d[15&e],i>1&&(a+=d[e>>12&15]+d[e>>8&15]),i>2&&(a+=d[e>>20&15]+d[e>>16&15])),a},B.prototype.arrayBuffer=function(){this.finalize();var e,t=this.blockCount,n=this.s,r=this.outputBlocks,i=this.extraBytes,s=0,o=0,a=this.outputBits>>3;e=i?new ArrayBuffer(r+1<<2):new ArrayBuffer(a);for(var u=new Uint32Array(e);o>8&255,u[e+2]=t>>16&255,u[e+3]=t>>24&255;a%n==0&&N(r)}return s&&(e=a<<2,t=r[o],u[e]=255&t,s>1&&(u[e+1]=t>>8&255),s>2&&(u[e+2]=t>>16&255)),u},D.prototype=new B,D.prototype.finalize=function(){return this.encode(this.outputBits,!0),B.prototype.finalize.call(this)};var N=function(e){var t,n,r,i,s,o,a,u,c,l,h,f,d,p,b,y,m,k,v,w,S,_,E,x,O,A,R,j,C,T,P,L,I,M,B,D,N,U,q,z,F,H,W,G,Y,$,J,V,K,Q,Z,X,ee,te,ne,re,ie,se,oe,ae,ue,ce,le;for(r=0;r<48;r+=2)i=e[0]^e[10]^e[20]^e[30]^e[40],s=e[1]^e[11]^e[21]^e[31]^e[41],o=e[2]^e[12]^e[22]^e[32]^e[42],a=e[3]^e[13]^e[23]^e[33]^e[43],u=e[4]^e[14]^e[24]^e[34]^e[44],c=e[5]^e[15]^e[25]^e[35]^e[45],l=e[6]^e[16]^e[26]^e[36]^e[46],h=e[7]^e[17]^e[27]^e[37]^e[47],t=(f=e[8]^e[18]^e[28]^e[38]^e[48])^(o<<1|a>>>31),n=(d=e[9]^e[19]^e[29]^e[39]^e[49])^(a<<1|o>>>31),e[0]^=t,e[1]^=n,e[10]^=t,e[11]^=n,e[20]^=t,e[21]^=n,e[30]^=t,e[31]^=n,e[40]^=t,e[41]^=n,t=i^(u<<1|c>>>31),n=s^(c<<1|u>>>31),e[2]^=t,e[3]^=n,e[12]^=t,e[13]^=n,e[22]^=t,e[23]^=n,e[32]^=t,e[33]^=n,e[42]^=t,e[43]^=n,t=o^(l<<1|h>>>31),n=a^(h<<1|l>>>31),e[4]^=t,e[5]^=n,e[14]^=t,e[15]^=n,e[24]^=t,e[25]^=n,e[34]^=t,e[35]^=n,e[44]^=t,e[45]^=n,t=u^(f<<1|d>>>31),n=c^(d<<1|f>>>31),e[6]^=t,e[7]^=n,e[16]^=t,e[17]^=n,e[26]^=t,e[27]^=n,e[36]^=t,e[37]^=n,e[46]^=t,e[47]^=n,t=l^(i<<1|s>>>31),n=h^(s<<1|i>>>31),e[8]^=t,e[9]^=n,e[18]^=t,e[19]^=n,e[28]^=t,e[29]^=n,e[38]^=t,e[39]^=n,e[48]^=t,e[49]^=n,p=e[0],b=e[1],$=e[11]<<4|e[10]>>>28,J=e[10]<<4|e[11]>>>28,j=e[20]<<3|e[21]>>>29,C=e[21]<<3|e[20]>>>29,ae=e[31]<<9|e[30]>>>23,ue=e[30]<<9|e[31]>>>23,H=e[40]<<18|e[41]>>>14,W=e[41]<<18|e[40]>>>14,M=e[2]<<1|e[3]>>>31,B=e[3]<<1|e[2]>>>31,y=e[13]<<12|e[12]>>>20,m=e[12]<<12|e[13]>>>20,V=e[22]<<10|e[23]>>>22,K=e[23]<<10|e[22]>>>22,T=e[33]<<13|e[32]>>>19,P=e[32]<<13|e[33]>>>19,ce=e[42]<<2|e[43]>>>30,le=e[43]<<2|e[42]>>>30,te=e[5]<<30|e[4]>>>2,ne=e[4]<<30|e[5]>>>2,D=e[14]<<6|e[15]>>>26,N=e[15]<<6|e[14]>>>26,k=e[25]<<11|e[24]>>>21,v=e[24]<<11|e[25]>>>21,Q=e[34]<<15|e[35]>>>17,Z=e[35]<<15|e[34]>>>17,L=e[45]<<29|e[44]>>>3,I=e[44]<<29|e[45]>>>3,x=e[6]<<28|e[7]>>>4,O=e[7]<<28|e[6]>>>4,re=e[17]<<23|e[16]>>>9,ie=e[16]<<23|e[17]>>>9,U=e[26]<<25|e[27]>>>7,q=e[27]<<25|e[26]>>>7,w=e[36]<<21|e[37]>>>11,S=e[37]<<21|e[36]>>>11,X=e[47]<<24|e[46]>>>8,ee=e[46]<<24|e[47]>>>8,G=e[8]<<27|e[9]>>>5,Y=e[9]<<27|e[8]>>>5,A=e[18]<<20|e[19]>>>12,R=e[19]<<20|e[18]>>>12,se=e[29]<<7|e[28]>>>25,oe=e[28]<<7|e[29]>>>25,z=e[38]<<8|e[39]>>>24,F=e[39]<<8|e[38]>>>24,_=e[48]<<14|e[49]>>>18,E=e[49]<<14|e[48]>>>18,e[0]=p^~y&k,e[1]=b^~m&v,e[10]=x^~A&j,e[11]=O^~R&C,e[20]=M^~D&U,e[21]=B^~N&q,e[30]=G^~$&V,e[31]=Y^~J&K,e[40]=te^~re&se,e[41]=ne^~ie&oe,e[2]=y^~k&w,e[3]=m^~v&S,e[12]=A^~j&T,e[13]=R^~C&P,e[22]=D^~U&z,e[23]=N^~q&F,e[32]=$^~V&Q,e[33]=J^~K&Z,e[42]=re^~se&ae,e[43]=ie^~oe&ue,e[4]=k^~w&_,e[5]=v^~S&E,e[14]=j^~T&L,e[15]=C^~P&I,e[24]=U^~z&H,e[25]=q^~F&W,e[34]=V^~Q&X,e[35]=K^~Z&ee,e[44]=se^~ae&ce,e[45]=oe^~ue&le,e[6]=w^~_&p,e[7]=S^~E&b,e[16]=T^~L&x,e[17]=P^~I&O,e[26]=z^~H&M,e[27]=F^~W&B,e[36]=Q^~X&G,e[37]=Z^~ee&Y,e[46]=ae^~ce&te,e[47]=ue^~le&ne,e[8]=_^~p&y,e[9]=E^~b&m,e[18]=L^~x&A,e[19]=I^~O&R,e[28]=H^~M&D,e[29]=W^~B&N,e[38]=X^~G&$,e[39]=ee^~Y&J,e[48]=ce^~te&re,e[49]=le^~ne&ie,e[0]^=g[r],e[1]^=g[r+1]};if(l)e.exports=R;else{for(C=0;C255)return!1;return!0}function o(e,t){return(65535&e)*t+(((e>>>16)*t&65535)<<16)}function a(e,t){return e<>>32-t}function u(e){return e=o(e^=e>>>16,2246822507),e=o(e^=e>>>13,3266489909),e^=e>>>16}function c(e,t){e=[e[0]>>>16,65535&e[0],e[1]>>>16,65535&e[1]],t=[t[0]>>>16,65535&t[0],t[1]>>>16,65535&t[1]];var n=[0,0,0,0];return n[3]+=e[3]+t[3],n[2]+=n[3]>>>16,n[3]&=65535,n[2]+=e[2]+t[2],n[1]+=n[2]>>>16,n[2]&=65535,n[1]+=e[1]+t[1],n[0]+=n[1]>>>16,n[1]&=65535,n[0]+=e[0]+t[0],n[0]&=65535,[n[0]<<16|n[1],n[2]<<16|n[3]]}function l(e,t){e=[e[0]>>>16,65535&e[0],e[1]>>>16,65535&e[1]],t=[t[0]>>>16,65535&t[0],t[1]>>>16,65535&t[1]];var n=[0,0,0,0];return n[3]+=e[3]*t[3],n[2]+=n[3]>>>16,n[3]&=65535,n[2]+=e[2]*t[3],n[1]+=n[2]>>>16,n[2]&=65535,n[2]+=e[3]*t[2],n[1]+=n[2]>>>16,n[2]&=65535,n[1]+=e[1]*t[3],n[0]+=n[1]>>>16,n[1]&=65535,n[1]+=e[2]*t[2],n[0]+=n[1]>>>16,n[1]&=65535,n[1]+=e[3]*t[1],n[0]+=n[1]>>>16,n[1]&=65535,n[0]+=e[0]*t[3]+e[1]*t[2]+e[2]*t[1]+e[3]*t[0],n[0]&=65535,[n[0]<<16|n[1],n[2]<<16|n[3]]}function h(e,t){return 32===(t%=64)?[e[1],e[0]]:t<32?[e[0]<>>32-t,e[1]<>>32-t]:(t-=32,[e[1]<>>32-t,e[0]<>>32-t])}function f(e,t){return 0===(t%=64)?e:t<32?[e[0]<>>32-t,e[1]<>>1]),e=d(e=l(e,[4283543511,3981806797]),[0,e[0]>>>1]),e=d(e=l(e,[3301882366,444984403]),[0,e[0]>>>1])}i.x86.hash32=function(e,t){if(!i.inputValidation||s(e)){t=t||0;for(var n=e.length%4,r=e.length-n,c=t,l=0,h=3432918353,f=461845907,d=0;d>>0}},i.x86.hash128=function(e,t){if(!i.inputValidation||s(e)){t=t||0;for(var n=e.length%16,r=e.length-n,c=t,l=t,h=t,f=t,d=0,p=0,b=0,g=0,y=597399067,m=2869860233,k=951274213,v=2716044179,w=0;w>>0).toString(16)).slice(-8)+("00000000"+(l>>>0).toString(16)).slice(-8)+("00000000"+(h>>>0).toString(16)).slice(-8)+("00000000"+(f>>>0).toString(16)).slice(-8)}},i.x64.hash128=function(e,t){if(!i.inputValidation||s(e)){t=t||0;for(var n=e.length%16,r=e.length-n,o=[0,t],a=[0,t],u=[0,0],b=[0,0],g=[2277735313,289559509],y=[1291169091,658871167],m=0;m>>0).toString(16)).slice(-8)+("00000000"+(o[1]>>>0).toString(16)).slice(-8)+("00000000"+(a[0]>>>0).toString(16)).slice(-8)+("00000000"+(a[1]>>>0).toString(16)).slice(-8)}},e.exports&&(t=e.exports=i),t.murmurHash3=i}()},function(e,t,n){"use strict";const{Buffer:r}=n(0),i=n(10),s=self.crypto||self.msCrypto,o=async(e,t)=>{if("undefined"==typeof self||!self.crypto&&!self.msCrypto)throw new Error("Please use a browser with webcrypto support and ensure the code has been delivered securely via HTTPS/TLS and run within a Secure Context");switch(t){case"sha1":return r.from(await s.subtle.digest({name:"SHA-1"},e));case"sha2-256":return r.from(await s.subtle.digest({name:"SHA-256"},e));case"sha2-512":return r.from(await s.subtle.digest({name:"SHA-512"},e));case"dbl-sha2-256":{const t=await s.subtle.digest({name:"SHA-256"},e);return r.from(await s.subtle.digest({name:"SHA-256"},t))}default:throw new Error(t+" is not a supported algorithm")}};e.exports={factory:e=>async t=>o(t,e),digest:o,multihashing:async(e,t,n)=>{const r=await o(e,t);return i.encode(r,t,n)}}},function(e,t,n){"use strict";const{Buffer:r}=n(0);e.exports={fromNumberTo32BitBuf:e=>{const t=new Array(4);for(let n=0;n<4;n++)t[n]=255&e,e>>=8;return r.from(t)}}},function(e,t,n){"use strict";const{Buffer:r}=n(0),i=n(142),s={init:i.blake2bInit,update:i.blake2bUpdate,digest:i.blake2bFinal},o={init:i.blake2sInit,update:i.blake2sUpdate,digest:i.blake2sFinal},a=(e,t)=>async n=>{const i=t.init(e,null);return t.update(i,n),r.from(t.digest(i))};e.exports=e=>{for(let t=0;t<64;t++)e[45569+t]=a(t+1,s);for(let t=0;t<32;t++)e[45633+t]=a(t+1,o)}},function(e,t,n){var r=n(143),i=n(144);e.exports={blake2b:r.blake2b,blake2bHex:r.blake2bHex,blake2bInit:r.blake2bInit,blake2bUpdate:r.blake2bUpdate,blake2bFinal:r.blake2bFinal,blake2s:i.blake2s,blake2sHex:i.blake2sHex,blake2sInit:i.blake2sInit,blake2sUpdate:i.blake2sUpdate,blake2sFinal:i.blake2sFinal}},function(e,t,n){var r=n(53);function i(e,t,n){var r=e[t]+e[n],i=e[t+1]+e[n+1];r>=4294967296&&i++,e[t]=r,e[t+1]=i}function s(e,t,n,r){var i=e[t]+n;n<0&&(i+=4294967296);var s=e[t+1]+r;i>=4294967296&&s++,e[t]=i,e[t+1]=s}function o(e,t){return e[t]^e[t+1]<<8^e[t+2]<<16^e[t+3]<<24}function a(e,t,n,r,o,a){var u=h[o],c=h[o+1],f=h[a],d=h[a+1];i(l,e,t),s(l,e,u,c);var p=l[r]^l[e],b=l[r+1]^l[e+1];l[r]=b,l[r+1]=p,i(l,n,r),p=l[t]^l[n],b=l[t+1]^l[n+1],l[t]=p>>>24^b<<8,l[t+1]=b>>>24^p<<8,i(l,e,t),s(l,e,f,d),p=l[r]^l[e],b=l[r+1]^l[e+1],l[r]=p>>>16^b<<16,l[r+1]=b>>>16^p<<16,i(l,n,r),p=l[t]^l[n],b=l[t+1]^l[n+1],l[t]=b>>>31^p<<1,l[t+1]=p>>>31^b<<1}var u=new Uint32Array([4089235720,1779033703,2227873595,3144134277,4271175723,1013904242,1595750129,2773480762,2917565137,1359893119,725511199,2600822924,4215389547,528734635,327033209,1541459225]),c=new Uint8Array([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,14,10,4,8,9,15,13,6,1,12,0,2,11,7,5,3,11,8,12,0,5,2,15,13,10,14,3,6,7,1,9,4,7,9,3,1,13,12,11,14,2,6,5,10,4,0,15,8,9,0,5,7,2,4,10,15,14,1,11,12,6,8,3,13,2,12,6,10,0,11,8,3,4,13,7,5,15,14,1,9,12,5,1,15,14,13,4,10,0,7,6,3,9,2,8,11,13,11,7,14,12,1,3,9,5,0,15,4,8,6,2,10,6,15,14,9,11,3,0,8,12,2,13,7,1,4,10,5,10,2,8,4,7,6,1,5,15,11,9,14,3,12,13,0,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,14,10,4,8,9,15,13,6,1,12,0,2,11,7,5,3].map((function(e){return 2*e}))),l=new Uint32Array(32),h=new Uint32Array(32);function f(e,t){var n=0;for(n=0;n<16;n++)l[n]=e.h[n],l[n+16]=u[n];for(l[24]=l[24]^e.t,l[25]=l[25]^e.t/4294967296,t&&(l[28]=~l[28],l[29]=~l[29]),n=0;n<32;n++)h[n]=o(e.b,4*n);for(n=0;n<12;n++)a(0,8,16,24,c[16*n+0],c[16*n+1]),a(2,10,18,26,c[16*n+2],c[16*n+3]),a(4,12,20,28,c[16*n+4],c[16*n+5]),a(6,14,22,30,c[16*n+6],c[16*n+7]),a(0,10,20,30,c[16*n+8],c[16*n+9]),a(2,12,22,24,c[16*n+10],c[16*n+11]),a(4,14,16,26,c[16*n+12],c[16*n+13]),a(6,8,18,28,c[16*n+14],c[16*n+15]);for(n=0;n<16;n++)e.h[n]=e.h[n]^l[n]^l[n+16]}function d(e,t){if(0===e||e>64)throw new Error("Illegal output length, expected 0 < length <= 64");if(t&&t.length>64)throw new Error("Illegal key, expected Uint8Array with 0 < length <= 64");for(var n={b:new Uint8Array(128),h:new Uint32Array(16),t:0,c:0,outlen:e},r=0;r<16;r++)n.h[r]=u[r];var i=t?t.length:0;return n.h[0]^=16842752^i<<8^e,t&&(p(n,t),n.c=128),n}function p(e,t){for(var n=0;n>2]>>8*(3&n);return t}function g(e,t,n){n=n||64,e=r.normalizeInput(e);var i=d(n,t);return p(i,e),b(i)}e.exports={blake2b:g,blake2bHex:function(e,t,n){var i=g(e,t,n);return r.toHex(i)},blake2bInit:d,blake2bUpdate:p,blake2bFinal:b}},function(e,t,n){var r=n(53);function i(e,t){return e[t]^e[t+1]<<8^e[t+2]<<16^e[t+3]<<24}function s(e,t,n,r,i,s){c[e]=c[e]+c[t]+i,c[r]=o(c[r]^c[e],16),c[n]=c[n]+c[r],c[t]=o(c[t]^c[n],12),c[e]=c[e]+c[t]+s,c[r]=o(c[r]^c[e],8),c[n]=c[n]+c[r],c[t]=o(c[t]^c[n],7)}function o(e,t){return e>>>t^e<<32-t}var a=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),u=new Uint8Array([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,14,10,4,8,9,15,13,6,1,12,0,2,11,7,5,3,11,8,12,0,5,2,15,13,10,14,3,6,7,1,9,4,7,9,3,1,13,12,11,14,2,6,5,10,4,0,15,8,9,0,5,7,2,4,10,15,14,1,11,12,6,8,3,13,2,12,6,10,0,11,8,3,4,13,7,5,15,14,1,9,12,5,1,15,14,13,4,10,0,7,6,3,9,2,8,11,13,11,7,14,12,1,3,9,5,0,15,4,8,6,2,10,6,15,14,9,11,3,0,8,12,2,13,7,1,4,10,5,10,2,8,4,7,6,1,5,15,11,9,14,3,12,13,0]),c=new Uint32Array(16),l=new Uint32Array(16);function h(e,t){var n=0;for(n=0;n<8;n++)c[n]=e.h[n],c[n+8]=a[n];for(c[12]^=e.t,c[13]^=e.t/4294967296,t&&(c[14]=~c[14]),n=0;n<16;n++)l[n]=i(e.b,4*n);for(n=0;n<10;n++)s(0,4,8,12,l[u[16*n+0]],l[u[16*n+1]]),s(1,5,9,13,l[u[16*n+2]],l[u[16*n+3]]),s(2,6,10,14,l[u[16*n+4]],l[u[16*n+5]]),s(3,7,11,15,l[u[16*n+6]],l[u[16*n+7]]),s(0,5,10,15,l[u[16*n+8]],l[u[16*n+9]]),s(1,6,11,12,l[u[16*n+10]],l[u[16*n+11]]),s(2,7,8,13,l[u[16*n+12]],l[u[16*n+13]]),s(3,4,9,14,l[u[16*n+14]],l[u[16*n+15]]);for(n=0;n<8;n++)e.h[n]^=c[n]^c[n+8]}function f(e,t){if(!(e>0&&e<=32))throw new Error("Incorrect output length, should be in [1, 32]");var n=t?t.length:0;if(t&&!(n>0&&n<=32))throw new Error("Incorrect key length, should be in [1, 32]");var r={h:new Uint32Array(a),b:new Uint32Array(64),c:0,t:0,outlen:e};return r.h[0]^=16842752^n<<8^e,n>0&&(d(r,t),r.c=64),r}function d(e,t){for(var n=0;n>2]>>8*(3&n)&255;return t}function b(e,t,n){n=n||32,e=r.normalizeInput(e);var i=f(n,t);return d(i,e),p(i)}e.exports={blake2s:b,blake2sHex:function(e,t,n){var i=b(e,t,n);return r.toHex(i)},blake2sInit:f,blake2sUpdate:d,blake2sFinal:p}},function(e,t,n){"use strict";const r=n(48),i=n(54);e.exports=(e,t)=>{const n=(e=>{if(i.isDAGLink(e))return e;if(!("cid"in e||"hash"in e||"Hash"in e||"multihash"in e))throw new Error("Link must be a DAGLink or DAGLink-like. Convert the DAGNode into a DAGLink via `node.toDAGLink()`.");return new i(e.Name||e.name,e.Tsize||e.size,e.Hash||e.multihash||e.hash||e.cid)})(t);e._links.push(n),e._links=r(e._links)}},function(e,t,n){"use strict";const r=n(12);e.exports.createDagLinkFromB58EncodedHash=function(e){return new r(e.Name||e.name||"",e.Tsize||e.Size||e.size||0,e.Hash||e.hash||e.multihash||e.cid)}},function(e,t,n){"use strict";const r=n(17),{Buffer:i}=n(0);e.exports=(e,t)=>{if("string"==typeof t)e._links=e._links.filter(e=>e.Name!==t);else{if(!i.isBuffer(t)&&!r.isCID(t))throw new Error("second arg needs to be a name or CID");e._links=e._links.filter(e=>!e.Hash.equals(t))}}},function(e,t,n){"use strict";const r=n(17),i=n(55);t.resolve=(e,t)=>{let n=i.deserialize(e);const s=t.split("/").filter(Boolean);for(;s.length;){const e=s.shift();if(void 0===n[e]){for(const t of n.Links)if(t.Name===e)return{value:t.Hash,remainderPath:s.join("/")};throw new Error(`Object has no property '${e}'`)}if(n=n[e],r.isCID(n))return{value:n,remainderPath:s.join("/")}}return{value:n,remainderPath:""}},t.tree=function*(e){const t=i.deserialize(e);yield"Data",yield"Links";for(let e=0;et,stringify:JSON.stringify}},function(e,t,n){"use strict";const r=n(20),i=n(152),s=n(56),{LastWriteWins:o,NoZeroes:a}=s,u=n(57),{isDefined:c,findUniques:l,difference:h,io:f}=n(22),d=["heads"],p=(e,t)=>e.slice(e.length-Math.min(e.length,t),e.length);e.exports=class{static async toMultihash(e,t,{format:n}={}){if(!c(e))throw u.IPFSNotDefinedError();if(!c(t))throw u.LogNotDefinedError();if(c(n)||(n="dag-cbor"),t.values.length<1)throw new Error("Can't serialize an empty log");return f.write(e,n,t.toJSON(),{links:d})}static async fromMultihash(e,t,{length:n=-1,exclude:r=[],timeout:s,concurrency:l,sortFn:h,onProgressCallback:b}){if(!c(e))throw u.IPFSNotDefinedError();if(!c(t))throw new Error("Invalid hash: "+t);const g=await f.read(e,t,{links:d});if(!g.heads||!g.id)throw u.NotALogError();h=h||a(o);const y=await i.fetchAll(e,g.heads,{length:n,exclude:r,timeout:s,concurrency:l,onProgressCallback:b}),m=g.id,k=n>-1?p(y.sort(h),n):y,v=k.filter(e=>g.heads.includes(e.hash));return{logId:m,entries:k,heads:v}}static async fromEntryHash(e,t,{length:n=-1,exclude:r=[],timeout:s,concurrency:l,sortFn:h,onProgressCallback:f}){if(!c(e))throw u.IpfsNotDefinedError();if(!c(t))throw new Error("'hash' must be defined");const d=Array.isArray(t)?t:[t];n=n>-1?Math.max(n,1):n;const b=await i.fetchParallel(e,d,{length:n,exclude:r,timeout:s,concurrency:l,onProgressCallback:f});return h=h||a(o),{entries:n>-1?p(b.sort(h),n):b}}static async fromJSON(e,t,{length:n=-1,timeout:s,concurrency:o,onProgressCallback:a}){if(!c(e))throw u.IPFSNotDefinedError();const{id:l,heads:h}=t,f=h.map(e=>e.hash);return{logId:l,entries:(await i.fetchParallel(e,f,{length:n,timeout:s,concurrency:o,onProgressCallback:a})).sort(r.compare),heads:h}}static async fromEntry(e,t,{length:n=-1,exclude:s=[],timeout:o,concurrency:a,onProgressCallback:f}){if(!c(e))throw u.IPFSNotDefinedError();if(!c(t))throw new Error("'sourceEntries' must be defined");if(!Array.isArray(t)&&!r.isEntry(t))throw new Error("'sourceEntries' argument must be an array of Entry instances or a single Entry");Array.isArray(t)||(t=[t]),n=n>-1?Math.max(n,t.length):n;const d=t.map(e=>e.hash),p=await i.fetchParallel(e,d,{length:n,exclude:s,timeout:o,concurrency:a,onProgressCallback:f}),b=t.concat(p).concat(s),g=l(b,"hash").sort(r.compare),y=g.slice(n>-1?-n:-g.length),m=((e,t)=>{var n=e.slice(t.length,e.length);return t.concat(n)})(y,h(y,t,"hash"));return{logId:m[m.length-1].id,entries:m}}}},function(e,t,n){"use strict";const r=n(42),i=n(153),s=n(20),o=e=>e&&e.length>0;class a{static async fetchParallel(e,t,{length:n,exclude:i=[],timeout:s,concurrency:o,onProgressCallback:u}){const c=(e,t)=>e.concat(t),l=await r(t,async t=>a.fetchAll(e,t,{length:n,exclude:i,timeout:s,onProgressCallback:u,concurrency:o}),{concurrency:Math.max(o||t.length,1)});return l.reduce(c,[])}static async fetchAll(e,t,{length:n=-1,exclude:a=[],timeout:u,onProgressCallback:c,onStartProgressCallback:l,concurrency:h=32,delay:f=0}={}){let d=[],p={},b={},g=Array.isArray(t)?{0:t.slice()}:{0:[t]},y=0,m=0,k=0;const v=(e,t)=>{b[e]||(g[t]||(g[t]=[]),g[t].includes(e)||g[t].push(e),b[e]=!0)},w=async t=>{if(t&&!p[t])return new Promise(async(r,i)=>{const o=u&&u>0?setTimeout(()=>{console.warn(`Warning: Couldn't fetch entry '${t}', request timed out (${u}ms)`),r()},u):null;l&&l(t,null,0,d.length);try{if((e=>{if(s.isEntry(e)){const r=e.clock.time;m=Math.max(m,r),k=d.length>0?Math.min(d[d.length-1].clock.time,k):m;const i=d.length>=n&&r>=k,s=e=>m-r+(e+1)*e;(n<0||d.lengthk||r===k&&!p[e.hash])&&e.next.forEach(e=>v(e,s(0))),e.refs&&d.length+e.refs.length<=n&&e.refs.forEach((e,t)=>v(e,s(t))))}})(await s.fromMultihash(e,t)),f>0){const e=(e=0)=>new Promise(t=>setTimeout(t,e));await e(f)}r()}catch(e){i(e)}finally{clearTimeout(o)}})};return a.forEach(e=>{p[e.hash]=!0}),await i(async()=>{if(yObject.keys(g).reduce((t,n,r)=>{const i=g[n];for(;i.length>0&&t.lengthvoid 0!==Object.values(g).find(o)),d}}e.exports=a},function(e,t,n){"use strict";const r=async(e,t)=>{if(t(await e()))return r(e,t)};e.exports=r,e.exports.default=r},function(e,t,n){"use strict";e.exports=class{async canAppend(e,t){return!0}}},function(e,t,n){"use strict";e.exports=class{constructor(e={}){this._cache=e}set(e,t){this._cache[e]=t}get(e){return this._cache[e]}delete(e){return delete this._cache[e]}add(e){this._cache=Object.assign(this._cache,e)}get length(){return Object.values(this._cache).length}}},function(e,t,n){"use strict";e.exports=class{constructor(e){this.id=e,this._index=[]}get(){return this._index}async updateIndex(e,t){this._index=e.values}}},function(e,t,n){const r=n(5).EventEmitter,i=n(158),s=n(41),o=n(58),a=o.create("replicator",{color:o.Colors.Cyan});o.setLogLevel("ERROR");const u=e=>e.next,c=(e,t)=>e.concat(t),l=e=>null!=e,h=(e,t)=>(e[t]=t,e);e.exports=class extends r{constructor(e,t){super(),this._store=e,this._fetching={},this._stats={tasksRequested:0,tasksStarted:0,tasksProcessed: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.warn("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 Math.max(Object.keys(this._queue).length-this.tasksRunning,0)}get tasksFinished(){return this._stats.tasksProcessed}getQueue(){return Object.values(this._queue)}load(e){const t=e=>{const t=e.hash||e;return!this._store._oplog.has(t)&&!this._fetching[t]&&!this._queue[t]};try{e.filter(l).filter(t).forEach(this._addToQueue.bind(this)),setTimeout(()=>this._processQueue(),0)}catch(e){console.error(e)}}stop(){clearInterval(this._flushTimer),this.removeAllListeners("load.added"),this.removeAllListeners("load.end"),this.removeAllListeners("load.progress")}_addToQueue(e){const t=e.hash||e;this._stats.tasksRequested+=1,this._queue[t]=e}async _processQueue(){if(this.tasksRunningdelete this._queue[e.hash||e]);const n=e=>e.reduce(c,[]).reduce(h,{}),r=e=>{const n=Object.values(e).filter(l);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)}n.length>0&&this.load(n)};return i(t,e=>this._processOne(e)).then(n).then(r)}}async _processOne(e){const t=e.hash||e;if(this._store._oplog.has(t)||this._fetching[t])return;this._fetching[t]=t,this.emit("load.added",e),this._stats.tasksStarted+=1;const n=await s.fromEntryHash(this._store._ipfs,this._store.identity,t,{logId:this._store._oplog.id,access:this._store.access,length:1,exclude:[]});this._buffer.push(n);const r=n.values[0];return delete this._queue[t],this._stats.tasksProcessed+=1,this.emit("load.progress",this._id,t,r,null,this._buffer.length),n.values.map(u).reduce(c,[])}}},function(e,t,n){"use strict";const r=n(159);e.exports=async(e,t,{concurrency:n=1/0,stopOnError:i=!0}={})=>new Promise((s,o)=>{if("function"!=typeof t)throw new TypeError("Mapper function is required");if(!("number"==typeof n&&n>=1))throw new TypeError(`Expected \`concurrency\` to be a number from 1 and up, got \`${n}\` (${typeof n})`);const a=[],u=[],c=e[Symbol.iterator]();let l=!1,h=!1,f=0,d=0;const p=()=>{if(l)return;const e=c.next(),n=d;if(d++,e.done)return h=!0,void(0===f&&(i||0===u.length?s(a):o(new r(u))));f++,(async()=>{try{const r=await e.value;a[n]=await t(r,n),f--,p()}catch(e){i?(l=!0,o(e)):(u.push(e),f--,p())}})()};for(let e=0;ee instanceof Error?e:null!==e&&"object"==typeof e?Object.assign(new Error(e.message),e):new Error(e))).map(e=>"string"==typeof e.stack?i(e.stack).replace(/\s+at .*aggregate-error\/index.js:\d+:\d+\)?/g,""):String(e)).join("\n");t="\n"+r(t,4),super(t),this.name="AggregateError",Object.defineProperty(this,"_errors",{value:e})}*[Symbol.iterator](){for(const e of this._errors)yield e}}e.exports=s},function(e,t,n){"use strict";e.exports=(e,t=1,n)=>{if(n={indent:" ",includeEmptyLines:!1,...n},"string"!=typeof e)throw new TypeError(`Expected \`input\` to be a \`string\`, got \`${typeof e}\``);if("number"!=typeof t)throw new TypeError(`Expected \`count\` to be a \`number\`, got \`${typeof t}\``);if("string"!=typeof n.indent)throw new TypeError(`Expected \`options.indent\` to be a \`string\`, got \`${typeof n.indent}\``);if(0===t)return e;const r=n.includeEmptyLines?/^/gm:/^(?!\s*$)/gm;return e.replace(r,n.indent.repeat(t))}},function(e,t,n){"use strict";const r=n(162),i=/\s+at.*(?:\(|\s)(.*)\)?/,s=/^(?:(?:(?:node|(?:internal\/[\w/]*|.*node_modules\/(?:babel-polyfill|pirates)\/.*)?\w+)\.js:\d+:\d+)|native)/,o=void 0===r.homedir?"":r.homedir();e.exports=(e,t)=>(t=Object.assign({pretty:!1},t),e.replace(/\\/g,"/").split("\n").filter(e=>{const t=e.match(i);if(null===t||!t[1])return!0;const n=t[1];return!n.includes(".app/Contents/Resources/electron.asar")&&!n.includes(".app/Contents/Resources/default_app.asar")&&!s.test(n)}).filter(e=>""!==e.trim()).map(e=>t.pretty?e.replace(i,(e,t)=>e.replace(t,t.replace(o,"~"))):e).join("\n"))},function(e,t){},function(e,t){},function(e,t,n){(function(e){var r=Object.getOwnPropertyDescriptors||function(e){for(var t=Object.keys(e),n={},r=0;r=s)return e;switch(e){case"%s":return String(r[n++]);case"%d":return Number(r[n++]);case"%j":try{return JSON.stringify(r[n++])}catch(e){return"[Circular]"}default:return e}})),u=r[n];n=3&&(r.depth=arguments[2]),arguments.length>=4&&(r.colors=arguments[3]),p(n)?r.showHidden=n:n&&t._extend(r,n),m(r.showHidden)&&(r.showHidden=!1),m(r.depth)&&(r.depth=2),m(r.colors)&&(r.colors=!1),m(r.customInspect)&&(r.customInspect=!0),r.colors&&(r.stylize=u),l(r,e,r.depth)}function u(e,t){var n=a.styles[t];return n?"["+a.colors[n][0]+"m"+e+"["+a.colors[n][1]+"m":e}function c(e,t){return e}function l(e,n,r){if(e.customInspect&&n&&_(n.inspect)&&n.inspect!==t.inspect&&(!n.constructor||n.constructor.prototype!==n)){var i=n.inspect(r,e);return y(i)||(i=l(e,i,r)),i}var s=function(e,t){if(m(t))return e.stylize("undefined","undefined");if(y(t)){var n="'"+JSON.stringify(t).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return e.stylize(n,"string")}if(g(t))return e.stylize(""+t,"number");if(p(t))return e.stylize(""+t,"boolean");if(b(t))return e.stylize("null","null")}(e,n);if(s)return s;var o=Object.keys(n),a=function(e){var t={};return e.forEach((function(e,n){t[e]=!0})),t}(o);if(e.showHidden&&(o=Object.getOwnPropertyNames(n)),S(n)&&(o.indexOf("message")>=0||o.indexOf("description")>=0))return h(n);if(0===o.length){if(_(n)){var u=n.name?": "+n.name:"";return e.stylize("[Function"+u+"]","special")}if(k(n))return e.stylize(RegExp.prototype.toString.call(n),"regexp");if(w(n))return e.stylize(Date.prototype.toString.call(n),"date");if(S(n))return h(n)}var c,v="",E=!1,x=["{","}"];(d(n)&&(E=!0,x=["[","]"]),_(n))&&(v=" [Function"+(n.name?": "+n.name:"")+"]");return k(n)&&(v=" "+RegExp.prototype.toString.call(n)),w(n)&&(v=" "+Date.prototype.toUTCString.call(n)),S(n)&&(v=" "+h(n)),0!==o.length||E&&0!=n.length?r<0?k(n)?e.stylize(RegExp.prototype.toString.call(n),"regexp"):e.stylize("[Object]","special"):(e.seen.push(n),c=E?function(e,t,n,r,i){for(var s=[],o=0,a=t.length;o=0&&0,e+t.replace(/\u001b\[\d\d?m/g,"").length+1}),0)>60)return n[0]+(""===t?"":t+"\n ")+" "+e.join(",\n ")+" "+n[1];return n[0]+t+" "+e.join(", ")+" "+n[1]}(c,v,x)):x[0]+v+x[1]}function h(e){return"["+Error.prototype.toString.call(e)+"]"}function f(e,t,n,r,i,s){var o,a,u;if((u=Object.getOwnPropertyDescriptor(t,i)||{value:t[i]}).get?a=u.set?e.stylize("[Getter/Setter]","special"):e.stylize("[Getter]","special"):u.set&&(a=e.stylize("[Setter]","special")),R(r,i)||(o="["+i+"]"),a||(e.seen.indexOf(u.value)<0?(a=b(n)?l(e,u.value,null):l(e,u.value,n-1)).indexOf("\n")>-1&&(a=s?a.split("\n").map((function(e){return" "+e})).join("\n").substr(2):"\n"+a.split("\n").map((function(e){return" "+e})).join("\n")):a=e.stylize("[Circular]","special")),m(o)){if(s&&i.match(/^\d+$/))return a;(o=JSON.stringify(""+i)).match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(o=o.substr(1,o.length-2),o=e.stylize(o,"name")):(o=o.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),o=e.stylize(o,"string"))}return o+": "+a}function d(e){return Array.isArray(e)}function p(e){return"boolean"==typeof e}function b(e){return null===e}function g(e){return"number"==typeof e}function y(e){return"string"==typeof e}function m(e){return void 0===e}function k(e){return v(e)&&"[object RegExp]"===E(e)}function v(e){return"object"==typeof e&&null!==e}function w(e){return v(e)&&"[object Date]"===E(e)}function S(e){return v(e)&&("[object Error]"===E(e)||e instanceof Error)}function _(e){return"function"==typeof e}function E(e){return Object.prototype.toString.call(e)}function x(e){return e<10?"0"+e.toString(10):e.toString(10)}t.debuglog=function(n){if(m(s)&&(s=e.env.NODE_DEBUG||""),n=n.toUpperCase(),!o[n])if(new RegExp("\\b"+n+"\\b","i").test(s)){var r=e.pid;o[n]=function(){var e=t.format.apply(t,arguments);console.error("%s %d: %s",n,r,e)}}else o[n]=function(){};return o[n]},t.inspect=a,a.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},a.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"},t.isArray=d,t.isBoolean=p,t.isNull=b,t.isNullOrUndefined=function(e){return null==e},t.isNumber=g,t.isString=y,t.isSymbol=function(e){return"symbol"==typeof e},t.isUndefined=m,t.isRegExp=k,t.isObject=v,t.isDate=w,t.isError=S,t.isFunction=_,t.isPrimitive=function(e){return null===e||"boolean"==typeof e||"number"==typeof e||"string"==typeof e||"symbol"==typeof e||void 0===e},t.isBuffer=n(165);var O=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function A(){var e=new Date,t=[x(e.getHours()),x(e.getMinutes()),x(e.getSeconds())].join(":");return[e.getDate(),O[e.getMonth()],t].join(" ")}function R(e,t){return Object.prototype.hasOwnProperty.call(e,t)}t.log=function(){console.log("%s - %s",A(),t.format.apply(t,arguments))},t.inherits=n(166),t._extend=function(e,t){if(!t||!v(t))return e;for(var n=Object.keys(t),r=n.length;r--;)e[n[r]]=t[n[r]];return e};var j="undefined"!=typeof Symbol?Symbol("util.promisify.custom"):void 0;function C(e,t){if(!e){var n=new Error("Promise was rejected with a falsy value");n.reason=e,e=n}return t(e)}t.promisify=function(e){if("function"!=typeof e)throw new TypeError('The "original" argument must be of type Function');if(j&&e[j]){var t;if("function"!=typeof(t=e[j]))throw new TypeError('The "util.promisify.custom" argument must be of type Function');return Object.defineProperty(t,j,{value:t,enumerable:!1,writable:!1,configurable:!0}),t}function t(){for(var t,n,r=new Promise((function(e,r){t=e,n=r})),i=[],s=0;s>5,this.byteCount=this.blockCount<<2,this.outputBlocks=n>>5,this.extraBytes=(31&n)>>3;for(var r=0;r<50;++r)this.s[r]=0}function D(e,t,n){B.call(this,e,t,n)}B.prototype.update=function(e){if(this.finalized)throw new Error("finalize already called");var t,n=typeof e;if("string"!==n){if("object"!==n)throw new Error(o);if(null===e)throw new Error(o);if(f&&e.constructor===ArrayBuffer)e=new Uint8Array(e);else if(!(Array.isArray(e)||f&&ArrayBuffer.isView(e)))throw new Error(o);t=!0}for(var r,i,s=this.blocks,a=this.byteCount,u=e.length,c=this.blockCount,l=0,h=this.s;l>2]|=e[l]<>2]|=i<>2]|=(192|i>>6)<>2]|=(128|63&i)<=57344?(s[r>>2]|=(224|i>>12)<>2]|=(128|i>>6&63)<>2]|=(128|63&i)<>2]|=(240|i>>18)<>2]|=(128|i>>12&63)<>2]|=(128|i>>6&63)<>2]|=(128|63&i)<=a){for(this.start=r-a,this.block=s[c],r=0;r>=8);n>0;)i.unshift(n),n=255&(e>>=8),++r;return t?i.push(r):i.unshift(r),this.update(i),i.length},B.prototype.encodeString=function(e){var t,n=typeof e;if("string"!==n){if("object"!==n)throw new Error(o);if(null===e)throw new Error(o);if(f&&e.constructor===ArrayBuffer)e=new Uint8Array(e);else if(!(Array.isArray(e)||f&&ArrayBuffer.isView(e)))throw new Error(o);t=!0}var r=0,i=e.length;if(t)r=i;else for(var s=0;s=57344?r+=3:(a=65536+((1023&a)<<10|1023&e.charCodeAt(++s)),r+=4)}return r+=this.encode(8*r),this.update(e),r},B.prototype.bytepad=function(e,t){for(var n=this.encode(t),r=0;r>2]|=this.padding[3&t],this.lastByteIndex===this.byteCount)for(e[0]=e[n],t=1;t>4&15]+d[15&e]+d[e>>12&15]+d[e>>8&15]+d[e>>20&15]+d[e>>16&15]+d[e>>28&15]+d[e>>24&15];o%t==0&&(N(n),s=0)}return i&&(e=n[s],a+=d[e>>4&15]+d[15&e],i>1&&(a+=d[e>>12&15]+d[e>>8&15]),i>2&&(a+=d[e>>20&15]+d[e>>16&15])),a},B.prototype.arrayBuffer=function(){this.finalize();var e,t=this.blockCount,n=this.s,r=this.outputBlocks,i=this.extraBytes,s=0,o=0,a=this.outputBits>>3;e=i?new ArrayBuffer(r+1<<2):new ArrayBuffer(a);for(var u=new Uint32Array(e);o>8&255,u[e+2]=t>>16&255,u[e+3]=t>>24&255;a%n==0&&N(r)}return s&&(e=a<<2,t=r[o],u[e]=255&t,s>1&&(u[e+1]=t>>8&255),s>2&&(u[e+2]=t>>16&255)),u},D.prototype=new B,D.prototype.finalize=function(){return this.encode(this.outputBits,!0),B.prototype.finalize.call(this)};var N=function(e){var t,n,r,i,s,o,a,u,c,l,h,f,d,p,b,y,m,k,v,w,S,_,E,x,O,A,R,j,C,T,P,I,L,M,B,D,N,U,q,z,F,H,W,G,Y,$,J,V,K,Q,Z,X,ee,te,ne,re,ie,se,oe,ae,ue,ce,le;for(r=0;r<48;r+=2)i=e[0]^e[10]^e[20]^e[30]^e[40],s=e[1]^e[11]^e[21]^e[31]^e[41],o=e[2]^e[12]^e[22]^e[32]^e[42],a=e[3]^e[13]^e[23]^e[33]^e[43],u=e[4]^e[14]^e[24]^e[34]^e[44],c=e[5]^e[15]^e[25]^e[35]^e[45],l=e[6]^e[16]^e[26]^e[36]^e[46],h=e[7]^e[17]^e[27]^e[37]^e[47],t=(f=e[8]^e[18]^e[28]^e[38]^e[48])^(o<<1|a>>>31),n=(d=e[9]^e[19]^e[29]^e[39]^e[49])^(a<<1|o>>>31),e[0]^=t,e[1]^=n,e[10]^=t,e[11]^=n,e[20]^=t,e[21]^=n,e[30]^=t,e[31]^=n,e[40]^=t,e[41]^=n,t=i^(u<<1|c>>>31),n=s^(c<<1|u>>>31),e[2]^=t,e[3]^=n,e[12]^=t,e[13]^=n,e[22]^=t,e[23]^=n,e[32]^=t,e[33]^=n,e[42]^=t,e[43]^=n,t=o^(l<<1|h>>>31),n=a^(h<<1|l>>>31),e[4]^=t,e[5]^=n,e[14]^=t,e[15]^=n,e[24]^=t,e[25]^=n,e[34]^=t,e[35]^=n,e[44]^=t,e[45]^=n,t=u^(f<<1|d>>>31),n=c^(d<<1|f>>>31),e[6]^=t,e[7]^=n,e[16]^=t,e[17]^=n,e[26]^=t,e[27]^=n,e[36]^=t,e[37]^=n,e[46]^=t,e[47]^=n,t=l^(i<<1|s>>>31),n=h^(s<<1|i>>>31),e[8]^=t,e[9]^=n,e[18]^=t,e[19]^=n,e[28]^=t,e[29]^=n,e[38]^=t,e[39]^=n,e[48]^=t,e[49]^=n,p=e[0],b=e[1],$=e[11]<<4|e[10]>>>28,J=e[10]<<4|e[11]>>>28,j=e[20]<<3|e[21]>>>29,C=e[21]<<3|e[20]>>>29,ae=e[31]<<9|e[30]>>>23,ue=e[30]<<9|e[31]>>>23,H=e[40]<<18|e[41]>>>14,W=e[41]<<18|e[40]>>>14,M=e[2]<<1|e[3]>>>31,B=e[3]<<1|e[2]>>>31,y=e[13]<<12|e[12]>>>20,m=e[12]<<12|e[13]>>>20,V=e[22]<<10|e[23]>>>22,K=e[23]<<10|e[22]>>>22,T=e[33]<<13|e[32]>>>19,P=e[32]<<13|e[33]>>>19,ce=e[42]<<2|e[43]>>>30,le=e[43]<<2|e[42]>>>30,te=e[5]<<30|e[4]>>>2,ne=e[4]<<30|e[5]>>>2,D=e[14]<<6|e[15]>>>26,N=e[15]<<6|e[14]>>>26,k=e[25]<<11|e[24]>>>21,v=e[24]<<11|e[25]>>>21,Q=e[34]<<15|e[35]>>>17,Z=e[35]<<15|e[34]>>>17,I=e[45]<<29|e[44]>>>3,L=e[44]<<29|e[45]>>>3,x=e[6]<<28|e[7]>>>4,O=e[7]<<28|e[6]>>>4,re=e[17]<<23|e[16]>>>9,ie=e[16]<<23|e[17]>>>9,U=e[26]<<25|e[27]>>>7,q=e[27]<<25|e[26]>>>7,w=e[36]<<21|e[37]>>>11,S=e[37]<<21|e[36]>>>11,X=e[47]<<24|e[46]>>>8,ee=e[46]<<24|e[47]>>>8,G=e[8]<<27|e[9]>>>5,Y=e[9]<<27|e[8]>>>5,A=e[18]<<20|e[19]>>>12,R=e[19]<<20|e[18]>>>12,se=e[29]<<7|e[28]>>>25,oe=e[28]<<7|e[29]>>>25,z=e[38]<<8|e[39]>>>24,F=e[39]<<8|e[38]>>>24,_=e[48]<<14|e[49]>>>18,E=e[49]<<14|e[48]>>>18,e[0]=p^~y&k,e[1]=b^~m&v,e[10]=x^~A&j,e[11]=O^~R&C,e[20]=M^~D&U,e[21]=B^~N&q,e[30]=G^~$&V,e[31]=Y^~J&K,e[40]=te^~re&se,e[41]=ne^~ie&oe,e[2]=y^~k&w,e[3]=m^~v&S,e[12]=A^~j&T,e[13]=R^~C&P,e[22]=D^~U&z,e[23]=N^~q&F,e[32]=$^~V&Q,e[33]=J^~K&Z,e[42]=re^~se&ae,e[43]=ie^~oe&ue,e[4]=k^~w&_,e[5]=v^~S&E,e[14]=j^~T&I,e[15]=C^~P&L,e[24]=U^~z&H,e[25]=q^~F&W,e[34]=V^~Q&X,e[35]=K^~Z&ee,e[44]=se^~ae&ce,e[45]=oe^~ue&le,e[6]=w^~_&p,e[7]=S^~E&b,e[16]=T^~I&x,e[17]=P^~L&O,e[26]=z^~H&M,e[27]=F^~W&B,e[36]=Q^~X&G,e[37]=Z^~ee&Y,e[46]=ae^~ce&te,e[47]=ue^~le&ne,e[8]=_^~p&y,e[9]=E^~b&m,e[18]=I^~x&A,e[19]=L^~O&R,e[28]=H^~M&D,e[29]=W^~B&N,e[38]=X^~G&$,e[39]=ee^~Y&J,e[48]=ce^~te&re,e[49]=le^~ne&ie,e[0]^=g[r],e[1]^=g[r+1]};if(l)e.exports=R;else{for(C=0;C255)return!1;return!0}function o(e,t){return(65535&e)*t+(((e>>>16)*t&65535)<<16)}function a(e,t){return e<>>32-t}function u(e){return e=o(e^=e>>>16,2246822507),e=o(e^=e>>>13,3266489909),e^=e>>>16}function c(e,t){e=[e[0]>>>16,65535&e[0],e[1]>>>16,65535&e[1]],t=[t[0]>>>16,65535&t[0],t[1]>>>16,65535&t[1]];var n=[0,0,0,0];return n[3]+=e[3]+t[3],n[2]+=n[3]>>>16,n[3]&=65535,n[2]+=e[2]+t[2],n[1]+=n[2]>>>16,n[2]&=65535,n[1]+=e[1]+t[1],n[0]+=n[1]>>>16,n[1]&=65535,n[0]+=e[0]+t[0],n[0]&=65535,[n[0]<<16|n[1],n[2]<<16|n[3]]}function l(e,t){e=[e[0]>>>16,65535&e[0],e[1]>>>16,65535&e[1]],t=[t[0]>>>16,65535&t[0],t[1]>>>16,65535&t[1]];var n=[0,0,0,0];return n[3]+=e[3]*t[3],n[2]+=n[3]>>>16,n[3]&=65535,n[2]+=e[2]*t[3],n[1]+=n[2]>>>16,n[2]&=65535,n[2]+=e[3]*t[2],n[1]+=n[2]>>>16,n[2]&=65535,n[1]+=e[1]*t[3],n[0]+=n[1]>>>16,n[1]&=65535,n[1]+=e[2]*t[2],n[0]+=n[1]>>>16,n[1]&=65535,n[1]+=e[3]*t[1],n[0]+=n[1]>>>16,n[1]&=65535,n[0]+=e[0]*t[3]+e[1]*t[2]+e[2]*t[1]+e[3]*t[0],n[0]&=65535,[n[0]<<16|n[1],n[2]<<16|n[3]]}function h(e,t){return 32===(t%=64)?[e[1],e[0]]:t<32?[e[0]<>>32-t,e[1]<>>32-t]:(t-=32,[e[1]<>>32-t,e[0]<>>32-t])}function f(e,t){return 0===(t%=64)?e:t<32?[e[0]<>>32-t,e[1]<>>1]),e=d(e=l(e,[4283543511,3981806797]),[0,e[0]>>>1]),e=d(e=l(e,[3301882366,444984403]),[0,e[0]>>>1])}i.x86.hash32=function(e,t){if(!i.inputValidation||s(e)){t=t||0;for(var n=e.length%4,r=e.length-n,c=t,l=0,h=3432918353,f=461845907,d=0;d>>0}},i.x86.hash128=function(e,t){if(!i.inputValidation||s(e)){t=t||0;for(var n=e.length%16,r=e.length-n,c=t,l=t,h=t,f=t,d=0,p=0,b=0,g=0,y=597399067,m=2869860233,k=951274213,v=2716044179,w=0;w>>0).toString(16)).slice(-8)+("00000000"+(l>>>0).toString(16)).slice(-8)+("00000000"+(h>>>0).toString(16)).slice(-8)+("00000000"+(f>>>0).toString(16)).slice(-8)}},i.x64.hash128=function(e,t){if(!i.inputValidation||s(e)){t=t||0;for(var n=e.length%16,r=e.length-n,o=[0,t],a=[0,t],u=[0,0],b=[0,0],g=[2277735313,289559509],y=[1291169091,658871167],m=0;m>>0).toString(16)).slice(-8)+("00000000"+(o[1]>>>0).toString(16)).slice(-8)+("00000000"+(a[0]>>>0).toString(16)).slice(-8)+("00000000"+(a[1]>>>0).toString(16)).slice(-8)}},e.exports&&(t=e.exports=i),t.murmurHash3=i}()},function(e,t,n){"use strict";const{Buffer:r}=n(0),i=n(10),s=self.crypto||self.msCrypto,o=async(e,t)=>{if("undefined"==typeof self||!self.crypto&&!self.msCrypto)throw new Error("Please use a browser with webcrypto support and ensure the code has been delivered securely via HTTPS/TLS and run within a Secure Context");switch(t){case"sha1":return r.from(await s.subtle.digest({name:"SHA-1"},e));case"sha2-256":return r.from(await s.subtle.digest({name:"SHA-256"},e));case"sha2-512":return r.from(await s.subtle.digest({name:"SHA-512"},e));case"dbl-sha2-256":{const t=await s.subtle.digest({name:"SHA-256"},e);return r.from(await s.subtle.digest({name:"SHA-256"},t))}default:throw new Error(t+" is not a supported algorithm")}};e.exports={factory:e=>async t=>o(t,e),digest:o,multihashing:async(e,t,n)=>{const r=await o(e,t);return i.encode(r,t,n)}}},function(e,t,n){"use strict";const{Buffer:r}=n(0);e.exports={fromNumberTo32BitBuf:e=>{const t=new Array(4);for(let n=0;n<4;n++)t[n]=255&e,e>>=8;return r.from(t)}}},function(e,t,n){"use strict";const{Buffer:r}=n(0),i=n(142),s={init:i.blake2bInit,update:i.blake2bUpdate,digest:i.blake2bFinal},o={init:i.blake2sInit,update:i.blake2sUpdate,digest:i.blake2sFinal},a=(e,t)=>async n=>{const i=t.init(e,null);return t.update(i,n),r.from(t.digest(i))};e.exports=e=>{for(let t=0;t<64;t++)e[45569+t]=a(t+1,s);for(let t=0;t<32;t++)e[45633+t]=a(t+1,o)}},function(e,t,n){var r=n(143),i=n(144);e.exports={blake2b:r.blake2b,blake2bHex:r.blake2bHex,blake2bInit:r.blake2bInit,blake2bUpdate:r.blake2bUpdate,blake2bFinal:r.blake2bFinal,blake2s:i.blake2s,blake2sHex:i.blake2sHex,blake2sInit:i.blake2sInit,blake2sUpdate:i.blake2sUpdate,blake2sFinal:i.blake2sFinal}},function(e,t,n){var r=n(53);function i(e,t,n){var r=e[t]+e[n],i=e[t+1]+e[n+1];r>=4294967296&&i++,e[t]=r,e[t+1]=i}function s(e,t,n,r){var i=e[t]+n;n<0&&(i+=4294967296);var s=e[t+1]+r;i>=4294967296&&s++,e[t]=i,e[t+1]=s}function o(e,t){return e[t]^e[t+1]<<8^e[t+2]<<16^e[t+3]<<24}function a(e,t,n,r,o,a){var u=h[o],c=h[o+1],f=h[a],d=h[a+1];i(l,e,t),s(l,e,u,c);var p=l[r]^l[e],b=l[r+1]^l[e+1];l[r]=b,l[r+1]=p,i(l,n,r),p=l[t]^l[n],b=l[t+1]^l[n+1],l[t]=p>>>24^b<<8,l[t+1]=b>>>24^p<<8,i(l,e,t),s(l,e,f,d),p=l[r]^l[e],b=l[r+1]^l[e+1],l[r]=p>>>16^b<<16,l[r+1]=b>>>16^p<<16,i(l,n,r),p=l[t]^l[n],b=l[t+1]^l[n+1],l[t]=b>>>31^p<<1,l[t+1]=p>>>31^b<<1}var u=new Uint32Array([4089235720,1779033703,2227873595,3144134277,4271175723,1013904242,1595750129,2773480762,2917565137,1359893119,725511199,2600822924,4215389547,528734635,327033209,1541459225]),c=new Uint8Array([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,14,10,4,8,9,15,13,6,1,12,0,2,11,7,5,3,11,8,12,0,5,2,15,13,10,14,3,6,7,1,9,4,7,9,3,1,13,12,11,14,2,6,5,10,4,0,15,8,9,0,5,7,2,4,10,15,14,1,11,12,6,8,3,13,2,12,6,10,0,11,8,3,4,13,7,5,15,14,1,9,12,5,1,15,14,13,4,10,0,7,6,3,9,2,8,11,13,11,7,14,12,1,3,9,5,0,15,4,8,6,2,10,6,15,14,9,11,3,0,8,12,2,13,7,1,4,10,5,10,2,8,4,7,6,1,5,15,11,9,14,3,12,13,0,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,14,10,4,8,9,15,13,6,1,12,0,2,11,7,5,3].map((function(e){return 2*e}))),l=new Uint32Array(32),h=new Uint32Array(32);function f(e,t){var n=0;for(n=0;n<16;n++)l[n]=e.h[n],l[n+16]=u[n];for(l[24]=l[24]^e.t,l[25]=l[25]^e.t/4294967296,t&&(l[28]=~l[28],l[29]=~l[29]),n=0;n<32;n++)h[n]=o(e.b,4*n);for(n=0;n<12;n++)a(0,8,16,24,c[16*n+0],c[16*n+1]),a(2,10,18,26,c[16*n+2],c[16*n+3]),a(4,12,20,28,c[16*n+4],c[16*n+5]),a(6,14,22,30,c[16*n+6],c[16*n+7]),a(0,10,20,30,c[16*n+8],c[16*n+9]),a(2,12,22,24,c[16*n+10],c[16*n+11]),a(4,14,16,26,c[16*n+12],c[16*n+13]),a(6,8,18,28,c[16*n+14],c[16*n+15]);for(n=0;n<16;n++)e.h[n]=e.h[n]^l[n]^l[n+16]}function d(e,t){if(0===e||e>64)throw new Error("Illegal output length, expected 0 < length <= 64");if(t&&t.length>64)throw new Error("Illegal key, expected Uint8Array with 0 < length <= 64");for(var n={b:new Uint8Array(128),h:new Uint32Array(16),t:0,c:0,outlen:e},r=0;r<16;r++)n.h[r]=u[r];var i=t?t.length:0;return n.h[0]^=16842752^i<<8^e,t&&(p(n,t),n.c=128),n}function p(e,t){for(var n=0;n>2]>>8*(3&n);return t}function g(e,t,n){n=n||64,e=r.normalizeInput(e);var i=d(n,t);return p(i,e),b(i)}e.exports={blake2b:g,blake2bHex:function(e,t,n){var i=g(e,t,n);return r.toHex(i)},blake2bInit:d,blake2bUpdate:p,blake2bFinal:b}},function(e,t,n){var r=n(53);function i(e,t){return e[t]^e[t+1]<<8^e[t+2]<<16^e[t+3]<<24}function s(e,t,n,r,i,s){c[e]=c[e]+c[t]+i,c[r]=o(c[r]^c[e],16),c[n]=c[n]+c[r],c[t]=o(c[t]^c[n],12),c[e]=c[e]+c[t]+s,c[r]=o(c[r]^c[e],8),c[n]=c[n]+c[r],c[t]=o(c[t]^c[n],7)}function o(e,t){return e>>>t^e<<32-t}var a=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),u=new Uint8Array([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,14,10,4,8,9,15,13,6,1,12,0,2,11,7,5,3,11,8,12,0,5,2,15,13,10,14,3,6,7,1,9,4,7,9,3,1,13,12,11,14,2,6,5,10,4,0,15,8,9,0,5,7,2,4,10,15,14,1,11,12,6,8,3,13,2,12,6,10,0,11,8,3,4,13,7,5,15,14,1,9,12,5,1,15,14,13,4,10,0,7,6,3,9,2,8,11,13,11,7,14,12,1,3,9,5,0,15,4,8,6,2,10,6,15,14,9,11,3,0,8,12,2,13,7,1,4,10,5,10,2,8,4,7,6,1,5,15,11,9,14,3,12,13,0]),c=new Uint32Array(16),l=new Uint32Array(16);function h(e,t){var n=0;for(n=0;n<8;n++)c[n]=e.h[n],c[n+8]=a[n];for(c[12]^=e.t,c[13]^=e.t/4294967296,t&&(c[14]=~c[14]),n=0;n<16;n++)l[n]=i(e.b,4*n);for(n=0;n<10;n++)s(0,4,8,12,l[u[16*n+0]],l[u[16*n+1]]),s(1,5,9,13,l[u[16*n+2]],l[u[16*n+3]]),s(2,6,10,14,l[u[16*n+4]],l[u[16*n+5]]),s(3,7,11,15,l[u[16*n+6]],l[u[16*n+7]]),s(0,5,10,15,l[u[16*n+8]],l[u[16*n+9]]),s(1,6,11,12,l[u[16*n+10]],l[u[16*n+11]]),s(2,7,8,13,l[u[16*n+12]],l[u[16*n+13]]),s(3,4,9,14,l[u[16*n+14]],l[u[16*n+15]]);for(n=0;n<8;n++)e.h[n]^=c[n]^c[n+8]}function f(e,t){if(!(e>0&&e<=32))throw new Error("Incorrect output length, should be in [1, 32]");var n=t?t.length:0;if(t&&!(n>0&&n<=32))throw new Error("Incorrect key length, should be in [1, 32]");var r={h:new Uint32Array(a),b:new Uint32Array(64),c:0,t:0,outlen:e};return r.h[0]^=16842752^n<<8^e,n>0&&(d(r,t),r.c=64),r}function d(e,t){for(var n=0;n>2]>>8*(3&n)&255;return t}function b(e,t,n){n=n||32,e=r.normalizeInput(e);var i=f(n,t);return d(i,e),p(i)}e.exports={blake2s:b,blake2sHex:function(e,t,n){var i=b(e,t,n);return r.toHex(i)},blake2sInit:f,blake2sUpdate:d,blake2sFinal:p}},function(e,t,n){"use strict";const r=n(48),i=n(54);e.exports=(e,t)=>{const n=(e=>{if(i.isDAGLink(e))return e;if(!("cid"in e||"hash"in e||"Hash"in e||"multihash"in e))throw new Error("Link must be a DAGLink or DAGLink-like. Convert the DAGNode into a DAGLink via `node.toDAGLink()`.");return new i(e.Name||e.name,e.Tsize||e.size,e.Hash||e.multihash||e.hash||e.cid)})(t);e._links.push(n),e._links=r(e._links)}},function(e,t,n){"use strict";const r=n(12);e.exports.createDagLinkFromB58EncodedHash=function(e){return new r(e.Name||e.name||"",e.Tsize||e.Size||e.size||0,e.Hash||e.hash||e.multihash||e.cid)}},function(e,t,n){"use strict";const r=n(17),{Buffer:i}=n(0);e.exports=(e,t)=>{if("string"==typeof t)e._links=e._links.filter(e=>e.Name!==t);else{if(!i.isBuffer(t)&&!r.isCID(t))throw new Error("second arg needs to be a name or CID");e._links=e._links.filter(e=>!e.Hash.equals(t))}}},function(e,t,n){"use strict";const r=n(17),i=n(55);t.resolve=(e,t)=>{let n=i.deserialize(e);const s=t.split("/").filter(Boolean);for(;s.length;){const e=s.shift();if(void 0===n[e]){for(const t of n.Links)if(t.Name===e)return{value:t.Hash,remainderPath:s.join("/")};throw new Error(`Object has no property '${e}'`)}if(n=n[e],r.isCID(n))return{value:n,remainderPath:s.join("/")}}return{value:n,remainderPath:""}},t.tree=function*(e){const t=i.deserialize(e);yield"Data",yield"Links";for(let e=0;et,stringify:JSON.stringify}},function(e,t,n){"use strict";const r=n(20),i=n(152),s=n(56),{LastWriteWins:o,NoZeroes:a}=s,u=n(57),{isDefined:c,findUniques:l,difference:h,io:f}=n(22),d=["heads"],p=(e,t)=>e.slice(e.length-Math.min(e.length,t),e.length);e.exports=class{static async toMultihash(e,t,{format:n}={}){if(!c(e))throw u.IPFSNotDefinedError();if(!c(t))throw u.LogNotDefinedError();if(c(n)||(n="dag-cbor"),t.values.length<1)throw new Error("Can't serialize an empty log");return f.write(e,n,t.toJSON(),{links:d})}static async fromMultihash(e,t,{length:n=-1,exclude:r=[],timeout:s,concurrency:l,sortFn:h,onProgressCallback:b}){if(!c(e))throw u.IPFSNotDefinedError();if(!c(t))throw new Error("Invalid hash: "+t);const g=await f.read(e,t,{links:d});if(!g.heads||!g.id)throw u.NotALogError();h=h||a(o);const y=await i.fetchAll(e,g.heads,{length:n,exclude:r,timeout:s,concurrency:l,onProgressCallback:b}),m=g.id,k=n>-1?p(y.sort(h),n):y,v=k.filter(e=>g.heads.includes(e.hash));return{logId:m,entries:k,heads:v}}static async fromEntryHash(e,t,{length:n=-1,exclude:r=[],timeout:s,concurrency:l,sortFn:h,onProgressCallback:f}){if(!c(e))throw u.IpfsNotDefinedError();if(!c(t))throw new Error("'hash' must be defined");const d=Array.isArray(t)?t:[t];n=n>-1?Math.max(n,1):n;const b=await i.fetchParallel(e,d,{length:n,exclude:r,timeout:s,concurrency:l,onProgressCallback:f});return h=h||a(o),{entries:n>-1?p(b.sort(h),n):b}}static async fromJSON(e,t,{length:n=-1,timeout:s,concurrency:o,onProgressCallback:a}){if(!c(e))throw u.IPFSNotDefinedError();const{id:l,heads:h}=t,f=h.map(e=>e.hash);return{logId:l,entries:(await i.fetchParallel(e,f,{length:n,timeout:s,concurrency:o,onProgressCallback:a})).sort(r.compare),heads:h}}static async fromEntry(e,t,{length:n=-1,exclude:s=[],timeout:o,concurrency:a,onProgressCallback:f}){if(!c(e))throw u.IPFSNotDefinedError();if(!c(t))throw new Error("'sourceEntries' must be defined");if(!Array.isArray(t)&&!r.isEntry(t))throw new Error("'sourceEntries' argument must be an array of Entry instances or a single Entry");Array.isArray(t)||(t=[t]),n=n>-1?Math.max(n,t.length):n;const d=t.map(e=>e.hash),p=await i.fetchParallel(e,d,{length:n,exclude:s,timeout:o,concurrency:a,onProgressCallback:f}),b=t.concat(p).concat(s),g=l(b,"hash").sort(r.compare),y=g.slice(n>-1?-n:-g.length),m=((e,t)=>{var n=e.slice(t.length,e.length);return t.concat(n)})(y,h(y,t,"hash"));return{logId:m[m.length-1].id,entries:m}}}},function(e,t,n){"use strict";const r=n(42),i=n(153),s=n(20),o=e=>e&&e.length>0;class a{static async fetchParallel(e,t,{length:n,exclude:i=[],timeout:s,concurrency:o,onProgressCallback:u}){const c=(e,t)=>e.concat(t),l=await r(t,async t=>a.fetchAll(e,t,{length:n,exclude:i,timeout:s,onProgressCallback:u,concurrency:o}),{concurrency:Math.max(o||t.length,1)});return l.reduce(c,[])}static async fetchAll(e,t,{length:n=-1,exclude:a=[],timeout:u,onProgressCallback:c,onStartProgressCallback:l,concurrency:h=32,delay:f=0}={}){let d=[],p={},b={},g=Array.isArray(t)?{0:t.slice()}:{0:[t]},y=0,m=0,k=0;const v=(e,t)=>{b[e]||(g[t]||(g[t]=[]),g[t].includes(e)||g[t].push(e),b[e]=!0)},w=async t=>{if(t&&!p[t])return new Promise(async(r,i)=>{const o=u&&u>0?setTimeout(()=>{console.warn(`Warning: Couldn't fetch entry '${t}', request timed out (${u}ms)`),r()},u):null;l&&l(t,null,0,d.length);try{if((e=>{if(s.isEntry(e)){const r=e.clock.time;m=Math.max(m,r),k=d.length>0?Math.min(d[d.length-1].clock.time,k):m;const i=d.length>=n&&r>=k,s=e=>m-r+(e+1)*e;(n<0||d.lengthk||r===k&&!p[e.hash])&&e.next.forEach(e=>v(e,s(0))),e.refs&&d.length+e.refs.length<=n&&e.refs.forEach((e,t)=>v(e,s(t))))}})(await s.fromMultihash(e,t)),f>0){const e=(e=0)=>new Promise(t=>setTimeout(t,e));await e(f)}r()}catch(e){i(e)}finally{clearTimeout(o)}})};return a.forEach(e=>{p[e.hash]=!0}),await i(async()=>{if(yObject.keys(g).reduce((t,n,r)=>{const i=g[n];for(;i.length>0&&t.lengthvoid 0!==Object.values(g).find(o)),d}}e.exports=a},function(e,t,n){"use strict";const r=async(e,t)=>{if(t(await e()))return r(e,t)};e.exports=r,e.exports.default=r},function(e,t,n){"use strict";e.exports=class{async canAppend(e,t){return!0}}},function(e,t,n){"use strict";e.exports=class{constructor(e={}){this._cache=e}set(e,t){this._cache[e]=t}get(e){return this._cache[e]}delete(e){return delete this._cache[e]}add(e){this._cache=Object.assign(this._cache,e)}get length(){return Object.values(this._cache).length}}},function(e,t,n){"use strict";e.exports=class{constructor(e){this.id=e,this._index=[]}get(){return this._index}async updateIndex(e,t){this._index=e.values}}},function(e,t,n){const r=n(5).EventEmitter,i=n(158),s=n(41),o=n(58),a=o.create("replicator",{color:o.Colors.Cyan});o.setLogLevel("ERROR");const u=e=>e.next,c=(e,t)=>e.concat(t),l=e=>null!=e,h=(e,t)=>(e[t]=t,e);e.exports=class extends r{constructor(e,t){super(),this._store=e,this._fetching={},this._stats={tasksRequested:0,tasksStarted:0,tasksProcessed: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.warn("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 Math.max(Object.keys(this._queue).length-this.tasksRunning,0)}get tasksFinished(){return this._stats.tasksProcessed}getQueue(){return Object.values(this._queue)}load(e){const t=e=>{const t=e.hash||e;return!this._store._oplog.has(t)&&!this._fetching[t]&&!this._queue[t]};try{e.filter(l).filter(t).forEach(this._addToQueue.bind(this)),setTimeout(()=>this._processQueue(),0)}catch(e){console.error(e)}}stop(){clearInterval(this._flushTimer),this.removeAllListeners("load.added"),this.removeAllListeners("load.end"),this.removeAllListeners("load.progress")}_addToQueue(e){const t=e.hash||e;this._stats.tasksRequested+=1,this._queue[t]=e}async _processQueue(){if(this.tasksRunningdelete this._queue[e.hash||e]);const n=e=>e.reduce(c,[]).reduce(h,{}),r=e=>{const n=Object.values(e).filter(l);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)}n.length>0&&this.load(n)};return i(t,e=>this._processOne(e)).then(n).then(r)}}async _processOne(e){const t=e.hash||e;if(this._store._oplog.has(t)||this._fetching[t])return;this._fetching[t]=t,this.emit("load.added",e),this._stats.tasksStarted+=1;const n=await s.fromEntryHash(this._store._ipfs,this._store.identity,t,{logId:this._store._oplog.id,access:this._store.access,length:1,exclude:[]});this._buffer.push(n);const r=n.values[0];return delete this._queue[t],this._stats.tasksProcessed+=1,this.emit("load.progress",this._id,t,r,null,this._buffer.length),n.values.map(u).reduce(c,[])}}},function(e,t,n){"use strict";const r=n(159);e.exports=async(e,t,{concurrency:n=1/0,stopOnError:i=!0}={})=>new Promise((s,o)=>{if("function"!=typeof t)throw new TypeError("Mapper function is required");if(!("number"==typeof n&&n>=1))throw new TypeError(`Expected \`concurrency\` to be a number from 1 and up, got \`${n}\` (${typeof n})`);const a=[],u=[],c=e[Symbol.iterator]();let l=!1,h=!1,f=0,d=0;const p=()=>{if(l)return;const e=c.next(),n=d;if(d++,e.done)return h=!0,void(0===f&&(i||0===u.length?s(a):o(new r(u))));f++,(async()=>{try{const r=await e.value;a[n]=await t(r,n),f--,p()}catch(e){i?(l=!0,o(e)):(u.push(e),f--,p())}})()};for(let e=0;ee instanceof Error?e:null!==e&&"object"==typeof e?Object.assign(new Error(e.message),e):new Error(e))).map(e=>"string"==typeof e.stack?i(e.stack).replace(/\s+at .*aggregate-error\/index.js:\d+:\d+\)?/g,""):String(e)).join("\n");t="\n"+r(t,4),super(t),this.name="AggregateError",Object.defineProperty(this,"_errors",{value:e})}*[Symbol.iterator](){for(const e of this._errors)yield e}}e.exports=s},function(e,t,n){"use strict";e.exports=(e,t=1,n)=>{if(n={indent:" ",includeEmptyLines:!1,...n},"string"!=typeof e)throw new TypeError(`Expected \`input\` to be a \`string\`, got \`${typeof e}\``);if("number"!=typeof t)throw new TypeError(`Expected \`count\` to be a \`number\`, got \`${typeof t}\``);if("string"!=typeof n.indent)throw new TypeError(`Expected \`options.indent\` to be a \`string\`, got \`${typeof n.indent}\``);if(0===t)return e;const r=n.includeEmptyLines?/^/gm:/^(?!\s*$)/gm;return e.replace(r,n.indent.repeat(t))}},function(e,t,n){"use strict";const r=n(162),i=/\s+at.*(?:\(|\s)(.*)\)?/,s=/^(?:(?:(?:node|(?:internal\/[\w/]*|.*node_modules\/(?:babel-polyfill|pirates)\/.*)?\w+)\.js:\d+:\d+)|native)/,o=void 0===r.homedir?"":r.homedir();e.exports=(e,t)=>(t=Object.assign({pretty:!1},t),e.replace(/\\/g,"/").split("\n").filter(e=>{const t=e.match(i);if(null===t||!t[1])return!0;const n=t[1];return!n.includes(".app/Contents/Resources/electron.asar")&&!n.includes(".app/Contents/Resources/default_app.asar")&&!s.test(n)}).filter(e=>""!==e.trim()).map(e=>t.pretty?e.replace(i,(e,t)=>e.replace(t,t.replace(o,"~"))):e).join("\n"))},function(e,t){},function(e,t){},function(e,t,n){(function(e){var r=Object.getOwnPropertyDescriptors||function(e){for(var t=Object.keys(e),n={},r=0;r=s)return e;switch(e){case"%s":return String(r[n++]);case"%d":return Number(r[n++]);case"%j":try{return JSON.stringify(r[n++])}catch(e){return"[Circular]"}default:return e}})),u=r[n];n=3&&(r.depth=arguments[2]),arguments.length>=4&&(r.colors=arguments[3]),p(n)?r.showHidden=n:n&&t._extend(r,n),m(r.showHidden)&&(r.showHidden=!1),m(r.depth)&&(r.depth=2),m(r.colors)&&(r.colors=!1),m(r.customInspect)&&(r.customInspect=!0),r.colors&&(r.stylize=u),l(r,e,r.depth)}function u(e,t){var n=a.styles[t];return n?"["+a.colors[n][0]+"m"+e+"["+a.colors[n][1]+"m":e}function c(e,t){return e}function l(e,n,r){if(e.customInspect&&n&&_(n.inspect)&&n.inspect!==t.inspect&&(!n.constructor||n.constructor.prototype!==n)){var i=n.inspect(r,e);return y(i)||(i=l(e,i,r)),i}var s=function(e,t){if(m(t))return e.stylize("undefined","undefined");if(y(t)){var n="'"+JSON.stringify(t).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return e.stylize(n,"string")}if(g(t))return e.stylize(""+t,"number");if(p(t))return e.stylize(""+t,"boolean");if(b(t))return e.stylize("null","null")}(e,n);if(s)return s;var o=Object.keys(n),a=function(e){var t={};return e.forEach((function(e,n){t[e]=!0})),t}(o);if(e.showHidden&&(o=Object.getOwnPropertyNames(n)),S(n)&&(o.indexOf("message")>=0||o.indexOf("description")>=0))return h(n);if(0===o.length){if(_(n)){var u=n.name?": "+n.name:"";return e.stylize("[Function"+u+"]","special")}if(k(n))return e.stylize(RegExp.prototype.toString.call(n),"regexp");if(w(n))return e.stylize(Date.prototype.toString.call(n),"date");if(S(n))return h(n)}var c,v="",E=!1,x=["{","}"];(d(n)&&(E=!0,x=["[","]"]),_(n))&&(v=" [Function"+(n.name?": "+n.name:"")+"]");return k(n)&&(v=" "+RegExp.prototype.toString.call(n)),w(n)&&(v=" "+Date.prototype.toUTCString.call(n)),S(n)&&(v=" "+h(n)),0!==o.length||E&&0!=n.length?r<0?k(n)?e.stylize(RegExp.prototype.toString.call(n),"regexp"):e.stylize("[Object]","special"):(e.seen.push(n),c=E?function(e,t,n,r,i){for(var s=[],o=0,a=t.length;o=0&&0,e+t.replace(/\u001b\[\d\d?m/g,"").length+1}),0)>60)return n[0]+(""===t?"":t+"\n ")+" "+e.join(",\n ")+" "+n[1];return n[0]+t+" "+e.join(", ")+" "+n[1]}(c,v,x)):x[0]+v+x[1]}function h(e){return"["+Error.prototype.toString.call(e)+"]"}function f(e,t,n,r,i,s){var o,a,u;if((u=Object.getOwnPropertyDescriptor(t,i)||{value:t[i]}).get?a=u.set?e.stylize("[Getter/Setter]","special"):e.stylize("[Getter]","special"):u.set&&(a=e.stylize("[Setter]","special")),R(r,i)||(o="["+i+"]"),a||(e.seen.indexOf(u.value)<0?(a=b(n)?l(e,u.value,null):l(e,u.value,n-1)).indexOf("\n")>-1&&(a=s?a.split("\n").map((function(e){return" "+e})).join("\n").substr(2):"\n"+a.split("\n").map((function(e){return" "+e})).join("\n")):a=e.stylize("[Circular]","special")),m(o)){if(s&&i.match(/^\d+$/))return a;(o=JSON.stringify(""+i)).match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(o=o.substr(1,o.length-2),o=e.stylize(o,"name")):(o=o.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),o=e.stylize(o,"string"))}return o+": "+a}function d(e){return Array.isArray(e)}function p(e){return"boolean"==typeof e}function b(e){return null===e}function g(e){return"number"==typeof e}function y(e){return"string"==typeof e}function m(e){return void 0===e}function k(e){return v(e)&&"[object RegExp]"===E(e)}function v(e){return"object"==typeof e&&null!==e}function w(e){return v(e)&&"[object Date]"===E(e)}function S(e){return v(e)&&("[object Error]"===E(e)||e instanceof Error)}function _(e){return"function"==typeof e}function E(e){return Object.prototype.toString.call(e)}function x(e){return e<10?"0"+e.toString(10):e.toString(10)}t.debuglog=function(n){if(m(s)&&(s=e.env.NODE_DEBUG||""),n=n.toUpperCase(),!o[n])if(new RegExp("\\b"+n+"\\b","i").test(s)){var r=e.pid;o[n]=function(){var e=t.format.apply(t,arguments);console.error("%s %d: %s",n,r,e)}}else o[n]=function(){};return o[n]},t.inspect=a,a.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},a.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"},t.isArray=d,t.isBoolean=p,t.isNull=b,t.isNullOrUndefined=function(e){return null==e},t.isNumber=g,t.isString=y,t.isSymbol=function(e){return"symbol"==typeof e},t.isUndefined=m,t.isRegExp=k,t.isObject=v,t.isDate=w,t.isError=S,t.isFunction=_,t.isPrimitive=function(e){return null===e||"boolean"==typeof e||"number"==typeof e||"string"==typeof e||"symbol"==typeof e||void 0===e},t.isBuffer=n(165);var O=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function A(){var e=new Date,t=[x(e.getHours()),x(e.getMinutes()),x(e.getSeconds())].join(":");return[e.getDate(),O[e.getMonth()],t].join(" ")}function R(e,t){return Object.prototype.hasOwnProperty.call(e,t)}t.log=function(){console.log("%s - %s",A(),t.format.apply(t,arguments))},t.inherits=n(166),t._extend=function(e,t){if(!t||!v(t))return e;for(var n=Object.keys(t),r=n.length;r--;)e[n[r]]=t[n[r]];return e};var j="undefined"!=typeof Symbol?Symbol("util.promisify.custom"):void 0;function C(e,t){if(!e){var n=new Error("Promise was rejected with a falsy value");n.reason=e,e=n}return t(e)}t.promisify=function(e){if("function"!=typeof e)throw new TypeError('The "original" argument must be of type Function');if(j&&e[j]){var t;if("function"!=typeof(t=e[j]))throw new TypeError('The "util.promisify.custom" argument must be of type Function');return Object.defineProperty(t,j,{value:t,enumerable:!1,writable:!1,configurable:!0}),t}function t(){for(var t,n,r=new Promise((function(e,r){t=e,n=r})),i=[],s=0;s { - this._procEntry(entry); - }); - this.events.on("write", (address, entry, heads) => { - this._procEntry(entry); - }); + this.events.on('replicated.progress', (address, hash, entry, progress, have) => { + this._procEntry(entry) + }) + this.events.on('write', (address, entry, heads) => { + this._procEntry(entry) + }) } get all () { @@ -194,8 +194,8 @@ class Store { } // Remove all event listeners - for(var event in this.events._events) { - this.events.removeAllListeners(event); + for (var event in this.events._events) { + this.events.removeAllListeners(event) } // Database is now closed @@ -529,14 +529,14 @@ class Store { _addOperationBatch (data, batchOperation, lastOperation, onProgressCallback) { throw new Error('Not implemented!') } - - _procEntry(entry) { - var { payload, hash } = entry; - var { op } = payload; - if(op) { - this.events.emit(`log.op.${op}`, this.address.toString(), hash, payload); + + _procEntry (entry) { + var { payload, hash } = entry + var { op } = payload + if (op) { + this.events.emit(`log.op.${op}`, this.address.toString(), hash, payload) } else { - this.events.emit(`log.op.none`, this.address.toString(), hash, payload); + this.events.emit('log.op.none', this.address.toString(), hash, payload) } this.events.emit('log.op', op, this.address.toString(), hash, payload) } diff --git a/test/events.spec.js b/test/events.spec.js index 5059bfa..e2d9779 100644 --- a/test/events.spec.js +++ b/test/events.spec.js @@ -10,67 +10,68 @@ const DefaultOptions = Store.DefaultOptions // Test utils const { - config, - testAPIs, - startIpfs, - stopIpfs, - implementations + config, + testAPIs, + startIpfs, + stopIpfs, + implementations } = require('orbit-db-test-utils') const properLevelModule = implementations.filter(i => i.key.indexOf('memdown') > -1).map(i => i.module)[0] const storage = require('orbit-db-storage-adapter')(properLevelModule) Object.keys(testAPIs).forEach((IPFS) => { - describe(`Events ${IPFS}`, function () { - let ipfs, testIdentity, identityStore, store, cacheStore + describe(`Events ${IPFS}`, function () { + let ipfsd, ipfs, testIdentity, identityStore, store, cacheStore - this.timeout(config.timeout) + this.timeout(config.timeout) - const ipfsConfig = Object.assign({}, config.defaultIpfsConfig, { - repo: config.defaultIpfsConfig.repo + '-entry' + new Date().getTime() - }) - after(async () => { - await store.close() - await stopIpfs(ipfs) - await identityStore.close() - await cacheStore.close() - }) + const ipfsConfig = Object.assign({}, config.defaultIpfsConfig, { + repo: config.defaultIpfsConfig.repo + '-entry' + new Date().getTime() + }) + after(async () => { + await store.close() + await stopIpfs(ipfsd) + await identityStore.close() + await cacheStore.close() + }) - afterEach(async () => { - await store.drop() - await cacheStore.open() - await identityStore.open() - }) - before(async () => { - identityStore = await storage.createStore('identity') - const keystore = new Keystore(identityStore) + afterEach(async () => { + await store.drop() + await cacheStore.open() + await identityStore.open() + }) - cacheStore = await storage.createStore('cache') - const cache = new Cache(cacheStore) + before(async () => { + identityStore = await storage.createStore('identity') + const keystore = new Keystore(identityStore) - testIdentity = await IdentityProvider.createIdentity({ id: 'userA', keystore }) - ipfs = await startIpfs(IPFS, ipfsConfig) + cacheStore = await storage.createStore('cache') + const cache = new Cache(cacheStore) - const address = 'test-address' - const options = Object.assign({}, DefaultOptions, { cache }) - store = new Store(ipfs, testIdentity, address, options) - }) - it('Specific log.op event', (done) => { - var data = { - op: "SET", - key: "transaction", - value: "data" - } - store.events.on("log.op.SET", (id, address, payload) => { - var {op, key, value} = payload; - assert.strictEqual(op, data.op); - assert.strictEqual(key, data.key); - assert.strictEqual(value, data.value); - assert.strictEqual(id, 'test-address'); - done(); - }) - store._addOperation(data) - - }) + testIdentity = await IdentityProvider.createIdentity({ id: 'userA', keystore }) + ipfsd = await startIpfs(IPFS, ipfsConfig) + ipfs = ipfsd.api + + const address = 'test-address' + const options = Object.assign({}, DefaultOptions, { cache }) + store = new Store(ipfs, testIdentity, address, options) + }) + it('Specific log.op event', (done) => { + var data = { + op: 'SET', + key: 'transaction', + value: 'data' + } + store.events.on('log.op.SET', (id, address, payload) => { + var { op, key, value } = payload + assert.strictEqual(op, data.op) + assert.strictEqual(key, data.key) + assert.strictEqual(value, data.value) + assert.strictEqual(id, 'test-address') + done() + }) + store._addOperation(data) }) -}) \ No newline at end of file + }) +})