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,QAAgB,MAAM,QAAQ,GACvD,OAAO,KAAK,MAAM,UAAW,KAAQ,GAIvC,GADI,MAAM,QAAQ,KAAM,EAAM,EAAI,KAAK,OAClC,SAAS,GACZ,MAAM,IAAI,UAAU,kDAGtB,OAAoB,IAAhB,EAAK,OACA,IAAI,KAAK,SAAU,IAG5B,IAAI,KAAK,SAAU,KAAQ,GAC3B,KAAK,KAAK,UAAW,EAAK,GACnB,KACT,CAmBA,KAAA,CAAM,KAAQ,GAIZ,OAHI,MAAM,QAAQ,KAAM,EAAM,EAAI,KAAK,MACvC,MAAM,KAAK,KAAK,MAAO,KAAQ,GAC/B,KAAK,KAAK,WAAY,GACf,IACT,CAoBA,GAAA,CAAI,GAEF,OADI,MAAM,QAAQ,KAAM,EAAM,EAAI,KAAK,WACK,IAA9B,IAAI,KAAK,KAAK,MAAO,EACrC,CA4BA,MAAA,CAAO,GAEL,OADI,MAAM,QAAQ,KAAM,EAAM,EAAI,KAAK,MAChC,OAAO,KAAK,KAAK,MAAO,EACjC,CAuBA,GAAA,CAAI,GACF,OAAK,GACL,IAAI,KAAK,KAAK,MAAO,GACrB,KAAK,KAAK,MAAO,GACV,MAHU,KAAK,OAIxB,CAeA,KAAA,GAGE,OAFA,KAAK,KAAK,MAAQ,CAAC,EACnB,KAAK,KAAK,SACH,IACT,CAaA,KAAA,CAAM,KAAQ,GAEZ,OADA,MAAM,KAAM,KAAQ,GACb,IACT,CAiBA,QAAI,GACF,OAAO,OAAO,KAAK,KAAK,KAAK,MAC/B,CAiBA,QAAI,GACF,OAAO,KAAK,KAAK,MACnB,EAOF,SAAS,SAAS,GAChB,MAAwB,iBAAV,GAAgC,KAAV,CACtC,CAMA,SAAS,SAAS,GAChB,MAAyB,WAAlB,OAAO,EAChB,CAMA,OAAO,QAAU","file":"/npm/cache-base@4.0.2/index.js","sourceRoot":"","sourcesContent":["/**\n * Minified by jsDelivr using Terser v5.37.0.\n * Original file: /npm/cache-base@4.0.2/index.js\n *\n * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files\n */\n","'use strict';\n\nconst typeOf = require('kind-of');\nconst Emitter = require('@sellside/emitter');\nconst visit = require('collection-visit');\nconst hasOwn = require('has-own-deep');\nconst union = require('union-value');\nconst del = require('unset-value');\nconst get = require('get-value');\nconst set = require('set-value');\n\n/**\n * Create an instance of `CacheBase`.\n *\n * ```js\n * const app = new CacheBase();\n * ```\n * @param {String|Object} `prop` (optional) Property name to use for the cache, or the object to initialize with.\n * @param {Object} `cache` (optional) An object to initialize with.\n * @constructor\n * @api public\n */\n\nclass CacheBase extends Emitter {\n  constructor(prop, cache) {\n    super();\n\n    if (typeof prop !== 'string') {\n      cache = prop || cache;\n      prop = 'cache';\n    }\n\n    Reflect.defineProperty(this, 'prop', { value: prop });\n    this[this.prop] = {};\n\n    if (cache) {\n      this.set(cache);\n    }\n  }\n\n  /**\n   * Assign `value` to `key`. Also emits `set` with the key and value.\n   *\n   * ```js\n   * app.on('set', function(key, val) {\n   *   // do something when `set` is emitted\n   * });\n   *\n   * app.set('admin', true);\n   *\n   * // also takes an object or an array of objects\n   * app.set({ name: 'Brian' });\n   * app.set([{ foo: 'bar' }, { baz: 'quux' }]);\n   * console.log(app);\n   * //=> { name: 'Brian', foo: 'bar', baz: 'quux' }\n   * ```\n   * @name .set\n   * @emits `set` with `key` and `value` as arguments.\n   * @param {String|Array} `key` The name of the property to set. Dot-notation may be used to set nested properties.\n   * @param {any} `value`\n   * @return {Object} Returns the instance for chaining.\n   * @api public\n   */\n\n  set(key, ...rest) {\n    if (isObject(key) || (rest.length === 0 && Array.isArray(key))) {\n      return this.visit('set', key, ...rest);\n    }\n    if (Array.isArray(key)) key = key.join('.');\n    set(this[this.prop], key, ...rest);\n    this.emit('set', key, ...rest);\n    return this;\n  }\n\n  /**\n   * Return the value of `key`.\n   *\n   * ```js\n   * app.set('a.b.c', 'd');\n   * app.get('a.b');\n   * //=> { c: 'd' }\n   * ```\n   * @name .get\n   * @emits `get` with `key` and `value` as arguments.\n   * @param {String|Array} `key` The name of the property to get. Dot-notation may be used to set nested properties.\n   * @return {any} Returns the value of `key`\n   * @api public\n   */\n\n  get(key) {\n    if (Array.isArray(key)) key = key.join('.');\n    let val = get(this[this.prop], key);\n\n    if (typeof val === 'undefined' && this.defaults) {\n      val = get(this.defaults, key);\n    }\n\n    this.emit('get', key, val);\n    return val;\n  }\n\n  /**\n   * Create a property on the cache with the given `value` only if it doesn't\n   * already exist.\n   *\n   * ```js\n   * console.log(app.cache); //=> {}\n   * app.set('one', { foo: 'bar' });\n   * app.prime('one', { a: 'b' });\n   * app.prime('two', { c: 'd' });\n   * console.log(app.cache.one); //=> { foo: 'bar' }\n   * console.log(app.cache.two); //=> { c: 'd' }\n   * ```\n   * @name .prime\n   * @param {String} `key` Property name or object path notation.\n   * @param {any} `val`\n   * @return {Object} Returns the instance for chaining.\n   * @api public\n   */\n\n  prime(key, ...rest) {\n    if (isObject(key) || (rest.length === 0 && Array.isArray(key))) {\n      return this.visit('prime', key, ...rest);\n    }\n    if (Array.isArray(key)) key = key.join('.');\n    if (!this.has(key)) {\n      this.set(key, ...rest);\n    }\n    return this;\n  }\n\n  /**\n   * Set a default value to be used when `.get()` is called and the value is not defined\n   * on the cache. Returns a value from the defaults when only a key is passed.\n   *\n   * ```js\n   * app.set('foo', 'xxx');\n   * app.default('foo', 'one');\n   * app.default('bar', 'two');\n   * app.default('baz', 'three');\n   * app.set('baz', 'zzz');\n   *\n   * console.log(app.get('foo'));\n   * //=> 'xxx'\n   *\n   * console.log(app.get('bar'));\n   * //=> 'two'\n   *\n   * console.log(app.get('baz'));\n   * //=> 'zzz'\n   *\n   * console.log(app);\n   * // CacheBase {\n   * //   cache: { foo: 'xxx', bar: 'two', baz: 'zzz' },\n   * //   defaults: { foo: 'one', bar: 'two', baz: 'three' } }\n   * ```\n   * @name .default\n   * @param {String|Array} `key` The name of the property to set. Dot-notation may be used to set nested properties.\n   * @param {any} `value` (optional) The value to set on the defaults object.\n   * @return {Object} Returns the instance for chaining.\n   * @api public\n   */\n\n  default(key, ...rest) {\n    this.defaults = this.defaults || {};\n\n    if (isObject(key) || (rest.length === 0 && Array.isArray(key))) {\n      return this.visit('default', key, ...rest);\n    }\n\n    if (Array.isArray(key)) key = key.join('.');\n    if (!isString(key)) {\n      throw new TypeError('expected \"key\" to be a string, object or array');\n    }\n\n    if (rest.length === 0) {\n      return get(this.defaults, key);\n    }\n\n    set(this.defaults, key, ...rest);\n    this.emit('default', key, rest);\n    return this;\n  }\n\n  /**\n   * Set an array of unique values on cache `key`.\n   *\n   * ```js\n   * app.union('a.b.c', 'foo');\n   * app.union('a.b.c', 'bar');\n   * app.union('a.b.c', ['bar', 'baz']);\n   * console.log(app.get('a'));\n   * //=> { b: { c: ['foo', 'bar', 'baz'] } }\n   * ```\n   * @name .union\n   * @param {String|Array} `key` The name of the property to union. Dot-notation may be used to set nested properties.\n   * @param {any} `value`\n   * @return {Object} Returns the instance for chaining.\n   * @api public\n   */\n\n  union(key, ...rest) {\n    if (Array.isArray(key)) key = key.join('.');\n    union(this[this.prop], key, ...rest);\n    this.emit('union', ...rest);\n    return this;\n  }\n\n  /**\n   * Return true if the value of property `key` is not `undefined`.\n   *\n   * ```js\n   * app.set('foo', true);\n   * app.set('baz', null);\n   * app.set('bar', undefined);\n   *\n   * app.has('foo'); //=> true\n   * app.has('bar'); //=> true\n   * app.has('baz'); //=> false\n   * ```\n   * @name .has\n   * @param {String|Array} `key` The name of the property to check. Dot-notation may be used to set nested properties.\n   * @return {Boolean}\n   * @api public\n   */\n\n  has(key) {\n    if (Array.isArray(key)) key = key.join('.');\n    return typeof get(this[this.prop], key) !== 'undefined';\n  }\n\n  /**\n   * Returns true if the specified property is an own (not inherited) property.\n   * Similar to [.has()](#has), but returns true if the key exists, even if the\n   * value is `undefined`.\n   *\n   * ```js\n   * app.set('a.b.c', 'd');\n   * app.set('x', false);\n   * app.set('y', null);\n   * app.set('z', undefined);\n   *\n   * app.hasOwn('a');      //=> true\n   * app.hasOwn('b');      //=> true\n   * app.hasOwn('c');      //=> true\n   * app.hasOwn('a.b.c');  //=> true\n   * app.hasOwn('x');      //=> true\n   * app.hasOwn('y');      //=> true\n   * app.hasOwn('z');      //=> true\n   * app.hasOwn('lslsls'); //=> false\n   * ```\n   * @name .hasOwn\n   * @param  {String} `key`\n   * @return {Boolean} Returns true if object `key` exists. Dot-notation may be used to set nested properties.\n   * @api public\n   */\n\n  hasOwn(key) {\n    if (Array.isArray(key)) key = key.join('.');\n    return hasOwn(this[this.prop], key);\n  }\n\n  /**\n   * Delete one or more properties from the instance.\n   *\n   * ```js\n   * // setup a listener to update a property with a default\n   * // value when it's deleted by the user\n   * app.on('del', key => app.set(key, app.default(key)));\n   *\n   * app.del(); // delete all properties on the cache\n   * // or\n   * app.del('foo');\n   * // or an array of keys\n   * app.del(['foo', 'bar']);\n   * ```\n   * @name .del\n   * @emits `del` with the `key` as the only argument.\n   * @param {string} `key` The name of the property to delete. Dot-notation may be used to delete nested properties. This method does not accept key as an array.\n   * @return {Object} Returns the instance for chaining.\n   * @api public\n   */\n\n  del(key) {\n    if (!key) return this.clear();\n    del(this[this.prop], key);\n    this.emit('del', key);\n    return this;\n  }\n\n  /**\n   * Reset the entire cache to an empty object. Note that this does not also clear the `defaults`\n   * object, since you can manually do `cache.defaults = {}` if you want to reset that object as well.\n   *\n   * ```js\n   * // clear \"defaults\" whenever the cache is cleared\n   * app.on('clear', key => (app.defaults = {}));\n   * app.clear();\n   * ```\n   * @name .clear\n   * @api public\n   */\n\n  clear() {\n    this[this.prop] = {};\n    this.emit('clear');\n    return this;\n  }\n\n  /**\n   * Visit (or map visit) the specified method (`key`) over the properties in the\n   * given object or array.\n   *\n   * @name .visit\n   * @param {String|Array} `key` The name of the method to visit.\n   * @param {Object|Array} `val` The object or array to iterate over.\n   * @return {Object} Returns the instance for chaining.\n   * @api public\n   */\n\n  visit(key, ...rest) {\n    visit(this, key, ...rest);\n    return this;\n  }\n\n  /**\n   * Gets an array of names of all enumerable properties on the cache.\n   *\n   * ```js\n   * const app = new CacheBase();\n   * app.set('user', true);\n   * app.set('admin', false);\n   *\n   * console.log(app.keys);\n   * //=> ['user', 'admin']\n   * ```\n   * @name .keys\n   * @api public\n   */\n\n  get keys() {\n    return Object.keys(this[this.prop]);\n  }\n\n  /**\n   * Gets the length of [keys](#keys).\n   *\n   * ```js\n   * const app = new CacheBase();\n   * app.set('user', true);\n   * app.set('admin', false);\n   *\n   * console.log(app.size);\n   * //=> 2\n   * ```\n   * @name .size\n   * @api public\n   */\n\n  get size() {\n    return this.keys.length;\n  }\n}\n\n/**\n * Returns true if `value` is a non-empty string.\n */\n\nfunction isString(value) {\n  return typeof value === 'string' && value !== '';\n}\n\n/**\n * Returns true if `value` is an object\n */\n\nfunction isObject(value) {\n  return typeOf(value) === 'object';\n}\n\n/**\n * Expose `CacheBase`\n */\n\nmodule.exports = CacheBase;\n"]}