hexo/node_modules/moize/dist/moize.min.js.map

1 line
68 KiB
Plaintext

{"version":3,"file":"moize.min.js","sources":["../src/constants.ts","../src/utils.ts","../src/maxAge.ts","../src/stats.ts","../src/instance.ts","../src/component.ts","../src/serialize.ts","../src/options.ts","../src/maxArgs.ts","../src/index.ts","../src/updateCacheForKey.ts"],"sourcesContent":["import type { AnyFn, Options } from '../index.d';\n\n/**\n * @private\n *\n * @constant DEFAULT_OPTIONS\n */\nexport const DEFAULT_OPTIONS: Options<AnyFn> = {\n isDeepEqual: false,\n isPromise: false,\n isReact: false,\n isSerialized: false,\n isShallowEqual: false,\n matchesArg: undefined,\n matchesKey: undefined,\n maxAge: undefined,\n maxArgs: undefined,\n maxSize: 1,\n onExpire: undefined,\n profileName: undefined,\n serializer: undefined,\n updateCacheForKey: undefined,\n transformArgs: undefined,\n updateExpire: false,\n};\n","import { DEFAULT_OPTIONS } from './constants';\n\nimport type {\n AnyFn,\n Expiration,\n IsEqual,\n IsMatchingKey,\n Key,\n Moizeable,\n Moized,\n Options,\n} from '../index.d';\n\n/**\n * @private\n *\n * @description\n * method to combine functions and return a single function that fires them all\n *\n * @param functions the functions to compose\n * @returns the composed function\n */\nexport function combine<Args extends any[], Result>(\n ...functions: Array<(...args: Args) => any>\n): ((...args: Args) => Result) | undefined {\n return functions.reduce(function (f: any, g: any) {\n if (typeof f === 'function') {\n return typeof g === 'function'\n ? function (this: any) {\n f.apply(this, arguments);\n g.apply(this, arguments);\n }\n : f;\n }\n\n if (typeof g === 'function') {\n return g;\n }\n });\n}\n\n/**\n * @private\n *\n * @description\n * method to compose functions and return a single function\n *\n * @param functions the functions to compose\n * @returns the composed function\n */\nexport function compose<Method>(...functions: Method[]): Method {\n return functions.reduce(function (f: any, g: any) {\n if (typeof f === 'function') {\n return typeof g === 'function'\n ? function (this: any) {\n return f(g.apply(this, arguments));\n }\n : f;\n }\n\n if (typeof g === 'function') {\n return g;\n }\n });\n}\n\n/**\n * @private\n *\n * @description\n * find the index of the expiration based on the key\n *\n * @param expirations the list of expirations\n * @param key the key to match\n * @returns the index of the expiration\n */\nexport function findExpirationIndex(expirations: Expiration[], key: Key) {\n for (let index = 0; index < expirations.length; index++) {\n if (expirations[index].key === key) {\n return index;\n }\n }\n\n return -1;\n}\n\n/**\n * @private\n *\n * @description\n * create function that finds the index of the key in the list of cache keys\n *\n * @param isEqual the function to test individual argument equality\n * @param isMatchingKey the function to test full key equality\n * @returns the function that finds the index of the key\n */\nexport function createFindKeyIndex(\n isEqual: IsEqual,\n isMatchingKey: IsMatchingKey | undefined\n) {\n const areKeysEqual: IsMatchingKey =\n typeof isMatchingKey === 'function'\n ? isMatchingKey\n : function (cacheKey: Key, key: Key) {\n for (let index = 0; index < key.length; index++) {\n if (!isEqual(cacheKey[index], key[index])) {\n return false;\n }\n }\n\n return true;\n };\n\n return function (keys: Key[], key: Key) {\n for (let keysIndex = 0; keysIndex < keys.length; keysIndex++) {\n if (\n keys[keysIndex].length === key.length &&\n areKeysEqual(keys[keysIndex], key)\n ) {\n return keysIndex;\n }\n }\n\n return -1;\n };\n}\n\ntype MergedOptions<\n OriginalOptions extends Options<Moizeable>,\n NewOptions extends Options<Moizeable>\n> = Omit<OriginalOptions, keyof NewOptions> & NewOptions;\n\n/**\n * @private\n *\n * @description\n * merge two options objects, combining or composing functions as necessary\n *\n * @param originalOptions the options that already exist on the method\n * @param newOptions the new options to merge\n * @returns the merged options\n */\nexport function mergeOptions<\n OriginalOptions extends Options<Moizeable>,\n NewOptions extends Options<Moizeable>\n>(\n originalOptions: OriginalOptions,\n newOptions: NewOptions | undefined\n): MergedOptions<OriginalOptions, NewOptions> {\n if (!newOptions || newOptions === DEFAULT_OPTIONS) {\n return originalOptions as unknown as MergedOptions<\n OriginalOptions,\n NewOptions\n >;\n }\n\n return {\n ...originalOptions,\n ...newOptions,\n onCacheAdd: combine(originalOptions.onCacheAdd, newOptions.onCacheAdd),\n onCacheChange: combine(\n originalOptions.onCacheChange,\n newOptions.onCacheChange\n ),\n onCacheHit: combine(originalOptions.onCacheHit, newOptions.onCacheHit),\n transformArgs: compose(\n originalOptions.transformArgs,\n newOptions.transformArgs\n ),\n };\n}\n\nexport function isMoized(\n fn: Moizeable | Moized | Options<AnyFn>\n): fn is Moized {\n return typeof fn === 'function' && (fn as Moizeable).isMoized;\n}\n\nexport function setName(\n fn: Moized,\n originalFunctionName: string,\n profileName: string\n) {\n try {\n const name = profileName || originalFunctionName || 'anonymous';\n\n Object.defineProperty(fn, 'name', {\n configurable: true,\n enumerable: false,\n value: `moized(${name})`,\n writable: true,\n });\n } catch {\n // For engines where `function.name` is not configurable, do nothing.\n }\n}\n","import { createFindKeyIndex, findExpirationIndex } from './utils';\n\nimport type {\n AnyFn,\n Cache,\n Expiration,\n IsEqual,\n IsMatchingKey,\n Key,\n OnCacheOperation,\n Options,\n} from '../index.d';\n\n/**\n * @private\n *\n * @description\n * clear an active expiration and remove it from the list if applicable\n *\n * @param expirations the list of expirations\n * @param key the key to clear\n * @param shouldRemove should the expiration be removed from the list\n */\nexport function clearExpiration(\n expirations: Expiration[],\n key: Key,\n shouldRemove?: boolean\n) {\n const expirationIndex = findExpirationIndex(expirations, key);\n\n if (expirationIndex !== -1) {\n clearTimeout(expirations[expirationIndex].timeoutId);\n\n if (shouldRemove) {\n expirations.splice(expirationIndex, 1);\n }\n }\n}\n\n/**\n * @private\n *\n * @description\n * Create the timeout for the given expiration method. If the ability to `unref`\n * exists, then apply it to avoid process locks in NodeJS.\n *\n * @param expirationMethod the method to fire upon expiration\n * @param maxAge the time to expire after\n * @returns the timeout ID\n */\nexport function createTimeout(expirationMethod: () => void, maxAge: number) {\n const timeoutId = setTimeout(expirationMethod, maxAge);\n\n if (typeof timeoutId.unref === 'function') {\n timeoutId.unref();\n }\n\n return timeoutId;\n}\n\n/**\n * @private\n *\n * @description\n * create a function that, when an item is added to the cache, adds an expiration for it\n *\n * @param expirations the mutable expirations array\n * @param options the options passed on initialization\n * @param isEqual the function to check argument equality\n * @param isMatchingKey the function to check complete key equality\n * @returns the onCacheAdd function to handle expirations\n */\nexport function createOnCacheAddSetExpiration<MoizeableFn extends AnyFn>(\n expirations: Expiration[],\n options: Options<MoizeableFn>,\n isEqual: IsEqual,\n isMatchingKey: IsMatchingKey\n): OnCacheOperation<MoizeableFn> {\n const { maxAge } = options;\n\n return function onCacheAdd(\n cache: Cache<MoizeableFn>,\n moizedOptions: Options<MoizeableFn>,\n moized: MoizeableFn\n ) {\n const key: any = cache.keys[0];\n\n if (findExpirationIndex(expirations, key) === -1) {\n const expirationMethod = function () {\n const findKeyIndex = createFindKeyIndex(isEqual, isMatchingKey);\n\n const keyIndex: number = findKeyIndex(cache.keys, key);\n const value: any = cache.values[keyIndex];\n\n if (~keyIndex) {\n cache.keys.splice(keyIndex, 1);\n cache.values.splice(keyIndex, 1);\n\n if (typeof options.onCacheChange === 'function') {\n options.onCacheChange(cache, moizedOptions, moized);\n }\n }\n\n clearExpiration(expirations, key, true);\n\n if (\n typeof options.onExpire === 'function' &&\n options.onExpire(key) === false\n ) {\n cache.keys.unshift(key);\n cache.values.unshift(value);\n\n onCacheAdd(cache, moizedOptions, moized);\n\n if (typeof options.onCacheChange === 'function') {\n options.onCacheChange(cache, moizedOptions, moized);\n }\n }\n };\n\n expirations.push({\n expirationMethod,\n key,\n timeoutId: createTimeout(expirationMethod, maxAge),\n });\n }\n };\n}\n\n/**\n * @private\n *\n * @description\n * creates a function that, when a cache item is hit, reset the expiration\n *\n * @param expirations the mutable expirations array\n * @param options the options passed on initialization\n * @returns the onCacheAdd function to handle expirations\n */\nexport function createOnCacheHitResetExpiration<MoizeableFn extends AnyFn>(\n expirations: Expiration[],\n options: Options<MoizeableFn>\n): OnCacheOperation<MoizeableFn> {\n return function onCacheHit(cache: Cache<MoizeableFn>) {\n const key = cache.keys[0];\n const expirationIndex = findExpirationIndex(expirations, key);\n\n if (~expirationIndex) {\n clearExpiration(expirations, key, false);\n\n expirations[expirationIndex].timeoutId = createTimeout(\n expirations[expirationIndex].expirationMethod,\n options.maxAge\n );\n }\n };\n}\n\n/**\n * @private\n *\n * @description\n * get the micro-memoize options specific to the maxAge option\n *\n * @param expirations the expirations for the memoized function\n * @param options the options passed to the moizer\n * @param isEqual the function to test equality of the key on a per-argument basis\n * @param isMatchingKey the function to test equality of the whole key\n * @returns the object of options based on the entries passed\n */\nexport function getMaxAgeOptions<MoizeableFn extends AnyFn>(\n expirations: Expiration[],\n options: Options<MoizeableFn>,\n isEqual: IsEqual,\n isMatchingKey: IsMatchingKey\n): {\n onCacheAdd: OnCacheOperation<MoizeableFn> | undefined;\n onCacheHit: OnCacheOperation<MoizeableFn> | undefined;\n} {\n const onCacheAdd =\n typeof options.maxAge === 'number' && isFinite(options.maxAge)\n ? createOnCacheAddSetExpiration(\n expirations,\n options,\n isEqual,\n isMatchingKey\n )\n : undefined;\n\n return {\n onCacheAdd,\n onCacheHit:\n onCacheAdd && options.updateExpire\n ? createOnCacheHitResetExpiration(expirations, options)\n : undefined,\n };\n}\n","import type {\n GlobalStatsObject,\n Moizeable,\n OnCacheOperation,\n Options,\n StatsCache,\n StatsProfile,\n} from '../index.d';\n\nexport const statsCache: StatsCache = {\n anonymousProfileNameCounter: 1,\n isCollectingStats: false,\n profiles: {},\n};\n\nlet hasWarningDisplayed = false;\n\nexport function clearStats(profileName?: string) {\n if (profileName) {\n delete statsCache.profiles[profileName];\n } else {\n statsCache.profiles = {};\n }\n}\n\n/**\n * @private\n *\n * @description\n * activate stats collection\n *\n * @param isCollectingStats should stats be collected\n */\nexport function collectStats(isCollectingStats = true) {\n statsCache.isCollectingStats = isCollectingStats;\n}\n\n/**\n * @private\n *\n * @description\n * create a function that increments the number of calls for the specific profile\n */\nexport function createOnCacheAddIncrementCalls<MoizeableFn extends Moizeable>(\n options: Options<MoizeableFn>\n) {\n const { profileName } = options;\n\n return function () {\n if (profileName && !statsCache.profiles[profileName]) {\n statsCache.profiles[profileName] = {\n calls: 0,\n hits: 0,\n };\n }\n\n statsCache.profiles[profileName].calls++;\n };\n}\n\n/**\n * @private\n *\n * @description\n * create a function that increments the number of calls and cache hits for the specific profile\n */\nexport function createOnCacheHitIncrementCallsAndHits<\n MoizeableFn extends Moizeable\n>(options: Options<MoizeableFn>) {\n return function () {\n const { profiles } = statsCache;\n const { profileName } = options;\n\n if (!profiles[profileName]) {\n profiles[profileName] = {\n calls: 0,\n hits: 0,\n };\n }\n\n profiles[profileName].calls++;\n profiles[profileName].hits++;\n };\n}\n\n/**\n * @private\n *\n * @description\n * get the profileName for the function when one is not provided\n *\n * @param fn the function to be memoized\n * @returns the derived profileName for the function\n */\nexport function getDefaultProfileName<MoizeableFn extends Moizeable>(\n fn: MoizeableFn\n) {\n return (\n fn.displayName ||\n fn.name ||\n `Anonymous ${statsCache.anonymousProfileNameCounter++}`\n );\n}\n\n/**\n * @private\n *\n * @description\n * get the usage percentage based on the number of hits and total calls\n *\n * @param calls the number of calls made\n * @param hits the number of cache hits when called\n * @returns the usage as a percentage string\n */\nexport function getUsagePercentage(calls: number, hits: number) {\n return calls ? `${((hits / calls) * 100).toFixed(4)}%` : '0.0000%';\n}\n\n/**\n * @private\n *\n * @description\n * get the statistics for a given method or all methods\n *\n * @param [profileName] the profileName to get the statistics for (get all when not provided)\n * @returns the object with stats information\n */\nexport function getStats(profileName?: string): GlobalStatsObject {\n if (!statsCache.isCollectingStats && !hasWarningDisplayed) {\n console.warn(\n 'Stats are not currently being collected, please run \"collectStats\" to enable them.'\n ); // eslint-disable-line no-console\n\n hasWarningDisplayed = true;\n }\n\n const { profiles } = statsCache;\n\n if (profileName) {\n if (!profiles[profileName]) {\n return {\n calls: 0,\n hits: 0,\n usage: '0.0000%',\n };\n }\n\n const { [profileName]: profile } = profiles;\n\n return {\n ...profile,\n usage: getUsagePercentage(profile.calls, profile.hits),\n };\n }\n\n const completeStats: StatsProfile = Object.keys(statsCache.profiles).reduce(\n (completeProfiles, profileName) => {\n completeProfiles.calls += profiles[profileName].calls;\n completeProfiles.hits += profiles[profileName].hits;\n\n return completeProfiles;\n },\n {\n calls: 0,\n hits: 0,\n }\n );\n\n return {\n ...completeStats,\n profiles: Object.keys(profiles).reduce(\n (computedProfiles, profileName) => {\n computedProfiles[profileName] = getStats(profileName);\n\n return computedProfiles;\n },\n {} as Record<string, StatsProfile>\n ),\n usage: getUsagePercentage(completeStats.calls, completeStats.hits),\n };\n}\n\n/**\n * @private\n *\n * @function getStatsOptions\n *\n * @description\n * get the options specific to storing statistics\n *\n * @param {Options} options the options passed to the moizer\n * @returns {Object} the options specific to keeping stats\n */\nexport function getStatsOptions<MoizeableFn extends Moizeable>(\n options: Options<MoizeableFn>\n): {\n onCacheAdd?: OnCacheOperation<MoizeableFn>;\n onCacheHit?: OnCacheOperation<MoizeableFn>;\n} {\n return statsCache.isCollectingStats\n ? {\n onCacheAdd: createOnCacheAddIncrementCalls(options),\n onCacheHit: createOnCacheHitIncrementCallsAndHits(options),\n }\n : {};\n}\n","import { clearExpiration } from './maxAge';\nimport { clearStats, getStats } from './stats';\nimport { createFindKeyIndex } from './utils';\n\nimport type {\n Key,\n Memoized,\n Moizeable,\n MoizeConfiguration,\n Moized,\n Options,\n StatsProfile,\n} from '../index.d';\n\nconst ALWAYS_SKIPPED_PROPERTIES: Record<string, boolean> = {\n arguments: true,\n callee: true,\n caller: true,\n constructor: true,\n length: true,\n name: true,\n prototype: true,\n};\n\n/**\n * @private\n *\n * @description\n * copy the static properties from the original function to the moized\n * function\n *\n * @param originalFn the function copying from\n * @param newFn the function copying to\n * @param skippedProperties the list of skipped properties, if any\n */\nexport function copyStaticProperties<\n OriginalMoizeableFn extends Moizeable,\n NewMoizeableFn extends Moizeable\n>(\n originalFn: OriginalMoizeableFn,\n newFn: NewMoizeableFn,\n skippedProperties: string[] = []\n) {\n Object.getOwnPropertyNames(originalFn).forEach((property) => {\n if (\n !ALWAYS_SKIPPED_PROPERTIES[property] &&\n skippedProperties.indexOf(property) === -1\n ) {\n const descriptor = Object.getOwnPropertyDescriptor(\n originalFn,\n property\n );\n\n if (descriptor.get || descriptor.set) {\n Object.defineProperty(newFn, property, descriptor);\n } else {\n // @ts-expect-error - properites may not align\n newFn[property] = originalFn[property];\n }\n }\n });\n}\n\n/**\n * @private\n *\n * @description\n * add methods to the moized fuction object that allow extra features\n *\n * @param memoized the memoized function from micro-memoize\n */\nexport function addInstanceMethods<MoizeableFn extends Moizeable>(\n memoized: Moizeable,\n { expirations }: MoizeConfiguration<MoizeableFn>\n) {\n const { options } = memoized;\n\n const findKeyIndex = createFindKeyIndex(\n options.isEqual,\n options.isMatchingKey\n );\n\n const moized = memoized as unknown as Moized<\n MoizeableFn,\n Options<MoizeableFn>\n >;\n\n moized.clear = function () {\n const {\n _microMemoizeOptions: { onCacheChange },\n cache,\n } = moized;\n\n cache.keys.length = 0;\n cache.values.length = 0;\n\n if (onCacheChange) {\n onCacheChange(cache, moized.options, moized);\n }\n\n return true;\n };\n\n moized.clearStats = function () {\n clearStats(moized.options.profileName);\n };\n\n moized.get = function (key: Key) {\n const {\n _microMemoizeOptions: { transformKey },\n cache,\n } = moized;\n\n const cacheKey = transformKey ? transformKey(key) : key;\n const keyIndex = findKeyIndex(cache.keys, cacheKey);\n\n return keyIndex !== -1 ? moized.apply(this, key) : undefined;\n };\n\n moized.getStats = function (): StatsProfile {\n return getStats(moized.options.profileName);\n };\n\n moized.has = function (key: Key) {\n const { transformKey } = moized._microMemoizeOptions;\n\n const cacheKey = transformKey ? transformKey(key) : key;\n\n return findKeyIndex(moized.cache.keys, cacheKey) !== -1;\n };\n\n moized.keys = function () {\n return moized.cacheSnapshot.keys;\n };\n\n moized.remove = function (key: Key) {\n const {\n _microMemoizeOptions: { onCacheChange, transformKey },\n cache,\n } = moized;\n\n const keyIndex = findKeyIndex(\n cache.keys,\n transformKey ? transformKey(key) : key\n );\n\n if (keyIndex === -1) {\n return false;\n }\n\n const existingKey = cache.keys[keyIndex];\n\n cache.keys.splice(keyIndex, 1);\n cache.values.splice(keyIndex, 1);\n\n if (onCacheChange) {\n onCacheChange(cache, moized.options, moized);\n }\n\n clearExpiration(expirations, existingKey, true);\n\n return true;\n };\n\n moized.set = function (key: Key, value: any) {\n const { _microMemoizeOptions, cache, options } = moized;\n const { onCacheAdd, onCacheChange, transformKey } =\n _microMemoizeOptions;\n\n const cacheKey = transformKey ? transformKey(key) : key;\n const keyIndex = findKeyIndex(cache.keys, cacheKey);\n\n if (keyIndex === -1) {\n const cutoff = options.maxSize - 1;\n\n if (cache.size > cutoff) {\n cache.keys.length = cutoff;\n cache.values.length = cutoff;\n }\n\n cache.keys.unshift(cacheKey);\n cache.values.unshift(value);\n\n if (options.isPromise) {\n cache.updateAsyncCache(moized);\n }\n\n if (onCacheAdd) {\n onCacheAdd(cache, options, moized);\n }\n\n if (onCacheChange) {\n onCacheChange(cache, options, moized);\n }\n } else {\n const existingKey = cache.keys[keyIndex];\n\n cache.values[keyIndex] = value;\n\n if (keyIndex > 0) {\n cache.orderByLru(existingKey, value, keyIndex);\n }\n\n if (options.isPromise) {\n cache.updateAsyncCache(moized);\n }\n\n if (typeof onCacheChange === 'function') {\n onCacheChange(cache, options, moized);\n }\n }\n };\n\n moized.values = function () {\n return moized.cacheSnapshot.values;\n };\n}\n\n/**\n * @private\n *\n * @description\n * add propeties to the moized fuction object that surfaces extra information\n *\n * @param memoized the memoized function\n * @param expirations the list of expirations for cache items\n * @param options the options passed to the moizer\n * @param originalFunction the function that is being memoized\n */\nexport function addInstanceProperties<MoizeableFn extends Moizeable>(\n memoized: Memoized<MoizeableFn>,\n {\n expirations,\n options: moizeOptions,\n originalFunction,\n }: MoizeConfiguration<MoizeableFn>\n) {\n const { options: microMemoizeOptions } = memoized;\n\n Object.defineProperties(memoized, {\n _microMemoizeOptions: {\n configurable: true,\n get() {\n return microMemoizeOptions;\n },\n },\n\n cacheSnapshot: {\n configurable: true,\n get() {\n const { cache: currentCache } = memoized;\n\n return {\n keys: currentCache.keys.slice(0),\n size: currentCache.size,\n values: currentCache.values.slice(0),\n };\n },\n },\n\n expirations: {\n configurable: true,\n get() {\n return expirations;\n },\n },\n\n expirationsSnapshot: {\n configurable: true,\n get() {\n return expirations.slice(0);\n },\n },\n\n isMoized: {\n configurable: true,\n get() {\n return true;\n },\n },\n\n options: {\n configurable: true,\n get() {\n return moizeOptions;\n },\n },\n\n originalFunction: {\n configurable: true,\n get() {\n return originalFunction;\n },\n },\n });\n\n const moized = memoized as unknown as Moized<\n MoizeableFn,\n Options<MoizeableFn>\n >;\n\n copyStaticProperties(originalFunction, moized);\n}\n\n/**\n * @private\n *\n * @description\n * add methods and properties to the memoized function for more features\n *\n * @param memoized the memoized function\n * @param configuration the configuration object for the instance\n * @returns the memoized function passed\n */\nexport function createMoizeInstance<\n MoizeableFn extends Moizeable,\n CombinedOptions extends Options<MoizeableFn>\n>(\n memoized: Memoized<MoizeableFn>,\n configuration: MoizeConfiguration<MoizeableFn>\n) {\n addInstanceMethods<MoizeableFn>(memoized, configuration);\n addInstanceProperties<MoizeableFn>(memoized, configuration);\n\n return memoized as Moized<MoizeableFn, CombinedOptions>;\n}\n","import { copyStaticProperties } from './instance';\nimport { setName } from './utils';\n\nimport type {\n Moize,\n Moized as MoizedFunction,\n Moizeable,\n Options,\n} from '../index.d';\n\n// This was stolen from React internals, which allows us to create React elements without needing\n// a dependency on the React library itself.\nconst REACT_ELEMENT_TYPE =\n typeof Symbol === 'function' && Symbol.for\n ? Symbol.for('react.element')\n : 0xeac7;\n\n/**\n * @private\n *\n * @description\n * Create a component that memoizes based on `props` and legacy `context`\n * on a per-instance basis. This requires creating a component class to\n * store the memoized function. The cost is quite low, and avoids the\n * need to have access to the React dependency by basically re-creating\n * the basic essentials for a component class and the results of the\n * `createElement` function.\n *\n * @param moizer the top-level moize method\n * @param fn the component to memoize\n * @param options the memoization options\n * @returns the memoized component\n */\nexport function createMoizedComponent<MoizeableFn extends Moizeable>(\n moizer: Moize,\n fn: MoizeableFn,\n options: Options<MoizeableFn>\n) {\n /**\n * This is a hack override setting the necessary options\n * for a React component to be memoized. In the main `moize`\n * method, if the `isReact` option is set it is short-circuited\n * to call this function, and these overrides allow the\n * necessary transformKey method to be derived.\n *\n * The order is based on:\n * 1) Set the necessary aspects of transformKey for React components.\n * 2) Allow setting of other options and overrides of those aspects\n * if desired (for example, `isDeepEqual` will use deep equality).\n * 3) Always set `isReact` to false to prevent infinite loop.\n */\n const reactMoizer = moizer({\n maxArgs: 2,\n isShallowEqual: true,\n ...options,\n isReact: false,\n });\n\n if (!fn.displayName) {\n // @ts-ignore - allow setting of displayName\n fn.displayName = fn.name || 'Component';\n }\n\n function Moized<Props extends Record<string, unknown>, Context, Updater>(\n this: any,\n props: Props,\n context: Context,\n updater: Updater\n ) {\n this.props = props;\n this.context = context;\n this.updater = updater;\n\n this.MoizedComponent = reactMoizer(fn);\n }\n\n Moized.prototype.isReactComponent = {};\n\n Moized.prototype.render = function (): ReturnType<MoizeableFn> {\n return {\n $$typeof: REACT_ELEMENT_TYPE,\n type: this.MoizedComponent,\n props: this.props,\n ref: null,\n key: null,\n _owner: null,\n } as ReturnType<MoizeableFn>;\n };\n\n copyStaticProperties(fn, Moized, ['contextType', 'contextTypes']);\n\n Moized.displayName = `Moized(${fn.displayName || fn.name || 'Component'})`;\n\n setName(Moized as MoizedFunction, fn.name, options.profileName);\n\n return Moized;\n}\n","import type { Key, Moizeable, Options } from '../index.d';\n\n/**\n * @function getCutoff\n *\n * @description\n * faster `Array.prototype.indexOf` implementation build for slicing / splicing\n *\n * @param array the array to match the value in\n * @param value the value to match\n * @returns the matching index, or -1\n */\nfunction getCutoff(array: any[], value: any) {\n const { length } = array;\n\n for (let index = 0; index < length; ++index) {\n if (array[index] === value) {\n return index + 1;\n }\n }\n\n return 0;\n}\n\n/**\n * @private\n *\n * @description\n * custom replacer for the stringify function\n *\n * @returns if function then toString of it, else the value itself\n */\nexport function createDefaultReplacer() {\n const cache: any[] = [];\n const keys: string[] = [];\n\n return function defaultReplacer(key: string, value: any) {\n const type = typeof value;\n\n if (type === 'function' || type === 'symbol') {\n return value.toString();\n }\n\n if (typeof value === 'object') {\n if (cache.length) {\n const thisCutoff = getCutoff(cache, this);\n\n if (thisCutoff === 0) {\n cache[cache.length] = this;\n } else {\n cache.splice(thisCutoff);\n keys.splice(thisCutoff);\n }\n\n keys[keys.length] = key;\n\n const valueCutoff = getCutoff(cache, value);\n\n if (valueCutoff !== 0) {\n return `[ref=${\n keys.slice(0, valueCutoff).join('.') || '.'\n }]`;\n }\n } else {\n cache[0] = value;\n keys[0] = key;\n }\n\n return value;\n }\n\n return '' + value;\n };\n}\n\n/**\n * @private\n *\n * @description\n * get the stringified version of the argument passed\n *\n * @param arg argument to stringify\n * @returns the stringified argument\n */\nexport function getStringifiedArgument<Type>(arg: Type) {\n const typeOfArg = typeof arg;\n\n return arg && (typeOfArg === 'object' || typeOfArg === 'function')\n ? JSON.stringify(arg, createDefaultReplacer())\n : arg;\n}\n\n/**\n * @private\n *\n * @description\n * serialize the arguments passed\n *\n * @param options the options passed to the moizer\n * @param options.maxArgs the cap on the number of arguments used in serialization\n * @returns argument serialization method\n */\nexport function defaultArgumentSerializer(args: Key) {\n let key = '|';\n\n for (let index = 0; index < args.length; index++) {\n key += getStringifiedArgument(args[index]) + '|';\n }\n\n return [key];\n}\n\n/**\n * @private\n *\n * @description\n * based on the options passed, either use the serializer passed or generate the internal one\n *\n * @param options the options passed to the moized function\n * @returns the function to use in serializing the arguments\n */\nexport function getSerializerFunction<MoizeableFn extends Moizeable>(\n options: Options<MoizeableFn>\n) {\n return typeof options.serializer === 'function'\n ? options.serializer\n : defaultArgumentSerializer;\n}\n\n/**\n * @private\n *\n * @description\n * are the serialized keys equal to one another\n *\n * @param cacheKey the cache key to compare\n * @param key the key to test\n * @returns are the keys equal\n */\nexport function getIsSerializedKeyEqual(cacheKey: Key, key: Key) {\n return cacheKey[0] === key[0];\n}\n","import { deepEqual, sameValueZeroEqual, shallowEqual } from 'fast-equals';\nimport { createGetInitialArgs } from './maxArgs';\nimport { getIsSerializedKeyEqual, getSerializerFunction } from './serialize';\nimport { compose } from './utils';\n\nimport type {\n Cache,\n IsEqual,\n IsMatchingKey,\n MicroMemoizeOptions,\n Moizeable,\n Moized,\n OnCacheOperation,\n Options,\n TransformKey,\n} from '../index.d';\n\nexport function createOnCacheOperation<MoizeableFn extends Moizeable>(\n fn?: OnCacheOperation<MoizeableFn>\n): OnCacheOperation<MoizeableFn> {\n if (typeof fn === 'function') {\n return (\n _cacheIgnored: Cache<MoizeableFn>,\n _microMemoizeOptionsIgnored: MicroMemoizeOptions<MoizeableFn>,\n memoized: Moized\n ): void => fn(memoized.cache, memoized.options, memoized);\n }\n}\n\n/**\n * @private\n *\n * @description\n * get the isEqual method passed to micro-memoize\n *\n * @param options the options passed to the moizer\n * @returns the isEqual method to apply\n */\nexport function getIsEqual<MoizeableFn extends Moizeable>(\n options: Options<MoizeableFn>\n): IsEqual {\n return (\n options.matchesArg ||\n (options.isDeepEqual && deepEqual) ||\n (options.isShallowEqual && shallowEqual) ||\n sameValueZeroEqual\n );\n}\n\n/**\n * @private\n *\n * @description\n * get the isEqual method passed to micro-memoize\n *\n * @param options the options passed to the moizer\n * @returns the isEqual method to apply\n */\nexport function getIsMatchingKey<MoizeableFn extends Moizeable>(\n options: Options<MoizeableFn>\n): IsMatchingKey | undefined {\n return (\n options.matchesKey ||\n (options.isSerialized && getIsSerializedKeyEqual) ||\n undefined\n );\n}\n\n/**\n * @private\n *\n * @description\n * get the function that will transform the key based on the arguments passed\n *\n * @param options the options passed to the moizer\n * @returns the function to transform the key with\n */\nexport function getTransformKey<MoizeableFn extends Moizeable>(\n options: Options<MoizeableFn>\n): TransformKey | undefined {\n return compose(\n options.isSerialized && getSerializerFunction(options),\n typeof options.transformArgs === 'function' && options.transformArgs,\n typeof options.maxArgs === 'number' &&\n createGetInitialArgs(options.maxArgs)\n ) as TransformKey;\n}\n","import type { Key } from '../index.d';\n\nexport function createGetInitialArgs(size: number) {\n /**\n * @private\n *\n * @description\n * take the first N number of items from the array (faster than slice)\n *\n * @param args the args to take from\n * @returns the shortened list of args as an array\n */\n return function (args: Key): Key {\n if (size >= args.length) {\n return args;\n }\n\n if (size === 0) {\n return [];\n }\n\n if (size === 1) {\n return [args[0]];\n }\n\n if (size === 2) {\n return [args[0], args[1]];\n }\n\n if (size === 3) {\n return [args[0], args[1], args[2]];\n }\n\n const clone = [];\n\n for (let index = 0; index < size; index++) {\n clone[index] = args[index];\n }\n\n return clone;\n };\n}\n","import memoize from 'micro-memoize';\nimport { createMoizedComponent } from './component';\nimport { DEFAULT_OPTIONS } from './constants';\nimport { createMoizeInstance } from './instance';\nimport { getMaxAgeOptions } from './maxAge';\nimport {\n createOnCacheOperation,\n getIsEqual,\n getIsMatchingKey,\n getTransformKey,\n} from './options';\nimport {\n clearStats,\n collectStats,\n getDefaultProfileName,\n getStats,\n getStatsOptions,\n statsCache,\n} from './stats';\nimport { createRefreshableMoized } from './updateCacheForKey';\nimport { combine, compose, isMoized, mergeOptions, setName } from './utils';\n\nimport type {\n Expiration,\n IsEqual,\n IsMatchingKey,\n MicroMemoizeOptions,\n Moize,\n Moizeable,\n Moized,\n OnExpire,\n Options,\n Serialize,\n TransformKey,\n UpdateCacheForKey,\n} from '../index.d';\n\n/**\n * @module moize\n */\n\n/**\n * @description\n * memoize a function based its arguments passed, potentially improving runtime performance\n *\n * @example\n * import moize from 'moize';\n *\n * // standard implementation\n * const fn = (foo, bar) => `${foo} ${bar}`;\n * const memoizedFn = moize(fn);\n *\n * // implementation with options\n * const fn = async (id) => get(`http://foo.com/${id}`);\n * const memoizedFn = moize(fn, {isPromise: true, maxSize: 5});\n *\n * // implementation with convenience methods\n * const Foo = ({foo}) => <div>{foo}</div>;\n * const MemoizedFoo = moize.react(Foo);\n *\n * @param fn the function to memoized, or a list of options when currying\n * @param [options=DEFAULT_OPTIONS] the options to apply\n * @returns the memoized function\n */\nconst moize: Moize = function <\n MoizeableFn extends Moizeable,\n PassedOptions extends Options<MoizeableFn>\n>(fn: MoizeableFn | PassedOptions, passedOptions?: PassedOptions) {\n type CombinedOptions = Omit<Options<MoizeableFn>, keyof PassedOptions> &\n PassedOptions;\n\n const options: Options<MoizeableFn> = passedOptions || DEFAULT_OPTIONS;\n\n if (isMoized(fn)) {\n const moizeable = fn.originalFunction as MoizeableFn;\n const mergedOptions = mergeOptions(\n fn.options,\n options\n ) as CombinedOptions;\n\n return moize<MoizeableFn, CombinedOptions>(moizeable, mergedOptions);\n }\n\n if (typeof fn === 'object') {\n return function <\n CurriedFn extends Moizeable,\n CurriedOptions extends Options<CurriedFn>\n >(\n curriedFn: CurriedFn | CurriedOptions,\n curriedOptions: CurriedOptions\n ) {\n type CombinedCurriedOptions = Omit<\n CombinedOptions,\n keyof CurriedOptions\n > &\n CurriedOptions;\n\n if (typeof curriedFn === 'function') {\n const mergedOptions = mergeOptions(\n fn as CombinedOptions,\n curriedOptions\n ) as CombinedCurriedOptions;\n\n return moize(curriedFn, mergedOptions);\n }\n\n const mergedOptions = mergeOptions(\n fn as CombinedOptions,\n curriedFn as CurriedOptions\n );\n\n return moize(mergedOptions);\n };\n }\n\n if (options.isReact) {\n return createMoizedComponent(moize, fn, options);\n }\n\n const coalescedOptions: Options<MoizeableFn> = {\n ...DEFAULT_OPTIONS,\n ...options,\n maxAge:\n typeof options.maxAge === 'number' && options.maxAge >= 0\n ? options.maxAge\n : DEFAULT_OPTIONS.maxAge,\n maxArgs:\n typeof options.maxArgs === 'number' && options.maxArgs >= 0\n ? options.maxArgs\n : DEFAULT_OPTIONS.maxArgs,\n maxSize:\n typeof options.maxSize === 'number' && options.maxSize >= 0\n ? options.maxSize\n : DEFAULT_OPTIONS.maxSize,\n profileName: options.profileName || getDefaultProfileName(fn),\n };\n const expirations: Array<Expiration> = [];\n\n const {\n matchesArg: equalsIgnored,\n isDeepEqual: isDeepEqualIgnored,\n isPromise,\n isReact: isReactIgnored,\n isSerialized: isSerialzedIgnored,\n isShallowEqual: isShallowEqualIgnored,\n matchesKey: matchesKeyIgnored,\n maxAge: maxAgeIgnored,\n maxArgs: maxArgsIgnored,\n maxSize,\n onCacheAdd,\n onCacheChange,\n onCacheHit,\n onExpire: onExpireIgnored,\n profileName: profileNameIgnored,\n serializer: serializerIgnored,\n updateCacheForKey,\n transformArgs: transformArgsIgnored,\n updateExpire: updateExpireIgnored,\n ...customOptions\n } = coalescedOptions;\n\n const isEqual = getIsEqual(coalescedOptions);\n const isMatchingKey = getIsMatchingKey(coalescedOptions);\n\n const maxAgeOptions = getMaxAgeOptions(\n expirations,\n coalescedOptions,\n isEqual,\n isMatchingKey\n );\n const statsOptions = getStatsOptions(coalescedOptions);\n\n const transformKey = getTransformKey(coalescedOptions);\n\n const microMemoizeOptions: MicroMemoizeOptions<MoizeableFn> = {\n ...customOptions,\n isEqual,\n isMatchingKey,\n isPromise,\n maxSize,\n onCacheAdd: createOnCacheOperation(\n combine(\n onCacheAdd,\n maxAgeOptions.onCacheAdd,\n statsOptions.onCacheAdd\n )\n ),\n onCacheChange: createOnCacheOperation(onCacheChange),\n onCacheHit: createOnCacheOperation(\n combine(\n onCacheHit,\n maxAgeOptions.onCacheHit,\n statsOptions.onCacheHit\n )\n ),\n transformKey,\n };\n\n const memoized = memoize(fn, microMemoizeOptions);\n\n let moized = createMoizeInstance<MoizeableFn, CombinedOptions>(memoized, {\n expirations,\n options: coalescedOptions,\n originalFunction: fn,\n });\n\n if (updateCacheForKey) {\n moized = createRefreshableMoized<typeof moized>(moized);\n }\n\n setName(moized, (fn as Moizeable).name, options.profileName);\n\n return moized;\n};\n\n/**\n * @function\n * @name clearStats\n * @memberof module:moize\n * @alias moize.clearStats\n *\n * @description\n * clear all existing stats stored\n */\nmoize.clearStats = clearStats;\n\n/**\n * @function\n * @name collectStats\n * @memberof module:moize\n * @alias moize.collectStats\n *\n * @description\n * start collecting statistics\n */\nmoize.collectStats = collectStats;\n\n/**\n * @function\n * @name compose\n * @memberof module:moize\n * @alias moize.compose\n *\n * @description\n * method to compose moized methods and return a single moized function\n *\n * @param moized the functions to compose\n * @returns the composed function\n */\nmoize.compose = function (...moized: Moize[]) {\n return compose<Moize>(...moized) || moize;\n};\n\n/**\n * @function\n * @name deep\n * @memberof module:moize\n * @alias moize.deep\n *\n * @description\n * should deep equality check be used\n *\n * @returns the moizer function\n */\nmoize.deep = moize({ isDeepEqual: true });\n\n/**\n * @function\n * @name getStats\n * @memberof module:moize\n * @alias moize.getStats\n *\n * @description\n * get the statistics of a given profile, or overall usage\n *\n * @returns statistics for a given profile or overall usage\n */\nmoize.getStats = getStats;\n\n/**\n * @function\n * @name infinite\n * @memberof module:moize\n * @alias moize.infinite\n *\n * @description\n * a moized method that will remove all limits from the cache size\n *\n * @returns the moizer function\n */\nmoize.infinite = moize({ maxSize: Infinity });\n\n/**\n * @function\n * @name isCollectingStats\n * @memberof module:moize\n * @alias moize.isCollectingStats\n *\n * @description\n * are stats being collected\n *\n * @returns are stats being collected\n */\nmoize.isCollectingStats = function isCollectingStats(): boolean {\n return statsCache.isCollectingStats;\n};\n\n/**\n * @function\n * @name isMoized\n * @memberof module:moize\n * @alias moize.isMoized\n *\n * @description\n * is the fn passed a moized function\n *\n * @param fn the object to test\n * @returns is fn a moized function\n */\nmoize.isMoized = function isMoized(fn: any): fn is Moized {\n return typeof fn === 'function' && !!fn.isMoized;\n};\n\n/**\n * @function\n * @name matchesArg\n * @memberof module:moize\n * @alias moize.matchesArg\n *\n * @description\n * a moized method where the arg matching method is the custom one passed\n *\n * @param keyMatcher the method to compare against those in cache\n * @returns the moizer function\n */\nmoize.matchesArg = function (argMatcher: IsEqual) {\n return moize({ matchesArg: argMatcher });\n};\n\n/**\n * @function\n * @name matchesKey\n * @memberof module:moize\n * @alias moize.matchesKey\n *\n * @description\n * a moized method where the key matching method is the custom one passed\n *\n * @param keyMatcher the method to compare against those in cache\n * @returns the moizer function\n */\nmoize.matchesKey = function (keyMatcher: IsMatchingKey) {\n return moize({ matchesKey: keyMatcher });\n};\n\nfunction maxAge<MaxAge extends number>(\n maxAge: MaxAge\n): Moize<{ maxAge: MaxAge }>;\nfunction maxAge<MaxAge extends number, UpdateExpire extends boolean>(\n maxAge: MaxAge,\n expireOptions: UpdateExpire\n): Moize<{ maxAge: MaxAge; updateExpire: UpdateExpire }>;\nfunction maxAge<MaxAge extends number, ExpireHandler extends OnExpire>(\n maxAge: MaxAge,\n expireOptions: ExpireHandler\n): Moize<{ maxAge: MaxAge; onExpire: ExpireHandler }>;\nfunction maxAge<\n MaxAge extends number,\n ExpireHandler extends OnExpire,\n ExpireOptions extends {\n onExpire: ExpireHandler;\n }\n>(\n maxAge: MaxAge,\n expireOptions: ExpireOptions\n): Moize<{ maxAge: MaxAge; onExpire: ExpireOptions['onExpire'] }>;\nfunction maxAge<\n MaxAge extends number,\n UpdateExpire extends boolean,\n ExpireOptions extends {\n updateExpire: UpdateExpire;\n }\n>(\n maxAge: MaxAge,\n expireOptions: ExpireOptions\n): Moize<{ maxAge: MaxAge; updateExpire: UpdateExpire }>;\nfunction maxAge<\n MaxAge extends number,\n ExpireHandler extends OnExpire,\n UpdateExpire extends boolean,\n ExpireOptions extends {\n onExpire: ExpireHandler;\n updateExpire: UpdateExpire;\n }\n>(\n maxAge: MaxAge,\n expireOptions: ExpireOptions\n): Moize<{\n maxAge: MaxAge;\n onExpire: ExpireHandler;\n updateExpire: UpdateExpire;\n}>;\nfunction maxAge<\n MaxAge extends number,\n ExpireHandler extends OnExpire,\n UpdateExpire extends boolean,\n ExpireOptions extends {\n onExpire?: ExpireHandler;\n updateExpire?: UpdateExpire;\n }\n>(\n maxAge: MaxAge,\n expireOptions?: ExpireHandler | UpdateExpire | ExpireOptions\n) {\n if (expireOptions === true) {\n return moize({\n maxAge,\n updateExpire: expireOptions,\n });\n }\n\n if (typeof expireOptions === 'object') {\n const { onExpire, updateExpire } = expireOptions;\n\n return moize({\n maxAge,\n onExpire,\n updateExpire,\n });\n }\n\n if (typeof expireOptions === 'function') {\n return moize({\n maxAge,\n onExpire: expireOptions,\n updateExpire: true,\n });\n }\n\n return moize({ maxAge });\n}\n\n/**\n * @function\n * @name maxAge\n * @memberof module:moize\n * @alias moize.maxAge\n *\n * @description\n * a moized method where the age of the cache is limited to the number of milliseconds passed\n *\n * @param maxAge the TTL of the value in cache\n * @returns the moizer function\n */\nmoize.maxAge = maxAge;\n\n/**\n * @function\n * @name maxArgs\n * @memberof module:moize\n * @alias moize.maxArgs\n *\n * @description\n * a moized method where the number of arguments used for determining cache is limited to the value passed\n *\n * @param maxArgs the number of args to base the key on\n * @returns the moizer function\n */\nmoize.maxArgs = function maxArgs(maxArgs: number) {\n return moize({ maxArgs });\n};\n\n/**\n * @function\n * @name maxSize\n * @memberof module:moize\n * @alias moize.maxSize\n *\n * @description\n * a moized method where the total size of the cache is limited to the value passed\n *\n * @param maxSize the maximum size of the cache\n * @returns the moizer function\n */\nmoize.maxSize = function maxSize(maxSize: number) {\n return moize({ maxSize });\n};\n\n/**\n * @function\n * @name profile\n * @memberof module:moize\n * @alias moize.profile\n *\n * @description\n * a moized method with a profile name\n *\n * @returns the moizer function\n */\nmoize.profile = function (profileName: string) {\n return moize({ profileName });\n};\n\n/**\n * @function\n * @name promise\n * @memberof module:moize\n * @alias moize.promise\n *\n * @description\n * a moized method specific to caching resolved promise / async values\n *\n * @returns the moizer function\n */\nmoize.promise = moize({\n isPromise: true,\n updateExpire: true,\n});\n\n/**\n * @function\n * @name react\n * @memberof module:moize\n * @alias moize.react\n *\n * @description\n * a moized method specific to caching React element values\n *\n * @returns the moizer function\n */\nmoize.react = moize({ isReact: true });\n\n/**\n * @function\n * @name serialize\n * @memberof module:moize\n * @alias moize.serialize\n *\n * @description\n * a moized method that will serialize the arguments passed to use as the cache key\n *\n * @returns the moizer function\n */\nmoize.serialize = moize({ isSerialized: true });\n\n/**\n * @function\n * @name serializeWith\n * @memberof module:moize\n * @alias moize.serializeWith\n *\n * @description\n * a moized method that will serialize the arguments passed to use as the cache key\n * based on the serializer passed\n *\n * @returns the moizer function\n */\nmoize.serializeWith = function (serializer: Serialize) {\n return moize({ isSerialized: true, serializer });\n};\n\n/**\n * @function\n * @name shallow\n * @memberof module:moize\n * @alias moize.shallow\n *\n * @description\n * should shallow equality check be used\n *\n * @returns the moizer function\n */\nmoize.shallow = moize({ isShallowEqual: true });\n\n/**\n * @function\n * @name transformArgs\n * @memberof module:moize\n * @alias moize.transformArgs\n *\n * @description\n * transform the args to allow for specific cache key comparison\n *\n * @param transformArgs the args transformer\n * @returns the moizer function\n */\nmoize.transformArgs = <Transformer extends TransformKey>(\n transformArgs: Transformer\n) => moize({ transformArgs });\n\n/**\n * @function\n * @name updateCacheForKey\n * @memberof module:moize\n * @alias moize.updateCacheForKey\n *\n * @description\n * update the cache for a given key when the method passed returns truthy\n *\n * @param updateCacheForKey the method to determine when to update cache\n * @returns the moizer function\n */\nmoize.updateCacheForKey = <UpdateWhen extends UpdateCacheForKey>(\n updateCacheForKey: UpdateWhen\n) => moize({ updateCacheForKey });\n\n// Add self-referring `default` property for edge-case cross-compatibility of mixed ESM/CommonJS usage.\n// This property is frozen and non-enumerable to avoid visibility on iteration or accidental overrides.\nObject.defineProperty(moize, 'default', {\n configurable: false,\n enumerable: false,\n value: moize,\n writable: false,\n});\n\nexport default moize;\n","import { copyStaticProperties } from './instance';\n\nimport type { Moized } from '../index.d';\n\nexport function createRefreshableMoized<MoizedFn extends Moized>(\n moized: MoizedFn\n) {\n const {\n options: { updateCacheForKey },\n } = moized;\n\n /**\n * @private\n *\n * @description\n * Wrapper around already-`moize`d function which will intercept the memoization\n * and call the underlying function directly with the purpose of updating the cache\n * for the given key.\n *\n * Promise values use a tweak of the logic that exists at cache.updateAsyncCache, which\n * reverts to the original value if the promise is rejected and there was already a cached\n * value.\n */\n const refreshableMoized = function refreshableMoized(\n this: any,\n ...args: Parameters<typeof moized.fn>\n ) {\n if (!updateCacheForKey(args)) {\n return moized.apply(this, args);\n }\n\n const result = moized.fn.apply(this, args);\n\n moized.set(args, result);\n\n return result;\n } as typeof moized;\n\n copyStaticProperties(moized, refreshableMoized);\n\n return refreshableMoized;\n}\n"],"names":["DEFAULT_OPTIONS","isDeepEqual","isPromise","isReact","isSerialized","isShallowEqual","matchesArg","undefined","matchesKey","maxAge","maxArgs","maxSize","onExpire","profileName","serializer","updateCacheForKey","transformArgs","updateExpire","combine","_len","arguments","length","functions","Array","_key","reduce","f","g","apply","this","compose","_len2","_key2","findExpirationIndex","expirations","key","index","createFindKeyIndex","isEqual","isMatchingKey","areKeysEqual","cacheKey","keys","keysIndex","mergeOptions","originalOptions","newOptions","_extends","onCacheAdd","onCacheChange","onCacheHit","setName","fn","originalFunctionName","name","Object","defineProperty","configurable","enumerable","value","writable","_unused","clearExpiration","shouldRemove","expirationIndex","clearTimeout","timeoutId","splice","createTimeout","expirationMethod","setTimeout","unref","createOnCacheHitResetExpiration","options","cache","getMaxAgeOptions","isFinite","moizedOptions","moized","keyIndex","findKeyIndex","values","unshift","push","createOnCacheAddSetExpiration","statsCache","anonymousProfileNameCounter","isCollectingStats","profiles","hasWarningDisplayed","clearStats","createOnCacheAddIncrementCalls","calls","hits","createOnCacheHitIncrementCallsAndHits","getDefaultProfileName","displayName","getUsagePercentage","toFixed","getStats","console","warn","usage","profile","completeStats","completeProfiles","computedProfiles","ALWAYS_SKIPPED_PROPERTIES","callee","caller","constructor","prototype","copyStaticProperties","originalFn","newFn","skippedProperties","getOwnPropertyNames","forEach","property","indexOf","descriptor","getOwnPropertyDescriptor","get","set","createMoizeInstance","memoized","configuration","_ref","clear","_microMemoizeOptions","transformKey","has","cacheSnapshot","remove","_moized$_microMemoize","existingKey","cutoff","size","updateAsyncCache","orderByLru","addInstanceMethods","_ref2","moizeOptions","originalFunction","microMemoizeOptions","defineProperties","currentCache","slice","expirationsSnapshot","isMoized","addInstanceProperties","REACT_ELEMENT_TYPE","Symbol","for","getCutoff","array","getStringifiedArgument","arg","typeOfArg","JSON","stringify","type","toString","thisCutoff","valueCutoff","join","defaultArgumentSerializer","args","getIsSerializedKeyEqual","createOnCacheOperation","_cacheIgnored","_microMemoizeOptionsIgnored","getTransformKey","getSerializerFunction","clone","moize","passedOptions","moizeable","mergedOptions","curriedFn","curriedOptions","moizer","reactMoizer","Moized","props","context","updater","MoizedComponent","isReactComponent","render","$$typeof","ref","_owner","createMoizedComponent","coalescedOptions","customOptions","_objectWithoutPropertiesLoose","_excluded","deepEqual","shallowEqual","sameValueZeroEqual","getIsEqual","getIsMatchingKey","maxAgeOptions","statsOptions","getStatsOptions","memoize","refreshableMoized","result","createRefreshableMoized","collectStats","deep","infinite","Infinity","argMatcher","keyMatcher","expireOptions","promise","react","serialize","serializeWith","shallow"],"mappings":"0iBAOO,IAAMA,EAAkC,CAC3CC,aAAa,EACbC,WAAW,EACXC,SAAS,EACTC,cAAc,EACdC,gBAAgB,EAChBC,gBAAYC,EACZC,gBAAYD,EACZE,YAAQF,EACRG,aAASH,EACTI,QAAS,EACTC,cAAUL,EACVM,iBAAaN,EACbO,gBAAYP,EACZQ,uBAAmBR,EACnBS,mBAAeT,EACfU,cAAc,GCDX,SAASC,IAE2B,IAAA,IAAAC,EAAAC,UAAAC,OADpCC,EAASC,IAAAA,MAAAJ,GAAAK,EAAA,EAAAA,EAAAL,EAAAK,IAATF,EAASE,GAAAJ,UAAAI,GAEZ,OAAOF,EAAUG,QAAO,SAAUC,EAAQC,GACtC,MAAiB,mBAAND,EACa,mBAANC,EACR,WACID,EAAEE,MAAMC,KAAMT,WACdO,EAAEC,MAAMC,KAAMT,UACjB,EACDM,EAGO,mBAANC,EACAA,OADX,CAGJ,GACJ,CAWO,SAASG,IAAgD,IAAA,IAAAC,EAAAX,UAAAC,OAA7BC,EAASC,IAAAA,MAAAQ,GAAAC,EAAA,EAAAA,EAAAD,EAAAC,IAATV,EAASU,GAAAZ,UAAAY,GACxC,OAAOV,EAAUG,QAAO,SAAUC,EAAQC,GACtC,MAAiB,mBAAND,EACa,mBAANC,EACR,WACI,OAAOD,EAAEC,EAAEC,MAAMC,KAAMT,WAC1B,EACDM,EAGO,mBAANC,EAC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