New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

indexeddb-chunk-store

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

indexeddb-chunk-store - npm Package Compare versions

Comparing version 2.1.0 to 2.1.1

4

idbchunkstore.min.js

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

(function(t){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=t()}else if(typeof define==="function"&&define.amd){define([],t)}else{var e;if(typeof window!=="undefined"){e=window}else if(typeof global!=="undefined"){e=global}else if(typeof self!=="undefined"){e=self}else{e=this}e.IdbChunkStore=t()}})(function(){var t,e,r;return function t(e,r,n){function i(f,u){if(!r[f]){if(!e[f]){var s=typeof require=="function"&&require;if(!u&&s)return s(f,!0);if(o)return o(f,!0);var a=new Error("Cannot find module '"+f+"'");throw a.code="MODULE_NOT_FOUND",a}var h=r[f]={exports:{}};e[f][0].call(h.exports,function(t){var r=e[f][1][t];return i(r?r:t)},h,h.exports,t,e,r,n)}return r[f].exports}var o=typeof require=="function"&&require;for(var f=0;f<n.length;f++)i(n[f]);return i}({1:[function(t,e,r){(function(e){"use strict";var n=t("base64-js");var i=t("ieee754");var o=t("isarray");r.Buffer=a;r.SlowBuffer=b;r.INSPECT_MAX_BYTES=50;a.TYPED_ARRAY_SUPPORT=e.TYPED_ARRAY_SUPPORT!==undefined?e.TYPED_ARRAY_SUPPORT:f();r.kMaxLength=u();function f(){try{var t=new Uint8Array(1);t.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}};return t.foo()===42&&typeof t.subarray==="function"&&t.subarray(1,1).byteLength===0}catch(t){return false}}function u(){return a.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function s(t,e){if(u()<e){throw new RangeError("Invalid typed array length")}if(a.TYPED_ARRAY_SUPPORT){t=new Uint8Array(e);t.__proto__=a.prototype}else{if(t===null){t=new a(e)}t.length=e}return t}function a(t,e,r){if(!a.TYPED_ARRAY_SUPPORT&&!(this instanceof a)){return new a(t,e,r)}if(typeof t==="number"){if(typeof e==="string"){throw new Error("If encoding is specified then the first argument must be a string")}return p(this,t)}return h(this,t,e,r)}a.poolSize=8192;a._augment=function(t){t.__proto__=a.prototype;return t};function h(t,e,r,n){if(typeof e==="number"){throw new TypeError('"value" argument must not be a number')}if(typeof ArrayBuffer!=="undefined"&&e instanceof ArrayBuffer){return g(t,e,r,n)}if(typeof e==="string"){return d(t,e,r)}return y(t,e)}a.from=function(t,e,r){return h(null,t,e,r)};if(a.TYPED_ARRAY_SUPPORT){a.prototype.__proto__=Uint8Array.prototype;a.__proto__=Uint8Array;if(typeof Symbol!=="undefined"&&Symbol.species&&a[Symbol.species]===a){Object.defineProperty(a,Symbol.species,{value:null,configurable:true})}}function l(t){if(typeof t!=="number"){throw new TypeError('"size" argument must be a number')}else if(t<0){throw new RangeError('"size" argument must not be negative')}}function c(t,e,r,n){l(e);if(e<=0){return s(t,e)}if(r!==undefined){return typeof n==="string"?s(t,e).fill(r,n):s(t,e).fill(r)}return s(t,e)}a.alloc=function(t,e,r){return c(null,t,e,r)};function p(t,e){l(e);t=s(t,e<0?0:w(e)|0);if(!a.TYPED_ARRAY_SUPPORT){for(var r=0;r<e;++r){t[r]=0}}return t}a.allocUnsafe=function(t){return p(null,t)};a.allocUnsafeSlow=function(t){return p(null,t)};function d(t,e,r){if(typeof r!=="string"||r===""){r="utf8"}if(!a.isEncoding(r)){throw new TypeError('"encoding" must be a valid string encoding')}var n=_(e,r)|0;t=s(t,n);var i=t.write(e,r);if(i!==n){t=t.slice(0,i)}return t}function v(t,e){var r=e.length<0?0:w(e.length)|0;t=s(t,r);for(var n=0;n<r;n+=1){t[n]=e[n]&255}return t}function g(t,e,r,n){e.byteLength;if(r<0||e.byteLength<r){throw new RangeError("'offset' is out of bounds")}if(e.byteLength<r+(n||0)){throw new RangeError("'length' is out of bounds")}if(r===undefined&&n===undefined){e=new Uint8Array(e)}else if(n===undefined){e=new Uint8Array(e,r)}else{e=new Uint8Array(e,r,n)}if(a.TYPED_ARRAY_SUPPORT){t=e;t.__proto__=a.prototype}else{t=v(t,e)}return t}function y(t,e){if(a.isBuffer(e)){var r=w(e.length)|0;t=s(t,r);if(t.length===0){return t}e.copy(t,0,0,r);return t}if(e){if(typeof ArrayBuffer!=="undefined"&&e.buffer instanceof ArrayBuffer||"length"in e){if(typeof e.length!=="number"||et(e.length)){return s(t,0)}return v(t,e)}if(e.type==="Buffer"&&o(e.data)){return v(t,e.data)}}throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}function w(t){if(t>=u()){throw new RangeError("Attempt to allocate Buffer larger than maximum "+"size: 0x"+u().toString(16)+" bytes")}return t|0}function b(t){if(+t!=t){t=0}return a.alloc(+t)}a.isBuffer=function t(e){return!!(e!=null&&e._isBuffer)};a.compare=function t(e,r){if(!a.isBuffer(e)||!a.isBuffer(r)){throw new TypeError("Arguments must be Buffers")}if(e===r)return 0;var n=e.length;var i=r.length;for(var o=0,f=Math.min(n,i);o<f;++o){if(e[o]!==r[o]){n=e[o];i=r[o];break}}if(n<i)return-1;if(i<n)return 1;return 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 true;default:return false}};a.concat=function t(e,r){if(!o(e)){throw new TypeError('"list" argument must be an Array of Buffers')}if(e.length===0){return a.alloc(0)}var n;if(r===undefined){r=0;for(n=0;n<e.length;++n){r+=e[n].length}}var i=a.allocUnsafe(r);var f=0;for(n=0;n<e.length;++n){var u=e[n];if(!a.isBuffer(u)){throw new TypeError('"list" argument must be an Array of Buffers')}u.copy(i,f);f+=u.length}return i};function _(t,e){if(a.isBuffer(t)){return t.length}if(typeof ArrayBuffer!=="undefined"&&typeof ArrayBuffer.isView==="function"&&(ArrayBuffer.isView(t)||t instanceof ArrayBuffer)){return t.byteLength}if(typeof t!=="string"){t=""+t}var r=t.length;if(r===0)return 0;var n=false;for(;;){switch(e){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":case undefined:return G(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return r*2;case"hex":return r>>>1;case"base64":return $(t).length;default:if(n)return G(t).length;e=(""+e).toLowerCase();n=true}}}a.byteLength=_;function m(t,e,r){var n=false;if(e===undefined||e<0){e=0}if(e>this.length){return""}if(r===undefined||r>this.length){r=this.length}if(r<=0){return""}r>>>=0;e>>>=0;if(r<=e){return""}if(!t)t="utf8";while(true){switch(t){case"hex":return M(this,e,r);case"utf8":case"utf-8":return Y(this,e,r);case"ascii":return C(this,e,r);case"latin1":case"binary":return D(this,e,r);case"base64":return I(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return O(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase();n=true}}}a.prototype._isBuffer=true;function E(t,e,r){var n=t[e];t[e]=t[r];t[r]=n}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 r=0;r<e;r+=2){E(this,r,r+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 r=0;r<e;r+=4){E(this,r,r+3);E(this,r+1,r+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 r=0;r<e;r+=8){E(this,r,r+7);E(this,r+1,r+6);E(this,r+2,r+5);E(this,r+3,r+4)}return this};a.prototype.toString=function t(){var e=this.length|0;if(e===0)return"";if(arguments.length===0)return Y(this,0,e);return m.apply(this,arguments)};a.prototype.equals=function t(e){if(!a.isBuffer(e))throw new TypeError("Argument must be a Buffer");if(this===e)return true;return a.compare(this,e)===0};a.prototype.inspect=function t(){var e="";var n=r.INSPECT_MAX_BYTES;if(this.length>0){e=this.toString("hex",0,n).match(/.{2}/g).join(" ");if(this.length>n)e+=" ... "}return"<Buffer "+e+">"};a.prototype.compare=function t(e,r,n,i,o){if(!a.isBuffer(e)){throw new TypeError("Argument must be a Buffer")}if(r===undefined){r=0}if(n===undefined){n=e?e.length:0}if(i===undefined){i=0}if(o===undefined){o=this.length}if(r<0||n>e.length||i<0||o>this.length){throw new RangeError("out of range index")}if(i>=o&&r>=n){return 0}if(i>=o){return-1}if(r>=n){return 1}r>>>=0;n>>>=0;i>>>=0;o>>>=0;if(this===e)return 0;var f=o-i;var u=n-r;var s=Math.min(f,u);var h=this.slice(i,o);var l=e.slice(r,n);for(var c=0;c<s;++c){if(h[c]!==l[c]){f=h[c];u=l[c];break}}if(f<u)return-1;if(u<f)return 1;return 0};function A(t,e,r,n,i){if(t.length===0)return-1;if(typeof r==="string"){n=r;r=0}else if(r>2147483647){r=2147483647}else if(r<-2147483648){r=-2147483648}r=+r;if(isNaN(r)){r=i?0:t.length-1}if(r<0)r=t.length+r;if(r>=t.length){if(i)return-1;else r=t.length-1}else if(r<0){if(i)r=0;else return-1}if(typeof e==="string"){e=a.from(e,n)}if(a.isBuffer(e)){if(e.length===0){return-1}return R(t,e,r,n,i)}else if(typeof e==="number"){e=e&255;if(a.TYPED_ARRAY_SUPPORT&&typeof Uint8Array.prototype.indexOf==="function"){if(i){return Uint8Array.prototype.indexOf.call(t,e,r)}else{return Uint8Array.prototype.lastIndexOf.call(t,e,r)}}return R(t,[e],r,n,i)}throw new TypeError("val must be string, number or Buffer")}function R(t,e,r,n,i){var o=1;var f=t.length;var u=e.length;if(n!==undefined){n=String(n).toLowerCase();if(n==="ucs2"||n==="ucs-2"||n==="utf16le"||n==="utf-16le"){if(t.length<2||e.length<2){return-1}o=2;f/=2;u/=2;r/=2}}function s(t,e){if(o===1){return t[e]}else{return t.readUInt16BE(e*o)}}var a;if(i){var h=-1;for(a=r;a<f;a++){if(s(t,a)===s(e,h===-1?0:a-h)){if(h===-1)h=a;if(a-h+1===u)return h*o}else{if(h!==-1)a-=a-h;h=-1}}}else{if(r+u>f)r=f-u;for(a=r;a>=0;a--){var l=true;for(var c=0;c<u;c++){if(s(t,a+c)!==s(e,c)){l=false;break}}if(l)return a}}return-1}a.prototype.includes=function t(e,r,n){return this.indexOf(e,r,n)!==-1};a.prototype.indexOf=function t(e,r,n){return A(this,e,r,n,true)};a.prototype.lastIndexOf=function t(e,r,n){return A(this,e,r,n,false)};function T(t,e,r,n){r=Number(r)||0;var i=t.length-r;if(!n){n=i}else{n=Number(n);if(n>i){n=i}}var o=e.length;if(o%2!==0)throw new TypeError("Invalid hex string");if(n>o/2){n=o/2}for(var f=0;f<n;++f){var u=parseInt(e.substr(f*2,2),16);if(isNaN(u))return f;t[r+f]=u}return f}function B(t,e,r,n){return tt(G(e,t.length-r),t,r,n)}function P(t,e,r,n){return tt(K(e),t,r,n)}function S(t,e,r,n){return P(t,e,r,n)}function U(t,e,r,n){return tt($(e),t,r,n)}function k(t,e,r,n){return tt(W(e,t.length-r),t,r,n)}a.prototype.write=function t(e,r,n,i){if(r===undefined){i="utf8";n=this.length;r=0}else if(n===undefined&&typeof r==="string"){i=r;n=this.length;r=0}else if(isFinite(r)){r=r|0;if(isFinite(n)){n=n|0;if(i===undefined)i="utf8"}else{i=n;n=undefined}}else{throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported")}var o=this.length-r;if(n===undefined||n>o)n=o;if(e.length>0&&(n<0||r<0)||r>this.length){throw new RangeError("Attempt to write outside buffer bounds")}if(!i)i="utf8";var f=false;for(;;){switch(i){case"hex":return T(this,e,r,n);case"utf8":case"utf-8":return B(this,e,r,n);case"ascii":return P(this,e,r,n);case"latin1":case"binary":return S(this,e,r,n);case"base64":return U(this,e,r,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return k(this,e,r,n);default:if(f)throw new TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase();f=true}}};a.prototype.toJSON=function t(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function I(t,e,r){if(e===0&&r===t.length){return n.fromByteArray(t)}else{return n.fromByteArray(t.slice(e,r))}}function Y(t,e,r){r=Math.min(t.length,r);var n=[];var i=e;while(i<r){var o=t[i];var f=null;var u=o>239?4:o>223?3:o>191?2:1;if(i+u<=r){var s,a,h,l;switch(u){case 1:if(o<128){f=o}break;case 2:s=t[i+1];if((s&192)===128){l=(o&31)<<6|s&63;if(l>127){f=l}}break;case 3:s=t[i+1];a=t[i+2];if((s&192)===128&&(a&192)===128){l=(o&15)<<12|(s&63)<<6|a&63;if(l>2047&&(l<55296||l>57343)){f=l}}break;case 4:s=t[i+1];a=t[i+2];h=t[i+3];if((s&192)===128&&(a&192)===128&&(h&192)===128){l=(o&15)<<18|(s&63)<<12|(a&63)<<6|h&63;if(l>65535&&l<1114112){f=l}}}}if(f===null){f=65533;u=1}else if(f>65535){f-=65536;n.push(f>>>10&1023|55296);f=56320|f&1023}n.push(f);i+=u}return L(n)}var x=4096;function L(t){var e=t.length;if(e<=x){return String.fromCharCode.apply(String,t)}var r="";var n=0;while(n<e){r+=String.fromCharCode.apply(String,t.slice(n,n+=x))}return r}function C(t,e,r){var n="";r=Math.min(t.length,r);for(var i=e;i<r;++i){n+=String.fromCharCode(t[i]&127)}return n}function D(t,e,r){var n="";r=Math.min(t.length,r);for(var i=e;i<r;++i){n+=String.fromCharCode(t[i])}return n}function M(t,e,r){var n=t.length;if(!e||e<0)e=0;if(!r||r<0||r>n)r=n;var i="";for(var o=e;o<r;++o){i+=Z(t[o])}return i}function O(t,e,r){var n=t.slice(e,r);var i="";for(var o=0;o<n.length;o+=2){i+=String.fromCharCode(n[o]+n[o+1]*256)}return i}a.prototype.slice=function t(e,r){var n=this.length;e=~~e;r=r===undefined?n:~~r;if(e<0){e+=n;if(e<0)e=0}else if(e>n){e=n}if(r<0){r+=n;if(r<0)r=0}else if(r>n){r=n}if(r<e)r=e;var i;if(a.TYPED_ARRAY_SUPPORT){i=this.subarray(e,r);i.__proto__=a.prototype}else{var o=r-e;i=new a(o,undefined);for(var f=0;f<o;++f){i[f]=this[f+e]}}return i};function j(t,e,r){if(t%1!==0||t<0)throw new RangeError("offset is not uint");if(t+e>r)throw new RangeError("Trying to access beyond buffer length")}a.prototype.readUIntLE=function t(e,r,n){e=e|0;r=r|0;if(!n)j(e,r,this.length);var i=this[e];var o=1;var f=0;while(++f<r&&(o*=256)){i+=this[e+f]*o}return i};a.prototype.readUIntBE=function t(e,r,n){e=e|0;r=r|0;if(!n){j(e,r,this.length)}var i=this[e+--r];var o=1;while(r>0&&(o*=256)){i+=this[e+--r]*o}return i};a.prototype.readUInt8=function t(e,r){if(!r)j(e,1,this.length);return this[e]};a.prototype.readUInt16LE=function t(e,r){if(!r)j(e,2,this.length);return this[e]|this[e+1]<<8};a.prototype.readUInt16BE=function t(e,r){if(!r)j(e,2,this.length);return this[e]<<8|this[e+1]};a.prototype.readUInt32LE=function t(e,r){if(!r)j(e,4,this.length);return(this[e]|this[e+1]<<8|this[e+2]<<16)+this[e+3]*16777216};a.prototype.readUInt32BE=function t(e,r){if(!r)j(e,4,this.length);return this[e]*16777216+(this[e+1]<<16|this[e+2]<<8|this[e+3])};a.prototype.readIntLE=function t(e,r,n){e=e|0;r=r|0;if(!n)j(e,r,this.length);var i=this[e];var o=1;var f=0;while(++f<r&&(o*=256)){i+=this[e+f]*o}o*=128;if(i>=o)i-=Math.pow(2,8*r);return i};a.prototype.readIntBE=function t(e,r,n){e=e|0;r=r|0;if(!n)j(e,r,this.length);var i=r;var o=1;var f=this[e+--i];while(i>0&&(o*=256)){f+=this[e+--i]*o}o*=128;if(f>=o)f-=Math.pow(2,8*r);return f};a.prototype.readInt8=function t(e,r){if(!r)j(e,1,this.length);if(!(this[e]&128))return this[e];return(255-this[e]+1)*-1};a.prototype.readInt16LE=function t(e,r){if(!r)j(e,2,this.length);var n=this[e]|this[e+1]<<8;return n&32768?n|4294901760:n};a.prototype.readInt16BE=function t(e,r){if(!r)j(e,2,this.length);var n=this[e+1]|this[e]<<8;return n&32768?n|4294901760:n};a.prototype.readInt32LE=function t(e,r){if(!r)j(e,4,this.length);return this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24};a.prototype.readInt32BE=function t(e,r){if(!r)j(e,4,this.length);return this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]};a.prototype.readFloatLE=function t(e,r){if(!r)j(e,4,this.length);return i.read(this,e,true,23,4)};a.prototype.readFloatBE=function t(e,r){if(!r)j(e,4,this.length);return i.read(this,e,false,23,4)};a.prototype.readDoubleLE=function t(e,r){if(!r)j(e,8,this.length);return i.read(this,e,true,52,8)};a.prototype.readDoubleBE=function t(e,r){if(!r)j(e,8,this.length);return i.read(this,e,false,52,8)};function N(t,e,r,n,i,o){if(!a.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>i||e<o)throw new RangeError('"value" argument is out of bounds');if(r+n>t.length)throw new RangeError("Index out of range")}a.prototype.writeUIntLE=function t(e,r,n,i){e=+e;r=r|0;n=n|0;if(!i){var o=Math.pow(2,8*n)-1;N(this,e,r,n,o,0)}var f=1;var u=0;this[r]=e&255;while(++u<n&&(f*=256)){this[r+u]=e/f&255}return r+n};a.prototype.writeUIntBE=function t(e,r,n,i){e=+e;r=r|0;n=n|0;if(!i){var o=Math.pow(2,8*n)-1;N(this,e,r,n,o,0)}var f=n-1;var u=1;this[r+f]=e&255;while(--f>=0&&(u*=256)){this[r+f]=e/u&255}return r+n};a.prototype.writeUInt8=function t(e,r,n){e=+e;r=r|0;if(!n)N(this,e,r,1,255,0);if(!a.TYPED_ARRAY_SUPPORT)e=Math.floor(e);this[r]=e&255;return r+1};function q(t,e,r,n){if(e<0)e=65535+e+1;for(var i=0,o=Math.min(t.length-r,2);i<o;++i){t[r+i]=(e&255<<8*(n?i:1-i))>>>(n?i:1-i)*8}}a.prototype.writeUInt16LE=function t(e,r,n){e=+e;r=r|0;if(!n)N(this,e,r,2,65535,0);if(a.TYPED_ARRAY_SUPPORT){this[r]=e&255;this[r+1]=e>>>8}else{q(this,e,r,true)}return r+2};a.prototype.writeUInt16BE=function t(e,r,n){e=+e;r=r|0;if(!n)N(this,e,r,2,65535,0);if(a.TYPED_ARRAY_SUPPORT){this[r]=e>>>8;this[r+1]=e&255}else{q(this,e,r,false)}return r+2};function z(t,e,r,n){if(e<0)e=4294967295+e+1;for(var i=0,o=Math.min(t.length-r,4);i<o;++i){t[r+i]=e>>>(n?i:3-i)*8&255}}a.prototype.writeUInt32LE=function t(e,r,n){e=+e;r=r|0;if(!n)N(this,e,r,4,4294967295,0);if(a.TYPED_ARRAY_SUPPORT){this[r+3]=e>>>24;this[r+2]=e>>>16;this[r+1]=e>>>8;this[r]=e&255}else{z(this,e,r,true)}return r+4};a.prototype.writeUInt32BE=function t(e,r,n){e=+e;r=r|0;if(!n)N(this,e,r,4,4294967295,0);if(a.TYPED_ARRAY_SUPPORT){this[r]=e>>>24;this[r+1]=e>>>16;this[r+2]=e>>>8;this[r+3]=e&255}else{z(this,e,r,false)}return r+4};a.prototype.writeIntLE=function t(e,r,n,i){e=+e;r=r|0;if(!i){var o=Math.pow(2,8*n-1);N(this,e,r,n,o-1,-o)}var f=0;var u=1;var s=0;this[r]=e&255;while(++f<n&&(u*=256)){if(e<0&&s===0&&this[r+f-1]!==0){s=1}this[r+f]=(e/u>>0)-s&255}return r+n};a.prototype.writeIntBE=function t(e,r,n,i){e=+e;r=r|0;if(!i){var o=Math.pow(2,8*n-1);N(this,e,r,n,o-1,-o)}var f=n-1;var u=1;var s=0;this[r+f]=e&255;while(--f>=0&&(u*=256)){if(e<0&&s===0&&this[r+f+1]!==0){s=1}this[r+f]=(e/u>>0)-s&255}return r+n};a.prototype.writeInt8=function t(e,r,n){e=+e;r=r|0;if(!n)N(this,e,r,1,127,-128);if(!a.TYPED_ARRAY_SUPPORT)e=Math.floor(e);if(e<0)e=255+e+1;this[r]=e&255;return r+1};a.prototype.writeInt16LE=function t(e,r,n){e=+e;r=r|0;if(!n)N(this,e,r,2,32767,-32768);if(a.TYPED_ARRAY_SUPPORT){this[r]=e&255;this[r+1]=e>>>8}else{q(this,e,r,true)}return r+2};a.prototype.writeInt16BE=function t(e,r,n){e=+e;r=r|0;if(!n)N(this,e,r,2,32767,-32768);if(a.TYPED_ARRAY_SUPPORT){this[r]=e>>>8;this[r+1]=e&255}else{q(this,e,r,false)}return r+2};a.prototype.writeInt32LE=function t(e,r,n){e=+e;r=r|0;if(!n)N(this,e,r,4,2147483647,-2147483648);if(a.TYPED_ARRAY_SUPPORT){this[r]=e&255;this[r+1]=e>>>8;this[r+2]=e>>>16;this[r+3]=e>>>24}else{z(this,e,r,true)}return r+4};a.prototype.writeInt32BE=function t(e,r,n){e=+e;r=r|0;if(!n)N(this,e,r,4,2147483647,-2147483648);if(e<0)e=4294967295+e+1;if(a.TYPED_ARRAY_SUPPORT){this[r]=e>>>24;this[r+1]=e>>>16;this[r+2]=e>>>8;this[r+3]=e&255}else{z(this,e,r,false)}return r+4};function F(t,e,r,n,i,o){if(r+n>t.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function H(t,e,r,n,o){if(!o){F(t,e,r,4,3.4028234663852886e38,-3.4028234663852886e38)}i.write(t,e,r,n,23,4);return r+4}a.prototype.writeFloatLE=function t(e,r,n){return H(this,e,r,true,n)};a.prototype.writeFloatBE=function t(e,r,n){return H(this,e,r,false,n)};function Q(t,e,r,n,o){if(!o){F(t,e,r,8,1.7976931348623157e308,-1.7976931348623157e308)}i.write(t,e,r,n,52,8);return r+8}a.prototype.writeDoubleLE=function t(e,r,n){return Q(this,e,r,true,n)};a.prototype.writeDoubleBE=function t(e,r,n){return Q(this,e,r,false,n)};a.prototype.copy=function t(e,r,n,i){if(!n)n=0;if(!i&&i!==0)i=this.length;if(r>=e.length)r=e.length;if(!r)r=0;if(i>0&&i<n)i=n;if(i===n)return 0;if(e.length===0||this.length===0)return 0;if(r<0){throw new RangeError("targetStart out of bounds")}if(n<0||n>=this.length)throw new RangeError("sourceStart out of bounds");if(i<0)throw new RangeError("sourceEnd out of bounds");if(i>this.length)i=this.length;if(e.length-r<i-n){i=e.length-r+n}var o=i-n;var f;if(this===e&&n<r&&r<i){for(f=o-1;f>=0;--f){e[f+r]=this[f+n]}}else if(o<1e3||!a.TYPED_ARRAY_SUPPORT){for(f=0;f<o;++f){e[f+r]=this[f+n]}}else{Uint8Array.prototype.set.call(e,this.subarray(n,n+o),r)}return o};a.prototype.fill=function t(e,r,n,i){if(typeof e==="string"){if(typeof r==="string"){i=r;r=0;n=this.length}else if(typeof n==="string"){i=n;n=this.length}if(e.length===1){var o=e.charCodeAt(0);if(o<256){e=o}}if(i!==undefined&&typeof i!=="string"){throw new TypeError("encoding must be a string")}if(typeof i==="string"&&!a.isEncoding(i)){throw new TypeError("Unknown encoding: "+i)}}else if(typeof e==="number"){e=e&255}if(r<0||this.length<r||this.length<n){throw new RangeError("Out of range index")}if(n<=r){return this}r=r>>>0;n=n===undefined?this.length:n>>>0;if(!e)e=0;var f;if(typeof e==="number"){for(f=r;f<n;++f){this[f]=e}}else{var u=a.isBuffer(e)?e:G(new a(e,i).toString());var s=u.length;for(f=0;f<n-r;++f){this[f+r]=u[f%s]}}return this};var V=/[^+\/0-9A-Za-z-_]/g;function X(t){t=J(t).replace(V,"");if(t.length<2)return"";while(t.length%4!==0){t=t+"="}return t}function J(t){if(t.trim)return t.trim();return t.replace(/^\s+|\s+$/g,"")}function Z(t){if(t<16)return"0"+t.toString(16);return t.toString(16)}function G(t,e){e=e||Infinity;var r;var n=t.length;var i=null;var o=[];for(var f=0;f<n;++f){r=t.charCodeAt(f);if(r>55295&&r<57344){if(!i){if(r>56319){if((e-=3)>-1)o.push(239,191,189);continue}else if(f+1===n){if((e-=3)>-1)o.push(239,191,189);continue}i=r;continue}if(r<56320){if((e-=3)>-1)o.push(239,191,189);i=r;continue}r=(i-55296<<10|r-56320)+65536}else if(i){if((e-=3)>-1)o.push(239,191,189)}i=null;if(r<128){if((e-=1)<0)break;o.push(r)}else if(r<2048){if((e-=2)<0)break;o.push(r>>6|192,r&63|128)}else if(r<65536){if((e-=3)<0)break;o.push(r>>12|224,r>>6&63|128,r&63|128)}else if(r<1114112){if((e-=4)<0)break;o.push(r>>18|240,r>>12&63|128,r>>6&63|128,r&63|128)}else{throw new Error("Invalid code point")}}return o}function K(t){var e=[];for(var r=0;r<t.length;++r){e.push(t.charCodeAt(r)&255)}return e}function W(t,e){var r,n,i;var o=[];for(var f=0;f<t.length;++f){if((e-=2)<0)break;r=t.charCodeAt(f);n=r>>8;i=r%256;o.push(i);o.push(n)}return o}function $(t){return n.toByteArray(X(t))}function tt(t,e,r,n){for(var i=0;i<n;++i){if(i+r>=e.length||i>=t.length)break;e[i+r]=t[i]}return i}function et(t){return t!==t}}).call(this,typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{})},{"base64-js":2,ieee754:3,isarray:4}],2:[function(t,e,r){"use strict";r.byteLength=h;r.toByteArray=l;r.fromByteArray=d;var n=[];var i=[];var o=typeof Uint8Array!=="undefined"?Uint8Array:Array;var f="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(var u=0,s=f.length;u<s;++u){n[u]=f[u];i[f.charCodeAt(u)]=u}i["-".charCodeAt(0)]=62;i["_".charCodeAt(0)]=63;function a(t){var e=t.length;if(e%4>0){throw new Error("Invalid string. Length must be a multiple of 4")}return t[e-2]==="="?2:t[e-1]==="="?1:0}function h(t){return t.length*3/4-a(t)}function l(t){var e,r,n,f,u,s;var h=t.length;u=a(t);s=new o(h*3/4-u);n=u>0?h-4:h;var l=0;for(e=0,r=0;e<n;e+=4,r+=3){f=i[t.charCodeAt(e)]<<18|i[t.charCodeAt(e+1)]<<12|i[t.charCodeAt(e+2)]<<6|i[t.charCodeAt(e+3)];s[l++]=f>>16&255;s[l++]=f>>8&255;s[l++]=f&255}if(u===2){f=i[t.charCodeAt(e)]<<2|i[t.charCodeAt(e+1)]>>4;s[l++]=f&255}else if(u===1){f=i[t.charCodeAt(e)]<<10|i[t.charCodeAt(e+1)]<<4|i[t.charCodeAt(e+2)]>>2;s[l++]=f>>8&255;s[l++]=f&255}return s}function c(t){return n[t>>18&63]+n[t>>12&63]+n[t>>6&63]+n[t&63]}function p(t,e,r){var n;var i=[];for(var o=e;o<r;o+=3){n=(t[o]<<16)+(t[o+1]<<8)+t[o+2];i.push(c(n))}return i.join("")}function d(t){var e;var r=t.length;var i=r%3;var o="";var f=[];var u=16383;for(var s=0,a=r-i;s<a;s+=u){f.push(p(t,s,s+u>a?a:s+u))}if(i===1){e=t[r-1];o+=n[e>>2];o+=n[e<<4&63];o+="=="}else if(i===2){e=(t[r-2]<<8)+t[r-1];o+=n[e>>10];o+=n[e>>4&63];o+=n[e<<2&63];o+="="}f.push(o);return f.join("")}},{}],3:[function(t,e,r){r.read=function(t,e,r,n,i){var o,f;var u=i*8-n-1;var s=(1<<u)-1;var a=s>>1;var h=-7;var l=r?i-1:0;var c=r?-1:1;var p=t[e+l];l+=c;o=p&(1<<-h)-1;p>>=-h;h+=u;for(;h>0;o=o*256+t[e+l],l+=c,h-=8){}f=o&(1<<-h)-1;o>>=-h;h+=n;for(;h>0;f=f*256+t[e+l],l+=c,h-=8){}if(o===0){o=1-a}else if(o===s){return f?NaN:(p?-1:1)*Infinity}else{f=f+Math.pow(2,n);o=o-a}return(p?-1:1)*f*Math.pow(2,o-n)};r.write=function(t,e,r,n,i,o){var f,u,s;var a=o*8-i-1;var h=(1<<a)-1;var l=h>>1;var c=i===23?Math.pow(2,-24)-Math.pow(2,-77):0;var p=n?0:o-1;var d=n?1:-1;var v=e<0||e===0&&1/e<0?1:0;e=Math.abs(e);if(isNaN(e)||e===Infinity){u=isNaN(e)?1:0;f=h}else{f=Math.floor(Math.log(e)/Math.LN2);if(e*(s=Math.pow(2,-f))<1){f--;s*=2}if(f+l>=1){e+=c/s}else{e+=c*Math.pow(2,1-l)}if(e*s>=2){f++;s/=2}if(f+l>=h){u=0;f=h}else if(f+l>=1){u=(e*s-1)*Math.pow(2,i);f=f+l}else{u=e*Math.pow(2,l-1)*Math.pow(2,i);f=0}}for(;i>=8;t[r+p]=u&255,p+=d,u/=256,i-=8){}f=f<<i|u;a+=i;for(;a>0;t[r+p]=f&255,p+=d,f/=256,a-=8){}t[r+p-d]|=v*128}},{}],4:[function(t,e,r){var n={}.toString;e.exports=Array.isArray||function(t){return n.call(t)=="[object Array]"}},{}],5:[function(t,e,r){var n=e.exports={};var i;var o;function f(){throw new Error("setTimeout has not been defined")}function u(){throw new Error("clearTimeout has not been defined")}(function(){try{if(typeof setTimeout==="function"){i=setTimeout}else{i=f}}catch(t){i=f}try{if(typeof clearTimeout==="function"){o=clearTimeout}else{o=u}}catch(t){o=u}})();function s(t){if(i===setTimeout){return setTimeout(t,0)}if((i===f||!i)&&setTimeout){i=setTimeout;return setTimeout(t,0)}try{return i(t,0)}catch(e){try{return i.call(null,t,0)}catch(e){return i.call(this,t,0)}}}function a(t){if(o===clearTimeout){return clearTimeout(t)}if((o===u||!o)&&clearTimeout){o=clearTimeout;return clearTimeout(t)}try{return o(t)}catch(e){try{return o.call(null,t)}catch(e){return o.call(this,t)}}}var h=[];var l=false;var c;var p=-1;function d(){if(!l||!c){return}l=false;if(c.length){h=c.concat(h)}else{p=-1}if(h.length){v()}}function v(){if(l){return}var t=s(d);l=true;var e=h.length;while(e){c=h;h=[];while(++p<e){if(c){c[p].run()}}p=-1;e=h.length}c=null;l=false;a(t)}n.nextTick=function(t){var e=new Array(arguments.length-1);if(arguments.length>1){for(var r=1;r<arguments.length;r++){e[r-1]=arguments[r]}}h.push(new g(t,e));if(h.length===1&&!l){s(v)}};function g(t,e){this.fun=t;this.array=e}g.prototype.run=function(){this.fun.apply(null,this.array)};n.title="browser";n.browser=true;n.env={};n.argv=[];n.version="";n.versions={};function y(){}n.on=y;n.addListener=y;n.once=y;n.off=y;n.removeListener=y;n.removeAllListeners=y;n.emit=y;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}},{}],6:[function(t,e,r){e.exports=o;var n=typeof window==="undefined"?self:window;var i=n.indexedDB||n.mozIndexedDB||n.webkitIndexedDB||n.msIndexedDB;function o(t,e){var r=this;if(typeof t!=="string")throw new Error("A name must be supplied of type string");if(!i)throw new Error("IndexedDb not supported");if(!(this instanceof o))return new o(t,e);r._db=null;r._closed=false;r._queue=[];var n=i.open(t);n.onerror=f;n.onsuccess=s;n.onupgradeneeded=a;function f(t){r.close();u(t,e)}function s(t){if(r._closed){t.target.result.close()}else{r._db=t.target.result;r._db.onclose=h;r._drainQueue();if(e)e(null)}}function a(t){if(r._closed)return;var e=t.target.result;e.createObjectStore("kv")}function h(){r.close()}}o.prototype.get=function(t,e){var r=this;if(r._closed)throw new Error("Database is closed");var n=f(e);if(!r._db){r._queue.push([r.get,t,n.cb])}else if(Array.isArray(t)){var i=[];var o=false;var s=0;t.forEach(function(e,f){r.get(t[f],function(e,r){if(o)return;if(e){o=true;n.cb(e)}i[f]=r;s++;if(s===t.length)n.cb(null,i)})})}else{var a=r._db.transaction("kv","readonly");var h=a.objectStore("kv").get(t);h.onsuccess=function(t){n.cb(null,t.target.result)};a.onerror=function(t){u(t,n.cb)}}return n.promise};o.prototype.set=function(t,e,r){var n=this;if(n._closed)throw new Error("Database is closed");var i=f(r);if(!n._db){n._queue.push([n.set,t,e,i.cb])}else{var o=n._db.transaction("kv","readwrite");var s=o.objectStore("kv").put(e,t);s.onsuccess=function(){i.cb(null)};o.onerror=function(t){u(t,i.cb)}}return i.promise};o.prototype.json=function(t){var e=this;if(e._closed)throw new Error("Database is closed");var r=f(t);if(!e._db){e._queue.push([e.json,r.cb])}else{var n=e._db.transaction("kv","readonly");var i=n.objectStore("kv").openCursor();var o={};i.onsuccess=function(t){var e=t.target.result;if(e){o[e.key]=e.value;e.continue()}else{r.cb(null,o)}};n.onerror=function(t){u(t,r.cb)}}return r.promise};o.prototype.keys=function(t){var e=this;if(e._closed)throw new Error("Database is closed");var r=f(t);if(!e._db){e._queue.push([e.keys,r.cb])}else{var n=e._db.transaction("kv","readonly");var i=n.objectStore("kv").openCursor();var o=[];i.onsuccess=function(t){var e=t.target.result;if(e){o.push(e.key);e.continue()}else{r.cb(null,o)}};n.onerror=function(t){u(t,r.cb)}}return r.promise};o.prototype.remove=function(t,e){var r=this;if(r._closed)throw new Error("Database is closed");var n=f(e);if(!r._db){r._queue.push([r.remove,t,n.cb])}else{var i=r._db.transaction("kv","readwrite");var o=i.objectStore("kv").delete(t);o.onsuccess=function(t){n.cb(null)};i.onerror=function(t){u(t,n.cb)}}return n.promise};o.prototype.clear=function(t){var e=this;if(e._closed)throw new Error("Database is closed");var r=f(t);if(!e._db){e._queue.push([e.clear,r.cb])}else{var n=e._db.transaction("kv","readwrite");var i=n.objectStore("kv").clear();i.onsuccess=function(t){r.cb(null)};n.onerror=function(t){u(t,r.cb)}}return r.promise};o.prototype.count=function(t){var e=this;if(e._closed)throw new Error("Database is closed");var r=f(t);if(!e._db){e._queue.push([e.count,r.cb])}else{var n=e._db.transaction("kv","readonly");var i=n.objectStore("kv").count();i.onsuccess=function(t){r.cb(null,t.target.result)};n.onerror=function(t){u(t,r.cb)}}return r.promise};o.prototype.add=function(t,e,r){var n=this;if(n._closed)throw new Error("Database is closed");var i=f(r);if(!n._db){n._queue.push([n.add,t,e,i.cb])}else{var o=n._db.transaction("kv","readwrite");var s=o.objectStore("kv").add(e,t);s.onsuccess=function(t){i.cb(null)};o.onerror=function(t){u(t,i.cb)}}return i.promise};o.prototype.close=function(){if(this._closed)return;this._closed=true;if(this._db)this._db.close();this._queue=null};o.prototype._drainQueue=function(){var t=this;for(var e=0;e<t._queue.length;e++){var r=t._queue[e];var n=r.splice(1);r[0].apply(t,n)}t._queue=null};function f(t){var e={cb:t};if(typeof Promise==="function"&&t==null){e.promise=new Promise(function(t,r){e.cb=function(e,n){if(e)return r(e);else return t(n)}})}if(!e.cb)e.cb=function t(){};return e}function u(t,e){var r=new Error("IDB error");r.event=t;if(e){e(r)}else{throw r}}},{}],"/":[function(t,e,r){(function(r,n){e.exports=o;var i=t("idb-kv-store");function o(t,e,r){var n=this;if(typeof t!=="number")throw new Error("chunkLength must be a number");if(typeof e==="function")return o(t,null,e);if(!(n instanceof o))return new o(t,e,r);if(!e)e={};n.chunkLength=t;n.length=Number(e.length)||Infinity;if(n.length!==Infinity){this.lastChunkLength=this.length%this.chunkLength||this.chunkLength;n.lastChunkIndex=Math.ceil(n.length/n.chunkLength)-1}var f=e.name||""+Math.round(9e16*Math.random());if(e.torrent&&e.torrent.infoHash)f=e.torrent.infoHash;n._store=new i(f,r)}o.prototype.put=function(t,e,i){var o=this;if(!i)i=f;if(!o._store)throw new Error("Store is closed");if(typeof t!=="number")throw new Error("index must be a number");if(!n.isBuffer(e))e=new n(e);var u=t===o.lastChunkIndex;var s=u&&e.length!==o.lastChunkLength||!u&&e.length!==o.chunkLength;if(s)return r.nextTick(i,new Error("Invalid buffer length"));o._store.set(t,e,i)};o.prototype.get=function(t,e,r){var i=this;if(typeof e==="function")return i.get(t,null,e);if(typeof r!=="function")throw new Error("cb must be a function");if(!i._store)throw new Error("Store is closed");if(typeof t!=="number")throw new Error("index must be a number");if(!e)e={};i._store.get(t,function(t,i){if(t)return r(t);if(typeof i==="undefined")return r(new Error("Chunk does not exist"));var o="offset"in e?e.offset:0;var f="length"in e?e.length:i.length-o;r(null,new n(i).slice(o,o+f))})};o.prototype.close=function(t){if(!t)t=f;if(this._store)this._store.close();
this._store=null;r.nextTick(t,null)};o.prototype.destroy=function(t){var e=this;var r=e._store;e._store=null;r.clear(function(e){r.close();if(t)t(e)})};function f(){}}).call(this,t("_process"),t("buffer").Buffer)},{_process:5,buffer:1,"idb-kv-store":6}]},{},[])("/")});
(function(e){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=e()}else if(typeof define==="function"&&define.amd){define([],e)}else{var t;if(typeof window!=="undefined"){t=window}else if(typeof global!=="undefined"){t=global}else if(typeof self!=="undefined"){t=self}else{t=this}t.IdbChunkStore=e()}})(function(){var e,t,r;return function e(t,r,n){function i(s,f){if(!r[s]){if(!t[s]){var u=typeof require=="function"&&require;if(!f&&u)return u(s,!0);if(o)return o(s,!0);var a=new Error("Cannot find module '"+s+"'");throw a.code="MODULE_NOT_FOUND",a}var h=r[s]={exports:{}};t[s][0].call(h.exports,function(e){var r=t[s][1][e];return i(r?r:e)},h,h.exports,e,t,r,n)}return r[s].exports}var o=typeof require=="function"&&require;for(var s=0;s<n.length;s++)i(n[s]);return i}({1:[function(e,t,r){"use strict";r.byteLength=h;r.toByteArray=l;r.fromByteArray=v;var n=[];var i=[];var o=typeof Uint8Array!=="undefined"?Uint8Array:Array;var s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(var f=0,u=s.length;f<u;++f){n[f]=s[f];i[s.charCodeAt(f)]=f}i["-".charCodeAt(0)]=62;i["_".charCodeAt(0)]=63;function a(e){var t=e.length;if(t%4>0){throw new Error("Invalid string. Length must be a multiple of 4")}return e[t-2]==="="?2:e[t-1]==="="?1:0}function h(e){return e.length*3/4-a(e)}function l(e){var t,r,n,s,f,u;var h=e.length;f=a(e);u=new o(h*3/4-f);n=f>0?h-4:h;var l=0;for(t=0,r=0;t<n;t+=4,r+=3){s=i[e.charCodeAt(t)]<<18|i[e.charCodeAt(t+1)]<<12|i[e.charCodeAt(t+2)]<<6|i[e.charCodeAt(t+3)];u[l++]=s>>16&255;u[l++]=s>>8&255;u[l++]=s&255}if(f===2){s=i[e.charCodeAt(t)]<<2|i[e.charCodeAt(t+1)]>>4;u[l++]=s&255}else if(f===1){s=i[e.charCodeAt(t)]<<10|i[e.charCodeAt(t+1)]<<4|i[e.charCodeAt(t+2)]>>2;u[l++]=s>>8&255;u[l++]=s&255}return u}function c(e){return n[e>>18&63]+n[e>>12&63]+n[e>>6&63]+n[e&63]}function p(e,t,r){var n;var i=[];for(var o=t;o<r;o+=3){n=(e[o]<<16)+(e[o+1]<<8)+e[o+2];i.push(c(n))}return i.join("")}function v(e){var t;var r=e.length;var i=r%3;var o="";var s=[];var f=16383;for(var u=0,a=r-i;u<a;u+=f){s.push(p(e,u,u+f>a?a:u+f))}if(i===1){t=e[r-1];o+=n[t>>2];o+=n[t<<4&63];o+="=="}else if(i===2){t=(e[r-2]<<8)+e[r-1];o+=n[t>>10];o+=n[t>>4&63];o+=n[t<<2&63];o+="="}s.push(o);return s.join("")}},{}],2:[function(e,t,r){(function(t){"use strict";var n=e("base64-js");var i=e("ieee754");var o=e("isarray");r.Buffer=a;r.SlowBuffer=_;r.INSPECT_MAX_BYTES=50;a.TYPED_ARRAY_SUPPORT=t.TYPED_ARRAY_SUPPORT!==undefined?t.TYPED_ARRAY_SUPPORT:s();r.kMaxLength=f();function s(){try{var e=new Uint8Array(1);e.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}};return e.foo()===42&&typeof e.subarray==="function"&&e.subarray(1,1).byteLength===0}catch(e){return false}}function f(){return a.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function u(e,t){if(f()<t){throw new RangeError("Invalid typed array length")}if(a.TYPED_ARRAY_SUPPORT){e=new Uint8Array(t);e.__proto__=a.prototype}else{if(e===null){e=new a(t)}e.length=t}return e}function a(e,t,r){if(!a.TYPED_ARRAY_SUPPORT&&!(this instanceof a)){return new a(e,t,r)}if(typeof e==="number"){if(typeof t==="string"){throw new Error("If encoding is specified then the first argument must be a string")}return p(this,e)}return h(this,e,t,r)}a.poolSize=8192;a._augment=function(e){e.__proto__=a.prototype;return e};function h(e,t,r,n){if(typeof t==="number"){throw new TypeError('"value" argument must not be a number')}if(typeof ArrayBuffer!=="undefined"&&t instanceof ArrayBuffer){return g(e,t,r,n)}if(typeof t==="string"){return v(e,t,r)}return y(e,t)}a.from=function(e,t,r){return h(null,e,t,r)};if(a.TYPED_ARRAY_SUPPORT){a.prototype.__proto__=Uint8Array.prototype;a.__proto__=Uint8Array;if(typeof Symbol!=="undefined"&&Symbol.species&&a[Symbol.species]===a){Object.defineProperty(a,Symbol.species,{value:null,configurable:true})}}function l(e){if(typeof e!=="number"){throw new TypeError('"size" argument must be a number')}else if(e<0){throw new RangeError('"size" argument must not be negative')}}function c(e,t,r,n){l(t);if(t<=0){return u(e,t)}if(r!==undefined){return typeof n==="string"?u(e,t).fill(r,n):u(e,t).fill(r)}return u(e,t)}a.alloc=function(e,t,r){return c(null,e,t,r)};function p(e,t){l(t);e=u(e,t<0?0:w(t)|0);if(!a.TYPED_ARRAY_SUPPORT){for(var r=0;r<t;++r){e[r]=0}}return e}a.allocUnsafe=function(e){return p(null,e)};a.allocUnsafeSlow=function(e){return p(null,e)};function v(e,t,r){if(typeof r!=="string"||r===""){r="utf8"}if(!a.isEncoding(r)){throw new TypeError('"encoding" must be a valid string encoding')}var n=b(t,r)|0;e=u(e,n);var i=e.write(t,r);if(i!==n){e=e.slice(0,i)}return e}function d(e,t){var r=t.length<0?0:w(t.length)|0;e=u(e,r);for(var n=0;n<r;n+=1){e[n]=t[n]&255}return e}function g(e,t,r,n){t.byteLength;if(r<0||t.byteLength<r){throw new RangeError("'offset' is out of bounds")}if(t.byteLength<r+(n||0)){throw new RangeError("'length' is out of bounds")}if(r===undefined&&n===undefined){t=new Uint8Array(t)}else if(n===undefined){t=new Uint8Array(t,r)}else{t=new Uint8Array(t,r,n)}if(a.TYPED_ARRAY_SUPPORT){e=t;e.__proto__=a.prototype}else{e=d(e,t)}return e}function y(e,t){if(a.isBuffer(t)){var r=w(t.length)|0;e=u(e,r);if(e.length===0){return e}t.copy(e,0,0,r);return e}if(t){if(typeof ArrayBuffer!=="undefined"&&t.buffer instanceof ArrayBuffer||"length"in t){if(typeof t.length!=="number"||te(t.length)){return u(e,0)}return d(e,t)}if(t.type==="Buffer"&&o(t.data)){return d(e,t.data)}}throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}function w(e){if(e>=f()){throw new RangeError("Attempt to allocate Buffer larger than maximum "+"size: 0x"+f().toString(16)+" bytes")}return e|0}function _(e){if(+e!=e){e=0}return a.alloc(+e)}a.isBuffer=function e(t){return!!(t!=null&&t._isBuffer)};a.compare=function e(t,r){if(!a.isBuffer(t)||!a.isBuffer(r)){throw new TypeError("Arguments must be Buffers")}if(t===r)return 0;var n=t.length;var i=r.length;for(var o=0,s=Math.min(n,i);o<s;++o){if(t[o]!==r[o]){n=t[o];i=r[o];break}}if(n<i)return-1;if(i<n)return 1;return 0};a.isEncoding=function e(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 true;default:return false}};a.concat=function e(t,r){if(!o(t)){throw new TypeError('"list" argument must be an Array of Buffers')}if(t.length===0){return a.alloc(0)}var n;if(r===undefined){r=0;for(n=0;n<t.length;++n){r+=t[n].length}}var i=a.allocUnsafe(r);var s=0;for(n=0;n<t.length;++n){var f=t[n];if(!a.isBuffer(f)){throw new TypeError('"list" argument must be an Array of Buffers')}f.copy(i,s);s+=f.length}return i};function b(e,t){if(a.isBuffer(e)){return e.length}if(typeof ArrayBuffer!=="undefined"&&typeof ArrayBuffer.isView==="function"&&(ArrayBuffer.isView(e)||e instanceof ArrayBuffer)){return e.byteLength}if(typeof e!=="string"){e=""+e}var r=e.length;if(r===0)return 0;var n=false;for(;;){switch(t){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":case undefined:return G(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return r*2;case"hex":return r>>>1;case"base64":return $(e).length;default:if(n)return G(e).length;t=(""+t).toLowerCase();n=true}}}a.byteLength=b;function m(e,t,r){var n=false;if(t===undefined||t<0){t=0}if(t>this.length){return""}if(r===undefined||r>this.length){r=this.length}if(r<=0){return""}r>>>=0;t>>>=0;if(r<=t){return""}if(!e)e="utf8";while(true){switch(e){case"hex":return M(this,t,r);case"utf8":case"utf-8":return x(this,t,r);case"ascii":return D(this,t,r);case"latin1":case"binary":return Y(this,t,r);case"base64":return U(this,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return O(this,t,r);default:if(n)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase();n=true}}}a.prototype._isBuffer=true;function E(e,t,r){var n=e[t];e[t]=e[r];e[r]=n}a.prototype.swap16=function e(){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){E(this,r,r+1)}return this};a.prototype.swap32=function e(){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){E(this,r,r+3);E(this,r+1,r+2)}return this};a.prototype.swap64=function e(){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){E(this,r,r+7);E(this,r+1,r+6);E(this,r+2,r+5);E(this,r+3,r+4)}return this};a.prototype.toString=function e(){var t=this.length|0;if(t===0)return"";if(arguments.length===0)return x(this,0,t);return m.apply(this,arguments)};a.prototype.equals=function e(t){if(!a.isBuffer(t))throw new TypeError("Argument must be a Buffer");if(this===t)return true;return a.compare(this,t)===0};a.prototype.inspect=function e(){var t="";var n=r.INSPECT_MAX_BYTES;if(this.length>0){t=this.toString("hex",0,n).match(/.{2}/g).join(" ");if(this.length>n)t+=" ... "}return"<Buffer "+t+">"};a.prototype.compare=function e(t,r,n,i,o){if(!a.isBuffer(t)){throw new TypeError("Argument must be a Buffer")}if(r===undefined){r=0}if(n===undefined){n=t?t.length:0}if(i===undefined){i=0}if(o===undefined){o=this.length}if(r<0||n>t.length||i<0||o>this.length){throw new RangeError("out of range index")}if(i>=o&&r>=n){return 0}if(i>=o){return-1}if(r>=n){return 1}r>>>=0;n>>>=0;i>>>=0;o>>>=0;if(this===t)return 0;var s=o-i;var f=n-r;var u=Math.min(s,f);var h=this.slice(i,o);var l=t.slice(r,n);for(var c=0;c<u;++c){if(h[c]!==l[c]){s=h[c];f=l[c];break}}if(s<f)return-1;if(f<s)return 1;return 0};function A(e,t,r,n,i){if(e.length===0)return-1;if(typeof r==="string"){n=r;r=0}else if(r>2147483647){r=2147483647}else if(r<-2147483648){r=-2147483648}r=+r;if(isNaN(r)){r=i?0:e.length-1}if(r<0)r=e.length+r;if(r>=e.length){if(i)return-1;else r=e.length-1}else if(r<0){if(i)r=0;else return-1}if(typeof t==="string"){t=a.from(t,n)}if(a.isBuffer(t)){if(t.length===0){return-1}return T(e,t,r,n,i)}else if(typeof t==="number"){t=t&255;if(a.TYPED_ARRAY_SUPPORT&&typeof Uint8Array.prototype.indexOf==="function"){if(i){return Uint8Array.prototype.indexOf.call(e,t,r)}else{return Uint8Array.prototype.lastIndexOf.call(e,t,r)}}return T(e,[t],r,n,i)}throw new TypeError("val must be string, number or Buffer")}function T(e,t,r,n,i){var o=1;var s=e.length;var f=t.length;if(n!==undefined){n=String(n).toLowerCase();if(n==="ucs2"||n==="ucs-2"||n==="utf16le"||n==="utf-16le"){if(e.length<2||t.length<2){return-1}o=2;s/=2;f/=2;r/=2}}function u(e,t){if(o===1){return e[t]}else{return e.readUInt16BE(t*o)}}var a;if(i){var h=-1;for(a=r;a<s;a++){if(u(e,a)===u(t,h===-1?0:a-h)){if(h===-1)h=a;if(a-h+1===f)return h*o}else{if(h!==-1)a-=a-h;h=-1}}}else{if(r+f>s)r=s-f;for(a=r;a>=0;a--){var l=true;for(var c=0;c<f;c++){if(u(e,a+c)!==u(t,c)){l=false;break}}if(l)return a}}return-1}a.prototype.includes=function e(t,r,n){return this.indexOf(t,r,n)!==-1};a.prototype.indexOf=function e(t,r,n){return A(this,t,r,n,true)};a.prototype.lastIndexOf=function e(t,r,n){return A(this,t,r,n,false)};function R(e,t,r,n){r=Number(r)||0;var i=e.length-r;if(!n){n=i}else{n=Number(n);if(n>i){n=i}}var o=t.length;if(o%2!==0)throw new TypeError("Invalid hex string");if(n>o/2){n=o/2}for(var s=0;s<n;++s){var f=parseInt(t.substr(s*2,2),16);if(isNaN(f))return s;e[r+s]=f}return s}function B(e,t,r,n){return ee(G(t,e.length-r),e,r,n)}function L(e,t,r,n){return ee(K(t),e,r,n)}function P(e,t,r,n){return L(e,t,r,n)}function S(e,t,r,n){return ee($(t),e,r,n)}function k(e,t,r,n){return ee(W(t,e.length-r),e,r,n)}a.prototype.write=function e(t,r,n,i){if(r===undefined){i="utf8";n=this.length;r=0}else if(n===undefined&&typeof r==="string"){i=r;n=this.length;r=0}else if(isFinite(r)){r=r|0;if(isFinite(n)){n=n|0;if(i===undefined)i="utf8"}else{i=n;n=undefined}}else{throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported")}var o=this.length-r;if(n===undefined||n>o)n=o;if(t.length>0&&(n<0||r<0)||r>this.length){throw new RangeError("Attempt to write outside buffer bounds")}if(!i)i="utf8";var s=false;for(;;){switch(i){case"hex":return R(this,t,r,n);case"utf8":case"utf-8":return B(this,t,r,n);case"ascii":return L(this,t,r,n);case"latin1":case"binary":return P(this,t,r,n);case"base64":return S(this,t,r,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return k(this,t,r,n);default:if(s)throw new TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase();s=true}}};a.prototype.toJSON=function e(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function U(e,t,r){if(t===0&&r===e.length){return n.fromByteArray(e)}else{return n.fromByteArray(e.slice(t,r))}}function x(e,t,r){r=Math.min(e.length,r);var n=[];var i=t;while(i<r){var o=e[i];var s=null;var f=o>239?4:o>223?3:o>191?2:1;if(i+f<=r){var u,a,h,l;switch(f){case 1:if(o<128){s=o}break;case 2:u=e[i+1];if((u&192)===128){l=(o&31)<<6|u&63;if(l>127){s=l}}break;case 3:u=e[i+1];a=e[i+2];if((u&192)===128&&(a&192)===128){l=(o&15)<<12|(u&63)<<6|a&63;if(l>2047&&(l<55296||l>57343)){s=l}}break;case 4:u=e[i+1];a=e[i+2];h=e[i+3];if((u&192)===128&&(a&192)===128&&(h&192)===128){l=(o&15)<<18|(u&63)<<12|(a&63)<<6|h&63;if(l>65535&&l<1114112){s=l}}}}if(s===null){s=65533;f=1}else if(s>65535){s-=65536;n.push(s>>>10&1023|55296);s=56320|s&1023}n.push(s);i+=f}return C(n)}var I=4096;function C(e){var t=e.length;if(t<=I){return String.fromCharCode.apply(String,e)}var r="";var n=0;while(n<t){r+=String.fromCharCode.apply(String,e.slice(n,n+=I))}return r}function D(e,t,r){var n="";r=Math.min(e.length,r);for(var i=t;i<r;++i){n+=String.fromCharCode(e[i]&127)}return n}function Y(e,t,r){var n="";r=Math.min(e.length,r);for(var i=t;i<r;++i){n+=String.fromCharCode(e[i])}return n}function M(e,t,r){var n=e.length;if(!t||t<0)t=0;if(!r||r<0||r>n)r=n;var i="";for(var o=t;o<r;++o){i+=Z(e[o])}return i}function O(e,t,r){var n=e.slice(t,r);var i="";for(var o=0;o<n.length;o+=2){i+=String.fromCharCode(n[o]+n[o+1]*256)}return i}a.prototype.slice=function e(t,r){var n=this.length;t=~~t;r=r===undefined?n:~~r;if(t<0){t+=n;if(t<0)t=0}else if(t>n){t=n}if(r<0){r+=n;if(r<0)r=0}else if(r>n){r=n}if(r<t)r=t;var i;if(a.TYPED_ARRAY_SUPPORT){i=this.subarray(t,r);i.__proto__=a.prototype}else{var o=r-t;i=new a(o,undefined);for(var s=0;s<o;++s){i[s]=this[s+t]}}return i};function j(e,t,r){if(e%1!==0||e<0)throw new RangeError("offset is not uint");if(e+t>r)throw new RangeError("Trying to access beyond buffer length")}a.prototype.readUIntLE=function e(t,r,n){t=t|0;r=r|0;if(!n)j(t,r,this.length);var i=this[t];var o=1;var s=0;while(++s<r&&(o*=256)){i+=this[t+s]*o}return i};a.prototype.readUIntBE=function e(t,r,n){t=t|0;r=r|0;if(!n){j(t,r,this.length)}var i=this[t+--r];var o=1;while(r>0&&(o*=256)){i+=this[t+--r]*o}return i};a.prototype.readUInt8=function e(t,r){if(!r)j(t,1,this.length);return this[t]};a.prototype.readUInt16LE=function e(t,r){if(!r)j(t,2,this.length);return this[t]|this[t+1]<<8};a.prototype.readUInt16BE=function e(t,r){if(!r)j(t,2,this.length);return this[t]<<8|this[t+1]};a.prototype.readUInt32LE=function e(t,r){if(!r)j(t,4,this.length);return(this[t]|this[t+1]<<8|this[t+2]<<16)+this[t+3]*16777216};a.prototype.readUInt32BE=function e(t,r){if(!r)j(t,4,this.length);return this[t]*16777216+(this[t+1]<<16|this[t+2]<<8|this[t+3])};a.prototype.readIntLE=function e(t,r,n){t=t|0;r=r|0;if(!n)j(t,r,this.length);var i=this[t];var o=1;var s=0;while(++s<r&&(o*=256)){i+=this[t+s]*o}o*=128;if(i>=o)i-=Math.pow(2,8*r);return i};a.prototype.readIntBE=function e(t,r,n){t=t|0;r=r|0;if(!n)j(t,r,this.length);var i=r;var o=1;var s=this[t+--i];while(i>0&&(o*=256)){s+=this[t+--i]*o}o*=128;if(s>=o)s-=Math.pow(2,8*r);return s};a.prototype.readInt8=function e(t,r){if(!r)j(t,1,this.length);if(!(this[t]&128))return this[t];return(255-this[t]+1)*-1};a.prototype.readInt16LE=function e(t,r){if(!r)j(t,2,this.length);var n=this[t]|this[t+1]<<8;return n&32768?n|4294901760:n};a.prototype.readInt16BE=function e(t,r){if(!r)j(t,2,this.length);var n=this[t+1]|this[t]<<8;return n&32768?n|4294901760:n};a.prototype.readInt32LE=function e(t,r){if(!r)j(t,4,this.length);return this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24};a.prototype.readInt32BE=function e(t,r){if(!r)j(t,4,this.length);return this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]};a.prototype.readFloatLE=function e(t,r){if(!r)j(t,4,this.length);return i.read(this,t,true,23,4)};a.prototype.readFloatBE=function e(t,r){if(!r)j(t,4,this.length);return i.read(this,t,false,23,4)};a.prototype.readDoubleLE=function e(t,r){if(!r)j(t,8,this.length);return i.read(this,t,true,52,8)};a.prototype.readDoubleBE=function e(t,r){if(!r)j(t,8,this.length);return i.read(this,t,false,52,8)};function N(e,t,r,n,i,o){if(!a.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>i||t<o)throw new RangeError('"value" argument is out of bounds');if(r+n>e.length)throw new RangeError("Index out of range")}a.prototype.writeUIntLE=function e(t,r,n,i){t=+t;r=r|0;n=n|0;if(!i){var o=Math.pow(2,8*n)-1;N(this,t,r,n,o,0)}var s=1;var f=0;this[r]=t&255;while(++f<n&&(s*=256)){this[r+f]=t/s&255}return r+n};a.prototype.writeUIntBE=function e(t,r,n,i){t=+t;r=r|0;n=n|0;if(!i){var o=Math.pow(2,8*n)-1;N(this,t,r,n,o,0)}var s=n-1;var f=1;this[r+s]=t&255;while(--s>=0&&(f*=256)){this[r+s]=t/f&255}return r+n};a.prototype.writeUInt8=function e(t,r,n){t=+t;r=r|0;if(!n)N(this,t,r,1,255,0);if(!a.TYPED_ARRAY_SUPPORT)t=Math.floor(t);this[r]=t&255;return r+1};function q(e,t,r,n){if(t<0)t=65535+t+1;for(var i=0,o=Math.min(e.length-r,2);i<o;++i){e[r+i]=(t&255<<8*(n?i:1-i))>>>(n?i:1-i)*8}}a.prototype.writeUInt16LE=function e(t,r,n){t=+t;r=r|0;if(!n)N(this,t,r,2,65535,0);if(a.TYPED_ARRAY_SUPPORT){this[r]=t&255;this[r+1]=t>>>8}else{q(this,t,r,true)}return r+2};a.prototype.writeUInt16BE=function e(t,r,n){t=+t;r=r|0;if(!n)N(this,t,r,2,65535,0);if(a.TYPED_ARRAY_SUPPORT){this[r]=t>>>8;this[r+1]=t&255}else{q(this,t,r,false)}return r+2};function z(e,t,r,n){if(t<0)t=4294967295+t+1;for(var i=0,o=Math.min(e.length-r,4);i<o;++i){e[r+i]=t>>>(n?i:3-i)*8&255}}a.prototype.writeUInt32LE=function e(t,r,n){t=+t;r=r|0;if(!n)N(this,t,r,4,4294967295,0);if(a.TYPED_ARRAY_SUPPORT){this[r+3]=t>>>24;this[r+2]=t>>>16;this[r+1]=t>>>8;this[r]=t&255}else{z(this,t,r,true)}return r+4};a.prototype.writeUInt32BE=function e(t,r,n){t=+t;r=r|0;if(!n)N(this,t,r,4,4294967295,0);if(a.TYPED_ARRAY_SUPPORT){this[r]=t>>>24;this[r+1]=t>>>16;this[r+2]=t>>>8;this[r+3]=t&255}else{z(this,t,r,false)}return r+4};a.prototype.writeIntLE=function e(t,r,n,i){t=+t;r=r|0;if(!i){var o=Math.pow(2,8*n-1);N(this,t,r,n,o-1,-o)}var s=0;var f=1;var u=0;this[r]=t&255;while(++s<n&&(f*=256)){if(t<0&&u===0&&this[r+s-1]!==0){u=1}this[r+s]=(t/f>>0)-u&255}return r+n};a.prototype.writeIntBE=function e(t,r,n,i){t=+t;r=r|0;if(!i){var o=Math.pow(2,8*n-1);N(this,t,r,n,o-1,-o)}var s=n-1;var f=1;var u=0;this[r+s]=t&255;while(--s>=0&&(f*=256)){if(t<0&&u===0&&this[r+s+1]!==0){u=1}this[r+s]=(t/f>>0)-u&255}return r+n};a.prototype.writeInt8=function e(t,r,n){t=+t;r=r|0;if(!n)N(this,t,r,1,127,-128);if(!a.TYPED_ARRAY_SUPPORT)t=Math.floor(t);if(t<0)t=255+t+1;this[r]=t&255;return r+1};a.prototype.writeInt16LE=function e(t,r,n){t=+t;r=r|0;if(!n)N(this,t,r,2,32767,-32768);if(a.TYPED_ARRAY_SUPPORT){this[r]=t&255;this[r+1]=t>>>8}else{q(this,t,r,true)}return r+2};a.prototype.writeInt16BE=function e(t,r,n){t=+t;r=r|0;if(!n)N(this,t,r,2,32767,-32768);if(a.TYPED_ARRAY_SUPPORT){this[r]=t>>>8;this[r+1]=t&255}else{q(this,t,r,false)}return r+2};a.prototype.writeInt32LE=function e(t,r,n){t=+t;r=r|0;if(!n)N(this,t,r,4,2147483647,-2147483648);if(a.TYPED_ARRAY_SUPPORT){this[r]=t&255;this[r+1]=t>>>8;this[r+2]=t>>>16;this[r+3]=t>>>24}else{z(this,t,r,true)}return r+4};a.prototype.writeInt32BE=function e(t,r,n){t=+t;r=r|0;if(!n)N(this,t,r,4,2147483647,-2147483648);if(t<0)t=4294967295+t+1;if(a.TYPED_ARRAY_SUPPORT){this[r]=t>>>24;this[r+1]=t>>>16;this[r+2]=t>>>8;this[r+3]=t&255}else{z(this,t,r,false)}return r+4};function F(e,t,r,n,i,o){if(r+n>e.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function X(e,t,r,n,o){if(!o){F(e,t,r,4,3.4028234663852886e38,-3.4028234663852886e38)}i.write(e,t,r,n,23,4);return r+4}a.prototype.writeFloatLE=function e(t,r,n){return X(this,t,r,true,n)};a.prototype.writeFloatBE=function e(t,r,n){return X(this,t,r,false,n)};function H(e,t,r,n,o){if(!o){F(e,t,r,8,1.7976931348623157e308,-1.7976931348623157e308)}i.write(e,t,r,n,52,8);return r+8}a.prototype.writeDoubleLE=function e(t,r,n){return H(this,t,r,true,n)};a.prototype.writeDoubleBE=function e(t,r,n){return H(this,t,r,false,n)};a.prototype.copy=function e(t,r,n,i){if(!n)n=0;if(!i&&i!==0)i=this.length;if(r>=t.length)r=t.length;if(!r)r=0;if(i>0&&i<n)i=n;if(i===n)return 0;if(t.length===0||this.length===0)return 0;if(r<0){throw new RangeError("targetStart out of bounds")}if(n<0||n>=this.length)throw new RangeError("sourceStart out of bounds");if(i<0)throw new RangeError("sourceEnd out of bounds");if(i>this.length)i=this.length;if(t.length-r<i-n){i=t.length-r+n}var o=i-n;var s;if(this===t&&n<r&&r<i){for(s=o-1;s>=0;--s){t[s+r]=this[s+n]}}else if(o<1e3||!a.TYPED_ARRAY_SUPPORT){for(s=0;s<o;++s){t[s+r]=this[s+n]}}else{Uint8Array.prototype.set.call(t,this.subarray(n,n+o),r)}return o};a.prototype.fill=function e(t,r,n,i){if(typeof t==="string"){if(typeof r==="string"){i=r;r=0;n=this.length}else if(typeof n==="string"){i=n;n=this.length}if(t.length===1){var o=t.charCodeAt(0);if(o<256){t=o}}if(i!==undefined&&typeof i!=="string"){throw new TypeError("encoding must be a string")}if(typeof i==="string"&&!a.isEncoding(i)){throw new TypeError("Unknown encoding: "+i)}}else if(typeof t==="number"){t=t&255}if(r<0||this.length<r||this.length<n){throw new RangeError("Out of range index")}if(n<=r){return this}r=r>>>0;n=n===undefined?this.length:n>>>0;if(!t)t=0;var s;if(typeof t==="number"){for(s=r;s<n;++s){this[s]=t}}else{var f=a.isBuffer(t)?t:G(new a(t,i).toString());var u=f.length;for(s=0;s<n-r;++s){this[s+r]=f[s%u]}}return this};var Q=/[^+\/0-9A-Za-z-_]/g;function V(e){e=J(e).replace(Q,"");if(e.length<2)return"";while(e.length%4!==0){e=e+"="}return e}function J(e){if(e.trim)return e.trim();return e.replace(/^\s+|\s+$/g,"")}function Z(e){if(e<16)return"0"+e.toString(16);return e.toString(16)}function G(e,t){t=t||Infinity;var r;var n=e.length;var i=null;var o=[];for(var s=0;s<n;++s){r=e.charCodeAt(s);if(r>55295&&r<57344){if(!i){if(r>56319){if((t-=3)>-1)o.push(239,191,189);continue}else if(s+1===n){if((t-=3)>-1)o.push(239,191,189);continue}i=r;continue}if(r<56320){if((t-=3)>-1)o.push(239,191,189);i=r;continue}r=(i-55296<<10|r-56320)+65536}else if(i){if((t-=3)>-1)o.push(239,191,189)}i=null;if(r<128){if((t-=1)<0)break;o.push(r)}else if(r<2048){if((t-=2)<0)break;o.push(r>>6|192,r&63|128)}else if(r<65536){if((t-=3)<0)break;o.push(r>>12|224,r>>6&63|128,r&63|128)}else if(r<1114112){if((t-=4)<0)break;o.push(r>>18|240,r>>12&63|128,r>>6&63|128,r&63|128)}else{throw new Error("Invalid code point")}}return o}function K(e){var t=[];for(var r=0;r<e.length;++r){t.push(e.charCodeAt(r)&255)}return t}function W(e,t){var r,n,i;var o=[];for(var s=0;s<e.length;++s){if((t-=2)<0)break;r=e.charCodeAt(s);n=r>>8;i=r%256;o.push(i);o.push(n)}return o}function $(e){return n.toByteArray(V(e))}function ee(e,t,r,n){for(var i=0;i<n;++i){if(i+r>=t.length||i>=e.length)break;t[i+r]=e[i]}return i}function te(e){return e!==e}}).call(this,typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{})},{"base64-js":1,ieee754:5,isarray:7}],3:[function(e,t,r){function n(){this._events=this._events||{};this._maxListeners=this._maxListeners||undefined}t.exports=n;n.EventEmitter=n;n.prototype._events=undefined;n.prototype._maxListeners=undefined;n.defaultMaxListeners=10;n.prototype.setMaxListeners=function(e){if(!o(e)||e<0||isNaN(e))throw TypeError("n must be a positive number");this._maxListeners=e;return this};n.prototype.emit=function(e){var t,r,n,o,u,a;if(!this._events)this._events={};if(e==="error"){if(!this._events.error||s(this._events.error)&&!this._events.error.length){t=arguments[1];if(t instanceof Error){throw t}else{var h=new Error('Uncaught, unspecified "error" event. ('+t+")");h.context=t;throw h}}}r=this._events[e];if(f(r))return false;if(i(r)){switch(arguments.length){case 1:r.call(this);break;case 2:r.call(this,arguments[1]);break;case 3:r.call(this,arguments[1],arguments[2]);break;default:o=Array.prototype.slice.call(arguments,1);r.apply(this,o)}}else if(s(r)){o=Array.prototype.slice.call(arguments,1);a=r.slice();n=a.length;for(u=0;u<n;u++)a[u].apply(this,o)}return true};n.prototype.addListener=function(e,t){var r;if(!i(t))throw TypeError("listener must be a function");if(!this._events)this._events={};if(this._events.newListener)this.emit("newListener",e,i(t.listener)?t.listener:t);if(!this._events[e])this._events[e]=t;else if(s(this._events[e]))this._events[e].push(t);else this._events[e]=[this._events[e],t];if(s(this._events[e])&&!this._events[e].warned){if(!f(this._maxListeners)){r=this._maxListeners}else{r=n.defaultMaxListeners}if(r&&r>0&&this._events[e].length>r){this._events[e].warned=true;console.error("(node) warning: possible EventEmitter memory "+"leak detected. %d listeners added. "+"Use emitter.setMaxListeners() to increase limit.",this._events[e].length);if(typeof console.trace==="function"){console.trace()}}}return this};n.prototype.on=n.prototype.addListener;n.prototype.once=function(e,t){if(!i(t))throw TypeError("listener must be a function");var r=false;function n(){this.removeListener(e,n);if(!r){r=true;t.apply(this,arguments)}}n.listener=t;this.on(e,n);return this};n.prototype.removeListener=function(e,t){var r,n,o,f;if(!i(t))throw TypeError("listener must be a function");if(!this._events||!this._events[e])return this;r=this._events[e];o=r.length;n=-1;if(r===t||i(r.listener)&&r.listener===t){delete this._events[e];if(this._events.removeListener)this.emit("removeListener",e,t)}else if(s(r)){for(f=o;f-- >0;){if(r[f]===t||r[f].listener&&r[f].listener===t){n=f;break}}if(n<0)return this;if(r.length===1){r.length=0;delete this._events[e]}else{r.splice(n,1)}if(this._events.removeListener)this.emit("removeListener",e,t)}return this};n.prototype.removeAllListeners=function(e){var t,r;if(!this._events)return this;if(!this._events.removeListener){if(arguments.length===0)this._events={};else if(this._events[e])delete this._events[e];return this}if(arguments.length===0){for(t in this._events){if(t==="removeListener")continue;this.removeAllListeners(t)}this.removeAllListeners("removeListener");this._events={};return this}r=this._events[e];if(i(r)){this.removeListener(e,r)}else if(r){while(r.length)this.removeListener(e,r[r.length-1])}delete this._events[e];return this};n.prototype.listeners=function(e){var t;if(!this._events||!this._events[e])t=[];else if(i(this._events[e]))t=[this._events[e]];else t=this._events[e].slice();return t};n.prototype.listenerCount=function(e){if(this._events){var t=this._events[e];if(i(t))return 1;else if(t)return t.length}return 0};n.listenerCount=function(e,t){return e.listenerCount(t)};function i(e){return typeof e==="function"}function o(e){return typeof e==="number"}function s(e){return typeof e==="object"&&e!==null}function f(e){return e===void 0}},{}],4:[function(e,t,r){t.exports=f;var n=e("events").EventEmitter;var i=e("inherits");var o=typeof window==="undefined"?self:window;var s=o.indexedDB||o.mozIndexedDB||o.webkitIndexedDB||o.msIndexedDB;f.INDEXEDDB_SUPPORT=s!=null;f.BROADCAST_SUPPORT=o.BroadcastChannel!=null;i(f,n);function f(e,t,r){var i=this;if(typeof e!=="string")throw new Error("A name must be supplied of type string");if(!s)throw new Error("IndexedDB not supported");if(typeof t==="function")return new f(e,null,t);if(!(this instanceof f))return new f(e,t,r);if(!t)t={};n.call(i);i._name=e;i._db=null;i._closed=false;i._queue=[];i._Channel=t.channel||o.BroadcastChannel;i._channel=null;var u=s.open(e);u.onerror=a;u.onsuccess=h;u.onupgradeneeded=l;i.on("newListener",p);function a(e){i.close();i._handleError(e,r)}function h(e){if(i._closed){e.target.result.close()}else{i._db=e.target.result;i._db.onclose=c;i._drainQueue();if(r)r(null);i.emit("open")}}function l(e){if(i._closed)return;var t=e.target.result;t.createObjectStore("kv",{autoIncrement:true})}function c(){i.close()}function p(e){if(e!=="add"&&e!=="set"&&e!=="remove")return;if(!i._Channel)return i.emit("error",new Error("No BroadcastChannel support"));i._channel=new i._Channel(i._name);i._channel.onmessage=v;i.removeListener("newListener",p)}function v(e){if(e.data.method==="add")i.emit("add",e.data);else if(e.data.method==="set")i.emit("set",e.data);else if(e.data.method==="remove")i.emit("remove",e.data)}}f.prototype.get=function(e,t){var r=this;if(r._closed)throw new Error("Database is closed");var n=u(t);if(!r._db){r._queue.push([r.get,e,n.cb])}else if(Array.isArray(e)){var i=[];var o=false;var s=0;e.forEach(function(t,f){r.get(e[f],function(t,r){if(o)return;if(t){o=true;n.cb(t)}i[f]=r;s++;if(s===e.length)n.cb(null,i)})})}else{var f=r._db.transaction("kv","readonly");var a=f.objectStore("kv").get(e);a.onsuccess=function(e){n.cb(null,e.target.result)};f.onerror=function(e){r._handleError(e,n.cb)}}return n.promise};f.prototype.set=function(e,t,r){var n=this;if(n._closed)throw new Error("Database is closed");var i=u(r);if(!n._db){n._queue.push([n.set,e,t,i.cb])}else{var o=n._db.transaction("kv","readwrite");var s=o.objectStore("kv").put(t,e);s.onsuccess=function(){if(n._channel){n._channel.postMessage({method:"set",key:e,value:t})}i.cb(null)};o.onerror=function(e){n._handleError(e,i.cb)}}return i.promise};f.prototype.json=function(e){var t=this;if(t._closed)throw new Error("Database is closed");var r=u(e);if(!t._db){t._queue.push([t.json,r.cb])}else{var n=t._db.transaction("kv","readonly");var i=n.objectStore("kv").openCursor();var o={};i.onsuccess=function(e){var t=e.target.result;if(t){o[t.key]=t.value;t.continue()}else{r.cb(null,o)}};n.onerror=function(e){t._handleError(e,r.cb)}}return r.promise};f.prototype.keys=function(e){var t=this;if(t._closed)throw new Error("Database is closed");var r=u(e);if(!t._db){t._queue.push([t.keys,r.cb])}else{var n=t._db.transaction("kv","readonly");var i=n.objectStore("kv").openCursor();var o=[];i.onsuccess=function(e){var t=e.target.result;if(t){o.push(t.key);t.continue()}else{r.cb(null,o)}};n.onerror=function(e){t._handleError(e,r.cb)}}return r.promise};f.prototype.values=function(e){var t=this;if(t._closed)throw new Error("Database is closed");var r=u(e);if(!t._db){t._queue.push([t.values,r.cb])}else{var n=t._db.transaction("kv","readonly");var i=n.objectStore("kv").openCursor();var o=[];i.onsuccess=function(e){var t=e.target.result;if(t){o.push(t.value);t.continue()}else{r.cb(null,o)}};n.onerror=function(e){t._handleError(e,r.cb)}}return r.promise};f.prototype.remove=function(e,t){var r=this;if(r._closed)throw new Error("Database is closed");var n=u(t);if(!r._db){r._queue.push([r.remove,e,n.cb])}else{var i=r._db.transaction("kv","readwrite");var o=i.objectStore("kv").delete(e);o.onsuccess=function(t){if(r._channel){r._channel.postMessage({method:"remove",key:e})}n.cb(null)};i.onerror=function(e){r._handleError(e,n.cb)}}return n.promise};f.prototype.clear=function(e){var t=this;if(t._closed)throw new Error("Database is closed");var r=u(e);if(!t._db){t._queue.push([t.clear,r.cb])}else{var n=t._db.transaction("kv","readwrite");var i=n.objectStore("kv").clear();i.onsuccess=function(e){r.cb(null)};n.onerror=function(e){t._handleError(e,r.cb)}}return r.promise};f.prototype.count=function(e){var t=this;if(t._closed)throw new Error("Database is closed");var r=u(e);if(!t._db){t._queue.push([t.count,r.cb])}else{var n=t._db.transaction("kv","readonly");var i=n.objectStore("kv").count();i.onsuccess=function(e){r.cb(null,e.target.result)};n.onerror=function(e){t._handleError(e,r.cb)}}return r.promise};f.prototype.add=function(e,t,r){var n=this;if(n._closed)throw new Error("Database is closed");if(typeof t==="function"||arguments.length===1)return n.add(undefined,e,t);
var i=u(r);if(!n._db){n._queue.push([n.add,e,t,i.cb])}else{var o=n._db.transaction("kv","readwrite");var s=e==null?o.objectStore("kv").add(t):o.objectStore("kv").add(t,e);s.onsuccess=function(r){if(n._channel){n._channel.postMessage({method:"add",key:e,value:t})}i.cb(null)};o.onerror=function(e){n._handleError(e,i.cb)}}return i.promise};f.prototype.close=function(){if(this._closed)return;this._closed=true;if(this._db)this._db.close();if(this._channel)this._channel.close();this._db=null;this._channel=null;this._queue=null;this.emit("close");this.removeAllListeners()};f.prototype._drainQueue=function(){var e=this;for(var t=0;t<e._queue.length;t++){var r=e._queue[t];var n=r.splice(1);r[0].apply(e,n)}e._queue=null};f.prototype._handleError=function(e,t){var r=e.target.error;e.preventDefault();if(t){t(r)}else{this.emit("error",r)}};function u(e){var t={cb:e};if(typeof Promise==="function"&&e==null){t.promise=new Promise(function(e,r){t.cb=function(t,n){if(t)return r(t);else return e(n)}})}if(!t.cb)t.cb=function e(){};return t}},{events:3,inherits:6}],5:[function(e,t,r){r.read=function(e,t,r,n,i){var o,s;var f=i*8-n-1;var u=(1<<f)-1;var a=u>>1;var h=-7;var l=r?i-1:0;var c=r?-1:1;var p=e[t+l];l+=c;o=p&(1<<-h)-1;p>>=-h;h+=f;for(;h>0;o=o*256+e[t+l],l+=c,h-=8){}s=o&(1<<-h)-1;o>>=-h;h+=n;for(;h>0;s=s*256+e[t+l],l+=c,h-=8){}if(o===0){o=1-a}else if(o===u){return s?NaN:(p?-1:1)*Infinity}else{s=s+Math.pow(2,n);o=o-a}return(p?-1:1)*s*Math.pow(2,o-n)};r.write=function(e,t,r,n,i,o){var s,f,u;var a=o*8-i-1;var h=(1<<a)-1;var l=h>>1;var c=i===23?Math.pow(2,-24)-Math.pow(2,-77):0;var p=n?0:o-1;var v=n?1:-1;var d=t<0||t===0&&1/t<0?1:0;t=Math.abs(t);if(isNaN(t)||t===Infinity){f=isNaN(t)?1:0;s=h}else{s=Math.floor(Math.log(t)/Math.LN2);if(t*(u=Math.pow(2,-s))<1){s--;u*=2}if(s+l>=1){t+=c/u}else{t+=c*Math.pow(2,1-l)}if(t*u>=2){s++;u/=2}if(s+l>=h){f=0;s=h}else if(s+l>=1){f=(t*u-1)*Math.pow(2,i);s=s+l}else{f=t*Math.pow(2,l-1)*Math.pow(2,i);s=0}}for(;i>=8;e[r+p]=f&255,p+=v,f/=256,i-=8){}s=s<<i|f;a+=i;for(;a>0;e[r+p]=s&255,p+=v,s/=256,a-=8){}e[r+p-v]|=d*128}},{}],6:[function(e,t,r){if(typeof Object.create==="function"){t.exports=function e(t,r){t.super_=r;t.prototype=Object.create(r.prototype,{constructor:{value:t,enumerable:false,writable:true,configurable:true}})}}else{t.exports=function e(t,r){t.super_=r;var n=function(){};n.prototype=r.prototype;t.prototype=new n;t.prototype.constructor=t}}},{}],7:[function(e,t,r){var n={}.toString;t.exports=Array.isArray||function(e){return n.call(e)=="[object Array]"}},{}],8:[function(e,t,r){var n=t.exports={};var i;var o;function s(){throw new Error("setTimeout has not been defined")}function f(){throw new Error("clearTimeout has not been defined")}(function(){try{if(typeof setTimeout==="function"){i=setTimeout}else{i=s}}catch(e){i=s}try{if(typeof clearTimeout==="function"){o=clearTimeout}else{o=f}}catch(e){o=f}})();function u(e){if(i===setTimeout){return setTimeout(e,0)}if((i===s||!i)&&setTimeout){i=setTimeout;return setTimeout(e,0)}try{return i(e,0)}catch(t){try{return i.call(null,e,0)}catch(t){return i.call(this,e,0)}}}function a(e){if(o===clearTimeout){return clearTimeout(e)}if((o===f||!o)&&clearTimeout){o=clearTimeout;return clearTimeout(e)}try{return o(e)}catch(t){try{return o.call(null,e)}catch(t){return o.call(this,e)}}}var h=[];var l=false;var c;var p=-1;function v(){if(!l||!c){return}l=false;if(c.length){h=c.concat(h)}else{p=-1}if(h.length){d()}}function d(){if(l){return}var e=u(v);l=true;var t=h.length;while(t){c=h;h=[];while(++p<t){if(c){c[p].run()}}p=-1;t=h.length}c=null;l=false;a(e)}n.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1){for(var r=1;r<arguments.length;r++){t[r-1]=arguments[r]}}h.push(new g(e,t));if(h.length===1&&!l){u(d)}};function g(e,t){this.fun=e;this.array=t}g.prototype.run=function(){this.fun.apply(null,this.array)};n.title="browser";n.browser=true;n.env={};n.argv=[];n.version="";n.versions={};function y(){}n.on=y;n.addListener=y;n.once=y;n.off=y;n.removeListener=y;n.removeAllListeners=y;n.emit=y;n.binding=function(e){throw new Error("process.binding is not supported")};n.cwd=function(){return"/"};n.chdir=function(e){throw new Error("process.chdir is not supported")};n.umask=function(){return 0}},{}],"/":[function(e,t,r){(function(r,n){t.exports=o;var i=e("idb-kv-store");function o(e,t,r){var n=this;if(typeof e!=="number")throw new Error("chunkLength must be a number");if(typeof t==="function")return o(e,null,t);if(!(n instanceof o))return new o(e,t,r);if(!t)t={};n.chunkLength=e;n.length=Number(t.length)||Infinity;if(n.length!==Infinity){this.lastChunkLength=this.length%this.chunkLength||this.chunkLength;n.lastChunkIndex=Math.ceil(n.length/n.chunkLength)-1}var s=t.name||""+Math.round(9e16*Math.random());if(t.torrent&&t.torrent.infoHash)s=t.torrent.infoHash;n._store=new i(s,r)}o.prototype.put=function(e,t,i){var o=this;if(!i)i=s;if(!o._store)throw new Error("Store is closed");if(typeof e!=="number")throw new Error("index must be a number");if(!n.isBuffer(t))t=new n(t);var f=e===o.lastChunkIndex;var u=f&&t.length!==o.lastChunkLength||!f&&t.length!==o.chunkLength;if(u)return r.nextTick(i,new Error("Invalid buffer length"));o._store.set(e,t,i)};o.prototype.get=function(e,t,r){var i=this;if(typeof t==="function")return i.get(e,null,t);if(typeof r!=="function")throw new Error("cb must be a function");if(!i._store)throw new Error("Store is closed");if(typeof e!=="number")throw new Error("index must be a number");if(!t)t={};i._store.get(e,function(e,i){if(e)return r(e);if(typeof i==="undefined")return r(new Error("Chunk does not exist"));var o="offset"in t?t.offset:0;var s="length"in t?t.length:i.length-o;r(null,new n(i).slice(o,o+s))})};o.prototype.close=function(e){if(!e)e=s;if(this._store)this._store.close();this._store=null;r.nextTick(e,null)};o.prototype.destroy=function(e){var t=this;var r=t._store;t._store=null;r.clear(function(t){r.close();if(e)e(t)})};function s(){}}).call(this,e("_process"),e("buffer").Buffer)},{_process:8,buffer:2,"idb-kv-store":4}]},{},[])("/")});
{
"name": "indexeddb-chunk-store",
"version": "2.1.0",
"version": "2.1.1",
"description": "A Chunk Store compatible store backed by IndexedDB",

@@ -33,12 +33,12 @@ "main": "index.js",

"dependencies": {
"idb-kv-store": "^3.0.0"
"idb-kv-store": "^4.0.0"
},
"devDependencies": {
"abstract-chunk-store": "^1.2.1",
"browserify": "^13.1.1",
"abstract-chunk-store": "^1.3.0",
"browserify": "^13.3.0",
"standard": "^8.6.0",
"tape": "^4.6.3",
"uglify-js": "^2.7.4",
"uglify-js": "^2.7.5",
"zuul": "^3.11.1"
}
}

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