UNPKG

@tanstack/router-core

Version:

Modern and scalable routing for React applications

1 lines 37.4 kB
{"version":3,"file":"load-server.cjs","names":[],"sources":["../../src/load-server.ts"],"sourcesContent":["// Keep this filename free of a secondary extension so declaration generation\n// can rewrite relative imports for both ESM and CJS.\nimport { isNotFound } from './not-found'\nimport { isRedirect, redirect } from './redirect'\nimport { rootRouteId } from './root'\nimport { loadRouteChunk } from './load-client'\nimport { waitForReason } from './await-signal'\nimport { getLocationChangeInfo, runRouteLifecycle } from './router'\nimport type { ParsedLocation } from './location'\nimport type { AnyRouteMatch } from './Matches'\nimport type { NotFoundError } from './not-found'\nimport type {\n AnyRoute,\n BeforeLoadContextOptions,\n LoaderFnContext,\n RouteContextOptions,\n SsrContextOptions,\n} from './route'\nimport type { AnyRedirect } from './redirect'\nimport type { AnyRouter, SSROption } from './router'\n\ndeclare const serverLanePhase: unique symbol\n\ntype ServerLane<TPhase extends 'matched' | 'contextualized' | 'reduced'> = {\n readonly [serverLanePhase]: TPhase\n location: ParsedLocation\n matches: Array<AnyRouteMatch>\n}\n\ntype MatchedLane = ServerLane<'matched'>\n\ntype IndexedOutcome = [index: number, outcome: LoaderOutcome, boundary?: number]\n\ntype ContextualizedLane = ServerLane<'contextualized'> & {\n end: number\n failure?: IndexedOutcome\n}\n\ntype ReducedLane = ServerLane<'reduced'>\n\nconst SUCCESS = 0\nconst ERROR = 1\nconst NOT_FOUND = 2\nconst REDIRECTED = 3\nconst SKIPPED = 4\n\ntype LoaderOutcome =\n | [typeof SUCCESS, data: unknown]\n | [typeof ERROR, error: unknown]\n | [typeof NOT_FOUND, error: NotFoundError]\n | [typeof REDIRECTED, redirect: AnyRedirect]\n | [typeof SKIPPED]\n\ntype LoaderTask = {\n index: number\n outcome: Promise<LoaderOutcome>\n match: Promise<AnyRouteMatch>\n}\n\nexport type ServerLoadResult =\n | {\n type: 'render'\n status: 200 | 404 | 500\n matches: Array<AnyRouteMatch>\n }\n | { type: 'redirect'; redirect: AnyRedirect }\n\nfunction getRoute(router: AnyRouter, match: AnyRouteMatch): AnyRoute {\n return router.routesById[match.routeId]\n}\n\nfunction normalize(value: unknown, rejected: boolean): LoaderOutcome {\n if (isRedirect(value)) {\n return [REDIRECTED, value]\n }\n if (isNotFound(value)) {\n return [NOT_FOUND, value]\n }\n if (rejected && typeof (value as any)?.then === 'function') {\n value = new Error('A Promise was thrown', { cause: value })\n }\n return rejected ? [ERROR, value] : [SUCCESS, value]\n}\n\nfunction normalizeError(route: AnyRoute, cause: unknown): LoaderOutcome {\n let outcome = normalize(cause, true)\n if (outcome[0] !== ERROR) {\n return outcome\n }\n try {\n route.options.onError?.(outcome[1])\n } catch (onErrorCause) {\n outcome = normalize(onErrorCause, true)\n }\n return outcome\n}\n\nfunction maybe<TValue>(\n value: TValue,\n cause: unknown,\n): { status: 'success'; value: TValue } | { status: 'error'; error: unknown } {\n if (cause !== undefined) {\n return { status: 'error', error: cause }\n }\n return { status: 'success', value }\n}\n\nfunction navigateFrom(router: AnyRouter, location: ParsedLocation) {\n return (options: any) =>\n router.navigate({\n ...options,\n _fromLocation: location,\n })\n}\n\nfunction waitFor<T>(value: Promise<T>, signal?: AbortSignal): Promise<T> {\n return signal ? waitForReason(value, signal) : value\n}\n\nasync function resolveSsr(\n router: AnyRouter,\n lane: MatchedLane,\n index: number,\n): Promise<SSROption> {\n const match = lane.matches[index]!\n const route = getRoute(router, match)\n const parentSsr = lane.matches[index - 1]?.ssr\n\n if (router.isShell()) {\n return route.id === rootRouteId\n }\n if (parentSsr === false) {\n return false\n }\n\n const inherit = (value: SSROption): SSROption => {\n return value === true && parentSsr === 'data-only' ? 'data-only' : value\n }\n const defaultSsr = router.options.defaultSsr ?? true\n const inheritedDefault = inherit(defaultSsr)\n // A functional override can fail. Establish the inherited policy first so\n // the selected error boundary retains the route's actual renderability.\n match.ssr = inheritedDefault\n const option = route.options.ssr\n if (option === undefined) {\n return inheritedDefault\n }\n if (typeof option !== 'function') {\n return inherit(option)\n }\n\n const context: SsrContextOptions<any, any, any> = {\n search: maybe(match.search, match.searchError),\n params: maybe(match.params, match.paramsError),\n location: lane.location,\n matches: lane.matches.map((candidate) => ({\n index: candidate.index,\n pathname: candidate.pathname,\n fullPath: candidate.fullPath,\n staticData: candidate.staticData,\n id: candidate.id,\n routeId: candidate.routeId,\n search: maybe(candidate.search, candidate.searchError),\n params: maybe(candidate.params, candidate.paramsError),\n ssr: candidate.ssr,\n })),\n }\n return inherit((await option(context)) ?? defaultSsr)\n}\n\nfunction stampNotFound(\n match: AnyRouteMatch,\n outcome: LoaderOutcome,\n): LoaderOutcome {\n if (outcome[0] === NOT_FOUND && !outcome[1].routeId) {\n outcome[1].routeId = match.routeId\n }\n return outcome\n}\n\nasync function contextualize(\n router: AnyRouter,\n lane: MatchedLane,\n signal?: AbortSignal,\n): Promise<ContextualizedLane> {\n const globalBoundary = lane.matches.findIndex((match) => match._notFound)\n let end = globalBoundary < 0 ? lane.matches.length : globalBoundary + 1\n let failure: IndexedOutcome | undefined\n let parentContext: Record<string, unknown> = {\n ...(router.options.context ?? {}),\n }\n\n for (let index = 0; index < end; index++) {\n const match = lane.matches[index]!\n const route = getRoute(router, match)\n try {\n match.ssr = await resolveSsr(router, lane, index)\n } catch (cause) {\n signal?.throwIfAborted()\n failure = [index, stampNotFound(match, normalizeError(route, cause))]\n end = index\n }\n signal?.throwIfAborted()\n if (failure?.[1][0] === REDIRECTED) {\n break\n }\n\n match.__beforeLoadContext = undefined\n let context = parentContext\n try {\n let routeContext\n if (route.options.context) {\n const routeContextOptions: RouteContextOptions<\n any,\n any,\n any,\n any,\n any\n > = {\n deps: match.loaderDeps,\n params: match.params,\n context: parentContext,\n location: lane.location,\n navigate: navigateFrom(router, lane.location),\n buildLocation: router.buildLocation,\n cause: match.cause,\n abortController: match.abortController,\n preload: false,\n matches: lane.matches,\n routeId: route.id,\n }\n routeContext = route.options.context(routeContextOptions) ?? undefined\n }\n context = {\n ...parentContext,\n ...routeContext,\n }\n match.context = context\n } catch (cause) {\n signal?.throwIfAborted()\n if (!failure) {\n failure = [index, stampNotFound(match, normalizeError(route, cause))]\n }\n end = index\n break\n }\n signal?.throwIfAborted()\n if (failure) {\n break\n }\n const validationError = match.paramsError ?? match.searchError\n if (validationError !== undefined) {\n failure = [\n index,\n stampNotFound(match, normalizeError(route, validationError)),\n ]\n end = index\n break\n }\n signal?.throwIfAborted()\n\n if (match.ssr === false || !route.options.beforeLoad) {\n parentContext = context\n continue\n }\n\n const abortController = match.abortController\n const options: BeforeLoadContextOptions<\n any,\n any,\n any,\n any,\n any,\n any,\n any,\n any,\n any\n > = {\n search: match.search,\n abortController,\n params: match.params,\n preload: false,\n context,\n location: lane.location,\n navigate: navigateFrom(router, lane.location),\n buildLocation: router.buildLocation,\n cause: match.cause,\n matches: lane.matches,\n routeId: route.id,\n ...router.options.additionalContext,\n }\n\n try {\n const beforeLoadContext = await route.options.beforeLoad(options)\n signal?.throwIfAborted()\n const outcome = stampNotFound(match, normalize(beforeLoadContext, false))\n if (outcome[0] !== SUCCESS) {\n failure = [index, outcome]\n end = index\n break\n }\n match.__beforeLoadContext = beforeLoadContext\n match.context = {\n ...context,\n ...beforeLoadContext,\n }\n parentContext = match.context\n } catch (cause) {\n signal?.throwIfAborted()\n failure = [index, stampNotFound(match, normalizeError(route, cause))]\n end = index\n break\n }\n }\n\n return {\n location: lane.location,\n matches: lane.matches,\n end,\n failure,\n } as ContextualizedLane\n}\n\nfunction getLoaderContext(\n router: AnyRouter,\n lane: ContextualizedLane,\n match: AnyRouteMatch,\n route: AnyRoute,\n index: number,\n tasks: Array<LoaderTask>,\n): LoaderFnContext {\n return {\n params: match.params,\n deps: match.loaderDeps,\n preload: false,\n parentMatchPromise: tasks[index - 1]?.match,\n abortController: match.abortController,\n context: match.context,\n location: lane.location,\n navigate: navigateFrom(router, lane.location),\n cause: match.cause,\n route,\n ...router.options.additionalContext,\n }\n}\n\nfunction createLoaderTask(\n router: AnyRouter,\n lane: ContextualizedLane,\n index: number,\n tasks: Array<LoaderTask>,\n signal?: AbortSignal,\n): LoaderTask {\n const match = lane.matches[index]!\n const route = getRoute(router, match)\n let outcome: Promise<LoaderOutcome>\n\n if (match.ssr === false) {\n outcome = Promise.resolve<LoaderOutcome>([SKIPPED])\n } else {\n const routeLoader = route.options.loader\n const loader =\n typeof routeLoader === 'function' ? routeLoader : routeLoader?.handler\n if (!loader) {\n outcome = Promise.resolve<LoaderOutcome>([SUCCESS, undefined])\n } else {\n outcome = Promise.resolve()\n .then(() =>\n loader(getLoaderContext(router, lane, match, route, index, tasks)),\n )\n .then(\n (result) => normalize(result, false),\n (cause) => normalize(cause, true),\n )\n .then((result): LoaderOutcome => {\n if (\n result[0] !== REDIRECTED &&\n (signal?.aborted || match.abortController.signal.reason === lane)\n ) {\n return [SKIPPED]\n }\n if (result[0] === ERROR) {\n result = normalizeError(route, result[1])\n }\n return stampNotFound(match, result)\n })\n }\n }\n\n const parentMatch = outcome.then((result) => {\n const snapshot = { ...match }\n if (result[0] === SUCCESS) {\n snapshot.loaderData = result[1]\n snapshot.status = 'success'\n snapshot.error = undefined\n snapshot.invalid = false\n snapshot.isFetching = false\n } else if (result[0] === ERROR) {\n snapshot.status = 'error'\n snapshot.error = result[1]\n } else if (result[0] === NOT_FOUND) {\n snapshot.status = 'notFound'\n snapshot.error = result[1]\n }\n return snapshot\n })\n\n return { index, outcome, match: parentMatch }\n}\n\nasync function getNotFoundBoundary(\n router: AnyRouter,\n matches: Array<AnyRouteMatch>,\n indexed: IndexedOutcome | undefined,\n signal?: AbortSignal,\n fallback = 0,\n): Promise<number> {\n const cause = indexed?.[1][1] as NotFoundError | undefined\n let index = cause?.routeId\n ? matches.findIndex((match) => match.routeId === cause.routeId)\n : (indexed?.[0] ?? matches.length - 1)\n if (index < 0) {\n index = 0\n }\n for (let candidate = index; candidate >= 0; candidate--) {\n const route = getRoute(router, matches[candidate]!)\n const loading = loadRouteChunk(route, false)\n if (loading) {\n try {\n await loading\n } catch {\n signal?.throwIfAborted()\n }\n }\n signal?.throwIfAborted()\n if (route.options.notFoundComponent) {\n return candidate\n }\n }\n return cause?.routeId ? index : fallback\n}\n\nfunction abortMatches(\n matches: Array<AnyRouteMatch>,\n start = 0,\n reason?: unknown,\n): void {\n for (let index = start; index < matches.length; index++) {\n matches[index]!.abortController.abort(reason)\n }\n}\n\nfunction resolveServerRedirect(\n router: AnyRouter,\n location: ParsedLocation,\n value: AnyRedirect,\n): ServerLoadResult {\n value.options._fromLocation = location\n return { type: 'redirect', redirect: router.resolveRedirect(value) }\n}\n\nasync function applyFailure(\n router: AnyRouter,\n lane: ContextualizedLane,\n indexed: IndexedOutcome | undefined,\n signal?: AbortSignal,\n): Promise<{ status: 200 | 404 | 500; boundary?: number; kind?: number }> {\n if (!indexed) {\n const boundary = lane.matches.findIndex((match) => match._notFound)\n if (boundary >= 0) {\n abortMatches(lane.matches, boundary + 1)\n return { status: 404, boundary, kind: NOT_FOUND }\n }\n return { status: 200 }\n }\n\n const [index, outcome] = indexed\n if (outcome[0] === ERROR) {\n const match = lane.matches[index]!\n match._notFound = undefined\n match.status = 'error'\n match.error = outcome[1]\n match.isFetching = false\n abortMatches(lane.matches, index + 1)\n return { status: 500, boundary: index, kind: ERROR }\n }\n\n const boundary =\n indexed[2] ??\n (await getNotFoundBoundary(router, lane.matches, indexed, signal))\n const match = lane.matches[boundary]!\n const cause = outcome[1] as NotFoundError\n cause.routeId = match.routeId\n match._notFound = undefined\n if (match.routeId === router.routeTree.id) {\n match.status = 'success'\n match._notFound = true\n match.error = cause\n } else {\n match.status = 'notFound'\n match.error = cause\n }\n match.isFetching = false\n abortMatches(lane.matches, boundary + 1)\n return { status: 404, boundary, kind: NOT_FOUND }\n}\n\nasync function loadNormalChunks(\n router: AnyRouter,\n lane: ContextualizedLane,\n end: number,\n signal?: AbortSignal,\n): Promise<IndexedOutcome | undefined> {\n const chunks: Array<IndexedOutcome | Promise<IndexedOutcome | undefined>> = []\n for (let index = 0; index < lane.matches.length; index++) {\n const match = lane.matches[index]!\n if (index >= end || match.ssr !== true || match.status !== 'success') {\n continue\n }\n const route = getRoute(router, match)\n try {\n const loading = loadRouteChunk(route)\n if (loading) {\n const chunk = loading.then(\n () => {\n signal?.throwIfAborted()\n return undefined\n },\n (cause) => {\n signal?.throwIfAborted()\n return [\n index,\n stampNotFound(match, normalizeError(route, cause)),\n ] as IndexedOutcome\n },\n )\n // Route-order reduction can return before later chunks settle.\n void chunk.catch(() => {})\n chunks.push(chunk)\n }\n } catch (cause) {\n signal?.throwIfAborted()\n chunks.push([index, stampNotFound(match, normalizeError(route, cause))])\n }\n }\n for (const chunk of chunks) {\n const indexed = Array.isArray(chunk) ? chunk : await chunk\n if (indexed) {\n return indexed\n }\n }\n return undefined\n}\n\nasync function projectLane(\n router: AnyRouter,\n lane: ReducedLane,\n signal?: AbortSignal,\n): Promise<void> {\n for (const match of lane.matches) {\n const routeOptions = getRoute(router, match).options\n if (routeOptions.head || routeOptions.scripts || routeOptions.headers) {\n const context = {\n ssr: router.options.ssr,\n matches: lane.matches,\n match,\n params: match.params,\n loaderData: match.loaderData,\n }\n try {\n const [head, scripts, headers] = await Promise.all([\n routeOptions.head?.(context),\n routeOptions.scripts?.(context),\n routeOptions.headers?.(context),\n ])\n signal?.throwIfAborted()\n match.meta = head?.meta\n match.links = head?.links\n match.headScripts = head?.scripts\n match.styles = head?.styles\n match.scripts = scripts\n match.headers = headers\n } catch (cause) {\n signal?.throwIfAborted()\n console.error(cause)\n }\n }\n if (match.ssr === false || match.status !== 'success' || match._notFound) {\n break\n }\n }\n}\n\nasync function executeServerLane(\n router: AnyRouter,\n location: ParsedLocation,\n matchedMatches: Array<AnyRouteMatch>,\n signal?: AbortSignal,\n): Promise<ServerLoadResult> {\n const matched = {\n location,\n matches: matchedMatches.map((match) => ({\n ...match,\n __beforeLoadContext: undefined,\n context: {},\n isFetching: false,\n abortController: new AbortController(),\n })),\n } as MatchedLane\n const abortLane = () => abortMatches(matched.matches, 0, signal?.reason)\n if (signal?.aborted) {\n abortLane()\n signal.throwIfAborted()\n }\n signal?.addEventListener('abort', abortLane, { once: true })\n\n try {\n const plannedGlobalBoundary = matched.matches.findIndex(\n (match) => match._notFound,\n )\n if (router.options.notFoundMode !== 'root' && plannedGlobalBoundary >= 0) {\n const boundary = await getNotFoundBoundary(\n router,\n matched.matches,\n undefined,\n signal,\n plannedGlobalBoundary,\n )\n if (boundary !== plannedGlobalBoundary) {\n matched.matches[plannedGlobalBoundary]!._notFound = undefined\n matched.matches[boundary]!._notFound = true\n }\n }\n const lane = await contextualize(router, matched, signal)\n signal?.throwIfAborted()\n\n let loaderEnd = lane.end\n if (lane.failure?.[1][0] === REDIRECTED) {\n loaderEnd = 0\n } else if (lane.failure?.[1][0] === NOT_FOUND) {\n lane.failure[2] = await getNotFoundBoundary(\n router,\n lane.matches,\n lane.failure,\n signal,\n )\n loaderEnd = Math.min(loaderEnd, lane.failure[2] + 1)\n }\n\n const tasks: Array<LoaderTask> = []\n for (let index = 0; index < loaderEnd; index++) {\n const task = createLoaderTask(router, lane, index, tasks, signal)\n tasks.push(task)\n }\n\n let loaderFailure: IndexedOutcome | undefined\n let control = lane.failure?.[1][0] === REDIRECTED ? lane.failure : undefined\n try {\n await Promise.all(\n tasks.map((task) =>\n task.outcome.then((loadedOutcome) => {\n const match = lane.matches[task.index]!\n const outcome = loadedOutcome\n if (outcome[0] === SUCCESS) {\n match.loaderData = outcome[1]\n match.status = 'success'\n match.error = undefined\n match.invalid = false\n match.isFetching = false\n match.updatedAt = Date.now()\n } else if (outcome[0] === REDIRECTED) {\n control = [task.index, outcome]\n throw control\n } else {\n // A selective-SSR skip must stay pending for hydration. Every\n // settled server attempt is otherwise renderable unless\n // reduction selects it as the lane's terminal failure.\n if (match.ssr !== false) {\n match.status = 'success'\n match.error = undefined\n match.invalid = true\n match.isFetching = false\n }\n if (!loaderFailure && outcome[0] !== SKIPPED) {\n loaderFailure = [task.index, outcome]\n }\n }\n }),\n ),\n )\n } catch (cause) {\n if (!Array.isArray(cause)) {\n throw cause\n }\n control = cause as IndexedOutcome\n }\n signal?.throwIfAborted()\n\n if (control?.[1][0] === REDIRECTED) {\n abortMatches(lane.matches, 0, lane)\n return resolveServerRedirect(router, location, control[1][1])\n }\n\n let failure = lane.failure ?? loaderFailure\n const plannedBoundary = lane.matches.findIndex((match) => match._notFound)\n let readinessEnd: number\n if (failure) {\n const outcomeEnd = (failure[2] ??=\n failure[1][0] === NOT_FOUND\n ? await getNotFoundBoundary(router, lane.matches, failure, signal)\n : failure[0])\n for (const task of tasks) {\n if (task.index >= outcomeEnd) {\n break\n }\n const outcome = await task.outcome\n // Presence means a loader previously succeeded, even with `undefined`.\n if (\n outcome[0] !== SUCCESS &&\n outcome[0] < REDIRECTED &&\n !('loaderData' in lane.matches[task.index]!)\n ) {\n failure = [task.index, outcome]\n failure[2] =\n outcome[0] === NOT_FOUND\n ? await getNotFoundBoundary(router, lane.matches, failure, signal)\n : task.index\n break\n }\n }\n readinessEnd = failure[2]\n } else {\n readinessEnd = plannedBoundary < 0 ? lane.matches.length : plannedBoundary\n }\n const requiredFailure = await loadNormalChunks(\n router,\n lane,\n readinessEnd,\n signal,\n )\n signal?.throwIfAborted()\n if (requiredFailure) {\n if (requiredFailure[1][0] === REDIRECTED) {\n abortMatches(lane.matches)\n return resolveServerRedirect(router, location, requiredFailure[1][1])\n }\n failure = requiredFailure\n }\n\n const terminal = await applyFailure(router, lane, failure, signal)\n if (terminal.boundary !== undefined) {\n const match = lane.matches[terminal.boundary]!\n if (match.ssr === true) {\n const route = getRoute(router, match)\n try {\n if (terminal.kind === ERROR) {\n await loadRouteChunk(route, 'errorComponent')\n } else if (match._notFound) {\n await Promise.all([\n loadRouteChunk(route),\n loadRouteChunk(route, 'notFoundComponent'),\n ])\n } else {\n await loadRouteChunk(route, 'notFoundComponent')\n }\n } catch {}\n signal?.throwIfAborted()\n }\n }\n\n signal?.throwIfAborted()\n await projectLane(\n router,\n {\n location: lane.location,\n matches: lane.matches,\n } as ReducedLane,\n signal,\n )\n signal?.throwIfAborted()\n router.serverSsr?.onCleanup(abortLane)\n return { type: 'render', status: terminal.status, matches: lane.matches }\n } finally {\n signal?.removeEventListener('abort', abortLane)\n }\n}\n\ntype ServerLoadOptions = NonNullable<Parameters<AnyRouter['load']>[0]> & {\n _signal?: AbortSignal\n}\n\nexport async function loadServerRoute(\n router: AnyRouter,\n opts?: ServerLoadOptions,\n): Promise<void> {\n router.updateLatestLocation()\n const next = router.latestLocation\n const previous = router._committed\n let result: ServerLoadResult\n try {\n const canonical = router.buildLocation({\n to: next.pathname,\n search: true,\n params: true,\n hash: true,\n state: true,\n _includeValidateSearch: true,\n })\n if (next.publicHref !== canonical.publicHref) {\n const href = canonical.publicHref || '/'\n throw canonical.external\n ? redirect({ href })\n : redirect({ href, _builtLocation: canonical })\n }\n\n const fromLocation = router.stores.resolvedLocation.get()\n const changeInfo = getLocationChangeInfo(next, fromLocation)\n router.emit({ type: 'onBeforeNavigate', ...changeInfo })\n router.emit({ type: 'onBeforeLoad', ...changeInfo })\n opts?._signal?.throwIfAborted()\n result = await waitFor(\n executeServerLane(router, next, router.matchRoutes(next), opts?._signal),\n opts?._signal,\n )\n opts?._signal?.throwIfAborted()\n } catch (cause) {\n opts?._signal?.throwIfAborted()\n if (!isRedirect(cause)) {\n throw cause\n }\n result = resolveServerRedirect(router, next, cause)\n }\n\n router._serverResult = result\n router.batch(() => {\n router.stores.location.set(next)\n router.stores.status.set('idle')\n if (result.type === 'render') {\n router.stores.setMatches(result.matches)\n router.stores.resolvedLocation.set(next)\n }\n })\n if (result.type === 'render') {\n router._committed = result.matches\n runRouteLifecycle(router, previous, result.matches)\n }\n router._commitPromise?.resolve()\n router._commitPromise = undefined\n}\n"],"mappings":";;;;;;;AAwCA,MAAM,UAAU;AAChB,MAAM,QAAQ;AACd,MAAM,YAAY;AAClB,MAAM,aAAa;AACnB,MAAM,UAAU;AAuBhB,SAAS,SAAS,QAAmB,OAAgC;CACnE,OAAO,OAAO,WAAW,MA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