source: node_modules/reselect/dist/reselect.browser.mjs.map@ d24f17c

main
Last change on this file since d24f17c was d24f17c, checked in by Aleksandar Panovski <apano77@…>, 15 months ago

Initial commit

  • Property mode set to 100644
File size: 84.7 KB
Line 
1{"version":3,"sources":["../src/devModeChecks/setGlobalDevModeChecks.ts","../src/utils.ts","../src/autotrackMemoize/autotracking.ts","../src/autotrackMemoize/tracking.ts","../src/autotrackMemoize/proxy.ts","../src/lruMemoize.ts","../src/autotrackMemoize/autotrackMemoize.ts","../src/weakMapMemoize.ts","../src/createSelectorCreator.ts","../src/createStructuredSelector.ts"],"sourcesContent":["import type { DevModeChecks } from '../types'\n\n/**\n * Global configuration for development mode checks. This specifies the default\n * frequency at which each development mode check should be performed.\n *\n * @since 5.0.0\n * @internal\n */\nexport const globalDevModeChecks: DevModeChecks = {\n inputStabilityCheck: 'once',\n identityFunctionCheck: 'once'\n}\n\n/**\n * Overrides the development mode checks settings for all selectors.\n *\n * Reselect performs additional checks in development mode to help identify and\n * warn about potential issues in selector behavior. This function allows you to\n * customize the behavior of these checks across all selectors in your application.\n *\n * **Note**: This setting can still be overridden per selector inside `createSelector`'s `options` object.\n * See {@link https://github.com/reduxjs/reselect#2-per-selector-by-passing-an-identityfunctioncheck-option-directly-to-createselector per-selector-configuration}\n * and {@linkcode CreateSelectorOptions.identityFunctionCheck identityFunctionCheck} for more details.\n *\n * _The development mode checks do not run in production builds._\n *\n * @param devModeChecks - An object specifying the desired settings for development mode checks. You can provide partial overrides. Unspecified settings will retain their current values.\n *\n * @example\n * ```ts\n * import { setGlobalDevModeChecks } from 'reselect'\n * import { DevModeChecks } from '../types'\n *\n * // Run only the first time the selector is called. (default)\n * setGlobalDevModeChecks({ inputStabilityCheck: 'once' })\n *\n * // Run every time the selector is called.\n * setGlobalDevModeChecks({ inputStabilityCheck: 'always' })\n *\n * // Never run the input stability check.\n * setGlobalDevModeChecks({ inputStabilityCheck: 'never' })\n *\n * // Run only the first time the selector is called. (default)\n * setGlobalDevModeChecks({ identityFunctionCheck: 'once' })\n *\n * // Run every time the selector is called.\n * setGlobalDevModeChecks({ identityFunctionCheck: 'always' })\n *\n * // Never run the identity function check.\n * setGlobalDevModeChecks({ identityFunctionCheck: 'never' })\n * ```\n * @see {@link https://reselect.js.org/api/development-only-stability-checks Development-Only Stability Checks}\n * @see {@link https://reselect.js.org/api/development-only-stability-checks#1-globally-through-setglobaldevmodechecks global-configuration}\n *\n * @since 5.0.0\n * @public\n */\nexport const setGlobalDevModeChecks = (\n devModeChecks: Partial<DevModeChecks>\n) => {\n Object.assign(globalDevModeChecks, devModeChecks)\n}\n","import { runIdentityFunctionCheck } from './devModeChecks/identityFunctionCheck'\nimport { runInputStabilityCheck } from './devModeChecks/inputStabilityCheck'\nimport { globalDevModeChecks } from './devModeChecks/setGlobalDevModeChecks'\n// eslint-disable-next-line @typescript-eslint/consistent-type-imports\nimport type {\n DevModeChecks,\n Selector,\n SelectorArray,\n DevModeChecksExecutionInfo\n} from './types'\n\nexport const NOT_FOUND = 'NOT_FOUND'\nexport type NOT_FOUND_TYPE = typeof NOT_FOUND\n\n/**\n * Assert that the provided value is a function. If the assertion fails,\n * a `TypeError` is thrown with an optional custom error message.\n *\n * @param func - The value to be checked.\n * @param errorMessage - An optional custom error message to use if the assertion fails.\n * @throws A `TypeError` if the assertion fails.\n */\nexport function assertIsFunction<FunctionType extends Function>(\n func: unknown,\n errorMessage = `expected a function, instead received ${typeof func}`\n): asserts func is FunctionType {\n if (typeof func !== 'function') {\n throw new TypeError(errorMessage)\n }\n}\n\n/**\n * Assert that the provided value is an object. If the assertion fails,\n * a `TypeError` is thrown with an optional custom error message.\n *\n * @param object - The value to be checked.\n * @param errorMessage - An optional custom error message to use if the assertion fails.\n * @throws A `TypeError` if the assertion fails.\n */\nexport function assertIsObject<ObjectType extends Record<string, unknown>>(\n object: unknown,\n errorMessage = `expected an object, instead received ${typeof object}`\n): asserts object is ObjectType {\n if (typeof object !== 'object') {\n throw new TypeError(errorMessage)\n }\n}\n\n/**\n * Assert that the provided array is an array of functions. If the assertion fails,\n * a `TypeError` is thrown with an optional custom error message.\n *\n * @param array - The array to be checked.\n * @param errorMessage - An optional custom error message to use if the assertion fails.\n * @throws A `TypeError` if the assertion fails.\n */\nexport function assertIsArrayOfFunctions<FunctionType extends Function>(\n array: unknown[],\n errorMessage = `expected all items to be functions, instead received the following types: `\n): asserts array is FunctionType[] {\n if (\n !array.every((item): item is FunctionType => typeof item === 'function')\n ) {\n const itemTypes = array\n .map(item =>\n typeof item === 'function'\n ? `function ${item.name || 'unnamed'}()`\n : typeof item\n )\n .join(', ')\n throw new TypeError(`${errorMessage}[${itemTypes}]`)\n }\n}\n\n/**\n * Ensure that the input is an array. If it's already an array, it's returned as is.\n * If it's not an array, it will be wrapped in a new array.\n *\n * @param item - The item to be checked.\n * @returns An array containing the input item. If the input is already an array, it's returned without modification.\n */\nexport const ensureIsArray = (item: unknown) => {\n return Array.isArray(item) ? item : [item]\n}\n\n/**\n * Extracts the \"dependencies\" / \"input selectors\" from the arguments of `createSelector`.\n *\n * @param createSelectorArgs - Arguments passed to `createSelector` as an array.\n * @returns An array of \"input selectors\" / \"dependencies\".\n * @throws A `TypeError` if any of the input selectors is not function.\n */\nexport function getDependencies(createSelectorArgs: unknown[]) {\n const dependencies = Array.isArray(createSelectorArgs[0])\n ? createSelectorArgs[0]\n : createSelectorArgs\n\n assertIsArrayOfFunctions<Selector>(\n dependencies,\n `createSelector expects all input-selectors to be functions, but received the following types: `\n )\n\n return dependencies as SelectorArray\n}\n\n/**\n * Runs each input selector and returns their collective results as an array.\n *\n * @param dependencies - An array of \"dependencies\" or \"input selectors\".\n * @param inputSelectorArgs - An array of arguments being passed to the input selectors.\n * @returns An array of input selector results.\n */\nexport function collectInputSelectorResults(\n dependencies: SelectorArray,\n inputSelectorArgs: unknown[] | IArguments\n) {\n const inputSelectorResults = []\n const { length } = dependencies\n for (let i = 0; i < length; i++) {\n // @ts-ignore\n // apply arguments instead of spreading and mutate a local list of params for performance.\n inputSelectorResults.push(dependencies[i].apply(null, inputSelectorArgs))\n }\n return inputSelectorResults\n}\n\n/**\n * Retrieves execution information for development mode checks.\n *\n * @param devModeChecks - Custom Settings for development mode checks. These settings will override the global defaults.\n * @param firstRun - Indicates whether it is the first time the selector has run.\n * @returns An object containing the execution information for each development mode check.\n */\nexport const getDevModeChecksExecutionInfo = (\n firstRun: boolean,\n devModeChecks: Partial<DevModeChecks>\n) => {\n const { identityFunctionCheck, inputStabilityCheck } = {\n ...globalDevModeChecks,\n ...devModeChecks\n }\n return {\n identityFunctionCheck: {\n shouldRun:\n identityFunctionCheck === 'always' ||\n (identityFunctionCheck === 'once' && firstRun),\n run: runIdentityFunctionCheck\n },\n inputStabilityCheck: {\n shouldRun:\n inputStabilityCheck === 'always' ||\n (inputStabilityCheck === 'once' && firstRun),\n run: runInputStabilityCheck\n }\n } satisfies DevModeChecksExecutionInfo\n}\n","// Original autotracking implementation source:\n// - https://gist.github.com/pzuraq/79bf862e0f8cd9521b79c4b6eccdc4f9\n// Additional references:\n// - https://www.pzuraq.com/blog/how-autotracking-works\n// - https://v5.chriskrycho.com/journal/autotracking-elegant-dx-via-cutting-edge-cs/\nimport type { EqualityFn } from '../types'\nimport { assertIsFunction } from '../utils'\n\n// The global revision clock. Every time state changes, the clock increments.\nexport let $REVISION = 0\n\n// The current dependency tracker. Whenever we compute a cache, we create a Set\n// to track any dependencies that are used while computing. If no cache is\n// computing, then the tracker is null.\nlet CURRENT_TRACKER: Set<Cell<any> | TrackingCache> | null = null\n\n// Storage represents a root value in the system - the actual state of our app.\nexport class Cell<T> {\n revision = $REVISION\n\n _value: T\n _lastValue: T\n _isEqual: EqualityFn = tripleEq\n\n constructor(initialValue: T, isEqual: EqualityFn = tripleEq) {\n this._value = this._lastValue = initialValue\n this._isEqual = isEqual\n }\n\n // Whenever a storage value is read, it'll add itself to the current tracker if\n // one exists, entangling its state with that cache.\n get value() {\n CURRENT_TRACKER?.add(this)\n\n return this._value\n }\n\n // Whenever a storage value is updated, we bump the global revision clock,\n // assign the revision for this storage to the new value, _and_ we schedule a\n // rerender. This is important, and it's what makes autotracking _pull_\n // based. We don't actively tell the caches which depend on the storage that\n // anything has happened. Instead, we recompute the caches when needed.\n set value(newValue) {\n if (this.value === newValue) return\n\n this._value = newValue\n this.revision = ++$REVISION\n }\n}\n\nfunction tripleEq(a: unknown, b: unknown) {\n return a === b\n}\n\n// Caches represent derived state in the system. They are ultimately functions\n// that are memoized based on what state they use to produce their output,\n// meaning they will only rerun IFF a storage value that could affect the output\n// has changed. Otherwise, they'll return the cached value.\nexport class TrackingCache {\n _cachedValue: any\n _cachedRevision = -1\n _deps: any[] = []\n hits = 0\n\n fn: () => any\n\n constructor(fn: () => any) {\n this.fn = fn\n }\n\n clear() {\n this._cachedValue = undefined\n this._cachedRevision = -1\n this._deps = []\n this.hits = 0\n }\n\n get value() {\n // When getting the value for a Cache, first we check all the dependencies of\n // the cache to see what their current revision is. If the current revision is\n // greater than the cached revision, then something has changed.\n if (this.revision > this._cachedRevision) {\n const { fn } = this\n\n // We create a new dependency tracker for this cache. As the cache runs\n // its function, any Storage or Cache instances which are used while\n // computing will be added to this tracker. In the end, it will be the\n // full list of dependencies that this Cache depends on.\n const currentTracker = new Set<Cell<any>>()\n const prevTracker = CURRENT_TRACKER\n\n CURRENT_TRACKER = currentTracker\n\n // try {\n this._cachedValue = fn()\n // } finally {\n CURRENT_TRACKER = prevTracker\n this.hits++\n this._deps = Array.from(currentTracker)\n\n // Set the cached revision. This is the current clock count of all the\n // dependencies. If any dependency changes, this number will be less\n // than the new revision.\n this._cachedRevision = this.revision\n // }\n }\n\n // If there is a current tracker, it means another Cache is computing and\n // using this one, so we add this one to the tracker.\n CURRENT_TRACKER?.add(this)\n\n // Always return the cached value.\n return this._cachedValue\n }\n\n get revision() {\n // The current revision is the max of all the dependencies' revisions.\n return Math.max(...this._deps.map(d => d.revision), 0)\n }\n}\n\nexport function getValue<T>(cell: Cell<T>): T {\n if (!(cell instanceof Cell)) {\n console.warn('Not a valid cell! ', cell)\n }\n\n return cell.value\n}\n\ntype CellValue<T extends Cell<unknown>> = T extends Cell<infer U> ? U : never\n\nexport function setValue<T extends Cell<unknown>>(\n storage: T,\n value: CellValue<T>\n): void {\n if (!(storage instanceof Cell)) {\n throw new TypeError(\n 'setValue must be passed a tracked store created with `createStorage`.'\n )\n }\n\n storage.value = storage._lastValue = value\n}\n\nexport function createCell<T = unknown>(\n initialValue: T,\n isEqual: EqualityFn = tripleEq\n): Cell<T> {\n return new Cell(initialValue, isEqual)\n}\n\nexport function createCache<T = unknown>(fn: () => T): TrackingCache {\n assertIsFunction(\n fn,\n 'the first parameter to `createCache` must be a function'\n )\n\n return new TrackingCache(fn)\n}\n","import type { Cell } from './autotracking'\nimport {\n getValue as consumeTag,\n createCell as createStorage,\n setValue\n} from './autotracking'\n\nexport type Tag = Cell<unknown>\n\nconst neverEq = (a: any, b: any): boolean => false\n\nexport function createTag(): Tag {\n return createStorage(null, neverEq)\n}\nexport { consumeTag }\nexport function dirtyTag(tag: Tag, value: any): void {\n setValue(tag, value)\n}\n\nexport interface Node<\n T extends Array<unknown> | Record<string, unknown> =\n | Array<unknown>\n | Record<string, unknown>\n> {\n collectionTag: Tag | null\n tag: Tag | null\n tags: Record<string, Tag>\n children: Record<string, Node>\n proxy: T\n value: T\n id: number\n}\n\nexport const consumeCollection = (node: Node): void => {\n let tag = node.collectionTag\n\n if (tag === null) {\n tag = node.collectionTag = createTag()\n }\n\n consumeTag(tag)\n}\n\nexport const dirtyCollection = (node: Node): void => {\n const tag = node.collectionTag\n\n if (tag !== null) {\n dirtyTag(tag, null)\n }\n}\n","// Original source:\n// - https://github.com/simonihmig/tracked-redux/blob/master/packages/tracked-redux/src/-private/proxy.ts\n\nimport type { Node, Tag } from './tracking'\nimport {\n consumeCollection,\n consumeTag,\n createTag,\n dirtyCollection,\n dirtyTag\n} from './tracking'\n\nexport const REDUX_PROXY_LABEL = Symbol()\n\nlet nextId = 0\n\nconst proto = Object.getPrototypeOf({})\n\nclass ObjectTreeNode<T extends Record<string, unknown>> implements Node<T> {\n proxy: T = new Proxy(this, objectProxyHandler) as unknown as T\n tag = createTag()\n tags = {} as Record<string, Tag>\n children = {} as Record<string, Node>\n collectionTag = null\n id = nextId++\n\n constructor(public value: T) {\n this.value = value\n this.tag.value = value\n }\n}\n\nconst objectProxyHandler = {\n get(node: Node, key: string | symbol): unknown {\n function calculateResult() {\n const { value } = node\n\n const childValue = Reflect.get(value, key)\n\n if (typeof key === 'symbol') {\n return childValue\n }\n\n if (key in proto) {\n return childValue\n }\n\n if (typeof childValue === 'object' && childValue !== null) {\n let childNode = node.children[key]\n\n if (childNode === undefined) {\n childNode = node.children[key] = createNode(childValue)\n }\n\n if (childNode.tag) {\n consumeTag(childNode.tag)\n }\n\n return childNode.proxy\n } else {\n let tag = node.tags[key]\n\n if (tag === undefined) {\n tag = node.tags[key] = createTag()\n tag.value = childValue\n }\n\n consumeTag(tag)\n\n return childValue\n }\n }\n const res = calculateResult()\n return res\n },\n\n ownKeys(node: Node): ArrayLike<string | symbol> {\n consumeCollection(node)\n return Reflect.ownKeys(node.value)\n },\n\n getOwnPropertyDescriptor(\n node: Node,\n prop: string | symbol\n ): PropertyDescriptor | undefined {\n return Reflect.getOwnPropertyDescriptor(node.value, prop)\n },\n\n has(node: Node, prop: string | symbol): boolean {\n return Reflect.has(node.value, prop)\n }\n}\n\nclass ArrayTreeNode<T extends Array<unknown>> implements Node<T> {\n proxy: T = new Proxy([this], arrayProxyHandler) as unknown as T\n tag = createTag()\n tags = {}\n children = {}\n collectionTag = null\n id = nextId++\n\n constructor(public value: T) {\n this.value = value\n this.tag.value = value\n }\n}\n\nconst arrayProxyHandler = {\n get([node]: [Node], key: string | symbol): unknown {\n if (key === 'length') {\n consumeCollection(node)\n }\n\n return objectProxyHandler.get(node, key)\n },\n\n ownKeys([node]: [Node]): ArrayLike<string | symbol> {\n return objectProxyHandler.ownKeys(node)\n },\n\n getOwnPropertyDescriptor(\n [node]: [Node],\n prop: string | symbol\n ): PropertyDescriptor | undefined {\n return objectProxyHandler.getOwnPropertyDescriptor(node, prop)\n },\n\n has([node]: [Node], prop: string | symbol): boolean {\n return objectProxyHandler.has(node, prop)\n }\n}\n\nexport function createNode<T extends Array<unknown> | Record<string, unknown>>(\n value: T\n): Node<T> {\n if (Array.isArray(value)) {\n return new ArrayTreeNode(value)\n }\n\n return new ObjectTreeNode(value) as Node<T>\n}\n\nconst keysMap = new WeakMap<\n Array<unknown> | Record<string, unknown>,\n Set<string>\n>()\n\nexport function updateNode<T extends Array<unknown> | Record<string, unknown>>(\n node: Node<T>,\n newValue: T\n): void {\n const { value, tags, children } = node\n\n node.value = newValue\n\n if (\n Array.isArray(value) &&\n Array.isArray(newValue) &&\n value.length !== newValue.length\n ) {\n dirtyCollection(node)\n } else {\n if (value !== newValue) {\n let oldKeysSize = 0\n let newKeysSize = 0\n let anyKeysAdded = false\n\n for (const _key in value) {\n oldKeysSize++\n }\n\n for (const key in newValue) {\n newKeysSize++\n if (!(key in value)) {\n anyKeysAdded = true\n break\n }\n }\n\n const isDifferent = anyKeysAdded || oldKeysSize !== newKeysSize\n\n if (isDifferent) {\n dirtyCollection(node)\n }\n }\n }\n\n for (const key in tags) {\n const childValue = (value as Record<string, unknown>)[key]\n const newChildValue = (newValue as Record<string, unknown>)[key]\n\n if (childValue !== newChildValue) {\n dirtyCollection(node)\n dirtyTag(tags[key], newChildValue)\n }\n\n if (typeof newChildValue === 'object' && newChildValue !== null) {\n delete tags[key]\n }\n }\n\n for (const key in children) {\n const childNode = children[key]\n const newChildValue = (newValue as Record<string, unknown>)[key]\n\n const childValue = childNode.value\n\n if (childValue === newChildValue) {\n continue\n } else if (typeof newChildValue === 'object' && newChildValue !== null) {\n updateNode(childNode, newChildValue as Record<string, unknown>)\n } else {\n deleteNode(childNode)\n delete children[key]\n }\n }\n}\n\nfunction deleteNode(node: Node): void {\n if (node.tag) {\n dirtyTag(node.tag, null)\n }\n dirtyCollection(node)\n for (const key in node.tags) {\n dirtyTag(node.tags[key], null)\n }\n for (const key in node.children) {\n deleteNode(node.children[key])\n }\n}\n","import type {\n AnyFunction,\n DefaultMemoizeFields,\n EqualityFn,\n Simplify\n} from './types'\n\nimport type { NOT_FOUND_TYPE } from './utils'\nimport { NOT_FOUND } from './utils'\n\n// Cache implementation based on Erik Rasmussen's `lru-memoize`:\n// https://github.com/erikras/lru-memoize\n\ninterface Entry {\n key: unknown\n value: unknown\n}\n\ninterface Cache {\n get(key: unknown): unknown | NOT_FOUND_TYPE\n put(key: unknown, value: unknown): void\n getEntries(): Entry[]\n clear(): void\n}\n\nfunction createSingletonCache(equals: EqualityFn): Cache {\n let entry: Entry | undefined\n return {\n get(key: unknown) {\n if (entry && equals(entry.key, key)) {\n return entry.value\n }\n\n return NOT_FOUND\n },\n\n put(key: unknown, value: unknown) {\n entry = { key, value }\n },\n\n getEntries() {\n return entry ? [entry] : []\n },\n\n clear() {\n entry = undefined\n }\n }\n}\n\nfunction createLruCache(maxSize: number, equals: EqualityFn): Cache {\n let entries: Entry[] = []\n\n function get(key: unknown) {\n const cacheIndex = entries.findIndex(entry => equals(key, entry.key))\n\n // We found a cached entry\n if (cacheIndex > -1) {\n const entry = entries[cacheIndex]\n\n // Cached entry not at top of cache, move it to the top\n if (cacheIndex > 0) {\n entries.splice(cacheIndex, 1)\n entries.unshift(entry)\n }\n\n return entry.value\n }\n\n // No entry found in cache, return sentinel\n return NOT_FOUND\n }\n\n function put(key: unknown, value: unknown) {\n if (get(key) === NOT_FOUND) {\n // TODO Is unshift slow?\n entries.unshift({ key, value })\n if (entries.length > maxSize) {\n entries.pop()\n }\n }\n }\n\n function getEntries() {\n return entries\n }\n\n function clear() {\n entries = []\n }\n\n return { get, put, getEntries, clear }\n}\n\n/**\n * Runs a simple reference equality check.\n * What {@linkcode lruMemoize lruMemoize} uses by default.\n *\n * **Note**: This function was previously known as `defaultEqualityCheck`.\n *\n * @public\n */\nexport const referenceEqualityCheck: EqualityFn = (a, b) => a === b\n\nexport function createCacheKeyComparator(equalityCheck: EqualityFn) {\n return function areArgumentsShallowlyEqual(\n prev: unknown[] | IArguments | null,\n next: unknown[] | IArguments | null\n ): boolean {\n if (prev === null || next === null || prev.length !== next.length) {\n return false\n }\n\n // Do this in a for loop (and not a `forEach` or an `every`) so we can determine equality as fast as possible.\n const { length } = prev\n for (let i = 0; i < length; i++) {\n if (!equalityCheck(prev[i], next[i])) {\n return false\n }\n }\n\n return true\n }\n}\n\n/**\n * Options for configuring the behavior of a function memoized with\n * LRU (Least Recently Used) caching.\n *\n * @template Result - The type of the return value of the memoized function.\n *\n * @public\n */\nexport interface LruMemoizeOptions<Result = any> {\n /**\n * Function used to compare the individual arguments of the\n * provided calculation function.\n *\n * @default referenceEqualityCheck\n */\n equalityCheck?: EqualityFn\n\n /**\n * If provided, used to compare a newly generated output value against\n * previous values in the cache. If a match is found,\n * the old value is returned. This addresses the common\n * ```ts\n * todos.map(todo => todo.id)\n * ```\n * use case, where an update to another field in the original data causes\n * a recalculation due to changed references, but the output is still\n * effectively the same.\n *\n * @since 4.1.0\n */\n resultEqualityCheck?: EqualityFn<Result>\n\n /**\n * The maximum size of the cache used by the selector.\n * A size greater than 1 means the selector will use an\n * LRU (Least Recently Used) cache, allowing for the caching of multiple\n * results based on different sets of arguments.\n *\n * @default 1\n */\n maxSize?: number\n}\n\n/**\n * Creates a memoized version of a function with an optional\n * LRU (Least Recently Used) cache. The memoized function uses a cache to\n * store computed values. Depending on the `maxSize` option, it will use\n * either a singleton cache (for a single entry) or an\n * LRU cache (for multiple entries).\n *\n * **Note**: This function was previously known as `defaultMemoize`.\n *\n * @param func - The function to be memoized.\n * @param equalityCheckOrOptions - Either an equality check function or an options object.\n * @returns A memoized function with a `.clearCache()` method attached.\n *\n * @template Func - The type of the function that is memoized.\n *\n * @see {@link https://reselect.js.org/api/lruMemoize `lruMemoize`}\n *\n * @public\n */\nexport function lruMemoize<Func extends AnyFunction>(\n func: Func,\n equalityCheckOrOptions?: EqualityFn | LruMemoizeOptions<ReturnType<Func>>\n) {\n const providedOptions =\n typeof equalityCheckOrOptions === 'object'\n ? equalityCheckOrOptions\n : { equalityCheck: equalityCheckOrOptions }\n\n const {\n equalityCheck = referenceEqualityCheck,\n maxSize = 1,\n resultEqualityCheck\n } = providedOptions\n\n const comparator = createCacheKeyComparator(equalityCheck)\n\n let resultsCount = 0\n\n const cache =\n maxSize === 1\n ? createSingletonCache(comparator)\n : createLruCache(maxSize, comparator)\n\n function memoized() {\n let value = cache.get(arguments) as ReturnType<Func>\n if (value === NOT_FOUND) {\n // apply arguments instead of spreading for performance.\n // @ts-ignore\n value = func.apply(null, arguments) as ReturnType<Func>\n resultsCount++\n\n if (resultEqualityCheck) {\n const entries = cache.getEntries()\n const matchingEntry = entries.find(entry =>\n resultEqualityCheck(entry.value as ReturnType<Func>, value)\n )\n\n if (matchingEntry) {\n value = matchingEntry.value as ReturnType<Func>\n resultsCount !== 0 && resultsCount--\n }\n }\n\n cache.put(arguments, value)\n }\n return value\n }\n\n memoized.clearCache = () => {\n cache.clear()\n memoized.resetResultsCount()\n }\n\n memoized.resultsCount = () => resultsCount\n\n memoized.resetResultsCount = () => {\n resultsCount = 0\n }\n\n return memoized as Func & Simplify<DefaultMemoizeFields>\n}\n","import { createNode, updateNode } from './proxy'\nimport type { Node } from './tracking'\n\nimport { createCacheKeyComparator, referenceEqualityCheck } from '../lruMemoize'\nimport type { AnyFunction, DefaultMemoizeFields, Simplify } from '../types'\nimport { createCache } from './autotracking'\n\n/**\n * Uses an \"auto-tracking\" approach inspired by the work of the Ember Glimmer team.\n * It uses a Proxy to wrap arguments and track accesses to nested fields\n * in your selector on first read. Later, when the selector is called with\n * new arguments, it identifies which accessed fields have changed and\n * only recalculates the result if one or more of those accessed fields have changed.\n * This allows it to be more precise than the shallow equality checks in `lruMemoize`.\n *\n * __Design Tradeoffs for `autotrackMemoize`:__\n * - Pros:\n * - It is likely to avoid excess calculations and recalculate fewer times than `lruMemoize` will,\n * which may also result in fewer component re-renders.\n * - Cons:\n * - It only has a cache size of 1.\n * - It is slower than `lruMemoize`, because it has to do more work. (How much slower is dependent on the number of accessed fields in a selector, number of calls, frequency of input changes, etc)\n * - It can have some unexpected behavior. Because it tracks nested field accesses,\n * cases where you don't access a field will not recalculate properly.\n * For example, a badly-written selector like:\n * ```ts\n * createSelector([state => state.todos], todos => todos)\n * ```\n * that just immediately returns the extracted value will never update, because it doesn't see any field accesses to check.\n *\n * __Use Cases for `autotrackMemoize`:__\n * - It is likely best used for cases where you need to access specific nested fields\n * in data, and avoid recalculating if other fields in the same data objects are immutably updated.\n *\n * @param func - The function to be memoized.\n * @returns A memoized function with a `.clearCache()` method attached.\n *\n * @example\n * <caption>Using `createSelector`</caption>\n * ```ts\n * import { unstable_autotrackMemoize as autotrackMemoize, createSelector } from 'reselect'\n *\n * const selectTodoIds = createSelector(\n * [(state: RootState) => state.todos],\n * (todos) => todos.map(todo => todo.id),\n * { memoize: autotrackMemoize }\n * )\n * ```\n *\n * @example\n * <caption>Using `createSelectorCreator`</caption>\n * ```ts\n * import { unstable_autotrackMemoize as autotrackMemoize, createSelectorCreator } from 'reselect'\n *\n * const createSelectorAutotrack = createSelectorCreator({ memoize: autotrackMemoize })\n *\n * const selectTodoIds = createSelectorAutotrack(\n * [(state: RootState) => state.todos],\n * (todos) => todos.map(todo => todo.id)\n * )\n * ```\n *\n * @template Func - The type of the function that is memoized.\n *\n * @see {@link https://reselect.js.org/api/unstable_autotrackMemoize autotrackMemoize}\n *\n * @since 5.0.0\n * @public\n * @experimental\n */\nexport function autotrackMemoize<Func extends AnyFunction>(func: Func) {\n // we reference arguments instead of spreading them for performance reasons\n\n const node: Node<Record<string, unknown>> = createNode(\n [] as unknown as Record<string, unknown>\n )\n\n let lastArgs: IArguments | null = null\n\n const shallowEqual = createCacheKeyComparator(referenceEqualityCheck)\n\n const cache = createCache(() => {\n const res = func.apply(null, node.proxy as unknown as any[])\n return res\n })\n\n function memoized() {\n if (!shallowEqual(lastArgs, arguments)) {\n updateNode(node, arguments as unknown as Record<string, unknown>)\n lastArgs = arguments\n }\n return cache.value\n }\n\n memoized.clearCache = () => {\n return cache.clear()\n }\n\n return memoized as Func & Simplify<DefaultMemoizeFields>\n}\n","// Original source:\n// - https://github.com/facebook/react/blob/0b974418c9a56f6c560298560265dcf4b65784bc/packages/react/src/ReactCache.js\n\nimport type {\n AnyFunction,\n DefaultMemoizeFields,\n EqualityFn,\n Simplify\n} from './types'\n\nclass StrongRef<T> {\n constructor(private value: T) {}\n deref() {\n return this.value\n }\n}\n\nconst Ref =\n typeof WeakRef !== 'undefined'\n ? WeakRef\n : (StrongRef as unknown as typeof WeakRef)\n\nconst UNTERMINATED = 0\nconst TERMINATED = 1\n\ninterface UnterminatedCacheNode<T> {\n /**\n * Status, represents whether the cached computation returned a value or threw an error.\n */\n s: 0\n /**\n * Value, either the cached result or an error, depending on status.\n */\n v: void\n /**\n * Object cache, a `WeakMap` where non-primitive arguments are stored.\n */\n o: null | WeakMap<Function | Object, CacheNode<T>>\n /**\n * Primitive cache, a regular Map where primitive arguments are stored.\n */\n p: null | Map<string | number | null | void | symbol | boolean, CacheNode<T>>\n}\n\ninterface TerminatedCacheNode<T> {\n /**\n * Status, represents whether the cached computation returned a value or threw an error.\n */\n s: 1\n /**\n * Value, either the cached result or an error, depending on status.\n */\n v: T\n /**\n * Object cache, a `WeakMap` where non-primitive arguments are stored.\n */\n o: null | WeakMap<Function | Object, CacheNode<T>>\n /**\n * Primitive cache, a regular `Map` where primitive arguments are stored.\n */\n p: null | Map<string | number | null | void | symbol | boolean, CacheNode<T>>\n}\n\ntype CacheNode<T> = TerminatedCacheNode<T> | UnterminatedCacheNode<T>\n\nfunction createCacheNode<T>(): CacheNode<T> {\n return {\n s: UNTERMINATED,\n v: undefined,\n o: null,\n p: null\n }\n}\n\n/**\n * Configuration options for a memoization function utilizing `WeakMap` for\n * its caching mechanism.\n *\n * @template Result - The type of the return value of the memoized function.\n *\n * @since 5.0.0\n * @public\n */\nexport interface WeakMapMemoizeOptions<Result = any> {\n /**\n * If provided, used to compare a newly generated output value against previous values in the cache.\n * If a match is found, the old value is returned. This addresses the common\n * ```ts\n * todos.map(todo => todo.id)\n * ```\n * use case, where an update to another field in the original data causes a recalculation\n * due to changed references, but the output is still effectively the same.\n *\n * @since 5.0.0\n */\n resultEqualityCheck?: EqualityFn<Result>\n}\n\n/**\n * Creates a tree of `WeakMap`-based cache nodes based on the identity of the\n * arguments it's been called with (in this case, the extracted values from your input selectors).\n * This allows `weakMapMemoize` to have an effectively infinite cache size.\n * Cache results will be kept in memory as long as references to the arguments still exist,\n * and then cleared out as the arguments are garbage-collected.\n *\n * __Design Tradeoffs for `weakMapMemoize`:__\n * - Pros:\n * - It has an effectively infinite cache size, but you have no control over\n * how long values are kept in cache as it's based on garbage collection and `WeakMap`s.\n * - Cons:\n * - There's currently no way to alter the argument comparisons.\n * They're based on strict reference equality.\n * - It's roughly the same speed as `lruMemoize`, although likely a fraction slower.\n *\n * __Use Cases for `weakMapMemoize`:__\n * - This memoizer is likely best used for cases where you need to call the\n * same selector instance with many different arguments, such as a single\n * selector instance that is used in a list item component and called with\n * item IDs like:\n * ```ts\n * useSelector(state => selectSomeData(state, props.category))\n * ```\n * @param func - The function to be memoized.\n * @returns A memoized function with a `.clearCache()` method attached.\n *\n * @example\n * <caption>Using `createSelector`</caption>\n * ```ts\n * import { createSelector, weakMapMemoize } from 'reselect'\n *\n * interface RootState {\n * items: { id: number; category: string; name: string }[]\n * }\n *\n * const selectItemsByCategory = createSelector(\n * [\n * (state: RootState) => state.items,\n * (state: RootState, category: string) => category\n * ],\n * (items, category) => items.filter(item => item.category === category),\n * {\n * memoize: weakMapMemoize,\n * argsMemoize: weakMapMemoize\n * }\n * )\n * ```\n *\n * @example\n * <caption>Using `createSelectorCreator`</caption>\n * ```ts\n * import { createSelectorCreator, weakMapMemoize } from 'reselect'\n *\n * const createSelectorWeakMap = createSelectorCreator({ memoize: weakMapMemoize, argsMemoize: weakMapMemoize })\n *\n * const selectItemsByCategory = createSelectorWeakMap(\n * [\n * (state: RootState) => state.items,\n * (state: RootState, category: string) => category\n * ],\n * (items, category) => items.filter(item => item.category === category)\n * )\n * ```\n *\n * @template Func - The type of the function that is memoized.\n *\n * @see {@link https://reselect.js.org/api/weakMapMemoize `weakMapMemoize`}\n *\n * @since 5.0.0\n * @public\n * @experimental\n */\nexport function weakMapMemoize<Func extends AnyFunction>(\n func: Func,\n options: WeakMapMemoizeOptions<ReturnType<Func>> = {}\n) {\n let fnNode = createCacheNode()\n const { resultEqualityCheck } = options\n\n let lastResult: WeakRef<object> | undefined\n\n let resultsCount = 0\n\n function memoized() {\n let cacheNode = fnNode\n const { length } = arguments\n for (let i = 0, l = length; i < l; i++) {\n const arg = arguments[i]\n if (\n typeof arg === 'function' ||\n (typeof arg === 'object' && arg !== null)\n ) {\n // Objects go into a WeakMap\n let objectCache = cacheNode.o\n if (objectCache === null) {\n cacheNode.o = objectCache = new WeakMap()\n }\n const objectNode = objectCache.get(arg)\n if (objectNode === undefined) {\n cacheNode = createCacheNode()\n objectCache.set(arg, cacheNode)\n } else {\n cacheNode = objectNode\n }\n } else {\n // Primitives go into a regular Map\n let primitiveCache = cacheNode.p\n if (primitiveCache === null) {\n cacheNode.p = primitiveCache = new Map()\n }\n const primitiveNode = primitiveCache.get(arg)\n if (primitiveNode === undefined) {\n cacheNode = createCacheNode()\n primitiveCache.set(arg, cacheNode)\n } else {\n cacheNode = primitiveNode\n }\n }\n }\n\n const terminatedNode = cacheNode as unknown as TerminatedCacheNode<any>\n\n let result\n\n if (cacheNode.s === TERMINATED) {\n result = cacheNode.v\n } else {\n // Allow errors to propagate\n result = func.apply(null, arguments as unknown as any[])\n resultsCount++\n }\n\n terminatedNode.s = TERMINATED\n\n if (resultEqualityCheck) {\n const lastResultValue = lastResult?.deref?.() ?? lastResult\n if (\n lastResultValue != null &&\n resultEqualityCheck(lastResultValue as ReturnType<Func>, result)\n ) {\n result = lastResultValue\n resultsCount !== 0 && resultsCount--\n }\n\n const needsWeakRef =\n (typeof result === 'object' && result !== null) ||\n typeof result === 'function'\n lastResult = needsWeakRef ? new Ref(result) : result\n }\n terminatedNode.v = result\n return result\n }\n\n memoized.clearCache = () => {\n fnNode = createCacheNode()\n memoized.resetResultsCount()\n }\n\n memoized.resultsCount = () => resultsCount\n\n memoized.resetResultsCount = () => {\n resultsCount = 0\n }\n\n return memoized as Func & Simplify<DefaultMemoizeFields>\n}\n","import { weakMapMemoize } from './weakMapMemoize'\n\nimport type {\n Combiner,\n CreateSelectorOptions,\n DropFirstParameter,\n ExtractMemoizerFields,\n GetParamsFromSelectors,\n GetStateFromSelectors,\n InterruptRecursion,\n OutputSelector,\n Selector,\n SelectorArray,\n SetRequired,\n Simplify,\n UnknownMemoizer\n} from './types'\n\nimport {\n assertIsFunction,\n collectInputSelectorResults,\n ensureIsArray,\n getDependencies,\n getDevModeChecksExecutionInfo\n} from './utils'\n\n/**\n * An instance of `createSelector`, customized with a given memoize implementation.\n *\n * @template MemoizeFunction - The type of the memoize function that is used to memoize the `resultFunc` inside `createSelector` (e.g., `lruMemoize` or `weakMapMemoize`).\n * @template ArgsMemoizeFunction - The type of the optional memoize function that is used to memoize the arguments passed into the output selector generated by `createSelector` (e.g., `lruMemoize` or `weakMapMemoize`). If none is explicitly provided, `weakMapMemoize` will be used.\n * @template StateType - The type of state that the selectors created with this selector creator will operate on.\n *\n * @public\n */\nexport interface CreateSelectorFunction<\n MemoizeFunction extends UnknownMemoizer = typeof weakMapMemoize,\n ArgsMemoizeFunction extends UnknownMemoizer = typeof weakMapMemoize,\n StateType = any\n> {\n /**\n * Creates a memoized selector function.\n *\n * @param createSelectorArgs - An arbitrary number of input selectors as separate inline arguments and a `combiner` function.\n * @returns A memoized output selector.\n *\n * @template InputSelectors - The type of the input selectors as an array.\n * @template Result - The return type of the `combiner` as well as the output selector.\n * @template OverrideMemoizeFunction - The type of the optional `memoize` function that could be passed into the options object to override the original `memoize` function that was initially passed into `createSelectorCreator`.\n * @template OverrideArgsMemoizeFunction - The type of the optional `argsMemoize` function that could be passed into the options object to override the original `argsMemoize` function that was initially passed into `createSelectorCreator`.\n *\n * @see {@link https://reselect.js.org/api/createselector `createSelector`}\n */\n <InputSelectors extends SelectorArray<StateType>, Result>(\n ...createSelectorArgs: [\n ...inputSelectors: InputSelectors,\n combiner: Combiner<InputSelectors, Result>\n ]\n ): OutputSelector<\n InputSelectors,\n Result,\n MemoizeFunction,\n ArgsMemoizeFunction\n > &\n InterruptRecursion\n\n /**\n * Creates a memoized selector function.\n *\n * @param createSelectorArgs - An arbitrary number of input selectors as separate inline arguments, a `combiner` function and an `options` object.\n * @returns A memoized output selector.\n *\n * @template InputSelectors - The type of the input selectors as an array.\n * @template Result - The return type of the `combiner` as well as the output selector.\n * @template OverrideMemoizeFunction - The type of the optional `memoize` function that could be passed into the options object to override the original `memoize` function that was initially passed into `createSelectorCreator`.\n * @template OverrideArgsMemoizeFunction - The type of the optional `argsMemoize` function that could be passed into the options object to override the original `argsMemoize` function that was initially passed into `createSelectorCreator`.\n *\n * @see {@link https://reselect.js.org/api/createselector `createSelector`}\n */\n <\n InputSelectors extends SelectorArray<StateType>,\n Result,\n OverrideMemoizeFunction extends UnknownMemoizer = MemoizeFunction,\n OverrideArgsMemoizeFunction extends UnknownMemoizer = ArgsMemoizeFunction\n >(\n ...createSelectorArgs: [\n ...inputSelectors: InputSelectors,\n combiner: Combiner<InputSelectors, Result>,\n createSelectorOptions: Simplify<\n CreateSelectorOptions<\n MemoizeFunction,\n ArgsMemoizeFunction,\n OverrideMemoizeFunction,\n OverrideArgsMemoizeFunction\n >\n >\n ]\n ): OutputSelector<\n InputSelectors,\n Result,\n OverrideMemoizeFunction,\n OverrideArgsMemoizeFunction\n > &\n InterruptRecursion\n\n /**\n * Creates a memoized selector function.\n *\n * @param inputSelectors - An array of input selectors.\n * @param combiner - A function that Combines the input selectors and returns an output selector. Otherwise known as the result function.\n * @param createSelectorOptions - An optional options object that allows for further customization per selector.\n * @returns A memoized output selector.\n *\n * @template InputSelectors - The type of the input selectors array.\n * @template Result - The return type of the `combiner` as well as the output selector.\n * @template OverrideMemoizeFunction - The type of the optional `memoize` function that could be passed into the options object to override the original `memoize` function that was initially passed into `createSelectorCreator`.\n * @template OverrideArgsMemoizeFunction - The type of the optional `argsMemoize` function that could be passed into the options object to override the original `argsMemoize` function that was initially passed into `createSelectorCreator`.\n *\n * @see {@link https://reselect.js.org/api/createselector `createSelector`}\n */\n <\n InputSelectors extends SelectorArray<StateType>,\n Result,\n OverrideMemoizeFunction extends UnknownMemoizer = MemoizeFunction,\n OverrideArgsMemoizeFunction extends UnknownMemoizer = ArgsMemoizeFunction\n >(\n inputSelectors: [...InputSelectors],\n combiner: Combiner<InputSelectors, Result>,\n createSelectorOptions?: Simplify<\n CreateSelectorOptions<\n MemoizeFunction,\n ArgsMemoizeFunction,\n OverrideMemoizeFunction,\n OverrideArgsMemoizeFunction\n >\n >\n ): OutputSelector<\n InputSelectors,\n Result,\n OverrideMemoizeFunction,\n OverrideArgsMemoizeFunction\n > &\n InterruptRecursion\n\n /**\n * Creates a \"pre-typed\" version of {@linkcode createSelector createSelector}\n * where the `state` type is predefined.\n *\n * This allows you to set the `state` type once, eliminating the need to\n * specify it with every {@linkcode createSelector createSelector} call.\n *\n * @returns A pre-typed `createSelector` with the state type already defined.\n *\n * @example\n * ```ts\n * import { createSelector } from 'reselect'\n *\n * export interface RootState {\n * todos: { id: number; completed: boolean }[]\n * alerts: { id: number; read: boolean }[]\n * }\n *\n * export const createAppSelector = createSelector.withTypes<RootState>()\n *\n * const selectTodoIds = createAppSelector(\n * [\n * // Type of `state` is set to `RootState`, no need to manually set the type\n * state => state.todos\n * ],\n * todos => todos.map(({ id }) => id)\n * )\n * ```\n * @template OverrideStateType - The specific type of state used by all selectors created with this selector creator.\n *\n * @see {@link https://reselect.js.org/api/createselector#defining-a-pre-typed-createselector `createSelector.withTypes`}\n *\n * @since 5.1.0\n */\n withTypes: <OverrideStateType extends StateType>() => CreateSelectorFunction<\n MemoizeFunction,\n ArgsMemoizeFunction,\n OverrideStateType\n >\n}\n\n/**\n * Creates a selector creator function with the specified memoization function\n * and options for customizing memoization behavior.\n *\n * @param options - An options object containing the `memoize` function responsible for memoizing the `resultFunc` inside `createSelector` (e.g., `lruMemoize` or `weakMapMemoize`). It also provides additional options for customizing memoization. While the `memoize` property is mandatory, the rest are optional.\n * @returns A customized `createSelector` function.\n *\n * @example\n * ```ts\n * const customCreateSelector = createSelectorCreator({\n * memoize: customMemoize, // Function to be used to memoize `resultFunc`\n * memoizeOptions: [memoizeOption1, memoizeOption2], // Options passed to `customMemoize` as the second argument onwards\n * argsMemoize: customArgsMemoize, // Function to be used to memoize the selector's arguments\n * argsMemoizeOptions: [argsMemoizeOption1, argsMemoizeOption2] // Options passed to `customArgsMemoize` as the second argument onwards\n * })\n *\n * const customSelector = customCreateSelector(\n * [inputSelector1, inputSelector2],\n * resultFunc // `resultFunc` will be passed as the first argument to `customMemoize`\n * )\n *\n * customSelector(\n * ...selectorArgs // Will be memoized by `customArgsMemoize`\n * )\n * ```\n *\n * @template MemoizeFunction - The type of the memoize function that is used to memoize the `resultFunc` inside `createSelector` (e.g., `lruMemoize` or `weakMapMemoize`).\n * @template ArgsMemoizeFunction - The type of the optional memoize function that is used to memoize the arguments passed into the output selector generated by `createSelector` (e.g., `lruMemoize` or `weakMapMemoize`). If none is explicitly provided, `weakMapMemoize` will be used.\n *\n * @see {@link https://reselect.js.org/api/createSelectorCreator#using-options-since-500 `createSelectorCreator`}\n *\n * @since 5.0.0\n * @public\n */\nexport function createSelectorCreator<\n MemoizeFunction extends UnknownMemoizer,\n ArgsMemoizeFunction extends UnknownMemoizer = typeof weakMapMemoize\n>(\n options: Simplify<\n SetRequired<\n CreateSelectorOptions<\n typeof weakMapMemoize,\n typeof weakMapMemoize,\n MemoizeFunction,\n ArgsMemoizeFunction\n >,\n 'memoize'\n >\n >\n): CreateSelectorFunction<MemoizeFunction, ArgsMemoizeFunction>\n\n/**\n * Creates a selector creator function with the specified memoization function\n * and options for customizing memoization behavior.\n *\n * @param memoize - The `memoize` function responsible for memoizing the `resultFunc` inside `createSelector` (e.g., `lruMemoize` or `weakMapMemoize`).\n * @param memoizeOptionsFromArgs - Optional configuration options for the memoization function. These options are then passed to the memoize function as the second argument onwards.\n * @returns A customized `createSelector` function.\n *\n * @example\n * ```ts\n * const customCreateSelector = createSelectorCreator(customMemoize, // Function to be used to memoize `resultFunc`\n * option1, // Will be passed as second argument to `customMemoize`\n * option2, // Will be passed as third argument to `customMemoize`\n * option3 // Will be passed as fourth argument to `customMemoize`\n * )\n *\n * const customSelector = customCreateSelector(\n * [inputSelector1, inputSelector2],\n * resultFunc // `resultFunc` will be passed as the first argument to `customMemoize`\n * )\n * ```\n *\n * @template MemoizeFunction - The type of the memoize function that is used to memoize the `resultFunc` inside `createSelector` (e.g., `lruMemoize` or `weakMapMemoize`).\n *\n * @see {@link https://reselect.js.org/api/createSelectorCreator#using-memoize-and-memoizeoptions `createSelectorCreator`}\n *\n * @public\n */\nexport function createSelectorCreator<MemoizeFunction extends UnknownMemoizer>(\n memoize: MemoizeFunction,\n ...memoizeOptionsFromArgs: DropFirstParameter<MemoizeFunction>\n): CreateSelectorFunction<MemoizeFunction>\n\n/**\n * Creates a selector creator function with the specified memoization\n * function and options for customizing memoization behavior.\n *\n * @param memoizeOrOptions - Either A `memoize` function or an `options` object containing the `memoize` function.\n * @param memoizeOptionsFromArgs - Optional configuration options for the memoization function. These options are then passed to the memoize function as the second argument onwards.\n * @returns A customized `createSelector` function.\n *\n * @template MemoizeFunction - The type of the memoize function that is used to memoize the `resultFunc` inside `createSelector` (e.g., `lruMemoize` or `weakMapMemoize`).\n * @template ArgsMemoizeFunction - The type of the optional memoize function that is used to memoize the arguments passed into the output selector generated by `createSelector` (e.g., `lruMemoize` or `weakMapMemoize`). If none is explicitly provided, `weakMapMemoize` will be used.\n * @template MemoizeOrOptions - The type of the first argument. It can either be a `memoize` function or an `options` object containing the `memoize` function.\n */\nexport function createSelectorCreator<\n MemoizeFunction extends UnknownMemoizer,\n ArgsMemoizeFunction extends UnknownMemoizer,\n MemoizeOrOptions extends\n | MemoizeFunction\n | SetRequired<\n CreateSelectorOptions<MemoizeFunction, ArgsMemoizeFunction>,\n 'memoize'\n >\n>(\n memoizeOrOptions: MemoizeOrOptions,\n ...memoizeOptionsFromArgs: MemoizeOrOptions extends SetRequired<\n CreateSelectorOptions<MemoizeFunction, ArgsMemoizeFunction>,\n 'memoize'\n >\n ? never\n : DropFirstParameter<MemoizeFunction>\n) {\n /** options initially passed into `createSelectorCreator`. */\n const createSelectorCreatorOptions: SetRequired<\n CreateSelectorOptions<MemoizeFunction, ArgsMemoizeFunction>,\n 'memoize'\n > = typeof memoizeOrOptions === 'function'\n ? {\n memoize: memoizeOrOptions as MemoizeFunction,\n memoizeOptions: memoizeOptionsFromArgs\n }\n : memoizeOrOptions\n\n const createSelector = <\n InputSelectors extends SelectorArray,\n Result,\n OverrideMemoizeFunction extends UnknownMemoizer = MemoizeFunction,\n OverrideArgsMemoizeFunction extends UnknownMemoizer = ArgsMemoizeFunction\n >(\n ...createSelectorArgs: [\n ...inputSelectors: [...InputSelectors],\n combiner: Combiner<InputSelectors, Result>,\n createSelectorOptions?: CreateSelectorOptions<\n MemoizeFunction,\n ArgsMemoizeFunction,\n OverrideMemoizeFunction,\n OverrideArgsMemoizeFunction\n >\n ]\n ) => {\n let recomputations = 0\n let dependencyRecomputations = 0\n let lastResult: Result\n\n // Due to the intricacies of rest params, we can't do an optional arg after `...createSelectorArgs`.\n // So, start by declaring the default value here.\n // (And yes, the words 'memoize' and 'options' appear too many times in this next sequence.)\n let directlyPassedOptions: CreateSelectorOptions<\n MemoizeFunction,\n ArgsMemoizeFunction,\n OverrideMemoizeFunction,\n OverrideArgsMemoizeFunction\n > = {}\n\n // Normally, the result func or \"combiner\" is the last arg\n let resultFunc = createSelectorArgs.pop() as\n | Combiner<InputSelectors, Result>\n | CreateSelectorOptions<\n MemoizeFunction,\n ArgsMemoizeFunction,\n OverrideMemoizeFunction,\n OverrideArgsMemoizeFunction\n >\n\n // If the result func is actually an _object_, assume it's our options object\n if (typeof resultFunc === 'object') {\n directlyPassedOptions = resultFunc\n // and pop the real result func off\n resultFunc = createSelectorArgs.pop() as Combiner<InputSelectors, Result>\n }\n\n assertIsFunction(\n resultFunc,\n `createSelector expects an output function after the inputs, but received: [${typeof resultFunc}]`\n )\n\n // Determine which set of options we're using. Prefer options passed directly,\n // but fall back to options given to `createSelectorCreator`.\n const combinedOptions = {\n ...createSelectorCreatorOptions,\n ...directlyPassedOptions\n }\n\n const {\n memoize,\n memoizeOptions = [],\n argsMemoize = weakMapMemoize,\n argsMemoizeOptions = [],\n devModeChecks = {}\n } = combinedOptions\n\n // Simplifying assumption: it's unlikely that the first options arg of the provided memoizer\n // is an array. In most libs I've looked at, it's an equality function or options object.\n // Based on that, if `memoizeOptions` _is_ an array, we assume it's a full\n // user-provided array of options. Otherwise, it must be just the _first_ arg, and so\n // we wrap it in an array so we can apply it.\n const finalMemoizeOptions = ensureIsArray(memoizeOptions)\n const finalArgsMemoizeOptions = ensureIsArray(argsMemoizeOptions)\n const dependencies = getDependencies(createSelectorArgs) as InputSelectors\n\n const memoizedResultFunc = memoize(function recomputationWrapper() {\n recomputations++\n // apply arguments instead of spreading for performance.\n // @ts-ignore\n return (resultFunc as Combiner<InputSelectors, Result>).apply(\n null,\n arguments\n )\n }, ...finalMemoizeOptions) as Combiner<InputSelectors, Result> &\n ExtractMemoizerFields<OverrideMemoizeFunction>\n\n let firstRun = true\n\n // If a selector is called with the exact same arguments we don't need to traverse our dependencies again.\n const selector = argsMemoize(function dependenciesChecker() {\n dependencyRecomputations++\n /** Return values of input selectors which the `resultFunc` takes as arguments. */\n const inputSelectorResults = collectInputSelectorResults(\n dependencies,\n arguments\n )\n\n // apply arguments instead of spreading for performance.\n // @ts-ignore\n lastResult = memoizedResultFunc.apply(null, inputSelectorResults)\n\n if (process.env.NODE_ENV !== 'production') {\n const { identityFunctionCheck, inputStabilityCheck } =\n getDevModeChecksExecutionInfo(firstRun, devModeChecks)\n if (identityFunctionCheck.shouldRun) {\n identityFunctionCheck.run(\n resultFunc as Combiner<InputSelectors, Result>,\n inputSelectorResults,\n lastResult\n )\n }\n\n if (inputStabilityCheck.shouldRun) {\n // make a second copy of the params, to check if we got the same results\n const inputSelectorResultsCopy = collectInputSelectorResults(\n dependencies,\n arguments\n )\n\n inputStabilityCheck.run(\n { inputSelectorResults, inputSelectorResultsCopy },\n { memoize, memoizeOptions: finalMemoizeOptions },\n arguments\n )\n }\n\n if (firstRun) firstRun = false\n }\n\n return lastResult\n }, ...finalArgsMemoizeOptions) as unknown as Selector<\n GetStateFromSelectors<InputSelectors>,\n Result,\n GetParamsFromSelectors<InputSelectors>\n > &\n ExtractMemoizerFields<OverrideArgsMemoizeFunction>\n\n return Object.assign(selector, {\n resultFunc,\n memoizedResultFunc,\n dependencies,\n dependencyRecomputations: () => dependencyRecomputations,\n resetDependencyRecomputations: () => {\n dependencyRecomputations = 0\n },\n lastResult: () => lastResult,\n recomputations: () => recomputations,\n resetRecomputations: () => {\n recomputations = 0\n },\n memoize,\n argsMemoize\n }) as OutputSelector<\n InputSelectors,\n Result,\n OverrideMemoizeFunction,\n OverrideArgsMemoizeFunction\n >\n }\n\n Object.assign(createSelector, {\n withTypes: () => createSelector\n })\n\n return createSelector as CreateSelectorFunction<\n MemoizeFunction,\n ArgsMemoizeFunction\n >\n}\n\n/**\n * Accepts one or more \"input selectors\" (either as separate arguments or a single array),\n * a single \"result function\" / \"combiner\", and an optional options object, and\n * generates a memoized selector function.\n *\n * @see {@link https://reselect.js.org/api/createSelector `createSelector`}\n *\n * @public\n */\nexport const createSelector =\n /* #__PURE__ */ createSelectorCreator(weakMapMemoize)\n","import { createSelector } from './createSelectorCreator'\n\nimport type { CreateSelectorFunction } from './createSelectorCreator'\nimport type {\n InterruptRecursion,\n ObjectValuesToTuple,\n OutputSelector,\n Selector,\n Simplify,\n UnknownMemoizer\n} from './types'\nimport { assertIsObject } from './utils'\nimport type { weakMapMemoize } from './weakMapMemoize'\n\n/**\n * Represents a mapping of selectors to their return types.\n *\n * @template TObject - An object type where each property is a selector function.\n *\n * @public\n */\nexport type SelectorResultsMap<TObject extends SelectorsObject> = {\n [Key in keyof TObject]: ReturnType<TObject[Key]>\n}\n\n/**\n * Represents a mapping of selectors for each key in a given root state.\n *\n * This type is a utility that takes a root state object type and\n * generates a corresponding set of selectors. Each selector is associated\n * with a key in the root state, allowing for the selection\n * of specific parts of the state.\n *\n * @template RootState - The type of the root state object.\n *\n * @since 5.0.0\n * @public\n */\nexport type RootStateSelectors<RootState = any> = {\n [Key in keyof RootState]: Selector<RootState, RootState[Key], []>\n}\n\n/**\n * @deprecated Please use {@linkcode StructuredSelectorCreator.withTypes createStructuredSelector.withTypes<RootState>()} instead. This type will be removed in the future.\n * @template RootState - The type of the root state object.\n *\n * @since 5.0.0\n * @public\n */\nexport type TypedStructuredSelectorCreator<RootState = any> =\n /**\n * A convenience function that simplifies returning an object\n * made up of selector results.\n *\n * @param inputSelectorsObject - A key value pair consisting of input selectors.\n * @param selectorCreator - A custom selector creator function. It defaults to `createSelector`.\n * @returns A memoized structured selector.\n *\n * @example\n * <caption>Modern Use Case</caption>\n * ```ts\n * import { createSelector, createStructuredSelector } from 'reselect'\n *\n * interface RootState {\n * todos: {\n * id: number\n * completed: boolean\n * title: string\n * description: string\n * }[]\n * alerts: { id: number; read: boolean }[]\n * }\n *\n * // This:\n * const structuredSelector = createStructuredSelector(\n * {\n * todos: (state: RootState) => state.todos,\n * alerts: (state: RootState) => state.alerts,\n * todoById: (state: RootState, id: number) => state.todos[id]\n * },\n * createSelector\n * )\n *\n * // Is essentially the same as this:\n * const selector = createSelector(\n * [\n * (state: RootState) => state.todos,\n * (state: RootState) => state.alerts,\n * (state: RootState, id: number) => state.todos[id]\n * ],\n * (todos, alerts, todoById) => {\n * return {\n * todos,\n * alerts,\n * todoById\n * }\n * }\n * )\n * ```\n *\n * @example\n * <caption>In your component:</caption>\n * ```tsx\n * import type { RootState } from 'createStructuredSelector/modernUseCase'\n * import { structuredSelector } from 'createStructuredSelector/modernUseCase'\n * import type { FC } from 'react'\n * import { useSelector } from 'react-redux'\n *\n * interface Props {\n * id: number\n * }\n *\n * const MyComponent: FC<Props> = ({ id }) => {\n * const { todos, alerts, todoById } = useSelector((state: RootState) =>\n * structuredSelector(state, id)\n * )\n *\n * return (\n * <div>\n * Next to do is:\n * <h2>{todoById.title}</h2>\n * <p>Description: {todoById.description}</p>\n * <ul>\n * <h3>All other to dos:</h3>\n * {todos.map(todo => (\n * <li key={todo.id}>{todo.title}</li>\n * ))}\n * </ul>\n * </div>\n * )\n * }\n * ```\n *\n * @example\n * <caption>Simple Use Case</caption>\n * ```ts\n * const selectA = state => state.a\n * const selectB = state => state.b\n *\n * // The result function in the following selector\n * // is simply building an object from the input selectors\n * const structuredSelector = createSelector(selectA, selectB, (a, b) => ({\n * a,\n * b\n * }))\n *\n * const result = structuredSelector({ a: 1, b: 2 }) // will produce { x: 1, y: 2 }\n * ```\n *\n * @template InputSelectorsObject - The shape of the input selectors object.\n * @template MemoizeFunction - The type of the memoize function that is used to create the structured selector. It defaults to `weakMapMemoize`.\n * @template ArgsMemoizeFunction - The type of the of the memoize function that is used to memoize the arguments passed into the generated structured selector. It defaults to `weakMapMemoize`.\n *\n * @see {@link https://reselect.js.org/api/createStructuredSelector `createStructuredSelector`}\n */\n <\n InputSelectorsObject extends RootStateSelectors<RootState> = RootStateSelectors<RootState>,\n MemoizeFunction extends UnknownMemoizer = typeof weakMapMemoize,\n ArgsMemoizeFunction extends UnknownMemoizer = typeof weakMapMemoize\n >(\n inputSelectorsObject: InputSelectorsObject,\n selectorCreator?: CreateSelectorFunction<\n MemoizeFunction,\n ArgsMemoizeFunction\n >\n ) => OutputSelector<\n ObjectValuesToTuple<InputSelectorsObject>,\n Simplify<SelectorResultsMap<InputSelectorsObject>>,\n MemoizeFunction,\n ArgsMemoizeFunction\n > &\n InterruptRecursion\n\n/**\n * Represents an object where each property is a selector function.\n *\n * @template StateType - The type of state that all the selectors operate on.\n *\n * @public\n */\nexport type SelectorsObject<StateType = any> = Record<\n string,\n Selector<StateType>\n>\n\n/**\n * It provides a way to create structured selectors.\n * The structured selector can take multiple input selectors\n * and map their output to an object with specific keys.\n *\n * @template StateType - The type of state that the structured selectors created with this structured selector creator will operate on.\n *\n * @see {@link https://reselect.js.org/api/createStructuredSelector `createStructuredSelector`}\n *\n * @public\n */\nexport interface StructuredSelectorCreator<StateType = any> {\n /**\n * A convenience function that simplifies returning an object\n * made up of selector results.\n *\n * @param inputSelectorsObject - A key value pair consisting of input selectors.\n * @param selectorCreator - A custom selector creator function. It defaults to `createSelector`.\n * @returns A memoized structured selector.\n *\n * @example\n * <caption>Modern Use Case</caption>\n * ```ts\n * import { createSelector, createStructuredSelector } from 'reselect'\n *\n * interface RootState {\n * todos: {\n * id: number\n * completed: boolean\n * title: string\n * description: string\n * }[]\n * alerts: { id: number; read: boolean }[]\n * }\n *\n * // This:\n * const structuredSelector = createStructuredSelector(\n * {\n * todos: (state: RootState) => state.todos,\n * alerts: (state: RootState) => state.alerts,\n * todoById: (state: RootState, id: number) => state.todos[id]\n * },\n * createSelector\n * )\n *\n * // Is essentially the same as this:\n * const selector = createSelector(\n * [\n * (state: RootState) => state.todos,\n * (state: RootState) => state.alerts,\n * (state: RootState, id: number) => state.todos[id]\n * ],\n * (todos, alerts, todoById) => {\n * return {\n * todos,\n * alerts,\n * todoById\n * }\n * }\n * )\n * ```\n *\n * @example\n * <caption>In your component:</caption>\n * ```tsx\n * import type { RootState } from 'createStructuredSelector/modernUseCase'\n * import { structuredSelector } from 'createStructuredSelector/modernUseCase'\n * import type { FC } from 'react'\n * import { useSelector } from 'react-redux'\n *\n * interface Props {\n * id: number\n * }\n *\n * const MyComponent: FC<Props> = ({ id }) => {\n * const { todos, alerts, todoById } = useSelector((state: RootState) =>\n * structuredSelector(state, id)\n * )\n *\n * return (\n * <div>\n * Next to do is:\n * <h2>{todoById.title}</h2>\n * <p>Description: {todoById.description}</p>\n * <ul>\n * <h3>All other to dos:</h3>\n * {todos.map(todo => (\n * <li key={todo.id}>{todo.title}</li>\n * ))}\n * </ul>\n * </div>\n * )\n * }\n * ```\n *\n * @example\n * <caption>Simple Use Case</caption>\n * ```ts\n * const selectA = state => state.a\n * const selectB = state => state.b\n *\n * // The result function in the following selector\n * // is simply building an object from the input selectors\n * const structuredSelector = createSelector(selectA, selectB, (a, b) => ({\n * a,\n * b\n * }))\n *\n * const result = structuredSelector({ a: 1, b: 2 }) // will produce { x: 1, y: 2 }\n * ```\n *\n * @template InputSelectorsObject - The shape of the input selectors object.\n * @template MemoizeFunction - The type of the memoize function that is used to create the structured selector. It defaults to `weakMapMemoize`.\n * @template ArgsMemoizeFunction - The type of the of the memoize function that is used to memoize the arguments passed into the generated structured selector. It defaults to `weakMapMemoize`.\n *\n * @see {@link https://reselect.js.org/api/createStructuredSelector `createStructuredSelector`}\n */\n <\n InputSelectorsObject extends SelectorsObject<StateType>,\n MemoizeFunction extends UnknownMemoizer = typeof weakMapMemoize,\n ArgsMemoizeFunction extends UnknownMemoizer = typeof weakMapMemoize\n >(\n inputSelectorsObject: InputSelectorsObject,\n selectorCreator?: CreateSelectorFunction<\n MemoizeFunction,\n ArgsMemoizeFunction\n >\n ): OutputSelector<\n ObjectValuesToTuple<InputSelectorsObject>,\n Simplify<SelectorResultsMap<InputSelectorsObject>>,\n MemoizeFunction,\n ArgsMemoizeFunction\n > &\n InterruptRecursion\n\n /**\n * Creates a \"pre-typed\" version of\n * {@linkcode createStructuredSelector createStructuredSelector}\n * where the `state` type is predefined.\n *\n * This allows you to set the `state` type once, eliminating the need to\n * specify it with every\n * {@linkcode createStructuredSelector createStructuredSelector} call.\n *\n * @returns A pre-typed `createStructuredSelector` with the state type already defined.\n *\n * @example\n * ```ts\n * import { createStructuredSelector } from 'reselect'\n *\n * export interface RootState {\n * todos: { id: number; completed: boolean }[]\n * alerts: { id: number; read: boolean }[]\n * }\n *\n * export const createStructuredAppSelector =\n * createStructuredSelector.withTypes<RootState>()\n *\n * const structuredAppSelector = createStructuredAppSelector({\n * // Type of `state` is set to `RootState`, no need to manually set the type\n * todos: state => state.todos,\n * alerts: state => state.alerts,\n * todoById: (state, id: number) => state.todos[id]\n * })\n *\n * ```\n * @template OverrideStateType - The specific type of state used by all structured selectors created with this structured selector creator.\n *\n * @see {@link https://reselect.js.org/api/createstructuredselector#defining-a-pre-typed-createstructuredselector `createSelector.withTypes`}\n *\n * @since 5.1.0\n */\n withTypes: <\n OverrideStateType extends StateType\n >() => StructuredSelectorCreator<OverrideStateType>\n}\n\n/**\n * A convenience function that simplifies returning an object\n * made up of selector results.\n *\n * @param inputSelectorsObject - A key value pair consisting of input selectors.\n * @param selectorCreator - A custom selector creator function. It defaults to `createSelector`.\n * @returns A memoized structured selector.\n *\n * @example\n * <caption>Modern Use Case</caption>\n * ```ts\n * import { createSelector, createStructuredSelector } from 'reselect'\n *\n * interface RootState {\n * todos: {\n * id: number\n * completed: boolean\n * title: string\n * description: string\n * }[]\n * alerts: { id: number; read: boolean }[]\n * }\n *\n * // This:\n * const structuredSelector = createStructuredSelector(\n * {\n * todos: (state: RootState) => state.todos,\n * alerts: (state: RootState) => state.alerts,\n * todoById: (state: RootState, id: number) => state.todos[id]\n * },\n * createSelector\n * )\n *\n * // Is essentially the same as this:\n * const selector = createSelector(\n * [\n * (state: RootState) => state.todos,\n * (state: RootState) => state.alerts,\n * (state: RootState, id: number) => state.todos[id]\n * ],\n * (todos, alerts, todoById) => {\n * return {\n * todos,\n * alerts,\n * todoById\n * }\n * }\n * )\n * ```\n *\n * @see {@link https://reselect.js.org/api/createStructuredSelector `createStructuredSelector`}\n *\n * @public\n */\nexport const createStructuredSelector: StructuredSelectorCreator =\n Object.assign(\n <\n InputSelectorsObject extends SelectorsObject,\n MemoizeFunction extends UnknownMemoizer = typeof weakMapMemoize,\n ArgsMemoizeFunction extends UnknownMemoizer = typeof weakMapMemoize\n >(\n inputSelectorsObject: InputSelectorsObject,\n selectorCreator: CreateSelectorFunction<\n MemoizeFunction,\n ArgsMemoizeFunction\n > = createSelector as CreateSelectorFunction<\n MemoizeFunction,\n ArgsMemoizeFunction\n >\n ) => {\n assertIsObject(\n inputSelectorsObject,\n 'createStructuredSelector expects first argument to be an object ' +\n `where each property is a selector, instead received a ${typeof inputSelectorsObject}`\n )\n const inputSelectorKeys = Object.keys(inputSelectorsObject)\n const dependencies = inputSelectorKeys.map(\n key => inputSelectorsObject[key]\n )\n const structuredSelector = selectorCreator(\n dependencies,\n (...inputSelectorResults: any[]) => {\n return inputSelectorResults.reduce((composition, value, index) => {\n composition[inputSelectorKeys[index]] = value\n return composition\n }, {})\n }\n )\n return structuredSelector\n },\n { withTypes: () => createStructuredSelector }\n ) as StructuredSelectorCreator\n"],"mappings":"AASO,IAAMA,GAAqC,CAChD,oBAAqB,OACrB,sBAAuB,MACzB,EA8CaC,GACXC,GACG,CACH,OAAO,OAAOF,GAAqBE,CAAa,CAClD,ECnDO,IAAMC,EAAY,YAWlB,SAASC,EACdC,EACAC,EAAe,yCAAyC,OAAOD,IACjC,CAC9B,GAAI,OAAOA,GAAS,WAClB,MAAM,IAAI,UAAUC,CAAY,CAEpC,CAUO,SAASC,EACdC,EACAF,EAAe,wCAAwC,OAAOE,IAChC,CAC9B,GAAI,OAAOA,GAAW,SACpB,MAAM,IAAI,UAAUF,CAAY,CAEpC,CAUO,SAASG,GACdC,EACAJ,EAAe,6EACkB,CACjC,GACE,CAACI,EAAM,MAAOC,GAA+B,OAAOA,GAAS,UAAU,EACvE,CACA,IAAMC,EAAYF,EACf,IAAIC,GACH,OAAOA,GAAS,WACZ,YAAYA,EAAK,MAAQ,cACzB,OAAOA,CACb,EACC,KAAK,IAAI,EACZ,MAAM,IAAI,UAAU,GAAGL,KAAgBM,IA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yB,CAC9C","names":["globalDevModeChecks","setGlobalDevModeChecks","devModeChecks","NOT_FOUND","assertIsFunction","func","errorMessage","assertIsObject","object","assertIsArrayOfFunctions","array","item","itemTypes","ensureIsArray","getDependencies","createSelectorArgs","dependencies","collectInputSelectorResults","inputSelectorArgs","inputSelectorResults","length","i","$REVISION","CURRENT_TRACKER","Cell","tripleEq","initialValue","isEqual","newValue","a","b","TrackingCache","fn","currentTracker","prevTracker","d","getValue","cell","setValue","storage","value","createCell","createCache","assertIsFunction","neverEq","a","b","createTag","createCell","dirtyTag","tag","value","setValue","consumeCollection","node","createTag","getValue","dirtyCollection","REDUX_PROXY_LABEL","nextId","proto","ObjectTreeNode","value","objectProxyHandler","createTag","node","key","calculateResult","childValue","childNode","createNode","getValue","tag","consumeCollection","prop","ArrayTreeNode","arrayProxyHandler","updateNode","node","newValue","value","tags","children","dirtyCollection","oldKeysSize","newKeysSize","anyKeysAdded","_key","key","childValue","newChildValue","dirtyTag","childNode","deleteNode","createSingletonCache","equals","entry","key","NOT_FOUND","value","createLruCache","maxSize","entries","get","cacheIndex","put","getEntries","clear","referenceEqualityCheck","a","b","createCacheKeyComparator","equalityCheck","prev","next","length","i","lruMemoize","func","equalityCheckOrOptions","providedOptions","resultEqualityCheck","comparator","resultsCount","cache","memoized","matchingEntry","autotrackMemoize","func","node","createNode","lastArgs","shallowEqual","createCacheKeyComparator","referenceEqualityCheck","cache","createCache","memoized","updateNode","StrongRef","value","Ref","UNTERMINATED","TERMINATED","createCacheNode","weakMapMemoize","func","options","fnNode","resultEqualityCheck","lastResult","resultsCount","memoized","cacheNode","length","i","l","arg","objectCache","objectNode","primitiveCache","primitiveNode","terminatedNode","result","lastResultValue","createSelectorCreator","memoizeOrOptions","memoizeOptionsFromArgs","createSelectorCreatorOptions","createSelector","createSelectorArgs","recomputations","dependencyRecomputations","lastResult","directlyPassedOptions","resultFunc","assertIsFunction","combinedOptions","memoize","memoizeOptions","argsMemoize","weakMapMemoize","argsMemoizeOptions","devModeChecks","finalMemoizeOptions","ensureIsArray","finalArgsMemoizeOptions","dependencies","getDependencies","memoizedResultFunc","firstRun","selector","inputSelectorResults","collectInputSelectorResults","createStructuredSelector","inputSelectorsObject","selectorCreator","createSelector","assertIsObject","inputSelectorKeys","dependencies","key","inputSelectorResults","composition","value","index"]}
Note: See TracBrowser for help on using the repository browser.