From bf59edca9907eb9ab6b105bebe13d1cbb2640043 Mon Sep 17 00:00:00 2001 From: Mitra Ardron Date: Thu, 15 Aug 2019 18:39:47 +1000 Subject: [PATCH] * v0.1.62 Upgrade dependencies --- README.md | 1 + dist/dweb-transports-bundle.js | 21264 ++++++++++++++++++++++++++++++- package.json | 12 +- yarn.lock | 2450 ++-- 4 files changed, 22025 insertions(+), 1702 deletions(-) diff --git a/README.md b/README.md index 6fa5fdf..5df177e 100644 --- a/README.md +++ b/README.md @@ -126,6 +126,7 @@ See [Dweb document index](./DOCUMENTINDEX.md) for a list of the repos that make ### Release Notes +* 0.1.62: Upgrade dependencies * 0.1.61: loopguard to return correct error from queuedFetch; add info to statuses * 0.1.60: Back on master release of webtorrent * 0.1.59: Add DwebTransports.statuses synchronous API diff --git a/dist/dweb-transports-bundle.js b/dist/dweb-transports-bundle.js index aec4db7..0482bb2 100644 --- a/dist/dweb-transports-bundle.js +++ b/dist/dweb-transports-bundle.js @@ -1,512 +1,20752 @@ -!function(e){var t={};function n(r){if(t[r])return t[r].exports;var i=t[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)n.d(r,i,function(t){return e[t]}.bind(null,i));return r},n.n=function(e){var t=e&&e.__esModule?function t(){return e.default}:function t(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=627)}([function(e,t,n){"use strict";(function(e){ -/*! - * The buffer module from node.js, for the browser. - * - * @author Feross Aboukhadijeh - * @license MIT - */ -var r=n(632),i=n(323),o=n(56);function s(){try{var e=new Uint8Array(1);return e.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===e.foo()&&"function"==typeof e.subarray&&0===e.subarray(1,1).byteLength}catch(e){return!1}}function a(){return u.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function l(e,t){if(a()=a())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+a().toString(16)+" bytes");return 0|e}function b(e){return+e!=e&&(e=0),u.alloc(+e)}function _(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 Z(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return X(e).length;default:if(r)return Z(e).length;t=(""+t).toLowerCase(),r=!0}}function w(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,n<=t)return"";for(e||(e="utf8");;)switch(e){case"hex":return F(this,t,n);case"utf8":case"utf-8":return B(this,t,n);case"ascii":return N(this,t,n);case"latin1":case"binary":return D(this,t,n);case"base64":return R(this,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return M(this,t,n);default:if(r)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),r=!0}}function k(e,t,n){var r=e[t];e[t]=e[n],e[n]=r}function E(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:S(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):S(e,[t],n,r,i);throw new TypeError("val must be string, number or Buffer")}function S(e,t,n,r,i){var o=1,s=e.length,a=t.length,l;if(void 0!==r&&(r=String(r).toLowerCase(),"ucs2"===r||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(e.length<2||t.length<2)return-1;o=2,s/=2,a/=2,n/=2}function u(e,t){return 1===o?e[t]:e.readUInt16BE(t*o)}if(i){var c=-1;for(l=n;ls&&(n=s-a),l=n;l>=0;l--){for(var h=!0,f=0;fi&&(r=i)):r=i;var o=t.length;if(o%2!=0)throw new TypeError("Invalid hex string");r>o/2&&(r=o/2);for(var s=0;s239?4:o>223?3:o>191?2:1,l,u,c,h;if(i+a<=n)switch(a){case 1:o<128&&(s=o);break;case 2:l=e[i+1],128==(192&l)&&(h=(31&o)<<6|63&l,h>127&&(s=h));break;case 3:l=e[i+1],u=e[i+2],128==(192&l)&&128==(192&u)&&(h=(15&o)<<12|(63&l)<<6|63&u,h>2047&&(h<55296||h>57343)&&(s=h));break;case 4:l=e[i+1],u=e[i+2],c=e[i+3],128==(192&l)&&128==(192&u)&&128==(192&c)&&(h=(15&o)<<18|(63&l)<<12|(63&u)<<6|63&c,h>65535&&h<1114112&&(s=h))}null===s?(s=65533,a=1):s>65535&&(s-=65536,r.push(s>>>10&1023|55296),s=56320|1023&s),r.push(s),i+=a}return P(r)}t.Buffer=u,t.SlowBuffer=b,t.INSPECT_MAX_BYTES=50,u.TYPED_ARRAY_SUPPORT=void 0!==e.TYPED_ARRAY_SUPPORT?e.TYPED_ARRAY_SUPPORT:s(),t.kMaxLength=a(),u.poolSize=8192,u._augment=function(e){return e.__proto__=u.prototype,e},u.from=function(e,t,n){return c(null,e,t,n)},u.TYPED_ARRAY_SUPPORT&&(u.prototype.__proto__=Uint8Array.prototype,u.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&u[Symbol.species]===u&&Object.defineProperty(u,Symbol.species,{value:null,configurable:!0})),u.alloc=function(e,t,n){return f(null,e,t,n)},u.allocUnsafe=function(e){return p(null,e)},u.allocUnsafeSlow=function(e){return p(null,e)},u.isBuffer=function e(t){return!(null==t||!t._isBuffer)},u.compare=function e(t,n){if(!u.isBuffer(t)||!u.isBuffer(n))throw new TypeError("Arguments must be Buffers");if(t===n)return 0;for(var r=t.length,i=n.length,o=0,s=Math.min(r,i);o0&&(n=this.toString("hex",0,r).match(/.{2}/g).join(" "),this.length>r&&(n+=" ... ")),""},u.prototype.compare=function e(t,n,r,i,o){if(!u.isBuffer(t))throw new TypeError("Argument must be a Buffer");if(void 0===n&&(n=0),void 0===r&&(r=t?t.length:0),void 0===i&&(i=0),void 0===o&&(o=this.length),n<0||r>t.length||i<0||o>this.length)throw new RangeError("out of range index");if(i>=o&&n>=r)return 0;if(i>=o)return-1;if(n>=r)return 1;if(n>>>=0,r>>>=0,i>>>=0,o>>>=0,this===t)return 0;for(var s=o-i,a=r-n,l=Math.min(s,a),c=this.slice(i,o),h=t.slice(n,r),f=0;fo)&&(r=o),t.length>0&&(r<0||n<0)||n>this.length)throw new RangeError("Attempt to write outside buffer bounds");i||(i="utf8");for(var s=!1;;)switch(i){case"hex":return x(this,t,n,r);case"utf8":case"utf-8":return C(this,t,n,r);case"ascii":return A(this,t,n,r);case"latin1":case"binary":return T(this,t,n,r);case"base64":return I(this,t,n,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return j(this,t,n,r);default:if(s)throw new TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),s=!0}},u.prototype.toJSON=function e(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var O=4096;function P(e){var t=e.length;if(t<=O)return String.fromCharCode.apply(String,e);for(var n="",r=0;rr)&&(n=r);for(var i="",o=t;on)throw new RangeError("Trying to access beyond buffer length")}function U(e,t,n,r,i,o){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 q(e,t,n,r){t<0&&(t=65535+t+1);for(var i=0,o=Math.min(e.length-n,2);i>>8*(r?i:1-i)}function z(e,t,n,r){t<0&&(t=4294967295+t+1);for(var i=0,o=Math.min(e.length-n,4);i>>8*(r?i:3-i)&255}function K(e,t,n,r,i,o){if(n+r>e.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function H(e,t,n,r,o){return o||K(e,t,n,4,3.4028234663852886e38,-3.4028234663852886e38),i.write(e,t,n,r,23,4),n+4}function V(e,t,n,r,o){return o||K(e,t,n,8,1.7976931348623157e308,-1.7976931348623157e308),i.write(e,t,n,r,52,8),n+8}u.prototype.slice=function e(t,n){var r=this.length,i;if(t=~~t,n=void 0===n?r:~~n,t<0?(t+=r,t<0&&(t=0)):t>r&&(t=r),n<0?(n+=r,n<0&&(n=0)):n>r&&(n=r),n0&&(o*=256);)i+=this[t+--n]*o;return i},u.prototype.readUInt8=function e(t,n){return n||L(t,1,this.length),this[t]},u.prototype.readUInt16LE=function e(t,n){return n||L(t,2,this.length),this[t]|this[t+1]<<8},u.prototype.readUInt16BE=function e(t,n){return n||L(t,2,this.length),this[t]<<8|this[t+1]},u.prototype.readUInt32LE=function e(t,n){return n||L(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},u.prototype.readUInt32BE=function e(t,n){return n||L(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},u.prototype.readIntLE=function e(t,n,r){t|=0,n|=0,r||L(t,n,this.length);for(var i=this[t],o=1,s=0;++s=o&&(i-=Math.pow(2,8*n)),i},u.prototype.readIntBE=function e(t,n,r){t|=0,n|=0,r||L(t,n,this.length);for(var i=n,o=1,s=this[t+--i];i>0&&(o*=256);)s+=this[t+--i]*o;return o*=128,s>=o&&(s-=Math.pow(2,8*n)),s},u.prototype.readInt8=function e(t,n){return n||L(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},u.prototype.readInt16LE=function e(t,n){n||L(t,2,this.length);var r=this[t]|this[t+1]<<8;return 32768&r?4294901760|r:r},u.prototype.readInt16BE=function e(t,n){n||L(t,2,this.length);var r=this[t+1]|this[t]<<8;return 32768&r?4294901760|r:r},u.prototype.readInt32LE=function e(t,n){return n||L(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},u.prototype.readInt32BE=function e(t,n){return n||L(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},u.prototype.readFloatLE=function e(t,n){return n||L(t,4,this.length),i.read(this,t,!0,23,4)},u.prototype.readFloatBE=function e(t,n){return n||L(t,4,this.length),i.read(this,t,!1,23,4)},u.prototype.readDoubleLE=function e(t,n){return n||L(t,8,this.length),i.read(this,t,!0,52,8)},u.prototype.readDoubleBE=function e(t,n){return n||L(t,8,this.length),i.read(this,t,!1,52,8)},u.prototype.writeUIntLE=function e(t,n,r,i){if(t=+t,n|=0,r|=0,!i){var o=Math.pow(2,8*r)-1;U(this,t,n,r,o,0)}var s=1,a=0;for(this[n]=255&t;++a=0&&(a*=256);)this[n+s]=t/a&255;return n+r},u.prototype.writeUInt8=function e(t,n,r){return t=+t,n|=0,r||U(this,t,n,1,255,0),u.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),this[n]=255&t,n+1},u.prototype.writeUInt16LE=function e(t,n,r){return t=+t,n|=0,r||U(this,t,n,2,65535,0),u.TYPED_ARRAY_SUPPORT?(this[n]=255&t,this[n+1]=t>>>8):q(this,t,n,!0),n+2},u.prototype.writeUInt16BE=function e(t,n,r){return t=+t,n|=0,r||U(this,t,n,2,65535,0),u.TYPED_ARRAY_SUPPORT?(this[n]=t>>>8,this[n+1]=255&t):q(this,t,n,!1),n+2},u.prototype.writeUInt32LE=function e(t,n,r){return t=+t,n|=0,r||U(this,t,n,4,4294967295,0),u.TYPED_ARRAY_SUPPORT?(this[n+3]=t>>>24,this[n+2]=t>>>16,this[n+1]=t>>>8,this[n]=255&t):z(this,t,n,!0),n+4},u.prototype.writeUInt32BE=function e(t,n,r){return t=+t,n|=0,r||U(this,t,n,4,4294967295,0),u.TYPED_ARRAY_SUPPORT?(this[n]=t>>>24,this[n+1]=t>>>16,this[n+2]=t>>>8,this[n+3]=255&t):z(this,t,n,!1),n+4},u.prototype.writeIntLE=function e(t,n,r,i){if(t=+t,n|=0,!i){var o=Math.pow(2,8*r-1);U(this,t,n,r,o-1,-o)}var s=0,a=1,l=0;for(this[n]=255&t;++s>0)-l&255;return n+r},u.prototype.writeIntBE=function e(t,n,r,i){if(t=+t,n|=0,!i){var o=Math.pow(2,8*r-1);U(this,t,n,r,o-1,-o)}var s=r-1,a=1,l=0;for(this[n+s]=255&t;--s>=0&&(a*=256);)t<0&&0===l&&0!==this[n+s+1]&&(l=1),this[n+s]=(t/a>>0)-l&255;return n+r},u.prototype.writeInt8=function e(t,n,r){return t=+t,n|=0,r||U(this,t,n,1,127,-128),u.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),t<0&&(t=255+t+1),this[n]=255&t,n+1},u.prototype.writeInt16LE=function e(t,n,r){return t=+t,n|=0,r||U(this,t,n,2,32767,-32768),u.TYPED_ARRAY_SUPPORT?(this[n]=255&t,this[n+1]=t>>>8):q(this,t,n,!0),n+2},u.prototype.writeInt16BE=function e(t,n,r){return t=+t,n|=0,r||U(this,t,n,2,32767,-32768),u.TYPED_ARRAY_SUPPORT?(this[n]=t>>>8,this[n+1]=255&t):q(this,t,n,!1),n+2},u.prototype.writeInt32LE=function e(t,n,r){return t=+t,n|=0,r||U(this,t,n,4,2147483647,-2147483648),u.TYPED_ARRAY_SUPPORT?(this[n]=255&t,this[n+1]=t>>>8,this[n+2]=t>>>16,this[n+3]=t>>>24):z(this,t,n,!0),n+4},u.prototype.writeInt32BE=function e(t,n,r){return t=+t,n|=0,r||U(this,t,n,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),u.TYPED_ARRAY_SUPPORT?(this[n]=t>>>24,this[n+1]=t>>>16,this[n+2]=t>>>8,this[n+3]=255&t):z(this,t,n,!1),n+4},u.prototype.writeFloatLE=function e(t,n,r){return H(this,t,n,!0,r)},u.prototype.writeFloatBE=function e(t,n,r){return H(this,t,n,!1,r)},u.prototype.writeDoubleLE=function e(t,n,r){return V(this,t,n,!0,r)},u.prototype.writeDoubleBE=function e(t,n,r){return V(this,t,n,!1,r)},u.prototype.copy=function e(t,n,r,i){if(r||(r=0),i||0===i||(i=this.length),n>=t.length&&(n=t.length),n||(n=0),i>0&&i=this.length)throw new RangeError("sourceStart out of bounds");if(i<0)throw new RangeError("sourceEnd out of bounds");i>this.length&&(i=this.length),t.length-n=0;--s)t[s+n]=this[s+r];else if(o<1e3||!u.TYPED_ARRAY_SUPPORT)for(s=0;s>>=0,r=void 0===r?this.length:r>>>0,t||(t=0),"number"==typeof t)for(s=n;s55295&&n<57344){if(!i){if(n>56319){(t-=3)>-1&&o.push(239,191,189);continue}if(s+1===r){(t-=3)>-1&&o.push(239,191,189);continue}i=n;continue}if(n<56320){(t-=3)>-1&&o.push(239,191,189),i=n;continue}n=65536+(i-55296<<10|n-56320)}else i&&(t-=3)>-1&&o.push(239,191,189);if(i=null,n<128){if((t-=1)<0)break;o.push(n)}else if(n<2048){if((t-=2)<0)break;o.push(n>>6|192,63&n|128)}else if(n<65536){if((t-=3)<0)break;o.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;o.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return o}function J(e){for(var t=[],n=0;n>8,i=n%256,o.push(i),o.push(r);return o}function X(e){return r.toByteArray(W(e))}function ee(e,t,n,r){for(var i=0;i=t.length||i>=e.length);++i)t[i+n]=e[i];return i}function te(e){return e!=e}}).call(this,n(7))},function(e,t,n){ -/** PROMISIFY CALLBACK-STYLE FUNCTIONS TO ES6 PROMISES -* -* EXAMPLE: -* const fn = promisify( (callback) => callback(null, "Hello world!") ); -* fn((err, str) => console.log(str)); -* fn().then((str) => console.log(str)); -* //Both functions, will log 'Hello world!' -* -* Note: The function you pass, may have any arguments you want, but the latest -* have to be the callback, which you will call with: next(err, value) -* -* @param method: Function/Array/Map = The function(s) to promisify -* @param options: Map = -* "context" (default is function): The context which to apply the called function -* "replace" (default is falsy): When passed an array/map, if to replace the original object -* -* @return: A promise if passed a function, otherwise the object with the promises -* -* @license: MIT -* @version: 1.0.3 -* @author: Manuel Di Iorio -**/ -var r=function(e,t){return function(){var n=Array.prototype.slice.call(arguments),r=n.length-1,i=n&&n.length>0?n[r]:null,o="function"==typeof i?i:null;return o?e.apply(t,n):new Promise(function(r,i){n.push(function(e,t){if(e)return i(e);r(t)}),e.apply(t,n)})}};e.exports=function(e,t){t=t||{};var n=Object.prototype.toString.call(e);if("[object Object]"===n||"[object Array]"===n){var i=t.replace?e:{};for(var o in e)e.hasOwnProperty(o)&&(i[o]=r(e[o]));return i}return r(e,t.context||e)}},function(e,t){var n=e.exports={},r,i;function o(){throw new Error("setTimeout has not been defined")}function s(){throw new Error("clearTimeout has not been defined")}function a(e){if(r===setTimeout)return setTimeout(e,0);if((r===o||!r)&&setTimeout)return r=setTimeout,setTimeout(e,0);try{return r(e,0)}catch(t){try{return r.call(null,e,0)}catch(t){return r.call(this,e,0)}}}function l(e){if(i===clearTimeout)return clearTimeout(e);if((i===s||!i)&&clearTimeout)return i=clearTimeout,clearTimeout(e);try{return i(e)}catch(t){try{return i.call(null,e)}catch(t){return i.call(this,e)}}}!function(){try{r="function"==typeof setTimeout?setTimeout:o}catch(e){r=o}try{i="function"==typeof clearTimeout?clearTimeout:s}catch(e){i=s}}();var u=[],c=!1,h,f=-1;function p(){c&&h&&(c=!1,h.length?u=h.concat(u):f=-1,u.length&&d())}function d(){if(!c){var e=a(p);c=!0;for(var t=u.length;t;){for(h=u,u=[];++f1)for(var n=1;n=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/))}function o(t){if(t[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+t[0]+(this.useColors?"%c ":" ")+"+"+e.exports.humanize(this.diff),!this.useColors)return;const n="color: "+this.color;t.splice(1,0,n,"color: inherit");let r=0,i=0;t[0].replace(/%[a-zA-Z%]/g,e=>{"%%"!==e&&(r++,"%c"===e&&(i=r))}),t.splice(i,0,n)}function s(...e){return"object"==typeof console&&console.log&&console.log(...e)}function a(e){try{e?t.storage.setItem("debug",e):t.storage.removeItem("debug")}catch(e){}}function l(){let e;try{e=t.storage.getItem("debug")}catch(e){}return!e&&void 0!==r&&"env"in r&&(e=r.env.DEBUG),e}function u(){try{return localStorage}catch(e){}}t.log=s,t.formatArgs=o,t.save=a,t.load=l,t.useColors=i,t.storage=u(),t.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],e.exports=n(631)(t);const{formatters:c}=e.exports;c.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}}).call(this,n(2))},function(e,t,n){var r=n(0),i=r.Buffer;function o(e,t){for(var n in e)t[n]=e[n]}function s(e,t,n){return i(e,t,n)}i.from&&i.alloc&&i.allocUnsafe&&i.allocUnsafeSlow?e.exports=r:(o(r,t),t.Buffer=s),o(i,s),s.from=function(e,t,n){if("number"==typeof e)throw new TypeError("Argument must not be a number");return i(e,t,n)},s.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},s.allocUnsafe=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return i(e)},s.allocUnsafeSlow=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return r.SlowBuffer(e)}},function(e,t,n){"use strict";var r="object"==typeof Reflect?Reflect:null,i=r&&"function"==typeof r.apply?r.apply:function e(t,n,r){return Function.prototype.apply.call(t,n,r)},o;function s(e){console&&console.warn&&console.warn(e)}o=r&&"function"==typeof r.ownKeys?r.ownKeys:Object.getOwnPropertySymbols?function e(t){return Object.getOwnPropertyNames(t).concat(Object.getOwnPropertySymbols(t))}:function e(t){return Object.getOwnPropertyNames(t)};var a=Number.isNaN||function e(t){return t!=t};function l(){l.init.call(this)}e.exports=l,l.EventEmitter=l,l.prototype._events=void 0,l.prototype._eventsCount=0,l.prototype._maxListeners=void 0;var u=10;function c(e){return void 0===e._maxListeners?l.defaultMaxListeners:e._maxListeners}function h(e,t,n,r){var i,o,a;if("function"!=typeof n)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof n);if(o=e._events,void 0===o?(o=e._events=Object.create(null),e._eventsCount=0):(void 0!==o.newListener&&(e.emit("newListener",t,n.listener?n.listener:n),o=e._events),a=o[t]),void 0===a)a=o[t]=n,++e._eventsCount;else if("function"==typeof a?a=o[t]=r?[n,a]:[a,n]:r?a.unshift(n):a.push(n),i=c(e),i>0&&a.length>i&&!a.warned){a.warned=!0;var l=new Error("Possible EventEmitter memory leak detected. "+a.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");l.name="MaxListenersExceededWarning",l.emitter=e,l.type=t,l.count=a.length,s(l)}return e}function f(){for(var e=[],t=0;t0&&(a=n[0]),a instanceof Error)throw a;var l=new Error("Unhandled error."+(a?" ("+a.message+")":""));throw l.context=a,l}var u=s[t];if(void 0===u)return!1;if("function"==typeof u)i(u,this,n);else for(var c=u.length,h=g(u,c),r=0;r=0;s--)if(r[s]===n||r[s].listener===n){a=r[s].listener,o=s;break}if(o<0)return this;0===o?r.shift():y(r,o),1===r.length&&(i[t]=r[0]),void 0!==i.removeListener&&this.emit("removeListener",t,a||n)}return this},l.prototype.off=l.prototype.removeListener,l.prototype.removeAllListeners=function e(t){var n,r,i;if(r=this._events,void 0===r)return this;if(void 0===r.removeListener)return 0===arguments.length?(this._events=Object.create(null),this._eventsCount=0):void 0!==r[t]&&(0==--this._eventsCount?this._events=Object.create(null):delete r[t]),this;if(0===arguments.length){var o=Object.keys(r),s;for(i=0;i=0;i--)this.removeListener(t,n[i]);return this},l.prototype.listeners=function e(t){return d(this,t,!0)},l.prototype.rawListeners=function e(t){return d(this,t,!1)},l.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):m.call(e,t)},l.prototype.listenerCount=m,l.prototype.eventNames=function e(){return this._eventsCount>0?o(this._events):[]}},function(e,t){var n;n=function(){return this}();try{n=n||new Function("return this")()}catch(e){"object"==typeof window&&(n=window)}e.exports=n},function(e,t,n){(function(e){function n(e){return Array.isArray?Array.isArray(e):"[object Array]"===g(e)}function r(e){return"boolean"==typeof e}function i(e){return null===e}function o(e){return null==e}function s(e){return"number"==typeof e}function a(e){return"string"==typeof e}function l(e){return"symbol"==typeof e}function u(e){return void 0===e}function c(e){return"[object RegExp]"===g(e)}function h(e){return"object"==typeof e&&null!==e}function f(e){return"[object Date]"===g(e)}function p(e){return"[object Error]"===g(e)||e instanceof Error}function d(e){return"function"==typeof e}function m(e){return null===e||"boolean"==typeof e||"number"==typeof e||"string"==typeof e||"symbol"==typeof e||void 0===e}function g(e){return Object.prototype.toString.call(e)}t.isArray=n,t.isBoolean=r,t.isNull=i,t.isNullOrUndefined=o,t.isNumber=s,t.isString=a,t.isSymbol=l,t.isUndefined=u,t.isRegExp=c,t.isObject=h,t.isDate=f,t.isError=p,t.isFunction=d,t.isPrimitive=m,t.isBuffer=e.isBuffer}).call(this,n(0).Buffer)},function(e,t,n){"use strict";(function(t){const r=n(27),i=n(60),o=n(115),s=n(95),a=n(695),l=n(39);class u{constructor(n,s,a){if(e.exports.isCID(n)){let e=n;return this.version=e.version,this.codec=e.codec,void(this.multihash=t.from(e.multihash))}if("string"==typeof n)if(i.isEncoded(n)){const e=i.decode(n);n=parseInt(e.slice(0,1).toString("hex"),16),s=o.getCodec(e.slice(1)),a=o.rmPrefix(e.slice(1))}else s="dag-pb",a=r.fromB58String(n),n=0;else if(t.isBuffer(n)){const e=n.slice(0,1),t=parseInt(e.toString("hex"),16);if(0===t||1===t){const e=n;n=t,s=o.getCodec(e.slice(1)),a=o.rmPrefix(e.slice(1))}else s="dag-pb",a=n,n=0}this.codec=s,this.version=n,this.multihash=a,u.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=t.concat([t.from("01","hex"),o.getCodeVarint(this.codec),this.multihash])}Object.defineProperty(this,"_buffer",{value:e})}return e}get prefix(){return t.concat([t.from(`0${this.version}`,"hex"),o.getCodeVarint(this.codec),r.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}=r.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 c(0,this.codec,this.multihash)}toV1(){return new c(1,this.codec,this.multihash)}toBaseEncodedString(e){switch(e=e||"base58btc",this.version){case 0:if("base58btc"!==e)throw new Error("not supported with CIDv0, to support different bases, please migrate the instance do CIDv1, you can do that through cid.toV1()");return r.toB58String(this.multihash);case 1:return i.encode(e,this.buffer).toString();default:throw new Error("Unsupported version")}}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){let t=a.checkCIDComponents(e);if(t)throw new Error(t)}}const c=l(u,{className:"CID",symbolName:"@ipld/js-cid/CID"});c.codecs=s,e.exports=c}).call(this,n(0).Buffer)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e,t){if(t=(0,l.default)(t||s.default),!(0,i.default)(e))return t(new Error("First argument to waterfall must be an array of functions"));if(!e.length)return t();var n=0;function r(t){var r=(0,d.default)(e[n++]);t.push((0,f.default)(o)),r.apply(null,t)}function o(i){if(i||n===e.length)return t.apply(null,arguments);r((0,c.default)(arguments,1))}r([])};var r=n(65),i=m(r),o=n(57),s=m(o),a=n(181),l=m(a),u=n(86),c=m(u),h=n(107),f=m(h),p=n(37),d=m(p);function m(e){return e&&e.__esModule?e:{default:e}}e.exports=t.default},function(e,t,n){"use strict";(function(t){function n(e,n,r,i){if("function"!=typeof e)throw new TypeError('"callback" argument must be a function');var o=arguments.length,s,a;switch(o){case 0:case 1:return t.nextTick(e);case 2:return t.nextTick(function t(){e.call(null,n)});case 3:return t.nextTick(function t(){e.call(null,n,r)});case 4:return t.nextTick(function t(){e.call(null,n,r,i)});default:for(s=new Array(o-1),a=0;a=o)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}}),l=r[n];n=3&&(r.depth=arguments[2]),arguments.length>=4&&(r.colors=arguments[3]),v(n)?r.showHidden=n:n&&t._extend(r,n),S(r.showHidden)&&(r.showHidden=!1),S(r.depth)&&(r.depth=2),S(r.colors)&&(r.colors=!1),S(r.customInspect)&&(r.customInspect=!0),r.colors&&(r.stylize=l),h(r,e,r.depth)}function l(e,t){var n=a.styles[t];return n?"["+a.colors[n][0]+"m"+e+"["+a.colors[n][1]+"m":e}function u(e,t){return e}function c(e){var t={};return e.forEach(function(e,n){t[e]=!0}),t}function h(e,n,r){if(e.customInspect&&n&&I(n.inspect)&&n.inspect!==t.inspect&&(!n.constructor||n.constructor.prototype!==n)){var i=n.inspect(r,e);return k(i)||(i=h(e,i,r)),i}var o=f(e,n);if(o)return o;var s=Object.keys(n),a=c(s);if(e.showHidden&&(s=Object.getOwnPropertyNames(n)),T(n)&&(s.indexOf("message")>=0||s.indexOf("description")>=0))return p(n);if(0===s.length){if(I(n)){var l=n.name?": "+n.name:"";return e.stylize("[Function"+l+"]","special")}if(x(n))return e.stylize(RegExp.prototype.toString.call(n),"regexp");if(A(n))return e.stylize(Date.prototype.toString.call(n),"date");if(T(n))return p(n)}var u="",v=!1,b=["{","}"],_;if(y(n)&&(v=!0,b=["[","]"]),I(n)){var w=n.name?": "+n.name:"";u=" [Function"+w+"]"}return x(n)&&(u=" "+RegExp.prototype.toString.call(n)),A(n)&&(u=" "+Date.prototype.toUTCString.call(n)),T(n)&&(u=" "+p(n)),0!==s.length||v&&0!=n.length?r<0?x(n)?e.stylize(RegExp.prototype.toString.call(n),"regexp"):e.stylize("[Object]","special"):(e.seen.push(n),_=v?d(e,n,r,a,s):s.map(function(t){return m(e,n,r,a,t,v)}),e.seen.pop(),g(_,u,b)):b[0]+u+b[1]}function f(e,t){if(S(t))return e.stylize("undefined","undefined");if(k(t)){var n="'"+JSON.stringify(t).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return e.stylize(n,"string")}return w(t)?e.stylize(""+t,"number"):v(t)?e.stylize(""+t,"boolean"):b(t)?e.stylize("null","null"):void 0}function p(e){return"["+Error.prototype.toString.call(e)+"]"}function d(e,t,n,r,i){for(var o=[],s=0,a=t.length;s-1&&(a=o?a.split("\n").map(function(e){return" "+e}).join("\n").substr(2):"\n"+a.split("\n").map(function(e){return" "+e}).join("\n"))):a=e.stylize("[Circular]","special")),S(s)){if(o&&i.match(/^\d+$/))return a;s=JSON.stringify(""+i),s.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(s=s.substr(1,s.length-2),s=e.stylize(s,"name")):(s=s.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),s=e.stylize(s,"string"))}return s+": "+a}function g(e,t,n){var r=0,i=e.reduce(function(e,t){return r++,t.indexOf("\n")>=0&&r++,e+t.replace(/\u001b\[\d\d?m/g,"").length+1},0);return i>60?n[0]+(""===t?"":t+"\n ")+" "+e.join(",\n ")+" "+n[1]:n[0]+t+" "+e.join(", ")+" "+n[1]}function y(e){return Array.isArray(e)}function v(e){return"boolean"==typeof e}function b(e){return null===e}function _(e){return null==e}function w(e){return"number"==typeof e}function k(e){return"string"==typeof e}function E(e){return"symbol"==typeof e}function S(e){return void 0===e}function x(e){return C(e)&&"[object RegExp]"===R(e)}function C(e){return"object"==typeof e&&null!==e}function A(e){return C(e)&&"[object Date]"===R(e)}function T(e){return C(e)&&("[object Error]"===R(e)||e instanceof Error)}function I(e){return"function"==typeof e}function j(e){return null===e||"boolean"==typeof e||"number"==typeof e||"string"==typeof e||"symbol"==typeof e||void 0===e}function R(e){return Object.prototype.toString.call(e)}function B(e){return e<10?"0"+e.toString(10):e.toString(10)}t.debuglog=function(n){if(S(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=y,t.isBoolean=v,t.isNull=b,t.isNullOrUndefined=_,t.isNumber=w,t.isString=k,t.isSymbol=E,t.isUndefined=S,t.isRegExp=x,t.isObject=C,t.isDate=A,t.isError=T,t.isFunction=I,t.isPrimitive=j,t.isBuffer=n(714);var O=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function P(){var e=new Date,t=[B(e.getHours()),B(e.getMinutes()),B(e.getSeconds())].join(":");return[e.getDate(),O[e.getMonth()],t].join(" ")}function N(e,t){return Object.prototype.hasOwnProperty.call(e,t)}t.log=function(){console.log("%s - %s",P(),t.format.apply(t,arguments))},t.inherits=n(715),t._extend=function(e,t){if(!t||!C(t))return e;for(var n=Object.keys(t),r=n.length;r--;)e[n[r]]=t[n[r]];return e};var D="undefined"!=typeof Symbol?Symbol("util.promisify.custom"):void 0;function F(e,t){if(!e){var n=new Error("Promise was rejected with a falsy value");n.reason=e,e=n}return t(e)}function M(t){if("function"!=typeof t)throw new TypeError('The "original" argument must be of type Function');function n(){for(var n=[],r=0;r"}toJSON(){return{id:this.toB58String(),privKey:h(this.marshalPrivKey()),pubKey:h(this.marshalPubKey())}}toHexString(){return i.toHexString(this.id)}toBytes(){return this.id}toB58String(){return this._idB58String}isEqual(e){if(r.isBuffer(e))return this.id.equals(e);if(e.id)return this.id.equals(e.id);throw new Error("not valid Id")}isValid(e){this.privKey&&this.privKey.public&&this.privKey.public.bytes&&r.isBuffer(this.pubKey.bytes)&&this.privKey.public.bytes.equals(this.pubKey.bytes)?e():e(new Error("Keys not match"))}}const c=l(u,{className:"PeerId",symbolName:"@libp2p/js-peer-id/PeerId"});function h(e){if(e)return e.toString("base64")}t=e.exports=c,t.create=function(e,t){"function"==typeof e&&(t=e,e={}),e=e||{},e.bits=e.bits||2048,a([t=>o.generateKeyPair("RSA",e.bits,t),(e,t)=>e.public.hash((n,r)=>{t(n,r,e)})],(e,n,r)=>{if(e)return t(e);t(null,new c(n,r))})},t.createFromHexString=function(e){return new c(i.fromHexString(e))},t.createFromBytes=function(e){return new c(e)},t.createFromB58String=function(e){return new c(i.fromB58String(e))},t.createFromPubKey=function(e,t){if("function"!=typeof t)throw new Error("callback is required");let n;try{let i=e;if("string"==typeof i&&(i=r.from(e,"base64")),!r.isBuffer(i))throw new Error("Supplied key is neither a base64 string nor a buffer");n=o.unmarshalPublicKey(i)}catch(e){return t(e)}n.hash((e,r)=>{if(e)return t(e);t(null,new c(r,null,n))})},t.createFromPrivKey=function(e,t){if("function"!=typeof t)throw new Error("callback is required");let n=e;try{if("string"==typeof n&&(n=r.from(e,"base64")),!r.isBuffer(n))throw new Error("Supplied key is neither a base64 string nor a buffer")}catch(e){return t(e)}a([e=>o.unmarshalPrivateKey(n,e),(e,t)=>e.public.hash((n,r)=>{t(n,r,e)})],(e,n,r)=>{if(e)return t(e);t(null,new c(n,r,r.public))})},t.createFromJSON=function(e,t){if("function"!=typeof t)throw new Error("callback is required");let n,s,l,u;try{n=i.fromB58String(e.id),s=e.privKey&&r.from(e.privKey,"base64"),l=e.pubKey&&r.from(e.pubKey,"base64"),u=l&&o.unmarshalPublicKey(l)}catch(e){return t(e)}s?a([e=>o.unmarshalPrivateKey(s,e),(e,t)=>e.public.hash((n,r)=>{t(n,r,e)}),(e,t,n)=>{u?u.hash((r,i)=>{n(r,e,t,i)}):n(null,e,t)}],(e,r,i,o)=>e?t(e):u&&!r.equals(o)?t(new Error("Public and private key do not match")):n&&!r.equals(n)?t(new Error("Id and private key do not match")):void t(null,new c(n,i,u))):t(null,new c(n,null,u))},t.isPeerId=function(e){return Boolean("object"==typeof e&&e._id&&e._idB58String)}}).call(this,n(0).Buffer)},function(e,t,n){t=e.exports=n(333),t.Stream=t,t.Readable=t,t.Writable=n(337),t.Duplex=n(113),t.Transform=n(338),t.PassThrough=n(662),t.finished=n(243),t.pipeline=n(663)},function(e,t){},function(e,t,n){"use strict";var r=n(684),i=n(688),o=n(692);for(var s in t=e.exports=n(12),t.pull=t,r)t[s]=r[s];for(var s in o)t[s]=o[s];for(var s in i)t[s]=i[s]},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(178),i=o(r);function o(e){return e&&e.__esModule?e:{default:e}}t.default=i.default,e.exports=t.default},function(e,t){e.exports={options:{usePureJavaScript:!1}}},function(e,t,n){"use strict";(function(r){const i=n(793),o=n(258),s=n(35),a=n(70),l=n(39),u=l.proto(function(e){if(!(this instanceof u))return new u(e);if(null==e&&(e=""),e instanceof r)this.buffer=i.fromBuffer(e);else if("string"==typeof e||e instanceof String){if(e.length>0&&"/"!==e.charAt(0))throw new Error(`multiaddr "${e}" must start with a "/"`);this.buffer=i.fromString(e)}else{if(!(e.buffer&&e.protos&&e.protoCodes))throw new Error("addr must be a string, Buffer, or another Multiaddr");this.buffer=i.fromBuffer(e.buffer)}},{className:"Multiaddr",symbolName:"@multiformats/js-multiaddr/multiaddr"});u.prototype.toString=function e(){return i.bufferToString(this.buffer)},u.prototype.toJSON=u.prototype.toString,u.prototype.toOptions=function e(){const t={},n=this.toString().split("/");return t.family="ip4"===n[1]?"ipv4":"ipv6",t.host=n[2],t.transport=n[3],t.port=n[4],t},u.prototype.inspect=function e(){return""},u.prototype.protos=function e(){return this.protoCodes().map(e=>Object.assign({},o(e)))},u.prototype.protoCodes=function e(){const t=[],n=this.buffer;let r=0;for(;re.name)},u.prototype.tuples=function e(){return i.bufferToTuples(this.buffer)},u.prototype.stringTuples=function e(){const t=i.bufferToTuples(this.buffer);return i.tuplesToStringTuples(t)},u.prototype.encapsulate=function e(t){return t=u(t),u(this.toString()+t.toString())},u.prototype.decapsulate=function e(t){t=t.toString();const n=this.toString(),r=n.lastIndexOf(t);if(r<0)throw new Error("Address "+this+" does not contain subaddress: "+t);return u(n.slice(0,r))},u.prototype.getPeerId=function e(){let t=null;try{t=this.stringTuples().filter(e=>{if(e[0]===o.names.ipfs.code)return!0})[0][1],a.decode(t)}catch(e){t=null}return t},u.prototype.getPath=function e(){let t=null;try{t=this.stringTuples().filter(e=>{const t=o(e[0]);if(t.path)return!0})[0][1]}catch(e){t=null}return t},u.prototype.equals=function e(t){return this.buffer.equals(t.buffer)},u.prototype.nodeAddress=function e(){const t=this.protoCodes(),n=this.protoNames(),r=this.toString().split("/").slice(1);if(r.length<4)throw new Error('multiaddr must have a valid format: "/{ip4, ip6, dns4, dns6}/{address}/{tcp, udp}/{port}".');if(4!==t[0]&&41!==t[0]&&54!==t[0]&&55!==t[0])throw new Error(`no protocol with name: "'${n[0]}'". Must have a valid family name: "{ip4, ip6, dns4, dns6}".`);if("tcp"!==r[2]&&"udp"!==r[2])throw new Error(`no protocol with name: "'${n[1]}'". Must have a valid transport protocol: "{tcp, udp}".`);return{family:41===t[0]||55===t[0]?6:4,address:r[1],port:r[3]}},u.fromNodeAddress=function e(t,n){if(!t)throw new Error("requires node address object");if(!n)throw new Error("requires transport protocol");const r="IPv6"===t.family?"ip6":"ip4";return u("/"+[r,t.address,n,t.port].join("/"))},u.prototype.isThinWaistAddress=function e(t){const n=(t||this).protos();return 2===n.length&&((4===n[0].code||41===n[0].code)&&(6===n[1].code||273===n[1].code))},u.protocols=o,u.isName=function e(t){return!!u.isMultiaddr(t)&&t.protos().some(e=>e.resolvable)},u.resolve=function e(t,n){return u.isMultiaddr(t)&&u.isName(t)?n(new Error("not implemented yet")):n(new Error("not a valid name"))},t=e.exports=u}).call(this,n(0).Buffer)},function(e,t,n){"use strict";const r=n(534),i=n(535),o=n(21);e.exports=(e=>{const t=r();if("function"==typeof e)return e;if("object"==typeof e)return i(e);if("string"==typeof e){const n=o(e).nodeAddress();return t.host=n.address,t.port=n.port,i(t)}throw new Error("Argument must be a send function or a config object.")})},function(e,t,n){"use strict";(function(t){var r=n(713); -/*! - * The buffer module from node.js, for the browser. - * - * @author Feross Aboukhadijeh - * @license MIT - */function i(e,t){if(e===t)return 0;for(var n=e.length,r=t.length,i=0,o=Math.min(n,r);i=0;h--)if(a[h]!==u[h])return!1;for(h=a.length-1;h>=0;h--)if(c=a[h],!_(e[c],t[c],n,r))return!1;return!0}function E(e,t,n){_(e,t,!0)&&v(e,t,n,"notDeepStrictEqual",E)}function S(e,t){if(!e||!t)return!1;if("[object RegExp]"==Object.prototype.toString.call(t))return t.test(e);try{if(e instanceof t)return!0}catch(e){}return!Error.isPrototypeOf(t)&&!0===t.call({},e)}function x(e){var t;try{e()}catch(e){t=e}return t}function C(e,t,n,r){var i;if("function"!=typeof t)throw new TypeError('"block" argument must be a function');"string"==typeof n&&(r=n,n=null),i=x(t),r=(n&&n.name?" ("+n.name+").":".")+(r?" "+r:"."),e&&!i&&v(i,n,"Missing expected exception"+r);var o="string"==typeof r,a=!e&&s.isError(i),l=!e&&i&&!n;if((a&&o&&S(i,n)||l)&&v(i,n,"Got unwanted exception"+r),e&&i&&n&&!S(i,n)||!e&&i)throw i}function A(e,t){e||v(e,!0,t,"==",A)}f.AssertionError=function e(t){this.name="AssertionError",this.actual=t.actual,this.expected=t.expected,this.operator=t.operator,t.message?(this.message=t.message,this.generatedMessage=!1):(this.message=y(this),this.generatedMessage=!0);var n=t.stackStartFunction||v;if(Error.captureStackTrace)Error.captureStackTrace(this,n);else{var r=new Error;if(r.stack){var i=r.stack,o=d(n),s=i.indexOf("\n"+o);if(s>=0){var a=i.indexOf("\n",s+1);i=i.substring(a+1)}this.stack=i}}},s.inherits(f.AssertionError,Error),f.fail=v,f.ok=b,f.equal=function e(t,n,r){t!=n&&v(t,n,r,"==",f.equal)},f.notEqual=function e(t,n,r){t==n&&v(t,n,r,"!=",f.notEqual)},f.deepEqual=function e(t,n,r){_(t,n,!1)||v(t,n,r,"deepEqual",f.deepEqual)},f.deepStrictEqual=function e(t,n,r){_(t,n,!0)||v(t,n,r,"deepStrictEqual",f.deepStrictEqual)},f.notDeepEqual=function e(t,n,r){_(t,n,!1)&&v(t,n,r,"notDeepEqual",f.notDeepEqual)},f.notDeepStrictEqual=E,f.strictEqual=function e(t,n,r){t!==n&&v(t,n,r,"===",f.strictEqual)},f.notStrictEqual=function e(t,n,r){t===n&&v(t,n,r,"!==",f.notStrictEqual)},f.throws=function(e,t,n){C(!0,e,t,n)},f.doesNotThrow=function(e,t,n){C(!1,e,t,n)},f.ifError=function(e){if(e)throw e},f.strict=r(A,f,{equal:f.strictEqual,deepEqual:f.deepStrictEqual,notEqual:f.notStrictEqual,notDeepEqual:f.notDeepStrictEqual}),f.strict.strict=f.strict;var T=Object.keys||function(e){var t=[];for(var n in e)a.call(e,n)&&t.push(n);return t}}).call(this,n(7))},function(e,t,n){"use strict";var r=n(5).Buffer,i=r.isEncoding||function(e){switch(e=""+e,e&&e.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function o(e){if(!e)return"utf8";for(var t;;)switch(e){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return e;default:if(t)return;e=(""+e).toLowerCase(),t=!0}}function s(e){var t=o(e);if("string"!=typeof t&&(r.isEncoding===i||!i(e)))throw new Error("Unknown encoding: "+e);return t||e}function a(e){var t;switch(this.encoding=s(e),this.encoding){case"utf16le":this.text=d,this.end=m,t=4;break;case"utf8":this.fillLast=h,t=4;break;case"base64":this.text=g,this.end=y,t=3;break;default:return this.write=v,void(this.end=b)}this.lastNeed=0,this.lastTotal=0,this.lastChar=r.allocUnsafe(t)}function l(e){return e<=127?0:e>>5==6?2:e>>4==14?3:e>>3==30?4:e>>6==2?-1:-2}function u(e,t,n){var r=t.length-1;if(r=0?(i>0&&(e.lastNeed=i-1),i):--r=0?(i>0&&(e.lastNeed=i-2),i):--r=0?(i>0&&(2===i?i=0:e.lastNeed=i-3),i):0))}function c(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,"�"}}function h(e){var t=this.lastTotal-this.lastNeed,n=c(this,e,t);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 f(e,t){var n=u(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)}function p(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+"�":t}function d(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 m(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 g(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 y(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+this.lastChar.toString("base64",0,3-this.lastNeed):t}function v(e){return e.toString(this.encoding)}function b(e){return e&&e.length?this.write(e):""}t.StringDecoder=a,a.prototype.write=function(e){if(0===e.length)return"";var t,n;if(this.lastNeed){if(t=this.fillLast(e),void 0===t)return"";n=this.lastNeed,this.lastNeed=0}else n=0;return n 3 bytes.");let s=o.decode(r);if(!t.isValidCode(s))throw new Error(`multihash unknown function code: 0x${s.toString(16)}`);r=r.slice(o.decode.bytes);let a=o.decode(r);if(a<1)throw new Error(`multihash invalid length: 0x${a.toString(16)}`);if(r=r.slice(o.decode.bytes),r.length!==a)throw new Error(`multihash length inconsistent: 0x${r.toString("hex")}`);return{code:s,name:i.codes[s],length:a,digest:r}},t.encode=function n(r,i,s){if(!r||!i)throw new Error("multihash encode requires at least two args: digest, code");const a=t.coerceCode(i);if(!e.isBuffer(r))throw new Error("digest should be a Buffer");if(null==s&&(s=r.length),s&&r.length!==s)throw new Error("digest length should be equal to specified length.");return e.concat([e.from(o.encode(a)),e.from(o.encode(s)),r])},t.coerceCode=function e(n){let r=n;if("string"==typeof n){if(!i.names[n])throw new Error(`Unrecognized hash function named: ${n}`);r=i.names[n]}if("number"!=typeof r)throw new Error(`Hash function code should be a number. Got: ${r}`);if(!i.codes[r]&&!t.isAppCode(r))throw new Error(`Unrecognized function code: ${r}`);return r},t.isAppCode=function e(t){return t>0&&t<16},t.isValidCode=function e(n){return!!t.isAppCode(n)||!!i.codes[n]},t.validate=s,t.prefix=function e(t){return s(t),t.slice(0,2)}}).call(this,n(0).Buffer)},function(e,t,n){"use strict";const r=n(401),i=n(820),o=n(260),s=n(404);t.Key=r,t.MemoryDatastore=i,t.utils=o,t.Errors=s},function(e,t,n){"use strict";(function(t){var r=n(0),i=r.Buffer,o={},s;for(s in r)r.hasOwnProperty(s)&&"SlowBuffer"!==s&&"Buffer"!==s&&(o[s]=r[s]);var a=o.Buffer={};for(s in i)i.hasOwnProperty(s)&&"allocUnsafe"!==s&&"allocUnsafeSlow"!==s&&(a[s]=i[s]);if(o.Buffer.prototype=i.prototype,a.from&&a.from!==Uint8Array.from||(a.from=function(e,t,n){if("number"==typeof e)throw new TypeError('The "value" argument must not be of type number. Received type '+typeof e);if(e&&void 0===e.length)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e);return i(e,t,n)}),a.alloc||(a.alloc=function(e,t,n){if("number"!=typeof e)throw new TypeError('The "size" argument must be of type number. Received type '+typeof e);if(e<0||e>=2*(1<<30))throw new RangeError('The value "'+e+'" is invalid for option "size"');var r=i(e);return t&&0!==t.length?"string"==typeof n?r.fill(t,n):r.fill(t):r.fill(0),r}),!o.kStringMaxLength)try{o.kStringMaxLength=t.binding("buffer").kStringMaxLength}catch(e){}o.constants||(o.constants={MAX_LENGTH:o.kMaxLength},o.kStringMaxLength&&(o.constants.MAX_STRING_LENGTH=o.kStringMaxLength)),e.exports=o}).call(this,n(2))},function(e,t,n){(function(t,r){var i=n(20),o=n(733),s=e.exports=i.util=i.util||{};function a(e){if(8!==e&&16!==e&&24!==e&&32!==e)throw new Error("Only 8, 16, 24, or 32 bits supported: "+e)}function l(e){if(this.data="",this.read=0,"string"==typeof e)this.data=e;else if(s.isArrayBuffer(e)||s.isArrayBufferView(e))if(void 0!==r&&e instanceof r)this.data=e.toString("binary");else{var t=new Uint8Array(e);try{this.data=String.fromCharCode.apply(null,t)}catch(e){for(var n=0;n15?(i=Date.now(),l(e)):(n.push(e),1===n.length&&a.setAttribute("a",o=!o))}}s.nextTick=s.setImmediate}(),s.isNodejs=void 0!==t&&t.versions&&t.versions.node,s.isArray=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)},s.isArrayBuffer=function(e){return"undefined"!=typeof ArrayBuffer&&e instanceof ArrayBuffer},s.isArrayBufferView=function(e){return e&&s.isArrayBuffer(e.buffer)&&void 0!==e.byteLength},s.ByteBuffer=l,s.ByteStringBuffer=l;var u=4096;function c(e,t){t=t||{},this.read=t.readOffset||0,this.growSize=t.growSize||1024;var n=s.isArrayBuffer(e),r=s.isArrayBufferView(e);if(n||r)return this.data=n?new DataView(e):new DataView(e.buffer,e.byteOffset,e.byteLength),void(this.write="writeOffset"in t?t.writeOffset:this.data.byteLength);this.data=new DataView(new ArrayBuffer(0)),this.write=0,null!==e&&void 0!==e&&this.putBytes(e),"writeOffset"in t&&(this.write=t.writeOffset)}s.ByteStringBuffer.prototype._optimizeConstructedString=function(e){this._constructedStringLength+=e,this._constructedStringLength>4096&&(this.data.substr(0,1),this._constructedStringLength=0)},s.ByteStringBuffer.prototype.length=function(){return this.data.length-this.read},s.ByteStringBuffer.prototype.isEmpty=function(){return this.length()<=0},s.ByteStringBuffer.prototype.putByte=function(e){return this.putBytes(String.fromCharCode(e))},s.ByteStringBuffer.prototype.fillWithByte=function(e,t){e=String.fromCharCode(e);for(var n=this.data;t>0;)1&t&&(n+=e),t>>>=1,t>0&&(e+=e);return this.data=n,this._optimizeConstructedString(t),this},s.ByteStringBuffer.prototype.putBytes=function(e){return this.data+=e,this._optimizeConstructedString(e.length),this},s.ByteStringBuffer.prototype.putString=function(e){return this.putBytes(s.encodeUtf8(e))},s.ByteStringBuffer.prototype.putInt16=function(e){return this.putBytes(String.fromCharCode(e>>8&255)+String.fromCharCode(255&e))},s.ByteStringBuffer.prototype.putInt24=function(e){return this.putBytes(String.fromCharCode(e>>16&255)+String.fromCharCode(e>>8&255)+String.fromCharCode(255&e))},s.ByteStringBuffer.prototype.putInt32=function(e){return this.putBytes(String.fromCharCode(e>>24&255)+String.fromCharCode(e>>16&255)+String.fromCharCode(e>>8&255)+String.fromCharCode(255&e))},s.ByteStringBuffer.prototype.putInt16Le=function(e){return this.putBytes(String.fromCharCode(255&e)+String.fromCharCode(e>>8&255))},s.ByteStringBuffer.prototype.putInt24Le=function(e){return this.putBytes(String.fromCharCode(255&e)+String.fromCharCode(e>>8&255)+String.fromCharCode(e>>16&255))},s.ByteStringBuffer.prototype.putInt32Le=function(e){return this.putBytes(String.fromCharCode(255&e)+String.fromCharCode(e>>8&255)+String.fromCharCode(e>>16&255)+String.fromCharCode(e>>24&255))},s.ByteStringBuffer.prototype.putInt=function(e,t){a(t);var n="";do{t-=8,n+=String.fromCharCode(e>>t&255)}while(t>0);return this.putBytes(n)},s.ByteStringBuffer.prototype.putSignedInt=function(e,t){return e<0&&(e+=2<0);return t},s.ByteStringBuffer.prototype.getSignedInt=function(e){var t=this.getInt(e),n=2<=n&&(t-=n<<1),t},s.ByteStringBuffer.prototype.getBytes=function(e){var t;return e?(e=Math.min(this.length(),e),t=this.data.slice(this.read,this.read+e),this.read+=e):0===e?t="":(t=0===this.read?this.data:this.data.slice(this.read),this.clear()),t},s.ByteStringBuffer.prototype.bytes=function(e){return void 0===e?this.data.slice(this.read):this.data.slice(this.read,this.read+e)},s.ByteStringBuffer.prototype.at=function(e){return this.data.charCodeAt(this.read+e)},s.ByteStringBuffer.prototype.setAt=function(e,t){return this.data=this.data.substr(0,this.read+e)+String.fromCharCode(t)+this.data.substr(this.read+e+1),this},s.ByteStringBuffer.prototype.last=function(){return this.data.charCodeAt(this.data.length-1)},s.ByteStringBuffer.prototype.copy=function(){var e=s.createBuffer(this.data);return e.read=this.read,e},s.ByteStringBuffer.prototype.compact=function(){return this.read>0&&(this.data=this.data.slice(this.read),this.read=0),this},s.ByteStringBuffer.prototype.clear=function(){return this.data="",this.read=0,this},s.ByteStringBuffer.prototype.truncate=function(e){var t=Math.max(0,this.length()-e);return this.data=this.data.substr(this.read,t),this.read=0,this},s.ByteStringBuffer.prototype.toHex=function(){for(var e="",t=this.read;t=e)return this;t=Math.max(t||this.growSize,e);var n=new Uint8Array(this.data.buffer,this.data.byteOffset,this.data.byteLength),r=new Uint8Array(this.length()+t);return r.set(n),this.data=new DataView(r.buffer),this},s.DataBuffer.prototype.putByte=function(e){return this.accommodate(1),this.data.setUint8(this.write++,e),this},s.DataBuffer.prototype.fillWithByte=function(e,t){this.accommodate(t);for(var n=0;n>8&65535),this.data.setInt8(this.write,e>>16&255),this.write+=3,this},s.DataBuffer.prototype.putInt32=function(e){return this.accommodate(4),this.data.setInt32(this.write,e),this.write+=4,this},s.DataBuffer.prototype.putInt16Le=function(e){return this.accommodate(2),this.data.setInt16(this.write,e,!0),this.write+=2,this},s.DataBuffer.prototype.putInt24Le=function(e){return this.accommodate(3),this.data.setInt8(this.write,e>>16&255),this.data.setInt16(this.write,e>>8&65535,!0),this.write+=3,this},s.DataBuffer.prototype.putInt32Le=function(e){return this.accommodate(4),this.data.setInt32(this.write,e,!0),this.write+=4,this},s.DataBuffer.prototype.putInt=function(e,t){a(t),this.accommodate(t/8);do{t-=8,this.data.setInt8(this.write++,e>>t&255)}while(t>0);return this},s.DataBuffer.prototype.putSignedInt=function(e,t){return a(t),this.accommodate(t/8),e<0&&(e+=2<0);return t},s.DataBuffer.prototype.getSignedInt=function(e){var t=this.getInt(e),n=2<=n&&(t-=n<<1),t},s.DataBuffer.prototype.getBytes=function(e){var t;return e?(e=Math.min(this.length(),e),t=this.data.slice(this.read,this.read+e),this.read+=e):0===e?t="":(t=0===this.read?this.data:this.data.slice(this.read),this.clear()),t},s.DataBuffer.prototype.bytes=function(e){return void 0===e?this.data.slice(this.read):this.data.slice(this.read,this.read+e)},s.DataBuffer.prototype.at=function(e){return this.data.getUint8(this.read+e)},s.DataBuffer.prototype.setAt=function(e,t){return this.data.setUint8(e,t),this},s.DataBuffer.prototype.last=function(){return this.data.getUint8(this.write-1)},s.DataBuffer.prototype.copy=function(){return new s.DataBuffer(this)},s.DataBuffer.prototype.compact=function(){if(this.read>0){var e=new Uint8Array(this.data.buffer,this.read),t=new Uint8Array(e.byteLength);t.set(e),this.data=new DataView(t),this.write-=this.read,this.read=0}return this},s.DataBuffer.prototype.clear=function(){return this.data=new DataView(new ArrayBuffer(0)),this.read=this.write=0,this},s.DataBuffer.prototype.truncate=function(e){return this.write=Math.max(0,this.length()-e),this.read=Math.min(this.read,this.write),this},s.DataBuffer.prototype.toHex=function(){for(var e="",t=this.read;t0;)1&t&&(n+=e),t>>>=1,t>0&&(e+=e);return n},s.xorBytes=function(e,t,n){for(var r="",i="",o="",s=0,a=0;n>0;--n,++s)i=e.charCodeAt(s)^t.charCodeAt(s),a>=10&&(r+=o,o="",a=0),o+=String.fromCharCode(i),++a;return r+=o,r},s.hexToBytes=function(e){var t="",n=0;for(!0&e.length&&(n=1,t+=String.fromCharCode(parseInt(e[0],16)));n>24&255)+String.fromCharCode(e>>16&255)+String.fromCharCode(e>>8&255)+String.fromCharCode(255&e)};var h="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",f=[62,-1,-1,-1,63,52,53,54,55,56,57,58,59,60,61,-1,-1,-1,64,-1,-1,-1,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,-1,-1,-1,-1,-1,-1,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51],p="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";s.encode64=function(e,t){for(var n="",r="",i,o,s,a=0;a>2),n+=h.charAt((3&i)<<4|o>>4),isNaN(o)?n+="==":(n+=h.charAt((15&o)<<2|s>>6),n+=isNaN(s)?"=":h.charAt(63&s)),t&&n.length>t&&(r+=n.substr(0,t)+"\r\n",n=n.substr(t));return r+=n,r},s.decode64=function(e){e=e.replace(/[^A-Za-z0-9\+\/\=]/g,"");for(var t="",n,r,i,o,s=0;s>4),64!==i&&(t+=String.fromCharCode((15&r)<<4|i>>2),64!==o&&(t+=String.fromCharCode((3&i)<<6|o)));return t},s.encodeUtf8=function(e){return unescape(encodeURIComponent(e))},s.decodeUtf8=function(e){return decodeURIComponent(escape(e))},s.binary={raw:{},hex:{},base64:{},base58:{},baseN:{encode:o.encode,decode:o.decode}},s.binary.raw.encode=function(e){return String.fromCharCode.apply(null,e)},s.binary.raw.decode=function(e,t,n){var r=t;r||(r=new Uint8Array(e.length)),n=n||0;for(var i=n,o=0;o>2),n+=h.charAt((3&i)<<4|o>>4),isNaN(o)?n+="==":(n+=h.charAt((15&o)<<2|s>>6),n+=isNaN(s)?"=":h.charAt(63&s)),t&&n.length>t&&(r+=n.substr(0,t)+"\r\n",n=n.substr(t));return r+=n,r},s.binary.base64.decode=function(e,t,n){var r=t,i,o,s,a;r||(r=new Uint8Array(3*Math.ceil(e.length/4))),e=e.replace(/[^A-Za-z0-9\+\/\=]/g,""),n=n||0;for(var l=0,u=n;l>4,64!==s&&(r[u++]=(15&o)<<4|s>>2,64!==a&&(r[u++]=(3&s)<<6|a));return t?u-n:r.subarray(0,u)},s.binary.base58.encode=function(e,t){return s.binary.baseN.encode(e,p,t)},s.binary.base58.decode=function(e,t){return s.binary.baseN.decode(e,p,t)},s.text={utf8:{},utf16:{}},s.text.utf8.encode=function(e,t,n){e=s.encodeUtf8(e);var r=t;r||(r=new Uint8Array(e.length)),n=n||0;for(var i=n,o=0;o0?(o=n[r].substring(0,i),s=n[r].substring(i+1)):(o=n[r],s=null),o in t||(t[o]=[]),o in Object.prototype||null===s||t[o].push(unescape(s))}return t},n;return void 0===e?(null===w&&(w="undefined"!=typeof window&&window.location&&window.location.search?t(window.location.search.substring(1)):{}),n=w):n=t(e),n},s.parseFragment=function(e){var t=e,n="",r=e.indexOf("?");r>0&&(t=e.substring(0,r),n=e.substring(r+1));var i=t.split("/");i.length>0&&""===i[0]&&i.shift();var o=""===n?{}:s.getQueryVariables(n);return{pathString:t,queryString:n,path:i,query:o}},s.makeRequest=function(e){var t=s.parseFragment(e),n={path:t.pathString,query:t.queryString,getPath:function(e){return void 0===e?t.path:t.path[e]},getQuery:function(e,n){var r;return void 0===e?r=t.query:(r=t.query[e],r&&void 0!==n&&(r=r[n])),r},getQueryLast:function(e,t){var r,i=n.getQuery(e);return r=i?i[i.length-1]:t,r}};return n},s.makeLink=function(e,t,n){e=jQuery.isArray(e)?e.join("/"):e;var r=jQuery.param(t||{});return n=n||"",e+(r.length>0?"?"+r:"")+(n.length>0?"#"+n:"")},s.setPath=function(e,t,n){if("object"==typeof e&&null!==e)for(var r=0,i=t.length;r0&&o.push(r),s=t.lastIndex;var a=n[0][1];switch(a){case"s":case"o":i");break;case"%":o.push("%");break;default:o.push("<%"+a+"?>")}}return o.push(e.substring(s)),o.join("")},s.formatNumber=function(e,t,n,r){var i=e,o=isNaN(t=Math.abs(t))?2:t,s=void 0===n?",":n,a=void 0===r?".":r,l=i<0?"-":"",u=parseInt(i=Math.abs(+i||0).toFixed(o),10)+"",c=u.length>3?u.length%3:0;return l+(c?u.substr(0,c)+a:"")+u.substr(c).replace(/(\d{3})(?=\d)/g,"$1"+a)+(o?s+Math.abs(i-u).toFixed(o).slice(2):"")},s.formatSize=function(e){return e=e>=1073741824?s.formatNumber(e/1073741824,2,".","")+" GiB":e>=1048576?s.formatNumber(e/1048576,2,".","")+" MiB":e>=1024?s.formatNumber(e/1024,0)+" KiB":s.formatNumber(e,0)+" bytes",e},s.bytesFromIP=function(e){return-1!==e.indexOf(".")?s.bytesFromIPv4(e):-1!==e.indexOf(":")?s.bytesFromIPv6(e):null},s.bytesFromIPv4=function(e){if(e=e.split("."),4!==e.length)return null;for(var t=s.createBuffer(),n=0;nn[r].end-n[r].start&&(r=n.length-1)):n.push({start:l,end:l})}t.push(o)}if(n.length>0){var u=n[r];u.end-u.start>0&&(t.splice(u.start,u.end-u.start+1,""),0===u.start&&t.unshift(""),7===u.end&&t.push(""))}return t.join(":")},s.estimateCores=function(e,t){if("function"==typeof e&&(t=e,e={}),e=e||{},"cores"in s&&!e.update)return t(null,s.cores);if("undefined"!=typeof navigator&&"hardwareConcurrency"in navigator&&navigator.hardwareConcurrency>0)return s.cores=navigator.hardwareConcurrency,t(null,s.cores);if("undefined"==typeof Worker)return s.cores=1,t(null,s.cores);if("undefined"==typeof Blob)return s.cores=2,t(null,s.cores);var n=URL.createObjectURL(new Blob(["(",function(){self.addEventListener("message",function(e){for(var t=Date.now(),n=t+4;Date.now()a.st&&i.sti.st&&a.st{if("function"==typeof e)return t=e,e=null,void r.create((e,n)=>{if(e)return t(e);t(null,new a(n))});"function"==typeof e.toJSON?t(null,new a(e)):r.createFromJSON(e,(e,n)=>t(e,new a(n)))}),a.isPeerInfo=(e=>Boolean("object"==typeof e&&e.id&&e.multiaddrs)),e.exports=a},function(e,t,n){"use strict";var r=n(177),i=n(628);function o(){this.protocol=null,this.slashes=null,this.auth=null,this.host=null,this.port=null,this.hostname=null,this.hash=null,this.search=null,this.query=null,this.pathname=null,this.path=null,this.href=null}t.parse=w,t.resolve=E,t.resolveObject=S,t.format=k,t.Url=o;var s=/^([a-z0-9.+-]+:)/i,a=/:[0-9]*$/,l=/^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,u=["<",">",'"',"`"," ","\r","\n","\t"],c=["{","}","|","\\","^","`"].concat(u),h=["'"].concat(c),f=["%","/","?",";","#"].concat(h),p=["/","?","#"],d=255,m=/^[+a-z0-9A-Z_-]{0,63}$/,g=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,y={javascript:!0,"javascript:":!0},v={javascript:!0,"javascript:":!0},b={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},_=n(143);function w(e,t,n){if(e&&i.isObject(e)&&e instanceof o)return e;var r=new o;return r.parse(e,t,n),r}function k(e){return i.isString(e)&&(e=w(e)),e instanceof o?e.format():o.prototype.format.call(e)}function E(e,t){return w(e,!1,!0).resolve(t)}function S(e,t){return e?w(e,!1,!0).resolveObject(t):t}o.prototype.parse=function(e,t,n){if(!i.isString(e))throw new TypeError("Parameter 'url' must be a string, not "+typeof e);var o=e.indexOf("?"),a=-1!==o&&o127?P+="x":P+=O[N];if(!P.match(m)){var F=R.slice(0,C),M=R.slice(C+1),L=O.match(g);L&&(F.push(L[1]),M.unshift(L[2])),M.length&&(d="/"+M.join(".")+d),this.hostname=F.join(".");break}}}this.hostname.length>255?this.hostname="":this.hostname=this.hostname.toLowerCase(),j||(this.hostname=r.toASCII(this.hostname));var U=this.port?":"+this.port:"",q=this.hostname||"";this.host=q+U,this.href+=this.host,j&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),"/"!==d[0]&&(d="/"+d))}if(!y[E])for(var C=0,B=h.length;C0)&&n.host.split("@");x&&(n.auth=x.shift(),n.host=n.hostname=x.shift())}return n.search=e.search,n.query=e.query,i.isNull(n.pathname)&&i.isNull(n.search)||(n.path=(n.pathname?n.pathname:"")+(n.search?n.search:"")),n.href=n.format(),n}if(!E.length)return n.pathname=null,n.search?n.path="/"+n.search:n.path=null,n.href=n.format(),n;for(var C=E.slice(-1)[0],A=(n.host||e.host||E.length>1)&&("."===C||".."===C)||""===C,T=0,I=E.length;I>=0;I--)C=E[I],"."===C?E.splice(I,1):".."===C?(E.splice(I,1),T++):T&&(E.splice(I,1),T--);if(!w&&!k)for(;T--;T)E.unshift("..");!w||""===E[0]||E[0]&&"/"===E[0].charAt(0)||E.unshift(""),A&&"/"!==E.join("/").substr(-1)&&E.push("");var j=""===E[0]||E[0]&&"/"===E[0].charAt(0);if(S){n.hostname=n.host=j?"":E.length?E.shift():"";var x=!!(n.host&&n.host.indexOf("@")>0)&&n.host.split("@");x&&(n.auth=x.shift(),n.host=n.hostname=x.shift())}return w=w||n.host&&E.length,w&&!j&&E.unshift(""),E.length?n.pathname=E.join("/"):(n.pathname=null,n.path=null),i.isNull(n.pathname)&&i.isNull(n.search)||(n.path=(n.pathname?n.pathname:"")+(n.search?n.search:"")),n.auth=e.auth||n.auth,n.slashes=n.slashes||e.slashes,n.href=n.format(),n},o.prototype.parseHost=function(){var e=this.host,t=a.exec(e);t&&(t=t[0],":"!==t&&(this.port=t.substr(1)),e=e.substr(0,e.length-t.length)),e&&(this.hostname=e)}},function(e,t,n){"use strict";var r=n(183);e.exports=function e(t){return r(function(e,t){return e.push(t),e},[],t)}},function(e,t,n){"use strict";t.DAGNode=n(190),t.DAGLink=n(96),t.resolver=n(364),t.util=n(192)},function(e,t,n){e.exports={encode:n(671),decode:n(672),encodingLength:n(673)}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=l;var r=n(239),i=a(r),o=n(400),s=a(o);function a(e){return e&&e.__esModule?e:{default:e}}function l(e,t){(0,s.default)(i.default,e,t)}e.exports=t.default},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.isAsync=void 0;var r=n(640),i=o(r);function o(e){return e&&e.__esModule?e:{default:e}}var s="function"==typeof Symbol;function a(e){return s&&"AsyncFunction"===e[Symbol.toStringTag]}function l(e){return a(e)?(0,i.default)(e):e}t.default=l,t.isAsync=a},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=c;var r=n(239),i=u(r),o=n(331),s=u(o),a=n(37),l=u(a);function u(e){return e&&e.__esModule?e:{default:e}}function c(e,t,n){(0,i.default)(e,(0,s.default)((0,l.default)(t)),n)}e.exports=t.default},function(e,t,n){"use strict";function r(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}function i(e,{className:t,symbolName:n,withoutNew:r}){const i=Symbol.for(n),o={[t]:function(...t){if(r&&!(this instanceof o))return new o(...t);const n=e.call(this,...t)||this;return n&&!n[i]&&Object.defineProperty(n,i,{value:!0}),n}}[t];return o.prototype=Object.create(e.prototype),o.prototype.constructor=o,Object.defineProperty(o.prototype,Symbol.toStringTag,{get:()=>t}),o[`is${t}`]=(e=>!(!e||!e[i])),o}e.exports=r,e.exports.proto=i},function(e,t,n){"use strict";var r=n(341);e.exports=function e(t,n){if(!t)return function(e,t){return e?r(t,e,n):t(!0)};Array.isArray(t)||(t=Object.keys(t).map(function(e){return t[e]}));var i=0;return function(e,o){if(e)return r(o,e,n);i>=t.length?o(!0):o(null,t[i++])}}},function(e,t,n){(function(t){e.exports=g;var r=n(25),i=n(48),o=n(17),s=n(170),a=n(83),l=n(315).DiffieHellman,u=n(76),c=n(42),h=n(46),f;try{f=n(602)}catch(e){}var p=u.InvalidAlgorithmError,d=u.KeyParseError,m={};function g(e){r.object(e,"options"),r.arrayOfObject(e.parts,"options.parts"),r.string(e.type,"options.type"),r.optionalString(e.comment,"options.comment");var t=i.info[e.type];if("object"!=typeof t)throw new p(e.type);for(var n={},o=0,s;o1024&&(e="sha256"),"ed25519"===this.type&&(e="sha512"),"ecdsa"===this.type&&(e=this.size<=256?"sha256":this.size<=384?"sha384":"sha512"),e},g.prototype.createVerify=function(e){if(void 0===e&&(e=this.defaultHashAlgorithm()),r.string(e,"hash algorithm"),"ed25519"===this.type&&void 0!==f)return new f.Verifier(this,e);if("curve25519"===this.type)throw new Error("Curve25519 keys are not suitable for signing or verification");var n,i,s;try{i=e.toUpperCase(),n=o.createVerify(i)}catch(e){s=e}(void 0===n||s instanceof Error&&s.message.match(/Unknown message digest/))&&(i="RSA-",i+=e.toUpperCase(),n=o.createVerify(i)),r.ok(n,"failed to create verifier");var l=n.verify.bind(n),u=this.toBuffer("pkcs8"),c=this.curve,h=this;return n.verify=function(n,r){if(a.isSignature(n,[2,0]))return n.type===h.type&&((!n.hashAlgorithm||n.hashAlgorithm===e)&&((!n.curve||"ecdsa"!==h.type||n.curve===c)&&l(u,n.toBuffer("asn1"))));if("string"==typeof n||t.isBuffer(n))return l(u,n,r);throw a.isSignature(n,[1,0])?new Error("signature was created by too old a version of sshpk and cannot be verified"):new TypeError("signature must be a string, Buffer, or Signature object")},n},g.prototype.createDiffieHellman=function(){if("rsa"===this.type)throw new Error("RSA keys do not support Diffie-Hellman");return new l(this)},g.prototype.createDH=g.prototype.createDiffieHellman,g.parse=function(e,t,n){"string"!=typeof e&&r.buffer(e,"data"),void 0===t&&(t="auto"),r.string(t,"format"),"string"==typeof n&&(n={filename:n}),r.optionalObject(n,"options"),void 0===n&&(n={}),r.optionalString(n.filename,"options.filename"),void 0===n.filename&&(n.filename="(unnamed)"),r.object(m[t],"formats[format]");try{var i=m[t].read(e,n);return i instanceof h&&(i=i.toPublic()),i.comment||(i.comment=n.filename),i}catch(e){if("KeyEncryptedError"===e.name)throw e;throw new d(n.filename,t,e)}},g.isKey=function(e,t){return c.isCompatible(e,g,t)},g.prototype._sshpkApiVersion=[1,7],g._oldVersionDetect=function(e){return r.func(e.toBuffer),r.func(e.fingerprint),e.createDH?[1,4]:e.defaultHashAlgorithm?[1,3]:e.formats.auto?[1,2]:e.formats.pkcs1?[1,1]:[1,0]}}).call(this,n(0).Buffer)},function(e,t,n){e.exports={bufferSplit:w,addRSAMissing:B,calculateDSAPublic:I,calculateED25519Public:j,calculateX25519Public:R,mpNormalize:x,mpDenormalize:C,ecNormalize:k,countZeros:_,assertCompatible:m,isCompatible:d,opensslKeyDeriv:v,opensshCipherInfo:P,publicFromPrivateECDSA:O,zeroPadToLength:A,writeBitString:S,readBitString:E,pbkdf2:b};var r=n(25),i=n(29).Buffer,o=n(46),s=n(41),a=n(17),l=n(48),u=n(84),c=n(235),h=n(171).BigInteger,f=n(172),p=3;function d(e,t,n){if(null===e||"object"!=typeof e)return!1;if(void 0===n&&(n=t.prototype._sshpkApiVersion),e instanceof t&&t.prototype._sshpkApiVersion[0]==n[0])return!0;for(var r=Object.getPrototypeOf(e),i=0;r.constructor.name!==t.name;)if(r=Object.getPrototypeOf(r),!r||++i>p)return!1;if(r.constructor.name!==t.name)return!1;var o=r._sshpkApiVersion;return void 0===o&&(o=t._oldVersionDetect(e)),!(o[0]!=n[0]||o[1]=n[1],i+" must be compatible with "+t.name+" klass version "+n[0]+"."+n[1])}}var g={"des-ede3-cbc":{key:24,iv:8},"aes-128-cbc":{key:16,iv:16},"aes-256-cbc":{key:32,iv:16}},y=8;function v(e,t,n,o){r.buffer(t,"salt"),r.buffer(n,"passphrase"),r.number(o,"iteration count");var s=g[e],l,u,c;r.object(s,"supported cipher"),t=t.slice(0,y);for(var h=i.alloc(0);h.length=t.length){var a=s+1;n.push(e.slice(i,a-o)),i=a,o=0}return i<=e.length&&n.push(e.slice(i,e.length)),n}function k(e,t){if(r.buffer(e),0===e[0]&&4===e[1])return t?e:e.slice(1);if(4===e[0]){if(!t)return e}else{for(;0===e[0];)e=e.slice(1);if(2===e[0]||3===e[0])throw new Error("Compressed elliptic curve points are not supported");if(4!==e[0])throw new Error("Not a valid elliptic curve point");if(!t)return e}var n=i.alloc(e.length+1);return n[0]=0,e.copy(n,1),n}function E(e,t){void 0===t&&(t=u.Ber.BitString);var n=e.readString(t,!0);return r.strictEqual(n[0],0,"bit strings with unused bits are not supported (0x"+n[0].toString(16)+")"),n.slice(1)}function S(e,t,n){void 0===n&&(n=u.Ber.BitString);var r=i.alloc(t.length+1);r[0]=0,t.copy(r,1),e.writeBuffer(r,n)}function x(e){for(r.buffer(e);e.length>1&&0===e[0]&&0==(128&e[1]);)e=e.slice(1);if(128==(128&e[0])){var t=i.alloc(e.length+1);t[0]=0,e.copy(t,1),e=t}return e}function C(e){for(r.buffer(e);e.length>1&&0===e[0];)e=e.slice(1);return e}function A(e,t){for(r.buffer(e),r.number(t);e.length>t;)r.equal(e[0],0),e=e.slice(1);for(;e.length{i.digest(e,"sha2-256",t)}),t.convertPeerId=((e,t)=>{i.digest(e.id,"sha2-256",t)}),t.bufferToKey=(e=>new s("/"+t.encodeBase32(e),!1)),t.keyForPublicKey=(t=>e.concat([e.from("/pk/"),t.id])),t.isPublicKeyKey=(e=>"/pk/"===e.slice(0,4).toString()),t.fromPublicKeyKey=(e=>new f(e.slice(4))),t.now=(()=>Date.now()),t.encodeBase32=(e=>{const t=new a.Encoder;return t.write(e).finalize()}),t.decodeBase32=(t=>{const n=new a.Decoder;return e.from(n.write(t).finalize())}),t.sortClosestPeers=((e,n,r)=>{u(e,(e,r)=>{t.convertPeerId(e,(t,i)=>{if(t)return r(t);r(null,{peer:e,distance:l(i,n)})})},(e,n)=>{if(e)return r(e);r(null,n.sort(t.xorCompare).map(e=>e.peer))})}),t.xorCompare=((e,t)=>l.compare(e.distance,t.distance)),t.pathSize=((e,t)=>Math.ceil(e/t)),t.createPutRecord=((e,t,n)=>{const r=new Date,i=new c(e,t,r);h(()=>{n(null,i.serialize())})}),t.logger=((e,t)=>{const n=["libp2p","dht"];t&&n.push(t),e&&n.push(`${e.toB58String().slice(0,8)}`),r.formatters.b=(e=>o.toB58String(e));const i=r(n.join(":"));return i.error=r(n.concat(["error"]).join(":")),i})}).call(this,n(0).Buffer)},function(e,t,n){"use strict";const r=n(55),i=r(n(1108)),o=i.Data,s=["raw","directory","file","metadata","symlink","hamt-sharded-directory"],a=["directory","hamt-sharded-directory"];function l(e,t){if(!(this instanceof l))return new l(e,t);if(-1===s.indexOf(e))throw new Error("Type: "+e+" is not valid");this.type=e,this.data=t,this.blockSizes=[],this.addBlockSize=(e=>{this.blockSizes.push(e)}),this.removeBlockSize=(e=>{this.blockSizes.splice(e,1)}),this.fileSize=(()=>{if(a.indexOf(this.type)>=0)return;let e=0;return this.blockSizes.forEach(t=>{e+=t}),t&&(e+=t.length),e}),this.marshal=(()=>{let e;switch(this.type){case"raw":e=o.DataType.Raw;break;case"directory":e=o.DataType.Directory;break;case"file":e=o.DataType.File;break;case"metadata":e=o.DataType.Metadata;break;case"symlink":e=o.DataType.Symlink;break;case"hamt-sharded-directory":e=o.DataType.HAMTShard;break;default:throw new Error(`Unkown type: "${this.type}"`)}let t=this.fileSize(),n=this.data;this.data&&this.data.length||(n=void 0);let r=this.blockSizes;return this.blockSizes&&this.blockSizes.length||(r=void 0),o.encode({Type:e,Data:n,filesize:t,blocksizes:r,hashType:this.hashType,fanout:this.fanout})})}l.unmarshal=(e=>{const t=o.decode(e);t.Data||(t.Data=void 0);const n=new l(s[t.Type],t.Data);return n.blockSizes=t.blocksizes,n}),t=e.exports=l},function(e,t,n){e.exports=k;var r=n(25),i=n(29).Buffer,o=n(48),s=n(17),a=n(170),l=n(83),u=n(76),c=n(14),h=n(42),f=n(315),p=f.generateECDSA,d=f.generateED25519,m=n(602),g=n(172),y=n(41),v=u.InvalidAlgorithmError,b=u.KeyParseError,_=u.KeyEncryptedError,w={};function k(e){r.object(e,"options"),y.call(this,e),this._pubCache=void 0}w.auto=n(603),w.pem=n(92),w.pkcs1=n(316),w.pkcs8=n(174),w.rfc4253=n(93),w["ssh-private"]=n(236),w.openssh=w["ssh-private"],w.ssh=w["ssh-private"],w.dnssec=n(317),c.inherits(k,y),k.formats=w,k.prototype.toBuffer=function(e,t){return void 0===e&&(e="pkcs1"),r.string(e,"format"),r.object(w[e],"formats[format]"),r.optionalObject(t,"options"),w[e].write(this,t)},k.prototype.hash=function(e,t){return this.toPublic().hash(e,t)},k.prototype.fingerprint=function(e,t){return this.toPublic().fingerprint(e,t)},k.prototype.toPublic=function(){if(this._pubCache)return this._pubCache;for(var e=o.info[this.type],t=[],n=0;n0;return h(i,s,a,function(e){n||(n=e),e&&r.forEach(f),s||(r.forEach(f),t(n))})});return e.reduce(p)};e.exports=d}).call(this,n(2))},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){"string"!=typeof e&&(e+="");var t=0,n=-1,r=!0,i;for(i=e.length-1;i>=0;--i)if(47===e.charCodeAt(i)){if(!r){t=i+1;break}}else-1===n&&(r=!1,n=i+1);return-1===n?"":e.slice(t,n)}function i(e,t){if(e.filter)return e.filter(t);for(var n=[],r=0;r=-1&&!r;o--){var s=o>=0?arguments[o]:e.cwd();if("string"!=typeof s)throw new TypeError("Arguments to path.resolve must be strings");s&&(t=s+"/"+t,r="/"===s.charAt(0))}return t=n(i(t.split("/"),function(e){return!!e}),!r).join("/"),(r?"/":"")+t||"."},t.normalize=function(e){var r=t.isAbsolute(e),s="/"===o(e,-1);return e=n(i(e.split("/"),function(e){return!!e}),!r).join("/"),e||r||(e="."),e&&s&&(e+="/"),(r?"/":"")+e},t.isAbsolute=function(e){return"/"===e.charAt(0)},t.join=function(){var e=Array.prototype.slice.call(arguments,0);return t.normalize(i(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("/")),o=r(n.split("/")),s=Math.min(i.length,o.length),a=s,l=0;l=1;--o)if(t=e.charCodeAt(o),47===t){if(!i){r=o;break}}else i=!1;return-1===r?n?"/":".":n&&1===r?"/":e.slice(0,r)},t.basename=function(e,t){var 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,o=0,s=e.length-1;s>=0;--s){var a=e.charCodeAt(s);if(47!==a)-1===r&&(i=!1,r=s+1),46===a?-1===t?t=s:1!==o&&(o=1):-1!==t&&(o=-1);else if(!i){n=s+1;break}}return-1===t||-1===r||0===o||1===o&&t===r-1&&t===n+1?"":e.slice(t,r)};var o="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(2))},function(e,t,n){var r;!function(i){"use strict";var o,s=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator,l=Math.ceil,u=Math.floor,c="[BigNumber Error] ",h=c+"Number primitive has more than 15 significant digits: ",f=1e14,p=14,d=9007199254740991,m=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],g=1e7,y=1e9;function v(e){var t,n,r,i=H.prototype={constructor:H,toString:null,valueOf:null},o=new H(1),C=20,A=4,T=-7,I=21,j=-1e7,R=1e7,B=!1,O=1,P=0,N={prefix:"",groupSize:3,secondaryGroupSize:0,groupSeparator:",",decimalSeparator:".",fractionGroupSize:0,fractionGroupSeparator:" ",suffix:""},D="0123456789abcdefghijklmnopqrstuvwxyz",F,M,L,U,q,z,K;function H(e,t){var i,o,a,l,c,f,m,g,y=this;if(!(y instanceof H))return new H(e,t);if(null==t){if(e&&!0===e._isBigNumber)return y.s=e.s,void(!e.c||e.e>R?y.c=y.e=null:e.e=10;c/=10,l++);return void(l>R?y.c=y.e=null:(y.e=l,y.c=[e]))}g=String(e)}else{if(!s.test(g=String(e)))return r(y,g,f);y.s=45==g.charCodeAt(0)?(g=g.slice(1),-1):1}(l=g.indexOf("."))>-1&&(g=g.replace(".","")),(c=g.search(/e/i))>0?(l<0&&(l=c),l+=+g.slice(c+1),g=g.substring(0,c)):l<0&&(l=g.length)}else{if(k(t,2,D.length,"Base"),10==t)return y=new H(e),G(y,C+y.e+1,A);if(g=String(e),f="number"==typeof e){if(0*e!=0)return r(y,g,f,t);if(y.s=1/e<0?(g=g.slice(1),-1):1,H.DEBUG&&g.replace(/^0\.0*|\./,"").length>15)throw Error(h+e)}else y.s=45===g.charCodeAt(0)?(g=g.slice(1),-1):1;for(i=D.slice(0,t),l=c=0,m=g.length;cl){l=m;continue}}else if(!a&&(g==g.toUpperCase()&&(g=g.toLowerCase())||g==g.toLowerCase()&&(g=g.toUpperCase()))){a=!0,c=-1,l=0;continue}return r(y,String(e),f,t)}f=!1,g=n(g,t,10,y.s),(l=g.indexOf("."))>-1?g=g.replace(".",""):l=g.length}for(c=0;48===g.charCodeAt(c);c++);for(m=g.length;48===g.charCodeAt(--m););if(g=g.slice(c,++m)){if(m-=c,f&&H.DEBUG&&m>15&&(e>d||e!==u(e)))throw Error(h+y.s*e);if((l=l-c-1)>R)y.c=y.e=null;else if(l=I)?S(l,s):x(l,s,"0");else if(e=G(new H(e),t,n),o=e.e,l=_(e.c),a=l.length,1==r||2==r&&(t<=o||o<=T)){for(;aa){if(--t>0)for(l+=".";t--;l+="0");}else if(t+=o-a,t>0)for(o+1==a&&(l+=".");t--;l+="0");return e.s<0&&i?"-"+l:l}function $(e,t){for(var n,r=1,i=new H(e[0]);r=10;i/=10,r++);return(n=r+n*p-1)>R?e.c=e.e=null:n=10;a/=10,i++);if(o=t-i,o<0)o+=p,s=t,c=g[h=0],d=c/y[i-s-1]%10|0;else if(h=l((o+1)/p),h>=g.length){if(!r)break e;for(;g.length<=h;g.push(0));c=d=0,i=1,o%=p,s=o-p+1}else{for(c=a=g[h],i=1;a>=10;a/=10,i++);o%=p,s=o-p+i,d=s<0?0:c/y[i-s-1]%10|0}if(r=r||t<0||null!=g[h+1]||(s<0?c:c%y[i-s-1]),r=n<4?(d||r)&&(0==n||n==(e.s<0?3:2)):d>5||5==d&&(4==n||r||6==n&&(o>0?s>0?c/y[i-s]:0:g[h-1])%10&1||n==(e.s<0?8:7)),t<1||!g[0])return g.length=0,r?(t-=e.e+1,g[0]=y[(p-t%p)%p],e.e=-t||0):g[0]=e.e=0,e;if(0==o?(g.length=h,a=1,h--):(g.length=h+1,a=y[p-o],g[h]=s>0?u(c/y[i-s]%y[s])*a:0),r)for(;;){if(0==h){for(o=1,s=g[0];s>=10;s/=10,o++);for(s=g[0]+=a,a=1;s>=10;s/=10,a++);o!=a&&(e.e++,g[0]==f&&(g[0]=1));break}if(g[h]+=a,g[h]!=f)break;g[h--]=0,a=1}for(o=g.length;0===g[--o];g.pop());}e.e>R?e.c=e.e=null:e.e=I?S(t,n):x(t,n,"0"),e.s<0?"-"+t:t)}return H.clone=v,H.ROUND_UP=0,H.ROUND_DOWN=1,H.ROUND_CEIL=2,H.ROUND_FLOOR=3,H.ROUND_HALF_UP=4,H.ROUND_HALF_DOWN=5,H.ROUND_HALF_EVEN=6,H.ROUND_HALF_CEIL=7,H.ROUND_HALF_FLOOR=8,H.EUCLID=9,H.config=H.set=function(e){var t,n;if(null!=e){if("object"!=typeof e)throw Error(c+"Object expected: "+e);if(e.hasOwnProperty(t="DECIMAL_PLACES")&&(n=e[t],k(n,0,y,t),C=n),e.hasOwnProperty(t="ROUNDING_MODE")&&(n=e[t],k(n,0,8,t),A=n),e.hasOwnProperty(t="EXPONENTIAL_AT")&&(n=e[t],n&&n.pop?(k(n[0],-y,0,t),k(n[1],0,y,t),T=n[0],I=n[1]):(k(n,-y,y,t),T=-(I=n<0?-n:n))),e.hasOwnProperty(t="RANGE"))if(n=e[t],n&&n.pop)k(n[0],-y,-1,t),k(n[1],1,y,t),j=n[0],R=n[1];else{if(k(n,-y,y,t),!n)throw Error(c+t+" cannot be zero: "+n);j=-(R=n<0?-n:n)}if(e.hasOwnProperty(t="CRYPTO")){if(n=e[t],n!==!!n)throw Error(c+t+" not true or false: "+n);if(n){if("undefined"==typeof crypto||!crypto||!crypto.getRandomValues&&!crypto.randomBytes)throw B=!n,Error(c+"crypto unavailable");B=n}else B=n}if(e.hasOwnProperty(t="MODULO_MODE")&&(n=e[t],k(n,0,9,t),O=n),e.hasOwnProperty(t="POW_PRECISION")&&(n=e[t],k(n,0,y,t),P=n),e.hasOwnProperty(t="FORMAT")){if(n=e[t],"object"!=typeof n)throw Error(c+t+" not an object: "+n);N=n}if(e.hasOwnProperty(t="ALPHABET")){if(n=e[t],"string"!=typeof n||/^.$|[+-.\s]|(.).*\1/.test(n))throw Error(c+t+" invalid: "+n);D=n}}return{DECIMAL_PLACES:C,ROUNDING_MODE:A,EXPONENTIAL_AT:[T,I],RANGE:[j,R],CRYPTO:B,MODULO_MODE:O,POW_PRECISION:P,FORMAT:N,ALPHABET:D}},H.isBigNumber=function(e){if(!e||!0!==e._isBigNumber)return!1;if(!H.DEBUG)return!0;var t,n,r=e.c,i=e.e,o=e.s;e:if("[object Array]"=={}.toString.call(r)){if((1===o||-1===o)&&i>=-y&&i<=y&&i===u(i)){if(0===r[0]){if(0===i&&1===r.length)return!0;break e}if(t=(i+1)%p,t<1&&(t+=p),String(r[0]).length==t){for(t=0;t=f||n!==u(n))break e;if(0!==n)return!0}}}else if(null===r&&null===i&&(null===o||1===o||-1===o))return!0;throw Error(c+"Invalid BigNumber: "+e)},H.maximum=H.max=function(){return $(arguments,i.lt)},H.minimum=H.min=function(){return $(arguments,i.gt)},H.random=(F=9007199254740992,M=Math.random()*F&2097151?function(){return u(Math.random()*F)}:function(){return 8388608*(1073741824*Math.random()|0)+(8388608*Math.random()|0)},function(e){var t,n,r,i,s,a=0,h=[],f=new H(o);if(null==e?e=C:k(e,0,y),i=l(e/p),B)if(crypto.getRandomValues){for(t=crypto.getRandomValues(new Uint32Array(i*=2));a>>11),s>=9e15?(n=crypto.getRandomValues(new Uint32Array(2)),t[a]=n[0],t[a+1]=n[1]):(h.push(s%1e14),a+=2);a=i/2}else{if(!crypto.randomBytes)throw B=!1,Error(c+"crypto unavailable");for(t=crypto.randomBytes(i*=7);a=9e15?crypto.randomBytes(7).copy(t,a):(h.push(s%1e14),a+=7);a=i/7}if(!B)for(;a=10;s/=10,a++);an-1&&(null==o[i+1]&&(o[i+1]=0),o[i+1]+=o[i]/n|0,o[i]%=n)}return o.reverse()}return function(r,i,o,s,a){var l,u,c,h,f,p,d,m,g=r.indexOf("."),y=C,v=A;for(g>=0&&(h=P,P=0,r=r.replace(".",""),m=new H(i),p=m.pow(r.length-g),P=h,m.c=n(x(_(p.c),p.e,"0"),10,o,e),m.e=m.c.length),d=n(r,i,o,a?(l=D,e):(l=e,D)),c=h=d.length;0==d[--h];d.pop());if(!d[0])return l.charAt(0);if(g<0?--c:(p.c=d,p.e=c,p.s=s,p=t(p,m,y,v,o),d=p.c,f=p.r,c=p.e),u=c+y+1,g=d[u],h=o/2,f=f||u<0||null!=d[u+1],f=v<4?(null!=g||f)&&(0==v||v==(p.s<0?3:2)):g>h||g==h&&(4==v||f||6==v&&1&d[u-1]||v==(p.s<0?8:7)),u<1||!d[0])r=f?x(l.charAt(1),-y,l.charAt(0)):l.charAt(0);else{if(d.length=u,f)for(--o;++d[--u]>o;)d[u]=0,u||(++c,d=[1].concat(d));for(h=d.length;!d[--h];);for(g=0,r="";g<=h;r+=l.charAt(d[g++]));r=x(r,c,l.charAt(0))}return r}}(),t=function(){function e(e,t,n){var r,i,o,s,a=0,l=e.length,u=t%g,c=t/g|0;for(e=e.slice();l--;)o=e[l]%g,s=e[l]/g|0,r=c*o+s*u,i=u*o+r%g*g+a,a=(i/n|0)+(r/g|0)+c*s,e[l]=i%n;return a&&(e=[a].concat(e)),e}function t(e,t,n,r){var i,o;if(n!=r)o=n>r?1:-1;else for(i=o=0;it[i]?1:-1;break}return o}function n(e,t,n,r){for(var i=0;n--;)e[n]-=i,i=e[n]1;e.splice(0,1));}return function(r,i,o,s,a){var l,c,h,d,m,g,y,v,_,w,k,E,S,x,C,A,T,I=r.s==i.s?1:-1,j=r.c,R=i.c;if(!(j&&j[0]&&R&&R[0]))return new H(r.s&&i.s&&(j?!R||j[0]!=R[0]:R)?j&&0==j[0]||!R?0*I:I/0:NaN);for(v=new H(I),_=v.c=[],c=r.e-i.e,I=o+c+1,a||(a=f,c=b(r.e/p)-b(i.e/p),I=I/p|0),h=0;R[h]==(j[h]||0);h++);if(R[h]>(j[h]||0)&&c--,I<0)_.push(1),d=!0;else{for(x=j.length,A=R.length,h=0,I+=2,m=u(a/(R[0]+1)),m>1&&(R=e(R,m,a),j=e(j,m,a),A=R.length,x=j.length),S=A,w=j.slice(0,A),k=w.length;k=a/2&&C++;do{if(m=0,l=t(R,w,A,k),l<0){if(E=w[0],A!=k&&(E=E*a+(w[1]||0)),m=u(E/C),m>1)for(m>=a&&(m=a-1),g=e(R,m,a),y=g.length,k=w.length;1==t(g,w,y,k);)m--,n(g,A=10;I/=10,h++);G(v,o+(v.e=h+c*p-1)+1,s,d)}else v.e=c,v.r=+d;return v}}(),L=/^(-?)0([xbo])(?=\w[\w.]*$)/i,U=/^([^.]+)\.$/,q=/^\.([^.]+)$/,z=/^-?(Infinity|NaN)$/,K=/^\s*\+(?=[\w.])|^\s+|\s+$/g,r=function(e,t,n,r){var i,o=n?t:t.replace(K,"");if(z.test(o))e.s=isNaN(o)?null:o<0?-1:1;else{if(!n&&(o=o.replace(L,function(e,t,n){return i="x"==(n=n.toLowerCase())?16:"b"==n?2:8,r&&r!=i?e:t}),r&&(i=r,o=o.replace(U,"$1").replace(q,"0.$1")),t!=o))return new H(o,i);if(H.DEBUG)throw Error(c+"Not a"+(r?" base "+r:"")+" number: "+t);e.s=null}e.c=e.e=null},i.absoluteValue=i.abs=function(){var e=new H(this);return e.s<0&&(e.s=1),e},i.comparedTo=function(e,t){return w(this,new H(e,t))},i.decimalPlaces=i.dp=function(e,t){var n,r,i,o=this;if(null!=e)return k(e,0,y),null==t?t=A:k(t,0,8),G(new H(o),e+o.e+1,t);if(!(n=o.c))return null;if(r=((i=n.length-1)-b(this.e/p))*p,i=n[i])for(;i%10==0;i/=10,r--);return r<0&&(r=0),r},i.dividedBy=i.div=function(e,n){return t(this,new H(e,n),C,A)},i.dividedToIntegerBy=i.idiv=function(e,n){return t(this,new H(e,n),0,1)},i.exponentiatedBy=i.pow=function(e,t){var n,r,i,s,a,h,f,d,m,g=this;if(e=new H(e),e.c&&!e.isInteger())throw Error(c+"Exponent not an integer: "+Y(e));if(null!=t&&(t=new H(t)),h=e.e>14,!g.c||!g.c[0]||1==g.c[0]&&!g.e&&1==g.c.length||!e.c||!e.c[0])return m=new H(Math.pow(+Y(g),h?2-E(e):+Y(e))),t?m.mod(t):m;if(f=e.s<0,t){if(t.c?!t.c[0]:!t.s)return new H(NaN);r=!f&&g.isInteger()&&t.isInteger(),r&&(g=g.mod(t))}else{if(e.e>9&&(g.e>0||g.e<-1||(0==g.e?g.c[0]>1||h&&g.c[1]>=24e7:g.c[0]<8e13||h&&g.c[0]<=9999975e7)))return s=g.s<0&&E(e)?-0:0,g.e>-1&&(s=1/s),new H(f?1/s:s);P&&(s=l(P/p+2))}for(h?(n=new H(.5),f&&(e.s=1),d=E(e)):(i=Math.abs(+Y(e)),d=i%2),m=new H(o);;){if(d){if(m=m.times(g),!m.c)break;s?m.c.length>s&&(m.c.length=s):r&&(m=m.mod(t))}if(i){if(i=u(i/2),0===i)break;d=i%2}else if(e=e.times(n),G(e,e.e+1,1),e.e>14)d=E(e);else{if(i=+Y(e),0===i)break;d=i%2}g=g.times(g),s?g.c&&g.c.length>s&&(g.c.length=s):r&&(g=g.mod(t))}return r?m:(f&&(m=o.div(m)),t?m.mod(t):s?G(m,P,A,a):m)},i.integerValue=function(e){var t=new H(this);return null==e?e=A:k(e,0,8),G(t,t.e+1,e)},i.isEqualTo=i.eq=function(e,t){return 0===w(this,new H(e,t))},i.isFinite=function(){return!!this.c},i.isGreaterThan=i.gt=function(e,t){return w(this,new H(e,t))>0},i.isGreaterThanOrEqualTo=i.gte=function(e,t){return 1===(t=w(this,new H(e,t)))||0===t},i.isInteger=function(){return!!this.c&&b(this.e/p)>this.c.length-2},i.isLessThan=i.lt=function(e,t){return w(this,new H(e,t))<0},i.isLessThanOrEqualTo=i.lte=function(e,t){return-1===(t=w(this,new H(e,t)))||0===t},i.isNaN=function(){return!this.s},i.isNegative=function(){return this.s<0},i.isPositive=function(){return this.s>0},i.isZero=function(){return!!this.c&&0==this.c[0]},i.minus=function(e,t){var n,r,i,o,s=this,a=s.s;if(e=new H(e,t),t=e.s,!a||!t)return new H(NaN);if(a!=t)return e.s=-t,s.plus(e);var l=s.e/p,u=e.e/p,c=s.c,h=e.c;if(!l||!u){if(!c||!h)return c?(e.s=-t,e):new H(h?s:NaN);if(!c[0]||!h[0])return h[0]?(e.s=-t,e):new H(c[0]?s:3==A?-0:0)}if(l=b(l),u=b(u),c=c.slice(),a=l-u){for((o=a<0)?(a=-a,i=c):(u=l,i=h),i.reverse(),t=a;t--;i.push(0));i.reverse()}else for(r=(o=(a=c.length)<(t=h.length))?a:t,a=t=0;t0)for(;t--;c[n++]=0);for(t=f-1;r>a;){if(c[--r]=0;){for(n=0,d=E[i]%_,m=E[i]/_|0,s=l,o=i+s;o>i;)u=k[--s]%_,c=k[s]/_|0,a=m*u+c*d,u=d*u+a%_*_+y[o]+n,n=(u/v|0)+(a/_|0)+m*c,y[o--]=u%v;y[o]=n}return n?++r:y.splice(0,1),W(e,y,r)},i.negated=function(){var e=new H(this);return e.s=-e.s||null,e},i.plus=function(e,t){var n,r=this,i=r.s;if(e=new H(e,t),t=e.s,!i||!t)return new H(NaN);if(i!=t)return e.s=-t,r.minus(e);var o=r.e/p,s=e.e/p,a=r.c,l=e.c;if(!o||!s){if(!a||!l)return new H(i/0);if(!a[0]||!l[0])return l[0]?e:new H(a[0]?r:0*i)}if(o=b(o),s=b(s),a=a.slice(),i=o-s){for(i>0?(s=o,n=l):(i=-i,n=a),n.reverse();i--;n.push(0));n.reverse()}for(i=a.length,t=l.length,i-t<0&&(n=l,l=a,a=n,t=i),i=0;t;)i=(a[--t]=a[t]+l[t]+i)/f|0,a[t]=f===a[t]?0:a[t]%f;return i&&(a=[i].concat(a),++s),W(e,a,s)},i.precision=i.sd=function(e,t){var n,r,i,o=this;if(null!=e&&e!==!!e)return k(e,1,y),null==t?t=A:k(t,0,8),G(new H(o),e,t);if(!(n=o.c))return null;if(i=n.length-1,r=i*p+1,i=n[i]){for(;i%10==0;i/=10,r--);for(i=n[0];i>=10;i/=10,r++);}return e&&o.e+1>r&&(r=o.e+1),r},i.shiftedBy=function(e){return k(e,-d,d),this.times("1e"+e)},i.squareRoot=i.sqrt=function(){var e,n,r,i,o,s=this,a=s.c,l=s.s,u=s.e,c=C+4,h=new H("0.5");if(1!==l||!a||!a[0])return new H(!l||l<0&&(!a||a[0])?NaN:a?s:1/0);if(l=Math.sqrt(+Y(s)),0==l||l==1/0?(n=_(a),(n.length+u)%2==0&&(n+="0"),l=Math.sqrt(+n),u=b((u+1)/2)-(u<0||u%2),l==1/0?n="1e"+u:(n=l.toExponential(),n=n.slice(0,n.indexOf("e")+1)+u),r=new H(n)):r=new H(l+""),r.c[0])for(u=r.e,l=u+c,l<3&&(l=0);;)if(o=r,r=h.times(o.plus(t(s,o,c,1))),_(o.c).slice(0,l)===(n=_(r.c)).slice(0,l)){if(r.e0&&m>0){for(o=m%a||a,h=d.substr(0,o);o0&&(h+=u+d.slice(o)),p&&(h="-"+h)}r=f?h+(n.decimalSeparator||"")+((l=+n.fractionGroupSize)?f.replace(new RegExp("\\d{"+l+"}\\B","g"),"$&"+(n.fractionGroupSeparator||"")):f):h}return(n.prefix||"")+r+(n.suffix||"")},i.toFraction=function(e){var n,r,i,s,a,l,u,h,f,d,g,y,v=this,b=v.c;if(null!=e&&(u=new H(e),!u.isInteger()&&(u.c||1!==u.s)||u.lt(o)))throw Error(c+"Argument "+(u.isInteger()?"out of range: ":"not an integer: ")+Y(u));if(!b)return new H(v);for(n=new H(o),f=r=new H(o),i=h=new H(o),y=_(b),a=n.e=y.length-v.e-1,n.c[0]=m[(l=a%p)<0?p+l:l],e=!e||u.comparedTo(n)>0?a>0?n:f:u,l=R,R=1/0,u=new H(y),h.c[0]=0;d=t(u,n,0,1),s=r.plus(d.times(i)),1!=s.comparedTo(e);)r=i,i=s,f=h.plus(d.times(s=f)),h=s,n=u.minus(d.times(s=n)),u=s;return s=t(e.minus(r),i,0,1),h=h.plus(s.times(f)),r=r.plus(s.times(i)),h.s=f.s=v.s,a*=2,g=t(f,i,a,A).minus(v).abs().comparedTo(t(h,r,a,A).minus(v).abs())<1?[f,i]:[h,r],R=l,g},i.toNumber=function(){return+Y(this)},i.toPrecision=function(e,t){return null!=e&&k(e,1,y),V(this,e,t,2)},i.toString=function(e){var t,r=this,i=r.s,o=r.e;return null===o?i?(t="Infinity",i<0&&(t="-"+t)):t="NaN":(null==e?t=o<=T||o>=I?S(_(r.c),o):x(_(r.c),o,"0"):10===e?(r=G(new H(r),C+o+1,A),t=x(_(r.c),r.e,"0")):(k(e,2,D.length,"Base"),t=n(x(_(r.c),o,"0"),10,e,i,!0)),i<0&&r.c[0]&&(t="-"+t)),t},i.valueOf=i.toJSON=function(){return Y(this)},i._isBigNumber=!0,a&&(i[Symbol.toStringTag]="BigNumber",i[Symbol.for("nodejs.util.inspect.custom")]=i.valueOf),null!=e&&H.set(e),H}function b(e){var t=0|e;return e>0||e===t?t:t-1}function _(e){for(var t,n,r=1,i=e.length,o=e[0]+"";ru^n?1:-1;for(a=(l=i.length)<(u=o.length)?l:u,s=0;so[s]^n?1:-1;return l==u?0:l>u^n?1:-1}function k(e,t,n,r){if(en||e!==u(e))throw Error(c+(r||"Argument")+("number"==typeof e?en?" out of range: ":" not an integer: ":" not a primitive number: ")+String(e))}function E(e){var t=e.c.length-1;return b(e.e/p)==t&&e.c[t]%2!=0}function S(e,t){return(e.length>1?e.charAt(0)+"."+e.slice(1):e)+(t<0?"e":"e+")+t}function x(e,t,n){var r,i;if(t<0){for(i=n+".";++t;i+=n);e=i+e}else if(r=e.length,++t>r){for(i=n,t-=r;--t;i+=n);e+=i}else t{if(e)return i(e);i(null,r.encode(o,t,n))})}e.exports=o,o.Buffer=t,o.multihash=r,o.digest=function(e,t,n,r){if("function"==typeof n&&(r=n,n=void 0),!r)throw new Error("Missing callback");let i=r,s;n&&(i=((e,t)=>{if(e)return r(e);r(null,t.slice(0,n))}));try{s=o.createHash(t)}catch(e){return i(e)}s(e,i)},o.createHash=function(e){if(e=r.coerceCode(e),!o.functions[e])throw new Error("multihash function "+e+" not yet supported");return o.functions[e]},o.functions={17:i.sha1,18:i.sha2256,19:i.sha2512,20:i.sha3512,21:i.sha3384,22:i.sha3256,23:i.sha3224,24:i.shake128,25:i.shake256,26:i.keccak224,27:i.keccak256,28:i.keccak384,29:i.keccak512,34:i.murmur3128,35:i.murmur332,86:i.dblSha2256},i.addBlake(o.functions)}).call(this,n(0).Buffer)},function(e,t,n){"use strict";(function(t){var r=n(717),i=n(721),o=function(e){if(!e)return null;var t={};return Object.keys(e).forEach(function(n){t[n]=e[n].value}),t};e.exports=function(e,n){if(n||(n={}),!e)throw new Error("Pass in a .proto string or a protobuf-schema parsed object");var s="object"!=typeof e||t.isBuffer(e)?r.parse(e):e,a=function(){var e=this;i(s,n.encodings||{}).forEach(function(t){e[t.name]=o(t.values)||t})};return a.prototype.toString=function(){return r.stringify(s)},a.prototype.toJSON=function(){return s},new a}}).call(this,n(0).Buffer)},function(e,t){var n={}.toString;e.exports=Array.isArray||function(e){return"[object Array]"==n.call(e)}},function(e,t){function n(){}e.exports=n},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(110),i=a(r),o=n(332),s=a(o);function a(e){return e&&e.__esModule?e:{default:e}}t.default=(0,i.default)(s.default),e.exports=t.default},function(e,t,n){(function(t){function n(e,t){if(r("noDeprecation"))return e;var n=!1;function i(){if(!n){if(r("throwDeprecation"))throw new Error(t);r("traceDeprecation")?console.trace(t):console.warn(t),n=!0}return e.apply(this,arguments)}return i}function r(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=n}).call(this,n(7))},function(e,t,n){"use strict";(function(r){const i=n(674);t=e.exports=s,t.encode=a,t.decode=l,t.isEncoded=u,t.names=Object.freeze(Object.keys(i.names)),t.codes=Object.freeze(Object.keys(i.codes));const o=new Error("Unsupported encoding");function s(e,t){if(!t)throw new Error("requires an encoded buffer");const n=h(e),i=r.from(n.code),o=n.name;return c(o,t),r.concat([i,t])}function a(e,t){const n=h(e),i=n.name;return s(i,r.from(n.encode(t)))}function l(e){r.isBuffer(e)&&(e=e.toString());const t=e.substring(0,1);e=e.substring(1,e.length),"string"==typeof e&&(e=r.from(e));const n=h(t);return r.from(n.decode(e.toString()))}function u(e){if(r.isBuffer(e)&&(e=e.toString()),"[object String]"!==Object.prototype.toString.call(e))return!1;const t=e.substring(0,1);try{const e=h(t);return e.name}catch(e){return!1}}function c(e,t){const n=h(e);n.decode(t.toString())}function h(e){let t;if(i.names[e])t=i.names[e];else{if(!i.codes[e])throw o;t=i.codes[e]}if(!t.isImplemented())throw new Error("Base "+e+" is not implemented yet");return t}}).call(this,n(0).Buffer)},function(e,t,n){t.source=n(186),t.through=n(697),t.sink=n(346),t.duplex=n(347)},function(e,t,n){e.exports=o;var r=n(6).EventEmitter,i=n(3);function o(){r.call(this)}i(o,r),o.Readable=n(256),o.Writable=n(774),o.Duplex=n(775),o.Transform=n(776),o.PassThrough=n(777),o.Stream=o,o.prototype.pipe=function(e,t){var n=this;function i(t){e.writable&&!1===e.write(t)&&n.pause&&n.pause()}function o(){n.readable&&n.resume&&n.resume()}n.on("data",i),e.on("drain",o),e._isStdio||t&&!1===t.end||(n.on("end",a),n.on("close",l));var s=!1;function a(){s||(s=!0,e.end())}function l(){s||(s=!0,"function"==typeof e.destroy&&e.destroy())}function u(e){if(c(),0===r.listenerCount(this,"error"))throw e}function c(){n.removeListener("data",i),e.removeListener("drain",o),n.removeListener("end",a),n.removeListener("close",l),n.removeListener("error",u),e.removeListener("error",u),n.removeListener("end",c),n.removeListener("close",c),e.removeListener("close",c)}return n.on("error",u),e.on("error",u),n.on("end",c),n.on("close",c),e.on("close",c),e.emit("pipe",n),e}},function(e,t){function n(e,t){"function"==typeof e&&(t=e,e=!1);var n=[],r,i,o;function s(e,t){e&&(r=e,i&&c(r)),i=t,u()}function a(e){o=o||e||!0,u()}function l(e){o||(i?c(r,e):n.push(e))}return e?{push:l,end:a,source:s,buffer:n}:(s.push=l,s.end=a,s.buffer=n,s);function u(){i&&(r?c(r):!n.length&&o?c(o):n.length&&c(null,n.shift()))}function c(e,n){var r=i;if(e&&t){var o=t;t=null,o(!0===e?null:e)}i=null,r(e,n)}}e.exports=n},function(e,t,n){"use strict";t.Connection=n(927)},function(e,t){var n=Array.isArray;e.exports=n},function(e,t,n){"use strict";function r(e){return e}var i=n(149);e.exports=function e(t){return t?(t=i(t),function(e){return function(n,r){e(n,function(n,i){try{i=n?null:t(i)}catch(t){return e(t,function(){return r(t)})}r(n,i)})}}):r}},function(e,t,n){"use strict";var r=n(343);e.exports=function e(t){return t=r(t),function(e){return function n(r,i){for(var o,s=!0;s;)s=!1,o=!0,e(r,function(e,r){if(!e&&!t(r))return o?s=!0:n(e,i);i(e,r)}),o=!1}}}},function(e,t){e.exports=r;var n=Object.prototype.hasOwnProperty;function r(){for(var e={},t=0;tT(A(k,E),k),S=E(),x=T(A(S,w,S),A(w,S),A(S,w),S,w);function C(e){return function t(n){if(!r.isMultiaddr(n))try{n=r(n)}catch(e){return!1}let i=e(n.protoNames());return null!==i&&0===i.length}}function A(){const e=Array.from(arguments);function t(t){return t.length{if(t="function"==typeof e?e().partialMatch(t):e.partialMatch(t),null===t)return!0}),t)}return{toString:function(){return"{ "+e.join(" ")+" }"},input:e,matches:C(t),partialMatch:t}}function T(){const e=Array.from(arguments);function t(t){let n=null;return e.some(e=>{const r="function"==typeof e?e().partialMatch(t):e.partialMatch(t);if(r)return n=r,!0}),n}const n={toString:function(){return"{ "+e.join(" ")+" }"},input:e,matches:C(t),partialMatch:t};return n}function I(e){const t=e;function n(e){if("string"==typeof e)try{e=r(e)}catch(e){return!1}const n=e.protoNames();return 1===n.length&&n[0]===t}function i(e){return 0===e.length?null:e[0]===t?e.slice(1):null}return{toString:function(){return t},matches:n,partialMatch:i}}t.DNS=h,t.DNS4=i,t.DNS6=o,t.IP=a,t.TCP=l,t.UDP=u,t.UTP=c,t.HTTP=d,t.HTTPS=m,t.WebSockets=f,t.WebSocketsSecure=p,t.WebSocketStar=y,t.WebRTCStar=g,t.WebRTCDirect=v,t.Reliable=b,t.Stardust=_,t.Circuit=S,t.IPFS=x},function(e,t,n){"use strict";const r=n(225);e.exports={addLink:n(488),countStreamBytes:n(1185),createLock:n(1186),createNode:n(1202),formatCid:n(1203),limitStreamBytes:n(1204),loadNode:n(1205),removeLink:n(1206),toMfsPath:n(493),toPathComponents:n(293),toPullSource:n(1207),toSourcesAndDestination:n(1216),toSources:n(502),toTrail:n(1217),updateMfsRoot:n(1218),updateTree:n(1219),withMfsRoot:n(494),zeros:n(1222),FILE_SEPARATOR:r.FILE_SEPARATOR,MAX_CHUNK_SIZE:r.MAX_CHUNK_SIZE,MAX_LINKS:r.MAX_LINKS,FILE_TYPES:r.FILE_TYPES}},function(e,t,n){"use strict";function r(e){return e}var i=n(149);e.exports=function e(t){if(!t)return r;t=i(t);var n=!1,o,s;return function(e){return function r(i,a){if(s)return a(s);i?(s=i,e(i,n?function(e){n?o=a:a(i)}:function(e){a(i)})):e(null,function(e,i){e?a(e):s?a(s):(n=!0,t(i,function(e,t){n=!1,s?(a(s),o&&o(s)):e?r(e,a):a(null,t)}))})}}}},function(e,t,n){"use strict";(function(t){const r=n(70),i=n(27),o=n(60),s=n(9),a=/^https?:\/\/[^/]+\/(ip(f|n)s)\/((\w+).*)/,l=/^\/(ip(f|n)s)\/((\w+).*)/,u=1,c=4,h=/^https?:\/\/([^/]+)\.(ip(?:f|n)s)\.[^/]+/,f=1,p=2;function d(e){const n=b(e);try{const e=t.from(r.decode(n));return i.decode(e),!0}catch(e){return!1}}function m(e){try{return o.isEncoded(e)}catch(e){return!1}}function g(e){try{return s.isCID(new s(e))}catch(e){return!1}}function y(e,t,n=u,r=c){const i=b(e);if(!i)return!1;const o=i.match(t);if(!o)return!1;if("ipfs"!==o[n])return!1;let s=o[r];return s&&t===h&&(s=s.toLowerCase()),g(s)}function v(e,t,n=u,r){const i=b(e);if(!i)return!1;const o=i.match(t);if(!o)return!1;if("ipns"!==o[n])return!1;if(r&&t===h){let e=o[r];return e=e.toLowerCase(),g(e)}return!0}function b(e){return t.isBuffer(e)?r.encode(e):"string"==typeof e&&e}const _=e=>y(e,h,2,1),w=e=>v(e,h,2,1);e.exports={multihash:d,cid:g,base32cid:e=>"base32"===m(e)&&g(e),ipfsSubdomain:_,ipnsSubdomain:w,subdomain:e=>_(e)||w(e),subdomainPattern:h,ipfsUrl:e=>y(e,a),ipnsUrl:e=>v(e,a),url:e=>y(e,a)||v(e,a),urlPattern:a,ipfsPath:e=>y(e,l),ipnsPath:e=>v(e,l),path:e=>y(e,l)||v(e,l),pathPattern:l,urlOrPath:e=>y(e,a)||v(e,a)||y(e,l)||v(e,l)}}).call(this,n(0).Buffer)},function(e,t,n){var r=n(25),i=n(14);function o(e,t){Error.captureStackTrace&&Error.captureStackTrace(this,o),this.name="FingerprintFormatError",this.fingerprint=e,this.format=t,this.message="Fingerprint format is not supported, or is invalid: ",void 0!==e&&(this.message+=" fingerprint = "+e),void 0!==t&&(this.message+=" format = "+t)}function s(e){Error.captureStackTrace&&Error.captureStackTrace(this,s),this.name="InvalidAlgorithmError",this.algorithm=e,this.message='Algorithm "'+e+'" is not supported'}function a(e,t,n){Error.captureStackTrace&&Error.captureStackTrace(this,a),this.name="KeyParseError",this.format=t,this.keyName=e,this.innerErr=n,this.message="Failed to parse "+e+" as a valid "+t+" format key: "+n.message}function l(e,t,n){Error.captureStackTrace&&Error.captureStackTrace(this,l),this.name="SignatureParseError",this.type=e,this.format=t,this.innerErr=n,this.message="Failed to parse the given data as a "+e+" signature in "+t+" format: "+n.message}function u(e,t,n){Error.captureStackTrace&&Error.captureStackTrace(this,u),this.name="CertificateParseError",this.format=t,this.certName=e,this.innerErr=n,this.message="Failed to parse "+e+" as a valid "+t+" format certificate: "+n.message}function c(e,t){Error.captureStackTrace&&Error.captureStackTrace(this,c),this.name="KeyEncryptedError",this.format=t,this.keyName=e,this.message="The "+t+" format key "+e+" is encrypted (password-protected), and no passphrase was provided in `options`"}i.inherits(o,Error),i.inherits(s,Error),i.inherits(a,Error),i.inherits(l,Error),i.inherits(u,Error),i.inherits(c,Error),e.exports={FingerprintFormatError:o,InvalidAlgorithmError:s,KeyParseError:a,SignatureParseError:l,KeyEncryptedError:c,CertificateParseError:u}},function(e,t){errors={};class n extends Error{constructor(e){super(e||"Coding Error"),this.name="CodingError"}}errors.CodingError=n;class r extends Error{constructor(e){super("To be implemented: "+e),this.name="ToBeImplementedError"}}errors.ToBeImplementedError=r;class i extends Error{constructor(e){super(e||"Transport failure"),this.name="TransportError"}}errors.TransportError=i;class o extends Error{constructor(e){super(e||"Timed out"),this.name="TimeoutError"}}errors.TimeoutError=o;class s extends Error{constructor(e){super(e||"Intentionally Unimplemented Function"),this.name="IntentionallyUnimplementedError"}}errors.IntentionallyUnimplementedError=s,t=e.exports=errors},function(e,t){var n=1e3,r=60*n,i=60*r,o=24*i,s=7*o,a=365.25*o;function l(e){if(e=String(e),!(e.length>100)){var t=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(e);if(t){var l=parseFloat(t[1]),u=(t[2]||"ms").toLowerCase();switch(u){case"years":case"year":case"yrs":case"yr":case"y":return l*a;case"weeks":case"week":case"w":return l*s;case"days":case"day":case"d":return l*o;case"hours":case"hour":case"hrs":case"hr":case"h":return l*i;case"minutes":case"minute":case"mins":case"min":case"m":return l*r;case"seconds":case"second":case"secs":case"sec":case"s":return l*n;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return l;default:return}}}}function u(e){var t=Math.abs(e);return t>=o?Math.round(e/o)+"d":t>=i?Math.round(e/i)+"h":t>=r?Math.round(e/r)+"m":t>=n?Math.round(e/n)+"s":e+"ms"}function c(e){var t=Math.abs(e);return t>=o?h(e,t,o,"day"):t>=i?h(e,t,i,"hour"):t>=r?h(e,t,r,"minute"):t>=n?h(e,t,n,"second"):e+" ms"}function h(e,t,n,r){var i=t>=1.5*n;return Math.round(e/n)+" "+r+(i?"s":"")}e.exports=function(e,t){t=t||{};var n=typeof e;if("string"===n&&e.length>0)return l(e);if("number"===n&&isFinite(e))return t.long?c(e):u(e);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))}},function(e,t,n){var r=n(325),i="object"==typeof self&&self&&self.Object===Object&&self,o=r||i||Function("return this")();e.exports=o},function(e,t,n){(function(t){var r=n(62);e.exports=o,e.exports.source=function(e){return o(null,e)},e.exports.sink=function(e){return o(e,null)};var i="undefined"==typeof setImmediate?t.nextTick:setImmediate;function o(e,t){e&&"object"==typeof e&&(t=e.source,e=e.sink);var n=[],o=[],s,a,l=new r,u;l.writable=l.readable=!0,l.write=function(e){return n.length?n.shift()(null,e):o.push(e),n.length||(a=!0),!!n.length},l.end=function(){t?o.length?g():t(s=!0,n.length?n.shift():function(){}):n.length&&n.shift()(!0)},l.source=function(e,t){o.length?(t(null,o.shift()),o.length||l.emit("drain")):((s=s||e)?t(s):n.push(t),a&&(a=!1,l.emit("drain")))},e&&(u=e(l.source)),u&&!t&&(t=u);var c=[],h=[],f=!1,p=!1,d=!1;if(l.sink=function(e){t=e,i(g)},t){l.sink(t);var m=l.pipe.bind(l);l.pipe=function(e,t){var n=m(e,t);return l.paused&&l.resume(),n}}function g(){if(p=!1,t&&!d){for(;c.length&&!l.paused;)l.emit("data",c.shift());if(!l.paused){if(f)return l.emit("end");d=!0,t(null,function e(n,r){d=!1,l.paused?(!0===n?f=n:n?l.emit("error",n):c.push(r),p=!0):n&&!0!==(s=n)?l.emit("error",n):(s=s||n)?l.emit("end"):(l.emit("data",r),d=!0,t(null,e))})}}}return l.pause=function(){return l.paused=!0,l},l.resume=function(){return l.paused=!1,g(),l},l.destroy=function(){!s&&t&&t(s=!0,function(){}),s=!0,n.length&&n.shift()(!0),l.emit("close")},l}}).call(this,n(2))},function(e,t,n){"use strict";(function(t){const r=n(12),i=n(40),o=n(71),s=n(67),a=n(66),l=n(9),u=n(1169).createResolver;function c(e){let n=e,r="/";if(t.isBuffer(e)&&(n=new l(e).toBaseEncodedString()),"string"==typeof e){0===e.indexOf("/ipfs/")&&(e=n=e.substring(6));const t=e.indexOf("/");t>0&&(n=e.substring(0,t),r=e.substring(t))}else l.isCID(n)&&(n=n.toBaseEncodedString());return n=new l(n).toBaseEncodedString(),{base:n,rest:p(r)}}const h={maxDepth:1/0,offset:void 0,length:void 0,fullPath:!1};function f(e){return e.reduce((e,t)=>(e.length&&(e+="/"),e+t),"")}e.exports=((e,t,n)=>{let p;n=Object.assign({},h,n);try{p=c(e)}catch(e){return o(e)}const d=f([p.base].concat(p.rest.slice(0,p.rest.length-1))).length,m=new l(p.base);return r(i([{cid:m,name:p.base,path:p.base,pathRest:p.rest,depth:0}]),u(t,n),s(Boolean),a(e=>({depth:e.depth,name:e.name,path:n.fullPath?e.path:g(e),size:e.size,cid:e.cid,content:e.content,type:e.type})));function g(e){if(!p.rest.length)return e.path;let t=e.path.substring(d);return"/"===t.charAt(0)&&(t=t.substring(1)),t||(t=p.rest[p.rest.length-1]||p.base),t}});const p=(e="")=>(e.trim().match(/([^\\^/]|\\\/)+/g)||[]).filter(Boolean)}).call(this,n(0).Buffer)},function(e,t,n){"use strict";(function(t){const r=n(9);e.exports=function(e){if(t.isBuffer(e))return new r(e).toString();if(r.isCID(e))return e.toString();if("string"!=typeof e)throw new Error("unexpected cid type: "+typeof e);return new r(e.split("/")[0]),e}}).call(this,n(0).Buffer)},function(e,t,n){e.exports=p;var r=n(25),i=n(29).Buffer,o=n(48),s=n(17),a=n(76),l=n(42),u=n(84),c=n(173),h=a.InvalidAlgorithmError,f=a.SignatureParseError;function p(e){r.object(e,"options"),r.arrayOfObject(e.parts,"options.parts"),r.string(e.type,"options.type");for(var t={},n=0;n20&&0===o[0]&&(o=o.slice(1)),s=this.part.s.data,s.length>20&&0===s[0]&&(s=s.slice(1)),this.hashAlgorithm&&"sha1"!==this.hashAlgorithm||o.length+s.length!==40)throw new Error("OpenSSH only supports DSA signatures with SHA1 hash");return t.writeBuffer(i.concat([o,s])),t.toBuffer()}if("ssh"===e&&"ecdsa"===this.type){var h=new c({}),f;o=this.part.r.data,h.writeBuffer(o),h.writePart(this.part.s),t=new c({}),0===o[0]&&(o=o.slice(1));var p=8*o.length;return 256===p?f="nistp256":384===p?f="nistp384":528===p&&(f="nistp521"),t.writeString("ecdsa-sha2-"+f),t.writeBuffer(h.toBuffer()),t.toBuffer()}throw new Error("Invalid signature format");default:throw new Error("Invalid signature data")}},p.prototype.toString=function(e){return r.optionalString(e,"format"),this.toBuffer(e).toString("base64")},p.parse=function(e,t,n){"string"==typeof e&&(e=i.from(e,"base64")),r.buffer(e,"data"),r.string(n,"format"),r.string(t,"type");var o={};o.type=t.toLowerCase(),o.parts=[];try{switch(r.ok(e.length>0,"signature must not be empty"),o.type){case"rsa":case"ed25519":return d(e,t,n,o);case"dsa":case"ecdsa":return"asn1"===n?m(e,t,n,o):"dsa"===o.type?g(e,t,n,o):y(e,t,n,o);default:throw new h(t)}}catch(e){if(e instanceof h)throw e;throw new f(t,n,e)}},p.isSignature=function(e,t){return l.isCompatible(e,p,t)},p.prototype._sshpkApiVersion=[2,1],p._oldVersionDetect=function(e){return r.func(e.toBuffer),e.hasOwnProperty("hashAlgorithm")?[2,0]:[1,0]}},function(e,t,n){var r=n(1630);e.exports={Ber:r,BerReader:r.Reader,BerWriter:r.Writer}},function(e,t){e.exports=function(e){return e.webpackPolyfill||(e.deprecate=function(){},e.paths=[],e.children||(e.children=[]),Object.defineProperty(e,"loaded",{enumerable:!0,get:function(){return e.l}}),Object.defineProperty(e,"id",{enumerable:!0,get:function(){return e.i}}),e.webpackPolyfill=1),e}},function(e,t,n){"use strict";function r(e,t){t|=0;for(var n=Math.max(e.length-t,0),r=Array(n),i=0;iObject.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0}),a=this,l={concatArrays:!1},u=e=>{const t=[];for(const n in e)i.call(e,n)&&t.push(n);if(Object.getOwnPropertySymbols){const n=Object.getOwnPropertySymbols(e);for(let r=0;r{s(t,n,c(e[n]))}),t}function f(e){const t=null===Object.getPrototypeOf(e)?Object.create(null):{};return u(e).forEach(n=>{s(t,n,c(e[n]))}),t}const p=(e,t,n,r)=>(n.forEach(n=>{n in e&&e[n]!==Object.getPrototypeOf(e)?s(e,n,m(e[n],t[n],r)):s(e,n,c(t[n]))}),e),d=(e,t,n)=>{let r=e.slice(0,0),o=0;return[e,t].forEach(t=>{const a=[];for(let n=0;n-1===a.indexOf(e)),n)}),r};function m(e,t,n){return n.concatArrays&&Array.isArray(e)&&Array.isArray(t)?d(e,t,n):r(t)&&r(e)?p(e,t,u(t),n):c(t)}e.exports=function(){const e=m(c(l),this!==a&&this||{},l);let t={foobar:{}};for(let n=0;ne.buffer)};return e.isConnected()?t.connection=c.CONNECTED:t.connection=c.NOT_CONNECTED,t}function p(e){const t=new i(new o(e.id));return e.addrs.forEach(e=>t.multiaddrs.add(e)),t}h.TYPES=u,h.CONNECTION_TYPES=c,e.exports=h}).call(this,n(0).Buffer)},function(e,t,n){"use strict";const r=n(51),i=n(164);function o(e,t){r(e,i(e=>t(null,e)),e=>{e&&t(e)})}e.exports=o},function(e,t,n){e.exports={read:k,write:E};var r=n(25),i=n(84),o=n(17),s=n(29).Buffer,a=n(48),l=n(42),u=n(41),c=n(46),h=n(316),f=n(174),p=n(236),d=n(93),m=n(76),g="1.2.840.113549.1.5.13",y="1.2.840.113549.1.5.12",v={"1.2.840.113549.3.7":"3des-cbc","2.16.840.1.101.3.4.1.2":"aes128-cbc","2.16.840.1.101.3.4.1.42":"aes256-cbc"},b={};Object.keys(v).forEach(function(e){b[v[e]]=e});var _={"1.2.840.113549.2.7":"sha1","1.2.840.113549.2.9":"sha256","1.2.840.113549.2.11":"sha512"},w={};function k(e,t,n){var a=e;"string"!=typeof e&&(r.buffer(e,"buf"),e=e.toString("ascii"));for(var u=e.trim().split(/[\r\n]+/g),c,b=-1,w;!c&&b0;)w=u[--k].match(/[-]+[ ]*END ([A-Z0-9][A-Za-z0-9]+ )?(PUBLIC|PRIVATE) KEY[ ]*[-]+/);r.ok(w,"invalid PEM footer"),r.equal(c[2],w[2]);var E=c[2].toLowerCase(),S;c[1]&&(r.equal(c[1],w[1],"PEM header and footer mismatch"),S=c[1].trim()),u=u.slice(b,k+1);for(var x={},C,A,T;u=u.slice(1),c=u[0].match(/^([A-Za-z0-9-]+): (.+)$/),c;)x[c[1].toLowerCase()]=c[2];if(u=u.slice(0,-1).join(""),e=s.from(u,"base64"),x["proc-type"]){var I=x["proc-type"].split(",");if("4"===I[0]&&"ENCRYPTED"===I[1]){if("string"==typeof t.passphrase&&(t.passphrase=s.from(t.passphrase,"utf-8")),!s.isBuffer(t.passphrase))throw new m.KeyEncryptedError(t.filename,"PEM");I=x["dek-info"].split(","),r.ok(2===I.length),C=I[0].toLowerCase(),T=s.from(I[1],"hex"),A=l.opensslKeyDeriv(C,T,t.passphrase,1).key}}if(S&&"encrypted"===S.toLowerCase()){var j=new i.BerReader(e),R;j.readSequence(),j.readSequence(),R=j.offset+j.length;var B=j.readOID();if(B!==g)throw new Error("Unsupported PEM/PKCS8 encryption scheme: "+B);j.readSequence(),j.readSequence();var O=j.offset+j.length,P=j.readOID();if(P!==y)throw new Error("Unsupported PBES2 KDF: "+P);j.readSequence();var N=j.readString(i.Ber.OctetString,!0),D=j.readInt(),F="sha1";if(j.offsetp.length&&(v=p.length),g+=m.write(p.slice(y,v),g),m[g++]=10,y=v}return g+=m.write("-----END "+a+"-----\n",g),m.slice(0,g)}Object.keys(_).forEach(function(e){w[_[e]]=e})},function(e,t,n){e.exports={read:f.bind(void 0,!1,void 0),readType:f.bind(void 0,!1),write:p,readPartial:f.bind(void 0,!0),readInternal:f,keyTypeToAlg:h,algToKeyType:c};var r=n(25),i=n(29).Buffer,o=n(48),s=n(42),a=n(41),l=n(46),u=n(173);function c(e){if(r.string(e),"ssh-dss"===e)return"dsa";if("ssh-rsa"===e)return"rsa";if("ssh-ed25519"===e)return"ed25519";if("ssh-curve25519"===e)return"curve25519";if(e.match(/^ecdsa-sha2-/))return"ecdsa";throw new Error("Unknown algorithm "+e)}function h(e){if(r.object(e),"dsa"===e.type)return"ssh-dss";if("rsa"===e.type)return"ssh-rsa";if("ed25519"===e.type)return"ssh-ed25519";if("curve25519"===e.type)return"ssh-curve25519";if("ecdsa"===e.type)return"ecdsa-sha2-"+e.part.curve.data.toString();throw new Error("Unknown key type "+e.type)}function f(e,t,n,h){"string"==typeof n&&(n=i.from(n)),r.buffer(n,"buf");var f={},p=f.parts=[],d=new u({buffer:n}),m=d.readString();r.ok(!d.atEnd(),"key must have at least one part"),f.type=c(m);var g=o.info[f.type].parts.length;for(t&&"private"===t&&(g=o.privInfo[f.type].parts.length);!d.atEnd()&&p.length=1,"key must have at least one part"),r.ok(e||d.atEnd(),"leftover bytes at end of key");var y=a,v=o.info[f.type];if("private"!==t&&v.parts.length===p.length||(v=o.privInfo[f.type],y=l),r.strictEqual(v.parts.length,p.length),"ecdsa"===f.type){var b=/^ecdsa-sha2-(.+)$/.exec(m);r.ok(null!==b),r.strictEqual(b[1],p[0].data.toString())}for(var _=!0,w=0;w!e.status)}static p_connectedNames(e){const t=this._connected().map(e=>e.name);if(!e)return new Promise((e,n)=>e(t));e(null,t)}static async p_connectedNamesParm(){return(await this.p_connectedNames()).map(e=>"transport="+e).join("&")}static statuses({connected:e}){const t=c._transports.map(e=>({name:e.name,status:e.status,info:e.info}));return e?t.filter(e=>!e.status):t}static p_statuses(e){const t=this.statuses({connected:!1});if(!e)return new Promise((e,n)=>e(t));e(null,t)}static validFor(e,t,n){return"string"==typeof e&&(e=[e]),e&&e[0]||["store","newlisturls","newdatabase","newtable","seed"].includes(t)?e&&e.length>0?[].concat(...e.map(e=>"string"==typeof e?r.parse(e):e).map(e=>this._transports.filter(r=>r.validFor(e,t,n)).map(t=>[e,t]))):this._transports.filter(e=>e.validFor(void 0,t,n)).map(e=>[void 0,e]):(console.error("Transports.validFor called with invalid arguments: urls=",e,"func=",t),[])}static async p_urlsValidFor(e,t,n){return this.validFor(e,t,n).map(e=>e[0])}static http(){return c._connected().find(e=>"HTTP"===e.name)}static wolk(){return c._connected().find(e=>"WOLK"===e.name)}static ipfs(){return c._connected().find(e=>"IPFS"===e.name)}static webtorrent(){return c._connected().find(e=>"WEBTORRENT"===e.name)}static gun(){return c._connected().find(e=>"GUN"===e.name)}static async p_resolveNames(e){return this.mirror?Array.isArray(e)?this.gatewayUrls(e):this.gatewayUrl(url):this.namingcb?await this.namingcb(e):e}static resolveNamesWith(e){this.namingcb=e}static togglePaused(e,t){const n=this._transports.find(t=>t.name===e);n?n.togglePaused(e=>t(null,e.status)):t(void 0)}static async _p_rawstore(e,t){let n=[],r=await Promise.all(e.map(async function(e){try{s("Storing %d bytes to %s",t.length,e.name);let r=await e.p_rawstore(t);return s("Storing %d bytes to %s succeeded: %s",t.length,e.name,r),r}catch(r){return s("Storing %d bytes to %s failed: %s",t.length,e.name,r.message),void n.push(r)}}));if(r=r.filter(e=>!!e),!r.length)throw s("Storing %d bytes failed on all transports",t.length),new i.TransportError(n.map(e=>e.message).join(", "));return r}static async p_rawstore(e){let t=this.validFor(void 0,"store").map(([e,t])=>t);if(!t.length)throw s("Storing %d bytes failed: no transports available",e.length),new i.TransportError("Transports.p_rawstore: Cant find transport for store");return this._p_rawstore(t,e)}static async p_rawfetch(e,t={}){if(!e.length)throw new i.TransportError("Transports.p_rawfetch given an empty list of urls");let n=await this.p_resolveNames(e);if(!n.length)throw new i.TransportError("Transports.p_rawfetch none of the urls resolved: "+e);let r=this.validFor(n,"fetch",{noCache:t.noCache});if(!r.length)throw new i.TransportError("Transports.p_rawfetch cant find any transport for urls: "+n);let o=[],a=[];for(const[e,n]of r)try{s("Fetching %s via %s",e.href,n.name);let r=await n.p_rawfetch(e,t);return s("Fetching %s via %s succeeded %d bytes",e.href,n.name,r.length),t.relay&&a.length&&(s("Fetching attempting relay of %d bytes from %s to %o",r.length,e.href,a.map(e=>e.name)),this._p_rawstore(a,r).then(e=>s("Fetching relayed %d bytes to %o",r.length,e))),r}catch(t){a.push(n),o.push(t),s("Fetching %s via %s failed: %s",e.href,n.name,t.message)}throw s("Fetching %o failed on all transports",e),new i.TransportError(o.map(e=>e.message).join(", "))}static fetch(e,t={},n){"function"==typeof t&&(n=t,t={});const r=this.p_rawfetch(e,t);if(!n)return r;r.then(e=>{try{n(null,e)}catch(e){s("Uncaught error in fetch %O",e)}}).catch(e=>n(e))}static seed({directoryPath:e,fileRelativePath:t,ipfsHash:n,urlToFile:r,torrentRelativePath:i},o){if(!o)return new Promise((e,t)=>{try{a.call(this,(n,r)=>{n?t(n):e(r)})}catch(e){t(e)}});try{a.call(this,o)}catch(e){o(e)}function a(o){let a=this.validFor(void 0,"seed").map(([e,t])=>t);if(a.length){const s={};l(a,(o,a)=>o.seed({directoryPath:e,torrentRelativePath:i,fileRelativePath:t,ipfsHash:n,urlToFile:r},(e,t)=>{s[o.name]=e?{err:e.message}:t,a(null)}),e=>o(null,s))}else s("Seeding: no transports available"),o(null)}}static async p_rawlist(e){e=await this.p_resolveNames(e);let t=this.validFor(e,"list");if(!t.length)throw new i.TransportError('Transports.p_rawlist: Cant find transport to "list" urls:'+e.join(","));let n=[],r=await Promise.all(t.map(async function([e,t]){try{s("Listing %s via %s",e,t.name);let r=await t.p_rawlist(e);return s("Listing %s via %s retrieved %d items",e,t.name,r.length),r}catch(r){return s("Listing %s via %s failed: %s",e,t.name,r.message),n.push(r),[]}}));if(n.length>=t.length)throw s("Listing %o failed on all transports",e),new i.TransportError(n.map(e=>e.message).join(", "));let o={};return[].concat(...r).filter(e=>!o[e.signature]&&(o[e.signature]=!0))}static async p_rawadd(e,t){e=await this.p_resolveNames(e);let n=this.validFor(e,"add");if(!n.length)throw s("Adding to %o failed: no transports available",e),new i.TransportError("Transports.p_rawstore: Cant find transport for urls:"+e.join(","));let r=[];if(await Promise.all(n.map(async function([e,n]){try{return s("Adding to %s via %s",e,n.name),await n.p_rawadd(e,t),void s("Adding to %s via %s succeeded",e,n.name)}catch(t){return s("Adding to %s via %s failed: %s",e,n.name,t.message),void r.push(t)}})),r.length>=n.length)throw s("Adding to %o failed on all transports",e),new i.TransportError(r.map(e=>e.message).join(", "))}static listmonitor(e,t,n={}){this.validFor(e,"listmonitor").map(([e,r])=>{r.listmonitor(e,t,n),s("Monitoring list %s via %s",e,r.name)})}static async p_newlisturls(e){let t=await Promise.all(this.validFor(void 0,"newlisturls").map(([t,n])=>n.p_newlisturls(e)));return[t.map(e=>e[0]),t.map(e=>e[1])]}static async p_f_createReadStream(e,{wanturl:t=!1,preferredTransports:n=[]}={}){let r=this.validFor(e,"createReadStream",{});if(!r.length)throw s("Opening stream from %o failed: no transports available",e),new i.TransportError("Transports.p_createReadStream cant find any transport for urls: "+e);let o=[];r.sort((e,t)=>(n.indexOf(e[1].name)+1||999+Math.random())-(n.indexOf(t[1].name)+1||999+Math.random()));for(const[e,n]of r)try{s("Opening stream from %s via %s",e.href,n.name);let r=await n.p_f_createReadStream(e,{wanturl:t});return s("Opening stream from %s via %s succeeded",e.href,n.name),r}catch(t){o.push(t),s("Opening stream from %s via %s failed: %s",e.href,n.name,t.message)}throw s("Opening stream from %o failed on all transports",e),new i.TransportError(o.map(e=>e.message).join(", "))}static createReadStream(e,t,n){"function"==typeof t&&(n=t,t={start:0}),DwebTransports.p_f_createReadStream(e,{preferredTransports:t.preferredTransports||[]}).then(e=>{let r=e(t);if(!n)return r;n(null,r)}).catch(e=>{e instanceof i.TransportError?console.warn("Transports.createReadStream caught",e.message):console.error("Transports.createReadStream caught",e),n?n(e):reject(e)})}static async p_get(e,t){let n=this.validFor(e,"get"),r=Array.isArray(t)?`${t.length} keys`:t;if(!n.length)throw s("Getting %s from %o failed: no transports available",r,e),new i.TransportError("Transports.p_get cant find any transport to get keys from urls: "+e);let o=[];for(const[e,i]of n)try{s("Getting %s from %s via %s",r,e.href,i.name);let n=await i.p_get(e,t);return s("Getting %s from %s via %s succeeded length=%d",r,e.href,i.name,n.length),n}catch(t){o.push(t),s("Getting %s from %s via %s failed: %s",r,e.href,i.name,t.message)}throw s("Getting %s from %o failed on all transports",r,e),new i.TransportError(o.map(e=>e.message).join(", "))}static async p_set(e,t,n){e=await this.p_resolveNames(e);let r="object"==typeof t?`${t.length} keys`:t,o=this.validFor(e,"set");if(!o.length)throw s("Setting %s on %o failed: no transports available",r,e),new i.TransportError("Transports.p_set cant find any transport for urls: "+e);let a=[],l=!1;if(await Promise.all(o.map(async function([e,i]){try{s("Setting %s on %s via %s",r,e.href,i.name),await i.p_set(e,t,n),s("Setting %s on %s via %s succeeded",r,e.href,i.name),l=!0}catch(t){s("Setting %s on %s via %s failed: %s",r,e.href,i.name,t.message),a.push(t)}})),!l)throw s("Setting %s on %o failed on all transports",r,e),new i.TransportError(a.map(e=>e.message).join(", "))}static async p_delete(e,t){e=await this.p_resolveNames(e);let n=Array.isArray(t)?`${t.length} keys`:t,r=this.validFor(e,"set");if(!r.length)throw s("Deleting %s on %o failed: no transports available",n,e),new i.TransportError("Transports.p_set cant find any transport for urls: "+e);let o=[],a=!1;if(await Promise.all(r.map(async function([e,r]){try{s("Deleting %s on %s via %s",n,e.href,r.name),await r.p_delete(e,t),s("Deleting %s on %s via %s succeeded",n,e.href,r.name),a=!0}catch(t){s("Deleting %s on %s via %s failed: %s",n,e.href,r.name,t.message),o.push(t)}})),!a)throw s("Deleting %s on %o failed on all transports",n,e),new i.TransportError(o.map(e=>e.message).join(", "))}static async p_keys(e){e=await this.p_resolveNames(e);let t=this.validFor(e,"keys");if(!t.length)throw s("Getting all keys on %o failed: no transports available",e),new i.TransportError("Transports.p_keys cant find any transport for urls: "+e);let n=[];for(const[e,r]of t)try{s("Getting all keys on %s via %s",e.href,r.name);let t=await r.p_keys(e);return s("Getting all keys on %s via %s succeeded with %d keys",e.href,r.name,t.length),t}catch(t){n.push(t),s("Getting all keys on %s via %s failed: %s",e.href,r.name,t.message)}throw s("Getting all keys on %o failed on all transports",e),new i.TransportError(n.map(e=>e.message).join(", "))}static async p_getall(e){e=await this.p_resolveNames(e);let t=this.validFor(e,"getall");if(!t.length)throw s("Getting all values on %o failed: no transports available",e),new i.TransportError("Transports.p_getall cant find any transport for urls: "+e);let n=[];for(const[e,r]of t)try{s("Getting all values on %s via %s",e.href,r.name);let t=await r.p_getall(e);return s("Getting all values on %s via %s succeeded with %d values",e.href,r.name,t.length),t}catch(t){n.push(t),s("Getting all values on %s via %s failed: %s",e.href,r.name,t.message)}throw s("Getting all keys on %o failed on all transports",e),new i.TransportError(n.map(e=>e.message).join(", "))}static async p_newdatabase(e){let t=await Promise.all(this.validFor(void 0,"newdatabase").map(([t,n])=>n.p_newdatabase(e)));return{privateurls:t.map(e=>e.privateurl),publicurls:t.map(e=>e.publicurl)}}static async p_newtable(e,t){let n=await Promise.all(this.validFor(void 0,"newtable").map(([n,r])=>r.p_newtable(e,t)));return{privateurls:n.map(e=>e.privateurl),publicurls:n.map(e=>e.publicurl)}}static async p_connection(e){e=await this.p_resolveNames(e),await Promise.all(this.validFor(e,"connection").map(([e,t])=>t.p_connection(e)))}static monitor(e,t,{current:n=!1}={}){this.validFor(e,"monitor").map(([e,r])=>{s("Monitoring table %s via %s",e,r.name),r.monitor(e,t,{current:n})})}static addtransport(e){c._transports.push(e)}static setup0(e,t,n){let r={http:{urlbase:"http://localhost:4244"}};return e.map(e=>{let n=this._transportclasses["LOCAL"===e?"HTTP":e];return n?(s("Setting up connection to %s with options %o",e,t),n.setup0("LOCAL"===e?r:t)):void s("Connection to %s unavailable",e)}).filter(e=>!!e)}static p_setup1(e,t){const n=Promise.all(this._transports.filter(e=>!this._optionspaused.includes(e.name)).map(t=>(s("Connection stage 1 to %s",t.name),t.p_setup1(e))));if(!t)return n;n.catch(e=>t(e)).then(e=>t(null,e))}static p_setup2(e,t){const n=Promise.all(this._transports.filter(e=>!this._optionspaused.includes(e.name)).map(t=>(s("Connection stage 2 to %s",t.name),t.p_setup2(e))));if(!t)return n;n.catch(e=>t(e)).then(e=>t(null,e))}static p_stop(e,t){if(!t)return new Promise((e,t)=>{try{n.call(this,(n,r)=>{n?t(n):e(r)})}catch(e){t(e)}});try{n.call(this,t)}catch(e){t(e)}function n(t){u(this._connected(),(t,n)=>{s("Stopping %s",t.name),t.stop(e,n)},t)}}static async refreshstatus(e){let t=["transportstatus0","transportstatus1","transportstatus2","transportstatus3","transportstatus4"],n=e.statuselement;n&&(n.classList.remove(...t),n.classList.add(t[e.status])),c.statuscb&&c.statuscb(e)}static connect(e,t){const n=this.p_connect(e);if(!t)return n;n.catch(e=>t(e)).then(e=>t(null,e))}static async p_connect(e){try{e=e||{};let t=e.transports;this._optionspaused=(e.paused||[]).map(e=>e.toUpperCase()),t&&t.length||(t=e.defaulttransports||[]),t.length||(t=["HTTP","IPFS","WEBTORRENT","WOLK"]),t=t.map(e=>e.toUpperCase());let n=this.setup0(t,e);if(["statuscb","mirror"].forEach(t=>{e[t]&&(this[t]=e[t])}),e.statuselement){let t=e.statuselement;for(;t.lastChild;)t.removeChild(t.lastChild);t.appendChild(o.createElement("UL",{},n.map(e=>{let t=o.createElement("LI",{onclick:"this.source.togglePaused(DwebTransports.refreshstatus);",source:e,name:e.name},e.name);return e.statuselement=t,t})))}await this.p_setup1(this.refreshstatus),await this.p_setup2(this.refreshstatus),s("Connection completed to %o",this._connected().map(e=>e.name))}catch(e){throw console.error("ERROR in p_connect:",e.message),e}}static async p_urlsFrom(e){if("string"==typeof e&&(e="["===e[0]?JSON.parse(e):e.includes(",")?e.split(","):[e]),!Array.isArray(e))throw new Error(`Unparsable url: ${e}`);return e}static async p_httpfetchurl(e){return c.http()._url(e.find(e=>e.startsWith("contenthash")||e.startsWith("http")),"content/rawfetch")}static canonicalName(e,t={}){"string"!=typeof e&&(e=r.parse(e).href);const n=["dweb.me","ipfs.io"],i=["ipfs","gun","magnet","yjs","wolk","arc","contenthash","http","https"],o=["arc","http","https"],s=[/^http[s]?:[/]+([^/]+)[/](\w+)[/](.*)/i],a=[/^dweb:[/]+(\w+)[/]+(.*)/i,/^\w+:[/]+(\w+)[/](.*)/i,/^(\w+):[/]*(.*)/i,/^[/]*(\w+)[/](.*)/i,/^[/]*dweb[/]*(\w+)[/](.*)/i],l=[/^http[s]?:[/]+[^/]+[/](archive).(org)[/]*(.*)/i,/^http[s]?:[/]+[^/]+[/]arc[/](archive).(org)[/]*(.*)/i,/^http[s]?:[/]+dweb.(\w+)[.]([^/]+)[/]*(.*)/i,/^(http[s])?:[/]+([^/]+)[/]+(.*)/i];for(let t of s){let r=e.match(t);if(r&&n.includes(r[1])&&i.includes(r[2]))return{proto:r[2],internal:r[3]}}for(let t of l){let n=e.match(t);if(n)return i.includes(n[1])?{proto:n[1],internal:o.includes(n[1])?[n[2],n[3]].join("/"):n[3]}:{proto:"arc",internal:[[n[1],n[2]].join("."),n[3]].join("/")}}for(let t of a){let n=e.match(t);if(n&&i.includes(n[1]))return{proto:n[1],internal:n[2]}}}static canonicalUrl(e,t={}){let n=this.canonicalName(e,t);return n.protocol+":/"+n.internal}static _o2url(e){return["http","https"].includes(e.proto)?[e.proto,e.internal].join("://"):e.proto?[this.mirror,e.proto,e.internal].join("/"):e.internal}static gatewayUrl(e){let t=c.canonicalName(e);return t?this._o2url(t):e}static gatewayUrls(e){const t=e.map(e=>c.canonicalName(e)||{proto:void 0,internal:e}),n=t.filter(e=>["arc"].includes(e.proto));return(n.length?n:t).map(e=>this._o2url(e))}}c._transports=[],c.namingcb=void 0,c._transportclasses={},c.httptools=a,t=e.exports=c},function(e,t,n){"use strict";(function(e){t.protobuf=e.from("50","hex"),t.cbor=e.from("51","hex"),t.rlp=e.from("60","hex"),t.bencode=e.from("63","hex"),t.multicodec=e.from("30","hex"),t.multihash=e.from("31","hex"),t.multiaddr=e.from("32","hex"),t.multibase=e.from("33","hex"),t.identity=e.from("00","hex"),t.sha1=e.from("11","hex"),t["sha2-256"]=e.from("12","hex"),t["sha2-512"]=e.from("13","hex"),t["sha3-512"]=e.from("14","hex"),t["sha3-384"]=e.from("15","hex"),t["sha3-256"]=e.from("16","hex"),t["sha3-224"]=e.from("17","hex"),t["shake-128"]=e.from("18","hex"),t["shake-256"]=e.from("19","hex"),t["keccak-224"]=e.from("1a","hex"),t["keccak-256"]=e.from("1b","hex"),t["keccak-384"]=e.from("1c","hex"),t["keccak-512"]=e.from("1d","hex"),t["murmur3-128"]=e.from("22","hex"),t["murmur3-32"]=e.from("23","hex"),t["dbl-sha2-256"]=e.from("56","hex"),t.md4=e.from("d4","hex"),t.md5=e.from("d5","hex"),t.bmt=e.from("d6","hex"),t.x11=e.from("1100","hex"),t["blake2b-8"]=e.from("b201","hex"),t["blake2b-16"]=e.from("b202","hex"),t["blake2b-24"]=e.from("b203","hex"),t["blake2b-32"]=e.from("b204","hex"),t["blake2b-40"]=e.from("b205","hex"),t["blake2b-48"]=e.from("b206","hex"),t["blake2b-56"]=e.from("b207","hex"),t["blake2b-64"]=e.from("b208","hex"),t["blake2b-72"]=e.from("b209","hex"),t["blake2b-80"]=e.from("b20a","hex"),t["blake2b-88"]=e.from("b20b","hex"),t["blake2b-96"]=e.from("b20c","hex"),t["blake2b-104"]=e.from("b20d","hex"),t["blake2b-112"]=e.from("b20e","hex"),t["blake2b-120"]=e.from("b20f","hex"),t["blake2b-128"]=e.from("b210","hex"),t["blake2b-136"]=e.from("b211","hex"),t["blake2b-144"]=e.from("b212","hex"),t["blake2b-152"]=e.from("b213","hex"),t["blake2b-160"]=e.from("b214","hex"),t["blake2b-168"]=e.from("b215","hex"),t["blake2b-176"]=e.from("b216","hex"),t["blake2b-184"]=e.from("b217","hex"),t["blake2b-192"]=e.from("b218","hex"),t["blake2b-200"]=e.from("b219","hex"),t["blake2b-208"]=e.from("b21a","hex"),t["blake2b-216"]=e.from("b21b","hex"),t["blake2b-224"]=e.from("b21c","hex"),t["blake2b-232"]=e.from("b21d","hex"),t["blake2b-240"]=e.from("b21e","hex"),t["blake2b-248"]=e.from("b21f","hex"),t["blake2b-256"]=e.from("b220","hex"),t["blake2b-264"]=e.from("b221","hex"),t["blake2b-272"]=e.from("b222","hex"),t["blake2b-280"]=e.from("b223","hex"),t["blake2b-288"]=e.from("b224","hex"),t["blake2b-296"]=e.from("b225","hex"),t["blake2b-304"]=e.from("b226","hex"),t["blake2b-312"]=e.from("b227","hex"),t["blake2b-320"]=e.from("b228","hex"),t["blake2b-328"]=e.from("b229","hex"),t["blake2b-336"]=e.from("b22a","hex"),t["blake2b-344"]=e.from("b22b","hex"),t["blake2b-352"]=e.from("b22c","hex"),t["blake2b-360"]=e.from("b22d","hex"),t["blake2b-368"]=e.from("b22e","hex"),t["blake2b-376"]=e.from("b22f","hex"),t["blake2b-384"]=e.from("b230","hex"),t["blake2b-392"]=e.from("b231","hex"),t["blake2b-400"]=e.from("b232","hex"),t["blake2b-408"]=e.from("b233","hex"),t["blake2b-416"]=e.from("b234","hex"),t["blake2b-424"]=e.from("b235","hex"),t["blake2b-432"]=e.from("b236","hex"),t["blake2b-440"]=e.from("b237","hex"),t["blake2b-448"]=e.from("b238","hex"),t["blake2b-456"]=e.from("b239","hex"),t["blake2b-464"]=e.from("b23a","hex"),t["blake2b-472"]=e.from("b23b","hex"),t["blake2b-480"]=e.from("b23c","hex"),t["blake2b-488"]=e.from("b23d","hex"),t["blake2b-496"]=e.from("b23e","hex"),t["blake2b-504"]=e.from("b23f","hex"),t["blake2b-512"]=e.from("b240","hex"),t["blake2s-8"]=e.from("b241","hex"),t["blake2s-16"]=e.from("b242","hex"),t["blake2s-24"]=e.from("b243","hex"),t["blake2s-32"]=e.from("b244","hex"),t["blake2s-40"]=e.from("b245","hex"),t["blake2s-48"]=e.from("b246","hex"),t["blake2s-56"]=e.from("b247","hex"),t["blake2s-64"]=e.from("b248","hex"),t["blake2s-72"]=e.from("b249","hex"),t["blake2s-80"]=e.from("b24a","hex"),t["blake2s-88"]=e.from("b24b","hex"),t["blake2s-96"]=e.from("b24c","hex"),t["blake2s-104"]=e.from("b24d","hex"),t["blake2s-112"]=e.from("b24e","hex"),t["blake2s-120"]=e.from("b24f","hex"),t["blake2s-128"]=e.from("b250","hex"),t["blake2s-136"]=e.from("b251","hex"),t["blake2s-144"]=e.from("b252","hex"),t["blake2s-152"]=e.from("b253","hex"),t["blake2s-160"]=e.from("b254","hex"),t["blake2s-168"]=e.from("b255","hex"),t["blake2s-176"]=e.from("b256","hex"),t["blake2s-184"]=e.from("b257","hex"),t["blake2s-192"]=e.from("b258","hex"),t["blake2s-200"]=e.from("b259","hex"),t["blake2s-208"]=e.from("b25a","hex"),t["blake2s-216"]=e.from("b25b","hex"),t["blake2s-224"]=e.from("b25c","hex"),t["blake2s-232"]=e.from("b25d","hex"),t["blake2s-240"]=e.from("b25e","hex"),t["blake2s-248"]=e.from("b25f","hex"),t["blake2s-256"]=e.from("b260","hex"),t["skein256-8"]=e.from("b301","hex"),t["skein256-16"]=e.from("b302","hex"),t["skein256-24"]=e.from("b303","hex"),t["skein256-32"]=e.from("b304","hex"),t["skein256-40"]=e.from("b305","hex"),t["skein256-48"]=e.from("b306","hex"),t["skein256-56"]=e.from("b307","hex"),t["skein256-64"]=e.from("b308","hex"),t["skein256-72"]=e.from("b309","hex"),t["skein256-80"]=e.from("b30a","hex"),t["skein256-88"]=e.from("b30b","hex"),t["skein256-96"]=e.from("b30c","hex"),t["skein256-104"]=e.from("b30d","hex"),t["skein256-112"]=e.from("b30e","hex"),t["skein256-120"]=e.from("b30f","hex"),t["skein256-128"]=e.from("b310","hex"),t["skein256-136"]=e.from("b311","hex"),t["skein256-144"]=e.from("b312","hex"),t["skein256-152"]=e.from("b313","hex"),t["skein256-160"]=e.from("b314","hex"),t["skein256-168"]=e.from("b315","hex"),t["skein256-176"]=e.from("b316","hex"),t["skein256-184"]=e.from("b317","hex"),t["skein256-192"]=e.from("b318","hex"),t["skein256-200"]=e.from("b319","hex"),t["skein256-208"]=e.from("b31a","hex"),t["skein256-216"]=e.from("b31b","hex"),t["skein256-224"]=e.from("b31c","hex"),t["skein256-232"]=e.from("b31d","hex"),t["skein256-240"]=e.from("b31e","hex"),t["skein256-248"]=e.from("b31f","hex"),t["skein256-256"]=e.from("b320","hex"),t["skein512-8"]=e.from("b321","hex"),t["skein512-16"]=e.from("b322","hex"),t["skein512-24"]=e.from("b323","hex"),t["skein512-32"]=e.from("b324","hex"),t["skein512-40"]=e.from("b325","hex"),t["skein512-48"]=e.from("b326","hex"),t["skein512-56"]=e.from("b327","hex"),t["skein512-64"]=e.from("b328","hex"),t["skein512-72"]=e.from("b329","hex"),t["skein512-80"]=e.from("b32a","hex"),t["skein512-88"]=e.from("b32b","hex"),t["skein512-96"]=e.from("b32c","hex"),t["skein512-104"]=e.from("b32d","hex"),t["skein512-112"]=e.from("b32e","hex"),t["skein512-120"]=e.from("b32f","hex"),t["skein512-128"]=e.from("b330","hex"),t["skein512-136"]=e.from("b331","hex"),t["skein512-144"]=e.from("b332","hex"),t["skein512-152"]=e.from("b333","hex"),t["skein512-160"]=e.from("b334","hex"),t["skein512-168"]=e.from("b335","hex"),t["skein512-176"]=e.from("b336","hex"),t["skein512-184"]=e.from("b337","hex"),t["skein512-192"]=e.from("b338","hex"),t["skein512-200"]=e.from("b339","hex"),t["skein512-208"]=e.from("b33a","hex"),t["skein512-216"]=e.from("b33b","hex"),t["skein512-224"]=e.from("b33c","hex"),t["skein512-232"]=e.from("b33d","hex"),t["skein512-240"]=e.from("b33e","hex"),t["skein512-248"]=e.from("b33f","hex"),t["skein512-256"]=e.from("b340","hex"),t["skein512-264"]=e.from("b341","hex"),t["skein512-272"]=e.from("b342","hex"),t["skein512-280"]=e.from("b343","hex"),t["skein512-288"]=e.from("b344","hex"),t["skein512-296"]=e.from("b345","hex"),t["skein512-304"]=e.from("b346","hex"),t["skein512-312"]=e.from("b347","hex"),t["skein512-320"]=e.from("b348","hex"),t["skein512-328"]=e.from("b349","hex"),t["skein512-336"]=e.from("b34a","hex"),t["skein512-344"]=e.from("b34b","hex"),t["skein512-352"]=e.from("b34c","hex"),t["skein512-360"]=e.from("b34d","hex"),t["skein512-368"]=e.from("b34e","hex"),t["skein512-376"]=e.from("b34f","hex"),t["skein512-384"]=e.from("b350","hex"),t["skein512-392"]=e.from("b351","hex"),t["skein512-400"]=e.from("b352","hex"),t["skein512-408"]=e.from("b353","hex"),t["skein512-416"]=e.from("b354","hex"),t["skein512-424"]=e.from("b355","hex"),t["skein512-432"]=e.from("b356","hex"),t["skein512-440"]=e.from("b357","hex"),t["skein512-448"]=e.from("b358","hex"),t["skein512-456"]=e.from("b359","hex"),t["skein512-464"]=e.from("b35a","hex"),t["skein512-472"]=e.from("b35b","hex"),t["skein512-480"]=e.from("b35c","hex"),t["skein512-488"]=e.from("b35d","hex"),t["skein512-496"]=e.from("b35e","hex"),t["skein512-504"]=e.from("b35f","hex"),t["skein512-512"]=e.from("b360","hex"),t["skein1024-8"]=e.from("b361","hex"),t["skein1024-16"]=e.from("b362","hex"),t["skein1024-24"]=e.from("b363","hex"),t["skein1024-32"]=e.from("b364","hex"),t["skein1024-40"]=e.from("b365","hex"),t["skein1024-48"]=e.from("b366","hex"),t["skein1024-56"]=e.from("b367","hex"),t["skein1024-64"]=e.from("b368","hex"),t["skein1024-72"]=e.from("b369","hex"),t["skein1024-80"]=e.from("b36a","hex"),t["skein1024-88"]=e.from("b36b","hex"),t["skein1024-96"]=e.from("b36c","hex"),t["skein1024-104"]=e.from("b36d","hex"),t["skein1024-112"]=e.from("b36e","hex"),t["skein1024-120"]=e.from("b36f","hex"),t["skein1024-128"]=e.from("b370","hex"),t["skein1024-136"]=e.from("b371","hex"),t["skein1024-144"]=e.from("b372","hex"),t["skein1024-152"]=e.from("b373","hex"),t["skein1024-160"]=e.from("b374","hex"),t["skein1024-168"]=e.from("b375","hex"),t["skein1024-176"]=e.from("b376","hex"),t["skein1024-184"]=e.from("b377","hex"),t["skein1024-192"]=e.from("b378","hex"),t["skein1024-200"]=e.from("b379","hex"),t["skein1024-208"]=e.from("b37a","hex"),t["skein1024-216"]=e.from("b37b","hex"),t["skein1024-224"]=e.from("b37c","hex"),t["skein1024-232"]=e.from("b37d","hex"),t["skein1024-240"]=e.from("b37e","hex"),t["skein1024-248"]=e.from("b37f","hex"),t["skein1024-256"]=e.from("b380","hex"),t["skein1024-264"]=e.from("b381","hex"),t["skein1024-272"]=e.from("b382","hex"),t["skein1024-280"]=e.from("b383","hex"),t["skein1024-288"]=e.from("b384","hex"),t["skein1024-296"]=e.from("b385","hex"),t["skein1024-304"]=e.from("b386","hex"),t["skein1024-312"]=e.from("b387","hex"),t["skein1024-320"]=e.from("b388","hex"),t["skein1024-328"]=e.from("b389","hex"),t["skein1024-336"]=e.from("b38a","hex"),t["skein1024-344"]=e.from("b38b","hex"),t["skein1024-352"]=e.from("b38c","hex"),t["skein1024-360"]=e.from("b38d","hex"),t["skein1024-368"]=e.from("b38e","hex"),t["skein1024-376"]=e.from("b38f","hex"),t["skein1024-384"]=e.from("b390","hex"),t["skein1024-392"]=e.from("b391","hex"),t["skein1024-400"]=e.from("b392","hex"),t["skein1024-408"]=e.from("b393","hex"),t["skein1024-416"]=e.from("b394","hex"),t["skein1024-424"]=e.from("b395","hex"),t["skein1024-432"]=e.from("b396","hex"),t["skein1024-440"]=e.from("b397","hex"),t["skein1024-448"]=e.from("b398","hex"),t["skein1024-456"]=e.from("b399","hex"),t["skein1024-464"]=e.from("b39a","hex"),t["skein1024-472"]=e.from("b39b","hex"),t["skein1024-480"]=e.from("b39c","hex"),t["skein1024-488"]=e.from("b39d","hex"),t["skein1024-496"]=e.from("b39e","hex"),t["skein1024-504"]=e.from("b39f","hex"),t["skein1024-512"]=e.from("b3a0","hex"),t["skein1024-520"]=e.from("b3a1","hex"),t["skein1024-528"]=e.from("b3a2","hex"),t["skein1024-536"]=e.from("b3a3","hex"),t["skein1024-544"]=e.from("b3a4","hex"),t["skein1024-552"]=e.from("b3a5","hex"),t["skein1024-560"]=e.from("b3a6","hex"),t["skein1024-568"]=e.from("b3a7","hex"),t["skein1024-576"]=e.from("b3a8","hex"),t["skein1024-584"]=e.from("b3a9","hex"),t["skein1024-592"]=e.from("b3aa","hex"),t["skein1024-600"]=e.from("b3ab","hex"),t["skein1024-608"]=e.from("b3ac","hex"),t["skein1024-616"]=e.from("b3ad","hex"),t["skein1024-624"]=e.from("b3ae","hex"),t["skein1024-632"]=e.from("b3af","hex"),t["skein1024-640"]=e.from("b3b0","hex"),t["skein1024-648"]=e.from("b3b1","hex"),t["skein1024-656"]=e.from("b3b2","hex"),t["skein1024-664"]=e.from("b3b3","hex"),t["skein1024-672"]=e.from("b3b4","hex"),t["skein1024-680"]=e.from("b3b5","hex"),t["skein1024-688"]=e.from("b3b6","hex"),t["skein1024-696"]=e.from("b3b7","hex"),t["skein1024-704"]=e.from("b3b8","hex"),t["skein1024-712"]=e.from("b3b9","hex"),t["skein1024-720"]=e.from("b3ba","hex"),t["skein1024-728"]=e.from("b3bb","hex"),t["skein1024-736"]=e.from("b3bc","hex"),t["skein1024-744"]=e.from("b3bd","hex"),t["skein1024-752"]=e.from("b3be","hex"),t["skein1024-760"]=e.from("b3bf","hex"),t["skein1024-768"]=e.from("b3c0","hex"),t["skein1024-776"]=e.from("b3c1","hex"),t["skein1024-784"]=e.from("b3c2","hex"),t["skein1024-792"]=e.from("b3c3","hex"),t["skein1024-800"]=e.from("b3c4","hex"),t["skein1024-808"]=e.from("b3c5","hex"),t["skein1024-816"]=e.from("b3c6","hex"),t["skein1024-824"]=e.from("b3c7","hex"),t["skein1024-832"]=e.from("b3c8","hex"),t["skein1024-840"]=e.from("b3c9","hex"),t["skein1024-848"]=e.from("b3ca","hex"),t["skein1024-856"]=e.from("b3cb","hex"),t["skein1024-864"]=e.from("b3cc","hex"),t["skein1024-872"]=e.from("b3cd","hex"),t["skein1024-880"]=e.from("b3ce","hex"),t["skein1024-888"]=e.from("b3cf","hex"),t["skein1024-896"]=e.from("b3d0","hex"),t["skein1024-904"]=e.from("b3d1","hex"),t["skein1024-912"]=e.from("b3d2","hex"),t["skein1024-920"]=e.from("b3d3","hex"),t["skein1024-928"]=e.from("b3d4","hex"),t["skein1024-936"]=e.from("b3d5","hex"),t["skein1024-944"]=e.from("b3d6","hex"),t["skein1024-952"]=e.from("b3d7","hex"),t["skein1024-960"]=e.from("b3d8","hex"),t["skein1024-968"]=e.from("b3d9","hex"),t["skein1024-976"]=e.from("b3da","hex"),t["skein1024-984"]=e.from("b3db","hex"),t["skein1024-992"]=e.from("b3dc","hex"),t["skein1024-1000"]=e.from("b3dd","hex"),t["skein1024-1008"]=e.from("b3de","hex"),t["skein1024-1016"]=e.from("b3df","hex"),t["skein1024-1024"]=e.from("b3e0","hex"),t.ip4=e.from("04","hex"),t.tcp=e.from("06","hex"),t.dccp=e.from("21","hex"),t.ip6=e.from("29","hex"),t.ip6zone=e.from("2a","hex"),t.dns=e.from("35","hex"),t.dns4=e.from("36","hex"),t.dns6=e.from("37","hex"),t.dnsaddr=e.from("38","hex"),t.sctp=e.from("84","hex"),t.udp=e.from("0111","hex"),t["p2p-webrtc-star"]=e.from("0113","hex"),t["p2p-webrtc-direct"]=e.from("0114","hex"),t["p2p-stardust"]=e.from("0115","hex"),t["p2p-circuit"]=e.from("0122","hex"),t.udt=e.from("012d","hex"),t.utp=e.from("012e","hex"),t.unix=e.from("0190","hex"),t.p2p=e.from("01a5","hex"),t.ipfs=e.from("01a5","hex"),t.https=e.from("01bb","hex"),t.onion=e.from("01bc","hex"),t.onion3=e.from("01bd","hex"),t.garlic64=e.from("01be","hex"),t.garlic32=e.from("01bf","hex"),t.quic=e.from("01cc","hex"),t.ws=e.from("01dd","hex"),t.wss=e.from("01de","hex"),t["p2p-websocket-star"]=e.from("01df","hex"),t.http=e.from("01e0","hex"),t.raw=e.from("55","hex"),t["dag-pb"]=e.from("70","hex"),t["dag-cbor"]=e.from("71","hex"),t["libp2p-key"]=e.from("72","hex"),t["git-raw"]=e.from("78","hex"),t["torrent-info"]=e.from("7b","hex"),t["torrent-file"]=e.from("7c","hex"),t["leofcoin-block"]=e.from("81","hex"),t["leofcoin-tx"]=e.from("82","hex"),t["leofcoin-pr"]=e.from("83","hex"),t["eth-block"]=e.from("90","hex"),t["eth-block-list"]=e.from("91","hex"),t["eth-tx-trie"]=e.from("92","hex"),t["eth-tx"]=e.from("93","hex"),t["eth-tx-receipt-trie"]=e.from("94","hex"),t["eth-tx-receipt"]=e.from("95","hex"),t["eth-state-trie"]=e.from("96","hex"),t["eth-account-snapshot"]=e.from("97","hex"),t["eth-storage-trie"]=e.from("98","hex"),t["bitcoin-block"]=e.from("b0","hex"),t["bitcoin-tx"]=e.from("b1","hex"),t["zcash-block"]=e.from("c0","hex"),t["zcash-tx"]=e.from("c1","hex"),t["stellar-block"]=e.from("d0","hex"),t["stellar-tx"]=e.from("d1","hex"),t["decred-block"]=e.from("e0","hex"),t["decred-tx"]=e.from("e1","hex"),t["dash-block"]=e.from("f0","hex"),t["dash-tx"]=e.from("f1","hex"),t["swarm-manifest"]=e.from("fa","hex"),t["swarm-feed"]=e.from("fb","hex"),t["dag-json"]=e.from("0129","hex"),t.path=e.from("2f","hex"),t["ipld-ns"]=e.from("e2","hex"),t["ipfs-ns"]=e.from("e3","hex"),t["swarm-ns"]=e.from("e4","hex"),t["ed25519-pub"]=e.from("ed","hex"),t["holochain-adr-v0"]=e.from("807124","hex"),t["holochain-adr-v1"]=e.from("817124","hex"),t["holochain-key-v0"]=e.from("947124","hex"),t["holochain-key-v1"]=e.from("957124","hex"),t["holochain-sig-v0"]=e.from("a27124","hex"),t["holochain-sig-v1"]=e.from("a37124","hex")}).call(this,n(0).Buffer)},function(e,t,n){"use strict";(function(r){const i=n(9),o=n(23),s=n(39);class a{constructor(e,t,n){o(n,"A link requires a cid to point to"),this._name=e||"",this._nameBuf=null,this._size=t,this._cid=new i(n)}toString(){return`DAGLink <${this._cid.toBaseEncodedString()} - name: "${this.name}", size: ${this.size}>`}toJSON(){return this._json||(this._json=Object.freeze({name:this.name,size:this.size,cid:this._cid.toBaseEncodedString()})),Object.assign({},this._json)}get name(){return this._name}get nameAsBuffer(){return null!==this._nameBuf?this._nameBuf:(this._nameBuf=r.from(this._name),this._nameBuf)}set name(e){throw new Error("Can't set property: 'name' is immutable")}get size(){return this._size}set size(e){throw new Error("Can't set property: 'size' is immutable")}get cid(){return this._cid}set cid(e){throw new Error("Can't set property: 'cid' is immutable")}}t=e.exports=s(a,{className:"DAGLink",symbolName:"@ipld/js-ipld-dag-pb/daglink"}),t.create=n(728),t.util=n(729)}).call(this,n(0).Buffer)},function(e,t,n){var r=n(20);e.exports=r.md=r.md||{},r.md.algorithms=r.md.algorithms||{}},function(e,t,n){"use strict";var r=n(11),i=Object.keys||function(e){var t=[];for(var n in e)t.push(n);return t};e.exports=h;var o=n(8);o.inherits=n(3);var s=n(379),a=n(257);o.inherits(h,s);for(var l=i(a.prototype),u=0;u{const n=["bitswap"];t&&n.push(t),e&&n.push(`${e.toB58String().slice(0,8)}`);const i=r(n.join(":"));return i.error=r(n.concat(["error"]).join(":")),i},o=(e,t,n)=>{let r=0;const i=n.length;for(;r{let n=0;const r=t.length,i=[];let s;for(;nt.reduce((t,n)=>{const r=e(n);return t[r]?t[r].push(n):t[r]=[n],t},{}),l=(e,t,n)=>t.filter(t=>!o(e,t,n)),u=(e,t)=>Array.prototype.slice.call(t,0).sort((t,n)=>{const r=e(t),i=e(n);return ri?1:0});e.exports={logger:i,includesWith:o,uniqWith:s,groupBy:a,pullAllWith:l,sortBy:u}},function(e,t,n){"use strict";(function(t,r){var i=65536,o=4294967295;function s(){throw new Error("Secure random number generation is not supported by this browser.\nUse Chrome, Firefox or Internet Explorer 11")}var a=n(5).Buffer,l=t.crypto||t.msCrypto;function u(e,t){if(e>o)throw new RangeError("requested too many random bytes");var n=a.allocUnsafe(e);if(e>0)if(e>i)for(var s=0;s{setTimeout(()=>{n(t)},e)})}class a{constructor(e){}static setup0(e){throw new o.IntentionallyUnimplementedError("Intentionally undefined function Transport.setup0 should have been subclassed")}p_setup1(e){return this}p_setup2(e){return this}static async p_setup(e,t){let n=await this.setup0(e).p_setup1(t);return n.p_setup2(t)}stop(e,t){this.status=a.STATUS_FAILED,e&&e(this),t(null,this)}togglePaused(e){switch(this.status){case a.STATUS_CONNECTED:this.status=a.STATUS_PAUSED;break;case a.STATUS_PAUSED:this.status=a.STATUS_CONNECTED;break;case a.STATUS_LOADED:this.p_setup1(e).then(t=>t.p_setup2(e))}e&&e(this)}async p_status(){return this.status}connected(){return!this.status}supports(e,t,{noCache:n}={}){if("string"==typeof e&&(e=r.parse(e)),e&&!e.protocol)throw new Error("URL failed to specific a scheme (before :) "+e.href);return(!e||this.supportURLs.includes(e.protocol.slice(0,-1)))&&(!t||this.supportFunctions.includes(t))&&(!n||this.supportFeatures.includes("noCache"))}validFor(e,t,n){return this.connected()&&this.supports(e,t,n)}p_rawstore(e,t){throw new o.ToBeImplementedError("Intentionally undefined function Transport.p_rawstore should have been subclassed")}async p_rawstoreCaught(e){try{return await this.p_rawstore(e)}catch(e){}}p_store(){throw new o.ToBeImplementedError("Undefined function Transport.p_store - may define higher level semantics here (see Python)")}p_rawfetch(e,{timeoutMS:t,start:n,end:r,relay:i=!1}={}){return console.assert(!1,"Intentionally undefined function Transport.p_rawfetch should have been subclassed"),"UNIMPLEMENTED"}p_fetch(){throw new o.ToBeImplementedError("Undefined function Transport.p_fetch - may define higher level semantics here (see Python)")}p_rawadd(e,t){throw new o.ToBeImplementedError("Undefined function Transport.p_rawadd")}p_rawlist(e){throw new o.ToBeImplementedError("Undefined function Transport.p_rawlist")}p_list(){throw new Error("Undefined function Transport.p_list")}p_newlisturls(e){throw new Error("undefined function Transport.p_newlisturls")}p_rawreverse(e){throw new o.ToBeImplementedError("Undefined function Transport.p_rawreverse")}listmonitor(e,t,{current:n=!1}={}){console.log("Undefined function Transport.listmonitor")}async p_newdatabase(e){throw new o.ToBeImplementedError("Undefined function Transport.p_newdatabase")}async p_newtable(e,t){throw new o.ToBeImplementedError("Undefined function Transport.p_newtable")}async p_set(e,t,n){throw new o.ToBeImplementedError("Undefined function Transport.p_set")}async p_get(e,t){throw new o.ToBeImplementedError("Undefined function Transport.p_get")}async p_delete(e,t){throw new o.ToBeImplementedError("Undefined function Transport.p_delete")}async p_keys(e){throw new o.ToBeImplementedError("Undefined function Transport.p_keys")}async p_getall(e){throw new o.ToBeImplementedError("Undefined function Transport.p_keys")}static async p_f_createReadStream(e,{wanturl:t=!1}){}static mergeoptions(e){let t={};for(let n=0;n",r),console.assert("bar"===r.testkey2.foo&&2===r.testkey3[1]&&!r.testkey),await s(200),console.log(this.name,"p_test_kvt complete")}catch(e){throw console.log("Exception thrown in ",this.name,"p_test_kvt:",e.message),e}}}a.STATUS_CONNECTED=0,a.STATUS_FAILED=1,a.STATUS_STARTING=2,a.STATUS_LOADED=3,a.STATUS_PAUSED=4,a.STATUSTEXT=["Connected","Failed","Starting","Loaded","Paused"],t=e.exports=a},function(e,t,n){"use strict";function r(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,e.__proto__=t}var i={};function o(e,t,n){function o(e,n,r){return"string"==typeof t?t:t(e,n,r)}n||(n=Error);var s=function(e){function t(t,n,r){return e.call(this,o(t,n,r))||this}return r(t,e),t}(n);s.prototype.name=n.name,s.prototype.code=e,i[e]=s}function s(e,t){if(Array.isArray(e)){var n=e.length;return e=e.map(function(e){return String(e)}),n>2?"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))}function a(e,t,n){return e.substr(!n||n<0?0:+n,t.length)===t}function l(e,t,n){return(void 0===n||n>e.length)&&(n=e.length),e.substring(n-t.length,n)===t}function u(e,t,n){return"number"!=typeof n&&(n=0),!(n+t.length>e.length)&&-1!==e.indexOf(t,n)}o("ERR_INVALID_OPT_VALUE",function(e,t){return'The value "'+t+'" is invalid for option "'+e+'"'},TypeError),o("ERR_INVALID_ARG_TYPE",function(e,t,n){var r,i;if("string"==typeof t&&a(t,"not ")?(r="must not be",t=t.replace(/^not /,"")):r="must be",l(e," argument"))i="The ".concat(e," ").concat(r," ").concat(s(t,"type"));else{var o=u(e,".")?"property":"argument";i='The "'.concat(e,'" ').concat(o," ").concat(r," ").concat(s(t,"type"))}return i+=". Received type ".concat(typeof n),i},TypeError),o("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),o("ERR_METHOD_NOT_IMPLEMENTED",function(e){return"The "+e+" method is not implemented"}),o("ERR_STREAM_PREMATURE_CLOSE","Premature close"),o("ERR_STREAM_DESTROYED",function(e){return"Cannot call "+e+" after a stream was destroyed"}),o("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),o("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),o("ERR_STREAM_WRITE_AFTER_END","write after end"),o("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),o("ERR_UNKNOWN_ENCODING",function(e){return"Unknown encoding: "+e},TypeError),o("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),e.exports.codes=i},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=u;var i=n(333),o=n(337);n(3)(u,i);for(var s=r(o.prototype),a=0;a{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=a.varintBufferDecode(e),n=s[t.toString("hex")];if(void 0===n)throw new Error("Code `0x"+t.toString("hex")+"` not found");return n}),t.getName=(e=>s[e.toString(16)]),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 l=n(681);Object.assign(t,l),t.print=n(682)}).call(this,n(0).Buffer)},function(e,t,n){"use strict";var r=n(341);e.exports=function e(t,n){return function(e,i){if(e)return r(i,e,n);if(null!=t){var o=t;t=null,i(null,o)}else i(!0)}}},function(e,t,n){var r=n(20);n(30),n(150);var i=e.exports=r.asn1=r.asn1||{};function o(e,t,n){if(n>t){var r=new Error("Too few bytes to parse DER.");throw r.available=e.length(),r.remaining=t,r.requested=n,r}}i.Class={UNIVERSAL:0,APPLICATION:64,CONTEXT_SPECIFIC:128,PRIVATE:192},i.Type={NONE:0,BOOLEAN:1,INTEGER:2,BITSTRING:3,OCTETSTRING:4,NULL:5,OID:6,ODESC:7,EXTERNAL:8,REAL:9,ENUMERATED:10,EMBEDDED:11,UTF8:12,ROID:13,SEQUENCE:16,SET:17,PRINTABLESTRING:19,IA5STRING:22,UTCTIME:23,GENERALIZEDTIME:24,BMPSTRING:30},i.create=function(e,t,n,o,s){if(r.util.isArray(o)){for(var a=[],l=0;lt){if(r.strict){var m=new Error("Too few bytes to read ASN.1 value.");throw m.available=e.length(),m.remaining=t,m.requested=f,m}f=t}var g=32==(32&u);if(g)if(p=[],void 0===f)for(;;){if(o(e,t,2),e.bytes(2)===String.fromCharCode(0,0)){e.getBytes(2),t-=2;break}l=e.length(),p.push(a(e,t,n+1,r)),t-=l-e.length()}else for(;f>0;)l=e.length(),p.push(a(e,f,n+1,r)),t-=l-e.length(),f-=l-e.length();if(void 0===p&&c===i.Class.UNIVERSAL&&h===i.Type.BITSTRING&&(d=e.bytes(f)),void 0===p&&r.decodeBitStrings&&c===i.Class.UNIVERSAL&&h===i.Type.BITSTRING&&f>1){var y=e.read,v=t,b=0;if(h===i.Type.BITSTRING&&(o(e,t,1),b=e.getByte(),t--),0===b)try{l=e.length();var _={verbose:r.verbose,strict:!0,decodeBitStrings:!0},w=a(e,t,n+1,_),k=l-e.length();t-=k,h==i.Type.BITSTRING&&k++;var E=w.tagClass;k!==f||E!==i.Class.UNIVERSAL&&E!==i.Class.CONTEXT_SPECIFIC||(p=[w])}catch(e){}void 0===p&&(e.read=y,t=v)}if(void 0===p){if(void 0===f){if(r.strict)throw new Error("Non-constructed ASN.1 object of indefinite length.");f=t}if(h===i.Type.BMPSTRING)for(p="";f>0;f-=2)o(e,t,2),p+=String.fromCharCode(e.getInt16()),t-=2;else p=e.getBytes(f)}var S=void 0===d?null:{bitStringContents:d};return i.create(c,h,g,p,S)}i.fromDer=function(e,t){return void 0===t&&(t={strict:!0,decodeBitStrings:!0}),"boolean"==typeof t&&(t={strict:t,decodeBitStrings:!0}),"strict"in t||(t.strict=!0),"decodeBitStrings"in t||(t.decodeBitStrings=!0),"string"==typeof e&&(e=r.util.createBuffer(e)),a(e,e.length(),0,t)},i.toDer=function(e){var t=r.util.createBuffer(),n=e.tagClass|e.type,o=r.util.createBuffer(),s=!1;if("bitStringContents"in e&&(s=!0,e.original&&(s=i.equals(e,e.original))),s)o.putBytes(e.bitStringContents);else if(e.composed){e.constructed?n|=32:o.putByte(0);for(var a=0;a1&&(0===e.value.charCodeAt(0)&&0==(128&e.value.charCodeAt(1))||255===e.value.charCodeAt(0)&&128==(128&e.value.charCodeAt(1)))?o.putBytes(e.value.substr(1)):o.putBytes(e.value);if(t.putByte(n),o.length()<=127)t.putByte(127&o.length());else{var l=o.length(),u="";do{u+=String.fromCharCode(255&l),l>>>=8}while(l>0);t.putByte(128|u.length);for(var a=u.length-1;a>=0;--a)t.putByte(u.charCodeAt(a))}return t.putBuffer(o),t},i.oidToDer=function(e){var t=e.split("."),n=r.util.createBuffer(),i,o,s,a;n.putByte(40*parseInt(t[0],10)+parseInt(t[1],10));for(var l=2;l>>=7,i||(a|=128),o.push(a),i=!1}while(s>0);for(var u=o.length-1;u>=0;--u)n.putByte(o[u])}return n},i.derToOid=function(e){var t;"string"==typeof e&&(e=r.util.createBuffer(e));var n=e.getByte();t=Math.floor(n/40)+"."+n%40;for(var i=0;e.length()>0;)n=e.getByte(),i<<=7,128&n?i+=127&n:(t+="."+(i+n),i=0);return t},i.utcTimeToDate=function(e){var t=new Date,n=parseInt(e.substr(0,2),10);n=n>=50?1900+n:2e3+n;var r=parseInt(e.substr(2,2),10)-1,i=parseInt(e.substr(4,2),10),o=parseInt(e.substr(6,2),10),s=parseInt(e.substr(8,2),10),a=0;if(e.length>11){var l=e.charAt(10),u=10;"+"!==l&&"-"!==l&&(a=parseInt(e.substr(10,2),10),u+=2)}if(t.setUTCFullYear(n,r,i),t.setUTCHours(o,s,a,0),u&&(l=e.charAt(u),"+"===l||"-"===l)){var c=parseInt(e.substr(u+1,2),10),h=parseInt(e.substr(u+4,2),10),f=60*c+h;f*=6e4,"+"===l?t.setTime(+t-f):t.setTime(+t+f)}return t},i.generalizedTimeToDate=function(e){var t=new Date,n=parseInt(e.substr(0,4),10),r=parseInt(e.substr(4,2),10)-1,i=parseInt(e.substr(6,2),10),o=parseInt(e.substr(8,2),10),s=parseInt(e.substr(10,2),10),a=parseInt(e.substr(12,2),10),l=0,u=0,c=!1;"Z"===e.charAt(e.length-1)&&(c=!0);var h=e.length-5,f=e.charAt(h);if("+"===f||"-"===f){var p=parseInt(e.substr(h+1,2),10),d=parseInt(e.substr(h+4,2),10);u=60*p+d,u*=6e4,"+"===f&&(u*=-1),c=!0}return"."===e.charAt(14)&&(l=1e3*parseFloat(e.substr(14),10)),c?(t.setUTCFullYear(n,r,i),t.setUTCHours(o,s,a,l),t.setTime(+t+u)):(t.setFullYear(n,r,i),t.setHours(o,s,a,l)),t},i.dateToUtcTime=function(e){if("string"==typeof e)return e;var t="",n=[];n.push((""+e.getUTCFullYear()).substr(2)),n.push(""+(e.getUTCMonth()+1)),n.push(""+e.getUTCDate()),n.push(""+e.getUTCHours()),n.push(""+e.getUTCMinutes()),n.push(""+e.getUTCSeconds());for(var r=0;r=-128&&e<128)return t.putSignedInt(e,8);if(e>=-32768&&e<32768)return t.putSignedInt(e,16);if(e>=-8388608&&e<8388608)return t.putSignedInt(e,24);if(e>=-2147483648&&e<2147483648)return t.putSignedInt(e,32);var n=new Error("Integer too large; max is 32-bits.");throw n.integer=e,n},i.derToInteger=function(e){"string"==typeof e&&(e=r.util.createBuffer(e));var t=8*e.length();if(t>32)throw new Error("Integer too large; max is 32-bits.");return e.getSignedInt(t)},i.validate=function(e,t,n,o){var s=!1;if(e.tagClass!==t.tagClass&&void 0!==t.tagClass||e.type!==t.type&&void 0!==t.type)o&&(e.tagClass!==t.tagClass&&o.push("["+t.name+'] Expected tag class "'+t.tagClass+'", got "'+e.tagClass+'"'),e.type!==t.type&&o.push("["+t.name+'] Expected type "'+t.type+'", got "'+e.type+'"'));else if(e.constructed===t.constructed||void 0===t.constructed){if(s=!0,t.value&&r.util.isArray(t.value))for(var a=0,l=0;s&&l0&&(o+="\n");for(var s="",a=0;a1?o+="0x"+r.util.bytesToHex(e.value.slice(1)):o+="(none)",e.value.length>0){var f=e.value.charCodeAt(0);1==f?o+=" (1 unused bit shown)":f>1&&(o+=" ("+f+" unused bits shown)")}}else e.type===i.Type.OCTETSTRING?(l.test(e.value)||(o+="("+e.value+") "),o+="0x"+r.util.bytesToHex(e.value)):e.type===i.Type.UTF8?o+=r.util.decodeUtf8(e.value):e.type===i.Type.PRINTABLESTRING||e.type===i.Type.IA5String?o+=e.value:l.test(e.value)?o+="0x"+r.util.bytesToHex(e.value):0===e.value.length?o+="[null]":o+=e.value}return o}},function(e,t,n){var r=n(20);n(194),n(735),n(736),n(30),r.random&&r.random.getBytes?e.exports=r.random:function(t){var n={},i=new Array(4),o=r.util.createBuffer();function s(){var e=r.prng.create(n);return e.getBytes=function(t,n){return e.generate(t,n)},e.getBytesSync=function(t){return e.generate(t)},e}n.formatKey=function(e){var t=r.util.createBuffer(e);return e=new Array(4),e[0]=t.getInt32(),e[1]=t.getInt32(),e[2]=t.getInt32(),e[3]=t.getInt32(),r.aes._expandKey(e,!1)},n.formatSeed=function(e){var t=r.util.createBuffer(e);return e=new Array(4),e[0]=t.getInt32(),e[1]=t.getInt32(),e[2]=t.getInt32(),e[3]=t.getInt32(),e},n.cipher=function(e,t){return r.aes._updateBlock(e,t,i,!1),o.putInt32(i[0]),o.putInt32(i[1]),o.putInt32(i[2]),o.putInt32(i[3]),o.getBytes()},n.increment=function(e){return++e[3],e},n.md=r.md.sha256;var a=s(),l=null;if("undefined"!=typeof window){var u=window.crypto||window.msCrypto;u&&u.getRandomValues&&(l=function(e){return u.getRandomValues(e)})}if(r.options.usePureJavaScript||!r.util.isNodejs&&!l){if("undefined"==typeof window||window.document,a.collectInt(+new Date,32),"undefined"!=typeof navigator){var c="";for(var h in navigator)try{"string"==typeof navigator[h]&&(c+=navigator[h])}catch(e){}a.collect(c),c=null}t&&(t().mousemove(function(e){a.collectInt(e.clientX,16),a.collectInt(e.clientY,16)}),t().keypress(function(e){a.collectInt(e.charCode,8)}))}if(r.random)for(var h in a)r.random[h]=a[h];else r.random=a;r.random.createInstance=s,e.exports=r.random}("undefined"!=typeof jQuery?jQuery:null)},function(e,t,n){"use strict";const r=t;r.bignum=n(745),r.define=n(747).define,r.base=n(151),r.constants=n(373),r.decoders=n(752),r.encoders=n(754)},function(e,t,n){var r=n(5).Buffer;function i(e,t){this._block=r.alloc(e),this._finalSize=t,this._blockSize=e,this._len=0}i.prototype.update=function(e,t){"string"==typeof e&&(t=t||"utf8",e=r.from(e,t));for(var n=this._block,i=this._blockSize,o=e.length,s=this._len,a=0;a=this._finalSize&&(this._update(this._block),this._block.fill(0));var n=8*this._len;if(n<=4294967295)this._block.writeUInt32BE(n,this._blockSize-4);else{var r=(4294967295&n)>>>0,i=(n-r)/4294967296;this._block.writeUInt32BE(i,this._blockSize-8),this._block.writeUInt32BE(r,this._blockSize-4)}this._update(this._block);var o=this._hash();return e?o.toString(e):o},i.prototype._update=function(){throw new Error("_update must be implemented by subclass")},e.exports=i},function(e,t,n){var r=n(402),i=n(403);function o(e,t,n){var o=t&&n||0;"string"==typeof e&&(t="binary"===e?new Array(16):null,e=null),e=e||{};var s=e.random||(e.rng||r)();if(s[6]=15&s[6]|64,s[8]=63&s[8]|128,t)for(var a=0;a<16;++a)t[o+a]=s[a];return t||i(s)}e.exports=o},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(428),i=a(r),o=n(109),s=a(o);function a(e){return e&&e.__esModule?e:{default:e}}t.default=(0,s.default)(i.default,1),e.exports=t.default},function(e,t,n){"use strict";e.exports={Record:n(904),validator:n(907),selection:n(915)}},function(e,t,n){function r(e){if(e)return i(e)}function i(e){for(var t in r.prototype)e[t]=r.prototype[t];return e}e.exports=r,r.prototype.on=r.prototype.addEventListener=function(e,t){return this._callbacks=this._callbacks||{},(this._callbacks["$"+e]=this._callbacks["$"+e]||[]).push(t),this},r.prototype.once=function(e,t){function n(){this.off(e,n),t.apply(this,arguments)}return n.fn=t,this.on(e,n),this},r.prototype.off=r.prototype.removeListener=r.prototype.removeAllListeners=r.prototype.removeEventListener=function(e,t){if(this._callbacks=this._callbacks||{},0==arguments.length)return this._callbacks={},this;var n=this._callbacks["$"+e],r;if(!n)return this;if(1==arguments.length)return delete this._callbacks["$"+e],this;for(var i=0;i1?{type:p[i],data:e.substring(1)}:{type:p[i]}:d}var s=new Uint8Array(e),i=s[0],a=o(e,1);return m&&"blob"===n&&(a=new m([a])),{type:p[i],data:a}},t.decodeBase64Packet=function(e,t){var n=p[e.charAt(0)];if(!l)return{type:n,data:{base64:!0,data:e.substr(1)}};var r=l.decode(e.substr(1));return"blob"===t&&m&&(r=new m([r])),{type:n,data:r}},t.encodePayload=function(e,n,r){"function"==typeof n&&(r=n,n=null);var o=i(e);if(n&&o)return m&&!h?t.encodePayloadAsBlob(e,r):t.encodePayloadAsArrayBuffer(e,r);if(!e.length)return r("0:");function s(e){return e.length+":"+e}function a(e,r){t.encodePacket(e,!!o&&n,!1,function(e){r(null,s(e))})}w(e,a,function(e,t){return r(t.join(""))})},t.decodePayload=function(e,n,r){if("string"!=typeof e)return t.decodePayloadAsBinary(e,n,r);var i;if("function"==typeof n&&(r=n,n=null),""===e)return r(d,0,1);for(var o="",s,a,l=0,u=e.length;l0;){for(var a=new Uint8Array(i),l=0===a[0],u="",c=1;255!==a[c];c++){if(u.length>310)return r(d,0,1);u+=a[c]}i=o(i,2+u.length),u=parseInt(u);var h=o(i,0,u);if(l)try{h=String.fromCharCode.apply(null,new Uint8Array(h))}catch(e){var f=new Uint8Array(h);h="";for(var c=0;c{const n=r(e,t);return(e,t,r)=>{n(e,t,(e,t)=>{if(e)return r(e);r(null,t[0])})}})},function(e,t,n){"use strict";var r=n(11),i=Object.keys||function(e){var t=[];for(var n in e)t.push(n);return t};e.exports=h;var o=n(8);o.inherits=n(3);var s=n(552),a=n(555);o.inherits(h,s);for(var l=i(a.prototype),u=0;u=t)throw new Error("Cannot access property/index "+r+" levels up, current level is "+t);return n[t-r]}if(r>t)throw new Error("Cannot access data "+r+" levels up, current level is "+t);if(o="data"+(t-r||""),!i)return o}for(var a=o,l=i.split("/"),u=0;u=0||1/0===e||-1/0===e)}},t.text={is:function(e){return"string"==typeof e}},t.text.ify=function(e){return t.text.is(e)?e:"undefined"!=typeof JSON?JSON.stringify(e):e&&e.toString?e.toString():e},t.text.random=function(e,t){var n="";for(e=e||24,t=t||"0123456789ABCDEFGHIJKLMNOPQRSTUVWXZabcdefghijklmnopqrstuvwxyz";e>0;)n+=t.charAt(Math.floor(Math.random()*t.length)),e--;return n},t.text.match=function(e,t){var n,r;return"string"==typeof e&&("string"==typeof t&&(t={"=":t}),t=t||{},n=t["="]||t["*"]||t[">"]||t["<"],e===n||r===t["="]&&(n=t["*"]||t[">"]||t["<"],e.slice(0,(n||"").length)===n||r===t["*"]&&(r!==t[">"]&&r!==t["<"]?e>=t[">"]&&e<=t["<"]:r!==t[">"]&&e>=t[">"]||r!==t["<"]&&e<=t["<"])))},t.list={is:function(e){return e instanceof Array}},t.list.slit=Array.prototype.slice,t.list.sort=function(e){return function(t,n){return t&&n?(t=t[e],n=n[e],tn?1:0):0}},t.list.map=function(e,t,n){return a(e,t,n)},t.list.index=1,t.obj={is:function(e){return!!e&&(e instanceof Object&&e.constructor===Object||"Object"===Object.prototype.toString.call(e).match(/^\[object (\w+)\]$/)[1])}},t.obj.put=function(e,t,n){return(e||{})[t]=n,e},t.obj.has=function(e,t){return e&&Object.prototype.hasOwnProperty.call(e,t)},t.obj.del=function(e,t){if(e)return e[t]=null,delete e[t],e},t.obj.as=function(e,t,n,r){return e[t]=e[t]||(r===n?{}:n)},t.obj.ify=function(e){if(o(e))return e;try{e=JSON.parse(e)}catch(t){e={}}return e},function(){var e;function n(t,n){s(this,n)&&e!==this[n]||(this[n]=t)}t.obj.to=function(e,t){return t=t||{},a(e,n,t),t}}(),t.obj.copy=function(e){return e?JSON.parse(JSON.stringify(e)):e},function(){function e(e,t){var n=this.n;if(!n||!(t===n||o(n)&&s(n,t)))return!!t||void 0}t.obj.empty=function(t,n){return!t||!a(t,e,{n:n})}}(),function(){function e(t,n){if(2===arguments.length)return e.r=e.r||{},void(e.r[t]=n);e.r=e.r||[],e.r.push(t)}var i=Object.keys;t.obj.map=function(a,l,u){var c,h=0,f,p,d,m,g=n(l);if(e.r=null,i&&o(a)&&(d=i(a),m=!0),r(a)||d)for(f=(d||a).length;h",r.drift=0,r.is=function(e,t,n){var i=t&&e&&e[w]&&e[w][r._]||n;if(i)return v(i=i[t])?i:-1/0},r.lex=function(){return r().toString(36).replace(".","")},r.ify=function(e,t,i,o,s){if(!e||!e[w]){if(!s)return;e=n.soul.ify(e,s)}var a=f(e[w],r._);return k!==t&&t!==w&&(v(i)&&(a[t]=i),k!==o&&(e[t]=o)),e},r.to=function(e,t,i){var o=(e||{})[t];return d(o)&&(o=g(o)),r.ify(i,t,r.is(e,t),o,n.soul(e))},function(){function e(e,t){w!==t&&r.ify(this.o,t,this.s)}r.map=function(t,n,i){var o,s=d(s=t||n)?s:null;return t=_(t=t||n)?t:null,s&&!t?(n=v(n)?n:r(),s[w]=s[w]||{},m(s,e,{o:s,s:n}),s):(i=i||d(n)?n:o,n=v(n)?n:r(),function(r,s,a,l){if(!t)return e.call({o:a,s:n},r,s),r;t.call(i||this||{},r,s,a,l),p(a,s)&&o===a[s]||e.call({o:a,s:n},r,s)})}}();var h=t.obj,f=h.as,p=h.has,d=h.is,m=h.map,g=h.copy,y=t.num,v=y.is,b=t.fn,_=b.is,w=n._,k;e.exports=r})(o,"./state"),o(function(e){var t=o("./type"),n=o("./val"),r=o("./node"),i={};!function(){function e(e,n){if(!e||n!==r.soul(e)||!r.is(e,this.fn,this.as))return!0;this.cb&&(t.n=e,t.as=this.as,this.cb.call(t.as,e,n,t))}function t(e){e&&r.is(t.n,e,t.as)}i.is=function(t,n,r,i){return!(!t||!l(t)||h(t))&&!p(t,e,{cb:n,fn:r,as:i})}}(),function(){function e(e,t){var i;return(i=h(e,t))?i:(t.env=e,t.soul=s,r.ify(t.obj,o,t)&&(t.link=t.link||n.link.ify(r.soul(t.node)),t.obj!==e.shell&&(e.graph[n.link.is(t.link)]=t.node)),t)}function o(t,i,o){var s=this,l=s.env,h,f;if(r._===i&&c(t,n.link._))return o._;if(h=a(t,i,o,s,l)){if(i||(s.node=s.node||o||{},c(t,r._)&&r.soul(t)&&(s.node._=d(t._)),s.node=r.soul.ify(s.node,n.link.is(s.link)),s.link=s.link||n.link.ify(r.soul(s.node))),(f=l.map)&&(f.call(l.as||{},t,i,o,s),c(o,i))){if(t=o[i],m===t)return void u(o,i);if(!(h=a(t,i,o,s,l)))return}if(!i)return s.node;if(!0===h)return t;if(f=e(l,{obj:t,path:s.path.concat(i)}),f.node)return f.link}}function s(e){var t=this,i=n.link.is(t.link),o=t.env.graph;t.link=t.link||n.link.ify(e),t.link[n.link._]=e,t.node&&t.node[r._]&&(t.node[r._][n.link._]=e),c(o,i)&&(o[e]=o[i],u(o,i))}function a(e,r,i,o,s){var u;return!!n.is(e)||(l(e)?1:(u=s.invalid)?(e=u.call(s.as||{},e,r,i),a(e,r,i,o,s)):(s.err="Invalid value at '"+o.path.concat(r).join(".")+"'!",void(t.list.is(e)&&(s.err+=" Use `.set(item)` instead of an Array."))))}function h(e,t){for(var n=e.seen,r=n.length,i;r--;)if(i=n[r],t.obj===i.obj)return i;n.push(t)}i.ify=function(t,r,i){var o={path:[],obj:t};return r?"string"==typeof r?r={soul:r}:r instanceof Function&&(r.map=r):r={},r.soul&&(o.link=n.link.ify(r.soul)),r.shell=(i||{}).shell,r.graph=r.graph||{},r.seen=r.seen||[],r.as=r.as||i,e(r,o),r.root=o.node,r.graph}}(),i.node=function(e){var t=r.soul(e);if(t)return f({},t,e)},function(){function e(e,t){var o,s;if(r._!==t)(o=n.link.is(e))?(s=this.opt.seen[o])?this.obj[t]=s:this.obj[t]=this.opt.seen[o]=i.to(this.graph,o,this.opt):this.obj[t]=e;else{if(h(e,n.link._))return;this.obj[t]=d(e)}}i.to=function(t,n,r){if(t){var i={};return r=r||{seen:{}},p(t[n],e,{obj:i,graph:t,opt:r}),i}}}();var s=t.fn.is,a=t.obj,l=a.is,u=a.del,c=a.has,h=a.empty,f=a.put,p=a.map,d=a.copy,m;e.exports=i})(o,"./graph"),o(function(e){o("./onto"),e.exports=function e(t,n){if(this.on){if(!(t instanceof Function)){if(!t||!n)return;var r=t["#"]||t,i=(this.tag||empty)[r];if(!i)return;return i=this.on(r,n),clearTimeout(i.err),!0}var r=n&&n["#"]||Math.random().toString(36).slice(2);if(!t)return r;var o=this.on(r,t,n);return o.err=o.err||setTimeout(function(){o.next({err:"Error: No ACK received yet.",lack:!0}),o.off()},(this.opt||{}).lack||9e3),r}}})(o,"./ask"),o(function(e){var t=o("./type");function n(e){var n={s:{}};return e=e||{max:1e3,age:9e3},n.check=function(e){var t;return!!(t=n.s[e])&&(t.pass?t.pass=!1:n.track(e))},n.track=function(i,o){var s=n.s[i]||(n.s[i]={});return s.was=r(),o&&(s.pass=!0),n.to||(n.to=setTimeout(function(){var i=r();t.obj.map(n.s,function(r,o){r&&e.age>i-r.was||t.obj.del(n.s,o)}),n.to=null},e.age+9)),s},n}var r=t.time.is;e.exports=n})(o,"./dup"),o(function(e){function t(e){return e instanceof t?(this._={gun:this,$:this}).$:this instanceof t?t.create(this._={gun:this,$:this,opt:e}):new t(e)}t.is=function(e){return e instanceof t||e&&e._&&e===e._.$||!1},t.version=.9,t.chain=t.prototype,t.chain.toJSON=function(){};var n=o("./type");n.obj.to(n,t),t.HAM=o("./HAM"),t.val=o("./val"),t.node=o("./node"),t.state=o("./state"),t.graph=o("./graph"),t.on=o("./onto"),t.ask=o("./ask"),t.dup=o("./dup"),function(){function e(n){var r=this,i=r.as,o=i.at||i,s=o.$,a,l;(l=n["#"])||(l=n["#"]=u(9)),(a=o.dup).check(l)?i.out===n.out&&(n.out=k,r.to.next(n)):(a.track(l),o.ask(n["@"],n)||(n.get&&t.on.get(n,s),n.put&&t.on.put(n,s)),r.to.next(n),i.out||(n.out=e,o.on("out",n)))}t.create=function(n){n.root=n.root||n,n.graph=n.graph||{},n.on=n.on||t.on,n.ask=n.ask||t.ask,n.dup=n.dup||t.dup();var r=n.$.opt(n.opt);return n.once||(n.on("in",e,n),n.on("out",e,{at:n,out:e}),t.on("create",n),n.on("create",n)),n.once=1,r}}(),function(){function e(e,n,r,i){var o=this,s=t.state.is(r,n),a;if(!s)return o.err="Error: No state on '"+n+"' in node '"+i+"'!";var l=o.graph[i]||w,u=t.state.is(l,n,!0),c=l[n],h=t.HAM(o.machine,s,u,e,c);h.incoming?(o.put[i]=t.state.to(r,n,o.put[i]),(o.diff||(o.diff={}))[i]=t.state.to(r,n,o.diff[i]),o.souls[i]=!0):h.defer&&(o.defer=s<(o.defer||1/0)?s:o.defer)}function n(e,t){var n=this,s=n.$._,a=(s.next||w)[t];if(!a){if(!(s.opt||w).super)return void(n.souls[t]=!1);a=n.$.get(t)._}var l=n.map[t]={put:e,get:t,$:a.$},u={ctx:n,msg:l};n.async=!!s.tag.node,n.ack&&(l["@"]=n.ack),d(e,r,u),n.async&&(n.and||s.on("node",function(e){this.to.next(e),e===n.map[e.get]&&(n.souls[e.get]=!1,d(e.put,i,e),d(n.souls,function(e){if(e)return e})||n.c||(n.c=1,this.off(),d(n.map,o,n)))}),n.and=!0,s.on("node",l))}function r(e,n){var r=this.ctx,i=r.graph,o=this.msg,s=o.get,a=o.put,l=o.$._,u;i[s]=t.state.to(a,n,i[s]),r.async||(l.put=t.state.to(a,n,l.put))}function i(e,n){var r=this,i=r.put,o=r.$._;o.put=t.state.to(i,n,o.put)}function o(e,t){e.$&&(this.cat.stop=this.stop,e.$._.on("in",e),this.cat.stop=null)}t.on.put=function(r,i){var s=i._,a={$:i,graph:s.graph,put:{},map:{},souls:{},machine:t.state(),ack:r["@"],cat:s,stop:{}};if(t.graph.is(r.put,null,e,a)||(a.err="Error: Invalid graph!"),a.err)return s.on("in",{"@":r["#"],err:t.log(a.err)});d(a.put,n,a),a.async||d(a.map,o,a),k!==a.defer&&setTimeout(function(){t.on.put(r,i)},a.defer-a.machine),a.diff&&s.on("put",p(r,{put:a.diff}))},t.on.get=function(e,n){var r=n._,i=e.get,o=i[y],s=r.graph[o],a=i[v],l,u=r.next||(r.next={}),c=u[o];if(!s)return r.on("get",e);if(a){if("string"!=typeof a||!f(s,a))return r.on("get",e);s=t.state.to(s,a)}else s=t.obj.copy(s);s=t.graph.node(s),l=(c||w).ack,r.on("in",{"@":e["#"],how:"mem",put:s,$:n}),r.on("get",e)}}(),t.chain.opt=function(e){e=e||{};var n=this,i=n._,o=e.peers||e;return h(e)||(e={}),h(i.opt)||(i.opt=e),l(o)&&(o=[o]),r(o)&&(o=d(o,function(e,t,n){t={},t.id=t.url=e,n(e,t)}),h(i.opt.peers)||(i.opt.peers={}),i.opt.peers=p(o,i.opt.peers)),i.opt.peers=i.opt.peers||{},p(e,i.opt),t.on("opt",i),i.opt.uuid=i.opt.uuid||function(){return g()+u(12)},n};var r=t.list.is,a=t.text,l=a.is,u=a.random,c=t.obj,h=c.is,f=c.has,p=c.to,d=c.map,m=c.copy,g=t.state.lex,y=t.val.link._,v=".",b=t.node._,_=t.val.link.is,w={},k;i.debug=function(e,t){return i.debug.i&&e===i.debug.i&&i.debug.i++&&(i.log.apply(i,arguments)||t)},t.log=function(){return!t.log.off&&i.log.apply(i,arguments),[].slice.call(arguments).join(" ")},t.log.once=function(e,n,r){return(r=t.log.once)[e]=r[e]||0,r[e]++||t.log(n)},t.log.once("welcome","Hello wonderful person! :) Thanks for using GUN, feel free to ask for help on https://gitter.im/amark/gun and ask StackOverflow questions tagged with 'gun'!"),"undefined"!=typeof window&&((window.GUN=window.Gun=t).window=window);try{void 0!==s&&(s.exports=t)}catch(e){}e.exports=t})(o,"./root"),o(function(e){var t=o("./root");t.chain.back=function(e,i){var o;if(e=e||1,-1===e||1/0===e)return this._.root.$;if(1===e)return(this._.back||this._).$;var s=this,a=s._;if("string"==typeof e&&(e=e.split(".")),e instanceof Array){for(var l=0,u=e.length,o=a;l(e.acks||0)&&this.off(),e.ack&&e.ack(r,this)},e.opt),i=0,o=n.root.now;f.del(n.root,"now");var s=n.root.mum;n.root.mum={},e.ref._.on("out",{$:e.ref,put:e.out=e.env.graph,opt:e.opt,"#":r}),n.root.mum=s?f.to(s,n.root.mum):s,n.root.now=o},e),e.res&&e.res())}function a(e,t){if(e)return!0}function l(e,n,r,i){var o=this,s=t.is(e);!n&&i.path.length&&(o.res||b)(function(){for(var n=i.path,r=o.ref,a=o.opt,l=0,c=n.length;lc){if((u.stack||(u.stack=[])).push([s,e,i,o]),u.puto)return;return u.puto=setTimeout(function e(){var t=u.stack.splice(0,c),n=0,r;for(u.puta=!0;r=t[n++];)r[0].put(r[1],r[2],r[3]);if(delete u.puta,u.stack.length)return u.puto=setTimeout(e,0);u.stack=u.puts=u.puto=null},0),s}++u.puts}else u.puts=1;return o=o||{},o.data=e,o.via=o.$=o.via||o.$||s,"string"==typeof i?o.soul=i:o.ack=o.ack||i,a.soul&&(o.soul=a.soul),o.soul||l===s?p(o.data)?(o.soul=o.soul||(o.not=t.node.soul(o.data)||(o.via.back("opt.uuid")||t.text.random)()),o.soul?(o.$=l.get(o.soul),o.ref=o.$,n(o),s):(o.via.back("opt.uuid")(function(e,n){if(e)return t.log(e);(o.ref||o.$).put(o.data,o.soul=n,o)}),s)):((o.ack||v).call(o,o.out={err:t.log("Data saved to the root level of the graph must be a node (an object), not a",typeof o.data,'of "'+o.data+'"!')}),o.res&&o.res(),s):t.is(e)?(e.get(function(e,n,r){if(!e)return t.log("The reference you are saving is a",typeof r.put,'"'+r.put+'", not a node (object)!');s.put(t.val.link.ify(e),i,o)},!0),s):(a.has&&(f=t.val.link.is(e))&&(a.dub=f),o.ref=o.ref||l._===(f=a.back)?s:f.$,o.ref._.soul&&t.val.is(o.data)&&a.get?(o.data=d({},a.get,o.data),o.ref.put(o.data,o.soul,o),s):(o.ref.get(h,!0,{as:o}),o.out||(o.res=o.res||r,o.$._.stun=o.ref._.stun),s))};var f=t.obj,p=f.is,d=f.put,m=f.map,g,y={},v=function(){},b=function(e,t){e.call(t||y)},_=t.node._})(o,"./put"),o(function(e){var t=o("./root");o("./chain"),o("./back"),o("./put"),o("./get"),e.exports=t})(o,"./index"),o(function(e){var t=o("./index");function n(e,t){var n=this,r=e.$,i=(r||{})._||{},o=i.put||e.put,s=n.at,a;if(f!==o){if(a=e.$$){if(a=e.$$._,f===a.put)return;o=a.put}n.change&&(o=e.put),n.as?n.ok.call(n.as,e,t):n.ok.call(r,o,e.get,e,t)}}function r(e,n,i){if(e.$){var o=this.as,a=o.at,l=e.$,u=l._,h=u.put||e.put,p,d;(d=e.$$)&&(p=d=e.$$._,f!==p.put&&(h=p.put)),(d=n.wait)&&(d=d[u.id])&&clearTimeout(d),!i&&(f===h||u.soul||u.link||p&&!(0 .once, apologies unexpected."),this.once(e,n)},t.chain.once=function(e,n){var i=this,o=i._,s=o.put;if(0=(t.batch||1e3))return h();s||(s=setTimeout(h,t.wait||1))}),e.on("get",function(t){this.to.next(t);var n=t.get,r,i,o;function s(){if(n&&(r=n["#"])){var s=n["."];i=a[r]||o,i&&s&&(i=Gun.state.to(i,s)),e.on("in",{"@":t["#"],put:Gun.graph.node(i),how:"lS",lS:t.$})}}Gun.debug?setTimeout(s,1):s()});var c=function(e,t,n,r){a[r]=Gun.state.to(n,t,a[r])},h=function(n){var l;o=0,clearTimeout(s),s=!1;var u=i;i={},n&&(a=n);try{r.setItem(t.prefix,JSON.stringify(a))}catch(n){Gun.log(l=(n||"localStorage failure")+" Consider using GUN's IndexedDB plugin for RAD for more storage space, https://gun.eco/docs/RAD#install"),e.on("localStorage:error",{err:l,file:t.prefix,flush:a,retry:h})}(l||Gun.obj.empty(t.peers))&&Gun.obj.map(u,function(t,n){e.on("in",{"@":n,err:l,ok:0})})}}})}})(o,"./adapters/localStorage"),o(function(e){var t=o("../type");function n(e){var n=function(){},o=e.opt||{};o.log=o.log||i.log,o.gap=o.gap||o.wait||1,o.pack=o.pack||.3*(o.memory?1e3*o.memory*1e3:1399e6);var a=e.dup;n.hear=function(r,i){if(r){var u,c,h,f=r[0];if(o.pack<=r.length)return n.say({dam:"!",err:"Message too big!"},i);if("{"!=r[2]&&(n.hear.d+=r.length||0,++n.hear.c),"["!==f){if("{"===f||t.obj.is(r)&&(u=r)){try{u=u||JSON.parse(r)}catch(e){return o.log("DAM JSON parse error",e)}if(!u)return;if((c=u["#"])||(c=u["#"]=t.text.random(9)),a.check(c))return;if(a.track(c,!0).it=u,(h=u["##"])||s===u.put||(h=u["##"]=t.obj.hash(u.put)),h&&(f=u["@"]||u.get&&c)){if(a.check(f+h))return;a.track(f+h,!0).it=u}return(u._=function(){}).via=i,(f=u["><"])&&(u._.to=t.obj.map(f.split(","),l)),u.dam?void((f=n.hear[u.dam])&&f(u,i,e)):void e.on("in",u)}}else{try{u=JSON.parse(r)}catch(e){o.log("DAM JSON parse error",e)}if(!u)return;for(var p=0,d;d=u[p++];)n.hear(d,i)}}};var l=function(e,t,n){n(e,!0)};function u(e,t){try{var r=t.wire;t.say?t.say(e):r.send&&r.send(e),n.say.d+=e.length||0,++n.say.c}catch(n){(t.queue=t.queue||[]).push(e)}}n.hear.c=n.hear.d=0,function(){var e;function i(t){n.say(e,t)}function l(e){var t=e.batch;if(e.batch=e.tail=null,t&&t.length){try{t=1===t.length?t[0]:JSON.stringify(t)}catch(e){return o.log("DAM JSON stringify error",e)}t&&u(t,e)}}n.say=function(c,h){if(this.to&&this.to.next(c),!c)return!1;var f,p,d,m,g=c._||(c._=function(){});if((f=c["#"])||(f=c["#"]=t.text.random(9)),(p=c["##"])||s===c.put||(p=c["##"]=t.obj.hash(c.put)),!(m=g.raw)&&(m=g.raw=n.raw(c),p&&(d=c["@"])&&(a.track(d+p).it=c,d=(a.s[d]||r).it))){if(p===d["##"])return!1;d["##"]=p}if(a.track(f).it=c,h||(h=(d=a.s[c["@"]])&&(d=d.it)&&(d=d._)&&(d=d.via)),!h&&n.way)return n.way(c);if(!h||!h.id)return e=c,!!t.obj.is(h||o.peers)&&void t.obj.map(h||o.peers,i);if(!h.wire&&n.wire&&n.wire(h),f!==h.last){if(h.last=f,h===g.via)return!1;if((d=g.to)&&(d[h.url]||d[h.pid]||d[h.id]))return!1;if(h.batch){if(h.tail=(d=h.tail||0)+m.length,h.tail<=o.pack)return void h.batch.push(m);l(h)}h.batch=[],setTimeout(function(){l(h)},o.gap),u(m,h)}},n.say.c=n.say.d=0}(),function(){n.raw=function(n){if(!n)return"";var r=n._||{},i,s,a;if(a=r.raw)return a;if("string"==typeof n)return n;if(!n.dam){var l=0,u=[];t.obj.map(o.peers,function(e){if(u.push(e.url||e.pid||e.id),++l>9)return!0}),l>1&&(n["><"]=u.join())}var c=e(n);return r&&(r.raw=c),c};var e=JSON.stringify,r=":])([:"}(),n.hi=function(r){var i=r.wire||{};r.id?o.peers[r.url||r.id]=r:(i=r.id=r.id||t.text.random(9),n.say({dam:"?"},o.peers[i]=r)),r.met=r.met||+new Date,i.hied||e.on(i.hied="hi",r),i=r.queue,r.queue=[],t.obj.map(i,function(e){u(e,r)})},n.bye=function(r){t.obj.del(o.peers,r.id),e.on("bye",r);var i=+new Date;i-=r.met||i,n.bye.time=((n.bye.time||i)+i)/2},n.hear["!"]=function(e,t){o.log("Error:",e.err)},n.hear["?"]=function(e,t){e.pid?t.pid||(t.pid=e.pid):n.say({dam:"?",pid:o.pid,"@":e["#"]},t)},e.on("create",function(e){e.opt.pid=e.opt.pid||t.text.random(9),this.to.next(e),e.on("out",n.say)});var c={};return e.on("bye",function(e,t){this.to.next(e),(t=e.url)&&(c[t]=!0,setTimeout(function(){delete c[t]},o.lack||9e3))}),e.on("hi",function(r,i){this.to.next(r),(i=r.url)&&c[i]&&(delete c[i],t.obj.map(e.next,function(o,s){i={},i[s]=e.graph[s],n.say({"##":t.obj.hash(i),get:{"#":s}},r)}))}),n}!function(){t.text.hash=function(e){if("string"!=typeof e)return{err:1};var t=0;if(!e.length)return t;for(var n=0,r=e.length,i;ne&&e.length>0?[e.length+" items inc:",e[e.length-1]]:e),utils.stringfrom=function(e,t={}){try{return"Url"===e.constructor.name?e.href:"string"==typeof e?e:e.toString()}catch(t){throw new r.CodingError(`Unable to turn ${e} into a string ${t.message}`)}},utils.p_timeout=function(e,t,n){let i=null;return Promise.race([new Promise((e,o)=>{i=setTimeout(o,t,new r.TimeoutError(n||`Timed out in ${t}ms`))}),e.then(e=>(clearTimeout(i),e))])},utils.createElement=function(e,t,n){var r=document.createElement(e);for(let e in t){let n="classname"===e.toLowerCase()?"class":e;if("dangerouslySetInnerHTML"===e&&(r.innerHTML=t[e].__html,delete t.dangerouslySetInnerHTML),t.hasOwnProperty(e)){let i=t[e];if(!0===i)r.setAttribute(n,e);else if("object"!=typeof i||Array.isArray(i))!1!==i&&null!=i&&r.setAttribute(n,i.toString());else if(["style"].includes(n))for(let e in i)r[n][e]=i[e];else r[n]=i}}for(let e=2;er.appendChild(null==e.nodeType?document.createTextNode(e.toString()):e)):r.appendChild(null==t.nodeType?document.createTextNode(t.toString()):t))}return r},t=e.exports=utils},function(e,t,n){var r=n(146),i=n(240);function o(e){return null!=e&&i(e.length)&&!r(e)}e.exports=o},function(e,t,n){var r=n(108),i=n(179),o="[object AsyncFunction]",s="[object Function]",a="[object GeneratorFunction]",l="[object Proxy]";function u(e){if(!i(e))return!1;var t=r(e);return t==s||t==a||t==o||t==l}e.exports=u},function(e,t,n){var r=n(645),i=n(652),o=n(145);function s(e){return o(e)?r(e):i(e)}e.exports=s},function(e,t,n){"use strict";e.exports=function e(t,n){var r,i;function o(e){if(r=e,i)return o.abort();!function e(){for(var o=!0,s=!1;o;)if(s=!1,r(null,function(a,l){if(s=!0,a=a||i){if(o=!1,n)n(!0===a?null:a);else if(a&&!0!==a)throw a}else t&&!1===t(l)||i?(o=!1,r(i||!0,n||function(){})):o||e()}),!s)return void(o=!1)}()}return o.abort=function(e,t){if("function"==typeof e&&(t=e,e=!0),i=e||!0,r)return r(i,t||function(){})},o}},function(e,t){e.exports=function e(t){return t&&("string"==typeof t?function(e){return e[t]}:"object"==typeof t&&"function"==typeof t.exec?function(e){var n=t.exec(e);return n&&n[0]}:t)}},function(e,t,n){var r=n(20);r.pki=r.pki||{};var i=e.exports=r.pki.oids=r.oids=r.oids||{};function o(e,t){i[e]=t,i[t]=e}function s(e,t){i[e]=t}o("1.2.840.113549.1.1.1","rsaEncryption"),o("1.2.840.113549.1.1.4","md5WithRSAEncryption"),o("1.2.840.113549.1.1.5","sha1WithRSAEncryption"),o("1.2.840.113549.1.1.7","RSAES-OAEP"),o("1.2.840.113549.1.1.8","mgf1"),o("1.2.840.113549.1.1.9","pSpecified"),o("1.2.840.113549.1.1.10","RSASSA-PSS"),o("1.2.840.113549.1.1.11","sha256WithRSAEncryption"),o("1.2.840.113549.1.1.12","sha384WithRSAEncryption"),o("1.2.840.113549.1.1.13","sha512WithRSAEncryption"),o("1.2.840.10040.4.3","dsa-with-sha1"),o("1.3.14.3.2.7","desCBC"),o("1.3.14.3.2.26","sha1"),o("2.16.840.1.101.3.4.2.1","sha256"),o("2.16.840.1.101.3.4.2.2","sha384"),o("2.16.840.1.101.3.4.2.3","sha512"),o("1.2.840.113549.2.5","md5"),o("1.2.840.113549.1.7.1","data"),o("1.2.840.113549.1.7.2","signedData"),o("1.2.840.113549.1.7.3","envelopedData"),o("1.2.840.113549.1.7.4","signedAndEnvelopedData"),o("1.2.840.113549.1.7.5","digestedData"),o("1.2.840.113549.1.7.6","encryptedData"),o("1.2.840.113549.1.9.1","emailAddress"),o("1.2.840.113549.1.9.2","unstructuredName"),o("1.2.840.113549.1.9.3","contentType"),o("1.2.840.113549.1.9.4","messageDigest"),o("1.2.840.113549.1.9.5","signingTime"),o("1.2.840.113549.1.9.6","counterSignature"),o("1.2.840.113549.1.9.7","challengePassword"),o("1.2.840.113549.1.9.8","unstructuredAddress"),o("1.2.840.113549.1.9.14","extensionRequest"),o("1.2.840.113549.1.9.20","friendlyName"),o("1.2.840.113549.1.9.21","localKeyId"),o("1.2.840.113549.1.9.22.1","x509Certificate"),o("1.2.840.113549.1.12.10.1.1","keyBag"),o("1.2.840.113549.1.12.10.1.2","pkcs8ShroudedKeyBag"),o("1.2.840.113549.1.12.10.1.3","certBag"),o("1.2.840.113549.1.12.10.1.4","crlBag"),o("1.2.840.113549.1.12.10.1.5","secretBag"),o("1.2.840.113549.1.12.10.1.6","safeContentsBag"),o("1.2.840.113549.1.5.13","pkcs5PBES2"),o("1.2.840.113549.1.5.12","pkcs5PBKDF2"),o("1.2.840.113549.1.12.1.1","pbeWithSHAAnd128BitRC4"),o("1.2.840.113549.1.12.1.2","pbeWithSHAAnd40BitRC4"),o("1.2.840.113549.1.12.1.3","pbeWithSHAAnd3-KeyTripleDES-CBC"),o("1.2.840.113549.1.12.1.4","pbeWithSHAAnd2-KeyTripleDES-CBC"),o("1.2.840.113549.1.12.1.5","pbeWithSHAAnd128BitRC2-CBC"),o("1.2.840.113549.1.12.1.6","pbewithSHAAnd40BitRC2-CBC"),o("1.2.840.113549.2.7","hmacWithSHA1"),o("1.2.840.113549.2.8","hmacWithSHA224"),o("1.2.840.113549.2.9","hmacWithSHA256"),o("1.2.840.113549.2.10","hmacWithSHA384"),o("1.2.840.113549.2.11","hmacWithSHA512"),o("1.2.840.113549.3.7","des-EDE3-CBC"),o("2.16.840.1.101.3.4.1.2","aes128-CBC"),o("2.16.840.1.101.3.4.1.22","aes192-CBC"),o("2.16.840.1.101.3.4.1.42","aes256-CBC"),o("2.5.4.3","commonName"),o("2.5.4.5","serialName"),o("2.5.4.6","countryName"),o("2.5.4.7","localityName"),o("2.5.4.8","stateOrProvinceName"),o("2.5.4.10","organizationName"),o("2.5.4.11","organizationalUnitName"),o("2.16.840.1.113730.1.1","nsCertType"),s("2.5.29.1","authorityKeyIdentifier"),s("2.5.29.2","keyAttributes"),s("2.5.29.3","certificatePolicies"),s("2.5.29.4","keyUsageRestriction"),s("2.5.29.5","policyMapping"),s("2.5.29.6","subtreesConstraint"),s("2.5.29.7","subjectAltName"),s("2.5.29.8","issuerAltName"),s("2.5.29.9","subjectDirectoryAttributes"),s("2.5.29.10","basicConstraints"),s("2.5.29.11","nameConstraints"),s("2.5.29.12","policyConstraints"),s("2.5.29.13","basicConstraints"),o("2.5.29.14","subjectKeyIdentifier"),o("2.5.29.15","keyUsage"),s("2.5.29.16","privateKeyUsagePeriod"),o("2.5.29.17","subjectAltName"),o("2.5.29.18","issuerAltName"),o("2.5.29.19","basicConstraints"),s("2.5.29.20","cRLNumber"),s("2.5.29.21","cRLReason"),s("2.5.29.22","expirationDate"),s("2.5.29.23","instructionCode"),s("2.5.29.24","invalidityDate"),s("2.5.29.25","cRLDistributionPoints"),s("2.5.29.26","issuingDistributionPoint"),s("2.5.29.27","deltaCRLIndicator"),s("2.5.29.28","issuingDistributionPoint"),s("2.5.29.29","certificateIssuer"),s("2.5.29.30","nameConstraints"),o("2.5.29.31","cRLDistributionPoints"),o("2.5.29.32","certificatePolicies"),s("2.5.29.33","policyMappings"),s("2.5.29.34","policyConstraints"),o("2.5.29.35","authorityKeyIdentifier"),s("2.5.29.36","policyConstraints"),o("2.5.29.37","extKeyUsage"),s("2.5.29.46","freshestCRL"),s("2.5.29.54","inhibitAnyPolicy"),o("1.3.6.1.4.1.11129.2.4.2","timestampList"),o("1.3.6.1.5.5.7.1.1","authorityInfoAccess"),o("1.3.6.1.5.5.7.3.1","serverAuth"),o("1.3.6.1.5.5.7.3.2","clientAuth"),o("1.3.6.1.5.5.7.3.3","codeSigning"),o("1.3.6.1.5.5.7.3.4","emailProtection"),o("1.3.6.1.5.5.7.3.8","timeStamping")},function(e,t,n){"use strict";const r=t;r.Reporter=n(748).Reporter,r.DecoderBuffer=n(372).DecoderBuffer,r.EncoderBuffer=n(372).EncoderBuffer,r.Node=n(749)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=f;var r=n(57),i=h(r),o=n(86),s=h(o),a=n(107),l=h(a),u=n(37),c=h(u);function h(e){return e&&e.__esModule?e:{default:e}}function f(e,t,n){n=(0,l.default)(n||i.default);var r=(0,c.default)(t);if(!e())return n(null);var o=function(t){if(t)return n(t);if(e())return r(o);var i=(0,s.default)(arguments,1);n.apply(null,[null].concat(i))};r(o)}e.exports=t.default},function(e,t,n){(function(t){e.exports=function e(n,r){for(var i=Math.min(n.length,r.length),o=new t(i),s=0;s{const s=new i(Date.now()+Number(r)).toString(),a=h.ValidityType.EOL;v(e,t,n,s,a,o)},y=(e,t,n,r,i)=>{const o=h.ValidityType.EOL;v(e,t,n,r,o,i)},v=(e,t,n,r,i,o)=>{x(e,t,i,r,(e,s)=>{if(e)return c.error("record signature creation failed"),o(Object.assign(new Error("record signature verification failed"),{code:p.ERR_SIGNATURE_CREATION}));const a={value:t,signature:s,validityType:i,validity:r,sequence:n};return c(`ipns entry for ${t} created`),o(null,a)})},b=(e,t,n)=>{const{value:r,validityType:i,validity:o}=t,s=A(r,i,o);e.verify(s,t.signature,(e,t)=>{if(e||!t)return c.error("record signature verification failed"),n(Object.assign(new Error("record signature verification failed"),{code:p.ERR_SIGNATURE_VERIFICATION}));if(i===h.ValidityType.EOL){let e;try{e=f(o.toString())}catch(e){return c.error("unrecognized validity format (not an rfc3339 format)"),n(Object.assign(new Error("unrecognized validity format (not an rfc3339 format)"),{code:p.ERR_UNRECOGNIZED_FORMAT}))}if(e{if(!e||!e.bytes||!t){const e="one or more of the provided parameters are not defined";return c.error(e),n(Object.assign(new Error(e),{code:p.ERR_UNDEFINED_PARAMETER}))}a.createFromPubKey(e.bytes,(r,i)=>{if(r)return c.error(r),n(Object.assign(new Error(r),{code:p.ERR_PEER_ID_FROM_PUBLIC_KEY}));let o;try{o=T(i)}catch(r){return c.error(r),n(Object.assign(new Error(r),{code:p.ERR_PUBLIC_KEY_FROM_ID}))}if(o)return n(null,null);try{t.pubKey=s.keys.marshalPublicKey(e)}catch(r){return c.error(r),n(r)}n(null,t)})},w=(e,t,n)=>{if(!t||!e){const e="one or more of the provided parameters are not defined";return c.error(e),n(Object.assign(new Error(e),{code:p.ERR_UNDEFINED_PARAMETER}))}if(t.pubKey){let e;try{e=s.keys.unmarshalPublicKey(t.pubKey)}catch(e){return c.error(e),n(e)}return n(null,e)}e.pubKey?n(null,e.pubKey):n(Object.assign(new Error("no public key is available"),{code:p.ERR_UNDEFINED_PARAMETER}))},k=e=>r(e,"RFC4648",{padding:!1}),E=e=>new o(`/ipns/${k(e)}`),S=e=>{const n=t.from("/pk/"),r=t.from("/ipns/");return{routingPubKey:new o(t.concat([n,e])),pkKey:new o(k(t.concat([n,e]))),routingKey:new o(t.concat([r,e])),ipnsKey:new o(k(t.concat([r,e])))}},x=(e,t,n,r,i)=>{const o=A(t,n,r);e.sign(o,(e,t)=>e?i(e):i(null,t))},C=e=>{if("0"===e.toString())return"EOL";{const t=`unrecognized validity type ${e.toString()}`;throw c.error(t),Object.assign(new Error(t),{code:p.ERR_UNRECOGNIZED_VALIDITY})}},A=(e,n,r)=>{const i=t.from(e),o=t.from(C(n)),s=t.from(r);return t.concat([i,s,o])},T=e=>{const t=l.decode(e.id);return t.code!==d?null:s.keys.unmarshalPublicKey(t.digest)},I=h.encode,j=h.decode,R={validate:(e,t,n)=>{const r=j(e),i=t.slice("/ipns/".length);let o;try{o=a.createFromBytes(i)}catch(e){return n(e)}w(o,r,(e,t)=>{if(e)return n(e);b(t,r,e=>{if(e)return n(e);n(null,!0)})})},select:(e,t,n)=>{const r=j(e),i=j(t),o=r.sequence>i.sequence?0:1;if("function"!=typeof n)return o;n(null,o)}};e.exports={create:g,createWithExpiration:y,validate:b,embedPublicKey:_,extractPublicKey:w,getLocalKey:E,getIdKeys:S,marshal:I,unmarshal:j,validator:R,namespace:"/ipns/",namespaceLength:"/ipns/".length}}).call(this,n(0).Buffer)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=l;var r=n(324),i=a(r),o=n(37),s=a(o);function a(e){return e&&e.__esModule?e:{default:e}}function l(e,t,n){var r=(0,s.default)(e);return(0,i.default)(function(i,o){var s=!1,a;function l(){var t=e.name||"anonymous",r=new Error('Callback function "'+t+'" timed out.');r.code="ETIMEDOUT",n&&(r.info=n),s=!0,o(r)}i.push(function(){s||(o.apply(null,arguments),clearTimeout(a))}),a=setTimeout(l,t),r.apply(null,i)})}e.exports=t.default},function(e,t,n){const r=n(6).EventEmitter,i=n(23),o=n(1021);function s(e,t){"object"==typeof e&&(t=e,e="START"),i.equal(typeof e,"string"),i.equal(typeof t,"object"),i.ok(t[e],"invalid starting state "+e),i.ok(o.validate(t));const n=new r;return l._graph=o.reachable(t),l._emitter=n,l._events=t,l._state=e,l.emit=l,l.on=s,l;function s(e,t){n.on(e,t)}function l(e){const t=l._events[l._state][e];if(!a(l._state,t,l._graph)){const t="invalid transition: "+l._state+" -> "+e;return n.emit("error",t)}const r=l._state+":leave",i=t+":enter";return l._state?o():s();function o(){n._events[r]?n.emit(r,s):s()}function s(){n._events[i]?n.emit(i,u):u()}function u(){l._state=t,n.emit(t),n.emit("done")}}}function a(e,t,n){if(!t)return!1;if(!e)return!0;const r=n[e];return!(!r||!r[t])&&1===r[t].length}e.exports=s},function(e,t,n){"use strict";const r=n(21),i=n(31),o=n(15),s=n(160);e.exports=function(e){function t(e){let t=null;if(r.isMultiaddr(e)){const n=r(e);t=n.getPeerId()}else i.isPeerInfo(e)&&(t=e.id.toB58String());return t}function n(t){let n;if(i.isPeerInfo(t))n=t;else if(r.isMultiaddr(t)){const r=t.getPeerId();try{n=e._peerBook.get(r)}catch(e){n=new i(o.createFromB58String(r))}n.multiaddrs.add(t)}else if(o.isPeerId(t)){const r=t.toB58String();n=e._peerBook.has(r)?e._peerBook.get(r):t}return n}function a(t){return e.muxedConns[t]||e.conns[t]}function l(e,t,n){return n=n||(()=>{}),e.write(s.CircuitRelay.encode({type:s.CircuitRelay.Type.STATUS,code:t})),n()}function u(e,t,n,i){try{e.dstPeer.addrs.forEach(e=>r(e))}catch(e){return l(t,n===s.CircuitRelay.Type.HOP?s.CircuitRelay.Status.HOP_DST_MULTIADDR_INVALID:s.CircuitRelay.Status.STOP_DST_MULTIADDR_INVALID),i(e)}try{e.srcPeer.addrs.forEach(e=>r(e))}catch(e){return l(t,n===s.CircuitRelay.Type.HOP?s.CircuitRelay.Status.HOP_SRC_MULTIADDR_INVALID:s.CircuitRelay.Status.STOP_SRC_MULTIADDR_INVALID),i(e)}return i(null)}function c(e){return"string"==typeof e?o.createFromB58String(e):o.createFromBytes(e)}return{getB58String:t,peerInfoFromMa:n,isPeerConnected:a,validateAddrs:u,writeResponse:l,peerIdFromId:c}}},function(e,t,n){"use strict";const r=n(55);e.exports=r("\nmessage CircuitRelay {\n\n enum Status {\n SUCCESS = 100;\n HOP_SRC_ADDR_TOO_LONG = 220;\n HOP_DST_ADDR_TOO_LONG = 221;\n HOP_SRC_MULTIADDR_INVALID = 250;\n HOP_DST_MULTIADDR_INVALID = 251;\n HOP_NO_CONN_TO_DST = 260;\n HOP_CANT_DIAL_DST = 261;\n HOP_CANT_OPEN_DST_STREAM = 262;\n HOP_CANT_SPEAK_RELAY = 270;\n HOP_CANT_RELAY_TO_SELF = 280;\n STOP_SRC_ADDR_TOO_LONG = 320;\n STOP_DST_ADDR_TOO_LONG = 321;\n STOP_SRC_MULTIADDR_INVALID = 350;\n STOP_DST_MULTIADDR_INVALID = 351;\n STOP_RELAY_REFUSED = 390;\n MALFORMED_MESSAGE = 400;\n }\n\n enum Type { // RPC identifier, either HOP, STOP or STATUS\n HOP = 1;\n STOP = 2;\n STATUS = 3;\n CAN_HOP = 4;\n }\n\n message Peer {\n required bytes id = 1; // peer id\n repeated bytes addrs = 2; // peer's known addresses\n }\n\n optional Type type = 1; // Type of the message\n\n optional Peer srcPeer = 2; // srcPeer and dstPeer are used when Type is HOP or STATUS\n optional Peer dstPeer = 3;\n\n optional Status code = 4; // Status code, used when Type is STATUS\n}\n")},function(e,t,n){"use strict";const r=n(1),i=n(58),o=n(198),s=n(9),a="ERR_BAD_PATH";function l(e){const t=new Error("invalid ipfs ref path");e=e.replace(/^\/ipfs\//,"");const n=e.match(/([^/]+(?:\/[^/]+)*)\/?$/);if(!n)throw t;const[r,...i]=n[1].split("/");if(o.cid(r))return{hash:r,links:i};throw t}t.OFFLINE_ERROR="This command must be run in online mode. Try running 'ipfs daemon' first.";const u=e=>{if(o.cid(e))return`/ipfs/${e}`;if(o.path(e))return e;throw Object.assign(new Error(`invalid ${e} path`),{code:a})},c=r(function(e,n,r){Array.isArray(n)||(n=[n]),i(n,(n,r)=>{if("string"!=typeof n){let e;try{e=new s(n)}catch(e){return r(e)}return r(null,e.buffer)}let i;try{i=t.parseIpfsPath(n)}catch(e){return r(e)}const o=new s(i.hash),a=i.links;if(!a.length)return r(null,o.buffer);function l(t,n,i,o){if(i)return r(i);if(!n.length)return r(null,t.buffer);const s=n[0],a=o.links.find(e=>e.name===s);if(!a)return r(new Error(`no link named "${s}" under ${t.toBaseEncodedString()}`));e.get(a.cid,l.bind(null,a.cid,n.slice(1)))}e.get(o,l.bind(null,o,a))},r)});t.normalizePath=u,t.parseIpfsPath=l,t.resolvePath=c},function(e,t){function n(e){return"function"==typeof e}function r(e){return"object"==typeof e&&i(e.source)&&o(e.sink)}function i(e){return n(e)&&2===e.length}function o(e){return n(e)&&1===e.length}t.isDuplex=r,t.isSource=i,t.isSink=o},function(e,t,n){var r=n(459);e.exports=function(e,t){return function(n){var i=[],o,s;function a(e){i.push(e)}e=e||function(e){this.queue(e)},t=t||function(){this.queue(null)};var l={emit:function(e,t){"data"==e&&a(t),"end"==e&&(o=!0,a(null)),"error"==e&&(s=t)},queue:a},u;return function(a,c){if(o=o||a,a)return n(a,function(){if(u){var e=u;u=null,e(a)}c(a)});u=c,r(function r(a){if(u)if(c=u,s)u=null,c(s);else if(i.length){var h=i.shift();u=null,c(null===h,h)}else n(o,function(i,h){if(i&&!0!==i)return s=i,a();if(o=o||i)t.call(l);else if(null!==h&&(e.call(l,h),s||o))return n(s||o,function(){u=null,c(s||o)});a(r)})})}}}},function(e,t,n){(function(t){var r=n(16).Writable,i=n(3),o=Uint8Array;function s(e,t){if(!(this instanceof s))return new s(e,t);"function"==typeof e&&(t=e,e={}),e||(e={});var n=e.encoding,i=!1;n?(n=String(n).toLowerCase(),"u8"!==n&&"uint8"!==n||(n="uint8array")):i=!0,r.call(this,{objectMode:!0}),this.encoding=n,this.shouldInferEncoding=i,t&&this.on("finish",function(){t(this.getBody())}),this.body=[]}function a(e){return/Array\]$/.test(Object.prototype.toString.call(e))}function l(e){return"string"==typeof e||a(e)||e&&"function"==typeof e.subarray}function u(e){for(var n=[],r=0;rn=>{let h,f=!1,p=!1;n=n?Object.assign({},n,n.qs):{};const d=new l,m=new r({objectMode:!0});m._read=(e=>{}),m._write=((e,t,r)=>{const o=s(r);try{const r=a(e,n).map(e=>Object.assign({headers:u(e)},e));p=!0,i(r,(e,n)=>d.write(e,t,n),e=>{if(p=!1,e)return o(e);f&&d.end(),o()})}catch(e){o(e)}}),m.once("finish",()=>{f||(f=!0,p||d.end())});const g=n.qs||{};g["cid-version"]=c(n,"cid-version","cidVersion"),g["raw-leaves"]=c(n,"raw-leaves","rawLeaves"),g["only-hash"]=c(n,"only-hash","onlyHash"),g["wrap-with-directory"]=c(n,"wrap-with-directory","wrapWithDirectory"),g.hash=c(n,"hash","hashAlg");const y={path:t,qs:g,args:n.args,multipart:!0,multipartBoundary:d._boundary,stream:!0,recursive:!0,progress:n.progress};return d.on("error",e=>{m.emit("error",e)}),h=e(y,(e,t)=>{if(e)return m.emit("error",e);if(!t)return m.push(null);if(!o(t))return m.push(t),void m.push(null);if(t.on("error",e=>m.emit("error",e)),n.converter){t.on("data",e=>{e.Bytes&&n.progress&&n.progress(e.Bytes)});const e=n.converter,r=new e;r.once("end",()=>m.push(null)),r.on("data",e=>m.push(e)),t.pipe(r)}else t.on("data",e=>{e.Bytes&&n.progress&&n.progress(e.Bytes),m.push(e)}),t.once("end",()=>m.push(null))}),h.on("drain",()=>d.emit("drain")),d.pipe(h),m})},function(e,t){e.exports=!1},function(e,t,n){var r=n(131),i=n(32),o=e.exports;for(var s in r)r.hasOwnProperty(s)&&(o[s]=r[s]);function a(e){if("string"==typeof e&&(e=i.parse(e)),e.protocol||(e.protocol="https:"),"https:"!==e.protocol)throw new Error('Protocol "'+e.protocol+'" not supported. Expected "https:"');return e}o.request=function(e,t){return e=a(e),r.request.call(this,e,t)},o.get=function(e,t){return e=a(e),r.get.call(this,e,t)}},function(e,t,n){(function(t){function n(e,n){var r,i,o,s=!0;function a(e){function i(){n&&n(e,r),n=null}s?t.nextTick(i):i()}function l(e,t,n){r[e]=n,(0==--i||t)&&a(t)}Array.isArray(e)?(r=[],i=e.length):(o=Object.keys(e),r={},i=o.length),i?o?o.forEach(function(t){e[t](function(e,n){l(t,e,n)})}):e.forEach(function(e,t){e(function(e,n){l(t,e,n)})}):a(null),s=!1}e.exports=n}).call(this,n(2))},function(e,t,n){var r=n(1527),i=new r,o="undefined"!=typeof window?window:self,s=o.crypto||o.msCrypto||{},a=s.subtle||s.webkitSubtle;function l(e){return i.digest(e)}try{a.digest({name:"sha-1"},new Uint8Array).catch(function(){a=!1})}catch(e){a=!1}function u(e,t){a?("string"==typeof e&&(e=c(e)),a.digest({name:"sha-1"},e).then(function e(n){t(h(new Uint8Array(n)))},function n(r){t(l(e))})):setTimeout(t,0,l(e))}function c(e){for(var t=e.length,n=new Uint8Array(t),r=0;r>>4).toString(16)),n.push((15&i).toString(16))}return n.join("")}e.exports=u,e.exports.sync=l},function(e,t,n){e.exports=d;var r=n(25),i=n(29).Buffer,o=n(48),s=n(17),a=n(76),l=n(41),u=n(46),c=n(175),h=n(42),f=a.FingerprintFormatError,p=a.InvalidAlgorithmError;function d(e){if(r.object(e,"options"),r.string(e.type,"options.type"),r.buffer(e.hash,"options.hash"),r.string(e.algorithm,"options.algorithm"),this.algorithm=e.algorithm.toLowerCase(),!0!==o.hashAlgs[this.algorithm])throw new p(this.algorithm);this.hash=e.hash,this.type=e.type,this.hashType=e.hashType}d.prototype.toString=function(e){switch(void 0===e&&(e="md5"===this.algorithm||"spki"===this.hashType?"hex":"base64"),r.string(e),e){case"hex":return"spki"===this.hashType?this.hash.toString("hex"):y(this.hash.toString("hex"));case"base64":return"spki"===this.hashType?this.hash.toString("base64"):b(this.algorithm,this.hash.toString("base64"));default:throw new f(void 0,e)}},d.prototype.matches=function(e){r.object(e,"key or certificate"),"key"===this.type&&"ssh"!==this.hashType?(h.assertCompatible(e,l,[1,7],"key with spki"),u.isPrivateKey(e)&&h.assertCompatible(e,u,[1,6],"privatekey with spki support")):"key"===this.type?h.assertCompatible(e,l,[1,0],"key"):h.assertCompatible(e,c,[1,0],"certificate");var t=e.hash(this.algorithm,this.hashType),n=s.createHash(this.algorithm).update(t).digest("base64");return void 0===this.hash2&&(this.hash2=s.createHash(this.algorithm).update(this.hash).digest("base64")),this.hash2===n};var m=/^[A-Za-z0-9+\/=]+$/,g=/^[a-fA-F0-9]+$/;function y(e){return e.replace(/(.{2})(?=.)/g,"$1:")}function v(e){return e.replace(/=*$/,"")}function b(e,t){return e.toUpperCase()+":"+v(t)}d.parse=function(e,t){var n,s,a;r.string(e,"fingerprint"),Array.isArray(t)&&(a=t,t={}),r.optionalObject(t,"options"),void 0===t&&(t={}),void 0!==t.enAlgs&&(a=t.enAlgs),void 0!==t.algorithms&&(a=t.algorithms),r.optionalArrayOfString(a,"algorithms");var l="ssh";void 0!==t.hashType&&(l=t.hashType),r.string(l,"options.hashType");var u=e.split(":");if(2==u.length){if(n=u[0].toLowerCase(),!m.test(u[1]))throw new f(e);try{s=i.from(u[1],"base64")}catch(t){throw new f(e)}}else if(u.length>2){if(n="md5","md5"===u[0].toLowerCase()&&(u=u.slice(1)),u=u.map(function(t){for(;t.length<2;)t="0"+t;if(t.length>2)throw new f(e);return t}),u=u.join(""),!g.test(u)||u.length%2!=0)throw new f(e);try{s=i.from(u,"hex")}catch(t){throw new f(e)}}else{if(g.test(e))s=i.from(e,"hex");else{if(!m.test(e))throw new f(e);s=i.from(e,"base64")}switch(s.length){case 32:n="sha256";break;case 16:n="md5";break;case 20:n="sha1";break;case 64:n="sha512";break;default:throw new f(e)}void 0===t.hashType&&(l="spki")}if(void 0===n)throw new f(e);if(void 0===o.hashAlgs[n])throw new p(n);if(void 0!==a&&(a=a.map(function(e){return e.toLowerCase()}),-1===a.indexOf(n)))throw new p(n);return new d({algorithm:n,hash:s,type:t.type||"key",hashType:l})},d.isFingerprint=function(e,t){return h.isCompatible(e,d,t)},d.prototype._sshpkApiVersion=[1,2],d._oldVersionDetect=function(e){return r.func(e.toString),r.func(e.matches),[1,0]}},function(e,t,n){(function(){var n,r=0xdeadbeefcafe,i=!0;function o(e,t,n){null!=e&&("number"==typeof e?this.fromNumber(e,t,n):null==t&&"string"!=typeof e?this.fromString(e,256):this.fromString(e,t))}function s(){return new o(null)}function a(e,t,n,r,i,o){for(;--o>=0;){var s=t*this[e++]+n[r]+i;i=Math.floor(s/67108864),n[r++]=67108863&s}return i}function l(e,t,n,r,i,o){for(var s=32767&t,a=t>>15;--o>=0;){var l=32767&this[e],u=this[e++]>>15,c=a*l+u*s;l=s*l+((32767&c)<<15)+n[r]+(1073741823&i),i=(l>>>30)+(c>>>15)+a*u+(i>>>30),n[r++]=1073741823&l}return i}function u(e,t,n,r,i,o){for(var s=16383&t,a=t>>14;--o>=0;){var l=16383&this[e],u=this[e++]>>14,c=a*l+u*s;l=s*l+((16383&c)<<14)+n[r]+i,i=(l>>28)+(c>>14)+a*u,n[r++]=268435455&l}return i}var c="undefined"!=typeof navigator;c&&"Microsoft Internet Explorer"==navigator.appName?(o.prototype.am=l,n=30):c&&"Netscape"!=navigator.appName?(o.prototype.am=a,n=26):(o.prototype.am=u,n=28),o.prototype.DB=n,o.prototype.DM=(1<=0;--t)e[t]=this[t];e.t=this.t,e.s=this.s}function b(e){this.t=1,this.s=e<0?-1:0,e>0?this[0]=e:e<-1?this[0]=e+this.DV:this.t=0}function _(e){var t=s();return t.fromInt(e),t}function w(e,t){var n;if(16==t)n=4;else if(8==t)n=3;else if(256==t)n=8;else if(2==t)n=1;else if(32==t)n=5;else{if(4!=t)return void this.fromRadix(e,t);n=2}this.t=0,this.s=0;for(var r=e.length,i=!1,s=0;--r>=0;){var a=8==n?255&e[r]:y(e,r);a<0?"-"==e.charAt(r)&&(i=!0):(i=!1,0==s?this[this.t++]=a:s+n>this.DB?(this[this.t-1]|=(a&(1<>this.DB-s):this[this.t-1]|=a<=this.DB&&(s-=this.DB))}8==n&&0!=(128&e[0])&&(this.s=-1,s>0&&(this[this.t-1]|=(1<0&&this[this.t-1]==e;)--this.t}function E(e){if(this.s<0)return"-"+this.negate().toString(e);var t;if(16==e)t=4;else if(8==e)t=3;else if(2==e)t=1;else if(32==e)t=5;else{if(4!=e)return this.toRadix(e);t=2}var n=(1<0)for(a>a)>0&&(i=!0,o=g(r));s>=0;)a>(a+=this.DB-t)):(r=this[s]>>(a-=t)&n,a<=0&&(a+=this.DB,--s)),r>0&&(i=!0),i&&(o+=g(r));return i?o:"0"}function S(){var e=s();return o.ZERO.subTo(this,e),e}function x(){return this.s<0?this.negate():this}function C(e){var t=this.s-e.s;if(0!=t)return t;var n=this.t;if(t=n-e.t,0!=t)return this.s<0?-t:t;for(;--n>=0;)if(0!=(t=this[n]-e[n]))return t;return 0}function A(e){var t=1,n;return 0!=(n=e>>>16)&&(e=n,t+=16),0!=(n=e>>8)&&(e=n,t+=8),0!=(n=e>>4)&&(e=n,t+=4),0!=(n=e>>2)&&(e=n,t+=2),0!=(n=e>>1)&&(e=n,t+=1),t}function T(){return this.t<=0?0:this.DB*(this.t-1)+A(this[this.t-1]^this.s&this.DM)}function I(e,t){var n;for(n=this.t-1;n>=0;--n)t[n+e]=this[n];for(n=e-1;n>=0;--n)t[n]=0;t.t=this.t+e,t.s=this.s}function j(e,t){for(var n=e;n=0;--a)t[a+o+1]=this[a]>>r|s,s=(this[a]&i)<=0;--a)t[a]=0;t[o]=s,t.t=this.t+o+1,t.s=this.s,t.clamp()}function B(e,t){t.s=this.s;var n=Math.floor(e/this.DB);if(n>=this.t)t.t=0;else{var r=e%this.DB,i=this.DB-r,o=(1<>r;for(var s=n+1;s>r;r>0&&(t[this.t-n-1]|=(this.s&o)<>=this.DB;if(e.t>=this.DB;r+=this.s}else{for(r+=this.s;n>=this.DB;r-=e.s}t.s=r<0?-1:0,r<-1?t[n++]=this.DV+r:r>0&&(t[n++]=r),t.t=n,t.clamp()}function P(e,t){var n=this.abs(),r=e.abs(),i=n.t;for(t.t=i+r.t;--i>=0;)t[i]=0;for(i=0;i=0;)e[n]=0;for(n=0;n=t.DV&&(e[n+t.t]-=t.DV,e[n+t.t+1]=1)}e.t>0&&(e[e.t-1]+=t.am(n,t[n],e,2*n,0,1)),e.s=0,e.clamp()}function D(e,t,n){var r=e.abs();if(!(r.t<=0)){var i=this.abs();if(i.t0?(r.lShiftTo(c,a),i.lShiftTo(c,n)):(r.copyTo(a),i.copyTo(n));var h=a.t,f=a[h-1];if(0!=f){var p=f*(1<1?a[h-2]>>this.F2:0),d=this.FV/p,m=(1<=0&&(n[n.t++]=1,n.subTo(b,n)),o.ONE.dlShiftTo(h,b),b.subTo(a,a);a.t=0;){var _=n[--y]==f?this.DM:Math.floor(n[y]*d+(n[y-1]+g)*m);if((n[y]+=a.am(0,_,n,v,0,h))<_)for(a.dlShiftTo(v,b),n.subTo(b,n);n[y]<--_;)n.subTo(b,n)}null!=t&&(n.drShiftTo(h,t),l!=u&&o.ZERO.subTo(t,t)),n.t=h,n.clamp(),c>0&&n.rShiftTo(c,n),l<0&&o.ZERO.subTo(n,n)}}}function F(e){var t=s();return this.abs().divRemTo(e,null,t),this.s<0&&t.compareTo(o.ZERO)>0&&e.subTo(t,t),t}function M(e){this.m=e}function L(e){return e.s<0||e.compareTo(this.m)>=0?e.mod(this.m):e}function U(e){return e}function q(e){e.divRemTo(this.m,null,e)}function z(e,t,n){e.multiplyTo(t,n),this.reduce(n)}function K(e,t){e.squareTo(t),this.reduce(t)}function H(){if(this.t<1)return 0;var e=this[0];if(0==(1&e))return 0;var t=3&e;return t=t*(2-(15&e)*t)&15,t=t*(2-(255&e)*t)&255,t=t*(2-((65535&e)*t&65535))&65535,t=t*(2-e*t%this.DV)%this.DV,t>0?this.DV-t:-t}function V(e){this.m=e,this.mp=e.invDigit(),this.mpl=32767&this.mp,this.mph=this.mp>>15,this.um=(1<0&&this.m.subTo(t,t),t}function W(e){var t=s();return e.copyTo(t),this.reduce(t),t}function G(e){for(;e.t<=this.mt2;)e[e.t++]=0;for(var t=0;t>15)*this.mpl&this.um)<<15)&e.DM;for(n=t+this.m.t,e[n]+=this.m.am(0,r,e,t,0,this.m.t);e[n]>=e.DV;)e[n]-=e.DV,e[++n]++}e.clamp(),e.drShiftTo(this.m.t,e),e.compareTo(this.m)>=0&&e.subTo(this.m,e)}function Y(e,t){e.squareTo(t),this.reduce(t)}function Z(e,t,n){e.multiplyTo(t,n),this.reduce(n)}function J(){return 0==(this.t>0?1&this[0]:this.s)}function Q(e,t){if(e>4294967295||e<1)return o.ONE;var n=s(),r=s(),i=t.convert(this),a=A(e)-1;for(i.copyTo(n);--a>=0;)if(t.sqrTo(n,r),(e&1<0)t.mulTo(r,i,n);else{var l=n;n=r,r=l}return t.revert(n)}function X(e,t){var n;return n=e<256||t.isEven()?new M(t):new V(t),this.exp(e,n)}function ee(){var e=s();return this.copyTo(e),e}function te(){if(this.s<0){if(1==this.t)return this[0]-this.DV;if(0==this.t)return-1}else{if(1==this.t)return this[0];if(0==this.t)return 0}return(this[1]&(1<<32-this.DB)-1)<>24}function re(){return 0==this.t?this.s:this[0]<<16>>16}function ie(e){return Math.floor(Math.LN2*this.DB/Math.log(e))}function oe(){return this.s<0?-1:this.t<=0||1==this.t&&this[0]<=0?0:1}function se(e){if(null==e&&(e=10),0==this.signum()||e<2||e>36)return"0";var t=this.chunkSize(e),n=Math.pow(e,t),r=_(n),i=s(),o=s(),a="";for(this.divRemTo(r,i,o);i.signum()>0;)a=(n+o.intValue()).toString(e).substr(1)+a,i.divRemTo(r,i,o);return o.intValue().toString(e)+a}function ae(e,t){this.fromInt(0),null==t&&(t=10);for(var n=this.chunkSize(t),r=Math.pow(t,n),i=!1,s=0,a=0,l=0;l=n&&(this.dMultiply(r),this.dAddOffset(a,0),s=0,a=0))}s>0&&(this.dMultiply(Math.pow(t,s)),this.dAddOffset(a,0)),i&&o.ZERO.subTo(this,this)}function le(e,t,n){if("number"==typeof t)if(e<2)this.fromInt(1);else for(this.fromNumber(e,n),this.testBit(e-1)||this.bitwiseTo(o.ONE.shiftLeft(e-1),ge,this),this.isEven()&&this.dAddOffset(1,0);!this.isProbablePrime(t);)this.dAddOffset(2,0),this.bitLength()>e&&this.subTo(o.ONE.shiftLeft(e-1),this);else{var r=new Array,i=7&e;r.length=1+(e>>3),t.nextBytes(r),i>0?r[0]&=(1<0)for(n>n)!=(this.s&this.DM)>>n&&(t[i++]=r|this.s<=0;)n<8?(r=(this[e]&(1<>(n+=this.DB-8)):(r=this[e]>>(n-=8)&255,n<=0&&(n+=this.DB,--e)),0!=(128&r)&&(r|=-256),0==i&&(128&this.s)!=(128&r)&&++i,(i>0||r!=this.s)&&(t[i++]=r);return t}function ce(e){return 0==this.compareTo(e)}function he(e){return this.compareTo(e)<0?this:e}function fe(e){return this.compareTo(e)>0?this:e}function pe(e,t,n){var r,i,o=Math.min(e.t,this.t);for(r=0;r>=16,t+=16),0==(255&e)&&(e>>=8,t+=8),0==(15&e)&&(e>>=4,t+=4),0==(3&e)&&(e>>=2,t+=2),0==(1&e)&&++t,t}function Ce(){for(var e=0;e=this.t?0!=this.s:0!=(this[t]&1<>=this.DB;if(e.t>=this.DB;r+=this.s}else{for(r+=this.s;n>=this.DB;r+=e.s}t.s=r<0?-1:0,r>0?t[n++]=r:r<-1&&(t[n++]=this.DV+r),t.t=n,t.clamp()}function Ne(e){var t=s();return this.addTo(e,t),t}function De(e){var t=s();return this.subTo(e,t),t}function Fe(e){var t=s();return this.multiplyTo(e,t),t}function Me(){var e=s();return this.squareTo(e),e}function Le(e){var t=s();return this.divRemTo(e,t,null),t}function Ue(e){var t=s();return this.divRemTo(e,null,t),t}function qe(e){var t=s(),n=s();return this.divRemTo(e,t,n),new Array(t,n)}function ze(e){this[this.t]=this.am(0,e-1,this,0,0,this.t),++this.t,this.clamp()}function Ke(e,t){if(0!=e){for(;this.t<=t;)this[this.t++]=0;for(this[t]+=e;this[t]>=this.DV;)this[t]-=this.DV,++t>=this.t&&(this[this.t++]=0),++this[t]}}function He(){}function Ve(e){return e}function $e(e,t,n){e.multiplyTo(t,n)}function We(e,t){e.squareTo(t)}function Ge(e){return this.exp(e,new He)}function Ye(e,t,n){var r=Math.min(this.t+e.t,t),i;for(n.s=0,n.t=r;r>0;)n[--r]=0;for(i=n.t-this.t;r=0;)n[r]=0;for(r=Math.max(t-this.t,0);r2*this.m.t)return e.mod(this.m);if(e.compareTo(this.m)<0)return e;var t=s();return e.copyTo(t),this.reduce(t),t}function Xe(e){return e}function et(e){for(e.drShiftTo(this.m.t-1,this.r2),e.t>this.m.t+1&&(e.t=this.m.t+1,e.clamp()),this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3),this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2);e.compareTo(this.r2)<0;)e.dAddOffset(1,this.m.t+1);for(e.subTo(this.r2,e);e.compareTo(this.m)>=0;)e.subTo(this.m,e)}function tt(e,t){e.squareTo(t),this.reduce(t)}function nt(e,t,n){e.multiplyTo(t,n),this.reduce(n)}function rt(e,t){var n=e.bitLength(),r,i=_(1),o;if(n<=0)return i;r=n<18?1:n<48?3:n<144?4:n<768?5:6,o=n<8?new M(t):t.isEven()?new Je(t):new V(t);var a=new Array,l=3,u=r-1,c=(1<1){var h=s();for(o.sqrTo(a[1],h);l<=c;)a[l]=s(),o.mulTo(h,a[l-2],a[l]),l+=2}var f=e.t-1,p,d=!0,m=s(),g;for(n=A(e[f])-1;f>=0;){for(n>=u?p=e[f]>>n-u&c:(p=(e[f]&(1<0&&(p|=e[f-1]>>this.DB+n-u)),l=r;0==(1&p);)p>>=1,--l;if((n-=l)<0&&(n+=this.DB,--f),d)a[p].copyTo(i),d=!1;else{for(;l>1;)o.sqrTo(i,m),o.sqrTo(m,i),l-=2;l>0?o.sqrTo(i,m):(g=i,i=m,m=g),o.mulTo(m,a[p],i)}for(;f>=0&&0==(e[f]&1<0&&(t.rShiftTo(o,t),n.rShiftTo(o,n));t.signum()>0;)(i=t.getLowestSetBit())>0&&t.rShiftTo(i,t),(i=n.getLowestSetBit())>0&&n.rShiftTo(i,n),t.compareTo(n)>=0?(t.subTo(n,t),t.rShiftTo(1,t)):(n.subTo(t,n),n.rShiftTo(1,n));return o>0&&n.lShiftTo(o,n),n}function ot(e){if(e<=0)return 0;var t=this.DV%e,n=this.s<0?e-1:0;if(this.t>0)if(0==t)n=this[0]%e;else for(var r=this.t-1;r>=0;--r)n=(t*n+this[r])%e;return n}function st(e){var t=e.isEven();if(this.isEven()&&t||0==e.signum())return o.ZERO;for(var n=e.clone(),r=this.clone(),i=_(1),s=_(0),a=_(0),l=_(1);0!=n.signum();){for(;n.isEven();)n.rShiftTo(1,n),t?(i.isEven()&&s.isEven()||(i.addTo(this,i),s.subTo(e,s)),i.rShiftTo(1,i)):s.isEven()||s.subTo(e,s),s.rShiftTo(1,s);for(;r.isEven();)r.rShiftTo(1,r),t?(a.isEven()&&l.isEven()||(a.addTo(this,a),l.subTo(e,l)),a.rShiftTo(1,a)):l.isEven()||l.subTo(e,l),l.rShiftTo(1,l);n.compareTo(r)>=0?(n.subTo(r,n),t&&i.subTo(a,i),s.subTo(l,s)):(r.subTo(n,r),t&&a.subTo(i,a),l.subTo(s,l))}return 0!=r.compareTo(o.ONE)?o.ZERO:l.compareTo(e)>=0?l.subtract(e):l.signum()<0?(l.addTo(e,l),l.signum()<0?l.add(e):l):l}M.prototype.convert=L,M.prototype.revert=U,M.prototype.reduce=q,M.prototype.mulTo=z,M.prototype.sqrTo=K,V.prototype.convert=$,V.prototype.revert=W,V.prototype.reduce=G,V.prototype.mulTo=Z,V.prototype.sqrTo=Y,o.prototype.copyTo=v,o.prototype.fromInt=b,o.prototype.fromString=w,o.prototype.clamp=k,o.prototype.dlShiftTo=I,o.prototype.drShiftTo=j,o.prototype.lShiftTo=R,o.prototype.rShiftTo=B,o.prototype.subTo=O,o.prototype.multiplyTo=P,o.prototype.squareTo=N,o.prototype.divRemTo=D,o.prototype.invDigit=H,o.prototype.isEven=J,o.prototype.exp=Q,o.prototype.toString=E,o.prototype.negate=S,o.prototype.abs=x,o.prototype.compareTo=C,o.prototype.bitLength=T,o.prototype.mod=F,o.prototype.modPowInt=X,o.ZERO=_(0),o.ONE=_(1),He.prototype.convert=Ve,He.prototype.revert=Ve,He.prototype.mulTo=$e,He.prototype.sqrTo=We,Je.prototype.convert=Qe,Je.prototype.revert=Xe,Je.prototype.reduce=et,Je.prototype.mulTo=nt,Je.prototype.sqrTo=tt;var at=[2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331,337,347,349,353,359,367,373,379,383,389,397,401,409,419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,509,521,523,541,547,557,563,569,571,577,587,593,599,601,607,613,617,619,631,641,643,647,653,659,661,673,677,683,691,701,709,719,727,733,739,743,751,757,761,769,773,787,797,809,811,821,823,827,829,839,853,857,859,863,877,881,883,887,907,911,919,929,937,941,947,953,967,971,977,983,991,997],lt=(1<<26)/at[at.length-1],ut,ct,ht;function ft(e){var t,n=this.abs();if(1==n.t&&n[0]<=at[at.length-1]){for(t=0;t>1,e>at.length&&(e=at.length);for(var i=s(),a=0;a>8&255,ct[ht++]^=e>>16&255,ct[ht++]^=e>>24&255,ht>=Ct&&(ht-=Ct)}function mt(){dt((new Date).getTime())}if(o.prototype.chunkSize=ie,o.prototype.toRadix=se,o.prototype.fromRadix=ae,o.prototype.fromNumber=le,o.prototype.bitwiseTo=pe,o.prototype.changeBit=je,o.prototype.addTo=Pe,o.prototype.dMultiply=ze,o.prototype.dAddOffset=Ke,o.prototype.multiplyLowerTo=Ye,o.prototype.multiplyUpperTo=Ze,o.prototype.modInt=ot,o.prototype.millerRabin=pt,o.prototype.clone=ee,o.prototype.intValue=te,o.prototype.byteValue=ne,o.prototype.shortValue=re,o.prototype.signum=oe,o.prototype.toByteArray=ue,o.prototype.equals=ce,o.prototype.min=he,o.prototype.max=fe,o.prototype.and=me,o.prototype.or=ye,o.prototype.xor=be,o.prototype.andNot=we,o.prototype.not=ke,o.prototype.shiftLeft=Ee,o.prototype.shiftRight=Se,o.prototype.getLowestSetBit=Ce,o.prototype.bitCount=Te,o.prototype.testBit=Ie,o.prototype.setBit=Re,o.prototype.clearBit=Be,o.prototype.flipBit=Oe,o.prototype.add=Ne,o.prototype.subtract=De,o.prototype.multiply=Fe,o.prototype.divide=Le,o.prototype.remainder=Ue,o.prototype.divideAndRemainder=qe,o.prototype.modPow=rt,o.prototype.modInverse=st,o.prototype.pow=Ge,o.prototype.gcd=it,o.prototype.isProbablePrime=ft,o.prototype.square=Me,o.prototype.Barrett=Je,null==ct){var gt;if(ct=new Array,ht=0,"undefined"!=typeof window&&window.crypto)if(window.crypto.getRandomValues){var yt=new Uint8Array(32);for(window.crypto.getRandomValues(yt),gt=0;gt<32;++gt)ct[ht++]=yt[gt]}else if("Netscape"==navigator.appName&&navigator.appVersion<"5"){var vt=window.crypto.random(32);for(gt=0;gt>>8,ct[ht++]=255>ht=0,mt()}function bt(){if(null==ut){for(mt(),ut=xt(),ut.init(ct),ht=0;ht>24&255,e[t+1]=n>>16&255,e[t+2]=n>>8&255,e[t+3]=255&n,e[t+4]=r>>24&255,e[t+5]=r>>16&255,e[t+6]=r>>8&255,e[t+7]=255&r}function m(e,t,n,r,i){var o,s=0;for(o=0;o>>8)-1}function g(e,t,n,r){return m(e,t,n,r,16)}function y(e,t,n,r){return m(e,t,n,r,32)}function v(e,t,n,r){for(var i=255&r[0]|(255&r[1])<<8|(255&r[2])<<16|(255&r[3])<<24,o=255&n[0]|(255&n[1])<<8|(255&n[2])<<16|(255&n[3])<<24,s=255&n[4]|(255&n[5])<<8|(255&n[6])<<16|(255&n[7])<<24,a=255&n[8]|(255&n[9])<<8|(255&n[10])<<16|(255&n[11])<<24,l=255&n[12]|(255&n[13])<<8|(255&n[14])<<16|(255&n[15])<<24,u=255&r[4]|(255&r[5])<<8|(255&r[6])<<16|(255&r[7])<<24,c=255&t[0]|(255&t[1])<<8|(255&t[2])<<16|(255&t[3])<<24,h=255&t[4]|(255&t[5])<<8|(255&t[6])<<16|(255&t[7])<<24,f=255&t[8]|(255&t[9])<<8|(255&t[10])<<16|(255&t[11])<<24,p=255&t[12]|(255&t[13])<<8|(255&t[14])<<16|(255&t[15])<<24,d=255&r[8]|(255&r[9])<<8|(255&r[10])<<16|(255&r[11])<<24,m=255&n[16]|(255&n[17])<<8|(255&n[18])<<16|(255&n[19])<<24,g=255&n[20]|(255&n[21])<<8|(255&n[22])<<16|(255&n[23])<<24,y=255&n[24]|(255&n[25])<<8|(255&n[26])<<16|(255&n[27])<<24,v=255&n[28]|(255&n[29])<<8|(255&n[30])<<16|(255&n[31])<<24,b=255&r[12]|(255&r[13])<<8|(255&r[14])<<16|(255&r[15])<<24,_=i,w=o,k=s,E=a,S=l,x=u,C=c,A=h,T=f,I=p,j=d,R=m,B=g,O=y,P=v,N=b,D,F=0;F<20;F+=2)D=_+B|0,S^=D<<7|D>>>25,D=S+_|0,T^=D<<9|D>>>23,D=T+S|0,B^=D<<13|D>>>19,D=B+T|0,_^=D<<18|D>>>14,D=x+w|0,I^=D<<7|D>>>25,D=I+x|0,O^=D<<9|D>>>23,D=O+I|0,w^=D<<13|D>>>19,D=w+O|0,x^=D<<18|D>>>14,D=j+C|0,P^=D<<7|D>>>25,D=P+j|0,k^=D<<9|D>>>23,D=k+P|0,C^=D<<13|D>>>19,D=C+k|0,j^=D<<18|D>>>14,D=N+R|0,E^=D<<7|D>>>25,D=E+N|0,A^=D<<9|D>>>23,D=A+E|0,R^=D<<13|D>>>19,D=R+A|0,N^=D<<18|D>>>14,D=_+E|0,w^=D<<7|D>>>25,D=w+_|0,k^=D<<9|D>>>23,D=k+w|0,E^=D<<13|D>>>19,D=E+k|0,_^=D<<18|D>>>14,D=x+S|0,C^=D<<7|D>>>25,D=C+x|0,A^=D<<9|D>>>23,D=A+C|0,S^=D<<13|D>>>19,D=S+A|0,x^=D<<18|D>>>14,D=j+I|0,R^=D<<7|D>>>25,D=R+j|0,T^=D<<9|D>>>23,D=T+R|0,I^=D<<13|D>>>19,D=I+T|0,j^=D<<18|D>>>14,D=N+P|0,B^=D<<7|D>>>25,D=B+N|0,O^=D<<9|D>>>23,D=O+B|0,P^=D<<13|D>>>19,D=P+O|0,N^=D<<18|D>>>14;_=_+i|0,w=w+o|0,k=k+s|0,E=E+a|0,S=S+l|0,x=x+u|0,C=C+c|0,A=A+h|0,T=T+f|0,I=I+p|0,j=j+d|0,R=R+m|0,B=B+g|0,O=O+y|0,P=P+v|0,N=N+b|0,e[0]=_>>>0&255,e[1]=_>>>8&255,e[2]=_>>>16&255,e[3]=_>>>24&255,e[4]=w>>>0&255,e[5]=w>>>8&255,e[6]=w>>>16&255,e[7]=w>>>24&255,e[8]=k>>>0&255,e[9]=k>>>8&255,e[10]=k>>>16&255,e[11]=k>>>24&255,e[12]=E>>>0&255,e[13]=E>>>8&255,e[14]=E>>>16&255,e[15]=E>>>24&255,e[16]=S>>>0&255,e[17]=S>>>8&255,e[18]=S>>>16&255,e[19]=S>>>24&255,e[20]=x>>>0&255,e[21]=x>>>8&255,e[22]=x>>>16&255,e[23]=x>>>24&255,e[24]=C>>>0&255,e[25]=C>>>8&255,e[26]=C>>>16&255,e[27]=C>>>24&255,e[28]=A>>>0&255,e[29]=A>>>8&255,e[30]=A>>>16&255,e[31]=A>>>24&255,e[32]=T>>>0&255,e[33]=T>>>8&255,e[34]=T>>>16&255,e[35]=T>>>24&255,e[36]=I>>>0&255,e[37]=I>>>8&255,e[38]=I>>>16&255,e[39]=I>>>24&255,e[40]=j>>>0&255,e[41]=j>>>8&255,e[42]=j>>>16&255,e[43]=j>>>24&255,e[44]=R>>>0&255,e[45]=R>>>8&255,e[46]=R>>>16&255,e[47]=R>>>24&255,e[48]=B>>>0&255,e[49]=B>>>8&255,e[50]=B>>>16&255,e[51]=B>>>24&255,e[52]=O>>>0&255,e[53]=O>>>8&255,e[54]=O>>>16&255,e[55]=O>>>24&255,e[56]=P>>>0&255,e[57]=P>>>8&255,e[58]=P>>>16&255,e[59]=P>>>24&255,e[60]=N>>>0&255,e[61]=N>>>8&255,e[62]=N>>>16&255,e[63]=N>>>24&255}function b(e,t,n,r){for(var i=255&r[0]|(255&r[1])<<8|(255&r[2])<<16|(255&r[3])<<24,o=255&n[0]|(255&n[1])<<8|(255&n[2])<<16|(255&n[3])<<24,s=255&n[4]|(255&n[5])<<8|(255&n[6])<<16|(255&n[7])<<24,a=255&n[8]|(255&n[9])<<8|(255&n[10])<<16|(255&n[11])<<24,l=255&n[12]|(255&n[13])<<8|(255&n[14])<<16|(255&n[15])<<24,u=255&r[4]|(255&r[5])<<8|(255&r[6])<<16|(255&r[7])<<24,c=255&t[0]|(255&t[1])<<8|(255&t[2])<<16|(255&t[3])<<24,h=255&t[4]|(255&t[5])<<8|(255&t[6])<<16|(255&t[7])<<24,f=255&t[8]|(255&t[9])<<8|(255&t[10])<<16|(255&t[11])<<24,p=255&t[12]|(255&t[13])<<8|(255&t[14])<<16|(255&t[15])<<24,d=255&r[8]|(255&r[9])<<8|(255&r[10])<<16|(255&r[11])<<24,m=255&n[16]|(255&n[17])<<8|(255&n[18])<<16|(255&n[19])<<24,g=255&n[20]|(255&n[21])<<8|(255&n[22])<<16|(255&n[23])<<24,y=255&n[24]|(255&n[25])<<8|(255&n[26])<<16|(255&n[27])<<24,v=255&n[28]|(255&n[29])<<8|(255&n[30])<<16|(255&n[31])<<24,b=255&r[12]|(255&r[13])<<8|(255&r[14])<<16|(255&r[15])<<24,_=i,w=o,k=s,E=a,S=l,x=u,C=c,A=h,T=f,I=p,j=d,R=m,B=g,O=y,P=v,N=b,D,F=0;F<20;F+=2)D=_+B|0,S^=D<<7|D>>>25,D=S+_|0,T^=D<<9|D>>>23,D=T+S|0,B^=D<<13|D>>>19,D=B+T|0,_^=D<<18|D>>>14,D=x+w|0,I^=D<<7|D>>>25,D=I+x|0,O^=D<<9|D>>>23,D=O+I|0,w^=D<<13|D>>>19,D=w+O|0,x^=D<<18|D>>>14,D=j+C|0,P^=D<<7|D>>>25,D=P+j|0,k^=D<<9|D>>>23,D=k+P|0,C^=D<<13|D>>>19,D=C+k|0,j^=D<<18|D>>>14,D=N+R|0,E^=D<<7|D>>>25,D=E+N|0,A^=D<<9|D>>>23,D=A+E|0,R^=D<<13|D>>>19,D=R+A|0,N^=D<<18|D>>>14,D=_+E|0,w^=D<<7|D>>>25,D=w+_|0,k^=D<<9|D>>>23,D=k+w|0,E^=D<<13|D>>>19,D=E+k|0,_^=D<<18|D>>>14,D=x+S|0,C^=D<<7|D>>>25,D=C+x|0,A^=D<<9|D>>>23,D=A+C|0,S^=D<<13|D>>>19,D=S+A|0,x^=D<<18|D>>>14,D=j+I|0,R^=D<<7|D>>>25,D=R+j|0,T^=D<<9|D>>>23,D=T+R|0,I^=D<<13|D>>>19,D=I+T|0,j^=D<<18|D>>>14,D=N+P|0,B^=D<<7|D>>>25,D=B+N|0,O^=D<<9|D>>>23,D=O+B|0,P^=D<<13|D>>>19,D=P+O|0,N^=D<<18|D>>>14;e[0]=_>>>0&255,e[1]=_>>>8&255,e[2]=_>>>16&255,e[3]=_>>>24&255,e[4]=x>>>0&255,e[5]=x>>>8&255,e[6]=x>>>16&255,e[7]=x>>>24&255,e[8]=j>>>0&255,e[9]=j>>>8&255,e[10]=j>>>16&255,e[11]=j>>>24&255,e[12]=N>>>0&255,e[13]=N>>>8&255,e[14]=N>>>16&255,e[15]=N>>>24&255,e[16]=C>>>0&255,e[17]=C>>>8&255,e[18]=C>>>16&255,e[19]=C>>>24&255,e[20]=A>>>0&255,e[21]=A>>>8&255,e[22]=A>>>16&255,e[23]=A>>>24&255,e[24]=T>>>0&255,e[25]=T>>>8&255,e[26]=T>>>16&255,e[27]=T>>>24&255,e[28]=I>>>0&255,e[29]=I>>>8&255,e[30]=I>>>16&255,e[31]=I>>>24&255}function _(e,t,n,r){v(e,t,n,r)}function w(e,t,n,r){b(e,t,n,r)}var k=new Uint8Array([101,120,112,97,110,100,32,51,50,45,98,121,116,101,32,107]);function E(e,t,n,r,i,o,s){var a=new Uint8Array(16),l=new Uint8Array(64),u,c;for(c=0;c<16;c++)a[c]=0;for(c=0;c<8;c++)a[c]=o[c];for(;i>=64;){for(_(l,a,s,k),c=0;c<64;c++)e[t+c]=n[r+c]^l[c];for(u=1,c=8;c<16;c++)u=u+(255&a[c])|0,a[c]=255&u,u>>>=8;i-=64,t+=64,r+=64}if(i>0)for(_(l,a,s,k),c=0;c=64;){for(_(s,o,i,k),l=0;l<64;l++)e[t+l]=s[l];for(a=1,l=8;l<16;l++)a=a+(255&o[l])|0,o[l]=255&a,a>>>=8;n-=64,t+=64}if(n>0)for(_(s,o,i,k),l=0;l>>13|n<<3),r=255&e[4]|(255&e[5])<<8,this.r[2]=7939&(n>>>10|r<<6),i=255&e[6]|(255&e[7])<<8,this.r[3]=8191&(r>>>7|i<<9),o=255&e[8]|(255&e[9])<<8,this.r[4]=255&(i>>>4|o<<12),this.r[5]=o>>>1&8190,s=255&e[10]|(255&e[11])<<8,this.r[6]=8191&(o>>>14|s<<2),a=255&e[12]|(255&e[13])<<8,this.r[7]=8065&(s>>>11|a<<5),l=255&e[14]|(255&e[15])<<8,this.r[8]=8191&(a>>>8|l<<8),this.r[9]=l>>>5&127,this.pad[0]=255&e[16]|(255&e[17])<<8,this.pad[1]=255&e[18]|(255&e[19])<<8,this.pad[2]=255&e[20]|(255&e[21])<<8,this.pad[3]=255&e[22]|(255&e[23])<<8,this.pad[4]=255&e[24]|(255&e[25])<<8,this.pad[5]=255&e[26]|(255&e[27])<<8,this.pad[6]=255&e[28]|(255&e[29])<<8,this.pad[7]=255&e[30]|(255&e[31])<<8};function T(e,t,n,r,i,o){var s=new A(o);return s.update(n,r,i),s.finish(e,t),0}function I(e,t,n,r,i,o){var s=new Uint8Array(16);return T(s,0,n,r,i,o),g(e,t,s,0)}function j(e,t,n,r,i){var o;if(n<32)return-1;for(C(e,0,t,0,n,r,i),T(e,16,e,32,n-32,e),o=0;o<16;o++)e[o]=0;return 0}function R(e,t,n,r,i){var o,s=new Uint8Array(32);if(n<32)return-1;if(x(s,0,32,r,i),0!==I(t,16,t,32,n-32,s))return-1;for(C(e,0,t,0,n,r,i),o=0;o<32;o++)e[o]=0;return 0}function B(e,t){var n;for(n=0;n<16;n++)e[n]=0|t[n]}function O(e){var t,n,r=1;for(t=0;t<16;t++)n=e[t]+r+65535,r=Math.floor(n/65536),e[t]=n-65536*r;e[0]+=r-1+37*(r-1)}function P(e,t,n){for(var r,i=~(n-1),o=0;o<16;o++)r=i&(e[o]^t[o]),e[o]^=r,t[o]^=r}function N(e,n){var r,i,o,s=t(),a=t();for(r=0;r<16;r++)a[r]=n[r];for(O(a),O(a),O(a),i=0;i<2;i++){for(s[0]=a[0]-65517,r=1;r<15;r++)s[r]=a[r]-65535-(s[r-1]>>16&1),s[r-1]&=65535;s[15]=a[15]-32767-(s[14]>>16&1),o=s[15]>>16&1,s[14]&=65535,P(a,s,1-o)}for(r=0;r<16;r++)e[2*r]=255&a[r],e[2*r+1]=a[r]>>8}function D(e,t){var n=new Uint8Array(32),r=new Uint8Array(32);return N(n,e),N(r,t),y(n,0,r,0)}function F(e){var t=new Uint8Array(32);return N(t,e),1&t[0]}function M(e,t){var n;for(n=0;n<16;n++)e[n]=t[2*n]+(t[2*n+1]<<8);e[15]&=32767}function L(e,t,n){for(var r=0;r<16;r++)e[r]=t[r]+n[r]}function U(e,t,n){for(var r=0;r<16;r++)e[r]=t[r]-n[r]}function q(e,t,n){var r,i,o=0,s=0,a=0,l=0,u=0,c=0,h=0,f=0,p=0,d=0,m=0,g=0,y=0,v=0,b=0,_=0,w=0,k=0,E=0,S=0,x=0,C=0,A=0,T=0,I=0,j=0,R=0,B=0,O=0,P=0,N=0,D=n[0],F=n[1],M=n[2],L=n[3],U=n[4],q=n[5],z=n[6],K=n[7],H=n[8],V=n[9],$=n[10],W=n[11],G=n[12],Y=n[13],Z=n[14],J=n[15];r=t[0],o+=r*D,s+=r*F,a+=r*M,l+=r*L,u+=r*U,c+=r*q,h+=r*z,f+=r*K,p+=r*H,d+=r*V,m+=r*$,g+=r*W,y+=r*G,v+=r*Y,b+=r*Z,_+=r*J,r=t[1],s+=r*D,a+=r*F,l+=r*M,u+=r*L,c+=r*U,h+=r*q,f+=r*z,p+=r*K,d+=r*H,m+=r*V,g+=r*$,y+=r*W,v+=r*G,b+=r*Y,_+=r*Z,w+=r*J,r=t[2],a+=r*D,l+=r*F,u+=r*M,c+=r*L,h+=r*U,f+=r*q,p+=r*z,d+=r*K,m+=r*H,g+=r*V,y+=r*$,v+=r*W,b+=r*G,_+=r*Y,w+=r*Z,k+=r*J,r=t[3],l+=r*D,u+=r*F,c+=r*M,h+=r*L,f+=r*U,p+=r*q,d+=r*z,m+=r*K,g+=r*H,y+=r*V,v+=r*$,b+=r*W,_+=r*G,w+=r*Y,k+=r*Z,E+=r*J,r=t[4],u+=r*D,c+=r*F,h+=r*M,f+=r*L,p+=r*U,d+=r*q,m+=r*z,g+=r*K,y+=r*H,v+=r*V,b+=r*$,_+=r*W,w+=r*G,k+=r*Y,E+=r*Z,S+=r*J,r=t[5],c+=r*D,h+=r*F,f+=r*M,p+=r*L,d+=r*U,m+=r*q,g+=r*z,y+=r*K,v+=r*H,b+=r*V,_+=r*$,w+=r*W,k+=r*G,E+=r*Y,S+=r*Z,x+=r*J,r=t[6],h+=r*D,f+=r*F,p+=r*M,d+=r*L,m+=r*U,g+=r*q,y+=r*z,v+=r*K,b+=r*H,_+=r*V,w+=r*$,k+=r*W,E+=r*G,S+=r*Y,x+=r*Z,C+=r*J,r=t[7],f+=r*D,p+=r*F,d+=r*M,m+=r*L,g+=r*U,y+=r*q,v+=r*z,b+=r*K,_+=r*H,w+=r*V,k+=r*$,E+=r*W,S+=r*G,x+=r*Y,C+=r*Z,A+=r*J,r=t[8],p+=r*D,d+=r*F,m+=r*M,g+=r*L,y+=r*U,v+=r*q,b+=r*z,_+=r*K,w+=r*H,k+=r*V,E+=r*$,S+=r*W,x+=r*G,C+=r*Y,A+=r*Z,T+=r*J,r=t[9],d+=r*D,m+=r*F,g+=r*M,y+=r*L,v+=r*U,b+=r*q,_+=r*z,w+=r*K,k+=r*H,E+=r*V,S+=r*$,x+=r*W,C+=r*G,A+=r*Y,T+=r*Z,I+=r*J,r=t[10],m+=r*D,g+=r*F,y+=r*M,v+=r*L,b+=r*U,_+=r*q,w+=r*z,k+=r*K,E+=r*H,S+=r*V,x+=r*$,C+=r*W,A+=r*G,T+=r*Y,I+=r*Z,j+=r*J,r=t[11],g+=r*D,y+=r*F,v+=r*M,b+=r*L,_+=r*U,w+=r*q,k+=r*z,E+=r*K,S+=r*H,x+=r*V,C+=r*$,A+=r*W,T+=r*G,I+=r*Y,j+=r*Z,R+=r*J,r=t[12],y+=r*D,v+=r*F,b+=r*M,_+=r*L,w+=r*U,k+=r*q,E+=r*z,S+=r*K,x+=r*H,C+=r*V,A+=r*$,T+=r*W,I+=r*G,j+=r*Y,R+=r*Z,B+=r*J,r=t[13],v+=r*D,b+=r*F,_+=r*M,w+=r*L,k+=r*U,E+=r*q,S+=r*z,x+=r*K,C+=r*H,A+=r*V,T+=r*$,I+=r*W,j+=r*G,R+=r*Y,B+=r*Z,O+=r*J,r=t[14],b+=r*D,_+=r*F,w+=r*M,k+=r*L,E+=r*U,S+=r*q,x+=r*z,C+=r*K,A+=r*H,T+=r*V,I+=r*$,j+=r*W,R+=r*G,B+=r*Y,O+=r*Z,P+=r*J,r=t[15],_+=r*D,w+=r*F,k+=r*M,E+=r*L,S+=r*U,x+=r*q,C+=r*z,A+=r*K,T+=r*H,I+=r*V,j+=r*$,R+=r*W,B+=r*G,O+=r*Y,P+=r*Z,N+=r*J,o+=38*w,s+=38*k,a+=38*E,l+=38*S,u+=38*x,c+=38*C,h+=38*A,f+=38*T,p+=38*I,d+=38*j,m+=38*R,g+=38*B,y+=38*O,v+=38*P,b+=38*N,i=1,r=o+i+65535,i=Math.floor(r/65536),o=r-65536*i,r=s+i+65535,i=Math.floor(r/65536),s=r-65536*i,r=a+i+65535,i=Math.floor(r/65536),a=r-65536*i,r=l+i+65535,i=Math.floor(r/65536),l=r-65536*i,r=u+i+65535,i=Math.floor(r/65536),u=r-65536*i,r=c+i+65535,i=Math.floor(r/65536),c=r-65536*i,r=h+i+65535,i=Math.floor(r/65536),h=r-65536*i,r=f+i+65535,i=Math.floor(r/65536),f=r-65536*i,r=p+i+65535,i=Math.floor(r/65536),p=r-65536*i,r=d+i+65535,i=Math.floor(r/65536),d=r-65536*i,r=m+i+65535,i=Math.floor(r/65536),m=r-65536*i,r=g+i+65535,i=Math.floor(r/65536),g=r-65536*i,r=y+i+65535,i=Math.floor(r/65536),y=r-65536*i,r=v+i+65535,i=Math.floor(r/65536),v=r-65536*i,r=b+i+65535,i=Math.floor(r/65536),b=r-65536*i,r=_+i+65535,i=Math.floor(r/65536),_=r-65536*i,o+=i-1+37*(i-1),i=1,r=o+i+65535,i=Math.floor(r/65536),o=r-65536*i,r=s+i+65535,i=Math.floor(r/65536),s=r-65536*i,r=a+i+65535,i=Math.floor(r/65536),a=r-65536*i,r=l+i+65535,i=Math.floor(r/65536),l=r-65536*i,r=u+i+65535,i=Math.floor(r/65536),u=r-65536*i,r=c+i+65535,i=Math.floor(r/65536),c=r-65536*i,r=h+i+65535,i=Math.floor(r/65536),h=r-65536*i,r=f+i+65535,i=Math.floor(r/65536),f=r-65536*i,r=p+i+65535,i=Math.floor(r/65536),p=r-65536*i,r=d+i+65535,i=Math.floor(r/65536),d=r-65536*i,r=m+i+65535,i=Math.floor(r/65536),m=r-65536*i,r=g+i+65535,i=Math.floor(r/65536),g=r-65536*i,r=y+i+65535,i=Math.floor(r/65536),y=r-65536*i,r=v+i+65535,i=Math.floor(r/65536),v=r-65536*i,r=b+i+65535,i=Math.floor(r/65536),b=r-65536*i,r=_+i+65535,i=Math.floor(r/65536),_=r-65536*i,o+=i-1+37*(i-1),e[0]=o,e[1]=s,e[2]=a,e[3]=l,e[4]=u,e[5]=c,e[6]=h,e[7]=f,e[8]=p,e[9]=d,e[10]=m,e[11]=g,e[12]=y,e[13]=v,e[14]=b,e[15]=_}function z(e,t){q(e,t,t)}function K(e,n){var r=t(),i;for(i=0;i<16;i++)r[i]=n[i];for(i=253;i>=0;i--)z(r,r),2!==i&&4!==i&&q(r,r,n);for(i=0;i<16;i++)e[i]=r[i]}function H(e,n){var r=t(),i;for(i=0;i<16;i++)r[i]=n[i];for(i=250;i>=0;i--)z(r,r),1!==i&&q(r,r,n);for(i=0;i<16;i++)e[i]=r[i]}function V(e,n,r){var i=new Uint8Array(32),o=new Float64Array(80),s,a,u=t(),c=t(),h=t(),f=t(),p=t(),d=t();for(a=0;a<31;a++)i[a]=n[a];for(i[31]=127&n[31]|64,i[0]&=248,M(o,r),a=0;a<16;a++)c[a]=o[a],f[a]=u[a]=h[a]=0;for(u[0]=f[0]=1,a=254;a>=0;--a)s=i[a>>>3]>>>(7&a)&1,P(u,c,s),P(h,f,s),L(p,u,h),U(u,u,h),L(h,c,f),U(c,c,f),z(f,p),z(d,u),q(u,h,u),q(h,c,p),L(p,u,h),U(u,u,h),z(c,u),U(h,f,d),q(u,h,l),L(u,u,f),q(h,h,u),q(u,f,d),q(f,c,o),z(c,p),P(u,c,s),P(h,f,s);for(a=0;a<16;a++)o[a+16]=u[a],o[a+32]=h[a],o[a+48]=c[a],o[a+64]=f[a];var m=o.subarray(32),g=o.subarray(16);return K(m,m),q(g,g,m),N(e,g),0}function $(e,t){return V(e,t,o)}function W(e,t){return r(t,32),$(e,t)}function G(e,t,n){var r=new Uint8Array(32);return V(r,n,t),w(e,i,r,k)}A.prototype.blocks=function(e,t,n){for(var r=this.fin?0:2048,i,o,s,a,l,u,c,h,f,p,d,m,g,y,v,b,_,w,k,E=this.h[0],S=this.h[1],x=this.h[2],C=this.h[3],A=this.h[4],T=this.h[5],I=this.h[6],j=this.h[7],R=this.h[8],B=this.h[9],O=this.r[0],P=this.r[1],N=this.r[2],D=this.r[3],F=this.r[4],M=this.r[5],L=this.r[6],U=this.r[7],q=this.r[8],z=this.r[9];n>=16;)i=255&e[t+0]|(255&e[t+1])<<8,E+=8191&i,o=255&e[t+2]|(255&e[t+3])<<8,S+=8191&(i>>>13|o<<3),s=255&e[t+4]|(255&e[t+5])<<8,x+=8191&(o>>>10|s<<6),a=255&e[t+6]|(255&e[t+7])<<8,C+=8191&(s>>>7|a<<9),l=255&e[t+8]|(255&e[t+9])<<8,A+=8191&(a>>>4|l<<12),T+=l>>>1&8191,u=255&e[t+10]|(255&e[t+11])<<8,I+=8191&(l>>>14|u<<2),c=255&e[t+12]|(255&e[t+13])<<8,j+=8191&(u>>>11|c<<5),h=255&e[t+14]|(255&e[t+15])<<8,R+=8191&(c>>>8|h<<8),B+=h>>>5|r,f=0,p=f,p+=E*O,p+=S*(5*z),p+=x*(5*q),p+=C*(5*U),p+=A*(5*L),f=p>>>13,p&=8191,p+=T*(5*M),p+=I*(5*F),p+=j*(5*D),p+=R*(5*N),p+=B*(5*P),f+=p>>>13,p&=8191,d=f,d+=E*P,d+=S*O,d+=x*(5*z),d+=C*(5*q),d+=A*(5*U),f=d>>>13,d&=8191,d+=T*(5*L),d+=I*(5*M),d+=j*(5*F),d+=R*(5*D),d+=B*(5*N),f+=d>>>13,d&=8191,m=f,m+=E*N,m+=S*P,m+=x*O,m+=C*(5*z),m+=A*(5*q),f=m>>>13,m&=8191,m+=T*(5*U),m+=I*(5*L),m+=j*(5*M),m+=R*(5*F),m+=B*(5*D),f+=m>>>13,m&=8191,g=f,g+=E*D,g+=S*N,g+=x*P,g+=C*O,g+=A*(5*z),f=g>>>13,g&=8191,g+=T*(5*q),g+=I*(5*U),g+=j*(5*L),g+=R*(5*M),g+=B*(5*F),f+=g>>>13,g&=8191,y=f,y+=E*F,y+=S*D,y+=x*N,y+=C*P,y+=A*O,f=y>>>13,y&=8191,y+=T*(5*z),y+=I*(5*q),y+=j*(5*U),y+=R*(5*L),y+=B*(5*M),f+=y>>>13,y&=8191,v=f,v+=E*M,v+=S*F,v+=x*D,v+=C*N,v+=A*P,f=v>>>13,v&=8191,v+=T*O,v+=I*(5*z),v+=j*(5*q),v+=R*(5*U),v+=B*(5*L),f+=v>>>13,v&=8191,b=f,b+=E*L,b+=S*M,b+=x*F,b+=C*D,b+=A*N,f=b>>>13,b&=8191,b+=T*P,b+=I*O,b+=j*(5*z),b+=R*(5*q),b+=B*(5*U),f+=b>>>13,b&=8191,_=f,_+=E*U,_+=S*L,_+=x*M,_+=C*F,_+=A*D,f=_>>>13,_&=8191,_+=T*N,_+=I*P,_+=j*O,_+=R*(5*z),_+=B*(5*q),f+=_>>>13,_&=8191,w=f,w+=E*q,w+=S*U,w+=x*L,w+=C*M,w+=A*F,f=w>>>13,w&=8191,w+=T*D,w+=I*N,w+=j*P,w+=R*O,w+=B*(5*z),f+=w>>>13,w&=8191,k=f,k+=E*z,k+=S*q,k+=x*U,k+=C*L,k+=A*M,f=k>>>13,k&=8191,k+=T*F,k+=I*D,k+=j*N,k+=R*P,k+=B*O,f+=k>>>13,k&=8191,f=(f<<2)+f|0,f=f+p|0,p=8191&f,f>>>=13,d+=f,E=p,S=d,x=m,C=g,A=y,T=v,I=b,j=_,R=w,B=k,t+=16,n-=16;this.h[0]=E,this.h[1]=S,this.h[2]=x,this.h[3]=C,this.h[4]=A,this.h[5]=T,this.h[6]=I,this.h[7]=j,this.h[8]=R,this.h[9]=B},A.prototype.finish=function(e,t){var n=new Uint16Array(10),r,i,o,s;if(this.leftover){for(s=this.leftover,this.buffer[s++]=1;s<16;s++)this.buffer[s]=0;this.fin=1,this.blocks(this.buffer,0,16)}for(r=this.h[1]>>>13,this.h[1]&=8191,s=2;s<10;s++)this.h[s]+=r,r=this.h[s]>>>13,this.h[s]&=8191;for(this.h[0]+=5*r,r=this.h[0]>>>13,this.h[0]&=8191,this.h[1]+=r,r=this.h[1]>>>13,this.h[1]&=8191,this.h[2]+=r,n[0]=this.h[0]+5,r=n[0]>>>13,n[0]&=8191,s=1;s<10;s++)n[s]=this.h[s]+r,r=n[s]>>>13,n[s]&=8191;for(n[9]-=8192,i=(1^r)-1,s=0;s<10;s++)n[s]&=i;for(i=~i,s=0;s<10;s++)this.h[s]=this.h[s]&i|n[s];for(this.h[0]=65535&(this.h[0]|this.h[1]<<13),this.h[1]=65535&(this.h[1]>>>3|this.h[2]<<10),this.h[2]=65535&(this.h[2]>>>6|this.h[3]<<7),this.h[3]=65535&(this.h[3]>>>9|this.h[4]<<4),this.h[4]=65535&(this.h[4]>>>12|this.h[5]<<1|this.h[6]<<14),this.h[5]=65535&(this.h[6]>>>2|this.h[7]<<11),this.h[6]=65535&(this.h[7]>>>5|this.h[8]<<8),this.h[7]=65535&(this.h[8]>>>8|this.h[9]<<5),o=this.h[0]+this.pad[0],this.h[0]=65535&o,s=1;s<8;s++)o=(this.h[s]+this.pad[s]|0)+(o>>>16)|0,this.h[s]=65535&o;e[t+0]=this.h[0]>>>0&255,e[t+1]=this.h[0]>>>8&255,e[t+2]=this.h[1]>>>0&255,e[t+3]=this.h[1]>>>8&255,e[t+4]=this.h[2]>>>0&255,e[t+5]=this.h[2]>>>8&255,e[t+6]=this.h[3]>>>0&255,e[t+7]=this.h[3]>>>8&255,e[t+8]=this.h[4]>>>0&255,e[t+9]=this.h[4]>>>8&255,e[t+10]=this.h[5]>>>0&255,e[t+11]=this.h[5]>>>8&255,e[t+12]=this.h[6]>>>0&255,e[t+13]=this.h[6]>>>8&255,e[t+14]=this.h[7]>>>0&255,e[t+15]=this.h[7]>>>8&255},A.prototype.update=function(e,t,n){var r,i;if(this.leftover){for(i=16-this.leftover,i>n&&(i=n),r=0;r=16&&(i=n-n%16,this.blocks(e,t,i),t+=i,n-=i),n){for(r=0;r=128;){for(S=0;S<16;S++)x=8*S+G,i[S]=n[x+0]<<24|n[x+1]<<16|n[x+2]<<8|n[x+3],o[S]=n[x+4]<<24|n[x+5]<<16|n[x+6]<<8|n[x+7];for(S=0;S<80;S++)if(s=B,a=O,l=P,u=N,c=D,h=F,f=M,p=L,d=U,m=q,g=z,y=K,v=H,b=V,_=$,w=W,C=L,A=W,T=65535&A,I=A>>>16,j=65535&C,R=C>>>16,C=(D>>>14|H<<18)^(D>>>18|H<<14)^(H>>>9|D<<23),A=(H>>>14|D<<18)^(H>>>18|D<<14)^(D>>>9|H<<23),T+=65535&A,I+=A>>>16,j+=65535&C,R+=C>>>16,C=D&F^~D&M,A=H&V^~H&$,T+=65535&A,I+=A>>>16,j+=65535&C,R+=C>>>16,C=X[2*S],A=X[2*S+1],T+=65535&A,I+=A>>>16,j+=65535&C,R+=C>>>16,C=i[S%16],A=o[S%16],T+=65535&A,I+=A>>>16,j+=65535&C,R+=C>>>16,I+=T>>>16,j+=I>>>16,R+=j>>>16,k=65535&j|R<<16,E=65535&T|I<<16,C=k,A=E,T=65535&A,I=A>>>16,j=65535&C,R=C>>>16,C=(B>>>28|U<<4)^(U>>>2|B<<30)^(U>>>7|B<<25),A=(U>>>28|B<<4)^(B>>>2|U<<30)^(B>>>7|U<<25),T+=65535&A,I+=A>>>16,j+=65535&C,R+=C>>>16,C=B&O^B&P^O&P,A=U&q^U&z^q&z,T+=65535&A,I+=A>>>16,j+=65535&C,R+=C>>>16,I+=T>>>16,j+=I>>>16,R+=j>>>16,p=65535&j|R<<16,w=65535&T|I<<16,C=u,A=y,T=65535&A,I=A>>>16,j=65535&C,R=C>>>16,C=k,A=E,T+=65535&A,I+=A>>>16,j+=65535&C,R+=C>>>16,I+=T>>>16,j+=I>>>16,R+=j>>>16,u=65535&j|R<<16,y=65535&T|I<<16,O=s,P=a,N=l,D=u,F=c,M=h,L=f,B=p,q=d,z=m,K=g,H=y,V=v,$=b,W=_,U=w,S%16==15)for(x=0;x<16;x++)C=i[x],A=o[x],T=65535&A,I=A>>>16,j=65535&C,R=C>>>16,C=i[(x+9)%16],A=o[(x+9)%16],T+=65535&A,I+=A>>>16,j+=65535&C,R+=C>>>16,k=i[(x+1)%16],E=o[(x+1)%16],C=(k>>>1|E<<31)^(k>>>8|E<<24)^k>>>7,A=(E>>>1|k<<31)^(E>>>8|k<<24)^(E>>>7|k<<25),T+=65535&A,I+=A>>>16,j+=65535&C,R+=C>>>16,k=i[(x+14)%16],E=o[(x+14)%16],C=(k>>>19|E<<13)^(E>>>29|k<<3)^k>>>6,A=(E>>>19|k<<13)^(k>>>29|E<<3)^(E>>>6|k<<26),T+=65535&A,I+=A>>>16,j+=65535&C,R+=C>>>16,I+=T>>>16,j+=I>>>16,R+=j>>>16,i[x]=65535&j|R<<16,o[x]=65535&T|I<<16;C=B,A=U,T=65535&A,I=A>>>16,j=65535&C,R=C>>>16,C=e[0],A=t[0],T+=65535&A,I+=A>>>16,j+=65535&C,R+=C>>>16,I+=T>>>16,j+=I>>>16,R+=j>>>16,e[0]=B=65535&j|R<<16,t[0]=U=65535&T|I<<16,C=O,A=q,T=65535&A,I=A>>>16,j=65535&C,R=C>>>16,C=e[1],A=t[1],T+=65535&A,I+=A>>>16,j+=65535&C,R+=C>>>16,I+=T>>>16,j+=I>>>16,R+=j>>>16,e[1]=O=65535&j|R<<16,t[1]=q=65535&T|I<<16,C=P,A=z,T=65535&A,I=A>>>16,j=65535&C,R=C>>>16,C=e[2],A=t[2],T+=65535&A,I+=A>>>16,j+=65535&C,R+=C>>>16,I+=T>>>16,j+=I>>>16,R+=j>>>16,e[2]=P=65535&j|R<<16,t[2]=z=65535&T|I<<16,C=N,A=K,T=65535&A,I=A>>>16,j=65535&C,R=C>>>16,C=e[3],A=t[3],T+=65535&A,I+=A>>>16,j+=65535&C,R+=C>>>16,I+=T>>>16,j+=I>>>16,R+=j>>>16,e[3]=N=65535&j|R<<16,t[3]=K=65535&T|I<<16,C=D,A=H,T=65535&A,I=A>>>16,j=65535&C,R=C>>>16,C=e[4],A=t[4],T+=65535&A,I+=A>>>16,j+=65535&C,R+=C>>>16,I+=T>>>16,j+=I>>>16,R+=j>>>16,e[4]=D=65535&j|R<<16,t[4]=H=65535&T|I<<16,C=F,A=V,T=65535&A,I=A>>>16,j=65535&C,R=C>>>16,C=e[5],A=t[5],T+=65535&A,I+=A>>>16,j+=65535&C,R+=C>>>16,I+=T>>>16,j+=I>>>16,R+=j>>>16,e[5]=F=65535&j|R<<16,t[5]=V=65535&T|I<<16,C=M,A=$,T=65535&A,I=A>>>16,j=65535&C,R=C>>>16,C=e[6],A=t[6],T+=65535&A,I+=A>>>16,j+=65535&C,R+=C>>>16,I+=T>>>16,j+=I>>>16,R+=j>>>16,e[6]=M=65535&j|R<<16,t[6]=$=65535&T|I<<16,C=L,A=W,T=65535&A,I=A>>>16,j=65535&C,R=C>>>16,C=e[7],A=t[7],T+=65535&A,I+=A>>>16,j+=65535&C,R+=C>>>16,I+=T>>>16,j+=I>>>16,R+=j>>>16,e[7]=L=65535&j|R<<16,t[7]=W=65535&T|I<<16,G+=128,r-=128}return r}function te(e,t,n){var r=new Int32Array(8),i=new Int32Array(8),o=new Uint8Array(256),s,a=n;for(r[0]=1779033703,r[1]=3144134277,r[2]=1013904242,r[3]=2773480762,r[4]=1359893119,r[5]=2600822924,r[6]=528734635,r[7]=1541459225,i[0]=4089235720,i[1]=2227873595,i[2]=4271175723,i[3]=1595750129,i[4]=2917565137,i[5]=725511199,i[6]=4215389547,i[7]=327033209,ee(r,i,t,n),n%=128,s=0;s=0;--i)r=n[i/8|0]>>(7&i)&1,re(e,t,r),ne(t,e),ne(e,e),re(e,t,r)}function se(e,n){var r=[t(),t(),t(),t()];B(r[0],h),B(r[1],f),B(r[2],a),q(r[3],h,f),oe(e,r,n)}function ae(e,n,i){var o=new Uint8Array(64),s=[t(),t(),t(),t()],a;for(i||r(n,32),te(o,n,32),o[0]&=248,o[31]&=127,o[31]|=64,se(s,o),ie(e,s),a=0;a<32;a++)n[a+32]=e[a];return 0}var le=new Float64Array([237,211,245,92,26,99,18,88,214,156,247,162,222,249,222,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16]);function ue(e,t){var n,r,i,o;for(r=63;r>=32;--r){for(n=0,i=r-32,o=r-12;i>8,t[i]-=256*n;t[i]+=n,t[r]=0}for(n=0,i=0;i<32;i++)t[i]+=n-(t[31]>>4)*le[i],n=t[i]>>8,t[i]&=255;for(i=0;i<32;i++)t[i]-=n*le[i];for(r=0;r<32;r++)t[r+1]+=t[r]>>8,e[r]=255&t[r]}function ce(e){var t=new Float64Array(64),n;for(n=0;n<64;n++)t[n]=e[n];for(n=0;n<64;n++)e[n]=0;ue(e,t)}function he(e,n,r,i){var o=new Uint8Array(64),s=new Uint8Array(64),a=new Uint8Array(64),l,u,c=new Float64Array(64),h=[t(),t(),t(),t()];te(o,i,32),o[0]&=248,o[31]&=127,o[31]|=64;var f=r+64;for(l=0;l>7&&U(e[0],s,e[0]),q(e[3],e[0],e[1]),0)}function pe(e,n,r,i){var o,s,a=new Uint8Array(32),l=new Uint8Array(64),u=[t(),t(),t(),t()],c=[t(),t(),t(),t()];if(s=-1,r<64)return-1;if(fe(c,i))return-1;for(o=0;o=0},e.sign.keyPair=function(){var e=new Uint8Array(32),t=new Uint8Array(64);return ae(e,t),{publicKey:e,secretKey:t}},e.sign.keyPair.fromSecretKey=function(e){if(Oe(e),64!==e.length)throw new Error("bad secret key size");for(var t=new Uint8Array(32),n=0;n=this._buffer.length},o.prototype.remainder=function(){return this._buffer.slice(this._offset)},o.prototype.skip=function(e){this._offset+=e},o.prototype.expand=function(){this._size*=2;var e=i.alloc(this._size);this._buffer.copy(e,0),this._buffer=e},o.prototype.readPart=function(){return{data:this.readBuffer()}},o.prototype.readBuffer=function(){var e=this._buffer.readUInt32BE(this._offset);this._offset+=4,r.ok(this._offset+e<=this._buffer.length,"length out of bounds at +0x"+this._offset.toString(16)+" (data truncated?)");var t=this._buffer.slice(this._offset,this._offset+e);return this._offset+=e,t},o.prototype.readString=function(){return this.readBuffer().toString()},o.prototype.readCString=function(){for(var e=this._offset;ethis._size;)this.expand();this._buffer.writeUInt32BE(e.length,this._offset),this._offset+=4,e.copy(this._buffer,this._offset),this._offset+=e.length},o.prototype.writeString=function(e){this.writeBuffer(i.from(e,"utf8"))},o.prototype.writeCString=function(e){for(;this._offset+1+e.length>this._size;)this.expand();this._buffer.write(e,this._offset),this._offset+=e.length,this._buffer[this._offset++]=0},o.prototype.writeInt=function(e){for(;this._offset+4>this._size;)this.expand();this._buffer.writeUInt32BE(e,this._offset),this._offset+=4},o.prototype.writeInt64=function(e){if(r.buffer(e,"value"),e.length>8){for(var t=e.slice(0,e.length-8),n=0;nthis._size;)this.expand();e.copy(this._buffer,this._offset),this._offset+=8},o.prototype.writeChar=function(e){for(;this._offset+1>this._size;)this.expand();this._buffer[this._offset++]=e},o.prototype.writePart=function(e){this.writeBuffer(e.data)},o.prototype.write=function(e){for(;this._offset+e.length>this._size;)this.expand();e.copy(this._buffer,this._offset),this._offset+=e.length}},function(e,t,n){e.exports={read:h,readPkcs8:d,write:f,writePkcs8:A,pkcs8ToBuffer:C,readECDSACurve:b,writeECDSACurve:B};var r=n(25),i=n(84),o=n(29).Buffer,s=n(48),a=n(42),l=n(41),u=n(46),c=n(92);function h(e,t){return c.read(e,t,"pkcs8")}function f(e,t){return c.write(e,t,"pkcs8")}function p(e,t){return r.strictEqual(e.peek(),i.Ber.Integer,t+" is not an Integer"),a.mpNormalize(e.readString(i.Ber.Integer,!0))}function d(e,t,n){n.peek()===i.Ber.Integer&&(r.strictEqual(t,"private","unexpected Integer at start of public key"),n.readString(i.Ber.Integer,!0)),n.readSequence();var o=n.offset+n.length,s=n.readOID();switch(s){case"1.2.840.113549.1.1.1":return n._offset=o,"public"===t?m(n):g(n);case"1.2.840.10040.4.1":return"public"===t?y(n):v(n);case"1.2.840.10045.2.1":return"public"===t?w(n):_(n);case"1.3.101.112":return"public"===t?k(n):S(n);case"1.3.101.110":return"public"===t?E(n):x(n);default:throw new Error("Unknown key type OID "+s)}}function m(e){e.readSequence(i.Ber.BitString),e.readByte(),e.readSequence();var t=p(e,"modulus"),n=p(e,"exponent"),r={type:"rsa",source:e.originalInput,parts:[{name:"e",data:n},{name:"n",data:t}]};return new l(r)}function g(e){e.readSequence(i.Ber.OctetString),e.readSequence();var t=p(e,"version");r.equal(t[0],0,"unknown RSA private key version");var n=p(e,"modulus"),o=p(e,"public exponent"),s=p(e,"private exponent"),a=p(e,"prime1"),l=p(e,"prime2"),c=p(e,"exponent1"),h=p(e,"exponent2"),f=p(e,"iqmp"),d={type:"rsa",parts:[{name:"n",data:n},{name:"e",data:o},{name:"d",data:s},{name:"iqmp",data:f},{name:"p",data:a},{name:"q",data:l},{name:"dmodp",data:c},{name:"dmodq",data:h}]};return new u(d)}function y(e){e.readSequence();var t=p(e,"p"),n=p(e,"q"),r=p(e,"g");e.readSequence(i.Ber.BitString),e.readByte();var o=p(e,"y"),s={type:"dsa",parts:[{name:"p",data:t},{name:"q",data:n},{name:"g",data:r},{name:"y",data:o}]};return new l(s)}function v(e){e.readSequence();var t=p(e,"p"),n=p(e,"q"),r=p(e,"g");e.readSequence(i.Ber.OctetString);var o=p(e,"x"),s=a.calculateDSAPublic(r,t,o),l={type:"dsa",parts:[{name:"p",data:t},{name:"q",data:n},{name:"g",data:r},{name:"y",data:s},{name:"x",data:o}]};return new u(l)}function b(e){var t,n,l,u,c;if(e.peek()===i.Ber.OID){var h=e.readOID();for(n=Object.keys(s.curves),l=0;l=this.validFrom.getTime()&&e.getTime()0&&-1===this.issuer.purposes.indexOf("ca"))&&this.isSignedByKey(e.subjectKey))},v.prototype.getExtension=function(e){r.string(e,"keyOrOid");var t=this.getExtensions().filter(function(t){return"x509"===t.format?t.oid===e:"openssh"===t.format&&t.name===e})[0];return t},v.prototype.getExtensions=function(){var e=[],t=this.signatures.x509;t&&t.extras&&t.extras.exts&&t.extras.exts.forEach(function(t){t.format="x509",e.push(t)});var n=this.signatures.openssh;return n&&n.exts&&n.exts.forEach(function(t){t.format="openssh",e.push(t)}),e},v.prototype.isSignedByKey=function(e){if(h.assertCompatible(e,f,[1,2],"issuerKey"),void 0!==this.issuerKey)return this.issuerKey.fingerprint("sha512").matches(e);var t=Object.keys(this.signatures)[0],n=m[t].verify(this,e);return n&&(this.issuerKey=e),n},v.prototype.signWith=function(e){h.assertCompatible(e,p,[1,2],"key");for(var t=Object.keys(m),n=!1,r=0;r0&&-1===c.indexOf("serverAuth")&&c.push("serverAuth"),m.length>0&&-1===c.indexOf("clientAuth")&&c.push("clientAuth"),(m.length>0||f.length>0)&&(-1===c.indexOf("keyAgreement")&&c.push("keyAgreement"),"rsa"===t.type&&-1===c.indexOf("encryption")&&c.push("encryption"))}var g=new v({subjects:o,issuer:o[0],subjectKey:t.toPublic(),issuerKey:t.toPublic(),signatures:{},serial:u,validFrom:s,validUntil:a,purposes:c});return g.signWith(t),g},v.create=function(e,t,n,o,s){var a;a=Array.isArray(e)?e:[e],r.arrayOfObject(a),a.forEach(function(e){h.assertCompatible(e,d,[1,0],"subject")}),h.assertCompatible(t,f,[1,0],"key"),p.isPrivateKey(t)&&(t=t.toPublic()),h.assertCompatible(n,d,[1,0],"issuer"),h.assertCompatible(o,p,[1,2],"issuer key"),r.optionalObject(s,"options"),void 0===s&&(s={}),r.optionalObject(s.validFrom,"options.validFrom"),r.optionalObject(s.validUntil,"options.validUntil");var l=s.validFrom,u=s.validUntil;if(void 0===l&&(l=new Date),void 0===u){r.optionalNumber(s.lifetime,"options.lifetime");var c=s.lifetime;void 0===c&&(c=31536e4),u=new Date,u.setTime(u.getTime()+1e3*c)}r.optionalBuffer(s.serial,"options.serial");var m=s.serial;void 0===m&&(m=i.from("0000000000000001","hex"));var g=s.purposes;void 0===g&&(g=[]),-1===g.indexOf("signature")&&g.push("signature"),!0===s.ca&&(-1===g.indexOf("ca")&&g.push("ca"),-1===g.indexOf("crl")&&g.push("crl"));var y=a.filter(function(e){return"host"===e.type}),b=a.filter(function(e){return"user"===e.type});y.length>0&&-1===g.indexOf("serverAuth")&&g.push("serverAuth"),b.length>0&&-1===g.indexOf("clientAuth")&&g.push("clientAuth"),(b.length>0||y.length>0)&&(-1===g.indexOf("keyAgreement")&&g.push("keyAgreement"),"rsa"===t.type&&-1===g.indexOf("encryption")&&g.push("encryption"));var _=new v({subjects:a,issuer:n,subjectKey:t,issuerKey:o.toPublic(),signatures:{},serial:m,validFrom:l,validUntil:u,purposes:g});return _.signWith(o),_},v.parse=function(e,t,n){"string"!=typeof e&&r.buffer(e,"data"),void 0===t&&(t="auto"),r.string(t,"format"),"string"==typeof n&&(n={filename:n}),r.optionalObject(n,"options"),void 0===n&&(n={}),r.optionalString(n.filename,"options.filename"),void 0===n.filename&&(n.filename="(unnamed)"),r.object(m[t],"formats[format]");try{var i=m[t].read(e,n);return i}catch(e){throw new g(n.filename,t,e)}},v.isCertificate=function(e,t){return h.isCompatible(e,v,t)},v.prototype._sshpkApiVersion=[1,1],v._oldVersionDetect=function(e){return[1,0]}},function(e,t,n){e.exports=g;var r=n(25),i=n(48),o=n(17),s=n(170),a=n(83),l=n(76),u=n(14),c=n(42),h=n(84),f=n(29).Buffer,p=/^([*]|[a-z0-9][a-z0-9\-]{0,62})(?:\.([*]|[a-z0-9][a-z0-9\-]{0,62}))*$/i,d={cn:"2.5.4.3",o:"2.5.4.10",ou:"2.5.4.11",l:"2.5.4.7",s:"2.5.4.8",c:"2.5.4.6",sn:"2.5.4.4",postalCode:"2.5.4.17",serialNumber:"2.5.4.5",street:"2.5.4.9",x500UniqueIdentifier:"2.5.4.45",role:"2.5.4.72",telephoneNumber:"2.5.4.20",description:"2.5.4.13",dc:"0.9.2342.19200300.100.1.25",uid:"0.9.2342.19200300.100.1.1",mail:"0.9.2342.19200300.100.1.3",title:"2.5.4.12",gn:"2.5.4.42",initials:"2.5.4.43",pseudonym:"2.5.4.65",emailAddress:"1.2.840.113549.1.9.1"},m={};function g(e){var t=this;if(r.object(e,"options"),r.arrayOfObject(e.components,"options.components"),this.components=e.components,this.componentLookup={},this.components.forEach(function(e){e.name&&!e.oid&&(e.oid=d[e.name]),e.oid&&!e.name&&(e.name=m[e.oid]),void 0===t.componentLookup[e.name]&&(t.componentLookup[e.name]=[]),t.componentLookup[e.name].push(e)}),this.componentLookup.cn&&this.componentLookup.cn.length>0&&(this.cn=this.componentLookup.cn[0].value),r.optionalString(e.type,"options.type"),void 0===e.type)1===this.components.length&&this.componentLookup.cn&&1===this.componentLookup.cn.length&&this.componentLookup.cn[0].value.match(p)?(this.type="host",this.hostname=this.componentLookup.cn[0].value):this.componentLookup.dc&&this.components.length===this.componentLookup.dc.length?(this.type="host",this.hostname=this.componentLookup.dc.map(function(e){return e.value}).join(".")):this.componentLookup.uid&&this.components.length===this.componentLookup.uid.length?(this.type="user",this.uid=this.componentLookup.uid[0].value):this.componentLookup.cn&&1===this.componentLookup.cn.length&&this.componentLookup.cn[0].value.match(p)?(this.type="host",this.hostname=this.componentLookup.cn[0].value):this.componentLookup.uid&&1===this.componentLookup.uid.length?(this.type="user",this.uid=this.componentLookup.uid[0].value):this.componentLookup.mail&&1===this.componentLookup.mail.length?(this.type="email",this.email=this.componentLookup.mail[0].value):this.componentLookup.cn&&1===this.componentLookup.cn.length?(this.type="user",this.uid=this.componentLookup.cn[0].value):this.type="unknown";else if(this.type=e.type,"host"===this.type)this.hostname=e.hostname;else if("user"===this.type)this.uid=e.uid;else{if("email"!==this.type)throw new Error("Unknown type "+this.type);this.email=e.email}}Object.keys(d).forEach(function(e){m[d[e]]=e}),g.prototype.toString=function(){return this.components.map(function(e){var t=e.name.toUpperCase();t=t.replace(/=/g,"\\=");var n=e.value;return n=n.replace(/,/g,"\\,"),t+"="+n}).join(", ")},g.prototype.get=function(e,t){r.string(e,"name");var n=this.componentLookup[e];if(void 0!==n&&0!==n.length){if(!t&&n.length>1)throw new Error("Multiple values for attribute "+e);return t?n.map(function(e){return e.value}):n[0].value}},g.prototype.toArray=function(e){return this.components.map(function(e){return{name:e.name,value:e.value}})};var y=/[^a-zA-Z0-9 '(),+.\/:=?-]/,v=/[^\x00-\x7f]/;function b(e,t){if("**"===e||"**"===t)return!0;var n=e.split("."),r=t.split(".");if(n.length!==r.length)return!1;for(var i=0;i0;){var o;if(null!==(o=/^,/.exec(i)))t[++n]="",i=i.slice(o[0].length);else if(null!==(o=/^\\,/.exec(i)))t[n]+=",",i=i.slice(o[0].length);else if(null!==(o=/^\\./.exec(i)))t[n]+=o[0],i=i.slice(o[0].length);else{if(null===(o=/^[^\\,]+/.exec(i)))throw new Error("Failed to parse DN");t[n]+=o[0],i=i.slice(o[0].length)}}var s=t.map(function(e){e=e.trim();for(var t=e.indexOf("=");t>0&&"\\"===e.charAt(t-1);)t=e.indexOf("=",t+1);if(-1===t)throw new Error("Failed to parse DN");var n=e.slice(0,t).toLowerCase().replace(/\\=/g,"="),r=e.slice(t+1);return{name:n,value:r}});return new g({components:s})},g.fromArray=function(e){return r.arrayOfObject(e,"components"),e.forEach(function(e){if(r.object(e,"component"),r.string(e.name,"component.name"),!f.isBuffer(e.value)&&"string"!=typeof e.value)throw new Error("Invalid component value")}),new g({components:e})},g.parseAsn1=function(e,t){var n=[];e.readSequence(t);for(var r=e.offset+e.length;e.offset= 0x80 (not a basic code point)","invalid-input":"Invalid input"},E=h-f,S=Math.floor,x=String.fromCharCode,C;function A(e){throw new RangeError(k[e])}function T(e,t){for(var n=e.length,r=[];n--;)r[n]=t(e[n]);return r}function I(e,t){var n=e.split("@"),r="";n.length>1&&(r=n[0]+"@",e=n[1]),e=e.replace(w,".");var i=e.split("."),o=T(i,t).join(".");return r+o}function j(e){for(var t=[],n=0,r=e.length,i,o;n=55296&&i<=56319&&n65535&&(e-=65536,t+=x(e>>>10&1023|55296),e=56320|1023&e),t+=x(e),t}).join("")}function B(e){return e-48<10?e-22:e-65<26?e-65:e-97<26?e-97:h}function O(e,t){return e+22+75*(e<26)-((0!=t)<<5)}function P(e,t,n){var r=0;for(e=n?S(e/m):e>>1,e+=S(e/t);e>E*p>>1;r+=h)e=S(e/E);return S(r+(E+1)*e/(e+d))}function N(e){var t=[],n=e.length,r,i=0,o=y,s=g,a,l,u,d,m,b,_,w,k;for(a=e.lastIndexOf(v),a<0&&(a=0),l=0;l=128&&A("not-basic"),t.push(e.charCodeAt(l));for(u=a>0?a+1:0;u=n&&A("invalid-input"),_=B(e.charCodeAt(u++)),(_>=h||_>S((c-i)/m))&&A("overflow"),i+=_*m,w=b<=s?f:b>=s+p?p:b-s,!(_S(c/k)&&A("overflow"),m*=k;r=t.length+1,s=P(i-d,r,0==d),S(i/r)>c-o&&A("overflow"),o+=S(i/r),i%=r,t.splice(i++,0,o)}return R(t)}function D(e){var t,n,r,i,o,s,a,l,u,d,m,b=[],_,w,k,E;for(e=j(e),_=e.length,t=y,n=0,o=g,s=0;s<_;++s)m=e[s],m<128&&b.push(x(m));for(r=i=b.length,i&&b.push(v);r<_;){for(a=c,s=0;s<_;++s)m=e[s],m>=t&&mS((c-n)/w)&&A("overflow"),n+=(a-t)*w,t=a,s=0;s<_;++s)if(m=e[s],mc&&A("overflow"),m==t){for(l=n,u=h;d=u<=o?f:u>=o+p?p:u-o,!(le.toJSON()),size:this.size})),Object.assign({},this._json)}toString(){return`DAGNode `}get data(){return this._data}set data(e){throw new Error("Can't set property: 'data' is immutable")}get links(){return this._links}set links(e){throw new Error("Can't set property: 'links' is immutable")}get size(){return void 0===this._size&&(this._size=this.links.reduce((e,t)=>e+t.size,this._serializedSize)),this._size}set size(e){throw new Error("Can't set property: 'size' is immutable")}}t=e.exports=o(s,{className:"DAGNode",symbolName:"@ipld/js-ipld-dag-pb/dagnode"}),t.create=n(191),t.clone=n(730),t.addLink=n(731),t.rmLink=n(732)}).call(this,n(0).Buffer)},function(e,t,n){"use strict";(function(t){const r=n(716),{serialize:i}=n(192),o=n(193),s=o.linkSort,a=n(190),l=n(96);function u(e,n,o){if("function"==typeof e?(o=e,e=void 0):"string"==typeof e&&(e=t.from(e)),"function"==typeof n&&(o=n,n=[]),!t.isBuffer(e))return o(new Error("Passed 'data' is not a buffer or a string!"));n=n.map(e=>l.isDAGLink(e)?e:l.util.createDagLinkFromB58EncodedHash(e)),n=r(n,s),i({data:e,links:n},(t,r)=>t?o(t):o(null,new a(e,n,r.length)))}e.exports=u}).call(this,n(0).Buffer)},function(e,t,n){"use strict";(function(r){const i=n(9),o=n(55),s=o(n(727)),a=n(364),l=n(96),u=n(190),c=n(54),h=n(10),f=n(19);function p(e,t,n){"function"==typeof t&&(n=t,t={}),t=t||{};const o=t.hashAlg||a.defaultHashAlg;let s=t.version;void 0===s&&(s="sha2-256"===o?0:1),h([t=>{if(r.isBuffer(e))return t(null,e);d(e,t)},(e,t)=>c(e,o,t),(e,t)=>t(null,new i(s,a.multicodec,e))],n)}function d(e,t){let n,{data:r,links:i=[]}=e;!u.isDAGNode(e)&&i&&(i=i.map(e=>l.isDAGLink(e)?e:l.util.createDagLinkFromB58EncodedHash(e)));try{n=s.PBNode.encode(g({data:r,links:i}))}catch(e){return t(e)}t(null,n)}function m(e,t){const n=s.PBNode.decode(e),i=n.Links.map(e=>new l(e.Name,e.Tsize,e.Hash)),o=null==n.Data?r.alloc(0):n.Data;f(()=>t(null,new u(o,i,e.length)))}function g(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.cid.buffer,Name:e.name,Tsize:e.size})):t.Links=null,t}t=e.exports,t.serialize=d,t.deserialize=m,t.cid=p}).call(this,n(0).Buffer)},function(e,t,n){"use strict";(function(r){const i=n(96),{cid:o}=n(192);function s(e){let t;return e.data&&e.data.length>0?(t=r.alloc(e.data.length),e.data.copy(t)):t=r.alloc(0),t}function a(e){return e.links.slice()}function l(e,t){return r.compare(e.nameAsBuffer,t.nameAsBuffer)}function u(e,t,n){"function"==typeof t&&(n=t,t={}),o(e,t,(r,o)=>{if(r)return n(r);n(null,new i(t.name||"",e.size,o))})}t=e.exports,t.cloneData=s,t.cloneLinks=a,t.linkSort=l,t.toDAGLink=u}).call(this,n(0).Buffer)},function(e,t,n){var r=n(20);function i(e,t){var n=function(){return new r.aes.Algorithm(e,t)};r.cipher.registerAlgorithm(e,n)}n(368),n(369),n(30),e.exports=r.aes=r.aes||{},r.aes.startEncrypting=function(e,t,n,r){var i=m({key:e,output:n,decrypt:!1,mode:r});return i.start(t),i},r.aes.createEncryptionCipher=function(e,t){return m({key:e,output:null,decrypt:!1,mode:t})},r.aes.startDecrypting=function(e,t,n,r){var i=m({key:e,output:n,decrypt:!0,mode:r});return i.start(t),i},r.aes.createDecryptionCipher=function(e,t){return m({key:e,output:null,decrypt:!0,mode:t})},r.aes.Algorithm=function(e,t){o||f();var n=this;n.name=e,n.mode=new t({blockSize:16,cipher:{encrypt:function(e,t){return d(n._w,e,t,!1)},decrypt:function(e,t){return d(n._w,e,t,!0)}}}),n._init=!1},r.aes.Algorithm.prototype.initialize=function(e){if(!this._init){var t=e.key,n;if("string"!=typeof t||16!==t.length&&24!==t.length&&32!==t.length){if(r.util.isArray(t)&&(16===t.length||24===t.length||32===t.length)){n=t,t=r.util.createBuffer();for(var i=0;i>>=2;for(var i=0;i>8^255&p^99,a[n]=p,l[p]=n,d=e[p],i=e[n],s=e[i],f=e[s],m=d<<24^p<<16^p<<8^p^d,g=(i^s^f)<<24^(n^f)<<16^(n^s^f)<<8^n^i^f;for(var y=0;y<4;++y)c[y][n]=m,h[y][p]=g,m=m<<24|m>>>8,g=g<<24|g>>>8;0===n?n=r=1:(n=i^e[e[e[i^f]]],r^=e[e[r]])}}function p(e,t){for(var n=e.slice(0),r,i=1,o=n.length,l=o+6+1,c=s*l,f=o;f>>16&255]<<24^a[r>>>8&255]<<16^a[255&r]<<8^a[r>>>24]^u[i]<<24,i++):o>6&&f%o==4&&(r=a[r>>>24]<<24^a[r>>>16&255]<<16^a[r>>>8&255]<<8^a[255&r]),n[f]=n[f-o]^r;if(t){var p,d=h[0],m=h[1],g=h[2],y=h[3],v=n.slice(0);c=n.length;for(var f=0,b=c-s;f>>24]]^m[a[p>>>16&255]]^g[a[p>>>8&255]]^y[a[255&p]];n=v}return n}function d(e,t,n,r){var i=e.length/4-1,o,s,u,f,p,d,m,g,y,v,b,_;r?(o=h[0],s=h[1],u=h[2],f=h[3],p=l):(o=c[0],s=c[1],u=c[2],f=c[3],p=a),d=t[0]^e[0],m=t[r?3:1]^e[1],g=t[2]^e[2],y=t[r?1:3]^e[3];for(var w=3,k=1;k>>24]^s[m>>>16&255]^u[g>>>8&255]^f[255&y]^e[++w],b=o[m>>>24]^s[g>>>16&255]^u[y>>>8&255]^f[255&d]^e[++w],_=o[g>>>24]^s[y>>>16&255]^u[d>>>8&255]^f[255&m]^e[++w],y=o[y>>>24]^s[d>>>16&255]^u[m>>>8&255]^f[255&g]^e[++w],d=v,m=b,g=_;n[0]=p[d>>>24]<<24^p[m>>>16&255]<<16^p[g>>>8&255]<<8^p[255&y]^e[++w],n[r?3:1]=p[m>>>24]<<24^p[g>>>16&255]<<16^p[y>>>8&255]<<8^p[255&d]^e[++w],n[2]=p[g>>>24]<<24^p[y>>>16&255]<<16^p[d>>>8&255]<<8^p[255&m]^e[++w],n[r?1:3]=p[y>>>24]<<24^p[d>>>16&255]<<16^p[m>>>8&255]<<8^p[255&g]^e[++w]}function m(e){e=e||{};var t=(e.mode||"CBC").toUpperCase(),n="AES-"+t,i;i=e.decrypt?r.cipher.createDecipher(n,e.key):r.cipher.createCipher(n,e.key);var o=i.start;return i.start=function(e,t){var n=null;t instanceof r.util.ByteBuffer&&(n=t,t={}),t=t||{},t.output=n,t.iv=e,o.call(i,t)},i}},function(e,t,n){"use strict";var r=n(5).Buffer,i=n(787),o;function s(){this.negative=0,this.words=null,this.length=0}s.fromNumber=function(e){var t=new s;return t.words=[67108863&e],t.length=1,t},s.fromBuffer=function(e){var t=new s;return t.words=new Array(10),t.words[0]=(3&e[28])<<24|e[29]<<16|e[30]<<8|e[31],t.words[1]=(15&e[25])<<22|e[26]<<14|e[27]<<6|e[28]>>>2,t.words[2]=(63&e[22])<<20|e[23]<<12|e[24]<<4|e[25]>>>4,t.words[3]=(255&e[19])<<18|e[20]<<10|e[21]<<2|e[22]>>>6,t.words[4]=(3&e[15])<<24|e[16]<<16|e[17]<<8|e[18],t.words[5]=(15&e[12])<<22|e[13]<<14|e[14]<<6|e[15]>>>2,t.words[6]=(63&e[9])<<20|e[10]<<12|e[11]<<4|e[12]>>>4,t.words[7]=(255&e[6])<<18|e[7]<<10|e[8]<<2|e[9]>>>6,t.words[8]=(3&e[2])<<24|e[3]<<16|e[4]<<8|e[5],t.words[9]=e[0]<<14|e[1]<<6|e[2]>>>2,t.length=10,t.strip()},s.prototype.toBuffer=function(){for(var e=this.words,t=this.length;t<10;++t)e[t]=0;return r.from([e[9]>>>14&255,e[9]>>>6&255,(63&e[9])<<2|e[8]>>>24&3,e[8]>>>16&255,e[8]>>>8&255,255&e[8],e[7]>>>18&255,e[7]>>>10&255,e[7]>>>2&255,(3&e[7])<<6|e[6]>>>20&63,e[6]>>>12&255,e[6]>>>4&255,(15&e[6])<<4|e[5]>>>22&15,e[5]>>>14&255,e[5]>>>6&255,(63&e[5])<<2|e[4]>>>24&3,e[4]>>>16&255,e[4]>>>8&255,255&e[4],e[3]>>>18&255,e[3]>>>10&255,e[3]>>>2&255,(3&e[3])<<6|e[2]>>>20&63,e[2]>>>12&255,e[2]>>>4&255,(15&e[2])<<4|e[1]>>>22&15,e[1]>>>14&255,e[1]>>>6&255,(63&e[1])<<2|e[0]>>>24&3,e[0]>>>16&255,e[0]>>>8&255,255&e[0]])},s.prototype.clone=function(){var e=new s;e.words=new Array(this.length);for(var t=0;t1&&0==(0|this.words[this.length-1]);)this.length--;return this},s.prototype.normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},s.prototype.isEven=function(){return 0==(1&this.words[0])},s.prototype.isOdd=function(){return 1==(1&this.words[0])},s.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},s.prototype.ucmp=function(e){if(this.length!==e.length)return this.length>e.length?1:-1;for(var t=this.length-1;t>=0;--t)if(this.words[t]!==e.words[t])return this.words[t]>e.words[t]?1:-1;return 0},s.prototype.gtOne=function(){return this.length>1||this.words[0]>1},s.prototype.isOverflow=function(){return this.ucmp(s.n)>=0},s.prototype.isHigh=function(){return 1===this.ucmp(s.nh)},s.prototype.bitLengthGT256=function(){return this.length>10||10===this.length&&this.words[9]>4194303},s.prototype.iuaddn=function(e){this.words[0]+=e;for(var t=0;this.words[t]>67108863&&te.length?(t=this,n=e):(t=e,n=this);for(var r=0,i=0;r>>26}for(;0!==i&&r>>26;if(this.length=t.length,0!==i)this.words[this.length++]=i;else if(t!==this)for(;r0?(n=this,r=e):(n=e,r=this);for(var i=0,o=0;i>26,this.words[i]=67108863&s}for(;0!==o&&i>26,this.words[i]=67108863&s;if(0===o&&i>>26,c=67108863&s,h=Math.max(0,a-e.length+1),f=Math.min(a,t.length-1);h<=f;h++){var p=a-h,d=e.words[p],m=t.words[h],g=d*m+c;u+=g/67108864|0,c=67108863&g}n.words[a]=c,s=u}return 0!==s&&(n.words[n.length++]=s),n.strip()},s.umulTo10x10=Math.imul?i.umulTo10x10:s.umulTo,s.umulnTo=function(e,t,n){if(0===t)return n.words=[0],n.length=1,n;for(var r=0,i=0;r0?(n.words[r]=i,n.length=e.length+1):n.length=e.length,n},s.prototype.umul=function(e){var t=new s;return t.words=new Array(this.length+e.length),10===this.length&&10===e.length?s.umulTo10x10(this,e,t):1===this.length?s.umulnTo(e,this.words[0],t):1===e.length?s.umulnTo(this,e.words[0],t):s.umulTo(this,e,t)},s.prototype.isplit=function(e){e.length=Math.min(this.length,9);for(var t=0;t>>22,n=r}return n>>>=22,this.words[t-10]=n,0===n&&this.length>10?this.length-=10:this.length-=9,this},s.prototype.fireduce=function(){return this.isOverflow()&&this.isub(s.n),this},s.prototype.ureduce=function(){var e=this.clone().isplit(s.tmp).umul(s.nc).iadd(s.tmp);return e.bitLengthGT256()&&(e=e.isplit(s.tmp).umul(s.nc).iadd(s.tmp),e.bitLengthGT256()&&(e=e.isplit(s.tmp).umul(s.nc).iadd(s.tmp))),e.fireduce()},s.prototype.ishrn=function(e){for(var t=(1<=0;--r){var o=this.words[r];this.words[r]=i<>>e,i=o&t}return this.length>1&&0===this.words[this.length-1]&&(this.length-=1),this},s.prototype.uinvm=function(){for(var e=this.clone(),t=s.n.clone(),n=s.fromNumber(1),r=s.fromNumber(0),i=s.fromNumber(0),o=s.fromNumber(1);e.isEven()&&t.isEven();){for(var a=1,l=1;0==(e.words[0]&l)&&0==(t.words[0]&l)&&a<26;++a,l<<=1);e.ishrn(a),t.ishrn(a)}for(var u=t.clone(),c=e.clone();!e.isZero();){for(var h=0,f=1;0==(e.words[0]&f)&&h<26;++h,f<<=1);if(h>0)for(e.ishrn(h);h-- >0;)(n.isOdd()||r.isOdd())&&(n.iadd(u),r.isub(c)),n.ishrn(1),r.ishrn(1);for(var p=0,d=1;0==(t.words[0]&d)&&p<26;++p,d<<=1);if(p>0)for(t.ishrn(p);p-- >0;)(i.isOdd()||o.isOdd())&&(i.iadd(u),o.isub(c)),i.ishrn(1),o.ishrn(1);e.ucmp(t)>=0?(e.isub(t),n.isub(i),r.isub(o)):(t.isub(e),i.isub(n),o.isub(r))}if(1===i.negative){i.negative=0;var m=i.ureduce();return m.negative^=1,m.normSign().iadd(s.n)}return i.ureduce()},s.prototype.imulK=function(){this.words[this.length]=0,this.words[this.length+1]=0,this.length+=2;for(var e=0,t=0;e0?this.isub(s.p):this.strip(),this},s.prototype.redNeg=function(){return this.isZero()?s.fromNumber(0):s.p.sub(this)},s.prototype.redAdd=function(e){return this.clone().redIAdd(e)},s.prototype.redIAdd=function(e){return this.iadd(e),this.ucmp(s.p)>=0&&this.isub(s.p),this},s.prototype.redIAdd7=function(){return this.iuaddn(7),this.ucmp(s.p)>=0&&this.isub(s.p),this},s.prototype.redSub=function(e){return this.clone().redISub(e)},s.prototype.redISub=function(e){return this.isub(e),0!==this.negative&&this.iadd(s.p),this},s.prototype.redMul=function(e){return this.umul(e).redIReduce()},s.prototype.redSqr=function(){return this.umul(this).redIReduce()},s.prototype.redSqrt=function(){if(this.isZero())return this.clone();for(var e=this.redSqr(),t=e.redSqr(),n=t.redSqr().redMul(t),r=n.redMul(e),i=r.redMul(this),o=i,s=0;s<54;++s)o=o.redSqr().redSqr().redSqr().redSqr().redMul(i);for(o=o.redSqr().redSqr().redSqr().redSqr().redMul(r),s=0;s<5;++s)o=o.redSqr().redSqr().redSqr().redSqr().redMul(i);return o=o.redSqr().redSqr().redSqr().redSqr().redMul(n),o=o.redSqr().redSqr().redSqr().redSqr().redSqr().redSqr().redMul(n),0===o.redSqr().ucmp(this)?o:null},s.prototype.redInvm=function(){for(var e=this.clone(),t=s.p.clone(),n=s.fromNumber(1),r=s.fromNumber(0),i;e.gtOne()&&t.gtOne();){for(var o=0,a=1;0==(e.words[0]&a)&&o<26;++o,a<<=1);if(o>0)for(e.ishrn(o);o-- >0;)n.isOdd()&&n.iadd(s.p),n.ishrn(1);for(var l=0,u=1;0==(t.words[0]&u)&&l<26;++l,u<<=1);if(l>0)for(t.ishrn(l);l-- >0;)r.isOdd()&&r.iadd(s.p),r.ishrn(1);e.ucmp(t)>=0?(e.isub(t),n.isub(r)):(t.isub(e),r.isub(n))}return i=1===e.length&&1===e.words[0]?n:r,0!==i.negative&&i.iadd(s.p),0!==i.negative?(i.negative=0,i.redIReduce().redNeg()):i.redIReduce()},s.prototype.getNAF=function(e){for(var t=[],n=1<>1,o=this.clone();!o.isZero();){for(var s=0,a=1;0==(o.words[0]&a)&&s<26;++s,a<<=1)t.push(0);if(0!==s)o.ishrn(s);else{var l=o.words[0]&r;if(l>=i)t.push(i-l),o.iuaddn(l-i).ishrn(1);else if(t.push(l),o.words[0]-=l,!o.isZero()){for(s=e-1;s>0;--s)t.push(0);o.ishrn(e)}}}return t},s.prototype.inspect=function(){if(this.isZero())return"0";for(var e=this.toBuffer().toString("hex"),t=0;"0"===e[t];++t);return e.slice(t)},s.n=s.fromBuffer(r.from("FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141","hex")),s.nh=s.n.clone().ishrn(1),s.nc=s.fromBuffer(r.from("000000000000000000000000000000014551231950B75FC4402DA1732FC9BEBF","hex")),s.p=s.fromBuffer(r.from("FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFC2F","hex")),s.psn=s.p.sub(s.n),s.tmp=new s,s.tmp.words=new Array(10),o=s.fromNumber(1),o.words[3]=0,e.exports=s},function(e,t){t.endianness=function(){return"LE"},t.hostname=function(){return"undefined"!=typeof location?location.hostname:""},t.loadavg=function(){return[]},t.uptime=function(){return 0},t.freemem=function(){return Number.MAX_VALUE},t.totalmem=function(){return Number.MAX_VALUE},t.cpus=function(){return[]},t.type=function(){return"Browser"},t.release=function(){return"undefined"!=typeof navigator?navigator.appVersion:""},t.networkInterfaces=t.getNetworkInterfaces=function(){return{}},t.arch=function(){return"javascript"},t.platform=function(){return"browser"},t.tmpdir=t.tmpDir=function(){return"/tmp"},t.EOL="\n",t.homedir=function(){return"/"}},function(e,t,n){var r=n(5).Buffer;function i(e){r.isBuffer(e)||(e=r.from(e));for(var t=e.length/4|0,n=new Array(t),i=0;i>>24]^s[c>>>16&255]^a[h>>>8&255]^l[255&f]^t[y++],d=o[c>>>24]^s[h>>>16&255]^a[f>>>8&255]^l[255&u]^t[y++],m=o[h>>>24]^s[f>>>16&255]^a[u>>>8&255]^l[255&c]^t[y++],g=o[f>>>24]^s[u>>>16&255]^a[c>>>8&255]^l[255&h]^t[y++],u=p,c=d,h=m,f=g;return p=(r[u>>>24]<<24|r[c>>>16&255]<<16|r[h>>>8&255]<<8|r[255&f])^t[y++],d=(r[c>>>24]<<24|r[h>>>16&255]<<16|r[f>>>8&255]<<8|r[255&u])^t[y++],m=(r[h>>>24]<<24|r[f>>>16&255]<<16|r[u>>>8&255]<<8|r[255&c])^t[y++],g=(r[f>>>24]<<24|r[u>>>16&255]<<16|r[c>>>8&255]<<8|r[255&h])^t[y++],p>>>=0,d>>>=0,m>>>=0,g>>>=0,[p,d,m,g]}var a=[0,1,2,4,8,16,32,64,128,27,54],l=function(){for(var e=new Array(256),t=0;t<256;t++)e[t]=t<128?t<<1:t<<1^283;for(var n=[],r=[],i=[[],[],[],[]],o=[[],[],[],[]],s=0,a=0,l=0;l<256;++l){var u=a^a<<1^a<<2^a<<3^a<<4;u=u>>>8^255&u^99,n[s]=u,r[u]=s;var c=e[s],h=e[c],f=e[h],p=257*e[u]^16843008*u;i[0][s]=p<<24|p>>>8,i[1][s]=p<<16|p>>>16,i[2][s]=p<<8|p>>>24,i[3][s]=p,p=16843009*f^65537*h^257*c^16843008*s,o[0][u]=p<<24|p>>>8,o[1][u]=p<<16|p>>>16,o[2][u]=p<<8|p>>>24,o[3][u]=p,0===s?s=a=1:(s=c^e[e[e[f^c]]],a^=e[e[a]])}return{SBOX:n,INV_SBOX:r,SUB_MIX:i,INV_SUB_MIX:o}}();function u(e){this._key=i(e),this._reset()}u.blockSize=16,u.keySize=32,u.prototype.blockSize=u.blockSize,u.prototype.keySize=u.keySize,u.prototype._reset=function(){for(var e=this._key,t=e.length,n=t+6,r=4*(n+1),i=[],o=0;o>>24,s=l.SBOX[s>>>24]<<24|l.SBOX[s>>>16&255]<<16|l.SBOX[s>>>8&255]<<8|l.SBOX[255&s],s^=a[o/t|0]<<24):t>6&&o%t==4&&(s=l.SBOX[s>>>24]<<24|l.SBOX[s>>>16&255]<<16|l.SBOX[s>>>8&255]<<8|l.SBOX[255&s]),i[o]=i[o-t]^s}for(var u=[],c=0;c>>24]]^l.INV_SUB_MIX[1][l.SBOX[f>>>16&255]]^l.INV_SUB_MIX[2][l.SBOX[f>>>8&255]]^l.INV_SUB_MIX[3][l.SBOX[255&f]]}this._nRounds=n,this._keySchedule=i,this._invKeySchedule=u},u.prototype.encryptBlockRaw=function(e){return e=i(e),s(e,this._keySchedule,l.SUB_MIX,l.SBOX,this._nRounds)},u.prototype.encryptBlock=function(e){var t=this.encryptBlockRaw(e),n=r.allocUnsafe(16);return n.writeUInt32BE(t[0],0),n.writeUInt32BE(t[1],4),n.writeUInt32BE(t[2],8),n.writeUInt32BE(t[3],12),n},u.prototype.decryptBlock=function(e){e=i(e);var t=e[1];e[1]=e[3],e[3]=t;var n=s(e,this._invKeySchedule,l.INV_SUB_MIX,l.INV_SBOX,this._nRounds),o=r.allocUnsafe(16);return o.writeUInt32BE(n[0],0),o.writeUInt32BE(n[3],4),o.writeUInt32BE(n[2],8),o.writeUInt32BE(n[1],12),o},u.prototype.scrub=function(){o(this._keySchedule),o(this._invKeySchedule),o(this._key)},e.exports.AES=u},function(e,t,n){"use strict";(function(t){const r=n(70),i=n(27),o=n(60),s=n(21),a=n(72),l=n(814),u=/^https?:\/\/[^/]+\/(ip(f|n)s)\/((\w+).*)/,c=/^\/(ip(f|n)s)\/((\w+).*)/,h=1,f=4,p=/^https?:\/\/([^/]+)\.(ip(?:f|n)s)\.[^/]+/,d=1,m=2;function g(e){const n=S(e);try{const e=t.from(r.decode(n));return i.decode(e),!0}catch(e){return!1}}function y(e){try{return o.isEncoded(e)}catch(e){return!1}}function v(e){try{return new l(e),!0}catch(e){return!1}}function b(e){if(!e)return!1;if(s.isMultiaddr(e))return!0;try{return new s(e),!0}catch(e){return!1}}function _(e){return b(e)&&a.IPFS.matches(e)}function w(e,t,n=h,r=f){const i=S(e);if(!i)return!1;const o=i.match(t);if(!o)return!1;if("ipfs"!==o[n])return!1;let s=o[r];return s&&t===p&&(s=s.toLowerCase()),v(s)}function k(e,t,n=h,r){const i=S(e);if(!i)return!1;const o=i.match(t);if(!o)return!1;if("ipns"!==o[n])return!1;if(r&&t===p){let e=o[r];return e=e.toLowerCase(),v(e)}return!0}function E(e){return"string"==typeof e}function S(e){return t.isBuffer(e)?r.encode(e):!!E(e)&&e}const x=e=>w(e,p,2,1),C=e=>k(e,p,2,1);e.exports={multihash:g,multiaddr:b,peerMultiaddr:_,cid:v,base32cid:e=>"base32"===y(e)&&v(e),ipfsSubdomain:x,ipnsSubdomain:C,subdomain:e=>x(e)||C(e),subdomainPattern:p,ipfsUrl:e=>w(e,u),ipnsUrl:e=>k(e,u),url:e=>w(e,u)||k(e,u),urlPattern:u,ipfsPath:e=>w(e,c),ipnsPath:e=>k(e,c),path:e=>w(e,c)||k(e,c),pathPattern:c,urlOrPath:e=>w(e,u)||k(e,u)||w(e,c)||k(e,c),cidPath:e=>E(e)&&!v(e)&&w(`/ipfs/${e}`,c)}}).call(this,n(0).Buffer)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(326),i=a(r),o=n(109),s=a(o);function a(e){return e&&e.__esModule?e:{default:e}}t.default=(0,s.default)(i.default,1),e.exports=t.default},function(e,t,n){var r,i;r=this,e.exports=function(e,t,n,r,i){for(t=t.split?t.split("."):t,r=0;r{e.put(this.transform.convert(t),n)},delete:t=>{e.delete(this.transform.convert(t))},commit:t=>{e.commit(t)}}}query(e){return r(this.child.query(e),r.map(e=>(e.key=this.transform.invert(e.key),e)))}close(e){this.child.close(e)}}e.exports=i},function(e,t,n){"use strict";(function(t){const r=n(18),i=n(837),o=n(28).utils.asyncFilter,s=n(28).utils.asyncSort,a=n(28).Key,l=n(28).Errors,u=n(846);class c{constructor(e,t){let r;t&&t.db?(r=t.db,delete t.db):r=n(850),this.db=i(u(r(e),{valueEncoding:"binary"}),Object.assign({},t,{compression:!1}),e=>{if(e)throw e})}open(e){this.db.open(t=>{if(t)return e(l.dbOpenFailedError(t));e()})}put(e,t,n){this.db.put(e.toString(),t,e=>{if(e)return n(l.dbWriteFailedError(e));n()})}get(e,t){this.db.get(e.toString(),(e,n)=>{if(e)return t(l.notFoundError(e));t(null,n)})}has(e,t){this.db.get(e.toString(),(e,n)=>{if(e)return e.notFound?void t(null,!1):void t(e);t(null,!0)})}delete(e,t){this.db.del(e.toString(),e=>{if(e)return t(l.dbDeleteFailedError(e));t()})}close(e){this.db.close(e)}batch(){const e=[];return{put:(t,n)=>{e.push({type:"put",key:t.toString(),value:n})},delete:t=>{e.push({type:"del",key:t.toString()})},commit:t=>{this.db.batch(e,t)}}}query(e){let n=!0;null!=e.keysOnly&&(n=!e.keysOnly);const i=this.db.db.iterator({keys:!0,values:n,keyAsBuffer:!0}),l=(e,r)=>{if(e)return i.end(t=>{r(t||e)});i.next((e,o,s)=>{if(e)return r(e);if(null==e&&null==o&&null==s)return i.end(e=>{r(e||!0)});const l={key:new a(o,!1)};n&&(l.value=t.from(s)),r(null,l)})};let u=[l],c=[];if(null!=e.prefix){const t=e.prefix;c.push((e,n)=>n(null,e.key.toString().startsWith(t)))}if(null!=e.filters&&(c=c.concat(e.filters)),u=u.concat(c.map(e=>o(e))),null!=e.orders&&(u=u.concat(e.orders.map(e=>s(e)))),null!=e.offset){let t=0;u.push(r.filter(()=>t++>=e.offset))}return null!=e.limit&&u.push(r.take(e.limit)),r.apply(null,u)}}e.exports=c}).call(this,n(0).Buffer)},function(e,t){t.getCallback=function(e,t){return"function"==typeof e?e:t},t.getOptions=function(e){return"object"==typeof e&&null!==e?e:{}}},function(e,t,n){"use strict";const r=n(55),i=n(114),o=n(877),s=n(23),a=n(38),l=n(47),u=n(9),c=n(340),h=n(878),f=n(54),p=r(n(879)),d=n(880);class m{constructor(e){this.full=e,this.wantlist=new Map,this.blocks=new Map}get empty(){return 0===this.blocks.size&&0===this.wantlist.size}addEntry(e,t,n){s(e&&u.isCID(e),"must be a valid cid");const r=e.buffer.toString(),i=this.wantlist.get(r);i?(i.priority=t,i.cancel=Boolean(n)):this.wantlist.set(r,new d(e,t,n))}addBlock(e){s(i.isBlock(e),"must be a valid cid");const t=e.cid.buffer.toString();this.blocks.set(t,e)}cancel(e){s(u.isCID(e),"must be a valid cid");const t=e.buffer.toString();this.wantlist.delete(t),this.addEntry(e,0,!0)}serializeToBitswap100(){const e={wantlist:{entries:Array.from(this.wantlist.values()).map(e=>({block:e.cid.buffer,priority:Number(e.priority),cancel:Boolean(e.cancel)}))},blocks:Array.from(this.blocks.values()).map(e=>e.data)};return this.full&&(e.wantlist.full=!0),p.Message.encode(e)}serializeToBitswap110(){const e={wantlist:{entries:Array.from(this.wantlist.values()).map(e=>({block:e.cid.buffer,priority:Number(e.priority),cancel:Boolean(e.cancel)}))},payload:[]};return this.full&&(e.wantlist.full=!0),this.blocks.forEach(t=>{e.payload.push({prefix:t.cid.prefix,data:t.data})}),p.Message.encode(e)}equals(e){const t=(e,t)=>{if(e.equals&&"function"==typeof e.equals)return e.equals(t)};return!(this.full!==e.full||!o(this.wantlist,e.wantlist,t)||!o(this.blocks,e.blocks,t))}get[Symbol.toStringTag](){const e=Array.from(this.wantlist.keys()),t=Array.from(this.blocks.keys());return`BitswapMessage `}}m.deserialize=((e,t)=>{let n;try{n=p.Message.decode(e)}catch(e){return l(()=>t(e))}const r=n.wantlist&&n.wantlist.full||!1,o=new m(r);return n.wantlist&&n.wantlist.entries.forEach(e=>{let n;try{n=new u(e.block)}catch(e){return t(e)}o.addEntry(n,e.priority,e.cancel)}),n.blocks.length>0?a(n.blocks,(e,n)=>{f(e,"sha2-256",(r,s)=>{if(r)return n(r);let a;try{a=new u(s)}catch(r){return t(r)}o.addBlock(new i(e,a)),n()})},e=>{if(e)return t(e);t(null,o)}):n.payload.length>0?a(n.payload,(e,t)=>{if(!e.prefix||!e.data)return l(t);const n=h(e.prefix),r=n[0],s=n[1],a=n[2];f(e.data,a,(n,a)=>{if(n)return t(n);let l;try{l=new u(r,c[s.toString("16")],a)}catch(n){return t(n)}o.addBlock(new i(e.data,l)),t()})},e=>{if(e)return t(e);t(null,o)}):void t(null,o)}),m.Entry=d,e.exports=m},function(e,t,n){"use strict";const{sortBy:r}=n(100),i=n(881);class o{constructor(e){this.set=new Map,this._stats=e}get length(){return this.set.size}add(e,t){const n=e.buffer.toString(),r=this.set.get(n);r?(r.inc(),r.priority=t):(this.set.set(n,new i(e,t)),this._stats&&this._stats.push(null,"wantListSize",1))}remove(e){const t=e.buffer.toString(),n=this.set.get(t);n&&(n.dec(),n.hasRefs()||(this.set.delete(t),this._stats&&this._stats.push(null,"wantListSize",-1)))}removeForce(e){this.set.has(e)&&this.set.delete(e)}forEach(e){return this.set.forEach(e)}entries(){return this.set.entries()}sortedEntries(){return new Map(r(e=>e[1].key,Array.from(this.set.entries())))}contains(e){const t=e.buffer.toString();return this.set.get(t)}}o.Entry=i,e.exports=o},function(e,t,n){(function(r){function i(){return!("undefined"==typeof window||!window.process||"renderer"!==window.process.type)||("undefined"==typeof navigator||!navigator.userAgent||!navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))&&("undefined"!=typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"undefined"!=typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/))}function o(e){var n=this.useColors;if(e[0]=(n?"%c":"")+this.namespace+(n?" %c":" ")+e[0]+(n?"%c ":" ")+"+"+t.humanize(this.diff),n){var r="color: "+this.color;e.splice(1,0,r,"color: inherit");var i=0,o=0;e[0].replace(/%[a-zA-Z%]/g,function(e){"%%"!==e&&(i++,"%c"===e&&(o=i))}),e.splice(o,0,r)}}function s(){return"object"==typeof console&&console.log&&Function.prototype.apply.call(console.log,console,arguments)}function a(e){try{null==e?t.storage.removeItem("debug"):t.storage.debug=e}catch(e){}}function l(){var e;try{e=t.storage.debug}catch(e){}return!e&&void 0!==r&&"env"in r&&(e=r.env.DEBUG),e}function u(){try{return window.localStorage}catch(e){}}t=e.exports=n(931),t.log=s,t.formatArgs=o,t.save=a,t.load=l,t.useColors=i,t.storage="undefined"!=typeof chrome&&void 0!==chrome.storage?chrome.storage.local:u(),t.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],t.formatters.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}},t.enable(l())}).call(this,n(2))},function(e,t){t.encode=function(e){var t="";for(var n in e)e.hasOwnProperty(n)&&(t.length&&(t+="&"),t+=encodeURIComponent(n)+"="+encodeURIComponent(e[n]));return t},t.decode=function(e){for(var t={},n=e.split("&"),r=0,i=n.length;r=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/))}function o(e){var n=this.useColors;if(e[0]=(n?"%c":"")+this.namespace+(n?" %c":" ")+e[0]+(n?"%c ":" ")+"+"+t.humanize(this.diff),n){var r="color: "+this.color;e.splice(1,0,r,"color: inherit");var i=0,o=0;e[0].replace(/%[a-zA-Z%]/g,function(e){"%%"!==e&&(i++,"%c"===e&&(o=i))}),e.splice(o,0,r)}}function s(){return"object"==typeof console&&console.log&&Function.prototype.apply.call(console.log,console,arguments)}function a(e){try{null==e?t.storage.removeItem("debug"):t.storage.debug=e}catch(e){}}function l(){var e;try{e=t.storage.debug}catch(e){}return!e&&void 0!==r&&"env"in r&&(e=r.env.DEBUG),e}function u(){try{return window.localStorage}catch(e){}}t=e.exports=n(948),t.log=s,t.formatArgs=o,t.save=a,t.load=l,t.useColors=i,t.storage="undefined"!=typeof chrome&&void 0!==chrome.storage?chrome.storage.local:u(),t.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],t.formatters.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}},t.enable(l())}).call(this,n(2))},function(e,t,n){var r=n(26),i=function(){},o=function(e){return e.setHeader&&"function"==typeof e.abort},s=function(e){return e.stdio&&Array.isArray(e.stdio)&&3===e.stdio.length},a=function(e,t,n){if("function"==typeof t)return a(e,null,t);t||(t={}),n=r(n||i);var l=e._writableState,u=e._readableState,c=t.readable||!1!==t.readable&&e.readable,h=t.writable||!1!==t.writable&&e.writable,f=function(){e.writable||p()},p=function(){h=!1,c||n.call(e)},d=function(){c=!1,h||n.call(e)},m=function(t){n.call(e,t?new Error("exited with error code: "+t):null)},g=function(t){n.call(e,t)},y=function(){return(!c||u&&u.ended)&&(!h||l&&l.ended)?void 0:n.call(e,new Error("premature close"))},v=function(){e.req.on("finish",p)};return o(e)?(e.on("complete",p),e.on("abort",y),e.req?v():e.on("request",v)):h&&!l&&(e.on("end",f),e.on("close",f)),s(e)&&e.on("exit",m),e.on("end",d),e.on("finish",p),!1!==t.error&&e.on("error",g),e.on("close",y),function(){e.removeListener("complete",p),e.removeListener("abort",y),e.removeListener("request",v),e.req&&e.req.removeListener("finish",p),e.removeListener("end",f),e.removeListener("close",f),e.removeListener("finish",p),e.removeListener("exit",m),e.removeListener("end",d),e.removeListener("error",g),e.removeListener("close",y)}};e.exports=a},function(e,t){var n=function(){};function r(e,t,n){var r=e.length;if(!r)return n(t);function i(){--r||n(t)}e.forEach(function(e){e?e(t,i):i()}),r||i()}e.exports=function(e){return function(t,n){!function i(){t?r(e,t,n):e.length?e[0]?e[0](null,function(t,o){t?(e.shift(),!0===t?i():r(e,t,n)):n(null,o)}):(e.shift(),i()):n(!0)}()}}},function(e,t,n){"use strict";e.exports=function(){var e,t;function n(n){if("function"!=typeof n)throw new Error("read must be function");if(e)throw new Error("already piped");if(e=n,t){var r=t;t=null,e.apply(null,r)}}function r(n,r){e?e(n,r):t=[n,r]}return{source:r,sink:n}}},function(e,t,n){"use strict";t.Listener=t.listener=n(1034),t.Dialer=t.dialer=n(1038),t.matchSemver=n(1039),t.matchExact=n(467)},function(e,t,n){"use strict";(function(r){const i=n(12),o=n(40),s=n(33),a=n(50),l=n(4);function u(){return(~~(1e9*Math.random())).toString(36)}function c(e,t){i(o(r.isBuffer(e)?[e]:[r.from(e)]),a.encode(),s((e,n)=>{if(e)return t(e);t(null,n[0])}))}function h(e){const t=u();function n(e){return n=>{Array.isArray(n)&&(n=n.join(" ")),e("(%s) %s",t,n)}}const r=n(l("mss:"+e));return r.error=n(l("mss:"+e+":error")),r}t=e.exports,t.writeEncoded=((e,t,n)=>{c(t,(t,r)=>{if(t)return n(t);e.write(r)})}),t.log={},t.log.dialer=(()=>h("dialer\t")),t.log.listener=(()=>h("listener\t"))}).call(this,n(0).Buffer)},function(e,t,n){"use strict";const r=n(13);e.exports={CONNECTION_FAILED:e=>r(e,"CONNECTION_FAILED"),DIAL_ABORTED:()=>r("Dial was aborted","DIAL_ABORTED"),ERR_BLACKLISTED:()=>r("Dial is currently blacklisted for this peer","ERR_BLACKLISTED"),DIAL_SELF:()=>r("A node cannot dial itself","DIAL_SELF"),INVALID_STATE_TRANSITION:e=>r(e,"INVALID_STATE_TRANSITION"),NO_TRANSPORTS_REGISTERED:()=>r("No transports registered, dial not possible","NO_TRANSPORTS_REGISTERED"),PROTECTOR_REQUIRED:()=>r("No protector provided with private network enforced","PROTECTOR_REQUIRED"),UNEXPECTED_END:()=>r("Unexpected end of input from reader.","UNEXPECTED_END"),maybeUnexpectedEnd:t=>!0===t?e.exports.UNEXPECTED_END():t}},function(e,t,n){var r=n(103),i=r(Object,"create");e.exports=i},function(e,t,n){var r=n(1073),i=n(1074),o=n(1075),s=n(1076),a=n(1077);function l(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t{let u=a.cidVersion||i,c=a.hashAlg||o,h=a.codec||s;if(t.isBuffer(e)&&(u=1,h="raw"),"sha2-256"!==c&&(u=1),a.onlyHash)return r(e,{version:u,hashAlg:c},(t,n)=>{l(t,{cid:n,node:e})});n.put(e,{version:u,hashAlg:c,format:h},(t,n)=>{l(t,{cid:n,node:e})})};e.exports=a}).call(this,n(0).Buffer)},function(e,t,n){"use strict";(function(t){const r=n(1152),i=n(152),o=n(10),s=n(34),a=n(45),l=s.DAGLink,u=s.DAGNode,c=n(54),h=n(291),f=n(222),p=n(1153),d=n(12),m=n(342),g=n(74),y=n(1156),v=function(e){return new Promise((n,r)=>{c(e,"murmur3-128",(e,i)=>{if(e)r(e);else{const e=i.slice(2,10),r=e.length,o=t.alloc(r);for(let t=0;t{e(t.key,t.value,n)}),m(t))}flush(e,t,n,r){k(this._options,this._bucket,e,t,n,(e,t)=>{if(e)return r(e);this.multihash=t.cid.buffer,this.size=t.node.size,r(null,t)})}}function w(e,t){return new _(e,t)}function k(e,n,s,c,h,p){const d=n._children;let m=0;const g=[];function v(t,n,i){const o=r(n.toString(16).toUpperCase(),2,"0");if(y.isBucket(t))k(e,t,s,c,null,(e,{cid:t,node:n})=>{e?i(e):(g.push(new l(o,n.size,t)),i())});else{const e=t.value,n=o+t.key;g.push(new l(n,e.size,e.multihash)),i()}}function b(r,i){const l=t.from(d.bitField().reverse()),p=new a("hamt-sharded-directory",l);p.fanout=n.tableSize(),p.hashType=e.hashFn.code,o([e=>u.create(p.marshal(),r,e),(t,n)=>f(t,c,e,n),({cid:e,node:t},n)=>{const r={path:s,size:t.size,multihash:e.buffer};h&&h.push(r),n(null,{cid:e,node:t})}],i)}i(()=>m{const t=d.get(m);t?v(t,m,t=>{m++,e(t)}):(m++,e())},e=>{e?p(e):b(g,p)})}e.exports=w,e.exports.hashFn=v}).call(this,n(0).Buffer)},function(e,t,n){"use strict";(function(e){const r=n(9);function i(e){const t={},n=e.split("-");switch(n.length){case 1:t.avgChunkSize=262144;break;case 2:t.avgChunkSize=o(n[1],"avg");break;case 4:t.minChunkSize=o(n[1],"min"),t.avgChunkSize=o(n[2],"avg"),t.maxChunkSize=o(n[3],"max");break;default:throw new Error('Incorrect chunker format (expected "rabin" "rabin-[avg]" or "rabin-[min]-[avg]-[max]"')}return t}function o(e,t){let n=parseInt(e);if(isNaN(n))throw new Error(`Chunker parameter ${t} must be an integer`);return n}t.normalizePath=(t=>e.isBuffer(t)?new r(t).toString():r.isCID(t)?t.toString():(0===t.indexOf("/ipfs/")&&(t=t.substring("/ipfs/".length)),"/"===t.charAt(t.length-1)&&(t=t.substring(0,t.length-1)),t)),t.parseChunkerString=(e=>{if(e){if(e.startsWith("size-")){const t=e.split("-")[1],n=parseInt(t);if(isNaN(n))throw new Error("Chunker parameter size must be an integer");return{chunker:"fixed",chunkerOptions:{maxChunkSize:n}}}if(e.startsWith("rabin"))return{chunker:"rabin",chunkerOptions:i(e)};throw new Error(`Unrecognized chunker option: ${e}`)}return{chunker:"fixed"}})}).call(this,n(0).Buffer)},function(e,t,n){"use strict";const r=n(28).Key,i={file:0,directory:1,"hamt-sharded-directory":1};e.exports={FILE_SEPARATOR:"/",MFS_ROOT_KEY:new r("/local/filesroot"),MAX_CHUNK_SIZE:262144,MAX_LINKS:174,FILE_TYPES:i}},function(e,t,n){"use strict";var r=n(1190),i="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_-",o,s,a;function l(){a=!1}function u(e){if(e){if(e!==o){if(e.length!==i.length)throw new Error("Custom alphabet for shortid must be "+i.length+" unique characters. You submitted "+e.length+" characters: "+e);var t=e.split("").filter(function(e,t,n){return t!==n.lastIndexOf(e)});if(t.length)throw new Error("Custom alphabet for shortid must be "+i.length+" unique characters. These characters were not unique: "+t.join(", "));o=e,l()}}else o!==i&&(o=i,l())}function c(e){return u(e),o}function h(e){r.seed(e),s!==e&&(l(),s=e)}function f(){o||u(i);for(var e=o.split(""),t=[],n=r.nextValue(),s;e.length>0;)n=r.nextValue(),s=Math.floor(n*e.length),t.push(e.splice(s,1)[0]);return t.join("")}function p(){return a||(a=f(),a)}function d(e){var t=p();return t[e]}function m(){return o||i}e.exports={get:m,characters:c,seed:h,lookup:d,shuffled:p}},function(e,t,n){"use strict";(function(t){const r=n(45).unmarshal,{formatCid:i,toMfsPath:o,loadNode:s}=n(73),a=n(10),l=n(12),u=n(33),c=n(74),h=n(81),f=n(4)("ipfs:mfs:stat"),p={hash:!1,size:!1,withLocal:!1,cidBase:"base58btc"};e.exports=(e=>(function n(d,m,g){"function"==typeof m&&(g=m,m={}),m=Object.assign({},p,m),f(`Fetching stats for ${d}`),a([t=>o(e,d,t),({mfsPath:n,depth:o},a)=>{l(h(n,e.ipld,{maxDepth:o}),c((n,o)=>m.hash?o(null,{hash:i(n.cid,m.cidBase)}):m.size?o(null,{size:n.size}):void s(e,{cid:n.cid},(e,n)=>{if(e)return o(e);const{node:s,cid:a}=n;if(t.isBuffer(s))return o(null,{hash:i(a,m.cidBase),size:s.length,cumulativeSize:s.length,blocks:0,type:"file",local:void 0,sizeLocal:void 0,withLocality:!1});const l=r(s.data);let u=s.links.length;"file"===l.type&&(u=l.blockSizes.length),o(null,{hash:i(a,m.cidBase),size:l.fileSize()||0,cumulativeSize:s.size,blocks:u,type:l.type,local:void 0,sizeLocal:void 0,withLocality:!1})})),u((e,t)=>e?a(e):t.length?(f(`Stats for ${d}`,t[0]),a(null,t[0])):a(new Error(`${d} does not exist`))))}],g)}))}).call(this,n(0).Buffer)},function(e,t,n){t=e.exports=n(527),t.Stream=t,t.Readable=t,t.Writable=n(530),t.Duplex=n(104),t.Transform=n(533),t.PassThrough=n(1287)},function(e,t,n){var r=e.exports;r.encode=n(1508),r.decode=n(1509),r.byteLength=r.encodingLength=function(e){return r.encode(e).length}},function(e,t,n){"use strict";function r(e,t){for(var n=1,r=e.length,i=e[0],o=e[0],s=1;s>3;return e%8!=0&&t++,t}r.prototype.get=function(e){var t=e>>3;return t>e%8)},r.prototype.set=function(e,t){var n=e>>3;t||1===arguments.length?(this.buffer.length>e%8):n>e%8))},r.prototype._grow=function(e){if(this.buffer.length4294967295&&(o=1),t.writeUInt32BE(o,n),t.write(e.type,n+4,4,"ascii");var a=n+8;if(1===o&&(r.encode(e.length,t,a),a+=8),s.fullBoxes[i]&&(t.writeUInt32BE(e.flags||0,a),t.writeUInt8(e.version||0,a),a+=4),u[i]){var c=u[i];c.forEach(function(n){if(5===n.length){var r=e[n]||[];n=n.substr(0,4),r.forEach(function(e){l._encode(e,t,a),a+=l.encode.bytes})}else e[n]&&(l._encode(e[n],t,a),a+=l.encode.bytes)}),e.otherBoxes&&e.otherBoxes.forEach(function(e){l._encode(e,t,a),a+=l.encode.bytes})}else if(s[i]){var h=s[i].encode;h(e,t,a),a+=h.bytes}else{if(!e.buffer)throw new Error("Either `type` must be set to a known type (not'"+i+"') or `buffer` must be set");var f=e.buffer;f.copy(t,a),a+=e.buffer.length}return l.encode.bytes=a-n,t},l.readHeaders=function(e,t,n){if(t=t||0,n=n||e.length,n-t<8)return 8;var i=e.readUInt32BE(t),o=e.toString("ascii",t+4,t+8),a=t+8,l,u;if(1===i){if(n-t<16)return 16;i=r.decode(e,a),a+=8}return s.fullBoxes[o]&&(l=e.readUInt8(a),u=16777215&e.readUInt32BE(a),a+=4),{length:i,headersLen:a-t,contentLen:i-(a-t),type:o,version:l,flags:u}},l.decode=function(e,t,n){t=t||0,n=n||e.length;var r=l.readHeaders(e,t,n);if(!r||r.length>n-t)throw new Error("Data too short");return l.decodeWithoutHeaders(r,e,t+r.headersLen,t+r.length)},l.decodeWithoutHeaders=function(e,t,n,r){n=n||0,r=r||t.length;var i=e.type,a={};if(u[i]){a.otherBoxes=[];for(var c=u[i],h=n;r-h>=8;){var f=l.decode(t,h,r);if(h+=f.length,c.indexOf(f.type)>=0)a[f.type]=f;else if(c.indexOf(f.type+"s")>=0){var p=f.type+"s",d=a[p]=a[p]||[];d.push(f)}else a.otherBoxes.push(f)}}else if(s[i]){var m=s[i].decode;a=m(t,n,r)}else a.buffer=o(t.slice(n,r));return a.length=e.length,a.contentLen=e.contentLen,a.type=e.type,a.version=e.version,a.flags=e.flags,a},l.encodingLength=function(e){var t=e.type,n=8;if(s.fullBoxes[t]&&(n+=4),u[t]){var r=u[t];r.forEach(function(t){if(5===t.length){var r=e[t]||[];t=t.substr(0,4),r.forEach(function(e){e.type=t,n+=l.encodingLength(e)})}else if(e[t]){var i=e[t];i.type=t,n+=l.encodingLength(i)}}),e.otherBoxes&&e.otherBoxes.forEach(function(e){n+=l.encodingLength(e)})}else if(s[t])n+=s[t].encodingLength(e);else{if(!e.buffer)throw new Error("Either `type` must be set to a known type (not'"+t+"') or `buffer` must be set");n+=e.buffer.length}return n>4294967295&&(n+=8),e.length=n,n}},function(e,t,n){"use strict";var r="undefined"!=typeof Uint8Array&&"undefined"!=typeof Uint16Array&&"undefined"!=typeof Int32Array;function i(e,t){return Object.prototype.hasOwnProperty.call(e,t)}t.assign=function(e){for(var t=Array.prototype.slice.call(arguments,1);t.length;){var n=t.shift();if(n){if("object"!=typeof n)throw new TypeError(n+"must be non-object");for(var r in n)i(n,r)&&(e[r]=n[r])}}return e},t.shrinkBuf=function(e,t){return e.length===t?e:e.subarray?e.subarray(0,t):(e.length=t,e)};var o={arraySet:function(e,t,n,r,i){if(t.subarray&&e.subarray)e.set(t.subarray(n,n+r),i);else for(var o=0;o0;--s){o=o.twice();var a=n.testBit(s),l=t.testBit(s);a!=l&&(o=o.add(a?this:i))}return o}function E(e,t,n){var r;r=e.bitLength()>n.bitLength()?e.bitLength()-1:n.bitLength()-1;for(var i=this.curve.getInfinity(),o=this.add(t);r>=0;)i=i.twice(),e.testBit(r)?i=n.testBit(r)?i.add(o):i.add(this):n.testBit(r)&&(i=i.add(t)),--r;return i}function S(e,t,n){this.q=e,this.a=this.fromBigInteger(t),this.b=this.fromBigInteger(n),this.infinity=new d(this,null,null),this.reducer=new i(this.q)}function x(){return this.q}function C(){return this.a}function A(){return this.b}function T(e){return e==this||this.q.equals(e.q)&&this.a.equals(e.a)&&this.b.equals(e.b)}function I(){return this.infinity}function j(e){return new o(this.q,e)}function R(e){this.reducer.reduce(e)}function B(e){switch(parseInt(e.substr(0,2),16)){case 0:return this.infinity;case 2:case 3:return null;case 4:case 6:case 7:var t=(e.length-2)/2,n=e.substr(2,t),i=e.substr(t+2,t);return new d(this,this.fromBigInteger(new r(n,16)),this.fromBigInteger(new r(i,16)));default:return null}}function O(e){if(e.isInfinity())return"00";var t=e.getX().toBigInteger().toString(16),n=e.getY().toBigInteger().toString(16),r=this.getQ().toString(16).length;for(r%2!=0&&r++;t.length128){var t=this.q.shiftRight(e-64);-1==t.intValue()&&(this.r=r.ONE.shiftLeft(e).subtract(this.q))}return this.r},o.prototype.modMult=function(e,t){return this.modReduce(e.multiply(t))},o.prototype.modReduce=function(e){if(null!=this.getR()){for(var t=q.bitLength();e.bitLength()>t+1;){var n=e.shiftRight(t),i=e.subtract(n.shiftLeft(t));this.getR().equals(r.ONE)||(n=n.multiply(this.getR())),e=n.add(i)}for(;e.compareTo(q)>=0;)e=e.subtract(q)}else e=e.mod(q);return e},o.prototype.sqrt=function(){if(!this.q.testBit(0))throw"unsupported";if(this.q.testBit(1)){var e=new o(this.q,this.x.modPow(this.q.shiftRight(2).add(r.ONE),this.q));return e.square().equals(this)?e:null}var t=this.q.subtract(r.ONE),n=t.shiftRight(1);if(!this.x.modPow(n,this.q).equals(r.ONE))return null;var i=t.shiftRight(2),s=i.shiftLeft(1).add(r.ONE),a=this.x,l=modDouble(modDouble(a)),u,c;do{var h;do{h=new r(this.q.bitLength(),new SecureRandom)}while(h.compareTo(this.q)>=0||!h.multiply(h).subtract(l).modPow(n,this.q).equals(t));var f=this.lucasSequence(h,a,s);if(u=f[0],c=f[1],this.modMult(c,c).equals(l))return c.testBit(0)&&(c=c.add(q)),c=c.shiftRight(1),new o(q,c)}while(u.equals(r.ONE)||u.equals(t));return null},o.prototype.lucasSequence=function(e,t,n){for(var i=n.bitLength(),o=n.getLowestSetBit(),s=r.ONE,a=r.TWO,l=e,u=r.ONE,c=r.ONE,h=i-1;h>=o+1;--h)u=this.modMult(u,c),n.testBit(h)?(c=this.modMult(u,t),s=this.modMult(s,l),a=this.modReduce(l.multiply(a).subtract(e.multiply(u))),l=this.modReduce(l.multiply(l).subtract(c.shiftLeft(1)))):(c=u,s=this.modReduce(s.multiply(a).subtract(u)),l=this.modReduce(l.multiply(a).subtract(e.multiply(u))),a=this.modReduce(a.multiply(a).subtract(u.shiftLeft(1))));u=this.modMult(u,c),c=this.modMult(u,t),s=this.modReduce(s.multiply(a).subtract(u)),a=this.modReduce(l.multiply(a).subtract(e.multiply(u))),u=this.modMult(u,c);for(var h=1;h<=o;++h)s=this.modMult(s,a),a=this.modReduce(a.multiply(a).subtract(u.shiftLeft(1))),u=this.modMult(u,u);return[s,a]};var t={ECCurveFp:S,ECPointFp:d,ECFieldElementFp:o};e.exports=t},function(e,t,n){e.exports={read:g,readSSHPrivate:v,write:b};var r=n(25),i=n(84),o=n(29).Buffer,s=n(48),a=n(42),l=n(17),u=n(41),c=n(46),h=n(92),f=n(93),p=n(173),d=n(76),m;function g(e,t){return h.read(e,t)}var y="openssh-key-v1";function v(e,t,i){t=new p({buffer:t});var s=t.readCString();r.strictEqual(s,y,"bad magic string");var u=t.readString(),c=t.readString(),h=t.readBuffer(),g=t.readInt();if(1!==g)throw new Error("OpenSSH-format key file contains multiple keys: this is unsupported.");var v=t.readBuffer();if("public"===e)return r.ok(t.atEnd(),"excess bytes left after key"),f.read(v);var b=t.readBuffer();r.ok(t.atEnd(),"excess bytes left after key");var _=new p({buffer:h});switch(c){case"none":if("none"!==u)throw new Error('OpenSSH-format key uses KDF "none" but specifies a cipher other than "none"');break;case"bcrypt":var w=_.readBuffer(),k=_.readInt(),E=a.opensshCipherInfo(u);if(void 0===m&&(m=n(604)),"string"==typeof i.passphrase&&(i.passphrase=o.from(i.passphrase,"utf-8")),!o.isBuffer(i.passphrase))throw new d.KeyEncryptedError(i.filename,"OpenSSH");var S=new Uint8Array(i.passphrase),x=new Uint8Array(w),C=new Uint8Array(E.keySize+E.blockSize),A=m.pbkdf(S,S.length,x,x.length,C,C.length,k);if(0!==A)throw new Error("bcrypt_pbkdf function returned failure, parameters invalid");C=o.from(C);var T=C.slice(0,E.keySize),I=C.slice(E.keySize,E.keySize+E.blockSize),j=l.createDecipheriv(E.opensslName,T,I);j.setAutoPadding(!1);var R,B=[];for(j.once("error",function(e){if(-1!==e.toString().indexOf("bad decrypt"))throw new Error("Incorrect passphrase supplied, could not decrypt key");throw e}),j.write(b),j.end();null!==(R=j.read());)B.push(R);b=o.concat(B);break;default:throw new Error('OpenSSH-format key uses unknown KDF "'+c+'"')}t=new p({buffer:b});var O=t.readInt(),P=t.readInt();if(O!==P)throw new Error("Incorrect passphrase supplied, could not decrypt key");var N={},D=f.readInternal(N,"private",t.remainder());t.skip(N.consumed);var F=t.readString();return D.comment=F,D}function b(e,t){var i;i=c.isPrivateKey(e)?e.toPublic():e;var s="none",u="none",h=o.alloc(0),f={blockSize:8},d,g;if(void 0!==t&&(d=t.passphrase,"string"==typeof d&&(d=o.from(d,"utf-8")),void 0!==d&&(r.buffer(d,"options.passphrase"),r.optionalString(t.cipher,"options.cipher"),s=t.cipher,void 0===s&&(s="aes128-ctr"),f=a.opensshCipherInfo(s),u="bcrypt")),c.isPrivateKey(e)){g=new p({});var v=l.randomBytes(4).readUInt32BE(0);g.writeInt(v),g.writeInt(v),g.write(e.toBuffer("rfc4253")),g.writeString(e.comment||"");for(var b=1;g._offset%f.blockSize!=0;)g.writeChar(b++);g=g.toBuffer()}switch(u){case"none":break;case"bcrypt":var _=l.randomBytes(16),w=16,k=new p({});k.writeBuffer(_),k.writeInt(16),h=k.toBuffer(),void 0===m&&(m=n(604));var E=new Uint8Array(d),S=new Uint8Array(_),x=new Uint8Array(f.keySize+f.blockSize),C=m.pbkdf(E,E.length,S,S.length,x,x.length,16);if(0!==C)throw new Error("bcrypt_pbkdf function returned failure, parameters invalid");x=o.from(x);var A=x.slice(0,f.keySize),T=x.slice(f.keySize,f.keySize+f.blockSize),I=l.createCipheriv(f.opensslName,A,T);I.setAutoPadding(!1);var j,R=[];for(I.once("error",function(e){throw e}),I.write(g),I.end();null!==(j=I.read());)R.push(j);g=o.concat(R);break;default:throw new Error("Unsupported kdf "+u)}var B=new p({}),O;B.writeCString(y),B.writeString(s),B.writeString(u),B.writeBuffer(h),B.writeInt(1),B.writeBuffer(i.toBuffer("rfc4253")),g&&B.writeBuffer(g),B=B.toBuffer(),O=c.isPrivateKey(e)?"OPENSSH PRIVATE KEY":"OPENSSH PUBLIC KEY";var P=B.toString("base64"),N=P.length+P.length/70+18+16+2*O.length+10;B=o.alloc(N);var D=0;D+=B.write("-----BEGIN "+O+"-----\n",D);for(var F=0;FP.length&&(M=P.length),D+=B.write(P.slice(F,M),D),B[D++]=10,F=M}return D+=B.write("-----END "+O+"-----\n",D),B.slice(0,D)}},function(e,t,n){e.exports={DataError:n(1743),InvalidAccessError:n(1744),KeyFormatNotSupportedError:n(1745),CurrentlyNotSupportedError:n(1746),NotSupportedError:n(322),OperationError:n(1747),QuotaExceededError:n(1748),TypeMismatchError:n(1749)}},function(e,t,n){(function(r){const i=n(633),o=n(77),s=o.TransportError,a=n(4)("dweb-transports:httptools"),l=n(106);let u;function c({concurrency:e}){u=l((e,t)=>{e.loopguard===("undefined"!=typeof window&&window.loopguard)?fetch(e.req).then(n=>{a("Fetch of %s completed",e.what),u.concurrency=Math.min(u.concurrency+1,u.running()+6),t(null),e.cb(null,n)}).catch(n=>{u.concurrency=Math.max(u.concurrency-1,6,u.running()-1),t(n),--e.count>0?(a("Retrying fetch of %s in %s ms: %s",e.what,e.ms,n.message),u.push(e)):(a("Requeued fetch of %s failed: %s",e.what,n.message),e.cb(n))}):(err=new Error(`Dropping fetch of ${e.what} as window changed from ${e.loopguard} to ${window.loopguard}`),a("Dropping fetch of %s as window changed from %s to %s",e.what,e.loopguard,window.loopguard),e.cb(err),t(err))},e)}function h(e,t,n,r){return new Promise((i,o)=>{n=n||1,u.push({req:e,count:n,ms:t,what:r,loopguard:"undefined"!=typeof window&&window.loopguard,cb:(e,t)=>{e?o(e):i(t)}})})}async function f(e,t,n,r){let i,o="undefined"!=typeof window&&window.loopguard;for(n=n||1;n--&&o===("undefined"!=typeof window&&window.loopguard);)try{return await fetch(e)}catch(e){i=e,a("Delaying %s by %d ms because %s",r,t,e.message),await new Promise(e=>{setTimeout(()=>{e()},t)}),t=Math.floor(t*(1+Math.random()))}throw console.warn("loopfetch of",r,"failed"),o!==("undefined"!=typeof window&&window.loopguard)?(a("Looping exited because of page change %s",r),new Error("Looping exited because of page change "+r)):i}"undefined"==typeof fetch&&(fetch=i,Headers=fetch.Headers,Request=fetch.Request),httptools={},c({concurrency:6}),httptools.p_httpfetch=async function(e,t,{wantstream:n=!1,retries:i}={}){try{a("p_httpfetch: %s %o",e,t.headers.range||"");let o=new Request(e,t),l=await h(o,500,i,e);if(l.ok){let e=l.headers.get("Content-Type");return n?l.body:void 0!==e&&e.startsWith("application/json")?l.json():void 0!==e&&e.startsWith("text")?l.text():new r(await l.arrayBuffer())}throw new s(`Transport Error ${e} ${l.status}: ${l.statusText}`)}catch(t){throw a("p_httpfetch failed: %s",t.message),t instanceof s?t:new s(`Transport error thrown by ${e}: ${t.message}`)}},httptools.p_GET=function(e,t={},n){"function"==typeof t&&(n=t,t={});let r=new Headers;(t.start||t.end)&&r.append("range",`bytes=${t.start||0}-${t.end<1/0?t.end:""}`);const i=void 0===t.retries?12:t.retries;let o={method:"GET",headers:r,mode:"cors",cache:t.noCache?"no-cache":"default",redirect:"follow",keepalive:!0};const s=httptools.p_httpfetch(e,o,{retries:i,wantstream:t.wantstream});if(!n)return s;s.then(e=>{try{n(null,e)}catch(e){a("Uncaught error %O",e)}}).catch(e=>n(e))},httptools.p_POST=function(e,t={},n){"function"==typeof t&&(n=t,t={});const r=void 0===t.retries?0:t.retries;let i={method:"POST",headers:{},body:t.data,mode:"cors",cache:"default",redirect:"follow",keepalive:!1};t.contenttype&&(i.headers["Content-Type"]=t.contenttype);const o=httptools.p_httpfetch(e,i,{retries:r});if(!n)return o;o.then(e=>n(null,e)).catch(e=>n(e))},t=e.exports=httptools}).call(this,n(0).Buffer)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e,t,n){var r=(0,i.default)(e)?_:w;r(e,(0,v.default)(t),n)};var r=n(145),i=b(r),o=n(241),s=b(o),a=n(326),l=b(a),u=n(109),c=b(u),h=n(57),f=b(h),p=n(181),d=b(p),m=n(107),g=b(m),y=n(37),v=b(y);function b(e){return e&&e.__esModule?e:{default:e}}function _(e,t,n){n=(0,d.default)(n||f.default);var r=0,i=0,o=e.length;function a(e,t){e?n(e):++i!==o&&t!==s.default||n(null)}for(0===o&&n(null);r-1&&e%1==0&&e<=n}e.exports=r},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default={},e.exports=t.default},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=d;var r=n(57),i=p(r),o=n(181),s=p(o),a=n(643),l=p(a),u=n(107),c=p(u),h=n(241),f=p(h);function p(e){return e&&e.__esModule?e:{default:e}}function d(e){return function(t,n,r){if(r=(0,s.default)(r||i.default),e<=0||!t)return r(null);var o=(0,l.default)(t),a=!1,u=0,h=!1;function p(e,t){if(u-=1,e)a=!0,r(e);else{if(t===f.default||a&&u<=0)return a=!0,r(null);h||d()}}function d(){for(h=!0;u>2,r=(3&t[0])<<8|t[1],n?31===n?i*(r?NaN:Infinity):i*Math.pow(2,n-25)*(1024+r):5.960464477539063e-8*i*r},t.arrayBufferToBignumber=function(e){const t=e.byteLength;let n="";for(let r=0;r{const t=new Map,n=Object.keys(e),r=n.length;for(let i=0;ie*s+t),t.buildInt64=((e,n,i,s)=>{const a=t.buildInt32(e,n),l=t.buildInt32(i,s);return a>2097151?new r(a).times(o).plus(l):a*o+l}),t.writeHalf=function t(n,r){const i=e.allocUnsafe(4);i.writeFloatBE(r,0);const o=i.readUInt32BE(0);if(0!=(8191&o))return!1;var s=o>>16&32768;const a=o>>23&255,l=8388607&o;if(a>=113&&a<=142)s+=(a-112<<10)+(l>>13);else{if(!(a>=103&&a<113))return!1;if(l&(1<<126-a)-1)return!1;s+=l+8388608>>126-a}return n.writeUInt16BE(s,0),!0},t.keySorter=function(e,t){var n=e[0].byteLength,r=t[0].byteLength;return n>r?1:r>n?-1:e[0].compare(t[0])},t.isNegativeZero=(e=>0===e&&1/e<0),t.nextPowerOf2=(e=>{let t=0;if(e&&!(e&e-1))return e;for(;0!==e;)e>>=1,t+=1;return 1<=0||!o.gcd(t.n).equals(i.ONE));e=e.multiply(o.modPow(t.e,t.n)).mod(t.n);for(var s=e.mod(t.p).modPow(t.dP,t.p),a=e.mod(t.q).modPow(t.dQ,t.q);s.compareTo(a)<0;)s=s.add(t.p);var l=s.subtract(a).multiply(t.qInv).mod(t.p).multiply(t.q).add(a);return l=l.multiply(o.modInverse(t.n)).mod(t.n),l};function d(e,t,n){var i=r.util.createBuffer(),o=Math.ceil(t.n.bitLength()/8);if(e.length>o-11){var s=new Error("Message is too long for PKCS#1 v1.5 padding.");throw s.length=e.length,s.max=o-11,s}i.putByte(0),i.putByte(n);var a=o-3-e.length,l;if(0===n||1===n){l=0===n?0:255;for(var u=0;u0;){for(var c=0,h=r.random.getBytes(a),u=0;u1;){if(255!==s.getByte()){--s.read;break}++u}else if(2===l)for(u=0;s.length()>1;){if(0===s.getByte()){--s.read;break}++u}var h=s.getByte();if(0!==h||u!==o-3-s.length())throw new Error("Encryption block is invalid.");return s.getBytes()}function g(e,t,n){"function"==typeof t&&(n=t,t={}),t=t||{};var o={algorithm:{name:t.algorithm||"PRIMEINC",options:{workers:t.workers||2,workLoad:t.workLoad||100,workerScript:t.workerScript}}};function a(){l(e.pBits,function(t,r){return t?n(t):(e.p=r,null!==e.q?u(t,e.q):void l(e.qBits,u))})}function l(e,t){r.prime.generateProbablePrime(e,o,t)}function u(t,r){if(t)return n(t);if(e.q=r,e.p.compareTo(e.q)<0){var o=e.p;e.p=e.q,e.q=o}if(0!==e.p.subtract(i.ONE).gcd(e.e).compareTo(i.ONE))return e.p=null,void a();if(0!==e.q.subtract(i.ONE).gcd(e.e).compareTo(i.ONE))return e.q=null,void l(e.qBits,u);if(e.p1=e.p.subtract(i.ONE),e.q1=e.q.subtract(i.ONE),e.phi=e.p1.multiply(e.q1),0!==e.phi.gcd(e.e).compareTo(i.ONE))return e.p=e.q=null,void a();if(e.n=e.p.multiply(e.q),e.n.bitLength()!==e.bits)return e.q=null,void l(e.qBits,u);var c=e.e.modInverse(e.phi);e.keys={privateKey:s.rsa.setPrivateKey(e.n,e.e,c,e.p,e.q,c.mod(e.p1),c.mod(e.q1),e.q.modInverse(e.p)),publicKey:s.rsa.setPublicKey(e.n,e.e)},n(null,e.keys)}"prng"in t&&(o.prng=t.prng),a()}function y(e){var t=e.toString(16);t[0]>="8"&&(t="00"+t);var n=r.util.hexToBytes(t);return n.length>1&&(0===n.charCodeAt(0)&&0==(128&n.charCodeAt(1))||255===n.charCodeAt(0)&&128==(128&n.charCodeAt(1)))?n.substr(1):n}function v(e){return e<=100?27:e<=150?18:e<=200?15:e<=250?12:e<=300?9:e<=350?8:e<=400?7:e<=500?6:e<=600?5:e<=800?4:e<=1250?3:2}function b(e){return"undefined"!=typeof window&&"object"==typeof window.crypto&&"object"==typeof window.crypto.subtle&&"function"==typeof window.crypto.subtle[e]}function _(e){return"undefined"!=typeof window&&"object"==typeof window.msCrypto&&"object"==typeof window.msCrypto.subtle&&"function"==typeof window.msCrypto.subtle[e]}function w(e){for(var t=r.util.hexToBytes(e.toString(16)),n=new Uint8Array(t.length),i=0;i0;)h.putByte(0),--f;return h.putBytes(r.util.hexToBytes(c)),h.getBytes()},s.rsa.decrypt=function(e,t,n,o){var s=Math.ceil(t.n.bitLength()/8);if(e.length!==s){var a=new Error("Encrypted message length is invalid.");throw a.length=e.length,a.expected=s,a}var l=new i(r.util.createBuffer(e).toHex(),16);if(l.compareTo(t.n)>=0)throw new Error("Encrypted message is invalid.");for(var u=p(l,t,n),c=u.toString(16),h=r.util.createBuffer(),f=s-Math.ceil(c.length/2);f>0;)h.putByte(0),--f;return h.putBytes(r.util.hexToBytes(c)),!1!==o?m(h.getBytes(),t,n):h.getBytes()},s.rsa.createKeyPairGenerationState=function(e,t,n){"string"==typeof e&&(e=parseInt(e,10)),e=e||2048,n=n||{};var o=n.prng||r.random,s={nextBytes:function(e){for(var t=o.getBytesSync(e.length),n=0;n>1,pBits:e-(e>>1),pqState:0,num:null,keys:null},l.e.fromInt(l.eInt),l},s.rsa.stepKeyPairGenerationState=function(e,t){"algorithm"in e||(e.algorithm="PRIMEINC");var n=new i(null);n.fromInt(30);for(var r=0,o=function(e,t){return e|t},l=+new Date,u,c=0;null===e.keys&&(t<=0||ch?e.pqState=0:e.num.isProbablePrime(v(e.num.bitLength()))?++e.pqState:e.num.dAddOffset(a[r++%8],0):2===e.pqState?e.pqState=0===e.num.subtract(i.ONE).gcd(e.e).compareTo(i.ONE)?3:0:3===e.pqState&&(e.pqState=0,null===e.p?e.p=e.num:e.q=e.num,null!==e.p&&null!==e.q&&++e.state,e.num=null)}else if(1===e.state)e.p.compareTo(e.q)<0&&(e.num=e.p,e.p=e.q,e.q=e.num),++e.state;else if(2===e.state)e.p1=e.p.subtract(i.ONE),e.q1=e.q.subtract(i.ONE),e.phi=e.p1.multiply(e.q1),++e.state;else if(3===e.state)0===e.phi.gcd(e.e).compareTo(i.ONE)?++e.state:(e.p=null,e.q=null,e.state=0);else if(4===e.state)e.n=e.p.multiply(e.q),e.n.bitLength()===e.bits?++e.state:(e.q=null,e.state=0);else if(5===e.state){var p=e.e.modInverse(e.phi);e.keys={privateKey:s.rsa.setPrivateKey(e.n,e.e,p,e.p,e.q,p.mod(e.p1),p.mod(e.q1),e.q.modInverse(e.p)),publicKey:s.rsa.setPublicKey(e.n,e.e)}}u=+new Date,c+=u-l,l=u}return null!==e.keys},s.rsa.generateKeyPair=function(e,t,n,i){if(1===arguments.length?"object"==typeof e?(n=e,e=void 0):"function"==typeof e&&(i=e,e=void 0):2===arguments.length?"number"==typeof e?"function"==typeof t?(i=t,t=void 0):"number"!=typeof t&&(n=t,t=void 0):(n=e,i=t,e=void 0,t=void 0):3===arguments.length&&("number"==typeof t?"function"==typeof n&&(i=n,n=void 0):(i=n,n=t,t=void 0)),n=n||{},void 0===e&&(e=n.bits||2048),void 0===t&&(t=n.e||65537),!r.options.usePureJavaScript&&i&&e>=256&&e<=16384&&(65537===t||3===t)){if(b("generateKey")&&b("exportKey"))return window.crypto.subtle.generateKey({name:"RSASSA-PKCS1-v1_5",modulusLength:e,publicExponent:w(t),hash:{name:"SHA-256"}},!0,["sign","verify"]).then(function(e){return window.crypto.subtle.exportKey("pkcs8",e.privateKey)}).then(void 0,function(e){i(e)}).then(function(e){if(e){var t=s.privateKeyFromAsn1(o.fromDer(r.util.createBuffer(e)));i(null,{privateKey:t,publicKey:s.setRsaPublicKey(t.n,t.e)})}});if(_("generateKey")&&_("exportKey")){var a=window.msCrypto.subtle.generateKey({name:"RSASSA-PKCS1-v1_5",modulusLength:e,publicExponent:w(t),hash:{name:"SHA-256"}},!0,["sign","verify"]);return a.oncomplete=function(e){var t=e.target.result,n=window.msCrypto.subtle.exportKey("pkcs8",t.privateKey);n.oncomplete=function(e){var t=e.target.result,n=s.privateKeyFromAsn1(o.fromDer(r.util.createBuffer(t)));i(null,{privateKey:n,publicKey:s.setRsaPublicKey(n.n,n.e)})},n.onerror=function(e){i(e)}},void(a.onerror=function(e){i(e)})}}var l=s.rsa.createKeyPairGenerationState(e,t,n);if(!i)return s.rsa.stepKeyPairGenerationState(l,0),l.keys;g(l,n,i)},s.setRsaPublicKey=s.rsa.setPublicKey=function(e,t){var n={n:e,e:t,encrypt:function(e,t,i){if("string"==typeof t?t=t.toUpperCase():void 0===t&&(t="RSAES-PKCS1-V1_5"),"RSAES-PKCS1-V1_5"===t)t={encode:function(e,t,n){return d(e,t,2).getBytes()}};else if("RSA-OAEP"===t||"RSAES-OAEP"===t)t={encode:function(e,t){return r.pkcs1.encode_rsa_oaep(t,e,i)}};else if(-1!==["RAW","NONE","NULL",null].indexOf(t))t={encode:function(e){return e}};else if("string"==typeof t)throw new Error('Unsupported encryption scheme: "'+t+'".');var o=t.encode(e,n,!0);return s.rsa.encrypt(o,n,!0)},verify:function(e,t,r){"string"==typeof r?r=r.toUpperCase():void 0===r&&(r="RSASSA-PKCS1-V1_5"),"RSASSA-PKCS1-V1_5"===r?r={verify:function(e,t){t=m(t,n,!0);var r=o.fromDer(t);return e===r.value[1].value}}:"NONE"!==r&&"NULL"!==r&&null!==r||(r={verify:function(e,t){return t=m(t,n,!0),e===t}});var i=s.rsa.decrypt(t,n,!0,!1);return r.verify(e,i,n.n.bitLength())}};return n},s.setRsaPrivateKey=s.rsa.setPrivateKey=function(e,t,n,i,o,a,l,u){var c={n:e,e:t,d:n,p:i,q:o,dP:a,dQ:l,qInv:u,decrypt:function(e,t,n){"string"==typeof t?t=t.toUpperCase():void 0===t&&(t="RSAES-PKCS1-V1_5");var i=s.rsa.decrypt(e,c,!1,!1);if("RSAES-PKCS1-V1_5"===t)t={decode:m};else if("RSA-OAEP"===t||"RSAES-OAEP"===t)t={decode:function(e,t){return r.pkcs1.decode_rsa_oaep(t,e,n)}};else{if(-1===["RAW","NONE","NULL",null].indexOf(t))throw new Error('Unsupported encryption scheme: "'+t+'".');t={decode:function(e){return e}}}return t.decode(i,c,!1)},sign:function(e,t){var n=!1;"string"==typeof t&&(t=t.toUpperCase()),void 0===t||"RSASSA-PKCS1-V1_5"===t?(t={encode:f},n=1):"NONE"!==t&&"NULL"!==t&&null!==t||(t={encode:function(){return e}},n=1);var r=t.encode(e,c.n.bitLength());return s.rsa.encrypt(r,c,n)}};return c},s.wrapRsaPrivateKey=function(e){return o.create(o.Class.UNIVERSAL,o.Type.SEQUENCE,!0,[o.create(o.Class.UNIVERSAL,o.Type.INTEGER,!1,o.integerToDer(0).getBytes()),o.create(o.Class.UNIVERSAL,o.Type.SEQUENCE,!0,[o.create(o.Class.UNIVERSAL,o.Type.OID,!1,o.oidToDer(s.oids.rsaEncryption).getBytes()),o.create(o.Class.UNIVERSAL,o.Type.NULL,!1,"")]),o.create(o.Class.UNIVERSAL,o.Type.OCTETSTRING,!1,o.toDer(e).getBytes())])},s.privateKeyFromAsn1=function(e){var t={},n=[],a,c,h,f,p,d,m,g;if(o.validate(e,l,t,n)&&(e=o.fromDer(r.util.createBuffer(t.privateKey))),t={},n=[],!o.validate(e,u,t,n)){var y=new Error("Cannot read private key. ASN.1 object does not contain an RSAPrivateKey.");throw y.errors=n,y}return a=r.util.createBuffer(t.privateKeyModulus).toHex(),c=r.util.createBuffer(t.privateKeyPublicExponent).toHex(),h=r.util.createBuffer(t.privateKeyPrivateExponent).toHex(),f=r.util.createBuffer(t.privateKeyPrime1).toHex(),p=r.util.createBuffer(t.privateKeyPrime2).toHex(),d=r.util.createBuffer(t.privateKeyExponent1).toHex(),m=r.util.createBuffer(t.privateKeyExponent2).toHex(),g=r.util.createBuffer(t.privateKeyCoefficient).toHex(),s.setRsaPrivateKey(new i(a,16),new i(c,16),new i(h,16),new i(f,16),new i(p,16),new i(d,16),new i(m,16),new i(g,16))},s.privateKeyToAsn1=s.privateKeyToRSAPrivateKey=function(e){return o.create(o.Class.UNIVERSAL,o.Type.SEQUENCE,!0,[o.create(o.Class.UNIVERSAL,o.Type.INTEGER,!1,o.integerToDer(0).getBytes()),o.create(o.Class.UNIVERSAL,o.Type.INTEGER,!1,y(e.n)),o.create(o.Class.UNIVERSAL,o.Type.INTEGER,!1,y(e.e)),o.create(o.Class.UNIVERSAL,o.Type.INTEGER,!1,y(e.d)),o.create(o.Class.UNIVERSAL,o.Type.INTEGER,!1,y(e.p)),o.create(o.Class.UNIVERSAL,o.Type.INTEGER,!1,y(e.q)),o.create(o.Class.UNIVERSAL,o.Type.INTEGER,!1,y(e.dP)),o.create(o.Class.UNIVERSAL,o.Type.INTEGER,!1,y(e.dQ)),o.create(o.Class.UNIVERSAL,o.Type.INTEGER,!1,y(e.qInv))])},s.publicKeyFromAsn1=function(e){var t={},n=[];if(o.validate(e,h,t,n)){var a=o.derToOid(t.publicKeyOid);if(a!==s.oids.rsaEncryption){var l=new Error("Cannot read public key. Unknown OID.");throw l.oid=a,l}e=t.rsaPublicKey}if(n=[],!o.validate(e,c,t,n)){var l=new Error("Cannot read public key. ASN.1 object does not contain an RSAPublicKey.");throw l.errors=n,l}var u=r.util.createBuffer(t.publicKeyModulus).toHex(),f=r.util.createBuffer(t.publicKeyExponent).toHex();return s.setRsaPublicKey(new i(u,16),new i(f,16))},s.publicKeyToAsn1=s.publicKeyToSubjectPublicKeyInfo=function(e){return o.create(o.Class.UNIVERSAL,o.Type.SEQUENCE,!0,[o.create(o.Class.UNIVERSAL,o.Type.SEQUENCE,!0,[o.create(o.Class.UNIVERSAL,o.Type.OID,!1,o.oidToDer(s.oids.rsaEncryption).getBytes()),o.create(o.Class.UNIVERSAL,o.Type.NULL,!1,"")]),o.create(o.Class.UNIVERSAL,o.Type.BITSTRING,!1,[s.publicKeyToRSAPublicKey(e)])])},s.publicKeyToRSAPublicKey=function(e){return o.create(o.Class.UNIVERSAL,o.Type.SEQUENCE,!0,[o.create(o.Class.UNIVERSAL,o.Type.INTEGER,!1,y(e.n)),o.create(o.Class.UNIVERSAL,o.Type.INTEGER,!1,y(e.e))])}},function(e,t,n){var r=n(20);if(n(194),n(117),n(250),n(97),n(150),n(371),n(251),n(118),n(740),n(248),n(30),void 0===i)var i=r.jsbn.BigInteger;var o=r.asn1,s=r.pki=r.pki||{};e.exports=s.pbe=r.pbe=r.pbe||{};var a=s.oids,l={name:"EncryptedPrivateKeyInfo",tagClass:o.Class.UNIVERSAL,type:o.Type.SEQUENCE,constructed:!0,value:[{name:"EncryptedPrivateKeyInfo.encryptionAlgorithm",tagClass:o.Class.UNIVERSAL,type:o.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:o.Class.UNIVERSAL,type:o.Type.OID,constructed:!1,capture:"encryptionOid"},{name:"AlgorithmIdentifier.parameters",tagClass:o.Class.UNIVERSAL,type:o.Type.SEQUENCE,constructed:!0,captureAsn1:"encryptionParams"}]},{name:"EncryptedPrivateKeyInfo.encryptedData",tagClass:o.Class.UNIVERSAL,type:o.Type.OCTETSTRING,constructed:!1,capture:"encryptedData"}]},u={name:"PBES2Algorithms",tagClass:o.Class.UNIVERSAL,type:o.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.keyDerivationFunc",tagClass:o.Class.UNIVERSAL,type:o.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.keyDerivationFunc.oid",tagClass:o.Class.UNIVERSAL,type:o.Type.OID,constructed:!1,capture:"kdfOid"},{name:"PBES2Algorithms.params",tagClass:o.Class.UNIVERSAL,type:o.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.params.salt",tagClass:o.Class.UNIVERSAL,type:o.Type.OCTETSTRING,constructed:!1,capture:"kdfSalt"},{name:"PBES2Algorithms.params.iterationCount",tagClass:o.Class.UNIVERSAL,type:o.Type.INTEGER,constructed:!1,capture:"kdfIterationCount"},{name:"PBES2Algorithms.params.keyLength",tagClass:o.Class.UNIVERSAL,type:o.Type.INTEGER,constructed:!1,optional:!0,capture:"keyLength"},{name:"PBES2Algorithms.params.prf",tagClass:o.Class.UNIVERSAL,type:o.Type.SEQUENCE,constructed:!0,optional:!0,value:[{name:"PBES2Algorithms.params.prf.algorithm",tagClass:o.Class.UNIVERSAL,type:o.Type.OID,constructed:!1,capture:"prfOid"}]}]}]},{name:"PBES2Algorithms.encryptionScheme",tagClass:o.Class.UNIVERSAL,type:o.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.encryptionScheme.oid",tagClass:o.Class.UNIVERSAL,type:o.Type.OID,constructed:!1,capture:"encOid"},{name:"PBES2Algorithms.encryptionScheme.iv",tagClass:o.Class.UNIVERSAL,type:o.Type.OCTETSTRING,constructed:!1,capture:"encIv"}]}]},c={name:"pkcs-12PbeParams",tagClass:o.Class.UNIVERSAL,type:o.Type.SEQUENCE,constructed:!0,value:[{name:"pkcs-12PbeParams.salt",tagClass:o.Class.UNIVERSAL,type:o.Type.OCTETSTRING,constructed:!1,capture:"salt"},{name:"pkcs-12PbeParams.iterations",tagClass:o.Class.UNIVERSAL,type:o.Type.INTEGER,constructed:!1,capture:"iterations"}]};function h(e,t){return e.start().update(t).digest().getBytes()}function f(e){var t;if(e){if(t=s.oids[o.derToOid(e)],!t){var n=new Error("Unsupported PRF OID.");throw n.oid=e,n.supported=["hmacWithSHA1","hmacWithSHA224","hmacWithSHA256","hmacWithSHA384","hmacWithSHA512"],n}}else t="hmacWithSHA1";return p(t)}function p(e){var t=r.md;switch(e){case"hmacWithSHA224":t=r.md.sha512;case"hmacWithSHA1":case"hmacWithSHA256":case"hmacWithSHA384":case"hmacWithSHA512":e=e.substr(8).toLowerCase();break;default:var n=new Error("Unsupported PRF algorithm.");throw n.algorithm=e,n.supported=["hmacWithSHA1","hmacWithSHA224","hmacWithSHA256","hmacWithSHA384","hmacWithSHA512"],n}if(!(t&&e in t))throw new Error("Unknown hash algorithm: "+e);return t[e].create()}function d(e,t,n,i){var a=o.create(o.Class.UNIVERSAL,o.Type.SEQUENCE,!0,[o.create(o.Class.UNIVERSAL,o.Type.OCTETSTRING,!1,e),o.create(o.Class.UNIVERSAL,o.Type.INTEGER,!1,t.getBytes())]);return"hmacWithSHA1"!==i&&a.value.push(o.create(o.Class.UNIVERSAL,o.Type.INTEGER,!1,r.util.hexToBytes(n.toString(16))),o.create(o.Class.UNIVERSAL,o.Type.SEQUENCE,!0,[o.create(o.Class.UNIVERSAL,o.Type.OID,!1,o.oidToDer(s.oids[i]).getBytes()),o.create(o.Class.UNIVERSAL,o.Type.NULL,!1,"")])),a}s.encryptPrivateKeyInfo=function(e,t,n){n=n||{},n.saltSize=n.saltSize||8,n.count=n.count||2048,n.algorithm=n.algorithm||"aes128",n.prfAlgorithm=n.prfAlgorithm||"sha1";var i=r.random.getBytesSync(n.saltSize),l=n.count,u=o.integerToDer(l),c,h,f;if(0===n.algorithm.indexOf("aes")||"des"===n.algorithm){var m,g,y;switch(n.algorithm){case"aes128":c=16,m=16,g=a["aes128-CBC"],y=r.aes.createEncryptionCipher;break;case"aes192":c=24,m=16,g=a["aes192-CBC"],y=r.aes.createEncryptionCipher;break;case"aes256":c=32,m=16,g=a["aes256-CBC"],y=r.aes.createEncryptionCipher;break;case"des":c=8,m=8,g=a.desCBC,y=r.des.createEncryptionCipher;break;default:var v=new Error("Cannot encrypt private key. Unknown encryption algorithm.");throw v.algorithm=n.algorithm,v}var b="hmacWith"+n.prfAlgorithm.toUpperCase(),_=p(b),w=r.pkcs5.pbkdf2(t,i,l,c,_),k=r.random.getBytesSync(m),E=y(w);E.start(k),E.update(o.toDer(e)),E.finish(),f=E.output.getBytes();var S=d(i,u,c,b);h=o.create(o.Class.UNIVERSAL,o.Type.SEQUENCE,!0,[o.create(o.Class.UNIVERSAL,o.Type.OID,!1,o.oidToDer(a.pkcs5PBES2).getBytes()),o.create(o.Class.UNIVERSAL,o.Type.SEQUENCE,!0,[o.create(o.Class.UNIVERSAL,o.Type.SEQUENCE,!0,[o.create(o.Class.UNIVERSAL,o.Type.OID,!1,o.oidToDer(a.pkcs5PBKDF2).getBytes()),S]),o.create(o.Class.UNIVERSAL,o.Type.SEQUENCE,!0,[o.create(o.Class.UNIVERSAL,o.Type.OID,!1,o.oidToDer(g).getBytes()),o.create(o.Class.UNIVERSAL,o.Type.OCTETSTRING,!1,k)])])])}else{if("3des"!==n.algorithm){var v=new Error("Cannot encrypt private key. Unknown encryption algorithm.");throw v.algorithm=n.algorithm,v}c=24;var x=new r.util.ByteBuffer(i),w=s.pbe.generatePkcs12Key(t,x,1,l,c),k=s.pbe.generatePkcs12Key(t,x,2,l,c),E=r.des.createEncryptionCipher(w);E.start(k),E.update(o.toDer(e)),E.finish(),f=E.output.getBytes(),h=o.create(o.Class.UNIVERSAL,o.Type.SEQUENCE,!0,[o.create(o.Class.UNIVERSAL,o.Type.OID,!1,o.oidToDer(a["pbeWithSHAAnd3-KeyTripleDES-CBC"]).getBytes()),o.create(o.Class.UNIVERSAL,o.Type.SEQUENCE,!0,[o.create(o.Class.UNIVERSAL,o.Type.OCTETSTRING,!1,i),o.create(o.Class.UNIVERSAL,o.Type.INTEGER,!1,u.getBytes())])])}var C=o.create(o.Class.UNIVERSAL,o.Type.SEQUENCE,!0,[h,o.create(o.Class.UNIVERSAL,o.Type.OCTETSTRING,!1,f)]);return C},s.decryptPrivateKeyInfo=function(e,t){var n=null,i={},a=[];if(!o.validate(e,l,i,a)){var u=new Error("Cannot read encrypted private key. ASN.1 object is not a supported EncryptedPrivateKeyInfo.");throw u.errors=a,u}var c=o.derToOid(i.encryptionOid),h=s.pbe.getCipher(c,i.encryptionParams,t),f=r.util.createBuffer(i.encryptedData);return h.update(f),h.finish()&&(n=o.fromDer(h.output)),n},s.encryptedPrivateKeyToPem=function(e,t){var n={type:"ENCRYPTED PRIVATE KEY",body:o.toDer(e).getBytes()};return r.pem.encode(n,{maxline:t})},s.encryptedPrivateKeyFromPem=function(e){var t=r.pem.decode(e)[0];if("ENCRYPTED PRIVATE KEY"!==t.type){var n=new Error('Could not convert encrypted private key from PEM; PEM header type is "ENCRYPTED PRIVATE KEY".');throw n.headerType=t.type,n}if(t.procType&&"ENCRYPTED"===t.procType.type)throw new Error("Could not convert encrypted private key from PEM; PEM is encrypted.");return o.fromDer(t.body)},s.encryptRsaPrivateKey=function(e,t,n){if(n=n||{},!n.legacy){var i=s.wrapRsaPrivateKey(s.privateKeyToAsn1(e));return i=s.encryptPrivateKeyInfo(i,t,n),s.encryptedPrivateKeyToPem(i)}var a,l,u,c;switch(n.algorithm){case"aes128":a="AES-128-CBC",u=16,l=r.random.getBytesSync(16),c=r.aes.createEncryptionCipher;break;case"aes192":a="AES-192-CBC",u=24,l=r.random.getBytesSync(16),c=r.aes.createEncryptionCipher;break;case"aes256":a="AES-256-CBC",u=32,l=r.random.getBytesSync(16),c=r.aes.createEncryptionCipher;break;case"3des":a="DES-EDE3-CBC",u=24,l=r.random.getBytesSync(8),c=r.des.createEncryptionCipher;break;case"des":a="DES-CBC",u=8,l=r.random.getBytesSync(8),c=r.des.createEncryptionCipher;break;default:var h=new Error('Could not encrypt RSA private key; unsupported encryption algorithm "'+n.algorithm+'".');throw h.algorithm=n.algorithm,h}var f=r.pbe.opensslDeriveBytes(t,l.substr(0,8),u),p=c(f);p.start(l),p.update(o.toDer(s.privateKeyToAsn1(e))),p.finish();var d={type:"RSA PRIVATE KEY",procType:{version:"4",type:"ENCRYPTED"},dekInfo:{algorithm:a,parameters:r.util.bytesToHex(l).toUpperCase()},body:p.output.getBytes()};return r.pem.encode(d)},s.decryptRsaPrivateKey=function(e,t){var n=null,i=r.pem.decode(e)[0];if("ENCRYPTED PRIVATE KEY"!==i.type&&"PRIVATE KEY"!==i.type&&"RSA PRIVATE KEY"!==i.type){var a=new Error('Could not convert private key from PEM; PEM header type is not "ENCRYPTED PRIVATE KEY", "PRIVATE KEY", or "RSA PRIVATE KEY".');throw a.headerType=a,a}if(i.procType&&"ENCRYPTED"===i.procType.type){var l,u;switch(i.dekInfo.algorithm){case"DES-CBC":l=8,u=r.des.createDecryptionCipher;break;case"DES-EDE3-CBC":l=24,u=r.des.createDecryptionCipher;break;case"AES-128-CBC":l=16,u=r.aes.createDecryptionCipher;break;case"AES-192-CBC":l=24,u=r.aes.createDecryptionCipher;break;case"AES-256-CBC":l=32,u=r.aes.createDecryptionCipher;break;case"RC2-40-CBC":l=5,u=function(e){return r.rc2.createDecryptionCipher(e,40)};break;case"RC2-64-CBC":l=8,u=function(e){return r.rc2.createDecryptionCipher(e,64)};break;case"RC2-128-CBC":l=16,u=function(e){return r.rc2.createDecryptionCipher(e,128)};break;default:var a=new Error('Could not decrypt private key; unsupported encryption algorithm "'+i.dekInfo.algorithm+'".');throw a.algorithm=i.dekInfo.algorithm,a}var c=r.util.hexToBytes(i.dekInfo.parameters),h=r.pbe.opensslDeriveBytes(t,c.substr(0,8),l),f=u(h);if(f.start(c),f.update(r.util.createBuffer(i.body)),!f.finish())return n;n=f.output.getBytes()}else n=i.body;return n="ENCRYPTED PRIVATE KEY"===i.type?s.decryptPrivateKeyInfo(o.fromDer(n),t):o.fromDer(n),null!==n&&(n=s.privateKeyFromAsn1(n)),n},s.pbe.generatePkcs12Key=function(e,t,n,i,o,s){var a,l;if(void 0===s||null===s){if(!("sha1"in r.md))throw new Error('"sha1" hash algorithm unavailable.');s=r.md.sha1.create()}var u=s.digestLength,c=s.blockLength,h=new r.util.ByteBuffer,f=new r.util.ByteBuffer;if(null!==e&&void 0!==e){for(l=0;l=0;l--)I>>=8,I+=x.at(l)+T.at(l),T.setAt(l,255&I);A.putBuffer(T)}_=A,h.putBuffer(E)}return h.truncate(h.length()-o),h},s.pbe.getCipher=function(e,t,n){switch(e){case s.oids.pkcs5PBES2:return s.pbe.getCipherForPBES2(e,t,n);case s.oids["pbeWithSHAAnd3-KeyTripleDES-CBC"]:case s.oids["pbewithSHAAnd40BitRC2-CBC"]:return s.pbe.getCipherForPKCS12PBE(e,t,n);default:var r=new Error("Cannot read encrypted PBE data block. Unsupported OID.");throw r.oid=e,r.supportedOids=["pkcs5PBES2","pbeWithSHAAnd3-KeyTripleDES-CBC","pbewithSHAAnd40BitRC2-CBC"],r}},s.pbe.getCipherForPBES2=function(e,t,n){var i={},a=[];if(!o.validate(t,u,i,a)){var l=new Error("Cannot read password-based-encryption algorithm parameters. ASN.1 object is not a supported EncryptedPrivateKeyInfo.");throw l.errors=a,l}if(e=o.derToOid(i.kdfOid),e!==s.oids.pkcs5PBKDF2){var l=new Error("Cannot read encrypted private key. Unsupported key derivation function OID.");throw l.oid=e,l.supportedOids=["pkcs5PBKDF2"],l}if(e=o.derToOid(i.encOid),e!==s.oids["aes128-CBC"]&&e!==s.oids["aes192-CBC"]&&e!==s.oids["aes256-CBC"]&&e!==s.oids["des-EDE3-CBC"]&&e!==s.oids.desCBC){var l=new Error("Cannot read encrypted private key. Unsupported encryption scheme OID.");throw l.oid=e,l.supportedOids=["aes128-CBC","aes192-CBC","aes256-CBC","des-EDE3-CBC","desCBC"],l}var c=i.kdfSalt,h=r.util.createBuffer(i.kdfIterationCount),p,d;switch(h=h.getInt(h.length()<<3),s.oids[e]){case"aes128-CBC":p=16,d=r.aes.createDecryptionCipher;break;case"aes192-CBC":p=24,d=r.aes.createDecryptionCipher;break;case"aes256-CBC":p=32,d=r.aes.createDecryptionCipher;break;case"des-EDE3-CBC":p=24,d=r.des.createDecryptionCipher;break;case"desCBC":p=8,d=r.des.createDecryptionCipher}var m=f(i.prfOid),g=r.pkcs5.pbkdf2(n,c,h,p,m),y=i.encIv,v=d(g);return v.start(y),v},s.pbe.getCipherForPKCS12PBE=function(e,t,n){var i={},a=[];if(!o.validate(t,c,i,a)){var l=new Error("Cannot read password-based-encryption algorithm parameters. ASN.1 object is not a supported EncryptedPrivateKeyInfo.");throw l.errors=a,l}var u=r.util.createBuffer(i.salt),h=r.util.createBuffer(i.iterations),p,d,m;switch(h=h.getInt(h.length()<<3),e){case s.oids["pbeWithSHAAnd3-KeyTripleDES-CBC"]:p=24,d=8,m=r.des.startDecrypting;break;case s.oids["pbewithSHAAnd40BitRC2-CBC"]:p=5,d=8,m=function(e,t){var n=r.rc2.createDecryptionCipher(e,40);return n.start(t,null),n};break;default:var l=new Error("Cannot read PKCS #12 PBE data block. Unsupported OID.");throw l.oid=e,l}var g=f(i.prfOid),y=s.pbe.generatePkcs12Key(n,u,1,h,p,g);g.start();var v=s.pbe.generatePkcs12Key(n,u,2,h,d,g);return m(y,v)},s.pbe.opensslDeriveBytes=function(e,t,n,i){if(void 0===i||null===i){if(!("md5"in r.md))throw new Error('"md5" hash algorithm unavailable.');i=r.md.md5.create()}null===t&&(t="");for(var o=[h(i,e+t)],s=16,a=1;s8?3:1,g=[],y=[0,0,1,1,1,1,1,1,0,1,1,1,1,1,1,0],v=0,b,_=0;_>>4^k),k^=b,w^=b<<4,b=65535&(k>>>-16^w),w^=b,k^=b<<-16,b=858993459&(w>>>2^k),k^=b,w^=b<<2,b=65535&(k>>>-16^w),w^=b,k^=b<<-16,b=1431655765&(w>>>1^k),k^=b,w^=b<<1,b=16711935&(k>>>8^w),w^=b,k^=b<<8,b=1431655765&(w>>>1^k),k^=b,w^=b<<1,b=w<<8|k>>>20&240,w=k<<24|k<<8&16711680|k>>>8&65280|k>>>24&240,k=b;for(var E=0;E>>26,k=k<<2|k>>>26):(w=w<<1|w>>>27,k=k<<1|k>>>27),w&=-15,k&=-15;var S=t[w>>>28]|n[w>>>24&15]|r[w>>>20&15]|i[w>>>16&15]|o[w>>>12&15]|s[w>>>8&15]|a[w>>>4&15],x=l[k>>>28]|u[k>>>24&15]|c[k>>>20&15]|h[k>>>16&15]|f[k>>>12&15]|p[k>>>8&15]|d[k>>>4&15];b=65535&(x>>>16^S),g[v++]=S^b,g[v++]=x^b<<16}}return g}function d(e,t,n,r){var i=32===e.length?3:9,p,d;p=3===i?r?[30,-2,-2]:[0,32,2]:r?[94,62,-2,32,64,2,30,-2,-2]:[0,32,2,62,30,-2,64,96,2];var m=t[0],g=t[1];d=252645135&(m>>>4^g),g^=d,m^=d<<4,d=65535&(m>>>16^g),g^=d,m^=d<<16,d=858993459&(g>>>2^m),m^=d,g^=d<<2,d=16711935&(g>>>8^m),m^=d,g^=d<<8,d=1431655765&(m>>>1^g),g^=d,m^=d<<1,m=m<<1|m>>>31,g=g<<1|g>>>31;for(var y=0;y>>4|g<<28)^e[_+1];d=m,m=g,g=d^(s[w>>>24&63]|l[w>>>16&63]|c[w>>>8&63]|f[63&w]|o[k>>>24&63]|a[k>>>16&63]|u[k>>>8&63]|h[63&k])}d=m,m=g,g=d}m=m>>>1|m<<31,g=g>>>1|g<<31,d=1431655765&(m>>>1^g),g^=d,m^=d<<1,d=16711935&(g>>>8^m),m^=d,g^=d<<8,d=858993459&(g>>>2^m),m^=d,g^=d<<2,d=65535&(m>>>16^g),g^=d,m^=d<<16,d=252645135&(m>>>4^g),g^=d,m^=d<<4,n[0]=m,n[1]=g}function m(e){e=e||{};var t=(e.mode||"CBC").toUpperCase(),n="DES-"+t,i;i=e.decrypt?r.cipher.createDecipher(n,e.key):r.cipher.createCipher(n,e.key);var o=i.start;return i.start=function(e,t){var n=null;t instanceof r.util.ByteBuffer&&(n=t,t={}),t=t||{},t.output=n,t.iv=e,o.call(i,t)},i}},function(e,t,n){var r=n(20);n(30);var i=e.exports=r.pem=r.pem||{};function o(e){for(var t=e.name+": ",n=[],r=function(e,t){return" "+t},i=0;i65&&-1!==s){var a=t[s];","===a?(++s,t=t.substr(0,s)+"\r\n "+t.substr(s)):t=t.substr(0,s)+"\r\n"+a+t.substr(s+1),o=i-s-1,s=-1,++i}else" "!==t[i]&&"\t"!==t[i]&&","!==t[i]||(s=i);return t}function s(e){return e.replace(/^\s+/,"")}i.encode=function(e,t){t=t||{};var n="-----BEGIN "+e.type+"-----\r\n",i;if(e.procType&&(i={name:"Proc-Type",values:[String(e.procType.version),e.procType.type]},n+=o(i)),e.contentDomain&&(i={name:"Content-Domain",values:[e.contentDomain]},n+=o(i)),e.dekInfo&&(i={name:"DEK-Info",values:[e.dekInfo.algorithm]},e.dekInfo.parameters&&i.values.push(e.dekInfo.parameters),n+=o(i)),e.headers)for(var s=0;s{n(null,e)},e=>{n(e)})}},function(e,t,n){"use strict";e.exports=self.crypto||self.msCrypto},function(e,t,n){"use strict";const r=n(743);e.exports=function(e){if(!e||"number"!=typeof e)throw new Error("first argument must be a Number bigger than 0");return r(e)}},function(e,t,n){"use strict";var r=n(3),i=n(378),o=n(5).Buffer,s=new Array(16);function a(){i.call(this,64),this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878}function l(e,t){return e<>>32-t}function u(e,t,n,r,i,o,s){return l(e+(t&n|~t&r)+i+o|0,s)+t|0}function c(e,t,n,r,i,o,s){return l(e+(t&r|n&~r)+i+o|0,s)+t|0}function h(e,t,n,r,i,o,s){return l(e+(t^n^r)+i+o|0,s)+t|0}function f(e,t,n,r,i,o,s){return l(e+(n^(t|~r))+i+o|0,s)+t|0}r(a,i),a.prototype._update=function(){for(var e=s,t=0;t<16;++t)e[t]=this._block.readInt32LE(4*t);var n=this._a,r=this._b,i=this._c,o=this._d;n=u(n,r,i,o,e[0],3614090360,7),o=u(o,n,r,i,e[1],3905402710,12),i=u(i,o,n,r,e[2],606105819,17),r=u(r,i,o,n,e[3],3250441966,22),n=u(n,r,i,o,e[4],4118548399,7),o=u(o,n,r,i,e[5],1200080426,12),i=u(i,o,n,r,e[6],2821735955,17),r=u(r,i,o,n,e[7],4249261313,22),n=u(n,r,i,o,e[8],1770035416,7),o=u(o,n,r,i,e[9],2336552879,12),i=u(i,o,n,r,e[10],4294925233,17),r=u(r,i,o,n,e[11],2304563134,22),n=u(n,r,i,o,e[12],1804603682,7),o=u(o,n,r,i,e[13],4254626195,12),i=u(i,o,n,r,e[14],2792965006,17),r=u(r,i,o,n,e[15],1236535329,22),n=c(n,r,i,o,e[1],4129170786,5),o=c(o,n,r,i,e[6],3225465664,9),i=c(i,o,n,r,e[11],643717713,14),r=c(r,i,o,n,e[0],3921069994,20),n=c(n,r,i,o,e[5],3593408605,5),o=c(o,n,r,i,e[10],38016083,9),i=c(i,o,n,r,e[15],3634488961,14),r=c(r,i,o,n,e[4],3889429448,20),n=c(n,r,i,o,e[9],568446438,5),o=c(o,n,r,i,e[14],3275163606,9),i=c(i,o,n,r,e[3],4107603335,14),r=c(r,i,o,n,e[8],1163531501,20),n=c(n,r,i,o,e[13],2850285829,5),o=c(o,n,r,i,e[2],4243563512,9),i=c(i,o,n,r,e[7],1735328473,14),r=c(r,i,o,n,e[12],2368359562,20),n=h(n,r,i,o,e[5],4294588738,4),o=h(o,n,r,i,e[8],2272392833,11),i=h(i,o,n,r,e[11],1839030562,16),r=h(r,i,o,n,e[14],4259657740,23),n=h(n,r,i,o,e[1],2763975236,4),o=h(o,n,r,i,e[4],1272893353,11),i=h(i,o,n,r,e[7],4139469664,16),r=h(r,i,o,n,e[10],3200236656,23),n=h(n,r,i,o,e[13],681279174,4),o=h(o,n,r,i,e[0],3936430074,11),i=h(i,o,n,r,e[3],3572445317,16),r=h(r,i,o,n,e[6],76029189,23),n=h(n,r,i,o,e[9],3654602809,4),o=h(o,n,r,i,e[12],3873151461,11),i=h(i,o,n,r,e[15],530742520,16),r=h(r,i,o,n,e[2],3299628645,23),n=f(n,r,i,o,e[0],4096336452,6),o=f(o,n,r,i,e[7],1126891415,10),i=f(i,o,n,r,e[14],2878612391,15),r=f(r,i,o,n,e[5],4237533241,21),n=f(n,r,i,o,e[12],1700485571,6),o=f(o,n,r,i,e[3],2399980690,10),i=f(i,o,n,r,e[10],4293915773,15),r=f(r,i,o,n,e[1],2240044497,21),n=f(n,r,i,o,e[8],1873313359,6),o=f(o,n,r,i,e[15],4264355552,10),i=f(i,o,n,r,e[6],2734768916,15),r=f(r,i,o,n,e[13],1309151649,21),n=f(n,r,i,o,e[4],4149444226,6),o=f(o,n,r,i,e[11],3174756917,10),i=f(i,o,n,r,e[2],718787259,15),r=f(r,i,o,n,e[9],3951481745,21),this._a=this._a+n|0,this._b=this._b+r|0,this._c=this._c+i|0,this._d=this._d+o|0},a.prototype._digest=function(){this._block[this._blockOffset++]=128,this._blockOffset>56&&(this._block.fill(0,this._blockOffset,64),this._update(),this._blockOffset=0),this._block.fill(0,this._blockOffset,56),this._block.writeUInt32LE(this._length[0],56),this._block.writeUInt32LE(this._length[1],60),this._update();var e=o.allocUnsafe(16);return e.writeInt32LE(this._a,0),e.writeInt32LE(this._b,4),e.writeInt32LE(this._c,8),e.writeInt32LE(this._d,12),e},e.exports=a},function(e,t,n){t=e.exports=n(379),t.Stream=t,t.Readable=t,t.Writable=n(257),t.Duplex=n(98),t.Transform=n(382),t.PassThrough=n(773)},function(e,t,n){"use strict";(function(t,r){var i=n(11);function o(e,t,n){this.chunk=e,this.encoding=t,this.callback=n,this.next=null}function s(e){var t=this;this.next=null,this.entry=null,this.finish=function(){F(t,e)}}e.exports=_;var a=!t.browser&&["v0.10","v0.9."].indexOf(t.version.slice(0,5))>-1?setImmediate:i.nextTick,l;_.WritableState=b;var u=n(8);u.inherits=n(3);var c={deprecate:n(59)},h=n(380),f=n(5).Buffer,p=r.Uint8Array||function(){};function d(e){return f.from(e)}function m(e){return f.isBuffer(e)||e instanceof p}var g=n(381),y;function v(){}function b(e,t){l=l||n(98),e=e||{};var r=t instanceof l;this.objectMode=!!e.objectMode,r&&(this.objectMode=this.objectMode||!!e.writableObjectMode);var i=e.highWaterMark,o=e.writableHighWaterMark,a=this.objectMode?16:16384;this.highWaterMark=i||0===i?i:r&&(o||0===o)?o:a,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 u=!1===e.decodeStrings;this.decodeStrings=!u,this.defaultEncoding=e.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(e){T(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 s(this)}function _(e){if(l=l||n(98),!(y.call(_,this)||this instanceof l))return new _(e);this._writableState=new b(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 w(e,t){var n=new Error("write after end");e.emit("error",n),i.nextTick(t,n)}function k(e,t,n,r){var o=!0,s=!1;return null===n?s=new TypeError("May not write null values to stream"):"string"==typeof n||void 0===n||t.objectMode||(s=new TypeError("Invalid non-string/buffer chunk")),s&&(e.emit("error",s),i.nextTick(r,s),o=!1),o}function E(e,t,n){return e.objectMode||!1===e.decodeStrings||"string"!=typeof t||(t=f.from(t,n)),t}function S(e,t,n,r,i,o){if(!n){var s=E(t,r,i);r!==s&&(n=!0,i="buffer",r=s)}var a=t.objectMode?1:r.length;t.length+=a;var l=t.length-1))throw new TypeError("Unknown encoding: "+t);return this._writableState.defaultEncoding=t,this},Object.defineProperty(_.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),_.prototype._write=function(e,t,n){n(new Error("_write() is not implemented"))},_.prototype._writev=null,_.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&&void 0!==e&&this.write(e,t),r.corked&&(r.corked=1,this.uncork()),r.ending||r.finished||D(this,r,n)},Object.defineProperty(_.prototype,"destroyed",{get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(e){this._writableState&&(this._writableState.destroyed=e)}}),_.prototype.destroy=g.destroy,_.prototype._undestroy=g.undestroy,_.prototype._destroy=function(e,t){this.end(),t(e)}}).call(this,n(2),n(7))},function(e,t,n){"use strict";function r(e){if("number"==typeof e){if(r.codes[e])return r.codes[e];throw new Error("no protocol with code: "+e)}if("string"==typeof e||e instanceof String){if(r.names[e])return r.names[e];throw new Error("no protocol with name: "+e)}throw new Error("invalid protocol id type: "+e)}const i=-1;function o(e,t,n,r,i){return{code:e,size:t,name:n,resolvable:Boolean(r),path:Boolean(i)}}r.lengthPrefixedVarSize=i,r.V=i,r.table=[[4,32,"ip4"],[6,16,"tcp"],[33,16,"dccp"],[41,128,"ip6"],[42,i,"ip6zone"],[53,i,"dns","resolvable"],[54,i,"dns4","resolvable"],[55,i,"dns6","resolvable"],[56,i,"dnsaddr","resolvable"],[132,16,"sctp"],[273,16,"udp"],[275,0,"p2p-webrtc-star"],[276,0,"p2p-webrtc-direct"],[277,0,"p2p-stardust"],[290,0,"p2p-circuit"],[301,0,"udt"],[302,0,"utp"],[400,i,"unix",!1,"path"],[421,i,"p2p"],[421,i,"ipfs"],[443,0,"https"],[444,96,"onion"],[445,296,"onion3"],[446,i,"garlic64"],[460,0,"quic"],[477,0,"ws"],[478,0,"wss"],[479,0,"p2p-websocket-star"],[480,0,"http"]],r.names={},r.codes={},r.table.map(e=>{const t=o.apply(null,e);r.codes[t.code]=t,r.names[t.name]=t}),r.object=o,e.exports=r},function(e,t,n){"use strict";const r=n(10),i=n(43),o=n(36),s=n(38),a=n(200),l=n(23),u=n(52),c=n(4),h=n(53),f=n(12),p=n(183),d=n(818),m=n(819),g=n(821),y=n(823),v=n(825),b=n(826),_=n(836),w=n(855),k=n(856),E=c("repo"),S=Number.MAX_SAFE_INTEGER,x={memory:n(422),fs:n(422)},C=n(857).repoVersion;class A{constructor(e,t){l.strictEqual(typeof e,"string","missing repoPath"),this.options=B(t),this.closed=!0,this.path=e,this._locker=this._getLocker(),this.root=d.create("root",this.path,this.options),this.version=m(this.root),this.config=g(this.root),this.spec=y(this.root),this.apiAddr=v(this.root)}init(e,t){E("initializing at: %s",this.path),i([e=>this.root.open(j(e)),t=>this.config.set(O(e),t),t=>this.spec.set(P(e),t),e=>this.version.set(C,e)],t)}open(e){this.closed?(E("opening at: %s",this.path),r([e=>this.root.open(j(e)),e=>this._isInitialized(e),e=>this._openLock(this.path,e),(e,t)=>{E("aquired repo.lock"),this.lockfile=e,t()},e=>{E("creating datastore"),this.datastore=d.create("datastore",u.join(this.path,"datastore"),this.options),E("creating blocks");const t=d.create("blocks",u.join(this.path,"blocks"),this.options);b(t,this.options.storageBackendOptions.blocks,e)},(e,t)=>{this.blocks=e,t()},e=>{E("creating keystore"),this.keys=d.create("keys",u.join(this.path,"keys"),this.options),e()},e=>{this.closed=!1,E("all opened"),e()}],t=>{t&&this.lockfile?this._closeLock(n=>{n?E("error removing lock",n):this.lockfile=null,e(t)}):e(t)})):setImmediate(()=>e(new Error("repo is already open")))}_getLocker(){return"string"==typeof this.options.lock?(l(x[this.options.lock],"Unknown lock type: "+this.options.lock),x[this.options.lock]):(l(this.options.lock,"No lock provided"),this.options.lock)}_openLock(e,t){this._locker.lock(e,(e,n)=>{if(e)return t(e,null);l.strictEqual(typeof n.close,"function","Locks must have a close method"),t(null,n)})}_closeLock(e){if(this.lockfile)return this.lockfile.close(e);e()}_isInitialized(e){E("init check"),o({config:e=>this.config.exists(e),spec:e=>this.spec.exists(e),version:e=>this.version.check(C,e)},(t,n)=>{if(E("init",t,n),t&&!n.config)return e(Object.assign(new Error("repo is not initialized yet"),{code:k.ERR_REPO_NOT_INITIALIZED,path:this.path}));e(t)})}close(e){if(this.closed)return e(new Error("repo is already closed"));E("closing at: %s",this.path),i([e=>this.apiAddr.delete(R(e)),e=>{s([this.blocks,this.keys,this.datastore],(e,t)=>e.close(t),e)},e=>{E("unlocking"),this.closed=!0,this._closeLock(e)},e=>{this.lockfile=null,e()}],t=>e(t))}exists(e){this.version.exists(e)}stat(e,t){"function"==typeof e&&(t=e,e={}),e=Object.assign({},{human:!1},e),o({storageMax:e=>this.config.get("Datastore.StorageMax",(t,n)=>{e(null,new h(t?S:n))}),version:e=>this.version.get(e),blocks:e=>this.blocks.query({},(t,n)=>{n=n||[];const r=new h(n.length);let i=new h(0);n.forEach(e=>{i=i.plus(e.value.byteLength).plus(e.key._buf.byteLength)}),e(t,{count:r,size:i})}),datastore:e=>T(this.datastore,e),keys:e=>T(this.keys,e)},(n,r)=>{if(n)return t(n);let i=r.blocks.size.plus(r.datastore).plus(r.keys);e.human&&(i=i.div(1048576)),t(null,{repoPath:this.path,storageMax:r.storageMax,version:r.version,numObjects:r.blocks.count,repoSize:i})})}}function T(e,t){f(e.query({}),p((e,t)=>e.plus(t.value.byteLength).plus(t.key._buf.byteLength),new h(0),t))}function I(e,t){return n=>{t(n&&!e(n)?n:null)}}function j(e){return I(e=>"Already open"===e.message,e)}function R(e){return I(e=>e&&(e.code===k.ERR_REPO_NOT_INITIALIZED||e.message.startsWith("ENOENT")),e)}function B(e){const t=Object.assign({},_,e);return t.storageBackends=Object.assign({},_.storageBackends,t.storageBackends),t.storageBackendOptions=Object.assign({},_.storageBackendOptions,t.storageBackendOptions),t}function O(e){return e.datastore=Object.assign({},w,a(e,"datastore",{})),e}function P(e){const t=Object.assign({},w.Spec,a(e,"datastore.Spec",{}));return{type:t.type,mounts:t.mounts.map(e=>({mountpoint:e.mountpoint,type:e.child.type,path:e.child.path,shardFunc:e.child.shardFunc}))}}e.exports=A,e.exports.repoVersion=C,e.exports.errors=k},function(e,t,n){"use strict";const r=n(18),i=n(186),o=n(52),s=n(196),a=n(121);t.asyncFilter=function(e){let t=!1,n,r;return function(i){return function o(s,a){if(r)return a(r);s?(r=s,i(s,t?()=>{t?n=a:a(s)}:a)):i(null,(i,s)=>{i?a(i):r?a(r):(t=!0,e(s,(e,i)=>{t=!1,r?(a(r),n(r)):e?o(e,a):i?a(null,s):o(null,a)}))})}}},t.asyncSort=function(e){const t=i(),n=r.collect((n,i)=>{if(n)return t.abort(n);e(i,(e,n)=>{if(e)return t.abort(e);t.resolve(r.values(i))})});return function(e){return n(e),t}},t.replaceStartWith=function(e,t){const n=new RegExp("^"+t);return e.replace(n,"")},t.tmpdir=(()=>o.join(s.tmpdir(),a()))},function(e,t,n){var r=n(843).create,i=r("LevelUPError"),o=r("NotFoundError",i);o.prototype.notFound=!0,o.prototype.status=404,e.exports={LevelUPError:i,InitializationError:r("InitializationError",i),OpenError:r("OpenError",i),ReadError:r("ReadError",i),WriteError:r("WriteError",i),NotFoundError:o,EncodingError:r("EncodingError",i)}},function(e,t,n){t.AbstractLevelDOWN=n(847),t.AbstractIterator=n(416),t.AbstractChainedBatch=n(417)},function(e,t,n){"use strict";const r=1e3;e.exports={maxProvidersPerRequest:3,providerRequestTimeout:1e4,hasBlockTimeout:15e3,provideTimeout:15e3,kMaxPriority:Math.pow(2,31)-1,rebroadcastDelay:1e4,maxListeners:1e3}},function(e,t,n){var r=n(933)("socket.io-parser"),i=n(124),o=n(936),s=n(442),a=n(443);function l(){}t.protocol=4,t.types=["CONNECT","DISCONNECT","EVENT","ACK","ERROR","BINARY_EVENT","BINARY_ACK"],t.CONNECT=0,t.DISCONNECT=1,t.EVENT=2,t.ACK=3,t.ERROR=4,t.BINARY_EVENT=5,t.BINARY_ACK=6,t.Encoder=l,t.Decoder=p;var u=t.ERROR+'"encode error"';function c(e){var n=""+e.type;if(t.BINARY_EVENT!==e.type&&t.BINARY_ACK!==e.type||(n+=e.attachments+"-"),e.nsp&&"/"!==e.nsp&&(n+=e.nsp+","),null!=e.id&&(n+=e.id),null!=e.data){var i=h(e.data);if(!1===i)return u;n+=i}return r("encoded %j as %s",e,n),n}function h(e){try{return JSON.stringify(e)}catch(e){return!1}}function f(e,t){function n(e){var n=o.deconstructPacket(e),r=c(n.packet),i=n.buffers;i.unshift(r),t(i)}o.removeBlobs(e,n)}function p(){this.reconstructor=null}function d(e){var n=0,i={type:Number(e.charAt(0))};if(null==t.types[i.type])return y("unknown packet type "+i.type);if(t.BINARY_EVENT===i.type||t.BINARY_ACK===i.type){for(var o="";"-"!==e.charAt(++n)&&(o+=e.charAt(n),n!=e.length););if(o!=Number(o)||"-"!==e.charAt(n))throw new Error("Illegal attachments");i.attachments=Number(o)}if("/"===e.charAt(n+1))for(i.nsp="";++n;){var a=e.charAt(n);if(","===a)break;if(i.nsp+=a,n===e.length)break}else i.nsp="/";var l=e.charAt(n+1);if(""!==l&&Number(l)==l){for(i.id="";++n;){var a=e.charAt(n);if(null==a||Number(a)!=a){--n;break}if(i.id+=e.charAt(n),n===e.length)break}i.id=Number(i.id)}if(e.charAt(++n)){var u=m(e.substr(n)),c=!1!==u&&(i.type===t.ERROR||s(u));if(!c)return y("invalid payload");i.data=u}return r("decoded %s as %j",e,i),i}function m(e){try{return JSON.parse(e)}catch(e){return!1}}function g(e){this.reconPack=e,this.buffers=[]}function y(e){return{type:t.ERROR,data:"parser error: "+e}}l.prototype.encode=function(e,n){if(r("encoding packet %j",e),t.BINARY_EVENT===e.type||t.BINARY_ACK===e.type)f(e,n);else{var i=c(e);n([i])}},i(p.prototype),p.prototype.add=function(e){var n;if("string"==typeof e)n=d(e),t.BINARY_EVENT===n.type||t.BINARY_ACK===n.type?(this.reconstructor=new g(n),0===this.reconstructor.reconPack.attachments&&this.emit("decoded",n)):this.emit("decoded",n);else{if(!a(e)&&!e.base64)throw new Error("Unknown type: "+e);if(!this.reconstructor)throw new Error("got binary data when not reconstructing a packet");n=this.reconstructor.takeBinaryData(e),n&&(this.reconstructor=null,this.emit("decoded",n))}},p.prototype.destroy=function(){this.reconstructor&&this.reconstructor.finishedReconstruction()},g.prototype.takeBinaryData=function(e){if(this.buffers.push(e),this.buffers.length===this.reconPack.attachments){var t=o.reconstructPacket(this.reconPack,this.buffers);return this.finishedReconstruction(),t}return null},g.prototype.finishedReconstruction=function(){this.reconPack=null,this.buffers=[]}},function(e,t,n){var r=n(939);e.exports=function(e){var t=e.xdomain,n=e.xscheme,i=e.enablesXDR;try{if("undefined"!=typeof XMLHttpRequest&&(!t||r))return new XMLHttpRequest}catch(e){}try{if("undefined"!=typeof XDomainRequest&&!n&&i)return new XDomainRequest}catch(e){}if(!t)try{return new(self[["Active"].concat("Object").join("X")])("Microsoft.XMLHTTP")}catch(e){}}},function(e,t,n){var r=n(125),i=n(124);function o(e){this.path=e.path,this.hostname=e.hostname,this.port=e.port,this.secure=e.secure,this.query=e.query,this.timestampParam=e.timestampParam,this.timestampRequests=e.timestampRequests,this.readyState="",this.agent=e.agent||!1,this.socket=e.socket,this.enablesXDR=e.enablesXDR,this.pfx=e.pfx,this.key=e.key,this.passphrase=e.passphrase,this.cert=e.cert,this.ca=e.ca,this.ciphers=e.ciphers,this.rejectUnauthorized=e.rejectUnauthorized,this.forceNode=e.forceNode,this.isReactNative=e.isReactNative,this.extraHeaders=e.extraHeaders,this.localAddress=e.localAddress}e.exports=o,i(o.prototype),o.prototype.onError=function(e,t){var n=new Error(e);return n.type="TransportError",n.description=t,this.emit("error",n),this},o.prototype.open=function(){return"closed"!==this.readyState&&""!==this.readyState||(this.readyState="opening",this.doOpen()),this},o.prototype.close=function(){return"opening"!==this.readyState&&"open"!==this.readyState||(this.doClose(),this.onClose()),this},o.prototype.send=function(e){if("open"!==this.readyState)throw new Error("Transport not open");this.write(e)},o.prototype.onOpen=function(){this.readyState="open",this.writable=!0,this.emit("open")},o.prototype.onData=function(e){var t=r.decodePacket(e,this.socket.binaryType);this.onPacket(t)},o.prototype.onPacket=function(e){this.emit("packet",e)},o.prototype.onClose=function(){this.readyState="closed",this.emit("close")}},function(e,t,n){"use strict";(function(e){const r=n(54),i=n(50),o=n(12),s=n(40),a=n(33),l=n(49),u=n(36);function c(e,t,n){l.hmac.create(e,t,n)}function h(e,t,n,r){if("AES-128"===e||"AES-256"===e)return l.aes.create(n,t,r);r(new Error(`unrecognized cipher type: ${e}`))}t.exchanges=["P-256","P-384","P-521"],t.ciphers=["AES-256","AES-128"],t.hashes=["SHA256","SHA512"],t.theBest=((e,t,n)=>{let r,i;if(e<0)r=n,i=t;else{if(!(e>0))return t[0];r=t,i=n}for(let e of r)for(let t of i)if(e===t)return e;throw new Error("No algorithms in common!")}),t.makeMacAndCipher=((e,t)=>{u([t=>c(e.hashT,e.keys.macKey,t),t=>h(e.cipherT,e.keys.iv,e.keys.cipherKey,t)],(n,r)=>{if(n)return t(n);e.mac=r[0],e.cipher=r[1],t()})}),t.selectBest=((n,r,i)=>{t.digest(e.concat([r.pubKeyBytes,n.nonce]),(o,s)=>{if(o)return i(o);t.digest(e.concat([n.pubKeyBytes,r.nonce]),(o,a)=>{if(o)return i(o);const l=e.compare(s,a);if(0===l)return i(new Error("you are trying to talk to yourself"));i(null,{curveT:t.theBest(l,n.exchanges,r.exchanges),cipherT:t.theBest(l,n.ciphers,r.ciphers),hashT:t.theBest(l,n.hashes,r.hashes),order:l})})})}),t.digest=((e,t)=>{r.digest(e,"sha2-256",e.length,t)}),t.write=function e(t,n,r){r=r||(()=>{}),o(s([n]),i.encode({fixed:!0,bytes:4}),a((e,n)=>{if(e)return r(e);t.shake.write(n[0]),r()}))},t.read=function e(t,n){i.decodeFromReader(t,{fixed:!0,bytes:4},n)}}).call(this,n(0).Buffer)},function(e,t,n){"use strict";(function(e){const r=n(55),i=n(15),o=n(49),s=n(36),a=n(10),l=n(4),u=l("libp2p:secio");u.error=l("libp2p:secio:error");const c=r(n(982)),h=n(267),f=16;t.createProposal=(e=>(e.proposal.out={rand:o.randomBytes(16),pubkey:e.key.local.public.bytes,exchanges:h.exchanges.join(","),ciphers:h.ciphers.join(","),hashes:h.hashes.join(",")},e.proposalEncoded.out=c.Propose.encode(e.proposal.out),e.proposalEncoded.out)),t.createExchange=((t,n)=>{o.keys.generateEphemeralKeyPair(t.protocols.local.curveT,(r,i)=>{if(r)return n(r);t.ephemeralKey.local=i.key,t.shared.generate=i.genSharedKey;const o=e.concat([t.proposalEncoded.out,t.proposalEncoded.in,t.ephemeralKey.local]);t.key.local.sign(o,(e,r)=>{if(e)return n(e);t.exchange.out={epubkey:t.ephemeralKey.local,signature:r},n(null,c.Exchange.encode(t.exchange.out))})})}),t.identify=((e,t,n)=>{u("1.1 identify"),e.proposalEncoded.in=t,e.proposal.in=c.Propose.decode(t);const r=e.proposal.in.pubkey;e.key.remote=o.keys.unmarshalPublicKey(r),i.createFromPubKey(r.toString("base64"),(t,r)=>{if(t)return n(t);if(e.id.remote){if(e.id.remote.toB58String()!==r.toB58String())return n(new Error("dialed to the wrong peer, Ids do not match"))}else e.id.remote=r;u("1.1 identify - %s - identified remote peer as %s",e.id.local.toB58String(),e.id.remote.toB58String()),n()})}),t.selectProtocols=((e,t)=>{u("1.2 selection");const n={pubKeyBytes:e.key.local.public.bytes,exchanges:h.exchanges,hashes:h.hashes,ciphers:h.ciphers,nonce:e.proposal.out.rand},r={pubKeyBytes:e.proposal.in.pubkey,exchanges:e.proposal.in.exchanges.split(","),hashes:e.proposal.in.hashes.split(","),ciphers:e.proposal.in.ciphers.split(","),nonce:e.proposal.in.rand};h.selectBest(n,r,(n,r)=>{if(n)return t(n);e.protocols.remote={order:r.order,curveT:r.curveT,cipherT:r.cipherT,hashT:r.hashT},e.protocols.local={order:r.order,curveT:r.curveT,cipherT:r.cipherT,hashT:r.hashT},t()})}),t.verify=((t,n,r)=>{u("2.1. verify"),t.exchange.in=c.Exchange.decode(n),t.ephemeralKey.remote=t.exchange.in.epubkey;const i=e.concat([t.proposalEncoded.in,t.proposalEncoded.out,t.ephemeralKey.remote]);t.key.remote.verify(i,t.exchange.in.signature,(e,t)=>e?r(e):t?(u("2.1. verify - signature verified"),void r()):r(new Error("Bad signature")))}),t.generateKeys=((e,t)=>{u("2.2. keys"),a([t=>e.shared.generate(e.exchange.in.epubkey,t),(t,n)=>{e.shared.secret=t,o.keys.keyStretcher(e.protocols.local.cipherT,e.protocols.local.hashT,e.shared.secret,n)},(t,n)=>{if(e.protocols.local.order>0)e.protocols.local.keys=t.k1,e.protocols.remote.keys=t.k2;else{if(!(e.protocols.local.order<0))return n(new Error("you are trying to talk to yourself"));e.protocols.local.keys=t.k2,e.protocols.remote.keys=t.k1}u("2.3. mac + cipher"),s([t=>h.makeMacAndCipher(e.protocols.local,t),t=>h.makeMacAndCipher(e.protocols.remote,t)],n)}],t)}),t.verifyNonce=((e,t)=>{const n=e.proposal.out.rand;if(!n.equals(t))throw new Error(`Failed to read our encrypted nonce: ${n.toString("hex")} != ${t.toString("hex")}`)})}).call(this,n(0).Buffer)},function(e,t,n){(function(t){function n(e,n){if(e.length!==n.length)throw new Error("Inputs should have the same length");for(var r=t.allocUnsafe(e.length),i=0;it?(c.err(t),e(t)):e(null,n))}write(e,t){if(t=t||(()=>{}),!this.isValid())return t(new Error("handler is not in a valid state"));s(r([e]),a.encode(),i((e,n)=>{if(e)return c.err(e),this.shake.abort(e),t(e);n.forEach(e=>this.shake.write(e)),t()}))}getRawConn(){return this.conn}rest(){const e=this.shake.rest();return this.conn=null,this.stream=null,this.shake=null,e}close(){this.isValid()&&s(o(),this.rest())}}e.exports=h},function(e,t,n){"use strict";e.exports={relay:"/libp2p/circuit/relay/0.1.0"}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=f;var r=n(57),i=h(r),o=n(122),s=h(o),a=n(37),l=h(a),u=n(86),c=h(u);function h(e){return e&&e.__esModule?e:{default:e}}function f(e,t){var n=null,r;t=t||i.default,(0,s.default)(e,function(e,t){(0,l.default)(e)(function(e,i){r=arguments.length>2?(0,c.default)(arguments,1):i,n=e,t(!e)})},function(){t(n,r)})}e.exports=t.default},function(e,t,n){"use strict";e.exports={BLACK_LIST_TTL:3e5,BLACK_LIST_ATTEMPTS:5,DIAL_TIMEOUT:3e4,MAX_COLD_CALLS:50,MAX_PARALLEL_DIALS:100,QUARTER_HOUR:9e5,PRIORITY_HIGH:10,PRIORITY_LOW:20}},function(e,t,n){"use strict";const r=n(278);e.exports.msHandle=((e,t)=>new Promise((n,r)=>{e.handle(t,e=>{if(e)return r(e);n()})})),e.exports.msSelect=((e,t)=>new Promise((n,r)=>{e.select(t,(e,t)=>{if(e)return r(e);n(t)})})),e.exports.identifyDialer=((e,t)=>new Promise((n,i)=>{r.dialer(e,t,(e,t,r)=>{if(e)return i(e);n({peerInfo:t,observedAddrs:r})})})),e.exports.uniqueBy=((e,t)=>[...new Map(e.map(e=>[t(e),e])).values()])},function(e,t,n){"use strict";t=e.exports,t.multicodec="/ipfs/id/1.0.0",t.listener=n(1031),t.dialer=n(1032),t.message=n(279)},function(e,t,n){"use strict";const r=n(55),i="\nmessage Identify {\n // protocolVersion determines compatibility between peers\n optional string protocolVersion = 5; // e.g. ipfs/1.0.0\n\n // agentVersion is like a UserAgent string in browsers, or client version in bittorrent\n // includes the client name and client.\n optional string agentVersion = 6; // e.g. go-ipfs/0.1.0\n\n // publicKey is this node's public key (which also gives its node.ID)\n // - may not need to be sent, as secure channel implies it has been sent.\n // - then again, if we change / disable secure channel, may still want it.\n optional bytes publicKey = 1;\n\n // listenAddrs are the multiaddrs the sender node listens for open connections on\n repeated bytes listenAddrs = 2;\n\n // oservedAddr is the multiaddr of the remote endpoint that the sender node perceives\n // this is useful information to convey to the other side, as it helps the remote endpoint\n // determine whether its connection to the local peer goes through NAT.\n optional bytes observedAddr = 4;\n\n repeated string protocols = 3;\n}\n";e.exports=r(i).Identify},function(e,t,n){"use strict";const r=n(64).Connection,i=n(12);e.exports=((e,t,n,o)=>{const s=new Promise((e,t)=>{n.getPeerInfo((t,r)=>{if(!t&&r)return void e(r);const i=n.setPeerInfo;n.setPeerInfo=(t=>{i.call(n,t),e(t)})})}),a={source:i(n,o.incoming(e,t,s)),sink:i(o.outgoing(e,t,s),n)};return new r(a,n)})},function(e,t,n){"use strict";e.exports={PROTOCOL:"/ipfs/ping/1.0.0",PING_LENGTH:32}},function(e,t,n){var r=n(65),i=n(283),o=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,s=/^\w*$/;function a(e,t){if(r(e))return!1;var n=typeof e;return!("number"!=n&&"symbol"!=n&&"boolean"!=n&&null!=e&&!i(e))||(s.test(e)||!o.test(e)||null!=t&&e in Object(t))}e.exports=a},function(e,t,n){var r=n(108),i=n(87),o="[object Symbol]";function s(e){return"symbol"==typeof e||i(e)&&r(e)==o}e.exports=s},function(e,t,n){var r=n(1062),i=n(1078),o=n(1080),s=n(1081),a=n(1082);function l(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t=u&&f&&(p=null,e(f))}}var g=r(function(){if(h=!0,f)return m();i||t&&a-t>=l||(i=!0,s(o,function(t,r){if(i=!1,t)u=a,f=t,m();else{var o=a++;e(r,function(e,t){n?c[o]=t:c.push(t),e&&(d=e),m()}),f||g()}}))});return function(e,t){e?s(f=o=e,function(e){if(t)return t(e)}):(p=t,h||g(),m())}}}},function(e,t,n){"use strict";const r=n(163),i=100;e.exports=function e(t){const n=t||100;var i=[];return r(function e(t){for(i=i.concat(t);i.length>=n;){const e=n,t=i.slice(0,e);i=i.slice(e),this.queue(t)}},function e(t){i.length&&(this.queue(i),i=[]),this.queue(null)})}},function(e,t,n){"use strict";e.exports=class e{constructor(e,t){this._options=t||{},Object.assign(this,e)}}},function(e,t,n){"use strict";const r=n(1157),i=n(1158),o={bits:8};class s{constructor(e,t,n){if(this._options=Object.assign({},o,e),this._popCount=0,this._parent=t,this._posAtParent=n,!this._options.hashFn)throw new Error("please define an options.hashFn");this._options.hash||(this._options.hash=i(this._options.hashFn)),this._children=new r}static isBucket(e){return e instanceof s}async put(e,t){const n=await this._findNewBucketAndPos(e);await n.bucket._putAt(n,e,t)}async get(e){const t=await this._findChild(e);if(t)return t.value}async del(e){const t=await this._findPlace(e),n=t.bucket._at(t.pos);n&&n.key===e&&t.bucket._delAt(t.pos)}leafCount(){return this._children.compactArray().reduce((e,t)=>t instanceof s?e+t.leafCount():e+1,0)}childrenCount(){return this._children.length}onlyChild(){return this._children.get(0)}*eachLeafSeries(){const e=this._children.compactArray();for(const t of e)if(t instanceof s)for(const e of t.eachLeafSeries())yield e;else yield t}serialize(e,t){return t(this._children.reduce((n,r,i)=>(r&&(r instanceof s?n.push(r.serialize(e,t)):n.push(e(r,i))),n),[]))}async asyncTransform(e,t){return c(this,e,t)}toJSON(){return this.serialize(l,u)}prettyPrint(){return JSON.stringify(this.toJSON(),null," ")}tableSize(){return Math.pow(2,this._options.bits)}async _findChild(e){const t=await this._findPlace(e),n=t.bucket._at(t.pos);if(n&&n.key===e)return n}async _findPlace(e){const t=this._options.hash(e),n=await t.take(this._options.bits),r=this._children.get(n);return r instanceof s?r._findPlace(t):{bucket:this,pos:n,hash:t}}async _findNewBucketAndPos(e){const t=await this._findPlace(e),n=t.bucket._at(t.pos);if(n&&n.key!==e){const e=new s(this._options,t.bucket,t.pos);t.bucket._putObjectAt(t.pos,e);const r=await e._findPlace(n.hash);return r.bucket._putAt(r,n.key,n.value),e._findNewBucketAndPos(t.hash)}return t}_putAt(e,t,n){this._putObjectAt(e.pos,{key:t,value:n,hash:e.hash})}_putObjectAt(e,t){this._children.get(e)||this._popCount++,this._children.set(e,t)}_delAt(e){this._children.get(e)&&this._popCount--,this._children.unset(e),this._level()}_level(){if(this._parent&&this._popCount<=1)if(1===this._popCount){const e=this._children.find(a);if(!(e instanceof s)){const t=e.hash;t.untake(this._options.bits);const n={pos:this._posAtParent,hash:t};this._parent._putAt(n,e.key,e.value)}}else this._parent._delAt(this._posAtParent)}_at(e){return this._children.get(e)}}function a(e){return Boolean(e)}function l(e,t){return e.key}function u(e){return e}async function c(e,t,n){const r=[];for(const i of e._children.compactArray()){if(i instanceof s)await c(i,t,n);else{const n=await t(i);r.push({bitField:e._children.bitField(),children:n})}return n(r)}}e.exports=s},function(e,t,n){"use strict";const r=(e="")=>(e.trim().match(/([^\\^/]|\\\/)+/g)||[]).filter(Boolean);e.exports=r},function(e,t,n){"use strict";(function(t){const r=n(10),i=n(45),o=n(81),{loadNode:s,formatCid:a,toMfsPath:l,FILE_SEPARATOR:u,FILE_TYPES:c}=n(73),h=n(12),f=n(33),p=n(74),d=n(67),m=n(116),g=n(71),y=n(61),v={long:!1,cidBase:"base58btc"};e.exports=(e=>(function n(b,_={}){"object"==typeof b&&(_=b,b=u),void 0===b&&(b=u),_=Object.assign({},v,_),_.long=_.l||_.long;const w=y.source();return r([t=>l(e,b,t),({mfsPath:t,depth:n},r)=>{h(o(t,e.ipld,{maxDepth:n}),f((i,s)=>{if(i)return r(i);if(s.length>1)return r(new Error(`Path ${b} had ${s.length} roots`));const a=s[0];if(!a)return r(new Error(`${b} does not exist`));if("dir"!==a.type)return r(null,m(a));let l=!0;return r(null,h(o(t,e.ipld,{maxDepth:n+1}),d(()=>!l||(l=!1,!1))))}))},(n,r)=>{r(null,h(n,p((n,r)=>{if(!_.long)return r(null,{name:n.name,type:0,size:0,hash:""});s(e,{cid:n.cid},(e,o)=>{if(e)return r(e);if(t.isBuffer(o.node))return r(null,{name:n.name,type:0,hash:a(n.cid,_.cidBase),size:o.node.length});const s=i.unmarshal(o.node.data);r(null,{name:n.name,type:c[s.type],hash:a(n.cid,_.cidBase),size:s.fileSize()||0})})})))}],(e,t)=>{if(e)return w.resolve(g(e));w.resolve(t)}),w}))}).call(this,n(0).Buffer)},function(e,t,n){"use strict";const r=n(10),i=n(58),o=n(4)("ipfs:mfs:mkdir"),s=n(81),a=n(12),l=n(67),u=n(66),c=n(33),{createNode:h,toMfsPath:f,toPathComponents:p,updateMfsRoot:d,updateTree:m,FILE_SEPARATOR:g}=n(73),y={parents:!1,hashAlg:"sha2-256",cidVersion:0,shardSplitThreshold:1e3,format:"dag-pb",flush:!0};e.exports=(e=>(function t(n,v,b){if("function"==typeof v&&(b=v,v={}),v=Object.assign({},y,v),v.parents=v.p||v.parents,v.cidVersion=v.cidVersion||0,!n)return b(new Error("no path given to Mkdir"));if(n=n.trim(),n===g)return b(v.parents?null:new Error(`cannot create directory '${g}': Already exists`));o(`Creating ${n}`);const _=p(n);r([t=>f(e,n,t),({mfsDirectory:t,mfsPath:n,root:r},i)=>{const o=p(n).slice(1);let h=0,f="";a(s(n,e.ipld,{fullPath:!0}),l(e=>e.name===o[h]&&(h++,!0)),u(e=>{const t=`${f}${f?"/":""}${o[e.depth]}`;if("dir"!==e.type)throw new Error(`cannot access ${t}: Not a directory`);return f=t,{cid:e.cid,name:e.name}}),c(i))},(t,n)=>{if(_.unshift("/"),t.length===_.length)return n(new Error("file already exists"));i(_.map((e,t)=>({part:e,index:t})),({part:n,index:i},o)=>t[i]?o(null,{name:n,...t[i]}):i===_.length-1||v.parents?void r([t=>h(e,"directory",v,t),({cid:e,node:t},r)=>{r(null,{cid:e,size:t.size,name:n})}],o):o(new Error("file does not exist")),n)},(t,n)=>m(e,t,v,n),({cid:t},n)=>d(e,t,n)],e=>{e&&e.message.includes("file already exists")&&v.parents&&(e=null),b(e)})}))},function(e,t,n){"use strict";const r=n(81),i=n(12),o=n(116),s=n(74),a=n(185),l=n(67),u=n(61),c=n(33),{toMfsPath:h}=n(73),f=n(4)("ipfs:mfs:read-pull-stream"),p={offset:0,length:void 0};e.exports=(e=>(function t(n,d={}){d=Object.assign({},p,d),d.length=d.length||d.count,f(`Reading ${n}`);const m=u.source();return i(o(n),s((t,n)=>h(e,t,n)),s(({mfsPath:t,root:n},o)=>(f(`Exporting ${t}`),i(r(t,e.ipld,{offset:d.offset,length:d.length}),c(o)))),a(),l(),c((e,t)=>{if(e)return m.abort(e);if(!t||!t.length)return m.abort(new Error(`${n} does not exist`));const r=t[0];return"file"!==r.type?m.abort(new Error(`${n} was not a file`)):r.content?(f(`Got ${n} content`),void m.resolve(t[0].content)):m.abort(new Error(`Could not load content stream from ${n}`))})),m}))},function(e,t,n){"use strict";const r=n(26),i=n(164),o=n(165);e.exports=((e,t)=>{const n=o(e,t);return(e,t,o)=>{const s=r(o),a=n(t),l=i(e=>s(null,e));a.once("error",s),a.pipe(l),a.write(e),a.end()}})},function(e,t,n){"use strict";const r=n(51),i=n(1278),o=n(16).Readable;class s extends o{constructor(e){const t=Object.assign(e||{},{objectMode:!0});super(t)}_read(){}}const a=(e,t)=>{let n=new s,o=i.extract();o.on("entry",(e,t,r)=>{t.on("end",r),"directory"!==e.type?n.push({path:e.name,content:t}):(n.push({path:e.name}),t.resume())}).on("finish",()=>n.push(null)),r(e,o),t(null,n)};e.exports=a},function(e,t,n){"use strict";var r=Object.prototype.hasOwnProperty,i=Array.isArray,o=function(){for(var e=[],t=0;t<256;++t)e.push("%"+((t<16?"0":"")+t.toString(16)).toUpperCase());return e}(),s=function e(t){for(;t.length>1;){var n=t.pop(),r=n.obj[n.prop];if(i(r)){for(var o=[],s=0;s=48&&l<=57||l>=65&&l<=90||l>=97&&l<=122?s+=i.charAt(a):l<128?s+=o[l]:l<2048?s+=o[192|l>>6]+o[128|63&l]:l<55296||l>=57344?s+=o[224|l>>12]+o[128|l>>6&63]+o[128|63&l]:(a+=1,l=65536+((1023&l)<<10|1023&i.charCodeAt(a)),s+=o[240|l>>18]+o[128|l>>12&63]+o[128|l>>6&63]+o[128|63&l])}return s},f=function e(t){for(var n=[{obj:{o:t},prop:"o"}],r=[],i=0;i1;class m{constructor(e){if("number"==typeof e&&(e={max:e}),e||(e={}),e.max&&("number"!=typeof e.max||e.max<0))throw new TypeError("max must be a non-negative number");const t=this[i]=e.max||1/0,n=e.length||d;if(this[s]="function"!=typeof n?d:n,this[a]=e.stale||!1,e.maxAge&&"number"!=typeof e.maxAge)throw new TypeError("maxAge must be a number");this[l]=e.maxAge||0,this[u]=e.dispose,this[c]=e.noDisposeOnSet||!1,this[p]=e.updateAgeOnGet||!1,this.reset()}set max(e){if("number"!=typeof e||e<0)throw new TypeError("max must be a non-negative number");this[i]=e||1/0,v(this)}get max(){return this[i]}set allowStale(e){this[a]=!!e}get allowStale(){return this[a]}set maxAge(e){if("number"!=typeof e)throw new TypeError("maxAge must be a non-negative number");this[l]=e,v(this)}get maxAge(){return this[l]}set lengthCalculator(e){"function"!=typeof e&&(e=d),e!==this[s]&&(this[s]=e,this[o]=0,this[h].forEach(e=>{e.length=this[s](e.value,e.key),this[o]+=e.length})),v(this)}get lengthCalculator(){return this[s]}get length(){return this[o]}get itemCount(){return this[h].length}rforEach(e,t){t=t||this;for(let n=this[h].tail;null!==n;){const r=n.prev;w(this,e,n,t),n=r}}forEach(e,t){t=t||this;for(let n=this[h].head;null!==n;){const r=n.next;w(this,e,n,t),n=r}}keys(){return this[h].toArray().map(e=>e.key)}values(){return this[h].toArray().map(e=>e.value)}reset(){this[u]&&this[h]&&this[h].length&&this[h].forEach(e=>this[u](e.key,e.value)),this[f]=new Map,this[h]=new r,this[o]=0}dump(){return this[h].map(e=>!y(this,e)&&{k:e.key,v:e.value,e:e.now+(e.maxAge||0)}).toArray().filter(e=>e)}dumpLru(){return this[h]}set(e,t,n){if(n=n||this[l],n&&"number"!=typeof n)throw new TypeError("maxAge must be a number");const r=n?Date.now():0,a=this[s](t,e);if(this[f].has(e)){if(a>this[i])return b(this,this[f].get(e)),!1;const s=this[f].get(e),l=s.value;return this[u]&&(this[c]||this[u](e,l.value)),l.now=r,l.maxAge=n,l.value=t,this[o]+=a-l.length,l.length=a,this.get(e),v(this),!0}const p=new _(e,t,a,r,n);return p.length>this[i]?(this[u]&&this[u](e,t),!1):(this[o]+=p.length,this[h].unshift(p),this[f].set(e,this[h].head),v(this),!0)}has(e){if(!this[f].has(e))return!1;const t=this[f].get(e).value;return!y(this,t)}get(e){return g(this,e,!0)}peek(e){return g(this,e,!1)}pop(){const e=this[h].tail;return e?(b(this,e),e.value):null}del(e){b(this,this[f].get(e))}load(e){this.reset();const t=Date.now();for(let n=e.length-1;n>=0;n--){const r=e[n],i=r.e||0;if(0===i)this.set(r.k,r.v);else{const e=i-t;e>0&&this.set(r.k,r.v,e)}}}prune(){this[f].forEach((e,t)=>g(this,t,!1))}}const g=(e,t,n)=>{const r=e[f].get(t);if(r){const t=r.value;if(y(e,t)){if(b(e,r),!e[a])return}else n&&(e[p]&&(r.value.now=Date.now()),e[h].unshiftNode(r));return t.value}},y=(e,t)=>{if(!t||!t.maxAge&&!e[l])return!1;const n=Date.now()-t.now;return t.maxAge?n>t.maxAge:e[l]&&n>e[l]},v=e=>{if(e[o]>e[i])for(let t=e[h].tail;e[o]>e[i]&&null!==t;){const n=t.prev;b(e,t),t=n}},b=(e,t)=>{if(t){const n=t.value;e[u]&&e[u](n.key,n.value),e[o]-=n.length,e[f].delete(n.key),e[h].removeNode(t)}};class _{constructor(e,t,n,r,i){this.key=e,this.value=t,this.length=n,this.now=r,this.maxAge=i||0}}const w=(e,t,n,r)=>{let i=n.value;y(e,i)&&(b(e,n),e[a]||(i=void 0)),i&&t.call(r,i.value,i.key,e)};e.exports=m},function(e,t,n){"use strict";const r=n(91);function i(e,t,n){"function"==typeof e.pipe?r(e,(e,r)=>{if(e)return n(e);t(r,n)}):t(e,n)}e.exports=i},function(e,t,n){"use strict";const r=n(16).Transform,i=n(1350);class o extends r{constructor(e){const t=Object.assign(e||{},{objectMode:!0});super(t)}_transform(e,t,n){try{const t=i(e);if(this.push(t),!t.success)throw new Error(t.text)}catch(e){return n(e)}n()}}e.exports=o},function(e,t,n){"use strict";const r=n(53);e.exports=(e=>({totalIn:new r(e.TotalIn),totalOut:new r(e.TotalOut),rateIn:new r(e.RateIn),rateOut:new r(e.RateOut)}))},function(e,t,n){(function(t){e.exports=h;const r=n(550),i=n(1531),o=n(131),s=n(167),a=n(26),l=n(143),u=n(32),c=e=>null!==e&&"object"==typeof e&&"function"==typeof e.pipe;function h(e,n){if(e=Object.assign({maxRedirects:10},"string"==typeof e?{url:e}:e),n=a(n),e.url){const{hostname:t,port:n,protocol:r,auth:i,path:o}=u.parse(e.url);delete e.url,t||n||r||i?Object.assign(e,{hostname:t,port:n,protocol:r,auth:i,path:o}):e.path=o}const r={"accept-encoding":"gzip, deflate"};let f;e.headers&&Object.keys(e.headers).forEach(t=>r[t.toLowerCase()]=e.headers[t]),e.headers=r,e.body?f=e.json&&!c(e.body)?JSON.stringify(e.body):e.body:e.form&&(f="string"==typeof e.form?e.form:l.stringify(e.form),e.headers["content-type"]="application/x-www-form-urlencoded"),f&&(e.method||(e.method="POST"),c(f)||(e.headers["content-length"]=t.byteLength(f)),e.json&&!e.form&&(e.headers["content-type"]="application/json")),delete e.body,delete e.form,e.json&&(e.headers.accept="application/json"),e.method&&(e.method=e.method.toUpperCase());const p="https:"===e.protocol?s:o,d=p.request(e,t=>{if(t.statusCode>=300&&t.statusCode<400&&t.headers.location)return e.url=t.headers.location,delete e.headers.host,t.resume(),"POST"===e.method&&[301,302].includes(t.statusCode)&&(e.method="GET",delete e.headers["content-length"],delete e.headers["content-type"]),0==e.maxRedirects--?n(new Error("too many redirects")):h(e,n);const r="function"==typeof i&&"HEAD"!==e.method;n(null,r?i(t):t)});return d.on("timeout",()=>{d.abort(),n(new Error("Request timed out"))}),d.on("error",n),c(f)?f.on("error",n).pipe(d):d.end(f),d}h.concat=((e,t)=>h(e,(n,i)=>{if(n)return t(n);r(i,(n,r)=>{if(n)return t(n);if(e.json)try{r=JSON.parse(r.toString())}catch(n){return t(n,i,r)}t(null,i,r)})})),["get","post","put","patch","head","delete"].forEach(e=>{h[e]=((t,n)=>("string"==typeof t&&(t={url:t}),h(Object.assign({method:e.toUpperCase()},t),n)))})}).call(this,n(0).Buffer)},function(e,t,n){(function(t){e.exports=h;var r=n(4)("simple-peer"),i=n(453),o=n(3),s=n(101),a=n(1535),l=65536,u=5e3,c=5e3;function h(e){var t=this;if(!(t instanceof h))return new h(e);if(t._id=s(4).toString("hex").slice(0,7),t._debug("new peer %o",e),e=Object.assign({allowHalfOpen:!1},e),a.Duplex.call(t,e),t.channelName=e.initiator?e.channelName||s(20).toString("hex"):null,t.initiator=e.initiator||!1,t.channelConfig=e.channelConfig||h.channelConfig,t.config=Object.assign({},h.config,e.config),t.offerOptions=e.offerOptions||{},t.answerOptions=e.answerOptions||{},t.sdpTransform=e.sdpTransform||function(e){return e},t.streams=e.streams||(e.stream?[e.stream]:[]),t.trickle=void 0===e.trickle||e.trickle,t.allowHalfTrickle=void 0!==e.allowHalfTrickle&&e.allowHalfTrickle,t.iceCompleteTimeout=e.iceCompleteTimeout||u,t.destroyed=!1,t.connected=!1,t.remoteAddress=void 0,t.remoteFamily=void 0,t.remotePort=void 0,t.localAddress=void 0,t.localFamily=void 0,t.localPort=void 0,t._wrtc=e.wrtc&&"object"==typeof e.wrtc?e.wrtc:i(),!t._wrtc)throw"undefined"==typeof window?p("No WebRTC support: Specify `opts.wrtc` option in this environment","ERR_WEBRTC_SUPPORT"):p("No WebRTC support: Not a supported browser","ERR_WEBRTC_SUPPORT");t._pcReady=!1,t._channelReady=!1,t._iceComplete=!1,t._iceCompleteTimer=null,t._channel=null,t._pendingCandidates=[],t._isNegotiating=!t.initiator,t._batchedNegotiation=!1,t._queuedNegotiation=!1,t._sendersAwaitingStable=[],t._senderMap=new Map,t._firstStable=!0,t._closingInterval=null,t._remoteTracks=[],t._remoteStreams=[],t._chunk=null,t._cb=null,t._interval=null;try{t._pc=new t._wrtc.RTCPeerConnection(t.config)}catch(e){t.destroy(e)}t._isReactNativeWebrtc="number"==typeof t._pc._peerConnectionId,t._pc.oniceconnectionstatechange=function(){t._onIceStateChange()},t._pc.onicegatheringstatechange=function(){t._onIceStateChange()},t._pc.onsignalingstatechange=function(){t._onSignalingStateChange()},t._pc.onicecandidate=function(e){t._onIceCandidate(e)},t.initiator?t._setupData({channel:t._pc.createDataChannel(t.channelName,t.channelConfig)}):t._pc.ondatachannel=function(e){t._setupData(e)},t.streams&&t.streams.forEach(function(e){t.addStream(e)}),t._pc.ontrack=function(e){t._onTrack(e)},t.initiator&&t._needsNegotiation(),t._onFinishBound=function(){t._onFinish()},t.once("finish",t._onFinishBound)}function f(e){return e.replace(/a=ice-options:trickle\s\n/g,"")}function p(e,t){var n=new Error(e);return n.code=t,n}o(h,a.Duplex),h.WEBRTC_SUPPORT=!!i(),h.config={iceServers:[{urls:"stun:stun.l.google.com:19302"},{urls:"stun:global.stun.twilio.com:3478?transport=udp"}],sdpSemantics:"unified-plan"},h.channelConfig={},Object.defineProperty(h.prototype,"bufferSize",{get:function(){var e=this;return this._channel&&this._channel.bufferedAmount||0}}),h.prototype.address=function(){var e=this;return{port:this.localPort,family:this.localFamily,address:this.localAddress}},h.prototype.signal=function(e){var t=this;if(t.destroyed)throw p("cannot signal after peer is destroyed","ERR_SIGNALING");if("string"==typeof e)try{e=JSON.parse(e)}catch(t){e={}}t._debug("signal()"),e.renegotiate&&t.initiator&&(t._debug("got request to renegotiate"),t._needsNegotiation()),e.transceiverRequest&&t.initiator&&(t._debug("got request for transceiver"),t.addTransceiver(e.transceiverRequest.kind,e.transceiverRequest.init)),e.candidate&&(t._pc.localDescription&&t._pc.localDescription.type&&t._pc.remoteDescription&&t._pc.remoteDescription.type?t._addIceCandidate(e.candidate):t._pendingCandidates.push(e.candidate)),e.sdp&&t._pc.setRemoteDescription(new t._wrtc.RTCSessionDescription(e)).then(function(){t.destroyed||(t._pendingCandidates.forEach(function(e){t._addIceCandidate(e)}),t._pendingCandidates=[],"offer"===t._pc.remoteDescription.type&&t._createAnswer())}).catch(function(e){t.destroy(p(e,"ERR_SET_REMOTE_DESCRIPTION"))}),e.sdp||e.candidate||e.renegotiate||e.transceiverRequest||t.destroy(p("signal() called with invalid signal data","ERR_SIGNALING"))},h.prototype._addIceCandidate=function(e){var t=this;t._pc.addIceCandidate(new t._wrtc.RTCIceCandidate(e)).catch(function(e){if("closed"!==t._pc.signalingState&&"Failed to set ICE candidate; RTCPeerConnection is closed."===e.message)return t._debug("ignoring incorrect wrtc error");t.destroy(p(e,"ERR_ADD_ICE_CANDIDATE"))})},h.prototype.send=function(e){var t=this;this._channel.send(e)},h.prototype.addTransceiver=function(e,t){var n=this;if(this._debug("addTransceiver()"),this.initiator)try{this._pc.addTransceiver(e,t),this._needsNegotiation()}catch(e){this.destroy(e)}else this.emit("signal",{transceiverRequest:{kind:e,init:t}})},h.prototype.addStream=function(e){var t=this;t._debug("addStream()"),e.getTracks().forEach(function(n){t.addTrack(n,e)})},h.prototype.addTrack=function(e,t){var n=this;this._debug("addTrack()");var r=this._senderMap.get(e)||new Map,i=r.get(t);i?i.removed?this.destroy(p("Track has been removed. You should enable/disable tracks that you want to re-add."),"ERR_SENDER_REMOVED"):this.destroy(p("Track has already been added to that stream."),"ERR_SENDER_ALREADY_ADDED"):(i=this._pc.addTrack(e,t),r.set(t,i),this._senderMap.set(e,r),this._needsNegotiation())},h.prototype.replaceTrack=function(e,t,n){var r=this;this._debug("replaceTrack()");var i=this._senderMap.get(e),o=i?i.get(n):null;o||this.destroy(p("Cannot replace track that was never added."),"ERR_TRACK_NOT_ADDED"),t&&this._senderMap.set(t,i),null!=o.replaceTrack?o.replaceTrack(t):this.destroy(p("replaceTrack is not supported in this browser","ERR_UNSUPPORTED_REPLACETRACK"))},h.prototype.removeTrack=function(e,t){var n=this;this._debug("removeSender()");var r=this._senderMap.get(e),i=r?r.get(t):null;i||this.destroy(p("Cannot remove track that was never added.","ERR_TRACK_NOT_ADDED"));try{i.removed=!0,this._pc.removeTrack(i)}catch(e){"NS_ERROR_UNEXPECTED"===e.name?this._sendersAwaitingStable.push(i):this.destroy(e)}this._needsNegotiation()},h.prototype.removeStream=function(e){var t=this;t._debug("removeSenders()"),e.getTracks().forEach(function(n){t.removeTrack(n,e)})},h.prototype._needsNegotiation=function(){var e=this;e._debug("_needsNegotiation"),e._batchedNegotiation||(e._batchedNegotiation=!0,setTimeout(function(){e._batchedNegotiation=!1,e._debug("starting batched negotiation"),e.negotiate()},0))},h.prototype.negotiate=function(){var e=this;e.initiator?e._isNegotiating?(e._queuedNegotiation=!0,e._debug("already negotiating, queueing")):(e._debug("start negotiation"),setTimeout(()=>{e._createOffer()},0)):e._isNegotiating||(e._debug("requesting negotiation from initiator"),e.emit("signal",{renegotiate:!0})),e._isNegotiating=!0},h.prototype.destroy=function(e){var t=this;this._destroy(e,function(){})},h.prototype._destroy=function(e,t){var n=this;if(!this.destroyed){if(this._debug("destroy (error: %s)",e&&(e.message||e)),this.readable=this.writable=!1,this._readableState.ended||this.push(null),this._writableState.finished||this.end(),this.destroyed=!0,this.connected=!1,this._pcReady=!1,this._channelReady=!1,this._remoteTracks=null,this._remoteStreams=null,this._senderMap=null,clearInterval(this._closingInterval),this._closingInterval=null,clearInterval(this._interval),this._interval=null,this._chunk=null,this._cb=null,this._onFinishBound&&this.removeListener("finish",this._onFinishBound),this._onFinishBound=null,this._channel){try{this._channel.close()}catch(e){}this._channel.onmessage=null,this._channel.onopen=null,this._channel.onclose=null,this._channel.onerror=null}if(this._pc){try{this._pc.close()}catch(e){}this._pc.oniceconnectionstatechange=null,this._pc.onicegatheringstatechange=null,this._pc.onsignalingstatechange=null,this._pc.onicecandidate=null,this._pc.ontrack=null,this._pc.ondatachannel=null}this._pc=null,this._channel=null,e&&this.emit("error",e),this.emit("close"),t()}},h.prototype._setupData=function(e){var t=this;if(!e.channel)return t.destroy(p("Data channel event is missing `channel` property","ERR_DATA_CHANNEL"));t._channel=e.channel,t._channel.binaryType="arraybuffer","number"==typeof t._channel.bufferedAmountLowThreshold&&(t._channel.bufferedAmountLowThreshold=65536),t.channelName=t._channel.label,t._channel.onmessage=function(e){t._onChannelMessage(e)},t._channel.onbufferedamountlow=function(){t._onChannelBufferedAmountLow()},t._channel.onopen=function(){t._onChannelOpen()},t._channel.onclose=function(){t._onChannelClose()},t._channel.onerror=function(e){t.destroy(p(e,"ERR_DATA_CHANNEL"))};var n=!1;t._closingInterval=setInterval(function(){t._channel&&"closing"===t._channel.readyState?(n&&t._onChannelClose(),n=!0):n=!1},5e3)},h.prototype._read=function(){},h.prototype._write=function(e,t,n){var r=this;if(this.destroyed)return n(p("cannot write after peer is destroyed","ERR_DATA_CHANNEL"));if(this.connected){try{this.send(e)}catch(e){return this.destroy(p(e,"ERR_DATA_CHANNEL"))}this._channel.bufferedAmount>65536?(this._debug("start backpressure: bufferedAmount %d",this._channel.bufferedAmount),this._cb=n):n(null)}else this._debug("write before connect"),this._chunk=e,this._cb=n},h.prototype._onFinish=function(){var e=this;function t(){setTimeout(function(){e.destroy()},1e3)}e.destroyed||(e.connected?t():e.once("connect",t))},h.prototype._startIceCompleteTimeout=function(){var e=this;e.destroyed||e._iceCompleteTimer||(e._debug("started iceComplete timeout"),e._iceCompleteTimer=setTimeout(function(){e._iceComplete||(e._iceComplete=!0,e._debug("iceComplete timeout completed"),e.emit("iceTimeout"),e.emit("_iceComplete"))},e.iceCompleteTimeout))},h.prototype._createOffer=function(){var e=this;e.destroyed||e._pc.createOffer(e.offerOptions).then(function(t){function n(){e._debug("createOffer success"),e.destroyed||(e.trickle||e._iceComplete?i():e.once("_iceComplete",i))}function r(t){e.destroy(p(t,"ERR_SET_LOCAL_DESCRIPTION"))}function i(){if(!e.destroyed){var n=e._pc.localDescription||t;e._debug("signal"),e.emit("signal",{type:n.type,sdp:n.sdp})}}e.destroyed||(e.trickle||e.allowHalfTrickle||(t.sdp=f(t.sdp)),t.sdp=e.sdpTransform(t.sdp),e._pc.setLocalDescription(t).then(n).catch(r))}).catch(function(t){e.destroy(p(t,"ERR_CREATE_OFFER"))})},h.prototype._requestMissingTransceivers=function(){var e=this;e._pc.getTransceivers&&e._pc.getTransceivers().forEach(t=>{!t.mid&&t.sender.track&&e.addTransceiver(t.sender.track.kind)})},h.prototype._createAnswer=function(){var e=this;e.destroyed||e._pc.createAnswer(e.answerOptions).then(function(t){function n(){e.destroyed||(e.trickle||e._iceComplete?i():e.once("_iceComplete",i))}function r(t){e.destroy(p(t,"ERR_SET_LOCAL_DESCRIPTION"))}function i(){if(!e.destroyed){var n=e._pc.localDescription||t;e._debug("signal"),e.emit("signal",{type:n.type,sdp:n.sdp}),e.initiator||e._requestMissingTransceivers()}}e.destroyed||(e.trickle||e.allowHalfTrickle||(t.sdp=f(t.sdp)),t.sdp=e.sdpTransform(t.sdp),e._pc.setLocalDescription(t).then(n).catch(r))}).catch(function(t){e.destroy(p(t,"ERR_CREATE_ANSWER"))})},h.prototype._onIceStateChange=function(){var e=this;if(!this.destroyed){var t=this._pc.iceConnectionState,n=this._pc.iceGatheringState;this._debug("iceStateChange (connection: %s) (gathering: %s)",t,n),this.emit("iceStateChange",t,n),"connected"!==t&&"completed"!==t||(this._pcReady=!0,this._maybeReady()),"failed"===t&&this.destroy(p("Ice connection failed.","ERR_ICE_CONNECTION_FAILURE")),"closed"===t&&this.destroy(p("Ice connection closed.","ERR_ICE_CONNECTION_CLOSED"))}},h.prototype.getStats=function(e){var t=this;function n(e){return"[object Array]"===Object.prototype.toString.call(e.values)&&e.values.forEach(function(t){Object.assign(e,t)}),e}0===t._pc.getStats.length?t._pc.getStats().then(function(t){var r=[];t.forEach(function(e){r.push(n(e))}),e(null,r)},function(t){e(t)}):t._isReactNativeWebrtc?t._pc.getStats(null,function(t){var r=[];t.forEach(function(e){r.push(n(e))}),e(null,r)},function(t){e(t)}):t._pc.getStats.length>0?t._pc.getStats(function(r){if(!t.destroyed){var i=[];r.result().forEach(function(e){var t={};e.names().forEach(function(n){t[n]=e.stat(n)}),t.id=e.id,t.type=e.type,t.timestamp=e.timestamp,i.push(n(t))}),e(null,i)}},function(t){e(t)}):e(null,[])},h.prototype._maybeReady=function(){var e=this;function t(){e.destroyed||e.getStats(function(n,r){if(!e.destroyed){n&&(r=[]);var i={},o={},s={},a=!1;if(r.forEach(function(e){"remotecandidate"!==e.type&&"remote-candidate"!==e.type||(i[e.id]=e),"localcandidate"!==e.type&&"local-candidate"!==e.type||(o[e.id]=e),"candidatepair"!==e.type&&"candidate-pair"!==e.type||(s[e.id]=e)}),r.forEach(function(e){"transport"===e.type&&e.selectedCandidatePairId&&u(s[e.selectedCandidatePairId]),("googCandidatePair"===e.type&&"true"===e.googActiveConnection||("candidatepair"===e.type||"candidate-pair"===e.type)&&e.selected)&&u(e)}),a||Object.keys(s).length&&!Object.keys(o).length){if(e._connecting=!1,e.connected=!0,e._chunk){try{e.send(e._chunk)}catch(n){return e.destroy(p(n,"ERR_DATA_CHANNEL"))}e._chunk=null,e._debug('sent chunk from "write before connect"');var l=e._cb;e._cb=null,l(null)}"number"!=typeof e._channel.bufferedAmountLowThreshold&&(e._interval=setInterval(function(){e._onInterval()},150),e._interval.unref&&e._interval.unref()),e._debug("connect"),e.emit("connect")}else setTimeout(t,100)}function u(t){a=!0;var n=o[t.localCandidateId];n&&(n.ip||n.address)?(e.localAddress=n.ip||n.address,e.localPort=Number(n.port)):n&&n.ipAddress?(e.localAddress=n.ipAddress,e.localPort=Number(n.portNumber)):"string"==typeof t.googLocalAddress&&(n=t.googLocalAddress.split(":"),e.localAddress=n[0],e.localPort=Number(n[1])),e.localAddress&&(e.localFamily=e.localAddress.includes(":")?"IPv6":"IPv4");var r=i[t.remoteCandidateId];r&&(r.ip||r.address)?(e.remoteAddress=r.ip||r.address,e.remotePort=Number(r.port)):r&&r.ipAddress?(e.remoteAddress=r.ipAddress,e.remotePort=Number(r.portNumber)):"string"==typeof t.googRemoteAddress&&(r=t.googRemoteAddress.split(":"),e.remoteAddress=r[0],e.remotePort=Number(r[1])),e.remoteAddress&&(e.remoteFamily=e.remoteAddress.includes(":")?"IPv6":"IPv4"),e._debug("connect local: %s:%s remote: %s:%s",e.localAddress,e.localPort,e.remoteAddress,e.remotePort)}})}e._debug("maybeReady pc %s channel %s",e._pcReady,e._channelReady),!e.connected&&!e._connecting&&e._pcReady&&e._channelReady&&(e._connecting=!0,t())},h.prototype._onInterval=function(){var e=this;!this._cb||!this._channel||this._channel.bufferedAmount>65536||this._onChannelBufferedAmountLow()},h.prototype._onSignalingStateChange=function(){var e=this;e.destroyed||("stable"!==e._pc.signalingState||e._firstStable||(e._isNegotiating=!1,e._debug("flushing sender queue",e._sendersAwaitingStable),e._sendersAwaitingStable.forEach(function(t){e._pc.removeTrack(t),e._queuedNegotiation=!0}),e._sendersAwaitingStable=[],e._queuedNegotiation&&(e._debug("flushing negotiation queue"),e._queuedNegotiation=!1,e._needsNegotiation()),e._debug("negotiate"),e.emit("negotiate")),e._firstStable=!1,e._debug("signalingStateChange %s",e._pc.signalingState),e.emit("signalingStateChange",e._pc.signalingState))},h.prototype._onIceCandidate=function(e){var t=this;this.destroyed||(e.candidate&&this.trickle?this.emit("signal",{candidate:{candidate:e.candidate.candidate,sdpMLineIndex:e.candidate.sdpMLineIndex,sdpMid:e.candidate.sdpMid}}):e.candidate||this._iceComplete||(this._iceComplete=!0,this.emit("_iceComplete")),e.candidate&&this._startIceCompleteTimeout())},h.prototype._onChannelMessage=function(e){var n=this;if(!this.destroyed){var r=e.data;r instanceof ArrayBuffer&&(r=t.from(r)),this.push(r)}},h.prototype._onChannelBufferedAmountLow=function(){var e=this;if(!this.destroyed&&this._cb){this._debug("ending backpressure: bufferedAmount %d",this._channel.bufferedAmount);var t=this._cb;this._cb=null,t(null)}},h.prototype._onChannelOpen=function(){var e=this;this.connected||this.destroyed||(this._debug("on channel open"),this._channelReady=!0,this._maybeReady())},h.prototype._onChannelClose=function(){var e=this;this.destroyed||(this._debug("on channel close"),this.destroy())},h.prototype._onTrack=function(e){var t=this;t.destroyed||e.streams.forEach(function(n){t._debug("on track"),t.emit("track",e.track,n),t._remoteTracks.push({track:e.track,stream:n}),t._remoteStreams.some(function(e){return e.id===n.id})||(t._remoteStreams.push(n),setTimeout(function(){t.emit("stream",n)},0))})},h.prototype._debug=function(){var e=this,t=[].slice.call(arguments);t[0]="["+this._id+"] "+t[0],r.apply(null,t)}}).call(this,n(0).Buffer)},function(e,t){var n=1,r=65535,i=4,o,s=function(){n=n+1&65535};e.exports=function(e){o||(o=setInterval(s,250),o.unref&&o.unref());var t=4*(e||5),r=[0],i=1,a=n-1&65535;return function(e){var o=n-a&65535;for(o>t&&(o=t),a=n;o--;)i===t&&(i=0),r[i]=r[0===i?t-1:i-1],i++;e&&(r[i-1]+=e);var s=r[i-1],l=r.length>>=0;var o=e.byteLength-n;if(o<0)throw new RangeError("'offset' is out of bounds");if(void 0===i)i=o;else if(i>>>=0,i>o)throw new RangeError("'length' is out of bounds");return r?t.from(e.slice(n,n+i)):new t(new Uint8Array(e.slice(n,n+i)))}function s(e,n){if("string"==typeof n&&""!==n||(n="utf8"),!t.isEncoding(n))throw new TypeError('"encoding" must be a valid string encoding');return r?t.from(e,n):new t(e,n)}function a(e,n,a){if("number"==typeof e)throw new TypeError('"value" argument must not be a number');return i(e)?o(e,n,a):"string"==typeof e?s(e,n):r?t.from(e):new t(e)}e.exports=a}).call(this,n(0).Buffer)},function(e){e.exports={name:"webtorrent",description:"Streaming torrent client",version:"0.105.1",author:{name:"WebTorrent, LLC",email:"feross@webtorrent.io",url:"https://webtorrent.io"},browser:{"./lib/server.js":!1,"./lib/tcp-pool.js":!1,"bittorrent-dht/client":!1,"fs-chunk-store":"memory-chunk-store","load-ip-set":!1,net:!1,os:!1,ut_pex:!1},browserify:{transform:["package-json-versionify"]},bugs:{url:"https://github.com/webtorrent/webtorrent/issues"},dependencies:{"addr-to-ip-port":"^1.4.2",bitfield:"^2.0.0","bittorrent-dht":"^9.0.0","bittorrent-protocol":"^3.0.0","chunk-store-stream":"^4.0.0","create-torrent":"^4.0.0",debug:"^4.1.0","end-of-stream":"^1.1.0","fs-chunk-store":"^1.6.2","immediate-chunk-store":"^2.0.0","load-ip-set":"^2.1.0","memory-chunk-store":"^1.2.0",mime:"^2.4.0",multistream:"^3.0.0","package-json-versionify":"^1.0.2","parse-numeric-range":"^0.0.2","parse-torrent":"^7.0.0",pump:"^3.0.0","random-iterate":"^1.0.1",randombytes:"^2.0.3","range-parser":"^1.2.0","readable-stream":"^3.0.6","render-media":"^3.0.0","run-parallel":"^1.1.6","run-parallel-limit":"^1.0.3","safe-buffer":"^5.0.1","simple-concat":"^1.0.0","simple-get":"^3.0.1","simple-peer":"^9.0.0","simple-sha1":"^2.0.8",speedometer:"^1.0.0","stream-to-blob":"^1.0.0","stream-to-blob-url":"^2.1.0","stream-with-known-length-to-buffer":"^1.0.0","torrent-discovery":"^9.1.1","torrent-piece":"^2.0.0",uniq:"^1.0.1","unordered-array-remove":"^1.0.2",ut_metadata:"^3.3.0",ut_pex:"^1.1.1"},devDependencies:{airtap:"^2.0.3","babel-minify":"^0.5.0","bittorrent-tracker":"^9.4.0",brfs:"^2.0.0",browserify:"^16.2.3","cross-spawn":"^6.0.3",electron:"^5.0.4",finalhandler:"^1.0.0","network-address":"^1.1.0","run-series":"^1.1.4","serve-static":"^1.11.1",standard:"*",tape:"^4.6.0","webtorrent-fixtures":"^1.5.0"},engines:{node:">=8"},homepage:"https://webtorrent.io",keywords:["bittorrent","bittorrent client","download","mad science","p2p","peer-to-peer","peers","streaming","swarm","torrent","web torrent","webrtc","webrtc data","webtorrent"],license:"MIT",main:"index.js",repository:{type:"git",url:"git://github.com/webtorrent/webtorrent.git"},scripts:{build:"browserify -s WebTorrent -e ./ | minify > webtorrent.min.js","build-debug":"browserify -s WebTorrent -e ./ > webtorrent.debug.js",size:"npm run build && cat webtorrent.min.js | gzip | wc -c",test:"standard && npm run test-node && npm run test-browser","test-browser":"airtap -- test/*.js test/browser/*.js","test-browser-local":"airtap --local -- test/*.js test/browser/*.js","test-node":"tape test/*.js test/node/*.js","update-authors":"./scripts/update-authors.sh"}}},function(e,t,n){"use strict";var r=Object.prototype.hasOwnProperty,i=Object.prototype.toString,o=Object.defineProperty,s=Object.getOwnPropertyDescriptor,a=function e(t){return"function"==typeof Array.isArray?Array.isArray(t):"[object Array]"===i.call(t)},l=function e(t){if(!t||"[object Object]"!==i.call(t))return!1;var n=r.call(t,"constructor"),o=t.constructor&&t.constructor.prototype&&r.call(t.constructor.prototype,"isPrototypeOf"),s;if(t.constructor&&!n&&!o)return!1;for(s in t);return void 0===s||r.call(t,s)},u=function e(t,n){o&&"__proto__"===n.name?o(t,n.name,{enumerable:!0,configurable:!0,value:n.newValue,writable:!0}):t[n.name]=n.newValue},c=function e(t,n){if("__proto__"===n){if(!r.call(t,n))return;if(s)return s(t,n).value}return t[n]};e.exports=function e(){var t,n,r,i,o,s,h=arguments[0],f=1,p=arguments.length,d=!1;for("boolean"==typeof h&&(d=h,h=arguments[1]||{},f=2),(null==h||"object"!=typeof h&&"function"!=typeof h)&&(h={});f32;)t=t.slice(1);var n=this._priv;r.strictEqual(t.length,32),r.strictEqual(n.length,32);var i=l.box.before(new Uint8Array(t),new Uint8Array(n));return o.from(i)}throw new Error("Invalid algorithm: "+this._algo)},m.prototype.generateKey=function(){var e=[],t,n;if("dsa"===this._algo)return this._dh.generateKeys(),e.push({name:"p",data:this._p.data}),e.push({name:"q",data:this._key.part.q.data}),e.push({name:"g",data:this._g.data}),e.push({name:"y",data:this._dh.getPublicKey()}),e.push({name:"x",data:this._dh.getPrivateKey()}),this._key=new c({type:"dsa",parts:e}),this._isPriv=!0,this._key;if("ecdsa"===this._algo){if(h)return this._dh.generateKeys(),e.push({name:"curve",data:o.from(this._curve)}),e.push({name:"Q",data:this._dh.getPublicKey()}),e.push({name:"d",data:this._dh.getPrivateKey()}),this._key=new c({type:"ecdsa",curve:this._curve,parts:e}),this._isPriv=!0,this._key;var s=this._ecParams.getN(),a=new d(i.randomBytes(s.bitLength())),u=s.subtract(d.ONE);return t=a.mod(u).add(d.ONE),n=this._ecParams.getG().multiply(t),t=o.from(t.toByteArray()),n=o.from(this._ecParams.getCurve().encodePointHex(n),"hex"),this._priv=new v(this._ecParams,t),e.push({name:"curve",data:o.from(this._curve)}),e.push({name:"Q",data:n}),e.push({name:"d",data:t}),this._key=new c({type:"ecdsa",curve:this._curve,parts:e}),this._isPriv=!0,this._key}if("curve25519"===this._algo){var f=l.box.keyPair();return t=o.from(f.secretKey),n=o.from(f.publicKey),t=o.concat([t,n]),r.strictEqual(t.length,64),r.strictEqual(n.length,32),e.push({name:"A",data:n}),e.push({name:"k",data:t}),this._key=new c({type:"curve25519",parts:e}),this._isPriv=!0,this._key}throw new Error("Invalid algorithm: "+this._algo)},m.prototype.generateKeys=m.prototype.generateKey,g.prototype.getCurve=function(){return this.curve},g.prototype.getG=function(){return this.g},g.prototype.getN=function(){return this.n},g.prototype.getH=function(){return this.h},v.prototype.deriveSharedSecret=function(e){r.ok(e instanceof y);var t=e._pub.multiply(this._priv);return o.from(t.getX().toBigInteger().toByteArray())}},function(e,t,n){e.exports={read:p,readPkcs1:g,write:d,writePkcs1:S};var r=n(25),i=n(84),o=n(29).Buffer,s=n(48),a=n(42),l=n(41),u=n(46),c=n(92),h=n(174),f=h.readECDSACurve;function p(e,t){return c.read(e,t,"pkcs1")}function d(e,t){return c.write(e,t,"pkcs1")}function m(e,t){return r.strictEqual(e.peek(),i.Ber.Integer,t+" is not an Integer"),a.mpNormalize(e.readString(i.Ber.Integer,!0))}function g(e,t,n){switch(e){case"RSA":if("public"===t)return y(n);if("private"===t)return v(n);throw new Error("Unknown key type: "+t);case"DSA":if("public"===t)return w(n);if("private"===t)return b(n);throw new Error("Unknown key type: "+t);case"EC":case"ECDSA":if("private"===t)return E(n);if("public"===t)return k(n);throw new Error("Unknown key type: "+t);case"EDDSA":case"EdDSA":if("private"===t)return _(n);throw new Error(t+" keys not supported with EdDSA");default:throw new Error("Unknown key algo: "+e)}}function y(e){var t=m(e,"modulus"),n=m(e,"exponent"),r={type:"rsa",parts:[{name:"e",data:n},{name:"n",data:t}]};return new l(r)}function v(e){var t=m(e,"version");r.strictEqual(t[0],0);var n=m(e,"modulus"),i=m(e,"public exponent"),o=m(e,"private exponent"),s=m(e,"prime1"),a=m(e,"prime2"),l=m(e,"exponent1"),c=m(e,"exponent2"),h=m(e,"iqmp"),f={type:"rsa",parts:[{name:"n",data:n},{name:"e",data:i},{name:"d",data:o},{name:"iqmp",data:h},{name:"p",data:s},{name:"q",data:a},{name:"dmodp",data:l},{name:"dmodq",data:c}]};return new u(f)}function b(e){var t=m(e,"version");r.strictEqual(t.readUInt8(0),0);var n=m(e,"p"),i=m(e,"q"),o=m(e,"g"),s=m(e,"y"),a=m(e,"x"),l={type:"dsa",parts:[{name:"p",data:n},{name:"q",data:i},{name:"g",data:o},{name:"y",data:s},{name:"x",data:a}]};return new u(l)}function _(e){var t=m(e,"version");r.strictEqual(t.readUInt8(0),1);var n=e.readString(i.Ber.OctetString,!0);e.readSequence(160);var o=e.readOID();r.strictEqual(o,"1.3.101.112","the ed25519 curve identifier"),e.readSequence(161);var s=a.readBitString(e),l={type:"ed25519",parts:[{name:"A",data:a.zeroPadToLength(s,32)},{name:"k",data:n}]};return new u(l)}function w(e){var t=m(e,"y"),n=m(e,"p"),r=m(e,"q"),i=m(e,"g"),o={type:"dsa",parts:[{name:"y",data:t},{name:"p",data:n},{name:"q",data:r},{name:"g",data:i}]};return new l(o)}function k(e){e.readSequence();var t=e.readOID();r.strictEqual(t,"1.2.840.10045.2.1","must be ecPublicKey");for(var n=e.readOID(),u,c=Object.keys(s.curves),h=0;h>1,c=-7,h=n?i-1:0,f=n?-1:1,p=e[t+h];for(h+=f,o=p&(1<<-c)-1,p>>=-c,c+=a;c>0;o=256*o+e[t+h],h+=f,c-=8);for(s=o&(1<<-c)-1,o>>=-c,c+=r;c>0;s=256*s+e[t+h],h+=f,c-=8);if(0===o)o=1-u;else{if(o===l)return s?NaN:1/0*(p?-1:1);s+=Math.pow(2,r),o-=u}return(p?-1:1)*s*Math.pow(2,o-r)},t.write=function(e,t,n,r,i,o){var s,a,l,u=8*o-i-1,c=(1<>1,f=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,p=r?0:o-1,d=r?1:-1,m=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(a=isNaN(t)?1:0,s=c):(s=Math.floor(Math.log(t)/Math.LN2),t*(l=Math.pow(2,-s))<1&&(s--,l*=2),t+=s+h>=1?f/l:f*Math.pow(2,1-h),t*l>=2&&(s++,l/=2),s+h>=c?(a=0,s=c):s+h>=1?(a=(t*l-1)*Math.pow(2,i),s+=h):(a=t*Math.pow(2,h-1)*Math.pow(2,i),s=0));i>=8;e[n+p]=255&a,p+=d,a/=256,i-=8);for(s=s<0;e[n+p]=255&s,p+=d,s/=256,u-=8);e[n+p-d]|=128*m}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){return function(){var t=(0,i.default)(arguments),n=t.pop();e.call(this,t,n)}};var r=n(86),i=o(r);function o(e){return e&&e.__esModule?e:{default:e}}e.exports=t.default},function(e,t,n){(function(t){var n="object"==typeof t&&t&&t.Object===Object&&t;e.exports=n}).call(this,n(7))},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=l;var r=n(242),i=a(r),o=n(37),s=a(o);function a(e){return e&&e.__esModule?e:{default:e}}function l(e,t,n,r){(0,i.default)(t)(e,(0,s.default)(n),r)}e.exports=t.default},function(e,t,n){var r=n(647),i=n(87),o=Object.prototype,s=o.hasOwnProperty,a=o.propertyIsEnumerable,l=r(function(){return arguments}())?r:function(e){return i(e)&&s.call(e,"callee")&&!a.call(e,"callee")};e.exports=l},function(e,t,n){(function(e){var r=n(79),i=n(648),o=t&&!t.nodeType&&t,s=o&&"object"==typeof e&&e&&!e.nodeType&&e,a=s&&s.exports===o,l=a?r.Buffer:void 0,u=l?l.isBuffer:void 0,c=u||i;e.exports=c}).call(this,n(85)(e))},function(e,t){var n=9007199254740991,r=/^(?:0|[1-9]\d*)$/;function i(e,t){var i=typeof e;return t=null==t?n:t,!!t&&("number"==i||"symbol"!=i&&r.test(e))&&e>-1&&e%1==0&&e0)if("string"==typeof t||o.objectMode||Object.getPrototypeOf(t)===l.prototype||(t=c(t)),r)o.endEmitted?e.emit("error",new k):B(e,o,t,!0);else if(o.ended)e.emit("error",new _);else{if(o.destroyed)return!1;o.reading=!1,o.decoder&&!n?(t=o.decoder.write(t),o.objectMode||0!==t.length?B(e,o,t,!1):U(e,o)):B(e,o,t,!1)}else r||(o.reading=!1,U(e,o));return!o.ended&&(o.length=P?e=P:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}function D(e,t){return e<=0||0===t.length&&t.ended?0:t.objectMode?1:e!=e?t.flowing&&t.length?t.buffer.head.data.length:t.length:(e>t.highWaterMark&&(t.highWaterMark=N(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}function F(e,t){if(!t.ended){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?M(e):(t.needReadable=!1,t.emittedReadable||(t.emittedReadable=!0,L(e)))}}function M(e){var t=e._readableState;t.needReadable=!1,t.emittedReadable||(p("emitReadable",t.flowing),t.emittedReadable=!0,r.nextTick(L,e))}function L(e){var t=e._readableState;p("emitReadable_",t.destroyed,t.length,t.ended),t.destroyed||!t.length&&!t.ended||e.emit("readable"),t.needReadable=!t.flowing&&!t.ended&&t.length<=t.highWaterMark,W(e)}function U(e,t){t.readingMore||(t.readingMore=!0,r.nextTick(q,e,t))}function q(e,t){for(;!t.reading&&!t.ended&&(t.length0,t.resumeScheduled&&!t.paused?t.flowing=!0:e.listenerCount("data")>0&&e.resume()}function H(e){p("readable nexttick read 0"),e.read(0)}function V(e,t){t.resumeScheduled||(t.resumeScheduled=!0,r.nextTick($,e,t))}function $(e,t){p("resume",t.reading),t.reading||e.read(0),t.resumeScheduled=!1,e.emit("resume"),W(e),t.flowing&&!t.reading&&e.read(0)}function W(e){var t=e._readableState;for(p("flow",t.flowing);t.flowing&&null!==e.read(););}function G(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 Y(e){var t=e._readableState;p("endReadable",t.endEmitted),t.endEmitted||(t.ended=!0,r.nextTick(Z,t,e))}function Z(e,t){p("endReadableNT",e.endEmitted,e.length),e.endEmitted||0!==e.length||(e.endEmitted=!0,t.readable=!1,t.emit("end"))}function J(e,t){for(var n=0,r=e.length;n=t.highWaterMark:t.length>0)||t.ended))return p("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?Y(this):M(this),null;if(e=D(e,t),0===e&&t.ended)return 0===t.length&&Y(this),null;var r=t.needReadable,i;return p("need readable",r),(0===t.length||t.length-e0?G(e,t):null,null===i?(t.needReadable=!0,e=0):(t.length-=e,t.awaitDrain=0),0===t.length&&(t.ended||(t.needReadable=!0),n!==e&&t.ended&&Y(this)),null!==i&&this.emit("data",i),i},j.prototype._read=function(e){this.emit("error",new w("_read()"))},j.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,p("pipe count=%d opts=%j",i.pipesCount,t);var o=(!t||!1!==t.end)&&e!==r.stdout&&e!==r.stderr,a=o?u:v;function l(e,t){p("onunpipe"),e===n&&t&&!1===t.hasUnpiped&&(t.hasUnpiped=!0,f())}function u(){p("onend"),e.end()}i.endEmitted?r.nextTick(a):n.once("end",a),e.on("unpipe",l);var c=z(n);e.on("drain",c);var h=!1;function f(){p("cleanup"),e.removeListener("close",g),e.removeListener("finish",y),e.removeListener("drain",c),e.removeListener("error",m),e.removeListener("unpipe",l),n.removeListener("end",u),n.removeListener("end",v),n.removeListener("data",d),h=!0,!i.awaitDrain||e._writableState&&!e._writableState.needDrain||c()}function d(t){p("ondata");var r=e.write(t);p("dest.write",r),!1===r&&((1===i.pipesCount&&i.pipes===e||i.pipesCount>1&&-1!==J(i.pipes,e))&&!h&&(p("false write response, pause",i.awaitDrain),i.awaitDrain++),n.pause())}function m(t){p("onerror",t),v(),e.removeListener("error",m),0===s(e,"error")&&e.emit("error",t)}function g(){e.removeListener("finish",y),v()}function y(){p("onfinish"),e.removeListener("close",g),v()}function v(){p("unpipe"),n.unpipe(e)}return n.on("data",d),T(e,"error",m),e.once("close",g),e.once("finish",y),e.emit("pipe",n),i.flowing||(p("pipe resume"),n.resume()),e},j.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?this:(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 o=0;o0,!1!==i.flowing&&this.resume()):"readable"===e&&(i.endEmitted||i.readableListening||(i.readableListening=i.needReadable=!0,i.flowing=!1,i.emittedReadable=!1,p("on readable",i.length,i.reading),i.length?M(this):i.reading||r.nextTick(H,this))),n},j.prototype.addListener=j.prototype.on,j.prototype.removeListener=function(e,t){var n=a.prototype.removeListener.call(this,e,t);return"readable"===e&&r.nextTick(K,this),n},j.prototype.removeAllListeners=function(e){var t=a.prototype.removeAllListeners.apply(this,arguments);return"readable"!==e&&void 0!==e||r.nextTick(K,this),t},j.prototype.resume=function(){var e=this._readableState;return e.flowing||(p("resume"),e.flowing=!e.readableListening,V(this,e)),e.paused=!1,this},j.prototype.pause=function(){return p("call pause flowing=%j",this._readableState.flowing),!1!==this._readableState.flowing&&(p("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this},j.prototype.wrap=function(e){var t=this,n=this._readableState,r=!1;for(var i in e.on("end",function(){if(p("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){if(p("wrapped data"),n.decoder&&(i=n.decoder.write(i)),(!n.objectMode||null!==i&&void 0!==i)&&(n.objectMode||i&&i.length)){var o=t.push(i);o||(r=!0,e.pause())}}),e)void 0===this[i]&&"function"==typeof e[i]&&(this[i]=function t(n){return function t(){return e[n].apply(e,arguments)}}(i));for(var o=0;o-1))throw new S(t);return this._writableState.defaultEncoding=t,this},Object.defineProperty(T.prototype,"writableBuffer",{enumerable:!1,get:function e(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(T.prototype,"writableHighWaterMark",{enumerable:!1,get:function e(){return this._writableState.highWaterMark}}),T.prototype._write=function(e,t,n){n(new v("_write()"))},T.prototype._writev=null,T.prototype.end=function(e,t,n){var r=this._writableState;return"function"==typeof e?(n=e,e=null,t=null):"function"==typeof t&&(n=t,t=null),null!==e&&void 0!==e&&this.write(e,t),r.corked&&(r.corked=1,this.uncork()),r.ending||H(this,r,n),this},Object.defineProperty(T.prototype,"writableLength",{enumerable:!1,get:function e(){return this._writableState.length}}),Object.defineProperty(T.prototype,"destroyed",{enumerable:!1,get:function e(){return void 0!==this._writableState&&this._writableState.destroyed},set:function e(t){this._writableState&&(this._writableState.destroyed=t)}}),T.prototype.destroy=p.destroy,T.prototype._undestroy=p.undestroy,T.prototype._destroy=function(e,t){t(e)}}).call(this,n(7),n(2))},function(e,t,n){"use strict";e.exports=c;var r=n(112).codes,i=r.ERR_METHOD_NOT_IMPLEMENTED,o=r.ERR_MULTIPLE_CALLBACK,s=r.ERR_TRANSFORM_ALREADY_TRANSFORMING,a=r.ERR_TRANSFORM_WITH_LENGTH_0,l=n(113);function u(e,t){var n=this._transformState;n.transforming=!1;var r=n.writecb;if(null===r)return this.emit("error",new o);n.writechunk=null,n.writecb=null,null!=t&&this.push(t),r(e);var i=this._readableState;i.reading=!1,(i.needReadable||i.length(e=e.slice(1),new s(e))}});function f(e){let t;try{t=a(e)}catch(e){t=!1}if(t)throw new Error("The object passed has circular references");function n(e){if(!e||r.isBuffer(e)||"string"==typeof e)return e;if(Array.isArray(e))return e.map(n);if(s.isCID(e))return c(e);const t=Object.keys(e);if(1===t.length&&"/"===t[0])return c(e["/"]);if(t.length>0){const r={};return t.forEach(t=>{"object"==typeof e[t]?r[t]=n(e[t]):r[t]=e[t]}),r}return e}return n(e)}t=e.exports,t.serialize=((e,t)=>{let n;try{const r=f(e);n=i.encode(r)}catch(e){return setImmediate(()=>t(e))}setImmediate(()=>t(null,n))}),t.deserialize=((e,t)=>{let n;try{n=h.decodeFirst(e)}catch(e){return setImmediate(()=>t(e))}setImmediate(()=>t(null,n))}),t.cid=((e,n,r)=>{"function"==typeof n&&(r=n,n={}),n=n||{};const i=n.hashAlg||l.defaultHashAlg,a=n.hashLen,u=void 0===n.version?1:n.version;t.serialize(e,(e,t)=>{if(e)return r(e);o(t,i,a,(e,t)=>{if(e)return r(e);r(null,new s(u,l.multicodec,t))})})})}).call(this,n(0).Buffer)},function(e,t,n){"use strict";(function(t,r){const i=n(323),o=n(53),s=n(700),a=n(245),l=n(188),u=n(352),c=n(353),{URL:h}=n(189);class f{constructor(e){e=e||{},!e.size||e.size<65536?e.size=65536:e.size=a.nextPowerOf2(e.size),this._heap=new ArrayBuffer(e.size),this._heap8=new Uint8Array(this._heap),this._buffer=t.from(this._heap),this._reset(),this._knownTags=Object.assign({0:e=>new Date(e),1:e=>new Date(1e3*e),2:e=>a.arrayBufferToBignumber(e),3:e=>l.NEG_ONE.minus(a.arrayBufferToBignumber(e)),4:e=>l.TEN.pow(e[0]).times(e[1]),5:e=>l.TWO.pow(e[0]).times(e[1]),32:e=>new h(e),35:e=>new RegExp(e)},e.tags),this.parser=s(r,{log:console.log.bind(console),pushInt:this.pushInt.bind(this),pushInt32:this.pushInt32.bind(this),pushInt32Neg:this.pushInt32Neg.bind(this),pushInt64:this.pushInt64.bind(this),pushInt64Neg:this.pushInt64Neg.bind(this),pushFloat:this.pushFloat.bind(this),pushFloatSingle:this.pushFloatSingle.bind(this),pushFloatDouble:this.pushFloatDouble.bind(this),pushTrue:this.pushTrue.bind(this),pushFalse:this.pushFalse.bind(this),pushUndefined:this.pushUndefined.bind(this),pushNull:this.pushNull.bind(this),pushInfinity:this.pushInfinity.bind(this),pushInfinityNeg:this.pushInfinityNeg.bind(this),pushNaN:this.pushNaN.bind(this),pushNaNNeg:this.pushNaNNeg.bind(this),pushArrayStart:this.pushArrayStart.bind(this),pushArrayStartFixed:this.pushArrayStartFixed.bind(this),pushArrayStartFixed32:this.pushArrayStartFixed32.bind(this),pushArrayStartFixed64:this.pushArrayStartFixed64.bind(this),pushObjectStart:this.pushObjectStart.bind(this),pushObjectStartFixed:this.pushObjectStartFixed.bind(this),pushObjectStartFixed32:this.pushObjectStartFixed32.bind(this),pushObjectStartFixed64:this.pushObjectStartFixed64.bind(this),pushByteString:this.pushByteString.bind(this),pushByteStringStart:this.pushByteStringStart.bind(this),pushUtf8String:this.pushUtf8String.bind(this),pushUtf8StringStart:this.pushUtf8StringStart.bind(this),pushSimpleUnassigned:this.pushSimpleUnassigned.bind(this),pushTagUnassigned:this.pushTagUnassigned.bind(this),pushTagStart:this.pushTagStart.bind(this),pushTagStart4:this.pushTagStart4.bind(this),pushTagStart8:this.pushTagStart8.bind(this),pushBreak:this.pushBreak.bind(this)},this._heap)}get _depth(){return this._parents.length}get _currentParent(){return this._parents[this._depth-1]}get _ref(){return this._currentParent.ref}_closeParent(){var e=this._parents.pop();if(e.length>0)throw new Error(`Missing ${e.length} elements`);switch(e.type){case l.PARENT.TAG:this._push(this.createTag(e.ref[0],e.ref[1]));break;case l.PARENT.BYTE_STRING:this._push(this.createByteString(e.ref,e.length));break;case l.PARENT.UTF8_STRING:this._push(this.createUtf8String(e.ref,e.length));break;case l.PARENT.MAP:if(e.values%2>0)throw new Error("Odd number of elements in the map");this._push(this.createMap(e.ref,e.length));break;case l.PARENT.OBJECT:if(e.values%2>0)throw new Error("Odd number of elements in the map");this._push(this.createObject(e.ref,e.length));break;case l.PARENT.ARRAY:this._push(this.createArray(e.ref,e.length))}this._currentParent&&this._currentParent.type===l.PARENT.TAG&&this._dec()}_dec(){const e=this._currentParent;e.length<0||(e.length--,0===e.length&&this._closeParent())}_push(e,t){const n=this._currentParent;switch(n.values++,n.type){case l.PARENT.ARRAY:case l.PARENT.BYTE_STRING:case l.PARENT.UTF8_STRING:n.length>-1?this._ref[this._ref.length-n.length]=e:this._ref.push(e),this._dec();break;case l.PARENT.OBJECT:null!=n.tmpKey?(this._ref[n.tmpKey]=e,n.tmpKey=null,this._dec()):(n.tmpKey=e,"string"!=typeof n.tmpKey&&(n.type=l.PARENT.MAP,n.ref=a.buildMap(n.ref)));break;case l.PARENT.MAP:null!=n.tmpKey?(this._ref.set(n.tmpKey,e),n.tmpKey=null,this._dec()):n.tmpKey=e;break;case l.PARENT.TAG:this._ref.push(e),t||this._dec();break;default:throw new Error("Unknown parent type")}}_createParent(e,t,n){this._parents[this._depth]={type:t,length:n,ref:e,values:0,tmpKey:null}}_reset(){this._res=[],this._parents=[{type:l.PARENT.ARRAY,length:-1,ref:this._res,values:0,tmpKey:null}]}createTag(e,t){const n=this._knownTags[e];return n?n(t):new c(e,t)}createMap(e,t){return e}createObject(e,t){return e}createArray(e,t){return e}createByteString(e,n){return t.concat(e)}createByteStringFromHeap(e,n){return e===n?t.alloc(0):t.from(this._heap.slice(e,n))}createInt(e){return e}createInt32(e,t){return a.buildInt32(e,t)}createInt64(e,t,n,r){return a.buildInt64(e,t,n,r)}createFloat(e){return e}createFloatSingle(e,t,n,r){return i.read([e,t,n,r],0,!1,23,4)}createFloatDouble(e,t,n,r,o,s,a,l){return i.read([e,t,n,r,o,s,a,l],0,!1,52,8)}createInt32Neg(e,t){return-1-a.buildInt32(e,t)}createInt64Neg(e,t,n,r){const i=a.buildInt32(e,t),s=a.buildInt32(n,r);return i>l.MAX_SAFE_HIGH?l.NEG_ONE.minus(new o(i).times(l.SHIFT32).plus(s)):-1-(i*l.SHIFT32+s)}createTrue(){return!0}createFalse(){return!1}createNull(){return null}createUndefined(){}createInfinity(){return 1/0}createInfinityNeg(){return-1/0}createNaN(){return NaN}createNaNNeg(){return NaN}createUtf8String(e,t){return e.join("")}createUtf8StringFromHeap(e,t){return e===t?"":this._buffer.toString("utf8",e,t)}createSimpleUnassigned(e){return new u(e)}pushInt(e){this._push(this.createInt(e))}pushInt32(e,t){this._push(this.createInt32(e,t))}pushInt64(e,t,n,r){this._push(this.createInt64(e,t,n,r))}pushFloat(e){this._push(this.createFloat(e))}pushFloatSingle(e,t,n,r){this._push(this.createFloatSingle(e,t,n,r))}pushFloatDouble(e,t,n,r,i,o,s,a){this._push(this.createFloatDouble(e,t,n,r,i,o,s,a))}pushInt32Neg(e,t){this._push(this.createInt32Neg(e,t))}pushInt64Neg(e,t,n,r){this._push(this.createInt64Neg(e,t,n,r))}pushTrue(){this._push(this.createTrue())}pushFalse(){this._push(this.createFalse())}pushNull(){this._push(this.createNull())}pushUndefined(){this._push(this.createUndefined())}pushInfinity(){this._push(this.createInfinity())}pushInfinityNeg(){this._push(this.createInfinityNeg())}pushNaN(){this._push(this.createNaN())}pushNaNNeg(){this._push(this.createNaNNeg())}pushArrayStart(){this._createParent([],l.PARENT.ARRAY,-1)}pushArrayStartFixed(e){this._createArrayStartFixed(e)}pushArrayStartFixed32(e,t){const n=a.buildInt32(e,t);this._createArrayStartFixed(n)}pushArrayStartFixed64(e,t,n,r){const i=a.buildInt64(e,t,n,r);this._createArrayStartFixed(i)}pushObjectStart(){this._createObjectStartFixed(-1)}pushObjectStartFixed(e){this._createObjectStartFixed(e)}pushObjectStartFixed32(e,t){const n=a.buildInt32(e,t);this._createObjectStartFixed(n)}pushObjectStartFixed64(e,t,n,r){const i=a.buildInt64(e,t,n,r);this._createObjectStartFixed(i)}pushByteStringStart(){this._parents[this._depth]={type:l.PARENT.BYTE_STRING,length:-1,ref:[],values:0,tmpKey:null}}pushByteString(e,t){this._push(this.createByteStringFromHeap(e,t))}pushUtf8StringStart(){this._parents[this._depth]={type:l.PARENT.UTF8_STRING,length:-1,ref:[],values:0,tmpKey:null}}pushUtf8String(e,t){this._push(this.createUtf8StringFromHeap(e,t))}pushSimpleUnassigned(e){this._push(this.createSimpleUnassigned(e))}pushTagStart(e){this._parents[this._depth]={type:l.PARENT.TAG,length:1,ref:[e]}}pushTagStart4(e,t){this.pushTagStart(a.buildInt32(e,t))}pushTagStart8(e,t,n,r){this.pushTagStart(a.buildInt64(e,t,n,r))}pushTagUnassigned(e){this._push(this.createTag(e))}pushBreak(){if(this._currentParent.length>-1)throw new Error("Unexpected break");this._closeParent()}_createObjectStartFixed(e){0!==e?this._createParent({},l.PARENT.OBJECT,e):this._push(this.createObject({}))}_createArrayStartFixed(e){0!==e?this._createParent(new Array(e),l.PARENT.ARRAY,e):this._push(this.createArray([]))}_decode(e){if(0===e.byteLength)throw new Error("Input too short");this._reset(),this._heap8.set(e);const t=this.parser.parse(e.byteLength);if(this._depth>1){for(;0===this._currentParent.length;)this._closeParent();if(this._depth>1)throw new Error("Undeterminated nesting")}if(t>0)throw new Error("Failed to parse");if(0===this._res.length)throw new Error("No valid result")}decodeFirst(e){return this._decode(e),this._res[0]}decodeAll(e){return this._decode(e),this._res}static decode(e,n){"string"==typeof e&&(e=t.from(e,n||"hex"));const r=new f({size:e.length});return r.decodeFirst(e)}static decodeAll(e,n){"string"==typeof e&&(e=t.from(e,n||"hex"));const r=new f({size:e.length});return r.decodeAll(e)}}f.decodeFirst=f.decode,e.exports=f}).call(this,n(0).Buffer,n(7))},function(e,t,n){"use strict";const r=n(188),i=r.MT,o=r.SIMPLE,s=r.SYMS;class a{constructor(e){if("number"!=typeof e)throw new Error("Invalid Simple type: "+typeof e);if(e<0||e>255||(0|e)!==e)throw new Error("value must be a small positive integer: "+e);this.value=e}toString(){return"simple("+this.value+")"}inspect(){return"simple("+this.value+")"}encodeCBOR(e){return e._pushInt(this.value,i.SIMPLE_FLOAT)}static isSimple(e){return e instanceof a}static decode(e,t){switch(null==t&&(t=!0),e){case o.FALSE:return!1;case o.TRUE:return!0;case o.NULL:return t?null:s.NULL;case o.UNDEFINED:return t?void 0:s.UNDEFINED;case-1:if(!t)throw new Error("Invalid BREAK");return s.BREAK;default:return new a(e)}}}e.exports=a},function(e,t,n){"use strict";class r{constructor(e,t,n){if(this.tag=e,this.value=t,this.err=n,"number"!=typeof this.tag)throw new Error("Invalid tag type ("+typeof this.tag+")");if(this.tag<0||(0|this.tag)!==this.tag)throw new Error("Tag must be a positive integer: "+this.tag)}toString(){return`${this.tag}(${JSON.stringify(this.value)})`}encodeCBOR(e){return e._pushTag(this.tag),e.pushAny(this.value)}convert(e){var t,n;if(n=null!=e?e[this.tag]:void 0,"function"!=typeof n&&(n=r["_tag"+this.tag],"function"!=typeof n))return this;try{return n.call(r,this.value)}catch(e){return t=e,this.err=t,this}}}e.exports=r},function(e,t,n){"use strict";const r=self.location?self.location.protocol+"//"+self.location.host:"",i=self.URL;class o{constructor(e,t=r){this.super=new i(e,t),this.path=this.pathname+this.search,this.auth=this.username&&this.password?this.username+":"+this.password:null,this.query=this.search&&this.search.startsWith("?")?this.search.slice(1):null}get hash(){return this.super.hash}get host(){return this.super.host}get hostname(){return this.super.hostname}get href(){return this.super.href}get origin(){return this.super.origin}get password(){return this.super.password}get pathname(){return this.super.pathname}get port(){return this.super.port}get protocol(){return this.super.protocol}get search(){return this.super.search}get searchParams(){return this.super.searchParams}get username(){return this.super.username}set hash(e){this.super.hash=e}set host(e){this.super.host=e}set hostname(e){this.super.hostname=e}set href(e){this.super.href=e}set origin(e){this.super.origin=e}set password(e){this.super.password=e}set pathname(e){this.super.pathname=e}set port(e){this.super.port=e}set protocol(e){this.super.protocol=e}set search(e){this.super.search=e}set searchParams(e){this.super.searchParams=e}set username(e){this.super.username=e}createObjectURL(e){return this.super.createObjectURL(e)}revokeObjectURL(e){this.super.revokeObjectURL(e)}toJSON(){return this.super.toJSON()}toString(){return this.super.toString()}format(){return this.toString()}}function s(e){if("string"==typeof e){const t=new i(e);return t.toString()}if(!(e instanceof i)){const t=e.username&&e.password?`${e.username}:${e.password}@`:"",n=e.auth?e.auth+"@":"",r=e.port?":"+e.port:"",i=e.protocol?e.protocol+"//":"",o=e.host||"",s=e.hostname||"",a=e.search||(e.query?"?"+e.query:""),l=e.hash||"",u=e.pathname||"",c=e.path||u+a;return`${i}${t||n}${o||s+r}${c}${l}`}}e.exports={URLWithLegacySupport:o,URLSearchParams:self.URLSearchParams,defaultBase:r,format:s}},function(e,t,n){(function(r,i){var o; -/** - * [js-sha3]{@link https://github.com/emn178/js-sha3} - * - * @version 0.8.0 - * @author Chen, Yi-Cyuan [emn178@gmail.com] - * @copyright Chen, Yi-Cyuan 2015-2018 - * @license MIT - */ -/** - * [js-sha3]{@link https://github.com/emn178/js-sha3} - * - * @version 0.8.0 - * @author Chen, Yi-Cyuan [emn178@gmail.com] - * @copyright Chen, Yi-Cyuan 2015-2018 - * @license MIT - */ -!function(){"use strict";var s="input is invalid type",a="finalize already called",l="object"==typeof window,u=l?window:{};u.JS_SHA3_NO_WINDOW&&(l=!1);var c=!l&&"object"==typeof self,h=!u.JS_SHA3_NO_NODE_JS&&"object"==typeof r&&r.versions&&r.versions.node;h?u=i:c&&(u=self);var f=!u.JS_SHA3_NO_COMMON_JS&&"object"==typeof e&&e.exports,p=n(356),d=!u.JS_SHA3_NO_ARRAY_BUFFER&&"undefined"!=typeof ArrayBuffer,m="0123456789abcdef".split(""),g=[31,7936,2031616,520093696],y=[4,1024,262144,67108864],v=[1,256,65536,16777216],b=[6,1536,393216,100663296],_=[0,8,16,24],w=[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],k=[224,256,384,512],E=[128,256],S=["hex","buffer","arrayBuffer","array","digest"],x={128:168,256:136};!u.JS_SHA3_NO_NODE_JS&&Array.isArray||(Array.isArray=function(e){return"[object Array]"===Object.prototype.toString.call(e)}),!d||!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 C=function(e,t,n){return function(r){return new H(e,t,e).update(r)[n]()}},A=function(e,t,n){return function(r,i){return new H(e,t,i).update(r)[n]()}},T=function(e,t,n){return function(t,r,i,o){return D["cshake"+e].update(t,r,i,o)[n]()}},I=function(e,t,n){return function(t,r,i,o){return D["kmac"+e].update(t,r,i,o)[n]()}},j=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 V(e,t,n){H.call(this,e,t,n)}H.prototype.update=function(e){if(this.finalized)throw new Error(a);var t,n=typeof e;if("string"!==n){if("object"!==n)throw new Error(s);if(null===e)throw new Error(s);if(d&&e.constructor===ArrayBuffer)e=new Uint8Array(e);else if(!(Array.isArray(e)||d&&ArrayBuffer.isView(e)))throw new Error(s);t=!0}for(var r=this.blocks,i=this.byteCount,o=e.length,l=this.blockCount,u=0,c=this.s,h,f;u>2]|=e[u]<<_[3&h++];else for(h=this.start;u>2]|=f<<_[3&h++]:f<2048?(r[h>>2]|=(192|f>>6)<<_[3&h++],r[h>>2]|=(128|63&f)<<_[3&h++]):f<55296||f>=57344?(r[h>>2]|=(224|f>>12)<<_[3&h++],r[h>>2]|=(128|f>>6&63)<<_[3&h++],r[h>>2]|=(128|63&f)<<_[3&h++]):(f=65536+((1023&f)<<10|1023&e.charCodeAt(++u)),r[h>>2]|=(240|f>>18)<<_[3&h++],r[h>>2]|=(128|f>>12&63)<<_[3&h++],r[h>>2]|=(128|f>>6&63)<<_[3&h++],r[h>>2]|=(128|63&f)<<_[3&h++]);if(this.lastByteIndex=h,h>=i){for(this.start=h-i,this.block=r[l],h=0;h>=8,n=255&e;n>0;)i.unshift(n),e>>=8,n=255&e,++r;return t?i.push(r):i.unshift(r),this.update(i),i.length},H.prototype.encodeString=function(e){var t,n=typeof e;if("string"!==n){if("object"!==n)throw new Error(s);if(null===e)throw new Error(s);if(d&&e.constructor===ArrayBuffer)e=new Uint8Array(e);else if(!(Array.isArray(e)||d&&ArrayBuffer.isView(e)))throw new Error(s);t=!0}var r=0,i=e.length;if(t)r=i;else for(var o=0;o=57344?r+=3:(a=65536+((1023&a)<<10|1023&e.charCodeAt(++o)),r+=4)}return r+=this.encode(8*r),this.update(e),r},H.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]+m[15&a]+m[a>>12&15]+m[a>>8&15]+m[a>>20&15]+m[a>>16&15]+m[a>>28&15]+m[a>>24&15];o%e==0&&($(t),i=0)}return r&&(a=t[i],s+=m[a>>4&15]+m[15&a],r>1&&(s+=m[a>>12&15]+m[a>>8&15]),r>2&&(s+=m[a>>20&15]+m[a>>16&15])),s},H.prototype.arrayBuffer=function(){this.finalize();var e=this.blockCount,t=this.s,n=this.outputBlocks,r=this.extraBytes,i=0,o=0,s=this.outputBits>>3,a;a=r?new ArrayBuffer(n+1<<2):new ArrayBuffer(s);for(var l=new Uint32Array(a);o>8&255,s[a+2]=l>>16&255,s[a+3]=l>>24&255;o%e==0&&$(t)}return r&&(a=o<<2,l=t[i],s[a]=255&l,r>1&&(s[a+1]=l>>8&255),r>2&&(s[a+2]=l>>16&255)),s},V.prototype=new H,V.prototype.finalize=function(){return this.encode(this.outputBits,!0),H.prototype.finalize.call(this)};var $=function(e){var t,n,r,i,o,s,a,l,u,c,h,f,p,d,m,g,y,v,b,_,k,E,S,x,C,A,T,I,j,R,B,O,P,N,D,F,M,L,U,q,z,K,H,V,$,W,G,Y,Z,J,Q,X,ee,te,ne,re,ie,oe,se,ae,le,ue,ce;for(r=0;r<48;r+=2)i=e[0]^e[10]^e[20]^e[30]^e[40],o=e[1]^e[11]^e[21]^e[31]^e[41],s=e[2]^e[12]^e[22]^e[32]^e[42],a=e[3]^e[13]^e[23]^e[33]^e[43],l=e[4]^e[14]^e[24]^e[34]^e[44],u=e[5]^e[15]^e[25]^e[35]^e[45],c=e[6]^e[16]^e[26]^e[36]^e[46],h=e[7]^e[17]^e[27]^e[37]^e[47],f=e[8]^e[18]^e[28]^e[38]^e[48],p=e[9]^e[19]^e[29]^e[39]^e[49],t=f^(s<<1|a>>>31),n=p^(a<<1|s>>>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^(l<<1|u>>>31),n=o^(u<<1|l>>>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=s^(c<<1|h>>>31),n=a^(h<<1|c>>>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=l^(f<<1|p>>>31),n=u^(p<<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=c^(i<<1|o>>>31),n=h^(o<<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,d=e[0],m=e[1],W=e[11]<<4|e[10]>>>28,G=e[10]<<4|e[11]>>>28,I=e[20]<<3|e[21]>>>29,j=e[21]<<3|e[20]>>>29,ae=e[31]<<9|e[30]>>>23,le=e[30]<<9|e[31]>>>23,K=e[40]<<18|e[41]>>>14,H=e[41]<<18|e[40]>>>14,N=e[2]<<1|e[3]>>>31,D=e[3]<<1|e[2]>>>31,g=e[13]<<12|e[12]>>>20,y=e[12]<<12|e[13]>>>20,Y=e[22]<<10|e[23]>>>22,Z=e[23]<<10|e[22]>>>22,R=e[33]<<13|e[32]>>>19,B=e[32]<<13|e[33]>>>19,ue=e[42]<<2|e[43]>>>30,ce=e[43]<<2|e[42]>>>30,te=e[5]<<30|e[4]>>>2,ne=e[4]<<30|e[5]>>>2,F=e[14]<<6|e[15]>>>26,M=e[15]<<6|e[14]>>>26,v=e[25]<<11|e[24]>>>21,b=e[24]<<11|e[25]>>>21,J=e[34]<<15|e[35]>>>17,Q=e[35]<<15|e[34]>>>17,O=e[45]<<29|e[44]>>>3,P=e[44]<<29|e[45]>>>3,x=e[6]<<28|e[7]>>>4,C=e[7]<<28|e[6]>>>4,re=e[17]<<23|e[16]>>>9,ie=e[16]<<23|e[17]>>>9,L=e[26]<<25|e[27]>>>7,U=e[27]<<25|e[26]>>>7,_=e[36]<<21|e[37]>>>11,k=e[37]<<21|e[36]>>>11,X=e[47]<<24|e[46]>>>8,ee=e[46]<<24|e[47]>>>8,V=e[8]<<27|e[9]>>>5,$=e[9]<<27|e[8]>>>5,A=e[18]<<20|e[19]>>>12,T=e[19]<<20|e[18]>>>12,oe=e[29]<<7|e[28]>>>25,se=e[28]<<7|e[29]>>>25,q=e[38]<<8|e[39]>>>24,z=e[39]<<8|e[38]>>>24,E=e[48]<<14|e[49]>>>18,S=e[49]<<14|e[48]>>>18,e[0]=d^~g&v,e[1]=m^~y&b,e[10]=x^~A&I,e[11]=C^~T&j,e[20]=N^~F&L,e[21]=D^~M&U,e[30]=V^~W&Y,e[31]=$^~G&Z,e[40]=te^~re&oe,e[41]=ne^~ie&se,e[2]=g^~v&_,e[3]=y^~b&k,e[12]=A^~I&R,e[13]=T^~j&B,e[22]=F^~L&q,e[23]=M^~U&z,e[32]=W^~Y&J,e[33]=G^~Z&Q,e[42]=re^~oe&ae,e[43]=ie^~se&le,e[4]=v^~_&E,e[5]=b^~k&S,e[14]=I^~R&O,e[15]=j^~B&P,e[24]=L^~q&K,e[25]=U^~z&H,e[34]=Y^~J&X,e[35]=Z^~Q&ee,e[44]=oe^~ae&ue,e[45]=se^~le&ce,e[6]=_^~E&d,e[7]=k^~S&m,e[16]=R^~O&x,e[17]=B^~P&C,e[26]=q^~K&N,e[27]=z^~H&D,e[36]=J^~X&V,e[37]=Q^~ee&$,e[46]=ae^~ue&te,e[47]=le^~ce&ne,e[8]=E^~d&g,e[9]=S^~m&y,e[18]=O^~x&A,e[19]=P^~C&T,e[28]=K^~N&F,e[29]=H^~D&M,e[38]=X^~V&W,e[39]=ee^~$&G,e[48]=ue^~te&re,e[49]=ce^~ne&ie,e[0]^=w[r],e[1]^=w[r+1]};if(f)e.exports=D;else{for(M=0;M(function(n,r){let i;try{i=t(n)}catch(t){return void e.nextTick(r,t)}e.nextTick(r,null,i)})),t.toBuf=((e,t)=>r=>{let i=e(r,t);return n.from(i,"hex")}),t.fromString=((e,t)=>r=>{const i=n.isBuffer(r)?r.toString():r;return e(i,t)}),t.fromNumberTo32BitBuf=((e,t)=>r=>{let i=e(r,t);const o=new Array(4);for(let e=0;e<4;e++)o[e]=255&i,i>>=8;return n.from(o)})}).call(this,n(2),n(0).Buffer)},function(e,t,n){(function(t){var r=n(706),i=n(360),o;function s(e,t){return"function"!=typeof t?e:e.then(function(e){o(function(){t(null,e)})},function(e){o(function(){t(e)})})}function a(e){return s(this,e)}function l(e){if(e&&i(e)){e.nodeify=a;var t=e.then;return e.then=function(){return l(t.apply(this,arguments))},e}"function"==typeof e?e.prototype.nodeify=a:r.prototype.nodeify=a}function u(e){if(!(this instanceof u))return new u(e);r.call(this,e),l(this)}o="function"==typeof setImmediate?setImmediate:"object"==typeof t&&t&&t.nextTick?t.nextTick:function(e){setTimeout(e,0)},e.exports=s,s.extend=l,s.Promise=u,u.prototype=Object.create(r.prototype),u.prototype.constructor=u}).call(this,n(2))},function(e,t){function n(e){return e&&"function"==typeof e.then}e.exports=n},function(e,t,n){var r=n(708),i=n(709);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){(function(t){var n="Input must be an string, Buffer or Uint8Array";function r(e){var r;if(e instanceof Uint8Array)r=e;else if(e instanceof t)r=new Uint8Array(e);else{if("string"!=typeof e)throw new Error(n);r=new Uint8Array(t.from(e,"utf8"))}return r}function i(e){return Array.prototype.map.call(e,function(e){return(e<16?"0":"")+e.toString(16)}).join("")}function o(e){return(4294967296+e).toString(16).substring(1)}function s(e,t,n){for(var r="\n"+e+" = ",i=0;i{"function"==typeof t&&(n=t,t=void 0),i.deserialize(e,(e,i)=>{if(e)return n(e);if(!t||"/"===t)return n(null,{value:i,remainderPath:""});const s=t.split("/"),a=o(i).get(s);if(void 0!==a)return n(null,{value:a,remainderPath:""});let l;const u=s.length;for(let e=0;e{"function"==typeof t&&(n=t,t=void 0),t=t||{},i.deserialize(e,(e,t)=>{if(e)return n(e);const r=a(t),i=r.map(e=>e.path);n(null,i)})}),t.isLink=((e,n,r)=>{t.resolve(e,n,(e,t)=>e?r(e):t.remainderPath.length>0?r(new Error("path out of scope")):void(s.isCID(t.value)?r(null,t.value):r(null,!1)))})}).call(this,n(0).Buffer)},function(e,t,n){"use strict";const r=n(10),i=n(9),o=n(192);t=e.exports,t.multicodec="dag-pb",t.defaultHashAlg="sha2-256",t.resolve=((e,t,n)=>{r([t=>o.deserialize(e,t),(e,r)=>{if(!t)return n(null,{value:e,remainderPath:""});const i=t.split("/");if("Links"===i[0]){let t="";if(!i[1])return r(null,{value:e.links.map(e=>e.toJSON()),remainderPath:""});const n={};e.links.forEach((e,t)=>{const r=e.toJSON();n[t]=n[r.name]={cid:r.cid,name:r.name,size:r.size}});let o=n[i[1]];"Hash"===i[2]?o={"/":o.cid}:"Tsize"===i[2]?o=o.size:"Name"===i[2]&&(o=o.name),t=i.slice(3).join("/"),r(null,{value:o,remainderPath:t})}else if("Data"===i[0])r(null,{value:e.data,remainderPath:""});else{const t={};e.links.forEach((e,n)=>{const r=e.toJSON();t[r.name]={cid:r.cid,name:r.name,size:r.size}});const n=t[i[0]];if(n)return r(null,{value:{"/":n.cid},remainderPath:i.slice(1).join("/")});r(new Error("path not available"))}}],n)}),t.tree=((e,t,n)=>{"function"==typeof t&&(n=t,t={}),t=t||{},o.deserialize(e,(e,t)=>{if(e)return n(e);const r=[];r.push("Links"),t.links.forEach((e,t)=>{r.push(`Links/${t}/Name`),r.push(`Links/${t}/Tsize`),r.push(`Links/${t}/Hash`)}),r.push("Data"),n(null,r)})}),t.isLink=((e,n,r)=>{t.resolve(e,n,(e,t)=>{if(e)return r(e);if(t.remainderPath.length>0)return r(new Error("path out of scope"));if("object"==typeof t.value&&t.value["/"]){let n;try{n=i.isCID(new i(t.value["/"]))}catch(e){n=!1}if(n)return r(null,t.value)}r(null,!1)})})},function(e,t,n){"use strict";const r=n(9),i=n(54);e.exports={resolver:{multicodec:"raw",defaultHashAlg:"sha2-256",resolve:(e,t,n)=>{n(null,{value:e,remainderPath:""})},tree:(e,t,n)=>{"function"==typeof t&&(n=t),n(null,[])}},util:{deserialize:(e,t)=>{t(null,e)},serialize:(e,t)=>{t(null,e)},cid:(e,t,n)=>{"function"==typeof t&&(n=t,t={}),t=t||{};const o=t.hashAlg||"sha2-256",s=void 0===t.version?1:t.version;i(e,o,(e,t)=>{if(e)return n(e);n(null,new r(s,"raw",t))})}}}},function(e,t,n){"use strict";(function(r){const i=n(55),o=i(n(247));n(117),n(248),n(249);const s=n(20);t=e.exports;const a={rsa:n(741),ed25519:n(757),secp256k1:n(761)(o,n(254))};function l(e){const t=a[e.toLowerCase()];return void 0!==t}t.supportedKeys=a,t.keysPBM=o,t.keyStretcher=n(789),t.generateEphemeralKeyPair=n(791),t.generateKeyPair=((e,t,n)=>{let r=a[e.toLowerCase()];if(!r)return n(new Error("invalid or unsupported key type"));r.generateKeyPair(t,n)}),t.generateKeyPairFromSeed=((e,t,n,r)=>{let i=a[e.toLowerCase()];return i?"ed25519"!==e.toLowerCase()?r(new Error("Seed key derivation is unimplemented for RSA or secp256k1")):void i.generateKeyPairFromSeed(t,n,r):r(new Error("invalid or unsupported key type"))}),t.unmarshalPublicKey=(e=>{const t=o.PublicKey.decode(e),n=t.Data;switch(t.Type){case o.KeyType.RSA:return a.rsa.unmarshalRsaPublicKey(n);case o.KeyType.Ed25519:return a.ed25519.unmarshalEd25519PublicKey(n);case o.KeyType.Secp256k1:if(a.secp256k1)return a.secp256k1.unmarshalSecp256k1PublicKey(n);throw new Error("secp256k1 support requires libp2p-crypto-secp256k1 package");default:throw new Error("invalid or unsupported key type")}}),t.marshalPublicKey=((e,t)=>{if(t=(t||"rsa").toLowerCase(),!l(t))throw new Error("invalid or unsupported key type");return e.bytes}),t.unmarshalPrivateKey=((e,t)=>{let n;try{n=o.PrivateKey.decode(e)}catch(e){return t(e)}const r=n.Data;switch(n.Type){case o.KeyType.RSA:return a.rsa.unmarshalRsaPrivateKey(r,t);case o.KeyType.Ed25519:return a.ed25519.unmarshalEd25519PrivateKey(r,t);case o.KeyType.Secp256k1:return a.secp256k1?a.secp256k1.unmarshalSecp256k1PrivateKey(r,t):t(new Error("secp256k1 support requires libp2p-crypto-secp256k1 package"));default:t(new Error("invalid or unsupported key type"))}}),t.marshalPrivateKey=((e,t)=>{if(t=(t||"rsa").toLowerCase(),!l(t))throw new Error("invalid or unsupported key type");return e.bytes}),t.import=((e,t,n)=>{try{const i=s.pki.decryptRsaPrivateKey(e,t);if(null===i)throw new Error("Cannot read the key, most likely the password is wrong or not a RSA key");let o=s.asn1.toDer(s.pki.privateKeyToAsn1(i));return o=r.from(o.getBytes(),"binary"),a.rsa.unmarshalRsaPrivateKey(o,n)}catch(e){n(e)}})}).call(this,n(0).Buffer)},function(e,t,n){var r=n(20),i;e.exports=r.jsbn=r.jsbn||{};var o=0xdeadbeefcafe,s=!0;function a(e,t,n){this.data=[],null!=e&&("number"==typeof e?this.fromNumber(e,t,n):null==t&&"string"!=typeof e?this.fromString(e,256):this.fromString(e,t))}function l(){return new a(null)}function u(e,t,n,r,i,o){for(;--o>=0;){var s=t*this.data[e++]+n.data[r]+i;i=Math.floor(s/67108864),n.data[r++]=67108863&s}return i}function c(e,t,n,r,i,o){for(var s=32767&t,a=t>>15;--o>=0;){var l=32767&this.data[e],u=this.data[e++]>>15,c=a*l+u*s;l=s*l+((32767&c)<<15)+n.data[r]+(1073741823&i),i=(l>>>30)+(c>>>15)+a*u+(i>>>30),n.data[r++]=1073741823&l}return i}function h(e,t,n,r,i,o){for(var s=16383&t,a=t>>14;--o>=0;){var l=16383&this.data[e],u=this.data[e++]>>14,c=a*l+u*s;l=s*l+((16383&c)<<14)+n.data[r]+i,i=(l>>28)+(c>>14)+a*u,n.data[r++]=268435455&l}return i}r.jsbn.BigInteger=a,"undefined"==typeof navigator?(a.prototype.am=h,i=28):"Microsoft Internet Explorer"==navigator.appName?(a.prototype.am=c,i=30):"Netscape"!=navigator.appName?(a.prototype.am=u,i=26):(a.prototype.am=h,i=28),a.prototype.DB=i,a.prototype.DM=(1<=0;--t)e.data[t]=this.data[t];e.t=this.t,e.s=this.s}function _(e){this.t=1,this.s=e<0?-1:0,e>0?this.data[0]=e:e<-1?this.data[0]=e+this.DV:this.t=0}function w(e){var t=l();return t.fromInt(e),t}function k(e,t){var n;if(16==t)n=4;else if(8==t)n=3;else if(256==t)n=8;else if(2==t)n=1;else if(32==t)n=5;else{if(4!=t)return void this.fromRadix(e,t);n=2}this.t=0,this.s=0;for(var r=e.length,i=!1,o=0;--r>=0;){var s=8==n?255&e[r]:v(e,r);s<0?"-"==e.charAt(r)&&(i=!0):(i=!1,0==o?this.data[this.t++]=s:o+n>this.DB?(this.data[this.t-1]|=(s&(1<>this.DB-o):this.data[this.t-1]|=s<=this.DB&&(o-=this.DB))}8==n&&0!=(128&e[0])&&(this.s=-1,o>0&&(this.data[this.t-1]|=(1<0&&this.data[this.t-1]==e;)--this.t}function S(e){if(this.s<0)return"-"+this.negate().toString(e);var t;if(16==e)t=4;else if(8==e)t=3;else if(2==e)t=1;else if(32==e)t=5;else{if(4!=e)return this.toRadix(e);t=2}var n=(1<0)for(a>a)>0&&(i=!0,o=y(r));s>=0;)a>(a+=this.DB-t)):(r=this.data[s]>>(a-=t)&n,a<=0&&(a+=this.DB,--s)),r>0&&(i=!0),i&&(o+=y(r));return i?o:"0"}function x(){var e=l();return a.ZERO.subTo(this,e),e}function C(){return this.s<0?this.negate():this}function A(e){var t=this.s-e.s;if(0!=t)return t;var n=this.t;if(t=n-e.t,0!=t)return this.s<0?-t:t;for(;--n>=0;)if(0!=(t=this.data[n]-e.data[n]))return t;return 0}function T(e){var t=1,n;return 0!=(n=e>>>16)&&(e=n,t+=16),0!=(n=e>>8)&&(e=n,t+=8),0!=(n=e>>4)&&(e=n,t+=4),0!=(n=e>>2)&&(e=n,t+=2),0!=(n=e>>1)&&(e=n,t+=1),t}function I(){return this.t<=0?0:this.DB*(this.t-1)+T(this.data[this.t-1]^this.s&this.DM)}function j(e,t){var n;for(n=this.t-1;n>=0;--n)t.data[n+e]=this.data[n];for(n=e-1;n>=0;--n)t.data[n]=0;t.t=this.t+e,t.s=this.s}function R(e,t){for(var n=e;n=0;--a)t.data[a+o+1]=this.data[a]>>r|s,s=(this.data[a]&i)<=0;--a)t.data[a]=0;t.data[o]=s,t.t=this.t+o+1,t.s=this.s,t.clamp()}function O(e,t){t.s=this.s;var n=Math.floor(e/this.DB);if(n>=this.t)t.t=0;else{var r=e%this.DB,i=this.DB-r,o=(1<>r;for(var s=n+1;s>r;r>0&&(t.data[this.t-n-1]|=(this.s&o)<>=this.DB;if(e.t>=this.DB;r+=this.s}else{for(r+=this.s;n>=this.DB;r-=e.s}t.s=r<0?-1:0,r<-1?t.data[n++]=this.DV+r:r>0&&(t.data[n++]=r),t.t=n,t.clamp()}function N(e,t){var n=this.abs(),r=e.abs(),i=n.t;for(t.t=i+r.t;--i>=0;)t.data[i]=0;for(i=0;i=0;)e.data[n]=0;for(n=0;n=t.DV&&(e.data[n+t.t]-=t.DV,e.data[n+t.t+1]=1)}e.t>0&&(e.data[e.t-1]+=t.am(n,t.data[n],e,2*n,0,1)),e.s=0,e.clamp()}function F(e,t,n){var r=e.abs();if(!(r.t<=0)){var i=this.abs();if(i.t0?(r.lShiftTo(c,o),i.lShiftTo(c,n)):(r.copyTo(o),i.copyTo(n));var h=o.t,f=o.data[h-1];if(0!=f){var p=f*(1<1?o.data[h-2]>>this.F2:0),d=this.FV/p,m=(1<=0&&(n.data[n.t++]=1,n.subTo(b,n)),a.ONE.dlShiftTo(h,b),b.subTo(o,o);o.t=0;){var _=n.data[--y]==f?this.DM:Math.floor(n.data[y]*d+(n.data[y-1]+g)*m);if((n.data[y]+=o.am(0,_,n,v,0,h))<_)for(o.dlShiftTo(v,b),n.subTo(b,n);n.data[y]<--_;)n.subTo(b,n)}null!=t&&(n.drShiftTo(h,t),s!=u&&a.ZERO.subTo(t,t)),n.t=h,n.clamp(),c>0&&n.rShiftTo(c,n),s<0&&a.ZERO.subTo(n,n)}}}function M(e){var t=l();return this.abs().divRemTo(e,null,t),this.s<0&&t.compareTo(a.ZERO)>0&&e.subTo(t,t),t}function L(e){this.m=e}function U(e){return e.s<0||e.compareTo(this.m)>=0?e.mod(this.m):e}function q(e){return e}function z(e){e.divRemTo(this.m,null,e)}function K(e,t,n){e.multiplyTo(t,n),this.reduce(n)}function H(e,t){e.squareTo(t),this.reduce(t)}function V(){if(this.t<1)return 0;var e=this.data[0];if(0==(1&e))return 0;var t=3&e;return t=t*(2-(15&e)*t)&15,t=t*(2-(255&e)*t)&255,t=t*(2-((65535&e)*t&65535))&65535,t=t*(2-e*t%this.DV)%this.DV,t>0?this.DV-t:-t}function $(e){this.m=e,this.mp=e.invDigit(),this.mpl=32767&this.mp,this.mph=this.mp>>15,this.um=(1<0&&this.m.subTo(t,t),t}function G(e){var t=l();return e.copyTo(t),this.reduce(t),t}function Y(e){for(;e.t<=this.mt2;)e.data[e.t++]=0;for(var t=0;t>15)*this.mpl&this.um)<<15)&e.DM;for(n=t+this.m.t,e.data[n]+=this.m.am(0,r,e,t,0,this.m.t);e.data[n]>=e.DV;)e.data[n]-=e.DV,e.data[++n]++}e.clamp(),e.drShiftTo(this.m.t,e),e.compareTo(this.m)>=0&&e.subTo(this.m,e)}function Z(e,t){e.squareTo(t),this.reduce(t)}function J(e,t,n){e.multiplyTo(t,n),this.reduce(n)}function Q(){return 0==(this.t>0?1&this.data[0]:this.s)}function X(e,t){if(e>4294967295||e<1)return a.ONE;var n=l(),r=l(),i=t.convert(this),o=T(e)-1;for(i.copyTo(n);--o>=0;)if(t.sqrTo(n,r),(e&1<0)t.mulTo(r,i,n);else{var s=n;n=r,r=s}return t.revert(n)}function ee(e,t){var n;return n=e<256||t.isEven()?new L(t):new $(t),this.exp(e,n)}function te(){var e=l();return this.copyTo(e),e}function ne(){if(this.s<0){if(1==this.t)return this.data[0]-this.DV;if(0==this.t)return-1}else{if(1==this.t)return this.data[0];if(0==this.t)return 0}return(this.data[1]&(1<<32-this.DB)-1)<>24}function ie(){return 0==this.t?this.s:this.data[0]<<16>>16}function oe(e){return Math.floor(Math.LN2*this.DB/Math.log(e))}function se(){return this.s<0?-1:this.t<=0||1==this.t&&this.data[0]<=0?0:1}function ae(e){if(null==e&&(e=10),0==this.signum()||e<2||e>36)return"0";var t=this.chunkSize(e),n=Math.pow(e,t),r=w(n),i=l(),o=l(),s="";for(this.divRemTo(r,i,o);i.signum()>0;)s=(n+o.intValue()).toString(e).substr(1)+s,i.divRemTo(r,i,o);return o.intValue().toString(e)+s}function le(e,t){this.fromInt(0),null==t&&(t=10);for(var n=this.chunkSize(t),r=Math.pow(t,n),i=!1,o=0,s=0,l=0;l=n&&(this.dMultiply(r),this.dAddOffset(s,0),o=0,s=0))}o>0&&(this.dMultiply(Math.pow(t,o)),this.dAddOffset(s,0)),i&&a.ZERO.subTo(this,this)}function ue(e,t,n){if("number"==typeof t)if(e<2)this.fromInt(1);else for(this.fromNumber(e,n),this.testBit(e-1)||this.bitwiseTo(a.ONE.shiftLeft(e-1),ye,this),this.isEven()&&this.dAddOffset(1,0);!this.isProbablePrime(t);)this.dAddOffset(2,0),this.bitLength()>e&&this.subTo(a.ONE.shiftLeft(e-1),this);else{var r=new Array,i=7&e;r.length=1+(e>>3),t.nextBytes(r),i>0?r[0]&=(1<0)for(n>n)!=(this.s&this.DM)>>n&&(t[i++]=r|this.s<=0;)n<8?(r=(this.data[e]&(1<>(n+=this.DB-8)):(r=this.data[e]>>(n-=8)&255,n<=0&&(n+=this.DB,--e)),0!=(128&r)&&(r|=-256),0==i&&(128&this.s)!=(128&r)&&++i,(i>0||r!=this.s)&&(t[i++]=r);return t}function he(e){return 0==this.compareTo(e)}function fe(e){return this.compareTo(e)<0?this:e}function pe(e){return this.compareTo(e)>0?this:e}function de(e,t,n){var r,i,o=Math.min(e.t,this.t);for(r=0;r>=16,t+=16),0==(255&e)&&(e>>=8,t+=8),0==(15&e)&&(e>>=4,t+=4),0==(3&e)&&(e>>=2,t+=2),0==(1&e)&&++t,t}function Ae(){for(var e=0;e=this.t?0!=this.s:0!=(this.data[t]&1<>=this.DB;if(e.t>=this.DB;r+=this.s}else{for(r+=this.s;n>=this.DB;r+=e.s}t.s=r<0?-1:0,r>0?t.data[n++]=r:r<-1&&(t.data[n++]=this.DV+r),t.t=n,t.clamp()}function De(e){var t=l();return this.addTo(e,t),t}function Fe(e){var t=l();return this.subTo(e,t),t}function Me(e){var t=l();return this.multiplyTo(e,t),t}function Le(e){var t=l();return this.divRemTo(e,t,null),t}function Ue(e){var t=l();return this.divRemTo(e,null,t),t}function qe(e){var t=l(),n=l();return this.divRemTo(e,t,n),new Array(t,n)}function ze(e){this.data[this.t]=this.am(0,e-1,this,0,0,this.t),++this.t,this.clamp()}function Ke(e,t){if(0!=e){for(;this.t<=t;)this.data[this.t++]=0;for(this.data[t]+=e;this.data[t]>=this.DV;)this.data[t]-=this.DV,++t>=this.t&&(this.data[this.t++]=0),++this.data[t]}}function He(){}function Ve(e){return e}function $e(e,t,n){e.multiplyTo(t,n)}function We(e,t){e.squareTo(t)}function Ge(e){return this.exp(e,new He)}function Ye(e,t,n){var r=Math.min(this.t+e.t,t),i;for(n.s=0,n.t=r;r>0;)n.data[--r]=0;for(i=n.t-this.t;r=0;)n.data[r]=0;for(r=Math.max(t-this.t,0);r2*this.m.t)return e.mod(this.m);if(e.compareTo(this.m)<0)return e;var t=l();return e.copyTo(t),this.reduce(t),t}function Xe(e){return e}function et(e){for(e.drShiftTo(this.m.t-1,this.r2),e.t>this.m.t+1&&(e.t=this.m.t+1,e.clamp()),this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3),this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2);e.compareTo(this.r2)<0;)e.dAddOffset(1,this.m.t+1);for(e.subTo(this.r2,e);e.compareTo(this.m)>=0;)e.subTo(this.m,e)}function tt(e,t){e.squareTo(t),this.reduce(t)}function nt(e,t,n){e.multiplyTo(t,n),this.reduce(n)}function rt(e,t){var n=e.bitLength(),r,i=w(1),o;if(n<=0)return i;r=n<18?1:n<48?3:n<144?4:n<768?5:6,o=n<8?new L(t):t.isEven()?new Je(t):new $(t);var s=new Array,a=3,u=r-1,c=(1<1){var h=l();for(o.sqrTo(s[1],h);a<=c;)s[a]=l(),o.mulTo(h,s[a-2],s[a]),a+=2}var f=e.t-1,p,d=!0,m=l(),g;for(n=T(e.data[f])-1;f>=0;){for(n>=u?p=e.data[f]>>n-u&c:(p=(e.data[f]&(1<0&&(p|=e.data[f-1]>>this.DB+n-u)),a=r;0==(1&p);)p>>=1,--a;if((n-=a)<0&&(n+=this.DB,--f),d)s[p].copyTo(i),d=!1;else{for(;a>1;)o.sqrTo(i,m),o.sqrTo(m,i),a-=2;a>0?o.sqrTo(i,m):(g=i,i=m,m=g),o.mulTo(m,s[p],i)}for(;f>=0&&0==(e.data[f]&1<0&&(t.rShiftTo(o,t),n.rShiftTo(o,n));t.signum()>0;)(i=t.getLowestSetBit())>0&&t.rShiftTo(i,t),(i=n.getLowestSetBit())>0&&n.rShiftTo(i,n),t.compareTo(n)>=0?(t.subTo(n,t),t.rShiftTo(1,t)):(n.subTo(t,n),n.rShiftTo(1,n));return o>0&&n.lShiftTo(o,n),n}function ot(e){if(e<=0)return 0;var t=this.DV%e,n=this.s<0?e-1:0;if(this.t>0)if(0==t)n=this.data[0]%e;else for(var r=this.t-1;r>=0;--r)n=(t*n+this.data[r])%e;return n}function st(e){var t=e.isEven();if(this.isEven()&&t||0==e.signum())return a.ZERO;for(var n=e.clone(),r=this.clone(),i=w(1),o=w(0),s=w(0),l=w(1);0!=n.signum();){for(;n.isEven();)n.rShiftTo(1,n),t?(i.isEven()&&o.isEven()||(i.addTo(this,i),o.subTo(e,o)),i.rShiftTo(1,i)):o.isEven()||o.subTo(e,o),o.rShiftTo(1,o);for(;r.isEven();)r.rShiftTo(1,r),t?(s.isEven()&&l.isEven()||(s.addTo(this,s),l.subTo(e,l)),s.rShiftTo(1,s)):l.isEven()||l.subTo(e,l),l.rShiftTo(1,l);n.compareTo(r)>=0?(n.subTo(r,n),t&&i.subTo(s,i),o.subTo(l,o)):(r.subTo(n,r),t&&s.subTo(i,s),l.subTo(o,l))}return 0!=r.compareTo(a.ONE)?a.ZERO:l.compareTo(e)>=0?l.subtract(e):l.signum()<0?(l.addTo(e,l),l.signum()<0?l.add(e):l):l}L.prototype.convert=U,L.prototype.revert=q,L.prototype.reduce=z,L.prototype.mulTo=K,L.prototype.sqrTo=H,$.prototype.convert=W,$.prototype.revert=G,$.prototype.reduce=Y,$.prototype.mulTo=J,$.prototype.sqrTo=Z,a.prototype.copyTo=b,a.prototype.fromInt=_,a.prototype.fromString=k,a.prototype.clamp=E,a.prototype.dlShiftTo=j,a.prototype.drShiftTo=R,a.prototype.lShiftTo=B,a.prototype.rShiftTo=O,a.prototype.subTo=P,a.prototype.multiplyTo=N,a.prototype.squareTo=D,a.prototype.divRemTo=F,a.prototype.invDigit=V,a.prototype.isEven=Q,a.prototype.exp=X,a.prototype.toString=S,a.prototype.negate=x,a.prototype.abs=C,a.prototype.compareTo=A,a.prototype.bitLength=I,a.prototype.mod=M,a.prototype.modPowInt=ee,a.ZERO=w(0),a.ONE=w(1),He.prototype.convert=Ve,He.prototype.revert=Ve,He.prototype.mulTo=$e,He.prototype.sqrTo=We,Je.prototype.convert=Qe,Je.prototype.revert=Xe,Je.prototype.reduce=et,Je.prototype.mulTo=nt,Je.prototype.sqrTo=tt;var at=[2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331,337,347,349,353,359,367,373,379,383,389,397,401,409,419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,509],lt=(1<<26)/at[at.length-1];function ut(e){var t,n=this.abs();if(1==n.t&&n.data[0]<=at[at.length-1]){for(t=0;t=0);var l=o.modPow(r,this);if(0!=l.compareTo(a.ONE)&&0!=l.compareTo(t)){for(var u=1;u++4){var t=e;e=r.util.createBuffer();for(var n=0;n0))return!0;for(var r=0;r0))return!0;for(var r=0;r0)return!1;var n=e.length(),r=e.at(n-1);return!(r>this.blockSize<<2)&&(e.truncate(r),!0)},i.cbc=function(e){e=e||{},this.name="CBC",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=new Array(this._ints),this._outBlock=new Array(this._ints)},i.cbc.prototype.start=function(e){if(null===e.iv){if(!this._prev)throw new Error("Invalid IV parameter.");this._iv=this._prev.slice(0)}else{if(!("iv"in e))throw new Error("Invalid IV parameter.");this._iv=o(e.iv),this._prev=this._iv.slice(0)}},i.cbc.prototype.encrypt=function(e,t,n){if(e.length()0))return!0;for(var r=0;r0))return!0;for(var r=0;r0)return!1;var n=e.length(),r=e.at(n-1);return!(r>this.blockSize<<2)&&(e.truncate(r),!0)},i.cfb=function(e){e=e||{},this.name="CFB",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._ints),this._partialBlock=new Array(this._ints),this._partialOutput=r.util.createBuffer(),this._partialBytes=0},i.cfb.prototype.start=function(e){if(!("iv"in e))throw new Error("Invalid IV parameter.");this._iv=o(e.iv),this._inBlock=this._iv.slice(0),this._partialBytes=0},i.cfb.prototype.encrypt=function(e,t,n){var r=e.length();if(0===r)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&r>=this.blockSize)for(var i=0;i0&&(o=this.blockSize-o),this._partialOutput.clear();for(var i=0;i0)e.read-=this.blockSize;else for(var i=0;i0&&this._partialOutput.getBytes(this._partialBytes),o>0&&!n)return t.putBytes(this._partialOutput.getBytes(o-this._partialBytes)),this._partialBytes=o,!0;t.putBytes(this._partialOutput.getBytes(r-this._partialBytes)),this._partialBytes=0}},i.cfb.prototype.decrypt=function(e,t,n){var r=e.length();if(0===r)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&r>=this.blockSize)for(var i=0;i0&&(o=this.blockSize-o),this._partialOutput.clear();for(var i=0;i0)e.read-=this.blockSize;else for(var i=0;i0&&this._partialOutput.getBytes(this._partialBytes),o>0&&!n)return t.putBytes(this._partialOutput.getBytes(o-this._partialBytes)),this._partialBytes=o,!0;t.putBytes(this._partialOutput.getBytes(r-this._partialBytes)),this._partialBytes=0}},i.ofb=function(e){e=e||{},this.name="OFB",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._ints),this._partialOutput=r.util.createBuffer(),this._partialBytes=0},i.ofb.prototype.start=function(e){if(!("iv"in e))throw new Error("Invalid IV parameter.");this._iv=o(e.iv),this._inBlock=this._iv.slice(0),this._partialBytes=0},i.ofb.prototype.encrypt=function(e,t,n){var r=e.length();if(0===e.length())return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&r>=this.blockSize)for(var i=0;i0&&(o=this.blockSize-o),this._partialOutput.clear();for(var i=0;i0)e.read-=this.blockSize;else for(var i=0;i0&&this._partialOutput.getBytes(this._partialBytes),o>0&&!n)return t.putBytes(this._partialOutput.getBytes(o-this._partialBytes)),this._partialBytes=o,!0;t.putBytes(this._partialOutput.getBytes(r-this._partialBytes)),this._partialBytes=0}},i.ofb.prototype.decrypt=i.ofb.prototype.encrypt,i.ctr=function(e){e=e||{},this.name="CTR",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._ints),this._partialOutput=r.util.createBuffer(),this._partialBytes=0},i.ctr.prototype.start=function(e){if(!("iv"in e))throw new Error("Invalid IV parameter.");this._iv=o(e.iv),this._inBlock=this._iv.slice(0),this._partialBytes=0},i.ctr.prototype.encrypt=function(e,t,n){var r=e.length();if(0===r)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&r>=this.blockSize)for(var i=0;i0&&(o=this.blockSize-o),this._partialOutput.clear();for(var i=0;i0&&(e.read-=this.blockSize),this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),o>0&&!n)return t.putBytes(this._partialOutput.getBytes(o-this._partialBytes)),this._partialBytes=o,!0;t.putBytes(this._partialOutput.getBytes(r-this._partialBytes)),this._partialBytes=0}s(this._inBlock)},i.ctr.prototype.decrypt=i.ctr.prototype.encrypt,i.gcm=function(e){e=e||{},this.name="GCM",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=new Array(this._ints),this._outBlock=new Array(this._ints),this._partialOutput=r.util.createBuffer(),this._partialBytes=0,this._R=3774873600},i.gcm.prototype.start=function(e){if(!("iv"in e))throw new Error("Invalid IV parameter.");var t=r.util.createBuffer(e.iv),n;if(this._cipherLength=0,n="additionalData"in e?r.util.createBuffer(e.additionalData):r.util.createBuffer(),this._tagLength="tagLength"in e?e.tagLength:128,this._tag=null,e.decrypt&&(this._tag=r.util.createBuffer(e.tag).getBytes(),this._tag.length!==this._tagLength/8))throw new Error("Authentication tag does not match tag length.");this._hashBlock=new Array(this._ints),this.tag=null,this._hashSubkey=new Array(this._ints),this.cipher.encrypt([0,0,0,0],this._hashSubkey),this.componentBits=4,this._m=this.generateHashTable(this._hashSubkey,this.componentBits);var i=t.length();if(12===i)this._j0=[t.getInt32(),t.getInt32(),t.getInt32(),1];else{for(this._j0=[0,0,0,0];t.length()>0;)this._j0=this.ghash(this._hashSubkey,this._j0,[t.getInt32(),t.getInt32(),t.getInt32(),t.getInt32()]);this._j0=this.ghash(this._hashSubkey,this._j0,[0,0].concat(a(8*i)))}this._inBlock=this._j0.slice(0),s(this._inBlock),this._partialBytes=0,n=r.util.createBuffer(n),this._aDataLength=a(8*n.length());var o=n.length()%this.blockSize;for(o&&n.fillWithByte(0,this.blockSize-o),this._s=[0,0,0,0];n.length()>0;)this._s=this.ghash(this._hashSubkey,this._s,[n.getInt32(),n.getInt32(),n.getInt32(),n.getInt32()])},i.gcm.prototype.encrypt=function(e,t,n){var r=e.length();if(0===r)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&r>=this.blockSize){for(var i=0;i0&&(o=this.blockSize-o),this._partialOutput.clear();for(var i=0;i0&&this._partialOutput.getBytes(this._partialBytes),o>0&&!n)return e.read-=this.blockSize,t.putBytes(this._partialOutput.getBytes(o-this._partialBytes)),this._partialBytes=o,!0;t.putBytes(this._partialOutput.getBytes(r-this._partialBytes)),this._partialBytes=0}this._s=this.ghash(this._hashSubkey,this._s,this._outBlock),s(this._inBlock)},i.gcm.prototype.decrypt=function(e,t,n){var r=e.length();if(r0))return!0;this.cipher.encrypt(this._inBlock,this._outBlock),s(this._inBlock),this._hashBlock[0]=e.getInt32(),this._hashBlock[1]=e.getInt32(),this._hashBlock[2]=e.getInt32(),this._hashBlock[3]=e.getInt32(),this._s=this.ghash(this._hashSubkey,this._s,this._hashBlock);for(var i=0;i0;--r)t[r]=e[r]>>>1|(1&e[r-1])<<31;t[0]=e[0]>>>1,n&&(t[0]^=this._R)},i.gcm.prototype.tableMultiply=function(e){for(var t=[0,0,0,0],n=0;n<32;++n){var r=n/8|0,i=e[r]>>>4*(7-n%8)&15,o=this._m[n][i];t[0]^=o[0],t[1]^=o[1],t[2]^=o[2],t[3]^=o[3]}return t},i.gcm.prototype.ghash=function(e,t,n){return t[0]^=n[0],t[1]^=n[1],t[2]^=n[2],t[3]^=n[3],this.tableMultiply(t)},i.gcm.prototype.generateHashTable=function(e,t){for(var n=8/t,r=4*n,i=16*n,o=new Array(i),s=0;s>>1,i=new Array(n);i[r]=e.slice(0);for(var o=r>>>1;o>0;)this.pow(i[2*o],i[o]=[]),o>>=1;for(o=2;o4||!a||"sha1"===a))return"string"!=typeof a&&(a="sha1"),e=new t(e,"binary"),n=new t(n,"binary"),l?4===o.pbkdf2Sync.length?o.pbkdf2(e,n,i,s,function(e,t){if(e)return l(e);l(null,t.toString("binary"))}):o.pbkdf2(e,n,i,s,a,function(e,t){if(e)return l(e);l(null,t.toString("binary"))}):4===o.pbkdf2Sync.length?o.pbkdf2Sync(e,n,i,s).toString("binary"):o.pbkdf2Sync(e,n,i,s,a).toString("binary");if(void 0!==a&&null!==a||(a="sha1"),"string"==typeof a){if(!(a in r.md.algorithms))throw new Error("Unknown hash algorithm: "+a);a=r.md[a].create()}var u=a.digestLength;if(s>4294967295*u){var c=new Error("Derived key is too long.");if(l)return l(c);throw c}var h=Math.ceil(s/u),f=s-(h-1)*u,p=r.hmac.create();p.start(a,e);var d="",m,g,y;if(!l){for(var v=1;v<=h;++v){p.start(null,null),p.update(n),p.update(r.util.int32ToBytes(v)),m=y=p.digest().getBytes();for(var b=2;b<=i;++b)p.start(null,null),p.update(y),g=p.digest().getBytes(),m=r.util.xorBytes(m,g,u),y=g;d+=vh)return l(null,d);p.start(null,null),p.update(n),p.update(r.util.int32ToBytes(v)),m=y=p.digest().getBytes(),b=2,w()}function w(){if(b<=i)return p.start(null,null),p.update(y),g=p.digest().getBytes(),m=r.util.xorBytes(m,g,u),y=g,++b,r.util.setImmediate(w);d+=v>6],i=0==(32&n);if(31==(31&n)){let r=n;for(n=0;128==(128&r);){if(r=e.readUInt8(t),e.isError(r))return r;n<<=7,n|=127&r}}else n&=31;const o=a.tag[n];return{cls:r,primitive:i,tag:n,tagStr:o}}function h(e,t,n){let r=e.readUInt8(n);if(e.isError(r))return r;if(!t&&128===r)return null;if(0==(128&r))return r;const i=127&r;if(i>4)return e.error("length octect is too long");r=0;for(let t=0;t=31?r.error("Multi-octet tag encoding unsupported"):(t||(i|=32),i|=a.tagClassByName[n||"universal"]<<6,i)}e.exports=l,l.prototype.encode=function e(t,n){return this.tree._encode(t,n).join()},r(u,s.Node),u.prototype._encodeComposite=function e(t,n,r,o){const s=h(t,n,r,this.reporter);if(o.length<128){const e=new i(2);return e[0]=s,e[1]=o.length,this._createEncoderBuffer([e,o])}let a=1;for(let e=o.length;e>=256;e>>=8)a++;const l=new i(2+a);l[0]=s,l[1]=128|a;for(let e=1+a,t=o.length;t>0;e--,t>>=8)l[e]=255&t;return this._createEncoderBuffer([l,o])},u.prototype._encodeStr=function e(t,n){if("bitstr"===n)return this._createEncoderBuffer([0|t.unused,t.data]);if("bmpstr"===n){const e=new i(2*t.length);for(let n=0;n=40)return this.reporter.error("Second objid identifier OOB");t.splice(0,2,40*t[0]+t[1])}let o=0;for(let e=0;e=128;n>>=7)o++}const s=new i(o);let a=s.length-1;for(let e=t.length-1;e>=0;e--){let n=t[e];for(s[a--]=127&n;(n>>=7)>0;)s[a--]=128|127&n}return this._createEncoderBuffer(s)},u.prototype._encodeTime=function e(t,n){let r;const i=new Date(t);return"gentime"===n?r=[c(i.getUTCFullYear()),c(i.getUTCMonth()+1),c(i.getUTCDate()),c(i.getUTCHours()),c(i.getUTCMinutes()),c(i.getUTCSeconds()),"Z"].join(""):"utctime"===n?r=[c(i.getUTCFullYear()%100),c(i.getUTCMonth()+1),c(i.getUTCDate()),c(i.getUTCHours()),c(i.getUTCMinutes()),c(i.getUTCSeconds()),"Z"].join(""):this.reporter.error("Encoding "+n+" time is not supported yet"),this._encodeStr(r,"octstr")},u.prototype._encodeNull=function e(){return this._createEncoderBuffer("")},u.prototype._encodeInt=function e(t,n){if("string"==typeof t){if(!n)return this.reporter.error("String int or enum given, but no values map");if(!n.hasOwnProperty(t))return this.reporter.error("Values map doesn't contain: "+JSON.stringify(t));t=n[t]}if("number"!=typeof t&&!i.isBuffer(t)){const e=t.toArray();!t.sign&&128&e[0]&&e.unshift(0),t=new i(e)}if(i.isBuffer(t)){let e=t.length;0===t.length&&e++;const n=new i(e);return t.copy(n),0===t.length&&(n[0]=0),this._createEncoderBuffer(n)}if(t<128)return this._createEncoderBuffer(t);if(t<256)return this._createEncoderBuffer([0,t]);let r=1;for(let e=t;e>=256;e>>=8)r++;const o=new Array(r);for(let e=o.length-1;e>=0;e--)o[e]=255&t,t>>=8;return 128&o[0]&&o.unshift(0),this._createEncoderBuffer(new i(o))},u.prototype._encodeBool=function e(t){return this._createEncoderBuffer(t?255:0)},u.prototype._use=function e(t,n){return"function"==typeof t&&(t=t(n)),t._getEncoder("der").tree},u.prototype._skipDefault=function e(t,n,r){const i=this._baseState;let o;if(null===i.default)return!1;const s=t.join();if(void 0===i.defaultBuffer&&(i.defaultBuffer=this._encodeValue(i.default,n,r).join()),s.length!==i.defaultBuffer.length)return!1;for(o=0;o=this._blockSize;){for(var o=this._blockOffset;o0;++a)this._length[a]+=l,l=this._length[a]/4294967296|0,l>0&&(this._length[a]-=4294967296*l);return this},a.prototype._update=function(){throw new Error("_update is not implemented")},a.prototype.digest=function(e){if(this._finalized)throw new Error("Digest already called");this._finalized=!0;var t=this._digest();void 0!==e&&(t=t.toString(e)),this._block.fill(0),this._blockOffset=0;for(var n=0;n<4;++n)this._length[n]=0;return t},a.prototype._digest=function(){throw new Error("_digest is not implemented")},e.exports=a},function(e,t,n){"use strict";(function(t,r){var i=n(11);e.exports=E;var o=n(56),s;E.ReadableState=k;var a=n(6).EventEmitter,l=function(e,t){return e.listeners(t).length},u=n(380),c=n(5).Buffer,h=t.Uint8Array||function(){};function f(e){return c.from(e)}function p(e){return c.isBuffer(e)||e instanceof h}var d=n(8);d.inherits=n(3);var m=n(770),g=void 0;g=m&&m.debuglog?m.debuglog("stream"):function(){};var y=n(771),v=n(381),b;d.inherits(E,u);var _=["error","close","destroy","pause","resume"];function w(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)}function k(e,t){s=s||n(98),e=e||{};var r=t instanceof s;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 y,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.destroyed=!1,this.defaultEncoding=e.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,e.encoding&&(b||(b=n(24).StringDecoder),this.decoder=new b(e.encoding),this.encoding=e.encoding)}function E(e){if(s=s||n(98),!(this instanceof E))return new E(e);this._readableState=new k(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 S(e,t,n,r,i){var o=e._readableState,s;null===t?(o.reading=!1,R(e,o)):(i||(s=C(o,t)),s?e.emit("error",s):o.objectMode||t&&t.length>0?("string"==typeof t||o.objectMode||Object.getPrototypeOf(t)===c.prototype||(t=f(t)),r?o.endEmitted?e.emit("error",new Error("stream.unshift() after end event")):x(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?x(e,o,t,!1):P(e,o)):x(e,o,t,!1))):r||(o.reading=!1));return A(o)}function x(e,t,n,r){t.flowing&&0===t.length&&!t.sync?(e.emit("data",n),e.read(0)):(t.length+=t.objectMode?1:n.length,r?t.buffer.unshift(n):t.buffer.push(n),t.needReadable&&B(e)),P(e,t)}function C(e,t){var n;return p(t)||"string"==typeof t||void 0===t||e.objectMode||(n=new TypeError("Invalid non-string/buffer chunk")),n}function A(e){return!e.ended&&(e.needReadable||e.length=T?e=T:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}function j(e,t){return e<=0||0===t.length&&t.ended?0:t.objectMode?1:e!=e?t.flowing&&t.length?t.buffer.head.data.length:t.length:(e>t.highWaterMark&&(t.highWaterMark=I(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}function R(e,t){if(!t.ended){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,B(e)}}function B(e){var t=e._readableState;t.needReadable=!1,t.emittedReadable||(g("emitReadable",t.flowing),t.emittedReadable=!0,t.sync?i.nextTick(O,e):O(e))}function O(e){g("emit readable"),e.emit("readable"),U(e)}function P(e,t){t.readingMore||(t.readingMore=!0,i.nextTick(N,e,t))}function N(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=z(e,t.buffer,t.decoder),n);var n}function z(e,t,n){var r;return eo.length?o.length:e;if(s===o.length?i+=o:i+=o.slice(0,e),e-=s,0===e){s===o.length?(++r,n.next?t.head=n.next:t.head=t.tail=null):(t.head=n,n.data=o.slice(s));break}++r}return t.length-=r,i}function H(e,t){var n=c.allocUnsafe(e),r=t.head,i=1;for(r.data.copy(n),e-=r.data.length;r=r.next;){var o=r.data,s=e>o.length?o.length:e;if(o.copy(n,n.length-e,0,s),e-=s,0===e){s===o.length?(++i,r.next?t.head=r.next:t.head=t.tail=null):(t.head=r,r.data=o.slice(s));break}++i}return t.length-=i,n}function V(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($,t,e))}function $(e,t){e.endEmitted||0!==e.length||(e.endEmitted=!0,t.readable=!1,t.emit("end"))}function W(e,t){for(var n=0,r=e.length;n=t.highWaterMark||t.ended))return g("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?V(this):B(this),null;if(e=j(e,t),0===e&&t.ended)return 0===t.length&&V(this),null;var r=t.needReadable,i;return g("need readable",r),(0===t.length||t.length-e0?q(e,t):null,null===i?(t.needReadable=!0,e=0):t.length-=e,0===t.length&&(t.ended||(t.needReadable=!0),n!==e&&t.ended&&V(this)),null!==i&&this.emit("data",i),i},E.prototype._read=function(e){this.emit("error",new Error("_read() is not implemented"))},E.prototype.pipe=function(e,t){var n=this,o=this._readableState;switch(o.pipesCount){case 0:o.pipes=e;break;case 1:o.pipes=[o.pipes,e];break;default:o.pipes.push(e)}o.pipesCount+=1,g("pipe count=%d opts=%j",o.pipesCount,t);var s=(!t||!1!==t.end)&&e!==r.stdout&&e!==r.stderr,a=s?c:_;function u(e,t){g("onunpipe"),e===n&&t&&!1===t.hasUnpiped&&(t.hasUnpiped=!0,p())}function c(){g("onend"),e.end()}o.endEmitted?i.nextTick(a):n.once("end",a),e.on("unpipe",u);var h=D(n);e.on("drain",h);var f=!1;function p(){g("cleanup"),e.removeListener("close",v),e.removeListener("finish",b),e.removeListener("drain",h),e.removeListener("error",y),e.removeListener("unpipe",u),n.removeListener("end",c),n.removeListener("end",_),n.removeListener("data",m),f=!0,!o.awaitDrain||e._writableState&&!e._writableState.needDrain||h()}var d=!1;function m(t){g("ondata"),d=!1;var r=e.write(t);!1!==r||d||((1===o.pipesCount&&o.pipes===e||o.pipesCount>1&&-1!==W(o.pipes,e))&&!f&&(g("false write response, pause",n._readableState.awaitDrain),n._readableState.awaitDrain++,d=!0),n.pause())}function y(t){g("onerror",t),_(),e.removeListener("error",y),0===l(e,"error")&&e.emit("error",t)}function v(){e.removeListener("finish",b),_()}function b(){g("onfinish"),e.removeListener("close",v),_()}function _(){g("unpipe"),n.unpipe(e)}return n.on("data",m),w(e,"error",y),e.once("close",v),e.once("finish",b),e.emit("pipe",n),o.flowing||(g("pipe resume"),n.resume()),e},E.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?this:(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 o=0;o>>32-t}function m(e,t,n,r,i,o,s,a){return d(e+(t^n^r)+o+s|0,a)+i|0}function g(e,t,n,r,i,o,s,a){return d(e+(t&n|~t&r)+o+s|0,a)+i|0}function y(e,t,n,r,i,o,s,a){return d(e+((t|~n)^r)+o+s|0,a)+i|0}function v(e,t,n,r,i,o,s,a){return d(e+(t&r|n&~r)+o+s|0,a)+i|0}function b(e,t,n,r,i,o,s,a){return d(e+(t^(n|~r))+o+s|0,a)+i|0}i(p,o),p.prototype._update=function(){for(var e=s,t=0;t<16;++t)e[t]=this._block.readInt32LE(4*t);for(var n=0|this._a,r=0|this._b,i=0|this._c,o=0|this._d,p=0|this._e,_=0|this._a,w=0|this._b,k=0|this._c,E=0|this._d,S=0|this._e,x=0;x<80;x+=1){var C,A;x<16?(C=m(n,r,i,o,p,e[a[x]],h[0],u[x]),A=b(_,w,k,E,S,e[l[x]],f[0],c[x])):x<32?(C=g(n,r,i,o,p,e[a[x]],h[1],u[x]),A=v(_,w,k,E,S,e[l[x]],f[1],c[x])):x<48?(C=y(n,r,i,o,p,e[a[x]],h[2],u[x]),A=y(_,w,k,E,S,e[l[x]],f[2],c[x])):x<64?(C=v(n,r,i,o,p,e[a[x]],h[3],u[x]),A=g(_,w,k,E,S,e[l[x]],f[3],c[x])):(C=b(n,r,i,o,p,e[a[x]],h[4],u[x]),A=m(_,w,k,E,S,e[l[x]],f[4],c[x])),n=p,p=o,o=d(i,10),i=r,r=C,_=S,S=E,E=d(k,10),k=w,w=A}var T=this._b+i+E|0;this._b=this._c+o+S|0,this._c=this._d+p+_|0,this._d=this._e+n+w|0,this._e=this._a+r+k|0,this._a=T},p.prototype._digest=function(){this._block[this._blockOffset++]=128,this._blockOffset>56&&(this._block.fill(0,this._blockOffset,64),this._update(),this._blockOffset=0),this._block.fill(0,this._blockOffset,56),this._block.writeUInt32LE(this._length[0],56),this._block.writeUInt32LE(this._length[1],60),this._update();var e=r.alloc?r.alloc(20):new r(20);return e.writeInt32LE(this._a,0),e.writeInt32LE(this._b,4),e.writeInt32LE(this._c,8),e.writeInt32LE(this._d,12),e.writeInt32LE(this._e,16),e},e.exports=p},function(e,t,n){var t=e.exports=function e(n){n=n.toLowerCase();var r=t[n];if(!r)throw new Error(n+" is not supported (we accept pull requests)");return new r};t.sha=n(778),t.sha1=n(779),t.sha224=n(780),t.sha256=n(385),t.sha384=n(781),t.sha512=n(386)},function(e,t,n){var r=n(3),i=n(120),o=n(5).Buffer,s=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298],a=new Array(64);function l(){this.init(),this._w=a,i.call(this,64,56)}function u(e,t,n){return n^e&(t^n)}function c(e,t,n){return e&t|n&(e|t)}function h(e){return(e>>>2|e<<30)^(e>>>13|e<<19)^(e>>>22|e<<10)}function f(e){return(e>>>6|e<<26)^(e>>>11|e<<21)^(e>>>25|e<<7)}function p(e){return(e>>>7|e<<25)^(e>>>18|e<<14)^e>>>3}function d(e){return(e>>>17|e<<15)^(e>>>19|e<<13)^e>>>10}r(l,i),l.prototype.init=function(){return this._a=1779033703,this._b=3144134277,this._c=1013904242,this._d=2773480762,this._e=1359893119,this._f=2600822924,this._g=528734635,this._h=1541459225,this},l.prototype._update=function(e){for(var t=this._w,n=0|this._a,r=0|this._b,i=0|this._c,o=0|this._d,a=0|this._e,l=0|this._f,m=0|this._g,g=0|this._h,y=0;y<16;++y)t[y]=e.readInt32BE(4*y);for(;y<64;++y)t[y]=d(t[y-2])+t[y-7]+p(t[y-15])+t[y-16]|0;for(var v=0;v<64;++v){var b=g+f(a)+u(a,l,m)+s[v]+t[v]|0,_=h(n)+c(n,r,i)|0;g=m,m=l,l=a,a=o+b|0,o=i,i=r,r=n,n=b+_|0}this._a=n+this._a|0,this._b=r+this._b|0,this._c=i+this._c|0,this._d=o+this._d|0,this._e=a+this._e|0,this._f=l+this._f|0,this._g=m+this._g|0,this._h=g+this._h|0},l.prototype._hash=function(){var e=o.allocUnsafe(32);return e.writeInt32BE(this._a,0),e.writeInt32BE(this._b,4),e.writeInt32BE(this._c,8),e.writeInt32BE(this._d,12),e.writeInt32BE(this._e,16),e.writeInt32BE(this._f,20),e.writeInt32BE(this._g,24),e.writeInt32BE(this._h,28),e},e.exports=l},function(e,t,n){var r=n(3),i=n(120),o=n(5).Buffer,s=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591],a=new Array(160);function l(){this.init(),this._w=a,i.call(this,128,112)}function u(e,t,n){return n^e&(t^n)}function c(e,t,n){return e&t|n&(e|t)}function h(e,t){return(e>>>28|t<<4)^(t>>>2|e<<30)^(t>>>7|e<<25)}function f(e,t){return(e>>>14|t<<18)^(e>>>18|t<<14)^(t>>>9|e<<23)}function p(e,t){return(e>>>1|t<<31)^(e>>>8|t<<24)^e>>>7}function d(e,t){return(e>>>1|t<<31)^(e>>>8|t<<24)^(e>>>7|t<<25)}function m(e,t){return(e>>>19|t<<13)^(t>>>29|e<<3)^e>>>6}function g(e,t){return(e>>>19|t<<13)^(t>>>29|e<<3)^(e>>>6|t<<26)}function y(e,t){return e>>>0>>0?1:0}r(l,i),l.prototype.init=function(){return this._ah=1779033703,this._bh=3144134277,this._ch=1013904242,this._dh=2773480762,this._eh=1359893119,this._fh=2600822924,this._gh=528734635,this._hh=1541459225,this._al=4089235720,this._bl=2227873595,this._cl=4271175723,this._dl=1595750129,this._el=2917565137,this._fl=725511199,this._gl=4215389547,this._hl=327033209,this},l.prototype._update=function(e){for(var t=this._w,n=0|this._ah,r=0|this._bh,i=0|this._ch,o=0|this._dh,a=0|this._eh,l=0|this._fh,v=0|this._gh,b=0|this._hh,_=0|this._al,w=0|this._bl,k=0|this._cl,E=0|this._dl,S=0|this._el,x=0|this._fl,C=0|this._gl,A=0|this._hl,T=0;T<32;T+=2)t[T]=e.readInt32BE(4*T),t[T+1]=e.readInt32BE(4*T+4);for(;T<160;T+=2){var I=t[T-30],j=t[T-30+1],R=p(I,j),B=d(j,I);I=t[T-4],j=t[T-4+1];var O=m(I,j),P=g(j,I),N=t[T-14],D=t[T-14+1],F=t[T-32],M=t[T-32+1],L=B+D|0,U=R+N+y(L,B)|0;L=L+P|0,U=U+O+y(L,P)|0,L=L+M|0,U=U+F+y(L,M)|0,t[T]=U,t[T+1]=L}for(var q=0;q<160;q+=2){U=t[q],L=t[q+1];var z=c(n,r,i),K=c(_,w,k),H=h(n,_),V=h(_,n),$=f(a,S),W=f(S,a),G=s[q],Y=s[q+1],Z=u(a,l,v),J=u(S,x,C),Q=A+W|0,X=b+$+y(Q,A)|0;Q=Q+J|0,X=X+Z+y(Q,J)|0,Q=Q+Y|0,X=X+G+y(Q,Y)|0,Q=Q+L|0,X=X+U+y(Q,L)|0;var ee=V+K|0,te=H+z+y(ee,V)|0;b=v,A=C,v=l,C=x,l=a,x=S,S=E+Q|0,a=o+X+y(S,E)|0,o=i,E=k,i=r,k=w,r=n,w=_,_=Q+ee|0,n=X+te+y(_,Q)|0}this._al=this._al+_|0,this._bl=this._bl+w|0,this._cl=this._cl+k|0,this._dl=this._dl+E|0,this._el=this._el+S|0,this._fl=this._fl+x|0,this._gl=this._gl+C|0,this._hl=this._hl+A|0,this._ah=this._ah+n+y(this._al,_)|0,this._bh=this._bh+r+y(this._bl,w)|0,this._ch=this._ch+i+y(this._cl,k)|0,this._dh=this._dh+o+y(this._dl,E)|0,this._eh=this._eh+a+y(this._el,S)|0,this._fh=this._fh+l+y(this._fl,x)|0,this._gh=this._gh+v+y(this._gl,C)|0,this._hh=this._hh+b+y(this._hl,A)|0},l.prototype._hash=function(){var e=o.allocUnsafe(64);function t(t,n,r){e.writeInt32BE(t,r),e.writeInt32BE(n,r+4)}return t(this._ah,this._al,0),t(this._bh,this._bl,8),t(this._ch,this._cl,16),t(this._dh,this._dl,24),t(this._eh,this._el,32),t(this._fh,this._fl,40),t(this._gh,this._gl,48),t(this._hh,this._hl,56),e},e.exports=l},function(e,t,n){"use strict";var r=n(5).Buffer,i=n(195),o=n(388);function s(e,t){null===e&&null===t?(this.x=this.y=null,this.inf=!0):(this.x=e,this.y=t,this.inf=!1)}s.fromPublicKey=function(e){var t=e[0],n,r;return 33!==e.length||2!==t&&3!==t?65!==e.length||4!==t&&6!==t&&7!==t?null:(n=i.fromBuffer(e.slice(1,33)),r=i.fromBuffer(e.slice(33,65)),n.ucmp(i.p)>=0||r.ucmp(i.p)>=0?null:6!==t&&7!==t||r.isOdd()===(7===t)?0!==n.redSqr().redMul(n).redIAdd7().ucmp(r.redSqr())?null:new s(n,r):null):(n=i.fromBuffer(e.slice(1,33)),n.ucmp(i.p)>=0?null:(r=n.redSqr().redMul(n).redIAdd7().redSqrt(),null===r?null:(3===t!==r.isOdd()&&(r=r.redNeg()),new s(n,r))))},s.prototype.toPublicKey=function(e){var t=this.x,n=this.y,i;return e?(i=r.alloc(33),i[0]=n.isOdd()?3:2,t.toBuffer().copy(i,1)):(i=r.alloc(65),i[0]=4,t.toBuffer().copy(i,1),n.toBuffer().copy(i,33)),i},s.fromECJPoint=function(e){if(e.inf)return new s(null,null);var t=e.z.redInvm(),n=t.redSqr(),r=e.x.redMul(n),i=e.y.redMul(n).redMul(t);return new s(r,i)},s.prototype.toECJPoint=function(){return this.inf?new o(null,null,null):new o(this.x,this.y,o.one)},s.prototype.neg=function(){return this.inf?this:new s(this.x,this.y.redNeg())},s.prototype.add=function(e){if(this.inf)return e;if(e.inf)return this;if(0===this.x.ucmp(e.x))return 0===this.y.ucmp(e.y)?this.dbl():new s(null,null);var t=this.y.redSub(e.y);t.isZero()||(t=t.redMul(this.x.redSub(e.x).redInvm()));var n=t.redSqr().redISub(this.x).redISub(e.x),r=t.redMul(this.x.redSub(n)).redISub(this.y);return new s(n,r)},s.prototype.dbl=function(){if(this.inf)return this;var e=this.y.redAdd(this.y);if(e.isZero())return new s(null,null);var t=this.x.redSqr(),n=t.redAdd(t).redIAdd(t).redMul(e.redInvm()),r=n.redSqr().redISub(this.x.redAdd(this.x)),i=n.redMul(this.x.redSub(r)).redISub(this.y);return new s(r,i)},s.prototype.mul=function(e){for(var t=this._getNAFPoints(4),n=t.points,r=e.getNAF(t.wnd),i=new o(null,null,null),a=r.length-1;a>=0;a--){for(var l=0;a>=0&&0===r[a];a--,++l);if(a>=0&&(l+=1),i=i.dblp(l),a<0)break;var u=r[a];i=u>0?i.mixedAdd(n[u-1>>1]):i.mixedAdd(n[-u-1>>1].neg())}return s.fromECJPoint(i)},s.prototype._getNAFPoints1=function(){return{wnd:1,points:[this]}},s.prototype._getNAFPoints=function(e){var t=new Array((1<{r(i.subtle.sign({name:"HMAC"},t,n).then(t=>e.from(t)),o)};t.create=function(e,t,n){const l=s[e];r(i.subtle.importKey("raw",t,{name:"HMAC",hash:{name:l}},!1,["sign"]).then(t=>({digest(e,n){a(t,e,n)},length:o[e]})),n)}}).call(this,n(0).Buffer)},function(e,t,n){"use strict";const r=n(21);function i(e){return r.isMultiaddr(e)?e:r(e)}e.exports={ensureMultiaddr:i}},function(e,t,n){var r={ECB:n(805),CBC:n(806),CFB:n(807),CFB8:n(808),CFB1:n(809),OFB:n(810),CTR:n(392),GCM:n(392)},i=n(394);for(var o in i)i[o].module=r[i[o].mode];e.exports=i},function(e,t,n){var r=n(153),i=n(5).Buffer,o=n(393);function s(e){var t=e._cipher.encryptBlockRaw(e._prev);return o(e._prev),t}var a=16;t.encrypt=function(e,t){var n=Math.ceil(t.length/16),o=e._cache.length;e._cache=i.concat([e._cache,i.allocUnsafe(16*n)]);for(var a=0;a0||o>0;){var c=new i;c.update(u),c.update(e),t&&c.update(t),u=c.digest();var h=0;if(s>0){var f=a.length-s;h=Math.min(s,u.length),u.copy(a,f,0,h),s-=h}if(h0){var p=l.length-o,d=Math.min(o,u.length-h);u.copy(l,p,h,h+d),o-=d}}return u.fill(0),{key:a,iv:l}}e.exports=o},function(e,t,n){"use strict";(function(t){const r=n(70),i=n(15),o=n(31);function s(e){let n;if("string"==typeof e)n=e;else if(t.isBuffer(e))n=r.encode(e).toString();else if(i.isPeerId(e))n=e.toB58String();else{if(!o.isPeerInfo(e))throw new Error("not valid PeerId or PeerInfo, or B58Str");n=e.id.toB58String()}return n}class a{constructor(){this._peers={}}has(e){const t=s(e);return Boolean(this._peers[t])}put(e,t){const n=this._peers[e.id.toB58String()];if(!n||t)return this._peers[e.id.toB58String()]=e,e;e.multiaddrs.forEach(e=>n.multiaddrs.add(e));const r=e.isConnected();return r&&n.connect(r),e.protocols.forEach(e=>n.protocols.add(e)),!n.id.privKey&&e.id.privKey&&(n.id.privKey=e.id.privKey),!n.id.pubKey&&e.id.pubKey&&(n.id.pubKey=e.id.pubKey),n}get(e){const t=s(e),n=this._peers[t];if(n)return n;throw new Error("PeerInfo not found")}getAll(){return this._peers}getAllArray(){return Object.keys(this._peers).map(e=>this._peers[e])}getMultiaddrs(e){const t=this.get(e);return t.multiaddrs.toArray()}remove(e){const t=s(e);this._peers[t]&&delete this._peers[t]}}e.exports=a}).call(this,n(0).Buffer)},function(e,t,n){"use strict";n.r(t),n.d(t,"struct",function(){return K}),n.d(t,"superstruct",function(){return z}),n.d(t,"isStruct",function(){return y}),n.d(t,"StructError",function(){return r});class r extends TypeError{static format(e){const{type:t,path:n,value:r}=e,i=`Expected a value of type \`${t}\`${n.length?` for \`${n.join(".")}\``:""} but received \`${JSON.stringify(r)}\`.`;return i}constructor(e){const t=r.format(e);super(t);const{data:n,path:i,value:o,reason:s,type:a,errors:l=[]}=e;this.data=n,this.path=i,this.value=o,this.reason=s,this.type=a,this.errors=l,l.length||l.push(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=(new Error).stack}}var i=Object.prototype.toString,o=function e(t){if(void 0===t)return"undefined";if(null===t)return"null";var n=typeof t;if("boolean"===n)return"boolean";if("string"===n)return"string";if("number"===n)return"number";if("symbol"===n)return"symbol";if("function"===n)return h(t)?"generatorfunction":"function";if(a(t))return"array";if(d(t))return"buffer";if(p(t))return"arguments";if(u(t))return"date";if(l(t))return"error";if(c(t))return"regexp";switch(s(t)){case"Symbol":return"symbol";case"Promise":return"promise";case"WeakMap":return"weakmap";case"WeakSet":return"weakset";case"Map":return"map";case"Set":return"set";case"Int8Array":return"int8array";case"Uint8Array":return"uint8array";case"Uint8ClampedArray":return"uint8clampedarray";case"Int16Array":return"int16array";case"Uint16Array":return"uint16array";case"Int32Array":return"int32array";case"Uint32Array":return"uint32array";case"Float32Array":return"float32array";case"Float64Array":return"float64array"}if(f(t))return"generator";switch(n=i.call(t),n){case"[object Object]":return"object";case"[object Map Iterator]":return"mapiterator";case"[object Set Iterator]":return"setiterator";case"[object String Iterator]":return"stringiterator";case"[object Array Iterator]":return"arrayiterator"}return n.slice(8,-1).toLowerCase().replace(/\s/g,"")};function s(e){return e.constructor?e.constructor.name:null}function a(e){return Array.isArray?Array.isArray(e):e instanceof Array}function l(e){return e instanceof Error||"string"==typeof e.message&&e.constructor&&"number"==typeof e.constructor.stackTraceLimit}function u(e){return e instanceof Date||"function"==typeof e.toDateString&&"function"==typeof e.getDate&&"function"==typeof e.setDate}function c(e){return e instanceof RegExp||"string"==typeof e.flags&&"boolean"==typeof e.ignoreCase&&"boolean"==typeof e.multiline&&"boolean"==typeof e.global}function h(e,t){return"GeneratorFunction"===s(e)}function f(e){return"function"==typeof e.throw&&"function"==typeof e.return&&"function"==typeof e.next}function p(e){try{if("number"==typeof e.length&&"function"==typeof e.callee)return!0}catch(e){if(-1!==e.message.indexOf("callee"))return!0}return!1}function d(e){return!(!e.constructor||"function"!=typeof e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const m="@@__STRUCT__@@",g="@@__KIND__@@";function y(e){return!(!e||!e[m])}function v(e,t){return"function"==typeof e?e(t):e}var b=Object.assign||function(e){for(var t=1;t1?D(e,t,n):j(e,t,n);case"function":return x(e,t,n);case"object":return B(e,t,n);case"string":{let r=!0,i;if(e.endsWith("?")&&(r=!1,e=e.slice(0,-1)),e.includes("|")){const r=e.split(/\s*\|\s*/g);i=F(r,t,n)}else if(e.includes("&")){const r=e.split(/\s*&\s*/g);i=M(r,t,n)}else i=N(e,t,n);return r||(i=O(i,void 0,n)),i}}throw new Error(`Invalid schema: ${e}`)}function k(e,t,n){if("array"!==o(e)||2!==e.length)throw new Error(`Invalid schema: ${e}`);const r=N("object",void 0,n),i=w(e[0],void 0,n),s=w(e[1],void 0,n),a="dict",l=`dict<${i.type},${s.type}>`,u=e=>{const n=v(t);e=n?b({},n,e):e;const[o]=r.validate(e);if(o)return o.type=l,[o];const a={},u=[];for(let t in e){const n=e[t],[r,o]=i.validate(t);if(r){const n=r.errors||[r];n.forEach(n=>{n.path=[t].concat(n.path),n.data=e,u.push(n)});continue}t=o;const[l,c]=s.validate(n);if(l){const n=l.errors||[l];n.forEach(n=>{n.path=[t].concat(n.path),n.data=e,u.push(n)})}else a[t]=c}if(u.length){const e=u[0];return e.errors=u,[e]}return[void 0,a]};return new _(a,l,u)}function E(e,t,n){if("array"!==o(e))throw new Error(`Invalid schema: ${e}`);const r="enum",i=e.map(e=>{try{return JSON.stringify(e)}catch(t){return String(e)}}).join(" | "),s=(n=v(t))=>e.includes(n)?[void 0,n]:[{data:n,path:[],value:n,type:i}];return new _(r,i,s)}function S(e,t,n){const r=E(e,void 0,n),i=j([r],t,n);return i}function x(e,t,n){if("function"!==o(e))throw new Error(`Invalid schema: ${e}`);const r="function",i="",s=(n=v(t),r)=>{const s=e(n,r);let a={path:[],reason:null},l;switch(o(s)){case"boolean":l=s;break;case"string":l=!1,a.reason=s;break;case"object":l=!1,a=b({},a,s);break;default:throw new Error(`Invalid result: ${s}`)}return l?[void 0,n]:[b({type:i,value:n,data:n},a)]};return new _(r,i,s)}function C(e,t,n){const r="instance",i=`instance<${e.name}>`,o=(n=v(t))=>n instanceof e?[void 0,n]:[{data:n,path:[],value:n,type:i}];return new _(r,i,o)}function A(e,t,n){if("object"!==o(e))throw new Error(`Invalid schema: ${e}`);const r=[],i={};for(const t in e){r.push(t);const o=e[t],s=w(o,void 0,n);i[t]=s}const s="interface",a=`{${r.join()}}`,l=e=>{const n=v(t);e=n?b({},n,e):e;const r=[],o=e;for(const n in i){let s=e[n];const a=i[n];if(void 0===s){const r=t&&t[n];s=v(r,e)}const[l,u]=a.validate(s,e);if(l){const t=l.errors||[l];t.forEach(t=>{t.path=[n].concat(t.path),t.data=e,r.push(t)})}else(n in e||void 0!==u)&&(o[n]=u)}if(r.length){const e=r[0];return e.errors=r,[e]}return[void 0,o]};return new _(s,a,l)}function T(e,t,n){if("function"!==o(e))throw new Error(`Invalid schema: ${e}`);let r,i;const s="lazy",a="lazy...",l=t=>(i=e(),r.name=i.kind,r.type=i.type,r.validate=i.validate,r.validate(t));return r=new _(s,a,l),r}function I(e,t,n){if("function"!==o(e))throw new Error(`Invalid schema: ${e}`);const r="dynamic",i="dynamic...",s=(n=v(t),r)=>{const i=e(n,r);if("function"!==o(i))throw new Error(`Invalid schema: ${i}`);const[s,a]=i.validate(n);return s?[s]:[void 0,a]};return new _(r,i,s)}function j(e,t,n){if("array"!==o(e)||1!==e.length)throw new Error(`Invalid schema: ${e}`);const r=N("array",void 0,n),i=w(e[0],void 0,n),s="list",a=`[${i.type}]`,l=(e=v(t))=>{const[n,o]=r.validate(e);if(n)return n.type=a,[n];e=o;const s=[],l=[];for(let t=0;t{n.path=[t].concat(n.path),n.data=e,s.push(n)})}else l[t]=o}if(s.length){const e=s[0];return e.errors=s,[e]}return[void 0,l]};return new _(s,a,l)}function R(e,t,n){const r="literal",i=`literal: ${JSON.stringify(e)}`,o=(n=v(t))=>n===e?[void 0,n]:[{data:n,path:[],value:n,type:i}];return new _(r,i,o)}function B(e,t,n){if("object"!==o(e))throw new Error(`Invalid schema: ${e}`);const r=N("object",void 0,n),i=[],s={};for(const t in e){i.push(t);const r=e[t],o=w(r,void 0,n);s[t]=o}const a="object",l=`{${i.join()}}`,u=(e=v(t))=>{const[n]=r.validate(e);if(n)return n.type=l,[n];const i=[],o={},a=Object.keys(e),u=Object.keys(s),c=new Set(a.concat(u));if(c.forEach(n=>{let r=e[n];const a=s[n];if(void 0===r){const i=t&&t[n];r=v(i,e)}if(!a){const t={data:e,path:[n],value:r};return void i.push(t)}const[l,u]=a.validate(r,e);if(l){const t=l.errors||[l];t.forEach(t=>{t.path=[n].concat(t.path),t.data=e,i.push(t)})}else(n in e||void 0!==u)&&(o[n]=u)}),i.length){const e=i[0];return e.errors=i,[e]}return[void 0,o]};return new _(a,l,u)}function O(e,t,n){return F([e,"undefined"],t,n)}function P(e,t,n){if("object"!==o(e))throw new Error(`Invalid schema: ${e}`);const r=N("object",void 0,n),i=[],s={};for(const t in e){i.push(t);const r=e[t],o=w(r,void 0,n);s[t]=o}const a="partial",l=`{${i.join()},...}`,u=(e=v(t))=>{const[n]=r.validate(e);if(n)return n.type=l,[n];const i=[],o={};for(const n in s){let r=e[n];const a=s[n];if(void 0===r){const i=t&&t[n];r=v(i,e)}const[l,u]=a.validate(r,e);if(l){const t=l.errors||[l];t.forEach(t=>{t.path=[n].concat(t.path),t.data=e,i.push(t)})}else(n in e||void 0!==u)&&(o[n]=u)}if(i.length){const e=i[0];return e.errors=i,[e]}return[void 0,o]};return new _(a,l,u)}function N(e,t,n){if("string"!==o(e))throw new Error(`Invalid schema: ${e}`);const{types:r}=n,i=r[e];if("function"!==o(i))throw new Error(`Invalid type: ${e}`);const s=x(i,t,n),a="scalar",l=e,u=e=>{const[t,n]=s.validate(e);return t?(t.type=l,[t]):[void 0,n]};return new _(a,l,u)}function D(e,t,n){if("array"!==o(e))throw new Error(`Invalid schema: ${e}`);const r=e.map(e=>w(e,void 0,n)),i=N("array",void 0,n),s="tuple",a=`[${r.map(e=>e.type).join()}]`,l=(e=v(t))=>{const[n]=i.validate(e);if(n)return n.type=a,[n];const o=[],s=[],l=Math.max(e.length,r.length);for(let t=0;t{n.path=[t].concat(n.path),n.data=e,s.push(n)})}else o[t]=l}if(s.length){const e=s[0];return e.errors=s,[e]}return[void 0,o]};return new _(s,a,l)}function F(e,t,n){if("array"!==o(e))throw new Error(`Invalid schema: ${e}`);const r=e.map(e=>w(e,void 0,n)),i="union",s=r.map(e=>e.type).join(" | "),a=(e=v(t))=>{const n=[];for(const t of r){const[r,i]=t.validate(e);if(!r)return[void 0,i];n.push(r)}return n[0].type=s,n};return new _(i,s,a)}function M(e,t,n){if("array"!==o(e))throw new Error(`Invalid schema: ${e}`);const r=e.map(e=>w(e,void 0,n)),i="intersection",s=r.map(e=>e.type).join(" & "),a=(e=v(t))=>{let n=e;for(const e of r){const[t,r]=e.validate(n);if(t)return t.type=s,[t];n=r}return[void 0,n]};return new _(i,s,a)}const L={any:w,dict:k,enum:E,enums:S,function:x,instance:C,interface:A,lazy:T,list:j,literal:R,object:B,optional:O,partial:P,scalar:N,tuple:D,union:F,intersection:M,dynamic:I},U=["arguments","array","boolean","buffer","error","float32array","float64array","function","generatorfunction","int16array","int32array","int8array","map","null","number","object","promise","regexp","set","string","symbol","uint16array","uint32array","uint8array","uint8clampedarray","undefined","weakmap","weakset"],q={any:e=>void 0!==e};function z(e={}){const t=b({},q,e.types||{});function n(e,n,i={}){y(e)&&(e=e.schema);const o=L.any(e,n,b({},i,{types:t}));function s(e){if(this instanceof s)throw new Error("Invalid `new` keyword!");return s.assert(e)}return Object.defineProperty(s,m,{value:!0}),Object.defineProperty(s,g,{value:o}),s.kind=o.name,s.type=o.type,s.schema=e,s.defaults=n,s.options=i,s.assert=(e=>{const[t,n]=o.validate(e);if(t)throw new r(t);return n}),s.test=(e=>{const[t]=o.validate(e);return!t}),s.validate=(e=>{const[t,n]=o.validate(e);return t?[new r(t)]:[void 0,n]}),s}return Object.keys(L).forEach(e=>{const r=L[e];n[e]=((e,i,o)=>{const s=r(e,i,b({},o,{types:t})),a=n(s,i,o);return a})}),n}U.forEach(e=>{q[e]=(t=>o(t)===e)}),q.date=(e=>"date"===o(e)&&!isNaN(e));const K=z()},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=f;var r=n(57),i=h(r),o=n(145),s=h(o),a=n(86),l=h(a),u=n(37),c=h(u);function h(e){return e&&e.__esModule?e:{default:e}}function f(e,t,n){n=n||i.default;var r=(0,s.default)(t)?[]:{};e(t,function(e,t,n){(0,c.default)(e)(function(e,i){arguments.length>2&&(i=(0,l.default)(arguments,1)),r[t]=i,n(e)})},function(e){n(e,r)})}e.exports=t.default},function(e,t,n){"use strict";(function(t){const r=n(121),i=n(39),o="/",s=t.from(o),a=s[0];class l{constructor(e,n){if("string"==typeof e?this._buf=t.from(e):t.isBuffer(e)&&(this._buf=e),null==n&&(n=!0),n&&this.clean(),0===this._buf.length||this._buf[0]!==a)throw new Error(`Invalid key: ${this.toString()}`)}toString(e){return this._buf.toString(e||"utf8")}toBuffer(){return this._buf}get[Symbol.toStringTag](){return`[Key ${this.toString()}]`}static withNamespaces(e){return new h(e.join(o))}static random(){return new h(r().replace(/-/g,""))}clean(){for(this._buf&&0!==this._buf.length||(this._buf=t.from(o)),this._buf[0]!==a&&(this._buf=t.concat([s,this._buf]));this._buf.length>1&&this._buf[this._buf.length-1]===a;)this._buf=this._buf.slice(0,-1)}less(e){const t=this.list(),n=e.list();for(let e=0;ei)return!1}return t.length>>((3&t)<<3)&255;return i}}},function(e,t){for(var n=[],r=0;r<256;++r)n[r]=(r+256).toString(16).substr(1);function i(e,t){var r=t||0,i=n;return[i[e[r++]],i[e[r++]],i[e[r++]],i[e[r++]],"-",i[e[r++]],i[e[r++]],"-",i[e[r++]],i[e[r++]],"-",i[e[r++]],i[e[r++]],"-",i[e[r++]],i[e[r++]],i[e[r++]],i[e[r++]],i[e[r++]],i[e[r++]]].join("")}e.exports=i},function(e,t,n){"use strict";const r=n(13);e.exports.dbOpenFailedError=(e=>(e=e||new Error("Cannot open database"),r(e,"ERR_DB_OPEN_FAILED"))),e.exports.dbDeleteFailedError=(e=>(e=e||new Error("Delete failed"),r(e,"ERR_DB_DELETE_FAILED"))),e.exports.dbWriteFailedError=(e=>(e=e||new Error("Write failed"),r(e,"ERR_DB_WRITE_FAILED"))),e.exports.notFoundError=(e=>(e=e||new Error("Not Found"),r(e,"ERR_NOT_FOUND")))},function(e,t,n){"use strict";const r=n(201),i=n(827),o=n(829),s=n(831),a=n(832),l=n(406);t.KeytransformDatastore=r,t.ShardingDatastore=i,t.MountDatastore=o,t.TieredDatastore=s,t.NamespaceDatastore=a,t.shard=l},function(e,t,n){"use strict";const r=n(28).Key,i=n(828),o=t.PREFIX="/repo/flatfs/shard/",s=t.SHARDING_FN="SHARDING";t.README_FN="_README";class a{constructor(e){this.param=e}fun(e){throw new Error("implement me")}toString(){return`${o}v1/${this.name}/${this.param}`}}class l extends a{constructor(e){super(e),this._padding="".padStart(e,"_"),this.name="prefix"}fun(e){return(e+this._padding).slice(0,this.param)}}class u extends a{constructor(e){super(e),this._padding="".padStart(e,"_"),this.name="suffix"}fun(e){const t=this._padding+e;return t.slice(t.length-this.param)}}class c extends a{constructor(e){super(e),this._padding="".padStart(e+1,"_"),this.name="next-to-last"}fun(e){const t=this._padding+e,n=t.length-this.param-1;return t.slice(n,n+this.param)}}function h(e){if(e=e.trim(),0===e.length)throw new Error("empty shard string");if(!e.startsWith(o))throw new Error(`invalid or no path prefix: ${e}`);const t=e.slice(o.length).split("/"),n=t[0];if("v1"!==n)throw new Error(`expect 'v1' version, got '${n}'`);const r=t[1];if(!t[2])throw new Error("missing param");const i=parseInt(t[2],10);switch(r){case"prefix":return new l(i);case"suffix":return new u(i);case"next-to-last":return new c(i);default:throw new Error(`unkown sharding function: ${r}`)}}t.readShardFun=((e,t,n)=>{const i=new r(e).child(new r(s)),o="function"==typeof t.getRaw?t.getRaw.bind(t):t.get.bind(t);o(i,(e,t)=>{if(e)return n(e);let r;try{r=h((t||"").toString().trim())}catch(e){return n(e)}n(null,r)})}),t.readme=i,t.parseShardFun=h,t.Prefix=l,t.Suffix=u,t.NextToLast=c},function(e,t,n){"use strict";var r=function(e,t){return t||(t={}),e.split("").forEach(function(e,n){e in t||(t[e]=n)}),t},i={alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",charmap:{0:14,1:8}};i.charmap=r(i.alphabet,i.charmap);var o={alphabet:"0123456789ABCDEFGHJKMNPQRSTVWXYZ",charmap:{O:0,I:1,L:1}};o.charmap=r(o.alphabet,o.charmap);var s={alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",charmap:{}};function a(e){if(this.buf=[],this.shift=8,this.carry=0,e){switch(e.type){case"rfc4648":this.charmap=t.rfc4648.charmap;break;case"crockford":this.charmap=t.crockford.charmap;break;case"base32hex":this.charmap=t.base32hex.charmap;break;default:throw new Error("invalid type")}e.charmap&&(this.charmap=e.charmap)}}function l(e){if(this.buf="",this.shift=3,this.carry=0,e){switch(e.type){case"rfc4648":this.alphabet=t.rfc4648.alphabet;break;case"crockford":this.alphabet=t.crockford.alphabet;break;case"base32hex":this.alphabet=t.base32hex.alphabet;break;default:throw new Error("invalid type")}e.alphabet?this.alphabet=e.alphabet:e.lc&&(this.alphabet=this.alphabet.toLowerCase())}}s.charmap=r(s.alphabet,s.charmap),a.prototype.charmap=i.charmap,a.prototype.write=function(e){var t=this.charmap,n=this.buf,r=this.shift,i=this.carry;return e.toUpperCase().split("").forEach(function(e){if("="!=e){var o=255&t[e];r-=5,r>0?i|=o<>-r),r+=8,i=o<>t,this.buf+=this.alphabet[31&r],t>5&&(t-=5,r=i>>t,this.buf+=this.alphabet[31&r]),t=5-t,n=i<{const n=e+"/"+s;o("locking %s",n),a[n]=!0;const r={close(e){a[n]&&delete a[n],i(e)}};i(()=>{t(null,r)})}),t.locked=((e,t)=>{const n=e+"/"+s;o("checking lock: %s");const r=a[n];i(()=>{t(null,r)})})},function(e,t,n){"use strict";e.exports=n(860)},function(e,t,n){"use strict";function r(e,t){return t}Object.defineProperty(t,"__esModule",{value:!0}),t.default=r,e.exports=t.default},function(e,t,n){var r=n(20);n(194),n(117),n(250),n(97),n(869),n(150),n(251),n(871),n(248),n(30);var i=r.asn1,o=e.exports=r.pki=r.pki||{},s=o.oids,a={};a.CN=s.commonName,a.commonName="CN",a.C=s.countryName,a.countryName="C",a.L=s.localityName,a.localityName="L",a.ST=s.stateOrProvinceName,a.stateOrProvinceName="ST",a.O=s.organizationName,a.organizationName="O",a.OU=s.organizationalUnitName,a.organizationalUnitName="OU",a.E=s.emailAddress,a.emailAddress="E";var l=r.pki.rsa.publicKeyValidator,u={name:"Certificate",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"Certificate.TBSCertificate",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,captureAsn1:"tbsCertificate",value:[{name:"Certificate.TBSCertificate.version",tagClass:i.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,optional:!0,value:[{name:"Certificate.TBSCertificate.version.integer",tagClass:i.Class.UNIVERSAL,type:i.Type.INTEGER,constructed:!1,capture:"certVersion"}]},{name:"Certificate.TBSCertificate.serialNumber",tagClass:i.Class.UNIVERSAL,type:i.Type.INTEGER,constructed:!1,capture:"certSerialNumber"},{name:"Certificate.TBSCertificate.signature",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"Certificate.TBSCertificate.signature.algorithm",tagClass:i.Class.UNIVERSAL,type:i.Type.OID,constructed:!1,capture:"certinfoSignatureOid"},{name:"Certificate.TBSCertificate.signature.parameters",tagClass:i.Class.UNIVERSAL,optional:!0,captureAsn1:"certinfoSignatureParams"}]},{name:"Certificate.TBSCertificate.issuer",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,captureAsn1:"certIssuer"},{name:"Certificate.TBSCertificate.validity",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"Certificate.TBSCertificate.validity.notBefore (utc)",tagClass:i.Class.UNIVERSAL,type:i.Type.UTCTIME,constructed:!1,optional:!0,capture:"certValidity1UTCTime"},{name:"Certificate.TBSCertificate.validity.notBefore (generalized)",tagClass:i.Class.UNIVERSAL,type:i.Type.GENERALIZEDTIME,constructed:!1,optional:!0,capture:"certValidity2GeneralizedTime"},{name:"Certificate.TBSCertificate.validity.notAfter (utc)",tagClass:i.Class.UNIVERSAL,type:i.Type.UTCTIME,constructed:!1,optional:!0,capture:"certValidity3UTCTime"},{name:"Certificate.TBSCertificate.validity.notAfter (generalized)",tagClass:i.Class.UNIVERSAL,type:i.Type.GENERALIZEDTIME,constructed:!1,optional:!0,capture:"certValidity4GeneralizedTime"}]},{name:"Certificate.TBSCertificate.subject",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,captureAsn1:"certSubject"},l,{name:"Certificate.TBSCertificate.issuerUniqueID",tagClass:i.Class.CONTEXT_SPECIFIC,type:1,constructed:!0,optional:!0,value:[{name:"Certificate.TBSCertificate.issuerUniqueID.id",tagClass:i.Class.UNIVERSAL,type:i.Type.BITSTRING,constructed:!1,captureBitStringValue:"certIssuerUniqueId"}]},{name:"Certificate.TBSCertificate.subjectUniqueID",tagClass:i.Class.CONTEXT_SPECIFIC,type:2,constructed:!0,optional:!0,value:[{name:"Certificate.TBSCertificate.subjectUniqueID.id",tagClass:i.Class.UNIVERSAL,type:i.Type.BITSTRING,constructed:!1,captureBitStringValue:"certSubjectUniqueId"}]},{name:"Certificate.TBSCertificate.extensions",tagClass:i.Class.CONTEXT_SPECIFIC,type:3,constructed:!0,captureAsn1:"certExtensions",optional:!0}]},{name:"Certificate.signatureAlgorithm",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"Certificate.signatureAlgorithm.algorithm",tagClass:i.Class.UNIVERSAL,type:i.Type.OID,constructed:!1,capture:"certSignatureOid"},{name:"Certificate.TBSCertificate.signature.parameters",tagClass:i.Class.UNIVERSAL,optional:!0,captureAsn1:"certSignatureParams"}]},{name:"Certificate.signatureValue",tagClass:i.Class.UNIVERSAL,type:i.Type.BITSTRING,constructed:!1,captureBitStringValue:"certSignature"}]},c={name:"rsapss",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"rsapss.hashAlgorithm",tagClass:i.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,value:[{name:"rsapss.hashAlgorithm.AlgorithmIdentifier",tagClass:i.Class.UNIVERSAL,type:i.Class.SEQUENCE,constructed:!0,optional:!0,value:[{name:"rsapss.hashAlgorithm.AlgorithmIdentifier.algorithm",tagClass:i.Class.UNIVERSAL,type:i.Type.OID,constructed:!1,capture:"hashOid"}]}]},{name:"rsapss.maskGenAlgorithm",tagClass:i.Class.CONTEXT_SPECIFIC,type:1,constructed:!0,value:[{name:"rsapss.maskGenAlgorithm.AlgorithmIdentifier",tagClass:i.Class.UNIVERSAL,type:i.Class.SEQUENCE,constructed:!0,optional:!0,value:[{name:"rsapss.maskGenAlgorithm.AlgorithmIdentifier.algorithm",tagClass:i.Class.UNIVERSAL,type:i.Type.OID,constructed:!1,capture:"maskGenOid"},{name:"rsapss.maskGenAlgorithm.AlgorithmIdentifier.params",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"rsapss.maskGenAlgorithm.AlgorithmIdentifier.params.algorithm",tagClass:i.Class.UNIVERSAL,type:i.Type.OID,constructed:!1,capture:"maskGenHashOid"}]}]}]},{name:"rsapss.saltLength",tagClass:i.Class.CONTEXT_SPECIFIC,type:2,optional:!0,value:[{name:"rsapss.saltLength.saltLength",tagClass:i.Class.UNIVERSAL,type:i.Class.INTEGER,constructed:!1,capture:"saltLength"}]},{name:"rsapss.trailerField",tagClass:i.Class.CONTEXT_SPECIFIC,type:3,optional:!0,value:[{name:"rsapss.trailer.trailer",tagClass:i.Class.UNIVERSAL,type:i.Class.INTEGER,constructed:!1,capture:"trailer"}]}]},h={name:"CertificationRequestInfo",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,captureAsn1:"certificationRequestInfo",value:[{name:"CertificationRequestInfo.integer",tagClass:i.Class.UNIVERSAL,type:i.Type.INTEGER,constructed:!1,capture:"certificationRequestInfoVersion"},{name:"CertificationRequestInfo.subject",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,captureAsn1:"certificationRequestInfoSubject"},l,{name:"CertificationRequestInfo.attributes",tagClass:i.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,optional:!0,capture:"certificationRequestInfoAttributes",value:[{name:"CertificationRequestInfo.attributes",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"CertificationRequestInfo.attributes.type",tagClass:i.Class.UNIVERSAL,type:i.Type.OID,constructed:!1},{name:"CertificationRequestInfo.attributes.value",tagClass:i.Class.UNIVERSAL,type:i.Type.SET,constructed:!0}]}]}]},f={name:"CertificationRequest",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,captureAsn1:"csr",value:[h,{name:"CertificationRequest.signatureAlgorithm",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"CertificationRequest.signatureAlgorithm.algorithm",tagClass:i.Class.UNIVERSAL,type:i.Type.OID,constructed:!1,capture:"csrSignatureOid"},{name:"CertificationRequest.signatureAlgorithm.parameters",tagClass:i.Class.UNIVERSAL,optional:!0,captureAsn1:"csrSignatureParams"}]},{name:"CertificationRequest.signature",tagClass:i.Class.UNIVERSAL,type:i.Type.BITSTRING,constructed:!1,captureBitStringValue:"csrSignature"}]};function p(e,t){"string"==typeof t&&(t={shortName:t});for(var n=null,r,i=0;null===n&&i2)throw new Error("Cannot read notBefore/notAfter validity times; more than two times were provided in the certificate.");if(m.length<2)throw new Error("Cannot read notBefore/notAfter validity times; they were not provided as either UTCTime or GeneralizedTime.");if(h.validity.notBefore=m[0],h.validity.notAfter=m[1],h.tbsCertificate=n.tbsCertificate,t){if(h.md=null,h.signatureOid in s){var c=s[h.signatureOid];switch(c){case"sha1WithRSAEncryption":h.md=r.md.sha1.create();break;case"md5WithRSAEncryption":h.md=r.md.md5.create();break;case"sha256WithRSAEncryption":h.md=r.md.sha256.create();break;case"sha384WithRSAEncryption":h.md=r.md.sha384.create();break;case"sha512WithRSAEncryption":h.md=r.md.sha512.create();break;case"RSASSA-PSS":h.md=r.md.sha256.create()}}if(null===h.md){var l=new Error("Could not compute certificate digest. Unknown signature OID.");throw l.signatureOid=h.signatureOid,l}var g=i.toDer(h.tbsCertificate);h.md.update(g.getBytes())}var v=r.md.sha1.create();h.issuer.getField=function(e){return p(h.issuer,e)},h.issuer.addField=function(e){y([e]),h.issuer.attributes.push(e)},h.issuer.attributes=o.RDNAttributesAsArray(n.certIssuer,v),n.certIssuerUniqueId&&(h.issuer.uniqueId=n.certIssuerUniqueId),h.issuer.hash=v.digest().toHex();var b=r.md.sha1.create();return h.subject.getField=function(e){return p(h.subject,e)},h.subject.addField=function(e){y([e]),h.subject.attributes.push(e)},h.subject.attributes=o.RDNAttributesAsArray(n.certSubject,b),n.certSubjectUniqueId&&(h.subject.uniqueId=n.certSubjectUniqueId),h.subject.hash=b.digest().toHex(),n.certExtensions?h.extensions=o.certificateExtensionsFromAsn1(n.certExtensions):h.extensions=[],h.publicKey=o.publicKeyFromAsn1(n.subjectPublicKeyInfo),h},o.certificateExtensionsFromAsn1=function(e){for(var t=[],n=0;n1&&(o=n.value.charCodeAt(1),a=n.value.length>2?n.value.charCodeAt(2):0),t.digitalSignature=128==(128&o),t.nonRepudiation=64==(64&o),t.keyEncipherment=32==(32&o),t.dataEncipherment=16==(16&o),t.keyAgreement=8==(8&o),t.keyCertSign=4==(4&o),t.cRLSign=2==(2&o),t.encipherOnly=1==(1&o),t.decipherOnly=128==(128&a)}else if("basicConstraints"===t.name){var n=i.fromDer(t.value);n.value.length>0&&n.value[0].type===i.Type.BOOLEAN?t.cA=0!==n.value[0].value.charCodeAt(0):t.cA=!1;var l=null;n.value.length>0&&n.value[0].type===i.Type.INTEGER?l=n.value[0].value:n.value.length>1&&(l=n.value[1].value),null!==l&&(t.pathLenConstraint=i.derToInteger(l))}else if("extKeyUsage"===t.name)for(var n=i.fromDer(t.value),u=0;u1&&(o=n.value.charCodeAt(1)),t.client=128==(128&o),t.server=64==(64&o),t.email=32==(32&o),t.objsign=16==(16&o),t.reserved=8==(8&o),t.sslCA=4==(4&o),t.emailCA=2==(2&o),t.objCA=1==(1&o)}else if("subjectAltName"===t.name||"issuerAltName"===t.name){var h;t.altNames=[];for(var n=i.fromDer(t.value),f=0;f0&&t.value.push(o.certificateExtensionsToAsn1(e.extensions)),t},o.getCertificationRequestInfo=function(e){var t=i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[i.create(i.Class.UNIVERSAL,i.Type.INTEGER,!1,i.integerToDer(e.version).getBytes()),m(e.subject),o.publicKeyToAsn1(e.publicKey),_(e)]);return t},o.distinguishedNameToAsn1=function(e){return m(e)},o.certificateToAsn1=function(e){var t=e.tbsCertificate||o.getTBSCertificate(e);return i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[t,i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[i.create(i.Class.UNIVERSAL,i.Type.OID,!1,i.oidToDer(e.signatureOid).getBytes()),b(e.signatureOid,e.signatureParameters)]),i.create(i.Class.UNIVERSAL,i.Type.BITSTRING,!1,String.fromCharCode(0)+e.signature)])},o.certificateExtensionsToAsn1=function(e){var t=i.create(i.Class.CONTEXT_SPECIFIC,3,!0,[]),n=i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[]);t.value.push(n);for(var r=0;rc.validity.notAfter)&&(l={message:"Certificate is not valid yet or has expired.",error:o.certificateError.certificate_expired,notBefore:c.validity.notBefore,notAfter:c.validity.notAfter,now:s}),null===l){if(h=t[0]||e.getIssuer(c),null===h&&c.isIssuer(c)&&(f=!0,h=c),h){var p=h;r.util.isArray(p)||(p=[p]);for(var d=!1;!d&&p.length>0;){h=p.shift();try{d=h.verify(c)}catch(e){}}d||(l={message:"Certificate signature is invalid.",error:o.certificateError.bad_certificate})}null!==l||h&&!f||e.hasCertificate(c)||(l={message:"Certificate is not trusted.",error:o.certificateError.unknown_ca})}if(null===l&&h&&!c.isIssuer(h)&&(l={message:"Certificate issuer is invalid.",error:o.certificateError.bad_certificate}),null===l)for(var m={keyUsage:!0,basicConstraints:!0},g=0;null===l&&gv.pathLenConstraint&&(l={message:"Certificate basicConstraints pathLenConstraint violated.",error:o.certificateError.bad_certificate})}}var w=null===l||l.error,k=n?n(w,u,i):w;if(!0!==k)throw!0===w&&(l={message:"The application rejected the certificate.",error:o.certificateError.bad_certificate}),(k||0===k)&&("object"!=typeof k||r.util.isArray(k)?"string"==typeof k&&(l.error=k):(k.message&&(l.message=k.message),k.error&&(l.error=k.error))),l;l=null,a=!1,++u}while(t.length>0);return!0}},function(e,t){function n(e,t,n){var r;return function(){if(!t)return e.apply(this,arguments);var i=this,o=arguments,s=n&&!r;return clearTimeout(r),r=setTimeout(function(){if(r=null,!s)return e.apply(i,o)},t),s?e.apply(this,arguments):void 0}}e.exports=n},function(e,t,n){"use strict";var r=n(886);function i(e){return Number.isFinite(e)}function o(e){return"function"==typeof e}function s(e,t){return t?function(n,r){var i=setTimeout(function(){e(new Error("pull-reader: read exceeded timeout"),r)},t);e(n,function(e,t){clearTimeout(i),r(e,t)})}:e}e.exports=function(e){var t=[],n,a,l=!1,u=r(),c,h,f;function p(){for(;t.length;)if(null==t[0].length&&u.has(1))t.shift().cb(null,u.get());else if(u.has(t[0].length)){var e=t.shift();e.cb(null,u.get(e.length))}else if(1==c&&t[0].length&&u.length 0 to the moving average constructor");let n,i=0,o=0,s=0,a,l={};function u(e,n){return 1-r(-(e-n)/t)}return l.push=function e(t,r){if(a){const e=u(t,a),l=r-n,c=e*l;n=e*r+(1-e)*n,i=(1-e)*(i+l*c),o=Math.sqrt(i),s=n+e*l}else n=r;a=t},l.movingAverage=function e(){return n},l.variance=function e(){return i},l.deviation=function e(){return o},l.forecast=function e(){return s},l}},function(e,t,n){"use strict";const{createFromPrivKey:r}=n(15),i=n(43),o=n(892),s=n(13),a=n(4),l=a("ipfs:ipns");l.error=a("ipfs:ipns:error");const u=n(893),c=n(899),h=n(900),f=n(431),p=6e4;class d{constructor(e,t,n,r,i){this.publisher=new u(e,t),this.republisher=new c(this.publisher,t,n,r,i),this.resolver=new h(e),this.cache=new o({max:1e3}),this.routing=e}publish(e,t,n,o){i([t=>r(e.bytes,t),r=>this.publisher.publishWithEOL(e,t,n,r)],(e,r)=>{if(e)return l.error(e),o(e);l(`IPNS value ${t} was published correctly`);const i=r[0].toB58String(),s=parseFloat(n),a=s{if(t)return l.error(t),n(t);l(`IPNS record from ${e} was resolved correctly`),n(null,{path:r})})}initializeKeyspace(e,t,n){this.publisher.publish(e,t,n)}}t=e.exports=d,t.path=f},function(e,t,n){"use strict";const r=n(198),i=n(4),o=i("ipfs:ipns:path");o.error=i("ipfs:ipns:path:error");const s=(e,t,n)=>{if(r.ipnsPath(t))return o(`resolve ipns path ${t}`),e._ipns.resolve(t,n);e.dag.get(t.substring("/ipfs/".length),(e,t)=>e?n(e):n(null,t))};e.exports={resolvePath:s}},function(e,t,n){"use strict";(function(r){const i=n(156),{fromB58String:o,toB58String:s}=n(27),a=n(902),l=n(39),u=n(13),c=n(4),h=c("ipfs:ipns:pubsub");h.error=c("ipfs:ipns:pubsub:error");class f{constructor(e,t,n){this._pubsub=e,this._subscriptions={},this._handleSubscriptionKey=this._handleSubscriptionKey.bind(this),this._pubsubDs=new a(e,t,n,i.validator,this._handleSubscriptionKey)}put(e,t,n){this._pubsubDs.put(e,t,n)}get(e,t){this._pubsubDs.get(e,(n,r)=>{const o=e.slice(0,i.namespaceLength);if(o.toString()===i.namespace){const t=e.toString(),n=s(e.slice(i.namespaceLength));this._subscriptions[t]=n,h(`subscribed pubsub ${t}: ${n}`)}if(n)return t(n);t(null,r)})}_handleSubscriptionKey(e,t){const n=this._subscriptions[e];if(!n){const n=`key ${e} does not correspond to a subscription`;return h.error(n),t(u(new Error(n),"ERR_INVALID_KEY"))}let r;try{r=i.getIdKeys(o(n))}catch(e){return h.error(e),t(e)}t(null,r.routingKey.toBuffer())}getSubscriptions(e){const t=Object.values(this._subscriptions).filter(Boolean);return e(null,t.map(e=>`${i.namespace}${e}`))}cancel(e,t){if("string"!=typeof e){const e="received subscription name is not valid";return h.error(e),t(u(new Error(e),"ERR_INVALID_SUBSCRIPTION_NAME"))}e.startsWith(i.namespace)&&(e=e.substring(i.namespaceLength));const n=Object.keys(this._subscriptions).find(t=>this._subscriptions[t]===e);if(!n)return t(null,{canceled:!1});try{const e=r.from(n);this._pubsubDs.unsubscribe(e)}catch(e){return t(e)}this._subscriptions[n]=void 0,h(`unsubscribed pubsub ${n}: ${e}`),t(null,{canceled:!0})}}t=e.exports=l(f,{className:"IpnsPubsubDatastore",symbolName:"@js-ipfs/ipns/IpnsPubsubDatastore"})}).call(this,n(0).Buffer)},function(e,t,n){"use strict";(function(r){const{Key:i}=n(28),{Record:o}=n(123),{encodeBase32:s}=n(436),a=n(13),l=n(4),u=l("ipfs:ipns:offline-datastore");u.error=l("ipfs:ipns:offline-datastore:error");class c{constructor(e){this._repo=e}put(e,t,n){if(!r.isBuffer(e)){const e="Offline datastore key must be a buffer";return u.error(e),n(a(new Error(e),"ERR_INVALID_KEY"))}if(!r.isBuffer(t)){const e="Offline datastore value must be a buffer";return u.error(e),n(a(new Error(e),"ERR_INVALID_VALUE"))}let i;try{i=this._routingKey(e)}catch(e){const t="Not possible to generate the routing key";return u.error(t),n(a(new Error(t),"ERR_GENERATING_ROUTING_KEY"))}const s=new o(e,t);this._repo.datastore.put(i,s.serialize(),n)}get(e,t){if(!r.isBuffer(e)){const e="Offline datastore key must be a buffer";return u.error(e),t(a(new Error(e),"ERR_INVALID_KEY"))}let n;try{n=this._routingKey(e)}catch(e){const n="Not possible to generate the routing key";return u.error(n),t(a(new Error(n),"ERR_GENERATING_ROUTING_KEY"))}this._repo.datastore.get(n,(e,n)=>{if(e)return t(e);let r;try{r=o.deserialize(n)}catch(e){return u.error(e),t(e)}t(null,r.value)})}_routingKey(e){return new i("/"+s(e),!1)}}t=e.exports=c}).call(this,n(0).Buffer)},function(e,t,n){var r=n(908);e.exports=function(e,t,n){for(var i=-1,o=[],s=n?t.length:0;(i=r(e,t))>-1;)o.push(e.slice(0,i+s)),e=e.slice(i+t.length,e.length);return o.push(e),o}},function(e,t,n){"use strict";(function(e,n){t.toCallback=(t=>(function(n,r){let i;try{i=t(n)}catch(t){return void e.nextTick(r,t)}e.nextTick(r,null,i)})),t.toBuf=((e,t)=>r=>{let i=e(r,t);return n.from(i,"hex")}),t.fromString=((e,t)=>r=>{const i=n.isBuffer(r)?r.toString():r;return e(i,t)}),t.fromNumberTo32BitBuf=((e,t)=>r=>{let i=e(r,t);const o=new Array(4);for(let e=0;e<4;e++)o[e]=255&i,i>>=8;return n.from(o)})}).call(this,n(2),n(0).Buffer)},function(e,t,n){"use strict";const r=n(60),i=n(156);e.exports={encodeBase32:e=>{const t=r.encode("base32",e).slice(1);return t.toString().toUpperCase()},validator:{func:(e,t,n)=>i.validator.validate(t,e,n)},selector:(e,t)=>i.validator.select(t[0],t[1])}},function(e,t,n){"use strict";const r=n(200),i=n(89),o=n(436);function s({datastore:e,peerInfo:t,peerBook:s,options:a,config:l}){const u={datastore:e,peerInfo:t,peerBook:s,config:{peerDiscovery:{mdns:{enabled:r(a,"config.Discovery.MDNS.Enabled",r(l,"Discovery.MDNS.Enabled",!0))},webRTCStar:{enabled:r(a,"config.Discovery.webRTCStar.Enabled",r(l,"Discovery.webRTCStar.Enabled",!0))},bootstrap:{list:r(a,"config.Bootstrap",r(l,"Bootstrap",[]))}},relay:{enabled:r(a,"relay.enabled",r(l,"relay.enabled",!0)),hop:{enabled:r(a,"relay.hop.enabled",r(l,"relay.hop.enabled",!1)),active:r(a,"relay.hop.active",r(l,"relay.hop.active",!1))}},dht:{kBucketSize:r(a,"dht.kBucketSize",20),enabled:!1,randomWalk:{enabled:!1},validators:{ipns:o.validator},selectors:{ipns:o.selector}},EXPERIMENTAL:{pubsub:r(a,"EXPERIMENTAL.pubsub",!1)}},connectionManager:r(a,"connectionManager",{maxPeers:r(l,"Swarm.ConnMgr.HighWater"),minPeers:r(l,"Swarm.ConnMgr.LowWater")})},c=i(u,r(a,"libp2p",{})),h=n(918);return new h(c)}e.exports=function e(t,n){const r=t._options||{};n=n||{};const i="function"==typeof r.libp2p?r.libp2p:s,{datastore:o}=t._repo,a=t._peerInfo,l=t._peerInfoBook,e=i({options:r,config:n,datastore:o,peerInfo:a,peerBook:l});return e.on("stop",()=>{a.multiaddrs.clear()}),e.on("start",()=>{a.multiaddrs.forEach(e=>{t._print("Swarm listening on",e.toString())})}),e.on("peer:connect",e=>l.put(e)),e}},function(e,t,n){"use strict";const r=n(919),i=n(72),o=n(39),s=n(64).Connection,a=n(439),l=n(4),u=l("libp2p:websockets:dialer"),c=n(928);class h{dial(e,t,n){"function"==typeof t&&(n=t,t={}),n=n||function(){};const i=a(e);u("dialing %s",i);const o=r(i,{binary:!0,onConnect:e=>{n(e)}}),l=new s(o);return l.getObservedAddrs=(t=>t(null,[e])),l.close=(e=>o.close(e)),l}createListener(e,t){return"function"==typeof e&&(t=e,e={}),c(e,t)}filter(e){return Array.isArray(e)||(e=[e]),e.filter(e=>!e.protoNames().includes("p2p-circuit")&&(e.protoNames().includes("ipfs")&&(e=e.decapsulate("ipfs")),i.WebSockets.matches(e)||i.WebSocketsSecure.matches(e)))}}e.exports=o(h,{className:"WebSockets",symbolName:"@libp2p/js-libp2p-websockets/websockets"})},function(e,t,n){const r=n(21),i=(e,t)=>t,o={ip4:i,ip6:(e,t,n,r)=>1===r.length&&"ip6"===r[0].protocol?t:`[${t}]`,tcp:(e,t,n,r)=>r.some(e=>["http","https","ws","wss"].includes(e.protocol))?`${e}:${t}`:`tcp://${e}:${t}`,udp:(e,t)=>`udp://${e}:${t}`,dnsaddr:i,dns4:i,dns6:i,ipfs:(e,t)=>`${e}/ipfs/${t}`,p2p:(e,t)=>`${e}/p2p/${t}`,http:e=>`http://${e}`,https:e=>`https://${e}`,ws:e=>`ws://${e}`,wss:e=>`wss://${e}`,"p2p-websocket-star":e=>`${e}/p2p-websocket-star`,"p2p-webrtc-star":e=>`${e}/p2p-webrtc-star`,"p2p-webrtc-direct":e=>`${e}/p2p-webrtc-direct`};e.exports=(e=>r(e).stringTuples().map(e=>({protocol:r.protocols.codes[e[0]].name,content:e[1]})).reduce((e,t,n,r)=>{const i=o[t.protocol];if(!i)throw new Error(`Unsupported protocol ${t.protocol}`);return i(e,t.content,n,r)},""))},function(e,t,n){var r=n(930),i=n(264),o=n(444),s=n(206)("socket.io-client");e.exports=t=l;var a=t.managers={};function l(e,t){"object"==typeof e&&(t=e,e=void 0),t=t||{};var n=r(e),i=n.source,l=n.id,u=n.path,c=a[l]&&u in a[l].nsps,h=t.forceNew||t["force new connection"]||!1===t.multiplex||c,f;return h?(s("ignoring socket cache for %s",i),f=o(i,t)):(a[l]||(s("new io instance for %s",i),a[l]=o(i,t)),f=a[l]),n.query&&!t.query&&(t.query=n.query),f.socket(n.path,t)}t.protocol=i.protocol,t.connect=l,t.Manager=n(444),t.Socket=n(450)},function(e,t){var n=/^(?:(?![^:@]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@]*)(?::([^:@]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,r=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];e.exports=function e(t){var i=t,o=t.indexOf("["),s=t.indexOf("]");-1!=o&&-1!=s&&(t=t.substring(0,o)+t.substring(o,s).replace(/:/g,";")+t.substring(s,t.length));for(var a=n.exec(t||""),l={},u=14;u--;)l[r[u]]=a[u]||"";return-1!=o&&-1!=s&&(l.source=i,l.host=l.host.substring(1,l.host.length-1).replace(/;/g,":"),l.authority=l.authority.replace("[","").replace("]","").replace(/;/g,":"),l.ipv6uri=!0),l}},function(e,t){var n={}.toString;e.exports=Array.isArray||function(e){return"[object Array]"==n.call(e)}},function(e,t,n){(function(t){e.exports=o;var n="function"==typeof t&&"function"==typeof t.isBuffer,r="function"==typeof ArrayBuffer,i=function(e){return"function"==typeof ArrayBuffer.isView?ArrayBuffer.isView(e):e.buffer instanceof ArrayBuffer};function o(e){return n&&t.isBuffer(e)||r&&(e instanceof ArrayBuffer||i(e))}}).call(this,n(0).Buffer)},function(e,t,n){var r=n(937),i=n(450),o=n(124),s=n(264),a=n(451),l=n(452),u=n(206)("socket.io-client:manager"),c=n(449),h=n(954),f=Object.prototype.hasOwnProperty;function p(e,t){if(!(this instanceof p))return new p(e,t);e&&"object"==typeof e&&(t=e,e=void 0),t=t||{},t.path=t.path||"/socket.io",this.nsps={},this.subs=[],this.opts=t,this.reconnection(!1!==t.reconnection),this.reconnectionAttempts(t.reconnectionAttempts||1/0),this.reconnectionDelay(t.reconnectionDelay||1e3),this.reconnectionDelayMax(t.reconnectionDelayMax||5e3),this.randomizationFactor(t.randomizationFactor||.5),this.backoff=new h({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(null==t.timeout?2e4:t.timeout),this.readyState="closed",this.uri=e,this.connecting=[],this.lastPing=null,this.encoding=!1,this.packetBuffer=[];var n=t.parser||s;this.encoder=new n.Encoder,this.decoder=new n.Decoder,this.autoConnect=!1!==t.autoConnect,this.autoConnect&&this.open()}e.exports=p,p.prototype.emitAll=function(){for(var e in this.emit.apply(this,arguments),this.nsps)f.call(this.nsps,e)&&this.nsps[e].emit.apply(this.nsps[e],arguments)},p.prototype.updateSocketIds=function(){for(var e in this.nsps)f.call(this.nsps,e)&&(this.nsps[e].id=this.generateId(e))},p.prototype.generateId=function(e){return("/"===e?"":e+"#")+this.engine.id},o(p.prototype),p.prototype.reconnection=function(e){return arguments.length?(this._reconnection=!!e,this):this._reconnection},p.prototype.reconnectionAttempts=function(e){return arguments.length?(this._reconnectionAttempts=e,this):this._reconnectionAttempts},p.prototype.reconnectionDelay=function(e){return arguments.length?(this._reconnectionDelay=e,this.backoff&&this.backoff.setMin(e),this):this._reconnectionDelay},p.prototype.randomizationFactor=function(e){return arguments.length?(this._randomizationFactor=e,this.backoff&&this.backoff.setJitter(e),this):this._randomizationFactor},p.prototype.reconnectionDelayMax=function(e){return arguments.length?(this._reconnectionDelayMax=e,this.backoff&&this.backoff.setMax(e),this):this._reconnectionDelayMax},p.prototype.timeout=function(e){return arguments.length?(this._timeout=e,this):this._timeout},p.prototype.maybeReconnectOnOpen=function(){!this.reconnecting&&this._reconnection&&0===this.backoff.attempts&&this.reconnect()},p.prototype.open=p.prototype.connect=function(e,t){if(u("readyState %s",this.readyState),~this.readyState.indexOf("open"))return this;u("opening %s",this.uri),this.engine=r(this.uri,this.opts);var n=this.engine,i=this;this.readyState="opening",this.skipReconnect=!1;var o=a(n,"open",function(){i.onopen(),e&&e()}),s=a(n,"error",function(t){if(u("connect_error"),i.cleanup(),i.readyState="closed",i.emitAll("connect_error",t),e){var n=new Error("Connection error");n.data=t,e(n)}else i.maybeReconnectOnOpen()});if(!1!==this._timeout){var l=this._timeout;u("connect attempt will timeout after %d",l);var c=setTimeout(function(){u("connect attempt timed out after %d",l),o.destroy(),n.close(),n.emit("error","timeout"),i.emitAll("connect_timeout",l)},l);this.subs.push({destroy:function(){clearTimeout(c)}})}return this.subs.push(o),this.subs.push(s),this},p.prototype.onopen=function(){u("open"),this.cleanup(),this.readyState="open",this.emit("open");var e=this.engine;this.subs.push(a(e,"data",l(this,"ondata"))),this.subs.push(a(e,"ping",l(this,"onping"))),this.subs.push(a(e,"pong",l(this,"onpong"))),this.subs.push(a(e,"error",l(this,"onerror"))),this.subs.push(a(e,"close",l(this,"onclose"))),this.subs.push(a(this.decoder,"decoded",l(this,"ondecoded")))},p.prototype.onping=function(){this.lastPing=new Date,this.emitAll("ping")},p.prototype.onpong=function(){this.emitAll("pong",new Date-this.lastPing)},p.prototype.ondata=function(e){this.decoder.add(e)},p.prototype.ondecoded=function(e){this.emit("packet",e)},p.prototype.onerror=function(e){u("error",e),this.emitAll("error",e)},p.prototype.socket=function(e,t){var n=this.nsps[e];if(!n){n=new i(this,e,t),this.nsps[e]=n;var r=this;n.on("connecting",o),n.on("connect",function(){n.id=r.generateId(e)}),this.autoConnect&&o()}function o(){~c(r.connecting,n)||r.connecting.push(n)}return n},p.prototype.destroy=function(e){var t=c(this.connecting,e);~t&&this.connecting.splice(t,1),this.connecting.length||this.close()},p.prototype.packet=function(e){u("writing packet %j",e);var t=this;e.query&&0===e.type&&(e.nsp+="?"+e.query),t.encoding?t.packetBuffer.push(e):(t.encoding=!0,this.encoder.encode(e,function(n){for(var r=0;r0&&!this.encoding){var e=this.packetBuffer.shift();this.packet(e)}},p.prototype.cleanup=function(){u("cleanup");for(var e=this.subs.length,t=0;t=this._reconnectionAttempts)u("reconnect failed"),this.backoff.reset(),this.emitAll("reconnect_failed"),this.reconnecting=!1;else{var t=this.backoff.duration();u("will wait %dms before reconnect attempt",t),this.reconnecting=!0;var n=setTimeout(function(){e.skipReconnect||(u("attempting reconnect"),e.emitAll("reconnect_attempt",e.backoff.attempts),e.emitAll("reconnecting",e.backoff.attempts),e.skipReconnect||e.open(function(t){t?(u("reconnect attempt error"),e.reconnecting=!1,e.reconnect(),e.emitAll("reconnect_error",t.data)):(u("reconnect success"),e.onreconnect())}))},t);this.subs.push({destroy:function(){clearTimeout(n)}})}},p.prototype.onreconnect=function(){var e=this.backoff.attempts;this.reconnecting=!1,this.backoff.reset(),this.updateSocketIds(),this.emitAll("reconnect",e)}},function(e,t,n){var r=n(265),i=n(940),o=n(950),s=n(951);function a(e){var t,n=!1,s=!1,a=!1!==e.jsonp;if("undefined"!=typeof location){var l="https:"===location.protocol,u=location.port;u||(u=l?443:80),n=e.hostname!==location.hostname||u!==e.port,s=e.secure!==l}if(e.xdomain=n,e.xscheme=s,t=new r(e),"open"in t&&!e.forceJSONP)return new i(e);if(!a)throw new Error("JSONP disabled");return new o(e)}t.polling=a,t.websocket=s},function(e,t,n){var r=n(266),i=n(207),o=n(125),s=n(208),a=n(448),l=n(209)("engine.io-client:polling");e.exports=f;var u=(c=n(265),h=new c({xdomain:!1}),null!=h.responseType),c,h;function f(e){var t=e&&e.forceBase64;u&&!t||(this.supportsBinary=!1),r.call(this,e)}s(f,r),f.prototype.name="polling",f.prototype.doOpen=function(){this.poll()},f.prototype.pause=function(e){var t=this;function n(){l("paused"),t.readyState="paused",e()}if(this.readyState="pausing",this.polling||!this.writable){var r=0;this.polling&&(l("we are currently polling - waiting to pause"),r++,this.once("pollComplete",function(){l("pre-pause polling complete"),--r||n()})),this.writable||(l("we are currently writing - waiting to pause"),r++,this.once("drain",function(){l("pre-pause writing complete"),--r||n()}))}else n()},f.prototype.poll=function(){l("polling"),this.polling=!0,this.doPoll(),this.emit("poll")},f.prototype.onData=function(e){var t=this;l("polling got data %s",e);var n=function(e,n,r){if("opening"===t.readyState&&t.onOpen(),"close"===e.type)return t.onClose(),!1;t.onPacket(e)};o.decodePayload(e,this.socket.binaryType,n),"closed"!==this.readyState&&(this.polling=!1,this.emit("pollComplete"),"open"===this.readyState?this.poll():l('ignoring poll - transport state "%s"',this.readyState))},f.prototype.doClose=function(){var e=this;function t(){l("writing close packet"),e.write([{type:"close"}])}"open"===this.readyState?(l("transport open - closing"),t()):(l("transport not open - deferring close"),this.once("open",t))},f.prototype.write=function(e){var t=this;this.writable=!1;var n=function(){t.writable=!0,t.emit("drain")};o.encodePayload(e,this.supportsBinary,function(e){t.doWrite(e,n)})},f.prototype.uri=function(){var e=this.query||{},t=this.secure?"https":"http",n="";!1!==this.timestampRequests&&(e[this.timestampParam]=a()),this.supportsBinary||e.sid||(e.b64=1),e=i.encode(e),this.port&&("https"===t&&443!==Number(this.port)||"http"===t&&80!==Number(this.port))&&(n=":"+this.port),e.length&&(e="?"+e);var r=-1!==this.hostname.indexOf(":");return t+"://"+(r?"["+this.hostname+"]":this.hostname)+n+this.path+e}},function(e,t,n){(function(t){var r=n(942),i=Object.prototype.toString,o="function"==typeof Blob||"undefined"!=typeof Blob&&"[object BlobConstructor]"===i.call(Blob),s="function"==typeof File||"undefined"!=typeof File&&"[object FileConstructor]"===i.call(File);function a(e){if(!e||"object"!=typeof e)return!1;if(r(e)){for(var n=0,i=e.length;n0);return t}function c(e){var t=0;for(a=0;a0?("string"==typeof t||o.objectMode||Object.getPrototypeOf(t)===c.prototype||(t=f(t)),r?o.endEmitted?e.emit("error",new Error("stream.unshift() after end event")):x(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?x(e,o,t,!1):P(e,o)):x(e,o,t,!1))):r||(o.reading=!1));return A(o)}function x(e,t,n,r){t.flowing&&0===t.length&&!t.sync?(e.emit("data",n),e.read(0)):(t.length+=t.objectMode?1:n.length,r?t.buffer.unshift(n):t.buffer.push(n),t.needReadable&&B(e)),P(e,t)}function C(e,t){var n;return p(t)||"string"==typeof t||void 0===t||e.objectMode||(n=new TypeError("Invalid non-string/buffer chunk")),n}function A(e){return!e.ended&&(e.needReadable||e.length=T?e=T:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}function j(e,t){return e<=0||0===t.length&&t.ended?0:t.objectMode?1:e!=e?t.flowing&&t.length?t.buffer.head.data.length:t.length:(e>t.highWaterMark&&(t.highWaterMark=I(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}function R(e,t){if(!t.ended){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,B(e)}}function B(e){var t=e._readableState;t.needReadable=!1,t.emittedReadable||(g("emitReadable",t.flowing),t.emittedReadable=!0,t.sync?i.nextTick(O,e):O(e))}function O(e){g("emit readable"),e.emit("readable"),U(e)}function P(e,t){t.readingMore||(t.readingMore=!0,i.nextTick(N,e,t))}function N(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=z(e,t.buffer,t.decoder),n);var n}function z(e,t,n){var r;return eo.length?o.length:e;if(s===o.length?i+=o:i+=o.slice(0,e),e-=s,0===e){s===o.length?(++r,n.next?t.head=n.next:t.head=t.tail=null):(t.head=n,n.data=o.slice(s));break}++r}return t.length-=r,i}function H(e,t){var n=c.allocUnsafe(e),r=t.head,i=1;for(r.data.copy(n),e-=r.data.length;r=r.next;){var o=r.data,s=e>o.length?o.length:e;if(o.copy(n,n.length-e,0,s),e-=s,0===e){s===o.length?(++i,r.next?t.head=r.next:t.head=t.tail=null):(t.head=r,r.data=o.slice(s));break}++i}return t.length-=i,n}function V(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($,t,e))}function $(e,t){e.endEmitted||0!==e.length||(e.endEmitted=!0,t.readable=!1,t.emit("end"))}function W(e,t){for(var n=0,r=e.length;n=t.highWaterMark||t.ended))return g("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?V(this):B(this),null;if(e=j(e,t),0===e&&t.ended)return 0===t.length&&V(this),null;var r=t.needReadable,i;return g("need readable",r),(0===t.length||t.length-e0?q(e,t):null,null===i?(t.needReadable=!0,e=0):t.length-=e,0===t.length&&(t.ended||(t.needReadable=!0),n!==e&&t.ended&&V(this)),null!==i&&this.emit("data",i),i},E.prototype._read=function(e){this.emit("error",new Error("_read() is not implemented"))},E.prototype.pipe=function(e,t){var n=this,o=this._readableState;switch(o.pipesCount){case 0:o.pipes=e;break;case 1:o.pipes=[o.pipes,e];break;default:o.pipes.push(e)}o.pipesCount+=1,g("pipe count=%d opts=%j",o.pipesCount,t);var s=(!t||!1!==t.end)&&e!==r.stdout&&e!==r.stderr,a=s?c:_;function u(e,t){g("onunpipe"),e===n&&t&&!1===t.hasUnpiped&&(t.hasUnpiped=!0,p())}function c(){g("onend"),e.end()}o.endEmitted?i.nextTick(a):n.once("end",a),e.on("unpipe",u);var h=D(n);e.on("drain",h);var f=!1;function p(){g("cleanup"),e.removeListener("close",v),e.removeListener("finish",b),e.removeListener("drain",h),e.removeListener("error",y),e.removeListener("unpipe",u),n.removeListener("end",c),n.removeListener("end",_),n.removeListener("data",m),f=!0,!o.awaitDrain||e._writableState&&!e._writableState.needDrain||h()}var d=!1;function m(t){g("ondata"),d=!1;var r=e.write(t);!1!==r||d||((1===o.pipesCount&&o.pipes===e||o.pipesCount>1&&-1!==W(o.pipes,e))&&!f&&(g("false write response, pause",n._readableState.awaitDrain),n._readableState.awaitDrain++,d=!0),n.pause())}function y(t){g("onerror",t),_(),e.removeListener("error",y),0===l(e,"error")&&e.emit("error",t)}function v(){e.removeListener("finish",b),_()}function b(){g("onfinish"),e.removeListener("close",v),_()}function _(){g("unpipe"),n.unpipe(e)}return n.on("data",m),w(e,"error",y),e.once("close",v),e.once("finish",b),e.emit("pipe",n),o.flowing||(g("pipe resume"),n.resume()),e},E.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?this:(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 o=0;o-1?setImmediate:i.nextTick,l;_.WritableState=b;var u=n(8);u.inherits=n(3);var c={deprecate:n(59)},h=n(455),f=n(5).Buffer,p=r.Uint8Array||function(){};function d(e){return f.from(e)}function m(e){return f.isBuffer(e)||e instanceof p}var g=n(456),y;function v(){}function b(e,t){l=l||n(126),e=e||{};var r=t instanceof l;this.objectMode=!!e.objectMode,r&&(this.objectMode=this.objectMode||!!e.writableObjectMode);var i=e.highWaterMark,o=e.writableHighWaterMark,a=this.objectMode?16:16384;this.highWaterMark=i||0===i?i:r&&(o||0===o)?o:a,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 u=!1===e.decodeStrings;this.decodeStrings=!u,this.defaultEncoding=e.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(e){T(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 s(this)}function _(e){if(l=l||n(126),!(y.call(_,this)||this instanceof l))return new _(e);this._writableState=new b(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 w(e,t){var n=new Error("write after end");e.emit("error",n),i.nextTick(t,n)}function k(e,t,n,r){var o=!0,s=!1;return null===n?s=new TypeError("May not write null values to stream"):"string"==typeof n||void 0===n||t.objectMode||(s=new TypeError("Invalid non-string/buffer chunk")),s&&(e.emit("error",s),i.nextTick(r,s),o=!1),o}function E(e,t,n){return e.objectMode||!1===e.decodeStrings||"string"!=typeof t||(t=f.from(t,n)),t}function S(e,t,n,r,i,o){if(!n){var s=E(t,r,i);r!==s&&(n=!0,i="buffer",r=s)}var a=t.objectMode?1:r.length;t.length+=a;var l=t.length-1))throw new TypeError("Unknown encoding: "+t);return this._writableState.defaultEncoding=t,this},Object.defineProperty(_.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),_.prototype._write=function(e,t,n){n(new Error("_write() is not implemented"))},_.prototype._writev=null,_.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&&void 0!==e&&this.write(e,t),r.corked&&(r.corked=1,this.uncork()),r.ending||r.finished||D(this,r,n)},Object.defineProperty(_.prototype,"destroyed",{get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(e){this._writableState&&(this._writableState.destroyed=e)}}),_.prototype.destroy=g.destroy,_.prototype._undestroy=g.undestroy,_.prototype._destroy=function(e,t){this.end(),t(e)}}).call(this,n(2),n(7))},function(e,t,n){"use strict";e.exports=s;var r=n(126),i=n(8);function o(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.length"string"==typeof e,object:e=>"object"==typeof e,multiaddr:e=>{if(u.string(e))try{return i(e),!0}catch(e){return!1}},function:e=>"function"==typeof e};function c(e,t){if(!Array.isArray(t))throw new Error("Data is not an array");e.forEach((e,n)=>{if(!u[e])throw console.error("Type %s does not exist",e),new Error("Type "+e+" does not exist");if(!u[e](t[n]))throw new Error("Data at index "+n+" is invalid for type "+e)})}function h(e){e||(e=(()=>{}));const t=this;t.requests={},t.addRequest=((e,n,r)=>{t.requests[e]={def:n,handle:r}}),t.handleSocket=(n=>{n.r={},Object.keys(t.requests).forEach(r=>{const i=t.requests[r];n.on(r,function(){const t=[...arguments];try{c(i.def,t),t.unshift(n),i.handle.apply(null,t)}catch(i){e(i),e("peer %s has sent invalid data for request %s",n.id||"",r,t)}})})})}function f(e,t,n){o.createFromPubKey(r.from(e,"hex"),(i,o)=>i?n(new Error("Crypto error")):o.toB58String()!==t?n(new Error("Id is not matching")):n(null,s.keys.unmarshalPublicKey(r.from(e,"hex"))))}t=e.exports,t.cleanUrlSIO=l,t.validate=c,t.Protocol=h,t.getIdAndValidate=f,t.validateMa=(e=>a.WebSocketStar.matches(i(e)))}).call(this,n(0).Buffer)},function(e,t,n){var r=n(969),i=n(121),o=i;o.v1=r,o.v4=i,e.exports=o},function(e,t,n){"use strict";e.exports="/mplex/6.7.0"},function(e,t,n){"use strict";const r=n(27),i=n(44),o=n(992);class s{constructor(e,t,n){this.dht=e,this.key=t,this.makePath=n,this._log=i.logger(this.dht.peerInfo.id,"query:"+r.toB58String(t)),this.running=!1,this._onStart=this._onStart.bind(this),this._onComplete=this._onComplete.bind(this)}run(e,t){return this.dht._queryManager.running?0===e.length?(this._log.error("Running query with no peers"),t(null,{finalSet:new Set,paths:[]})):(this._run=new o(this),this._log(`query running with K=${this.dht.kBucketSize}, A=${this.dht.concurrency}, D=${Math.min(this.dht.disjointPaths,e.length)}`),this._run.once("start",this._onStart),this._run.once("complete",this._onComplete),void this._run.execute(e,t)):(this._log.error("Attempt to run query after shutdown"),t(null,{finalSet:new Set,paths:[]}))}_onStart(){this.running=!0,this._startTime=Date.now(),this._log("query:start"),this.dht._queryManager.queryStarted(this)}_onComplete(){this.stop()}stop(){this._log(`query:done in ${Date.now()-this._startTime}ms`),this._run&&this._log(`${this._run.errors.length} of ${this._run.peersSeen.size} peers errored (${this._run.errors.length/this._run.peersSeen.size*100}% fail rate)`),this.running&&(this._run.removeListener("start",this._onStart),this._run.removeListener("complete",this._onComplete),this.running=!1,this._run&&this._run.stop(),this.dht._queryManager.queryCompleted(this))}}e.exports=s},function(e,t){e.exports=function(e){if(!e)throw Error("hashlru must have a max value, of type number, greater than 0");var t=0,n=Object.create(null),r=Object.create(null);function i(i,o){n[i]=o,t++,t>=e&&(t=0,r=n,n=Object.create(null))}return{has:function(e){return void 0!==n[e]||void 0!==r[e]},remove:function(e){void 0!==n[e]&&(n[e]=void 0),void 0!==r[e]&&(r[e]=void 0)},get:function(e){var t=n[e];return void 0!==t?t:void 0!==(t=r[e])?(i(e,t),t):void 0},set:function(e,t){void 0!==n[e]?n[e]=t:i(e,t)},clear:function(){n=Object.create(null),r=Object.create(null)}}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(271),i=a(r),o=n(332),s=a(o);function a(e){return e&&e.__esModule?e:{default:e}}t.default=(0,i.default)(s.default),e.exports=t.default},function(e,t,n){"use strict";(function(t){const r=n(102),i=n(50),o=n(214),s=o.writeEncoded;function a(e,n,o){const a=r({timeout:6e4},n),l=a.handshake;return o("writing multicodec: "+e),s(l,t.from(e+"\n"),n),i.decodeFromReader(l,(t,r)=>{if(t)return n(t);const i=r.toString().slice(0,-1);if(i!==e)return n(new Error(`"${e}" not supported`),l.rest());o("received ack: "+i),n(null,l.rest())}),a}e.exports=a}).call(this,n(0).Buffer)},function(e,t,n){"use strict";function r(e,t,n){const r=e===t;n(null,r)}e.exports=r},function(e,t,n){"use strict";t=e.exports,t.PROTOCOL_ID="/multistream/1.0.0"},function(e,t,n){"use strict";const r=n(158),i=n(272),o=n(213),s=n(39),a=n(470),l=n(36),u=n(47),c=n(278),h=n(13),{msHandle:f,msSelect:p,identifyDialer:d}=n(277),m=n(280),{CONNECTION_FAILED:g,DIAL_SELF:y,INVALID_STATE_TRANSITION:v,NO_TRANSPORTS_REGISTERED:b,maybeUnexpectedEnd:_}=n(215);class w extends a{constructor({_switch:e,peerInfo:t,muxer:n,conn:i,type:o="out"}){super({_switch:e,name:`${o}:${e._peerInfo.id.toB58String().slice(0,8)}`}),this.theirPeerInfo=t,this.theirB58Id=this.theirPeerInfo.id.toB58String(),this.conn=i,this.muxer=n;let s="DISCONNECTED";this.muxer&&(s="MUXED"),this._state=r(s,{DISCONNECTED:{dial:"DIALING",disconnect:"DISCONNECTED",done:"DISCONNECTED"},DIALING:{abort:"ABORTED",done:"DIALED",error:"ERRORED",disconnect:"DISCONNECTING"},DIALED:{encrypt:"ENCRYPTING",privatize:"PRIVATIZING"},PRIVATIZING:{done:"PRIVATIZED",abort:"ABORTED",disconnect:"DISCONNECTING"},PRIVATIZED:{encrypt:"ENCRYPTING"},ENCRYPTING:{done:"ENCRYPTED",error:"ERRORED",disconnect:"DISCONNECTING"},ENCRYPTED:{upgrade:"UPGRADING",disconnect:"DISCONNECTING"},UPGRADING:{stop:"CONNECTED",done:"MUXED",error:"ERRORED",disconnect:"DISCONNECTING"},MUXED:{disconnect:"DISCONNECTING"},CONNECTED:{disconnect:"DISCONNECTING"},DISCONNECTING:{done:"DISCONNECTED",disconnect:"DISCONNECTING"},ABORTED:{},ERRORED:{disconnect:"DISCONNECTING"}}),this._state.on("DISCONNECTED",()=>this._onDisconnected()),this._state.on("DIALING",()=>this._onDialing()),this._state.on("DIALED",()=>this._onDialed()),this._state.on("PRIVATIZING",()=>this._onPrivatizing()),this._state.on("PRIVATIZED",()=>this._onPrivatized()),this._state.on("ENCRYPTING",()=>this._onEncrypting()),this._state.on("ENCRYPTED",()=>{this.log("successfully encrypted connection to %s",this.theirB58Id),this.emit("encrypted",this.conn)}),this._state.on("UPGRADING",()=>this._onUpgrading()),this._state.on("MUXED",()=>{this.log("successfully muxed connection to %s",this.theirB58Id),delete this.switch.conns[this.theirB58Id],this.emit("muxed",this.muxer)}),this._state.on("CONNECTED",()=>{this.log("unmuxed connection opened to %s",this.theirB58Id),this.emit("unmuxed",this.conn)}),this._state.on("DISCONNECTING",()=>this._onDisconnecting()),this._state.on("ABORTED",()=>this._onAborted()),this._state.on("ERRORED",()=>this._onErrored()),this._state.on("error",e=>this._onStateError(e))}dial(){return this.theirB58Id===this.ourPeerInfo.id.toB58String()?this.emit("error",y()):"DIALING"===this.getState()?this.log("attempted to dial while already dialing, ignoring"):void this._state("dial")}shake(e,t){return e?this.muxer&&this.muxer.newStream?this.muxer.newStream((n,r)=>{if(n)return t(n,null);this.log("created new stream to %s",this.theirB58Id),this._protocolHandshake(e,r,t)}):void this._protocolHandshake(e,this.conn,t):t(null,null)}upgrade(){this._state("upgrade")}_onDialing(){if(this.log("dialing %s",this.theirB58Id),!this.switch.hasTransports())return this.close(b());const e=this.switch.availableTransports(this.theirPeerInfo),t=Boolean(this.switch.transports[i.tag]);t&&!e.includes(i.tag)&&e.push(i.tag);const n=r=>{let o=r;if(!o)return t?this.close(g(`No available transports to dial peer ${this.theirB58Id}!`)):this.close(g(`Circuit not enabled and all transports failed to dial peer ${this.theirB58Id}!`));o===i.tag&&this.theirPeerInfo.multiaddrs.add(`/p2p-circuit/p2p/${this.theirB58Id}`),this.log("dialing transport %s",o),this.switch.transport.dial(o,this.theirPeerInfo,(t,r)=>{if(t)return this.emit("error:connection_attempt_failed",t),this.log(t),n(e.shift());this.conn=m(o,null,r,this.switch.observer),this._state("done")})};n(e.shift())}_onDialed(){this.log("successfully dialed %s",this.theirB58Id),this.emit("connected",this.conn)}_onDisconnecting(){this.log("disconnecting from %s",this.theirB58Id,Boolean(this.muxer)),delete this.switch.conns[this.theirB58Id];let e=[];if(this.muxer&&e.push(e=>{this.muxer.end(()=>{delete this.muxer,e()})}),this.conn){try{this.conn.source.abort()}catch(e){}delete this.conn}l(e,()=>{this._state("done")})}_onEncrypting(){const e=new o.Dialer;e.handle(this.conn,t=>{if(t)return this.close(_(t));this.log("selecting crypto %s to %s",this.switch.crypto.tag,this.theirB58Id),e.select(this.switch.crypto.tag,(e,t)=>{if(e)return this.close(_(e));const n=m(null,this.switch.crypto.tag,t,this.switch.observer),r=this.switch.crypto.encrypt(this.ourPeerInfo.id,n,this.theirPeerInfo.id,e=>{if(e)return this.close(e);this.conn=r,this.conn.setPeerInfo(this.theirPeerInfo),this._state("done")})})})}_onUpgrading(){const e=Object.keys(this.switch.muxers);if(this.log("upgrading connection to %s",this.theirB58Id),0===e.length)return this._state("stop");const t=new o.Dialer;t.handle(this.conn,n=>{if(n)return this._didUpgrade(n);const r=n=>{this.log("selecting %s",n),t.select(n,(t,i)=>{if(t)return 0===e.length?this._didUpgrade(t):r(e.shift());const o=m(null,n,i,this.switch.observer);this.muxer=this.switch.muxers[n].dialer(o),this.muxer.once("close",()=>{this.close()}),this.muxer.on("stream",e=>{this.log("new stream created via muxer to %s",this.theirB58Id),e.setPeerInfo(this.theirPeerInfo),this.switch.protocolMuxer(null)(e)}),this._didUpgrade(null),this.switch.identify&&this._identify((e,t)=>{if(e)return this.close(e);this.theirPeerInfo=this.switch._peerBook.put(t.peerInfo)})})};r(e.shift())})}_identify(e){if(!this.muxer)return u(e,h("The connection was already closed","ERR_CONNECTION_CLOSED"));this.muxer.newStream(async(t,n)=>{if(t)return e(t);const r=new o.Dialer;let i;try{await f(r,n);const o=await p(r,c.multicodec);i=await d(o,this.theirPeerInfo)}catch(t){return e(t)}e(null,i)})}_didUpgrade(e){if(e)return this.log("Error upgrading connection:",e),this.switch.conns[this.theirB58Id]=this,this.emit("error:upgrade_failed",e),this._state("stop");this._state("done")}_protocolHandshake(e,t,n){const r=new o.Dialer;r.handle(t,t=>{if(t)return n(t,null);r.select(e,(t,r)=>{if(t)return this.log("could not perform protocol handshake:",t),n(t,null);const i=m(null,e,r,this.switch.observer);this.log("successfully performed handshake of %s to %s",e,this.theirB58Id),this.emit("connection",i),n(null,i)})})}_onStateError(e){this.emit("error",v(e)),this.log(e)}}e.exports=s(w,{className:"ConnectionFSM",symbolName:"libp2p-switch/ConnectionFSM"})},function(e,t,n){"use strict";const r=n(6).EventEmitter,i=n(4),o=n(39);class s extends r{constructor({_switch:e,name:t}){super(),this.switch=e,this.ourPeerInfo=this.switch._peerInfo,this.log=i(`libp2p:conn:${t}`),this.log.error=i(`libp2p:conn:${t}:error`)}close(e){"DISCONNECTING"!==this._state._state&&(this.log("closing connection to %s",this.theirB58Id),e&&this._events.error&&this.emit("error",e),this._state("disconnect"))}emit(e,...t){"error"!==e||this._events.error?super.emit(e,...t):this.log.error(...t)}getState(){return this._state._state}encrypt(){this._state("encrypt")}protect(){this._state("privatize")}upgrade(){this._state("upgrade")}_onDisconnected(){this.switch.connection.remove(this),this.log("disconnected from %s",this.theirB58Id),this.emit("close"),this.removeAllListeners()}_onPrivatized(){this.emit("private",this.conn)}_onPrivatizing(){if(!this.switch.protector)return this._state("done");this.conn=this.switch.protector.protect(this.conn,e=>{if(e)return this.close(e);this.log("successfully privatized conn to %s",this.theirB58Id),this.conn.setPeerInfo(this.theirPeerInfo),this._state("done")})}}e.exports=o(s,{className:"BaseConnection",symbolName:"libp2p-switch/BaseConnection"})},function(e,t,n){"use strict";const r=n(19);e.exports={tag:"/plaintext/1.0.0",encrypt:(e,t,n,i)=>("function"==typeof n&&(i=n,n=void 0),r(()=>i()),t)}},function(e,t,n){"use strict";const r=n(15),i=n(31),o=n(21);function s(e,t){let n;if(i.isPeerInfo(e))return t.put(e);if(o.isMultiaddr(e)){const o=e.getPeerId();try{n=t.get(o)}catch(e){n=new i(r.createFromB58String(o))}return n.multiaddrs.add(e),n}if(r.isPeerId(e)){const n=e.toB58String();try{return t.get(n)}catch(e){throw new Error(`Couldnt get PeerInfo for ${n}`)}}throw new Error("peer type not recognized")}e.exports=s},function(e,t,n){"use strict";var r=n(1044);function i(e,t,n){var i=this;function o(){i._rescheduled>0?(i._scheduled=i._rescheduled-(r()-i._started),i._timer=setTimeout(o,i._scheduled),i._rescheduled=0):e.apply(null,i._args)}this._started=r(),this._rescheduled=0,this._scheduled=t,this._args=n,this._timer=setTimeout(o,t)}function o(){if("function"!=typeof arguments[0])throw new Error("callback needed");if("number"!=typeof arguments[1])throw new Error("timeout needed");var e;if(arguments.length>0){e=new Array(arguments.length-2);for(var t=0;t=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/))}function o(e){var n=this.useColors;if(e[0]=(n?"%c":"")+this.namespace+(n?" %c":" ")+e[0]+(n?"%c ":" ")+"+"+t.humanize(this.diff),n){var r="color: "+this.color;e.splice(1,0,r,"color: inherit");var i=0,o=0;e[0].replace(/%[a-zA-Z%]/g,function(e){"%%"!==e&&(i++,"%c"===e&&(o=i))}),e.splice(o,0,r)}}function s(){return"object"==typeof console&&console.log&&Function.prototype.apply.call(console.log,console,arguments)}function a(e){try{null==e?t.storage.removeItem("debug"):t.storage.debug=e}catch(e){}}function l(){var e;try{e=t.storage.debug}catch(e){}return!e&&void 0!==r&&"env"in r&&(e=r.env.DEBUG),e}function u(){try{return window.localStorage}catch(e){}}t=e.exports=n(1085),t.log=s,t.formatArgs=o,t.save=a,t.load=l,t.useColors=i,t.storage="undefined"!=typeof chrome&&void 0!==chrome.storage?chrome.storage.local:u(),t.colors=["lightseagreen","forestgreen","goldenrod","dodgerblue","darkorchid","crimson"],t.formatters.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}},t.enable(l())}).call(this,n(2))},function(e,t,n){"use strict";const r=n(6),i=n(12),o=n(88),s=n(38),a=n(1093),l=n(4),u=n(13),c=n(1095),h=n(288),{signMessage:f}=n(1098),p=n(1099),d=n(47);class m extends r{constructor(e,t,n,r){super(),r={signMessages:!0,...r},this.log=l(e),this.log.err=l(`${e}:error`),this.multicodec=t,this.libp2p=n,this.started=!1,r.signMessages&&(this.peerId=this.libp2p.peerInfo.id),this.topics=new Map,this.seenCache=new a,this.peers=new Map,this._dials=new Set,this._onConnection=this._onConnection.bind(this),this._dialPeer=this._dialPeer.bind(this)}_addPeer(e){const t=e.info.id.toB58String();let n=this.peers.get(t);return n||(this.log("new peer",t),this.peers.set(t,e),n=e,e.once("close",()=>this._removePeer(e))),++n._references,n}_removePeer(e){const t=e.info.id.toB58String();return this.log("remove",t,e._references),0==--e._references&&(this.log("delete peer",t),this.peers.delete(t)),e}_dialPeer(e,t){t=t||function e(){};const n=e.id.toB58String(),r=this.peers.get(n);return r&&r.isConnected?d(()=>t()):this._dials.has(n)?(this.log("already dialing %s, ignoring dial attempt",n),d(()=>t())):(this._dials.add(n),this.log("dialing %s",n),void this.libp2p.dialProtocol(e,this.multicodec,(r,i)=>{this.log("dial to %s complete",n);const o=!this._dials.has(n);return this._dials.delete(n),r?(this.log.err(r),t()):o?(this.log("pubsub was stopped, not processing dial to %s",n),t()):void this._onDial(e,i,t)}))}_onDial(e,t,n){const r=e.id.toB58String();this.log("connected",r);const i=this._addPeer(new c(e));i.attachConnection(t),d(()=>n())}_onConnection(e,t){t.getPeerInfo((e,n)=>{if(e)return this.log.err("Failed to identify incomming conn",e),i(o(),t);const r=n.id.toB58String(),s=this._addPeer(new c(n));this._processConnection(r,t,s)})}_processConnection(e,t,n){throw u("_processConnection must be implemented by the subclass","ERR_NOT_IMPLEMENTED")}_onConnectionEnd(e,t,n){n&&"socket hang up"!==n.message&&this.log.err(n),this.log("connection ended",e,n?n.message:""),this._removePeer(t)}_buildMessage(e,t){const n=p.normalizeOutRpcMessage(e);this.peerId?f(this.peerId,n,t):d(t,null,n)}publish(e,t,n){throw u("publish must be implemented by the subclass","ERR_NOT_IMPLEMENTED")}subscribe(e){throw u("subscribe must be implemented by the subclass","ERR_NOT_IMPLEMENTED")}unsubscribe(e){throw u("unsubscribe must be implemented by the subclass","ERR_NOT_IMPLEMENTED")}start(e){if(this.started)return d(()=>e(new Error("already started")));this.log("starting"),this.libp2p.handle(this.multicodec,this._onConnection),this.libp2p.on("peer:connect",this._dialPeer);const t=Object.values(this.libp2p.peerBook.getAll());s(t,(e,t)=>this._dialPeer(e,t),t=>{d(()=>{this.log("started"),this.started=!0,e(t)})})}stop(e){if(!this.started)return d(()=>e(new Error("not started yet")));this.libp2p.unhandle(this.multicodec),this.libp2p.removeListener("peer:connect",this._dialPeer),this._dials=new Set,this.log("stopping"),s(this.peers.values(),(e,t)=>e.close(t),t=>{if(t)return e(t);this.log("stopped"),this.peers=new Map,this.started=!1,e()})}}e.exports=m,e.exports.message=h,e.exports.utils=p},function(e){e.exports={name:"ipfs",version:"0.35.0",description:"JavaScript implementation of the IPFS specification",leadMaintainer:"Alan Shaw ",bin:{jsipfs:"src/cli/bin.js"},main:"src/core/index.js",browser:{"./src/core/components/init-assets.js":!1,"./src/core/runtime/add-from-fs-nodejs.js":"./src/core/runtime/add-from-fs-browser.js","./src/core/runtime/config-nodejs.js":"./src/core/runtime/config-browser.js","./src/core/runtime/dns-nodejs.js":"./src/core/runtime/dns-browser.js","./src/core/runtime/fetch-nodejs.js":"./src/core/runtime/fetch-browser.js","./src/core/runtime/libp2p-nodejs.js":"./src/core/runtime/libp2p-browser.js","./src/core/runtime/preload-nodejs.js":"./src/core/runtime/preload-browser.js","./src/core/runtime/repo-nodejs.js":"./src/core/runtime/repo-browser.js","./src/core/runtime/ipld-nodejs.js":"./src/core/runtime/ipld-browser.js","./test/utils/create-repo-nodejs.js":"./test/utils/create-repo-browser.js",stream:"readable-stream",joi:"joi-browser"},"browser-all-ipld-formats":{"./src/core/runtime/ipld-browser.js":"./src/core/runtime/ipld-browser-all.js"},engines:{node:">=10.0.0",npm:">=6.0.0"},scripts:{lint:"aegir lint",build:"aegir build",test:"aegir test -t node -t browser -t webworker --no-cors --timeout=10000","test:node":"aegir test -t node --timeout=10000","test:browser":"aegir test -t browser --no-cors --timeout=10000","test:webworker":"aegir test -t webworker --no-cors --timeout=10000","test:node:core":"aegir test -t node -f test/core/**/*.js --timeout=10000","test:node:http":"aegir test -t node -f test/http-api/index.js --timeout=10000","test:node:gateway":"aegir test -t node -f test/gateway/index.js --timeout=10000","test:node:cli":"aegir test -t node -f test/cli/index.js --timeout=10000","test:node:interface":"aegir test -t node -f test/core/interface.spec.js --timeout=10000","test:bootstrapers":"IPFS_TEST=bootstrapers aegir test -t browser -f test/bootstrapers.js --timeout=10000",benchmark:'echo "Error: no benchmarks yet" && exit 1',"benchmark:node":'echo "Error: no benchmarks yet" && exit 1',"benchmark:node:core":'echo "Error: no benchmarks yet" && exit 1',"benchmark:node:http":'echo "Error: no benchmarks yet" && exit 1',"benchmark:browser":'echo "Error: no benchmarks yet" && exit 1',release:"aegir release -t node -t browser","release-minor":"aegir release --type minor -t node -t browser","release-major":"aegir release --type major -t node -t browser"},repository:{type:"git",url:"git+https://github.com/ipfs/js-ipfs.git"},keywords:["IPFS"],license:"MIT",bugs:{url:"https://github.com/ipfs/js-ipfs/issues"},homepage:"https://github.com/ipfs/js-ipfs#readme",devDependencies:{aegir:"^18.1.0",chai:"^4.2.0",delay:"^4.1.0","detect-node":"^2.0.4","dir-compare":"^1.4.0","dirty-chai":"^2.0.1",execa:"^1.0.0","form-data":"^2.3.3",hat:"0.0.3","interface-ipfs-core":"~0.99.1","ipfsd-ctl":"~0.42.0","libp2p-websocket-star":"~0.10.2",ncp:"^2.0.0",qs:"^6.5.2",rimraf:"^2.6.2",sinon:"^7.3.1","stream-to-promise":"^2.2.0"},dependencies:{async:"^2.6.1","bignumber.js":"^8.0.2","binary-querystring":"~0.1.2",bl:"^3.0.0",boom:"^7.2.0",bs58:"^4.0.1",byteman:"^1.3.5","cid-tool":"~0.2.0",cids:"~0.5.8","class-is":"^1.1.0","datastore-core":"~0.6.0","datastore-pubsub":"~0.1.1",debug:"^4.1.0",dlv:"^1.1.2","err-code":"^1.1.2","file-type":"^10.2.0",fnv1a:"^1.0.1","fsm-event":"^2.1.0","get-folder-size":"^2.0.0",glob:"^7.1.3",hapi:"^18.0.0","hapi-pino":"^5.2.0","human-to-milliseconds":"^1.0.0","interface-datastore":"~0.6.0","ipfs-bitswap":"~0.23.0","ipfs-block":"~0.8.0","ipfs-block-service":"~0.15.1","ipfs-http-client":"^30.1.1","ipfs-http-response":"~0.2.1","ipfs-mfs":"~0.10.2","ipfs-multipart":"~0.1.0","ipfs-repo":"~0.26.1","ipfs-unixfs":"~0.1.16","ipfs-unixfs-exporter":"~0.36.1","ipfs-unixfs-importer":"~0.38.5",ipld:"~0.21.1","ipld-bitcoin":"~0.1.8","ipld-dag-cbor":"~0.13.1","ipld-dag-pb":"~0.15.3","ipld-ethereum":"^2.0.1","ipld-git":"~0.3.0","ipld-raw":"^2.0.1","ipld-zcash":"~0.1.6",ipns:"~0.5.0","is-ipfs":"~0.6.0","is-pull-stream":"~0.0.0","is-stream":"^1.1.0","iso-url":"~0.4.6",joi:"^14.3.0","just-flatten-it":"^2.1.0","just-safe-set":"^2.1.0",libp2p:"~0.25.0","libp2p-bootstrap":"~0.9.3","libp2p-crypto":"~0.16.0","libp2p-kad-dht":"~0.14.12","libp2p-keychain":"~0.4.1","libp2p-mdns":"~0.12.0","libp2p-mplex":"~0.8.4","libp2p-record":"~0.6.1","libp2p-secio":"~0.11.0","libp2p-tcp":"~0.13.0","libp2p-webrtc-star":"~0.15.5","libp2p-websocket-star-multi":"~0.4.0","libp2p-websockets":"~0.12.2",lodash:"^4.17.11",mafmt:"^6.0.2","merge-options":"^1.0.1","mime-types":"^2.1.21",mkdirp:"~0.5.1",multiaddr:"^6.0.0","multiaddr-to-uri":"^4.0.1",multibase:"~0.6.0",multicodec:"~0.5.0",multihashes:"~0.4.14","multihashing-async":"~0.5.1","node-fetch":"^2.3.0","peer-book":"~0.9.0","peer-id":"~0.12.0","peer-info":"~0.15.0",progress:"^2.0.1","promisify-es6":"^1.0.3",protons:"^1.0.1","pull-abortable":"^4.1.1","pull-cat":"^1.1.11","pull-defer":"~0.2.3","pull-file":"^1.1.0","pull-ndjson":"~0.1.1","pull-pushable":"^2.2.0","pull-sort":"^1.0.1","pull-stream":"^3.6.9","pull-stream-to-stream":"^1.3.4","readable-stream":"^3.1.1",receptacle:"^1.3.2","stream-to-pull-stream":"^1.7.3",superstruct:"~0.6.0","tar-stream":"^2.0.0",temp:"~0.9.0","update-notifier":"^2.5.0","uri-to-multiaddr":"^3.0.1",varint:"^5.0.0",yargs:"^13.2.2","yargs-promise":"^1.1.0"},optionalDependencies:{"prom-client":"^11.1.3","prometheus-gc-stats":"~0.6.0"},contributors:["0xflotus <0xflotus@gmail.com>","A_A <21040751+Otto-AA@users.noreply.github.com>","Alan Shaw ","Alan Shaw ","Alex North ","Alex Potsides ","Andrew Nesbitt ","Andrew de Andrade ","André Cruz ","Arkadiy Kukarkin ","Arpit Agarwal <93arpit@gmail.com>","Arpit Agarwal ","Bernard Mordan ","Brian Vander Schaaf ","Bruno Zell ","CHEVALAY JOSSELIN ","Caio Gondim ","Chance Hudson ","Christian Couder ","Dafeng ","Dan Ordille ","Daniel J. O'Quinn ","Daniela Borges Matos de Carvalho ","David Dias ","David Gilbertson ","David da Silva ","Diogo Silva ","Dmitriy Ryajov ","Dzmitry Das ","Enrico Marino ","Faheel Ahmad ","Felix Yan ","Francisco Baio Dias ","Francisco Baio Dias ","Friedel Ziegelmayer ","Gar ","Georgios Rassias ","Gorka Ludlow ","Grant Herman ","Greenkeeper ","Haad ","Haoliang Yu ","Harsh Vakharia ","Henrique Dias ","Henry Rodrick ","Heo Sangmin ","Hugo Dias ","Hugo Dias ","Irakli Gozalishvili ","Jacob Heun ","Jacob Heun ","Jade Meskill ","Johannes Wikner ","Jon Schlinkert ","Jonathan ","João Antunes ","João Santos ","Kevin Wang ","Lars Gierth ","Lukas Drgon ","Maciej Krüger ","Marcin Rataj ","Marius Darila ","Mat Kelly ","Michelle Lee ","Mikeal Rogers ","Mithgol ","Molly ","Mounish Sai ","My9Bot <34904312+My9Bot@users.noreply.github.com>","Nitin Patel <31539366+niinpatel@users.noreply.github.com>","Nuno Nogueira ","Oli Evans ","Oskar Nyberg ","Pascal Precht ","Pau Ramon Revilla ","Paulo Rodrigues ","Pedro Teixeira ","Portia Burton ","Raoul Millais ","RasmusErik Voel Jensen ","Richard Littauer ","Richard Schneider ","Rob Brackett ","Rod Keys ","Sangwon Hong ","Sid Harder ","SidHarder ","Stephen Whitmore ","Stephen Whitmore ","Steven Allen ","Terence Pae ","Uroš Jurglič ","Vasco Santos ","Vasco Santos ","Volker Mische ","Xiao Liang ","Yahya ","Yole ","bitspill ","datafatmunger ","dirkmc ","haad ","jbenet ","jonahweissman <19804455+jonahweissman@users.noreply.github.com>","kevingzhang ","kumavis ","nginnever ","npmcdn-to-unpkg-bot ","robbsolter <35879806+robbsolter@users.noreply.github.com>","seungwon-kang ","tcme ","victorbjelkholm ","Łukasz Magiera ","Максим Ильин "]}},function(e,t,n){"use strict";const r=n(1),i=n(259).repoVersion;e.exports=function e(t){return{init:(e,t,n)=>{},version:r(e=>{t._repo._isInitialized(n=>{if(n){const t=[/Key not found in database \[\/version\]/,/ENOENT/,/repo is not initialized yet/].some(e=>e.test(n.message));return t?e(null,i):e(n)}t._repo.version.get(e)})}),gc:r((e,t)=>{"function"==typeof e&&(t=e,e={}),t(new Error("Not implemented"))}),stat:r((e,n)=>{"function"==typeof e&&(n=e,e={}),t._repo.stat(e,(e,t)=>{if(e)return n(e);n(null,{numObjects:t.numObjects,repoSize:t.repoSize,repoPath:t.repoPath,version:t.version.toString(),storageMax:t.storageMax})})}),path:()=>t._repo.path}}},function(e,t,n){"use strict";e.exports=(()=>({Addresses:{Swarm:[],API:"",Gateway:""},Discovery:{MDNS:{Enabled:!1,Interval:10},webRTCStar:{Enabled:!0}},Bootstrap:["/dns4/ams-1.bootstrap.libp2p.io/tcp/443/wss/ipfs/QmSoLer265NRgSp2LA3dPaeykiS1J6DifTC88f5uVQKNAd","/dns4/lon-1.bootstrap.libp2p.io/tcp/443/wss/ipfs/QmSoLMeWqB7YGVLJN3pNLQpmmEk35v6wYtsMGLzSr5QBU3","/dns4/sfo-3.bootstrap.libp2p.io/tcp/443/wss/ipfs/QmSoLPppuBtQSGwKDZT2M73ULpjvfd3aZ6ha4oFGL1KrGM","/dns4/sgp-1.bootstrap.libp2p.io/tcp/443/wss/ipfs/QmSoLSafTMBsPKadTEgaXctDQVcqN88CNLHXMkTNwMKPnu","/dns4/nyc-1.bootstrap.libp2p.io/tcp/443/wss/ipfs/QmSoLueR4xBeUbY9WZ9xGUUxunbKWcrNFTDAadQJmocnWm","/dns4/nyc-2.bootstrap.libp2p.io/tcp/443/wss/ipfs/QmSoLV4Bbm51jM9C4gDYZQ9Cy3U6aXMJDAbzgu2fzaDs64","/dns4/node0.preload.ipfs.io/tcp/443/wss/ipfs/QmZMxNdpMkewiVZLMRxaNxUeZpDUb34pWjZ1kZvsd16Zic","/dns4/node1.preload.ipfs.io/tcp/443/wss/ipfs/Qmbut9Ywz9YEDrz8ySBSgWyJk41Uvm2QJPhwDJzJyGFsD6"],Swarm:{ConnMgr:{LowWater:200,HighWater:500}}}))},function(e,t,n){"use strict";(function(t){const r=n(1),i=n(18),o=n(1129),s=n(128),a=n(162).isSource;e.exports=function(e){const n=r((n,r,l)=>{"function"==typeof r&&(l=r,r={}),r=r||{};const u=e=>t.isBuffer(e)||s.readable(e)||a(e),c=e=>"object"==typeof e&&(e.content?u(e.content):Boolean(e.path)&&"string"==typeof e.path),h=e=>u(e)||c(e),f=h(n)||Array.isArray(n)&&n.every(h);if(!f)return l(new Error("invalid input: expected buffer, readable stream, pull stream, object or array of objects"));i(i.values([n]),e.addPullStream(r),o((e,t)=>e.patht.path?-1:0),i.collect(l))});return function(){const e=Array.from(arguments);return 1===e.length&&a(e[0])&&e.push({}),n.apply(null,e)}}}).call(this,n(0).Buffer)},function(e,t,n){"use strict";e.exports=n(1136)},function(e,t){e.exports=function(e){var t,n,r;function i(e){return n=e,function(e,i){r?t=[e,i]:n(e,i)}}return i.pause=function(){r||(r=!0,e&&e(r))},i.resume=function(){if(r&&(r=!1,e&&e(r),t)){var i=t;t=null,n(i[0],i[1])}},i}},function(e,t,n){"use strict";(function(t){e.exports=function e(n,r,i,o){const s=n.length,a=r+s;return i>=a||o=r&&o=r&&i{if(t=Object.assign({},g,t),!t.parentCid)return n(new Error("No parent CID passed to addLink"));if(!o.isCID(t.parentCid))return n(new Error("Invalid CID passed to addLink"));if(!t.parent)return l("Loading parent node",t.parentCid.toBaseEncodedString()),s([n=>e.ipld.get(t.parentCid,n),(e,t)=>t(null,e.value),(n,r)=>y(e,{...t,parent:n},r)],n);if(!t.cid)return n(new Error("No child cid passed to addLink"));if(!t.name)return n(new Error("No child name passed to addLink"));if(o.isCID(t.cid)||(t.cid=new o(t.cid)),!t.size&&0!==t.size)return n(new Error("No child size passed to addLink"));const r=u.unmarshal(t.parent.data);return"hamt-sharded-directory"===r.type?(l("Adding link to sharded directory"),_(e,t,n)):t.parent.links.length>=t.shardSplitThreshold?(l("Converting directory to sharded directory"),v(e,t,n)):(l(`Adding ${t.name} to regular directory`),void b(e,t,n))},v=(e,t,n)=>{p(e,t.parent.links.map(e=>({name:e.name,size:e.size,multihash:e.cid.buffer})).concat({name:t.name,size:t.size,multihash:t.cid.buffer}),{},(e,t)=>{e||l("Converted directory to sharded directory",t.cid.toBaseEncodedString()),n(e,t)})},b=(e,t,n)=>{s([e=>r.rmLink(t.parent,t.name,e),(e,n)=>r.addLink(e,new i(t.name,t.size,t.cid),n),(n,r)=>{e.ipld.put(n,{version:t.cidVersion,format:t.codec,hashAlg:t.hashAlg,hashOnly:!t.flush},(e,t)=>r(e,{node:n,cid:t}))}],n)},_=(e,t,n)=>w(e,t,(i,o)=>{if(i)return n(i);const{shard:a,path:l}=o;a.flush("",e.ipld,null,async(i,o)=>{if(i)return n(i);const a=t.parent.links.find(e=>e.name.substring(0,2)===l[0].prefix),u=o.node.links.find(e=>e.name.substring(0,2)===l[0].prefix);s([e=>{if(!a)return e(null,t.parent);r.rmLink(t.parent,a.name,e)},(e,t)=>r.addLink(e,u,t),(n,r)=>h(e,n.links,l[0].bucket,t,r)],n)})}),w=(e,t,n)=>{const r={name:t.name,cid:t.cid,size:t.size};f(t.parent.links,null,null,null,async(i,o)=>{if(i)return n(i);const s=new c({root:!0,dir:!0,parent:null,parentKey:null,path:"",dirty:!0,flat:!1});s._bucket=o;const u=await o._findNewBucketAndPos(r.name),h=k(u);h[0].node=t.parent;let p=0;a(()=>p{let n=h[p];p++;let i=n.node,a=i.links.find(e=>e.name.substring(0,2)===n.prefix);return a?a.name===`${n.prefix}${r.name}`?(l(`Link ${n.prefix}${r.name} will be replaced`),p=h.length,t(null,s)):a.name.length>2?(l(`Link ${a.name} will be replaced with a subshard`),p=h.length,t(null,s)):(l(`Found subshard ${n.prefix}`),void e.ipld.get(a.cid,(e,i)=>{if(e)return t(e);if(!h[p]){l(`Loaded new subshard ${n.prefix}`);const e=i.value;return f(e.links,o,n.bucket,parseInt(n.prefix,16),async n=>{if(n)return t(n);const i=await o._findNewBucketAndPos(r.name);return h.push({bucket:i.bucket,prefix:d(i.pos),node:e}),t(null,s)})}const a=h[p];m(i.value.links,a.bucket,o,e=>{a.node=i.value,t(e,s)})})):(l(`Link ${n.prefix}${r.name} will be added`),p=h.length,t(null,s))},(e,t)=>{if(e)return n(e);t.put(r.name,{size:r.size,multihash:r.cid.buffer},e=>{n(e,{shard:t,path:h})})})})},k=e=>{let t=e.bucket,n=e.pos,r=[{bucket:t,prefix:d(n)}];for(t=e.bucket._parent,n=e.bucket._posAtParent;t;)r.push({bucket:t,prefix:d(n)}),n=t._posAtParent,t=t._parent;return r.reverse(),r};e.exports=y},function(e,t,n){"use strict";(function(t){const{DAGNode:r}=n(34),i=n(10),o=n(152),s=n(43),a=n(292),l=n(223),u=n(4)("ipfs:mfs:core:utils:hamt-utils"),c=n(45),h=(e,n,o,s,a)=>{i([e=>{const i=t.from(o._children.bitField().reverse()),s=new c("hamt-sharded-directory",i);s.fanout=o.tableSize(),s.hashType=l.hashFn.code,r.create(s.marshal(),n,e)},(t,n)=>{e.ipld.put(t,{version:s.cidVersion,format:s.codec,hashAlg:s.hashAlg,hashOnly:!s.flush},(e,r)=>n(e,{node:t,cid:r}))}],a)},f=(e,t,n,r,i)=>{const o=new a({hashFn:l.hashFn,hash:n?n._options.hash:void 0},n,r);n&&n._putObjectAt(r,o),p(e,o,t,i)},p=(e,t,n,r)=>{Promise.all(e.map(e=>{if(2===e.name.length){const n=parseInt(e.name,16);return t._putObjectAt(n,new a({hashFn:l.hashFn},t,n)),Promise.resolve()}return(n||t).put(e.name.substring(2),{size:e.size,multihash:e.cid})})).then(()=>r(null,t),r)},d=e=>e.toString("16").toUpperCase().padStart(2,"0").substring(0,2),m=(e,t,n,r)=>{f(n.links,null,null,null,async(i,s)=>{if(i)return r(i);const a=await s._findNewBucketAndPos(t);let l=[{bucket:a.bucket,prefix:d(a.pos)}],c=a.bucket;for(;c!==s;)l.push({bucket:c,prefix:d(c._posAtParent)}),c=c._parent;l[l.length-1].node=n;let h=l.length;o(()=>h>0,n=>{h--;const r=l[h],i=r.node.links.filter(e=>e.name.substring(0,2)===r.prefix).pop();return i?i.name===`${r.prefix}${t}`?(u(`Link ${r.prefix}${t} will be replaced`),n(null,l)):(u(`Found subshard ${r.prefix}`),void e.ipld.get(i.cid,(e,i)=>{if(e)return n(e);if(!l[h-1]){u(`Loaded new subshard ${r.prefix}`);const e=i.value;return f(e.links,s,r.bucket,parseInt(r.prefix,16),async(r,i)=>{if(r)return n(r);const o=await s._findNewBucketAndPos(t);h++,l.unshift({bucket:o.bucket,prefix:d(o.pos),node:e}),n()})}const o=l[h-1];p(i.value.links,o.bucket,s,e=>{o.node=i.value,n(e)})})):(u(`Link ${r.prefix}${t} will be added`),n(null,l))},async(e,n)=>{await s.put(t,!0),r(e,{rootBucket:s,path:n})})})},g=(e,t,n,r)=>{const i=new l({root:!0,dir:!0,parent:null,parentKey:null,path:"",dirty:!0,flat:!1,...n}),o=t.map(e=>t=>{i.put(e.name,{size:e.size,multihash:e.multihash},t)});return s(o,t=>{if(t)return r(t);i.flush("",e.ipld,null,r)})};e.exports={generatePath:m,updateHamtDirectory:h,recreateHamtLevel:f,addLinksToHamtBucket:p,toPrefix:d,createShard:g}}).call(this,n(0).Buffer)},function(e,t,n){"use strict";e.exports=n(1189)},function(e,t){e.exports={WORKER_REQUEST_READ_LOCK:"lock:worker:request-read",WORKER_RELEASE_READ_LOCK:"lock:worker:release-read",MASTER_GRANT_READ_LOCK:"lock:master:grant-read",WORKER_REQUEST_WRITE_LOCK:"lock:worker:request-write",WORKER_RELEASE_WRITE_LOCK:"lock:worker:release-write",MASTER_GRANT_WRITE_LOCK:"lock:master:grant-write"}},function(e,t){const n={},r=e=>{e.addEventListener("message",t=>{r.dispatchEvent("message",e,t)}),e.port&&e.port.addEventListener("message",t=>{r.dispatchEvent("message",e,t)})};r.addEventListener=((e,t)=>{n[e]||(n[e]=[]),n[e].push(t)}),r.removeEventListener=((e,t)=>{n[e]&&(n[e]=n[e].filter(e=>e===t))}),r.dispatchEvent=function(){const e=Array.prototype.slice.call(arguments),t=e.shift();n[t]&&n[t].forEach(t=>t.apply(null,e))},e.exports=r},function(e,t,n){"use strict";const{FILE_SEPARATOR:r}=n(225),i=n(494),o=n(10),s=n(36),a=n(293),l="ipfs",u=(e,t,n)=>{let l=Array.isArray(t);const u=Array.isArray(t)?t:[t];o([t=>{s({paths:e=>{let t;try{t=u.map(e=>{if(e=(e||"").trim(),e=e.replace(/(\/\/+)/g,"/"),!e)throw new Error("paths must not be empty");if(e.substring(0,1)!==r)throw new Error(`paths must start with a leading ${r}`);return e.substring(e.length-r.length)===r&&(e=e.substring(0,e.length-r.length)),a(e)})}catch(t){return e(t)}e(null,t)},root:t=>i(e,t)},t)},({paths:e,root:t},n)=>{n(null,e.map(e=>{if("ipfs"===e[0]){let n;return n=2===e.length?`${r}${e.join(r)}`:`${r}${e.slice(0,e.length-1).join(r)}`,{type:"ipfs",depth:e.length-2,mfsPath:`${r}${e.join(r)}`,mfsDirectory:n,root:t,parts:e,path:`${r}${e.join(r)}`,name:e[e.length-1]}}const n=`/ipfs/${t.toBaseEncodedString()}/${e.join(r)}`,i=`/ipfs/${t.toBaseEncodedString()}/${e.slice(0,e.length-1).join(r)}`;return{type:"mfs",depth:e.length,mfsDirectory:i,mfsPath:n,root:t,parts:e,path:`${r}${e.join(r)}`,name:e[e.length-1]}}))},(e,t)=>{if(l)return t(null,e);t(null,e[0])}],n)};e.exports=u},function(e,t,n){"use strict";const r=n(9),i=n(45),{DAGNode:o}=n(34),s=n(4)("ipfs:mfs:utils:with-mfs-root"),a=n(10),{MFS_ROOT_KEY:l}=n(225),u=(e,t)=>{a([t=>e.repo.datastore.open(e=>t(e)),t=>{e.repo.datastore.get(l,(n,u)=>{if(n&&(n.notFound||"ERR_NOT_FOUND"===n.code))return s("Creating new MFS root"),a([e=>o.create(new i("directory").marshal(),e),(t,n)=>e.ipld.put(t,{version:0,hashAlg:"sha2-256",format:"dag-pb"},n),(t,n)=>e.repo.datastore.put(l,t.buffer,e=>n(e,t))],t);t(n,u?new r(u):null)})},(e,t)=>{s(`Fetched MFS root ${e.toBaseEncodedString()}`),t(null,e)}],t)};e.exports=u},function(e,t,n){"use strict";(function(t,r){var i=n(11);e.exports=E;var o=n(56),s;E.ReadableState=k;var a=n(6).EventEmitter,l=function(e,t){return e.listeners(t).length},u=n(496),c=n(5).Buffer,h=t.Uint8Array||function(){};function f(e){return c.from(e)}function p(e){return c.isBuffer(e)||e instanceof h}var d=n(8);d.inherits=n(3);var m=n(1211),g=void 0;g=m&&m.debuglog?m.debuglog("stream"):function(){};var y=n(1212),v=n(497),b;d.inherits(E,u);var _=["error","close","destroy","pause","resume"];function w(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)}function k(e,t){s=s||n(129),e=e||{};var r=t instanceof s;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 y,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.destroyed=!1,this.defaultEncoding=e.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,e.encoding&&(b||(b=n(24).StringDecoder),this.decoder=new b(e.encoding),this.encoding=e.encoding)}function E(e){if(s=s||n(129),!(this instanceof E))return new E(e);this._readableState=new k(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 S(e,t,n,r,i){var o=e._readableState,s;null===t?(o.reading=!1,R(e,o)):(i||(s=C(o,t)),s?e.emit("error",s):o.objectMode||t&&t.length>0?("string"==typeof t||o.objectMode||Object.getPrototypeOf(t)===c.prototype||(t=f(t)),r?o.endEmitted?e.emit("error",new Error("stream.unshift() after end event")):x(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?x(e,o,t,!1):P(e,o)):x(e,o,t,!1))):r||(o.reading=!1));return A(o)}function x(e,t,n,r){t.flowing&&0===t.length&&!t.sync?(e.emit("data",n),e.read(0)):(t.length+=t.objectMode?1:n.length,r?t.buffer.unshift(n):t.buffer.push(n),t.needReadable&&B(e)),P(e,t)}function C(e,t){var n;return p(t)||"string"==typeof t||void 0===t||e.objectMode||(n=new TypeError("Invalid non-string/buffer chunk")),n}function A(e){return!e.ended&&(e.needReadable||e.length=T?e=T:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}function j(e,t){return e<=0||0===t.length&&t.ended?0:t.objectMode?1:e!=e?t.flowing&&t.length?t.buffer.head.data.length:t.length:(e>t.highWaterMark&&(t.highWaterMark=I(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}function R(e,t){if(!t.ended){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,B(e)}}function B(e){var t=e._readableState;t.needReadable=!1,t.emittedReadable||(g("emitReadable",t.flowing),t.emittedReadable=!0,t.sync?i.nextTick(O,e):O(e))}function O(e){g("emit readable"),e.emit("readable"),U(e)}function P(e,t){t.readingMore||(t.readingMore=!0,i.nextTick(N,e,t))}function N(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=z(e,t.buffer,t.decoder),n);var n}function z(e,t,n){var r;return eo.length?o.length:e;if(s===o.length?i+=o:i+=o.slice(0,e),e-=s,0===e){s===o.length?(++r,n.next?t.head=n.next:t.head=t.tail=null):(t.head=n,n.data=o.slice(s));break}++r}return t.length-=r,i}function H(e,t){var n=c.allocUnsafe(e),r=t.head,i=1;for(r.data.copy(n),e-=r.data.length;r=r.next;){var o=r.data,s=e>o.length?o.length:e;if(o.copy(n,n.length-e,0,s),e-=s,0===e){s===o.length?(++i,r.next?t.head=r.next:t.head=t.tail=null):(t.head=r,r.data=o.slice(s));break}++i}return t.length-=i,n}function V(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($,t,e))}function $(e,t){e.endEmitted||0!==e.length||(e.endEmitted=!0,t.readable=!1,t.emit("end"))}function W(e,t){for(var n=0,r=e.length;n=t.highWaterMark||t.ended))return g("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?V(this):B(this),null;if(e=j(e,t),0===e&&t.ended)return 0===t.length&&V(this),null;var r=t.needReadable,i;return g("need readable",r),(0===t.length||t.length-e0?q(e,t):null,null===i?(t.needReadable=!0,e=0):t.length-=e,0===t.length&&(t.ended||(t.needReadable=!0),n!==e&&t.ended&&V(this)),null!==i&&this.emit("data",i),i},E.prototype._read=function(e){this.emit("error",new Error("_read() is not implemented"))},E.prototype.pipe=function(e,t){var n=this,o=this._readableState;switch(o.pipesCount){case 0:o.pipes=e;break;case 1:o.pipes=[o.pipes,e];break;default:o.pipes.push(e)}o.pipesCount+=1,g("pipe count=%d opts=%j",o.pipesCount,t);var s=(!t||!1!==t.end)&&e!==r.stdout&&e!==r.stderr,a=s?c:_;function u(e,t){g("onunpipe"),e===n&&t&&!1===t.hasUnpiped&&(t.hasUnpiped=!0,p())}function c(){g("onend"),e.end()}o.endEmitted?i.nextTick(a):n.once("end",a),e.on("unpipe",u);var h=D(n);e.on("drain",h);var f=!1;function p(){g("cleanup"),e.removeListener("close",v),e.removeListener("finish",b),e.removeListener("drain",h),e.removeListener("error",y),e.removeListener("unpipe",u),n.removeListener("end",c),n.removeListener("end",_),n.removeListener("data",m),f=!0,!o.awaitDrain||e._writableState&&!e._writableState.needDrain||h()}var d=!1;function m(t){g("ondata"),d=!1;var r=e.write(t);!1!==r||d||((1===o.pipesCount&&o.pipes===e||o.pipesCount>1&&-1!==W(o.pipes,e))&&!f&&(g("false write response, pause",n._readableState.awaitDrain),n._readableState.awaitDrain++,d=!0),n.pause())}function y(t){g("onerror",t),_(),e.removeListener("error",y),0===l(e,"error")&&e.emit("error",t)}function v(){e.removeListener("finish",b),_()}function b(){g("onfinish"),e.removeListener("close",v),_()}function _(){g("unpipe"),n.unpipe(e)}return n.on("data",m),w(e,"error",y),e.once("close",v),e.once("finish",b),e.emit("pipe",n),o.flowing||(g("pipe resume"),n.resume()),e},E.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?this:(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 o=0;o-1?setImmediate:i.nextTick,l;_.WritableState=b;var u=n(8);u.inherits=n(3);var c={deprecate:n(59)},h=n(496),f=n(5).Buffer,p=r.Uint8Array||function(){};function d(e){return f.from(e)}function m(e){return f.isBuffer(e)||e instanceof p}var g=n(497),y;function v(){}function b(e,t){l=l||n(129),e=e||{};var r=t instanceof l;this.objectMode=!!e.objectMode,r&&(this.objectMode=this.objectMode||!!e.writableObjectMode);var i=e.highWaterMark,o=e.writableHighWaterMark,a=this.objectMode?16:16384;this.highWaterMark=i||0===i?i:r&&(o||0===o)?o:a,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 u=!1===e.decodeStrings;this.decodeStrings=!u,this.defaultEncoding=e.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(e){T(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 s(this)}function _(e){if(l=l||n(129),!(y.call(_,this)||this instanceof l))return new _(e);this._writableState=new b(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 w(e,t){var n=new Error("write after end");e.emit("error",n),i.nextTick(t,n)}function k(e,t,n,r){var o=!0,s=!1;return null===n?s=new TypeError("May not write null values to stream"):"string"==typeof n||void 0===n||t.objectMode||(s=new TypeError("Invalid non-string/buffer chunk")),s&&(e.emit("error",s),i.nextTick(r,s),o=!1),o}function E(e,t,n){return e.objectMode||!1===e.decodeStrings||"string"!=typeof t||(t=f.from(t,n)),t}function S(e,t,n,r,i,o){if(!n){var s=E(t,r,i);r!==s&&(n=!0,i="buffer",r=s)}var a=t.objectMode?1:r.length;t.length+=a;var l=t.length-1))throw new TypeError("Unknown encoding: "+t);return this._writableState.defaultEncoding=t,this},Object.defineProperty(_.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),_.prototype._write=function(e,t,n){n(new Error("_write() is not implemented"))},_.prototype._writev=null,_.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&&void 0!==e&&this.write(e,t),r.corked&&(r.corked=1,this.uncork()),r.ending||r.finished||D(this,r,n)},Object.defineProperty(_.prototype,"destroyed",{get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(e){this._writableState&&(this._writableState.destroyed=e)}}),_.prototype.destroy=g.destroy,_.prototype._undestroy=g.undestroy,_.prototype._destroy=function(e,t){this.end(),t(e)}}).call(this,n(2),n(7))},function(e,t,n){"use strict";e.exports=s;var r=n(129),i=n(8);function o(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.length"object"==typeof e).pop()||{});Array.isArray(t[0])&&(t=t[0]);const s=t.filter(e=>"string"==typeof e).map(e=>e.trim());r(e,s,(e,t)=>{i(e,{sources:t,options:o})})}e.exports=i},function(e,t,n){"use strict";const r=n(10),i=n(36),{addLink:o,updateTree:s,updateMfsRoot:a,toTrail:l,toSourcesAndDestination:u,toMfsPath:c}=n(73),h=n(227),f=n(295),p=n(4)("ipfs:mfs:cp"),d={parents:!1,flush:!0,format:"dag-pb",hashAlg:"sha2-256",shardSplitThreshold:1e3};e.exports=(e=>(function t(){const n=Array.from(arguments),i=n.pop();r([t=>u(e,n,d,t),({sources:e,destination:t,options:n},r)=>e.length?t?(n.parents=n.p||n.parents,void r(null,{sources:e,destination:t,options:n})):r(new Error("Please supply a destination")):r(new Error("Please supply at least one source")),({sources:t,destination:n,options:r},i)=>l(e,n.mfsPath,r,(o,s)=>{if(o)return i(o);if(s.length===n.parts.length)return p("Destination does not exist"),1===t.length?(p("Only one source, copying to a file"),m(e,t.pop(),n,s,r,i)):(p("Multiple sources, copying to a directory"),g(e,t,n,s,r,i));const a=s[s.length-1];if("dir"===a.type)return p("Destination is a directory"),g(e,t,n,s,r,i);i(new Error("directory already has entry by that name"))})],i)}));const m=(e,t,n,i,l,u)=>{r([n=>y(e,t,l,n),(t,s)=>{const a=i[i.length-1],l=t[t.length-1];r([t=>e.ipld.get(a.cid,t),(t,r)=>o(e,{parent:t.value,parentCid:a.cid,size:l.size,cid:l.cid,name:n.parts[n.parts.length-1]},r),({node:e,cid:t},n)=>{a.node=e,a.cid=t,a.size=e.size,n(null,i)}],s)},(t,n)=>s(e,t,l,n),({cid:t},n)=>a(e,t,n)],e=>u(e))},g=(e,t,n,u,d,m)=>{r([t=>{if(u.length!==n.parts.length+1)return p("Making destination directory",n.path),r([t=>f(e)(n.path,d,t),t=>c(e,n.path,t),(t,r)=>{n=t,l(e,n.mfsPath,d,r)}],(e,n)=>{if(e)return t(e);u=n,t()});t()},n=>i(t.map(t=>n=>y(e,t,d,n)),n),(l,c)=>{r([r=>{i(t.map(t=>r=>{h(e)(`${n.path}/${t.name}`,d,e=>{if(e)return e.message.includes("does not exist")?r():r(e);r(new Error("directory already has entry by that name"))})}),e=>r(e))},n=>{const i=u[u.length-1];r([t=>e.ipld.get(i.cid,t),(e,t)=>t(null,{cid:i.cid,node:e.value})].concat(l.map((n,r)=>(i,s)=>{const a=n[n.length-1];p(`Adding ${t[r].name} to ${i.cid.toBaseEncodedString()}`),o(e,{parent:i.node,parentCid:i.cid,size:a.size,cid:a.cid,name:t[r].name},(e,t)=>{if(e)return s(e);p(`New directory hash ${t.cid.toBaseEncodedString()}`),s(e,t)})})),n)},({node:e,cid:t},n)=>{const r=u[u.length-1];r.node=e,r.cid=t,r.size=e.size,n(null,u)},(t,n)=>s(e,t,d,n),({cid:t},n)=>a(e,t,n)],c)}],e=>m(e))},y=(e,t,n,r)=>{l(e,t.mfsPath,n,(e,n)=>e?r(e):"ipfs"===t.type?r(null,n):n.length!==t.parts.length+1?r(new Error(`${t.path} does not exist`)):void r(null,n))}},function(e,t,n){"use strict";const r=n(10),i=n(43),{updateTree:o,updateMfsRoot:s,toSources:a,removeLink:l,toMfsPath:u,toTrail:c,FILE_SEPARATOR:h}=n(73),f={recursive:!1,cidVersion:0,hashAlg:"sha2-256",format:"dag-pb"};e.exports=(e=>(function t(){const n=Array.from(arguments),o=n.pop();r([t=>a(e,n,f,t),({sources:t,options:n},r)=>{if(!t.length)return r(new Error("Please supply at least one path to remove"));i(t.map(t=>r=>p(e,t.path,n,r)),e=>r(e))}],o)}));const p=(e,t,n,i)=>{if(t===h)return i(new Error("Cannot delete root"));r([n=>u(e,t,n),({mfsPath:t,parts:r},i)=>c(e,t,n,(e,n)=>i(e,{mfsPath:t,parts:r,trail:n})),({trail:i},o)=>{const s=i.pop(),a=i[i.length-1];return a?"dir"!==s.type||n.recursive?void r([t=>l(e,{parentCid:a.cid,name:s.name},t),({cid:e},t)=>{a.cid=e,t(null,i)}],o):o(new Error(`${t} is a directory, use -r to remove directories`)):o(new Error(`${t} does not exist`))},(t,r)=>o(e,t,n,r),({cid:t},n)=>s(e,t,n)],i)}},function(e,t,n){"use strict";const r=n(161).OFFLINE_ERROR,i=n(1),o=n(19),s=n(53),a=n(9),l=n(15),u=n(13);function c(e,t){return Array.from(e).map(e=>({"/":e[1].cid.toBaseEncodedString()}))}e.exports=function e(t){return{wantlist:i((e,n)=>{if("function"==typeof e&&(n=e,e=null),!t.isOnline())return o(()=>n(new Error(r)));let i;if(e){try{e=l.createFromB58String(e)}catch(t){e=null}if(!e)return o(()=>n(new Error("Invalid peerId")));i=t._bitswap.wantlistForPeer(e)}else i=t._bitswap.getWantlist();o(()=>n(null,{Keys:c(i)}))}),stat:i(e=>{if(!t.isOnline())return o(()=>e(new Error(r)));const n=t._bitswap.stat().snapshot;o(()=>{e(null,{provideBufLen:parseInt(n.providesBufferLength.toString()),blocksReceived:new s(n.blocksReceived),wantlist:c(t._bitswap.getWantlist()),peers:t._bitswap.peers().map(e=>e.toB58String()),dupBlksReceived:new s(n.dupBlksReceived),dupDataReceived:new s(n.dupDataReceived),dataReceived:new s(n.dataReceived),blocksSent:new s(n.blocksSent),dataSent:new s(n.dataSent)})})}),unwant:i((e,n)=>{if(!t.isOnline())return o(()=>n(new Error(r)));Array.isArray(e)||(e=[e]);try{e=e.map(e=>a.isCID(e)?e:new a(e))}catch(e){return o(()=>n(u(e,"ERR_INVALID_CID")))}o(()=>n(null,t._bitswap.unwant(e)))})}}},function(e,t,n){"use strict";const r=n(1),i=/^((\d+(\.\d+)*)(ns|ms|us|µs|m|s|h))+$/,o=/((\d+(\.\d+)*)(ns|ms|us|µs|m|s|h))/g,s=/(ns|ms|us|µs|m|s|h)/g,a={ns:1e-6,us:.001,"µs":.001,ms:1,s:1e3,m:6e4,h:36e5};function l(e){let t=e.match(s)[0];return e=e.substring(0,e.length-t.length),parseFloat(e)*a[t]}e.exports=r(function(e,t){return"string"!=typeof e?t(new Error("the first argument must be a string")):i.test(e)?void t(null,e.match(o).reduce((e,t)=>e+l(t),0)):t(new Error("invalid time"))})},function(e,t,n){"use strict";(function(t){const r=n(1),i=n(164),o=n(26),s=n(128),a=n(508),l=n(162).isSource,u=n(130),c=n(165);e.exports=(e=>{const n=c(e,"add"),h=r((e,r,c)=>{"function"==typeof r&&(c=r,r=null);const h=o(c);r||(r={}),r.converter=u;const f=e=>t.isBuffer(e)||s.readable(e)||l(e),p=e=>"object"==typeof e&&(e.content?f(e.content):Boolean(e.path)&&a(e.path)),d=e=>f(e)||p(e),m=d(e)||Array.isArray(e)&&e.every(d);if(!m)return h(new Error("invalid input: expected buffer, readable stream, pull stream, object or array of objects"));const g=[].concat(e),y=n({qs:r}),v=i(e=>h(null,e));y.once("error",h),y.pipe(v),g.forEach(e=>y.write(e)),y.end()});return function(){const e=Array.from(arguments);return 1===e.length&&l(e[0])&&e.push({}),h.apply(null,e)}})}).call(this,n(0).Buffer)},function(e,t,n){var r=n(108),i=n(65),o=n(87),s="[object String]";function a(e){return"string"==typeof e||!i(e)&&o(e)&&r(e)==s}e.exports=a},function(e,t,n){"use strict";const r=n(1261),i=n(167);e.exports=(e=>0===e.indexOf("https")?i.request:r.request)},function(e,t,n){(function(e){var n;function r(){if(void 0!==n)return n;if(e.XMLHttpRequest){n=new e.XMLHttpRequest;try{n.open("GET",e.XDomainRequest?"/":"https://example.com")}catch(e){n=null}}else n=null;return n}function i(e){var t=r();if(!t)return!1;try{return t.responseType=e,t.responseType===e}catch(e){}return!1}function o(e){return"function"==typeof e}t.fetch=o(e.fetch)&&o(e.ReadableStream),t.writableStream=o(e.WritableStream),t.abortController=o(e.AbortController),t.arraybuffer=t.fetch||i("arraybuffer"),t.msstream=!t.fetch&&i("ms-stream"),t.mozchunkedarraybuffer=!t.fetch&&i("moz-chunked-arraybuffer"),t.overrideMimeType=t.fetch||!!r()&&o(r().overrideMimeType),n=null}).call(this,n(7))},function(e,t,n){(function(e,r,i){var o=n(510),s=n(3),a=n(16),l=t.readyStates={UNSENT:0,OPENED:1,HEADERS_RECEIVED:2,LOADING:3,DONE:4},u=t.IncomingMessage=function(t,n,s,l){var u=this;if(a.Readable.call(u),u._mode=s,u.headers={},u.rawHeaders=[],u.trailers={},u.rawTrailers=[],u.on("end",function(){e.nextTick(function(){u.emit("close")})}),"fetch"===s){if(u._fetchResponse=n,u.url=n.url,u.statusCode=n.status,u.statusMessage=n.statusText,n.headers.forEach(function(e,t){u.headers[t.toLowerCase()]=e,u.rawHeaders.push(t,e)}),o.writableStream){var c=new WritableStream({write:function(e){return new Promise(function(t,n){u._destroyed?n():u.push(r.from(e))?t():u._resumeFetch=t})},close:function(){i.clearTimeout(l),u._destroyed||u.push(null)},abort:function(e){u._destroyed||u.emit("error",e)}});try{return void n.body.pipeTo(c).catch(function(e){i.clearTimeout(l),u._destroyed||u.emit("error",e)})}catch(e){}}var h=n.body.getReader();function f(){h.read().then(function(e){if(!u._destroyed){if(e.done)return i.clearTimeout(l),void u.push(null);u.push(r.from(e.value)),f()}}).catch(function(e){i.clearTimeout(l),u._destroyed||u.emit("error",e)})}f()}else{u._xhr=t,u._pos=0,u.url=t.responseURL,u.statusCode=t.status,u.statusMessage=t.statusText;var p=t.getAllResponseHeaders().split(/\r?\n/);if(p.forEach(function(e){var t=e.match(/^([^:]+):\s*(.*)/);if(t){var n=t[1].toLowerCase();"set-cookie"===n?(void 0===u.headers[n]&&(u.headers[n]=[]),u.headers[n].push(t[2])):void 0!==u.headers[n]?u.headers[n]+=", "+t[2]:u.headers[n]=t[2],u.rawHeaders.push(t[1],t[2])}}),u._charset="x-user-defined",!o.overrideMimeType){var d=u.rawHeaders["mime-type"];if(d){var m=d.match(/;\s*charset=([^;])(;|$)/);m&&(u._charset=m[1].toLowerCase())}u._charset||(u._charset="utf-8")}}};s(u,a.Readable),u.prototype._read=function(){var e=this,t=this._resumeFetch;t&&(this._resumeFetch=null,t())},u.prototype._onXHRProgress=function(){var e=this,t=e._xhr,n=null;switch(e._mode){case"text":if(n=t.responseText,n.length>e._pos){var o=n.substr(e._pos);if("x-user-defined"===e._charset){for(var s=r.alloc(o.length),a=0;ae._pos&&(e.push(r.from(new Uint8Array(u.result.slice(e._pos)))),e._pos=u.result.byteLength)},u.onload=function(){e.push(null)},u.readAsArrayBuffer(n)}e._xhr.readyState===l.DONE&&"ms-stream"!==e._mode&&e.push(null)}}).call(this,n(2),n(0).Buffer,n(7))},function(e,t){e.exports={100:"Continue",101:"Switching Protocols",102:"Processing",200:"OK",201:"Created",202:"Accepted",203:"Non-Authoritative Information",204:"No Content",205:"Reset Content",206:"Partial Content",207:"Multi-Status",208:"Already Reported",226:"IM Used",300:"Multiple Choices",301:"Moved Permanently",302:"Found",303:"See Other",304:"Not Modified",305:"Use Proxy",307:"Temporary Redirect",308:"Permanent Redirect",400:"Bad Request",401:"Unauthorized",402:"Payment Required",403:"Forbidden",404:"Not Found",405:"Method Not Allowed",406:"Not Acceptable",407:"Proxy Authentication Required",408:"Request Timeout",409:"Conflict",410:"Gone",411:"Length Required",412:"Precondition Failed",413:"Payload Too Large",414:"URI Too Long",415:"Unsupported Media Type",416:"Range Not Satisfiable",417:"Expectation Failed",418:"I'm a teapot",421:"Misdirected Request",422:"Unprocessable Entity",423:"Locked",424:"Failed Dependency",425:"Unordered Collection",426:"Upgrade Required",428:"Precondition Required",429:"Too Many Requests",431:"Request Header Fields Too Large",451:"Unavailable For Legal Reasons",500:"Internal Server Error",501:"Not Implemented",502:"Bad Gateway",503:"Service Unavailable",504:"Gateway Timeout",505:"HTTP Version Not Supported",506:"Variant Also Negotiates",507:"Insufficient Storage",508:"Loop Detected",509:"Bandwidth Limit Exceeded",510:"Not Extended",511:"Network Authentication Required"}},function(e,t,n){(function(e){t.fetch=a(e.fetch)&&a(e.ReadableStream),t.writableStream=a(e.WritableStream),t.abortController=a(e.AbortController),t.blobConstructor=!1;try{new Blob([new ArrayBuffer(1)]),t.blobConstructor=!0}catch(e){}var n;function r(){if(void 0!==n)return n;if(e.XMLHttpRequest){n=new e.XMLHttpRequest;try{n.open("GET",e.XDomainRequest?"/":"https://example.com")}catch(e){n=null}}else n=null;return n}function i(e){var t=r();if(!t)return!1;try{return t.responseType=e,t.responseType===e}catch(e){}return!1}var o=void 0!==e.ArrayBuffer,s=o&&a(e.ArrayBuffer.prototype.slice);function a(e){return"function"==typeof e}t.arraybuffer=t.fetch||o&&i("arraybuffer"),t.msstream=!t.fetch&&s&&i("ms-stream"),t.mozchunkedarraybuffer=!t.fetch&&o&&i("moz-chunked-arraybuffer"),t.overrideMimeType=t.fetch||!!r()&&a(r().overrideMimeType),t.vbArray=a(e.VBArray),n=null}).call(this,n(7))},function(e,t,n){(function(e,r,i){var o=n(513),s=n(3),a=n(515),l=t.readyStates={UNSENT:0,OPENED:1,HEADERS_RECEIVED:2,LOADING:3,DONE:4},u=t.IncomingMessage=function(t,n,s,l){var u=this;if(a.Readable.call(u),u._mode=s,u.headers={},u.rawHeaders=[],u.trailers={},u.rawTrailers=[],u.on("end",function(){e.nextTick(function(){u.emit("close")})}),"fetch"===s){if(u._fetchResponse=n,u.url=n.url,u.statusCode=n.status,u.statusMessage=n.statusText,n.headers.forEach(function(e,t){u.headers[t.toLowerCase()]=e,u.rawHeaders.push(t,e)}),o.writableStream){var c=new WritableStream({write:function(e){return new Promise(function(t,n){u._destroyed?n():u.push(new r(e))?t():u._resumeFetch=t})},close:function(){i.clearTimeout(l),u._destroyed||u.push(null)},abort:function(e){u._destroyed||u.emit("error",e)}});try{return void n.body.pipeTo(c).catch(function(e){i.clearTimeout(l),u._destroyed||u.emit("error",e)})}catch(e){}}var h=n.body.getReader();function f(){h.read().then(function(e){if(!u._destroyed){if(e.done)return i.clearTimeout(l),void u.push(null);u.push(new r(e.value)),f()}}).catch(function(e){i.clearTimeout(l),u._destroyed||u.emit("error",e)})}f()}else{u._xhr=t,u._pos=0,u.url=t.responseURL,u.statusCode=t.status,u.statusMessage=t.statusText;var p=t.getAllResponseHeaders().split(/\r?\n/);if(p.forEach(function(e){var t=e.match(/^([^:]+):\s*(.*)/);if(t){var n=t[1].toLowerCase();"set-cookie"===n?(void 0===u.headers[n]&&(u.headers[n]=[]),u.headers[n].push(t[2])):void 0!==u.headers[n]?u.headers[n]+=", "+t[2]:u.headers[n]=t[2],u.rawHeaders.push(t[1],t[2])}}),u._charset="x-user-defined",!o.overrideMimeType){var d=u.rawHeaders["mime-type"];if(d){var m=d.match(/;\s*charset=([^;])(;|$)/);m&&(u._charset=m[1].toLowerCase())}u._charset||(u._charset="utf-8")}}};s(u,a.Readable),u.prototype._read=function(){var e=this,t=this._resumeFetch;t&&(this._resumeFetch=null,t())},u.prototype._onXHRProgress=function(){var e=this,t=e._xhr,n=null;switch(e._mode){case"text:vbarray":if(t.readyState!==l.DONE)break;try{n=new i.VBArray(t.responseBody).toArray()}catch(e){}if(null!==n){e.push(new r(n));break}case"text":try{n=t.responseText}catch(t){e._mode="text:vbarray";break}if(n.length>e._pos){var o=n.substr(e._pos);if("x-user-defined"===e._charset){for(var s=new r(o.length),a=0;ae._pos&&(e.push(new r(new Uint8Array(u.result.slice(e._pos)))),e._pos=u.result.byteLength)},u.onload=function(){e.push(null)},u.readAsArrayBuffer(n)}e._xhr.readyState===l.DONE&&"ms-stream"!==e._mode&&e.push(null)}}).call(this,n(2),n(0).Buffer,n(7))},function(e,t,n){t=e.exports=n(516),t.Stream=t,t.Readable=t,t.Writable=n(519),t.Duplex=n(132),t.Transform=n(520),t.PassThrough=n(1267)},function(e,t,n){"use strict";(function(t,r){var i=n(11);e.exports=E;var o=n(56),s;E.ReadableState=k;var a=n(6).EventEmitter,l=function(e,t){return e.listeners(t).length},u=n(517),c=n(5).Buffer,h=t.Uint8Array||function(){};function f(e){return c.from(e)}function p(e){return c.isBuffer(e)||e instanceof h}var d=n(8);d.inherits=n(3);var m=n(1264),g=void 0;g=m&&m.debuglog?m.debuglog("stream"):function(){};var y=n(1265),v=n(518),b;d.inherits(E,u);var _=["error","close","destroy","pause","resume"];function w(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)}function k(e,t){s=s||n(132),e=e||{};var r=t instanceof s;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 y,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.destroyed=!1,this.defaultEncoding=e.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,e.encoding&&(b||(b=n(24).StringDecoder),this.decoder=new b(e.encoding),this.encoding=e.encoding)}function E(e){if(s=s||n(132),!(this instanceof E))return new E(e);this._readableState=new k(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 S(e,t,n,r,i){var o=e._readableState,s;null===t?(o.reading=!1,R(e,o)):(i||(s=C(o,t)),s?e.emit("error",s):o.objectMode||t&&t.length>0?("string"==typeof t||o.objectMode||Object.getPrototypeOf(t)===c.prototype||(t=f(t)),r?o.endEmitted?e.emit("error",new Error("stream.unshift() after end event")):x(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?x(e,o,t,!1):P(e,o)):x(e,o,t,!1))):r||(o.reading=!1));return A(o)}function x(e,t,n,r){t.flowing&&0===t.length&&!t.sync?(e.emit("data",n),e.read(0)):(t.length+=t.objectMode?1:n.length,r?t.buffer.unshift(n):t.buffer.push(n),t.needReadable&&B(e)),P(e,t)}function C(e,t){var n;return p(t)||"string"==typeof t||void 0===t||e.objectMode||(n=new TypeError("Invalid non-string/buffer chunk")),n}function A(e){return!e.ended&&(e.needReadable||e.length=T?e=T:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}function j(e,t){return e<=0||0===t.length&&t.ended?0:t.objectMode?1:e!=e?t.flowing&&t.length?t.buffer.head.data.length:t.length:(e>t.highWaterMark&&(t.highWaterMark=I(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}function R(e,t){if(!t.ended){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,B(e)}}function B(e){var t=e._readableState;t.needReadable=!1,t.emittedReadable||(g("emitReadable",t.flowing),t.emittedReadable=!0,t.sync?i.nextTick(O,e):O(e))}function O(e){g("emit readable"),e.emit("readable"),U(e)}function P(e,t){t.readingMore||(t.readingMore=!0,i.nextTick(N,e,t))}function N(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=z(e,t.buffer,t.decoder),n);var n}function z(e,t,n){var r;return eo.length?o.length:e;if(s===o.length?i+=o:i+=o.slice(0,e),e-=s,0===e){s===o.length?(++r,n.next?t.head=n.next:t.head=t.tail=null):(t.head=n,n.data=o.slice(s));break}++r}return t.length-=r,i}function H(e,t){var n=c.allocUnsafe(e),r=t.head,i=1;for(r.data.copy(n),e-=r.data.length;r=r.next;){var o=r.data,s=e>o.length?o.length:e;if(o.copy(n,n.length-e,0,s),e-=s,0===e){s===o.length?(++i,r.next?t.head=r.next:t.head=t.tail=null):(t.head=r,r.data=o.slice(s));break}++i}return t.length-=i,n}function V(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($,t,e))}function $(e,t){e.endEmitted||0!==e.length||(e.endEmitted=!0,t.readable=!1,t.emit("end"))}function W(e,t){for(var n=0,r=e.length;n=t.highWaterMark||t.ended))return g("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?V(this):B(this),null;if(e=j(e,t),0===e&&t.ended)return 0===t.length&&V(this),null;var r=t.needReadable,i;return g("need readable",r),(0===t.length||t.length-e0?q(e,t):null,null===i?(t.needReadable=!0,e=0):t.length-=e,0===t.length&&(t.ended||(t.needReadable=!0),n!==e&&t.ended&&V(this)),null!==i&&this.emit("data",i),i},E.prototype._read=function(e){this.emit("error",new Error("_read() is not implemented"))},E.prototype.pipe=function(e,t){var n=this,o=this._readableState;switch(o.pipesCount){case 0:o.pipes=e;break;case 1:o.pipes=[o.pipes,e];break;default:o.pipes.push(e)}o.pipesCount+=1,g("pipe count=%d opts=%j",o.pipesCount,t);var s=(!t||!1!==t.end)&&e!==r.stdout&&e!==r.stderr,a=s?c:_;function u(e,t){g("onunpipe"),e===n&&t&&!1===t.hasUnpiped&&(t.hasUnpiped=!0,p())}function c(){g("onend"),e.end()}o.endEmitted?i.nextTick(a):n.once("end",a),e.on("unpipe",u);var h=D(n);e.on("drain",h);var f=!1;function p(){g("cleanup"),e.removeListener("close",v),e.removeListener("finish",b),e.removeListener("drain",h),e.removeListener("error",y),e.removeListener("unpipe",u),n.removeListener("end",c),n.removeListener("end",_),n.removeListener("data",m),f=!0,!o.awaitDrain||e._writableState&&!e._writableState.needDrain||h()}var d=!1;function m(t){g("ondata"),d=!1;var r=e.write(t);!1!==r||d||((1===o.pipesCount&&o.pipes===e||o.pipesCount>1&&-1!==W(o.pipes,e))&&!f&&(g("false write response, pause",n._readableState.awaitDrain),n._readableState.awaitDrain++,d=!0),n.pause())}function y(t){g("onerror",t),_(),e.removeListener("error",y),0===l(e,"error")&&e.emit("error",t)}function v(){e.removeListener("finish",b),_()}function b(){g("onfinish"),e.removeListener("close",v),_()}function _(){g("unpipe"),n.unpipe(e)}return n.on("data",m),w(e,"error",y),e.once("close",v),e.once("finish",b),e.emit("pipe",n),o.flowing||(g("pipe resume"),n.resume()),e},E.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?this:(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 o=0;o-1?setImmediate:i.nextTick,l;_.WritableState=b;var u=n(8);u.inherits=n(3);var c={deprecate:n(59)},h=n(517),f=n(5).Buffer,p=r.Uint8Array||function(){};function d(e){return f.from(e)}function m(e){return f.isBuffer(e)||e instanceof p}var g=n(518),y;function v(){}function b(e,t){l=l||n(132),e=e||{};var r=t instanceof l;this.objectMode=!!e.objectMode,r&&(this.objectMode=this.objectMode||!!e.writableObjectMode);var i=e.highWaterMark,o=e.writableHighWaterMark,a=this.objectMode?16:16384;this.highWaterMark=i||0===i?i:r&&(o||0===o)?o:a,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 u=!1===e.decodeStrings;this.decodeStrings=!u,this.defaultEncoding=e.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(e){T(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 s(this)}function _(e){if(l=l||n(132),!(y.call(_,this)||this instanceof l))return new _(e);this._writableState=new b(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 w(e,t){var n=new Error("write after end");e.emit("error",n),i.nextTick(t,n)}function k(e,t,n,r){var o=!0,s=!1;return null===n?s=new TypeError("May not write null values to stream"):"string"==typeof n||void 0===n||t.objectMode||(s=new TypeError("Invalid non-string/buffer chunk")),s&&(e.emit("error",s),i.nextTick(r,s),o=!1),o}function E(e,t,n){return e.objectMode||!1===e.decodeStrings||"string"!=typeof t||(t=f.from(t,n)),t}function S(e,t,n,r,i,o){if(!n){var s=E(t,r,i);r!==s&&(n=!0,i="buffer",r=s)}var a=t.objectMode?1:r.length;t.length+=a;var l=t.length-1))throw new TypeError("Unknown encoding: "+t);return this._writableState.defaultEncoding=t,this},Object.defineProperty(_.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),_.prototype._write=function(e,t,n){n(new Error("_write() is not implemented"))},_.prototype._writev=null,_.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&&void 0!==e&&this.write(e,t),r.corked&&(r.corked=1,this.uncork()),r.ending||r.finished||D(this,r,n)},Object.defineProperty(_.prototype,"destroyed",{get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(e){this._writableState&&(this._writableState.destroyed=e)}}),_.prototype.destroy=g.destroy,_.prototype._undestroy=g.undestroy,_.prototype._destroy=function(e,t){this.end(),t(e)}}).call(this,n(2),n(7))},function(e,t,n){"use strict";e.exports=s;var r=n(132),i=n(8);function o(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.length0?("string"==typeof t||o.objectMode||Object.getPrototypeOf(t)===c.prototype||(t=f(t)),r?o.endEmitted?e.emit("error",new Error("stream.unshift() after end event")):x(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?x(e,o,t,!1):P(e,o)):x(e,o,t,!1))):r||(o.reading=!1));return A(o)}function x(e,t,n,r){t.flowing&&0===t.length&&!t.sync?(e.emit("data",n),e.read(0)):(t.length+=t.objectMode?1:n.length,r?t.buffer.unshift(n):t.buffer.push(n),t.needReadable&&B(e)),P(e,t)}function C(e,t){var n;return p(t)||"string"==typeof t||void 0===t||e.objectMode||(n=new TypeError("Invalid non-string/buffer chunk")),n}function A(e){return!e.ended&&(e.needReadable||e.length=T?e=T:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}function j(e,t){return e<=0||0===t.length&&t.ended?0:t.objectMode?1:e!=e?t.flowing&&t.length?t.buffer.head.data.length:t.length:(e>t.highWaterMark&&(t.highWaterMark=I(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}function R(e,t){if(!t.ended){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,B(e)}}function B(e){var t=e._readableState;t.needReadable=!1,t.emittedReadable||(g("emitReadable",t.flowing),t.emittedReadable=!0,t.sync?i.nextTick(O,e):O(e))}function O(e){g("emit readable"),e.emit("readable"),U(e)}function P(e,t){t.readingMore||(t.readingMore=!0,i.nextTick(N,e,t))}function N(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=z(e,t.buffer,t.decoder),n);var n}function z(e,t,n){var r;return eo.length?o.length:e;if(s===o.length?i+=o:i+=o.slice(0,e),e-=s,0===e){s===o.length?(++r,n.next?t.head=n.next:t.head=t.tail=null):(t.head=n,n.data=o.slice(s));break}++r}return t.length-=r,i}function H(e,t){var n=c.allocUnsafe(e),r=t.head,i=1;for(r.data.copy(n),e-=r.data.length;r=r.next;){var o=r.data,s=e>o.length?o.length:e;if(o.copy(n,n.length-e,0,s),e-=s,0===e){s===o.length?(++i,r.next?t.head=r.next:t.head=t.tail=null):(t.head=r,r.data=o.slice(s));break}++i}return t.length-=i,n}function V(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($,t,e))}function $(e,t){e.endEmitted||0!==e.length||(e.endEmitted=!0,t.readable=!1,t.emit("end"))}function W(e,t){for(var n=0,r=e.length;n=t.highWaterMark||t.ended))return g("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?V(this):B(this),null;if(e=j(e,t),0===e&&t.ended)return 0===t.length&&V(this),null;var r=t.needReadable,i;return g("need readable",r),(0===t.length||t.length-e0?q(e,t):null,null===i?(t.needReadable=!0,e=0):t.length-=e,0===t.length&&(t.ended||(t.needReadable=!0),n!==e&&t.ended&&V(this)),null!==i&&this.emit("data",i),i},E.prototype._read=function(e){this.emit("error",new Error("_read() is not implemented"))},E.prototype.pipe=function(e,t){var n=this,o=this._readableState;switch(o.pipesCount){case 0:o.pipes=e;break;case 1:o.pipes=[o.pipes,e];break;default:o.pipes.push(e)}o.pipesCount+=1,g("pipe count=%d opts=%j",o.pipesCount,t);var s=(!t||!1!==t.end)&&e!==r.stdout&&e!==r.stderr,a=s?c:_;function u(e,t){g("onunpipe"),e===n&&t&&!1===t.hasUnpiped&&(t.hasUnpiped=!0,p())}function c(){g("onend"),e.end()}o.endEmitted?i.nextTick(a):n.once("end",a),e.on("unpipe",u);var h=D(n);e.on("drain",h);var f=!1;function p(){g("cleanup"),e.removeListener("close",v),e.removeListener("finish",b),e.removeListener("drain",h),e.removeListener("error",y),e.removeListener("unpipe",u),n.removeListener("end",c),n.removeListener("end",_),n.removeListener("data",m),f=!0,!o.awaitDrain||e._writableState&&!e._writableState.needDrain||h()}var d=!1;function m(t){g("ondata"),d=!1;var r=e.write(t);!1!==r||d||((1===o.pipesCount&&o.pipes===e||o.pipesCount>1&&-1!==W(o.pipes,e))&&!f&&(g("false write response, pause",n._readableState.awaitDrain),n._readableState.awaitDrain++,d=!0),n.pause())}function y(t){g("onerror",t),_(),e.removeListener("error",y),0===l(e,"error")&&e.emit("error",t)}function v(){e.removeListener("finish",b),_()}function b(){g("onfinish"),e.removeListener("close",v),_()}function _(){g("unpipe"),n.unpipe(e)}return n.on("data",m),w(e,"error",y),e.once("close",v),e.once("finish",b),e.emit("pipe",n),o.flowing||(g("pipe resume"),n.resume()),e},E.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?this:(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 o=0;o-1?setImmediate:i.nextTick,l;_.WritableState=b;var u=n(8);u.inherits=n(3);var c={deprecate:n(59)},h=n(523),f=n(5).Buffer,p=r.Uint8Array||function(){};function d(e){return f.from(e)}function m(e){return f.isBuffer(e)||e instanceof p}var g=n(524),y;function v(){}function b(e,t){l=l||n(133),e=e||{};var r=t instanceof l;this.objectMode=!!e.objectMode,r&&(this.objectMode=this.objectMode||!!e.writableObjectMode);var i=e.highWaterMark,o=e.writableHighWaterMark,a=this.objectMode?16:16384;this.highWaterMark=i||0===i?i:r&&(o||0===o)?o:a,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 u=!1===e.decodeStrings;this.decodeStrings=!u,this.defaultEncoding=e.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(e){T(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 s(this)}function _(e){if(l=l||n(133),!(y.call(_,this)||this instanceof l))return new _(e);this._writableState=new b(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 w(e,t){var n=new Error("write after end");e.emit("error",n),i.nextTick(t,n)}function k(e,t,n,r){var o=!0,s=!1;return null===n?s=new TypeError("May not write null values to stream"):"string"==typeof n||void 0===n||t.objectMode||(s=new TypeError("Invalid non-string/buffer chunk")),s&&(e.emit("error",s),i.nextTick(r,s),o=!1),o}function E(e,t,n){return e.objectMode||!1===e.decodeStrings||"string"!=typeof t||(t=f.from(t,n)),t}function S(e,t,n,r,i,o){if(!n){var s=E(t,r,i);r!==s&&(n=!0,i="buffer",r=s)}var a=t.objectMode?1:r.length;t.length+=a;var l=t.length-1))throw new TypeError("Unknown encoding: "+t);return this._writableState.defaultEncoding=t,this},Object.defineProperty(_.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),_.prototype._write=function(e,t,n){n(new Error("_write() is not implemented"))},_.prototype._writev=null,_.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&&void 0!==e&&this.write(e,t),r.corked&&(r.corked=1,this.uncork()),r.ending||r.finished||D(this,r,n)},Object.defineProperty(_.prototype,"destroyed",{get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(e){this._writableState&&(this._writableState.destroyed=e)}}),_.prototype.destroy=g.destroy,_.prototype._undestroy=g.undestroy,_.prototype._destroy=function(e,t){this.end(),t(e)}}).call(this,n(2),n(7))},function(e,t,n){"use strict";e.exports=s;var r=n(133),i=n(8);function o(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.length0?("string"==typeof t||o.objectMode||Object.getPrototypeOf(t)===c.prototype||(t=f(t)),r?o.endEmitted?e.emit("error",new Error("stream.unshift() after end event")):x(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?x(e,o,t,!1):P(e,o)):x(e,o,t,!1))):r||(o.reading=!1));return A(o)}function x(e,t,n,r){t.flowing&&0===t.length&&!t.sync?(e.emit("data",n),e.read(0)):(t.length+=t.objectMode?1:n.length,r?t.buffer.unshift(n):t.buffer.push(n),t.needReadable&&B(e)),P(e,t)}function C(e,t){var n;return p(t)||"string"==typeof t||void 0===t||e.objectMode||(n=new TypeError("Invalid non-string/buffer chunk")),n}function A(e){return!e.ended&&(e.needReadable||e.length=T?e=T:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}function j(e,t){return e<=0||0===t.length&&t.ended?0:t.objectMode?1:e!=e?t.flowing&&t.length?t.buffer.head.data.length:t.length:(e>t.highWaterMark&&(t.highWaterMark=I(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}function R(e,t){if(!t.ended){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,B(e)}}function B(e){var t=e._readableState;t.needReadable=!1,t.emittedReadable||(g("emitReadable",t.flowing),t.emittedReadable=!0,t.sync?i.nextTick(O,e):O(e))}function O(e){g("emit readable"),e.emit("readable"),U(e)}function P(e,t){t.readingMore||(t.readingMore=!0,i.nextTick(N,e,t))}function N(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=z(e,t.buffer,t.decoder),n);var n}function z(e,t,n){var r;return eo.length?o.length:e;if(s===o.length?i+=o:i+=o.slice(0,e),e-=s,0===e){s===o.length?(++r,n.next?t.head=n.next:t.head=t.tail=null):(t.head=n,n.data=o.slice(s));break}++r}return t.length-=r,i}function H(e,t){var n=c.allocUnsafe(e),r=t.head,i=1;for(r.data.copy(n),e-=r.data.length;r=r.next;){var o=r.data,s=e>o.length?o.length:e;if(o.copy(n,n.length-e,0,s),e-=s,0===e){s===o.length?(++i,r.next?t.head=r.next:t.head=t.tail=null):(t.head=r,r.data=o.slice(s));break}++i}return t.length-=i,n}function V(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($,t,e))}function $(e,t){e.endEmitted||0!==e.length||(e.endEmitted=!0,t.readable=!1,t.emit("end"))}function W(e,t){for(var n=0,r=e.length;n=t.highWaterMark||t.ended))return g("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?V(this):B(this),null;if(e=j(e,t),0===e&&t.ended)return 0===t.length&&V(this),null;var r=t.needReadable,i;return g("need readable",r),(0===t.length||t.length-e0?q(e,t):null,null===i?(t.needReadable=!0,e=0):t.length-=e,0===t.length&&(t.ended||(t.needReadable=!0),n!==e&&t.ended&&V(this)),null!==i&&this.emit("data",i),i},E.prototype._read=function(e){this.emit("error",new Error("_read() is not implemented"))},E.prototype.pipe=function(e,t){var n=this,o=this._readableState;switch(o.pipesCount){case 0:o.pipes=e;break;case 1:o.pipes=[o.pipes,e];break;default:o.pipes.push(e)}o.pipesCount+=1,g("pipe count=%d opts=%j",o.pipesCount,t);var s=(!t||!1!==t.end)&&e!==r.stdout&&e!==r.stderr,a=s?c:_;function u(e,t){g("onunpipe"),e===n&&t&&!1===t.hasUnpiped&&(t.hasUnpiped=!0,p())}function c(){g("onend"),e.end()}o.endEmitted?i.nextTick(a):n.once("end",a),e.on("unpipe",u);var h=D(n);e.on("drain",h);var f=!1;function p(){g("cleanup"),e.removeListener("close",v),e.removeListener("finish",b),e.removeListener("drain",h),e.removeListener("error",y),e.removeListener("unpipe",u),n.removeListener("end",c),n.removeListener("end",_),n.removeListener("data",m),f=!0,!o.awaitDrain||e._writableState&&!e._writableState.needDrain||h()}var d=!1;function m(t){g("ondata"),d=!1;var r=e.write(t);!1!==r||d||((1===o.pipesCount&&o.pipes===e||o.pipesCount>1&&-1!==W(o.pipes,e))&&!f&&(g("false write response, pause",n._readableState.awaitDrain),n._readableState.awaitDrain++,d=!0),n.pause())}function y(t){g("onerror",t),_(),e.removeListener("error",y),0===l(e,"error")&&e.emit("error",t)}function v(){e.removeListener("finish",b),_()}function b(){g("onfinish"),e.removeListener("close",v),_()}function _(){g("unpipe"),n.unpipe(e)}return n.on("data",m),w(e,"error",y),e.once("close",v),e.once("finish",b),e.emit("pipe",n),o.flowing||(g("pipe resume"),n.resume()),e},E.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?this:(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 o=0;o-1?setImmediate:i.nextTick,l;_.WritableState=b;var u=n(8);u.inherits=n(3);var c={deprecate:n(59)},h=n(528),f=n(5).Buffer,p=r.Uint8Array||function(){};function d(e){return f.from(e)}function m(e){return f.isBuffer(e)||e instanceof p}var g=n(529),y;function v(){}function b(e,t){l=l||n(104),e=e||{};var r=t instanceof l;this.objectMode=!!e.objectMode,r&&(this.objectMode=this.objectMode||!!e.writableObjectMode);var i=e.highWaterMark,o=e.writableHighWaterMark,a=this.objectMode?16:16384;this.highWaterMark=i||0===i?i:r&&(o||0===o)?o:a,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 u=!1===e.decodeStrings;this.decodeStrings=!u,this.defaultEncoding=e.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(e){T(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 s(this)}function _(e){if(l=l||n(104),!(y.call(_,this)||this instanceof l))return new _(e);this._writableState=new b(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 w(e,t){var n=new Error("write after end");e.emit("error",n),i.nextTick(t,n)}function k(e,t,n,r){var o=!0,s=!1;return null===n?s=new TypeError("May not write null values to stream"):"string"==typeof n||void 0===n||t.objectMode||(s=new TypeError("Invalid non-string/buffer chunk")),s&&(e.emit("error",s),i.nextTick(r,s),o=!1),o}function E(e,t,n){return e.objectMode||!1===e.decodeStrings||"string"!=typeof t||(t=f.from(t,n)),t}function S(e,t,n,r,i,o){if(!n){var s=E(t,r,i);r!==s&&(n=!0,i="buffer",r=s)}var a=t.objectMode?1:r.length;t.length+=a;var l=t.length-1))throw new TypeError("Unknown encoding: "+t);return this._writableState.defaultEncoding=t,this},Object.defineProperty(_.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),_.prototype._write=function(e,t,n){n(new Error("_write() is not implemented"))},_.prototype._writev=null,_.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&&void 0!==e&&this.write(e,t),r.corked&&(r.corked=1,this.uncork()),r.ending||r.finished||D(this,r,n)},Object.defineProperty(_.prototype,"destroyed",{get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(e){this._writableState&&(this._writableState.destroyed=e)}}),_.prototype.destroy=g.destroy,_.prototype._undestroy=g.undestroy,_.prototype._destroy=function(e,t){this.end(),t(e)}}).call(this,n(2),n(7))},function(e,t,n){(function(e){var r=n(532),i=n(105),o="0000000000000000000",s="7777777777777777777",a="0".charCodeAt(0),l="ustar\x0000",u=parseInt("7777",8),c=function(e,t,n){return"number"!=typeof e?n:(e=~~e,e>=t?t:e>=0?e:(e+=t,e>=0?e:0))},h=function(e){switch(e){case 0:return"file";case 1:return"link";case 2:return"symlink";case 3:return"character-device";case 4:return"block-device";case 5:return"directory";case 6:return"fifo";case 7:return"contiguous-file";case 72:return"pax-header";case 55:return"pax-global-header";case 27:return"gnu-long-link-path";case 28:case 30:return"gnu-long-path"}return null},f=function(e){switch(e){case"file":return 0;case"link":return 1;case"symlink":return 2;case"character-device":return 3;case"block-device":return 4;case"directory":return 5;case"fifo":return 6;case"contiguous-file":return 7;case"pax-header":return 72}return 0},p=function(e,t,n,r){for(;nt?s.slice(0,t)+" ":o.slice(0,t-e.length)+e+" "};function g(e){var t;if(128===e[0])t=!0;else{if(255!==e[0])return null;t=!1}for(var n=!1,r=[],i=e.length-1;i>0;i--){var o=e[i];t?r.push(o):n&&0===o?r.push(0):n?(n=!1,r.push(256-o)):r.push(255-o)}var s=0,a=r.length;for(i=0;i=Math.pow(10,r)&&r++,n+r+t};t.decodeLongPath=function(e,t){return v(e,0,e.length,t)},t.encodePax=function(e){var t="";e.name&&(t+=b(" path="+e.name+"\n")),e.linkname&&(t+=b(" linkpath="+e.linkname+"\n"));var n=e.pax;if(n)for(var i in n)t+=b(" "+i+"="+n[i]+"\n");return r(t)},t.decodePax=function(e){for(var t={};e.length;){for(var n=0;n100;){var s=r.indexOf("/");if(-1===s)return null;o+=o?"/"+r.slice(0,s):r.slice(0,s),r=r.slice(s+1)}return e.byteLength(r)>100||e.byteLength(o)>155?null:t.linkname&&e.byteLength(t.linkname)>100?null:(n.write(r),n.write(m(t.mode&u,6),100),n.write(m(t.uid,6),108),n.write(m(t.gid,6),116),n.write(m(t.size,11),124),n.write(m(t.mtime.getTime()/1e3|0,11),136),n[156]=a+f(t.type),t.linkname&&n.write(t.linkname,157),n.write(l,257),t.uname&&n.write(t.uname,265),t.gname&&n.write(t.gname,297),n.write(m(t.devmajor||0,6),329),n.write(m(t.devminor||0,6),337),o&&n.write(o,345),n.write(m(d(n),6),148),n)},t.decode=function(e,t){var n=0===e[156]?0:e[156]-a,r=v(e,0,100,t),i=y(e,100,8),o=y(e,108,8),s=y(e,116,8),l=y(e,124,12),u=y(e,136,12),c=h(n),f=0===e[157]?null:v(e,157,100,t),p=v(e,265,32),m=v(e,297,32),g=y(e,329,8),b=y(e,337,8);e[345]&&(r=v(e,345,155,t)+"/"+r),0===n&&r&&"/"===r[r.length-1]&&(n=5);var _=d(e);if(256===_)return null;if(_!==y(e,148,8))throw new Error("Invalid tar header. Maybe the tar is corrupted or it needs to be gunzipped?");return{name:r,mode:i,uid:o,gid:s,size:l,mtime:new Date(1e3*u),type:c,linkname:f,uname:p,gname:m,devmajor:g,devminor:b}}}).call(this,n(0).Buffer)},function(e,t,n){(function(t){e.exports=i;var n=t.from&&t.from!==Uint8Array.from?t.from:r;function r(e,n){return new t(e,n)}function i(e,r){if(t.isBuffer(e))return e;if("string"==typeof e)return n(e,r);if(Array.isArray(e))return n(e);throw new Error("Input should be a buffer or a string")}}).call(this,n(0).Buffer)},function(e,t,n){"use strict";e.exports=s;var r=n(104),i=n(8);function o(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.length({"api-path":"/api/v0/","user-agent":`/node-${r.name}/${r.version}/`,host:"localhost",port:"5001",protocol:"http"}))},function(e,t,n){"use strict";(function(r){const i=n(1296),o=n(299).encode,s=n(166),a=n(300),l=n(51),u=n(26),c=n(91),h=n(1301),f=n(509),p=n(4)("ipfs-http-client:request");function d(e,t){const n=new Error(`Server responded with ${e.statusCode}`);h(e,(e,r)=>{if(e)return t(e);r&&(n.code=r.Code,n.message=r.Message||r.toString(),n.type=r.Type),t(n)})}function m(e,t){return n=>{const r=Boolean(n.headers["x-stream-output"]),i=Boolean(n.headers["x-chunked-output"]),o=n.headers["content-type"]&&0===n.headers["content-type"].indexOf("application/json");if(n.req?p(n.req.method,`${n.req.getHeaders().host}${n.req.path}`,n.statusCode,n.statusMessage):p(n.url,n.statusCode,n.statusMessage),n.statusCode>=400||!n.statusCode)return d(n,t);if(r&&!e)return t(null,n);if(i&&o){const e=a.parse();return l(n,e),n.on("end",()=>{let t=n.trailers["x-stream-error"];if(t){try{t=JSON.parse(t)}catch(e){t={Message:t}}e.emit("error",new Error(t.Message))}}),t(null,e)}return o?h(n,t):c(n,t)}}function g(e,t,n){n=u(n),t.qs=t.qs||{},Array.isArray(t.path)&&(t.path=t.path.join("/")),t.args&&!Array.isArray(t.args)&&(t.args=[t.args]),t.args&&(t.qs.arg=t.args),t.progress&&(t.qs.progress=!0),t.qs.r&&(t.qs.recursive=t.qs.r,delete t.qs.r),t.qs["stream-channels"]=!0,t.stream&&(t.buffer=!1),delete t.qs.followSymlinks;const a="POST",l=Object.assign({},e.headers);if(s&&(l["User-Agent"]=e["user-agent"]),t.multipart){if(!t.multipartBoundary)return n(new Error("No multipartBoundary"));l["Content-Type"]=`multipart/form-data; boundary=${t.multipartBoundary}`}const c=i.stringify(t.qs,{arrayFormat:"repeat",encoder:e=>{if(r.isBuffer(e)){let t="";for(const n of e)if(n>=65&&n<=90||n>=97&&n<=122||n>=48&&n<=57||45===n||46===n||95===n||126===n)t+=String.fromCharCode(n);else{const e=n.toString(16),r=1===e.length?`0${e}`:e;t+=`%${r}`}return t}return o(e)}}),h={hostname:e.host,path:`${e["api-path"]}${t.path}?${c}`,port:e.port,method:"POST",headers:l,protocol:`${e.protocol}:`},p=f(e.protocol)(h,m(t.buffer,n));return p.on("error",e=>{n(e)}),t.stream||p.end(),p}t=e.exports=(e=>{const t=(t,n)=>"object"!=typeof t?n(new Error("no options were passed")):g(e,t,n);return t.andTransform=((e,n,r)=>t(e,(e,t)=>{if(e)return r(e);n(t,r)})),t})}).call(this,n(0).Buffer)},function(e,t,n){"use strict";var r=String.prototype.replace,i=/%20/g;e.exports={default:"RFC3986",formatters:{RFC1738:function(e){return r.call(e,i,"+")},RFC3986:function(e){return e}},RFC1738:"RFC1738",RFC3986:"RFC3986"}},function(e,t){function n(e,t,n,i){return JSON.stringify(e,r(t,i),n)}function r(e,t){var n=[],r=[];return null==t&&(t=function(e,t){return n[0]===t?"[Circular ~]":"[Circular ~."+r.slice(0,n.indexOf(t)).join(".")+"]"}),function(i,o){if(n.length>0){var s=n.indexOf(this);~s?n.splice(s+1):n.push(this),~s?r.splice(s,1/0,i):r.push(i),~n.indexOf(o)&&(o=t.call(this,i,o))}else n.push(o);return null==e?o:e.call(this,i,o)}}t=e.exports=n,t.getSerialize=r},function(e,t,n){"use strict";const r=n(22);e.exports=(e=>{const t=r(e);return{get:n(1304)(t),stat:n(1305)(t),put:n(1306)(t)}})},function(e,t,n){"use strict";e.exports=(e=>{const t=e.pop();let n={},r=[];return Array.isArray(e[e.length-1])||"object"!=typeof e[e.length-1]||(n=e.pop()),r=1===e.length&&Array.isArray(e[0])?e[0]:e,{callback:t,sources:r,opts:n}})},function(e,t,n){var r=n(217),i=n(1417),o=n(1418),s=n(1419),a=n(1420),l=n(1421);function u(e){var t=this.__data__=new r(e);this.size=t.size}u.prototype.clear=i,u.prototype.delete=o,u.prototype.get=s,u.prototype.has=a,u.prototype.set=l,e.exports=u},function(e,t,n){var r=n(1422),i=n(87);function o(e,t,n,s,a){return e===t||(null==e||null==t||!i(e)&&!i(t)?e!=e&&t!=t:r(e,t,n,s,o,a))}e.exports=o},function(e,t,n){var r=n(1423),i=n(1426),o=n(1427),s=1,a=2;function l(e,t,n,l,u,c){var h=n&s,f=e.length,p=t.length;if(f!=p&&!(h&&p>f))return!1;var d=c.get(e);if(d&&c.get(t))return d==t;var m=-1,g=!0,y=n&a?new r:void 0;for(c.set(e,t),c.set(t,e);++m({name:e.Name,type:e.Type,size:e.Size,hash:e.Hash});e.exports=(e=>(t,n)=>{n=n||{};const u=new r({objectMode:!0,transform(e,t,n){n(null,l(e))}}),c=new i({objectMode:!0});return e({path:"files/ls",args:t,qs:Object.assign({},n,{stream:!0})},(e,t)=>{if(e)return c.destroy(e);if(a(t)){const e=s.parse();o(t,e,u,c)}else{const e=t.Entries||[];e.forEach(e=>{c.write(l(e))}),c.end()}}),c})},function(e,t,n){(function(e,n){var r=200,i="__lodash_hash_undefined__",o=9007199254740991,s="[object Arguments]",a="[object Array]",l="[object Boolean]",u="[object Date]",c="[object Error]",h="[object Function]",f="[object GeneratorFunction]",p="[object Map]",d="[object Number]",m="[object Object]",g="[object Promise]",y="[object RegExp]",v="[object Set]",b="[object String]",_="[object Symbol]",w="[object WeakMap]",k="[object ArrayBuffer]",E="[object DataView]",S="[object Float32Array]",x="[object Float64Array]",C="[object Int8Array]",A="[object Int16Array]",T="[object Int32Array]",I="[object Uint8Array]",j="[object Uint8ClampedArray]",R="[object Uint16Array]",B="[object Uint32Array]",O=/[\\^$.*+?()[\]{}|]/g,P=/\w*$/,N=/^\[object .+?Constructor\]$/,D=/^(?:0|[1-9]\d*)$/,F={};F[s]=F[a]=F[k]=F[E]=F[l]=F[u]=F[S]=F[x]=F[C]=F[A]=F[T]=F[p]=F[d]=F[m]=F[y]=F[v]=F[b]=F[_]=F[I]=F[j]=F[R]=F[B]=!0,F[c]=F[h]=F[w]=!1;var M="object"==typeof e&&e&&e.Object===Object&&e,L="object"==typeof self&&self&&self.Object===Object&&self,U=M||L||Function("return this")(),q=t&&!t.nodeType&&t,z=q&&"object"==typeof n&&n&&!n.nodeType&&n,K=z&&z.exports===q;function H(e,t){return e.set(t[0],t[1]),e}function V(e,t){return e.add(t),e}function $(e,t){for(var n=-1,r=e?e.length:0;++n-1}function Ve(e,t){var n=this.__data__,r=st(n,e);return r<0?n.push([e,t]):n[r][1]=t,this}function $e(e){var t=-1,n=e?e.length:0;for(this.clear();++t-1&&e%1==0&&e-1&&e%1==0&&e<=o}function Wt(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function Gt(e){return!!e&&"object"==typeof e}function Yt(e){return zt(e)?it(e):pt(e)}function Zt(){return[]}function Jt(){return!1}n.exports=Mt}).call(this,n(7),n(85)(e))},function(e,t,n){"use strict";e.exports="ipfs-pubsub-room/v2"},function(e,t,n){"use strict";(function(t){e.exports=(e=>{let n=e;return t.isBuffer(n)||(n=t.from(n)),n})}).call(this,n(0).Buffer)},function(e,t,n){"use strict";e.exports=(e=>e._libp2pNode||e.libp2p)},function(e,t,n){(function(t){e.exports=function(e,n){var r=[];e.on("data",function(e){r.push(e)}),e.once("end",function(){n&&n(null,t.concat(r)),n=null}),e.once("error",function(e){n&&n(e),n=null})}}).call(this,n(0).Buffer)},function(e,t,n){(function(t){var r=n(3),i=n(1510).Transform,o=n(1515);function s(e,t){if(!(this instanceof s))return new s(e,t);i.call(this),t||(t={}),"object"==typeof e&&(t=e,e=t.size),this.size=e||512,t.nopad?this._zeroPadding=!1:this._zeroPadding=o(t.zeroPadding,!0),this._buffered=[],this._bufferedBytes=0}e.exports=s,r(s,i),s.prototype._transform=function(e,n,r){for(this._bufferedBytes+=e.length,this._buffered.push(e);this._bufferedBytes>=this.size;){var i=t.concat(this._buffered);this._bufferedBytes-=this.size,this.push(i.slice(0,this.size)),this._buffered=[i.slice(this.size,i.length)]}r()},s.prototype._flush=function(){if(this._bufferedBytes&&this._zeroPadding){var e=new t(this.size-this._bufferedBytes);e.fill(0),this._buffered.push(e),this.push(t.concat(this._buffered)),this._buffered=null}else this._bufferedBytes&&(this.push(t.concat(this._buffered)),this._buffered=null);this.push(null)}}).call(this,n(0).Buffer)},function(e,t,n){"use strict";(function(t,r){var i=n(11);e.exports=E;var o=n(56),s;E.ReadableState=k;var a=n(6).EventEmitter,l=function(e,t){return e.listeners(t).length},u=n(553),c=n(5).Buffer,h=t.Uint8Array||function(){};function f(e){return c.from(e)}function p(e){return c.isBuffer(e)||e instanceof h}var d=n(8);d.inherits=n(3);var m=n(1511),g=void 0;g=m&&m.debuglog?m.debuglog("stream"):function(){};var y=n(1512),v=n(554),b;d.inherits(E,u);var _=["error","close","destroy","pause","resume"];function w(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)}function k(e,t){s=s||n(135),e=e||{};var r=t instanceof s;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 y,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.destroyed=!1,this.defaultEncoding=e.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,e.encoding&&(b||(b=n(24).StringDecoder),this.decoder=new b(e.encoding),this.encoding=e.encoding)}function E(e){if(s=s||n(135),!(this instanceof E))return new E(e);this._readableState=new k(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 S(e,t,n,r,i){var o=e._readableState,s;null===t?(o.reading=!1,R(e,o)):(i||(s=C(o,t)),s?e.emit("error",s):o.objectMode||t&&t.length>0?("string"==typeof t||o.objectMode||Object.getPrototypeOf(t)===c.prototype||(t=f(t)),r?o.endEmitted?e.emit("error",new Error("stream.unshift() after end event")):x(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?x(e,o,t,!1):P(e,o)):x(e,o,t,!1))):r||(o.reading=!1));return A(o)}function x(e,t,n,r){t.flowing&&0===t.length&&!t.sync?(e.emit("data",n),e.read(0)):(t.length+=t.objectMode?1:n.length,r?t.buffer.unshift(n):t.buffer.push(n),t.needReadable&&B(e)),P(e,t)}function C(e,t){var n;return p(t)||"string"==typeof t||void 0===t||e.objectMode||(n=new TypeError("Invalid non-string/buffer chunk")),n}function A(e){return!e.ended&&(e.needReadable||e.length=T?e=T:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}function j(e,t){return e<=0||0===t.length&&t.ended?0:t.objectMode?1:e!=e?t.flowing&&t.length?t.buffer.head.data.length:t.length:(e>t.highWaterMark&&(t.highWaterMark=I(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}function R(e,t){if(!t.ended){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,B(e)}}function B(e){var t=e._readableState;t.needReadable=!1,t.emittedReadable||(g("emitReadable",t.flowing),t.emittedReadable=!0,t.sync?i.nextTick(O,e):O(e))}function O(e){g("emit readable"),e.emit("readable"),U(e)}function P(e,t){t.readingMore||(t.readingMore=!0,i.nextTick(N,e,t))}function N(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=z(e,t.buffer,t.decoder),n);var n}function z(e,t,n){var r;return eo.length?o.length:e;if(s===o.length?i+=o:i+=o.slice(0,e),e-=s,0===e){s===o.length?(++r,n.next?t.head=n.next:t.head=t.tail=null):(t.head=n,n.data=o.slice(s));break}++r}return t.length-=r,i}function H(e,t){var n=c.allocUnsafe(e),r=t.head,i=1;for(r.data.copy(n),e-=r.data.length;r=r.next;){var o=r.data,s=e>o.length?o.length:e;if(o.copy(n,n.length-e,0,s),e-=s,0===e){s===o.length?(++i,r.next?t.head=r.next:t.head=t.tail=null):(t.head=r,r.data=o.slice(s));break}++i}return t.length-=i,n}function V(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($,t,e))}function $(e,t){e.endEmitted||0!==e.length||(e.endEmitted=!0,t.readable=!1,t.emit("end"))}function W(e,t){for(var n=0,r=e.length;n=t.highWaterMark||t.ended))return g("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?V(this):B(this),null;if(e=j(e,t),0===e&&t.ended)return 0===t.length&&V(this),null;var r=t.needReadable,i;return g("need readable",r),(0===t.length||t.length-e0?q(e,t):null,null===i?(t.needReadable=!0,e=0):t.length-=e,0===t.length&&(t.ended||(t.needReadable=!0),n!==e&&t.ended&&V(this)),null!==i&&this.emit("data",i),i},E.prototype._read=function(e){this.emit("error",new Error("_read() is not implemented"))},E.prototype.pipe=function(e,t){var n=this,o=this._readableState;switch(o.pipesCount){case 0:o.pipes=e;break;case 1:o.pipes=[o.pipes,e];break;default:o.pipes.push(e)}o.pipesCount+=1,g("pipe count=%d opts=%j",o.pipesCount,t);var s=(!t||!1!==t.end)&&e!==r.stdout&&e!==r.stderr,a=s?c:_;function u(e,t){g("onunpipe"),e===n&&t&&!1===t.hasUnpiped&&(t.hasUnpiped=!0,p())}function c(){g("onend"),e.end()}o.endEmitted?i.nextTick(a):n.once("end",a),e.on("unpipe",u);var h=D(n);e.on("drain",h);var f=!1;function p(){g("cleanup"),e.removeListener("close",v),e.removeListener("finish",b),e.removeListener("drain",h),e.removeListener("error",y),e.removeListener("unpipe",u),n.removeListener("end",c),n.removeListener("end",_),n.removeListener("data",m),f=!0,!o.awaitDrain||e._writableState&&!e._writableState.needDrain||h()}var d=!1;function m(t){g("ondata"),d=!1;var r=e.write(t);!1!==r||d||((1===o.pipesCount&&o.pipes===e||o.pipesCount>1&&-1!==W(o.pipes,e))&&!f&&(g("false write response, pause",n._readableState.awaitDrain),n._readableState.awaitDrain++,d=!0),n.pause())}function y(t){g("onerror",t),_(),e.removeListener("error",y),0===l(e,"error")&&e.emit("error",t)}function v(){e.removeListener("finish",b),_()}function b(){g("onfinish"),e.removeListener("close",v),_()}function _(){g("unpipe"),n.unpipe(e)}return n.on("data",m),w(e,"error",y),e.once("close",v),e.once("finish",b),e.emit("pipe",n),o.flowing||(g("pipe resume"),n.resume()),e},E.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?this:(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 o=0;o-1?setImmediate:i.nextTick,l;_.WritableState=b;var u=n(8);u.inherits=n(3);var c={deprecate:n(59)},h=n(553),f=n(5).Buffer,p=r.Uint8Array||function(){};function d(e){return f.from(e)}function m(e){return f.isBuffer(e)||e instanceof p}var g=n(554),y;function v(){}function b(e,t){l=l||n(135),e=e||{};var r=t instanceof l;this.objectMode=!!e.objectMode,r&&(this.objectMode=this.objectMode||!!e.writableObjectMode);var i=e.highWaterMark,o=e.writableHighWaterMark,a=this.objectMode?16:16384;this.highWaterMark=i||0===i?i:r&&(o||0===o)?o:a,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 u=!1===e.decodeStrings;this.decodeStrings=!u,this.defaultEncoding=e.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(e){T(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 s(this)}function _(e){if(l=l||n(135),!(y.call(_,this)||this instanceof l))return new _(e);this._writableState=new b(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 w(e,t){var n=new Error("write after end");e.emit("error",n),i.nextTick(t,n)}function k(e,t,n,r){var o=!0,s=!1;return null===n?s=new TypeError("May not write null values to stream"):"string"==typeof n||void 0===n||t.objectMode||(s=new TypeError("Invalid non-string/buffer chunk")),s&&(e.emit("error",s),i.nextTick(r,s),o=!1),o}function E(e,t,n){return e.objectMode||!1===e.decodeStrings||"string"!=typeof t||(t=f.from(t,n)),t}function S(e,t,n,r,i,o){if(!n){var s=E(t,r,i);r!==s&&(n=!0,i="buffer",r=s)}var a=t.objectMode?1:r.length;t.length+=a;var l=t.length-1))throw new TypeError("Unknown encoding: "+t);return this._writableState.defaultEncoding=t,this},Object.defineProperty(_.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),_.prototype._write=function(e,t,n){n(new Error("_write() is not implemented"))},_.prototype._writev=null,_.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&&void 0!==e&&this.write(e,t),r.corked&&(r.corked=1,this.uncork()),r.ending||r.finished||D(this,r,n)},Object.defineProperty(_.prototype,"destroyed",{get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(e){this._writableState&&(this._writableState.destroyed=e)}}),_.prototype.destroy=g.destroy,_.prototype._undestroy=g.undestroy,_.prototype._destroy=function(e,t){this.end(),t(e)}}).call(this,n(2),n(7))},function(e,t,n){"use strict";e.exports=s;var r=n(135),i=n(8);function o(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.length0?("string"==typeof t||o.objectMode||Object.getPrototypeOf(t)===c.prototype||(t=f(t)),r?o.endEmitted?e.emit("error",new Error("stream.unshift() after end event")):x(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?x(e,o,t,!1):P(e,o)):x(e,o,t,!1))):r||(o.reading=!1));return A(o)}function x(e,t,n,r){t.flowing&&0===t.length&&!t.sync?(e.emit("data",n),e.read(0)):(t.length+=t.objectMode?1:n.length,r?t.buffer.unshift(n):t.buffer.push(n),t.needReadable&&B(e)),P(e,t)}function C(e,t){var n;return p(t)||"string"==typeof t||void 0===t||e.objectMode||(n=new TypeError("Invalid non-string/buffer chunk")),n}function A(e){return!e.ended&&(e.needReadable||e.length=T?e=T:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}function j(e,t){return e<=0||0===t.length&&t.ended?0:t.objectMode?1:e!=e?t.flowing&&t.length?t.buffer.head.data.length:t.length:(e>t.highWaterMark&&(t.highWaterMark=I(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}function R(e,t){if(!t.ended){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,B(e)}}function B(e){var t=e._readableState;t.needReadable=!1,t.emittedReadable||(g("emitReadable",t.flowing),t.emittedReadable=!0,t.sync?i.nextTick(O,e):O(e))}function O(e){g("emit readable"),e.emit("readable"),U(e)}function P(e,t){t.readingMore||(t.readingMore=!0,i.nextTick(N,e,t))}function N(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=z(e,t.buffer,t.decoder),n);var n}function z(e,t,n){var r;return eo.length?o.length:e;if(s===o.length?i+=o:i+=o.slice(0,e),e-=s,0===e){s===o.length?(++r,n.next?t.head=n.next:t.head=t.tail=null):(t.head=n,n.data=o.slice(s));break}++r}return t.length-=r,i}function H(e,t){var n=c.allocUnsafe(e),r=t.head,i=1;for(r.data.copy(n),e-=r.data.length;r=r.next;){var o=r.data,s=e>o.length?o.length:e;if(o.copy(n,n.length-e,0,s),e-=s,0===e){s===o.length?(++i,r.next?t.head=r.next:t.head=t.tail=null):(t.head=r,r.data=o.slice(s));break}++i}return t.length-=i,n}function V(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($,t,e))}function $(e,t){e.endEmitted||0!==e.length||(e.endEmitted=!0,t.readable=!1,t.emit("end"))}function W(e,t){for(var n=0,r=e.length;n=t.highWaterMark||t.ended))return g("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?V(this):B(this),null;if(e=j(e,t),0===e&&t.ended)return 0===t.length&&V(this),null;var r=t.needReadable,i;return g("need readable",r),(0===t.length||t.length-e0?q(e,t):null,null===i?(t.needReadable=!0,e=0):t.length-=e,0===t.length&&(t.ended||(t.needReadable=!0),n!==e&&t.ended&&V(this)),null!==i&&this.emit("data",i),i},E.prototype._read=function(e){this.emit("error",new Error("_read() is not implemented"))},E.prototype.pipe=function(e,t){var n=this,o=this._readableState;switch(o.pipesCount){case 0:o.pipes=e;break;case 1:o.pipes=[o.pipes,e];break;default:o.pipes.push(e)}o.pipesCount+=1,g("pipe count=%d opts=%j",o.pipesCount,t);var s=(!t||!1!==t.end)&&e!==r.stdout&&e!==r.stderr,a=s?c:_;function u(e,t){g("onunpipe"),e===n&&t&&!1===t.hasUnpiped&&(t.hasUnpiped=!0,p())}function c(){g("onend"),e.end()}o.endEmitted?i.nextTick(a):n.once("end",a),e.on("unpipe",u);var h=D(n);e.on("drain",h);var f=!1;function p(){g("cleanup"),e.removeListener("close",v),e.removeListener("finish",b),e.removeListener("drain",h),e.removeListener("error",y),e.removeListener("unpipe",u),n.removeListener("end",c),n.removeListener("end",_),n.removeListener("data",m),f=!0,!o.awaitDrain||e._writableState&&!e._writableState.needDrain||h()}var d=!1;function m(t){g("ondata"),d=!1;var r=e.write(t);!1!==r||d||((1===o.pipesCount&&o.pipes===e||o.pipesCount>1&&-1!==W(o.pipes,e))&&!f&&(g("false write response, pause",n._readableState.awaitDrain),n._readableState.awaitDrain++,d=!0),n.pause())}function y(t){g("onerror",t),_(),e.removeListener("error",y),0===l(e,"error")&&e.emit("error",t)}function v(){e.removeListener("finish",b),_()}function b(){g("onfinish"),e.removeListener("close",v),_()}function _(){g("unpipe"),n.unpipe(e)}return n.on("data",m),w(e,"error",y),e.once("close",v),e.once("finish",b),e.emit("pipe",n),o.flowing||(g("pipe resume"),n.resume()),e},E.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?this:(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 o=0;o-1?setImmediate:i.nextTick,l;_.WritableState=b;var u=n(8);u.inherits=n(3);var c={deprecate:n(59)},h=n(558),f=n(5).Buffer,p=r.Uint8Array||function(){};function d(e){return f.from(e)}function m(e){return f.isBuffer(e)||e instanceof p}var g=n(559),y;function v(){}function b(e,t){l=l||n(136),e=e||{};var r=t instanceof l;this.objectMode=!!e.objectMode,r&&(this.objectMode=this.objectMode||!!e.writableObjectMode);var i=e.highWaterMark,o=e.writableHighWaterMark,a=this.objectMode?16:16384;this.highWaterMark=i||0===i?i:r&&(o||0===o)?o:a,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 u=!1===e.decodeStrings;this.decodeStrings=!u,this.defaultEncoding=e.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(e){T(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 s(this)}function _(e){if(l=l||n(136),!(y.call(_,this)||this instanceof l))return new _(e);this._writableState=new b(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 w(e,t){var n=new Error("write after end");e.emit("error",n),i.nextTick(t,n)}function k(e,t,n,r){var o=!0,s=!1;return null===n?s=new TypeError("May not write null values to stream"):"string"==typeof n||void 0===n||t.objectMode||(s=new TypeError("Invalid non-string/buffer chunk")),s&&(e.emit("error",s),i.nextTick(r,s),o=!1),o}function E(e,t,n){return e.objectMode||!1===e.decodeStrings||"string"!=typeof t||(t=f.from(t,n)),t}function S(e,t,n,r,i,o){if(!n){var s=E(t,r,i);r!==s&&(n=!0,i="buffer",r=s)}var a=t.objectMode?1:r.length;t.length+=a;var l=t.length-1))throw new TypeError("Unknown encoding: "+t);return this._writableState.defaultEncoding=t,this},Object.defineProperty(_.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),_.prototype._write=function(e,t,n){n(new Error("_write() is not implemented"))},_.prototype._writev=null,_.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&&void 0!==e&&this.write(e,t),r.corked&&(r.corked=1,this.uncork()),r.ending||r.finished||D(this,r,n)},Object.defineProperty(_.prototype,"destroyed",{get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(e){this._writableState&&(this._writableState.destroyed=e)}}),_.prototype.destroy=g.destroy,_.prototype._undestroy=g.undestroy,_.prototype._destroy=function(e,t){this.end(),t(e)}}).call(this,n(2),n(7))},function(e,t,n){"use strict";e.exports=s;var r=n(136),i=n(8);function o(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.length{t(null,n)}):g(e)?o(e,(e,n)=>{if(e)return t(new Error(`Error converting Blob: ${e.message}`));i(n)}):"function"==typeof a&&/^https?:/.test(e)?a.concat({url:e,timeout:3e4,headers:{"user-agent":"WebTorrent (https://webtorrent.io)"}},(e,n,r)=>{if(e)return t(new Error(`Error downloading torrent: ${e.message}`));i(r)}):"function"==typeof s.readFile&&"string"==typeof e?s.readFile(e,(e,n)=>{if(e)return t(new Error("Invalid torrent identifier"));i(n)}):r.nextTick(()=>{t(new Error("Invalid torrent identifier"))})}function d(e){t.isBuffer(e)&&(e=i.decode(e)),b(e.info,"info"),b(e.info["name.utf-8"]||e.info.name,"info.name"),b(e.info["piece length"],"info['piece length']"),b(e.info.pieces,"info.pieces"),e.info.files?e.info.files.forEach(e=>{b("number"==typeof e.length,"info.files[0].length"),b(e["path.utf-8"]||e.path,"info.files[0].path")}):b("number"==typeof e.info.length,"info.length");const n={info:e.info,infoBuffer:i.encode(e.info),name:(e.info["name.utf-8"]||e.info.name).toString(),announce:[]};n.infoHash=c.sync(n.infoBuffer),n.infoHashBuffer=t.from(n.infoHash,"hex"),void 0!==e.info.private&&(n.private=!!e.info.private),e["creation date"]&&(n.created=new Date(1e3*e["creation date"])),e["created by"]&&(n.createdBy=e["created by"].toString()),t.isBuffer(e.comment)&&(n.comment=e.comment.toString()),Array.isArray(e["announce-list"])&&e["announce-list"].length>0?e["announce-list"].forEach(e=>{e.forEach(e=>{n.announce.push(e.toString())})}):e.announce&&n.announce.push(e.announce.toString()),t.isBuffer(e["url-list"])&&(e["url-list"]=e["url-list"].length>0?[e["url-list"]]:[]),n.urlList=(e["url-list"]||[]).map(e=>e.toString()),h(n.announce),h(n.urlList);const r=e.info.files||[e.info];n.files=r.map((e,t)=>{const i=[].concat(n.name,e["path.utf-8"]||e.path||[]).map(e=>e.toString());return{path:u.join.apply(null,[u.sep].concat(i)).slice(1),name:i[i.length-1],length:e.length,offset:r.slice(0,t).reduce(y,0)}}),n.length=r.reduce(y,0);const o=n.files[n.files.length-1];return n.pieceLength=e.info["piece length"],n.lastPieceLength=(o.offset+o.length)%n.pieceLength||n.pieceLength,n.pieces=v(e.info.pieces),n}function m(e){const n={info:e.info};return n["announce-list"]=(e.announce||[]).map(e=>(n.announce||(n.announce=e),e=t.from(e,"utf8"),[e])),n["url-list"]=e.urlList||[],void 0!==e.private&&(n.private=Number(e.private)),e.created&&(n["creation date"]=e.created.getTime()/1e3|0),e.createdBy&&(n["created by"]=e.createdBy),e.comment&&(n.comment=e.comment),i.encode(n)}function g(e){return"undefined"!=typeof Blob&&e instanceof Blob}function y(e,t){return e+t.length}function v(e){const t=[];for(let n=0;n0?("string"==typeof t||o.objectMode||Object.getPrototypeOf(t)===c.prototype||(t=f(t)),r?o.endEmitted?e.emit("error",new Error("stream.unshift() after end event")):x(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?x(e,o,t,!1):P(e,o)):x(e,o,t,!1))):r||(o.reading=!1));return A(o)}function x(e,t,n,r){t.flowing&&0===t.length&&!t.sync?(e.emit("data",n),e.read(0)):(t.length+=t.objectMode?1:n.length,r?t.buffer.unshift(n):t.buffer.push(n),t.needReadable&&B(e)),P(e,t)}function C(e,t){var n;return p(t)||"string"==typeof t||void 0===t||e.objectMode||(n=new TypeError("Invalid non-string/buffer chunk")),n}function A(e){return!e.ended&&(e.needReadable||e.length=T?e=T:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}function j(e,t){return e<=0||0===t.length&&t.ended?0:t.objectMode?1:e!=e?t.flowing&&t.length?t.buffer.head.data.length:t.length:(e>t.highWaterMark&&(t.highWaterMark=I(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}function R(e,t){if(!t.ended){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,B(e)}}function B(e){var t=e._readableState;t.needReadable=!1,t.emittedReadable||(g("emitReadable",t.flowing),t.emittedReadable=!0,t.sync?i.nextTick(O,e):O(e))}function O(e){g("emit readable"),e.emit("readable"),U(e)}function P(e,t){t.readingMore||(t.readingMore=!0,i.nextTick(N,e,t))}function N(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=z(e,t.buffer,t.decoder),n);var n}function z(e,t,n){var r;return eo.length?o.length:e;if(s===o.length?i+=o:i+=o.slice(0,e),e-=s,0===e){s===o.length?(++r,n.next?t.head=n.next:t.head=t.tail=null):(t.head=n,n.data=o.slice(s));break}++r}return t.length-=r,i}function H(e,t){var n=c.allocUnsafe(e),r=t.head,i=1;for(r.data.copy(n),e-=r.data.length;r=r.next;){var o=r.data,s=e>o.length?o.length:e;if(o.copy(n,n.length-e,0,s),e-=s,0===e){s===o.length?(++i,r.next?t.head=r.next:t.head=t.tail=null):(t.head=r,r.data=o.slice(s));break}++i}return t.length-=i,n}function V(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($,t,e))}function $(e,t){e.endEmitted||0!==e.length||(e.endEmitted=!0,t.readable=!1,t.emit("end"))}function W(e,t){for(var n=0,r=e.length;n=t.highWaterMark||t.ended))return g("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?V(this):B(this),null;if(e=j(e,t),0===e&&t.ended)return 0===t.length&&V(this),null;var r=t.needReadable,i;return g("need readable",r),(0===t.length||t.length-e0?q(e,t):null,null===i?(t.needReadable=!0,e=0):t.length-=e,0===t.length&&(t.ended||(t.needReadable=!0),n!==e&&t.ended&&V(this)),null!==i&&this.emit("data",i),i},E.prototype._read=function(e){this.emit("error",new Error("_read() is not implemented"))},E.prototype.pipe=function(e,t){var n=this,o=this._readableState;switch(o.pipesCount){case 0:o.pipes=e;break;case 1:o.pipes=[o.pipes,e];break;default:o.pipes.push(e)}o.pipesCount+=1,g("pipe count=%d opts=%j",o.pipesCount,t);var s=(!t||!1!==t.end)&&e!==r.stdout&&e!==r.stderr,a=s?c:_;function u(e,t){g("onunpipe"),e===n&&t&&!1===t.hasUnpiped&&(t.hasUnpiped=!0,p())}function c(){g("onend"),e.end()}o.endEmitted?i.nextTick(a):n.once("end",a),e.on("unpipe",u);var h=D(n);e.on("drain",h);var f=!1;function p(){g("cleanup"),e.removeListener("close",v),e.removeListener("finish",b),e.removeListener("drain",h),e.removeListener("error",y),e.removeListener("unpipe",u),n.removeListener("end",c),n.removeListener("end",_),n.removeListener("data",m),f=!0,!o.awaitDrain||e._writableState&&!e._writableState.needDrain||h()}var d=!1;function m(t){g("ondata"),d=!1;var r=e.write(t);!1!==r||d||((1===o.pipesCount&&o.pipes===e||o.pipesCount>1&&-1!==W(o.pipes,e))&&!f&&(g("false write response, pause",n._readableState.awaitDrain),n._readableState.awaitDrain++,d=!0),n.pause())}function y(t){g("onerror",t),_(),e.removeListener("error",y),0===l(e,"error")&&e.emit("error",t)}function v(){e.removeListener("finish",b),_()}function b(){g("onfinish"),e.removeListener("close",v),_()}function _(){g("unpipe"),n.unpipe(e)}return n.on("data",m),w(e,"error",y),e.once("close",v),e.once("finish",b),e.emit("pipe",n),o.flowing||(g("pipe resume"),n.resume()),e},E.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?this:(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 o=0;o-1?setImmediate:i.nextTick,l;_.WritableState=b;var u=n(8);u.inherits=n(3);var c={deprecate:n(59)},h=n(565),f=n(5).Buffer,p=r.Uint8Array||function(){};function d(e){return f.from(e)}function m(e){return f.isBuffer(e)||e instanceof p}var g=n(566),y;function v(){}function b(e,t){l=l||n(137),e=e||{};var r=t instanceof l;this.objectMode=!!e.objectMode,r&&(this.objectMode=this.objectMode||!!e.writableObjectMode);var i=e.highWaterMark,o=e.writableHighWaterMark,a=this.objectMode?16:16384;this.highWaterMark=i||0===i?i:r&&(o||0===o)?o:a,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 u=!1===e.decodeStrings;this.decodeStrings=!u,this.defaultEncoding=e.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(e){T(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 s(this)}function _(e){if(l=l||n(137),!(y.call(_,this)||this instanceof l))return new _(e);this._writableState=new b(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 w(e,t){var n=new Error("write after end");e.emit("error",n),i.nextTick(t,n)}function k(e,t,n,r){var o=!0,s=!1;return null===n?s=new TypeError("May not write null values to stream"):"string"==typeof n||void 0===n||t.objectMode||(s=new TypeError("Invalid non-string/buffer chunk")),s&&(e.emit("error",s),i.nextTick(r,s),o=!1),o}function E(e,t,n){return e.objectMode||!1===e.decodeStrings||"string"!=typeof t||(t=f.from(t,n)),t}function S(e,t,n,r,i,o){if(!n){var s=E(t,r,i);r!==s&&(n=!0,i="buffer",r=s)}var a=t.objectMode?1:r.length;t.length+=a;var l=t.length-1))throw new TypeError("Unknown encoding: "+t);return this._writableState.defaultEncoding=t,this},Object.defineProperty(_.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),_.prototype._write=function(e,t,n){n(new Error("_write() is not implemented"))},_.prototype._writev=null,_.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&&void 0!==e&&this.write(e,t),r.corked&&(r.corked=1,this.uncork()),r.ending||r.finished||D(this,r,n)},Object.defineProperty(_.prototype,"destroyed",{get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(e){this._writableState&&(this._writableState.destroyed=e)}}),_.prototype.destroy=g.destroy,_.prototype._undestroy=g.undestroy,_.prototype._destroy=function(e,t){this.end(),t(e)}}).call(this,n(2),n(7))},function(e,t,n){"use strict";e.exports=s;var r=n(137),i=n(8);function o(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.length0?("string"==typeof t||o.objectMode||Object.getPrototypeOf(t)===c.prototype||(t=f(t)),r?o.endEmitted?e.emit("error",new Error("stream.unshift() after end event")):x(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?x(e,o,t,!1):P(e,o)):x(e,o,t,!1))):r||(o.reading=!1));return A(o)}function x(e,t,n,r){t.flowing&&0===t.length&&!t.sync?(e.emit("data",n),e.read(0)):(t.length+=t.objectMode?1:n.length,r?t.buffer.unshift(n):t.buffer.push(n),t.needReadable&&B(e)),P(e,t)}function C(e,t){var n;return p(t)||"string"==typeof t||void 0===t||e.objectMode||(n=new TypeError("Invalid non-string/buffer chunk")),n}function A(e){return!e.ended&&(e.needReadable||e.length=T?e=T:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}function j(e,t){return e<=0||0===t.length&&t.ended?0:t.objectMode?1:e!=e?t.flowing&&t.length?t.buffer.head.data.length:t.length:(e>t.highWaterMark&&(t.highWaterMark=I(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}function R(e,t){if(!t.ended){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,B(e)}}function B(e){var t=e._readableState;t.needReadable=!1,t.emittedReadable||(g("emitReadable",t.flowing),t.emittedReadable=!0,t.sync?i.nextTick(O,e):O(e))}function O(e){g("emit readable"),e.emit("readable"),U(e)}function P(e,t){t.readingMore||(t.readingMore=!0,i.nextTick(N,e,t))}function N(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=z(e,t.buffer,t.decoder),n);var n}function z(e,t,n){var r;return eo.length?o.length:e;if(s===o.length?i+=o:i+=o.slice(0,e),e-=s,0===e){s===o.length?(++r,n.next?t.head=n.next:t.head=t.tail=null):(t.head=n,n.data=o.slice(s));break}++r}return t.length-=r,i}function H(e,t){var n=c.allocUnsafe(e),r=t.head,i=1;for(r.data.copy(n),e-=r.data.length;r=r.next;){var o=r.data,s=e>o.length?o.length:e;if(o.copy(n,n.length-e,0,s),e-=s,0===e){s===o.length?(++i,r.next?t.head=r.next:t.head=t.tail=null):(t.head=r,r.data=o.slice(s));break}++i}return t.length-=i,n}function V(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($,t,e))}function $(e,t){e.endEmitted||0!==e.length||(e.endEmitted=!0,t.readable=!1,t.emit("end"))}function W(e,t){for(var n=0,r=e.length;n=t.highWaterMark||t.ended))return g("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?V(this):B(this),null;if(e=j(e,t),0===e&&t.ended)return 0===t.length&&V(this),null;var r=t.needReadable,i;return g("need readable",r),(0===t.length||t.length-e0?q(e,t):null,null===i?(t.needReadable=!0,e=0):t.length-=e,0===t.length&&(t.ended||(t.needReadable=!0),n!==e&&t.ended&&V(this)),null!==i&&this.emit("data",i),i},E.prototype._read=function(e){this.emit("error",new Error("_read() is not implemented"))},E.prototype.pipe=function(e,t){var n=this,o=this._readableState;switch(o.pipesCount){case 0:o.pipes=e;break;case 1:o.pipes=[o.pipes,e];break;default:o.pipes.push(e)}o.pipesCount+=1,g("pipe count=%d opts=%j",o.pipesCount,t);var s=(!t||!1!==t.end)&&e!==r.stdout&&e!==r.stderr,a=s?c:_;function u(e,t){g("onunpipe"),e===n&&t&&!1===t.hasUnpiped&&(t.hasUnpiped=!0,p())}function c(){g("onend"),e.end()}o.endEmitted?i.nextTick(a):n.once("end",a),e.on("unpipe",u);var h=D(n);e.on("drain",h);var f=!1;function p(){g("cleanup"),e.removeListener("close",v),e.removeListener("finish",b),e.removeListener("drain",h),e.removeListener("error",y),e.removeListener("unpipe",u),n.removeListener("end",c),n.removeListener("end",_),n.removeListener("data",m),f=!0,!o.awaitDrain||e._writableState&&!e._writableState.needDrain||h()}var d=!1;function m(t){g("ondata"),d=!1;var r=e.write(t);!1!==r||d||((1===o.pipesCount&&o.pipes===e||o.pipesCount>1&&-1!==W(o.pipes,e))&&!f&&(g("false write response, pause",n._readableState.awaitDrain),n._readableState.awaitDrain++,d=!0),n.pause())}function y(t){g("onerror",t),_(),e.removeListener("error",y),0===l(e,"error")&&e.emit("error",t)}function v(){e.removeListener("finish",b),_()}function b(){g("onfinish"),e.removeListener("close",v),_()}function _(){g("unpipe"),n.unpipe(e)}return n.on("data",m),w(e,"error",y),e.once("close",v),e.once("finish",b),e.emit("pipe",n),o.flowing||(g("pipe resume"),n.resume()),e},E.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?this:(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 o=0;o-1?setImmediate:i.nextTick,l;_.WritableState=b;var u=n(8);u.inherits=n(3);var c={deprecate:n(59)},h=n(571),f=n(5).Buffer,p=r.Uint8Array||function(){};function d(e){return f.from(e)}function m(e){return f.isBuffer(e)||e instanceof p}var g=n(572),y;function v(){}function b(e,t){l=l||n(138),e=e||{};var r=t instanceof l;this.objectMode=!!e.objectMode,r&&(this.objectMode=this.objectMode||!!e.writableObjectMode);var i=e.highWaterMark,o=e.writableHighWaterMark,a=this.objectMode?16:16384;this.highWaterMark=i||0===i?i:r&&(o||0===o)?o:a,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 u=!1===e.decodeStrings;this.decodeStrings=!u,this.defaultEncoding=e.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(e){T(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 s(this)}function _(e){if(l=l||n(138),!(y.call(_,this)||this instanceof l))return new _(e);this._writableState=new b(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 w(e,t){var n=new Error("write after end");e.emit("error",n),i.nextTick(t,n)}function k(e,t,n,r){var o=!0,s=!1;return null===n?s=new TypeError("May not write null values to stream"):"string"==typeof n||void 0===n||t.objectMode||(s=new TypeError("Invalid non-string/buffer chunk")),s&&(e.emit("error",s),i.nextTick(r,s),o=!1),o}function E(e,t,n){return e.objectMode||!1===e.decodeStrings||"string"!=typeof t||(t=f.from(t,n)),t}function S(e,t,n,r,i,o){if(!n){var s=E(t,r,i);r!==s&&(n=!0,i="buffer",r=s)}var a=t.objectMode?1:r.length;t.length+=a;var l=t.length-1))throw new TypeError("Unknown encoding: "+t);return this._writableState.defaultEncoding=t,this},Object.defineProperty(_.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),_.prototype._write=function(e,t,n){n(new Error("_write() is not implemented"))},_.prototype._writev=null,_.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&&void 0!==e&&this.write(e,t),r.corked&&(r.corked=1,this.uncork()),r.ending||r.finished||D(this,r,n)},Object.defineProperty(_.prototype,"destroyed",{get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(e){this._writableState&&(this._writableState.destroyed=e)}}),_.prototype.destroy=g.destroy,_.prototype._undestroy=g.undestroy,_.prototype._destroy=function(e,t){this.end(),t(e)}}).call(this,n(2),n(7))},function(e,t,n){"use strict";e.exports=s;var r=n(138),i=n(8);function o(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.lengththis._bufferDuration)&&this._cb){var t=this._cb;this._cb=null,t()}};var c=0;function h(e,t){var n=document.createElement("a");n.href=window.URL.createObjectURL(new window.Blob(e)),n.download=t,n.click()}u.prototype._getBufferDuration=function(){for(var e=this,t=this._sourceBuffer.buffered,n=this._elem.currentTime,r=-1,i=0;in)break;(r>=0||n<=s)&&(r=s)}var a=r-n;return a<0&&(a=0),a}},function(e,t,n){var r=n(577);e.exports=function e(t,n,i){if("function"==typeof n)return e(t,null,n);r(t,n,function(e,t){if(e)return i(e);var n=URL.createObjectURL(t);i(null,n)})}},function(e,t,n){var r=n(26);e.exports=function e(t,n,i){if("function"==typeof n)return e(t,null,n);i=r(i);var o=[];t.on("data",function(e){o.push(e)}).on("end",function(){var e=n?new Blob(o,{type:n}):new Blob(o);i(null,e)}).on("error",i)}},function(e,t,n){t=e.exports=n(579),t.Stream=t,t.Readable=t,t.Writable=n(582),t.Duplex=n(139),t.Transform=n(583),t.PassThrough=n(1589)},function(e,t,n){"use strict";(function(t,r){var i=n(11);e.exports=E;var o=n(56),s;E.ReadableState=k;var a=n(6).EventEmitter,l=function(e,t){return e.listeners(t).length},u=n(580),c=n(5).Buffer,h=t.Uint8Array||function(){};function f(e){return c.from(e)}function p(e){return c.isBuffer(e)||e instanceof h}var d=n(8);d.inherits=n(3);var m=n(1586),g=void 0;g=m&&m.debuglog?m.debuglog("stream"):function(){};var y=n(1587),v=n(581),b;d.inherits(E,u);var _=["error","close","destroy","pause","resume"];function w(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)}function k(e,t){s=s||n(139),e=e||{};var r=t instanceof s;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 y,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.destroyed=!1,this.defaultEncoding=e.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,e.encoding&&(b||(b=n(24).StringDecoder),this.decoder=new b(e.encoding),this.encoding=e.encoding)}function E(e){if(s=s||n(139),!(this instanceof E))return new E(e);this._readableState=new k(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 S(e,t,n,r,i){var o=e._readableState,s;null===t?(o.reading=!1,R(e,o)):(i||(s=C(o,t)),s?e.emit("error",s):o.objectMode||t&&t.length>0?("string"==typeof t||o.objectMode||Object.getPrototypeOf(t)===c.prototype||(t=f(t)),r?o.endEmitted?e.emit("error",new Error("stream.unshift() after end event")):x(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?x(e,o,t,!1):P(e,o)):x(e,o,t,!1))):r||(o.reading=!1));return A(o)}function x(e,t,n,r){t.flowing&&0===t.length&&!t.sync?(e.emit("data",n),e.read(0)):(t.length+=t.objectMode?1:n.length,r?t.buffer.unshift(n):t.buffer.push(n),t.needReadable&&B(e)),P(e,t)}function C(e,t){var n;return p(t)||"string"==typeof t||void 0===t||e.objectMode||(n=new TypeError("Invalid non-string/buffer chunk")),n}function A(e){return!e.ended&&(e.needReadable||e.length=T?e=T:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}function j(e,t){return e<=0||0===t.length&&t.ended?0:t.objectMode?1:e!=e?t.flowing&&t.length?t.buffer.head.data.length:t.length:(e>t.highWaterMark&&(t.highWaterMark=I(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}function R(e,t){if(!t.ended){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,B(e)}}function B(e){var t=e._readableState;t.needReadable=!1,t.emittedReadable||(g("emitReadable",t.flowing),t.emittedReadable=!0,t.sync?i.nextTick(O,e):O(e))}function O(e){g("emit readable"),e.emit("readable"),U(e)}function P(e,t){t.readingMore||(t.readingMore=!0,i.nextTick(N,e,t))}function N(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=z(e,t.buffer,t.decoder),n);var n}function z(e,t,n){var r;return eo.length?o.length:e;if(s===o.length?i+=o:i+=o.slice(0,e),e-=s,0===e){s===o.length?(++r,n.next?t.head=n.next:t.head=t.tail=null):(t.head=n,n.data=o.slice(s));break}++r}return t.length-=r,i}function H(e,t){var n=c.allocUnsafe(e),r=t.head,i=1;for(r.data.copy(n),e-=r.data.length;r=r.next;){var o=r.data,s=e>o.length?o.length:e;if(o.copy(n,n.length-e,0,s),e-=s,0===e){s===o.length?(++i,r.next?t.head=r.next:t.head=t.tail=null):(t.head=r,r.data=o.slice(s));break}++i}return t.length-=i,n}function V(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($,t,e))}function $(e,t){e.endEmitted||0!==e.length||(e.endEmitted=!0,t.readable=!1,t.emit("end"))}function W(e,t){for(var n=0,r=e.length;n=t.highWaterMark||t.ended))return g("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?V(this):B(this),null;if(e=j(e,t),0===e&&t.ended)return 0===t.length&&V(this),null;var r=t.needReadable,i;return g("need readable",r),(0===t.length||t.length-e0?q(e,t):null,null===i?(t.needReadable=!0,e=0):t.length-=e,0===t.length&&(t.ended||(t.needReadable=!0),n!==e&&t.ended&&V(this)),null!==i&&this.emit("data",i),i},E.prototype._read=function(e){this.emit("error",new Error("_read() is not implemented"))},E.prototype.pipe=function(e,t){var n=this,o=this._readableState;switch(o.pipesCount){case 0:o.pipes=e;break;case 1:o.pipes=[o.pipes,e];break;default:o.pipes.push(e)}o.pipesCount+=1,g("pipe count=%d opts=%j",o.pipesCount,t);var s=(!t||!1!==t.end)&&e!==r.stdout&&e!==r.stderr,a=s?c:_;function u(e,t){g("onunpipe"),e===n&&t&&!1===t.hasUnpiped&&(t.hasUnpiped=!0,p())}function c(){g("onend"),e.end()}o.endEmitted?i.nextTick(a):n.once("end",a),e.on("unpipe",u);var h=D(n);e.on("drain",h);var f=!1;function p(){g("cleanup"),e.removeListener("close",v),e.removeListener("finish",b),e.removeListener("drain",h),e.removeListener("error",y),e.removeListener("unpipe",u),n.removeListener("end",c),n.removeListener("end",_),n.removeListener("data",m),f=!0,!o.awaitDrain||e._writableState&&!e._writableState.needDrain||h()}var d=!1;function m(t){g("ondata"),d=!1;var r=e.write(t);!1!==r||d||((1===o.pipesCount&&o.pipes===e||o.pipesCount>1&&-1!==W(o.pipes,e))&&!f&&(g("false write response, pause",n._readableState.awaitDrain),n._readableState.awaitDrain++,d=!0),n.pause())}function y(t){g("onerror",t),_(),e.removeListener("error",y),0===l(e,"error")&&e.emit("error",t)}function v(){e.removeListener("finish",b),_()}function b(){g("onfinish"),e.removeListener("close",v),_()}function _(){g("unpipe"),n.unpipe(e)}return n.on("data",m),w(e,"error",y),e.once("close",v),e.once("finish",b),e.emit("pipe",n),o.flowing||(g("pipe resume"),n.resume()),e},E.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?this:(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 o=0;o-1?setImmediate:i.nextTick,l;_.WritableState=b;var u=n(8);u.inherits=n(3);var c={deprecate:n(59)},h=n(580),f=n(5).Buffer,p=r.Uint8Array||function(){};function d(e){return f.from(e)}function m(e){return f.isBuffer(e)||e instanceof p}var g=n(581),y;function v(){}function b(e,t){l=l||n(139),e=e||{};var r=t instanceof l;this.objectMode=!!e.objectMode,r&&(this.objectMode=this.objectMode||!!e.writableObjectMode);var i=e.highWaterMark,o=e.writableHighWaterMark,a=this.objectMode?16:16384;this.highWaterMark=i||0===i?i:r&&(o||0===o)?o:a,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 u=!1===e.decodeStrings;this.decodeStrings=!u,this.defaultEncoding=e.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(e){T(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 s(this)}function _(e){if(l=l||n(139),!(y.call(_,this)||this instanceof l))return new _(e);this._writableState=new b(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 w(e,t){var n=new Error("write after end");e.emit("error",n),i.nextTick(t,n)}function k(e,t,n,r){var o=!0,s=!1;return null===n?s=new TypeError("May not write null values to stream"):"string"==typeof n||void 0===n||t.objectMode||(s=new TypeError("Invalid non-string/buffer chunk")),s&&(e.emit("error",s),i.nextTick(r,s),o=!1),o}function E(e,t,n){return e.objectMode||!1===e.decodeStrings||"string"!=typeof t||(t=f.from(t,n)),t}function S(e,t,n,r,i,o){if(!n){var s=E(t,r,i);r!==s&&(n=!0,i="buffer",r=s)}var a=t.objectMode?1:r.length;t.length+=a;var l=t.length-1))throw new TypeError("Unknown encoding: "+t);return this._writableState.defaultEncoding=t,this},Object.defineProperty(_.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),_.prototype._write=function(e,t,n){n(new Error("_write() is not implemented"))},_.prototype._writev=null,_.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&&void 0!==e&&this.write(e,t),r.corked&&(r.corked=1,this.uncork()),r.ending||r.finished||D(this,r,n)},Object.defineProperty(_.prototype,"destroyed",{get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(e){this._writableState&&(this._writableState.destroyed=e)}}),_.prototype.destroy=g.destroy,_.prototype._undestroy=g.undestroy,_.prototype._destroy=function(e,t){this.end(),t(e)}}).call(this,n(2),n(7))},function(e,t,n){"use strict";e.exports=s;var r=n(139),i=n(8);function o(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.length=e.length||t<0)){var n=e.pop();if(t{this.keepAlive()},f))}setTimeout(e,t){this._debug("setTimeout ms=%d unref=%s",e,t),this._clearTimeout(),this._timeoutMs=e,this._timeoutUnref=!!t,this._updateTimeout()}destroy(){this.destroyed||(this.destroyed=!0,this._debug("destroy"),this.emit("close"),this.end())}end(...e){this._debug("end"),this._onUninterested(),this._onChoke(),super.end(...e)}use(e){const t=e.prototype.name;if(!t)throw new Error('Extension class requires a "name" property on the prototype');this._debug("use extension.name=%s",t);const n=this._nextExt,r=new e(this);function i(){}"function"!=typeof r.onHandshake&&(r.onHandshake=i),"function"!=typeof r.onExtendedHandshake&&(r.onExtendedHandshake=i),"function"!=typeof r.onMessage&&(r.onMessage=i),this.extendedMapping[n]=t,this._ext[t]=r,this[t]=r,this._nextExt+=1}keepAlive(){this._debug("keep-alive"),this._push(d)}handshake(e,n,r){let i,o;if("string"==typeof e?(e=e.toLowerCase(),i=t.from(e,"hex")):(i=e,e=i.toString("hex")),"string"==typeof n?o=t.from(n,"hex"):(o=n,n=o.toString("hex")),20!==i.length||20!==o.length)throw new Error("infoHash and peerId MUST have length 20");this._debug("handshake i=%s p=%s exts=%o",e,n,r);const s=t.from(b);s[5]|=16,r&&r.dht&&(s[7]|=1),this._push(t.concat([p,s,i,o])),this._handshakeSent=!0,this.peerExtensions.extended&&!this._extendedHandshakeSent&&this._sendExtendedHandshake()}_sendExtendedHandshake(){const e=a(this.extendedHandshake);e.m={};for(const t in this.extendedMapping){const n=this.extendedMapping[t];e.m[n]=Number(t)}this.extended(0,i.encode(e)),this._extendedHandshakeSent=!0}choke(){if(!this.amChoking){for(this.amChoking=!0,this._debug("choke");this.peerRequests.length;)this.peerRequests.pop();this._push(m)}}unchoke(){this.amChoking&&(this.amChoking=!1,this._debug("unchoke"),this._push(g))}interested(){this.amInterested||(this.amInterested=!0,this._debug("interested"),this._push(y))}uninterested(){this.amInterested&&(this.amInterested=!1,this._debug("uninterested"),this._push(v))}have(e){this._debug("have %d",e),this._message(4,[e],null)}bitfield(e){this._debug("bitfield"),t.isBuffer(e)||(e=e.buffer),this._message(5,[],e)}request(e,t,n,r){return r||(r=(()=>{})),this._finished?r(new Error("wire is closed")):this.peerChoking?r(new Error("peer is choking")):(this._debug("request index=%d offset=%d length=%d",e,t,n),this.requests.push(new w(e,t,n,r)),this._updateTimeout(),void this._message(6,[e,t,n],null))}piece(e,t,n){this._debug("piece index=%d offset=%d",e,t),this.uploaded+=n.length,this.uploadSpeed(n.length),this.emit("upload",n.length),this._message(7,[e,t],n)}cancel(e,t,n){this._debug("cancel index=%d offset=%d length=%d",e,t,n),this._callback(this._pull(this.requests,e,t,n),new Error("request was cancelled"),null),this._message(8,[e,t,n],null)}port(e){this._debug("port %d",e);const n=t.from(_);n.writeUInt16BE(e,5),this._push(n)}extended(e,n){if(this._debug("extended ext=%s",e),"string"==typeof e&&this.peerExtendedMapping[e]&&(e=this.peerExtendedMapping[e]),"number"!=typeof e)throw new Error(`Unrecognized extension: ${e}`);{const r=t.from([e]),o=t.isBuffer(n)?n:i.encode(n);this._message(20,[],t.concat([r,o]))}}_read(){}_message(e,n,r){const i=r?r.length:0,o=t.allocUnsafe(5+4*n.length);o.writeUInt32BE(o.length+i-4,0),o[4]=e;for(let e=0;e{if(i===this._pull(this.peerRequests,e,t,n))return r?this._debug("error satisfying request index=%d offset=%d length=%d (%s)",e,t,n,r.message):void this.piece(e,t,o)};var i=new w(e,t,n,r);this.peerRequests.push(i),this.emit("request",e,t,n,r)}_onPiece(e,t,n){this._debug("got piece index=%d offset=%d",e,t),this._callback(this._pull(this.requests,e,t,n.length),null,n),this.downloaded+=n.length,this.downloadSpeed(n.length),this.emit("download",n.length),this.emit("piece",e,t,n)}_onCancel(e,t,n){this._debug("got cancel index=%d offset=%d length=%d",e,t,n),this._pull(this.peerRequests,e,t,n),this.emit("cancel",e,t,n)}_onPort(e){this._debug("got port %d",e),this.emit("port",e)}_onExtended(e,t){if(0===e){let e,n;try{e=i.decode(t)}catch(e){this._debug("ignoring invalid extended handshake: %s",e.message||e)}if(!e)return;if(this.peerExtendedHandshake=e,"object"==typeof e.m)for(n in e.m)this.peerExtendedMapping[n]=Number(e.m[n].toString());for(n in this._ext)this.peerExtendedMapping[n]&&this._ext[n].onExtendedHandshake(this.peerExtendedHandshake);this._debug("got extended handshake"),this.emit("extended","handshake",this.peerExtendedHandshake)}else this.extendedMapping[e]&&(e=this.extendedMapping[e],this._ext[e]&&this._ext[e].onMessage(t)),this._debug("got extended message ext=%s",e),this.emit("extended",e,t)}_onTimeout(){this._debug("request timed out"),this._callback(this.requests.shift(),new Error("request has timed out"),null),this.emit("timeout")}_write(e,n,r){for(this._bufferSize+=e.length,this._buffer.push(e);this._bufferSize>=this._parserSize;){const e=1===this._buffer.length?this._buffer[0]:t.concat(this._buffer);this._bufferSize-=this._parserSize,this._buffer=this._bufferSize?[e.slice(this._parserSize)]:[],this._parser(e.slice(0,this._parserSize))}r(null)}_callback(e,t,n){e&&(this._clearTimeout(),this.peerChoking||this._finished||this._updateTimeout(),e.callback(t,n))}_clearTimeout(){this._timeout&&(clearTimeout(this._timeout),this._timeout=null)}_updateTimeout(){this._timeoutMs&&this.requests.length&&!this._timeout&&(this._timeout=setTimeout(()=>this._onTimeout(),this._timeoutMs),this._timeoutUnref&&this._timeout.unref&&this._timeout.unref())}_parse(e,t){this._parserSize=e,this._parser=t}_onMessageLength(e){const t=e.readUInt32BE(0);t>0?this._parse(t,this._onMessage):(this._onKeepAlive(),this._parse(4,this._onMessageLength))}_onMessage(e){switch(this._parse(4,this._onMessageLength),e[0]){case 0:return this._onChoke();case 1:return this._onUnchoke();case 2:return this._onInterested();case 3:return this._onUninterested();case 4:return this._onHave(e.readUInt32BE(1));case 5:return this._onBitField(e.slice(1));case 6:return this._onRequest(e.readUInt32BE(1),e.readUInt32BE(5),e.readUInt32BE(9));case 7:return this._onPiece(e.readUInt32BE(1),e.readUInt32BE(5),e.slice(9));case 8:return this._onCancel(e.readUInt32BE(1),e.readUInt32BE(5),e.readUInt32BE(9));case 9:return this._onPort(e.readUInt16BE(1));case 20:return this._onExtended(e.readUInt8(1),e.slice(2));default:return this._debug("got unknown message"),this.emit("unknownmessage",e)}}_parseHandshake(){this._parse(1,e=>{const t=e.readUInt8(0);this._parse(t+48,e=>{const n=e.slice(0,t);if("BitTorrent protocol"!==n.toString())return this._debug("Error: wire not speaking BitTorrent protocol (%s)",n.toString()),void this.end();e=e.slice(t),this._onHandshake(e.slice(8,28),e.slice(28,48),{dht:!!(1&e[7]),extended:!!(16&e[5])}),this._parse(4,this._onMessageLength)})})}_onFinish(){for(this._finished=!0,this.push(null);this.read(););for(clearInterval(this._keepAliveInterval),this._parse(Number.MAX_VALUE,()=>{});this.peerRequests.length;)this.peerRequests.pop();for(;this.requests.length;)this._callback(this.requests.pop(),new Error("wire was closed"),null)}_debug(...e){e[0]=`[${this._debugId}] ${e[0]}`,s(...e)}_pull(e,t,n,i){for(let o=0;o0?("string"==typeof t||o.objectMode||Object.getPrototypeOf(t)===c.prototype||(t=f(t)),r?o.endEmitted?e.emit("error",new Error("stream.unshift() after end event")):x(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?x(e,o,t,!1):P(e,o)):x(e,o,t,!1))):r||(o.reading=!1));return A(o)}function x(e,t,n,r){t.flowing&&0===t.length&&!t.sync?(e.emit("data",n),e.read(0)):(t.length+=t.objectMode?1:n.length,r?t.buffer.unshift(n):t.buffer.push(n),t.needReadable&&B(e)),P(e,t)}function C(e,t){var n;return p(t)||"string"==typeof t||void 0===t||e.objectMode||(n=new TypeError("Invalid non-string/buffer chunk")),n}function A(e){return!e.ended&&(e.needReadable||e.length=T?e=T:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}function j(e,t){return e<=0||0===t.length&&t.ended?0:t.objectMode?1:e!=e?t.flowing&&t.length?t.buffer.head.data.length:t.length:(e>t.highWaterMark&&(t.highWaterMark=I(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}function R(e,t){if(!t.ended){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,B(e)}}function B(e){var t=e._readableState;t.needReadable=!1,t.emittedReadable||(g("emitReadable",t.flowing),t.emittedReadable=!0,t.sync?i.nextTick(O,e):O(e))}function O(e){g("emit readable"),e.emit("readable"),U(e)}function P(e,t){t.readingMore||(t.readingMore=!0,i.nextTick(N,e,t))}function N(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=z(e,t.buffer,t.decoder),n);var n}function z(e,t,n){var r;return eo.length?o.length:e;if(s===o.length?i+=o:i+=o.slice(0,e),e-=s,0===e){s===o.length?(++r,n.next?t.head=n.next:t.head=t.tail=null):(t.head=n,n.data=o.slice(s));break}++r}return t.length-=r,i}function H(e,t){var n=c.allocUnsafe(e),r=t.head,i=1;for(r.data.copy(n),e-=r.data.length;r=r.next;){var o=r.data,s=e>o.length?o.length:e;if(o.copy(n,n.length-e,0,s),e-=s,0===e){s===o.length?(++i,r.next?t.head=r.next:t.head=t.tail=null):(t.head=r,r.data=o.slice(s));break}++i}return t.length-=i,n}function V(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($,t,e))}function $(e,t){e.endEmitted||0!==e.length||(e.endEmitted=!0,t.readable=!1,t.emit("end"))}function W(e,t){for(var n=0,r=e.length;n=t.highWaterMark||t.ended))return g("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?V(this):B(this),null;if(e=j(e,t),0===e&&t.ended)return 0===t.length&&V(this),null;var r=t.needReadable,i;return g("need readable",r),(0===t.length||t.length-e0?q(e,t):null,null===i?(t.needReadable=!0,e=0):t.length-=e,0===t.length&&(t.ended||(t.needReadable=!0),n!==e&&t.ended&&V(this)),null!==i&&this.emit("data",i),i},E.prototype._read=function(e){this.emit("error",new Error("_read() is not implemented"))},E.prototype.pipe=function(e,t){var n=this,o=this._readableState;switch(o.pipesCount){case 0:o.pipes=e;break;case 1:o.pipes=[o.pipes,e];break;default:o.pipes.push(e)}o.pipesCount+=1,g("pipe count=%d opts=%j",o.pipesCount,t);var s=(!t||!1!==t.end)&&e!==r.stdout&&e!==r.stderr,a=s?c:_;function u(e,t){g("onunpipe"),e===n&&t&&!1===t.hasUnpiped&&(t.hasUnpiped=!0,p())}function c(){g("onend"),e.end()}o.endEmitted?i.nextTick(a):n.once("end",a),e.on("unpipe",u);var h=D(n);e.on("drain",h);var f=!1;function p(){g("cleanup"),e.removeListener("close",v),e.removeListener("finish",b),e.removeListener("drain",h),e.removeListener("error",y),e.removeListener("unpipe",u),n.removeListener("end",c),n.removeListener("end",_),n.removeListener("data",m),f=!0,!o.awaitDrain||e._writableState&&!e._writableState.needDrain||h()}var d=!1;function m(t){g("ondata"),d=!1;var r=e.write(t);!1!==r||d||((1===o.pipesCount&&o.pipes===e||o.pipesCount>1&&-1!==W(o.pipes,e))&&!f&&(g("false write response, pause",n._readableState.awaitDrain),n._readableState.awaitDrain++,d=!0),n.pause())}function y(t){g("onerror",t),_(),e.removeListener("error",y),0===l(e,"error")&&e.emit("error",t)}function v(){e.removeListener("finish",b),_()}function b(){g("onfinish"),e.removeListener("close",v),_()}function _(){g("unpipe"),n.unpipe(e)}return n.on("data",m),w(e,"error",y),e.once("close",v),e.once("finish",b),e.emit("pipe",n),o.flowing||(g("pipe resume"),n.resume()),e},E.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?this:(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 o=0;o-1?setImmediate:i.nextTick,l;_.WritableState=b;var u=n(8);u.inherits=n(3);var c={deprecate:n(59)},h=n(588),f=n(5).Buffer,p=r.Uint8Array||function(){};function d(e){return f.from(e)}function m(e){return f.isBuffer(e)||e instanceof p}var g=n(589),y;function v(){}function b(e,t){l=l||n(140),e=e||{};var r=t instanceof l;this.objectMode=!!e.objectMode,r&&(this.objectMode=this.objectMode||!!e.writableObjectMode);var i=e.highWaterMark,o=e.writableHighWaterMark,a=this.objectMode?16:16384;this.highWaterMark=i||0===i?i:r&&(o||0===o)?o:a,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 u=!1===e.decodeStrings;this.decodeStrings=!u,this.defaultEncoding=e.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(e){T(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 s(this)}function _(e){if(l=l||n(140),!(y.call(_,this)||this instanceof l))return new _(e);this._writableState=new b(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 w(e,t){var n=new Error("write after end");e.emit("error",n),i.nextTick(t,n)}function k(e,t,n,r){var o=!0,s=!1;return null===n?s=new TypeError("May not write null values to stream"):"string"==typeof n||void 0===n||t.objectMode||(s=new TypeError("Invalid non-string/buffer chunk")),s&&(e.emit("error",s),i.nextTick(r,s),o=!1),o}function E(e,t,n){return e.objectMode||!1===e.decodeStrings||"string"!=typeof t||(t=f.from(t,n)),t}function S(e,t,n,r,i,o){if(!n){var s=E(t,r,i);r!==s&&(n=!0,i="buffer",r=s)}var a=t.objectMode?1:r.length;t.length+=a;var l=t.length-1))throw new TypeError("Unknown encoding: "+t);return this._writableState.defaultEncoding=t,this},Object.defineProperty(_.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),_.prototype._write=function(e,t,n){n(new Error("_write() is not implemented"))},_.prototype._writev=null,_.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&&void 0!==e&&this.write(e,t),r.corked&&(r.corked=1,this.uncork()),r.ending||r.finished||D(this,r,n)},Object.defineProperty(_.prototype,"destroyed",{get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(e){this._writableState&&(this._writableState.destroyed=e)}}),_.prototype.destroy=g.destroy,_.prototype._undestroy=g.undestroy,_.prototype._destroy=function(e,t){this.end(),t(e)}}).call(this,n(2),n(7))},function(e,t,n){"use strict";e.exports=s;var r=n(140),i=n(8);function o(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.length255)return"DOMAIN_TOO_LONG";for(var n=t.split("."),i,o=0;o63)return"LABEL_TOO_LONG";if("-"===i.charAt(0))return"LABEL_STARTS_WITH_DASH";if("-"===i.charAt(i.length-1))return"LABEL_ENDS_WITH_DASH";if(!/^[a-z0-9\-]+$/.test(i))return"LABEL_INVALID_CHARS"}},t.parse=function(e){if("string"!=typeof e)throw new TypeError("Domain name must be a string.");var n=e.slice(0).toLowerCase();"."===n.charAt(n.length-1)&&(n=n.slice(0,n.length-1));var o=i.validate(n);if(o)return{input:e,error:{message:t.errorCodes[o],code:o}};var s={input:e,tld:null,sld:null,domain:null,subdomain:null,listed:!1},a=n.split(".");if("local"===a[a.length-1])return s;var l=function(){return/xn--/.test(n)?(s.domain&&(s.domain=r.toASCII(s.domain)),s.subdomain&&(s.subdomain=r.toASCII(s.subdomain)),s):s},u=i.findRule(n);if(!u)return a.length<2?s:(s.tld=a.pop(),s.sld=a.pop(),s.domain=[s.sld,s.tld].join("."),a.length&&(s.subdomain=a.pop()),l());s.listed=!0;var c=u.suffix.split("."),h=a.slice(0,a.length-c.length);return u.exception&&h.push(c.shift()),s.tld=c.join("."),h.length?(u.wildcard&&(c.unshift(h.pop()),s.tld=c.join(".")),h.length?(s.sld=h.pop(),s.domain=[s.sld,s.tld].join("."),h.length&&(s.subdomain=h.join(".")),l()):l()):l()},t.get=function(e){return e&&t.parse(e).domain||null},t.isValid=function(e){var n=t.parse(e);return Boolean(n.domain&&n.listed)}},function(e,t,n){"use strict"; -/*! - * Copyright (c) 2015, Salesforce.com, Inc. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * 3. Neither the name of Salesforce.com nor the names of its contributors may - * be used to endorse or promote products derived from this software without - * specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */function r(){}t.Store=r,r.prototype.synchronous=!1,r.prototype.findCookie=function(e,t,n,r){throw new Error("findCookie is not implemented")},r.prototype.findCookies=function(e,t,n){throw new Error("findCookies is not implemented")},r.prototype.putCookie=function(e,t){throw new Error("putCookie is not implemented")},r.prototype.updateCookie=function(e,t,n){throw new Error("updateCookie is not implemented")},r.prototype.removeCookie=function(e,t,n,r){throw new Error("removeCookie is not implemented")},r.prototype.removeCookies=function(e,t,n){throw new Error("removeCookies is not implemented")},r.prototype.getAllCookies=function(e){throw new Error("getAllCookies is not implemented (therefore jar cannot be serialized)")}},function(e,t,n){"use strict"; -/*! - * Copyright (c) 2015, Salesforce.com, Inc. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * 3. Neither the name of Salesforce.com nor the names of its contributors may - * be used to endorse or promote products derived from this software without - * specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */var r=n(595);function i(e){var t=r.getPublicSuffix(e);if(!t)return null;if(t==e)return[e];for(var n=e.slice(0,-(t.length+1)),i=n.split(".").reverse(),o=t,s=[o];i.length;)o=i.shift()+"."+o,s.push(o);return s}t.permuteDomain=i},function(e,t,n){"use strict"; -/*! - * Copyright (c) 2015, Salesforce.com, Inc. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * 3. Neither the name of Salesforce.com nor the names of its contributors may - * be used to endorse or promote products derived from this software without - * specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */function r(e,t){if(t===e)return!0;var n=e.indexOf(t);if(0===n){if("/"===t.substr(-1))return!0;if("/"===e.substr(t.length,1))return!0}return!1}t.pathMatch=r},function(e,t,n){"use strict";function r(e,t,n,r){for(var i=65535&e|0,o=e>>>16&65535|0,s=0;0!==n;){s=n>2e3?2e3:n,n-=s;do{i=i+t[r++]|0,o=o+i|0}while(--s);i%=65521,o%=65521}return i|o<<16|0}e.exports=r},function(e,t,n){"use strict";function r(){for(var e,t=[],n=0;n<256;n++){e=n;for(var r=0;r<8;r++)e=1&e?3988292384^e>>>1:e>>>1;t[n]=e}return t}var i=r();function o(e,t,n,r){var o=i,s=r+n;e^=-1;for(var a=r;a>>8^o[255&(e^t[a])];return-1^e}e.exports=o},function(e,t,n){e.exports={Verifier:u,Signer:c};var r=n(172),i=n(62),o=n(14),s=n(25),a=n(29).Buffer,l=n(83);function u(e,t){if("sha512"!==t.toLowerCase())throw new Error("ED25519 only supports the use of SHA-512 hashes");this.key=e,this.chunks=[],i.Writable.call(this,{})}function c(e,t){if("sha512"!==t.toLowerCase())throw new Error("ED25519 only supports the use of SHA-512 hashes");this.key=e,this.chunks=[],i.Writable.call(this,{})}o.inherits(u,i.Writable),u.prototype._write=function(e,t,n){this.chunks.push(e),n()},u.prototype.update=function(e){"string"==typeof e&&(e=a.from(e,"binary")),this.chunks.push(e)},u.prototype.verify=function(e,t){var n;if(l.isSignature(e,[2,0])){if("ed25519"!==e.type)return!1;n=e.toBuffer("raw")}else if("string"==typeof e)n=a.from(e,"base64");else if(l.isSignature(e,[1,0]))throw new Error("signature was created by too old a version of sshpk and cannot be verified");return s.buffer(n),r.sign.detached.verify(new Uint8Array(a.concat(this.chunks)),new Uint8Array(n),new Uint8Array(this.key.part.A.data))},o.inherits(c,i.Writable),c.prototype._write=function(e,t,n){this.chunks.push(e),n()},c.prototype.update=function(e){"string"==typeof e&&(e=a.from(e,"binary")),this.chunks.push(e)},c.prototype.sign=function(){var e=r.sign.detached(new Uint8Array(a.concat(this.chunks)),new Uint8Array(a.concat([this.key.part.k.data,this.key.part.A.data]))),t=a.from(e),n=l.parse(t,"ed25519","raw");return n.hashAlgorithm="sha512",n}},function(e,t,n){e.exports={read:d,write:b};var r=n(25),i=n(29).Buffer,o=n(42),s=n(41),a=n(46),l=n(92),u=n(605),c=n(93),h=n(317),f=n(606),p="Private-key-format: v1";function d(e,t){if("string"==typeof e){if(e.trim().match(/^[-]+[ ]*BEGIN/))return l.read(e,t);if(e.match(/^\s*ssh-[a-z]/))return u.read(e,t);if(e.match(/^\s*ecdsa-/))return u.read(e,t);if(e.match(/^putty-user-key-file-2:/i))return f.read(e,t);if(v(e))return h.read(e,t);e=i.from(e,"binary")}else{if(r.buffer(e),y(e))return l.read(e,t);if(g(e))return u.read(e,t);if(m(e))return f.read(e,t);if(v(e))return h.read(e,t)}if(e.readUInt32BE(0)e.length||"BEGIN"!==e.slice(t,t+5).toString("ascii"))}function v(e){if(e.length<=p.length)return!1;var t=e.slice(0,p.length);if(t.toString("ascii")===p)return!0;"string"!=typeof e&&(e=e.toString("ascii"));for(var n=e.split("\n"),r=0;n[r].match(/^\;/);)r++;return!!n[r].toString("ascii").match(/\. IN KEY /)||!!n[r].toString("ascii").match(/\. IN DNSKEY /)}function b(e,t){throw new Error('"auto" format cannot be used for writing')}},function(e,t,n){"use strict";var r=n(172).lowlevel.crypto_hash,i=0,o=function(){this.S=[new Uint32Array([3509652390,2564797868,805139163,3491422135,3101798381,1780907670,3128725573,4046225305,614570311,3012652279,134345442,2240740374,1667834072,1901547113,2757295779,4103290238,227898511,1921955416,1904987480,2182433518,2069144605,3260701109,2620446009,720527379,3318853667,677414384,3393288472,3101374703,2390351024,1614419982,1822297739,2954791486,3608508353,3174124327,2024746970,1432378464,3864339955,2857741204,1464375394,1676153920,1439316330,715854006,3033291828,289532110,2706671279,2087905683,3018724369,1668267050,732546397,1947742710,3462151702,2609353502,2950085171,1814351708,2050118529,680887927,999245976,1800124847,3300911131,1713906067,1641548236,4213287313,1216130144,1575780402,4018429277,3917837745,3693486850,3949271944,596196993,3549867205,258830323,2213823033,772490370,2760122372,1774776394,2652871518,566650946,4142492826,1728879713,2882767088,1783734482,3629395816,2517608232,2874225571,1861159788,326777828,3124490320,2130389656,2716951837,967770486,1724537150,2185432712,2364442137,1164943284,2105845187,998989502,3765401048,2244026483,1075463327,1455516326,1322494562,910128902,469688178,1117454909,936433444,3490320968,3675253459,1240580251,122909385,2157517691,634681816,4142456567,3825094682,3061402683,2540495037,79693498,3249098678,1084186820,1583128258,426386531,1761308591,1047286709,322548459,995290223,1845252383,2603652396,3431023940,2942221577,3202600964,3727903485,1712269319,422464435,3234572375,1170764815,3523960633,3117677531,1434042557,442511882,3600875718,1076654713,1738483198,4213154764,2393238008,3677496056,1014306527,4251020053,793779912,2902807211,842905082,4246964064,1395751752,1040244610,2656851899,3396308128,445077038,3742853595,3577915638,679411651,2892444358,2354009459,1767581616,3150600392,3791627101,3102740896,284835224,4246832056,1258075500,768725851,2589189241,3069724005,3532540348,1274779536,3789419226,2764799539,1660621633,3471099624,4011903706,913787905,3497959166,737222580,2514213453,2928710040,3937242737,1804850592,3499020752,2949064160,2386320175,2390070455,2415321851,4061277028,2290661394,2416832540,1336762016,1754252060,3520065937,3014181293,791618072,3188594551,3933548030,2332172193,3852520463,3043980520,413987798,3465142937,3030929376,4245938359,2093235073,3534596313,375366246,2157278981,2479649556,555357303,3870105701,2008414854,3344188149,4221384143,3956125452,2067696032,3594591187,2921233993,2428461,544322398,577241275,1471733935,610547355,4027169054,1432588573,1507829418,2025931657,3646575487,545086370,48609733,2200306550,1653985193,298326376,1316178497,3007786442,2064951626,458293330,2589141269,3591329599,3164325604,727753846,2179363840,146436021,1461446943,4069977195,705550613,3059967265,3887724982,4281599278,3313849956,1404054877,2845806497,146425753,1854211946]),new Uint32Array([1266315497,3048417604,3681880366,3289982499,290971e4,1235738493,2632868024,2414719590,3970600049,1771706367,1449415276,3266420449,422970021,1963543593,2690192192,3826793022,1062508698,1531092325,1804592342,2583117782,2714934279,4024971509,1294809318,4028980673,1289560198,2221992742,1669523910,35572830,157838143,1052438473,1016535060,1802137761,1753167236,1386275462,3080475397,2857371447,1040679964,2145300060,2390574316,1461121720,2956646967,4031777805,4028374788,33600511,2920084762,1018524850,629373528,3691585981,3515945977,2091462646,2486323059,586499841,988145025,935516892,3367335476,2599673255,2839830854,265290510,3972581182,2759138881,3795373465,1005194799,847297441,406762289,1314163512,1332590856,1866599683,4127851711,750260880,613907577,1450815602,3165620655,3734664991,3650291728,3012275730,3704569646,1427272223,778793252,1343938022,2676280711,2052605720,1946737175,3164576444,3914038668,3967478842,3682934266,1661551462,3294938066,4011595847,840292616,3712170807,616741398,312560963,711312465,1351876610,322626781,1910503582,271666773,2175563734,1594956187,70604529,3617834859,1007753275,1495573769,4069517037,2549218298,2663038764,504708206,2263041392,3941167025,2249088522,1514023603,1998579484,1312622330,694541497,2582060303,2151582166,1382467621,776784248,2618340202,3323268794,2497899128,2784771155,503983604,4076293799,907881277,423175695,432175456,1378068232,4145222326,3954048622,3938656102,3820766613,2793130115,2977904593,26017576,3274890735,3194772133,1700274565,1756076034,4006520079,3677328699,720338349,1533947780,354530856,688349552,3973924725,1637815568,332179504,3949051286,53804574,2852348879,3044236432,1282449977,3583942155,3416972820,4006381244,1617046695,2628476075,3002303598,1686838959,431878346,2686675385,1700445008,1080580658,1009431731,832498133,3223435511,2605976345,2271191193,2516031870,1648197032,4164389018,2548247927,300782431,375919233,238389289,3353747414,2531188641,2019080857,1475708069,455242339,2609103871,448939670,3451063019,1395535956,2413381860,1841049896,1491858159,885456874,4264095073,4001119347,1565136089,3898914787,1108368660,540939232,1173283510,2745871338,3681308437,4207628240,3343053890,4016749493,1699691293,1103962373,3625875870,2256883143,3830138730,1031889488,3479347698,1535977030,4236805024,3251091107,2132092099,1774941330,1199868427,1452454533,157007616,2904115357,342012276,595725824,1480756522,206960106,497939518,591360097,863170706,2375253569,3596610801,1814182875,2094937945,3421402208,1082520231,3463918190,2785509508,435703966,3908032597,1641649973,2842273706,3305899714,1510255612,2148256476,2655287854,3276092548,4258621189,236887753,3681803219,274041037,1734335097,3815195456,3317970021,1899903192,1026095262,4050517792,356393447,2410691914,3873677099,3682840055]),new Uint32Array([3913112168,2491498743,4132185628,2489919796,1091903735,1979897079,3170134830,3567386728,3557303409,857797738,1136121015,1342202287,507115054,2535736646,337727348,3213592640,1301675037,2528481711,1895095763,1721773893,3216771564,62756741,2142006736,835421444,2531993523,1442658625,3659876326,2882144922,676362277,1392781812,170690266,3921047035,1759253602,3611846912,1745797284,664899054,1329594018,3901205900,3045908486,2062866102,2865634940,3543621612,3464012697,1080764994,553557557,3656615353,3996768171,991055499,499776247,1265440854,648242737,3940784050,980351604,3713745714,1749149687,3396870395,4211799374,3640570775,1161844396,3125318951,1431517754,545492359,4268468663,3499529547,1437099964,2702547544,3433638243,2581715763,2787789398,1060185593,1593081372,2418618748,4260947970,69676912,2159744348,86519011,2512459080,3838209314,1220612927,3339683548,133810670,1090789135,1078426020,1569222167,845107691,3583754449,4072456591,1091646820,628848692,1613405280,3757631651,526609435,236106946,48312990,2942717905,3402727701,1797494240,859738849,992217954,4005476642,2243076622,3870952857,3732016268,765654824,3490871365,2511836413,1685915746,3888969200,1414112111,2273134842,3281911079,4080962846,172450625,2569994100,980381355,4109958455,2819808352,2716589560,2568741196,3681446669,3329971472,1835478071,660984891,3704678404,4045999559,3422617507,3040415634,1762651403,1719377915,3470491036,2693910283,3642056355,3138596744,1364962596,2073328063,1983633131,926494387,3423689081,2150032023,4096667949,1749200295,3328846651,309677260,2016342300,1779581495,3079819751,111262694,1274766160,443224088,298511866,1025883608,3806446537,1145181785,168956806,3641502830,3584813610,1689216846,3666258015,3200248200,1692713982,2646376535,4042768518,1618508792,1610833997,3523052358,4130873264,2001055236,3610705100,2202168115,4028541809,2961195399,1006657119,2006996926,3186142756,1430667929,3210227297,1314452623,4074634658,4101304120,2273951170,1399257539,3367210612,3027628629,1190975929,2062231137,2333990788,2221543033,2438960610,1181637006,548689776,2362791313,3372408396,3104550113,3145860560,296247880,1970579870,3078560182,3769228297,1714227617,3291629107,3898220290,166772364,1251581989,493813264,448347421,195405023,2709975567,677966185,3703036547,1463355134,2715995803,1338867538,1343315457,2802222074,2684532164,233230375,2599980071,2000651841,3277868038,1638401717,4028070440,3237316320,6314154,819756386,300326615,590932579,1405279636,3267499572,3150704214,2428286686,3959192993,3461946742,1862657033,1266418056,963775037,2089974820,2263052895,1917689273,448879540,3550394620,3981727096,150775221,3627908307,1303187396,508620638,2975983352,2726630617,1817252668,1876281319,1457606340,908771278,3720792119,3617206836,2455994898,1729034894,1080033504]),new Uint32Array([976866871,3556439503,2881648439,1522871579,1555064734,1336096578,3548522304,2579274686,3574697629,3205460757,3593280638,3338716283,3079412587,564236357,2993598910,1781952180,1464380207,3163844217,3332601554,1699332808,1393555694,1183702653,3581086237,1288719814,691649499,2847557200,2895455976,3193889540,2717570544,1781354906,1676643554,2592534050,3230253752,1126444790,2770207658,2633158820,2210423226,2615765581,2414155088,3127139286,673620729,2805611233,1269405062,4015350505,3341807571,4149409754,1057255273,2012875353,2162469141,2276492801,2601117357,993977747,3918593370,2654263191,753973209,36408145,2530585658,25011837,3520020182,2088578344,530523599,2918365339,1524020338,1518925132,3760827505,3759777254,1202760957,3985898139,3906192525,674977740,4174734889,2031300136,2019492241,3983892565,4153806404,3822280332,352677332,2297720250,60907813,90501309,3286998549,1016092578,2535922412,2839152426,457141659,509813237,4120667899,652014361,1966332200,2975202805,55981186,2327461051,676427537,3255491064,2882294119,3433927263,1307055953,942726286,933058658,2468411793,3933900994,4215176142,1361170020,2001714738,2830558078,3274259782,1222529897,1679025792,2729314320,3714953764,1770335741,151462246,3013232138,1682292957,1483529935,471910574,1539241949,458788160,3436315007,1807016891,3718408830,978976581,1043663428,3165965781,1927990952,4200891579,2372276910,3208408903,3533431907,1412390302,2931980059,4132332400,1947078029,3881505623,4168226417,2941484381,1077988104,1320477388,886195818,18198404,3786409e3,2509781533,112762804,3463356488,1866414978,891333506,18488651,661792760,1628790961,3885187036,3141171499,876946877,2693282273,1372485963,791857591,2686433993,3759982718,3167212022,3472953795,2716379847,445679433,3561995674,3504004811,3574258232,54117162,3331405415,2381918588,3769707343,4154350007,1140177722,4074052095,668550556,3214352940,367459370,261225585,2610173221,4209349473,3468074219,3265815641,314222801,3066103646,3808782860,282218597,3406013506,3773591054,379116347,1285071038,846784868,2669647154,3771962079,3550491691,2305946142,453669953,1268987020,3317592352,3279303384,3744833421,2610507566,3859509063,266596637,3847019092,517658769,3462560207,3443424879,370717030,4247526661,2224018117,4143653529,4112773975,2788324899,2477274417,1456262402,2901442914,1517677493,1846949527,2295493580,3734397586,2176403920,1280348187,1908823572,3871786941,846861322,1172426758,3287448474,3383383037,1655181056,3139813346,901632758,1897031941,2986607138,3066810236,3447102507,1393639104,373351379,950779232,625454576,3124240540,4148612726,2007998917,544563296,2244738638,2330496472,2058025392,1291430526,424198748,50039436,29584100,3605783033,2429876329,2791104160,1057563949,3255363231,3075367218,3463963227,1469046755,985887462])],this.P=new Uint32Array([608135816,2242054355,320440878,57701188,2752067618,698298832,137296536,3964562569,1160258022,953160567,3193202383,887688300,3232508343,3380367581,1065670069,3041331479,2450970073,2306472731])};function s(e,t,n){return(e[0][t[n+3]]+e[1][t[n+2]]^e[2][t[n+1]])+e[3][t[n]]}function a(e,t){var n,r=0;for(n=0;n<4;n++,i++)i>=t&&(i=0),r=r<<8|e[i];return r}o.prototype.encipher=function(e,t){void 0===t&&(t=new Uint8Array(e.buffer),0!==e.byteOffset&&(t=t.subarray(e.byteOffset))),e[0]^=this.P[0];for(var n=1;n<16;n+=2)e[1]^=s(this.S,t,0)^this.P[n],e[0]^=s(this.S,t,4)^this.P[n+1];var r=e[0];e[0]=e[1]^this.P[17],e[1]=r},o.prototype.decipher=function(e){var t=new Uint8Array(e.buffer);0!==e.byteOffset&&(t=t.subarray(e.byteOffset)),e[0]^=this.P[17];for(var n=16;n>0;n-=2)e[1]^=s(this.S,t,0)^this.P[n],e[0]^=s(this.S,t,4)^this.P[n-1];var r=e[0];e[0]=e[1]^this.P[0],e[1]=r},o.prototype.expand0state=function(e,t){var n=new Uint32Array(2),r,o,s=new Uint8Array(n.buffer);for(r=0,i=0;r<18;r++)this.P[r]^=a(e,t);for(i=0,r=0;r<18;r+=2)this.encipher(n,s),this.P[r]=n[0],this.P[r+1]=n[1];for(r=0;r<4;r++)for(o=0;o<256;o+=2)this.encipher(n,s),this.S[r][o]=n[0],this.S[r][o+1]=n[1]},o.prototype.expandstate=function(e,t,n,r){var o=new Uint32Array(2),s,l;for(s=0,i=0;s<18;s++)this.P[s]^=a(n,r);for(s=0,i=0;s<18;s+=2)o[0]^=a(e,t),o[1]^=a(e,t),this.encipher(o),this.P[s]=o[0],this.P[s+1]=o[1];for(s=0;s<4;s++)for(l=0;l<256;l+=2)o[0]^=a(e,t),o[1]^=a(e,t),this.encipher(o),this.S[s][l]=o[0],this.S[s][l+1]=o[1];i=0},o.prototype.enc=function(e,t){for(var n=0;n>>24,n[4*s+2]=i[s]>>>16,n[4*s+1]=i[s]>>>8,n[4*s+0]=i[s]}function h(e,t,n,i,o,s,a){var l=new Uint8Array(64),h=new Uint8Array(64),f=new Uint8Array(u),p=new Uint8Array(u),d=new Uint8Array(i+4),m,g,y,v,b,_,w=s;if(a<1)return-1;if(0===t||0===i||0===s||s>f.byteLength*f.byteLength||i>1<<20)return-1;for(v=Math.floor((s+f.byteLength-1)/f.byteLength),y=Math.floor((s+v-1)/v),m=0;m0;_++){for(d[i+0]=_>>>24,d[i+1]=_>>>16,d[i+2]=_>>>8,d[i+3]=_,r(h,d,i+4),c(l,h,p),m=f.byteLength;m--;)f[m]=p[m];for(m=1;m=w));m++)o[b]=f[m];s-=m}return 0}e.exports={BLOCKS:l,HASHSIZE:u,hash:c,pbkdf:h}},function(e,t,n){e.exports={read:f,write:p};var r=n(25),i=n(29).Buffer,o=n(93),s=n(42),a=n(41),l=n(46),u=n(236),c=/^([a-z0-9-]+)[ \t]+([a-zA-Z0-9+\/]+[=]*)([ \t]+([^ \t][^\n]*[\n]*)?)?$/,h=/^([a-z0-9-]+)[ \t\n]+([a-zA-Z0-9+\/][a-zA-Z0-9+\/ \t\n=]*)([^a-zA-Z0-9+\/ \t\n=].*)?$/;function f(e,t){"string"!=typeof e&&(r.buffer(e,"buf"),e=e.toString("ascii"));var n=e.trim().replace(/[\\\r]/g,""),s=n.match(c);s||(s=n.match(h)),r.ok(s,"key must match regex");var a=o.algToKeyType(s[1]),l=i.from(s[2],"base64"),u,f={};if(s[4])try{u=o.read(l)}catch(e){s=n.match(h),r.ok(s,"key must match regex"),l=i.from(s[2],"base64"),u=o.readInternal(f,"public",l)}else u=o.readInternal(f,"public",l);if(r.strictEqual(a,u.type),s[4]&&s[4].length>0)u.comment=s[4];else if(f.consumed){var p=s[2]+(s[3]?s[3]:""),d=4*Math.ceil(f.consumed/3);p=p.slice(0,d-2).replace(/[^a-zA-Z0-9+\/=]/g,"")+p.slice(d-2);var m=f.consumed%3;for(m>0&&"="!==p.slice(d-1,d)&&d--;"="===p.slice(d,d+1);)d++;var g=p.slice(d);g=g.replace(/[\r\n]/g," ").replace(/^\s+/,""),g.match(/^[a-zA-Z0-9]/)&&(u.comment=g)}return u}function p(e,t){if(r.object(e),!a.isKey(e))throw new Error("Must be a public key");var n=[],s=o.keyTypeToAlg(e);n.push(s);var l=o.write(e);return n.push(l.toString("base64")),e.comment&&n.push(e.comment),i.from(n.join(" "))}},function(e,t,n){e.exports={read:l,write:c};var r=n(25),i=n(29).Buffer,o=n(93),s=n(41),a=n(76);function l(e,t){for(var n=e.toString("ascii").split(/[\r\n]+/),s=!1,a,l=0;ln.length)throw new Error("Invalid public-lines count");var p=i.from(n.slice(l,l+f).join(""),"base64"),d=o.algToKeyType(c),m=o.read(p);if(m.type!==d)throw new Error("Outer key algorithm mismatch");return m.comment=h,m}function u(e){var t=e.indexOf(":");if(-1===t)return null;var n=e.slice(0,t);for(++t;" "===e[t];)++t;var r=e.slice(t);return[n,r]}function c(e,t){if(r.object(e),!s.isKey(e))throw new Error("Must be a public key");var n=o.keyTypeToAlg(e),a=o.write(e),l=e.comment||"",u=a.toString("base64"),c=h(u,64);return c.unshift("Public-Lines: "+c.length),c.unshift("Comment: "+l),c.unshift("Encryption: none"),c.unshift("PuTTY-User-Key-File-2: "+n),i.from(c.join("\n")+"\n")}function h(e,t){for(var n=[],r=0;r1)throw new Error("DER sequence does not contain whole byte stream");var s=n.offset;n.readSequence();var a=n.offset+n.length,l=a;if(n.peek()===y(0)){n.readSequence(y(0));var u=n.readInt();r.ok(u<=3,"only x.509 versions up to v3 supported")}var c={signatures:{}},g=c.signatures.x509={};g.extras={},c.serial=m(n,"serial"),n.readSequence();var v=n.offset+n.length,_=n.readOID(),w=b[_];if(void 0===w)throw new Error("unknown signature algorithm "+_);if(n._offset=v,c.issuer=h.parseAsn1(n),n.readSequence(),c.validFrom=k(n),c.validUntil=k(n),c.subjects=[h.parseAsn1(n)],n.readSequence(),v=n.offset+n.length,c.subjectKey=d.readPkcs8(void 0,"public",n),n._offset=v,n.peek()===y(1)&&(n.readSequence(y(1)),g.extras.issuerUniqueID=e.slice(n.offset,n.offset+n.length),n._offset+=n.length),n.peek()===y(2)&&(n.readSequence(y(2)),g.extras.subjectUniqueID=e.slice(n.offset,n.offset+n.length),n._offset+=n.length),n.peek()===y(3)){n.readSequence(y(3));var E=n.offset+n.length;for(n.readSequence();n.offset=2050||t.getUTCFullYear()<1950?e.writeString(N(t),i.Ber.GeneralizedTime):e.writeString(P(t),i.Ber.UTCTime)}var S={OtherName:y(0),RFC822Name:v(1),DNSName:v(2),X400Address:y(3),DirectoryName:y(4),EDIPartyName:y(5),URI:v(6),IPAddress:v(7),OID:v(8)},x={serverAuth:"1.3.6.1.5.5.7.3.1",clientAuth:"1.3.6.1.5.5.7.3.2",codeSigning:"1.3.6.1.5.5.7.3.3",joyentDocker:"1.3.6.1.4.1.38678.1.4.1",joyentCmon:"1.3.6.1.4.1.38678.1.4.2"},C={};Object.keys(x).forEach(function(e){C[x[e]]=e});var A=["signature","identity","keyEncryption","encryption","keyAgreement","ca","crl"];function T(e,t,n){n.readSequence();var r=n.offset+n.length,o=n.readOID(),s,a=e.signatures.x509,l;switch(a.extras.exts||(a.extras.exts=[]),n.peek()===i.Ber.Boolean&&(l=n.readBoolean()),o){case _.basicConstraints:n.readSequence(i.Ber.OctetString),n.readSequence();var u=n.offset+n.length,c=!1;n.peek()===i.Ber.Boolean&&(c=n.readBoolean()),void 0===e.purposes&&(e.purposes=[]),!0===c&&e.purposes.push("ca");var f={oid:o,critical:l};n.offset=60?o-1:o,n.setUTCFullYear(s,parseInt(t[2],10)-1,parseInt(t[3],10)),n.setUTCHours(parseInt(t[4],10),parseInt(t[5],10)),t[6]&&t[6].length>0&&n.setUTCSeconds(parseInt(t[6],10)),n}var R=/^([0-9]{4})([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})?Z$/;function B(e){var t=e.match(R);r.ok(t);var n=new Date;return n.setUTCFullYear(parseInt(t[1],10),parseInt(t[2],10)-1,parseInt(t[3],10)),n.setUTCHours(parseInt(t[4],10),parseInt(t[5],10)),t[6]&&t[6].length>0&&n.setUTCSeconds(parseInt(t[6],10)),n}function O(e,t){void 0===t&&(t=2);for(var n=""+e;n.length0||"host"===o.type||void 0!==e.purposes&&e.purposes.length>0||n.extras&&n.extras.exts){t.startSequence(y(3)),t.startSequence();var l=[];void 0!==e.purposes&&e.purposes.length>0&&(l.push({oid:_.basicConstraints,critical:!0}),l.push({oid:_.keyUsage,critical:!0}),l.push({oid:_.extKeyUsage,critical:!0})),l.push({oid:_.altName}),n.extras&&n.extras.exts&&(l=n.extras.exts);for(var u=0;u=48&&s<=57||s>=65&&s<=90||s>=97&&s<=122?r+=n.charAt(o):s<128?r+=i[s]:s<2048?r+=i[192|s>>6]+i[128|63&s]:s<55296||s>=57344?r+=i[224|s>>12]+i[128|s>>6&63]+i[128|63&s]:(o+=1,s=65536+((1023&s)<<10|1023&n.charCodeAt(o)),r+=i[240|s>>18]+i[128|s>>12&63]+i[128|s>>6&63]+i[128|63&s])}return r},h=function e(t){for(var n=[{obj:{o:t},prop:"o"}],r=[],i=0;i",_=m?">":"<",h=void 0;if(v){var w=t.util.getData(y.$data,s,t.dataPathArr),k="exclusive"+o,E="exclType"+o,S="exclIsNumber"+o,x="op"+o,C="' + "+x+" + '";i+=" var schemaExcl"+o+" = "+w+"; ",w="schemaExcl"+o,i+=" var "+k+"; var "+E+" = typeof "+w+"; if ("+E+" != 'boolean' && "+E+" != 'undefined' && "+E+" != 'number') { ";var h=g,A=A||[];A.push(i),i="",!1!==t.createErrors?(i+=" { keyword: '"+(h||"_exclusiveLimit")+"' , dataPath: (dataPath || '') + "+t.errorPath+" , schemaPath: "+t.util.toQuotedString(u)+" , params: {} ",!1!==t.opts.messages&&(i+=" , message: '"+g+" should be boolean' "),t.opts.verbose&&(i+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+t.schemaPath+" , data: "+f+" "),i+=" } "):i+=" {} ";var T=i;i=A.pop(),!t.compositeRule&&c?t.async?i+=" throw new ValidationError(["+T+"]); ":i+=" validate.errors = ["+T+"]; return false; ":i+=" var err = "+T+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",i+=" } else if ( ",p&&(i+=" ("+d+" !== undefined && typeof "+d+" != 'number') || "),i+=" "+E+" == 'number' ? ( ("+k+" = "+d+" === undefined || "+w+" "+b+"= "+d+") ? "+f+" "+_+"= "+w+" : "+f+" "+_+" "+d+" ) : ( ("+k+" = "+w+" === true) ? "+f+" "+_+"= "+d+" : "+f+" "+_+" "+d+" ) || "+f+" !== "+f+") { var op"+o+" = "+k+" ? '"+b+"' : '"+b+"='; ",void 0===a&&(h=g,u=t.errSchemaPath+"/"+g,d=w,p=v)}else{var S="number"==typeof y,C=b;if(S&&p){var x="'"+C+"'";i+=" if ( ",p&&(i+=" ("+d+" !== undefined && typeof "+d+" != 'number') || "),i+=" ( "+d+" === undefined || "+y+" "+b+"= "+d+" ? "+f+" "+_+"= "+y+" : "+f+" "+_+" "+d+" ) || "+f+" !== "+f+") { "}else{S&&void 0===a?(k=!0,h=g,u=t.errSchemaPath+"/"+g,d=y,_+="="):(S&&(d=Math[m?"min":"max"](y,a)),y===(!S||d)?(k=!0,h=g,u=t.errSchemaPath+"/"+g,_+="="):(k=!1,C+="="));var x="'"+C+"'";i+=" if ( ",p&&(i+=" ("+d+" !== undefined && typeof "+d+" != 'number') || "),i+=" "+f+" "+_+" "+d+" || "+f+" !== "+f+") { "}}h=h||n;var A=A||[];A.push(i),i="",!1!==t.createErrors?(i+=" { keyword: '"+(h||"_limit")+"' , dataPath: (dataPath || '') + "+t.errorPath+" , schemaPath: "+t.util.toQuotedString(u)+" , params: { comparison: "+x+", limit: "+d+", exclusive: "+k+" } ",!1!==t.opts.messages&&(i+=" , message: 'should be "+C+" ",i+=p?"' + "+d:d+"'"),t.opts.verbose&&(i+=" , schema: ",i+=p?"validate.schema"+l:""+a,i+=" , parentSchema: validate.schema"+t.schemaPath+" , data: "+f+" "),i+=" } "):i+=" {} ";var T=i;return i=A.pop(),!t.compositeRule&&c?t.async?i+=" throw new ValidationError(["+T+"]); ":i+=" validate.errors = ["+T+"]; return false; ":i+=" var err = "+T+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",i+=" } ",c&&(i+=" else { "),i}},function(e,t,n){"use strict";e.exports=function e(t,n,r){var i=" ",o=t.level,s=t.dataLevel,a=t.schema[n],l=t.schemaPath+t.util.getProperty(n),u=t.errSchemaPath+"/"+n,c=!t.opts.allErrors,h,f="data"+(s||""),p=t.opts.$data&&a&&a.$data,d;p?(i+=" var schema"+o+" = "+t.util.getData(a.$data,s,t.dataPathArr)+"; ",d="schema"+o):d=a;var m="maxItems"==n?">":"<";i+="if ( ",p&&(i+=" ("+d+" !== undefined && typeof "+d+" != 'number') || "),i+=" "+f+".length "+m+" "+d+") { ";var h=n,g=g||[];g.push(i),i="",!1!==t.createErrors?(i+=" { keyword: '"+(h||"_limitItems")+"' , dataPath: (dataPath || '') + "+t.errorPath+" , schemaPath: "+t.util.toQuotedString(u)+" , params: { limit: "+d+" } ",!1!==t.opts.messages&&(i+=" , message: 'should NOT have ",i+="maxItems"==n?"more":"fewer",i+=" than ",i+=p?"' + "+d+" + '":""+a,i+=" items' "),t.opts.verbose&&(i+=" , schema: ",i+=p?"validate.schema"+l:""+a,i+=" , parentSchema: validate.schema"+t.schemaPath+" , data: "+f+" "),i+=" } "):i+=" {} ";var y=i;return i=g.pop(),!t.compositeRule&&c?t.async?i+=" throw new ValidationError(["+y+"]); ":i+=" validate.errors = ["+y+"]; return false; ":i+=" var err = "+y+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",i+="} ",c&&(i+=" else { "),i}},function(e,t,n){"use strict";e.exports=function e(t,n,r){var i=" ",o=t.level,s=t.dataLevel,a=t.schema[n],l=t.schemaPath+t.util.getProperty(n),u=t.errSchemaPath+"/"+n,c=!t.opts.allErrors,h,f="data"+(s||""),p=t.opts.$data&&a&&a.$data,d;p?(i+=" var schema"+o+" = "+t.util.getData(a.$data,s,t.dataPathArr)+"; ",d="schema"+o):d=a;var m="maxLength"==n?">":"<";i+="if ( ",p&&(i+=" ("+d+" !== undefined && typeof "+d+" != 'number') || "),!1===t.opts.unicode?i+=" "+f+".length ":i+=" ucs2length("+f+") ",i+=" "+m+" "+d+") { ";var h=n,g=g||[];g.push(i),i="",!1!==t.createErrors?(i+=" { keyword: '"+(h||"_limitLength")+"' , dataPath: (dataPath || '') + "+t.errorPath+" , schemaPath: "+t.util.toQuotedString(u)+" , params: { limit: "+d+" } ",!1!==t.opts.messages&&(i+=" , message: 'should NOT be ",i+="maxLength"==n?"longer":"shorter",i+=" than ",i+=p?"' + "+d+" + '":""+a,i+=" characters' "),t.opts.verbose&&(i+=" , schema: ",i+=p?"validate.schema"+l:""+a,i+=" , parentSchema: validate.schema"+t.schemaPath+" , data: "+f+" "),i+=" } "):i+=" {} ";var y=i;return i=g.pop(),!t.compositeRule&&c?t.async?i+=" throw new ValidationError(["+y+"]); ":i+=" validate.errors = ["+y+"]; return false; ":i+=" var err = "+y+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",i+="} ",c&&(i+=" else { "),i}},function(e,t,n){"use strict";e.exports=function e(t,n,r){var i=" ",o=t.level,s=t.dataLevel,a=t.schema[n],l=t.schemaPath+t.util.getProperty(n),u=t.errSchemaPath+"/"+n,c=!t.opts.allErrors,h,f="data"+(s||""),p=t.opts.$data&&a&&a.$data,d;p?(i+=" var schema"+o+" = "+t.util.getData(a.$data,s,t.dataPathArr)+"; ",d="schema"+o):d=a;var m="maxProperties"==n?">":"<";i+="if ( ",p&&(i+=" ("+d+" !== undefined && typeof "+d+" != 'number') || "),i+=" Object.keys("+f+").length "+m+" "+d+") { ";var h=n,g=g||[];g.push(i),i="",!1!==t.createErrors?(i+=" { keyword: '"+(h||"_limitProperties")+"' , dataPath: (dataPath || '') + "+t.errorPath+" , schemaPath: "+t.util.toQuotedString(u)+" , params: { limit: "+d+" } ",!1!==t.opts.messages&&(i+=" , message: 'should NOT have ",i+="maxProperties"==n?"more":"fewer",i+=" than ",i+=p?"' + "+d+" + '":""+a,i+=" properties' "),t.opts.verbose&&(i+=" , schema: ",i+=p?"validate.schema"+l:""+a,i+=" , parentSchema: validate.schema"+t.schemaPath+" , data: "+f+" "),i+=" } "):i+=" {} ";var y=i;return i=g.pop(),!t.compositeRule&&c?t.async?i+=" throw new ValidationError(["+y+"]); ":i+=" validate.errors = ["+y+"]; return false; ":i+=" var err = "+y+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",i+="} ",c&&(i+=" else { "),i}},function(e){e.exports={$schema:"http://json-schema.org/draft-07/schema#",$id:"http://json-schema.org/draft-07/schema#",title:"Core schema meta-schema",definitions:{schemaArray:{type:"array",minItems:1,items:{$ref:"#"}},nonNegativeInteger:{type:"integer",minimum:0},nonNegativeIntegerDefault0:{allOf:[{$ref:"#/definitions/nonNegativeInteger"},{default:0}]},simpleTypes:{enum:["array","boolean","integer","null","number","object","string"]},stringArray:{type:"array",items:{type:"string"},uniqueItems:!0,default:[]}},type:["object","boolean"],properties:{$id:{type:"string",format:"uri-reference"},$schema:{type:"string",format:"uri"},$ref:{type:"string",format:"uri-reference"},$comment:{type:"string"},title:{type:"string"},description:{type:"string"},default:!0,readOnly:{type:"boolean",default:!1},examples:{type:"array",items:!0},multipleOf:{type:"number",exclusiveMinimum:0},maximum:{type:"number"},exclusiveMaximum:{type:"number"},minimum:{type:"number"},exclusiveMinimum:{type:"number"},maxLength:{$ref:"#/definitions/nonNegativeInteger"},minLength:{$ref:"#/definitions/nonNegativeIntegerDefault0"},pattern:{type:"string",format:"regex"},additionalItems:{$ref:"#"},items:{anyOf:[{$ref:"#"},{$ref:"#/definitions/schemaArray"}],default:!0},maxItems:{$ref:"#/definitions/nonNegativeInteger"},minItems:{$ref:"#/definitions/nonNegativeIntegerDefault0"},uniqueItems:{type:"boolean",default:!1},contains:{$ref:"#"},maxProperties:{$ref:"#/definitions/nonNegativeInteger"},minProperties:{$ref:"#/definitions/nonNegativeIntegerDefault0"},required:{$ref:"#/definitions/stringArray"},additionalProperties:{$ref:"#"},definitions:{type:"object",additionalProperties:{$ref:"#"},default:{}},properties:{type:"object",additionalProperties:{$ref:"#"},default:{}},patternProperties:{type:"object",additionalProperties:{$ref:"#"},propertyNames:{format:"regex"},default:{}},dependencies:{type:"object",additionalProperties:{anyOf:[{$ref:"#"},{$ref:"#/definitions/stringArray"}]}},propertyNames:{$ref:"#"},const:!0,enum:{type:"array",items:!0,minItems:1,uniqueItems:!0},type:{anyOf:[{$ref:"#/definitions/simpleTypes"},{type:"array",items:{$ref:"#/definitions/simpleTypes"},minItems:1,uniqueItems:!0}]},format:{type:"string"},contentMediaType:{type:"string"},contentEncoding:{type:"string"},if:{$ref:"#"},then:{$ref:"#"},else:{$ref:"#"},allOf:{$ref:"#/definitions/schemaArray"},anyOf:{$ref:"#/definitions/schemaArray"},oneOf:{$ref:"#/definitions/schemaArray"},not:{$ref:"#"}},default:!0}},function(e,t,n){"use strict";function r(e,t,n){this.name="RequestError",this.message=String(e),this.cause=e,this.error=e,this.options=t,this.response=n,Error.captureStackTrace&&Error.captureStackTrace(this)}function i(e,t,n,r){this.name="StatusCodeError",this.statusCode=e,this.message=e+" - "+(JSON&&JSON.stringify?JSON.stringify(t):t),this.error=t,this.options=n,this.response=r,Error.captureStackTrace&&Error.captureStackTrace(this)}function o(e,t,n){this.name="TransformError",this.message=String(e),this.cause=e,this.error=e,this.options=t,this.response=n,Error.captureStackTrace&&Error.captureStackTrace(this)}r.prototype=Object.create(Error.prototype),r.prototype.constructor=r,i.prototype=Object.create(Error.prototype),i.prototype.constructor=i,o.prototype=Object.create(Error.prototype),o.prototype.constructor=o,e.exports={RequestError:r,StatusCodeError:i,TransformError:o}},function(e,t,n){"use strict"; -/*! - * Copyright (c) 2018, Salesforce.com, Inc. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * 3. Neither the name of Salesforce.com nor the names of its contributors may - * be used to endorse or promote products derived from this software without - * specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */var r=n(596);function i(e){return r.get(e)}t.getPublicSuffix=i},function(e,t,n){"use strict"; -/*! - * Copyright (c) 2015, Salesforce.com, Inc. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * 3. Neither the name of Salesforce.com nor the names of its contributors may - * be used to endorse or promote products derived from this software without - * specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */function r(){}t.Store=r,r.prototype.synchronous=!1,r.prototype.findCookie=function(e,t,n,r){throw new Error("findCookie is not implemented")},r.prototype.findCookies=function(e,t,n){throw new Error("findCookies is not implemented")},r.prototype.putCookie=function(e,t){throw new Error("putCookie is not implemented")},r.prototype.updateCookie=function(e,t,n){throw new Error("updateCookie is not implemented")},r.prototype.removeCookie=function(e,t,n,r){throw new Error("removeCookie is not implemented")},r.prototype.removeCookies=function(e,t,n){throw new Error("removeCookies is not implemented")},r.prototype.removeAllCookies=function(e){throw new Error("removeAllCookies is not implemented")},r.prototype.getAllCookies=function(e){throw new Error("getAllCookies is not implemented (therefore jar cannot be serialized)")}},function(e,t,n){"use strict"; -/*! - * Copyright (c) 2015, Salesforce.com, Inc. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * 3. Neither the name of Salesforce.com nor the names of its contributors may - * be used to endorse or promote products derived from this software without - * specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */var r=n(621);function i(e){var t=r.getPublicSuffix(e);if(!t)return null;if(t==e)return[e];for(var n=e.slice(0,-(t.length+1)),i=n.split(".").reverse(),o=t,s=[o];i.length;)o=i.shift()+"."+o,s.push(o);return s}t.permuteDomain=i},function(e,t,n){"use strict"; -/*! - * Copyright (c) 2015, Salesforce.com, Inc. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * 3. Neither the name of Salesforce.com nor the names of its contributors may - * be used to endorse or promote products derived from this software without - * specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */function r(e,t){if(t===e)return!0;var n=e.indexOf(t);if(0===n){if("/"===t.substr(-1))return!0;if("/"===e.substr(t.length,1))return!0}return!1}t.pathMatch=r},function(e,t,n){!function(){function t(){var e=function(t,n,r){if(t=""+t,r||s===n||(e.last=t=e.batch)return u.thrash();u.batch.to||(u.batch.to=setTimeout(u.thrash,e.until||1))},c,h,f,p,d;u.batch=s(),u.batch.acks=[],u.batch.ed=0,u.thrash=function(){var t=u.thrash;if(t.ing)return t.more=!0;t.more=!1,t.ing=!0;var n=t.at=u.batch,r=0;clearTimeout(u.batch.to),u.batch=null,u.batch=s(),u.batch.acks=[],u.batch.ed=0,u.save(n,function(i,o){++r>1?e.log("RAD ERR: Radisk has callbacked multiple times, please report this as a BUG at github.com/amark/gun/issues ! "+r):(i&&e.log("err",i),a(n.acks,function(e){e(i,o)}),t.at=null,t.ing=!1,t.more&&t())})},u.save=function(t,n){var r=function e(){};r.find=function(e,t){if(!(tr.start)return r.mix(r.file||e.code.from,r.start,r.end=t),!0;r.file=t},r.mix=function(e,i,o){r.start=r.end=r.file=y,u.parse(e,function(a,l){if(a)return n(a);l=l||s(),s.map(t,function(e,t){if(!(ti))return(r.next||r.reverse)&&(s.file=e),(i=c[s.file])?(i.push({key:t,ack:n,file:s.file,opt:r}),!0):(c[s.file]=[{key:t,ack:n,file:s.file,opt:r}],s.file?(u.parse(s.file,s.it),!0):(s.it(null,y,{}),!0));s.file=e},s.it=function(t,n,r){(s.err=t)&&e.log("err",t),s.info=r,n&&(g=s.disk=n),n=c[s.file],delete c[s.file],a(n,s.ack)},s.ack=function(e){if(e.ack){var t=e.key,n=e.opt,r=s.info,i=s.disk||m,o=u.range(i(t),n),a=i.last;if(n.parsed=(n.parsed||0)+(r.parsed||0),n.chunks=(n.chunks||0)+1,n.some||(n.some=y!==o),y!==o)e.ack(s.err,o,n);else if(!e.file)return void(!n.some&&e.ack(s.err,y,n));if(!n.span){if(/*!last || */a===t)return void(!n.some&&e.ack(s.err,y,n));if(a&&a>t&&0!=a.indexOf(t))return void(!n.some&&e.ack(s.err,y,n))}n.some&&n.parsed>=n.limit||(n.next=e.file,u.read(t,e.ack,n))}},r.reverse&&(s.lex.reverse=!0),u.list(s.lex)},function(){var n={},i=String.fromCharCode(31);u.parse=function(o,l,u){var c;if(c=n[o])return c.push(l);c=n[o]=[l];var h=function e(){},f={};if(h.disk=s(),h.read=function(t,r){var i,s,s;if(delete n[o],(h.err=t)||(h.not=!r))return a(c,h.ack);if("string"!=typeof r){try{e.pack<=r.length?h.err="Chunk too big!":r=r.toString()}catch(e){h.err=e}if(h.err)return a(c,h.ack)}if(f.parsed=r.length,e.jsonify){try{var l=JSON.parse(r);return h.disk.$=l,void a(c,h.ack)}catch(e){i=e}if("{"===r[0])return h.err=i||"JSON error!",a(c,h.ack)}var i=h.split(r),u=[],p,d,m;if(!i||0!==i[1])return h.err="File '"+o+"' does not have root radix! ",a(c,h.ack);for(;i;)d=m=y,p=i[1],i=h.split(i[2])||"","#"==i[0]&&(d=i[1],u=u.slice(0,p),p<=u.length&&u.push(d)),i=h.split(i[2])||"","\n"!=i[0]&&("="!=i[0]&&":"!=i[0]||(m=i[1]),y!==d&&y!==m&&h.disk(u.join(""),m),i=h.split(i[2]));a(c,h.ack)},h.split=function(e){if(e){var n=[],r={},o=-1,s="",a,l;if(o=e.indexOf(i),e[o])return s=e.slice(0,o),n[0]=s,n[1]=a=t.decode(e.slice(o),r),n[2]=e.slice(o+r.i),n}},h.ack=function(e){if(e)return h.err||h.not?e(h.err,y,f):void e(y,h.disk,f)},u)return h.read(null,u);e.store.get(r(o),h.read)}}(),p=String.fromCharCode(28),d=r(p),u.list=function(e){if(h){var t={reverse:e.reverse?1:0};s.map(h,function(t,n){return e(n)},t)||e()}else{if(f)return f.push(e);f=[e],u.parse(p,u.list.init)}},u.list.add=function(e,t){var n=h(e);if(n||e===d)return t(y,1);h(e,!0),t.listed=(t.listed||0)+1,u.write(p,h,function(e,n){if(e)return t(e);t.listed=(t.listed||0)-1,0===t.listed&&t(y,1)},!0)},u.list.init=function(t,n){if(t)return e.log("list",t),void setTimeout(function(){u.parse(p,u.list.init)},1e3);n?u.list.drain(n):e.store.list?e.store.list(function(e){if(h=h||s(),!e)return u.list.drain(h);u.list.add(e,m)}):u.list.drain(s())},u.list.drain=function(e,t){u.list.dir=h=e,t=f,f=null,o.list.map(t,function(e){u.list(e)})};var m=function(){},g,y;return t.has[e.file]=u,u}var r,i;if(r=String.fromCharCode(31),t.encode=function(e,t,n){n=n||r;var i=n,s;if("string"==typeof e){for(var a=e.indexOf(n);-1!=a;)i+=n,a=e.indexOf(n,a+1);return i+'"'+e+n}return e&&e["#"]&&(s=o.val.link.is(e))?i+"#"+s+i:o.num.is(e)?i+"+"+(e||0)+i:null===e?i+" "+i:!0===e?i+"+"+i:!1===e?i+"-"+i:void 0},t.decode=function(e,t,n){n=n||r;var i="",s=-1,a=0,l,u;if(n===e[0]){for(;n===e[++s];)++a;for(u=e[l=a]||!0;--a>=0;)s=e.indexOf(n,s+1);return-1==s&&(s=e.length),i=e.slice(l+1,s),t&&(t.i=s+1),'"'===u?i:"#"===u?o.val.link.ify(i):"+"===u?0===i.length||parseFloat(i):" "===u?null:"-"!==u&&void 0}},"undefined"!=typeof window){var o=window.Gun,s=window.Radix;window.Radisk=t}else{var o=n(142),s=n(625);try{e.exports=t}catch(e){}}t.Radix=s}()},function(e,t,n){const r=n(94);n(656),n(664),n(1470),n(1505),n(1608),n(1761),"undefined"!=typeof window&&(window.DwebTransports=r),t=e.exports=r},function(e,t,n){"use strict";e.exports={isString:function(e){return"string"==typeof e},isObject:function(e){return"object"==typeof e&&null!==e},isNull:function(e){return null===e},isNullOrUndefined:function(e){return null==e}}},function(e,t,n){"use strict";function r(e,t){return Object.prototype.hasOwnProperty.call(e,t)}e.exports=function(e,t,n,o){t=t||"&",n=n||"=";var s={};if("string"!=typeof e||0===e.length)return s;var a=/\+/g;e=e.split(t);var l=1e3;o&&"number"==typeof o.maxKeys&&(l=o.maxKeys);var u=e.length;l>0&&u>l&&(u=l);for(var c=0;c=0?(p=h.substr(0,f),d=h.substr(f+1)):(p=h,d=""),m=decodeURIComponent(p),g=decodeURIComponent(d),r(s,m)?i(s[m])?s[m].push(g):s[m]=[s[m],g]:s[m]=g}return s};var i=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)}},function(e,t,n){"use strict";var r=function(e){switch(typeof e){case"string":return e;case"boolean":return e?"true":"false";case"number":return isFinite(e)?e:"";default:return""}};e.exports=function(e,t,n,a){return t=t||"&",n=n||"=",null===e&&(e=void 0),"object"==typeof e?o(s(e),function(s){var a=encodeURIComponent(r(s))+n;return i(e[s])?o(e[s],function(e){return a+encodeURIComponent(r(e))}).join(t):a+encodeURIComponent(r(e[s]))}).join(t):a?encodeURIComponent(r(a))+n+encodeURIComponent(r(e)):""};var i=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)};function o(e,t){if(e.map)return e.map(t);for(var n=[],r=0;r{if("%%"===n)return n;a++;const o=r.formatters[i];if("function"==typeof o){const r=e[a];n=o.call(t,r),e.splice(a,1),a--}return n}),r.formatArgs.call(t,e);const l=t.log||r.log;l.apply(t,e)}return s.namespace=e,s.enabled=r.enabled(e),s.useColors=r.useColors(),s.color=t(e),s.destroy=i,s.extend=o,"function"==typeof r.init&&r.init(s),r.instances.push(s),s}function i(){const e=r.instances.indexOf(this);return-1!==e&&(r.instances.splice(e,1),!0)}function o(e,t){const n=r(this.namespace+(void 0===t?":":t)+e);return n.log=this.log,n}function s(e){let t;r.save(e),r.names=[],r.skips=[];const n=("string"==typeof e?e:"").split(/[\s,]+/),i=n.length;for(t=0;t"-"+e)].join(",");return r.enable(""),e}function l(e){if("*"===e[e.length-1])return!0;let t,n;for(t=0,n=r.skips.length;t{r[t]=e[t]}),r.instances=[],r.names=[],r.skips=[],r.formatters={},r.selectColor=t,r.enable(r.load()),r}e.exports=r},function(e,t,n){"use strict";t.byteLength=c,t.toByteArray=f,t.fromByteArray=m;for(var r=[],i=[],o="undefined"!=typeof Uint8Array?Uint8Array:Array,s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",a=0,l=s.length;a0)throw new Error("Invalid string. Length must be a multiple of 4");var n=e.indexOf("=");-1===n&&(n=t);var r=n===t?0:4-n%4;return[n,r]}function c(e){var t=u(e),n=t[0],r=t[1];return 3*(n+r)/4-r}function h(e,t,n){return 3*(t+n)/4-n}function f(e){for(var t,n=u(e),r=n[0],s=n[1],a=new o(h(e,r,s)),l=0,c=s>0?r-4:r,f=0;f>16&255,a[l++]=t>>8&255,a[l++]=255&t;return 2===s&&(t=i[e.charCodeAt(f)]<<2|i[e.charCodeAt(f+1)]>>4,a[l++]=255&t),1===s&&(t=i[e.charCodeAt(f)]<<10|i[e.charCodeAt(f+1)]<<4|i[e.charCodeAt(f+2)]>>2,a[l++]=t>>8&255,a[l++]=255&t),a}function p(e){return r[e>>18&63]+r[e>>12&63]+r[e>>6&63]+r[63&e]}function d(e,t,n){for(var r,i=[],o=t;ol?l:a+16383));return 1===i?(t=e[n-1],o.push(r[t>>2]+r[t<<4&63]+"==")):2===i&&(t=(e[n-2]<<8)+e[n-1],o.push(r[t>>10]+r[t>>4&63]+r[t<<2&63]+"=")),o.join("")}i["-".charCodeAt(0)]=62,i["_".charCodeAt(0)]=63},function(e,t){},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=v;var r=n(635),i=y(r),o=n(65),s=y(o),a=n(57),l=y(a),u=n(107),c=y(u),h=n(178),f=y(h),p=n(639),d=y(p),m=n(37),g=y(m);function y(e){return e&&e.__esModule?e:{default:e}}function v(e,t,n){if(null==t)t=1;else if(0===t)throw new Error("Concurrency must not be zero");var r=(0,g.default)(e),o=0,a=[],u=!1;function h(e,t,n){if(null!=n&&"function"!=typeof n)throw new Error("task callback must be a function");if(y.started=!0,(0,s.default)(e)||(e=[e]),0===e.length&&y.idle())return(0,f.default)(function(){y.drain()});for(var r=0,i=e.length;r0&&a.splice(l,1),s.callback.apply(s,arguments),null!=t&&y.error(t,s.data)}o<=y.concurrency-y.buffer&&y.unsaturated(),y.idle()&&y.drain(),y.process()}}var m=!1,y={_tasks:new d.default,concurrency:t,payload:n,saturated:l.default,unsaturated:l.default,buffer:t/4,empty:l.default,drain:l.default,error:l.default,started:!1,paused:!1,push:function(e,t){h(e,!1,t)},kill:function(){y.drain=l.default,y._tasks.empty()},unshift:function(e,t){h(e,!0,t)},remove:function(e){y._tasks.remove(e)},process:function(){if(!m){for(m=!0;!y.paused&&o{this.status=r.STATUS_STARTING,e&&e(this),this.updateStatus((n,r)=>{e&&e(this),this.startHeartbeat(this.options.heartbeat),t(this)})})}async p_status(e){if(!e)return new Promise((e,t)=>{try{this.updateStatus((n,r)=>{n?t(n):e(r)})}catch(e){t(e)}});try{this.updateStatus(e)}catch(t){e(t)}}updateStatus(e){this.updateInfo((t,n)=>{t?(l("Error status call to info failed %s",t.message),this.status=r.STATUS_FAILED,e(null,this.status)):(this.info=n,this.status=r.STATUS_CONNECTED,e(null,this.status))})}startHeartbeat({delay:e,statusCB:t}){e&&(l("HTTP Starting Heartbeat"),this.HTTPheartbeatTimer=setInterval(()=>{this.updateStatus((e,n)=>{t&&t(this)},(e,t)=>{})},e))}stopHeartbeat(){this.HTTPheartbeatTimer&&(l("HTTP stopping heartbeat"),clearInterval(this.HTTPheartbeatTimer))}stop(e,t){this.stopHeartbeat(),this.status=r.STATUS_FAILED,e&&e(this),t(null,this)}_cmdurl(e){return`${this.urlbase}/${e}`}_url(e,t,n){if(!e)throw new errors.CodingError(`${t}: requires url`);return"string"!=typeof e&&(e=e.href),e=e.replace("contenthash:/contenthash",this._cmdurl(t)),e=e.replace("getall/table",t),e+=n?"?"+n:"",e}validFor(e,t,n){return(this.connected()||e.protocol.startsWith("http")&&!e.href.startsWith(this.urlbase))&&this.supports(e,t,n)}async p_rawfetch(e,t={}){if(("string"==typeof e?e:e.href).includes("/getall/table"))throw new Error("Probably dont want to be calling p_rawfetch on a KeyValueTable, especially since dont know if its keyvaluetable or subclass");return await o.p_GET(this._url(e,servercommands.rawfetch),t)}p_rawlist(e){if(!e)throw new errors.CodingError("TransportHTTP.p_rawlist: requires url");return o.p_GET(this._url(e,servercommands.rawlist))}rawreverse(){throw new errors.ToBeImplementedError("Undefined function TransportHTTP.rawreverse")}async p_rawstore(e){console.assert(e,"TransportHttp.p_rawstore: requires data");const t=await o.p_POST(this._cmdurl(servercommands.rawstore),{data:e,contenttype:"application/octet-stream"});let n=s.parse(t),r=n.pathname.split("/");return`contenthash:/contenthash/${r.slice(-1)}`}p_rawadd(e,t){if(!e||!t)throw new errors.CodingError("TransportHTTP.p_rawadd: invalid parms",e,t);const n=u(t.preflight(Object.assign({},t)))+"\n";return o.p_POST(this._url(e,servercommands.rawadd),{data:n,contenttype:"application/json"})}p_newlisturls(e){let t=e._publicurls.map(e=>s.parse(e)).find(e=>"https:"===e.protocol&&["gateway.dweb.me","dweb.me"].includes(e.host)&&(e.pathname.includes("/content/rawfetch")||e.pathname.includes("/contenthash/"))||"contenthash:"===e.protocol&&"contenthash"===e.pathname.split("/")[1]);return t||(t=`contenthash:/contenthash/${e.keypair.verifyexportmultihashsha256_58()}`),[t,t]}async p_f_createReadStream(e,{wanturl:t=!1}={}){try{let n=this;return t?e:function(t){return n.createReadStream(e,t)}}catch(e){throw e}}createReadStream(e,t){let n;return l("createreadstream %s %o",s.parse(e).href,t),n=new a.PassThrough,o.p_GET(this._url(e,servercommands.rawfetch),Object.assign({wantstream:!0},t)).then(e=>e.pipe(n)).catch(e=>{console.warn(this.name,"createReadStream caught error",e.message),"function"==typeof n.destroy?n.destroy(e):n.emit("error",e)}),n}async p_createReadStream(e,t){l("createreadstream %s %o",s.parse(e).href,t);try{return await o.p_GET(this._url(e,servercommands.rawfetch),Object.assign({wantstream:!0},t))}catch(e){throw console.warn(this.name,"caught error",e),e}}async p_newdatabase(e){e.hasOwnProperty("keypair")&&(e=e.keypair.signingexport());let t=`${this.urlbase}/getall/table/${encodeURIComponent(e)}`;return{publicurl:t,privateurl:t}}async p_newtable(e,t){if(!e)throw new errors.CodingError("p_newtable currently requires a pubkey");let n=await this.p_newdatabase(e);return{privateurl:`${n.privateurl}/${t}`,publicurl:`${n.publicurl}/${t}`}}async p_set(e,t,n){if(!e||!t)throw new errors.CodingError("TransportHTTP.p_set: invalid parms",e,keyvalyes);if("string"==typeof t){let r=u([{key:t,value:n}]);await o.p_POST(this._url(e,servercommands.set),{data:r,contenttype:"application/json"})}else{let n=u(Object.keys(t).map(e=>({key:e,value:t[e]})));await o.p_POST(this._url(e,servercommands.set),{data:n,contenttype:"application/json"})}}_keyparm(e){return`key=${encodeURIComponent(e)}`}async p_get(e,t){if(!e&&t)throw new errors.CodingError("TransportHTTP.p_get: requires url and at least one key");let n=Array.isArray(t)?t.map(e=>this._keyparm(e)).join("&"):this._keyparm(t);const r=await o.p_GET(this._url(e,servercommands.get,n));return Array.isArray(t)?r:r[t]}async p_delete(e,t){if(!e&&t)throw new errors.CodingError("TransportHTTP.p_get: requires url and at least one key");let n=t.map(e=>this._keyparm(e)).join("&");await o.p_GET(this._url(e,servercommands.delete,n))}async p_keys(e){if(!e&&keys)throw new errors.CodingError("TransportHTTP.p_get: requires url and at least one key");return await o.p_GET(this._url(e,servercommands.keys))}async p_getall(e){if(!e&&keys)throw new errors.CodingError("TransportHTTP.p_get: requires url and at least one key");return await o.p_GET(this._url(e,servercommands.getall))}async p_info(){return new Promise((e,t)=>{try{this.updateInfo((n,r)=>{n?t(n):e(r)})}catch(e){t(e)}})}updateInfo(e){o.p_GET(`${this.urlbase}/info`,{retries:1},e)}static async p_test(e={}){console.log("TransportHTTP.test");try{let t=await this.p_setup(e);console.log("HTTP connected");let n=await t.p_info();console.log("TransportHTTP info=",n),n=await t.p_status(),console.assert(n===r.STATUS_CONNECTED),await t.p_test_kvt("NACL%20VERIFY")}catch(e){throw console.log("Exception thrown in TransportHTTP.test:",e.message),e}}static async test(){return this}}i._transportclasses.HTTP=c,t=e.exports=c},function(e,t){},function(e,t,n){"use strict";function r(e){for(var t=1;t0?this.tail.next=n:this.head=n,this.tail=n,++this.length},t.unshift=function e(t){var n={data:t,next:this.head};0===this.length&&(this.tail=n),this.head=n,++this.length},t.shift=function e(){if(0!==this.length){var t=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,t}},t.clear=function e(){this.head=this.tail=null,this.length=0},t.join=function e(t){if(0===this.length)return"";for(var n=this.head,r=""+n.data;n=n.next;)r+=t+n.data;return r},t.concat=function e(t){if(0===this.length)return s.alloc(0);for(var n=s.allocUnsafe(t>>>0),r=this.head,i=0;r;)c(r.data,n,i),i+=r.data.length,r=r.next;return n},t.consume=function e(t,n){var r;return to.length?o.length:t;if(s===o.length?i+=o:i+=o.slice(0,t),t-=s,0===t){s===o.length?(++r,n.next?this.head=n.next:this.head=this.tail=null):(this.head=n,n.data=o.slice(s));break}++r}return this.length-=r,i},t._getBuffer=function e(t){var n=s.allocUnsafe(t),r=this.head,i=1;for(r.data.copy(n),t-=r.data.length;r=r.next;){var o=r.data,a=t>o.length?o.length:t;if(o.copy(n,n.length-t,0,a),t-=a,0===t){a===o.length?(++i,r.next?this.head=r.next:this.head=this.tail=null):(this.head=r,r.data=o.slice(a));break}++i}return this.length-=i,n},t[u]=function(e,t){return l(this,r({},t,{depth:0,customInspect:!1}))},e}()},function(e,t){},function(e,t,n){"use strict";(function(t){var n=new Set;function r(e){if(!n.has(e)){var r=e+" is an experimental feature. This feature could change at any time";n.add(e),t.emitWarning(r,"ExperimentalWarning")}}function i(){}e.exports.emitExperimentalWarning=t.emitWarning?r:i}).call(this,n(2))},function(e,t,n){"use strict";(function(t){var r;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}var o=n(243),s=Symbol("lastResolve"),a=Symbol("lastReject"),l=Symbol("error"),u=Symbol("ended"),c=Symbol("lastPromise"),h=Symbol("handlePromise"),f=Symbol("stream");function p(e,t){return{value:e,done:t}}function d(e){var t=e[s];if(null!==t){var n=e[f].read();null!==n&&(e[c]=null,e[s]=null,e[a]=null,t(p(n,!1)))}}function m(e){t.nextTick(d,e)}function g(e,t){return function(n,r){e.then(function(){t[u]?n(p(void 0,!0)):t[h](n,r)},r)}}var y=Object.getPrototypeOf(function(){}),v=Object.setPrototypeOf((r={get stream(){return this[f]},next:function e(){var n=this,r=this[l];if(null!==r)return Promise.reject(r);if(this[u])return Promise.resolve(p(void 0,!0));if(this[f].destroyed)return new Promise(function(e,r){t.nextTick(function(){n[l]?r(n[l]):e(p(void 0,!0))})});var i=this[c],o;if(i)o=new Promise(g(i,this));else{var s=this[f].read();if(null!==s)return Promise.resolve(p(s,!1));o=new Promise(this[h])}return this[c]=o,o}},i(r,Symbol.asyncIterator,function(){return this}),i(r,"return",function e(){var t=this;return new Promise(function(e,n){t[f].destroy(null,function(t){t?n(t):e(p(void 0,!0))})})}),r),y),b=function e(t){var n,r=Object.create(v,(n={},i(n,f,{value:t,writable:!0}),i(n,s,{value:null,writable:!0}),i(n,a,{value:null,writable:!0}),i(n,l,{value:null,writable:!0}),i(n,u,{value:t._readableState.endEmitted,writable:!0}),i(n,h,{value:function e(t,n){var i=r[f].read();i?(r[c]=null,r[s]=null,r[a]=null,t(p(i,!1))):(r[s]=t,r[a]=n)},writable:!0}),n));return r[c]=null,o(t,function(e){if(e&&"ERR_STREAM_PREMATURE_CLOSE"!==e.code){var t=r[a];return null!==t&&(r[c]=null,r[s]=null,r[a]=null,t(e)),void(r[l]=e)}var n=r[s];null!==n&&(r[c]=null,r[s]=null,r[a]=null,n(p(void 0,!0))),r[u]=!0}),t.on("readable",m.bind(null,r)),r};e.exports=b}).call(this,n(2))},function(e,t,n){"use strict";e.exports=i;var r=n(338);function i(e){if(!(this instanceof i))return new i(e);r.call(this,e)}n(3)(i,r),i.prototype._transform=function(e,t,n){n(null,e)}},function(e,t,n){"use strict";var r;function i(e){var t=!1;return function(){t||(t=!0,e.apply(void 0,arguments))}}var o=n(112).codes,s=o.ERR_MISSING_ARGS,a=o.ERR_STREAM_DESTROYED;function l(e){if(e)throw e}function u(e){return e.setHeader&&"function"==typeof e.abort}function c(e,t,o,s){s=i(s);var l=!1;e.on("close",function(){l=!0}),void 0===r&&(r=n(243)),r(e,{readable:t,writable:o},function(e){if(e)return s(e);l=!0,s()});var c=!1;return function(t){if(!l&&!c)return c=!0,u(e)?e.abort():"function"==typeof e.destroy?e.destroy():void s(t||new a("pipe"))}}function h(e){e()}function f(e,t){return e.pipe(t)}function p(e){return e.length?"function"!=typeof e[e.length-1]?l:e.pop():l}function d(){for(var e=arguments.length,t=new Array(e),n=0;n0;return c(e,s,a,function(e){i||(i=e),e&&o.forEach(h),s||(o.forEach(h),r(i))})});return t.reduce(f)}e.exports=d},function(e,t,n){(function(r,i){const o=n(238),s=n(4)("dweb-transports:ipfs"),a=n(665),l=n(1250),u=n(9),c=n(45),h=n(32),f=n(16),p=n(77),d=n(111),m=n(94),g=n(144),y={repo:"/tmp/dweb_ipfsv3107",config:{Bootstrap:["/dns4/dweb.me/tcp/4245/wss/ipfs/QmQz3p44VVQDeAieaW28DMjcTVzLbpxqaQB9bkXnyd7HY5"]},EXPERIMENTAL:{pubsub:!0},preload:{enabled:!1}};class v extends d{constructor(e){super(e),["urlUrlstore","httpIPFSgateway"].forEach(t=>{this[t]=e[t],delete e[t]}),this.ipfs=void 0,this.options=e,this.name="IPFS",this.supportURLs=["ipfs"],this.supportFunctions=["fetch","store","seed","createReadStream"],this.supportFeatures=["noCache"],this.status=d.STATUS_LOADED}_ipfsversion(e,t,n){e.version((r,i)=>{r?(s("IPFS via %s present but unresponsive: %o",t,i),this.ipfstype="FAILED",n(r)):(s("IPFS available via %s: %o",t,i),this.ipfstype=t,n(null,e))})}IPFSAutoConnect(e){if(r.ipfs)this._ipfsversion(r.ipfs,"global.ipfs",e);else if("undefined"!=typeof window&&window.ipfs)this._ipfsversion(window.ipfs,"window.ipfs",e);else{var t=l("localhost","5001",{protocol:"http"});t.version((n,r)=>{n?(s("IPFS via API failed %s, trying running own IPFS client",n.message),t=new a(this.options),t.on("ready",()=>{this._ipfsversion(t,"client",e)}),t.on("error",t=>{s("IPFS via client error %s",t.message),e(t)})):this._ipfsversion(t,"API",e)})}}static setup0(e){const t=d.mergeoptions(y,e.ipfs);s("setup options=%o",t);const n=new v(t);return m.addtransport(n),n}p_setup1(e,t){if(!t)return new Promise((e,t)=>{try{n.call(this,(n,r)=>{n?t(n):e(r)})}catch(e){t(e)}});try{n.call(this,t)}catch(e){t(e)}function n(t){this.status=d.STATUS_STARTING,e&&e(this),this.IPFSAutoConnect((n,r)=>{n?(s("Failed to connect %s",n.message),this.status=d.STATUS_FAILED):(this.ipfs=r,this.status=d.STATUS_CONNECTED),e&&e(this),t(null,this)})}}p_setup2(e){return this.status===d.STATUS_FAILED&&s("Stage 1 failed, skipping"),this}stop(e,t){"client"===this.ipfstype?this.ipfs.stop((n,r)=>{this.status=d.STATUS_FAILED,e&&e(this),t(n,r)}):(this.status=d.STATUS_FAILED,e&&e(this),t(miull,this))}async p_status(){return this.status=await this.ipfs.isOnline()?d.STATUS_CONNECTED:d.STATUS_FAILED,super.p_status()}static urlFrom(e){if(e instanceof u)return"ipfs:/ipfs/"+e.toBaseEncodedString();if("object"==typeof e&&e.hash)return"ipfs:/ipfs/"+e.hash;if("string"==typeof e)return"ipfs:/ipfs/"+e;throw new p.CodingError("TransportIPFS.urlFrom: Cant convert to url from",e)}static cidFrom(e){if(e instanceof u)return e;if("string"==typeof e&&(e=h.parse(e)),e&&e.pathname){const t=e.pathname.split("/");if(!["ipfs:","dweb:"].includes(e.protocol)||"ipfs"!==t[1]||t.length<3)throw new p.TransportError("TransportIPFS.cidFrom bad format for url should be dweb: or ipfs:/ipfs/...: "+e.href);if(t.length>3)throw new p.TransportError("TransportIPFS.cidFrom not supporting paths in url yet, should be dweb: or ipfs:/ipfs/...: "+e.href);return new u(t[2])}throw new p.CodingError("TransportIPFS.cidFrom: Cant convert url",e)}static _stringFrom(e){return e instanceof u?"/ipfs/"+e.toBaseEncodedString():"object"==typeof e&&e.path?e.path:void 0}static ipfsFrom(e){if(e=this._stringFrom(e),e.indexOf("/ipfs/")>-1)return e.slice(e.indexOf("/ipfs/"));throw new p.CodingError(`TransportIPFS.ipfsFrom: Cant convert url ${e} into a path starting /ipfs/`)}ipfsGatewayFrom(e){if(e=this._stringFrom(e),e.indexOf("/ipfs/")>-1)return this.httpIPFSgateway+e.slice(e.indexOf("/ipfs/"));throw new p.CodingError(`TransportIPFS.ipfsGatewayFrom: Cant convert url ${e} into a path starting /ipfs/`)}static multihashFrom(e){if(e instanceof u)return e.toBaseEncodedString();if("object"==typeof e&&e.path&&(e=e.path),"string"==typeof e){const t=e.indexOf("/ipfs/");if(t>-1)return e.slice(t+6)}throw new p.CodingError(`Cant turn ${e} into a multihash`)}async p_rawfetch(e,{timeoutMS:t=6e4,relay:n=!1}={}){if(!e)throw new p.CodingError("TransportIPFS.p_rawfetch: requires url");const r=v.cidFrom(e),i=v.ipfsFrom(e);try{const n=await g.p_timeout(this.ipfs.dag.get(r),t,"Timed out IPFS fetch of "+v._stringFrom(r));if(n.remainderPath.length)throw new p.TransportError("Not yet supporting paths in p_rawfetch");let a;return"DAGNode"===n.value.constructor.name?a=await this.ipfs.cat(i):(s("Found a raw IPFS block (unusual) - not a DAGNode - handling as such"),a=n.value),a}catch(n){if(s("Caught error '%s' fetching via IPFS",n.message),!this.httpIPFSgateway)throw n;try{s("Trying IPFS HTTP gateway");let n=this.ipfsGatewayFrom(e);return await g.p_timeout(o.p_GET(n),t,"Timed out IPFS fetch of "+n)}catch(e){throw e}}}async p_rawstore(e){console.assert(e,"TransportIPFS.p_rawstore: requires data");const t=e instanceof i?e:new i(e),n=(await this.ipfs.add(t,{"cid-version":1,hashAlg:"sha2-256"}))[0];return v.urlFrom(n)}seed({directoryPath:e,fileRelativePath:t,ipfsHash:n,urlToFile:r},i){if(this.urlUrlstore&&r){const e=`${this.urlUrlstore}?arg=${encodeURIComponent(r)}`;o.p_GET(e,{retries:0},(e,t)=>{e?(s("IPFS.seed for %s failed in http: %s",r,e.message),i(e)):(s("Added %s to IPFS key=",r,t.Key),n&&n!==t.Key&&s("ipfs hash doesnt match expected metadata has %s daemon returned %s",n,t.Key),i(null,t))})}else s("IPFS.seed support requires urlUrlstore and urlToFile"),i(new Error("IPFS.seed support requires urlUrlstore and urlToFile"))}async p_f_createReadStream(e,{wanturl:t=!1}={}){let n;try{let r=e.pathname.split("/ipfs/")[1];if(r.includes("/"))throw new CodingError("Should not be seeing URLS with a path here:"+e);let i=this;return t?e:function e(t){s("reading from stream %o %o",r,t||"");const o=t?t.start:0,a=t&&t.end?o+t.end+1:void 0;return n&&n.destroy&&n.destroy(),n=i.ipfs.catReadableStream(r,{offset:o,length:a&&a-o}),n.on("error",e=>console.error(e)),n}}catch(e){throw n&&n.destroy&&n.destroy(),e}}static async p_test(e){console.log("TransportIPFS.test");try{const t=await this.p_setup(e);console.log(t.name,"setup");const n=await t.p_status();let r;console.assert(n===d.STATUS_CONNECTED);const i="The quick brown fox",o="ipfs:/ipfs/zdpuAscRnisRkYnEyJAp1LydQ3po25rCEDPPEDMymYRfN1yPK",s="1114",a=await t.p_rawstore(i);console.log("rawstore returned",a);const l=v.cidFrom(a);console.assert(a===o,"url should match url from rawstore");const u=a.split("/")[2],c=v.urlFrom(l);console.assert(a===c,"Should round trip"),r=a;const h=await t.p_rawfetch(r);return console.assert(h.toString()===i,"Should fetch block stored above"),t}catch(e){throw console.log("Exception thrown in TransportIPFS.test:",e.message),e}}}m._transportclasses.IPFS=v,t=e.exports=v}).call(this,n(7),n(0).Buffer)},function(e,t,n){"use strict";(function(t){const r=n(666),i=n(667),o=n(15),s=n(31),a=n(49),l=n(198),u=n(21),c=n(27),h=n(398),f=n(60),p=n(115),d=n(54),m=n(9),g=n(4),y=n(89),v=n(6),b=n(816),_=n(817),w=n(858),k=n(1242),E=n(1243),S=n(1247),x=n(1248);class C extends v{constructor(e){super();const t={init:!0,start:!0,EXPERIMENTAL:{},preload:{enabled:!0,addresses:["/dnsaddr/node0.preload.ipfs.io/https","/dnsaddr/node1.preload.ipfs.io/https"]}};e=b.validate(e||{}),this._options=y(t,e),!1===e.init&&(this._options.init=!1),!1!==e.start&&(this._options.start=!0),"string"==typeof e.repo||void 0===e.repo?this._repo=k(e.repo):this._repo=e.repo,this.log=g("ipfs"),this.log.err=g("ipfs:err"),this._peerInfoBook=new h,this._peerInfo=void 0,this._bitswap=void 0,this._blockService=new r(this._repo),this._ipld=new i(x(this._blockService,this._options.ipld,this.log)),this._preload=E(this),this._mfsPreload=S(this),this._ipns=void 0,this._print=this._options.silent?this.log:console.log,this.init=w.init(this),this.preStart=w.preStart(this),this.start=w.start(this),this.stop=w.stop(this),this.shutdown=this.stop,this.isOnline=w.isOnline(this),Object.assign(this,w.filesRegular(this)),this.version=w.version(this),this.id=w.id(this),this.repo=w.repo(this),this.bootstrap=w.bootstrap(this),this.config=w.config(this),this.block=w.block(this),this.object=w.object(this),this.dag=w.dag(this),this.files=w.filesMFS(this),this.libp2p=null,this.swarm=w.swarm(this),this.name=w.name(this),this.bitswap=w.bitswap(this),this.pin=w.pin(this),this.ping=w.ping(this),this.pingPullStream=w.pingPullStream(this),this.pingReadableStream=w.pingReadableStream(this),this.pubsub=w.pubsub(this),this.dht=w.dht(this),this.dns=w.dns(this),this.key=w.key(this),this.stats=w.stats(this),this.resolve=w.resolve(this),this._options.EXPERIMENTAL.pubsub&&this.log("EXPERIMENTAL pubsub is enabled"),this._options.EXPERIMENTAL.ipnsPubsub&&(this._options.EXPERIMENTAL.pubsub||(this.log("EXPERIMENTAL pubsub is enabled to use IPNS pubsub"),this._options.EXPERIMENTAL.pubsub=!0),this.log("EXPERIMENTAL IPNS pubsub is enabled")),this._options.EXPERIMENTAL.sharding&&this.log("EXPERIMENTAL sharding is enabled"),this.state=n(1249)(this),_(this)}}e.exports=C;const A=t;Object.assign(e.exports,{crypto:a,isIPFS:l,Buffer:A,CID:m,multiaddr:u,multibase:f,multihash:c,multihashing:d,multicodec:p,PeerId:o,PeerInfo:s}),e.exports.createNode=(e=>new C(e))}).call(this,n(0).Buffer)},function(e,t,n){"use strict";const r=n(58);class i{constructor(e){this._repo=e,this._bitswap=null}setExchange(e){this._bitswap=e}unsetExchange(){this._bitswap=null}hasExchange(){return null!=this._bitswap}put(e,t){this.hasExchange()?this._bitswap.put(e,t):this._repo.blocks.put(e,t)}putMany(e,t){this.hasExchange()?this._bitswap.putMany(e,t):this._repo.blocks.putMany(e,t)}get(e,t){this.hasExchange()?this._bitswap.get(e,t):this._repo.blocks.get(e,t)}getMany(e,t){Array.isArray(e)?this.hasExchange()?this._bitswap.getMany(e,t):r(e,(e,t)=>this._repo.blocks.get(e,t),t):t(new Error("first arg must be an array of cids"))}delete(e,t){this._repo.blocks.delete(e,t)}}e.exports=i},function(e,t,n){"use strict";const r=n(114),i=n(18),o=n(9),s=n(345),a=n(52).join,l=n(52).sep,u=n(61).source,c=n(348),h=n(58),f=n(10),p=n(89),d=n(187),m=n(34),g=n(365);function y(){}class v{constructor(e){const t=p(v.defaultOptions,e);if(!t.blockService)throw new Error("Missing blockservice");this.bs=t.blockService,this.resolvers={},this.support={},this.support.add=((e,t,n)=>{if(this.resolvers[e])throw new Error('Resolver already exists for codec "'+e+'"');this.resolvers[e]={resolver:t,util:n}}),this.support.load=t.loadFormat||((e,t)=>{t(new Error(`No resolver found for codec "${e}"`))}),this.support.rm=(e=>{this.resolvers[e]&&delete this.resolvers[e]});for(const e of t.formats){const{resolver:t,util:n}=e,r=t.multicodec;this.support.add(r,t,n)}}get(e,t,n,r){if("function"==typeof t&&(r=t,t=void 0),"function"==typeof n&&(r=n,n={}),"string"==typeof t&&(t=a("/",t).substr(1).split(l).join("/")),""===t||!t)return this._get(e,(t,n)=>{if(t)return r(t);r(null,{value:n,remainderPath:"",cid:e})});let i;s(n=>{this._getFormat(e.codec,(r,o)=>{if(r)return n(r);this.bs.get(e,(e,r)=>{if(e)return n(e);o.resolver.resolve(r.data,t,(e,r)=>{if(e)return n(e);i=r.value,t=r.remainderPath,n()})})})},()=>{const r=!t||""===t||"/"===t,o=i&&!v._maybeCID(i);return r&&o||n.localResolve?(e=v._maybeCID(i)||e,!0):(i=v._maybeCID(i),i&&(e=i),!1)},(n,o)=>n?r(n):r(null,{value:i,remainderPath:t,cid:e}))}getStream(e,t,n){const r=u();return this.get(e,t,n,(e,t)=>{if(e)return r.resolve(i.error(e));r.resolve(i.values([t]))}),r}getMany(e,t){if(!Array.isArray(e))return t(new Error("Argument must be an array of CIDs"));this.bs.getMany(e,(e,n)=>{if(e)return t(e);h(n,(e,t)=>{this._getFormat(e.cid.codec,(n,r)=>{if(n)return t(n);r.util.deserialize(e.data,t)})},t)})}put(e,t,n){return"function"==typeof t?(n=t,setImmediate(()=>n(new Error("IPLDResolver.put requires options")))):(n=n||y,t.cid&&o.isCID(t.cid)?t.onlyHash?setImmediate(()=>n(null,t.cid)):this._put(t.cid,e,n):void this._getFormat(t.format,(r,i)=>{if(r)return n(r);i.util.cid(e,t,(r,i)=>r?n(r):t.onlyHash?n(null,i):void this._put(i,e,n))}))}treeStream(e,t,n){let r;return"object"==typeof t&&(n=t,t=void 0),n=n||{},n.recursive||(r=u(),f([t=>this._getFormat(e.codec,t),(t,n)=>this.bs.get(e,(e,r)=>{if(e)return n(e);n(null,t,r)}),(e,t,n)=>e.resolver.tree(t.data,n)],(e,t)=>{if(e)return r.abort(e),r;r.resolve(i.values(t))})),n.recursive&&(r=i(c.widthFirst({basePath:null,cid:e},e=>{if("string"==typeof e)return i.empty();const t=u(),n=e.cid;return f([e=>this._getFormat(n.codec,e),(e,t)=>this.bs.get(n,(n,r)=>{if(n)return t(n);t(null,e,r)}),(e,t,n)=>e.resolver.tree(t.data,(r,i)=>{if(r)return n(r);h(i,(n,r)=>{e.resolver.isLink(t.data,n,(e,t)=>{if(e)return r(e);r(null,{path:n,link:t})})},n)})],(n,r)=>{if(n)return t.abort(n),t;t.resolve(i.values(r.map(t=>{const n=e.basePath?e.basePath+"/"+t.path:t.path;return t.link?{basePath:n,cid:v._maybeCID(t.link)}:n})))}),t}),i.map(e=>"string"==typeof e?e:e.basePath),i.filter(Boolean))),t?i(r,i.map(e=>{if(0===e.indexOf(t))return e=e.slice(t.length+1),e}),i.filter(Boolean)):r}remove(e,t){this.bs.delete(e,t)}_get(e,t){f([t=>this._getFormat(e.codec,t),(t,n)=>this.bs.get(e,(e,r)=>{if(e)return n(e);n(null,t,r)}),(e,t,n)=>{e.util.deserialize(t.data,(e,t)=>{if(e)return n(e);n(null,t)})}],t)}_getFormat(e,t){if(this.resolvers[e])return t(null,this.resolvers[e]);this.support.load(e,(n,r)=>{if(n)return t(n);this.resolvers[e]=r,t(null,r)})}_put(e,t,n){n=n||y,f([t=>this._getFormat(e.codec,t),(e,n)=>e.util.serialize(t,n),(t,n)=>this.bs.put(new r(t,e),n)],t=>{if(t)return n(t);n(null,e)})}static _maybeCID(e){return o.isCID(e)?e:e&&void 0!==e["/"]?new o(e["/"]):null}}v.defaultOptions={formats:[d,m,g]},e.exports=v},function(e,t,n){"use strict";(function(t){const r=n(27),i=n(60),o=n(115),s=n(95),a=n(683),l=n(39);class u{constructor(e,n,s,a){if(c.isCID(e)){const n=e;return this.version=n.version,this.codec=n.codec,this.multihash=t.from(n.multihash),void(this.multibaseName=n.multibaseName||(0===n.version?"base58btc":"base32"))}if("string"==typeof e){const t=i.isEncoded(e);if(t){const n=i.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=r.fromB58String(e),this.multibaseName="base58btc";return u.validateCID(this),void Object.defineProperty(this,"string",{value:e})}if(t.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";u.validateCID(this)}else this.version=e,this.codec=n,this.multihash=s,this.multibaseName=a||(0===e?"base58btc":"base32"),u.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=t.concat([t.from("01","hex"),o.getCodeVarint(this.codec),this.multihash])}Object.defineProperty(this,"_buffer",{value:e})}return e}get prefix(){return t.concat([t.from(`0${this.version}`,"hex"),o.getCodeVarint(this.codec),r.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}=r.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 c(0,this.codec,this.multihash)}toV1(){return new c(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=r.toB58String(this.multihash)}else{if(1!==this.version)throw new Error("unsupported version");t=i.encode(e,this.buffer).toString()}return e===this.multibaseName&&Object.defineProperty(this,"string",{value:t}),t}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){let t=a.checkCIDComponents(e);if(t)throw new Error(t)}}const c=l(u,{className:"CID",symbolName:"@ipld/js-cid/CID"});c.codecs=s,e.exports=c}).call(this,n(0).Buffer)},function(e,t,n){const r=n(5).Buffer;e.exports=function e(t){if(t.length>=255)throw new TypeError("Alphabet too long");const n=new Uint8Array(256);n.fill(255);for(let e=0;e>>0,h=new Uint8Array(c);for(;l!==u;){let t=e[l],n=0;for(let e=c-1;(0!==t||n>>0,h[e]=t%i>>>0,t=t/i>>>0;if(0!==t)throw new Error("Non-zero carry");s=n,l++}let f=c-s;for(;f!==c&&0===h[f];)f++;let p=o.repeat(n);for(;f>>0,c=new Uint8Array(u);for(;e[t];){let r=n[e.charCodeAt(t)];if(255===r)return;let o=0;for(let e=u-1;(0!==r||o>>0,c[e]=r%256>>>0,r=r/256>>>0;if(0!==r)throw new Error("Non-zero carry");l=o,t++}if(" "===e[t])return;let h=u-l;for(;h!==u&&0===c[h];)h++;const f=r.allocUnsafe(a+(u-h));f.fill(0,0,a);let p=a;for(;h!==u;)f[p++]=c[h++];return f}function c(e){const t=u(e);if(t)return t;throw new Error("Non-base"+i+" character")}return{encode:l,decodeUnsafe:u,decode:c}}},function(e,t,n){"use strict";t.names=Object.freeze({id:0,sha1:17,"sha2-256":18,"sha2-512":19,"dbl-sha2-256":86,"sha3-224":23,"sha3-256":22,"sha3-384":21,"sha3-512":20,"shake-128":24,"shake-256":25,"keccak-224":26,"keccak-256":27,"keccak-384":28,"keccak-512":29,"murmur3-128":34,"murmur3-32":35,"blake2b-8":45569,"blake2b-16":45570,"blake2b-24":45571,"blake2b-32":45572,"blake2b-40":45573,"blake2b-48":45574,"blake2b-56":45575,"blake2b-64":45576,"blake2b-72":45577,"blake2b-80":45578,"blake2b-88":45579,"blake2b-96":45580,"blake2b-104":45581,"blake2b-112":45582,"blake2b-120":45583,"blake2b-128":45584,"blake2b-136":45585,"blake2b-144":45586,"blake2b-152":45587,"blake2b-160":45588,"blake2b-168":45589,"blake2b-176":45590,"blake2b-184":45591,"blake2b-192":45592,"blake2b-200":45593,"blake2b-208":45594,"blake2b-216":45595,"blake2b-224":45596,"blake2b-232":45597,"blake2b-240":45598,"blake2b-248":45599,"blake2b-256":45600,"blake2b-264":45601,"blake2b-272":45602,"blake2b-280":45603,"blake2b-288":45604,"blake2b-296":45605,"blake2b-304":45606,"blake2b-312":45607,"blake2b-320":45608,"blake2b-328":45609,"blake2b-336":45610,"blake2b-344":45611,"blake2b-352":45612,"blake2b-360":45613,"blake2b-368":45614,"blake2b-376":45615,"blake2b-384":45616,"blake2b-392":45617,"blake2b-400":45618,"blake2b-408":45619,"blake2b-416":45620,"blake2b-424":45621,"blake2b-432":45622,"blake2b-440":45623,"blake2b-448":45624,"blake2b-456":45625,"blake2b-464":45626,"blake2b-472":45627,"blake2b-480":45628,"blake2b-488":45629,"blake2b-496":45630,"blake2b-504":45631,"blake2b-512":45632,"blake2s-8":45633,"blake2s-16":45634,"blake2s-24":45635,"blake2s-32":45636,"blake2s-40":45637,"blake2s-48":45638,"blake2s-56":45639,"blake2s-64":45640,"blake2s-72":45641,"blake2s-80":45642,"blake2s-88":45643,"blake2s-96":45644,"blake2s-104":45645,"blake2s-112":45646,"blake2s-120":45647,"blake2s-128":45648,"blake2s-136":45649,"blake2s-144":45650,"blake2s-152":45651,"blake2s-160":45652,"blake2s-168":45653,"blake2s-176":45654,"blake2s-184":45655,"blake2s-192":45656,"blake2s-200":45657,"blake2s-208":45658,"blake2s-216":45659,"blake2s-224":45660,"blake2s-232":45661,"blake2s-240":45662,"blake2s-248":45663,"blake2s-256":45664,"Skein256-8":45825,"Skein256-16":45826,"Skein256-24":45827,"Skein256-32":45828,"Skein256-40":45829,"Skein256-48":45830,"Skein256-56":45831,"Skein256-64":45832,"Skein256-72":45833,"Skein256-80":45834,"Skein256-88":45835,"Skein256-96":45836,"Skein256-104":45837,"Skein256-112":45838,"Skein256-120":45839,"Skein256-128":45840,"Skein256-136":45841,"Skein256-144":45842,"Skein256-152":45843,"Skein256-160":45844,"Skein256-168":45845,"Skein256-176":45846,"Skein256-184":45847,"Skein256-192":45848,"Skein256-200":45849,"Skein256-208":45850,"Skein256-216":45851,"Skein256-224":45852,"Skein256-232":45853,"Skein256-240":45854,"Skein256-248":45855,"Skein256-256":45856,"Skein512-8":45857,"Skein512-16":45858,"Skein512-24":45859,"Skein512-32":45860,"Skein512-40":45861,"Skein512-48":45862,"Skein512-56":45863,"Skein512-64":45864,"Skein512-72":45865,"Skein512-80":45866,"Skein512-88":45867,"Skein512-96":45868,"Skein512-104":45869,"Skein512-112":45870,"Skein512-120":45871,"Skein512-128":45872,"Skein512-136":45873,"Skein512-144":45874,"Skein512-152":45875,"Skein512-160":45876,"Skein512-168":45877,"Skein512-176":45878,"Skein512-184":45879,"Skein512-192":45880,"Skein512-200":45881,"Skein512-208":45882,"Skein512-216":45883,"Skein512-224":45884,"Skein512-232":45885,"Skein512-240":45886,"Skein512-248":45887,"Skein512-256":45888,"Skein512-264":45889,"Skein512-272":45890,"Skein512-280":45891,"Skein512-288":45892,"Skein512-296":45893,"Skein512-304":45894,"Skein512-312":45895,"Skein512-320":45896,"Skein512-328":45897,"Skein512-336":45898,"Skein512-344":45899,"Skein512-352":45900,"Skein512-360":45901,"Skein512-368":45902,"Skein512-376":45903,"Skein512-384":45904,"Skein512-392":45905,"Skein512-400":45906,"Skein512-408":45907,"Skein512-416":45908,"Skein512-424":45909,"Skein512-432":45910,"Skein512-440":45911,"Skein512-448":45912,"Skein512-456":45913,"Skein512-464":45914,"Skein512-472":45915,"Skein512-480":45916,"Skein512-488":45917,"Skein512-496":45918,"Skein512-504":45919,"Skein512-512":45920,"Skein1024-8":45921,"Skein1024-16":45922,"Skein1024-24":45923,"Skein1024-32":45924,"Skein1024-40":45925,"Skein1024-48":45926,"Skein1024-56":45927,"Skein1024-64":45928,"Skein1024-72":45929,"Skein1024-80":45930,"Skein1024-88":45931,"Skein1024-96":45932,"Skein1024-104":45933,"Skein1024-112":45934,"Skein1024-120":45935,"Skein1024-128":45936,"Skein1024-136":45937,"Skein1024-144":45938,"Skein1024-152":45939,"Skein1024-160":45940,"Skein1024-168":45941,"Skein1024-176":45942,"Skein1024-184":45943,"Skein1024-192":45944,"Skein1024-200":45945,"Skein1024-208":45946,"Skein1024-216":45947,"Skein1024-224":45948,"Skein1024-232":45949,"Skein1024-240":45950,"Skein1024-248":45951,"Skein1024-256":45952,"Skein1024-264":45953,"Skein1024-272":45954,"Skein1024-280":45955,"Skein1024-288":45956,"Skein1024-296":45957,"Skein1024-304":45958,"Skein1024-312":45959,"Skein1024-320":45960,"Skein1024-328":45961,"Skein1024-336":45962,"Skein1024-344":45963,"Skein1024-352":45964,"Skein1024-360":45965,"Skein1024-368":45966,"Skein1024-376":45967,"Skein1024-384":45968,"Skein1024-392":45969,"Skein1024-400":45970,"Skein1024-408":45971,"Skein1024-416":45972,"Skein1024-424":45973,"Skein1024-432":45974,"Skein1024-440":45975,"Skein1024-448":45976,"Skein1024-456":45977,"Skein1024-464":45978,"Skein1024-472":45979,"Skein1024-480":45980,"Skein1024-488":45981,"Skein1024-496":45982,"Skein1024-504":45983,"Skein1024-512":45984,"Skein1024-520":45985,"Skein1024-528":45986,"Skein1024-536":45987,"Skein1024-544":45988,"Skein1024-552":45989,"Skein1024-560":45990,"Skein1024-568":45991,"Skein1024-576":45992,"Skein1024-584":45993,"Skein1024-592":45994,"Skein1024-600":45995,"Skein1024-608":45996,"Skein1024-616":45997,"Skein1024-624":45998,"Skein1024-632":45999,"Skein1024-640":46e3,"Skein1024-648":46001,"Skein1024-656":46002,"Skein1024-664":46003,"Skein1024-672":46004,"Skein1024-680":46005,"Skein1024-688":46006,"Skein1024-696":46007,"Skein1024-704":46008,"Skein1024-712":46009,"Skein1024-720":46010,"Skein1024-728":46011,"Skein1024-736":46012,"Skein1024-744":46013,"Skein1024-752":46014,"Skein1024-760":46015,"Skein1024-768":46016,"Skein1024-776":46017,"Skein1024-784":46018,"Skein1024-792":46019,"Skein1024-800":46020,"Skein1024-808":46021,"Skein1024-816":46022,"Skein1024-824":46023,"Skein1024-832":46024,"Skein1024-840":46025,"Skein1024-848":46026,"Skein1024-856":46027,"Skein1024-864":46028,"Skein1024-872":46029,"Skein1024-880":46030,"Skein1024-888":46031,"Skein1024-896":46032,"Skein1024-904":46033,"Skein1024-912":46034,"Skein1024-920":46035,"Skein1024-928":46036,"Skein1024-936":46037,"Skein1024-944":46038,"Skein1024-952":46039,"Skein1024-960":46040,"Skein1024-968":46041,"Skein1024-976":46042,"Skein1024-984":46043,"Skein1024-992":46044,"Skein1024-1000":46045,"Skein1024-1008":46046,"Skein1024-1016":46047,"Skein1024-1024":46048}),t.codes=Object.freeze({17:"sha1",18:"sha2-256",19:"sha2-512",86:"dbl-sha2-256",23:"sha3-224",22:"sha3-256",21:"sha3-384",20:"sha3-512",24:"shake-128",25:"shake-256",26:"keccak-224",27:"keccak-256",28:"keccak-384",29:"keccak-512",34:"murmur3-128",35:"murmur3-32",45569:"blake2b-8",45570:"blake2b-16",45571:"blake2b-24",45572:"blake2b-32",45573:"blake2b-40",45574:"blake2b-48",45575:"blake2b-56",45576:"blake2b-64",45577:"blake2b-72",45578:"blake2b-80",45579:"blake2b-88",45580:"blake2b-96",45581:"blake2b-104",45582:"blake2b-112",45583:"blake2b-120",45584:"blake2b-128",45585:"blake2b-136",45586:"blake2b-144",45587:"blake2b-152",45588:"blake2b-160",45589:"blake2b-168",45590:"blake2b-176",45591:"blake2b-184",45592:"blake2b-192",45593:"blake2b-200",45594:"blake2b-208",45595:"blake2b-216",45596:"blake2b-224",45597:"blake2b-232",45598:"blake2b-240",45599:"blake2b-248",45600:"blake2b-256",45601:"blake2b-264",45602:"blake2b-272",45603:"blake2b-280",45604:"blake2b-288",45605:"blake2b-296",45606:"blake2b-304",45607:"blake2b-312",45608:"blake2b-320",45609:"blake2b-328",45610:"blake2b-336",45611:"blake2b-344",45612:"blake2b-352",45613:"blake2b-360",45614:"blake2b-368",45615:"blake2b-376",45616:"blake2b-384",45617:"blake2b-392",45618:"blake2b-400",45619:"blake2b-408",45620:"blake2b-416",45621:"blake2b-424",45622:"blake2b-432",45623:"blake2b-440",45624:"blake2b-448",45625:"blake2b-456",45626:"blake2b-464",45627:"blake2b-472",45628:"blake2b-480",45629:"blake2b-488",45630:"blake2b-496",45631:"blake2b-504",45632:"blake2b-512",45633:"blake2s-8",45634:"blake2s-16",45635:"blake2s-24",45636:"blake2s-32",45637:"blake2s-40",45638:"blake2s-48",45639:"blake2s-56",45640:"blake2s-64",45641:"blake2s-72",45642:"blake2s-80",45643:"blake2s-88",45644:"blake2s-96",45645:"blake2s-104",45646:"blake2s-112",45647:"blake2s-120",45648:"blake2s-128",45649:"blake2s-136",45650:"blake2s-144",45651:"blake2s-152",45652:"blake2s-160",45653:"blake2s-168",45654:"blake2s-176",45655:"blake2s-184",45656:"blake2s-192",45657:"blake2s-200",45658:"blake2s-208",45659:"blake2s-216",45660:"blake2s-224",45661:"blake2s-232",45662:"blake2s-240",45663:"blake2s-248",45664:"blake2s-256",45825:"Skein256-8",45826:"Skein256-16",45827:"Skein256-24",45828:"Skein256-32",45829:"Skein256-40",45830:"Skein256-48",45831:"Skein256-56",45832:"Skein256-64",45833:"Skein256-72",45834:"Skein256-80",45835:"Skein256-88",45836:"Skein256-96",45837:"Skein256-104",45838:"Skein256-112",45839:"Skein256-120",45840:"Skein256-128",45841:"Skein256-136",45842:"Skein256-144",45843:"Skein256-152",45844:"Skein256-160",45845:"Skein256-168",45846:"Skein256-176",45847:"Skein256-184",45848:"Skein256-192",45849:"Skein256-200",45850:"Skein256-208",45851:"Skein256-216",45852:"Skein256-224",45853:"Skein256-232",45854:"Skein256-240",45855:"Skein256-248",45856:"Skein256-256",45857:"Skein512-8",45858:"Skein512-16",45859:"Skein512-24",45860:"Skein512-32",45861:"Skein512-40",45862:"Skein512-48",45863:"Skein512-56",45864:"Skein512-64",45865:"Skein512-72",45866:"Skein512-80",45867:"Skein512-88",45868:"Skein512-96",45869:"Skein512-104",45870:"Skein512-112",45871:"Skein512-120",45872:"Skein512-128",45873:"Skein512-136",45874:"Skein512-144",45875:"Skein512-152",45876:"Skein512-160",45877:"Skein512-168",45878:"Skein512-176",45879:"Skein512-184",45880:"Skein512-192",45881:"Skein512-200",45882:"Skein512-208",45883:"Skein512-216",45884:"Skein512-224",45885:"Skein512-232",45886:"Skein512-240",45887:"Skein512-248",45888:"Skein512-256",45889:"Skein512-264",45890:"Skein512-272",45891:"Skein512-280",45892:"Skein512-288",45893:"Skein512-296",45894:"Skein512-304",45895:"Skein512-312",45896:"Skein512-320",45897:"Skein512-328",45898:"Skein512-336",45899:"Skein512-344",45900:"Skein512-352",45901:"Skein512-360",45902:"Skein512-368",45903:"Skein512-376",45904:"Skein512-384",45905:"Skein512-392",45906:"Skein512-400",45907:"Skein512-408",45908:"Skein512-416",45909:"Skein512-424",45910:"Skein512-432",45911:"Skein512-440",45912:"Skein512-448",45913:"Skein512-456",45914:"Skein512-464",45915:"Skein512-472",45916:"Skein512-480",45917:"Skein512-488",45918:"Skein512-496",45919:"Skein512-504",45920:"Skein512-512",45921:"Skein1024-8",45922:"Skein1024-16",45923:"Skein1024-24",45924:"Skein1024-32",45925:"Skein1024-40",45926:"Skein1024-48",45927:"Skein1024-56",45928:"Skein1024-64",45929:"Skein1024-72",45930:"Skein1024-80",45931:"Skein1024-88",45932:"Skein1024-96",45933:"Skein1024-104",45934:"Skein1024-112",45935:"Skein1024-120",45936:"Skein1024-128",45937:"Skein1024-136",45938:"Skein1024-144",45939:"Skein1024-152",45940:"Skein1024-160",45941:"Skein1024-168",45942:"Skein1024-176",45943:"Skein1024-184",45944:"Skein1024-192",45945:"Skein1024-200",45946:"Skein1024-208",45947:"Skein1024-216",45948:"Skein1024-224",45949:"Skein1024-232",45950:"Skein1024-240",45951:"Skein1024-248",45952:"Skein1024-256",45953:"Skein1024-264",45954:"Skein1024-272",45955:"Skein1024-280",45956:"Skein1024-288",45957:"Skein1024-296",45958:"Skein1024-304",45959:"Skein1024-312",45960:"Skein1024-320",45961:"Skein1024-328",45962:"Skein1024-336",45963:"Skein1024-344",45964:"Skein1024-352",45965:"Skein1024-360",45966:"Skein1024-368",45967:"Skein1024-376",45968:"Skein1024-384",45969:"Skein1024-392",45970:"Skein1024-400",45971:"Skein1024-408",45972:"Skein1024-416",45973:"Skein1024-424",45974:"Skein1024-432",45975:"Skein1024-440",45976:"Skein1024-448",45977:"Skein1024-456",45978:"Skein1024-464",45979:"Skein1024-472",45980:"Skein1024-480",45981:"Skein1024-488",45982:"Skein1024-496",45983:"Skein1024-504",45984:"Skein1024-512",45985:"Skein1024-520",45986:"Skein1024-528",45987:"Skein1024-536",45988:"Skein1024-544",45989:"Skein1024-552",45990:"Skein1024-560",45991:"Skein1024-568",45992:"Skein1024-576",45993:"Skein1024-584",45994:"Skein1024-592",45995:"Skein1024-600",45996:"Skein1024-608",45997:"Skein1024-616",45998:"Skein1024-624",45999:"Skein1024-632",46000:"Skein1024-640",46001:"Skein1024-648",46002:"Skein1024-656",46003:"Skein1024-664",46004:"Skein1024-672",46005:"Skein1024-680",46006:"Skein1024-688",46007:"Skein1024-696",46008:"Skein1024-704",46009:"Skein1024-712",46010:"Skein1024-720",46011:"Skein1024-728",46012:"Skein1024-736",46013:"Skein1024-744",46014:"Skein1024-752",46015:"Skein1024-760",46016:"Skein1024-768",46017:"Skein1024-776",46018:"Skein1024-784",46019:"Skein1024-792",46020:"Skein1024-800",46021:"Skein1024-808",46022:"Skein1024-816",46023:"Skein1024-824",46024:"Skein1024-832",46025:"Skein1024-840",46026:"Skein1024-848",46027:"Skein1024-856",46028:"Skein1024-864",46029:"Skein1024-872",46030:"Skein1024-880",46031:"Skein1024-888",46032:"Skein1024-896",46033:"Skein1024-904",46034:"Skein1024-912",46035:"Skein1024-920",46036:"Skein1024-928",46037:"Skein1024-936",46038:"Skein1024-944",46039:"Skein1024-952",46040:"Skein1024-960",46041:"Skein1024-968",46042:"Skein1024-976",46043:"Skein1024-984",46044:"Skein1024-992",46045:"Skein1024-1000",46046:"Skein1024-1008",46047:"Skein1024-1016",46048:"Skein1024-1024"}),t.defaultLengths=Object.freeze({17:20,18:32,19:64,86:32,23:28,22:32,21:48,20:64,24:32,25:64,26:28,27:32,28:48,29:64,34:32,45569:1,45570:2,45571:3,45572:4,45573:5,45574:6,45575:7,45576:8,45577:9,45578:10,45579:11,45580:12,45581:13,45582:14,45583:15,45584:16,45585:17,45586:18,45587:19,45588:20,45589:21,45590:22,45591:23,45592:24,45593:25,45594:26,45595:27,45596:28,45597:29,45598:30,45599:31,45600:32,45601:33,45602:34,45603:35,45604:36,45605:37,45606:38,45607:39,45608:40,45609:41,45610:42,45611:43,45612:44,45613:45,45614:46,45615:47,45616:48,45617:49,45618:50,45619:51,45620:52,45621:53,45622:54,45623:55,45624:56,45625:57,45626:58,45627:59,45628:60,45629:61,45630:62,45631:63,45632:64,45633:1,45634:2,45635:3,45636:4,45637:5,45638:6,45639:7,45640:8,45641:9,45642:10,45643:11,45644:12,45645:13,45646:14,45647:15,45648:16,45649:17,45650:18,45651:19,45652:20,45653:21,45654:22,45655:23,45656:24,45657:25,45658:26,45659:27,45660:28,45661:29,45662:30,45663:31,45664:32,45825:1,45826:2,45827:3,45828:4,45829:5,45830:6,45831:7,45832:8,45833:9,45834:10,45835:11,45836:12,45837:13,45838:14,45839:15,45840:16,45841:17,45842:18,45843:19,45844:20,45845:21,45846:22,45847:23,45848:24,45849:25,45850:26,45851:27,45852:28,45853:29,45854:30,45855:31,45856:32,45857:1,45858:2,45859:3,45860:4,45861:5,45862:6,45863:7,45864:8,45865:9,45866:10,45867:11,45868:12,45869:13,45870:14,45871:15,45872:16,45873:17,45874:18,45875:19,45876:20,45877:21,45878:22,45879:23,45880:24,45881:25,45882:26,45883:27,45884:28,45885:29,45886:30,45887:31,45888:32,45889:33,45890:34,45891:35,45892:36,45893:37,45894:38,45895:39,45896:40,45897:41,45898:42,45899:43,45900:44,45901:45,45902:46,45903:47,45904:48,45905:49,45906:50,45907:51,45908:52,45909:53,45910:54,45911:55,45912:56,45913:57,45914:58,45915:59,45916:60,45917:61,45918:62,45919:63,45920:64,45921:1,45922:2,45923:3,45924:4,45925:5,45926:6,45927:7,45928:8,45929:9,45930:10,45931:11,45932:12,45933:13,45934:14,45935:15,45936:16,45937:17,45938:18,45939:19,45940:20,45941:21,45942:22,45943:23,45944:24,45945:25,45946:26,45947:27,45948:28,45949:29,45950:30,45951:31,45952:32,45953:33,45954:34,45955:35,45956:36,45957:37,45958:38,45959:39,45960:40,45961:41,45962:42,45963:43,45964:44,45965:45,45966:46,45967:47,45968:48,45969:49,45970:50,45971:51,45972:52,45973:53,45974:54,45975:55,45976:56,45977:57,45978:58,45979:59,45980:60,45981:61,45982:62,45983:63,45984:64,45985:65,45986:66,45987:67,45988:68,45989:69,45990:70,45991:71,45992:72,45993:73,45994:74,45995:75,45996:76,45997:77,45998:78,45999:79,46000:80,46001:81,46002:82,46003:83,46004:84,46005:85,46006:86,46007:87,46008:88,46009:89,46010:90,46011:91,46012:92,46013:93,46014:94,46015:95,46016:96,46017:97,46018:98,46019:99,46020:100,46021:101,46022:102,46023:103,46024:104,46025:105,46026:106,46027:107,46028:108,46029:109,46030:110,46031:111,46032:112,46033:113,46034:114,46035:115,46036:116,46037:117,46038:118,46039:119,46040:120,46041:121,46042:122,46043:123,46044:124,46045:125,46046:126,46047:127,46048:128})},function(e,t){e.exports=s;var n=128,r=127,i=-128,o=Math.pow(2,31);function s(e,t,r){t=t||[],r=r||0;for(var a=r;e>=o;)t[r++]=255&e|n,e/=128;for(;e&i;)t[r++]=255&e|n,e>>>=7;return t[r]=0|e,s.bytes=r-a+1,t}},function(e,t){e.exports=i;var n=128,r=127;function i(e,t){var o=0,t=t||0,s=0,a=t,l,u=e.length;do{if(a>=u)throw i.bytes=0,new RangeError("Could not decode varint");l=e[a++],o+=s<28?(l&r)<=n);return i.bytes=a-t,o}},function(e,t){var n=Math.pow(2,7),r=Math.pow(2,14),i=Math.pow(2,21),o=Math.pow(2,28),s=Math.pow(2,35),a=Math.pow(2,42),l=Math.pow(2,49),u=Math.pow(2,56),c=Math.pow(2,63);e.exports=function(e){return e(e[t[0]]=new r(t[0],t[1],t[2],t[3]),e),{}),c=l.reduce((e,t)=>(e[t[1]]=u[t[0]],e),{});e.exports={names:u,codes:c}},function(e,t,n){"use strict";class r{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}}e.exports=r},function(e,t,n){var r=n(5).Buffer;e.exports=function e(t){for(var n={},i=t.length,o=t.charAt(0),s=0;s0;)n.push(a%i),a=a/i|0}for(var l="",u=0;0===e[u]&&u=0;--c)l+=t[n[c]];return l}function u(e){if("string"!=typeof e)throw new TypeError("Expected String");if(0===e.length)return r.allocUnsafe(0);for(var t=[0],s=0;s>=8;for(;u>0;)t.push(255&u),u>>=8}for(var c=0;e[c]===o&&c"string"==typeof e?t.from(e).toString("hex"):e.toString("hex"),decode(e){for(let t of e)if(n.indexOf(t)<0)throw new Error("invalid base16 character");return t.from(e,"hex")}}}}).call(this,n(0).Buffer)},function(e,t,n){"use strict";(function(t){function n(e,t){e=e.replace(new RegExp("=","g"),"");let n=e.length,r=0,i=0,o=0,s=new Uint8Array(5*n/8|0);for(let a=0;a=8&&(s[o++]=i>>>r-8&255,r-=8);return s.buffer}function r(e,t){let n=e.byteLength,r=new Uint8Array(e),i=t.indexOf("=")===t.length-1;i&&(t=t.substring(0,t.length-2));let o=0,s=0,a="";for(let e=0;e=5;)a+=t[s>>>o-5&31],o-=5;if(o>0&&(a+=t[s<<5-o&31]),i)for(;a.length%8!=0;)a+="=";return a}e.exports=function e(i){return{encode:e=>r("string"==typeof e?t.from(e):e,i),decode(e){for(let t of e)if(i.indexOf(t)<0)throw new Error("invalid base32 character");return n(e,i)}}}}).call(this,n(0).Buffer)},function(e,t,n){"use strict";(function(t){e.exports=function e(n){const r=n.indexOf("=")>-1,i=n.indexOf("-")>-1&&n.indexOf("_")>-1;return{encode(e){let n="";n="string"==typeof e?t.from(e).toString("base64"):e.toString("base64"),i&&(n=n.replace(/\+/g,"-").replace(/\//g,"_"));const o=n.indexOf("=");return o>0&&!r&&(n=n.substring(0,o)),n},decode(e){for(let t of e)if(n.indexOf(t)<0)throw new Error("invalid base64 character");return t.from(e,"base64")}}}}).call(this,n(0).Buffer)},function(e,t,n){"use strict";const r=n(95),i=n(339).varintBufferEncode,o={};e.exports=o;for(let e in r){let t=r[e];o[e]=i(t)}},function(e,t,n){"use strict";e.exports=Object.freeze({PROTOBUF:80,CBOR:81,RLP:96,BENCODE:99,MULTICODEC:48,MULTIHASH:49,MULTIADDR:50,MULTIBASE:51,IDENTITY:0,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,MURMUR3_128:34,MURMUR3_32:35,DBL_SHA2_256:86,MD4:212,MD5:213,BMT:214,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:46e3,SKEIN1024_648:46001,SKEIN1024_656:46002,SKEIN1024_664:46003,SKEIN1024_672:46004,SKEIN1024_680:46005,SKEIN1024_688:46006,SKEIN1024_696:46007,SKEIN1024_704:46008,SKEIN1024_712:46009,SKEIN1024_720:46010,SKEIN1024_728:46011,SKEIN1024_736:46012,SKEIN1024_744:46013,SKEIN1024_752:46014,SKEIN1024_760:46015,SKEIN1024_768:46016,SKEIN1024_776:46017,SKEIN1024_784:46018,SKEIN1024_792:46019,SKEIN1024_800:46020,SKEIN1024_808:46021,SKEIN1024_816:46022,SKEIN1024_824:46023,SKEIN1024_832:46024,SKEIN1024_840:46025,SKEIN1024_848:46026,SKEIN1024_856:46027,SKEIN1024_864:46028,SKEIN1024_872:46029,SKEIN1024_880:46030,SKEIN1024_888:46031,SKEIN1024_896:46032,SKEIN1024_904:46033,SKEIN1024_912:46034,SKEIN1024_920:46035,SKEIN1024_928:46036,SKEIN1024_936:46037,SKEIN1024_944:46038,SKEIN1024_952:46039,SKEIN1024_960:46040,SKEIN1024_968:46041,SKEIN1024_976:46042,SKEIN1024_984:46043,SKEIN1024_992:46044,SKEIN1024_1000:46045,SKEIN1024_1008:46046,SKEIN1024_1016:46047,SKEIN1024_1024:46048,IP4:4,TCP:6,DCCP:33,IP6:41,IP6ZONE:42,DNS:53,DNS4:54,DNS6:55,DNSADDR:56,SCTP:132,UDP:273,P2P_WEBRTC_STAR:275,P2P_WEBRTC_DIRECT:276,P2P_STARDUST:277,P2P_CIRCUIT:290,UDT:301,UTP:302,UNIX:400,P2P:421,IPFS:421,HTTPS:443,ONION:444,ONION3:445,GARLIC64:446,GARLIC32:447,QUIC:460,WS:477,WSS:478,P2P_WEBSOCKET_STAR:479,HTTP:480,RAW:85,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,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,DECRED_BLOCK:224,DECRED_TX:225,DASH_BLOCK:240,DASH_TX:241,SWARM_MANIFEST:250,SWARM_FEED:251,DAG_JSON:297,PATH:47,IPLD_NS:226,IPFS_NS:227,SWARM_NS:228,ED25519_PUB:237,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";e.exports=Object.freeze({80:"protobuf",81:"cbor",96:"rlp",99:"bencode",48:"multicodec",49:"multihash",50:"multiaddr",51:"multibase",0:"identity",17:"sha1",18:"sha2-256",19:"sha2-512",20:"sha3-512",21:"sha3-384",22:"sha3-256",23:"sha3-224",24:"shake-128",25:"shake-256",26:"keccak-224",27:"keccak-256",28:"keccak-384",29:"keccak-512",34:"murmur3-128",35:"murmur3-32",86:"dbl-sha2-256",212:"md4",213:"md5",214:"bmt",4352:"x11",45569:"blake2b-8",45570:"blake2b-16",45571:"blake2b-24",45572:"blake2b-32",45573:"blake2b-40",45574:"blake2b-48",45575:"blake2b-56",45576:"blake2b-64",45577:"blake2b-72",45578:"blake2b-80",45579:"blake2b-88",45580:"blake2b-96",45581:"blake2b-104",45582:"blake2b-112",45583:"blake2b-120",45584:"blake2b-128",45585:"blake2b-136",45586:"blake2b-144",45587:"blake2b-152",45588:"blake2b-160",45589:"blake2b-168",45590:"blake2b-176",45591:"blake2b-184",45592:"blake2b-192",45593:"blake2b-200",45594:"blake2b-208",45595:"blake2b-216",45596:"blake2b-224",45597:"blake2b-232",45598:"blake2b-240",45599:"blake2b-248",45600:"blake2b-256",45601:"blake2b-264",45602:"blake2b-272",45603:"blake2b-280",45604:"blake2b-288",45605:"blake2b-296",45606:"blake2b-304",45607:"blake2b-312",45608:"blake2b-320",45609:"blake2b-328",45610:"blake2b-336",45611:"blake2b-344",45612:"blake2b-352",45613:"blake2b-360",45614:"blake2b-368",45615:"blake2b-376",45616:"blake2b-384",45617:"blake2b-392",45618:"blake2b-400",45619:"blake2b-408",45620:"blake2b-416",45621:"blake2b-424",45622:"blake2b-432",45623:"blake2b-440",45624:"blake2b-448",45625:"blake2b-456",45626:"blake2b-464",45627:"blake2b-472",45628:"blake2b-480",45629:"blake2b-488",45630:"blake2b-496",45631:"blake2b-504",45632:"blake2b-512",45633:"blake2s-8",45634:"blake2s-16",45635:"blake2s-24",45636:"blake2s-32",45637:"blake2s-40",45638:"blake2s-48",45639:"blake2s-56",45640:"blake2s-64",45641:"blake2s-72",45642:"blake2s-80",45643:"blake2s-88",45644:"blake2s-96",45645:"blake2s-104",45646:"blake2s-112",45647:"blake2s-120",45648:"blake2s-128",45649:"blake2s-136",45650:"blake2s-144",45651:"blake2s-152",45652:"blake2s-160",45653:"blake2s-168",45654:"blake2s-176",45655:"blake2s-184",45656:"blake2s-192",45657:"blake2s-200",45658:"blake2s-208",45659:"blake2s-216",45660:"blake2s-224",45661:"blake2s-232",45662:"blake2s-240",45663:"blake2s-248",45664:"blake2s-256",45825:"skein256-8",45826:"skein256-16",45827:"skein256-24",45828:"skein256-32",45829:"skein256-40",45830:"skein256-48",45831:"skein256-56",45832:"skein256-64",45833:"skein256-72",45834:"skein256-80",45835:"skein256-88",45836:"skein256-96",45837:"skein256-104",45838:"skein256-112",45839:"skein256-120",45840:"skein256-128",45841:"skein256-136",45842:"skein256-144",45843:"skein256-152",45844:"skein256-160",45845:"skein256-168",45846:"skein256-176",45847:"skein256-184",45848:"skein256-192",45849:"skein256-200",45850:"skein256-208",45851:"skein256-216",45852:"skein256-224",45853:"skein256-232",45854:"skein256-240",45855:"skein256-248",45856:"skein256-256",45857:"skein512-8",45858:"skein512-16",45859:"skein512-24",45860:"skein512-32",45861:"skein512-40",45862:"skein512-48",45863:"skein512-56",45864:"skein512-64",45865:"skein512-72",45866:"skein512-80",45867:"skein512-88",45868:"skein512-96",45869:"skein512-104",45870:"skein512-112",45871:"skein512-120",45872:"skein512-128",45873:"skein512-136",45874:"skein512-144",45875:"skein512-152",45876:"skein512-160",45877:"skein512-168",45878:"skein512-176",45879:"skein512-184",45880:"skein512-192",45881:"skein512-200",45882:"skein512-208",45883:"skein512-216",45884:"skein512-224",45885:"skein512-232",45886:"skein512-240",45887:"skein512-248",45888:"skein512-256",45889:"skein512-264",45890:"skein512-272",45891:"skein512-280",45892:"skein512-288",45893:"skein512-296",45894:"skein512-304",45895:"skein512-312",45896:"skein512-320",45897:"skein512-328",45898:"skein512-336",45899:"skein512-344",45900:"skein512-352",45901:"skein512-360",45902:"skein512-368",45903:"skein512-376",45904:"skein512-384",45905:"skein512-392",45906:"skein512-400",45907:"skein512-408",45908:"skein512-416",45909:"skein512-424",45910:"skein512-432",45911:"skein512-440",45912:"skein512-448",45913:"skein512-456",45914:"skein512-464",45915:"skein512-472",45916:"skein512-480",45917:"skein512-488",45918:"skein512-496",45919:"skein512-504",45920:"skein512-512",45921:"skein1024-8",45922:"skein1024-16",45923:"skein1024-24",45924:"skein1024-32",45925:"skein1024-40",45926:"skein1024-48",45927:"skein1024-56",45928:"skein1024-64",45929:"skein1024-72",45930:"skein1024-80",45931:"skein1024-88",45932:"skein1024-96",45933:"skein1024-104",45934:"skein1024-112",45935:"skein1024-120",45936:"skein1024-128",45937:"skein1024-136",45938:"skein1024-144",45939:"skein1024-152",45940:"skein1024-160",45941:"skein1024-168",45942:"skein1024-176",45943:"skein1024-184",45944:"skein1024-192",45945:"skein1024-200",45946:"skein1024-208",45947:"skein1024-216",45948:"skein1024-224",45949:"skein1024-232",45950:"skein1024-240",45951:"skein1024-248",45952:"skein1024-256",45953:"skein1024-264",45954:"skein1024-272",45955:"skein1024-280",45956:"skein1024-288",45957:"skein1024-296",45958:"skein1024-304",45959:"skein1024-312",45960:"skein1024-320",45961:"skein1024-328",45962:"skein1024-336",45963:"skein1024-344",45964:"skein1024-352",45965:"skein1024-360",45966:"skein1024-368",45967:"skein1024-376",45968:"skein1024-384",45969:"skein1024-392",45970:"skein1024-400",45971:"skein1024-408",45972:"skein1024-416",45973:"skein1024-424",45974:"skein1024-432",45975:"skein1024-440",45976:"skein1024-448",45977:"skein1024-456",45978:"skein1024-464",45979:"skein1024-472",45980:"skein1024-480",45981:"skein1024-488",45982:"skein1024-496",45983:"skein1024-504",45984:"skein1024-512",45985:"skein1024-520",45986:"skein1024-528",45987:"skein1024-536",45988:"skein1024-544",45989:"skein1024-552",45990:"skein1024-560",45991:"skein1024-568",45992:"skein1024-576",45993:"skein1024-584",45994:"skein1024-592",45995:"skein1024-600",45996:"skein1024-608",45997:"skein1024-616",45998:"skein1024-624",45999:"skein1024-632",46000:"skein1024-640",46001:"skein1024-648",46002:"skein1024-656",46003:"skein1024-664",46004:"skein1024-672",46005:"skein1024-680",46006:"skein1024-688",46007:"skein1024-696",46008:"skein1024-704",46009:"skein1024-712",46010:"skein1024-720",46011:"skein1024-728",46012:"skein1024-736",46013:"skein1024-744",46014:"skein1024-752",46015:"skein1024-760",46016:"skein1024-768",46017:"skein1024-776",46018:"skein1024-784",46019:"skein1024-792",46020:"skein1024-800",46021:"skein1024-808",46022:"skein1024-816",46023:"skein1024-824",46024:"skein1024-832",46025:"skein1024-840",46026:"skein1024-848",46027:"skein1024-856",46028:"skein1024-864",46029:"skein1024-872",46030:"skein1024-880",46031:"skein1024-888",46032:"skein1024-896",46033:"skein1024-904",46034:"skein1024-912",46035:"skein1024-920",46036:"skein1024-928",46037:"skein1024-936",46038:"skein1024-944",46039:"skein1024-952",46040:"skein1024-960",46041:"skein1024-968",46042:"skein1024-976",46043:"skein1024-984",46044:"skein1024-992",46045:"skein1024-1000",46046:"skein1024-1008",46047:"skein1024-1016",46048:"skein1024-1024",4:"ip4",6:"tcp",33:"dccp",41:"ip6",42:"ip6zone",53:"dns",54:"dns4",55:"dns6",56:"dnsaddr",132:"sctp",273:"udp",275:"p2p-webrtc-star",276:"p2p-webrtc-direct",277:"p2p-stardust",290:"p2p-circuit",301:"udt",302:"utp",400:"unix",421:"p2p",443:"https",444:"onion",445:"onion3",446:"garlic64",447:"garlic32",460:"quic",477:"ws",478:"wss",479:"p2p-websocket-star",480:"http",85:"raw",112:"dag-pb",113:"dag-cbor",114:"libp2p-key",120:"git-raw",123:"torrent-info",124:"torrent-file",129:"leofcoin-block",130:"leofcoin-tx",131:"leofcoin-pr",144:"eth-block",145:"eth-block-list",146:"eth-tx-trie",147:"eth-tx",148:"eth-tx-receipt-trie",149:"eth-tx-receipt",150:"eth-state-trie",151:"eth-account-snapshot",152:"eth-storage-trie",176:"bitcoin-block",177:"bitcoin-tx",192:"zcash-block",193:"zcash-tx",208:"stellar-block",209:"stellar-tx",224:"decred-block",225:"decred-tx",240:"dash-block",241:"dash-tx",250:"swarm-manifest",251:"swarm-feed",297:"dag-json",47:"path",226:"ipld-ns",227:"ipfs-ns",228:"swarm-ns",237:"ed25519-pub",8417572:"holochain-adr-v0",8483108:"holochain-adr-v1",9728292:"holochain-key-v0",9793828:"holochain-key-v1",10645796:"holochain-sig-v0",10711332:"holochain-sig-v1"})},function(e,t,n){"use strict";(function(t){const r=n(27);var i={checkCIDComponents:function(e){if(null==e)return"null values are not valid CIDs";if(0!==e.version&&1!==e.version)return"Invalid version, must be a number equal to 1 or 0";if("string"!=typeof e.codec)return"codec must be string";if(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(!t.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=i}).call(this,n(0).Buffer)},function(e,t,n){"use strict";e.exports={keys:n(685),once:n(116),values:n(40),count:n(686),infinite:n(687),empty:n(88),error:n(71)}},function(e,t,n){"use strict";var r=n(40);e.exports=function(e){return r(Object.keys(e))}},function(e,t,n){"use strict";e.exports=function e(t){var n=0;return t=t||1/0,function(e,r){return e?r&&r(e):n>t?r(!0):void r(null,n++)}}},function(e,t,n){"use strict";e.exports=function e(t){return t=t||Math.random,function(e,n){return e?n&&n(e):n(null,t())}}},function(e,t,n){"use strict";e.exports={drain:n(148),onEnd:n(342),log:n(689),find:n(690),reduce:n(183),collect:n(33),concat:n(691)}},function(e,t,n){"use strict";var r=n(148);e.exports=function e(t){return r(function(e){console.log(e)},t)}},function(e,t,n){"use strict";function r(e){return e}var i=n(149),o=n(148);e.exports=function e(t,n){var s=!1;return n?t=i(t)||r:(n=t,t=r),o(function(e){if(t(e))return s=!0,n(null,e),!1},function(e){s||n(!0===e?null:e,null)})}},function(e,t,n){"use strict";var r=n(183);e.exports=function e(t){return r(function(e,t){return e+t},"",t)}},function(e,t,n){"use strict";e.exports={map:n(66),asyncMap:n(74),filter:n(67),filterNot:n(693),through:n(184),take:n(244),unique:n(344),nonUnique:n(694),flatten:n(185)}},function(e,t,n){"use strict";var r=n(343),i=n(67);e.exports=function e(t){return t=r(t),i(function(e){return!t(e)})}},function(e,t,n){"use strict";var r=n(344);e.exports=function e(t){return r(t,!0)}},function(e,t,n){"use strict";(function(t){const r=n(27);var i={checkCIDComponents:function(e){if(null==e)return"null values are not valid CIDs";if(0!==e.version&&1!==e.version)return"Invalid version, must be a number equal to 1 or 0";if("string"!=typeof e.codec)return"codec must be string";if(!t.isBuffer(e.multihash))return"multihash must be a Buffer";try{r.validate(e.multihash)}catch(e){let t=e.message;return t||(t="Multihash validation failed"),t}}};e.exports=i}).call(this,n(0).Buffer)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=f;var r=n(57),i=h(r),o=n(86),s=h(o),a=n(107),l=h(a),u=n(37),c=h(u);function h(e){return e&&e.__esModule?e:{default:e}}function f(e,t,n){n=(0,l.default)(n||i.default);var r=(0,c.default)(e),o=function(e){if(e)return n(e);var i=(0,s.default)(arguments,1);if(t.apply(this,i))return r(o);n.apply(null,[null].concat(i))};r(o)}e.exports=t.default},function(e,t){e.exports=function(){var e,t,n,r,i;function o(o){return i?i(o):(e=o,function(e,i){t?t(e,i):(r=e,n=i)})}return o.resolve=function(o){if(i)throw new Error("already resolved");if(i=o,!i)throw new Error("resolve *must* be passed a transform stream");e&&(t=i(e),n&&t(r,n))},o}},function(e,t,n){"use strict";t.Diagnose=n(699),t.Decoder=n(351),t.Encoder=n(702),t.Simple=n(352),t.Tagged=n(353),t.decodeAll=t.Decoder.decodeAll,t.decodeFirst=t.Decoder.decodeFirst,t.diagnose=t.Diagnose.diagnose,t.encode=t.Encoder.encode,t.decode=t.Decoder.decode,t.leveldb={decode:t.Decoder.decodeAll,encode:t.Encoder.encode,buffer:!0,name:"cbor"}},function(e,t,n){"use strict";(function(t){const r=n(351),i=n(245);class o extends r{createTag(e,t){return`${e}(${t})`}createInt(e){return super.createInt(e).toString()}createInt32(e,t){return super.createInt32(e,t).toString()}createInt64(e,t,n,r){return super.createInt64(e,t,n,r).toString()}createInt32Neg(e,t){return super.createInt32Neg(e,t).toString()}createInt64Neg(e,t,n,r){return super.createInt64Neg(e,t,n,r).toString()}createTrue(){return"true"}createFalse(){return"false"}createFloat(e){const t=super.createFloat(e);return i.isNegativeZero(e)?"-0_1":`${t}_1`}createFloatSingle(e,t,n,r){const i=super.createFloatSingle(e,t,n,r);return`${i}_2`}createFloatDouble(e,t,n,r,i,o,s,a){const l=super.createFloatDouble(e,t,n,r,i,o,s,a);return`${l}_3`}createByteString(e,t){const n=e.join(", ");return-1===t?`(_ ${n})`:`h'${n}`}createByteStringFromHeap(e,n){const r=t.from(super.createByteStringFromHeap(e,n)).toString("hex");return`h'${r}'`}createInfinity(){return"Infinity_1"}createInfinityNeg(){return"-Infinity_1"}createNaN(){return"NaN_1"}createNaNNeg(){return"-NaN_1"}createNull(){return"null"}createUndefined(){return"undefined"}createSimpleUnassigned(e){return`simple(${e})`}createArray(e,t){const n=super.createArray(e,t);return-1===t?`[_ ${n.join(", ")}]`:`[${n.join(", ")}]`}createMap(e,t){const n=super.createMap(e),r=Array.from(n.keys()).reduce(s(n),"");return-1===t?`{_ ${r}}`:`{${r}}`}createObject(e,t){const n=super.createObject(e),r=Object.keys(n).reduce(s(n),"");return-1===t?`{_ ${r}}`:`{${r}}`}createUtf8String(e,t){const n=e.join(", ");return-1===t?`(_ ${n})`:`"${n}"`}createUtf8StringFromHeap(e,n){const r=t.from(super.createUtf8StringFromHeap(e,n)).toString("utf8");return`"${r}"`}static diagnose(e,n){"string"==typeof e&&(e=t.from(e,n||"hex"));const r=new o;return r.decodeFirst(e)}}function s(e){return(t,n)=>t?`${t}, ${n}: ${e[n]}`:`${n}: ${e[n]}`}e.exports=o}).call(this,n(0).Buffer)},function(e,t){e.exports=function e(t,n,r){"use asm";var i=new t.Uint8Array(r);var o=n.pushInt;var s=n.pushInt32;var a=n.pushInt32Neg;var l=n.pushInt64;var u=n.pushInt64Neg;var c=n.pushFloat;var h=n.pushFloatSingle;var f=n.pushFloatDouble;var p=n.pushTrue;var d=n.pushFalse;var m=n.pushUndefined;var g=n.pushNull;var y=n.pushInfinity;var v=n.pushInfinityNeg;var b=n.pushNaN;var _=n.pushNaNNeg;var w=n.pushArrayStart;var k=n.pushArrayStartFixed;var E=n.pushArrayStartFixed32;var S=n.pushArrayStartFixed64;var x=n.pushObjectStart;var C=n.pushObjectStartFixed;var A=n.pushObjectStartFixed32;var T=n.pushObjectStartFixed64;var I=n.pushByteString;var j=n.pushByteStringStart;var R=n.pushUtf8String;var B=n.pushUtf8StringStart;var O=n.pushSimpleUnassigned;var P=n.pushTagStart;var N=n.pushTagStart4;var D=n.pushTagStart8;var F=n.pushTagUnassigned;var M=n.pushBreak;var L=t.Math.pow;var U=0;var q=0;var z=0;function K(e){e=e|0;U=0;q=e;while((U|0)<(q|0)){z=Je[i[U]&255](i[U]|0)|0;if((z|0)>0){break}}return z|0}function H(e){e=e|0;if(((U|0)+(e|0)|0)<(q|0)){return 0}return 1}function V(e){e=e|0;return i[e|0]<<8|i[e+1|0]|0}function $(e){e=e|0;return i[e|0]<<24|i[e+1|0]<<16|i[e+2|0]<<8|i[e+3|0]|0}function W(e){e=e|0;o(e|0);U=U+1|0;return 0}function G(e){e=e|0;if(H(1)|0){return 1}o(i[U+1|0]|0);U=U+2|0;return 0}function Y(e){e=e|0;if(H(2)|0){return 1}o(V(U+1|0)|0);U=U+3|0;return 0}function Z(e){e=e|0;if(H(4)|0){return 1}s(V(U+1|0)|0,V(U+3|0)|0);U=U+5|0;return 0}function J(e){e=e|0;if(H(8)|0){return 1}l(V(U+1|0)|0,V(U+3|0)|0,V(U+5|0)|0,V(U+7|0)|0);U=U+9|0;return 0}function Q(e){e=e|0;o(-1-(e-32|0)|0);U=U+1|0;return 0}function X(e){e=e|0;if(H(1)|0){return 1}o(-1-(i[U+1|0]|0)|0);U=U+2|0;return 0}function ee(e){e=e|0;var t=0;if(H(2)|0){return 1}t=V(U+1|0)|0;o(-1-(t|0)|0);U=U+3|0;return 0}function te(e){e=e|0;if(H(4)|0){return 1}a(V(U+1|0)|0,V(U+3|0)|0);U=U+5|0;return 0}function ne(e){e=e|0;if(H(8)|0){return 1}u(V(U+1|0)|0,V(U+3|0)|0,V(U+5|0)|0,V(U+7|0)|0);U=U+9|0;return 0}function re(e){e=e|0;var t=0;var n=0;var r=0;r=e-64|0;if(H(r|0)|0){return 1}t=U+1|0;n=(U+1|0)+(r|0)|0;I(t|0,n|0);U=n|0;return 0}function ie(e){e=e|0;var t=0;var n=0;var r=0;if(H(1)|0){return 1}r=i[U+1|0]|0;t=U+2|0;n=(U+2|0)+(r|0)|0;if(H(r+1|0)|0){return 1}I(t|0,n|0);U=n|0;return 0}function oe(e){e=e|0;var t=0;var n=0;var r=0;if(H(2)|0){return 1}r=V(U+1|0)|0;t=U+3|0;n=(U+3|0)+(r|0)|0;if(H(r+2|0)|0){return 1}I(t|0,n|0);U=n|0;return 0}function se(e){e=e|0;var t=0;var n=0;var r=0;if(H(4)|0){return 1}r=$(U+1|0)|0;t=U+5|0;n=(U+5|0)+(r|0)|0;if(H(r+4|0)|0){return 1}I(t|0,n|0);U=n|0;return 0}function ae(e){e=e|0;return 1}function le(e){e=e|0;j();U=U+1|0;return 0}function ue(e){e=e|0;var t=0;var n=0;var r=0;r=e-96|0;if(H(r|0)|0){return 1}t=U+1|0;n=(U+1|0)+(r|0)|0;R(t|0,n|0);U=n|0;return 0}function ce(e){e=e|0;var t=0;var n=0;var r=0;if(H(1)|0){return 1}r=i[U+1|0]|0;t=U+2|0;n=(U+2|0)+(r|0)|0;if(H(r+1|0)|0){return 1}R(t|0,n|0);U=n|0;return 0}function he(e){e=e|0;var t=0;var n=0;var r=0;if(H(2)|0){return 1}r=V(U+1|0)|0;t=U+3|0;n=(U+3|0)+(r|0)|0;if(H(r+2|0)|0){return 1}R(t|0,n|0);U=n|0;return 0}function fe(e){e=e|0;var t=0;var n=0;var r=0;if(H(4)|0){return 1}r=$(U+1|0)|0;t=U+5|0;n=(U+5|0)+(r|0)|0;if(H(r+4|0)|0){return 1}R(t|0,n|0);U=n|0;return 0}function pe(e){e=e|0;return 1}function de(e){e=e|0;B();U=U+1|0;return 0}function me(e){e=e|0;k(e-128|0);U=U+1|0;return 0}function ge(e){e=e|0;if(H(1)|0){return 1}k(i[U+1|0]|0);U=U+2|0;return 0}function ye(e){e=e|0;if(H(2)|0){return 1}k(V(U+1|0)|0);U=U+3|0;return 0}function ve(e){e=e|0;if(H(4)|0){return 1}E(V(U+1|0)|0,V(U+3|0)|0);U=U+5|0;return 0}function be(e){e=e|0;if(H(8)|0){return 1}S(V(U+1|0)|0,V(U+3|0)|0,V(U+5|0)|0,V(U+7|0)|0);U=U+9|0;return 0}function _e(e){e=e|0;w();U=U+1|0;return 0}function we(e){e=e|0;var t=0;t=e-160|0;if(H(t|0)|0){return 1}C(t|0);U=U+1|0;return 0}function ke(e){e=e|0;if(H(1)|0){return 1}C(i[U+1|0]|0);U=U+2|0;return 0}function Ee(e){e=e|0;if(H(2)|0){return 1}C(V(U+1|0)|0);U=U+3|0;return 0}function Se(e){e=e|0;if(H(4)|0){return 1}A(V(U+1|0)|0,V(U+3|0)|0);U=U+5|0;return 0}function xe(e){e=e|0;if(H(8)|0){return 1}T(V(U+1|0)|0,V(U+3|0)|0,V(U+5|0)|0,V(U+7|0)|0);U=U+9|0;return 0}function Ce(e){e=e|0;x();U=U+1|0;return 0}function Ae(e){e=e|0;P(e-192|0|0);U=U+1|0;return 0}function Te(e){e=e|0;P(e|0);U=U+1|0;return 0}function Ie(e){e=e|0;P(e|0);U=U+1|0;return 0}function je(e){e=e|0;P(e|0);U=U+1|0;return 0}function Re(e){e=e|0;P(e|0);U=U+1|0;return 0}function Be(e){e=e|0;P(e-192|0|0);U=U+1|0;return 0}function Oe(e){e=e|0;P(e|0);U=U+1|0;return 0}function Pe(e){e=e|0;P(e|0);U=U+1|0;return 0}function Ne(e){e=e|0;P(e|0);U=U+1|0;return 0}function De(e){e=e|0;if(H(1)|0){return 1}P(i[U+1|0]|0);U=U+2|0;return 0}function Fe(e){e=e|0;if(H(2)|0){return 1}P(V(U+1|0)|0);U=U+3|0;return 0}function Me(e){e=e|0;if(H(4)|0){return 1}N(V(U+1|0)|0,V(U+3|0)|0);U=U+5|0;return 0}function Le(e){e=e|0;if(H(8)|0){return 1}D(V(U+1|0)|0,V(U+3|0)|0,V(U+5|0)|0,V(U+7|0)|0);U=U+9|0;return 0}function Ue(e){e=e|0;O((e|0)-224|0);U=U+1|0;return 0}function qe(e){e=e|0;d();U=U+1|0;return 0}function ze(e){e=e|0;p();U=U+1|0;return 0}function Ke(e){e=e|0;g();U=U+1|0;return 0}function He(e){e=e|0;m();U=U+1|0;return 0}function Ve(e){e=e|0;if(H(1)|0){return 1}O(i[U+1|0]|0);U=U+2|0;return 0}function $e(e){e=e|0;var t=0;var n=0;var r=1.0;var o=0.0;var s=0.0;var a=0.0;if(H(2)|0){return 1}t=i[U+1|0]|0;n=i[U+2|0]|0;if((t|0)&0x80){r=-1.0}o=+(((t|0)&0x7C)>>2);s=+(((t|0)&0x03)<<8|n);if(+o==0.0){c(+(+r*+5.9604644775390625e-8*+s))}else if(+o==31.0){if(+r==1.0){if(+s>0.0){b()}else{y()}}else{if(+s>0.0){_()}else{v()}}}else{c(+(+r*L(+2,+(+o-25.0))*+(1024.0+s)))}U=U+3|0;return 0}function We(e){e=e|0;if(H(4)|0){return 1}h(i[U+1|0]|0,i[U+2|0]|0,i[U+3|0]|0,i[U+4|0]|0);U=U+5|0;return 0}function Ge(e){e=e|0;if(H(8)|0){return 1}f(i[U+1|0]|0,i[U+2|0]|0,i[U+3|0]|0,i[U+4|0]|0,i[U+5|0]|0,i[U+6|0]|0,i[U+7|0]|0,i[U+8|0]|0);U=U+9|0;return 0}function Ye(e){e=e|0;return 1}function Ze(e){e=e|0;M();U=U+1|0;return 0}var Je=[W,W,W,W,W,W,W,W,W,W,W,W,W,W,W,W,W,W,W,W,W,W,W,W,G,Y,Z,J,Ye,Ye,Ye,Ye,Q,Q,Q,Q,Q,Q,Q,Q,Q,Q,Q,Q,Q,Q,Q,Q,Q,Q,Q,Q,Q,Q,Q,Q,X,ee,te,ne,Ye,Ye,Ye,Ye,re,re,re,re,re,re,re,re,re,re,re,re,re,re,re,re,re,re,re,re,re,re,re,re,ie,oe,se,ae,Ye,Ye,Ye,le,ue,ue,ue,ue,ue,ue,ue,ue,ue,ue,ue,ue,ue,ue,ue,ue,ue,ue,ue,ue,ue,ue,ue,ue,ce,he,fe,pe,Ye,Ye,Ye,de,me,me,me,me,me,me,me,me,me,me,me,me,me,me,me,me,me,me,me,me,me,me,me,me,ge,ye,ve,be,Ye,Ye,Ye,_e,we,we,we,we,we,we,we,we,we,we,we,we,we,we,we,we,we,we,we,we,we,we,we,we,ke,Ee,Se,xe,Ye,Ye,Ye,Ce,Ae,Ae,Ae,Ae,Ae,Ae,Be,Be,Be,Be,Be,Be,Be,Be,Be,Be,Be,Be,Be,Be,Be,Be,Be,Be,De,Fe,Me,Le,Ye,Ye,Ye,Ye,Ue,Ue,Ue,Ue,Ue,Ue,Ue,Ue,Ue,Ue,Ue,Ue,Ue,Ue,Ue,Ue,Ue,Ue,Ue,Ue,qe,ze,Ke,He,Ve,$e,We,Ge,Ye,Ye,Ye,Ze];return{parse:K}}},function(e,t,n){"use strict";const{URLWithLegacySupport:r,format:i}=n(354);e.exports=((e,t={},n={},o)=>{let s=t.protocol?t.protocol.replace(":",""):"http",a;s=(n[s]||o||s)+":";try{a=new r(e)}catch(e){a={}}const l=Object.assign({},t,{protocol:s||a.protocol,host:t.host||a.host});return new r(e,i(l)).toString()})},function(e,t,n){"use strict";(function(t){const{URL:r}=n(189),i=n(53),o=n(245),s=n(188),a=s.MT,l=s.NUMBYTES,u=s.SHIFT32,c=s.SYMS,h=s.TAG,f=s.MT.SIMPLE_FLOAT<<5|s.NUMBYTES.TWO,p=s.MT.SIMPLE_FLOAT<<5|s.NUMBYTES.FOUR,d=s.MT.SIMPLE_FLOAT<<5|s.NUMBYTES.EIGHT,m=s.MT.SIMPLE_FLOAT<<5|s.SIMPLE.TRUE,g=s.MT.SIMPLE_FLOAT<<5|s.SIMPLE.FALSE,y=s.MT.SIMPLE_FLOAT<<5|s.SIMPLE.UNDEFINED,v=s.MT.SIMPLE_FLOAT<<5|s.SIMPLE.NULL,b=new i("0x20000000000000"),_=t.from("f97e00","hex"),w=t.from("f9fc00","hex"),k=t.from("f97c00","hex");function E(e){return{}.toString.call(e).slice(8,-1)}class S{constructor(e){e=e||{},this.streaming="function"==typeof e.stream,this.onData=e.stream,this.semanticTypes=[[r,this._pushUrl],[i,this._pushBigNumber]];const t=e.genTypes||[],n=t.length;for(let e=0;e[t,e[t]]))}_pushRawMap(e,t){t=t.map(function(e){return e[0]=S.encode(e[0]),e}).sort(o.keySorter);for(var n=0;n{s.sha2256(e,(e,r)=>{e&&n(e),s.sha2256(t.from(r),n)})};e.exports={sha1:s.sha1,sha2256:s.sha2256,sha2512:s.sha2512,sha3512:a(l(r.sha3_512)),sha3384:a(l(r.sha3_384)),sha3256:a(l(r.sha3_256)),sha3224:a(l(r.sha3_224)),shake128:a(l(r.shake_128,128)),shake256:a(l(r.shake_256,256)),keccak224:a(l(r.keccak_224)),keccak256:a(l(r.keccak_256)),keccak384:a(l(r.keccak_384)),keccak512:a(l(r.keccak_512)),murmur3128:a(l(u(i.x64.hash128))),murmur332:a(c(u(i.x86.hash32))),addBlake:n(707),dblSha2256:h}}).call(this,n(0).Buffer)},function(e,t,n){!function(n,r){"use strict";var i={version:"3.0.1",x86:{},x64:{}};function o(e,t){return(65535&e)*t+(((e>>>16)*t&65535)<<16)}function s(e,t){return e<>>32-t}function a(e){return e^=e>>>16,e=o(e,2246822507),e^=e>>>13,e=o(e,3266489909),e^=e>>>16,e}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[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 u(e,t){e=[e[0]>>>16,65535&e[0],e[1]>>>16,65535&e[1]],t=[t[0]>>>16,65535&t[0],t[1]>>>16,65535&t[1]];var 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 c(e,t){return t%=64,32===t?[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 h(e,t){return t%=64,0===t?e:t<32?[e[0]<>>32-t,e[1]<>>1]),e=u(e,[4283543511,3981806797]),e=f(e,[0,e[0]>>>1]),e=u(e,[3301882366,444984403]),e=f(e,[0,e[0]>>>1]),e}i.x86.hash32=function(e,t){e=e||"",t=t||0;for(var n=e.length%4,r=e.length-n,i=t,l=0,u=3432918353,c=461845907,h=0;h>>0},i.x86.hash128=function(e,t){e=e||"",t=t||0;for(var n=e.length%16,r=e.length-n,i=t,l=t,u=t,c=t,h=0,f=0,p=0,d=0,m=597399067,g=2869860233,y=951274213,v=2716044179,b=0;b>>0).toString(16)).slice(-8)+("00000000"+(l>>>0).toString(16)).slice(-8)+("00000000"+(u>>>0).toString(16)).slice(-8)+("00000000"+(c>>>0).toString(16)).slice(-8)},i.x64.hash128=function(e,t){e=e||"",t=t||0;for(var n=e.length%16,r=e.length-n,i=[0,t],o=[0,t],s=[0,0],a=[0,0],d=[2277735313,289559509],m=[1291169091,658871167],g=0;g>>0).toString(16)).slice(-8)+("00000000"+(i[1]>>>0).toString(16)).slice(-8)+("00000000"+(o[0]>>>0).toString(16)).slice(-8)+("00000000"+(o[1]>>>0).toString(16)).slice(-8)},e.exports&&(t=e.exports=i),t.murmurHash3=i}(this)},function(e,t,n){"use strict";(function(t){const r=n(359),i=o();function o(){return self.crypto?self.crypto.subtle||self.crypto.webkitSubtle:self.msCrypto?self.msCrypto.subtle:void 0}function s(e){if(!i)throw new Error("Please use a browser with webcrypto support and ensure the code has been delivered securely via HTTPS/TLS and run within a Secure Context");return(n,o)=>{const s=i.digest({name:e},n);if("function"!=typeof s.then)return s.onerror=(()=>{o(new Error(`hashing data using ${e}`))}),void(s.oncomplete=(e=>{o(null,e.target.result)}));r(s.then(e=>t.from(new Uint8Array(e))),o)}}function a(e,t){s("SHA-1")(e,t)}function l(e,t){s("SHA-256")(e,t)}function u(e,t){s("SHA-512")(e,t)}e.exports={sha1:a,sha2256:l,sha2512:u}}).call(this,n(0).Buffer)},function(e,t,n){(function(t){var r=n(360),i;i="function"==typeof setImediate?setImediate:"object"==typeof t&&t&&t.nextTick?t.nextTick:function(e){setTimeout(e,0)};var o=[];function s(e){if(!(this instanceof s))return"function"==typeof e?new s(e):a();var t=!1,n=!1,l,u=[],c=!1;function h(e){u.length?(c=!0,u.shift()(e||!1)):c=!1}function f(e,r){return new s(function(o){function s(t){var s=n?e:r;if("function"==typeof s){function a(){var e;try{e=s(l)}catch(e){return o.reject(e),h()}o.fulfill(e),h(!0)}t?a():i(a)}else n?(o.fulfill(l),h(t)):(o.reject(l),h(t))}u.push(s),t&&!c&&h()})}this.then=f,function(){function i(e){t||(r(e)?e.then(i,s):(t=n=!0,l=e,h()))}function s(e){t||(t=!0,n=!1,l=e,h())}for(var a={fulfill:i,reject:s},u=0;ui(r=>{const i=n.init(e,null);return n.update(i,r),t.from(n.digest(i))});e.exports=(e=>{for(let t=0;t<64;t++)e[o+t]=u(t+1,a);for(let t=0;t<32;t++)e[s+t]=u(t+1,l)})}).call(this,n(0).Buffer)},function(e,t,n){var r=n(362);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 o(e,t,n,r){var i=e[t]+n;n<0&&(i+=4294967296);var o=e[t+1]+r;i>=4294967296&&o++,e[t]=i,e[t+1]=o}function s(e,t){return e[t]^e[t+1]<<8^e[t+2]<<16^e[t+3]<<24}function a(e,t,n,r,s,a){var l=f[s],u=f[s+1],c=f[a],p=f[a+1];i(h,e,t),o(h,e,l,u);var d=h[r]^h[e],m=h[r+1]^h[e+1];h[r]=m,h[r+1]=d,i(h,n,r),d=h[t]^h[n],m=h[t+1]^h[n+1],h[t]=d>>>24^m<<8,h[t+1]=m>>>24^d<<8,i(h,e,t),o(h,e,c,p),d=h[r]^h[e],m=h[r+1]^h[e+1],h[r]=d>>>16^m<<16,h[r+1]=m>>>16^d<<16,i(h,n,r),d=h[t]^h[n],m=h[t+1]^h[n+1],h[t]=m>>>31^d<<1,h[t+1]=d>>>31^m<<1}var l=new Uint32Array([4089235720,1779033703,2227873595,3144134277,4271175723,1013904242,1595750129,2773480762,2917565137,1359893119,725511199,2600822924,4215389547,528734635,327033209,1541459225]),u=[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],c=new Uint8Array(u.map(function(e){return 2*e})),h=new Uint32Array(32),f=new Uint32Array(32);function p(e,t){var n=0;for(n=0;n<16;n++)h[n]=e.h[n],h[n+16]=l[n];for(h[24]=h[24]^e.t,h[25]=h[25]^e.t/4294967296,t&&(h[28]=~h[28],h[29]=~h[29]),n=0;n<32;n++)f[n]=s(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]^h[n]^h[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]=l[r];var i=t?t.length:0;return n.h[0]^=16842752^i<<8^e,t&&(m(n,t),n.c=128),n}function m(e,t){for(var n=0;n>2]>>8*(3&n);return t}function y(e,t,n){n=n||64,e=r.normalizeInput(e);var i=d(n,t);return m(i,e),g(i)}function v(e,t,n){var i=y(e,t,n);return r.toHex(i)}e.exports={blake2b:y,blake2bHex:v,blake2bInit:d,blake2bUpdate:m,blake2bFinal:g}},function(e,t,n){var r=n(362);function i(e,t){return e[t]^e[t+1]<<8^e[t+2]<<16^e[t+3]<<24}function o(e,t,n,r,i,o){u[e]=u[e]+u[t]+i,u[r]=s(u[r]^u[e],16),u[n]=u[n]+u[r],u[t]=s(u[t]^u[n],12),u[e]=u[e]+u[t]+o,u[r]=s(u[r]^u[e],8),u[n]=u[n]+u[r],u[t]=s(u[t]^u[n],7)}function s(e,t){return e>>>t^e<<32-t}var a=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),l=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]),u=new Uint32Array(16),c=new Uint32Array(16);function h(e,t){var n=0;for(n=0;n<8;n++)u[n]=e.h[n],u[n+8]=a[n];for(u[12]^=e.t,u[13]^=e.t/4294967296,t&&(u[14]=~u[14]),n=0;n<16;n++)c[n]=i(e.b,4*n);for(n=0;n<10;n++)o(0,4,8,12,c[l[16*n+0]],c[l[16*n+1]]),o(1,5,9,13,c[l[16*n+2]],c[l[16*n+3]]),o(2,6,10,14,c[l[16*n+4]],c[l[16*n+5]]),o(3,7,11,15,c[l[16*n+6]],c[l[16*n+7]]),o(0,5,10,15,c[l[16*n+8]],c[l[16*n+9]]),o(1,6,11,12,c[l[16*n+10]],c[l[16*n+11]]),o(2,7,8,13,c[l[16*n+12]],c[l[16*n+13]]),o(3,4,9,14,c[l[16*n+14]],c[l[16*n+15]]);for(n=0;n<8;n++)e.h[n]^=u[n]^u[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&&(p(r,t),r.c=64),r}function p(e,t){for(var n=0;n>2]>>8*(3&n)&255;return t}function m(e,t,n){n=n||32,e=r.normalizeInput(e);var i=f(n,t);return p(i,e),d(i)}function g(e,t,n){var i=m(e,t,n);return r.toHex(i)}e.exports={blake2s:m,blake2sHex:g,blake2sInit:f,blake2sUpdate:p,blake2sFinal:d}},function(e,t,n){var r=n(711);function i(e){if(!(e instanceof Object))throw new TypeError('"obj" must be an object (or inherit from it)');return o(e)}function o(e,t){for(var n in t=new r(e,t),e){var i=e[n];if(i instanceof Object&&(t.contains(i)||o(i,t)))return!0}return!1}e.exports=i},function(e,t){function n(e,t){this.value=e,this.next=t}e.exports=n,n.prototype.contains=function(e){for(var t=this;t;){if(t.value===e)return!0;t=t.next}return!1}},function(e,t){var n=e.exports=function(e){return new r(e)};function r(e){this.value=e}function i(e,t,n){var r=[],i=[],a=!0;return function e(l){var u=n?o(l):l,c={},h=!0,f={node:u,node_:l,path:[].concat(r),parent:i[i.length-1],parents:i,key:r.slice(-1)[0],isRoot:0===r.length,level:r.length,circular:null,update:function(e,t){f.isRoot||(f.parent.node[f.key]=e),f.node=e,t&&(h=!1)},delete:function(e){delete f.parent.node[f.key],e&&(h=!1)},remove:function(e){d(f.parent.node)?f.parent.node.splice(f.key,1):delete f.parent.node[f.key],e&&(h=!1)},keys:null,before:function(e){c.before=e},after:function(e){c.after=e},pre:function(e){c.pre=e},post:function(e){c.post=e},stop:function(){a=!1},block:function(){h=!1}};if(!a)return f;function p(){if("object"==typeof f.node&&null!==f.node){f.keys&&f.node_===f.node||(f.keys=s(f.node)),f.isLeaf=0==f.keys.length;for(var e=0;ei&&(l=i),u>i&&(u=i),c=a,h=l;;)if(c"!==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")},l=function(e){for(var t={enums:[],messages:[],fields:[],extends:[],extensions:null};e.length;)switch(e[0]){case"map":case"repeated":case"optional":case"required":t.fields.push(a(e));break;case"enum":t.enums.push(m(e));break;case"message":t.messages.push(h(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=a(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":case"option":for(e.shift();";"!==e[0];)e.shift();break;default:e.unshift("optional"),t.fields.push(a(e))}return t},u=function(e){var t={name:e[1],message:h(e)};return t},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}},h=function(e){e.shift();var t=1,n=[],r={name:e.shift(),enums:[],extends:[],messages:[],fields:[]};if("{"!==e[0])throw new Error("Expected { but found "+e[0]);for(e.shift();e.length;){if("{"===e[0]?t++:"}"===e[0]&&t--,!t)return e.shift(),n=l(n),r.enums=n.enums,r.messages=n.messages,r.fields=n.fields,r.extends=n.extends,r.extensions=n.extensions,r;n.push(e.shift())}if(t)throw new Error("No closing tag for message")},f=function(e){e.shift();var t=e.shift();if(";"!==e[0])throw new Error("Expected ; but found "+e[0]);return e.shift(),t},p=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}},m=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=g(e),n.options[t.name]=t.value}throw new Error("No closing tag for enum")},g=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=y(e));break;default:throw new Error("Unexpected token in option: "+e[0])}}},y=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 o=null;switch(e[0]){case":":if(void 0!==n[i])throw new Error("Duplicate option map key "+i);e.shift(),o=t(e.shift()),"{"===o&&(o=y(e)),n[i]=o,";"===e[0]&&e.shift();break;case"{":if(e.shift(),o=y(e),void 0===n[i]&&(n[i]=[]),!Array.isArray(n[i]))throw new Error("Duplicate option map key "+i);n[i].push(o);break;default:throw new Error("Unexpected token in option map: "+e[0])}}throw new Error("No closing tag for option map")},v=function(e){e.shift();var t=e.shift().replace(/^"+|"+$/gm,"");if(";"!==e[0])throw new Error("Unexpected token: "+e[0]+'. Expected ";"');return e.shift(),t},b=function(e){e.shift();var t={name:e.shift(),methods:[],options:{}};if("{"!==e[0])throw new Error("Expected { but found "+e[0]);for(e.shift();e.length;){if("}"===e[0])return e.shift(),";"===e[0]&&e.shift(),t;switch(e[0]){case"option":var n=g(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(_(e));break;default:throw new Error("Unexpected token in service: "+e[0])}}throw new Error("No closing tag for service")},_=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=g(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")},w=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)})})}),s.messages.forEach(function(e){e.fields.forEach(function(t){var n,r,i,a;function l(e){return e.name===t.type}function u(e){return e.name===i}if(t.options&&"true"===t.options.packed&&-1===o.indexOf(t.type)){if(-1===t.type.indexOf(".")){if(e.enums&&e.enums.some(l))return}else{if(n=t.type.split("."),n.length>2)throw new Error("what is this?");if(r=n[0],i=n[1],s.messages.some(function(e){if(e.name===r)return a=e,e}),a&&a.enums&&a.enums.some(u))return}throw new Error("Fields of type "+t.type+' cannot be declared [packed=true]. Only repeated fields of primitive numeric types (types which use the varint, 32-bit, or 64-bit wire types) can be declared "packed". See https://developers.google.com/protocol-buffers/docs/encoding#optional')}})}),s};e.exports=w},function(e,t){e.exports=function(e){var t=function(e){var t=e.indexOf("//");return t>-1?e.slice(0,t):e},n=function(){var e=!1;return function(t){return"/*"===t?(e=!0,!1):"*/"===t?(e=!1,!1):!e}},r=function(e){return e.trim()};return e.replace(/([;,{}()=:[\]<>]|\/\*|\*\/)/g," $1 ").split(/\n/).map(r).filter(Boolean).map(t).map(r).filter(Boolean).join("\n").split(/\s+|\n+/gm).filter(n())}},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.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 o={};return e.fields||(e.fields=[]),e.fields.forEach(function(e){e.oneof?(o[e.oneof]||(o[e.oneof]=[]),o[e.oneof].push(n(e,[]))):t.push(n(e,[]))}),Object.keys(o).forEach(function(e){o[e].unshift("oneof "+e+" {"),o[e].push("}"),t.push(o[e])}),t.push("}",""),t},i=function(e,t){t.push("enum "+e.name+" {"),e.options||(e.options={});var n=s(e.options,[]);return n.length>1&&t.push(n.slice(0,-1)),Object.keys(e.values).map(function(n){var r=o(e.values[n]);t.push([n+" = "+r+";"])}),t.push("}",""),t},o=function(e,t){var n=Object.keys(e.options||{}).map(function(t){return t+" = "+e.options[t]}).join(",");n&&(n=" ["+n+"]");var r=e.value+n;return r},s=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,[]),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){var n=Object.keys(e);return n.forEach(function(n){var r=e[n],i=typeof r;"object"===i?Array.isArray(r)?r.forEach(function(e){e=a(e,[]),e.length&&t.push(n+" {",e,"}")}):(r=a(r,[]),r.length&&t.push(n+" {",r,"}")):("string"===i&&(r='"'+r+'"'),t.push(n+": "+r))}),t},l=function(e,t){return t.push("service "+e.name+" {"),e.options||(e.options={}),s(e.options,t),e.methods||(e.methods=[]),e.methods.forEach(function(e){t.push(u(e,[]))}),t.push("}",""),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=s(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={}),s(e.options,t),e.enums||(e.enums=[]),e.enums.forEach(function(e){i(e,t)}),e.messages||(e.messages=[]),e.messages.forEach(function(e){r(e,t)}),e.services&&e.services.forEach(function(e){l(e,t)}),t.map(c("")).join("\n")}},function(e,t,n){"use strict";var r=n(722),i=n(724),o=n(725),s=n(726),a=n(35),l=function(e){if(!e)return null;var t={};return Object.keys(e).forEach(function(n){t[n]=e[n].value}),t};e.exports=function(e,t){var n={},u={},c={},h=function(e,t){e.enums&&e.enums.forEach(function(e){e.id=t+(t?".":"")+e.name,u[e.id]=e,h(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,o={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[o.id]||(n[o.id]=o,e.messages.push(o)),r.type=i,r.repeated=!0}}),h(r,r.id)})};h(e,"");var f=function(e){var t=Object.keys(e.values||[]).map(function(t){return parseInt(e.values[t].value,10)}),n=function e(n,r,i){if(!t.length||-1===t.indexOf(n))throw new Error("Invalid enum value: "+n);return a.encode(n,r,i),e.bytes=a.encode.bytes,r},i=function e(n,r){var i=a.decode(n,r);if(!t.length||-1===t.indexOf(i))throw new Error("Invalid enum value: "+i);return e.bytes=a.decode.bytes,i};return r.make(0,n,i,a.encodingLength)},p=function(e,t){e.messages.forEach(function(n){t[n.name]=d(n.name,e.id)}),e.enums.forEach(function(e){t[e.name]=l(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 d(t.type,e.id)}),a=s(e,r,n),u=o(e,d,r,n,a),c=i(e,d,r);return u.bytes=c.bytes=0,t.buffer=!0,t.encode=u,t.decode=c,t.encodingLength=a,t},d=function(e,i,o){if(t&&t[e])return t[e];if(r[e])return r[e];var s=(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===o)return s;if(!s)throw new Error("Could not resolve "+e);if(s.values)return f(s);var a=c[s.id]||p(s,c[s.id]={});return a};return(e.enums||[]).concat((e.messages||[]).map(function(e){return d(e.id)}))}},function(e,t,n){"use strict";var r=n(35),i=n(723),o=n(5).Buffer,s=function(e,t,n,r){return t.bytes=n.bytes=0,{type:e,encode:t,decode:n,encodingLength:r}},a,l,u,c,h;t.make=s,t.bytes=(l=function(e){return o.isBuffer(e)?e.length:o.byteLength(e)},u=function(e){var t=l(e);return r.encodingLength(t)+t},c=function(e,t,n){var i=n,s=l(e);return r.encode(s,t,n),n+=r.encode.bytes,o.isBuffer(e)?e.copy(t,n):t.write(e,n,s),n+=s,c.bytes=n-i,t},h=function(e,t){var n=t,i=r.decode(e,t);t+=r.decode.bytes;var o=e.slice(t,t+i);return t+=o.length,h.bytes=t-n,o},s(2,c,h,u)),t.string=function(){var e=function(e){var t=o.byteLength(e);return r.encodingLength(t)+t},t=function(e,n,i){var s=i,a=o.byteLength(e);return r.encode(a,n,i,"utf-8"),i+=r.encode.bytes,n.write(e,i,a),i+=a,t.bytes=i-s,n},n=function(e,t){var i=t,o=r.decode(e,t);t+=r.decode.bytes;var s=e.toString("utf-8",t,t+o);return t+=o,n.bytes=t-i,s};return s(2,t,n,e)}(),t.bool=function(){var e=function(e){return 1},t=function(e,n,r){return n[r]=e?1:0,t.bytes=1,n},n=function(e,t){var r=e[t]>0;return n.bytes=1,r};return s(0,t,n,e)}(),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},n=function(e){return r.encodingLength(e<0?e+4294967296:e)};return s(0,r.encode,e,n)}(),t.int64=function(){var e=function(t,n){var i=r.decode(t,n);if(i>=Math.pow(2,63)){for(var s=9;255===t[n+s-1];)s--;s=s||9;var a=o.allocUnsafe(s);t.copy(a,0,n,n+s),a[s-1]=127&a[s-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 o=i+9;for(r.encode(-1*e,n,i),i+=r.encode.bytes-1,n[i]=128|n[i];i=0?2*t:-2*t-1;var o=r.encode(t,n,i);return e.bytes=r.encode.bytes,o},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(35),i=n(246).defined;function o(e,t,n){for(var o=[],l={},u=[],c=[],h=0;h-1&&delete n[l[c]];if(e.message){var h=r.decode(i,o);o+=r.decode.bytes;var f=e.decode(i,o,o+h);t.map?(n[a]=n[a]||{},n[a][f.key]=f.value):t.repeated?(n[a]=n[a]||[],n[a].push(f)):n[a]=f}else t.repeated?(n[a]=n[a]||[],n[a].push(e.decode(i,o))):n[a]=e.decode(i,o);return o+=e.decode.bytes,o}return function t(h,f,p){if(null==f&&(f=0),null==p&&(p=h.length),!(p<=h.length&&f<=h.length))throw new Error("Decoded message is not valid");for(var d=f,g={},y;;){if(p<=f){var v="",b=0,_,w;for(b=0;b-1){k=!0;break}k||(_?y.repeated?g[v]=[]:(w=w&&_[w]?_[w].value:_[Object.keys(_)[0]].value,g[v]=parseInt(w||0,10)):g[v]=a(y,w))}return t.bytes=f-d,g}var x=r.decode(h,f);f+=r.decode.bytes;var C=x>>3,A=l[C];if(null!=A){var T=n[A];if(y=e.fields[A],y.packed){var I=r.decode(h,f);for(f+=r.decode.bytes,I+=f;f-1){if(v)throw new Error("only one of the properties defined in oneof "+b+" can be set");v=!0}}for(y=0;y{if(e)return n(e);r.push(t),u(s,r,n)})}e.exports=h},function(e,t,n){"use strict";(function(t){const r=n(193),i=r.cloneLinks,o=r.cloneData,s=n(191),a=n(9);function l(e,n,r){const l=o(e);let u=i(e);if("string"==typeof n)u=u.filter(e=>e.name!==n);else{if(!t.isBuffer(n)&&!a.isCID(n))return r(new Error("second arg needs to be a name or CID"),null);u=u.filter(e=>!e.cid.equals(n))}s(l,u,r)}e.exports=l}).call(this,n(0).Buffer)},function(e,t,n){(function(t){var n={};e.exports=n;var r={};function i(e,t){var n=0,r=t.length,i=t.charAt(0),o=[0];for(n=0;n0;)o.push(a%r),a=a/r|0}var l="";for(n=0;0===e.at(n)&&n=0;--n)l+=t[o[n]];return l}n.encode=function(e,t,n){if("string"!=typeof t)throw new TypeError('"alphabet" must be a string.');if(void 0!==n&&"number"!=typeof n)throw new TypeError('"maxline" must be a number.');var r="";if(e instanceof Uint8Array){var o=0,s=t.length,a=t.charAt(0),l=[0];for(o=0;o0;)l.push(c%s),c=c/s|0}for(o=0;0===e[o]&&o=0;--o)r+=t[l[o]]}else r=i(e,t);if(n){var h=new RegExp(".{1,"+n+"}","g");r=r.match(h).join("\r\n")}return r},n.decode=function(e,n){if("string"!=typeof e)throw new TypeError('"input" must be a string.');if("string"!=typeof n)throw new TypeError('"alphabet" must be a string.');var i=r[n];if(!i){i=r[n]=[];for(var o=0;o>=8;for(;h>0;)l.push(255&h),h>>=8}for(var f=0;e[f]===a&&f>24&255,s>>16&255,s>>8&255,255&s);n.start(),n.update(e+a),i+=n.digest().getBytes()}return i.substring(0,t)}i.encode_rsa_oaep=function(e,t,n){var i,s,a,l;"string"==typeof n?(i=n,s=arguments[3]||void 0,a=arguments[4]||void 0):n&&(i=n.label||void 0,s=n.seed||void 0,a=n.md||void 0,n.mgf1&&n.mgf1.md&&(l=n.mgf1.md)),a?a.start():a=r.md.sha1.create(),l||(l=a);var u=Math.ceil(e.n.bitLength()/8),c=u-2*a.digestLength-2;if(t.length>c){var h=new Error("RSAES-OAEP input message length is too long.");throw h.length=t.length,h.maxLength=c,h}i||(i=""),a.update(i,"raw");for(var f=a.digest(),p="",d=c-t.length,m=0;m>>0,a>>>0];for(var l=i.fullMessageLength.length-1;l>=0;--l)i.fullMessageLength[l]+=a[1],a[1]=a[0]+(i.fullMessageLength[l]/4294967296>>>0),i.fullMessageLength[l]=i.fullMessageLength[l]>>>0,a[0]=a[1]/4294967296>>>0;return t.putBytes(o),u(e,n,t),(t.read>2048||0===t.length())&&t.compact(),i},i.digest=function(){var s=r.util.createBuffer();s.putBytes(t.bytes());var a=i.fullMessageLength[i.fullMessageLength.length-1]+i.messageLengthSize,l=a&i.blockLength-1,c,h;s.putBytes(o.substr(0,i.blockLength-l));for(var f=8*i.fullMessageLength[0],p=0;p>>0,f+=h,s.putInt32(f>>>0),f=c>>>0;s.putInt32(f);var d={h0:e.h0,h1:e.h1,h2:e.h2,h3:e.h3,h4:e.h4,h5:e.h5,h6:e.h6,h7:e.h7};u(d,n,s);var m=r.util.createBuffer();return m.putInt32(d.h0),m.putInt32(d.h1),m.putInt32(d.h2),m.putInt32(d.h3),m.putInt32(d.h4),m.putInt32(d.h5),m.putInt32(d.h6),m.putInt32(d.h7),m},i};var o=null,s=!1,a=null;function l(){o=String.fromCharCode(128),o+=r.util.fillString(String.fromCharCode(0),64),a=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298],s=!0}function u(e,t,n){for(var r,i,o,s,l,u,c,h,f,p,d,m,g,y,v,b=n.length();b>=64;){for(c=0;c<16;++c)t[c]=n.getInt32();for(;c<64;++c)r=t[c-2],r=(r>>>17|r<<15)^(r>>>19|r<<13)^r>>>10,i=t[c-15],i=(i>>>7|i<<25)^(i>>>18|i<<14)^i>>>3,t[c]=r+t[c-7]+i+t[c-16]|0;for(h=e.h0,f=e.h1,p=e.h2,d=e.h3,m=e.h4,g=e.h5,y=e.h6,v=e.h7,c=0;c<64;++c)s=(m>>>6|m<<26)^(m>>>11|m<<21)^(m>>>25|m<<7),l=y^m&(g^y),o=(h>>>2|h<<30)^(h>>>13|h<<19)^(h>>>22|h<<10),u=h&f|p&(h^f),r=v+s+l+a[c]+t[c],i=o+u,v=y,y=g,g=m,m=d+r>>>0,d=p,p=f,f=h,h=r+i>>>0;e.h0=e.h0+h|0,e.h1=e.h1+f|0,e.h2=e.h2+p|0,e.h3=e.h3+d|0,e.h4=e.h4+m|0,e.h5=e.h5+g|0,e.h6=e.h6+y|0,e.h7=e.h7+v|0,b-=64}}},function(e,t,n){(function(t){var r=n(20);n(30);var i=null;!r.util.isNodejs||r.options.usePureJavaScript||t.versions["node-webkit"]||(i=n(370));var o=e.exports=r.prng=r.prng||{};o.create=function(e){for(var t={plugin:e,key:null,seed:null,time:null,reseeds:0,generated:0,keyBytes:""},n=e.md,o=new Array(32),s=0;s<32;++s)o[s]=n.create();function a(e){if(t.pools[0].messageLength>=32)return u(),e();var n=32-t.pools[0].messageLength<<5;t.seedFile(n,function(n,r){if(n)return e(n);t.collect(r),u(),e()})}function l(){if(t.pools[0].messageLength>=32)return u();var e=32-t.pools[0].messageLength<<5;t.collect(t.seedFileSync(e)),u()}function u(){t.reseeds=4294967295===t.reseeds?0:t.reseeds+1;var e=t.plugin.md.create();e.update(t.keyBytes);for(var n=1,r=0;r<32;++r)t.reseeds%n==0&&(e.update(t.pools[r].digest().getBytes()),t.pools[r].start()),n<<=1;t.keyBytes=e.digest().getBytes(),e.start(),e.update(t.keyBytes);var i=e.digest().getBytes();t.key=t.plugin.formatKey(t.keyBytes),t.seed=t.plugin.formatSeed(i),t.generated=0}function c(e){var t=null;if("undefined"!=typeof window){var n=window.crypto||window.msCrypto;n&&n.getRandomValues&&(t=function(e){return n.getRandomValues(e)})}var i=r.util.createBuffer();if(t)for(;i.length()>16),u+=(32767&l)<<16,u+=l>>15,u=(2147483647&u)+(u>>31),h=4294967295&u;for(var a=0;a<3;++a)c=h>>>(a<<3),c^=Math.floor(256*Math.random()),i.putByte(String.fromCharCode(255&c))}return i.getBytes(e)}return t.pools=o,t.pool=0,t.generate=function(e,n){if(!n)return t.generateSync(e);var i=t.plugin.cipher,o=t.plugin.increment,s=t.plugin.formatKey,l=t.plugin.formatSeed,u=r.util.createBuffer();function c(h){if(h)return n(h);if(u.length()>=e)return n(null,u.getBytes(e));if(t.generated>1048575&&(t.key=null),null===t.key)return r.util.nextTick(function(){a(c)});var f=i(t.key,t.seed);t.generated+=f.length,u.putBytes(f),t.key=s(i(t.key,o(t.seed))),t.seed=l(i(t.key,t.seed)),r.util.setImmediate(c)}t.key=null,c()},t.generateSync=function(e){var n=t.plugin.cipher,i=t.plugin.increment,o=t.plugin.formatKey,s=t.plugin.formatSeed;t.key=null;for(var a=r.util.createBuffer();a.length()1048575&&(t.key=null),null===t.key&&l();var u=n(t.key,t.seed);t.generated+=u.length,a.putBytes(u),t.key=o(n(t.key,i(t.seed))),t.seed=s(n(t.key,t.seed))}return a.getBytes(e)},i?(t.seedFile=function(e,t){i.randomBytes(e,function(e,n){if(e)return t(e);t(null,n.toString())})},t.seedFileSync=function(e){return i.randomBytes(e).toString()}):(t.seedFile=function(e,t){try{t(null,c(e))}catch(e){t(e)}},t.seedFileSync=c),t.collect=function(e){for(var n=e.length,r=0;r>i&255);t.collect(r)},t.registerWorker=function(e){if(e===self)t.seedFile=function(e,t){function n(e){var r=e.data;r.forge&&r.forge.prng&&(self.removeEventListener("message",n),t(r.forge.prng.err,r.forge.prng.bytes))}self.addEventListener("message",n),self.postMessage({forge:{prng:{needed:e}}})};else{var n=function(n){var r=n.data;r.forge&&r.forge.prng&&t.seedFile(r.forge.prng.needed,function(t,n){e.postMessage({forge:{prng:{err:t,bytes:n}}})})};e.addEventListener("message",n)}},t}}).call(this,n(2))},function(e,t,n){var r=n(20);n(97),n(30);var i=e.exports=r.sha1=r.sha1||{};r.md.sha1=r.md.algorithms.sha1=i,i.create=function(){s||a();var e=null,t=r.util.createBuffer(),n=new Array(80),i={algorithm:"sha1",blockLength:64,digestLength:20,messageLength:0,fullMessageLength:null,messageLengthSize:8,start:function(){i.messageLength=0,i.fullMessageLength=i.messageLength64=[];for(var n=i.messageLengthSize/4,o=0;o>>0,a>>>0];for(var u=i.fullMessageLength.length-1;u>=0;--u)i.fullMessageLength[u]+=a[1],a[1]=a[0]+(i.fullMessageLength[u]/4294967296>>>0),i.fullMessageLength[u]=i.fullMessageLength[u]>>>0,a[0]=a[1]/4294967296>>>0;return t.putBytes(o),l(e,n,t),(t.read>2048||0===t.length())&&t.compact(),i},i.digest=function(){var s=r.util.createBuffer();s.putBytes(t.bytes());var a=i.fullMessageLength[i.fullMessageLength.length-1]+i.messageLengthSize,u=a&i.blockLength-1,c,h;s.putBytes(o.substr(0,i.blockLength-u));for(var f=8*i.fullMessageLength[0],p=0;p>>0,f+=h,s.putInt32(f>>>0),f=c>>>0;s.putInt32(f);var d={h0:e.h0,h1:e.h1,h2:e.h2,h3:e.h3,h4:e.h4};l(d,n,s);var m=r.util.createBuffer();return m.putInt32(d.h0),m.putInt32(d.h1),m.putInt32(d.h2),m.putInt32(d.h3),m.putInt32(d.h4),m},i};var o=null,s=!1;function a(){o=String.fromCharCode(128),o+=r.util.fillString(String.fromCharCode(0),64),s=!0}function l(e,t,n){for(var r,i,o,s,a,l,u,c,h=n.length();h>=64;){for(i=e.h0,o=e.h1,s=e.h2,a=e.h3,l=e.h4,c=0;c<16;++c)r=n.getInt32(),t[c]=r,u=a^o&(s^a),r=(i<<5|i>>>27)+u+l+1518500249+r,l=a,a=s,s=(o<<30|o>>>2)>>>0,o=i,i=r;for(;c<20;++c)r=t[c-3]^t[c-8]^t[c-14]^t[c-16],r=r<<1|r>>>31,t[c]=r,u=a^o&(s^a),r=(i<<5|i>>>27)+u+l+1518500249+r,l=a,a=s,s=(o<<30|o>>>2)>>>0,o=i,i=r;for(;c<32;++c)r=t[c-3]^t[c-8]^t[c-14]^t[c-16],r=r<<1|r>>>31,t[c]=r,u=o^s^a,r=(i<<5|i>>>27)+u+l+1859775393+r,l=a,a=s,s=(o<<30|o>>>2)>>>0,o=i,i=r;for(;c<40;++c)r=t[c-6]^t[c-16]^t[c-28]^t[c-32],r=r<<2|r>>>30,t[c]=r,u=o^s^a,r=(i<<5|i>>>27)+u+l+1859775393+r,l=a,a=s,s=(o<<30|o>>>2)>>>0,o=i,i=r;for(;c<60;++c)r=t[c-6]^t[c-16]^t[c-28]^t[c-32],r=r<<2|r>>>30,t[c]=r,u=o&s|a&(o^s),r=(i<<5|i>>>27)+u+l+2400959708+r,l=a,a=s,s=(o<<30|o>>>2)>>>0,o=i,i=r;for(;c<80;++c)r=t[c-6]^t[c-16]^t[c-28]^t[c-32],r=r<<2|r>>>30,t[c]=r,u=o^s^a,r=(i<<5|i>>>27)+u+l+3395469782+r,l=a,a=s,s=(o<<30|o>>>2)>>>0,o=i,i=r;e.h0=e.h0+i|0,e.h1=e.h1+o|0,e.h2=e.h2+s|0,e.h3=e.h3+a|0,e.h4=e.h4+l|0,h-=64}}},function(e,t,n){var r=n(20);n(30),n(367),n(118),function(){if(r.prime)e.exports=r.prime;else{var t=e.exports=r.prime=r.prime||{},n=r.jsbn.BigInteger,i=[6,4,2,4,2,4,6,2],o=new n(null);o.fromInt(30);var s=function(e,t){return e|t};t.generateProbablePrime=function(e,t,n){"function"==typeof t&&(n=t,t={}),t=t||{};var i=t.algorithm||"PRIMEINC";"string"==typeof i&&(i={name:i}),i.options=i.options||{};var o=t.prng||r.random,s={nextBytes:function(e){for(var t=o.getBytesSync(e.length),n=0;nt&&(e=h(t,n)),e.isProbablePrime(s))return l(null,e);e.dAddOffset(i[o++%8],0)}while(a<0||+new Date-ce&&(s=h(e,t));var d=s.toString(16);i.target.postMessage({hex:d,workLoad:u}),s.dAddOffset(c,0)}}}p()}function h(e,t){var r=new n(e,t),i=e-1;return r.testBit(i)||r.bitwiseTo(n.ONE.shiftLeft(i),s,r),r.dAddOffset(31-r.mod(o).byteValue(),0),r}function f(e){return e<=100?27:e<=150?18:e<=200?15:e<=250?12:e<=300?9:e<=350?8:e<=400?7:e<=500?6:e<=600?5:e<=800?4:e<=1250?3:2}}()},function(e,t,n){var r=n(20);n(97),n(30);var i=e.exports=r.hmac=r.hmac||{};i.create=function(){var e=null,t=null,n=null,i=null,o={start:function(o,s){if(null!==o)if("string"==typeof o){if(o=o.toLowerCase(),!(o in r.md.algorithms))throw new Error('Unknown hash algorithm "'+o+'"');t=r.md.algorithms[o].create()}else t=o;if(null===s)s=e;else{if("string"==typeof s)s=r.util.createBuffer(s);else if(r.util.isArray(s)){var a=s;s=r.util.createBuffer();for(var l=0;lt.blockLength&&(t.start(),t.update(s.bytes()),s=t.digest()),n=r.util.createBuffer(),i=r.util.createBuffer(),u=s.length();for(var l=0;l>16-t},a=function(e,t){return(65535&e)>>t|e<<16-t&65535};e.exports=r.rc2=r.rc2||{},r.rc2.expandKey=function(e,t){"string"==typeof e&&(e=r.util.createBuffer(e)),t=t||128;var n=e,o=e.length(),s=t,a=Math.ceil(s/8),l=255>>(7&s),u;for(u=o;u<128;u++)n.putByte(i[n.at(u-1)+n.at(u-o)&255]);for(n.setAt(128-a,i[n.at(128-a)&l]),u=127-a;u>=0;u--)n.setAt(u,i[n.at(u+1)^n.at(u+a)]);return n};var l=function(e,t,n){var i=!1,l=null,u=null,c=null,h,f,p,d,m=[];for(e=r.rc2.expandKey(e,t),p=0;p<64;p++)m.push(e.getInt16Le());n?(h=function(e){for(p=0;p<4;p++)e[p]+=m[d]+(e[(p+3)%4]&e[(p+2)%4])+(~e[(p+3)%4]&e[(p+1)%4]),e[p]=s(e[p],o[p]),d++},f=function(e){for(p=0;p<4;p++)e[p]+=m[63&e[(p+3)%4]]}):(h=function(e){for(p=3;p>=0;p--)e[p]=a(e[p],o[p]),e[p]-=m[d]+(e[(p+3)%4]&e[(p+2)%4])+(~e[(p+3)%4]&e[(p+1)%4]),d--},f=function(e){for(p=3;p>=0;p--)e[p]-=m[63&e[(p+3)%4]]});var g=function(e){var t=[];for(p=0;p<4;p++){var r=l.getInt16Le();null!==c&&(n?r^=c.getInt16Le():c.putInt16Le(r)),t.push(65535&r)}d=n?0:63;for(var i=0;i=8;)g([[5,h],[1,f],[6,h],[1,f],[5,h]])},finish:function(e){var t=!0;if(n)if(e)t=e(8,l,!n);else{var r=8===l.length()?8:8-l.length();l.fillWithByte(r,r)}if(t&&(i=!0,y.update()),!n&&(t=0===l.length(),t))if(e)t=e(8,u,!n);else{var o=u.length(),s=u.at(o-1);s>o?t=!1:u.truncate(s)}return t}},y};r.rc2.startEncrypting=function(e,t,n){var i=r.rc2.createEncryptionCipher(e,128);return i.start(t,n),i},r.rc2.createEncryptionCipher=function(e,t){return l(e,t,!0)},r.rc2.startDecrypting=function(e,t,n){var i=r.rc2.createDecryptionCipher(e,128);return i.start(t,n),i},r.rc2.createDecryptionCipher=function(e,t){return l(e,t,!1)}},function(e,t,n){"use strict";const r=n(54),i=n(55),o=n(70),s=n(47),a=n(742),l=i(n(247));n(756),n(249);const u=n(20);class c{constructor(e){this._key=e}verify(e,t,n){g(n),a.hashAndVerify(this._key,t,e,n)}marshal(){return a.utils.jwkToPkix(this._key)}get bytes(){return l.PublicKey.encode({Type:l.KeyType.RSA,Data:this.marshal()})}encrypt(e){return this._key.encrypt(e,"RSAES-PKCS1-V1_5")}equals(e){return this.bytes.equals(e.bytes)}hash(e){g(e),r(this.bytes,"sha2-256",e)}}class h{constructor(e,t){this._key=e,this._publicKey=t}genSecret(){return a.getRandomValues(16)}sign(e,t){g(t),a.hashAndSign(this._key,e,t)}get public(){if(!this._publicKey)throw new Error("public key not provided");return new c(this._publicKey)}decrypt(e,t){a.decrypt(this._key,e,t)}marshal(){return a.utils.jwkToPkcs1(this._key)}get bytes(){return l.PrivateKey.encode({Type:l.KeyType.RSA,Data:this.marshal()})}equals(e){return this.bytes.equals(e.bytes)}hash(e){g(e),r(this.bytes,"sha2-256",e)}id(e){this.public.hash((t,n)=>{if(t)return e(t);e(null,o.encode(n))})}export(e,t,n){"function"==typeof t&&(n=t,t=e,e="pkcs-8"),g(n),s(()=>{let r=null,i=null;try{const n=new u.util.ByteBuffer(this.marshal()),o=u.asn1.fromDer(n),s=u.pki.privateKeyFromAsn1(o);if("pkcs-8"===e){const e={algorithm:"aes256",count:1e4,saltSize:16,prfAlgorithm:"sha512"};i=u.pki.encryptRsaPrivateKey(s,t,e)}else r=new Error(`Unknown export format '${e}'`)}catch(e){r=e}n(r,i)})}}function f(e,t){const n=a.utils.pkcs1ToJwk(e);a.unmarshalPrivateKey(n,(e,n)=>{if(e)return t(e);t(null,new h(n.privateKey,n.publicKey))})}function p(e){const t=a.utils.pkixToJwk(e);return new c(t)}function d(e,t){a.unmarshalPrivateKey(e,(e,n)=>{if(e)return t(e);t(null,new h(n.privateKey,n.publicKey))})}function m(e,t){a.generateKey(e,(e,n)=>{if(e)return t(e);t(null,new h(n.privateKey,n.publicKey))})}function g(e){if("function"!=typeof e)throw new Error("callback is required")}e.exports={RsaPublicKey:c,RsaPrivateKey:h,unmarshalRsaPublicKey:p,unmarshalRsaPrivateKey:f,generateKeyPair:m,fromJwk:d}},function(e,t,n){"use strict";(function(e){const r=n(252),i=n(253),o=n(254);function s(e){return Promise.all([i.subtle.exportKey("jwk",e.privateKey),i.subtle.exportKey("jwk",e.publicKey)])}function a(e){return i.subtle.importKey("jwk",{kty:e.kty,n:e.n,e:e.e},{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}},!0,["verify"])}t.utils=n(744),t.generateKey=function(e,t){r(i.subtle.generateKey({name:"RSASSA-PKCS1-v1_5",modulusLength:e,publicExponent:new Uint8Array([1,0,1]),hash:{name:"SHA-256"}},!0,["sign","verify"]).then(s).then(e=>({privateKey:e[0],publicKey:e[1]})),t)},t.unmarshalPrivateKey=function(e,t){const n=i.subtle.importKey("jwk",e,{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}},!0,["sign"]);r(Promise.all([n,a(e)]).then(e=>s({privateKey:e[0],publicKey:e[1]})).then(e=>({privateKey:e[0],publicKey:e[1]})),t)},t.getRandomValues=o,t.hashAndSign=function(t,n,o){r(i.subtle.importKey("jwk",t,{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}},!1,["sign"]).then(e=>i.subtle.sign({name:"RSASSA-PKCS1-v1_5"},e,Uint8Array.from(n))).then(t=>e.from(t)),o)},t.hashAndVerify=function(e,t,n,o){r(i.subtle.importKey("jwk",e,{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}},!1,["verify"]).then(e=>i.subtle.verify({name:"RSASSA-PKCS1-v1_5"},e,t,n)),o)}}).call(this,n(0).Buffer)},function(e,t,n){"use strict";(function(t,n){const r=t.crypto||t.msCrypto,i=65536;function o(){throw new Error("Secure random number generation is not supported by this browser.\nUse Chrome, Firefox or Internet Explorer 11")}function s(e){const t=new Uint8Array(e);let o=0;if(e>0)if(e>i)for(;ot?r.getRandomValues(t.subarray(o,t-o)):(r.getRandomValues(t.subarray(o,o+i)),o+=i);else r.getRandomValues(t);return n.from(t)}r&&r.getRandomValues?e.exports=s:e.exports=o}).call(this,n(7),n(0).Buffer)},function(e,t,n){"use strict";const r=n(119),i=n(376),o=i.toBase64,s=i.toBn,a=r.define("RSAPrivateKey",function(){this.seq().obj(this.key("version").int(),this.key("modulus").int(),this.key("publicExponent").int(),this.key("privateExponent").int(),this.key("prime1").int(),this.key("prime2").int(),this.key("exponent1").int(),this.key("exponent2").int(),this.key("coefficient").int())}),l=r.define("AlgorithmIdentifier",function(){this.seq().obj(this.key("algorithm").objid({"1.2.840.113549.1.1.1":"rsa"}),this.key("none").optional().null_(),this.key("curve").optional().objid(),this.key("params").optional().seq().obj(this.key("p").int(),this.key("q").int(),this.key("g").int()))}),u=r.define("RSAPublicKey",function(){this.seq().obj(this.key("algorithm").use(l),this.key("subjectPublicKey").bitstr())}),c=r.define("RSAPublicKey",function(){this.seq().obj(this.key("modulus").int(),this.key("publicExponent").int())});t.pkcs1ToJwk=function(e){const t=a.decode(e,"der");return{kty:"RSA",n:o(t.modulus),e:o(t.publicExponent),d:o(t.privateExponent),p:o(t.prime1),q:o(t.prime2),dp:o(t.exponent1),dq:o(t.exponent2),qi:o(t.coefficient),alg:"RS256",kid:"2011-04-29"}},t.jwkToPkcs1=function(e){return a.encode({version:0,modulus:s(e.n),publicExponent:s(e.e),privateExponent:s(e.d),prime1:s(e.p),prime2:s(e.q),exponent1:s(e.dp),exponent2:s(e.dq),coefficient:s(e.qi)},"der")},t.pkixToJwk=function(e){const t=u.decode(e,"der"),n=c.decode(t.subjectPublicKey.data,"der");return{kty:"RSA",n:o(n.modulus),e:o(n.publicExponent),alg:"RS256",kid:"2011-04-29"}},t.jwkToPkix=function(e){return u.encode({algorithm:{algorithm:"rsa",none:null},subjectPublicKey:{data:c.encode({modulus:s(e.n),publicExponent:s(e.e)},"der")}},"der")}},function(e,t,n){(function(e){!function(e,t){"use strict";function r(e,t){if(!e)throw new Error(t||"Assertion failed")}function i(e,t){e.super_=t;var n=function(){};n.prototype=t.prototype,e.prototype=new n,e.prototype.constructor=e}function o(e,t,n){if(o.isBN(e))return e;this.negative=0,this.words=null,this.length=0,this.red=null,null!==e&&("le"!==t&&"be"!==t||(n=t,t=10),this._init(e||0,t||10,n||"be"))}var s;"object"==typeof e?e.exports=o:t.BN=o,o.BN=o,o.wordSize=26;try{s=n(746).Buffer}catch(e){}function a(e,t,n){for(var r=0,i=Math.min(e.length,n),o=t;o=49&&s<=54?s-49+10:s>=17&&s<=22?s-17+10:15&s}return r}function l(e,t,n,r){for(var i=0,o=Math.min(e.length,n),s=t;s=49?a-49+10:a>=17?a-17+10:a}return i}o.isBN=function e(t){return t instanceof o||null!==t&&"object"==typeof t&&t.constructor.wordSize===o.wordSize&&Array.isArray(t.words)},o.max=function e(t,n){return t.cmp(n)>0?t:n},o.min=function e(t,n){return t.cmp(n)<0?t:n},o.prototype._init=function e(t,n,i){if("number"==typeof t)return this._initNumber(t,n,i);if("object"==typeof t)return this._initArray(t,n,i);"hex"===n&&(n=16),r(n===(0|n)&&n>=2&&n<=36),t=t.toString().replace(/\s+/g,"");var o=0;"-"===t[0]&&o++,16===n?this._parseHex(t,o):this._parseBase(t,n,o),"-"===t[0]&&(this.negative=1),this.strip(),"le"===i&&this._initArray(this.toArray(),n,i)},o.prototype._initNumber=function e(t,n,i){t<0&&(this.negative=1,t=-t),t<67108864?(this.words=[67108863&t],this.length=1):t<4503599627370496?(this.words=[67108863&t,t/67108864&67108863],this.length=2):(r(t<9007199254740992),this.words=[67108863&t,t/67108864&67108863,1],this.length=3),"le"===i&&this._initArray(this.toArray(),n,i)},o.prototype._initArray=function e(t,n,i){if(r("number"==typeof t.length),t.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(t.length/3),this.words=new Array(this.length);for(var o=0;o=0;o-=3)a=t[o]|t[o-1]<<8|t[o-2]<<16,this.words[s]|=a<>>26-l&67108863,l+=24,l>=26&&(l-=26,s++);else if("le"===i)for(o=0,s=0;o>>26-l&67108863,l+=24,l>=26&&(l-=26,s++);return this.strip()},o.prototype._parseHex=function e(t,n){this.length=Math.ceil((t.length-n)/6),this.words=new Array(this.length);for(var r=0;r=n;r-=6)o=a(t,r,r+6),this.words[i]|=o<>>26-s&4194303,s+=24,s>=26&&(s-=26,i++);r+6!==n&&(o=a(t,n,r+6),this.words[i]|=o<>>26-s&4194303),this.strip()},o.prototype._parseBase=function e(t,n,r){this.words=[0],this.length=1;for(var i=0,o=1;o<=67108863;o*=n)i++;i--,o=o/n|0;for(var s=t.length-r,a=s%i,u=Math.min(s,s-a)+r,c=0,h=r;h1&&0===this.words[this.length-1];)this.length--;return this._normSign()},o.prototype._normSign=function e(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},o.prototype.inspect=function e(){return(this.red?""};var u=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],c=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],h=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];function f(e){for(var t=new Array(e.bitLength()),n=0;n>>i}return t}function p(e,t,n){n.negative=t.negative^e.negative;var r=e.length+t.length|0;n.length=r,r=r-1|0;var i=0|e.words[0],o=0|t.words[0],s=i*o,a=67108863&s,l=s/67108864|0;n.words[0]=a;for(var u=1;u>>26,h=67108863&l,f=Math.min(u,t.length-1),p=Math.max(0,u-e.length+1);p<=f;p++){var d=u-p|0;i=0|e.words[d],o=0|t.words[p],s=i*o+h,c+=s/67108864|0,h=67108863&s}n.words[u]=0|h,l=0|c}return 0!==l?n.words[u]=0|l:n.length--,n.strip()}o.prototype.toString=function e(t,n){var i;if(t=t||10,n=0|n||1,16===t||"hex"===t){i="";for(var o=0,s=0,a=0;a>>24-o&16777215,i=0!==s||a!==this.length-1?u[6-f.length]+f+i:f+i,o+=2,o>=26&&(o-=26,a--)}for(0!==s&&(i=s.toString(16)+i);i.length%n!=0;)i="0"+i;return 0!==this.negative&&(i="-"+i),i}if(t===(0|t)&&t>=2&&t<=36){var p=c[t],d=h[t];i="";var m=this.clone();for(m.negative=0;!m.isZero();){var g=m.modn(d).toString(t);m=m.idivn(d),i=m.isZero()?g+i:u[p-g.length]+g+i}for(this.isZero()&&(i="0"+i);i.length%n!=0;)i="0"+i;return 0!==this.negative&&(i="-"+i),i}r(!1,"Base should be between 2 and 36")},o.prototype.toNumber=function e(){var t=this.words[0];return 2===this.length?t+=67108864*this.words[1]:3===this.length&&1===this.words[2]?t+=4503599627370496+67108864*this.words[1]:this.length>2&&r(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-t:t},o.prototype.toJSON=function e(){return this.toString(16)},o.prototype.toBuffer=function e(t,n){return r(void 0!==s),this.toArrayLike(s,t,n)},o.prototype.toArray=function e(t,n){return this.toArrayLike(Array,t,n)},o.prototype.toArrayLike=function e(t,n,i){var o=this.byteLength(),s=i||Math.max(1,o);r(o<=s,"byte array longer than desired length"),r(s>0,"Requested array length <= 0"),this.strip();var a="le"===n,l=new t(s),u,c,h=this.clone();if(a){for(c=0;!h.isZero();c++)u=h.andln(255),h.iushrn(8),l[c]=u;for(;c=4096&&(r+=13,n>>>=13),n>=64&&(r+=7,n>>>=7),n>=8&&(r+=4,n>>>=4),n>=2&&(r+=2,n>>>=2),r+n},o.prototype._zeroBits=function e(t){if(0===t)return 26;var n=t,r=0;return 0==(8191&n)&&(r+=13,n>>>=13),0==(127&n)&&(r+=7,n>>>=7),0==(15&n)&&(r+=4,n>>>=4),0==(3&n)&&(r+=2,n>>>=2),0==(1&n)&&r++,r},o.prototype.bitLength=function e(){var t=this.words[this.length-1],n=this._countBits(t);return 26*(this.length-1)+n},o.prototype.zeroBits=function e(){if(this.isZero())return 0;for(var t=0,n=0;nt.length?this.clone().ior(t):t.clone().ior(this)},o.prototype.uor=function e(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},o.prototype.iuand=function e(t){var n;n=this.length>t.length?t:this;for(var r=0;rt.length?this.clone().iand(t):t.clone().iand(this)},o.prototype.uand=function e(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},o.prototype.iuxor=function e(t){var n,r;this.length>t.length?(n=this,r=t):(n=t,r=this);for(var i=0;it.length?this.clone().ixor(t):t.clone().ixor(this)},o.prototype.uxor=function e(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},o.prototype.inotn=function e(t){r("number"==typeof t&&t>=0);var n=0|Math.ceil(t/26),i=t%26;this._expand(n),i>0&&n--;for(var o=0;o0&&(this.words[o]=~this.words[o]&67108863>>26-i),this.strip()},o.prototype.notn=function e(t){return this.clone().inotn(t)},o.prototype.setn=function e(t,n){r("number"==typeof t&&t>=0);var i=t/26|0,o=t%26;return this._expand(i+1),this.words[i]=n?this.words[i]|1<t.length?(r=this,i=t):(r=t,i=this);for(var o=0,s=0;s>>26;for(;0!==o&&s>>26;if(this.length=r.length,0!==o)this.words[this.length]=o,this.length++;else if(r!==this)for(;st.length?this.clone().iadd(t):t.clone().iadd(this)},o.prototype.isub=function e(t){if(0!==t.negative){t.negative=0;var n=this.iadd(t);return t.negative=1,n._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var r=this.cmp(t),i,o;if(0===r)return this.negative=0,this.length=1,this.words[0]=0,this;r>0?(i=this,o=t):(i=t,o=this);for(var s=0,a=0;a>26,this.words[a]=67108863&n;for(;0!==s&&a>26,this.words[a]=67108863&n;if(0===s&&a>>13,d=0|i[1],m=8191&d,g=d>>>13,y=0|i[2],v=8191&y,b=y>>>13,_=0|i[3],w=8191&_,k=_>>>13,E=0|i[4],S=8191&E,x=E>>>13,C=0|i[5],A=8191&C,T=C>>>13,I=0|i[6],j=8191&I,R=I>>>13,B=0|i[7],O=8191&B,P=B>>>13,N=0|i[8],D=8191&N,F=N>>>13,M=0|i[9],L=8191&M,U=M>>>13,q=0|o[0],z=8191&q,K=q>>>13,H=0|o[1],V=8191&H,$=H>>>13,W=0|o[2],G=8191&W,Y=W>>>13,Z=0|o[3],J=8191&Z,Q=Z>>>13,X=0|o[4],ee=8191&X,te=X>>>13,ne=0|o[5],re=8191&ne,ie=ne>>>13,oe=0|o[6],se=8191&oe,ae=oe>>>13,le=0|o[7],ue=8191&le,ce=le>>>13,he=0|o[8],fe=8191&he,pe=he>>>13,de=0|o[9],me=8191&de,ge=de>>>13;r.negative=t.negative^n.negative,r.length=19,l=Math.imul(f,z),u=Math.imul(f,K),u=u+Math.imul(p,z)|0,c=Math.imul(p,K);var ye=(a+l|0)+((8191&u)<<13)|0;a=(c+(u>>>13)|0)+(ye>>>26)|0,ye&=67108863,l=Math.imul(m,z),u=Math.imul(m,K),u=u+Math.imul(g,z)|0,c=Math.imul(g,K),l=l+Math.imul(f,V)|0,u=u+Math.imul(f,$)|0,u=u+Math.imul(p,V)|0,c=c+Math.imul(p,$)|0;var ve=(a+l|0)+((8191&u)<<13)|0;a=(c+(u>>>13)|0)+(ve>>>26)|0,ve&=67108863,l=Math.imul(v,z),u=Math.imul(v,K),u=u+Math.imul(b,z)|0,c=Math.imul(b,K),l=l+Math.imul(m,V)|0,u=u+Math.imul(m,$)|0,u=u+Math.imul(g,V)|0,c=c+Math.imul(g,$)|0,l=l+Math.imul(f,G)|0,u=u+Math.imul(f,Y)|0,u=u+Math.imul(p,G)|0,c=c+Math.imul(p,Y)|0;var be=(a+l|0)+((8191&u)<<13)|0;a=(c+(u>>>13)|0)+(be>>>26)|0,be&=67108863,l=Math.imul(w,z),u=Math.imul(w,K),u=u+Math.imul(k,z)|0,c=Math.imul(k,K),l=l+Math.imul(v,V)|0,u=u+Math.imul(v,$)|0,u=u+Math.imul(b,V)|0,c=c+Math.imul(b,$)|0,l=l+Math.imul(m,G)|0,u=u+Math.imul(m,Y)|0,u=u+Math.imul(g,G)|0,c=c+Math.imul(g,Y)|0,l=l+Math.imul(f,J)|0,u=u+Math.imul(f,Q)|0,u=u+Math.imul(p,J)|0,c=c+Math.imul(p,Q)|0;var _e=(a+l|0)+((8191&u)<<13)|0;a=(c+(u>>>13)|0)+(_e>>>26)|0,_e&=67108863,l=Math.imul(S,z),u=Math.imul(S,K),u=u+Math.imul(x,z)|0,c=Math.imul(x,K),l=l+Math.imul(w,V)|0,u=u+Math.imul(w,$)|0,u=u+Math.imul(k,V)|0,c=c+Math.imul(k,$)|0,l=l+Math.imul(v,G)|0,u=u+Math.imul(v,Y)|0,u=u+Math.imul(b,G)|0,c=c+Math.imul(b,Y)|0,l=l+Math.imul(m,J)|0,u=u+Math.imul(m,Q)|0,u=u+Math.imul(g,J)|0,c=c+Math.imul(g,Q)|0,l=l+Math.imul(f,ee)|0,u=u+Math.imul(f,te)|0,u=u+Math.imul(p,ee)|0,c=c+Math.imul(p,te)|0;var we=(a+l|0)+((8191&u)<<13)|0;a=(c+(u>>>13)|0)+(we>>>26)|0,we&=67108863,l=Math.imul(A,z),u=Math.imul(A,K),u=u+Math.imul(T,z)|0,c=Math.imul(T,K),l=l+Math.imul(S,V)|0,u=u+Math.imul(S,$)|0,u=u+Math.imul(x,V)|0,c=c+Math.imul(x,$)|0,l=l+Math.imul(w,G)|0,u=u+Math.imul(w,Y)|0,u=u+Math.imul(k,G)|0,c=c+Math.imul(k,Y)|0,l=l+Math.imul(v,J)|0,u=u+Math.imul(v,Q)|0,u=u+Math.imul(b,J)|0,c=c+Math.imul(b,Q)|0,l=l+Math.imul(m,ee)|0,u=u+Math.imul(m,te)|0,u=u+Math.imul(g,ee)|0,c=c+Math.imul(g,te)|0,l=l+Math.imul(f,re)|0,u=u+Math.imul(f,ie)|0,u=u+Math.imul(p,re)|0,c=c+Math.imul(p,ie)|0;var ke=(a+l|0)+((8191&u)<<13)|0;a=(c+(u>>>13)|0)+(ke>>>26)|0,ke&=67108863,l=Math.imul(j,z),u=Math.imul(j,K),u=u+Math.imul(R,z)|0,c=Math.imul(R,K),l=l+Math.imul(A,V)|0,u=u+Math.imul(A,$)|0,u=u+Math.imul(T,V)|0,c=c+Math.imul(T,$)|0,l=l+Math.imul(S,G)|0,u=u+Math.imul(S,Y)|0,u=u+Math.imul(x,G)|0,c=c+Math.imul(x,Y)|0,l=l+Math.imul(w,J)|0,u=u+Math.imul(w,Q)|0,u=u+Math.imul(k,J)|0,c=c+Math.imul(k,Q)|0,l=l+Math.imul(v,ee)|0,u=u+Math.imul(v,te)|0,u=u+Math.imul(b,ee)|0,c=c+Math.imul(b,te)|0,l=l+Math.imul(m,re)|0,u=u+Math.imul(m,ie)|0,u=u+Math.imul(g,re)|0,c=c+Math.imul(g,ie)|0,l=l+Math.imul(f,se)|0,u=u+Math.imul(f,ae)|0,u=u+Math.imul(p,se)|0,c=c+Math.imul(p,ae)|0;var Ee=(a+l|0)+((8191&u)<<13)|0;a=(c+(u>>>13)|0)+(Ee>>>26)|0,Ee&=67108863,l=Math.imul(O,z),u=Math.imul(O,K),u=u+Math.imul(P,z)|0,c=Math.imul(P,K),l=l+Math.imul(j,V)|0,u=u+Math.imul(j,$)|0,u=u+Math.imul(R,V)|0,c=c+Math.imul(R,$)|0,l=l+Math.imul(A,G)|0,u=u+Math.imul(A,Y)|0,u=u+Math.imul(T,G)|0,c=c+Math.imul(T,Y)|0,l=l+Math.imul(S,J)|0,u=u+Math.imul(S,Q)|0,u=u+Math.imul(x,J)|0,c=c+Math.imul(x,Q)|0,l=l+Math.imul(w,ee)|0,u=u+Math.imul(w,te)|0,u=u+Math.imul(k,ee)|0,c=c+Math.imul(k,te)|0,l=l+Math.imul(v,re)|0,u=u+Math.imul(v,ie)|0,u=u+Math.imul(b,re)|0,c=c+Math.imul(b,ie)|0,l=l+Math.imul(m,se)|0,u=u+Math.imul(m,ae)|0,u=u+Math.imul(g,se)|0,c=c+Math.imul(g,ae)|0,l=l+Math.imul(f,ue)|0,u=u+Math.imul(f,ce)|0,u=u+Math.imul(p,ue)|0,c=c+Math.imul(p,ce)|0;var Se=(a+l|0)+((8191&u)<<13)|0;a=(c+(u>>>13)|0)+(Se>>>26)|0,Se&=67108863,l=Math.imul(D,z),u=Math.imul(D,K),u=u+Math.imul(F,z)|0,c=Math.imul(F,K),l=l+Math.imul(O,V)|0,u=u+Math.imul(O,$)|0,u=u+Math.imul(P,V)|0,c=c+Math.imul(P,$)|0,l=l+Math.imul(j,G)|0,u=u+Math.imul(j,Y)|0,u=u+Math.imul(R,G)|0,c=c+Math.imul(R,Y)|0,l=l+Math.imul(A,J)|0,u=u+Math.imul(A,Q)|0,u=u+Math.imul(T,J)|0,c=c+Math.imul(T,Q)|0,l=l+Math.imul(S,ee)|0,u=u+Math.imul(S,te)|0,u=u+Math.imul(x,ee)|0,c=c+Math.imul(x,te)|0,l=l+Math.imul(w,re)|0,u=u+Math.imul(w,ie)|0,u=u+Math.imul(k,re)|0,c=c+Math.imul(k,ie)|0,l=l+Math.imul(v,se)|0,u=u+Math.imul(v,ae)|0,u=u+Math.imul(b,se)|0,c=c+Math.imul(b,ae)|0,l=l+Math.imul(m,ue)|0,u=u+Math.imul(m,ce)|0,u=u+Math.imul(g,ue)|0,c=c+Math.imul(g,ce)|0,l=l+Math.imul(f,fe)|0,u=u+Math.imul(f,pe)|0,u=u+Math.imul(p,fe)|0,c=c+Math.imul(p,pe)|0;var xe=(a+l|0)+((8191&u)<<13)|0;a=(c+(u>>>13)|0)+(xe>>>26)|0,xe&=67108863,l=Math.imul(L,z),u=Math.imul(L,K),u=u+Math.imul(U,z)|0,c=Math.imul(U,K),l=l+Math.imul(D,V)|0,u=u+Math.imul(D,$)|0,u=u+Math.imul(F,V)|0,c=c+Math.imul(F,$)|0,l=l+Math.imul(O,G)|0,u=u+Math.imul(O,Y)|0,u=u+Math.imul(P,G)|0,c=c+Math.imul(P,Y)|0,l=l+Math.imul(j,J)|0,u=u+Math.imul(j,Q)|0,u=u+Math.imul(R,J)|0,c=c+Math.imul(R,Q)|0,l=l+Math.imul(A,ee)|0,u=u+Math.imul(A,te)|0,u=u+Math.imul(T,ee)|0,c=c+Math.imul(T,te)|0,l=l+Math.imul(S,re)|0,u=u+Math.imul(S,ie)|0,u=u+Math.imul(x,re)|0,c=c+Math.imul(x,ie)|0,l=l+Math.imul(w,se)|0,u=u+Math.imul(w,ae)|0,u=u+Math.imul(k,se)|0,c=c+Math.imul(k,ae)|0,l=l+Math.imul(v,ue)|0,u=u+Math.imul(v,ce)|0,u=u+Math.imul(b,ue)|0,c=c+Math.imul(b,ce)|0,l=l+Math.imul(m,fe)|0,u=u+Math.imul(m,pe)|0,u=u+Math.imul(g,fe)|0,c=c+Math.imul(g,pe)|0,l=l+Math.imul(f,me)|0,u=u+Math.imul(f,ge)|0,u=u+Math.imul(p,me)|0,c=c+Math.imul(p,ge)|0;var Ce=(a+l|0)+((8191&u)<<13)|0;a=(c+(u>>>13)|0)+(Ce>>>26)|0,Ce&=67108863,l=Math.imul(L,V),u=Math.imul(L,$),u=u+Math.imul(U,V)|0,c=Math.imul(U,$),l=l+Math.imul(D,G)|0,u=u+Math.imul(D,Y)|0,u=u+Math.imul(F,G)|0,c=c+Math.imul(F,Y)|0,l=l+Math.imul(O,J)|0,u=u+Math.imul(O,Q)|0,u=u+Math.imul(P,J)|0,c=c+Math.imul(P,Q)|0,l=l+Math.imul(j,ee)|0,u=u+Math.imul(j,te)|0,u=u+Math.imul(R,ee)|0,c=c+Math.imul(R,te)|0,l=l+Math.imul(A,re)|0,u=u+Math.imul(A,ie)|0,u=u+Math.imul(T,re)|0,c=c+Math.imul(T,ie)|0,l=l+Math.imul(S,se)|0,u=u+Math.imul(S,ae)|0,u=u+Math.imul(x,se)|0,c=c+Math.imul(x,ae)|0,l=l+Math.imul(w,ue)|0,u=u+Math.imul(w,ce)|0,u=u+Math.imul(k,ue)|0,c=c+Math.imul(k,ce)|0,l=l+Math.imul(v,fe)|0,u=u+Math.imul(v,pe)|0,u=u+Math.imul(b,fe)|0,c=c+Math.imul(b,pe)|0,l=l+Math.imul(m,me)|0,u=u+Math.imul(m,ge)|0,u=u+Math.imul(g,me)|0,c=c+Math.imul(g,ge)|0;var Ae=(a+l|0)+((8191&u)<<13)|0;a=(c+(u>>>13)|0)+(Ae>>>26)|0,Ae&=67108863,l=Math.imul(L,G),u=Math.imul(L,Y),u=u+Math.imul(U,G)|0,c=Math.imul(U,Y),l=l+Math.imul(D,J)|0,u=u+Math.imul(D,Q)|0,u=u+Math.imul(F,J)|0,c=c+Math.imul(F,Q)|0,l=l+Math.imul(O,ee)|0,u=u+Math.imul(O,te)|0,u=u+Math.imul(P,ee)|0,c=c+Math.imul(P,te)|0,l=l+Math.imul(j,re)|0,u=u+Math.imul(j,ie)|0,u=u+Math.imul(R,re)|0,c=c+Math.imul(R,ie)|0,l=l+Math.imul(A,se)|0,u=u+Math.imul(A,ae)|0,u=u+Math.imul(T,se)|0,c=c+Math.imul(T,ae)|0,l=l+Math.imul(S,ue)|0,u=u+Math.imul(S,ce)|0,u=u+Math.imul(x,ue)|0,c=c+Math.imul(x,ce)|0,l=l+Math.imul(w,fe)|0,u=u+Math.imul(w,pe)|0,u=u+Math.imul(k,fe)|0,c=c+Math.imul(k,pe)|0,l=l+Math.imul(v,me)|0,u=u+Math.imul(v,ge)|0,u=u+Math.imul(b,me)|0,c=c+Math.imul(b,ge)|0;var Te=(a+l|0)+((8191&u)<<13)|0;a=(c+(u>>>13)|0)+(Te>>>26)|0,Te&=67108863,l=Math.imul(L,J),u=Math.imul(L,Q),u=u+Math.imul(U,J)|0,c=Math.imul(U,Q),l=l+Math.imul(D,ee)|0,u=u+Math.imul(D,te)|0,u=u+Math.imul(F,ee)|0,c=c+Math.imul(F,te)|0,l=l+Math.imul(O,re)|0,u=u+Math.imul(O,ie)|0,u=u+Math.imul(P,re)|0,c=c+Math.imul(P,ie)|0,l=l+Math.imul(j,se)|0,u=u+Math.imul(j,ae)|0,u=u+Math.imul(R,se)|0,c=c+Math.imul(R,ae)|0,l=l+Math.imul(A,ue)|0,u=u+Math.imul(A,ce)|0,u=u+Math.imul(T,ue)|0,c=c+Math.imul(T,ce)|0,l=l+Math.imul(S,fe)|0,u=u+Math.imul(S,pe)|0,u=u+Math.imul(x,fe)|0,c=c+Math.imul(x,pe)|0,l=l+Math.imul(w,me)|0,u=u+Math.imul(w,ge)|0,u=u+Math.imul(k,me)|0,c=c+Math.imul(k,ge)|0;var Ie=(a+l|0)+((8191&u)<<13)|0;a=(c+(u>>>13)|0)+(Ie>>>26)|0,Ie&=67108863,l=Math.imul(L,ee),u=Math.imul(L,te),u=u+Math.imul(U,ee)|0,c=Math.imul(U,te),l=l+Math.imul(D,re)|0,u=u+Math.imul(D,ie)|0,u=u+Math.imul(F,re)|0,c=c+Math.imul(F,ie)|0,l=l+Math.imul(O,se)|0,u=u+Math.imul(O,ae)|0,u=u+Math.imul(P,se)|0,c=c+Math.imul(P,ae)|0,l=l+Math.imul(j,ue)|0,u=u+Math.imul(j,ce)|0,u=u+Math.imul(R,ue)|0,c=c+Math.imul(R,ce)|0,l=l+Math.imul(A,fe)|0,u=u+Math.imul(A,pe)|0,u=u+Math.imul(T,fe)|0,c=c+Math.imul(T,pe)|0,l=l+Math.imul(S,me)|0,u=u+Math.imul(S,ge)|0,u=u+Math.imul(x,me)|0,c=c+Math.imul(x,ge)|0;var je=(a+l|0)+((8191&u)<<13)|0;a=(c+(u>>>13)|0)+(je>>>26)|0,je&=67108863,l=Math.imul(L,re),u=Math.imul(L,ie),u=u+Math.imul(U,re)|0,c=Math.imul(U,ie),l=l+Math.imul(D,se)|0,u=u+Math.imul(D,ae)|0,u=u+Math.imul(F,se)|0,c=c+Math.imul(F,ae)|0,l=l+Math.imul(O,ue)|0,u=u+Math.imul(O,ce)|0,u=u+Math.imul(P,ue)|0,c=c+Math.imul(P,ce)|0,l=l+Math.imul(j,fe)|0,u=u+Math.imul(j,pe)|0,u=u+Math.imul(R,fe)|0,c=c+Math.imul(R,pe)|0,l=l+Math.imul(A,me)|0,u=u+Math.imul(A,ge)|0,u=u+Math.imul(T,me)|0,c=c+Math.imul(T,ge)|0;var Re=(a+l|0)+((8191&u)<<13)|0;a=(c+(u>>>13)|0)+(Re>>>26)|0,Re&=67108863,l=Math.imul(L,se),u=Math.imul(L,ae),u=u+Math.imul(U,se)|0,c=Math.imul(U,ae),l=l+Math.imul(D,ue)|0,u=u+Math.imul(D,ce)|0,u=u+Math.imul(F,ue)|0,c=c+Math.imul(F,ce)|0,l=l+Math.imul(O,fe)|0,u=u+Math.imul(O,pe)|0,u=u+Math.imul(P,fe)|0,c=c+Math.imul(P,pe)|0,l=l+Math.imul(j,me)|0,u=u+Math.imul(j,ge)|0,u=u+Math.imul(R,me)|0,c=c+Math.imul(R,ge)|0;var Be=(a+l|0)+((8191&u)<<13)|0;a=(c+(u>>>13)|0)+(Be>>>26)|0,Be&=67108863,l=Math.imul(L,ue),u=Math.imul(L,ce),u=u+Math.imul(U,ue)|0,c=Math.imul(U,ce),l=l+Math.imul(D,fe)|0,u=u+Math.imul(D,pe)|0,u=u+Math.imul(F,fe)|0,c=c+Math.imul(F,pe)|0,l=l+Math.imul(O,me)|0,u=u+Math.imul(O,ge)|0,u=u+Math.imul(P,me)|0,c=c+Math.imul(P,ge)|0;var Oe=(a+l|0)+((8191&u)<<13)|0;a=(c+(u>>>13)|0)+(Oe>>>26)|0,Oe&=67108863,l=Math.imul(L,fe),u=Math.imul(L,pe),u=u+Math.imul(U,fe)|0,c=Math.imul(U,pe),l=l+Math.imul(D,me)|0,u=u+Math.imul(D,ge)|0,u=u+Math.imul(F,me)|0,c=c+Math.imul(F,ge)|0;var Pe=(a+l|0)+((8191&u)<<13)|0;a=(c+(u>>>13)|0)+(Pe>>>26)|0,Pe&=67108863,l=Math.imul(L,me),u=Math.imul(L,ge),u=u+Math.imul(U,me)|0,c=Math.imul(U,ge);var Ne=(a+l|0)+((8191&u)<<13)|0;return a=(c+(u>>>13)|0)+(Ne>>>26)|0,Ne&=67108863,s[0]=ye,s[1]=ve,s[2]=be,s[3]=_e,s[4]=we,s[5]=ke,s[6]=Ee,s[7]=Se,s[8]=xe,s[9]=Ce,s[10]=Ae,s[11]=Te,s[12]=Ie,s[13]=je,s[14]=Re,s[15]=Be,s[16]=Oe,s[17]=Pe,s[18]=Ne,0!==a&&(s[19]=a,r.length++),r};function m(e,t,n){n.negative=t.negative^e.negative,n.length=e.length+t.length;for(var r=0,i=0,o=0;o>>26)|0,i+=s>>>26,s&=67108863}n.words[o]=a,r=s,s=i}return 0!==r?n.words[o]=r:n.length--,n.strip()}function g(e,t,n){var r=new y;return r.mulp(e,t,n)}function y(e,t){this.x=e,this.y=t}Math.imul||(d=p),o.prototype.mulTo=function e(t,n){var r,i=this.length+t.length;return r=10===this.length&&10===t.length?d(this,t,n):i<63?p(this,t,n):i<1024?m(this,t,n):g(this,t,n),r},y.prototype.makeRBT=function e(t){for(var n=new Array(t),r=o.prototype._countBits(t)-1,i=0;i>=1;return i},y.prototype.permute=function e(t,n,r,i,o,s){for(var a=0;a>>=1)o++;return 1<>>=13,i[2*a+1]=8191&s,s>>>=13;for(a=2*n;a>=26,n+=o/67108864|0,n+=s>>>26,this.words[i]=67108863&s}return 0!==n&&(this.words[i]=n,this.length++),this},o.prototype.muln=function e(t){return this.clone().imuln(t)},o.prototype.sqr=function e(){return this.mul(this)},o.prototype.isqr=function e(){return this.imul(this.clone())},o.prototype.pow=function e(t){var n=f(t);if(0===n.length)return new o(1);for(var r=this,i=0;i=0);var n=t%26,i=(t-n)/26,o=67108863>>>26-n<<26-n,s;if(0!==n){var a=0;for(s=0;s>>26-n}a&&(this.words[s]=a,this.length++)}if(0!==i){for(s=this.length-1;s>=0;s--)this.words[s+i]=this.words[s];for(s=0;s=0),o=n?(n-n%26)/26:0;var s=t%26,a=Math.min((t-s)/26,this.length),l=67108863^67108863>>>s<a)for(this.length-=a,c=0;c=0&&(0!==h||c>=o);c--){var f=0|this.words[c];this.words[c]=h<<26-s|f>>>s,h=f&l}return u&&0!==h&&(u.words[u.length++]=h),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},o.prototype.ishrn=function e(t,n,i){return r(0===this.negative),this.iushrn(t,n,i)},o.prototype.shln=function e(t){return this.clone().ishln(t)},o.prototype.ushln=function e(t){return this.clone().iushln(t)},o.prototype.shrn=function e(t){return this.clone().ishrn(t)},o.prototype.ushrn=function e(t){return this.clone().iushrn(t)},o.prototype.testn=function e(t){r("number"==typeof t&&t>=0);var n=t%26,i=(t-n)/26,o=1<=0);var n=t%26,i=(t-n)/26;if(r(0===this.negative,"imaskn works only with positive numbers"),this.length<=i)return this;if(0!==n&&i++,this.length=Math.min(i,this.length),0!==n){var o=67108863^67108863>>>n<=67108864;n++)this.words[n]-=67108864,n===this.length-1?this.words[n+1]=1:this.words[n+1]++;return this.length=Math.max(this.length,n+1),this},o.prototype.isubn=function e(t){if(r("number"==typeof t),r(t<67108864),t<0)return this.iaddn(-t);if(0!==this.negative)return this.negative=0,this.iaddn(t),this.negative=1,this;if(this.words[0]-=t,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var n=0;n>26)-(u/67108864|0),this.words[s+i]=67108863&a}for(;s>26,this.words[s+i]=67108863&a;if(0===l)return this.strip();for(r(-1===l),l=0,s=0;s>26,this.words[s]=67108863&a;return this.negative=1,this.strip()},o.prototype._wordDiv=function e(t,n){var r=this.length-t.length,i=this.clone(),s=t,a=0|s.words[s.length-1],l=this._countBits(a);r=26-l,0!==r&&(s=s.ushln(r),i.iushln(r),a=0|s.words[s.length-1]);var u=i.length-s.length,c;if("mod"!==n){c=new o(null),c.length=u+1,c.words=new Array(c.length);for(var h=0;h=0;p--){var d=67108864*(0|i.words[s.length+p])+(0|i.words[s.length+p-1]);for(d=Math.min(d/a|0,67108863),i._ishlnsubmul(s,d,p);0!==i.negative;)d--,i.negative=0,i._ishlnsubmul(s,1,p),i.isZero()||(i.negative^=1);c&&(c.words[p]=d)}return c&&c.strip(),i.strip(),"div"!==n&&0!==r&&i.iushrn(r),{div:c||null,mod:i}},o.prototype.divmod=function e(t,n,i){return r(!t.isZero()),this.isZero()?{div:new o(0),mod:new o(0)}:0!==this.negative&&0===t.negative?(l=this.neg().divmod(t,n),"mod"!==n&&(s=l.div.neg()),"div"!==n&&(a=l.mod.neg(),i&&0!==a.negative&&a.iadd(t)),{div:s,mod:a}):0===this.negative&&0!==t.negative?(l=this.divmod(t.neg(),n),"mod"!==n&&(s=l.div.neg()),{div:s,mod:l.mod}):0!=(this.negative&t.negative)?(l=this.neg().divmod(t.neg(),n),"div"!==n&&(a=l.mod.neg(),i&&0!==a.negative&&a.isub(t)),{div:l.div,mod:a}):t.length>this.length||this.cmp(t)<0?{div:new o(0),mod:this}:1===t.length?"div"===n?{div:this.divn(t.words[0]),mod:null}:"mod"===n?{div:null,mod:new o(this.modn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new o(this.modn(t.words[0]))}:this._wordDiv(t,n);var s,a,l},o.prototype.div=function e(t){return this.divmod(t,"div",!1).div},o.prototype.mod=function e(t){return this.divmod(t,"mod",!1).mod},o.prototype.umod=function e(t){return this.divmod(t,"mod",!0).mod},o.prototype.divRound=function e(t){var n=this.divmod(t);if(n.mod.isZero())return n.div;var r=0!==n.div.negative?n.mod.isub(t):n.mod,i=t.ushrn(1),o=t.andln(1),s=r.cmp(i);return s<0||1===o&&0===s?n.div:0!==n.div.negative?n.div.isubn(1):n.div.iaddn(1)},o.prototype.modn=function e(t){r(t<=67108863);for(var n=(1<<26)%t,i=0,o=this.length-1;o>=0;o--)i=(n*i+(0|this.words[o]))%t;return i},o.prototype.idivn=function e(t){r(t<=67108863);for(var n=0,i=this.length-1;i>=0;i--){var o=(0|this.words[i])+67108864*n;this.words[i]=o/t|0,n=o%t}return this.strip()},o.prototype.divn=function e(t){return this.clone().idivn(t)},o.prototype.egcd=function e(t){r(0===t.negative),r(!t.isZero());var n=this,i=t.clone();n=0!==n.negative?n.umod(t):n.clone();for(var s=new o(1),a=new o(0),l=new o(0),u=new o(1),c=0;n.isEven()&&i.isEven();)n.iushrn(1),i.iushrn(1),++c;for(var h=i.clone(),f=n.clone();!n.isZero();){for(var p=0,d=1;0==(n.words[0]&d)&&p<26;++p,d<<=1);if(p>0)for(n.iushrn(p);p-- >0;)(s.isOdd()||a.isOdd())&&(s.iadd(h),a.isub(f)),s.iushrn(1),a.iushrn(1);for(var m=0,g=1;0==(i.words[0]&g)&&m<26;++m,g<<=1);if(m>0)for(i.iushrn(m);m-- >0;)(l.isOdd()||u.isOdd())&&(l.iadd(h),u.isub(f)),l.iushrn(1),u.iushrn(1);n.cmp(i)>=0?(n.isub(i),s.isub(l),a.isub(u)):(i.isub(n),l.isub(s),u.isub(a))}return{a:l,b:u,gcd:i.iushln(c)}},o.prototype._invmp=function e(t){r(0===t.negative),r(!t.isZero());var n=this,i=t.clone();n=0!==n.negative?n.umod(t):n.clone();for(var s=new o(1),a=new o(0),l=i.clone(),u;n.cmpn(1)>0&&i.cmpn(1)>0;){for(var c=0,h=1;0==(n.words[0]&h)&&c<26;++c,h<<=1);if(c>0)for(n.iushrn(c);c-- >0;)s.isOdd()&&s.iadd(l),s.iushrn(1);for(var f=0,p=1;0==(i.words[0]&p)&&f<26;++f,p<<=1);if(f>0)for(i.iushrn(f);f-- >0;)a.isOdd()&&a.iadd(l),a.iushrn(1);n.cmp(i)>=0?(n.isub(i),s.isub(a)):(i.isub(n),a.isub(s))}return u=0===n.cmpn(1)?s:a,u.cmpn(0)<0&&u.iadd(t),u},o.prototype.gcd=function e(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var n=this.clone(),r=t.clone();n.negative=0,r.negative=0;for(var i=0;n.isEven()&&r.isEven();i++)n.iushrn(1),r.iushrn(1);for(;;){for(;n.isEven();)n.iushrn(1);for(;r.isEven();)r.iushrn(1);var o=n.cmp(r);if(o<0){var s=n;n=r,r=s}else if(0===o||0===r.cmpn(1))break;n.isub(r)}return r.iushln(i)},o.prototype.invm=function e(t){return this.egcd(t).a.umod(t)},o.prototype.isEven=function e(){return 0==(1&this.words[0])},o.prototype.isOdd=function e(){return 1==(1&this.words[0])},o.prototype.andln=function e(t){return this.words[0]&t},o.prototype.bincn=function e(t){r("number"==typeof t);var n=t%26,i=(t-n)/26,o=1<>>26,l&=67108863,this.words[a]=l}return 0!==s&&(this.words[a]=s,this.length++),this},o.prototype.isZero=function e(){return 1===this.length&&0===this.words[0]},o.prototype.cmpn=function e(t){var n=t<0,i;if(0!==this.negative&&!n)return-1;if(0===this.negative&&n)return 1;if(this.strip(),this.length>1)i=1;else{n&&(t=-t),r(t<=67108863,"Number is too big");var o=0|this.words[0];i=o===t?0:ot.length)return 1;if(this.length=0;r--){var i=0|this.words[r],o=0|t.words[r];if(i!==o){io&&(n=1);break}}return n},o.prototype.gtn=function e(t){return 1===this.cmpn(t)},o.prototype.gt=function e(t){return 1===this.cmp(t)},o.prototype.gten=function e(t){return this.cmpn(t)>=0},o.prototype.gte=function e(t){return this.cmp(t)>=0},o.prototype.ltn=function e(t){return-1===this.cmpn(t)},o.prototype.lt=function e(t){return-1===this.cmp(t)},o.prototype.lten=function e(t){return this.cmpn(t)<=0},o.prototype.lte=function e(t){return this.cmp(t)<=0},o.prototype.eqn=function e(t){return 0===this.cmpn(t)},o.prototype.eq=function e(t){return 0===this.cmp(t)},o.red=function e(t){return new S(t)},o.prototype.toRed=function e(t){return r(!this.red,"Already a number in reduction context"),r(0===this.negative,"red works only with positives"),t.convertTo(this)._forceRed(t)},o.prototype.fromRed=function e(){return r(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},o.prototype._forceRed=function e(t){return this.red=t,this},o.prototype.forceRed=function e(t){return r(!this.red,"Already a number in reduction context"),this._forceRed(t)},o.prototype.redAdd=function e(t){return r(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},o.prototype.redIAdd=function e(t){return r(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},o.prototype.redSub=function e(t){return r(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},o.prototype.redISub=function e(t){return r(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},o.prototype.redShl=function e(t){return r(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},o.prototype.redMul=function e(t){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},o.prototype.redIMul=function e(t){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},o.prototype.redSqr=function e(){return r(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},o.prototype.redISqr=function e(){return r(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},o.prototype.redSqrt=function e(){return r(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},o.prototype.redInvm=function e(){return r(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},o.prototype.redNeg=function e(){return r(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},o.prototype.redPow=function e(t){return r(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var v={k256:null,p224:null,p192:null,p25519:null};function b(e,t){this.name=e,this.p=new o(t,16),this.n=this.p.bitLength(),this.k=new o(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function _(){b.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function w(){b.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function k(){b.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function E(){b.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function S(e){if("string"==typeof e){var t=o._prime(e);this.m=t.p,this.prime=t}else r(e.gtn(1),"modulus must be greater than 1"),this.m=e,this.prime=null}function x(e){S.call(this,e),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new o(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}b.prototype._tmp=function e(){var t=new o(null);return t.words=new Array(Math.ceil(this.n/13)),t},b.prototype.ireduce=function e(t){var n=t,r;do{this.split(n,this.tmp),n=this.imulK(n),n=n.iadd(this.tmp),r=n.bitLength()}while(r>this.n);var i=r0?n.isub(this.p):n.strip(),n},b.prototype.split=function e(t,n){t.iushrn(this.n,0,n)},b.prototype.imulK=function e(t){return t.imul(this.k)},i(_,b),_.prototype.split=function e(t,n){for(var r=4194303,i=Math.min(t.length,9),o=0;o>>22,s=a}s>>>=22,t.words[o-10]=s,0===s&&t.length>10?t.length-=10:t.length-=9},_.prototype.imulK=function e(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var n=0,r=0;r>>=26,t.words[r]=o,n=i}return 0!==n&&(t.words[t.length++]=n),t},o._prime=function e(t){if(v[t])return v[t];var e;if("k256"===t)e=new _;else if("p224"===t)e=new w;else if("p192"===t)e=new k;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new E}return v[t]=e,e},S.prototype._verify1=function e(t){r(0===t.negative,"red works only with positives"),r(t.red,"red works only with red numbers")},S.prototype._verify2=function e(t,n){r(0==(t.negative|n.negative),"red works only with positives"),r(t.red&&t.red===n.red,"red works only with red numbers")},S.prototype.imod=function e(t){return this.prime?this.prime.ireduce(t)._forceRed(this):t.umod(this.m)._forceRed(this)},S.prototype.neg=function e(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},S.prototype.add=function e(t,n){this._verify2(t,n);var r=t.add(n);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},S.prototype.iadd=function e(t,n){this._verify2(t,n);var r=t.iadd(n);return r.cmp(this.m)>=0&&r.isub(this.m),r},S.prototype.sub=function e(t,n){this._verify2(t,n);var r=t.sub(n);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},S.prototype.isub=function e(t,n){this._verify2(t,n);var r=t.isub(n);return r.cmpn(0)<0&&r.iadd(this.m),r},S.prototype.shl=function e(t,n){return this._verify1(t),this.imod(t.ushln(n))},S.prototype.imul=function e(t,n){return this._verify2(t,n),this.imod(t.imul(n))},S.prototype.mul=function e(t,n){return this._verify2(t,n),this.imod(t.mul(n))},S.prototype.isqr=function e(t){return this.imul(t,t.clone())},S.prototype.sqr=function e(t){return this.mul(t,t)},S.prototype.sqrt=function e(t){if(t.isZero())return t.clone();var n=this.m.andln(3);if(r(n%2==1),3===n){var i=this.m.add(new o(1)).iushrn(2);return this.pow(t,i)}for(var s=this.m.subn(1),a=0;!s.isZero()&&0===s.andln(1);)a++,s.iushrn(1);r(!s.isZero());var l=new o(1).toRed(this),u=l.redNeg(),c=this.m.subn(1).iushrn(1),h=this.m.bitLength();for(h=new o(2*h*h).toRed(this);0!==this.pow(h,c).cmp(u);)h.redIAdd(u);for(var f=this.pow(h,s),p=this.pow(t,s.addn(1).iushrn(1)),d=this.pow(t,s),m=a;0!==d.cmp(l);){for(var g=d,y=0;0!==g.cmp(l);y++)g=g.redSqr();r(y=0;s--){for(var h=n.words[s],f=c-1;f>=0;f--){var p=h>>f&1;a!==i[0]&&(a=this.sqr(a)),0!==p||0!==l?(l<<=1,l|=p,u++,(4===u||0===s&&0===f)&&(a=this.mul(a,i[l]),u=0,l=0)):u=0}c=26}return a},S.prototype.convertTo=function e(t){var n=t.umod(this.m);return n===t?n.clone():n},S.prototype.convertFrom=function e(t){var n=t.clone();return n.red=null,n},o.mont=function e(t){return new x(t)},i(x,S),x.prototype.convertTo=function e(t){return this.imod(t.ushln(this.shift))},x.prototype.convertFrom=function e(t){var n=this.imod(t.mul(this.rinv));return n.red=null,n},x.prototype.imul=function e(t,n){if(t.isZero()||n.isZero())return t.words[0]=0,t.length=1,t;var r=t.imul(n),i=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),o=r.isub(i).iushrn(this.shift),s=o;return o.cmp(this.m)>=0?s=o.isub(this.m):o.cmpn(0)<0&&(s=o.iadd(this.m)),s._forceRed(this)},x.prototype.mul=function e(t,n){if(t.isZero()||n.isZero())return new o(0)._forceRed(this);var r=t.mul(n),i=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),s=r.isub(i).iushrn(this.shift),a=s;return s.cmp(this.m)>=0?a=s.isub(this.m):s.cmpn(0)<0&&(a=s.iadd(this.m)),a._forceRed(this)},x.prototype.invm=function e(t){var n=this.imod(t._invmp(this.m).mul(this.r2));return n._forceRed(this)}}(e,this)}).call(this,n(85)(e))},function(e,t){},function(e,t,n){"use strict";const r=n(119),i=n(3),o=t;function s(e,t){this.name=e,this.body=t,this.decoders={},this.encoders={}}o.define=function e(t,n){return new s(t,n)},s.prototype._createNamed=function e(t){const n=this.name;function r(e){this._initNamed(e,n)}return i(r,t),r.prototype._initNamed=function e(n,r){t.call(this,n,r)},new r(this)},s.prototype._getDecoder=function e(t){return t=t||"der",this.decoders.hasOwnProperty(t)||(this.decoders[t]=this._createNamed(r.decoders[t])),this.decoders[t]},s.prototype.decode=function e(t,n,r){return this._getDecoder(n).decode(t,r)},s.prototype._getEncoder=function e(t){return t=t||"der",this.encoders.hasOwnProperty(t)||(this.encoders[t]=this._createNamed(r.encoders[t])),this.encoders[t]},s.prototype.encode=function e(t,n,r){return this._getEncoder(n).encode(t,r)}},function(e,t,n){"use strict";const r=n(3);function i(e){this._reporterState={obj:null,path:[],options:e||{},errors:[]}}function o(e,t){this.path=e,this.rethrow(t)}t.Reporter=i,i.prototype.isError=function e(t){return t instanceof o},i.prototype.save=function e(){const t=this._reporterState;return{obj:t.obj,pathLen:t.path.length}},i.prototype.restore=function e(t){const n=this._reporterState;n.obj=t.obj,n.path=n.path.slice(0,t.pathLen)},i.prototype.enterKey=function e(t){return this._reporterState.path.push(t)},i.prototype.exitKey=function e(t){const n=this._reporterState;n.path=n.path.slice(0,t-1)},i.prototype.leaveKey=function e(t,n,r){const i=this._reporterState;this.exitKey(t),null!==i.obj&&(i.obj[n]=r)},i.prototype.path=function e(){return this._reporterState.path.join("/")},i.prototype.enterObject=function e(){const t=this._reporterState,n=t.obj;return t.obj={},n},i.prototype.leaveObject=function e(t){const n=this._reporterState,r=n.obj;return n.obj=t,r},i.prototype.error=function e(t){let n;const r=this._reporterState,i=t instanceof o;if(n=i?t:new o(r.path.map(function(e){return"["+JSON.stringify(e)+"]"}).join(""),t.message||t,t.stack),!r.options.partial)throw n;return i||r.errors.push(n),n},i.prototype.wrapResult=function e(t){const n=this._reporterState;return n.options.partial?{result:this.isError(t)?null:t,errors:n.errors}:t},r(o,Error),o.prototype.rethrow=function e(t){if(this.message=t+" at: "+(this.path||"(shallow)"),Error.captureStackTrace&&Error.captureStackTrace(this,o),!this.stack)try{throw new Error(this.message)}catch(e){this.stack=e.stack}return this}},function(e,t,n){"use strict";const r=n(151).Reporter,i=n(151).EncoderBuffer,o=n(151).DecoderBuffer,s=n(750),a=["seq","seqof","set","setof","objid","bool","gentime","utctime","null_","enum","int","objDesc","bitstr","bmpstr","charstr","genstr","graphstr","ia5str","iso646str","numstr","octstr","printstr","t61str","unistr","utf8str","videostr"],l=["key","obj","use","optional","explicit","implicit","def","choice","any","contains"].concat(a),u=["_peekTag","_decodeTag","_use","_decodeStr","_decodeObjid","_decodeTime","_decodeNull","_decodeInt","_decodeBool","_decodeList","_encodeComposite","_encodeStr","_encodeObjid","_encodeTime","_encodeNull","_encodeInt","_encodeBool"];function c(e,t,n){const r={};this._baseState=r,r.name=n,r.enc=e,r.parent=t||null,r.children=null,r.tag=null,r.args=null,r.reverseArgs=null,r.choice=null,r.optional=!1,r.any=!1,r.obj=!1,r.use=null,r.useDecoder=null,r.key=null,r.default=null,r.explicit=null,r.implicit=null,r.contains=null,r.parent||(r.children=[],this._wrap())}e.exports=c;const h=["enc","parent","children","tag","args","reverseArgs","choice","optional","any","obj","use","alteredUse","key","default","explicit","implicit","contains"];c.prototype.clone=function e(){const t=this._baseState,n={};h.forEach(function(e){n[e]=t[e]});const r=new this.constructor(n.parent);return r._baseState=n,r},c.prototype._wrap=function e(){const t=this._baseState;l.forEach(function(e){this[e]=function n(){const r=new this.constructor(this);return t.children.push(r),r[e].apply(r,arguments)}},this)},c.prototype._init=function e(t){const n=this._baseState;s(null===n.parent),t.call(this),n.children=n.children.filter(function(e){return e._baseState.parent===this},this),s.equal(n.children.length,1,"Root node can have only one child")},c.prototype._useArgs=function e(t){const n=this._baseState,r=t.filter(function(e){return e instanceof this.constructor},this);t=t.filter(function(e){return!(e instanceof this.constructor)},this),0!==r.length&&(s(null===n.children),n.children=r,r.forEach(function(e){e._baseState.parent=this},this)),0!==t.length&&(s(null===n.args),n.args=t,n.reverseArgs=t.map(function(e){if("object"!=typeof e||e.constructor!==Object)return e;const t={};return Object.keys(e).forEach(function(n){n==(0|n)&&(n|=0);const r=e[n];t[r]=n}),t}))},u.forEach(function(e){c.prototype[e]=function t(){const n=this._baseState;throw new Error(e+" not implemented for encoding: "+n.enc)}}),a.forEach(function(e){c.prototype[e]=function t(){const n=this._baseState,r=Array.prototype.slice.call(arguments);return s(null===n.tag),n.tag=e,this._useArgs(r),this}}),c.prototype.use=function e(t){s(t);const n=this._baseState;return s(null===n.use),n.use=t,this},c.prototype.optional=function e(){const t=this._baseState;return t.optional=!0,this},c.prototype.def=function e(t){const n=this._baseState;return s(null===n.default),n.default=t,n.optional=!0,this},c.prototype.explicit=function e(t){const n=this._baseState;return s(null===n.explicit&&null===n.implicit),n.explicit=t,this},c.prototype.implicit=function e(t){const n=this._baseState;return s(null===n.explicit&&null===n.implicit),n.implicit=t,this},c.prototype.obj=function e(){const t=this._baseState,n=Array.prototype.slice.call(arguments);return t.obj=!0,0!==n.length&&this._useArgs(n),this},c.prototype.key=function e(t){const n=this._baseState;return s(null===n.key),n.key=t,this},c.prototype.any=function e(){const t=this._baseState;return t.any=!0,this},c.prototype.choice=function e(t){const n=this._baseState;return s(null===n.choice),n.choice=t,this._useArgs(Object.keys(t).map(function(e){return t[e]})),this},c.prototype.contains=function e(t){const n=this._baseState;return s(null===n.use),n.contains=t,this},c.prototype._decode=function e(t,n){const r=this._baseState;if(null===r.parent)return t.wrapResult(r.children[0]._decode(t,n));let i=r.default,s=!0,a=null,l;if(null!==r.key&&(a=t.enterKey(r.key)),r.optional){let e=null;if(null!==r.explicit?e=r.explicit:null!==r.implicit?e=r.implicit:null!==r.tag&&(e=r.tag),null!==e||r.any){if(s=this._peekTag(t,e,r.any),t.isError(s))return s}else{const e=t.save();try{null===r.choice?this._decodeGeneric(r.tag,t,n):this._decodeChoice(t,n),s=!0}catch(e){s=!1}t.restore(e)}}if(r.obj&&s&&(l=t.enterObject()),s){if(null!==r.explicit){const e=this._decodeTag(t,r.explicit);if(t.isError(e))return e;t=e}const e=t.offset;if(null===r.use&&null===r.choice){let e;r.any&&(e=t.save());const n=this._decodeTag(t,null!==r.implicit?r.implicit:r.tag,r.any);if(t.isError(n))return n;r.any?i=t.raw(e):t=n}if(n&&n.track&&null!==r.tag&&n.track(t.path(),e,t.length,"tagged"),n&&n.track&&null!==r.tag&&n.track(t.path(),t.offset,t.length,"content"),r.any||(i=null===r.choice?this._decodeGeneric(r.tag,t,n):this._decodeChoice(t,n)),t.isError(i))return i;if(r.any||null!==r.choice||null===r.children||r.children.forEach(function e(r){r._decode(t,n)}),r.contains&&("octstr"===r.tag||"bitstr"===r.tag)){const e=new o(i);i=this._getUse(r.contains,t._reporterState.obj)._decode(e,n)}}return r.obj&&s&&(i=t.leaveObject(l)),null===r.key||null===i&&!0!==s?null!==a&&t.exitKey(a):t.leaveKey(a,r.key,i),i},c.prototype._decodeGeneric=function e(t,n,r){const i=this._baseState;return"seq"===t||"set"===t?null:"seqof"===t||"setof"===t?this._decodeList(n,t,i.args[0],r):/str$/.test(t)?this._decodeStr(n,t,r):"objid"===t&&i.args?this._decodeObjid(n,i.args[0],i.args[1],r):"objid"===t?this._decodeObjid(n,null,null,r):"gentime"===t||"utctime"===t?this._decodeTime(n,t,r):"null_"===t?this._decodeNull(n,r):"bool"===t?this._decodeBool(n,r):"objDesc"===t?this._decodeStr(n,t,r):"int"===t||"enum"===t?this._decodeInt(n,i.args&&i.args[0],r):null!==i.use?this._getUse(i.use,n._reporterState.obj)._decode(n,r):n.error("unknown tag: "+t)},c.prototype._getUse=function e(t,n){const r=this._baseState;return r.useDecoder=this._use(t,n),s(null===r.useDecoder._baseState.parent),r.useDecoder=r.useDecoder._baseState.children[0],r.implicit!==r.useDecoder._baseState.implicit&&(r.useDecoder=r.useDecoder.clone(),r.useDecoder._baseState.implicit=r.implicit),r.useDecoder},c.prototype._decodeChoice=function e(t,n){const r=this._baseState;let i=null,o=!1;return Object.keys(r.choice).some(function(e){const s=t.save(),a=r.choice[e];try{const r=a._decode(t,n);if(t.isError(r))return!1;i={type:e,value:r},o=!0}catch(e){return t.restore(s),!1}return!0},this),o?i:t.error("Choice not matched")},c.prototype._createEncoderBuffer=function e(t){return new i(t,this.reporter)},c.prototype._encode=function e(t,n,r){const i=this._baseState;if(null!==i.default&&i.default===t)return;const o=this._encodeValue(t,n,r);return void 0===o||this._skipDefault(o,n,r)?void 0:o},c.prototype._encodeValue=function e(t,n,i){const o=this._baseState;if(null===o.parent)return o.children[0]._encode(t,n||new r);let s=null;if(this.reporter=n,o.optional&&void 0===t){if(null===o.default)return;t=o.default}let a=null,l=!1;if(o.any)s=this._createEncoderBuffer(t);else if(o.choice)s=this._encodeChoice(t,n);else if(o.contains)a=this._getUse(o.contains,i)._encode(t,n),l=!0;else if(o.children)a=o.children.map(function(e){if("null_"===e._baseState.tag)return e._encode(null,n,t);if(null===e._baseState.key)return n.error("Child should have a key");const r=n.enterKey(e._baseState.key);if("object"!=typeof t)return n.error("Child expected, but input is not object");const i=e._encode(t[e._baseState.key],n,t);return n.leaveKey(r),i},this).filter(function(e){return e}),a=this._createEncoderBuffer(a);else if("seqof"===o.tag||"setof"===o.tag){if(!o.args||1!==o.args.length)return n.error("Too many args for : "+o.tag);if(!Array.isArray(t))return n.error("seqof/setof, but data is not Array");const e=this.clone();e._baseState.implicit=null,a=this._createEncoderBuffer(t.map(function(e){const r=this._baseState;return this._getUse(r.args[0],t)._encode(e,n)},e))}else null!==o.use?s=this._getUse(o.use,i)._encode(t,n):(a=this._encodePrimitive(o.tag,t),l=!0);if(!o.any&&null===o.choice){const e=null!==o.implicit?o.implicit:o.tag,t=null===o.implicit?"universal":"context";null===e?null===o.use&&n.error("Tag could be omitted only for .use()"):null===o.use&&(s=this._encodeComposite(e,l,t,a))}return null!==o.explicit&&(s=this._encodeComposite(o.explicit,!1,"context",s)),s},c.prototype._encodeChoice=function e(t,n){const r=this._baseState,i=r.choice[t.type];return i||s(!1,t.type+" not found in "+JSON.stringify(Object.keys(r.choice))),i._encode(t.value,n)},c.prototype._encodePrimitive=function e(t,n){const r=this._baseState;if(/str$/.test(t))return this._encodeStr(n,t);if("objid"===t&&r.args)return this._encodeObjid(n,r.reverseArgs[0],r.args[1]);if("objid"===t)return this._encodeObjid(n,null,null);if("gentime"===t||"utctime"===t)return this._encodeTime(n,t);if("null_"===t)return this._encodeNull();if("int"===t||"enum"===t)return this._encodeInt(n,r.args&&r.reverseArgs[0]);if("bool"===t)return this._encodeBool(n);if("objDesc"===t)return this._encodeStr(n,t);throw new Error("Unsupported tag: "+t)},c.prototype._isNumstr=function e(t){return/^[0-9 ]*$/.test(t)},c.prototype._isPrintstr=function e(t){return/^[A-Za-z0-9 '()+,-./:=?]*$/.test(t)}},function(e,t){function n(e,t){if(!e)throw new Error(t||"Assertion failed")}e.exports=n,n.equal=function e(t,n,r){if(t!=n)throw new Error(r||"Assertion failed: "+t+" != "+n)}},function(e,t,n){"use strict";const r=n(373);t.tagClass={0:"universal",1:"application",2:"context",3:"private"},t.tagClassByName=r._reverse(t.tagClass),t.tag={0:"end",1:"bool",2:"int",3:"bitstr",4:"octstr",5:"null_",6:"objid",7:"objDesc",8:"external",9:"real",10:"enum",11:"embed",12:"utf8str",13:"relativeOid",16:"seq",17:"set",18:"numstr",19:"printstr",20:"t61str",21:"videostr",22:"ia5str",23:"utctime",24:"gentime",25:"graphstr",26:"iso646str",27:"genstr",28:"unistr",29:"charstr",30:"bmpstr"},t.tagByName=r._reverse(t.tag)},function(e,t,n){"use strict";const r=t;r.der=n(374),r.pem=n(753)},function(e,t,n){"use strict";const r=n(3),i=n(0).Buffer,o=n(374);function s(e){o.call(this,e),this.enc="pem"}r(s,o),e.exports=s,s.prototype.decode=function e(t,n){const r=t.toString().split(/[\r\n]+/g),s=n.label.toUpperCase(),a=/^-----(BEGIN|END) ([^-]+)-----$/;let l=-1,u=-1;for(let e=0;e>>0,s>>>0];for(var a=p.fullMessageLength.length-1;a>=0;--a)p.fullMessageLength[a]+=s[1],s[1]=s[0]+(p.fullMessageLength[a]/4294967296>>>0),p.fullMessageLength[a]=p.fullMessageLength[a]>>>0,s[0]=s[1]/4294967296>>>0;return i.putBytes(e),h(n,o,i),(i.read>2048||0===i.length())&&i.compact(),p},p.digest=function(){var t=r.util.createBuffer();t.putBytes(i.bytes());var a=p.fullMessageLength[p.fullMessageLength.length-1]+p.messageLengthSize,l=a&p.blockLength-1,u,c;t.putBytes(s.substr(0,p.blockLength-l));for(var f=8*p.fullMessageLength[0],d=0;d>>0,f+=c,t.putInt32(f>>>0),f=u>>>0;t.putInt32(f);for(var m=new Array(n.length),d=0;d=128;){for(B=0;B<16;++B)t[B][0]=n.getInt32()>>>0,t[B][1]=n.getInt32()>>>0;for(;B<80;++B)N=t[B-2],O=N[0],P=N[1],r=((O>>>19|P<<13)^(P>>>29|O<<3)^O>>>6)>>>0,i=((O<<13|P>>>19)^(P<<3|O>>>29)^(O<<26|P>>>6))>>>0,F=t[B-15],O=F[0],P=F[1],o=((O>>>1|P<<31)^(O>>>8|P<<24)^O>>>7)>>>0,s=((O<<31|P>>>1)^(O<<24|P>>>8)^(O<<25|P>>>7))>>>0,D=t[B-7],M=t[B-16],P=i+D[1]+s+M[1],t[B][0]=r+D[0]+o+M[0]+(P/4294967296>>>0)>>>0,t[B][1]=P>>>0;for(g=e[0][0],y=e[0][1],v=e[1][0],b=e[1][1],_=e[2][0],w=e[2][1],k=e[3][0],E=e[3][1],S=e[4][0],x=e[4][1],C=e[5][0],A=e[5][1],T=e[6][0],I=e[6][1],j=e[7][0],R=e[7][1],B=0;B<80;++B)c=((S>>>14|x<<18)^(S>>>18|x<<14)^(x>>>9|S<<23))>>>0,h=((S<<18|x>>>14)^(S<<14|x>>>18)^(x<<23|S>>>9))>>>0,f=(T^S&(C^T))>>>0,p=(I^x&(A^I))>>>0,a=((g>>>28|y<<4)^(y>>>2|g<<30)^(y>>>7|g<<25))>>>0,u=((g<<4|y>>>28)^(y<<30|g>>>2)^(y<<25|g>>>7))>>>0,d=(g&v|_&(g^v))>>>0,m=(y&b|w&(y^b))>>>0,P=R+h+p+l[B][1]+t[B][1],r=j+c+f+l[B][0]+t[B][0]+(P/4294967296>>>0)>>>0,i=P>>>0,P=u+m,o=a+d+(P/4294967296>>>0)>>>0,s=P>>>0,j=T,R=I,T=C,I=A,C=S,A=x,P=E+i,S=k+r+(P/4294967296>>>0)>>>0,x=P>>>0,k=_,E=w,_=v,w=b,v=g,b=y,P=i+s,g=r+o+(P/4294967296>>>0)>>>0,y=P>>>0;P=e[0][1]+y,e[0][0]=e[0][0]+g+(P/4294967296>>>0)>>>0,e[0][1]=P>>>0,P=e[1][1]+b,e[1][0]=e[1][0]+v+(P/4294967296>>>0)>>>0,e[1][1]=P>>>0,P=e[2][1]+w,e[2][0]=e[2][0]+_+(P/4294967296>>>0)>>>0,e[2][1]=P>>>0,P=e[3][1]+E,e[3][0]=e[3][0]+k+(P/4294967296>>>0)>>>0,e[3][1]=P>>>0,P=e[4][1]+x,e[4][0]=e[4][0]+S+(P/4294967296>>>0)>>>0,e[4][1]=P>>>0,P=e[5][1]+A,e[5][0]=e[5][0]+C+(P/4294967296>>>0)>>>0,e[5][1]=P>>>0,P=e[6][1]+I,e[6][0]=e[6][0]+T+(P/4294967296>>>0)>>>0,e[6][1]=P>>>0,P=e[7][1]+R,e[7][0]=e[7][0]+j+(P/4294967296>>>0)>>>0,e[7][1]=P>>>0,L-=128}}},function(e,t,n){"use strict";(function(t){const r=n(54),i=n(55),o=n(70),s=n(758),a=i(n(247));class l{constructor(e){this._key=m(e,s.publicKeyLength)}verify(e,t,n){d(n),s.hashAndVerify(this._key,t,e,n)}marshal(){return t.from(this._key)}get bytes(){return a.PublicKey.encode({Type:a.KeyType.Ed25519,Data:this.marshal()})}equals(e){return this.bytes.equals(e.bytes)}hash(e){d(e),r(this.bytes,"sha2-256",e)}}class u{constructor(e,t){this._key=m(e,s.privateKeyLength),this._publicKey=m(t,s.publicKeyLength)}sign(e,t){d(t),s.hashAndSign(this._key,e,t)}get public(){if(!this._publicKey)throw new Error("public key not provided");return new l(this._publicKey)}marshal(){return t.concat([t.from(this._key),t.from(this._publicKey)])}get bytes(){return a.PrivateKey.encode({Type:a.KeyType.Ed25519,Data:this.marshal()})}equals(e){return this.bytes.equals(e.bytes)}hash(e){d(e),r(this.bytes,"sha2-256",e)}id(e){this.public.hash((t,n)=>{if(t)return e(t);e(null,o.encode(n))})}}function c(e,t){try{e=m(e,s.privateKeyLength+s.publicKeyLength)}catch(e){return t(e)}const n=e.slice(0,s.privateKeyLength),r=e.slice(s.privateKeyLength,e.length);t(null,new u(n,r))}function h(e){return e=m(e,s.publicKeyLength),new l(e)}function f(e,t){void 0===t&&"function"==typeof e&&(t=e),s.generateKey((e,n)=>{if(e)return t(e);let r;try{r=new u(n.secretKey,n.publicKey)}catch(e){return void t(e)}t(null,r)})}function p(e,t,n){void 0===n&&"function"==typeof t&&(n=t),s.generateKeyFromSeed(e,(e,t)=>{if(e)return n(e);let r;try{r=new u(t.secretKey,t.publicKey)}catch(e){return void n(e)}n(null,r)})}function d(e){if("function"!=typeof e)throw new Error("callback is required")}function m(e,n){if(t.isBuffer(e)&&(e=new Uint8Array(e)),!(e instanceof Uint8Array)||e.length!==n)throw new Error("Key must be a Uint8Array or Buffer of length "+n);return e}e.exports={Ed25519PublicKey:l,Ed25519PrivateKey:u,unmarshalEd25519PrivateKey:c,unmarshalEd25519PublicKey:h,generateKeyPair:f,generateKeyPairFromSeed:p}}).call(this,n(0).Buffer)},function(e,t,n){"use strict";(function(e){const r=n(759),i=n(47);t.publicKeyLength=r.sign.publicKeyLength,t.privateKeyLength=r.sign.secretKeyLength,t.generateKey=function(e){i(()=>{let t;try{t=r.sign.keyPair()}catch(t){return e(t)}e(null,t)})},t.generateKeyFromSeed=function(e,t){i(()=>{let n;try{n=r.sign.keyPair.fromSeed(e)}catch(e){return t(e)}t(null,n)})},t.hashAndSign=function(t,n,o){i(()=>{o(null,e.from(r.sign.detached(n,t)))})},t.hashAndVerify=function(e,t,n,o){i(()=>{let i;try{i=r.sign.detached.verify(n,t,e)}catch(e){return o(e)}o(null,i)})}}).call(this,n(0).Buffer)},function(e,t,n){!function(e){"use strict";var t=function(e){var t,n=new Float64Array(16);if(e)for(t=0;t>24&255,e[t+1]=n>>16&255,e[t+2]=n>>8&255,e[t+3]=255&n,e[t+4]=r>>24&255,e[t+5]=r>>16&255,e[t+6]=r>>8&255,e[t+7]=255&r}function m(e,t,n,r,i){var o,s=0;for(o=0;o>>8)-1}function g(e,t,n,r){return m(e,t,n,r,16)}function y(e,t,n,r){return m(e,t,n,r,32)}function v(e,t,n,r){for(var i=255&r[0]|(255&r[1])<<8|(255&r[2])<<16|(255&r[3])<<24,o=255&n[0]|(255&n[1])<<8|(255&n[2])<<16|(255&n[3])<<24,s=255&n[4]|(255&n[5])<<8|(255&n[6])<<16|(255&n[7])<<24,a=255&n[8]|(255&n[9])<<8|(255&n[10])<<16|(255&n[11])<<24,l=255&n[12]|(255&n[13])<<8|(255&n[14])<<16|(255&n[15])<<24,u=255&r[4]|(255&r[5])<<8|(255&r[6])<<16|(255&r[7])<<24,c=255&t[0]|(255&t[1])<<8|(255&t[2])<<16|(255&t[3])<<24,h=255&t[4]|(255&t[5])<<8|(255&t[6])<<16|(255&t[7])<<24,f=255&t[8]|(255&t[9])<<8|(255&t[10])<<16|(255&t[11])<<24,p=255&t[12]|(255&t[13])<<8|(255&t[14])<<16|(255&t[15])<<24,d=255&r[8]|(255&r[9])<<8|(255&r[10])<<16|(255&r[11])<<24,m=255&n[16]|(255&n[17])<<8|(255&n[18])<<16|(255&n[19])<<24,g=255&n[20]|(255&n[21])<<8|(255&n[22])<<16|(255&n[23])<<24,y=255&n[24]|(255&n[25])<<8|(255&n[26])<<16|(255&n[27])<<24,v=255&n[28]|(255&n[29])<<8|(255&n[30])<<16|(255&n[31])<<24,b=255&r[12]|(255&r[13])<<8|(255&r[14])<<16|(255&r[15])<<24,_=i,w=o,k=s,E=a,S=l,x=u,C=c,A=h,T=f,I=p,j=d,R=m,B=g,O=y,P=v,N=b,D,F=0;F<20;F+=2)D=_+B|0,S^=D<<7|D>>>25,D=S+_|0,T^=D<<9|D>>>23,D=T+S|0,B^=D<<13|D>>>19,D=B+T|0,_^=D<<18|D>>>14,D=x+w|0,I^=D<<7|D>>>25,D=I+x|0,O^=D<<9|D>>>23,D=O+I|0,w^=D<<13|D>>>19,D=w+O|0,x^=D<<18|D>>>14,D=j+C|0,P^=D<<7|D>>>25,D=P+j|0,k^=D<<9|D>>>23,D=k+P|0,C^=D<<13|D>>>19,D=C+k|0,j^=D<<18|D>>>14,D=N+R|0,E^=D<<7|D>>>25,D=E+N|0,A^=D<<9|D>>>23,D=A+E|0,R^=D<<13|D>>>19,D=R+A|0,N^=D<<18|D>>>14,D=_+E|0,w^=D<<7|D>>>25,D=w+_|0,k^=D<<9|D>>>23,D=k+w|0,E^=D<<13|D>>>19,D=E+k|0,_^=D<<18|D>>>14,D=x+S|0,C^=D<<7|D>>>25,D=C+x|0,A^=D<<9|D>>>23,D=A+C|0,S^=D<<13|D>>>19,D=S+A|0,x^=D<<18|D>>>14,D=j+I|0,R^=D<<7|D>>>25,D=R+j|0,T^=D<<9|D>>>23,D=T+R|0,I^=D<<13|D>>>19,D=I+T|0,j^=D<<18|D>>>14,D=N+P|0,B^=D<<7|D>>>25,D=B+N|0,O^=D<<9|D>>>23,D=O+B|0,P^=D<<13|D>>>19,D=P+O|0,N^=D<<18|D>>>14;_=_+i|0,w=w+o|0,k=k+s|0,E=E+a|0,S=S+l|0,x=x+u|0,C=C+c|0,A=A+h|0,T=T+f|0,I=I+p|0,j=j+d|0,R=R+m|0,B=B+g|0,O=O+y|0,P=P+v|0,N=N+b|0,e[0]=_>>>0&255,e[1]=_>>>8&255,e[2]=_>>>16&255,e[3]=_>>>24&255,e[4]=w>>>0&255,e[5]=w>>>8&255,e[6]=w>>>16&255,e[7]=w>>>24&255,e[8]=k>>>0&255,e[9]=k>>>8&255,e[10]=k>>>16&255,e[11]=k>>>24&255,e[12]=E>>>0&255,e[13]=E>>>8&255,e[14]=E>>>16&255,e[15]=E>>>24&255,e[16]=S>>>0&255,e[17]=S>>>8&255,e[18]=S>>>16&255,e[19]=S>>>24&255,e[20]=x>>>0&255,e[21]=x>>>8&255,e[22]=x>>>16&255,e[23]=x>>>24&255,e[24]=C>>>0&255,e[25]=C>>>8&255,e[26]=C>>>16&255,e[27]=C>>>24&255,e[28]=A>>>0&255,e[29]=A>>>8&255,e[30]=A>>>16&255,e[31]=A>>>24&255,e[32]=T>>>0&255,e[33]=T>>>8&255,e[34]=T>>>16&255,e[35]=T>>>24&255,e[36]=I>>>0&255,e[37]=I>>>8&255,e[38]=I>>>16&255,e[39]=I>>>24&255,e[40]=j>>>0&255,e[41]=j>>>8&255,e[42]=j>>>16&255,e[43]=j>>>24&255,e[44]=R>>>0&255,e[45]=R>>>8&255,e[46]=R>>>16&255,e[47]=R>>>24&255,e[48]=B>>>0&255,e[49]=B>>>8&255,e[50]=B>>>16&255,e[51]=B>>>24&255,e[52]=O>>>0&255,e[53]=O>>>8&255,e[54]=O>>>16&255,e[55]=O>>>24&255,e[56]=P>>>0&255,e[57]=P>>>8&255,e[58]=P>>>16&255,e[59]=P>>>24&255,e[60]=N>>>0&255,e[61]=N>>>8&255,e[62]=N>>>16&255,e[63]=N>>>24&255}function b(e,t,n,r){for(var i=255&r[0]|(255&r[1])<<8|(255&r[2])<<16|(255&r[3])<<24,o=255&n[0]|(255&n[1])<<8|(255&n[2])<<16|(255&n[3])<<24,s=255&n[4]|(255&n[5])<<8|(255&n[6])<<16|(255&n[7])<<24,a=255&n[8]|(255&n[9])<<8|(255&n[10])<<16|(255&n[11])<<24,l=255&n[12]|(255&n[13])<<8|(255&n[14])<<16|(255&n[15])<<24,u=255&r[4]|(255&r[5])<<8|(255&r[6])<<16|(255&r[7])<<24,c=255&t[0]|(255&t[1])<<8|(255&t[2])<<16|(255&t[3])<<24,h=255&t[4]|(255&t[5])<<8|(255&t[6])<<16|(255&t[7])<<24,f=255&t[8]|(255&t[9])<<8|(255&t[10])<<16|(255&t[11])<<24,p=255&t[12]|(255&t[13])<<8|(255&t[14])<<16|(255&t[15])<<24,d=255&r[8]|(255&r[9])<<8|(255&r[10])<<16|(255&r[11])<<24,m=255&n[16]|(255&n[17])<<8|(255&n[18])<<16|(255&n[19])<<24,g=255&n[20]|(255&n[21])<<8|(255&n[22])<<16|(255&n[23])<<24,y=255&n[24]|(255&n[25])<<8|(255&n[26])<<16|(255&n[27])<<24,v=255&n[28]|(255&n[29])<<8|(255&n[30])<<16|(255&n[31])<<24,b=255&r[12]|(255&r[13])<<8|(255&r[14])<<16|(255&r[15])<<24,_=i,w=o,k=s,E=a,S=l,x=u,C=c,A=h,T=f,I=p,j=d,R=m,B=g,O=y,P=v,N=b,D,F=0;F<20;F+=2)D=_+B|0,S^=D<<7|D>>>25,D=S+_|0,T^=D<<9|D>>>23,D=T+S|0,B^=D<<13|D>>>19,D=B+T|0,_^=D<<18|D>>>14,D=x+w|0,I^=D<<7|D>>>25,D=I+x|0,O^=D<<9|D>>>23,D=O+I|0,w^=D<<13|D>>>19,D=w+O|0,x^=D<<18|D>>>14,D=j+C|0,P^=D<<7|D>>>25,D=P+j|0,k^=D<<9|D>>>23,D=k+P|0,C^=D<<13|D>>>19,D=C+k|0,j^=D<<18|D>>>14,D=N+R|0,E^=D<<7|D>>>25,D=E+N|0,A^=D<<9|D>>>23,D=A+E|0,R^=D<<13|D>>>19,D=R+A|0,N^=D<<18|D>>>14,D=_+E|0,w^=D<<7|D>>>25,D=w+_|0,k^=D<<9|D>>>23,D=k+w|0,E^=D<<13|D>>>19,D=E+k|0,_^=D<<18|D>>>14,D=x+S|0,C^=D<<7|D>>>25,D=C+x|0,A^=D<<9|D>>>23,D=A+C|0,S^=D<<13|D>>>19,D=S+A|0,x^=D<<18|D>>>14,D=j+I|0,R^=D<<7|D>>>25,D=R+j|0,T^=D<<9|D>>>23,D=T+R|0,I^=D<<13|D>>>19,D=I+T|0,j^=D<<18|D>>>14,D=N+P|0,B^=D<<7|D>>>25,D=B+N|0,O^=D<<9|D>>>23,D=O+B|0,P^=D<<13|D>>>19,D=P+O|0,N^=D<<18|D>>>14;e[0]=_>>>0&255,e[1]=_>>>8&255,e[2]=_>>>16&255,e[3]=_>>>24&255,e[4]=x>>>0&255,e[5]=x>>>8&255,e[6]=x>>>16&255,e[7]=x>>>24&255,e[8]=j>>>0&255,e[9]=j>>>8&255,e[10]=j>>>16&255,e[11]=j>>>24&255,e[12]=N>>>0&255,e[13]=N>>>8&255,e[14]=N>>>16&255,e[15]=N>>>24&255,e[16]=C>>>0&255,e[17]=C>>>8&255,e[18]=C>>>16&255,e[19]=C>>>24&255,e[20]=A>>>0&255,e[21]=A>>>8&255,e[22]=A>>>16&255,e[23]=A>>>24&255,e[24]=T>>>0&255,e[25]=T>>>8&255,e[26]=T>>>16&255,e[27]=T>>>24&255,e[28]=I>>>0&255,e[29]=I>>>8&255,e[30]=I>>>16&255,e[31]=I>>>24&255}function _(e,t,n,r){v(e,t,n,r)}function w(e,t,n,r){b(e,t,n,r)}var k=new Uint8Array([101,120,112,97,110,100,32,51,50,45,98,121,116,101,32,107]);function E(e,t,n,r,i,o,s){var a=new Uint8Array(16),l=new Uint8Array(64),u,c;for(c=0;c<16;c++)a[c]=0;for(c=0;c<8;c++)a[c]=o[c];for(;i>=64;){for(_(l,a,s,k),c=0;c<64;c++)e[t+c]=n[r+c]^l[c];for(u=1,c=8;c<16;c++)u=u+(255&a[c])|0,a[c]=255&u,u>>>=8;i-=64,t+=64,r+=64}if(i>0)for(_(l,a,s,k),c=0;c=64;){for(_(s,o,i,k),l=0;l<64;l++)e[t+l]=s[l];for(a=1,l=8;l<16;l++)a=a+(255&o[l])|0,o[l]=255&a,a>>>=8;n-=64,t+=64}if(n>0)for(_(s,o,i,k),l=0;l>>13|n<<3),r=255&e[4]|(255&e[5])<<8,this.r[2]=7939&(n>>>10|r<<6),i=255&e[6]|(255&e[7])<<8,this.r[3]=8191&(r>>>7|i<<9),o=255&e[8]|(255&e[9])<<8,this.r[4]=255&(i>>>4|o<<12),this.r[5]=o>>>1&8190,s=255&e[10]|(255&e[11])<<8,this.r[6]=8191&(o>>>14|s<<2),a=255&e[12]|(255&e[13])<<8,this.r[7]=8065&(s>>>11|a<<5),l=255&e[14]|(255&e[15])<<8,this.r[8]=8191&(a>>>8|l<<8),this.r[9]=l>>>5&127,this.pad[0]=255&e[16]|(255&e[17])<<8,this.pad[1]=255&e[18]|(255&e[19])<<8,this.pad[2]=255&e[20]|(255&e[21])<<8,this.pad[3]=255&e[22]|(255&e[23])<<8,this.pad[4]=255&e[24]|(255&e[25])<<8,this.pad[5]=255&e[26]|(255&e[27])<<8,this.pad[6]=255&e[28]|(255&e[29])<<8,this.pad[7]=255&e[30]|(255&e[31])<<8};function T(e,t,n,r,i,o){var s=new A(o);return s.update(n,r,i),s.finish(e,t),0}function I(e,t,n,r,i,o){var s=new Uint8Array(16);return T(s,0,n,r,i,o),g(e,t,s,0)}function j(e,t,n,r,i){var o;if(n<32)return-1;for(C(e,0,t,0,n,r,i),T(e,16,e,32,n-32,e),o=0;o<16;o++)e[o]=0;return 0}function R(e,t,n,r,i){var o,s=new Uint8Array(32);if(n<32)return-1;if(x(s,0,32,r,i),0!==I(t,16,t,32,n-32,s))return-1;for(C(e,0,t,0,n,r,i),o=0;o<32;o++)e[o]=0;return 0}function B(e,t){var n;for(n=0;n<16;n++)e[n]=0|t[n]}function O(e){var t,n,r=1;for(t=0;t<16;t++)n=e[t]+r+65535,r=Math.floor(n/65536),e[t]=n-65536*r;e[0]+=r-1+37*(r-1)}function P(e,t,n){for(var r,i=~(n-1),o=0;o<16;o++)r=i&(e[o]^t[o]),e[o]^=r,t[o]^=r}function N(e,n){var r,i,o,s=t(),a=t();for(r=0;r<16;r++)a[r]=n[r];for(O(a),O(a),O(a),i=0;i<2;i++){for(s[0]=a[0]-65517,r=1;r<15;r++)s[r]=a[r]-65535-(s[r-1]>>16&1),s[r-1]&=65535;s[15]=a[15]-32767-(s[14]>>16&1),o=s[15]>>16&1,s[14]&=65535,P(a,s,1-o)}for(r=0;r<16;r++)e[2*r]=255&a[r],e[2*r+1]=a[r]>>8}function D(e,t){var n=new Uint8Array(32),r=new Uint8Array(32);return N(n,e),N(r,t),y(n,0,r,0)}function F(e){var t=new Uint8Array(32);return N(t,e),1&t[0]}function M(e,t){var n;for(n=0;n<16;n++)e[n]=t[2*n]+(t[2*n+1]<<8);e[15]&=32767}function L(e,t,n){for(var r=0;r<16;r++)e[r]=t[r]+n[r]}function U(e,t,n){for(var r=0;r<16;r++)e[r]=t[r]-n[r]}function q(e,t,n){var r,i,o=0,s=0,a=0,l=0,u=0,c=0,h=0,f=0,p=0,d=0,m=0,g=0,y=0,v=0,b=0,_=0,w=0,k=0,E=0,S=0,x=0,C=0,A=0,T=0,I=0,j=0,R=0,B=0,O=0,P=0,N=0,D=n[0],F=n[1],M=n[2],L=n[3],U=n[4],q=n[5],z=n[6],K=n[7],H=n[8],V=n[9],$=n[10],W=n[11],G=n[12],Y=n[13],Z=n[14],J=n[15];r=t[0],o+=r*D,s+=r*F,a+=r*M,l+=r*L,u+=r*U,c+=r*q,h+=r*z,f+=r*K,p+=r*H,d+=r*V,m+=r*$,g+=r*W,y+=r*G,v+=r*Y,b+=r*Z,_+=r*J,r=t[1],s+=r*D,a+=r*F,l+=r*M,u+=r*L,c+=r*U,h+=r*q,f+=r*z,p+=r*K,d+=r*H,m+=r*V,g+=r*$,y+=r*W,v+=r*G,b+=r*Y,_+=r*Z,w+=r*J,r=t[2],a+=r*D,l+=r*F,u+=r*M,c+=r*L,h+=r*U,f+=r*q,p+=r*z,d+=r*K,m+=r*H,g+=r*V,y+=r*$,v+=r*W,b+=r*G,_+=r*Y,w+=r*Z,k+=r*J,r=t[3],l+=r*D,u+=r*F,c+=r*M,h+=r*L,f+=r*U,p+=r*q,d+=r*z,m+=r*K,g+=r*H,y+=r*V,v+=r*$,b+=r*W,_+=r*G,w+=r*Y,k+=r*Z,E+=r*J,r=t[4],u+=r*D,c+=r*F,h+=r*M,f+=r*L,p+=r*U,d+=r*q,m+=r*z,g+=r*K,y+=r*H,v+=r*V,b+=r*$,_+=r*W,w+=r*G,k+=r*Y,E+=r*Z,S+=r*J,r=t[5],c+=r*D,h+=r*F,f+=r*M,p+=r*L,d+=r*U,m+=r*q,g+=r*z,y+=r*K,v+=r*H,b+=r*V,_+=r*$,w+=r*W,k+=r*G,E+=r*Y,S+=r*Z,x+=r*J,r=t[6],h+=r*D,f+=r*F,p+=r*M,d+=r*L,m+=r*U,g+=r*q,y+=r*z,v+=r*K,b+=r*H,_+=r*V,w+=r*$,k+=r*W,E+=r*G,S+=r*Y,x+=r*Z,C+=r*J,r=t[7],f+=r*D,p+=r*F,d+=r*M,m+=r*L,g+=r*U,y+=r*q,v+=r*z,b+=r*K,_+=r*H,w+=r*V,k+=r*$,E+=r*W,S+=r*G,x+=r*Y,C+=r*Z,A+=r*J,r=t[8],p+=r*D,d+=r*F,m+=r*M,g+=r*L,y+=r*U,v+=r*q,b+=r*z,_+=r*K,w+=r*H,k+=r*V,E+=r*$,S+=r*W,x+=r*G,C+=r*Y,A+=r*Z,T+=r*J,r=t[9],d+=r*D,m+=r*F,g+=r*M,y+=r*L,v+=r*U,b+=r*q,_+=r*z,w+=r*K,k+=r*H,E+=r*V,S+=r*$,x+=r*W,C+=r*G,A+=r*Y,T+=r*Z,I+=r*J,r=t[10],m+=r*D,g+=r*F,y+=r*M,v+=r*L,b+=r*U,_+=r*q,w+=r*z,k+=r*K,E+=r*H,S+=r*V,x+=r*$,C+=r*W,A+=r*G,T+=r*Y,I+=r*Z,j+=r*J,r=t[11],g+=r*D,y+=r*F,v+=r*M,b+=r*L,_+=r*U,w+=r*q,k+=r*z,E+=r*K,S+=r*H,x+=r*V,C+=r*$,A+=r*W,T+=r*G,I+=r*Y,j+=r*Z,R+=r*J,r=t[12],y+=r*D,v+=r*F,b+=r*M,_+=r*L,w+=r*U,k+=r*q,E+=r*z,S+=r*K,x+=r*H,C+=r*V,A+=r*$,T+=r*W,I+=r*G,j+=r*Y,R+=r*Z,B+=r*J,r=t[13],v+=r*D,b+=r*F,_+=r*M,w+=r*L,k+=r*U,E+=r*q,S+=r*z,x+=r*K,C+=r*H,A+=r*V,T+=r*$,I+=r*W,j+=r*G,R+=r*Y,B+=r*Z,O+=r*J,r=t[14],b+=r*D,_+=r*F,w+=r*M,k+=r*L,E+=r*U,S+=r*q,x+=r*z,C+=r*K,A+=r*H,T+=r*V,I+=r*$,j+=r*W,R+=r*G,B+=r*Y,O+=r*Z,P+=r*J,r=t[15],_+=r*D,w+=r*F,k+=r*M,E+=r*L,S+=r*U,x+=r*q,C+=r*z,A+=r*K,T+=r*H,I+=r*V,j+=r*$,R+=r*W,B+=r*G,O+=r*Y,P+=r*Z,N+=r*J,o+=38*w,s+=38*k,a+=38*E,l+=38*S,u+=38*x,c+=38*C,h+=38*A,f+=38*T,p+=38*I,d+=38*j,m+=38*R,g+=38*B,y+=38*O,v+=38*P,b+=38*N,i=1,r=o+i+65535,i=Math.floor(r/65536),o=r-65536*i,r=s+i+65535,i=Math.floor(r/65536),s=r-65536*i,r=a+i+65535,i=Math.floor(r/65536),a=r-65536*i,r=l+i+65535,i=Math.floor(r/65536),l=r-65536*i,r=u+i+65535,i=Math.floor(r/65536),u=r-65536*i,r=c+i+65535,i=Math.floor(r/65536),c=r-65536*i,r=h+i+65535,i=Math.floor(r/65536),h=r-65536*i,r=f+i+65535,i=Math.floor(r/65536),f=r-65536*i,r=p+i+65535,i=Math.floor(r/65536),p=r-65536*i,r=d+i+65535,i=Math.floor(r/65536),d=r-65536*i,r=m+i+65535,i=Math.floor(r/65536),m=r-65536*i,r=g+i+65535,i=Math.floor(r/65536),g=r-65536*i,r=y+i+65535,i=Math.floor(r/65536),y=r-65536*i,r=v+i+65535,i=Math.floor(r/65536),v=r-65536*i,r=b+i+65535,i=Math.floor(r/65536),b=r-65536*i,r=_+i+65535,i=Math.floor(r/65536),_=r-65536*i,o+=i-1+37*(i-1),i=1,r=o+i+65535,i=Math.floor(r/65536),o=r-65536*i,r=s+i+65535,i=Math.floor(r/65536),s=r-65536*i,r=a+i+65535,i=Math.floor(r/65536),a=r-65536*i,r=l+i+65535,i=Math.floor(r/65536),l=r-65536*i,r=u+i+65535,i=Math.floor(r/65536),u=r-65536*i,r=c+i+65535,i=Math.floor(r/65536),c=r-65536*i,r=h+i+65535,i=Math.floor(r/65536),h=r-65536*i,r=f+i+65535,i=Math.floor(r/65536),f=r-65536*i,r=p+i+65535,i=Math.floor(r/65536),p=r-65536*i,r=d+i+65535,i=Math.floor(r/65536),d=r-65536*i,r=m+i+65535,i=Math.floor(r/65536),m=r-65536*i,r=g+i+65535,i=Math.floor(r/65536),g=r-65536*i,r=y+i+65535,i=Math.floor(r/65536),y=r-65536*i,r=v+i+65535,i=Math.floor(r/65536),v=r-65536*i,r=b+i+65535,i=Math.floor(r/65536),b=r-65536*i,r=_+i+65535,i=Math.floor(r/65536),_=r-65536*i,o+=i-1+37*(i-1),e[0]=o,e[1]=s,e[2]=a,e[3]=l,e[4]=u,e[5]=c,e[6]=h,e[7]=f,e[8]=p,e[9]=d,e[10]=m,e[11]=g,e[12]=y,e[13]=v,e[14]=b,e[15]=_}function z(e,t){q(e,t,t)}function K(e,n){var r=t(),i;for(i=0;i<16;i++)r[i]=n[i];for(i=253;i>=0;i--)z(r,r),2!==i&&4!==i&&q(r,r,n);for(i=0;i<16;i++)e[i]=r[i]}function H(e,n){var r=t(),i;for(i=0;i<16;i++)r[i]=n[i];for(i=250;i>=0;i--)z(r,r),1!==i&&q(r,r,n);for(i=0;i<16;i++)e[i]=r[i]}function V(e,n,r){var i=new Uint8Array(32),o=new Float64Array(80),s,a,u=t(),c=t(),h=t(),f=t(),p=t(),d=t();for(a=0;a<31;a++)i[a]=n[a];for(i[31]=127&n[31]|64,i[0]&=248,M(o,r),a=0;a<16;a++)c[a]=o[a],f[a]=u[a]=h[a]=0;for(u[0]=f[0]=1,a=254;a>=0;--a)s=i[a>>>3]>>>(7&a)&1,P(u,c,s),P(h,f,s),L(p,u,h),U(u,u,h),L(h,c,f),U(c,c,f),z(f,p),z(d,u),q(u,h,u),q(h,c,p),L(p,u,h),U(u,u,h),z(c,u),U(h,f,d),q(u,h,l),L(u,u,f),q(h,h,u),q(u,f,d),q(f,c,o),z(c,p),P(u,c,s),P(h,f,s);for(a=0;a<16;a++)o[a+16]=u[a],o[a+32]=h[a],o[a+48]=c[a],o[a+64]=f[a];var m=o.subarray(32),g=o.subarray(16);return K(m,m),q(g,g,m),N(e,g),0}function $(e,t){return V(e,t,o)}function W(e,t){return r(t,32),$(e,t)}function G(e,t,n){var r=new Uint8Array(32);return V(r,n,t),w(e,i,r,k)}A.prototype.blocks=function(e,t,n){for(var r=this.fin?0:2048,i,o,s,a,l,u,c,h,f,p,d,m,g,y,v,b,_,w,k,E=this.h[0],S=this.h[1],x=this.h[2],C=this.h[3],A=this.h[4],T=this.h[5],I=this.h[6],j=this.h[7],R=this.h[8],B=this.h[9],O=this.r[0],P=this.r[1],N=this.r[2],D=this.r[3],F=this.r[4],M=this.r[5],L=this.r[6],U=this.r[7],q=this.r[8],z=this.r[9];n>=16;)i=255&e[t+0]|(255&e[t+1])<<8,E+=8191&i,o=255&e[t+2]|(255&e[t+3])<<8,S+=8191&(i>>>13|o<<3),s=255&e[t+4]|(255&e[t+5])<<8,x+=8191&(o>>>10|s<<6),a=255&e[t+6]|(255&e[t+7])<<8,C+=8191&(s>>>7|a<<9),l=255&e[t+8]|(255&e[t+9])<<8,A+=8191&(a>>>4|l<<12),T+=l>>>1&8191,u=255&e[t+10]|(255&e[t+11])<<8,I+=8191&(l>>>14|u<<2),c=255&e[t+12]|(255&e[t+13])<<8,j+=8191&(u>>>11|c<<5),h=255&e[t+14]|(255&e[t+15])<<8,R+=8191&(c>>>8|h<<8),B+=h>>>5|r,f=0,p=f,p+=E*O,p+=S*(5*z),p+=x*(5*q),p+=C*(5*U),p+=A*(5*L),f=p>>>13,p&=8191,p+=T*(5*M),p+=I*(5*F),p+=j*(5*D),p+=R*(5*N),p+=B*(5*P),f+=p>>>13,p&=8191,d=f,d+=E*P,d+=S*O,d+=x*(5*z),d+=C*(5*q),d+=A*(5*U),f=d>>>13,d&=8191,d+=T*(5*L),d+=I*(5*M),d+=j*(5*F),d+=R*(5*D),d+=B*(5*N),f+=d>>>13,d&=8191,m=f,m+=E*N,m+=S*P,m+=x*O,m+=C*(5*z),m+=A*(5*q),f=m>>>13,m&=8191,m+=T*(5*U),m+=I*(5*L),m+=j*(5*M),m+=R*(5*F),m+=B*(5*D),f+=m>>>13,m&=8191,g=f,g+=E*D,g+=S*N,g+=x*P,g+=C*O,g+=A*(5*z),f=g>>>13,g&=8191,g+=T*(5*q),g+=I*(5*U),g+=j*(5*L),g+=R*(5*M),g+=B*(5*F),f+=g>>>13,g&=8191,y=f,y+=E*F,y+=S*D,y+=x*N,y+=C*P,y+=A*O,f=y>>>13,y&=8191,y+=T*(5*z),y+=I*(5*q),y+=j*(5*U),y+=R*(5*L),y+=B*(5*M),f+=y>>>13,y&=8191,v=f,v+=E*M,v+=S*F,v+=x*D,v+=C*N,v+=A*P,f=v>>>13,v&=8191,v+=T*O,v+=I*(5*z),v+=j*(5*q),v+=R*(5*U),v+=B*(5*L),f+=v>>>13,v&=8191,b=f,b+=E*L,b+=S*M,b+=x*F,b+=C*D,b+=A*N,f=b>>>13,b&=8191,b+=T*P,b+=I*O,b+=j*(5*z),b+=R*(5*q),b+=B*(5*U),f+=b>>>13,b&=8191,_=f,_+=E*U,_+=S*L,_+=x*M,_+=C*F,_+=A*D,f=_>>>13,_&=8191,_+=T*N,_+=I*P,_+=j*O,_+=R*(5*z),_+=B*(5*q),f+=_>>>13,_&=8191,w=f,w+=E*q,w+=S*U,w+=x*L,w+=C*M,w+=A*F,f=w>>>13,w&=8191,w+=T*D,w+=I*N,w+=j*P,w+=R*O,w+=B*(5*z),f+=w>>>13,w&=8191,k=f,k+=E*z,k+=S*q,k+=x*U,k+=C*L,k+=A*M,f=k>>>13,k&=8191,k+=T*F,k+=I*D,k+=j*N,k+=R*P,k+=B*O,f+=k>>>13,k&=8191,f=(f<<2)+f|0,f=f+p|0,p=8191&f,f>>>=13,d+=f,E=p,S=d,x=m,C=g,A=y,T=v,I=b,j=_,R=w,B=k,t+=16,n-=16;this.h[0]=E,this.h[1]=S,this.h[2]=x,this.h[3]=C,this.h[4]=A,this.h[5]=T,this.h[6]=I,this.h[7]=j,this.h[8]=R,this.h[9]=B},A.prototype.finish=function(e,t){var n=new Uint16Array(10),r,i,o,s;if(this.leftover){for(s=this.leftover,this.buffer[s++]=1;s<16;s++)this.buffer[s]=0;this.fin=1,this.blocks(this.buffer,0,16)}for(r=this.h[1]>>>13,this.h[1]&=8191,s=2;s<10;s++)this.h[s]+=r,r=this.h[s]>>>13,this.h[s]&=8191;for(this.h[0]+=5*r,r=this.h[0]>>>13,this.h[0]&=8191,this.h[1]+=r,r=this.h[1]>>>13,this.h[1]&=8191,this.h[2]+=r,n[0]=this.h[0]+5,r=n[0]>>>13,n[0]&=8191,s=1;s<10;s++)n[s]=this.h[s]+r,r=n[s]>>>13,n[s]&=8191;for(n[9]-=8192,i=(1^r)-1,s=0;s<10;s++)n[s]&=i;for(i=~i,s=0;s<10;s++)this.h[s]=this.h[s]&i|n[s];for(this.h[0]=65535&(this.h[0]|this.h[1]<<13),this.h[1]=65535&(this.h[1]>>>3|this.h[2]<<10),this.h[2]=65535&(this.h[2]>>>6|this.h[3]<<7),this.h[3]=65535&(this.h[3]>>>9|this.h[4]<<4),this.h[4]=65535&(this.h[4]>>>12|this.h[5]<<1|this.h[6]<<14),this.h[5]=65535&(this.h[6]>>>2|this.h[7]<<11),this.h[6]=65535&(this.h[7]>>>5|this.h[8]<<8),this.h[7]=65535&(this.h[8]>>>8|this.h[9]<<5),o=this.h[0]+this.pad[0],this.h[0]=65535&o,s=1;s<8;s++)o=(this.h[s]+this.pad[s]|0)+(o>>>16)|0,this.h[s]=65535&o;e[t+0]=this.h[0]>>>0&255,e[t+1]=this.h[0]>>>8&255,e[t+2]=this.h[1]>>>0&255,e[t+3]=this.h[1]>>>8&255,e[t+4]=this.h[2]>>>0&255,e[t+5]=this.h[2]>>>8&255,e[t+6]=this.h[3]>>>0&255,e[t+7]=this.h[3]>>>8&255,e[t+8]=this.h[4]>>>0&255,e[t+9]=this.h[4]>>>8&255,e[t+10]=this.h[5]>>>0&255,e[t+11]=this.h[5]>>>8&255,e[t+12]=this.h[6]>>>0&255,e[t+13]=this.h[6]>>>8&255,e[t+14]=this.h[7]>>>0&255,e[t+15]=this.h[7]>>>8&255},A.prototype.update=function(e,t,n){var r,i;if(this.leftover){for(i=16-this.leftover,i>n&&(i=n),r=0;r=16&&(i=n-n%16,this.blocks(e,t,i),t+=i,n-=i),n){for(r=0;r=128;){for(S=0;S<16;S++)x=8*S+G,i[S]=n[x+0]<<24|n[x+1]<<16|n[x+2]<<8|n[x+3],o[S]=n[x+4]<<24|n[x+5]<<16|n[x+6]<<8|n[x+7];for(S=0;S<80;S++)if(s=B,a=O,l=P,u=N,c=D,h=F,f=M,p=L,d=U,m=q,g=z,y=K,v=H,b=V,_=$,w=W,C=L,A=W,T=65535&A,I=A>>>16,j=65535&C,R=C>>>16,C=(D>>>14|H<<18)^(D>>>18|H<<14)^(H>>>9|D<<23),A=(H>>>14|D<<18)^(H>>>18|D<<14)^(D>>>9|H<<23),T+=65535&A,I+=A>>>16,j+=65535&C,R+=C>>>16,C=D&F^~D&M,A=H&V^~H&$,T+=65535&A,I+=A>>>16,j+=65535&C,R+=C>>>16,C=X[2*S],A=X[2*S+1],T+=65535&A,I+=A>>>16,j+=65535&C,R+=C>>>16,C=i[S%16],A=o[S%16],T+=65535&A,I+=A>>>16,j+=65535&C,R+=C>>>16,I+=T>>>16,j+=I>>>16,R+=j>>>16,k=65535&j|R<<16,E=65535&T|I<<16,C=k,A=E,T=65535&A,I=A>>>16,j=65535&C,R=C>>>16,C=(B>>>28|U<<4)^(U>>>2|B<<30)^(U>>>7|B<<25),A=(U>>>28|B<<4)^(B>>>2|U<<30)^(B>>>7|U<<25),T+=65535&A,I+=A>>>16,j+=65535&C,R+=C>>>16,C=B&O^B&P^O&P,A=U&q^U&z^q&z,T+=65535&A,I+=A>>>16,j+=65535&C,R+=C>>>16,I+=T>>>16,j+=I>>>16,R+=j>>>16,p=65535&j|R<<16,w=65535&T|I<<16,C=u,A=y,T=65535&A,I=A>>>16,j=65535&C,R=C>>>16,C=k,A=E,T+=65535&A,I+=A>>>16,j+=65535&C,R+=C>>>16,I+=T>>>16,j+=I>>>16,R+=j>>>16,u=65535&j|R<<16,y=65535&T|I<<16,O=s,P=a,N=l,D=u,F=c,M=h,L=f,B=p,q=d,z=m,K=g,H=y,V=v,$=b,W=_,U=w,S%16==15)for(x=0;x<16;x++)C=i[x],A=o[x],T=65535&A,I=A>>>16,j=65535&C,R=C>>>16,C=i[(x+9)%16],A=o[(x+9)%16],T+=65535&A,I+=A>>>16,j+=65535&C,R+=C>>>16,k=i[(x+1)%16],E=o[(x+1)%16],C=(k>>>1|E<<31)^(k>>>8|E<<24)^k>>>7,A=(E>>>1|k<<31)^(E>>>8|k<<24)^(E>>>7|k<<25),T+=65535&A,I+=A>>>16,j+=65535&C,R+=C>>>16,k=i[(x+14)%16],E=o[(x+14)%16],C=(k>>>19|E<<13)^(E>>>29|k<<3)^k>>>6,A=(E>>>19|k<<13)^(k>>>29|E<<3)^(E>>>6|k<<26),T+=65535&A,I+=A>>>16,j+=65535&C,R+=C>>>16,I+=T>>>16,j+=I>>>16,R+=j>>>16,i[x]=65535&j|R<<16,o[x]=65535&T|I<<16;C=B,A=U,T=65535&A,I=A>>>16,j=65535&C,R=C>>>16,C=e[0],A=t[0],T+=65535&A,I+=A>>>16,j+=65535&C,R+=C>>>16,I+=T>>>16,j+=I>>>16,R+=j>>>16,e[0]=B=65535&j|R<<16,t[0]=U=65535&T|I<<16,C=O,A=q,T=65535&A,I=A>>>16,j=65535&C,R=C>>>16,C=e[1],A=t[1],T+=65535&A,I+=A>>>16,j+=65535&C,R+=C>>>16,I+=T>>>16,j+=I>>>16,R+=j>>>16,e[1]=O=65535&j|R<<16,t[1]=q=65535&T|I<<16,C=P,A=z,T=65535&A,I=A>>>16,j=65535&C,R=C>>>16,C=e[2],A=t[2],T+=65535&A,I+=A>>>16,j+=65535&C,R+=C>>>16,I+=T>>>16,j+=I>>>16,R+=j>>>16,e[2]=P=65535&j|R<<16,t[2]=z=65535&T|I<<16,C=N,A=K,T=65535&A,I=A>>>16,j=65535&C,R=C>>>16,C=e[3],A=t[3],T+=65535&A,I+=A>>>16,j+=65535&C,R+=C>>>16,I+=T>>>16,j+=I>>>16,R+=j>>>16,e[3]=N=65535&j|R<<16,t[3]=K=65535&T|I<<16,C=D,A=H,T=65535&A,I=A>>>16,j=65535&C,R=C>>>16,C=e[4],A=t[4],T+=65535&A,I+=A>>>16,j+=65535&C,R+=C>>>16,I+=T>>>16,j+=I>>>16,R+=j>>>16,e[4]=D=65535&j|R<<16,t[4]=H=65535&T|I<<16,C=F,A=V,T=65535&A,I=A>>>16,j=65535&C,R=C>>>16,C=e[5],A=t[5],T+=65535&A,I+=A>>>16,j+=65535&C,R+=C>>>16,I+=T>>>16,j+=I>>>16,R+=j>>>16,e[5]=F=65535&j|R<<16,t[5]=V=65535&T|I<<16,C=M,A=$,T=65535&A,I=A>>>16,j=65535&C,R=C>>>16,C=e[6],A=t[6],T+=65535&A,I+=A>>>16,j+=65535&C,R+=C>>>16,I+=T>>>16,j+=I>>>16,R+=j>>>16,e[6]=M=65535&j|R<<16,t[6]=$=65535&T|I<<16,C=L,A=W,T=65535&A,I=A>>>16,j=65535&C,R=C>>>16,C=e[7],A=t[7],T+=65535&A,I+=A>>>16,j+=65535&C,R+=C>>>16,I+=T>>>16,j+=I>>>16,R+=j>>>16,e[7]=L=65535&j|R<<16,t[7]=W=65535&T|I<<16,G+=128,r-=128}return r}function te(e,t,n){var r=new Int32Array(8),i=new Int32Array(8),o=new Uint8Array(256),s,a=n;for(r[0]=1779033703,r[1]=3144134277,r[2]=1013904242,r[3]=2773480762,r[4]=1359893119,r[5]=2600822924,r[6]=528734635,r[7]=1541459225,i[0]=4089235720,i[1]=2227873595,i[2]=4271175723,i[3]=1595750129,i[4]=2917565137,i[5]=725511199,i[6]=4215389547,i[7]=327033209,ee(r,i,t,n),n%=128,s=0;s=0;--i)r=n[i/8|0]>>(7&i)&1,re(e,t,r),ne(t,e),ne(e,e),re(e,t,r)}function se(e,n){var r=[t(),t(),t(),t()];B(r[0],h),B(r[1],f),B(r[2],a),q(r[3],h,f),oe(e,r,n)}function ae(e,n,i){var o=new Uint8Array(64),s=[t(),t(),t(),t()],a;for(i||r(n,32),te(o,n,32),o[0]&=248,o[31]&=127,o[31]|=64,se(s,o),ie(e,s),a=0;a<32;a++)n[a+32]=e[a];return 0}var le=new Float64Array([237,211,245,92,26,99,18,88,214,156,247,162,222,249,222,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16]);function ue(e,t){var n,r,i,o;for(r=63;r>=32;--r){for(n=0,i=r-32,o=r-12;i>8,t[i]-=256*n;t[i]+=n,t[r]=0}for(n=0,i=0;i<32;i++)t[i]+=n-(t[31]>>4)*le[i],n=t[i]>>8,t[i]&=255;for(i=0;i<32;i++)t[i]-=n*le[i];for(r=0;r<32;r++)t[r+1]+=t[r]>>8,e[r]=255&t[r]}function ce(e){var t=new Float64Array(64),n;for(n=0;n<64;n++)t[n]=e[n];for(n=0;n<64;n++)e[n]=0;ue(e,t)}function he(e,n,r,i){var o=new Uint8Array(64),s=new Uint8Array(64),a=new Uint8Array(64),l,u,c=new Float64Array(64),h=[t(),t(),t(),t()];te(o,i,32),o[0]&=248,o[31]&=127,o[31]|=64;var f=r+64;for(l=0;l>7&&U(e[0],s,e[0]),q(e[3],e[0],e[1]),0)}function pe(e,n,r,i){var o,s,a=new Uint8Array(32),l=new Uint8Array(64),u=[t(),t(),t(),t()],c=[t(),t(),t(),t()];if(s=-1,r<64)return-1;if(fe(c,i))return-1;for(o=0;o=0},e.sign.keyPair=function(){var e=new Uint8Array(32),t=new Uint8Array(64);return ae(e,t),{publicKey:e,secretKey:t}},e.sign.keyPair.fromSecretKey=function(e){if(Oe(e),64!==e.length)throw new Error("bad secret key size");for(var t=new Uint8Array(32),n=0;n{o=o||n(762)(t);class s{constructor(e){o.validatePublicKey(e),this._key=e}verify(e,t,n){h(n),o.hashAndVerify(this._key,t,e,n)}marshal(){return o.compressPublicKey(this._key)}get bytes(){return e.PublicKey.encode({Type:e.KeyType.Secp256k1,Data:this.marshal()})}equals(e){return this.bytes.equals(e.bytes)}hash(e){h(e),i(this.bytes,"sha2-256",e)}}class a{constructor(e,t){this._key=e,this._publicKey=t||o.computePublicKey(e),o.validatePrivateKey(this._key),o.validatePublicKey(this._publicKey)}sign(e,t){h(t),o.hashAndSign(this._key,e,t)}get public(){return new s(this._publicKey)}marshal(){return this._key}get bytes(){return e.PrivateKey.encode({Type:e.KeyType.Secp256k1,Data:this.marshal()})}equals(e){return this.bytes.equals(e.bytes)}hash(e){h(e),i(this.bytes,"sha2-256",e)}id(e){this.public.hash((t,n)=>{if(t)return e(t);e(null,r.encode(n))})}}function l(e,t){t(null,new a(e),null)}function u(e){return new s(e)}function c(e,t){void 0===t&&"function"==typeof e&&(t=e),h(t),o.generateKey((e,n)=>{if(e)return t(e);let r;try{r=new a(n)}catch(e){return t(e)}t(null,r)})}function h(e){if("function"!=typeof e)throw new Error("callback is required")}return{Secp256k1PublicKey:s,Secp256k1PrivateKey:a,unmarshalSecp256k1PrivateKey:l,unmarshalSecp256k1PublicKey:u,generateKeyPair:c}})},function(e,t,n){"use strict";const r=n(763),i=n(54),o=n(19),s="sha2-256";e.exports=(e=>{const t=32;function n(t){const n=(e,n)=>o(()=>t(e,n));let i;do{i=e(32)}while(!r.privateKeyVerify(i));n(null,i)}function a(e,t,n){const a=(e,t)=>o(()=>n(e,t));i.digest(t,s,(t,n)=>{if(t)return a(t);try{const i=r.sign(n,e),o=r.signatureExport(i.signature);return a(null,o)}catch(t){a(t)}})}function l(e,t,n,a){const l=(e,t)=>o(()=>a(e,t));i.digest(n,s,(n,i)=>{if(n)return l(n);try{t=r.signatureImport(t);const o=r.verify(i,t,e);return l(null,o)}catch(n){l(n)}})}function u(e){if(!r.publicKeyVerify(e))throw new Error("Invalid public key");return r.publicKeyConvert(e,!0)}function c(e){return r.publicKeyConvert(e,!1)}function h(e){if(!r.privateKeyVerify(e))throw new Error("Invalid private key")}function f(e){if(!r.publicKeyVerify(e))throw new Error("Invalid public key")}function p(e){return h(e),r.publicKeyCreate(e)}return{generateKey:n,privateKeyLength:32,hashAndSign:a,hashAndVerify:l,compressPublicKey:u,decompressPublicKey:c,validatePrivateKey:h,validatePublicKey:f,computePublicKey:p}})},function(e,t,n){"use strict";e.exports=n(764)(n(768))},function(e,t,n){"use strict";var r=n(765),i=n(766),o=n(377);function s(e,t){return void 0===e?t:(r.isBoolean(e,o.COMPRESSED_TYPE_INVALID),e)}e.exports=function(e){return{privateKeyVerify:function(t){return r.isBuffer(t,o.EC_PRIVATE_KEY_TYPE_INVALID),32===t.length&&e.privateKeyVerify(t)},privateKeyExport:function(t,n){r.isBuffer(t,o.EC_PRIVATE_KEY_TYPE_INVALID),r.isBufferLength(t,32,o.EC_PRIVATE_KEY_LENGTH_INVALID),n=s(n,!0);var a=e.privateKeyExport(t,n);return i.privateKeyExport(t,a,n)},privateKeyImport:function(t){if(r.isBuffer(t,o.EC_PRIVATE_KEY_TYPE_INVALID),t=i.privateKeyImport(t),t&&32===t.length&&e.privateKeyVerify(t))return t;throw new Error(o.EC_PRIVATE_KEY_IMPORT_DER_FAIL)},privateKeyNegate:function(t){return r.isBuffer(t,o.EC_PRIVATE_KEY_TYPE_INVALID),r.isBufferLength(t,32,o.EC_PRIVATE_KEY_LENGTH_INVALID),e.privateKeyNegate(t)},privateKeyModInverse:function(t){return r.isBuffer(t,o.EC_PRIVATE_KEY_TYPE_INVALID),r.isBufferLength(t,32,o.EC_PRIVATE_KEY_LENGTH_INVALID),e.privateKeyModInverse(t)},privateKeyTweakAdd:function(t,n){return r.isBuffer(t,o.EC_PRIVATE_KEY_TYPE_INVALID),r.isBufferLength(t,32,o.EC_PRIVATE_KEY_LENGTH_INVALID),r.isBuffer(n,o.TWEAK_TYPE_INVALID),r.isBufferLength(n,32,o.TWEAK_LENGTH_INVALID),e.privateKeyTweakAdd(t,n)},privateKeyTweakMul:function(t,n){return r.isBuffer(t,o.EC_PRIVATE_KEY_TYPE_INVALID),r.isBufferLength(t,32,o.EC_PRIVATE_KEY_LENGTH_INVALID),r.isBuffer(n,o.TWEAK_TYPE_INVALID),r.isBufferLength(n,32,o.TWEAK_LENGTH_INVALID),e.privateKeyTweakMul(t,n)},publicKeyCreate:function(t,n){return r.isBuffer(t,o.EC_PRIVATE_KEY_TYPE_INVALID),r.isBufferLength(t,32,o.EC_PRIVATE_KEY_LENGTH_INVALID),n=s(n,!0),e.publicKeyCreate(t,n)},publicKeyConvert:function(t,n){return r.isBuffer(t,o.EC_PUBLIC_KEY_TYPE_INVALID),r.isBufferLength2(t,33,65,o.EC_PUBLIC_KEY_LENGTH_INVALID),n=s(n,!0),e.publicKeyConvert(t,n)},publicKeyVerify:function(t){return r.isBuffer(t,o.EC_PUBLIC_KEY_TYPE_INVALID),e.publicKeyVerify(t)},publicKeyTweakAdd:function(t,n,i){return r.isBuffer(t,o.EC_PUBLIC_KEY_TYPE_INVALID),r.isBufferLength2(t,33,65,o.EC_PUBLIC_KEY_LENGTH_INVALID),r.isBuffer(n,o.TWEAK_TYPE_INVALID),r.isBufferLength(n,32,o.TWEAK_LENGTH_INVALID),i=s(i,!0),e.publicKeyTweakAdd(t,n,i)},publicKeyTweakMul:function(t,n,i){return r.isBuffer(t,o.EC_PUBLIC_KEY_TYPE_INVALID),r.isBufferLength2(t,33,65,o.EC_PUBLIC_KEY_LENGTH_INVALID),r.isBuffer(n,o.TWEAK_TYPE_INVALID),r.isBufferLength(n,32,o.TWEAK_LENGTH_INVALID),i=s(i,!0),e.publicKeyTweakMul(t,n,i)},publicKeyCombine:function(t,n){r.isArray(t,o.EC_PUBLIC_KEYS_TYPE_INVALID),r.isLengthGTZero(t,o.EC_PUBLIC_KEYS_LENGTH_INVALID);for(var i=0;i=n)throw RangeError(r)}}).call(this,n(0).Buffer)},function(e,t,n){"use strict";var r=n(5).Buffer,i=n(767),o=r.from([48,129,211,2,1,1,4,32,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,160,129,133,48,129,130,2,1,1,48,44,6,7,42,134,72,206,61,1,1,2,33,0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,254,255,255,252,47,48,6,4,1,0,4,1,7,4,33,2,121,190,102,126,249,220,187,172,85,160,98,149,206,135,11,7,2,155,252,219,45,206,40,217,89,242,129,91,22,248,23,152,2,33,0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,254,186,174,220,230,175,72,160,59,191,210,94,140,208,54,65,65,2,1,1,161,36,3,34,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]),s=r.from([48,130,1,19,2,1,1,4,32,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,160,129,165,48,129,162,2,1,1,48,44,6,7,42,134,72,206,61,1,1,2,33,0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,254,255,255,252,47,48,6,4,1,0,4,1,7,4,65,4,121,190,102,126,249,220,187,172,85,160,98,149,206,135,11,7,2,155,252,219,45,206,40,217,89,242,129,91,22,248,23,152,72,58,218,119,38,163,196,101,93,164,251,252,14,17,8,168,253,23,180,72,166,133,84,25,156,71,208,143,251,16,212,184,2,33,0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,254,186,174,220,230,175,72,160,59,191,210,94,140,208,54,65,65,2,1,1,161,68,3,66,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]);t.privateKeyExport=function(e,t,n){var i=r.from(n?o:s);return e.copy(i,n?8:9),t.copy(i,n?181:214),i},t.privateKeyImport=function(e){var t=e.length,n=0;if(!(t2||t1?e[n+r-2]<<8:0);if(n+=r,!(t32||t1&&0===t[o]&&!(128&t[o+1]);--n,++o);for(var s=r.concat([r.from([0]),e.s]),a=33,l=0;a>1&&0===s[l]&&!(128&s[l+1]);--a,++l);return i.encode(t.slice(o),s.slice(l))},t.signatureImport=function(e){var t=r.alloc(32,0),n=r.alloc(32,0);try{var o=i.decode(e);if(33===o.r.length&&0===o.r[0]&&(o.r=o.r.slice(1)),o.r.length>32)throw new Error("R length is too long");if(33===o.s.length&&0===o.s[0]&&(o.s=o.s.slice(1)),o.s.length>32)throw new Error("S length is too long")}catch(e){return}return o.r.copy(t,32-o.r.length),o.s.copy(n,32-o.s.length),{r:t,s:n}},t.signatureImportLax=function(e){var t=r.alloc(32,0),n=r.alloc(32,0),i=e.length,o=0;if(48===e[o++]){var s=e[o++];if(!(128&s&&(o+=s-128,o>i))&&2===e[o++]){var a=e[o++];if(128&a){if(s=a-128,o+s>i)return;for(;s>0&&0===e[o];o+=1,s-=1);for(a=0;s>0;o+=1,s-=1)a=(a<<8)+e[o]}if(!(a>i-o)){var l=o;if(o+=a,2===e[o++]){var u=e[o++];if(128&u){if(s=u-128,o+s>i)return;for(;s>0&&0===e[o];o+=1,s-=1);for(u=0;s>0;o+=1,s-=1)u=(u<<8)+e[o]}if(!(u>i-o)){var c=o;for(o+=u;a>0&&0===e[l];a-=1,l+=1);if(!(a>32)){var h=e.slice(l,l+a);for(h.copy(t,32-h.length);u>0&&0===e[c];u-=1,c+=1);if(!(u>32)){var f=e.slice(c,c+u);return f.copy(n,32-f.length),{r:t,s:n}}}}}}}}}},function(e,t,n){var r=n(5).Buffer;function i(e){if(e.length<8)return!1;if(e.length>72)return!1;if(48!==e[0])return!1;if(e[1]!==e.length-2)return!1;if(2!==e[2])return!1;var t=e[3];if(0===t)return!1;if(5+t>=e.length)return!1;if(2!==e[4+t])return!1;var n=e[5+t];return 0!==n&&(6+t+n===e.length&&(!(128&e[4])&&(!(t>1&&0===e[4]&&!(128&e[5]))&&(!(128&e[t+6])&&!(n>1&&0===e[t+6]&&!(128&e[t+7]))))))}function o(e){if(e.length<8)throw new Error("DER sequence length is too short");if(e.length>72)throw new Error("DER sequence length is too long");if(48!==e[0])throw new Error("Expected DER sequence");if(e[1]!==e.length-2)throw new Error("DER sequence length is invalid");if(2!==e[2])throw new Error("Expected DER integer");var t=e[3];if(0===t)throw new Error("R length is zero");if(5+t>=e.length)throw new Error("R length is too long");if(2!==e[4+t])throw new Error("Expected DER integer (2)");var n=e[5+t];if(0===n)throw new Error("S length is zero");if(6+t+n!==e.length)throw new Error("S length is invalid");if(128&e[4])throw new Error("R value is negative");if(t>1&&0===e[4]&&!(128&e[5]))throw new Error("R value excessively padded");if(128&e[t+6])throw new Error("S value is negative");if(n>1&&0===e[t+6]&&!(128&e[t+7]))throw new Error("S value excessively padded");return{r:e.slice(4,4+t),s:e.slice(6+t)}}function s(e,t){var n=e.length,i=t.length;if(0===n)throw new Error("R length is zero");if(0===i)throw new Error("S length is zero");if(n>33)throw new Error("R length is too long");if(i>33)throw new Error("S length is too long");if(128&e[0])throw new Error("R value is negative");if(128&t[0])throw new Error("S value is negative");if(n>1&&0===e[0]&&!(128&e[1]))throw new Error("R value excessively padded");if(i>1&&0===t[0]&&!(128&t[1]))throw new Error("S value excessively padded");var o=r.allocUnsafe(6+n+i);return o[0]=48,o[1]=o.length-2,o[2]=2,o[3]=e.length,e.copy(o,4),o[4+n]=2,o[5+n]=t.length,t.copy(o,6+n),o}e.exports={check:i,decode:o,encode:s}},function(e,t,n){"use strict";var r=n(5).Buffer,i=n(769),o=n(782),s=n(377),a=n(195),l=n(387),u=n(788);t.privateKeyVerify=function(e){var t=a.fromBuffer(e);return!(t.isOverflow()||t.isZero())},t.privateKeyExport=function(e,t){var n=a.fromBuffer(e);if(n.isOverflow()||n.isZero())throw new Error(s.EC_PRIVATE_KEY_EXPORT_DER_FAIL);return u.mul(n).toPublicKey(t)},t.privateKeyNegate=function(e){var t=a.fromBuffer(e);return t.isZero()?r.alloc(32):(t.ucmp(a.n)>0&&t.isub(a.n),a.n.sub(t).toBuffer())},t.privateKeyModInverse=function(e){var t=a.fromBuffer(e);if(t.isOverflow()||t.isZero())throw new Error(s.EC_PRIVATE_KEY_RANGE_INVALID);return t.uinvm().toBuffer()},t.privateKeyTweakAdd=function(e,t){var n=a.fromBuffer(t);if(n.isOverflow())throw new Error(s.EC_PRIVATE_KEY_TWEAK_ADD_FAIL);if(n.iadd(a.fromBuffer(e)),n.isOverflow()&&n.isub(a.n),n.isZero())throw new Error(s.EC_PRIVATE_KEY_TWEAK_ADD_FAIL);return n.toBuffer()},t.privateKeyTweakMul=function(e,t){var n=a.fromBuffer(t);if(n.isOverflow()||n.isZero())throw new Error(s.EC_PRIVATE_KEY_TWEAK_MUL_FAIL);var r=a.fromBuffer(e);return n.umul(r).ureduce().toBuffer()},t.publicKeyCreate=function(e,t){var n=a.fromBuffer(e);if(n.isOverflow()||n.isZero())throw new Error(s.EC_PUBLIC_KEY_CREATE_FAIL);return u.mul(n).toPublicKey(t)},t.publicKeyConvert=function(e,t){var n=l.fromPublicKey(e);if(null===n)throw new Error(s.EC_PUBLIC_KEY_PARSE_FAIL);return n.toPublicKey(t)},t.publicKeyVerify=function(e){return null!==l.fromPublicKey(e)},t.publicKeyTweakAdd=function(e,t,n){var r=l.fromPublicKey(e);if(null===r)throw new Error(s.EC_PUBLIC_KEY_PARSE_FAIL);if(t=a.fromBuffer(t),t.isOverflow())throw new Error(s.EC_PUBLIC_KEY_TWEAK_ADD_FAIL);var i=u.mul(t).add(r);if(i.inf)throw new Error(s.EC_PUBLIC_KEY_TWEAK_ADD_FAIL);return i.toPublicKey(n)},t.publicKeyTweakMul=function(e,t,n){var r=l.fromPublicKey(e);if(null===r)throw new Error(s.EC_PUBLIC_KEY_PARSE_FAIL);if(t=a.fromBuffer(t),t.isOverflow()||t.isZero())throw new Error(s.EC_PUBLIC_KEY_TWEAK_MUL_FAIL);return r.mul(t).toPublicKey(n)},t.publicKeyCombine=function(e,t){for(var n=new Array(e.length),r=0;r=0)&&0===r.iadd(a.psn).redMul(d).ucmp(p.x)},t.recover=function(e,t,n,i){var o=a.fromBuffer(t.slice(0,32)),c=a.fromBuffer(t.slice(32,64));if(o.isOverflow()||c.isOverflow())throw new Error(s.ECDSA_SIGNATURE_PARSE_FAIL);do{if(o.isZero()||c.isZero())break;var h=o;if(n>>1){if(h.ucmp(a.psn)>=0)break;h=o.add(a.n)}var f=r.concat([r.from([2+(1&n)]),h.toBuffer()]),p=l.fromPublicKey(f);if(null===p)break;var d=o.uinvm(),m=a.n.sub(a.fromBuffer(e)).umul(d).ureduce(),g=c.umul(d).ureduce(),y=l.fromECJPoint(u.mulAdd(m,p,g));return y.toPublicKey(i)}while(0);throw new Error(s.ECDSA_RECOVER_FAIL)},t.ecdh=function(e,n){var r=t.ecdhUnsafe(e,n,!0);return i("sha256").update(r).digest()},t.ecdhUnsafe=function(e,t,n){var r=l.fromPublicKey(e);if(null===r)throw new Error(s.EC_PUBLIC_KEY_PARSE_FAIL);var i=a.fromBuffer(t);if(i.isOverflow()||i.isZero())throw new Error(s.ECDH_FAIL);return r.mul(i).toPublicKey(n)}},function(e,t,n){"use strict";var r=n(3),i=n(255),o=n(383),s=n(384),a=n(99);function l(e){a.call(this,"digest"),this._hash=e}r(l,a),l.prototype._update=function(e){this._hash.update(e)},l.prototype._final=function(){return this._hash.digest()},e.exports=function e(t){return t=t.toLowerCase(),"md5"===t?new i:"rmd160"===t||"ripemd160"===t?new o:new l(s(t))}},function(e,t){},function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var i=n(5).Buffer,o=n(772);function s(e,t,n){e.copy(t,n)}e.exports=function(){function e(){r(this,e),this.head=null,this.tail=null,this.length=0}return e.prototype.push=function e(t){var n={data:t,next:null};this.length>0?this.tail.next=n:this.head=n,this.tail=n,++this.length},e.prototype.unshift=function e(t){var n={data:t,next:this.head};0===this.length&&(this.tail=n),this.head=n,++this.length},e.prototype.shift=function e(){if(0!==this.length){var t=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,t}},e.prototype.clear=function e(){this.head=this.tail=null,this.length=0},e.prototype.join=function e(t){if(0===this.length)return"";for(var n=this.head,r=""+n.data;n=n.next;)r+=t+n.data;return r},e.prototype.concat=function e(t){if(0===this.length)return i.alloc(0);if(1===this.length)return this.head.data;for(var n=i.allocUnsafe(t>>>0),r=this.head,o=0;r;)s(r.data,n,o),o+=r.data.length,r=r.next;return n},e}(),o&&o.inspect&&o.inspect.custom&&(e.exports.prototype[o.inspect.custom]=function(){var e=o.inspect({length:this.length});return this.constructor.name+" "+e})},function(e,t){},function(e,t,n){"use strict";e.exports=o;var r=n(382),i=n(8);function o(e){if(!(this instanceof o))return new o(e);r.call(this,e)}i.inherits=n(3),i.inherits(o,r),o.prototype._transform=function(e,t,n){n(null,e)}},function(e,t,n){e.exports=n(257)},function(e,t,n){e.exports=n(98)},function(e,t,n){e.exports=n(256).Transform},function(e,t,n){e.exports=n(256).PassThrough},function(e,t,n){var r=n(3),i=n(120),o=n(5).Buffer,s=[1518500249,1859775393,-1894007588,-899497514],a=new Array(80);function l(){this.init(),this._w=a,i.call(this,64,56)}function u(e){return e<<5|e>>>27}function c(e){return e<<30|e>>>2}function h(e,t,n,r){return 0===e?t&n|~t&r:2===e?t&n|t&r|n&r:t^n^r}r(l,i),l.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this},l.prototype._update=function(e){for(var t=this._w,n=0|this._a,r=0|this._b,i=0|this._c,o=0|this._d,a=0|this._e,l=0;l<16;++l)t[l]=e.readInt32BE(4*l);for(;l<80;++l)t[l]=t[l-3]^t[l-8]^t[l-14]^t[l-16];for(var f=0;f<80;++f){var p=~~(f/20),d=u(n)+h(p,r,i,o)+a+t[f]+s[p]|0;a=o,o=i,i=c(r),r=n,n=d}this._a=n+this._a|0,this._b=r+this._b|0,this._c=i+this._c|0,this._d=o+this._d|0,this._e=a+this._e|0},l.prototype._hash=function(){var e=o.allocUnsafe(20);return e.writeInt32BE(0|this._a,0),e.writeInt32BE(0|this._b,4),e.writeInt32BE(0|this._c,8),e.writeInt32BE(0|this._d,12),e.writeInt32BE(0|this._e,16),e},e.exports=l},function(e,t,n){var r=n(3),i=n(120),o=n(5).Buffer,s=[1518500249,1859775393,-1894007588,-899497514],a=new Array(80);function l(){this.init(),this._w=a,i.call(this,64,56)}function u(e){return e<<1|e>>>31}function c(e){return e<<5|e>>>27}function h(e){return e<<30|e>>>2}function f(e,t,n,r){return 0===e?t&n|~t&r:2===e?t&n|t&r|n&r:t^n^r}r(l,i),l.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this},l.prototype._update=function(e){for(var t=this._w,n=0|this._a,r=0|this._b,i=0|this._c,o=0|this._d,a=0|this._e,l=0;l<16;++l)t[l]=e.readInt32BE(4*l);for(;l<80;++l)t[l]=u(t[l-3]^t[l-8]^t[l-14]^t[l-16]);for(var p=0;p<80;++p){var d=~~(p/20),m=c(n)+f(d,r,i,o)+a+t[p]+s[d]|0;a=o,o=i,i=h(r),r=n,n=m}this._a=n+this._a|0,this._b=r+this._b|0,this._c=i+this._c|0,this._d=o+this._d|0,this._e=a+this._e|0},l.prototype._hash=function(){var e=o.allocUnsafe(20);return e.writeInt32BE(0|this._a,0),e.writeInt32BE(0|this._b,4),e.writeInt32BE(0|this._c,8),e.writeInt32BE(0|this._d,12),e.writeInt32BE(0|this._e,16),e},e.exports=l},function(e,t,n){var r=n(3),i=n(385),o=n(120),s=n(5).Buffer,a=new Array(64);function l(){this.init(),this._w=a,o.call(this,64,56)}r(l,i),l.prototype.init=function(){return this._a=3238371032,this._b=914150663,this._c=812702999,this._d=4144912697,this._e=4290775857,this._f=1750603025,this._g=1694076839,this._h=3204075428,this},l.prototype._hash=function(){var e=s.allocUnsafe(28);return e.writeInt32BE(this._a,0),e.writeInt32BE(this._b,4),e.writeInt32BE(this._c,8),e.writeInt32BE(this._d,12),e.writeInt32BE(this._e,16),e.writeInt32BE(this._f,20),e.writeInt32BE(this._g,24),e},e.exports=l},function(e,t,n){var r=n(3),i=n(386),o=n(120),s=n(5).Buffer,a=new Array(160);function l(){this.init(),this._w=a,o.call(this,128,112)}r(l,i),l.prototype.init=function(){return this._ah=3418070365,this._bh=1654270250,this._ch=2438529370,this._dh=355462360,this._eh=1731405415,this._fh=2394180231,this._gh=3675008525,this._hh=1203062813,this._al=3238371032,this._bl=914150663,this._cl=812702999,this._dl=4144912697,this._el=4290775857,this._fl=1750603025,this._gl=1694076839,this._hl=3204075428,this},l.prototype._hash=function(){var e=s.allocUnsafe(48);function t(t,n,r){e.writeInt32BE(t,r),e.writeInt32BE(n,r+4)}return t(this._ah,this._al,0),t(this._bh,this._bl,8),t(this._ch,this._cl,16),t(this._dh,this._dl,24),t(this._eh,this._el,32),t(this._fh,this._fl,40),e},e.exports=l},function(e,t,n){"use strict";(function(t){var r=n(783),i=n(786),o=new t(0),s=new t([0]),a=new t([1]);function l(e,t,n,r){var o=i[e];if(void 0===o)throw new Error("hash "+e+" is not supported");this._algo=e,this._securityStrength=o.securityStrength/8,this._outlen=o.outlen/8,this._reseedInterval=281474976710656,this._init(t,n,r)}l.prototype._update=function(e){var t=r(this._algo,this._K).update(this._V).update(s);e&&t.update(e),this._K=t.digest(),this._V=r(this._algo,this._K).update(this._V).digest(),e&&(this._K=r(this._algo,this._K).update(this._V).update(a).update(e).digest(),this._V=r(this._algo,this._K).update(this._V).digest())},l.prototype._init=function(e,n,r){if(e.lengththis._reseedInterval)throw new Error("Reseed is required");n&&0===n.length&&(n=void 0),n&&this._update(n);for(var i=new t(0);i.lengthn){var r="rmd160"===e?new l:u(e);t=r.update(t).digest()}else t.lengtha?t=e(t):t.length>>13,p=0|r[1],d=8191&p,m=p>>>13,g=0|r[2],y=8191&g,v=g>>>13,b=0|r[3],_=8191&b,w=b>>>13,k=0|r[4],E=8191&k,S=k>>>13,x=0|r[5],C=8191&x,A=x>>>13,T=0|r[6],I=8191&T,j=T>>>13,R=0|r[7],B=8191&R,O=R>>>13,P=0|r[8],N=8191&P,D=P>>>13,F=0|r[9],M=8191&F,L=F>>>13,U=0|i[0],q=8191&U,z=U>>>13,K=0|i[1],H=8191&K,V=K>>>13,$=0|i[2],W=8191&$,G=$>>>13,Y=0|i[3],Z=8191&Y,J=Y>>>13,Q=0|i[4],X=8191&Q,ee=Q>>>13,te=0|i[5],ne=8191&te,re=te>>>13,ie=0|i[6],oe=8191&ie,se=ie>>>13,ae=0|i[7],le=8191&ae,ue=ae>>>13,ce=0|i[8],he=8191&ce,fe=ce>>>13,pe=0|i[9],de=8191&pe,me=pe>>>13;n.length=19,a=Math.imul(h,q),l=Math.imul(h,z),l+=Math.imul(f,q),u=Math.imul(f,z);var ge=s+a+((8191&l)<<13);s=u+(l>>>13)+(ge>>>26),ge&=67108863,a=Math.imul(d,q),l=Math.imul(d,z),l+=Math.imul(m,q),u=Math.imul(m,z),a+=Math.imul(h,H),l+=Math.imul(h,V),l+=Math.imul(f,H),u+=Math.imul(f,V);var ye=s+a+((8191&l)<<13);s=u+(l>>>13)+(ye>>>26),ye&=67108863,a=Math.imul(y,q),l=Math.imul(y,z),l+=Math.imul(v,q),u=Math.imul(v,z),a+=Math.imul(d,H),l+=Math.imul(d,V),l+=Math.imul(m,H),u+=Math.imul(m,V),a+=Math.imul(h,W),l+=Math.imul(h,G),l+=Math.imul(f,W),u+=Math.imul(f,G);var ve=s+a+((8191&l)<<13);s=u+(l>>>13)+(ve>>>26),ve&=67108863,a=Math.imul(_,q),l=Math.imul(_,z),l+=Math.imul(w,q),u=Math.imul(w,z),a+=Math.imul(y,H),l+=Math.imul(y,V),l+=Math.imul(v,H),u+=Math.imul(v,V),a+=Math.imul(d,W),l+=Math.imul(d,G),l+=Math.imul(m,W),u+=Math.imul(m,G),a+=Math.imul(h,Z),l+=Math.imul(h,J),l+=Math.imul(f,Z),u+=Math.imul(f,J);var be=s+a+((8191&l)<<13);s=u+(l>>>13)+(be>>>26),be&=67108863,a=Math.imul(E,q),l=Math.imul(E,z),l+=Math.imul(S,q),u=Math.imul(S,z),a+=Math.imul(_,H),l+=Math.imul(_,V),l+=Math.imul(w,H),u+=Math.imul(w,V),a+=Math.imul(y,W),l+=Math.imul(y,G),l+=Math.imul(v,W),u+=Math.imul(v,G),a+=Math.imul(d,Z),l+=Math.imul(d,J),l+=Math.imul(m,Z),u+=Math.imul(m,J),a+=Math.imul(h,X),l+=Math.imul(h,ee),l+=Math.imul(f,X),u+=Math.imul(f,ee);var _e=s+a+((8191&l)<<13);s=u+(l>>>13)+(_e>>>26),_e&=67108863,a=Math.imul(C,q),l=Math.imul(C,z),l+=Math.imul(A,q),u=Math.imul(A,z),a+=Math.imul(E,H),l+=Math.imul(E,V),l+=Math.imul(S,H),u+=Math.imul(S,V),a+=Math.imul(_,W),l+=Math.imul(_,G),l+=Math.imul(w,W),u+=Math.imul(w,G),a+=Math.imul(y,Z),l+=Math.imul(y,J),l+=Math.imul(v,Z),u+=Math.imul(v,J),a+=Math.imul(d,X),l+=Math.imul(d,ee),l+=Math.imul(m,X),u+=Math.imul(m,ee),a+=Math.imul(h,ne),l+=Math.imul(h,re),l+=Math.imul(f,ne),u+=Math.imul(f,re);var we=s+a+((8191&l)<<13);s=u+(l>>>13)+(we>>>26),we&=67108863,a=Math.imul(I,q),l=Math.imul(I,z),l+=Math.imul(j,q),u=Math.imul(j,z),a+=Math.imul(C,H),l+=Math.imul(C,V),l+=Math.imul(A,H),u+=Math.imul(A,V),a+=Math.imul(E,W),l+=Math.imul(E,G),l+=Math.imul(S,W),u+=Math.imul(S,G),a+=Math.imul(_,Z),l+=Math.imul(_,J),l+=Math.imul(w,Z),u+=Math.imul(w,J),a+=Math.imul(y,X),l+=Math.imul(y,ee),l+=Math.imul(v,X),u+=Math.imul(v,ee),a+=Math.imul(d,ne),l+=Math.imul(d,re),l+=Math.imul(m,ne),u+=Math.imul(m,re),a+=Math.imul(h,oe),l+=Math.imul(h,se),l+=Math.imul(f,oe),u+=Math.imul(f,se);var ke=s+a+((8191&l)<<13);s=u+(l>>>13)+(ke>>>26),ke&=67108863,a=Math.imul(B,q),l=Math.imul(B,z),l+=Math.imul(O,q),u=Math.imul(O,z),a+=Math.imul(I,H),l+=Math.imul(I,V),l+=Math.imul(j,H),u+=Math.imul(j,V),a+=Math.imul(C,W),l+=Math.imul(C,G),l+=Math.imul(A,W),u+=Math.imul(A,G),a+=Math.imul(E,Z),l+=Math.imul(E,J),l+=Math.imul(S,Z),u+=Math.imul(S,J),a+=Math.imul(_,X),l+=Math.imul(_,ee),l+=Math.imul(w,X),u+=Math.imul(w,ee),a+=Math.imul(y,ne),l+=Math.imul(y,re),l+=Math.imul(v,ne),u+=Math.imul(v,re),a+=Math.imul(d,oe),l+=Math.imul(d,se),l+=Math.imul(m,oe),u+=Math.imul(m,se),a+=Math.imul(h,le),l+=Math.imul(h,ue),l+=Math.imul(f,le),u+=Math.imul(f,ue);var Ee=s+a+((8191&l)<<13);s=u+(l>>>13)+(Ee>>>26),Ee&=67108863,a=Math.imul(N,q),l=Math.imul(N,z),l+=Math.imul(D,q),u=Math.imul(D,z),a+=Math.imul(B,H),l+=Math.imul(B,V),l+=Math.imul(O,H),u+=Math.imul(O,V),a+=Math.imul(I,W),l+=Math.imul(I,G),l+=Math.imul(j,W),u+=Math.imul(j,G),a+=Math.imul(C,Z),l+=Math.imul(C,J),l+=Math.imul(A,Z),u+=Math.imul(A,J),a+=Math.imul(E,X),l+=Math.imul(E,ee),l+=Math.imul(S,X),u+=Math.imul(S,ee),a+=Math.imul(_,ne),l+=Math.imul(_,re),l+=Math.imul(w,ne),u+=Math.imul(w,re),a+=Math.imul(y,oe),l+=Math.imul(y,se),l+=Math.imul(v,oe),u+=Math.imul(v,se),a+=Math.imul(d,le),l+=Math.imul(d,ue),l+=Math.imul(m,le),u+=Math.imul(m,ue),a+=Math.imul(h,he),l+=Math.imul(h,fe),l+=Math.imul(f,he),u+=Math.imul(f,fe);var Se=s+a+((8191&l)<<13);s=u+(l>>>13)+(Se>>>26),Se&=67108863,a=Math.imul(M,q),l=Math.imul(M,z),l+=Math.imul(L,q),u=Math.imul(L,z),a+=Math.imul(N,H),l+=Math.imul(N,V),l+=Math.imul(D,H),u+=Math.imul(D,V),a+=Math.imul(B,W),l+=Math.imul(B,G),l+=Math.imul(O,W),u+=Math.imul(O,G),a+=Math.imul(I,Z),l+=Math.imul(I,J),l+=Math.imul(j,Z),u+=Math.imul(j,J),a+=Math.imul(C,X),l+=Math.imul(C,ee),l+=Math.imul(A,X),u+=Math.imul(A,ee),a+=Math.imul(E,ne),l+=Math.imul(E,re),l+=Math.imul(S,ne),u+=Math.imul(S,re),a+=Math.imul(_,oe),l+=Math.imul(_,se),l+=Math.imul(w,oe),u+=Math.imul(w,se),a+=Math.imul(y,le),l+=Math.imul(y,ue),l+=Math.imul(v,le),u+=Math.imul(v,ue),a+=Math.imul(d,he),l+=Math.imul(d,fe),l+=Math.imul(m,he),u+=Math.imul(m,fe),a+=Math.imul(h,de),l+=Math.imul(h,me),l+=Math.imul(f,de),u+=Math.imul(f,me);var xe=s+a+((8191&l)<<13);s=u+(l>>>13)+(xe>>>26),xe&=67108863,a=Math.imul(M,H),l=Math.imul(M,V),l+=Math.imul(L,H),u=Math.imul(L,V),a+=Math.imul(N,W),l+=Math.imul(N,G),l+=Math.imul(D,W),u+=Math.imul(D,G),a+=Math.imul(B,Z),l+=Math.imul(B,J),l+=Math.imul(O,Z),u+=Math.imul(O,J),a+=Math.imul(I,X),l+=Math.imul(I,ee),l+=Math.imul(j,X),u+=Math.imul(j,ee),a+=Math.imul(C,ne),l+=Math.imul(C,re),l+=Math.imul(A,ne),u+=Math.imul(A,re),a+=Math.imul(E,oe),l+=Math.imul(E,se),l+=Math.imul(S,oe),u+=Math.imul(S,se),a+=Math.imul(_,le),l+=Math.imul(_,ue),l+=Math.imul(w,le),u+=Math.imul(w,ue),a+=Math.imul(y,he),l+=Math.imul(y,fe),l+=Math.imul(v,he),u+=Math.imul(v,fe),a+=Math.imul(d,de),l+=Math.imul(d,me),l+=Math.imul(m,de),u+=Math.imul(m,me);var Ce=s+a+((8191&l)<<13);s=u+(l>>>13)+(Ce>>>26),Ce&=67108863,a=Math.imul(M,W),l=Math.imul(M,G),l+=Math.imul(L,W),u=Math.imul(L,G),a+=Math.imul(N,Z),l+=Math.imul(N,J),l+=Math.imul(D,Z),u+=Math.imul(D,J),a+=Math.imul(B,X),l+=Math.imul(B,ee),l+=Math.imul(O,X),u+=Math.imul(O,ee),a+=Math.imul(I,ne),l+=Math.imul(I,re),l+=Math.imul(j,ne),u+=Math.imul(j,re),a+=Math.imul(C,oe),l+=Math.imul(C,se),l+=Math.imul(A,oe),u+=Math.imul(A,se),a+=Math.imul(E,le),l+=Math.imul(E,ue),l+=Math.imul(S,le),u+=Math.imul(S,ue),a+=Math.imul(_,he),l+=Math.imul(_,fe),l+=Math.imul(w,he),u+=Math.imul(w,fe),a+=Math.imul(y,de),l+=Math.imul(y,me),l+=Math.imul(v,de),u+=Math.imul(v,me);var Ae=s+a+((8191&l)<<13);s=u+(l>>>13)+(Ae>>>26),Ae&=67108863,a=Math.imul(M,Z),l=Math.imul(M,J),l+=Math.imul(L,Z),u=Math.imul(L,J),a+=Math.imul(N,X),l+=Math.imul(N,ee),l+=Math.imul(D,X),u+=Math.imul(D,ee),a+=Math.imul(B,ne),l+=Math.imul(B,re),l+=Math.imul(O,ne),u+=Math.imul(O,re),a+=Math.imul(I,oe),l+=Math.imul(I,se),l+=Math.imul(j,oe),u+=Math.imul(j,se),a+=Math.imul(C,le),l+=Math.imul(C,ue),l+=Math.imul(A,le),u+=Math.imul(A,ue),a+=Math.imul(E,he),l+=Math.imul(E,fe),l+=Math.imul(S,he),u+=Math.imul(S,fe),a+=Math.imul(_,de),l+=Math.imul(_,me),l+=Math.imul(w,de),u+=Math.imul(w,me);var Te=s+a+((8191&l)<<13);s=u+(l>>>13)+(Te>>>26),Te&=67108863,a=Math.imul(M,X),l=Math.imul(M,ee),l+=Math.imul(L,X),u=Math.imul(L,ee),a+=Math.imul(N,ne),l+=Math.imul(N,re),l+=Math.imul(D,ne),u+=Math.imul(D,re),a+=Math.imul(B,oe),l+=Math.imul(B,se),l+=Math.imul(O,oe),u+=Math.imul(O,se),a+=Math.imul(I,le),l+=Math.imul(I,ue),l+=Math.imul(j,le),u+=Math.imul(j,ue),a+=Math.imul(C,he),l+=Math.imul(C,fe),l+=Math.imul(A,he),u+=Math.imul(A,fe),a+=Math.imul(E,de),l+=Math.imul(E,me),l+=Math.imul(S,de),u+=Math.imul(S,me);var Ie=s+a+((8191&l)<<13);s=u+(l>>>13)+(Ie>>>26),Ie&=67108863,a=Math.imul(M,ne),l=Math.imul(M,re),l+=Math.imul(L,ne),u=Math.imul(L,re),a+=Math.imul(N,oe),l+=Math.imul(N,se),l+=Math.imul(D,oe),u+=Math.imul(D,se),a+=Math.imul(B,le),l+=Math.imul(B,ue),l+=Math.imul(O,le),u+=Math.imul(O,ue),a+=Math.imul(I,he),l+=Math.imul(I,fe),l+=Math.imul(j,he),u+=Math.imul(j,fe),a+=Math.imul(C,de),l+=Math.imul(C,me),l+=Math.imul(A,de),u+=Math.imul(A,me);var je=s+a+((8191&l)<<13);s=u+(l>>>13)+(je>>>26),je&=67108863,a=Math.imul(M,oe),l=Math.imul(M,se),l+=Math.imul(L,oe),u=Math.imul(L,se),a+=Math.imul(N,le),l+=Math.imul(N,ue),l+=Math.imul(D,le),u+=Math.imul(D,ue),a+=Math.imul(B,he),l+=Math.imul(B,fe),l+=Math.imul(O,he),u+=Math.imul(O,fe),a+=Math.imul(I,de),l+=Math.imul(I,me),l+=Math.imul(j,de),u+=Math.imul(j,me);var Re=s+a+((8191&l)<<13);s=u+(l>>>13)+(Re>>>26),Re&=67108863,a=Math.imul(M,le),l=Math.imul(M,ue),l+=Math.imul(L,le),u=Math.imul(L,ue),a+=Math.imul(N,he),l+=Math.imul(N,fe),l+=Math.imul(D,he),u+=Math.imul(D,fe),a+=Math.imul(B,de),l+=Math.imul(B,me),l+=Math.imul(O,de),u+=Math.imul(O,me);var Be=s+a+((8191&l)<<13);s=u+(l>>>13)+(Be>>>26),Be&=67108863,a=Math.imul(M,he),l=Math.imul(M,fe),l+=Math.imul(L,he),u=Math.imul(L,fe),a+=Math.imul(N,de),l+=Math.imul(N,me),l+=Math.imul(D,de),u+=Math.imul(D,me);var Oe=s+a+((8191&l)<<13);s=u+(l>>>13)+(Oe>>>26),Oe&=67108863,a=Math.imul(M,de),l=Math.imul(M,me),l+=Math.imul(L,de),u=Math.imul(L,me);var Pe=s+a+((8191&l)<<13);return s=u+(l>>>13)+(Pe>>>26),Pe&=67108863,o[0]=ge,o[1]=ye,o[2]=ve,o[3]=be,o[4]=_e,o[5]=we,o[6]=ke,o[7]=Ee,o[8]=Se,o[9]=xe,o[10]=Ce,o[11]=Ae,o[12]=Te,o[13]=Ie,o[14]=je,o[15]=Re,o[16]=Be,o[17]=Oe,o[18]=Pe,0!==s&&(o[19]=s,n.length++),n}},function(e,t,n){"use strict";var r=n(5).Buffer,i=n(195),o=n(387),s=n(388);function a(){this.x=i.fromBuffer(r.from("79BE667EF9DCBBAC55A06295CE870B07029BFCDB2DCE28D959F2815B16F81798","hex")),this.y=i.fromBuffer(r.from("483ADA7726A3C4655DA4FBFC0E1108A8FD17B448A68554199C47D08FFB10D4B8","hex")),this.inf=!1,this._precompute()}a.prototype._precompute=function(){for(var e=new o(this.x,this.y),t=4,n=new Array(1+Math.ceil(64.25)),r=n[0]=e,i=1;i=u;h--)c=(c<<1)+i[h];l.push(c)}for(var f=new s(null,null,null),p=new s(null,null,null),d=a;d>0;d--){for(var m=0;m=0;c--){for(var h=0;c>=0&&(u[0]=0|a[0][c],u[1]=0|a[1][c],0===u[0]&&0===u[1]);++h,--c);if(c>=0&&(h+=1),l=l.dblp(h),c<0)break;for(var f=0;f<2;f++){var p=u[f],d;0!==p&&(p>0?d=o[f][p>>1]:p<0&&(d=o[f][-p>>1].neg()),l=void 0===d.z?l.mixedAdd(d):l.add(d))}}return l},e.exports=new a},function(e,t,n){"use strict";(function(t){const r=n(152),i=n(389),o={"AES-128":{ivSize:16,keySize:16},"AES-256":{ivSize:16,keySize:32},Blowfish:{ivSize:8,cipherKeySize:32}};e.exports=((e,n,s,a)=>{const l=o[e];if(!l)return a(new Error("unkown cipherType passed"));if(!n)return a(new Error("unkown hashType passed"));const u=l.keySize,c=l.ivSize,h=20,f=t.from("key expansion"),p=2*(c+u+20);i.create(n,s,(e,n)=>{if(e)return a(e);n.digest(f,(e,i)=>{if(e)return a(e);let o=[],s=0;function l(e){n.digest(t.concat([i,f]),(t,r)=>{if(t)return e(t);let a=r.length;s+a>p&&(a=p-s),o.push(r),s+=a,n.digest(i,(t,n)=>{if(t)return e(t);i=n,e()})})}function h(e){if(e)return a(e);const n=p/2,r=t.concat(o),i=r.slice(0,n),s=r.slice(n,p),l=e=>({iv:e.slice(0,c),cipherKey:e.slice(c,c+u),macKey:e.slice(c+u)});a(null,{k1:l(i),k2:l(s)})}r(()=>s{r.generateEphmeralKeyPair(e,t)})},function(e,t,n){"use strict";(function(e){const r=n(253),i=n(252),o=n(119).bignum,s=n(376),a=s.toBase64,l=s.toBn,u={"P-256":256,"P-384":384,"P-521":521};t.generateEphmeralKeyPair=function(t,n){i(r.subtle.generateKey({name:"ECDH",namedCurve:t},!0,["deriveBits"]).then(n=>{const o=(o,s,a)=>{let l;"function"==typeof s&&(a=s,s=void 0),l=s?r.subtle.importKey("jwk",p(t,s),{name:"ECDH",namedCurve:t},!1,["deriveBits"]):Promise.resolve(n.privateKey);const c=Promise.all([r.subtle.importKey("jwk",f(t,o),{name:"ECDH",namedCurve:t},!1,[]),l]);i(c.then(e=>r.subtle.deriveBits({name:"ECDH",namedCurve:t,public:e[0]},e[1],u[t])).then(t=>e.from(t)),a)};return r.subtle.exportKey("jwk",n.publicKey).then(e=>({key:h(e),genSharedKey:o}))}),n)};const c={"P-256":32,"P-384":48,"P-521":66};function h(t){const n=c[t.crv];return e.concat([e.from([4]),l(t.x).toArrayLike(e,"be",n),l(t.y).toArrayLike(e,"be",n)],1+2*n)}function f(t,n){const r=c[t];if(!n.slice(0,1).equals(e.from([4])))throw new Error("Invalid key format");const i=new o(n.slice(1,r+1)),s=new o(n.slice(1+r));return{kty:"EC",crv:t,x:a(i,r),y:a(s,r),ext:!0}}function p(e,t){const n=f(e,t.public);return n.d=a(new o(t.private)),n}}).call(this,n(0).Buffer)},function(e,t,n){"use strict";(function(t){const r=n(794),i=n(258),o=n(35);function s(e){const t=[],n=e.split("/").slice(1);if(1===n.length&&""===n[0])return[];for(let r=0;r=n.length)throw _("invalid address: "+e);if(s.path){t.push([o,b(n.slice(r).join("/"))]);break}t.push([o,n[r]])}else t.push([o])}return t}function a(e){const t=[];return e.map(e=>{const n=w(e);t.push(n.name),e.length>1&&t.push(e[1])}),b(t.join("/"))}function l(e){return e.map(e=>{Array.isArray(e)||(e=[e]);const t=w(e);return e.length>1?[t.code,r.toBuffer(t.code,e[1])]:[t.code]})}function u(e){return e.map(e=>{const t=w(e);return e.length>1?[t.code,r.toString(t.code,e[1])]:[t.code]})}function c(e){return g(t.concat(e.map(e=>{const n=w(e);let r=t.from(o.encode(n.code));return e.length>1&&(r=t.concat([r,e[1]])),r})))}function h(e,t){if(e.size>0)return e.size/8;if(0===e.size)return 0;{const e=o.decode(t);return e+o.decode.bytes}}function f(e){const t=[];let n=0;for(;ne.length)throw _("Invalid address buffer: "+e.toString("hex"));t.push([r,u])}return t}function p(e){const t=f(e),n=u(t);return a(n)}function d(e){e=b(e);const t=s(e),n=l(t);return c(n)}function m(e){return d(e)}function g(e){const n=y(e);if(n)throw n;return t.from(e)}function y(e){try{f(e)}catch(e){return e}}function v(e){return void 0===y(e)}function b(e){return"/"+e.trim().split("/").filter(e=>e).join("/")}function _(e){return new Error("Error parsing address: "+e)}function w(e){const t=i(e[0]);return t}e.exports={stringToStringTuples:s,stringTuplesToString:a,tuplesToStringTuples:u,stringTuplesToTuples:l,bufferToTuples:f,tuplesToBuffer:c,bufferToString:p,stringToBuffer:d,fromString:m,fromBuffer:g,validateBuffer:y,isValidBuffer:v,cleanPath:b,ParseError:_,protoFromTuple:w,sizeForAddr:h}}).call(this,n(0).Buffer)},function(e,t,n){"use strict";(function(t){const r=n(795),i=n(796),o=n(258),s=n(70),a=n(798),l=n(35);function u(e,n){return n instanceof t?u.toString(e,n):u.toBuffer(e,n)}function c(e){if(!i(e))throw new Error("invalid ip address");return r.toBuffer(e)}function h(e){const t=r.toString(e);if(!i(t))throw new Error("invalid ip address");return t}function f(e){const n=t.alloc(2);return n.writeUInt16BE(e,0),n}function p(e){return e.readUInt16BE(0)}function d(e){const n=t.from(e),r=t.from(l.encode(n.length));return t.concat([r,n])}function m(e){const t=l.decode(e);if(e=e.slice(l.decode.bytes),e.length!==t)throw new Error("inconsistent lengths");return e.toString()}function g(e){const n=t.from(s.decode(e)),r=t.from(l.encode(n.length));return t.concat([r,n])}function y(e){const t=l.decode(e),n=e.slice(l.decode.bytes);if(n.length!==t)throw new Error("inconsistent lengths");return s.encode(n)}function v(e){const n=e.split(":");if(2!==n.length)throw new Error("failed to parse onion addr: "+n+" does not contain a port number");if(16!==n[0].length)throw new Error("failed to parse onion addr: "+n[0]+" not a Tor onion address.");const r=t.from(a.decode.asBytes(n[0].toUpperCase())),i=parseInt(n[1],10);if(i<1||i>65536)throw new Error("Port number is not in range(1, 65536)");const o=f(i);return t.concat([r,o])}function b(e){const n=e.split(":");if(2!==n.length)throw new Error("failed to parse onion addr: "+n+" does not contain a port number");if(56!==n[0].length)throw new Error("failed to parse onion addr: "+n[0]+" not a Tor onion3 address.");const r=t.from(a.decode.asBytes(n[0].toUpperCase())),i=parseInt(n[1],10);if(i<1||i>65536)throw new Error("Port number is not in range(1, 65536)");const o=f(i);return t.concat([r,o])}function _(e){const t=e.slice(0,e.length-2),n=e.slice(e.length-2),r=a.encode(t).toString("ascii").toLowerCase(),i=p(n);return r+":"+i}e.exports=u,u.toString=function e(t,n){switch(t=o(t),t.code){case 4:case 41:return h(n);case 6:case 273:case 33:case 132:return p(n);case 53:case 54:case 55:case 56:case 400:return m(n);case 421:return y(n);case 444:case 445:return _(n);default:return n.toString("hex")}},u.toBuffer=function e(n,r){switch(n=o(n),n.code){case 4:case 41:return c(r);case 6:case 273:case 33:case 132:return f(parseInt(r,10));case 53:case 54:case 55:case 56:case 400:return d(r);case 421:return g(r);case 444:return v(r);case 445:return b(r);default:return t.from(r,"hex")}}}).call(this,n(0).Buffer)},function(e,t,n){"use strict";var r=t,i=n(0).Buffer,o=n(196);r.toBuffer=function(e,t,n){var r;if(n=~~n,this.isV4Format(e))r=t||new i(n+4),e.split(/\./g).map(function(e){r[n++]=255&parseInt(e,10)});else if(this.isV6Format(e)){var o=e.split(":",8),s;for(s=0;s0;s--)u.push("0");o.splice.apply(o,u)}for(r=t||new i(n+16),s=0;s>8&255,r[n++]=255&c}}if(!r)throw Error("Invalid ip address: "+e);return r},r.toString=function(e,t,n){t=~~t,n=n||e.length-t;var r=[];if(4===n){for(var i=0;i32?"ipv6":l(t);var n=4;"ipv6"===t&&(n=16);for(var o=new i(n),s=0,a=o.length;s>u)}return r.toString(o)},r.mask=function(e,t){e=r.toBuffer(e),t=r.toBuffer(t);var n=new i(Math.max(e.length,t.length)),o=0;if(e.length===t.length)for(o=0;oe.length&&(i=t,o=e);for(var s=i.length-o.length,n=s;n>>0},r.fromLong=function(e){return(e>>>24)+"."+(e>>16&255)+"."+(e>>8&255)+"."+(255&e)}},function(e,t,n){"use strict";const r=n(797),i=e.exports=(e=>r({exact:!0}).test(e));i.v4=(e=>r.v4({exact:!0}).test(e)),i.v6=(e=>r.v6({exact:!0}).test(e))},function(e,t,n){"use strict";const r="(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])(?:\\.(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])){3}",i="[0-9a-fA-F]{1,4}",o=`\n(\n(?:${i}:){7}(?:${i}|:)| // 1:2:3:4:5:6:7:: 1:2:3:4:5:6:7:8\n(?:${i}:){6}(?:${r}|:${i}|:)| // 1:2:3:4:5:6:: 1:2:3:4:5:6::8 1:2:3:4:5:6::8 1:2:3:4:5:6::1.2.3.4\n(?:${i}:){5}(?::${r}|(:${i}){1,2}|:)| // 1:2:3:4:5:: 1:2:3:4:5::7:8 1:2:3:4:5::8 1:2:3:4:5::7:1.2.3.4\n(?:${i}:){4}(?:(:${i}){0,1}:${r}|(:${i}){1,3}|:)| // 1:2:3:4:: 1:2:3:4::6:7:8 1:2:3:4::8 1:2:3:4::6:7:1.2.3.4\n(?:${i}:){3}(?:(:${i}){0,2}:${r}|(:${i}){1,4}|:)| // 1:2:3:: 1:2:3::5:6:7:8 1:2:3::8 1:2:3::5:6:7:1.2.3.4\n(?:${i}:){2}(?:(:${i}){0,3}:${r}|(:${i}){1,5}|:)| // 1:2:: 1:2::4:5:6:7:8 1:2::8 1:2::4:5:6:7:1.2.3.4\n(?:${i}:){1}(?:(:${i}){0,4}:${r}|(:${i}){1,6}|:)| // 1:: 1::3:4:5:6:7:8 1::8 1::3:4:5:6:7:1.2.3.4\n(?::((?::${i}){0,5}:${r}|(?::${i}){1,7}|:)) // ::2:3:4:5:6:7:8 ::2:3:4:5:6:7:8 ::8 ::1.2.3.4\n)(%[0-9a-zA-Z]{1,})? // %eth0 %1\n`.replace(/\s*\/\/.*$/gm,"").replace(/\n/g,"").trim(),s=e.exports=(e=>e&&e.exact?new RegExp(`(?:^${r}$)|(?:^${o}$)`):new RegExp(`(?:${r})|(?:${o})`,"g"));s.v4=(e=>e&&e.exact?new RegExp(`^${r}$`):new RegExp(r,"g")),s.v6=(e=>e&&e.exact?new RegExp(`^${o}$`):new RegExp(o,"g"))},function(e,t,n){(function(t,r){var i; -/* - * [hi-base32]{@link https://github.com/emn178/hi-base32} - * - * @version 0.5.0 - * @author Chen, Yi-Cyuan [emn178@gmail.com] - * @copyright Chen, Yi-Cyuan 2015-2018 - * @license MIT - */ -/* - * [hi-base32]{@link https://github.com/emn178/hi-base32} - * - * @version 0.5.0 - * @author Chen, Yi-Cyuan [emn178@gmail.com] - * @copyright Chen, Yi-Cyuan 2015-2018 - * @license MIT - */ -!function(){"use strict";var o="object"==typeof window?window:{},s=!o.HI_BASE32_NO_NODE_JS&&"object"==typeof t&&t.versions&&t.versions.node;s&&(o=r);var a=!o.HI_BASE32_NO_COMMON_JS&&"object"==typeof e&&e.exports,l=n(356),u="ABCDEFGHIJKLMNOPQRSTUVWXYZ234567".split(""),c={A:0,B:1,C:2,D:3,E:4,F:5,G:6,H:7,I:8,J:9,K:10,L:11,M:12,N:13,O:14,P:15,Q:16,R:17,S:18,T:19,U:20,V:21,W:22,X:23,Y:24,Z:25,2:26,3:27,4:28,5:29,6:30,7:31},h=[0,0,0,0,0,0,0,0],f=function(e,t){t.length>10&&(t="..."+t.substr(-10));var n=new Error("Decoded data is not valid UTF-8. Maybe try base32.decode.asBytes()? Partial data after reading "+e+" bytes: "+t+" <-");throw n.position=e,n},p=function(e){for(var t="",n=e.length,r=0,i=0,o,s;r191&&o<=223?(s=31&o,i=1):o<=239?(s=15&o,i=2):o<=247?(s=7&o,i=3):f(r,t);for(var a=0;a191)&&f(r,t),s<<=6,s+=63&o;s>=55296&&s<=57343&&f(r,t),s>1114111&&f(r,t),s<=65535?t+=String.fromCharCode(s):(s-=65536,t+=String.fromCharCode(55296+(s>>10)),t+=String.fromCharCode(56320+(1023&s)))}return t},d=function(e){if(!/^[A-Z2-7=]+$/.test(e))throw new Error("Invalid base32 characters");e=e.replace(/=/g,"");for(var t,n,r,i,o,s,a,l,u=[],h=0,f=e.length,p=0,d=f>>3<<3;p>>2),u[h++]=255&(n<<6|r<<1|i>>>4),u[h++]=255&(i<<4|o>>>1),u[h++]=255&(o<<7|s<<2|a>>>3),u[h++]=255&(a<<5|l);var m=f-d;return 2===m?(t=c[e.charAt(p++)],n=c[e.charAt(p++)],u[h++]=255&(t<<3|n>>>2)):4===m?(t=c[e.charAt(p++)],n=c[e.charAt(p++)],r=c[e.charAt(p++)],i=c[e.charAt(p++)],u[h++]=255&(t<<3|n>>>2),u[h++]=255&(n<<6|r<<1|i>>>4)):5===m?(t=c[e.charAt(p++)],n=c[e.charAt(p++)],r=c[e.charAt(p++)],i=c[e.charAt(p++)],o=c[e.charAt(p++)],u[h++]=255&(t<<3|n>>>2),u[h++]=255&(n<<6|r<<1|i>>>4),u[h++]=255&(i<<4|o>>>1)):7===m&&(t=c[e.charAt(p++)],n=c[e.charAt(p++)],r=c[e.charAt(p++)],i=c[e.charAt(p++)],o=c[e.charAt(p++)],s=c[e.charAt(p++)],a=c[e.charAt(p++)],u[h++]=255&(t<<3|n>>>2),u[h++]=255&(n<<6|r<<1|i>>>4),u[h++]=255&(i<<4|o>>>1),u[h++]=255&(o<<7|s<<2|a>>>3)),u},m=function(e){for(var t,n,r,i,o,s="",a=e.length,l=0,c=5*parseInt(a/5);l>>3]+u[31&(t<<2|n>>>6)]+u[n>>>1&31]+u[31&(n<<4|r>>>4)]+u[31&(r<<1|i>>>7)]+u[i>>>2&31]+u[31&(i<<3|o>>>5)]+u[31&o];var h=a-c;return 1===h?(t=e.charCodeAt(l),s+=u[t>>>3]+u[t<<2&31]+"======"):2===h?(t=e.charCodeAt(l++),n=e.charCodeAt(l),s+=u[t>>>3]+u[31&(t<<2|n>>>6)]+u[n>>>1&31]+u[n<<4&31]+"===="):3===h?(t=e.charCodeAt(l++),n=e.charCodeAt(l++),r=e.charCodeAt(l),s+=u[t>>>3]+u[31&(t<<2|n>>>6)]+u[n>>>1&31]+u[31&(n<<4|r>>>4)]+u[r<<1&31]+"==="):4===h&&(t=e.charCodeAt(l++),n=e.charCodeAt(l++),r=e.charCodeAt(l++),i=e.charCodeAt(l),s+=u[t>>>3]+u[31&(t<<2|n>>>6)]+u[n>>>1&31]+u[31&(n<<4|r>>>4)]+u[31&(r<<1|i>>>7)]+u[i>>>2&31]+u[i<<3&31]+"="),s},g=function(e){var t,n,r,i,o,s,a=!1,l="",c=0,f,p=0,d=0,m=e.length;do{for(h[0]=h[5],h[1]=h[6],h[2]=h[7],f=p;c>6,h[f++]=128|63&s):s<55296||s>=57344?(h[f++]=224|s>>12,h[f++]=128|s>>6&63,h[f++]=128|63&s):(s=65536+((1023&s)<<10|1023&e.charCodeAt(++c)),h[f++]=240|s>>18,h[f++]=128|s>>12&63,h[f++]=128|s>>6&63,h[f++]=128|63&s);d+=f-p,p=f-5,c===m&&++c,c>m&&f<6&&(a=!0),t=h[0],f>4?(n=h[1],r=h[2],i=h[3],o=h[4],l+=u[t>>>3]+u[31&(t<<2|n>>>6)]+u[n>>>1&31]+u[31&(n<<4|r>>>4)]+u[31&(r<<1|i>>>7)]+u[i>>>2&31]+u[31&(i<<3|o>>>5)]+u[31&o]):1===f?l+=u[t>>>3]+u[t<<2&31]+"======":2===f?(n=h[1],l+=u[t>>>3]+u[31&(t<<2|n>>>6)]+u[n>>>1&31]+u[n<<4&31]+"===="):3===f?(n=h[1],r=h[2],l+=u[t>>>3]+u[31&(t<<2|n>>>6)]+u[n>>>1&31]+u[31&(n<<4|r>>>4)]+u[r<<1&31]+"==="):(n=h[1],r=h[2],i=h[3],l+=u[t>>>3]+u[31&(t<<2|n>>>6)]+u[n>>>1&31]+u[31&(n<<4|r>>>4)]+u[31&(r<<1|i>>>7)]+u[i>>>2&31]+u[i<<3&31]+"=")}while(!a);return l},y=function(e){for(var t,n,r,i,o,s="",a=e.length,l=0,c=5*parseInt(a/5);l>>3]+u[31&(t<<2|n>>>6)]+u[n>>>1&31]+u[31&(n<<4|r>>>4)]+u[31&(r<<1|i>>>7)]+u[i>>>2&31]+u[31&(i<<3|o>>>5)]+u[31&o];var h=a-c;return 1===h?(t=e[l],s+=u[t>>>3]+u[t<<2&31]+"======"):2===h?(t=e[l++],n=e[l],s+=u[t>>>3]+u[31&(t<<2|n>>>6)]+u[n>>>1&31]+u[n<<4&31]+"===="):3===h?(t=e[l++],n=e[l++],r=e[l],s+=u[t>>>3]+u[31&(t<<2|n>>>6)]+u[n>>>1&31]+u[31&(n<<4|r>>>4)]+u[r<<1&31]+"==="):4===h&&(t=e[l++],n=e[l++],r=e[l++],i=e[l],s+=u[t>>>3]+u[31&(t<<2|n>>>6)]+u[n>>>1&31]+u[31&(n<<4|r>>>4)]+u[31&(r<<1|i>>>7)]+u[i>>>2&31]+u[i<<3&31]+"="),s},v=function(e,t){var n="string"!=typeof e;return n&&e.constructor===ArrayBuffer&&(e=new Uint8Array(e)),n?y(e):t?m(e):g(e)},b=function(e,t){if(!t)return p(d(e));if(!/^[A-Z2-7=]+$/.test(e))throw new Error("Invalid base32 characters");var n,r,i,o,s,a,l,u,h="",f=e.indexOf("=");-1===f&&(f=e.length);for(var m=0,g=f>>3<<3;m>>2))+String.fromCharCode(255&(r<<6|i<<1|o>>>4))+String.fromCharCode(255&(o<<4|s>>>1))+String.fromCharCode(255&(s<<7|a<<2|l>>>3))+String.fromCharCode(255&(l<<5|u));var y=f-g;return 2===y?(n=c[e.charAt(m++)],r=c[e.charAt(m++)],h+=String.fromCharCode(255&(n<<3|r>>>2))):4===y?(n=c[e.charAt(m++)],r=c[e.charAt(m++)],i=c[e.charAt(m++)],o=c[e.charAt(m++)],h+=String.fromCharCode(255&(n<<3|r>>>2))+String.fromCharCode(255&(r<<6|i<<1|o>>>4))):5===y?(n=c[e.charAt(m++)],r=c[e.charAt(m++)],i=c[e.charAt(m++)],o=c[e.charAt(m++)],s=c[e.charAt(m++)],h+=String.fromCharCode(255&(n<<3|r>>>2))+String.fromCharCode(255&(r<<6|i<<1|o>>>4))+String.fromCharCode(255&(o<<4|s>>>1))):7===y&&(n=c[e.charAt(m++)],r=c[e.charAt(m++)],i=c[e.charAt(m++)],o=c[e.charAt(m++)],s=c[e.charAt(m++)],a=c[e.charAt(m++)],l=c[e.charAt(m++)],h+=String.fromCharCode(255&(n<<3|r>>>2))+String.fromCharCode(255&(r<<6|i<<1|o>>>4))+String.fromCharCode(255&(o<<4|s>>>1))+String.fromCharCode(255&(s<<7|a<<2|l>>>3))),h},_={encode:v,decode:b};b.asBytes=d,a?e.exports=_:(o.base32=_,l&&(i=function(){return _}.call(_,n,_,e),void 0===i||(e.exports=i)))}()}).call(this,n(2),n(7))},function(e,t,n){"use strict";const{ensureMultiaddr:r}=n(390),i=n(800);class o{constructor(e){this._multiaddrs=e||[],this._observedMultiaddrs=[]}add(e){e=r(e),this.has(e)||this._multiaddrs.push(e)}addSafe(e){e=r(e);const t=this._observedMultiaddrs.some((t,n)=>{if(t.equals(e))return this.add(e),this._observedMultiaddrs.splice(n,1),!0});t||this._observedMultiaddrs.push(e)}toArray(){return this._multiaddrs.slice()}get size(){return this._multiaddrs.length}forEach(e){return this._multiaddrs.forEach(e)}filterBy(e){return"object"!=typeof e||"function"!=typeof e.matches||"function"!=typeof e.partialMatch||"function"!=typeof e.toString?[]:this._multiaddrs.filter(t=>e.matches(t))}has(e){return e=r(e),this._multiaddrs.some(t=>t.equals(e))}delete(e){e=r(e),this._multiaddrs.some((t,n)=>{if(t.equals(e))return this._multiaddrs.splice(n,1),!0})}replace(e,t){Array.isArray(e)||(e=[e]),Array.isArray(t)||(t=[t]),e.forEach(e=>this.delete(e)),t.forEach(e=>this.add(e))}clear(){this._multiaddrs=[]}distinct(){return i(this._multiaddrs,e=>[e.toOptions().port,e.toOptions().transport].join())}}e.exports=o},function(e,t,n){"use strict";function r(e,t){var n=[],r={};if("function"!=typeof t){var i=t;t=function e(t){return t[i]}}return e.forEach(function e(i){var o=t(i);r[o]||(r[o]=!0,n.push(i))}),n}e.exports=r},function(e,t,n){"use strict";const r=n(802),i={16:"aes-128-ctr",32:"aes-256-ctr"};t.create=function(e,t,n){const o=i[e.length];if(!o)return n(new Error("Invalid key length"));const s=r.createCipheriv(o,e,t),a=r.createDecipheriv(o,e,t),l={encrypt(e,t){t(null,s.update(e))},decrypt(e,t){t(null,a.update(e))}};n(null,l)}},function(e,t,n){"use strict";const r=n(803);e.exports={createCipheriv:r.createCipheriv,createDecipheriv:r.createDecipheriv}},function(e,t,n){var r=n(804),i=n(812),o=n(394);function s(){return Object.keys(o)}t.createCipher=t.Cipher=r.createCipher,t.createCipheriv=t.Cipheriv=r.createCipheriv,t.createDecipher=t.Decipher=i.createDecipher,t.createDecipheriv=t.Decipheriv=i.createDecipheriv,t.listCiphers=t.getCiphers=s},function(e,t,n){var r=n(391),i=n(395),o=n(5).Buffer,s=n(396),a=n(99),l=n(197),u=n(397),c=n(3);function h(e,t,n){a.call(this),this._cache=new p,this._cipher=new l.AES(t),this._prev=o.from(n),this._mode=e,this._autopadding=!0}c(h,a),h.prototype._update=function(e){var t,n;this._cache.add(e);for(var r=[];t=this._cache.get();)n=this._mode.encrypt(this,t),r.push(n);return o.concat(r)};var f=o.alloc(16,16);function p(){this.cache=o.allocUnsafe(0)}function d(e,t,n){var a=r[e.toLowerCase()];if(!a)throw new TypeError("invalid suite type");if("string"==typeof t&&(t=o.from(t)),t.length!==a.key/8)throw new TypeError("invalid key length "+t.length);if("string"==typeof n&&(n=o.from(n)),"GCM"!==a.mode&&n.length!==a.iv)throw new TypeError("invalid iv length "+n.length);return"stream"===a.type?new s(a.module,t,n):"auth"===a.type?new i(a.module,t,n):new h(a.module,t,n)}function m(e,t){var n=r[e.toLowerCase()];if(!n)throw new TypeError("invalid suite type");var i=u(t,!1,n.key,n.iv);return d(e,i.key,i.iv)}h.prototype._final=function(){var e=this._cache.flush();if(this._autopadding)return e=this._mode.encrypt(this,e),this._cipher.scrub(),e;if(!e.equals(f))throw this._cipher.scrub(),new Error("data not multiple of block length")},h.prototype.setAutoPadding=function(e){return this._autopadding=!!e,this},p.prototype.add=function(e){this.cache=o.concat([this.cache,e])},p.prototype.get=function(){if(this.cache.length>15){var e=this.cache.slice(0,16);return this.cache=this.cache.slice(16),e}return null},p.prototype.flush=function(){for(var e=16-this.cache.length,t=o.allocUnsafe(e),n=-1;++n>i%8,e._prev=o(e._prev,n?l:u);return a}function o(e,t){var n=e.length,i=-1,o=r.allocUnsafe(e.length);for(e=r.concat([e,r.from([t])]);++i>7;return o}t.encrypt=function(e,t,n){for(var o=t.length,s=r.allocUnsafe(o),a=-1;++a>>0,0),t.writeUInt32BE(e[1]>>>0,4),t.writeUInt32BE(e[2]>>>0,8),t.writeUInt32BE(e[3]>>>0,12),t}function a(e){this.h=e,this.state=r.alloc(16,0),this.cache=r.allocUnsafe(0)}a.prototype.ghash=function(e){for(var t=-1;++t0;n--)e[n]=e[n]>>>1|(1&e[n-1])<<31;e[0]=e[0]>>>1,i&&(e[0]=e[0]^225<<24)}this.state=s(t)},a.prototype.update=function(e){var t;for(this.cache=r.concat([this.cache,e]);this.cache.length>=16;)t=this.cache.slice(0,16),this.cache=this.cache.slice(16),this.ghash(t)},a.prototype.final=function(e,t){return this.cache.length&&this.ghash(r.concat([this.cache,i],16)),this.ghash(s([0,e,0,t])),this.state},e.exports=a},function(e,t,n){var r=n(395),i=n(5).Buffer,o=n(391),s=n(396),a=n(99),l=n(197),u=n(397),c=n(3);function h(e,t,n){a.call(this),this._cache=new f,this._last=void 0,this._cipher=new l.AES(t),this._prev=i.from(n),this._mode=e,this._autopadding=!0}function f(){this.cache=i.allocUnsafe(0)}function p(e){var t=e[15];if(t<1||t>16)throw new Error("unable to decrypt data");for(var n=-1;++n16)return t=this.cache.slice(0,16),this.cache=this.cache.slice(16),t}else if(this.cache.length>=16)return t=this.cache.slice(0,16),this.cache=this.cache.slice(16),t;return null},f.prototype.flush=function(){if(this.cache.length)return this.cache},t.createDecipher=m,t.createDecipheriv=d},function(e,t,n){"use strict";const r=n(371),i=n(30),o={sha1:"sha1","sha2-256":"sha256","sha2-512":"sha512"};function s(e,t,n,s,a){const l=o[a];if(!l)throw new Error(`Hash '${a}' is unknown or not supported`);const u=r(e,t,n,s,l);return i.encode64(u)}e.exports=s},function(e,t,n){"use strict";(function(t){const r=n(27),i=n(60),o=n(115),s=n(95),a=n(815),l=n(39);class u{constructor(e,n,s,a){if(c.isCID(e)){const n=e;return this.version=n.version,this.codec=n.codec,this.multihash=t.from(n.multihash),void(this.multibaseName=n.multibaseName||(0===n.version?"base58btc":"base32"))}if("string"==typeof e){const t=i.isEncoded(e);if(t){const n=i.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=r.fromB58String(e),this.multibaseName="base58btc";return u.validateCID(this),void Object.defineProperty(this,"string",{value:e})}if(t.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";u.validateCID(this)}else this.version=e,this.codec=n,this.multihash=s,this.multibaseName=a||(0===e?"base58btc":"base32"),u.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=t.concat([t.from("01","hex"),o.getCodeVarint(this.codec),this.multihash])}Object.defineProperty(this,"_buffer",{value:e})}return e}get prefix(){return t.concat([t.from(`0${this.version}`,"hex"),o.getCodeVarint(this.codec),r.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}=r.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 c(0,this.codec,this.multihash)}toV1(){return new c(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=r.toB58String(this.multihash)}else{if(1!==this.version)throw new Error("unsupported version");t=i.encode(e,this.buffer).toString()}return e===this.multibaseName&&Object.defineProperty(this,"string",{value:t}),t}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){let t=a.checkCIDComponents(e);if(t)throw new Error(t)}}const c=l(u,{className:"CID",symbolName:"@ipld/js-cid/CID"});c.codecs=s,e.exports=c}).call(this,n(0).Buffer)},function(e,t,n){"use strict";(function(t){const r=n(27);var i={checkCIDComponents:function(e){if(null==e)return"null values are not valid CIDs";if(0!==e.version&&1!==e.version)return"Invalid version, must be a number equal to 1 or 0";if("string"!=typeof e.codec)return"codec must be string";if(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(!t.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=i}).call(this,n(0).Buffer)},function(e,t,n){"use strict";const r=n(21),i=n(72),{struct:o,superstruct:s}=n(399),{optional:a,union:l}=o,u=s({types:{multiaddr:e=>{if(null===e)return`multiaddr invalid, value must be a string, Buffer, or another Multiaddr got ${e}`;try{r(e)}catch(e){return`multiaddr invalid, ${e.message}`}return!0},"multiaddr-ipfs":e=>!!i.IPFS.matches(e)||"multiaddr IPFS invalid"}}),c=u({repo:a(u("object|string")),repoOwner:"boolean?",preload:u({enabled:"boolean?",addresses:a(u(["multiaddr"])),interval:"number?"},{enabled:!0,interval:3e4}),init:a(l(["boolean",u({bits:"number?",emptyRepo:"boolean?",privateKey:a(u("object|string")),pass:"string?"})])),start:"boolean?",offline:"boolean?",pass:"string?",silent:"boolean?",relay:"object?",EXPERIMENTAL:a(u({pubsub:"boolean?",ipnsPubsub:"boolean?",sharding:"boolean?",dht:"boolean?"})),connectionManager:"object?",config:a(u({API:"object?",Addresses:a(u({Swarm:a(u(["multiaddr"])),API:"multiaddr?",Gateway:"multiaddr"})),Discovery:a(u({MDNS:a(u({Enabled:"boolean?",Interval:"number?"})),webRTCStar:a(u({Enabled:"boolean?"}))})),Bootstrap:a(u(["multiaddr-ipfs"]))})),libp2p:a(l(["function","object"]))},{repoOwner:!0}),h=e=>{const[t,n]=c.validate(e);if(t)throw t;return n};e.exports={validate:h}},function(e,t,n){"use strict";const r=n(10),i=n(259).errors;function o(e){return!!e&&(e.code===i.ERR_REPO_NOT_INITIALIZED||!!(e.message.match(/not found/)||e.message.match(/ENOENT/)||e.message.match(/No value/)))}e.exports=(e=>{e.log("booting");const t=e._options,n=t.init,i=t.start;r([t=>{if(!e._repo.closed)return t(null,!0);e._repo.open((e,n)=>o(e)?t(null,!1):e?t(e):void t(null,!0))},(r,i)=>{if(r)return e.init({repo:e._repo},e=>{if(e)return i(Object.assign(e,{emitted:!0}));i()});if(n){const n=Object.assign({bits:2048,pass:e._options.pass},"object"==typeof t.init?t.init:{});return e.init(n,e=>{if(e)return i(Object.assign(e,{emitted:!0}));i()})}i()},t=>{if(!i)return t();e.start(e=>{if(e)return t(Object.assign(e,{emitted:!0}));t()})}],t=>{t?t.emitted||e.emit("error",t):(e.log("booted"),e.emit("ready"))})})},function(e,t,n){"use strict";t.create=function e(t,n,r){const i=r.storageBackends[t],o=Object.assign({},r.storageBackendOptions[t]||{});return new i(n,o)}},function(e,t,n){"use strict";(function(t){const r=n(28).Key,i=n(4),o=i("repo:version"),s=new r("version");e.exports=(e=>({exists(t){e.has(s,t)},get(t){e.get(s,(e,n)=>{if(e)return t(e);t(null,parseInt(n.toString().trim(),10))})},set(n,r){e.put(s,t.from(String(n)),r)},check(e,t){this.get((n,r)=>{if(n)return t(n);o("comparing version: %s and %s",r,e);const i=6===r&&7===e||6===e&&7===r;if(r!==e&&!i)return t(new Error(`ipfs repo needs migration: expected version v${e}, found version v${r}`));t()})}}))}).call(this,n(0).Buffer)},function(e,t,n){"use strict";const r=n(18),i=n(19),o=n(260).asyncFilter,s=n(260).asyncSort,a=n(401),l=n(404);class u{constructor(){this.data={}}open(e){i(e)}put(e,t,n){this.data[e.toString()]=t,i(n)}get(e,t){this.has(e,(n,r)=>n?t(n):r?void t(null,this.data[e.toString()]):t(l.notFoundError()))}has(e,t){i(()=>{t(null,void 0!==this.data[e.toString()])})}delete(e,t){delete this.data[e.toString()],i(()=>{t()})}batch(){let e=[],t=[];return{put(t,n){e.push([t,n])},delete(e){t.push(e)},commit:n=>{e.forEach(e=>{this.data[e[0].toString()]=e[1]}),e=[],t.forEach(e=>{delete this.data[e.toString()]}),t=[],i(n)}}}query(e){let t=[r.keys(this.data),r.map(e=>({key:new a(e),value:this.data[e]}))],n=[];if(null!=e.prefix){const t=e.prefix;n.push((e,n)=>n(null,e.key.toString().startsWith(t)))}if(null!=e.filters&&(n=n.concat(e.filters)),t=t.concat(n.map(e=>o(e))),null!=e.orders&&(t=t.concat(e.orders.map(e=>s(e)))),null!=e.offset){let n=0;t.push(r.filter(()=>n++>=e.offset))}return null!=e.limit&&t.push(r.take(e.limit)),!0===e.keysOnly&&t.push(r.map(e=>({key:e.key}))),r.apply(null,t)}close(e){i(e)}}e.exports=u},function(e,t,n){"use strict";const r=n(28).Key,i=n(106),o=n(10),s=n(200),a=n(822),l=n(0).Buffer,u=new r("config");e.exports=(e=>{const t=i(r,1),n={get(t,n){"function"==typeof t&&(n=t,t=void 0),t||(t=void 0),e.get(u,(e,r)=>{if(e)return n(e);let i;try{i=JSON.parse(r.toString())}catch(e){return n(e)}if(void 0===t)return n(null,i);if("string"!=typeof t)return n(new Error("Key "+t+" must be a string."));const o=s(i,t,null);if(null===o)return n(new Error("Key "+t+" does not exist in config."));n(null,o)})},set(e,n,r){if("function"==typeof n)r=n,n=e,e=void 0;else if(!e||"string"!=typeof e)return r(new Error("Invalid key type"));if(void 0===n||l.isBuffer(n))return r(new Error("Invalid value type"));t.push({key:e,value:n},r)},exists(t){e.has(u,t)}};return n;function r(e,t){const r=e.key,i=e.value;r?o([e=>n.get(e),(e,t)=>{a(e,r,i),t(null,e)},c],t):c(i,t)}function c(t,n){const r=l.from(JSON.stringify(t,null,2));e.put(u,r,n)}})},function(e,t){function n(e,t,n){"string"==typeof t&&(t=t.split(".")),"symbol"==typeof t&&(t=[t]);var r=t.pop(),i;if(!r)return!1;for(;i=t.shift();)if(void 0===e[i]&&(e[i]={}),e=e[i],!e||"object"!=typeof e)return!1;return e[r]=n,!0}e.exports=n},function(e,t,n){"use strict";(function(t){const r=n(28).Key,i=n(824),o=new r("datastore_spec");e.exports=(e=>({exists(t){e.has(o,t)},get(t){e.get(o,(e,n)=>{if(e)return t(e);t(null,JSON.parse(n.toString()))})},set(n,r){e.put(o,t.from(JSON.stringify(i(n,{deep:!0}))),r)}}))}).call(this,n(0).Buffer)},function(e,t,n){"use strict";const r=n(349);e.exports=((e,t)=>{if(!r(e))throw new TypeError("Expected a plain object");if(t=t||{},"function"==typeof t)throw new TypeError("Specify the compare function as an option instead");const n=t.deep,i=[],o=[],s=e=>{const a=i.indexOf(e);if(-1!==a)return o[a];const l={},u=Object.keys(e).sort(t.compare);i.push(e),o.push(l);for(let t=0;t({get(t){e.get(i,(e,n)=>t(e,n&&n.toString()))},set(n,r){e.put(i,t.from(n.toString()),r)},delete(t){e.delete(i,t)}}))}).call(this,n(0).Buffer)},function(e,t,n){"use strict";const r=n(405),i=r.ShardingDatastore,o=n(28).Key,s=n(407),a=n(114),l=n(19),u=n(408),c=n(834),h=n(12),f=n(33),p=e=>{const t=new s.Encoder;return new o("/"+t.write(e).finalize(),!1)},d=e=>p(e.buffer);function m(e,t,n){if(t.sharding){const t=new r.shard.NextToLast(2);i.createOrOpen(e,t,n)}else l(()=>n(null,e))}function g(e){return{query(t,n){h(e.query(t),f(n))},get(t,n){if(!c.isCID(t))return l(()=>{n(new Error("Not a valid cid"))});const r=d(t);e.get(r,(i,o)=>{if(i){if("ERR_NOT_FOUND"===i.code){const o=y(t);if(!o)return n(i);const s=d(o);return e.get(s,(i,o)=>{if(i)return n(i);e.put(r,o,e=>{if(e)return n(e);n(null,new a(o,t))})})}return n(i)}n(null,new a(o,t))})},put(t,n){if(!a.isBlock(t))return l(()=>{n(new Error("invalid block"))});const r=d(t.cid);e.has(r,(i,o)=>i?n(i):o?n():void e.put(r,t.data,n))},putMany(t,n){const r=t.map(e=>({key:d(e.cid),block:e})),i=e.batch();u(r,(t,n)=>e.has(t.key,n),(e,t)=>{if(e)return n(e);t.forEach(e=>{i.put(e.key,e.block.data)}),i.commit(n)})},has(t,n){if(!c.isCID(t))return l(()=>{n(new Error("Not a valid cid"))});e.has(d(t),(r,i)=>{if(r)return n(r);if(i)return n(null,!0);const o=y(t);if(!o)return n(null,!1);e.has(d(o),n)})},delete(t,n){if(!c.isCID(t))return l(()=>{n(new Error("Not a valid cid"))});e.delete(d(t),n)},close(t){e.close(t)}}}function y(e){try{return 0===e.version?e.toV1():e.toV0()}catch(e){return null}}e.exports=((e,t,n)=>{m(e,t,(e,t)=>{if(e)return n(e);n(null,g(t))})})},function(e,t,n){"use strict";(function(t){const r=n(10),i=n(36),o=n(28).Key,s=n(406),a=n(201),l=new o(s.SHARDING_FN),u=new o(s.README_FN);class c{constructor(e,t){this.child=new a(e,{convert:this._convertKey.bind(this),invert:this._invertKey.bind(this)}),this.shard=t}open(e){this.child.open(e)}_convertKey(e){const t=e.toString();if(t===l.toString()||t===u.toString())return e;const n=new o(this.shard.fun(t));return n.child(e)}_invertKey(e){const t=e.toString();return t===l.toString()||t===u.toString()?e:o.withNamespaces(e.list().slice(1))}static createOrOpen(e,t,n){c.create(e,t,t=>{if(t&&"datastore exists"!==t.message)return n(t);c.open(e,n)})}static open(e,t){r([t=>s.readShardFun("/",e,t),(t,n)=>{n(null,new c(e,t))}],t)}static create(e,n,r){e.has(l,(o,a)=>{if(o)return r(o);if(!a){const o="function"==typeof e.putRaw?e.putRaw.bind(e):e.put.bind(e);return i([e=>o(l,t.from(n.toString()+"\n"),e),e=>o(u,t.from(s.readme),e)],e=>r(e))}s.readShardFun("/",e,(e,t)=>{if(e)return r(e);const i=(t||"").toString(),o=n.toString();if(i!==o)return r(new Error(`specified fun ${o} does not match repo shard fun ${i}`));r(new Error("datastore exists"))})})}put(e,t,n){this.child.put(e,t,n)}get(e,t){this.child.get(e,t)}has(e,t){this.child.has(e,t)}delete(e,t){this.child.delete(e,t)}batch(){return this.child.batch()}query(e){const t={keysOnly:e.keysOnly,offset:e.offset,limit:e.limit,filters:[(e,t)=>t(null,e.key.toString()!==l.toString()),(e,t)=>t(null,e.key.toString()!==u.toString())]};if(null!=e.prefix&&t.filters.push((t,n)=>{n(null,this._invertKey(t.key).toString().startsWith(e.prefix))}),null!=e.filters){const n=e.filters.map(e=>(t,n)=>{e(Object.assign({},t,{key:this._invertKey(t.key)}),n)});t.filters=t.filters.concat(n)}return null!=e.orders&&(t.orders=e.orders.map(e=>(t,n)=>{t.forEach(e=>{e.key=this._invertKey(e.key)}),e(t,(e,t)=>{if(e)return n(e);t.forEach(e=>{e.key=this._convertKey(e.key)}),n(null,t)})})),this.child.query(t)}close(e){this.child.close(e)}}e.exports=c}).call(this,n(0).Buffer)},function(e,t,n){"use strict";e.exports="This is a repository of IPLD objects. Each IPLD object is in a single file,\nnamed .data. Where is the\n\"base32\" encoding of the CID (as specified in\nhttps://github.com/multiformats/multibase) without the 'B' prefix.\nAll the object files are placed in a tree of directories, based on a\nfunction of the CID. This is a form of sharding similar to\nthe objects directory in git repositories. Previously, we used\nprefixes, we now use the next-to-last two charters.\n func NextToLast(base32cid string) {\n nextToLastLen := 2\n offset := len(base32cid) - nextToLastLen - 1\n return str[offset : offset+nextToLastLen]\n }\nFor example, an object with a base58 CIDv1 of\n zb2rhYSxw4ZjuzgCnWSt19Q94ERaeFhu9uSqRgjSdx9bsgM6f\nhas a base32 CIDv1 of\n BAFKREIA22FLID5AJ2KU7URG47MDLROZIH6YF2KALU2PWEFPVI37YLKRSCA\nand will be placed at\n SC/AFKREIA22FLID5AJ2KU7URG47MDLROZIH6YF2KALU2PWEFPVI37YLKRSCA.data\nwith 'SC' being the last-to-next two characters and the 'B' at the\nbeginning of the CIDv1 string is the multibase prefix that is not\nstored in the filename.\n"},function(e,t,n){"use strict";const r=n(38),i=n(830),o=n(18),s=n(28).Key,a=n(28).Errors,l=n(28).utils,u=l.asyncFilter,c=l.asyncSort,h=l.replaceStartWith,f=n(201);class p{constructor(e){this.mounts=e.slice()}open(e){r(this.mounts,(e,t)=>{e.datastore.open(t)},e)}_lookup(e){for(let t of this.mounts)if(t.prefix.toString()===e.toString()||t.prefix.isAncestorOf(e)){const n=h(e.toString(),t.prefix.toString());return{datastore:t.datastore,mountpoint:t.prefix,rest:new s(n)}}}put(e,t,n){const r=this._lookup(e);if(null==r)return n(a.dbWriteFailedError(new Error("No datastore mounted for this key")));r.datastore.put(r.rest,t,n)}get(e,t){const n=this._lookup(e);if(null==n)return t(a.notFoundError(new Error("No datastore mounted for this key")));n.datastore.get(n.rest,t)}has(e,t){const n=this._lookup(e);null!=n?n.datastore.has(n.rest,t):t(null,!1)}delete(e,t){const n=this._lookup(e);if(null==n)return t(a.dbDeleteFailedError(new Error("No datastore mounted for this key")));n.datastore.delete(n.rest,t)}close(e){r(this.mounts,(e,t)=>{e.datastore.close(t)},e)}batch(){const e={},t=t=>{const n=this._lookup(t);if(null==n)throw new Error("No datastore mounted for this key");const r=n.mountpoint.toString();return null==e[r]&&(e[r]=n.datastore.batch()),{batch:e[r],rest:n.rest}};return{put:(e,n)=>{const r=t(e);r.batch.put(r.rest,n)},delete:e=>{const n=t(e);n.batch.delete(n.rest)},commit:t=>{r(Object.keys(e),(t,n)=>{e[t].commit(n)},t)}}}query(e){const t=this.mounts.map(t=>{const n=new f(t.datastore,{convert:e=>{throw new Error("should never be called")},invert:e=>t.prefix.child(e)});let r;return null!=e.prefix&&(r=h(e.prefix,t.prefix.toString())),n.query({prefix:r,filters:e.filters,keysOnly:e.keysOnly})});let n=[i(t)];if(null!=e.filters&&(n=n.concat(e.filters.map(e=>u(e)))),null!=e.orders&&(n=n.concat(e.orders.map(e=>c(e)))),null!=e.offset){let t=0;n.push(o.filter(()=>t++>=e.offset))}return null!=e.limit&&n.push(o.take(e.limit)),o.apply(null,n)}}e.exports=p},function(e,t){e.exports=function(e){var t=!!e,n=(e||[]).map(s),r=0,i,o;function s(e){return{ready:!1,reading:!1,ended:!1,read:e,data:null}}function a(){if(o){l();var e=n.length,s=o;if(0===e&&(i||t))return o=null,void s(i||!0);for(var a=0;an.length)throw new Error("this should never happen");if(!(t.reading||t.ended||t.ready)){t.reading=!0;var r=!0;t.read(i,function e(n,o){t.data=o,t.ready=!0,t.reading=!1,!0===n||i?t.ended=!0:n&&(i=t.ended=n),i&&!n&&t.read(i,e),r||a()}),r=!1}}(n[e]);a()}function c(e,t){i=i||e,o=t,u()}return c.add=function(e){if(!e)return t=!0,u();n.push(s(e)),u()},c.cap=function(e){c.add(null)},c}},function(e,t,n){"use strict";const r=n(38),i=n(152),o=n(28).Errors;class s{constructor(e){this.stores=e.slice()}open(e){r(this.stores,(e,t)=>{e.open(t)},t=>{if(t)return e(o.dbOpenFailedError());e()})}put(e,t,n){r(this.stores,(n,r)=>{n.put(e,t,r)},e=>{if(e)return n(o.dbWriteFailedError());n()})}get(e,t){const n=this.stores.length;let r=!1,s=0;i(()=>!r&&s{const n=this.stores[s++];n.get(e,(e,n)=>{if(null==e)return r=!0,t(null,n);t()})},(e,n)=>{if(e||!n)return t(o.notFoundError());t(null,n)})}has(e,t){const n=this.stores.length;let r=!1,o=0;i(()=>!r&&o{const n=this.stores[o++];n.has(e,(e,n)=>{if(null==e)return r=!0,t(null,n);t()})},t)}delete(e,t){r(this.stores,(t,n)=>{t.delete(e,n)},e=>{if(e)return t(o.dbDeleteFailedError());t()})}close(e){r(this.stores,(e,t)=>{e.close(t)},e)}batch(){const e=this.stores.map(e=>e.batch());return{put:(t,n)=>{e.forEach(e=>e.put(t,n))},delete:t=>{e.forEach(e=>e.delete(t))},commit:t=>{r(e,(e,t)=>{e.commit(t)},t)}}}query(e){return this.stores[this.stores.length-1].query(e)}}e.exports=s},function(e,t,n){"use strict";const r=n(28).Key,i=n(201);class o extends i{constructor(e,t){super(e,{convert:e=>t.child(e),invert(e){if("/"===t.toString())return e;if(!t.isAncestorOf(e))throw new Error(`Expected prefix: (${t.toString()}) in key: ${e.toString()}`);return new r(e.toString().slice(t.toString().length),!1)}}),this.prefix=t}query(e){return e.prefix&&"/"!==this.prefix.toString()?super.query(Object.assign({},e,{prefix:this.prefix.child(new r(e.prefix)).toString()})):super.query(e)}}e.exports=o},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=s;var r=n(409),i=o(r);function o(e){return e&&e.__esModule?e:{default:e}}function s(e,t,n,r){(0,i.default)(e,t,function(e,t){n(e,function(e,n){t(e,!n)})},r)}e.exports=t.default},function(e,t,n){"use strict";(function(t){const r=n(27),i=n(60),o=n(115),s=n(95),a=n(835),l=n(39);class u{constructor(e,n,s,a){if(c.isCID(e)){const n=e;return this.version=n.version,this.codec=n.codec,this.multihash=t.from(n.multihash),void(this.multibaseName=n.multibaseName||(0===n.version?"base58btc":"base32"))}if("string"==typeof e){const t=i.isEncoded(e);if(t){const n=i.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=r.fromB58String(e),this.multibaseName="base58btc";return u.validateCID(this),void Object.defineProperty(this,"string",{value:e})}if(t.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";u.validateCID(this)}else this.version=e,this.codec=n,this.multihash=s,this.multibaseName=a||(0===e?"base58btc":"base32"),u.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=t.concat([t.from("01","hex"),o.getCodeVarint(this.codec),this.multihash])}Object.defineProperty(this,"_buffer",{value:e})}return e}get prefix(){return t.concat([t.from(`0${this.version}`,"hex"),o.getCodeVarint(this.codec),r.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}=r.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 c(0,this.codec,this.multihash)}toV1(){return new c(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=r.toB58String(this.multihash)}else{if(1!==this.version)throw new Error("unsupported version");t=i.encode(e,this.buffer).toString()}return e===this.multibaseName&&Object.defineProperty(this,"string",{value:t}),t}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){let t=a.checkCIDComponents(e);if(t)throw new Error(t)}}const c=l(u,{className:"CID",symbolName:"@ipld/js-cid/CID"});c.codecs=s,e.exports=c}).call(this,n(0).Buffer)},function(e,t,n){"use strict";(function(t){const r=n(27);var i={checkCIDComponents:function(e){if(null==e)return"null values are not valid CIDs";if(0!==e.version&&1!==e.version)return"Invalid version, must be a number equal to 1 or 0";if("string"!=typeof e.codec)return"codec must be string";if(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(!t.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=i}).call(this,n(0).Buffer)},function(e,t,n){"use strict";e.exports={lock:"memory",storageBackends:{root:n(202),blocks:n(202),keys:n(202),datastore:n(202)},storageBackendOptions:{root:{extension:""},blocks:{sharding:!1},keys:{sharding:!1}}}},function(e,t,n){(function(t){var r=n(6).EventEmitter,i=n(14).inherits,o=n(68),s=n(838),a=n(841),l=n(842),u=n(261),c=n(23),h=n(415),f=n(203).getCallback,p=n(203).getOptions,d=u.WriteError,m=u.ReadError,g=u.NotFoundError,y=u.OpenError,v=u.InitializationError;function b(e,n,i){if(!(this instanceof b))return new b(e,n,i);var o;if(r.call(this),this.setMaxListeners(1/0),"function"==typeof n&&(i=n,n={}),n=n||{},!e||"object"!=typeof e){if(o=new v("First argument must be an abstract-leveldown compliant store"),"function"==typeof i)return t.nextTick(i,o);throw o}c.strictEqual(typeof e.status,"string",".status required, old abstract-leveldown"),this.options=p(n),this._db=e,this.db=new s(e),this.open(i)}function _(e,n){if(!e._isOpening()&&!e.isOpen())return t.nextTick(n,new m("Database is not open")),!0}b.prototype.emit=r.prototype.emit,b.prototype.once=r.prototype.once,i(b,r),b.prototype.open=function(e){var n=this,r;return e||(e=h(),r=e.promise),this.isOpen()?(t.nextTick(e,null,n),r):this._isOpening()?(this.once("open",function(){e(null,n)}),r):(this.emit("opening"),this.db.open(this.options,function(t){if(t)return e(new y(t));n.db=n._db,e(null,n),n.emit("open"),n.emit("ready")}),r)},b.prototype.close=function(e){var n=this,r;return e||(e=h(),r=e.promise),this.isOpen()?(this.db.close(function(){n.emit("closed"),e.apply(null,arguments)}),this.emit("closing"),this.db=new s(this._db)):this.isClosed()?t.nextTick(e):"closing"===this.db.status?this.once("closed",e):this._isOpening()&&this.once("open",function(){n.close(e)}),r},b.prototype.isOpen=function(){return"open"===this.db.status},b.prototype._isOpening=function(){return"opening"===this.db.status},b.prototype.isClosed=function(){return/^clos|new/.test(this.db.status)},b.prototype.get=function(e,t,n){if(null===e||void 0===e)throw new m("get() requires a key argument");var r;return n=f(t,n),n||(n=h(),r=n.promise),_(this,n)?r:(t=p(t),this.db.get(e,t,function(t,r){if(t)return t=/notfound/i.test(t)||t.notFound?new g("Key not found in database ["+e+"]",t):new m(t),n(t);n(null,r)}),r)},b.prototype.put=function(e,t,n,r){if(null===e||void 0===e)throw new d("put() requires a key argument");var i=this,o;return r=f(n,r),r||(r=h(),o=r.promise),_(this,r)?o:(n=p(n),this.db.put(e,t,n,function(n){if(n)return r(new d(n));i.emit("put",e,t),r()}),o)},b.prototype.del=function(e,t,n){if(null===e||void 0===e)throw new d("del() requires a key argument");var r=this,i;return n=f(t,n),n||(n=h(),i=n.promise),_(this,n)?i:(t=p(t),this.db.del(e,t,function(t){if(t)return n(new d(t));r.emit("del",e),n()}),i)},b.prototype.batch=function(e,t,n){if(!arguments.length)return new l(this);if(!Array.isArray(e))throw new d("batch() requires an array argument");var r=this,i;return n=f(t,n),n||(n=h(),i=n.promise),_(this,n)?i:(t=p(t),this.db.batch(e,t,function(t){if(t)return n(new d(t));r.emit("batch",e),n()}),i)},b.prototype.iterator=function(e){return this.db.iterator(e)},b.prototype.readStream=b.prototype.createReadStream=function(e){return e=o({keys:!0,values:!0},e),"number"!=typeof e.limit&&(e.limit=-1),new a(this.db.iterator(e),e)},b.prototype.keyStream=b.prototype.createKeyStream=function(e){return this.createReadStream(o(e,{keys:!0,values:!1}))},b.prototype.valueStream=b.prototype.createValueStream=function(e){return this.createReadStream(o(e,{keys:!1,values:!0}))},b.prototype.toString=function(){return"LevelUP"},b.errors=u,e.exports=b.default=b}).call(this,n(2))},function(e,t,n){var r=n(412).AbstractLevelDOWN,i=n(3),o=n(840),s="put get del batch".split(" ");function a(e){r.call(this,""),this._db=e,this._operations=[],this._iterators=[],u(this)}function l(e){s.concat("iterator").forEach(function(t){e["_"+t]=function(){return this._db[t].apply(this._db,arguments)}}),e._db.approximateSize&&(e.approximateSize=function(){return this._db.approximateSize.apply(this._db,arguments)})}function u(e){s.forEach(function(t){e["_"+t]=function(){this._operations.push({method:t,args:arguments})}}),"function"==typeof e._db.approximateSize&&(e.approximateSize=function(){this._operations.push({method:"approximateSize",args:arguments})}),e._iterator=function(e){var t=new o(e);return this._iterators.push(t),t}}i(a,r),a.prototype._open=function(e,t){var n=this;this._db.open(e,function(e){if(e)return t(e);n._operations.forEach(function(e){n._db[e.method].apply(n._db,e.args)}),n._operations=[],n._iterators.forEach(function(e){e.setDb(n._db)}),n._iterators=[],l(n),t()})},a.prototype._close=function(e){var t=this;this._db.close(function(n){if(n)return e(n);u(t),e()})},a.prototype._serializeKey=function(e){return e},a.prototype._serializeValue=function(e){return e},e.exports=a,e.exports.DeferredIterator=o},function(e,t,n){(function(t,r){var i=n(68),o=n(413),s=n(414),a=Object.prototype.hasOwnProperty,l="start end gt gte lt lte".split(" ");function u(){this.status="new"}function c(e,t){var n={};for(var r in t)if(a.call(t,r)){var i=t[r];h(r)&&(i=e._serializeKey(i)),n[r]=i}return n}function h(e){return-1!==l.indexOf(e)}u.prototype.open=function(e,t){var n=this,r=this.status;if("function"==typeof e&&(t=e),"function"!=typeof t)throw new Error("open() requires a callback argument");"object"==typeof e&&null!==e||(e={}),e.createIfMissing=!1!==e.createIfMissing,e.errorIfExists=!!e.errorIfExists,this.status="opening",this._open(e,function(e){if(e)return n.status=r,t(e);n.status="open",t()})},u.prototype._open=function(e,n){t.nextTick(n)},u.prototype.close=function(e){var t=this,n=this.status;if("function"!=typeof e)throw new Error("close() requires a callback argument");this.status="closing",this._close(function(r){if(r)return t.status=n,e(r);t.status="closed",e()})},u.prototype._close=function(e){t.nextTick(e)},u.prototype.get=function(e,n,r){if("function"==typeof n&&(r=n),"function"!=typeof r)throw new Error("get() requires a callback argument");var i=this._checkKey(e);if(i)return t.nextTick(r,i);e=this._serializeKey(e),"object"==typeof n&&null!==n||(n={}),n.asBuffer=!1!==n.asBuffer,this._get(e,n,r)},u.prototype._get=function(e,n,r){t.nextTick(function(){r(new Error("NotFound"))})},u.prototype.put=function(e,n,r,i){if("function"==typeof r&&(i=r),"function"!=typeof i)throw new Error("put() requires a callback argument");var o=this._checkKey(e)||this._checkValue(n);if(o)return t.nextTick(i,o);e=this._serializeKey(e),n=this._serializeValue(n),"object"==typeof r&&null!==r||(r={}),this._put(e,n,r,i)},u.prototype._put=function(e,n,r,i){t.nextTick(i)},u.prototype.del=function(e,n,r){if("function"==typeof n&&(r=n),"function"!=typeof r)throw new Error("del() requires a callback argument");var i=this._checkKey(e);if(i)return t.nextTick(r,i);e=this._serializeKey(e),"object"==typeof n&&null!==n||(n={}),this._del(e,n,r)},u.prototype._del=function(e,n,r){t.nextTick(r)},u.prototype.batch=function(e,n,r){if(!arguments.length)return this._chainedBatch();if("function"==typeof n&&(r=n),"function"==typeof e&&(r=e),"function"!=typeof r)throw new Error("batch(array) requires a callback argument");if(!Array.isArray(e))return t.nextTick(r,new Error("batch(array) requires an array argument"));if(0===e.length)return t.nextTick(r);"object"==typeof n&&null!==n||(n={});for(var o=new Array(e.length),s=0;s - * https://github.com/rvagg/prr - * License: MIT - */ -var r,i,o;r="prr",i=this,o=function(){var e="function"==typeof Object.defineProperty?function(e,t,n){return Object.defineProperty(e,t,n),e}:function(e,t,n){return e[t]=n.value,e},t=function(e,t){var n="object"==typeof t,r=!n&&"string"==typeof t,i=function(e){return n?!!t[e]:!!r&&t.indexOf(e[0])>-1};return{enumerable:i("enumerable"),configurable:i("configurable"),writable:i("writable"),value:e}},n=function(n,r,i,o){var s;if(o=t(i,o),"object"==typeof r){for(s in r)Object.hasOwnProperty.call(r,s)&&(o.value=r[s],e(n,s,o));return n}return e(n,r,o)};return n},e.exports?e.exports=o():i.prr=o()},function(e,t,n){"use strict";var r=n(262).AbstractLevelDOWN,i=n(262).AbstractChainedBatch,o=n(262).AbstractIterator,s=n(3),a=n(848),l=n(261).EncodingError;function u(e,t){if(!(this instanceof u))return new u(e,t);r.call(this,""),t=t||{},void 0===t.keyEncoding&&(t.keyEncoding="utf8"),void 0===t.valueEncoding&&(t.valueEncoding="utf8"),this.db=e,this.codec=new a(t)}function c(e,t){o.call(this,e),this.codec=e.codec,this.keys=t.keys,this.values=t.values,this.opts=this.codec.encodeLtgt(t),this.it=e.db.iterator(this.opts)}function h(e,t){i.call(this,e),this.codec=e.codec,this.batch=e.db.batch()}e.exports=u.default=u,s(u,r),u.prototype._serializeKey=u.prototype._serializeValue=function(e){return e},u.prototype._open=function(e,t){this.db.open(e,t)},u.prototype._close=function(e){this.db.close(e)},u.prototype._put=function(e,t,n,r){e=this.codec.encodeKey(e,n),t=this.codec.encodeValue(t,n),this.db.put(e,t,n,r)},u.prototype._get=function(e,t,n){var r=this;e=this.codec.encodeKey(e,t),t.asBuffer=this.codec.valueAsBuffer(t),this.db.get(e,t,function(e,i){if(e)return n(e);try{i=r.codec.decodeValue(i,t)}catch(e){return n(new l(e))}n(null,i)})},u.prototype._del=function(e,t,n){e=this.codec.encodeKey(e,t),this.db.del(e,t,n)},u.prototype._chainedBatch=function(){return new h(this)},u.prototype._batch=function(e,t,n){e=this.codec.encodeBatch(e,t),this.db.batch(e,t,n)},u.prototype._iterator=function(e){return e.keyAsBuffer=this.codec.keyAsBuffer(e),e.valueAsBuffer=this.codec.valueAsBuffer(e),new c(this,e)},u.prototype.approximateSize=function(e,t,n,r){return e=this.codec.encodeKey(e,n),t=this.codec.encodeKey(t,n),this.db.approximateSize(e,t,n,r)},s(c,o),c.prototype._next=function(e){var t=this;this.it.next(function(n,r,i){if(n)return e(n);try{r=t.keys&&void 0!==r?t.codec.decodeKey(r,t.opts):void 0,i=t.values&&void 0!==i?t.codec.decodeValue(i,t.opts):void 0}catch(n){return e(new l(n))}e(null,r,i)})},c.prototype._seek=function(e){e=this.codec.encodeKey(e,this.opts),this.it.seek(e)},c.prototype._end=function(e){this.it.end(e)},s(h,i),h.prototype._put=function(e,t){e=this.codec.encodeKey(e),t=this.codec.encodeValue(t),this.batch.put(e,t)},h.prototype._del=function(e){e=this.codec.encodeKey(e),this.batch.del(e)},h.prototype._clear=function(){this.batch.clear()},h.prototype._write=function(e,t){this.batch.write(e,t)}},function(e,t,n){(function(t,r){var i=n(68),o=n(416),s=n(417),a=Object.prototype.hasOwnProperty,l="start end gt gte lt lte".split(" ");function u(){this.status="new"}function c(e,t){var n={};for(var r in t)if(a.call(t,r)){var i=t[r];h(r)&&(i=e._serializeKey(i)),n[r]=i}return n}function h(e){return-1!==l.indexOf(e)}u.prototype.open=function(e,t){var n=this,r=this.status;if("function"==typeof e&&(t=e),"function"!=typeof t)throw new Error("open() requires a callback argument");"object"==typeof e&&null!==e||(e={}),e.createIfMissing=!1!==e.createIfMissing,e.errorIfExists=!!e.errorIfExists,this.status="opening",this._open(e,function(e){if(e)return n.status=r,t(e);n.status="open",t()})},u.prototype._open=function(e,n){t.nextTick(n)},u.prototype.close=function(e){var t=this,n=this.status;if("function"!=typeof e)throw new Error("close() requires a callback argument");this.status="closing",this._close(function(r){if(r)return t.status=n,e(r);t.status="closed",e()})},u.prototype._close=function(e){t.nextTick(e)},u.prototype.get=function(e,n,r){if("function"==typeof n&&(r=n),"function"!=typeof r)throw new Error("get() requires a callback argument");var i=this._checkKey(e);if(i)return t.nextTick(r,i);e=this._serializeKey(e),"object"==typeof n&&null!==n||(n={}),n.asBuffer=!1!==n.asBuffer,this._get(e,n,r)},u.prototype._get=function(e,n,r){t.nextTick(function(){r(new Error("NotFound"))})},u.prototype.put=function(e,n,r,i){if("function"==typeof r&&(i=r),"function"!=typeof i)throw new Error("put() requires a callback argument");var o=this._checkKey(e)||this._checkValue(n);if(o)return t.nextTick(i,o);e=this._serializeKey(e),n=this._serializeValue(n),"object"==typeof r&&null!==r||(r={}),this._put(e,n,r,i)},u.prototype._put=function(e,n,r,i){t.nextTick(i)},u.prototype.del=function(e,n,r){if("function"==typeof n&&(r=n),"function"!=typeof r)throw new Error("del() requires a callback argument");var i=this._checkKey(e);if(i)return t.nextTick(r,i);e=this._serializeKey(e),"object"==typeof n&&null!==n||(n={}),this._del(e,n,r)},u.prototype._del=function(e,n,r){t.nextTick(r)},u.prototype.batch=function(e,n,r){if(!arguments.length)return this._chainedBatch();if("function"==typeof n&&(r=n),"function"==typeof e&&(r=e),"function"!=typeof r)throw new Error("batch(array) requires a callback argument");if(!Array.isArray(e))return t.nextTick(r,new Error("batch(array) requires an array argument"));if(0===e.length)return t.nextTick(r);"object"==typeof n&&null!==n||(n={});for(var o=new Array(e.length),s=0;s-1?t.encodeKey(e[r],e):e[r]}),n},i.prototype.createStreamDecoder=function(e){var t=this;return e.keys&&e.values?function(n,r){return{key:t.decodeKey(n,e),value:t.decodeValue(r,e)}}:e.keys?function(n){return t.decodeKey(n,e)}:e.values?function(n,r){return t.decodeValue(r,e)}:function(){}},i.prototype.keyAsBuffer=function(e){return this._keyEncoding(e).buffer},i.prototype.valueAsBuffer=function(e){return this._valueEncoding(e).buffer}},function(e,t,n){(function(e){t.utf8=t["utf-8"]={encode:function(e){return i(e)?e:String(e)},decode:r,buffer:!1,type:"utf8"},t.json={encode:JSON.stringify,decode:JSON.parse,buffer:!1,type:"json"},t.binary={encode:function(t){return i(t)?t:e.from(t)},decode:r,buffer:!0,type:"binary"},t.none={encode:r,decode:r,buffer:!1,type:"id"},t.id=t.none;var n=["hex","ascii","base64","ucs2","ucs-2","utf16le","utf-16le"];function r(e){return e}function i(t){return void 0===t||null===t||e.isBuffer(t)}n.forEach(function(n){t[n]={encode:function(t){return i(t)?t:e.from(t,n)},decode:function(e){return e.toString(n)},buffer:!0,type:n}})}).call(this,n(0).Buffer)},function(e,t,n){(function(t,r){e.exports=l;var i=n(418).AbstractLevelDOWN,o=n(14),s=n(852),a=n(68);function l(e){if(!(this instanceof l))return new l(e);i.call(this,e)}o.inherits(l,i),l.prototype._open=function(e,t){var n=this;if(this._idbOpts=a({storeName:this.location,keyEncoding:"none",valueEncoding:"none"},e),this._idbOpts.idb)o(this._idbOpts.idb);else{var r=indexedDB.open(this.location);r.onerror=i,r.onsuccess=function(){o(r.result)}}function i(e){t(e.target.error)}function o(r){n._db=r;var i=n._db.objectStoreNames.contains(n._idbOpts.storeName);if(e.errorIfExists&&i)return n._db.close(),void t(new Error("store already exists"));if(!e.createIfMissing&&!i)return n._db.close(),void t(new Error("store does not exist"));if(e.createIfMissing&&!i){n._db.close();var o=indexedDB.open(n.location,n._db.version+1);return o.onerror=function(e){t(e.target.error)},o.onupgradeneeded=function(){var e=o.result;e.createObjectStore(n._idbOpts.storeName,n._idbOpts)},void(o.onsuccess=function(){n._db=o.result,t(null,n)})}t(null,n)}},l.prototype._get=function(e,n,r){n=a(this._idbOpts,n);var i=e;"binary"!==n.keyEncoding||Array.isArray(e)||(e=Array.prototype.slice.call(e));var o=this._db.transaction(this._idbOpts.storeName),s=o.objectStore(this._idbOpts.storeName).openCursor(IDBKeyRange.only(e));o.onabort=function(){r(o.error)},s.onsuccess=function(){var e=s.result;if(e){var o=e.value;if(o instanceof Uint8Array&&(o=new t(o)),"binary"!==n.valueEncoding||t.isBuffer(o)||(o=new t(o)),n.asBuffer&&!t.isBuffer(o))if(null==o)o=new t(0);else if("string"==typeof o)o=new t(o);else if("boolean"==typeof o)o=new t(String(o));else if("number"==typeof o)o=new t(String(o));else if(Array.isArray(o))o=new t(String(o));else{if(!(o instanceof Uint8Array))return void r(new TypeError("can't coerce `"+o.constructor.name+"` into a Buffer"));o=new t(o)}r(null,o,i)}else r(new Error("NotFound"))}},l.prototype._del=function(e,t,n){t=a(this._idbOpts,t),"binary"!==t.keyEncoding||Array.isArray(e)||(e=Array.prototype.slice.call(e));var r="readwrite";!0===t.sync&&(r="readwriteflush");var i=this._db.transaction(this._idbOpts.storeName,r),o=i.objectStore(this._idbOpts.storeName).delete(e);i.onabort=function(){n(i.error)},i.oncomplete=function(){n()}},l.prototype._put=function(e,t,n,r){n=a(this._idbOpts,n),"binary"!==n.keyEncoding||Array.isArray(e)||(e=Array.prototype.slice.call(e));var i="readwrite";!0===n.sync&&(i="readwriteflush");var o=this._db.transaction(this._idbOpts.storeName,i),s=o.objectStore(this._idbOpts.storeName).put(t,e);o.onabort=function(){r(o.error)},o.oncomplete=function(){r()}},l.prototype._iterator=function(e){return new s(this,e)},l.prototype._batch=function(e,t,n){if(0===e.length)return r.nextTick(n);var i="readwrite";!0===t.sync&&(i="readwriteflush");var o=this._db.transaction(this._idbOpts.storeName,i),s=o.objectStore(this._idbOpts.storeName);o.onabort=function(){n(o.error)},o.oncomplete=function(){n()},e.forEach(function(e){var n=a(t,e);"binary"!==n.keyEncoding||Array.isArray(e.key)||(e.key=Array.prototype.slice.call(e.key)),"del"===e.type?s.delete(e.key):s.put(e.value,e.key)})},l.prototype._close=function(e){this._db.close(),r.nextTick(e)},l.prototype._approximateSize=function(e,t,n){var i=new Error("Not implemented");if(!n)throw i;r.nextTick(function(){n(i)})},l.destroy=function(e,t){var n;if(null!=e&&"object"==typeof e)n=a({location:e.location,storeName:e.location},e._idbOpts);else{if("string"!=typeof e)throw new TypeError("location must be a string or an object");n={location:e,storeName:e}}if("string"!=typeof n.location)throw new TypeError("location must be a string");if("string"!=typeof n.storeName)throw new TypeError("db.storeName must be a string");var r=indexedDB.open(n.location);r.onerror=function(e){t(e.target.error)},r.onsuccess=function(){var e=r.result;function i(e){var n=indexedDB.deleteDatabase(e);n.onerror=function(e){t(e.target.error)},n.onsuccess=function(){t()}}if(e.close(),0!==e.objectStoreNames.length)if(e.objectStoreNames.contains(n.storeName)){var o=indexedDB.open(n.location,e.version+1);o.onerror=function(e){t(e.target.error)},o.onupgradeneeded=function(){e=o.result,e.deleteObjectStore(n.storeName)},o.onsuccess=function(){e=o.result,e.close(),0===e.objectStoreNames.length?i(n.location):t()}}else t();else i(n.location)}}}).call(this,n(0).Buffer,n(2))},function(e,t,n){var r=n(419);function i(e){return!(!e||"object"!=typeof e)&&Object.keys(r.prototype).filter(function(e){return"_"!=e[0]&&"approximateSize"!=e}).every(function(t){return"function"==typeof e[t]})}e.exports=i},function(e,t,n){(function(t,r){var i=n(14),o=n(418).AbstractIterator,s=n(853),a=n(854),l=n(62),u=n(68),c=l.Writable;function h(e,t){if(this._db=e._db,this._idbOpts=e._idbOpts,o.call(this,e),this._options=u({snapshot:!0},this._idbOpts,t),this._limit=this._options.limit,null!=this._limit&&-1!==this._limit||(this._limit=1/0),"number"!=typeof this._limit)throw new TypeError("options.limit must be a number");0!==this._limit&&(this._count=0,this._startCursor(this._options))}e.exports=h,i.inherits(h,o),h.prototype._startCursor=function(e){e=u(this._options,e);var t=this,n=null,r=s.lowerBound(e),i=s.upperBound(e),o=s.lowerBoundExclusive(e),l=s.upperBoundExclusive(e),h=e.reverse?"prev":"next";if(r&&("binary"!==e.keyEncoding||Array.isArray(r)||(r=Array.prototype.slice.call(r))),i&&("binary"!==e.keyEncoding||Array.isArray(i)||(i=Array.prototype.slice.call(i))),r&&i)try{n=IDBKeyRange.bound(r,i,o,l)}catch(e){return void(this._keyRangeError=!0)}else r?n=IDBKeyRange.lowerBound(r,o):i&&(n=IDBKeyRange.upperBound(i,l));this._reader=a(this._db,this._idbOpts.storeName,u(e,{range:n,direction:h})),this._reader.on("error",function(e){var n=t._callback;t._callback=!1,n?n(e):t._readNext=function(t){t(e)}}),this._reader.pipe(new c({objectMode:!0,write:function(e,n,r){if(t._count++>=t._limit)return t._reader.pause(),t._reader.unpipe(this),r(),void this.end();var i=t._callback;t._callback=!1,i?t._processItem(e,function(e,t,n){r(e),i(e,t,n)}):t._readNext=function(n){t._processItem(e,function(e,t,i){r(e),n(e,t,i)})}}})).on("finish",function(){var e=t._callback;t._callback=!1,e?e():t._readNext=function(e){e()}})},h.prototype._processItem=function(e,n){if("function"!=typeof n)throw new TypeError("cb must be a function");var r=e.key,i=e.value;if(i instanceof Uint8Array&&(i=new t(i)),"binary"===this._options.keyEncoding&&Array.isArray(r)&&(r=new t(r)),"binary"!==this._options.valueEncoding||t.isBuffer(i)||(i=new t(i)),this._options.keyAsBuffer&&!t.isBuffer(r))if(null==r)r=new t(0);else if("string"==typeof r)r=new t(r);else if("boolean"==typeof r)r=new t(String(r));else if("number"==typeof r)r=new t(String(r));else if(Array.isArray(r))r=new t(String(r));else{if(!(r instanceof Uint8Array))throw new TypeError("can't coerce `"+r.constructor.name+"` into a Buffer");r=new t(r)}if(this._options.valueAsBuffer&&!t.isBuffer(i))if(null==i)i=new t(0);else if("string"==typeof i)i=new t(i);else if("boolean"==typeof i)i=new t(String(i));else if("number"==typeof i)i=new t(String(i));else if(Array.isArray(i))i=new t(String(i));else{if(!(i instanceof Uint8Array))throw new TypeError("can't coerce `"+i.constructor.name+"` into a Buffer");i=new t(i)}n(null,r,i)},h.prototype._next=function(e){if(this._callback)throw new Error("callback already exists");if(this._keyRangeError||0===this._limit)e();else{var t=this._readNext;this._readNext=!1,t?r.nextTick(function(){t(e)}):this._callback=e}}}).call(this,n(0).Buffer,n(2))},function(e,t,n){(function(e){function n(e){return void 0!==e&&""!==e}function r(e,t){return Object.hasOwnProperty.call(e,t)}function i(e,t){return Object.hasOwnProperty.call(e,t)&&t}t.compare=function(t,n){if(e.isBuffer(t)){for(var r=Math.min(t.length,n.length),i=0;in?1:0};var o=t.lowerBoundKey=function(e){return i(e,"gt")||i(e,"gte")||i(e,"min")||(e.reverse?i(e,"end"):i(e,"start"))||void 0},s=t.lowerBound=function(e,t){var n=o(e);return n?e[n]:t},a=t.lowerBoundInclusive=function(e){return!r(e,"gt")},l=t.upperBoundInclusive=function(e){return!r(e,"lt")},u=t.lowerBoundExclusive=function(e){return!a(e)},c=t.upperBoundExclusive=function(e){return!l(e)},h=t.upperBoundKey=function(e){return i(e,"lt")||i(e,"lte")||i(e,"max")||(e.reverse?i(e,"start"):i(e,"end"))||void 0},f=t.upperBound=function(e,t){var n=h(e);return n?e[n]:t};function p(e){return e}t.start=function(e,t){return e.reverse?f(e,t):s(e,t)},t.end=function(e,t){return e.reverse?s(e,t):f(e,t)},t.startInclusive=function(e){return e.reverse?l(e):a(e)},t.endInclusive=function(e){return e.reverse?a(e):l(e)},t.toLtgt=function(e,n,i,o,s){n=n||{},i=i||p;var a=arguments.length>3,l=t.lowerBoundKey(e),u=t.upperBoundKey(e);return l?"gt"===l?n.gt=i(e.gt,!1):n.gte=i(e[l],!1):a&&(n.gte=i(o,!1)),u?"lt"===u?n.lt=i(e.lt,!0):n.lte=i(e[u],!0):a&&(n.lte=i(s,!0)),null!=e.reverse&&(n.reverse=!!e.reverse),r(n,"max")&&delete n.max,r(n,"min")&&delete n.min,r(n,"start")&&delete n.start,r(n,"end")&&delete n.end,n},t.contains=function(e,r,i){i=i||t.compare;var o=s(e);if(n(o)){var a=i(r,o);if(a<0||0===a&&u(e))return!1}var l=f(e);if(n(l)){var a=i(r,l);if(a>0||0===a&&c(e))return!1}return!0},t.filter=function(e,n){return function(r){return t.contains(e,r,n)}}}).call(this,n(0).Buffer)},function(e,t,n){"use strict";var r=n(62),i=n(68);function o(e,t,n){if("object"!=typeof e)throw new TypeError("db must be an object");if("string"!=typeof t)throw new TypeError("storeName must be a string");if(null==n&&(n={}),"object"!=typeof n)throw new TypeError("opts must be an object");var o=new r.Transform(i(n,{objectMode:!0,transform:function(e,t,n){n(null,e)}}));n=i({snapshot:!1},n);var s=null;function a(){var r,i,l,u,c=n.direction||"next",h=n.range||{},f;r=h.lower,i=h.upper,l=!!h.lowerOpen,u=!!h.upperOpen,s&&("next"===c?(l=!0,r=s):(u=!0,i=s)),r&&i?f=IDBKeyRange.bound(r,i,l,u):r?f=IDBKeyRange.lowerBound(r,l):i&&(f=IDBKeyRange.upperBound(i,u));var p=e.transaction(t,"readonly"),d=p.objectStore(t);o._cursorsOpened++;var m=d.openCursor(f,n.direction);function g(e){try{e.continue()}catch(e){"TransactionInactiveError"!==e.name||n.snapshot?o.emit("error",e):a()}}m.onsuccess=function(){var e=m.result;if(e){s=e.key;var t=o.write({key:e.key,value:e.value});n.snapshot||t?g(e):o.once("drain",function(){g(e)})}else o.end()},p.onabort=function(){o.emit("error",p.error)},p.onerror=function(){o.emit("error",p.error)}}return o._cursorsOpened=0,a(),o}e.exports=o},function(e,t,n){"use strict";e.exports={Spec:{type:"mount",mounts:[{mountpoint:"/blocks",type:"measure",prefix:"flatfs.datastore",child:{type:"flatfs",path:"blocks",sync:!0,shardFunc:"/repo/flatfs/shard/v1/next-to-last/2"}},{mountpoint:"/",type:"measure",prefix:"leveldb.datastore",child:{type:"levelds",path:"datastore",compression:"none"}}]}}},function(e,t,n){"use strict";t.ERR_REPO_NOT_INITIALIZED="ERR_REPO_NOT_INITIALIZED"},function(e,t,n){"use strict";e.exports={repoVersion:7}},function(e,t,n){"use strict";t.preStart=n(859),t.start=n(874),t.stop=n(1103),t.isOnline=n(1104),t.version=n(1105),t.id=n(1106),t.repo=n(482),t.init=n(1107),t.bootstrap=n(1110),t.config=n(1111),t.block=n(1112),t.object=n(1113),t.dag=n(1114),t.libp2p=n(437),t.swarm=n(1116),t.ping=n(1117),t.pingPullStream=n(1118),t.pingReadableStream=n(1119),t.pin=n(1120),t.filesRegular=n(1128),t.filesMFS=n(1182),t.bitswap=n(505),t.pubsub=n(1230),t.dht=n(1231),t.dns=n(1234),t.key=n(1236),t.stats=n(1237),t.resolve=n(1238),t.name=n(1240)},function(e,t,n){"use strict";const r=n(15),i=n(31),o=n(21),s=n(10),a=n(423),l=n(89),u=n(873);e.exports=function e(t){return e=>{t.log("pre-start");const n=t._options.pass;s([e=>t._repo.config.get(e),(e,n)=>{if(!t._options.config)return n(null,e);e=l(e,t._options.config),t.config.replace(e,t=>{if(t)return n(t);n(null,e)})},(e,n)=>{if(e.Keychain)return n(null,e);e.Keychain=a.generateOptions(),t.config.set("Keychain",e.Keychain,r=>{t.log("using default keychain options"),n(r,e)})},(e,r)=>{if(t._keychain);else if(n){const r=Object.assign({passPhrase:n},e.Keychain);t._keychain=new a(t._repo.keys,r),t.log("keychain constructed")}else t._keychain=new u,t.log("no keychain, use --pass");r(null,e)},(e,t)=>{const n=e.Identity.PrivKey;r.createFromPrivKey(n,(n,r)=>{t(n,e,r)})},(e,r,i)=>{if(!n)return i(null,e,r);t._keychain.findKeyByName("self",n=>{if(n)return t.log('Creating "self" key'),t._keychain.importPeer("self",r,t=>i(t,e,r));i(null,e,r)})},(e,n,r)=>{t.log("peer created"),t._peerInfo=new i(n),e.Addresses&&e.Addresses.Swarm&&e.Addresses.Swarm.forEach(e=>{let n=o(e);n.getPeerId()&&(n=n.encapsulate("/ipfs/"+t._peerInfo.id.toB58String())),t._peerInfo.multiaddrs.add(n)}),r()},e=>t.pin._load(e)],e)}}},function(e,t,n){"use strict";const r=n(861),i=n(89),o=n(49),s=n(28),a=n(33),l=n(12),u=n(865),c=n(13),h="/pkcs8/",f="/info/",p={minKeyLength:14,minSaltLength:16,minIterationCount:1e3},d={dek:{keyLength:64,iterationCount:1e4,salt:"you should override this value with a crypto secure random number",hash:"sha2-512"}};function m(e){return!!e&&("string"==typeof e&&e===r(e.trim()))}function g(e,t){const n=200,r=1e3,i=800*Math.random()+200;setTimeout(e,i,t,null)}function y(e){return new s.Key(h+e)}function v(e){return new s.Key(f+e)}class b{constructor(e,t){if(!e)throw new Error("store is required");this.store=e;const n=i(d,t);if(!n.passPhrase||n.passPhrase.length<20)throw new Error("passPhrase must be least 20 characters");if(n.dek.keyLengthr})}get cms(){return new u(this)}static generateOptions(){const e=Object.assign({},d),t=3*Math.ceil(p.minSaltLength/3);return e.dek.salt=o.randomBytes(t).toString("base64"),e}static get options(){return d}createKey(e,t,n,r){const i=this;if(!m(e)||"self"===e)return g(r,c(new Error(`Invalid key name '${e}'`),"ERR_INVALID_KEY_NAME"));if("string"!=typeof t)return g(r,c(new Error(`Invalid key type '${t}'`),"ERR_INVALID_KEY_TYPE"));if(!Number.isSafeInteger(n))return g(r,c(new Error(`Invalid key size '${n}'`),"ERR_INVALID_KEY_SIZE"));const s=y(e);i.store.has(s,(a,l)=>{if(a)return g(r,a);if(l)return g(r,c(new Error(`Key '${e}' already exists`),"ERR_KEY_ALREADY_EXISTS"));switch(t.toLowerCase()){case"rsa":if(n<2048)return g(r,c(new Error(`Invalid RSA key size ${n}`),"ERR_INVALID_KEY_SIZE"))}o.keys.generateKeyPair(t,n,(t,n)=>{if(t)return g(r,t);n.id((t,o)=>{if(t)return g(r,t);n.export(this._(),(t,n)=>{if(t)return g(r,t);const a={name:e,id:o},l=i.store.batch();l.put(s,n),l.put(v(e),JSON.stringify(a)),l.commit(e=>{if(e)return g(r,e);r(null,a)})})})})})}listKeys(e){const t=this,n={prefix:f};l(this.store.query(n),a((t,n)=>{if(t)return g(e,t);const r=n.map(e=>JSON.parse(e.value));e(null,r)}))}findKeyById(e,t){this.listKeys((n,r)=>{if(n)return g(t,n);const i=r.find(t=>t.id===e);t(null,i)})}findKeyByName(e,t){if(!m(e))return g(t,c(new Error(`Invalid key name '${e}'`),"ERR_INVALID_KEY_NAME"));const n=v(e);this.store.get(n,(n,r)=>{if(n)return g(t,c(new Error(`Key '${e}' does not exist. ${n.message}`),"ERR_KEY_NOT_FOUND"));t(null,JSON.parse(r.toString()))})}removeKey(e,t){const n=this;if(!m(e)||"self"===e)return g(t,c(new Error(`Invalid key name '${e}'`),"ERR_INVALID_KEY_NAME"));const r=y(e);n.findKeyByName(e,(i,o)=>{if(i)return g(t,i);const s=n.store.batch();s.delete(r),s.delete(v(e)),s.commit(e=>{if(e)return g(t,e);t(null,o)})})}renameKey(e,t,n){const r=this;if(!m(e)||"self"===e)return g(n,c(new Error(`Invalid old key name '${e}'`),"ERR_OLD_KEY_NAME_INVALID"));if(!m(t)||"self"===t)return g(n,c(new Error(`Invalid new key name '${t}'`),"ERR_NEW_KEY_NAME_INVALID"));const i=y(e),o=y(t),s=v(e),a=v(t);this.store.get(i,(l,u)=>{if(l)return g(n,c(new Error(`Key '${e}' does not exist. ${l.message}`),"ERR_KEY_NOT_FOUND"));const h=u.toString();r.store.has(o,(e,l)=>e?g(n,e):l?g(n,c(new Error(`Key '${t}' already exists`),"ERR_KEY_ALREADY_EXISTS")):void r.store.get(s,(e,l)=>{if(e)return g(n,e);const u=JSON.parse(l.toString());u.name=t;const c=r.store.batch();c.put(o,h),c.put(a,JSON.stringify(u)),c.delete(i),c.delete(s),c.commit(e=>{if(e)return g(n,e);n(null,u)})}))})}exportKey(e,t,n){if(!m(e))return g(n,c(new Error(`Invalid key name '${e}'`),"ERR_INVALID_KEY_NAME"));if(!t)return g(n,c(new Error("Password is required"),"ERR_PASSWORD_REQUIRED"));const r=y(e);this.store.get(r,(r,i)=>{if(r)return g(n,c(new Error(`Key '${e}' does not exist. ${r.message}`),"ERR_KEY_NOT_FOUND"));const s=i.toString();o.keys.import(s,this._(),(e,r)=>{if(e)return g(n,e);r.export(t,n)})})}importKey(e,t,n,r){const i=this;if(!m(e)||"self"===e)return g(r,c(new Error(`Invalid key name '${e}'`),"ERR_INVALID_KEY_NAME"));if(!t)return g(r,"PEM encoded key is required");const s=y(e);i.store.has(s,(a,l)=>a?g(r,a):l?g(r,c(new Error(`Key '${e}' already exists`),"ERR_KEY_ALREADY_EXISTS")):void o.keys.import(t,n,(t,n)=>{if(t)return g(r,c(new Error("Cannot read the key, most likely the password is wrong"),"ERR_CANNOT_READ_KEY"));n.id((t,o)=>{if(t)return g(r,t);n.export(this._(),(t,n)=>{if(t)return g(r,t);const a={name:e,id:o},l=i.store.batch();l.put(s,n),l.put(v(e),JSON.stringify(a)),l.commit(e=>{if(e)return g(r,e);r(null,a)})})})}))}importPeer(e,t,n){const r=this;if(!m(e))return g(n,c(new Error(`Invalid key name '${e}'`),"ERR_INVALID_KEY_NAME"));if(!t||!t.privKey)return g(n,c(new Error("Peer.privKey is required"),"ERR_MISSING_PRIVATE_KEY"));const i=t.privKey,o=y(e);r.store.has(o,(t,s)=>t?g(n,t):s?g(n,c(new Error(`Key '${e}' already exists`),"ERR_KEY_ALREADY_EXISTS")):void i.id((t,s)=>{if(t)return g(n,t);i.export(this._(),(t,i)=>{if(t)return g(n,t);const a={name:e,id:s},l=r.store.batch();l.put(o,i),l.put(v(e),JSON.stringify(a)),l.commit(e=>{if(e)return g(n,e);n(null,a)})})}))}_getPrivateKey(e,t){if(!m(e))return g(t,c(new Error(`Invalid key name '${e}'`),"ERR_INVALID_KEY_NAME"));this.store.get(y(e),(n,r)=>{if(n)return g(t,c(new Error(`Key '${e}' does not exist. ${n.message}`),"ERR_KEY_NOT_FOUND"));t(null,r.toString())})}}e.exports=b},function(e,t,n){"use strict";var r=n(862),i=/[\/\?<>\\:\*\|":]/g,o=/[\x00-\x1f\x80-\x9f]/g,s=/^\.+$/,a=/^(con|prn|aux|nul|com[0-9]|lpt[0-9])(\..*)?$/i,l=/[\. ]+$/;function u(e,t){var n=e.replace(i,t).replace(o,t).replace(s,t).replace(a,t).replace(l,t);return r(n,255)}e.exports=function(e,t){var n=t&&t.replacement||"",r=u(e,n);return""===n?r:u(r,"")}},function(e,t,n){"use strict";var r=n(863),i=n(864);e.exports=r.bind(null,i)},function(e,t,n){"use strict";function r(e){return e>=55296&&e<=56319}function i(e){return e>=56320&&e<=57343}e.exports=function e(t,n,o){if("string"!=typeof n)throw new Error("Input must be string");for(var s=n.length,a=0,l,u,c=0;co)return n.slice(0,c-u.length+1)}return n}},function(e,t,n){"use strict";function r(e){return e>=55296&&e<=56319}function i(e){return e>=56320&&e<=57343}e.exports=function e(t){if("string"!=typeof t)throw new Error("Input must be string");for(var n=t.length,o=0,s=null,a=null,l=0;l=128&&s<=2047?o+=2:s>=2048&&s<=65535&&(o+=3),a=s;return o}},function(e,t,n){"use strict";(function(t){const r=n(19),i=n(43),o=n(866),s=n(10);n(867),n(249);const a=n(20),l=n(872),u=n(13);class c{constructor(e){if(!e)throw u(new Error("keychain is required"),"ERR_KEYCHAIN_REQUIRED");this.keychain=e}encrypt(e,n,o){const s=this,c=(e,t)=>r(()=>o(e,t));if(!t.isBuffer(n))return c(u(new Error("Plain data must be a Buffer"),"ERR_INVALID_PARAMS"));i([t=>s.keychain.findKeyByName(e,t),t=>s.keychain._getPrivateKey(e,t)],(e,r)=>{if(e)return c(e);let i=r[0],u=r[1];try{const r=a.pki.decryptRsaPrivateKey(u,s.keychain._());l.certificateForKey(i,r,(e,r)=>{if(e)return o(e);const i=a.pkcs7.createEnvelopedData();i.addRecipient(r),i.content=a.util.createBuffer(n),i.encrypt();const s=a.asn1.toDer(i.toAsn1()).getBytes();c(null,t.from(s,"binary"))})}catch(e){c(e)}})}decrypt(e,n){const i=(e,t)=>r(()=>n(e,t));if(!t.isBuffer(e))return i(u(new Error("CMS data is required"),"ERR_INVALID_PARAMS"));const l=this;let c;try{const t=a.util.createBuffer(e.toString("binary")),n=a.asn1.fromDer(t);c=a.pkcs7.messageFromAsn1(n)}catch(e){return i(u(new Error("Invalid CMS: "+e.message),"ERR_INVALID_CMS"))}const h=c.recipients.filter(e=>e.issuer.find(e=>"O"===e.shortName&&"ipfs"===e.value)).filter(e=>e.issuer.find(e=>"CN"===e.shortName)).map(e=>({recipient:e,keyId:e.issuer.find(e=>"CN"===e.shortName).value}));o(h,(e,t)=>l.keychain.findKeyById(e.keyId,(e,n)=>t(null,!e&&n)),(e,n)=>{if(e)return i(e);if(!n){const t=h.map(e=>e.keyId);return e=u(new Error("Decryption needs one of the key(s): "+t.join(", ")),"ERR_MISSING_KEYS",{missingKeys:t}),i(e)}s([e=>l.keychain.findKeyById(n.keyId,e),(e,t)=>l.keychain._getPrivateKey(e.name,t)],(e,r)=>{if(e)return i(e);const o=a.pki.decryptRsaPrivateKey(r,l.keychain._());c.decrypt(n.recipient,o),i(null,t.from(c.content.getBytes(),"binary"))})})}}e.exports=c}).call(this,n(0).Buffer)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(154),i=h(r),o=n(155),s=h(o),a=n(110),l=h(a),u=n(424),c=h(u);function h(e){return e&&e.__esModule?e:{default:e}}t.default=(0,l.default)((0,s.default)(i.default,c.default)),e.exports=t.default},function(e,t,n){var r=n(20);n(194),n(117),n(250),n(150),n(251),n(868),n(118),n(30),n(425);var i=r.asn1,o=e.exports=r.pkcs7=r.pkcs7||{};function s(e){var t={},n=[];if(!i.validate(e,o.asn1.recipientInfoValidator,t,n)){var s=new Error("Cannot read PKCS#7 RecipientInfo. ASN.1 object is not an PKCS#7 RecipientInfo.");throw s.errors=n,s}return{version:t.version.charCodeAt(0),issuer:r.pki.RDNAttributesAsArray(t.issuer),serialNumber:r.util.createBuffer(t.serial).toHex(),encryptedContent:{algorithm:i.derToOid(t.encAlgorithm),parameter:t.encParameter.value,content:t.encKey}}}function a(e){return i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[i.create(i.Class.UNIVERSAL,i.Type.INTEGER,!1,i.integerToDer(e.version).getBytes()),i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[r.pki.distinguishedNameToAsn1({attributes:e.issuer}),i.create(i.Class.UNIVERSAL,i.Type.INTEGER,!1,r.util.hexToBytes(e.serialNumber))]),i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[i.create(i.Class.UNIVERSAL,i.Type.OID,!1,i.oidToDer(e.encryptedContent.algorithm).getBytes()),i.create(i.Class.UNIVERSAL,i.Type.NULL,!1,"")]),i.create(i.Class.UNIVERSAL,i.Type.OCTETSTRING,!1,e.encryptedContent.content)])}function l(e){for(var t=[],n=0;n0){for(var n=i.create(i.Class.CONTEXT_SPECIFIC,1,!0,[]),o=0;o=n&&s0&&s.value[0].value.push(i.create(i.Class.CONTEXT_SPECIFIC,0,!0,t)),o.length>0&&s.value[0].value.push(i.create(i.Class.CONTEXT_SPECIFIC,1,!0,o)),s.value[0].value.push(i.create(i.Class.UNIVERSAL,i.Type.SET,!0,e.signerInfos)),i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[i.create(i.Class.UNIVERSAL,i.Type.OID,!1,i.oidToDer(e.type).getBytes()),s])},addSigner:function(t){var n=t.issuer,i=t.serialNumber;if(t.certificate){var o=t.certificate;"string"==typeof o&&(o=r.pki.certificateFromPem(o)),n=o.issuer.attributes,i=o.serialNumber}var s=t.key;if(!s)throw new Error("Could not add PKCS#7 signer; no private key specified.");"string"==typeof s&&(s=r.pki.privateKeyFromPem(s));var a=t.digestAlgorithm||r.pki.oids.sha1;switch(a){case r.pki.oids.sha1:case r.pki.oids.sha256:case r.pki.oids.sha384:case r.pki.oids.sha512:case r.pki.oids.md5:break;default:throw new Error("Could not add PKCS#7 signer; unknown message digest algorithm: "+a)}var l=t.authenticatedAttributes||[];if(l.length>0){for(var u=!1,c=!1,h=0;h>8*h-c&255;return _=String.fromCharCode(_.charCodeAt(0)&~w)+_.substr(1),_+m+String.fromCharCode(188)},verify:function(e,o,a){var l,u=a-1,c=Math.ceil(u/8);if(o=o.substr(-c),c>8*c-u&255;if(0!=(f.charCodeAt(0)&d))throw new Error("Bits beyond keysize not zero as expected.");var m=n.generate(p,h),g="";for(l=0;l{const r=i.setRsaPublicKey(t.n,t.e),o=i.createCertificate();o.publicKey=r,o.serialNumber="01",o.validity.notBefore=new Date,o.validity.notAfter=new Date,o.validity.notAfter.setFullYear(o.validity.notBefore.getFullYear()+10);const s=[{name:"organizationName",value:"ipfs"},{shortName:"OU",value:"keystore"},{name:"commonName",value:e.id}];return o.setSubject(s),o.setIssuer(s),o.setExtensions([{name:"basicConstraints",cA:!0},{name:"keyUsage",keyCertSign:!0,digitalSignature:!0,nonRepudiation:!0,keyEncipherment:!0,dataEncipherment:!0},{name:"extKeyUsage",serverAuth:!0,clientAuth:!0,codeSigning:!0,emailProtection:!0,timeStamping:!0},{name:"nsCertType",client:!0,server:!0,email:!0,objsign:!0,sslCA:!0,emailCA:!0,objCA:!0}]),o.sign(t),n(null,o)})},function(e,t,n){"use strict";function r(){throw new Error("Key management requires '--pass ...' option")}class i{static get options(){r()}static generateOptions(){r()}createKey(){r()}listKeys(){r()}findKeyById(){r()}findKeyByName(){r()}renameKey(){r()}removeKey(){r()}exportKey(){r()}importKey(){r()}importPeer(){r()}get cms(){r()}}e.exports=i},function(e,t,n){"use strict";const r=n(43),i=n(875),o=n(19),s=n(1),a=n(430),l=n(901),u=n(437);e.exports=(e=>s(t=>{const n=n=>{if(n)return o(()=>e.emit("error",n)),t(n);e.state.started(),o(()=>e.emit("start")),t()};if("stopped"!==e.state.state())return n(new Error(`Not able to start from state: ${e.state.state()}`));e.log("starting"),e.state.start(),r([t=>{e._repo.closed?e._repo.open(t):t()},t=>{e._repo.config.get((n,r)=>{if(n)return t(n);const i=u(e,r);i.start(n=>{if(n)return t(n);e.libp2p=i,t()})})},t=>{const n=l(e);e._ipns=new a(n,e._repo.datastore,e._peerInfo,e._keychain,e._options),e._bitswap=new i(e.libp2p,e._repo.blocks,{statsEnabled:!0}),e._bitswap.start(),e._blockService.setExchange(e._bitswap),e._preload.start(),e._ipns.republisher.start(),e._mfsPreload.start(t)}],n)}))},function(e,t,n){"use strict";const r=n(10),i=n(408),o=n(38),s=n(43),a=n(58),l=n(47),u=n(876),c=n(883),h=n(887),f=n(889),p=n(100).logger,d=n(890),m={statsEnabled:!1,statsComputeThrottleTimeout:1e3,statsComputeThrottleMaxQueueSize:1e3},g=["blocksReceived","dataReceived","dupBlksReceived","dupDataReceived","blocksSent","dataSent","providesBufferLength","wantListLength","peerCount"];class y{constructor(e,t,n){this._libp2p=e,this._log=p(this.peerInfo.id),this._options=Object.assign({},m,n),this._stats=new d(g,{enabled:this._options.statsEnabled,computeThrottleTimeout:this._options.statsComputeThrottleTimeout,computeThrottleMaxQueueSize:this._options.statsComputeThrottleMaxQueueSize}),this.network=new c(e,this,{},this._stats),this.blockstore=t,this.engine=new h(this.peerInfo.id,t,this.network,this._stats),this.wm=new u(this.peerInfo.id,this.network,this._stats),this.notifications=new f(this.peerInfo.id)}get peerInfo(){return this._libp2p.peerInfo}_receiveMessage(e,t,n){this.engine.messageReceived(e,t,r=>{if(r&&this._log("failed to receive message",t),0===t.blocks.size)return n();const i=Array.from(t.blocks.values()),s=i.filter(e=>this.wm.wantlist.contains(e.cid)).map(e=>e.cid);this.wm.cancelWants(s),o(i,(t,n)=>this._handleReceivedBlock(e,t,n),n)})}_handleReceivedBlock(e,t,n){this._log("received block"),r([e=>this.blockstore.has(t.cid,e),(n,r)=>{if(this._updateReceiveCounters(e.toB58String(),t,n),n)return l(r);this._putBlock(t,r)}],n)}_updateReceiveCounters(e,t,n){this._stats.push(e,"blocksReceived",1),this._stats.push(e,"dataReceived",t.data.length),n&&(this._stats.push(e,"dupBlksReceived",1),this._stats.push(e,"dupDataReceived",t.data.length))}_receiveError(e){this._log.error("ReceiveError: %s",e.message)}_onPeerConnected(e){this.wm.connected(e)}_onPeerDisconnected(e){this.wm.disconnected(e),this.engine.peerDisconnected(e),this._stats.disconnected(e)}_putBlock(e,t){this.blockstore.put(e,n=>{if(n)return t(n);this.notifications.hasBlock(e),this.network.provide(e.cid,e=>{e&&this._log.error("Failed to provide: %s",e.message)}),this.engine.receivedBlocks([e.cid]),t()})}enableStats(){this._stats.enable()}disableStats(){this._stats.disable()}wantlistForPeer(e){return this.engine.wantlistForPeer(e)}ledgerForPeer(e){return this.engine.ledgerForPeer(e)}get(e,t){this.getMany([e],(e,n)=>{if(e)return t(e);n&&n.length>0?t(null,n[0]):t()})}getMany(e,t){let n=e.length;const i=[];let o=!1;const s=(e,t)=>{i.push(e),this.notifications.wantBlock(e,n=>{this.wm.cancelWants([e]),t(null,n)},()=>{this.wm.cancelWants([e]),t(null,void 0)}),n||this.wm.wantBlocks(i)};a(e,(t,a)=>{r([e=>this.blockstore.has(t,e),(r,a)=>{if(n--,r)return n||this.wm.wantBlocks(i),this.blockstore.get(t,a);o||(o=!0,this.network.findAndConnect(e[0],e=>{e&&this._log.error(e)})),s(t,a)}],a)},t)}unwant(e){Array.isArray(e)||(e=[e]),this.wm.unwantBlocks(e),e.forEach(e=>this.notifications.unwantBlock(e))}cancelWants(e){Array.isArray(e)||(e=[e]),this.wm.cancelWants(e)}put(e,t){this._log("putting block"),r([t=>this.blockstore.has(e.cid,t),(t,n)=>{if(t)return l(n);this._putBlock(e,n)}],t)}putMany(e,t){r([t=>i(e,(e,t)=>{this.blockstore.has(e.cid,t)},t),(e,t)=>this.blockstore.putMany(e,n=>{if(n)return t(n);e.forEach(e=>{this.notifications.hasBlock(e),this.engine.receivedBlocks([e.cid]),this.network.provide(e.cid,e=>{e&&this._log.error("Failed to provide: %s",e.message)})}),t()})],t)}getWantlist(){return this.wm.wantlist.entries()}peers(){return this.engine.peers()}stat(){return this._stats}start(e){s([e=>this.wm.start(e),e=>this.network.start(e),e=>this.engine.start(e)],e)}stop(e){this._stats.stop(),s([e=>this.wm.stop(e),e=>this.network.stop(e),e=>this.engine.stop(e)],e)}}e.exports=y},function(e,t,n){"use strict";const r=n(47),i=n(204),o=n(205),s=n(263),a=n(882),l=n(100).logger;e.exports=class e{constructor(e,t,n){this.peers=new Map,this.wantlist=new o(n),this.network=t,this._stats=n,this._peerId=e,this._log=l(e,"want")}_addEntries(e,t,n){const r=e.map((e,n)=>new i.Entry(e,s.kMaxPriority-n,t));r.forEach(e=>{e.cancel?n?this.wantlist.removeForce(e.cid):this.wantlist.remove(e.cid):(this._log("adding to wl"),this.wantlist.add(e.cid,e.priority))});for(let e of this.peers.values())e.addEntries(r)}_startPeerHandler(e){let t=this.peers.get(e.toB58String());if(t)return void t.refcnt++;t=new a(this._peerId,e,this.network);const n=new i(!0);for(let e of this.wantlist.entries())n.addEntry(e[1].cid,e[1].priority);return t.addMessage(n),this.peers.set(e.toB58String(),t),t}_stopPeerHandler(e){const t=this.peers.get(e.toB58String());t&&(t.refcnt--,t.refcnt>0||this.peers.delete(e.toB58String()))}wantBlocks(e){this._addEntries(e,!1)}unwantBlocks(e){this._log("unwant blocks: %s",e.length),this._addEntries(e,!0,!0)}cancelWants(e){this._log("cancel wants: %s",e.length),this._addEntries(e,!0)}connectedPeers(){return Array.from(this.peers.keys())}connected(e){this._startPeerHandler(e)}disconnected(e){this._stopPeerHandler(e)}start(e){this.timer=setInterval(()=>{this._log("resend full-wantlist");const e=new i(!0);this.wantlist.forEach(t=>{e.addEntry(t.cid,t.priority)}),this.peers.forEach(t=>t.addMessage(e))},6e4),r(()=>e())}stop(e){this.peers.forEach(e=>this.disconnected(e.peerId)),clearInterval(this.timer),r(()=>e())}}},function(e,t,n){(function(e,n){var r=200,i="__lodash_hash_undefined__",o=1,s=2,a=9007199254740991,l="[object Arguments]",u="[object Array]",c="[object Boolean]",h="[object Date]",f="[object Error]",p="[object Function]",d="[object GeneratorFunction]",m="[object Map]",g="[object Number]",y="[object Object]",v="[object Promise]",b="[object RegExp]",_="[object Set]",w="[object String]",k="[object Symbol]",E="[object WeakMap]",S="[object ArrayBuffer]",x="[object DataView]",C="[object Float32Array]",A="[object Float64Array]",T="[object Int8Array]",I="[object Int16Array]",j="[object Int32Array]",R="[object Uint8Array]",B="[object Uint8ClampedArray]",O="[object Uint16Array]",P="[object Uint32Array]",N=/[\\^$.*+?()[\]{}|]/g,D=/^\[object .+?Constructor\]$/,F=/^(?:0|[1-9]\d*)$/,M={};M[C]=M[A]=M[T]=M[I]=M[j]=M[R]=M[B]=M[O]=M[P]=!0,M[l]=M[u]=M[S]=M[c]=M[x]=M[h]=M[f]=M[p]=M[m]=M[g]=M[y]=M[b]=M[_]=M[w]=M[E]=!1;var L="object"==typeof e&&e&&e.Object===Object&&e,U="object"==typeof self&&self&&self.Object===Object&&self,q=L||U||Function("return this")(),z=t&&!t.nodeType&&t,K=z&&"object"==typeof n&&n&&!n.nodeType&&n,H=K&&K.exports===z,V=H&&L.process,$=function(){try{return V&&V.binding("util")}catch(e){}}(),W=$&&$.isTypedArray;function G(e,t){for(var n=-1,r=e?e.length:0;++n-1}function qe(e,t){var n=this.__data__,r=it(n,e);return r<0?n.push([e,t]):n[r][1]=t,this}function ze(e){var t=-1,n=e?e.length:0;for(this.clear();++tu))return!1;var h=a.get(e);if(h&&a.get(t))return h==t;var f=-1,p=!0,d=i&o?new Ge:void 0;for(a.set(e,t),a.set(t,e);++f-1&&e%1==0&&e-1&&e%1==0&&e<=a}function jt(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function Rt(e){return!!e&&"object"==typeof e}var Bt=W?Z(W):ut;function Ot(e){return xt(e)?rt(e):ct(e)}n.exports=At}).call(this,n(7),n(85)(e))},function(e,t,n){"use strict";(function(t){const r=n(35);e.exports=(e=>{if(!t.isBuffer(e))throw new Error("arg needs to be a buffer");let n=[];for(;e.length>0;){const t=r.decode(e);n.push(t),e=e.slice(r.decode.bytes)}return n})}).call(this,n(0).Buffer)},function(e,t,n){"use strict";e.exports="\n message Message {\n message Wantlist {\n message Entry {\n // changed from string to bytes, it makes a difference in JavaScript\n optional bytes block = 1; // the block cid (cidV0 in bitswap 1.0.0, cidV1 in bitswap 1.1.0)\n optional int32 priority = 2; // the priority (normalized). default to 1\n optional bool cancel = 3; // whether this revokes an entry\n }\n\n repeated Entry entries = 1; // a list of wantlist entries\n optional bool full = 2; // whether this is the full wantlist. default to false\n }\n\n message Block {\n optional bytes prefix = 1; // CID prefix (cid version, multicodec and multihash prefix (type + length)\n optional bytes data = 2;\n }\n\n optional Wantlist wantlist = 1;\n repeated bytes blocks = 2; // used to send Blocks in bitswap 1.0.0\n repeated Block payload = 3; // used to send Blocks in bitswap 1.1.0\n }\n"},function(e,t,n){"use strict";const r=n(205).Entry,i=n(9),o=n(23);e.exports=class e{constructor(e,t,n){o(i.isCID(e),"needs valid cid"),this.entry=new r(e,t),this.cancel=Boolean(n)}get cid(){return this.entry.cid}set cid(e){this.entry.cid=e}get priority(){return this.entry.priority}set priority(e){this.entry.priority=e}get[Symbol.toStringTag](){const e=this.cid.toBaseEncodedString();return`BitswapMessageEntry ${e} `}equals(e){return this.cancel===e.cancel&&this.entry.equals(e.entry)}}},function(e,t,n){"use strict";const r=n(23),i=n(9);class o{constructor(e,t){r(i.isCID(e),"must be valid CID"),this._refCounter=1,this.cid=e,this.priority=t||1}inc(){this._refCounter+=1}dec(){this._refCounter=Math.max(0,this._refCounter-1)}hasRefs(){return this._refCounter>0}get[Symbol.toStringTag](){const e=this.cid.toBaseEncodedString();return`WantlistEntry `}equals(e){return this._refCounter===e._refCounter&&this.cid.equals(e.cid)&&this.priority===e.priority}}e.exports=o},function(e,t,n){"use strict";const r=n(426),i=n(204),o=n(100).logger;e.exports=class e{constructor(e,t,n){this.peerId=t,this.network=n,this.refcnt=1,this._entries=[],this._log=o(e,"msgqueue",t.toB58String().slice(0,8)),this.sendEntries=r(this._sendEntries.bind(this),200)}addMessage(e){e.empty||this.send(e)}addEntries(e){this._entries=this._entries.concat(e),this.sendEntries()}_sendEntries(){if(!this._entries.length)return;const e=new i(!1);this._entries.forEach(t=>{t.cancel?e.cancel(t.cid):e.addEntry(t.cid,t.priority)}),this._entries=[],this.addMessage(e)}send(e){this.network.connectTo(this.peerId,t=>{t?this._log.error("cant connect to peer %s: %s",this.peerId.toB58String(),t.message):(this._log("sending message"),this.network.sendMessage(this.peerId,e,e=>{e&&this._log.error("send error: %s",e.message)}))})}}},function(e,t,n){"use strict";const r=n(50),i=n(18),o=n(10),s=n(38),a=n(47),l=n(204),u=n(263),c=n(100).logger,h="/ipfs/bitswap/1.0.0",f="/ipfs/bitswap/1.1.0";class p{constructor(e,t,n,r){this._log=c(e.peerInfo.id,"network"),n=n||{},this.libp2p=e,this.bitswap=t,this.b100Only=n.b100Only||!1,this._stats=r,this._running=!1}start(e){this._running=!0,this._onPeerConnect=this._onPeerConnect.bind(this),this._onPeerDisconnect=this._onPeerDisconnect.bind(this),this._onConnection=this._onConnection.bind(this),this.libp2p.handle(h,this._onConnection),this.b100Only||this.libp2p.handle(f,this._onConnection),this.libp2p.on("peer:connect",this._onPeerConnect),this.libp2p.on("peer:disconnect",this._onPeerDisconnect),this.libp2p.peerBook.getAllArray().filter(e=>e.isConnected()).forEach(e=>this._onPeerConnect(e)),a(()=>e())}stop(e){this._running=!1,this.libp2p.unhandle(h),this.b100Only||this.libp2p.unhandle(f),this.libp2p.removeListener("peer:connect",this._onPeerConnect),this.libp2p.removeListener("peer:disconnect",this._onPeerDisconnect),a(()=>e())}_onConnection(e,t){this._running&&(this._log("incomming new bitswap connection: %s",e),i(t,r.decode(),i.asyncMap((e,t)=>l.deserialize(e,t)),i.asyncMap((e,n)=>{t.getPeerInfo((t,r)=>{if(t)return n(t);this.bitswap._receiveMessage(r.id,e,n)})}),i.onEnd(e=>{this._log("ending connection"),e&&this.bitswap._receiveError(e)})))}_onPeerConnect(e){this._running&&this.bitswap._onPeerConnected(e.id)}_onPeerDisconnect(e){this._running&&this.bitswap._onPeerDisconnected(e.id)}findProviders(e,t,n){this.libp2p.contentRouting.findProviders(e,{maxTimeout:u.providerRequestTimeout,maxNumProviders:t},n)}findAndConnect(e,t){o([t=>this.findProviders(e,u.maxProvidersPerRequest,t),(e,t)=>{this._log("connecting to providers",e.map(e=>e.id.toB58String())),s(e,(e,t)=>this.connectTo(e,t))}],t)}provide(e,t){this.libp2p.contentRouting.provide(e,t)}sendMessage(e,t,n){if(!this._running)return n(new Error("network isn't running"));const r=e.toB58String()?e.toB58String():e.id.toB58String();this._log("sendMessage to %s",r,t),this._dialPeer(e,(r,i,o)=>{if(r)return n(r);let s;switch(o){case h:s=t.serializeToBitswap100();break;case f:s=t.serializeToBitswap110();break;default:return n(new Error("Unkown protocol: "+o))}d(i,s,e=>{e&&this._log.error(e)}),n(),this._updateSentStats(e,t.blocks)})}connectTo(e,t){if(!this._running)return t(new Error("network isn't running"));this.libp2p.dial(e,t)}_dialPeer(e,t){this.libp2p.dialProtocol(e,f,(n,r)=>{n?this.libp2p.dialProtocol(e,h,(e,n)=>{if(e)return t(e);t(null,n,h)}):t(null,r,f)})}_updateSentStats(e,t){const n=e.toB58String();this._stats&&(t.forEach(e=>this._stats.push(n,"dataSent",e.data.length)),this._stats.push(n,"blocksSent",t.size))}}function d(e,t,n){i(i.values([t]),r.encode(),e,i.onEnd(n))}e.exports=p},function(e,t,n){"use strict";const r=n(5).Buffer;e.exports=o;const i=10240;function o(e){e=Object.assign({fixed:!1},e||{});const t=n(35);let i=e.fixed?null:s(),o=0,a=!1;return n=>(l,u)=>{if(l&&(a=l),a)return u(a);n(null,(n,l)=>{if(n&&(a=n),a)return u(a);if(!a&&!r.isBuffer(l))return a=new Error("data must be a buffer"),u(a);const c=a?0:l.length;let h;if(e.fixed?(h=r.alloc(4),h.writeInt32BE(c,0)):(t.encode(c,i,o),o+=t.encode.bytes,h=i.slice(o-t.encode.bytes,o),i.length-o<100&&(i=s(),o=0)),a)return u(null,h);u(null,r.concat([h,l],(e.fixed?4:t.encode.bytes)+c))})}}function s(){return r.alloc(i)}},function(e,t,n){"use strict";const r=n(35),i=n(427),o=n(5).Buffer,s=n(63);t.decode=c,t.decodeFromReader=h;const a=128,l=e=>!(128&e),u=4194304;function c(e){let t=new i,n=s(e=>{t.abort(e)});return r=>{function i(){let r=!0,o=!1;const s=(e,t)=>{o=!0,e?(n.end(e),r=!1):(n.push(t),r||i())};for(;r;)o=!1,f(t,e,s),o||(r=!1)}return t(r),i(),n}}function h(e,t,n){"function"==typeof t&&(n=t,t={}),f(e,t,function e(t,r){if(t)return n(!0===t?new Error("Unexpected end of input from reader."):t);n(null,r)})}function f(e,t,n){t=Object.assign({fixed:!1,maxLength:u},t||{}),t.fixed?p(e,t.maxLength,n):d(e,t.maxLength,n)}function p(e,t,n){e.read(4,(r,i)=>{if(r)return n(r);const o=i.readInt32BE(0);if(o>t)return n(new Error("size longer than max permitted length of "+t+"!"));m(e,o,n)})}function d(e,t,n){let i=[];function s(){e.read(1,(a,u)=>{if(a)return n(a);if(i.push(u),u&&!l(u[0]))return void s();const c=r.decode(o.concat(i));if(c>t)return n(new Error("size longer than max permitted length of "+t+"!"));m(e,c,(e,t)=>e?n(e):(i=[],t.length{if(e)return n(e);n(null,t)})}},function(e,t,n){(function(t){e.exports=function(){var e=[],n=0;function r(){return e.reduce(function(e,t){return e+t.length},0)}return{length:n,data:this,add:function(r){if(!t.isBuffer(r))throw new Error("data must be a buffer, was: "+JSON.stringify(r));return this.length=n+=r.length,e.push(r),this},has:function(e){return null==e?n>0:n>=e},get:function(r){var i;if(null==r||r===n){n=0;var o=e;return e=[],1==o.length?o[0]:t.concat(o)}if(e.length>1&&r<=(i=e[0].length)){var s=e[0].slice(0,r);return r===i?e.shift():e[0]=e[0].slice(r,i),n-=r,s}if(re+t.data.byteLength,0);if(r{if(l--,a.push(t),o+=t.data.byteLength,o>=g||0===l){o=0;const t=a.slice();a=[],this._sendSafeBlocks(e,t,e=>{e&&this._log("sendblock error: %s",e.message),n()})}else s(n)},n)}_sendSafeBlocks(e,t,n){const r=new u(!1);t.forEach(e=>r.addBlock(e)),this.network.sendMessage(e,r,n)}_processTasks(){if(!this._running||!this._tasks.length)return;const e=this._tasks;this._tasks=[];const t=e.map(e=>e.entry),n=t.map(e=>e.cid),i=m((e,t)=>e.equals(t),n),s=p(e=>e.target.toB58String(),e);o([e=>a(i,(e,t)=>{this.blockstore.get(e,t)},e),(e,t)=>r(Object.values(s),(t,r)=>{const i=t[0].target,o=n.map(t=>e.find(e=>e.cid.equals(t)));this._sendBlocks(i,o,e=>{e?this._log.error("should never happen: ",e):o.forEach(e=>this.messageSent(i,e)),r()})},t)],e=>{this._tasks=[],e&&this._log.error(e)})}wantlistForPeer(e){const t=e.toB58String();return this.ledgerMap.has(t)?this.ledgerMap.get(t).wantlist.sortedEntries():new Map}ledgerForPeer(e){const t=e.toB58String(),n=this.ledgerMap.get(t);return n?{peer:n.partner.toPrint(),value:n.debtRatio(),sent:n.accounting.bytesSent,recv:n.accounting.bytesRecv,exchanged:n.exchangeCount}:null}peers(){return Array.from(this.ledgerMap.values()).map(e=>e.partner)}receivedBlocks(e){e.length&&(this.ledgerMap.forEach(t=>{e.map(e=>t.wantlistContains(e)).filter(Boolean).forEach(e=>{this._tasks.push({entry:e,target:t.partner})})}),this._outbox())}messageReceived(e,t,n){const r=this._findOrCreate(e);if(t.empty)return s(n);if(t.full&&(r.wantlist=new c),this._processBlocks(t.blocks,r),0===t.wantlist.size)return s(n);let i=[],o=[];t.wantlist.forEach(e=>{e.cancel?(r.cancelWant(e.cid),i.push(e)):(r.wants(e.cid,e.priority),o.push(e))}),this._cancelWants(r,e,i),this._addWants(r,e,o,n)}_cancelWants(e,t,n){const r=t.toB58String();this._tasks=d((e,t)=>{const n=e.target.toB58String()===r,i=e.entry.cid.equals(t.cid);return n&&i},this._tasks,n)}_addWants(e,t,n,i){r(n,(e,n)=>{this.blockstore.has(e.cid,(r,i)=>{r?this._log.error("failed existence check"):i&&this._tasks.push({entry:e.entry,target:t}),n()})},()=>{this._outbox(),i()})}_processBlocks(e,t,n){const r=[];e.forEach((e,n)=>{this._log("got block (%s bytes)",e.data.length),t.receivedBytes(e.data.length),r.push(e.cid)}),this.receivedBlocks(r)}messageSent(e,t){const n=this._findOrCreate(e);n.sentBytes(t?t.data.length:0),t&&t.cid&&n.wantlist.remove(t.cid)}numBytesSentTo(e){return this._findOrCreate(e).accounting.bytesSent}numBytesReceivedFrom(e){return this._findOrCreate(e).accounting.bytesRecv}peerDisconnected(e){}_findOrCreate(e){const t=e.toB58String();if(this.ledgerMap.has(t))return this.ledgerMap.get(t);const n=new h(e);return this.ledgerMap.set(t,n),this._stats&&this._stats.push(t,"peerCount",1),n}start(e){this._running=!0,s(()=>e())}stop(e){this._running=!1,s(()=>e())}}e.exports=y},function(e,t,n){"use strict";const r=n(205);class i{constructor(e){this.partner=e,this.wantlist=new r,this.exchangeCount=0,this.sentToPeer=new Map,this.accounting={bytesSent:0,bytesRecv:0}}sentBytes(e){this.exchangeCount++,this.lastExchange=(new Date).getTime(),this.accounting.bytesSent+=e}receivedBytes(e){this.exchangeCount++,this.lastExchange=(new Date).getTime(),this.accounting.bytesRecv+=e}wants(e,t){this.wantlist.add(e,t)}cancelWant(e){this.wantlist.remove(e)}wantlistContains(e){return this.wantlist.contains(e)}debtRatio(){return this.accounting.bytesSent/(this.accounting.bytesRecv+1)}}e.exports=i},function(e,t,n){"use strict";const r=n(6).EventEmitter,i=n(263),o=n(100).logger,s=e=>`unwant:${e}`,a=e=>`block:${e}`;class l extends r{constructor(e){super(),this.setMaxListeners(i.maxListeners),this._log=o(e,"notif"),this._unwantListeners={},this._blockListeners={}}hasBlock(e){const t=`block:${e.cid.buffer.toString()}`;this._log(t),this.emit(t,e)}wantBlock(e,t,n){const r=e.buffer.toString();this._log(`wantBlock:${r}`),this._unwantListeners[r]=(()=>{this._log(`manual unwant: ${r}`),this._cleanup(r),n()}),this._blockListeners[r]=(e=>{this._cleanup(r),t(e)}),this.once(s(r),this._unwantListeners[r]),this.once(a(r),this._blockListeners[r])}unwantBlock(e){const t=`unwant:${e.buffer.toString()}`;this._log(t),this.emit(t)}_cleanup(e){this._unwantListeners[e]&&(this.removeListener(s(e),this._unwantListeners[e]),delete this._unwantListeners[e]),this._blockListeners[e]&&(this.removeListener(a(e),this._blockListeners[e]),delete this._blockListeners[e])}}e.exports=l},function(e,t,n){"use strict";const r=n(6),i=n(891),o={movingAverageIntervals:[6e4,3e5,9e5]};class s extends r{constructor(e,t){super();const n=Object.assign({},o,t);if("number"!=typeof n.computeThrottleTimeout)throw new Error("need computeThrottleTimeout");if("number"!=typeof n.computeThrottleMaxQueueSize)throw new Error("need computeThrottleMaxQueueSize");this._initialCounters=e,this._options=n,this._enabled=this._options.enabled,this._global=new i(e,n),this._global.on("update",e=>this.emit("update",e)),this._peers=new Map}enable(){this._enabled=!0,this._options.enabled=!0,this._global.enable()}disable(){this._enabled=!1,this._options.enabled=!1,this._global.disable()}stop(){this._enabled=!1,this._global.stop();for(let e of this._peers)e[1].stop()}get snapshot(){return this._global.snapshot}get movingAverages(){return this._global.movingAverages}forPeer(e){return e.toB58String&&(e=e.toB58String()),this._peers.get(e)}push(e,t,n){if(this._enabled&&(this._global.push(t,n),e)){let r=this._peers.get(e);r||(r=new i(this._initialCounters,this._options),this._peers.set(e,r)),r.push(t,n)}}disconnected(e){const t=e.toB58String(),n=this._peers.get(t);n&&(n.stop(),this._peers.delete(t))}}e.exports=s},function(e,t,n){"use strict";const r=n(6),i=n(53),o=n(429);class s extends r{constructor(e,t){super(),this._options=t,this._queue=[],this._stats={},this._frequencyLastTime=Date.now(),this._frequencyAccumulators={},this._movingAverages={},this._update=this._update.bind(this),e.forEach(e=>{this._stats[e]=i(0),this._movingAverages[e]={},this._options.movingAverageIntervals.forEach(t=>{const n=this._movingAverages[e][t]=o(t);n.push(this._frequencyLastTime,0)})}),this._enabled=this._options.enabled}enable(){this._enabled=!0}disable(){this._disabled=!0}stop(){this._timeout&&clearTimeout(this._timeout)}get snapshot(){return Object.assign({},this._stats)}get movingAverages(){return Object.assign({},this._movingAverages)}push(e,t){this._enabled&&(this._queue.push([e,t,Date.now()]),this._resetComputeTimeout())}_resetComputeTimeout(){this._timeout&&clearTimeout(this._timeout),this._timeout=setTimeout(this._update,this._nextTimeout())}_nextTimeout(){const e=this._queue.length/this._options.computeThrottleMaxQueueSize;return Math.max(this._options.computeThrottleTimeout*(1-e),0)}_update(){if(this._timeout=null,this._queue.length){let e;for(;this._queue.length;){const t=e=this._queue.shift();this._applyOp(t)}this._updateFrequency(e[2]),this.emit("update",this._stats)}}_updateFrequency(e){const t=e-this._frequencyLastTime;Object.keys(this._stats).forEach(n=>{this._updateFrequencyFor(n,t,e)}),this._frequencyLastTime=e}_updateFrequencyFor(e,t,n){const r=this._frequencyAccumulators[e]||0;this._frequencyAccumulators[e]=0;const i=r/t*1e3;let s=this._movingAverages[e];s||(s=this._movingAverages[e]={}),this._options.movingAverageIntervals.forEach(e=>{let t=s[e];t||(t=s[e]=o(e)),t.push(n,i)})}_applyOp(e){const t=e[0],n=e[1];if("number"!=typeof n)throw new Error("invalid increment number:",n);let r;r=this._stats.hasOwnProperty(t)?this._stats[t]:this._stats[t]=i(0),this._stats[t]=r.plus(n),this._frequencyAccumulators[t]||(this._frequencyAccumulators[t]=0),this._frequencyAccumulators[t]+=n}}e.exports=s},function(e,t,n){"use strict";e.exports=a;var r=n(78),i=a.prototype,o=new Date%1e9;function s(){return(1e9*Math.random()>>>0)+o++}function a(e){e=e||{},this.id=e.id||s(),this.max=e.max||1/0,this.items=e.items||[],this._lookup={},this.size=this.items.length,this.lastModified=new Date(e.lastModified||new Date);for(var t,n,r=this.items.length;r--;)t=this.items[r],n=new Date(t.expires)-new Date,this._lookup[t.key]=t,n>0?this.expire(t.key,n):n<=0&&this.delete(t.key)}i.has=function(e){return e in this._lookup},i.get=function(e){if(!this.has(e))return null;var t=this._lookup[e];return t.refresh&&this.expire(e,t.refresh),this.items.splice(this.items.indexOf(t),1),this.items.push(t),t.value},i.meta=function(e){if(!this.has(e))return null;var t=this._lookup[e];return"meta"in t?t.meta:null},i.set=function(e,t,n){var r=this._lookup[e],i=this._lookup[e]={key:e,value:t};return this.lastModified=new Date,r?(clearTimeout(r.timeout),this.items.splice(this.items.indexOf(r),1,i)):(this.size>=this.max&&this.delete(this.items[0].key),this.items.push(i),this.size++),n&&("ttl"in n&&this.expire(e,n.ttl),"meta"in n&&(i.meta=n.meta),n.refresh&&(i.refresh=n.ttl)),this},i.delete=function(e){var t=this._lookup[e];return!!t&&(this.lastModified=new Date,this.items.splice(this.items.indexOf(t),1),clearTimeout(t.timeout),delete this._lookup[e],this.size--,this)},i.expire=function(e,t){var n=t||0,i=this._lookup[e];if(!i)return this;if("string"==typeof n&&(n=r(t)),"number"!=typeof n)throw new TypeError("Expiration time must be a string or number.");return clearTimeout(i.timeout),i.timeout=setTimeout(this.delete.bind(this,i.key),n),i.expires=Number(new Date)+n,this},i.clear=function(){for(var e=this.items.length;e--;)this.delete(this.items[e].key);return this},i.toJSON=function(){for(var e=new Array(this.items.length),t,n=e.length;n--;)t=this.items[n],e[n]={key:t.key,meta:t.meta,value:t.value,expires:t.expires,refresh:t.refresh};return{id:this.id,max:isFinite(this.max)?this.max:void 0,lastModified:this.lastModified,items:e}}},function(e,t,n){"use strict";const r=n(15),{Key:i}=n(28),o=n(43),s=n(13),a=n(4),l=a("ipfs:ipns:publisher");l.error=a("ipfs:ipns:publisher:error");const u=n(156),c=36e5;class h{constructor(e,t){this._routing=e,this._datastore=t}publishWithEOL(e,t,n,i){if(!e||!e.bytes){const e="one or more of the provided parameters are not defined";return l.error(e),i(s(new Error(e),"ERR_UNDEFINED_PARAMETER"))}r.createFromPrivKey(e.bytes,(r,o)=>{if(r)return i(r);this._updateOrCreateRecord(e,t,n,o,(e,t)=>{if(e)return i(e);this._putRecordToRouting(t,o,i)})})}publish(e,t,n){this.publishWithEOL(e,t,c,n)}_putRecordToRouting(e,t,n){if(!r.isPeerId(t)){const e="peerId received is not valid";return l.error(e),n(s(new Error(e),"ERR_INVALID_PEER_ID"))}const i=t._pubKey;u.embedPublicKey(i,e,(r,s)=>{if(r)return n(r);let a;try{a=u.getIdKeys(t.toBytes())}catch(r){return l.error(r),n(r)}o([n=>this._publishEntry(a.routingKey,s||e,t,n),e=>this._publishPublicKey(a.routingPubKey,i,t,e)],t=>{if(t)return l.error(t),n(t);n(null,s||e)})})}_publishEntry(e,t,n,r){if(!i.isKey(e)){const e="datastore key does not have a valid format";return l.error(e),r(s(new Error(e),"ERR_INVALID_DATASTORE_KEY"))}let o;try{o=u.marshal(t)}catch(e){return l.error(e),r(e)}this._routing.put(e.toBuffer(),o,(t,n)=>{if(t){const t=`ipns record for ${e.toString()} could not be stored in the routing`;return l.error(t),r(s(new Error(t),"ERR_PUTTING_TO_ROUTING"))}l(`ipns record for ${e.toString()} was stored in the routing`),r(null,n)})}_publishPublicKey(e,t,n,r){if(!i.isKey(e)){const e="datastore key does not have a valid format";return l.error(e),r(s(new Error(e),"ERR_INVALID_DATASTORE_KEY"))}if(!t||!t.bytes){const e="one or more of the provided parameters are not defined";return l.error(e),r(s(new Error(e),"ERR_UNDEFINED_PARAMETER"))}this._routing.put(e.toBuffer(),t.bytes,(t,n)=>{if(t){const t=`public key for ${e.toString()} could not be stored in the routing`;return l.error(t),r(s(new Error(t),"ERR_PUTTING_TO_ROUTING"))}l(`public key for ${e.toString()} was stored in the routing`),r(null,n)})}_getPublished(e,t,n){if(!r.isPeerId(e)){const e="peerId received is not valid";return l.error(e),n(s(new Error(e),"ERR_INVALID_PEER_ID"))}t=t||{};const i=!1!==t.checkRouting;this._datastore.get(u.getLocalKey(e.id),(t,r)=>{if(t){if("ERR_NOT_FOUND"!==t.code){const t=`unexpected error getting the ipns record ${e.id} from datastore`;return l.error(t),n(s(new Error(t),"ERR_UNEXPECTED_DATASTORE_RESPONSE"))}if(!i)return n(s(t));let r;try{r=u.getIdKeys(e.toBytes())}catch(t){return l.error(t),n(t)}this._routing.get(r.routingKey.toBuffer(),(e,t)=>{if(e)return n(e);this._unmarshalData(t,n)})}else this._unmarshalData(r,n)})}_unmarshalData(e,t){let n;try{n=u.unmarshal(e)}catch(e){return l.error(e),t(s(e,"ERR_INVALID_RECORD_DATA"))}t(null,n)}_updateOrCreateRecord(e,t,n,i,o){if(!r.isPeerId(i)){const e="peerId received is not valid";return l.error(e),o(s(new Error(e),"ERR_INVALID_PEER_ID"))}const a={checkRouting:!0};this._getPublished(i,a,(r,a)=>{if(r&&"ERR_NOT_FOUND"!==r.code){const e=`unexpected error when determining the last published IPNS record for ${i.id}`;return l.error(e),o(s(new Error(e),"ERR_DETERMINING_PUBLISHED_RECORD"))}let c=0;a&&void 0!==a.sequence&&(c=a.value.toString()!==t?a.sequence+1:a.sequence),u.create(e,t,c,n,(e,n)=>{if(e){const e=`ipns record for ${t} could not be created`;return l.error(e),o(s(new Error(e),"ERR_CREATING_IPNS_RECORD"))}const r=u.marshal(n);this._datastore.put(u.getLocalKey(i.id),r,(e,r)=>{if(e){const e=`ipns record for ${t} could not be stored in the datastore`;return l.error(e),o(s(new Error(e),"ERR_STORING_IN_DATASTORE"))}l(`ipns record for ${t} was stored in the datastore`),o(null,n)})})})}}t=e.exports=h},function(e,t){var n="ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",r="0123456789ABCDEFGHIJKLMNOPQRSTUV",i="0123456789ABCDEFGHJKMNPQRSTVWXYZ";e.exports=function e(t,o,s){var a,l;switch(s=s||{},o){case"RFC3548":case"RFC4648":a=n,l=!0;break;case"RFC4648-HEX":a=r,l=!0;break;case"Crockford":a=i,l=!1;break;default:throw new Error("Unknown base32 variant: "+o)}for(var u=void 0!==s.padding?s.padding:l,c=t.byteLength,h=new Uint8Array(t),f=0,p=0,d="",m=0;m=5;)d+=a[p>>>f-5&31],f-=5;if(f>0&&(d+=a[p<<5-f&31]),u)for(;d.length%8!=0;)d+="=";return d}},function(e,t,n){ -/** - * Timestamp for 64-bit time_t, nanosecond precision and strftime - * - * @author Yusuke Kawasaki - * @license MIT - * @see https://github.com/kawanet/timestamp-nano - */ -var r=function(){e.exports=v;var t=86400,n=3200,r=146097*n/400,i=t*r,o=1e3*i,s=1e11*t,a=16777216,l=4294967296,u=1e6,c=1e9,h="000000000",f=Math.trunc||N,p=v.prototype;v.fromDate=C,v.fromInt64BE=O(0,1,2,3,0,4),v.fromInt64LE=O(3,2,1,0,4,0),v.fromString=x,v.fromTimeT=A,p.year=0,p.time=0,p.nano=0,p.addNano=E,p.getNano=S,p.getTimeT=I,p.getYear=b,p.toDate=w,p.toJSON=j,p.toString=R,p.writeInt64BE=B(0,1,2,3,0,4),p.writeInt64LE=B(3,2,1,0,4,0);var d="%Y-%m-%dT%H:%M:%S.%NZ",m=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],g=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],y={"%":"%",F:"%Y-%m-%d",n:"\n",R:"%H:%M",T:"%H:%M:%S",t:"\t",X:"%T",Z:"GMT",z:"+0000"};return v;function v(e,t,n){var r=this;if(!(r instanceof v))return new v(e,t,n);r.time=+e||0,r.nano=+t||0,r.year=+n||0,_(r)}function b(){var e=this.toDate().getUTCFullYear();return e+this.year}function _(e){var t=e.year,r=e.time,i=e.nano,a,l;if(i<0||u<=i){var c=Math.floor(i/u);i-=c*u,r+=c,a=1}var h=t%n;if(r<-s||s1?r[1]--:r[1]=0,n.time=t=Date.UTC.apply(Date,r)-(t||0),isNaN(t))throw new TypeError("Invalid Date");return _(n)}function C(e){return new v(+e)}function A(e){return T(e,0)}function T(e,t){t|=0,t*=l,e=+e||0;var r=f(t/i)+f(e/i),o=t%i+e%i,s=f(o/i);return s&&(r+=s,o-=s*i),new v(1e3*o,0,r*n)}function I(){var e=_(this),i=Math.floor(e.time/1e3),o=e.year;return o&&(i+=o*r*t/n),i}function j(){return this.toString().replace(/0{1,6}Z$/,"Z")}function R(e){var t=this,n=t.toDate(),r={H:u,L:f,M:c,N:p,S:h,Y:o,a:v,b:b,d:a,e:l,m:s};return i(e||d);function i(e){return e.replace(/%./g,function(e){var t=e[1],n=y[t],o=r[t];return n?i(n):o?o():e})}function o(){var e=t.getYear();return e>999999?"+"+e:e>9999?"+"+M(e,6):e>=0?M(e,4):e>=-999999?"-"+M(-e,6):e}function s(){return F(n.getUTCMonth()+1)}function a(){return F(n.getUTCDate())}function l(){return D(n.getUTCDate())}function u(){return F(n.getUTCHours())}function c(){return F(n.getUTCMinutes())}function h(){return F(n.getUTCSeconds())}function f(){return M(n.getUTCMilliseconds(),3)}function p(){return M(t.getNano(),9)}function v(){return g[n.getUTCDay()]}function b(){return m[n.getUTCMonth()]}}function B(e,i,o,s,a,u){return c;function c(e,i){var o=_(this);e||(e=new Array(8)),P(e,i|=0);var s=Math.floor(o.time/1e3),c=o.year*(r*t/n),p=f(c/l)+f(s/l),d=c%l+s%l,m=Math.floor(d/l);return m&&(p+=m,d-=m*l),h(e,i+a,p),h(e,i+u,d),e}function h(t,n,r){t[n+e]=r>>24&255,t[n+i]=r>>16&255,t[n+o]=r>>8&255,t[n+s]=255&r}}function O(e,t,n,r,i,o){return s;function s(e,t){P(e,t|=0);var n=l(e,t+i),r=l(e,t+o);return T(r,n)}function l(i,o){return i[o+e]*a+(i[o+t]<<16|i[o+n]<<8|i[o+r])}}function P(e,t){var n=e&&e.length;if(null==n)throw new TypeError("Invalid Buffer");if(n9?"":" ")+(0|e)}function F(e){return(e>9?"":"0")+(0|e)}function M(e,t){return(h+(0|e)).substr(-t)}}()},function(e,t,n){"use strict";const r=n(55),i='\nmessage IpnsEntry {\n enum ValidityType {\n\t\tEOL = 0; // setting an EOL says "this record is valid until..."\n\t}\n\n required bytes value = 1;\n\trequired bytes signature = 2;\n\n\toptional ValidityType validityType = 3;\n\toptional bytes validity = 4;\n\n\toptional uint64 sequence = 5;\n\n\toptional uint64 ttl = 6;\n\n\t// in order for nodes to properly validate a record upon receipt, they need the public\n\t// key associated with it. For old RSA keys, its easiest if we just send this as part of\n\t// the record itself. For newer ed25519 keys, the public key can be embedded in the\n\t// peerID, making this field unnecessary.\n\toptional bytes pubKey = 7;\n}\n';e.exports=r(i).IpnsEntry},function(e,t,n){"use strict";e.exports.toRFC3339=(e=>{const t=e.getUTCFullYear(),n=String(e.getUTCMonth()+1).padStart(2,"0"),r=String(e.getUTCDate()).padStart(2,"0"),i=String(e.getUTCHours()).padStart(2,"0"),o=String(e.getUTCMinutes()).padStart(2,"0"),s=String(e.getUTCSeconds()).padStart(2,"0"),a=e.getUTCMilliseconds(),l=1e3*a*1e3;return`${t}-${n}-${r}T${i}:${o}:${s}.${l}Z`}),e.exports.parseRFC3339=(e=>{const t=new RegExp("(\\d{4})-(\\d{2})-(\\d{2})T(\\d{2}):(\\d{2}):(\\d{2})\\.(\\d+)Z"),n=String(e).trim().match(t);if(!n)throw new Error("Invalid format");const r=parseInt(n[1],10),i=parseInt(n[2],10)-1,o=parseInt(n[3],10),s=parseInt(n[4],10),a=parseInt(n[5],10),l=parseInt(n[6],10),u=parseInt(n[7].slice(0,-6),10);return new Date(Date.UTC(r,i,o,s,a,l,u))})},function(e,t,n){"use strict";t.ERR_IPNS_EXPIRED_RECORD="ERR_IPNS_EXPIRED_RECORD",t.ERR_UNRECOGNIZED_VALIDITY="ERR_UNRECOGNIZED_VALIDITY",t.ERR_SIGNATURE_CREATION="ERR_SIGNATURE_CREATION",t.ERR_SIGNATURE_VERIFICATION="ERR_SIGNATURE_VERIFICATION",t.ERR_UNRECOGNIZED_FORMAT="ERR_UNRECOGNIZED_FORMAT",t.ERR_PEER_ID_FROM_PUBLIC_KEY="ERR_PEER_ID_FROM_PUBLIC_KEY",t.ERR_PUBLIC_KEY_FROM_ID="ERR_PUBLIC_KEY_FROM_ID",t.ERR_UNDEFINED_PARAMETER="ERR_UNDEFINED_PARAMETER"},function(e,t,n){"use strict";(function(r){const i=n(156),o=n(49),s=n(15),a=n(13),l=n(4),u=n(38),c=n(10),h=l("ipfs:ipns:republisher");h.error=l("ipfs:ipns:republisher:error");const f=6e4,p=60*f,d=4*p,m=24*p;class g{constructor(e,t,n,r,i){this._publisher=e,this._datastore=t,this._peerInfo=n,this._keychain=r,this._options=i,this._republishHandle=null}start(){if(this._republishHandle){const e="already running";throw h.error(e),a(new Error(e),"ERR_REPUBLISH_ALREADY_RUNNING")}const e={_onCancel:null,_timeoutId:null,runPeriodically:(t,n)=>{e._timeoutId=setTimeout(()=>{e._timeoutId=null,t(r=>{if(e._onCancel)return e._onCancel();e.runPeriodically(t,r||n)})},n)},cancel:t=>{if(e._timeoutId)return clearTimeout(e._timeoutId),t();e._onCancel=t}},{privKey:t}=this._peerInfo.id,{pass:n}=this._options;e.runPeriodically(e=>{this._republishEntries(t,n,()=>e(d))},f),this._republishHandle=e}stop(e){const t=this._republishHandle;if(!t){const t="not running";return h.error(t),e(a(new Error(t),"ERR_REPUBLISH_NOT_RUNNING"))}this._republishHandle=null,t.cancel(e)}_republishEntries(e,t,n){this._republishEntry(e,e=>{if(e){const e="cannot republish entry for the node's private key";h.error(e)}else t?this._keychain.listKeys((e,r)=>{e?h.error(e):u(r,(e,n)=>{c([n=>this._keychain.exportKey(e.name,t,n),(e,n)=>o.keys.import(e,t,n)],(e,t)=>{e?h.error(e):this._republishEntry(t,n)})},e=>{e&&h.error(e),n(null)})}):n(null)})}_republishEntry(e,t){if(!e||!e.bytes){const e="one or more of the provided parameters are not defined";return h.error(e),t(a(new Error(e),"ERR_UNDEFINED_PARAMETER"))}c([t=>s.createFromPrivKey(e.bytes,t),(e,t)=>this._getPreviousValue(e,t)],(n,r)=>{if(n)return t("ERR_NO_ENTRY_FOUND"===n.code?null:n);this._publisher.publishWithEOL(e,r,m,t)})}_getPreviousValue(e,t){if(!s.isPeerId(e)){const e="peerId received is not valid";return h.error(e),t(a(new Error(e),"ERR_INVALID_PEER_ID"))}this._datastore.get(i.getLocalKey(e.id),(n,o)=>{if(n&&n.notFound){const n=`no previous entry for record with id: ${e.id}`;return h.error(n),t(a(new Error(n),"ERR_NO_ENTRY_FOUND"))}if(n)return t(n);if(!r.isBuffer(o)){const e="found ipns record that we couldn't process";return h.error(e),t(a(new Error(e),"ERR_INVALID_IPNS_RECORD"))}let s;try{s=i.unmarshal(o)}catch(n){const e="found ipns record that we couldn't convert to a value";return h.error(e),t(a(new Error(e),"ERR_INVALID_IPNS_RECORD"))}t(null,s.value)})}}t=e.exports=g}).call(this,n(0).Buffer)},function(e,t,n){"use strict";const r=n(156),i=n(49),o=n(15),s=n(13),a=n(4),l=a("ipfs:ipns:resolver");l.error=a("ipfs:ipns:resolver:error");const u=32;class c{constructor(e){this._routing=e}resolve(e,t,n){if("function"==typeof t&&(n=t,t={}),"string"!=typeof e){const e="one or more of the provided parameters are not valid";return l.error(e),n(s(new Error(e),"ERR_INVALID_PARAMETER"))}t=t||{};const r=t.recursive&&"true"===t.recursive.toString(),i=e.split("/");if(3!==i.length||""!==i[0]){const t=`invalid name syntax for ${e}`;return l.error(t),n(s(new Error(t),"ERR_INVALID_NAME_SYNTAX"))}const o=i[2];let a;r&&(a=u),this.resolver(o,a,(t,r)=>{if(t)return n(t);l(`${e} was locally resolved correctly`),n(null,r)})}resolver(e,t,n){if(0===t){const e=`could not resolve name (recursion limit of ${u} exceeded)`;return l.error(e),n(s(new Error(e),"ERR_RESOLVE_RECURSION_LIMIT"))}this._resolveName(e,(e,r)=>{if(e)return n(e);const i=r.split("/");if("ipfs"===i[1]||!t)return n(null,r);this.resolver(i[2],t-1,n)})}_resolveName(e,t){let n;try{n=o.createFromB58String(e)}catch(e){return t(e)}const{routingKey:a,routingPubKey:u}=r.getIdKeys(n.toBytes());this._routing.get(a.toBuffer(),(o,c)=>{if(o){if("ERR_NOT_FOUND"!==o.code){const e=`unexpected error getting the ipns record ${n.id}`;return l.error(e),t(s(new Error(e),"ERR_UNEXPECTED_ERROR_GETTING_RECORD"))}const r=`record requested was not found for ${e} (${a}) in the network`;return l.error(r),t(s(new Error(r),"ERR_NO_RECORD_FOUND"))}let h;try{h=r.unmarshal(c)}catch(o){const e="found ipns record that we couldn't convert to a value";return l.error(e),t(s(new Error(e),"ERR_INVALID_RECORD_RECEIVED"))}if(h.pubKey)return this._validateRecord(n,h,t);this._routing.get(a.toBuffer(),(r,o)=>{if(r){if("ERR_NOT_FOUND"!==r.code){const e=`unexpected error getting the public key for the ipns record ${n.id}`;return l.error(e),t(s(new Error(e),"ERR_UNEXPECTED_ERROR_GETTING_PUB_KEY"))}const i=`public key requested was not found for ${e} (${u}) in the network`;return l.error(i),t(s(new Error(i),"ERR_NO_RECORD_FOUND"))}try{n.pubKey=i.keys.unmarshalPublicKey(o)}catch(r){const e="found public key record that we couldn't convert to a value";return l.error(e),t(s(new Error(e),"ERR_INVALID_PUB_KEY_RECEIVED"))}this._validateRecord(n,h,t)})})}_validateRecord(e,t,n){r.extractPublicKey(e,t,(e,i)=>{if(e)return n(e);r.validate(i,t,e=>{if(e)return n(e);n(null,t.value.toString())})})}}t=e.exports=c},function(e,t,n){"use strict";const{TieredDatastore:r}=n(405),i=n(200),o=n(432),s=n(433);e.exports=(e=>{const t=[];let n;if(i(e._options,"EXPERIMENTAL.ipnsPubsub",!1)){const r=e.libp2p.pubsub,i=e._repo.datastore,s=e._peerInfo.id;n=new o(r,i,s),t.push(n)}if(i(e._options,"offline")||!i(e._options,"libp2p.dht.enabled",!1)){const n=new s(e._repo);t.push(n)}else t.push(e.libp2p.dht);return new r(t)})},function(e,t,n){"use strict";(function(r){const{Key:i}=n(28),{encodeBase32:o,keyToTopic:s,topicToKey:a}=n(903),l=n(13),u=n(23),c=n(4),h=c("datastore-pubsub:publisher");h.error=c("datastore-pubsub:publisher:error");class f{constructor(e,t,n,r,i){u.strictEqual(typeof r,"object","missing validator"),u.strictEqual(typeof r.validate,"function","missing validate function"),u.strictEqual(typeof r.select,"function","missing select function"),i&&u.strictEqual(typeof i,"function","invalid subscriptionKeyFn received"),this._pubsub=e,this._datastore=t,this._peerId=n,this._validator=r,this._handleSubscriptionKeyFn=i,this._onMessage=this._onMessage.bind(this)}put(e,t,n){if(!r.isBuffer(e)){const e="datastore key does not have a valid format";return h.error(e),n(l(new Error(e),"ERR_INVALID_DATASTORE_KEY"))}if(!r.isBuffer(t)){const e="received value is not a buffer";return h.error(e),n(l(new Error(e),"ERR_INVALID_VALUE_RECEIVED"))}const i=s(e);h(`publish value for topic ${i}`),this._pubsub.publish(i,t,n)}get(e,t){if(!r.isBuffer(e)){const e="datastore key does not have a valid format";return h.error(e),t(l(new Error(e),"ERR_INVALID_DATASTORE_KEY"))}const n=s(e);this._pubsub.ls((r,i)=>r?t(r):i&&Array.isArray(i)&&i.indexOf(n)>-1?this._getLocal(e,t):void this._pubsub.subscribe(n,this._onMessage,r=>{if(r){const e=`cannot subscribe topic ${n}`;return h.error(e),t(l(new Error(e),"ERR_SUBSCRIBING_TOPIC"))}h(`subscribed values for key ${n}`),this._getLocal(e,t)}))}unsubscribe(e){const t=s(e);this._pubsub.unsubscribe(t,this._onMessage)}_getLocal(e,t){const n=new i("/"+o(e),!1);this._datastore.get(n,(e,i)=>{if(e){if("ERR_NOT_FOUND"!==e.code){const e=`unexpected error getting the ipns record for ${n.toString()}`;return h.error(e),t(l(new Error(e),"ERR_UNEXPECTED_ERROR_GETTING_RECORD"))}const r=`local record requested was not found for ${n.toString()}`;return h.error(r),t(l(new Error(r),"ERR_NOT_FOUND"))}if(!r.isBuffer(i)){const e="found record that we couldn't convert to a value";return h.error(e),t(l(new Error(e),"ERR_INVALID_RECORD_RECEIVED"))}t(null,i)})}_onMessage(e){const{data:t,from:n,topicIDs:r}=e;let i;try{i=a(r[0])}catch(e){return void h.error(e)}h(`message received for ${i} topic`),n!==this._peerId.toB58String()?this._handleSubscriptionKeyFn?this._handleSubscriptionKeyFn(i,(e,n)=>{e?h.error("message discarded by the subscriptionKeyFn"):this._storeIfSubscriptionIsBetter(n,t)}):this._storeIfSubscriptionIsBetter(i,t):h("message discarded as it is from the same peer")}_storeIfSubscriptionIsBetter(e,t){this._isBetter(e,t,(n,i)=>{!n&&i&&this._storeRecord(r.from(e),t)})}_validateRecord(e,t,n){this._validator.validate(e,t,n)}_selectRecord(e,t,n){this._validator.select(e,t,(e,t)=>{if(e)return h.error(e),n(e);n(null,0===t)})}_isBetter(e,t,n){this._validateRecord(t,e,(r,o)=>{if(r||!o){const e="record received through pubsub is not valid";return h.error(e),n(l(new Error(e),"ERR_NOT_VALID_RECORD"))}const s=new i(e);this._getLocal(s.toBuffer(),(e,r)=>e?n(null,!0):r.equals(t)?n(null,!1):void this._selectRecord(t,r,n))})}_storeRecord(e,t){const n=new i("/"+o(e),!1);this._datastore.put(n,t,t=>{t?h.error(`record for ${e.toString()} could not be stored in the routing`):h(`record for ${e.toString()} was stored in the datastore`)})}open(e){const t="open function was not implemented yet";return h.error(t),e(l(new Error(t),"ERR_NOT_IMPLEMENTED_YET"))}has(e,t){const n="has function was not implemented yet";return h.error(n),t(l(new Error(n),"ERR_NOT_IMPLEMENTED_YET"))}delete(e,t){const n="delete function was not implemented yet";return h.error(n),t(l(new Error(n),"ERR_NOT_IMPLEMENTED_YET"))}close(e){const t="close function was not implemented yet";return h.error(t),e(l(new Error(t),"ERR_NOT_IMPLEMENTED_YET"))}batch(){const e="batch function was not implemented yet";throw h.error(e),l(new Error(e),"ERR_NOT_IMPLEMENTED_YET")}query(){const e="query function was not implemented yet";throw h.error(e),l(new Error(e),"ERR_NOT_IMPLEMENTED_YET")}}t=e.exports=f}).call(this,n(0).Buffer)},function(e,t,n){"use strict";const r=n(60),i=n(13),o="/record/",s="u";e.exports.encodeBase32=(e=>r.encode("base32",e).slice(1)),e.exports.keyToTopic=(e=>{const t=r.encode("base64url",e).slice(1).toString();return`/record/${t}`}),e.exports.topicToKey=(e=>{if(e.substring(0,o.length)!==o)throw i(new Error("topic received is not from a record"),"ERR_TOPIC_IS_NOT_FROM_RECORD_NAMESPACE");const t=`u${e.substring(o.length)}`;return r.decode(t).toString()})},function(e,t,n){"use strict";(function(t){const r=n(55),i=n(23),o=r(n(905)).Record,s=n(906);class a{constructor(e,n,r){e&&i(t.isBuffer(e),"key must be a Buffer"),n&&i(t.isBuffer(n),"value must be a buffer"),this.key=e,this.value=n,this.timeReceived=r}serialize(){return o.encode(this.prepareSerialize())}prepareSerialize(){return{key:this.key,value:this.value,timeReceived:this.timeReceived&&s.toRFC3339(this.timeReceived)}}static deserialize(e){const t=o.decode(e);return a.fromDeserialized(t)}static fromDeserialized(e){let t;e.timeReceived&&(t=s.parseRFC3339(e.timeReceived));const n=new a(e.key,e.value,t);return n}}e.exports=a}).call(this,n(0).Buffer)},function(e,t,n){"use strict";e.exports="// Record represents a dht record that contains a value\n// for a key value pair\nmessage Record {\n // The key that references this record\n bytes key = 1;\n\n // The actual value this record is storing\n bytes value = 2;\n\n // Note: These fields were removed from the Record message\n // hash of the authors public key\n // optional bytes author = 3;\n // A PKI signature for the key+value+author\n // optional bytes signature = 4;\n\n // Time the record was received, set by receiver\n optional string timeReceived = 5;\n}"},function(e,t,n){"use strict";e.exports.toRFC3339=(e=>{const t=e.getUTCFullYear(),n=String(e.getUTCMonth()+1).padStart(2,"0"),r=String(e.getUTCDate()).padStart(2,"0"),i=String(e.getUTCHours()).padStart(2,"0"),o=String(e.getUTCMinutes()).padStart(2,"0"),s=String(e.getUTCSeconds()).padStart(2,"0"),a=e.getUTCMilliseconds(),l=1e3*a*1e3;return`${t}-${n}-${r}T${i}:${o}:${s}.${l}Z`}),e.exports.parseRFC3339=(e=>{const t=new RegExp("(\\d{4})-(\\d{2})-(\\d{2})T(\\d{2}):(\\d{2}):(\\d{2})\\.(\\d+)Z"),n=String(e).trim().match(t);if(!n)throw new Error("Invalid format");const r=parseInt(n[1],10),i=parseInt(n[2],10)-1,o=parseInt(n[3],10),s=parseInt(n[4],10),a=parseInt(n[5],10),l=parseInt(n[6],10),u=parseInt(n[7].slice(0,-6),10);return new Date(Date.UTC(r,i,o,s,a,l,u))})},function(e,t,n){"use strict";(function(t){const r=n(434),i=n(13),o=(e,n,o)=>{const s=n.key,a=r(s,t.from("/"));if(a.length<3)return o();const l=e[a[1].toString()];if(!l){const e="Invalid record keytype";return o(i(new Error(e),"ERR_INVALID_RECORD_KEY_TYPE"))}l.func(s,n.value,o)};e.exports={verifyRecord:o,validators:n(909)}}).call(this,n(0).Buffer)},function(e,t){e.exports=function e(t,n,r){r=r||0;for(var i=0,o=-1,s=r;s-1&&t.length-o{const s=e=>r(()=>o(e));if(!t.isBuffer(e))return s(new Error('"key" must be a Buffer'));if(e.length<3)return s(new Error("invalid public key record"));const a=e.slice(0,4).toString();if("/pk/"!==a)return s(new Error("key was not prefixed with /pk/"));const l=e.slice(4);i(n,"sha2-256",(e,t)=>e?s(e):l.equals(t)?void s():s(new Error("public key does not match passed in key")))};e.exports={func:o,sign:!1}}).call(this,n(0).Buffer)},function(e,t,n){"use strict";(function(t){const r=n(27),i=n(912);function o(e,t,n,i){if("function"==typeof n&&(i=n,n=void 0),!i)throw new Error("Missing callback");o.digest(e,t,n,(e,o)=>{if(e)return i(e);i(null,r.encode(o,t,n))})}e.exports=o,o.Buffer=t,o.multihash=r,o.digest=function(e,t,n,r){if("function"==typeof n&&(r=n,n=void 0),!r)throw new Error("Missing callback");let i=r,s;n&&(i=((e,t)=>{if(e)return r(e);r(null,t.slice(0,n))}));try{s=o.createHash(t)}catch(e){return i(e)}s(e,i)},o.createHash=function(e){if(e=r.coerceCode(e),!o.functions[e])throw new Error("multihash function "+e+" not yet supported");return o.functions[e]},o.functions={17:i.sha1,18:i.sha2256,19:i.sha2512,20:i.sha3512,21:i.sha3384,22:i.sha3256,23:i.sha3224,24:i.shake128,25:i.shake256,26:i.keccak224,27:i.keccak256,28:i.keccak384,29:i.keccak512,34:i.murmur3128,35:i.murmur332,86:i.dblSha2256},i.addBlake(o.functions),o.validate=((e,n,i)=>{let s=r.decode(n).name;o(e,s,(e,r)=>{if(e)return i(e);i(e,0===t.compare(n,r))})})}).call(this,n(0).Buffer)},function(e,t,n){"use strict";(function(t){const r=n(355),i=n(357),o=n(435),s=n(913),a=o.toCallback,l=o.toBuf,u=o.fromString,c=o.fromNumberTo32BitBuf,h=(e,n)=>{s.sha2256(e,(e,r)=>{e&&n(e),s.sha2256(t.from(r),n)})};e.exports={sha1:s.sha1,sha2256:s.sha2256,sha2512:s.sha2512,sha3512:a(l(r.sha3_512)),sha3384:a(l(r.sha3_384)),sha3256:a(l(r.sha3_256)),sha3224:a(l(r.sha3_224)),shake128:a(l(r.shake_128,128)),shake256:a(l(r.shake_256,256)),keccak224:a(l(r.keccak_224)),keccak256:a(l(r.keccak_256)),keccak384:a(l(r.keccak_384)),keccak512:a(l(r.keccak_512)),murmur3128:a(l(u(i.x64.hash128))),murmur332:a(c(u(i.x86.hash32))),addBlake:n(914),dblSha2256:h}}).call(this,n(0).Buffer)},function(e,t,n){"use strict";(function(t){const r=n(359),i=o();function o(){return self.crypto?self.crypto.subtle||self.crypto.webkitSubtle:self.msCrypto?self.msCrypto.subtle:void 0}function s(e){if(!i)throw new Error("Please use a browser with webcrypto support and ensure the code has been delivered securely via HTTPS/TLS and run within a Secure Context");return(n,o)=>{const s=i.digest({name:e},n);if("function"!=typeof s.then)return s.onerror=(()=>{o(new Error(`hashing data using ${e}`))}),void(s.oncomplete=(e=>{o(null,e.target.result)}));r(s.then(e=>t.from(new Uint8Array(e))),o)}}function a(e,t){s("SHA-1")(e,t)}function l(e,t){s("SHA-256")(e,t)}function u(e,t){s("SHA-512")(e,t)}e.exports={sha1:a,sha2256:l,sha2512:u}}).call(this,n(0).Buffer)},function(e,t,n){"use strict";(function(t){const r=n(361),i=n(435).toCallback,o=45569,s=45633,a={init:r.blake2bInit,update:r.blake2bUpdate,digest:r.blake2bFinal},l={init:r.blake2sInit,update:r.blake2sUpdate,digest:r.blake2sFinal},u=(e,n)=>i(r=>{const i=n.init(e,null);return n.update(i,r),t.from(n.digest(i))});e.exports=(e=>{for(let t=0;t<64;t++)e[o+t]=u(t+1,a);for(let t=0;t<32;t++)e[s+t]=u(t+1,l)})}).call(this,n(0).Buffer)},function(e,t,n){"use strict";(function(t){const r=n(434),i=n(13),o=(e,n,o)=>{if(0===o.length){const e="No records given";throw i(new Error(e),"ERR_NO_RECORDS_RECEIVED")}const s=r(n,t.from("/"));if(s.length<3){const e="Record key does not have a selector function";throw i(new Error(e),"ERR_NO_SELECTOR_FUNCTION_FOR_RECORD_KEY")}const a=e[s[1].toString()];if(!a){const e=`Unrecognized key prefix: ${s[1]}`;throw i(new Error(e),"ERR_UNRECOGNIZED_KEY_PREFIX")}return a(n,o)};e.exports={bestRecord:o,selectors:n(916)}}).call(this,n(0).Buffer)},function(e,t,n){"use strict";e.exports={pk:n(917)}},function(e,t,n){"use strict";const r=(e,t)=>0;e.exports=r},function(e,t,n){"use strict";const r=n(438),i=n(929),o=n(964),s=n(973),a=n(979),l=n(987),u=n(988),c=n(1020),h=n(89),f=n(21);class p extends c{constructor(e){const t=new i({id:e.peerInfo.id}),n=e.peerInfo.multiaddrs.toArray().map(String).filter(e=>e.includes("p2p-websocket-star"));e.peerInfo.multiaddrs.replace(n.map(f),"/p2p-websocket-star");const c=new o({servers:n,id:e.peerInfo.id,ignore_no_online:!n.length||e.wsStarIgnoreErrors}),p={switch:{blacklistTTL:12e4,blackListAttempts:5,maxParallelDials:100,maxColdCalls:25,dialTimeout:2e4},modules:{transport:[r,t,c],streamMuxer:[s],connEncryption:[a],peerDiscovery:[t.discovery,c.discovery,l],dht:u},config:{peerDiscovery:{autoDial:!0,bootstrap:{enabled:!0},webRTCStar:{enabled:!0},websocketStar:{enabled:!0}},dht:{enabled:!1},EXPERIMENTAL:{pubsub:!1}}};super(h(p,e))}}e.exports=p},function(e,t,n){"use strict";var r=n(920),i=n(922),o=n(926);function s(e){return"function"==typeof e}e.exports=function(e,t){s(t)&&(t={onConnect:t});var n="undefined"==typeof window?{}:window.location,a=o(e,n),l=new r(a),u=i(l,t);return u.remoteAddress=a,u.close=function(e){s(e)&&l.addEventListener("close",e),l.close()},l.addEventListener("open",function(e){t&&s(t.onConnect)&&t.onConnect(null,u)}),u},e.exports.connect=e.exports},function(e,t,n){e.exports="undefined"==typeof WebSocket?n(921):WebSocket},function(e,t){},function(e,t,n){var r=n(923),i=n(924);function o(e,t){var n=e.upgradeReq||{};return t&&t.binaryType?e.binaryType=t.binaryType:t&&t.binary&&(e.binaryType="arraybuffer"),{source:r(e,t&&t.onConnect),sink:i(e,t),headers:n.headers,url:n.url,upgrade:n.upgrade,method:n.method}}e.exports=o},function(e,t,n){var r=n(5).Buffer;function i(e){return e instanceof ArrayBuffer||null!=e&&null!=e.constructor&&"ArrayBuffer"===e.constructor.name&&"number"==typeof e.byteLength}e.exports=function(e,t){var n=[],o,s,a=!1;function l(t,r){if(o=null,s)return r(s);t?(o=r,e.close()):n.length>0?r(null,n.shift()):o=r}return e.addEventListener("message",function(e){var t=e.data;if(i(t)&&(t=r.from(t)),o)return o(null,t);n.push(t)}),e.addEventListener("close",function(e){s||o&&o(s=!0)}),e.addEventListener("error",function(e){s||(s=e,a||(a=!0,t&&t(e)),o&&o(s))}),e.addEventListener("open",function(e){a||s||(a=!0)}),l}},function(e,t,n){(function(t){var r=n(925),i="undefined"!=typeof setImmediate?setImmediate:t.nextTick;e.exports=function(e,t){return function(n){t=t||{};var o=!1!==t.closeOnEnd,s="function"==typeof t?t:t.onClose;function a(t,l){t?o&&e.readyState<=1&&(s&&e.addEventListener("close",function(e){if(e.wasClean||1006===e.code)s();else{var t=new Error("ws error");t.event=e,s(t)}}),e.close()):r(e,function(t){if(t)return n(t,function(){});e.send(l),i(function(){n(null,a)})})}n(null,a)}}}).call(this,n(2))},function(e,t){e.exports=function(e,t){var n=e&&(e.removeEventListener||e.removeListener);function r(){"function"==typeof n&&(n.call(e,"open",i),n.call(e,"error",o))}function i(e){r(),t()}function o(e){r(),t(e)}return e.readyState>=2?t(!0):1===e.readyState?t():(e.addEventListener("open",i),void e.addEventListener("error",o))}},function(e,t,n){var{relative:r}=n(189),i={http:"ws",https:"wss"},o="ws";e.exports=function(e,t){return r(e,t,i,o)}},function(e,t,n){"use strict";const r=n(347);e.exports=class e{constructor(e,t){this.peerInfo=null,this.conn=r(),e?this.setInnerConn(e,t):t&&(this.info=t)}get source(){return this.conn.source}get sink(){return this.conn.sink}getPeerInfo(e){return this.info&&this.info.getPeerInfo?this.info.getPeerInfo(e):this.peerInfo?void e(null,this.peerInfo):e(new Error("Peer Info not set yet"))}setPeerInfo(e){if(this.info&&this.info.setPeerInfo)return this.info.setPeerInfo(e);this.peerInfo=e}getObservedAddrs(e){if(this.info&&this.info.getObservedAddrs)return this.info.getObservedAddrs(e);e(null,[])}setInnerConn(e,t){this.conn.resolve(e),this.info=t||e}}},function(e,t,n){"use strict";e.exports=function(){throw new Error("WebSocket Servers can not be created in the browser!")}},function(e,t,n){"use strict";const r=n(4),i=r("libp2p:webrtc-star"),o=n(21),s=n(72),a=n(39),l=n(440),u=n(6).EventEmitter,c=n(955),h=n(15),f=n(31),p=n(64).Connection,d=n(69),m=n(26),g=n(19),y=n(962),v=n(963),b=v.cleanUrlSIO,_=v.cleanMultiaddr,w=m(()=>{}),k={transports:["websocket"],"force new connection":!0};class E{constructor(e){e=e||{},this.maSelf=void 0,this.sioOptions={transports:["websocket"],"force new connection":!0},e.wrtc&&(this.wrtc=e.wrtc),this.discovery=new u,this.discovery.tag="webRTCStar",this.discovery.start=(e=>{g(e)}),this.discovery.stop=(e=>{g(e)}),this.listenersRefs={},this._peerDiscovered=this._peerDiscovered.bind(this)}dial(e,t,n){"function"==typeof t&&(n=t,t={}),n=n?m(n):w;const r=(~~(1e9*Math.random())).toString(36)+Date.now(),o=this.listenersRefs[Object.keys(this.listenersRefs)[0]].io,s={initiator:!0,trickle:!1};let a;this.wrtc&&(s.wrtc=this.wrtc);try{a=new c(s)}catch(e){return i("Could not create connection:",e),n(e)}const l=new p(d.duplex(a));let u=!1;return a.on("signal",t=>{o.emit("ss-handshake",{intentId:r,srcMultiaddr:this.maSelf.toString(),dstMultiaddr:e.toString(),signal:t})}),a.once("timeout",()=>n(new Error("timeout"))),a.once("error",e=>{u||n(e)}),o.on("ws-handshake",t=>{if(t.intentId===r&&t.err)return n(new Error(t.err));t.intentId===r&&t.answer&&(a.once("connect",()=>{u=!0,l.destroy=a.destroy.bind(a),a.once("close",()=>l.destroy()),l.getObservedAddrs=(t=>t(null,[e])),n(null,l)}),a.signal(t.signal))}),l}createListener(e,t){"function"==typeof e&&(t=e,e={});const n=new u;return n.listen=((e,r)=>{if(r=r?m(r):w,!y.support&&!this.wrtc)return g(()=>r(new Error("no WebRTC support")));this.maSelf=e;const o=b(e);i("Dialing to Signalling Server on: "+o),n.io=l.connect(o,k),n.io.once("connect_error",r),n.io.once("error",e=>{n.emit("error",e),n.emit("close")}),n.io.on("ws-handshake",a),n.io.on("ws-peer",this._peerDiscovered),n.io.on("connect",()=>{n.io.emit("ss-join",e.toString())}),n.io.once("connect",()=>{n.emit("listening"),r()});const s=this;function a(e){if(e.answer||e.err)return;const o={trickle:!1};let a;s.wrtc&&(o.wrtc=s.wrtc);try{a=new c(o)}catch(e){return i("Could not create incoming connection:",e),r(e)}const l=new p(d.duplex(a));a.once("connect",()=>{l.getObservedAddrs=(t=>t(null,[e.srcMultiaddr])),n.emit("connection",l),t(l)}),a.once("signal",t=>{e.signal=t,e.answer=!0,n.io.emit("ss-handshake",e)}),a.signal(e.signal)}}),n.close=(e=>{e=e?m(e):w,n.io.emit("ss-leave"),g(()=>{n.emit("close"),e()})}),n.getAddrs=(e=>{g(()=>e(null,[this.maSelf]))}),this.listenersRefs[o.toString()]=n,n}filter(e){return Array.isArray(e)||(e=[e]),e.filter(e=>!(e.protoNames().indexOf("p2p-circuit")>-1)&&s.WebRTCStar.matches(e))}_peerDiscovered(e){i("Peer Discovered:",e),e=_(e);const t=e.split("/ipfs/"),n=t[t.length-1],r=h.createFromB58String(n),s=new f(r);s.multiaddrs.add(o(e)),this.discovery.emit("peer",s)}}e.exports=a(E,{className:"WebRTCStar",symbolName:"@libp2p/js-libp2p-webrtc-star/webrtcstar"})},function(e,t,n){var r=n(441),i=n(206)("socket.io-client:url");function o(e,t){var n=e;t=t||"undefined"!=typeof location&&location,null==e&&(e=t.protocol+"//"+t.host),"string"==typeof e&&("/"===e.charAt(0)&&(e="/"===e.charAt(1)?t.protocol+e:t.host+e),/^(https?|wss?):\/\//.test(e)||(i("protocol-less url %s",e),e=void 0!==t?t.protocol+"//"+e:"https://"+e),i("parse %s",e),n=r(e)),n.port||(/^(http|ws)$/.test(n.protocol)?n.port="80":/^(http|ws)s$/.test(n.protocol)&&(n.port="443")),n.path=n.path||"/";var o=-1!==n.host.indexOf(":"),s=o?"["+n.host+"]":n.host;return n.id=n.protocol+"://"+s+":"+n.port,n.href=n.protocol+"://"+s+(t&&t.port===n.port?"":":"+n.port),n}e.exports=o},function(e,t,n){function r(e){var n=0,r;for(r in e)n=(n<<5)-n+e.charCodeAt(r),n|=0;return t.colors[Math.abs(n)%t.colors.length]}function i(e){var n;function i(){if(i.enabled){var e=i,r=+new Date,o=r-(n||r);e.diff=o,e.prev=n,e.curr=r,n=r;for(var s=new Array(arguments.length),a=0;a100)){var t=/^((?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|years?|yrs?|y)?$/i.exec(e);if(t){var a=parseFloat(t[1]),l=(t[2]||"ms").toLowerCase();switch(l){case"years":case"year":case"yrs":case"yr":case"y":return a*s;case"days":case"day":case"d":return a*o;case"hours":case"hour":case"hrs":case"hr":case"h":return a*i;case"minutes":case"minute":case"mins":case"min":case"m":return a*r;case"seconds":case"second":case"secs":case"sec":case"s":return a*n;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return a;default:return}}}}function l(e){return e>=o?Math.round(e/o)+"d":e>=i?Math.round(e/i)+"h":e>=r?Math.round(e/r)+"m":e>=n?Math.round(e/n)+"s":e+"ms"}function u(e){return c(e,o,"day")||c(e,i,"hour")||c(e,r,"minute")||c(e,n,"second")||e+" ms"}function c(e,t,n){if(!(e0)return a(e);if("number"===n&&!1===isNaN(e))return t.long?u(e):l(e);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))}},function(e,t,n){(function(r){function i(){return!("undefined"==typeof window||!window.process||"renderer"!==window.process.type)||("undefined"==typeof navigator||!navigator.userAgent||!navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))&&("undefined"!=typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"undefined"!=typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/))}function o(e){var n=this.useColors;if(e[0]=(n?"%c":"")+this.namespace+(n?" %c":" ")+e[0]+(n?"%c ":" ")+"+"+t.humanize(this.diff),n){var r="color: "+this.color;e.splice(1,0,r,"color: inherit");var i=0,o=0;e[0].replace(/%[a-zA-Z%]/g,function(e){"%%"!==e&&(i++,"%c"===e&&(o=i))}),e.splice(o,0,r)}}function s(){return"object"==typeof console&&console.log&&Function.prototype.apply.call(console.log,console,arguments)}function a(e){try{null==e?t.storage.removeItem("debug"):t.storage.debug=e}catch(e){}}function l(){var e;try{e=t.storage.debug}catch(e){}return!e&&void 0!==r&&"env"in r&&(e=r.env.DEBUG),e}function u(){try{return window.localStorage}catch(e){}}t=e.exports=n(934),t.log=s,t.formatArgs=o,t.save=a,t.load=l,t.useColors=i,t.storage="undefined"!=typeof chrome&&void 0!==chrome.storage?chrome.storage.local:u(),t.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],t.formatters.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}},t.enable(l())}).call(this,n(2))},function(e,t,n){function r(e){var n=0,r;for(r in e)n=(n<<5)-n+e.charCodeAt(r),n|=0;return t.colors[Math.abs(n)%t.colors.length]}function i(e){var n;function i(){if(i.enabled){var e=i,r=+new Date,o=r-(n||r);e.diff=o,e.prev=n,e.curr=r,n=r;for(var s=new Array(arguments.length),a=0;a100)){var t=/^((?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|years?|yrs?|y)?$/i.exec(e);if(t){var a=parseFloat(t[1]),l=(t[2]||"ms").toLowerCase();switch(l){case"years":case"year":case"yrs":case"yr":case"y":return a*s;case"days":case"day":case"d":return a*o;case"hours":case"hour":case"hrs":case"hr":case"h":return a*i;case"minutes":case"minute":case"mins":case"min":case"m":return a*r;case"seconds":case"second":case"secs":case"sec":case"s":return a*n;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return a;default:return}}}}function l(e){return e>=o?Math.round(e/o)+"d":e>=i?Math.round(e/i)+"h":e>=r?Math.round(e/r)+"m":e>=n?Math.round(e/n)+"s":e+"ms"}function u(e){return c(e,o,"day")||c(e,i,"hour")||c(e,r,"minute")||c(e,n,"second")||e+" ms"}function c(e,t,n){if(!(e0)return a(e);if("number"===n&&!1===isNaN(e))return t.long?u(e):l(e);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))}},function(e,t,n){var r=n(442),i=n(443),o=Object.prototype.toString,s="function"==typeof Blob||"undefined"!=typeof Blob&&"[object BlobConstructor]"===o.call(Blob),a="function"==typeof File||"undefined"!=typeof File&&"[object FileConstructor]"===o.call(File);function l(e,t){if(!e)return e;if(i(e)){var n={_placeholder:!0,num:t.length};return t.push(e),n}if(r(e)){for(var o=new Array(e.length),s=0;s0&&(this.extraHeaders=t.extraHeaders),t.localAddress&&(this.localAddress=t.localAddress)),this.id=null,this.upgrades=null,this.pingInterval=null,this.pingTimeout=null,this.pingIntervalTimer=null,this.pingTimeoutTimer=null,this.open()}function h(e){var t={};for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);return t}e.exports=c,c.priorWebsocketSuccess=!1,i(c.prototype),c.protocol=a.protocol,c.Socket=c,c.Transport=n(266),c.transports=n(445),c.parser=n(125),c.prototype.createTransport=function(e){o('creating transport "%s"',e);var t=h(this.query);t.EIO=a.protocol,t.transport=e;var n=this.transportOptions[e]||{};this.id&&(t.sid=this.id);var i=new r[e]({query:t,socket:this,agent:n.agent||this.agent,hostname:n.hostname||this.hostname,port:n.port||this.port,secure:n.secure||this.secure,path:n.path||this.path,forceJSONP:n.forceJSONP||this.forceJSONP,jsonp:n.jsonp||this.jsonp,forceBase64:n.forceBase64||this.forceBase64,enablesXDR:n.enablesXDR||this.enablesXDR,timestampRequests:n.timestampRequests||this.timestampRequests,timestampParam:n.timestampParam||this.timestampParam,policyPort:n.policyPort||this.policyPort,pfx:n.pfx||this.pfx,key:n.key||this.key,passphrase:n.passphrase||this.passphrase,cert:n.cert||this.cert,ca:n.ca||this.ca,ciphers:n.ciphers||this.ciphers,rejectUnauthorized:n.rejectUnauthorized||this.rejectUnauthorized,perMessageDeflate:n.perMessageDeflate||this.perMessageDeflate,extraHeaders:n.extraHeaders||this.extraHeaders,forceNode:n.forceNode||this.forceNode,localAddress:n.localAddress||this.localAddress,requestTimeout:n.requestTimeout||this.requestTimeout,protocols:n.protocols||void 0,isReactNative:this.isReactNative});return i},c.prototype.open=function(){var e;if(this.rememberUpgrade&&c.priorWebsocketSuccess&&-1!==this.transports.indexOf("websocket"))e="websocket";else{if(0===this.transports.length){var t=this;return void setTimeout(function(){t.emit("error","No transports available")},0)}e=this.transports[0]}this.readyState="opening";try{e=this.createTransport(e)}catch(e){return this.transports.shift(),void this.open()}e.open(),this.setTransport(e)},c.prototype.setTransport=function(e){o("setting transport %s",e.name);var t=this;this.transport&&(o("clearing existing transport %s",this.transport.name),this.transport.removeAllListeners()),this.transport=e,e.on("drain",function(){t.onDrain()}).on("packet",function(e){t.onPacket(e)}).on("error",function(e){t.onError(e)}).on("close",function(){t.onClose("transport close")})},c.prototype.probe=function(e){o('probing transport "%s"',e);var t=this.createTransport(e,{probe:1}),n=!1,r=this;function i(){if(r.onlyBinaryUpgrades){var i=!this.supportsBinary&&r.transport.supportsBinary;n=n||i}n||(o('probe transport "%s" opened',e),t.send([{type:"ping",data:"probe"}]),t.once("packet",function(i){if(!n)if("pong"===i.type&&"probe"===i.data){if(o('probe transport "%s" pong',e),r.upgrading=!0,r.emit("upgrading",t),!t)return;c.priorWebsocketSuccess="websocket"===t.name,o('pausing current transport "%s"',r.transport.name),r.transport.pause(function(){n||"closed"!==r.readyState&&(o("changing transport and sending upgrade packet"),f(),r.setTransport(t),t.send([{type:"upgrade"}]),r.emit("upgrade",t),t=null,r.upgrading=!1,r.flush())})}else{o('probe transport "%s" failed',e);var s=new Error("probe error");s.transport=t.name,r.emit("upgradeError",s)}}))}function s(){n||(n=!0,f(),t.close(),t=null)}function a(n){var i=new Error("probe error: "+n);i.transport=t.name,s(),o('probe transport "%s" failed because of error: %s',e,n),r.emit("upgradeError",i)}function l(){a("transport closed")}function u(){a("socket closed")}function h(e){t&&e.name!==t.name&&(o('"%s" works - aborting "%s"',e.name,t.name),s())}function f(){t.removeListener("open",i),t.removeListener("error",a),t.removeListener("close",l),r.removeListener("close",u),r.removeListener("upgrading",h)}c.priorWebsocketSuccess=!1,t.once("open",i),t.once("error",a),t.once("close",l),this.once("close",u),this.once("upgrading",h),t.open()},c.prototype.onOpen=function(){if(o("socket open"),this.readyState="open",c.priorWebsocketSuccess="websocket"===this.transport.name,this.emit("open"),this.flush(),"open"===this.readyState&&this.upgrade&&this.transport.pause){o("starting upgrade probes");for(var e=0,t=this.upgrades.length;er&&(n=r),t>=r||t>=n||0===r)return new ArrayBuffer(0);for(var i=new Uint8Array(e),o=new Uint8Array(n-t),s=t,a=0;s=55296&&i<=56319&&n65535&&(i-=65536,o+=n(i>>>10&1023|55296),i=56320|1023&i),o+=n(i);return o}function l(e,t){if(e>=55296&&e<=57343){if(t)throw Error("Lone surrogate U+"+e.toString(16).toUpperCase()+" is not a scalar value");return!1}return!0}function u(e,t){return n(e>>t&63|128)}function c(e,t){if(0==(4294967168&e))return n(e);var r="";return 0==(4294965248&e)?r=n(e>>6&31|192):0==(4294901760&e)?(l(e,t)||(e=65533),r=n(e>>12&15|224),r+=u(e,6)):0==(4292870144&e)&&(r=n(e>>18&7|240),r+=u(e,12),r+=u(e,6)),r+=n(63&e|128),r}function h(e,t){t=t||{};for(var n=!1!==t.strict,r=s(e),i=r.length,o=-1,a,l="";++o=i)throw Error("Invalid byte index");var e=255&r[o];if(o++,128==(192&e))return 63&e;throw Error("Invalid continuation byte")}function p(e){var t,n,s,a,u;if(o>i)throw Error("Invalid byte index");if(o==i)return!1;if(t=255&r[o],o++,0==(128&t))return t;if(192==(224&t)){if(n=f(),u=(31&t)<<6|n,u>=128)return u;throw Error("Invalid continuation byte")}if(224==(240&t)){if(n=f(),s=f(),u=(15&t)<<12|n<<6|s,u>=2048)return l(u,e)?u:65533;throw Error("Invalid continuation byte")}if(240==(248&t)&&(n=f(),s=f(),a=f(),u=(7&t)<<18|n<<12|s<<6|a,u>=65536&&u<=1114111))return u;throw Error("Invalid UTF-8 detected")}function d(e,t){t=t||{};var n=!1!==t.strict;r=s(e),i=r.length,o=0;for(var l=[],u;!1!==(u=p(n));)l.push(u);return a(l)}e.exports={version:"2.1.2",encode:h,decode:d}},function(e,t){!function(){"use strict";for(var e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",n=new Uint8Array(256),r=0;r>2],o+=e[(3&n[r])<<4|n[r+1]>>4],o+=e[(15&n[r+1])<<2|n[r+2]>>6],o+=e[63&n[r+2]];return i%3==2?o=o.substring(0,o.length-1)+"=":i%3==1&&(o=o.substring(0,o.length-2)+"=="),o},t.decode=function(e){var t=.75*e.length,r=e.length,i,o=0,s,a,l,u;"="===e[e.length-1]&&(t--,"="===e[e.length-2]&&t--);var c=new ArrayBuffer(t),h=new Uint8Array(c);for(i=0;i>4,h[o++]=(15&a)<<4|l>>2,h[o++]=(3&l)<<6|63&u;return c}}()},function(e,t){var n=void 0!==n?n:"undefined"!=typeof WebKitBlobBuilder?WebKitBlobBuilder:"undefined"!=typeof MSBlobBuilder?MSBlobBuilder:"undefined"!=typeof MozBlobBuilder&&MozBlobBuilder,r=function(){try{var e=new Blob(["hi"]);return 2===e.size}catch(e){return!1}}(),i=r&&function(){try{var e=new Blob([new Uint8Array([1,2])]);return 2===e.size}catch(e){return!1}}(),o=n&&n.prototype.append&&n.prototype.getBlob;function s(e){return e.map(function(e){if(e.buffer instanceof ArrayBuffer){var t=e.buffer;if(e.byteLength!==t.byteLength){var n=new Uint8Array(e.byteLength);n.set(new Uint8Array(t,e.byteOffset,e.byteLength)),t=n.buffer}return t}return e})}function a(e,t){t=t||{};var r=new n;return s(e).forEach(function(e){r.append(e)}),t.type?r.getBlob(t.type):r.getBlob()}function l(e,t){return new Blob(s(e),t||{})}"undefined"!=typeof Blob&&(a.prototype=Blob.prototype,l.prototype=Blob.prototype),e.exports=r?i?Blob:l:o?a:void 0},function(e,t,n){function r(e){var n=0,r;for(r in e)n=(n<<5)-n+e.charCodeAt(r),n|=0;return t.colors[Math.abs(n)%t.colors.length]}function i(e){var n;function i(){if(i.enabled){var e=i,r=+new Date,o=r-(n||r);e.diff=o,e.prev=n,e.curr=r,n=r;for(var s=new Array(arguments.length),a=0;a100)){var t=/^((?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|years?|yrs?|y)?$/i.exec(e);if(t){var a=parseFloat(t[1]),l=(t[2]||"ms").toLowerCase();switch(l){case"years":case"year":case"yrs":case"yr":case"y":return a*s;case"days":case"day":case"d":return a*o;case"hours":case"hour":case"hrs":case"hr":case"h":return a*i;case"minutes":case"minute":case"mins":case"min":case"m":return a*r;case"seconds":case"second":case"secs":case"sec":case"s":return a*n;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return a;default:return}}}}function l(e){return e>=o?Math.round(e/o)+"d":e>=i?Math.round(e/i)+"h":e>=r?Math.round(e/r)+"m":e>=n?Math.round(e/n)+"s":e+"ms"}function u(e){return c(e,o,"day")||c(e,i,"hour")||c(e,r,"minute")||c(e,n,"second")||e+" ms"}function c(e,t,n){if(!(e0)return a(e);if("number"===n&&!1===isNaN(e))return t.long?u(e):l(e);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))}},function(e,t,n){(function(t){var r=n(446),i=n(208);e.exports=c;var o=/\n/g,s=/\\n/g,a;function l(){}function u(){return"undefined"!=typeof self?self:"undefined"!=typeof window?window:void 0!==t?t:{}}function c(e){if(r.call(this,e),this.query=this.query||{},!a){var t=u();a=t.___eio=t.___eio||[]}this.index=a.length;var n=this;a.push(function(e){n.onData(e)}),this.query.j=this.index,"function"==typeof addEventListener&&addEventListener("beforeunload",function(){n.script&&(n.script.onerror=l)},!1)}i(c,r),c.prototype.supportsBinary=!1,c.prototype.doClose=function(){this.script&&(this.script.parentNode.removeChild(this.script),this.script=null),this.form&&(this.form.parentNode.removeChild(this.form),this.form=null,this.iframe=null),r.prototype.doClose.call(this)},c.prototype.doPoll=function(){var e=this,t=document.createElement("script");this.script&&(this.script.parentNode.removeChild(this.script),this.script=null),t.async=!0,t.src=this.uri(),t.onerror=function(t){e.onError("jsonp poll error",t)};var n=document.getElementsByTagName("script")[0];n?n.parentNode.insertBefore(t,n):(document.head||document.body).appendChild(t),this.script=t;var r="undefined"!=typeof navigator&&/gecko/i.test(navigator.userAgent);r&&setTimeout(function(){var e=document.createElement("iframe");document.body.appendChild(e),document.body.removeChild(e)},100)},c.prototype.doWrite=function(e,t){var n=this;if(!this.form){var r=document.createElement("form"),i=document.createElement("textarea"),a=this.iframeId="eio_iframe_"+this.index,l;r.className="socketio",r.style.position="absolute",r.style.top="-1000px",r.style.left="-1000px",r.target=a,r.method="POST",r.setAttribute("accept-charset","utf-8"),i.name="d",r.appendChild(i),document.body.appendChild(r),this.form=r,this.area=i}function u(){c(),t()}function c(){if(n.iframe)try{n.form.removeChild(n.iframe)}catch(e){n.onError("jsonp polling iframe removal error",e)}try{var e='