{"version":3,"sources":["../../src/server/config.ts"],"sourcesContent":["import { existsSync } from 'fs'\nimport { basename, extname, join, relative, isAbsolute, resolve } from 'path'\nimport { pathToFileURL } from 'url'\nimport findUp from 'next/dist/compiled/find-up'\nimport * as Log from '../build/output/log'\nimport * as ciEnvironment from '../server/ci-info'\nimport {\n  CONFIG_FILES,\n  PHASE_DEVELOPMENT_SERVER,\n  PHASE_EXPORT,\n  PHASE_PRODUCTION_BUILD,\n  PHASE_PRODUCTION_SERVER,\n} from '../shared/lib/constants'\nimport { defaultConfig, normalizeConfig } from './config-shared'\nimport type {\n  ExperimentalConfig,\n  NextConfigComplete,\n  NextConfig,\n  TurbopackLoaderItem,\n  NextAdapter,\n} from './config-shared'\n\nimport { loadWebpackHook } from './config-utils'\nimport { imageConfigDefault } from '../shared/lib/image-config'\nimport type { ImageConfig } from '../shared/lib/image-config'\nimport { loadEnvConfig, updateInitialEnv } from '@next/env'\nimport { flushAndExit } from '../telemetry/flush-and-exit'\nimport { findRootDir } from '../lib/find-root'\nimport { setHttpClientAndAgentOptions } from './setup-http-agent-env'\nimport { pathHasPrefix } from '../shared/lib/router/utils/path-has-prefix'\nimport { matchRemotePattern } from '../shared/lib/match-remote-pattern'\n\nimport type { ZodError } from 'next/dist/compiled/zod'\nimport { hasNextSupport } from '../server/ci-info'\nimport { transpileConfig } from '../build/next-config-ts/transpile-config'\nimport { dset } from '../shared/lib/dset'\nimport { normalizeZodErrors } from '../shared/lib/zod'\nimport { HTML_LIMITED_BOT_UA_RE_STRING } from '../shared/lib/router/utils/is-bot'\nimport { findDir } from '../lib/find-pages-dir'\nimport { CanaryOnlyError, isStableBuild } from '../shared/lib/canary-only'\nimport { interopDefault } from '../lib/interop-default'\nimport { djb2Hash } from '../shared/lib/hash'\n\nexport { normalizeConfig } from './config-shared'\nexport type { DomainLocale, NextConfig } from './config-shared'\n\nfunction normalizeNextConfigZodErrors(\n  error: ZodError<NextConfig>\n): [errorMessages: string[], shouldExit: boolean] {\n  let shouldExit = false\n  const issues = normalizeZodErrors(error)\n  return [\n    issues.flatMap(({ issue, message }) => {\n      if (issue.path[0] === 'images') {\n        // We exit the build when encountering an error in the images config\n        shouldExit = true\n      }\n\n      return message\n    }),\n    shouldExit,\n  ]\n}\n\nexport function warnOptionHasBeenDeprecated(\n  config: NextConfig,\n  nestedPropertyKey: string,\n  reason: string,\n  silent: boolean\n): boolean {\n  let hasWarned = false\n  if (!silent) {\n    let current = config\n    let found = true\n    const nestedPropertyKeys = nestedPropertyKey.split('.')\n    for (const key of nestedPropertyKeys) {\n      if (current[key] !== undefined) {\n        current = current[key]\n      } else {\n        found = false\n        break\n      }\n    }\n    if (found) {\n      Log.warnOnce(reason)\n      hasWarned = true\n    }\n  }\n  return hasWarned\n}\n\nfunction checkDeprecations(\n  userConfig: NextConfig,\n  configFileName: string,\n  silent: boolean,\n  dir: string\n) {\n  warnOptionHasBeenDeprecated(\n    userConfig,\n    'amp',\n    `Built-in amp support is deprecated and the \\`amp\\` configuration option will be removed in Next.js 16.`,\n    silent\n  )\n\n  warnOptionHasBeenDeprecated(\n    userConfig,\n    'experimental.amp',\n    `Built-in amp support is deprecated and the \\`experimental.amp\\` configuration option will be removed in Next.js 16.`,\n    silent\n  )\n\n  warnOptionHasBeenDeprecated(\n    userConfig,\n    'publicRuntimeConfig',\n    `Runtime config is deprecated and the \\`publicRuntimeConfig\\` configuration option will be removed in Next.js 16.`,\n    silent\n  )\n  warnOptionHasBeenDeprecated(\n    userConfig,\n    'serverRuntimeConfig',\n    `Runtime config is deprecated and the \\`serverRuntimeConfig\\` configuration option will be removed in Next.js 16.`,\n    silent\n  )\n\n  if (userConfig.experimental?.dynamicIO !== undefined) {\n    warnOptionHasBeenDeprecated(\n      userConfig,\n      'experimental.dynamicIO',\n      `\\`experimental.dynamicIO\\` has been renamed to \\`experimental.cacheComponents\\`. Please update your ${configFileName} file accordingly.`,\n      silent\n    )\n  }\n\n  warnOptionHasBeenDeprecated(\n    userConfig,\n    'experimental.instrumentationHook',\n    `\\`experimental.instrumentationHook\\` is no longer needed, because \\`instrumentation.js\\` is available by default. You can remove it from ${configFileName}.`,\n    silent\n  )\n\n  warnOptionHasBeenDeprecated(\n    userConfig,\n    'experimental.after',\n    `\\`experimental.after\\` is no longer needed, because \\`after\\` is available by default. You can remove it from ${configFileName}.`,\n    silent\n  )\n\n  warnOptionHasBeenDeprecated(\n    userConfig,\n    'devIndicators.appIsrStatus',\n    `\\`devIndicators.appIsrStatus\\` is deprecated and no longer configurable. Please remove it from ${configFileName}.`,\n    silent\n  )\n\n  warnOptionHasBeenDeprecated(\n    userConfig,\n    'devIndicators.buildActivity',\n    `\\`devIndicators.buildActivity\\` is deprecated and no longer configurable. Please remove it from ${configFileName}.`,\n    silent\n  )\n\n  warnOptionHasBeenDeprecated(\n    userConfig,\n    'devIndicators.buildActivityPosition',\n    `\\`devIndicators.buildActivityPosition\\` has been renamed to \\`devIndicators.position\\`. Please update your ${configFileName} file accordingly.`,\n    silent\n  )\n\n  // i18n deprecation for App Router\n  if (userConfig.i18n) {\n    const hasAppDir = Boolean(findDir(dir, 'app'))\n    if (hasAppDir) {\n      warnOptionHasBeenDeprecated(\n        userConfig,\n        'i18n',\n        `i18n configuration in ${configFileName} is unsupported in App Router.\\nLearn more about internationalization in App Router: https://nextjs.org/docs/app/building-your-application/routing/internationalization`,\n        silent\n      )\n    }\n  }\n}\n\nexport function warnOptionHasBeenMovedOutOfExperimental(\n  config: NextConfig,\n  oldExperimentalKey: string,\n  newKey: string,\n  configFileName: string,\n  silent: boolean\n) {\n  if (config.experimental && oldExperimentalKey in config.experimental) {\n    if (!silent) {\n      Log.warn(\n        `\\`experimental.${oldExperimentalKey}\\` has been moved to \\`${newKey}\\`. ` +\n          `Please update your ${configFileName} file accordingly.`\n      )\n    }\n\n    let current = config\n    const newKeys = newKey.split('.')\n    while (newKeys.length > 1) {\n      const key = newKeys.shift()!\n      current[key] = current[key] || {}\n      current = current[key]\n    }\n    current[newKeys.shift()!] = (config.experimental as any)[oldExperimentalKey]\n  }\n\n  return config\n}\n\nfunction warnCustomizedOption(\n  config: NextConfig,\n  key: string,\n  defaultValue: any,\n  customMessage: string,\n  configFileName: string,\n  silent: boolean\n) {\n  const segs = key.split('.')\n  let current = config\n\n  while (segs.length >= 1) {\n    const seg = segs.shift()!\n    if (!(seg in current)) {\n      return\n    }\n    current = current[seg]\n  }\n\n  if (!silent && current !== defaultValue) {\n    Log.warn(\n      `The \"${key}\" option has been modified. ${customMessage ? customMessage + '. ' : ''}It should be removed from your ${configFileName}.`\n    )\n  }\n}\n\nfunction assignDefaults(\n  dir: string,\n  userConfig: NextConfig & { configFileName: string },\n  silent: boolean\n): NextConfigComplete {\n  const configFileName = userConfig.configFileName\n  if (typeof userConfig.exportTrailingSlash !== 'undefined') {\n    if (!silent) {\n      Log.warn(\n        `The \"exportTrailingSlash\" option has been renamed to \"trailingSlash\". Please update your ${configFileName}.`\n      )\n    }\n    if (typeof userConfig.trailingSlash === 'undefined') {\n      userConfig.trailingSlash = userConfig.exportTrailingSlash\n    }\n    delete userConfig.exportTrailingSlash\n  }\n\n  // Handle migration of experimental.dynamicIO to experimental.cacheComponents\n  if (userConfig.experimental?.dynamicIO !== undefined) {\n    // If cacheComponents was not explicitly set by the user (i.e., it's still the default value),\n    // use the dynamicIO value. We check against the user config, not the merged result.\n    if (userConfig.experimental?.cacheComponents === undefined) {\n      userConfig.experimental.cacheComponents =\n        userConfig.experimental.dynamicIO\n    }\n\n    // Remove the deprecated property\n    delete userConfig.experimental.dynamicIO\n  }\n\n  const config = Object.keys(userConfig).reduce<{ [key: string]: any }>(\n    (currentConfig, key) => {\n      const value = userConfig[key]\n\n      if (value === undefined || value === null) {\n        return currentConfig\n      }\n\n      if (key === 'distDir') {\n        if (typeof value !== 'string') {\n          throw new Error(\n            `Specified distDir is not a string, found type \"${typeof value}\"`\n          )\n        }\n        const userDistDir = value.trim()\n\n        // don't allow public as the distDir as this is a reserved folder for\n        // public files\n        if (userDistDir === 'public') {\n          throw new Error(\n            `The 'public' directory is reserved in Next.js and can not be set as the 'distDir'. https://nextjs.org/docs/messages/can-not-output-to-public`\n          )\n        }\n        // make sure distDir isn't an empty string as it can result in the provided\n        // directory being deleted in development mode\n        if (userDistDir.length === 0) {\n          throw new Error(\n            `Invalid distDir provided, distDir can not be an empty string. Please remove this config or set it to undefined`\n          )\n        }\n      }\n\n      if (key === 'pageExtensions') {\n        if (!Array.isArray(value)) {\n          throw new Error(\n            `Specified pageExtensions is not an array of strings, found \"${value}\". Please update this config or remove it.`\n          )\n        }\n\n        if (!value.length) {\n          throw new Error(\n            `Specified pageExtensions is an empty array. Please update it with the relevant extensions or remove it.`\n          )\n        }\n\n        value.forEach((ext) => {\n          if (typeof ext !== 'string') {\n            throw new Error(\n              `Specified pageExtensions is not an array of strings, found \"${ext}\" of type \"${typeof ext}\". Please update this config or remove it.`\n            )\n          }\n        })\n      }\n\n      const defaultValue = (defaultConfig as Record<string, unknown>)[key]\n\n      if (\n        !!value &&\n        value.constructor === Object &&\n        typeof defaultValue === 'object'\n      ) {\n        currentConfig[key] = {\n          ...defaultValue,\n          ...Object.keys(value).reduce<any>((c, k) => {\n            const v = value[k]\n            if (v !== undefined && v !== null) {\n              c[k] = v\n            }\n            return c\n          }, {}),\n        }\n      } else {\n        currentConfig[key] = value\n      }\n\n      return currentConfig\n    },\n    {}\n  ) as NextConfig & { configFileName: string }\n\n  const result = {\n    ...defaultConfig,\n    ...config,\n    experimental: {\n      ...defaultConfig.experimental,\n      ...config.experimental,\n    },\n  }\n\n  // ensure correct default is set for api-resolver revalidate handling\n  if (!result.experimental?.trustHostHeader && ciEnvironment.hasNextSupport) {\n    result.experimental.trustHostHeader = true\n  }\n\n  if (\n    result.experimental?.allowDevelopmentBuild &&\n    process.env.NODE_ENV !== 'development'\n  ) {\n    throw new Error(\n      `The experimental.allowDevelopmentBuild option requires NODE_ENV to be explicitly set to 'development'.`\n    )\n  }\n\n  if (isStableBuild()) {\n    // Prevents usage of certain experimental features outside of canary\n    if (result.experimental?.ppr) {\n      throw new CanaryOnlyError({ feature: 'experimental.ppr' })\n    } else if (result.experimental?.cacheComponents) {\n      throw new CanaryOnlyError({ feature: 'experimental.cacheComponents' })\n    } else if (result.experimental?.turbopackPersistentCaching) {\n      throw new CanaryOnlyError({\n        feature: 'experimental.turbopackPersistentCaching',\n      })\n    }\n  }\n\n  if (result.output === 'export') {\n    if (result.i18n) {\n      throw new Error(\n        'Specified \"i18n\" cannot be used with \"output: export\". See more info here: https://nextjs.org/docs/messages/export-no-i18n'\n      )\n    }\n\n    if (!hasNextSupport) {\n      if (result.rewrites) {\n        Log.warn(\n          'Specified \"rewrites\" will not automatically work with \"output: export\". See more info here: https://nextjs.org/docs/messages/export-no-custom-routes'\n        )\n      }\n      if (result.redirects) {\n        Log.warn(\n          'Specified \"redirects\" will not automatically work with \"output: export\". See more info here: https://nextjs.org/docs/messages/export-no-custom-routes'\n        )\n      }\n      if (result.headers) {\n        Log.warn(\n          'Specified \"headers\" will not automatically work with \"output: export\". See more info here: https://nextjs.org/docs/messages/export-no-custom-routes'\n        )\n      }\n    }\n  }\n\n  if (typeof result.assetPrefix !== 'string') {\n    throw new Error(\n      `Specified assetPrefix is not a string, found type \"${typeof result.assetPrefix}\" https://nextjs.org/docs/messages/invalid-assetprefix`\n    )\n  }\n\n  if (typeof result.basePath !== 'string') {\n    throw new Error(\n      `Specified basePath is not a string, found type \"${typeof result.basePath}\"`\n    )\n  }\n\n  if (result.basePath !== '') {\n    if (result.basePath === '/') {\n      throw new Error(\n        `Specified basePath /. basePath has to be either an empty string or a path prefix\"`\n      )\n    }\n\n    if (!result.basePath.startsWith('/')) {\n      throw new Error(\n        `Specified basePath has to start with a /, found \"${result.basePath}\"`\n      )\n    }\n\n    if (result.basePath !== '/') {\n      if (result.basePath.endsWith('/')) {\n        throw new Error(\n          `Specified basePath should not end with /, found \"${result.basePath}\"`\n        )\n      }\n\n      if (result.assetPrefix === '') {\n        result.assetPrefix = result.basePath\n      }\n\n      if (result.amp?.canonicalBase === '') {\n        result.amp.canonicalBase = result.basePath\n      }\n    }\n  }\n\n  if (result?.images) {\n    const images: ImageConfig = result.images\n\n    if (typeof images !== 'object') {\n      throw new Error(\n        `Specified images should be an object received ${typeof images}.\\nSee more info here: https://nextjs.org/docs/messages/invalid-images-config`\n      )\n    }\n\n    if (images.localPatterns) {\n      if (!Array.isArray(images.localPatterns)) {\n        throw new Error(\n          `Specified images.localPatterns should be an Array received ${typeof images.localPatterns}.\\nSee more info here: https://nextjs.org/docs/messages/invalid-images-config`\n        )\n      }\n      // avoid double-pushing the same pattern if it already exists\n      const hasMatch = images.localPatterns.some(\n        (pattern) =>\n          pattern.pathname === '/_next/static/media/**' && pattern.search === ''\n      )\n      if (!hasMatch) {\n        // static import images are automatically allowed\n        images.localPatterns.push({\n          pathname: '/_next/static/media/**',\n          search: '',\n        })\n      }\n    }\n\n    if (images.remotePatterns) {\n      if (!Array.isArray(images.remotePatterns)) {\n        throw new Error(\n          `Specified images.remotePatterns should be an Array received ${typeof images.remotePatterns}.\\nSee more info here: https://nextjs.org/docs/messages/invalid-images-config`\n        )\n      }\n\n      // We must convert URL to RemotePattern since URL has a colon in the protocol\n      // and also has additional properties we want to filter out. Also, new URL()\n      // accepts any protocol so we need manual validation here.\n      images.remotePatterns = images.remotePatterns.map(\n        ({ protocol, hostname, port, pathname, search }) => {\n          const proto = protocol?.replace(/:$/, '')\n          if (!['http', 'https', undefined].includes(proto)) {\n            throw new Error(\n              `Specified images.remotePatterns must have protocol \"http\" or \"https\" received \"${proto}\".`\n            )\n          }\n          return {\n            protocol: proto as 'http' | 'https' | undefined,\n            hostname,\n            port,\n            pathname,\n            search,\n          }\n        }\n      )\n\n      // static images are automatically prefixed with assetPrefix\n      // so we need to ensure _next/image allows downloading from\n      // this resource\n      if (config.assetPrefix?.startsWith('http')) {\n        try {\n          const url = new URL(config.assetPrefix)\n          const hasMatchForAssetPrefix = images.remotePatterns.some((pattern) =>\n            matchRemotePattern(pattern, url)\n          )\n\n          // avoid double-pushing the same pattern if it already can be matched\n          if (!hasMatchForAssetPrefix) {\n            images.remotePatterns.push({\n              hostname: url.hostname,\n              protocol: url.protocol.replace(/:$/, '') as 'http' | 'https',\n              port: url.port,\n            })\n          }\n        } catch (error) {\n          throw new Error(\n            `Invalid assetPrefix provided. Original error: ${error}`\n          )\n        }\n      }\n    }\n\n    if (images.domains) {\n      if (!Array.isArray(images.domains)) {\n        throw new Error(\n          `Specified images.domains should be an Array received ${typeof images.domains}.\\nSee more info here: https://nextjs.org/docs/messages/invalid-images-config`\n        )\n      }\n    }\n\n    if (!images.loader) {\n      images.loader = 'default'\n    }\n\n    if (\n      images.loader !== 'default' &&\n      images.loader !== 'custom' &&\n      images.path === imageConfigDefault.path\n    ) {\n      throw new Error(\n        `Specified images.loader property (${images.loader}) also requires images.path property to be assigned to a URL prefix.\\nSee more info here: https://nextjs.org/docs/api-reference/next/legacy/image#loader-configuration`\n      )\n    }\n\n    if (\n      images.path === imageConfigDefault.path &&\n      result.basePath &&\n      !pathHasPrefix(images.path, result.basePath)\n    ) {\n      images.path = `${result.basePath}${images.path}`\n    }\n\n    // Append trailing slash for non-default loaders and when trailingSlash is set\n    if (\n      images.path &&\n      !images.path.endsWith('/') &&\n      (images.loader !== 'default' || result.trailingSlash)\n    ) {\n      images.path += '/'\n    }\n\n    if (images.loaderFile) {\n      if (images.loader !== 'default' && images.loader !== 'custom') {\n        throw new Error(\n          `Specified images.loader property (${images.loader}) cannot be used with images.loaderFile property. Please set images.loader to \"custom\".`\n        )\n      }\n      const absolutePath = join(dir, images.loaderFile)\n      if (!existsSync(absolutePath)) {\n        throw new Error(\n          `Specified images.loaderFile does not exist at \"${absolutePath}\".`\n        )\n      }\n      images.loaderFile = absolutePath\n    }\n  }\n\n  warnCustomizedOption(\n    result,\n    'experimental.esmExternals',\n    true,\n    'experimental.esmExternals is not recommended to be modified as it may disrupt module resolution',\n    configFileName,\n    silent\n  )\n\n  // Handle buildActivityPosition migration (needs to be done after merging with defaults)\n  if (\n    result.devIndicators &&\n    typeof result.devIndicators === 'object' &&\n    'buildActivityPosition' in result.devIndicators &&\n    result.devIndicators.buildActivityPosition !== result.devIndicators.position\n  ) {\n    if (!silent) {\n      Log.warnOnce(\n        `The \\`devIndicators\\` option \\`buildActivityPosition\\` (\"${result.devIndicators.buildActivityPosition}\") conflicts with \\`position\\` (\"${result.devIndicators.position}\"). Using \\`buildActivityPosition\\` (\"${result.devIndicators.buildActivityPosition}\") for backward compatibility.`\n      )\n    }\n    result.devIndicators.position = result.devIndicators.buildActivityPosition\n  }\n\n  warnOptionHasBeenMovedOutOfExperimental(\n    result,\n    'bundlePagesExternals',\n    'bundlePagesRouterDependencies',\n    configFileName,\n    silent\n  )\n  warnOptionHasBeenMovedOutOfExperimental(\n    result,\n    'serverComponentsExternalPackages',\n    'serverExternalPackages',\n    configFileName,\n    silent\n  )\n  warnOptionHasBeenMovedOutOfExperimental(\n    result,\n    'relay',\n    'compiler.relay',\n    configFileName,\n    silent\n  )\n  warnOptionHasBeenMovedOutOfExperimental(\n    result,\n    'styledComponents',\n    'compiler.styledComponents',\n    configFileName,\n    silent\n  )\n  warnOptionHasBeenMovedOutOfExperimental(\n    result,\n    'emotion',\n    'compiler.emotion',\n    configFileName,\n    silent\n  )\n  warnOptionHasBeenMovedOutOfExperimental(\n    result,\n    'reactRemoveProperties',\n    'compiler.reactRemoveProperties',\n    configFileName,\n    silent\n  )\n  warnOptionHasBeenMovedOutOfExperimental(\n    result,\n    'removeConsole',\n    'compiler.removeConsole',\n    configFileName,\n    silent\n  )\n  warnOptionHasBeenMovedOutOfExperimental(\n    result,\n    'swrDelta',\n    'expireTime',\n    configFileName,\n    silent\n  )\n  warnOptionHasBeenMovedOutOfExperimental(\n    result,\n    'typedRoutes',\n    'typedRoutes',\n    configFileName,\n    silent\n  )\n  warnOptionHasBeenMovedOutOfExperimental(\n    result,\n    'outputFileTracingRoot',\n    'outputFileTracingRoot',\n    configFileName,\n    silent\n  )\n  warnOptionHasBeenMovedOutOfExperimental(\n    result,\n    'outputFileTracingIncludes',\n    'outputFileTracingIncludes',\n    configFileName,\n    silent\n  )\n  warnOptionHasBeenMovedOutOfExperimental(\n    result,\n    'outputFileTracingExcludes',\n    'outputFileTracingExcludes',\n    configFileName,\n    silent\n  )\n\n  if ((result.experimental as any).outputStandalone) {\n    if (!silent) {\n      Log.warn(\n        `experimental.outputStandalone has been renamed to \"output: 'standalone'\", please move the config.`\n      )\n    }\n    result.output = 'standalone'\n  }\n\n  if (\n    typeof result.experimental?.serverActions?.bodySizeLimit !== 'undefined'\n  ) {\n    const value = parseInt(\n      result.experimental.serverActions?.bodySizeLimit.toString()\n    )\n    if (isNaN(value) || value < 1) {\n      throw new Error(\n        'Server Actions Size Limit must be a valid number or filesize format larger than 1MB: https://nextjs.org/docs/app/api-reference/next-config-js/serverActions#bodysizelimit'\n      )\n    }\n  }\n\n  // Normalize & validate experimental.middlewareClientMaxBodySize\n  if (typeof result.experimental?.middlewareClientMaxBodySize !== 'undefined') {\n    const middlewareClientMaxBodySize =\n      result.experimental.middlewareClientMaxBodySize\n    let normalizedValue: number\n\n    if (typeof middlewareClientMaxBodySize === 'string') {\n      const bytes =\n        require('next/dist/compiled/bytes') as typeof import('next/dist/compiled/bytes')\n      normalizedValue = bytes.parse(middlewareClientMaxBodySize)\n    } else if (typeof middlewareClientMaxBodySize === 'number') {\n      normalizedValue = middlewareClientMaxBodySize\n    } else {\n      throw new Error(\n        'Client Max Body Size must be a valid number (bytes) or filesize format string (e.g., \"5mb\")'\n      )\n    }\n\n    if (isNaN(normalizedValue) || normalizedValue < 1) {\n      throw new Error('Client Max Body Size must be larger than 0 bytes')\n    }\n\n    // Store the normalized value as a number\n    result.experimental.middlewareClientMaxBodySize = normalizedValue\n  }\n\n  warnOptionHasBeenMovedOutOfExperimental(\n    result,\n    'transpilePackages',\n    'transpilePackages',\n    configFileName,\n    silent\n  )\n  warnOptionHasBeenMovedOutOfExperimental(\n    result,\n    'skipMiddlewareUrlNormalize',\n    'skipMiddlewareUrlNormalize',\n    configFileName,\n    silent\n  )\n  warnOptionHasBeenMovedOutOfExperimental(\n    result,\n    'skipTrailingSlashRedirect',\n    'skipTrailingSlashRedirect',\n    configFileName,\n    silent\n  )\n\n  if (\n    result?.outputFileTracingRoot &&\n    !isAbsolute(result.outputFileTracingRoot)\n  ) {\n    result.outputFileTracingRoot = resolve(result.outputFileTracingRoot)\n    if (!silent) {\n      Log.warn(\n        `outputFileTracingRoot should be absolute, using: ${result.outputFileTracingRoot}`\n      )\n    }\n  }\n\n  if (result?.turbopack?.root && !isAbsolute(result.turbopack.root)) {\n    result.turbopack.root = resolve(result.turbopack.root)\n    if (!silent) {\n      Log.warn(\n        `turbopack.root should be absolute, using: ${result.turbopack.root}`\n      )\n    }\n  }\n\n  // only leverage deploymentId\n  if (process.env.NEXT_DEPLOYMENT_ID) {\n    result.deploymentId = process.env.NEXT_DEPLOYMENT_ID\n  }\n\n  const tracingRoot = result?.outputFileTracingRoot\n  const turbopackRoot = result?.turbopack?.root\n\n  // If both provided, validate they match. If not, use outputFileTracingRoot.\n  if (tracingRoot && turbopackRoot && tracingRoot !== turbopackRoot) {\n    Log.warn(\n      `Both \\`outputFileTracingRoot\\` and \\`turbopack.root\\` are set, but they must have the same value.\\n` +\n        `Using \\`outputFileTracingRoot\\` value: ${tracingRoot}.`\n    )\n  }\n\n  const rootDir = tracingRoot || turbopackRoot || findRootDir(dir)\n\n  if (!rootDir) {\n    throw new Error(\n      'Failed to find the root directory of the project. This is a bug in Next.js.'\n    )\n  }\n\n  // Ensure both properties are set to the same value\n  result.outputFileTracingRoot = rootDir\n  dset(result, ['turbopack', 'root'], rootDir)\n\n  setHttpClientAndAgentOptions(result || defaultConfig)\n\n  if (result.i18n) {\n    const { i18n } = result\n    const i18nType = typeof i18n\n\n    if (i18nType !== 'object') {\n      throw new Error(\n        `Specified i18n should be an object received ${i18nType}.\\nSee more info here: https://nextjs.org/docs/messages/invalid-i18n-config`\n      )\n    }\n\n    if (!Array.isArray(i18n.locales)) {\n      throw new Error(\n        `Specified i18n.locales should be an Array received ${typeof i18n.locales}.\\nSee more info here: https://nextjs.org/docs/messages/invalid-i18n-config`\n      )\n    }\n\n    if (i18n.locales.length > 100 && !silent) {\n      Log.warn(\n        `Received ${i18n.locales.length} i18n.locales items which exceeds the recommended max of 100.\\nSee more info here: https://nextjs.org/docs/advanced-features/i18n-routing#how-does-this-work-with-static-generation`\n      )\n    }\n\n    const defaultLocaleType = typeof i18n.defaultLocale\n\n    if (!i18n.defaultLocale || defaultLocaleType !== 'string') {\n      throw new Error(\n        `Specified i18n.defaultLocale should be a string.\\nSee more info here: https://nextjs.org/docs/messages/invalid-i18n-config`\n      )\n    }\n\n    if (typeof i18n.domains !== 'undefined' && !Array.isArray(i18n.domains)) {\n      throw new Error(\n        `Specified i18n.domains must be an array of domain objects e.g. [ { domain: 'example.fr', defaultLocale: 'fr', locales: ['fr'] } ] received ${typeof i18n.domains}.\\nSee more info here: https://nextjs.org/docs/messages/invalid-i18n-config`\n      )\n    }\n\n    if (i18n.domains) {\n      const invalidDomainItems = i18n.domains.filter((item) => {\n        if (!item || typeof item !== 'object') return true\n        if (!item.defaultLocale) return true\n        if (!item.domain || typeof item.domain !== 'string') return true\n\n        if (item.domain.includes(':')) {\n          console.warn(\n            `i18n domain: \"${item.domain}\" is invalid it should be a valid domain without protocol (https://) or port (:3000) e.g. example.vercel.sh`\n          )\n          return true\n        }\n\n        const defaultLocaleDuplicate = i18n.domains?.find(\n          (altItem) =>\n            altItem.defaultLocale === item.defaultLocale &&\n            altItem.domain !== item.domain\n        )\n\n        if (!silent && defaultLocaleDuplicate) {\n          console.warn(\n            `Both ${item.domain} and ${defaultLocaleDuplicate.domain} configured the defaultLocale ${item.defaultLocale} but only one can. Change one item's default locale to continue`\n          )\n          return true\n        }\n\n        let hasInvalidLocale = false\n\n        if (Array.isArray(item.locales)) {\n          for (const locale of item.locales) {\n            if (typeof locale !== 'string') hasInvalidLocale = true\n\n            for (const domainItem of i18n.domains || []) {\n              if (domainItem === item) continue\n              if (domainItem.locales && domainItem.locales.includes(locale)) {\n                console.warn(\n                  `Both ${item.domain} and ${domainItem.domain} configured the locale (${locale}) but only one can. Remove it from one i18n.domains config to continue`\n                )\n                hasInvalidLocale = true\n                break\n              }\n            }\n          }\n        }\n\n        return hasInvalidLocale\n      })\n\n      if (invalidDomainItems.length > 0) {\n        throw new Error(\n          `Invalid i18n.domains values:\\n${invalidDomainItems\n            .map((item: any) => JSON.stringify(item))\n            .join(\n              '\\n'\n            )}\\n\\ndomains value must follow format { domain: 'example.fr', defaultLocale: 'fr', locales: ['fr'] }.\\nSee more info here: https://nextjs.org/docs/messages/invalid-i18n-config`\n        )\n      }\n    }\n\n    if (!Array.isArray(i18n.locales)) {\n      throw new Error(\n        `Specified i18n.locales must be an array of locale strings e.g. [\"en-US\", \"nl-NL\"] received ${typeof i18n.locales}.\\nSee more info here: https://nextjs.org/docs/messages/invalid-i18n-config`\n      )\n    }\n\n    const invalidLocales = i18n.locales.filter(\n      (locale: any) => typeof locale !== 'string'\n    )\n\n    if (invalidLocales.length > 0) {\n      throw new Error(\n        `Specified i18n.locales contains invalid values (${invalidLocales\n          .map(String)\n          .join(\n            ', '\n          )}), locales must be valid locale tags provided as strings e.g. \"en-US\".\\n` +\n          `See here for list of valid language sub-tags: http://www.iana.org/assignments/language-subtag-registry/language-subtag-registry`\n      )\n    }\n\n    if (!i18n.locales.includes(i18n.defaultLocale)) {\n      throw new Error(\n        `Specified i18n.defaultLocale should be included in i18n.locales.\\nSee more info here: https://nextjs.org/docs/messages/invalid-i18n-config`\n      )\n    }\n\n    const normalizedLocales = new Set()\n    const duplicateLocales = new Set()\n\n    i18n.locales.forEach((locale) => {\n      const localeLower = locale.toLowerCase()\n      if (normalizedLocales.has(localeLower)) {\n        duplicateLocales.add(locale)\n      }\n      normalizedLocales.add(localeLower)\n    })\n\n    if (duplicateLocales.size > 0) {\n      throw new Error(\n        `Specified i18n.locales contains the following duplicate locales:\\n` +\n          `${[...duplicateLocales].join(', ')}\\n` +\n          `Each locale should be listed only once.\\n` +\n          `See more info here: https://nextjs.org/docs/messages/invalid-i18n-config`\n      )\n    }\n\n    // make sure default Locale is at the front\n    i18n.locales = [\n      i18n.defaultLocale,\n      ...i18n.locales.filter((locale) => locale !== i18n.defaultLocale),\n    ]\n\n    const localeDetectionType = typeof i18n.localeDetection\n\n    if (\n      localeDetectionType !== 'boolean' &&\n      localeDetectionType !== 'undefined'\n    ) {\n      throw new Error(\n        `Specified i18n.localeDetection should be undefined or a boolean received ${localeDetectionType}.\\nSee more info here: https://nextjs.org/docs/messages/invalid-i18n-config`\n      )\n    }\n  }\n\n  if (result.devIndicators !== false && result.devIndicators?.position) {\n    const { position } = result.devIndicators\n    const allowedValues = [\n      'top-left',\n      'top-right',\n      'bottom-left',\n      'bottom-right',\n    ]\n\n    if (!allowedValues.includes(position)) {\n      throw new Error(\n        `Invalid \"devIndicator.position\" provided, expected one of ${allowedValues.join(\n          ', '\n        )}, received ${position}`\n      )\n    }\n  }\n\n  if (result.experimental) {\n    result.experimental.cacheLife = {\n      ...defaultConfig.experimental?.cacheLife,\n      ...result.experimental.cacheLife,\n    }\n    const defaultDefault = defaultConfig.experimental?.cacheLife?.['default']\n    if (\n      !defaultDefault ||\n      defaultDefault.revalidate === undefined ||\n      defaultDefault.expire === undefined ||\n      !defaultConfig.experimental?.staleTimes?.static\n    ) {\n      throw new Error('No default cacheLife profile.')\n    }\n    const defaultCacheLifeProfile = result.experimental.cacheLife['default']\n    if (!defaultCacheLifeProfile) {\n      result.experimental.cacheLife['default'] = defaultDefault\n    } else {\n      if (defaultCacheLifeProfile.stale === undefined) {\n        const staticStaleTime = result.experimental.staleTimes?.static\n        defaultCacheLifeProfile.stale =\n          staticStaleTime ?? defaultConfig.experimental?.staleTimes?.static\n      }\n      if (defaultCacheLifeProfile.revalidate === undefined) {\n        defaultCacheLifeProfile.revalidate = defaultDefault.revalidate\n      }\n      if (defaultCacheLifeProfile.expire === undefined) {\n        defaultCacheLifeProfile.expire =\n          result.expireTime ?? defaultDefault.expire\n      }\n    }\n  }\n\n  if (result.experimental?.cacheHandlers) {\n    const allowedHandlerNameRegex = /[a-z-]/\n\n    if (typeof result.experimental.cacheHandlers !== 'object') {\n      throw new Error(\n        `Invalid \"experimental.cacheHandlers\" provided, expected an object e.g. { default: '/my-handler.js' }, received ${JSON.stringify(result.experimental.cacheHandlers)}`\n      )\n    }\n\n    const handlerKeys = Object.keys(result.experimental.cacheHandlers)\n    const invalidHandlerItems: Array<{ key: string; reason: string }> = []\n\n    for (const key of handlerKeys) {\n      if (key === 'private') {\n        invalidHandlerItems.push({\n          key,\n          reason:\n            'The cache handler for \"use cache: private\" cannot be customized.',\n        })\n      } else if (!allowedHandlerNameRegex.test(key)) {\n        invalidHandlerItems.push({\n          key,\n          reason: 'key must only use characters a-z and -',\n        })\n      } else {\n        const handlerPath = (\n          result.experimental.cacheHandlers as {\n            [handlerName: string]: string | undefined\n          }\n        )[key]\n\n        if (handlerPath && !existsSync(handlerPath)) {\n          invalidHandlerItems.push({\n            key,\n            reason: `cache handler path provided does not exist, received ${handlerPath}`,\n          })\n        }\n      }\n      if (invalidHandlerItems.length) {\n        throw new Error(\n          `Invalid handler fields configured for \"experimental.cacheHandler\":\\n${invalidHandlerItems.map((item) => `${key}: ${item.reason}`).join('\\n')}`\n        )\n      }\n    }\n  }\n\n  const userProvidedModularizeImports = result.modularizeImports\n  // Unfortunately these packages end up re-exporting 10600 modules, for example: https://unpkg.com/browse/@mui/icons-material@5.11.16/esm/index.js.\n  // Leveraging modularizeImports tremendously reduces compile times for these.\n  result.modularizeImports = {\n    ...(userProvidedModularizeImports || {}),\n    // This is intentionally added after the user-provided modularizeImports config.\n    '@mui/icons-material': {\n      transform: '@mui/icons-material/{{member}}',\n    },\n    lodash: {\n      transform: 'lodash/{{member}}',\n    },\n  }\n\n  const userProvidedOptimizePackageImports =\n    result.experimental?.optimizePackageImports || []\n\n  result.experimental.optimizePackageImports = [\n    ...new Set([\n      ...userProvidedOptimizePackageImports,\n      'lucide-react',\n      'date-fns',\n      'lodash-es',\n      'ramda',\n      'antd',\n      'react-bootstrap',\n      'ahooks',\n      '@ant-design/icons',\n      '@headlessui/react',\n      '@headlessui-float/react',\n      '@heroicons/react/20/solid',\n      '@heroicons/react/24/solid',\n      '@heroicons/react/24/outline',\n      '@visx/visx',\n      '@tremor/react',\n      'rxjs',\n      '@mui/material',\n      '@mui/icons-material',\n      'recharts',\n      'react-use',\n      'effect',\n      '@effect/schema',\n      '@effect/platform',\n      '@effect/platform-node',\n      '@effect/platform-browser',\n      '@effect/platform-bun',\n      '@effect/sql',\n      '@effect/sql-mssql',\n      '@effect/sql-mysql2',\n      '@effect/sql-pg',\n      '@effect/sql-sqlite-node',\n      '@effect/sql-sqlite-bun',\n      '@effect/sql-sqlite-wasm',\n      '@effect/sql-sqlite-react-native',\n      '@effect/rpc',\n      '@effect/rpc-http',\n      '@effect/typeclass',\n      '@effect/experimental',\n      '@effect/opentelemetry',\n      '@material-ui/core',\n      '@material-ui/icons',\n      '@tabler/icons-react',\n      'mui-core',\n      // We don't support wildcard imports for these configs, e.g. `react-icons/*`\n      // so we need to add them manually.\n      // In the future, we should consider automatically detecting packages that\n      // need to be optimized.\n      'react-icons/ai',\n      'react-icons/bi',\n      'react-icons/bs',\n      'react-icons/cg',\n      'react-icons/ci',\n      'react-icons/di',\n      'react-icons/fa',\n      'react-icons/fa6',\n      'react-icons/fc',\n      'react-icons/fi',\n      'react-icons/gi',\n      'react-icons/go',\n      'react-icons/gr',\n      'react-icons/hi',\n      'react-icons/hi2',\n      'react-icons/im',\n      'react-icons/io',\n      'react-icons/io5',\n      'react-icons/lia',\n      'react-icons/lib',\n      'react-icons/lu',\n      'react-icons/md',\n      'react-icons/pi',\n      'react-icons/ri',\n      'react-icons/rx',\n      'react-icons/si',\n      'react-icons/sl',\n      'react-icons/tb',\n      'react-icons/tfi',\n      'react-icons/ti',\n      'react-icons/vsc',\n      'react-icons/wi',\n    ]),\n  ]\n\n  if (!result.htmlLimitedBots) {\n    // @ts-expect-error: override the htmlLimitedBots with default string, type covert: RegExp -> string\n    result.htmlLimitedBots = HTML_LIMITED_BOT_UA_RE_STRING\n  }\n\n  // \"use cache\" was originally implicitly enabled with the cacheComponents flag, so\n  // we transfer the value for cacheComponents to the explicit useCache flag to ensure\n  // backwards compatibility.\n  if (result.experimental.useCache === undefined) {\n    result.experimental.useCache = result.experimental.cacheComponents\n  }\n\n  // If cacheComponents is enabled, we also enable PPR.\n  if (result.experimental.cacheComponents) {\n    if (\n      userConfig.experimental?.ppr === false ||\n      userConfig.experimental?.ppr === 'incremental'\n    ) {\n      throw new Error(\n        `\\`experimental.ppr\\` can not be \\`${JSON.stringify(userConfig.experimental?.ppr)}\\` when \\`experimental.cacheComponents\\` is \\`true\\`. PPR is implicitly enabled when Cache Components is enabled.`\n      )\n    }\n\n    result.experimental.ppr = true\n  }\n\n  return result as NextConfigComplete\n}\n\nasync function applyModifyConfig(\n  config: NextConfigComplete,\n  phase: string,\n  silent: boolean\n): Promise<NextConfigComplete> {\n  if (\n    // TODO: should this be called for server start as\n    // adapters shouldn't be relying on \"next start\"\n    [PHASE_PRODUCTION_BUILD, PHASE_PRODUCTION_SERVER].includes(phase) &&\n    config.experimental?.adapterPath\n  ) {\n    const adapterMod = interopDefault(\n      await import(\n        pathToFileURL(require.resolve(config.experimental.adapterPath)).href\n      )\n    ) as NextAdapter\n\n    if (typeof adapterMod.modifyConfig === 'function') {\n      if (!silent) {\n        Log.info(`Applying modifyConfig from ${adapterMod.name}`)\n      }\n      config = await adapterMod.modifyConfig(config)\n    }\n  }\n  return config\n}\n\n// Cache config with keys to handle multiple configurations (e.g., multi-zone)\nconst configCache = new Map<\n  string,\n  {\n    rawConfig: any\n    config: NextConfigComplete\n    configuredExperimentalFeatures: ConfiguredExperimentalFeature[]\n  }\n>()\n\n// Generate cache key based on parameters that affect config output\n// We need a unique key for cache because there can be multiple values\nfunction getCacheKey(\n  phase: string,\n  dir: string,\n  customConfig?: object | null,\n  reactProductionProfiling?: boolean,\n  debugPrerender?: boolean\n): string {\n  // The next.config.js is unique per project, so we can use the dir as the major key\n  // to generate the unique config key.\n  const keyData = JSON.stringify({\n    dir,\n    phase,\n    hasCustomConfig: Boolean(customConfig),\n    reactProductionProfiling: Boolean(reactProductionProfiling),\n    debugPrerender: Boolean(debugPrerender),\n  })\n\n  return djb2Hash(keyData).toString(36)\n}\n\nexport default async function loadConfig(\n  phase: string,\n  dir: string,\n  {\n    customConfig,\n    rawConfig,\n    silent = true,\n    reportExperimentalFeatures,\n    reactProductionProfiling,\n    debugPrerender,\n  }: {\n    customConfig?: object | null\n    rawConfig?: boolean\n    silent?: boolean\n    reportExperimentalFeatures?: (\n      configuredExperimentalFeatures: ConfiguredExperimentalFeature[]\n    ) => void\n    reactProductionProfiling?: boolean\n    debugPrerender?: boolean\n  } = {}\n): Promise<NextConfigComplete> {\n  // Generate cache key based on parameters that affect config output\n  const cacheKey = getCacheKey(\n    phase,\n    dir,\n    customConfig,\n    reactProductionProfiling,\n    debugPrerender\n  )\n\n  // Check if we have a cached result\n  const cachedResult = configCache.get(cacheKey)\n  if (cachedResult) {\n    // Call the experimental features callback if provided\n    if (reportExperimentalFeatures) {\n      reportExperimentalFeatures(cachedResult.configuredExperimentalFeatures)\n    }\n\n    // Return raw config if requested and available\n    if (rawConfig && cachedResult.rawConfig) {\n      return cachedResult.rawConfig\n    }\n\n    return cachedResult.config\n  }\n\n  // Original implementation continues below...\n  if (!process.env.__NEXT_PRIVATE_RENDER_WORKER) {\n    try {\n      loadWebpackHook()\n    } catch (err) {\n      // this can fail in standalone mode as the files\n      // aren't traced/included\n      if (!process.env.__NEXT_PRIVATE_STANDALONE_CONFIG) {\n        throw err\n      }\n    }\n  }\n\n  if (process.env.__NEXT_PRIVATE_STANDALONE_CONFIG) {\n    // we don't apply assignDefaults or modifyConfig here as it\n    // has already been applied\n    const standaloneConfig = JSON.parse(\n      process.env.__NEXT_PRIVATE_STANDALONE_CONFIG\n    )\n\n    // Cache the standalone config\n    configCache.set(cacheKey, {\n      config: standaloneConfig,\n      rawConfig: standaloneConfig,\n      configuredExperimentalFeatures: [],\n    })\n\n    return standaloneConfig\n  }\n\n  const curLog = silent\n    ? {\n        warn: () => {},\n        info: () => {},\n        error: () => {},\n      }\n    : Log\n\n  loadEnvConfig(dir, phase === PHASE_DEVELOPMENT_SERVER, curLog)\n\n  let configFileName = 'next.config.js'\n  const configuredExperimentalFeatures: ConfiguredExperimentalFeature[] = []\n\n  if (customConfig) {\n    // Check deprecation warnings on the custom config before merging with defaults\n    checkDeprecations(customConfig as NextConfig, configFileName, silent, dir)\n\n    const config = await applyModifyConfig(\n      assignDefaults(\n        dir,\n        {\n          configOrigin: 'server',\n          configFileName,\n          ...customConfig,\n        },\n        silent\n      ) as NextConfigComplete,\n      phase,\n      silent\n    )\n\n    // Cache the custom config result\n    configCache.set(cacheKey, {\n      config,\n      rawConfig: customConfig,\n      configuredExperimentalFeatures,\n    })\n\n    reportExperimentalFeatures?.(configuredExperimentalFeatures)\n\n    return config\n  }\n\n  const path = await findUp(CONFIG_FILES, { cwd: dir })\n\n  // If config file was found\n  if (path?.length) {\n    configFileName = basename(path)\n\n    let userConfigModule: any\n    try {\n      const envBefore = Object.assign({}, process.env)\n\n      // `import()` expects url-encoded strings, so the path must be properly\n      // escaped and (especially on Windows) absolute paths must pe prefixed\n      // with the `file://` protocol\n      if (process.env.__NEXT_TEST_MODE === 'jest') {\n        // dynamic import does not currently work inside of vm which\n        // jest relies on so we fall back to require for this case\n        // https://github.com/nodejs/node/issues/35889\n        userConfigModule = require(path)\n      } else if (configFileName === 'next.config.ts') {\n        userConfigModule = await transpileConfig({\n          nextConfigPath: path,\n          configFileName,\n          cwd: dir,\n        })\n      } else {\n        userConfigModule = await import(pathToFileURL(path).href)\n      }\n      const newEnv: typeof process.env = {} as any\n\n      for (const key of Object.keys(process.env)) {\n        if (envBefore[key] !== process.env[key]) {\n          newEnv[key] = process.env[key]\n        }\n      }\n      updateInitialEnv(newEnv)\n\n      if (rawConfig) {\n        // Cache the raw config\n        configCache.set(cacheKey, {\n          config: userConfigModule as NextConfigComplete,\n          rawConfig: userConfigModule,\n          configuredExperimentalFeatures,\n        })\n\n        reportExperimentalFeatures?.(configuredExperimentalFeatures)\n\n        return userConfigModule\n      }\n    } catch (err) {\n      // TODO: Modify docs to add cases of failing next.config.ts transformation\n      curLog.error(\n        `Failed to load ${configFileName}, see more info here https://nextjs.org/docs/messages/next-config-error`\n      )\n      throw err\n    }\n\n    const loadedConfig = Object.freeze(\n      (await normalizeConfig(\n        phase,\n        interopDefault(userConfigModule)\n      )) as NextConfig\n    )\n\n    if (loadedConfig.experimental) {\n      for (const name of Object.keys(\n        loadedConfig.experimental\n      ) as (keyof ExperimentalConfig)[]) {\n        const value = loadedConfig.experimental[name]\n\n        if (name === 'turbo' && !process.env.TURBOPACK) {\n          // Ignore any Turbopack config if Turbopack is not enabled\n          continue\n        }\n\n        addConfiguredExperimentalFeature(\n          configuredExperimentalFeatures,\n          name,\n          value\n        )\n      }\n    }\n\n    // Clone a new userConfig each time to avoid mutating the original\n    const userConfig = cloneObject(loadedConfig) as NextConfig\n\n    // Check deprecation warnings on the actual user config before merging with defaults\n    checkDeprecations(userConfig, configFileName, silent, dir)\n\n    // Always validate the config against schema in non minimal mode.\n    // Only validate once in the root Next.js process, not in forked processes.\n    const isRootProcess = typeof process.send !== 'function'\n    if (!process.env.NEXT_MINIMAL && isRootProcess) {\n      // We only validate the config against schema in non minimal mode\n      const { configSchema } =\n        require('./config-schema') as typeof import('./config-schema')\n      const state = configSchema.safeParse(userConfig)\n\n      if (!state.success) {\n        // error message header\n        const messages = [`Invalid ${configFileName} options detected: `]\n\n        const [errorMessages, shouldExit] = normalizeNextConfigZodErrors(\n          state.error\n        )\n        // ident list item\n        for (const error of errorMessages) {\n          messages.push(`    ${error}`)\n        }\n\n        // error message footer\n        messages.push(\n          'See more info here: https://nextjs.org/docs/messages/invalid-next-config'\n        )\n\n        if (shouldExit) {\n          for (const message of messages) {\n            console.error(message)\n          }\n          await flushAndExit(1)\n        } else {\n          for (const message of messages) {\n            curLog.warn(message)\n          }\n        }\n      }\n    }\n\n    if (userConfig.target && userConfig.target !== 'server') {\n      throw new Error(\n        `The \"target\" property is no longer supported in ${configFileName}.\\n` +\n          'See more info here https://nextjs.org/docs/messages/deprecated-target-config'\n      )\n    }\n\n    if (userConfig.amp?.canonicalBase) {\n      const { canonicalBase } = userConfig.amp || ({} as any)\n      userConfig.amp = userConfig.amp || {}\n      userConfig.amp.canonicalBase =\n        (canonicalBase?.endsWith('/')\n          ? canonicalBase.slice(0, -1)\n          : canonicalBase) || ''\n    }\n\n    if (reactProductionProfiling) {\n      userConfig.reactProductionProfiling = reactProductionProfiling\n    }\n\n    if (\n      userConfig.experimental?.turbo?.loaders &&\n      !userConfig.experimental?.turbo?.rules\n    ) {\n      curLog.warn(\n        'experimental.turbo.loaders is now deprecated. Please update next.config.js to use experimental.turbo.rules as soon as possible.\\n' +\n          'The new option is similar, but the key should be a glob instead of an extension.\\n' +\n          'Example: loaders: { \".mdx\": [\"mdx-loader\"] } -> rules: { \"*.mdx\": [\"mdx-loader\"] }\" }\\n' +\n          'See more info here https://nextjs.org/docs/app/api-reference/next-config-js/turbo'\n      )\n\n      const rules: Record<string, TurbopackLoaderItem[]> = {}\n      for (const [ext, loaders] of Object.entries(\n        userConfig.experimental.turbo.loaders\n      )) {\n        rules['*' + ext] = loaders as TurbopackLoaderItem[]\n      }\n\n      userConfig.experimental.turbo.rules = rules\n    }\n\n    if (userConfig.experimental?.turbo) {\n      curLog.warn(\n        'The config property `experimental.turbo` is deprecated. Move this setting to `config.turbopack` or run `npx @next/codemod@latest next-experimental-turbo-to-turbopack .`'\n      )\n\n      // Merge the two configs, preferring values in `config.turbopack`.\n      userConfig.turbopack = {\n        ...userConfig.experimental.turbo,\n        ...userConfig.turbopack,\n      }\n      userConfig.experimental.turbopackMemoryLimit ??=\n        userConfig.experimental.turbo.memoryLimit\n      userConfig.experimental.turbopackMinify ??=\n        userConfig.experimental.turbo.minify\n      userConfig.experimental.turbopackTreeShaking ??=\n        userConfig.experimental.turbo.treeShaking\n      userConfig.experimental.turbopackSourceMaps ??=\n        userConfig.experimental.turbo.sourceMaps\n    }\n\n    if (userConfig.experimental?.useLightningcss) {\n      const { loadBindings } =\n        require('../build/swc') as typeof import('../build/swc')\n      const isLightningSupported = (await loadBindings())?.css?.lightning\n\n      if (!isLightningSupported) {\n        curLog.warn(\n          `experimental.useLightningcss is set, but the setting is disabled because next-swc/wasm does not support it yet.`\n        )\n        userConfig.experimental.useLightningcss = false\n      }\n    }\n\n    // serialize the regex config into string\n    if (userConfig?.htmlLimitedBots instanceof RegExp) {\n      // @ts-expect-error: override the htmlLimitedBots with default string, type covert: RegExp -> string\n      userConfig.htmlLimitedBots = userConfig.htmlLimitedBots.source\n    }\n\n    enforceExperimentalFeatures(userConfig, {\n      isDefaultConfig: false,\n      configuredExperimentalFeatures,\n      debugPrerender,\n      phase,\n    })\n\n    const completeConfig = assignDefaults(\n      dir,\n      {\n        configOrigin: relative(dir, path),\n        configFile: path,\n        configFileName,\n        ...userConfig,\n      },\n      silent\n    ) as NextConfigComplete\n\n    const finalConfig = await applyModifyConfig(completeConfig, phase, silent)\n\n    // Cache the final result\n    configCache.set(cacheKey, {\n      config: finalConfig,\n      rawConfig: userConfigModule, // Store the original user config module\n      configuredExperimentalFeatures,\n    })\n\n    if (reportExperimentalFeatures) {\n      reportExperimentalFeatures(configuredExperimentalFeatures)\n    }\n\n    return finalConfig\n  } else {\n    const configBaseName = basename(CONFIG_FILES[0], extname(CONFIG_FILES[0]))\n    const unsupportedConfig = findUp.sync(\n      [\n        `${configBaseName}.cjs`,\n        `${configBaseName}.cts`,\n        `${configBaseName}.mts`,\n        `${configBaseName}.json`,\n        `${configBaseName}.jsx`,\n        `${configBaseName}.tsx`,\n      ],\n      { cwd: dir }\n    )\n    if (unsupportedConfig?.length) {\n      throw new Error(\n        `Configuring Next.js via '${basename(\n          unsupportedConfig\n        )}' is not supported. Please replace the file with 'next.config.js', 'next.config.mjs', or 'next.config.ts'.`\n      )\n    }\n  }\n\n  const clonedDefaultConfig = cloneObject(defaultConfig) as NextConfig\n\n  enforceExperimentalFeatures(clonedDefaultConfig, {\n    isDefaultConfig: true,\n    configuredExperimentalFeatures,\n    debugPrerender,\n    phase,\n  })\n\n  // always call assignDefaults to ensure settings like\n  // reactRoot can be updated correctly even with no next.config.js\n  const completeConfig = assignDefaults(\n    dir,\n    { ...clonedDefaultConfig, configFileName },\n    silent\n  ) as NextConfigComplete\n\n  setHttpClientAndAgentOptions(completeConfig)\n\n  const finalConfig = await applyModifyConfig(completeConfig, phase, silent)\n\n  // Cache the default config result\n  configCache.set(cacheKey, {\n    config: finalConfig,\n    rawConfig: clonedDefaultConfig,\n    configuredExperimentalFeatures,\n  })\n\n  if (reportExperimentalFeatures) {\n    reportExperimentalFeatures(configuredExperimentalFeatures)\n  }\n\n  return finalConfig\n}\n\nexport type ConfiguredExperimentalFeature = {\n  key: keyof ExperimentalConfig\n  value: ExperimentalConfig[keyof ExperimentalConfig]\n  reason?: string\n}\n\nfunction enforceExperimentalFeatures(\n  config: NextConfig,\n  options: {\n    isDefaultConfig: boolean\n    configuredExperimentalFeatures: ConfiguredExperimentalFeature[] | undefined\n    debugPrerender: boolean | undefined\n    phase: string\n  }\n) {\n  const {\n    configuredExperimentalFeatures,\n    debugPrerender,\n    isDefaultConfig,\n    phase,\n  } = options\n\n  config.experimental ??= {}\n\n  if (\n    debugPrerender &&\n    (phase === PHASE_PRODUCTION_BUILD || phase === PHASE_EXPORT)\n  ) {\n    setExperimentalFeatureForDebugPrerender(\n      config.experimental,\n      'serverSourceMaps',\n      true,\n      configuredExperimentalFeatures\n    )\n\n    setExperimentalFeatureForDebugPrerender(\n      config.experimental,\n      process.env.TURBOPACK ? 'turbopackMinify' : 'serverMinification',\n      false,\n      configuredExperimentalFeatures\n    )\n\n    setExperimentalFeatureForDebugPrerender(\n      config.experimental,\n      'enablePrerenderSourceMaps',\n      true,\n      configuredExperimentalFeatures\n    )\n\n    setExperimentalFeatureForDebugPrerender(\n      config.experimental,\n      'prerenderEarlyExit',\n      false,\n      configuredExperimentalFeatures\n    )\n  }\n\n  // TODO: Remove this once we've made Cache Components the default.\n  if (\n    process.env.__NEXT_EXPERIMENTAL_CACHE_COMPONENTS === 'true' &&\n    // We do respect an explicit value in the user config.\n    (config.experimental.ppr === undefined ||\n      (isDefaultConfig && !config.experimental.ppr))\n  ) {\n    config.experimental.ppr = true\n\n    if (configuredExperimentalFeatures) {\n      addConfiguredExperimentalFeature(\n        configuredExperimentalFeatures,\n        'ppr',\n        true,\n        'enabled by `__NEXT_EXPERIMENTAL_CACHE_COMPONENTS`'\n      )\n    }\n  }\n\n  // TODO: Remove this once we've made Cache Components the default.\n  if (\n    process.env.__NEXT_EXPERIMENTAL_PPR === 'true' &&\n    // We do respect an explicit value in the user config.\n    (config.experimental.ppr === undefined ||\n      (isDefaultConfig && !config.experimental.ppr))\n  ) {\n    config.experimental.ppr = true\n\n    if (configuredExperimentalFeatures) {\n      addConfiguredExperimentalFeature(\n        configuredExperimentalFeatures,\n        'ppr',\n        true,\n        'enabled by `__NEXT_EXPERIMENTAL_PPR`'\n      )\n    }\n  }\n\n  // TODO: Remove this once we've made Client Segment Cache the default.\n  if (\n    process.env.__NEXT_EXPERIMENTAL_PPR === 'true' &&\n    // We do respect an explicit value in the user config.\n    (config.experimental.clientSegmentCache === undefined ||\n      (isDefaultConfig && !config.experimental.clientSegmentCache))\n  ) {\n    config.experimental.clientSegmentCache = true\n\n    if (configuredExperimentalFeatures) {\n      addConfiguredExperimentalFeature(\n        configuredExperimentalFeatures,\n        'clientSegmentCache',\n        true,\n        'enabled by `__NEXT_EXPERIMENTAL_PPR`'\n      )\n    }\n  }\n\n  // TODO: Remove this once we've made Client Param Parsing the default.\n  if (\n    process.env.__NEXT_EXPERIMENTAL_PPR === 'true' &&\n    // We do respect an explicit value in the user config.\n    (config.experimental.clientParamParsing === undefined ||\n      (isDefaultConfig && !config.experimental.clientParamParsing))\n  ) {\n    config.experimental.clientParamParsing = true\n\n    if (configuredExperimentalFeatures) {\n      addConfiguredExperimentalFeature(\n        configuredExperimentalFeatures,\n        'clientParamParsing',\n        true,\n        'enabled by `__NEXT_EXPERIMENTAL_PPR`'\n      )\n    }\n  }\n\n  // TODO: Remove this once we've made Cache Components the default.\n  if (\n    process.env.__NEXT_EXPERIMENTAL_CACHE_COMPONENTS === 'true' &&\n    // We do respect an explicit value in the user config.\n    (config.experimental.cacheComponents === undefined ||\n      (isDefaultConfig && !config.experimental.cacheComponents))\n  ) {\n    config.experimental.cacheComponents = true\n\n    if (configuredExperimentalFeatures) {\n      addConfiguredExperimentalFeature(\n        configuredExperimentalFeatures,\n        'cacheComponents',\n        true,\n        'enabled by `__NEXT_EXPERIMENTAL_CACHE_COMPONENTS`'\n      )\n    }\n  }\n\n  if (\n    config.experimental.enablePrerenderSourceMaps === undefined &&\n    config.experimental.cacheComponents === true\n  ) {\n    config.experimental.enablePrerenderSourceMaps = true\n\n    if (configuredExperimentalFeatures) {\n      addConfiguredExperimentalFeature(\n        configuredExperimentalFeatures,\n        'enablePrerenderSourceMaps',\n        true,\n        'enabled by `experimental.cacheComponents`'\n      )\n    }\n  }\n}\n\nfunction addConfiguredExperimentalFeature<\n  KeyType extends keyof ExperimentalConfig,\n>(\n  configuredExperimentalFeatures: ConfiguredExperimentalFeature[],\n  key: KeyType,\n  value: ExperimentalConfig[KeyType],\n  reason?: string\n) {\n  if (value !== (defaultConfig.experimental as Record<string, unknown>)[key]) {\n    configuredExperimentalFeatures.push({ key, value, reason })\n  }\n}\n\nfunction setExperimentalFeatureForDebugPrerender<\n  KeyType extends keyof ExperimentalConfig,\n>(\n  experimentalConfig: ExperimentalConfig,\n  key: KeyType,\n  value: ExperimentalConfig[KeyType],\n  configuredExperimentalFeatures: ConfiguredExperimentalFeature[] | undefined\n) {\n  if (experimentalConfig[key] !== value) {\n    experimentalConfig[key] = value\n\n    if (configuredExperimentalFeatures) {\n      const action =\n        value === true ? 'enabled' : value === false ? 'disabled' : 'set'\n\n      const reason = `${action} by \\`--debug-prerender\\``\n\n      addConfiguredExperimentalFeature(\n        configuredExperimentalFeatures,\n        key,\n        value,\n        reason\n      )\n    }\n  }\n}\n\nfunction cloneObject(obj: any): any {\n  // Primitives & null\n  if (obj === null || typeof obj !== 'object') {\n    return obj\n  }\n\n  // RegExp → clone via constructor\n  if (obj instanceof RegExp) {\n    return new RegExp(obj.source, obj.flags)\n  }\n\n  // Function → just reuse the function reference\n  if (typeof obj === 'function') {\n    return obj\n  }\n\n  // Arrays → map each element\n  if (Array.isArray(obj)) {\n    return obj.map(cloneObject)\n  }\n\n  // Detect non‑plain objects (class instances)\n  const proto = Object.getPrototypeOf(obj)\n  const isPlainObject = proto === Object.prototype || proto === null\n\n  // If it's not a plain object, just return the original\n  if (!isPlainObject) {\n    return obj\n  }\n\n  // Plain object → create a new object with the same prototype\n  // and copy all properties, cloning data properties and keeping\n  // accessor properties (getters/setters) as‑is.\n  const result = Object.create(proto)\n  for (const key of Reflect.ownKeys(obj)) {\n    const descriptor = Object.getOwnPropertyDescriptor(obj, key)\n\n    if (descriptor && (descriptor.get || descriptor.set)) {\n      // Accessor property → copy descriptor as‑is (get/set functions)\n      Object.defineProperty(result, key, descriptor)\n    } else {\n      // Data property → clone the value\n      result[key] = cloneObject(obj[key])\n    }\n  }\n\n  return result\n}\n"],"names":["existsSync","basename","extname","join","relative","isAbsolute","resolve","pathToFileURL","findUp","Log","ciEnvironment","CONFIG_FILES","PHASE_DEVELOPMENT_SERVER","PHASE_EXPORT","PHASE_PRODUCTION_BUILD","PHASE_PRODUCTION_SERVER","defaultConfig","normalizeConfig","loadWebpackHook","imageConfigDefault","loadEnvConfig","updateInitialEnv","flushAndExit","findRootDir","setHttpClientAndAgentOptions","pathHasPrefix","matchRemotePattern","hasNextSupport","transpileConfig","dset","normalizeZodErrors","HTML_LIMITED_BOT_UA_RE_STRING","findDir","CanaryOnlyError","isStableBuild","interopDefault","djb2Hash","normalizeNextConfigZodErrors","error","shouldExit","issues","flatMap","issue","message","path","warnOptionHasBeenDeprecated","config","nestedPropertyKey","reason","silent","hasWarned","current","found","nestedPropertyKeys","split","key","undefined","warnOnce","checkDeprecations","userConfig","configFileName","dir","experimental","dynamicIO","i18n","hasAppDir","Boolean","warnOptionHasBeenMovedOutOfExperimental","oldExperimentalKey","newKey","warn","newKeys","length","shift","warnCustomizedOption","defaultValue","customMessage","segs","seg","assignDefaults","result","exportTrailingSlash","trailingSlash","cacheComponents","Object","keys","reduce","currentConfig","value","Error","userDistDir","trim","Array","isArray","forEach","ext","constructor","c","k","v","trustHostHeader","allowDevelopmentBuild","process","env","NODE_ENV","ppr","feature","turbopackPersistentCaching","output","rewrites","redirects","headers","assetPrefix","basePath","startsWith","endsWith","amp","canonicalBase","images","localPatterns","hasMatch","some","pattern","pathname","search","push","remotePatterns","map","protocol","hostname","port","proto","replace","includes","url","URL","hasMatchForAssetPrefix","domains","loader","loaderFile","absolutePath","devIndicators","buildActivityPosition","position","outputStandalone","serverActions","bodySizeLimit","parseInt","toString","isNaN","middlewareClientMaxBodySize","normalizedValue","bytes","require","parse","outputFileTracingRoot","turbopack","root","NEXT_DEPLOYMENT_ID","deploymentId","tracingRoot","turbopackRoot","rootDir","i18nType","locales","defaultLocaleType","defaultLocale","invalidDomainItems","filter","item","domain","console","defaultLocaleDuplicate","find","altItem","hasInvalidLocale","locale","domainItem","JSON","stringify","invalidLocales","String","normalizedLocales","Set","duplicateLocales","localeLower","toLowerCase","has","add","size","localeDetectionType","localeDetection","allowedValues","cacheLife","defaultDefault","revalidate","expire","staleTimes","static","defaultCacheLifeProfile","stale","staticStaleTime","expireTime","cacheHandlers","allowedHandlerNameRegex","handlerKeys","invalidHandlerItems","test","handlerPath","userProvidedModularizeImports","modularizeImports","transform","lodash","userProvidedOptimizePackageImports","optimizePackageImports","htmlLimitedBots","useCache","applyModifyConfig","phase","adapterPath","adapterMod","href","modifyConfig","info","name","configCache","Map","getCacheKey","customConfig","reactProductionProfiling","debugPrerender","keyData","hasCustomConfig","loadConfig","rawConfig","reportExperimentalFeatures","cacheKey","cachedResult","get","configuredExperimentalFeatures","__NEXT_PRIVATE_RENDER_WORKER","err","__NEXT_PRIVATE_STANDALONE_CONFIG","standaloneConfig","set","curLog","configOrigin","cwd","userConfigModule","envBefore","assign","__NEXT_TEST_MODE","nextConfigPath","newEnv","loadedConfig","freeze","TURBOPACK","addConfiguredExperimentalFeature","cloneObject","isRootProcess","send","NEXT_MINIMAL","configSchema","state","safeParse","success","messages","errorMessages","target","slice","turbo","loaders","rules","entries","turbopackMemoryLimit","memoryLimit","turbopackMinify","minify","turbopackTreeShaking","treeShaking","turbopackSourceMaps","sourceMaps","useLightningcss","loadBindings","isLightningSupported","css","lightning","RegExp","source","enforceExperimentalFeatures","isDefaultConfig","completeConfig","configFile","finalConfig","configBaseName","unsupportedConfig","sync","clonedDefaultConfig","options","setExperimentalFeatureForDebugPrerender","__NEXT_EXPERIMENTAL_CACHE_COMPONENTS","__NEXT_EXPERIMENTAL_PPR","clientSegmentCache","clientParamParsing","enablePrerenderSourceMaps","experimentalConfig","action","obj","flags","getPrototypeOf","isPlainObject","prototype","create","Reflect","ownKeys","descriptor","getOwnPropertyDescriptor","defineProperty"],"mappings":"AAAA,SAASA,UAAU,QAAQ,KAAI;AAC/B,SAASC,QAAQ,EAAEC,OAAO,EAAEC,IAAI,EAAEC,QAAQ,EAAEC,UAAU,EAAEC,OAAO,QAAQ,OAAM;AAC7E,SAASC,aAAa,QAAQ,MAAK;AACnC,OAAOC,YAAY,6BAA4B;AAC/C,YAAYC,SAAS,sBAAqB;AAC1C,YAAYC,mBAAmB,oBAAmB;AAClD,SACEC,YAAY,EACZC,wBAAwB,EACxBC,YAAY,EACZC,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