react-redux.alternate-renderers.mjs.map 108 KB

1
  1. {"version":3,"sources":["../src/utils/react.ts","../src/alternate-renderers.ts","../src/components/Context.ts","../src/utils/useSyncExternalStore.ts","../src/hooks/useReduxContext.ts","../src/hooks/useSelector.ts","../src/utils/react-is.ts","../src/utils/warning.ts","../src/connect/verifySubselectors.ts","../src/connect/selectorFactory.ts","../src/utils/bindActionCreators.ts","../src/utils/isPlainObject.ts","../src/utils/verifyPlainObject.ts","../src/connect/wrapMapToProps.ts","../src/connect/invalidArgFactory.ts","../src/connect/mapDispatchToProps.ts","../src/connect/mapStateToProps.ts","../src/connect/mergeProps.ts","../src/utils/batch.ts","../src/utils/Subscription.ts","../src/utils/useIsomorphicLayoutEffect.ts","../src/utils/shallowEqual.ts","../src/utils/hoistStatics.ts","../src/components/connect.tsx","../src/components/Provider.tsx","../src/hooks/useStore.ts","../src/hooks/useDispatch.ts"],"sourcesContent":["import * as ReactOriginal from 'react'\r\nimport type * as ReactNamespace from 'react'\r\n\r\nexport const React: typeof ReactNamespace =\r\n // prettier-ignore\r\n // @ts-ignore\r\n 'default' in ReactOriginal ? ReactOriginal['default'] : ReactOriginal as any\r\n","// The \"alternate renderers\" entry point is primarily here to fall back on a no-op\r\n// version of `unstable_batchedUpdates`, for use with renderers other than ReactDOM/RN.\r\n// Examples include React-Three-Fiber, Ink, etc.\r\n// We'll assume they're built with React 18 and thus have `useSyncExternalStore` available.\r\n\r\nimport { React } from './utils/react'\r\nimport { useSyncExternalStoreWithSelector } from 'use-sync-external-store/with-selector.js'\r\n\r\nimport { initializeUseSelector } from './hooks/useSelector'\r\nimport { initializeConnect } from './components/connect'\r\n\r\ninitializeUseSelector(useSyncExternalStoreWithSelector)\r\ninitializeConnect(React.useSyncExternalStore)\r\n\r\nimport { getBatch } from './utils/batch'\r\n\r\n// For other renderers besides ReactDOM and React Native,\r\n// use the default noop batch function\r\nconst batch = getBatch()\r\n\r\nexport { batch }\r\n\r\nexport * from './exports'\r\n","import type { Context } from 'react'\r\nimport { React } from '../utils/react'\r\nimport type { Action, Store, UnknownAction } from 'redux'\r\nimport type { Subscription } from '../utils/Subscription'\r\nimport type { ProviderProps } from './Provider'\r\n\r\nexport interface ReactReduxContextValue<\r\n SS = any,\r\n A extends Action<string> = UnknownAction\r\n> extends Pick<ProviderProps, 'stabilityCheck' | 'identityFunctionCheck'> {\r\n store: Store<SS, A>\r\n subscription: Subscription\r\n getServerState?: () => SS\r\n}\r\n\r\nconst ContextKey = Symbol.for(`react-redux-context`)\r\nconst gT: {\r\n [ContextKey]?: Map<\r\n typeof React.createContext,\r\n Context<ReactReduxContextValue | null>\r\n >\r\n} = (\r\n typeof globalThis !== 'undefined'\r\n ? globalThis\r\n : /* fall back to a per-module scope (pre-8.1 behaviour) if `globalThis` is not available */ {}\r\n) as any\r\n\r\nfunction getContext(): Context<ReactReduxContextValue | null> {\r\n if (!React.createContext) return {} as any\r\n\r\n const contextMap = (gT[ContextKey] ??= new Map<\r\n typeof React.createContext,\r\n Context<ReactReduxContextValue | null>\r\n >())\r\n let realContext = contextMap.get(React.createContext)\r\n if (!realContext) {\r\n realContext = React.createContext<ReactReduxContextValue | null>(\r\n null as any\r\n )\r\n if (process.env.NODE_ENV !== 'production') {\r\n realContext.displayName = 'ReactRedux'\r\n }\r\n contextMap.set(React.createContext, realContext)\r\n }\r\n return realContext\r\n}\r\n\r\nexport const ReactReduxContext = /*#__PURE__*/ getContext()\r\n\r\nexport type ReactReduxContextInstance = typeof ReactReduxContext\r\n\r\nexport default ReactReduxContext\r\n","import type { useSyncExternalStore } from 'use-sync-external-store'\r\nimport type { useSyncExternalStoreWithSelector } from 'use-sync-external-store/with-selector'\r\n\r\nexport const notInitialized = () => {\r\n throw new Error('uSES not initialized!')\r\n}\r\n\r\nexport type uSES = typeof useSyncExternalStore\r\nexport type uSESWS = typeof useSyncExternalStoreWithSelector\r\n","import { React } from '../utils/react'\r\nimport { ReactReduxContext } from '../components/Context'\r\nimport type { ReactReduxContextValue } from '../components/Context'\r\n\r\n/**\r\n * Hook factory, which creates a `useReduxContext` hook bound to a given context. This is a low-level\r\n * hook that you should usually not need to call directly.\r\n *\r\n * @param {React.Context} [context=ReactReduxContext] Context passed to your `<Provider>`.\r\n * @returns {Function} A `useReduxContext` hook bound to the specified context.\r\n */\r\nexport function createReduxContextHook(context = ReactReduxContext) {\r\n return function useReduxContext(): ReactReduxContextValue {\r\n const contextValue = React.useContext(context)\r\n\r\n if (process.env.NODE_ENV !== 'production' && !contextValue) {\r\n throw new Error(\r\n 'could not find react-redux context value; please ensure the component is wrapped in a <Provider>'\r\n )\r\n }\r\n\r\n return contextValue!\r\n }\r\n}\r\n\r\n/**\r\n * A hook to access the value of the `ReactReduxContext`. This is a low-level\r\n * hook that you should usually not need to call directly.\r\n *\r\n * @returns {any} the value of the `ReactReduxContext`\r\n *\r\n * @example\r\n *\r\n * import React from 'react'\r\n * import { useReduxContext } from 'react-redux'\r\n *\r\n * export const CounterComponent = () => {\r\n * const { store } = useReduxContext()\r\n * return <div>{store.getState()}</div>\r\n * }\r\n */\r\nexport const useReduxContext = /*#__PURE__*/ createReduxContextHook()\r\n","//import * as React from 'react'\r\nimport { React } from '../utils/react'\r\n\r\nimport type { ReactReduxContextValue } from '../components/Context'\r\nimport { ReactReduxContext } from '../components/Context'\r\nimport type { EqualityFn, NoInfer } from '../types'\r\nimport type { uSESWS } from '../utils/useSyncExternalStore'\r\nimport { notInitialized } from '../utils/useSyncExternalStore'\r\nimport {\r\n createReduxContextHook,\r\n useReduxContext as useDefaultReduxContext,\r\n} from './useReduxContext'\r\n\r\n/**\r\n * The frequency of development mode checks.\r\n *\r\n * @since 8.1.0\r\n * @internal\r\n */\r\nexport type DevModeCheckFrequency = 'never' | 'once' | 'always'\r\n\r\n/**\r\n * Represents the configuration for development mode checks.\r\n *\r\n * @since 9.0.0\r\n * @internal\r\n */\r\nexport interface DevModeChecks {\r\n /**\r\n * Overrides the global stability check for the selector.\r\n * - `once` - Run only the first time the selector is called.\r\n * - `always` - Run every time the selector is called.\r\n * - `never` - Never run the stability check.\r\n *\r\n * @default 'once'\r\n *\r\n * @since 8.1.0\r\n */\r\n stabilityCheck: DevModeCheckFrequency\r\n\r\n /**\r\n * Overrides the global identity function check for the selector.\r\n * - `once` - Run only the first time the selector is called.\r\n * - `always` - Run every time the selector is called.\r\n * - `never` - Never run the identity function check.\r\n *\r\n * **Note**: Previously referred to as `noopCheck`.\r\n *\r\n * @default 'once'\r\n *\r\n * @since 9.0.0\r\n */\r\n identityFunctionCheck: DevModeCheckFrequency\r\n}\r\n\r\nexport interface UseSelectorOptions<Selected = unknown> {\r\n equalityFn?: EqualityFn<Selected>\r\n\r\n /**\r\n * `useSelector` performs additional checks in development mode to help\r\n * identify and warn about potential issues in selector behavior. This\r\n * option allows you to customize the behavior of these checks per selector.\r\n *\r\n * @since 9.0.0\r\n */\r\n devModeChecks?: Partial<DevModeChecks>\r\n}\r\n\r\nexport interface UseSelector {\r\n <TState = unknown, Selected = unknown>(\r\n selector: (state: TState) => Selected,\r\n equalityFn?: EqualityFn<Selected>\r\n ): Selected\r\n <TState = unknown, Selected = unknown>(\r\n selector: (state: TState) => Selected,\r\n options?: UseSelectorOptions<Selected>\r\n ): Selected\r\n}\r\n\r\nlet useSyncExternalStoreWithSelector = notInitialized as uSESWS\r\nexport const initializeUseSelector = (fn: uSESWS) => {\r\n useSyncExternalStoreWithSelector = fn\r\n}\r\n\r\nconst refEquality: EqualityFn<any> = (a, b) => a === b\r\n\r\n/**\r\n * Hook factory, which creates a `useSelector` hook bound to a given context.\r\n *\r\n * @param {React.Context} [context=ReactReduxContext] Context passed to your `<Provider>`.\r\n * @returns {Function} A `useSelector` hook bound to the specified context.\r\n */\r\nexport function createSelectorHook(\r\n context: React.Context<ReactReduxContextValue<\r\n any,\r\n any\r\n > | null> = ReactReduxContext\r\n): UseSelector {\r\n const useReduxContext =\r\n context === ReactReduxContext\r\n ? useDefaultReduxContext\r\n : createReduxContextHook(context)\r\n\r\n return function useSelector<TState, Selected extends unknown>(\r\n selector: (state: TState) => Selected,\r\n equalityFnOrOptions:\r\n | EqualityFn<NoInfer<Selected>>\r\n | UseSelectorOptions<NoInfer<Selected>> = {}\r\n ): Selected {\r\n const { equalityFn = refEquality, devModeChecks = {} } =\r\n typeof equalityFnOrOptions === 'function'\r\n ? { equalityFn: equalityFnOrOptions }\r\n : equalityFnOrOptions\r\n if (process.env.NODE_ENV !== 'production') {\r\n if (!selector) {\r\n throw new Error(`You must pass a selector to useSelector`)\r\n }\r\n if (typeof selector !== 'function') {\r\n throw new Error(`You must pass a function as a selector to useSelector`)\r\n }\r\n if (typeof equalityFn !== 'function') {\r\n throw new Error(\r\n `You must pass a function as an equality function to useSelector`\r\n )\r\n }\r\n }\r\n\r\n const {\r\n store,\r\n subscription,\r\n getServerState,\r\n stabilityCheck,\r\n identityFunctionCheck,\r\n } = useReduxContext()\r\n\r\n const firstRun = React.useRef(true)\r\n\r\n const wrappedSelector = React.useCallback<typeof selector>(\r\n {\r\n [selector.name](state: TState) {\r\n const selected = selector(state)\r\n if (process.env.NODE_ENV !== 'production') {\r\n const {\r\n identityFunctionCheck: finalIdentityFunctionCheck,\r\n stabilityCheck: finalStabilityCheck,\r\n } = {\r\n stabilityCheck,\r\n identityFunctionCheck,\r\n ...devModeChecks,\r\n }\r\n if (\r\n finalStabilityCheck === 'always' ||\r\n (finalStabilityCheck === 'once' && firstRun.current)\r\n ) {\r\n const toCompare = selector(state)\r\n if (!equalityFn(selected, toCompare)) {\r\n let stack: string | undefined = undefined\r\n try {\r\n throw new Error()\r\n } catch (e) {\r\n ;({ stack } = e as Error)\r\n }\r\n console.warn(\r\n 'Selector ' +\r\n (selector.name || 'unknown') +\r\n ' returned a different result when called with the same parameters. This can lead to unnecessary rerenders.' +\r\n '\\nSelectors that return a new reference (such as an object or an array) should be memoized: https://redux.js.org/usage/deriving-data-selectors#optimizing-selectors-with-memoization',\r\n {\r\n state,\r\n selected,\r\n selected2: toCompare,\r\n stack,\r\n }\r\n )\r\n }\r\n }\r\n if (\r\n finalIdentityFunctionCheck === 'always' ||\r\n (finalIdentityFunctionCheck === 'once' && firstRun.current)\r\n ) {\r\n // @ts-ignore\r\n if (selected === state) {\r\n let stack: string | undefined = undefined\r\n try {\r\n throw new Error()\r\n } catch (e) {\r\n ;({ stack } = e as Error)\r\n }\r\n console.warn(\r\n 'Selector ' +\r\n (selector.name || 'unknown') +\r\n ' returned the root state when called. This can lead to unnecessary rerenders.' +\r\n '\\nSelectors that return the entire state are almost certainly a mistake, as they will cause a rerender whenever *anything* in state changes.',\r\n { stack }\r\n )\r\n }\r\n }\r\n if (firstRun.current) firstRun.current = false\r\n }\r\n return selected\r\n },\r\n }[selector.name],\r\n [selector, stabilityCheck, devModeChecks.stabilityCheck]\r\n )\r\n\r\n const selectedState = useSyncExternalStoreWithSelector(\r\n subscription.addNestedSub,\r\n store.getState,\r\n getServerState || store.getState,\r\n wrappedSelector,\r\n equalityFn\r\n )\r\n\r\n React.useDebugValue(selectedState)\r\n\r\n return selectedState\r\n }\r\n}\r\n\r\n/**\r\n * A hook to access the redux store's state. This hook takes a selector function\r\n * as an argument. The selector is called with the store state.\r\n *\r\n * This hook takes an optional equality comparison function as the second parameter\r\n * that allows you to customize the way the selected state is compared to determine\r\n * whether the component needs to be re-rendered.\r\n *\r\n * @param {Function} selector the selector function\r\n * @param {Function=} equalityFn the function that will be used to determine equality\r\n *\r\n * @returns {any} the selected state\r\n *\r\n * @example\r\n *\r\n * import React from 'react'\r\n * import { useSelector } from 'react-redux'\r\n *\r\n * export const CounterComponent = () => {\r\n * const counter = useSelector(state => state.counter)\r\n * return <div>{counter}</div>\r\n * }\r\n */\r\nexport const useSelector = /*#__PURE__*/ createSelectorHook()\r\n","import type { ElementType, MemoExoticComponent, ReactElement } from 'react'\r\n\r\n// Directly ported from:\r\n// https://unpkg.com/browse/react-is@18.3.0-canary-ee68446ff-20231115/cjs/react-is.production.js\r\n// It's very possible this could change in the future, but given that\r\n// we only use these in `connect`, this is a low priority.\r\n\r\nconst REACT_ELEMENT_TYPE = Symbol.for('react.element')\r\nconst REACT_PORTAL_TYPE = Symbol.for('react.portal')\r\nconst REACT_FRAGMENT_TYPE = Symbol.for('react.fragment')\r\nconst REACT_STRICT_MODE_TYPE = Symbol.for('react.strict_mode')\r\nconst REACT_PROFILER_TYPE = Symbol.for('react.profiler')\r\nconst REACT_PROVIDER_TYPE = Symbol.for('react.provider')\r\nconst REACT_CONTEXT_TYPE = Symbol.for('react.context')\r\nconst REACT_SERVER_CONTEXT_TYPE = Symbol.for('react.server_context')\r\nconst REACT_FORWARD_REF_TYPE = Symbol.for('react.forward_ref')\r\nconst REACT_SUSPENSE_TYPE = Symbol.for('react.suspense')\r\nconst REACT_SUSPENSE_LIST_TYPE = Symbol.for('react.suspense_list')\r\nconst REACT_MEMO_TYPE = Symbol.for('react.memo')\r\nconst REACT_LAZY_TYPE = Symbol.for('react.lazy')\r\nconst REACT_OFFSCREEN_TYPE = Symbol.for('react.offscreen')\r\nconst REACT_CLIENT_REFERENCE = Symbol.for('react.client.reference')\r\n\r\nexport const ForwardRef = REACT_FORWARD_REF_TYPE\r\nexport const Memo = REACT_MEMO_TYPE\r\n\r\nexport function isValidElementType(type: any): type is ElementType {\r\n if (typeof type === 'string' || typeof type === 'function') {\r\n return true\r\n } // Note: typeof might be other than 'symbol' or 'number' (e.g. if it's a polyfill).\r\n\r\n if (\r\n type === REACT_FRAGMENT_TYPE ||\r\n type === REACT_PROFILER_TYPE ||\r\n type === REACT_STRICT_MODE_TYPE ||\r\n type === REACT_SUSPENSE_TYPE ||\r\n type === REACT_SUSPENSE_LIST_TYPE ||\r\n type === REACT_OFFSCREEN_TYPE\r\n ) {\r\n return true\r\n }\r\n\r\n if (typeof type === 'object' && type !== null) {\r\n if (\r\n type.$$typeof === REACT_LAZY_TYPE ||\r\n type.$$typeof === REACT_MEMO_TYPE ||\r\n type.$$typeof === REACT_PROVIDER_TYPE ||\r\n type.$$typeof === REACT_CONTEXT_TYPE ||\r\n type.$$typeof === REACT_FORWARD_REF_TYPE || // This needs to include all possible module reference object\r\n // types supported by any Flight configuration anywhere since\r\n // we don't know which Flight build this will end up being used\r\n // with.\r\n type.$$typeof === REACT_CLIENT_REFERENCE ||\r\n type.getModuleId !== undefined\r\n ) {\r\n return true\r\n }\r\n }\r\n\r\n return false\r\n}\r\n\r\nfunction typeOf(object: any): symbol | undefined {\r\n if (typeof object === 'object' && object !== null) {\r\n const $$typeof = object.$$typeof\r\n\r\n switch ($$typeof) {\r\n case REACT_ELEMENT_TYPE: {\r\n const type = object.type\r\n\r\n switch (type) {\r\n case REACT_FRAGMENT_TYPE:\r\n case REACT_PROFILER_TYPE:\r\n case REACT_STRICT_MODE_TYPE:\r\n case REACT_SUSPENSE_TYPE:\r\n case REACT_SUSPENSE_LIST_TYPE:\r\n return type\r\n\r\n default: {\r\n const $$typeofType = type && type.$$typeof\r\n\r\n switch ($$typeofType) {\r\n case REACT_SERVER_CONTEXT_TYPE:\r\n case REACT_CONTEXT_TYPE:\r\n case REACT_FORWARD_REF_TYPE:\r\n case REACT_LAZY_TYPE:\r\n case REACT_MEMO_TYPE:\r\n case REACT_PROVIDER_TYPE:\r\n return $$typeofType\r\n\r\n default:\r\n return $$typeof\r\n }\r\n }\r\n }\r\n }\r\n\r\n case REACT_PORTAL_TYPE: {\r\n return $$typeof\r\n }\r\n }\r\n }\r\n\r\n return undefined\r\n}\r\n\r\nexport function isContextConsumer(object: any): object is ReactElement {\r\n return typeOf(object) === REACT_CONTEXT_TYPE\r\n}\r\n\r\nexport function isMemo(object: any): object is MemoExoticComponent<any> {\r\n return typeOf(object) === REACT_MEMO_TYPE\r\n}\r\n","/**\r\n * Prints a warning in the console if it exists.\r\n *\r\n * @param {String} message The warning message.\r\n * @returns {void}\r\n */\r\nexport default function warning(message: string) {\r\n /* eslint-disable no-console */\r\n if (typeof console !== 'undefined' && typeof console.error === 'function') {\r\n console.error(message)\r\n }\r\n /* eslint-enable no-console */\r\n try {\r\n // This error was thrown as a convenience so that if you enable\r\n // \"break on all exceptions\" in your console,\r\n // it would pause the execution at this line.\r\n throw new Error(message)\r\n /* eslint-disable no-empty */\r\n } catch (e) {}\r\n /* eslint-enable no-empty */\r\n}\r\n","import warning from '../utils/warning'\r\n\r\nfunction verify(selector: unknown, methodName: string): void {\r\n if (!selector) {\r\n throw new Error(`Unexpected value for ${methodName} in connect.`)\r\n } else if (\r\n methodName === 'mapStateToProps' ||\r\n methodName === 'mapDispatchToProps'\r\n ) {\r\n if (!Object.prototype.hasOwnProperty.call(selector, 'dependsOnOwnProps')) {\r\n warning(\r\n `The selector for ${methodName} of connect did not specify a value for dependsOnOwnProps.`\r\n )\r\n }\r\n }\r\n}\r\n\r\nexport default function verifySubselectors(\r\n mapStateToProps: unknown,\r\n mapDispatchToProps: unknown,\r\n mergeProps: unknown\r\n): void {\r\n verify(mapStateToProps, 'mapStateToProps')\r\n verify(mapDispatchToProps, 'mapDispatchToProps')\r\n verify(mergeProps, 'mergeProps')\r\n}\r\n","import type { Dispatch, Action } from 'redux'\r\nimport type { ComponentType } from 'react'\r\nimport verifySubselectors from './verifySubselectors'\r\nimport type { EqualityFn, ExtendedEqualityFn } from '../types'\r\n\r\nexport type SelectorFactory<S, TProps, TOwnProps, TFactoryOptions> = (\r\n dispatch: Dispatch<Action<string>>,\r\n factoryOptions: TFactoryOptions\r\n) => Selector<S, TProps, TOwnProps>\r\n\r\nexport type Selector<S, TProps, TOwnProps = null> = TOwnProps extends\r\n | null\r\n | undefined\r\n ? (state: S) => TProps\r\n : (state: S, ownProps: TOwnProps) => TProps\r\n\r\nexport type MapStateToProps<TStateProps, TOwnProps, State> = (\r\n state: State,\r\n ownProps: TOwnProps\r\n) => TStateProps\r\n\r\nexport type MapStateToPropsFactory<TStateProps, TOwnProps, State> = (\r\n initialState: State,\r\n ownProps: TOwnProps\r\n) => MapStateToProps<TStateProps, TOwnProps, State>\r\n\r\nexport type MapStateToPropsParam<TStateProps, TOwnProps, State> =\r\n | MapStateToPropsFactory<TStateProps, TOwnProps, State>\r\n | MapStateToProps<TStateProps, TOwnProps, State>\r\n | null\r\n | undefined\r\n\r\nexport type MapDispatchToPropsFunction<TDispatchProps, TOwnProps> = (\r\n dispatch: Dispatch<Action<string>>,\r\n ownProps: TOwnProps\r\n) => TDispatchProps\r\n\r\nexport type MapDispatchToProps<TDispatchProps, TOwnProps> =\r\n | MapDispatchToPropsFunction<TDispatchProps, TOwnProps>\r\n | TDispatchProps\r\n\r\nexport type MapDispatchToPropsFactory<TDispatchProps, TOwnProps> = (\r\n dispatch: Dispatch<Action<string>>,\r\n ownProps: TOwnProps\r\n) => MapDispatchToPropsFunction<TDispatchProps, TOwnProps>\r\n\r\nexport type MapDispatchToPropsParam<TDispatchProps, TOwnProps> =\r\n | MapDispatchToPropsFactory<TDispatchProps, TOwnProps>\r\n | MapDispatchToProps<TDispatchProps, TOwnProps>\r\n\r\nexport type MapDispatchToPropsNonObject<TDispatchProps, TOwnProps> =\r\n | MapDispatchToPropsFactory<TDispatchProps, TOwnProps>\r\n | MapDispatchToPropsFunction<TDispatchProps, TOwnProps>\r\n\r\nexport type MergeProps<TStateProps, TDispatchProps, TOwnProps, TMergedProps> = (\r\n stateProps: TStateProps,\r\n dispatchProps: TDispatchProps,\r\n ownProps: TOwnProps\r\n) => TMergedProps\r\n\r\ninterface PureSelectorFactoryComparisonOptions<TStateProps, TOwnProps, State> {\r\n readonly areStatesEqual: ExtendedEqualityFn<State, TOwnProps>\r\n readonly areStatePropsEqual: EqualityFn<TStateProps>\r\n readonly areOwnPropsEqual: EqualityFn<TOwnProps>\r\n}\r\n\r\nexport function pureFinalPropsSelectorFactory<\r\n TStateProps,\r\n TOwnProps,\r\n TDispatchProps,\r\n TMergedProps,\r\n State\r\n>(\r\n mapStateToProps: WrappedMapStateToProps<TStateProps, TOwnProps, State>,\r\n mapDispatchToProps: WrappedMapDispatchToProps<TDispatchProps, TOwnProps>,\r\n mergeProps: MergeProps<TStateProps, TDispatchProps, TOwnProps, TMergedProps>,\r\n dispatch: Dispatch<Action<string>>,\r\n {\r\n areStatesEqual,\r\n areOwnPropsEqual,\r\n areStatePropsEqual,\r\n }: PureSelectorFactoryComparisonOptions<TStateProps, TOwnProps, State>\r\n) {\r\n let hasRunAtLeastOnce = false\r\n let state: State\r\n let ownProps: TOwnProps\r\n let stateProps: TStateProps\r\n let dispatchProps: TDispatchProps\r\n let mergedProps: TMergedProps\r\n\r\n function handleFirstCall(firstState: State, firstOwnProps: TOwnProps) {\r\n state = firstState\r\n ownProps = firstOwnProps\r\n stateProps = mapStateToProps(state, ownProps)\r\n dispatchProps = mapDispatchToProps(dispatch, ownProps)\r\n mergedProps = mergeProps(stateProps, dispatchProps, ownProps)\r\n hasRunAtLeastOnce = true\r\n return mergedProps\r\n }\r\n\r\n function handleNewPropsAndNewState() {\r\n stateProps = mapStateToProps(state, ownProps)\r\n\r\n if (mapDispatchToProps.dependsOnOwnProps)\r\n dispatchProps = mapDispatchToProps(dispatch, ownProps)\r\n\r\n mergedProps = mergeProps(stateProps, dispatchProps, ownProps)\r\n return mergedProps\r\n }\r\n\r\n function handleNewProps() {\r\n if (mapStateToProps.dependsOnOwnProps)\r\n stateProps = mapStateToProps(state, ownProps)\r\n\r\n if (mapDispatchToProps.dependsOnOwnProps)\r\n dispatchProps = mapDispatchToProps(dispatch, ownProps)\r\n\r\n mergedProps = mergeProps(stateProps, dispatchProps, ownProps)\r\n return mergedProps\r\n }\r\n\r\n function handleNewState() {\r\n const nextStateProps = mapStateToProps(state, ownProps)\r\n const statePropsChanged = !areStatePropsEqual(nextStateProps, stateProps)\r\n stateProps = nextStateProps\r\n\r\n if (statePropsChanged)\r\n mergedProps = mergeProps(stateProps, dispatchProps, ownProps)\r\n\r\n return mergedProps\r\n }\r\n\r\n function handleSubsequentCalls(nextState: State, nextOwnProps: TOwnProps) {\r\n const propsChanged = !areOwnPropsEqual(nextOwnProps, ownProps)\r\n const stateChanged = !areStatesEqual(\r\n nextState,\r\n state,\r\n nextOwnProps,\r\n ownProps\r\n )\r\n state = nextState\r\n ownProps = nextOwnProps\r\n\r\n if (propsChanged && stateChanged) return handleNewPropsAndNewState()\r\n if (propsChanged) return handleNewProps()\r\n if (stateChanged) return handleNewState()\r\n return mergedProps\r\n }\r\n\r\n return function pureFinalPropsSelector(\r\n nextState: State,\r\n nextOwnProps: TOwnProps\r\n ) {\r\n return hasRunAtLeastOnce\r\n ? handleSubsequentCalls(nextState, nextOwnProps)\r\n : handleFirstCall(nextState, nextOwnProps)\r\n }\r\n}\r\n\r\ninterface WrappedMapStateToProps<TStateProps, TOwnProps, State> {\r\n (state: State, ownProps: TOwnProps): TStateProps\r\n readonly dependsOnOwnProps: boolean\r\n}\r\n\r\ninterface WrappedMapDispatchToProps<TDispatchProps, TOwnProps> {\r\n (dispatch: Dispatch<Action<string>>, ownProps: TOwnProps): TDispatchProps\r\n readonly dependsOnOwnProps: boolean\r\n}\r\n\r\nexport interface InitOptions<TStateProps, TOwnProps, TMergedProps, State>\r\n extends PureSelectorFactoryComparisonOptions<TStateProps, TOwnProps, State> {\r\n readonly shouldHandleStateChanges: boolean\r\n readonly displayName: string\r\n readonly wrappedComponentName: string\r\n readonly WrappedComponent: ComponentType<TOwnProps>\r\n readonly areMergedPropsEqual: EqualityFn<TMergedProps>\r\n}\r\n\r\nexport interface SelectorFactoryOptions<\r\n TStateProps,\r\n TOwnProps,\r\n TDispatchProps,\r\n TMergedProps,\r\n State\r\n> extends InitOptions<TStateProps, TOwnProps, TMergedProps, State> {\r\n readonly initMapStateToProps: (\r\n dispatch: Dispatch<Action<string>>,\r\n options: InitOptions<TStateProps, TOwnProps, TMergedProps, State>\r\n ) => WrappedMapStateToProps<TStateProps, TOwnProps, State>\r\n readonly initMapDispatchToProps: (\r\n dispatch: Dispatch<Action<string>>,\r\n options: InitOptions<TStateProps, TOwnProps, TMergedProps, State>\r\n ) => WrappedMapDispatchToProps<TDispatchProps, TOwnProps>\r\n readonly initMergeProps: (\r\n dispatch: Dispatch<Action<string>>,\r\n options: InitOptions<TStateProps, TOwnProps, TMergedProps, State>\r\n ) => MergeProps<TStateProps, TDispatchProps, TOwnProps, TMergedProps>\r\n}\r\n\r\n// TODO: Add more comments\r\n\r\n// The selector returned by selectorFactory will memoize its results,\r\n// allowing connect's shouldComponentUpdate to return false if final\r\n// props have not changed.\r\n\r\nexport default function finalPropsSelectorFactory<\r\n TStateProps,\r\n TOwnProps,\r\n TDispatchProps,\r\n TMergedProps,\r\n State\r\n>(\r\n dispatch: Dispatch<Action<string>>,\r\n {\r\n initMapStateToProps,\r\n initMapDispatchToProps,\r\n initMergeProps,\r\n ...options\r\n }: SelectorFactoryOptions<\r\n TStateProps,\r\n TOwnProps,\r\n TDispatchProps,\r\n TMergedProps,\r\n State\r\n >\r\n) {\r\n const mapStateToProps = initMapStateToProps(dispatch, options)\r\n const mapDispatchToProps = initMapDispatchToProps(dispatch, options)\r\n const mergeProps = initMergeProps(dispatch, options)\r\n\r\n if (process.env.NODE_ENV !== 'production') {\r\n verifySubselectors(mapStateToProps, mapDispatchToProps, mergeProps)\r\n }\r\n\r\n return pureFinalPropsSelectorFactory<\r\n TStateProps,\r\n TOwnProps,\r\n TDispatchProps,\r\n TMergedProps,\r\n State\r\n >(mapStateToProps, mapDispatchToProps, mergeProps, dispatch, options)\r\n}\r\n","import type { ActionCreatorsMapObject, Dispatch } from 'redux'\r\n\r\nexport default function bindActionCreators(\r\n actionCreators: ActionCreatorsMapObject,\r\n dispatch: Dispatch\r\n): ActionCreatorsMapObject {\r\n const boundActionCreators: ActionCreatorsMapObject = {}\r\n\r\n for (const key in actionCreators) {\r\n const actionCreator = actionCreators[key]\r\n if (typeof actionCreator === 'function') {\r\n boundActionCreators[key] = (...args) => dispatch(actionCreator(...args))\r\n }\r\n }\r\n return boundActionCreators\r\n}\r\n","/**\r\n * @param {any} obj The object to inspect.\r\n * @returns {boolean} True if the argument appears to be a plain object.\r\n */\r\nexport default function isPlainObject(obj: unknown) {\r\n if (typeof obj !== 'object' || obj === null) return false\r\n\r\n let proto = Object.getPrototypeOf(obj)\r\n if (proto === null) return true\r\n\r\n let baseProto = proto\r\n while (Object.getPrototypeOf(baseProto) !== null) {\r\n baseProto = Object.getPrototypeOf(baseProto)\r\n }\r\n\r\n return proto === baseProto\r\n}\r\n","import isPlainObject from './isPlainObject'\r\nimport warning from './warning'\r\n\r\nexport default function verifyPlainObject(\r\n value: unknown,\r\n displayName: string,\r\n methodName: string\r\n) {\r\n if (!isPlainObject(value)) {\r\n warning(\r\n `${methodName}() in ${displayName} must return a plain object. Instead received ${value}.`\r\n )\r\n }\r\n}\r\n","import type { ActionCreatorsMapObject, Dispatch, ActionCreator } from 'redux'\r\n\r\nimport type { FixTypeLater } from '../types'\r\nimport verifyPlainObject from '../utils/verifyPlainObject'\r\n\r\ntype AnyState = { [key: string]: any }\r\ntype StateOrDispatch<S extends AnyState = AnyState> = S | Dispatch\r\n\r\ntype AnyProps = { [key: string]: any }\r\n\r\nexport type MapToProps<P extends AnyProps = AnyProps> = {\r\n // eslint-disable-next-line no-unused-vars\r\n (stateOrDispatch: StateOrDispatch, ownProps?: P): FixTypeLater\r\n dependsOnOwnProps?: boolean\r\n}\r\n\r\nexport function wrapMapToPropsConstant(\r\n // * Note:\r\n // It seems that the dispatch argument\r\n // could be a dispatch function in some cases (ex: whenMapDispatchToPropsIsMissing)\r\n // and a state object in some others (ex: whenMapStateToPropsIsMissing)\r\n // eslint-disable-next-line no-unused-vars\r\n getConstant: (dispatch: Dispatch) =>\r\n | {\r\n dispatch?: Dispatch\r\n dependsOnOwnProps?: boolean\r\n }\r\n | ActionCreatorsMapObject\r\n | ActionCreator<any>\r\n) {\r\n return function initConstantSelector(dispatch: Dispatch) {\r\n const constant = getConstant(dispatch)\r\n\r\n function constantSelector() {\r\n return constant\r\n }\r\n constantSelector.dependsOnOwnProps = false\r\n return constantSelector\r\n }\r\n}\r\n\r\n// dependsOnOwnProps is used by createMapToPropsProxy to determine whether to pass props as args\r\n// to the mapToProps function being wrapped. It is also used by makePurePropsSelector to determine\r\n// whether mapToProps needs to be invoked when props have changed.\r\n//\r\n// A length of one signals that mapToProps does not depend on props from the parent component.\r\n// A length of zero is assumed to mean mapToProps is getting args via arguments or ...args and\r\n// therefore not reporting its length accurately..\r\n// TODO Can this get pulled out so that we can subscribe directly to the store if we don't need ownProps?\r\nexport function getDependsOnOwnProps(mapToProps: MapToProps) {\r\n return mapToProps.dependsOnOwnProps\r\n ? Boolean(mapToProps.dependsOnOwnProps)\r\n : mapToProps.length !== 1\r\n}\r\n\r\n// Used by whenMapStateToPropsIsFunction and whenMapDispatchToPropsIsFunction,\r\n// this function wraps mapToProps in a proxy function which does several things:\r\n//\r\n// * Detects whether the mapToProps function being called depends on props, which\r\n// is used by selectorFactory to decide if it should reinvoke on props changes.\r\n//\r\n// * On first call, handles mapToProps if returns another function, and treats that\r\n// new function as the true mapToProps for subsequent calls.\r\n//\r\n// * On first call, verifies the first result is a plain object, in order to warn\r\n// the developer that their mapToProps function is not returning a valid result.\r\n//\r\nexport function wrapMapToPropsFunc<P extends AnyProps = AnyProps>(\r\n mapToProps: MapToProps,\r\n methodName: string\r\n) {\r\n return function initProxySelector(\r\n dispatch: Dispatch,\r\n { displayName }: { displayName: string }\r\n ) {\r\n const proxy = function mapToPropsProxy(\r\n stateOrDispatch: StateOrDispatch,\r\n ownProps?: P\r\n ): MapToProps {\r\n return proxy.dependsOnOwnProps\r\n ? proxy.mapToProps(stateOrDispatch, ownProps)\r\n : proxy.mapToProps(stateOrDispatch, undefined)\r\n }\r\n\r\n // allow detectFactoryAndVerify to get ownProps\r\n proxy.dependsOnOwnProps = true\r\n\r\n proxy.mapToProps = function detectFactoryAndVerify(\r\n stateOrDispatch: StateOrDispatch,\r\n ownProps?: P\r\n ): MapToProps {\r\n proxy.mapToProps = mapToProps\r\n proxy.dependsOnOwnProps = getDependsOnOwnProps(mapToProps)\r\n let props = proxy(stateOrDispatch, ownProps)\r\n\r\n if (typeof props === 'function') {\r\n proxy.mapToProps = props\r\n proxy.dependsOnOwnProps = getDependsOnOwnProps(props)\r\n props = proxy(stateOrDispatch, ownProps)\r\n }\r\n\r\n if (process.env.NODE_ENV !== 'production')\r\n verifyPlainObject(props, displayName, methodName)\r\n\r\n return props\r\n }\r\n\r\n return proxy\r\n }\r\n}\r\n","import type { Action, Dispatch } from 'redux'\r\n\r\nexport function createInvalidArgFactory(arg: unknown, name: string) {\r\n return (\r\n dispatch: Dispatch<Action<string>>,\r\n options: { readonly wrappedComponentName: string }\r\n ) => {\r\n throw new Error(\r\n `Invalid value of type ${typeof arg} for ${name} argument when connecting component ${\r\n options.wrappedComponentName\r\n }.`\r\n )\r\n }\r\n}\r\n","import type { Action, Dispatch } from 'redux'\r\nimport bindActionCreators from '../utils/bindActionCreators'\r\nimport { wrapMapToPropsConstant, wrapMapToPropsFunc } from './wrapMapToProps'\r\nimport { createInvalidArgFactory } from './invalidArgFactory'\r\nimport type { MapDispatchToPropsParam } from './selectorFactory'\r\n\r\nexport function mapDispatchToPropsFactory<TDispatchProps, TOwnProps>(\r\n mapDispatchToProps:\r\n | MapDispatchToPropsParam<TDispatchProps, TOwnProps>\r\n | undefined\r\n) {\r\n return mapDispatchToProps && typeof mapDispatchToProps === 'object'\r\n ? wrapMapToPropsConstant((dispatch: Dispatch<Action<string>>) =>\r\n // @ts-ignore\r\n bindActionCreators(mapDispatchToProps, dispatch)\r\n )\r\n : !mapDispatchToProps\r\n ? wrapMapToPropsConstant((dispatch: Dispatch<Action<string>>) => ({\r\n dispatch,\r\n }))\r\n : typeof mapDispatchToProps === 'function'\r\n ? // @ts-ignore\r\n wrapMapToPropsFunc(mapDispatchToProps, 'mapDispatchToProps')\r\n : createInvalidArgFactory(mapDispatchToProps, 'mapDispatchToProps')\r\n}\r\n","import { wrapMapToPropsConstant, wrapMapToPropsFunc } from './wrapMapToProps'\r\nimport { createInvalidArgFactory } from './invalidArgFactory'\r\nimport type { MapStateToPropsParam } from './selectorFactory'\r\n\r\nexport function mapStateToPropsFactory<TStateProps, TOwnProps, State>(\r\n mapStateToProps: MapStateToPropsParam<TStateProps, TOwnProps, State>\r\n) {\r\n return !mapStateToProps\r\n ? wrapMapToPropsConstant(() => ({}))\r\n : typeof mapStateToProps === 'function'\r\n ? // @ts-ignore\r\n wrapMapToPropsFunc(mapStateToProps, 'mapStateToProps')\r\n : createInvalidArgFactory(mapStateToProps, 'mapStateToProps')\r\n}\r\n","import type { Action, Dispatch } from 'redux'\r\nimport verifyPlainObject from '../utils/verifyPlainObject'\r\nimport { createInvalidArgFactory } from './invalidArgFactory'\r\nimport type { MergeProps } from './selectorFactory'\r\nimport type { EqualityFn } from '../types'\r\n\r\nexport function defaultMergeProps<\r\n TStateProps,\r\n TDispatchProps,\r\n TOwnProps,\r\n TMergedProps\r\n>(\r\n stateProps: TStateProps,\r\n dispatchProps: TDispatchProps,\r\n ownProps: TOwnProps\r\n): TMergedProps {\r\n // @ts-ignore\r\n return { ...ownProps, ...stateProps, ...dispatchProps }\r\n}\r\n\r\nexport function wrapMergePropsFunc<\r\n TStateProps,\r\n TDispatchProps,\r\n TOwnProps,\r\n TMergedProps\r\n>(\r\n mergeProps: MergeProps<TStateProps, TDispatchProps, TOwnProps, TMergedProps>\r\n): (\r\n dispatch: Dispatch<Action<string>>,\r\n options: {\r\n readonly displayName: string\r\n readonly areMergedPropsEqual: EqualityFn<TMergedProps>\r\n }\r\n) => MergeProps<TStateProps, TDispatchProps, TOwnProps, TMergedProps> {\r\n return function initMergePropsProxy(\r\n dispatch,\r\n { displayName, areMergedPropsEqual }\r\n ) {\r\n let hasRunOnce = false\r\n let mergedProps: TMergedProps\r\n\r\n return function mergePropsProxy(\r\n stateProps: TStateProps,\r\n dispatchProps: TDispatchProps,\r\n ownProps: TOwnProps\r\n ) {\r\n const nextMergedProps = mergeProps(stateProps, dispatchProps, ownProps)\r\n\r\n if (hasRunOnce) {\r\n if (!areMergedPropsEqual(nextMergedProps, mergedProps))\r\n mergedProps = nextMergedProps\r\n } else {\r\n hasRunOnce = true\r\n mergedProps = nextMergedProps\r\n\r\n if (process.env.NODE_ENV !== 'production')\r\n verifyPlainObject(mergedProps, displayName, 'mergeProps')\r\n }\r\n\r\n return mergedProps\r\n }\r\n }\r\n}\r\n\r\nexport function mergePropsFactory<\r\n TStateProps,\r\n TDispatchProps,\r\n TOwnProps,\r\n TMergedProps\r\n>(\r\n mergeProps?: MergeProps<TStateProps, TDispatchProps, TOwnProps, TMergedProps>\r\n) {\r\n return !mergeProps\r\n ? () => defaultMergeProps\r\n : typeof mergeProps === 'function'\r\n ? wrapMergePropsFunc(mergeProps)\r\n : createInvalidArgFactory(mergeProps, 'mergeProps')\r\n}\r\n","// Default to a dummy \"batch\" implementation that just runs the callback\r\nfunction defaultNoopBatch(callback: () => void) {\r\n callback()\r\n}\r\n\r\nlet batch = defaultNoopBatch\r\n\r\n// Allow injecting another batching function later\r\nexport const setBatch = (newBatch: typeof defaultNoopBatch) =>\r\n (batch = newBatch)\r\n\r\n// Supply a getter just to skip dealing with ESM bindings\r\nexport const getBatch = () => batch\r\n","import { getBatch } from './batch'\r\n\r\n// encapsulates the subscription logic for connecting a component to the redux store, as\r\n// well as nesting subscriptions of descendant components, so that we can ensure the\r\n// ancestor components re-render before descendants\r\n\r\ntype VoidFunc = () => void\r\n\r\ntype Listener = {\r\n callback: VoidFunc\r\n next: Listener | null\r\n prev: Listener | null\r\n}\r\n\r\nfunction createListenerCollection() {\r\n const batch = getBatch()\r\n let first: Listener | null = null\r\n let last: Listener | null = null\r\n\r\n return {\r\n clear() {\r\n first = null\r\n last = null\r\n },\r\n\r\n notify() {\r\n batch(() => {\r\n let listener = first\r\n while (listener) {\r\n listener.callback()\r\n listener = listener.next\r\n }\r\n })\r\n },\r\n\r\n get() {\r\n let listeners: Listener[] = []\r\n let listener = first\r\n while (listener) {\r\n listeners.push(listener)\r\n listener = listener.next\r\n }\r\n return listeners\r\n },\r\n\r\n subscribe(callback: () => void) {\r\n let isSubscribed = true\r\n\r\n let listener: Listener = (last = {\r\n callback,\r\n next: null,\r\n prev: last,\r\n })\r\n\r\n if (listener.prev) {\r\n listener.prev.next = listener\r\n } else {\r\n first = listener\r\n }\r\n\r\n return function unsubscribe() {\r\n if (!isSubscribed || first === null) return\r\n isSubscribed = false\r\n\r\n if (listener.next) {\r\n listener.next.prev = listener.prev\r\n } else {\r\n last = listener.prev\r\n }\r\n if (listener.prev) {\r\n listener.prev.next = listener.next\r\n } else {\r\n first = listener.next\r\n }\r\n }\r\n },\r\n }\r\n}\r\n\r\ntype ListenerCollection = ReturnType<typeof createListenerCollection>\r\n\r\nexport interface Subscription {\r\n addNestedSub: (listener: VoidFunc) => VoidFunc\r\n notifyNestedSubs: VoidFunc\r\n handleChangeWrapper: VoidFunc\r\n isSubscribed: () => boolean\r\n onStateChange?: VoidFunc | null\r\n trySubscribe: VoidFunc\r\n tryUnsubscribe: VoidFunc\r\n getListeners: () => ListenerCollection\r\n}\r\n\r\nconst nullListeners = {\r\n notify() {},\r\n get: () => [],\r\n} as unknown as ListenerCollection\r\n\r\nexport function createSubscription(store: any, parentSub?: Subscription) {\r\n let unsubscribe: VoidFunc | undefined\r\n let listeners: ListenerCollection = nullListeners\r\n\r\n // Reasons to keep the subscription active\r\n let subscriptionsAmount = 0\r\n\r\n // Is this specific subscription subscribed (or only nested ones?)\r\n let selfSubscribed = false\r\n\r\n function addNestedSub(listener: () => void) {\r\n trySubscribe()\r\n\r\n const cleanupListener = listeners.subscribe(listener)\r\n\r\n // cleanup nested sub\r\n let removed = false\r\n return () => {\r\n if (!removed) {\r\n removed = true\r\n cleanupListener()\r\n tryUnsubscribe()\r\n }\r\n }\r\n }\r\n\r\n function notifyNestedSubs() {\r\n listeners.notify()\r\n }\r\n\r\n function handleChangeWrapper() {\r\n if (subscription.onStateChange) {\r\n subscription.onStateChange()\r\n }\r\n }\r\n\r\n function isSubscribed() {\r\n return selfSubscribed\r\n }\r\n\r\n function trySubscribe() {\r\n subscriptionsAmount++\r\n if (!unsubscribe) {\r\n unsubscribe = parentSub\r\n ? parentSub.addNestedSub(handleChangeWrapper)\r\n : store.subscribe(handleChangeWrapper)\r\n\r\n listeners = createListenerCollection()\r\n }\r\n }\r\n\r\n function tryUnsubscribe() {\r\n subscriptionsAmount--\r\n if (unsubscribe && subscriptionsAmount === 0) {\r\n unsubscribe()\r\n unsubscribe = undefined\r\n listeners.clear()\r\n listeners = nullListeners\r\n }\r\n }\r\n\r\n function trySubscribeSelf() {\r\n if (!selfSubscribed) {\r\n selfSubscribed = true\r\n trySubscribe()\r\n }\r\n }\r\n\r\n function tryUnsubscribeSelf() {\r\n if (selfSubscribed) {\r\n selfSubscribed = false\r\n tryUnsubscribe()\r\n }\r\n }\r\n\r\n const subscription: Subscription = {\r\n addNestedSub,\r\n notifyNestedSubs,\r\n handleChangeWrapper,\r\n isSubscribed,\r\n trySubscribe: trySubscribeSelf,\r\n tryUnsubscribe: tryUnsubscribeSelf,\r\n getListeners: () => listeners,\r\n }\r\n\r\n return subscription\r\n}\r\n","import { React } from '../utils/react'\r\n\r\n// React currently throws a warning when using useLayoutEffect on the server.\r\n// To get around it, we can conditionally useEffect on the server (no-op) and\r\n// useLayoutEffect in the browser. We need useLayoutEffect to ensure the store\r\n// subscription callback always has the selector from the latest render commit\r\n// available, otherwise a store update may happen between render and the effect,\r\n// which may cause missed updates; we also must ensure the store subscription\r\n// is created synchronously, otherwise a store update may occur before the\r\n// subscription is created and an inconsistent state may be observed\r\n\r\n// Matches logic in React's `shared/ExecutionEnvironment` file\r\nexport const canUseDOM = !!(\r\n typeof window !== 'undefined' &&\r\n typeof window.document !== 'undefined' &&\r\n typeof window.document.createElement !== 'undefined'\r\n)\r\n\r\nexport const useIsomorphicLayoutEffect = canUseDOM\r\n ? React.useLayoutEffect\r\n : React.useEffect\r\n","function is(x: unknown, y: unknown) {\r\n if (x === y) {\r\n return x !== 0 || y !== 0 || 1 / x === 1 / y\r\n } else {\r\n return x !== x && y !== y\r\n }\r\n}\r\n\r\nexport default function shallowEqual(objA: any, objB: any) {\r\n if (is(objA, objB)) return true\r\n\r\n if (\r\n typeof objA !== 'object' ||\r\n objA === null ||\r\n typeof objB !== 'object' ||\r\n objB === null\r\n ) {\r\n return false\r\n }\r\n\r\n const keysA = Object.keys(objA)\r\n const keysB = Object.keys(objB)\r\n\r\n if (keysA.length !== keysB.length) return false\r\n\r\n for (let i = 0; i < keysA.length; i++) {\r\n if (\r\n !Object.prototype.hasOwnProperty.call(objB, keysA[i]) ||\r\n !is(objA[keysA[i]], objB[keysA[i]])\r\n ) {\r\n return false\r\n }\r\n }\r\n\r\n return true\r\n}\r\n","// Copied directly from:\r\n// https://github.com/mridgway/hoist-non-react-statics/blob/main/src/index.js\r\n// https://unpkg.com/browse/@types/hoist-non-react-statics@3.3.1/index.d.ts\r\n\r\n/**\r\n * Copyright 2015, Yahoo! Inc.\r\n * Copyrights licensed under the New BSD License. See the accompanying LICENSE file for terms.\r\n */\r\nimport type * as React from 'react'\r\nimport { ForwardRef, Memo, isMemo } from '../utils/react-is'\r\n\r\nconst REACT_STATICS = {\r\n childContextTypes: true,\r\n contextType: true,\r\n contextTypes: true,\r\n defaultProps: true,\r\n displayName: true,\r\n getDefaultProps: true,\r\n getDerivedStateFromError: true,\r\n getDerivedStateFromProps: true,\r\n mixins: true,\r\n propTypes: true,\r\n type: true,\r\n} as const\r\n\r\nconst KNOWN_STATICS = {\r\n name: true,\r\n length: true,\r\n prototype: true,\r\n caller: true,\r\n callee: true,\r\n arguments: true,\r\n arity: true,\r\n} as const\r\n\r\nconst FORWARD_REF_STATICS = {\r\n $$typeof: true,\r\n render: true,\r\n defaultProps: true,\r\n displayName: true,\r\n propTypes: true,\r\n} as const\r\n\r\nconst MEMO_STATICS = {\r\n $$typeof: true,\r\n compare: true,\r\n defaultProps: true,\r\n displayName: true,\r\n propTypes: true,\r\n type: true,\r\n} as const\r\n\r\nconst TYPE_STATICS = {\r\n [ForwardRef]: FORWARD_REF_STATICS,\r\n [Memo]: MEMO_STATICS,\r\n} as const\r\n\r\nfunction getStatics(component: any) {\r\n // React v16.11 and below\r\n if (isMemo(component)) {\r\n return MEMO_STATICS\r\n }\r\n\r\n // React v16.12 and above\r\n return TYPE_STATICS[component['$$typeof']] || REACT_STATICS\r\n}\r\n\r\nexport type NonReactStatics<\r\n S extends React.ComponentType<any>,\r\n C extends {\r\n [key: string]: true\r\n } = {}\r\n> = {\r\n [key in Exclude<\r\n keyof S,\r\n S extends React.MemoExoticComponent<any>\r\n ? keyof typeof MEMO_STATICS | keyof C\r\n : S extends React.ForwardRefExoticComponent<any>\r\n ? keyof typeof FORWARD_REF_STATICS | keyof C\r\n : keyof typeof REACT_STATICS | keyof typeof KNOWN_STATICS | keyof C\r\n >]: S[key]\r\n}\r\n\r\nconst defineProperty = Object.defineProperty\r\nconst getOwnPropertyNames = Object.getOwnPropertyNames\r\nconst getOwnPropertySymbols = Object.getOwnPropertySymbols\r\nconst getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor\r\nconst getPrototypeOf = Object.getPrototypeOf\r\nconst objectPrototype = Object.prototype\r\n\r\nexport default function hoistNonReactStatics<\r\n T extends React.ComponentType<any>,\r\n S extends React.ComponentType<any>,\r\n C extends {\r\n [key: string]: true\r\n } = {}\r\n>(targetComponent: T, sourceComponent: S): T & NonReactStatics<S, C> {\r\n if (typeof sourceComponent !== 'string') {\r\n // don't hoist over string (html) components\r\n\r\n if (objectPrototype) {\r\n const inheritedComponent = getPrototypeOf(sourceComponent)\r\n if (inheritedComponent && inheritedComponent !== objectPrototype) {\r\n hoistNonReactStatics(targetComponent, inheritedComponent)\r\n }\r\n }\r\n\r\n let keys: (string | symbol)[] = getOwnPropertyNames(sourceComponent)\r\n\r\n if (getOwnPropertySymbols) {\r\n keys = keys.concat(getOwnPropertySymbols(sourceComponent))\r\n }\r\n\r\n const targetStatics = getStatics(targetComponent)\r\n const sourceStatics = getStatics(sourceComponent)\r\n\r\n for (let i = 0; i < keys.length; ++i) {\r\n const key = keys[i]\r\n if (\r\n !KNOWN_STATICS[key as keyof typeof KNOWN_STATICS] &&\r\n !(sourceStatics && sourceStatics[key as keyof typeof sourceStatics]) &&\r\n !(targetStatics && targetStatics[key as keyof typeof targetStatics])\r\n ) {\r\n const descriptor = getOwnPropertyDescriptor(sourceComponent, key)\r\n try {\r\n // Avoid failures from read-only properties\r\n defineProperty(targetComponent, key, descriptor!)\r\n } catch (e) {\r\n // ignore\r\n }\r\n }\r\n }\r\n }\r\n\r\n return targetComponent as any\r\n}\r\n","/* eslint-disable valid-jsdoc, @typescript-eslint/no-unused-vars */\r\nimport type { ComponentType } from 'react'\r\nimport { React } from '../utils/react'\r\nimport { isValidElementType, isContextConsumer } from '../utils/react-is'\r\n\r\nimport type { Store } from 'redux'\r\n\r\nimport type {\r\n ConnectedComponent,\r\n InferableComponentEnhancer,\r\n InferableComponentEnhancerWithProps,\r\n ResolveThunks,\r\n DispatchProp,\r\n ConnectPropsMaybeWithoutContext,\r\n} from '../types'\r\n\r\nimport type {\r\n MapStateToPropsParam,\r\n MapDispatchToPropsParam,\r\n MergeProps,\r\n MapDispatchToPropsNonObject,\r\n SelectorFactoryOptions,\r\n} from '../connect/selectorFactory'\r\nimport defaultSelectorFactory from '../connect/selectorFactory'\r\nimport { mapDispatchToPropsFactory } from '../connect/mapDispatchToProps'\r\nimport { mapStateToPropsFactory } from '../connect/mapStateToProps'\r\nimport { mergePropsFactory } from '../connect/mergeProps'\r\n\r\nimport type { Subscription } from '../utils/Subscription'\r\nimport { createSubscription } from '../utils/Subscription'\r\nimport { useIsomorphicLayoutEffect } from '../utils/useIsomorphicLayoutEffect'\r\nimport shallowEqual from '../utils/shallowEqual'\r\nimport hoistStatics from '../utils/hoistStatics'\r\nimport warning from '../utils/warning'\r\n\r\nimport type {\r\n ReactReduxContextValue,\r\n ReactReduxContextInstance,\r\n} from './Context'\r\nimport { ReactReduxContext } from './Context'\r\n\r\nimport type { uSES } from '../utils/useSyncExternalStore'\r\nimport { notInitialized } from '../utils/useSyncExternalStore'\r\n\r\nlet useSyncExternalStore = notInitialized as uSES\r\nexport const initializeConnect = (fn: uSES) => {\r\n useSyncExternalStore = fn\r\n}\r\n\r\n// Define some constant arrays just to avoid re-creating these\r\nconst EMPTY_ARRAY: [unknown, number] = [null, 0]\r\nconst NO_SUBSCRIPTION_ARRAY = [null, null]\r\n\r\n// Attempts to stringify whatever not-really-a-component value we were given\r\n// for logging in an error message\r\nconst stringifyComponent = (Comp: unknown) => {\r\n try {\r\n return JSON.stringify(Comp)\r\n } catch (err) {\r\n return String(Comp)\r\n }\r\n}\r\n\r\ntype EffectFunc = (...args: any[]) => void | ReturnType<React.EffectCallback>\r\n\r\n// This is \"just\" a `useLayoutEffect`, but with two modifications:\r\n// - we need to fall back to `useEffect` in SSR to avoid annoying warnings\r\n// - we extract this to a separate function to avoid closing over values\r\n// and causing memory leaks\r\nfunction useIsomorphicLayoutEffectWithArgs(\r\n effectFunc: EffectFunc,\r\n effectArgs: any[],\r\n dependencies?: React.DependencyList\r\n) {\r\n useIsomorphicLayoutEffect(() => effectFunc(...effectArgs), dependencies)\r\n}\r\n\r\n// Effect callback, extracted: assign the latest props values to refs for later usage\r\nfunction captureWrapperProps(\r\n lastWrapperProps: React.MutableRefObject<unknown>,\r\n lastChildProps: React.MutableRefObject<unknown>,\r\n renderIsScheduled: React.MutableRefObject<boolean>,\r\n wrapperProps: unknown,\r\n // actualChildProps: unknown,\r\n childPropsFromStoreUpdate: React.MutableRefObject<unknown>,\r\n notifyNestedSubs: () => void\r\n) {\r\n // We want to capture the wrapper props and child props we used for later comparisons\r\n lastWrapperProps.current = wrapperProps\r\n renderIsScheduled.current = false\r\n\r\n // If the render was from a store update, clear out that reference and cascade the subscriber update\r\n if (childPropsFromStoreUpdate.current) {\r\n childPropsFromStoreUpdate.current = null\r\n notifyNestedSubs()\r\n }\r\n}\r\n\r\n// Effect callback, extracted: subscribe to the Redux store or nearest connected ancestor,\r\n// check for updates after dispatched actions, and trigger re-renders.\r\nfunction subscribeUpdates(\r\n shouldHandleStateChanges: boolean,\r\n store: Store,\r\n subscription: Subscription,\r\n childPropsSelector: (state: unknown, props: unknown) => unknown,\r\n lastWrapperProps: React.MutableRefObject<unknown>,\r\n lastChildProps: React.MutableRefObject<unknown>,\r\n renderIsScheduled: React.MutableRefObject<boolean>,\r\n isMounted: React.MutableRefObject<boolean>,\r\n childPropsFromStoreUpdate: React.MutableRefObject<unknown>,\r\n notifyNestedSubs: () => void,\r\n // forceComponentUpdateDispatch: React.Dispatch<any>,\r\n additionalSubscribeListener: () => void\r\n) {\r\n // If we're not subscribed to the store, nothing to do here\r\n if (!shouldHandleStateChanges) return () => {}\r\n\r\n // Capture values for checking if and when this component unmounts\r\n let didUnsubscribe = false\r\n let lastThrownError: Error | null = null\r\n\r\n // We'll run this callback every time a store subscription update propagates to this component\r\n const checkForUpdates = () => {\r\n if (didUnsubscribe || !isMounted.current) {\r\n // Don't run stale listeners.\r\n // Redux doesn't guarantee unsubscriptions happen until next dispatch.\r\n return\r\n }\r\n\r\n // TODO We're currently calling getState ourselves here, rather than letting `uSES` do it\r\n const latestStoreState = store.getState()\r\n\r\n let newChildProps, error\r\n try {\r\n // Actually run the selector with the most recent store state and wrapper props\r\n // to determine what the child props should be\r\n newChildProps = childPropsSelector(\r\n latestStoreState,\r\n lastWrapperProps.current\r\n )\r\n } catch (e) {\r\n error = e\r\n lastThrownError = e as Error | null\r\n }\r\n\r\n if (!error) {\r\n lastThrownError = null\r\n }\r\n\r\n // If the child props haven't changed, nothing to do here - cascade the subscription update\r\n if (newChildProps === lastChildProps.current) {\r\n if (!renderIsScheduled.current) {\r\n notifyNestedSubs()\r\n }\r\n } else {\r\n // Save references to the new child props. Note that we track the \"child props from store update\"\r\n // as a ref instead of a useState/useReducer because we need a way to determine if that value has\r\n // been processed. If this went into useState/useReducer, we couldn't clear out the value without\r\n // forcing another re-render, which we don't want.\r\n lastChildProps.current = newChildProps\r\n childPropsFromStoreUpdate.current = newChildProps\r\n renderIsScheduled.current = true\r\n\r\n // TODO This is hacky and not how `uSES` is meant to be used\r\n // Trigger the React `useSyncExternalStore` subscriber\r\n additionalSubscribeListener()\r\n }\r\n }\r\n\r\n // Actually subscribe to the nearest connected ancestor (or store)\r\n subscription.onStateChange = checkForUpdates\r\n subscription.trySubscribe()\r\n\r\n // Pull data from the store after first render in case the store has\r\n // changed since we began.\r\n checkForUpdates()\r\n\r\n const unsubscribeWrapper = () => {\r\n didUnsubscribe = true\r\n subscription.tryUnsubscribe()\r\n subscription.onStateChange = null\r\n\r\n if (lastThrownError) {\r\n // It's possible that we caught an error due to a bad mapState function, but the\r\n // parent re-rendered without this component and we're about to unmount.\r\n // This shouldn't happen as long as we do top-down subscriptions correctly, but\r\n // if we ever do those wrong, this throw will surface the error in our tests.\r\n // In that case, throw the error from here so it doesn't get lost.\r\n throw lastThrownError\r\n }\r\n }\r\n\r\n return unsubscribeWrapper\r\n}\r\n\r\n// Reducer initial state creation for our update reducer\r\nconst initStateUpdates = () => EMPTY_ARRAY\r\n\r\nexport interface ConnectProps {\r\n /** A custom Context instance that the component can use to access the store from an alternate Provider using that same Context instance */\r\n context?: ReactReduxContextInstance\r\n /** A Redux store instance to be used for subscriptions instead of the store from a Provider */\r\n store?: Store\r\n}\r\n\r\ninterface InternalConnectProps extends ConnectProps {\r\n reactReduxForwardedRef?: React.ForwardedRef<unknown>\r\n}\r\n\r\nfunction strictEqual(a: unknown, b: unknown) {\r\n return a === b\r\n}\r\n\r\n/**\r\n * Infers the type of props that a connector will inject into a component.\r\n */\r\nexport type ConnectedProps<TConnector> =\r\n TConnector extends InferableComponentEnhancerWithProps<\r\n infer TInjectedProps,\r\n any\r\n >\r\n ? unknown extends TInjectedProps\r\n ? TConnector extends InferableComponentEnhancer<infer TInjectedProps>\r\n ? TInjectedProps\r\n : never\r\n : TInjectedProps\r\n : never\r\n\r\nexport interface ConnectOptions<\r\n State = unknown,\r\n TStateProps = {},\r\n TOwnProps = {},\r\n TMergedProps = {}\r\n> {\r\n forwardRef?: boolean\r\n context?: typeof ReactReduxContext\r\n areStatesEqual?: (\r\n nextState: State,\r\n prevState: State,\r\n nextOwnProps: TOwnProps,\r\n prevOwnProps: TOwnProps\r\n ) => boolean\r\n\r\n areOwnPropsEqual?: (\r\n nextOwnProps: TOwnProps,\r\n prevOwnProps: TOwnProps\r\n ) => boolean\r\n\r\n areStatePropsEqual?: (\r\n nextStateProps: TStateProps,\r\n prevStateProps: TStateProps\r\n ) => boolean\r\n areMergedPropsEqual?: (\r\n nextMergedProps: TMergedProps,\r\n prevMergedProps: TMergedProps\r\n ) => boolean\r\n}\r\n\r\n/**\r\n * Connects a React component to a Redux store.\r\n *\r\n * - Without arguments, just wraps the component, without changing the behavior / props\r\n *\r\n * - If 2 params are passed (3rd param, mergeProps, is skipped), default behavior\r\n * is to override ownProps (as stated in the docs), so what remains is everything that's\r\n * not a state or dispatch prop\r\n *\r\n * - When 3rd param is passed, we don't know if ownProps propagate and whether they\r\n * should be valid component props, because it depends on mergeProps implementation.\r\n * As such, it is the user's responsibility to extend ownProps interface from state or\r\n * dispatch props or both when applicable\r\n *\r\n * @param mapStateToProps\r\n * @param mapDispatchToProps\r\n * @param mergeProps\r\n * @param options\r\n */\r\nexport interface Connect<DefaultState = unknown> {\r\n // tslint:disable:no-unnecessary-generics\r\n (): InferableComponentEnhancer<DispatchProp>\r\n\r\n /** mapState only */\r\n <TStateProps = {}, no_dispatch = {}, TOwnProps = {}, State = DefaultState>(\r\n mapStateToProps: MapStateToPropsParam<TStateProps, TOwnProps, State>\r\n ): InferableComponentEnhancerWithProps<TStateProps & DispatchProp, TOwnProps>\r\n\r\n /** mapDispatch only (as a function) */\r\n <no_state = {}, TDispatchProps = {}, TOwnProps = {}>(\r\n mapStateToProps: null | undefined,\r\n mapDispatchToProps: MapDispatchToPropsNonObject<TDispatchProps, TOwnProps>\r\n ): InferableComponentEnhancerWithProps<TDispatchProps, TOwnProps>\r\n\r\n /** mapDispatch only (as an object) */\r\n <no_state = {}, TDispatchProps = {}, TOwnProps = {}>(\r\n mapStateToProps: null | undefined,\r\n mapDispatchToProps: MapDispatchToPropsParam<TDispatchProps, TOwnProps>\r\n ): InferableComponentEnhancerWithProps<\r\n ResolveThunks<TDispatchProps>,\r\n TOwnProps\r\n >\r\n\r\n /** mapState and mapDispatch (as a function)*/\r\n <TStateProps = {}, TDispatchProps = {}, TOwnProps = {}, State = DefaultState>(\r\n mapStateToProps: MapStateToPropsParam<TStateProps, TOwnProps, State>,\r\n mapDispatchToProps: MapDispatchToPropsNonObject<TDispatchProps, TOwnProps>\r\n ): InferableComponentEnhancerWithProps<\r\n TStateProps & TDispatchProps,\r\n TOwnProps\r\n >\r\n\r\n /** mapState and mapDispatch (nullish) */\r\n <TStateProps = {}, TDispatchProps = {}, TOwnProps = {}, State = DefaultState>(\r\n mapStateToProps: MapStateToPropsParam<TStateProps, TOwnProps, State>,\r\n mapDispatchToProps: null | undefined\r\n ): InferableComponentEnhancerWithProps<TStateProps, TOwnProps>\r\n\r\n /** mapState and mapDispatch (as an object) */\r\n <TStateProps = {}, TDispatchProps = {}, TOwnProps = {}, State = DefaultState>(\r\n mapStateToProps: MapStateToPropsParam<TStateProps, TOwnProps, State>,\r\n mapDispatchToProps: MapDispatchToPropsParam<TDispatchProps, TOwnProps>\r\n ): InferableComponentEnhancerWithProps<\r\n TStateProps & ResolveThunks<TDispatchProps>,\r\n TOwnProps\r\n >\r\n\r\n /** mergeProps only */\r\n <no_state = {}, no_dispatch = {}, TOwnProps = {}, TMergedProps = {}>(\r\n mapStateToProps: null | undefined,\r\n mapDispatchToProps: null | undefined,\r\n mergeProps: MergeProps<undefined, DispatchProp, TOwnProps, TMergedProps>\r\n ): InferableComponentEnhancerWithProps<TMergedProps, TOwnProps>\r\n\r\n /** mapState and mergeProps */\r\n <\r\n TStateProps = {},\r\n no_dispatch = {},\r\n TOwnProps = {},\r\n TMergedProps = {},\r\n State = DefaultState\r\n >(\r\n mapStateToProps: MapStateToPropsParam<TStateProps, TOwnProps, State>,\r\n mapDispatchToProps: null | undefined,\r\n mergeProps: MergeProps<TStateProps, DispatchProp, TOwnProps, TMergedProps>\r\n ): InferableComponentEnhancerWithProps<TMergedProps, TOwnProps>\r\n\r\n /** mapDispatch (as a object) and mergeProps */\r\n <no_state = {}, TDispatchProps = {}, TOwnProps = {}, TMergedProps = {}>(\r\n mapStateToProps: null | undefined,\r\n mapDispatchToProps: MapDispatchToPropsParam<TDispatchProps, TOwnProps>,\r\n mergeProps: MergeProps<undefined, TDispatchProps, TOwnProps, TMergedProps>\r\n ): InferableComponentEnhancerWithProps<TMergedProps, TOwnProps>\r\n\r\n /** mapState and options */\r\n <TStateProps = {}, no_dispatch = {}, TOwnProps = {}, State = DefaultState>(\r\n mapStateToProps: MapStateToPropsParam<TStateProps, TOwnProps, State>,\r\n mapDispatchToProps: null | undefined,\r\n mergeProps: null | undefined,\r\n options: ConnectOptions<State, TStateProps, TOwnProps>\r\n ): InferableComponentEnhancerWithProps<DispatchProp & TStateProps, TOwnProps>\r\n\r\n /** mapDispatch (as a function) and options */\r\n <TStateProps = {}, TDispatchProps = {}, TOwnProps = {}>(\r\n mapStateToProps: null | undefined,\r\n mapDispatchToProps: MapDispatchToPropsNonObject<TDispatchProps, TOwnProps>,\r\n mergeProps: null | undefined,\r\n options: ConnectOptions<{}, TStateProps, TOwnProps>\r\n ): InferableComponentEnhancerWithProps<TDispatchProps, TOwnProps>\r\n\r\n /** mapDispatch (as an object) and options*/\r\n <TStateProps = {}, TDispatchProps = {}, TOwnProps = {}>(\r\n mapStateToProps: null | undefined,\r\n mapDispatchToProps: MapDispatchToPropsParam<TDispatchProps, TOwnProps>,\r\n mergeProps: null | undefined,\r\n options: ConnectOptions<{}, TStateProps, TOwnProps>\r\n ): InferableComponentEnhancerWithProps<\r\n ResolveThunks<TDispatchProps>,\r\n TOwnProps\r\n >\r\n\r\n /** mapState, mapDispatch (as a function), and options */\r\n <TStateProps = {}, TDispatchProps = {}, TOwnProps = {}, State = DefaultState>(\r\n mapStateToProps: MapStateToPropsParam<TStateProps, TOwnProps, State>,\r\n mapDispatchToProps: MapDispatchToPropsNonObject<TDispatchProps, TOwnProps>,\r\n mergeProps: null | undefined,\r\n options: ConnectOptions<State, TStateProps, TOwnProps>\r\n ): InferableComponentEnhancerWithProps<\r\n TStateProps & TDispatchProps,\r\n TOwnProps\r\n >\r\n\r\n /** mapState, mapDispatch (as an object), and options */\r\n <TStateProps = {}, TDispatchProps = {}, TOwnProps = {}, State = DefaultState>(\r\n mapStateToProps: MapStateToPropsParam<TStateProps, TOwnProps, State>,\r\n mapDispatchToProps: MapDispatchToPropsParam<TDispatchProps, TOwnProps>,\r\n mergeProps: null | undefined,\r\n options: ConnectOptions<State, TStateProps, TOwnProps>\r\n ): InferableComponentEnhancerWithProps<\r\n TStateProps & ResolveThunks<TDispatchProps>,\r\n TOwnProps\r\n >\r\n\r\n /** mapState, mapDispatch, mergeProps, and options */\r\n <\r\n TStateProps = {},\r\n TDispatchProps = {},\r\n TOwnProps = {},\r\n TMergedProps = {},\r\n State = DefaultState\r\n >(\r\n mapStateToProps: MapStateToPropsParam<TStateProps, TOwnProps, State>,\r\n mapDispatchToProps: MapDispatchToPropsParam<TDispatchProps, TOwnProps>,\r\n mergeProps: MergeProps<\r\n TStateProps,\r\n TDispatchProps,\r\n TOwnProps,\r\n TMergedProps\r\n >,\r\n options?: ConnectOptions<State, TStateProps, TOwnProps, TMergedProps>\r\n ): InferableComponentEnhancerWithProps<TMergedProps, TOwnProps>\r\n // tslint:enable:no-unnecessary-generics\r\n}\r\n\r\nlet hasWarnedAboutDeprecatedPureOption = false\r\n\r\n/**\r\n * Connects a React component to a Redux store.\r\n *\r\n * - Without arguments, just wraps the component, without changing the behavior / props\r\n *\r\n * - If 2 params are passed (3rd param, mergeProps, is skipped), default behavior\r\n * is to override ownProps (as stated in the docs), so what remains is everything that's\r\n * not a state or dispatch prop\r\n *\r\n * - When 3rd param is passed, we don't know if ownProps propagate and whether they\r\n * should be valid component props, because it depends on mergeProps implementation.\r\n * As such, it is the user's responsibility to extend ownProps interface from state or\r\n * dispatch props or both when applicable\r\n *\r\n * @param mapStateToProps A function that extracts values from state\r\n * @param mapDispatchToProps Setup for dispatching actions\r\n * @param mergeProps Optional callback to merge state and dispatch props together\r\n * @param options Options for configuring the connection\r\n *\r\n */\r\nfunction connect<\r\n TStateProps = {},\r\n TDispatchProps = {},\r\n TOwnProps = {},\r\n TMergedProps = {},\r\n State = unknown\r\n>(\r\n mapStateToProps?: MapStateToPropsParam<TStateProps, TOwnProps, State>,\r\n mapDispatchToProps?: MapDispatchToPropsParam<TDispatchProps, TOwnProps>,\r\n mergeProps?: MergeProps<TStateProps, TDispatchProps, TOwnProps, TMergedProps>,\r\n {\r\n // The `pure` option has been removed, so TS doesn't like us destructuring this to check its existence.\r\n // @ts-ignore\r\n pure,\r\n areStatesEqual = strictEqual,\r\n areOwnPropsEqual = shallowEqual,\r\n areStatePropsEqual = shallowEqual,\r\n areMergedPropsEqual = shallowEqual,\r\n\r\n // use React's forwardRef to expose a ref of the wrapped component\r\n forwardRef = false,\r\n\r\n // the context consumer to use\r\n context = ReactReduxContext,\r\n }: ConnectOptions<unknown, unknown, unknown, unknown> = {}\r\n): unknown {\r\n if (process.env.NODE_ENV !== 'production') {\r\n if (pure !== undefined && !hasWarnedAboutDeprecatedPureOption) {\r\n hasWarnedAboutDeprecatedPureOption = true\r\n warning(\r\n 'The `pure` option has been removed. `connect` is now always a \"pure/memoized\" component'\r\n )\r\n }\r\n }\r\n\r\n const Context = context\r\n\r\n const initMapStateToProps = mapStateToPropsFactory(mapStateToProps)\r\n const initMapDispatchToProps = mapDispatchToPropsFactory(mapDispatchToProps)\r\n const initMergeProps = mergePropsFactory(mergeProps)\r\n\r\n const shouldHandleStateChanges = Boolean(mapStateToProps)\r\n\r\n const wrapWithConnect = <TProps,>(\r\n WrappedComponent: ComponentType<TProps>\r\n ) => {\r\n type WrappedComponentProps = TProps &\r\n ConnectPropsMaybeWithoutContext<TProps>\r\n\r\n if (process.env.NODE_ENV !== 'production') {\r\n const isValid = /*#__PURE__*/ isValidElementType(WrappedComponent)\r\n if (!isValid)\r\n throw new Error(\r\n `You must pass a component to the function returned by connect. Instead received ${stringifyComponent(\r\n WrappedComponent\r\n )}`\r\n )\r\n }\r\n\r\n const wrappedComponentName =\r\n WrappedComponent.displayName || WrappedComponent.name || 'Component'\r\n\r\n const displayName = `Connect(${wrappedComponentName})`\r\n\r\n const selectorFactoryOptions: SelectorFactoryOptions<\r\n any,\r\n any,\r\n any,\r\n any,\r\n State\r\n > = {\r\n shouldHandleStateChanges,\r\n displayName,\r\n wrappedComponentName,\r\n WrappedComponent,\r\n // @ts-ignore\r\n initMapStateToProps,\r\n // @ts-ignore\r\n initMapDispatchToProps,\r\n initMergeProps,\r\n areStatesEqual,\r\n areStatePropsEqual,\r\n areOwnPropsEqual,\r\n areMergedPropsEqual,\r\n }\r\n\r\n function ConnectFunction<TOwnProps>(\r\n props: InternalConnectProps & TOwnProps\r\n ) {\r\n const [propsContext, reactReduxForwardedRef, wrapperProps] =\r\n React.useMemo(() => {\r\n // Distinguish between actual \"data\" props that were passed to the wrapper component,\r\n // and values needed to control behavior (forwarded refs, alternate context instances).\r\n // To maintain the wrapperProps object reference, memoize this destructuring.\r\n const { reactReduxForwardedRef, ...wrapperProps } = props\r\n return [props.context, reactReduxForwardedRef, wrapperProps]\r\n }, [props])\r\n\r\n const ContextToUse: ReactReduxContextInstance = React.useMemo(() => {\r\n // Users may optionally pass in a custom context instance to use instead of our ReactReduxContext.\r\n // Memoize the check that determines which context instance we should use.\r\n let ResultContext = Context\r\n if (propsContext?.Consumer) {\r\n if (process.env.NODE_ENV !== 'production') {\r\n const isValid = /*#__PURE__*/ isContextConsumer(\r\n // @ts-ignore\r\n <propsContext.Consumer />\r\n )\r\n if (!isValid) {\r\n throw new Error(\r\n 'You must pass a valid React context consumer as `props.context`'\r\n )\r\n }\r\n ResultContext = propsContext\r\n }\r\n }\r\n return ResultContext\r\n }, [propsContext, Context])\r\n\r\n // Retrieve the store and ancestor subscription via context, if available\r\n const contextValue = React.useContext(ContextToUse)\r\n\r\n // The store _must_ exist as either a prop or in context.\r\n // We'll check to see if it _looks_ like a Redux store first.\r\n // This allows us to pass through a `store` prop that is just a plain value.\r\n const didStoreComeFromProps =\r\n Boolean(props.store) &&\r\n Boolean(props.store!.getState) &&\r\n Boolean(props.store!.dispatch)\r\n const didStoreComeFromContext =\r\n Boolean(contextValue) && Boolean(contextValue!.store)\r\n\r\n if (\r\n process.env.NODE_ENV !== 'production' &&\r\n !didStoreComeFromProps &&\r\n !didStoreComeFromContext\r\n ) {\r\n throw new Error(\r\n `Could not find \"store\" in the context of ` +\r\n `\"${displayName}\". Either wrap the root component in a <Provider>, ` +\r\n `or pass a custom React context provider to <Provider> and the corresponding ` +\r\n `React context consumer to ${displayName} in connect options.`\r\n )\r\n }\r\n\r\n // Based on the previous check, one of these must be true\r\n const store: Store = didStoreComeFromProps\r\n ? props.store!\r\n : contextValue!.store\r\n\r\n const getServerState = didStoreComeFromContext\r\n ? contextValue!.getServerState\r\n : store.getState\r\n\r\n const childPropsSelector = React.useMemo(() => {\r\n // The child props selector needs the store reference as an input.\r\n // Re-create this selector whenever the store changes.\r\n return defaultSelectorFactory(store.dispatch, selectorFactoryOptions)\r\n }, [store])\r\n\r\n const [subscription, notifyNestedSubs] = React.useMemo(() => {\r\n if (!shouldHandleStateChanges) return NO_SUBSCRIPTION_ARRAY\r\n\r\n // This Subscription's source should match where store came from: props vs. context. A component\r\n // connected to the store via props shouldn't use subscription from context, or vice versa.\r\n const subscription = createSubscription(\r\n store,\r\n didStoreComeFromProps ? undefined : contextValue!.subscription\r\n )\r\n\r\n // `notifyNestedSubs` is duplicated to handle the case where the component is unmounted in\r\n // the middle of the notification loop, where `subscription` will then be null. This can\r\n // probably be avoided if Subscription's listeners logic is changed to not call listeners\r\n // that have been unsubscribed in the middle of the notification loop.\r\n const notifyNestedSubs =\r\n subscription.notifyNestedSubs.bind(subscription)\r\n\r\n return [subscription, notifyNestedSubs]\r\n }, [store, didStoreComeFromProps, contextValue])\r\n\r\n // Determine what {store, subscription} value should be put into nested context, if necessary,\r\n // and memoize that value to avoid unnecessary context updates.\r\n const overriddenContextValue = React.useMemo(() => {\r\n if (didStoreComeFromProps) {\r\n // This component is directly subscribed to a store from props.\r\n // We don't want descendants reading from this store - pass down whatever\r\n // the existing context value is from the nearest connected ancestor.\r\n return contextValue!\r\n }\r\n\r\n // Otherwise, put this component's subscription instance into context, so that\r\n // connected descendants won't update until after this component is done\r\n return {\r\n ...contextValue,\r\n subscription,\r\n } as ReactReduxContextValue\r\n }, [didStoreComeFromProps, contextValue, subscription])\r\n\r\n // Set up refs to coordinate values between the subscription effect and the render logic\r\n const lastChildProps = React.useRef<unknown>()\r\n const lastWrapperProps = React.useRef(wrapperProps)\r\n const childPropsFromStoreUpdate = React.useRef<unknown>()\r\n const renderIsScheduled = React.useRef(false)\r\n const isProcessingDispatch = React.useRef(false)\r\n const isMounted = React.useRef(false)\r\n\r\n const latestSubscriptionCallbackError = React.useRef<Error>()\r\n\r\n useIsomorphicLayoutEffect(() => {\r\n isMounted.current = true\r\n return () => {\r\n isMounted.current = false\r\n }\r\n }, [])\r\n\r\n const actualChildPropsSelector = React.useMemo(() => {\r\n const selector = () => {\r\n // Tricky logic here:\r\n // - This render may have been triggered by a Redux store update that produced new child props\r\n // - However, we may have gotten new wrapper props after that\r\n // If we have new child props, and the same wrapper props, we know we should use the new child props as-is.\r\n // But, if we have new wrapper props, those might change the child props, so we have to recalculate things.\r\n // So, we'll use the child props from store update only if the wrapper props are the same as last time.\r\n if (\r\n childPropsFromStoreUpdate.current &&\r\n wrapperProps === lastWrapperProps.current\r\n ) {\r\n return childPropsFromStoreUpdate.current\r\n }\r\n\r\n // TODO We're reading the store directly in render() here. Bad idea?\r\n // This will likely cause Bad Things (TM) to happen in Concurrent Mode.\r\n // Note that we do this because on renders _not_ caused by store updates, we need the latest store state\r\n // to determine what the child props should be.\r\n return childPropsSelector(store.getState(), wrapperProps)\r\n }\r\n return selector\r\n }, [store, wrapperProps])\r\n\r\n // We need this to execute synchronously every time we re-render. However, React warns\r\n // about useLayoutEffect in SSR, so we try to detect environment and fall back to\r\n // just useEffect instead to avoid the warning, since neither will run anyway.\r\n\r\n const subscribeForReact = React.useMemo(() => {\r\n const subscribe = (reactListener: () => void) => {\r\n if (!subscription) {\r\n return () => {}\r\n }\r\n\r\n return subscribeUpdates(\r\n shouldHandleStateChanges,\r\n store,\r\n subscription,\r\n // @ts-ignore\r\n childPropsSelector,\r\n lastWrapperProps,\r\n lastChildProps,\r\n renderIsScheduled,\r\n isMounted,\r\n childPropsFromStoreUpdate,\r\n notifyNestedSubs,\r\n reactListener\r\n )\r\n }\r\n\r\n return subscribe\r\n }, [subscription])\r\n\r\n useIsomorphicLayoutEffectWithArgs(captureWrapperProps, [\r\n lastWrapperProps,\r\n lastChildProps,\r\n renderIsScheduled,\r\n wrapperProps,\r\n childPropsFromStoreUpdate,\r\n notifyNestedSubs,\r\n ])\r\n\r\n let actualChildProps: Record<string, unknown>\r\n\r\n try {\r\n actualChildProps = useSyncExternalStore(\r\n // TODO We're passing through a big wrapper that does a bunch of extra side effects besides subscribing\r\n subscribeForReact,\r\n // TODO This is incredibly hacky. We've already processed the store update and calculated new child props,\r\n // TODO and we're just passing that through so it triggers a re-render for us rather than relying on `uSES`.\r\n actualChildPropsSelector,\r\n getServerState\r\n ? () => childPropsSelector(getServerState(), wrapperProps)\r\n : actualChildPropsSelector\r\n )\r\n } catch (err) {\r\n if (latestSubscriptionCallbackError.current) {\r\n ;(\r\n err as Error\r\n ).message += `\\nThe error may be correlated with this previous error:\\n${latestSubscriptionCallbackError.current.stack}\\n\\n`\r\n }\r\n\r\n throw err\r\n }\r\n\r\n useIsomorphicLayoutEffect(() => {\r\n latestSubscriptionCallbackError.current = undefined\r\n childPropsFromStoreUpdate.current = undefined\r\n lastChildProps.current = actualChildProps\r\n })\r\n\r\n // Now that all that's done, we can finally try to actually render the child component.\r\n // We memoize the elements for the rendered child component as an optimization.\r\n const renderedWrappedComponent = React.useMemo(() => {\r\n return (\r\n // @ts-ignore\r\n <WrappedComponent\r\n {...actualChildProps}\r\n ref={reactReduxForwardedRef}\r\n />\r\n )\r\n }, [reactReduxForwardedRef, WrappedComponent, actualChildProps])\r\n\r\n // If React sees the exact same element reference as last time, it bails out of re-rendering\r\n // that child, same as if it was wrapped in React.memo() or returned false from shouldComponentUpdate.\r\n const renderedChild = React.useMemo(() => {\r\n if (shouldHandleStateChanges) {\r\n // If this component is subscribed to store updates, we need to pass its own\r\n // subscription instance down to our descendants. That means rendering the same\r\n // Context instance, and putting a different value into the context.\r\n return (\r\n <ContextToUse.Provider value={overriddenContextValue}>\r\n {renderedWrappedComponent}\r\n </ContextToUse.Provider>\r\n )\r\n }\r\n\r\n return renderedWrappedComponent\r\n }, [ContextToUse, renderedWrappedComponent, overriddenContextValue])\r\n\r\n return renderedChild\r\n }\r\n\r\n const _Connect = React.memo(ConnectFunction)\r\n\r\n type ConnectedWrapperComponent = typeof _Connect & {\r\n WrappedComponent: typeof WrappedComponent\r\n }\r\n\r\n // Add a hacky cast to get the right output type\r\n const Connect = _Connect as unknown as ConnectedComponent<\r\n typeof WrappedComponent,\r\n WrappedComponentProps\r\n >\r\n Connect.WrappedComponent = WrappedComponent\r\n Connect.displayName = ConnectFunction.displayName = displayName\r\n\r\n if (forwardRef) {\r\n const _forwarded = React.forwardRef(function forwardConnectRef(\r\n props,\r\n ref\r\n ) {\r\n // @ts-ignore\r\n return <Connect {...props} reactReduxForwardedRef={ref} />\r\n })\r\n\r\n const forwarded = _forwarded as ConnectedWrapperComponent\r\n forwarded.displayName = displayName\r\n forwarded.WrappedComponent = WrappedComponent\r\n return /*#__PURE__*/ hoistStatics(forwarded, WrappedComponent)\r\n }\r\n\r\n return /*#__PURE__*/ hoistStatics(Connect, WrappedComponent)\r\n }\r\n\r\n return wrapWithConnect\r\n}\r\n\r\nexport default connect as Connect\r\n","import type { Context, ReactNode } from 'react'\r\nimport { React } from '../utils/react'\r\nimport type { Action, Store, UnknownAction } from 'redux'\r\nimport type { DevModeCheckFrequency } from '../hooks/useSelector'\r\nimport { createSubscription } from '../utils/Subscription'\r\nimport { useIsomorphicLayoutEffect } from '../utils/useIsomorphicLayoutEffect'\r\nimport type { ReactReduxContextValue } from './Context'\r\nimport { ReactReduxContext } from './Context'\r\n\r\nexport interface ProviderProps<\r\n A extends Action<string> = UnknownAction,\r\n S = unknown\r\n> {\r\n /**\r\n * The single Redux store in your application.\r\n */\r\n store: Store<S, A>\r\n\r\n /**\r\n * An optional server state snapshot. Will be used during initial hydration render if available, to ensure that the UI output is consistent with the HTML generated on the server.\r\n */\r\n serverState?: S\r\n\r\n /**\r\n * Optional context to be used internally in react-redux. Use React.createContext() to create a context to be used.\r\n * If this is used, you'll need to customize `connect` by supplying the same context provided to the Provider.\r\n * Set the initial value to null, and the hooks will error\r\n * if this is not overwritten by Provider.\r\n */\r\n context?: Context<ReactReduxContextValue<S, A> | null>\r\n\r\n /**\r\n * Determines the frequency of stability checks for all selectors.\r\n * This setting overrides the global configuration for\r\n * the `useSelector` stability check, allowing you to specify how often\r\n * these checks should occur in development mode.\r\n *\r\n * @since 8.1.0\r\n */\r\n stabilityCheck?: DevModeCheckFrequency\r\n\r\n /**\r\n * Determines the frequency of identity function checks for all selectors.\r\n * This setting overrides the global configuration for\r\n * the `useSelector` identity function check, allowing you to specify how often\r\n * these checks should occur in development mode.\r\n *\r\n * **Note**: Previously referred to as `noopCheck`.\r\n *\r\n * @since 9.0.0\r\n */\r\n identityFunctionCheck?: DevModeCheckFrequency\r\n\r\n children: ReactNode\r\n}\r\n\r\nfunction Provider<A extends Action<string> = UnknownAction, S = unknown>({\r\n store,\r\n context,\r\n children,\r\n serverState,\r\n stabilityCheck = 'once',\r\n identityFunctionCheck = 'once',\r\n}: ProviderProps<A, S>) {\r\n const contextValue = React.useMemo(() => {\r\n const subscription = createSubscription(store)\r\n return {\r\n store,\r\n subscription,\r\n getServerState: serverState ? () => serverState : undefined,\r\n stabilityCheck,\r\n identityFunctionCheck,\r\n }\r\n }, [store, serverState, stabilityCheck, identityFunctionCheck])\r\n\r\n const previousState = React.useMemo(() => store.getState(), [store])\r\n\r\n useIsomorphicLayoutEffect(() => {\r\n const { subscription } = contextValue\r\n subscription.onStateChange = subscription.notifyNestedSubs\r\n subscription.trySubscribe()\r\n\r\n if (previousState !== store.getState()) {\r\n subscription.notifyNestedSubs()\r\n }\r\n return () => {\r\n subscription.tryUnsubscribe()\r\n subscription.onStateChange = undefined\r\n }\r\n }, [contextValue, previousState])\r\n\r\n const Context = context || ReactReduxContext\r\n\r\n // @ts-ignore 'AnyAction' is assignable to the constraint of type 'A', but 'A' could be instantiated with a different subtype\r\n return <Context.Provider value={contextValue}>{children}</Context.Provider>\r\n}\r\n\r\nexport default Provider\r\n","import type { Context } from 'react'\r\nimport type { Action as BasicAction, UnknownAction, Store } from 'redux'\r\nimport type { ReactReduxContextValue } from '../components/Context'\r\nimport { ReactReduxContext } from '../components/Context'\r\nimport {\r\n useReduxContext as useDefaultReduxContext,\r\n createReduxContextHook,\r\n} from './useReduxContext'\r\n\r\n/**\r\n * Hook factory, which creates a `useStore` hook bound to a given context.\r\n *\r\n * @param {React.Context} [context=ReactReduxContext] Context passed to your `<Provider>`.\r\n * @returns {Function} A `useStore` hook bound to the specified context.\r\n */\r\nexport function createStoreHook<\r\n S = unknown,\r\n A extends BasicAction = UnknownAction\r\n // @ts-ignore\r\n>(context?: Context<ReactReduxContextValue<S, A> | null> = ReactReduxContext) {\r\n const useReduxContext =\r\n // @ts-ignore\r\n context === ReactReduxContext\r\n ? useDefaultReduxContext\r\n : // @ts-ignore\r\n createReduxContextHook(context)\r\n return function useStore<\r\n State = S,\r\n Action2 extends BasicAction = A\r\n // @ts-ignore\r\n >() {\r\n const { store } = useReduxContext()\r\n // @ts-ignore\r\n return store as Store<State, Action2>\r\n }\r\n}\r\n\r\n/**\r\n * A hook to access the redux store.\r\n *\r\n * @returns {any} the redux store\r\n *\r\n * @example\r\n *\r\n * import React from 'react'\r\n * import { useStore } from 'react-redux'\r\n *\r\n * export const ExampleComponent = () => {\r\n * const store = useStore()\r\n * return <div>{store.getState()}</div>\r\n * }\r\n */\r\nexport const useStore = /*#__PURE__*/ createStoreHook()\r\n","import type { Action, Dispatch, UnknownAction } from 'redux'\r\nimport type { Context } from 'react'\r\n\r\nimport type { ReactReduxContextValue } from '../components/Context'\r\nimport { ReactReduxContext } from '../components/Context'\r\nimport { useStore as useDefaultStore, createStoreHook } from './useStore'\r\n\r\n/**\r\n * Hook factory, which creates a `useDispatch` hook bound to a given context.\r\n *\r\n * @param {React.Context} [context=ReactReduxContext] Context passed to your `<Provider>`.\r\n * @returns {Function} A `useDispatch` hook bound to the specified context.\r\n */\r\nexport function createDispatchHook<\r\n S = unknown,\r\n A extends Action<string> = UnknownAction\r\n // @ts-ignore\r\n>(context?: Context<ReactReduxContextValue<S, A> | null> = ReactReduxContext) {\r\n const useStore =\r\n // @ts-ignore\r\n context === ReactReduxContext ? useDefaultStore : createStoreHook(context)\r\n\r\n return function useDispatch<\r\n AppDispatch extends Dispatch<A> = Dispatch<A>\r\n >(): AppDispatch {\r\n const store = useStore()\r\n // @ts-ignore\r\n return store.dispatch\r\n }\r\n}\r\n\r\n/**\r\n * A hook to access the redux `dispatch` function.\r\n *\r\n * @returns {any|function} redux store's `dispatch` function\r\n *\r\n * @example\r\n *\r\n * import React, { useCallback } from 'react'\r\n * import { useDispatch } from 'react-redux'\r\n *\r\n * export const CounterComponent = ({ value }) => {\r\n * const dispatch = useDispatch()\r\n * const increaseCounter = useCallback(() => dispatch({ type: 'increase-counter' }), [])\r\n * return (\r\n * <div>\r\n * <span>{value}</span>\r\n * <button onClick={increaseCounter}>Increase counter</button>\r\n * </div>\r\n * )\r\n * }\r\n */\r\nexport const useDispatch = /*#__PURE__*/ createDispatchHook()\r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,mBAAa,gBAAgB;AAAA,IAC/B;AAAA,EACF,GAAG,CAAC,cAAc,aAAa,CAAC;AAEhC,QAAM,UAAU,WAAW;AAG3B,SAAO,oCAAC,QAAQ,UAAR,EAAiB,OAAO,gBAAe,QAAS;AAC1D;AAEA,IAAO,mBAAQ;;;AClFR,SAAS,gBAId,UAAyD,mBAAmB;AAC5E,QAAMC;AAAA;AAAA,IAEJ,YAAY,oBACR;AAAA;AAAA,MAEA,uBAAuB,OAAO;AAAA;AAAA;AACpC,SAAO,SAASC,YAIZ;AACF,UAAM,EAAE,MAAM,IAAID,iBAAgB;AAElC,WAAO;AAAA,EACT;AACF;AAiBO,IAAM,WAAyB,gCAAgB;;;ACvC/C,SAAS,mBAId,UAAyD,mBAAmB;AAC5E,QAAME;AAAA;AAAA,IAEJ,YAAY,oBAAoB,WAAkB,gBAAgB,OAAO;AAAA;AAE3E,SAAO,SAASC,eAEC;AACf,UAAM,QAAQD,UAAS;AAEvB,WAAO,MAAM;AAAA,EACf;AACF;AAuBO,IAAM,cAA4B,mCAAmB;;;AzBzC5D,sBAAsBE,iCAAgC;AACtD,kBAAkB,MAAM,oBAAoB;AAM5C,IAAMC,SAAQ,SAAS;","names":["useSyncExternalStoreWithSelector","useReduxContext","useReduxContext","useSelector","batch","reactReduxForwardedRef","wrapperProps","subscription","notifyNestedSubs","useReduxContext","useStore","useStore","useDispatch","useSyncExternalStoreWithSelector","batch"]}