{"version":3,"sources":["../../../src/server/app-render/app-render.tsx"],"sourcesContent":["import type { ComponentType, ErrorInfo, JSX, ReactNode } from 'react'\nimport type { RenderOpts, PreloadCallbacks } from './types'\nimport type {\n  ActionResult,\n  DynamicParamTypesShort,\n  DynamicSegmentTuple,\n  FlightRouterState,\n  CacheNodeSeedData,\n  RSCPayload,\n  NavigationFlightResponse,\n  FlightData,\n  InitialRSCPayload,\n  FlightDataPath,\n  PrefetchHints,\n} from '../../shared/lib/app-router-types'\nimport { PrefetchHint } from '../../shared/lib/app-router-types'\nimport type { Readable } from 'node:stream'\nimport {\n  workAsyncStorage,\n  type WorkStore,\n} from '../app-render/work-async-storage.external'\nimport type {\n  InstantValidationSamples,\n  PrerenderStoreModernClient,\n  PrerenderStoreModernRuntime,\n  PrerenderStoreModernServer,\n  RequestStore,\n  ValidationStoreClient,\n  WorkUnitStore,\n} from '../app-render/work-unit-async-storage.external'\nimport type { NextParsedUrlQuery } from '../request-meta'\nimport { getTurbopackChunkGroupBootstrap } from '../get-page-files'\nimport { UNDERSCORE_NOT_FOUND_ROUTE_ENTRY } from '../../shared/lib/entry-constants'\nimport type { LoaderTree } from '../lib/app-dir-module'\nimport type { AppPageModule } from '../route-modules/app-page/module'\nimport type { BaseNextRequest, BaseNextResponse } from '../base-http'\nimport type { IncomingHttpHeaders } from 'http'\nimport * as ReactClient from 'react'\n\nimport RenderResult, {\n  type AppPageRenderResultMetadata,\n  type RenderResultOptions,\n} from '../render-result'\nimport {\n  chainStreams,\n  continueFizzStream,\n  continueDynamicPrerender,\n  continueStaticPrerender,\n  continueDynamicHTMLResumeNode,\n  continueDynamicHTMLResumeWeb,\n  continueStaticFallbackPrerender,\n  streamToBuffer,\n  streamToString,\n  createWebInlinedDataStream,\n  createPendingStream,\n  createOnHeadersCallback,\n  resumeAndAbort,\n  renderToWebFlightStream,\n  resumeToFizzStream,\n  getServerPrerender,\n  getClientPrerender,\n  processPrelude as processPreludeOp,\n  createDocumentClosingStream,\n  teeStream,\n  renderToWebFizzStream,\n  renderToNodeFlightStream,\n  renderToNodeFizzStream,\n  createNodeInlinedDataStream,\n} from './stream-ops'\nimport type { AnyStream } from './stream-ops'\nimport { getInstantTestBootstrapScriptContent } from './instant-test-bootstrap'\nimport { stripInternalQueries } from '../internal-utils'\nimport {\n  NEXT_HMR_REFRESH_HEADER,\n  NEXT_ROUTER_PREFETCH_HEADER,\n  NEXT_ROUTER_STATE_TREE_HEADER,\n  NEXT_ROUTER_STALE_TIME_HEADER,\n  NEXT_URL,\n  RSC_HEADER,\n  NEXT_ROUTER_SEGMENT_PREFETCH_HEADER,\n  NEXT_REQUEST_ID_HEADER,\n  NEXT_HTML_REQUEST_ID_HEADER,\n} from '../../client/components/app-router-headers'\nimport { createMetadataContext } from '../../lib/metadata/metadata-context'\nimport {\n  createRequestStore as createRequestStoreFromInputs,\n  createRequestStoreForRender,\n} from '../async-storage/request-store'\nimport { isRSCRequestHeader } from '../lib/is-rsc-request'\nimport { createWorkStore } from '../async-storage/work-store'\nimport { formatValidationEvent } from './dev-validation-events'\nimport { createSnapshot } from './async-local-storage'\nimport {\n  getDevValidationWorker,\n  type DevValidationWorkerMessage,\n  type SerializedValidationInputs,\n} from './dev-validation-worker-globals'\nimport { buildDevValidationSnapshot } from './dev-validation-worker-snapshot'\nimport {\n  getAccessFallbackErrorTypeByStatus,\n  getAccessFallbackHTTPStatus,\n  isHTTPAccessFallbackError,\n} from '../../client/components/http-access-fallback/http-access-fallback'\nimport {\n  getURLFromRedirectError,\n  getRedirectStatusCodeFromError,\n} from '../../client/components/redirect'\nimport { isRedirectError } from '../../client/components/redirect-error'\nimport { getImplicitTags, type ImplicitTags } from '../lib/implicit-tags'\nimport { AppRenderSpan, NextNodeServerSpan } from '../lib/trace/constants'\nimport {\n  getRequestInsightsIdentity,\n  runWithRequestInsightsIdentity,\n} from '../lib/trace/request-insights-identity'\nimport { getTracer, SpanStatusCode } from '../lib/trace/tracer'\nimport { traceLocalSpan } from '../lib/trace/local-span-recorder'\nimport { isRequestInsightsEnabled } from '../lib/trace/request-insights'\nimport { FlightRenderResult } from './flight-render-result'\nimport {\n  createReactServerErrorHandler,\n  createHTMLErrorHandler,\n  type DigestedError,\n  isUserLandError,\n  getDigestForWellKnownError,\n} from './create-error-handler'\nimport { dynamicParamTypes } from './get-short-dynamic-param-type'\nimport { getSegmentParam } from '../../shared/lib/router/utils/get-segment-param'\nimport { getScriptNonceFromHeader } from './get-script-nonce-from-header'\nimport { parseAndValidateFlightRouterState } from './parse-and-validate-flight-router-state'\nimport { createFlightRouterStateFromLoaderTree } from './create-flight-router-state-from-loader-tree'\nimport { handleAction } from './action-handler'\nimport { isBailoutToCSRError } from '../../shared/lib/lazy-dynamic/bailout-to-csr'\nimport { warn, error } from '../../build/output/log'\nimport {\n  appendMutableCookies,\n  RequestCookiesAdapter,\n} from '../web/spec-extension/adapters/request-cookies'\nimport { HeadersAdapter } from '../web/spec-extension/adapters/headers'\nimport { createServerInsertedHTML } from './server-inserted-html'\nimport { getRequiredScripts } from './required-scripts'\nimport { addPathPrefix } from '../../shared/lib/router/utils/add-path-prefix'\nimport { makeGetServerInsertedHTML } from './make-get-server-inserted-html'\nimport {\n  walkTreeWithFlightRouterState,\n  createFullTreeFlightDataForNavigation,\n} from './walk-tree-with-flight-router-state'\nimport { createComponentTree, getRootParams } from './create-component-tree'\nimport { getAssetQueryString } from './get-asset-query-string'\nimport {\n  getClientReferenceManifest,\n  getServerModuleMap,\n} from './manifests-singleton'\nimport {\n  DynamicState,\n  type PostponedState,\n  DynamicHTMLPreludeState,\n  parsePostponedState,\n} from './postponed-state'\nimport {\n  getDynamicDataPostponedState,\n  getDynamicHTMLPostponedState,\n  getPostponedFromState,\n} from './postponed-state'\nimport { isDynamicServerError } from '../../client/components/hooks-server-context'\nimport { getFlightStream } from './use-flight-response'\nimport {\n  StaticGenBailoutError,\n  isStaticGenBailoutError,\n} from '../../client/components/static-generation-bailout'\nimport { getStackWithoutErrorMessage } from '../../lib/format-server-error'\nimport { extractNextErrorCode } from '../../lib/error-telemetry-utils'\nimport {\n  accessedDynamicData,\n  createRenderInBrowserAbortSignal,\n  formatDynamicAPIAccesses,\n  isPrerenderInterruptedError,\n  createDynamicTrackingState,\n  createDynamicValidationState,\n  trackAllowedDynamicAccess,\n  throwIfDisallowedDynamic,\n  PreludeState,\n  consumeDynamicAccess,\n  type DynamicAccess,\n  logDisallowedDynamicError,\n  trackDynamicHoleInRuntimeShell,\n  trackDynamicHoleInStaticShell,\n  getStaticShellDisallowedDynamicReasons,\n  getNavigationDisallowedDynamicReasons,\n  trackDynamicHoleInNavigation,\n  DynamicHoleKind,\n  trackThrownErrorInNavigation,\n  createInstantValidationState,\n  type NavigationValidationResult,\n  throwIfSyncIOUsed,\n} from './dynamic-rendering'\nimport { logBuildDebugHint } from './blocking-route-messages'\nimport {\n  getClientComponentLoaderMetrics,\n  wrapClientComponentLoader,\n} from '../client-component-renderer-logger'\nimport { isNodeNextRequest, isNodeNextResponse } from '../base-http/helpers'\nimport { waitForResponseToFinish } from './wait-for-response'\nimport {\n  beginDevValidation,\n  type DevValidationGeneration,\n  yieldToForegroundRequest,\n} from './dev-validation-scheduler'\nimport { signalFromNodeResponse } from '../web/spec-extension/adapters/next-request'\nimport {\n  parseRelativeUrl,\n  type ParsedRelativeUrl,\n} from '../../shared/lib/router/utils/parse-relative-url'\nimport AppRouter from '../../client/components/app-router'\nimport type { ServerComponentsHmrCache } from '../response-cache'\nimport type { RequestErrorContext } from '../instrumentation/types'\nimport { getIsPossibleServerAction } from '../lib/server-action-request-meta'\nimport { createInitialRouterState } from '../../client/components/router-reducer/create-initial-router-state'\nimport { createMutableActionQueue } from '../../client/components/app-router-instance'\nimport { getRevalidateReason } from '../instrumentation/utils'\nimport { PAGE_SEGMENT_KEY } from '../../shared/lib/segment'\nimport {\n  getFallbackRouteParams,\n  type OpaqueFallbackRouteParams,\n} from '../request/fallback-params'\nimport {\n  ReactServerPrerenderResult,\n  createReactServerPrerenderResult,\n  ReactServerResult,\n  ReplayableNodeStream,\n  createReactServerPrerenderResultFromRender,\n} from './app-render-prerender-utils'\nimport {\n  Phase,\n  printDebugThrownValueForProspectiveRender,\n} from './prospective-render-utils'\nimport { runInSequentialTasks } from './app-render-render-utils'\nimport { waitAtLeastOneReactRenderTask } from '../../lib/scheduler'\nimport {\n  getHmrRefreshHash,\n  workUnitAsyncStorage,\n  type PrerenderStore,\n} from './work-unit-async-storage.external'\nimport { consoleAsyncStorage } from './console-async-storage.external'\nimport { CacheSignal } from './cache-signal'\nimport {\n  createResponseVaryParamsAccumulator,\n  finishAccumulatingVaryParams,\n  getMetadataVaryParamsAccumulator,\n  getRootParamsVaryParamsAccumulator,\n} from './vary-params'\nimport { getTracedMetadata } from '../lib/trace/utils'\nimport { InvariantError } from '../../shared/lib/invariant-error'\nimport {\n  StaleTimeIterable,\n  createSelectStaleTime,\n  trackStaleTime,\n} from './stale-time'\n\nimport { HTML_CONTENT_TYPE_HEADER, INFINITE_CACHE } from '../../lib/constants'\nimport { createComponentStylesAndScripts } from './create-component-styles-and-scripts'\nimport { parseLoaderTree } from '../../shared/lib/router/utils/parse-loader-tree'\nimport {\n  createPrerenderResumeDataCache,\n  createRenderResumeDataCache,\n  type PrerenderResumeDataCache,\n  type RenderResumeDataCache,\n  type ResumeDataCache,\n} from '../resume-data-cache/resume-data-cache'\nimport type { MetadataErrorType } from '../../lib/metadata/resolve-metadata'\nimport isError from '../../lib/is-error'\nimport { createServerInsertedMetadata } from './metadata-insertion/create-server-inserted-metadata'\nimport { getPreviouslyRevalidatedTags } from '../server-utils'\nimport { executeRevalidates } from '../revalidation-utils'\nimport {\n  trackPendingChunkLoad,\n  trackPendingImport,\n  trackPendingModules,\n} from './module-loading/track-module-loading.external'\nimport { isReactLargeShellError } from './react-large-shell-error'\nimport type { GlobalErrorComponent } from '../../client/components/builtin/global-error'\nimport { normalizeConventionFilePath } from './segment-explorer-path'\nimport { getRequestMeta } from '../request-meta'\nimport {\n  getDynamicParam,\n  interpolateParallelRouteParams,\n} from '../../shared/lib/router/utils/get-dynamic-param'\nimport type { Params } from '../request/params'\nimport { ImageConfigContext } from '../../shared/lib/image-config-context.shared-runtime'\nimport { imageConfigDefault } from '../../shared/lib/image-config'\nimport {\n  getNextStage,\n  isAdvanceableRenderStage,\n  RENDER_STAGE_ADVANCE_ORDER,\n  RenderStage,\n  StagedRenderingController,\n  SyncIOMode,\n  type AdvanceableRenderStage,\n} from './staged-rendering'\nimport {\n  anySegmentHasPartialPrefetchingEnabled,\n  isPageAllowedToBlock,\n  anySegmentNeedsInstantValidationInDev,\n  anySegmentNeedsInstantValidationInBuild,\n  resolveInstantConfigSamplesForPage,\n} from './instant-validation/instant-config'\nimport { warnOnce } from '../../shared/lib/utils/warn-once'\nimport {\n  createWebDebugChannel,\n  createNodeDebugChannel,\n  type DebugChannelPair,\n  type NodeDebugChannelPair,\n} from './debug-channel-server'\nimport {\n  createNodeStreamFromChunks,\n  createNodeStreamWithLateRelease,\n} from './instant-validation/stream-utils'\n\nimport {\n  createValidationBoundaryTracking,\n  type ValidationBoundaryTracking,\n} from './instant-validation/boundary-tracking'\nimport type {\n  AppSegmentConfig,\n  InstantSample,\n} from '../../build/segment-config/app/app-segment-config'\nimport { ResponseCookies } from '../web/spec-extension/cookies'\nimport { isInstantValidationError } from './instant-validation/instant-validation-error'\nimport { createPromiseWithResolvers } from '../../shared/lib/promise-with-resolvers'\nimport { RENDER_STAGES_BY_DATA_KIND } from '../dynamic-rendering-utils'\nimport type { StageEndTimes } from './instant-validation/instant-validation'\nimport { hasNonRootStaticParams } from '../lib/params-utils'\n\nexport type GetDynamicParamFromSegment = (\n  // The LoaderTree to extract the dynamic param from\n  loaderTree: LoaderTree\n) => DynamicParam | null\n\nexport type DynamicParam = {\n  param: string\n  value: string | string[] | null\n  treeSegment: DynamicSegmentTuple\n  type: DynamicParamTypesShort\n}\n\nexport type GenerateFlight = typeof generateDynamicFlightRenderResult\n\nexport type AppSharedContext = {\n  buildId: string\n  deploymentId: string\n  clientAssetToken: string\n}\n\nexport type AppRenderContext = {\n  sharedContext: AppSharedContext\n  workStore: WorkStore\n  url: ReturnType<typeof parseRelativeUrl>\n  componentMod: AppPageModule\n  renderOpts: RenderOpts\n  parsedRequestHeaders: ParsedRequestHeaders\n  getDynamicParamFromSegment: GetDynamicParamFromSegment\n  interpolatedParams: Params\n  /**\n   * The request's fallback route params (the same ones\n   * `getDynamicParamFromSegment` closes over). Kept on the context so the dev\n   * validation worker can rebuild an identical `getDynamicParamFromSegment`;\n   * the depth-loop segment keys are derived from it, so it must match what\n   * produced the seed render's Flight, not the separate fallback set validation\n   * uses to mark params unknown in its stores.\n   */\n  fallbackRouteParams: OpaqueFallbackRouteParams | null\n  query: NextParsedUrlQuery\n  isPrefetch: boolean\n  isPossibleServerAction: boolean\n  requestTimestamp: number\n  appUsingSizeAdjustment: boolean\n  flightRouterState?: FlightRouterState\n  requestId: string\n  htmlRequestId: string\n  pagePath: string\n  assetPrefix: string\n  isNotFoundPath: boolean\n  nonce: string | undefined\n  res: BaseNextResponse\n  /**\n   * For now, the implicit tags are common for the whole route. If we ever start\n   * rendering/revalidating segments independently, they need to move to the\n   * work unit store.\n   */\n  implicitTags: ImplicitTags\n}\n\nfunction maybeAppendBuildIdToRSCPayload<T extends RSCPayload>(\n  ctx: AppRenderContext,\n  payload: T\n): T {\n  if (!ctx.sharedContext.deploymentId) {\n    // When using the build id, we need to initialize the id on initial page load, so a build id\n    // header wouldn't be enough.\n    payload.b = ctx.sharedContext.buildId\n  }\n  return payload\n}\n\ninterface ParseRequestHeadersOptions {\n  readonly isRoutePPREnabled: boolean\n  readonly previewModeId: string | undefined\n}\n\nconst flightDataPathHeadKey = 'h'\nconst getFlightViewportKey = (requestId: string) => requestId + 'v'\nconst getFlightMetadataKey = (requestId: string) => requestId + 'm'\n\nconst filterStackFrame =\n  process.env.NODE_ENV !== 'production'\n    ? (require('../lib/source-maps') as typeof import('../lib/source-maps'))\n        .filterStackFrameDEV\n    : undefined\n\ninterface ParsedRequestHeaders {\n  /**\n   * Router state provided from the client-side router. Used to handle rendering\n   * from the common layout down. This value will be undefined if the request is\n   * not a client-side navigation request, or if the request is a prefetch\n   * request.\n   */\n  readonly flightRouterState: FlightRouterState | undefined\n  readonly isPrefetchRequest: boolean\n  readonly isRuntimePrefetchRequest: boolean\n  /**\n   * App Shell prefetch: a runtime prefetch that the server renders with\n   * params omitted (any `await params` hangs forever). Produces the\n   * param-independent shell of the route. Implies isRuntimePrefetchRequest.\n   */\n  readonly isAppShellPrefetchRequest: boolean\n  readonly isRouteTreePrefetchRequest: boolean\n  readonly isHmrRefresh: boolean\n  readonly isRSCRequest: boolean\n  readonly nonce: string | undefined\n  readonly previouslyRevalidatedTags: string[]\n  readonly requestId: string | undefined\n  readonly htmlRequestId: string | undefined\n}\n\nfunction parseRequestHeaders(\n  headers: IncomingHttpHeaders,\n  options: ParseRequestHeadersOptions\n): ParsedRequestHeaders {\n  const isRSCRequest = isRSCRequestHeader(headers[RSC_HEADER])\n\n  // runtime prefetch requests are *not* treated as prefetch requests\n  // (TODO: this is confusing, we should refactor this to express this better)\n  const isPrefetchRequest =\n    isRSCRequest && headers[NEXT_ROUTER_PREFETCH_HEADER] === '1'\n\n  const isAppShellPrefetchRequest =\n    isRSCRequest && headers[NEXT_ROUTER_PREFETCH_HEADER] === '3'\n\n  // App Shell prefetches are a subtype of runtime prefetch — same code path,\n  // but with less resolved content (omitting link data)\n  const isRuntimePrefetchRequest =\n    isRSCRequest &&\n    (headers[NEXT_ROUTER_PREFETCH_HEADER] === '2' || isAppShellPrefetchRequest)\n\n  const isHmrRefresh = headers[NEXT_HMR_REFRESH_HEADER] !== undefined\n\n  const shouldProvideFlightRouterState =\n    isRSCRequest && (!isPrefetchRequest || !options.isRoutePPREnabled)\n\n  const flightRouterState = shouldProvideFlightRouterState\n    ? parseAndValidateFlightRouterState(headers[NEXT_ROUTER_STATE_TREE_HEADER])\n    : undefined\n\n  // Checks if this is a prefetch of the Route Tree by the Segment Cache\n  const isRouteTreePrefetchRequest =\n    isRSCRequest && headers[NEXT_ROUTER_SEGMENT_PREFETCH_HEADER] === '/_tree'\n\n  const csp =\n    headers['content-security-policy'] ||\n    headers['content-security-policy-report-only']\n\n  const nonce =\n    typeof csp === 'string' ? getScriptNonceFromHeader(csp) : undefined\n\n  const previouslyRevalidatedTags = getPreviouslyRevalidatedTags(\n    headers,\n    options.previewModeId\n  )\n\n  let requestId: string | undefined\n  let htmlRequestId: string | undefined\n\n  if (process.env.__NEXT_DEV_SERVER) {\n    // The request IDs are only used for the dev server to send debug\n    // information to the matching client (identified by the HTML request ID\n    // that was sent to the client with the HTML document) for the current\n    // request (identified by the request ID, as defined by the client).\n\n    requestId =\n      typeof headers[NEXT_REQUEST_ID_HEADER] === 'string'\n        ? headers[NEXT_REQUEST_ID_HEADER]\n        : undefined\n\n    htmlRequestId =\n      typeof headers[NEXT_HTML_REQUEST_ID_HEADER] === 'string'\n        ? headers[NEXT_HTML_REQUEST_ID_HEADER]\n        : undefined\n  }\n\n  return {\n    flightRouterState,\n    isPrefetchRequest,\n    isRuntimePrefetchRequest,\n    isAppShellPrefetchRequest,\n    isRouteTreePrefetchRequest,\n    isHmrRefresh,\n    isRSCRequest,\n    nonce,\n    previouslyRevalidatedTags,\n    requestId,\n    htmlRequestId,\n  }\n}\n\n/**\n * Walks the loader tree to find the minimum `unstable_dynamicStaleTime` exported by\n * any page module. Returns null if no page exports the config.\n *\n * This only reads static exports from page modules — it does not render any\n * server components, so it's cheap to call.\n *\n * TODO: Move this to the prefetch hints file so we don't have to walk the\n * tree on every render.\n */\nasync function getDynamicStaleTime(tree: LoaderTree): Promise<number | null> {\n  const { page, parallelRoutes } = parseLoaderTree(tree)\n\n  let result: number | null = null\n\n  // Only pages (not layouts) can export unstable_dynamicStaleTime.\n  if (typeof page !== 'undefined') {\n    const pageMod = await page[0]()\n    if (\n      pageMod &&\n      typeof (pageMod as AppSegmentConfig).unstable_dynamicStaleTime ===\n        'number'\n    ) {\n      const value = (pageMod as AppSegmentConfig).unstable_dynamicStaleTime!\n      result = result !== null ? Math.min(result, value) : value\n    }\n  }\n\n  const childPromises: Promise<number | null>[] = []\n  for (const parallelRouteKey in parallelRoutes) {\n    childPromises.push(getDynamicStaleTime(parallelRoutes[parallelRouteKey]))\n  }\n  const childResults = await Promise.all(childPromises)\n  for (const childResult of childResults) {\n    if (childResult !== null) {\n      result = result !== null ? Math.min(result, childResult) : childResult\n    }\n  }\n\n  return result\n}\n\nfunction createNotFoundLoaderTree(loaderTree: LoaderTree): LoaderTree {\n  const components = loaderTree[2]\n  const hasGlobalNotFound = !!components['global-not-found']\n  const notFoundTreeComponents: LoaderTree[2] = hasGlobalNotFound\n    ? {\n        layout: components['global-not-found']!,\n        page: [() => null, 'next/dist/client/components/builtin/empty-stub'],\n      }\n    : {\n        page: components['not-found'],\n      }\n\n  return [\n    '',\n    {\n      children: [PAGE_SEGMENT_KEY, {}, notFoundTreeComponents, null],\n    },\n    // Always include global-error so that getGlobalErrorStyles can access it.\n    // When global-not-found is present, use full components.\n    // Otherwise, only include global-error module.\n    hasGlobalNotFound\n      ? components\n      : { 'global-error': components['global-error'] },\n    null, // staticSiblings\n  ]\n}\n\n/**\n * Returns a function that parses the dynamic segment and return the associated value.\n */\nfunction makeGetDynamicParamFromSegment(\n  interpolatedParams: Params,\n  fallbackRouteParams: OpaqueFallbackRouteParams | null,\n  optimisticRouting: boolean\n): GetDynamicParamFromSegment {\n  return function getDynamicParamFromSegment(loaderTree: LoaderTree) {\n    const [segment, , , staticSiblings] = loaderTree\n    const segmentParam = getSegmentParam(segment)\n    if (!segmentParam) {\n      return null\n    }\n    const segmentKey = segmentParam.paramName\n    const dynamicParamType = dynamicParamTypes[segmentParam.paramType]\n    // Static siblings are only included when optimistic routing is enabled\n    const siblings = optimisticRouting ? staticSiblings : null\n    return getDynamicParam(\n      interpolatedParams,\n      segmentKey,\n      dynamicParamType,\n      fallbackRouteParams,\n      siblings\n    )\n  }\n}\n\nfunction NonIndex({\n  createElement,\n  pagePath,\n  statusCode,\n  isPossibleServerAction,\n}: {\n  createElement: typeof ReactClient.createElement\n  pagePath: string\n  statusCode: number | undefined\n  isPossibleServerAction: boolean\n}) {\n  const is404Page = pagePath === '/404'\n  const isInvalidStatusCode = typeof statusCode === 'number' && statusCode > 400\n\n  // Only render noindex for page request, skip for server actions\n  // TODO: is this correct if `isPossibleServerAction` is a false positive?\n  if (!isPossibleServerAction && (is404Page || isInvalidStatusCode)) {\n    return createElement('meta', {\n      name: 'robots',\n      content: 'noindex',\n    })\n  }\n  return null\n}\n\n/**\n * This is used by server actions & client-side navigations to generate RSC data from a client-side request.\n * This function is only called on \"dynamic\" requests (ie, there wasn't already a static response).\n * It uses request headers (namely `next-router-state-tree`) to determine where to start rendering.\n */\nasync function generateDynamicRSCPayload(\n  ctx: AppRenderContext,\n  options?: {\n    actionResult?: ActionResult\n    skipPageRendering?: boolean\n    staleTimeIterable?: AsyncIterable<number>\n    staticStageByteLengthPromise?: Promise<number>\n    shellByteLengthPromise?: Promise<number | null>\n    shellUsedSessionDataPromise?: Promise<boolean>\n    runtimePrefetchStream?: ReadableStream<Uint8Array>\n  }\n): Promise<RSCPayload> {\n  // Flight data that is going to be passed to the browser.\n  // Currently a single item array but in the future multiple patches might be combined in a single request.\n\n  // We initialize `flightData` to an empty string because the client router knows how to tolerate\n  // it (treating it as an MPA navigation). The only time this function wouldn't generate flight data\n  // is for server actions, if the server action handler instructs this function to skip it. When the server\n  // action reducer sees a falsy value, it'll simply resolve the action with no data.\n  let flightData: FlightData = ''\n\n  const {\n    componentMod: {\n      routeModule: {\n        userland: { loaderTree },\n      },\n      createElement,\n      createMetadataComponents,\n      Fragment,\n    },\n    query,\n    requestId,\n    flightRouterState,\n    workStore,\n    url,\n  } = ctx\n\n  const serveStreamingMetadata = !!ctx.renderOpts.serveStreamingMetadata\n\n  if (!options?.skipPageRendering) {\n    const preloadCallbacks: PreloadCallbacks = []\n    const requestStore = workUnitAsyncStorage.getStore()\n\n    // If we're performing instant validation, we need to render the whole tree,\n    // without skipping shared layouts.\n    const needsFullTree =\n      process.env.__NEXT_DEV_SERVER &&\n      ctx.renderOpts.cacheComponents &&\n      !(\n        requestStore?.type === 'request' &&\n        isBypassingCachesInDev(requestStore, workStore)\n      ) &&\n      !options?.actionResult && // Only for navigations\n      (await anySegmentNeedsInstantValidationInDev(loaderTree))\n\n    const { Viewport, Metadata, MetadataOutlet } = createMetadataComponents({\n      tree: loaderTree,\n      parsedQuery: query,\n      pathname: url.pathname,\n      metadataContext: createMetadataContext(ctx.renderOpts),\n      interpolatedParams: ctx.interpolatedParams,\n      serveStreamingMetadata,\n    })\n\n    const rscHead = createElement(\n      Fragment,\n      {\n        key: flightDataPathHeadKey,\n      },\n      createElement(NonIndex, {\n        createElement,\n        pagePath: ctx.pagePath,\n        statusCode: ctx.res.statusCode,\n        isPossibleServerAction: ctx.isPossibleServerAction,\n      }),\n      createElement(Viewport, {\n        key: getFlightViewportKey(requestId),\n      }),\n      createElement(Metadata, {\n        key: getFlightMetadataKey(requestId),\n      })\n    )\n\n    flightData = (\n      needsFullTree\n        ? await createFullTreeFlightDataForNavigation({\n            ctx,\n            loaderTree,\n            rscHead,\n            injectedCSS: new Set(),\n            injectedJS: new Set(),\n            injectedFontPreloadTags: new Set(),\n            preloadCallbacks,\n            MetadataOutlet,\n          })\n        : await walkTreeWithFlightRouterState({\n            ctx,\n            loaderTreeToFilter: loaderTree,\n            parentParams: {},\n            flightRouterState,\n            rscHead,\n            injectedCSS: new Set(),\n            injectedJS: new Set(),\n            injectedFontPreloadTags: new Set(),\n            rootLayoutIncluded: false,\n            preloadCallbacks,\n            MetadataOutlet,\n            hintTree: ctx.renderOpts.prefetchHints?.[ctx.pagePath] ?? null,\n          })\n    ).map((path) => path.slice(1)) // remove the '' (root) segment\n  }\n\n  // In dev, the Vary header may not reliably reflect whether a route can\n  // be intercepted, because interception routes are compiled on demand.\n  // Default to true so the client doesn't cache a stale Fallback entry.\n  const varyHeader = ctx.res.getHeader('vary')\n  const couldBeIntercepted =\n    !!process.env.__NEXT_DEV_SERVER ||\n    (typeof varyHeader === 'string' && varyHeader.includes(NEXT_URL))\n\n  // If we have an action result, then this is a server action response.\n  // We can rely on this because `ActionResult` will always be a promise, even if\n  // the result is falsey.\n  if (options?.actionResult) {\n    return maybeAppendBuildIdToRSCPayload(ctx, {\n      a: options.actionResult,\n      f: flightData,\n      q: getRenderedSearch(query),\n      i: !!couldBeIntercepted,\n    })\n  }\n\n  // Otherwise, it's a regular RSC response.\n  const baseResponse: NavigationFlightResponse = maybeAppendBuildIdToRSCPayload(\n    ctx,\n    {\n      f: flightData,\n      q: getRenderedSearch(query),\n      i: !!couldBeIntercepted,\n      S: workStore.isStaticGeneration,\n      h: getMetadataVaryParamsAccumulator(),\n      r: getRootParamsVaryParamsAccumulator() ?? undefined,\n    }\n  )\n\n  if (options?.staleTimeIterable !== undefined) {\n    baseResponse.s = options.staleTimeIterable\n  }\n\n  if (options?.staticStageByteLengthPromise !== undefined) {\n    baseResponse.l = options.staticStageByteLengthPromise\n  }\n  if (options?.shellByteLengthPromise !== undefined) {\n    baseResponse.a = options.shellByteLengthPromise\n  }\n  if (options?.shellUsedSessionDataPromise !== undefined) {\n    baseResponse.u = options.shellUsedSessionDataPromise\n  }\n\n  if (options?.runtimePrefetchStream !== undefined) {\n    baseResponse.p = options.runtimePrefetchStream\n  }\n\n  // Include the per-page dynamic stale time from unstable_dynamicStaleTime, but only\n  // for dynamic renders (not prerenders/static generation). The client treats\n  // its presence as authoritative.\n  // TODO: Move this to the prefetch hints file so we don't have to walk the\n  // tree on every render.\n  if (!workStore.isStaticGeneration) {\n    const dynamicStaleTime = await getDynamicStaleTime(\n      ctx.componentMod.routeModule.userland.loaderTree\n    )\n    if (dynamicStaleTime !== null) {\n      baseResponse.d = dynamicStaleTime\n    }\n  }\n\n  return baseResponse\n}\n\nfunction createErrorContext(\n  ctx: AppRenderContext,\n  renderSource: RequestErrorContext['renderSource']\n): RequestErrorContext {\n  return {\n    routerKind: 'App Router',\n    routePath: ctx.pagePath,\n    // TODO: is this correct if `isPossibleServerAction` is a false positive?\n    routeType: ctx.isPossibleServerAction ? 'action' : 'render',\n    renderSource,\n    revalidateReason: getRevalidateReason(ctx.workStore),\n  }\n}\n\n/**\n * Produces a RenderResult containing the Flight data for the given request. See\n * `generateDynamicRSCPayload` for information on the contents of the render result.\n */\nasync function generateDynamicFlightRenderResult(\n  req: BaseNextRequest,\n  ctx: AppRenderContext,\n  requestStore: RequestStore,\n  options?: {\n    actionResult: ActionResult\n    skipPageRendering: boolean\n    componentTree?: CacheNodeSeedData\n    preloadCallbacks?: PreloadCallbacks\n    temporaryReferences?: WeakMap<any, string>\n    waitUntil?: Promise<unknown>\n  }\n): Promise<RenderResult> {\n  const { htmlRequestId, renderOpts, requestId, workStore } = ctx\n\n  const {\n    onInstrumentationRequestError,\n    setReactDebugChannel,\n    isBuildTimePrerendering = false,\n  } = renderOpts\n\n  function onFlightDataRenderError(err: DigestedError, silenceLog: boolean) {\n    return onInstrumentationRequestError?.(\n      err,\n      req,\n      createErrorContext(ctx, 'react-server-components-payload'),\n      silenceLog\n    )\n  }\n\n  const onError = createReactServerErrorHandler(\n    process.env.NODE_ENV === 'development',\n    isBuildTimePrerendering,\n    workStore.reactServerErrorsByDigest,\n    onFlightDataRenderError\n  )\n\n  // With Server Components HMR cancellation enabled, a superseded HMR refresh\n  // aborts its own client fetch, which closes this response. We use that\n  // response-close to abort the discarded render. This is the\n  // non-Cache-Components dev RSC path; unlike the Cache Components staged path\n  // it has no detached validation, so the render is the only work to cancel.\n  const requestAbortSignal =\n    process.env.__NEXT_DEV_SERVER &&\n    renderOpts.experimental.serverComponentsHmrCancellation === true &&\n    requestStore.isHmrRefresh === true &&\n    isNodeNextResponse(ctx.res)\n      ? signalFromNodeResponse(ctx.res.originalResponse)\n      : undefined\n\n  if (process.env.__NEXT_USE_NODE_STREAMS) {\n    const debugChannel = setReactDebugChannel && createNodeDebugChannel()\n\n    if (debugChannel) {\n      setReactDebugChannel(debugChannel.clientSide, htmlRequestId, requestId)\n    }\n\n    const { clientModules } = getClientReferenceManifest()\n\n    const rscPayload = await workUnitAsyncStorage.run(\n      requestStore,\n      generateDynamicRSCPayload,\n      ctx,\n      options\n    )\n\n    const flightStream = workUnitAsyncStorage.run(\n      requestStore,\n      renderToNodeFlightStream,\n      ctx.componentMod,\n      rscPayload,\n      clientModules,\n      {\n        onError,\n        temporaryReferences: options?.temporaryReferences,\n        filterStackFrame,\n        debugChannel: debugChannel?.serverSide,\n        signal: requestAbortSignal,\n      }\n    )\n\n    return new FlightRenderResult(\n      flightStream,\n      { fetchMetrics: workStore.fetchMetrics },\n      options?.waitUntil\n    )\n  } else {\n    const debugChannel = setReactDebugChannel && createWebDebugChannel()\n\n    if (debugChannel) {\n      setReactDebugChannel(debugChannel.clientSide, htmlRequestId, requestId)\n    }\n\n    const { clientModules } = getClientReferenceManifest()\n\n    const rscPayload = await workUnitAsyncStorage.run(\n      requestStore,\n      generateDynamicRSCPayload,\n      ctx,\n      options\n    )\n\n    const flightStream = workUnitAsyncStorage.run(\n      requestStore,\n      renderToWebFlightStream,\n      ctx.componentMod,\n      rscPayload,\n      clientModules,\n      {\n        onError,\n        temporaryReferences: options?.temporaryReferences,\n        filterStackFrame,\n        debugChannel: debugChannel?.serverSide,\n        signal: requestAbortSignal,\n      }\n    )\n\n    return new FlightRenderResult(\n      flightStream,\n      { fetchMetrics: workStore.fetchMetrics },\n      options?.waitUntil\n    )\n  }\n}\n\n/**\n * Production-only staged dynamic flight render for cache components (Node.js\n * streams). Uses staged rendering to separate static (RDC-backed) from\n * runtime/dynamic content.\n */\nasync function generateStagedDynamicFlightRenderResultNode(\n  req: BaseNextRequest,\n  ctx: AppRenderContext,\n  requestStore: RequestStore\n): Promise<RenderResult> {\n  const { componentMod, workStore, renderOpts } = ctx\n  const { routeModule } = componentMod\n  const { loaderTree } = routeModule.userland\n  const { onInstrumentationRequestError, experimental } = renderOpts\n\n  function onFlightDataRenderError(err: DigestedError, silenceLog: boolean) {\n    return onInstrumentationRequestError?.(\n      err,\n      req,\n      createErrorContext(ctx, 'react-server-components-payload'),\n      silenceLog\n    )\n  }\n\n  const onError = createReactServerErrorHandler(\n    false,\n    false,\n    workStore.reactServerErrorsByDigest,\n    onFlightDataRenderError\n  )\n\n  const selectStaleTime = createSelectStaleTime(experimental)\n  const staleTimeIterable = new StaleTimeIterable()\n\n  const stageController = new StagedRenderingController({\n    abortSignal: null,\n    abandonController: null,\n    // TODO(cached-navs): this assumes that we checked during build that there's no sync IO.\n    // but it can happen e.g. after a revalidation or conditionally for a param that wasn't prerendered.\n    // we should change this to track sync IO, log an error and advance to dynamic.\n    syncIO: SyncIOMode.Untracked,\n    finalStage: null,\n  })\n\n  // Initialize stale time tracking on the request store.\n  requestStore.stale = INFINITE_CACHE\n  requestStore.stagedRendering = stageController\n  requestStore.varyParamsAccumulator = createResponseVaryParamsAccumulator()\n  requestStore.asyncApiPromises = createAsyncApiPromises(\n    stageController,\n    requestStore.cookies,\n    requestStore.mutableCookies,\n    requestStore.headers\n  )\n\n  trackStaleTime(\n    requestStore as { stale: number },\n    staleTimeIterable,\n    selectStaleTime\n  )\n\n  const shellByteLengthDeferred = createPromiseWithResolvers<number | null>()\n  const staticStageByteLengthDeferred = createPromiseWithResolvers<number>()\n\n  let runtimePrefetchStream: ReadableStream<Uint8Array> | undefined\n\n  // Check if this route should runtime-cache its navigation. This happens when\n  // Partial Prefetching is enabled for the route, either per segment (a\n  // `prefetch` of 'partial' or 'unstable_eager') or globally (the\n  // `partialPrefetching` config). If so, we piggyback on the dynamic render to\n  // fill caches and then spawn a final runtime prerender whose result stream\n  // is embedded in the RSC payload. This is gated because it adds extra server\n  // processing and increases the response payload size.\n  if (\n    Boolean(renderOpts.partialPrefetching) ||\n    (await anySegmentHasPartialPrefetchingEnabled(loaderTree))\n  ) {\n    // Create a mutable cache that gets filled during the dynamic render.\n    const prerenderResumeDataCache = createPrerenderResumeDataCache()\n    requestStore.resumeDataCache = prerenderResumeDataCache\n\n    const cacheSignal = new CacheSignal()\n    trackPendingModules(cacheSignal)\n    requestStore.cacheSignal = cacheSignal\n\n    // Create a deferred stream for the runtime prefetch result. Its readable\n    // side goes into the RSC payload (Flight serializes it lazily). The\n    // writable side receives the runtime prerender result once the dynamic\n    // render has filled all caches.\n    const runtimePrefetchTransform = new TransformStream<Uint8Array>()\n    runtimePrefetchStream = runtimePrefetchTransform.readable\n\n    // Wait for the dynamic render to fill caches, then run the final runtime\n    // prerender (fire-and-forget — does not block the response).\n    void cacheSignal\n      .cacheReady()\n      .then(() =>\n        spawnRuntimePrefetchWithFilledCaches(\n          runtimePrefetchTransform.writable,\n          ctx,\n          prerenderResumeDataCache,\n          requestStore,\n          onError\n        )\n      )\n  }\n\n  const rscPayload = await workUnitAsyncStorage.run(\n    requestStore,\n    generateDynamicRSCPayload,\n    ctx,\n    {\n      staleTimeIterable,\n      staticStageByteLengthPromise: staticStageByteLengthDeferred.promise,\n      shellByteLengthPromise: shellByteLengthDeferred.promise,\n      runtimePrefetchStream,\n    }\n  )\n\n  const { clientModules } = getClientReferenceManifest()\n\n  const flightStream = await runInSequentialTasks(\n    () => {\n      stageController.advanceStage(RenderStage.ShellStatic)\n\n      const sourceStream = workUnitAsyncStorage.run(\n        requestStore,\n        renderToNodeFlightStream,\n        ctx.componentMod,\n        rscPayload,\n        clientModules,\n        { onError, filterStackFrame }\n      ) as Readable\n\n      const replayable = new ReplayableNodeStream(sourceStream)\n      const dynamicStream = replayable.createReplayStream()\n      const staticStream = replayable.createReplayStream()\n\n      void countShellAndStaticStageBytes(staticStream, stageController).then(\n        (byteLengths) => {\n          staticStageByteLengthDeferred.resolve(byteLengths[RenderStage.Static])\n          shellByteLengthDeferred.resolve(byteLengths[RenderStage.ShellStatic])\n        }\n      )\n\n      return dynamicStream\n    },\n    () => {\n      stageController.advanceStage(RenderStage.Static)\n    },\n    () => {\n      // This is a separate task that doesn't advance a stage. It forces\n      // draining the immediate queue so that the stale time iterable and vary\n      // params accumulators are flushed before we advance to the dynamic stage.\n      staleTimeIterable.close()\n      if (requestStore.varyParamsAccumulator) {\n        finishAccumulatingVaryParams(requestStore.varyParamsAccumulator)\n      }\n    },\n    () => {\n      stageController.advanceStage(RenderStage.Dynamic)\n    }\n  )\n\n  return new FlightRenderResult(flightStream, {\n    fetchMetrics: workStore.fetchMetrics,\n  })\n}\n\n/**\n * Runs a final runtime prerender using the provided (already filled) cache and\n * pipes its output into the provided writable stream. The caller is responsible\n * for waiting until caches are warm before calling this function.\n */\nasync function spawnRuntimePrefetchWithFilledCaches(\n  writable: WritableStream<Uint8Array>,\n  ctx: AppRenderContext,\n  prerenderResumeDataCache: PrerenderResumeDataCache,\n  requestStore: RequestStore,\n  onError: (err: unknown) => string | undefined\n): Promise<void> {\n  try {\n    const { componentMod, getDynamicParamFromSegment } = ctx\n    const { loaderTree } = componentMod.routeModule.userland\n\n    const rootParams = getRootParams(loaderTree, getDynamicParamFromSegment)\n    const staleTimeIterable = new StaleTimeIterable()\n\n    // We want to be able to rewind the result to a session shell.\n    const mode: RuntimePrerenderMode = {\n      type: 'rewindable-session-shell',\n      shellUsedSessionDataDeferred: createPromiseWithResolvers(),\n      shellByteLengthDeferred: createPromiseWithResolvers(),\n    }\n\n    const { result } = await finalRuntimeServerPrerender(\n      mode,\n      ctx,\n      generateDynamicRSCPayload.bind(null, ctx, {\n        staleTimeIterable,\n        shellByteLengthPromise:\n          mode.type === 'rewindable-session-shell'\n            ? mode.shellByteLengthDeferred.promise\n            : undefined,\n        shellUsedSessionDataPromise: mode.shellUsedSessionDataDeferred.promise,\n      }),\n      prerenderResumeDataCache,\n      rootParams,\n      requestStore.headers,\n      requestStore.cookies,\n      requestStore.draftMode,\n      onError,\n      staleTimeIterable,\n      // This path is only reached on the production Cache Components + Cached\n      // Navigations renders (the staged Flight response and the HTML hydration\n      // payload), which set up no React debug channel.\n      undefined\n    )\n\n    await result.prelude.pipeTo(writable)\n  } catch {\n    // Runtime prerender failed. Close the stream gracefully — the navigation\n    // still works, we just won't get cached runtime data.\n    try {\n      await writable.close()\n    } catch {\n      // Writable may already be closed/errored.\n    }\n  }\n}\n\ntype RenderToReadableStreamServerOptions = NonNullable<\n  Parameters<\n    (typeof import('react-server-dom-webpack/server.node'))['renderToReadableStream']\n  >[2]\n>\n\nasync function stagedRenderWithoutCachesInDevNode(\n  ctx: AppRenderContext,\n  requestStore: RequestStore,\n  getPayload: (requestStore: RequestStore) => Promise<RSCPayload>,\n  options: Omit<RenderToReadableStreamServerOptions, 'environmentName'>\n) {\n  // We're rendering while bypassing caches,\n  // so we have no hope of showing a useful runtime stage.\n  // But we still want things like `params` to show up in devtools correctly,\n  // which relies on mechanisms we've set up for staged rendering,\n  // so we do a 2-task version (Static -> Dynamic) instead.\n\n  // We aren't filling caches so we don't need to abort this render, it'll\n  // stream in a single pass\n  const stageController = new StagedRenderingController({\n    abortSignal: null,\n    abandonController: null,\n    syncIO: SyncIOMode.Untracked, // do not track sync IO (we don't have reliable stages)\n    finalStage: null,\n  })\n\n  const environmentName = () => {\n    const currentStage = stageController.currentStage\n    return getEnvironmentNameForStageWithoutCaches(currentStage)\n  }\n\n  requestStore.stagedRendering = stageController\n  requestStore.asyncApiPromises = createAsyncApiPromises(\n    stageController,\n    requestStore.cookies,\n    requestStore.mutableCookies,\n    requestStore.headers\n  )\n\n  const { clientModules } = getClientReferenceManifest()\n  const rscPayload = await getPayload(requestStore)\n\n  return await runInSequentialTasks(\n    () => {\n      stageController.advanceStage(RenderStage.ShellStatic)\n\n      return workUnitAsyncStorage.run(\n        requestStore,\n        renderToNodeFlightStream,\n        ctx.componentMod,\n        rscPayload,\n        clientModules,\n        {\n          ...options,\n          environmentName,\n        }\n      )\n    },\n    () => {\n      stageController.advanceStage(RenderStage.Static)\n    },\n    () => {\n      stageController.advanceStage(RenderStage.Dynamic)\n    }\n  )\n}\n\nfunction getEnvironmentNameForStageWithoutCaches(stage: RenderStage) {\n  switch (stage) {\n    case RenderStage.Before:\n    case RenderStage.ShellStatic:\n    case RenderStage.Static:\n      return 'Prerender'\n    case RenderStage.ShellRuntime:\n    case RenderStage.Runtime:\n    case RenderStage.Dynamic:\n    case RenderStage.Abandoned:\n      return 'Server'\n    default:\n      stage satisfies never\n      throw new InvariantError(`Invalid render stage: ${stage}`)\n  }\n}\n\n/**\n * Fork of `generateDynamicFlightRenderResult` that renders using `renderWithRestartOnCacheMissInDev`\n * to ensure correct separation of environments Prerender/Server (for use in Cache Components)\n */\nasync function generateDynamicFlightRenderResultWithStagesInDev(\n  req: BaseNextRequest,\n  ctx: AppRenderContext,\n  initialRequestStore: RequestStore,\n  createRequestStore: (() => RequestStore) | undefined,\n  fallbackParams: OpaqueFallbackRouteParams | null\n): Promise<RenderResult> {\n  const {\n    htmlRequestId,\n    renderOpts,\n    requestId,\n    workStore,\n    componentMod: {\n      createElement,\n      routeModule: {\n        userland: { loaderTree },\n      },\n    },\n    url,\n  } = ctx\n\n  const {\n    onInstrumentationRequestError,\n    setReactDebugChannel,\n    setCacheStatus,\n    isBuildTimePrerendering = false,\n  } = renderOpts\n\n  let didErrorObservably = false\n  function onFlightDataRenderError(err: DigestedError, silenceLog: boolean) {\n    didErrorObservably = true\n    return onInstrumentationRequestError?.(\n      err,\n      req,\n      createErrorContext(ctx, 'react-server-components-payload'),\n      silenceLog\n    )\n  }\n\n  const onError = createReactServerErrorHandler(\n    process.env.NODE_ENV === 'development',\n    isBuildTimePrerendering,\n    workStore.reactServerErrorsByDigest,\n    onFlightDataRenderError\n  )\n\n  // We validate RSC requests for HMR refreshes and client navigations when\n  // instant configs exist, since we render all the layouts necessary to perform\n  // the validation in those cases.\n  const shouldValidate =\n    !ctx.isPrefetch &&\n    !isBypassingCachesInDev(initialRequestStore, workStore) &&\n    (initialRequestStore.isHmrRefresh === true ||\n      (await anySegmentNeedsInstantValidationInDev(loaderTree)))\n\n  const getPayload = async (requestStore: RequestStore) => {\n    const payload: RSCPayload &\n      RSCPayloadDevProperties &\n      RSCInitialPayloadPartialDev = await workUnitAsyncStorage.run(\n      requestStore,\n      generateDynamicRSCPayload,\n      ctx,\n      undefined\n    )\n\n    if (isBypassingCachesInDev(requestStore, workStore)) {\n      // Mark the RSC payload to indicate that caches were bypassed in dev.\n      // This lets the client know not to cache anything based on this render.\n      payload._bypassCachesInDev = createElement(WarnForBypassCachesInDev, {\n        route: workStore.route,\n      })\n    } else if (shouldValidate) {\n      // If this payload will be used for validation, it needs to contain the\n      // canonical URL. Without it we'd get an error.\n      payload.c = prepareInitialCanonicalUrl(url)\n    }\n\n    return payload\n  }\n\n  let debugChannel: DebugChannelPair | undefined\n  let stream: AnyStream\n\n  if (\n    // We only do this flow if we can safely recreate the store from scratch\n    // (which is not the case for renders after an action)\n    createRequestStore &&\n    // We only do this flow if we're not bypassing caches in dev using\n    // \"disable cache\" in devtools, a hard refresh (cache-control: \"no-cache\"),\n    // or draft mode.\n    !isBypassingCachesInDev(initialRequestStore, workStore)\n  ) {\n    // Before we kick off the render, we set the cache status back to it's initial state\n    // in case a previous render bypassed the cache.\n    if (setCacheStatus) {\n      setCacheStatus('ready', htmlRequestId)\n    }\n\n    const prefetchMode = await getPrefetchingModeForPage(renderOpts, loaderTree)\n\n    // A client navigation into a Partial Prefetching route extends the shell\n    // through the runtime-prefetchable content: it has already settled on the\n    // client (via the prefetch) by the time it navigates, so it belongs in this\n    // response's shell. Everything else uses the static shell, like an initial\n    // load: plain navigations, and HMR refreshes (a fresh render of the current\n    // page, with no settled prefetch to draw on). Dynamic content always\n    // streams in after the shell.\n    let prefetchStage: StreamRevealStage\n\n    if (initialRequestStore.isHmrRefresh === true) {\n      prefetchStage = RenderStage.Static\n    } else {\n      if (prefetchMode === PrefetchingMode.Partial) {\n        // TODO(app-shells): model `partialPrefetching: \"unstable_eager\"`\n        // TODO(app-shells): if this navigation came from <Link prefetch={true} />,\n        // we should show the shell for a speculative prefetch\n        // (which can have more data than the app shell)\n        prefetchStage = RenderStage.ShellRuntime\n      } else {\n        prefetchStage = RenderStage.Static\n      }\n    }\n\n    // With Server Components HMR cancellation enabled, a superseded HMR refresh\n    // aborts its own client fetch (see the client-side supersession logic),\n    // which closes this response. We use that response-close as the signal to\n    // stop the server work this refresh started that's now discarded: the\n    // streaming render below is aborted, and the detached validation is skipped\n    // (including aborting the background renders it uses to prepare its\n    // inputs). The render's in-flight `'use cache'` fills are left running,\n    // since they aren't tied to its controller. A superseding refresh can't\n    // reuse those fills today, because each edit changes the HMR hash baked\n    // into the cache key; that becomes useful only once those keys use\n    // implementation-derived hashes instead (see `use-cache-wrapper.ts`).\n    //\n    // The detached validation is Cache Components only: it runs only on this\n    // staged dev render, so there's nothing to skip on the non-Cache Components\n    // dev RSC path. That path (`generateDynamicFlightRenderResult`) aborts its\n    // superseded render the same way; it just has no validation to skip.\n    //\n    // TODO: The gate is `isHmrRefresh` for now because that's the only case we\n    // cancel today. The response-close signal itself is general, so this could\n    // later be relaxed to also cover a browser stop or a devtools \"cancel\n    // render\" button.\n    const requestAbortSignal =\n      renderOpts.experimental.serverComponentsHmrCancellation === true &&\n      initialRequestStore.isHmrRefresh === true &&\n      isNodeNextResponse(ctx.res)\n        ? signalFromNodeResponse(ctx.res.originalResponse)\n        : undefined\n\n    const result = await stagedRenderWithCachesInDev({\n      prefetchMode,\n      ctx,\n      requestStore: initialRequestStore,\n      createRequestStore,\n      getPayload,\n      onError,\n      shouldValidate,\n      fallbackRouteParams: fallbackParams,\n      getDevRenderDidError: () => didErrorObservably,\n      navigationKind: {\n        type: 'prefetched-client',\n        prefetchStage,\n      },\n      requestAbortSignal,\n    })\n    stream = result.stream\n    debugChannel = result.debugChannel\n  } else {\n    // We're either bypassing caches or we can't restart the render.\n    // Do a dynamic render, but with (basic) environment labels.\n\n    // Set cache status to bypass when specifically bypassing caches in dev\n    if (setCacheStatus) {\n      setCacheStatus('bypass', htmlRequestId)\n    }\n\n    debugChannel = setReactDebugChannel && createNodeDebugChannel()\n\n    stream = await stagedRenderWithoutCachesInDevNode(\n      ctx,\n      initialRequestStore,\n      getPayload,\n      {\n        onError: onError,\n        filterStackFrame,\n        debugChannel: debugChannel?.serverSide,\n      }\n    )\n  }\n\n  if (debugChannel && setReactDebugChannel) {\n    setReactDebugChannel(debugChannel.clientSide, htmlRequestId, requestId)\n  }\n\n  return new FlightRenderResult(stream, {\n    fetchMetrics: workStore.fetchMetrics,\n  })\n}\n\nasync function generateRuntimePrefetchResult(\n  req: BaseNextRequest,\n  ctx: AppRenderContext,\n  requestStore: RequestStore,\n  isShellPrefetch: boolean\n): Promise<RenderResult> {\n  const { workStore, renderOpts, htmlRequestId, requestId } = ctx\n  const {\n    isBuildTimePrerendering = false,\n    onInstrumentationRequestError,\n    setReactDebugChannel,\n  } = renderOpts\n\n  function onFlightDataRenderError(err: DigestedError, silenceLog: boolean) {\n    return onInstrumentationRequestError?.(\n      err,\n      req,\n      // TODO(runtime-ppr): should we use a different value?\n      createErrorContext(ctx, 'react-server-components-payload'),\n      silenceLog\n    )\n  }\n\n  const onError = createReactServerErrorHandler(\n    false,\n    isBuildTimePrerendering,\n    workStore.reactServerErrorsByDigest,\n    onFlightDataRenderError\n  )\n\n  const metadata: AppPageRenderResultMetadata = {}\n  const staleTimeIterable = new StaleTimeIterable()\n\n  const {\n    componentMod: {\n      routeModule: {\n        userland: { loaderTree },\n      },\n    },\n    getDynamicParamFromSegment,\n  } = ctx\n  const rootParams = getRootParams(loaderTree, getDynamicParamFromSegment)\n\n  // We need to share caches between the prospective prerender and the final prerender,\n  // but we're not going to persist this anywhere.\n  const prerenderResumeDataCache = createPrerenderResumeDataCache()\n\n  await prospectiveRuntimeServerPrerender(\n    ctx,\n    isShellPrefetch,\n    generateDynamicRSCPayload.bind(null, ctx),\n    prerenderResumeDataCache,\n    rootParams,\n    requestStore.headers,\n    requestStore.cookies,\n    requestStore.draftMode\n  )\n\n  const mode: RuntimePrerenderMode = isShellPrefetch\n    ? {\n        type: 'session-shell-only',\n        shellUsedSessionDataDeferred: createPromiseWithResolvers(),\n      }\n    : {\n        type: 'rewindable-session-shell',\n        shellUsedSessionDataDeferred: createPromiseWithResolvers(),\n        shellByteLengthDeferred: createPromiseWithResolvers(),\n      }\n\n  const debugChannel = setReactDebugChannel\n    ? createWebDebugChannel()\n    : undefined\n  if (debugChannel && setReactDebugChannel) {\n    setReactDebugChannel(debugChannel.clientSide, htmlRequestId, requestId)\n  }\n\n  const response = await finalRuntimeServerPrerender(\n    mode,\n    ctx,\n    generateDynamicRSCPayload.bind(null, ctx, {\n      staleTimeIterable,\n      shellByteLengthPromise:\n        mode.type === 'rewindable-session-shell'\n          ? mode.shellByteLengthDeferred.promise\n          : undefined,\n      shellUsedSessionDataPromise: mode.shellUsedSessionDataDeferred.promise,\n    }),\n    prerenderResumeDataCache,\n    rootParams,\n    requestStore.headers,\n    requestStore.cookies,\n    requestStore.draftMode,\n    onError,\n    staleTimeIterable,\n    debugChannel?.serverSide\n  )\n\n  applyMetadataFromPrerenderResult(response, metadata, workStore)\n  metadata.fetchMetrics = ctx.workStore.fetchMetrics\n\n  return new FlightRenderResult(response.result.prelude, metadata)\n}\n\nasync function prospectiveRuntimeServerPrerender(\n  ctx: AppRenderContext,\n  isShellPrefetch: boolean,\n  getPayload: () => Promise<RSCPayload>,\n  resumeDataCache: PrerenderResumeDataCache | null,\n  rootParams: Params,\n  headers: PrerenderStoreModernRuntime['headers'],\n  cookies: PrerenderStoreModernRuntime['cookies'],\n  draftMode: PrerenderStoreModernRuntime['draftMode']\n) {\n  const { implicitTags, renderOpts, workStore } = ctx\n  const { ComponentMod } = renderOpts\n\n  // Prerender controller represents the lifetime of the prerender.\n  // It will be aborted when a Task is complete or a synchronously aborting\n  // API is called. Notably during cache-filling renders this does not actually\n  // terminate the render itself which will continue until all caches are filled\n  const initialServerPrerenderController = new AbortController()\n\n  // This controller represents the lifetime of the React render call. Notably\n  // during the cache-filling render it is different from the prerender controller\n  // because we don't want to end the react render until all caches are filled.\n  const initialServerRenderController = new AbortController()\n\n  // The cacheSignal helps us track whether caches are still filling or we are ready\n  // to cut the render off.\n  const cacheSignal = new CacheSignal()\n\n  const initialServerPrerenderStore: PrerenderStoreModernRuntime = {\n    type: 'prerender-runtime',\n    phase: 'render',\n    rootParams,\n    implicitTags,\n    renderSignal: initialServerRenderController.signal,\n    controller: initialServerPrerenderController,\n    // During the initial prerender we need to track all cache reads to ensure\n    // we render long enough to fill every cache it is possible to visit during\n    // the final prerender.\n    cacheSignal,\n    // We only need to track dynamic accesses during the final prerender.\n    dynamicTracking: null,\n    // Runtime prefetches are never cached server-side, only client-side,\n    // so we set `expire` and `revalidate` to their minimum values just in case.\n    revalidate: 1,\n    expire: 0,\n    stale: INFINITE_CACHE,\n    tags: [...implicitTags.tags],\n    resumeDataCache,\n    hmrRefreshHash: undefined,\n    // We don't track vary params during initial prerender, only the final one\n    varyParamsAccumulator: null,\n    // No stage sequencing needed for prospective renders.\n    stagedRendering: null,\n    isSessionShell: isShellPrefetch,\n    // These are not present in regular prerenders, but allowed in a runtime\n    // prerender.\n    // Any cache keyed on headers() or cookies() needs to be invalidated.\n    // Otherwise some Next.js API semantics leak across render passes.\n    headers: HeadersAdapter.fresh(headers),\n    cookies: RequestCookiesAdapter.fresh(cookies),\n    draftMode,\n  }\n\n  const { clientModules } = getClientReferenceManifest()\n\n  // We're not going to use the result of this render because the only time it could be used\n  // is if it completes in a microtask and that's likely very rare for any non-trivial app\n  const initialServerPayload = await workUnitAsyncStorage.run(\n    initialServerPrerenderStore,\n    getPayload\n  )\n\n  const prerenderOptions = {\n    filterStackFrame,\n    onError: (err: unknown) => {\n      const digest = getDigestForWellKnownError(err)\n\n      if (digest) {\n        return digest\n      }\n\n      if (initialServerPrerenderController.signal.aborted) {\n        // The render aborted before this error was handled which indicates\n        // the error is caused by unfinished components within the render\n        return\n      } else if (\n        process.env.NEXT_DEBUG_BUILD ||\n        process.env.__NEXT_VERBOSE_LOGGING\n      ) {\n        printDebugThrownValueForProspectiveRender(\n          err,\n          workStore.route,\n          Phase.ProspectiveRender\n        )\n      }\n    },\n    // We don't want to stop rendering until the cacheSignal is complete so we pass\n    // a different signal to this render call than is used by dynamic APIs to signify\n    // transitioning out of the prerender environment\n    signal: initialServerRenderController.signal,\n  }\n\n  const pendingInitialServerResult = workUnitAsyncStorage.run(\n    initialServerPrerenderStore,\n    getServerPrerender(ComponentMod),\n    initialServerPayload,\n    clientModules,\n    prerenderOptions\n  )\n\n  // Wait for all caches to be finished filling and for async imports to resolve\n  trackPendingModules(cacheSignal)\n  await cacheSignal.cacheReady()\n\n  initialServerRenderController.abort()\n  initialServerPrerenderController.abort()\n\n  // We don't need to continue the prerender process if we already\n  // detected invalid dynamic usage in the initial prerender phase.\n  if (workStore.invalidDynamicUsageError) {\n    throw workStore.invalidDynamicUsageError\n  }\n\n  try {\n    return await createReactServerPrerenderResult(pendingInitialServerResult)\n  } catch (err) {\n    if (\n      initialServerRenderController.signal.aborted ||\n      initialServerPrerenderController.signal.aborted\n    ) {\n      // These are expected errors that might error the prerender. we ignore them.\n    } else if (\n      process.env.NEXT_DEBUG_BUILD ||\n      process.env.__NEXT_VERBOSE_LOGGING\n    ) {\n      // We don't normally log these errors because we are going to retry anyway but\n      // it can be useful for debugging Next.js itself to get visibility here when needed\n      printDebugThrownValueForProspectiveRender(\n        err,\n        workStore.route,\n        Phase.ProspectiveRender\n      )\n    }\n    return null\n  }\n}\n\n/**\n * Prepends a single ASCII byte to the chunks indicating whether the response\n * is partial (contains dynamic holes): '~' (0x7e) for partial, '#' (0x23)\n * for complete.\n */\nfunction prependIsPartialByteToChunks(\n  chunks: Uint8Array[],\n  isPartial: boolean\n) {\n  const markerByte = isPartial ? 0x7e : 0x23\n  return [new Uint8Array([markerByte]), ...chunks]\n}\n\ntype RuntimePrerenderMode =\n  | {\n      type: 'session-shell-only'\n      shellUsedSessionDataDeferred: PromiseWithResolvers<boolean>\n    }\n  | {\n      type: 'rewindable-session-shell'\n      shellUsedSessionDataDeferred: PromiseWithResolvers<boolean>\n      shellByteLengthDeferred: PromiseWithResolvers<number | null>\n    }\n\nasync function finalRuntimeServerPrerender(\n  mode: RuntimePrerenderMode,\n  ctx: AppRenderContext,\n  getPayload: () => Promise<RSCPayload>,\n  resumeDataCache: PrerenderResumeDataCache | null,\n  rootParams: Params,\n  headers: PrerenderStoreModernRuntime['headers'],\n  cookies: PrerenderStoreModernRuntime['cookies'],\n  draftMode: PrerenderStoreModernRuntime['draftMode'],\n  onError: (err: unknown) => string | undefined,\n  staleTimeIterable: StaleTimeIterable,\n  debugChannel: RenderToReadableStreamServerOptions['debugChannel']\n) {\n  const { implicitTags, renderOpts } = ctx\n  const { ComponentMod, experimental, isDebugDynamicAccesses } = renderOpts\n  const selectStaleTime = createSelectStaleTime(experimental)\n\n  let resultIsPartial = false\n  const finalServerController = new AbortController()\n\n  const serverDynamicTracking = createDynamicTrackingState(\n    isDebugDynamicAccesses\n  )\n\n  const finalStageController = new StagedRenderingController({\n    abortSignal: finalServerController.signal,\n    abandonController: null,\n    // In dynamic renders, we allow Sync IO in the Runtime stage\n    // if partialPrefetching is not enabled. However, a runtime prerender\n    // (or App Shell) is stricter and never allows sync IO in any stage\n    // that we go through here (i.e. < Dynamic)\n    syncIO: SyncIOMode.AllowedInDynamic,\n    // we only reach the runtime stage if we're doing a rewindable render\n    finalStage:\n      mode.type === 'session-shell-only'\n        ? RenderStage.ShellRuntime\n        : RenderStage.Runtime,\n  })\n\n  const varyParamsAccumulator = createResponseVaryParamsAccumulator()\n\n  const finalServerPrerenderStore: PrerenderStoreModernRuntime = {\n    type: 'prerender-runtime',\n    phase: 'render',\n    rootParams,\n    implicitTags,\n    renderSignal: finalServerController.signal,\n    controller: finalServerController,\n    // All caches we could read must already be filled so no tracking is necessary\n    cacheSignal: null,\n    dynamicTracking: serverDynamicTracking,\n    // Runtime prefetches are never cached server-side, only client-side,\n    // so we set `expire` and `revalidate` to their minimum values just in case.\n    revalidate: 1,\n    expire: 0,\n    stale: INFINITE_CACHE,\n    tags: [...implicitTags.tags],\n    resumeDataCache,\n    hmrRefreshHash: undefined,\n    varyParamsAccumulator,\n    stagedRendering: finalStageController,\n    isSessionShell: mode.type === 'session-shell-only',\n    // These are not present in regular prerenders, but allowed in a runtime\n    // prerender.\n    headers: HeadersAdapter.fresh(headers),\n    cookies: RequestCookiesAdapter.fresh(cookies),\n    draftMode,\n  }\n\n  trackStaleTime(finalServerPrerenderStore, staleTimeIterable, selectStaleTime)\n\n  const { clientModules } = getClientReferenceManifest()\n\n  const finalRSCPayload = await workUnitAsyncStorage.run(\n    finalServerPrerenderStore,\n    getPayload\n  )\n\n  const streamState = createStreamPendingState()\n  const collectedChunks = createPrerenderChunksAccumulator()\n  const stageByteLengths = createStageByteLengths()\n  const collectChunk = (chunk: Uint8Array) => {\n    collectPrerenderChunk(collectedChunks, finalServerController.signal, chunk)\n    increaseChunkByteLengths(\n      stageByteLengths,\n      finalStageController.currentStage,\n      chunk.byteLength\n    )\n  }\n\n  let didHandleUnexpectedAbort = false\n  /**\n   * @returns - whether or not the task should be skipped\n   * because the render was already aborted.\n   * */\n  const checkUnexpectedAbort = (): boolean => {\n    if (finalServerController.signal.aborted) {\n      // If the server controller is already aborted, then we must have encountered sync IO\n      if (!didHandleUnexpectedAbort) {\n        didHandleUnexpectedAbort = true\n        onUnexpectedAbort()\n      }\n      return true\n    }\n\n    // Not aborted.\n    return false\n  }\n\n  const onUnexpectedAbort = () => {\n    resultIsPartial = true\n\n    // FIXME(NAR-810): If we're already aborted due to Sync IO, there should be no need to\n    // finish the accumulators. However, it seems like in `--debug-prerender`\n    // the stream will stay open if we don't close the iterable here.\n    if (process.env.NODE_ENV === 'development') {\n      if (staleTimeIterable !== undefined) {\n        staleTimeIterable.close()\n      }\n      finishAccumulatingVaryParams(varyParamsAccumulator)\n    }\n  }\n\n  await runInSequentialTasks(\n    async () => {\n      finalStageController.advanceStage(RenderStage.ShellStatic)\n\n      let stream = workUnitAsyncStorage.run(\n        finalServerPrerenderStore,\n        ComponentMod.renderToReadableStream,\n        finalRSCPayload,\n        clientModules,\n        {\n          filterStackFrame,\n          onError,\n          signal: finalServerController.signal,\n          debugChannel,\n        }\n      )\n\n      // Note: this await will only resolve after the last task (unless sync IO aborts the render earlier)\n      // We await it here so that if the stream errors, it's not an unhandled rejection.\n      await iterateStreamingPrerenderChunks(\n        stream,\n        finalServerController.signal,\n        collectChunk,\n        streamState\n      )\n    },\n    () => {\n      if (checkUnexpectedAbort()) return\n      finalStageController.advanceStage(RenderStage.Static)\n    },\n    () => {\n      if (checkUnexpectedAbort()) return\n      finalStageController.advanceStage(RenderStage.ShellRuntime)\n    },\n    () => {\n      if (checkUnexpectedAbort()) return\n\n      if (mode.type === 'session-shell-only') {\n        // We're only rendering a shell, so we do not advance to stages where link data is resolved.\n        return\n      }\n      finalStageController.advanceStage(RenderStage.Runtime)\n    },\n    () => {\n      if (checkUnexpectedAbort()) return\n\n      // Finish the accumulators. We need to wait for Flight to flush the result into the stream,\n      // which is scheduled in a (fast) immediate, so we do this in a separate task\n      // (fast immediates will be drained at the end of the task, so in the next task we know we're done flushing)\n\n      // Check if session data unblocked new content in the shell.\n      const didSessionDataUnblockNewContent =\n        stageByteLengths[RenderStage.ShellRuntime] >\n        stageByteLengths[RenderStage.Static]\n      mode.shellUsedSessionDataDeferred.resolve(didSessionDataUnblockNewContent)\n\n      if (mode.type === 'rewindable-session-shell') {\n        // If advancing to the runtime stage didn't unblock new content,\n        // then the result does not depend on link data and can be used as a shell (indicated via `null`).\n        // Otherwise, send a byte length to indicate where the shell content ends.\n        const didLinkDataUnblockNewContent =\n          stageByteLengths[RenderStage.Runtime] >\n          stageByteLengths[RenderStage.ShellRuntime]\n        mode.shellByteLengthDeferred.resolve(\n          didLinkDataUnblockNewContent\n            ? stageByteLengths[RenderStage.ShellRuntime]\n            : null\n        )\n      }\n\n      staleTimeIterable.close()\n      finishAccumulatingVaryParams(varyParamsAccumulator)\n    },\n    () => {\n      if (checkUnexpectedAbort()) return\n\n      if (streamState.isPending) {\n        // If the prerender is still pending then it must depend on dynamic data\n        // (or, if this is a shell prefetch, link data)\n        resultIsPartial = true\n      }\n\n      workUnitAsyncStorage.run(\n        finalServerPrerenderStore,\n        finalServerController.abort.bind(finalServerController)\n      )\n    }\n  )\n\n  const result = {\n    prelude: new ReactServerPrerenderResult(\n      prependIsPartialByteToChunks(\n        collectedChunks.prerenderChunks,\n        resultIsPartial\n      )\n    ).consumeAsStream(),\n  }\n\n  return {\n    result,\n    // TODO(runtime-ppr): do we need to produce a digest map here?\n    // digestErrorsMap: ...,\n    dynamicAccess: serverDynamicTracking,\n    isPartial: resultIsPartial,\n    collectedRevalidate: finalServerPrerenderStore.revalidate,\n    collectedExpire: finalServerPrerenderStore.expire,\n    collectedStale: staleTimeIterable.currentValue,\n    collectedTags: finalServerPrerenderStore.tags,\n  }\n}\n\n/**\n * Crawlers will inadvertently think the canonicalUrl in the RSC payload should be crawled\n * when our intention is to just seed the router state with the current URL.\n * This function splits up the pathname so that we can later join it on\n * when we're ready to consume the path.\n */\nfunction prepareInitialCanonicalUrl(url: RequestStore['url']) {\n  return (url.pathname + url.search).split('/')\n}\n\nfunction getRenderedSearch(query: NextParsedUrlQuery): string {\n  // Inlined implementation of querystring.encode, which is not available in\n  // the Edge runtime.\n  const pairs = []\n  for (const key in query) {\n    const value = query[key]\n    if (value == null) continue\n    if (Array.isArray(value)) {\n      for (const v of value) {\n        pairs.push(\n          `${encodeURIComponent(key)}=${encodeURIComponent(String(v))}`\n        )\n      }\n    } else {\n      pairs.push(\n        `${encodeURIComponent(key)}=${encodeURIComponent(String(value))}`\n      )\n    }\n  }\n\n  // The result should match the format of a web URL's `search` property, since\n  // this is the format that's stored in the App Router state.\n  // TODO: We're a bit inconsistent about this. The x-nextjs-rewritten-query\n  // header omits the leading question mark. Should refactor to always do\n  // that instead.\n  if (pairs.length === 0) {\n    // If the search string is empty, return an empty string.\n    return ''\n  }\n  // Prepend '?' to the search params string.\n  return '?' + pairs.join('&')\n}\n\n// This is the data necessary to render <AppRouter /> when no SSR errors are encountered\nasync function getRSCPayload(\n  tree: LoaderTree,\n  ctx: AppRenderContext,\n  options: {\n    is404: boolean\n    staleTimeIterable?: AsyncIterable<number>\n    staticStageByteLengthPromise?: Promise<number>\n    shellByteLengthPromise?: Promise<number | null>\n    runtimePrefetchStream?: ReadableStream<Uint8Array>\n  }\n): Promise<InitialRSCPayload & { P: ReactNode }> {\n  const {\n    is404,\n    staleTimeIterable,\n    staticStageByteLengthPromise,\n    shellByteLengthPromise,\n    runtimePrefetchStream,\n  } = options\n  const injectedCSS = new Set<string>()\n  const injectedJS = new Set<string>()\n  const injectedFontPreloadTags = new Set<string>()\n  let missingSlots: Set<string> | undefined\n\n  // We only track missing parallel slots in development\n  if (process.env.__NEXT_DEV_SERVER) {\n    missingSlots = new Set<string>()\n  }\n\n  const {\n    getDynamicParamFromSegment,\n    query,\n    appUsingSizeAdjustment,\n    componentMod: { createMetadataComponents, createElement, Fragment },\n    url,\n    workStore,\n  } = ctx\n\n  const hints = ctx.renderOpts.prefetchHints?.[ctx.pagePath] ?? null\n  const prefetchInliningEnabled = Boolean(\n    ctx.renderOpts.experimental.prefetchInlining\n  )\n  const initialTree = await createFlightRouterStateFromLoaderTree(\n    tree,\n    hints,\n    prefetchInliningEnabled,\n    ctx.renderOpts.cacheComponents,\n    ctx.renderOpts.partialPrefetching,\n    workStore.isStaticGeneration,\n    ctx.renderOpts.isBuildTimePrerendering ?? false,\n    getDynamicParamFromSegment,\n    query\n  )\n  const serveStreamingMetadata = !!ctx.renderOpts.serveStreamingMetadata\n  const hasGlobalNotFound = !!tree[2]['global-not-found']\n\n  const { Viewport, Metadata, MetadataOutlet } = createMetadataComponents({\n    tree,\n    // When it's using global-not-found, metadata errorType is undefined, which will retrieve the\n    // metadata from the page.\n    // When it's using not-found, metadata errorType is 'not-found', which will retrieve the\n    // metadata from the not-found.js boundary.\n    // TODO: remove this condition and keep it undefined when global-not-found is stabilized.\n    errorType: is404 && !hasGlobalNotFound ? 'not-found' : undefined,\n    parsedQuery: query,\n    pathname: url.pathname,\n    metadataContext: createMetadataContext(ctx.renderOpts),\n    interpolatedParams: ctx.interpolatedParams,\n    serveStreamingMetadata,\n  })\n\n  const preloadCallbacks: PreloadCallbacks = []\n\n  const seedData = await createComponentTree({\n    ctx,\n    loaderTree: tree,\n    parentParams: {},\n    parentOptionalCatchAllParamName: null,\n    parentRuntimePrefetchable: false,\n    injectedCSS,\n    injectedJS,\n    injectedFontPreloadTags,\n    rootLayoutIncluded: false,\n    missingSlots,\n    preloadCallbacks,\n    authInterrupts: ctx.renderOpts.experimental.authInterrupts,\n    MetadataOutlet,\n  })\n\n  // When the `vary` response header is present with `Next-URL`, that means there's a chance\n  // it could respond differently if there's an interception route. We provide this information\n  // to `AppRouter` so that it can properly seed the prefetch cache with a prefix, if needed.\n  // In dev, the Vary header may not reliably reflect whether a route can\n  // be intercepted, because interception routes are compiled on demand.\n  // Default to true so the client doesn't cache a stale Fallback entry.\n  const varyHeader = ctx.res.getHeader('vary')\n  const couldBeIntercepted =\n    !!process.env.__NEXT_DEV_SERVER ||\n    (typeof varyHeader === 'string' && varyHeader.includes(NEXT_URL))\n\n  const initialHead = createElement(\n    Fragment,\n    {\n      key: flightDataPathHeadKey,\n    },\n    createElement(NonIndex, {\n      createElement,\n      pagePath: ctx.pagePath,\n      statusCode: ctx.res.statusCode,\n      isPossibleServerAction: ctx.isPossibleServerAction,\n    }),\n    createElement(Viewport, null),\n    createElement(Metadata, null),\n    appUsingSizeAdjustment\n      ? createElement('meta', {\n          name: 'next-size-adjust',\n          content: '',\n        })\n      : null\n  )\n\n  const { GlobalError, styles: globalErrorStyles } = await getGlobalErrorStyles(\n    tree,\n    ctx\n  )\n\n  // Assume the head we're rendering contains only partial data if PPR is\n  // enabled and this is a statically generated response. This is used by the\n  // client Segment Cache after a prefetch to determine if it can skip the\n  // second request to fill in the dynamic data.\n  //\n  // See similar comment in create-component-tree.tsx for more context.\n  const isPossiblyPartialHead =\n    workStore.isStaticGeneration &&\n    ctx.renderOpts.experimental.isRoutePPREnabled === true\n\n  return maybeAppendBuildIdToRSCPayload(ctx, {\n    // See the comment above the `Preloads` component (below) for why this is part of the payload\n    P: createElement(Preloads, {\n      preloadCallbacks: preloadCallbacks,\n    }),\n    c: prepareInitialCanonicalUrl(url),\n    q: getRenderedSearch(query),\n    i: !!couldBeIntercepted,\n    f: [\n      [\n        initialTree,\n        seedData,\n        initialHead,\n        isPossiblyPartialHead,\n      ] as FlightDataPath,\n    ],\n    m: missingSlots,\n    G: [GlobalError, globalErrorStyles],\n    // Tells the client whether this route supports per-segment prefetching.\n    // With Cache Components, all routes support it. Without it, only fully\n    // static pages do, because their per-segment prefetch responses are\n    // generated during static generation (build or ISR).\n    S: workStore.isStaticGeneration || ctx.renderOpts.cacheComponents,\n    h: getMetadataVaryParamsAccumulator(),\n    r: getRootParamsVaryParamsAccumulator() ?? undefined,\n    s: staleTimeIterable,\n    a: shellByteLengthPromise,\n    l: staticStageByteLengthPromise,\n    p: runtimePrefetchStream,\n    // Include the per-page dynamic stale time from unstable_dynamicStaleTime, but\n    // only for dynamic renders. The client treats its presence as\n    // authoritative.\n    // TODO: Move this to the prefetch hints file so we don't have to walk\n    // the tree on every render.\n    d: !workStore.isStaticGeneration\n      ? ((await getDynamicStaleTime(tree)) ?? undefined)\n      : undefined,\n  } satisfies InitialRSCPayload & { P: ReactNode })\n}\n\n/**\n * Preload calls (such as `ReactDOM.preloadStyle` and `ReactDOM.preloadFont`) need to be called during rendering\n * in order to create the appropriate preload tags in the DOM, otherwise they're a no-op. Since we invoke\n * renderToReadableStream with a function that returns component props rather than a component itself, we use\n * this component to \"render  \" the preload calls.\n */\nfunction Preloads({ preloadCallbacks }: { preloadCallbacks: Function[] }) {\n  preloadCallbacks.forEach((preloadFn) => preloadFn())\n  return null\n}\n\n// This is the data necessary to render <AppRouter /> when an error state is triggered\nasync function getErrorRSCPayload(\n  tree: LoaderTree,\n  ctx: AppRenderContext,\n  ssrError: unknown,\n  errorType: MetadataErrorType | 'redirect' | undefined,\n  shouldRenderMetadataAndViewport: boolean\n) {\n  const {\n    getDynamicParamFromSegment,\n    query,\n    componentMod: { createMetadataComponents, createElement, Fragment },\n    url,\n    workStore,\n  } = ctx\n\n  let Viewport: ComponentType | null = null\n  let Metadata: ComponentType | null = null\n  if (shouldRenderMetadataAndViewport) {\n    const serveStreamingMetadata = !!ctx.renderOpts.serveStreamingMetadata\n    const metadataComponents = createMetadataComponents({\n      tree,\n      parsedQuery: query,\n      pathname: url.pathname,\n      metadataContext: createMetadataContext(ctx.renderOpts),\n      errorType,\n      interpolatedParams: ctx.interpolatedParams,\n      serveStreamingMetadata: serveStreamingMetadata,\n    })\n    Viewport = metadataComponents.Viewport\n    Metadata = metadataComponents.Metadata\n  }\n\n  const initialHead = createElement(\n    Fragment,\n    {\n      key: flightDataPathHeadKey,\n    },\n    createElement(NonIndex, {\n      createElement,\n      pagePath: ctx.pagePath,\n      statusCode: ctx.res.statusCode,\n      isPossibleServerAction: ctx.isPossibleServerAction,\n    }),\n    Viewport ? createElement(Viewport, null) : null,\n    process.env.__NEXT_DEV_SERVER &&\n      createElement('meta', {\n        name: 'next-error',\n        content: 'not-found',\n      }),\n    Metadata ? createElement(Metadata, null) : null\n  )\n\n  const errorHints = ctx.renderOpts.prefetchHints?.[ctx.pagePath] ?? null\n  const errorPrefetchInliningEnabled = Boolean(\n    ctx.renderOpts.experimental.prefetchInlining\n  )\n  const initialTree = await createFlightRouterStateFromLoaderTree(\n    tree,\n    errorHints,\n    errorPrefetchInliningEnabled,\n    ctx.renderOpts.cacheComponents,\n    ctx.renderOpts.partialPrefetching,\n    workStore.isStaticGeneration,\n    ctx.renderOpts.isBuildTimePrerendering ?? false,\n    getDynamicParamFromSegment,\n    query\n  )\n\n  let err: Error | undefined = undefined\n  if (ssrError) {\n    err = isError(ssrError) ? ssrError : new Error(ssrError + '')\n  }\n\n  // For metadata notFound error there's no global not found boundary on top\n  // so we create a not found page with AppRouter\n  const seedData: CacheNodeSeedData = [\n    createElement(\n      'html',\n      {\n        id: '__next_error__',\n      },\n      createElement('head', null),\n      createElement(\n        'body',\n        null,\n        process.env.__NEXT_DEV_SERVER && err\n          ? createElement('template', {\n              'data-next-error-message': err.message,\n              'data-next-error-digest': 'digest' in err ? err.digest : '',\n              'data-next-error-stack': err.stack,\n            })\n          : null\n      )\n    ),\n    {},\n    null,\n    false,\n    null, // varyParams - not tracked for error pages\n  ]\n\n  const { GlobalError, styles: globalErrorStyles } = await getGlobalErrorStyles(\n    tree,\n    ctx\n  )\n\n  const isPossiblyPartialHead =\n    workStore.isStaticGeneration &&\n    ctx.renderOpts.experimental.isRoutePPREnabled === true\n\n  return maybeAppendBuildIdToRSCPayload(ctx, {\n    c: prepareInitialCanonicalUrl(url),\n    q: getRenderedSearch(query),\n    m: undefined,\n    i: false,\n    f: [\n      [\n        initialTree,\n        seedData,\n        initialHead,\n        isPossiblyPartialHead,\n      ] as FlightDataPath,\n    ],\n    G: [GlobalError, globalErrorStyles],\n    // Tells the client whether this route supports per-segment prefetching.\n    // With Cache Components, all routes support it. Without it, only fully\n    // static pages do, because their per-segment prefetch responses are\n    // generated during static generation (build or ISR).\n    S: workStore.isStaticGeneration || ctx.renderOpts.cacheComponents,\n    h: getMetadataVaryParamsAccumulator(),\n    r: getRootParamsVaryParamsAccumulator() ?? undefined,\n  } satisfies InitialRSCPayload)\n}\n\n// This component must run in an SSR context. It will render the RSC root component\nfunction App<T>({\n  reactServerStream,\n  reactDebugStream,\n  debugEndTime,\n  preinitScripts,\n  ServerInsertedHTMLProvider,\n  nonce,\n  images,\n}: {\n  /* eslint-disable @next/internal/no-ambiguous-jsx -- React Client */\n  reactServerStream: Readable | BinaryStreamOf<T>\n  reactDebugStream: AnyStream | undefined\n  debugEndTime: number | undefined\n  preinitScripts: () => void\n  ServerInsertedHTMLProvider: ComponentType<{\n    children: JSX.Element\n  }>\n  images: RenderOpts['images']\n  nonce?: string\n}): JSX.Element {\n  preinitScripts()\n  const response = ReactClient.use(\n    getFlightStream<InitialRSCPayload>(\n      reactServerStream,\n      reactDebugStream,\n      debugEndTime,\n      nonce\n    )\n  )\n\n  const initialState = createInitialRouterState({\n    // This is not used during hydration, so we don't have to pass a\n    // real timestamp.\n    navigatedAt: -1,\n    initialRSCPayload: response,\n    // location is not initialized in the SSR render\n    // it's set to window.location during hydration\n    location: null,\n  })\n\n  const actionQueue = createMutableActionQueue(initialState)\n\n  const { HeadManagerContext } =\n    require('../../shared/lib/head-manager-context.shared-runtime') as typeof import('../../shared/lib/head-manager-context.shared-runtime')\n\n  return (\n    <HeadManagerContext.Provider\n      value={{\n        appDir: true,\n        nonce,\n      }}\n    >\n      <ImageConfigContext.Provider value={images ?? imageConfigDefault}>\n        <ServerInsertedHTMLProvider>\n          <AppRouter actionQueue={actionQueue} globalErrorState={response.G} />\n        </ServerInsertedHTMLProvider>\n      </ImageConfigContext.Provider>\n    </HeadManagerContext.Provider>\n  )\n  /* eslint-enable @next/internal/no-ambiguous-jsx -- React Client */\n}\n\n// @TODO our error stream should be probably just use the same root component. But it was previously\n// different I don't want to figure out if that is meaningful at this time so just keeping the behavior\n// consistent for now.\nfunction ErrorApp<T>({\n  reactServerStream,\n  preinitScripts,\n  ServerInsertedHTMLProvider,\n  nonce,\n  images,\n}: {\n  reactServerStream: BinaryStreamOf<T>\n  preinitScripts: () => void\n  ServerInsertedHTMLProvider: ComponentType<{\n    children: JSX.Element\n  }>\n  nonce?: string\n  images: RenderOpts['images']\n}): JSX.Element {\n  /* eslint-disable @next/internal/no-ambiguous-jsx -- React Client */\n  preinitScripts()\n  const response = ReactClient.use(\n    getFlightStream<InitialRSCPayload>(\n      reactServerStream,\n      undefined,\n      undefined,\n      nonce\n    )\n  )\n\n  const initialState = createInitialRouterState({\n    // This is not used during hydration, so we don't have to pass a\n    // real timestamp.\n    navigatedAt: -1,\n    initialRSCPayload: response,\n    // location is not initialized in the SSR render\n    // it's set to window.location during hydration\n    location: null,\n  })\n\n  const actionQueue = createMutableActionQueue(initialState)\n\n  return (\n    <ImageConfigContext.Provider value={images ?? imageConfigDefault}>\n      <ServerInsertedHTMLProvider>\n        <AppRouter actionQueue={actionQueue} globalErrorState={response.G} />\n      </ServerInsertedHTMLProvider>\n    </ImageConfigContext.Provider>\n  )\n  /* eslint-enable @next/internal/no-ambiguous-jsx -- React Client */\n}\n\n// We use a trick with TS Generics to branch streams with a type so we can\n// consume the parsed value of a Readable Stream if it was constructed with a\n// certain object shape. The generic type is not used directly in the type so it\n// requires a disabling of the eslint rule disallowing unused vars\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nexport type BinaryStreamOf<T> = AnyStream\n\n/**\n * Extracted to a separate function to prevent V8 from retaining the entire\n * `renderToHTMLOrFlightImpl` closure scope through globalThis.__next_require__.\n * V8 shares a single Context object per scope for all closures; by creating\n * these closures in their own function scope, the globalThis references only\n * retain `instrumented` and `cacheComponents`, not request-specific data like\n * req/res/workStore.\n */\nfunction installGlobalModuleLoadingHandlers(\n  ComponentMod: AppPageModule,\n  cacheComponents: boolean,\n  isTracingEnabled: boolean\n) {\n  const instrumented = wrapClientComponentLoader(ComponentMod, isTracingEnabled)\n\n  // When we are prerendering if there is a cacheSignal for tracking\n  // cache reads we track calls to `loadChunk` and `require`. This allows us\n  // to treat chunk/module loading with similar semantics as cache reads to avoid\n  // module loading from causing a prerender to abort too early.\n  const shouldTrackModuleLoading = () => {\n    if (!cacheComponents) {\n      return false\n    }\n    if (process.env.__NEXT_DEV_SERVER) {\n      return true\n    }\n    const workUnitStore = workUnitAsyncStorage.getStore()\n\n    if (!workUnitStore) {\n      return false\n    }\n\n    switch (workUnitStore.type) {\n      case 'prerender':\n      case 'prerender-client':\n      case 'validation-client':\n      case 'prerender-runtime':\n      case 'cache':\n      case 'private-cache':\n        return true\n      case 'prerender-ppr':\n      case 'prerender-legacy':\n      case 'request':\n      case 'unstable-cache':\n      case 'generate-static-params':\n        return false\n      default:\n        workUnitStore satisfies never\n    }\n  }\n\n  // @ts-expect-error\n  globalThis.__next_require__ = (\n    ...args: Parameters<typeof instrumented.require>\n  ) => {\n    const exportsOrPromise = instrumented.require(...args)\n    if (shouldTrackModuleLoading()) {\n      trackPendingImport(exportsOrPromise)\n    }\n    return exportsOrPromise\n  }\n\n  // @ts-expect-error\n  globalThis.__next_chunk_load__ = (\n    ...args: Parameters<typeof instrumented.loadChunk>\n  ) => {\n    const loadingChunk = instrumented.loadChunk(...args)\n    if (shouldTrackModuleLoading()) {\n      trackPendingChunkLoad(loadingChunk)\n    }\n    return loadingChunk\n  }\n}\n\nasync function renderToHTMLOrFlightImpl(\n  req: BaseNextRequest,\n  res: BaseNextResponse,\n  url: ReturnType<typeof parseRelativeUrl>,\n  pagePath: string,\n  query: NextParsedUrlQuery,\n  renderOpts: RenderOpts,\n  workStore: WorkStore,\n  parsedRequestHeaders: ParsedRequestHeaders,\n  postponedState: PostponedState | null,\n  serverComponentsHmrCache: ServerComponentsHmrCache | undefined,\n  sharedContext: AppSharedContext,\n  interpolatedParams: Params,\n  fallbackRouteParams: OpaqueFallbackRouteParams | null\n) {\n  const isNotFoundPath = pagePath === '/404'\n  if (isNotFoundPath) {\n    res.statusCode = 404\n  }\n\n  // A unique request timestamp used by development to ensure that it's\n  // consistent and won't change during this request. This is important to\n  // avoid that resources can be deduped by React Float if the same resource is\n  // rendered or preloaded multiple times: `<link href=\"a.css?v={Date.now()}\"/>`.\n  const requestTimestamp = Date.now()\n\n  const {\n    ComponentMod,\n    nextFontManifest,\n    serverActions,\n    assetPrefix = '',\n    enableTainting,\n    cacheComponents,\n    setIsrStatus,\n  } = renderOpts\n\n  const { cachedNavigations } = renderOpts.experimental\n\n  // We need to expose the bundled `require` API globally for\n  // react-server-dom-webpack. This is a hack until we find a better way.\n  if (ComponentMod.__next_app__) {\n    const isTracingEnabled =\n      getTracer().getActiveScopeSpan()?.isRecording() ?? false\n    installGlobalModuleLoadingHandlers(\n      ComponentMod,\n      cacheComponents,\n      isTracingEnabled\n    )\n  }\n\n  if (process.env.__NEXT_DEV_SERVER && setIsrStatus && !cacheComponents) {\n    // Reset the ISR status at start of request.\n    const { pathname } = new URL(req.url || '/', 'http://n')\n    setIsrStatus(\n      pathname,\n      // Only pages using the Node runtime can use ISR, Edge is always dynamic.\n      process.env.NEXT_RUNTIME === 'edge' ? false : undefined\n    )\n  }\n\n  if (\n    // The type check here ensures that `req` is correctly typed, and the\n    // environment variable check provides dead code elimination.\n    process.env.NEXT_RUNTIME !== 'edge' &&\n    isNodeNextRequest(req)\n  ) {\n    res.onClose(() => {\n      // We stop tracking fetch metrics when the response closes, since we\n      // report them at that time.\n      workStore.shouldTrackFetchMetrics = false\n    })\n\n    req.originalRequest.on('end', () => {\n      if ('performance' in globalThis) {\n        const metrics = getClientComponentLoaderMetrics({ reset: true })\n        if (metrics) {\n          getTracer()\n            .startSpan(NextNodeServerSpan.clientComponentLoading, {\n              startTime: metrics.clientComponentLoadStart,\n              attributes: {\n                'next.clientComponentLoadCount':\n                  metrics.clientComponentLoadCount,\n                'next.span_type': NextNodeServerSpan.clientComponentLoading,\n              },\n            })\n            .end(\n              metrics.clientComponentLoadStart +\n                metrics.clientComponentLoadTimes\n            )\n        }\n      }\n    })\n  }\n\n  const metadata: AppPageRenderResultMetadata = {\n    statusCode: isNotFoundPath ? 404 : undefined,\n    hasPendingUi: false,\n  }\n\n  const appUsingSizeAdjustment = !!nextFontManifest?.appUsingSizeAdjust\n\n  ComponentMod.patchFetch()\n\n  // Pull out the hooks/references from the component.\n  const {\n    routeModule: {\n      userland: { loaderTree },\n    },\n    taintObjectReference,\n  } = ComponentMod\n  if (enableTainting) {\n    taintObjectReference(\n      'Do not pass process.env to Client Components since it will leak sensitive data',\n      process.env\n    )\n  }\n\n  workStore.fetchMetrics = []\n  metadata.fetchMetrics = workStore.fetchMetrics\n\n  // don't modify original query object\n  query = { ...query }\n  stripInternalQueries(query)\n\n  const { isStaticGeneration } = workStore\n\n  let requestId: string\n  let htmlRequestId: string\n  const requestInsightsIdentity = process.env.__NEXT_REQUEST_INSIGHTS\n    ? getRequestInsightsIdentity()\n    : undefined\n\n  const {\n    flightRouterState,\n    isPrefetchRequest,\n    isRuntimePrefetchRequest,\n    isAppShellPrefetchRequest,\n    isRSCRequest,\n    isHmrRefresh,\n    nonce,\n  } = parsedRequestHeaders\n\n  if (parsedRequestHeaders.requestId) {\n    // If the client has provided a request ID (in development mode), we use it.\n    requestId = parsedRequestHeaders.requestId\n  } else if (requestInsightsIdentity) {\n    // Request Insights starts recording before the work store exists. Reuse\n    // the identity from that outer request scope so all spans stay together.\n    requestId = requestInsightsIdentity.requestId\n  } else {\n    // Otherwise we generate a new request ID.\n    if (isStaticGeneration) {\n      requestId = Buffer.from(\n        await crypto.subtle.digest('SHA-1', Buffer.from(req.url))\n      ).toString('hex')\n    } else if (process.env.NEXT_RUNTIME === 'edge') {\n      requestId = crypto.randomUUID()\n    } else {\n      requestId = (\n        require('next/dist/compiled/nanoid') as typeof import('next/dist/compiled/nanoid')\n      ).nanoid()\n    }\n  }\n\n  // If the client has provided an HTML request ID, we use it to associate the\n  // request with the HTML document from which it originated, which is used to\n  // send debug information to the associated WebSocket client. Otherwise, this\n  // is the request for the HTML document, so we use the request ID also as the\n  // HTML request ID.\n  htmlRequestId =\n    parsedRequestHeaders.htmlRequestId ||\n    requestInsightsIdentity?.htmlRequestId ||\n    requestId\n  workStore.requestId = requestId\n  workStore.htmlRequestId = htmlRequestId\n\n  const getDynamicParamFromSegment = makeGetDynamicParamFromSegment(\n    interpolatedParams,\n    fallbackRouteParams,\n    renderOpts.experimental.optimisticRouting\n  )\n\n  const isPossibleActionRequest = getIsPossibleServerAction(req)\n\n  // For implicit tags, we use the resolved pathname which has dynamic params\n  // interpolated, is decoded, and has trailing slash removed.\n  const resolvedPathname = getRequestMeta(req, 'resolvedPathname')\n  if (!resolvedPathname) {\n    throw new InvariantError('resolvedPathname must be set in request metadata')\n  }\n\n  const implicitTags = await getImplicitTags(\n    workStore.page,\n    resolvedPathname,\n    fallbackRouteParams\n  )\n\n  const ctx: AppRenderContext = {\n    componentMod: ComponentMod,\n    url,\n    renderOpts,\n    workStore,\n    parsedRequestHeaders,\n    getDynamicParamFromSegment,\n    interpolatedParams,\n    fallbackRouteParams,\n    query,\n    isPrefetch: isPrefetchRequest,\n    isPossibleServerAction: isPossibleActionRequest,\n    requestTimestamp,\n    appUsingSizeAdjustment,\n    flightRouterState,\n    requestId,\n    htmlRequestId,\n    pagePath,\n    assetPrefix,\n    isNotFoundPath,\n    nonce,\n    res,\n    sharedContext,\n    implicitTags,\n  }\n\n  getTracer().setRootSpanAttribute('next.route', pagePath)\n\n  if (isStaticGeneration) {\n    // We're either building or revalidating. In either case we need to\n    // prerender our page rather than render it.\n    const prerenderToStreamWithTracing = getTracer().wrap(\n      AppRenderSpan.getBodyResult,\n      {\n        spanName: `prerender route (app) ${pagePath}`,\n        attributes: {\n          'next.route': pagePath,\n        },\n      },\n      prerenderToStream\n    )\n\n    const response = await prerenderToStreamWithTracing(\n      req,\n      res,\n      ctx,\n      metadata,\n      loaderTree,\n      fallbackRouteParams\n    )\n\n    // If we're debugging partial prerendering, print all the dynamic API accesses\n    // that occurred during the render.\n    // @TODO move into renderToStream function\n    if (\n      response.dynamicAccess &&\n      accessedDynamicData(response.dynamicAccess) &&\n      renderOpts.isDebugDynamicAccesses\n    ) {\n      warn('The following dynamic usage was detected:')\n      for (const access of formatDynamicAPIAccesses(response.dynamicAccess)) {\n        warn(access)\n      }\n    }\n\n    // If we encountered any unexpected errors during build we fail the\n    // prerendering phase and the build.\n    if (workStore.invalidDynamicUsageError) {\n      logDisallowedDynamicError(workStore, workStore.invalidDynamicUsageError)\n      throw new StaticGenBailoutError()\n    }\n    if (response.digestErrorsMap.size) {\n      const buildFailingError = response.digestErrorsMap.values().next().value\n      if (buildFailingError) throw buildFailingError\n    }\n    // Pick first userland SSR error, which is also not a RSC error.\n    if (response.ssrErrors.length) {\n      const buildFailingError = response.ssrErrors.find((err) =>\n        isUserLandError(err)\n      )\n      if (buildFailingError) throw buildFailingError\n    }\n\n    const options: RenderResultOptions = {\n      metadata,\n      contentType: HTML_CONTENT_TYPE_HEADER,\n    }\n\n    // If we have pending revalidates, wait until they are all resolved.\n    const maybeRevalidatesPromise = executeRevalidates(workStore)\n    if (maybeRevalidatesPromise !== false) {\n      const revalidatesPromise = maybeRevalidatesPromise.finally(() => {\n        if (process.env.NEXT_PRIVATE_DEBUG_CACHE) {\n          console.log('pending revalidates promise finished for:', url.href)\n        }\n      })\n      if (renderOpts.waitUntil) {\n        renderOpts.waitUntil(revalidatesPromise)\n      } else {\n        options.waitUntil = revalidatesPromise\n      }\n    }\n\n    applyMetadataFromPrerenderResult(response, metadata, workStore)\n\n    if (response.renderResumeDataCache) {\n      metadata.renderResumeDataCache = response.renderResumeDataCache\n    }\n\n    const streamString = await streamToString(response.stream)\n    const result = new RenderResult(streamString, options)\n\n    // Run build-time instant validation if the page has instant configs\n    // TODO(instant-validation-build): This is not a great place to wire this in.\n    if (\n      workStore.cacheComponentsEnabled &&\n      workStore.isBuildTimePrerendering &&\n      renderOpts.runInstantValidation &&\n      (await anySegmentNeedsInstantValidationInBuild(loaderTree))\n    ) {\n      // Throws StaticGenBailoutError if validation failed.\n      await validateInstantConfigsInBuild(\n        ctx,\n        response.renderResumeDataCache ?? null\n      )\n    }\n\n    return result\n  } else {\n    // We're rendering dynamically\n    const renderResumeDataCache =\n      renderOpts.renderResumeDataCache ??\n      postponedState?.renderResumeDataCache ??\n      null\n\n    const rootParams = getRootParams(loaderTree, ctx.getDynamicParamFromSegment)\n    const fallbackParams = getRequestMeta(req, 'fallbackParams') || null\n    const hmrRefreshHash = getRequestMeta(req, 'hmrRefreshHash')\n\n    const createRequestStore = createRequestStoreForRender.bind(\n      null,\n      req,\n      res,\n      url,\n      rootParams,\n      implicitTags,\n      renderOpts.onUpdateCookies,\n      renderOpts.previewProps,\n      isHmrRefresh,\n      serverComponentsHmrCache,\n      renderResumeDataCache,\n      fallbackParams,\n      hmrRefreshHash\n    )\n    const requestStore = createRequestStore()\n\n    if (\n      process.env.__NEXT_DEV_SERVER &&\n      setIsrStatus &&\n      !cacheComponents &&\n      // Only pages using the Node runtime can use ISR, so we only need to\n      // update the status for those.\n      // The type check here ensures that `req` is correctly typed, and the\n      // environment variable check provides dead code elimination.\n      process.env.NEXT_RUNTIME !== 'edge' &&\n      isNodeNextRequest(req)\n    ) {\n      req.originalRequest.on('end', () => {\n        const { pathname } = new URL(req.url || '/', 'http://n')\n        const isStatic = !requestStore.usedDynamic && !workStore.forceDynamic\n        setIsrStatus(pathname, isStatic)\n      })\n    }\n\n    // MARK: RSC request\n    if (isRSCRequest) {\n      if (isRuntimePrefetchRequest) {\n        // MARK: RSC runtimePrefetch\n        return generateRuntimePrefetchResult(\n          req,\n          ctx,\n          requestStore,\n          isAppShellPrefetchRequest\n        )\n      } else {\n        if (\n          process.env.__NEXT_DEV_SERVER &&\n          process.env.NEXT_RUNTIME !== 'edge' &&\n          cacheComponents\n        ) {\n          // MARK: RSC devCacheComponents\n          return generateDynamicFlightRenderResultWithStagesInDev(\n            req,\n            ctx,\n            requestStore,\n            createRequestStore,\n            fallbackParams\n          )\n        } else if (cacheComponents && cachedNavigations) {\n          // MARK: RSC cacheComponents\n          return generateStagedDynamicFlightRenderResultNode(\n            req,\n            ctx,\n            requestStore\n          )\n        } else {\n          // MARK: RSC dynamic\n          return generateDynamicFlightRenderResult(req, ctx, requestStore)\n        }\n      }\n    }\n\n    let didExecuteServerAction = false\n    let formState: null | any = null\n    if (isPossibleActionRequest) {\n      // For action requests, we handle them differently with a special render result.\n      const actionRequestResult = await handleAction({\n        req,\n        res,\n        ComponentMod,\n        generateFlight: generateDynamicFlightRenderResult,\n        workStore,\n        requestStore,\n        serverActions,\n        ctx,\n        metadata,\n      })\n\n      if (actionRequestResult) {\n        if (actionRequestResult.type === 'not-found') {\n          const notFoundLoaderTree = createNotFoundLoaderTree(loaderTree)\n          res.statusCode = 404\n          metadata.statusCode = 404\n          const stream = await renderToStream(\n            requestStore,\n            req,\n            res,\n            ctx,\n            notFoundLoaderTree,\n            formState,\n            postponedState,\n            metadata,\n            undefined, // Prevent restartable-render behavior in dev + Cache Components mode\n            fallbackParams\n          )\n\n          return new RenderResult(stream, {\n            metadata,\n            contentType: HTML_CONTENT_TYPE_HEADER,\n          })\n        } else if (actionRequestResult.type === 'done') {\n          if (actionRequestResult.result) {\n            actionRequestResult.result.assignMetadata(metadata)\n            return actionRequestResult.result\n          } else if (actionRequestResult.formState) {\n            formState = actionRequestResult.formState\n          }\n        }\n      }\n\n      didExecuteServerAction = true\n    }\n\n    const options: RenderResultOptions = {\n      metadata,\n      contentType: HTML_CONTENT_TYPE_HEADER,\n    }\n\n    const stream = await renderToStream(\n      // NOTE: in Cache Components (dev), if the render is restarted, it will use a different requestStore\n      // than the one that we're passing in here.\n      requestStore,\n      req,\n      res,\n      ctx,\n      loaderTree,\n      formState,\n      postponedState,\n      metadata,\n      // If we're rendering HTML after an action, we don't want restartable-render behavior\n      // because the result should be dynamic, like it is in prod.\n      // Also, the request store might have been mutated by the action (e.g. enabling draftMode)\n      // and we currently we don't copy changes over when creating a new store,\n      // so the restarted render wouldn't be correct.\n      didExecuteServerAction ? undefined : createRequestStore,\n      fallbackParams\n    )\n\n    // Forward an invalid-dynamic-usage error recorded by `'use cache'` only\n    // when userland caught it (try/catch around the cache call). If userland\n    // didn't catch, the rejection propagated into the React render, and React's\n    // `serverComponentsErrorHandler` already stamped a digest on the error and\n    // emitted it as a Flight error chunk — surfacing it again here would\n    // duplicate the entry in the dev overlay.\n    //\n    // The cacheComponents paths forward this themselves via\n    // `runValidationInDev` and the validation-skipped fallback in\n    // `generateDynamicFlightRenderResultWithStagesInDev`. Here we cover the\n    // non-cacheComponents dev path where neither runs.\n    if (\n      process.env.__NEXT_DEV_SERVER &&\n      !cacheComponents &&\n      workStore.invalidDynamicUsageError &&\n      !(workStore.invalidDynamicUsageError as { digest?: unknown }).digest\n    ) {\n      void logMessagesAndSendErrorsToBrowser(\n        [workStore.invalidDynamicUsageError],\n        ctx\n      )\n    }\n\n    // If we have pending revalidates, wait until they are all resolved.\n    const maybeRevalidatesPromise = executeRevalidates(workStore)\n    if (maybeRevalidatesPromise !== false) {\n      const revalidatesPromise = maybeRevalidatesPromise.finally(() => {\n        if (process.env.NEXT_PRIVATE_DEBUG_CACHE) {\n          console.log('pending revalidates promise finished for:', url.href)\n        }\n      })\n      if (renderOpts.waitUntil) {\n        renderOpts.waitUntil(revalidatesPromise)\n      } else {\n        options.waitUntil = revalidatesPromise\n      }\n    }\n\n    // Create the new render result for the response.\n    return new RenderResult(stream, options)\n  }\n}\n\nexport type AppPageRender = (\n  req: BaseNextRequest,\n  res: BaseNextResponse,\n  pagePath: string,\n  query: NextParsedUrlQuery,\n  fallbackRouteParams: OpaqueFallbackRouteParams | null,\n  renderOpts: RenderOpts,\n  serverComponentsHmrCache: ServerComponentsHmrCache | undefined,\n  sharedContext: AppSharedContext\n) => Promise<RenderResult<AppPageRenderResultMetadata>>\n\nexport const renderToHTMLOrFlight: AppPageRender = (\n  req,\n  res,\n  pagePath,\n  query,\n  fallbackRouteParams,\n  renderOpts,\n  serverComponentsHmrCache,\n  sharedContext\n) => {\n  if (!req.url) {\n    throw new Error('Invalid URL')\n  }\n\n  const url = parseRelativeUrl(req.url, undefined, false)\n\n  // We read these values from the request object as, in certain cases,\n  // base-server will strip them to opt into different rendering behavior.\n  const parsedRequestHeaders = parseRequestHeaders(req.headers, {\n    isRoutePPREnabled: renderOpts.experimental.isRoutePPREnabled === true,\n    previewModeId: renderOpts.previewProps?.previewModeId,\n  })\n\n  const { isPrefetchRequest, previouslyRevalidatedTags, nonce } =\n    parsedRequestHeaders\n\n  let interpolatedParams: Params\n  let postponedState: PostponedState | null = null\n\n  // If provided, the postpone state should be parsed so it can be provided to\n  // React.\n  if (typeof renderOpts.postponed === 'string') {\n    if (fallbackRouteParams) {\n      throw new InvariantError(\n        'postponed state should not be provided when fallback params are provided'\n      )\n    }\n\n    interpolatedParams = interpolateParallelRouteParams(\n      renderOpts.ComponentMod.routeModule.userland.loaderTree,\n      renderOpts.params ?? {},\n      pagePath,\n      fallbackRouteParams\n    )\n\n    postponedState = parsePostponedState(\n      renderOpts.postponed,\n      interpolatedParams,\n      renderOpts.experimental.maxPostponedStateSizeBytes\n    )\n  } else {\n    interpolatedParams = interpolateParallelRouteParams(\n      renderOpts.ComponentMod.routeModule.userland.loaderTree,\n      renderOpts.params ?? {},\n      pagePath,\n      fallbackRouteParams\n    )\n  }\n\n  if (\n    postponedState?.renderResumeDataCache &&\n    renderOpts.renderResumeDataCache\n  ) {\n    throw new InvariantError(\n      'postponed state and dev warmup immutable resume data cache should not be provided together'\n    )\n  }\n\n  const workStore = createWorkStore({\n    page: renderOpts.routeModule.definition.page,\n    renderOpts,\n    // @TODO move to workUnitStore of type Request\n    isPrefetchRequest,\n    buildId: sharedContext.buildId,\n    deploymentId: sharedContext.deploymentId,\n    previouslyRevalidatedTags,\n    nonce,\n  })\n\n  return workAsyncStorage.run(\n    workStore,\n    // The function to run\n    renderToHTMLOrFlightImpl,\n    // all of it's args\n    req,\n    res,\n    url,\n    pagePath,\n    query,\n    renderOpts,\n    workStore,\n    parsedRequestHeaders,\n    postponedState,\n    serverComponentsHmrCache,\n    sharedContext,\n    interpolatedParams,\n    fallbackRouteParams\n  )\n}\n\nfunction applyMetadataFromPrerenderResult(\n  response: Pick<\n    PrerenderToStreamResult,\n    | 'collectedExpire'\n    | 'collectedRevalidate'\n    | 'collectedStale'\n    | 'collectedTags'\n  >,\n  metadata: AppPageRenderResultMetadata,\n  workStore: WorkStore\n) {\n  if (response.collectedTags) {\n    metadata.fetchTags = response.collectedTags.join(',')\n  }\n\n  // Let the client router know how long to keep the cached entry around.\n  const staleHeader = String(response.collectedStale)\n  metadata.headers ??= {}\n  metadata.headers[NEXT_ROUTER_STALE_TIME_HEADER] = staleHeader\n\n  // If force static is specifically set to false, we should not revalidate\n  // the page.\n  if (workStore.forceStatic === false || response.collectedRevalidate === 0) {\n    metadata.cacheControl = { revalidate: 0, expire: undefined }\n  } else {\n    // Copy the cache control value onto the render result metadata.\n    metadata.cacheControl = {\n      revalidate:\n        response.collectedRevalidate >= INFINITE_CACHE\n          ? false\n          : response.collectedRevalidate,\n      expire:\n        response.collectedExpire >= INFINITE_CACHE\n          ? undefined\n          : response.collectedExpire,\n    }\n  }\n\n  // provide bailout info for debugging\n  if (metadata.cacheControl.revalidate === 0) {\n    metadata.staticBailoutInfo = {\n      description: workStore.dynamicUsageDescription,\n      stack: workStore.dynamicUsageStack,\n    }\n  }\n}\n\ntype RSCPayloadDevProperties = {\n  /** Only available during cacheComponents development builds. Used for logging errors. */\n  _validation?: Promise<ReactNode>\n  _bypassCachesInDev?: ReactNode\n}\n\ntype RSCInitialPayloadPartialDev = {\n  c?: InitialRSCPayload['c']\n}\n\nasync function renderToStream(\n  requestStore: RequestStore,\n  req: BaseNextRequest,\n  res: BaseNextResponse,\n  ctx: AppRenderContext,\n  tree: LoaderTree,\n  formState: any,\n  postponedState: PostponedState | null,\n  metadata: AppPageRenderResultMetadata,\n  createRequestStore: (() => RequestStore) | undefined,\n  fallbackParams: OpaqueFallbackRouteParams | null\n): Promise<AnyStream> {\n  /* eslint-disable @next/internal/no-ambiguous-jsx -- React Client */\n  // MARK: renderToStream setup\n  const {\n    assetPrefix,\n    htmlRequestId,\n    nonce,\n    pagePath,\n    renderOpts,\n    requestId,\n    workStore,\n  } = ctx\n\n  const {\n    basePath,\n    buildManifest,\n    ComponentMod: { createElement },\n    crossOrigin,\n    experimental,\n    isBuildTimePrerendering = false,\n    onInstrumentationRequestError,\n    page,\n    reactMaxHeadersLength,\n    setReactDebugChannel,\n    subresourceIntegrityManifest,\n    supportsDynamicResponse,\n    cacheComponents,\n  } = renderOpts\n\n  const { cachedNavigations } = renderOpts.experimental\n\n  const { ServerInsertedHTMLProvider, renderServerInsertedHTML } =\n    createServerInsertedHTML()\n  const getServerInsertedMetadata = createServerInsertedMetadata(nonce)\n\n  const tracingMetadata = getTracedMetadata(\n    getTracer().getTracePropagationData(),\n    experimental.clientTraceMetadata\n  )\n\n  const polyfills: JSX.IntrinsicElements['script'][] =\n    buildManifest.polyfillFiles\n      .filter(\n        (polyfill) =>\n          polyfill.endsWith('.js') && !polyfill.endsWith('.module.js')\n      )\n      .map((polyfill) => ({\n        src: `${assetPrefix}/_next/${polyfill}${getAssetQueryString(\n          ctx,\n          false\n        )}`,\n        integrity: subresourceIntegrityManifest?.[polyfill],\n        crossOrigin,\n        noModule: true,\n        nonce,\n      }))\n\n  const [preinitScripts, bootstrapScript] = getRequiredScripts(\n    buildManifest,\n    // Why is assetPrefix optional on renderOpts?\n    // @TODO make it default empty string on renderOpts and get rid of it from ctx\n    assetPrefix,\n    crossOrigin,\n    subresourceIntegrityManifest,\n    getAssetQueryString(ctx, true),\n    nonce,\n    page\n  )\n\n  // In development mode, set the request ID as a global variable, before the\n  // bootstrap script is executed, which depends on it during hydration.\n  // For MPA navigations (page reload, direct URL entry), the request ID\n  // header is not present, so we generate a random one.\n  let bootstrapScriptContent: string | undefined\n  if (process.env.__NEXT_DEV_SERVER) {\n    bootstrapScriptContent = `self.__next_r=${JSON.stringify(\n      requestId ?? crypto.randomUUID()\n    )}`\n  } else if (\n    buildManifest.pagesChunkGroupBootstrapParams &&\n    buildManifest.chunkLoadingGlobal\n  ) {\n    bootstrapScriptContent = getTurbopackChunkGroupBootstrap(\n      buildManifest.pagesChunkGroupBootstrapParams,\n      buildManifest.chunkLoadingGlobal,\n      [page]\n    )\n  }\n\n  // Instant Navigation Testing API: embed the cookie-guarded bootstrap so it\n  // runs before the client bootstrap module reads self.__next_instant_test as\n  // its hydration source. This mirrors the prerender path so a dynamically\n  // rendered document carries the same script as the cached static prelude.\n  if (ctx.renderOpts.experimental.exposeTestingApi) {\n    bootstrapScriptContent =\n      (bootstrapScriptContent ? `${bootstrapScriptContent};` : '') +\n      (await getInstantTestBootstrapScriptContent())\n  }\n\n  // Create the \"render route (app)\" span manually so we can keep it open during streaming.\n  // This is necessary because errors inside Suspense boundaries are reported asynchronously\n  // during stream consumption, after a typical wrapped function would have ended the span.\n  // Note: We pass the full span name as the first argument since startSpan uses it directly.\n  const renderSpan = getTracer().startSpan(\n    `render route (app) ${pagePath}` as any,\n    {\n      attributes: {\n        'next.span_name': `render route (app) ${pagePath}`,\n        'next.span_type': AppRenderSpan.getBodyResult,\n        'next.route': pagePath,\n      },\n    }\n  )\n\n  // Helper to end the span with error status (used when throwing from catch blocks)\n  const endSpanWithError = (err: unknown) => {\n    if (!renderSpan.isRecording()) return\n    if (err instanceof Error) {\n      renderSpan.recordException(err)\n      renderSpan.setAttribute('error.type', err.name)\n    }\n    renderSpan.setStatus({\n      code: SpanStatusCode.ERROR,\n      message: err instanceof Error ? err.message : undefined,\n    })\n    renderSpan.end()\n  }\n\n  // Run the rest of the function within the span's context so child spans\n  // (like \"build component tree\", \"generateMetadata\") are properly parented.\n  return getTracer().withSpan(renderSpan, async () => {\n    // MARK: renderToStream errorHandlers\n    const { reactServerErrorsByDigest } = workStore\n\n    // We use this to determine if we should suppress other derivative errors\n    let didErrorObservably = false\n    function onHTMLRenderRSCError(err: DigestedError, silenceLog: boolean) {\n      didErrorObservably = true\n      return onInstrumentationRequestError?.(\n        err,\n        req,\n        createErrorContext(ctx, 'react-server-components'),\n        silenceLog\n      )\n    }\n    const serverComponentsErrorHandler = createReactServerErrorHandler(\n      process.env.NODE_ENV === 'development',\n      isBuildTimePrerendering,\n      reactServerErrorsByDigest,\n      onHTMLRenderRSCError,\n      renderSpan\n    )\n\n    function onHTMLRenderSSRError(err: DigestedError) {\n      // We don't need to silence logs here. onHTMLRenderSSRError won't be called\n      // at all if the error was logged before in the RSC error handler.\n      const silenceLog = false\n      return onInstrumentationRequestError?.(\n        err,\n        req,\n        createErrorContext(ctx, 'server-rendering'),\n        silenceLog\n      )\n    }\n\n    const allCapturedErrors: Array<unknown> = []\n    const htmlRendererErrorHandler = createHTMLErrorHandler(\n      process.env.NODE_ENV === 'development',\n      isBuildTimePrerendering,\n      reactServerErrorsByDigest,\n      allCapturedErrors,\n      onHTMLRenderSSRError,\n      renderSpan\n    )\n\n    let reactServerResult: null | ReactServerResult = null\n    let reactDebugStream: AnyStream | undefined\n\n    const setHeader = res.setHeader.bind(res)\n    const appendHeader = res.appendHeader.bind(res)\n    const { clientModules } = getClientReferenceManifest()\n\n    try {\n      if (\n        process.env.__NEXT_DEV_SERVER &&\n        // Edge routes never prerender so we don't have a Prerender environment for anything in edge runtime\n        process.env.NEXT_RUNTIME !== 'edge' &&\n        // We only have a Prerender environment for projects opted into cacheComponents\n        cacheComponents\n      ) {\n        let debugChannelClientStream: ReplayableNodeStream | undefined\n\n        // eslint-disable-next-line @typescript-eslint/no-shadow\n        const getPayload = async (requestStore: RequestStore) => {\n          const payload: InitialRSCPayload & RSCPayloadDevProperties =\n            await workUnitAsyncStorage.run(\n              requestStore,\n              getRSCPayload,\n              tree,\n              ctx,\n              { is404: res.statusCode === 404 }\n            )\n\n          if (isBypassingCachesInDev(requestStore, workStore)) {\n            // Mark the RSC payload to indicate that caches were bypassed in dev.\n            // This lets the client know not to cache anything based on this render.\n            if (renderOpts.setCacheStatus) {\n              // we know this is available  when cacheComponents is enabled, but typeguard to be safe\n              renderOpts.setCacheStatus('bypass', htmlRequestId)\n            }\n            payload._bypassCachesInDev = createElement(\n              WarnForBypassCachesInDev,\n              {\n                route: workStore.route,\n              }\n            )\n          }\n\n          return payload\n        }\n\n        if (\n          // We only do this flow if we can safely recreate the store from scratch\n          // (which is not the case for renders after an action)\n          createRequestStore &&\n          // We only do this flow if we're not bypassing caches in dev using\n          // \"disable cache\" in devtools, a hard refresh (cache-control: \"no-cache\"),\n          // or draft mode.\n          !isBypassingCachesInDev(requestStore, workStore)\n        ) {\n          const loaderTree = ctx.componentMod.routeModule.userland.loaderTree\n          const prefetchMode = await getPrefetchingModeForPage(\n            renderOpts,\n            loaderTree\n          )\n\n          const { stream: serverStream, debugChannel: returnedDebugChannel } =\n            await stagedRenderWithCachesInDev({\n              prefetchMode,\n              ctx,\n              requestStore,\n              createRequestStore,\n              getPayload,\n              onError: serverComponentsErrorHandler,\n              shouldValidate: true,\n              fallbackRouteParams: fallbackParams,\n              getDevRenderDidError: () => didErrorObservably,\n              // An initial HTML load serves the static shell; runtime and\n              // dynamic content stream in afterward.\n              navigationKind: {\n                type: 'initial-load',\n              },\n              // We currently only abort HMR refresh requests.\n              requestAbortSignal: undefined,\n            })\n\n          reactServerResult = new ReactServerResult(serverStream)\n\n          if (returnedDebugChannel) {\n            debugChannelClientStream = new ReplayableNodeStream(\n              returnedDebugChannel.clientSide.readable\n            )\n          }\n        } else {\n          logValidationSkipped(ctx)\n\n          // We're either bypassing caches or we can't restart the render.\n          // Do a dynamic render, but with (basic) environment labels.\n\n          const debugChannel = setReactDebugChannel && createNodeDebugChannel()\n\n          const serverStream = await stagedRenderWithoutCachesInDevNode(\n            ctx,\n            requestStore,\n            getPayload,\n            {\n              onError: serverComponentsErrorHandler,\n              filterStackFrame,\n              debugChannel: debugChannel?.serverSide,\n            }\n          )\n          reactServerResult = new ReactServerResult(serverStream)\n\n          if (debugChannel) {\n            debugChannelClientStream = new ReplayableNodeStream(\n              debugChannel.clientSide.readable\n            )\n          }\n        }\n\n        if (debugChannelClientStream && setReactDebugChannel) {\n          reactDebugStream = debugChannelClientStream.createReplayStream()\n\n          setReactDebugChannel(\n            { readable: debugChannelClientStream.createReplayStream() },\n            htmlRequestId,\n            requestId\n          )\n        }\n      } else if (cacheComponents && cachedNavigations) {\n        // Production Cache Components + Cached Navigations: use staged\n        // rendering so the RSC payload includes the static stage byte length\n        // (`l` field), enabling the client to cache the static subset during\n        // hydration.\n\n        const selectStaleTime = createSelectStaleTime(experimental)\n        const staleTimeIterable = new StaleTimeIterable()\n\n        const stageController = new StagedRenderingController({\n          abortSignal: null,\n          abandonController: null,\n          // TODO(cached-navs): this assumes that we checked during build that there's no sync IO.\n          // but it can happen e.g. after a revalidation or conditionally for a param that wasn't prerendered.\n          // we should change this to track sync IO, log an error and advance to dynamic.\n          syncIO: SyncIOMode.Untracked,\n          finalStage: null,\n        })\n\n        requestStore.stale = INFINITE_CACHE\n        requestStore.stagedRendering = stageController\n        requestStore.asyncApiPromises = createAsyncApiPromises(\n          stageController,\n          requestStore.cookies,\n          requestStore.mutableCookies,\n          requestStore.headers\n        )\n        requestStore.varyParamsAccumulator =\n          createResponseVaryParamsAccumulator()\n\n        trackStaleTime(\n          requestStore as { stale: number },\n          staleTimeIterable,\n          selectStaleTime\n        )\n\n        const shellByteLengthDeferred = createPromiseWithResolvers<\n          number | null\n        >()\n        const staticStageByteLengthDeferred =\n          createPromiseWithResolvers<number>()\n\n        let runtimePrefetchStream: ReadableStream<Uint8Array> | undefined\n\n        // If the route should runtime-cache its navigation, spawn a runtime\n        // prerender after the resume render fills caches. The result is\n        // embedded in the initial RSC payload so the client can cache\n        // runtime-prefetchable content during hydration. This is enabled when\n        // Partial Prefetching is on for the route, either per segment (a\n        // `prefetch` of 'partial' or 'unstable_eager') or globally (the\n        // `partialPrefetching` config).\n        if (\n          Boolean(renderOpts.partialPrefetching) ||\n          (await anySegmentHasPartialPrefetchingEnabled(tree))\n        ) {\n          const prerenderResumeDataCache = createPrerenderResumeDataCache()\n          requestStore.resumeDataCache = prerenderResumeDataCache\n\n          const cacheSignal = new CacheSignal()\n          trackPendingModules(cacheSignal)\n          requestStore.cacheSignal = cacheSignal\n\n          const runtimePrefetchTransform = new TransformStream<Uint8Array>()\n          runtimePrefetchStream = runtimePrefetchTransform.readable\n\n          void cacheSignal\n            .cacheReady()\n            .then(() =>\n              spawnRuntimePrefetchWithFilledCaches(\n                runtimePrefetchTransform.writable,\n                ctx,\n                prerenderResumeDataCache,\n                requestStore,\n                serverComponentsErrorHandler\n              )\n            )\n        }\n\n        const RSCPayload = await workUnitAsyncStorage.run(\n          requestStore,\n          getRSCPayload,\n          tree,\n          ctx,\n          {\n            is404: res.statusCode === 404,\n            staleTimeIterable,\n            shellByteLengthPromise: shellByteLengthDeferred.promise,\n            staticStageByteLengthPromise: staticStageByteLengthDeferred.promise,\n            runtimePrefetchStream,\n          }\n        )\n\n        const flightStream = await runInSequentialTasks(\n          () => {\n            stageController.advanceStage(RenderStage.ShellStatic)\n\n            const stream = workUnitAsyncStorage.run(\n              requestStore,\n              renderToNodeFlightStream,\n              ctx.componentMod,\n              RSCPayload,\n              clientModules,\n              {\n                onError: serverComponentsErrorHandler,\n                filterStackFrame,\n              }\n            ) as Readable\n\n            const replayable = new ReplayableNodeStream(stream)\n            const dynamicStream = replayable.createReplayStream()\n            const staticStream = replayable.createReplayStream()\n\n            void countShellAndStaticStageBytes(\n              staticStream,\n              stageController\n            ).then((byteLengths) => {\n              staticStageByteLengthDeferred.resolve(\n                byteLengths[RenderStage.Static]\n              )\n              shellByteLengthDeferred.resolve(\n                byteLengths[RenderStage.ShellStatic]\n              )\n            })\n\n            return dynamicStream\n          },\n          () => {\n            stageController.advanceStage(RenderStage.Static)\n          },\n          () => {\n            // This is a separate task that doesn't advance a stage. It forces\n            // draining the immediate queue so that the stale time iterable and vary\n            // params accumulators are flushed before we advance to the dynamic stage.\n            staleTimeIterable.close()\n            if (requestStore.varyParamsAccumulator) {\n              finishAccumulatingVaryParams(requestStore.varyParamsAccumulator)\n            }\n          },\n          () => {\n            stageController.advanceStage(RenderStage.Dynamic)\n          }\n        )\n\n        reactServerResult = new ReactServerResult(flightStream)\n      } else {\n        // MARK: nodeStreams RSC\n        if (process.env.__NEXT_USE_NODE_STREAMS) {\n          // This is a dynamic render. We don't do dynamic tracking because we're not prerendering\n          const RSCPayload: RSCPayload & RSCPayloadDevProperties =\n            await workUnitAsyncStorage.run(\n              requestStore,\n              getRSCPayload,\n              tree,\n              ctx,\n              { is404: res.statusCode === 404 }\n            )\n\n          const debugChannel = setReactDebugChannel && createNodeDebugChannel()\n\n          if (debugChannel) {\n            const [readableSsr, readableBrowser] = teeStream(\n              debugChannel.clientSide.readable\n            )\n\n            reactDebugStream = readableSsr\n\n            setReactDebugChannel(\n              { readable: readableBrowser },\n              htmlRequestId,\n              requestId\n            )\n          }\n\n          reactServerResult = new ReactServerResult(\n            workUnitAsyncStorage.run(\n              requestStore,\n              renderToNodeFlightStream,\n              ctx.componentMod,\n              RSCPayload,\n              clientModules,\n              {\n                filterStackFrame,\n                onError: serverComponentsErrorHandler,\n                debugChannel: debugChannel?.serverSide,\n              }\n            )\n          )\n        } else {\n          // MARK: webStreams RSC\n          // This is a dynamic render. We don't do dynamic tracking because we're not prerendering\n          const RSCPayload: RSCPayload & RSCPayloadDevProperties =\n            await workUnitAsyncStorage.run(\n              requestStore,\n              getRSCPayload,\n              tree,\n              ctx,\n              { is404: res.statusCode === 404 }\n            )\n\n          const debugChannel = setReactDebugChannel && createWebDebugChannel()\n\n          if (debugChannel) {\n            const [readableSsr, readableBrowser] = teeStream(\n              debugChannel.clientSide.readable\n            )\n\n            reactDebugStream = readableSsr\n\n            setReactDebugChannel(\n              { readable: readableBrowser },\n              htmlRequestId,\n              requestId\n            )\n          }\n\n          reactServerResult = new ReactServerResult(\n            workUnitAsyncStorage.run(\n              requestStore,\n              renderToWebFlightStream,\n              ctx.componentMod,\n              RSCPayload,\n              clientModules,\n              {\n                filterStackFrame,\n                onError: serverComponentsErrorHandler,\n                debugChannel: debugChannel?.serverSide,\n              }\n            )\n          )\n        }\n      }\n\n      // React doesn't start rendering synchronously but we want the RSC render to have a chance to start\n      // before we begin SSR rendering because we want to capture any available preload headers so we tick\n      // one task before continuing\n      await waitAtLeastOneReactRenderTask()\n\n      // MARK: nodeStreams HTML\n      if (process.env.__NEXT_USE_NODE_STREAMS) {\n        // If provided, the postpone state should be parsed as JSON so it can be\n        // provided to React.\n        if (typeof renderOpts.postponed === 'string') {\n          if (postponedState?.type === DynamicState.DATA) {\n            // We have a complete HTML Document in the prerender but we need to\n            // still include the new server component render because it was not included\n            // in the static prelude.\n            const inlinedDataStream = createNodeInlinedDataStream(\n              reactServerResult.tee(),\n              nonce,\n              formState\n            )\n\n            // End the span since there's no async rendering in this path\n            if (renderSpan.isRecording()) renderSpan.end()\n            return chainStreams(\n              inlinedDataStream,\n              createDocumentClosingStream()\n            )\n          } else if (postponedState) {\n            // We assume we have dynamic HTML requiring a resume render to complete\n            const { postponed, preludeState } =\n              getPostponedFromState(postponedState)\n\n            const resumeAppElement = (\n              <App\n                reactServerStream={reactServerResult.tee()}\n                reactDebugStream={reactDebugStream}\n                debugEndTime={undefined}\n                preinitScripts={preinitScripts}\n                ServerInsertedHTMLProvider={ServerInsertedHTMLProvider}\n                nonce={nonce}\n                images={ctx.renderOpts.images}\n              />\n            )\n\n            const getServerInsertedHTML = makeGetServerInsertedHTML({\n              polyfills,\n              renderServerInsertedHTML,\n              serverCapturedErrors: allCapturedErrors,\n              basePath,\n              tracingMetadata: tracingMetadata,\n            })\n\n            const { stream: htmlStream, allReady } =\n              await workUnitAsyncStorage.run(\n                requestStore,\n                resumeToFizzStream,\n                resumeAppElement,\n                postponed,\n                { onError: htmlRendererErrorHandler, nonce }\n              )\n\n            // End the render span only after React completed rendering (including anything inside Suspense boundaries)\n            allReady.finally(() => {\n              if (renderSpan.isRecording()) renderSpan.end()\n            })\n\n            return await continueDynamicHTMLResumeNode(htmlStream, {\n              delayDataUntilFirstHtmlChunk:\n                preludeState === DynamicHTMLPreludeState.Empty,\n              inlinedDataStream: createNodeInlinedDataStream(\n                reactServerResult.consume(),\n                nonce,\n                formState\n              ),\n              getServerInsertedHTML,\n              getServerInsertedMetadata,\n              deploymentId: ctx.sharedContext.deploymentId,\n            })\n          }\n        }\n\n        // This is a regular dynamic render\n        const getServerInsertedHTML = makeGetServerInsertedHTML({\n          polyfills,\n          renderServerInsertedHTML,\n          serverCapturedErrors: allCapturedErrors,\n          basePath,\n          tracingMetadata: tracingMetadata,\n        })\n\n        const generateStaticHTML = supportsDynamicResponse !== true\n\n        const appElement = (\n          <App\n            reactServerStream={reactServerResult.tee()}\n            // TODO: Pass Node.js debugStream\n            reactDebugStream={reactDebugStream}\n            debugEndTime={undefined}\n            preinitScripts={preinitScripts}\n            ServerInsertedHTMLProvider={ServerInsertedHTMLProvider}\n            nonce={nonce}\n            images={ctx.renderOpts.images}\n          />\n        )\n\n        const fizzOptions = {\n          onError: htmlRendererErrorHandler,\n          nonce,\n          onHeaders: (headers: { [header: string]: string }) => {\n            for (const key in headers) {\n              appendHeader(key, headers[key])\n            }\n          },\n          maxHeadersLength: reactMaxHeadersLength,\n          bootstrapScriptContent,\n          bootstrapScripts: [bootstrapScript],\n          formState,\n        }\n\n        const { stream: htmlStream, allReady } = await getTracer().trace(\n          AppRenderSpan.renderToNodeFizzStream,\n          () =>\n            workUnitAsyncStorage.run(\n              requestStore,\n              renderToNodeFizzStream,\n              appElement,\n              fizzOptions,\n              { waitForAllReady: generateStaticHTML }\n            )\n        )\n\n        // End the render span only after React completed rendering (including anything inside Suspense boundaries)\n        allReady.finally(() => {\n          if (renderSpan.isRecording()) renderSpan.end()\n        })\n\n        return await continueFizzStream(htmlStream, {\n          inlinedDataStream: createNodeInlinedDataStream(\n            reactServerResult.consume(),\n            nonce,\n            formState\n          ),\n          isStaticGeneration: generateStaticHTML,\n          allReady,\n          deploymentId: ctx.sharedContext.deploymentId,\n          getServerInsertedHTML,\n          getServerInsertedMetadata,\n          validateRootLayout: !!process.env.__NEXT_DEV_SERVER,\n        })\n      } else {\n        // MARK: webStreams HTML\n        // If provided, the postpone state should be parsed as JSON so it can be\n        // provided to React.\n        if (typeof renderOpts.postponed === 'string') {\n          if (postponedState?.type === DynamicState.DATA) {\n            // We have a complete HTML Document in the prerender but we need to\n            // still include the new server component render because it was not included\n            // in the static prelude.\n            const inlinedDataStream = createWebInlinedDataStream(\n              reactServerResult.tee(),\n              nonce,\n              formState\n            )\n\n            // End the span since there's no async rendering in this path\n            if (renderSpan.isRecording()) renderSpan.end()\n            return chainStreams(\n              inlinedDataStream,\n              createDocumentClosingStream()\n            )\n          } else if (postponedState) {\n            // We assume we have dynamic HTML requiring a resume render to complete\n            const { postponed, preludeState } =\n              getPostponedFromState(postponedState)\n\n            const resumeAppElement = (\n              <App\n                reactServerStream={reactServerResult.tee()}\n                reactDebugStream={reactDebugStream}\n                debugEndTime={undefined}\n                preinitScripts={preinitScripts}\n                ServerInsertedHTMLProvider={ServerInsertedHTMLProvider}\n                nonce={nonce}\n                images={ctx.renderOpts.images}\n              />\n            )\n\n            const getServerInsertedHTML = makeGetServerInsertedHTML({\n              polyfills,\n              renderServerInsertedHTML,\n              serverCapturedErrors: allCapturedErrors,\n              basePath,\n              tracingMetadata: tracingMetadata,\n            })\n\n            const { stream: htmlStream, allReady } =\n              await workUnitAsyncStorage.run(\n                requestStore,\n                resumeToFizzStream,\n                resumeAppElement,\n                postponed,\n                { onError: htmlRendererErrorHandler, nonce }\n              )\n\n            // End the render span only after React completed rendering (including anything inside Suspense boundaries)\n            allReady.finally(() => {\n              if (renderSpan.isRecording()) renderSpan.end()\n            })\n\n            return await continueDynamicHTMLResumeWeb(htmlStream, {\n              delayDataUntilFirstHtmlChunk:\n                preludeState === DynamicHTMLPreludeState.Empty,\n              inlinedDataStream: createWebInlinedDataStream(\n                reactServerResult.consume(),\n                nonce,\n                formState\n              ),\n              getServerInsertedHTML,\n              getServerInsertedMetadata,\n              deploymentId: ctx.sharedContext.deploymentId,\n            })\n          }\n        }\n\n        // This is a regular dynamic render\n        const getServerInsertedHTML = makeGetServerInsertedHTML({\n          polyfills,\n          renderServerInsertedHTML,\n          serverCapturedErrors: allCapturedErrors,\n          basePath,\n          tracingMetadata: tracingMetadata,\n        })\n\n        const generateStaticHTML = supportsDynamicResponse !== true\n\n        const appElement = (\n          <App\n            reactServerStream={reactServerResult.tee()}\n            reactDebugStream={reactDebugStream}\n            debugEndTime={undefined}\n            preinitScripts={preinitScripts}\n            ServerInsertedHTMLProvider={ServerInsertedHTMLProvider}\n            nonce={nonce}\n            images={ctx.renderOpts.images}\n          />\n        )\n\n        const fizzOptions = {\n          onError: htmlRendererErrorHandler,\n          nonce,\n          onHeaders: (headers: Headers) => {\n            headers.forEach((value, key) => {\n              appendHeader(key, value)\n            })\n          },\n          maxHeadersLength: reactMaxHeadersLength,\n          bootstrapScriptContent,\n          bootstrapScripts: [bootstrapScript],\n          formState,\n        }\n\n        const { stream: htmlStream, allReady } = await workUnitAsyncStorage.run(\n          requestStore,\n          renderToWebFizzStream,\n          appElement,\n          fizzOptions\n        )\n\n        // End the render span only after React completed rendering (including anything inside Suspense boundaries)\n        allReady.finally(() => {\n          if (renderSpan.isRecording()) renderSpan.end()\n        })\n\n        return await continueFizzStream(htmlStream, {\n          inlinedDataStream: createWebInlinedDataStream(\n            reactServerResult.consume(),\n            nonce,\n            formState\n          ),\n          isStaticGeneration: generateStaticHTML,\n          allReady,\n          deploymentId: ctx.sharedContext.deploymentId,\n          getServerInsertedHTML,\n          getServerInsertedMetadata,\n          validateRootLayout: !!process.env.__NEXT_DEV_SERVER,\n        })\n      }\n      // MARK: renderToStream errorRecovery\n    } catch (err) {\n      if (\n        isStaticGenBailoutError(err) ||\n        (typeof err === 'object' &&\n          err !== null &&\n          'message' in err &&\n          typeof err.message === 'string' &&\n          err.message.includes(\n            'https://nextjs.org/docs/advanced-features/static-html-export'\n          ))\n      ) {\n        // Ensure that \"next dev\" prints the red error overlay\n        endSpanWithError(err)\n        throw err\n      }\n\n      // If a bailout made it to this point, it means it wasn't wrapped inside\n      // a suspense boundary.\n      const shouldBailoutToCSR = isBailoutToCSRError(err)\n      if (shouldBailoutToCSR) {\n        const stack = getStackWithoutErrorMessage(err)\n        error(\n          `${err.reason} should be wrapped in a suspense boundary at page \"${pagePath}\". Read more: https://nextjs.org/docs/messages/missing-suspense-with-csr-bailout\\n${stack}`\n        )\n\n        endSpanWithError(err)\n        throw err\n      }\n\n      // MARK: errorRecovery classification\n      let errorType: MetadataErrorType | 'redirect' | undefined\n\n      if (isHTTPAccessFallbackError(err)) {\n        res.statusCode = getAccessFallbackHTTPStatus(err)\n        metadata.statusCode = res.statusCode\n        errorType = getAccessFallbackErrorTypeByStatus(res.statusCode)\n      } else if (isRedirectError(err)) {\n        errorType = 'redirect'\n        res.statusCode = getRedirectStatusCodeFromError(err)\n        metadata.statusCode = res.statusCode\n\n        const redirectUrl = addPathPrefix(\n          getURLFromRedirectError(err),\n          basePath\n        )\n\n        // If there were mutable cookies set, we need to set them on the\n        // response.\n        const headers = new Headers()\n        if (appendMutableCookies(headers, requestStore.mutableCookies)) {\n          setHeader('set-cookie', Array.from(headers.values()))\n        }\n\n        setHeader('location', redirectUrl)\n      } else if (!shouldBailoutToCSR) {\n        res.statusCode = 500\n        metadata.statusCode = res.statusCode\n      }\n\n      const [errorPreinitScripts, errorBootstrapScript] = getRequiredScripts(\n        buildManifest,\n        assetPrefix,\n        crossOrigin,\n        subresourceIntegrityManifest,\n        getAssetQueryString(ctx, false),\n        nonce,\n        UNDERSCORE_NOT_FOUND_ROUTE_ENTRY\n      )\n\n      let errorBootstrapScriptContent: string | undefined\n      if (process.env.__NEXT_DEV_SERVER) {\n        errorBootstrapScriptContent = bootstrapScriptContent\n      } else if (\n        buildManifest.pagesChunkGroupBootstrapParams &&\n        buildManifest.chunkLoadingGlobal\n      ) {\n        errorBootstrapScriptContent = getTurbopackChunkGroupBootstrap(\n          buildManifest.pagesChunkGroupBootstrapParams,\n          buildManifest.chunkLoadingGlobal,\n          [UNDERSCORE_NOT_FOUND_ROUTE_ENTRY]\n        )\n      }\n\n      if (process.env.__NEXT_USE_NODE_STREAMS) {\n        // MARK: nodeStreams errorRecovery RSC + HTML\n        let errorRSCPayload: InitialRSCPayload\n        let errorServerStream: import('./stream-ops').AnyStream\n\n        try {\n          errorRSCPayload = await workUnitAsyncStorage.run(\n            requestStore,\n            getErrorRSCPayload,\n            tree,\n            ctx,\n            reactServerErrorsByDigest.has((err as any).digest) ? null : err,\n            errorType,\n            // Normal error rendering should include the error payload head.\n            true\n          )\n\n          errorServerStream = workUnitAsyncStorage.run(\n            requestStore,\n            renderToNodeFlightStream,\n            ctx.componentMod,\n            errorRSCPayload,\n            clientModules,\n            {\n              filterStackFrame,\n              onError: serverComponentsErrorHandler,\n            }\n          )\n\n          if (reactServerResult === null) {\n            endSpanWithError(err)\n            throw err\n          }\n        } catch (setupErr) {\n          endSpanWithError(setupErr)\n          throw setupErr\n        }\n\n        try {\n          const generateStaticHTML = supportsDynamicResponse !== true\n\n          const { stream: errorHtmlStream, allReady: errorAllReady } =\n            await workUnitAsyncStorage.run(\n              requestStore,\n              renderToNodeFizzStream,\n              <ErrorApp\n                reactServerStream={errorServerStream}\n                ServerInsertedHTMLProvider={ServerInsertedHTMLProvider}\n                preinitScripts={errorPreinitScripts}\n                nonce={nonce}\n                images={ctx.renderOpts.images}\n              />,\n              {\n                nonce,\n                bootstrapScriptContent: errorBootstrapScriptContent,\n                bootstrapScripts: [errorBootstrapScript],\n                formState,\n              },\n              { waitForAllReady: generateStaticHTML }\n            )\n\n          errorAllReady.finally(() => {\n            if (renderSpan.isRecording()) renderSpan.end()\n          })\n\n          return await continueFizzStream(errorHtmlStream, {\n            inlinedDataStream: createNodeInlinedDataStream(\n              // This is intentionally using the readable datastream from the\n              // main render rather than the flight data from the error page\n              // render\n              reactServerResult.consume(),\n              nonce,\n              formState\n            ),\n            isStaticGeneration: generateStaticHTML,\n            deploymentId: ctx.sharedContext.deploymentId,\n            getServerInsertedHTML: makeGetServerInsertedHTML({\n              polyfills,\n              renderServerInsertedHTML,\n              serverCapturedErrors: [],\n              basePath,\n              tracingMetadata: tracingMetadata,\n            }),\n            getServerInsertedMetadata,\n            validateRootLayout: !!process.env.__NEXT_DEV_SERVER,\n          })\n        } catch (finalErr: any) {\n          if (\n            process.env.__NEXT_DEV_SERVER &&\n            isHTTPAccessFallbackError(finalErr)\n          ) {\n            const { bailOnRootNotFound } =\n              require('../../client/components/dev-root-http-access-fallback-boundary') as typeof import('../../client/components/dev-root-http-access-fallback-boundary')\n            bailOnRootNotFound()\n          }\n          endSpanWithError(finalErr)\n          throw finalErr\n        }\n      } else {\n        // MARK: webStreams errorRecovery RSC + HTML\n        let errorRSCPayload: InitialRSCPayload\n        let errorServerStream: import('./stream-ops').AnyStream\n\n        try {\n          errorRSCPayload = await workUnitAsyncStorage.run(\n            requestStore,\n            getErrorRSCPayload,\n            tree,\n            ctx,\n            reactServerErrorsByDigest.has((err as any).digest) ? null : err,\n            errorType,\n            // Normal error rendering should include the error payload head.\n            true\n          )\n\n          errorServerStream = workUnitAsyncStorage.run(\n            requestStore,\n            renderToWebFlightStream,\n            ctx.componentMod,\n            errorRSCPayload,\n            clientModules,\n            {\n              filterStackFrame,\n              onError: serverComponentsErrorHandler,\n            }\n          )\n\n          if (reactServerResult === null) {\n            endSpanWithError(err)\n            throw err\n          }\n        } catch (setupErr) {\n          endSpanWithError(setupErr)\n          throw setupErr\n        }\n\n        try {\n          const generateStaticHTML = supportsDynamicResponse !== true\n\n          const { stream: errorHtmlStream, allReady: errorAllReady } =\n            await workUnitAsyncStorage.run(\n              requestStore,\n              renderToWebFizzStream,\n              <ErrorApp\n                reactServerStream={errorServerStream}\n                ServerInsertedHTMLProvider={ServerInsertedHTMLProvider}\n                preinitScripts={errorPreinitScripts}\n                nonce={nonce}\n                images={ctx.renderOpts.images}\n              />,\n              {\n                nonce,\n                bootstrapScriptContent: errorBootstrapScriptContent,\n                bootstrapScripts: [errorBootstrapScript],\n                formState,\n              }\n            )\n\n          errorAllReady.finally(() => {\n            if (renderSpan.isRecording()) renderSpan.end()\n          })\n\n          return await continueFizzStream(errorHtmlStream, {\n            inlinedDataStream: createWebInlinedDataStream(\n              // This is intentionally using the readable datastream from the\n              // main render rather than the flight data from the error page\n              // render\n              reactServerResult.consume(),\n              nonce,\n              formState\n            ),\n            isStaticGeneration: generateStaticHTML,\n            deploymentId: ctx.sharedContext.deploymentId,\n            getServerInsertedHTML: makeGetServerInsertedHTML({\n              polyfills,\n              renderServerInsertedHTML,\n              serverCapturedErrors: [],\n              basePath,\n              tracingMetadata: tracingMetadata,\n            }),\n            getServerInsertedMetadata,\n            validateRootLayout: !!process.env.__NEXT_DEV_SERVER,\n          })\n        } catch (finalErr: any) {\n          if (\n            process.env.__NEXT_DEV_SERVER &&\n            isHTTPAccessFallbackError(finalErr)\n          ) {\n            const { bailOnRootNotFound } =\n              require('../../client/components/dev-root-http-access-fallback-boundary') as typeof import('../../client/components/dev-root-http-access-fallback-boundary')\n            bailOnRootNotFound()\n          }\n          endSpanWithError(finalErr)\n          throw finalErr\n        }\n      }\n    }\n  })\n  /* eslint-enable @next/internal/no-ambiguous-jsx */\n}\n\n/**\n * A staged dev render interrupted by sync IO. It has no artifacts that could be\n * used as validation inputs, only the reason it was interrupted.\n */\ninterface SyncInterruptedStagedDevRender {\n  readonly syncInterruptReason: Error\n}\n\n/**\n * The chunks and per-stage timings a staged dev render accumulates once its\n * stream finishes. A render only produces them when it runs to the end without\n * a sync-IO interrupt, so they back both a render's uninterrupted outcome and\n * the validation inputs.\n */\ninterface StagedDevRenderArtifacts {\n  readonly accumulatedChunks: AccumulatedStreamChunks\n  readonly startTime: number\n  readonly stageEndTimes: StageEndTimes\n}\n\n/**\n * How a staged dev render ended once its stream has fully finished: with usable\n * artifacts or interrupted by sync IO.\n */\ntype StagedDevRenderOutcome =\n  | StagedDevRenderArtifacts\n  | SyncInterruptedStagedDevRender\n\n/**\n * A settled staged dev render: how it ended, plus whether it triggered `use\n * cache` fills that may still be settling. `hadCacheMiss` is orthogonal to the\n * outcome (either kind of render can miss caches) and is consumed before the\n * result is split into validation inputs: it gates the `cacheReady()` wait\n * before the render's work store is inspected, and on an uninterrupted render\n * also marks the output non-prod-representative so it can't be reused for\n * validation.\n */\ninterface StagedDevRenderResult {\n  readonly hadCacheMiss: boolean\n  readonly outcome: StagedDevRenderOutcome\n}\n\n/**\n * What `runValidationInDev` consumes: an uninterrupted render's artifacts plus\n * the request store and the debug channel. Carries no `syncInterruptReason`:\n * the resolution step has already surfaced and bailed on any sync interrupt.\n */\nexport interface ResolvedValidationInputs extends StagedDevRenderArtifacts {\n  readonly requestStore: RequestStore\n  readonly debugChannelClient: AnyStream | undefined\n}\n\n/**\n * The inputs produced for validation, before resolution: either an\n * uninterrupted render's artifacts (`ResolvedValidationInputs`) or, for a\n * render interrupted by sync IO, only the interrupt reason. An interrupted\n * render is never validated, so it carries nothing else: its debug channel is\n * dropped at construction. Discriminate with `'syncInterruptReason' in x`; the\n * resolution step surfaces and bails on the interrupted case, so the depth loop\n * only ever sees `ResolvedValidationInputs`.\n */\nexport type DevValidationInputs =\n  | ResolvedValidationInputs\n  | SyncInterruptedStagedDevRender\n\n/**\n * Drops a validation debug channel branch we've decided not to read.\n */\nfunction dropValidationDebugChannel(channel: AnyStream | undefined): void {\n  if (channel instanceof ReadableStream) {\n    channel.cancel()\n  } else {\n    channel?.destroy()\n  }\n}\n\nconst alreadyForwardedDynamicUsageErrors = new WeakSet<Error>()\n\n/**\n * Forwards an `invalidDynamicUsageError` recorded on the work store (e.g. a\n * request API used inside `'use cache'`) to the dev overlay, so client\n * navigations surface the same error as initial HTML loads do via validation.\n *\n * Returns whether an error was present, so callers can skip further validation.\n * That's independent of whether it was forwarded: an error that already carries\n * a digest is not forwarded again (it was emitted into the React render), but\n * it's still present and already shown, so validation should still be skipped.\n */\nfunction forwardInvalidDynamicUsageError(\n  invalidDynamicUsageError: Error | undefined,\n  ctx: AppRenderContext\n): boolean {\n  if (!invalidDynamicUsageError) {\n    return false\n  }\n\n  // Forward only if userland caught the rejection. If userland didn't catch,\n  // the rejection propagated into the React render and React's\n  // `serverComponentsErrorHandler` already stamped a digest on the error and\n  // emitted it as a Flight error chunk, so surfacing it again here would\n  // duplicate the entry in the dev overlay.\n  if (\n    !(invalidDynamicUsageError as { digest?: unknown }).digest &&\n    !alreadyForwardedDynamicUsageErrors.has(invalidDynamicUsageError)\n  ) {\n    alreadyForwardedDynamicUsageErrors.add(invalidDynamicUsageError)\n    void logMessagesAndSendErrorsToBrowser([invalidDynamicUsageError], ctx)\n  }\n\n  return true\n}\n\n/**\n * Runs Cache Components validation in the background once the response has\n * finished.\n */\nfunction runDevValidationInBackground(\n  prefetchMode: PrefetchingMode,\n  navigationKind: DevNavigationKind,\n  result: StagedDevRenderResult,\n  requestStore: RequestStore,\n  validationDebugChannel: AnyStream | undefined,\n  ctx: AppRenderContext,\n  fallbackRouteParams: OpaqueFallbackRouteParams | null,\n  prerenderResumeDataCache: ReturnType<typeof createPrerenderResumeDataCache>,\n  getDevRenderDidError: () => boolean,\n  createRequestStore: () => RequestStore,\n  getPayload: (requestStore: RequestStore) => Promise<RSCPayload>,\n  onError: (error: unknown) => void,\n  validationGeneration: DevValidationGeneration\n): void {\n  const validationAbortSignal = validationGeneration.signal\n\n  void consoleAsyncStorage\n    .run({ dim: true }, async () => {\n      // Validation is detached diagnostic work, but the renders and error\n      // formatting it performs can still monopolize the event loop. Wait until\n      // the response has finished so that work cannot delay Flight delivery or\n      // the client navigation.\n      if (\n        isNodeNextResponse(ctx.res) &&\n        !(await waitForResponseToFinish(ctx.res.originalResponse))\n      ) {\n        logValidationAborted(ctx)\n        return\n      }\n\n      if (!(await yieldToForegroundRequest(validationAbortSignal))) {\n        logValidationAborted(ctx)\n        return\n      }\n\n      return runInstantInsightsWithTracing(ctx, async (runSpan) => {\n        // Read whether the streamed render errored only now that it has fully\n        // settled.\n        const devRenderDidError = getDevRenderDidError()\n\n        const [instantInputs, staticInputs] = await runSpan(\n          AppRenderSpan.instantInsightsPrepareValidation,\n          'Prepare validation inputs',\n          async () => {\n            const lazyInputs = await prepareValidationInputs(\n              prefetchMode,\n              navigationKind,\n              result,\n              requestStore,\n              validationDebugChannel,\n              ctx,\n              prerenderResumeDataCache,\n              createRequestStore,\n              getPayload,\n              onError,\n              validationAbortSignal\n            )\n\n            // If we need to do multiple renders, do them in parallel.\n            // `runValidationInDev` currently needs `instantInputs` eagerly\n            // right before using `staticInputs` for static shell validation,\n            // so there's no point delaying one of the renders.\n            // We bail out (after logging an error during\n            // `resolveLazyDevValidationInputs`) if sync IO or invalid dynamic\n            // errors happen in either.\n            return Promise.all([\n              lazyInputs.instantInputs\n                ? resolveLazyDevValidationInputs(lazyInputs.instantInputs, ctx)\n                : null,\n              resolveLazyDevValidationInputs(lazyInputs.staticInputs, ctx),\n            ])\n          }\n        )\n        if (\n          instantInputs === VALIDATION_BAILOUT ||\n          staticInputs === VALIDATION_BAILOUT\n        ) {\n          return\n        }\n\n        // A newer render may have superseded this work while we prepared the\n        // validation inputs above (which can itself render).\n        if (validationAbortSignal.aborted) {\n          logValidationAborted(ctx)\n          return\n        }\n\n        return runSpan(\n          AppRenderSpan.instantInsightsRunValidation,\n          'Run validation',\n          async () => {\n            // Hand the whole validation to the worker when one is installed. It\n            // runs on a worker thread (off the main thread), emits its own\n            // lifecycle markers, logs code frames on its piped stdio, and\n            // returns the overlay Flight bytes for the main thread to forward.\n            // The worker is absent when `experimental.devValidationWorker` is\n            // false, and validation runs in-process instead.\n            const devValidationWorker = getDevValidationWorker()\n\n            if (devValidationWorker) {\n              const snapshot = await buildDevValidationSnapshot(\n                ctx,\n                instantInputs,\n                staticInputs,\n                prefetchMode,\n                fallbackRouteParams,\n                devRenderDidError\n              )\n\n              const chunks = await devValidationWorker(\n                snapshot,\n                validationAbortSignal\n              )\n\n              // A newer navigation may have superseded this validation while\n              // the worker ran; don't surface stale insights for a page the user\n              // left.\n              if (chunks && !validationAbortSignal.aborted) {\n                const { sendErrorsToBrowser } = ctx.renderOpts\n                if (!sendErrorsToBrowser) {\n                  throw new InvariantError(\n                    'Expected `sendErrorsToBrowser` to be defined in renderOpts.'\n                  )\n                }\n                sendErrorsToBrowser(\n                  createNodeStreamFromChunks(chunks),\n                  ctx.htmlRequestId\n                )\n              }\n            } else {\n              // In-process path, taken when `experimental.devValidationWorker`\n              // is false or no worker is installed (e.g. during a build).\n              // Validation computes the errors; the caller delivers them to the\n              // dev overlay. `runWithDevValidationLogging` encloses both the\n              // render and the delivery in the test-mode lifecycle markers so\n              // tests that assert the delivered error between\n              // `validation_start` and `validation_end` capture it.\n              await runWithDevValidationLogging(\n                ctx,\n                validationAbortSignal,\n                async () => {\n                  const validationErrors = await runValidationInDev(\n                    prefetchMode,\n                    instantInputs,\n                    staticInputs,\n                    toValidationRenderContext(ctx),\n                    fallbackRouteParams,\n                    devRenderDidError,\n                    validationAbortSignal\n                  )\n\n                  if (\n                    validationErrors !== undefined &&\n                    !validationAbortSignal.aborted\n                  ) {\n                    await logMessagesAndSendErrorsToBrowser(\n                      validationErrors,\n                      ctx\n                    )\n                  }\n                }\n              )\n            }\n          }\n        )\n      })\n    })\n    // The catch keeps a failed render, or anything thrown inside validation,\n    // from surfacing as an unhandled rejection.\n    .catch((err) => {\n      // Superseded validation is intentionally torn down. Don't log errors\n      // caused by its abort signal.\n      if (validationAbortSignal.aborted) {\n        return\n      }\n      console.error(\n        new InvariantError('An unexpected error occurred during validation', {\n          cause: err,\n        })\n      )\n    })\n    .finally(() => validationGeneration.finish())\n}\n\ntype RunInstantInsightsSpan = <T>(\n  spanType: AppRenderSpan,\n  spanName: string,\n  fn: () => Promise<T>\n) => Promise<T>\n\nfunction runInstantInsightsSpan<T>(\n  spanType: AppRenderSpan,\n  spanName: string,\n  fn: () => Promise<T>\n): Promise<T> {\n  return traceLocalSpan(\n    {\n      name: spanName,\n      attributes: {\n        'next.span_category': 'nextjs',\n        'next.span_name': spanName,\n        'next.span_type': spanType,\n      },\n    },\n    fn\n  )\n}\n\nfunction runWithoutInstantInsightsSpan<T>(\n  _spanType: AppRenderSpan,\n  _spanName: string,\n  fn: () => Promise<T>\n): Promise<T> {\n  return fn()\n}\n\nasync function runInstantInsightsWithTracing<T>(\n  ctx: AppRenderContext,\n  fn: (runSpan: RunInstantInsightsSpan) => Promise<T>\n): Promise<T> {\n  if (!isRequestInsightsEnabled()) {\n    return fn(runWithoutInstantInsightsSpan)\n  }\n\n  return runWithRequestInsightsIdentity(\n    {\n      requestId: ctx.requestId,\n      kind: 'instant-insights',\n      htmlRequestId: ctx.htmlRequestId,\n      url: ctx.url.href,\n    },\n    () =>\n      traceLocalSpan(\n        {\n          name: 'Instant Insights',\n          parentSpan: null,\n          attributes: {\n            'next.span_category': 'nextjs',\n            'next.span_name': 'Instant Insights',\n            'next.span_type': AppRenderSpan.instantInsights,\n            'next.route': ctx.pagePath,\n          },\n        },\n        () => fn(runInstantInsightsSpan)\n      )\n  )\n}\n\n/**\n * The inputs to use for dev validation.\n * If an input needs additional rendering work (because it couldn't be\n * reused from the main render), it'll be an async function that produces\n * the actual input, which lets the consumer consume these lazily and/or\n * control when they are evaluated.\n * */\ntype PrepareValidationInputsResult = {\n  /** `null` if Instant Validation isn't enabled for a route */\n  readonly instantInputs: null | DevValidationInputs | LazyDevValidationInputs\n  readonly staticInputs: DevValidationInputs | LazyDevValidationInputs\n}\n\n/**\n * A lazily evaluated render that will produce validation inputs.\n * If it encounters sync IO or another error, it'll resolve to a sentinel\n * `VALIDATION_BAILOUT` value instead.\n */\ntype LazyDevValidationInputs = MemoizedThunk<\n  Promise<DevValidationInputs | ValidationBailout>\n>\n\nconst VALIDATION_BAILOUT = Symbol('VALIDATION_BAILOUT')\ntype ValidationBailout = typeof VALIDATION_BAILOUT\n\nfunction createLazyDevValidationInputs(\n  create: () => Promise<DevValidationInputs | ValidationBailout>\n): LazyDevValidationInputs {\n  return createMemoizedThunk(create)\n}\n\n/** A lazily evaluated value. Only runs once even when called multiple times. */\ntype MemoizedThunk<T> = (() => T) & { MemoizedOnce: never }\n\nfunction createMemoizedThunk<T>(cb: () => T): MemoizedThunk<T> {\n  let cache: null | { value: T } = null\n  const wrapped = (): T => {\n    if (cache === null) {\n      cache = { value: cb() }\n    }\n    return cache.value\n  }\n  return wrapped as MemoizedThunk<T>\n}\n\nasync function prepareValidationInputs(\n  prefetchMode: PrefetchingMode,\n  navigationKind: DevNavigationKind,\n  result: StagedDevRenderResult,\n  requestStore: RequestStore,\n  validationDebugChannel: AnyStream | undefined,\n  ctx: AppRenderContext,\n  prerenderResumeDataCache: ReturnType<typeof createPrerenderResumeDataCache>,\n  createRequestStore: () => RequestStore,\n  getPayload: (requestStore: RequestStore) => Promise<RSCPayload>,\n  onError: (error: unknown) => void,\n  validationAbortSignal: AbortSignal\n): Promise<PrepareValidationInputsResult> {\n  // Check if we can re-use the main render for validation.\n  let inputsFromNavigation: ResolvedValidationInputs | null\n  if (!result.hadCacheMiss && !('syncInterruptReason' in result.outcome)) {\n    inputsFromNavigation = {\n      accumulatedChunks: result.outcome.accumulatedChunks,\n      startTime: result.outcome.startTime,\n      stageEndTimes: result.outcome.stageEndTimes,\n      requestStore,\n      debugChannelClient: validationDebugChannel,\n    }\n  } else {\n    // Cache miss or sync IO. We can't re-use the main render.\n    dropValidationDebugChannel(validationDebugChannel)\n    inputsFromNavigation = null\n  }\n\n  if (prefetchMode === PrefetchingMode.Partial) {\n    return prepareValidationInputsInPartialPrefetching(\n      navigationKind,\n      requestStore,\n      ctx,\n      prerenderResumeDataCache,\n      createRequestStore,\n      getPayload,\n      onError,\n      inputsFromNavigation,\n      validationAbortSignal\n    )\n  } else {\n    return prepareValidationInputsInLegacyPrefetching(\n      ctx,\n      prerenderResumeDataCache,\n      createRequestStore,\n      getPayload,\n      onError,\n      inputsFromNavigation,\n      validationAbortSignal\n    )\n  }\n}\n\nasync function prepareValidationInputsInPartialPrefetching(\n  navigationKind: DevNavigationKind,\n  requestStore: RequestStore,\n  ctx: AppRenderContext,\n  prerenderResumeDataCache: ReturnType<typeof createPrerenderResumeDataCache>,\n  createRequestStore: () => RequestStore,\n  getPayload: (requestStore: RequestStore) => Promise<RSCPayload>,\n  onError: (error: unknown) => void,\n  inputsFromNavigation: ResolvedValidationInputs | null,\n  validationAbortSignal: AbortSignal\n): Promise<PrepareValidationInputsResult> {\n  const loaderTree = ctx.componentMod.routeModule.userland.loaderTree\n  const needsInstantValidation =\n    await anySegmentNeedsInstantValidationInDev(loaderTree)\n\n  // If we have static params that aren't root params, then the static stages are incompatible\n  // between the Static shell and the App Shell, and we can't use the same render for both.\n  const areStagesCompatible = !hasNonRootStaticParams(\n    ctx.interpolatedParams,\n    requestStore.rootParams,\n    requestStore.fallbackParams\n  )\n\n  const LAZY_FULL_RENDER = createLazyDevValidationInputs(async () => {\n    const shouldRenderWithAppShell = true\n    const prefetchMode = PrefetchingMode.Partial\n    const inputs = await renderWithWarmCachesForValidationInDev(\n      ctx,\n      createRequestStore,\n      getPayload,\n      onError,\n      prerenderResumeDataCache,\n      prefetchMode,\n      shouldRenderWithAppShell,\n      validationAbortSignal\n    )\n    if (forwardErrorsFromWarmRender(inputs, ctx)) {\n      return VALIDATION_BAILOUT\n    }\n    return inputs\n  })\n\n  const LAZY_RUNTIME_PRERENDER = createLazyDevValidationInputs(async () => {\n    const inputs = await prerenderWithWarmCachesForStaticValidationInDev(\n      ctx,\n      createRequestStore,\n      getPayload,\n      onError,\n      prerenderResumeDataCache,\n      validationAbortSignal\n    )\n    if (forwardErrorsFromWarmRender(inputs, ctx)) {\n      return VALIDATION_BAILOUT\n    }\n    return inputs\n  })\n\n  if (inputsFromNavigation) {\n    // We can reuse the main render for at least one of the validation passes.\n    if (areStagesCompatible) {\n      // Stages are compatible across the static shell and the app shell.\n      // We reuse the main render for both.\n      const instantInputs = needsInstantValidation ? inputsFromNavigation : null\n      const staticInputs = inputsFromNavigation\n      return { instantInputs, staticInputs }\n    }\n\n    // Stages are incompatible across static and instant validation.\n\n    // If this navigation has an accurate app shell, we can use it for instant validation.\n    // However, static validation can't use this static stage, so we need to prerender it.\n    if (navigationHasAppShell(navigationKind)) {\n      const instantInputs = needsInstantValidation ? inputsFromNavigation : null\n      const staticInputs = LAZY_RUNTIME_PRERENDER\n      return { instantInputs, staticInputs }\n    }\n\n    // This navigation does not have an accurate app shell, so if we need instant validation, we need to render again.\n    // However, this means that it has an accurate static shell, so we can skip prerendering it.\n    const instantInputs = needsInstantValidation ? LAZY_FULL_RENDER : null\n    const staticInputs = inputsFromNavigation\n    return { instantInputs, staticInputs }\n  }\n\n  // We cannot reuse the main navigation, and need to render again.\n  // If stages are compatible and we'll rerender for instant validation,\n  // we can reuse the result for static validation.\n  const instantInputs = needsInstantValidation ? LAZY_FULL_RENDER : null\n  const staticInputs =\n    areStagesCompatible && instantInputs !== null\n      ? instantInputs\n      : LAZY_RUNTIME_PRERENDER\n\n  return { instantInputs, staticInputs }\n}\n\nasync function prepareValidationInputsInLegacyPrefetching(\n  ctx: AppRenderContext,\n  prerenderResumeDataCache: ReturnType<typeof createPrerenderResumeDataCache>,\n  createRequestStore: () => RequestStore,\n  getPayload: (requestStore: RequestStore) => Promise<RSCPayload>,\n  onError: (error: unknown) => void,\n  inputsFromNavigation: ResolvedValidationInputs | null,\n  validationAbortSignal: AbortSignal\n): Promise<PrepareValidationInputsResult> {\n  const loaderTree = ctx.componentMod.routeModule.userland.loaderTree\n  const needsInstantValidation =\n    await anySegmentNeedsInstantValidationInDev(loaderTree)\n\n  // We're not in partialPrefetching, so we can use the same inputs for both\n  // instant validation and static shell validation.\n  if (inputsFromNavigation) {\n    // The main render is reusable.\n    const instantInputs = needsInstantValidation ? inputsFromNavigation : null\n    const staticInputs = inputsFromNavigation\n    return { instantInputs, staticInputs }\n  }\n\n  const LAZY_FULL_RENDER = createLazyDevValidationInputs(async () => {\n    const shouldRenderWithAppShell = false\n    const prefetchMode = PrefetchingMode.LegacySpeculative\n    const inputs = await renderWithWarmCachesForValidationInDev(\n      ctx,\n      createRequestStore,\n      getPayload,\n      onError,\n      prerenderResumeDataCache,\n      prefetchMode,\n      shouldRenderWithAppShell,\n      validationAbortSignal\n    )\n    if (forwardErrorsFromWarmRender(inputs, ctx)) {\n      return VALIDATION_BAILOUT\n    }\n    return inputs\n  })\n\n  const LAZY_RUNTIME_PRERENDER = createLazyDevValidationInputs(async () => {\n    const inputs = await prerenderWithWarmCachesForStaticValidationInDev(\n      ctx,\n      createRequestStore,\n      getPayload,\n      onError,\n      prerenderResumeDataCache,\n      validationAbortSignal\n    )\n    if (forwardErrorsFromWarmRender(inputs, ctx)) {\n      return VALIDATION_BAILOUT\n    }\n    return inputs\n  })\n\n  // If instant validation is needed, we need to perform a full rerender.\n  // Otherwise, a prerender is enough.\n  if (needsInstantValidation) {\n    const instantInputs = LAZY_FULL_RENDER\n    const staticInputs = instantInputs\n    return { instantInputs, staticInputs }\n  } else {\n    const instantInputs = null\n    const staticInputs = LAZY_RUNTIME_PRERENDER\n    return { instantInputs, staticInputs }\n  }\n}\n\nasync function resolveLazyDevValidationInputs(\n  resolvedOrLazyInputs: DevValidationInputs | LazyDevValidationInputs,\n  ctx: AppRenderContext\n): Promise<ResolvedValidationInputs | ValidationBailout> {\n  let inputs: DevValidationInputs\n  if (typeof resolvedOrLazyInputs === 'function') {\n    const maybeInputs = await resolvedOrLazyInputs()\n    if (maybeInputs === VALIDATION_BAILOUT) {\n      return maybeInputs\n    }\n    inputs = maybeInputs\n  } else {\n    inputs = resolvedOrLazyInputs\n  }\n\n  if ('syncInterruptReason' in inputs) {\n    await logMessagesAndSendErrorsToBrowser([inputs.syncInterruptReason], ctx)\n    return VALIDATION_BAILOUT\n  }\n  return inputs\n}\n\nfunction forwardErrorsFromWarmRender(\n  inputs: DevValidationInputs,\n  ctx: AppRenderContext\n) {\n  if ('syncInterruptReason' in inputs) {\n    void logMessagesAndSendErrorsToBrowser([inputs.syncInterruptReason], ctx)\n    return true\n  }\n\n  // Unlike the cold streamed render, which fills the caches, the warm\n  // render reads them back. Reading a `use cache` entry can surface an\n  // invalid dynamic usage error that filling can't (e.g. a nested\n  // dynamic `use cache` cache life that propagated to a parent with no\n  // explicit `cacheLife`). Forward it and skip validation.\n  if (\n    forwardInvalidDynamicUsageError(ctx.workStore.invalidDynamicUsageError, ctx)\n  ) {\n    return true\n  }\n  return false\n}\n\ninterface StagedDevRenderSetup {\n  readonly cacheSignal: CacheSignal\n  readonly prerenderResumeDataCache: ReturnType<\n    typeof createPrerenderResumeDataCache\n  >\n  readonly stageController: StagedRenderingController\n  readonly environmentName: () => string\n}\n\nexport enum PrefetchingMode {\n  LegacySpeculative = 1,\n  Partial = 2,\n}\n\nasync function getPrefetchingModeForPage(\n  renderOpts: Pick<RenderOpts, 'partialPrefetching'>,\n  loaderTree: LoaderTree\n): Promise<PrefetchingMode> {\n  const debug =\n    process.env.NEXT_PRIVATE_DEBUG_VALIDATION === '1' ? console.log : undefined\n\n  // TODO(app-shells): support \"unstable_eager\"\n  if (renderOpts.partialPrefetching) {\n    debug?.('using prefetching mode Partial because of next.config.js')\n    return PrefetchingMode.Partial\n  }\n  if (await anySegmentHasPartialPrefetchingEnabled(loaderTree)) {\n    debug?.('using prefetching mode Partial because of segment config')\n    return PrefetchingMode.Partial\n  }\n\n  debug?.('using prefetching mode LegacySpeculative')\n  return PrefetchingMode.LegacySpeculative\n}\n\nfunction getSyncIOMode(prefetchMode: PrefetchingMode): SyncIOMode {\n  switch (prefetchMode) {\n    case PrefetchingMode.LegacySpeculative:\n      return SyncIOMode.AllowedInRuntimeOrDynamic\n    case PrefetchingMode.Partial:\n      return SyncIOMode.AllowedInDynamic\n  }\n}\n\n/**\n * Per-render setup shared by the streaming dev Cache Components renders: a\n * cache signal (so caches fill in the background), a prerender resume data\n * cache, async API promises, and a staged rendering controller, all wired into\n * the request store.\n */\nfunction setUpStagedDevRender(\n  prefetchingMode: PrefetchingMode,\n  navigationKind: DevNavigationKind,\n  requestStore: RequestStore\n): StagedDevRenderSetup {\n  const shouldRenderWithAppShell = navigationHasAppShell(navigationKind)\n\n  const cacheSignal = new CacheSignal()\n  trackPendingModules(cacheSignal)\n  const prerenderResumeDataCache = createPrerenderResumeDataCache()\n  const stageController = new StagedRenderingController({\n    abortSignal: null,\n    abandonController: null,\n    syncIO: getSyncIOMode(prefetchingMode),\n    finalStage: null,\n  })\n  requestStore.resumeDataCache = prerenderResumeDataCache\n  requestStore.stagedRendering = stageController\n  requestStore.needsSessionShell = shouldRenderWithAppShell\n  requestStore.asyncApiPromises = createAsyncApiPromises(\n    stageController,\n    requestStore.cookies,\n    requestStore.mutableCookies,\n    requestStore.headers\n  )\n  requestStore.cacheSignal = cacheSignal\n\n  const environmentName = () =>\n    getEnvironmentNameForStage(stageController.currentStage)\n\n  return {\n    cacheSignal,\n    prerenderResumeDataCache,\n    stageController,\n    environmentName,\n  }\n}\n\nfunction getEnvironmentNameForStage(stage: RenderStage) {\n  switch (stage) {\n    case RenderStage.Before:\n    case RenderStage.ShellStatic:\n    case RenderStage.Static:\n      return 'Prerender'\n    case RenderStage.ShellRuntime:\n    case RenderStage.Runtime:\n      return 'Prefetch'\n    case RenderStage.Dynamic:\n    case RenderStage.Abandoned:\n      return 'Server'\n    default:\n      stage satisfies never\n      throw new InvariantError(`Invalid render stage: ${stage}`)\n  }\n}\n\n// The rendering context and reveal config that `stagedRenderWithCachesInDev`\n// forwards to `streamStagedRenderInDev`.\ninterface StagedDevRenderOptions {\n  prefetchMode: PrefetchingMode\n  ctx: AppRenderContext\n  requestStore: RequestStore\n  onError: (error: unknown) => void\n  navigationKind: DevNavigationKind\n  // This is defined only for foreground HMR requests. When it aborts, the\n  // staged render is torn down while its in-flight `'use cache'` fills keep\n  // running. Detached validation uses its per-document generation signal;\n  // `waitForResponseToFinish` handles response closure before it begins.\n  requestAbortSignal: AbortSignal | undefined\n}\n\ntype DevNavigationKind =\n  | { type: 'initial-load' }\n  | { type: 'prefetched-client'; prefetchStage: StreamRevealStage }\n\ntype StreamRevealStage =\n  | RenderStage.Static\n  | RenderStage.ShellRuntime\n  | RenderStage.Runtime\n\nfunction navigationHasAppShell(navigationKind: DevNavigationKind): boolean {\n  // TODO(app-shells): when we implement `<Link prefetch={true}>/`prefetch = \"unstable_eager\"` in dev,\n  // this might need to be adjusted, because we'll use `Runtime` for the stage\n  return (\n    navigationKind.type === 'prefetched-client' &&\n    navigationKind.prefetchStage === RenderStage.ShellRuntime\n  )\n}\n\ninterface StreamStagedRenderInDevOptions extends StagedDevRenderOptions {\n  rscPayload: RSCPayload\n  stageController: StagedRenderingController\n  cacheSignal: CacheSignal\n  environmentName: () => string\n  debugChannel: NodeDebugChannelPair | undefined\n}\n\n/**\n * Streams a staged dev render to completion without ever abandoning it, so it\n * streams progressively and fills caches as a side effect. Resolves as soon as\n * the first task creates the stream, handing back the response `stream` and a\n * `result` promise. The `result` settles once the full stream has finished, and\n * reports whether any stage boundary still had pending cache reads (a cold load\n * that streamed Suspense fallbacks for not-yet-cached content), the stage\n * timings, and the accumulated chunks.\n *\n * The chunks are accumulated eagerly because detecting completion requires\n * reading the whole stream anyway; the same accumulation feeds validation when\n * the render turns out to be prod-representative.\n */\nasync function streamStagedRenderInDev({\n  ctx,\n  requestStore,\n  rscPayload,\n  stageController,\n  cacheSignal,\n  environmentName,\n  onError,\n  debugChannel,\n  navigationKind,\n  requestAbortSignal,\n}: StreamStagedRenderInDevOptions): Promise<{\n  stream: Readable\n  resultPromise: Promise<StagedDevRenderResult>\n}> {\n  let holdStreamUntilRevealed: boolean\n  let revealAfterStage: StreamRevealStage\n  switch (navigationKind.type) {\n    case 'initial-load': {\n      // Hold the stream until the shell content has flushed so the\n      // streamed HTML reflects the prerendered HTML shell\n      holdStreamUntilRevealed = true\n      revealAfterStage = RenderStage.Static\n      break\n    }\n    case 'prefetched-client': {\n      // This stream goes to the browser, which gates revealing the response on\n      // the payload's `_revealAfter`, so release it live and let the browser\n      // process chunks as they arrive instead of holding it server-side.\n      holdStreamUntilRevealed = false\n      revealAfterStage = navigationKind.prefetchStage\n      break\n    }\n  }\n\n  const { ComponentMod } = ctx.renderOpts\n  const { clientModules } = getClientReferenceManifest()\n\n  // The first task creates the stream; `streamReady` carries it (and its chunk\n  // accumulation) out of that task into the function body below.\n  const streamReady = createPromiseWithResolvers<{\n    stream: Readable\n    accumulatedChunksPromise: Promise<AccumulatedStreamChunks>\n  }>()\n\n  // `revealAfter` resolves once the `revealAfterStage` content has flushed (or\n  // earlier on a cache miss). When streaming live (a client navigation), it's\n  // surfaced through the Flight payload as `_revealAfter`: the client decodes\n  // it and defers resolving the response's deferred RSCs on it (see\n  // `ppr-navigations`), so a Suspense boundary's children aren't revealed\n  // before their row has been decoded, which would flush a premature fallback.\n  // React serializes the promise as a pending row whose resolution row is\n  // emitted only when we resolve it here, and that row follows the children's\n  // row in the payload, so the children are already decoded by the time the\n  // client unblocks. The HTML (Fizz) render can't gate like this, so we don't\n  // surface the promise on its payload and instead hold the whole stream on\n  // `revealAfter` for it (see `holdStreamUntilRevealed` below).\n  const revealAfter = createPromiseWithResolvers<void>()\n  if (!holdStreamUntilRevealed) {\n    ;(rscPayload as InitialRSCPayload | NavigationFlightResponse)._revealAfter =\n      revealAfter.promise\n  }\n\n  let startTime = -Infinity\n\n  // Whether any stage boundary still had pending cache reads (or modules): i.e.\n  // the caches weren't filled yet and the render streamed Suspense fallbacks\n  // for content that would be cached in production.\n  let hadCacheMiss = false\n\n  // Whether the cold-cache status has already been reported for this render. It\n  // is reported at most once, and only for a read that's still pending while a\n  // shell stage is flushing (see `checkForCacheMiss`).\n  let reportedColdCache = false\n\n  // Runs at each stage boundary. Latches the running cache-miss verdict and\n  // returns it, so a boundary can reveal the shell as soon as a miss is seen\n  // (and so dev validation can later tell whether the streamed render is\n  // prod-representative). The first miss seen while a shell stage is still\n  // flushing also reports the cold-cache status.\n  const checkForCacheMiss = () => {\n    if (cacheSignal.hasPendingReads()) {\n      hadCacheMiss = true\n\n      // The cold-cache indicator reflects the shell only. A cache read still\n      // pending while a shell stage flushes (`currentStage <=\n      // revealAfterStage`, using the ordered `RenderStage` values) is part of\n      // the shell that production serves instantly, so a cold cache there is\n      // worth surfacing and we show the indicator. A cache miss after the shell\n      // stage is runtime or dynamic content that production reads/fills during\n      // the resume at runtime, so a cold cache there is expected and must not\n      // show the indicator.\n      if (\n        !reportedColdCache &&\n        stageController.currentStage <= revealAfterStage\n      ) {\n        // First in-shell cache miss this render: tell the dev overlay we're\n        // streaming with a cold cache now. The per-load `'ready'` reset clears\n        // it again on the next load.\n        ctx.renderOpts.setCacheStatus?.('cold', ctx.htmlRequestId)\n        reportedColdCache = true\n      }\n    }\n    return hadCacheMiss\n  }\n\n  const checkCacheMissAndAdvance = (stage: AdvanceableRenderStage) => {\n    if (checkForCacheMiss()) {\n      revealAfter.resolve()\n    }\n    stageController.advanceStage(stage)\n  }\n\n  const checkReveal = (stage: AdvanceableRenderStage) => {\n    if (checkForCacheMiss() || revealAfterStage === stage) {\n      revealAfter.resolve()\n    }\n  }\n\n  const stagesAdvanced = runInSequentialTasks(\n    () => {\n      stageController.advanceStage(RenderStage.ShellStatic)\n      startTime = performance.now() + performance.timeOrigin\n\n      const replayable = new ReplayableNodeStream(\n        workUnitAsyncStorage.run(\n          requestStore,\n          renderToNodeFlightStream,\n          ComponentMod,\n          rscPayload,\n          clientModules,\n          {\n            onError,\n            environmentName,\n            startTime,\n            filterStackFrame,\n            debugChannel: debugChannel?.serverSide,\n            signal: requestAbortSignal,\n          }\n        ) as Readable\n      )\n\n      streamReady.resolve({\n        stream: replayable.createReplayStream(),\n        accumulatedChunksPromise: accumulateStreamChunks(\n          replayable.createReplayStream(),\n          stageController,\n          // Abort accumulation as soon as the signal aborts instead of waiting\n          // for the stream to close.\n          requestAbortSignal ?? null\n        ),\n      })\n    },\n    () => checkCacheMissAndAdvance(RenderStage.Static),\n    () => checkReveal(RenderStage.Static),\n\n    () => checkCacheMissAndAdvance(RenderStage.ShellRuntime),\n    () => checkReveal(RenderStage.ShellRuntime),\n\n    () => checkCacheMissAndAdvance(RenderStage.Runtime),\n    () => checkReveal(RenderStage.Runtime),\n\n    () => {\n      // Advance to the dynamic stage even while caches are still filling, so\n      // dynamic content streams to the browser right away instead of being\n      // withheld until the slowest cache fill completes. Streaming that content\n      // promptly is the whole point of the streaming dev render.\n      //\n      // The tradeoff is that dev no longer detects a `'use cache'` deadlock: a\n      // cache whose fill depends on Dynamic-stage IO used to be held here until\n      // it hit the fill timeout, but advancing now unblocks that IO so the\n      // cache fills instead. That detection only served to debug a build-time\n      // deadlock from within dev, and the streaming render no longer blocks the\n      // page on the fill, so we accept losing it here.\n      // TODO: Surface `'use cache'` deadlocks at build time instead, e.g. via\n      // `next build --debug-prerender`, so they can still be diagnosed.\n      stageController.advanceStage(RenderStage.Dynamic)\n    }\n  )\n\n  // If a task throws before the stream is created, surface it to the awaiter\n  // below via `streamReady`. Resolve (not reject) `revealAfter` so the client\n  // consumers that gate on the payload's `_revealAfter` unblock rather than\n  // seeing a rejection; the actual error still surfaces through the stream.\n  stagesAdvanced.catch((err) => {\n    streamReady.reject(err)\n    revealAfter.resolve()\n  })\n\n  const { stream, accumulatedChunksPromise } = await streamReady.promise\n\n  // For the HTML (Fizz) render, hold the stream until the shell-stage content\n  // has flushed (or until a cache miss reveals early) so the HTML reflects the\n  // prerendered shell that production streams rather than a premature fallback.\n  // The `_revealAfter` gate is client-side and doesn't apply to this render,\n  // which consumes the payload directly and would otherwise stream a boundary's\n  // fallback before its content arrived. A client navigation doesn't need the\n  // hold: it gates revealing the response on `_revealAfter` (whose resolution\n  // row follows the children's row in the stream), so we release the stream to\n  // it live and let the browser process chunks as they arrive instead of\n  // holding it server-side.\n  if (holdStreamUntilRevealed) {\n    await revealAfter.promise\n  }\n\n  // Advancing the stages only drives the pipeline forward; the render isn't\n  // actually complete until its stream has fully finished. The accumulation\n  // resolves at that point, so the result is read only once both it and the\n  // stages have settled (a late `syncInterruptReason` or\n  // `invalidDynamicUsageError` isn't final until the last stage has streamed).\n  const resultPromise = Promise.all([\n    stagesAdvanced,\n    accumulatedChunksPromise,\n  ]).then(([, accumulatedChunks]): StagedDevRenderResult => {\n    const syncInterruptReason = stageController.getSyncInterruptReason()\n    return {\n      hadCacheMiss,\n      outcome: syncInterruptReason\n        ? { syncInterruptReason }\n        : {\n            startTime,\n            stageEndTimes: getStageEndTimes(stageController),\n            accumulatedChunks,\n          },\n    }\n  })\n\n  return { stream, resultPromise }\n}\n\nfunction getStageEndTimes(\n  stageController: StagedRenderingController\n): StageEndTimes {\n  return {\n    [RenderStage.Static]: stageController.getStageEndTime(RenderStage.Static),\n    [RenderStage.ShellRuntime]: stageController.getStageEndTime(\n      RenderStage.ShellRuntime\n    ),\n    [RenderStage.Runtime]: stageController.getStageEndTime(RenderStage.Runtime),\n  }\n}\n\nasync function renderWithWarmCachesForValidationInDev(\n  ctx: AppRenderContext,\n  createRequestStore: () => RequestStore,\n  getPayload: (requestStore: RequestStore) => Promise<RSCPayload>,\n  onError: (error: unknown) => void,\n  prerenderResumeDataCache: ReturnType<typeof createPrerenderResumeDataCache>,\n  prefetchMode: PrefetchingMode,\n  shouldRenderWithAppShell: boolean,\n  validationAbortSignal: AbortSignal\n): Promise<DevValidationInputs> {\n  const { ComponentMod, setReactDebugChannel } = ctx.renderOpts\n  const { clientModules } = getClientReferenceManifest()\n\n  const stageController = new StagedRenderingController({\n    abortSignal: null,\n    abandonController: null,\n    syncIO: getSyncIOMode(prefetchMode),\n    finalStage: null,\n  })\n\n  const requestStore = createRequestStore()\n  requestStore.resumeDataCache = createRenderResumeDataCache(\n    prerenderResumeDataCache\n  )\n  requestStore.stagedRendering = stageController\n  requestStore.needsSessionShell = shouldRenderWithAppShell\n  requestStore.cacheSignal = null\n  requestStore.asyncApiPromises = createAsyncApiPromises(\n    stageController,\n    requestStore.cookies,\n    requestStore.mutableCookies,\n    requestStore.headers\n  )\n\n  const debugChannel = setReactDebugChannel && createNodeDebugChannel()\n  const environmentName = () =>\n    getEnvironmentNameForStage(stageController.currentStage)\n\n  const rscPayload = await getPayload(requestStore)\n\n  let startTime = -Infinity\n  const accumulatedChunks = await runInSequentialTasks(\n    () => {\n      stageController.advanceStage(RenderStage.ShellStatic)\n      startTime = performance.now() + performance.timeOrigin\n\n      const sourceStream = workUnitAsyncStorage.run(\n        requestStore,\n        renderToNodeFlightStream,\n        ComponentMod,\n        rscPayload,\n        clientModules,\n        {\n          onError,\n          environmentName,\n          startTime,\n          filterStackFrame,\n          debugChannel: debugChannel?.serverSide,\n          signal: validationAbortSignal,\n        }\n      ) as Readable\n\n      return accumulateStreamChunks(\n        sourceStream,\n        stageController,\n        validationAbortSignal\n      )\n    },\n    () => stageController.advanceStage(RenderStage.Static),\n    () => stageController.advanceStage(RenderStage.ShellRuntime),\n    () => stageController.advanceStage(RenderStage.Runtime),\n    () => stageController.advanceStage(RenderStage.Dynamic)\n  )\n\n  const syncInterruptReason = stageController.getSyncInterruptReason()\n  if (syncInterruptReason) {\n    // Sync IO interrupted the render, so it won't be validated. Drop the debug\n    // channel now and return only the interrupt reason: nothing downstream\n    // reads the request store or chunks of an interrupted render.\n    dropValidationDebugChannel(debugChannel?.clientSide.readable)\n    return { syncInterruptReason }\n  }\n\n  return {\n    accumulatedChunks,\n    startTime,\n    stageEndTimes: getStageEndTimes(stageController),\n    requestStore,\n    debugChannelClient: debugChannel?.clientSide.readable,\n  }\n}\n\ninterface StagedRenderWithCachesInDevOptions extends StagedDevRenderOptions {\n  createRequestStore: () => RequestStore\n  getPayload: (requestStore: RequestStore) => Promise<RSCPayload>\n  shouldValidate: boolean\n  fallbackRouteParams: OpaqueFallbackRouteParams | null\n  getDevRenderDidError: () => boolean\n}\n\nasync function prerenderWithWarmCachesForStaticValidationInDev(\n  ctx: AppRenderContext,\n  createRequestStore: () => RequestStore,\n  getPayload: (requestStore: RequestStore) => Promise<RSCPayload>,\n  onError: (error: unknown) => void,\n  prerenderResumeDataCache: ReturnType<typeof createPrerenderResumeDataCache>,\n  validationAbortSignal: AbortSignal\n): Promise<DevValidationInputs> {\n  // This function is currently only used in partialPrefetching.\n  const prefetchMode = PrefetchingMode.Partial\n\n  const { ComponentMod, setReactDebugChannel } = ctx.renderOpts\n  const { clientModules } = getClientReferenceManifest()\n\n  // This render is for validation only, and won't be shown to the user,\n  // so we're only rendering until the runtime stage\n  // (we need static chunks and runtime chunks for discriminated errors)\n  const finalReactController = new AbortController()\n  const finalDataController = new AbortController()\n\n  abortWhenSignalAborts(validationAbortSignal, finalReactController)\n\n  const stageController = new StagedRenderingController({\n    abortSignal: finalDataController.signal,\n    abandonController: null,\n    syncIO: getSyncIOMode(prefetchMode),\n    finalStage: RenderStage.Runtime,\n  })\n\n  const requestStore = createRequestStore()\n  requestStore.resumeDataCache = createRenderResumeDataCache(\n    prerenderResumeDataCache\n  )\n  requestStore.stagedRendering = stageController\n  requestStore.needsSessionShell = false\n  requestStore.cacheSignal = null\n  requestStore.asyncApiPromises = createAsyncApiPromises(\n    stageController,\n    requestStore.cookies,\n    requestStore.mutableCookies,\n    requestStore.headers\n  )\n\n  // We abort upon reaching the runtime stage or on Sync IO.\n  // If sync IO occurs in a place where it's not allowed, then we have to fail validation,\n  // and we can abort the render immediately, without waiting for anything else..\n  requestStore.controller = finalReactController\n  requestStore.renderSignal = finalDataController.signal\n\n  const debugChannel = setReactDebugChannel && createNodeDebugChannel()\n  const environmentName = () =>\n    getEnvironmentNameForStage(stageController.currentStage)\n\n  const rscPayload = await getPayload(requestStore)\n\n  let startTime = -Infinity\n  const collectedChunksByStage = createStageChunksAccumulator()\n\n  const collectChunk = (chunk: Uint8Array) => {\n    // We abort the render before the dynamic stage.\n    // If we aborted, save the errored chunks as if they were emitted\n    // in the dynamic stage so that we can late-release them for debug info.\n    const stage = finalReactController.signal.aborted\n      ? RenderStage.Dynamic\n      : stageController.currentStage\n    collectStageChunk(collectedChunksByStage, stage, chunk)\n  }\n\n  await runInSequentialTasks(\n    async () => {\n      stageController.advanceStage(RenderStage.ShellStatic)\n      startTime = performance.now() + performance.timeOrigin\n\n      const sourceStream = workUnitAsyncStorage.run(\n        requestStore,\n        renderToNodeFlightStream,\n        ComponentMod,\n        rscPayload,\n        clientModules,\n        {\n          onError,\n          environmentName,\n          startTime,\n          filterStackFrame,\n          debugChannel: debugChannel?.serverSide,\n        }\n      ) as Readable\n\n      // Only reject hanging promises after react finished aborting.\n      abortWhenSignalAborts(finalReactController.signal, finalDataController)\n\n      // Note: this await will only resolve after the last task (unless sync IO aborts the render earlier)\n      await iterateStreamingPrerenderChunks(\n        sourceStream,\n        finalReactController.signal,\n        collectChunk\n      )\n    },\n    () => stageController.advanceStage(RenderStage.Static),\n    () => stageController.advanceStage(RenderStage.ShellRuntime),\n    () => stageController.advanceStage(RenderStage.Runtime),\n    () => {\n      // Do not advance to the dynamic stage, abort instead.\n      abortInRenderContext(requestStore, finalReactController)\n    }\n  )\n\n  const syncInterruptReason = stageController.getSyncInterruptReason()\n  if (syncInterruptReason) {\n    // Sync IO interrupted the render, so it won't be validated. Drop the debug\n    // channel now and return only the interrupt reason: nothing downstream\n    // reads the request store or chunks of an interrupted render.\n    dropValidationDebugChannel(debugChannel?.clientSide.readable)\n    return { syncInterruptReason }\n  }\n  return {\n    accumulatedChunks: collectedChunksByStage,\n    startTime,\n    stageEndTimes: getStageEndTimes(stageController),\n    requestStore,\n    debugChannelClient: debugChannel?.clientSide.readable,\n  }\n}\n\n/** When the source signal aborts, abort the controller with its reason. */\nfunction abortWhenSignalAborts(\n  signal: AbortSignal,\n  controller: AbortController\n) {\n  if (signal.aborted) {\n    controller.abort(signal.reason)\n    return\n  }\n  signal.addEventListener(\n    'abort',\n    () => controller.abort(signal.reason),\n    ABORT_ONCE\n  )\n}\n\nconst ABORT_ONCE = { once: true }\n\n/** Make sure that any userspace code that might run during abort has access\n * to the workUnitStore that it was rendered in.\n * This is mostly relevant to Fizz where a component suspended on a hanging use()\n * might get rerendered during an abort for debug info reasons, but we defensively\n * also do it in Flight just in case.\n * x-ref: https://github.com/vercel/next.js/pull/94436\n * */\nfunction abortInRenderContext(\n  workUnitStore: WorkUnitStore,\n  controller: AbortController,\n  reason?: unknown\n): void {\n  if (controller.signal.aborted) {\n    return\n  }\n  workUnitAsyncStorage.run(\n    workUnitStore,\n    reason\n      ? controller.abort.bind(controller, reason)\n      : controller.abort.bind(controller)\n  )\n}\n\n/**\n * Sets up and streams a dev Cache Components render. Streams immediately and\n * fills caches as a side effect, then runs a background follow-up once the\n * render finishes. When `shouldValidate`, it spawns Cache Components validation\n * (against the streamed render directly when it's prod-representative,\n * otherwise against a separate warm-cache render); otherwise it just forwards\n * any recorded invalid dynamic usage error to the dev overlay.\n */\nasync function stagedRenderWithCachesInDev({\n  prefetchMode,\n  ctx,\n  requestStore,\n  createRequestStore,\n  getPayload,\n  onError,\n  shouldValidate,\n  fallbackRouteParams,\n  getDevRenderDidError,\n  navigationKind,\n  requestAbortSignal,\n}: StagedRenderWithCachesInDevOptions): Promise<{\n  stream: Readable\n  debugChannel: NodeDebugChannelPair | undefined\n}> {\n  const validationGeneration = shouldValidate\n    ? beginDevValidation(ctx.htmlRequestId)\n    : undefined\n\n  try {\n    const { setReactDebugChannel } = ctx.renderOpts\n\n    const {\n      cacheSignal,\n      prerenderResumeDataCache,\n      stageController,\n      environmentName,\n    } = setUpStagedDevRender(prefetchMode, navigationKind, requestStore)\n\n    let validationDebugChannel: AnyStream | undefined\n    const debugChannel = setReactDebugChannel && createNodeDebugChannel()\n    if (validationGeneration !== undefined && debugChannel) {\n      const debugChannelReplay = new ReplayableNodeStream(\n        debugChannel.clientSide.readable\n      )\n      debugChannel.clientSide.readable = debugChannelReplay.createReplayStream()\n      validationDebugChannel = debugChannelReplay.createReplayStream()\n    }\n\n    // The stage controller starts in the `Before` stage, where sync IO doesn't\n    // abort, so it's fine if it happens while creating the payload.\n    const rscPayload = await getPayload(requestStore)\n\n    const { stream, resultPromise } = await streamStagedRenderInDev({\n      prefetchMode,\n      ctx,\n      requestStore,\n      rscPayload,\n      stageController,\n      cacheSignal,\n      environmentName,\n      onError,\n      debugChannel,\n      navigationKind,\n      requestAbortSignal,\n    })\n\n    if (validationGeneration === undefined) {\n      logValidationSkipped(ctx)\n    }\n\n    // The render may record an invalid dynamic usage error (e.g. a request API\n    // used inside `'use cache'`). A cache-miss render records it while filling,\n    // so the verdict isn't final until the fills settle. Once the render has\n    // settled, forward any such error to the dev overlay: it's a real error\n    // from the render the user received, so it surfaces whether or not the\n    // route validates. When there is one the render isn't prod-representative,\n    // so validating it is pointless and we skip it; otherwise validation runs\n    // in the background (deferred there until the response has finished).\n    void resultPromise.then(\n      async (result) => {\n        if (result.hadCacheMiss) {\n          await cacheSignal.cacheReady()\n        }\n\n        const hadInvalidDynamicUsage = forwardInvalidDynamicUsageError(\n          ctx.workStore.invalidDynamicUsageError,\n          ctx\n        )\n\n        if (validationGeneration === undefined) {\n          return\n        }\n\n        if (hadInvalidDynamicUsage || validationGeneration.signal.aborted) {\n          if (validationGeneration.signal.aborted) {\n            logValidationAborted(ctx)\n          }\n          validationGeneration.finish()\n          return\n        }\n\n        runDevValidationInBackground(\n          prefetchMode,\n          navigationKind,\n          result,\n          requestStore,\n          validationDebugChannel,\n          ctx,\n          fallbackRouteParams,\n          prerenderResumeDataCache,\n          getDevRenderDidError,\n          createRequestStore,\n          getPayload,\n          onError,\n          validationGeneration\n        )\n      },\n      () => {\n        // The render itself rejected; there's nothing to forward or validate.\n        validationGeneration?.finish()\n      }\n    )\n\n    return { stream, debugChannel }\n  } catch (err) {\n    validationGeneration?.finish()\n    throw err\n  }\n}\n\ninterface AccumulatedStreamChunks {\n  readonly shellStaticChunks: Array<Uint8Array>\n  readonly staticChunks: Array<Uint8Array>\n  readonly shellRuntimeChunks: Array<Uint8Array>\n  readonly runtimeChunks: Array<Uint8Array>\n  readonly dynamicChunks: Array<Uint8Array>\n}\n\nfunction createStageChunksAccumulator(): AccumulatedStreamChunks {\n  return {\n    shellStaticChunks: [],\n    staticChunks: [],\n    shellRuntimeChunks: [],\n    runtimeChunks: [],\n    dynamicChunks: [],\n  }\n}\n\nasync function accumulateStreamChunks(\n  stream: AnyStream,\n  stageController: StagedRenderingController,\n  signal: AbortSignal | null\n): Promise<AccumulatedStreamChunks> {\n  const accumulator = createStageChunksAccumulator()\n  await accumulateStreamChunksInto(accumulator, stream, stageController, signal)\n  return accumulator\n}\n\nasync function accumulateStreamChunksInto(\n  accumulator: AccumulatedStreamChunks,\n  stream: AnyStream,\n  stageController: StagedRenderingController,\n  signal: AbortSignal | null\n): Promise<void> {\n  if (stream instanceof ReadableStream) {\n    const reader = stream.getReader()\n\n    let cancelled = false\n    function cancel() {\n      if (!cancelled) {\n        cancelled = true\n        reader.cancel()\n      }\n    }\n\n    if (signal) {\n      signal.addEventListener('abort', cancel, { once: true })\n    }\n\n    try {\n      while (!cancelled) {\n        const { done, value } = await reader.read()\n        if (done || cancelled) {\n          cancel()\n          break\n        }\n        collectStageChunk(accumulator, stageController.currentStage, value)\n      }\n    } catch (err) {\n      // When we cancel the reader we may reject the read.\n      // Only swallow errors caused by our intentional cancel();\n      // re-throw unexpected errors to avoid silently returning partial data.\n      if (!cancelled) {\n        throw err\n      }\n    }\n  } else {\n    const nodeStream = stream as Readable\n    let cancelled = false\n    function cancel() {\n      if (!cancelled) {\n        cancelled = true\n        nodeStream.destroy()\n      }\n    }\n\n    if (signal) {\n      signal.addEventListener('abort', cancel, { once: true })\n    }\n\n    try {\n      for await (const value of nodeStream) {\n        if (cancelled) break\n        collectStageChunk(accumulator, stageController.currentStage, value)\n      }\n    } catch (err) {\n      if (!cancelled) {\n        throw err\n      }\n    }\n  }\n}\n\nfunction collectStageChunk(\n  accumulator: AccumulatedStreamChunks,\n  stage: RenderStage,\n  value: Uint8Array\n): void {\n  switch (stage) {\n    case RenderStage.Before:\n      throw new InvariantError('Unexpected stream chunk while in Before stage')\n    case RenderStage.ShellStatic:\n      accumulator.shellStaticChunks.push(value)\n    // fall through\n    case RenderStage.Static:\n      accumulator.staticChunks.push(value)\n    // fall through\n    case RenderStage.ShellRuntime:\n      accumulator.shellRuntimeChunks.push(value)\n    // fall through\n    case RenderStage.Runtime:\n      accumulator.runtimeChunks.push(value)\n    // fall through\n    case RenderStage.Dynamic:\n      accumulator.dynamicChunks.push(value)\n      break\n    case RenderStage.Abandoned:\n      break\n    default:\n      stage satisfies never\n      break\n  }\n}\n\nasync function countShellAndStaticStageBytes(\n  stream: Readable,\n  stageController: StagedRenderingController\n): Promise<\n  Pick<StageByteLengths, RenderStage.ShellStatic | RenderStage.Static>\n> {\n  const byteLengths = createStageByteLengths()\n\n  // Abort the signal whenever we advance to the stage after static.\n  const abortController = new AbortController()\n  const endStage = getNextStage(RenderStage.Static)\n  stageController.onStage(endStage, abortController.abort.bind(abortController))\n\n  await countStageBytesUntilAbortNode(\n    byteLengths,\n    stream,\n    stageController,\n    abortController.signal\n  )\n  return byteLengths\n}\n\ntype StageByteLengths = Record<AdvanceableRenderStage, number>\n\nfunction createStageByteLengths(): StageByteLengths {\n  const result: Partial<StageByteLengths> = {}\n  for (const stage of RENDER_STAGE_ADVANCE_ORDER) {\n    result[stage] = 0\n  }\n  return result as StageByteLengths\n}\n\nasync function countStageBytesUntilAbortNode(\n  byteLengths: StageByteLengths,\n  stream: Readable,\n  stageController: StagedRenderingController,\n  abortSignal: AbortSignal\n): Promise<void> {\n  let cancelled = false\n  abortSignal.addEventListener(\n    'abort',\n    () => {\n      cancelled = true\n      stream.destroy()\n    },\n    { once: true }\n  )\n\n  try {\n    for await (const value of stream) {\n      if (cancelled) break\n      increaseChunkByteLengths(\n        byteLengths,\n        stageController.currentStage,\n        (value as Uint8Array).byteLength\n      )\n    }\n  } catch (err) {\n    if (!cancelled) {\n      throw err\n    }\n  }\n}\n\nfunction increaseChunkByteLengths(\n  byteLengths: StageByteLengths,\n  currentStage: RenderStage,\n  length: number\n) {\n  if (!isAdvanceableRenderStage(currentStage)) {\n    return\n  }\n  // Later stages include earlier stages, so we increment\n  // the byte count for all that are `>= currentStage`.\n  // Iterate in reverse so we don't have to skip the earlier ones.\n  for (let i = RENDER_STAGE_ADVANCE_ORDER.length - 1; i >= 0; i--) {\n    const stage = RENDER_STAGE_ADVANCE_ORDER[i]\n    if (stage < currentStage) {\n      break\n    }\n    byteLengths[stage] += length\n  }\n}\n\nfunction createAsyncApiPromises(\n  stagedRendering: StagedRenderingController,\n  cookies: RequestStore['cookies'],\n  mutableCookies: RequestStore['mutableCookies'],\n  headers: RequestStore['headers']\n): NonNullable<RequestStore['asyncApiPromises']> {\n  // NOTE: Must be kept in sync with cookies.ts, headers.ts, params.ts, search-params.ts\n  const cookiesStage = RENDER_STAGES_BY_DATA_KIND.sessionData\n  const headersStage = RENDER_STAGES_BY_DATA_KIND.sessionData\n  const paramsStage = RENDER_STAGES_BY_DATA_KIND.runtimeLinkData\n  const searchParamsStage = RENDER_STAGES_BY_DATA_KIND.runtimeLinkData\n\n  return {\n    cookies: stagedRendering.delayUntilStage(cookiesStage, 'cookies', cookies),\n    mutableCookies: stagedRendering.delayUntilStage(\n      cookiesStage,\n      'cookies',\n      mutableCookies as RequestStore['cookies']\n    ),\n    headers: stagedRendering.delayUntilStage(headersStage, 'headers', headers),\n\n    // These are not used directly, but we chain other `params`/`searchParams` promises off of them.\n    sharedParamsParent: stagedRendering.delayUntilStage(\n      paramsStage,\n      undefined,\n      '<internal params>'\n    ),\n    sharedSearchParamsParent: stagedRendering.delayUntilStage(\n      searchParamsStage,\n      undefined,\n      '<internal searchParams>'\n    ),\n\n    connection: stagedRendering.delayUntilStage(\n      RenderStage.Dynamic,\n      'connection',\n      undefined\n    ),\n    io: stagedRendering.delayUntilStage(RenderStage.Dynamic, 'io', undefined),\n  }\n}\n\n/**\n * Logs the given messages, and sends the error instances to the browser as an\n * RSC stream, where they can be deserialized and logged (or otherwise presented\n * in the devtools), while leveraging React's capabilities to not only\n * source-map the stack frames (via findSourceMapURL), but also create virtual\n * server modules that allow users to inspect the server source code in the\n * browser.\n */\nasync function logMessagesAndSendErrorsToBrowser(\n  messages: unknown[],\n  ctx: AppRenderContext\n): Promise<void> {\n  const { htmlRequestId, renderOpts } = ctx\n  const { sendErrorsToBrowser } = renderOpts\n\n  const errors: Error[] = []\n  for (const message of messages) {\n    // Log the error to the CLI. Prevent the logs from being dimmed, which we\n    // apply for other logs during the spawned validation.\n    consoleAsyncStorage.exit(() => {\n      console.error(message)\n    })\n\n    // Error instances are also sent to the browser. We're currently using a\n    // non-Error message only in debug build mode as a message that is only\n    // meant for the CLI. FIXME: This is a bit spooky action at a distance. We\n    // should maybe have a more explicit way of determining which messages\n    // should be sent to the browser. Regardless, only real errors with a proper\n    // stack make sense to be \"replayed\" in the browser.\n    if (message instanceof Error) {\n      errors.push(message)\n    }\n  }\n\n  if (errors.length > 0) {\n    if (!sendErrorsToBrowser) {\n      throw new InvariantError(\n        'Expected `sendErrorsToBrowser` to be defined in renderOpts.'\n      )\n    }\n\n    // Build a Map of error → error code for errors that have one.\n    // React doesn't revive __NEXT_ERROR_CODE during RSC deserialization, so we\n    // send it as a side-channel Map. RSC preserves object identity, so the\n    // deserialized Map keys will reference the same Error objects.\n    const errorCodes = new Map<Error, string>()\n    for (const err of errors) {\n      const code = extractNextErrorCode(err)\n      if (code !== undefined) {\n        errorCodes.set(err, code)\n      }\n    }\n\n    const { clientModules } = getClientReferenceManifest()\n\n    let errorsFlightStream: AnyStream\n    if (process.env.__NEXT_USE_NODE_STREAMS) {\n      errorsFlightStream = renderToNodeFlightStream(\n        ctx.componentMod,\n        { errors, errorCodes },\n        clientModules,\n        { filterStackFrame }\n      )\n    } else {\n      errorsFlightStream = renderToWebFlightStream(\n        ctx.componentMod,\n        { errors, errorCodes },\n        clientModules,\n        { filterStackFrame }\n      )\n    }\n\n    sendErrorsToBrowser(errorsFlightStream, htmlRequestId)\n  }\n}\n\nfunction logValidationSkipped(ctx: AppRenderContext) {\n  if (process.env.__NEXT_TEST_MODE && process.env.NEXT_TEST_LOG_VALIDATION) {\n    const requestId = ctx.requestId\n    const url = ctx.url.href\n    console.log(\n      formatValidationEvent({ type: 'validation_start', requestId, url })\n    )\n    console.log(\n      formatValidationEvent({ type: 'validation_end', requestId, url })\n    )\n  }\n}\n\nfunction logValidationAborted(ctx: AppRenderContext) {\n  if (process.env.__NEXT_TEST_MODE && process.env.NEXT_TEST_LOG_VALIDATION) {\n    const requestId = ctx.requestId\n    const url = ctx.url.href\n    console.log(\n      formatValidationEvent({ type: 'validation_aborted', requestId, url })\n    )\n  }\n}\n\n/**\n * Runs a dev validation `run` callback (the render plus the error delivery),\n * enclosing it in the `validation_start` / `validation_end` /\n * `validation_aborted` lifecycle markers that E2E tests read from the CLI\n * output. The markers must enclose delivery as well as the render, so tests\n * that assert the error between the markers capture it. Also applies the\n * `NEXT_TEST_DEV_VALIDATION_DELAY_MS` hook that keeps validation in flight for\n * scheduler tests. All of this is test-mode only; otherwise `run` is invoked\n * directly.\n */\nasync function runWithDevValidationLogging(\n  ctx: AppRenderContext,\n  validationAbortSignal: AbortSignal,\n  run: () => Promise<void>\n): Promise<void> {\n  if (!(process.env.__NEXT_TEST_MODE && process.env.NEXT_TEST_LOG_VALIDATION)) {\n    return run()\n  }\n\n  const requestId = ctx.requestId\n  const url = ctx.url.href\n  const responseFinished =\n    !isNodeNextResponse(ctx.res) || ctx.res.originalResponse.writableFinished\n\n  console.log(\n    formatValidationEvent({\n      type: 'validation_start',\n      requestId,\n      url,\n      responseFinished,\n    })\n  )\n\n  try {\n    // Keep validation in flight for scheduler E2E tests without relying on\n    // timing-sensitive user code. Aborts end the delay immediately.\n    const validationDelay = Number(\n      process.env.NEXT_TEST_DEV_VALIDATION_DELAY_MS\n    )\n\n    if (\n      Number.isFinite(validationDelay) &&\n      validationDelay > 0 &&\n      !validationAbortSignal.aborted\n    ) {\n      await new Promise<void>((resolve) => {\n        let timeout: NodeJS.Timeout\n        const finishDelay = () => {\n          clearTimeout(timeout)\n          validationAbortSignal.removeEventListener('abort', finishDelay)\n          resolve()\n        }\n        timeout = setTimeout(finishDelay, validationDelay)\n        validationAbortSignal.addEventListener('abort', finishDelay, {\n          once: true,\n        })\n      })\n    }\n\n    if (!validationAbortSignal.aborted) {\n      await run()\n    }\n  } finally {\n    if (validationAbortSignal.aborted) {\n      logValidationAborted(ctx)\n    } else {\n      console.log(\n        formatValidationEvent({ type: 'validation_end', requestId, url })\n      )\n    }\n  }\n}\n\n/**\n * The slice of the render context the dev/build validation passes read. Both\n * the in-process callers and the validation worker build one of these, so it\n * names exactly what validation depends on and nothing else: no live\n * request/response objects that can't be rebuilt off the main thread.\n * `isDebugChannelEnabled` is the derived flag validation uses in place of the\n * main render's `setReactDebugChannel` callback (validation only ever read that\n * callback's presence as a boolean).\n */\nexport type ValidationRenderContext = Pick<\n  AppRenderContext,\n  | 'componentMod'\n  | 'getDynamicParamFromSegment'\n  | 'query'\n  | 'implicitTags'\n  | 'nonce'\n  | 'workStore'\n> & {\n  renderOpts: Pick<RenderOpts, 'images' | 'allowEmptyStaticShell'>\n  isDebugChannelEnabled: boolean\n}\n\n/**\n * Projects a full app render context down to the slice validation reads. The\n * in-process dev and build callers hold an `AppRenderContext` and use this to\n * hand validation exactly what it needs; the worker builds the same shape from\n * its snapshot instead.\n */\nexport function toValidationRenderContext(\n  ctx: AppRenderContext\n): ValidationRenderContext {\n  return {\n    componentMod: ctx.componentMod,\n    getDynamicParamFromSegment: ctx.getDynamicParamFromSegment,\n    query: ctx.query,\n    implicitTags: ctx.implicitTags,\n    nonce: ctx.nonce,\n    workStore: ctx.workStore,\n    renderOpts: {\n      images: ctx.renderOpts.images,\n      allowEmptyStaticShell: ctx.renderOpts.allowEmptyStaticShell,\n    },\n    isDebugChannelEnabled: !!ctx.renderOpts.setReactDebugChannel,\n  }\n}\n\n/**\n * Rebuilds the `WorkStore` the worker's dev validation runs under from the\n * transported snapshot, carrying only the fields the validation passes read.\n * `after()` callbacks are routed into a throwaway `AfterContext` whose hooks\n * no-op, because the validation render must not repeat those side effects, and\n * `after()` can't affect the rendered output.\n */\nfunction buildDevValidationWorkStore(\n  message: DevValidationWorkerMessage\n): WorkStore {\n  const { AfterContext } =\n    require('../after/after-context') as typeof import('../after/after-context')\n\n  const noopAfterContext = new AfterContext({\n    waitUntil(promise) {\n      promise.catch(() => {})\n    },\n    onClose() {},\n    onTaskError() {},\n  })\n\n  return {\n    isStaticGeneration: false,\n    page: message.page,\n    route: message.route,\n    forceStatic: message.forceStatic,\n    isDraftMode: message.request.isDraftMode,\n    useCacheTimeout: message.nextConfigSerializable.useCacheTimeout,\n    staticPageGenerationTimeout:\n      message.nextConfigSerializable.staticPageGenerationTimeout,\n    cacheLifeProfiles: message.nextConfigSerializable.cacheLifeProfiles,\n    buildId: message.buildId,\n    deploymentId: message.deploymentId,\n    requestStartTime: message.request.requestStartTime,\n    previouslyRevalidatedTags: [],\n    refreshTagsByCacheKind: new Map(),\n    runInCleanSnapshot: createSnapshot(),\n    shouldTrackFetchMetrics: false,\n    reactServerErrorsByDigest: new Map(),\n    afterContext: noopAfterContext,\n    // Dev validation only ever runs under Cache Components.\n    cacheComponentsEnabled: true,\n    validationLevel: message.validationLevel,\n  }\n}\n\n/**\n * Revives one serialized validation input into the in-memory shape\n * `runValidationInDev` consumes, binding it to the rebuilt request store.\n */\nfunction toDevValidationInputs(\n  serialized: SerializedValidationInputs,\n  requestStore: RequestStore\n): ResolvedValidationInputs {\n  return {\n    accumulatedChunks: serialized.accumulatedChunks,\n    startTime: serialized.startTime,\n    stageEndTimes: serialized.stageEndTimes,\n    requestStore,\n    debugChannelClient: serialized.debugChunks\n      ? createNodeStreamFromChunks(serialized.debugChunks)\n      : undefined,\n  }\n}\n\n/**\n * Worker entry point for Cached Components dev validation, reached from the\n * validation worker via `ComponentMod.routeModule.runValidationInDev`. The\n * worker reloads the route's compiled module and calls this so the entire\n * validation (Flight re-encodes and the client prerenders) runs inside the\n * app-page bundle's single React instance, alongside the user's client\n * components. It rebuilds the render context, work store, and request store\n * from the transported snapshot (the live objects can't cross a thread) and\n * returns the validation errors for the worker to serialize and the main thread\n * to deliver.\n */\nexport async function runValidationInDevFromSnapshot(\n  message: DevValidationWorkerMessage,\n  componentMod: AppPageModule,\n  abortSignal: AbortSignal\n): Promise<Array<unknown> | undefined> {\n  // Expose the reloaded route's bundler `require` / `loadChunk` on `globalThis`\n  // so `react-server-dom-*` can resolve client references during the validation\n  // prerenders, exactly as the main render does after loading its module.\n  if (componentMod.__next_app__) {\n    installGlobalModuleLoadingHandlers(componentMod, true, false)\n  }\n\n  // `requestFallbackRouteParams` reproduces `ctx.getDynamicParamFromSegment`\n  // exactly, so the depth-loop segment keys match the seed render's Flight.\n  // `fallbackRouteParams` is separate and only marks params unknown in the\n  // prerender stores.\n  //\n  // TODO: Those two fallback params sets are very confusing in the whole code\n  // base. We should maybe refactor this to make their different roles clearer.\n  const { requestFallbackRouteParams, fallbackRouteParams } = message\n\n  const getDynamicParamFromSegment = makeGetDynamicParamFromSegment(\n    message.interpolatedParams,\n    requestFallbackRouteParams,\n    message.optimisticRouting\n  )\n\n  const implicitTags: ImplicitTags = {\n    tags: message.implicitTags,\n    expirationsByCacheKind: new Map(),\n  }\n\n  const workStore = buildDevValidationWorkStore(message)\n\n  const ctx: ValidationRenderContext = {\n    componentMod,\n    getDynamicParamFromSegment,\n    query: message.query,\n    implicitTags,\n    nonce: message.nonce,\n    workStore,\n    renderOpts: {\n      images: message.renderOpts.images,\n      allowEmptyStaticShell: message.renderOpts.allowEmptyStaticShell,\n    },\n    isDebugChannelEnabled: message.isDebugChannelEnabled,\n  }\n\n  const requestStore = createRequestStoreFromInputs({\n    phase: 'render',\n    headers: new Headers(message.request.headers),\n    onUpdateCookies: undefined,\n    url: {\n      pathname: message.request.urlPathname,\n      search: message.request.urlSearch,\n    },\n    rootParams: message.request.rootParams,\n    implicitTags,\n    resumeDataCache: null,\n    previewProps: undefined,\n    isHmrRefresh: message.request.isHmrRefresh,\n    hmrRefreshHash: message.request.hmrRefreshHash,\n    serverComponentsHmrCache: undefined,\n    fallbackParams: requestFallbackRouteParams,\n  })\n\n  const staticInputs = toDevValidationInputs(message.staticInputs, requestStore)\n\n  const instantInputs = message.instantInputs\n    ? toDevValidationInputs(message.instantInputs, requestStore)\n    : null\n\n  return workAsyncStorage.run(\n    workStore,\n    runValidationInDev,\n    message.prefetchMode,\n    instantInputs,\n    staticInputs,\n    ctx,\n    fallbackRouteParams,\n    message.devRenderDidError,\n    abortSignal\n  )\n}\n\n/**\n * This function is a fork of prerenderToStream cacheComponents branch.\n * While it doesn't return a stream we want it to have identical\n * prerender semantics to prerenderToStream and should update it\n * in conjunction with any changes to that function.\n */\nasync function runValidationInDev(\n  prefetchMode: PrefetchingMode,\n  instantInputs: ResolvedValidationInputs | null,\n  staticInputs: ResolvedValidationInputs,\n  ctx: ValidationRenderContext,\n  fallbackRouteParams: OpaqueFallbackRouteParams | null,\n  devRenderDidError: boolean,\n  validationAbortSignal: AbortSignal\n): Promise<Array<unknown> | undefined> {\n  const { componentMod: ComponentMod, getDynamicParamFromSegment } = ctx\n  const loaderTree = ComponentMod.routeModule.userland.loaderTree\n  const rootParams = getRootParams(loaderTree, getDynamicParamFromSegment)\n\n  const needsInstantValidation =\n    await anySegmentNeedsInstantValidationInDev(loaderTree)\n\n  // `samples` from instant config are only used during build\n  const validationSamples = null\n  const validationSampleTracking = null\n\n  //================================\n  // Client module warmup\n  //================================\n  {\n    // For warmup, we have to use the shared inputs if present -- the static inputs\n    // may not have a proper dynamic stage.\n    const { runtimeChunks, dynamicChunks } = (instantInputs ?? staticInputs)\n      .accumulatedChunks\n\n    // First we warmup SSR with the runtime chunks. This ensures that when we do\n    // the full prerender pass with dynamic tracking module loading won't\n    // interrupt the prerender and can properly observe the entire content\n    await warmupClientModulesForStagedValidation(\n      // if we're going to be validating prefetches, we'll be rendering some segments in the dynamic stage.\n      // otherwise, for static shell validation, we only need to warm up to the runtime stage.\n      // we also need to use a different store type, because instant validation allows more APIs to resolve.\n      needsInstantValidation ? 'validation-client' : 'prerender-client',\n      needsInstantValidation ? dynamicChunks : runtimeChunks,\n      dynamicChunks,\n      rootParams,\n      fallbackRouteParams,\n      ctx,\n      validationSamples,\n      validationSampleTracking,\n      validationAbortSignal\n    )\n  }\n\n  // React renders used by validation can occupy an entire event-loop turn.\n  // Yield between them so a newer navigation can enter app rendering,\n  // supersede this validation, and avoid waiting for all remaining attempts.\n  if (!(await yieldToForegroundRequest(validationAbortSignal))) {\n    return\n  }\n\n  // instantInputs and staticInputs may be the same,\n  // so we have to make sure we only consume the debug channel once.\n  let cachedDebugChunks = new WeakMap<AnyStream, Uint8Array[]>()\n  const getDebugChunksOnce = async (\n    channel: AnyStream\n  ): Promise<Uint8Array[]> => {\n    let chunks = cachedDebugChunks.get(channel)\n    if (!chunks) {\n      cachedDebugChunks.set(\n        channel,\n        (chunks = await collectDebugChunksFromClientChannel(channel))\n      )\n    }\n    return chunks\n  }\n\n  //================================\n  // Static shell validation\n  //================================\n  {\n    // The request may have been aborted during the client module warmup above.\n    if (validationAbortSignal.aborted) {\n      return\n    }\n\n    const inputs = staticInputs\n\n    const debugChunks = inputs.debugChannelClient\n      ? await getDebugChunksOnce(inputs.debugChannelClient)\n      : null\n    const hmrRefreshHash = getHmrRefreshHash(inputs.requestStore)\n\n    const result = await validateStaticShell(\n      inputs,\n      ctx,\n      rootParams,\n      fallbackRouteParams,\n      debugChunks,\n      hmrRefreshHash,\n      validationAbortSignal\n    )\n    // A newer render superseded this validation while its render ran, so its\n    // result is stale. Don't surface errors for a page the user left.\n    if (validationAbortSignal.aborted) {\n      return\n    }\n    if (result.length > 0) {\n      if (!(await yieldToForegroundRequest(validationAbortSignal))) {\n        return\n      }\n      return result\n    }\n  }\n\n  //================================\n  // Instant validation\n  //================================\n  if (needsInstantValidation && instantInputs) {\n    if (!(await yieldToForegroundRequest(validationAbortSignal))) {\n      return\n    }\n\n    const inputs = instantInputs\n\n    const debugChunks = inputs.debugChannelClient\n      ? await getDebugChunksOnce(inputs.debugChannelClient)\n      : null\n    const hmrRefreshHash = getHmrRefreshHash(inputs.requestStore)\n\n    const result = await validateInstantConfigs(\n      prefetchMode,\n      inputs.accumulatedChunks,\n      debugChunks,\n      inputs.startTime,\n      inputs.stageEndTimes,\n      rootParams,\n      fallbackRouteParams,\n      ctx,\n      hmrRefreshHash,\n      validationSamples,\n      devRenderDidError,\n      validationAbortSignal\n    )\n\n    // A newer render superseded this work. Don't surface stale validation\n    // errors for a page the user left.\n    if (validationAbortSignal.aborted) {\n      return\n    }\n    if (result.length > 0) {\n      if (!(await yieldToForegroundRequest(validationAbortSignal))) {\n        return\n      }\n      return result\n    }\n  }\n}\n\nasync function collectDebugChunksFromClientChannel(debugChannel: AnyStream) {\n  const debugChunks: Uint8Array[] = []\n  for await (const c of debugChannel) {\n    debugChunks.push(c)\n  }\n  return debugChunks\n}\n\nasync function validateStaticShell(\n  inputs: ResolvedValidationInputs,\n  ctx: ValidationRenderContext,\n  rootParams: Params,\n  fallbackRouteParams: OpaqueFallbackRouteParams | null,\n  debugChunks: Uint8Array[] | null,\n  hmrRefreshHash: string | undefined,\n  validationAbortSignal: AbortSignal\n): Promise<unknown[]> {\n  const debug =\n    process.env.NEXT_PRIVATE_DEBUG_VALIDATION === '1' ? console.log : undefined\n\n  debug?.(`Starting static shell validation...`)\n\n  const { componentMod: ComponentMod, renderOpts } = ctx\n\n  const loaderTree = ComponentMod.routeModule.userland.loaderTree\n\n  const { accumulatedChunks, stageEndTimes } = inputs\n  const { staticChunks, runtimeChunks, dynamicChunks } = accumulatedChunks\n\n  const allowEmptyStaticShell =\n    (renderOpts.allowEmptyStaticShell ?? false) ||\n    (await isPageAllowedToBlock(loaderTree))\n\n  const runtimeResult = await validateStagedShell(\n    runtimeChunks,\n    dynamicChunks,\n    debugChunks,\n    stageEndTimes[RenderStage.Runtime],\n    rootParams,\n    fallbackRouteParams,\n    allowEmptyStaticShell,\n    ctx,\n    hmrRefreshHash,\n    trackDynamicHoleInRuntimeShell,\n    validationAbortSignal\n  )\n\n  if (runtimeResult.length > 0) {\n    debug?.(`❌ Failed - ${runtimeResult.length} errors from runtime stage`)\n    // We have something to report from the runtime validation\n    // We can skip the rest\n    return runtimeResult\n  }\n\n  if (!(await yieldToForegroundRequest(validationAbortSignal))) {\n    return []\n  }\n\n  const staticResult = await validateStagedShell(\n    staticChunks,\n    dynamicChunks,\n    debugChunks,\n    stageEndTimes[RenderStage.Static],\n    rootParams,\n    fallbackRouteParams,\n    allowEmptyStaticShell,\n    ctx,\n    hmrRefreshHash,\n    trackDynamicHoleInStaticShell,\n    validationAbortSignal\n  )\n\n  if (staticResult.length > 0) {\n    debug?.(`❌ Failed - ${staticResult.length} errors from static stage`)\n    // We have something to report from the static validation\n    // We can skip the rest\n    return staticResult\n  }\n  debug?.(`✅ Passed`)\n  return []\n}\n\nasync function warmupClientModulesForStagedValidation(\n  storeType: PrerenderStoreModernClient['type'] | ValidationStoreClient['type'],\n  partialServerChunks: Array<Uint8Array>,\n  allServerChunks: Array<Uint8Array>,\n  rootParams: Params,\n  fallbackRouteParams: OpaqueFallbackRouteParams | null,\n  ctx: ValidationRenderContext,\n  validationSamples: ValidationStoreClient['validationSamples'],\n  validationSampleTracking: ValidationStoreClient['validationSampleTracking'],\n  validationAbortSignal?: AbortSignal\n) {\n  const { implicitTags, nonce, workStore } = ctx\n\n  // Warmup SSR\n  const initialClientPrerenderController = new AbortController()\n  const initialClientReactController = new AbortController()\n  const initialClientRenderController = new AbortController()\n  const initialClientReactSignal =\n    validationAbortSignal === undefined\n      ? initialClientReactController.signal\n      : AbortSignal.any([\n          initialClientReactController.signal,\n          validationAbortSignal,\n        ])\n\n  const preinitScripts = () => {}\n  const { ServerInsertedHTMLProvider } = createServerInsertedHTML()\n\n  let initialClientPrerenderStore: PrerenderStore\n  if (storeType === 'prerender-client') {\n    const store: PrerenderStoreModernClient = {\n      type: 'prerender-client',\n      phase: 'render',\n      rootParams,\n      fallbackRouteParams,\n      implicitTags,\n      renderSignal: initialClientRenderController.signal,\n      controller: initialClientPrerenderController,\n      // For HTML Generation the only cache tracked activity\n      // is module loading, which has it's own cache signal\n      cacheSignal: null,\n      dynamicTracking: null,\n      revalidate: INFINITE_CACHE,\n      expire: INFINITE_CACHE,\n      stale: INFINITE_CACHE,\n      tags: [...implicitTags.tags],\n      // TODO should this be removed from client stores?\n      resumeDataCache: null,\n      hmrRefreshHash: undefined,\n      // Client prerenders don't track server param access\n      varyParamsAccumulator: null,\n    }\n    initialClientPrerenderStore = store\n  } else {\n    const store: ValidationStoreClient = {\n      type: 'validation-client',\n      phase: 'render',\n      rootParams,\n      implicitTags,\n      renderSignal: initialClientRenderController.signal,\n      controller: initialClientPrerenderController,\n      // For HTML Generation the only cache tracked activity\n      // is module loading, which has it's own cache signal\n      cacheSignal: null,\n      dynamicTracking: null,\n      revalidate: INFINITE_CACHE,\n      expire: INFINITE_CACHE,\n      stale: INFINITE_CACHE,\n      tags: [...implicitTags.tags],\n      // TODO should this be removed from client stores?\n      resumeDataCache: null,\n      hmrRefreshHash: undefined,\n      // Client prerenders don't track server param access\n      varyParamsAccumulator: null,\n      // We're not rendering any validation boundaries yet.\n      boundaryState: null,\n      validationSamples,\n      validationSampleTracking,\n      fallbackRouteParams,\n    }\n    initialClientPrerenderStore = store\n  }\n\n  // TODO: maybe conditionally switch between runtime chunks and all chunks?\n  // but warming too much should always be fine, just not always necessary\n  const serverStream = createNodeStreamWithLateRelease(\n    partialServerChunks,\n    allServerChunks,\n    initialClientReactSignal\n  )\n\n  const pendingInitialClientResult = workUnitAsyncStorage.run(\n    initialClientPrerenderStore,\n    getClientPrerender,\n    // eslint-disable-next-line @next/internal/no-ambiguous-jsx -- React Client\n    <App\n      reactServerStream={serverStream}\n      reactDebugStream={undefined}\n      debugEndTime={undefined}\n      preinitScripts={preinitScripts}\n      ServerInsertedHTMLProvider={ServerInsertedHTMLProvider}\n      nonce={nonce}\n      images={ctx.renderOpts.images}\n    />,\n    {\n      signal: initialClientReactSignal,\n      onError: (err: unknown) => {\n        const digest = getDigestForWellKnownError(err)\n\n        if (digest) {\n          return digest\n        }\n\n        if (isReactLargeShellError(err)) {\n          // TODO: Aggregate\n          console.error(err)\n          return undefined\n        }\n\n        if (initialClientReactSignal.aborted) {\n          // These are expected errors that might error the prerender. we ignore them.\n        } else if (\n          process.env.NEXT_DEBUG_BUILD ||\n          process.env.__NEXT_VERBOSE_LOGGING\n        ) {\n          // We don't normally log these errors because we are going to retry anyway but\n          // it can be useful for debugging Next.js itself to get visibility here when needed\n          printDebugThrownValueForProspectiveRender(\n            err,\n            workStore.route,\n            Phase.ProspectiveRender\n          )\n        }\n      },\n      // We don't need bootstrap scripts in this prerender\n      // bootstrapScripts: [bootstrapScript],\n    }\n  )\n\n  // The listener to abort our own render controller must be added after React\n  // has added its listener, to ensure that pending I/O is not\n  // aborted/rejected too early.\n  initialClientReactSignal.addEventListener(\n    'abort',\n    () => {\n      initialClientRenderController.abort()\n    },\n    { once: true }\n  )\n\n  pendingInitialClientResult.catch((err: unknown) => {\n    if (initialClientReactSignal.aborted || isPrerenderInterruptedError(err)) {\n      // These are expected errors that might error the prerender. we ignore them.\n    } else if (\n      process.env.NEXT_DEBUG_BUILD ||\n      process.env.__NEXT_VERBOSE_LOGGING\n    ) {\n      // We don't normally log these errors because we are going to retry anyway but\n      // it can be useful for debugging Next.js itself to get visibility here when needed\n      printDebugThrownValueForProspectiveRender(\n        err,\n        workStore.route,\n        Phase.ProspectiveRender\n      )\n    }\n  })\n\n  // This is mostly needed for dynamic `import()`s in client components.\n  // Promises passed to client were already awaited above (assuming that they came from cached functions)\n  const cacheSignal = new CacheSignal()\n  trackPendingModules(cacheSignal)\n  await cacheSignal.cacheReady()\n  workUnitAsyncStorage.run(\n    initialClientPrerenderStore,\n    initialClientReactController.abort.bind(initialClientReactController)\n  )\n}\n\nasync function validateStagedShell(\n  stageChunks: Array<Uint8Array>,\n  allServerChunks: Array<Uint8Array>,\n  debugChunks: null | Array<Uint8Array>,\n  debugEndTime: number | undefined,\n  rootParams: Params,\n  fallbackRouteParams: OpaqueFallbackRouteParams | null,\n  allowEmptyStaticShell: boolean,\n  ctx: ValidationRenderContext,\n  hmrRefreshHash: string | undefined,\n  trackDynamicHole:\n    | typeof trackDynamicHoleInStaticShell\n    | typeof trackDynamicHoleInRuntimeShell,\n  validationAbortSignal: AbortSignal\n): Promise<Array<unknown>> {\n  const { implicitTags, nonce, workStore } = ctx\n\n  const clientDynamicTracking = createDynamicTrackingState(\n    false //isDebugDynamicAccesses\n  )\n  const clientReactController = new AbortController()\n  const clientRenderController = new AbortController()\n  const clientReactSignal = AbortSignal.any([\n    clientReactController.signal,\n    validationAbortSignal,\n  ])\n\n  const preinitScripts = () => {}\n  const { ServerInsertedHTMLProvider } = createServerInsertedHTML()\n\n  const finalClientPrerenderStore: PrerenderStore = {\n    type: 'prerender-client',\n    phase: 'render',\n    rootParams,\n    fallbackRouteParams,\n    implicitTags,\n    renderSignal: clientRenderController.signal,\n    controller: clientReactController,\n    // No APIs require a cacheSignal through the workUnitStore during the HTML prerender\n    cacheSignal: null,\n    dynamicTracking: clientDynamicTracking,\n    revalidate: INFINITE_CACHE,\n    expire: INFINITE_CACHE,\n    stale: INFINITE_CACHE,\n    tags: [...implicitTags.tags],\n    // TODO should this be removed from client stores?\n    resumeDataCache: null,\n    hmrRefreshHash,\n    // Client prerenders don't track server param access\n    varyParamsAccumulator: null,\n  }\n\n  const dynamicValidation = createDynamicValidationState()\n\n  const serverStream = createNodeStreamWithLateRelease(\n    stageChunks,\n    allServerChunks,\n    clientReactSignal\n  )\n\n  const debugChannelClient = debugChunks\n    ? createNodeStreamWithLateRelease(\n        debugChunks,\n        debugChunks,\n        clientReactSignal\n      )\n    : undefined\n\n  try {\n    let { prelude: unprocessedPrelude } = await runInSequentialTasks(\n      () => {\n        const pendingFinalClientResult = workUnitAsyncStorage.run(\n          finalClientPrerenderStore,\n          getClientPrerender,\n          // eslint-disable-next-line @next/internal/no-ambiguous-jsx -- React Client\n          <App\n            reactServerStream={serverStream}\n            reactDebugStream={debugChannelClient}\n            debugEndTime={debugEndTime}\n            preinitScripts={preinitScripts}\n            ServerInsertedHTMLProvider={ServerInsertedHTMLProvider}\n            nonce={nonce}\n            images={ctx.renderOpts.images}\n          />,\n          {\n            signal: clientReactSignal,\n            onError: (err: unknown, errorInfo: ErrorInfo) => {\n              if (\n                isPrerenderInterruptedError(err) ||\n                clientReactSignal.aborted\n              ) {\n                const componentStack = errorInfo.componentStack\n                if (typeof componentStack === 'string') {\n                  trackDynamicHole(\n                    err,\n                    workStore,\n                    componentStack,\n                    dynamicValidation,\n                    clientDynamicTracking\n                  )\n                }\n                return\n              }\n\n              if (isReactLargeShellError(err)) {\n                // TODO: Aggregate\n                console.error(err)\n                return undefined\n              }\n\n              return getDigestForWellKnownError(err)\n            },\n            // We don't need bootstrap scripts in this prerender\n            // bootstrapScripts: [bootstrapScript],\n          }\n        )\n\n        // The listener to abort our own render controller must be added after\n        // React has added its listener, to ensure that pending I/O is not\n        // aborted/rejected too early.\n        clientReactSignal.addEventListener(\n          'abort',\n          () => {\n            clientRenderController.abort()\n          },\n          { once: true }\n        )\n\n        return pendingFinalClientResult\n      },\n      () => {\n        workUnitAsyncStorage.run(\n          finalClientPrerenderStore,\n          clientReactController.abort.bind(clientReactController)\n        )\n      }\n    )\n\n    const { preludeIsEmpty } = await processPreludeOp(unprocessedPrelude)\n    return getStaticShellDisallowedDynamicReasons(\n      workStore,\n      preludeIsEmpty ? PreludeState.Empty : PreludeState.Full,\n      dynamicValidation,\n      allowEmptyStaticShell\n    )\n  } catch (thrownValue) {\n    // Even if the root errors we still want to report any cache components errors\n    // that were discovered before the root errored.\n    let errors: Array<unknown> = getStaticShellDisallowedDynamicReasons(\n      workStore,\n      PreludeState.Errored,\n      dynamicValidation,\n      allowEmptyStaticShell\n    )\n\n    if (process.env.NEXT_DEBUG_BUILD || process.env.__NEXT_VERBOSE_LOGGING) {\n      errors.unshift(\n        'During dynamic validation the root of the page errored. The next logged error is the thrown value. It may be a duplicate of errors reported during the normal development mode render.',\n        thrownValue\n      )\n    }\n\n    return errors\n  }\n}\n\n/**\n * Validates instant configs by iterating URL depths from deepest to\n * shallowest. At each depth, builds a combined payload where segments\n * above the boundary use Dynamic stage (already mounted) and segments\n * below use Static/Runtime stage (being prefetched). If the new subtree\n * contains any `instant` configs, the payload is rendered to\n * detect dynamic holes without Suspense.\n */\nasync function validateInstantConfigs(\n  prefetchMode: PrefetchingMode,\n  accumulatedChunks: AccumulatedStreamChunks,\n  debugChunks: null | Array<Uint8Array>,\n  startTime: number,\n  stageEndTimes: StageEndTimes,\n  rootParams: Params,\n  fallbackRouteParams: OpaqueFallbackRouteParams | null,\n  ctx: ValidationRenderContext,\n  hmrRefreshHash: string | undefined,\n  validationSamples: ValidationStoreClient['validationSamples'] | null,\n  devRenderDidError: boolean,\n  validationAbortSignal?: AbortSignal\n): Promise<Array<unknown>> {\n  const debug =\n    process.env.NEXT_PRIVATE_DEBUG_VALIDATION === '1' ? console.log : undefined\n\n  const {\n    createCombinedPayloadAtDepth,\n    createCombinedPayloadStream,\n    collectStagedSegmentData,\n    discoverValidationDepths,\n    ValidationPrefetchKind,\n  } = ctx.componentMod.InstantValidation()!\n\n  const { createValidationSampleTracking } =\n    require('./instant-validation/instant-samples') as typeof import('./instant-validation/instant-samples')\n\n  debug?.('\\nStarting depth-based instant validation...')\n\n  const prefetchKind =\n    prefetchMode === PrefetchingMode.Partial\n      ? ValidationPrefetchKind.Shell\n      : ValidationPrefetchKind.LegacySpeculative\n\n  const loaderTree = ctx.componentMod.routeModule.userland.loaderTree\n\n  const clientReferenceManifest = getClientReferenceManifest()\n\n  const renderFlightStream = process.env.__NEXT_USE_NODE_STREAMS\n    ? renderToNodeFlightStream\n    : renderToWebFlightStream\n  const createDebugChannel = process.env.__NEXT_USE_NODE_STREAMS\n    ? createNodeDebugChannel\n    : createWebDebugChannel\n\n  const { cache, payload: initialRscPayload } = await collectStagedSegmentData(\n    prefetchKind,\n    ctx.componentMod,\n    renderFlightStream,\n    {\n      [RenderStage.Static]: accumulatedChunks.staticChunks,\n      [RenderStage.ShellRuntime]: accumulatedChunks.shellRuntimeChunks,\n      [RenderStage.Runtime]: accumulatedChunks.runtimeChunks,\n      [RenderStage.Dynamic]: accumulatedChunks.dynamicChunks,\n    },\n    debugChunks,\n    startTime,\n    stageEndTimes,\n    clientReferenceManifest,\n    createDebugChannel\n  )\n\n  const { implicitTags, nonce, workStore, isDebugChannelEnabled } = ctx\n\n  async function validateAtDepth(\n    depth: number,\n    groupDepthForValidation: number\n  ): Promise<null | NavigationValidationResult> {\n    return validateAtDepthImpl(depth, groupDepthForValidation, null)\n  }\n\n  async function validateAtDepthImpl(\n    depth: number,\n    groupDepthForValidation: number,\n    previousBoundaryState: null | ValidationBoundaryTracking\n  ): Promise<null | NavigationValidationResult> {\n    if (validationAbortSignal?.aborted) {\n      return null\n    }\n\n    const extraChunksController = new AbortController()\n    const extraChunksSignal =\n      validationAbortSignal === undefined\n        ? extraChunksController.signal\n        : AbortSignal.any([extraChunksController.signal, validationAbortSignal])\n\n    const boundaryState = createValidationBoundaryTracking()\n    let useRuntimeStageForPartialSegments = false\n    if (previousBoundaryState) {\n      // We're doing a followup render to better discriminate error types\n      useRuntimeStageForPartialSegments = true\n      for (const [id, filePath] of previousBoundaryState.requiredIds) {\n        boundaryState.requiredIds.set(id, filePath)\n      }\n    }\n\n    const payloadResult = await createCombinedPayloadAtDepth(\n      prefetchKind,\n      initialRscPayload,\n      cache,\n      loaderTree,\n      ctx.getDynamicParamFromSegment,\n      ctx.query,\n      depth,\n      groupDepthForValidation,\n      extraChunksSignal,\n      boundaryState,\n      clientReferenceManifest,\n      useRuntimeStageForPartialSegments\n    )\n\n    if (payloadResult === null) {\n      return null\n    }\n\n    const reactController = new AbortController()\n    const renderController = new AbortController()\n    const reactSignal =\n      validationAbortSignal === undefined\n        ? reactController.signal\n        : AbortSignal.any([reactController.signal, validationAbortSignal])\n    const preinitScripts = () => {}\n    const { ServerInsertedHTMLProvider } = createServerInsertedHTML()\n\n    const { stream: serverStream, debugStream } =\n      await createCombinedPayloadStream(\n        ctx.componentMod,\n        renderFlightStream,\n        payloadResult.payload,\n        extraChunksController,\n        reactSignal,\n        clientReferenceManifest,\n        startTime,\n        isDebugChannelEnabled,\n        createDebugChannel\n      )\n\n    const instantValidationState = createInstantValidationState(\n      payloadResult.slotStacks\n    )\n\n    const validationSampleTracking =\n      validationSamples !== null ? createValidationSampleTracking() : null\n\n    const clientDynamicTracking = createDynamicTrackingState(false)\n\n    const prerenderStore: PrerenderStore = {\n      type: 'validation-client',\n      phase: 'render',\n      rootParams,\n      implicitTags,\n      renderSignal: renderController.signal,\n      controller: reactController,\n      cacheSignal: null,\n      dynamicTracking: clientDynamicTracking,\n      revalidate: INFINITE_CACHE,\n      expire: INFINITE_CACHE,\n      stale: INFINITE_CACHE,\n      tags: [...implicitTags.tags],\n      resumeDataCache: null,\n      hmrRefreshHash,\n      varyParamsAccumulator: null,\n      boundaryState,\n      fallbackRouteParams,\n      validationSamples,\n      validationSampleTracking,\n    }\n\n    let dynamicHoleKind: DynamicHoleKind\n    switch (prefetchKind) {\n      case ValidationPrefetchKind.Shell: {\n        dynamicHoleKind = payloadResult.hasAmbiguousErrors\n          ? DynamicHoleKind.Link\n          : DynamicHoleKind.Dynamic\n        break\n      }\n      case ValidationPrefetchKind.LegacySpeculative: {\n        dynamicHoleKind = payloadResult.hasAmbiguousErrors\n          ? DynamicHoleKind.Runtime\n          : DynamicHoleKind.Dynamic\n        break\n      }\n    }\n\n    let result: NavigationValidationResult\n    try {\n      const { prelude: unprocessedPrelude } = await runInSequentialTasks(\n        () => {\n          const pendingResult = workUnitAsyncStorage.run(\n            prerenderStore,\n            getClientPrerender,\n            // eslint-disable-next-line @next/internal/no-ambiguous-jsx -- React Client\n            <App\n              reactServerStream={serverStream}\n              reactDebugStream={debugStream ?? undefined}\n              debugEndTime={undefined}\n              preinitScripts={preinitScripts}\n              ServerInsertedHTMLProvider={ServerInsertedHTMLProvider}\n              nonce={nonce}\n              images={ctx.renderOpts.images}\n            />,\n            {\n              signal: reactSignal,\n              onError: (err: unknown, errorInfo: ErrorInfo) => {\n                if (isPrerenderInterruptedError(err) || reactSignal.aborted) {\n                  const componentStack = errorInfo.componentStack\n                  if (typeof componentStack === 'string') {\n                    trackDynamicHoleInNavigation(\n                      err,\n                      workStore,\n                      componentStack,\n                      instantValidationState,\n                      clientDynamicTracking,\n                      dynamicHoleKind,\n                      boundaryState\n                    )\n                  }\n                  return\n                } else if (!reactSignal.aborted) {\n                  const componentStack = errorInfo.componentStack\n                  if (typeof componentStack === 'string') {\n                    let errorForDisplay = err\n                    if (process.env.NODE_ENV === 'production') {\n                      // In production (i.e. build validation), Flight omits everything except the digest\n                      // when serializing errors, which makes them very unfriendly for debugging.\n                      // Map the deserialized errors back to their original error object to make it more useful.\n                      if (\n                        err &&\n                        typeof err === 'object' &&\n                        'digest' in err &&\n                        typeof err.digest === 'string'\n                      ) {\n                        const serverError =\n                          workStore.reactServerErrorsByDigest.get(err.digest)\n                        if (serverError !== undefined) {\n                          errorForDisplay = serverError\n                        }\n                      }\n                    }\n\n                    trackThrownErrorInNavigation(\n                      workStore,\n                      instantValidationState,\n                      errorForDisplay,\n                      componentStack\n                    )\n                  }\n                }\n\n                if (isReactLargeShellError(err)) {\n                  console.error(err)\n                  return undefined\n                }\n\n                return getDigestForWellKnownError(err)\n              },\n            }\n          )\n\n          reactSignal.addEventListener(\n            'abort',\n            () => {\n              renderController.abort()\n            },\n            { once: true }\n          )\n\n          return pendingResult\n        },\n        () => {\n          workUnitAsyncStorage.run(\n            prerenderStore,\n            reactController.abort.bind(reactController)\n          )\n        }\n      )\n\n      const { preludeIsEmpty } = await processPreludeOp(unprocessedPrelude)\n\n      result = getNavigationDisallowedDynamicReasons(\n        workStore,\n        preludeIsEmpty ? PreludeState.Empty : PreludeState.Full,\n        instantValidationState,\n        validationSampleTracking,\n        boundaryState,\n        devRenderDidError\n      )\n    } catch (thrownValue) {\n      result = getNavigationDisallowedDynamicReasons(\n        workStore,\n        PreludeState.Errored,\n        instantValidationState,\n        validationSampleTracking,\n        boundaryState,\n        devRenderDidError\n      )\n    }\n\n    // If the prerender produced no real errors at this depth — either an\n    // empty array (clean) or a deferred-only result (Error/AggregateError\n    // representing a missing-boundary fallback) — there's nothing to\n    // discriminate. Pass it up so the outer loop can hold any deferred\n    // fallback back until every depth has been tried.\n    if (!Array.isArray(result) || result.length === 0) {\n      return result\n    }\n\n    if (previousBoundaryState === null && payloadResult.hasAmbiguousErrors) {\n      // This is the first validation attempt. we prepared a payload where dynamic holes might be runtime data dependencies\n      // or dynamic data dependencies. We do a followup validation using a payload with only Runtime segments to discriminate\n      if (\n        validationAbortSignal !== undefined &&\n        !(await yieldToForegroundRequest(validationAbortSignal))\n      ) {\n        return []\n      }\n\n      const dynamicOnlyResult = await validateAtDepthImpl(\n        depth,\n        groupDepthForValidation,\n        boundaryState\n      )\n\n      if (Array.isArray(dynamicOnlyResult) && dynamicOnlyResult.length > 0) {\n        // The dynamic errors only validation found errors to report so we favor those\n        return dynamicOnlyResult\n      }\n    }\n\n    // If we didn't return some other errors at this point the only thing to return is this validation's result\n    return result\n  }\n\n  // Discover validation depth bounds from the LoaderTree. The array\n  // length is the max URL depth; each entry is the max group depth\n  // (route group segments) between that URL depth and the next.\n  const groupDepthsByUrlDepth = discoverValidationDepths(loaderTree)\n  const maxDepth = groupDepthsByUrlDepth.length\n\n  let impairedValidation: null | Error | AggregateError = null\n\n  for (let depth = maxDepth - 1; depth >= 0; depth--) {\n    const maxGroupDepth = groupDepthsByUrlDepth[depth]\n\n    for (\n      let currentGroupDepth = maxGroupDepth;\n      currentGroupDepth >= 0;\n      currentGroupDepth--\n    ) {\n      const debugKind = ValidationPrefetchKind[prefetchKind]\n      debug?.(\n        `Trying ${debugKind} at depth ${depth}` +\n          (currentGroupDepth > 0\n            ? ` + groupDepth ${currentGroupDepth}...`\n            : '...')\n      )\n\n      if (\n        validationAbortSignal !== undefined &&\n        !(await yieldToForegroundRequest(validationAbortSignal))\n      ) {\n        return []\n      }\n\n      const result = await validateAtDepth(depth, currentGroupDepth)\n\n      if (Array.isArray(result)) {\n        const errors: Array<Error> = result\n        // Validation completed at least partially.\n        if (errors.length > 0) {\n          // There were issues with producing an instant UI for this attempted navigation\n          debug?.(\n            `  ${debugKind} at depth ${depth}+${currentGroupDepth}: ❌ Failed (${errors.length} errors)`\n          )\n          return errors\n        } else {\n          // There is nothing blocking instant UI for this simluated navigation\n          debug?.(\n            `  ${debugKind} at depth ${depth}+${currentGroupDepth}: ✅ Passed`\n          )\n        }\n      } else if (result === null) {\n        // There was no validation to perform at this level\n        debug?.(`  No config at depth ${depth}+${currentGroupDepth}, skipping.`)\n      } else {\n        // Something prevented this level from fully validating but there\n        // were no detected errors. Always overwrite — prefer the\n        // shallowest deferred fallback. If a high-level layout drops\n        // children, everything below is unreachable; the shallowest\n        // unrendered segment is closest to the actual cause.\n        impairedValidation = result\n      }\n    }\n  }\n\n  if (impairedValidation) {\n    debug?.(\n      `⏸ All depths passed without real errors; surfacing deferred missing-boundary fallback`\n    )\n    if (impairedValidation instanceof AggregateError) {\n      // There is at least one potential cause of the validation blocking\n      return impairedValidation.errors\n    } else {\n      // There was no known cause but we report something anyway\n      return [impairedValidation]\n    }\n  }\n\n  debug?.(`✅ All depths passed`)\n  return []\n}\n\n/**\n * Two-pass render for build-time instant validation.\n * The flow is similar to `renderWithRestartOnCacheMissInDev`: pass 1 warms caches,\n * pass 2 renders with warm caches. If pass 1 has no cache misses,\n * its result is returned directly.\n *\n * Differences from `renderWithRestartOnCacheMissInDev`:\n * - both renders are abortable: if we know that we can't use a stream, we can just\n *   throw it away, we don't have to render a complete result.\n * - We don't need to tee the stream, we only care about accumulating chunks.\n */\nasync function renderWithRestartOnCacheMissInValidation(\n  prefetchMode: PrefetchingMode,\n  ctx: AppRenderContext,\n  initialRequestStore: RequestStore,\n  createRequestStore: () => RequestStore,\n  getPayload: (requestStore: RequestStore) => Promise<RSCPayload>,\n  createOnError: (\n    signal: AbortSignal,\n    isRestart: boolean\n  ) => (error: unknown) => void,\n  prefilledDataCache: RenderResumeDataCache | null\n): Promise<{\n  accumulatedChunksPromise: Promise<AccumulatedStreamChunks>\n  startTime: number\n  stageController: StagedRenderingController\n  requestStore: RequestStore\n}> {\n  const { componentMod: ComponentMod } = ctx\n  const shouldRenderAppShell = prefetchMode === PrefetchingMode.Partial\n\n  const { clientModules } = getClientReferenceManifest()\n  const renderFlightStream = process.env.__NEXT_USE_NODE_STREAMS\n    ? renderToNodeFlightStream\n    : renderToWebFlightStream\n\n  let startTime = -Infinity\n  let requestStore: RequestStore = initialRequestStore\n\n  //===============================================\n  // Initial render (prospective — may warm caches)\n  //===============================================\n\n  const cacheSignal = new CacheSignal()\n  trackPendingModules(cacheSignal)\n\n  // The prerender we rean before the validation probably already filled some caches,\n  // so we want to save work and re-use them.\n  const prerenderResumeDataCache = prefilledDataCache\n    ? createPrerenderResumeDataCache(prefilledDataCache)\n    : createPrerenderResumeDataCache()\n\n  const initialReactController = new AbortController()\n  const initialDataController = new AbortController()\n\n  const initialAbandonController = new AbortController()\n  const initialStageController = new StagedRenderingController({\n    abortSignal: initialDataController.signal,\n    abandonController: initialAbandonController,\n    syncIO: getSyncIOMode(prefetchMode),\n    finalStage: null,\n  })\n\n  requestStore.resumeDataCache = prerenderResumeDataCache\n  requestStore.stagedRendering = initialStageController\n  requestStore.needsSessionShell = shouldRenderAppShell\n  requestStore.cacheSignal = cacheSignal\n  requestStore.asyncApiPromises = createAsyncApiPromises(\n    initialStageController,\n    requestStore.cookies,\n    requestStore.mutableCookies,\n    requestStore.headers\n  )\n  // We don't set `requestStore.controller and requestStore.renderSignal here.\n  // Right now, we only abort for sync IO, and in the first render, that's just a restart\n  // (after waiting for caches)\n  requestStore.controller = undefined\n  requestStore.renderSignal = undefined\n\n  const initialRscPayload = await getPayload(requestStore)\n\n  const advanceStageIfNoCacheMiss = (\n    stage: Parameters<StagedRenderingController['advanceStage']>[0]\n  ) => {\n    if (initialAbandonController.signal.aborted === true) {\n      return\n    } else if (cacheSignal.hasPendingReads()) {\n      initialAbandonController.abort()\n    } else {\n      initialStageController.advanceStage(stage)\n    }\n  }\n\n  const initialResult = await runInSequentialTasks(\n    () => {\n      initialStageController.advanceStage(RenderStage.ShellStatic)\n      startTime = performance.now() + performance.timeOrigin\n\n      const stream = workUnitAsyncStorage.run(\n        requestStore,\n        renderFlightStream,\n        ComponentMod,\n        initialRscPayload,\n        clientModules,\n        {\n          onError: createOnError(initialReactController.signal, false),\n          startTime,\n          filterStackFrame,\n          signal: initialReactController.signal,\n        }\n      )\n\n      initialReactController.signal.addEventListener(\n        'abort',\n        () => {\n          const { reason } = initialReactController.signal\n          initialDataController.abort(reason)\n        },\n        { once: true }\n      )\n\n      const accumulatedChunksPromise = accumulateStreamChunks(\n        stream,\n        initialStageController,\n        initialDataController.signal\n      )\n      accumulatedChunksPromise.catch(() => {})\n      return { accumulatedChunksPromise }\n    },\n    () => {\n      advanceStageIfNoCacheMiss(RenderStage.Static)\n    },\n    () => {\n      advanceStageIfNoCacheMiss(RenderStage.ShellRuntime)\n    },\n    () => {\n      advanceStageIfNoCacheMiss(RenderStage.Runtime)\n    },\n    () => {\n      advanceStageIfNoCacheMiss(RenderStage.Dynamic)\n    }\n  )\n\n  if (initialStageController.currentStage !== RenderStage.Abandoned) {\n    // No cache misses. Use the result as-is.\n    return {\n      accumulatedChunksPromise: initialResult.accumulatedChunksPromise,\n      startTime,\n      stageController: initialStageController,\n      requestStore,\n    }\n  }\n\n  // Cache miss. Wait for caches to fill, then re-render with warm caches.\n  await cacheSignal.cacheReady()\n  workUnitAsyncStorage.run(\n    requestStore,\n    initialReactController.abort.bind(initialReactController)\n  )\n\n  //===============================================\n  // Final render (restarted, with warm caches)\n  //===============================================\n\n  requestStore = createRequestStore()\n\n  // Unlike dev, where we're re-using the render that'll be visible in the browser,\n  // we *can* abort the validation render.\n\n  const finalReactController = new AbortController()\n  const finalDataController = new AbortController()\n  const finalStageController = new StagedRenderingController({\n    abortSignal: finalDataController.signal,\n    abandonController: null,\n    syncIO: getSyncIOMode(prefetchMode),\n    finalStage: null,\n  })\n\n  requestStore.resumeDataCache = createRenderResumeDataCache(\n    prerenderResumeDataCache\n  )\n  requestStore.stagedRendering = finalStageController\n  requestStore.needsSessionShell = shouldRenderAppShell\n  requestStore.cacheSignal = null\n  requestStore.asyncApiPromises = createAsyncApiPromises(\n    finalStageController,\n    requestStore.cookies,\n    requestStore.mutableCookies,\n    requestStore.headers\n  )\n  // Right now, we only abort for sync IO.\n  // If sync IO occurs in a place where it's not allowed, then we have to fail validation,\n  // and we can abort the render immediately, without waiting for anything else..\n  requestStore.controller = finalReactController\n  requestStore.renderSignal = finalDataController.signal\n\n  const finalRscPayload = await getPayload(requestStore)\n\n  const finalResult = await runInSequentialTasks(\n    () => {\n      finalStageController.advanceStage(RenderStage.ShellStatic)\n      startTime = performance.now() + performance.timeOrigin\n\n      const stream = workUnitAsyncStorage.run(\n        requestStore,\n        renderFlightStream,\n        ComponentMod,\n        finalRscPayload,\n        clientModules,\n        {\n          onError: createOnError(finalReactController.signal, true),\n          startTime,\n          filterStackFrame,\n          signal: finalReactController.signal,\n        }\n      )\n\n      finalReactController.signal.addEventListener(\n        'abort',\n        () => {\n          finalDataController.abort(finalReactController.signal.reason)\n        },\n        { once: true }\n      )\n\n      const accumulatedChunksPromise = accumulateStreamChunks(\n        stream,\n        finalStageController,\n        null\n      )\n      accumulatedChunksPromise.catch(() => {})\n\n      return {\n        accumulatedChunksPromise,\n      }\n    },\n    () => finalStageController.advanceStage(RenderStage.Static),\n    () => finalStageController.advanceStage(RenderStage.ShellRuntime),\n    () => finalStageController.advanceStage(RenderStage.Runtime),\n    () => finalStageController.advanceStage(RenderStage.Dynamic)\n  )\n\n  return {\n    accumulatedChunksPromise: finalResult.accumulatedChunksPromise,\n    startTime,\n    stageController: finalStageController,\n    requestStore,\n  }\n}\n\nasync function validateInstantConfigsInBuild(\n  ctx: AppRenderContext,\n  prefilledDataCache: RenderResumeDataCache | null\n): Promise<void> {\n  const run = async () => {\n    let success: boolean\n    try {\n      // The validation renders are separate renders, and use a separate WorkStore.\n      // However, we defensively exit the existing workStore to avoid relying on something from there\n      // before we shadow it.\n      success = await workAsyncStorage.exit(async () =>\n        validateInstantConfigsInBuildImpl(ctx, prefilledDataCache)\n      )\n    } catch (err) {\n      console.error(\n        new InvariantError(\n          'An unexpected error occurred during instant validation',\n          { cause: err }\n        )\n      )\n      success = false\n    }\n    if (!success) {\n      console.error('Stopping prerender due to instant validation errors.')\n      throw new StaticGenBailoutError()\n    }\n  }\n\n  if (process.env.__NEXT_TEST_MODE && process.env.NEXT_TEST_LOG_VALIDATION) {\n    // In tests, we use these markers to extract the relevant portion of the CLI logs.\n    // We want consistent ordering of these messages and other console.error calls,\n    // so we use console.error here as well. Using console.log leads to non-deterministic\n    // log order, likely stdout/stderr can interleave in non-deterministic ways.\n    const requestId = String(Date.now())\n    const route = ctx.workStore.route\n    console.error(\n      formatValidationEvent({ type: 'validation_start', requestId, url: route })\n    )\n    try {\n      return await run()\n    } finally {\n      console.error(\n        formatValidationEvent({ type: 'validation_end', requestId, url: route })\n      )\n    }\n  } else {\n    return await run()\n  }\n}\n\n/**\n * Runs instant validation at build time using the `samples` from `instant`.\n *\n * For each sample, this creates a staged RSC render with a synthetic `RequestStore`\n * populated from sample data, then feeds the accumulated chunks to\n * `validateInstantConfigs` which handles the actual validation.\n */\nasync function validateInstantConfigsInBuildImpl(\n  ctx: AppRenderContext,\n  prefilledDataCache: RenderResumeDataCache | null\n): Promise<boolean> {\n  const debug =\n    process.env.NEXT_PRIVATE_DEBUG_VALIDATION === '1' ? console.log : undefined\n\n  const { workStore: outerWorkStore } = ctx\n  const route = outerWorkStore.route\n\n  const loaderTree = ctx.componentMod.routeModule.userland.loaderTree\n  let samples = await resolveInstantConfigSamplesForPage(loaderTree)\n  if (!samples || samples.length === 0) {\n    // No samples defined; use a single empty sample to still run validation\n    samples = [{}]\n  }\n  debug?.('Resolved samples:', samples)\n\n  const allPossibleFallbackRouteParams = getFallbackRouteParams(\n    route,\n    ctx.componentMod.routeModule\n  )\n\n  for (let sampleIndex = 0; sampleIndex < samples.length; sampleIndex++) {\n    const sample = samples[sampleIndex]\n    debug?.(`Validating sample (${sampleIndex + 1}/${samples.length}):`, sample)\n\n    let errors: unknown[]\n    try {\n      errors = await consoleAsyncStorage.run({ dim: true }, () =>\n        validateInstantConfigInBuildWithSample(\n          ctx,\n          sample,\n          allPossibleFallbackRouteParams,\n          prefilledDataCache\n        )\n      )\n    } catch (err) {\n      if (isInstantValidationError(err)) {\n        errors = [err]\n      } else {\n        throw err\n      }\n    }\n\n    if (errors.length > 0) {\n      debug?.(`❌ Sample failed validation (${errors.length} errors)`)\n      const sampleDesc =\n        samples.length > 1\n          ? ` (sample ${sampleIndex + 1} of ${samples.length})`\n          : ''\n      for (const err of errors) {\n        console.error(err)\n      }\n      console.error(\n        `Build-time instant validation failed for route \"${route}\"${sampleDesc}.`\n      )\n      logBuildDebugHint(route)\n      return false\n    } else {\n      debug?.('✅ Sample validated successfully')\n    }\n  }\n  return true\n}\n\nasync function validateInstantConfigInBuildWithSample(\n  outerCtx: AppRenderContext,\n  sample: InstantSample,\n  allPossibleFallbackRouteParams: OpaqueFallbackRouteParams | null,\n  prefilledDataCache: RenderResumeDataCache | null\n): Promise<unknown[]> {\n  // The flow for build mirrors what we do when validating in dev.\n  // We have to perform a full dynamic render to get the RSC chunks for each stage.\n  // In order to do that, we have to set up a mock AppRenderContext, workStore, and requestStore\n  // based on the `sample` we're using.\n\n  const { workStore: outerWorkStore } = outerCtx\n  const loaderTree = outerCtx.componentMod.routeModule.userland.loaderTree\n  const prefetchMode = await getPrefetchingModeForPage(\n    outerCtx.renderOpts,\n    loaderTree\n  )\n\n  const route = outerWorkStore.route\n\n  const {\n    createCookiesFromSample,\n    createHeadersFromSample,\n    createDraftModeForValidation,\n    createRelativeURLFromSamples,\n    createValidationSampleTracking,\n  } =\n    require('./instant-validation/instant-samples') as typeof import('./instant-validation/instant-samples')\n\n  // TODO(instant-validation-build): it feels like this should happen higher up\n  // and go through existing URL parsing/generation logic?\n  const sampleUrl = createRelativeURLFromSamples(\n    route,\n    sample.params,\n    sample.searchParams\n  )\n\n  const sampleParams = sample.params ?? {}\n  let fallbackRouteParams: OpaqueFallbackRouteParams | null = null\n  if (allPossibleFallbackRouteParams) {\n    const fallbackRouteParamsMut = new Map()\n    for (const [paramKey, value] of allPossibleFallbackRouteParams) {\n      if (!(paramKey in sampleParams)) {\n        fallbackRouteParamsMut.set(paramKey, value)\n      }\n    }\n    fallbackRouteParams = fallbackRouteParamsMut\n  }\n\n  const getDynamicParamFromSegment = makeGetDynamicParamFromSegment(\n    sampleParams,\n    fallbackRouteParams,\n    false\n  )\n\n  const sampleRootParams = getRootParams(loaderTree, getDynamicParamFromSegment)\n\n  let sampleUrlWithoutQuery: Omit<ParsedRelativeUrl, 'query'>\n  let sampleQuery: ParsedRelativeUrl['query']\n  ;({ query: sampleQuery, ...sampleUrlWithoutQuery } = sampleUrl)\n\n  const { AfterContext } =\n    require('../after/after-context') as typeof import('../after/after-context')\n\n  // NOTE: Matching the field order in `createWorkStore` to avoid deopting.\n  const workStore: WorkStore = {\n    isStaticGeneration: false,\n    page: outerWorkStore.page,\n    route: outerWorkStore.route,\n    requestStartTime: outerWorkStore.requestStartTime,\n    incrementalCache: outerWorkStore.incrementalCache,\n    cacheLifeProfiles: outerWorkStore.cacheLifeProfiles,\n    useCacheTimeout: outerWorkStore.useCacheTimeout,\n    staticPageGenerationTimeout: outerWorkStore.staticPageGenerationTimeout,\n    isBuildTimePrerendering: false,\n    fetchCache: outerWorkStore.fetchCache,\n    isOnDemandRevalidate: false,\n    requestId: outerWorkStore.requestId,\n    htmlRequestId: outerWorkStore.htmlRequestId,\n\n    isDraftMode: false,\n\n    isPrefetchRequest: false,\n    buildId: outerWorkStore.buildId,\n    deploymentId: outerWorkStore.deploymentId,\n    reactLoadableManifest: outerWorkStore.reactLoadableManifest,\n    assetPrefix: outerWorkStore.assetPrefix,\n    nonce: outerWorkStore.nonce,\n\n    // Never run `after()` for this validation render. by definition, `after` can't affect the rendered output.\n    afterContext: new AfterContext({\n      waitUntil(promise) {\n        promise.catch(() => {})\n      },\n      onClose() {},\n      onTaskError() {},\n    }),\n\n    cacheComponentsEnabled: outerWorkStore.cacheComponentsEnabled,\n    validationLevel: outerWorkStore.validationLevel,\n    previouslyRevalidatedTags: [],\n    refreshTagsByCacheKind: new Map(),\n    runInCleanSnapshot: outerWorkStore.runInCleanSnapshot,\n    shouldTrackFetchMetrics: false,\n    reactServerErrorsByDigest: new Map(),\n  }\n\n  return workAsyncStorage.run(workStore, async () => {\n    // NOTE: match field order in renderToHTMLOrFlightImpl to avoid deopts\n    const validationCtx: AppRenderContext = {\n      componentMod: outerCtx.componentMod,\n      url: sampleUrlWithoutQuery,\n      renderOpts: outerCtx.renderOpts,\n      workStore,\n      parsedRequestHeaders: outerCtx.parsedRequestHeaders,\n      getDynamicParamFromSegment,\n      interpolatedParams: sampleParams,\n      fallbackRouteParams,\n      query: sampleQuery,\n      isPrefetch: false,\n      isPossibleServerAction: false,\n      requestTimestamp: outerCtx.requestTimestamp,\n      appUsingSizeAdjustment: outerCtx.appUsingSizeAdjustment,\n      flightRouterState: undefined,\n      requestId: outerCtx.requestId,\n      htmlRequestId: outerCtx.htmlRequestId,\n      pagePath: outerCtx.pagePath,\n      assetPrefix: outerCtx.assetPrefix,\n      isNotFoundPath: outerCtx.isNotFoundPath,\n      nonce: outerCtx.nonce,\n      res: outerCtx.res,\n      sharedContext: outerCtx.sharedContext,\n      implicitTags: outerCtx.implicitTags,\n    }\n\n    const validationSamples: InstantValidationSamples = {\n      params: sample.params,\n      searchParams: sample.searchParams,\n    }\n\n    const createRequestStore = (): RequestStore => {\n      // Create exhaustive request data from sample\n      const sampleCookies = createCookiesFromSample(sample.cookies, route)\n\n      // We don't have to bother initializing these, pages can't access them anyway,\n      // we just need them because RequestStore requires them.\n      const unusedMutableCookies = new ResponseCookies(new Headers())\n\n      // Create headers.\n      const sampleHeaders = createHeadersFromSample(\n        sample.headers,\n        sample.cookies,\n        route\n      )\n\n      const draftMode = createDraftModeForValidation()\n\n      return {\n        type: 'request',\n        phase: 'render',\n        implicitTags: outerCtx.implicitTags,\n        url: {\n          pathname: sampleUrl.pathname,\n          search: sampleUrl.search,\n        },\n        headers: sampleHeaders,\n        cookies: sampleCookies,\n        mutableCookies: unusedMutableCookies,\n        userspaceMutableCookies: unusedMutableCookies,\n        draftMode,\n        rootParams: sampleRootParams,\n        validationSamples,\n        validationSampleTracking: createValidationSampleTracking(),\n        // This will be set when rendering\n        resumeDataCache: null,\n        stagedRendering: null,\n        asyncApiPromises: undefined,\n      }\n    }\n\n    // Track server errors. If one of them surfaces during the client render\n    // in the deserialized form (with no message/stack) we'll use this to map it\n    // back to the original.\n    const onServerError = createReactServerErrorHandler(\n      true, // shouldFormatError\n      true, // isBuildTimePrerendering - disables tracing\n      workStore.reactServerErrorsByDigest,\n      () => {} // Don't report anything here. If needed, it will be reported in the client render.\n    )\n\n    const {\n      accumulatedChunksPromise,\n      startTime,\n      stageController,\n      requestStore: finalServerStore,\n    } = await renderWithRestartOnCacheMissInValidation(\n      prefetchMode,\n      validationCtx,\n      createRequestStore(),\n      createRequestStore,\n      (requestStore) =>\n        workUnitAsyncStorage.run(\n          requestStore,\n          getRSCPayload,\n          loaderTree,\n          validationCtx,\n          { is404: false }\n        ),\n      (signal) =>\n        function onError(err) {\n          const digest = getDigestForWellKnownError(err)\n          if (digest) {\n            return digest\n          }\n          if (signal.aborted) {\n            return\n          }\n          return onServerError(err)\n        },\n      prefilledDataCache\n    )\n\n    const accumulatedChunks = await accumulatedChunksPromise\n    const endTimes = getStageEndTimes(stageController)\n    const debugChunks = null // TODO(instant-validation-build): support debugChannel\n\n    // Missing sample errors take priority over everything else,\n    // because they prevent us from rendering everything we need to validate.\n    const serverValidationSampleTracking =\n      finalServerStore.validationSampleTracking!\n    if (serverValidationSampleTracking.missingSampleErrors.length > 0) {\n      return serverValidationSampleTracking.missingSampleErrors\n    }\n\n    // We also error for sync IO. This runs after the prerender,\n    // so if we get sync IO errors here, they're likely from the runtime stage --\n    // the prerender probably discovered sync IO in the static stage\n    if (\n      stageController.currentStage === RenderStage.Abandoned &&\n      stageController.syncInterruptReason\n    ) {\n      return [stageController.syncInterruptReason]\n    }\n\n    // Now we the chunks of a fully rendered page, just like in dev.\n    // We can use them to validate all the navigations required by `instant` configs.\n    // Note that we're not performing static shell validation here -- that happens\n    // implicitly as part of the static prerender.\n\n    // The static prerender has warmed some client modules already,\n    // but we'll be reaching Runtime/Dynamic stages and thus rendering more content,\n    // so we need to warm again.\n    // TODO(instant-validation-build): This might warm too much, possibly hitting errors on code that didn't expect\n    // to run at build time. For example, we generally don't need to render leaf segments (e.g. __PAGE__) in\n    // the Dynamic stage, they're Runtime at best.\n\n    const warmupValidationSamplesTracking = createValidationSampleTracking()\n    const validationRenderCtx = toValidationRenderContext(validationCtx)\n    await warmupClientModulesForStagedValidation(\n      'validation-client',\n      accumulatedChunks.dynamicChunks,\n      accumulatedChunks.dynamicChunks,\n      sampleRootParams,\n      fallbackRouteParams,\n      validationRenderCtx,\n      validationSamples,\n      warmupValidationSamplesTracking\n    )\n    if (warmupValidationSamplesTracking.missingSampleErrors.length > 0) {\n      return warmupValidationSamplesTracking.missingSampleErrors\n    }\n\n    return await validateInstantConfigs(\n      prefetchMode,\n      accumulatedChunks,\n      debugChunks,\n      startTime,\n      endTimes,\n      sampleRootParams,\n      fallbackRouteParams,\n      validationRenderCtx,\n      undefined, // hmrRefreshHash,\n      validationSamples,\n      false // build has no shared dev render that would surface errors\n    )\n  })\n}\n\ntype PrerenderToStreamResult = {\n  stream: AnyStream\n  digestErrorsMap: Map<string, DigestedError>\n  ssrErrors: Array<unknown>\n  dynamicAccess?: null | Array<DynamicAccess>\n  collectedRevalidate: number\n  collectedExpire: number\n  collectedStale: number\n  collectedTags: null | string[]\n  renderResumeDataCache?: RenderResumeDataCache\n}\n\n/**\n * Determines whether we should generate static flight data.\n */\n// TODO: This helper used to exclude fallback route params. It now only checks\n// static generation inside prerenderToStream and can be removed. LOE: low.\nfunction shouldGenerateStaticFlightData(workStore: WorkStore): boolean {\n  const { isStaticGeneration } = workStore\n  if (!isStaticGeneration) return false\n\n  return true\n}\n\nasync function continueStaticPrerenderWithInlinedData(\n  htmlStream: AnyStream,\n  reactServerResult: ReactServerPrerenderResult,\n  fallbackRouteParams: OpaqueFallbackRouteParams | null,\n  createInlinedDataStream: typeof createWebInlinedDataStream,\n  formState: unknown | null,\n  nonce: string | undefined,\n  getServerInsertedHTML: () => Promise<string>,\n  getServerInsertedMetadata: () => Promise<string>,\n  deploymentId: string | undefined,\n  ComponentMod: AppPageModule,\n  renderFlightStream: typeof renderToWebFlightStream,\n  clientModules: Parameters<typeof renderToWebFlightStream>[2],\n  filterStackFrameForError: typeof filterStackFrame,\n  serverComponentsErrorHandler: (err: unknown) => string | undefined\n): Promise<AnyStream> {\n  const hasFallbackRouteParams =\n    fallbackRouteParams && fallbackRouteParams.size > 0\n  if (hasFallbackRouteParams) {\n    // This is a \"static fallback\" prerender: although the page didn't\n    // access any runtime params in a Server Component, it may have\n    // accessed a runtime param in a client segment.\n    //\n    // TODO: If there were no client segments, we can use the fully static\n    // path instead.\n    //\n    // Rather than use a dynamic server resume to fill in the params,\n    // we can rely on the client to parse the params from the URL and use\n    // that to hydrate the page.\n    //\n    // Send an empty InitialRSCPayload to the server component renderer\n    // The data will be fetched by the client instead.\n    // TODO: In the future, rather than defer the entire hydration payload\n    // to be fetched by the client, we should only defer the client\n    // segments, since those are the only ones whose data is not complete.\n    const emptyReactServerResult =\n      await createReactServerPrerenderResultFromRender(\n        renderFlightStream(ComponentMod, [], clientModules, {\n          filterStackFrame: filterStackFrameForError,\n          onError: serverComponentsErrorHandler,\n        })\n      )\n    const inlinedDataStream = createInlinedDataStream(\n      emptyReactServerResult.consumeAsStream(),\n      nonce,\n      formState\n    )\n    return continueStaticFallbackPrerender(htmlStream, {\n      inlinedDataStream,\n      getServerInsertedHTML,\n      getServerInsertedMetadata,\n      deploymentId,\n    })\n  }\n\n  const inlinedDataStream = createInlinedDataStream(\n    reactServerResult.consumeAsStream(),\n    nonce,\n    formState\n  )\n  return continueStaticPrerender(htmlStream, {\n    inlinedDataStream,\n    getServerInsertedHTML,\n    getServerInsertedMetadata,\n    deploymentId,\n  })\n}\n\nasync function prerenderToStream(\n  req: BaseNextRequest,\n  res: BaseNextResponse,\n  ctx: AppRenderContext,\n  metadata: AppPageRenderResultMetadata,\n  tree: LoaderTree,\n  fallbackRouteParams: OpaqueFallbackRouteParams | null\n): Promise<PrerenderToStreamResult> {\n  // When prerendering formState is always null. We still include it\n  // because some shared APIs expect a formState value and this is slightly\n  // more explicit than making it an optional function argument\n  const formState = null\n\n  const {\n    assetPrefix,\n    getDynamicParamFromSegment,\n    implicitTags,\n    nonce,\n    pagePath,\n    renderOpts,\n    workStore,\n  } = ctx\n\n  const {\n    basePath,\n    buildManifest,\n    ComponentMod,\n    crossOrigin,\n    experimental,\n    isDebugDynamicAccesses,\n    isBuildTimePrerendering = false,\n    onInstrumentationRequestError,\n    page,\n    reactMaxHeadersLength,\n    subresourceIntegrityManifest,\n    cacheComponents,\n  } = renderOpts\n\n  const { cachedNavigations } = renderOpts.experimental\n\n  const renderFlightStream = process.env.__NEXT_USE_NODE_STREAMS\n    ? renderToNodeFlightStream\n    : renderToWebFlightStream\n  const renderFizzStream = process.env.__NEXT_USE_NODE_STREAMS\n    ? renderToNodeFizzStream\n    : renderToWebFizzStream\n  const createInlinedDataStream = process.env.__NEXT_USE_NODE_STREAMS\n    ? createNodeInlinedDataStream\n    : createWebInlinedDataStream\n\n  const allowEmptyStaticShell =\n    (renderOpts.allowEmptyStaticShell ?? false) ||\n    (await isPageAllowedToBlock(tree))\n\n  const rootParams = getRootParams(tree, getDynamicParamFromSegment)\n\n  const { ServerInsertedHTMLProvider, renderServerInsertedHTML } =\n    createServerInsertedHTML()\n  const getServerInsertedMetadata = createServerInsertedMetadata(nonce)\n\n  const tracingMetadata = getTracedMetadata(\n    getTracer().getTracePropagationData(),\n    experimental.clientTraceMetadata\n  )\n\n  const polyfills: JSX.IntrinsicElements['script'][] =\n    buildManifest.polyfillFiles\n      .filter(\n        (polyfill) =>\n          polyfill.endsWith('.js') && !polyfill.endsWith('.module.js')\n      )\n      .map((polyfill) => ({\n        src: `${assetPrefix}/_next/${polyfill}${getAssetQueryString(\n          ctx,\n          false\n        )}`,\n        integrity: subresourceIntegrityManifest?.[polyfill],\n        crossOrigin,\n        noModule: true,\n        nonce,\n      }))\n\n  const [preinitScripts, bootstrapScript] = getRequiredScripts(\n    buildManifest,\n    // Why is assetPrefix optional on renderOpts?\n    // @TODO make it default empty string on renderOpts and get rid of it from ctx\n    assetPrefix,\n    crossOrigin,\n    subresourceIntegrityManifest,\n    getAssetQueryString(ctx, true),\n    nonce,\n    page\n  )\n\n  let bootstrapScriptContent =\n    buildManifest.pagesChunkGroupBootstrapParams &&\n    buildManifest.chunkLoadingGlobal\n      ? getTurbopackChunkGroupBootstrap(\n          buildManifest.pagesChunkGroupBootstrapParams,\n          buildManifest.chunkLoadingGlobal,\n          [page]\n        )\n      : undefined\n\n  // Instant Navigation Testing API: when exposed, embed the cookie-guarded\n  // bootstrap into the prerendered prelude so the cached static shell carries\n  // it and it runs before the client bootstrap module reads\n  // self.__next_instant_test.\n  if (renderOpts.experimental.exposeTestingApi) {\n    bootstrapScriptContent =\n      (bootstrapScriptContent ? `${bootstrapScriptContent};` : '') +\n      (await getInstantTestBootstrapScriptContent())\n  }\n\n  // In development the static shell is served without a dynamic resume, so it\n  // must carry the debug-channel request id (self.__next_r) itself for\n  // app-index to initialize the HMR/debug channel. renderToStream provides this\n  // for dynamic renders; prepend it here so it runs before the bootstrap\n  // module.\n  if (process.env.__NEXT_DEV_SERVER && bootstrapScriptContent) {\n    bootstrapScriptContent =\n      `self.__next_r=${JSON.stringify(ctx.requestId ?? crypto.randomUUID())};` +\n      bootstrapScriptContent\n  }\n\n  const { reactServerErrorsByDigest } = workStore\n  // We don't report errors during prerendering through our instrumentation hooks\n  const reportErrors = !experimental.isRoutePPREnabled\n  function onHTMLRenderRSCError(err: DigestedError, silenceLog: boolean) {\n    if (reportErrors) {\n      return onInstrumentationRequestError?.(\n        err,\n        req,\n        createErrorContext(ctx, 'react-server-components'),\n        silenceLog\n      )\n    }\n  }\n  const serverComponentsErrorHandler = createReactServerErrorHandler(\n    process.env.NODE_ENV === 'development',\n    isBuildTimePrerendering,\n    reactServerErrorsByDigest,\n    onHTMLRenderRSCError\n  )\n\n  function onHTMLRenderSSRError(err: DigestedError) {\n    if (reportErrors) {\n      // We don't need to silence logs here. onHTMLRenderSSRError won't be\n      // called at all if the error was logged before in the RSC error handler.\n      const silenceLog = false\n      return onInstrumentationRequestError?.(\n        err,\n        req,\n        createErrorContext(ctx, 'server-rendering'),\n        silenceLog\n      )\n    }\n  }\n  const allCapturedErrors: Array<unknown> = []\n  const htmlRendererErrorHandler = createHTMLErrorHandler(\n    process.env.NODE_ENV === 'development',\n    isBuildTimePrerendering,\n    reactServerErrorsByDigest,\n    allCapturedErrors,\n    onHTMLRenderSSRError\n  )\n\n  let reactServerPrerenderResult: null | ReactServerPrerenderResult = null\n  let reactServerPrerenderResultIsDynamic: null | boolean = null\n  let reactServerResumeDataCache: ResumeDataCache | null = null\n  let reactServerPrerenderStore: null | PrerenderStore = null\n  const setMetadataHeader = (name: string) => {\n    metadata.headers ??= {}\n    metadata.headers[name] = res.getHeader(name)\n  }\n  const setHeader = (name: string, value: string | string[]) => {\n    res.setHeader(name, value)\n    setMetadataHeader(name)\n    return res\n  }\n  const appendHeader = (name: string, value: string | string[]) => {\n    if (Array.isArray(value)) {\n      value.forEach((item) => {\n        res.appendHeader(name, item)\n      })\n    } else {\n      res.appendHeader(name, value)\n    }\n    setMetadataHeader(name)\n  }\n\n  const selectStaleTime = createSelectStaleTime(experimental)\n  const { clientModules } = getClientReferenceManifest()\n\n  let prerenderStore: PrerenderStore | null = null\n\n  try {\n    if (cacheComponents) {\n      /**\n       * cacheComponents with PPR\n       *\n       * The general approach is to render the RSC stream first allowing any cache reads to resolve.\n       * Once we have settled all cache reads we restart the render and abort after a single Task.\n       *\n       * Unlike with the non PPR case we can't synchronously abort the render when a dynamic API is used\n       * during the initial render because we need to ensure all caches can be filled as part of the initial Task\n       * and a synchronous abort might prevent us from filling all caches.\n       *\n       * Once the render is complete we allow the SSR render to finish and use a combination of the postponed state\n       * and the reactServerIsDynamic value to determine how to treat the resulting render\n       */\n\n      // The prerender controller represents the lifetime of the prerender. It\n      // will be aborted when a task is complete or a synchronously aborting API\n      // is called. Notably, during prospective prerenders, this does not\n      // actually terminate the prerender itself, which will continue until all\n      // caches are filled.\n      const initialServerPrerenderController = new AbortController()\n\n      // This controller is used to abort the React prerender.\n      const initialServerReactController = new AbortController()\n\n      // This controller represents the lifetime of the React prerender. Its\n      // signal can be used for any I/O operation to abort the I/O and/or to\n      // reject, when prerendering aborts. This includes our own hanging\n      // promises for accessing request data, and for fetch calls. It might be\n      // replaced in the future by React.cacheSignal(). It's aborted after the\n      // React controller, so that no pending I/O can register abort listeners\n      // that are called before React's abort listener is called. This ensures\n      // that pending I/O is not rejected too early when aborting the prerender.\n      // Notably, during the prospective prerender, it is different from the\n      // prerender controller because we don't want to end the React prerender\n      // until all caches are filled.\n      const initialServerRenderController = new AbortController()\n\n      // The cacheSignal helps us track whether caches are still filling or we are ready\n      // to cut the render off.\n      const cacheSignal = new CacheSignal()\n\n      // If a prefilled immutable render resume data cache is provided, e.g.\n      // when prerendering an optional fallback shell after having prerendered\n      // pages with defined params, we use this instead of a mutable prerender\n      // resume data cache.\n      const resumeDataCache: ResumeDataCache =\n        renderOpts.renderResumeDataCache ?? createPrerenderResumeDataCache()\n      reactServerPrerenderResultIsDynamic = null\n      reactServerResumeDataCache = resumeDataCache\n      reactServerPrerenderStore = null\n\n      const initialServerPayloadPrerenderStore: PrerenderStore = {\n        type: 'prerender',\n        phase: 'render',\n        rootParams,\n        fallbackRouteParams,\n        implicitTags,\n        // While this render signal isn't going to be used to abort a React render while getting the RSC payload\n        // various request data APIs bind to this controller to reject after completion.\n        renderSignal: initialServerRenderController.signal,\n        // When we generate the RSC payload we might abort this controller due to sync IO\n        // but we don't actually care about sync IO in this phase so we use a throw away controller\n        // that isn't connected to anything\n        controller: new AbortController(),\n        stagedRendering: null, // We don't need staging in the initial render\n        // During the initial prerender we need to track all cache reads to ensure\n        // we render long enough to fill every cache it is possible to visit during\n        // the final prerender.\n        cacheSignal,\n        dynamicTracking: null,\n        revalidate: INFINITE_CACHE,\n        expire: INFINITE_CACHE,\n        stale: INFINITE_CACHE,\n        tags: [...implicitTags.tags],\n        resumeDataCache,\n        hmrRefreshHash: undefined,\n        // We don't track vary params during initial prerender, only the final one\n        varyParamsAccumulator: null,\n        runtimeDataAccessed: null,\n        shouldAttemptStaticPrefetch: null,\n        isFallbackUpgradeable: renderOpts.isFallbackUpgradeable === true,\n      }\n\n      // We're not going to use the result of this render because the only time it could be used\n      // is if it completes in a microtask and that's likely very rare for any non-trivial app\n      const initialServerPayload = await workUnitAsyncStorage.run(\n        initialServerPayloadPrerenderStore,\n        getRSCPayload,\n        tree,\n        ctx,\n        { is404: res.statusCode === 404 }\n      )\n\n      const initialServerPrerenderStore: PrerenderStore = (prerenderStore = {\n        type: 'prerender',\n        phase: 'render',\n        rootParams,\n        fallbackRouteParams,\n        implicitTags,\n        renderSignal: initialServerRenderController.signal,\n        controller: initialServerPrerenderController,\n        stagedRendering: null, // We don't need staging in the initial render\n        // During the initial prerender we need to track all cache reads to ensure\n        // we render long enough to fill every cache it is possible to visit during\n        // the final prerender.\n        cacheSignal,\n        dynamicTracking: null,\n        revalidate: INFINITE_CACHE,\n        expire: INFINITE_CACHE,\n        stale: INFINITE_CACHE,\n        tags: [...implicitTags.tags],\n        resumeDataCache,\n        hmrRefreshHash: undefined,\n        // We don't track vary params during initial prerender, only the final one\n        varyParamsAccumulator: null,\n        runtimeDataAccessed: null,\n        shouldAttemptStaticPrefetch: null,\n        isFallbackUpgradeable: renderOpts.isFallbackUpgradeable === true,\n      })\n\n      const initialPrerenderOptions = {\n        filterStackFrame,\n        onError: (err: unknown) => {\n          const digest = getDigestForWellKnownError(err)\n\n          if (digest) {\n            return digest\n          }\n\n          if (isReactLargeShellError(err)) {\n            // TODO: Aggregate\n            console.error(err)\n            return undefined\n          }\n\n          if (initialServerPrerenderController.signal.aborted) {\n            // The render aborted before this error was handled which indicates\n            // the error is caused by unfinished components within the render\n            return\n          } else if (\n            process.env.NEXT_DEBUG_BUILD ||\n            process.env.__NEXT_VERBOSE_LOGGING\n          ) {\n            printDebugThrownValueForProspectiveRender(\n              err,\n              workStore.route,\n              Phase.ProspectiveRender\n            )\n          }\n        },\n        // We don't want to stop rendering until the cacheSignal is complete so we pass\n        // a different signal to this render call than is used by dynamic APIs to signify\n        // transitioning out of the prerender environment\n        signal: initialServerReactController.signal,\n      }\n\n      const pendingInitialServerResult = workUnitAsyncStorage.run(\n        initialServerPrerenderStore,\n        getServerPrerender(ComponentMod),\n        initialServerPayload,\n        clientModules,\n        initialPrerenderOptions\n      )\n\n      // The listener to abort our own render controller must be added after\n      // React has added its listener, to ensure that pending I/O is not\n      // aborted/rejected too early.\n      initialServerReactController.signal.addEventListener(\n        'abort',\n        () => {\n          initialServerRenderController.abort()\n          initialServerPrerenderController.abort()\n        },\n        { once: true }\n      )\n\n      // Wait for all caches to be finished filling and for async imports to resolve\n      trackPendingModules(cacheSignal)\n      await cacheSignal.cacheReady()\n\n      initialServerReactController.abort()\n\n      // We don't need to continue the prerender process if we already\n      // detected invalid dynamic usage in the initial prerender phase.\n      if (workStore.invalidDynamicUsageError) {\n        logDisallowedDynamicError(workStore, workStore.invalidDynamicUsageError)\n        throw new StaticGenBailoutError()\n      }\n\n      let initialServerResult\n      try {\n        initialServerResult = await createReactServerPrerenderResult(\n          pendingInitialServerResult\n        )\n      } catch (err) {\n        if (\n          initialServerReactController.signal.aborted ||\n          initialServerPrerenderController.signal.aborted\n        ) {\n          // These are expected errors that might error the prerender. we ignore them.\n        } else if (\n          process.env.NEXT_DEBUG_BUILD ||\n          process.env.__NEXT_VERBOSE_LOGGING\n        ) {\n          // We don't normally log these errors because we are going to retry anyway but\n          // it can be useful for debugging Next.js itself to get visibility here when needed\n          printDebugThrownValueForProspectiveRender(\n            err,\n            workStore.route,\n            Phase.ProspectiveRender\n          )\n        }\n      }\n\n      if (initialServerResult) {\n        const initialClientPrerenderController = new AbortController()\n        const initialClientReactController = new AbortController()\n        const initialClientRenderController = new AbortController()\n\n        const initialClientPrerenderStore: PrerenderStore = {\n          type: 'prerender-client',\n          phase: 'render',\n          rootParams,\n          fallbackRouteParams,\n          implicitTags,\n          renderSignal: initialClientRenderController.signal,\n          controller: initialClientPrerenderController,\n          // For HTML Generation the only cache tracked activity\n          // is module loading, which has it's own cache signal\n          cacheSignal: null,\n          dynamicTracking: null,\n          revalidate: INFINITE_CACHE,\n          expire: INFINITE_CACHE,\n          stale: INFINITE_CACHE,\n          tags: [...implicitTags.tags],\n          resumeDataCache,\n          hmrRefreshHash: undefined,\n          // Client prerenders don't track server param access\n          varyParamsAccumulator: null,\n        }\n\n        const pendingInitialClientResult = workUnitAsyncStorage.run(\n          initialClientPrerenderStore,\n          getClientPrerender,\n          // eslint-disable-next-line @next/internal/no-ambiguous-jsx\n          <App\n            reactServerStream={initialServerResult.asUnclosingStream()}\n            reactDebugStream={undefined}\n            debugEndTime={undefined}\n            preinitScripts={preinitScripts}\n            ServerInsertedHTMLProvider={ServerInsertedHTMLProvider}\n            nonce={nonce}\n            images={ctx.renderOpts.images}\n          />,\n          {\n            signal: initialClientReactController.signal,\n            onError: (err: unknown) => {\n              const digest = getDigestForWellKnownError(err)\n\n              if (digest) {\n                return digest\n              }\n\n              if (isReactLargeShellError(err)) {\n                // TODO: Aggregate\n                console.error(err)\n                return undefined\n              }\n\n              if (initialClientReactController.signal.aborted) {\n                // These are expected errors that might error the prerender. we ignore them.\n              } else if (\n                process.env.NEXT_DEBUG_BUILD ||\n                process.env.__NEXT_VERBOSE_LOGGING\n              ) {\n                // We don't normally log these errors because we are going to retry anyway but\n                // it can be useful for debugging Next.js itself to get visibility here when needed\n                printDebugThrownValueForProspectiveRender(\n                  err,\n                  workStore.route,\n                  Phase.ProspectiveRender\n                )\n              }\n            },\n            bootstrapScriptContent,\n            bootstrapScripts: [bootstrapScript],\n          }\n        )\n\n        // The listener to abort our own render controller must be added after\n        // React has added its listener, to ensure that pending I/O is not\n        // aborted/rejected too early.\n        initialClientReactController.signal.addEventListener(\n          'abort',\n          () => {\n            initialClientRenderController.abort()\n          },\n          { once: true }\n        )\n\n        pendingInitialClientResult.catch((err: unknown) => {\n          if (\n            initialClientReactController.signal.aborted ||\n            isPrerenderInterruptedError(err)\n          ) {\n            // These are expected errors that might error the prerender. we ignore them.\n          } else if (\n            process.env.NEXT_DEBUG_BUILD ||\n            process.env.__NEXT_VERBOSE_LOGGING\n          ) {\n            // We don't normally log these errors because we are going to retry anyway but\n            // it can be useful for debugging Next.js itself to get visibility here when needed\n            printDebugThrownValueForProspectiveRender(\n              err,\n              workStore.route,\n              Phase.ProspectiveRender\n            )\n          }\n        })\n\n        // This is mostly needed for dynamic `import()`s in client components.\n        // Promises passed to client were already awaited above (assuming that they came from cached functions)\n        trackPendingModules(cacheSignal)\n        await cacheSignal.cacheReady()\n        workUnitAsyncStorage.run(\n          initialClientPrerenderStore,\n          initialClientReactController.abort.bind(initialClientReactController)\n        )\n      }\n\n      const finalServerReactController = new AbortController()\n      const finalServerRenderController = new AbortController()\n\n      const varyParamsAccumulator = createResponseVaryParamsAccumulator()\n\n      const finalStageController = new StagedRenderingController({\n        abortSignal: finalServerRenderController.signal,\n        abandonController: null,\n        syncIO: SyncIOMode.AllowedInDynamic,\n        finalStage: RenderStage.Static,\n      })\n\n      // Records runtime data accesses from the payload and render stores\n      // below into the RSC payload (as `u`), resolved `true` at the moment\n      // of first access so the fulfillment row is serialized at the stream\n      // position where it happened. Used when generating per-segment\n      // prefetch responses. Request data props (params, searchParams) are\n      // created while the RSC payload is constructed, under the payload\n      // store; both stores share the same promise so it observes accesses\n      // from both.\n      const runtimeDataAccessed = createPromiseWithResolvers<boolean>()\n\n      // Companion cell holding this prerender's static-prefetch measurement\n      // directly — the value that becomes the route's build-constant hint:\n      // starts true, and a disqualifying runtime-data access flips it false\n      // — fallback-param accesses on an upgradeable route don't (see\n      // trackRuntimeDataAccessed, which applies the rule at access time).\n      // Read after the prerender settles by\n      // collectSegmentData below. Shared between both stores for the same\n      // reason as the promise.\n      const shouldAttemptStaticPrefetch = { current: true }\n\n      const finalServerPayloadPrerenderStore: PrerenderStoreModernServer = {\n        type: 'prerender',\n        phase: 'render',\n        rootParams,\n        fallbackRouteParams,\n        implicitTags,\n        // While this render signal isn't going to be used to abort a React render while getting the RSC payload\n        // various request data APIs bind to this controller to reject after completion.\n        renderSignal: finalServerRenderController.signal,\n        // When we generate the RSC payload we might abort this controller due to sync IO\n        // but we don't actually care about sync IO in this phase so we use a throw away controller\n        // that isn't connected to anything\n        controller: new AbortController(),\n        // NOTE: we're not using the stage controller for sync IO tracking,\n        // so this doesn't break the \"throwaway abort controller\" trick above.\n        stagedRendering: finalStageController,\n        // All caches we could read must already be filled so no tracking is necessary\n        cacheSignal: null,\n        dynamicTracking: null,\n        revalidate: INFINITE_CACHE,\n        expire: INFINITE_CACHE,\n        stale: INFINITE_CACHE,\n        tags: [...implicitTags.tags],\n        resumeDataCache,\n        hmrRefreshHash: undefined,\n        varyParamsAccumulator,\n        runtimeDataAccessed,\n        shouldAttemptStaticPrefetch,\n        isFallbackUpgradeable: renderOpts.isFallbackUpgradeable === true,\n      }\n\n      const shellByteLengthDeferred = createPromiseWithResolvers<\n        number | null\n      >()\n\n      const finalServerPayload = await workUnitAsyncStorage.run(\n        finalServerPayloadPrerenderStore,\n        getRSCPayload,\n        tree,\n        ctx,\n        {\n          is404: res.statusCode === 404,\n          shellByteLengthPromise: shellByteLengthDeferred.promise,\n        }\n      )\n\n      let staleTimeIterable: StaleTimeIterable | undefined\n      if (cachedNavigations) {\n        staleTimeIterable = new StaleTimeIterable()\n        finalServerPayload.s = staleTimeIterable\n      }\n\n      if (shouldGenerateStaticFlightData(workStore)) {\n        // Embed the runtime data access tracking in the payload so\n        // collectSegmentData can replay it per stage. Only needed when the\n        // Flight data will be decomposed into segment prefetches below.\n        finalServerPayload.u = runtimeDataAccessed.promise\n      }\n\n      const serverDynamicTracking = createDynamicTrackingState(\n        isDebugDynamicAccesses\n      )\n      let resultIsPartial = false\n\n      const finalServerPrerenderStore: PrerenderStore = (prerenderStore = {\n        type: 'prerender',\n        phase: 'render',\n        rootParams,\n        fallbackRouteParams,\n        implicitTags,\n        renderSignal: finalServerRenderController.signal,\n        controller: finalServerReactController,\n        stagedRendering: finalStageController,\n        // All caches we could read must already be filled so no tracking is necessary\n        cacheSignal: null,\n        dynamicTracking: serverDynamicTracking,\n        revalidate: INFINITE_CACHE,\n        expire: INFINITE_CACHE,\n        stale: INFINITE_CACHE,\n        tags: [...implicitTags.tags],\n        resumeDataCache,\n        hmrRefreshHash: undefined,\n        varyParamsAccumulator,\n        runtimeDataAccessed,\n        shouldAttemptStaticPrefetch,\n        isFallbackUpgradeable: renderOpts.isFallbackUpgradeable === true,\n      })\n\n      if (staleTimeIterable !== undefined) {\n        trackStaleTime(\n          finalServerPrerenderStore,\n          staleTimeIterable,\n          selectStaleTime\n        )\n      }\n\n      const streamState = createStreamPendingState()\n      const collectedChunks = createPrerenderChunksAccumulator()\n      const collectedChunksByStage = createStageChunksAccumulator()\n      const collectChunk = (chunk: Uint8Array) => {\n        collectPrerenderChunk(\n          collectedChunks,\n          finalServerReactController.signal,\n          chunk\n        )\n        collectStageChunk(\n          collectedChunksByStage,\n          finalStageController.currentStage,\n          chunk\n        )\n      }\n\n      let didHandleUnexpectedAbort = false\n      /**\n       * @returns - whether or not the task should be skipped\n       * because the render was already aborted.\n       * */\n      const checkUnexpectedAbort = (): boolean => {\n        if (finalServerReactController.signal.aborted) {\n          // If the server controller is already aborted, then we must have encountered sync IO\n          if (!didHandleUnexpectedAbort) {\n            didHandleUnexpectedAbort = true\n            onUnexpectedAbort()\n          }\n          return true\n        }\n\n        // Not aborted.\n        return false\n      }\n\n      const onUnexpectedAbort = () => {\n        resultIsPartial = true\n\n        // FIXME(NAR-810): If we're already aborted due to Sync IO, there should be no need to\n        // finish the accumulators. However, it seems like in `--debug-prerender`\n        // the stream will stay open if we don't settle these here.\n        if (process.env.NODE_ENV === 'development') {\n          if (staleTimeIterable !== undefined) {\n            staleTimeIterable.close()\n          }\n          runtimeDataAccessed.resolve(false)\n          finishAccumulatingVaryParams(varyParamsAccumulator)\n        }\n      }\n\n      let debugEndTime: number | undefined = undefined\n      let didLinkDataUnblockNewContent = false\n\n      await runInSequentialTasks(\n        async () => {\n          if (process.env.NODE_ENV === 'development') {\n            // The end time should be tracked whenever we abort.\n            // We defensively do this before React runs its abort listener,\n            // although in practice this shouldn't matter.\n            finalServerReactController.signal.addEventListener(\n              'abort',\n              () => {\n                debugEndTime = performance.timeOrigin + performance.now()\n              },\n              { once: true }\n            )\n          }\n\n          finalStageController.advanceStage(RenderStage.ShellStatic)\n\n          let stream = workUnitAsyncStorage.run(\n            finalServerPrerenderStore,\n            ComponentMod.renderToReadableStream,\n            finalServerPayload,\n            clientModules,\n            {\n              filterStackFrame,\n              onError: (err: unknown) => {\n                return serverComponentsErrorHandler(err)\n              },\n              signal: finalServerReactController.signal,\n            }\n          )\n\n          // The listener to abort our own render controller must be added\n          // after React has added its listener, to ensure that pending I/O\n          // is not aborted/rejected too early.\n          finalServerReactController.signal.addEventListener(\n            'abort',\n            () => {\n              finalServerRenderController.abort()\n            },\n            { once: true }\n          )\n\n          // Note: this await will only resolve after the last task (unless sync IO aborts the render earlier)\n          // We await it here so that if the stream errors, it's not an unhandled rejection.\n          await iterateStreamingPrerenderChunks(\n            stream,\n            finalServerReactController.signal,\n            collectChunk,\n            streamState\n          )\n        },\n        () => {\n          if (checkUnexpectedAbort()) return\n          finalStageController.advanceStage(RenderStage.Static)\n        },\n        () => {\n          if (checkUnexpectedAbort()) return\n\n          // Finish the accumulators. We need to wait for Flight to flush the result into the stream,\n          // which is scheduled in a (fast) immediate, so we do this in a separate task\n          // (fast immediates will be drained at the end of the task, so in the next task we know we're done flushing)\n\n          // If new chunks were emitted in the static stage\n          // (after unblocking link data, i.e. static params)\n          // then the prerender uses link data.\n          // NOTE: we must capture this *before* resolving staleTime/varyParams,\n          // which always emit new static chunks.\n          didLinkDataUnblockNewContent =\n            collectedChunksByStage.staticChunks.length >\n            collectedChunksByStage.shellStaticChunks.length\n\n          // Now that the prerendering is complete, we know the final stale\n          // time and vary params. Close the stale time iterable and resolve\n          // the vary params thenable so Flight can serialize their values\n          // into the stream. The timing here is important: both were\n          // included in the Flight payload, but they can only be serialized\n          // at the very end, after all the components have finished.\n          if (staleTimeIterable !== undefined) {\n            staleTimeIterable.close()\n          }\n          // Idempotent: a no-op if a runtime data access already resolved it\n          // `true`. The `false` row lands here, after all stage content.\n          runtimeDataAccessed.resolve(false)\n          finishAccumulatingVaryParams(varyParamsAccumulator)\n\n          shellByteLengthDeferred.resolve(\n            didLinkDataUnblockNewContent\n              ? collectedChunksByStage.shellStaticChunks.reduce(\n                  (acc, chunk) => acc + chunk.byteLength,\n                  0\n                )\n              : null\n          )\n        },\n        () => {\n          if (checkUnexpectedAbort()) return\n\n          if (streamState.isPending) {\n            // If prerenderIsPending then we have blocked for longer than a Task and we assume\n            // there is something unfinished.\n            resultIsPartial = true\n          }\n\n          workUnitAsyncStorage.run(\n            finalServerPrerenderStore,\n            finalServerReactController.abort.bind(finalServerReactController)\n          )\n        }\n      )\n\n      // If a sync IO error occurred, there's no point continuing.\n      // NOTE: this early exit is load-bearing. The way we simulate a halt\n      // in a render (ignoring all chunks emitted after an abort)\n      // can lead to a blocked root chunk (if it didn't flush before the abort).\n      // This means that deserializing the RSC payload can hang in unexpected places --\n      // normally, we can at least get the outer object with hanging promises inside.\n      throwIfSyncIOUsed(workStore, serverDynamicTracking)\n\n      const reactServerResult = (reactServerPrerenderResult =\n        new ReactServerPrerenderResult(collectedChunks.prerenderChunks))\n      reactServerPrerenderResultIsDynamic = resultIsPartial\n      reactServerPrerenderStore = finalServerPrerenderStore\n\n      if (shouldGenerateStaticFlightData(workStore)) {\n        metadata.flightData = Buffer.concat(\n          cachedNavigations\n            ? prependIsPartialByteToChunks(\n                reactServerResult.asChunks(),\n                resultIsPartial\n              )\n            : reactServerResult.asChunks()\n        )\n\n        // collectSegmentData needs the raw flight data without the marker byte.\n        const flightData = cachedNavigations\n          ? metadata.flightData.subarray(1)\n          : metadata.flightData\n\n        await collectSegmentData(\n          flightData,\n          finalServerPrerenderStore,\n          ComponentMod,\n          renderOpts,\n          ctx.pagePath,\n          metadata\n        )\n      }\n\n      const clientDynamicTracking = createDynamicTrackingState(\n        isDebugDynamicAccesses\n      )\n\n      const finalClientReactController = new AbortController()\n      const finalClientRenderController = new AbortController()\n\n      const finalClientPrerenderStore: PrerenderStore = {\n        type: 'prerender-client',\n        phase: 'render',\n        rootParams,\n        fallbackRouteParams,\n        implicitTags,\n        renderSignal: finalClientRenderController.signal,\n        controller: finalClientReactController,\n        // No APIs require a cacheSignal through the workUnitStore during the HTML prerender\n        cacheSignal: null,\n        dynamicTracking: clientDynamicTracking,\n        revalidate: INFINITE_CACHE,\n        expire: INFINITE_CACHE,\n        stale: INFINITE_CACHE,\n        tags: [...implicitTags.tags],\n        resumeDataCache,\n        hmrRefreshHash: undefined,\n        // Client prerenders don't track server param access\n        varyParamsAccumulator: null,\n      }\n\n      let dynamicValidation = createDynamicValidationState()\n\n      const finalClientOnHeaders = createOnHeadersCallback(appendHeader)\n\n      let { prelude: unprocessedPrelude, postponed } =\n        await runInSequentialTasks(\n          () => {\n            const stream =\n              process.env.NODE_ENV === 'development' &&\n              collectedChunks.allChunks\n                ? createNodeStreamWithLateRelease(\n                    collectedChunks.prerenderChunks,\n                    collectedChunks.allChunks,\n                    finalClientReactController.signal\n                  )\n                : reactServerResult.asUnclosingStream()\n\n            const pendingFinalClientResult = workUnitAsyncStorage.run(\n              finalClientPrerenderStore,\n              getClientPrerender,\n              // eslint-disable-next-line @next/internal/no-ambiguous-jsx\n              <App\n                reactServerStream={stream}\n                reactDebugStream={undefined}\n                debugEndTime={debugEndTime}\n                preinitScripts={preinitScripts}\n                ServerInsertedHTMLProvider={ServerInsertedHTMLProvider}\n                nonce={nonce}\n                images={ctx.renderOpts.images}\n              />,\n              {\n                signal: finalClientReactController.signal,\n                onError: (err: unknown, errorInfo: ErrorInfo) => {\n                  if (\n                    isPrerenderInterruptedError(err) ||\n                    finalClientReactController.signal.aborted\n                  ) {\n                    const componentStack: string | undefined = (\n                      errorInfo as any\n                    ).componentStack\n                    if (typeof componentStack === 'string') {\n                      trackAllowedDynamicAccess(\n                        err,\n                        workStore,\n                        componentStack,\n                        dynamicValidation,\n                        clientDynamicTracking\n                      )\n                    }\n                    return\n                  }\n\n                  return htmlRendererErrorHandler(err, errorInfo)\n                },\n                onHeaders: finalClientOnHeaders,\n                maxHeadersLength: reactMaxHeadersLength,\n                bootstrapScriptContent,\n                bootstrapScripts: [bootstrapScript],\n              }\n            )\n\n            // The listener to abort our own render controller must be added\n            // after React has added its listener, to ensure that pending I/O is\n            // not aborted/rejected too early.\n            finalClientReactController.signal.addEventListener(\n              'abort',\n              () => {\n                finalClientRenderController.abort()\n              },\n              { once: true }\n            )\n\n            return pendingFinalClientResult\n          },\n          () => {\n            workUnitAsyncStorage.run(\n              finalClientPrerenderStore,\n              finalClientReactController.abort.bind(finalClientReactController)\n            )\n          }\n        )\n\n      metadata.hasPendingUi = postponed != null\n\n      const { prelude, preludeIsEmpty } =\n        await processPreludeOp(unprocessedPrelude)\n\n      throwIfDisallowedDynamic(\n        workStore,\n        preludeIsEmpty ? PreludeState.Empty : PreludeState.Full,\n        dynamicValidation,\n        serverDynamicTracking,\n        allowEmptyStaticShell\n      )\n\n      const getServerInsertedHTML = makeGetServerInsertedHTML({\n        polyfills,\n        renderServerInsertedHTML,\n        serverCapturedErrors: allCapturedErrors,\n        basePath,\n        tracingMetadata: tracingMetadata,\n      })\n\n      let htmlStream: AnyStream = prelude\n      if (resultIsPartial) {\n        if (postponed != null) {\n          metadata.postponed = await getDynamicHTMLPostponedState(\n            postponed,\n            preludeIsEmpty\n              ? DynamicHTMLPreludeState.Empty\n              : DynamicHTMLPreludeState.Full,\n            fallbackRouteParams,\n            resumeDataCache,\n            cacheComponents\n          )\n        } else {\n          metadata.postponed = await getDynamicDataPostponedState(\n            resumeDataCache,\n            cacheComponents\n          )\n        }\n        reactServerResult.consume()\n        return {\n          digestErrorsMap: reactServerErrorsByDigest,\n          ssrErrors: allCapturedErrors,\n          stream: await continueDynamicPrerender(htmlStream, {\n            getServerInsertedHTML,\n            getServerInsertedMetadata,\n            deploymentId: ctx.sharedContext.deploymentId,\n          }),\n          dynamicAccess: consumeDynamicAccess(\n            serverDynamicTracking,\n            clientDynamicTracking\n          ),\n          // TODO: Should this include the SSR pass?\n          collectedRevalidate: finalServerPrerenderStore.revalidate,\n          collectedExpire: finalServerPrerenderStore.expire,\n          collectedStale: selectStaleTime(finalServerPrerenderStore.stale),\n          collectedTags: finalServerPrerenderStore.tags,\n          renderResumeDataCache: createRenderResumeDataCache(resumeDataCache),\n        }\n      } else if (postponed != null) {\n        // We postponed but nothing dynamic was used. We resume the render now and immediately abort it\n        // so we can set all the postponed boundaries to client render mode before we store the HTML response\n        const foreverStream = createPendingStream()\n        const resumePrelude = await workUnitAsyncStorage.run(\n          finalServerPrerenderStore,\n          resumeAndAbort,\n          // eslint-disable-next-line @next/internal/no-ambiguous-jsx\n          <App\n            reactServerStream={foreverStream}\n            reactDebugStream={undefined}\n            debugEndTime={undefined}\n            preinitScripts={() => {}}\n            ServerInsertedHTMLProvider={ServerInsertedHTMLProvider}\n            nonce={nonce}\n            images={ctx.renderOpts.images}\n          />,\n          JSON.parse(JSON.stringify(postponed)),\n          {\n            signal: createRenderInBrowserAbortSignal(),\n            onError: htmlRendererErrorHandler,\n            nonce,\n          }\n        )\n        // First we write everything from the prerender, then we write everything from the aborted resume render\n        htmlStream = chainStreams(prelude, resumePrelude)\n      }\n\n      if (workStore.forceDynamic) {\n        throw new StaticGenBailoutError(\n          'Invariant: a Page with `dynamic = \"force-dynamic\"` did not trigger the dynamic pathway. This is a bug in Next.js'\n        )\n      }\n\n      const stream = await continueStaticPrerenderWithInlinedData(\n        htmlStream,\n        reactServerResult,\n        fallbackRouteParams,\n        createInlinedDataStream,\n        formState,\n        nonce,\n        getServerInsertedHTML,\n        getServerInsertedMetadata,\n        ctx.sharedContext.deploymentId,\n        ComponentMod,\n        renderFlightStream,\n        clientModules,\n        filterStackFrame,\n        serverComponentsErrorHandler\n      )\n\n      return {\n        digestErrorsMap: reactServerErrorsByDigest,\n        ssrErrors: allCapturedErrors,\n        stream,\n        dynamicAccess: consumeDynamicAccess(\n          serverDynamicTracking,\n          clientDynamicTracking\n        ),\n        collectedRevalidate: finalServerPrerenderStore.revalidate,\n        collectedExpire: finalServerPrerenderStore.expire,\n        collectedStale: selectStaleTime(finalServerPrerenderStore.stale),\n        collectedTags: finalServerPrerenderStore.tags,\n        renderResumeDataCache: createRenderResumeDataCache(resumeDataCache),\n      }\n    } else if (experimental.isRoutePPREnabled) {\n      // We're statically generating with PPR and need to do dynamic tracking\n      let dynamicTracking = createDynamicTrackingState(isDebugDynamicAccesses)\n\n      const resumeDataCache = createPrerenderResumeDataCache()\n      const pprReactServerPrerenderStore: PrerenderStore = (prerenderStore = {\n        type: 'prerender-ppr',\n        phase: 'render',\n        rootParams,\n        fallbackRouteParams,\n        implicitTags,\n        dynamicTracking,\n        revalidate: INFINITE_CACHE,\n        expire: INFINITE_CACHE,\n        stale: INFINITE_CACHE,\n        tags: [...implicitTags.tags],\n        resumeDataCache,\n      })\n      const RSCPayload = await workUnitAsyncStorage.run(\n        pprReactServerPrerenderStore,\n        getRSCPayload,\n        tree,\n        ctx,\n        { is404: res.statusCode === 404 }\n      )\n      let reactServerResult: ReactServerPrerenderResult\n      reactServerResult = reactServerPrerenderResult =\n        await createReactServerPrerenderResultFromRender(\n          workUnitAsyncStorage.run(\n            pprReactServerPrerenderStore,\n            renderFlightStream,\n            ComponentMod,\n            RSCPayload,\n            clientModules,\n            {\n              filterStackFrame,\n              onError: serverComponentsErrorHandler,\n            }\n          )\n        )\n\n      const ssrPrerenderStore: PrerenderStore = {\n        type: 'prerender-ppr',\n        phase: 'render',\n        rootParams,\n        fallbackRouteParams,\n        implicitTags,\n        dynamicTracking,\n        revalidate: INFINITE_CACHE,\n        expire: INFINITE_CACHE,\n        stale: INFINITE_CACHE,\n        tags: [...implicitTags.tags],\n        resumeDataCache,\n      }\n      const pprOnHeaders = createOnHeadersCallback(appendHeader)\n      const { prelude: unprocessedPrelude, postponed } =\n        await workUnitAsyncStorage.run(\n          ssrPrerenderStore,\n          getClientPrerender,\n          // eslint-disable-next-line @next/internal/no-ambiguous-jsx\n          <App\n            reactServerStream={reactServerResult.asUnclosingStream()}\n            reactDebugStream={undefined}\n            debugEndTime={undefined}\n            preinitScripts={preinitScripts}\n            ServerInsertedHTMLProvider={ServerInsertedHTMLProvider}\n            nonce={nonce}\n            images={ctx.renderOpts.images}\n          />,\n          {\n            onError: htmlRendererErrorHandler,\n            onHeaders: pprOnHeaders,\n            maxHeadersLength: reactMaxHeadersLength,\n            bootstrapScriptContent,\n            bootstrapScripts: [bootstrapScript],\n          }\n        )\n\n      metadata.hasPendingUi = postponed != null\n      const getServerInsertedHTML = makeGetServerInsertedHTML({\n        polyfills,\n        renderServerInsertedHTML,\n        serverCapturedErrors: allCapturedErrors,\n        basePath,\n        tracingMetadata: tracingMetadata,\n      })\n\n      // After awaiting here we've waited for the entire RSC render to complete. Crucially this means\n      // that when we detect whether we've used dynamic APIs below we know we'll have picked up even\n      // parts of the React Server render that might not be used in the SSR render.\n      const flightData = await streamToBuffer(reactServerResult.asStream())\n\n      if (shouldGenerateStaticFlightData(workStore)) {\n        metadata.flightData = flightData\n        await collectSegmentData(\n          flightData,\n          ssrPrerenderStore,\n          ComponentMod,\n          renderOpts,\n          ctx.pagePath,\n          metadata\n        )\n      }\n\n      const { prelude, preludeIsEmpty } =\n        await processPreludeOp(unprocessedPrelude)\n\n      /**\n       * When prerendering there are three outcomes to consider\n       *\n       *   Dynamic HTML:      The prerender has dynamic holes (caused by using Next.js Dynamic Rendering APIs)\n       *                      We will need to resume this result when requests are handled and we don't include\n       *                      any server inserted HTML or inlined flight data in the static HTML\n       *\n       *   Dynamic Data:      The prerender has no dynamic holes but dynamic APIs were used. We will not\n       *                      resume this render when requests are handled but we will generate new inlined\n       *                      flight data since it is dynamic and differences may end up reconciling on the client\n       *\n       *   Static:            The prerender has no dynamic holes and no dynamic APIs were used. We statically encode\n       *                      all server inserted HTML and flight data\n       */\n      // First we check if we have any dynamic holes in our HTML prerender\n      if (accessedDynamicData(dynamicTracking.dynamicAccesses)) {\n        if (postponed != null) {\n          // Dynamic HTML case.\n          metadata.postponed = await getDynamicHTMLPostponedState(\n            postponed,\n            preludeIsEmpty\n              ? DynamicHTMLPreludeState.Empty\n              : DynamicHTMLPreludeState.Full,\n            fallbackRouteParams,\n            resumeDataCache,\n            cacheComponents\n          )\n        } else {\n          // Dynamic Data case.\n          metadata.postponed = await getDynamicDataPostponedState(\n            resumeDataCache,\n            cacheComponents\n          )\n        }\n        // Regardless of whether this is the Dynamic HTML or Dynamic Data case we need to ensure we include\n        // server inserted html in the static response because the html that is part of the prerender may depend on it\n        // It is possible in the set of stream transforms for Dynamic HTML vs Dynamic Data may differ but currently both states\n        // require the same set so we unify the code path here\n        reactServerResult.consume()\n        const pprDynamicOpts = {\n          getServerInsertedHTML,\n          getServerInsertedMetadata,\n          deploymentId: ctx.sharedContext.deploymentId,\n        }\n        return {\n          digestErrorsMap: reactServerErrorsByDigest,\n          ssrErrors: allCapturedErrors,\n          stream: await continueDynamicPrerender(prelude, pprDynamicOpts),\n          dynamicAccess: dynamicTracking.dynamicAccesses,\n          // TODO: Should this include the SSR pass?\n          collectedRevalidate: pprReactServerPrerenderStore.revalidate,\n          collectedExpire: pprReactServerPrerenderStore.expire,\n          collectedStale: selectStaleTime(pprReactServerPrerenderStore.stale),\n          collectedTags: pprReactServerPrerenderStore.tags,\n        }\n      } else if (fallbackRouteParams && fallbackRouteParams.size > 0) {\n        // Rendering the fallback case.\n        metadata.postponed = await getDynamicDataPostponedState(\n          resumeDataCache,\n          cacheComponents\n        )\n\n        const pprFallbackDynamicOpts = {\n          getServerInsertedHTML,\n          getServerInsertedMetadata,\n          deploymentId: ctx.sharedContext.deploymentId,\n        }\n        return {\n          digestErrorsMap: reactServerErrorsByDigest,\n          ssrErrors: allCapturedErrors,\n          stream: await continueDynamicPrerender(\n            prelude,\n            pprFallbackDynamicOpts\n          ),\n          dynamicAccess: dynamicTracking.dynamicAccesses,\n          // TODO: Should this include the SSR pass?\n          collectedRevalidate: pprReactServerPrerenderStore.revalidate,\n          collectedExpire: pprReactServerPrerenderStore.expire,\n          collectedStale: selectStaleTime(pprReactServerPrerenderStore.stale),\n          collectedTags: pprReactServerPrerenderStore.tags,\n        }\n      } else {\n        // Static case\n        // We still have not used any dynamic APIs. At this point we can produce an entirely static prerender response\n        if (workStore.forceDynamic) {\n          throw new StaticGenBailoutError(\n            'Invariant: a Page with `dynamic = \"force-dynamic\"` did not trigger the dynamic pathway. This is a bug in Next.js'\n          )\n        }\n\n        let htmlStream: AnyStream = prelude\n        if (postponed != null) {\n          // We postponed but nothing dynamic was used. We resume the render now and immediately abort it\n          // so we can set all the postponed boundaries to client render mode before we store the HTML response\n          const foreverStream = createPendingStream()\n          const resumePrelude = await resumeAndAbort(\n            // eslint-disable-next-line @next/internal/no-ambiguous-jsx\n            <App\n              reactServerStream={foreverStream}\n              reactDebugStream={undefined}\n              debugEndTime={undefined}\n              preinitScripts={() => {}}\n              ServerInsertedHTMLProvider={ServerInsertedHTMLProvider}\n              nonce={nonce}\n              images={ctx.renderOpts.images}\n            />,\n            JSON.parse(JSON.stringify(postponed)),\n            {\n              signal: createRenderInBrowserAbortSignal(),\n              onError: htmlRendererErrorHandler,\n              nonce,\n            }\n          )\n          // First we write everything from the prerender, then we write everything from the aborted resume render\n          htmlStream = chainStreams(prelude, resumePrelude)\n        }\n\n        return {\n          digestErrorsMap: reactServerErrorsByDigest,\n          ssrErrors: allCapturedErrors,\n          stream: await continueStaticPrerender(htmlStream, {\n            inlinedDataStream: createInlinedDataStream(\n              reactServerResult.consumeAsStream(),\n              nonce,\n              formState\n            ),\n            getServerInsertedHTML,\n            getServerInsertedMetadata,\n            deploymentId: ctx.sharedContext.deploymentId,\n          }),\n          dynamicAccess: dynamicTracking.dynamicAccesses,\n          // TODO: Should this include the SSR pass?\n          collectedRevalidate: pprReactServerPrerenderStore.revalidate,\n          collectedExpire: pprReactServerPrerenderStore.expire,\n          collectedStale: selectStaleTime(pprReactServerPrerenderStore.stale),\n          collectedTags: pprReactServerPrerenderStore.tags,\n        }\n      }\n    } else {\n      const prerenderLegacyStore: PrerenderStore = (prerenderStore = {\n        type: 'prerender-legacy',\n        phase: 'render',\n        rootParams,\n        implicitTags,\n        revalidate: INFINITE_CACHE,\n        expire: INFINITE_CACHE,\n        stale: INFINITE_CACHE,\n        tags: [...implicitTags.tags],\n      })\n      // This is a regular static generation. We don't do dynamic tracking because we rely on\n      // the old-school dynamic error handling to bail out of static generation\n      const RSCPayload = await workUnitAsyncStorage.run(\n        prerenderLegacyStore,\n        getRSCPayload,\n        tree,\n        ctx,\n        { is404: res.statusCode === 404 }\n      )\n\n      let reactServerResult: ReactServerPrerenderResult\n      reactServerResult = reactServerPrerenderResult =\n        await createReactServerPrerenderResultFromRender(\n          workUnitAsyncStorage.run(\n            prerenderLegacyStore,\n            renderFlightStream,\n            ComponentMod,\n            RSCPayload,\n            clientModules,\n            {\n              filterStackFrame,\n              onError: serverComponentsErrorHandler,\n            }\n          )\n        )\n\n      const { stream: htmlStream } = await workUnitAsyncStorage.run(\n        prerenderLegacyStore,\n        renderFizzStream,\n        // eslint-disable-next-line @next/internal/no-ambiguous-jsx\n        <App\n          reactServerStream={reactServerResult.asUnclosingStream()}\n          reactDebugStream={undefined}\n          debugEndTime={undefined}\n          preinitScripts={preinitScripts}\n          ServerInsertedHTMLProvider={ServerInsertedHTMLProvider}\n          nonce={nonce}\n          images={ctx.renderOpts.images}\n        />,\n        {\n          onError: htmlRendererErrorHandler,\n          nonce,\n          bootstrapScriptContent,\n          bootstrapScripts: [bootstrapScript],\n        },\n        { waitForAllReady: true }\n      )\n\n      if (shouldGenerateStaticFlightData(workStore)) {\n        const flightData = await streamToBuffer(reactServerResult.asStream())\n        metadata.flightData = flightData\n        await collectSegmentData(\n          flightData,\n          prerenderLegacyStore,\n          ComponentMod,\n          renderOpts,\n          ctx.pagePath,\n          metadata\n        )\n      }\n\n      const getServerInsertedHTML = makeGetServerInsertedHTML({\n        polyfills,\n        renderServerInsertedHTML,\n        serverCapturedErrors: allCapturedErrors,\n        basePath,\n        tracingMetadata: tracingMetadata,\n      })\n      return {\n        digestErrorsMap: reactServerErrorsByDigest,\n        ssrErrors: allCapturedErrors,\n        stream: await continueFizzStream(htmlStream, {\n          inlinedDataStream: createInlinedDataStream(\n            reactServerResult.consumeAsStream(),\n            nonce,\n            formState\n          ),\n          isStaticGeneration: true,\n          getServerInsertedHTML,\n          getServerInsertedMetadata,\n          deploymentId: ctx.sharedContext.deploymentId,\n        }),\n        // TODO: Should this include the SSR pass?\n        collectedRevalidate: prerenderLegacyStore.revalidate,\n        collectedExpire: prerenderLegacyStore.expire,\n        collectedStale: selectStaleTime(prerenderLegacyStore.stale),\n        collectedTags: prerenderLegacyStore.tags,\n      }\n    }\n  } catch (err) {\n    if (\n      isStaticGenBailoutError(err) ||\n      (typeof err === 'object' &&\n        err !== null &&\n        'message' in err &&\n        typeof err.message === 'string' &&\n        err.message.includes(\n          'https://nextjs.org/docs/advanced-features/static-html-export'\n        ))\n    ) {\n      // Ensure that \"next dev\" prints the red error overlay\n      throw err\n    }\n\n    // If this is a static generation error, we need to throw it so that it\n    // can be handled by the caller if we're in static generation mode.\n    if (isDynamicServerError(err)) {\n      throw err\n    }\n\n    // If a bailout made it to this point, it means it wasn't wrapped inside\n    // a suspense boundary.\n    const shouldBailoutToCSR = isBailoutToCSRError(err)\n    if (shouldBailoutToCSR) {\n      const stack = getStackWithoutErrorMessage(err)\n      error(\n        `${err.reason} should be wrapped in a suspense boundary at page \"${pagePath}\". Read more: https://nextjs.org/docs/messages/missing-suspense-with-csr-bailout\\n${stack}`\n      )\n\n      throw err\n    }\n\n    // If we errored when we did not have an RSC stream to read from. This is\n    // not just a render error, we need to throw early.\n    if (reactServerPrerenderResult === null) {\n      throw err\n    }\n    let errorType: MetadataErrorType | 'redirect' | undefined\n    const isHTTPAccessFallback = isHTTPAccessFallbackError(err)\n    const isRedirect = isRedirectError(err)\n\n    if (isHTTPAccessFallback) {\n      res.statusCode = getAccessFallbackHTTPStatus(err)\n      metadata.statusCode = res.statusCode\n      errorType = getAccessFallbackErrorTypeByStatus(res.statusCode)\n    } else if (isRedirect) {\n      errorType = 'redirect'\n      res.statusCode = getRedirectStatusCodeFromError(err)\n      metadata.statusCode = res.statusCode\n\n      const redirectUrl = addPathPrefix(getURLFromRedirectError(err), basePath)\n\n      setHeader('location', redirectUrl)\n    } else {\n      res.statusCode = 500\n      metadata.statusCode = res.statusCode\n    }\n\n    if (cacheComponents && !isHTTPAccessFallback && !isRedirect) {\n      throw reactServerErrorsByDigest.get((err as any).digest) ?? err\n    }\n\n    const [errorPreinitScripts, errorBootstrapScript] = getRequiredScripts(\n      buildManifest,\n      assetPrefix,\n      crossOrigin,\n      subresourceIntegrityManifest,\n      getAssetQueryString(ctx, false),\n      nonce,\n      UNDERSCORE_NOT_FOUND_ROUTE_ENTRY\n    )\n\n    const errorBootstrapScriptContent =\n      buildManifest.pagesChunkGroupBootstrapParams &&\n      buildManifest.chunkLoadingGlobal\n        ? getTurbopackChunkGroupBootstrap(\n            buildManifest.pagesChunkGroupBootstrapParams,\n            buildManifest.chunkLoadingGlobal,\n            [UNDERSCORE_NOT_FOUND_ROUTE_ENTRY]\n          )\n        : undefined\n\n    if (cacheComponents) {\n      const originalFlightPrerenderResult = reactServerPrerenderResult\n      const originalFlightPrerenderResultIsDynamic =\n        reactServerPrerenderResultIsDynamic\n      const originalResumeDataCache = reactServerResumeDataCache\n      const originalPrerenderStore =\n        reactServerPrerenderStore as PrerenderStore | null\n\n      if (originalFlightPrerenderResult === null) {\n        throw new InvariantError(\n          'Cache Components error recovery expected an original Flight prerender result'\n        )\n      }\n      if (originalFlightPrerenderResultIsDynamic === null) {\n        throw new InvariantError(\n          'Cache Components error recovery expected to know whether the original Flight prerender result was dynamic'\n        )\n      }\n      if (originalResumeDataCache === null) {\n        throw new InvariantError(\n          'Cache Components error recovery expected an original resume data cache'\n        )\n      }\n      if (originalPrerenderStore === null) {\n        throw new InvariantError(\n          'Cache Components error recovery expected an original prerender store'\n        )\n      }\n      const originalCollectedStale = selectStaleTime(\n        originalPrerenderStore.stale\n      )\n\n      // The final recovery still belongs to Cache Components. Render the error\n      // payload with the same prerender APIs as the normal path so not-found\n      // metadata can participate in static, dynamic-data, and dynamic-HTML\n      // outcomes instead of being dropped from the recovery shell.\n      const errorServerReactController = new AbortController()\n      const errorServerRenderController = new AbortController()\n      const errorServerDynamicTracking = createDynamicTrackingState(\n        isDebugDynamicAccesses\n      )\n      const errorPrerenderStore: PrerenderStore = {\n        type: 'prerender',\n        phase: 'render',\n        rootParams,\n        fallbackRouteParams,\n        implicitTags,\n        renderSignal: errorServerRenderController.signal,\n        controller: errorServerReactController,\n        stagedRendering: null,\n        cacheSignal: null,\n        dynamicTracking: errorServerDynamicTracking,\n        revalidate:\n          typeof prerenderStore?.revalidate !== 'undefined'\n            ? prerenderStore.revalidate\n            : INFINITE_CACHE,\n        expire:\n          typeof prerenderStore?.expire !== 'undefined'\n            ? prerenderStore.expire\n            : INFINITE_CACHE,\n        stale:\n          typeof prerenderStore?.stale !== 'undefined'\n            ? prerenderStore.stale\n            : INFINITE_CACHE,\n        tags: [...(prerenderStore?.tags || implicitTags.tags)],\n        resumeDataCache: originalResumeDataCache,\n        hmrRefreshHash: undefined,\n        varyParamsAccumulator: null,\n        runtimeDataAccessed: null,\n        shouldAttemptStaticPrefetch: null,\n        isFallbackUpgradeable: renderOpts.isFallbackUpgradeable === true,\n      }\n\n      const errorRSCPayload = await workUnitAsyncStorage.run(\n        errorPrerenderStore,\n        getErrorRSCPayload,\n        tree,\n        ctx,\n        reactServerErrorsByDigest.has((err as any).digest) ? undefined : err,\n        errorType,\n        // The recovery shell only bootstraps the original Flight data. Avoid\n        // blocking that shell on error-page metadata or viewport.\n        false\n      )\n\n      const errorServerResult = await createReactServerPrerenderResult(\n        runInSequentialTasks(\n          async () => {\n            const pendingErrorServerResult = workUnitAsyncStorage.run(\n              errorPrerenderStore,\n              getServerPrerender(ComponentMod),\n              errorRSCPayload,\n              clientModules,\n              {\n                filterStackFrame,\n                signal: errorServerReactController.signal,\n                onError: (rscError: unknown) => {\n                  return serverComponentsErrorHandler(rscError)\n                },\n              }\n            )\n\n            // The listener to abort our own render controller must be added\n            // after React has added its listener, to ensure that pending I/O\n            // is not aborted/rejected too early.\n            errorServerReactController.signal.addEventListener(\n              'abort',\n              () => {\n                errorServerRenderController.abort()\n              },\n              { once: true }\n            )\n\n            const prerenderResult = await pendingErrorServerResult\n            return prerenderResult\n          },\n          () => {\n            if (!errorServerReactController.signal.aborted) {\n              workUnitAsyncStorage.run(\n                errorPrerenderStore,\n                errorServerReactController.abort.bind(\n                  errorServerReactController\n                )\n              )\n            }\n          }\n        )\n      )\n\n      try {\n        const errorClientReactController = new AbortController()\n        const errorClientRenderController = new AbortController()\n        const errorClientDynamicTracking = createDynamicTrackingState(\n          isDebugDynamicAccesses\n        )\n        const errorDynamicValidation = createDynamicValidationState()\n        const errorClientPrerenderStore: PrerenderStore = {\n          type: 'prerender-client',\n          phase: 'render',\n          rootParams,\n          fallbackRouteParams,\n          implicitTags,\n          renderSignal: errorClientRenderController.signal,\n          controller: errorClientReactController,\n          cacheSignal: null,\n          dynamicTracking: errorClientDynamicTracking,\n          revalidate: errorPrerenderStore.revalidate,\n          expire: errorPrerenderStore.expire,\n          stale: errorPrerenderStore.stale,\n          tags: [...(errorPrerenderStore.tags || implicitTags.tags)],\n          resumeDataCache: originalResumeDataCache,\n          hmrRefreshHash: undefined,\n          varyParamsAccumulator: null,\n        }\n\n        const {\n          prelude: unprocessedErrorHtmlStream,\n          postponed: errorPostponed,\n        } = await runInSequentialTasks(\n          () => {\n            const pendingErrorHtmlResult = workUnitAsyncStorage.run(\n              errorClientPrerenderStore,\n              getClientPrerender,\n              // eslint-disable-next-line @next/internal/no-ambiguous-jsx\n              <ErrorApp\n                reactServerStream={errorServerResult.asUnclosingStream()}\n                ServerInsertedHTMLProvider={ServerInsertedHTMLProvider}\n                preinitScripts={errorPreinitScripts}\n                nonce={nonce}\n                images={ctx.renderOpts.images}\n              />,\n              {\n                nonce,\n                bootstrapScriptContent: errorBootstrapScriptContent,\n                bootstrapScripts: [errorBootstrapScript],\n                formState,\n                signal: errorClientReactController.signal,\n                onError: (clientError: unknown, errorInfo: ErrorInfo) => {\n                  if (\n                    isPrerenderInterruptedError(clientError) ||\n                    errorClientReactController.signal.aborted\n                  ) {\n                    const componentStack: string | undefined = (\n                      errorInfo as any\n                    ).componentStack\n                    if (typeof componentStack === 'string') {\n                      trackAllowedDynamicAccess(\n                        clientError,\n                        workStore,\n                        componentStack,\n                        errorDynamicValidation,\n                        errorClientDynamicTracking\n                      )\n                    }\n                    return\n                  }\n\n                  return htmlRendererErrorHandler(clientError, errorInfo)\n                },\n              }\n            )\n\n            // The listener to abort our own render controller must be added\n            // after React has added its listener, to ensure that pending I/O\n            // is not aborted/rejected too early.\n            errorClientReactController.signal.addEventListener(\n              'abort',\n              () => {\n                errorClientRenderController.abort()\n              },\n              { once: true }\n            )\n\n            return pendingErrorHtmlResult\n          },\n          () => {\n            workUnitAsyncStorage.run(\n              errorClientPrerenderStore,\n              errorClientReactController.abort.bind(errorClientReactController)\n            )\n          }\n        )\n\n        metadata.hasPendingUi = errorPostponed != null\n\n        const { prelude, preludeIsEmpty } = await processPreludeOp(\n          unprocessedErrorHtmlStream\n        )\n\n        if (preludeIsEmpty) {\n          console.error(\n            `Route \"${workStore.route}\" did not produce a static shell while rendering its error page.`\n          )\n          throwIfDisallowedDynamic(\n            workStore,\n            PreludeState.Empty,\n            errorDynamicValidation,\n            errorServerDynamicTracking,\n            false\n          )\n          throw new StaticGenBailoutError()\n        }\n\n        const getServerInsertedHTML = makeGetServerInsertedHTML({\n          polyfills,\n          renderServerInsertedHTML,\n          serverCapturedErrors: [],\n          basePath,\n          tracingMetadata: tracingMetadata,\n        })\n\n        let errorHtmlStream: AnyStream = prelude\n        if (originalFlightPrerenderResultIsDynamic) {\n          metadata.postponed = await getDynamicDataPostponedState(\n            originalResumeDataCache,\n            cacheComponents\n          )\n          originalFlightPrerenderResult.consume()\n          errorServerResult.consume()\n          return {\n            digestErrorsMap: reactServerErrorsByDigest,\n            ssrErrors: allCapturedErrors,\n            stream: await continueDynamicPrerender(errorHtmlStream, {\n              getServerInsertedHTML,\n              getServerInsertedMetadata,\n              deploymentId: ctx.sharedContext.deploymentId,\n            }),\n            dynamicAccess: consumeDynamicAccess(\n              errorServerDynamicTracking,\n              errorClientDynamicTracking\n            ),\n            collectedRevalidate: originalPrerenderStore.revalidate,\n            collectedExpire: originalPrerenderStore.expire,\n            collectedStale: originalCollectedStale,\n            collectedTags: originalPrerenderStore.tags,\n            renderResumeDataCache: createRenderResumeDataCache(\n              originalResumeDataCache\n            ),\n          }\n        } else if (errorPostponed != null) {\n          // We postponed but nothing dynamic was used. Resume the error shell\n          // and immediately abort it so postponed client boundaries are marked\n          // for browser rendering before the static response is stored.\n          const foreverStream = createPendingStream()\n          const resumePrelude = await workUnitAsyncStorage.run(\n            errorPrerenderStore,\n            resumeAndAbort,\n            // eslint-disable-next-line @next/internal/no-ambiguous-jsx\n            <ErrorApp\n              reactServerStream={foreverStream}\n              ServerInsertedHTMLProvider={ServerInsertedHTMLProvider}\n              preinitScripts={() => {}}\n              nonce={nonce}\n              images={ctx.renderOpts.images}\n            />,\n            JSON.parse(JSON.stringify(errorPostponed)),\n            {\n              signal: createRenderInBrowserAbortSignal(),\n              onError: htmlRendererErrorHandler,\n              nonce,\n            }\n          )\n          errorHtmlStream = chainStreams(prelude, resumePrelude)\n        }\n\n        if (workStore.forceDynamic) {\n          throw new StaticGenBailoutError(\n            'Invariant: a Page with `dynamic = \"force-dynamic\"` did not trigger the dynamic pathway. This is a bug in Next.js'\n          )\n        }\n\n        const stream = await continueStaticPrerenderWithInlinedData(\n          errorHtmlStream,\n          originalFlightPrerenderResult,\n          fallbackRouteParams,\n          createInlinedDataStream,\n          formState,\n          nonce,\n          getServerInsertedHTML,\n          getServerInsertedMetadata,\n          ctx.sharedContext.deploymentId,\n          ComponentMod,\n          renderFlightStream,\n          clientModules,\n          filterStackFrame,\n          serverComponentsErrorHandler\n        )\n\n        errorServerResult.consume()\n        return {\n          digestErrorsMap: reactServerErrorsByDigest,\n          ssrErrors: allCapturedErrors,\n          stream,\n          dynamicAccess: consumeDynamicAccess(\n            errorServerDynamicTracking,\n            errorClientDynamicTracking\n          ),\n          collectedRevalidate: originalPrerenderStore.revalidate,\n          collectedExpire: originalPrerenderStore.expire,\n          collectedStale: originalCollectedStale,\n          collectedTags: originalPrerenderStore.tags,\n          renderResumeDataCache: createRenderResumeDataCache(\n            originalResumeDataCache\n          ),\n        }\n      } catch (finalErr: any) {\n        if (\n          process.env.__NEXT_DEV_SERVER &&\n          isHTTPAccessFallbackError(finalErr)\n        ) {\n          const { bailOnRootNotFound } =\n            require('../../client/components/dev-root-http-access-fallback-boundary') as typeof import('../../client/components/dev-root-http-access-fallback-boundary')\n          bailOnRootNotFound()\n        }\n        throw finalErr\n      }\n    }\n\n    const prerenderLegacyStore: PrerenderStore = {\n      type: 'prerender-legacy',\n      phase: 'render',\n      rootParams,\n      implicitTags: implicitTags,\n      revalidate:\n        typeof prerenderStore?.revalidate !== 'undefined'\n          ? prerenderStore.revalidate\n          : INFINITE_CACHE,\n      expire:\n        typeof prerenderStore?.expire !== 'undefined'\n          ? prerenderStore.expire\n          : INFINITE_CACHE,\n      stale:\n        typeof prerenderStore?.stale !== 'undefined'\n          ? prerenderStore.stale\n          : INFINITE_CACHE,\n      tags: [...(prerenderStore?.tags || implicitTags.tags)],\n    }\n\n    const errorRSCPayload = await workUnitAsyncStorage.run(\n      prerenderLegacyStore,\n      getErrorRSCPayload,\n      tree,\n      ctx,\n      reactServerErrorsByDigest.has((err as any).digest) ? undefined : err,\n      errorType,\n      // Legacy prerender recovery should include the error payload head.\n      true\n    )\n\n    const errorServerStream = workUnitAsyncStorage.run(\n      prerenderLegacyStore,\n      renderFlightStream,\n      ComponentMod,\n      errorRSCPayload,\n      clientModules,\n      {\n        filterStackFrame,\n        onError: serverComponentsErrorHandler,\n      }\n    )\n\n    try {\n      const { stream: errorHtmlStream } = await workUnitAsyncStorage.run(\n        prerenderLegacyStore,\n        renderFizzStream,\n        // eslint-disable-next-line @next/internal/no-ambiguous-jsx\n        <ErrorApp\n          reactServerStream={errorServerStream}\n          ServerInsertedHTMLProvider={ServerInsertedHTMLProvider}\n          preinitScripts={errorPreinitScripts}\n          nonce={nonce}\n          images={ctx.renderOpts.images}\n        />,\n        {\n          nonce,\n          bootstrapScriptContent: errorBootstrapScriptContent,\n          bootstrapScripts: [errorBootstrapScript],\n          formState,\n        },\n        { waitForAllReady: true }\n      )\n\n      if (shouldGenerateStaticFlightData(workStore)) {\n        const flightData = await streamToBuffer(\n          reactServerPrerenderResult.asStream()\n        )\n        metadata.flightData = flightData\n        await collectSegmentData(\n          flightData,\n          prerenderLegacyStore,\n          ComponentMod,\n          renderOpts,\n          ctx.pagePath,\n          metadata\n        )\n      }\n\n      return {\n        digestErrorsMap: reactServerErrorsByDigest,\n        ssrErrors: allCapturedErrors,\n        stream: await continueFizzStream(errorHtmlStream, {\n          inlinedDataStream: createInlinedDataStream(\n            reactServerPrerenderResult.consumeAsStream(),\n            nonce,\n            formState\n          ),\n          isStaticGeneration: true,\n          getServerInsertedHTML: makeGetServerInsertedHTML({\n            polyfills,\n            renderServerInsertedHTML,\n            serverCapturedErrors: [],\n            basePath,\n            tracingMetadata: tracingMetadata,\n          }),\n          getServerInsertedMetadata,\n          validateRootLayout: !!process.env.__NEXT_DEV_SERVER,\n          deploymentId: ctx.sharedContext.deploymentId,\n        }),\n        dynamicAccess: null,\n        collectedRevalidate: prerenderLegacyStore.revalidate,\n        collectedExpire: prerenderLegacyStore.expire,\n        collectedStale: selectStaleTime(prerenderLegacyStore.stale),\n        collectedTags: prerenderLegacyStore.tags,\n      }\n    } catch (finalErr: any) {\n      if (\n        process.env.__NEXT_DEV_SERVER &&\n        isHTTPAccessFallbackError(finalErr)\n      ) {\n        const { bailOnRootNotFound } =\n          require('../../client/components/dev-root-http-access-fallback-boundary') as typeof import('../../client/components/dev-root-http-access-fallback-boundary')\n        bailOnRootNotFound()\n      }\n      throw finalErr\n    }\n  }\n}\n\ntype StreamPendingState = { isPending: boolean }\n\nfunction createStreamPendingState(): StreamPendingState {\n  // This state essentially acts as a mutable out-parameter that should be set\n  // by something that consumes the stream.\n  // As a sanity check, we require it to be set at least once.\n  let _isPending: boolean | undefined\n  return {\n    get isPending() {\n      if (_isPending === undefined) {\n        throw new InvariantError(\n          'Expected stream state to be initialized before reading'\n        )\n      }\n      return _isPending\n    },\n    set isPending(value) {\n      _isPending = value\n    },\n  }\n}\n\nfunction createPrerenderChunksAccumulator(): PrerenderChunksAccumulator {\n  return {\n    // Chunks emitted before aborting the render.\n    prerenderChunks: [],\n    // In dev, we also collect chunks that the render emits after aborting,\n    // because they can contain debug info for chunks that did not\n    // resolve during the prerender. However, unlike a prerender, a render\n    // will also error all the pending chunks (instead of halting),\n    // so have to use something like `createNodeStreamWithLateRelease`\n    // to make the errors unobservable.\n    allChunks: process.env.NODE_ENV === 'development' ? [] : null,\n  }\n}\n\ntype PrerenderChunksAccumulator = {\n  prerenderChunks: Uint8Array[]\n  allChunks: Uint8Array[] | null\n}\n\nfunction collectPrerenderChunk(\n  chunks: PrerenderChunksAccumulator,\n  signal: AbortSignal,\n  chunk: Uint8Array\n) {\n  // The chunks emitted after an abort are not part of the prerender...\n  if (!signal.aborted) {\n    chunks.prerenderChunks.push(chunk)\n  }\n  // ...but if they contain debug info, we still want to collect them\n  // to improve error messages.\n  chunks.allChunks?.push(chunk)\n}\n\nasync function iterateStreamingPrerenderChunks(\n  stream: AnyStream,\n  signal: AbortSignal,\n  onChunk: (chunk: Uint8Array) => void,\n  streamState?: StreamPendingState\n): Promise<void> {\n  if (stream instanceof ReadableStream) {\n    const reader = stream.getReader()\n    if (streamState) {\n      streamState.isPending = true\n    }\n\n    // In production, there's no debug info, so we don't need to capture\n    // anything emitted after the abort and can cancel immediately.\n    if (process.env.NODE_ENV !== 'development') {\n      signal.addEventListener(\n        'abort',\n        () => {\n          reader.cancel(signal.reason)\n        },\n        { once: true }\n      )\n    }\n\n    while (true) {\n      const { done, value } = await reader.read()\n      if (done) {\n        break\n      }\n      onChunk(value)\n    }\n    if (streamState) {\n      streamState.isPending = false\n    }\n  } else {\n    const nodeStream = stream as Readable\n    if (streamState) {\n      streamState.isPending = true\n    }\n\n    let cancelled = false\n\n    // In production, there's no debug info, so we don't need to capture\n    // anything emitted after the abort and can cancel immediately.\n    if (process.env.NODE_ENV !== 'development') {\n      signal.addEventListener(\n        'abort',\n        () => {\n          if (!cancelled) {\n            cancelled = true\n            nodeStream.destroy()\n          }\n        },\n        { once: true }\n      )\n    }\n\n    try {\n      for await (const value of nodeStream) {\n        if (cancelled) break\n        onChunk(value)\n      }\n    } catch (err) {\n      if (!cancelled) {\n        throw err\n      }\n    }\n    if (streamState) {\n      streamState.isPending = false\n    }\n  }\n}\n\nconst getGlobalErrorStyles = async (\n  tree: LoaderTree,\n  ctx: AppRenderContext\n): Promise<{\n  GlobalError: GlobalErrorComponent\n  styles: ReactNode | undefined\n}> => {\n  const globalErrorModule = parseLoaderTree(tree).modules['global-error']\n\n  if (!globalErrorModule) {\n    throw new Error(\n      'Invariant: global-error module is required but not found in loader tree'\n    )\n  }\n\n  const {\n    componentMod: { createElement },\n  } = ctx\n\n  // Get the GlobalError component and styles from the loader tree\n  const [GlobalErrorComponent, styles] = await createComponentStylesAndScripts({\n    ctx,\n    filePath: globalErrorModule[1],\n    getComponent: globalErrorModule[0],\n    injectedCSS: new Set(),\n    injectedJS: new Set(),\n  })\n\n  let globalErrorStyles: ReactNode = styles\n\n  if (process.env.__NEXT_DEV_SERVER) {\n    const dir =\n      (process.env.NEXT_RUNTIME === 'edge'\n        ? process.env.__NEXT_EDGE_PROJECT_DIR\n        : ctx.renderOpts.dir) || ''\n\n    const globalErrorModulePath = normalizeConventionFilePath(\n      dir,\n      globalErrorModule[1]\n    )\n    if (globalErrorModulePath) {\n      const SegmentViewNode = ctx.componentMod.SegmentViewNode\n      globalErrorStyles =\n        // This will be rendered next to GlobalError component under ErrorBoundary,\n        // it requires a key to avoid React warning about duplicate keys.\n        createElement(\n          SegmentViewNode,\n          {\n            key: 'ge-svn',\n            type: 'global-error',\n            pagePath: globalErrorModulePath,\n          },\n          globalErrorStyles\n        )\n    }\n  }\n\n  return {\n    GlobalError: GlobalErrorComponent,\n    styles: globalErrorStyles,\n  }\n}\n\nasync function collectSegmentData(\n  fullPageDataBuffer: Buffer,\n  prerenderStore: PrerenderStore,\n  ComponentMod: AppPageModule,\n  renderOpts: RenderOpts,\n  pagePath: string,\n  metadata: AppPageRenderResultMetadata\n): Promise<void> {\n  // Per-segment prefetch data\n  //\n  // All of the segments for a page are generated simultaneously, including\n  // during revalidations. This is to ensure consistency, because it's\n  // possible for a mismatch between a layout and page segment can cause the\n  // client to error during rendering. We want to preserve the ability of the\n  // client to recover from such a mismatch by re-requesting all the segments\n  // to get a consistent view of the page.\n  //\n  // For performance, we reuse the Flight output that was created when\n  // generating the initial page HTML. The Flight stream for the whole page is\n  // decomposed into a separate stream per segment.\n\n  const { clientModules, edgeRscModuleMapping, rscModuleMapping } =\n    getClientReferenceManifest()\n\n  // Manifest passed to the Flight client for reading the full-page Flight\n  // stream. Based off similar code in use-cache-wrapper.ts.\n  const isEdgeRuntime = process.env.NEXT_RUNTIME === 'edge'\n  const serverConsumerManifest = {\n    // moduleLoading must be null because we don't want to trigger preloads of ClientReferences\n    // to be added to the consumer. Instead, we'll wait for any ClientReference to be emitted\n    // which themselves will handle the preloading.\n    moduleLoading: null,\n    moduleMap: isEdgeRuntime ? edgeRscModuleMapping : rscModuleMapping,\n    serverModuleMap: getServerModuleMap(),\n  }\n\n  const selectStaleTime = createSelectStaleTime(renderOpts.experimental)\n  const staleTime = selectStaleTime(prerenderStore.stale)\n\n  // Resolve prefetch hints. At runtime (next start / ISR), the precomputed\n  // hints are already loaded from the prefetch-hints.json manifest. During\n  // build, compute them and write them to metadata so the build pipeline\n  // can persist them to the manifest. Like every other hint bit, the\n  // static-prefetch-attempt hint is computed once here and stays constant\n  // for the entire build — it must reach every response that carries\n  // prefetch hints (dynamic navigations included), which only the manifest\n  // flow can guarantee.\n  //\n  // The manifest isn't just a cache of this work — for some responses it's\n  // the only possible source. A response's FlightRouterState is built early\n  // in its render, before the runtime-data tracking has settled, so it can't\n  // read a finished measurement even when one is coming; and a dynamic\n  // navigation has no prerender to measure in the first place. Recomputing\n  // per render would therefore leave those responses with no hint at all,\n  // which is worse than an occasionally-stale one: the client would deopt\n  // straight to runtime prefetches instead of attempting static.\n  let hints: PrefetchHints | null\n  const prefetchInlining = renderOpts.experimental.prefetchInlining\n  if (renderOpts.isBuildTimePrerendering) {\n    // Whether the client should attempt a static prefetch for this route\n    // (PrefetchHint.ShouldAttemptStaticPrefetch): the prerender store's\n    // cell holds the hint value directly — true iff the build-time\n    // prerender accessed no runtime data that disqualifies a static\n    // attempt. The fallback-param upgradeability rule is applied at access\n    // time — see trackRuntimeDataAccessed — so only the settled value is\n    // read here. Only the modern (cacheComponents) prerender tracks\n    // accesses; legacy prerenders conservatively never set the hint.\n    const hintCell =\n      prerenderStore.type === 'prerender'\n        ? prerenderStore.shouldAttemptStaticPrefetch\n        : null\n    const shouldAttemptStaticPrefetch = hintCell !== null && hintCell.current\n    if (prefetchInlining || shouldAttemptStaticPrefetch) {\n      // Build time: compute fresh hints and store in metadata for the\n      // manifest. When prefetch inlining is disabled there are no sizes to\n      // measure, but the static-prefetch hint still rides the manifest —\n      // collectPrefetchHints then only builds the tree shape carrying it.\n      hints = await ComponentMod.collectPrefetchHints(\n        fullPageDataBuffer,\n        staleTime,\n        clientModules,\n        serverConsumerManifest,\n        prefetchInlining,\n        shouldAttemptStaticPrefetch\n      )\n      metadata.prefetchHints = hints\n    } else {\n      // Inlining is disabled and the hint didn't qualify — there's nothing\n      // to record, so don't write a manifest entry for this route.\n      hints = null\n    }\n  } else {\n    // Runtime: use hints from the manifest. Never compute fresh hints\n    // during ISR/revalidation.\n    const manifestHints = renderOpts.prefetchHints?.[pagePath]\n    if (manifestHints === undefined) {\n      if (!prefetchInlining || !renderOpts.cacheComponents) {\n        // Without cacheComponents, dynamic pages have no static shell\n        // and therefore no prerender pass to compute hints; and with\n        // inlining disabled, a missing entry just means the route didn't\n        // qualify for the static-prefetch hint at build. Either way this\n        // is expected — skip the hint system for this route and let\n        // prefetching proceed normally without inlining decisions (the\n        // client goes straight to runtime prefetches where it matters).\n        hints = null\n      } else {\n        // TODO(#91407): No hints found for this route. This currently\n        // happens for routes with `instant = false` at the root segment,\n        // which causes the prerender to run per-request and the hints\n        // manifest to be unavailable at runtime.\n        //\n        // Fall back to a hint tree that marks everything as\n        // unprefetchable. This also swallows the static-prefetch-attempt\n        // hint — such routes never carry it, so the client goes straight\n        // to a runtime prefetch, which is safe (just less cacheable).\n        // Once the instant:false bug is fixed, this should become an\n        // error — the manifest should always have an entry for every\n        // route that reaches collectSegmentData.\n        hints = {\n          hints: PrefetchHint.PrefetchDisabled,\n          slots: null,\n        }\n      }\n    } else {\n      hints = manifestHints\n    }\n  }\n\n  // Whether this render is a fallback shell, i.e. it was prerendered with\n  // unknown (opaque) route params rather than concrete ones. The per-segment\n  // responses generated below are stamped with this so the client knows to\n  // retry the prefetch — a more complete version may become available once\n  // the server's background regeneration finishes.\n  //\n  // Only flag the shell when it could actually be upgraded\n  // (`isFallbackUpgradeable`): at least one fallback param is a candidate\n  // enumerated by `generateStaticParams`. A route with no `generateStaticParams`\n  // never upgrades, so flagging it would trigger pointless client retries.\n  const fallbackRouteParams =\n    'fallbackRouteParams' in prerenderStore\n      ? prerenderStore.fallbackRouteParams\n      : null\n  const isUpgradeableISRFallback =\n    fallbackRouteParams != null &&\n    fallbackRouteParams.size > 0 &&\n    renderOpts.isFallbackUpgradeable === true\n\n  // Pass the resolved hints so collectSegmentData can union them into\n  // the TreePrefetch. During the initial build the FlightRouterState in\n  // the buffer doesn't have inlining hints yet (they were just computed\n  // above), so we need to merge them in here. At runtime/ISR the hints\n  // are already embedded in the FlightRouterState, so this is null.\n  metadata.segmentData = await ComponentMod.collectSegmentData(\n    renderOpts.cacheComponents,\n    fullPageDataBuffer,\n    staleTime,\n    clientModules,\n    serverConsumerManifest,\n    Boolean(renderOpts.experimental.prefetchInlining),\n    hints,\n    isUpgradeableISRFallback\n  )\n}\n\nfunction isBypassingCachesInDev(\n  requestStore: RequestStore,\n  workStore: WorkStore\n): boolean {\n  return (\n    !!process.env.__NEXT_DEV_SERVER &&\n    (requestStore.headers.get('cache-control') === 'no-cache' ||\n      requestStore.draftMode.isEnabled ||\n      workStore.isDraftMode === true)\n  )\n}\n\nfunction WarnForBypassCachesInDev({ route }: { route: string }) {\n  warnOnce(\n    `Route ${route} is rendering with server caches disabled. For this navigation, Component Metadata in React DevTools will not accurately reflect what is statically prerenderable and runtime prefetchable. See more info here: https://nextjs.org/docs/messages/cache-bypass-in-dev`\n  )\n  return null\n}\n"],"names":["PrefetchingMode","renderToHTMLOrFlight","runValidationInDevFromSnapshot","toValidationRenderContext","maybeAppendBuildIdToRSCPayload","ctx","payload","sharedContext","deploymentId","b","buildId","flightDataPathHeadKey","getFlightViewportKey","requestId","getFlightMetadataKey","filterStackFrame","process","env","NODE_ENV","require","filterStackFrameDEV","undefined","parseRequestHeaders","headers","options","isRSCRequest","isRSCRequestHeader","RSC_HEADER","isPrefetchRequest","NEXT_ROUTER_PREFETCH_HEADER","isAppShellPrefetchRequest","isRuntimePrefetchRequest","isHmrRefresh","NEXT_HMR_REFRESH_HEADER","shouldProvideFlightRouterState","isRoutePPREnabled","flightRouterState","parseAndValidateFlightRouterState","NEXT_ROUTER_STATE_TREE_HEADER","isRouteTreePrefetchRequest","NEXT_ROUTER_SEGMENT_PREFETCH_HEADER","csp","nonce","getScriptNonceFromHeader","previouslyRevalidatedTags","getPreviouslyRevalidatedTags","previewModeId","htmlRequestId","__NEXT_DEV_SERVER","NEXT_REQUEST_ID_HEADER","NEXT_HTML_REQUEST_ID_HEADER","getDynamicStaleTime","tree","page","parallelRoutes","parseLoaderTree","result","pageMod","unstable_dynamicStaleTime","value","Math","min","childPromises","parallelRouteKey","push","childResults","Promise","all","childResult","createNotFoundLoaderTree","loaderTree","components","hasGlobalNotFound","notFoundTreeComponents","layout","children","PAGE_SEGMENT_KEY","makeGetDynamicParamFromSegment","interpolatedParams","fallbackRouteParams","optimisticRouting","getDynamicParamFromSegment","segment","staticSiblings","segmentParam","getSegmentParam","segmentKey","paramName","dynamicParamType","dynamicParamTypes","paramType","siblings","getDynamicParam","NonIndex","createElement","pagePath","statusCode","isPossibleServerAction","is404Page","isInvalidStatusCode","name","content","generateDynamicRSCPayload","flightData","componentMod","routeModule","userland","createMetadataComponents","Fragment","query","workStore","url","serveStreamingMetadata","renderOpts","skipPageRendering","preloadCallbacks","requestStore","workUnitAsyncStorage","getStore","needsFullTree","cacheComponents","type","isBypassingCachesInDev","actionResult","anySegmentNeedsInstantValidationInDev","Viewport","Metadata","MetadataOutlet","parsedQuery","pathname","metadataContext","createMetadataContext","rscHead","key","res","createFullTreeFlightDataForNavigation","injectedCSS","Set","injectedJS","injectedFontPreloadTags","walkTreeWithFlightRouterState","loaderTreeToFilter","parentParams","rootLayoutIncluded","hintTree","prefetchHints","map","path","slice","varyHeader","getHeader","couldBeIntercepted","includes","NEXT_URL","a","f","q","getRenderedSearch","i","baseResponse","S","isStaticGeneration","h","getMetadataVaryParamsAccumulator","r","getRootParamsVaryParamsAccumulator","staleTimeIterable","s","staticStageByteLengthPromise","l","shellByteLengthPromise","shellUsedSessionDataPromise","u","runtimePrefetchStream","p","dynamicStaleTime","d","createErrorContext","renderSource","routerKind","routePath","routeType","revalidateReason","getRevalidateReason","generateDynamicFlightRenderResult","req","onInstrumentationRequestError","setReactDebugChannel","isBuildTimePrerendering","onFlightDataRenderError","err","silenceLog","onError","createReactServerErrorHandler","reactServerErrorsByDigest","requestAbortSignal","experimental","serverComponentsHmrCancellation","isNodeNextResponse","signalFromNodeResponse","originalResponse","__NEXT_USE_NODE_STREAMS","debugChannel","createNodeDebugChannel","clientSide","clientModules","getClientReferenceManifest","rscPayload","run","flightStream","renderToNodeFlightStream","temporaryReferences","serverSide","signal","FlightRenderResult","fetchMetrics","waitUntil","createWebDebugChannel","renderToWebFlightStream","generateStagedDynamicFlightRenderResultNode","selectStaleTime","createSelectStaleTime","StaleTimeIterable","stageController","StagedRenderingController","abortSignal","abandonController","syncIO","SyncIOMode","Untracked","finalStage","stale","INFINITE_CACHE","stagedRendering","varyParamsAccumulator","createResponseVaryParamsAccumulator","asyncApiPromises","createAsyncApiPromises","cookies","mutableCookies","trackStaleTime","shellByteLengthDeferred","createPromiseWithResolvers","staticStageByteLengthDeferred","Boolean","partialPrefetching","anySegmentHasPartialPrefetchingEnabled","prerenderResumeDataCache","createPrerenderResumeDataCache","resumeDataCache","cacheSignal","CacheSignal","trackPendingModules","runtimePrefetchTransform","TransformStream","readable","cacheReady","then","spawnRuntimePrefetchWithFilledCaches","writable","promise","runInSequentialTasks","advanceStage","RenderStage","ShellStatic","sourceStream","replayable","ReplayableNodeStream","dynamicStream","createReplayStream","staticStream","countShellAndStaticStageBytes","byteLengths","resolve","Static","close","finishAccumulatingVaryParams","Dynamic","rootParams","getRootParams","mode","shellUsedSessionDataDeferred","finalRuntimeServerPrerender","bind","draftMode","prelude","pipeTo","stagedRenderWithoutCachesInDevNode","getPayload","environmentName","currentStage","getEnvironmentNameForStageWithoutCaches","stage","Before","ShellRuntime","Runtime","Abandoned","InvariantError","generateDynamicFlightRenderResultWithStagesInDev","initialRequestStore","createRequestStore","fallbackParams","setCacheStatus","didErrorObservably","shouldValidate","isPrefetch","_bypassCachesInDev","WarnForBypassCachesInDev","route","c","prepareInitialCanonicalUrl","stream","prefetchMode","getPrefetchingModeForPage","prefetchStage","stagedRenderWithCachesInDev","getDevRenderDidError","navigationKind","generateRuntimePrefetchResult","isShellPrefetch","metadata","prospectiveRuntimeServerPrerender","response","applyMetadataFromPrerenderResult","implicitTags","ComponentMod","initialServerPrerenderController","AbortController","initialServerRenderController","initialServerPrerenderStore","phase","renderSignal","controller","dynamicTracking","revalidate","expire","tags","hmrRefreshHash","isSessionShell","HeadersAdapter","fresh","RequestCookiesAdapter","initialServerPayload","prerenderOptions","digest","getDigestForWellKnownError","aborted","NEXT_DEBUG_BUILD","__NEXT_VERBOSE_LOGGING","printDebugThrownValueForProspectiveRender","Phase","ProspectiveRender","pendingInitialServerResult","getServerPrerender","abort","invalidDynamicUsageError","createReactServerPrerenderResult","prependIsPartialByteToChunks","chunks","isPartial","markerByte","Uint8Array","isDebugDynamicAccesses","resultIsPartial","finalServerController","serverDynamicTracking","createDynamicTrackingState","finalStageController","AllowedInDynamic","finalServerPrerenderStore","finalRSCPayload","streamState","createStreamPendingState","collectedChunks","createPrerenderChunksAccumulator","stageByteLengths","createStageByteLengths","collectChunk","chunk","collectPrerenderChunk","increaseChunkByteLengths","byteLength","didHandleUnexpectedAbort","checkUnexpectedAbort","onUnexpectedAbort","renderToReadableStream","iterateStreamingPrerenderChunks","didSessionDataUnblockNewContent","didLinkDataUnblockNewContent","isPending","ReactServerPrerenderResult","prerenderChunks","consumeAsStream","dynamicAccess","collectedRevalidate","collectedExpire","collectedStale","currentValue","collectedTags","search","split","pairs","Array","isArray","v","encodeURIComponent","String","length","join","getRSCPayload","is404","missingSlots","appUsingSizeAdjustment","hints","prefetchInliningEnabled","prefetchInlining","initialTree","createFlightRouterStateFromLoaderTree","errorType","seedData","createComponentTree","parentOptionalCatchAllParamName","parentRuntimePrefetchable","authInterrupts","initialHead","GlobalError","styles","globalErrorStyles","getGlobalErrorStyles","isPossiblyPartialHead","P","Preloads","m","G","forEach","preloadFn","getErrorRSCPayload","ssrError","shouldRenderMetadataAndViewport","metadataComponents","errorHints","errorPrefetchInliningEnabled","isError","Error","id","message","stack","App","reactServerStream","reactDebugStream","debugEndTime","preinitScripts","ServerInsertedHTMLProvider","images","ReactClient","use","getFlightStream","initialState","createInitialRouterState","navigatedAt","initialRSCPayload","location","actionQueue","createMutableActionQueue","HeadManagerContext","Provider","appDir","ImageConfigContext","imageConfigDefault","AppRouter","globalErrorState","ErrorApp","installGlobalModuleLoadingHandlers","isTracingEnabled","instrumented","wrapClientComponentLoader","shouldTrackModuleLoading","workUnitStore","globalThis","__next_require__","args","exportsOrPromise","trackPendingImport","__next_chunk_load__","loadingChunk","loadChunk","trackPendingChunkLoad","renderToHTMLOrFlightImpl","parsedRequestHeaders","postponedState","serverComponentsHmrCache","isNotFoundPath","requestTimestamp","Date","now","nextFontManifest","serverActions","assetPrefix","enableTainting","setIsrStatus","cachedNavigations","__next_app__","getTracer","getActiveScopeSpan","isRecording","URL","NEXT_RUNTIME","isNodeNextRequest","onClose","shouldTrackFetchMetrics","originalRequest","on","metrics","getClientComponentLoaderMetrics","reset","startSpan","NextNodeServerSpan","clientComponentLoading","startTime","clientComponentLoadStart","attributes","clientComponentLoadCount","end","clientComponentLoadTimes","hasPendingUi","appUsingSizeAdjust","patchFetch","taintObjectReference","stripInternalQueries","requestInsightsIdentity","__NEXT_REQUEST_INSIGHTS","getRequestInsightsIdentity","Buffer","from","crypto","subtle","toString","randomUUID","nanoid","isPossibleActionRequest","getIsPossibleServerAction","resolvedPathname","getRequestMeta","getImplicitTags","setRootSpanAttribute","prerenderToStreamWithTracing","wrap","AppRenderSpan","getBodyResult","spanName","prerenderToStream","accessedDynamicData","warn","access","formatDynamicAPIAccesses","logDisallowedDynamicError","StaticGenBailoutError","digestErrorsMap","size","buildFailingError","values","next","ssrErrors","find","isUserLandError","contentType","HTML_CONTENT_TYPE_HEADER","maybeRevalidatesPromise","executeRevalidates","revalidatesPromise","finally","NEXT_PRIVATE_DEBUG_CACHE","console","log","href","renderResumeDataCache","streamString","streamToString","RenderResult","cacheComponentsEnabled","runInstantValidation","anySegmentNeedsInstantValidationInBuild","validateInstantConfigsInBuild","createRequestStoreForRender","onUpdateCookies","previewProps","isStatic","usedDynamic","forceDynamic","didExecuteServerAction","formState","actionRequestResult","handleAction","generateFlight","notFoundLoaderTree","renderToStream","assignMetadata","logMessagesAndSendErrorsToBrowser","parseRelativeUrl","postponed","interpolateParallelRouteParams","params","parsePostponedState","maxPostponedStateSizeBytes","createWorkStore","definition","workAsyncStorage","fetchTags","staleHeader","NEXT_ROUTER_STALE_TIME_HEADER","forceStatic","cacheControl","staticBailoutInfo","description","dynamicUsageDescription","dynamicUsageStack","basePath","buildManifest","crossOrigin","reactMaxHeadersLength","subresourceIntegrityManifest","supportsDynamicResponse","renderServerInsertedHTML","createServerInsertedHTML","getServerInsertedMetadata","createServerInsertedMetadata","tracingMetadata","getTracedMetadata","getTracePropagationData","clientTraceMetadata","polyfills","polyfillFiles","filter","polyfill","endsWith","src","getAssetQueryString","integrity","noModule","bootstrapScript","getRequiredScripts","bootstrapScriptContent","JSON","stringify","pagesChunkGroupBootstrapParams","chunkLoadingGlobal","getTurbopackChunkGroupBootstrap","exposeTestingApi","getInstantTestBootstrapScriptContent","renderSpan","endSpanWithError","recordException","setAttribute","setStatus","code","SpanStatusCode","ERROR","withSpan","onHTMLRenderRSCError","serverComponentsErrorHandler","onHTMLRenderSSRError","allCapturedErrors","htmlRendererErrorHandler","createHTMLErrorHandler","reactServerResult","setHeader","appendHeader","debugChannelClientStream","serverStream","returnedDebugChannel","ReactServerResult","logValidationSkipped","RSCPayload","readableSsr","readableBrowser","teeStream","waitAtLeastOneReactRenderTask","DynamicState","DATA","inlinedDataStream","createNodeInlinedDataStream","tee","chainStreams","createDocumentClosingStream","preludeState","getPostponedFromState","resumeAppElement","getServerInsertedHTML","makeGetServerInsertedHTML","serverCapturedErrors","htmlStream","allReady","resumeToFizzStream","continueDynamicHTMLResumeNode","delayDataUntilFirstHtmlChunk","DynamicHTMLPreludeState","Empty","consume","generateStaticHTML","appElement","fizzOptions","onHeaders","maxHeadersLength","bootstrapScripts","trace","renderToNodeFizzStream","waitForAllReady","continueFizzStream","validateRootLayout","createWebInlinedDataStream","continueDynamicHTMLResumeWeb","renderToWebFizzStream","isStaticGenBailoutError","shouldBailoutToCSR","isBailoutToCSRError","getStackWithoutErrorMessage","error","reason","isHTTPAccessFallbackError","getAccessFallbackHTTPStatus","getAccessFallbackErrorTypeByStatus","isRedirectError","getRedirectStatusCodeFromError","redirectUrl","addPathPrefix","getURLFromRedirectError","Headers","appendMutableCookies","errorPreinitScripts","errorBootstrapScript","UNDERSCORE_NOT_FOUND_ROUTE_ENTRY","errorBootstrapScriptContent","errorRSCPayload","errorServerStream","has","setupErr","errorHtmlStream","errorAllReady","finalErr","bailOnRootNotFound","dropValidationDebugChannel","channel","ReadableStream","cancel","destroy","alreadyForwardedDynamicUsageErrors","WeakSet","forwardInvalidDynamicUsageError","add","runDevValidationInBackground","validationDebugChannel","validationGeneration","validationAbortSignal","consoleAsyncStorage","dim","waitForResponseToFinish","logValidationAborted","yieldToForegroundRequest","runInstantInsightsWithTracing","runSpan","devRenderDidError","instantInputs","staticInputs","instantInsightsPrepareValidation","lazyInputs","prepareValidationInputs","resolveLazyDevValidationInputs","VALIDATION_BAILOUT","instantInsightsRunValidation","devValidationWorker","getDevValidationWorker","snapshot","buildDevValidationSnapshot","sendErrorsToBrowser","createNodeStreamFromChunks","runWithDevValidationLogging","validationErrors","runValidationInDev","catch","cause","finish","runInstantInsightsSpan","spanType","fn","traceLocalSpan","runWithoutInstantInsightsSpan","_spanType","_spanName","isRequestInsightsEnabled","runWithRequestInsightsIdentity","kind","parentSpan","instantInsights","Symbol","createLazyDevValidationInputs","create","createMemoizedThunk","cb","cache","wrapped","inputsFromNavigation","hadCacheMiss","outcome","accumulatedChunks","stageEndTimes","debugChannelClient","prepareValidationInputsInPartialPrefetching","prepareValidationInputsInLegacyPrefetching","needsInstantValidation","areStagesCompatible","hasNonRootStaticParams","LAZY_FULL_RENDER","shouldRenderWithAppShell","inputs","renderWithWarmCachesForValidationInDev","forwardErrorsFromWarmRender","LAZY_RUNTIME_PRERENDER","prerenderWithWarmCachesForStaticValidationInDev","navigationHasAppShell","resolvedOrLazyInputs","maybeInputs","syncInterruptReason","debug","NEXT_PRIVATE_DEBUG_VALIDATION","getSyncIOMode","AllowedInRuntimeOrDynamic","setUpStagedDevRender","prefetchingMode","needsSessionShell","getEnvironmentNameForStage","streamStagedRenderInDev","holdStreamUntilRevealed","revealAfterStage","streamReady","revealAfter","_revealAfter","Infinity","reportedColdCache","checkForCacheMiss","hasPendingReads","checkCacheMissAndAdvance","checkReveal","stagesAdvanced","performance","timeOrigin","accumulatedChunksPromise","accumulateStreamChunks","reject","resultPromise","getSyncInterruptReason","getStageEndTimes","getStageEndTime","createRenderResumeDataCache","finalReactController","finalDataController","abortWhenSignalAborts","collectedChunksByStage","createStageChunksAccumulator","collectStageChunk","abortInRenderContext","addEventListener","ABORT_ONCE","once","beginDevValidation","debugChannelReplay","hadInvalidDynamicUsage","shellStaticChunks","staticChunks","shellRuntimeChunks","runtimeChunks","dynamicChunks","accumulator","accumulateStreamChunksInto","reader","getReader","cancelled","done","read","nodeStream","abortController","endStage","getNextStage","onStage","countStageBytesUntilAbortNode","RENDER_STAGE_ADVANCE_ORDER","isAdvanceableRenderStage","cookiesStage","RENDER_STAGES_BY_DATA_KIND","sessionData","headersStage","paramsStage","runtimeLinkData","searchParamsStage","delayUntilStage","sharedParamsParent","sharedSearchParamsParent","connection","io","messages","errors","exit","errorCodes","Map","extractNextErrorCode","set","errorsFlightStream","__NEXT_TEST_MODE","NEXT_TEST_LOG_VALIDATION","formatValidationEvent","responseFinished","writableFinished","validationDelay","Number","NEXT_TEST_DEV_VALIDATION_DELAY_MS","isFinite","timeout","finishDelay","clearTimeout","removeEventListener","setTimeout","allowEmptyStaticShell","isDebugChannelEnabled","buildDevValidationWorkStore","AfterContext","noopAfterContext","onTaskError","isDraftMode","request","useCacheTimeout","nextConfigSerializable","staticPageGenerationTimeout","cacheLifeProfiles","requestStartTime","refreshTagsByCacheKind","runInCleanSnapshot","createSnapshot","afterContext","validationLevel","toDevValidationInputs","serialized","debugChunks","requestFallbackRouteParams","expirationsByCacheKind","createRequestStoreFromInputs","urlPathname","urlSearch","validationSamples","validationSampleTracking","warmupClientModulesForStagedValidation","cachedDebugChunks","WeakMap","getDebugChunksOnce","get","collectDebugChunksFromClientChannel","getHmrRefreshHash","validateStaticShell","validateInstantConfigs","isPageAllowedToBlock","runtimeResult","validateStagedShell","trackDynamicHoleInRuntimeShell","staticResult","trackDynamicHoleInStaticShell","storeType","partialServerChunks","allServerChunks","initialClientPrerenderController","initialClientReactController","initialClientRenderController","initialClientReactSignal","AbortSignal","any","initialClientPrerenderStore","store","boundaryState","createNodeStreamWithLateRelease","pendingInitialClientResult","getClientPrerender","isReactLargeShellError","isPrerenderInterruptedError","stageChunks","trackDynamicHole","clientDynamicTracking","clientReactController","clientRenderController","clientReactSignal","finalClientPrerenderStore","dynamicValidation","createDynamicValidationState","unprocessedPrelude","pendingFinalClientResult","errorInfo","componentStack","preludeIsEmpty","processPreludeOp","getStaticShellDisallowedDynamicReasons","PreludeState","Full","thrownValue","Errored","unshift","createCombinedPayloadAtDepth","createCombinedPayloadStream","collectStagedSegmentData","discoverValidationDepths","ValidationPrefetchKind","InstantValidation","createValidationSampleTracking","prefetchKind","Shell","LegacySpeculative","clientReferenceManifest","renderFlightStream","createDebugChannel","initialRscPayload","validateAtDepth","depth","groupDepthForValidation","validateAtDepthImpl","previousBoundaryState","extraChunksController","extraChunksSignal","createValidationBoundaryTracking","useRuntimeStageForPartialSegments","filePath","requiredIds","payloadResult","reactController","renderController","reactSignal","debugStream","instantValidationState","createInstantValidationState","slotStacks","prerenderStore","dynamicHoleKind","hasAmbiguousErrors","DynamicHoleKind","Link","pendingResult","trackDynamicHoleInNavigation","errorForDisplay","serverError","trackThrownErrorInNavigation","getNavigationDisallowedDynamicReasons","dynamicOnlyResult","groupDepthsByUrlDepth","maxDepth","impairedValidation","maxGroupDepth","currentGroupDepth","debugKind","AggregateError","renderWithRestartOnCacheMissInValidation","createOnError","prefilledDataCache","shouldRenderAppShell","initialReactController","initialDataController","initialAbandonController","initialStageController","advanceStageIfNoCacheMiss","initialResult","finalRscPayload","finalResult","success","validateInstantConfigsInBuildImpl","outerWorkStore","samples","resolveInstantConfigSamplesForPage","allPossibleFallbackRouteParams","getFallbackRouteParams","sampleIndex","sample","validateInstantConfigInBuildWithSample","isInstantValidationError","sampleDesc","logBuildDebugHint","outerCtx","createCookiesFromSample","createHeadersFromSample","createDraftModeForValidation","createRelativeURLFromSamples","sampleUrl","searchParams","sampleParams","fallbackRouteParamsMut","paramKey","sampleRootParams","sampleUrlWithoutQuery","sampleQuery","incrementalCache","fetchCache","isOnDemandRevalidate","reactLoadableManifest","validationCtx","sampleCookies","unusedMutableCookies","ResponseCookies","sampleHeaders","userspaceMutableCookies","onServerError","finalServerStore","endTimes","serverValidationSampleTracking","missingSampleErrors","warmupValidationSamplesTracking","validationRenderCtx","shouldGenerateStaticFlightData","continueStaticPrerenderWithInlinedData","createInlinedDataStream","filterStackFrameForError","hasFallbackRouteParams","emptyReactServerResult","createReactServerPrerenderResultFromRender","continueStaticFallbackPrerender","continueStaticPrerender","renderFizzStream","reportErrors","reactServerPrerenderResult","reactServerPrerenderResultIsDynamic","reactServerResumeDataCache","reactServerPrerenderStore","setMetadataHeader","item","initialServerReactController","initialServerPayloadPrerenderStore","runtimeDataAccessed","shouldAttemptStaticPrefetch","isFallbackUpgradeable","initialPrerenderOptions","initialServerResult","asUnclosingStream","finalServerReactController","finalServerRenderController","current","finalServerPayloadPrerenderStore","finalServerPayload","reduce","acc","throwIfSyncIOUsed","concat","asChunks","subarray","collectSegmentData","finalClientReactController","finalClientRenderController","finalClientOnHeaders","createOnHeadersCallback","allChunks","trackAllowedDynamicAccess","throwIfDisallowedDynamic","getDynamicHTMLPostponedState","getDynamicDataPostponedState","continueDynamicPrerender","consumeDynamicAccess","foreverStream","createPendingStream","resumePrelude","resumeAndAbort","parse","createRenderInBrowserAbortSignal","pprReactServerPrerenderStore","ssrPrerenderStore","pprOnHeaders","streamToBuffer","asStream","dynamicAccesses","pprDynamicOpts","pprFallbackDynamicOpts","prerenderLegacyStore","isDynamicServerError","isHTTPAccessFallback","isRedirect","originalFlightPrerenderResult","originalFlightPrerenderResultIsDynamic","originalResumeDataCache","originalPrerenderStore","originalCollectedStale","errorServerReactController","errorServerRenderController","errorServerDynamicTracking","errorPrerenderStore","errorServerResult","pendingErrorServerResult","rscError","prerenderResult","errorClientReactController","errorClientRenderController","errorClientDynamicTracking","errorDynamicValidation","errorClientPrerenderStore","unprocessedErrorHtmlStream","errorPostponed","pendingErrorHtmlResult","clientError","_isPending","onChunk","globalErrorModule","modules","GlobalErrorComponent","createComponentStylesAndScripts","getComponent","dir","__NEXT_EDGE_PROJECT_DIR","globalErrorModulePath","normalizeConventionFilePath","SegmentViewNode","fullPageDataBuffer","edgeRscModuleMapping","rscModuleMapping","isEdgeRuntime","serverConsumerManifest","moduleLoading","moduleMap","serverModuleMap","getServerModuleMap","staleTime","hintCell","collectPrefetchHints","manifestHints","PrefetchHint","PrefetchDisabled","slots","isUpgradeableISRFallback","segmentData","isEnabled","warnOnce"],"mappings":";;;;;;;;;;;;;;;;;IA47JYA,eAAe;eAAfA;;IAh6DCC,oBAAoB;eAApBA;;IAotGSC,8BAA8B;eAA9BA;;IA9FNC,yBAAyB;eAAzBA;;;;gCAnoMa;0CAKtB;8BAWyC;gCACC;+DAKpB;qEAKtB;2BA0BA;sCAE8C;+BAChB;kCAW9B;iCA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