Comparing version 6.6.1 to 7.0.0
@@ -7,2 +7,8 @@ # Change Log | ||
## [7.0.0] - 2018-01-13 | ||
- **Added** `load` support for browser | ||
- **Added** `save` support for browser | ||
- **Added** `autoLoad` support for browser | ||
- **Added** `autoSave` support for browser | ||
## [6.6.1] - 2017-12-04 | ||
@@ -9,0 +15,0 @@ - Fixed main entry point |
@@ -1,2 +0,2 @@ | ||
// [AIV] InCache Build version: 6.6.1 | ||
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("incache",[],t):"object"==typeof exports?exports.incache=t():e.incache=t()}(this,function(){return function(e){function t(n){if(r[n])return r[n].exports;var i=r[n]={i:n,l:!1,exports:{}};return e[n].call(i.exports,i,i.exports,t),i.l=!0,i.exports}var r={};return t.m=e,t.c=r,t.d=function(e,r,n){t.o(e,r)||Object.defineProperty(e,r,{configurable:!1,enumerable:!0,get:n})},t.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(r,"a",r),r},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=3)}([function(e,t,r){"use strict";var n,i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};n=function(){return this}();try{n=n||Function("return this")()||(0,eval)("this")}catch(e){"object"===("undefined"==typeof window?"undefined":i(window))&&(n=window)}e.exports=n},function(e,t,r){"use strict";e.exports=function(e){return e.webpackPolyfill||(e.deprecate=function(){},e.paths=[],e.children||(e.children=[]),Object.defineProperty(e,"loaded",{enumerable:!0,get:function(){return e.l}}),Object.defineProperty(e,"id",{enumerable:!0,get:function(){return e.i}}),e.webpackPolyfill=1),e}},function(e,t,r){"use strict";(function(e){function n(){return o.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function i(e,t){if(n()<t)throw new RangeError("Invalid typed array length");return o.TYPED_ARRAY_SUPPORT?(e=new Uint8Array(t),e.__proto__=o.prototype):(null===e&&(e=new o(t)),e.length=t),e}function o(e,t,r){if(!(o.TYPED_ARRAY_SUPPORT||this instanceof o))return new o(e,t,r);if("number"==typeof e){if("string"==typeof t)throw new Error("If encoding is specified then the first argument must be a string");return f(this,e)}return s(this,e,t,r)}function s(e,t,r,n){if("number"==typeof t)throw new TypeError('"value" argument must not be a number');return"undefined"!=typeof ArrayBuffer&&t instanceof ArrayBuffer?c(e,t,r,n):"string"==typeof t?h(e,t,r):p(e,t)}function u(e){if("number"!=typeof e)throw new TypeError('"size" argument must be a number');if(e<0)throw new RangeError('"size" argument must not be negative')}function a(e,t,r,n){return u(t),t<=0?i(e,t):void 0!==r?"string"==typeof n?i(e,t).fill(r,n):i(e,t).fill(r):i(e,t)}function f(e,t){if(u(t),e=i(e,t<0?0:0|y(t)),!o.TYPED_ARRAY_SUPPORT)for(var r=0;r<t;++r)e[r]=0;return e}function h(e,t,r){if("string"==typeof r&&""!==r||(r="utf8"),!o.isEncoding(r))throw new TypeError('"encoding" must be a valid string encoding');var n=0|v(t,r);e=i(e,n);var s=e.write(t,r);return s!==n&&(e=e.slice(0,s)),e}function l(e,t){var r=t.length<0?0:0|y(t.length);e=i(e,r);for(var n=0;n<r;n+=1)e[n]=255&t[n];return e}function c(e,t,r,n){if(t.byteLength,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");return t=void 0===r&&void 0===n?new Uint8Array(t):void 0===n?new Uint8Array(t,r):new Uint8Array(t,r,n),o.TYPED_ARRAY_SUPPORT?(e=t,e.__proto__=o.prototype):e=l(e,t),e}function p(e,t){if(o.isBuffer(t)){var r=0|y(t.length);return e=i(e,r),0===e.length?e:(t.copy(e,0,0,r),e)}if(t){if("undefined"!=typeof ArrayBuffer&&t.buffer instanceof ArrayBuffer||"length"in t)return"number"!=typeof t.length||H(t.length)?i(e,0):l(e,t);if("Buffer"===t.type&&W(t.data))return l(e,t.data)}throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}function y(e){if(e>=n())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+n().toString(16)+" bytes");return 0|e}function d(e){return+e!=e&&(e=0),o.alloc(+e)}function v(e,t){if(o.isBuffer(e))return e.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(e)||e instanceof ArrayBuffer))return e.byteLength;"string"!=typeof e&&(e=""+e);var r=e.length;if(0===r)return 0;for(var n=!1;;)switch(t){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":case void 0:return V(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return J(e).length;default:if(n)return V(e).length;t=(""+t).toLowerCase(),n=!0}}function m(e,t,r){var n=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if(r>>>=0,t>>>=0,r<=t)return"";for(e||(e="utf8");;)switch(e){case"hex":return C(this,t,r);case"utf8":case"utf-8":return P(this,t,r);case"ascii":return T(this,t,r);case"latin1":case"binary":return B(this,t,r);case"base64":return x(this,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return L(this,t,r);default:if(n)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),n=!0}}function g(e,t,r){var n=e[t];e[t]=e[r],e[r]=n}function b(e,t,r,n,i){if(0===e.length)return-1;if("string"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,isNaN(r)&&(r=i?0:e.length-1),r<0&&(r=e.length+r),r>=e.length){if(i)return-1;r=e.length-1}else if(r<0){if(!i)return-1;r=0}if("string"==typeof t&&(t=o.from(t,n)),o.isBuffer(t))return 0===t.length?-1:w(e,t,r,n,i);if("number"==typeof t)return t&=255,o.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(e,t,r):Uint8Array.prototype.lastIndexOf.call(e,t,r):w(e,[t],r,n,i);throw new TypeError("val must be string, number or Buffer")}function w(e,t,r,n,i){function o(e,t){return 1===s?e[t]:e.readUInt16BE(t*s)}var s=1,u=e.length,a=t.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(e.length<2||t.length<2)return-1;s=2,u/=2,a/=2,r/=2}var f;if(i){var h=-1;for(f=r;f<u;f++)if(o(e,f)===o(t,-1===h?0:f-h)){if(-1===h&&(h=f),f-h+1===a)return h*s}else-1!==h&&(f-=f-h),h=-1}else for(r+a>u&&(r=u-a),f=r;f>=0;f--){for(var l=!0,c=0;c<a;c++)if(o(e,f+c)!==o(t,c)){l=!1;break}if(l)return f}return-1}function _(e,t,r,n){r=Number(r)||0;var i=e.length-r;n?(n=Number(n))>i&&(n=i):n=i;var o=t.length;if(o%2!=0)throw new TypeError("Invalid hex string");n>o/2&&(n=o/2);for(var s=0;s<n;++s){var u=parseInt(t.substr(2*s,2),16);if(isNaN(u))return s;e[r+s]=u}return s}function E(e,t,r,n){return X(V(t,e.length-r),e,r,n)}function A(e,t,r,n){return X(q(t),e,r,n)}function S(e,t,r,n){return A(e,t,r,n)}function O(e,t,r,n){return X(J(t),e,r,n)}function R(e,t,r,n){return X(K(t,e.length-r),e,r,n)}function x(e,t,r){return 0===t&&r===e.length?Z.fromByteArray(e):Z.fromByteArray(e.slice(t,r))}function P(e,t,r){r=Math.min(e.length,r);for(var n=[],i=t;i<r;){var o=e[i],s=null,u=o>239?4:o>223?3:o>191?2:1;if(i+u<=r){var a,f,h,l;switch(u){case 1:o<128&&(s=o);break;case 2:a=e[i+1],128==(192&a)&&(l=(31&o)<<6|63&a)>127&&(s=l);break;case 3:a=e[i+1],f=e[i+2],128==(192&a)&&128==(192&f)&&(l=(15&o)<<12|(63&a)<<6|63&f)>2047&&(l<55296||l>57343)&&(s=l);break;case 4:a=e[i+1],f=e[i+2],h=e[i+3],128==(192&a)&&128==(192&f)&&128==(192&h)&&(l=(15&o)<<18|(63&a)<<12|(63&f)<<6|63&h)>65535&&l<1114112&&(s=l)}}null===s?(s=65533,u=1):s>65535&&(s-=65536,n.push(s>>>10&1023|55296),s=56320|1023&s),n.push(s),i+=u}return k(n)}function k(e){var t=e.length;if(t<=$)return String.fromCharCode.apply(String,e);for(var r="",n=0;n<t;)r+=String.fromCharCode.apply(String,e.slice(n,n+=$));return r}function T(e,t,r){var n="";r=Math.min(e.length,r);for(var i=t;i<r;++i)n+=String.fromCharCode(127&e[i]);return n}function B(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 C(e,t,r){var n=e.length;(!t||t<0)&&(t=0),(!r||r<0||r>n)&&(r=n);for(var i="",o=t;o<r;++o)i+=z(e[o]);return i}function L(e,t,r){for(var n=e.slice(t,r),i="",o=0;o<n.length;o+=2)i+=String.fromCharCode(n[o]+256*n[o+1]);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")}function D(e,t,r,n,i,s){if(!o.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>i||t<s)throw new RangeError('"value" argument is out of bounds');if(r+n>e.length)throw new RangeError("Index out of range")}function I(e,t,r,n){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))>>>8*(n?i:1-i)}function U(e,t,r,n){t<0&&(t=4294967295+t+1);for(var i=0,o=Math.min(e.length-r,4);i<o;++i)e[r+i]=t>>>8*(n?i:3-i)&255}function M(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 N(e,t,r,n,i){return i||M(e,t,r,4,3.4028234663852886e38,-3.4028234663852886e38),Q.write(e,t,r,n,23,4),r+4}function Y(e,t,r,n,i){return i||M(e,t,r,8,1.7976931348623157e308,-1.7976931348623157e308),Q.write(e,t,r,n,52,8),r+8}function F(e){if(e=G(e).replace(ee,""),e.length<2)return"";for(;e.length%4!=0;)e+="=";return e}function G(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")}function z(e){return e<16?"0"+e.toString(16):e.toString(16)}function V(e,t){t=t||1/0;for(var r,n=e.length,i=null,o=[],s=0;s<n;++s){if((r=e.charCodeAt(s))>55295&&r<57344){if(!i){if(r>56319){(t-=3)>-1&&o.push(239,191,189);continue}if(s+1===n){(t-=3)>-1&&o.push(239,191,189);continue}i=r;continue}if(r<56320){(t-=3)>-1&&o.push(239,191,189),i=r;continue}r=65536+(i-55296<<10|r-56320)}else i&&(t-=3)>-1&&o.push(239,191,189);if(i=null,r<128){if((t-=1)<0)break;o.push(r)}else if(r<2048){if((t-=2)<0)break;o.push(r>>6|192,63&r|128)}else if(r<65536){if((t-=3)<0)break;o.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;o.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return o}function q(e){for(var t=[],r=0;r<e.length;++r)t.push(255&e.charCodeAt(r));return t}function K(e,t){for(var r,n,i,o=[],s=0;s<e.length&&!((t-=2)<0);++s)r=e.charCodeAt(s),n=r>>8,i=r%256,o.push(i),o.push(n);return o}function J(e){return Z.toByteArray(F(e))}function X(e,t,r,n){for(var i=0;i<n&&!(i+r>=t.length||i>=e.length);++i)t[i+r]=e[i];return i}function H(e){return e!==e}var Z=r(13),Q=r(14),W=r(15);t.Buffer=o,t.SlowBuffer=d,t.INSPECT_MAX_BYTES=50,o.TYPED_ARRAY_SUPPORT=void 0!==e.TYPED_ARRAY_SUPPORT?e.TYPED_ARRAY_SUPPORT:function(){try{var e=new Uint8Array(1);return e.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===e.foo()&&"function"==typeof e.subarray&&0===e.subarray(1,1).byteLength}catch(e){return!1}}(),t.kMaxLength=n(),o.poolSize=8192,o._augment=function(e){return e.__proto__=o.prototype,e},o.from=function(e,t,r){return s(null,e,t,r)},o.TYPED_ARRAY_SUPPORT&&(o.prototype.__proto__=Uint8Array.prototype,o.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&o[Symbol.species]===o&&Object.defineProperty(o,Symbol.species,{value:null,configurable:!0})),o.alloc=function(e,t,r){return a(null,e,t,r)},o.allocUnsafe=function(e){return f(null,e)},o.allocUnsafeSlow=function(e){return f(null,e)},o.isBuffer=function(e){return!(null==e||!e._isBuffer)},o.compare=function(e,t){if(!o.isBuffer(e)||!o.isBuffer(t))throw new TypeError("Arguments must be Buffers");if(e===t)return 0;for(var r=e.length,n=t.length,i=0,s=Math.min(r,n);i<s;++i)if(e[i]!==t[i]){r=e[i],n=t[i];break}return r<n?-1:n<r?1:0},o.isEncoding=function(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}},o.concat=function(e,t){if(!W(e))throw new TypeError('"list" argument must be an Array of Buffers');if(0===e.length)return o.alloc(0);var r;if(void 0===t)for(t=0,r=0;r<e.length;++r)t+=e[r].length;var n=o.allocUnsafe(t),i=0;for(r=0;r<e.length;++r){var s=e[r];if(!o.isBuffer(s))throw new TypeError('"list" argument must be an Array of Buffers');s.copy(n,i),i+=s.length}return n},o.byteLength=v,o.prototype._isBuffer=!0,o.prototype.swap16=function(){var e=this.length;if(e%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var t=0;t<e;t+=2)g(this,t,t+1);return this},o.prototype.swap32=function(){var e=this.length;if(e%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var t=0;t<e;t+=4)g(this,t,t+3),g(this,t+1,t+2);return this},o.prototype.swap64=function(){var e=this.length;if(e%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var t=0;t<e;t+=8)g(this,t,t+7),g(this,t+1,t+6),g(this,t+2,t+5),g(this,t+3,t+4);return this},o.prototype.toString=function(){var e=0|this.length;return 0===e?"":0===arguments.length?P(this,0,e):m.apply(this,arguments)},o.prototype.equals=function(e){if(!o.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e||0===o.compare(this,e)},o.prototype.inspect=function(){var e="",r=t.INSPECT_MAX_BYTES;return this.length>0&&(e=this.toString("hex",0,r).match(/.{2}/g).join(" "),this.length>r&&(e+=" ... ")),"<Buffer "+e+">"},o.prototype.compare=function(e,t,r,n,i){if(!o.isBuffer(e))throw new TypeError("Argument must be a Buffer");if(void 0===t&&(t=0),void 0===r&&(r=e?e.length:0),void 0===n&&(n=0),void 0===i&&(i=this.length),t<0||r>e.length||n<0||i>this.length)throw new RangeError("out of range index");if(n>=i&&t>=r)return 0;if(n>=i)return-1;if(t>=r)return 1;if(t>>>=0,r>>>=0,n>>>=0,i>>>=0,this===e)return 0;for(var s=i-n,u=r-t,a=Math.min(s,u),f=this.slice(n,i),h=e.slice(t,r),l=0;l<a;++l)if(f[l]!==h[l]){s=f[l],u=h[l];break}return s<u?-1:u<s?1:0},o.prototype.includes=function(e,t,r){return-1!==this.indexOf(e,t,r)},o.prototype.indexOf=function(e,t,r){return b(this,e,t,r,!0)},o.prototype.lastIndexOf=function(e,t,r){return b(this,e,t,r,!1)},o.prototype.write=function(e,t,r,n){if(void 0===t)n="utf8",r=this.length,t=0;else if(void 0===r&&"string"==typeof t)n=t,r=this.length,t=0;else{if(!isFinite(t))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");t|=0,isFinite(r)?(r|=0,void 0===n&&(n="utf8")):(n=r,r=void 0)}var i=this.length-t;if((void 0===r||r>i)&&(r=i),e.length>0&&(r<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var o=!1;;)switch(n){case"hex":return _(this,e,t,r);case"utf8":case"utf-8":return E(this,e,t,r);case"ascii":return A(this,e,t,r);case"latin1":case"binary":return S(this,e,t,r);case"base64":return O(this,e,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return R(this,e,t,r);default:if(o)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),o=!0}},o.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var $=4096;o.prototype.slice=function(e,t){var r=this.length;e=~~e,t=void 0===t?r:~~t,e<0?(e+=r)<0&&(e=0):e>r&&(e=r),t<0?(t+=r)<0&&(t=0):t>r&&(t=r),t<e&&(t=e);var n;if(o.TYPED_ARRAY_SUPPORT)n=this.subarray(e,t),n.__proto__=o.prototype;else{var i=t-e;n=new o(i,void 0);for(var s=0;s<i;++s)n[s]=this[s+e]}return n},o.prototype.readUIntLE=function(e,t,r){e|=0,t|=0,r||j(e,t,this.length);for(var n=this[e],i=1,o=0;++o<t&&(i*=256);)n+=this[e+o]*i;return n},o.prototype.readUIntBE=function(e,t,r){e|=0,t|=0,r||j(e,t,this.length);for(var n=this[e+--t],i=1;t>0&&(i*=256);)n+=this[e+--t]*i;return n},o.prototype.readUInt8=function(e,t){return t||j(e,1,this.length),this[e]},o.prototype.readUInt16LE=function(e,t){return t||j(e,2,this.length),this[e]|this[e+1]<<8},o.prototype.readUInt16BE=function(e,t){return t||j(e,2,this.length),this[e]<<8|this[e+1]},o.prototype.readUInt32LE=function(e,t){return t||j(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},o.prototype.readUInt32BE=function(e,t){return t||j(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},o.prototype.readIntLE=function(e,t,r){e|=0,t|=0,r||j(e,t,this.length);for(var n=this[e],i=1,o=0;++o<t&&(i*=256);)n+=this[e+o]*i;return i*=128,n>=i&&(n-=Math.pow(2,8*t)),n},o.prototype.readIntBE=function(e,t,r){e|=0,t|=0,r||j(e,t,this.length);for(var n=t,i=1,o=this[e+--n];n>0&&(i*=256);)o+=this[e+--n]*i;return i*=128,o>=i&&(o-=Math.pow(2,8*t)),o},o.prototype.readInt8=function(e,t){return t||j(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},o.prototype.readInt16LE=function(e,t){t||j(e,2,this.length);var r=this[e]|this[e+1]<<8;return 32768&r?4294901760|r:r},o.prototype.readInt16BE=function(e,t){t||j(e,2,this.length);var r=this[e+1]|this[e]<<8;return 32768&r?4294901760|r:r},o.prototype.readInt32LE=function(e,t){return t||j(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},o.prototype.readInt32BE=function(e,t){return t||j(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},o.prototype.readFloatLE=function(e,t){return t||j(e,4,this.length),Q.read(this,e,!0,23,4)},o.prototype.readFloatBE=function(e,t){return t||j(e,4,this.length),Q.read(this,e,!1,23,4)},o.prototype.readDoubleLE=function(e,t){return t||j(e,8,this.length),Q.read(this,e,!0,52,8)},o.prototype.readDoubleBE=function(e,t){return t||j(e,8,this.length),Q.read(this,e,!1,52,8)},o.prototype.writeUIntLE=function(e,t,r,n){if(e=+e,t|=0,r|=0,!n){D(this,e,t,r,Math.pow(2,8*r)-1,0)}var i=1,o=0;for(this[t]=255&e;++o<r&&(i*=256);)this[t+o]=e/i&255;return t+r},o.prototype.writeUIntBE=function(e,t,r,n){if(e=+e,t|=0,r|=0,!n){D(this,e,t,r,Math.pow(2,8*r)-1,0)}var i=r-1,o=1;for(this[t+i]=255&e;--i>=0&&(o*=256);)this[t+i]=e/o&255;return t+r},o.prototype.writeUInt8=function(e,t,r){return e=+e,t|=0,r||D(this,e,t,1,255,0),o.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[t]=255&e,t+1},o.prototype.writeUInt16LE=function(e,t,r){return e=+e,t|=0,r||D(this,e,t,2,65535,0),o.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):I(this,e,t,!0),t+2},o.prototype.writeUInt16BE=function(e,t,r){return e=+e,t|=0,r||D(this,e,t,2,65535,0),o.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):I(this,e,t,!1),t+2},o.prototype.writeUInt32LE=function(e,t,r){return e=+e,t|=0,r||D(this,e,t,4,4294967295,0),o.TYPED_ARRAY_SUPPORT?(this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e):U(this,e,t,!0),t+4},o.prototype.writeUInt32BE=function(e,t,r){return e=+e,t|=0,r||D(this,e,t,4,4294967295,0),o.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):U(this,e,t,!1),t+4},o.prototype.writeIntLE=function(e,t,r,n){if(e=+e,t|=0,!n){var i=Math.pow(2,8*r-1);D(this,e,t,r,i-1,-i)}var o=0,s=1,u=0;for(this[t]=255&e;++o<r&&(s*=256);)e<0&&0===u&&0!==this[t+o-1]&&(u=1),this[t+o]=(e/s>>0)-u&255;return t+r},o.prototype.writeIntBE=function(e,t,r,n){if(e=+e,t|=0,!n){var i=Math.pow(2,8*r-1);D(this,e,t,r,i-1,-i)}var o=r-1,s=1,u=0;for(this[t+o]=255&e;--o>=0&&(s*=256);)e<0&&0===u&&0!==this[t+o+1]&&(u=1),this[t+o]=(e/s>>0)-u&255;return t+r},o.prototype.writeInt8=function(e,t,r){return e=+e,t|=0,r||D(this,e,t,1,127,-128),o.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),e<0&&(e=255+e+1),this[t]=255&e,t+1},o.prototype.writeInt16LE=function(e,t,r){return e=+e,t|=0,r||D(this,e,t,2,32767,-32768),o.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):I(this,e,t,!0),t+2},o.prototype.writeInt16BE=function(e,t,r){return e=+e,t|=0,r||D(this,e,t,2,32767,-32768),o.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):I(this,e,t,!1),t+2},o.prototype.writeInt32LE=function(e,t,r){return e=+e,t|=0,r||D(this,e,t,4,2147483647,-2147483648),o.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24):U(this,e,t,!0),t+4},o.prototype.writeInt32BE=function(e,t,r){return e=+e,t|=0,r||D(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),o.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):U(this,e,t,!1),t+4},o.prototype.writeFloatLE=function(e,t,r){return N(this,e,t,!0,r)},o.prototype.writeFloatBE=function(e,t,r){return N(this,e,t,!1,r)},o.prototype.writeDoubleLE=function(e,t,r){return Y(this,e,t,!0,r)},o.prototype.writeDoubleBE=function(e,t,r){return Y(this,e,t,!1,r)},o.prototype.copy=function(e,t,r,n){if(r||(r=0),n||0===n||(n=this.length),t>=e.length&&(t=e.length),t||(t=0),n>0&&n<r&&(n=r),n===r)return 0;if(0===e.length||0===this.length)return 0;if(t<0)throw new RangeError("targetStart out of bounds");if(r<0||r>=this.length)throw new RangeError("sourceStart out of bounds");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),e.length-t<n-r&&(n=e.length-t+r);var i,s=n-r;if(this===e&&r<t&&t<n)for(i=s-1;i>=0;--i)e[i+t]=this[i+r];else if(s<1e3||!o.TYPED_ARRAY_SUPPORT)for(i=0;i<s;++i)e[i+t]=this[i+r];else Uint8Array.prototype.set.call(e,this.subarray(r,r+s),t);return s},o.prototype.fill=function(e,t,r,n){if("string"==typeof e){if("string"==typeof t?(n=t,t=0,r=this.length):"string"==typeof r&&(n=r,r=this.length),1===e.length){var i=e.charCodeAt(0);i<256&&(e=i)}if(void 0!==n&&"string"!=typeof n)throw new TypeError("encoding must be a string");if("string"==typeof n&&!o.isEncoding(n))throw new TypeError("Unknown encoding: "+n)}else"number"==typeof e&&(e&=255);if(t<0||this.length<t||this.length<r)throw new RangeError("Out of range index");if(r<=t)return this;t>>>=0,r=void 0===r?this.length:r>>>0,e||(e=0);var s;if("number"==typeof e)for(s=t;s<r;++s)this[s]=e;else{var u=o.isBuffer(e)?e:V(new o(e,n).toString()),a=u.length;for(s=0;s<r-t;++s)this[s+t]=u[s%a]}return this};var ee=/[^+\/0-9A-Za-z-_]/g}).call(t,r(0))},function(e,t,r){"use strict";e.exports=r(4)},function(e,t,r){"use strict";(function(t,n){function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},s=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),u=r(6),a=r(7),f=r(8),h=r(9),l=r(12),c=r(16),p=r(18),y=p.SAVE_MODE,d=p.RECORD,v=function(){function e(){var t=this,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};i(this,e),Object.defineProperties(this,{_root:{writable:!0,enumerable:!1},_storage:{writable:!0,enumerable:!1},_memory:{writable:!0,enumerable:!1},_emitter:{value:new a},_opts:{writable:!0,enumerable:!1},_timerExpiryCheck:{value:null,writable:!0,enumerable:!1},_timerSaveCheck:{value:null,writable:!0,enumerable:!1},GLOBAL_KEY:{writable:!0,enumerable:!1},_lastChange:{value:null,writable:!0,enumerable:!1},_lastChangeDetected:{value:null,writable:!0,enumerable:!1},_lastSave:{value:null,writable:!0,enumerable:!1},_saving:{value:!1,writable:!0,enumerable:!1},_loading:{value:!1,writable:!0,enumerable:!1}}),this.GLOBAL_KEY="___InCache___storage___global___key___",this.DEFAULT_CONFIG={storeName:"",autoLoad:!0,autoSave:!1,autoSaveMode:y.TERMINATE,autoSavePeriod:5,save:!1,clone:!1,preserve:!1,deleteOnExpires:!0,filePath:".incache",maxAge:0,maxRecordNumber:0,expires:null,silent:!1,share:!1,autoRemovePeriod:0,nullIfNotFound:!1,global:{silent:!1,life:0}},this._onRemoved=function(){},this._onCreated=function(){},this._onUpdated=function(){},this.on("_change",function(e){t._lastChange=(new Date).getTime(),t._opts.silent||t._emitter.fire("change",e)}),this.setConfig(r)}return s(e,[{key:"_checkExceeded",value:function(){var e=Object.keys(this._memory.data);if(this._opts.maxRecordNumber>0&&e.length>this._opts.maxRecordNumber){var t=e.length-this._opts.maxRecordNumber;this._emitter.fire("exceed",t),this.bulkRemove(e.slice(0,t),!0)}}},{key:"_importData",value:function(t){if(u.is(t,"object")){var r=Object.keys(t);r.length&&(e.isRecord(t[r[0]])?this._memory.data=t:this.bulkSet(t,!0))}else{if(!u.is(t,"array"))throw new Error("bad data");t.length&&this.bulkSet(t,!0)}}},{key:"load",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this._opts.filePath;return new Promise(function(r,n){if(!u.isServer())return n("operation not allowed");if(e._loading)return n("loading locked");if(!1===e._emitter.fireTheFirst("beforeLoad",e))return n();e._loading=!0;try{var i=f.readFileSync(t);e._importData(JSON.parse(i.toString())),e._loading=!1,r(e),e._emitter.fireAsync("load",null,e)}catch(t){t=t.message,e._loading=!1,n(t),e._emitter.fireAsync("load",t,e)}})}},{key:"save",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this._opts.filePath;return new Promise(function(r,n){if(!u.isServer())return n("operation not allowed");if(e._saving)return n("saving locked");if(!1===e._emitter.fireTheFirst("beforeSave",e))return n();e._saving=!0;try{f.writeFileSync(t,JSON.stringify(e._memory.data)),e._lastSave=(new Date).getTime(),e._saving=!1,r(e),e._emitter.fireAsync("save",null,e)}catch(t){t=t.message,e._saving=!1,n(t),e._emitter.fireAsync("save",t,e)}})}},{key:"setConfig",value:function(){var e=this,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(r.global&&(u.deprecated(r.global.life,"global.life is deprecated use maxAge instead"),u.deprecated(r.global.silent,"global.silent is deprecated use silent instead")),u.defaults(r,this.DEFAULT_CONFIG),this._opts=r,this._root=r.share?u.isServer()?t:window:{},r.storeName&&(this.GLOBAL_KEY+=r.storeName),this._root[this.GLOBAL_KEY]||(this._root[this.GLOBAL_KEY]={data:{}}),this._memory=this._root[this.GLOBAL_KEY],u.isServer()&&(r.autoLoad&&this.load().then().catch(function(e){}),r.autoSave||r.save))if(r.autoSaveMode===y.TERMINATE){var i=function(){o.save().then().catch(function(e){})},o=this;n.removeListener("exit",i),n.removeListener("SIGINT",i),n.on("exit",i),n.on("SIGINT",i)}else r.autoSaveMode===y.TIMER&&(this._timerSaveCheck&&(clearInterval(this._timerSaveCheck),this._timerSaveCheck=null),r.autoSavePeriod&&(this._timerSaveCheck=setInterval(function(){e._lastChange!==e._lastChangeDetected&&(e._lastChangeDetected=e._lastChange,e.save().then().catch(function(e){}))},1e3*r.autoSavePeriod)));this._timerExpiryCheck&&(clearInterval(this._timerExpiryCheck),this._timerExpiryCheck=null),r.autoRemovePeriod&&(this._timerExpiryCheck=setInterval(function(){var t=e.removeExpired();t.length&&e._emitter.fire("expired",t)},1e3*r.autoRemovePeriod))}},{key:"getConfig",value:function(){return this._opts}},{key:"set",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if((r.silent||!1!==this._emitter.fireTheFirst("beforeSet",e,t))&&(r=u.defaults(r,this._opts),!this.has(e)||!this._memory.data[e].isPreserved)){r.clone&&(t=l(t));var n=Object.assign({},d);return n.isNew=!0,n.isPreserved=r.preserve,n.toDelete=r.deleteOnExpires,n.hits=0,n.value=t,r.expires&&(u.is(r.expires,"date")||u.is(r.expires,"string"))?n.expiresOn=new Date(r.expires):r.maxAge&&u.is(r.maxAge,"number")?n.expiresOn=u.addMSToNow(r.maxAge):r.life&&u.is(r.life,"number")&&(u.deprecated(r.life,"life is deprecated use maxAge instead"),n.expiresOn=u.addSecondsToNow(r.life)),this.has(e)?(n.isNew=!1,n.hits=this._memory.data[e].hits,n.id=this._memory.data[e].id,n.createdOn=this._memory.data[e].createdOn,n.updatedOn=new Date,r.silent||(this._onUpdated.call(this,e,n),this._emitter.fire("update",e,n))):(n.id=h(),n.createdOn=new Date,r.silent||(this._onCreated.call(this,e,n),this._emitter.fire("create",e,n))),this._memory.data[e]=n,r.silent||this._emitter.fire("set",e,n),this._checkExceeded(),this._emitter.fire("_change","set"),n}}},{key:"get",value:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return this.has(e)?!this._opts.autoRemovePeriod&&this.expired(e)&&this._memory.data[e].toDelete?(this.remove(e,!0),this._opts.nullIfNotFound?null:void 0):(this._memory.data[e].hits+=1,this._memory.data[e].lastHit=new Date,t?this._memory.data[e].value:this._memory.data[e]):this._opts.nullIfNotFound?null:void 0}},{key:"remove",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];(t||!1!==this._emitter.fireTheFirst("beforeRemove",e))&&(delete this._memory.data[e],t||(this._onRemoved.call(this,e),this._emitter.fire("remove",e)),this._emitter.fire("_change","remove"))}},{key:"removeFrom",value:function(e,t){if(!this.has(e))return null;if(u.is(t,"undefined"))throw new Error("where cannot be undefined");if(!this._memory.data[e].isPreserved){var r=this.get(e);if(!u.is(r,"array"))throw new Error("value must be an array");var n=r.length;for(var i in r)if(r.hasOwnProperty(i)){var o=[];for(var s in t)t.hasOwnProperty(s)&&(u.is(t,"object")?o.push(void 0!==r[i][s]&&r[i][s]===t[s]):o.push(r[i]===t));o.length&&-1===o.indexOf(!1)&&r.splice(i,1)}n!==r.length&&this.set(e,r)}}},{key:"removeExpired",value:function(){var e=[];for(var t in this._memory.data)this._memory.data.hasOwnProperty(t)&&this.expired(t)&&this._memory.data[t].toDelete&&(this.remove(t,!0),e.push(t));return e}},{key:"addTo",value:function(e,t){if(this.has(e)){var r=this.get(e);if(!this._memory.data[e].isPreserved){if(!u.is(r,"array"))throw new Error("object must be an array");return r.push(t),this.set(e,r)}}}},{key:"prependTo",value:function(e,t){if(this.has(e)&&!this._memory.data[e].isPreserved){var r=this.get(e);if(!u.is(r,"array"))throw new Error("object must be an array");return r.unshift(t),this.set(e,r)}}},{key:"updateIn",value:function(e,t,r){if(this.has(e)){if(u.is(t,"undefined"))throw new Error("value cannot be undefined");if(u.is(r,"undefined"))throw new Error("where cannot be undefined");if(!this._memory.data[e].isPreserved){var n=this.get(e);if(!u.is(n,"array"))throw new Error("value must be an array");var i=!1;for(var o in n)if(n.hasOwnProperty(o)){var s=[];for(var a in r)r.hasOwnProperty(a)&&(u.is(r,"object")?s.push(void 0!==n[o][a]&&n[o][a]===r[a]):s.push(n[o]===r));s.length&&-1===s.indexOf(!1)&&(i=!0,n[o]=t)}i&&this.set(e,n)}}}},{key:"bulkSet",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(!u.is(e,"array")&&!u.is(e,"object"))throw new Error("records must be an array, e.g. {key: foo, value: bar}");if(t||!1!==this._emitter.fireTheFirst("beforeBulkSet",e)){for(var r={},n=void 0,i=0;i<e.length;i++)u.is(e[i].key,"undefined")||u.is(e[i].value,"undefined")?(n=this.set(i,e[i],{silent:!0,fromBulk:!0}))&&(r[i]=n):(n=this.set(e[i].key,e[i].value,{silent:!0,fromBulk:!0}))&&(r[e[i].key]=n);return t||this._emitter.fire("bulkSet",e),r}}},{key:"bulkRemove",value:function(e,t){if(!u.is(e,"array"))throw new Error("keys must be an array of keys");if(t||!1!==this._emitter.fireTheFirst("beforeBulkRemove",e)){for(var r=0;r<e.length;r++)this.remove(e[r],!0);t||this._emitter.fire("bulkRemove",e)}}},{key:"clean",value:function(e){if(!u.is(e,"string"))throw new Error("key must be a string");for(var t in this._memory.data)this._memory.data.hasOwnProperty(t)&&-1!==t.indexOf(e)&&(delete this._memory.data[t],this._emitter.fire("_change","clean"))}},{key:"all",value:function(){var e=[];for(var t in this._memory.data)this._memory.data.hasOwnProperty(t)&&(!this._opts.autoRemovePeriod&&this.expired(t)&&this._memory.data[t].toDelete?this.remove(t,!0):e.push({key:t,value:this._memory.data[t].value}));return e}},{key:"count",value:function(){return this.removeExpired(),Object.keys(this._memory.data).length}},{key:"expired",value:function(e){if(this._memory.data[e]&&this._memory.data[e].expiresOn){return new Date>new Date(this._memory.data[e].expiresOn)}return!1}},{key:"clear",value:function(){this._memory.data={},this._emitter.fire("_change","clear")}},{key:"has",value:function(e){return this._memory.data.hasOwnProperty(e)}},{key:"destroy",value:function(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];this.remove.apply(this,t)}},{key:"stats",value:function(){return{count:this.count(),size:c(this._memory.data)}}},{key:"on",value:function(e,t){return this._emitter.on.call(this._emitter,e,t),this}},{key:"suspendEvent",value:function(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];return this._emitter.suspendEvent.call(this._emitter,t),this}},{key:"resumeEvent",value:function(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];return this._emitter.resumeEvent.call(this._emitter,t),this}},{key:"suspendEvents",value:function(){return this._emitter.suspendEvents.call(this._emitter),this}},{key:"resumeEvents",value:function(){return this._emitter.resumeEvents.call(this._emitter),this}},{key:"onRemoved",value:function(e){this._onRemoved=e}},{key:"onCreated",value:function(e){this._onCreated=e}},{key:"onUpdated",value:function(e){this._onUpdated=e}}],[{key:"isRecord",value:function(e){return Object.keys(d).every(function(t){return"object"===(void 0===e?"undefined":o(e))&&e.hasOwnProperty(t)})}}]),e}();e.exports=v,e.exports.SAVE_MODE=y}).call(t,r(0),r(5))},function(e,t,r){"use strict";function n(){throw new Error("setTimeout has not been defined")}function i(){throw new Error("clearTimeout has not been defined")}function o(e){if(l===setTimeout)return setTimeout(e,0);if((l===n||!l)&&setTimeout)return l=setTimeout,setTimeout(e,0);try{return l(e,0)}catch(t){try{return l.call(null,e,0)}catch(t){return l.call(this,e,0)}}}function s(e){if(c===clearTimeout)return clearTimeout(e);if((c===i||!c)&&clearTimeout)return c=clearTimeout,clearTimeout(e);try{return c(e)}catch(t){try{return c.call(null,e)}catch(t){return c.call(this,e)}}}function u(){v&&y&&(v=!1,y.length?d=y.concat(d):m=-1,d.length&&a())}function a(){if(!v){var e=o(u);v=!0;for(var t=d.length;t;){for(y=d,d=[];++m<t;)y&&y[m].run();m=-1,t=d.length}y=null,v=!1,s(e)}}function f(e,t){this.fun=e,this.array=t}function h(){}var l,c,p=e.exports={};!function(){try{l="function"==typeof setTimeout?setTimeout:n}catch(e){l=n}try{c="function"==typeof clearTimeout?clearTimeout:i}catch(e){c=i}}();var y,d=[],v=!1,m=-1;p.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];d.push(new f(e,t)),1!==d.length||v||o(a)},f.prototype.run=function(){this.fun.apply(null,this.array)},p.title="browser",p.browser=!0,p.env={},p.argv=[],p.version="",p.versions={},p.on=h,p.addListener=h,p.once=h,p.off=h,p.removeListener=h,p.removeAllListeners=h,p.emit=h,p.prependListener=h,p.prependOnceListener=h,p.listeners=function(e){return[]},p.binding=function(e){throw new Error("process.binding is not supported")},p.cwd=function(){return"/"},p.chdir=function(e){throw new Error("process.chdir is not supported")},p.umask=function(){return 0}},function(e,t,r){"use strict";var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},i={};i.is=function(e,t){return Object.prototype.toString.call(e).toLowerCase()==="[object "+t+"]".toLowerCase()},i.defaults=function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e.hasOwnProperty(r)?"object"===n(e[r])&&i.defaults(e[r],t[r]):e[r]=t[r]);return e},i.addSecondsToNow=function(e){var t=new Date;return new Date(t.setSeconds(t.getSeconds()+e))},i.addMSToNow=function(e){var t=new Date;return new Date(t.setMilliseconds(t.getMilliseconds()+e))},i.isServer=function(){return"undefined"==typeof window},i.deprecated=function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"warn";return void 0!==e&&(console[r](t||e),!0)},e.exports=i},function(e,t,r){"use strict";(function(e){var r,n,i,o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};!function(s,u){"object"===o(t)&&"object"===o(e)?e.exports=u():(n=[],r=u,void 0!==(i="function"==typeof r?r.apply(t,n):r)&&(e.exports=i))}(0,function(){return function(e){function t(n){if(r[n])return r[n].exports;var i=r[n]={i:n,l:!1,exports:{}};return e[n].call(i.exports,i,i.exports,t),i.l=!0,i.exports}var r={};return t.m=e,t.c=r,t.d=function(e,r,n){t.o(e,r)||Object.defineProperty(e,r,{configurable:!1,enumerable:!0,get:n})},t.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(r,"a",r),r},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=0)}([function(e,t,r){e.exports=r(1)},function(e,t,r){function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var i=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),o=r(2),s=r(3),u=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};n(this,e),this.defaultClassOpts={maxListeners:10,asyncDelay:10},this.defaultListenerOpts={maxCalls:0,prepend:!1},this.opts=o.defaults(t,this.defaultClassOpts),this.events={}}return i(e,[{key:"_createEvent",value:function(e,t,r){if(this.events[e]||(this.events[e]=[]),this.opts.maxListeners){var n=this.opts.maxListeners;if(this.events[e].length>=n)throw new Error(s[3]+n)}t.opts=o.defaults(r,this.defaultListenerOpts),t.state={suspended:!1,calls:0},r.prepend?this.events[e].unshift(t):this.events[e].push(t),this._created.call(this,e,t,r)}},{key:"_callEvent",value:function(e,t,r){if(!t.state.suspended)return t.opts.maxCalls&&t.state.calls++>=t.opts.maxCalls?void this.off(e,t):(this._catchAll.call(this,r),t.apply(this,r))}},{key:"_suspendEvent",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments[1],r=void 0;for(var n in e)r=e[n],this.events[r]&&this.events[r].forEach(function(e){e.state.suspended=t});return this}},{key:"_created",value:function(){}},{key:"_removed",value:function(){}},{key:"_catchAll",value:function(){}},{key:"on",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(!o.is(e,"string"))throw new Error(s[0]);if(e=e.trim(),!e.length)throw new Error(s[4]);if(o.is(t,"array")){for(var n in t)if(t.hasOwnProperty(n)){if(!o.is(t[n],"function"))throw new Error(s[1]);this._createEvent(e,t[n],r)}}else{if(!o.is(t,"function"))throw new Error(s[1]);this._createEvent(e,t,r)}return this}},{key:"once",value:function(e,t){return this.on(e,t,{maxCalls:1})}},{key:"fire",value:function(e){if(this.exists(e)){for(var t=arguments.length,r=Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];for(var i=0;i<this.events[e].length;i++)this._callEvent(e,this.events[e][i],r)}return this}},{key:"fireTheFirst",value:function(e){for(var t=arguments.length,r=Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];if(this.exists(e))return this._callEvent(e,this.events[e][0],r)}},{key:"fireAsync",value:function(e){for(var t=this,r=arguments.length,n=Array(r>1?r-1:0),i=1;i<r;i++)n[i-1]=arguments[i];n.unshift(e),setTimeout(function(){t.fire.apply(t,n)},this.opts.asyncDelay)}},{key:"off",value:function(e,t){if(!o.is(e,"string"))throw new Error(s[0]);if(this.events[e])if("function"==typeof t)for(var r=0;r<this.events[e].length;r++)this.events[e][r]===t&&(this.events[e].splice(r,1),this._removed.call(this,e,t));else delete this.events[e],this._removed.call(this,e);return this}},{key:"prependListener",value:function(e,t){return this.on(e,t,{prepend:!0})}},{key:"prependOnceListener",value:function(e,t){return this.on(e,t,{maxCalls:1,prepend:!0})}},{key:"suspendEvent",value:function(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];return this._suspendEvent(t,!0)}},{key:"resumeEvent",value:function(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];return this._suspendEvent(t,!1)}},{key:"suspendEvents",value:function(){return this._suspendEvent(Object.keys(this.events),!0)}},{key:"resumeEvents",value:function(){return this._suspendEvent(Object.keys(this.events),!1)}},{key:"isSuspended",value:function(e){return!!this.exists(e)&&this.events[e][0].state.suspended}},{key:"clear",value:function(){return this.events=[],this}},{key:"getListenersCount",value:function(e){return this.getListeners(e).length}},{key:"getListeners",value:function(e){if(!o.is(e,"string"))throw new Error(s[0]);if(!this.exists(e))throw new Error(s[5]);return this.events[e]}},{key:"getEvents",value:function(){return this.events}},{key:"exists",value:function(e){if(!o.is(e,"string"))throw new Error(s[0]);return!o.is(this.events[e],"undefined")}},{key:"getMaxListeners",value:function(){return this.opts.maxListeners}},{key:"setMaxListeners",value:function(e){if(!o.is(e,"number"))throw new Error(s[2]);return this.opts.maxListeners=e,this}},{key:"onCatchAll",value:function(e){return this._catchAll=e,this}},{key:"onCreated",value:function(e){return this._created=e,this}},{key:"onRemoved",value:function(e){return this._removed=e,this}}]),e}();e.exports=u,e.exports._error=s},function(e,t,r){var n="function"==typeof Symbol&&"symbol"===o(Symbol.iterator)?function(e){return void 0===e?"undefined":o(e)}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":void 0===e?"undefined":o(e)},i={};i.is=function(e,t){return Object.prototype.toString.call(e).toLowerCase()==="[object "+t+"]".toLowerCase()},i.defaults=function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e.hasOwnProperty(r)?"object"===n(e[r])&&i.defaults(e[r],t[r]):e[r]=t[r]);return e},e.exports=i},function(e,t,r){e.exports=["event name is required and must be a string","listener is required and must be a function or an array of function","value must be a number","increase maxListeners per event: ","event name not valid","event not found"]}])})}).call(t,r(1)(e))},function(e,t,r){"use strict"},function(e,t,r){"use strict";function n(e,t,r){var n=t&&r||0,i=t||[];e=e||{};var s=void 0!==e.clockseq?e.clockseq:a,l=void 0!==e.msecs?e.msecs:(new Date).getTime(),c=void 0!==e.nsecs?e.nsecs:h+1,p=l-f+(c-h)/1e4;if(p<0&&void 0===e.clockseq&&(s=s+1&16383),(p<0||l>f)&&void 0===e.nsecs&&(c=0),c>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");f=l,h=c,a=s,l+=122192928e5;var y=(1e4*(268435455&l)+c)%4294967296;i[n++]=y>>>24&255,i[n++]=y>>>16&255,i[n++]=y>>>8&255,i[n++]=255&y;var d=l/4294967296*1e4&268435455;i[n++]=d>>>8&255,i[n++]=255&d,i[n++]=d>>>24&15|16,i[n++]=d>>>16&255,i[n++]=s>>>8|128,i[n++]=255&s;for(var v=e.node||u,m=0;m<6;++m)i[n+m]=v[m];return t||o(i)}var i=r(10),o=r(11),s=i(),u=[1|s[0],s[1],s[2],s[3],s[4],s[5]],a=16383&(s[6]<<8|s[7]),f=0,h=0;e.exports=n},function(e,t,r){"use strict";(function(t){var r,n=t.crypto||t.msCrypto;if(n&&n.getRandomValues){var i=new Uint8Array(16);r=function(){return n.getRandomValues(i),i}}if(!r){var o=new Array(16);r=function(){for(var e,t=0;t<16;t++)0==(3&t)&&(e=4294967296*Math.random()),o[t]=e>>>((3&t)<<3)&255;return o}}e.exports=r}).call(t,r(0))},function(e,t,r){"use strict";function n(e,t){var r=t||0,n=i;return n[e[r++]]+n[e[r++]]+n[e[r++]]+n[e[r++]]+"-"+n[e[r++]]+n[e[r++]]+"-"+n[e[r++]]+n[e[r++]]+"-"+n[e[r++]]+n[e[r++]]+"-"+n[e[r++]]+n[e[r++]]+n[e[r++]]+n[e[r++]]+n[e[r++]]+n[e[r++]]}for(var i=[],o=0;o<256;++o)i[o]=(o+256).toString(16).substr(1);e.exports=n},function(e,t,r){"use strict";(function(e,t){var r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},n=function(){function t(e,t){return null!=t&&e instanceof t}function n(i,o,s,u,c){function p(i,s){if(null===i)return null;if(0===s)return i;var m,g;if("object"!=(void 0===i?"undefined":r(i)))return i;if(t(i,f))m=new f;else if(t(i,h))m=new h;else if(t(i,l))m=new l(function(e,t){i.then(function(t){e(p(t,s-1))},function(e){t(p(e,s-1))})});else if(n.__isArray(i))m=[];else if(n.__isRegExp(i))m=new RegExp(i.source,a(i)),i.lastIndex&&(m.lastIndex=i.lastIndex);else if(n.__isDate(i))m=new Date(i.getTime());else{if(v&&e.isBuffer(i))return m=new e(i.length),i.copy(m),m;t(i,Error)?m=Object.create(i):void 0===u?(g=Object.getPrototypeOf(i),m=Object.create(g)):(m=Object.create(u),g=u)}if(o){var b=y.indexOf(i);if(-1!=b)return d[b];y.push(i),d.push(m)}t(i,f)&&i.forEach(function(e,t){var r=p(t,s-1),n=p(e,s-1);m.set(r,n)}),t(i,h)&&i.forEach(function(e){var t=p(e,s-1);m.add(t)});for(var w in i){var _;g&&(_=Object.getOwnPropertyDescriptor(g,w)),_&&null==_.set||(m[w]=p(i[w],s-1))}if(Object.getOwnPropertySymbols)for(var E=Object.getOwnPropertySymbols(i),w=0;w<E.length;w++){var A=E[w],S=Object.getOwnPropertyDescriptor(i,A);(!S||S.enumerable||c)&&(m[A]=p(i[A],s-1),S.enumerable||Object.defineProperty(m,A,{enumerable:!1}))}if(c)for(var O=Object.getOwnPropertyNames(i),w=0;w<O.length;w++){var R=O[w],S=Object.getOwnPropertyDescriptor(i,R);S&&S.enumerable||(m[R]=p(i[R],s-1),Object.defineProperty(m,R,{enumerable:!1}))}return m}"object"===(void 0===o?"undefined":r(o))&&(s=o.depth,u=o.prototype,c=o.includeNonEnumerable,o=o.circular);var y=[],d=[],v=void 0!==e;return void 0===o&&(o=!0),void 0===s&&(s=1/0),p(i,s)}function i(e){return Object.prototype.toString.call(e)}function o(e){return"object"===(void 0===e?"undefined":r(e))&&"[object Date]"===i(e)}function s(e){return"object"===(void 0===e?"undefined":r(e))&&"[object Array]"===i(e)}function u(e){return"object"===(void 0===e?"undefined":r(e))&&"[object RegExp]"===i(e)}function a(e){var t="";return e.global&&(t+="g"),e.ignoreCase&&(t+="i"),e.multiline&&(t+="m"),t}var f;try{f=Map}catch(e){f=function(){}}var h;try{h=Set}catch(e){h=function(){}}var l;try{l=Promise}catch(e){l=function(){}}return n.clonePrototype=function(e){if(null===e)return null;var t=function(){};return t.prototype=e,new t},n.__objToStr=i,n.__isDate=o,n.__isArray=s,n.__isRegExp=u,n.__getRegExpFlags=a,n}();"object"===r(t)&&t.exports&&(t.exports=n)}).call(t,r(2).Buffer,r(1)(e))},function(e,t,r){"use strict";function n(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");return"="===e[t-2]?2:"="===e[t-1]?1:0}function i(e){return 3*e.length/4-n(e)}function o(e){var t,r,i,o,s,u=e.length;o=n(e),s=new l(3*u/4-o),r=o>0?u-4:u;var a=0;for(t=0;t<r;t+=4)i=h[e.charCodeAt(t)]<<18|h[e.charCodeAt(t+1)]<<12|h[e.charCodeAt(t+2)]<<6|h[e.charCodeAt(t+3)],s[a++]=i>>16&255,s[a++]=i>>8&255,s[a++]=255&i;return 2===o?(i=h[e.charCodeAt(t)]<<2|h[e.charCodeAt(t+1)]>>4,s[a++]=255&i):1===o&&(i=h[e.charCodeAt(t)]<<10|h[e.charCodeAt(t+1)]<<4|h[e.charCodeAt(t+2)]>>2,s[a++]=i>>8&255,s[a++]=255&i),s}function s(e){return f[e>>18&63]+f[e>>12&63]+f[e>>6&63]+f[63&e]}function u(e,t,r){for(var n,i=[],o=t;o<r;o+=3)n=(e[o]<<16)+(e[o+1]<<8)+e[o+2],i.push(s(n));return i.join("")}function a(e){for(var t,r=e.length,n=r%3,i="",o=[],s=0,a=r-n;s<a;s+=16383)o.push(u(e,s,s+16383>a?a:s+16383));return 1===n?(t=e[r-1],i+=f[t>>2],i+=f[t<<4&63],i+="=="):2===n&&(t=(e[r-2]<<8)+e[r-1],i+=f[t>>10],i+=f[t>>4&63],i+=f[t<<2&63],i+="="),o.push(i),o.join("")}t.byteLength=i,t.toByteArray=o,t.fromByteArray=a;for(var f=[],h=[],l="undefined"!=typeof Uint8Array?Uint8Array:Array,c="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",p=0,y=c.length;p<y;++p)f[p]=c[p],h[c.charCodeAt(p)]=p;h["-".charCodeAt(0)]=62,h["_".charCodeAt(0)]=63},function(e,t,r){"use strict";t.read=function(e,t,r,n,i){var o,s,u=8*i-n-1,a=(1<<u)-1,f=a>>1,h=-7,l=r?i-1:0,c=r?-1:1,p=e[t+l];for(l+=c,o=p&(1<<-h)-1,p>>=-h,h+=u;h>0;o=256*o+e[t+l],l+=c,h-=8);for(s=o&(1<<-h)-1,o>>=-h,h+=n;h>0;s=256*s+e[t+l],l+=c,h-=8);if(0===o)o=1-f;else{if(o===a)return s?NaN:1/0*(p?-1:1);s+=Math.pow(2,n),o-=f}return(p?-1:1)*s*Math.pow(2,o-n)},t.write=function(e,t,r,n,i,o){var s,u,a,f=8*o-i-1,h=(1<<f)-1,l=h>>1,c=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,p=n?0:o-1,y=n?1:-1,d=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(u=isNaN(t)?1:0,s=h):(s=Math.floor(Math.log(t)/Math.LN2),t*(a=Math.pow(2,-s))<1&&(s--,a*=2),t+=s+l>=1?c/a:c*Math.pow(2,1-l),t*a>=2&&(s++,a/=2),s+l>=h?(u=0,s=h):s+l>=1?(u=(t*a-1)*Math.pow(2,i),s+=l):(u=t*Math.pow(2,l-1)*Math.pow(2,i),s=0));i>=8;e[r+p]=255&u,p+=y,u/=256,i-=8);for(s=s<<i|u,f+=i;f>0;e[r+p]=255&s,p+=y,s/=256,f-=8);e[r+p-y]|=128*d}},function(e,t,r){"use strict";var n={}.toString;e.exports=Array.isArray||function(e){return"[object Array]"==n.call(e)}},function(e,t,r){"use strict";function n(e){if(null!==e&&"object"===(void 0===e?"undefined":i(e))){if(s.isBuffer(e))return e.length;var t=0;for(var r in e)if(Object.hasOwnProperty.call(e,r)){t+=n(r);try{t+=n(e[r])}catch(e){e instanceof RangeError&&(t=0)}}return t}return"string"==typeof e?e.length*o.STRING:"boolean"==typeof e?o.BOOLEAN:"number"==typeof e?o.NUMBER:0}var i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},o=r(17),s=r(2).Buffer;e.exports=n},function(e,t,r){"use strict";e.exports={STRING:2,BOOLEAN:4,NUMBER:8}},function(e,t,r){"use strict";t.SAVE_MODE=Object.defineProperties({},{TERMINATE:{value:"terminate",enumerable:!0},TIMER:{value:"timer",enumerable:!0}}),t.REMOVE_EXCEED=Object.defineProperties({},{OLDER:{value:"older",enumerable:!0},USAGE:{value:"usage",enumerable:!0},NONE:{value:"none",enumerable:!0}}),t.RECORD={id:null,isNew:!0,isPreserved:null,toDelete:null,hits:null,lastHit:null,createdOn:null,updatedOn:null,expiresOn:null,value:null}}])}); | ||
// [AIV] InCache Build version: 7.0.0 | ||
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("incache",[],t):"object"==typeof exports?exports.incache=t():e.incache=t()}(this,function(){return function(e){function t(n){if(r[n])return r[n].exports;var i=r[n]={i:n,l:!1,exports:{}};return e[n].call(i.exports,i,i.exports,t),i.l=!0,i.exports}var r={};return t.m=e,t.c=r,t.d=function(e,r,n){t.o(e,r)||Object.defineProperty(e,r,{configurable:!1,enumerable:!0,get:n})},t.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(r,"a",r),r},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=3)}([function(e,t,r){"use strict";var n,i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};n=function(){return this}();try{n=n||Function("return this")()||(0,eval)("this")}catch(e){"object"===("undefined"==typeof window?"undefined":i(window))&&(n=window)}e.exports=n},function(e,t,r){"use strict";e.exports=function(e){return e.webpackPolyfill||(e.deprecate=function(){},e.paths=[],e.children||(e.children=[]),Object.defineProperty(e,"loaded",{enumerable:!0,get:function(){return e.l}}),Object.defineProperty(e,"id",{enumerable:!0,get:function(){return e.i}}),e.webpackPolyfill=1),e}},function(e,t,r){"use strict";(function(e){function n(){return o.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function i(e,t){if(n()<t)throw new RangeError("Invalid typed array length");return o.TYPED_ARRAY_SUPPORT?(e=new Uint8Array(t),e.__proto__=o.prototype):(null===e&&(e=new o(t)),e.length=t),e}function o(e,t,r){if(!(o.TYPED_ARRAY_SUPPORT||this instanceof o))return new o(e,t,r);if("number"==typeof e){if("string"==typeof t)throw new Error("If encoding is specified then the first argument must be a string");return f(this,e)}return s(this,e,t,r)}function s(e,t,r,n){if("number"==typeof t)throw new TypeError('"value" argument must not be a number');return"undefined"!=typeof ArrayBuffer&&t instanceof ArrayBuffer?c(e,t,r,n):"string"==typeof t?h(e,t,r):p(e,t)}function u(e){if("number"!=typeof e)throw new TypeError('"size" argument must be a number');if(e<0)throw new RangeError('"size" argument must not be negative')}function a(e,t,r,n){return u(t),t<=0?i(e,t):void 0!==r?"string"==typeof n?i(e,t).fill(r,n):i(e,t).fill(r):i(e,t)}function f(e,t){if(u(t),e=i(e,t<0?0:0|y(t)),!o.TYPED_ARRAY_SUPPORT)for(var r=0;r<t;++r)e[r]=0;return e}function h(e,t,r){if("string"==typeof r&&""!==r||(r="utf8"),!o.isEncoding(r))throw new TypeError('"encoding" must be a valid string encoding');var n=0|v(t,r);e=i(e,n);var s=e.write(t,r);return s!==n&&(e=e.slice(0,s)),e}function l(e,t){var r=t.length<0?0:0|y(t.length);e=i(e,r);for(var n=0;n<r;n+=1)e[n]=255&t[n];return e}function c(e,t,r,n){if(t.byteLength,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");return t=void 0===r&&void 0===n?new Uint8Array(t):void 0===n?new Uint8Array(t,r):new Uint8Array(t,r,n),o.TYPED_ARRAY_SUPPORT?(e=t,e.__proto__=o.prototype):e=l(e,t),e}function p(e,t){if(o.isBuffer(t)){var r=0|y(t.length);return e=i(e,r),0===e.length?e:(t.copy(e,0,0,r),e)}if(t){if("undefined"!=typeof ArrayBuffer&&t.buffer instanceof ArrayBuffer||"length"in t)return"number"!=typeof t.length||H(t.length)?i(e,0):l(e,t);if("Buffer"===t.type&&W(t.data))return l(e,t.data)}throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}function y(e){if(e>=n())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+n().toString(16)+" bytes");return 0|e}function d(e){return+e!=e&&(e=0),o.alloc(+e)}function v(e,t){if(o.isBuffer(e))return e.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(e)||e instanceof ArrayBuffer))return e.byteLength;"string"!=typeof e&&(e=""+e);var r=e.length;if(0===r)return 0;for(var n=!1;;)switch(t){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":case void 0:return V(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return J(e).length;default:if(n)return V(e).length;t=(""+t).toLowerCase(),n=!0}}function m(e,t,r){var n=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if(r>>>=0,t>>>=0,r<=t)return"";for(e||(e="utf8");;)switch(e){case"hex":return C(this,t,r);case"utf8":case"utf-8":return P(this,t,r);case"ascii":return T(this,t,r);case"latin1":case"binary":return B(this,t,r);case"base64":return x(this,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return L(this,t,r);default:if(n)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),n=!0}}function g(e,t,r){var n=e[t];e[t]=e[r],e[r]=n}function w(e,t,r,n,i){if(0===e.length)return-1;if("string"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,isNaN(r)&&(r=i?0:e.length-1),r<0&&(r=e.length+r),r>=e.length){if(i)return-1;r=e.length-1}else if(r<0){if(!i)return-1;r=0}if("string"==typeof t&&(t=o.from(t,n)),o.isBuffer(t))return 0===t.length?-1:b(e,t,r,n,i);if("number"==typeof t)return t&=255,o.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(e,t,r):Uint8Array.prototype.lastIndexOf.call(e,t,r):b(e,[t],r,n,i);throw new TypeError("val must be string, number or Buffer")}function b(e,t,r,n,i){function o(e,t){return 1===s?e[t]:e.readUInt16BE(t*s)}var s=1,u=e.length,a=t.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(e.length<2||t.length<2)return-1;s=2,u/=2,a/=2,r/=2}var f;if(i){var h=-1;for(f=r;f<u;f++)if(o(e,f)===o(t,-1===h?0:f-h)){if(-1===h&&(h=f),f-h+1===a)return h*s}else-1!==h&&(f-=f-h),h=-1}else for(r+a>u&&(r=u-a),f=r;f>=0;f--){for(var l=!0,c=0;c<a;c++)if(o(e,f+c)!==o(t,c)){l=!1;break}if(l)return f}return-1}function _(e,t,r,n){r=Number(r)||0;var i=e.length-r;n?(n=Number(n))>i&&(n=i):n=i;var o=t.length;if(o%2!=0)throw new TypeError("Invalid hex string");n>o/2&&(n=o/2);for(var s=0;s<n;++s){var u=parseInt(t.substr(2*s,2),16);if(isNaN(u))return s;e[r+s]=u}return s}function E(e,t,r,n){return X(V(t,e.length-r),e,r,n)}function A(e,t,r,n){return X(q(t),e,r,n)}function S(e,t,r,n){return A(e,t,r,n)}function O(e,t,r,n){return X(J(t),e,r,n)}function R(e,t,r,n){return X(K(t,e.length-r),e,r,n)}function x(e,t,r){return 0===t&&r===e.length?Z.fromByteArray(e):Z.fromByteArray(e.slice(t,r))}function P(e,t,r){r=Math.min(e.length,r);for(var n=[],i=t;i<r;){var o=e[i],s=null,u=o>239?4:o>223?3:o>191?2:1;if(i+u<=r){var a,f,h,l;switch(u){case 1:o<128&&(s=o);break;case 2:a=e[i+1],128==(192&a)&&(l=(31&o)<<6|63&a)>127&&(s=l);break;case 3:a=e[i+1],f=e[i+2],128==(192&a)&&128==(192&f)&&(l=(15&o)<<12|(63&a)<<6|63&f)>2047&&(l<55296||l>57343)&&(s=l);break;case 4:a=e[i+1],f=e[i+2],h=e[i+3],128==(192&a)&&128==(192&f)&&128==(192&h)&&(l=(15&o)<<18|(63&a)<<12|(63&f)<<6|63&h)>65535&&l<1114112&&(s=l)}}null===s?(s=65533,u=1):s>65535&&(s-=65536,n.push(s>>>10&1023|55296),s=56320|1023&s),n.push(s),i+=u}return k(n)}function k(e){var t=e.length;if(t<=$)return String.fromCharCode.apply(String,e);for(var r="",n=0;n<t;)r+=String.fromCharCode.apply(String,e.slice(n,n+=$));return r}function T(e,t,r){var n="";r=Math.min(e.length,r);for(var i=t;i<r;++i)n+=String.fromCharCode(127&e[i]);return n}function B(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 C(e,t,r){var n=e.length;(!t||t<0)&&(t=0),(!r||r<0||r>n)&&(r=n);for(var i="",o=t;o<r;++o)i+=z(e[o]);return i}function L(e,t,r){for(var n=e.slice(t,r),i="",o=0;o<n.length;o+=2)i+=String.fromCharCode(n[o]+256*n[o+1]);return i}function I(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")}function j(e,t,r,n,i,s){if(!o.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>i||t<s)throw new RangeError('"value" argument is out of bounds');if(r+n>e.length)throw new RangeError("Index out of range")}function D(e,t,r,n){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))>>>8*(n?i:1-i)}function U(e,t,r,n){t<0&&(t=4294967295+t+1);for(var i=0,o=Math.min(e.length-r,4);i<o;++i)e[r+i]=t>>>8*(n?i:3-i)&255}function M(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 N(e,t,r,n,i){return i||M(e,t,r,4,3.4028234663852886e38,-3.4028234663852886e38),Q.write(e,t,r,n,23,4),r+4}function Y(e,t,r,n,i){return i||M(e,t,r,8,1.7976931348623157e308,-1.7976931348623157e308),Q.write(e,t,r,n,52,8),r+8}function F(e){if(e=G(e).replace(ee,""),e.length<2)return"";for(;e.length%4!=0;)e+="=";return e}function G(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")}function z(e){return e<16?"0"+e.toString(16):e.toString(16)}function V(e,t){t=t||1/0;for(var r,n=e.length,i=null,o=[],s=0;s<n;++s){if((r=e.charCodeAt(s))>55295&&r<57344){if(!i){if(r>56319){(t-=3)>-1&&o.push(239,191,189);continue}if(s+1===n){(t-=3)>-1&&o.push(239,191,189);continue}i=r;continue}if(r<56320){(t-=3)>-1&&o.push(239,191,189),i=r;continue}r=65536+(i-55296<<10|r-56320)}else i&&(t-=3)>-1&&o.push(239,191,189);if(i=null,r<128){if((t-=1)<0)break;o.push(r)}else if(r<2048){if((t-=2)<0)break;o.push(r>>6|192,63&r|128)}else if(r<65536){if((t-=3)<0)break;o.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;o.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return o}function q(e){for(var t=[],r=0;r<e.length;++r)t.push(255&e.charCodeAt(r));return t}function K(e,t){for(var r,n,i,o=[],s=0;s<e.length&&!((t-=2)<0);++s)r=e.charCodeAt(s),n=r>>8,i=r%256,o.push(i),o.push(n);return o}function J(e){return Z.toByteArray(F(e))}function X(e,t,r,n){for(var i=0;i<n&&!(i+r>=t.length||i>=e.length);++i)t[i+r]=e[i];return i}function H(e){return e!==e}var Z=r(13),Q=r(14),W=r(15);t.Buffer=o,t.SlowBuffer=d,t.INSPECT_MAX_BYTES=50,o.TYPED_ARRAY_SUPPORT=void 0!==e.TYPED_ARRAY_SUPPORT?e.TYPED_ARRAY_SUPPORT:function(){try{var e=new Uint8Array(1);return e.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===e.foo()&&"function"==typeof e.subarray&&0===e.subarray(1,1).byteLength}catch(e){return!1}}(),t.kMaxLength=n(),o.poolSize=8192,o._augment=function(e){return e.__proto__=o.prototype,e},o.from=function(e,t,r){return s(null,e,t,r)},o.TYPED_ARRAY_SUPPORT&&(o.prototype.__proto__=Uint8Array.prototype,o.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&o[Symbol.species]===o&&Object.defineProperty(o,Symbol.species,{value:null,configurable:!0})),o.alloc=function(e,t,r){return a(null,e,t,r)},o.allocUnsafe=function(e){return f(null,e)},o.allocUnsafeSlow=function(e){return f(null,e)},o.isBuffer=function(e){return!(null==e||!e._isBuffer)},o.compare=function(e,t){if(!o.isBuffer(e)||!o.isBuffer(t))throw new TypeError("Arguments must be Buffers");if(e===t)return 0;for(var r=e.length,n=t.length,i=0,s=Math.min(r,n);i<s;++i)if(e[i]!==t[i]){r=e[i],n=t[i];break}return r<n?-1:n<r?1:0},o.isEncoding=function(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}},o.concat=function(e,t){if(!W(e))throw new TypeError('"list" argument must be an Array of Buffers');if(0===e.length)return o.alloc(0);var r;if(void 0===t)for(t=0,r=0;r<e.length;++r)t+=e[r].length;var n=o.allocUnsafe(t),i=0;for(r=0;r<e.length;++r){var s=e[r];if(!o.isBuffer(s))throw new TypeError('"list" argument must be an Array of Buffers');s.copy(n,i),i+=s.length}return n},o.byteLength=v,o.prototype._isBuffer=!0,o.prototype.swap16=function(){var e=this.length;if(e%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var t=0;t<e;t+=2)g(this,t,t+1);return this},o.prototype.swap32=function(){var e=this.length;if(e%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var t=0;t<e;t+=4)g(this,t,t+3),g(this,t+1,t+2);return this},o.prototype.swap64=function(){var e=this.length;if(e%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var t=0;t<e;t+=8)g(this,t,t+7),g(this,t+1,t+6),g(this,t+2,t+5),g(this,t+3,t+4);return this},o.prototype.toString=function(){var e=0|this.length;return 0===e?"":0===arguments.length?P(this,0,e):m.apply(this,arguments)},o.prototype.equals=function(e){if(!o.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e||0===o.compare(this,e)},o.prototype.inspect=function(){var e="",r=t.INSPECT_MAX_BYTES;return this.length>0&&(e=this.toString("hex",0,r).match(/.{2}/g).join(" "),this.length>r&&(e+=" ... ")),"<Buffer "+e+">"},o.prototype.compare=function(e,t,r,n,i){if(!o.isBuffer(e))throw new TypeError("Argument must be a Buffer");if(void 0===t&&(t=0),void 0===r&&(r=e?e.length:0),void 0===n&&(n=0),void 0===i&&(i=this.length),t<0||r>e.length||n<0||i>this.length)throw new RangeError("out of range index");if(n>=i&&t>=r)return 0;if(n>=i)return-1;if(t>=r)return 1;if(t>>>=0,r>>>=0,n>>>=0,i>>>=0,this===e)return 0;for(var s=i-n,u=r-t,a=Math.min(s,u),f=this.slice(n,i),h=e.slice(t,r),l=0;l<a;++l)if(f[l]!==h[l]){s=f[l],u=h[l];break}return s<u?-1:u<s?1:0},o.prototype.includes=function(e,t,r){return-1!==this.indexOf(e,t,r)},o.prototype.indexOf=function(e,t,r){return w(this,e,t,r,!0)},o.prototype.lastIndexOf=function(e,t,r){return w(this,e,t,r,!1)},o.prototype.write=function(e,t,r,n){if(void 0===t)n="utf8",r=this.length,t=0;else if(void 0===r&&"string"==typeof t)n=t,r=this.length,t=0;else{if(!isFinite(t))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");t|=0,isFinite(r)?(r|=0,void 0===n&&(n="utf8")):(n=r,r=void 0)}var i=this.length-t;if((void 0===r||r>i)&&(r=i),e.length>0&&(r<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var o=!1;;)switch(n){case"hex":return _(this,e,t,r);case"utf8":case"utf-8":return E(this,e,t,r);case"ascii":return A(this,e,t,r);case"latin1":case"binary":return S(this,e,t,r);case"base64":return O(this,e,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return R(this,e,t,r);default:if(o)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),o=!0}},o.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var $=4096;o.prototype.slice=function(e,t){var r=this.length;e=~~e,t=void 0===t?r:~~t,e<0?(e+=r)<0&&(e=0):e>r&&(e=r),t<0?(t+=r)<0&&(t=0):t>r&&(t=r),t<e&&(t=e);var n;if(o.TYPED_ARRAY_SUPPORT)n=this.subarray(e,t),n.__proto__=o.prototype;else{var i=t-e;n=new o(i,void 0);for(var s=0;s<i;++s)n[s]=this[s+e]}return n},o.prototype.readUIntLE=function(e,t,r){e|=0,t|=0,r||I(e,t,this.length);for(var n=this[e],i=1,o=0;++o<t&&(i*=256);)n+=this[e+o]*i;return n},o.prototype.readUIntBE=function(e,t,r){e|=0,t|=0,r||I(e,t,this.length);for(var n=this[e+--t],i=1;t>0&&(i*=256);)n+=this[e+--t]*i;return n},o.prototype.readUInt8=function(e,t){return t||I(e,1,this.length),this[e]},o.prototype.readUInt16LE=function(e,t){return t||I(e,2,this.length),this[e]|this[e+1]<<8},o.prototype.readUInt16BE=function(e,t){return t||I(e,2,this.length),this[e]<<8|this[e+1]},o.prototype.readUInt32LE=function(e,t){return t||I(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},o.prototype.readUInt32BE=function(e,t){return t||I(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},o.prototype.readIntLE=function(e,t,r){e|=0,t|=0,r||I(e,t,this.length);for(var n=this[e],i=1,o=0;++o<t&&(i*=256);)n+=this[e+o]*i;return i*=128,n>=i&&(n-=Math.pow(2,8*t)),n},o.prototype.readIntBE=function(e,t,r){e|=0,t|=0,r||I(e,t,this.length);for(var n=t,i=1,o=this[e+--n];n>0&&(i*=256);)o+=this[e+--n]*i;return i*=128,o>=i&&(o-=Math.pow(2,8*t)),o},o.prototype.readInt8=function(e,t){return t||I(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},o.prototype.readInt16LE=function(e,t){t||I(e,2,this.length);var r=this[e]|this[e+1]<<8;return 32768&r?4294901760|r:r},o.prototype.readInt16BE=function(e,t){t||I(e,2,this.length);var r=this[e+1]|this[e]<<8;return 32768&r?4294901760|r:r},o.prototype.readInt32LE=function(e,t){return t||I(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},o.prototype.readInt32BE=function(e,t){return t||I(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},o.prototype.readFloatLE=function(e,t){return t||I(e,4,this.length),Q.read(this,e,!0,23,4)},o.prototype.readFloatBE=function(e,t){return t||I(e,4,this.length),Q.read(this,e,!1,23,4)},o.prototype.readDoubleLE=function(e,t){return t||I(e,8,this.length),Q.read(this,e,!0,52,8)},o.prototype.readDoubleBE=function(e,t){return t||I(e,8,this.length),Q.read(this,e,!1,52,8)},o.prototype.writeUIntLE=function(e,t,r,n){if(e=+e,t|=0,r|=0,!n){j(this,e,t,r,Math.pow(2,8*r)-1,0)}var i=1,o=0;for(this[t]=255&e;++o<r&&(i*=256);)this[t+o]=e/i&255;return t+r},o.prototype.writeUIntBE=function(e,t,r,n){if(e=+e,t|=0,r|=0,!n){j(this,e,t,r,Math.pow(2,8*r)-1,0)}var i=r-1,o=1;for(this[t+i]=255&e;--i>=0&&(o*=256);)this[t+i]=e/o&255;return t+r},o.prototype.writeUInt8=function(e,t,r){return e=+e,t|=0,r||j(this,e,t,1,255,0),o.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[t]=255&e,t+1},o.prototype.writeUInt16LE=function(e,t,r){return e=+e,t|=0,r||j(this,e,t,2,65535,0),o.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):D(this,e,t,!0),t+2},o.prototype.writeUInt16BE=function(e,t,r){return e=+e,t|=0,r||j(this,e,t,2,65535,0),o.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):D(this,e,t,!1),t+2},o.prototype.writeUInt32LE=function(e,t,r){return e=+e,t|=0,r||j(this,e,t,4,4294967295,0),o.TYPED_ARRAY_SUPPORT?(this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e):U(this,e,t,!0),t+4},o.prototype.writeUInt32BE=function(e,t,r){return e=+e,t|=0,r||j(this,e,t,4,4294967295,0),o.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):U(this,e,t,!1),t+4},o.prototype.writeIntLE=function(e,t,r,n){if(e=+e,t|=0,!n){var i=Math.pow(2,8*r-1);j(this,e,t,r,i-1,-i)}var o=0,s=1,u=0;for(this[t]=255&e;++o<r&&(s*=256);)e<0&&0===u&&0!==this[t+o-1]&&(u=1),this[t+o]=(e/s>>0)-u&255;return t+r},o.prototype.writeIntBE=function(e,t,r,n){if(e=+e,t|=0,!n){var i=Math.pow(2,8*r-1);j(this,e,t,r,i-1,-i)}var o=r-1,s=1,u=0;for(this[t+o]=255&e;--o>=0&&(s*=256);)e<0&&0===u&&0!==this[t+o+1]&&(u=1),this[t+o]=(e/s>>0)-u&255;return t+r},o.prototype.writeInt8=function(e,t,r){return e=+e,t|=0,r||j(this,e,t,1,127,-128),o.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),e<0&&(e=255+e+1),this[t]=255&e,t+1},o.prototype.writeInt16LE=function(e,t,r){return e=+e,t|=0,r||j(this,e,t,2,32767,-32768),o.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):D(this,e,t,!0),t+2},o.prototype.writeInt16BE=function(e,t,r){return e=+e,t|=0,r||j(this,e,t,2,32767,-32768),o.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):D(this,e,t,!1),t+2},o.prototype.writeInt32LE=function(e,t,r){return e=+e,t|=0,r||j(this,e,t,4,2147483647,-2147483648),o.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24):U(this,e,t,!0),t+4},o.prototype.writeInt32BE=function(e,t,r){return e=+e,t|=0,r||j(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),o.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):U(this,e,t,!1),t+4},o.prototype.writeFloatLE=function(e,t,r){return N(this,e,t,!0,r)},o.prototype.writeFloatBE=function(e,t,r){return N(this,e,t,!1,r)},o.prototype.writeDoubleLE=function(e,t,r){return Y(this,e,t,!0,r)},o.prototype.writeDoubleBE=function(e,t,r){return Y(this,e,t,!1,r)},o.prototype.copy=function(e,t,r,n){if(r||(r=0),n||0===n||(n=this.length),t>=e.length&&(t=e.length),t||(t=0),n>0&&n<r&&(n=r),n===r)return 0;if(0===e.length||0===this.length)return 0;if(t<0)throw new RangeError("targetStart out of bounds");if(r<0||r>=this.length)throw new RangeError("sourceStart out of bounds");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),e.length-t<n-r&&(n=e.length-t+r);var i,s=n-r;if(this===e&&r<t&&t<n)for(i=s-1;i>=0;--i)e[i+t]=this[i+r];else if(s<1e3||!o.TYPED_ARRAY_SUPPORT)for(i=0;i<s;++i)e[i+t]=this[i+r];else Uint8Array.prototype.set.call(e,this.subarray(r,r+s),t);return s},o.prototype.fill=function(e,t,r,n){if("string"==typeof e){if("string"==typeof t?(n=t,t=0,r=this.length):"string"==typeof r&&(n=r,r=this.length),1===e.length){var i=e.charCodeAt(0);i<256&&(e=i)}if(void 0!==n&&"string"!=typeof n)throw new TypeError("encoding must be a string");if("string"==typeof n&&!o.isEncoding(n))throw new TypeError("Unknown encoding: "+n)}else"number"==typeof e&&(e&=255);if(t<0||this.length<t||this.length<r)throw new RangeError("Out of range index");if(r<=t)return this;t>>>=0,r=void 0===r?this.length:r>>>0,e||(e=0);var s;if("number"==typeof e)for(s=t;s<r;++s)this[s]=e;else{var u=o.isBuffer(e)?e:V(new o(e,n).toString()),a=u.length;for(s=0;s<r-t;++s)this[s+t]=u[s%a]}return this};var ee=/[^+\/0-9A-Za-z-_]/g}).call(t,r(0))},function(e,t,r){"use strict";e.exports=r(4)},function(e,t,r){"use strict";(function(t,n){function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},s=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),u=r(6),a=r(7),f=r(8),h=r(9),l=r(12),c=r(16),p=r(18),y=p.SAVE_MODE,d=p.RECORD,v=function(){function e(){var t=this,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};i(this,e),Object.defineProperties(this,{_root:{writable:!0,enumerable:!1},_storage:{writable:!0,enumerable:!1},_memory:{writable:!0,enumerable:!1},_emitter:{value:new a},_opts:{writable:!0,enumerable:!1},_timerExpiryCheck:{value:null,writable:!0,enumerable:!1},_timerSaveCheck:{value:null,writable:!0,enumerable:!1},GLOBAL_KEY:{writable:!0,enumerable:!1},_lastChange:{value:null,writable:!0,enumerable:!1},_lastChangeDetected:{value:null,writable:!0,enumerable:!1},_lastSave:{value:null,writable:!0,enumerable:!1},_saving:{value:!1,writable:!0,enumerable:!1},_loading:{value:!1,writable:!0,enumerable:!1}}),this.GLOBAL_KEY="___InCache___storage___global___key___",this.DEFAULT_CONFIG={storeName:"",autoLoad:!0,autoSave:!1,autoSaveMode:y.TERMINATE,autoSavePeriod:5,save:!1,clone:!1,preserve:!1,deleteOnExpires:!0,filePath:".incache",maxAge:0,maxRecordNumber:0,expires:null,silent:!1,share:!1,autoRemovePeriod:0,nullIfNotFound:!1,global:{silent:!1,life:0}},this._onRemoved=function(){},this._onCreated=function(){},this._onUpdated=function(){},this.on("_change",function(e){t._lastChange=(new Date).getTime(),t._opts.silent||t._emitter.fire("change",e)}),this.setConfig(r)}return s(e,[{key:"_checkExceeded",value:function(){var e=Object.keys(this._memory.data);if(this._opts.maxRecordNumber>0&&e.length>this._opts.maxRecordNumber){var t=e.length-this._opts.maxRecordNumber;this._emitter.fire("exceed",t),this.bulkRemove(e.slice(0,t),!0)}}},{key:"_importData",value:function(t){if(u.is(t,"object")){var r=Object.keys(t);r.length&&(e.isRecord(t[r[0]])?this._memory.data=t:this.bulkSet(t,!0))}else{if(!u.is(t,"array"))throw new Error("bad data");t.length&&this.bulkSet(t,!0)}}},{key:"load",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this._opts.filePath;return new Promise(function(r,n){if(e._loading)return n("loading locked");if(!1===e._emitter.fireTheFirst("beforeLoad",e))return n();e._loading=!0;try{var i=u.isServer()?f.readFileSync(t):window.localStorage.getItem(t);null===i&&u.throwError("content cannot is null"),e._importData(JSON.parse(i.toString())),e._loading=!1,r(e),e._emitter.fireAsync("load",null,e)}catch(t){t=t.message,e._loading=!1,n(t),e._emitter.fireAsync("load",t,e)}})}},{key:"save",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this._opts.filePath;return new Promise(function(r,n){if(e._saving)return n("saving locked");if(!1===e._emitter.fireTheFirst("beforeSave",e))return n();e._saving=!0;var i=JSON.stringify(e._memory.data);try{u.isServer()?f.writeFileSync(t,i):window.localStorage.setItem(t,i),e._lastSave=(new Date).getTime(),e._saving=!1,r(e),e._emitter.fireAsync("save",null,e)}catch(t){t=t.message,e._saving=!1,n(t),e._emitter.fireAsync("save",t,e)}})}},{key:"setConfig",value:function(){var e=this,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(r.global&&(u.deprecated(r.global.life,"global.life is deprecated use maxAge instead"),u.deprecated(r.global.silent,"global.silent is deprecated use silent instead")),u.defaults(r,this.DEFAULT_CONFIG),this._opts=r,this._root=r.share?u.isServer()?t:window:{},r.storeName&&(this.GLOBAL_KEY+=r.storeName),this._root[this.GLOBAL_KEY]||(this._root[this.GLOBAL_KEY]={data:{}}),this._memory=this._root[this.GLOBAL_KEY],r.autoLoad&&this.load().then().catch(function(e){}),r.autoSave||r.save)if(r.autoSaveMode===y.TERMINATE&&u.isServer()){var i=function(){o.save().then().catch(function(e){})},o=this;n.removeListener("exit",i),n.removeListener("SIGINT",i),n.on("exit",i),n.on("SIGINT",i)}else r.autoSaveMode===y.TIMER&&(this._timerSaveCheck&&(clearInterval(this._timerSaveCheck),this._timerSaveCheck=null),r.autoSavePeriod&&(this._timerSaveCheck=setInterval(function(){e._lastChange!==e._lastChangeDetected&&(e._lastChangeDetected=e._lastChange,e.save().then().catch(function(e){}))},1e3*r.autoSavePeriod)));this._timerExpiryCheck&&(clearInterval(this._timerExpiryCheck),this._timerExpiryCheck=null),r.autoRemovePeriod&&(this._timerExpiryCheck=setInterval(function(){var t=e.removeExpired();t.length&&e._emitter.fire("expired",t)},1e3*r.autoRemovePeriod))}},{key:"getConfig",value:function(){return this._opts}},{key:"set",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if((r.silent||!1!==this._emitter.fireTheFirst("beforeSet",e,t))&&(r=u.defaults(r,this._opts),!this.has(e)||!this._memory.data[e].isPreserved)){r.clone&&(t=l(t));var n=Object.assign({},d);return n.isNew=!0,n.isPreserved=r.preserve,n.toDelete=r.deleteOnExpires,n.hits=0,n.value=t,r.expires&&(u.is(r.expires,"date")||u.is(r.expires,"string"))?n.expiresOn=new Date(r.expires):r.maxAge&&u.is(r.maxAge,"number")?n.expiresOn=u.addMSToNow(r.maxAge):r.life&&u.is(r.life,"number")&&(u.deprecated(r.life,"life is deprecated use maxAge instead"),n.expiresOn=u.addSecondsToNow(r.life)),this.has(e)?(n.isNew=!1,n.hits=this._memory.data[e].hits,n.id=this._memory.data[e].id,n.createdOn=this._memory.data[e].createdOn,n.updatedOn=new Date,r.silent||(this._onUpdated.call(this,e,n),this._emitter.fire("update",e,n))):(n.id=h(),n.createdOn=new Date,r.silent||(this._onCreated.call(this,e,n),this._emitter.fire("create",e,n))),this._memory.data[e]=n,r.silent||this._emitter.fire("set",e,n),this._checkExceeded(),this._emitter.fire("_change","set"),n}}},{key:"get",value:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return this.has(e)?!this._opts.autoRemovePeriod&&this.expired(e)&&this._memory.data[e].toDelete?(this.remove(e,!0),this._opts.nullIfNotFound?null:void 0):(this._memory.data[e].hits+=1,this._memory.data[e].lastHit=new Date,t?this._memory.data[e].value:this._memory.data[e]):this._opts.nullIfNotFound?null:void 0}},{key:"remove",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];(t||!1!==this._emitter.fireTheFirst("beforeRemove",e))&&(delete this._memory.data[e],t||(this._onRemoved.call(this,e),this._emitter.fire("remove",e)),this._emitter.fire("_change","remove"))}},{key:"removeFrom",value:function(e,t){if(!this.has(e))return null;if(u.is(t,"undefined"))throw new Error("where cannot be undefined");if(!this._memory.data[e].isPreserved){var r=this.get(e);if(!u.is(r,"array"))throw new Error("value must be an array");var n=r.length;for(var i in r)if(r.hasOwnProperty(i)){var o=[];for(var s in t)t.hasOwnProperty(s)&&(u.is(t,"object")?o.push(void 0!==r[i][s]&&r[i][s]===t[s]):o.push(r[i]===t));o.length&&-1===o.indexOf(!1)&&r.splice(i,1)}n!==r.length&&this.set(e,r)}}},{key:"removeExpired",value:function(){var e=[];for(var t in this._memory.data)this._memory.data.hasOwnProperty(t)&&this.expired(t)&&this._memory.data[t].toDelete&&(this.remove(t,!0),e.push(t));return e}},{key:"addTo",value:function(e,t){if(this.has(e)){var r=this.get(e);if(!this._memory.data[e].isPreserved){if(!u.is(r,"array"))throw new Error("object must be an array");return r.push(t),this.set(e,r)}}}},{key:"prependTo",value:function(e,t){if(this.has(e)&&!this._memory.data[e].isPreserved){var r=this.get(e);if(!u.is(r,"array"))throw new Error("object must be an array");return r.unshift(t),this.set(e,r)}}},{key:"updateIn",value:function(e,t,r){if(this.has(e)){if(u.is(t,"undefined"))throw new Error("value cannot be undefined");if(u.is(r,"undefined"))throw new Error("where cannot be undefined");if(!this._memory.data[e].isPreserved){var n=this.get(e);if(!u.is(n,"array"))throw new Error("value must be an array");var i=!1;for(var o in n)if(n.hasOwnProperty(o)){var s=[];for(var a in r)r.hasOwnProperty(a)&&(u.is(r,"object")?s.push(void 0!==n[o][a]&&n[o][a]===r[a]):s.push(n[o]===r));s.length&&-1===s.indexOf(!1)&&(i=!0,n[o]=t)}i&&this.set(e,n)}}}},{key:"bulkSet",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(!u.is(e,"array")&&!u.is(e,"object"))throw new Error("records must be an array, e.g. {key: foo, value: bar}");if(t||!1!==this._emitter.fireTheFirst("beforeBulkSet",e)){for(var r={},n=void 0,i=0;i<e.length;i++)u.is(e[i].key,"undefined")||u.is(e[i].value,"undefined")?(n=this.set(i,e[i],{silent:!0,fromBulk:!0}))&&(r[i]=n):(n=this.set(e[i].key,e[i].value,{silent:!0,fromBulk:!0}))&&(r[e[i].key]=n);return t||this._emitter.fire("bulkSet",e),r}}},{key:"bulkRemove",value:function(e,t){if(!u.is(e,"array"))throw new Error("keys must be an array of keys");if(t||!1!==this._emitter.fireTheFirst("beforeBulkRemove",e)){for(var r=0;r<e.length;r++)this.remove(e[r],!0);t||this._emitter.fire("bulkRemove",e)}}},{key:"clean",value:function(e){if(!u.is(e,"string"))throw new Error("key must be a string");for(var t in this._memory.data)this._memory.data.hasOwnProperty(t)&&-1!==t.indexOf(e)&&(delete this._memory.data[t],this._emitter.fire("_change","clean"))}},{key:"all",value:function(){var e=[];for(var t in this._memory.data)this._memory.data.hasOwnProperty(t)&&(!this._opts.autoRemovePeriod&&this.expired(t)&&this._memory.data[t].toDelete?this.remove(t,!0):e.push({key:t,value:this._memory.data[t].value}));return e}},{key:"count",value:function(){return this.removeExpired(),Object.keys(this._memory.data).length}},{key:"expired",value:function(e){if(this._memory.data[e]&&this._memory.data[e].expiresOn){return new Date>new Date(this._memory.data[e].expiresOn)}return!1}},{key:"clear",value:function(){this._memory.data={},this._emitter.fire("_change","clear")}},{key:"has",value:function(e){return this._memory.data.hasOwnProperty(e)}},{key:"destroy",value:function(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];this.remove.apply(this,t)}},{key:"stats",value:function(){return{count:this.count(),size:c(this._memory.data)}}},{key:"on",value:function(e,t){return this._emitter.on.call(this._emitter,e,t),this}},{key:"suspendEvent",value:function(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];return this._emitter.suspendEvent.call(this._emitter,t),this}},{key:"resumeEvent",value:function(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];return this._emitter.resumeEvent.call(this._emitter,t),this}},{key:"suspendEvents",value:function(){return this._emitter.suspendEvents.call(this._emitter),this}},{key:"resumeEvents",value:function(){return this._emitter.resumeEvents.call(this._emitter),this}},{key:"onRemoved",value:function(e){this._onRemoved=e}},{key:"onCreated",value:function(e){this._onCreated=e}},{key:"onUpdated",value:function(e){this._onUpdated=e}}],[{key:"isRecord",value:function(e){return Object.keys(d).every(function(t){return"object"===(void 0===e?"undefined":o(e))&&e.hasOwnProperty(t)})}}]),e}();e.exports=v,e.exports.SAVE_MODE=y}).call(t,r(0),r(5))},function(e,t,r){"use strict";function n(){throw new Error("setTimeout has not been defined")}function i(){throw new Error("clearTimeout has not been defined")}function o(e){if(l===setTimeout)return setTimeout(e,0);if((l===n||!l)&&setTimeout)return l=setTimeout,setTimeout(e,0);try{return l(e,0)}catch(t){try{return l.call(null,e,0)}catch(t){return l.call(this,e,0)}}}function s(e){if(c===clearTimeout)return clearTimeout(e);if((c===i||!c)&&clearTimeout)return c=clearTimeout,clearTimeout(e);try{return c(e)}catch(t){try{return c.call(null,e)}catch(t){return c.call(this,e)}}}function u(){v&&y&&(v=!1,y.length?d=y.concat(d):m=-1,d.length&&a())}function a(){if(!v){var e=o(u);v=!0;for(var t=d.length;t;){for(y=d,d=[];++m<t;)y&&y[m].run();m=-1,t=d.length}y=null,v=!1,s(e)}}function f(e,t){this.fun=e,this.array=t}function h(){}var l,c,p=e.exports={};!function(){try{l="function"==typeof setTimeout?setTimeout:n}catch(e){l=n}try{c="function"==typeof clearTimeout?clearTimeout:i}catch(e){c=i}}();var y,d=[],v=!1,m=-1;p.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];d.push(new f(e,t)),1!==d.length||v||o(a)},f.prototype.run=function(){this.fun.apply(null,this.array)},p.title="browser",p.browser=!0,p.env={},p.argv=[],p.version="",p.versions={},p.on=h,p.addListener=h,p.once=h,p.off=h,p.removeListener=h,p.removeAllListeners=h,p.emit=h,p.prependListener=h,p.prependOnceListener=h,p.listeners=function(e){return[]},p.binding=function(e){throw new Error("process.binding is not supported")},p.cwd=function(){return"/"},p.chdir=function(e){throw new Error("process.chdir is not supported")},p.umask=function(){return 0}},function(e,t,r){"use strict";var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},i={};i.is=function(e,t){return Object.prototype.toString.call(e).toLowerCase()==="[object "+t+"]".toLowerCase()},i.defaults=function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e.hasOwnProperty(r)?"object"===n(e[r])&&i.defaults(e[r],t[r]):e[r]=t[r]);return e},i.addSecondsToNow=function(e){var t=new Date;return new Date(t.setSeconds(t.getSeconds()+e))},i.addMSToNow=function(e){var t=new Date;return new Date(t.setMilliseconds(t.getMilliseconds()+e))},i.isServer=function(){return"undefined"==typeof window},i.deprecated=function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"warn";return void 0!==e&&(console[r](t||e),!0)},i.throwError=function(e){throw new Error(e)},e.exports=i},function(e,t,r){"use strict";(function(e){var r,n,i,o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};!function(s,u){"object"===o(t)&&"object"===o(e)?e.exports=u():(n=[],r=u,void 0!==(i="function"==typeof r?r.apply(t,n):r)&&(e.exports=i))}(0,function(){return function(e){function t(n){if(r[n])return r[n].exports;var i=r[n]={i:n,l:!1,exports:{}};return e[n].call(i.exports,i,i.exports,t),i.l=!0,i.exports}var r={};return t.m=e,t.c=r,t.d=function(e,r,n){t.o(e,r)||Object.defineProperty(e,r,{configurable:!1,enumerable:!0,get:n})},t.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(r,"a",r),r},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=0)}([function(e,t,r){e.exports=r(1)},function(e,t,r){function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var i=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),o=r(2),s=r(3),u=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};n(this,e),this.defaultClassOpts={maxListeners:10,asyncDelay:10},this.defaultListenerOpts={maxCalls:0,prepend:!1},this.opts=o.defaults(t,this.defaultClassOpts),this.events={}}return i(e,[{key:"_createEvent",value:function(e,t,r){if(this.events[e]||(this.events[e]=[]),this.opts.maxListeners){var n=this.opts.maxListeners;if(this.events[e].length>=n)throw new Error(s[3]+n)}t.opts=o.defaults(r,this.defaultListenerOpts),t.state={suspended:!1,calls:0},r.prepend?this.events[e].unshift(t):this.events[e].push(t),this._created.call(this,e,t,r)}},{key:"_callEvent",value:function(e,t,r){if(!t.state.suspended)return t.opts.maxCalls&&t.state.calls++>=t.opts.maxCalls?void this.off(e,t):(this._catchAll.call(this,r),t.apply(this,r))}},{key:"_suspendEvent",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments[1],r=void 0;for(var n in e)r=e[n],this.events[r]&&this.events[r].forEach(function(e){e.state.suspended=t});return this}},{key:"_created",value:function(){}},{key:"_removed",value:function(){}},{key:"_catchAll",value:function(){}},{key:"on",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(!o.is(e,"string"))throw new Error(s[0]);if(e=e.trim(),!e.length)throw new Error(s[4]);if(o.is(t,"array")){for(var n in t)if(t.hasOwnProperty(n)){if(!o.is(t[n],"function"))throw new Error(s[1]);this._createEvent(e,t[n],r)}}else{if(!o.is(t,"function"))throw new Error(s[1]);this._createEvent(e,t,r)}return this}},{key:"once",value:function(e,t){return this.on(e,t,{maxCalls:1})}},{key:"fire",value:function(e){if(this.exists(e)){for(var t=arguments.length,r=Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];for(var i=0;i<this.events[e].length;i++)this._callEvent(e,this.events[e][i],r)}return this}},{key:"fireTheFirst",value:function(e){for(var t=arguments.length,r=Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];if(this.exists(e))return this._callEvent(e,this.events[e][0],r)}},{key:"fireAsync",value:function(e){for(var t=this,r=arguments.length,n=Array(r>1?r-1:0),i=1;i<r;i++)n[i-1]=arguments[i];n.unshift(e),setTimeout(function(){t.fire.apply(t,n)},this.opts.asyncDelay)}},{key:"off",value:function(e,t){if(!o.is(e,"string"))throw new Error(s[0]);if(this.events[e])if("function"==typeof t)for(var r=0;r<this.events[e].length;r++)this.events[e][r]===t&&(this.events[e].splice(r,1),this._removed.call(this,e,t));else delete this.events[e],this._removed.call(this,e);return this}},{key:"prependListener",value:function(e,t){return this.on(e,t,{prepend:!0})}},{key:"prependOnceListener",value:function(e,t){return this.on(e,t,{maxCalls:1,prepend:!0})}},{key:"suspendEvent",value:function(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];return this._suspendEvent(t,!0)}},{key:"resumeEvent",value:function(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];return this._suspendEvent(t,!1)}},{key:"suspendEvents",value:function(){return this._suspendEvent(Object.keys(this.events),!0)}},{key:"resumeEvents",value:function(){return this._suspendEvent(Object.keys(this.events),!1)}},{key:"isSuspended",value:function(e){return!!this.exists(e)&&this.events[e][0].state.suspended}},{key:"clear",value:function(){return this.events=[],this}},{key:"getListenersCount",value:function(e){return this.getListeners(e).length}},{key:"getListeners",value:function(e){if(!o.is(e,"string"))throw new Error(s[0]);if(!this.exists(e))throw new Error(s[5]);return this.events[e]}},{key:"getEvents",value:function(){return this.events}},{key:"exists",value:function(e){if(!o.is(e,"string"))throw new Error(s[0]);return!o.is(this.events[e],"undefined")}},{key:"getMaxListeners",value:function(){return this.opts.maxListeners}},{key:"setMaxListeners",value:function(e){if(!o.is(e,"number"))throw new Error(s[2]);return this.opts.maxListeners=e,this}},{key:"onCatchAll",value:function(e){return this._catchAll=e,this}},{key:"onCreated",value:function(e){return this._created=e,this}},{key:"onRemoved",value:function(e){return this._removed=e,this}}]),e}();e.exports=u,e.exports._error=s},function(e,t,r){var n="function"==typeof Symbol&&"symbol"===o(Symbol.iterator)?function(e){return void 0===e?"undefined":o(e)}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":void 0===e?"undefined":o(e)},i={};i.is=function(e,t){return Object.prototype.toString.call(e).toLowerCase()==="[object "+t+"]".toLowerCase()},i.defaults=function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e.hasOwnProperty(r)?"object"===n(e[r])&&i.defaults(e[r],t[r]):e[r]=t[r]);return e},e.exports=i},function(e,t,r){e.exports=["event name is required and must be a string","listener is required and must be a function or an array of function","value must be a number","increase maxListeners per event: ","event name not valid","event not found"]}])})}).call(t,r(1)(e))},function(e,t,r){"use strict"},function(e,t,r){"use strict";function n(e,t,r){var n=t&&r||0,i=t||[];e=e||{};var s=void 0!==e.clockseq?e.clockseq:a,l=void 0!==e.msecs?e.msecs:(new Date).getTime(),c=void 0!==e.nsecs?e.nsecs:h+1,p=l-f+(c-h)/1e4;if(p<0&&void 0===e.clockseq&&(s=s+1&16383),(p<0||l>f)&&void 0===e.nsecs&&(c=0),c>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");f=l,h=c,a=s,l+=122192928e5;var y=(1e4*(268435455&l)+c)%4294967296;i[n++]=y>>>24&255,i[n++]=y>>>16&255,i[n++]=y>>>8&255,i[n++]=255&y;var d=l/4294967296*1e4&268435455;i[n++]=d>>>8&255,i[n++]=255&d,i[n++]=d>>>24&15|16,i[n++]=d>>>16&255,i[n++]=s>>>8|128,i[n++]=255&s;for(var v=e.node||u,m=0;m<6;++m)i[n+m]=v[m];return t||o(i)}var i=r(10),o=r(11),s=i(),u=[1|s[0],s[1],s[2],s[3],s[4],s[5]],a=16383&(s[6]<<8|s[7]),f=0,h=0;e.exports=n},function(e,t,r){"use strict";(function(t){var r,n=t.crypto||t.msCrypto;if(n&&n.getRandomValues){var i=new Uint8Array(16);r=function(){return n.getRandomValues(i),i}}if(!r){var o=new Array(16);r=function(){for(var e,t=0;t<16;t++)0==(3&t)&&(e=4294967296*Math.random()),o[t]=e>>>((3&t)<<3)&255;return o}}e.exports=r}).call(t,r(0))},function(e,t,r){"use strict";function n(e,t){var r=t||0,n=i;return n[e[r++]]+n[e[r++]]+n[e[r++]]+n[e[r++]]+"-"+n[e[r++]]+n[e[r++]]+"-"+n[e[r++]]+n[e[r++]]+"-"+n[e[r++]]+n[e[r++]]+"-"+n[e[r++]]+n[e[r++]]+n[e[r++]]+n[e[r++]]+n[e[r++]]+n[e[r++]]}for(var i=[],o=0;o<256;++o)i[o]=(o+256).toString(16).substr(1);e.exports=n},function(e,t,r){"use strict";(function(e,t){var r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},n=function(){function t(e,t){return null!=t&&e instanceof t}function n(i,o,s,u,c){function p(i,s){if(null===i)return null;if(0===s)return i;var m,g;if("object"!=(void 0===i?"undefined":r(i)))return i;if(t(i,f))m=new f;else if(t(i,h))m=new h;else if(t(i,l))m=new l(function(e,t){i.then(function(t){e(p(t,s-1))},function(e){t(p(e,s-1))})});else if(n.__isArray(i))m=[];else if(n.__isRegExp(i))m=new RegExp(i.source,a(i)),i.lastIndex&&(m.lastIndex=i.lastIndex);else if(n.__isDate(i))m=new Date(i.getTime());else{if(v&&e.isBuffer(i))return m=new e(i.length),i.copy(m),m;t(i,Error)?m=Object.create(i):void 0===u?(g=Object.getPrototypeOf(i),m=Object.create(g)):(m=Object.create(u),g=u)}if(o){var w=y.indexOf(i);if(-1!=w)return d[w];y.push(i),d.push(m)}t(i,f)&&i.forEach(function(e,t){var r=p(t,s-1),n=p(e,s-1);m.set(r,n)}),t(i,h)&&i.forEach(function(e){var t=p(e,s-1);m.add(t)});for(var b in i){var _;g&&(_=Object.getOwnPropertyDescriptor(g,b)),_&&null==_.set||(m[b]=p(i[b],s-1))}if(Object.getOwnPropertySymbols)for(var E=Object.getOwnPropertySymbols(i),b=0;b<E.length;b++){var A=E[b],S=Object.getOwnPropertyDescriptor(i,A);(!S||S.enumerable||c)&&(m[A]=p(i[A],s-1),S.enumerable||Object.defineProperty(m,A,{enumerable:!1}))}if(c)for(var O=Object.getOwnPropertyNames(i),b=0;b<O.length;b++){var R=O[b],S=Object.getOwnPropertyDescriptor(i,R);S&&S.enumerable||(m[R]=p(i[R],s-1),Object.defineProperty(m,R,{enumerable:!1}))}return m}"object"===(void 0===o?"undefined":r(o))&&(s=o.depth,u=o.prototype,c=o.includeNonEnumerable,o=o.circular);var y=[],d=[],v=void 0!==e;return void 0===o&&(o=!0),void 0===s&&(s=1/0),p(i,s)}function i(e){return Object.prototype.toString.call(e)}function o(e){return"object"===(void 0===e?"undefined":r(e))&&"[object Date]"===i(e)}function s(e){return"object"===(void 0===e?"undefined":r(e))&&"[object Array]"===i(e)}function u(e){return"object"===(void 0===e?"undefined":r(e))&&"[object RegExp]"===i(e)}function a(e){var t="";return e.global&&(t+="g"),e.ignoreCase&&(t+="i"),e.multiline&&(t+="m"),t}var f;try{f=Map}catch(e){f=function(){}}var h;try{h=Set}catch(e){h=function(){}}var l;try{l=Promise}catch(e){l=function(){}}return n.clonePrototype=function(e){if(null===e)return null;var t=function(){};return t.prototype=e,new t},n.__objToStr=i,n.__isDate=o,n.__isArray=s,n.__isRegExp=u,n.__getRegExpFlags=a,n}();"object"===r(t)&&t.exports&&(t.exports=n)}).call(t,r(2).Buffer,r(1)(e))},function(e,t,r){"use strict";function n(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");return"="===e[t-2]?2:"="===e[t-1]?1:0}function i(e){return 3*e.length/4-n(e)}function o(e){var t,r,i,o,s,u=e.length;o=n(e),s=new l(3*u/4-o),r=o>0?u-4:u;var a=0;for(t=0;t<r;t+=4)i=h[e.charCodeAt(t)]<<18|h[e.charCodeAt(t+1)]<<12|h[e.charCodeAt(t+2)]<<6|h[e.charCodeAt(t+3)],s[a++]=i>>16&255,s[a++]=i>>8&255,s[a++]=255&i;return 2===o?(i=h[e.charCodeAt(t)]<<2|h[e.charCodeAt(t+1)]>>4,s[a++]=255&i):1===o&&(i=h[e.charCodeAt(t)]<<10|h[e.charCodeAt(t+1)]<<4|h[e.charCodeAt(t+2)]>>2,s[a++]=i>>8&255,s[a++]=255&i),s}function s(e){return f[e>>18&63]+f[e>>12&63]+f[e>>6&63]+f[63&e]}function u(e,t,r){for(var n,i=[],o=t;o<r;o+=3)n=(e[o]<<16)+(e[o+1]<<8)+e[o+2],i.push(s(n));return i.join("")}function a(e){for(var t,r=e.length,n=r%3,i="",o=[],s=0,a=r-n;s<a;s+=16383)o.push(u(e,s,s+16383>a?a:s+16383));return 1===n?(t=e[r-1],i+=f[t>>2],i+=f[t<<4&63],i+="=="):2===n&&(t=(e[r-2]<<8)+e[r-1],i+=f[t>>10],i+=f[t>>4&63],i+=f[t<<2&63],i+="="),o.push(i),o.join("")}t.byteLength=i,t.toByteArray=o,t.fromByteArray=a;for(var f=[],h=[],l="undefined"!=typeof Uint8Array?Uint8Array:Array,c="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",p=0,y=c.length;p<y;++p)f[p]=c[p],h[c.charCodeAt(p)]=p;h["-".charCodeAt(0)]=62,h["_".charCodeAt(0)]=63},function(e,t,r){"use strict";t.read=function(e,t,r,n,i){var o,s,u=8*i-n-1,a=(1<<u)-1,f=a>>1,h=-7,l=r?i-1:0,c=r?-1:1,p=e[t+l];for(l+=c,o=p&(1<<-h)-1,p>>=-h,h+=u;h>0;o=256*o+e[t+l],l+=c,h-=8);for(s=o&(1<<-h)-1,o>>=-h,h+=n;h>0;s=256*s+e[t+l],l+=c,h-=8);if(0===o)o=1-f;else{if(o===a)return s?NaN:1/0*(p?-1:1);s+=Math.pow(2,n),o-=f}return(p?-1:1)*s*Math.pow(2,o-n)},t.write=function(e,t,r,n,i,o){var s,u,a,f=8*o-i-1,h=(1<<f)-1,l=h>>1,c=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,p=n?0:o-1,y=n?1:-1,d=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(u=isNaN(t)?1:0,s=h):(s=Math.floor(Math.log(t)/Math.LN2),t*(a=Math.pow(2,-s))<1&&(s--,a*=2),t+=s+l>=1?c/a:c*Math.pow(2,1-l),t*a>=2&&(s++,a/=2),s+l>=h?(u=0,s=h):s+l>=1?(u=(t*a-1)*Math.pow(2,i),s+=l):(u=t*Math.pow(2,l-1)*Math.pow(2,i),s=0));i>=8;e[r+p]=255&u,p+=y,u/=256,i-=8);for(s=s<<i|u,f+=i;f>0;e[r+p]=255&s,p+=y,s/=256,f-=8);e[r+p-y]|=128*d}},function(e,t,r){"use strict";var n={}.toString;e.exports=Array.isArray||function(e){return"[object Array]"==n.call(e)}},function(e,t,r){"use strict";function n(e){if(null!==e&&"object"===(void 0===e?"undefined":i(e))){if(s.isBuffer(e))return e.length;var t=0;for(var r in e)if(Object.hasOwnProperty.call(e,r)){t+=n(r);try{t+=n(e[r])}catch(e){e instanceof RangeError&&(t=0)}}return t}return"string"==typeof e?e.length*o.STRING:"boolean"==typeof e?o.BOOLEAN:"number"==typeof e?o.NUMBER:0}var i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},o=r(17),s=r(2).Buffer;e.exports=n},function(e,t,r){"use strict";e.exports={STRING:2,BOOLEAN:4,NUMBER:8}},function(e,t,r){"use strict";t.SAVE_MODE=Object.defineProperties({},{TERMINATE:{value:"terminate",enumerable:!0},TIMER:{value:"timer",enumerable:!0}}),t.REMOVE_EXCEED=Object.defineProperties({},{OLDER:{value:"older",enumerable:!0},USAGE:{value:"usage",enumerable:!0},NONE:{value:"none",enumerable:!0}}),t.RECORD={id:null,isNew:!0,isPreserved:null,toDelete:null,hits:null,lastHit:null,createdOn:null,updatedOn:null,expiresOn:null,value:null}}])}); |
{ | ||
"name": "incache", | ||
"version": "6.6.1", | ||
"version": "7.0.0", | ||
"description": "Powerful key/value in-memory storage or on disk to persist some data", | ||
@@ -55,2 +55,3 @@ "main": "index.js", | ||
"mocha-lcov-reporter": "^1.3.0", | ||
"mock-local-storage": "^1.0.5", | ||
"typis": "^1.0.2", | ||
@@ -57,0 +58,0 @@ "unminified-webpack-plugin": "^1.2.0", |
@@ -17,3 +17,3 @@ <div align="center"> | ||
InCache is a module that store any info in memory, it can be used for example for storing **server sessions**, **caching http response** or **sharing singleton object** in your apps. | ||
It also give you the possibility to save data on disk so you can avoid the data loss when the process exit or restart. | ||
It also give you the possibility to save data on disk so you can avoid the data loss when the process exit or restart. In a browser scenario all data is saved on localStorage through a key. | ||
@@ -135,2 +135,9 @@ ## Installation | ||
### Browser scenario | ||
In browser environment the file path becomes a string key for localStorage interface: | ||
```javascript | ||
store.load('myLocalStorageKey'); | ||
store.save('myLocalStorageKey'); | ||
``` | ||
### Events | ||
@@ -137,0 +144,0 @@ ```javascript |
@@ -78,2 +78,10 @@ const helper = {}; | ||
/** | ||
* Throw error | ||
* @param msg | ||
*/ | ||
helper.throwError = (msg) => { | ||
throw new Error(msg); | ||
}; | ||
module.exports = helper; |
@@ -53,7 +53,7 @@ const helper = require('./helper'); | ||
* @param [opts.maxRecordNumber=0] {number} the maximum of record number of the cache, if exceeded some records will be deleted. If 0 is disabled | ||
* @param [opts.autoLoad=true] {boolean} load cache from disk when instance is created. (server only) | ||
* @param [opts.autoSave=false] {boolean} if true saves cache in disk when the process is terminated. (server only) | ||
* @param [opts.autoSaveMode=terminate] {string} there are 2 modes -> "terminate": saves before the process is terminated. "timer": every n seconds checks for new changes and save on disk. (server only) | ||
* @param [opts.autoSavePeriod=5] {number} period in seconds to check for new changes to save on disk. Works only if `opts.autoSaveMode` is set to 'timer' mode. (server only) | ||
* @param [opts.filePath=.incache] {string} cache file path | ||
* @param [opts.autoLoad=true] {boolean} load cache from disk when instance is created. | ||
* @param [opts.autoSave=false] {boolean} if true saves cache in disk when the process is terminated. | ||
* @param [opts.autoSaveMode=terminate] {string} there are 2 modes -> "terminate": saves before the process is terminated (server only). "timer": every n seconds checks for new changes and save on disk. | ||
* @param [opts.autoSavePeriod=5] {number} period in seconds to check for new changes to save on disk. Works only if `opts.autoSaveMode` is set to 'timer' mode. | ||
* @param [opts.filePath=.incache] {string} cache file path or key (browser scenario) | ||
* @param [opts.storeName] {string} store name | ||
@@ -63,3 +63,3 @@ * @param [opts.share=false] {boolean} if true, use global object as storage | ||
* @param [opts.nullIfNotFound=false] {boolean} calling `get` if the key is not found returns `null`. If false returns `undefined` | ||
* @param [opts.save=false] {boolean} **deprecated:** if true saves cache in disk when the process is terminated. Use `autoSave` instead. (server only) | ||
* @param [opts.save=false] {boolean} **deprecated:** if true saves cache in disk when the process is terminated. Use `autoSave` instead. | ||
* @param [opts.global] {Object} **deprecated:** global record configuration | ||
@@ -224,3 +224,3 @@ * @param [opts.global.silent=false] {boolean} **deprecated:** if true no event will be triggered, use `silent` instead | ||
* Load cache from disk | ||
* @param [path=opts.filePath] {string} file path | ||
* @param [path=opts.filePath] {string} file path or key (browser scenario) | ||
* @fires InCache#beforeLoad | ||
@@ -234,3 +234,3 @@ * @fires InCache#load | ||
(resolve, reject) => { | ||
if (!helper.isServer()) return reject('operation not allowed'); | ||
//if (!helper.isServer()) return reject('operation not allowed'); | ||
if (this._loading) return reject('loading locked'); | ||
@@ -246,4 +246,7 @@ | ||
try { | ||
let content = fs.readFileSync(path); | ||
//this._memory.data = JSON.parse(content.toString()); | ||
let content = helper.isServer() ? fs.readFileSync(path) : window.localStorage.getItem(path); | ||
if (content === null) | ||
helper.throwError('content cannot is null'); | ||
this._importData(JSON.parse(content.toString())); | ||
@@ -265,3 +268,3 @@ this._loading = false; | ||
* Save cache into disk | ||
* @param [path=opts.filePath] {string} file path | ||
* @param [path=opts.filePath] {string} file path or key (browser scenario) | ||
* @fires InCache#beforeSave | ||
@@ -275,3 +278,3 @@ * @fires InCache#save | ||
(resolve, reject) => { | ||
if (!helper.isServer()) return reject('operation not allowed'); | ||
//if (!helper.isServer()) return reject('operation not allowed'); | ||
if (this._saving) return reject('saving locked'); | ||
@@ -286,4 +289,10 @@ | ||
let dataString = JSON.stringify(this._memory.data); | ||
try { | ||
fs.writeFileSync(path, JSON.stringify(this._memory.data)); | ||
if (helper.isServer()) | ||
fs.writeFileSync(path, dataString); | ||
else | ||
window.localStorage.setItem(path, dataString); | ||
this._lastSave = (new Date()).getTime(); | ||
@@ -345,3 +354,3 @@ this._saving = false; | ||
/* istanbul ignore else */ | ||
if (helper.isServer()) { | ||
//if (helper.isServer()) { | ||
if (opts.autoLoad) | ||
@@ -355,3 +364,3 @@ this.load().then().catch((e) => { | ||
/* istanbul ignore else */ | ||
if (opts.autoSaveMode === SAVE_MODE.TERMINATE) { | ||
if (opts.autoSaveMode === SAVE_MODE.TERMINATE && helper.isServer()) { | ||
let self = this; | ||
@@ -393,3 +402,3 @@ | ||
} | ||
} | ||
//} | ||
@@ -396,0 +405,0 @@ /* istanbul ignore else */ |
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
260269
5404
209
18