@payloadcms/next 3.69.0-internal.2883df2 → 3.69.0-internal.35bf893

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (81) hide show
  1. package/dist/cjs/withPayload.cjs +1 -0
  2. package/dist/cjs/withPayload.cjs.map +2 -2
  3. package/dist/elements/DocumentHeader/Tabs/Tab/TabLink.d.ts.map +1 -1
  4. package/dist/elements/DocumentHeader/Tabs/Tab/TabLink.js +24 -19
  5. package/dist/elements/DocumentHeader/Tabs/Tab/TabLink.js.map +1 -1
  6. package/dist/elements/Nav/index.client.d.ts.map +1 -1
  7. package/dist/elements/Nav/index.client.js +21 -15
  8. package/dist/elements/Nav/index.client.js.map +1 -1
  9. package/dist/prod/styles.css +1 -1
  10. package/dist/templates/Default/index.d.ts.map +1 -1
  11. package/dist/templates/Default/index.js +20 -35
  12. package/dist/templates/Default/index.js.map +1 -1
  13. package/dist/utilities/handleAuthRedirect.d.ts.map +1 -1
  14. package/dist/utilities/handleAuthRedirect.js +2 -1
  15. package/dist/utilities/handleAuthRedirect.js.map +1 -1
  16. package/dist/views/Account/ResetPreferences/index.d.ts.map +1 -1
  17. package/dist/views/Account/ResetPreferences/index.js +6 -1
  18. package/dist/views/Account/ResetPreferences/index.js.map +1 -1
  19. package/dist/views/CreateFirstUser/index.client.d.ts.map +1 -1
  20. package/dist/views/CreateFirstUser/index.client.js +6 -1
  21. package/dist/views/CreateFirstUser/index.client.js.map +1 -1
  22. package/dist/views/Dashboard/Default/index.d.ts.map +1 -1
  23. package/dist/views/Dashboard/Default/index.js +8 -4
  24. package/dist/views/Dashboard/Default/index.js.map +1 -1
  25. package/dist/views/Document/index.d.ts.map +1 -1
  26. package/dist/views/Document/index.js +6 -2
  27. package/dist/views/Document/index.js.map +1 -1
  28. package/dist/views/ForgotPassword/index.d.ts.map +1 -1
  29. package/dist/views/ForgotPassword/index.js +6 -3
  30. package/dist/views/ForgotPassword/index.js.map +1 -1
  31. package/dist/views/List/handleServerFunction.d.ts.map +1 -1
  32. package/dist/views/List/handleServerFunction.js +4 -1
  33. package/dist/views/List/handleServerFunction.js.map +1 -1
  34. package/dist/views/List/index.d.ts.map +1 -1
  35. package/dist/views/List/index.js +2 -1
  36. package/dist/views/List/index.js.map +1 -1
  37. package/dist/views/Login/LoginForm/index.d.ts.map +1 -1
  38. package/dist/views/Login/LoginForm/index.js +24 -17
  39. package/dist/views/Login/LoginForm/index.js.map +1 -1
  40. package/dist/views/Logout/LogoutClient.d.ts.map +1 -1
  41. package/dist/views/Logout/LogoutClient.js +41 -36
  42. package/dist/views/Logout/LogoutClient.js.map +1 -1
  43. package/dist/views/NotFound/index.d.ts.map +1 -1
  44. package/dist/views/NotFound/index.js +1 -0
  45. package/dist/views/NotFound/index.js.map +1 -1
  46. package/dist/views/ResetPassword/ResetPasswordForm/index.d.ts.map +1 -1
  47. package/dist/views/ResetPassword/ResetPasswordForm/index.js +22 -16
  48. package/dist/views/ResetPassword/ResetPasswordForm/index.js.map +1 -1
  49. package/dist/views/ResetPassword/index.d.ts.map +1 -1
  50. package/dist/views/ResetPassword/index.js +4 -2
  51. package/dist/views/ResetPassword/index.js.map +1 -1
  52. package/dist/views/Root/getRouteData.d.ts.map +1 -1
  53. package/dist/views/Root/getRouteData.js +3 -1
  54. package/dist/views/Root/getRouteData.js.map +1 -1
  55. package/dist/views/Root/index.d.ts.map +1 -1
  56. package/dist/views/Root/index.js +11 -5
  57. package/dist/views/Root/index.js.map +1 -1
  58. package/dist/views/Root/isPathMatchingRoute.d.ts.map +1 -1
  59. package/dist/views/Root/isPathMatchingRoute.js.map +1 -1
  60. package/dist/views/Unauthorized/index.d.ts.map +1 -1
  61. package/dist/views/Unauthorized/index.js +4 -2
  62. package/dist/views/Unauthorized/index.js.map +1 -1
  63. package/dist/views/Verify/index.d.ts.map +1 -1
  64. package/dist/views/Verify/index.js +4 -2
  65. package/dist/views/Verify/index.js.map +1 -1
  66. package/dist/views/Version/Default/SetStepNav.d.ts.map +1 -1
  67. package/dist/views/Version/Default/SetStepNav.js +14 -7
  68. package/dist/views/Version/Default/SetStepNav.js.map +1 -1
  69. package/dist/views/Version/Restore/index.d.ts.map +1 -1
  70. package/dist/views/Version/Restore/index.js +4 -2
  71. package/dist/views/Version/Restore/index.js.map +1 -1
  72. package/dist/views/Versions/cells/CreatedAt/index.d.ts.map +1 -1
  73. package/dist/views/Versions/cells/CreatedAt/index.js +6 -3
  74. package/dist/views/Versions/cells/CreatedAt/index.js.map +1 -1
  75. package/dist/views/Versions/index.d.ts.map +1 -1
  76. package/dist/views/Versions/index.js +6 -2
  77. package/dist/views/Versions/index.js.map +1 -1
  78. package/dist/withPayload/withPayload.d.ts.map +1 -1
  79. package/dist/withPayload/withPayload.js +1 -1
  80. package/dist/withPayload/withPayload.js.map +1 -1
  81. package/package.json +7 -7
@@ -190,6 +190,7 @@ var withPayload = (nextConfig = {}, options = {}) => {
190
190
  }];
191
191
  },
