/nextjs.org/docs/messages/no-assign-module-variable'

export default defineRule({
  meta: {
    docs: {
      description: 'Prevent assignment to the `module` variable.',
      recommended: true,
      url,
    },
    type: 'problem',
    schema: [],
  },

  create(context) {
    return {
      VariableDeclaration(node) {
        // Checks node.declarations array for variable with id.name of `module`
        const moduleVariableFound = node.declarations.some((declaration) => {
          if ('name' in declar

== 'module'
          }
          return false
        })

        // Return early if no `module` variable is found
        if (!moduleVariableFound) {
          return
        }

        context.report({
          node,
          message: `Do not assign t

ation.id) {
            return declaration.id.name =


ync-client-component'
const description = 'Prevent Client Components from being async functions.'
const message = `${description} See: ${url}`

function isCapitalized(str: string): boolean {
  return /[A-Z]/.test(str?.[0])
}

export default defineRule({
  meta: {
    docs: {
      description,
      recommended: true,
      url,
    },
    type: 'problem',
    schema: [],
  },

  create(context) {
    return {
      Program(node) {
        let isClientComponent: boolean = false

        for (const block of

true
          }

          if (block.type === 'ExportDefaultDeclaration' && isClientComponent) {
            // export default async function MyComponent() {...}
            if (
              block.declaration?.type === 'FunctionDeclaration' &&

node.body) {
          if (
            block.type === 'ExpressionStatement' &&
            block.expression.type === 'Literal' &&
            block.expression.value === 'use client'
          ) {
            isClientComponent =


m '../utils/define-rule'
import * as path from 'path'

const url =
  'https://nextjs.org/docs/messages/no-before-interactive-script-outside-document'

const convertToCorrectSeparator = (str: string) =>
  str.replace(/[\\/]/g, path.sep)

export default defineRule({
  meta: {
    docs: {
      description:
        "Prevent usage of `next/script`'s `beforeInteractive` strategy outside of `pages/_document.js`.",
      recommended: true,
      url,
    },
    type: 'problem',
    schema: [],
  },
  create(contex

ement(node) {
        const pathname = convertToCorrectSeparator(context.filename)

        const isInAppDir = pathname.includes(`${path.sep}app${path.sep}`)

        // This rule shouldn't fire in `app/`
        if (isInAppDir) {
          return

t) {
    let scriptImportName = null

    return {
      'ImportDeclaration[source.value="next/script"] > ImportDefaultSpecifier'(
        node: any
      ) {
        scriptImportName = node.local.name
      },
      JSXOpeningEl


 { defineRule } from '../utils/define-rule'
const url = 'https://nextjs.org/docs/messages/no-css-tags'

export default defineRule({
  meta: {
    docs: {
      description: 'Prevent manual stylesheet tags.',
      recommended: true,
      url,
    },
    type: 'problem',
    schema: [],
  },
  create(context) {
    return {
      JSXOpeningElement(node) {
        if (node.name.name !== 'link') {
          return
        }
        if (node.attributes.length === 0) {
          return
        }

        const

eet'
          ) &&
          attributes.find(
            (attr) =>
              attr.name.name === 'href' &&
              attr.value.type === 'Literal' &&
              !/^https?/.test(attr.value.value)
          )
        ) {
          context.report(

attributes = node.attributes.filter(
          (attr) => attr.type === 'JSXAttribute'
        )
        if (
          attributes.find(
            (attr) =>
              attr.name.name === 'rel' && attr.value.value === 'stylesh


import { defineRule } from '../utils/define-rule'
import * as path from 'path'

const url = 'https://nextjs.org/docs/messages/no-document-import-in-page'

export default defineRule({
  meta: {
    docs: {
      description:
        'Prevent importing `next/document` outside of `pages/_document.js`.',
      recommended: true,
      url,
    },
    type: 'problem',
    schema: [],
  },
  create(context) {
    return {
      ImportDeclaration(node) {
        if (node.source.value !== 'next/document') {

th(`${path.posix.sep}_document`)
        ) {
          return
        }

        context.report({
          node,
          message: `\`<Document />\` from \`next/document\` should not be imported outside of \`pages/_document.js\`. See: ${url}`,
        })

   return
        }

        const paths = context.filename.split('pages')
        const page = paths[paths.length - 1]

        if (
          !page ||
          page.startsWith(`${path.sep}_document`) ||
          page.startsWi


onst url = 'https://nextjs.org/docs/messages/no-duplicate-head'

export default defineRule({
  meta: {
    docs: {
      description:
        'Prevent duplicate usage of `<Head>` in `pages/_document.js`.',
      recommended: true,
      url,
    },
    type: 'problem',
    schema: [],
  },
  create(context) {
    const { sourceCode } = context
    let documentImportName
    return {
      ImportDeclaration(node) {
        if (node.source.value === 'next/document') {
          const documentImport = node.spe

},
      ReturnStatement(node) {
        const ancestors = sourceCode.getAncestors(node)
        const documentClass = ancestors.find(
          (ancestorNode) =>
            ancestorNode.type === 'ClassDeclaration' &&
            ancestorNode.superClass &

cifiers.find(
            ({ type }) => type === 'ImportDefaultSpecifier'
          )
          if (documentImport && documentImport.local) {
            documentImportName = documentImport.local.name
          }
        }


 parameter in `Array.prototype.sort` function to ensure correct sorting.
 */

export function sortFontsVariantValues(valA: string, valB: string) {
  // If both values contain commas, it indicates they are in "ital,wght" format
  if (valA.includes(',') && valB.includes(',')) {
    // Split the values into prefix and suffix
    const [aPrefix, aSuffix] = valA.split(',', 2)
    const [bPrefix, bSuffix] = valB.split(',', 2)

    // Compare the prefixes (ital values)
    if (aPrefix === bPrefix) {
      // If pr

lues)
      return parseInt(aSuffix) - parseInt(bSuffix)
    } else {
      // If prefixes are different, then compare the prefixes directly
      return parseInt(aPrefix) - parseInt(bPrefix)
    }
  }

  // If values are not in "ital,wght" format, then di

efixes are equal, then compare the suffixes (wght va


vailable-values'
import { nextFontError } from '../next-font-error'
import { googleFontsMetadata } from './google-fonts-metadata'

type FontOptions = {
  fontFamily: string
  weights: string[]
  styles: string[]
  display: string
  preload: boolean
  selectedVariableAxes?: string[]
  fallback?: string[]
  adjustFontFallback: boolean
  variable?: string
  subsets: string[]
}
/**
 * Validate the data received from next-swc next-transform-font on next/font/google calls
 */
export function validateGoogleFontFun

sets,
  } = fontFunctionArgument || ({} as any)
  if (functionName === '') {
    nextFontError(`next/font/google has no default export`)
  }

  const fontFamily = functionName.replace(/_/g, ' ')
  // Get the Google font metadata, we'll use this to validate

ctionCall(
  functionName: string,
  fontFunctionArgument: any
): FontOptions {
  let {
    weight,
    style,
    preload = true,
    display = 'swap',
    axes,
    fallback,
    adjustFontFallback = true,
    variable,
    sub


BUILD } = require('next/constants')
const { findPagesDir } = require('next/dist/lib/find-pages-dir')
const loadConfig = require('next/dist/server/config').default
const getWebpackConfig = require('next/dist/build/webpack-config').default

const CWD = process.cwd()

async function webpackFinal(config) {
  const nextConfig = await loadConfig(PHASE_PRODUCTION_BUILD, CWD)
  const { pagesDir } = findPagesDir(CWD, !!nextConfig.experimental.appDir)
  const nextWebpackConfig = await getWebpackConfig(CWD, {
    page

 ...nextWebpackConfig.plugins]

  config.resolve = {
    ...config.resolve,
    ...nextWebpackConfig.resolve,
  }

  config.module.rules = [
    ...filterModuleRules(config),
    ...nextWebpackConfig.module.rules.map((rule) => {
      // we need to resolve

sDir,
    entrypoints: {},
    isServer: false,
    target: 'server',
    config: nextConfig,
    buildId: 'storybook',
    rewrites: { beforeFiles: [], afterFiles: [], fallback: [] },
  })

  config.plugins = [...config.plugins,


{ API, FileInfo, Options } from 'jscodeshift'
import { createParserFromPath } from '../lib/parser'

export default function transformer(
  file: FileInfo,
  _api: API,
  options: Options
) {
  const j = createParserFromPath(file.path)
  const root = j(file.source)
  let hasChanges = false

  // Before: import { ... } from '@next/font'
  // After: import { ... } from 'next/font'
  root
    .find(j.ImportDeclaration, {
      source: { value: '@next/font' },
    })
    .forEach((fontImport) => {
      hasChang

ource: { value: '@next/font/google' },
    })
    .forEach((fontImport) => {
      hasChanges = true
      fontImport.node.source = j.stringLiteral('next/font/google')
    })

  // Before: import localFont from '@next/font/local'
  // After: import localFo

es = true
      fontImport.node.source = j.stringLiteral('next/font')
    })

  // Before: import { ... } from '@next/font/google'
  // After: import { ... } from 'next/font/google'
  root
    .find(j.ImportDeclaration, {
      s


port { createParserFromPath } from '../lib/parser'

export default function transformer(file: FileInfo, _api: API) {
  const j = createParserFromPath(file.path)
  const root = j(file.source)

  // Find the metadata export
  const metadataExport = root.find(j.ExportNamedDeclaration, {
    declaration: {
      type: 'VariableDeclaration',
      declarations: [
        {
          id: { name: 'metadata' },
        },
      ],
    },
  })

  if (metadataExport.size() !== 1) {
    return file.source
  }

  const

 let viewportProperties
  let hasChanges = false

  const viewport = metadataProperties.find(
    (prop) => prop.key.name === 'viewport'
  )
  if (viewport) {
    viewportProperties = viewport.value.properties
    metadataProperties = metadataProperties.fi

 metadataObject = metadataExport.find(j.ObjectExpression).get(0).node
  if (!metadataObject) {
    console.error('Could not find metadata object')
    return file.source
  }

  let metadataProperties = metadataObject.properties


STPath,
  ExportDefaultDeclaration,
  FileInfo,
  FunctionDeclaration,
  Options,
} from 'jscodeshift'
import { basename, extname } from 'path'
import { createParserFromPath } from '../lib/parser'

const camelCase = (value: string): string => {
  const val = value.replace(/[-_\s.]+(.)?/g, (_match, chr) =>
    chr ? chr.toUpperCase() : ''
  )
  return val.slice(0, 1).toUpperCase() + val.slice(1)
}

const isValidIdentifier = (value: string): boolean =>
  /^[a-zA-ZÀ-ÿ][0-9a-zA-ZÀ-ÿ]+$/.test(value)

export defa

   node.type === 'JSXElement' ||
    (node.type === 'BlockStatement' &&
      j(node)
        .find(j.ReturnStatement)
        .some((path) => path.value.argument?.type === 'JSXElement'))

  const hasRootAsParent = (path): boolean => {
    const program =

ult function transformer(
  file: FileInfo,
  _api: API,
  options: Options
) {
  const j = createParserFromPath(file.path)
  const root = j(file.source)

  let hasModifications: boolean

  const returnsJSX = (node): boolean =>


vel turbopack
 * property, with special handling for certain properties like memoryLimit, minify,
 * treeShaking, and sourceMaps which become experimental.turbopack* properties instead.
 */

import type {
  API as JSCodeShiftAPI,
  Options as JSCodeShiftOptions,
  FileInfo,
  ObjectExpression,
  Property,
  ObjectProperty,
  SpreadElement,
  SpreadProperty,
  ObjectMethod,
} from 'jscodeshift'
import { createParserFromPath } from '../lib/parser'
import { isNextConfigFile } from './lib/utils'

// Properties

aps',
}

export default function transformer(
  file: FileInfo,
  _api: JSCodeShiftAPI,
  options: JSCodeShiftOptions
): string {
  const j = createParserFromPath(file.path)
  const root = j(file.source)
  let hasChanges = false

  if (
    !isNextConfigFi

that need to be moved to experimental.turbopack*
const RENAMED_EXPERIMENTAL_PROPERTIES = {
  memoryLimit: 'turbopackMemoryLimit',
  minify: 'turbopackMinify',
  treeShaking: 'turbopackTreeShaking',
  sourceMaps: 'turbopackSourceM


/parser'

export default function transformer(
  file: FileInfo,
  _api: API,
  options: Options
) {
  const j = createParserFromPath(file.path)
  const root = j(file.source)

  // Before: import Image from "next/image"
  //  After: import Image from "next/legacy/image"
  root
    .find(j.ImportDeclaration, {
      source: { value: 'next/image' },
    })
    .forEach((imageImport) => {
      imageImport.node.source = j.stringLiteral('next/legacy/image')
    })
  // Before: const Image = await import("next/i

ort') {
      if (
        arg.arguments[0].type === 'StringLiteral' &&
        arg.arguments[0].value === 'next/image'
      ) {
        arg.arguments[0] = j.stringLiteral('next/legacy/image')
      }
    }
  })

  // Before: import Image from "next/futur

mage")
  //  After: const Image = await import("next/legacy/image")
  root.find(j.AwaitExpression).forEach((awaitExp) => {
    const arg = awaitExp.value.argument
    if (arg?.type === 'CallExpression' && arg.callee.type === 'Imp


fo } from 'jscodeshift'
import { createParserFromPath } from '../lib/parser'

const importToChange = 'ImageResponse'

export default function transformer(file: FileInfo, _api: API) {
  const j = createParserFromPath(file.path)

  // Find import declarations that match the pattern
  file.source = j(file.source)
    .find(j.ImportDeclaration, {
      source: {
        value: 'next/server',
      },
    })
    .forEach((path) => {
      const importSpecifiers = path.node.specifiers
      const importNamesToCha

  )

      // If the import includes the specified import name, create a new import for it from 'next/og'

      if (importNamesToChange.length > 0) {
        // Replace the original import with the remaining specifiers
        // path.node.specifiers = re

nge = importSpecifiers.filter(
        (specifier) => specifier.local.name === importToChange
      )
      const importsNamesRemained = importSpecifiers.filter(
        (specifier) => specifier.local.name !== importToChange


le.path)
  const root = j(file.source)

  if (!root.length) {
    return file.source
  }

  const nextReqType = root
    .find(j.FunctionDeclaration)
    .find(j.Identifier, (id) => {
      if (id.typeAnnotation?.type !== 'TSTypeAnnotation') {
        return false
      }

      const typeAnn = id.typeAnnotation.typeAnnotation
      return (
        typeAnn.type === 'TSTypeReference' &&
        typeAnn.typeName.type === 'Identifier' &&
        typeAnn.typeName.name === 'NextRequest'
      )
    })

  const

cImportNames = new Set(
    vercelFuncImportSpecifiers.map((node) => node.imported.name)
  )

  const hasGeolocation = vercelFuncImportNames.has(GEOLOCATION)
  const hasIpAddress = vercelFuncImportNames.has(IP_ADDRESS)
  const hasGeoType = vercelFuncImport

vercelFuncImports = root.find(j.ImportDeclaration, {
    source: {
      value: '@vercel/functions',
    },
  })

  const vercelFuncImportSpecifiers = vercelFuncImports
    .find(j.ImportSpecifier)
    .nodes()

  const vercelFun


at we can just attach `withRouter` instead of creating a new `import` node
  const originalRouterImport = root.find(j.ImportDeclaration, {
    source: {
      value: 'next/router',
    },
  })
  if (originalRouterImport.length > 0) {
    // Check if `withRouter` is already imported. In that case we don't have to do anything
    if (
      originalRouterImport.find(j.ImportSpecifier, {
        imported: { name: 'withRouter' },
      }).length > 0
    ) {
      return
    }

    // Attach `withRouter` to the

nst withRouterImport = j.importDeclaration(
    [withRouterSpecifier],
    j.stringLiteral('next/router')
  )

  // Find the Program, this is the top level AST node
  const Program = root.find(j.Program)
  // Attach the import at the top of the body
  Prog

existing `next/router` import node
    originalRouterImport.forEach((node) => {
      node.value.specifiers.push(withRouterSpecifier)
    })
    return
  }

  // Create import node
  // import {withRouter} from 'next/router'
  co


uire('fs')
const path = require('path')
const { defineTest, defineInlineTest, runInlineTest } = require('jscodeshift/dist/testUtils')
const { readdirSync } = require('fs')
const { join } = require('path')

const possibleExtensions = ['ts', 'tsx', 'js', 'jsx']

function getSourceByInputPath(inputPath) {
  let source
  let filePath
  for (const ext of possibleExtensions) {
    const currentPath = `${inputPath}.${ext}`
    if (fs.existsSync(currentPath)) {
      filePath = currentPath
      source = fs.readFil

uest-api'
const fixtureDirPath = join(__dirname, '..', '__testfixtures__', fixtureDir)
const fixtures = readdirSync(fixtureDirPath)
  .filter(file => testFileRegex.test(file))

describe('next-async-request-api - dynamic-props', () => {
  for (const file of

eSync(`${inputPath}.${ext}`, 'utf8')
      break
    }
  }
  return [filePath, source]
}

const testFileRegex = /\.input\.(j|t)sx?$/

const fixtureDir = 'next-async-request-api-dynamic-props'
const transformName = 'next-async-req


toMockOff()
const Runner = require('jscodeshift/dist/Runner');
const { cp, mkdir, mkdtemp, rm, readdir, readFile, stat } = require('fs/promises')
const { readdirSync } = require('fs')
const { tmpdir } = require('os')
const { join } = require('path')

const fixtureDir = join(__dirname, '..', '__testfixtures__', 'next-image-experimental-loader')
const transform = join(__dirname, '..', 'next-image-experimental.js')
const opts = { recursive: true, force: true }

async function toObj(dir) {
  const obj = {}
  co

= await readFile(filePath, 'utf8')
    }
  }
  return obj
}

// TODO: this is not working before it's built, re-enable on CI after migrating tests to defineTest
const loaders = readdirSync(fixtureDir)
for (const loader of loaders) {
  it.skip(`should trans

nst files = await readdir(dir)
  for (const file of files) {
    const filePath = join(dir, file)
    const s = await stat(filePath)
    if (s.isDirectory()) {
      obj[file] = await toObj(filePath)
    } else {
      obj[file]


arentUseCallExpression,
  isReactHookName,
} from './utils'
import { createParserFromPath } from '../../../lib/parser'

const DYNAMIC_IMPORT_WARN_COMMENT = ` @next-codemod-error The APIs under 'next/headers' are async now, need to be manually awaited. `

function findDynamicImportsAndComment(root: Collection<any>, j: API['j']) {
  let modified = false
  // find all the dynamic imports of `next/headers`,
  // and add a comment to the import expression to inform this needs to be manually handled

  // find al

j.CallExpression, {
    callee: {
      type: 'Import',
    },
    arguments: [{ value: 'next/headers' }],
  })

  importPaths.forEach((path) => {
    const inserted = insertCommentOnce(
      path.node,
      j,
      DYNAMIC_IMPORT_WARN_COMMENT
    )

l the dynamic imports of `next/cookies`,
  // Notice, import() is not handled as ImportExpression in current jscodeshift version,
  // we need to use CallExpression to capture the dynamic imports.
  const importPaths = root.find(


* global jest */
jest.autoMockOff()
const defineTest = require('jscodeshift/dist/testUtils').defineTest

const fixtures = [
  'with-router-import',
  'without-import',
  'already-using-withrouter',
  'using-inline-class',
  'export-default-variable',
  'export-default-variable-wrapping',
  'no-transform',
  'no-transform-method',
  'wrapping-export',
  'variable-export',
  'arrow-function-component',
  'destructuring-this',
  'destructuring-this-class',
  'destructuring-this-props',
  'destructuring-this-pr

onentdidupdate',
  'componentwillreceiveprops',
  'first-parameter-hoc',
  'url-property-not-part-of-this-props',
]

for (const fixture of fixtures) {
  defineTest(
    __dirname,
    'url-to-withrouter',
    null,
    `url-to-withrouter/${fixture}`
  )
}

ops-nested',
  'with-nested-arrow-function',
  'comp


Values } from './sort-fonts-variant-values'

describe('sortFontsVariantValues', () => {
  it('should correctly compare and return result for plain integer values', () => {
    // Testing plain integer values
    expect(sortFontsVariantValues('100', '200')).toBe(-100)
    expect(sortFontsVariantValues('200', '100')).toBe(100)
    expect(sortFontsVariantValues('50', '150')).toBe(-100)
    expect(sortFontsVariantValues('150', '50')).toBe(100)
  })

  it('should correctly compare and return result for comma-sep

0')).toBe(-100)
    expect(sortFontsVariantValues('1,200', '1,100')).toBe(100)
    expect(sortFontsVariantValues('0,100', '0,200')).toBe(-100)
    expect(sortFontsVariantValues('0,200', '0,100')).toBe(100)
  })

  it('should sort an array of plain integer

arated values', () => {
    // Testing "ital,wght" format
    expect(sortFontsVariantValues('1,100', '0,200')).toBe(1)
    expect(sortFontsVariantValues('0,200', '1,100')).toBe(-1)
    expect(sortFontsVariantValues('1,100', '1,20


Codeshift,
  Options,
} from 'jscodeshift'
import { createParserFromPath } from '../lib/parser'

function addReactImport(j: JSCodeshift, root: Collection) {
  // We create an import specifier, this is the value of an import, eg:
  // import React from 'react'
  // The specifier would be `React`
  const ReactDefaultSpecifier = j.importDefaultSpecifier(j.identifier('React'))

  // Check if this file is already importing `react`
  // so that we can attach `React` to the existing import instead of creating a ne

on't have to do anything
    if (originalReactImport.find(j.ImportDefaultSpecifier).length > 0) {
      return
    }

    // Attach `React` to the existing `react` import node
    originalReactImport.forEach((node) => {
      node.value.specifiers.unshift(

w `import` node
  const originalReactImport = root.find(j.ImportDeclaration, {
    source: {
      value: 'react',
    },
  })
  if (originalReactImport.length > 0) {
    // Check if `React` is already imported. In that case we d


.join('../lib/cra-to-next')

const globalCssTransformPath = require.resolve(
  path.join(craTransformsPath, 'global-css-transform.js')
)
const indexTransformPath = require.resolve(
  path.join(craTransformsPath, 'index-to-component.js')
)

class CraTransform {
  private appDir: string
  private pagesDir: string
  private isVite: boolean
  private isCra: boolean
  private isDryRun: boolean
  private indexPage: string
  private installClient: string
  private shouldLogInfo: boolean
  private packageJsonPath:

isDryRun = flags.dry
    this.jscodeShiftFlags = flags
    this.appDir = this.validateAppDir(files)
    this.packageJsonPath = path.join(this.appDir, 'package.json')
    this.packageJsonData = this.loadPackageJson()
    this.shouldLogInfo = flags.print ||

string
  private shouldUseTypeScript: boolean
  private packageJsonData: { [key: string]: any }
  private jscodeShiftFlags: { [key: string]: boolean }

  constructor(files: string[], flags: { [key: string]: boolean }) {
    this.


ProxyConfig',
}

export default function transformer(file: FileInfo) {
  const j = createParserFromPath(file.path)
  const root = j(file.source)

  if (!root.length) {
    return file.source
  }

  const isNextConfig =
    isNextConfigFile(file) ||
    (process.env.NODE_ENV === 'test' && /next-config-/.test(file.path))
  const isMiddlewareFile =
    /(^|[/\\])middleware\.|[/\\]src[/\\]middleware\./.test(file.path) ||
    (process.env.NODE_ENV === 'test' && !isNextConfig)
  const hasMiddlewareTypeImports = c

 {
      return file.source
    }
  }

  let hasChanges = false

  if (hasMiddlewareTypeImports) {
    const typeImportChanges = transformMiddlewareTypeImports(root, j)
    hasChanges = hasChanges || typeImportChanges
  }

  if (isMiddlewareFile) {
    con

heckForNextServerTypeImports(root, j)

  // In test mode, process all files. Otherwise, only process relevant files
  if (process.env.NODE_ENV !== 'test') {
    if (!isMiddlewareFile && !isNextConfig && !hasMiddlewareTypeImports)


sLegacy: boolean | null
} {
  const flatConfigs = [
    'eslint.config.js',
    'eslint.config.mjs',
    'eslint.config.cjs',
    'eslint.config.ts',
    'eslint.config.mts',
    'eslint.config.cts',
  ]

  const legacyConfigs = [
    '.eslintrc.js',
    '.eslintrc.cjs',
    '.eslintrc.yaml',
    '.eslintrc.yml',
    '.eslintrc.json',
    '.eslintrc',
  ]

  // Check for flat configs first (preferred for v9+)
  for (const config of flatConfigs) {
    const configPath = path.join(projectRoot, config)
    if

  if (existsSync(configPath)) {
      return { exists: true, path: configPath, isLegacy: true }
    }
  }

  return { exists: false, path: null, isLegacy: null }
}

function replaceFlatCompatInConfig(configPath: string): boolean {
  let configContent: stri

(existsSync(configPath)) {
      return { exists: true, path: configPath, isLegacy: false }
    }
  }

  // Check for legacy configs
  for (const config of legacyConfigs) {
    const configPath = path.join(projectRoot, config)


hould be renamed
function shouldRenameProperty(propertyName: string): boolean {
  return propertyName in UNSTABLE_TO_STABLE_MAPPING
}

export default function transformer(
  file: FileInfo,
  _api: API,
  options: Options
) {
  const j = createParserFromPath(file.path)
  const root = j(file.source)
  let hasChanges = false

  try {
    // Track identifier renames that need to be applied
    const identifierRenames: Array<{ oldName: string; newName: string }> = []
    // Track variables assigned from next/ca

rEach((path) => {
        path.node.specifiers?.forEach((specifier) => {
          if (
            specifier.type === 'ImportSpecifier' &&
            specifier.imported?.type === 'Identifier' &&
            shouldRenameProperty(specifier.imported.name)

che imports/requires
    const cacheVariables = new Set<string>()

    // Handle ES6 imports: import { unstable_cacheTag } from 'next/cache'
    root
      .find(j.ImportDeclaration, { source: { value: 'next/cache' } })
      .fo


uire('fs')
const path = require('path')
const { defineTest, defineInlineTest, runInlineTest } = require('jscodeshift/dist/testUtils')
const { readdirSync } = require('fs')
const { join } = require('path')

const possibleExtensions = ['ts', 'tsx', 'js', 'jsx']

function getSourceByInputPath(inputPath) {
  let source = ''
  let filePath
  for (const ext of possibleExtensions) {
    const currentPath = `${inputPath}.${ext}`
    if (fs.existsSync(currentPath)) {
      filePath = currentPath
      source = fs.re

-request-api'
const fixtureDirPath = join(__dirname, '..', '__testfixtures__', fixtureDir)
const fixtures = readdirSync(fixtureDirPath)
  .filter(file => testFileRegex.test(file))

describe('next-async-request-api - dynamic-apis', () => {
  for (const file

adFileSync(`${inputPath}.${ext}`, 'utf8')
      break
    }
  }
  return [filePath, source]
}

const testFileRegex = /\.input\.(j|t)sx?$/

const fixtureDir = 'next-async-request-api-dynamic-apis'
const transformName = 'next-async


er = require('../next-lint-to-eslint-cli.js').default
  })

  afterAll(() => {
    // Clean up ONCE after all tests
    if (isolatedDir && fs.existsSync(isolatedDir)) {
      fs.rmSync(isolatedDir, { recursive: true, force: true })
    }
  })

  describe('flat-config', () => {
    it('should keep config unchanged and transform package.json', () => {
      const testDir = path.join(fixturesDir, 'flat-config')
      // Check BEFORE state
      const beforeConfig = fs.readFileSync(
        path.join(testDir, '

neConfig } from 'eslint/config'
       import foo from 'foo'
       import bar from 'bar'

       const eslintConfig = defineConfig([
         foo,
         bar,
         {
           ignores: [
             'node_modules/**',
             '.next/**',

eslint.config.mjs'),
        'utf8'
      )
      const beforePackage = fs.readFileSync(
        path.join(testDir, 'package.json'),
        'utf8'
      )

      expect(beforeConfig).toMatchInlineSnapshot(`
       "import { defi


 Set(['params', 'searchParams'])

export function isFunctionType(
  type: string
): type is
  | 'FunctionDeclaration'
  | 'FunctionExpression'
  | 'ArrowFunctionExpression' {
  return (
    type === 'FunctionDeclaration' ||
    type === 'FunctionExpression' ||
    type === 'ArrowFunctionExpression'
  )
}

export function isMatchedFunctionExported(
  path: ASTPath<FunctionDeclaration>,
  j: API['jscodeshift']
): boolean {
  const matchedFunctionNameFilter = (idName) => TARGET_NAMED_EXPORTS.has(idName)

  con

0) {
    return true
  }

  // Check for default export (`export default function() {}`)
  const isDefaultExport = j(path).closest(j.ExportDefaultDeclaration).size() > 0
  if (isDefaultExport) {
    return true
  }

  // Look for named export elsewhere in

st directNamedExport = j(path).closest(j.ExportNamedDeclaration, {
    declaration: {
      type: 'FunctionDeclaration',
      id: {
        name: matchedFunctionNameFilter,
      },
    },
  })

  if (directNamedExport.size() >


ateFontFunctionCall errors', () => {
  test('Missing function name', () => {
    expect(() =>
      validateGoogleFontFunctionCall(
        '', // default import
        undefined
      )
    ).toThrowErrorMatchingInlineSnapshot(
      `"next/font/google has no default export"`
    )
  })

  test('Unknown font', () => {
    expect(() =>
      validateGoogleFontFunctionCall('Unknown_Font', undefined)
    ).toThrowErrorMatchingInlineSnapshot(`"Unknown font \`Unknown Font\`"`)
  })

  test('Unknown weight', ()

     Available weights: \`100\`, \`200\`, \`300\`, \`400\`, \`500\`, \`600\`, \`700\`, \`800\`, \`900\`, \`variable\`"
      `)
  })

  test('Missing weight for non variable font', () => {
    expect(() => validateGoogleFontFunctionCall('Abel', { subsets:

 => {
    expect(() =>
      validateGoogleFontFunctionCall('Inter', {
        weight: '123',
        subsets: ['latin'],
      })
    ).toThrowErrorMatchingInlineSnapshot(`
        "Unknown weight \`123\` for font \`Inter\`.


utToStyle: Record<string, Record<string, string> | null> = {
    intrinsic: { maxWidth: '100%', height: 'auto' },
    responsive: { width: '100%', height: 'auto' },
    fill: null,
    fixed: null,
  }
  const layoutToSizes: Record<string, string | null> = {
    intrinsic: null,
    responsive: '100vw',
    fill: '100vw',
    fixed: null,
  }
  root
    .find(j.JSXElement)
    .filter(
      (el) =>
        el.value.openingElement.name &&
        el.value.openingElement.name.type === 'JSXIdentifier' &&

te | null = null
      const attributes = el.node.openingElement.attributes?.filter((a) => {
        if (a.type !== 'JSXAttribute') {
          return true
        }

        if (a.name.name === 'layout' && 'value' in a.value) {
          layout = String(a

    el.value.openingElement.name.name === tagName
    )
    .forEach((el) => {
      let layout = 'intrinsic'
      let objectFit = null
      let objectPosition = null
      let styleExpProps = []
      let sizesAttr: JSXAttribu


port { createParserFromPath } from '../lib/parser'

export default function transformer(file: FileInfo, _api: API) {
  // Run on App Router page/layout/route files, except for test environment.
  if (
    process.env.NODE_ENV !== 'test' &&
    !/[/\\]app[/\\](?:.*[/\\])?(page|layout|route)(\.[^/\\]*)?$/.test(file.path)
  ) {
    return file.source
  }

  const j = createParserFromPath(file.path)
  const root = j(file.source)

  let hasChanges = false

  // Remove export const experimental_ppr = boolean
  co

rectExports.size() > 0) {
    directExports.remove()
    hasChanges = true
  }

  // Remove const experimental_ppr = boolean declarations
  const variableDeclarations = root.find(j.VariableDeclaration).filter((path) =>
    path.node.declarations.some((decl

nst directExports = root.find(j.ExportNamedDeclaration, {
    declaration: {
      type: 'VariableDeclaration',
      declarations: [
        {
          id: { name: 'experimental_ppr' },
        },
      ],
    },
  })

  if (di


ty) {
      return
    }

    if (isParentPromiseAllCallExpression(memberAccessPath, j)) {
      return
    }

    // check if it's already awaited
    if (memberAccessPath.parentPath?.value.type === 'AwaitExpression') {
      return
    }

    const parentScopeOfMemberAccess = findClosetParentFunctionScope(
      memberAccessPath,
      j
    )

    // When the parent scope is sync, and it's also not the function itself, which means it's not able to convert to async.
    if (
      parentScopeOfMemberAcces

pe is sync, await keyword can't be applied
      const comment = ` ${NEXT_CODEMOD_ERROR_PREFIX} '${propIdName}.${memberProperty.name}' is accessed without awaiting.`
      insertCommentOnce(member, j, comment)
      return
    }

    const awaitedExpr = j.

s &&
      !parentScopeOfMemberAccess.value?.async &&
      parentScopeOfMemberAccess.node !== path.node
    ) {
      // If it's not able to convert, add a comment to the prop access to warn the user
      // e.g. the parent sco


parser'

export default function transformer(file: FileInfo, _api: API) {
  if (
    process.env.NODE_ENV !== 'test' &&
    !/[/\\]app[/\\].*?(page|layout|route)\.[^/\\]+$/.test(file.path)
  ) {
    return file.source
  }

  const j = createParserFromPath(file.path)
  const root = j(file.source)

  const runtimeExport = root.find(j.ExportNamedDeclaration, {
    declaration: {
      type: 'VariableDeclaration',
      declarations: [
        {
          id: { name: 'runtime' },
        },
      ],
    },
  })

e.source
  }

  const runtimeValue = runtimeExport.find(j.StringLiteral, {
    value: 'experimental-edge',
  })

  if (runtimeValue.size() !== 1) {
    return file.source
  }

  runtimeValue.replaceWith(j.stringLiteral('edge'))

  return root.toSource()
}

  if (runtimeExport.size() !== 1) {
    return fil


bal jest */
jest.autoMockOff()
const defineTest = require('jscodeshift/dist/testUtils').defineTest

const fixtureDir = 'next-experimental-turbo-to-turbopack'

defineTest(__dirname, fixtureDir, null, `${fixtureDir}/commonjs-var`, { parser: 'js' })
defineTest(__dirname, fixtureDir, null, `${fixtureDir}/esm`, { parser: 'js' })
defineTest(__dirname, fixtureDir, null, `${fixtureDir}/mixed-config`, { parser: 'js' })
defineTest(__dirname, fixtureDir, null, `${fixtureDir}/modified-var`, { parser: 'js' })
defineTest

y-assignment`, { parser: 'js' })
defineTest(__dirname, fixtureDir, null, `${fixtureDir}/typescript-as-const`, { parser: 'ts' })
defineTest(__dirname, fixtureDir, null, `${fixtureDir}/typescript`, { parser: 'ts' })
defineTest(__dirname, fixtureDir, null, `$

(__dirname, fixtureDir, null, `${fixtureDir}/wrapped-function`, { parser: 'js' })
defineTest(__dirname, fixtureDir, null, `${fixtureDir}/no-change`, { parser: 'js' })
defineTest(__dirname, fixtureDir, null, `${fixtureDir}/propert


ssues/534

import type { API, Collection, FileInfo, JSXElement } from 'jscodeshift'
import { createParserFromPath } from '../lib/parser'
import { NEXT_CODEMOD_ERROR_PREFIX } from './lib/async-request-api/utils'

export default function transformer(file: FileInfo, _api: API) {
  const j = createParserFromPath(file.path)

  const $j = j(file.source)
  let hasChanges = false

  $j.find(j.ImportDeclaration, { source: { value: 'next/link' } }).forEach(
    (path) => {
      const defaultImport = j(path).find(j.I

ariableName) {
        return
      }

      const linkElements = $j.findJSXElements(variableName)

      linkElements.forEach((linkPath) => {
        const $link: Collection<JSXElement> = j(linkPath)

        if ($link.size() === 0) {
          return

mportDefaultSpecifier)
      if (defaultImport.size() === 0) {
        return
      }

      const variableName = j(path)
        .find(j.ImportDefaultSpecifier)
        .find(j.Identifier)
        .get('name').value
      if (!v


://github.com/vercel/next.js/blob/master/packages/next-polyfill-nomodule/src/index.js
const NEXT_POLYFILLED_FEATURES = [
  'Array.prototype.@@iterator',
  'Array.prototype.at',
  'Array.prototype.copyWithin',
  'Array.prototype.fill',
  'Array.prototype.find',
  'Array.prototype.findIndex',
  'Array.prototype.flatMap',
  'Array.prototype.flat',
  'Array.from',
  'Array.prototype.includes',
  'Array.of',
  'Function.prototype.name',
  'fetch',
  'Map',
  'Number.EPSILON',
  'Number.Epsilon',
  'Number.isFini

ries',
  'Object.getOwnPropertyDescriptor',
  'Object.getOwnPropertyDescriptors',
  'Object.hasOwn',
  'Object.is',
  'Object.keys',
  'Object.values',
  'Reflect',
  'Set',
  'Symbol',
  'Symbol.asyncIterator',
  'String.prototype.codePointAt',
  'String.

te',
  'Number.isNaN',
  'Number.isInteger',
  'Number.isSafeInteger',
  'Number.MAX_SAFE_INTEGER',
  'Number.MIN_SAFE_INTEGER',
  'Number.parseFloat',
  'Number.parseInt',
  'Object.assign',
  'Object.entries',
  'Object.fromEnt


b[39m   \u001b[36mreturn\u001b[39m \u001b[33m<\u001b[39m\u001b[33mdiv\u001b[39m\u001b[33m>\u001b[39m\u001b[33mWelcome to my Next.js application! This is a longer piece of text that will demonstrate text wrapping behavior in the code frame.\u001b[39m\u001b[33m<\u001b[39m\u001b[33m/\u001b[39m\u001b[33mdiv\u001b[39m\u001b[33m>\u001b[39m\u001b[0m
\u001b[0m \u001b[90m 4 \u001b[39m }\u001b[0m
\u001b[0m \u001b[90m 5 \u001b[39m\u001b[0m`
}

const instantCodeFrame = ({
  beforeLine,
  line,
  markerLine,
  pointerCo

lumn,
  afterLine = 'return
Hello
',
}: {
  beforeLine: string
  line: string
  markerLine: number
  pointerColumn: number
  afterLine?: string
}) => {
  const markerPadding = ' '.repeat(Math.max(pointerColumn - 1, 0))


 namespace NodeJS {
  // only for rust, see https://github.com/napi-rs/napi-rs/issues/1630
  interface TTY {
    setBlocking(blocking: boolean): void
  }

  interface WriteStream {
    _handle?: TTY
  }

  interface Process {
    /**
     * @deprecated Use `typeof window` instead
     */
    readonly browser: boolean
  }

  interface ProcessEnv {
    // TODO: Should be optional and possibly undefined
    readonly NODE_ENV: 'development' | 'production' | 'test'
  }
}

declare module '*.module.css' {
  const

sses: { readonly [key: string]: string }
  export default classes
}

// CSS side-effect imports (non-modules)
// These are needed for `noUncheckedSideEffectImports` support
// See: https://www.typescriptlang.org/tsconfig/#noUncheckedSideEffectImports
decla

classes: { readonly [key: string]: string }
  export default classes
}

declare module '*.module.sass' {
  const classes: { readonly [key: string]: string }
  export default classes
}

declare module '*.module.scss' {
  const cla


e 'react-dom/server' {
  /**
   * Options for `renderToReadableStream`.
   *
   * https://github.com/facebook/react/blob/aec521a96d3f1bebc2ba38553d14f4989c6e88e0/packages/react-dom/src/server/ReactDOMFizzServerEdge.js#L36-L52
   */
  export interface RenderToReadableStreamOptions {
    unstable_externalRuntimeSrc?:
      | string
      | import('react-dom/server').BootstrapScriptDescriptor
  }
}

declare module 'react-dom/static' {
  /**
   * Options for `prerender`.
   *
   * https://github.com/facebook/re

1a96d3f1bebc2ba38553d14f4989c6e88e0/packages/react-dom/src/server/ReactDOMFizzStaticEdge.js#L35-L49
   */
  export interface PrerenderOptions {
    unstable_externalRuntimeSrc?:
      | string
      | import('react-dom/server').BootstrapScriptDescriptor


 />
/// <reference types="react-dom/experimental" preserve="true" />

import type { Agent as HttpAgent } from 'http'
import type { Agent as HttpsAgent } from 'https'

import type { ParsedUrlQuery } from 'querystring'
import type { IncomingMessage, ServerResponse } from 'http'

import type {
  NextPageContext,
  NextComponentType,
  NextApiResponse,
  NextApiRequest,
  NextApiHandler,
} from './shared/lib/utils'
import type { GetStaticPathsFallback } from './lib/fallback'

import type { NextApiRequestCookies

NextConfig } from './server/config'

export type { NextAdapter, AdapterOutput } from './build/adapter/build-complete'

export type {
  Metadata,
  MetadataRoute,
  ResolvedMetadata,
  ResolvingMetadata,
  Viewport,
  ResolvingViewport,
  ResolvedViewport,

 } from './server/api-utils'

import next from './server/next'

export type ServerRuntime = 'nodejs' | 'experimental-edge' | 'edge' | undefined

// @ts-ignore This path is generated at build time and conflicts otherwise
export {


e-path'
import { loadEnvConfig } from '@next/env'
import { isAPIRoute } from '../lib/is-api-route'
import { getPagePath } from '../server/require'
import type { Span } from '../trace'
import type { MiddlewareManifest } from '../build/webpack/plugins/middleware-plugin'
import { isAppRouteRoute } from '../lib/is-app-route-route'
import { isAppPageRoute } from '../lib/is-app-page-route'
import isError from '../lib/is-error'
import { formatManifest } from '../build/manifests/formatter/format-manifest'
import {

/lib/is-interception-route-rewrite'
import type { ActionManifest } from '../build/webpack/plugins/flight-client-entry-plugin'
import { extractInfoFromServerReferenceId } from '../shared/lib/server-reference-info'
import { convertSegmentPathToStaticExportFi

TurborepoAccessTraceResult } from '../build/turborepo-access-trace'
import { createProgress } from '../build/progress'
import type { DeepReadonly } from '../shared/lib/deep-readonly'
import { isInterceptionRouteRewrite } from '..


e { RenderOptsPartial as PagesRenderOptsPartial } from '../server/render'
import type {
  GenericComponentMod,
  LoadComponentsReturnType,
} from '../server/load-components'
import type { OutgoingHttpHeaders } from 'http'
import type { ExportPathMap, NextConfigComplete } from '../server/config-shared'
import type { CacheControl } from '../server/lib/cache-control'
import type { NextEnabledDirectories } from '../server/base-server'
import type {
  SerializableTurborepoAccessTraceResult,
  TurborepoAccessTrac

/resume-data-cache'
import type { StaticWorker } from '../build'
import type { Bundler } from '../lib/bundler'

export type ExportPathEntry = ExportPathMap[keyof ExportPathMap] & {
  path: string
}

export interface ExportPagesInput {
  buildId: string
  d

eResult,
} from '../build/turborepo-access-trace'
import type { FetchMetrics } from '../server/base-http'
import type { RouteMetadata } from './routes/types'
import type { RenderResumeDataCache } from '../server/resume-data-cache


normalize-page-path'
import { normalizeLocalePath } from '../shared/lib/i18n/normalize-locale-path'
import { trace } from '../trace'
import { setHttpClientAndAgentOptions } from '../server/setup-http-agent-env'
import { addRequestMeta } from '../server/request-meta'
import { normalizeAppPath } from '../shared/lib/router/utils/app-paths'
import { removeTrailingSlash } from '../shared/lib/router/utils/remove-trailing-slash'

import { createRequestResponseMocks } from '../server/lib/mock-request'
import { isAp

om './routes/pages'
import { getParams } from './helpers/get-params'
import { createIncrementalCache } from './helpers/create-incremental-cache'
import { isPostpone } from '../server/lib/router-utils/is-postpone'
import { isDynamicUsageError } from './help

pRouteRoute } from '../lib/is-app-route-route'
import { hasNextSupport } from '../server/ci-info'
import { exportAppRoute } from './routes/app-route'
import { exportAppPage } from './routes/app-page'
import { exportPagesPage } fr


helpers/is-dynamic-usage-error'
import {
  NEXT_CACHE_TAGS_HEADER,
  NEXT_META_SUFFIX,
  RSC_SUFFIX,
  RSC_SEGMENTS_DIR_SUFFIX,
  RSC_SEGMENT_SUFFIX,
} from '../../lib/constants'
import { hasNextSupport } from '../../server/ci-info'
import { lazyRenderAppPage } from '../../server/route-modules/app-page/module.render'
import { isBailoutToCSRError } from '../../shared/lib/lazy-dynamic/bailout-to-csr'
import { NodeNextRequest, NodeNextResponse } from '../../server/base-http/node'
import { NEXT_IS_PRERENDER_HEA

outeParams } from '../../server/request/fallback-params'
import { AfterRunner } from '../../server/after/run-with-after'
import type { RequestLifecycleOpts } from '../../server/base-server'
import type { AppSharedContext } from '../../server/app-render/app

DER } from '../../client/components/app-router-headers'
import type { FetchMetrics } from '../../server/base-http'
import type { WorkStore } from '../../server/app-render/work-async-storage.external'
import type { OpaqueFallbackR


dules/app-route/module'
import type { IncrementalCache } from '../../server/lib/incremental-cache'

import {
  INFINITE_CACHE,
  NEXT_BODY_SUFFIX,
  NEXT_CACHE_TAGS_HEADER,
  NEXT_META_SUFFIX,
} from '../../lib/constants'
import { NodeNextRequest } from '../../server/base-http/node'
import {
  NextRequestAdapter,
  signalFromNodeResponse,
} from '../../server/web/spec-extension/adapters/next-request'
import { toNodeOutgoingHttpHeaders } from '../../server/web/utils'
import type {
  MockedRequest,
  MockedRe

 type { ExperimentalConfig } from '../../server/config-shared'
import { isMetadataRoute } from '../../lib/metadata/is-metadata-route'
import { normalizeAppPath } from '../../shared/lib/router/utils/app-paths'
import type { Params } from '../../server/reque

sponse,
} from '../../server/lib/mock-request'
import { isDynamicUsageError } from '../helpers/is-dynamic-usage-error'
import { isStaticGenEnabled } from '../../server/route-modules/app-route/helpers/is-static-gen-enabled'
import


text,
  RenderOpts,
} from '../../server/render'
import type { LoadComponentsReturnType } from '../../server/load-components'
import type { NextParsedUrlQuery } from '../../server/request-meta'
import type { Params } from '../../server/request/params'

import RenderResult from '../../server/render-result'
import { join } from 'path'
import type {
  MockedRequest,
  MockedResponse,
} from '../../server/lib/mock-request'
import {
  HTML_CONTENT_TYPE_HEADER,
  NEXT_DATA_SUFFIX,
  SERVER_PROPS_EXPORT_ERROR,
} f

m '../../lib/multi-file-writer'

/**
 * Renders & exports a page associated with the /pages directory
 */
export async function exportPagesPage(
  req: MockedRequest,
  res: MockedResponse,
  path: string,
  page: string,
  query: NextParsedUrlQuery,
  par

rom '../../lib/constants'
import { isBailoutToCSRError } from '../../shared/lib/lazy-dynamic/bailout-to-csr'
import { lazyRenderPagesPage } from '../../server/route-modules/pages/module.render'
import type { MultiFileWriter } fro


 from '../../server/lib/incremental-cache'
import { hasNextSupport } from '../../server/ci-info'
import { nodeFs } from '../../server/lib/node-fs-methods'
import { interopDefault } from '../../lib/interop-default'
import { formatDynamicImportPath } from '../../lib/format-dynamic-import-path'
import {
  initializeCacheHandlers,
  setCacheHandler,
} from '../../server/use-cache/handlers'

export async function createIncrementalCache({
  cacheHandler,
  cacheMaxMemorySize,
  fetchCacheKeyPrefix,
  distDir,
  d

ng, string | string[] | undefined>
  cacheHandlers?: Record<string, string | undefined>
}) {
  // Custom cache handler overrides.
  let CacheHandler: any
  if (cacheHandler) {
    CacheHandler = interopDefault(
      await import(formatDynamicImportPath(di

ir,
  flushToDisk,
  cacheHandlers,
  requestHeaders,
}: {
  cacheHandler?: string
  cacheMaxMemorySize: number
  fetchCacheKeyPrefix?: string
  distDir: string
  dir: string
  flushToDisk?: boolean
  requestHeaders?: Record<stri


 {
  type RouteMatchFn,
  getRouteMatcher,
} from '../../shared/lib/router/utils/route-matcher'
import { getRouteRegex } from '../../shared/lib/router/utils/route-regex'

// The last page and matcher that this function handled.
let last: {
  page: string
  matcher: RouteMatchFn
} | null = null

/**
 * Gets the params for the provided page.
 * @param page the page that contains dynamic path parameters
 * @param pathname the pathname to match
 * @returns the matches that were found, throws otherwise
 */
expor

he RegExp for. If it matches, it'll just re-use it.
  let matcher: RouteMatchFn
  if (last?.page === page) {
    matcher = last.matcher
  } else {
    matcher = getRouteMatcher(getRouteRegex(page))
  }

  const params = matcher(pathname)
  if (!params) {

t function getParams(page: string, pathname: string) {
  // Because this is often called on the output of `getStaticPaths` or similar
  // where the `page` here doesn't change, this will "remember" the last page
  // it created t


28);const n=t(738);const c=t(219);const o=Symbol("findUp.stop");r.exports=async(r,e={})=>{let t=s.resolve(e.cwd||"");const{root:c}=s.parse(t);const i=[].concat(r);const runMatcher=async e=>{if(typeof r!=="function"){return n(i,e)}const t=await r(e.cwd);if(typeof t==="string"){return n([t],e)}return t};while(true){const r=await runMatcher({...e,cwd:t});if(r===o){return}if(r){return s.resolve(t,r)}if(t===c){return}t=s.dirname(t)}};r.exports.sync=(r,e={})=>{let t=s.resolve(e.cwd||"");const{root:c}=s.parse(t);c

urn s.resolve(t,r)}if(t===c){return}t=s.dirname(t)}};r.exports.exists=c;r.exports.sync.exists=c.sync;r.exports.stop=o},738:(r,e,t)=>{const s=t(928);const n=t(896);const{promisify:c}=t(23);const o=t(296);const i=c(n.stat);const a=c(n.lstat);const u={directo

onst i=[].concat(r);const runMatcher=e=>{if(typeof r!=="function"){return n.sync(i,e)}const t=r(e.cwd);if(typeof t==="string"){return n.sync([t],e)}return t};while(true){const r=runMatcher({...e,cwd:t});if(r===o){return}if(r){ret


ef!==e.pref){if(e.pref===undefined){return n}if(t.pref===undefined){return r}return e.pref-t.pref}return e.pos-t.pos}},982:(e,t,r)=>{const n=r(817);const o=r(730);const s={options:{charset:{type:"accept-charset"},encoding:{type:"accept-encoding",default:"i

nst e of f){if(e==="*"){for(const[e,t]of a){if(!c.has(e)){l.push(t.orig)}}}else{const t=e.toLowerCase();if(a.has(t)){l.push(a.get(t).orig)}}}return l};s.sort=function(e,t){const r=-1;const n=1;if(t.q!==e.q){return t.q-e.q}if(t.pr


(_){a+="' + "+R+" + '"}else{a+=""+e.util.escapeQuotes(o)}a+="\"' "}if(e.opts.verbose){a+=" , schema:  ";if(_){a+="validate.schema"+n}else{a+=""+e.util.toQuotedString(o)}a+="         , parentSchema: validate.schema"+e.schemaPath+" , data: "+c+" "}a+=" } "}e

, schemaPath: "+e.util.toQuotedString(l)+" , params: { comparison: "+D+", limit:  ";if(_){a+=""+R}else{a+=""+e.util.toQuotedString(o)}a+=" , exclusive: "+O+" } ";if(e.opts.messages!==false){a+=" , message: 'should be "+j+' "';if


("",""),bgCyanBright:t("",""),bgWhiteBright:t("","")}};e.exports=createColors();e.exports.createColors=createColors},754:(e,t,r)=>{let{Input:s}=r(940);let i=r(986);e.exports=function safeParse(e,t){let r=new s(e,t);let n=new i(r);n.parse();return n.root}},986:(e,t,r)=>{let s=r(892);let i=r(260);let n=r(838);class SafeParser extends n{createTokenizer(){this.tokenizer=s(this.input,{ignoreErrors:true})}comment(e){let t=new i;this.init(t,e[2]);let r=this.input.fromOffset(e[3])||


r s;
if (process.env.NODE_ENV === 'production') {
  s = require('./cjs/react-server-dom-turbopack-server.node.production.js');
} else {
  s = require('./cjs/react-server-dom-turbopack-server.node.development.js');
}

exports.renderToReadableStream = s.renderToReadableStream;
exports.renderToPipeableStream = s.renderToPipeableStream;
exports.decodeReply = s.decodeReply;
exports.decodeReplyFromBusboy = s.decodeReplyFromBusboy;
exports.decodeReplyFromAsyncIterable = s.decodeReplyFromAsyncIterable;
exports.deco

 s.decodeFormState;
exports.registerServerReference = s.registerServerReference;
exports.registerClientReference = s.registerClientReference;
exports.createClientModuleProxy = s.createClientModuleProxy;
exports.createTemporaryReferenceSet = s.createTempora

deAction = s.decodeAction;
exports.decodeFormState =


lue);
          return "Object" === value ? "{...}" : value;
        case "function":
          return value.$$typeof === CLIENT_REFERENCE_TAG
            ? "client"
            : (value = value.displayName || value.name)
              ? "function " + value
              : "function";
        default:
          return String(value);
      }
    }
    function describeElementType(type) {
      if ("string" === typeof type) return type;
      switch (type) {
        case REACT_SUSPENSE_TYPE:
          return

peof) {
          case REACT_FORWARD_REF_TYPE:
            return describeElementType(type.render);
          case REACT_MEMO_TYPE:
            return describeElementType(type.type);
          case REACT_LAZY_TYPE:
            var payload = type._payload;

"Suspense";
        case REACT_SUSPENSE_LIST_TYPE:
          return "SuspenseList";
        case REACT_VIEW_TRANSITION_TYPE:
          return "ViewTransition";
      }
      if ("object" === typeof type)
        switch (type.$$ty


g[id];
  if (resolvedModuleData) name = resolvedModuleData.name;
  else {
    var idx = id.lastIndexOf("#");
    -1 !== idx &&
      ((name = id.slice(idx + 1)),
      (resolvedModuleData = bundlerConfig[id.slice(0, idx)]));
    if (!resolvedModuleData) throw Error(formatProdErrorMessage(589, id));
  }
  return resolvedModuleData.async
    ? [resolvedModuleData.id, resolvedModuleData.chunks, name, 1]
    : [resolvedModuleData.id, resolvedModuleData.chunks, name];
}
function requireAsyncModule(id) {
  var pr

e;
    },
    function (reason) {
      promise.status = "rejected";
      promise.reason = reason;
    }
  );
  return promise;
}
var instrumentedChunks = new WeakSet(),
  loadedChunks = new WeakSet();
function ignoreReject() {}
function preloadModule(met

omise = __turbopack_require__(id);
  if ("function" !== typeof promise.then || "fulfilled" === promise.status)
    return null;
  promise.then(
    function (value) {
      promise.status = "fulfilled";
      promise.value = valu


 !== names[i] && "ref" !== names[i]) ||
              "function" !== typeof descriptor.get))
        )
          return !1;
      }
      return !0;
    }
    function objectName(object) {
      object = Object.prototype.toString.call(object);
      return object.slice(8, object.length - 1);
    }
    function describeKeyForErrorMessage(key) {
      var encodedKey = JSON.stringify(key);
      return '"' + key + '"' === encodedKey ? key : encodedKey;
    }
    function describeValueForErrorMessage(value) {

 "[...]";
          if (null !== value && value.$$typeof === CLIENT_REFERENCE_TAG)
            return "client";
          value = objectName(value);
          return "Object" === value ? "{...}" : value;
        case "function":
          return value.$$ty

     switch (typeof value) {
        case "string":
          return JSON.stringify(
            10 >= value.length ? value : value.slice(0, 10) + "..."
          );
        case "object":
          if (isArrayImpl(value)) return


&& "function" === typeof moduleExports.then)
    if ("fulfilled" === moduleExports.status)
      moduleExports = moduleExports.value;
    else throw moduleExports.reason;
  if ("*" === metadata[2]) return moduleExports;
  if ("" === metadata[2])
    return moduleExports.__esModule ? moduleExports.default : moduleExports;
  if (hasOwnProperty.call(moduleExports, metadata[2]))
    return moduleExports[metadata[2]];
}
function prepareDestinationWithChunks(moduleLoading, chunks, nonce$jscomp$0) {
  if (null !==

JSCompiler_temp_const$jscomp$1 = moduleLoading.prefix + chunks[i];
      var JSCompiler_inline_result = moduleLoading.crossOrigin;
      JSCompiler_inline_result =
        "string" === typeof JSCompiler_inline_result
          ? "use-credentials" === JSCom

 moduleLoading)
    for (var i = 0; i < chunks.length; i++) {
      var nonce = nonce$jscomp$0,
        JSCompiler_temp_const = ReactDOMSharedInternals.d,
        JSCompiler_temp_const$jscomp$0 = JSCompiler_temp_const.X,


getOwnPropertyDescriptor(object, names[i]);
        if (
          !descriptor ||
          (!descriptor.enumerable &&
            (("key" !== names[i] && "ref" !== names[i]) ||
              "function" !== typeof descriptor.get))
        )
          return !1;
      }
      return !0;
    }
    function objectName(object) {
      object = Object.prototype.toString.call(object);
      return object.slice(8, object.length - 1);
    }
    function describeKeyForErrorMessage(key) {
      var encodedKey = JSON.

      10 >= value.length ? value : value.slice(0, 10) + "..."
          );
        case "object":
          if (isArrayImpl(value)) return "[...]";
          if (null !== value && value.$$typeof === CLIENT_REFERENCE_TAG)
            return "client";

stringify(key);
      return '"' + key + '"' === encodedKey ? key : encodedKey;
    }
    function describeValueForErrorMessage(value) {
      switch (typeof value) {
        case "string":
          return JSON.stringify(


if (4 === metadata.length && "function" === typeof moduleExports.then)
    if ("fulfilled" === moduleExports.status)
      moduleExports = moduleExports.value;
    else throw moduleExports.reason;
  if ("*" === metadata[2]) return moduleExports;
  if ("" === metadata[2])
    return moduleExports.__esModule ? moduleExports.default : moduleExports;
  if (hasOwnProperty.call(moduleExports, metadata[2]))
    return moduleExports[metadata[2]];
}
function prepareDestinationWithChunks(moduleLoading, chunks, nonce$

ler_temp_const.X,
        JSCompiler_temp_const$jscomp$1 = moduleLoading.prefix + chunks[i];
      var JSCompiler_inline_result = moduleLoading.crossOrigin;
      JSCompiler_inline_result =
        "string" === typeof JSCompiler_inline_result
          ? "

jscomp$0) {
  if (null !== moduleLoading)
    for (var i = 0; i < chunks.length; i++) {
      var nonce = nonce$jscomp$0,
        JSCompiler_temp_const = ReactDOMSharedInternals.d,
        JSCompiler_temp_const$jscomp$0 = JSCompi


Exports = {
  NextRequest: require('next/dist/server/web/spec-extension/request')
    .NextRequest,
  NextResponse: require('next/dist/server/web/spec-extension/response')
    .NextResponse,
  ImageResponse: require('next/dist/server/web/spec-extension/image-response')
    .ImageResponse,
  userAgentFromString: require('next/dist/server/web/spec-extension/user-agent')
    .userAgentFromString,
  userAgent: require('next/dist/server/web/spec-extension/user-agent')
    .userAgent,
  URLPattern: require('next/

js-namespaces
// When importing CommonJS modules, the module.exports object is provided as the default export
module.exports = serverExports

// make import { xxx } from 'next/server' work
exports.NextRequest = serverExports.NextRequest
exports.NextRespons

dist/server/web/spec-extension/url-pattern')
    .URLPattern,
  after: require('next/dist/server/after').after,
  connection: require('next/dist/server/request/connection').connection,
}

// https://nodejs.org/api/esm.html#common


x &&
          ((name = modulePath.slice(idx + 1)),
          (resolvedModuleData = config[modulePath.slice(0, idx)]));
        if (!resolvedModuleData)
          throw Error(
            'Could not find the module "' +
              modulePath +
              '" in the React Client Manifest. This is probably a bug in the React Server Components bundler.'
          );
      }
      if (!0 === resolvedModuleData.async && !0 === clientReference.$$async)
        throw Error(
          'The module "' +

entReference.$$async
        ? [resolvedModuleData.id, resolvedModuleData.chunks, name, 1]
        : [resolvedModuleData.id, resolvedModuleData.chunks, name];
    }
    function preload(href, as, options) {
      if ("string" === typeof href) {
        var

    modulePath +
            '" is marked as an async ESM module but was loaded as a CJS proxy. This is probably a bug in the React Server Components bundler.'
        );
      return !0 === resolvedModuleData.async || !0 === cli


) {
    var args = ArraySlice.call(arguments, 1),
      $$typeof = { value: SERVER_REFERENCE_TAG },
      $$id = { value: this.$$id };
    args = { value: this.$$bound ? this.$$bound.concat(args) : args };
    return Object.defineProperties(newFn, {
      $$typeof: $$typeof,
      $$id: $$id,
      $$bound: args,
      bind: { value: bind, configurable: !0 }
    });
  }
  return newFn;
}
var serverReferenceToString = {
    value: function () {
      return "function () { [omitted code] }";
    },
    config

    case "$$id":
          return target.$$id;
        case "$$async":
          return target.$$async;
        case "name":
          return target.name;
        case "displayName":
          return;
        case "defaultProps":
          return;

urable: !0,
    writable: !0
  },
  PROMISE_PROTOTYPE = Promise.prototype,
  deepProxyHandlers = {
    get: function (target, name, receiver) {
      switch (name) {
        case "$$typeof":
          return target.$$typeof;


= clientReference.$$id,
        name = "",
        resolvedModuleData = config[modulePath];
      if (resolvedModuleData) name = resolvedModuleData.name;
      else {
        var idx = modulePath.lastIndexOf("#");
        -1 !== idx &&
          ((name = modulePath.slice(idx + 1)),
          (resolvedModuleData = config[modulePath.slice(0, idx)]));
        if (!resolvedModuleData)
          throw Error(
            'Could not find the module "' +
              modulePath +
              '" in the React Clie

      modulePath +
            '" is marked as an async ESM module but was loaded as a CJS proxy. This is probably a bug in the React Server Components bundler.'
        );
      return !0 === resolvedModuleData.async || !0 === clientReference.$$async

nt Manifest. This is probably a bug in the React Server Components bundler.'
          );
      }
      if (!0 === resolvedModuleData.async && !0 === clientReference.$$async)
        throw Error(
          'The module "' +


turn Object.defineProperties(proxyImplementation, {
    $$typeof: { value: CLIENT_REFERENCE_TAG$1 },
    $$id: { value: id },
    $$async: { value: async }
  });
}
var FunctionBind = Function.prototype.bind,
  ArraySlice = Array.prototype.slice;
function bind() {
  var newFn = FunctionBind.apply(this, arguments);
  if (this.$$typeof === SERVER_REFERENCE_TAG) {
    var args = ArraySlice.call(arguments, 1),
      $$typeof = { value: SERVER_REFERENCE_TAG },
      $$id = { value: this.$$id };
    args = { value

newFn;
}
var serverReferenceToString = {
    value: function () {
      return "function () { [omitted code] }";
    },
    configurable: !0,
    writable: !0
  },
  PROMISE_PROTOTYPE = Promise.prototype,
  deepProxyHandlers = {
    get: function (target,

: this.$$bound ? this.$$bound.concat(args) : args };
    return Object.defineProperties(newFn, {
      $$typeof: $$typeof,
      $$id: $$id,
      $$bound: args,
      bind: { value: bind, configurable: !0 }
    });
  }
  return


            {},
              target.$$id,
              !0
            ),
            proxy = new Proxy(clientReference, proxyHandlers$1);
          target.status = "fulfilled";
          target.value = proxy;
          return (target.then = registerClientReferenceImpl(
            function (resolve) {
              return Promise.resolve(resolve(proxy));
            },
            target.$$id + "#then",
            !1
          ));
      }
      if ("symbol" === typeof name)
        throw Error(

nceImpl(
          function () {
            throw Error(
              "Attempted to call " +
                String(name) +
                "() from the server but " +
                String(name) +
                " is on the client. It's not possible t

 "Cannot read Symbol exports. Only named exports are supported on a client module imported on the server."
        );
      clientReference = target[name];
      clientReference ||
        ((clientReference = registerClientRefere


ay(4096)),
            (writtenBytes = 0)),
          writeToDestination(destination, chunk))
        : ((target = currentView.length - writtenBytes),
          target < chunk.byteLength &&
            (0 === target
              ? writeToDestination(destination, currentView)
              : (currentView.set(chunk.subarray(0, target), writtenBytes),
                (writtenBytes += target),
                writeToDestination(destination, currentView),
                (chunk = chunk.subarray(target))),

stination(destination, currentView),
            (currentView = new Uint8Array(4096)),
            (writtenBytes = 0))));
  return destinationHasCapacity;
}
var textEncoder = new util.TextEncoder();
function byteLengthOfChunk(chunk) {
  return "string" ===

       (currentView = new Uint8Array(4096)),
            (writtenBytes = 0)),
          currentView.set(chunk, writtenBytes),
          (writtenBytes += chunk.byteLength),
          4096 === writtenBytes &&
            (writeToDe


t);i.filename=n;i._compile(t,n);return i.exports}function compareIds(e,t){if(typeof e!==typeof t){return typeof e<typeof t?-1:1}if(e<t){return-1}if(e>t){return 1}return 0}function compareModulesByIdentifier(e,t){return compareIds(e.identifier(),t.identifier())}const r="css/mini-extract";t.MODULE_TYPE=r;const o="__mini_css_extract_plugin_public_path_auto__";t.AUTO_PUBLIC_PATH=o;const a="webpack:///mini-css-extract-plugin/";t.ABSOLUTE_PUBLIC_PATH=a;const u="__mini_css_extract_plugin_single_dot_path_segment__"

f e.utils!=="undefined"&&typeof e.utils.contextify==="function"){return JSON.stringify(e.utils.contextify(e.context||e.rootContext,t))}const n=t.split("!");const{context:s}=e;return JSON.stringify(n.map((e=>{const t=e.match(/^(.*?)(\?.*)/);const n=t?t[2]:"

;t.SINGLE_DOT_PATH_SEGMENT=u;function isAbsolutePath(e){return i.default.posix.isAbsolute(e)||i.default.win32.isAbsolute(e)}const l=/^\.\.?[/\\]/;function isRelativePath(e){return l.test(e)}function stringifyRequest(e,t){if(typeo


339));var o=_interopRequireDefault(i(928));function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}function trueFn(){return true}function findModuleById(e,t){const{modules:i,chunkGraph:n}=e;for(const e of i){const i=typeof n!=="undefined"?n.getModuleId(e):e.id;if(i===t){return e}}return null}function evalModuleCode(e,t,i){const o=new n.default(i,e);o.paths=n.default._nodeModulePaths(e.context);o.filename=i;o._compile(t,i);return o.exports}function compareIds(e,t){if(typeof e!==typeof t){retu

rn typeof e<typeof t?-1:1}if(e<t){return-1}if(e>t){return 1}return 0}function compareModulesByIdentifier(e,t){return compareIds(e.identifier(),t.identifier())}const r="css/mini-extract";t.MODULE_TYPE=r;const s="__mini_css_extract


="undefined";var o=Array.prototype.forEach;function debounce(e,r){var t=0;return function(){var n=this;var i=arguments;var a=function functionCall(){return e.apply(n,i)};clearTimeout(t);t=setTimeout(a,r)}}function noop(){}function getCurrentScriptUrl(e){var r=i[e];if(!r){if(document.currentScript){r=document.currentScript.src}else{var t=document.getElementsByTagName("script");var a=t[t.length-1];if(a){r=a.src}}i[e]=r}return function(e){if(!r){return null}var t=r.split(/([^\\/]+)\.js$/);var i=t&&t[1];if(!i){


g=function(){return Array.isArray(this.nodes)?o(this.nodes):""};ValueParser.prototype.walk=function(e,r){n(this.nodes,e,r);return this};ValueParser.unit=t(15);ValueParser.walk=n;ValueParser.stringify=o;e.exports=ValueParser},90:e=>{var r="(".charCodeAt(0);var t=")".charCodeAt(0);var a="'".charCodeAt(0);var n='"'.charCodeAt(0);var o="\\".charCodeAt(0);var s="/".charCodeAt(0);var d=",".charCodeAt(0);var u=":".charCodeAt(0);var i="*".charCodeAt(0);var c="u".charCodeAt(0);var l="U".charCodeAt(0);var f="+".charC

odeAt(0);var h=/^[a-f0-9?-]+$/i;e.exports=function(e){var v=[];var A=e;var p,C,x,y,g,I,_,w;var E=0;var b=A.charCodeAt(E);var k=A.length;var m=[{nodes:v}];var P=0;var V;var q="";var N="";var O="";while(E<k){if(b<=32){p=E;do{p+=1;b


rse(e,r,t);if(typeof r!=="function")return n;return n.reduce((function(e,r){if(typeof r==="object")return e.concat(r);var t=r.split(RegExp("("+s+".*?"+s+")","g"));if(t.length===1)return e.concat(t[0]);return e.concat(t.filter(Boolean).map((function(e){if(R


tateAction } from 'react'
import {
  DevOverlayContext,
  useDevOverlayContext,
} from '../../src/next-devtools/dev-overlay.browser'
import { RenderErrorContext } from '../../src/next-devtools/dev-overlay/dev-overlay'
import {
  PanelRouterContext,
  type PanelStateKind,
} from '../../src/next-devtools/dev-overlay/menu/context'
import { INITIAL_OVERLAY_STATE } from '../../src/next-devtools/dev-overlay/shared'
import type {
  OverlayState,
  DispatcherEvent,
} from '../../src/next-devtools/dev-overlay/shared

ntimeErrors?: ReadyRuntimeError[]
  totalErrorCount?: number
  panel?: PanelStateKind | null
  setPanel?: Dispatch<SetStateAction<PanelStateKind | null>>
  selectedIndex?: number
  setSelectedIndex?: Dispatch<SetStateAction<number>>
  shadowRoot?: ShadowRo

'
import type { ReadyRuntimeError } from '../../src/next-devtools/dev-overlay/utils/get-error-by-type'

interface WithDevOverlayContextsOptions {
  state?: Partial<OverlayState>
  dispatch?: (action: DispatcherEvent) => void
  ru


mport { defineRule } from '../utils/define-rule'
import * as path from 'path'

const url = 'https://nextjs.org/docs/messages/no-head-import-in-document'

export default defineRule({
  meta: {
    docs: {
      description: 'Prevent usage of `next/head` in `pages/_document.js`.',
      recommended: true,
      url,
    },
    type: 'problem',
    schema: [],
  },
  create(context) {
    return {
      ImportDeclaration(node) {
        if (node.source.value !== 'next/head') {
          return
        }

dir === '/_document' && name === 'index')
        ) {
          context.report({
            node,
            message: `\`next/head\` should not be imported in \`pages${document}\`. Use \`<Head />\` from \`next/document\` instead. See: ${url}`,

   const document = context.filename.split('pages', 2)[1]
        if (!document) {
          return
        }

        const { name, dir } = path.parse(document)

        if (
          name.startsWith('_document') ||
          (


'
import { getRootDirs } from '../utils/get-root-dirs'

import {
  getUrlFromPagesDirectories,
  normalizeURL,
  execOnce,
  getUrlFromAppDirectory,
} from '../utils/url'

const pagesDirWarning = execOnce((pagesDirs) => {
  console.warn(
    `Pages directory cannot be found at ${pagesDirs.join(' or ')}. ` +
      'If using a custom path, please configure with the `no-html-link-for-pages` rule in your eslint config file.'
  )
})

// Cache for fs.existsSync lookup.
// Prevent multiple blocking IO requests tha

=== undefined) {
      cache[key] = fn(...args)
    }
    return cache[key]
  }
}

const cachedGetUrlFromPagesDirectories = memoize(getUrlFromPagesDirectories)
const cachedGetUrlFromAppDirectory = memoize(getUrlFromAppDirectory)

const url = 'https://nextj

t have already been calculated.
const fsExistsSyncCache = {}

const memoize = <T = any>(fn: (...args: any[]) => T) => {
  const cache = {}
  return (...args: any[]): T => {
    const key = JSON.stringify(args)
    if (cache[key]


location-assign-relative-destination'

const LOCATION_GLOBALS = new Set(['window', 'globalThis'])

function isLocationObject(node: any): boolean {
  // `location`
  if (node.type === 'Identifier' && node.name === 'location') {
    return true
  }
  // `window.location` / `globalThis.location` (dot or bracket notation)
  if (
    node.type === 'MemberExpression' &&
    node.object.type === 'Identifier' &&
    LOCATION_GLOBALS.has(node.object.name) &&
    isPropertyNamed(node, 'location')
  ) {
    return tru

e) ||
    (memberNode.computed === true &&
      memberNode.property.type === 'Literal' &&
      memberNode.property.value === name)
  )
}

/** Returns true when the node is a string literal containing "://" (absolute URL). */
function isAbsoluteUrlLiteral

e
  }
  return false
}

function isPropertyNamed(memberNode: any, name: string): boolean {
  return (
    (memberNode.computed === false &&
      memberNode.property.type === 'Identifier' &&
      memberNode.property.name === nam


 { defineRule } from '../utils/define-rule'
import * as path from 'path'

const url = 'https://nextjs.org/docs/messages/no-styled-jsx-in-document'

export default defineRule({
  meta: {
    docs: {
      description: 'Prevent usage of `styled-jsx` in `pages/_document.js`.',
      recommended: true,
      url,
    },
    type: 'problem',
    schema: [],
  },
  create(context) {
    return {
      JSXOpeningElement(node) {
        const document = context.filename.split('pages', 2)[1]
        if (!document) {

          return
        }

        if (
          node.name.name === 'style' &&
          node.attributes.find(
            (attr) => attr.type === 'JSXAttribute' && attr.name.name === 'jsx'
          )
        ) {
          context.report({
            n

          return
        }
        const { name, dir } = path.parse(document)

        if (
          !(
            name.startsWith('_document') ||
            (dir === '/_document' && name === 'index')
          )
        ) {


m '../utils/define-rule'
const url = 'https://nextjs.org/docs/messages/no-title-in-document-head'

export default defineRule({
  meta: {
    docs: {
      description:
        'Prevent usage of `<title>` with `Head` component from `next/document`.',
      recommended: true,
      url,
    },
    type: 'problem',
    schema: [],
  },
  create(context) {
    let headFromNextDocument = false
    return {
      ImportDeclaration(node) {
        if (node.source.value === 'next/document') {
          if (node.spe

         node.openingElement &&
          node.openingElement.name &&
          node.openingElement.name.name !== 'Head'
        ) {
          return
        }

        const titleTag = node.children.find(
          (child) =>
            child.openingElem

cifiers.some(({ local }) => local.name === 'Head')) {
            headFromNextDocument = true
          }
        }
      },
      JSXElement(node) {
        if (!headFromNextDocument) {
          return
        }

        if (


mport * as path from 'path'

const NEXT_EXPORT_FUNCTIONS = [
  'getStaticProps',
  'getStaticPaths',
  'getServerSideProps',
]

// 0 is the exact match
const THRESHOLD = 1

// the minimum number of operations required to convert string a to string b.
function minDistance(a, b) {
  const m = a.length
  const n = b.length

  if (m < n) {
    return minDistance(b, a)
  }

  if (n === 0) {
    return m
  }

  let previousRow = Array.from({ length: n + 1 }, (_, i) => i)

  for (let i = 0; i < m; i++) {
    const

+ Number(s1 !== s2)
      currentRow.push(Math.min(insertions, deletions, substitutions))
    }
    previousRow = currentRow
  }
  return previousRow[previousRow.length - 1]
}

export default defineRule({
  meta: {
    docs: {
      description: 'Prevent c

 s1 = a[i]
    let currentRow = [i + 1]
    for (let j = 0; j < n; j++) {
      const s2 = b[j]
      const insertions = previousRow[j + 1] + 1
      const deletions = currentRow[j] + 1
      const substitutions = previousRow[j]


  return function notAvailable() {
      throw new Error(`\`${name}\` is only available in a Server Component.`)
    }
  }

  cacheExports = {
    unstable_cache: function unstable_cache(cb) {
      // Legacy behavior: allow importing/using unstable_cache from client bundles
      // without pulling in server internals.
      if (typeof cb !== 'function') return cb
      return function cached() {
        return cb.apply(this, arguments)
      }
    },
    unstable_noStore: function unstable_noStore() {},

  refresh: notAvailableInClient('refresh'),
    cacheLife: notAvailableInClient('cacheLife'),
    cacheTag: notAvailableInClient('cacheTag'),
  }
} else {
  // Keep server requires in this branch so browser builds can DCE them.
  cacheExports = {
    unsta

   io: require('next/dist/client/request/io.browser').io,

    updateTag: notAvailableInClient('updateTag'),
    revalidateTag: notAvailableInClient('revalidateTag'),
    revalidatePath: notAvailableInClient('revalidatePath'),


= require('./src/shared/lib/modern-browserslist-target')
const DevToolsIgnoreListPlugin = require('./webpack-plugins/devtools-ignore-list-plugin')

function shouldIgnorePath(modulePath) {
  // For consumers, everything will be considered 3rd party dependency if they use
  // the bundles we produce here.
  // In other words, this is all library code and should therefore be ignored.
  return true
}

/**
 * @param {Object} options
 * @param {boolean} options.dev
 * @param {Partial<webpack.Configuration>} optio

WSERSLIST_TARGET.join(', ')}`

  return {
    entry: path.join(__dirname, 'src/next-devtools/entrypoint.ts'),
    target,
    mode: dev ? 'development' : 'production',
    output: {
      path: path.join(__dirname, 'dist/compiled/next-devtools'),
      fil

ns.rest
 * @returns {webpack.Configuration}
 */
module.exports = ({ dev, ...rest }) => {
  const experimental = false

  const bundledReactChannel = experimental ? '-experimental' : ''

  const target = `browserslist:${MODERN_BRO


s is all library code and should therefore be ignored.
  return true
}

const pagesExternals = [
  'react',
  'react/package.json',
  'react/jsx-runtime',
  'react/jsx-dev-runtime',
  'react/compiler-runtime',
  'react-dom',
  'react-dom/package.json',
  'react-dom/client',
  'react-dom/server',
  'react-dom/server.browser',
  'react-dom/server.edge',
  'react-server-dom-webpack/client',
  'react-server-dom-webpack/server',
  'react-server-dom-webpack/server.node',
  'react-server-dom-webpack/static',
]

co

er$': `next/dist/compiled/react${reactChannel}/react.react-server`,
    'react-dom$': `next/dist/compiled/react-dom${reactChannel}`,
    'react/jsx-runtime$': `next/dist/compiled/react${reactChannel}/jsx-runtime`,
    'react/jsx-dev-runtime$': `next/dist/c

nst appExternals = []

function makeAppAliases({ experimental, bundler }) {
  const reactChannel = experimental ? '-experimental' : ''

  return {
    react$: `next/dist/compiled/react${reactChannel}`,
    'react/react.react-serv


} = require('fs')
const { basename, dirname, extname, join, resolve } = require('path')
const { Module } = require('module')

// files might be lower case and not able to be found on case-sensitive
// file systems (ubuntu)
const potentialLicenseFiles = [
  'LICENSE',
  'license',
  'LICENSE.md',
  'License.md',
  'license.md',
]

// See taskfile.js bundleContext definition for explanation
const m = new Module(resolve(__dirname, 'bundles', '_'))
m.filename = m.id
m.paths = Module._nodeModulePaths(m.id)
const

}, function* (file, options) {
    if (options.externals && options.packageName) {
      options.externals = { ...options.externals }
      delete options.externals[options.packageName]
    }
    let precompiled = options.precompiled !== false
    delete o

 bundleRequire = m.require
bundleRequire.resolve = (request, options) =>
  Module._resolveFilename(request, m, false, options)

module.exports = function (task) {
  // eslint-disable-next-line require-yield
  task.plugin('ncc', {


ack instead of chokidar

https://github.com/lukeed/taskr/blob/7a50e6e8c1fb8c01c0020d9f0e4d8897ccc4cc28/license
The MIT License (MIT)

Copyright (c) 2015 Jorge Bucaran (https://github.com/JorgeBucaran)
Copyright (c) 2016 Luke Edwards (https://github.com/lukeed)

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modi

n notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR

fy, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permissio


node-html-parser'
export async function ncc_node_html_parser(task, opts) {
  await task
    .source(relative(__dirname, require.resolve('node-html-parser')))
    .ncc({
      packageName: 'node-html-parser',
      externals,
      target: 'es5',
    })
    .target('src/compiled/node-html-parser')
}

externals['@vercel/routing-utils'] = 'next/dist/compiled/@vercel/routing-utils'
export async function ncc_vercel_routing_utils(task, opts) {
  await task
    .source(
      relative(
        __dirname,
        r

nals['busboy'] = 'next/dist/compiled/busboy'
export async function ncc_busboy(task, opts) {
  await task
    .source(relative(__dirname, require.resolve('busboy')))
    .ncc({
      packageName: 'busboy',
      externals,
      target: 'es5',
    })
    .t

equire.resolve('@vercel/routing-utils/dist/superstatic')
      )
    )
    .ncc({
      packageName: '@vercel/routing-utils',
      externals,
      target: 'es5',
    })
    .target('src/compiled/@vercel/routing-utils')
}

exter


m-webpack/client.edge'
declare module 'next/dist/compiled/react-server-dom-webpack/client.browser'
declare module 'next/dist/compiled/react-server-dom-webpack/server.browser'
declare module 'next/dist/compiled/react-server-dom-webpack/server.edge'
declare module 'next/dist/compiled/react-server-dom-turbopack/client'
declare module 'next/dist/compiled/react-server-dom-turbopack/client.edge'
declare module 'next/dist/compiled/react-server-dom-turbopack/client.browser'
declare module 'next/dist/compiled/react-

om/server'
declare module 'next/dist/compiled/react-dom/server.edge'
declare module 'next/dist/compiled/browserslist'

declare module 'react-server-dom-webpack/client' {
  import type { Options } from 'react-server-dom-webpack/client.edge'

  export { Opti

server-dom-turbopack/server.browser'
declare module 'next/dist/compiled/react-server-dom-turbopack/server.edge'
declare module 'next/dist/compiled/react-server-dom-turbopack/static.edge'
declare module 'next/dist/compiled/react-d


act-webpack5'
import { join, dirname, resolve } from 'path'
import { fileURLToPath } from 'url'

/**
 * This function is used to resolve the absolute path of a package.
 * It is needed in projects that use Yarn PnP or are set up within a monorepo.
 */
function getAbsolutePath(value: string): any {
  return dirname(require.resolve(join(value, 'package.json')))
}
import { createRequire } from 'module'
const require = createRequire(import.meta.url)

const config: StorybookConfig = {
  stories: ['../src/next-de

@storybook/addon-a11y'),
  ],
  framework: {
    name: getAbsolutePath('@storybook/react-webpack5'),
    options: {
      builder: {
        useSWC: true,
      },
    },
  },
  swc: () => ({
    jsc: {
      transform: {
        react: {
          runtime

vtools/**/*.stories.tsx'],
  addons: [
    getAbsolutePath('@storybook/addon-webpack5-compiler-swc'),
    getAbsolutePath('@storybook/addon-essentials'),
    getAbsolutePath('@storybook/addon-interactions'),
    getAbsolutePath('


import { useReducer } from 'react'
import {
  ACTION_BEFORE_REFRESH,
  ACTION_BUILD_ERROR,
  ACTION_BUILD_OK,
  ACTION_BUILDING_INDICATOR_HIDE,
  ACTION_BUILDING_INDICATOR_SHOW,
  ACTION_CACHE_INDICATOR,
  ACTION_INSTANT_ERRORS_CLEAR,
  ACTION_INSTANT_NAVS_TOGGLE,
  ACTION_INSTANT_NAVS_RESET,
  ACTION_DEBUG_INFO,
  ACTION_DEV_INDICATOR,
  ACTION_DEV_INDICATOR_SET,
  ACTION_DEVTOOL_UPDATE_ROUTE_STATE,
  ACTION_DEVTOOLS_CONFIG,
  ACTION_DEVTOOLS_PANEL_POSITION,
  ACTION_DEVTOOLS_POSITION,
  ACTION_DEVTOOLS_SC

ERROR,
  ACTION_UNHANDLED_REJECTION,
  ACTION_VERSION_INFO,
  INITIAL_OVERLAY_STATE,
} from '../../src/next-devtools/dev-overlay/shared'

export const storybookDefaultOverlayState: OverlayState = {
  ...INITIAL_OVERLAY_STATE,
  routerType: 'app',
  isError

ALE,
  ACTION_ERROR_OVERLAY_CLOSE,
  ACTION_ERROR_OVERLAY_OPEN,
  ACTION_ERROR_OVERLAY_TOGGLE,
  ACTION_REFRESH,
  ACTION_RENDERING_INDICATOR_HIDE,
  ACTION_RENDERING_INDICATOR_SHOW,
  ACTION_STATIC_INDICATOR,
  ACTION_UNHANDLED_


mport { defineRule } from '../utils/define-rule'

const url = 'https://nextjs.org/docs/messages/no-img-element'

export default defineRule({
  meta: {
    docs: {
      description:
        'Prevent usage of `<img>` element due to slower LCP and higher bandwidth.',
      category: 'HTML',
      recommended: true,
      url,
    },
    type: 'problem',
    schema: [],
  },
  create(context) {
    // Get relative path of the file
    const relativePath = context.filename
      .replace(path.sep, '/')
      .r

 if (node.attributes.length === 0) {
          return
        }

        if (node.parent?.parent?.openingElement?.name?.name === 'picture') {
          return
        }

        // If is metadata route files, ignore
        // e.g. opengraph-image.js, twit

eplace(context.cwd, '')
      .replace(/^\//, '')

    const isAppDir = /^(src\/)?app\//.test(relativePath)

    return {
      JSXOpeningElement(node) {
        if (node.name.name !== 'img') {
          return
        }


ineRule } from '../utils/define-rule'
const url = 'https://nextjs.org/docs/messages/no-script-component-in-head'

export default defineRule({
  meta: {
    docs: {
      description: 'Prevent usage of `next/script` in `next/head` component.',
      recommended: true,
      url,
    },
    type: 'problem',
    schema: [],
  },
  create(context) {
    let isNextHead = null

    return {
      ImportDeclaration(node) {
        if (node.source.value === 'next/head') {
          isNextHead = node.source.value

   node.openingElement.name &&
          node.openingElement.name.name !== 'Head'
        ) {
          return
        }

        const scriptTag = node.children.find(
          (child) =>
            child.openingElement &&
            child.openingElemen

      }

        if (node.source.value !== 'next/script') {
          return
        }
      },
      JSXElement(node) {
        if (!isNextHead) {
          return
        }

        if (
          node.openingElement &&


ate'

export { unstable_noStore } from 'next/dist/server/web/spec-extension/unstable-no-store'

export { io } from 'next/dist/server/request/io'

import { cacheTag } from 'next/dist/server/use-cache/cache-tag'

export { cacheTag }

/**
 * Cache this `"use cache"` for a timespan defined by the `"default"` profile.
 * ```
 *   stale:      300 seconds (5 minutes)
 *   revalidate: 900 seconds (15 minutes)
 *   expire:     never
 * ```
 *
 * This cache may be stale on clients for 5 minutes before checking with t

old value the next request.
 */
export function cacheLife(profile: 'default'): void

/**
 * Cache this `"use cache"` for a timespan defined by the `"seconds"` profile.
 * ```
 *   stale:      30 seconds
 *   revalidate: 1 second
 *   expire:     1 minute

he server.
 * If the server receives a new request after 15 minutes, start revalidating new values in the background.
 * It lives for the maximum age of the server cache. If this entry has no traffic for a while, it may serve an


const path = require('path')
const fs = require('fs/promises')

const errorsDir = path.join(__dirname, '.errors')

// This script checks for new error codes in .errors directory and consolidates them into errors.json.
// It will fail if new error codes are found, after consolidating them, to ensure error codes are
// properly reviewed and committed.
async function main() {
  // Check if .errors directory exists
  try {
    await fs.access(errorsDir)
  } catch {
    process.exit(0)
  }

  let existingErrors

  // Calculate next error code
  const nextInitialCode =
    Object.keys(existingErrors).length > 0
      ? Math.max(...Object.keys(existingErrors).map(Number)) + 1
      : 1

  // Process new error files
  const errorFiles = [...(await fs.readdir(errors

= {}

  // Load existing errors.json if it exists
  try {
    existingErrors = JSON.parse(
      await fs.readFile(path.join(__dirname, 'errors.json'), 'utf8')
    )
  } catch {
    // Start fresh if errors.json doesn't exist
  }


import type { AsyncLocalStorage as NodeAsyncLocalStorage } from 'async_hooks'

declare global {
  var AsyncLocalStorage: typeof NodeAsyncLocalStorage
}

export { NextFetchEvent } from 'next/dist/server/web/spec-extension/fetch-event'
export { NextRequest } from 'next/dist/server/web/spec-extension/request'
export { NextResponse } from 'next/dist/server/web/spec-extension/response'
export {
  NextMiddleware,
  MiddlewareConfig,
  NextProxy,
  ProxyConfig,
} from 'next/dist/server/web/types'
export { userAgen

ImageResponse } from 'next/dist/server/web/spec-extension/image-response'
export type { ImageResponseOptions } from 'next/dist/compiled/@vercel/og/types'
export { after } from 'next/dist/server/after'
export { connection } from 'next/dist/server/request/co

tFromString } from 'next/dist/server/web/spec-extension/user-agent'
export { userAgent } from 'next/dist/server/web/spec-extension/user-agent'
export { URLPattern } from 'next/dist/compiled/@edge-runtime/primitives/url'
export {


k = require('@rspack/core')

module.exports = function (task) {
  // eslint-disable-next-line require-yield
  task.plugin('webpack', {}, function* (_, options) {
    options = options || {}

    const compiler = webpack(options.config)

    if (options.watch) {
      return compiler.watch({}, (err, stats) => {
        if (err || stats.hasErrors()) {
          console.error(err || stats.toString())
        } else {
          console.log(`${options.name} compiled successfully.`)
        }
      })
    }

? stats.toString(),
          })
        }

        if (stats.hasWarnings()) {
          this.emit('plugin_warning', {
            plugin: 'taskfile-webpack',
            warning: `webpack compiled ${options.name} with warnings:\n${stats.toString('errors-w

return new Promise((resolve) => {
      compiler.run((err, stats) => {
        if (err || stats.hasErrors()) {
          return this.emit('plugin_error', {
            plugin: 'taskfile-webpack',
            error: err?.message ?


//nextjs.org/docs/messages/no-head-element'

export default defineRule({
  meta: {
    docs: {
      description: 'Prevent usage of `<head>` element.',
      category: 'HTML',
      recommended: true,
      url,
    },
    type: 'problem',
    schema: [],
  },
  create(context) {
    return {
      JSXOpeningElement(node) {
        const paths = context.filename

        const isInAppDir = () =>
          paths.includes(`app${path.sep}`) ||
          paths.includes(`app${path.posix.sep}`)
        // Only li

(node.name.name !== 'head' || isInAppDir()) {
          return
        }

        context.report({
          node,
          message: `Do not use \`<head>\` element. Use \`<Head />\` from \`next/head\` instead. See: ${url}`,
        })
      },
    }
  },

nt the <head> element in pages directory
        if


rom '@storybook/react'
import { withDevOverlayContexts } from './decorators/with-dev-overlay-contexts'

const portalNode = document.querySelector('nextjs-portal')!
const shadowRoot = portalNode.attachShadow({ mode: 'open' })

const preview: Preview = {
  parameters: {
    a11y: {
      element: 'nextjs-portal',
      config: {
        standards: {
          ariaAttrs: {
            'aria-modal': {
              global: true,
            },
          },
        },
        rules: [
          {
            //

   // on a value below threshold.
            id: 'color-contrast',
            selector: '.code-frame-lines',
            enabled: false,
          },
        ],
      },
    },
    controls: {
      matchers: {
        color: /(background|color)$/i,

It's incredibly hard to find a code highlighting theme that works
            // for both light and dark themes and passes WCAG color contrast.
            // These kind of tests should really only fail when you regress


/docs/messages/no-page-custom-font'

function isIdentifierMatch(id1, id2) {
  return (id1 === null && id2 === null) || (id1 && id2 && id1.name === id2.name)
}

export default defineRule({
  meta: {
    docs: {
      description: 'Prevent page-only custom fonts.',
      recommended: true,
      url,
    },
    type: 'problem',
    schema: [],
  },
  create(context) {
    const { sourceCode } = context
    const paths = context.filename.split('pages')
    const page = paths[paths.length - 1]

    // outside o

aultExportId
    let exportDeclarationType

    return {
      ImportDeclaration(node) {
        if (node.source.value === 'next/document') {
          const documentImport = node.specifiers.find(
            ({ type }) => type === 'ImportDefaultSpecifier'

f a file within `pages`, bail
    if (!page) {
      return {}
    }

    const is_Document =
      page.startsWith(`${sep}_document`) ||
      page.startsWith(`${posix.sep}_document`)

    let documentImportName
    let localDef


h')

const transform = require('@swc/core').transform

module.exports = function (task) {
  task.plugin(
    'swc',
    {},
    function* (
      file,
      serverOrClient,
      { stripExtension, interopClientDefaultExport = false, esm = false } = {}
    ) {
      // Don't compile .d.ts
      if (
        file.base.endsWith('.d.ts') ||
        file.base.endsWith('.json') ||
        file.base.endsWith('.jsonc') ||
        file.base.endsWith('.woff2')
      )
        return

      const plugins = [

* @type {import('@swc/core').Options} */
      const swcClientOptions = {
        module: esm
          ? {
              type: 'es6',
            }
          : {
              type: 'commonjs',
              ignoreDynamic: true,
              exportIntero

...(file.base.includes('.test.') || file.base.includes('.stories.')
          ? []
          : [[path.join(__dirname, 'next_error_code_swc_plugin.wasm'), {}]]),
      ]

      const isClient = serverOrClient === 'client'
      /*


//nextjs.org/docs/messages/no-sync-scripts'

export default defineRule({
  meta: {
    docs: {
      description: 'Prevent synchronous scripts.',
      recommended: true,
      url,
    },
    type: 'problem',
    schema: [],
  },
  create(context) {
    return {
      JSXOpeningElement(node) {
        if (node.name.name !== 'script') {
          return
        }
        if (node.attributes.length === 0) {
          return
        }
        const attributeNames = node.attributes
          .filter((attr) =>

=> attr.name.name)
        if (
          attributeNames.includes('src') &&
          !attributeNames.includes('async') &&
          !attributeNames.includes('defer')
        ) {
          context.report({
            node,
            message: `Synchronou

attr.type === 'JSXAttribute')
          .map((attr)


 names.length;
        i++
      ) {
        var descriptor = Object.getOwnPropertyDescriptor(object, names[i]);
        if (
          !descriptor ||
          (!descriptor.enumerable &&
            (("key" !== names[i] && "ref" !== names[i]) ||
              "function" !== typeof descriptor.get))
        )
          return !1;
      }
      return !0;
    }
    function objectName(object) {
      object = Object.prototype.toString.call(object);
      return object.slice(8, object.length - 1);
    }
    fu

lue) {
        case "string":
          return JSON.stringify(
            10 >= value.length ? value : value.slice(0, 10) + "..."
          );
        case "object":
          if (isArrayImpl(value)) return "[...]";
          if (null !== value && value.$

nction describeKeyForErrorMessage(key) {
      var encodedKey = JSON.stringify(key);
      return '"' + key + '"' === encodedKey ? key : encodedKey;
    }
    function describeValueForErrorMessage(value) {
      switch (typeof va


nse React
 * react-jsx-dev-runtime.react-server.production.js
 *
 * Copyright (c) Meta Platforms, Inc. and affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */

"use strict";
var React = require("next/dist/compiled/react"),
  REACT_ELEMENT_TYPE = Symbol.for("react.transitional.element"),
  REACT_FRAGMENT_TYPE = Symbol.for("react.fragment");
if (!React.__SERVER_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE)

Key) {
  var key = null;
  void 0 !== maybeKey && (key = "" + maybeKey);
  void 0 !== config.key && (key = "" + config.key);
  if ("key" in config) {
    maybeKey = {};
    for (var propName in config)
      "key" !== propName && (maybeKey[propName] = conf

 throw Error(
    'The "react" package in this environment is not configured correctly. The "react-server" condition must be enabled in any environment that runs React Server Components.'
  );
function jsxProd(type, config, maybe


 if ("function" === typeof type)
        return type.$$typeof === REACT_CLIENT_REFERENCE
          ? null
          : type.displayName || type.name || null;
      if ("string" === typeof type) return type;
      switch (type) {
        case REACT_FRAGMENT_TYPE:
          return "Fragment";
        case REACT_PROFILER_TYPE:
          return "Profiler";
        case REACT_STRICT_MODE_TYPE:
          return "StrictMode";
        case REACT_SUSPENSE_TYPE:
          return "Suspense";
        case REACT_SUSPENSE

       switch (
          ("number" === typeof type.tag &&
            console.error(
              "Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."
            ),
          type.$$typeof)

_LIST_TYPE:
          return "SuspenseList";
        case REACT_ACTIVITY_TYPE:
          return "Activity";
        case REACT_VIEW_TRANSITION_TYPE:
          return "ViewTransition";
      }
      if ("object" === typeof type)


ht (c) Meta Platforms, Inc. and affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */

"use strict";
var REACT_ELEMENT_TYPE = Symbol.for("react.transitional.element"),
  REACT_FRAGMENT_TYPE = Symbol.for("react.fragment");
function jsxProd(type, config, maybeKey) {
  var key = null;
  void 0 !== maybeKey && (key = "" + maybeKey);
  void 0 !== config.key && (key = "" + config.key);
  if ("key" in config) {
    maybeKey

== propName && (maybeKey[propName] = config[propName]);
  } else maybeKey = config;
  config = maybeKey.ref;
  return {
    $$typeof: REACT_ELEMENT_TYPE,
    type: type,
    key: key,
    ref: void 0 !== config ? config : null,
    props: maybeKey
  };
}
e

= {};
    for (var propName in config)
      "key" !


t (c) Meta Platforms, Inc. and affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */

"use strict";
var REACT_ELEMENT_TYPE = Symbol.for("react.transitional.element"),
  REACT_FRAGMENT_TYPE = Symbol.for("react.fragment");
function jsxProd(type, config, maybeKey) {
  var key = null;
  void 0 !== maybeKey && (key = "" + maybeKey);
  void 0 !== config.key && (key = "" + config.key);
  if ("key" in config) {
    maybeKey =

= propName && (maybeKey[propName] = config[propName]);
  } else maybeKey = config;
  config = maybeKey.ref;
  return {
    $$typeof: REACT_ELEMENT_TYPE,
    type: type,
    key: key,
    ref: void 0 !== config ? config : null,
    props: maybeKey
  };
}
ex

 {};
    for (var propName in config)
      "key" !=