UNPKG

40.3 kBSource Map (JSON)View Raw
1{"version":3,"names":["CommonActions","React","isValidElementType","Group","isArrayEqual","isRecordEqual","NavigationHelpersContext","NavigationRouteContext","NavigationStateContext","PreventRemoveProvider","Screen","PrivateValueStore","useChildListeners","useComponent","useCurrentRender","useDescriptors","useEventEmitter","useFocusedListenersChildrenAdapter","useFocusEvents","useKeyedChildListeners","useNavigationHelpers","useOnAction","useOnGetState","useOnRouteFocus","useRegisterNavigator","useScheduleUpdate","isValidKey","key","undefined","getRouteConfigsFromChildren","children","groupKey","groupOptions","configs","Children","toArray","reduce","acc","child","isValidElement","type","props","navigationKey","Error","JSON","stringify","name","push","keys","options","Fragment","screenOptions","String","process","env","NODE_ENV","forEach","config","component","getComponent","console","warn","test","useNavigationBuilder","createRouter","navigatorKey","route","useContext","screenListeners","rest","current","router","useRef","params","state","initial","screen","initialRouteName","routeConfigs","screens","routeNames","map","routeKeyList","curr","join","routeParamList","initialParams","routeGetIdList","Object","assign","getId","length","isStateValid","useCallback","isStateInitialized","stale","currentState","getState","getCurrentState","setState","setCurrentState","setKey","getKey","getIsInitial","stateCleanedUp","cleanUpState","initializedState","isFirstStateInitialization","useMemo","initialRouteParamList","initialParamsFromParams","getInitialState","getRehydratedState","previousRouteKeyListRef","useEffect","previousRouteKeyList","nextState","getStateForRouteNamesChange","routeKeyChanges","filter","hasOwnProperty","previousNestedParamsRef","previousParams","action","reset","navigate","path","updatedState","getStateForAction","shouldUpdate","setTimeout","initializedStateRef","emitter","e","target","routes","find","index","navigation","descriptors","listeners","concat","cb","i","self","lastIndexOf","listener","emit","data","childListeners","addListener","keyedListeners","addKeyedListener","onAction","actionListeners","beforeRemoveListeners","beforeRemove","routerConfigOptions","onRouteFocus","id","focusedListeners","focus","getStateListeners","defaultScreenOptions","NavigationContent"],"sources":["useNavigationBuilder.tsx"],"sourcesContent":["import {\n CommonActions,\n DefaultRouterOptions,\n NavigationAction,\n NavigationState,\n ParamListBase,\n PartialState,\n Route,\n Router,\n RouterConfigOptions,\n RouterFactory,\n} from '@react-navigation/routers';\nimport * as React from 'react';\nimport { isValidElementType } from 'react-is';\n\nimport Group from './Group';\nimport isArrayEqual from './isArrayEqual';\nimport isRecordEqual from './isRecordEqual';\nimport NavigationHelpersContext from './NavigationHelpersContext';\nimport NavigationRouteContext from './NavigationRouteContext';\nimport NavigationStateContext from './NavigationStateContext';\nimport PreventRemoveProvider from './PreventRemoveProvider';\nimport Screen from './Screen';\nimport {\n DefaultNavigatorOptions,\n EventMapBase,\n EventMapCore,\n NavigatorScreenParams,\n PrivateValueStore,\n RouteConfig,\n} from './types';\nimport useChildListeners from './useChildListeners';\nimport useComponent from './useComponent';\nimport useCurrentRender from './useCurrentRender';\nimport useDescriptors, { ScreenConfigWithParent } from './useDescriptors';\nimport useEventEmitter from './useEventEmitter';\nimport useFocusedListenersChildrenAdapter from './useFocusedListenersChildrenAdapter';\nimport useFocusEvents from './useFocusEvents';\nimport useKeyedChildListeners from './useKeyedChildListeners';\nimport useNavigationHelpers from './useNavigationHelpers';\nimport useOnAction from './useOnAction';\nimport useOnGetState from './useOnGetState';\nimport useOnRouteFocus from './useOnRouteFocus';\nimport useRegisterNavigator from './useRegisterNavigator';\nimport useScheduleUpdate from './useScheduleUpdate';\n\n// This is to make TypeScript compiler happy\n// eslint-disable-next-line babel/no-unused-expressions\nPrivateValueStore;\n\ntype NavigatorRoute<State extends NavigationState> = {\n key: string;\n params?: NavigatorScreenParams<ParamListBase, State>;\n};\n\nconst isValidKey = (key: unknown) =>\n key === undefined || (typeof key === 'string' && key !== '');\n\n/**\n * Extract route config object from React children elements.\n *\n * @param children React Elements to extract the config from.\n */\nconst getRouteConfigsFromChildren = <\n State extends NavigationState,\n ScreenOptions extends {},\n EventMap extends EventMapBase\n>(\n children: React.ReactNode,\n groupKey?: string,\n groupOptions?: ScreenConfigWithParent<\n State,\n ScreenOptions,\n EventMap\n >['options']\n) => {\n const configs = React.Children.toArray(children).reduce<\n ScreenConfigWithParent<State, ScreenOptions, EventMap>[]\n >((acc, child) => {\n if (React.isValidElement(child)) {\n if (child.type === Screen) {\n // We can only extract the config from `Screen` elements\n // If something else was rendered, it's probably a bug\n\n if (!isValidKey(child.props.navigationKey)) {\n throw new Error(\n `Got an invalid 'navigationKey' prop (${JSON.stringify(\n child.props.navigationKey\n )}) for the screen '${\n child.props.name\n }'. It must be a non-empty string or 'undefined'.`\n );\n }\n\n acc.push({\n keys: [groupKey, child.props.navigationKey],\n options: groupOptions,\n props: child.props as RouteConfig<\n ParamListBase,\n string,\n State,\n ScreenOptions,\n EventMap\n >,\n });\n return acc;\n }\n\n if (child.type === React.Fragment || child.type === Group) {\n if (!isValidKey(child.props.navigationKey)) {\n throw new Error(\n `Got an invalid 'navigationKey' prop (${JSON.stringify(\n child.props.navigationKey\n )}) for the group. It must be a non-empty string or 'undefined'.`\n );\n }\n\n // When we encounter a fragment or group, we need to dive into its children to extract the configs\n // This is handy to conditionally define a group of screens\n acc.push(\n ...getRouteConfigsFromChildren<State, ScreenOptions, EventMap>(\n child.props.children,\n child.props.navigationKey,\n child.type !== Group\n ? groupOptions\n : groupOptions != null\n ? [...groupOptions, child.props.screenOptions]\n : [child.props.screenOptions]\n )\n );\n return acc;\n }\n }\n\n throw new Error(\n `A navigator can only contain 'Screen', 'Group' or 'React.Fragment' as its direct children (found ${\n React.isValidElement(child)\n ? `'${\n typeof child.type === 'string' ? child.type : child.type?.name\n }'${\n child.props?.name ? ` for the screen '${child.props.name}'` : ''\n }`\n : typeof child === 'object'\n ? JSON.stringify(child)\n : `'${String(child)}'`\n }). To render this component in the navigator, pass it in the 'component' prop to 'Screen'.`\n );\n }, []);\n\n if (process.env.NODE_ENV !== 'production') {\n configs.forEach((config) => {\n const { name, children, component, getComponent } = config.props;\n\n if (typeof name !== 'string' || !name) {\n throw new Error(\n `Got an invalid name (${JSON.stringify(\n name\n )}) for the screen. It must be a non-empty string.`\n );\n }\n\n if (\n children != null ||\n component !== undefined ||\n getComponent !== undefined\n ) {\n if (children != null && component !== undefined) {\n throw new Error(\n `Got both 'component' and 'children' props for the screen '${name}'. You must pass only one of them.`\n );\n }\n\n if (children != null && getComponent !== undefined) {\n throw new Error(\n `Got both 'getComponent' and 'children' props for the screen '${name}'. You must pass only one of them.`\n );\n }\n\n if (component !== undefined && getComponent !== undefined) {\n throw new Error(\n `Got both 'component' and 'getComponent' props for the screen '${name}'. You must pass only one of them.`\n );\n }\n\n if (children != null && typeof children !== 'function') {\n throw new Error(\n `Got an invalid value for 'children' prop for the screen '${name}'. It must be a function returning a React Element.`\n );\n }\n\n if (component !== undefined && !isValidElementType(component)) {\n throw new Error(\n `Got an invalid value for 'component' prop for the screen '${name}'. It must be a valid React Component.`\n );\n }\n\n if (getComponent !== undefined && typeof getComponent !== 'function') {\n throw new Error(\n `Got an invalid value for 'getComponent' prop for the screen '${name}'. It must be a function returning a React Component.`\n );\n }\n\n if (typeof component === 'function') {\n if (component.name === 'component') {\n // Inline anonymous functions passed in the `component` prop will have the name of the prop\n // It's relatively safe to assume that it's not a component since it should also have PascalCase name\n // We won't catch all scenarios here, but this should catch a good chunk of incorrect use.\n console.warn(\n `Looks like you're passing an inline function for 'component' prop for the screen '${name}' (e.g. component={() => <SomeComponent />}). Passing an inline function will cause the component state to be lost on re-render and cause perf issues since it's re-created every render. You can pass the function as children to 'Screen' instead to achieve the desired behaviour.`\n );\n } else if (/^[a-z]/.test(component.name)) {\n console.warn(\n `Got a component with the name '${component.name}' for the screen '${name}'. React Components must start with an uppercase letter. If you're passing a regular function and not a component, pass it as children to 'Screen' instead. Otherwise capitalize your component's name.`\n );\n }\n }\n } else {\n throw new Error(\n `Couldn't find a 'component', 'getComponent' or 'children' prop for the screen '${name}'. This can happen if you passed 'undefined'. You likely forgot to export your component from the file it's defined in, or mixed up default import and named import when importing.`\n );\n }\n });\n }\n\n return configs;\n};\n\n/**\n * Hook for building navigators.\n *\n * @param createRouter Factory method which returns router object.\n * @param options Options object containing `children` and additional options for the router.\n * @returns An object containing `state`, `navigation`, `descriptors` objects.\n */\nexport default function useNavigationBuilder<\n State extends NavigationState,\n RouterOptions extends DefaultRouterOptions,\n ActionHelpers extends Record<string, () => void>,\n ScreenOptions extends {},\n EventMap extends Record<string, any>\n>(\n createRouter: RouterFactory<State, any, RouterOptions>,\n options: DefaultNavigatorOptions<\n ParamListBase,\n State,\n ScreenOptions,\n EventMap\n > &\n RouterOptions\n) {\n const navigatorKey = useRegisterNavigator();\n\n const route = React.useContext(NavigationRouteContext) as\n | NavigatorRoute<State>\n | undefined;\n\n const { children, screenListeners, ...rest } = options;\n const { current: router } = React.useRef<Router<State, any>>(\n createRouter({\n ...(rest as unknown as RouterOptions),\n ...(route?.params &&\n route.params.state == null &&\n route.params.initial !== false &&\n typeof route.params.screen === 'string'\n ? { initialRouteName: route.params.screen }\n : null),\n })\n );\n\n const routeConfigs = getRouteConfigsFromChildren<\n State,\n ScreenOptions,\n EventMap\n >(children);\n\n const screens = routeConfigs.reduce<\n Record<string, ScreenConfigWithParent<State, ScreenOptions, EventMap>>\n >((acc, config) => {\n if (config.props.name in acc) {\n throw new Error(\n `A navigator cannot contain multiple 'Screen' components with the same name (found duplicate screen named '${config.props.name}')`\n );\n }\n\n acc[config.props.name] = config;\n return acc;\n }, {});\n\n const routeNames = routeConfigs.map((config) => config.props.name);\n const routeKeyList = routeNames.reduce<Record<string, React.Key | undefined>>(\n (acc, curr) => {\n acc[curr] = screens[curr].keys.map((key) => key ?? '').join(':');\n return acc;\n },\n {}\n );\n const routeParamList = routeNames.reduce<Record<string, object | undefined>>(\n (acc, curr) => {\n const { initialParams } = screens[curr].props;\n acc[curr] = initialParams;\n return acc;\n },\n {}\n );\n const routeGetIdList = routeNames.reduce<\n RouterConfigOptions['routeGetIdList']\n >(\n (acc, curr) =>\n Object.assign(acc, {\n [curr]: screens[curr].props.getId,\n }),\n {}\n );\n\n if (!routeNames.length) {\n throw new Error(\n \"Couldn't find any screens for the navigator. Have you defined any screens as its children?\"\n );\n }\n\n const isStateValid = React.useCallback(\n (state: NavigationState | PartialState<NavigationState>) =>\n state.type === undefined || state.type === router.type,\n [router.type]\n );\n\n const isStateInitialized = React.useCallback(\n (state: NavigationState | PartialState<NavigationState> | undefined) =>\n state !== undefined && state.stale === false && isStateValid(state),\n [isStateValid]\n );\n\n const {\n state: currentState,\n getState: getCurrentState,\n setState: setCurrentState,\n setKey,\n getKey,\n getIsInitial,\n } = React.useContext(NavigationStateContext);\n\n const stateCleanedUp = React.useRef(false);\n\n const cleanUpState = React.useCallback(() => {\n setCurrentState(undefined);\n stateCleanedUp.current = true;\n }, [setCurrentState]);\n\n const setState = React.useCallback(\n (state: NavigationState | PartialState<NavigationState> | undefined) => {\n if (stateCleanedUp.current) {\n // State might have been already cleaned up due to unmount\n // We do not want to expose API allowing to override this\n // This would lead to old data preservation on main navigator unmount\n return;\n }\n setCurrentState(state);\n },\n [setCurrentState]\n );\n\n const [initializedState, isFirstStateInitialization] = React.useMemo(() => {\n const initialRouteParamList = routeNames.reduce<\n Record<string, object | undefined>\n >((acc, curr) => {\n const { initialParams } = screens[curr].props;\n const initialParamsFromParams =\n route?.params?.state == null &&\n route?.params?.initial !== false &&\n route?.params?.screen === curr\n ? route.params.params\n : undefined;\n\n acc[curr] =\n initialParams !== undefined || initialParamsFromParams !== undefined\n ? {\n ...initialParams,\n ...initialParamsFromParams,\n }\n : undefined;\n\n return acc;\n }, {});\n\n // If the current state isn't initialized on first render, we initialize it\n // We also need to re-initialize it if the state passed from parent was changed (maybe due to reset)\n // Otherwise assume that the state was provided as initial state\n // So we need to rehydrate it to make it usable\n if (\n (currentState === undefined || !isStateValid(currentState)) &&\n route?.params?.state == null\n ) {\n return [\n router.getInitialState({\n routeNames,\n routeParamList: initialRouteParamList,\n routeGetIdList,\n }),\n true,\n ];\n } else {\n return [\n router.getRehydratedState(\n route?.params?.state ?? (currentState as PartialState<State>),\n {\n routeNames,\n routeParamList: initialRouteParamList,\n routeGetIdList,\n }\n ),\n false,\n ];\n }\n // We explicitly don't include routeNames, route.params etc. in the dep list\n // below. We want to avoid forcing a new state to be calculated in those cases\n // Instead, we handle changes to these in the nextState code below. Note\n // that some changes to routeConfigs are explicitly ignored, such as changes\n // to initialParams\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [currentState, router, isStateValid]);\n\n const previousRouteKeyListRef = React.useRef(routeKeyList);\n\n React.useEffect(() => {\n previousRouteKeyListRef.current = routeKeyList;\n });\n\n const previousRouteKeyList = previousRouteKeyListRef.current;\n\n let state =\n // If the state isn't initialized, or stale, use the state we initialized instead\n // The state won't update until there's a change needed in the state we have initalized locally\n // So it'll be `undefined` or stale until the first navigation event happens\n isStateInitialized(currentState)\n ? (currentState as State)\n : (initializedState as State);\n\n let nextState: State = state;\n\n if (\n !isArrayEqual(state.routeNames, routeNames) ||\n !isRecordEqual(routeKeyList, previousRouteKeyList)\n ) {\n // When the list of route names change, the router should handle it to remove invalid routes\n nextState = router.getStateForRouteNamesChange(state, {\n routeNames,\n routeParamList,\n routeGetIdList,\n routeKeyChanges: Object.keys(routeKeyList).filter(\n (name) =>\n previousRouteKeyList.hasOwnProperty(name) &&\n routeKeyList[name] !== previousRouteKeyList[name]\n ),\n });\n }\n\n const previousNestedParamsRef = React.useRef(route?.params);\n\n React.useEffect(() => {\n previousNestedParamsRef.current = route?.params;\n }, [route?.params]);\n\n if (route?.params) {\n const previousParams = previousNestedParamsRef.current;\n\n let action: CommonActions.Action | undefined;\n\n if (\n typeof route.params.state === 'object' &&\n route.params.state != null &&\n route.params !== previousParams\n ) {\n // If the route was updated with new state, we should reset to it\n action = CommonActions.reset(route.params.state);\n } else if (\n typeof route.params.screen === 'string' &&\n ((route.params.initial === false && isFirstStateInitialization) ||\n route.params !== previousParams)\n ) {\n // If the route was updated with new screen name and/or params, we should navigate there\n action = CommonActions.navigate({\n name: route.params.screen,\n params: route.params.params,\n path: route.params.path,\n });\n }\n\n // The update should be limited to current navigator only, so we call the router manually\n const updatedState = action\n ? router.getStateForAction(nextState, action, {\n routeNames,\n routeParamList,\n routeGetIdList,\n })\n : null;\n\n nextState =\n updatedState !== null\n ? router.getRehydratedState(updatedState, {\n routeNames,\n routeParamList,\n routeGetIdList,\n })\n : nextState;\n }\n\n const shouldUpdate = state !== nextState;\n\n useScheduleUpdate(() => {\n if (shouldUpdate) {\n // If the state needs to be updated, we'll schedule an update\n setState(nextState);\n }\n });\n\n // The up-to-date state will come in next render, but we don't need to wait for it\n // We can't use the outdated state since the screens have changed, which will cause error due to mismatched config\n // So we override the state object we return to use the latest state as soon as possible\n state = nextState;\n\n React.useEffect(() => {\n setKey(navigatorKey);\n\n if (!getIsInitial()) {\n // If it's not initial render, we need to update the state\n // This will make sure that our container gets notifier of state changes due to new mounts\n // This is necessary for proper screen tracking, URL updates etc.\n setState(nextState);\n }\n\n return () => {\n // We need to clean up state for this navigator on unmount\n // We do it in a timeout because we need to detect if another navigator mounted in the meantime\n // For example, if another navigator has started rendering, we should skip cleanup\n // Otherwise, our cleanup step will cleanup state for the other navigator and re-initialize it\n setTimeout(() => {\n if (getCurrentState() !== undefined && getKey() === navigatorKey) {\n cleanUpState();\n }\n }, 0);\n };\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n\n // We initialize this ref here to avoid a new getState getting initialized\n // whenever initializedState changes. We want getState to have access to the\n // latest initializedState, but don't need it to change when that happens\n const initializedStateRef = React.useRef<State>();\n initializedStateRef.current = initializedState;\n\n const getState = React.useCallback((): State => {\n const currentState = getCurrentState();\n\n return isStateInitialized(currentState)\n ? (currentState as State)\n : (initializedStateRef.current as State);\n }, [getCurrentState, isStateInitialized]);\n\n const emitter = useEventEmitter<EventMapCore<State>>((e) => {\n let routeNames = [];\n\n let route: Route<string> | undefined;\n\n if (e.target) {\n route = state.routes.find((route) => route.key === e.target);\n\n if (route?.name) {\n routeNames.push(route.name);\n }\n } else {\n route = state.routes[state.index];\n routeNames.push(\n ...Object.keys(screens).filter((name) => route?.name === name)\n );\n }\n\n if (route == null) {\n return;\n }\n\n const navigation = descriptors[route.key].navigation;\n\n const listeners = ([] as (((e: any) => void) | undefined)[])\n .concat(\n // Get an array of listeners for all screens + common listeners on navigator\n ...[\n screenListeners,\n ...routeNames.map((name) => {\n const { listeners } = screens[name].props;\n return listeners;\n }),\n ].map((listeners) => {\n const map =\n typeof listeners === 'function'\n ? listeners({ route: route as any, navigation })\n : listeners;\n\n return map\n ? Object.keys(map)\n .filter((type) => type === e.type)\n .map((type) => map?.[type])\n : undefined;\n })\n )\n // We don't want same listener to be called multiple times for same event\n // So we remove any duplicate functions from the array\n .filter((cb, i, self) => cb && self.lastIndexOf(cb) === i);\n\n listeners.forEach((listener) => listener?.(e));\n });\n\n useFocusEvents({ state, emitter });\n\n React.useEffect(() => {\n emitter.emit({ type: 'state', data: { state } });\n }, [emitter, state]);\n\n const { listeners: childListeners, addListener } = useChildListeners();\n\n const { keyedListeners, addKeyedListener } = useKeyedChildListeners();\n\n const onAction = useOnAction({\n router,\n getState,\n setState,\n key: route?.key,\n actionListeners: childListeners.action,\n beforeRemoveListeners: keyedListeners.beforeRemove,\n routerConfigOptions: {\n routeNames,\n routeParamList,\n routeGetIdList,\n },\n emitter,\n });\n\n const onRouteFocus = useOnRouteFocus({\n router,\n key: route?.key,\n getState,\n setState,\n });\n\n const navigation = useNavigationHelpers<\n State,\n ActionHelpers,\n NavigationAction,\n EventMap\n >({\n id: options.id,\n onAction,\n getState,\n emitter,\n router,\n });\n\n useFocusedListenersChildrenAdapter({\n navigation,\n focusedListeners: childListeners.focus,\n });\n\n useOnGetState({\n getState,\n getStateListeners: keyedListeners.getState,\n });\n\n const descriptors = useDescriptors<\n State,\n ActionHelpers,\n ScreenOptions,\n EventMap\n >({\n state,\n screens,\n navigation,\n screenOptions: options.screenOptions,\n defaultScreenOptions: options.defaultScreenOptions,\n onAction,\n getState,\n setState,\n onRouteFocus,\n addListener,\n addKeyedListener,\n router,\n // @ts-expect-error: this should have both core and custom events, but too much work right now\n emitter,\n });\n\n useCurrentRender({\n state,\n navigation,\n descriptors,\n });\n\n const NavigationContent = useComponent((children: React.ReactNode) => (\n <NavigationHelpersContext.Provider value={navigation}>\n <PreventRemoveProvider>{children}</PreventRemoveProvider>\n </NavigationHelpersContext.Provider>\n ));\n\n return {\n state,\n navigation,\n descriptors,\n NavigationContent,\n };\n}\n"],"mappings":"AAAA,SACEA,aADF,QAWO,2BAXP;AAYA,OAAO,KAAKC,KAAZ,MAAuB,OAAvB;AACA,SAASC,kBAAT,QAAmC,UAAnC;AAEA,OAAOC,KAAP,MAAkB,SAAlB;AACA,OAAOC,YAAP,MAAyB,gBAAzB;AACA,OAAOC,aAAP,MAA0B,iBAA1B;AACA,OAAOC,wBAAP,MAAqC,4BAArC;AACA,OAAOC,sBAAP,MAAmC,0BAAnC;AACA,OAAOC,sBAAP,MAAmC,0BAAnC;AACA,OAAOC,qBAAP,MAAkC,yBAAlC;AACA,OAAOC,MAAP,MAAmB,UAAnB;AACA,SAKEC,iBALF,QAOO,SAPP;AAQA,OAAOC,iBAAP,MAA8B,qBAA9B;AACA,OAAOC,YAAP,MAAyB,gBAAzB;AACA,OAAOC,gBAAP,MAA6B,oBAA7B;AACA,OAAOC,cAAP,MAAuD,kBAAvD;AACA,OAAOC,eAAP,MAA4B,mBAA5B;AACA,OAAOC,kCAAP,MAA+C,sCAA/C;AACA,OAAOC,cAAP,MAA2B,kBAA3B;AACA,OAAOC,sBAAP,MAAmC,0BAAnC;AACA,OAAOC,oBAAP,MAAiC,wBAAjC;AACA,OAAOC,WAAP,MAAwB,eAAxB;AACA,OAAOC,aAAP,MAA0B,iBAA1B;AACA,OAAOC,eAAP,MAA4B,mBAA5B;AACA,OAAOC,oBAAP,MAAiC,wBAAjC;AACA,OAAOC,iBAAP,MAA8B,qBAA9B,C,CAEA;AACA;;AACAd,iBAAiB;;AAOjB,MAAMe,UAAU,GAAIC,GAAD,IACjBA,GAAG,KAAKC,SAAR,IAAsB,OAAOD,GAAP,KAAe,QAAf,IAA2BA,GAAG,KAAK,EAD3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