192
192
  serverExternalPackages: [
193
+ ...nextConfig.serverExternalPackages || [],
193
194
  // WHY: without externalizing graphql, a graphql version error will be thrown
194
195
  // during runtime ("Ensure that there is only one instance of \"graphql\" in the node_modules\ndirectory.")
195
196
  "graphql",
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/withPayload/withPayload.ts", "../../src/withPayload/withPayload.utils.ts", "../../src/withPayload/withPayloadLegacy.ts"],
4
- "sourcesContent": ["/* eslint-disable no-console */\n/* eslint-disable no-restricted-exports */\nimport type { NextConfig } from 'next'\n\nimport {\n getNextjsVersion,\n supportsTurbopackExternalizeTransitiveDependencies,\n} from './withPayload.utils.js'\nimport { withPayloadLegacy } from './withPayloadLegacy.js'\n\nconst poweredByHeader = {\n key: 'X-Powered-By',\n value: 'Next.js, Payload',\n}\n\n/**\n * @param {import('next').NextConfig} nextConfig\n * @param {Object} [options] - Optional configuration options\n * @param {boolean} [options.devBundleServerPackages] - Whether to bundle server packages in development mode. @default false\n * */\nexport const withPayload = (\n nextConfig: NextConfig = {},\n options: { devBundleServerPackages?: boolean } = {},\n): NextConfig => {\n const nextjsVersion = getNextjsVersion()\n\n const supportsTurbopackBuild = supportsTurbopackExternalizeTransitiveDependencies(nextjsVersion)\n\n const env = nextConfig.env || {}\n\n if (nextConfig.experimental?.staleTimes?.dynamic) {\n console.warn(\n 'Payload detected a non-zero value for the `staleTimes.dynamic` option in your Next.js config. This will slow down page transitions and may cause stale data to load within the Admin panel. To clear this warning, remove the `staleTimes.dynamic` option from your Next.js config or set it to 0. In the future, Next.js may support scoping this option to specific routes.',\n )\n env.NEXT_PUBLIC_ENABLE_ROUTER_CACHE_REFRESH = 'true'\n }\n\n const baseConfig: NextConfig = {\n ...nextConfig,\n env,\n outputFileTracingExcludes: {\n ...(nextConfig.outputFileTracingExcludes || {}),\n '**/*': [\n ...(nextConfig.outputFileTracingExcludes?.['**/*'] || []),\n 'drizzle-kit',\n 'drizzle-kit/api',\n ],\n },\n outputFileTracingIncludes: {\n ...(nextConfig.outputFileTracingIncludes || {}),\n '**/*': [...(nextConfig.outputFileTracingIncludes?.['**/*'] || []), '@libsql/client'],\n },\n turbopack: {\n ...(nextConfig.turbopack || {}),\n },\n // We disable the poweredByHeader here because we add it manually in the headers function below\n ...(nextConfig.poweredByHeader !== false ? { poweredByHeader: false } : {}),\n headers: async () => {\n const headersFromConfig = 'headers' in nextConfig ? await nextConfig.headers() : []\n\n return [\n ...(headersFromConfig || []),\n {\n headers: [\n {\n key: 'Accept-CH',\n value: 'Sec-CH-Prefers-Color-Scheme',\n },\n {\n key: 'Vary',\n value: 'Sec-CH-Prefers-Color-Scheme',\n },\n {\n key: 'Critical-CH',\n value: 'Sec-CH-Prefers-Color-Scheme',\n },\n ...(nextConfig.poweredByHeader !== false ? [poweredByHeader] : []),\n ],\n source: '/:path*',\n },\n ]\n },\n serverExternalPackages: [\n // WHY: without externalizing graphql, a graphql version error will be thrown\n // during runtime (\"Ensure that there is only one instance of \\\"graphql\\\" in the node_modules\\ndirectory.\")\n 'graphql',\n ...(process.env.NODE_ENV === 'development' && options.devBundleServerPackages !== true\n ? /**\n * Unless explicitly disabled by the user, by passing `devBundleServerPackages: true` to withPayload, we\n * do not bundle server-only packages during dev for two reasons:\n *\n * 1. Performance: Fewer files to compile means faster compilation speeds.\n * 2. Turbopack support: Webpack's externals are not supported by Turbopack.\n *\n * Regarding Turbopack support: Unlike webpack.externals, we cannot use serverExternalPackages to\n * externalized packages that are not resolvable from the project root. So including a package like\n * \"drizzle-kit\" in here would do nothing - Next.js will ignore the rule and still bundle the package -\n * because it detects that the package is not resolvable from the project root (= not directly installed\n * by the user in their own package.json).\n *\n * Instead, we can use serverExternalPackages for the entry-point packages that *are* installed directly\n * by the user (e.g. db-postgres, which then installs drizzle-kit as a dependency).\n *\n *\n *\n * We should only do this during development, not build, because externalizing these packages can hurt\n * the bundle size. Not only does it disable tree-shaking, it also risks installing duplicate copies of the\n * same package.\n *\n * Example:\n * - @payloadcms/richtext-lexical (in bundle) -> installs qs-esm (bundled because of importer)\n * - payload (not in bundle, external) -> installs qs-esm (external because of importer)\n * Result: we have two copies of qs-esm installed - one in the bundle, and one in node_modules.\n *\n * During development, these bundle size difference do not matter much, and development speed /\n * turbopack support are more important.\n */\n [\n 'payload',\n '@payloadcms/db-mongodb',\n '@payloadcms/db-postgres',\n '@payloadcms/db-sqlite',\n '@payloadcms/db-vercel-postgres',\n '@payloadcms/db-d1-sqlite',\n '@payloadcms/drizzle',\n '@payloadcms/email-nodemailer',\n '@payloadcms/email-resend',\n '@payloadcms/graphql',\n '@payloadcms/payload-cloud',\n '@payloadcms/plugin-redirects',\n // TODO: Add the following packages, excluding their /client subpath exports, once Next.js supports it\n // see: https://github.com/vercel/next.js/discussions/76991\n //'@payloadcms/plugin-cloud-storage',\n //'@payloadcms/plugin-sentry',\n //'@payloadcms/plugin-stripe',\n // @payloadcms/richtext-lexical\n //'@payloadcms/storage-azure',\n //'@payloadcms/storage-gcs',\n //'@payloadcms/storage-s3',\n //'@payloadcms/storage-uploadthing',\n //'@payloadcms/storage-vercel-blob',\n ]\n : []),\n ],\n webpack: (webpackConfig, webpackOptions) => {\n const incomingWebpackConfig =\n typeof nextConfig.webpack === 'function'\n ? nextConfig.webpack(webpackConfig, webpackOptions)\n : webpackConfig\n\n return {\n ...incomingWebpackConfig,\n externals: [\n ...(incomingWebpackConfig?.externals || []),\n /**\n * See the explanation in the serverExternalPackages section above.\n * We need to force Webpack to emit require() calls for these packages, even though they are not\n * resolvable from the project root. You would expect this to error during runtime, but Next.js seems to be able to require these just fine.\n *\n * This is the only way to get Webpack Build to work, without the bundle size caveats of externalizing the\n * entry point packages, as explained in the serverExternalPackages section above.\n */\n 'drizzle-kit',\n 'drizzle-kit/api',\n 'sharp',\n 'libsql',\n 'require-in-the-middle',\n ],\n plugins: [\n ...(incomingWebpackConfig?.plugins || []),\n // Fix cloudflare:sockets error: https://github.com/vercel/next.js/discussions/50177\n new webpackOptions.webpack.IgnorePlugin({\n resourceRegExp: /^pg-native$|^cloudflare:sockets$/,\n }),\n ],\n resolve: {\n ...(incomingWebpackConfig?.resolve || {}),\n alias: {\n ...(incomingWebpackConfig?.resolve?.alias || {}),\n },\n fallback: {\n ...(incomingWebpackConfig?.resolve?.fallback || {}),\n /*\n * This fixes the following warning when running next build with webpack (tested on Next.js 16.0.3 with Payload 3.64.0):\n *\n * ⚠ Compiled with warnings in 8.7s\n *\n * ./node_modules/.pnpm/mongodb@6.16.0/node_modules/mongodb/lib/deps.js\n * Module not found: Can't resolve 'aws4' in '/Users/alessio/Documents/temp/next16p/node_modules/.pnpm/mongodb@6.16.0/node_modules/mongodb/lib'\n *\n * Import trace for requested module:\n * ./node_modules/.pnpm/mongodb@6.16.0/node_modules/mongodb/lib/deps.js\n * ./node_modules/.pnpm/mongodb@6.16.0/node_modules/mongodb/lib/client-side-encryption/client_encryption.js\n * ./node_modules/.pnpm/mongodb@6.16.0/node_modules/mongodb/lib/index.js\n * ./node_modules/.pnpm/mongoose@8.15.1/node_modules/mongoose/lib/index.js\n * ./node_modules/.pnpm/mongoose@8.15.1/node_modules/mongoose/index.js\n * ./node_modules/.pnpm/@payloadcms+db-mongodb@3.64.0_payload@3.64.0_graphql@16.12.0_typescript@5.7.3_/node_modules/@payloadcms/db-mongodb/dist/index.js\n * ./src/payload.config.ts\n * ./src/app/my-route/route.ts\n *\n **/\n aws4: false,\n },\n },\n }\n },\n }\n\n if (nextConfig.basePath) {\n baseConfig.env.NEXT_BASE_PATH = nextConfig.basePath\n }\n\n if (!supportsTurbopackBuild) {\n return withPayloadLegacy(baseConfig)\n } else {\n return {\n ...baseConfig,\n serverExternalPackages: [\n ...(baseConfig.serverExternalPackages || []),\n 'drizzle-kit',\n 'drizzle-kit/api',\n 'sharp',\n 'libsql',\n 'require-in-the-middle',\n // Prevents turbopack build errors by the thread-stream package which is installed by pino\n 'pino',\n ],\n }\n }\n}\n\nexport default withPayload\n", "/* eslint-disable no-console */\n/**\n * This was taken and modified from https://github.com/getsentry/sentry-javascript/blob/15256034ee8150a5b7dcb97d23eca1a5486f0cae/packages/nextjs/src/config/util.ts\n *\n * MIT License\n *\n * Copyright (c) 2012 Functional Software, Inc. dba Sentry\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy of\n * this software and associated documentation files (the \"Software\"), to deal in\n * the Software without restriction, including without limitation the rights to\n * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies\n * of the Software, and to permit persons to whom the Software is furnished to do\n * so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\nimport { readFileSync } from 'fs'\nimport { fileURLToPath } from 'url'\n\nfunction _parseInt(input: string | undefined): number {\n return parseInt(input || '', 10)\n}\n\n/**\n * Represents Semantic Versioning object\n */\ntype SemVer = {\n buildmetadata?: string\n /**\n * undefined if not a canary version\n */\n canaryVersion?: number\n major?: number\n minor?: number\n patch?: number\n prerelease?: string\n}\n\n// https://semver.org/#is-there-a-suggested-regular-expression-regex-to-check-a-semver-string\nconst SEMVER_REGEXP =\n /^(0|[1-9]\\d*)\\.(0|[1-9]\\d*)\\.(0|[1-9]\\d*)(?:-((?:0|[1-9]\\d*|\\d*[a-z-][0-9a-z-]*)(?:\\.(?:0|[1-9]\\d*|\\d*[a-z-][0-9a-z-]*))*))?(?:\\+([0-9a-z-]+(?:\\.[0-9a-z-]+)*))?$/i\n\n/**\n * Parses input into a SemVer interface\n * @param input string representation of a semver version\n */\nexport function parseSemver(input: string): SemVer {\n const match = input.match(SEMVER_REGEXP) || []\n const major = _parseInt(match[1])\n const minor = _parseInt(match[2])\n const patch = _parseInt(match[3])\n\n const prerelease = match[4]\n const canaryVersion = prerelease?.startsWith('canary.')\n ? parseInt(prerelease.split('.')[1] || '0', 10)\n : undefined\n\n return {\n buildmetadata: match[5],\n canaryVersion,\n major: isNaN(major) ? undefined : major,\n minor: isNaN(minor) ? undefined : minor,\n patch: isNaN(patch) ? undefined : patch,\n prerelease: match[4],\n }\n}\n\n/**\n * Returns the version of Next.js installed in the project, or undefined if it cannot be determined.\n */\nexport function getNextjsVersion(): SemVer | undefined {\n try {\n let pkgPath: string\n\n // Check if we're in ESM or CJS environment\n if (typeof import.meta?.resolve === 'function') {\n // ESM environment - use import.meta.resolve\n const pkgUrl = import.meta.resolve('next/package.json')\n // Use fileURLToPath for proper cross-platform path handling (Windows, macOS, Linux)\n // new URL().pathname returns '/C:/path' on Windows which causes path resolution issues\n pkgPath = fileURLToPath(pkgUrl)\n } else {\n // CJS environment - use require.resolve\n pkgPath = require.resolve('next/package.json')\n }\n\n const pkgJson = JSON.parse(readFileSync(pkgPath, 'utf8'))\n return parseSemver(pkgJson.version)\n } catch (e) {\n console.error('Payload: Error getting Next.js version', e)\n return undefined\n }\n}\n\n/**\n * Checks if the current Next.js version supports Turbopack externalize transitive dependencies.\n * This was introduced in Next.js v16.1.0-canary.3\n */\nexport function supportsTurbopackExternalizeTransitiveDependencies(\n version: SemVer | undefined,\n): boolean {\n if (!version) {\n return false\n }\n\n const { canaryVersion, major, minor } = version\n\n if (major === undefined || minor === undefined) {\n return false\n }\n\n if (major > 16) {\n return true\n }\n\n if (major === 16) {\n if (minor > 1) {\n return true\n }\n if (minor === 1) {\n if (canaryVersion !== undefined) {\n // 16.1.0-canary.3+\n return canaryVersion >= 3\n } else {\n // Assume that Next.js 16.1 inherits support for this feature from the canary release\n return true\n }\n }\n }\n\n return false\n}\n", "/* eslint-disable no-console */\nimport type { NextConfig } from 'next'\n\n/**\n * Applies config options required to support Next.js versions before 16.1.0 and 16.1.0-canary.3.\n */\nexport const withPayloadLegacy = (nextConfig: NextConfig = {}): NextConfig => {\n if (process.env.PAYLOAD_PATCH_TURBOPACK_WARNINGS !== 'false') {\n // TODO: This warning is thrown because we cannot externalize the entry-point package for client-s3, so we patch the warning to not show it.\n // We can remove this once Next.js implements https://github.com/vercel/next.js/discussions/76991\n const turbopackWarningText =\n 'Packages that should be external need to be installed in the project directory, so they can be resolved from the output files.\\nTry to install it into the project directory by running'\n\n // TODO 4.0: Remove this once we drop support for Next.js 15.2.x\n const turbopackConfigWarningText = \"Unrecognized key(s) in object: 'turbopack'\"\n\n const consoleWarn = console.warn\n console.warn = (...args) => {\n // Force to disable serverExternalPackages warnings: https://github.com/vercel/next.js/issues/68805\n if (\n (typeof args[1] === 'string' && args[1].includes(turbopackWarningText)) ||\n (typeof args[0] === 'string' && args[0].includes(turbopackWarningText))\n ) {\n return\n }\n\n // Add Payload-specific message after turbopack config warning in Next.js 15.2.x or lower.\n // TODO 4.0: Remove this once we drop support for Next.js 15.2.x\n const hasTurbopackConfigWarning =\n (typeof args[1] === 'string' && args[1].includes(turbopackConfigWarningText)) ||\n (typeof args[0] === 'string' && args[0].includes(turbopackConfigWarningText))\n\n if (hasTurbopackConfigWarning) {\n consoleWarn(...args)\n consoleWarn(\n 'Payload: You can safely ignore the \"Invalid next.config\" warning above. This only occurs on Next.js 15.2.x or lower. We recommend upgrading to the latest supported Next.js version to resolve this warning.',\n )\n return\n }\n\n consoleWarn(...args)\n }\n }\n\n const isBuild = process.env.NODE_ENV === 'production'\n const isTurbopackNextjs15 = process.env.TURBOPACK === '1'\n const isTurbopackNextjs16 = process.env.TURBOPACK === 'auto'\n\n if (isBuild && (isTurbopackNextjs15 || isTurbopackNextjs16)) {\n throw new Error(\n 'Your Next.js and Payload versions do not support using Turbopack for production builds. Please upgrade to Next.js 16.1.0 or, if not yet released, the latest canary release.',\n )\n }\n\n const toReturn: NextConfig = {\n ...nextConfig,\n serverExternalPackages: [\n // serverExternalPackages = webpack.externals, but with turbopack support and an additional check\n // for whether the package is resolvable from the project root\n ...(nextConfig.serverExternalPackages || []),\n // External, because it installs import-in-the-middle and require-in-the-middle - both in the default serverExternalPackages list.\n '@sentry/nextjs',\n ],\n }\n\n return toReturn\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;AC2BA,gBAA6B;AAC7B,iBAA8B;AA5B9B;AA8BA,SAASA,UAAUC,OAAyB;AAC1C,SAAOC,SAASD,SAAS,IAAI,EAAA;AAC/B;AAkBA,IAAME,gBACJ;AAMK,SAASC,YAAYH,OAAa;AACvC,QAAMI,QAAQJ,MAAMI,MAAMF,aAAA,KAAkB,CAAA;AAC5C,QAAMG,QAAQN,UAAUK,MAAM,CAAA,CAAE;AA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AGE;QACHC,WAAW;UAAA,GACLD,uBAAuBC,aAAa,CAAA;;;;;;;;;UASxC;UACA;UACA;UACA;UACA;QAAA;QAEFC,SAAS;UAAA,GACHF,uBAAuBE,WAAW,CAAA;;UAEtC,IAAIH,eAAeF,QAAQM,aAAa;YACtCC,gBAAgB;UAClB,CAAA;QAAA;QAEFC,SAAS;UACP,GAAIL,uBAAuBK,WAAW,CAAC;UACvCC,OAAO;YACL,GAAIN,uBAAuBK,SAASC,SAAS,CAAC;UAChD;UACAC,UAAU;YACR,GAAIP,uBAAuBK,SAASE,YAAY,CAAC;;;;;;;;;;;;;;;;;;;;YAoBjDC,MAAM;UACR;QACF;MACF;IACF;EACF;AAEA,MAAInC,WAAWoC,UAAU;AACvBvB,eAAWP,IAAI+B,iBAAiBrC,WAAWoC;EAC7C;AAEA,MAAI,CAAChC,wBAAwB;AAC3B,WAAOkC,kBAAkBzB,UAAA;EAC3B,OAAO;AACL,WAAO;MACL,GAAGA;MACHO,wBAAwB;QAAA,GAClBP,WAAWO,0BAA0B,CAAA;QACzC;QACA;QACA;QACA;QACA;;QAEA;MAAA;IAEJ;EACF;AACF;AAEA,IAAA,sBAAerB;",
4
+ "sourcesContent": ["/* eslint-disable no-console */\n/* eslint-disable no-restricted-exports */\nimport type { NextConfig } from 'next'\n\nimport {\n getNextjsVersion,\n supportsTurbopackExternalizeTransitiveDependencies,\n} from './withPayload.utils.js'\nimport { withPayloadLegacy } from './withPayloadLegacy.js'\n\nconst poweredByHeader = {\n key: 'X-Powered-By',\n value: 'Next.js, Payload',\n}\n\n/**\n * @param {import('next').NextConfig} nextConfig\n * @param {Object} [options] - Optional configuration options\n * @param {boolean} [options.devBundleServerPackages] - Whether to bundle server packages in development mode. @default false\n * */\nexport const withPayload = (\n nextConfig: NextConfig = {},\n options: { devBundleServerPackages?: boolean } = {},\n): NextConfig => {\n const nextjsVersion = getNextjsVersion()\n\n const supportsTurbopackBuild = supportsTurbopackExternalizeTransitiveDependencies(nextjsVersion)\n\n const env = nextConfig.env || {}\n\n if (nextConfig.experimental?.staleTimes?.dynamic) {\n console.warn(\n 'Payload detected a non-zero value for the `staleTimes.dynamic` option in your Next.js config. This will slow down page transitions and may cause stale data to load within the Admin panel. To clear this warning, remove the `staleTimes.dynamic` option from your Next.js config or set it to 0. In the future, Next.js may support scoping this option to specific routes.',\n )\n env.NEXT_PUBLIC_ENABLE_ROUTER_CACHE_REFRESH = 'true'\n }\n\n const baseConfig: NextConfig = {\n ...nextConfig,\n env,\n outputFileTracingExcludes: {\n ...(nextConfig.outputFileTracingExcludes || {}),\n '**/*': [\n ...(nextConfig.outputFileTracingExcludes?.['**/*'] || []),\n 'drizzle-kit',\n 'drizzle-kit/api',\n ],\n },\n outputFileTracingIncludes: {\n ...(nextConfig.outputFileTracingIncludes || {}),\n '**/*': [...(nextConfig.outputFileTracingIncludes?.['**/*'] || []), '@libsql/client'],\n },\n turbopack: {\n ...(nextConfig.turbopack || {}),\n },\n // We disable the poweredByHeader here because we add it manually in the headers function below\n ...(nextConfig.poweredByHeader !== false ? { poweredByHeader: false } : {}),\n headers: async () => {\n const headersFromConfig = 'headers' in nextConfig ? await nextConfig.headers() : []\n\n return [\n ...(headersFromConfig || []),\n {\n headers: [\n {\n key: 'Accept-CH',\n value: 'Sec-CH-Prefers-Color-Scheme',\n },\n {\n key: 'Vary',\n value: 'Sec-CH-Prefers-Color-Scheme',\n },\n {\n key: 'Critical-CH',\n value: 'Sec-CH-Prefers-Color-Scheme',\n },\n ...(nextConfig.poweredByHeader !== false ? [poweredByHeader] : []),\n ],\n source: '/:path*',\n },\n ]\n },\n serverExternalPackages: [\n ...(nextConfig.serverExternalPackages || []),\n // WHY: without externalizing graphql, a graphql version error will be thrown\n // during runtime (\"Ensure that there is only one instance of \\\"graphql\\\" in the node_modules\\ndirectory.\")\n 'graphql',\n ...(process.env.NODE_ENV === 'development' && options.devBundleServerPackages !== true\n ? /**\n * Unless explicitly disabled by the user, by passing `devBundleServerPackages: true` to withPayload, we\n * do not bundle server-only packages during dev for two reasons:\n *\n * 1. Performance: Fewer files to compile means faster compilation speeds.\n * 2. Turbopack support: Webpack's externals are not supported by Turbopack.\n *\n * Regarding Turbopack support: Unlike webpack.externals, we cannot use serverExternalPackages to\n * externalized packages that are not resolvable from the project root. So including a package like\n * \"drizzle-kit\" in here would do nothing - Next.js will ignore the rule and still bundle the package -\n * because it detects that the package is not resolvable from the project root (= not directly installed\n * by the user in their own package.json).\n *\n * Instead, we can use serverExternalPackages for the entry-point packages that *are* installed directly\n * by the user (e.g. db-postgres, which then installs drizzle-kit as a dependency).\n *\n *\n *\n * We should only do this during development, not build, because externalizing these packages can hurt\n * the bundle size. Not only does it disable tree-shaking, it also risks installing duplicate copies of the\n * same package.\n *\n * Example:\n * - @payloadcms/richtext-lexical (in bundle) -> installs qs-esm (bundled because of importer)\n * - payload (not in bundle, external) -> installs qs-esm (external because of importer)\n * Result: we have two copies of qs-esm installed - one in the bundle, and one in node_modules.\n *\n * During development, these bundle size difference do not matter much, and development speed /\n * turbopack support are more important.\n */\n [\n 'payload',\n '@payloadcms/db-mongodb',\n '@payloadcms/db-postgres',\n '@payloadcms/db-sqlite',\n '@payloadcms/db-vercel-postgres',\n '@payloadcms/db-d1-sqlite',\n '@payloadcms/drizzle',\n '@payloadcms/email-nodemailer',\n '@payloadcms/email-resend',\n '@payloadcms/graphql',\n '@payloadcms/payload-cloud',\n '@payloadcms/plugin-redirects',\n // TODO: Add the following packages, excluding their /client subpath exports, once Next.js supports it\n // see: https://github.com/vercel/next.js/discussions/76991\n //'@payloadcms/plugin-cloud-storage',\n //'@payloadcms/plugin-sentry',\n //'@payloadcms/plugin-stripe',\n // @payloadcms/richtext-lexical\n //'@payloadcms/storage-azure',\n //'@payloadcms/storage-gcs',\n //'@payloadcms/storage-s3',\n //'@payloadcms/storage-uploadthing',\n //'@payloadcms/storage-vercel-blob',\n ]\n : []),\n ],\n webpack: (webpackConfig, webpackOptions) => {\n const incomingWebpackConfig =\n typeof nextConfig.webpack === 'function'\n ? nextConfig.webpack(webpackConfig, webpackOptions)\n : webpackConfig\n\n return {\n ...incomingWebpackConfig,\n externals: [\n ...(incomingWebpackConfig?.externals || []),\n /**\n * See the explanation in the serverExternalPackages section above.\n * We need to force Webpack to emit require() calls for these packages, even though they are not\n * resolvable from the project root. You would expect this to error during runtime, but Next.js seems to be able to require these just fine.\n *\n * This is the only way to get Webpack Build to work, without the bundle size caveats of externalizing the\n * entry point packages, as explained in the serverExternalPackages section above.\n */\n 'drizzle-kit',\n 'drizzle-kit/api',\n 'sharp',\n 'libsql',\n 'require-in-the-middle',\n ],\n plugins: [\n ...(incomingWebpackConfig?.plugins || []),\n // Fix cloudflare:sockets error: https://github.com/vercel/next.js/discussions/50177\n new webpackOptions.webpack.IgnorePlugin({\n resourceRegExp: /^pg-native$|^cloudflare:sockets$/,\n }),\n ],\n resolve: {\n ...(incomingWebpackConfig?.resolve || {}),\n alias: {\n ...(incomingWebpackConfig?.resolve?.alias || {}),\n },\n fallback: {\n ...(incomingWebpackConfig?.resolve?.fallback || {}),\n /*\n * This fixes the following warning when running next build with webpack (tested on Next.js 16.0.3 with Payload 3.64.0):\n *\n * ⚠ Compiled with warnings in 8.7s\n *\n * ./node_modules/.pnpm/mongodb@6.16.0/node_modules/mongodb/lib/deps.js\n * Module not found: Can't resolve 'aws4' in '/Users/alessio/Documents/temp/next16p/node_modules/.pnpm/mongodb@6.16.0/node_modules/mongodb/lib'\n *\n * Import trace for requested module:\n * ./node_modules/.pnpm/mongodb@6.16.0/node_modules/mongodb/lib/deps.js\n * ./node_modules/.pnpm/mongodb@6.16.0/node_modules/mongodb/lib/client-side-encryption/client_encryption.js\n * ./node_modules/.pnpm/mongodb@6.16.0/node_modules/mongodb/lib/index.js\n * ./node_modules/.pnpm/mongoose@8.15.1/node_modules/mongoose/lib/index.js\n * ./node_modules/.pnpm/mongoose@8.15.1/node_modules/mongoose/index.js\n * ./node_modules/.pnpm/@payloadcms+db-mongodb@3.64.0_payload@3.64.0_graphql@16.12.0_typescript@5.7.3_/node_modules/@payloadcms/db-mongodb/dist/index.js\n * ./src/payload.config.ts\n * ./src/app/my-route/route.ts\n *\n **/\n aws4: false,\n },\n },\n }\n },\n }\n\n if (nextConfig.basePath) {\n baseConfig.env.NEXT_BASE_PATH = nextConfig.basePath\n }\n\n if (!supportsTurbopackBuild) {\n return withPayloadLegacy(baseConfig)\n } else {\n return {\n ...baseConfig,\n serverExternalPackages: [\n ...(baseConfig.serverExternalPackages || []),\n 'drizzle-kit',\n 'drizzle-kit/api',\n 'sharp',\n 'libsql',\n 'require-in-the-middle',\n // Prevents turbopack build errors by the thread-stream package which is installed by pino\n 'pino',\n ],\n }\n }\n}\n\nexport default withPayload\n", "/* eslint-disable no-console */\n/**\n * This was taken and modified from https://github.com/getsentry/sentry-javascript/blob/15256034ee8150a5b7dcb97d23eca1a5486f0cae/packages/nextjs/src/config/util.ts\n *\n * MIT License\n *\n * Copyright (c) 2012 Functional Software, Inc. dba Sentry\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy of\n * this software and associated documentation files (the \"Software\"), to deal in\n * the Software without restriction, including without limitation the rights to\n * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies\n * of the Software, and to permit persons to whom the Software is furnished to do\n * so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\nimport { readFileSync } from 'fs'\nimport { fileURLToPath } from 'url'\n\nfunction _parseInt(input: string | undefined): number {\n return parseInt(input || '', 10)\n}\n\n/**\n * Represents Semantic Versioning object\n */\ntype SemVer = {\n buildmetadata?: string\n /**\n * undefined if not a canary version\n */\n canaryVersion?: number\n major?: number\n minor?: number\n patch?: number\n prerelease?: string\n}\n\n// https://semver.org/#is-there-a-suggested-regular-expression-regex-to-check-a-semver-string\nconst SEMVER_REGEXP =\n /^(0|[1-9]\\d*)\\.(0|[1-9]\\d*)\\.(0|[1-9]\\d*)(?:-((?:0|[1-9]\\d*|\\d*[a-z-][0-9a-z-]*)(?:\\.(?:0|[1-9]\\d*|\\d*[a-z-][0-9a-z-]*))*))?(?:\\+([0-9a-z-]+(?:\\.[0-9a-z-]+)*))?$/i\n\n/**\n * Parses input into a SemVer interface\n * @param input string representation of a semver version\n */\nexport function parseSemver(input: string): SemVer {\n const match = input.match(SEMVER_REGEXP) || []\n const major = _parseInt(match[1])\n const minor = _parseInt(match[2])\n const patch = _parseInt(match[3])\n\n const prerelease = match[4]\n const canaryVersion = prerelease?.startsWith('canary.')\n ? parseInt(prerelease.split('.')[1] || '0', 10)\n : undefined\n\n return {\n buildmetadata: match[5],\n canaryVersion,\n major: isNaN(major) ? undefined : major,\n minor: isNaN(minor) ? undefined : minor,\n patch: isNaN(patch) ? undefined : patch,\n prerelease: match[4],\n }\n}\n\n/**\n * Returns the version of Next.js installed in the project, or undefined if it cannot be determined.\n */\nexport function getNextjsVersion(): SemVer | undefined {\n try {\n let pkgPath: string\n\n // Check if we're in ESM or CJS environment\n if (typeof import.meta?.resolve === 'function') {\n // ESM environment - use import.meta.resolve\n const pkgUrl = import.meta.resolve('next/package.json')\n // Use fileURLToPath for proper cross-platform path handling (Windows, macOS, Linux)\n // new URL().pathname returns '/C:/path' on Windows which causes path resolution issues\n pkgPath = fileURLToPath(pkgUrl)\n } else {\n // CJS environment - use require.resolve\n pkgPath = require.resolve('next/package.json')\n }\n\n const pkgJson = JSON.parse(readFileSync(pkgPath, 'utf8'))\n return parseSemver(pkgJson.version)\n } catch (e) {\n console.error('Payload: Error getting Next.js version', e)\n return undefined\n }\n}\n\n/**\n * Checks if the current Next.js version supports Turbopack externalize transitive dependencies.\n * This was introduced in Next.js v16.1.0-canary.3\n */\nexport function supportsTurbopackExternalizeTransitiveDependencies(\n version: SemVer | undefined,\n): boolean {\n if (!version) {\n return false\n }\n\n const { canaryVersion, major, minor } = version\n\n if (major === undefined || minor === undefined) {\n return false\n }\n\n if (major > 16) {\n return true\n }\n\n if (major === 16) {\n if (minor > 1) {\n return true\n }\n if (minor === 1) {\n if (canaryVersion !== undefined) {\n // 16.1.0-canary.3+\n return canaryVersion >= 3\n } else {\n // Assume that Next.js 16.1 inherits support for this feature from the canary release\n return true\n }\n }\n }\n\n return false\n}\n", "/* eslint-disable no-console */\nimport type { NextConfig } from 'next'\n\n/**\n * Applies config options required to support Next.js versions before 16.1.0 and 16.1.0-canary.3.\n */\nexport const withPayloadLegacy = (nextConfig: NextConfig = {}): NextConfig => {\n if (process.env.PAYLOAD_PATCH_TURBOPACK_WARNINGS !== 'false') {\n // TODO: This warning is thrown because we cannot externalize the entry-point package for client-s3, so we patch the warning to not show it.\n // We can remove this once Next.js implements https://github.com/vercel/next.js/discussions/76991\n const turbopackWarningText =\n 'Packages that should be external need to be installed in the project directory, so they can be resolved from the output files.\\nTry to install it into the project directory by running'\n\n // TODO 4.0: Remove this once we drop support for Next.js 15.2.x\n const turbopackConfigWarningText = \"Unrecognized key(s) in object: 'turbopack'\"\n\n const consoleWarn = console.warn\n console.warn = (...args) => {\n // Force to disable serverExternalPackages warnings: https://github.com/vercel/next.js/issues/68805\n if (\n (typeof args[1] === 'string' && args[1].includes(turbopackWarningText)) ||\n (typeof args[0] === 'string' && args[0].includes(turbopackWarningText))\n ) {\n return\n }\n\n // Add Payload-specific message after turbopack config warning in Next.js 15.2.x or lower.\n // TODO 4.0: Remove this once we drop support for Next.js 15.2.x\n const hasTurbopackConfigWarning =\n (typeof args[1] === 'string' && args[1].includes(turbopackConfigWarningText)) ||\n (typeof args[0] === 'string' && args[0].includes(turbopackConfigWarningText))\n\n if (hasTurbopackConfigWarning) {\n consoleWarn(...args)\n consoleWarn(\n 'Payload: You can safely ignore the \"Invalid next.config\" warning above. This only occurs on Next.js 15.2.x or lower. We recommend upgrading to the latest supported Next.js version to resolve this warning.',\n )\n return\n }\n\n consoleWarn(...args)\n }\n }\n\n const isBuild = process.env.NODE_ENV === 'production'\n const isTurbopackNextjs15 = process.env.TURBOPACK === '1'\n const isTurbopackNextjs16 = process.env.TURBOPACK === 'auto'\n\n if (isBuild && (isTurbopackNextjs15 || isTurbopackNextjs16)) {\n throw new Error(\n 'Your Next.js and Payload versions do not support using Turbopack for production builds. Please upgrade to Next.js 16.1.0 or, if not yet released, the latest canary release.',\n )\n }\n\n const toReturn: NextConfig = {\n ...nextConfig,\n serverExternalPackages: [\n // serverExternalPackages = webpack.externals, but with turbopack support and an additional check\n // for whether the package is resolvable from the project root\n ...(nextConfig.serverExternalPackages || []),\n // External, because it installs import-in-the-middle and require-in-the-middle - both in the default serverExternalPackages list.\n '@sentry/nextjs',\n ],\n }\n\n return toReturn\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;AC2BA,gBAA6B;AAC7B,iBAA8B;AA5B9B;AA8BA,SAASA,UAAUC,OAAyB;AAC1C,SAAOC,SAASD,SAAS,IAAI,EAAA;AAC/B;AAkBA,IAAME,gBACJ;AAMK,SAASC,YAAYH,OAAa;AACvC,QAAMI,QAAQJ,MAAMI,MAAMF,aAAA,KAAkB,CAAA;AAC5C,QAAMG,QAAQN,UAAUK,MAAM,CAAA,CAAE;AAChC,QAAME,QAAQP,UAAUK,MAAM,CAAA,CAAE;AAChC,QAAMG,QAAQR,UAAUK,MAAM,CAAA,CAAE;AAEhC,QAAMI,aAAaJ,MAAM,CAAA;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QAAA;QAEFC,SAAS;UAAA,GACHF,uBAAuBE,WAAW,CAAA;;UAEtC,IAAIH,eAAeF,QAAQM,aAAa;YACtCC,gBAAgB;UAClB,CAAA;QAAA;QAEFC,SAAS;UACP,GAAIL,uBAAuBK,WAAW,CAAC;UACvCC,OAAO;YACL,GAAIN,uBAAuBK,SAASC,SAAS,CAAC;UAChD;UACAC,UAAU;YACR,GAAIP,uBAAuBK,SAASE,YAAY,CAAC;;;;;;;;;;;;;;;;;;;;YAoBjDC,MAAM;UACR;QACF;MACF;IACF;EACF;AAEA,MAAInC,WAAWoC,UAAU;AACvBvB,eAAWP,IAAI+B,iBAAiBrC,WAAWoC;EAC7C;AAEA,MAAI,CAAChC,wBAAwB;AAC3B,WAAOkC,kBAAkBzB,UAAA;EAC3B,OAAO;AACL,WAAO;MACL,GAAGA;MACHO,wBAAwB;QAAA,GAClBP,WAAWO,0BAA0B,CAAA;QACzC;QACA;QACA;QACA;QACA;;QAEA;MAAA;IAEJ;EACF;AACF;AAEA,IAAA,sBAAerB;",
6
6
  "names": ["_parseInt", "input", "parseInt", "SEMVER_REGEXP", "parseSemver", "match", "major", "minor", "patch", "prerelease", "canaryVersion", "startsWith", "split", "undefined", "buildmetadata", "isNaN", "getNextjsVersion", "pkgPath", "import", "resolve", "pkgUrl", "fileURLToPath", "require", "pkgJson", "JSON", "parse", "readFileSync", "version", "e", "console", "error", "supportsTurbopackExternalizeTransitiveDependencies", "withPayloadLegacy", "nextConfig", "process", "env", "PAYLOAD_PATCH_TURBOPACK_WARNINGS", "turbopackWarningText", "turbopackConfigWarningText", "consoleWarn", "console", "warn", "args", "includes", "hasTurbopackConfigWarning", "isBuild", "NODE_ENV", "isTurbopackNextjs15", "TURBOPACK", "isTurbopackNextjs16", "Error", "toReturn", "serverExternalPackages", "poweredByHeader", "key", "value", "withPayload", "nextConfig", "options", "nextjsVersion", "getNextjsVersion", "supportsTurbopackBuild", "supportsTurbopackExternalizeTransitiveDependencies", "env", "experimental", "staleTimes", "dynamic", "console", "warn", "NEXT_PUBLIC_ENABLE_ROUTER_CACHE_REFRESH", "baseConfig", "outputFileTracingExcludes", "outputFileTracingIncludes", "turbopack", "headers", "headersFromConfig", "source", "serverExternalPackages", "process", "NODE_ENV", "devBundleServerPackages", "webpack", "webpackConfig", "webpackOptions", "incomingWebpackConfig", "externals", "plugins", "IgnorePlugin", "resourceRegExp", "resolve", "alias", "fallback", "aws4", "basePath", "NEXT_BASE_PATH", "withPayloadLegacy"]
7
7
  }
@@ -1 +1 @@
1
- {"version":3,"file":"TabLink.d.ts","sourceRoot":"","sources":["../../../../../src/elements/DocumentHeader/Tabs/Tab/TabLink.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAA;AAK9C,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,eAAO,MAAM,eAAe,EAAE,KAAK,CAAC,EAAE,CAAC;IACrC,UAAU,EAAE,eAAe,CAAC,QAAQ,CAAC,CAAC,OAAO,CAAC,CAAA;IAC9C,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,SAAS,EAAE,MAAM,CAAA;IACjB,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;IAC1B,IAAI,EAAE,MAAM,CAAA;IACZ,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,MAAM,CAAC,EAAE,OAAO,CAAA;CACjB,CAwDA,CAAA"}
1
+ {"version":3,"file":"TabLink.d.ts","sourceRoot":"","sources":["../../../../../src/elements/DocumentHeader/Tabs/Tab/TabLink.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAA;AAK9C,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,eAAO,MAAM,eAAe,EAAE,KAAK,CAAC,EAAE,CAAC;IACrC,UAAU,EAAE,eAAe,CAAC,QAAQ,CAAC,CAAC,OAAO,CAAC,CAAA;IAC9C,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,SAAS,EAAE,MAAM,CAAA;IACjB,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;IAC1B,IAAI,EAAE,MAAM,CAAA;IACZ,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,MAAM,CAAC,EAAE,OAAO,CAAA;CACjB,CA0DA,CAAA"}
@@ -2,12 +2,12 @@
2
2
 
3
3
  import { c as _c } from "react/compiler-runtime";
4
4
  import { jsx as _jsx } from "react/jsx-runtime";
5
- import { Button } from '@payloadcms/ui';
5
+ import { Button, useConfig } from '@payloadcms/ui';
6
6
  import { useParams, usePathname, useSearchParams } from 'next/navigation.js';
7
7
  import { formatAdminURL } from 'payload/shared';
8
8
  import React from 'react';
9
9
  export const DocumentTabLink = t0 => {
10
- const $ = _c(13);
10
+ const $ = _c(14);
11
11
  const {
12
12
  adminRoute,
13
13
  ariaLabel,
@@ -19,22 +19,27 @@ export const DocumentTabLink = t0 => {
19
19
  } = t0;
20
20
  const pathname = usePathname();
21
21
  const params = useParams();
22
+ const {
23
+ config
24
+ } = useConfig();
22
25
  const searchParams = useSearchParams();
23
26
  const locale = searchParams.get("locale");
24
27
  const [entityType, entitySlug, segmentThree, segmentFour] = params.segments || [];
25
28
  const isCollection = entityType === "collections";
26
29
  const t1 = `/${isCollection ? "collections" : "globals"}/${entitySlug}`;
27
30
  let t2;
28
- if ($[0] !== adminRoute || $[1] !== t1) {
31
+ if ($[0] !== adminRoute || $[1] !== config.serverURL || $[2] !== t1) {
29
32
  t2 = formatAdminURL({
30
33
  adminRoute,
31
- path: t1
34
+ path: t1,
35
+ serverURL: config.serverURL
32
36
  });
33
37
  $[0] = adminRoute;
34
- $[1] = t1;
35
- $[2] = t2;
38
+ $[1] = config.serverURL;
39
+ $[2] = t1;
40
+ $[3] = t2;
36
41
  } else {
37
- t2 = $[2];
42
+ t2 = $[3];
38
43
  }
39
44
  let docPath = t2;
40
45
  if (isCollection) {
@@ -49,7 +54,7 @@ export const DocumentTabLink = t0 => {
49
54
  const href = `${docPath}${hrefFromProps}`;
50
55
  const hrefWithLocale = `${href}${locale ? `?locale=${locale}` : ""}`;
51
56
  let t3;
52
- if ($[3] !== ariaLabel || $[4] !== baseClass || $[5] !== children || $[6] !== docPath || $[7] !== href || $[8] !== hrefWithLocale || $[9] !== isActiveFromProps || $[10] !== newTab || $[11] !== pathname) {
57
+ if ($[4] !== ariaLabel || $[5] !== baseClass || $[6] !== children || $[7] !== docPath || $[8] !== href || $[9] !== hrefWithLocale || $[10] !== isActiveFromProps || $[11] !== newTab || $[12] !== pathname) {
53
58
  const isActive = href === docPath && pathname === docPath || href !== docPath && pathname.startsWith(href) || isActiveFromProps;
54
59
  t3 = _jsx(Button, {
55
60
  "aria-label": ariaLabel,
@@ -63,18 +68,18 @@ export const DocumentTabLink = t0 => {
63
68
  to: !isActive || href !== pathname ? hrefWithLocale : undefined,
64
69
  children
65
70
  });
66
- $[3] = ariaLabel;
67
- $[4] = baseClass;
68
- $[5] = children;
69
- $[6] = docPath;
70
- $[7] = href;
71
- $[8] = hrefWithLocale;
72
- $[9] = isActiveFromProps;
73
- $[10] = newTab;
74
- $[11] = pathname;
75
- $[12] = t3;
71
+ $[4] = ariaLabel;
72
+ $[5] = baseClass;
73
+ $[6] = children;
74
+ $[7] = docPath;
75
+ $[8] = href;
76
+ $[9] = hrefWithLocale;
77
+ $[10] = isActiveFromProps;
78
+ $[11] = newTab;
79
+ $[12] = pathname;
80
+ $[13] = t3;
76
81
  } else {
77
- t3 = $[12];
82
+ t3 = $[13];
78
83
  }
79
84
  return t3;
80
85
  };
@@ -1 +1 @@
1
- {"version":3,"file":"TabLink.js","names":["c","_c","Button","useParams","usePathname","useSearchParams","formatAdminURL","React","DocumentTabLink","t0","$","adminRoute","ariaLabel","baseClass","children","href","hrefFromProps","isActive","isActiveFromProps","newTab","pathname","params","searchParams","locale","get","entityType","entitySlug","segmentThree","segmentFour","segments","isCollection","t1","t2","path","docPath","hrefWithLocale","t3","startsWith","_jsx","buttonStyle","className","filter","Boolean","join","disabled","el","margin","size","to","undefined"],"sources":["../../../../../src/elements/DocumentHeader/Tabs/Tab/TabLink.tsx"],"sourcesContent":["'use client'\nimport type { SanitizedConfig } from 'payload'\n\nimport { Button } from '@payloadcms/ui'\nimport { useParams, usePathname, useSearchParams } from 'next/navigation.js'\nimport { formatAdminURL } from 'payload/shared'\nimport React from 'react'\n\nexport const DocumentTabLink: React.FC<{\n adminRoute: SanitizedConfig['routes']['admin']\n ariaLabel?: string\n baseClass: string\n children?: React.ReactNode\n href: string\n isActive?: boolean\n newTab?: boolean\n}> = ({\n adminRoute,\n ariaLabel,\n baseClass,\n children,\n href: hrefFromProps,\n isActive: isActiveFromProps,\n newTab,\n}) => {\n const pathname = usePathname()\n const params = useParams()\n\n const searchParams = useSearchParams()\n\n const locale = searchParams.get('locale')\n\n const [entityType, entitySlug, segmentThree, segmentFour, ...rest] = params.segments || []\n const isCollection = entityType === 'collections'\n\n let docPath = formatAdminURL({\n adminRoute,\n path: `/${isCollection ? 'collections' : 'globals'}/${entitySlug}`,\n })\n\n if (isCollection) {\n if (segmentThree === 'trash' && segmentFour) {\n docPath += `/trash/${segmentFour}`\n } else if (segmentThree) {\n docPath += `/${segmentThree}`\n }\n }\n\n const href = `${docPath}${hrefFromProps}`\n // separated the two so it doesn't break checks against pathname\n const hrefWithLocale = `${href}${locale ? `?locale=${locale}` : ''}`\n\n const isActive =\n (href === docPath && pathname === docPath) ||\n (href !== docPath && pathname.startsWith(href)) ||\n isActiveFromProps\n\n return (\n <Button\n aria-label={ariaLabel}\n buttonStyle=\"tab\"\n className={[baseClass, isActive && `${baseClass}--active`].filter(Boolean).join(' ')}\n disabled={isActive}\n el={!isActive || href !== pathname ? 'link' : 'div'}\n margin={false}\n newTab={newTab}\n size=\"medium\"\n to={!isActive || href !== pathname ? hrefWithLocale : undefined}\n >\n {children}\n </Button>\n )\n}\n"],"mappings":"AAAA;;AAAA,SAAAA,CAAA,IAAAC,EAAA;;AAGA,SAASC,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,GAAGmB,OAAA,GAAUlB,aAAA,EAAe;EAEzC,MAAAmB,cAAA,GAAuB,GAAGpB,IAAA,GAAOQ,MAAA,GAAS,WAAWA,MAAA,EAAQ,GAAG,IAAI;EAAA,IAAAa,EAAA;EAAA,IAAA1B,CAAA,QAAAE,SAAA,IAAAF,CAAA,QAAAG,SAAA,IAAAH,CAAA,QAAAI,QAAA,IAAAJ,CAAA,QAAAwB,OAAA,IAAAxB,CAAA,QAAAK,IAAA,IAAAL,CAAA,QAAAyB,cAAA,IAAAzB,CAAA,QAAAQ,iBAAA,IAAAR,CAAA,SAAAS,MAAA,IAAAT,CAAA,SAAAU,QAAA;IAEpE,MAAAH,QAAA,GACEF,IAAC,KAASmB,OAAA,IAAWd,QAAA,KAAac,OAAA,IACjCnB,IAAA,KAASmB,OAAA,IAAWd,QAAA,CAAAiB,UAAA,CAAoBtB,IAAA,KACzCG,iBAAA;IAGAkB,EAAA,GAAAE,IAAA,CAAApC,MAAA;MAAA,cACcU,SAAA;MAAA2B,WAAA,EACA;MAAAC,SAAA,EACD,CAAC3B,SAAA,EAAWI,QAAA,IAAY,GAAGJ,SAAA,UAAmB,EAAA4B,MAAA,CAAAC,OAAS,EAAAC,IAAA,CAAc;MAAAC,QAAA,EACtE3B,QAAA;MAAA4B,EAAA,EACN,CAAC5B,QAAA,IAAYF,IAAA,KAASK,QAAA,GAAW,SAAS;MAAA0B,MAAA;MAAA3B,MAAA;MAAA4B,IAAA,EAGzC;MAAAC,EAAA,EACD,CAAC/B,QAAA,IAAYF,IAAA,KAASK,QAAA,GAAWe,cAAA,GAAAc,SAAiB;MAAAnC;IAAA,C;;;;;;;;;;;;;;SATxDsB,E;CAcJ","ignoreList":[]}
1
+ {"version":3,"file":"TabLink.js","names":["c","_c","Button","useConfig","useParams","usePathname","useSearchParams","formatAdminURL","React","DocumentTabLink","t0","$","adminRoute","ariaLabel","baseClass","children","href","hrefFromProps","isActive","isActiveFromProps","newTab","pathname","params","config","searchParams","locale","get","entityType","entitySlug","segmentThree","segmentFour","segments","isCollection","t1","t2","serverURL","path","docPath","hrefWithLocale","t3","startsWith","_jsx","buttonStyle","className","filter","Boolean","join","disabled","el","margin","size","to","undefined"],"sources":["../../../../../src/elements/DocumentHeader/Tabs/Tab/TabLink.tsx"],"sourcesContent":["'use client'\nimport type { SanitizedConfig } from 'payload'\n\nimport { Button, useConfig } from '@payloadcms/ui'\nimport { useParams, usePathname, useSearchParams } from 'next/navigation.js'\nimport { formatAdminURL } from 'payload/shared'\nimport React from 'react'\n\nexport const DocumentTabLink: React.FC<{\n adminRoute: SanitizedConfig['routes']['admin']\n ariaLabel?: string\n baseClass: string\n children?: React.ReactNode\n href: string\n isActive?: boolean\n newTab?: boolean\n}> = ({\n adminRoute,\n ariaLabel,\n baseClass,\n children,\n href: hrefFromProps,\n isActive: isActiveFromProps,\n newTab,\n}) => {\n const pathname = usePathname()\n const params = useParams()\n const { config } = useConfig()\n\n const searchParams = useSearchParams()\n\n const locale = searchParams.get('locale')\n\n const [entityType, entitySlug, segmentThree, segmentFour, ...rest] = params.segments || []\n const isCollection = entityType === 'collections'\n\n let docPath = formatAdminURL({\n adminRoute,\n path: `/${isCollection ? 'collections' : 'globals'}/${entitySlug}`,\n serverURL: config.serverURL,\n })\n\n if (isCollection) {\n if (segmentThree === 'trash' && segmentFour) {\n docPath += `/trash/${segmentFour}`\n } else if (segmentThree) {\n docPath += `/${segmentThree}`\n }\n }\n\n const href = `${docPath}${hrefFromProps}`\n // separated the two so it doesn't break checks against pathname\n const hrefWithLocale = `${href}${locale ? `?locale=${locale}` : ''}`\n\n const isActive =\n (href === docPath && pathname === docPath) ||\n (href !== docPath && pathname.startsWith(href)) ||\n isActiveFromProps\n\n return (\n <Button\n aria-label={ariaLabel}\n buttonStyle=\"tab\"\n className={[baseClass, isActive && `${baseClass}--active`].filter(Boolean).join(' ')}\n disabled={isActive}\n el={!isActive || href !== pathname ? 'link' : 'div'}\n margin={false}\n newTab={newTab}\n size=\"medium\"\n to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AA,IAAYF,IAAA,KAASK,QAAA,GAAWiB,cAAA,GAAAc,SAAiB;MAAArC;IAAA,C;;;;;;;;;;;;;;SATxDwB,E;CAcJ","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"index.client.d.ts","sourceRoot":"","sources":["../../../src/elements/Nav/index.client.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAA;AAC1D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAA;AAO7C,OAAO,KAAmB,MAAM,OAAO,CAAA;AAIvC;;GAEG;AACH,eAAO,MAAM,gBAAgB,EAAE,KAAK,CAAC,EAAE,CAAC;IACtC,MAAM,EAAE,UAAU,CAAC,OAAO,aAAa,CAAC,CAAA;IACxC,cAAc,EAAE,cAAc,CAAA;CAC/B,CAwEA,CAAA"}
1
+ {"version":3,"file":"index.client.d.ts","sourceRoot":"","sources":["../../../src/elements/Nav/index.client.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAA;AAC1D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAA;AAO7C,OAAO,KAAmB,MAAM,OAAO,CAAA;AAIvC;;GAEG;AACH,eAAO,MAAM,gBAAgB,EAAE,KAAK,CAAC,EAAE,CAAC;IACtC,MAAM,EAAE,UAAU,CAAC,OAAO,aAAa,CAAC,CAAA;IACxC,cAAc,EAAE,cAAc,CAAA;CAC/B,CA0EA,CAAA"}
@@ -13,7 +13,7 @@ const baseClass = 'nav';
13
13
  * @internal
14
14
  */
15
15
  export const DefaultNavClient = t0 => {
16
- const $ = _c(13);
16
+ const $ = _c(15);
17
17
  const {
18
18
  groups,
19
19
  navPreferences
@@ -25,7 +25,8 @@ export const DefaultNavClient = t0 => {
25
25
  const {
26
26
  admin: t2,
27
27
  folders,
28
- routes: t3
28
+ routes: t3,
29
+ serverURL
29
30
  } = t1;
30
31
  const {
31
32
  routes: t4
@@ -40,14 +41,15 @@ export const DefaultNavClient = t0 => {
40
41
  i18n
41
42
  } = useTranslation();
42
43
  let t5;
43
- if ($[0] !== adminRoute || $[1] !== folders || $[2] !== foldersRoute || $[3] !== groups || $[4] !== i18n || $[5] !== navPreferences?.groups || $[6] !== pathname) {
44
+ if ($[0] !== adminRoute || $[1] !== folders || $[2] !== foldersRoute || $[3] !== groups || $[4] !== i18n || $[5] !== navPreferences?.groups || $[6] !== pathname || $[7] !== serverURL) {
44
45
  const folderURL = formatAdminURL({
45
46
  adminRoute,
46
- path: foldersRoute
47
+ path: foldersRoute,
48
+ serverURL
47
49
  });
48
50
  const viewingRootFolderView = pathname.startsWith(folderURL);
49
51
  let t6;
50
- if ($[8] !== adminRoute || $[9] !== i18n || $[10] !== navPreferences?.groups || $[11] !== pathname) {
52
+ if ($[9] !== adminRoute || $[10] !== i18n || $[11] !== navPreferences?.groups || $[12] !== pathname || $[13] !== serverURL) {
51
53
  t6 = (t7, key) => {
52
54
  const {
53
55
  entities,
@@ -67,14 +69,16 @@ export const DefaultNavClient = t0 => {
67
69
  if (type === EntityType.collection) {
68
70
  href = formatAdminURL({
69
71
  adminRoute,
70
- path: `/collections/${slug}`
72
+ path: `/collections/${slug}`,
73
+ serverURL
71
74
  });
72
75
  id = `nav-${slug}`;
73
76
  }
74
77
  if (type === EntityType.global) {
75
78
  href = formatAdminURL({
76
79
  adminRoute,
77
- path: `/globals/${slug}`
80
+ path: `/globals/${slug}`,
81
+ serverURL
78
82
  });
79
83
  id = `nav-global-${slug}`;
80
84
  }
@@ -104,13 +108,14 @@ export const DefaultNavClient = t0 => {
104
108
  })
105
109
  }, key);
106
110
  };
107
- $[8] = adminRoute;
108
- $[9] = i18n;
109
- $[10] = navPreferences?.groups;
110
- $[11] = pathname;
111
- $[12] = t6;
111
+ $[9] = adminRoute;
112
+ $[10] = i18n;
113
+ $[11] = navPreferences?.groups;
114
+ $[12] = pathname;
115
+ $[13] = serverURL;
116
+ $[14] = t6;
112
117
  } else {
113
- t6 = $[12];
118
+ t6 = $[14];
114
119
  }
115
120
  t5 = _jsxs(Fragment, {
116
121
  children: [folders && folders.browseByFolder && _jsx(BrowseByFolderButton, {
@@ -124,9 +129,10 @@ export const DefaultNavClient = t0 => {
124
129
  $[4] = i18n;
125
130
  $[5] = navPreferences?.groups;
126
131
  $[6] = pathname;
127
- $[7] = t5;
132
+ $[7] = serverURL;
133
+ $[8] = t5;
128
134
  } else {
129
- t5 = $[7];
135
+ t5 = $[8];
130
136
  }
131
137
  return t5;
132
138
  };
@@ -1 +1 @@
1
- {"version":3,"file":"index.client.js","names":["c","_c","getTranslation","BrowseByFolderButton","Link","NavGroup","useConfig","useTranslation","EntityType","usePathname","formatAdminURL","React","Fragment","baseClass","DefaultNavClient","t0","$","groups","navPreferences","pathname","config","t1","admin","t2","folders","routes","t3","t4","browseByFolder","foldersRoute","adminRoute","i18n","t5","folderURL","path","viewingRootFolderView","startsWith","t6","t7","key","entities","label","_jsx","isOpen","open","children","map","t8","i","slug","type","label_0","href","id","collection","global","isActive","undefined","includes","length","Label","_jsxs","_Fragment","className","prefetch","active"],"sources":["../../../src/elements/Nav/index.client.tsx"],"sourcesContent":["'use client'\n\nimport type { groupNavItems } from '@payloadcms/ui/shared'\nimport type { NavPreferences } from 'payload'\n\nimport { getTranslation } from '@payloadcms/translations'\nimport { BrowseByFolderButton, Link, NavGroup, useConfig, useTranslation } from '@payloadcms/ui'\nimport { EntityType } from '@payloadcms/ui/shared'\nimport { usePathname } from 'next/navigation.js'\nimport { formatAdminURL } from 'payload/shared'\nimport React, { Fragment } from 'react'\n\nconst baseClass = 'nav'\n\n/**\n * @internal\n */\nexport const DefaultNavClient: React.FC<{\n groups: ReturnType<typeof groupNavItems>\n navPreferences: NavPreferences\n}> = ({ groups, navPreferences }) => {\n const pathname = usePathname()\n\n const {\n config: {\n admin: {\n routes: { browseByFolder: foldersRoute },\n },\n folders,\n routes: { admin: adminRoute },\n },\n } = useConfig()\n\n const { i18n } = useTranslation()\n\n const folderURL = formatAdminURL({\n adminRoute,\n path: foldersRoute,\n })\n\n const viewingRootFolderView = pathname.startsWith(folderURL)\n\n return (\n <Fragment>\n {folders && folders.browseByFolder && <BrowseByFolderButton active={viewingRootFolderView} />}\n {groups.map(({ entities, label }, key) => {\n return (\n <NavGroup isOpen={navPreferences?.groups?.[label]?.open} key={key} label={label}>\n {entities.map(({ slug, type, label }, i) => {\n let href: string\n let id: string\n\n if (type === EntityType.collection) {\n href = formatAdminURL({ adminRoute, path: `/collections/${slug}` })\n id = `nav-${slug}`\n }\n\n if (type === EntityType.global) {\n href = formatAdminURL({ adminRoute, path: `/globals/${slug}` })\n id = `nav-global-${slug}`\n }\n\n const isActive =\n pathname.startsWith(href) && ['/', undefined].includes(pathname[href.length])\n\n const Label = (\n <>\n {isActive && <div className={`${baseClass}__link-indicator`} />}\n <span className={`${baseClass}__link-label`}>{getTranslation(label, i18n)}</span>\n </>\n )\n\n // If the URL matches the link exactly\n if (pathname === href) {\n return (\n <div className={`${baseClass}__link`} id={id} key={i}>\n {Label}\n </div>\n )\n }\n\n return (\n <Link className={`${baseClass}__link`} href={href} id={id} key={i} prefetch={false}>\n {Label}\n </Link>\n )\n })}\n </NavGroup>\n )\n })}\n </Fragment>\n )\n}\n"],"mappings":"AAAA;;AAAA,SAAAA,CAAA,IAAAC,EAAA;;AAKA,SAASC,cAAc,QAAQ;AAC/B,SAASC,oBAAoB,EAAEC,IAAI,EAAEC,QAAQ,EAAEC,SAAS,EAAEC,cAAc,QAAQ;AAChF,SAASC,UAAU,QAAQ;AAC3B,SAASC,WAAW,QAAQ;AAC5B,SAASC,cAAc,QAAQ;AAC/B,OAAOC,KAAA,IAASC,QAAQ,QAAQ;AAEhC,MAAMC,SAAA,GAAY;AAElB;;;AAGA,OAAO,MAAMC,gBAAA,GAGRC,EAAA;EAAA,MAAAC,CAAA,GAAAf,EAAA;EAAC;IAAAgB,MAAA;IAAAC;EAAA,IAAAH,EAA0B;E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AA;MA0ClEvB,CAAA,MAAAc,UAAA;MAAAd,CAAA,MAAAe,IAAA;MAAAf,CAAA,OAAAE,cAAA,EAAAD,MAAA;MAAAD,CAAA,OAAAG,QAAA;MAAAH,CAAA,OAAAqB,EAAA;IAAA;MAAAA,EAAA,GAAArB,CAAA;IAAA;IA9CFgB,EAAA,GAAA6B,KAAA,CAAAjD,QAAA;MAAAiC,QAAA,GACGrB,OAAA,IAAWA,OAAA,CAAAI,cAAsB,IAAIc,IAAA,CAAAvC,oBAAA;QAAA8D,MAAA,EAA8B9B;MAAA,C,GACnElB,MAAA,CAAA6B,GAAA,CAAWT,EA4CZ;IAAA,C;;;;;;;;;;;;SA9CFL,E;CAiDJ","ignoreList":[]}
1
+ {"version":3,"file":"index.client.js","names":["c","_c","getTranslation","BrowseByFolderButton","Link","NavGroup","useConfig","useTranslation","EntityType","usePathname","formatAdminURL","React","Fragment","baseClass","DefaultNavClient","t0","$","groups","navPreferences","pathname","config","t1","admin","t2","folders","routes","t3","serverURL","t4","browseByFolder","foldersRoute","adminRoute","i18n","t5","folderURL","path","viewingRootFolderView","startsWith","t6","t7","key","entities","label","_jsx","isOpen","open","children","map","t8","i","slug","type","label_0","href","id","collection","global","isActive","undefined","includes","length","Label","_jsxs","_Fragment","className","prefetch","active"],"sources":["../../../src/elements/Nav/index.client.tsx"],"sourcesContent":["'use client'\n\nimport type { groupNavItems } from '@payloadcms/ui/shared'\nimport type { NavPreferences } from 'payload'\n\nimport { getTranslation } from '@payloadcms/translations'\nimport { BrowseByFolderButton, Link, NavGroup, useConfig, useTranslation } from '@payloadcms/ui'\nimport { EntityType } from '@payloadcms/ui/shared'\nimport { usePathname } from 'next/navigation.js'\nimport { formatAdminURL } from 'payload/shared'\nimport React, { Fragment } from 'react'\n\nconst baseClass = 'nav'\n\n/**\n * @internal\n */\nexport const DefaultNavClient: React.FC<{\n groups: ReturnType<typeof groupNavItems>\n navPreferences: NavPreferences\n}> = ({ groups, navPreferences }) => {\n const pathname = usePathname()\n\n const {\n config: {\n admin: {\n routes: { browseByFolder: foldersRoute },\n },\n folders,\n routes: { admin: adminRoute },\n serverURL,\n },\n } = useConfig()\n\n const { i18n } = useTranslation()\n\n const folderURL = formatAdminURL({\n adminRoute,\n path: foldersRoute,\n serverURL,\n })\n\n const viewingRootFolderView = pathname.startsWith(folderURL)\n\n return (\n <Fragment>\n {folders && folders.browseByFolder && <BrowseByFolderButton active={viewingRootFolderView} />}\n {groups.map(({ entities, label }, key) => {\n return (\n <NavGroup isOpen={navPreferences?.groups?.[label]?.open} key={key} label={label}>\n {entities.map(({ slug, type, label }, i) => {\n let href: string\n let id: string\n\n if (type === EntityType.collection) {\n href = formatAdminURL({ adminRoute, path: `/collections/${slug}`, serverURL })\n id = `nav-${slug}`\n }\n\n if (type === EntityType.global) {\n href = formatAdminURL({ adminRoute, path: `/globals/${slug}`, serverURL })\n id = `nav-global-${slug}`\n }\n\n const isActive =\n pathname.startsWith(href) && ['/', undefined].includes(pathname[href.length])\n\n const Label = (\n <>\n {isActive && <div className={`${baseClass}__link-indicator`} />}\n <span className={`${baseClass}__link-label`}>{getTranslation(label, i18n)}</span>\n </>\n )\n\n // If the URL matches the link exactly\n if (pathname === href) {\n return (\n <div className={`${baseClass}__link`} id={id} key={i}>\n {Label}\n </div>\n )\n }\n\n return (\n <Link className={`${baseClass}__link`} href={href} id={id} key={i} prefetch={false}>\n {Label}\n </Link>\n )\n })}\n </NavGroup>\n )\n })}\n </Fragment>\n )\n}\n"],"mappings":"AAAA;;AAAA,SAAAA,CAAA,IAAAC,EAAA;;AAKA,SAASC,cAAc,QAAQ;AAC/B,SAASC,oBAAoB,EAAEC,IAAI,EAAEC,QAAQ,EAAEC,SAAS,EAAEC,cAAc,QAAQ;AAChF,SAASC,UAAU,QAAQ;AAC3B,SAASC,WAAW,QAAQ;AAC5B,SAASC,cAAc,QAAQ;AAC/B,OAAOC,KAAA,IAASC,QAAQ,QAAQ;AAEhC,MAAMC,SAAA,GAAY;AAElB;;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