Socket
Socket
Sign inDemoInstall

interface-datastore

Package Overview
Dependencies
Maintainers
3
Versions
68
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

interface-datastore - npm Package Compare versions

Comparing version 0.6.0 to 0.7.0

docs/index.html

10

CHANGELOG.md

@@ -0,1 +1,11 @@

<a name="0.7.0"></a>
# [0.7.0](https://github.com/ipfs/interface-datastore/compare/v0.6.0...v0.7.0) (2019-05-01)
### Features
* refactor to async iterators ([#25](https://github.com/ipfs/interface-datastore/issues/25)) ([ab2f2b9](https://github.com/ipfs/interface-datastore/commit/ab2f2b9))
<a name="0.6.0"></a>

@@ -2,0 +12,0 @@ # [0.6.0](https://github.com/ipfs/interface-datastore/compare/v0.5.0...v0.6.0) (2018-10-24)

2

dist/index.min.js

@@ -1,2 +0,2 @@

var InterfaceDatastore=function(t){var e={};function n(r){if(e[r])return e[r].exports;var o=e[r]={i:r,l:!1,exports:{}};return t[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)n.d(r,o,function(e){return t[e]}.bind(null,o));return r},n.n=function(t){var e=t&&t.__esModule?function e(){return t.default}:function e(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=0)}({"./node_modules/async/internal/setImmediate.js":function(t,e,n){"use strict";(function(t,r){Object.defineProperty(e,"__esModule",{value:!0}),e.hasNextTick=e.hasSetImmediate=void 0,e.fallback=f,e.wrap=c;var o,i=s(n("./node_modules/async/internal/slice.js"));function s(t){return t&&t.__esModule?t:{default:t}}var u=e.hasSetImmediate="function"==typeof t&&t,l=e.hasNextTick="object"==typeof r&&"function"==typeof r.nextTick,a;function f(t){setTimeout(t,0)}function c(t){return function(e){var n=(0,i.default)(arguments,1);t(function(){e.apply(null,n)})}}a=u?t:l?r.nextTick:f,e.default=c(a)}).call(this,n("./node_modules/timers-browserify/main.js").setImmediate,n("./node_modules/process/browser.js"))},"./node_modules/async/internal/slice.js":function(t,e,n){"use strict";function r(t,e){e|=0;for(var n=Math.max(t.length-e,0),r=Array(n),o=0;o<n;o++)r[o]=t[e+o];return r}Object.defineProperty(e,"__esModule",{value:!0}),e.default=r,t.exports=e.default},"./node_modules/async/setImmediate.js":function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r,o=i(n("./node_modules/async/internal/setImmediate.js"));function i(t){return t&&t.__esModule?t:{default:t}}e.default=o.default,t.exports=e.default},"./node_modules/base64-js/index.js":function(t,e,n){"use strict";e.byteLength=f,e.toByteArray=h,e.fromByteArray=m;for(var r=[],o=[],i="undefined"!=typeof Uint8Array?Uint8Array:Array,s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",u=0,l=s.length;u<l;++u)r[u]=s[u],o[s.charCodeAt(u)]=u;function a(t){var e=t.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var n=t.indexOf("="),r;return-1===n&&(n=e),[n,n===e?0:4-n%4]}function f(t){var e=a(t),n=e[0],r=e[1];return 3*(n+r)/4-r}function c(t,e,n){return 3*(e+n)/4-n}function h(t){for(var e,n=a(t),r=n[0],s=n[1],u=new i(c(t,r,s)),l=0,f=s>0?r-4:r,h=0;h<f;h+=4)e=o[t.charCodeAt(h)]<<18|o[t.charCodeAt(h+1)]<<12|o[t.charCodeAt(h+2)]<<6|o[t.charCodeAt(h+3)],u[l++]=e>>16&255,u[l++]=e>>8&255,u[l++]=255&e;return 2===s&&(e=o[t.charCodeAt(h)]<<2|o[t.charCodeAt(h+1)]>>4,u[l++]=255&e),1===s&&(e=o[t.charCodeAt(h)]<<10|o[t.charCodeAt(h+1)]<<4|o[t.charCodeAt(h+2)]>>2,u[l++]=e>>8&255,u[l++]=255&e),u}function d(t){return r[t>>18&63]+r[t>>12&63]+r[t>>6&63]+r[63&t]}function p(t,e,n){for(var r,o=[],i=e;i<n;i+=3)r=(t[i]<<16&16711680)+(t[i+1]<<8&65280)+(255&t[i+2]),o.push(d(r));return o.join("")}function m(t){for(var e,n=t.length,o=n%3,i=[],s=16383,u=0,l=n-o;u<l;u+=16383)i.push(p(t,u,u+16383>l?l:u+16383));return 1===o?(e=t[n-1],i.push(r[e>>2]+r[e<<4&63]+"==")):2===o&&(e=(t[n-2]<<8)+t[n-1],i.push(r[e>>10]+r[e>>4&63]+r[e<<2&63]+"=")),i.join("")}o["-".charCodeAt(0)]=62,o["_".charCodeAt(0)]=63},"./node_modules/buffer/index.js":function(t,e,n){"use strict";(function(t){var r=n("./node_modules/base64-js/index.js"),o=n("./node_modules/ieee754/index.js"),i=n("./node_modules/isarray/index.js");function s(){try{var t=new Uint8Array(1);return t.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===t.foo()&&"function"==typeof t.subarray&&0===t.subarray(1,1).byteLength}catch(t){return!1}}function u(){return a.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function l(t,e){if(u()<e)throw new RangeError("Invalid typed array length");return a.TYPED_ARRAY_SUPPORT?(t=new Uint8Array(e)).__proto__=a.prototype:(null===t&&(t=new a(e)),t.length=e),t}function a(t,e,n){if(!(a.TYPED_ARRAY_SUPPORT||this instanceof a))return new a(t,e,n);if("number"==typeof t){if("string"==typeof e)throw new Error("If encoding is specified then the first argument must be a string");return d(this,t)}return f(this,t,e,n)}function f(t,e,n,r){if("number"==typeof e)throw new TypeError('"value" argument must not be a number');return"undefined"!=typeof ArrayBuffer&&e instanceof ArrayBuffer?g(t,e,n,r):"string"==typeof e?p(t,e,n):y(t,e)}function c(t){if("number"!=typeof t)throw new TypeError('"size" argument must be a number');if(t<0)throw new RangeError('"size" argument must not be negative')}function h(t,e,n,r){return c(e),e<=0?l(t,e):void 0!==n?"string"==typeof r?l(t,e).fill(n,r):l(t,e).fill(n):l(t,e)}function d(t,e){if(c(e),t=l(t,e<0?0:0|v(e)),!a.TYPED_ARRAY_SUPPORT)for(var n=0;n<e;++n)t[n]=0;return t}function p(t,e,n){if("string"==typeof n&&""!==n||(n="utf8"),!a.isEncoding(n))throw new TypeError('"encoding" must be a valid string encoding');var r=0|b(e,n),o=(t=l(t,r)).write(e,n);return o!==r&&(t=t.slice(0,o)),t}function m(t,e){var n=e.length<0?0:0|v(e.length);t=l(t,n);for(var r=0;r<n;r+=1)t[r]=255&e[r];return t}function g(t,e,n,r){if(e.byteLength,n<0||e.byteLength<n)throw new RangeError("'offset' is out of bounds");if(e.byteLength<n+(r||0))throw new RangeError("'length' is out of bounds");return e=void 0===n&&void 0===r?new Uint8Array(e):void 0===r?new Uint8Array(e,n):new Uint8Array(e,n,r),a.TYPED_ARRAY_SUPPORT?(t=e).__proto__=a.prototype:t=m(t,e),t}function y(t,e){if(a.isBuffer(e)){var n=0|v(e.length);return 0===(t=l(t,n)).length?t:(e.copy(t,0,0,n),t)}if(e){if("undefined"!=typeof ArrayBuffer&&e.buffer instanceof ArrayBuffer||"length"in e)return"number"!=typeof e.length||et(e.length)?l(t,0):m(t,e);if("Buffer"===e.type&&i(e.data))return m(t,e.data)}throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}function v(t){if(t>=u())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+u().toString(16)+" bytes");return 0|t}function _(t){return+t!=t&&(t=0),a.alloc(+t)}function b(t,e){if(a.isBuffer(t))return t.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(t)||t instanceof ArrayBuffer))return t.byteLength;"string"!=typeof t&&(t=""+t);var n=t.length;if(0===n)return 0;for(var r=!1;;)switch(e){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":case void 0:return Z(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return Q(t).length;default:if(r)return Z(t).length;e=(""+e).toLowerCase(),r=!0}}function w(t,e,n){var r=!1;if((void 0===e||e<0)&&(e=0),e>this.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if((n>>>=0)<=(e>>>=0))return"";for(t||(t="utf8");;)switch(t){case"hex":return Y(this,e,n);case"utf8":case"utf-8":return B(this,e,n);case"ascii":return M(this,e,n);case"latin1":case"binary":return L(this,e,n);case"base64":return I(this,e,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return C(this,e,n);default:if(r)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),r=!0}}function j(t,e,n){var r=t[e];t[e]=t[n],t[n]=r}function E(t,e,n,r,o){if(0===t.length)return-1;if("string"==typeof n?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),n=+n,isNaN(n)&&(n=o?0:t.length-1),n<0&&(n=t.length+n),n>=t.length){if(o)return-1;n=t.length-1}else if(n<0){if(!o)return-1;n=0}if("string"==typeof e&&(e=a.from(e,r)),a.isBuffer(e))return 0===e.length?-1:A(t,e,n,r,o);if("number"==typeof e)return e&=255,a.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?o?Uint8Array.prototype.indexOf.call(t,e,n):Uint8Array.prototype.lastIndexOf.call(t,e,n):A(t,[e],n,r,o);throw new TypeError("val must be string, number or Buffer")}function A(t,e,n,r,o){var i=1,s=t.length,u=e.length,l;if(void 0!==r&&("ucs2"===(r=String(r).toLowerCase())||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(t.length<2||e.length<2)return-1;i=2,s/=2,u/=2,n/=2}function a(t,e){return 1===i?t[e]:t.readUInt16BE(e*i)}if(o){var f=-1;for(l=n;l<s;l++)if(a(t,l)===a(e,-1===f?0:l-f)){if(-1===f&&(f=l),l-f+1===u)return f*i}else-1!==f&&(l-=l-f),f=-1}else for(n+u>s&&(n=s-u),l=n;l>=0;l--){for(var c=!0,h=0;h<u;h++)if(a(t,l+h)!==a(e,h)){c=!1;break}if(c)return l}return-1}function T(t,e,n,r){n=Number(n)||0;var o=t.length-n;r?(r=Number(r))>o&&(r=o):r=o;var i=e.length;if(i%2!=0)throw new TypeError("Invalid hex string");r>i/2&&(r=i/2);for(var s=0;s<r;++s){var u=parseInt(e.substr(2*s,2),16);if(isNaN(u))return s;t[n+s]=u}return s}function x(t,e,n,r){return tt(Z(e,t.length-n),t,n,r)}function R(t,e,n,r){return tt(G(e),t,n,r)}function S(t,e,n,r){return R(t,e,n,r)}function P(t,e,n,r){return tt(Q(e),t,n,r)}function k(t,e,n,r){return tt(H(e,t.length-n),t,n,r)}function I(t,e,n){return 0===e&&n===t.length?r.fromByteArray(t):r.fromByteArray(t.slice(e,n))}function B(t,e,n){n=Math.min(t.length,n);for(var r=[],o=e;o<n;){var i=t[o],s=null,u=i>239?4:i>223?3:i>191?2:1,l,a,f,c;if(o+u<=n)switch(u){case 1:i<128&&(s=i);break;case 2:128==(192&(l=t[o+1]))&&(c=(31&i)<<6|63&l)>127&&(s=c);break;case 3:l=t[o+1],a=t[o+2],128==(192&l)&&128==(192&a)&&(c=(15&i)<<12|(63&l)<<6|63&a)>2047&&(c<55296||c>57343)&&(s=c);break;case 4:l=t[o+1],a=t[o+2],f=t[o+3],128==(192&l)&&128==(192&a)&&128==(192&f)&&(c=(15&i)<<18|(63&l)<<12|(63&a)<<6|63&f)>65535&&c<1114112&&(s=c)}null===s?(s=65533,u=1):s>65535&&(s-=65536,r.push(s>>>10&1023|55296),s=56320|1023&s),r.push(s),o+=u}return O(r)}e.Buffer=a,e.SlowBuffer=_,e.INSPECT_MAX_BYTES=50,a.TYPED_ARRAY_SUPPORT=void 0!==t.TYPED_ARRAY_SUPPORT?t.TYPED_ARRAY_SUPPORT:s(),e.kMaxLength=u(),a.poolSize=8192,a._augment=function(t){return t.__proto__=a.prototype,t},a.from=function(t,e,n){return f(null,t,e,n)},a.TYPED_ARRAY_SUPPORT&&(a.prototype.__proto__=Uint8Array.prototype,a.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&a[Symbol.species]===a&&Object.defineProperty(a,Symbol.species,{value:null,configurable:!0})),a.alloc=function(t,e,n){return h(null,t,e,n)},a.allocUnsafe=function(t){return d(null,t)},a.allocUnsafeSlow=function(t){return d(null,t)},a.isBuffer=function t(e){return!(null==e||!e._isBuffer)},a.compare=function t(e,n){if(!a.isBuffer(e)||!a.isBuffer(n))throw new TypeError("Arguments must be Buffers");if(e===n)return 0;for(var r=e.length,o=n.length,i=0,s=Math.min(r,o);i<s;++i)if(e[i]!==n[i]){r=e[i],o=n[i];break}return r<o?-1:o<r?1:0},a.isEncoding=function t(e){switch(String(e).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},a.concat=function t(e,n){if(!i(e))throw new TypeError('"list" argument must be an Array of Buffers');if(0===e.length)return a.alloc(0);var r;if(void 0===n)for(n=0,r=0;r<e.length;++r)n+=e[r].length;var o=a.allocUnsafe(n),s=0;for(r=0;r<e.length;++r){var u=e[r];if(!a.isBuffer(u))throw new TypeError('"list" argument must be an Array of Buffers');u.copy(o,s),s+=u.length}return o},a.byteLength=b,a.prototype._isBuffer=!0,a.prototype.swap16=function t(){var e=this.length;if(e%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var n=0;n<e;n+=2)j(this,n,n+1);return this},a.prototype.swap32=function t(){var e=this.length;if(e%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var n=0;n<e;n+=4)j(this,n,n+3),j(this,n+1,n+2);return this},a.prototype.swap64=function t(){var e=this.length;if(e%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var n=0;n<e;n+=8)j(this,n,n+7),j(this,n+1,n+6),j(this,n+2,n+5),j(this,n+3,n+4);return this},a.prototype.toString=function t(){var e=0|this.length;return 0===e?"":0===arguments.length?B(this,0,e):w.apply(this,arguments)},a.prototype.equals=function t(e){if(!a.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e||0===a.compare(this,e)},a.prototype.inspect=function t(){var n="",r=e.INSPECT_MAX_BYTES;return this.length>0&&(n=this.toString("hex",0,r).match(/.{2}/g).join(" "),this.length>r&&(n+=" ... ")),"<Buffer "+n+">"},a.prototype.compare=function t(e,n,r,o,i){if(!a.isBuffer(e))throw new TypeError("Argument must be a Buffer");if(void 0===n&&(n=0),void 0===r&&(r=e?e.length:0),void 0===o&&(o=0),void 0===i&&(i=this.length),n<0||r>e.length||o<0||i>this.length)throw new RangeError("out of range index");if(o>=i&&n>=r)return 0;if(o>=i)return-1;if(n>=r)return 1;if(n>>>=0,r>>>=0,o>>>=0,i>>>=0,this===e)return 0;for(var s=i-o,u=r-n,l=Math.min(s,u),f=this.slice(o,i),c=e.slice(n,r),h=0;h<l;++h)if(f[h]!==c[h]){s=f[h],u=c[h];break}return s<u?-1:u<s?1:0},a.prototype.includes=function t(e,n,r){return-1!==this.indexOf(e,n,r)},a.prototype.indexOf=function t(e,n,r){return E(this,e,n,r,!0)},a.prototype.lastIndexOf=function t(e,n,r){return E(this,e,n,r,!1)},a.prototype.write=function t(e,n,r,o){if(void 0===n)o="utf8",r=this.length,n=0;else if(void 0===r&&"string"==typeof n)o=n,r=this.length,n=0;else{if(!isFinite(n))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");n|=0,isFinite(r)?(r|=0,void 0===o&&(o="utf8")):(o=r,r=void 0)}var i=this.length-n;if((void 0===r||r>i)&&(r=i),e.length>0&&(r<0||n<0)||n>this.length)throw new RangeError("Attempt to write outside buffer bounds");o||(o="utf8");for(var s=!1;;)switch(o){case"hex":return T(this,e,n,r);case"utf8":case"utf-8":return x(this,e,n,r);case"ascii":return R(this,e,n,r);case"latin1":case"binary":return S(this,e,n,r);case"base64":return P(this,e,n,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return k(this,e,n,r);default:if(s)throw new TypeError("Unknown encoding: "+o);o=(""+o).toLowerCase(),s=!0}},a.prototype.toJSON=function t(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var U=4096;function O(t){var e=t.length;if(e<=U)return String.fromCharCode.apply(String,t);for(var n="",r=0;r<e;)n+=String.fromCharCode.apply(String,t.slice(r,r+=U));return n}function M(t,e,n){var r="";n=Math.min(t.length,n);for(var o=e;o<n;++o)r+=String.fromCharCode(127&t[o]);return r}function L(t,e,n){var r="";n=Math.min(t.length,n);for(var o=e;o<n;++o)r+=String.fromCharCode(t[o]);return r}function Y(t,e,n){var r=t.length;(!e||e<0)&&(e=0),(!n||n<0||n>r)&&(n=r);for(var o="",i=e;i<n;++i)o+=J(t[i]);return o}function C(t,e,n){for(var r=t.slice(e,n),o="",i=0;i<r.length;i+=2)o+=String.fromCharCode(r[i]+256*r[i+1]);return o}function D(t,e,n){if(t%1!=0||t<0)throw new RangeError("offset is not uint");if(t+e>n)throw new RangeError("Trying to access beyond buffer length")}function N(t,e,n,r,o,i){if(!a.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>o||e<i)throw new RangeError('"value" argument is out of bounds');if(n+r>t.length)throw new RangeError("Index out of range")}function F(t,e,n,r){e<0&&(e=65535+e+1);for(var o=0,i=Math.min(t.length-n,2);o<i;++o)t[n+o]=(e&255<<8*(r?o:1-o))>>>8*(r?o:1-o)}function z(t,e,n,r){e<0&&(e=4294967295+e+1);for(var o=0,i=Math.min(t.length-n,4);o<i;++o)t[n+o]=e>>>8*(r?o:3-o)&255}function q(t,e,n,r,o,i){if(n+r>t.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function V(t,e,n,r,i){return i||q(t,e,n,4,3.4028234663852886e38,-3.4028234663852886e38),o.write(t,e,n,r,23,4),n+4}function W(t,e,n,r,i){return i||q(t,e,n,8,1.7976931348623157e308,-1.7976931348623157e308),o.write(t,e,n,r,52,8),n+8}a.prototype.slice=function t(e,n){var r=this.length,o;if(e=~~e,n=void 0===n?r:~~n,e<0?(e+=r)<0&&(e=0):e>r&&(e=r),n<0?(n+=r)<0&&(n=0):n>r&&(n=r),n<e&&(n=e),a.TYPED_ARRAY_SUPPORT)(o=this.subarray(e,n)).__proto__=a.prototype;else{var i=n-e;o=new a(i,void 0);for(var s=0;s<i;++s)o[s]=this[s+e]}return o},a.prototype.readUIntLE=function t(e,n,r){e|=0,n|=0,r||D(e,n,this.length);for(var o=this[e],i=1,s=0;++s<n&&(i*=256);)o+=this[e+s]*i;return o},a.prototype.readUIntBE=function t(e,n,r){e|=0,n|=0,r||D(e,n,this.length);for(var o=this[e+--n],i=1;n>0&&(i*=256);)o+=this[e+--n]*i;return o},a.prototype.readUInt8=function t(e,n){return n||D(e,1,this.length),this[e]},a.prototype.readUInt16LE=function t(e,n){return n||D(e,2,this.length),this[e]|this[e+1]<<8},a.prototype.readUInt16BE=function t(e,n){return n||D(e,2,this.length),this[e]<<8|this[e+1]},a.prototype.readUInt32LE=function t(e,n){return n||D(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},a.prototype.readUInt32BE=function t(e,n){return n||D(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},a.prototype.readIntLE=function t(e,n,r){e|=0,n|=0,r||D(e,n,this.length);for(var o=this[e],i=1,s=0;++s<n&&(i*=256);)o+=this[e+s]*i;return o>=(i*=128)&&(o-=Math.pow(2,8*n)),o},a.prototype.readIntBE=function t(e,n,r){e|=0,n|=0,r||D(e,n,this.length);for(var o=n,i=1,s=this[e+--o];o>0&&(i*=256);)s+=this[e+--o]*i;return s>=(i*=128)&&(s-=Math.pow(2,8*n)),s},a.prototype.readInt8=function t(e,n){return n||D(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},a.prototype.readInt16LE=function t(e,n){n||D(e,2,this.length);var r=this[e]|this[e+1]<<8;return 32768&r?4294901760|r:r},a.prototype.readInt16BE=function t(e,n){n||D(e,2,this.length);var r=this[e+1]|this[e]<<8;return 32768&r?4294901760|r:r},a.prototype.readInt32LE=function t(e,n){return n||D(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},a.prototype.readInt32BE=function t(e,n){return n||D(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},a.prototype.readFloatLE=function t(e,n){return n||D(e,4,this.length),o.read(this,e,!0,23,4)},a.prototype.readFloatBE=function t(e,n){return n||D(e,4,this.length),o.read(this,e,!1,23,4)},a.prototype.readDoubleLE=function t(e,n){return n||D(e,8,this.length),o.read(this,e,!0,52,8)},a.prototype.readDoubleBE=function t(e,n){return n||D(e,8,this.length),o.read(this,e,!1,52,8)},a.prototype.writeUIntLE=function t(e,n,r,o){var i;(e=+e,n|=0,r|=0,o)||N(this,e,n,r,Math.pow(2,8*r)-1,0);var s=1,u=0;for(this[n]=255&e;++u<r&&(s*=256);)this[n+u]=e/s&255;return n+r},a.prototype.writeUIntBE=function t(e,n,r,o){var i;(e=+e,n|=0,r|=0,o)||N(this,e,n,r,Math.pow(2,8*r)-1,0);var s=r-1,u=1;for(this[n+s]=255&e;--s>=0&&(u*=256);)this[n+s]=e/u&255;return n+r},a.prototype.writeUInt8=function t(e,n,r){return e=+e,n|=0,r||N(this,e,n,1,255,0),a.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[n]=255&e,n+1},a.prototype.writeUInt16LE=function t(e,n,r){return e=+e,n|=0,r||N(this,e,n,2,65535,0),a.TYPED_ARRAY_SUPPORT?(this[n]=255&e,this[n+1]=e>>>8):F(this,e,n,!0),n+2},a.prototype.writeUInt16BE=function t(e,n,r){return e=+e,n|=0,r||N(this,e,n,2,65535,0),a.TYPED_ARRAY_SUPPORT?(this[n]=e>>>8,this[n+1]=255&e):F(this,e,n,!1),n+2},a.prototype.writeUInt32LE=function t(e,n,r){return e=+e,n|=0,r||N(this,e,n,4,4294967295,0),a.TYPED_ARRAY_SUPPORT?(this[n+3]=e>>>24,this[n+2]=e>>>16,this[n+1]=e>>>8,this[n]=255&e):z(this,e,n,!0),n+4},a.prototype.writeUInt32BE=function t(e,n,r){return e=+e,n|=0,r||N(this,e,n,4,4294967295,0),a.TYPED_ARRAY_SUPPORT?(this[n]=e>>>24,this[n+1]=e>>>16,this[n+2]=e>>>8,this[n+3]=255&e):z(this,e,n,!1),n+4},a.prototype.writeIntLE=function t(e,n,r,o){if(e=+e,n|=0,!o){var i=Math.pow(2,8*r-1);N(this,e,n,r,i-1,-i)}var s=0,u=1,l=0;for(this[n]=255&e;++s<r&&(u*=256);)e<0&&0===l&&0!==this[n+s-1]&&(l=1),this[n+s]=(e/u>>0)-l&255;return n+r},a.prototype.writeIntBE=function t(e,n,r,o){if(e=+e,n|=0,!o){var i=Math.pow(2,8*r-1);N(this,e,n,r,i-1,-i)}var s=r-1,u=1,l=0;for(this[n+s]=255&e;--s>=0&&(u*=256);)e<0&&0===l&&0!==this[n+s+1]&&(l=1),this[n+s]=(e/u>>0)-l&255;return n+r},a.prototype.writeInt8=function t(e,n,r){return e=+e,n|=0,r||N(this,e,n,1,127,-128),a.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),e<0&&(e=255+e+1),this[n]=255&e,n+1},a.prototype.writeInt16LE=function t(e,n,r){return e=+e,n|=0,r||N(this,e,n,2,32767,-32768),a.TYPED_ARRAY_SUPPORT?(this[n]=255&e,this[n+1]=e>>>8):F(this,e,n,!0),n+2},a.prototype.writeInt16BE=function t(e,n,r){return e=+e,n|=0,r||N(this,e,n,2,32767,-32768),a.TYPED_ARRAY_SUPPORT?(this[n]=e>>>8,this[n+1]=255&e):F(this,e,n,!1),n+2},a.prototype.writeInt32LE=function t(e,n,r){return e=+e,n|=0,r||N(this,e,n,4,2147483647,-2147483648),a.TYPED_ARRAY_SUPPORT?(this[n]=255&e,this[n+1]=e>>>8,this[n+2]=e>>>16,this[n+3]=e>>>24):z(this,e,n,!0),n+4},a.prototype.writeInt32BE=function t(e,n,r){return e=+e,n|=0,r||N(this,e,n,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),a.TYPED_ARRAY_SUPPORT?(this[n]=e>>>24,this[n+1]=e>>>16,this[n+2]=e>>>8,this[n+3]=255&e):z(this,e,n,!1),n+4},a.prototype.writeFloatLE=function t(e,n,r){return V(this,e,n,!0,r)},a.prototype.writeFloatBE=function t(e,n,r){return V(this,e,n,!1,r)},a.prototype.writeDoubleLE=function t(e,n,r){return W(this,e,n,!0,r)},a.prototype.writeDoubleBE=function t(e,n,r){return W(this,e,n,!1,r)},a.prototype.copy=function t(e,n,r,o){if(r||(r=0),o||0===o||(o=this.length),n>=e.length&&(n=e.length),n||(n=0),o>0&&o<r&&(o=r),o===r)return 0;if(0===e.length||0===this.length)return 0;if(n<0)throw new RangeError("targetStart out of bounds");if(r<0||r>=this.length)throw new RangeError("sourceStart out of bounds");if(o<0)throw new RangeError("sourceEnd out of bounds");o>this.length&&(o=this.length),e.length-n<o-r&&(o=e.length-n+r);var i=o-r,s;if(this===e&&r<n&&n<o)for(s=i-1;s>=0;--s)e[s+n]=this[s+r];else if(i<1e3||!a.TYPED_ARRAY_SUPPORT)for(s=0;s<i;++s)e[s+n]=this[s+r];else Uint8Array.prototype.set.call(e,this.subarray(r,r+i),n);return i},a.prototype.fill=function t(e,n,r,o){if("string"==typeof e){if("string"==typeof n?(o=n,n=0,r=this.length):"string"==typeof r&&(o=r,r=this.length),1===e.length){var i=e.charCodeAt(0);i<256&&(e=i)}if(void 0!==o&&"string"!=typeof o)throw new TypeError("encoding must be a string");if("string"==typeof o&&!a.isEncoding(o))throw new TypeError("Unknown encoding: "+o)}else"number"==typeof e&&(e&=255);if(n<0||this.length<n||this.length<r)throw new RangeError("Out of range index");if(r<=n)return this;var s;if(n>>>=0,r=void 0===r?this.length:r>>>0,e||(e=0),"number"==typeof e)for(s=n;s<r;++s)this[s]=e;else{var u=a.isBuffer(e)?e:Z(new a(e,o).toString()),l=u.length;for(s=0;s<r-n;++s)this[s+n]=u[s%l]}return this};var $=/[^+\/0-9A-Za-z-_]/g;function X(t){if((t=K(t).replace($,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}function K(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}function J(t){return t<16?"0"+t.toString(16):t.toString(16)}function Z(t,e){var n;e=e||1/0;for(var r=t.length,o=null,i=[],s=0;s<r;++s){if((n=t.charCodeAt(s))>55295&&n<57344){if(!o){if(n>56319){(e-=3)>-1&&i.push(239,191,189);continue}if(s+1===r){(e-=3)>-1&&i.push(239,191,189);continue}o=n;continue}if(n<56320){(e-=3)>-1&&i.push(239,191,189),o=n;continue}n=65536+(o-55296<<10|n-56320)}else o&&(e-=3)>-1&&i.push(239,191,189);if(o=null,n<128){if((e-=1)<0)break;i.push(n)}else if(n<2048){if((e-=2)<0)break;i.push(n>>6|192,63&n|128)}else if(n<65536){if((e-=3)<0)break;i.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((e-=4)<0)break;i.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return i}function G(t){for(var e=[],n=0;n<t.length;++n)e.push(255&t.charCodeAt(n));return e}function H(t,e){for(var n,r,o,i=[],s=0;s<t.length&&!((e-=2)<0);++s)r=(n=t.charCodeAt(s))>>8,o=n%256,i.push(o),i.push(r);return i}function Q(t){return r.toByteArray(X(t))}function tt(t,e,n,r){for(var o=0;o<r&&!(o+n>=e.length||o>=t.length);++o)e[o+n]=t[o];return o}function et(t){return t!=t}}).call(this,n("./node_modules/webpack/buildin/global.js"))},"./node_modules/class-is/index.js":function(t,e,n){"use strict";function r(t,{className:e,symbolName:n}){const r=Symbol.for(n),o={[e]:class extends t{constructor(...t){super(...t),Object.defineProperty(this,r,{value:!0})}get[Symbol.toStringTag](){return e}}}[e];return o[`is${e}`]=(t=>!(!t||!t[r])),o}function o(t,{className:e,symbolName:n,withoutNew:r}){const o=Symbol.for(n),i={[e]:function(...e){if(r&&!(this instanceof i))return new i(...e);const n=t.call(this,...e)||this;return n&&!n[o]&&Object.defineProperty(n,o,{value:!0}),n}}[e];return i.prototype=Object.create(t.prototype),i.prototype.constructor=i,Object.defineProperty(i.prototype,Symbol.toStringTag,{get:()=>e}),i[`is${e}`]=(t=>!(!t||!t[o])),i}t.exports=r,t.exports.proto=o},"./node_modules/err-code/index.js":function(t,e,n){"use strict";function r(t,e,n){var r=t instanceof Error?t:new Error(t),o;if("object"==typeof e?n=e:null!=e&&(r.code=e),n)for(o in n)r[o]=n[o];return r}t.exports=r},"./node_modules/ieee754/index.js":function(t,e){e.read=function(t,e,n,r,o){var i,s,u=8*o-r-1,l=(1<<u)-1,a=l>>1,f=-7,c=n?o-1:0,h=n?-1:1,d=t[e+c];for(c+=h,i=d&(1<<-f)-1,d>>=-f,f+=u;f>0;i=256*i+t[e+c],c+=h,f-=8);for(s=i&(1<<-f)-1,i>>=-f,f+=r;f>0;s=256*s+t[e+c],c+=h,f-=8);if(0===i)i=1-a;else{if(i===l)return s?NaN:1/0*(d?-1:1);s+=Math.pow(2,r),i-=a}return(d?-1:1)*s*Math.pow(2,i-r)},e.write=function(t,e,n,r,o,i){var s,u,l,a=8*i-o-1,f=(1<<a)-1,c=f>>1,h=23===o?Math.pow(2,-24)-Math.pow(2,-77):0,d=r?0:i-1,p=r?1:-1,m=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(u=isNaN(e)?1:0,s=f):(s=Math.floor(Math.log(e)/Math.LN2),e*(l=Math.pow(2,-s))<1&&(s--,l*=2),(e+=s+c>=1?h/l:h*Math.pow(2,1-c))*l>=2&&(s++,l/=2),s+c>=f?(u=0,s=f):s+c>=1?(u=(e*l-1)*Math.pow(2,o),s+=c):(u=e*Math.pow(2,c-1)*Math.pow(2,o),s=0));o>=8;t[n+d]=255&u,d+=p,u/=256,o-=8);for(s=s<<o|u,a+=o;a>0;t[n+d]=255&s,d+=p,s/=256,a-=8);t[n+d-p]|=128*m}},"./node_modules/isarray/index.js":function(t,e){var n={}.toString;t.exports=Array.isArray||function(t){return"[object Array]"==n.call(t)}},"./node_modules/os-browserify/browser.js":function(t,e){e.endianness=function(){return"LE"},e.hostname=function(){return"undefined"!=typeof location?location.hostname:""},e.loadavg=function(){return[]},e.uptime=function(){return 0},e.freemem=function(){return Number.MAX_VALUE},e.totalmem=function(){return Number.MAX_VALUE},e.cpus=function(){return[]},e.type=function(){return"Browser"},e.release=function(){return"undefined"!=typeof navigator?navigator.appVersion:""},e.networkInterfaces=e.getNetworkInterfaces=function(){return{}},e.arch=function(){return"javascript"},e.platform=function(){return"browser"},e.tmpdir=e.tmpDir=function(){return"/tmp"},e.EOL="\n",e.homedir=function(){return"/"}},"./node_modules/path-browserify/index.js":function(t,e,n){(function(t){function n(t,e){for(var n=0,r=t.length-1;r>=0;r--){var o=t[r];"."===o?t.splice(r,1):".."===o?(t.splice(r,1),n++):n&&(t.splice(r,1),n--)}if(e)for(;n--;n)t.unshift("..");return t}var r=/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/,o=function(t){return r.exec(t).slice(1)};function i(t,e){if(t.filter)return t.filter(e);for(var n=[],r=0;r<t.length;r++)e(t[r],r,t)&&n.push(t[r]);return n}e.resolve=function(){for(var e="",r=!1,o=arguments.length-1;o>=-1&&!r;o--){var s=o>=0?arguments[o]:t.cwd();if("string"!=typeof s)throw new TypeError("Arguments to path.resolve must be strings");s&&(e=s+"/"+e,r="/"===s.charAt(0))}return e=n(i(e.split("/"),function(t){return!!t}),!r).join("/"),(r?"/":"")+e||"."},e.normalize=function(t){var r=e.isAbsolute(t),o="/"===s(t,-1);return(t=n(i(t.split("/"),function(t){return!!t}),!r).join("/"))||r||(t="."),t&&o&&(t+="/"),(r?"/":"")+t},e.isAbsolute=function(t){return"/"===t.charAt(0)},e.join=function(){var t=Array.prototype.slice.call(arguments,0);return e.normalize(i(t,function(t,e){if("string"!=typeof t)throw new TypeError("Arguments to path.join must be strings");return t}).join("/"))},e.relative=function(t,n){function r(t){for(var e=0;e<t.length&&""===t[e];e++);for(var n=t.length-1;n>=0&&""===t[n];n--);return e>n?[]:t.slice(e,n-e+1)}t=e.resolve(t).substr(1),n=e.resolve(n).substr(1);for(var o=r(t.split("/")),i=r(n.split("/")),s=Math.min(o.length,i.length),u=s,l=0;l<s;l++)if(o[l]!==i[l]){u=l;break}for(var a=[],l=u;l<o.length;l++)a.push("..");return(a=a.concat(i.slice(u))).join("/")},e.sep="/",e.delimiter=":",e.dirname=function(t){var e=o(t),n=e[0],r=e[1];return n||r?(r&&(r=r.substr(0,r.length-1)),n+r):"."},e.basename=function(t,e){var n=o(t)[2];return e&&n.substr(-1*e.length)===e&&(n=n.substr(0,n.length-e.length)),n},e.extname=function(t){return o(t)[3]};var s="b"==="ab".substr(-1)?function(t,e,n){return t.substr(e,n)}:function(t,e,n){return e<0&&(e=t.length+e),t.substr(e,n)}}).call(this,n("./node_modules/process/browser.js"))},"./node_modules/process/browser.js":function(t,e){var n=t.exports={},r,o;function i(){throw new Error("setTimeout has not been defined")}function s(){throw new Error("clearTimeout has not been defined")}function u(t){if(r===setTimeout)return setTimeout(t,0);if((r===i||!r)&&setTimeout)return r=setTimeout,setTimeout(t,0);try{return r(t,0)}catch(e){try{return r.call(null,t,0)}catch(e){return r.call(this,t,0)}}}function l(t){if(o===clearTimeout)return clearTimeout(t);if((o===s||!o)&&clearTimeout)return o=clearTimeout,clearTimeout(t);try{return o(t)}catch(e){try{return o.call(null,t)}catch(e){return o.call(this,t)}}}!function(){try{r="function"==typeof setTimeout?setTimeout:i}catch(t){r=i}try{o="function"==typeof clearTimeout?clearTimeout:s}catch(t){o=s}}();var a=[],f=!1,c,h=-1;function d(){f&&c&&(f=!1,c.length?a=c.concat(a):h=-1,a.length&&p())}function p(){if(!f){var t=u(d);f=!0;for(var e=a.length;e;){for(c=a,a=[];++h<e;)c&&c[h].run();h=-1,e=a.length}c=null,f=!1,l(t)}}function m(t,e){this.fun=t,this.array=e}function g(){}n.nextTick=function(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)e[n-1]=arguments[n];a.push(new m(t,e)),1!==a.length||f||u(p)},m.prototype.run=function(){this.fun.apply(null,this.array)},n.title="browser",n.browser=!0,n.env={},n.argv=[],n.version="",n.versions={},n.on=g,n.addListener=g,n.once=g,n.off=g,n.removeListener=g,n.removeAllListeners=g,n.emit=g,n.prependListener=g,n.prependOnceListener=g,n.listeners=function(t){return[]},n.binding=function(t){throw new Error("process.binding is not supported")},n.cwd=function(){return"/"},n.chdir=function(t){throw new Error("process.chdir is not supported")},n.umask=function(){return 0}},"./node_modules/pull-defer/source.js":function(t,e){t.exports=function(){var t,e,n,r,o=function(o,i){t?t(o,i):o?(r=o,n=i):e=i};return o.resolve=function(o){if(t)throw new Error("already resolved");if(!(t=o))throw new Error("no read cannot resolve!"+t);e&&o(null,e),n&&o(r,n)},o.abort=function(t){o.resolve(function(e,n){n(t||!0)})},o}},"./node_modules/pull-stream/index.js":function(t,e,n){"use strict";var r=n("./node_modules/pull-stream/sources/index.js"),o=n("./node_modules/pull-stream/sinks/index.js"),i=n("./node_modules/pull-stream/throughs/index.js");for(var s in(e=t.exports=n("./node_modules/pull-stream/pull.js")).pull=e,r)e[s]=r[s];for(var s in i)e[s]=i[s];for(var s in o)e[s]=o[s]},"./node_modules/pull-stream/pull.js":function(t,e,n){"use strict";t.exports=function t(e){var n=arguments.length;if("function"==typeof e&&1===e.length){for(var r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return function(e){if(null==r)throw new TypeError("partial sink should only be called once!");var o=r;switch(r=null,n){case 1:return t(e,o[0]);case 2:return t(e,o[0],o[1]);case 3:return t(e,o[0],o[1],o[2]);case 4:return t(e,o[0],o[1],o[2],o[3]);default:return o.unshift(e),t.apply(null,o)}}}var i=e;i&&"function"==typeof i.source&&(i=i.source);for(var o=1;o<n;o++){var s=arguments[o];"function"==typeof s?i=s(i):s&&"object"==typeof s&&(s.sink(i),i=s.source)}return i}},"./node_modules/pull-stream/sinks/collect.js":function(t,e,n){"use strict";var r=n("./node_modules/pull-stream/sinks/reduce.js");t.exports=function t(e){return r(function(t,e){return t.push(e),t},[],e)}},"./node_modules/pull-stream/sinks/concat.js":function(t,e,n){"use strict";var r=n("./node_modules/pull-stream/sinks/reduce.js");t.exports=function t(e){return r(function(t,e){return t+e},"",e)}},"./node_modules/pull-stream/sinks/drain.js":function(t,e,n){"use strict";t.exports=function t(e,n){var r,o;function i(t){if(r=t,o)return i.abort();!function t(){for(var i=!0,s=!1;i;)if(s=!1,r(null,function(u,l){if(s=!0,u=u||o){if(i=!1,n)n(!0===u?null:u);else if(u&&!0!==u)throw u}else e&&!1===e(l)||o?(i=!1,r(o||!0,n||function(){})):i||t()}),!s)return void(i=!1)}()}return i.abort=function(t,e){if("function"==typeof t&&(e=t,t=!0),o=t||!0,r)return r(o,e||function(){})},i}},"./node_modules/pull-stream/sinks/find.js":function(t,e,n){"use strict";function r(t){return t}var o=n("./node_modules/pull-stream/util/prop.js"),i=n("./node_modules/pull-stream/sinks/drain.js");t.exports=function t(e,n){var s=!1;return n?e=o(e)||r:(n=e,e=r),i(function(t){if(e(t))return s=!0,n(null,t),!1},function(t){s||n(!0===t?null:t,null)})}},"./node_modules/pull-stream/sinks/index.js":function(t,e,n){"use strict";t.exports={drain:n("./node_modules/pull-stream/sinks/drain.js"),onEnd:n("./node_modules/pull-stream/sinks/on-end.js"),log:n("./node_modules/pull-stream/sinks/log.js"),find:n("./node_modules/pull-stream/sinks/find.js"),reduce:n("./node_modules/pull-stream/sinks/reduce.js"),collect:n("./node_modules/pull-stream/sinks/collect.js"),concat:n("./node_modules/pull-stream/sinks/concat.js")}},"./node_modules/pull-stream/sinks/log.js":function(t,e,n){"use strict";var r=n("./node_modules/pull-stream/sinks/drain.js");t.exports=function t(e){return r(function(t){console.log(t)},e)}},"./node_modules/pull-stream/sinks/on-end.js":function(t,e,n){"use strict";var r=n("./node_modules/pull-stream/sinks/drain.js");t.exports=function t(e){return r(null,e)}},"./node_modules/pull-stream/sinks/reduce.js":function(t,e,n){"use strict";var r=n("./node_modules/pull-stream/sinks/drain.js");t.exports=function t(e,n,o){o||(o=n,n=null);var i=r(function(t){n=e(n,t)},function(t){o(t,n)});return 2===arguments.length?function(t){t(null,function(e,r){if(e)return o(!0===e?null:e);n=r,i(t)})}:i}},"./node_modules/pull-stream/sources/count.js":function(t,e,n){"use strict";t.exports=function t(e){var n=0;return e=e||1/0,function(t,r){return t?r&&r(t):n>e?r(!0):void r(null,n++)}}},"./node_modules/pull-stream/sources/empty.js":function(t,e,n){"use strict";t.exports=function t(){return function(t,e){e(!0)}}},"./node_modules/pull-stream/sources/error.js":function(t,e,n){"use strict";t.exports=function t(e){return function(t,n){n(e)}}},"./node_modules/pull-stream/sources/index.js":function(t,e,n){"use strict";t.exports={keys:n("./node_modules/pull-stream/sources/keys.js"),once:n("./node_modules/pull-stream/sources/once.js"),values:n("./node_modules/pull-stream/sources/values.js"),count:n("./node_modules/pull-stream/sources/count.js"),infinite:n("./node_modules/pull-stream/sources/infinite.js"),empty:n("./node_modules/pull-stream/sources/empty.js"),error:n("./node_modules/pull-stream/sources/error.js")}},"./node_modules/pull-stream/sources/infinite.js":function(t,e,n){"use strict";t.exports=function t(e){return e=e||Math.random,function(t,n){return t?n&&n(t):n(null,e())}}},"./node_modules/pull-stream/sources/keys.js":function(t,e,n){"use strict";var r=n("./node_modules/pull-stream/sources/values.js");t.exports=function(t){return r(Object.keys(t))}},"./node_modules/pull-stream/sources/once.js":function(t,e,n){"use strict";var r=n("./node_modules/pull-stream/util/abort-cb.js");t.exports=function t(e,n){return function(t,o){if(t)return r(o,t,n);if(null!=e){var i=e;e=null,o(null,i)}else o(!0)}}},"./node_modules/pull-stream/sources/values.js":function(t,e,n){"use strict";var r=n("./node_modules/pull-stream/util/abort-cb.js");t.exports=function t(e,n){if(!e)return function(t,e){return t?r(e,t,n):e(!0)};Array.isArray(e)||(e=Object.keys(e).map(function(t){return e[t]}));var o=0;return function(t,i){if(t)return r(i,t,n);o>=e.length?i(!0):i(null,e[o++])}}},"./node_modules/pull-stream/throughs/async-map.js":function(t,e,n){"use strict";function r(t){return t}var o=n("./node_modules/pull-stream/util/prop.js");t.exports=function t(e){if(!e)return r;e=o(e);var n=!1,i,s;return function(t){return function r(o,u){if(s)return u(s);o?(s=o,t(o,n?function(t){n?i=u:u(o)}:function(t){u(o)})):t(null,function(t,o){t?u(t):s?u(s):(n=!0,e(o,function(t,e){n=!1,s?(u(s),i&&i(s)):t?r(t,u):u(null,e)}))})}}}},"./node_modules/pull-stream/throughs/filter-not.js":function(t,e,n){"use strict";var r=n("./node_modules/pull-stream/util/tester.js"),o=n("./node_modules/pull-stream/throughs/filter.js");t.exports=function t(e){return e=r(e),o(function(t){return!e(t)})}},"./node_modules/pull-stream/throughs/filter.js":function(t,e,n){"use strict";var r=n("./node_modules/pull-stream/util/tester.js");t.exports=function t(e){return e=r(e),function(t){return function n(r,o){for(var i,s=!0;s;)s=!1,i=!0,t(r,function(t,r){if(!t&&!e(r))return i?s=!0:n(t,o);o(t,r)}),i=!1}}}},"./node_modules/pull-stream/throughs/flatten.js":function(t,e,n){"use strict";var r=n("./node_modules/pull-stream/sources/values.js"),o=n("./node_modules/pull-stream/sources/once.js");t.exports=function t(){return function(t){var e;return function(n,i){function s(){e(null,function(e,n){!0===e?u():e?t(!0,function(t){i(e)}):i(null,n)})}function u(){e=null,t(null,function(t,n){if(t)return i(t);Array.isArray(n)||n&&"object"==typeof n?n=r(n):"function"!=typeof n&&(n=o(n)),e=n,s()})}n?e?e(n,function(e){t(e||n,i)}):t(n,i):e?s():u()}}}},"./node_modules/pull-stream/throughs/index.js":function(t,e,n){"use strict";t.exports={map:n("./node_modules/pull-stream/throughs/map.js"),asyncMap:n("./node_modules/pull-stream/throughs/async-map.js"),filter:n("./node_modules/pull-stream/throughs/filter.js"),filterNot:n("./node_modules/pull-stream/throughs/filter-not.js"),through:n("./node_modules/pull-stream/throughs/through.js"),take:n("./node_modules/pull-stream/throughs/take.js"),unique:n("./node_modules/pull-stream/throughs/unique.js"),nonUnique:n("./node_modules/pull-stream/throughs/non-unique.js"),flatten:n("./node_modules/pull-stream/throughs/flatten.js")}},"./node_modules/pull-stream/throughs/map.js":function(t,e,n){"use strict";function r(t){return t}var o=n("./node_modules/pull-stream/util/prop.js");t.exports=function t(e){return e?(e=o(e),function(t){return function(n,r){t(n,function(n,o){try{o=n?null:e(o)}catch(e){return t(e,function(){return r(e)})}r(n,o)})}}):r}},"./node_modules/pull-stream/throughs/non-unique.js":function(t,e,n){"use strict";var r=n("./node_modules/pull-stream/throughs/unique.js");t.exports=function t(e){return r(e,!0)}},"./node_modules/pull-stream/throughs/take.js":function(t,e,n){"use strict";t.exports=function t(e,n){var r=(n=n||{}).last||!1,o=!1;if("number"==typeof e){r=!0;var i=e;e=function(){return--i}}return function(t){function n(e){t(!0,function(t){r=!1,e(t||!0)})}return function(i,s){o&&!i?r?n(s):s(o):(o=i)?t(o,s):t(null,function(t,i){(o=o||t)?s(o):e(i)?s(null,i):(o=!0,r?s(null,i):n(s))})}}}},"./node_modules/pull-stream/throughs/through.js":function(t,e,n){"use strict";t.exports=function t(e,n){var r=!1;function o(t){!r&&n&&(r=!0,n(!0===t?null:t))}return function(t){return function(n,r){return n&&o(n),t(n,function(t,n){t?o(t):e&&e(n),r(t,n)})}}}},"./node_modules/pull-stream/throughs/unique.js":function(t,e,n){"use strict";function r(t){return t}var o=n("./node_modules/pull-stream/util/prop.js"),i=n("./node_modules/pull-stream/throughs/filter.js");t.exports=function t(e,n){e=o(e)||r;var s={};return i(function(t){var r=e(t);return s[r]?!!n:(s[r]=!0,!n)})}},"./node_modules/pull-stream/util/abort-cb.js":function(t,e){t.exports=function t(e,n,r){e(n),r&&r(!0===n?null:n)}},"./node_modules/pull-stream/util/prop.js":function(t,e){t.exports=function t(e){return e&&("string"==typeof e?function(t){return t[e]}:"object"==typeof e&&"function"==typeof e.exec?function(t){var n=e.exec(t);return n&&n[0]}:e)}},"./node_modules/pull-stream/util/tester.js":function(t,e,n){var r=n("./node_modules/pull-stream/util/prop.js");function o(t){return t}t.exports=function t(e){return"object"==typeof e&&"function"==typeof e.test?function(t){return e.test(t)}:r(e)||o}},"./node_modules/setimmediate/setImmediate.js":function(t,e,n){(function(t,e){!function(t,n){"use strict";if(!t.setImmediate){var r=1,o={},i=!1,s=t.document,u,l=Object.getPrototypeOf&&Object.getPrototypeOf(t);l=l&&l.setTimeout?l:t,"[object process]"==={}.toString.call(t.process)?d():p()?m():t.MessageChannel?g():s&&"onreadystatechange"in s.createElement("script")?y():v(),l.setImmediate=a,l.clearImmediate=f}function a(t){"function"!=typeof t&&(t=new Function(""+t));for(var e=new Array(arguments.length-1),n=0;n<e.length;n++)e[n]=arguments[n+1];var i={callback:t,args:e};return o[r]=i,u(r),r++}function f(t){delete o[t]}function c(t){var e=t.callback,r=t.args;switch(r.length){case 0:e();break;case 1:e(r[0]);break;case 2:e(r[0],r[1]);break;case 3:e(r[0],r[1],r[2]);break;default:e.apply(n,r)}}function h(t){if(i)setTimeout(h,0,t);else{var e=o[t];if(e){i=!0;try{c(e)}finally{f(t),i=!1}}}}function d(){u=function(t){e.nextTick(function(){h(t)})}}function p(){if(t.postMessage&&!t.importScripts){var e=!0,n=t.onmessage;return t.onmessage=function(){e=!1},t.postMessage("","*"),t.onmessage=n,e}}function m(){var e="setImmediate$"+Math.random()+"$",n=function(n){n.source===t&&"string"==typeof n.data&&0===n.data.indexOf(e)&&h(+n.data.slice(e.length))};t.addEventListener?t.addEventListener("message",n,!1):t.attachEvent("onmessage",n),u=function(n){t.postMessage(e+n,"*")}}function g(){var t=new MessageChannel;t.port1.onmessage=function(t){var e;h(t.data)},u=function(e){t.port2.postMessage(e)}}function y(){var t=s.documentElement;u=function(e){var n=s.createElement("script");n.onreadystatechange=function(){h(e),n.onreadystatechange=null,t.removeChild(n),n=null},t.appendChild(n)}}function v(){u=function(t){setTimeout(h,0,t)}}}("undefined"==typeof self?void 0===t?this:t:self)}).call(this,n("./node_modules/webpack/buildin/global.js"),n("./node_modules/process/browser.js"))},"./node_modules/timers-browserify/main.js":function(t,e,n){(function(t){var r=void 0!==t&&t||"undefined"!=typeof self&&self||window,o=Function.prototype.apply;function i(t,e){this._id=t,this._clearFn=e}e.setTimeout=function(){return new i(o.call(setTimeout,r,arguments),clearTimeout)},e.setInterval=function(){return new i(o.call(setInterval,r,arguments),clearInterval)},e.clearTimeout=e.clearInterval=function(t){t&&t.close()},i.prototype.unref=i.prototype.ref=function(){},i.prototype.close=function(){this._clearFn.call(r,this._id)},e.enroll=function(t,e){clearTimeout(t._idleTimeoutId),t._idleTimeout=e},e.unenroll=function(t){clearTimeout(t._idleTimeoutId),t._idleTimeout=-1},e._unrefActive=e.active=function(t){clearTimeout(t._idleTimeoutId);var e=t._idleTimeout;e>=0&&(t._idleTimeoutId=setTimeout(function e(){t._onTimeout&&t._onTimeout()},e))},n("./node_modules/setimmediate/setImmediate.js"),e.setImmediate="undefined"!=typeof self&&self.setImmediate||void 0!==t&&t.setImmediate||this&&this.setImmediate,e.clearImmediate="undefined"!=typeof self&&self.clearImmediate||void 0!==t&&t.clearImmediate||this&&this.clearImmediate}).call(this,n("./node_modules/webpack/buildin/global.js"))},"./node_modules/uuid/lib/bytesToUuid.js":function(t,e){for(var n=[],r=0;r<256;++r)n[r]=(r+256).toString(16).substr(1);function o(t,e){var r=e||0,o=n;return[o[t[r++]],o[t[r++]],o[t[r++]],o[t[r++]],"-",o[t[r++]],o[t[r++]],"-",o[t[r++]],o[t[r++]],"-",o[t[r++]],o[t[r++]],"-",o[t[r++]],o[t[r++]],o[t[r++]],o[t[r++]],o[t[r++]],o[t[r++]]].join("")}t.exports=o},"./node_modules/uuid/lib/rng-browser.js":function(t,e){var n="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof window.msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto);if(n){var r=new Uint8Array(16);t.exports=function t(){return n(r),r}}else{var o=new Array(16);t.exports=function t(){for(var e=0,n;e<16;e++)0==(3&e)&&(n=4294967296*Math.random()),o[e]=n>>>((3&e)<<3)&255;return o}}},"./node_modules/uuid/v4.js":function(t,e,n){var r=n("./node_modules/uuid/lib/rng-browser.js"),o=n("./node_modules/uuid/lib/bytesToUuid.js");function i(t,e,n){var i=e&&n||0;"string"==typeof t&&(e="binary"===t?new Array(16):null,t=null);var s=(t=t||{}).random||(t.rng||r)();if(s[6]=15&s[6]|64,s[8]=63&s[8]|128,e)for(var u=0;u<16;++u)e[i+u]=s[u];return e||o(s)}t.exports=i},"./node_modules/webpack/buildin/global.js":function(t,e){var n;n=function(){return this}();try{n=n||Function("return this")()||(0,eval)("this")}catch(t){"object"==typeof window&&(n=window)}t.exports=n},"./src/errors.js":function(t,e,n){"use strict";const r=n("./node_modules/err-code/index.js");t.exports.dbOpenFailedError=(t=>(t=t||new Error("Cannot open database"),r(t,"ERR_DB_OPEN_FAILED"))),t.exports.dbDeleteFailedError=(t=>(t=t||new Error("Delete failed"),r(t,"ERR_DB_DELETE_FAILED"))),t.exports.dbWriteFailedError=(t=>(t=t||new Error("Write failed"),r(t,"ERR_DB_WRITE_FAILED"))),t.exports.notFoundError=(t=>(t=t||new Error("Not Found"),r(t,"ERR_NOT_FOUND")))},"./src/index.js":function(t,e,n){"use strict";const r=n("./src/key.js"),o=n("./src/memory.js"),i=n("./src/utils.js"),s=n("./src/errors.js");e.Key=r,e.MemoryDatastore=o,e.utils=i,e.Errors=s},"./src/key.js":function(t,e,n){"use strict";(function(e){const r=n("./node_modules/uuid/v4.js"),o=n("./node_modules/class-is/index.js"),i="/",s=e.from(i),u=s[0];class l{constructor(t,n){if("string"==typeof t?this._buf=e.from(t):e.isBuffer(t)&&(this._buf=t),null==n&&(n=!0),n&&this.clean(),0===this._buf.length||this._buf[0]!==u)throw new Error(`Invalid key: ${this.toString()}`)}toString(t){return this._buf.toString(t||"utf8")}toBuffer(){return this._buf}get[Symbol.toStringTag](){return`[Key ${this.toString()}]`}static withNamespaces(t){return new c(t.join(i))}static random(){return new c(r().replace(/-/g,""))}clean(){for(this._buf&&0!==this._buf.length||(this._buf=e.from(i)),this._buf[0]!==u&&(this._buf=e.concat([s,this._buf]));this._buf.length>1&&this._buf[this._buf.length-1]===u;)this._buf=this._buf.slice(0,-1)}less(t){const e=this.list(),n=t.list();for(let t=0;t<e.length;t++){if(n.length<t+1)return!1;const r=e[t],o=n[t];if(r<o)return!0;if(r>o)return!1}return e.length<n.length}reverse(){return l.withNamespaces(this.list().slice().reverse())}namespaces(){return this.list()}baseNamespace(){const t=this.namespaces();return t[t.length-1]}list(){return this.toString().split(i).slice(1)}type(){return a(this.baseNamespace())}name(){return f(this.baseNamespace())}instance(t){return new c(this.toString()+":"+t)}path(){let t=this.parent().toString();return t.endsWith(i)||(t+=i),t+=this.type(),new c(t)}parent(){const t=this.list();return 1===t.length?new c(i):new c(t.slice(0,-1).join(i))}child(t){return this.toString()===i?t:t.toString()===i?this:new c(this.toString()+t.toString(),!1)}isAncestorOf(t){return t.toString()!==this.toString()&&t.toString().startsWith(this.toString())}isDecendantOf(t){return t.toString()!==this.toString()&&this.toString().startsWith(t.toString())}isTopLevel(){return 1===this.list().length}}function a(t){const e=t.split(":");return e.length<2?"":e.slice(0,-1).join(":")}function f(t){const e=t.split(":");return e[e.length-1]}const c=o(l,{className:"Key",symbolName:"@ipfs/interface-datastore/key"});t.exports=c}).call(this,n("./node_modules/buffer/index.js").Buffer)},"./src/memory.js":function(t,e,n){"use strict";const r=n("./node_modules/pull-stream/index.js"),o=n("./node_modules/async/setImmediate.js"),i=n("./src/utils.js").asyncFilter,s=n("./src/utils.js").asyncSort,u=n("./src/key.js"),l=n("./src/errors.js");class a{constructor(){this.data={}}open(t){o(t)}put(t,e,n){this.data[t.toString()]=e,o(n)}get(t,e){this.has(t,(n,r)=>n?e(n):r?void e(null,this.data[t.toString()]):e(l.notFoundError()))}has(t,e){o(()=>{e(null,void 0!==this.data[t.toString()])})}delete(t,e){delete this.data[t.toString()],o(()=>{e()})}batch(){let t=[],e=[];return{put(e,n){t.push([e,n])},delete(t){e.push(t)},commit:n=>{t.forEach(t=>{this.data[t[0].toString()]=t[1]}),t=[],e.forEach(t=>{delete this.data[t.toString()]}),e=[],o(n)}}}query(t){let e=[r.keys(this.data),r.map(t=>({key:new u(t),value:this.data[t]}))],n=[];if(null!=t.prefix){const e=t.prefix;n.push((t,n)=>n(null,t.key.toString().startsWith(e)))}if(null!=t.filters&&(n=n.concat(t.filters)),e=e.concat(n.map(t=>i(t))),null!=t.orders&&(e=e.concat(t.orders.map(t=>s(t)))),null!=t.offset){let n=0;e.push(r.filter(()=>n++>=t.offset))}return null!=t.limit&&e.push(r.take(t.limit)),!0===t.keysOnly&&e.push(r.map(t=>({key:t.key}))),r.apply(null,e)}close(t){o(t)}}t.exports=a},"./src/utils.js":function(t,e,n){"use strict";const r=n("./node_modules/pull-stream/index.js"),o=n("./node_modules/pull-defer/source.js"),i=n("./node_modules/path-browserify/index.js"),s=n("./node_modules/os-browserify/browser.js"),u=n("./node_modules/uuid/v4.js");e.asyncFilter=function(t){let e=!1,n,r;return function(o){return function i(s,u){if(r)return u(r);s?(r=s,o(s,e?()=>{e?n=u:u(s)}:u)):o(null,(o,s)=>{o?u(o):r?u(r):(e=!0,t(s,(t,o)=>{e=!1,r?(u(r),n(r)):t?i(t,u):o?u(null,s):i(null,u)}))})}}},e.asyncSort=function(t){const e=o(),n=r.collect((n,o)=>{if(n)return e.abort(n);t(o,(t,n)=>{if(t)return e.abort(t);e.resolve(r.values(o))})});return function(t){return n(t),e}},e.replaceStartWith=function(t,e){const n=new RegExp("^"+e);return t.replace(n,"")},e.tmpdir=(()=>i.join(s.tmpdir(),u()))},0:function(t,e,n){t.exports=n("./src/index.js")}});
!function(t,r){"object"==typeof exports&&"object"==typeof module?module.exports=r():"function"==typeof define&&define.amd?define([],r):"object"==typeof exports?exports.InterfaceDatastore=r():t.InterfaceDatastore=r()}(window,function(){return function(t){var r={};function e(n){if(r[n])return r[n].exports;var o=r[n]={i:n,l:!1,exports:{}};return t[n].call(o.exports,o,o.exports,e),o.l=!0,o.exports}return e.m=t,e.c=r,e.d=function(t,r,n){e.o(t,r)||Object.defineProperty(t,r,{enumerable:!0,get:n})},e.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},e.t=function(t,r){if(1&r&&(t=e(t)),8&r)return t;if(4&r&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(e.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&r&&"string"!=typeof t)for(var o in t)e.d(n,o,function(r){return t[r]}.bind(null,o));return n},e.n=function(t){var r=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(r,"a",r),r},e.o=function(t,r){return Object.prototype.hasOwnProperty.call(t,r)},e.p="",e(e.s=5)}([function(t,r,e){"use strict";(function(r){function n(t,r){for(var e=0;e<r.length;e++){var n=r[e];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}var o=e(1),i=e(14),u=r.from("/"),a=u[0];var f=i(function(){function t(e,n){if(function(t,r){if(!(t instanceof r))throw new TypeError("Cannot call a class as a function")}(this,t),"string"==typeof e?this._buf=r.from(e):r.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: ".concat(this.toString()))}var e,i,s;return e=t,i=[{key:"toString",value:function(t){return this._buf.toString(t||"utf8")}},{key:"toBuffer",value:function(){return this._buf}},{key:"clean",value:function(){for(this._buf&&0!==this._buf.length||(this._buf=r.from("/")),this._buf[0]!==a&&(this._buf=r.concat([u,this._buf]));this._buf.length>1&&this._buf[this._buf.length-1]===a;)this._buf=this._buf.slice(0,-1)}},{key:"less",value:function(t){for(var r=this.list(),e=t.list(),n=0;n<r.length;n++){if(e.length<n+1)return!1;var o=r[n],i=e[n];if(o<i)return!0;if(o>i)return!1}return r.length<e.length}},{key:"reverse",value:function(){return t.withNamespaces(this.list().slice().reverse())}},{key:"namespaces",value:function(){return this.list()}},{key:"baseNamespace",value:function(){var t=this.namespaces();return t[t.length-1]}},{key:"list",value:function(){return this.toString().split("/").slice(1)}},{key:"type",value:function(){return function(t){var r=t.split(":");if(r.length<2)return"";return r.slice(0,-1).join(":")}(this.baseNamespace())}},{key:"name",value:function(){return t=this.baseNamespace(),(r=t.split(":"))[r.length-1];var t,r}},{key:"instance",value:function(t){return new f(this.toString()+":"+t)}},{key:"path",value:function(){var t=this.parent().toString();return t.endsWith("/")||(t+="/"),t+=this.type(),new f(t)}},{key:"parent",value:function(){var t=this.list();return 1===t.length?new f("/"):new f(t.slice(0,-1).join("/"))}},{key:"child",value:function(t){return"/"===this.toString()?t:"/"===t.toString()?this:new f(this.toString()+t.toString(),!1)}},{key:"isAncestorOf",value:function(t){return t.toString()!==this.toString()&&t.toString().startsWith(this.toString())}},{key:"isDecendantOf",value:function(t){return t.toString()!==this.toString()&&this.toString().startsWith(t.toString())}},{key:"isTopLevel",value:function(){return 1===this.list().length}},{key:Symbol.toStringTag,get:function(){return"[Key ".concat(this.toString(),"]")}}],s=[{key:"withNamespaces",value:function(t){return new f(t.join("/"))}},{key:"random",value:function(){return new f(o().replace(/-/g,""))}}],i&&n(e.prototype,i),s&&n(e,s),t}(),{className:"Key",symbolName:"@ipfs/interface-datastore/key"});t.exports=f}).call(this,e(7).Buffer)},function(t,r,e){"use strict";var n=e(12),o=e(13);t.exports=function(t,r,e){var i=r&&e||0;"string"==typeof t&&(r="binary"===t?new Array(16):null,t=null);var u=(t=t||{}).random||(t.rng||n)();if(u[6]=15&u[6]|64,u[8]=63&u[8]|128,r)for(var a=0;a<16;++a)r[i+a]=u[a];return r||o(u)}},function(t,r,e){t.exports=e(16)},function(t,r,e){"use strict";var n,o=(n=e(2))&&n.__esModule?n:{default:n};function i(t){return new f(t)}function u(t){return function(){return new a(t.apply(this,arguments))}}function a(t){var r,e;function n(r,e){try{var i=t[r](e),u=i.value,a=u instanceof f;Promise.resolve(a?u.wrapped:u).then(function(t){a?n("next",t):o(i.done?"return":"normal",t)},function(t){n("throw",t)})}catch(s){o("throw",s)}}function o(t,o){switch(t){case"return":r.resolve({value:o,done:!0});break;case"throw":r.reject(o);break;default:r.resolve({value:o,done:!1})}(r=r.next)?n(r.key,r.arg):e=null}this._invoke=function(t,o){return new Promise(function(i,u){var a={key:t,arg:o,resolve:i,reject:u,next:null};e?e=e.next=a:(r=e=a,n(t,o))})},"function"!=typeof t.return&&(this.return=void 0)}function f(t){this.wrapped=t}function s(t){var r;if("undefined"!=typeof Symbol){if(Symbol.asyncIterator&&null!=(r=t[Symbol.asyncIterator]))return r.call(t);if(Symbol.iterator&&null!=(r=t[Symbol.iterator]))return r.call(t)}throw new TypeError("Object is not async iterable")}"function"==typeof Symbol&&Symbol.asyncIterator&&(a.prototype[Symbol.asyncIterator]=function(){return this}),a.prototype.next=function(t){return this._invoke("next",t)},a.prototype.throw=function(t){return this._invoke("throw",t)},a.prototype.return=function(t){return this._invoke("return",t)};var c=e(18),h=e(20),l=e(1);r.filter=function(t,r){return u(o.default.mark(function e(){var n,u,a,f,c,h,l;return o.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:n=!0,u=!1,e.prev=2,f=s(t);case 4:return e.next=6,i(f.next());case 6:return c=e.sent,n=c.done,e.next=10,i(c.value);case 10:if(h=e.sent,n){e.next=23;break}return l=h,e.next=15,i(r(l));case 15:if(e.sent){e.next=18;break}return e.abrupt("continue",20);case 18:return e.next=20,l;case 20:n=!0,e.next=4;break;case 23:e.next=29;break;case 25:e.prev=25,e.t0=e.catch(2),u=!0,a=e.t0;case 29:if(e.prev=29,e.prev=30,n||null==f.return){e.next=34;break}return e.next=34,i(f.return());case 34:if(e.prev=34,!u){e.next=37;break}throw a;case 37:return e.finish(34);case 38:return e.finish(29);case 39:case"end":return e.stop()}},e,null,[[2,25,29,39],[30,,34,38]])}))()},r.sortAll=function(t,r){return u(o.default.mark(function e(){var n,u,a,f,c,h,l,p,y,g,v,d,w,b;return o.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:n=[],u=!0,a=!1,e.prev=3,c=s(t);case 5:return e.next=7,i(c.next());case 7:return h=e.sent,u=h.done,e.next=11,i(h.value);case 11:if(l=e.sent,u){e.next=18;break}p=l,n.push(p);case 15:u=!0,e.next=5;break;case 18:e.next=24;break;case 20:e.prev=20,e.t0=e.catch(3),a=!0,f=e.t0;case 24:if(e.prev=24,e.prev=25,u||null==c.return){e.next=29;break}return e.next=29,i(c.return());case 29:if(e.prev=29,!a){e.next=32;break}throw f;case 32:return e.finish(29);case 33:return e.finish(24);case 34:return e.next=36,i(r(n));case 36:n=e.sent,y=!0,g=!1,v=void 0,e.prev=40,d=n[Symbol.iterator]();case 42:if(y=(w=d.next()).done){e.next=49;break}return b=w.value,e.next=46,b;case 46:y=!0,e.next=42;break;case 49:e.next=55;break;case 51:e.prev=51,e.t1=e.catch(40),g=!0,v=e.t1;case 55:e.prev=55,e.prev=56,y||null==d.return||d.return();case 58:if(e.prev=58,!g){e.next=61;break}throw v;case 61:return e.finish(58);case 62:return e.finish(55);case 63:case"end":return e.stop()}},e,null,[[3,20,24,34],[25,,29,33],[40,51,55,63],[56,,58,62]])}))()},r.take=function(t,r){return u(o.default.mark(function e(){var n,u,a,f,c,h,l,p;return o.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(!(r<=0)){e.next=2;break}return e.abrupt("return");case 2:n=0,u=!0,a=!1,e.prev=5,c=s(t);case 7:return e.next=9,i(c.next());case 9:return h=e.sent,u=h.done,e.next=13,i(h.value);case 13:if(l=e.sent,u){e.next=24;break}return p=l,e.next=18,p;case 18:if(!(++n>=r)){e.next=21;break}return e.abrupt("return");case 21:u=!0,e.next=7;break;case 24:e.next=30;break;case 26:e.prev=26,e.t0=e.catch(5),a=!0,f=e.t0;case 30:if(e.prev=30,e.prev=31,u||null==c.return){e.next=35;break}return e.next=35,i(c.return());case 35:if(e.prev=35,!a){e.next=38;break}throw f;case 38:return e.finish(35);case 39:return e.finish(30);case 40:case"end":return e.stop()}},e,null,[[5,26,30,40],[31,,35,39]])}))()},r.map=function(t,r){return u(o.default.mark(function e(){var n,u,a,f,c,h,l;return o.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:n=!0,u=!1,e.prev=2,f=s(t);case 4:return e.next=6,i(f.next());case 6:return c=e.sent,n=c.done,e.next=10,i(c.value);case 10:if(h=e.sent,n){e.next=18;break}return l=h,e.next=15,r(l);case 15:n=!0,e.next=4;break;case 18:e.next=24;break;case 20:e.prev=20,e.t0=e.catch(2),u=!0,a=e.t0;case 24:if(e.prev=24,e.prev=25,n||null==f.return){e.next=29;break}return e.next=29,i(f.return());case 29:if(e.prev=29,!u){e.next=32;break}throw a;case 32:return e.finish(29);case 33:return e.finish(24);case 34:case"end":return e.stop()}},e,null,[[2,20,24,34],[25,,29,33]])}))()},r.replaceStartWith=function(t,r){var e=new RegExp("^"+r);return t.replace(e,"")},r.tmpdir=function(){return c.join(h.tmpdir(),l())}},function(t,r,e){"use strict";var n=e(21);t.exports.dbOpenFailedError=function(t){return t=t||new Error("Cannot open database"),n(t,"ERR_DB_OPEN_FAILED")},t.exports.dbDeleteFailedError=function(t){return t=t||new Error("Delete failed"),n(t,"ERR_DB_DELETE_FAILED")},t.exports.dbWriteFailedError=function(t){return t=t||new Error("Write failed"),n(t,"ERR_DB_WRITE_FAILED")},t.exports.notFoundError=function(t){return t=t||new Error("Not Found"),n(t,"ERR_NOT_FOUND")}},function(t,r,e){t.exports=e(6)},function(t,r,e){"use strict";var n=e(0),o=e(15),i=e(3),u=e(4);r.Key=n,r.MemoryDatastore=o,r.utils=i,r.Errors=u},function(t,r,e){"use strict";(function(t){var n=e(9),o=e(10),i=e(11);function u(){return f.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function a(t,r){if(u()<r)throw new RangeError("Invalid typed array length");return f.TYPED_ARRAY_SUPPORT?(t=new Uint8Array(r)).__proto__=f.prototype:(null===t&&(t=new f(r)),t.length=r),t}function f(t,r,e){if(!(f.TYPED_ARRAY_SUPPORT||this instanceof f))return new f(t,r,e);if("number"==typeof t){if("string"==typeof r)throw new Error("If encoding is specified then the first argument must be a string");return h(this,t)}return s(this,t,r,e)}function s(t,r,e,n){if("number"==typeof r)throw new TypeError('"value" argument must not be a number');return"undefined"!=typeof ArrayBuffer&&r instanceof ArrayBuffer?function(t,r,e,n){if(r.byteLength,e<0||r.byteLength<e)throw new RangeError("'offset' is out of bounds");if(r.byteLength<e+(n||0))throw new RangeError("'length' is out of bounds");r=void 0===e&&void 0===n?new Uint8Array(r):void 0===n?new Uint8Array(r,e):new Uint8Array(r,e,n);f.TYPED_ARRAY_SUPPORT?(t=r).__proto__=f.prototype:t=l(t,r);return t}(t,r,e,n):"string"==typeof r?function(t,r,e){"string"==typeof e&&""!==e||(e="utf8");if(!f.isEncoding(e))throw new TypeError('"encoding" must be a valid string encoding');var n=0|y(r,e),o=(t=a(t,n)).write(r,e);o!==n&&(t=t.slice(0,o));return t}(t,r,e):function(t,r){if(f.isBuffer(r)){var e=0|p(r.length);return 0===(t=a(t,e)).length?t:(r.copy(t,0,0,e),t)}if(r){if("undefined"!=typeof ArrayBuffer&&r.buffer instanceof ArrayBuffer||"length"in r)return"number"!=typeof r.length||(n=r.length)!=n?a(t,0):l(t,r);if("Buffer"===r.type&&i(r.data))return l(t,r.data)}var n;throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}(t,r)}function c(t){if("number"!=typeof t)throw new TypeError('"size" argument must be a number');if(t<0)throw new RangeError('"size" argument must not be negative')}function h(t,r){if(c(r),t=a(t,r<0?0:0|p(r)),!f.TYPED_ARRAY_SUPPORT)for(var e=0;e<r;++e)t[e]=0;return t}function l(t,r){var e=r.length<0?0:0|p(r.length);t=a(t,e);for(var n=0;n<e;n+=1)t[n]=255&r[n];return t}function p(t){if(t>=u())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+u().toString(16)+" bytes");return 0|t}function y(t,r){if(f.isBuffer(t))return t.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(t)||t instanceof ArrayBuffer))return t.byteLength;"string"!=typeof t&&(t=""+t);var e=t.length;if(0===e)return 0;for(var n=!1;;)switch(r){case"ascii":case"latin1":case"binary":return e;case"utf8":case"utf-8":case void 0:return C(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*e;case"hex":return e>>>1;case"base64":return F(t).length;default:if(n)return C(t).length;r=(""+r).toLowerCase(),n=!0}}function g(t,r,e){var n=t[r];t[r]=t[e],t[e]=n}function v(t,r,e,n,o){if(0===t.length)return-1;if("string"==typeof e?(n=e,e=0):e>2147483647?e=2147483647:e<-2147483648&&(e=-2147483648),e=+e,isNaN(e)&&(e=o?0:t.length-1),e<0&&(e=t.length+e),e>=t.length){if(o)return-1;e=t.length-1}else if(e<0){if(!o)return-1;e=0}if("string"==typeof r&&(r=f.from(r,n)),f.isBuffer(r))return 0===r.length?-1:d(t,r,e,n,o);if("number"==typeof r)return r&=255,f.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?o?Uint8Array.prototype.indexOf.call(t,r,e):Uint8Array.prototype.lastIndexOf.call(t,r,e):d(t,[r],e,n,o);throw new TypeError("val must be string, number or Buffer")}function d(t,r,e,n,o){var i,u=1,a=t.length,f=r.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(t.length<2||r.length<2)return-1;u=2,a/=2,f/=2,e/=2}function s(t,r){return 1===u?t[r]:t.readUInt16BE(r*u)}if(o){var c=-1;for(i=e;i<a;i++)if(s(t,i)===s(r,-1===c?0:i-c)){if(-1===c&&(c=i),i-c+1===f)return c*u}else-1!==c&&(i-=i-c),c=-1}else for(e+f>a&&(e=a-f),i=e;i>=0;i--){for(var h=!0,l=0;l<f;l++)if(s(t,i+l)!==s(r,l)){h=!1;break}if(h)return i}return-1}function w(t,r,e,n){e=Number(e)||0;var o=t.length-e;n?(n=Number(n))>o&&(n=o):n=o;var i=r.length;if(i%2!=0)throw new TypeError("Invalid hex string");n>i/2&&(n=i/2);for(var u=0;u<n;++u){var a=parseInt(r.substr(2*u,2),16);if(isNaN(a))return u;t[e+u]=a}return u}function b(t,r,e,n){return z(C(r,t.length-e),t,e,n)}function m(t,r,e,n){return z(function(t){for(var r=[],e=0;e<t.length;++e)r.push(255&t.charCodeAt(e));return r}(r),t,e,n)}function E(t,r,e,n){return m(t,r,e,n)}function x(t,r,e,n){return z(F(r),t,e,n)}function _(t,r,e,n){return z(function(t,r){for(var e,n,o,i=[],u=0;u<t.length&&!((r-=2)<0);++u)e=t.charCodeAt(u),n=e>>8,o=e%256,i.push(o),i.push(n);return i}(r,t.length-e),t,e,n)}function A(t,r,e){return 0===r&&e===t.length?n.fromByteArray(t):n.fromByteArray(t.slice(r,e))}function S(t,r,e){e=Math.min(t.length,e);for(var n=[],o=r;o<e;){var i,u,a,f,s=t[o],c=null,h=s>239?4:s>223?3:s>191?2:1;if(o+h<=e)switch(h){case 1:s<128&&(c=s);break;case 2:128==(192&(i=t[o+1]))&&(f=(31&s)<<6|63&i)>127&&(c=f);break;case 3:i=t[o+1],u=t[o+2],128==(192&i)&&128==(192&u)&&(f=(15&s)<<12|(63&i)<<6|63&u)>2047&&(f<55296||f>57343)&&(c=f);break;case 4:i=t[o+1],u=t[o+2],a=t[o+3],128==(192&i)&&128==(192&u)&&128==(192&a)&&(f=(15&s)<<18|(63&i)<<12|(63&u)<<6|63&a)>65535&&f<1114112&&(c=f)}null===c?(c=65533,h=1):c>65535&&(c-=65536,n.push(c>>>10&1023|55296),c=56320|1023&c),n.push(c),o+=h}return function(t){var r=t.length;if(r<=k)return String.fromCharCode.apply(String,t);var e="",n=0;for(;n<r;)e+=String.fromCharCode.apply(String,t.slice(n,n+=k));return e}(n)}r.Buffer=f,r.SlowBuffer=function(t){+t!=t&&(t=0);return f.alloc(+t)},r.INSPECT_MAX_BYTES=50,f.TYPED_ARRAY_SUPPORT=void 0!==t.TYPED_ARRAY_SUPPORT?t.TYPED_ARRAY_SUPPORT:function(){try{var t=new Uint8Array(1);return t.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===t.foo()&&"function"==typeof t.subarray&&0===t.subarray(1,1).byteLength}catch(r){return!1}}(),r.kMaxLength=u(),f.poolSize=8192,f._augment=function(t){return t.__proto__=f.prototype,t},f.from=function(t,r,e){return s(null,t,r,e)},f.TYPED_ARRAY_SUPPORT&&(f.prototype.__proto__=Uint8Array.prototype,f.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&f[Symbol.species]===f&&Object.defineProperty(f,Symbol.species,{value:null,configurable:!0})),f.alloc=function(t,r,e){return function(t,r,e,n){return c(r),r<=0?a(t,r):void 0!==e?"string"==typeof n?a(t,r).fill(e,n):a(t,r).fill(e):a(t,r)}(null,t,r,e)},f.allocUnsafe=function(t){return h(null,t)},f.allocUnsafeSlow=function(t){return h(null,t)},f.isBuffer=function(t){return!(null==t||!t._isBuffer)},f.compare=function(t,r){if(!f.isBuffer(t)||!f.isBuffer(r))throw new TypeError("Arguments must be Buffers");if(t===r)return 0;for(var e=t.length,n=r.length,o=0,i=Math.min(e,n);o<i;++o)if(t[o]!==r[o]){e=t[o],n=r[o];break}return e<n?-1:n<e?1:0},f.isEncoding=function(t){switch(String(t).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},f.concat=function(t,r){if(!i(t))throw new TypeError('"list" argument must be an Array of Buffers');if(0===t.length)return f.alloc(0);var e;if(void 0===r)for(r=0,e=0;e<t.length;++e)r+=t[e].length;var n=f.allocUnsafe(r),o=0;for(e=0;e<t.length;++e){var u=t[e];if(!f.isBuffer(u))throw new TypeError('"list" argument must be an Array of Buffers');u.copy(n,o),o+=u.length}return n},f.byteLength=y,f.prototype._isBuffer=!0,f.prototype.swap16=function(){var t=this.length;if(t%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var r=0;r<t;r+=2)g(this,r,r+1);return this},f.prototype.swap32=function(){var t=this.length;if(t%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var r=0;r<t;r+=4)g(this,r,r+3),g(this,r+1,r+2);return this},f.prototype.swap64=function(){var t=this.length;if(t%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var r=0;r<t;r+=8)g(this,r,r+7),g(this,r+1,r+6),g(this,r+2,r+5),g(this,r+3,r+4);return this},f.prototype.toString=function(){var t=0|this.length;return 0===t?"":0===arguments.length?S(this,0,t):function(t,r,e){var n=!1;if((void 0===r||r<0)&&(r=0),r>this.length)return"";if((void 0===e||e>this.length)&&(e=this.length),e<=0)return"";if((e>>>=0)<=(r>>>=0))return"";for(t||(t="utf8");;)switch(t){case"hex":return P(this,r,e);case"utf8":case"utf-8":return S(this,r,e);case"ascii":return R(this,r,e);case"latin1":case"binary":return T(this,r,e);case"base64":return A(this,r,e);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return O(this,r,e);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}.apply(this,arguments)},f.prototype.equals=function(t){if(!f.isBuffer(t))throw new TypeError("Argument must be a Buffer");return this===t||0===f.compare(this,t)},f.prototype.inspect=function(){var t="",e=r.INSPECT_MAX_BYTES;return this.length>0&&(t=this.toString("hex",0,e).match(/.{2}/g).join(" "),this.length>e&&(t+=" ... ")),"<Buffer "+t+">"},f.prototype.compare=function(t,r,e,n,o){if(!f.isBuffer(t))throw new TypeError("Argument must be a Buffer");if(void 0===r&&(r=0),void 0===e&&(e=t?t.length:0),void 0===n&&(n=0),void 0===o&&(o=this.length),r<0||e>t.length||n<0||o>this.length)throw new RangeError("out of range index");if(n>=o&&r>=e)return 0;if(n>=o)return-1;if(r>=e)return 1;if(this===t)return 0;for(var i=(o>>>=0)-(n>>>=0),u=(e>>>=0)-(r>>>=0),a=Math.min(i,u),s=this.slice(n,o),c=t.slice(r,e),h=0;h<a;++h)if(s[h]!==c[h]){i=s[h],u=c[h];break}return i<u?-1:u<i?1:0},f.prototype.includes=function(t,r,e){return-1!==this.indexOf(t,r,e)},f.prototype.indexOf=function(t,r,e){return v(this,t,r,e,!0)},f.prototype.lastIndexOf=function(t,r,e){return v(this,t,r,e,!1)},f.prototype.write=function(t,r,e,n){if(void 0===r)n="utf8",e=this.length,r=0;else if(void 0===e&&"string"==typeof r)n=r,e=this.length,r=0;else{if(!isFinite(r))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");r|=0,isFinite(e)?(e|=0,void 0===n&&(n="utf8")):(n=e,e=void 0)}var o=this.length-r;if((void 0===e||e>o)&&(e=o),t.length>0&&(e<0||r<0)||r>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var i=!1;;)switch(n){case"hex":return w(this,t,r,e);case"utf8":case"utf-8":return b(this,t,r,e);case"ascii":return m(this,t,r,e);case"latin1":case"binary":return E(this,t,r,e);case"base64":return x(this,t,r,e);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return _(this,t,r,e);default:if(i)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),i=!0}},f.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var k=4096;function R(t,r,e){var n="";e=Math.min(t.length,e);for(var o=r;o<e;++o)n+=String.fromCharCode(127&t[o]);return n}function T(t,r,e){var n="";e=Math.min(t.length,e);for(var o=r;o<e;++o)n+=String.fromCharCode(t[o]);return n}function P(t,r,e){var n=t.length;(!r||r<0)&&(r=0),(!e||e<0||e>n)&&(e=n);for(var o="",i=r;i<e;++i)o+=M(t[i]);return o}function O(t,r,e){for(var n=t.slice(r,e),o="",i=0;i<n.length;i+=2)o+=String.fromCharCode(n[i]+256*n[i+1]);return o}function L(t,r,e){if(t%1!=0||t<0)throw new RangeError("offset is not uint");if(t+r>e)throw new RangeError("Trying to access beyond buffer length")}function B(t,r,e,n,o,i){if(!f.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(r>o||r<i)throw new RangeError('"value" argument is out of bounds');if(e+n>t.length)throw new RangeError("Index out of range")}function j(t,r,e,n){r<0&&(r=65535+r+1);for(var o=0,i=Math.min(t.length-e,2);o<i;++o)t[e+o]=(r&255<<8*(n?o:1-o))>>>8*(n?o:1-o)}function U(t,r,e,n){r<0&&(r=4294967295+r+1);for(var o=0,i=Math.min(t.length-e,4);o<i;++o)t[e+o]=r>>>8*(n?o:3-o)&255}function I(t,r,e,n,o,i){if(e+n>t.length)throw new RangeError("Index out of range");if(e<0)throw new RangeError("Index out of range")}function Y(t,r,e,n,i){return i||I(t,0,e,4),o.write(t,r,e,n,23,4),e+4}function D(t,r,e,n,i){return i||I(t,0,e,8),o.write(t,r,e,n,52,8),e+8}f.prototype.slice=function(t,r){var e,n=this.length;if((t=~~t)<0?(t+=n)<0&&(t=0):t>n&&(t=n),(r=void 0===r?n:~~r)<0?(r+=n)<0&&(r=0):r>n&&(r=n),r<t&&(r=t),f.TYPED_ARRAY_SUPPORT)(e=this.subarray(t,r)).__proto__=f.prototype;else{var o=r-t;e=new f(o,void 0);for(var i=0;i<o;++i)e[i]=this[i+t]}return e},f.prototype.readUIntLE=function(t,r,e){t|=0,r|=0,e||L(t,r,this.length);for(var n=this[t],o=1,i=0;++i<r&&(o*=256);)n+=this[t+i]*o;return n},f.prototype.readUIntBE=function(t,r,e){t|=0,r|=0,e||L(t,r,this.length);for(var n=this[t+--r],o=1;r>0&&(o*=256);)n+=this[t+--r]*o;return n},f.prototype.readUInt8=function(t,r){return r||L(t,1,this.length),this[t]},f.prototype.readUInt16LE=function(t,r){return r||L(t,2,this.length),this[t]|this[t+1]<<8},f.prototype.readUInt16BE=function(t,r){return r||L(t,2,this.length),this[t]<<8|this[t+1]},f.prototype.readUInt32LE=function(t,r){return r||L(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},f.prototype.readUInt32BE=function(t,r){return r||L(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},f.prototype.readIntLE=function(t,r,e){t|=0,r|=0,e||L(t,r,this.length);for(var n=this[t],o=1,i=0;++i<r&&(o*=256);)n+=this[t+i]*o;return n>=(o*=128)&&(n-=Math.pow(2,8*r)),n},f.prototype.readIntBE=function(t,r,e){t|=0,r|=0,e||L(t,r,this.length);for(var n=r,o=1,i=this[t+--n];n>0&&(o*=256);)i+=this[t+--n]*o;return i>=(o*=128)&&(i-=Math.pow(2,8*r)),i},f.prototype.readInt8=function(t,r){return r||L(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},f.prototype.readInt16LE=function(t,r){r||L(t,2,this.length);var e=this[t]|this[t+1]<<8;return 32768&e?4294901760|e:e},f.prototype.readInt16BE=function(t,r){r||L(t,2,this.length);var e=this[t+1]|this[t]<<8;return 32768&e?4294901760|e:e},f.prototype.readInt32LE=function(t,r){return r||L(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},f.prototype.readInt32BE=function(t,r){return r||L(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},f.prototype.readFloatLE=function(t,r){return r||L(t,4,this.length),o.read(this,t,!0,23,4)},f.prototype.readFloatBE=function(t,r){return r||L(t,4,this.length),o.read(this,t,!1,23,4)},f.prototype.readDoubleLE=function(t,r){return r||L(t,8,this.length),o.read(this,t,!0,52,8)},f.prototype.readDoubleBE=function(t,r){return r||L(t,8,this.length),o.read(this,t,!1,52,8)},f.prototype.writeUIntLE=function(t,r,e,n){(t=+t,r|=0,e|=0,n)||B(this,t,r,e,Math.pow(2,8*e)-1,0);var o=1,i=0;for(this[r]=255&t;++i<e&&(o*=256);)this[r+i]=t/o&255;return r+e},f.prototype.writeUIntBE=function(t,r,e,n){(t=+t,r|=0,e|=0,n)||B(this,t,r,e,Math.pow(2,8*e)-1,0);var o=e-1,i=1;for(this[r+o]=255&t;--o>=0&&(i*=256);)this[r+o]=t/i&255;return r+e},f.prototype.writeUInt8=function(t,r,e){return t=+t,r|=0,e||B(this,t,r,1,255,0),f.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),this[r]=255&t,r+1},f.prototype.writeUInt16LE=function(t,r,e){return t=+t,r|=0,e||B(this,t,r,2,65535,0),f.TYPED_ARRAY_SUPPORT?(this[r]=255&t,this[r+1]=t>>>8):j(this,t,r,!0),r+2},f.prototype.writeUInt16BE=function(t,r,e){return t=+t,r|=0,e||B(this,t,r,2,65535,0),f.TYPED_ARRAY_SUPPORT?(this[r]=t>>>8,this[r+1]=255&t):j(this,t,r,!1),r+2},f.prototype.writeUInt32LE=function(t,r,e){return t=+t,r|=0,e||B(this,t,r,4,4294967295,0),f.TYPED_ARRAY_SUPPORT?(this[r+3]=t>>>24,this[r+2]=t>>>16,this[r+1]=t>>>8,this[r]=255&t):U(this,t,r,!0),r+4},f.prototype.writeUInt32BE=function(t,r,e){return t=+t,r|=0,e||B(this,t,r,4,4294967295,0),f.TYPED_ARRAY_SUPPORT?(this[r]=t>>>24,this[r+1]=t>>>16,this[r+2]=t>>>8,this[r+3]=255&t):U(this,t,r,!1),r+4},f.prototype.writeIntLE=function(t,r,e,n){if(t=+t,r|=0,!n){var o=Math.pow(2,8*e-1);B(this,t,r,e,o-1,-o)}var i=0,u=1,a=0;for(this[r]=255&t;++i<e&&(u*=256);)t<0&&0===a&&0!==this[r+i-1]&&(a=1),this[r+i]=(t/u>>0)-a&255;return r+e},f.prototype.writeIntBE=function(t,r,e,n){if(t=+t,r|=0,!n){var o=Math.pow(2,8*e-1);B(this,t,r,e,o-1,-o)}var i=e-1,u=1,a=0;for(this[r+i]=255&t;--i>=0&&(u*=256);)t<0&&0===a&&0!==this[r+i+1]&&(a=1),this[r+i]=(t/u>>0)-a&255;return r+e},f.prototype.writeInt8=function(t,r,e){return t=+t,r|=0,e||B(this,t,r,1,127,-128),f.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),t<0&&(t=255+t+1),this[r]=255&t,r+1},f.prototype.writeInt16LE=function(t,r,e){return t=+t,r|=0,e||B(this,t,r,2,32767,-32768),f.TYPED_ARRAY_SUPPORT?(this[r]=255&t,this[r+1]=t>>>8):j(this,t,r,!0),r+2},f.prototype.writeInt16BE=function(t,r,e){return t=+t,r|=0,e||B(this,t,r,2,32767,-32768),f.TYPED_ARRAY_SUPPORT?(this[r]=t>>>8,this[r+1]=255&t):j(this,t,r,!1),r+2},f.prototype.writeInt32LE=function(t,r,e){return t=+t,r|=0,e||B(this,t,r,4,2147483647,-2147483648),f.TYPED_ARRAY_SUPPORT?(this[r]=255&t,this[r+1]=t>>>8,this[r+2]=t>>>16,this[r+3]=t>>>24):U(this,t,r,!0),r+4},f.prototype.writeInt32BE=function(t,r,e){return t=+t,r|=0,e||B(this,t,r,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),f.TYPED_ARRAY_SUPPORT?(this[r]=t>>>24,this[r+1]=t>>>16,this[r+2]=t>>>8,this[r+3]=255&t):U(this,t,r,!1),r+4},f.prototype.writeFloatLE=function(t,r,e){return Y(this,t,r,!0,e)},f.prototype.writeFloatBE=function(t,r,e){return Y(this,t,r,!1,e)},f.prototype.writeDoubleLE=function(t,r,e){return D(this,t,r,!0,e)},f.prototype.writeDoubleBE=function(t,r,e){return D(this,t,r,!1,e)},f.prototype.copy=function(t,r,e,n){if(e||(e=0),n||0===n||(n=this.length),r>=t.length&&(r=t.length),r||(r=0),n>0&&n<e&&(n=e),n===e)return 0;if(0===t.length||0===this.length)return 0;if(r<0)throw new RangeError("targetStart out of bounds");if(e<0||e>=this.length)throw new RangeError("sourceStart out of bounds");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),t.length-r<n-e&&(n=t.length-r+e);var o,i=n-e;if(this===t&&e<r&&r<n)for(o=i-1;o>=0;--o)t[o+r]=this[o+e];else if(i<1e3||!f.TYPED_ARRAY_SUPPORT)for(o=0;o<i;++o)t[o+r]=this[o+e];else Uint8Array.prototype.set.call(t,this.subarray(e,e+i),r);return i},f.prototype.fill=function(t,r,e,n){if("string"==typeof t){if("string"==typeof r?(n=r,r=0,e=this.length):"string"==typeof e&&(n=e,e=this.length),1===t.length){var o=t.charCodeAt(0);o<256&&(t=o)}if(void 0!==n&&"string"!=typeof n)throw new TypeError("encoding must be a string");if("string"==typeof n&&!f.isEncoding(n))throw new TypeError("Unknown encoding: "+n)}else"number"==typeof t&&(t&=255);if(r<0||this.length<r||this.length<e)throw new RangeError("Out of range index");if(e<=r)return this;var i;if(r>>>=0,e=void 0===e?this.length:e>>>0,t||(t=0),"number"==typeof t)for(i=r;i<e;++i)this[i]=t;else{var u=f.isBuffer(t)?t:C(new f(t,n).toString()),a=u.length;for(i=0;i<e-r;++i)this[i+r]=u[i%a]}return this};var N=/[^+\/0-9A-Za-z-_]/g;function M(t){return t<16?"0"+t.toString(16):t.toString(16)}function C(t,r){var e;r=r||1/0;for(var n=t.length,o=null,i=[],u=0;u<n;++u){if((e=t.charCodeAt(u))>55295&&e<57344){if(!o){if(e>56319){(r-=3)>-1&&i.push(239,191,189);continue}if(u+1===n){(r-=3)>-1&&i.push(239,191,189);continue}o=e;continue}if(e<56320){(r-=3)>-1&&i.push(239,191,189),o=e;continue}e=65536+(o-55296<<10|e-56320)}else o&&(r-=3)>-1&&i.push(239,191,189);if(o=null,e<128){if((r-=1)<0)break;i.push(e)}else if(e<2048){if((r-=2)<0)break;i.push(e>>6|192,63&e|128)}else if(e<65536){if((r-=3)<0)break;i.push(e>>12|224,e>>6&63|128,63&e|128)}else{if(!(e<1114112))throw new Error("Invalid code point");if((r-=4)<0)break;i.push(e>>18|240,e>>12&63|128,e>>6&63|128,63&e|128)}}return i}function F(t){return n.toByteArray(function(t){if((t=function(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}(t).replace(N,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function z(t,r,e,n){for(var o=0;o<n&&!(o+e>=r.length||o>=t.length);++o)r[o+e]=t[o];return o}}).call(this,e(8))},function(t,r,e){"use strict";function n(t){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var o;o=function(){return this}();try{o=o||new Function("return this")()}catch(i){"object"===("undefined"==typeof window?"undefined":n(window))&&(o=window)}t.exports=o},function(t,r,e){"use strict";r.byteLength=function(t){var r=s(t),e=r[0],n=r[1];return 3*(e+n)/4-n},r.toByteArray=function(t){for(var r,e=s(t),n=e[0],u=e[1],a=new i(function(t,r,e){return 3*(r+e)/4-e}(0,n,u)),f=0,c=u>0?n-4:n,h=0;h<c;h+=4)r=o[t.charCodeAt(h)]<<18|o[t.charCodeAt(h+1)]<<12|o[t.charCodeAt(h+2)]<<6|o[t.charCodeAt(h+3)],a[f++]=r>>16&255,a[f++]=r>>8&255,a[f++]=255&r;2===u&&(r=o[t.charCodeAt(h)]<<2|o[t.charCodeAt(h+1)]>>4,a[f++]=255&r);1===u&&(r=o[t.charCodeAt(h)]<<10|o[t.charCodeAt(h+1)]<<4|o[t.charCodeAt(h+2)]>>2,a[f++]=r>>8&255,a[f++]=255&r);return a},r.fromByteArray=function(t){for(var r,e=t.length,o=e%3,i=[],u=0,a=e-o;u<a;u+=16383)i.push(c(t,u,u+16383>a?a:u+16383));1===o?(r=t[e-1],i.push(n[r>>2]+n[r<<4&63]+"==")):2===o&&(r=(t[e-2]<<8)+t[e-1],i.push(n[r>>10]+n[r>>4&63]+n[r<<2&63]+"="));return i.join("")};for(var n=[],o=[],i="undefined"!=typeof Uint8Array?Uint8Array:Array,u="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",a=0,f=u.length;a<f;++a)n[a]=u[a],o[u.charCodeAt(a)]=a;function s(t){var r=t.length;if(r%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var e=t.indexOf("=");return-1===e&&(e=r),[e,e===r?0:4-e%4]}function c(t,r,e){for(var o,i,u=[],a=r;a<e;a+=3)o=(t[a]<<16&16711680)+(t[a+1]<<8&65280)+(255&t[a+2]),u.push(n[(i=o)>>18&63]+n[i>>12&63]+n[i>>6&63]+n[63&i]);return u.join("")}o["-".charCodeAt(0)]=62,o["_".charCodeAt(0)]=63},function(t,r,e){"use strict";r.read=function(t,r,e,n,o){var i,u,a=8*o-n-1,f=(1<<a)-1,s=f>>1,c=-7,h=e?o-1:0,l=e?-1:1,p=t[r+h];for(h+=l,i=p&(1<<-c)-1,p>>=-c,c+=a;c>0;i=256*i+t[r+h],h+=l,c-=8);for(u=i&(1<<-c)-1,i>>=-c,c+=n;c>0;u=256*u+t[r+h],h+=l,c-=8);if(0===i)i=1-s;else{if(i===f)return u?NaN:1/0*(p?-1:1);u+=Math.pow(2,n),i-=s}return(p?-1:1)*u*Math.pow(2,i-n)},r.write=function(t,r,e,n,o,i){var u,a,f,s=8*i-o-1,c=(1<<s)-1,h=c>>1,l=23===o?Math.pow(2,-24)-Math.pow(2,-77):0,p=n?0:i-1,y=n?1:-1,g=r<0||0===r&&1/r<0?1:0;for(r=Math.abs(r),isNaN(r)||r===1/0?(a=isNaN(r)?1:0,u=c):(u=Math.floor(Math.log(r)/Math.LN2),r*(f=Math.pow(2,-u))<1&&(u--,f*=2),(r+=u+h>=1?l/f:l*Math.pow(2,1-h))*f>=2&&(u++,f/=2),u+h>=c?(a=0,u=c):u+h>=1?(a=(r*f-1)*Math.pow(2,o),u+=h):(a=r*Math.pow(2,h-1)*Math.pow(2,o),u=0));o>=8;t[e+p]=255&a,p+=y,a/=256,o-=8);for(u=u<<o|a,s+=o;s>0;t[e+p]=255&u,p+=y,u/=256,s-=8);t[e+p-y]|=128*g}},function(t,r,e){"use strict";var n={}.toString;t.exports=Array.isArray||function(t){return"[object Array]"==n.call(t)}},function(t,r,e){"use strict";var n="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof window.msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto);if(n){var o=new Uint8Array(16);t.exports=function(){return n(o),o}}else{var i=new Array(16);t.exports=function(){for(var t,r=0;r<16;r++)0==(3&r)&&(t=4294967296*Math.random()),i[r]=t>>>((3&r)<<3)&255;return i}}},function(t,r,e){"use strict";for(var n=[],o=0;o<256;++o)n[o]=(o+256).toString(16).substr(1);t.exports=function(t,r){var e=r||0,o=n;return[o[t[e++]],o[t[e++]],o[t[e++]],o[t[e++]],"-",o[t[e++]],o[t[e++]],"-",o[t[e++]],o[t[e++]],"-",o[t[e++]],o[t[e++]],"-",o[t[e++]],o[t[e++]],o[t[e++]],o[t[e++]],o[t[e++]],o[t[e++]]].join("")}},function(t,r,e){"use strict";function n(t){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function o(t,r,e){return(o=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(t){return!1}}()?Reflect.construct:function(t,r,e){var n=[null];n.push.apply(n,r);var o=new(Function.bind.apply(t,n));return e&&s(o,e.prototype),o}).apply(null,arguments)}function i(t,r,e){return r in t?Object.defineProperty(t,r,{value:e,enumerable:!0,configurable:!0,writable:!0}):t[r]=e,t}function u(t,r){for(var e=0;e<r.length;e++){var n=r[e];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function a(t){return(a=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function f(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function s(t,r){return(s=Object.setPrototypeOf||function(t,r){return t.__proto__=r,t})(t,r)}t.exports=function(t,r){var e=r.className,o=r.symbolName,c=Symbol.for(o),h=i({},e,function(r){function o(){var t,r,e,i;!function(t,r){if(!(t instanceof r))throw new TypeError("Cannot call a class as a function")}(this,o);for(var u=arguments.length,s=new Array(u),h=0;h<u;h++)s[h]=arguments[h];return e=this,r=!(i=(t=a(o)).call.apply(t,[this].concat(s)))||"object"!==n(i)&&"function"!=typeof i?f(e):i,Object.defineProperty(f(r),c,{value:!0}),r}var i,h,l;return function(t,r){if("function"!=typeof r&&null!==r)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(r&&r.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),r&&s(t,r)}(o,t),i=o,(h=[{key:Symbol.toStringTag,get:function(){return e}}])&&u(i.prototype,h),l&&u(i,l),o}())[e];return h["is".concat(e)]=function(t){return!(!t||!t[c])},h},t.exports.proto=function(t,r){var e=r.className,n=r.symbolName,u=r.withoutNew,a=Symbol.for(n),f=i({},e,function(){for(var r=arguments.length,e=new Array(r),n=0;n<r;n++)e[n]=arguments[n];if(u&&!(this instanceof f))return o(f,e);var i=t.call.apply(t,[this].concat(e))||this;return i&&!i[a]&&Object.defineProperty(i,a,{value:!0}),i})[e];return f.prototype=Object.create(t.prototype),f.prototype.constructor=f,Object.defineProperty(f.prototype,Symbol.toStringTag,{get:function(){return e}}),f["is".concat(e)]=function(t){return!(!t||!t[a])},f}},function(t,r,e){"use strict";var n,o=(n=e(2))&&n.__esModule?n:{default:n};function i(t,r,e,n,o,i,u){try{var a=t[i](u),f=a.value}catch(s){return void e(s)}a.done?r(f):Promise.resolve(f).then(n,o)}function u(t){return function(){var r=this,e=arguments;return new Promise(function(n,o){var u=t.apply(r,e);function a(t){i(u,n,o,a,f,"next",t)}function f(t){i(u,n,o,a,f,"throw",t)}a(void 0)})}}function a(t,r){for(var e=0;e<r.length;e++){var n=r[e];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}var f=e(3),s=f.filter,c=f.sortAll,h=f.take,l=f.map,p=e(0),y=e(4),g=function(){function t(){!function(t,r){if(!(t instanceof r))throw new TypeError("Cannot call a class as a function")}(this,t),this.data={}}var r,e,n;return r=t,(e=[{key:"open",value:function(){var t=u(o.default.mark(function t(){return o.default.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:case"end":return t.stop()}},t)}));return function(){return t.apply(this,arguments)}}()},{key:"put",value:function(){var t=u(o.default.mark(function t(r,e){return o.default.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:this.data[r.toString()]=e;case 1:case"end":return t.stop()}},t,this)}));return function(r,e){return t.apply(this,arguments)}}()},{key:"get",value:function(){var t=u(o.default.mark(function t(r){return o.default.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.has(r);case 2:if(t.sent){t.next=5;break}throw y.notFoundError();case 5:return t.abrupt("return",this.data[r.toString()]);case 6:case"end":return t.stop()}},t,this)}));return function(r){return t.apply(this,arguments)}}()},{key:"has",value:function(){var t=u(o.default.mark(function t(r){return o.default.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",void 0!==this.data[r.toString()]);case 1:case"end":return t.stop()}},t,this)}));return function(r){return t.apply(this,arguments)}}()},{key:"delete",value:function(){var t=u(o.default.mark(function t(r){return o.default.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:delete this.data[r.toString()];case 1:case"end":return t.stop()}},t,this)}));return function(r){return t.apply(this,arguments)}}()},{key:"batch",value:function(){var t=this,r=[],e=[];return{put:function(t,e){r.push([t,e])},delete:function(t){e.push(t)},commit:function(){var n=u(o.default.mark(function n(){return o.default.wrap(function(n){for(;;)switch(n.prev=n.next){case 0:r.forEach(function(r){t.data[r[0].toString()]=r[1]}),r=[],e.forEach(function(r){delete t.data[r.toString()]}),e=[];case 4:case"end":return n.stop()}},n)}));return function(){return n.apply(this,arguments)}}()}}},{key:"query",value:function(t){var r=Object.entries(this.data);if(r=l(r,function(t){return{key:new p(t[0]),value:t[1]}}),null!=t.prefix&&(r=s(r,function(r){return r.key.toString().startsWith(t.prefix)})),Array.isArray(t.filters)&&(r=t.filters.reduce(function(t,r){return s(t,r)},r)),Array.isArray(t.orders)&&(r=t.orders.reduce(function(t,r){return c(t,r)},r)),null!=t.offset){var e=0;r=s(r,function(){return e++>=t.offset})}return null!=t.limit&&(r=h(r,t.limit)),!0===t.keysOnly&&(r=l(r,function(t){return{key:t.key}})),r}},{key:"close",value:function(){var t=u(o.default.mark(function t(){return o.default.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:case"end":return t.stop()}},t)}));return function(){return t.apply(this,arguments)}}()}])&&a(r.prototype,e),n&&a(r,n),t}();t.exports=g},function(t,r,e){"use strict";(function(t){function r(t){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var e=function(t){var e,n=Object.prototype,o=n.hasOwnProperty,i="function"==typeof Symbol?Symbol:{},u=i.iterator||"@@iterator",a=i.asyncIterator||"@@asyncIterator",f=i.toStringTag||"@@toStringTag";function s(t,r,e,n){var o=r&&r.prototype instanceof v?r:v,i=Object.create(o.prototype),u=new T(n||[]);return i._invoke=function(t,r,e){var n=h;return function(o,i){if(n===p)throw new Error("Generator is already running");if(n===y){if("throw"===o)throw i;return O()}for(e.method=o,e.arg=i;;){var u=e.delegate;if(u){var a=S(u,e);if(a){if(a===g)continue;return a}}if("next"===e.method)e.sent=e._sent=e.arg;else if("throw"===e.method){if(n===h)throw n=y,e.arg;e.dispatchException(e.arg)}else"return"===e.method&&e.abrupt("return",e.arg);n=p;var f=c(t,r,e);if("normal"===f.type){if(n=e.done?y:l,f.arg===g)continue;return{value:f.arg,done:e.done}}"throw"===f.type&&(n=y,e.method="throw",e.arg=f.arg)}}}(t,e,u),i}function c(t,r,e){try{return{type:"normal",arg:t.call(r,e)}}catch(n){return{type:"throw",arg:n}}}t.wrap=s;var h="suspendedStart",l="suspendedYield",p="executing",y="completed",g={};function v(){}function d(){}function w(){}var b={};b[u]=function(){return this};var m=Object.getPrototypeOf,E=m&&m(m(P([])));E&&E!==n&&o.call(E,u)&&(b=E);var x=w.prototype=v.prototype=Object.create(b);function _(t){["next","throw","return"].forEach(function(r){t[r]=function(t){return this._invoke(r,t)}})}function A(t){var e;this._invoke=function(n,i){function u(){return new Promise(function(e,u){!function e(n,i,u,a){var f=c(t[n],t,i);if("throw"!==f.type){var s=f.arg,h=s.value;return h&&"object"===r(h)&&o.call(h,"__await")?Promise.resolve(h.__await).then(function(t){e("next",t,u,a)},function(t){e("throw",t,u,a)}):Promise.resolve(h).then(function(t){s.value=t,u(s)},function(t){return e("throw",t,u,a)})}a(f.arg)}(n,i,e,u)})}return e=e?e.then(u,u):u()}}function S(t,r){var n=t.iterator[r.method];if(n===e){if(r.delegate=null,"throw"===r.method){if(t.iterator.return&&(r.method="return",r.arg=e,S(t,r),"throw"===r.method))return g;r.method="throw",r.arg=new TypeError("The iterator does not provide a 'throw' method")}return g}var o=c(n,t.iterator,r.arg);if("throw"===o.type)return r.method="throw",r.arg=o.arg,r.delegate=null,g;var i=o.arg;return i?i.done?(r[t.resultName]=i.value,r.next=t.nextLoc,"return"!==r.method&&(r.method="next",r.arg=e),r.delegate=null,g):i:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,g)}function k(t){var r={tryLoc:t[0]};1 in t&&(r.catchLoc=t[1]),2 in t&&(r.finallyLoc=t[2],r.afterLoc=t[3]),this.tryEntries.push(r)}function R(t){var r=t.completion||{};r.type="normal",delete r.arg,t.completion=r}function T(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(k,this),this.reset(!0)}function P(t){if(t){var r=t[u];if(r)return r.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var n=-1,i=function r(){for(;++n<t.length;)if(o.call(t,n))return r.value=t[n],r.done=!1,r;return r.value=e,r.done=!0,r};return i.next=i}}return{next:O}}function O(){return{value:e,done:!0}}return d.prototype=x.constructor=w,w.constructor=d,w[f]=d.displayName="GeneratorFunction",t.isGeneratorFunction=function(t){var r="function"==typeof t&&t.constructor;return!!r&&(r===d||"GeneratorFunction"===(r.displayName||r.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,w):(t.__proto__=w,f in t||(t[f]="GeneratorFunction")),t.prototype=Object.create(x),t},t.awrap=function(t){return{__await:t}},_(A.prototype),A.prototype[a]=function(){return this},t.AsyncIterator=A,t.async=function(r,e,n,o){var i=new A(s(r,e,n,o));return t.isGeneratorFunction(e)?i:i.next().then(function(t){return t.done?t.value:i.next()})},_(x),x[f]="Generator",x[u]=function(){return this},x.toString=function(){return"[object Generator]"},t.keys=function(t){var r=[];for(var e in t)r.push(e);return r.reverse(),function e(){for(;r.length;){var n=r.pop();if(n in t)return e.value=n,e.done=!1,e}return e.done=!0,e}},t.values=P,T.prototype={constructor:T,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(R),!t)for(var r in this)"t"===r.charAt(0)&&o.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=e)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var r=this;function n(n,o){return a.type="throw",a.arg=t,r.next=n,o&&(r.method="next",r.arg=e),!!o}for(var i=this.tryEntries.length-1;i>=0;--i){var u=this.tryEntries[i],a=u.completion;if("root"===u.tryLoc)return n("end");if(u.tryLoc<=this.prev){var f=o.call(u,"catchLoc"),s=o.call(u,"finallyLoc");if(f&&s){if(this.prev<u.catchLoc)return n(u.catchLoc,!0);if(this.prev<u.finallyLoc)return n(u.finallyLoc)}else if(f){if(this.prev<u.catchLoc)return n(u.catchLoc,!0)}else{if(!s)throw new Error("try statement without catch or finally");if(this.prev<u.finallyLoc)return n(u.finallyLoc)}}}},abrupt:function(t,r){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc<=this.prev&&o.call(n,"finallyLoc")&&this.prev<n.finallyLoc){var i=n;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=r&&r<=i.finallyLoc&&(i=null);var u=i?i.completion:{};return u.type=t,u.arg=r,i?(this.method="next",this.next=i.finallyLoc,g):this.complete(u)},complete:function(t,r){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&r&&(this.next=r),g},finish:function(t){for(var r=this.tryEntries.length-1;r>=0;--r){var e=this.tryEntries[r];if(e.finallyLoc===t)return this.complete(e.completion,e.afterLoc),R(e),g}},catch:function(t){for(var r=this.tryEntries.length-1;r>=0;--r){var e=this.tryEntries[r];if(e.tryLoc===t){var n=e.completion;if("throw"===n.type){var o=n.arg;R(e)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,r,n){return this.delegate={iterator:P(t),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=e),g}},t}("object"===r(t)?t.exports:{});try{regeneratorRuntime=e}catch(n){Function("r","regeneratorRuntime = r")(e)}}).call(this,e(17)(t))},function(t,r,e){"use strict";t.exports=function(t){return t.webpackPolyfill||(t.deprecate=function(){},t.paths=[],t.children||(t.children=[]),Object.defineProperty(t,"loaded",{enumerable:!0,get:function(){return t.l}}),Object.defineProperty(t,"id",{enumerable:!0,get:function(){return t.i}}),t.webpackPolyfill=1),t}},function(t,r,e){"use strict";(function(t){function e(t,r){for(var e=0,n=t.length-1;n>=0;n--){var o=t[n];"."===o?t.splice(n,1):".."===o?(t.splice(n,1),e++):e&&(t.splice(n,1),e--)}if(r)for(;e--;e)t.unshift("..");return t}var n=/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/,o=function(t){return n.exec(t).slice(1)};function i(t,r){if(t.filter)return t.filter(r);for(var e=[],n=0;n<t.length;n++)r(t[n],n,t)&&e.push(t[n]);return e}r.resolve=function(){for(var r="",n=!1,o=arguments.length-1;o>=-1&&!n;o--){var u=o>=0?arguments[o]:t.cwd();if("string"!=typeof u)throw new TypeError("Arguments to path.resolve must be strings");u&&(r=u+"/"+r,n="/"===u.charAt(0))}return(n?"/":"")+(r=e(i(r.split("/"),function(t){return!!t}),!n).join("/"))||"."},r.normalize=function(t){var n=r.isAbsolute(t),o="/"===u(t,-1);return(t=e(i(t.split("/"),function(t){return!!t}),!n).join("/"))||n||(t="."),t&&o&&(t+="/"),(n?"/":"")+t},r.isAbsolute=function(t){return"/"===t.charAt(0)},r.join=function(){var t=Array.prototype.slice.call(arguments,0);return r.normalize(i(t,function(t,r){if("string"!=typeof t)throw new TypeError("Arguments to path.join must be strings");return t}).join("/"))},r.relative=function(t,e){function n(t){for(var r=0;r<t.length&&""===t[r];r++);for(var e=t.length-1;e>=0&&""===t[e];e--);return r>e?[]:t.slice(r,e-r+1)}t=r.resolve(t).substr(1),e=r.resolve(e).substr(1);for(var o=n(t.split("/")),i=n(e.split("/")),u=Math.min(o.length,i.length),a=u,f=0;f<u;f++)if(o[f]!==i[f]){a=f;break}var s=[];for(f=a;f<o.length;f++)s.push("..");return(s=s.concat(i.slice(a))).join("/")},r.sep="/",r.delimiter=":",r.dirname=function(t){var r=o(t),e=r[0],n=r[1];return e||n?(n&&(n=n.substr(0,n.length-1)),e+n):"."},r.basename=function(t,r){var e=o(t)[2];return r&&e.substr(-1*r.length)===r&&(e=e.substr(0,e.length-r.length)),e},r.extname=function(t){return o(t)[3]};var u="b"==="ab".substr(-1)?function(t,r,e){return t.substr(r,e)}:function(t,r,e){return r<0&&(r=t.length+r),t.substr(r,e)}}).call(this,e(19))},function(t,r,e){"use strict";var n,o,i=t.exports={};function u(){throw new Error("setTimeout has not been defined")}function a(){throw new Error("clearTimeout has not been defined")}function f(t){if(n===setTimeout)return setTimeout(t,0);if((n===u||!n)&&setTimeout)return n=setTimeout,setTimeout(t,0);try{return n(t,0)}catch(r){try{return n.call(null,t,0)}catch(r){return n.call(this,t,0)}}}!function(){try{n="function"==typeof setTimeout?setTimeout:u}catch(t){n=u}try{o="function"==typeof clearTimeout?clearTimeout:a}catch(t){o=a}}();var s,c=[],h=!1,l=-1;function p(){h&&s&&(h=!1,s.length?c=s.concat(c):l=-1,c.length&&y())}function y(){if(!h){var t=f(p);h=!0;for(var r=c.length;r;){for(s=c,c=[];++l<r;)s&&s[l].run();l=-1,r=c.length}s=null,h=!1,function(t){if(o===clearTimeout)return clearTimeout(t);if((o===a||!o)&&clearTimeout)return o=clearTimeout,clearTimeout(t);try{o(t)}catch(r){try{return o.call(null,t)}catch(r){return o.call(this,t)}}}(t)}}function g(t,r){this.fun=t,this.array=r}function v(){}i.nextTick=function(t){var r=new Array(arguments.length-1);if(arguments.length>1)for(var e=1;e<arguments.length;e++)r[e-1]=arguments[e];c.push(new g(t,r)),1!==c.length||h||f(y)},g.prototype.run=function(){this.fun.apply(null,this.array)},i.title="browser",i.browser=!0,i.env={},i.argv=[],i.version="",i.versions={},i.on=v,i.addListener=v,i.once=v,i.off=v,i.removeListener=v,i.removeAllListeners=v,i.emit=v,i.prependListener=v,i.prependOnceListener=v,i.listeners=function(t){return[]},i.binding=function(t){throw new Error("process.binding is not supported")},i.cwd=function(){return"/"},i.chdir=function(t){throw new Error("process.chdir is not supported")},i.umask=function(){return 0}},function(t,r,e){"use strict";r.endianness=function(){return"LE"},r.hostname=function(){return"undefined"!=typeof location?location.hostname:""},r.loadavg=function(){return[]},r.uptime=function(){return 0},r.freemem=function(){return Number.MAX_VALUE},r.totalmem=function(){return Number.MAX_VALUE},r.cpus=function(){return[]},r.type=function(){return"Browser"},r.release=function(){return"undefined"!=typeof navigator?navigator.appVersion:""},r.networkInterfaces=r.getNetworkInterfaces=function(){return{}},r.arch=function(){return"javascript"},r.platform=function(){return"browser"},r.tmpdir=r.tmpDir=function(){return"/tmp"},r.EOL="\n",r.homedir=function(){return"/"}},function(t,r,e){"use strict";function n(t){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}t.exports=function(t,r,e){var o,i=t instanceof Error?t:new Error(t);if("object"===n(r)?e=r:null!=r&&(i.code=r),e)for(o in e)i[o]=e[o];return i}}])});
//# sourceMappingURL=index.min.js.map
{
"name": "interface-datastore",
"version": "0.6.0",
"version": "0.7.0",
"description": "datastore interface",
"leadMaintainer": "Pedro Teixeira <i@pgte.me>",
"leadMaintainer": "Alex Potsides <alex.potsides@protocol.ai>",
"main": "src/index.js",

@@ -37,13 +37,10 @@ "scripts": {

"devDependencies": {
"aegir": "^15.1.0",
"aegir": "^18.2.2",
"chai": "^4.1.2",
"dirty-chai": "^2.0.1",
"flow-bin": "~0.83.0"
"flow-bin": "~0.97.0"
},
"dependencies": {
"async": "^2.6.1",
"class-is": "^1.1.0",
"err-code": "^1.1.2",
"pull-defer": "~0.2.3",
"pull-stream": "^3.6.9",
"uuid": "^3.2.2"

@@ -56,2 +53,3 @@ },

"contributors": [
"Alan Shaw <alan.shaw@protocol.ai>",
"David Dias <daviddias.p@gmail.com>",

@@ -66,2 +64,3 @@ "Erin Dachtler <download333@gmail.com>",

"Vasco Santos <vasco.santos@moxy.studio>",
"achingbrain <alex@achingbrain.net>",
"dignifiedquire <dignifiedquire@gmail.com>",

@@ -68,0 +67,0 @@ "tcme <hi@this-connect.me>",

@@ -18,3 +18,3 @@ # interface-datastore

[Pedro Teixeira](https://github.com/pgte)
[Alex Potsides](https://github.com/achingbrain)

@@ -51,5 +51,5 @@ ## Table of Contents

const fs = new FsStore('path/to/store')
ShardingStore.createOrOpen(fs, new NextToLast(2), (err, flatfs) => {
// flatfs now works like go-flatfs
})
// flatfs now works like go-flatfs
const flatfs = await ShardingStore.createOrOpen(fs, new NextToLast(2))
```

@@ -59,3 +59,3 @@

```
```sh
$ npm install interface-datastore

@@ -73,6 +73,6 @@ ```

const store = new MountStore({prefix: new Key('/a'), datastore: new MemoryStore()})
const store = new MountStore({ prefix: new Key('/a'), datastore: new MemoryStore() })
```
### Testsuite
### Test suite

@@ -84,8 +84,7 @@ Available under [`src/tests.js`](src/tests.js)

require('interface-datastore/src/tests')({
setup (callback) {
callback(null, instanceOfMyStore)
async setup () {
return instanceOfMyStore
},
teardown (callback) {
async teardown () {
// cleanup resources
callback()
}

@@ -107,3 +106,3 @@ })

The key scheme is inspired by file systems and Google App Engine key model. Keys are meant to be unique across a system. They are typical hierarchical, incorporating more and more specific namespaces. Thus keys can be deemed 'children' or 'ancestors' of other keys:
The key scheme is inspired by file systems and Google App Engine key model. Keys are meant to be unique across a system. They are typically hierarchical, incorporating more and more specific namespaces. Thus keys can be deemed 'children' or 'ancestors' of other keys:

@@ -113,3 +112,3 @@ - `new Key('/Comedy')`

Also, every namespace can be parametrized to embed relevant object information. For example, the Key `name` (most specific namespace) could include the object type:
Also, every namespace can be parameterized to embed relevant object information. For example, the Key `name` (most specific namespace) could include the object type:

@@ -127,6 +126,5 @@ - `new Key('/Comedy/MontyPython/Actor:JohnCleese')`

### `has(key, callback)`
### `has(key)` -> `Promise<Boolean>`
- `key: Key`
- `callback: function(Error, bool)`

@@ -136,15 +134,10 @@ Check for the existence of a given key

```js
store.has(new Key('awesome'), (err, exists) => {
if (err) {
throw err
}
console.log('is it there', exists)
})
const exists = await store.has(new Key('awesome'))
console.log('is it there', exists)
```
### `put(key, value, callback)`
### `put(key, value)` -> `Promise`
- `key: Key`
- `value: Value`
- `callback: function(Error)`

@@ -154,14 +147,9 @@ Store a value with the given key.

```js
store.put(new Key('awesome'), new Buffer('datastores'), (err) => {
if (err) {
throw err
}
console.log('put content')
})
await store.put(new Key('awesome'), new Buffer('datastores'))
console.log('put content')
```
### `get(key, callback)`
### `get(key)` -> `Promise<Value>`
- `key: Key`
- `callback: function(Error, Value)`

@@ -171,15 +159,10 @@ Retrieve the value stored under the given key.

```js
store.get(new Key('awesome'), (err, value) => {
if (err) {
throw err
}
console.log('got content: %s', value.toString())
// => got content: datastore
})
const value = await store.get(new Key('awesome'))
console.log('got content: %s', value.toString())
// => got content: datastore
```
### `delete(key, callback)`
### `delete(key)` -> `Promise`
- `key: Key`
- `callback: function(Error)`

@@ -189,28 +172,19 @@ Delete the content stored under the given key.

```js
store.delete(new Key('awesome'), (err) => {
if (err) {
throw err
}
console.log('deleted awesome content :(')
})
await store.delete(new Key('awesome'))
console.log('deleted awesome content :(')
```
### `query(query)`
### `query(query)` -> `Iterable`
- `query: Query` see below for possible values
- Returns: `pull-stream source`
Search the store for some values. Returns a [pull-stream](https://pull-stream.github.io/) with each item being a `Value`.
Search the store for some values. Returns an [Iterable](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols) with each item being a `Value`.
```js
// retrieve __all__ values from the store
pull(
store.query({}),
pull.collect((err, list) => {
if (err) {
console.error(err)
}
console.log('ALL THE VALUES', list)
})
)
let list = []
for await (const value of store.query({})) {
list.push(value)
}
console.log('ALL THE VALUES', list)
```

@@ -225,5 +199,5 @@

- `orders: Array<Order<Value>>` (optional) - order the results according to these functions
- `limit: number` (optional) - only return this many records
- `offset: number` (optional) - skip this many records at the beginning
- `keysOnly: bool` (optional) - Only return keys, no values.
- `limit: Number` (optional) - only return this many records
- `offset: Number` (optional) - skip this many records at the beginning
- `keysOnly: Boolean` (optional) - Only return keys, no values.

@@ -241,9 +215,4 @@ ### `batch()`

b.commit((err) => {
if (err) {
throw err
}
console.log('put 100 values')
})
await b.commit()
console.log('put 100 values')
```

@@ -264,18 +233,12 @@

#### `commit(callback)`
#### `commit()` -> `Promise`
- `callback: function(Error)`
Write all queued operations to the underyling store. The batch object should not be used after calling this.
### `open(callback)`
### `open()` -> `Promise`
- `callback: function(Error)`
Opens the datastore, this is only needed if the store was closed before, otherwise this is taken care of by the constructor.
### `close(callback)`
### `close()` -> `Promise`
- `callback: function(Error)`
Close the datastore, this should always be called to ensure resources are cleaned up.

@@ -282,0 +245,0 @@

@@ -6,7 +6,3 @@ /* @flow */

const pull = require('pull-stream')
const setImmediate = require('async/setImmediate')
const asyncFilter = require('./utils').asyncFilter
const asyncSort = require('./utils').asyncSort
const { filter, sortAll, take, map } = require('./utils')
const Key = require('./key')

@@ -24,38 +20,20 @@

open (callback /* : Callback<void> */) /* : void */ {
setImmediate(callback)
}
async open () /* : Promise */ {}
put (key /* : Key */, val /* : Buffer */, callback /* : Callback<void> */) /* : void */ {
async put (key /* : Key */, val /* : Buffer */) /* : Promise */ {
this.data[key.toString()] = val
setImmediate(callback)
}
get (key /* : Key */, callback /* : Callback<Buffer> */) /* : void */ {
this.has(key, (err, exists) => {
if (err) {
return callback(err)
}
if (!exists) {
return callback(Errors.notFoundError())
}
callback(null, this.data[key.toString()])
})
async get (key /* : Key */) /* : Promise<Buffer> */ {
const exists = await this.has(key)
if (!exists) throw Errors.notFoundError()
return this.data[key.toString()]
}
has (key /* : Key */, callback /* : Callback<bool> */) /* : void */ {
setImmediate(() => {
callback(null, this.data[key.toString()] !== undefined)
})
async has (key /* : Key */) /* : Promise<Boolean> */ {
return this.data[key.toString()] !== undefined
}
delete (key /* : Key */, callback /* : Callback<void> */) /* : void */ {
async delete (key /* : Key */) /* : Promise */ {
delete this.data[key.toString()]
setImmediate(() => {
callback()
})
}

@@ -74,8 +52,8 @@

},
commit: (callback /* : Callback<void> */) /* : void */ => {
commit: async () /* : Promise */ => {
puts.forEach(v => {
this.data[v[0].toString()] = v[1]
})
puts = []
puts = []
dels.forEach(key => {

@@ -85,4 +63,2 @@ delete this.data[key.toString()]

dels = []
setImmediate(callback)
}

@@ -92,23 +68,17 @@ }

query (q /* : Query<Buffer> */) /* : QueryResult<Buffer> */ {
let tasks = [pull.keys(this.data), pull.map(k => ({
key: new Key(k),
value: this.data[k]
}))]
query (q /* : Query<Buffer> */) /* : Iterator */ {
let it = Object.entries(this.data)
let filters = []
it = map(it, entry => ({ key: new Key(entry[0]), value: entry[1] }))
if (q.prefix != null) {
const prefix = q.prefix
filters.push((e, cb) => cb(null, e.key.toString().startsWith(prefix)))
it = filter(it, e => e.key.toString().startsWith(q.prefix))
}
if (q.filters != null) {
filters = filters.concat(q.filters)
if (Array.isArray(q.filters)) {
it = q.filters.reduce((it, f) => filter(it, f), it)
}
tasks = tasks.concat(filters.map(f => asyncFilter(f)))
if (q.orders != null) {
tasks = tasks.concat(q.orders.map(o => asyncSort(o)))
if (Array.isArray(q.orders)) {
it = q.orders.reduce((it, f) => sortAll(it, f), it)
}

@@ -118,22 +88,19 @@

let i = 0
// $FlowFixMe
tasks.push(pull.filter(() => i++ >= q.offset))
it = filter(it, () => i++ >= q.offset)
}
if (q.limit != null) {
tasks.push(pull.take(q.limit))
it = take(it, q.limit)
}
if (q.keysOnly === true) {
tasks.push(pull.map(e => ({ key: e.key })))
it = map(it, e => ({ key: e.key }))
}
return pull.apply(null, tasks)
return it
}
close (callback /* : Callback<void> */) /* : void */ {
setImmediate(callback)
}
async close () /* : Promise */ {}
}
module.exports = MemoryDatastore

@@ -9,7 +9,2 @@ /* @flow */

const expect = chai.expect
const pull = require('pull-stream')
const series = require('async/series')
const parallel = require('async/parallel')
const map = require('async/map')
const each = require('async/each')
const crypto = require('crypto')

@@ -27,15 +22,6 @@

const check = (s) => {
if (s == null) {
throw new Error('missing store')
}
return s
}
module.exports = (test/* : Test */) => {
const cleanup = (store, done) => {
series([
(cb) => check(store).close(cb),
(cb) => test.teardown(cb)
], done)
const cleanup = async store => {
await store.close()
await test.teardown()
}

@@ -46,22 +32,15 @@

beforeEach((done) => {
test.setup((err, s) => {
if (err) {
throw err
}
store = s
done()
})
beforeEach(async () => {
store = await test.setup()
if (!store) throw new Error('missing store')
})
afterEach((done) => {
cleanup(store, done)
})
afterEach(() => cleanup(store))
it('simple', (done) => {
it('simple', () => {
const k = new Key('/z/one')
check(store).put(k, Buffer.from('one'), done)
return store.put(k, Buffer.from('one'))
})
it('parallel', (done) => {
it('parallel', async () => {
const data = []

@@ -72,15 +51,7 @@ for (let i = 0; i < 100; i++) {

each(data, (d, cb) => {
check(store).put(d[0], d[1], cb)
}, (err) => {
expect(err).to.not.exist()
map(data, (d, cb) => {
check(store).get(d[0], cb)
}, (err, res) => {
expect(err).to.not.exist()
res.forEach((res, i) => {
expect(res).to.be.eql(data[i][1])
})
done()
})
await Promise.all(data.map(d => store.put(d[0], d[1])))
const res = await Promise.all(data.map(d => store.get(d[0])))
res.forEach((res, i) => {
expect(res).to.be.eql(data[i][1])
})

@@ -93,35 +64,27 @@ })

beforeEach((done) => {
test.setup((err, s) => {
if (err) {
throw err
}
store = s
done()
})
beforeEach(async () => {
store = await test.setup()
if (!store) throw new Error('missing store')
})
afterEach((done) => {
cleanup(store, done)
})
afterEach(() => cleanup(store))
it('simple', (done) => {
it('simple', async () => {
const k = new Key('/z/one')
series([
(cb) => check(store).put(k, Buffer.from('hello'), cb),
(cb) => check(store).get(k, (err, res) => {
expect(err).to.not.exist()
expect(res).to.be.eql(Buffer.from('hello'))
cb()
})
], done)
await store.put(k, Buffer.from('hello'))
const res = await store.get(k)
expect(res).to.be.eql(Buffer.from('hello'))
})
it('should return error with missing key', (done) => {
it('should throw error for missing key', async () => {
const k = new Key('/does/not/exist')
check(store).get(k, (err) => {
expect(err).to.exist()
try {
await store.get(k)
} catch (err) {
expect(err).to.have.property('code', 'ERR_NOT_FOUND')
done()
})
return
}
throw new Error('expected error to be thrown')
})

@@ -133,35 +96,19 @@ })

beforeEach((done) => {
test.setup((err, s) => {
if (err) {
throw err
}
store = s
done()
})
beforeEach(async () => {
store = await test.setup()
if (!store) throw new Error('missing store')
})
afterEach((done) => {
cleanup(store, done)
})
afterEach(() => cleanup(store))
it('simple', (done) => {
it('simple', async () => {
const k = new Key('/z/one')
series([
(cb) => check(store).put(k, Buffer.from('hello'), cb),
(cb) => check(store).get(k, (err, res) => {
expect(err).to.not.exist()
expect(res).to.be.eql(Buffer.from('hello'))
cb()
}),
(cb) => check(store).delete(k, cb),
(cb) => check(store).has(k, (err, exists) => {
expect(err).to.not.exist()
expect(exists).to.be.eql(false)
cb()
})
], done)
await store.put(k, Buffer.from('hello'))
await store.get(k)
await store.delete(k)
const exists = await store.has(k)
expect(exists).to.be.eql(false)
})
it('parallel', (done) => {
it('parallel', async () => {
const data = []

@@ -172,28 +119,11 @@ for (let i = 0; i < 100; i++) {

series([
(cb) => each(data, (d, cb) => {
check(store).put(d[0], d[1], cb)
}, cb),
(cb) => map(data, (d, cb) => {
check(store).has(d[0], cb)
}, (err, res) => {
expect(err).to.not.exist()
res.forEach((res, i) => {
expect(res).to.be.eql(true)
})
cb()
}),
(cb) => each(data, (d, cb) => {
check(store).delete(d[0], cb)
}, cb),
(cb) => map(data, (d, cb) => {
check(store).has(d[0], cb)
}, (err, res) => {
expect(err).to.not.exist()
res.forEach((res, i) => {
expect(res).to.be.eql(false)
})
cb()
})
], done)
await Promise.all(data.map(d => store.put(d[0], d[1])))
const res0 = await Promise.all(data.map(d => store.has(d[0])))
res0.forEach((res, i) => expect(res).to.be.eql(true))
await Promise.all(data.map(d => store.delete(d[0])))
const res1 = await Promise.all(data.map(d => store.has(d[0])))
res1.forEach((res, i) => expect(res).to.be.eql(false))
})

@@ -205,43 +135,29 @@ })

beforeEach((done) => {
test.setup((err, s) => {
if (err) {
throw err
}
store = s
done()
})
beforeEach(async () => {
store = await test.setup()
if (!store) throw new Error('missing store')
})
afterEach((done) => {
cleanup(store, done)
})
afterEach(() => cleanup(store))
it('simple', (done) => {
const b = check(store).batch()
it('simple', async () => {
const b = store.batch()
series([
(cb) => check(store).put(new Key('/z/old'), Buffer.from('old'), cb),
(cb) => {
b.put(new Key('/a/one'), Buffer.from('1'))
b.put(new Key('/q/two'), Buffer.from('2'))
b.put(new Key('/q/three'), Buffer.from('3'))
b.delete(new Key('/z/old'))
b.commit(cb)
},
(cb) => map(
['/a/one', '/q/two', '/q/three', '/z/old'],
(k, cb) => check(store).has(new Key(k), cb),
(err, res) => {
expect(err).to.not.exist()
expect(res).to.be.eql([true, true, true, false])
cb()
}
)
], done)
await store.put(new Key('/z/old'), Buffer.from('old'))
b.put(new Key('/a/one'), Buffer.from('1'))
b.put(new Key('/q/two'), Buffer.from('2'))
b.put(new Key('/q/three'), Buffer.from('3'))
b.delete(new Key('/z/old'))
await b.commit()
const keys = ['/a/one', '/q/two', '/q/three', '/z/old']
const res = await Promise.all(keys.map(k => store.has(new Key(k))))
expect(res).to.be.eql([true, true, true, false])
})
it('many (3 * 400)', function (done) {
it('many (3 * 400)', async function () {
this.timeout(20 * 1000)
const b = check(store).batch()
const b = store.batch()
const count = 400

@@ -254,16 +170,13 @@ for (let i = 0; i < count; i++) {

series([
(cb) => b.commit(cb),
(cb) => parallel([
(cb) => pull(check(store).query({prefix: '/a'}), pull.collect(cb)),
(cb) => pull(check(store).query({prefix: '/z'}), pull.collect(cb)),
(cb) => pull(check(store).query({prefix: '/q'}), pull.collect(cb))
], (err, res) => {
expect(err).to.not.exist()
expect(res[0]).to.have.length(count)
expect(res[1]).to.have.length(count)
expect(res[2]).to.have.length(count)
cb()
})
], done)
await b.commit()
const total = async iterable => {
let count = 0
for await (const _ of iterable) count++ // eslint-disable-line
return count
}
expect(await total(store.query({ prefix: '/a' }))).to.equal(count)
expect(await total(store.query({ prefix: '/z' }))).to.equal(count)
expect(await total(store.query({ prefix: '/q' }))).to.equal(count)
})

@@ -274,15 +187,11 @@ })

let store
const hello = {key: new Key('/q/1hello'), value: Buffer.from('1')}
const world = {key: new Key('/z/2world'), value: Buffer.from('2')}
const hello2 = {key: new Key('/z/3hello2'), value: Buffer.from('3')}
const filter1 = (entry, cb) => {
cb(null, !entry.key.toString().endsWith('hello'))
}
const hello = { key: new Key('/q/1hello'), value: Buffer.from('1') }
const world = { key: new Key('/z/2world'), value: Buffer.from('2') }
const hello2 = { key: new Key('/z/3hello2'), value: Buffer.from('3') }
const filter2 = (entry, cb) => {
cb(null, entry.key.toString().endsWith('hello2'))
}
const filter1 = async entry => !entry.key.toString().endsWith('hello')
const filter2 = entry => entry.key.toString().endsWith('hello2')
const order1 = (res, cb) => {
cb(null, res.sort((a, b) => {
const order1 = async res => {
return res.sort((a, b) => {
if (a.value.toString() < b.value.toString()) {

@@ -292,7 +201,7 @@ return -1

return 1
}))
})
}
const order2 = (res, cb) => {
const out = res.sort((a, b) => {
const order2 = res => {
return res.sort((a, b) => {
if (a.value.toString() < b.value.toString()) {

@@ -306,4 +215,2 @@ return 1

})
cb(null, out)
}

@@ -313,70 +220,60 @@

['empty', {}, [hello, world, hello2]],
['prefix', {prefix: '/z'}, [world, hello2]],
['1 filter', {filters: [filter1]}, [world, hello2]],
['2 filters', {filters: [filter1, filter2]}, [hello2]],
['limit', {limit: 1}, 1],
['offset', {offset: 1}, 2],
['keysOnly', {keysOnly: true}, [{key: hello.key}, {key: world.key}, {key: hello2.key}]],
['1 order (1)', {orders: [order1]}, [hello, world, hello2]],
['1 order (reverse 1)', {orders: [order2]}, [hello2, world, hello]]
['prefix', { prefix: '/z' }, [world, hello2]],
['1 filter', { filters: [filter1] }, [world, hello2]],
['2 filters', { filters: [filter1, filter2] }, [hello2]],
['limit', { limit: 1 }, 1],
['offset', { offset: 1 }, 2],
['keysOnly', { keysOnly: true }, [{ key: hello.key }, { key: world.key }, { key: hello2.key }]],
['1 order (1)', { orders: [order1] }, [hello, world, hello2]],
['1 order (reverse 1)', { orders: [order2] }, [hello2, world, hello]]
]
before((done) => {
test.setup((err, s) => {
if (err) {
throw err
}
store = s
before(async () => {
store = await test.setup()
if (!store) throw new Error('missing store')
const b = check(store).batch()
const b = store.batch()
b.put(hello.key, hello.value)
b.put(world.key, world.value)
b.put(hello2.key, hello2.value)
b.put(hello.key, hello.value)
b.put(world.key, world.value)
b.put(hello2.key, hello2.value)
b.commit(done)
})
return b.commit()
})
after((done) => {
cleanup(store, done)
})
after(() => cleanup(store))
tests.forEach((t) => it(t[0], (done) => {
pull(
check(store).query(t[1]),
pull.collect((err, res) => {
expect(err).to.not.exist()
const expected = t[2]
if (Array.isArray(expected)) {
if (t[1].orders == null) {
expect(res).to.have.length(expected.length)
const s = (a, b) => {
if (a.key.toString() < b.key.toString()) {
return 1
} else {
return -1
}
}
res = res.sort(s)
const exp = expected.sort(s)
tests.forEach(t => it(t[0], async () => {
let res = []
for await (const value of store.query(t[1])) res.push(value)
res.forEach((r, i) => {
expect(r.key.toString()).to.be.eql(exp[i].key.toString())
const expected = t[2]
if (Array.isArray(expected)) {
if (t[1].orders == null) {
expect(res).to.have.length(expected.length)
const s = (a, b) => {
if (a.key.toString() < b.key.toString()) {
return 1
} else {
return -1
}
}
res = res.sort(s)
const exp = expected.sort(s)
if (r.value == null) {
expect(exp[i].value).to.not.exist()
} else {
expect(r.value.equals(exp[i].value)).to.be.eql(true)
}
})
res.forEach((r, i) => {
expect(r.key.toString()).to.be.eql(exp[i].key.toString())
if (r.value == null) {
expect(exp[i].value).to.not.exist()
} else {
expect(res).to.be.eql(t[2])
expect(r.value.equals(exp[i].value)).to.be.eql(true)
}
} else if (typeof expected === 'number') {
expect(res).to.have.length(expected)
}
done()
})
)
})
} else {
expect(res).to.be.eql(t[2])
}
} else if (typeof expected === 'number') {
expect(res).to.have.length(expected)
}
}))

@@ -387,25 +284,17 @@ })

let store
before((done) => {
test.setup((err, s) => {
if (err) {
throw err
}
store = s
done()
})
})
after((done) => {
cleanup(store, done)
before(async () => {
store = await test.setup()
if (!store) throw new Error('missing store')
})
it('close and open', (done) => {
series([
(cb) => check(store).close(cb),
(cb) => check(store).open(cb),
(cb) => check(store).close(cb),
(cb) => check(store).open(cb)
], done)
after(() => cleanup(store))
it('close and open', async () => {
await store.close()
await store.open()
await store.close()
await store.open()
})
})
}
'use strict'
const pull = require('pull-stream')
const Source = require('pull-defer/source')
const path = require('path')

@@ -9,63 +7,41 @@ const os = require('os')

exports.asyncFilter = function (test) {
let busy = false
let abortCb
let aborted
return function (read) {
return function next (abort, cb) {
if (aborted) return cb(aborted)
if (abort) {
aborted = abort
if (!busy) {
read(abort, cb)
} else {
read(abort, () => {
// if we are still busy, wait for the test to complete.
if (busy) abortCb = cb; else cb(abort)
})
}
} else {
read(null, (end, data) => {
if (end) cb(end); else if (aborted) cb(aborted); else {
busy = true
test(data, (err, valid) => {
busy = false
if (aborted) {
cb(aborted)
abortCb(aborted)
} else if (err) {
next(err, cb)
} else if (valid) {
cb(null, data)
} else {
next(null, cb)
}
})
}
})
}
exports.filter = (iterable, filterer) => {
return (async function * () {
for await (const value of iterable) {
const keep = await filterer(value)
if (!keep) continue
yield value
}
}
})()
}
exports.asyncSort = function (sorter) {
const source = Source()
// Not just sort, because the sorter is given all the values and should return
// them all sorted
exports.sortAll = (iterable, sorter) => {
return (async function * () {
let values = []
for await (const value of iterable) values.push(value)
values = await sorter(values)
for (const value of values) yield value
})()
}
const sink = pull.collect((err, ary) => {
if (err) {
return source.abort(err)
exports.take = (iterable, n) => {
return (async function * () {
if (n <= 0) return
let i = 0
for await (const value of iterable) {
yield value
i++
if (i >= n) return
}
sorter(ary, (err, res) => {
if (err) {
return source.abort(err)
}
source.resolve(pull.values(ary))
})
})
})()
}
return function (read) {
sink(read)
return source
}
exports.map = (iterable, mapper) => {
return (async function * () {
for await (const value of iterable) {
yield mapper(value)
}
})()
}

@@ -72,0 +48,0 @@

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc