@shepai/cli 1.147.0 → 1.148.0
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.
- package/apis/json-schema/Attachment.yaml +3 -0
- package/dist/packages/core/src/domain/generated/output.d.ts +4 -0
- package/dist/packages/core/src/domain/generated/output.d.ts.map +1 -1
- package/dist/src/presentation/web/app/actions/compose-user-input.d.ts +1 -0
- package/dist/src/presentation/web/app/actions/compose-user-input.d.ts.map +1 -1
- package/dist/src/presentation/web/app/actions/compose-user-input.js +3 -1
- package/dist/src/presentation/web/app/actions/create-feature.d.ts +1 -0
- package/dist/src/presentation/web/app/actions/create-feature.d.ts.map +1 -1
- package/dist/src/presentation/web/components/common/attachment-chip/attachment-chip.d.ts +5 -1
- package/dist/src/presentation/web/components/common/attachment-chip/attachment-chip.d.ts.map +1 -1
- package/dist/src/presentation/web/components/common/attachment-chip/attachment-chip.js +6 -3
- package/dist/src/presentation/web/components/common/attachment-chip/attachment-chip.stories.d.ts +2 -0
- package/dist/src/presentation/web/components/common/attachment-chip/attachment-chip.stories.d.ts.map +1 -1
- package/dist/src/presentation/web/components/common/attachment-chip/attachment-chip.stories.js +20 -0
- package/dist/src/presentation/web/components/common/control-center-drawer/feature-drawer-client.d.ts.map +1 -1
- package/dist/src/presentation/web/components/common/control-center-drawer/feature-drawer-client.js +5 -1
- package/dist/src/presentation/web/components/common/drawer-action-bar/drawer-action-bar-config.d.ts +2 -0
- package/dist/src/presentation/web/components/common/drawer-action-bar/drawer-action-bar-config.d.ts.map +1 -1
- package/dist/src/presentation/web/components/common/drawer-action-bar/drawer-action-bar.d.ts.map +1 -1
- package/dist/src/presentation/web/components/common/drawer-action-bar/drawer-action-bar.js +4 -1
- package/dist/src/presentation/web/components/common/feature-create-drawer/feature-create-drawer.d.ts +2 -0
- package/dist/src/presentation/web/components/common/feature-create-drawer/feature-create-drawer.d.ts.map +1 -1
- package/dist/src/presentation/web/components/common/feature-create-drawer/feature-create-drawer.js +4 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/web/.next/BUILD_ID +1 -1
- package/web/.next/build-manifest.json +2 -2
- package/web/.next/fallback-build-manifest.json +2 -2
- package/web/.next/prerender-manifest.json +3 -3
- package/web/.next/required-server-files.js +2 -2
- package/web/.next/required-server-files.json +2 -2
- package/web/.next/server/app/(dashboard)/@drawer/adopt/page/server-reference-manifest.json +28 -28
- package/web/.next/server/app/(dashboard)/@drawer/adopt/page.js.nft.json +1 -1
- package/web/.next/server/app/(dashboard)/@drawer/adopt/page_client-reference-manifest.js +1 -1
- package/web/.next/server/app/(dashboard)/@drawer/create/page/server-reference-manifest.json +28 -28
- package/web/.next/server/app/(dashboard)/@drawer/create/page.js.nft.json +1 -1
- package/web/.next/server/app/(dashboard)/@drawer/create/page_client-reference-manifest.js +1 -1
- package/web/.next/server/app/(dashboard)/@drawer/feature/[featureId]/[tab]/page/server-reference-manifest.json +36 -36
- package/web/.next/server/app/(dashboard)/@drawer/feature/[featureId]/[tab]/page.js.nft.json +1 -1
- package/web/.next/server/app/(dashboard)/@drawer/feature/[featureId]/[tab]/page_client-reference-manifest.js +1 -1
- package/web/.next/server/app/(dashboard)/@drawer/feature/[featureId]/page/server-reference-manifest.json +36 -36
- package/web/.next/server/app/(dashboard)/@drawer/feature/[featureId]/page.js.nft.json +1 -1
- package/web/.next/server/app/(dashboard)/@drawer/feature/[featureId]/page_client-reference-manifest.js +1 -1
- package/web/.next/server/app/(dashboard)/@drawer/repository/[repositoryId]/page/server-reference-manifest.json +26 -26
- package/web/.next/server/app/(dashboard)/@drawer/repository/[repositoryId]/page.js.nft.json +1 -1
- package/web/.next/server/app/(dashboard)/@drawer/repository/[repositoryId]/page_client-reference-manifest.js +1 -1
- package/web/.next/server/app/(dashboard)/create/page/server-reference-manifest.json +28 -28
- package/web/.next/server/app/(dashboard)/create/page.js.nft.json +1 -1
- package/web/.next/server/app/(dashboard)/create/page_client-reference-manifest.js +1 -1
- package/web/.next/server/app/(dashboard)/feature/[featureId]/[tab]/page/server-reference-manifest.json +36 -36
- package/web/.next/server/app/(dashboard)/feature/[featureId]/[tab]/page.js.nft.json +1 -1
- package/web/.next/server/app/(dashboard)/feature/[featureId]/[tab]/page_client-reference-manifest.js +1 -1
- package/web/.next/server/app/(dashboard)/feature/[featureId]/page/server-reference-manifest.json +36 -36
- package/web/.next/server/app/(dashboard)/feature/[featureId]/page.js.nft.json +1 -1
- package/web/.next/server/app/(dashboard)/feature/[featureId]/page_client-reference-manifest.js +1 -1
- package/web/.next/server/app/(dashboard)/page/server-reference-manifest.json +26 -26
- package/web/.next/server/app/(dashboard)/page.js.nft.json +1 -1
- package/web/.next/server/app/(dashboard)/page_client-reference-manifest.js +1 -1
- package/web/.next/server/app/(dashboard)/repository/[repositoryId]/page/server-reference-manifest.json +26 -26
- package/web/.next/server/app/(dashboard)/repository/[repositoryId]/page.js.nft.json +1 -1
- package/web/.next/server/app/(dashboard)/repository/[repositoryId]/page_client-reference-manifest.js +1 -1
- package/web/.next/server/app/_global-error.html +2 -2
- package/web/.next/server/app/_global-error.rsc +1 -1
- package/web/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
- package/web/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
- package/web/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
- package/web/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
- package/web/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
- package/web/.next/server/app/_not-found/page/server-reference-manifest.json +3 -3
- package/web/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/web/.next/server/app/settings/page/server-reference-manifest.json +8 -8
- package/web/.next/server/app/settings/page.js.nft.json +1 -1
- package/web/.next/server/app/settings/page_client-reference-manifest.js +1 -1
- package/web/.next/server/app/skills/page/server-reference-manifest.json +8 -8
- package/web/.next/server/app/skills/page_client-reference-manifest.js +1 -1
- package/web/.next/server/app/tools/page/server-reference-manifest.json +8 -8
- package/web/.next/server/app/tools/page_client-reference-manifest.js +1 -1
- package/web/.next/server/app/version/page/server-reference-manifest.json +3 -3
- package/web/.next/server/app/version/page_client-reference-manifest.js +1 -1
- package/web/.next/server/chunks/[root-of-the-server]__a402b567._.js +1 -1
- package/web/.next/server/chunks/[root-of-the-server]__c6e32a23._.js.map +1 -1
- package/web/.next/server/chunks/[root-of-the-server]__cd67a84c._.js.map +1 -1
- package/web/.next/server/chunks/ssr/744ca_web_components_common_control-center-drawer_create-drawer-client_tsx_5e26fc0a._.js +1 -1
- package/web/.next/server/chunks/ssr/744ca_web_components_common_control-center-drawer_create-drawer-client_tsx_5e26fc0a._.js.map +1 -1
- package/web/.next/server/chunks/ssr/[root-of-the-server]__0b150ddf._.js.map +1 -1
- package/web/.next/server/chunks/ssr/[root-of-the-server]__2138fa7e._.js +2 -2
- package/web/.next/server/chunks/ssr/[root-of-the-server]__2138fa7e._.js.map +1 -1
- package/web/.next/server/chunks/ssr/[root-of-the-server]__29580090._.js +1 -1
- package/web/.next/server/chunks/ssr/[root-of-the-server]__29580090._.js.map +1 -1
- package/web/.next/server/chunks/ssr/[root-of-the-server]__357d99f9._.js +1 -1
- package/web/.next/server/chunks/ssr/[root-of-the-server]__3ef34e4c._.js +1 -1
- package/web/.next/server/chunks/ssr/[root-of-the-server]__43f51aa6._.js +1 -1
- package/web/.next/server/chunks/ssr/[root-of-the-server]__43f51aa6._.js.map +1 -1
- package/web/.next/server/chunks/ssr/[root-of-the-server]__815546bd._.js +1 -1
- package/web/.next/server/chunks/ssr/[root-of-the-server]__815546bd._.js.map +1 -1
- package/web/.next/server/chunks/ssr/[root-of-the-server]__aad040c0._.js +5 -2
- package/web/.next/server/chunks/ssr/[root-of-the-server]__aad040c0._.js.map +1 -1
- package/web/.next/server/chunks/ssr/[root-of-the-server]__c094882b._.js +1 -1
- package/web/.next/server/chunks/ssr/[root-of-the-server]__c094882b._.js.map +1 -1
- package/web/.next/server/chunks/ssr/[root-of-the-server]__d48c5b11._.js +1 -1
- package/web/.next/server/chunks/ssr/[root-of-the-server]__d48c5b11._.js.map +1 -1
- package/web/.next/server/chunks/ssr/[root-of-the-server]__dac5dbf1._.js +1 -1
- package/web/.next/server/chunks/ssr/[root-of-the-server]__dac5dbf1._.js.map +1 -1
- package/web/.next/server/chunks/ssr/[root-of-the-server]__df7c1cd3._.js +1 -1
- package/web/.next/server/chunks/ssr/[root-of-the-server]__df7c1cd3._.js.map +1 -1
- package/web/.next/server/chunks/ssr/[root-of-the-server]__fae8b355._.js +1 -1
- package/web/.next/server/chunks/ssr/[root-of-the-server]__fae8b355._.js.map +1 -1
- package/web/.next/server/chunks/ssr/_05c23ad9._.js +1 -1
- package/web/.next/server/chunks/ssr/_05c23ad9._.js.map +1 -1
- package/web/.next/server/chunks/ssr/_0c5f56e3._.js +2 -2
- package/web/.next/server/chunks/ssr/_0c5f56e3._.js.map +1 -1
- package/web/.next/server/chunks/ssr/_16eb4fec._.js +1 -1
- package/web/.next/server/chunks/ssr/_16eb4fec._.js.map +1 -1
- package/web/.next/server/chunks/ssr/_1b719e7f._.js +1 -1
- package/web/.next/server/chunks/ssr/_1b719e7f._.js.map +1 -1
- package/web/.next/server/chunks/ssr/_37e8548b._.js +1 -1
- package/web/.next/server/chunks/ssr/_37e8548b._.js.map +1 -1
- package/web/.next/server/chunks/ssr/{_5a50254c._.js → _4533d6f8._.js} +2 -2
- package/web/.next/server/chunks/ssr/{_5a50254c._.js.map → _4533d6f8._.js.map} +1 -1
- package/web/.next/server/chunks/ssr/_55d763e2._.js +1 -1
- package/web/.next/server/chunks/ssr/_55d763e2._.js.map +1 -1
- package/web/.next/server/chunks/ssr/_6256a985._.js +1 -1
- package/web/.next/server/chunks/ssr/_6256a985._.js.map +1 -1
- package/web/.next/server/chunks/ssr/_64bdfc6f._.js +2 -2
- package/web/.next/server/chunks/ssr/_64bdfc6f._.js.map +1 -1
- package/web/.next/server/chunks/ssr/_8fcc39d4._.js +1 -1
- package/web/.next/server/chunks/ssr/_8fcc39d4._.js.map +1 -1
- package/web/.next/server/chunks/ssr/_b71645b4._.js +1 -1
- package/web/.next/server/chunks/ssr/_b71645b4._.js.map +1 -1
- package/web/.next/server/chunks/ssr/_d4b20e29._.js.map +1 -1
- package/web/.next/server/chunks/ssr/_d8575088._.js +1 -1
- package/web/.next/server/chunks/ssr/_d8575088._.js.map +1 -1
- package/web/.next/server/chunks/ssr/_fe63a7f9._.js +3 -0
- package/web/.next/server/chunks/ssr/{_b839d4f1._.js.map → _fe63a7f9._.js.map} +1 -1
- package/web/.next/server/chunks/ssr/b1a17_presentation_web_components_features_settings_settings-page-client_tsx_6ed9d5f8._.js +1 -1
- package/web/.next/server/chunks/ssr/b1a17_presentation_web_components_features_settings_settings-page-client_tsx_6ed9d5f8._.js.map +1 -1
- package/web/.next/server/chunks/ssr/{src_presentation_web_523768ca._.js → src_presentation_web_7b2fda40._.js} +2 -2
- package/web/.next/server/chunks/ssr/{src_presentation_web_523768ca._.js.map → src_presentation_web_7b2fda40._.js.map} +1 -1
- package/web/.next/server/chunks/ssr/src_presentation_web__next-internal_server_app_skills_page_actions_1b176e3c.js +1 -1
- package/web/.next/server/chunks/ssr/src_presentation_web__next-internal_server_app_skills_page_actions_1b176e3c.js.map +1 -1
- package/web/.next/server/chunks/ssr/src_presentation_web__next-internal_server_app_tools_page_actions_bd9f0dda.js +1 -1
- package/web/.next/server/chunks/ssr/src_presentation_web__next-internal_server_app_tools_page_actions_bd9f0dda.js.map +1 -1
- package/web/.next/server/chunks/ssr/src_presentation_web_app_actions_open-ide_ts_baaca5d5._.js +1 -1
- package/web/.next/server/chunks/ssr/src_presentation_web_components_e599bb8c._.js +1 -1
- package/web/.next/server/chunks/ssr/src_presentation_web_components_e599bb8c._.js.map +1 -1
- package/web/.next/server/chunks/ssr/src_presentation_web_components_features_control-center_7ac3562e._.js +1 -1
- package/web/.next/server/chunks/ssr/src_presentation_web_components_features_control-center_7ac3562e._.js.map +1 -1
- package/web/.next/server/pages/500.html +2 -2
- package/web/.next/server/server-reference-manifest.js +1 -1
- package/web/.next/server/server-reference-manifest.json +44 -44
- package/web/.next/static/chunks/0137d4850cab3c45.js +5 -0
- package/web/.next/static/chunks/{a0ab3aee9a5e3d02.js → 04869f1d3f5d9071.js} +1 -1
- package/web/.next/static/chunks/063a24b49d9818a0.js +1 -0
- package/web/.next/static/chunks/21e82fee1a7e1668.js +1 -0
- package/web/.next/static/chunks/{9fd5c3ecc8c5eb07.js → 48850e202dd814ac.js} +1 -1
- package/web/.next/static/chunks/49057cf8cd37e262.js +1 -0
- package/web/.next/static/chunks/{28f5e2d65510526a.js → 682563e4503cbd58.js} +1 -1
- package/web/.next/static/chunks/{0539e93ac218f442.js → 683b1d85e789c2eb.js} +2 -2
- package/web/.next/static/chunks/{0ddea46ed4ba1621.js → 6f76e63ead3fac2e.js} +1 -1
- package/web/.next/static/chunks/{a63c16171b149d2d.js → 7c5131e33516a325.js} +1 -1
- package/web/.next/static/chunks/9b8678597fa1db84.css +1 -0
- package/web/.next/static/chunks/{8923825cdb21cf1c.js → 9dad6769d10a32df.js} +1 -1
- package/web/.next/static/chunks/{63f412a89bde2484.js → c731682077fbac4f.js} +1 -1
- package/web/.next/static/chunks/{ebbc5dd20e227e3d.js → d62ae5e449d87057.js} +1 -1
- package/web/.next/server/chunks/ssr/_b839d4f1._.js +0 -3
- package/web/.next/static/chunks/79984461b85f1e4e.js +0 -1
- package/web/.next/static/chunks/7ab5c32984198a7e.js +0 -2
- package/web/.next/static/chunks/869ae48ca73fa328.js +0 -1
- package/web/.next/static/chunks/d61c239df26c61fd.css +0 -1
- package/web/.next/static/chunks/fa556c575c788679.js +0 -1
- /package/web/.next/static/{41QsWn4e2sGnQCNBIar6W → zYKuE1zbe1UWwAJv5EVwg}/_buildManifest.js +0 -0
- /package/web/.next/static/{41QsWn4e2sGnQCNBIar6W → zYKuE1zbe1UWwAJv5EVwg}/_clientMiddlewareManifest.json +0 -0
- /package/web/.next/static/{41QsWn4e2sGnQCNBIar6W → zYKuE1zbe1UWwAJv5EVwg}/_ssgManifest.js +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../../node_modules/.pnpm/next%4016.1.6_%40babel%2Bcore%407.29.0_%40playwright%2Btest%401.58.1_react-dom%4019.2.4_react%4019.2.4__react%4019.2.4/node_modules/next/src/lib/constants.ts","../../../../../../../node_modules/.pnpm/next%4016.1.6_%40babel%2Bcore%407.29.0_%40playwright%2Btest%401.58.1_react-dom%4019.2.4_react%4019.2.4__react%4019.2.4/node_modules/next/src/server/lib/trace/constants.ts","../../../../../../../node_modules/.pnpm/next%4016.1.6_%40babel%2Bcore%407.29.0_%40playwright%2Btest%401.58.1_react-dom%4019.2.4_react%4019.2.4__react%4019.2.4/node_modules/next/src/shared/lib/is-thenable.ts","../../../../../../../node_modules/.pnpm/next%4016.1.6_%40babel%2Bcore%407.29.0_%40playwright%2Btest%401.58.1_react-dom%4019.2.4_react%4019.2.4__react%4019.2.4/node_modules/next/src/server/lib/trace/tracer.ts","../../../../../../../node_modules/.pnpm/next%4016.1.6_%40babel%2Bcore%407.29.0_%40playwright%2Btest%401.58.1_react-dom%4019.2.4_react%4019.2.4__react%4019.2.4/node_modules/next/src/server/lib/clone-response.ts","../../../../../../../node_modules/.pnpm/next%4016.1.6_%40babel%2Bcore%407.29.0_%40playwright%2Btest%401.58.1_react-dom%4019.2.4_react%4019.2.4__react%4019.2.4/node_modules/next/src/server/lib/dedupe-fetch.ts","../../../../../../../node_modules/.pnpm/next%4016.1.6_%40babel%2Bcore%407.29.0_%40playwright%2Btest%401.58.1_react-dom%4019.2.4_react%4019.2.4__react%4019.2.4/node_modules/next/src/server/response-cache/types.ts","../../../../../../../node_modules/.pnpm/next%4016.1.6_%40babel%2Bcore%407.29.0_%40playwright%2Btest%401.58.1_react-dom%4019.2.4_react%4019.2.4__react%4019.2.4/node_modules/next/src/lib/detached-promise.ts","../../../../../../../node_modules/.pnpm/next%4016.1.6_%40babel%2Bcore%407.29.0_%40playwright%2Btest%401.58.1_react-dom%4019.2.4_react%4019.2.4__react%4019.2.4/node_modules/next/src/lib/batcher.ts","../../../../../../../node_modules/.pnpm/next%4016.1.6_%40babel%2Bcore%407.29.0_%40playwright%2Btest%401.58.1_react-dom%4019.2.4_react%4019.2.4__react%4019.2.4/node_modules/next/src/server/lib/lru-cache.ts","../../../../../../../node_modules/.pnpm/next%4016.1.6_%40babel%2Bcore%407.29.0_%40playwright%2Btest%401.58.1_react-dom%4019.2.4_react%4019.2.4__react%4019.2.4/node_modules/next/src/lib/picocolors.ts","../../../../../../../node_modules/.pnpm/next%4016.1.6_%40babel%2Bcore%407.29.0_%40playwright%2Btest%401.58.1_react-dom%4019.2.4_react%4019.2.4__react%4019.2.4/node_modules/next/src/build/output/log.ts","../../../../../../../node_modules/.pnpm/next%4016.1.6_%40babel%2Bcore%407.29.0_%40playwright%2Btest%401.58.1_react-dom%4019.2.4_react%4019.2.4__react%4019.2.4/node_modules/next/src/server/stream-utils/encoded-tags.ts","../../../../../../../node_modules/.pnpm/next%4016.1.6_%40babel%2Bcore%407.29.0_%40playwright%2Btest%401.58.1_react-dom%4019.2.4_react%4019.2.4__react%4019.2.4/node_modules/next/src/server/stream-utils/uint8array-helpers.ts","../../../../../../../node_modules/.pnpm/next%4016.1.6_%40babel%2Bcore%407.29.0_%40playwright%2Btest%401.58.1_react-dom%4019.2.4_react%4019.2.4__react%4019.2.4/node_modules/next/src/shared/lib/errors/constants.ts","../../../../../../../node_modules/.pnpm/next%4016.1.6_%40babel%2Bcore%407.29.0_%40playwright%2Btest%401.58.1_react-dom%4019.2.4_react%4019.2.4__react%4019.2.4/node_modules/next/src/shared/lib/segment-cache/output-export-prefetch-encoding.ts","../../../../../../../node_modules/.pnpm/next%4016.1.6_%40babel%2Bcore%407.29.0_%40playwright%2Btest%401.58.1_react-dom%4019.2.4_react%4019.2.4__react%4019.2.4/node_modules/next/src/client/components/app-router-headers.ts","../../../../../../../node_modules/.pnpm/next%4016.1.6_%40babel%2Bcore%407.29.0_%40playwright%2Btest%401.58.1_react-dom%4019.2.4_react%4019.2.4__react%4019.2.4/node_modules/next/src/shared/lib/hash.ts","../../../../../../../node_modules/.pnpm/next%4016.1.6_%40babel%2Bcore%407.29.0_%40playwright%2Btest%401.58.1_react-dom%4019.2.4_react%4019.2.4__react%4019.2.4/node_modules/next/src/shared/lib/router/utils/cache-busting-search-param.ts","../../../../../../../node_modules/.pnpm/next%4016.1.6_%40babel%2Bcore%407.29.0_%40playwright%2Btest%401.58.1_react-dom%4019.2.4_react%4019.2.4__react%4019.2.4/node_modules/next/src/server/stream-utils/node-web-streams-helper.ts","../../../../../../../node_modules/.pnpm/next%4016.1.6_%40babel%2Bcore%407.29.0_%40playwright%2Btest%401.58.1_react-dom%4019.2.4_react%4019.2.4__react%4019.2.4/node_modules/next/src/server/request-meta.ts","../../../../../../../node_modules/.pnpm/next%4016.1.6_%40babel%2Bcore%407.29.0_%40playwright%2Btest%401.58.1_react-dom%4019.2.4_react%4019.2.4__react%4019.2.4/node_modules/next/src/server/web/utils.ts","../../../../../../../node_modules/.pnpm/next%4016.1.6_%40babel%2Bcore%407.29.0_%40playwright%2Btest%401.58.1_react-dom%4019.2.4_react%4019.2.4__react%4019.2.4/node_modules/next/src/shared/lib/i18n/detect-domain-locale.ts","../../../../../../../node_modules/.pnpm/next%4016.1.6_%40babel%2Bcore%407.29.0_%40playwright%2Btest%401.58.1_react-dom%4019.2.4_react%4019.2.4__react%4019.2.4/node_modules/next/src/shared/lib/router/utils/remove-trailing-slash.ts","../../../../../../../node_modules/.pnpm/next%4016.1.6_%40babel%2Bcore%407.29.0_%40playwright%2Btest%401.58.1_react-dom%4019.2.4_react%4019.2.4__react%4019.2.4/node_modules/next/src/shared/lib/router/utils/parse-path.ts","../../../../../../../node_modules/.pnpm/next%4016.1.6_%40babel%2Bcore%407.29.0_%40playwright%2Btest%401.58.1_react-dom%4019.2.4_react%4019.2.4__react%4019.2.4/node_modules/next/src/shared/lib/router/utils/add-path-prefix.ts","../../../../../../../node_modules/.pnpm/next%4016.1.6_%40babel%2Bcore%407.29.0_%40playwright%2Btest%401.58.1_react-dom%4019.2.4_react%4019.2.4__react%4019.2.4/node_modules/next/src/shared/lib/router/utils/add-path-suffix.ts","../../../../../../../node_modules/.pnpm/next%4016.1.6_%40babel%2Bcore%407.29.0_%40playwright%2Btest%401.58.1_react-dom%4019.2.4_react%4019.2.4__react%4019.2.4/node_modules/next/src/shared/lib/router/utils/path-has-prefix.ts","../../../../../../../node_modules/.pnpm/next%4016.1.6_%40babel%2Bcore%407.29.0_%40playwright%2Btest%401.58.1_react-dom%4019.2.4_react%4019.2.4__react%4019.2.4/node_modules/next/src/shared/lib/router/utils/add-locale.ts","../../../../../../../node_modules/.pnpm/next%4016.1.6_%40babel%2Bcore%407.29.0_%40playwright%2Btest%401.58.1_react-dom%4019.2.4_react%4019.2.4__react%4019.2.4/node_modules/next/src/shared/lib/router/utils/format-next-pathname-info.ts","../../../../../../../node_modules/.pnpm/next%4016.1.6_%40babel%2Bcore%407.29.0_%40playwright%2Btest%401.58.1_react-dom%4019.2.4_react%4019.2.4__react%4019.2.4/node_modules/next/src/shared/lib/get-hostname.ts","../../../../../../../node_modules/.pnpm/next%4016.1.6_%40babel%2Bcore%407.29.0_%40playwright%2Btest%401.58.1_react-dom%4019.2.4_react%4019.2.4__react%4019.2.4/node_modules/next/src/shared/lib/i18n/normalize-locale-path.ts","../../../../../../../node_modules/.pnpm/next%4016.1.6_%40babel%2Bcore%407.29.0_%40playwright%2Btest%401.58.1_react-dom%4019.2.4_react%4019.2.4__react%4019.2.4/node_modules/next/src/shared/lib/router/utils/remove-path-prefix.ts","../../../../../../../node_modules/.pnpm/next%4016.1.6_%40babel%2Bcore%407.29.0_%40playwright%2Btest%401.58.1_react-dom%4019.2.4_react%4019.2.4__react%4019.2.4/node_modules/next/src/shared/lib/router/utils/get-next-pathname-info.ts","../../../../../../../node_modules/.pnpm/next%4016.1.6_%40babel%2Bcore%407.29.0_%40playwright%2Btest%401.58.1_react-dom%4019.2.4_react%4019.2.4__react%4019.2.4/node_modules/next/src/server/web/next-url.ts","../../../../../../../node_modules/.pnpm/next%4016.1.6_%40babel%2Bcore%407.29.0_%40playwright%2Btest%401.58.1_react-dom%4019.2.4_react%4019.2.4__react%4019.2.4/node_modules/next/src/server/web/error.ts","../../../../../../../node_modules/.pnpm/next%4016.1.6_%40babel%2Bcore%407.29.0_%40playwright%2Btest%401.58.1_react-dom%4019.2.4_react%4019.2.4__react%4019.2.4/node_modules/next/src/server/web/spec-extension/request.ts","../../../../../../../node_modules/.pnpm/next%4016.1.6_%40babel%2Bcore%407.29.0_%40playwright%2Btest%401.58.1_react-dom%4019.2.4_react%4019.2.4__react%4019.2.4/node_modules/next/src/server/base-http/helpers.ts","../../../../../../../node_modules/.pnpm/next%4016.1.6_%40babel%2Bcore%407.29.0_%40playwright%2Btest%401.58.1_react-dom%4019.2.4_react%4019.2.4__react%4019.2.4/node_modules/next/src/server/web/spec-extension/adapters/next-request.ts","../../../../../../../node_modules/.pnpm/next%4016.1.6_%40babel%2Bcore%407.29.0_%40playwright%2Btest%401.58.1_react-dom%4019.2.4_react%4019.2.4__react%4019.2.4/node_modules/next/src/server/client-component-renderer-logger.ts","../../../../../../../node_modules/.pnpm/next%4016.1.6_%40babel%2Bcore%407.29.0_%40playwright%2Btest%401.58.1_react-dom%4019.2.4_react%4019.2.4__react%4019.2.4/node_modules/next/src/server/pipe-readable.ts","../../../../../../../node_modules/.pnpm/next%4016.1.6_%40babel%2Bcore%407.29.0_%40playwright%2Btest%401.58.1_react-dom%4019.2.4_react%4019.2.4__react%4019.2.4/node_modules/next/src/server/render-result.ts","../../../../../../../node_modules/.pnpm/next%4016.1.6_%40babel%2Bcore%407.29.0_%40playwright%2Btest%401.58.1_react-dom%4019.2.4_react%4019.2.4__react%4019.2.4/node_modules/next/src/server/route-kind.ts","../../../../../../../node_modules/.pnpm/next%4016.1.6_%40babel%2Bcore%407.29.0_%40playwright%2Btest%401.58.1_react-dom%4019.2.4_react%4019.2.4__react%4019.2.4/node_modules/next/src/server/response-cache/utils.ts","../../../../../../../node_modules/.pnpm/next%4016.1.6_%40babel%2Bcore%407.29.0_%40playwright%2Btest%401.58.1_react-dom%4019.2.4_react%4019.2.4__react%4019.2.4/node_modules/next/src/server/response-cache/index.ts","../../../../../../../node_modules/.pnpm/next%4016.1.6_%40babel%2Bcore%407.29.0_%40playwright%2Btest%401.58.1_react-dom%4019.2.4_react%4019.2.4__react%4019.2.4/node_modules/next/src/server/lib/patch-fetch.ts","../../../../../../../node_modules/.pnpm/next%4016.1.6_%40babel%2Bcore%407.29.0_%40playwright%2Btest%401.58.1_react-dom%4019.2.4_react%4019.2.4__react%4019.2.4/node_modules/next/src/server/web/spec-extension/unstable-cache.ts","../../../../../../../node_modules/.pnpm/next%4016.1.6_%40babel%2Bcore%407.29.0_%40playwright%2Btest%401.58.1_react-dom%4019.2.4_react%4019.2.4__react%4019.2.4/node_modules/next/src/shared/lib/router/utils/sorted-routes.ts","../../../../../../../node_modules/.pnpm/next%4016.1.6_%40babel%2Bcore%407.29.0_%40playwright%2Btest%401.58.1_react-dom%4019.2.4_react%4019.2.4__react%4019.2.4/node_modules/next/src/shared/lib/page-path/ensure-leading-slash.ts","../../../../../../../node_modules/.pnpm/next%4016.1.6_%40babel%2Bcore%407.29.0_%40playwright%2Btest%401.58.1_react-dom%4019.2.4_react%4019.2.4__react%4019.2.4/node_modules/next/src/shared/lib/segment.ts","../../../../../../../node_modules/.pnpm/next%4016.1.6_%40babel%2Bcore%407.29.0_%40playwright%2Btest%401.58.1_react-dom%4019.2.4_react%4019.2.4__react%4019.2.4/node_modules/next/src/shared/lib/router/utils/app-paths.ts","../../../../../../../node_modules/.pnpm/next%4016.1.6_%40babel%2Bcore%407.29.0_%40playwright%2Btest%401.58.1_react-dom%4019.2.4_react%4019.2.4__react%4019.2.4/node_modules/next/src/shared/lib/router/utils/interception-routes.ts","../../../../../../../node_modules/.pnpm/next%4016.1.6_%40babel%2Bcore%407.29.0_%40playwright%2Btest%401.58.1_react-dom%4019.2.4_react%4019.2.4__react%4019.2.4/node_modules/next/src/shared/lib/router/utils/is-dynamic.ts","../../../../../../../node_modules/.pnpm/next%4016.1.6_%40babel%2Bcore%407.29.0_%40playwright%2Btest%401.58.1_react-dom%4019.2.4_react%4019.2.4__react%4019.2.4/node_modules/next/src/shared/lib/router/utils/index.ts","../../../../../../../node_modules/.pnpm/next%4016.1.6_%40babel%2Bcore%407.29.0_%40playwright%2Btest%401.58.1_react-dom%4019.2.4_react%4019.2.4__react%4019.2.4/node_modules/next/src/server/web/spec-extension/revalidate.ts","../../../../../../../node_modules/.pnpm/next%4016.1.6_%40babel%2Bcore%407.29.0_%40playwright%2Btest%401.58.1_react-dom%4019.2.4_react%4019.2.4__react%4019.2.4/node_modules/next/src/server/web/spec-extension/unstable-no-store.ts","../../../../../../../node_modules/.pnpm/next%4016.1.6_%40babel%2Bcore%407.29.0_%40playwright%2Btest%401.58.1_react-dom%4019.2.4_react%4019.2.4__react%4019.2.4/node_modules/next/src/server/use-cache/cache-life.ts","../../../../../../../node_modules/.pnpm/next%4016.1.6_%40babel%2Bcore%407.29.0_%40playwright%2Btest%401.58.1_react-dom%4019.2.4_react%4019.2.4__react%4019.2.4/node_modules/next/src/server/use-cache/cache-tag.ts","../../../../../../../node_modules/.pnpm/next%4016.1.6_%40babel%2Bcore%407.29.0_%40playwright%2Btest%401.58.1_react-dom%4019.2.4_react%4019.2.4__react%4019.2.4/node_modules/next/cache.js","../../../../../../../src/presentation/web/.next-internal/server/app/settings/page/actions.js%20%28server%20actions%20loader%29","../../../../../../../src/presentation/web/app/actions/update-settings.ts"],"sourcesContent":["import type { ServerRuntime } from '../types'\n\nexport const TEXT_PLAIN_CONTENT_TYPE_HEADER = 'text/plain'\nexport const HTML_CONTENT_TYPE_HEADER = 'text/html; charset=utf-8'\nexport const JSON_CONTENT_TYPE_HEADER = 'application/json; charset=utf-8'\nexport const NEXT_QUERY_PARAM_PREFIX = 'nxtP'\nexport const NEXT_INTERCEPTION_MARKER_PREFIX = 'nxtI'\n\nexport const MATCHED_PATH_HEADER = 'x-matched-path'\nexport const PRERENDER_REVALIDATE_HEADER = 'x-prerender-revalidate'\nexport const PRERENDER_REVALIDATE_ONLY_GENERATED_HEADER =\n 'x-prerender-revalidate-if-generated'\n\nexport const RSC_SEGMENTS_DIR_SUFFIX = '.segments'\nexport const RSC_SEGMENT_SUFFIX = '.segment.rsc'\nexport const RSC_SUFFIX = '.rsc'\nexport const ACTION_SUFFIX = '.action'\nexport const NEXT_DATA_SUFFIX = '.json'\nexport const NEXT_META_SUFFIX = '.meta'\nexport const NEXT_BODY_SUFFIX = '.body'\n\nexport const NEXT_CACHE_TAGS_HEADER = 'x-next-cache-tags'\nexport const NEXT_CACHE_REVALIDATED_TAGS_HEADER = 'x-next-revalidated-tags'\nexport const NEXT_CACHE_REVALIDATE_TAG_TOKEN_HEADER =\n 'x-next-revalidate-tag-token'\n\nexport const NEXT_RESUME_HEADER = 'next-resume'\n\n// if these change make sure we update the related\n// documentation as well\nexport const NEXT_CACHE_TAG_MAX_ITEMS = 128\nexport const NEXT_CACHE_TAG_MAX_LENGTH = 256\nexport const NEXT_CACHE_SOFT_TAG_MAX_LENGTH = 1024\nexport const NEXT_CACHE_IMPLICIT_TAG_ID = '_N_T_'\n\n// in seconds\nexport const CACHE_ONE_YEAR = 31536000\n\n// in seconds, represents revalidate=false. I.e. never revaliate.\n// We use this value since it can be represented as a V8 SMI for optimal performance.\n// It can also be serialized as JSON if it ever leaks accidentally as an actual value.\nexport const INFINITE_CACHE = 0xfffffffe\n\n// Patterns to detect middleware files\nexport const MIDDLEWARE_FILENAME = 'middleware'\nexport const MIDDLEWARE_LOCATION_REGEXP = `(?:src/)?${MIDDLEWARE_FILENAME}`\n\n// Patterns to detect proxy files (replacement for middleware)\nexport const PROXY_FILENAME = 'proxy'\nexport const PROXY_LOCATION_REGEXP = `(?:src/)?${PROXY_FILENAME}`\n\n// Pattern to detect instrumentation hooks file\nexport const INSTRUMENTATION_HOOK_FILENAME = 'instrumentation'\n\n// Because on Windows absolute paths in the generated code can break because of numbers, eg 1 in the path,\n// we have to use a private alias\nexport const PAGES_DIR_ALIAS = 'private-next-pages'\nexport const DOT_NEXT_ALIAS = 'private-dot-next'\nexport const ROOT_DIR_ALIAS = 'private-next-root-dir'\nexport const APP_DIR_ALIAS = 'private-next-app-dir'\nexport const RSC_MOD_REF_PROXY_ALIAS = 'private-next-rsc-mod-ref-proxy'\nexport const RSC_ACTION_VALIDATE_ALIAS = 'private-next-rsc-action-validate'\nexport const RSC_ACTION_PROXY_ALIAS = 'private-next-rsc-server-reference'\nexport const RSC_CACHE_WRAPPER_ALIAS = 'private-next-rsc-cache-wrapper'\nexport const RSC_DYNAMIC_IMPORT_WRAPPER_ALIAS =\n 'private-next-rsc-track-dynamic-import'\nexport const RSC_ACTION_ENCRYPTION_ALIAS = 'private-next-rsc-action-encryption'\nexport const RSC_ACTION_CLIENT_WRAPPER_ALIAS =\n 'private-next-rsc-action-client-wrapper'\n\nexport const PUBLIC_DIR_MIDDLEWARE_CONFLICT = `You can not have a '_next' folder inside of your public folder. This conflicts with the internal '/_next' route. https://nextjs.org/docs/messages/public-next-folder-conflict`\n\nexport const SSG_GET_INITIAL_PROPS_CONFLICT = `You can not use getInitialProps with getStaticProps. To use SSG, please remove your getInitialProps`\n\nexport const SERVER_PROPS_GET_INIT_PROPS_CONFLICT = `You can not use getInitialProps with getServerSideProps. Please remove getInitialProps.`\n\nexport const SERVER_PROPS_SSG_CONFLICT = `You can not use getStaticProps or getStaticPaths with getServerSideProps. To use SSG, please remove getServerSideProps`\n\nexport const STATIC_STATUS_PAGE_GET_INITIAL_PROPS_ERROR = `can not have getInitialProps/getServerSideProps, https://nextjs.org/docs/messages/404-get-initial-props`\n\nexport const SERVER_PROPS_EXPORT_ERROR = `pages with \\`getServerSideProps\\` can not be exported. See more info here: https://nextjs.org/docs/messages/gssp-export`\n\nexport const GSP_NO_RETURNED_VALUE =\n 'Your `getStaticProps` function did not return an object. Did you forget to add a `return`?'\nexport const GSSP_NO_RETURNED_VALUE =\n 'Your `getServerSideProps` function did not return an object. Did you forget to add a `return`?'\n\nexport const UNSTABLE_REVALIDATE_RENAME_ERROR =\n 'The `unstable_revalidate` property is available for general use.\\n' +\n 'Please use `revalidate` instead.'\n\nexport const GSSP_COMPONENT_MEMBER_ERROR = `can not be attached to a page's component and must be exported from the page. See more info here: https://nextjs.org/docs/messages/gssp-component-member`\n\nexport const NON_STANDARD_NODE_ENV = `You are using a non-standard \"NODE_ENV\" value in your environment. This creates inconsistencies in the project and is strongly advised against. Read more: https://nextjs.org/docs/messages/non-standard-node-env`\n\nexport const SSG_FALLBACK_EXPORT_ERROR = `Pages with \\`fallback\\` enabled in \\`getStaticPaths\\` can not be exported. See more info here: https://nextjs.org/docs/messages/ssg-fallback-true-export`\n\nexport const ESLINT_DEFAULT_DIRS = ['app', 'pages', 'components', 'lib', 'src']\n\nexport const SERVER_RUNTIME: Record<string, ServerRuntime> = {\n edge: 'edge',\n experimentalEdge: 'experimental-edge',\n nodejs: 'nodejs',\n}\n\nexport const WEB_SOCKET_MAX_RECONNECTIONS = 12\n\n/**\n * The names of the webpack layers. These layers are the primitives for the\n * webpack chunks.\n */\nconst WEBPACK_LAYERS_NAMES = {\n /**\n * The layer for the shared code between the client and server bundles.\n */\n shared: 'shared',\n /**\n * The layer for server-only runtime and picking up `react-server` export conditions.\n * Including app router RSC pages and app router custom routes and metadata routes.\n */\n reactServerComponents: 'rsc',\n /**\n * Server Side Rendering layer for app (ssr).\n */\n serverSideRendering: 'ssr',\n /**\n * The browser client bundle layer for actions.\n */\n actionBrowser: 'action-browser',\n /**\n * The Node.js bundle layer for the API routes.\n */\n apiNode: 'api-node',\n /**\n * The Edge Lite bundle layer for the API routes.\n */\n apiEdge: 'api-edge',\n /**\n * The layer for the middleware code.\n */\n middleware: 'middleware',\n /**\n * The layer for the instrumentation hooks.\n */\n instrument: 'instrument',\n /**\n * The layer for assets on the edge.\n */\n edgeAsset: 'edge-asset',\n /**\n * The browser client bundle layer for App directory.\n */\n appPagesBrowser: 'app-pages-browser',\n /**\n * The browser client bundle layer for Pages directory.\n */\n pagesDirBrowser: 'pages-dir-browser',\n /**\n * The Edge Lite bundle layer for Pages directory.\n */\n pagesDirEdge: 'pages-dir-edge',\n /**\n * The Node.js bundle layer for Pages directory.\n */\n pagesDirNode: 'pages-dir-node',\n} as const\n\nexport type WebpackLayerName =\n (typeof WEBPACK_LAYERS_NAMES)[keyof typeof WEBPACK_LAYERS_NAMES]\n\nconst WEBPACK_LAYERS = {\n ...WEBPACK_LAYERS_NAMES,\n GROUP: {\n builtinReact: [\n WEBPACK_LAYERS_NAMES.reactServerComponents,\n WEBPACK_LAYERS_NAMES.actionBrowser,\n ],\n serverOnly: [\n WEBPACK_LAYERS_NAMES.reactServerComponents,\n WEBPACK_LAYERS_NAMES.actionBrowser,\n WEBPACK_LAYERS_NAMES.instrument,\n WEBPACK_LAYERS_NAMES.middleware,\n ],\n neutralTarget: [\n // pages api\n WEBPACK_LAYERS_NAMES.apiNode,\n WEBPACK_LAYERS_NAMES.apiEdge,\n ],\n clientOnly: [\n WEBPACK_LAYERS_NAMES.serverSideRendering,\n WEBPACK_LAYERS_NAMES.appPagesBrowser,\n ],\n bundled: [\n WEBPACK_LAYERS_NAMES.reactServerComponents,\n WEBPACK_LAYERS_NAMES.actionBrowser,\n WEBPACK_LAYERS_NAMES.serverSideRendering,\n WEBPACK_LAYERS_NAMES.appPagesBrowser,\n WEBPACK_LAYERS_NAMES.shared,\n WEBPACK_LAYERS_NAMES.instrument,\n WEBPACK_LAYERS_NAMES.middleware,\n ],\n appPages: [\n // app router pages and layouts\n WEBPACK_LAYERS_NAMES.reactServerComponents,\n WEBPACK_LAYERS_NAMES.serverSideRendering,\n WEBPACK_LAYERS_NAMES.appPagesBrowser,\n WEBPACK_LAYERS_NAMES.actionBrowser,\n ],\n },\n}\n\nconst WEBPACK_RESOURCE_QUERIES = {\n edgeSSREntry: '__next_edge_ssr_entry__',\n metadata: '__next_metadata__',\n metadataRoute: '__next_metadata_route__',\n metadataImageMeta: '__next_metadata_image_meta__',\n}\n\nexport { WEBPACK_LAYERS, WEBPACK_RESOURCE_QUERIES }\n","/**\n * Contains predefined constants for the trace span name in next/server.\n *\n * Currently, next/server/tracer is internal implementation only for tracking\n * next.js's implementation only with known span names defined here.\n **/\n\n// eslint typescript has a bug with TS enums\n\nenum BaseServerSpan {\n handleRequest = 'BaseServer.handleRequest',\n run = 'BaseServer.run',\n pipe = 'BaseServer.pipe',\n getStaticHTML = 'BaseServer.getStaticHTML',\n render = 'BaseServer.render',\n renderToResponseWithComponents = 'BaseServer.renderToResponseWithComponents',\n renderToResponse = 'BaseServer.renderToResponse',\n renderToHTML = 'BaseServer.renderToHTML',\n renderError = 'BaseServer.renderError',\n renderErrorToResponse = 'BaseServer.renderErrorToResponse',\n renderErrorToHTML = 'BaseServer.renderErrorToHTML',\n render404 = 'BaseServer.render404',\n}\n\nenum LoadComponentsSpan {\n loadDefaultErrorComponents = 'LoadComponents.loadDefaultErrorComponents',\n loadComponents = 'LoadComponents.loadComponents',\n}\n\nenum NextServerSpan {\n getRequestHandler = 'NextServer.getRequestHandler',\n getRequestHandlerWithMetadata = 'NextServer.getRequestHandlerWithMetadata',\n getServer = 'NextServer.getServer',\n getServerRequestHandler = 'NextServer.getServerRequestHandler',\n createServer = 'createServer.createServer',\n}\n\nenum NextNodeServerSpan {\n compression = 'NextNodeServer.compression',\n getBuildId = 'NextNodeServer.getBuildId',\n createComponentTree = 'NextNodeServer.createComponentTree',\n clientComponentLoading = 'NextNodeServer.clientComponentLoading',\n getLayoutOrPageModule = 'NextNodeServer.getLayoutOrPageModule',\n generateStaticRoutes = 'NextNodeServer.generateStaticRoutes',\n generateFsStaticRoutes = 'NextNodeServer.generateFsStaticRoutes',\n generatePublicRoutes = 'NextNodeServer.generatePublicRoutes',\n generateImageRoutes = 'NextNodeServer.generateImageRoutes.route',\n sendRenderResult = 'NextNodeServer.sendRenderResult',\n proxyRequest = 'NextNodeServer.proxyRequest',\n runApi = 'NextNodeServer.runApi',\n render = 'NextNodeServer.render',\n renderHTML = 'NextNodeServer.renderHTML',\n imageOptimizer = 'NextNodeServer.imageOptimizer',\n getPagePath = 'NextNodeServer.getPagePath',\n getRoutesManifest = 'NextNodeServer.getRoutesManifest',\n findPageComponents = 'NextNodeServer.findPageComponents',\n getFontManifest = 'NextNodeServer.getFontManifest',\n getServerComponentManifest = 'NextNodeServer.getServerComponentManifest',\n getRequestHandler = 'NextNodeServer.getRequestHandler',\n renderToHTML = 'NextNodeServer.renderToHTML',\n renderError = 'NextNodeServer.renderError',\n renderErrorToHTML = 'NextNodeServer.renderErrorToHTML',\n render404 = 'NextNodeServer.render404',\n startResponse = 'NextNodeServer.startResponse',\n\n // nested inner span, does not require parent scope name\n route = 'route',\n onProxyReq = 'onProxyReq',\n apiResolver = 'apiResolver',\n internalFetch = 'internalFetch',\n}\n\nenum StartServerSpan {\n startServer = 'startServer.startServer',\n}\n\nenum RenderSpan {\n getServerSideProps = 'Render.getServerSideProps',\n getStaticProps = 'Render.getStaticProps',\n renderToString = 'Render.renderToString',\n renderDocument = 'Render.renderDocument',\n createBodyResult = 'Render.createBodyResult',\n}\n\nenum AppRenderSpan {\n renderToString = 'AppRender.renderToString',\n renderToReadableStream = 'AppRender.renderToReadableStream',\n getBodyResult = 'AppRender.getBodyResult',\n fetch = 'AppRender.fetch',\n}\n\nenum RouterSpan {\n executeRoute = 'Router.executeRoute',\n}\n\nenum NodeSpan {\n runHandler = 'Node.runHandler',\n}\n\nenum AppRouteRouteHandlersSpan {\n runHandler = 'AppRouteRouteHandlers.runHandler',\n}\n\nenum ResolveMetadataSpan {\n generateMetadata = 'ResolveMetadata.generateMetadata',\n generateViewport = 'ResolveMetadata.generateViewport',\n}\n\nenum MiddlewareSpan {\n execute = 'Middleware.execute',\n}\n\ntype SpanTypes =\n | `${BaseServerSpan}`\n | `${LoadComponentsSpan}`\n | `${NextServerSpan}`\n | `${StartServerSpan}`\n | `${NextNodeServerSpan}`\n | `${RenderSpan}`\n | `${RouterSpan}`\n | `${AppRenderSpan}`\n | `${NodeSpan}`\n | `${AppRouteRouteHandlersSpan}`\n | `${ResolveMetadataSpan}`\n | `${MiddlewareSpan}`\n\n// This list is used to filter out spans that are not relevant to the user\nexport const NextVanillaSpanAllowlist = new Set([\n MiddlewareSpan.execute,\n BaseServerSpan.handleRequest,\n RenderSpan.getServerSideProps,\n RenderSpan.getStaticProps,\n AppRenderSpan.fetch,\n AppRenderSpan.getBodyResult,\n RenderSpan.renderDocument,\n NodeSpan.runHandler,\n AppRouteRouteHandlersSpan.runHandler,\n ResolveMetadataSpan.generateMetadata,\n ResolveMetadataSpan.generateViewport,\n NextNodeServerSpan.createComponentTree,\n NextNodeServerSpan.findPageComponents,\n NextNodeServerSpan.getLayoutOrPageModule,\n NextNodeServerSpan.startResponse,\n NextNodeServerSpan.clientComponentLoading,\n])\n\n// These Spans are allowed to be always logged\n// when the otel log prefix env is set\nexport const LogSpanAllowList = new Set([\n NextNodeServerSpan.findPageComponents,\n NextNodeServerSpan.createComponentTree,\n NextNodeServerSpan.clientComponentLoading,\n])\n\nexport {\n BaseServerSpan,\n LoadComponentsSpan,\n NextServerSpan,\n NextNodeServerSpan,\n StartServerSpan,\n RenderSpan,\n RouterSpan,\n AppRenderSpan,\n NodeSpan,\n AppRouteRouteHandlersSpan,\n ResolveMetadataSpan,\n MiddlewareSpan,\n}\n\nexport type { SpanTypes }\n","/**\n * Check to see if a value is Thenable.\n *\n * @param promise the maybe-thenable value\n * @returns true if the value is thenable\n */\nexport function isThenable<T = unknown>(\n promise: Promise<T> | T\n): promise is Promise<T> {\n return (\n promise !== null &&\n typeof promise === 'object' &&\n 'then' in promise &&\n typeof promise.then === 'function'\n )\n}\n","import type { FetchEventResult } from '../../web/types'\nimport type { TextMapSetter } from '@opentelemetry/api'\nimport type { SpanTypes } from './constants'\nimport { LogSpanAllowList, NextVanillaSpanAllowlist } from './constants'\n\nimport type {\n ContextAPI,\n Span,\n SpanOptions,\n Tracer,\n AttributeValue,\n TextMapGetter,\n} from 'next/dist/compiled/@opentelemetry/api'\nimport { isThenable } from '../../../shared/lib/is-thenable'\n\nconst NEXT_OTEL_PERFORMANCE_PREFIX = process.env.NEXT_OTEL_PERFORMANCE_PREFIX\n\nlet api: typeof import('next/dist/compiled/@opentelemetry/api')\n\n// we want to allow users to use their own version of @opentelemetry/api if they\n// want to, so we try to require it first, and if it fails we fall back to the\n// version that is bundled with Next.js\n// this is because @opentelemetry/api has to be synced with the version of\n// @opentelemetry/tracing that is used, and we don't want to force users to use\n// the version that is bundled with Next.js.\n// the API is ~stable, so this should be fine\nif (process.env.NEXT_RUNTIME === 'edge') {\n api = require('@opentelemetry/api') as typeof import('@opentelemetry/api')\n} else {\n try {\n api = require('@opentelemetry/api') as typeof import('@opentelemetry/api')\n } catch (err) {\n api =\n require('next/dist/compiled/@opentelemetry/api') as typeof import('next/dist/compiled/@opentelemetry/api')\n }\n}\n\nconst { context, propagation, trace, SpanStatusCode, SpanKind, ROOT_CONTEXT } =\n api\n\nexport class BubbledError extends Error {\n constructor(\n public readonly bubble?: boolean,\n public readonly result?: FetchEventResult\n ) {\n super()\n }\n}\n\nexport function isBubbledError(error: unknown): error is BubbledError {\n if (typeof error !== 'object' || error === null) return false\n return error instanceof BubbledError\n}\n\nconst closeSpanWithError = (span: Span, error?: Error) => {\n if (isBubbledError(error) && error.bubble) {\n span.setAttribute('next.bubble', true)\n } else {\n if (error) {\n span.recordException(error)\n span.setAttribute('error.type', error.name)\n }\n span.setStatus({ code: SpanStatusCode.ERROR, message: error?.message })\n }\n span.end()\n}\n\ntype TracerSpanOptions = Omit<SpanOptions, 'attributes'> & {\n parentSpan?: Span\n spanName?: string\n attributes?: Partial<Record<AttributeNames, AttributeValue | undefined>>\n hideSpan?: boolean\n}\n\ninterface NextTracer {\n getContext(): ContextAPI\n\n /**\n * Instruments a function by automatically creating a span activated on its\n * scope.\n *\n * The span will automatically be finished when one of these conditions is\n * met:\n *\n * * The function returns a promise, in which case the span will finish when\n * the promise is resolved or rejected.\n * * The function takes a callback as its second parameter, in which case the\n * span will finish when that callback is called.\n * * The function doesn't accept a callback and doesn't return a promise, in\n * which case the span will finish at the end of the function execution.\n *\n */\n trace<T>(\n type: SpanTypes,\n fn: (span?: Span, done?: (error?: Error) => any) => Promise<T>\n ): Promise<T>\n trace<T>(\n type: SpanTypes,\n fn: (span?: Span, done?: (error?: Error) => any) => T\n ): T\n trace<T>(\n type: SpanTypes,\n options: TracerSpanOptions,\n fn: (span?: Span, done?: (error?: Error) => any) => Promise<T>\n ): Promise<T>\n trace<T>(\n type: SpanTypes,\n options: TracerSpanOptions,\n fn: (span?: Span, done?: (error?: Error) => any) => T\n ): T\n\n /**\n * Wrap a function to automatically create a span activated on its\n * scope when it's called.\n *\n * The span will automatically be finished when one of these conditions is\n * met:\n *\n * * The function returns a promise, in which case the span will finish when\n * the promise is resolved or rejected.\n * * The function takes a callback as its last parameter, in which case the\n * span will finish when that callback is called.\n * * The function doesn't accept a callback and doesn't return a promise, in\n * which case the span will finish at the end of the function execution.\n */\n wrap<T = (...args: Array<any>) => any>(type: SpanTypes, fn: T): T\n wrap<T = (...args: Array<any>) => any>(\n type: SpanTypes,\n options: TracerSpanOptions,\n fn: T\n ): T\n wrap<T = (...args: Array<any>) => any>(\n type: SpanTypes,\n options: (...args: any[]) => TracerSpanOptions,\n fn: T\n ): T\n\n /**\n * Starts and returns a new Span representing a logical unit of work.\n *\n * This method do NOT modify the current Context by default. In result, any inner span will not\n * automatically set its parent context to the span created by this method unless manually activate\n * context via `tracer.getContext().with`. `trace`, or `wrap` is generally recommended as it gracefully\n * handles context activation. (ref: https://github.com/open-telemetry/opentelemetry-js/issues/1923)\n */\n startSpan(type: SpanTypes): Span\n startSpan(type: SpanTypes, options: TracerSpanOptions): Span\n\n /**\n * Returns currently activated span if current context is in the scope of the span.\n * Returns undefined otherwise.\n */\n getActiveScopeSpan(): Span | undefined\n\n /**\n * Returns trace propagation data for the currently active context. The format is equal to data provided\n * through the OpenTelemetry propagator API.\n */\n getTracePropagationData(): ClientTraceDataEntry[]\n\n /**\n * Executes a function with the given span set as the active span in the context.\n * This allows child spans created within the function to automatically parent to this span.\n */\n withSpan<T>(span: Span, fn: () => T): T\n}\n\ntype NextAttributeNames =\n | 'next.route'\n | 'next.page'\n | 'next.rsc'\n | 'next.segment'\n | 'next.span_name'\n | 'next.span_type'\n | 'next.clientComponentLoadCount'\ntype OTELAttributeNames = `http.${string}` | `net.${string}`\ntype AttributeNames = NextAttributeNames | OTELAttributeNames\n\n/** we use this map to propagate attributes from nested spans to the top span */\nconst rootSpanAttributesStore = new Map<\n number,\n Map<AttributeNames, AttributeValue | undefined>\n>()\nconst rootSpanIdKey = api.createContextKey('next.rootSpanId')\nlet lastSpanId = 0\nconst getSpanId = () => lastSpanId++\n\nexport interface ClientTraceDataEntry {\n key: string\n value: string\n}\n\nconst clientTraceDataSetter: TextMapSetter<ClientTraceDataEntry[]> = {\n set(carrier, key, value) {\n carrier.push({\n key,\n value,\n })\n },\n}\n\nclass NextTracerImpl implements NextTracer {\n /**\n * Returns an instance to the trace with configured name.\n * Since wrap / trace can be defined in any place prior to actual trace subscriber initialization,\n * This should be lazily evaluated.\n */\n private getTracerInstance(): Tracer {\n return trace.getTracer('next.js', '0.0.1')\n }\n\n public getContext(): ContextAPI {\n return context\n }\n\n public getTracePropagationData(): ClientTraceDataEntry[] {\n const activeContext = context.active()\n const entries: ClientTraceDataEntry[] = []\n propagation.inject(activeContext, entries, clientTraceDataSetter)\n return entries\n }\n\n public getActiveScopeSpan(): Span | undefined {\n return trace.getSpan(context?.active())\n }\n\n public withPropagatedContext<T, C>(\n carrier: C,\n fn: () => T,\n getter?: TextMapGetter<C>\n ): T {\n const activeContext = context.active()\n if (trace.getSpanContext(activeContext)) {\n // Active span is already set, too late to propagate.\n return fn()\n }\n const remoteContext = propagation.extract(activeContext, carrier, getter)\n return context.with(remoteContext, fn)\n }\n\n // Trace, wrap implementation is inspired by datadog trace implementation\n // (https://datadoghq.dev/dd-trace-js/interfaces/tracer.html#trace).\n public trace<T>(\n type: SpanTypes,\n fn: (span?: Span, done?: (error?: Error) => any) => Promise<T>\n ): Promise<T>\n public trace<T>(\n type: SpanTypes,\n fn: (span?: Span, done?: (error?: Error) => any) => T\n ): T\n public trace<T>(\n type: SpanTypes,\n options: TracerSpanOptions,\n fn: (span?: Span, done?: (error?: Error) => any) => Promise<T>\n ): Promise<T>\n public trace<T>(\n type: SpanTypes,\n options: TracerSpanOptions,\n fn: (span?: Span, done?: (error?: Error) => any) => T\n ): T\n public trace<T>(...args: Array<any>) {\n const [type, fnOrOptions, fnOrEmpty] = args\n\n // coerce options form overload\n const {\n fn,\n options,\n }: {\n fn: (span?: Span, done?: (error?: Error) => any) => T | Promise<T>\n options: TracerSpanOptions\n } =\n typeof fnOrOptions === 'function'\n ? {\n fn: fnOrOptions,\n options: {},\n }\n : {\n fn: fnOrEmpty,\n options: { ...fnOrOptions },\n }\n\n const spanName = options.spanName ?? type\n\n if (\n (!NextVanillaSpanAllowlist.has(type) &&\n process.env.NEXT_OTEL_VERBOSE !== '1') ||\n options.hideSpan\n ) {\n return fn()\n }\n\n // Trying to get active scoped span to assign parent. If option specifies parent span manually, will try to use it.\n let spanContext = this.getSpanContext(\n options?.parentSpan ?? this.getActiveScopeSpan()\n )\n\n if (!spanContext) {\n spanContext = context?.active() ?? ROOT_CONTEXT\n }\n // Check if there's already a root span in the store for this trace\n // We are intentionally not checking whether there is an active context\n // from outside of nextjs to ensure that we can provide the same level\n // of telemetry when using a custom server\n const existingRootSpanId = spanContext.getValue(rootSpanIdKey)\n const isRootSpan =\n typeof existingRootSpanId !== 'number' ||\n !rootSpanAttributesStore.has(existingRootSpanId)\n\n const spanId = getSpanId()\n\n options.attributes = {\n 'next.span_name': spanName,\n 'next.span_type': type,\n ...options.attributes,\n }\n\n return context.with(spanContext.setValue(rootSpanIdKey, spanId), () =>\n this.getTracerInstance().startActiveSpan(\n spanName,\n options,\n (span: Span) => {\n let startTime: number | undefined\n if (\n NEXT_OTEL_PERFORMANCE_PREFIX &&\n type &&\n LogSpanAllowList.has(type)\n ) {\n startTime =\n 'performance' in globalThis && 'measure' in performance\n ? globalThis.performance.now()\n : undefined\n }\n\n let cleanedUp = false\n const onCleanup = () => {\n if (cleanedUp) return\n cleanedUp = true\n rootSpanAttributesStore.delete(spanId)\n if (startTime) {\n performance.measure(\n `${NEXT_OTEL_PERFORMANCE_PREFIX}:next-${(\n type.split('.').pop() || ''\n ).replace(\n /[A-Z]/g,\n (match: string) => '-' + match.toLowerCase()\n )}`,\n {\n start: startTime,\n end: performance.now(),\n }\n )\n }\n }\n\n if (isRootSpan) {\n rootSpanAttributesStore.set(\n spanId,\n new Map(\n Object.entries(options.attributes ?? {}) as [\n AttributeNames,\n AttributeValue | undefined,\n ][]\n )\n )\n }\n if (fn.length > 1) {\n try {\n return fn(span, (err) => closeSpanWithError(span, err))\n } catch (err: any) {\n closeSpanWithError(span, err)\n throw err\n } finally {\n onCleanup()\n }\n }\n\n try {\n const result = fn(span)\n if (isThenable(result)) {\n // If there's error make sure it throws\n return result\n .then((res) => {\n span.end()\n // Need to pass down the promise result,\n // it could be react stream response with error { error, stream }\n return res\n })\n .catch((err) => {\n closeSpanWithError(span, err)\n throw err\n })\n .finally(onCleanup)\n } else {\n span.end()\n onCleanup()\n }\n\n return result\n } catch (err: any) {\n closeSpanWithError(span, err)\n onCleanup()\n throw err\n }\n }\n )\n )\n }\n\n public wrap<T = (...args: Array<any>) => any>(type: SpanTypes, fn: T): T\n public wrap<T = (...args: Array<any>) => any>(\n type: SpanTypes,\n options: TracerSpanOptions,\n fn: T\n ): T\n public wrap<T = (...args: Array<any>) => any>(\n type: SpanTypes,\n options: (...args: any[]) => TracerSpanOptions,\n fn: T\n ): T\n public wrap(...args: Array<any>) {\n const tracer = this\n const [name, options, fn] =\n args.length === 3 ? args : [args[0], {}, args[1]]\n\n if (\n !NextVanillaSpanAllowlist.has(name) &&\n process.env.NEXT_OTEL_VERBOSE !== '1'\n ) {\n return fn\n }\n\n return function (this: any) {\n let optionsObj = options\n if (typeof optionsObj === 'function' && typeof fn === 'function') {\n optionsObj = optionsObj.apply(this, arguments)\n }\n\n const lastArgId = arguments.length - 1\n const cb = arguments[lastArgId]\n\n if (typeof cb === 'function') {\n const scopeBoundCb = tracer.getContext().bind(context.active(), cb)\n return tracer.trace(name, optionsObj, (_span, done) => {\n arguments[lastArgId] = function (err: any) {\n done?.(err)\n return scopeBoundCb.apply(this, arguments)\n }\n\n return fn.apply(this, arguments)\n })\n } else {\n return tracer.trace(name, optionsObj, () => fn.apply(this, arguments))\n }\n }\n }\n\n public startSpan(type: SpanTypes): Span\n public startSpan(type: SpanTypes, options: TracerSpanOptions): Span\n public startSpan(...args: Array<any>): Span {\n const [type, options]: [string, TracerSpanOptions | undefined] = args as any\n\n const spanContext = this.getSpanContext(\n options?.parentSpan ?? this.getActiveScopeSpan()\n )\n return this.getTracerInstance().startSpan(type, options, spanContext)\n }\n\n private getSpanContext(parentSpan?: Span) {\n const spanContext = parentSpan\n ? trace.setSpan(context.active(), parentSpan)\n : undefined\n\n return spanContext\n }\n\n public getRootSpanAttributes() {\n const spanId = context.active().getValue(rootSpanIdKey) as number\n return rootSpanAttributesStore.get(spanId)\n }\n\n public setRootSpanAttribute(key: AttributeNames, value: AttributeValue) {\n const spanId = context.active().getValue(rootSpanIdKey) as number\n const attributes = rootSpanAttributesStore.get(spanId)\n if (attributes && !attributes.has(key)) {\n attributes.set(key, value)\n }\n }\n\n public withSpan<T>(span: Span, fn: () => T): T {\n const spanContext = trace.setSpan(context.active(), span)\n return context.with(spanContext, fn)\n }\n}\n\nconst getTracer = (() => {\n const tracer = new NextTracerImpl()\n\n return () => tracer\n})()\n\nexport { getTracer, SpanStatusCode, SpanKind }\nexport type { NextTracer, Span, SpanOptions, ContextAPI, TracerSpanOptions }\n","const noop = () => {}\n\nlet registry: FinalizationRegistry<WeakRef<ReadableStream>> | undefined\n\nif (globalThis.FinalizationRegistry) {\n registry = new FinalizationRegistry((weakRef: WeakRef<ReadableStream>) => {\n const stream = weakRef.deref()\n if (stream && !stream.locked) {\n stream.cancel('Response object has been garbage collected').then(noop)\n }\n })\n}\n\n/**\n * Clones a response by teeing the body so we can return two independent\n * ReadableStreams from it. This avoids the bug in the undici library around\n * response cloning.\n *\n * After cloning, the original response's body will be consumed and closed.\n *\n * @see https://github.com/vercel/next.js/pull/73274\n *\n * @param original - The original response to clone.\n * @returns A tuple containing two independent clones of the original response.\n */\nexport function cloneResponse(original: Response): [Response, Response] {\n // If the response has no body, then we can just return the original response\n // twice because it's immutable.\n if (!original.body) {\n return [original, original]\n }\n\n const [body1, body2] = original.body.tee()\n\n const cloned1 = new Response(body1, {\n status: original.status,\n statusText: original.statusText,\n headers: original.headers,\n })\n\n Object.defineProperty(cloned1, 'url', {\n value: original.url,\n // How the original response.url behaves\n configurable: true,\n enumerable: true,\n writable: false,\n })\n\n // The Fetch Standard allows users to skip consuming the response body by\n // relying on garbage collection to release connection resources.\n // https://github.com/nodejs/undici?tab=readme-ov-file#garbage-collection\n //\n // To cancel the stream you then need to cancel both resulting branches.\n // Teeing a stream will generally lock it for the duration, preventing other\n // readers from locking it.\n // https://developer.mozilla.org/en-US/docs/Web/API/ReadableStream/tee\n\n // cloned2 is stored in a react cache and cloned for subsequent requests.\n // It is the original request, and is is garbage collected by a\n // FinalizationRegistry in Undici, but since we're tee-ing the stream\n // ourselves, we need to cancel clone1's stream (the response returned from\n // our dedupe fetch) when clone1 is reclaimed, otherwise we leak memory.\n if (registry && cloned1.body) {\n registry.register(cloned1, new WeakRef(cloned1.body))\n }\n\n const cloned2 = new Response(body2, {\n status: original.status,\n statusText: original.statusText,\n headers: original.headers,\n })\n\n Object.defineProperty(cloned2, 'url', {\n value: original.url,\n // How the original response.url behaves\n configurable: true,\n enumerable: true,\n writable: false,\n })\n\n return [cloned1, cloned2]\n}\n","/**\n * Based on https://github.com/facebook/react/blob/d4e78c42a94be027b4dc7ed2659a5fddfbf9bd4e/packages/react/src/ReactFetch.js\n */\nimport * as React from 'react'\nimport { cloneResponse } from './clone-response'\nimport { InvariantError } from '../../shared/lib/invariant-error'\n\nconst simpleCacheKey = '[\"GET\",[],null,\"follow\",null,null,null,null]' // generateCacheKey(new Request('https://blank'));\n\n// Headers that should not affect deduplication\n// traceparent and tracestate are used for distributed tracing and should not affect cache keys\nconst headersToExcludeInCacheKey = new Set(['traceparent', 'tracestate'])\n\nfunction generateCacheKey(request: Request): string {\n // We pick the fields that goes into the key used to dedupe requests.\n // We don't include the `cache` field, because we end up using whatever\n // caching resulted from the first request.\n // Notably we currently don't consider non-standard (or future) options.\n // This might not be safe. TODO: warn for non-standard extensions differing.\n // IF YOU CHANGE THIS UPDATE THE simpleCacheKey ABOVE.\n\n const filteredHeaders = Array.from(request.headers.entries()).filter(\n ([key]) => !headersToExcludeInCacheKey.has(key.toLowerCase())\n )\n\n return JSON.stringify([\n request.method,\n filteredHeaders,\n request.mode,\n request.redirect,\n request.credentials,\n request.referrer,\n request.referrerPolicy,\n request.integrity,\n ])\n}\n\ntype CacheEntry = [\n key: string,\n promise: Promise<Response>,\n response: Response | null,\n]\n\nexport function createDedupeFetch(originalFetch: typeof fetch) {\n const getCacheEntries = React.cache(\n // eslint-disable-next-line @typescript-eslint/no-unused-vars -- url is the cache key\n (url: string): CacheEntry[] => []\n )\n\n return function dedupeFetch(\n resource: URL | RequestInfo,\n options?: RequestInit\n ): Promise<Response> {\n if (options && options.signal) {\n // If we're passed a signal, then we assume that\n // someone else controls the lifetime of this object and opts out of\n // caching. It's effectively the opt-out mechanism.\n // Ideally we should be able to check this on the Request but\n // it always gets initialized with its own signal so we don't\n // know if it's supposed to override - unless we also override the\n // Request constructor.\n return originalFetch(resource, options)\n }\n // Normalize the Request\n let url: string\n let cacheKey: string\n if (typeof resource === 'string' && !options) {\n // Fast path.\n cacheKey = simpleCacheKey\n url = resource\n } else {\n // Normalize the request.\n // if resource is not a string or a URL (its an instance of Request)\n // then do not instantiate a new Request but instead\n // reuse the request as to not disturb the body in the event it's a ReadableStream.\n const request =\n typeof resource === 'string' || resource instanceof URL\n ? new Request(resource, options)\n : resource\n if (\n (request.method !== 'GET' && request.method !== 'HEAD') ||\n request.keepalive\n ) {\n // We currently don't dedupe requests that might have side-effects. Those\n // have to be explicitly cached. We assume that the request doesn't have a\n // body if it's GET or HEAD.\n // keepalive gets treated the same as if you passed a custom cache signal.\n return originalFetch(resource, options)\n }\n cacheKey = generateCacheKey(request)\n url = request.url\n }\n\n const cacheEntries = getCacheEntries(url)\n for (let i = 0, j = cacheEntries.length; i < j; i += 1) {\n const [key, promise] = cacheEntries[i]\n if (key === cacheKey) {\n return promise.then(() => {\n const response = cacheEntries[i][2]\n if (!response) throw new InvariantError('No cached response')\n\n // We're cloning the response using this utility because there exists\n // a bug in the undici library around response cloning. See the\n // following pull request for more details:\n // https://github.com/vercel/next.js/pull/73274\n const [cloned1, cloned2] = cloneResponse(response)\n cacheEntries[i][2] = cloned2\n return cloned1\n })\n }\n }\n\n // We pass the original arguments here in case normalizing the Request\n // doesn't include all the options in this environment.\n const promise = originalFetch(resource, options)\n const entry: CacheEntry = [cacheKey, promise, null]\n cacheEntries.push(entry)\n\n return promise.then((response) => {\n // We're cloning the response using this utility because there exists\n // a bug in the undici library around response cloning. See the\n // following pull request for more details:\n // https://github.com/vercel/next.js/pull/73274\n const [cloned1, cloned2] = cloneResponse(response)\n entry[2] = cloned2\n return cloned1\n })\n }\n}\n","import type { OutgoingHttpHeaders } from 'http'\nimport type RenderResult from '../render-result'\nimport type { CacheControl, Revalidate } from '../lib/cache-control'\nimport type { RouteKind } from '../route-kind'\n\nexport interface ResponseCacheBase {\n get(\n key: string | null,\n responseGenerator: ResponseGenerator,\n context: {\n isOnDemandRevalidate?: boolean\n isPrefetch?: boolean\n incrementalCache: IncrementalCache\n /**\n * This is a hint to the cache to help it determine what kind of route\n * this is so it knows where to look up the cache entry from. If not\n * provided it will test the filesystem to check.\n */\n routeKind: RouteKind\n\n /**\n * True if this is a fallback request.\n */\n isFallback?: boolean\n\n /**\n * True if the route is enabled for PPR.\n */\n isRoutePPREnabled?: boolean\n }\n ): Promise<ResponseCacheEntry | null>\n}\n\n// The server components HMR cache might store other data as well in the future,\n// at which point this should be refactored to a discriminated union type.\nexport interface ServerComponentsHmrCache {\n get(key: string): CachedFetchData | undefined\n set(key: string, data: CachedFetchData): void\n}\n\nexport type CachedFetchData = {\n headers: Record<string, string>\n body: string\n url: string\n status?: number\n}\n\nexport const enum CachedRouteKind {\n APP_PAGE = 'APP_PAGE',\n APP_ROUTE = 'APP_ROUTE',\n PAGES = 'PAGES',\n FETCH = 'FETCH',\n REDIRECT = 'REDIRECT',\n IMAGE = 'IMAGE',\n}\n\nexport interface CachedFetchValue {\n kind: CachedRouteKind.FETCH\n data: CachedFetchData\n // tags are only present with file-system-cache\n // fetch cache stores tags outside of cache entry\n tags?: string[]\n revalidate: number\n}\n\nexport interface CachedRedirectValue {\n kind: CachedRouteKind.REDIRECT\n props: Object\n}\n\nexport interface CachedAppPageValue {\n kind: CachedRouteKind.APP_PAGE\n // this needs to be a RenderResult so since renderResponse\n // expects that type instead of a string\n html: RenderResult\n rscData: Buffer | undefined\n status: number | undefined\n postponed: string | undefined\n headers: OutgoingHttpHeaders | undefined\n segmentData: Map<string, Buffer> | undefined\n}\n\nexport interface CachedPageValue {\n kind: CachedRouteKind.PAGES\n // this needs to be a RenderResult so since renderResponse\n // expects that type instead of a string\n html: RenderResult\n pageData: Object\n status: number | undefined\n headers: OutgoingHttpHeaders | undefined\n}\n\nexport interface CachedRouteValue {\n kind: CachedRouteKind.APP_ROUTE\n // this needs to be a RenderResult so since renderResponse\n // expects that type instead of a string\n body: Buffer\n status: number\n headers: OutgoingHttpHeaders\n}\n\nexport interface CachedImageValue {\n kind: CachedRouteKind.IMAGE\n etag: string\n upstreamEtag: string\n buffer: Buffer\n extension: string\n isMiss?: boolean\n isStale?: boolean\n}\n\nexport interface IncrementalCachedAppPageValue {\n kind: CachedRouteKind.APP_PAGE\n // this needs to be a string since the cache expects to store\n // the string value\n html: string\n rscData: Buffer | undefined\n headers: OutgoingHttpHeaders | undefined\n postponed: string | undefined\n status: number | undefined\n segmentData: Map<string, Buffer> | undefined\n}\n\nexport interface IncrementalCachedPageValue {\n kind: CachedRouteKind.PAGES\n // this needs to be a string since the cache expects to store\n // the string value\n html: string\n pageData: Object\n headers: OutgoingHttpHeaders | undefined\n status: number | undefined\n}\n\nexport interface IncrementalResponseCacheEntry {\n cacheControl?: CacheControl\n /**\n * timestamp in milliseconds to revalidate after\n */\n revalidateAfter?: Revalidate\n /**\n * `-1` here dictates a blocking revalidate should be used\n */\n isStale?: boolean | -1\n isMiss?: boolean\n value: Exclude<IncrementalCacheValue, CachedFetchValue> | null\n}\n\nexport interface IncrementalFetchCacheEntry {\n /**\n * `-1` here dictates a blocking revalidate should be used\n */\n isStale?: boolean | -1\n value: CachedFetchValue\n}\n\nexport type IncrementalCacheEntry =\n | IncrementalResponseCacheEntry\n | IncrementalFetchCacheEntry\n\nexport type IncrementalCacheValue =\n | CachedRedirectValue\n | IncrementalCachedPageValue\n | IncrementalCachedAppPageValue\n | CachedImageValue\n | CachedFetchValue\n | CachedRouteValue\n\nexport type ResponseCacheValue =\n | CachedRedirectValue\n | CachedPageValue\n | CachedAppPageValue\n | CachedImageValue\n | CachedRouteValue\n\nexport type ResponseCacheEntry = {\n cacheControl?: CacheControl\n value: ResponseCacheValue | null\n isStale?: boolean | -1\n isMiss?: boolean\n}\n\n/**\n * @param hasResolved whether the responseGenerator has resolved it's promise\n * @param previousCacheEntry the previous cache entry if it exists or the current\n */\nexport type ResponseGenerator = (state: {\n hasResolved: boolean\n previousCacheEntry?: IncrementalResponseCacheEntry | null\n isRevalidating?: boolean\n span?: any\n\n /**\n * When true, this indicates that the response generator is being called in a\n * context where the response must be generated statically.\n *\n * CRITICAL: This should only currently be used when revalidating due to a\n * dynamic RSC request.\n */\n forceStaticRender?: boolean\n}) => Promise<ResponseCacheEntry | null>\n\nexport const enum IncrementalCacheKind {\n APP_PAGE = 'APP_PAGE',\n APP_ROUTE = 'APP_ROUTE',\n PAGES = 'PAGES',\n FETCH = 'FETCH',\n IMAGE = 'IMAGE',\n}\n\nexport interface GetIncrementalFetchCacheContext {\n kind: IncrementalCacheKind.FETCH\n revalidate?: Revalidate\n fetchUrl?: string\n fetchIdx?: number\n tags?: string[]\n softTags?: string[]\n}\n\nexport interface GetIncrementalResponseCacheContext {\n kind: Exclude<IncrementalCacheKind, IncrementalCacheKind.FETCH>\n\n /**\n * True if the route is enabled for PPR.\n */\n isRoutePPREnabled?: boolean\n\n /**\n * True if this is a fallback request.\n */\n isFallback: boolean\n}\n\nexport interface SetIncrementalFetchCacheContext {\n fetchCache: true\n fetchUrl?: string\n fetchIdx?: number\n tags?: string[]\n isImplicitBuildTimeCache?: boolean\n}\n\nexport interface SetIncrementalResponseCacheContext {\n fetchCache?: false\n cacheControl?: CacheControl\n\n /**\n * True if the route is enabled for PPR.\n */\n isRoutePPREnabled?: boolean\n\n /**\n * True if this is a fallback request.\n */\n isFallback?: boolean\n}\n\nexport interface IncrementalResponseCache {\n get(\n cacheKey: string,\n ctx: GetIncrementalResponseCacheContext\n ): Promise<IncrementalResponseCacheEntry | null>\n set(\n key: string,\n data: Exclude<IncrementalCacheValue, CachedFetchValue> | null,\n ctx: SetIncrementalResponseCacheContext\n ): Promise<void>\n}\n\nexport interface IncrementalCache extends IncrementalResponseCache {\n get(\n cacheKey: string,\n ctx: GetIncrementalFetchCacheContext\n ): Promise<IncrementalFetchCacheEntry | null>\n get(\n cacheKey: string,\n ctx: GetIncrementalResponseCacheContext\n ): Promise<IncrementalResponseCacheEntry | null>\n set(\n key: string,\n data: CachedFetchValue | null,\n ctx: SetIncrementalFetchCacheContext\n ): Promise<void>\n set(\n key: string,\n data: Exclude<IncrementalCacheValue, CachedFetchValue> | null,\n ctx: SetIncrementalResponseCacheContext\n ): Promise<void>\n revalidateTag(\n tags: string | string[],\n durations?: { expire?: number }\n ): Promise<void>\n}\n","/**\n * A `Promise.withResolvers` implementation that exposes the `resolve` and\n * `reject` functions on a `Promise`.\n *\n * @see https://tc39.es/proposal-promise-with-resolvers/\n */\nexport class DetachedPromise<T = any> {\n public readonly resolve: (value: T | PromiseLike<T>) => void\n public readonly reject: (reason: any) => void\n public readonly promise: Promise<T>\n\n constructor() {\n let resolve: (value: T | PromiseLike<T>) => void\n let reject: (reason: any) => void\n\n // Create the promise and assign the resolvers to the object.\n this.promise = new Promise<T>((res, rej) => {\n resolve = res\n reject = rej\n })\n\n // We know that resolvers is defined because the Promise constructor runs\n // synchronously.\n this.resolve = resolve!\n this.reject = reject!\n }\n}\n","import type { SchedulerFn } from './scheduler'\n\nimport { DetachedPromise } from './detached-promise'\n\ntype CacheKeyFn<K, C extends string | number | null> = (\n key: K\n) => PromiseLike<C> | C\n\ntype BatcherOptions<K, C extends string | number | null> = {\n cacheKeyFn?: CacheKeyFn<K, C>\n schedulerFn?: SchedulerFn<void>\n}\n\ntype WorkFnContext<V, K> = {\n resolve: (value: V | PromiseLike<V>) => void\n key: K\n}\n\ntype WorkFn<V, K> = (context: WorkFnContext<V, K>) => Promise<V>\n\n/**\n * A wrapper for a function that will only allow one call to the function to\n * execute at a time.\n */\nexport class Batcher<K, V, C extends string | number | null> {\n private readonly pending = new Map<C, Promise<V>>()\n\n protected constructor(\n private readonly cacheKeyFn?: CacheKeyFn<K, C>,\n /**\n * A function that will be called to schedule the wrapped function to be\n * executed. This defaults to a function that will execute the function\n * immediately.\n */\n private readonly schedulerFn: SchedulerFn<void> = (fn) => fn()\n ) {}\n\n /**\n * Creates a new instance of PendingWrapper. If the key extends a string or\n * number, the key will be used as the cache key. If the key is an object, a\n * cache key function must be provided.\n */\n public static create<K extends string | number | null, V>(\n options?: BatcherOptions<K, K>\n ): Batcher<K, V, K>\n public static create<K, V, C extends string | number | null>(\n options: BatcherOptions<K, C> &\n Required<Pick<BatcherOptions<K, C>, 'cacheKeyFn'>>\n ): Batcher<K, V, C>\n public static create<K, V, C extends string | number | null>(\n options?: BatcherOptions<K, C>\n ): Batcher<K, V, C> {\n return new Batcher<K, V, C>(options?.cacheKeyFn, options?.schedulerFn)\n }\n\n /**\n * Wraps a function in a promise that will be resolved or rejected only once\n * for a given key. This will allow multiple calls to the function to be\n * made, but only one will be executed at a time. The result of the first\n * call will be returned to all callers.\n *\n * @param key the key to use for the cache\n * @param fn the function to wrap\n * @returns a promise that resolves to the result of the function\n */\n public async batch(key: K, fn: WorkFn<V, K>): Promise<V> {\n const cacheKey = (this.cacheKeyFn ? await this.cacheKeyFn(key) : key) as C\n if (cacheKey === null) {\n return fn({ resolve: (value) => Promise.resolve(value), key })\n }\n\n const pending = this.pending.get(cacheKey)\n if (pending) return pending\n\n const { promise, resolve, reject } = new DetachedPromise<V>()\n this.pending.set(cacheKey, promise)\n\n this.schedulerFn(async () => {\n try {\n const result = await fn({ resolve, key })\n\n // Resolving a promise multiple times is a no-op, so we can safely\n // resolve all pending promises with the same result.\n resolve(result)\n } catch (err) {\n reject(err)\n } finally {\n this.pending.delete(cacheKey)\n }\n })\n\n return promise\n }\n}\n","/**\n * Node in the doubly-linked list used for LRU tracking.\n * Each node represents a cache entry with bidirectional pointers.\n */\nclass LRUNode<T> {\n public readonly key: string\n public data: T\n public size: number\n public prev: LRUNode<T> | SentinelNode<T> | null = null\n public next: LRUNode<T> | SentinelNode<T> | null = null\n\n constructor(key: string, data: T, size: number) {\n this.key = key\n this.data = data\n this.size = size\n }\n}\n\n/**\n * Sentinel node used for head/tail boundaries.\n * These nodes don't contain actual cache data but simplify list operations.\n */\nclass SentinelNode<T> {\n public prev: LRUNode<T> | SentinelNode<T> | null = null\n public next: LRUNode<T> | SentinelNode<T> | null = null\n}\n\n/**\n * LRU (Least Recently Used) Cache implementation using a doubly-linked list\n * and hash map for O(1) operations.\n *\n * Algorithm:\n * - Uses a doubly-linked list to maintain access order (most recent at head)\n * - Hash map provides O(1) key-to-node lookup\n * - Sentinel head/tail nodes simplify edge case handling\n * - Size-based eviction supports custom size calculation functions\n *\n * Data Structure Layout:\n * HEAD <-> [most recent] <-> ... <-> [least recent] <-> TAIL\n *\n * Operations:\n * - get(): Move accessed node to head (mark as most recent)\n * - set(): Add new node at head, evict from tail if over capacity\n * - Eviction: Remove least recent node (tail.prev) when size exceeds limit\n */\nexport class LRUCache<T> {\n private readonly cache: Map<string, LRUNode<T>> = new Map()\n private readonly head: SentinelNode<T>\n private readonly tail: SentinelNode<T>\n private totalSize: number = 0\n private readonly maxSize: number\n private readonly calculateSize: ((value: T) => number) | undefined\n private readonly onEvict: ((key: string, value: T) => void) | undefined\n\n constructor(\n maxSize: number,\n calculateSize?: (value: T) => number,\n onEvict?: (key: string, value: T) => void\n ) {\n this.maxSize = maxSize\n this.calculateSize = calculateSize\n this.onEvict = onEvict\n\n // Create sentinel nodes to simplify doubly-linked list operations\n // HEAD <-> TAIL (empty list)\n this.head = new SentinelNode<T>()\n this.tail = new SentinelNode<T>()\n this.head.next = this.tail\n this.tail.prev = this.head\n }\n\n /**\n * Adds a node immediately after the head (marks as most recently used).\n * Used when inserting new items or when an item is accessed.\n * PRECONDITION: node must be disconnected (prev/next should be null)\n */\n private addToHead(node: LRUNode<T>): void {\n node.prev = this.head\n node.next = this.head.next\n // head.next is always non-null (points to tail or another node)\n this.head.next!.prev = node\n this.head.next = node\n }\n\n /**\n * Removes a node from its current position in the doubly-linked list.\n * Updates the prev/next pointers of adjacent nodes to maintain list integrity.\n * PRECONDITION: node must be connected (prev/next are non-null)\n */\n private removeNode(node: LRUNode<T>): void {\n // Connected nodes always have non-null prev/next\n node.prev!.next = node.next\n node.next!.prev = node.prev\n }\n\n /**\n * Moves an existing node to the head position (marks as most recently used).\n * This is the core LRU operation - accessed items become most recent.\n */\n private moveToHead(node: LRUNode<T>): void {\n this.removeNode(node)\n this.addToHead(node)\n }\n\n /**\n * Removes and returns the least recently used node (the one before tail).\n * This is called during eviction when the cache exceeds capacity.\n * PRECONDITION: cache is not empty (ensured by caller)\n */\n private removeTail(): LRUNode<T> {\n const lastNode = this.tail.prev as LRUNode<T>\n // tail.prev is always non-null and always LRUNode when cache is not empty\n this.removeNode(lastNode)\n return lastNode\n }\n\n /**\n * Sets a key-value pair in the cache.\n * If the key exists, updates the value and moves to head.\n * If new, adds at head and evicts from tail if necessary.\n *\n * Time Complexity:\n * - O(1) for uniform item sizes\n * - O(k) where k is the number of items evicted (can be O(N) for variable sizes)\n */\n public set(key: string, value: T): void {\n const size = this.calculateSize?.(value) ?? 1\n if (size > this.maxSize) {\n console.warn('Single item size exceeds maxSize')\n return\n }\n\n const existing = this.cache.get(key)\n if (existing) {\n // Update existing node: adjust size and move to head (most recent)\n existing.data = value\n this.totalSize = this.totalSize - existing.size + size\n existing.size = size\n this.moveToHead(existing)\n } else {\n // Add new node at head (most recent position)\n const newNode = new LRUNode(key, value, size)\n this.cache.set(key, newNode)\n this.addToHead(newNode)\n this.totalSize += size\n }\n\n // Evict least recently used items until under capacity\n while (this.totalSize > this.maxSize && this.cache.size > 0) {\n const tail = this.removeTail()\n this.cache.delete(tail.key)\n this.totalSize -= tail.size\n this.onEvict?.(tail.key, tail.data)\n }\n }\n\n /**\n * Checks if a key exists in the cache.\n * This is a pure query operation - does NOT update LRU order.\n *\n * Time Complexity: O(1)\n */\n public has(key: string): boolean {\n return this.cache.has(key)\n }\n\n /**\n * Retrieves a value by key and marks it as most recently used.\n * Moving to head maintains the LRU property for future evictions.\n *\n * Time Complexity: O(1)\n */\n public get(key: string): T | undefined {\n const node = this.cache.get(key)\n if (!node) return undefined\n\n // Mark as most recently used by moving to head\n this.moveToHead(node)\n\n return node.data\n }\n\n /**\n * Returns an iterator over the cache entries. The order is outputted in the\n * order of most recently used to least recently used.\n */\n public *[Symbol.iterator](): IterableIterator<[string, T]> {\n let current = this.head.next\n while (current && current !== this.tail) {\n // Between head and tail, current is always LRUNode\n const node = current as LRUNode<T>\n yield [node.key, node.data]\n current = current.next\n }\n }\n\n /**\n * Removes a specific key from the cache.\n * Updates both the hash map and doubly-linked list.\n *\n * Note: This is an explicit removal and does NOT trigger the `onEvict`\n * callback. Use this for intentional deletions where eviction tracking\n * is not needed.\n *\n * Time Complexity: O(1)\n */\n public remove(key: string): void {\n const node = this.cache.get(key)\n if (!node) return\n\n this.removeNode(node)\n this.cache.delete(key)\n this.totalSize -= node.size\n }\n\n /**\n * Returns the number of items in the cache.\n */\n public get size(): number {\n return this.cache.size\n }\n\n /**\n * Returns the current total size of all cached items.\n * This uses the custom size calculation if provided.\n */\n public get currentSize(): number {\n return this.totalSize\n }\n}\n","// ISC License\n\n// Copyright (c) 2021 Alexey Raspopov, Kostiantyn Denysov, Anton Verinov\n\n// Permission to use, copy, modify, and/or distribute this software for any\n// purpose with or without fee is hereby granted, provided that the above\n// copyright notice and this permission notice appear in all copies.\n\n// THE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES\n// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF\n// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR\n// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES\n// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN\n// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF\n// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.\n//\n// https://github.com/alexeyraspopov/picocolors/blob/b6261487e7b81aaab2440e397a356732cad9e342/picocolors.js#L1\n\nconst { env, stdout } = globalThis?.process ?? {}\n\nconst enabled =\n env &&\n !env.NO_COLOR &&\n (env.FORCE_COLOR || (stdout?.isTTY && !env.CI && env.TERM !== 'dumb'))\n\nconst replaceClose = (\n str: string,\n close: string,\n replace: string,\n index: number\n): string => {\n const start = str.substring(0, index) + replace\n const end = str.substring(index + close.length)\n const nextIndex = end.indexOf(close)\n return ~nextIndex\n ? start + replaceClose(end, close, replace, nextIndex)\n : start + end\n}\n\nconst formatter = (open: string, close: string, replace = open) => {\n if (!enabled) return String\n return (input: string) => {\n const string = '' + input\n const index = string.indexOf(close, open.length)\n return ~index\n ? open + replaceClose(string, close, replace, index) + close\n : open + string + close\n }\n}\n\nexport const reset = enabled ? (s: string) => `\\x1b[0m${s}\\x1b[0m` : String\nexport const bold = formatter('\\x1b[1m', '\\x1b[22m', '\\x1b[22m\\x1b[1m')\nexport const dim = formatter('\\x1b[2m', '\\x1b[22m', '\\x1b[22m\\x1b[2m')\nexport const italic = formatter('\\x1b[3m', '\\x1b[23m')\nexport const underline = formatter('\\x1b[4m', '\\x1b[24m')\nexport const inverse = formatter('\\x1b[7m', '\\x1b[27m')\nexport const hidden = formatter('\\x1b[8m', '\\x1b[28m')\nexport const strikethrough = formatter('\\x1b[9m', '\\x1b[29m')\nexport const black = formatter('\\x1b[30m', '\\x1b[39m')\nexport const red = formatter('\\x1b[31m', '\\x1b[39m')\nexport const green = formatter('\\x1b[32m', '\\x1b[39m')\nexport const yellow = formatter('\\x1b[33m', '\\x1b[39m')\nexport const blue = formatter('\\x1b[34m', '\\x1b[39m')\nexport const magenta = formatter('\\x1b[35m', '\\x1b[39m')\nexport const purple = formatter('\\x1b[38;2;173;127;168m', '\\x1b[39m')\nexport const cyan = formatter('\\x1b[36m', '\\x1b[39m')\nexport const white = formatter('\\x1b[37m', '\\x1b[39m')\nexport const gray = formatter('\\x1b[90m', '\\x1b[39m')\nexport const bgBlack = formatter('\\x1b[40m', '\\x1b[49m')\nexport const bgRed = formatter('\\x1b[41m', '\\x1b[49m')\nexport const bgGreen = formatter('\\x1b[42m', '\\x1b[49m')\nexport const bgYellow = formatter('\\x1b[43m', '\\x1b[49m')\nexport const bgBlue = formatter('\\x1b[44m', '\\x1b[49m')\nexport const bgMagenta = formatter('\\x1b[45m', '\\x1b[49m')\nexport const bgCyan = formatter('\\x1b[46m', '\\x1b[49m')\nexport const bgWhite = formatter('\\x1b[47m', '\\x1b[49m')\n","import { bold, green, magenta, red, yellow, white } from '../../lib/picocolors'\nimport { LRUCache } from '../../server/lib/lru-cache'\n\nexport const prefixes = {\n wait: white(bold('○')),\n error: red(bold('⨯')),\n warn: yellow(bold('⚠')),\n ready: '▲', // no color\n info: white(bold(' ')),\n event: green(bold('✓')),\n trace: magenta(bold('»')),\n} as const\n\nconst LOGGING_METHOD = {\n log: 'log',\n warn: 'warn',\n error: 'error',\n} as const\n\nfunction prefixedLog(prefixType: keyof typeof prefixes, ...message: any[]) {\n if ((message[0] === '' || message[0] === undefined) && message.length === 1) {\n message.shift()\n }\n\n const consoleMethod: keyof typeof LOGGING_METHOD =\n prefixType in LOGGING_METHOD\n ? LOGGING_METHOD[prefixType as keyof typeof LOGGING_METHOD]\n : 'log'\n\n const prefix = prefixes[prefixType]\n // If there's no message, don't print the prefix but a new line\n if (message.length === 0) {\n console[consoleMethod]('')\n } else {\n // Ensure if there's ANSI escape codes it's concatenated into one string.\n // Chrome DevTool can only handle color if it's in one string.\n if (message.length === 1 && typeof message[0] === 'string') {\n console[consoleMethod](prefix + ' ' + message[0])\n } else {\n console[consoleMethod](prefix, ...message)\n }\n }\n}\n\nexport function bootstrap(message: string) {\n console.log(message)\n}\n\nexport function wait(...message: any[]) {\n prefixedLog('wait', ...message)\n}\n\nexport function error(...message: any[]) {\n prefixedLog('error', ...message)\n}\n\nexport function warn(...message: any[]) {\n prefixedLog('warn', ...message)\n}\n\nexport function ready(...message: any[]) {\n prefixedLog('ready', ...message)\n}\n\nexport function info(...message: any[]) {\n prefixedLog('info', ...message)\n}\n\nexport function event(...message: any[]) {\n prefixedLog('event', ...message)\n}\n\nexport function trace(...message: any[]) {\n prefixedLog('trace', ...message)\n}\n\nconst warnOnceCache = new LRUCache<string>(10_000, (value) => value.length)\nexport function warnOnce(...message: any[]) {\n const key = message.join(' ')\n if (!warnOnceCache.has(key)) {\n warnOnceCache.set(key, key)\n warn(...message)\n }\n}\n\nconst errorOnceCache = new LRUCache<string>(10_000, (value) => value.length)\nexport function errorOnce(...message: any[]) {\n const key = message.join(' ')\n if (!errorOnceCache.has(key)) {\n errorOnceCache.set(key, key)\n error(...message)\n }\n}\n","export const ENCODED_TAGS = {\n // opening tags do not have the closing `>` since they can contain other attributes such as `<body className=''>`\n OPENING: {\n // <html\n HTML: new Uint8Array([60, 104, 116, 109, 108]),\n // <body\n BODY: new Uint8Array([60, 98, 111, 100, 121]),\n },\n CLOSED: {\n // </head>\n HEAD: new Uint8Array([60, 47, 104, 101, 97, 100, 62]),\n // </body>\n BODY: new Uint8Array([60, 47, 98, 111, 100, 121, 62]),\n // </html>\n HTML: new Uint8Array([60, 47, 104, 116, 109, 108, 62]),\n // </body></html>\n BODY_AND_HTML: new Uint8Array([\n 60, 47, 98, 111, 100, 121, 62, 60, 47, 104, 116, 109, 108, 62,\n ]),\n },\n META: {\n // Only the match the prefix cause the suffix can be different wether it's xml compatible or not \">\" or \"/>\"\n // <meta name=\"«nxt-icon»\"\n // This is a special mark that will be replaced by the icon insertion script tag.\n ICON_MARK: new Uint8Array([\n 60, 109, 101, 116, 97, 32, 110, 97, 109, 101, 61, 34, 194, 171, 110, 120,\n 116, 45, 105, 99, 111, 110, 194, 187, 34,\n ]),\n },\n} as const\n","/**\n * Find the starting index of Uint8Array `b` within Uint8Array `a`.\n */\nexport function indexOfUint8Array(a: Uint8Array, b: Uint8Array) {\n if (b.length === 0) return 0\n if (a.length === 0 || b.length > a.length) return -1\n\n // start iterating through `a`\n for (let i = 0; i <= a.length - b.length; i++) {\n let completeMatch = true\n // from index `i`, iterate through `b` and check for mismatch\n for (let j = 0; j < b.length; j++) {\n // if the values do not match, then this isn't a complete match, exit `b` iteration early and iterate to next index of `a`.\n if (a[i + j] !== b[j]) {\n completeMatch = false\n break\n }\n }\n\n if (completeMatch) {\n return i\n }\n }\n\n return -1\n}\n\n/**\n * Check if two Uint8Arrays are strictly equivalent.\n */\nexport function isEquivalentUint8Arrays(a: Uint8Array, b: Uint8Array) {\n if (a.length !== b.length) return false\n\n for (let i = 0; i < a.length; i++) {\n if (a[i] !== b[i]) return false\n }\n\n return true\n}\n\n/**\n * Remove Uint8Array `b` from Uint8Array `a`.\n *\n * If `b` is not in `a`, `a` is returned unchanged.\n *\n * Otherwise, the function returns a new Uint8Array instance with size `a.length - b.length`\n */\nexport function removeFromUint8Array(a: Uint8Array, b: Uint8Array) {\n const tagIndex = indexOfUint8Array(a, b)\n if (tagIndex === 0) return a.subarray(b.length)\n if (tagIndex > -1) {\n const removed = new Uint8Array(a.length - b.length)\n removed.set(a.slice(0, tagIndex))\n removed.set(a.slice(tagIndex + b.length), tagIndex)\n return removed\n } else {\n return a\n }\n}\n","export const MISSING_ROOT_TAGS_ERROR = 'NEXT_MISSING_ROOT_TAGS'\n","// In output: export mode, the build id is added to the start of the HTML\n// document, directly after the doctype declaration. During a prefetch, the\n// client performs a range request to get the build id, so it can check whether\n// the target page belongs to the same build.\n//\n// The first 64 bytes of the document are requested. The exact number isn't\n// too important; it must be larger than the build id + doctype + closing and\n// ending comment markers, but it doesn't need to match the end of the\n// comment exactly.\n//\n// Build ids are 21 bytes long in the default implementation, though this\n// can be overridden in the Next.js config. For the purposes of this check,\n// it's OK to only match the start of the id, so we'll truncate it if exceeds\n// a certain length.\n\nconst DOCTYPE_PREFIX = '<!DOCTYPE html>' // 15 bytes\nconst MAX_BUILD_ID_LENGTH = 24\n\nfunction escapeBuildId(buildId: string) {\n // If the build id is longer than the given limit, it's OK for our purposes\n // to only match the beginning.\n const truncated = buildId.slice(0, MAX_BUILD_ID_LENGTH)\n // Replace hyphens with underscores so it doesn't break the HTML comment.\n // (Unlikely, but if this did happen it would break the whole document.)\n return truncated.replace(/-/g, '_')\n}\n\nexport function insertBuildIdComment(originalHtml: string, buildId: string) {\n if (\n // Skip if the build id contains a closing comment marker.\n buildId.includes('-->') ||\n // React always inserts a doctype at the start of the document. Skip if it\n // isn't present. Shouldn't happen; suggests an issue elsewhere.\n !originalHtml.startsWith(DOCTYPE_PREFIX)\n ) {\n // Return the original HTML unchanged. This means the document will not\n // be prefetched.\n // TODO: The build id comment is currently only used during prefetches, but\n // if we eventually use this mechanism for regular navigations, we may need\n // to error during build if we fail to insert it for some reason.\n return originalHtml\n }\n // The comment must be inserted after the doctype.\n return originalHtml.replace(\n DOCTYPE_PREFIX,\n DOCTYPE_PREFIX + '<!--' + escapeBuildId(buildId) + '-->'\n )\n}\n","export const RSC_HEADER = 'rsc' as const\nexport const ACTION_HEADER = 'next-action' as const\n// TODO: Instead of sending the full router state, we only need to send the\n// segment path. Saves bytes. Then we could also use this field for segment\n// prefetches, which also need to specify a particular segment.\nexport const NEXT_ROUTER_STATE_TREE_HEADER = 'next-router-state-tree' as const\nexport const NEXT_ROUTER_PREFETCH_HEADER = 'next-router-prefetch' as const\n// This contains the path to the segment being prefetched.\n// TODO: If we change next-router-state-tree to be a segment path, we can use\n// that instead. Then next-router-prefetch and next-router-segment-prefetch can\n// be merged into a single enum.\nexport const NEXT_ROUTER_SEGMENT_PREFETCH_HEADER =\n 'next-router-segment-prefetch' as const\nexport const NEXT_HMR_REFRESH_HEADER = 'next-hmr-refresh' as const\nexport const NEXT_HMR_REFRESH_HASH_COOKIE = '__next_hmr_refresh_hash__' as const\nexport const NEXT_URL = 'next-url' as const\nexport const RSC_CONTENT_TYPE_HEADER = 'text/x-component' as const\n\nexport const FLIGHT_HEADERS = [\n RSC_HEADER,\n NEXT_ROUTER_STATE_TREE_HEADER,\n NEXT_ROUTER_PREFETCH_HEADER,\n NEXT_HMR_REFRESH_HEADER,\n NEXT_ROUTER_SEGMENT_PREFETCH_HEADER,\n] as const\n\nexport const NEXT_RSC_UNION_QUERY = '_rsc' as const\n\nexport const NEXT_ROUTER_STALE_TIME_HEADER = 'x-nextjs-stale-time' as const\nexport const NEXT_DID_POSTPONE_HEADER = 'x-nextjs-postponed' as const\nexport const NEXT_REWRITTEN_PATH_HEADER = 'x-nextjs-rewritten-path' as const\nexport const NEXT_REWRITTEN_QUERY_HEADER = 'x-nextjs-rewritten-query' as const\nexport const NEXT_IS_PRERENDER_HEADER = 'x-nextjs-prerender' as const\nexport const NEXT_ACTION_NOT_FOUND_HEADER = 'x-nextjs-action-not-found' as const\nexport const NEXT_REQUEST_ID_HEADER = 'x-nextjs-request-id' as const\nexport const NEXT_HTML_REQUEST_ID_HEADER = 'x-nextjs-html-request-id' as const\n\n// TODO: Should this include nextjs in the name, like the others?\nexport const NEXT_ACTION_REVALIDATED_HEADER = 'x-action-revalidated' as const\n","// http://www.cse.yorku.ca/~oz/hash.html\n// More specifically, 32-bit hash via djbxor\n// (ref: https://gist.github.com/eplawless/52813b1d8ad9af510d85?permalink_comment_id=3367765#gistcomment-3367765)\n// This is due to number type differences between rust for turbopack to js number types,\n// where rust does not have easy way to repreesnt js's 53-bit float number type for the matching\n// overflow behavior. This is more `correct` in terms of having canonical hash across different runtime / implementation\n// as can gaurantee determinstic output from 32bit hash.\nexport function djb2Hash(str: string) {\n let hash = 5381\n for (let i = 0; i < str.length; i++) {\n const char = str.charCodeAt(i)\n hash = ((hash << 5) + hash + char) & 0xffffffff\n }\n return hash >>> 0\n}\n\nexport function hexHash(str: string) {\n return djb2Hash(str).toString(36).slice(0, 5)\n}\n","import { hexHash } from '../../hash'\n\nexport function computeCacheBustingSearchParam(\n prefetchHeader: '1' | '2' | '0' | undefined,\n segmentPrefetchHeader: string | string[] | undefined,\n stateTreeHeader: string | string[] | undefined,\n nextUrlHeader: string | string[] | undefined\n): string {\n if (\n (prefetchHeader === undefined || prefetchHeader === '0') &&\n segmentPrefetchHeader === undefined &&\n stateTreeHeader === undefined &&\n nextUrlHeader === undefined\n ) {\n return ''\n }\n return hexHash(\n [\n prefetchHeader || '0',\n segmentPrefetchHeader || '0',\n stateTreeHeader || '0',\n nextUrlHeader || '0',\n ].join(',')\n )\n}\n","import type { ReactDOMServerReadableStream } from 'react-dom/server'\nimport { getTracer } from '../lib/trace/tracer'\nimport { AppRenderSpan } from '../lib/trace/constants'\nimport { DetachedPromise } from '../../lib/detached-promise'\nimport {\n scheduleImmediate,\n atLeastOneTask,\n waitAtLeastOneReactRenderTask,\n} from '../../lib/scheduler'\nimport { ENCODED_TAGS } from './encoded-tags'\nimport {\n indexOfUint8Array,\n isEquivalentUint8Arrays,\n removeFromUint8Array,\n} from './uint8array-helpers'\nimport { MISSING_ROOT_TAGS_ERROR } from '../../shared/lib/errors/constants'\nimport { insertBuildIdComment } from '../../shared/lib/segment-cache/output-export-prefetch-encoding'\nimport {\n RSC_HEADER,\n NEXT_ROUTER_PREFETCH_HEADER,\n NEXT_ROUTER_SEGMENT_PREFETCH_HEADER,\n NEXT_RSC_UNION_QUERY,\n} from '../../client/components/app-router-headers'\nimport { computeCacheBustingSearchParam } from '../../shared/lib/router/utils/cache-busting-search-param'\n\nfunction voidCatch() {\n // this catcher is designed to be used with pipeTo where we expect the underlying\n // pipe implementation to forward errors but we don't want the pipeTo promise to reject\n // and be unhandled\n}\n\n// We can share the same encoder instance everywhere\n// Notably we cannot do the same for TextDecoder because it is stateful\n// when handling streaming data\nconst encoder = new TextEncoder()\n\nexport function chainStreams<T>(\n ...streams: ReadableStream<T>[]\n): ReadableStream<T> {\n // If we have no streams, return an empty stream. This behavior is\n // intentional as we're now providing the `RenderResult.EMPTY` value.\n if (streams.length === 0) {\n return new ReadableStream<T>({\n start(controller) {\n controller.close()\n },\n })\n }\n\n // If we only have 1 stream we fast path it by returning just this stream\n if (streams.length === 1) {\n return streams[0]\n }\n\n const { readable, writable } = new TransformStream()\n\n // We always initiate pipeTo immediately. We know we have at least 2 streams\n // so we need to avoid closing the writable when this one finishes.\n let promise = streams[0].pipeTo(writable, { preventClose: true })\n\n let i = 1\n for (; i < streams.length - 1; i++) {\n const nextStream = streams[i]\n promise = promise.then(() =>\n nextStream.pipeTo(writable, { preventClose: true })\n )\n }\n\n // We can omit the length check because we halted before the last stream and there\n // is at least two streams so the lastStream here will always be defined\n const lastStream = streams[i]\n promise = promise.then(() => lastStream.pipeTo(writable))\n\n // Catch any errors from the streams and ignore them, they will be handled\n // by whatever is consuming the readable stream.\n promise.catch(voidCatch)\n\n return readable\n}\n\nexport function streamFromString(str: string): ReadableStream<Uint8Array> {\n return new ReadableStream({\n start(controller) {\n controller.enqueue(encoder.encode(str))\n controller.close()\n },\n })\n}\n\nexport function streamFromBuffer(chunk: Buffer): ReadableStream<Uint8Array> {\n return new ReadableStream({\n start(controller) {\n controller.enqueue(chunk)\n controller.close()\n },\n })\n}\n\nasync function streamToChunks(\n stream: ReadableStream<Uint8Array>\n): Promise<Array<Uint8Array>> {\n const reader = stream.getReader()\n const chunks: Array<Uint8Array> = []\n\n while (true) {\n const { done, value } = await reader.read()\n if (done) {\n break\n }\n\n chunks.push(value)\n }\n\n return chunks\n}\n\nfunction concatUint8Arrays(chunks: Array<Uint8Array>): Uint8Array {\n const totalLength = chunks.reduce((sum, chunk) => sum + chunk.length, 0)\n const result = new Uint8Array(totalLength)\n let offset = 0\n for (const chunk of chunks) {\n result.set(chunk, offset)\n offset += chunk.length\n }\n return result\n}\n\nexport async function streamToUint8Array(\n stream: ReadableStream<Uint8Array>\n): Promise<Uint8Array> {\n return concatUint8Arrays(await streamToChunks(stream))\n}\n\nexport async function streamToBuffer(\n stream: ReadableStream<Uint8Array>\n): Promise<Buffer> {\n return Buffer.concat(await streamToChunks(stream))\n}\n\nexport async function streamToString(\n stream: ReadableStream<Uint8Array>,\n signal?: AbortSignal\n): Promise<string> {\n const decoder = new TextDecoder('utf-8', { fatal: true })\n let string = ''\n\n for await (const chunk of stream) {\n if (signal?.aborted) {\n return string\n }\n\n string += decoder.decode(chunk, { stream: true })\n }\n\n string += decoder.decode()\n\n return string\n}\n\nexport type BufferedTransformOptions = {\n /**\n * Flush synchronously once the buffer reaches this many bytes.\n */\n readonly maxBufferByteLength?: number\n}\n\nexport function createBufferedTransformStream(\n options: BufferedTransformOptions = {}\n): TransformStream<Uint8Array, Uint8Array> {\n const { maxBufferByteLength = Infinity } = options\n\n let bufferedChunks: Array<Uint8Array> = []\n let bufferByteLength: number = 0\n let pending: DetachedPromise<void> | undefined\n\n const flush = (controller: TransformStreamDefaultController) => {\n try {\n if (bufferedChunks.length === 0) {\n return\n }\n\n const chunk = new Uint8Array(bufferByteLength)\n let copiedBytes = 0\n\n for (let i = 0; i < bufferedChunks.length; i++) {\n const bufferedChunk = bufferedChunks[i]\n chunk.set(bufferedChunk, copiedBytes)\n copiedBytes += bufferedChunk.byteLength\n }\n // We just wrote all the buffered chunks so we need to reset the bufferedChunks array\n // and our bufferByteLength to prepare for the next round of buffered chunks\n bufferedChunks.length = 0\n bufferByteLength = 0\n controller.enqueue(chunk)\n } catch {\n // If an error occurs while enqueuing, it can't be due to this\n // transformer. It's most likely caused by the controller having been\n // errored (for example, if the stream was cancelled).\n }\n }\n\n const scheduleFlush = (controller: TransformStreamDefaultController) => {\n if (pending) {\n return\n }\n\n const detached = new DetachedPromise<void>()\n pending = detached\n\n scheduleImmediate(() => {\n try {\n flush(controller)\n } finally {\n pending = undefined\n detached.resolve()\n }\n })\n }\n\n return new TransformStream({\n transform(chunk, controller) {\n // Combine the previous buffer with the new chunk.\n bufferedChunks.push(chunk)\n bufferByteLength += chunk.byteLength\n\n if (bufferByteLength >= maxBufferByteLength) {\n flush(controller)\n } else {\n scheduleFlush(controller)\n }\n },\n flush() {\n return pending?.promise\n },\n })\n}\n\nfunction createPrefetchCommentStream(\n isBuildTimePrerendering: boolean,\n buildId: string\n): TransformStream<Uint8Array, Uint8Array> {\n // Insert an extra comment at the beginning of the HTML document. This must\n // come after the DOCTYPE, which is inserted by React.\n //\n // The first chunk sent by React will contain the doctype. After that, we can\n // pass through the rest of the chunks as-is.\n let didTransformFirstChunk = false\n return new TransformStream({\n transform(chunk, controller) {\n if (isBuildTimePrerendering && !didTransformFirstChunk) {\n didTransformFirstChunk = true\n const decoder = new TextDecoder('utf-8', { fatal: true })\n const chunkStr = decoder.decode(chunk, {\n stream: true,\n })\n const updatedChunkStr = insertBuildIdComment(chunkStr, buildId)\n controller.enqueue(encoder.encode(updatedChunkStr))\n return\n }\n controller.enqueue(chunk)\n },\n })\n}\n\nexport function renderToInitialFizzStream({\n ReactDOMServer,\n element,\n streamOptions,\n}: {\n ReactDOMServer: {\n renderToReadableStream: typeof import('react-dom/server').renderToReadableStream\n }\n element: React.ReactElement\n streamOptions?: Parameters<typeof ReactDOMServer.renderToReadableStream>[1]\n}): Promise<ReactDOMServerReadableStream> {\n return getTracer().trace(AppRenderSpan.renderToReadableStream, async () =>\n ReactDOMServer.renderToReadableStream(element, streamOptions)\n )\n}\n\nfunction createMetadataTransformStream(\n insert: () => Promise<string> | string\n): TransformStream<Uint8Array, Uint8Array> {\n let chunkIndex = -1\n let isMarkRemoved = false\n\n return new TransformStream({\n async transform(chunk, controller) {\n let iconMarkIndex = -1\n let closedHeadIndex = -1\n chunkIndex++\n\n if (isMarkRemoved) {\n controller.enqueue(chunk)\n return\n }\n let iconMarkLength = 0\n // Only search for the closed head tag once\n if (iconMarkIndex === -1) {\n iconMarkIndex = indexOfUint8Array(chunk, ENCODED_TAGS.META.ICON_MARK)\n if (iconMarkIndex === -1) {\n controller.enqueue(chunk)\n return\n } else {\n // When we found the `<meta name=\"«nxt-icon»\"` tag prefix, we will remove it from the chunk.\n // Its close tag could either be `/>` or `>`, checking the next char to ensure we cover both cases.\n iconMarkLength = ENCODED_TAGS.META.ICON_MARK.length\n // Check if next char is /, this is for xml mode.\n if (chunk[iconMarkIndex + iconMarkLength] === 47) {\n iconMarkLength += 2\n } else {\n // The last char is `>`\n iconMarkLength++\n }\n }\n }\n\n // Check if icon mark is inside <head> tag in the first chunk.\n if (chunkIndex === 0) {\n closedHeadIndex = indexOfUint8Array(chunk, ENCODED_TAGS.CLOSED.HEAD)\n if (iconMarkIndex !== -1) {\n // The mark icon is located in the 1st chunk before the head tag.\n // We do not need to insert the script tag in this case because it's in the head.\n // Just remove the icon mark from the chunk.\n if (iconMarkIndex < closedHeadIndex) {\n const replaced = new Uint8Array(chunk.length - iconMarkLength)\n\n // Remove the icon mark from the chunk.\n replaced.set(chunk.subarray(0, iconMarkIndex))\n replaced.set(\n chunk.subarray(iconMarkIndex + iconMarkLength),\n iconMarkIndex\n )\n chunk = replaced\n } else {\n // The icon mark is after the head tag, replace and insert the script tag at that position.\n const insertion = await insert()\n const encodedInsertion = encoder.encode(insertion)\n const insertionLength = encodedInsertion.length\n const replaced = new Uint8Array(\n chunk.length - iconMarkLength + insertionLength\n )\n replaced.set(chunk.subarray(0, iconMarkIndex))\n replaced.set(encodedInsertion, iconMarkIndex)\n replaced.set(\n chunk.subarray(iconMarkIndex + iconMarkLength),\n iconMarkIndex + insertionLength\n )\n chunk = replaced\n }\n isMarkRemoved = true\n }\n // If there's no icon mark located, it will be handled later when if present in the following chunks.\n } else {\n // When it's appeared in the following chunks, we'll need to\n // remove the mark and then insert the script tag at that position.\n const insertion = await insert()\n const encodedInsertion = encoder.encode(insertion)\n const insertionLength = encodedInsertion.length\n // Replace the icon mark with the hoist script or empty string.\n const replaced = new Uint8Array(\n chunk.length - iconMarkLength + insertionLength\n )\n // Set the first part of the chunk, before the icon mark.\n replaced.set(chunk.subarray(0, iconMarkIndex))\n // Set the insertion after the icon mark.\n replaced.set(encodedInsertion, iconMarkIndex)\n\n // Set the rest of the chunk after the icon mark.\n replaced.set(\n chunk.subarray(iconMarkIndex + iconMarkLength),\n iconMarkIndex + insertionLength\n )\n chunk = replaced\n isMarkRemoved = true\n }\n controller.enqueue(chunk)\n },\n })\n}\n\nfunction createHeadInsertionTransformStream(\n insert: () => Promise<string>\n): TransformStream<Uint8Array, Uint8Array> {\n let inserted = false\n\n // We need to track if this transform saw any bytes because if it didn't\n // we won't want to insert any server HTML at all\n let hasBytes = false\n\n return new TransformStream({\n async transform(chunk, controller) {\n hasBytes = true\n\n const insertion = await insert()\n if (inserted) {\n if (insertion) {\n const encodedInsertion = encoder.encode(insertion)\n controller.enqueue(encodedInsertion)\n }\n controller.enqueue(chunk)\n } else {\n // TODO (@Ethan-Arrowood): Replace the generic `indexOfUint8Array` method with something finely tuned for the subset of things actually being checked for.\n const index = indexOfUint8Array(chunk, ENCODED_TAGS.CLOSED.HEAD)\n // In fully static rendering or non PPR rendering cases:\n // `/head>` will always be found in the chunk in first chunk rendering.\n if (index !== -1) {\n if (insertion) {\n const encodedInsertion = encoder.encode(insertion)\n // Get the total count of the bytes in the chunk and the insertion\n // e.g.\n // chunk = <head><meta charset=\"utf-8\"></head>\n // insertion = <script>...</script>\n // output = <head><meta charset=\"utf-8\"> [ <script>...</script> ] </head>\n const insertedHeadContent = new Uint8Array(\n chunk.length + encodedInsertion.length\n )\n // Append the first part of the chunk, before the head tag\n insertedHeadContent.set(chunk.slice(0, index))\n // Append the server inserted content\n insertedHeadContent.set(encodedInsertion, index)\n // Append the rest of the chunk\n insertedHeadContent.set(\n chunk.slice(index),\n index + encodedInsertion.length\n )\n controller.enqueue(insertedHeadContent)\n } else {\n controller.enqueue(chunk)\n }\n inserted = true\n } else {\n // This will happens in PPR rendering during next start, when the page is partially rendered.\n // When the page resumes, the head tag will be found in the middle of the chunk.\n // Where we just need to append the insertion and chunk to the current stream.\n // e.g.\n // PPR-static: <head>...</head><body> [ resume content ] </body>\n // PPR-resume: [ insertion ] [ rest content ]\n if (insertion) {\n controller.enqueue(encoder.encode(insertion))\n }\n controller.enqueue(chunk)\n inserted = true\n }\n }\n },\n async flush(controller) {\n // Check before closing if there's anything remaining to insert.\n if (hasBytes) {\n const insertion = await insert()\n if (insertion) {\n controller.enqueue(encoder.encode(insertion))\n }\n }\n },\n })\n}\n\nfunction createClientResumeScriptInsertionTransformStream(): TransformStream<\n Uint8Array,\n Uint8Array\n> {\n const segmentPath = '/_full'\n const cacheBustingHeader = computeCacheBustingSearchParam(\n '1', // headers[NEXT_ROUTER_PREFETCH_HEADER]\n '/_full', // headers[NEXT_ROUTER_SEGMENT_PREFETCH_HEADER]\n undefined, // headers[NEXT_ROUTER_STATE_TREE_HEADER]\n undefined // headers[NEXT_URL]\n )\n const searchStr = `${NEXT_RSC_UNION_QUERY}=${cacheBustingHeader}`\n const NEXT_CLIENT_RESUME_SCRIPT = `<script>__NEXT_CLIENT_RESUME=fetch(location.pathname+'?${searchStr}',{credentials:'same-origin',headers:{'${RSC_HEADER}': '1','${NEXT_ROUTER_PREFETCH_HEADER}': '1','${NEXT_ROUTER_SEGMENT_PREFETCH_HEADER}': '${segmentPath}'}})</script>`\n\n let didAlreadyInsert = false\n return new TransformStream({\n transform(chunk, controller) {\n if (didAlreadyInsert) {\n // Already inserted the script into the head. Pass through.\n controller.enqueue(chunk)\n return\n }\n // TODO (@Ethan-Arrowood): Replace the generic `indexOfUint8Array` method with something finely tuned for the subset of things actually being checked for.\n const headClosingTagIndex = indexOfUint8Array(\n chunk,\n ENCODED_TAGS.CLOSED.HEAD\n )\n\n if (headClosingTagIndex === -1) {\n // In fully static rendering or non PPR rendering cases:\n // `/head>` will always be found in the chunk in first chunk rendering.\n controller.enqueue(chunk)\n return\n }\n\n const encodedInsertion = encoder.encode(NEXT_CLIENT_RESUME_SCRIPT)\n // Get the total count of the bytes in the chunk and the insertion\n // e.g.\n // chunk = <head><meta charset=\"utf-8\"></head>\n // insertion = <script>...</script>\n // output = <head><meta charset=\"utf-8\"> [ <script>...</script> ] </head>\n const insertedHeadContent = new Uint8Array(\n chunk.length + encodedInsertion.length\n )\n // Append the first part of the chunk, before the head tag\n insertedHeadContent.set(chunk.slice(0, headClosingTagIndex))\n // Append the server inserted content\n insertedHeadContent.set(encodedInsertion, headClosingTagIndex)\n // Append the rest of the chunk\n insertedHeadContent.set(\n chunk.slice(headClosingTagIndex),\n headClosingTagIndex + encodedInsertion.length\n )\n\n controller.enqueue(insertedHeadContent)\n didAlreadyInsert = true\n },\n })\n}\n\n// Suffix after main body content - scripts before </body>,\n// but wait for the major chunks to be enqueued.\nfunction createDeferredSuffixStream(\n suffix: string\n): TransformStream<Uint8Array, Uint8Array> {\n let flushed = false\n let pending: DetachedPromise<void> | undefined\n\n const flush = (controller: TransformStreamDefaultController) => {\n const detached = new DetachedPromise<void>()\n pending = detached\n\n scheduleImmediate(() => {\n try {\n controller.enqueue(encoder.encode(suffix))\n } catch {\n // If an error occurs while enqueuing it can't be due to this\n // transformers fault. It's likely due to the controller being\n // errored due to the stream being cancelled.\n } finally {\n pending = undefined\n detached.resolve()\n }\n })\n }\n\n return new TransformStream({\n transform(chunk, controller) {\n controller.enqueue(chunk)\n\n // If we've already flushed, we're done.\n if (flushed) return\n\n // Schedule the flush to happen.\n flushed = true\n flush(controller)\n },\n flush(controller) {\n if (pending) return pending.promise\n if (flushed) return\n\n // Flush now.\n controller.enqueue(encoder.encode(suffix))\n },\n })\n}\n\nfunction createFlightDataInjectionTransformStream(\n stream: ReadableStream<Uint8Array>,\n delayDataUntilFirstHtmlChunk: boolean\n): TransformStream<Uint8Array, Uint8Array> {\n let htmlStreamFinished = false\n\n let pull: Promise<void> | null = null\n let donePulling = false\n\n function startOrContinuePulling(\n controller: TransformStreamDefaultController\n ) {\n if (!pull) {\n pull = startPulling(controller)\n }\n return pull\n }\n\n async function startPulling(controller: TransformStreamDefaultController) {\n const reader = stream.getReader()\n\n if (delayDataUntilFirstHtmlChunk) {\n // NOTE: streaming flush\n // We are buffering here for the inlined data stream because the\n // \"shell\" stream might be chunkenized again by the underlying stream\n // implementation, e.g. with a specific high-water mark. To ensure it's\n // the safe timing to pipe the data stream, this extra tick is\n // necessary.\n\n // We don't start reading until we've left the current Task to ensure\n // that it's inserted after flushing the shell. Note that this implementation\n // might get stale if impl details of Fizz change in the future.\n await atLeastOneTask()\n }\n\n try {\n while (true) {\n const { done, value } = await reader.read()\n if (done) {\n donePulling = true\n return\n }\n\n // We want to prioritize HTML over RSC data.\n // The SSR render is based on the same RSC stream, so when we get a new RSC chunk,\n // we're likely to produce an HTML chunk as well, so give it a chance to flush first.\n if (!delayDataUntilFirstHtmlChunk && !htmlStreamFinished) {\n await atLeastOneTask()\n }\n controller.enqueue(value)\n }\n } catch (err) {\n controller.error(err)\n }\n }\n\n return new TransformStream({\n start(controller) {\n if (!delayDataUntilFirstHtmlChunk) {\n startOrContinuePulling(controller)\n }\n },\n transform(chunk, controller) {\n controller.enqueue(chunk)\n\n // Start the streaming if it hasn't already been started yet.\n if (delayDataUntilFirstHtmlChunk) {\n startOrContinuePulling(controller)\n }\n },\n flush(controller) {\n htmlStreamFinished = true\n if (donePulling) {\n return\n }\n return startOrContinuePulling(controller)\n },\n })\n}\n\nconst CLOSE_TAG = '</body></html>'\n\n/**\n * This transform stream moves the suffix to the end of the stream, so results\n * like `</body></html><script>...</script>` will be transformed to\n * `<script>...</script></body></html>`.\n */\nfunction createMoveSuffixStream(): TransformStream<Uint8Array, Uint8Array> {\n let foundSuffix = false\n\n return new TransformStream({\n transform(chunk, controller) {\n if (foundSuffix) {\n return controller.enqueue(chunk)\n }\n\n const index = indexOfUint8Array(chunk, ENCODED_TAGS.CLOSED.BODY_AND_HTML)\n if (index > -1) {\n foundSuffix = true\n\n // If the whole chunk is the suffix, then don't write anything, it will\n // be written in the flush.\n if (chunk.length === ENCODED_TAGS.CLOSED.BODY_AND_HTML.length) {\n return\n }\n\n // Write out the part before the suffix.\n const before = chunk.slice(0, index)\n controller.enqueue(before)\n\n // In the case where the suffix is in the middle of the chunk, we need\n // to split the chunk into two parts.\n if (chunk.length > ENCODED_TAGS.CLOSED.BODY_AND_HTML.length + index) {\n // Write out the part after the suffix.\n const after = chunk.slice(\n index + ENCODED_TAGS.CLOSED.BODY_AND_HTML.length\n )\n controller.enqueue(after)\n }\n } else {\n controller.enqueue(chunk)\n }\n },\n flush(controller) {\n // Even if we didn't find the suffix, the HTML is not valid if we don't\n // add it, so insert it at the end.\n controller.enqueue(ENCODED_TAGS.CLOSED.BODY_AND_HTML)\n },\n })\n}\n\nfunction createStripDocumentClosingTagsTransform(): TransformStream<\n Uint8Array,\n Uint8Array\n> {\n return new TransformStream({\n transform(chunk, controller) {\n // We rely on the assumption that chunks will never break across a code unit.\n // This is reasonable because we currently concat all of React's output from a single\n // flush into one chunk before streaming it forward which means the chunk will represent\n // a single coherent utf-8 string. This is not safe to use if we change our streaming to no\n // longer do this large buffered chunk\n if (\n isEquivalentUint8Arrays(chunk, ENCODED_TAGS.CLOSED.BODY_AND_HTML) ||\n isEquivalentUint8Arrays(chunk, ENCODED_TAGS.CLOSED.BODY) ||\n isEquivalentUint8Arrays(chunk, ENCODED_TAGS.CLOSED.HTML)\n ) {\n // the entire chunk is the closing tags; return without enqueueing anything.\n return\n }\n\n // We assume these tags will go at together at the end of the document and that\n // they won't appear anywhere else in the document. This is not really a safe assumption\n // but until we revamp our streaming infra this is a performant way to string the tags\n chunk = removeFromUint8Array(chunk, ENCODED_TAGS.CLOSED.BODY)\n chunk = removeFromUint8Array(chunk, ENCODED_TAGS.CLOSED.HTML)\n\n controller.enqueue(chunk)\n },\n })\n}\n\n/*\n * Checks if the root layout is missing the html or body tags\n * and if so, it will inject a script tag to throw an error in the browser, showing the user\n * the error message in the error overlay.\n */\nexport function createRootLayoutValidatorStream(): TransformStream<\n Uint8Array,\n Uint8Array\n> {\n let foundHtml = false\n let foundBody = false\n return new TransformStream({\n async transform(chunk, controller) {\n // Peek into the streamed chunk to see if the tags are present.\n if (\n !foundHtml &&\n indexOfUint8Array(chunk, ENCODED_TAGS.OPENING.HTML) > -1\n ) {\n foundHtml = true\n }\n\n if (\n !foundBody &&\n indexOfUint8Array(chunk, ENCODED_TAGS.OPENING.BODY) > -1\n ) {\n foundBody = true\n }\n\n controller.enqueue(chunk)\n },\n flush(controller) {\n const missingTags: ('html' | 'body')[] = []\n if (!foundHtml) missingTags.push('html')\n if (!foundBody) missingTags.push('body')\n\n if (!missingTags.length) return\n\n controller.enqueue(\n encoder.encode(\n `<html id=\"__next_error__\">\n <template\n data-next-error-message=\"Missing ${missingTags\n .map((c) => `<${c}>`)\n .join(\n missingTags.length > 1 ? ' and ' : ''\n )} tags in the root layout.\\nRead more at https://nextjs.org/docs/messages/missing-root-layout-tags\"\n data-next-error-digest=\"${MISSING_ROOT_TAGS_ERROR}\"\n data-next-error-stack=\"\"\n ></template>\n `\n )\n )\n },\n })\n}\n\nfunction chainTransformers<T>(\n readable: ReadableStream<T>,\n transformers: ReadonlyArray<TransformStream<T, T> | null>\n): ReadableStream<T> {\n let stream = readable\n for (const transformer of transformers) {\n if (!transformer) continue\n\n stream = stream.pipeThrough(transformer)\n }\n return stream\n}\n\nexport type ContinueStreamOptions = {\n inlinedDataStream: ReadableStream<Uint8Array> | undefined\n isStaticGeneration: boolean\n isBuildTimePrerendering: boolean\n buildId: string\n getServerInsertedHTML: () => Promise<string>\n getServerInsertedMetadata: () => Promise<string>\n validateRootLayout?: boolean\n /**\n * Suffix to inject after the buffered data, but before the close tags.\n */\n suffix?: string | undefined\n}\n\nexport async function continueFizzStream(\n renderStream: ReactDOMServerReadableStream,\n {\n suffix,\n inlinedDataStream,\n isStaticGeneration,\n isBuildTimePrerendering,\n buildId,\n getServerInsertedHTML,\n getServerInsertedMetadata,\n validateRootLayout,\n }: ContinueStreamOptions\n): Promise<ReadableStream<Uint8Array>> {\n // Suffix itself might contain close tags at the end, so we need to split it.\n const suffixUnclosed = suffix ? suffix.split(CLOSE_TAG, 1)[0] : null\n\n if (isStaticGeneration) {\n // If we're generating static HTML we need to wait for it to resolve before continuing.\n await renderStream.allReady\n } else {\n // Otherwise, we want to make sure Fizz is done with all microtasky work\n // before we start pulling the stream and cause a flush.\n await waitAtLeastOneReactRenderTask()\n }\n\n return chainTransformers(renderStream, [\n // Buffer everything to avoid flushing too frequently\n createBufferedTransformStream(),\n\n // Add build id comment to start of the HTML document (in export mode)\n createPrefetchCommentStream(isBuildTimePrerendering, buildId),\n\n // Transform metadata\n createMetadataTransformStream(getServerInsertedMetadata),\n\n // Insert suffix content\n suffixUnclosed != null && suffixUnclosed.length > 0\n ? createDeferredSuffixStream(suffixUnclosed)\n : null,\n\n // Insert the inlined data (Flight data, form state, etc.) stream into the HTML\n inlinedDataStream\n ? createFlightDataInjectionTransformStream(inlinedDataStream, true)\n : null,\n\n // Validate the root layout for missing html or body tags\n validateRootLayout ? createRootLayoutValidatorStream() : null,\n\n // Close tags should always be deferred to the end\n createMoveSuffixStream(),\n\n // Special head insertions\n // TODO-APP: Insert server side html to end of head in app layout rendering, to avoid\n // hydration errors. Remove this once it's ready to be handled by react itself.\n createHeadInsertionTransformStream(getServerInsertedHTML),\n ])\n}\n\ntype ContinueDynamicPrerenderOptions = {\n getServerInsertedHTML: () => Promise<string>\n getServerInsertedMetadata: () => Promise<string>\n}\n\nexport async function continueDynamicPrerender(\n prerenderStream: ReadableStream<Uint8Array>,\n {\n getServerInsertedHTML,\n getServerInsertedMetadata,\n }: ContinueDynamicPrerenderOptions\n) {\n return (\n prerenderStream\n // Buffer everything to avoid flushing too frequently\n .pipeThrough(createBufferedTransformStream())\n .pipeThrough(createStripDocumentClosingTagsTransform())\n // Insert generated tags to head\n .pipeThrough(createHeadInsertionTransformStream(getServerInsertedHTML))\n // Transform metadata\n .pipeThrough(createMetadataTransformStream(getServerInsertedMetadata))\n )\n}\n\ntype ContinueStaticPrerenderOptions = {\n inlinedDataStream: ReadableStream<Uint8Array>\n getServerInsertedHTML: () => Promise<string>\n getServerInsertedMetadata: () => Promise<string>\n isBuildTimePrerendering: boolean\n buildId: string\n}\n\nexport async function continueStaticPrerender(\n prerenderStream: ReadableStream<Uint8Array>,\n {\n inlinedDataStream,\n getServerInsertedHTML,\n getServerInsertedMetadata,\n isBuildTimePrerendering,\n buildId,\n }: ContinueStaticPrerenderOptions\n) {\n return (\n prerenderStream\n // Buffer everything to avoid flushing too frequently\n .pipeThrough(createBufferedTransformStream())\n // Add build id comment to start of the HTML document (in export mode)\n .pipeThrough(\n createPrefetchCommentStream(isBuildTimePrerendering, buildId)\n )\n // Insert generated tags to head\n .pipeThrough(createHeadInsertionTransformStream(getServerInsertedHTML))\n // Transform metadata\n .pipeThrough(createMetadataTransformStream(getServerInsertedMetadata))\n // Insert the inlined data (Flight data, form state, etc.) stream into the HTML\n .pipeThrough(\n createFlightDataInjectionTransformStream(inlinedDataStream, true)\n )\n // Close tags should always be deferred to the end\n .pipeThrough(createMoveSuffixStream())\n )\n}\n\nexport async function continueStaticFallbackPrerender(\n prerenderStream: ReadableStream<Uint8Array>,\n {\n inlinedDataStream,\n getServerInsertedHTML,\n getServerInsertedMetadata,\n isBuildTimePrerendering,\n buildId,\n }: ContinueStaticPrerenderOptions\n) {\n // Same as `continueStaticPrerender`, but also inserts an additional script\n // to instruct the client to start fetching the hydration data as early\n // as possible.\n return (\n prerenderStream\n // Buffer everything to avoid flushing too frequently\n .pipeThrough(createBufferedTransformStream())\n // Add build id comment to start of the HTML document (in export mode)\n .pipeThrough(\n createPrefetchCommentStream(isBuildTimePrerendering, buildId)\n )\n // Insert generated tags to head\n .pipeThrough(createHeadInsertionTransformStream(getServerInsertedHTML))\n // Insert the client resume script into the head\n .pipeThrough(createClientResumeScriptInsertionTransformStream())\n // Transform metadata\n .pipeThrough(createMetadataTransformStream(getServerInsertedMetadata))\n // Insert the inlined data (Flight data, form state, etc.) stream into the HTML\n .pipeThrough(\n createFlightDataInjectionTransformStream(inlinedDataStream, true)\n )\n // Close tags should always be deferred to the end\n .pipeThrough(createMoveSuffixStream())\n )\n}\n\ntype ContinueResumeOptions = {\n inlinedDataStream: ReadableStream<Uint8Array>\n getServerInsertedHTML: () => Promise<string>\n getServerInsertedMetadata: () => Promise<string>\n delayDataUntilFirstHtmlChunk: boolean\n}\n\nexport async function continueDynamicHTMLResume(\n renderStream: ReadableStream<Uint8Array>,\n {\n delayDataUntilFirstHtmlChunk,\n inlinedDataStream,\n getServerInsertedHTML,\n getServerInsertedMetadata,\n }: ContinueResumeOptions\n) {\n return (\n renderStream\n // Buffer everything to avoid flushing too frequently\n .pipeThrough(createBufferedTransformStream())\n // Insert generated tags to head\n .pipeThrough(createHeadInsertionTransformStream(getServerInsertedHTML))\n // Transform metadata\n .pipeThrough(createMetadataTransformStream(getServerInsertedMetadata))\n // Insert the inlined data (Flight data, form state, etc.) stream into the HTML\n .pipeThrough(\n createFlightDataInjectionTransformStream(\n inlinedDataStream,\n delayDataUntilFirstHtmlChunk\n )\n )\n // Close tags should always be deferred to the end\n .pipeThrough(createMoveSuffixStream())\n )\n}\n\nexport function createDocumentClosingStream(): ReadableStream<Uint8Array> {\n return streamFromString(CLOSE_TAG)\n}\n","import type { IncomingMessage } from 'http'\nimport type { ParsedUrlQuery } from 'querystring'\nimport type { UrlWithParsedQuery } from 'url'\nimport type { BaseNextRequest } from './base-http'\nimport type { CloneableBody } from './body-streams'\nimport type { RouteMatch } from './route-matches/route-match'\nimport type { NEXT_RSC_UNION_QUERY } from '../client/components/app-router-headers'\nimport type {\n ResponseCacheEntry,\n ServerComponentsHmrCache,\n} from './response-cache'\nimport type { PagesDevOverlayBridgeType } from '../next-devtools/userspace/pages/pages-dev-overlay-setup'\nimport type { OpaqueFallbackRouteParams } from './request/fallback-params'\nimport type { IncrementalCache } from './lib/incremental-cache'\n\n// FIXME: (wyattjoh) this is a temporary solution to allow us to pass data between bundled modules\nexport const NEXT_REQUEST_META = Symbol.for('NextInternalRequestMeta')\n\nexport type NextIncomingMessage = (BaseNextRequest | IncomingMessage) & {\n [NEXT_REQUEST_META]?: RequestMeta\n}\n\n/**\n * The callback function to call when a response cache entry was generated or\n * looked up in the cache. When it returns true, the server assumes that the\n * handler has already responded to the request and will not do so itself.\n */\nexport type OnCacheEntryHandler = (\n /**\n * The response cache entry that was generated or looked up in the cache.\n */\n cacheEntry: ResponseCacheEntry,\n\n /**\n * The request metadata.\n */\n requestMeta: {\n /**\n * The URL that was used to make the request.\n */\n url: string | undefined\n }\n) => Promise<boolean | void> | boolean | void\n\nexport interface RequestMeta {\n /**\n * The query that was used to make the request.\n */\n initQuery?: ParsedUrlQuery\n\n /**\n * The URL that was used to make the request.\n */\n initURL?: string\n\n /**\n * The protocol that was used to make the request.\n */\n initProtocol?: string\n\n /**\n * The body that was read from the request. This is used to allow the body to\n * be read multiple times.\n */\n clonableBody?: CloneableBody\n\n /**\n * True when the request matched a locale domain that was configured in the\n * next.config.js file.\n */\n isLocaleDomain?: boolean\n\n /**\n * True when the request had locale information stripped from the pathname\n * part of the URL.\n */\n didStripLocale?: boolean\n\n /**\n * If the request had it's URL rewritten, this is the URL it was rewritten to.\n */\n rewroteURL?: string\n\n /**\n * The cookies that were added by middleware and were added to the response.\n */\n middlewareCookie?: string[]\n\n /**\n * The match on the request for a given route.\n */\n match?: RouteMatch\n\n /**\n * The incremental cache to use for the request.\n */\n incrementalCache?: IncrementalCache\n\n /**\n * The server components HMR cache, only for dev.\n */\n serverComponentsHmrCache?: ServerComponentsHmrCache\n\n /**\n * Equals the segment path that was used for the prefetch RSC request.\n */\n segmentPrefetchRSCRequest?: string\n\n /**\n * True when the request is for the prefetch flight data.\n */\n isPrefetchRSCRequest?: true\n\n /**\n * True when the request is for the flight data.\n */\n isRSCRequest?: true\n\n /**\n * A search param set by the Next.js client when performing RSC requests.\n * Because some CDNs do not vary their cache entries on our custom headers,\n * this search param represents a hash of the header values. For any cached\n * RSC request, we should verify that the hash matches before responding.\n * Otherwise this can lead to cache poisoning.\n * TODO: Consider not using custom request headers at all, and instead encode\n * everything into the search param.\n */\n cacheBustingSearchParam?: string\n\n /**\n * True when the request is for the `/_next/data` route using the pages\n * router.\n */\n isNextDataReq?: true\n\n /**\n * Postponed state to use for resumption. If present it's assumed that the\n * request is for a page that has postponed (there are no guarantees that the\n * page actually has postponed though as it would incur an additional cache\n * lookup).\n */\n postponed?: string\n\n /**\n * If provided, this will be called when a response cache entry was generated\n * or looked up in the cache.\n *\n * @deprecated Use `onCacheEntryV2` instead.\n */\n onCacheEntry?: OnCacheEntryHandler\n\n /**\n * If provided, this will be called when a response cache entry was generated\n * or looked up in the cache.\n */\n onCacheEntryV2?: OnCacheEntryHandler\n\n /**\n * The previous revalidate before rendering 404 page for notFound: true\n */\n notFoundRevalidate?: number | false\n\n /**\n * In development, the original source page that returned a 404.\n */\n developmentNotFoundSourcePage?: string\n\n /**\n * The path we routed to and should be invoked\n */\n invokePath?: string\n\n /**\n * The specific page output we should be matching\n */\n invokeOutput?: string\n\n /**\n * The status we are invoking the request with from routing\n */\n invokeStatus?: number\n\n /**\n * The routing error we are invoking with\n */\n invokeError?: Error\n\n /**\n * The query parsed for the invocation\n */\n invokeQuery?: Record<string, undefined | string | string[]>\n\n /**\n * Whether the request is a middleware invocation\n */\n middlewareInvoke?: boolean\n\n /**\n * Whether the request should render the fallback shell or not.\n */\n renderFallbackShell?: boolean\n\n /**\n * Whether the request is for the custom error page.\n */\n customErrorRender?: true\n\n /**\n * Whether to bubble up the NoFallbackError to the caller when a 404 is\n * returned.\n */\n bubbleNoFallback?: true\n\n /**\n * True when the request had locale information inferred from the default\n * locale.\n */\n localeInferredFromDefault?: true\n\n /**\n * The locale that was inferred or explicitly set for the request.\n */\n locale?: string\n\n /**\n * The default locale that was inferred or explicitly set for the request.\n */\n defaultLocale?: string\n\n /**\n * The relative project dir the server is running in from project root\n */\n relativeProjectDir?: string\n\n /**\n * The dist directory the server is currently using\n */\n distDir?: string\n\n /**\n * The query after resolving routes\n */\n query?: ParsedUrlQuery\n\n /**\n * The params after resolving routes\n */\n params?: ParsedUrlQuery\n\n /**\n * ErrorOverlay component to use in development for pages router\n */\n PagesErrorDebug?: PagesDevOverlayBridgeType\n\n /**\n * Whether server is in minimal mode (this will be replaced with more\n * specific flags in future)\n */\n minimalMode?: boolean\n\n /**\n * DEV only: The fallback params that should be used when validating prerenders during dev\n */\n devFallbackParams?: OpaqueFallbackRouteParams\n\n /**\n * DEV only: Request timings in process.hrtime.bigint()\n */\n devRequestTimingStart?: bigint\n devRequestTimingMiddlewareStart?: bigint\n devRequestTimingMiddlewareEnd?: bigint\n devRequestTimingInternalsEnd?: bigint\n\n /**\n * DEV only: The duration of getStaticPaths/generateStaticParams in process.hrtime.bigint()\n */\n devGenerateStaticParamsDuration?: bigint\n}\n\n/**\n * Gets the request metadata. If no key is provided, the entire metadata object\n * is returned.\n *\n * @param req the request to get the metadata from\n * @param key the key to get from the metadata (optional)\n * @returns the value for the key or the entire metadata object\n */\nexport function getRequestMeta(\n req: NextIncomingMessage,\n key?: undefined\n): RequestMeta\nexport function getRequestMeta<K extends keyof RequestMeta>(\n req: NextIncomingMessage,\n key: K\n): RequestMeta[K]\nexport function getRequestMeta<K extends keyof RequestMeta>(\n req: NextIncomingMessage,\n key?: K\n): RequestMeta | RequestMeta[K] {\n const meta = req[NEXT_REQUEST_META] || {}\n return typeof key === 'string' ? meta[key] : meta\n}\n\n/**\n * Sets the request metadata.\n *\n * @param req the request to set the metadata on\n * @param meta the metadata to set\n * @returns the mutated request metadata\n */\nexport function setRequestMeta(req: NextIncomingMessage, meta: RequestMeta) {\n req[NEXT_REQUEST_META] = meta\n return meta\n}\n\n/**\n * Adds a value to the request metadata.\n *\n * @param request the request to mutate\n * @param key the key to set\n * @param value the value to set\n * @returns the mutated request metadata\n */\nexport function addRequestMeta<K extends keyof RequestMeta>(\n request: NextIncomingMessage,\n key: K,\n value: RequestMeta[K]\n) {\n const meta = getRequestMeta(request)\n meta[key] = value\n return setRequestMeta(request, meta)\n}\n\n/**\n * Removes a key from the request metadata.\n *\n * @param request the request to mutate\n * @param key the key to remove\n * @returns the mutated request metadata\n */\nexport function removeRequestMeta<K extends keyof RequestMeta>(\n request: NextIncomingMessage,\n key: K\n) {\n const meta = getRequestMeta(request)\n delete meta[key]\n return setRequestMeta(request, meta)\n}\n\ntype NextQueryMetadata = {\n /**\n * The `_rsc` query parameter used for cache busting to ensure that the RSC\n * requests do not get cached by the browser explicitly.\n */\n [NEXT_RSC_UNION_QUERY]?: string\n}\n\nexport type NextParsedUrlQuery = ParsedUrlQuery & NextQueryMetadata\n\nexport interface NextUrlWithParsedQuery extends UrlWithParsedQuery {\n query: NextParsedUrlQuery\n}\n","import type { OutgoingHttpHeaders } from 'http'\nimport {\n NEXT_INTERCEPTION_MARKER_PREFIX,\n NEXT_QUERY_PARAM_PREFIX,\n} from '../../lib/constants'\n\n/**\n * Converts a Node.js IncomingHttpHeaders object to a Headers object. Any\n * headers with multiple values will be joined with a comma and space. Any\n * headers that have an undefined value will be ignored and others will be\n * coerced to strings.\n *\n * @param nodeHeaders the headers object to convert\n * @returns the converted headers object\n */\nexport function fromNodeOutgoingHttpHeaders(\n nodeHeaders: OutgoingHttpHeaders\n): Headers {\n const headers = new Headers()\n for (let [key, value] of Object.entries(nodeHeaders)) {\n const values = Array.isArray(value) ? value : [value]\n for (let v of values) {\n if (typeof v === 'undefined') continue\n if (typeof v === 'number') {\n v = v.toString()\n }\n\n headers.append(key, v)\n }\n }\n return headers\n}\n\n/*\n Set-Cookie header field-values are sometimes comma joined in one string. This splits them without choking on commas\n that are within a single set-cookie field-value, such as in the Expires portion.\n This is uncommon, but explicitly allowed - see https://tools.ietf.org/html/rfc2616#section-4.2\n Node.js does this for every header *except* set-cookie - see https://github.com/nodejs/node/blob/d5e363b77ebaf1caf67cd7528224b651c86815c1/lib/_http_incoming.js#L128\n React Native's fetch does this for *every* header, including set-cookie.\n \n Based on: https://github.com/google/j2objc/commit/16820fdbc8f76ca0c33472810ce0cb03d20efe25\n Credits to: https://github.com/tomball for original and https://github.com/chrusart for JavaScript implementation\n*/\nexport function splitCookiesString(cookiesString: string) {\n var cookiesStrings = []\n var pos = 0\n var start\n var ch\n var lastComma\n var nextStart\n var cookiesSeparatorFound\n\n function skipWhitespace() {\n while (pos < cookiesString.length && /\\s/.test(cookiesString.charAt(pos))) {\n pos += 1\n }\n return pos < cookiesString.length\n }\n\n function notSpecialChar() {\n ch = cookiesString.charAt(pos)\n\n return ch !== '=' && ch !== ';' && ch !== ','\n }\n\n while (pos < cookiesString.length) {\n start = pos\n cookiesSeparatorFound = false\n\n while (skipWhitespace()) {\n ch = cookiesString.charAt(pos)\n if (ch === ',') {\n // ',' is a cookie separator if we have later first '=', not ';' or ','\n lastComma = pos\n pos += 1\n\n skipWhitespace()\n nextStart = pos\n\n while (pos < cookiesString.length && notSpecialChar()) {\n pos += 1\n }\n\n // currently special character\n if (pos < cookiesString.length && cookiesString.charAt(pos) === '=') {\n // we found cookies separator\n cookiesSeparatorFound = true\n // pos is inside the next cookie, so back up and return it.\n pos = nextStart\n cookiesStrings.push(cookiesString.substring(start, lastComma))\n start = pos\n } else {\n // in param ',' or param separator ';',\n // we continue from that comma\n pos = lastComma + 1\n }\n } else {\n pos += 1\n }\n }\n\n if (!cookiesSeparatorFound || pos >= cookiesString.length) {\n cookiesStrings.push(cookiesString.substring(start, cookiesString.length))\n }\n }\n\n return cookiesStrings\n}\n\n/**\n * Converts a Headers object to a Node.js OutgoingHttpHeaders object. This is\n * required to support the set-cookie header, which may have multiple values.\n *\n * @param headers the headers object to convert\n * @returns the converted headers object\n */\nexport function toNodeOutgoingHttpHeaders(\n headers: Headers\n): OutgoingHttpHeaders {\n const nodeHeaders: OutgoingHttpHeaders = {}\n const cookies: string[] = []\n if (headers) {\n for (const [key, value] of headers.entries()) {\n if (key.toLowerCase() === 'set-cookie') {\n // We may have gotten a comma joined string of cookies, or multiple\n // set-cookie headers. We need to merge them into one header array\n // to represent all the cookies.\n cookies.push(...splitCookiesString(value))\n nodeHeaders[key] = cookies.length === 1 ? cookies[0] : cookies\n } else {\n nodeHeaders[key] = value\n }\n }\n }\n return nodeHeaders\n}\n\n/**\n * Validate the correctness of a user-provided URL.\n */\nexport function validateURL(url: string | URL): string {\n try {\n return String(new URL(String(url)))\n } catch (error: any) {\n throw new Error(\n `URL is malformed \"${String(\n url\n )}\". Please use only absolute URLs - https://nextjs.org/docs/messages/middleware-relative-urls`,\n { cause: error }\n )\n }\n}\n\n/**\n * Normalizes `nxtP` and `nxtI` query param values to remove the prefix.\n * This function does not mutate the input key.\n */\nexport function normalizeNextQueryParam(key: string): null | string {\n const prefixes = [NEXT_QUERY_PARAM_PREFIX, NEXT_INTERCEPTION_MARKER_PREFIX]\n for (const prefix of prefixes) {\n if (key !== prefix && key.startsWith(prefix)) {\n return key.substring(prefix.length)\n }\n }\n return null\n}\n","import type { DomainLocale } from '../../../server/config-shared'\n\nexport function detectDomainLocale(\n domainItems?: readonly DomainLocale[],\n hostname?: string,\n detectedLocale?: string\n) {\n if (!domainItems) return\n\n if (detectedLocale) {\n detectedLocale = detectedLocale.toLowerCase()\n }\n\n for (const item of domainItems) {\n // remove port if present\n const domainHostname = item.domain?.split(':', 1)[0].toLowerCase()\n if (\n hostname === domainHostname ||\n detectedLocale === item.defaultLocale.toLowerCase() ||\n item.locales?.some((locale) => locale.toLowerCase() === detectedLocale)\n ) {\n return item\n }\n }\n}\n","/**\n * Removes the trailing slash for a given route or page path. Preserves the\n * root page. Examples:\n * - `/foo/bar/` -> `/foo/bar`\n * - `/foo/bar` -> `/foo/bar`\n * - `/` -> `/`\n */\nexport function removeTrailingSlash(route: string) {\n return route.replace(/\\/$/, '') || '/'\n}\n","/**\n * Given a path this function will find the pathname, query and hash and return\n * them. This is useful to parse full paths on the client side.\n * @param path A path to parse e.g. /foo/bar?id=1#hash\n */\nexport function parsePath(path: string) {\n const hashIndex = path.indexOf('#')\n const queryIndex = path.indexOf('?')\n const hasQuery = queryIndex > -1 && (hashIndex < 0 || queryIndex < hashIndex)\n\n if (hasQuery || hashIndex > -1) {\n return {\n pathname: path.substring(0, hasQuery ? queryIndex : hashIndex),\n query: hasQuery\n ? path.substring(queryIndex, hashIndex > -1 ? hashIndex : undefined)\n : '',\n hash: hashIndex > -1 ? path.slice(hashIndex) : '',\n }\n }\n\n return { pathname: path, query: '', hash: '' }\n}\n","import { parsePath } from './parse-path'\n\n/**\n * Adds the provided prefix to the given path. It first ensures that the path\n * is indeed starting with a slash.\n */\nexport function addPathPrefix(path: string, prefix?: string) {\n if (!path.startsWith('/') || !prefix) {\n return path\n }\n\n const { pathname, query, hash } = parsePath(path)\n return `${prefix}${pathname}${query}${hash}`\n}\n","import { parsePath } from './parse-path'\n\n/**\n * Similarly to `addPathPrefix`, this function adds a suffix at the end on the\n * provided path. It also works only for paths ensuring the argument starts\n * with a slash.\n */\nexport function addPathSuffix(path: string, suffix?: string) {\n if (!path.startsWith('/') || !suffix) {\n return path\n }\n\n const { pathname, query, hash } = parsePath(path)\n return `${pathname}${suffix}${query}${hash}`\n}\n","import { parsePath } from './parse-path'\n\n/**\n * Checks if a given path starts with a given prefix. It ensures it matches\n * exactly without containing extra chars. e.g. prefix /docs should replace\n * for /docs, /docs/, /docs/a but not /docsss\n * @param path The path to check.\n * @param prefix The prefix to check against.\n */\nexport function pathHasPrefix(path: string, prefix: string) {\n if (typeof path !== 'string') {\n return false\n }\n\n const { pathname } = parsePath(path)\n return pathname === prefix || pathname.startsWith(prefix + '/')\n}\n","import { addPathPrefix } from './add-path-prefix'\nimport { pathHasPrefix } from './path-has-prefix'\n\n/**\n * For a given path and a locale, if the locale is given, it will prefix the\n * locale. The path shouldn't be an API path. If a default locale is given the\n * prefix will be omitted if the locale is already the default locale.\n */\nexport function addLocale(\n path: string,\n locale?: string | false,\n defaultLocale?: string,\n ignorePrefix?: boolean\n) {\n // If no locale was given or the locale is the default locale, we don't need\n // to prefix the path.\n if (!locale || locale === defaultLocale) return path\n\n const lower = path.toLowerCase()\n\n // If the path is an API path or the path already has the locale prefix, we\n // don't need to prefix the path.\n if (!ignorePrefix) {\n if (pathHasPrefix(lower, '/api')) return path\n if (pathHasPrefix(lower, `/${locale.toLowerCase()}`)) return path\n }\n\n // Add the locale prefix to the path.\n return addPathPrefix(path, `/${locale}`)\n}\n","import type { NextPathnameInfo } from './get-next-pathname-info'\nimport { removeTrailingSlash } from './remove-trailing-slash'\nimport { addPathPrefix } from './add-path-prefix'\nimport { addPathSuffix } from './add-path-suffix'\nimport { addLocale } from './add-locale'\n\ninterface ExtendedInfo extends NextPathnameInfo {\n defaultLocale?: string\n ignorePrefix?: boolean\n}\n\nexport function formatNextPathnameInfo(info: ExtendedInfo) {\n let pathname = addLocale(\n info.pathname,\n info.locale,\n info.buildId ? undefined : info.defaultLocale,\n info.ignorePrefix\n )\n\n if (info.buildId || !info.trailingSlash) {\n pathname = removeTrailingSlash(pathname)\n }\n\n if (info.buildId) {\n pathname = addPathSuffix(\n addPathPrefix(pathname, `/_next/data/${info.buildId}`),\n info.pathname === '/' ? 'index.json' : '.json'\n )\n }\n\n pathname = addPathPrefix(pathname, info.basePath)\n return !info.buildId && info.trailingSlash\n ? !pathname.endsWith('/')\n ? addPathSuffix(pathname, '/')\n : pathname\n : removeTrailingSlash(pathname)\n}\n","import type { OutgoingHttpHeaders } from 'http'\n\n/**\n * Takes an object with a hostname property (like a parsed URL) and some\n * headers that may contain Host and returns the preferred hostname.\n * @param parsed An object containing a hostname property.\n * @param headers A dictionary with headers containing a `host`.\n */\nexport function getHostname(\n parsed: { hostname?: string | null },\n headers?: OutgoingHttpHeaders\n): string | undefined {\n // Get the hostname from the headers if it exists, otherwise use the parsed\n // hostname.\n let hostname: string\n if (headers?.host && !Array.isArray(headers.host)) {\n hostname = headers.host.toString().split(':', 1)[0]\n } else if (parsed.hostname) {\n hostname = parsed.hostname\n } else return\n\n return hostname.toLowerCase()\n}\n","export interface PathLocale {\n detectedLocale?: string\n pathname: string\n}\n\n/**\n * A cache of lowercased locales for each list of locales. This is stored as a\n * WeakMap so if the locales are garbage collected, the cache entry will be\n * removed as well.\n */\nconst cache = new WeakMap<readonly string[], readonly string[]>()\n\n/**\n * For a pathname that may include a locale from a list of locales, it\n * removes the locale from the pathname returning it alongside with the\n * detected locale.\n *\n * @param pathname A pathname that may include a locale.\n * @param locales A list of locales.\n * @returns The detected locale and pathname without locale\n */\nexport function normalizeLocalePath(\n pathname: string,\n locales?: readonly string[]\n): PathLocale {\n // If locales is undefined, return the pathname as is.\n if (!locales) return { pathname }\n\n // Get the cached lowercased locales or create a new cache entry.\n let lowercasedLocales = cache.get(locales)\n if (!lowercasedLocales) {\n lowercasedLocales = locales.map((locale) => locale.toLowerCase())\n cache.set(locales, lowercasedLocales)\n }\n\n let detectedLocale: string | undefined\n\n // The first segment will be empty, because it has a leading `/`. If\n // there is no further segment, there is no locale (or it's the default).\n const segments = pathname.split('/', 2)\n\n // If there's no second segment (ie, the pathname is just `/`), there's no\n // locale.\n if (!segments[1]) return { pathname }\n\n // The second segment will contain the locale part if any.\n const segment = segments[1].toLowerCase()\n\n // See if the segment matches one of the locales. If it doesn't, there is\n // no locale (or it's the default).\n const index = lowercasedLocales.indexOf(segment)\n if (index < 0) return { pathname }\n\n // Return the case-sensitive locale.\n detectedLocale = locales[index]\n\n // Remove the `/${locale}` part of the pathname.\n pathname = pathname.slice(detectedLocale.length + 1) || '/'\n\n return { pathname, detectedLocale }\n}\n","import { pathHasPrefix } from './path-has-prefix'\n\n/**\n * Given a path and a prefix it will remove the prefix when it exists in the\n * given path. It ensures it matches exactly without containing extra chars\n * and if the prefix is not there it will be noop.\n *\n * @param path The path to remove the prefix from.\n * @param prefix The prefix to be removed.\n */\nexport function removePathPrefix(path: string, prefix: string): string {\n // If the path doesn't start with the prefix we can return it as is. This\n // protects us from situations where the prefix is a substring of the path\n // prefix such as:\n //\n // For prefix: /blog\n //\n // /blog -> true\n // /blog/ -> true\n // /blog/1 -> true\n // /blogging -> false\n // /blogging/ -> false\n // /blogging/1 -> false\n if (!pathHasPrefix(path, prefix)) {\n return path\n }\n\n // Remove the prefix from the path via slicing.\n const withoutPrefix = path.slice(prefix.length)\n\n // If the path without the prefix starts with a `/` we can return it as is.\n if (withoutPrefix.startsWith('/')) {\n return withoutPrefix\n }\n\n // If the path without the prefix doesn't start with a `/` we need to add it\n // back to the path to make sure it's a valid path.\n return `/${withoutPrefix}`\n}\n","import { normalizeLocalePath } from '../../i18n/normalize-locale-path'\nimport { removePathPrefix } from './remove-path-prefix'\nimport { pathHasPrefix } from './path-has-prefix'\nimport type { I18NProvider } from '../../../../server/lib/i18n-provider'\n\nexport interface NextPathnameInfo {\n /**\n * The base path in case the pathname included it.\n */\n basePath?: string\n /**\n * The buildId for when the parsed URL is a data URL. Parsing it can be\n * disabled with the `parseData` option.\n */\n buildId?: string\n /**\n * If there was a locale in the pathname, this will hold its value.\n */\n locale?: string\n /**\n * The processed pathname without a base path, locale, or data URL elements\n * when parsing it is enabled.\n */\n pathname: string\n /**\n * A boolean telling if the pathname had a trailingSlash. This can be only\n * true if trailingSlash is enabled.\n */\n trailingSlash?: boolean\n}\n\ninterface Options {\n /**\n * When passed to true, this function will also parse Nextjs data URLs.\n */\n parseData?: boolean\n /**\n * A partial of the Next.js configuration to parse the URL.\n */\n nextConfig?: {\n basePath?: string\n i18n?: { locales?: readonly string[] } | null\n trailingSlash?: boolean\n }\n\n /**\n * If provided, this normalizer will be used to detect the locale instead of\n * the default locale detection.\n */\n i18nProvider?: I18NProvider\n}\n\nexport function getNextPathnameInfo(\n pathname: string,\n options: Options\n): NextPathnameInfo {\n const { basePath, i18n, trailingSlash } = options.nextConfig ?? {}\n const info: NextPathnameInfo = {\n pathname,\n trailingSlash: pathname !== '/' ? pathname.endsWith('/') : trailingSlash,\n }\n\n if (basePath && pathHasPrefix(info.pathname, basePath)) {\n info.pathname = removePathPrefix(info.pathname, basePath)\n info.basePath = basePath\n }\n let pathnameNoDataPrefix = info.pathname\n\n if (\n info.pathname.startsWith('/_next/data/') &&\n info.pathname.endsWith('.json')\n ) {\n const paths = info.pathname\n .replace(/^\\/_next\\/data\\//, '')\n .replace(/\\.json$/, '')\n .split('/')\n\n const buildId = paths[0]\n info.buildId = buildId\n pathnameNoDataPrefix =\n paths[1] !== 'index' ? `/${paths.slice(1).join('/')}` : '/'\n\n // update pathname with normalized if enabled although\n // we use normalized to populate locale info still\n if (options.parseData === true) {\n info.pathname = pathnameNoDataPrefix\n }\n }\n\n // If provided, use the locale route normalizer to detect the locale instead\n // of the function below.\n if (i18n) {\n let result = options.i18nProvider\n ? options.i18nProvider.analyze(info.pathname)\n : normalizeLocalePath(info.pathname, i18n.locales)\n\n info.locale = result.detectedLocale\n info.pathname = result.pathname ?? info.pathname\n\n if (!result.detectedLocale && info.buildId) {\n result = options.i18nProvider\n ? options.i18nProvider.analyze(pathnameNoDataPrefix)\n : normalizeLocalePath(pathnameNoDataPrefix, i18n.locales)\n\n if (result.detectedLocale) {\n info.locale = result.detectedLocale\n }\n }\n }\n return info\n}\n","import type { OutgoingHttpHeaders } from 'http'\nimport type { DomainLocale, I18NConfig } from '../config-shared'\nimport type { I18NProvider } from '../lib/i18n-provider'\n\nimport { detectDomainLocale } from '../../shared/lib/i18n/detect-domain-locale'\nimport { formatNextPathnameInfo } from '../../shared/lib/router/utils/format-next-pathname-info'\nimport { getHostname } from '../../shared/lib/get-hostname'\nimport { getNextPathnameInfo } from '../../shared/lib/router/utils/get-next-pathname-info'\n\ninterface Options {\n base?: string | URL\n headers?: OutgoingHttpHeaders\n forceLocale?: boolean\n nextConfig?: {\n basePath?: string\n i18n?: I18NConfig | null\n trailingSlash?: boolean\n }\n i18nProvider?: I18NProvider\n}\n\nconst REGEX_LOCALHOST_HOSTNAME =\n /(?!^https?:\\/\\/)(127(?:\\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}|\\[::1\\]|localhost)/\n\nfunction parseURL(url: string | URL, base?: string | URL) {\n return new URL(\n String(url).replace(REGEX_LOCALHOST_HOSTNAME, 'localhost'),\n base && String(base).replace(REGEX_LOCALHOST_HOSTNAME, 'localhost')\n )\n}\n\nconst Internal = Symbol('NextURLInternal')\n\nexport class NextURL {\n private [Internal]: {\n basePath: string\n buildId?: string\n flightSearchParameters?: Record<string, string>\n defaultLocale?: string\n domainLocale?: DomainLocale\n locale?: string\n options: Options\n trailingSlash?: boolean\n url: URL\n }\n\n constructor(input: string | URL, base?: string | URL, opts?: Options)\n constructor(input: string | URL, opts?: Options)\n constructor(\n input: string | URL,\n baseOrOpts?: string | URL | Options,\n opts?: Options\n ) {\n let base: undefined | string | URL\n let options: Options\n\n if (\n (typeof baseOrOpts === 'object' && 'pathname' in baseOrOpts) ||\n typeof baseOrOpts === 'string'\n ) {\n base = baseOrOpts\n options = opts || {}\n } else {\n options = opts || baseOrOpts || {}\n }\n\n this[Internal] = {\n url: parseURL(input, base ?? options.base),\n options: options,\n basePath: '',\n }\n\n this.analyze()\n }\n\n private analyze() {\n const info = getNextPathnameInfo(this[Internal].url.pathname, {\n nextConfig: this[Internal].options.nextConfig,\n parseData: !process.env.__NEXT_NO_MIDDLEWARE_URL_NORMALIZE,\n i18nProvider: this[Internal].options.i18nProvider,\n })\n\n const hostname = getHostname(\n this[Internal].url,\n this[Internal].options.headers\n )\n this[Internal].domainLocale = this[Internal].options.i18nProvider\n ? this[Internal].options.i18nProvider.detectDomainLocale(hostname)\n : detectDomainLocale(\n this[Internal].options.nextConfig?.i18n?.domains,\n hostname\n )\n\n const defaultLocale =\n this[Internal].domainLocale?.defaultLocale ||\n this[Internal].options.nextConfig?.i18n?.defaultLocale\n\n this[Internal].url.pathname = info.pathname\n this[Internal].defaultLocale = defaultLocale\n this[Internal].basePath = info.basePath ?? ''\n this[Internal].buildId = info.buildId\n this[Internal].locale = info.locale ?? defaultLocale\n this[Internal].trailingSlash = info.trailingSlash\n }\n\n private formatPathname() {\n return formatNextPathnameInfo({\n basePath: this[Internal].basePath,\n buildId: this[Internal].buildId,\n defaultLocale: !this[Internal].options.forceLocale\n ? this[Internal].defaultLocale\n : undefined,\n locale: this[Internal].locale,\n pathname: this[Internal].url.pathname,\n trailingSlash: this[Internal].trailingSlash,\n })\n }\n\n private formatSearch() {\n return this[Internal].url.search\n }\n\n public get buildId() {\n return this[Internal].buildId\n }\n\n public set buildId(buildId: string | undefined) {\n this[Internal].buildId = buildId\n }\n\n public get locale() {\n return this[Internal].locale ?? ''\n }\n\n public set locale(locale: string) {\n if (\n !this[Internal].locale ||\n !this[Internal].options.nextConfig?.i18n?.locales.includes(locale)\n ) {\n throw new TypeError(\n `The NextURL configuration includes no locale \"${locale}\"`\n )\n }\n\n this[Internal].locale = locale\n }\n\n get defaultLocale() {\n return this[Internal].defaultLocale\n }\n\n get domainLocale() {\n return this[Internal].domainLocale\n }\n\n get searchParams() {\n return this[Internal].url.searchParams\n }\n\n get host() {\n return this[Internal].url.host\n }\n\n set host(value: string) {\n this[Internal].url.host = value\n }\n\n get hostname() {\n return this[Internal].url.hostname\n }\n\n set hostname(value: string) {\n this[Internal].url.hostname = value\n }\n\n get port() {\n return this[Internal].url.port\n }\n\n set port(value: string) {\n this[Internal].url.port = value\n }\n\n get protocol() {\n return this[Internal].url.protocol\n }\n\n set protocol(value: string) {\n this[Internal].url.protocol = value\n }\n\n get href() {\n const pathname = this.formatPathname()\n const search = this.formatSearch()\n return `${this.protocol}//${this.host}${pathname}${search}${this.hash}`\n }\n\n set href(url: string) {\n this[Internal].url = parseURL(url)\n this.analyze()\n }\n\n get origin() {\n return this[Internal].url.origin\n }\n\n get pathname() {\n return this[Internal].url.pathname\n }\n\n set pathname(value: string) {\n this[Internal].url.pathname = value\n }\n\n get hash() {\n return this[Internal].url.hash\n }\n\n set hash(value: string) {\n this[Internal].url.hash = value\n }\n\n get search() {\n return this[Internal].url.search\n }\n\n set search(value: string) {\n this[Internal].url.search = value\n }\n\n get password() {\n return this[Internal].url.password\n }\n\n set password(value: string) {\n this[Internal].url.password = value\n }\n\n get username() {\n return this[Internal].url.username\n }\n\n set username(value: string) {\n this[Internal].url.username = value\n }\n\n get basePath() {\n return this[Internal].basePath\n }\n\n set basePath(value: string) {\n this[Internal].basePath = value.startsWith('/') ? value : `/${value}`\n }\n\n toString() {\n return this.href\n }\n\n toJSON() {\n return this.href\n }\n\n [Symbol.for('edge-runtime.inspect.custom')]() {\n return {\n href: this.href,\n origin: this.origin,\n protocol: this.protocol,\n username: this.username,\n password: this.password,\n host: this.host,\n hostname: this.hostname,\n port: this.port,\n pathname: this.pathname,\n search: this.search,\n searchParams: this.searchParams,\n hash: this.hash,\n }\n }\n\n clone() {\n return new NextURL(String(this), this[Internal].options)\n }\n}\n","export class PageSignatureError extends Error {\n constructor({ page }: { page: string }) {\n super(`The middleware \"${page}\" accepts an async API directly with the form:\n \n export function middleware(request, event) {\n return NextResponse.redirect('/new-location')\n }\n \n Read more: https://nextjs.org/docs/messages/middleware-new-signature\n `)\n }\n}\n\nexport class RemovedPageError extends Error {\n constructor() {\n super(`The request.page has been deprecated in favour of \\`URLPattern\\`.\n Read more: https://nextjs.org/docs/messages/middleware-request-page\n `)\n }\n}\n\nexport class RemovedUAError extends Error {\n constructor() {\n super(`The request.ua has been removed in favour of \\`userAgent\\` function.\n Read more: https://nextjs.org/docs/messages/middleware-parse-user-agent\n `)\n }\n}\n","import type { I18NConfig } from '../../config-shared'\nimport { NextURL } from '../next-url'\nimport { toNodeOutgoingHttpHeaders, validateURL } from '../utils'\nimport { RemovedUAError, RemovedPageError } from '../error'\nimport { RequestCookies } from './cookies'\n\nexport const INTERNALS = Symbol('internal request')\n\n/**\n * This class extends the [Web `Request` API](https://developer.mozilla.org/docs/Web/API/Request) with additional convenience methods.\n *\n * Read more: [Next.js Docs: `NextRequest`](https://nextjs.org/docs/app/api-reference/functions/next-request)\n */\nexport class NextRequest extends Request {\n /** @internal */\n [INTERNALS]: {\n cookies: RequestCookies\n url: string\n nextUrl: NextURL\n }\n\n constructor(input: URL | RequestInfo, init: RequestInit = {}) {\n const url =\n typeof input !== 'string' && 'url' in input ? input.url : String(input)\n\n validateURL(url)\n\n // node Request instance requires duplex option when a body\n // is present or it errors, we don't handle this for\n // Request being passed in since it would have already\n // errored if this wasn't configured\n if (process.env.NEXT_RUNTIME !== 'edge') {\n if (init.body && init.duplex !== 'half') {\n init.duplex = 'half'\n }\n }\n\n if (input instanceof Request) super(input, init)\n else super(url, init)\n\n const nextUrl = new NextURL(url, {\n headers: toNodeOutgoingHttpHeaders(this.headers),\n nextConfig: init.nextConfig,\n })\n this[INTERNALS] = {\n cookies: new RequestCookies(this.headers),\n nextUrl,\n url: process.env.__NEXT_NO_MIDDLEWARE_URL_NORMALIZE\n ? url\n : nextUrl.toString(),\n }\n }\n\n [Symbol.for('edge-runtime.inspect.custom')]() {\n return {\n cookies: this.cookies,\n nextUrl: this.nextUrl,\n url: this.url,\n // rest of props come from Request\n bodyUsed: this.bodyUsed,\n cache: this.cache,\n credentials: this.credentials,\n destination: this.destination,\n headers: Object.fromEntries(this.headers),\n integrity: this.integrity,\n keepalive: this.keepalive,\n method: this.method,\n mode: this.mode,\n redirect: this.redirect,\n referrer: this.referrer,\n referrerPolicy: this.referrerPolicy,\n signal: this.signal,\n }\n }\n\n public get cookies() {\n return this[INTERNALS].cookies\n }\n\n public get nextUrl() {\n return this[INTERNALS].nextUrl\n }\n\n /**\n * @deprecated\n * `page` has been deprecated in favour of `URLPattern`.\n * Read more: https://nextjs.org/docs/messages/middleware-request-page\n */\n public get page() {\n throw new RemovedPageError()\n }\n\n /**\n * @deprecated\n * `ua` has been removed in favour of \\`userAgent\\` function.\n * Read more: https://nextjs.org/docs/messages/middleware-parse-user-agent\n */\n public get ua() {\n throw new RemovedUAError()\n }\n\n public get url() {\n return this[INTERNALS].url\n }\n}\n\nexport interface RequestInit extends globalThis.RequestInit {\n nextConfig?: {\n basePath?: string\n i18n?: I18NConfig | null\n trailingSlash?: boolean\n }\n signal?: AbortSignal\n // see https://github.com/whatwg/fetch/pull/1457\n duplex?: 'half'\n}\n","import type { BaseNextRequest, BaseNextResponse } from './'\nimport type { NodeNextRequest, NodeNextResponse } from './node'\nimport type { WebNextRequest, WebNextResponse } from './web'\n\n/**\n * This file provides some helpers that should be used in conjunction with\n * explicit environment checks. When combined with the environment checks, it\n * will ensure that the correct typings are used as well as enable code\n * elimination.\n */\n\n/**\n * Type guard to determine if a request is a WebNextRequest. This does not\n * actually check the type of the request, but rather the runtime environment.\n * It's expected that when the runtime environment is the edge runtime, that any\n * base request is a WebNextRequest.\n */\nexport const isWebNextRequest = (req: BaseNextRequest): req is WebNextRequest =>\n process.env.NEXT_RUNTIME === 'edge'\n\n/**\n * Type guard to determine if a response is a WebNextResponse. This does not\n * actually check the type of the response, but rather the runtime environment.\n * It's expected that when the runtime environment is the edge runtime, that any\n * base response is a WebNextResponse.\n */\nexport const isWebNextResponse = (\n res: BaseNextResponse\n): res is WebNextResponse => process.env.NEXT_RUNTIME === 'edge'\n\n/**\n * Type guard to determine if a request is a NodeNextRequest. This does not\n * actually check the type of the request, but rather the runtime environment.\n * It's expected that when the runtime environment is the node runtime, that any\n * base request is a NodeNextRequest.\n */\nexport const isNodeNextRequest = (\n req: BaseNextRequest\n): req is NodeNextRequest => process.env.NEXT_RUNTIME !== 'edge'\n\n/**\n * Type guard to determine if a response is a NodeNextResponse. This does not\n * actually check the type of the response, but rather the runtime environment.\n * It's expected that when the runtime environment is the node runtime, that any\n * base response is a NodeNextResponse.\n */\nexport const isNodeNextResponse = (\n res: BaseNextResponse\n): res is NodeNextResponse => process.env.NEXT_RUNTIME !== 'edge'\n","import type { BaseNextRequest } from '../../../base-http'\nimport type { NodeNextRequest } from '../../../base-http/node'\nimport type { WebNextRequest } from '../../../base-http/web'\nimport type { Writable } from 'node:stream'\n\nimport { getRequestMeta } from '../../../request-meta'\nimport { fromNodeOutgoingHttpHeaders } from '../../utils'\nimport { NextRequest } from '../request'\nimport { isNodeNextRequest, isWebNextRequest } from '../../../base-http/helpers'\n\nexport const ResponseAbortedName = 'ResponseAborted'\nexport class ResponseAborted extends Error {\n public readonly name = ResponseAbortedName\n}\n\n/**\n * Creates an AbortController tied to the closing of a ServerResponse (or other\n * appropriate Writable).\n *\n * If the `close` event is fired before the `finish` event, then we'll send the\n * `abort` signal.\n */\nexport function createAbortController(response: Writable): AbortController {\n const controller = new AbortController()\n\n // If `finish` fires first, then `res.end()` has been called and the close is\n // just us finishing the stream on our side. If `close` fires first, then we\n // know the client disconnected before we finished.\n response.once('close', () => {\n if (response.writableFinished) return\n\n controller.abort(new ResponseAborted())\n })\n\n return controller\n}\n\n/**\n * Creates an AbortSignal tied to the closing of a ServerResponse (or other\n * appropriate Writable).\n *\n * This cannot be done with the request (IncomingMessage or Readable) because\n * the `abort` event will not fire if to data has been fully read (because that\n * will \"close\" the readable stream and nothing fires after that).\n */\nexport function signalFromNodeResponse(response: Writable): AbortSignal {\n const { errored, destroyed } = response\n if (errored || destroyed) {\n return AbortSignal.abort(errored ?? new ResponseAborted())\n }\n\n const { signal } = createAbortController(response)\n return signal\n}\n\nexport class NextRequestAdapter {\n public static fromBaseNextRequest(\n request: BaseNextRequest,\n signal: AbortSignal\n ): NextRequest {\n if (\n // The type check here ensures that `req` is correctly typed, and the\n // environment variable check provides dead code elimination.\n process.env.NEXT_RUNTIME === 'edge' &&\n isWebNextRequest(request)\n ) {\n return NextRequestAdapter.fromWebNextRequest(request)\n } else if (\n // The type check here ensures that `req` is correctly typed, and the\n // environment variable check provides dead code elimination.\n process.env.NEXT_RUNTIME !== 'edge' &&\n isNodeNextRequest(request)\n ) {\n return NextRequestAdapter.fromNodeNextRequest(request, signal)\n } else {\n throw new Error('Invariant: Unsupported NextRequest type')\n }\n }\n\n public static fromNodeNextRequest(\n request: NodeNextRequest,\n signal: AbortSignal\n ): NextRequest {\n // HEAD and GET requests can not have a body.\n let body: BodyInit | null = null\n if (request.method !== 'GET' && request.method !== 'HEAD' && request.body) {\n // @ts-expect-error - this is handled by undici, when streams/web land use it instead\n body = request.body\n }\n\n let url: URL\n if (request.url.startsWith('http')) {\n url = new URL(request.url)\n } else {\n // Grab the full URL from the request metadata.\n const base = getRequestMeta(request, 'initURL')\n if (!base || !base.startsWith('http')) {\n // Because the URL construction relies on the fact that the URL provided\n // is absolute, we need to provide a base URL. We can't use the request\n // URL because it's relative, so we use a dummy URL instead.\n url = new URL(request.url, 'http://n')\n } else {\n url = new URL(request.url, base)\n }\n }\n\n return new NextRequest(url, {\n method: request.method,\n headers: fromNodeOutgoingHttpHeaders(request.headers),\n duplex: 'half',\n signal,\n // geo\n // ip\n // nextConfig\n\n // body can not be passed if request was aborted\n // or we get a Request body was disturbed error\n ...(signal.aborted\n ? {}\n : {\n body,\n }),\n })\n }\n\n public static fromWebNextRequest(request: WebNextRequest): NextRequest {\n // HEAD and GET requests can not have a body.\n let body: ReadableStream | null = null\n if (request.method !== 'GET' && request.method !== 'HEAD') {\n body = request.body\n }\n\n return new NextRequest(request.url, {\n method: request.method,\n headers: fromNodeOutgoingHttpHeaders(request.headers),\n duplex: 'half',\n signal: request.request.signal,\n // geo\n // ip\n // nextConfig\n\n // body can not be passed if request was aborted\n // or we get a Request body was disturbed error\n ...(request.request.signal.aborted\n ? {}\n : {\n body,\n }),\n })\n }\n}\n","import type { AppPageModule } from './route-modules/app-page/module'\n\n// Combined load times for loading client components\nlet clientComponentLoadStart = 0\nlet clientComponentLoadTimes = 0\nlet clientComponentLoadCount = 0\n\nexport function wrapClientComponentLoader(\n ComponentMod: AppPageModule\n): AppPageModule['__next_app__'] {\n if (!('performance' in globalThis)) {\n return ComponentMod.__next_app__\n }\n\n return {\n require: (...args) => {\n const startTime = performance.now()\n\n if (clientComponentLoadStart === 0) {\n clientComponentLoadStart = startTime\n }\n\n try {\n clientComponentLoadCount += 1\n return ComponentMod.__next_app__.require(...args)\n } finally {\n clientComponentLoadTimes += performance.now() - startTime\n }\n },\n loadChunk: (...args) => {\n const startTime = performance.now()\n const result = ComponentMod.__next_app__.loadChunk(...args)\n // Avoid wrapping `loadChunk`'s result in an extra promise in case something like React depends on its identity.\n // We only need to know when it's settled.\n result.finally(() => {\n clientComponentLoadTimes += performance.now() - startTime\n })\n return result\n },\n }\n}\n\nexport function getClientComponentLoaderMetrics(\n options: { reset?: boolean } = {}\n) {\n const metrics =\n clientComponentLoadStart === 0\n ? undefined\n : {\n clientComponentLoadStart,\n clientComponentLoadTimes,\n clientComponentLoadCount,\n }\n\n if (options.reset) {\n clientComponentLoadStart = 0\n clientComponentLoadTimes = 0\n clientComponentLoadCount = 0\n }\n\n return metrics\n}\n","import type { ServerResponse } from 'node:http'\n\nimport {\n ResponseAbortedName,\n createAbortController,\n} from './web/spec-extension/adapters/next-request'\nimport { DetachedPromise } from '../lib/detached-promise'\nimport { getTracer } from './lib/trace/tracer'\nimport { NextNodeServerSpan } from './lib/trace/constants'\nimport { getClientComponentLoaderMetrics } from './client-component-renderer-logger'\n\nexport function isAbortError(e: any): e is Error & { name: 'AbortError' } {\n return e?.name === 'AbortError' || e?.name === ResponseAbortedName\n}\n\nfunction createWriterFromResponse(\n res: ServerResponse,\n waitUntilForEnd?: Promise<unknown>\n): WritableStream<Uint8Array> {\n let started = false\n\n // Create a promise that will resolve once the response has drained. See\n // https://nodejs.org/api/stream.html#stream_event_drain\n let drained = new DetachedPromise<void>()\n function onDrain() {\n drained.resolve()\n }\n res.on('drain', onDrain)\n\n // If the finish event fires, it means we shouldn't block and wait for the\n // drain event.\n res.once('close', () => {\n res.off('drain', onDrain)\n drained.resolve()\n })\n\n // Create a promise that will resolve once the response has finished. See\n // https://nodejs.org/api/http.html#event-finish_1\n const finished = new DetachedPromise<void>()\n res.once('finish', () => {\n finished.resolve()\n })\n\n // Create a writable stream that will write to the response.\n return new WritableStream<Uint8Array>({\n write: async (chunk) => {\n // You'd think we'd want to use `start` instead of placing this in `write`\n // but this ensures that we don't actually flush the headers until we've\n // started writing chunks.\n if (!started) {\n started = true\n\n if (\n 'performance' in globalThis &&\n process.env.NEXT_OTEL_PERFORMANCE_PREFIX\n ) {\n const metrics = getClientComponentLoaderMetrics()\n if (metrics) {\n performance.measure(\n `${process.env.NEXT_OTEL_PERFORMANCE_PREFIX}:next-client-component-loading`,\n {\n start: metrics.clientComponentLoadStart,\n end:\n metrics.clientComponentLoadStart +\n metrics.clientComponentLoadTimes,\n }\n )\n }\n }\n\n res.flushHeaders()\n getTracer().trace(\n NextNodeServerSpan.startResponse,\n {\n spanName: 'start response',\n },\n () => undefined\n )\n }\n\n try {\n const ok = res.write(chunk)\n\n // Added by the `compression` middleware, this is a function that will\n // flush the partially-compressed response to the client.\n if ('flush' in res && typeof res.flush === 'function') {\n res.flush()\n }\n\n // If the write returns false, it means there's some backpressure, so\n // wait until it's streamed before continuing.\n if (!ok) {\n await drained.promise\n\n // Reset the drained promise so that we can wait for the next drain event.\n drained = new DetachedPromise<void>()\n }\n } catch (err) {\n res.end()\n throw new Error('failed to write chunk to response', { cause: err })\n }\n },\n abort: (err) => {\n if (res.writableFinished) return\n\n res.destroy(err)\n },\n close: async () => {\n // if a waitUntil promise was passed, wait for it to resolve before\n // ending the response.\n if (waitUntilForEnd) {\n await waitUntilForEnd\n }\n\n if (res.writableFinished) return\n\n res.end()\n return finished.promise\n },\n })\n}\n\nexport async function pipeToNodeResponse(\n readable: ReadableStream<Uint8Array>,\n res: ServerResponse,\n waitUntilForEnd?: Promise<unknown>\n) {\n try {\n // If the response has already errored, then just return now.\n const { errored, destroyed } = res\n if (errored || destroyed) return\n\n // Create a new AbortController so that we can abort the readable if the\n // client disconnects.\n const controller = createAbortController(res)\n\n const writer = createWriterFromResponse(res, waitUntilForEnd)\n\n await readable.pipeTo(writer, { signal: controller.signal })\n } catch (err: any) {\n // If this isn't related to an abort error, re-throw it.\n if (isAbortError(err)) return\n\n throw new Error('failed to pipe response', { cause: err })\n }\n}\n","import type { OutgoingHttpHeaders, ServerResponse } from 'http'\nimport type { CacheControl } from './lib/cache-control'\nimport type { FetchMetrics } from './base-http'\n\nimport {\n chainStreams,\n streamFromBuffer,\n streamFromString,\n streamToString,\n} from './stream-utils/node-web-streams-helper'\nimport { isAbortError, pipeToNodeResponse } from './pipe-readable'\nimport type { RenderResumeDataCache } from './resume-data-cache/resume-data-cache'\nimport { InvariantError } from '../shared/lib/invariant-error'\nimport type {\n HTML_CONTENT_TYPE_HEADER,\n JSON_CONTENT_TYPE_HEADER,\n TEXT_PLAIN_CONTENT_TYPE_HEADER,\n} from '../lib/constants'\nimport type { RSC_CONTENT_TYPE_HEADER } from '../client/components/app-router-headers'\n\ntype ContentTypeOption =\n | typeof RSC_CONTENT_TYPE_HEADER // For App Page RSC responses\n | typeof HTML_CONTENT_TYPE_HEADER // For App Page, Pages HTML responses\n | typeof JSON_CONTENT_TYPE_HEADER // For API routes, Next.js data requests\n | typeof TEXT_PLAIN_CONTENT_TYPE_HEADER // For simplified errors\n\nexport type AppPageRenderResultMetadata = {\n flightData?: Buffer\n cacheControl?: CacheControl\n staticBailoutInfo?: {\n stack?: string\n description?: string\n }\n\n /**\n * The postponed state if the render had postponed and needs to be resumed.\n */\n postponed?: string\n\n /**\n * The headers to set on the response that were added by the render.\n */\n headers?: OutgoingHttpHeaders\n statusCode?: number\n fetchTags?: string\n fetchMetrics?: FetchMetrics\n\n segmentData?: Map<string, Buffer>\n\n /**\n * In development, the resume data cache is warmed up before the render. This\n * is attached to the metadata so that it can be used during the render. When\n * prerendering, the filled resume data cache is also attached to the metadata\n * so that it can be used when prerendering matching fallback shells.\n */\n renderResumeDataCache?: RenderResumeDataCache\n}\n\nexport type PagesRenderResultMetadata = {\n pageData?: any\n cacheControl?: CacheControl\n assetQueryString?: string\n isNotFound?: boolean\n isRedirect?: boolean\n}\n\nexport type StaticRenderResultMetadata = {}\n\nexport type RenderResultMetadata = AppPageRenderResultMetadata &\n PagesRenderResultMetadata &\n StaticRenderResultMetadata\n\nexport type RenderResultResponse =\n | ReadableStream<Uint8Array>[]\n | ReadableStream<Uint8Array>\n | string\n | Buffer\n | null\n\nexport type RenderResultOptions<\n Metadata extends RenderResultMetadata = RenderResultMetadata,\n> = {\n contentType: ContentTypeOption | null\n waitUntil?: Promise<unknown>\n metadata: Metadata\n}\n\nexport default class RenderResult<\n Metadata extends RenderResultMetadata = RenderResultMetadata,\n> {\n /**\n * The detected content type for the response. This is used to set the\n * `Content-Type` header.\n */\n public readonly contentType: ContentTypeOption | null\n\n /**\n * The metadata for the response. This is used to set the revalidation times\n * and other metadata.\n */\n public readonly metadata: Readonly<Metadata>\n\n /**\n * The response itself. This can be a string, a stream, or null. If it's a\n * string, then it's a static response. If it's a stream, then it's a\n * dynamic response. If it's null, then the response was not found or was\n * already sent.\n */\n private response: RenderResultResponse\n\n /**\n * A render result that represents an empty response. This is used to\n * represent a response that was not found or was already sent.\n */\n public static readonly EMPTY = new RenderResult<StaticRenderResultMetadata>(\n null,\n { metadata: {}, contentType: null }\n )\n\n /**\n * Creates a new RenderResult instance from a static response.\n *\n * @param value the static response value\n * @param contentType the content type of the response\n * @returns a new RenderResult instance\n */\n public static fromStatic(\n value: string | Buffer,\n contentType: ContentTypeOption\n ) {\n return new RenderResult<StaticRenderResultMetadata>(value, {\n metadata: {},\n contentType,\n })\n }\n\n private readonly waitUntil?: Promise<unknown>\n\n constructor(\n response: RenderResultResponse,\n { contentType, waitUntil, metadata }: RenderResultOptions<Metadata>\n ) {\n this.response = response\n this.contentType = contentType\n this.metadata = metadata\n this.waitUntil = waitUntil\n }\n\n public assignMetadata(metadata: Metadata) {\n Object.assign(this.metadata, metadata)\n }\n\n /**\n * Returns true if the response is null. It can be null if the response was\n * not found or was already sent.\n */\n public get isNull(): boolean {\n return this.response === null\n }\n\n /**\n * Returns false if the response is a string. It can be a string if the page\n * was prerendered. If it's not, then it was generated dynamically.\n */\n public get isDynamic(): boolean {\n return typeof this.response !== 'string'\n }\n\n /**\n * Returns the response if it is a string. If the page was dynamic, this will\n * return a promise if the `stream` option is true, or it will throw an error.\n *\n * @param stream Whether or not to return a promise if the response is dynamic\n * @returns The response as a string\n */\n public toUnchunkedString(stream?: false): string\n public toUnchunkedString(stream: true): Promise<string>\n public toUnchunkedString(stream = false): Promise<string> | string {\n if (this.response === null) {\n // If the response is null, return an empty string. This behavior is\n // intentional as we're now providing the `RenderResult.EMPTY` value.\n return ''\n }\n\n if (typeof this.response !== 'string') {\n if (!stream) {\n throw new InvariantError(\n 'dynamic responses cannot be unchunked. This is a bug in Next.js'\n )\n }\n\n return streamToString(this.readable)\n }\n\n return this.response\n }\n\n /**\n * Returns a readable stream of the response.\n */\n private get readable(): ReadableStream<Uint8Array> {\n if (this.response === null) {\n // If the response is null, return an empty stream. This behavior is\n // intentional as we're now providing the `RenderResult.EMPTY` value.\n return new ReadableStream<Uint8Array>({\n start(controller) {\n controller.close()\n },\n })\n }\n\n if (typeof this.response === 'string') {\n return streamFromString(this.response)\n }\n\n if (Buffer.isBuffer(this.response)) {\n return streamFromBuffer(this.response)\n }\n\n // If the response is an array of streams, then chain them together.\n if (Array.isArray(this.response)) {\n return chainStreams(...this.response)\n }\n\n return this.response\n }\n\n /**\n * Coerces the response to an array of streams. This will convert the response\n * to an array of streams if it is not already one.\n *\n * @returns An array of streams\n */\n private coerce(): ReadableStream<Uint8Array>[] {\n if (this.response === null) {\n // If the response is null, return an empty stream. This behavior is\n // intentional as we're now providing the `RenderResult.EMPTY` value.\n return []\n }\n\n if (typeof this.response === 'string') {\n return [streamFromString(this.response)]\n } else if (Array.isArray(this.response)) {\n return this.response\n } else if (Buffer.isBuffer(this.response)) {\n return [streamFromBuffer(this.response)]\n } else {\n return [this.response]\n }\n }\n\n /**\n * Unshifts a new stream to the response. This will convert the response to an\n * array of streams if it is not already one and will add the new stream to\n * the start of the array. When this response is piped, all of the streams\n * will be piped one after the other.\n *\n * @param readable The new stream to unshift\n */\n public unshift(readable: ReadableStream<Uint8Array>): void {\n // Coerce the response to an array of streams.\n this.response = this.coerce()\n\n // Add the new stream to the start of the array.\n this.response.unshift(readable)\n }\n\n /**\n * Chains a new stream to the response. This will convert the response to an\n * array of streams if it is not already one and will add the new stream to\n * the end. When this response is piped, all of the streams will be piped\n * one after the other.\n *\n * @param readable The new stream to chain\n */\n public push(readable: ReadableStream<Uint8Array>): void {\n // Coerce the response to an array of streams.\n this.response = this.coerce()\n\n // Add the new stream to the end of the array.\n this.response.push(readable)\n }\n\n /**\n * Pipes the response to a writable stream. This will close/cancel the\n * writable stream if an error is encountered. If this doesn't throw, then\n * the writable stream will be closed or aborted.\n *\n * @param writable Writable stream to pipe the response to\n */\n public async pipeTo(writable: WritableStream<Uint8Array>): Promise<void> {\n try {\n await this.readable.pipeTo(writable, {\n // We want to close the writable stream ourselves so that we can wait\n // for the waitUntil promise to resolve before closing it. If an error\n // is encountered, we'll abort the writable stream if we swallowed the\n // error.\n preventClose: true,\n })\n\n // If there is a waitUntil promise, wait for it to resolve before\n // closing the writable stream.\n if (this.waitUntil) await this.waitUntil\n\n // Close the writable stream.\n await writable.close()\n } catch (err) {\n // If this is an abort error, we should abort the writable stream (as we\n // took ownership of it when we started piping). We don't need to re-throw\n // because we handled the error.\n if (isAbortError(err)) {\n // Abort the writable stream if an error is encountered.\n await writable.abort(err)\n\n return\n }\n\n // We're not aborting the writer here as when this method throws it's not\n // clear as to how so the caller should assume it's their responsibility\n // to clean up the writer.\n throw err\n }\n }\n\n /**\n * Pipes the response to a node response. This will close/cancel the node\n * response if an error is encountered.\n *\n * @param res\n */\n public async pipeToNodeResponse(res: ServerResponse) {\n await pipeToNodeResponse(this.readable, res, this.waitUntil)\n }\n}\n","export const enum RouteKind {\n /**\n * `PAGES` represents all the React pages that are under `pages/`.\n */\n PAGES = 'PAGES',\n /**\n * `PAGES_API` represents all the API routes under `pages/api/`.\n */\n PAGES_API = 'PAGES_API',\n /**\n * `APP_PAGE` represents all the React pages that are under `app/` with the\n * filename of `page.{j,t}s{,x}`.\n */\n APP_PAGE = 'APP_PAGE',\n /**\n * `APP_ROUTE` represents all the API routes and metadata routes that are under `app/` with the\n * filename of `route.{j,t}s{,x}`.\n */\n APP_ROUTE = 'APP_ROUTE',\n\n /**\n * `IMAGE` represents all the images that are generated by `next/image`.\n */\n IMAGE = 'IMAGE',\n}\n","import {\n CachedRouteKind,\n IncrementalCacheKind,\n type CachedAppPageValue,\n type CachedPageValue,\n type IncrementalResponseCacheEntry,\n type ResponseCacheEntry,\n} from './types'\n\nimport RenderResult from '../render-result'\nimport { RouteKind } from '../route-kind'\nimport { HTML_CONTENT_TYPE_HEADER } from '../../lib/constants'\n\nexport async function fromResponseCacheEntry(\n cacheEntry: ResponseCacheEntry\n): Promise<IncrementalResponseCacheEntry> {\n return {\n ...cacheEntry,\n value:\n cacheEntry.value?.kind === CachedRouteKind.PAGES\n ? {\n kind: CachedRouteKind.PAGES,\n html: await cacheEntry.value.html.toUnchunkedString(true),\n pageData: cacheEntry.value.pageData,\n headers: cacheEntry.value.headers,\n status: cacheEntry.value.status,\n }\n : cacheEntry.value?.kind === CachedRouteKind.APP_PAGE\n ? {\n kind: CachedRouteKind.APP_PAGE,\n html: await cacheEntry.value.html.toUnchunkedString(true),\n postponed: cacheEntry.value.postponed,\n rscData: cacheEntry.value.rscData,\n headers: cacheEntry.value.headers,\n status: cacheEntry.value.status,\n segmentData: cacheEntry.value.segmentData,\n }\n : cacheEntry.value,\n }\n}\n\nexport async function toResponseCacheEntry(\n response: IncrementalResponseCacheEntry | null\n): Promise<ResponseCacheEntry | null> {\n if (!response) return null\n\n return {\n isMiss: response.isMiss,\n isStale: response.isStale,\n cacheControl: response.cacheControl,\n value:\n response.value?.kind === CachedRouteKind.PAGES\n ? ({\n kind: CachedRouteKind.PAGES,\n html: RenderResult.fromStatic(\n response.value.html,\n HTML_CONTENT_TYPE_HEADER\n ),\n pageData: response.value.pageData,\n headers: response.value.headers,\n status: response.value.status,\n } satisfies CachedPageValue)\n : response.value?.kind === CachedRouteKind.APP_PAGE\n ? ({\n kind: CachedRouteKind.APP_PAGE,\n html: RenderResult.fromStatic(\n response.value.html,\n HTML_CONTENT_TYPE_HEADER\n ),\n rscData: response.value.rscData,\n headers: response.value.headers,\n status: response.value.status,\n postponed: response.value.postponed,\n segmentData: response.value.segmentData,\n } satisfies CachedAppPageValue)\n : response.value,\n }\n}\n\nexport function routeKindToIncrementalCacheKind(\n routeKind: RouteKind\n): Exclude<IncrementalCacheKind, IncrementalCacheKind.FETCH> {\n switch (routeKind) {\n case RouteKind.PAGES:\n return IncrementalCacheKind.PAGES\n case RouteKind.APP_PAGE:\n return IncrementalCacheKind.APP_PAGE\n case RouteKind.IMAGE:\n return IncrementalCacheKind.IMAGE\n case RouteKind.APP_ROUTE:\n return IncrementalCacheKind.APP_ROUTE\n case RouteKind.PAGES_API:\n // Pages Router API routes are not cached in the incremental cache.\n throw new Error(`Unexpected route kind ${routeKind}`)\n default:\n return routeKind satisfies never\n }\n}\n","import type {\n ResponseCacheEntry,\n ResponseGenerator,\n ResponseCacheBase,\n IncrementalResponseCacheEntry,\n IncrementalResponseCache,\n} from './types'\n\nimport { Batcher } from '../../lib/batcher'\nimport { LRUCache } from '../lib/lru-cache'\nimport { warnOnce } from '../../build/output/log'\nimport { scheduleOnNextTick } from '../../lib/scheduler'\nimport {\n fromResponseCacheEntry,\n routeKindToIncrementalCacheKind,\n toResponseCacheEntry,\n} from './utils'\nimport type { RouteKind } from '../route-kind'\n\n/**\n * Parses an environment variable as a positive integer, returning the fallback\n * if the value is missing, not a number, or not positive.\n */\nfunction parsePositiveInt(\n envValue: string | undefined,\n fallback: number\n): number {\n if (!envValue) return fallback\n const parsed = parseInt(envValue, 10)\n return Number.isFinite(parsed) && parsed > 0 ? parsed : fallback\n}\n\n/**\n * Default TTL (in milliseconds) for minimal mode response cache entries.\n * Used for cache hit validation as a fallback for providers that don't\n * send the x-invocation-id header yet.\n *\n * 10 seconds chosen because:\n * - Long enough to dedupe rapid successive requests (e.g., page + data)\n * - Short enough to not serve stale data across unrelated requests\n *\n * Can be configured via `NEXT_PRIVATE_RESPONSE_CACHE_TTL` environment variable.\n */\nconst DEFAULT_TTL_MS = parsePositiveInt(\n process.env.NEXT_PRIVATE_RESPONSE_CACHE_TTL,\n 10_000\n)\n\n/**\n * Default maximum number of entries in the response cache.\n * Can be configured via `NEXT_PRIVATE_RESPONSE_CACHE_MAX_SIZE` environment variable.\n */\nconst DEFAULT_MAX_SIZE = parsePositiveInt(\n process.env.NEXT_PRIVATE_RESPONSE_CACHE_MAX_SIZE,\n 150\n)\n\n/**\n * Separator used in compound cache keys to join pathname and invocationID.\n * Using null byte (\\0) since it cannot appear in valid URL paths or UUIDs.\n */\nconst KEY_SEPARATOR = '\\0'\n\n/**\n * Sentinel value used for TTL-based cache entries (when invocationID is undefined).\n * Chosen to be a clearly reserved marker for internal cache keys.\n */\nconst TTL_SENTINEL = '__ttl_sentinel__'\n\n/**\n * Entry stored in the LRU cache.\n */\ntype CacheEntry = {\n entry: IncrementalResponseCacheEntry | null\n /**\n * TTL expiration timestamp in milliseconds. Used as a fallback for\n * cache hit validation when providers don't send x-invocation-id.\n * Memory pressure is managed by LRU eviction rather than timers.\n */\n expiresAt: number\n}\n\n/**\n * Creates a compound cache key from pathname and invocationID.\n */\nfunction createCacheKey(\n pathname: string,\n invocationID: string | undefined\n): string {\n return `${pathname}${KEY_SEPARATOR}${invocationID ?? TTL_SENTINEL}`\n}\n\n/**\n * Extracts the invocationID from a compound cache key.\n * Returns undefined if the key used TTL_SENTINEL.\n */\nfunction extractInvocationID(compoundKey: string): string | undefined {\n const separatorIndex = compoundKey.lastIndexOf(KEY_SEPARATOR)\n if (separatorIndex === -1) return undefined\n\n const invocationID = compoundKey.slice(separatorIndex + 1)\n return invocationID === TTL_SENTINEL ? undefined : invocationID\n}\n\nexport * from './types'\n\nexport default class ResponseCache implements ResponseCacheBase {\n private readonly getBatcher = Batcher.create<\n { key: string; isOnDemandRevalidate: boolean },\n IncrementalResponseCacheEntry | null,\n string\n >({\n // Ensure on-demand revalidate doesn't block normal requests, it should be\n // safe to run an on-demand revalidate for the same key as a normal request.\n cacheKeyFn: ({ key, isOnDemandRevalidate }) =>\n `${key}-${isOnDemandRevalidate ? '1' : '0'}`,\n // We wait to do any async work until after we've added our promise to\n // `pendingResponses` to ensure that any any other calls will reuse the\n // same promise until we've fully finished our work.\n schedulerFn: scheduleOnNextTick,\n })\n\n private readonly revalidateBatcher = Batcher.create<\n string,\n IncrementalResponseCacheEntry | null\n >({\n // We wait to do any async work until after we've added our promise to\n // `pendingResponses` to ensure that any any other calls will reuse the\n // same promise until we've fully finished our work.\n schedulerFn: scheduleOnNextTick,\n })\n\n /**\n * LRU cache for minimal mode using compound keys (pathname + invocationID).\n * This allows multiple invocations to cache the same pathname without\n * overwriting each other's entries.\n */\n private readonly cache: LRUCache<CacheEntry>\n\n /**\n * Set of invocation IDs that have had cache entries evicted.\n * Used to detect when the cache size may be too small.\n * Bounded to prevent memory growth.\n */\n private readonly evictedInvocationIDs: Set<string> = new Set()\n\n /**\n * The configured max size, stored for logging.\n */\n private readonly maxSize: number\n\n /**\n * The configured TTL for cache entries in milliseconds.\n */\n private readonly ttl: number\n\n // we don't use minimal_mode name here as this.minimal_mode is\n // statically replace for server runtimes but we need it to\n // be dynamic here\n private minimal_mode?: boolean\n\n constructor(\n minimal_mode: boolean,\n maxSize: number = DEFAULT_MAX_SIZE,\n ttl: number = DEFAULT_TTL_MS\n ) {\n this.minimal_mode = minimal_mode\n this.maxSize = maxSize\n this.ttl = ttl\n\n // Create the LRU cache with eviction tracking\n this.cache = new LRUCache(maxSize, undefined, (compoundKey) => {\n const invocationID = extractInvocationID(compoundKey)\n if (invocationID) {\n // Bound to 100 entries to prevent unbounded memory growth.\n // FIFO eviction is acceptable here because:\n // 1. Invocations are short-lived (single request lifecycle), so older\n // invocations are unlikely to still be active after 100 newer ones\n // 2. This warning mechanism is best-effort for developer guidance—\n // missing occasional eviction warnings doesn't affect correctness\n // 3. If a long-running invocation is somehow evicted and then has\n // another cache entry evicted, it will simply be re-added\n if (this.evictedInvocationIDs.size >= 100) {\n const first = this.evictedInvocationIDs.values().next().value\n if (first) this.evictedInvocationIDs.delete(first)\n }\n this.evictedInvocationIDs.add(invocationID)\n }\n })\n }\n\n /**\n * Gets the response cache entry for the given key.\n *\n * @param key - The key to get the response cache entry for.\n * @param responseGenerator - The response generator to use to generate the response cache entry.\n * @param context - The context for the get request.\n * @returns The response cache entry.\n */\n public async get(\n key: string | null,\n responseGenerator: ResponseGenerator,\n context: {\n routeKind: RouteKind\n isOnDemandRevalidate?: boolean\n isPrefetch?: boolean\n incrementalCache: IncrementalResponseCache\n isRoutePPREnabled?: boolean\n isFallback?: boolean\n waitUntil?: (prom: Promise<any>) => void\n\n /**\n * The invocation ID from the infrastructure. Used to scope the\n * in-memory cache to a single revalidation request in minimal mode.\n */\n invocationID?: string\n }\n ): Promise<ResponseCacheEntry | null> {\n // If there is no key for the cache, we can't possibly look this up in the\n // cache so just return the result of the response generator.\n if (!key) {\n return responseGenerator({\n hasResolved: false,\n previousCacheEntry: null,\n })\n }\n\n // Check minimal mode cache before doing any other work.\n if (this.minimal_mode) {\n const cacheKey = createCacheKey(key, context.invocationID)\n const cachedItem = this.cache.get(cacheKey)\n\n if (cachedItem) {\n // With invocationID: exact match found - always a hit\n // With TTL mode: must check expiration\n if (context.invocationID !== undefined) {\n return toResponseCacheEntry(cachedItem.entry)\n }\n\n // TTL mode: check expiration\n const now = Date.now()\n if (cachedItem.expiresAt > now) {\n return toResponseCacheEntry(cachedItem.entry)\n }\n\n // TTL expired - clean up\n this.cache.remove(cacheKey)\n }\n\n // Warn if this invocation had entries evicted - indicates cache may be too small.\n if (\n context.invocationID &&\n this.evictedInvocationIDs.has(context.invocationID)\n ) {\n warnOnce(\n `Response cache entry was evicted for invocation ${context.invocationID}. ` +\n `Consider increasing NEXT_PRIVATE_RESPONSE_CACHE_MAX_SIZE (current: ${this.maxSize}).`\n )\n }\n }\n\n const {\n incrementalCache,\n isOnDemandRevalidate = false,\n isFallback = false,\n isRoutePPREnabled = false,\n isPrefetch = false,\n waitUntil,\n routeKind,\n invocationID,\n } = context\n\n const response = await this.getBatcher.batch(\n { key, isOnDemandRevalidate },\n ({ resolve }) => {\n const promise = this.handleGet(\n key,\n responseGenerator,\n {\n incrementalCache,\n isOnDemandRevalidate,\n isFallback,\n isRoutePPREnabled,\n isPrefetch,\n routeKind,\n invocationID,\n },\n resolve\n )\n\n // We need to ensure background revalidates are passed to waitUntil.\n if (waitUntil) waitUntil(promise)\n\n return promise\n }\n )\n\n return toResponseCacheEntry(response)\n }\n\n /**\n * Handles the get request for the response cache.\n *\n * @param key - The key to get the response cache entry for.\n * @param responseGenerator - The response generator to use to generate the response cache entry.\n * @param context - The context for the get request.\n * @param resolve - The resolve function to use to resolve the response cache entry.\n * @returns The response cache entry.\n */\n private async handleGet(\n key: string,\n responseGenerator: ResponseGenerator,\n context: {\n incrementalCache: IncrementalResponseCache\n isOnDemandRevalidate: boolean\n isFallback: boolean\n isRoutePPREnabled: boolean\n isPrefetch: boolean\n routeKind: RouteKind\n invocationID: string | undefined\n },\n resolve: (value: IncrementalResponseCacheEntry | null) => void\n ): Promise<IncrementalResponseCacheEntry | null> {\n let previousIncrementalCacheEntry: IncrementalResponseCacheEntry | null =\n null\n let resolved = false\n\n try {\n // Get the previous cache entry if not in minimal mode\n previousIncrementalCacheEntry = !this.minimal_mode\n ? await context.incrementalCache.get(key, {\n kind: routeKindToIncrementalCacheKind(context.routeKind),\n isRoutePPREnabled: context.isRoutePPREnabled,\n isFallback: context.isFallback,\n })\n : null\n\n if (previousIncrementalCacheEntry && !context.isOnDemandRevalidate) {\n resolve(previousIncrementalCacheEntry)\n resolved = true\n\n if (!previousIncrementalCacheEntry.isStale || context.isPrefetch) {\n // The cached value is still valid, so we don't need to update it yet.\n return previousIncrementalCacheEntry\n }\n }\n\n // Revalidate the cache entry\n const incrementalResponseCacheEntry = await this.revalidate(\n key,\n context.incrementalCache,\n context.isRoutePPREnabled,\n context.isFallback,\n responseGenerator,\n previousIncrementalCacheEntry,\n previousIncrementalCacheEntry !== null && !context.isOnDemandRevalidate,\n undefined,\n context.invocationID\n )\n\n // Handle null response\n if (!incrementalResponseCacheEntry) {\n // Remove the cache item if it was set so we don't use it again.\n if (this.minimal_mode) {\n const cacheKey = createCacheKey(key, context.invocationID)\n this.cache.remove(cacheKey)\n }\n return null\n }\n\n // Resolve for on-demand revalidation or if not already resolved\n if (context.isOnDemandRevalidate && !resolved) {\n return incrementalResponseCacheEntry\n }\n\n return incrementalResponseCacheEntry\n } catch (err) {\n // If we've already resolved the cache entry, we can't reject as we\n // already resolved the cache entry so log the error here.\n if (resolved) {\n console.error(err)\n return null\n }\n\n throw err\n }\n }\n\n /**\n * Revalidates the cache entry for the given key.\n *\n * @param key - The key to revalidate the cache entry for.\n * @param incrementalCache - The incremental cache to use to revalidate the cache entry.\n * @param isRoutePPREnabled - Whether the route is PPR enabled.\n * @param isFallback - Whether the route is a fallback.\n * @param responseGenerator - The response generator to use to generate the response cache entry.\n * @param previousIncrementalCacheEntry - The previous cache entry to use to revalidate the cache entry.\n * @param hasResolved - Whether the response has been resolved.\n * @param waitUntil - Optional function to register background work.\n * @param invocationID - The invocation ID for cache key scoping.\n * @returns The revalidated cache entry.\n */\n public async revalidate(\n key: string,\n incrementalCache: IncrementalResponseCache,\n isRoutePPREnabled: boolean,\n isFallback: boolean,\n responseGenerator: ResponseGenerator,\n previousIncrementalCacheEntry: IncrementalResponseCacheEntry | null,\n hasResolved: boolean,\n waitUntil?: (prom: Promise<any>) => void,\n invocationID?: string\n ) {\n return this.revalidateBatcher.batch(key, () => {\n const promise = this.handleRevalidate(\n key,\n incrementalCache,\n isRoutePPREnabled,\n isFallback,\n responseGenerator,\n previousIncrementalCacheEntry,\n hasResolved,\n invocationID\n )\n\n // We need to ensure background revalidates are passed to waitUntil.\n if (waitUntil) waitUntil(promise)\n\n return promise\n })\n }\n\n private async handleRevalidate(\n key: string,\n incrementalCache: IncrementalResponseCache,\n isRoutePPREnabled: boolean,\n isFallback: boolean,\n responseGenerator: ResponseGenerator,\n previousIncrementalCacheEntry: IncrementalResponseCacheEntry | null,\n hasResolved: boolean,\n invocationID: string | undefined\n ) {\n try {\n // Generate the response cache entry using the response generator.\n const responseCacheEntry = await responseGenerator({\n hasResolved,\n previousCacheEntry: previousIncrementalCacheEntry,\n isRevalidating: true,\n })\n if (!responseCacheEntry) {\n return null\n }\n\n // Convert the response cache entry to an incremental response cache entry.\n const incrementalResponseCacheEntry = await fromResponseCacheEntry({\n ...responseCacheEntry,\n isMiss: !previousIncrementalCacheEntry,\n })\n\n // We want to persist the result only if it has a cache control value\n // defined.\n if (incrementalResponseCacheEntry.cacheControl) {\n if (this.minimal_mode) {\n // Set TTL expiration for cache hit validation. Entries are validated\n // by invocationID when available, with TTL as a fallback for providers\n // that don't send x-invocation-id. Memory is managed by LRU eviction.\n const cacheKey = createCacheKey(key, invocationID)\n this.cache.set(cacheKey, {\n entry: incrementalResponseCacheEntry,\n expiresAt: Date.now() + this.ttl,\n })\n } else {\n await incrementalCache.set(key, incrementalResponseCacheEntry.value, {\n cacheControl: incrementalResponseCacheEntry.cacheControl,\n isRoutePPREnabled,\n isFallback,\n })\n }\n }\n\n return incrementalResponseCacheEntry\n } catch (err) {\n // When a path is erroring we automatically re-set the existing cache\n // with new revalidate and expire times to prevent non-stop retrying.\n if (previousIncrementalCacheEntry?.cacheControl) {\n const revalidate = Math.min(\n Math.max(\n previousIncrementalCacheEntry.cacheControl.revalidate || 3,\n 3\n ),\n 30\n )\n const expire =\n previousIncrementalCacheEntry.cacheControl.expire === undefined\n ? undefined\n : Math.max(\n revalidate + 3,\n previousIncrementalCacheEntry.cacheControl.expire\n )\n\n await incrementalCache.set(key, previousIncrementalCacheEntry.value, {\n cacheControl: { revalidate: revalidate, expire: expire },\n isRoutePPREnabled,\n isFallback,\n })\n }\n\n // We haven't resolved yet, so let's throw to indicate an error.\n throw err\n }\n }\n}\n","import type {\n WorkAsyncStorage,\n WorkStore,\n} from '../app-render/work-async-storage.external'\n\nimport { AppRenderSpan, NextNodeServerSpan } from './trace/constants'\nimport { getTracer, SpanKind } from './trace/tracer'\nimport {\n CACHE_ONE_YEAR,\n INFINITE_CACHE,\n NEXT_CACHE_TAG_MAX_ITEMS,\n NEXT_CACHE_TAG_MAX_LENGTH,\n} from '../../lib/constants'\nimport { markCurrentScopeAsDynamic } from '../app-render/dynamic-rendering'\nimport { makeHangingPromise } from '../dynamic-rendering-utils'\nimport type { FetchMetric } from '../base-http'\nimport { createDedupeFetch } from './dedupe-fetch'\nimport {\n getCacheSignal,\n type RevalidateStore,\n type WorkUnitAsyncStorage,\n} from '../app-render/work-unit-async-storage.external'\nimport {\n CachedRouteKind,\n IncrementalCacheKind,\n type CachedFetchData,\n type ServerComponentsHmrCache,\n type SetIncrementalFetchCacheContext,\n} from '../response-cache'\nimport { cloneResponse } from './clone-response'\nimport type { IncrementalCache } from './incremental-cache'\nimport { RenderStage } from '../app-render/staged-rendering'\n\nconst isEdgeRuntime = process.env.NEXT_RUNTIME === 'edge'\n\ntype Fetcher = typeof fetch\n\ntype PatchedFetcher = Fetcher & {\n readonly __nextPatched: true\n readonly __nextGetStaticStore: () => WorkAsyncStorage\n readonly _nextOriginalFetch: Fetcher\n}\n\nexport const NEXT_PATCH_SYMBOL = Symbol.for('next-patch')\n\nfunction isFetchPatched() {\n return (globalThis as Record<symbol, unknown>)[NEXT_PATCH_SYMBOL] === true\n}\n\nexport function validateRevalidate(\n revalidateVal: unknown,\n route: string\n): undefined | number {\n try {\n let normalizedRevalidate: number | undefined = undefined\n\n if (revalidateVal === false) {\n normalizedRevalidate = INFINITE_CACHE\n } else if (\n typeof revalidateVal === 'number' &&\n !isNaN(revalidateVal) &&\n revalidateVal > -1\n ) {\n normalizedRevalidate = revalidateVal\n } else if (typeof revalidateVal !== 'undefined') {\n throw new Error(\n `Invalid revalidate value \"${revalidateVal}\" on \"${route}\", must be a non-negative number or false`\n )\n }\n return normalizedRevalidate\n } catch (err: any) {\n // handle client component error from attempting to check revalidate value\n if (err instanceof Error && err.message.includes('Invalid revalidate')) {\n throw err\n }\n return undefined\n }\n}\n\nexport function validateTags(tags: any[], description: string) {\n const validTags: string[] = []\n const invalidTags: Array<{\n tag: any\n reason: string\n }> = []\n\n for (let i = 0; i < tags.length; i++) {\n const tag = tags[i]\n\n if (typeof tag !== 'string') {\n invalidTags.push({ tag, reason: 'invalid type, must be a string' })\n } else if (tag.length > NEXT_CACHE_TAG_MAX_LENGTH) {\n invalidTags.push({\n tag,\n reason: `exceeded max length of ${NEXT_CACHE_TAG_MAX_LENGTH}`,\n })\n } else {\n validTags.push(tag)\n }\n\n if (validTags.length > NEXT_CACHE_TAG_MAX_ITEMS) {\n console.warn(\n `Warning: exceeded max tag count for ${description}, dropped tags:`,\n tags.slice(i).join(', ')\n )\n break\n }\n }\n\n if (invalidTags.length > 0) {\n console.warn(`Warning: invalid tags passed to ${description}: `)\n\n for (const { tag, reason } of invalidTags) {\n console.log(`tag: \"${tag}\" ${reason}`)\n }\n }\n return validTags\n}\n\nfunction trackFetchMetric(\n workStore: WorkStore,\n ctx: Omit<FetchMetric, 'end' | 'idx'>\n) {\n if (!workStore.shouldTrackFetchMetrics) {\n return\n }\n\n workStore.fetchMetrics ??= []\n\n workStore.fetchMetrics.push({\n ...ctx,\n end: performance.timeOrigin + performance.now(),\n idx: workStore.nextFetchId || 0,\n })\n}\n\nasync function createCachedPrerenderResponse(\n res: Response,\n cacheKey: string,\n incrementalCacheContext: SetIncrementalFetchCacheContext | undefined,\n incrementalCache: IncrementalCache,\n revalidate: number,\n handleUnlock: () => Promise<void> | void\n): Promise<Response> {\n // We are prerendering at build time or revalidate time with cacheComponents so we\n // need to buffer the response so we can guarantee it can be read in a\n // microtask.\n const bodyBuffer = await res.arrayBuffer()\n\n const fetchedData = {\n headers: Object.fromEntries(res.headers.entries()),\n body: Buffer.from(bodyBuffer).toString('base64'),\n status: res.status,\n url: res.url,\n }\n\n // We can skip setting the serverComponentsHmrCache because we aren't in dev\n // mode.\n\n if (incrementalCacheContext) {\n await incrementalCache.set(\n cacheKey,\n { kind: CachedRouteKind.FETCH, data: fetchedData, revalidate },\n incrementalCacheContext\n )\n }\n\n await handleUnlock()\n\n // We return a new Response to the caller.\n return new Response(bodyBuffer, {\n headers: res.headers,\n status: res.status,\n statusText: res.statusText,\n })\n}\n\nasync function createCachedDynamicResponse(\n workStore: WorkStore,\n res: Response,\n cacheKey: string,\n incrementalCacheContext: SetIncrementalFetchCacheContext | undefined,\n incrementalCache: IncrementalCache,\n serverComponentsHmrCache: ServerComponentsHmrCache | undefined,\n revalidate: number,\n input: RequestInfo | URL,\n handleUnlock: () => Promise<void> | void\n): Promise<Response> {\n // We're cloning the response using this utility because there exists a bug in\n // the undici library around response cloning. See the following pull request\n // for more details: https://github.com/vercel/next.js/pull/73274\n const [cloned1, cloned2] = cloneResponse(res)\n\n // We are dynamically rendering including dev mode. We want to return the\n // response to the caller as soon as possible because it might stream over a\n // very long time.\n const cacheSetPromise = cloned1\n .arrayBuffer()\n .then(async (arrayBuffer) => {\n const bodyBuffer = Buffer.from(arrayBuffer)\n\n const fetchedData = {\n headers: Object.fromEntries(cloned1.headers.entries()),\n body: bodyBuffer.toString('base64'),\n status: cloned1.status,\n url: cloned1.url,\n }\n\n serverComponentsHmrCache?.set(cacheKey, fetchedData)\n\n if (incrementalCacheContext) {\n await incrementalCache.set(\n cacheKey,\n { kind: CachedRouteKind.FETCH, data: fetchedData, revalidate },\n incrementalCacheContext\n )\n }\n })\n .catch((error) => console.warn(`Failed to set fetch cache`, input, error))\n .finally(handleUnlock)\n\n const pendingRevalidateKey = `cache-set-${cacheKey}`\n const pendingRevalidates = (workStore.pendingRevalidates ??= {})\n\n let pendingRevalidatePromise = Promise.resolve()\n if (pendingRevalidateKey in pendingRevalidates) {\n // There is already a pending revalidate entry that we need to await to\n // avoid race conditions.\n pendingRevalidatePromise = pendingRevalidates[pendingRevalidateKey]\n }\n\n pendingRevalidates[pendingRevalidateKey] = pendingRevalidatePromise\n .then(() => cacheSetPromise)\n .finally(() => {\n // If the pending revalidate is not present in the store, then we have\n // nothing to delete.\n if (!pendingRevalidates?.[pendingRevalidateKey]) {\n return\n }\n\n delete pendingRevalidates[pendingRevalidateKey]\n })\n\n return cloned2\n}\n\ninterface PatchableModule {\n workAsyncStorage: WorkAsyncStorage\n workUnitAsyncStorage: WorkUnitAsyncStorage\n}\n\nexport function createPatchedFetcher(\n originFetch: Fetcher,\n { workAsyncStorage, workUnitAsyncStorage }: PatchableModule\n): PatchedFetcher {\n // Create the patched fetch function.\n const patched = async function fetch(\n input: RequestInfo | URL,\n init: RequestInit | undefined\n ): Promise<Response> {\n let url: URL | undefined\n try {\n url = new URL(input instanceof Request ? input.url : input)\n url.username = ''\n url.password = ''\n } catch {\n // Error caused by malformed URL should be handled by native fetch\n url = undefined\n }\n const fetchUrl = url?.href ?? ''\n const method = init?.method?.toUpperCase() || 'GET'\n\n // Do create a new span trace for internal fetches in the\n // non-verbose mode.\n const isInternal = (init?.next as any)?.internal === true\n const hideSpan = process.env.NEXT_OTEL_FETCH_DISABLED === '1'\n // We don't track fetch metrics for internal fetches\n // so it's not critical that we have a start time, as it won't be recorded.\n // This is to workaround a flaky issue where performance APIs might\n // not be available and will require follow-up investigation.\n const fetchStart: number | undefined = isInternal\n ? undefined\n : performance.timeOrigin + performance.now()\n\n const workStore = workAsyncStorage.getStore()\n const workUnitStore = workUnitAsyncStorage.getStore()\n\n let cacheSignal = workUnitStore ? getCacheSignal(workUnitStore) : null\n if (cacheSignal) {\n cacheSignal.beginRead()\n }\n\n const result = getTracer().trace(\n isInternal ? NextNodeServerSpan.internalFetch : AppRenderSpan.fetch,\n {\n hideSpan,\n kind: SpanKind.CLIENT,\n spanName: ['fetch', method, fetchUrl].filter(Boolean).join(' '),\n attributes: {\n 'http.url': fetchUrl,\n 'http.method': method,\n 'net.peer.name': url?.hostname,\n 'net.peer.port': url?.port || undefined,\n },\n },\n async () => {\n // If this is an internal fetch, we should not do any special treatment.\n if (isInternal) {\n return originFetch(input, init)\n }\n\n // If the workStore is not available, we can't do any\n // special treatment of fetch, therefore fallback to the original\n // fetch implementation.\n if (!workStore) {\n return originFetch(input, init)\n }\n\n // We should also fallback to the original fetch implementation if we\n // are in draft mode, it does not constitute a static generation.\n if (workStore.isDraftMode) {\n return originFetch(input, init)\n }\n\n const isRequestInput =\n input &&\n typeof input === 'object' &&\n typeof (input as Request).method === 'string'\n\n const getRequestMeta = (field: string) => {\n // If request input is present but init is not, retrieve from input first.\n const value = (init as any)?.[field]\n return value || (isRequestInput ? (input as any)[field] : null)\n }\n\n let finalRevalidate: number | undefined = undefined\n const getNextField = (field: 'revalidate' | 'tags') => {\n return typeof init?.next?.[field] !== 'undefined'\n ? init?.next?.[field]\n : isRequestInput\n ? (input as any).next?.[field]\n : undefined\n }\n // RequestInit doesn't keep extra fields e.g. next so it's\n // only available if init is used separate\n const originalFetchRevalidate = getNextField('revalidate')\n let currentFetchRevalidate = originalFetchRevalidate\n const tags: string[] = validateTags(\n getNextField('tags') || [],\n `fetch ${input.toString()}`\n )\n\n let revalidateStore: RevalidateStore | undefined\n\n if (workUnitStore) {\n switch (workUnitStore.type) {\n case 'prerender':\n case 'prerender-runtime':\n // TODO: Stop accumulating tags in client prerender. (fallthrough)\n case 'prerender-client':\n case 'prerender-ppr':\n case 'prerender-legacy':\n case 'cache':\n case 'private-cache':\n revalidateStore = workUnitStore\n break\n case 'request':\n case 'unstable-cache':\n break\n default:\n workUnitStore satisfies never\n }\n }\n\n if (revalidateStore) {\n if (Array.isArray(tags)) {\n // Collect tags onto parent caches or parent prerenders.\n const collectedTags =\n revalidateStore.tags ?? (revalidateStore.tags = [])\n for (const tag of tags) {\n if (!collectedTags.includes(tag)) {\n collectedTags.push(tag)\n }\n }\n }\n }\n\n const implicitTags = workUnitStore?.implicitTags\n\n let pageFetchCacheMode = workStore.fetchCache\n\n if (workUnitStore) {\n switch (workUnitStore.type) {\n case 'unstable-cache':\n // Inside unstable-cache we treat it the same as force-no-store on\n // the page.\n pageFetchCacheMode = 'force-no-store'\n break\n case 'prerender':\n case 'prerender-client':\n case 'prerender-runtime':\n case 'prerender-ppr':\n case 'prerender-legacy':\n case 'request':\n case 'cache':\n case 'private-cache':\n break\n default:\n workUnitStore satisfies never\n }\n }\n\n const isUsingNoStore = !!workStore.isUnstableNoStore\n\n let currentFetchCacheConfig = getRequestMeta('cache')\n let cacheReason = ''\n let cacheWarning: string | undefined\n\n if (\n typeof currentFetchCacheConfig === 'string' &&\n typeof currentFetchRevalidate !== 'undefined'\n ) {\n // If the revalidate value conflicts with the cache value, we should warn the user and unset the conflicting values.\n const isConflictingRevalidate =\n // revalidate: 0 and cache: force-cache\n (currentFetchCacheConfig === 'force-cache' &&\n currentFetchRevalidate === 0) ||\n // revalidate: >0 or revalidate: false and cache: no-store\n (currentFetchCacheConfig === 'no-store' &&\n (currentFetchRevalidate > 0 || currentFetchRevalidate === false))\n\n if (isConflictingRevalidate) {\n cacheWarning = `Specified \"cache: ${currentFetchCacheConfig}\" and \"revalidate: ${currentFetchRevalidate}\", only one should be specified.`\n currentFetchCacheConfig = undefined\n currentFetchRevalidate = undefined\n }\n }\n\n const hasExplicitFetchCacheOptOut =\n // fetch config itself signals not to cache\n currentFetchCacheConfig === 'no-cache' ||\n currentFetchCacheConfig === 'no-store' ||\n // the fetch isn't explicitly caching and the segment level cache config signals not to cache\n // note: `pageFetchCacheMode` is also set by being in an unstable_cache context.\n pageFetchCacheMode === 'force-no-store' ||\n pageFetchCacheMode === 'only-no-store'\n\n // If no explicit fetch cache mode is set, but dynamic = `force-dynamic` is set,\n // we shouldn't consider caching the fetch. This is because the `dynamic` cache\n // is considered a \"top-level\" cache mode, whereas something like `fetchCache` is more\n // fine-grained. Top-level modes are responsible for setting reasonable defaults for the\n // other configurations.\n const noFetchConfigAndForceDynamic =\n !pageFetchCacheMode &&\n !currentFetchCacheConfig &&\n !currentFetchRevalidate &&\n workStore.forceDynamic\n\n if (\n // force-cache was specified without a revalidate value. We set the revalidate value to false\n // which will signal the cache to not revalidate\n currentFetchCacheConfig === 'force-cache' &&\n typeof currentFetchRevalidate === 'undefined'\n ) {\n currentFetchRevalidate = false\n } else if (\n hasExplicitFetchCacheOptOut ||\n noFetchConfigAndForceDynamic\n ) {\n currentFetchRevalidate = 0\n }\n\n if (\n currentFetchCacheConfig === 'no-cache' ||\n currentFetchCacheConfig === 'no-store'\n ) {\n cacheReason = `cache: ${currentFetchCacheConfig}`\n }\n\n finalRevalidate = validateRevalidate(\n currentFetchRevalidate,\n workStore.route\n )\n\n const _headers = getRequestMeta('headers')\n const initHeaders: Headers =\n typeof _headers?.get === 'function'\n ? _headers\n : new Headers(_headers || {})\n\n const hasUnCacheableHeader =\n initHeaders.get('authorization') || initHeaders.get('cookie')\n\n const isUnCacheableMethod = !['get', 'head'].includes(\n getRequestMeta('method')?.toLowerCase() || 'get'\n )\n\n /**\n * We automatically disable fetch caching under the following conditions:\n * - Fetch cache configs are not set. Specifically:\n * - A page fetch cache mode is not set (export const fetchCache=...)\n * - A fetch cache mode is not set in the fetch call (fetch(url, { cache: ... }))\n * or the fetch cache mode is set to 'default'\n * - A fetch revalidate value is not set in the fetch call (fetch(url, { revalidate: ... }))\n * - OR the fetch comes after a configuration that triggered dynamic rendering (e.g., reading cookies())\n * and the fetch was considered uncacheable (e.g., POST method or has authorization headers)\n */\n const hasNoExplicitCacheConfig =\n // eslint-disable-next-line eqeqeq\n pageFetchCacheMode == undefined &&\n // eslint-disable-next-line eqeqeq\n (currentFetchCacheConfig == undefined ||\n // when considering whether to opt into the default \"no-cache\" fetch semantics,\n // a \"default\" cache config should be treated the same as no cache config\n currentFetchCacheConfig === 'default') &&\n // eslint-disable-next-line eqeqeq\n currentFetchRevalidate == undefined\n\n let autoNoCache = Boolean(\n (hasUnCacheableHeader || isUnCacheableMethod) &&\n revalidateStore?.revalidate === 0\n )\n\n let isImplicitBuildTimeCache = false\n\n if (!autoNoCache && hasNoExplicitCacheConfig) {\n // We don't enable automatic no-cache behavior during build-time\n // prerendering so that we can still leverage the fetch cache between\n // export workers.\n if (workStore.isBuildTimePrerendering) {\n isImplicitBuildTimeCache = true\n } else {\n autoNoCache = true\n }\n }\n\n // If we have no cache config, and we're in Dynamic I/O prerendering,\n // it'll be a dynamic call. We don't have to issue that dynamic call.\n if (hasNoExplicitCacheConfig && workUnitStore !== undefined) {\n switch (workUnitStore.type) {\n case 'prerender':\n case 'prerender-runtime':\n // While we don't want to do caching in the client scope we know the\n // fetch will be dynamic for cacheComponents so we may as well avoid the\n // call here. (fallthrough)\n case 'prerender-client':\n if (cacheSignal) {\n cacheSignal.endRead()\n cacheSignal = null\n }\n\n return makeHangingPromise<Response>(\n workUnitStore.renderSignal,\n workStore.route,\n 'fetch()'\n )\n case 'request':\n if (\n process.env.NODE_ENV === 'development' &&\n workUnitStore.stagedRendering\n ) {\n if (cacheSignal) {\n cacheSignal.endRead()\n cacheSignal = null\n }\n await workUnitStore.stagedRendering.waitForStage(\n RenderStage.Dynamic\n )\n }\n break\n case 'prerender-ppr':\n case 'prerender-legacy':\n case 'cache':\n case 'private-cache':\n case 'unstable-cache':\n break\n default:\n workUnitStore satisfies never\n }\n }\n\n switch (pageFetchCacheMode) {\n case 'force-no-store': {\n cacheReason = 'fetchCache = force-no-store'\n break\n }\n case 'only-no-store': {\n if (\n currentFetchCacheConfig === 'force-cache' ||\n (typeof finalRevalidate !== 'undefined' && finalRevalidate > 0)\n ) {\n throw new Error(\n `cache: 'force-cache' used on fetch for ${fetchUrl} with 'export const fetchCache = 'only-no-store'`\n )\n }\n cacheReason = 'fetchCache = only-no-store'\n break\n }\n case 'only-cache': {\n if (currentFetchCacheConfig === 'no-store') {\n throw new Error(\n `cache: 'no-store' used on fetch for ${fetchUrl} with 'export const fetchCache = 'only-cache'`\n )\n }\n break\n }\n case 'force-cache': {\n if (\n typeof currentFetchRevalidate === 'undefined' ||\n currentFetchRevalidate === 0\n ) {\n cacheReason = 'fetchCache = force-cache'\n finalRevalidate = INFINITE_CACHE\n }\n break\n }\n case 'default-cache':\n case 'default-no-store':\n case 'auto':\n case undefined:\n // sometimes we won't match the above cases. the reason we don't move\n // everything to this switch is the use of autoNoCache which is not a fetchCacheMode\n // I suspect this could be unified with fetchCacheMode however in which case we could\n // simplify the switch case and ensure we have an exhaustive switch handling all modes\n break\n default:\n pageFetchCacheMode satisfies never\n }\n\n if (typeof finalRevalidate === 'undefined') {\n if (pageFetchCacheMode === 'default-cache' && !isUsingNoStore) {\n finalRevalidate = INFINITE_CACHE\n cacheReason = 'fetchCache = default-cache'\n } else if (pageFetchCacheMode === 'default-no-store') {\n finalRevalidate = 0\n cacheReason = 'fetchCache = default-no-store'\n } else if (isUsingNoStore) {\n finalRevalidate = 0\n cacheReason = 'noStore call'\n } else if (autoNoCache) {\n finalRevalidate = 0\n cacheReason = 'auto no cache'\n } else {\n // TODO: should we consider this case an invariant?\n cacheReason = 'auto cache'\n finalRevalidate = revalidateStore\n ? revalidateStore.revalidate\n : INFINITE_CACHE\n }\n } else if (!cacheReason) {\n cacheReason = `revalidate: ${finalRevalidate}`\n }\n\n if (\n // when force static is configured we don't bail from\n // `revalidate: 0` values\n !(workStore.forceStatic && finalRevalidate === 0) &&\n // we don't consider autoNoCache to switch to dynamic for ISR\n !autoNoCache &&\n // If the revalidate value isn't currently set or the value is less\n // than the current revalidate value, we should update the revalidate\n // value.\n revalidateStore &&\n finalRevalidate < revalidateStore.revalidate\n ) {\n // If we were setting the revalidate value to 0, we should try to\n // postpone instead first.\n if (finalRevalidate === 0) {\n if (workUnitStore) {\n switch (workUnitStore.type) {\n case 'prerender':\n case 'prerender-client':\n case 'prerender-runtime':\n if (cacheSignal) {\n cacheSignal.endRead()\n cacheSignal = null\n }\n return makeHangingPromise<Response>(\n workUnitStore.renderSignal,\n workStore.route,\n 'fetch()'\n )\n case 'request':\n if (\n process.env.NODE_ENV === 'development' &&\n workUnitStore.stagedRendering\n ) {\n if (cacheSignal) {\n cacheSignal.endRead()\n cacheSignal = null\n }\n await workUnitStore.stagedRendering.waitForStage(\n RenderStage.Dynamic\n )\n }\n break\n case 'prerender-ppr':\n case 'prerender-legacy':\n case 'cache':\n case 'private-cache':\n case 'unstable-cache':\n break\n default:\n workUnitStore satisfies never\n }\n }\n\n markCurrentScopeAsDynamic(\n workStore,\n workUnitStore,\n `revalidate: 0 fetch ${input} ${workStore.route}`\n )\n }\n\n // We only want to set the revalidate store's revalidate time if it\n // was explicitly set for the fetch call, i.e.\n // originalFetchRevalidate.\n if (revalidateStore && originalFetchRevalidate === finalRevalidate) {\n revalidateStore.revalidate = finalRevalidate\n }\n }\n\n const isCacheableRevalidate =\n typeof finalRevalidate === 'number' && finalRevalidate > 0\n\n let cacheKey: string | undefined\n const { incrementalCache } = workStore\n let isHmrRefresh = false\n let serverComponentsHmrCache: ServerComponentsHmrCache | undefined\n\n if (workUnitStore) {\n switch (workUnitStore.type) {\n case 'request':\n case 'cache':\n case 'private-cache':\n isHmrRefresh = workUnitStore.isHmrRefresh ?? false\n serverComponentsHmrCache = workUnitStore.serverComponentsHmrCache\n break\n case 'prerender':\n case 'prerender-client':\n case 'prerender-runtime':\n case 'prerender-ppr':\n case 'prerender-legacy':\n case 'unstable-cache':\n break\n default:\n workUnitStore satisfies never\n }\n }\n\n if (\n incrementalCache &&\n (isCacheableRevalidate || serverComponentsHmrCache)\n ) {\n try {\n cacheKey = await incrementalCache.generateCacheKey(\n fetchUrl,\n isRequestInput ? (input as RequestInit) : init\n )\n } catch (err) {\n console.error(`Failed to generate cache key for`, input)\n }\n }\n\n const fetchIdx = workStore.nextFetchId ?? 1\n workStore.nextFetchId = fetchIdx + 1\n\n let handleUnlock: () => Promise<void> | void = () => {}\n\n const doOriginalFetch = async (\n isStale?: boolean,\n cacheReasonOverride?: string\n ) => {\n const requestInputFields = [\n 'cache',\n 'credentials',\n 'headers',\n 'integrity',\n 'keepalive',\n 'method',\n 'mode',\n 'redirect',\n 'referrer',\n 'referrerPolicy',\n 'window',\n 'duplex',\n\n // don't pass through signal when revalidating\n ...(isStale ? [] : ['signal']),\n ]\n\n if (isRequestInput) {\n const reqInput: Request = input as any\n const reqOptions: RequestInit = {\n body: (reqInput as any)._ogBody || reqInput.body,\n }\n\n for (const field of requestInputFields) {\n // @ts-expect-error custom fields\n reqOptions[field] = reqInput[field]\n }\n input = new Request(reqInput.url, reqOptions)\n } else if (init) {\n const { _ogBody, body, signal, ...otherInput } =\n init as RequestInit & { _ogBody?: any }\n init = {\n ...otherInput,\n body: _ogBody || body,\n signal: isStale ? undefined : signal,\n }\n }\n\n // add metadata to init without editing the original\n const clonedInit = {\n ...init,\n next: { ...init?.next, fetchType: 'origin', fetchIdx },\n }\n\n return originFetch(input, clonedInit)\n .then(async (res) => {\n if (!isStale && fetchStart) {\n trackFetchMetric(workStore, {\n start: fetchStart,\n url: fetchUrl,\n cacheReason: cacheReasonOverride || cacheReason,\n cacheStatus:\n finalRevalidate === 0 || cacheReasonOverride\n ? 'skip'\n : 'miss',\n cacheWarning,\n status: res.status,\n method: clonedInit.method || 'GET',\n })\n }\n if (\n res.status === 200 &&\n incrementalCache &&\n cacheKey &&\n (isCacheableRevalidate || serverComponentsHmrCache)\n ) {\n const normalizedRevalidate =\n finalRevalidate >= INFINITE_CACHE\n ? CACHE_ONE_YEAR\n : finalRevalidate\n\n const incrementalCacheConfig:\n | SetIncrementalFetchCacheContext\n | undefined = isCacheableRevalidate\n ? {\n fetchCache: true,\n fetchUrl,\n fetchIdx,\n tags,\n isImplicitBuildTimeCache,\n }\n : undefined\n\n switch (workUnitStore?.type) {\n case 'prerender':\n case 'prerender-client':\n case 'prerender-runtime':\n return createCachedPrerenderResponse(\n res,\n cacheKey,\n incrementalCacheConfig,\n incrementalCache,\n normalizedRevalidate,\n handleUnlock\n )\n case 'request':\n if (\n process.env.NODE_ENV === 'development' &&\n workUnitStore.stagedRendering &&\n workUnitStore.cacheSignal\n ) {\n // We're filling caches for a staged render,\n // so we need to wait for the response to finish instead of streaming.\n return createCachedPrerenderResponse(\n res,\n cacheKey,\n incrementalCacheConfig,\n incrementalCache,\n normalizedRevalidate,\n handleUnlock\n )\n }\n // fallthrough\n case 'prerender-ppr':\n case 'prerender-legacy':\n case 'cache':\n case 'private-cache':\n case 'unstable-cache':\n case undefined:\n return createCachedDynamicResponse(\n workStore,\n res,\n cacheKey,\n incrementalCacheConfig,\n incrementalCache,\n serverComponentsHmrCache,\n normalizedRevalidate,\n input,\n handleUnlock\n )\n default:\n workUnitStore satisfies never\n }\n }\n\n // we had response that we determined shouldn't be cached so we return it\n // and don't cache it. This also needs to unlock the cache lock we acquired.\n await handleUnlock()\n\n return res\n })\n .catch((error) => {\n handleUnlock()\n throw error\n })\n }\n\n let cacheReasonOverride\n let isForegroundRevalidate = false\n let isHmrRefreshCache = false\n\n if (cacheKey && incrementalCache) {\n let cachedFetchData: CachedFetchData | undefined\n\n if (isHmrRefresh && serverComponentsHmrCache) {\n cachedFetchData = serverComponentsHmrCache.get(cacheKey)\n isHmrRefreshCache = true\n }\n\n if (isCacheableRevalidate && !cachedFetchData) {\n handleUnlock = await incrementalCache.lock(cacheKey)\n const entry = workStore.isOnDemandRevalidate\n ? null\n : await incrementalCache.get(cacheKey, {\n kind: IncrementalCacheKind.FETCH,\n revalidate: finalRevalidate,\n fetchUrl,\n fetchIdx,\n tags,\n softTags: implicitTags?.tags,\n })\n\n if (hasNoExplicitCacheConfig && workUnitStore) {\n switch (workUnitStore.type) {\n case 'prerender':\n case 'prerender-client':\n case 'prerender-runtime':\n // We sometimes use the cache to dedupe fetches that do not\n // specify a cache configuration. In these cases we want to\n // make sure we still exclude them from prerenders if\n // cacheComponents is on so we introduce an artificial task boundary\n // here.\n await getTimeoutBoundary()\n break\n case 'request':\n if (\n process.env.NODE_ENV === 'development' &&\n workUnitStore.stagedRendering\n ) {\n await workUnitStore.stagedRendering.waitForStage(\n RenderStage.Dynamic\n )\n }\n break\n case 'prerender-ppr':\n case 'prerender-legacy':\n case 'cache':\n case 'private-cache':\n case 'unstable-cache':\n break\n default:\n workUnitStore satisfies never\n }\n }\n\n if (entry) {\n await handleUnlock()\n } else {\n // in dev, incremental cache response will be null in case the browser adds `cache-control: no-cache` in the request headers\n // TODO: it seems like we also hit this after revalidates in dev?\n cacheReasonOverride = 'cache-control: no-cache (hard refresh)'\n }\n\n if (entry?.value && entry.value.kind === CachedRouteKind.FETCH) {\n // when stale and is revalidating we wait for fresh data\n // so the revalidated entry has the updated data\n if (workStore.isStaticGeneration && entry.isStale) {\n isForegroundRevalidate = true\n } else {\n if (entry.isStale) {\n workStore.pendingRevalidates ??= {}\n if (!workStore.pendingRevalidates[cacheKey]) {\n const pendingRevalidate = doOriginalFetch(true)\n .then(async (response) => ({\n body: await response.arrayBuffer(),\n headers: response.headers,\n status: response.status,\n statusText: response.statusText,\n }))\n .finally(() => {\n workStore.pendingRevalidates ??= {}\n delete workStore.pendingRevalidates[cacheKey || '']\n })\n\n // Attach the empty catch here so we don't get a \"unhandled\n // promise rejection\" warning.\n pendingRevalidate.catch(console.error)\n\n workStore.pendingRevalidates[cacheKey] = pendingRevalidate\n }\n }\n\n cachedFetchData = entry.value.data\n }\n }\n }\n\n if (cachedFetchData) {\n if (fetchStart) {\n trackFetchMetric(workStore, {\n start: fetchStart,\n url: fetchUrl,\n cacheReason,\n cacheStatus: isHmrRefreshCache ? 'hmr' : 'hit',\n cacheWarning,\n status: cachedFetchData.status || 200,\n method: init?.method || 'GET',\n })\n }\n\n const response = new Response(\n Buffer.from(cachedFetchData.body, 'base64'),\n {\n headers: cachedFetchData.headers,\n status: cachedFetchData.status,\n }\n )\n\n Object.defineProperty(response, 'url', {\n value: cachedFetchData.url,\n })\n\n return response\n }\n }\n\n if (\n (workStore.isStaticGeneration ||\n (process.env.NODE_ENV === 'development' &&\n process.env.__NEXT_CACHE_COMPONENTS &&\n workUnitStore &&\n // eslint-disable-next-line no-restricted-syntax\n workUnitStore.type === 'request' &&\n workUnitStore.stagedRendering)) &&\n init &&\n typeof init === 'object'\n ) {\n const { cache } = init\n\n // Delete `cache` property as Cloudflare Workers will throw an error\n if (isEdgeRuntime) delete init.cache\n\n if (cache === 'no-store') {\n // If enabled, we should bail out of static generation.\n if (workUnitStore) {\n switch (workUnitStore.type) {\n case 'prerender':\n case 'prerender-client':\n case 'prerender-runtime':\n if (cacheSignal) {\n cacheSignal.endRead()\n cacheSignal = null\n }\n return makeHangingPromise<Response>(\n workUnitStore.renderSignal,\n workStore.route,\n 'fetch()'\n )\n case 'request':\n if (\n process.env.NODE_ENV === 'development' &&\n workUnitStore.stagedRendering\n ) {\n if (cacheSignal) {\n cacheSignal.endRead()\n cacheSignal = null\n }\n await workUnitStore.stagedRendering.waitForStage(\n RenderStage.Dynamic\n )\n }\n break\n case 'prerender-ppr':\n case 'prerender-legacy':\n case 'cache':\n case 'private-cache':\n case 'unstable-cache':\n break\n default:\n workUnitStore satisfies never\n }\n }\n markCurrentScopeAsDynamic(\n workStore,\n workUnitStore,\n `no-store fetch ${input} ${workStore.route}`\n )\n }\n\n const hasNextConfig = 'next' in init\n const { next = {} } = init\n if (\n typeof next.revalidate === 'number' &&\n revalidateStore &&\n next.revalidate < revalidateStore.revalidate\n ) {\n if (next.revalidate === 0) {\n // If enabled, we should bail out of static generation.\n if (workUnitStore) {\n switch (workUnitStore.type) {\n case 'prerender':\n case 'prerender-client':\n case 'prerender-runtime':\n return makeHangingPromise<Response>(\n workUnitStore.renderSignal,\n workStore.route,\n 'fetch()'\n )\n case 'request':\n if (\n process.env.NODE_ENV === 'development' &&\n workUnitStore.stagedRendering\n ) {\n await workUnitStore.stagedRendering.waitForStage(\n RenderStage.Dynamic\n )\n }\n break\n case 'cache':\n case 'private-cache':\n case 'unstable-cache':\n case 'prerender-legacy':\n case 'prerender-ppr':\n break\n default:\n workUnitStore satisfies never\n }\n }\n markCurrentScopeAsDynamic(\n workStore,\n workUnitStore,\n `revalidate: 0 fetch ${input} ${workStore.route}`\n )\n }\n\n if (!workStore.forceStatic || next.revalidate !== 0) {\n revalidateStore.revalidate = next.revalidate\n }\n }\n if (hasNextConfig) delete init.next\n }\n\n // if we are revalidating the whole page via time or on-demand and\n // the fetch cache entry is stale we should still de-dupe the\n // origin hit if it's a cache-able entry\n if (cacheKey && isForegroundRevalidate) {\n const pendingRevalidateKey = cacheKey\n workStore.pendingRevalidates ??= {}\n let pendingRevalidate =\n workStore.pendingRevalidates[pendingRevalidateKey]\n\n if (pendingRevalidate) {\n const revalidatedResult: {\n body: ArrayBuffer\n headers: Headers\n status: number\n statusText: string\n } = await pendingRevalidate\n return new Response(revalidatedResult.body, {\n headers: revalidatedResult.headers,\n status: revalidatedResult.status,\n statusText: revalidatedResult.statusText,\n })\n }\n\n // We used to just resolve the Response and clone it however for\n // static generation with cacheComponents we need the response to be able to\n // be resolved in a microtask and cloning the response will never have\n // a body that can resolve in a microtask in node (as observed through\n // experimentation) So instead we await the body and then when it is\n // available we construct manually cloned Response objects with the\n // body as an ArrayBuffer. This will be resolvable in a microtask\n // making it compatible with cacheComponents.\n const pendingResponse = doOriginalFetch(true, cacheReasonOverride)\n // We're cloning the response using this utility because there\n // exists a bug in the undici library around response cloning.\n // See the following pull request for more details:\n // https://github.com/vercel/next.js/pull/73274\n .then(cloneResponse)\n\n pendingRevalidate = pendingResponse\n .then(async (responses) => {\n const response = responses[0]\n return {\n body: await response.arrayBuffer(),\n headers: response.headers,\n status: response.status,\n statusText: response.statusText,\n }\n })\n .finally(() => {\n // If the pending revalidate is not present in the store, then\n // we have nothing to delete.\n if (!workStore.pendingRevalidates?.[pendingRevalidateKey]) {\n return\n }\n\n delete workStore.pendingRevalidates[pendingRevalidateKey]\n })\n\n // Attach the empty catch here so we don't get a \"unhandled promise\n // rejection\" warning\n pendingRevalidate.catch(() => {})\n\n workStore.pendingRevalidates[pendingRevalidateKey] = pendingRevalidate\n\n return pendingResponse.then((responses) => responses[1])\n } else {\n return doOriginalFetch(false, cacheReasonOverride)\n }\n }\n )\n\n if (cacheSignal) {\n try {\n return await result\n } finally {\n if (cacheSignal) {\n cacheSignal.endRead()\n }\n }\n }\n return result\n }\n\n // Attach the necessary properties to the patched fetch function.\n // We don't use this to determine if the fetch function has been patched,\n // but for external consumers to determine if the fetch function has been\n // patched.\n patched.__nextPatched = true as const\n patched.__nextGetStaticStore = () => workAsyncStorage\n patched._nextOriginalFetch = originFetch\n ;(globalThis as Record<symbol, unknown>)[NEXT_PATCH_SYMBOL] = true\n\n // Assign the function name also as a name property, so that it's preserved\n // even when mangling is enabled.\n Object.defineProperty(patched, 'name', { value: 'fetch', writable: false })\n\n return patched\n}\n\n// we patch fetch to collect cache information used for\n// determining if a page is static or not\nexport function patchFetch(options: PatchableModule) {\n // If we've already patched fetch, we should not patch it again.\n if (isFetchPatched()) return\n\n // Grab the original fetch function. We'll attach this so we can use it in\n // the patched fetch function.\n const original = createDedupeFetch(globalThis.fetch)\n\n // Set the global fetch to the patched fetch.\n globalThis.fetch = createPatchedFetcher(original, options)\n}\n\nlet currentTimeoutBoundary: null | Promise<void> = null\nfunction getTimeoutBoundary() {\n if (!currentTimeoutBoundary) {\n currentTimeoutBoundary = new Promise((r) => {\n setTimeout(() => {\n currentTimeoutBoundary = null\n r()\n }, 0)\n })\n }\n return currentTimeoutBoundary\n}\n","import type { IncrementalCache } from '../../lib/incremental-cache'\n\nimport { CACHE_ONE_YEAR } from '../../../lib/constants'\nimport { validateRevalidate, validateTags } from '../../lib/patch-fetch'\nimport {\n workAsyncStorage,\n type WorkStore,\n} from '../../app-render/work-async-storage.external'\nimport {\n getCacheSignal,\n getDraftModeProviderForCacheScope,\n workUnitAsyncStorage,\n} from '../../app-render/work-unit-async-storage.external'\nimport {\n CachedRouteKind,\n IncrementalCacheKind,\n type CachedFetchData,\n} from '../../response-cache'\nimport type {\n UnstableCacheStore,\n WorkUnitStore,\n} from '../../app-render/work-unit-async-storage.external'\n\ntype Callback = (...args: any[]) => Promise<any>\n\nlet noStoreFetchIdx = 0\n\nasync function cacheNewResult<T>(\n result: T,\n incrementalCache: IncrementalCache,\n cacheKey: string,\n tags: string[],\n revalidate: number | false | undefined,\n fetchIdx: number,\n fetchUrl: string\n): Promise<unknown> {\n await incrementalCache.set(\n cacheKey,\n {\n kind: CachedRouteKind.FETCH,\n data: {\n headers: {},\n // TODO: handle non-JSON values?\n body: JSON.stringify(result),\n status: 200,\n url: '',\n } satisfies CachedFetchData,\n revalidate: typeof revalidate !== 'number' ? CACHE_ONE_YEAR : revalidate,\n },\n { fetchCache: true, tags, fetchIdx, fetchUrl }\n )\n return\n}\n\n/**\n * This function allows you to cache the results of expensive operations, like database queries, and reuse them across multiple requests.\n *\n * Read more: [Next.js Docs: `unstable_cache`](https://nextjs.org/docs/app/api-reference/functions/unstable_cache)\n */\nexport function unstable_cache<T extends Callback>(\n cb: T,\n keyParts?: string[],\n options: {\n /**\n * The revalidation interval in seconds.\n */\n revalidate?: number | false\n tags?: string[]\n } = {}\n): T {\n if (options.revalidate === 0) {\n throw new Error(\n `Invariant revalidate: 0 can not be passed to unstable_cache(), must be \"false\" or \"> 0\" ${cb.toString()}`\n )\n }\n\n // Validate the tags provided are valid\n const tags = options.tags\n ? validateTags(options.tags, `unstable_cache ${cb.toString()}`)\n : []\n\n // Validate the revalidate options\n validateRevalidate(\n options.revalidate,\n `unstable_cache ${cb.name || cb.toString()}`\n )\n\n // Stash the fixed part of the key at construction time. The invocation key will combine\n // the fixed key with the arguments when actually called\n // @TODO if cb.toString() is long we should hash it\n // @TODO come up with a collision-free way to combine keyParts\n // @TODO consider validating the keyParts are all strings. TS can't provide runtime guarantees\n // and the error produced by accidentally using something that cannot be safely coerced is likely\n // hard to debug\n const fixedKey = `${cb.toString()}-${\n Array.isArray(keyParts) && keyParts.join(',')\n }`\n\n const cachedCb = async (...args: any[]) => {\n const workStore = workAsyncStorage.getStore()\n const workUnitStore = workUnitAsyncStorage.getStore()\n\n // We must be able to find the incremental cache otherwise we throw\n const maybeIncrementalCache:\n | import('../../lib/incremental-cache').IncrementalCache\n | undefined =\n workStore?.incrementalCache || (globalThis as any).__incrementalCache\n\n if (!maybeIncrementalCache) {\n throw new Error(\n `Invariant: incrementalCache missing in unstable_cache ${cb.toString()}`\n )\n }\n const incrementalCache = maybeIncrementalCache\n\n const cacheSignal = workUnitStore ? getCacheSignal(workUnitStore) : null\n if (cacheSignal) {\n cacheSignal.beginRead()\n }\n try {\n // If there's no request store, we aren't in a request (or we're not in\n // app router) and if there's no static generation store, we aren't in app\n // router. Default to an empty pathname and search params when there's no\n // request store or static generation store available.\n const fetchUrlPrefix =\n workStore && workUnitStore\n ? getFetchUrlPrefix(workStore, workUnitStore)\n : ''\n\n // Construct the complete cache key for this function invocation\n // @TODO stringify is likely not safe here. We will coerce undefined to null which will make\n // the keyspace smaller than the execution space\n const invocationKey = `${fixedKey}-${JSON.stringify(args)}`\n const cacheKey = await incrementalCache.generateCacheKey(invocationKey)\n // $urlWithPath,$sortedQueryStringKeys,$hashOfEveryThingElse\n const fetchUrl = `unstable_cache ${fetchUrlPrefix} ${cb.name ? ` ${cb.name}` : cacheKey}`\n const fetchIdx =\n (workStore ? workStore.nextFetchId : noStoreFetchIdx) ?? 1\n\n const implicitTags = workUnitStore?.implicitTags\n\n const innerCacheStore: UnstableCacheStore = {\n type: 'unstable-cache',\n phase: 'render',\n implicitTags,\n draftMode:\n workUnitStore &&\n workStore &&\n getDraftModeProviderForCacheScope(workStore, workUnitStore),\n }\n\n if (workStore) {\n workStore.nextFetchId = fetchIdx + 1\n\n // We are in an App Router context. We try to return the cached entry if it exists and is valid\n // If the entry is fresh we return it. If the entry is stale we return it but revalidate the entry in\n // the background. If the entry is missing or invalid we generate a new entry and return it.\n\n let isNestedUnstableCache = false\n\n if (workUnitStore) {\n switch (workUnitStore.type) {\n case 'cache':\n case 'private-cache':\n case 'prerender':\n case 'prerender-runtime':\n case 'prerender-ppr':\n case 'prerender-legacy':\n // We update the store's revalidate property if the option.revalidate is a higher precedence\n // options.revalidate === undefined doesn't affect timing.\n // options.revalidate === false doesn't shrink timing. it stays at the maximum.\n if (typeof options.revalidate === 'number') {\n if (workUnitStore.revalidate < options.revalidate) {\n // The store is already revalidating on a shorter time interval, leave it alone\n } else {\n workUnitStore.revalidate = options.revalidate\n }\n }\n\n // We need to accumulate the tags for this invocation within the store\n const collectedTags = workUnitStore.tags\n if (collectedTags === null) {\n workUnitStore.tags = tags.slice()\n } else {\n for (const tag of tags) {\n // @TODO refactor tags to be a set to avoid this O(n) lookup\n if (!collectedTags.includes(tag)) {\n collectedTags.push(tag)\n }\n }\n }\n break\n case 'unstable-cache':\n isNestedUnstableCache = true\n break\n case 'prerender-client':\n case 'request':\n break\n default:\n workUnitStore satisfies never\n }\n }\n\n if (\n // when we are nested inside of other unstable_cache's\n // we should bypass cache similar to fetches\n !isNestedUnstableCache &&\n workStore.fetchCache !== 'force-no-store' &&\n !workStore.isOnDemandRevalidate &&\n !incrementalCache.isOnDemandRevalidate &&\n !workStore.isDraftMode\n ) {\n // We attempt to get the current cache entry from the incremental cache.\n const cacheEntry = await incrementalCache.get(cacheKey, {\n kind: IncrementalCacheKind.FETCH,\n revalidate: options.revalidate,\n tags,\n softTags: implicitTags?.tags,\n fetchIdx,\n fetchUrl,\n })\n\n if (cacheEntry && cacheEntry.value) {\n // The entry exists and has a value\n if (cacheEntry.value.kind !== CachedRouteKind.FETCH) {\n // The entry is invalid and we need a special warning\n // @TODO why do we warn this way? Should this just be an error? How are these errors surfaced\n // so bugs can be reported\n // @TODO the invocation key can have sensitive data in it. we should not log this entire object\n console.error(\n `Invariant invalid cacheEntry returned for ${invocationKey}`\n )\n // will fall through to generating a new cache entry below\n } else {\n // We have a valid cache entry so we will be returning it. We also check to see if we need\n // to background revalidate it by checking if it is stale.\n const cachedResponse =\n cacheEntry.value.data.body !== undefined\n ? JSON.parse(cacheEntry.value.data.body)\n : undefined\n\n if (cacheEntry.isStale) {\n if (!workStore.pendingRevalidates) {\n workStore.pendingRevalidates = {}\n }\n\n // Check if there's already a pending revalidation to avoid duplicate work\n if (!workStore.pendingRevalidates[invocationKey]) {\n // Create the revalidation promise\n const revalidationPromise = workUnitAsyncStorage\n .run(innerCacheStore, cb, ...args)\n .then(async (result) => {\n await cacheNewResult(\n result,\n incrementalCache,\n cacheKey,\n tags,\n options.revalidate,\n fetchIdx,\n fetchUrl\n )\n return result\n })\n .catch((err) => {\n // @TODO This error handling seems wrong. We swallow the error?\n console.error(\n `revalidating cache with key: ${invocationKey}`,\n err\n )\n // Return the stale value on error for foreground revalidation\n return cachedResponse\n })\n\n // Attach the empty catch here so we don't get a \"unhandled promise\n // rejection\" warning. (Behavior is matched with patch-fetch)\n if (workStore.isStaticGeneration) {\n revalidationPromise.catch(() => {})\n }\n\n workStore.pendingRevalidates[invocationKey] =\n revalidationPromise\n }\n\n // Check if we need to do foreground revalidation\n if (workStore.isStaticGeneration) {\n // When the page is revalidating and the cache entry is stale,\n // we need to wait for fresh data (blocking revalidate)\n return workStore.pendingRevalidates[invocationKey]\n }\n // Otherwise, we're doing background revalidation - return stale immediately\n }\n\n // We had a valid cache entry so we return it here\n return cachedResponse\n }\n }\n }\n\n // If we got this far then we had an invalid cache entry and need to generate a new one\n const result = await workUnitAsyncStorage.run(\n innerCacheStore,\n cb,\n ...args\n )\n\n if (!workStore.isDraftMode) {\n if (!workStore.pendingRevalidates) {\n workStore.pendingRevalidates = {}\n }\n\n // We need to push the cache result promise to pending\n // revalidates otherwise it won't be awaited and is just\n // dangling\n workStore.pendingRevalidates[invocationKey] = cacheNewResult(\n result,\n incrementalCache,\n cacheKey,\n tags,\n options.revalidate,\n fetchIdx,\n fetchUrl\n )\n }\n\n return result\n } else {\n noStoreFetchIdx += 1\n // We are in Pages Router or were called outside of a render. We don't have a store\n // so we just call the callback directly when it needs to run.\n // If the entry is fresh we return it. If the entry is stale we return it but revalidate the entry in\n // the background. If the entry is missing or invalid we generate a new entry and return it.\n\n if (!incrementalCache.isOnDemandRevalidate) {\n // We aren't doing an on demand revalidation so we check use the cache if valid\n const cacheEntry = await incrementalCache.get(cacheKey, {\n kind: IncrementalCacheKind.FETCH,\n revalidate: options.revalidate,\n tags,\n fetchIdx,\n fetchUrl,\n softTags: implicitTags?.tags,\n })\n\n if (cacheEntry && cacheEntry.value) {\n // The entry exists and has a value\n if (cacheEntry.value.kind !== CachedRouteKind.FETCH) {\n // The entry is invalid and we need a special warning\n // @TODO why do we warn this way? Should this just be an error? How are these errors surfaced\n // so bugs can be reported\n console.error(\n `Invariant invalid cacheEntry returned for ${invocationKey}`\n )\n // will fall through to generating a new cache entry below\n } else if (!cacheEntry.isStale) {\n // We have a valid cache entry and it is fresh so we return it\n return cacheEntry.value.data.body !== undefined\n ? JSON.parse(cacheEntry.value.data.body)\n : undefined\n }\n }\n }\n\n // If we got this far then we had an invalid cache entry and need to generate a new one\n const result = await workUnitAsyncStorage.run(\n innerCacheStore,\n cb,\n ...args\n )\n\n // we need to wait setting the new cache result here as\n // we don't have pending revalidates on workStore to\n // push to and we can't have a dangling promise\n await cacheNewResult(\n result,\n incrementalCache,\n cacheKey,\n tags,\n options.revalidate,\n fetchIdx,\n fetchUrl\n )\n return result\n }\n } finally {\n if (cacheSignal) {\n cacheSignal.endRead()\n }\n }\n }\n // TODO: once AsyncLocalStorage.run() returns the correct types this override will no longer be necessary\n return cachedCb as unknown as T\n}\n\nfunction getFetchUrlPrefix(\n workStore: WorkStore,\n workUnitStore: WorkUnitStore\n): string {\n switch (workUnitStore.type) {\n case 'request':\n const pathname = workUnitStore.url.pathname\n const searchParams = new URLSearchParams(workUnitStore.url.search)\n\n const sortedSearch = [...searchParams.keys()]\n .sort((a, b) => a.localeCompare(b))\n .map((key) => `${key}=${searchParams.get(key)}`)\n .join('&')\n\n return `${pathname}${sortedSearch.length ? '?' : ''}${sortedSearch}`\n case 'prerender':\n case 'prerender-client':\n case 'prerender-runtime':\n case 'prerender-ppr':\n case 'prerender-legacy':\n case 'cache':\n case 'private-cache':\n case 'unstable-cache':\n return workStore.route\n default:\n return workUnitStore satisfies never\n }\n}\n","class UrlNode {\n placeholder: boolean = true\n children: Map<string, UrlNode> = new Map()\n slugName: string | null = null\n restSlugName: string | null = null\n optionalRestSlugName: string | null = null\n\n insert(urlPath: string): void {\n this._insert(urlPath.split('/').filter(Boolean), [], false)\n }\n\n smoosh(): string[] {\n return this._smoosh()\n }\n\n private _smoosh(prefix: string = '/'): string[] {\n const childrenPaths = [...this.children.keys()].sort()\n if (this.slugName !== null) {\n childrenPaths.splice(childrenPaths.indexOf('[]'), 1)\n }\n if (this.restSlugName !== null) {\n childrenPaths.splice(childrenPaths.indexOf('[...]'), 1)\n }\n if (this.optionalRestSlugName !== null) {\n childrenPaths.splice(childrenPaths.indexOf('[[...]]'), 1)\n }\n\n const routes = childrenPaths\n .map((c) => this.children.get(c)!._smoosh(`${prefix}${c}/`))\n .reduce((prev, curr) => [...prev, ...curr], [])\n\n if (this.slugName !== null) {\n routes.push(\n ...this.children.get('[]')!._smoosh(`${prefix}[${this.slugName}]/`)\n )\n }\n\n if (!this.placeholder) {\n const r = prefix === '/' ? '/' : prefix.slice(0, -1)\n if (this.optionalRestSlugName != null) {\n throw new Error(\n `You cannot define a route with the same specificity as a optional catch-all route (\"${r}\" and \"${r}[[...${this.optionalRestSlugName}]]\").`\n )\n }\n\n routes.unshift(r)\n }\n\n if (this.restSlugName !== null) {\n routes.push(\n ...this.children\n .get('[...]')!\n ._smoosh(`${prefix}[...${this.restSlugName}]/`)\n )\n }\n\n if (this.optionalRestSlugName !== null) {\n routes.push(\n ...this.children\n .get('[[...]]')!\n ._smoosh(`${prefix}[[...${this.optionalRestSlugName}]]/`)\n )\n }\n\n return routes\n }\n\n private _insert(\n urlPaths: string[],\n slugNames: string[],\n isCatchAll: boolean\n ): void {\n if (urlPaths.length === 0) {\n this.placeholder = false\n return\n }\n\n if (isCatchAll) {\n throw new Error(`Catch-all must be the last part of the URL.`)\n }\n\n // The next segment in the urlPaths list\n let nextSegment = urlPaths[0]\n\n // Check if the segment matches `[something]`\n if (nextSegment.startsWith('[') && nextSegment.endsWith(']')) {\n // Strip `[` and `]`, leaving only `something`\n let segmentName = nextSegment.slice(1, -1)\n\n let isOptional = false\n if (segmentName.startsWith('[') && segmentName.endsWith(']')) {\n // Strip optional `[` and `]`, leaving only `something`\n segmentName = segmentName.slice(1, -1)\n isOptional = true\n }\n\n if (segmentName.startsWith('…')) {\n throw new Error(\n `Detected a three-dot character ('…') at ('${segmentName}'). Did you mean ('...')?`\n )\n }\n\n if (segmentName.startsWith('...')) {\n // Strip `...`, leaving only `something`\n segmentName = segmentName.substring(3)\n isCatchAll = true\n }\n\n if (segmentName.startsWith('[') || segmentName.endsWith(']')) {\n throw new Error(\n `Segment names may not start or end with extra brackets ('${segmentName}').`\n )\n }\n\n if (segmentName.startsWith('.')) {\n throw new Error(\n `Segment names may not start with erroneous periods ('${segmentName}').`\n )\n }\n\n function handleSlug(previousSlug: string | null, nextSlug: string) {\n if (previousSlug !== null) {\n // If the specific segment already has a slug but the slug is not `something`\n // This prevents collisions like:\n // pages/[post]/index.js\n // pages/[id]/index.js\n // Because currently multiple dynamic params on the same segment level are not supported\n if (previousSlug !== nextSlug) {\n // TODO: This error seems to be confusing for users, needs an error link, the description can be based on above comment.\n throw new Error(\n `You cannot use different slug names for the same dynamic path ('${previousSlug}' !== '${nextSlug}').`\n )\n }\n }\n\n slugNames.forEach((slug) => {\n if (slug === nextSlug) {\n throw new Error(\n `You cannot have the same slug name \"${nextSlug}\" repeat within a single dynamic path`\n )\n }\n\n if (slug.replace(/\\W/g, '') === nextSegment.replace(/\\W/g, '')) {\n throw new Error(\n `You cannot have the slug names \"${slug}\" and \"${nextSlug}\" differ only by non-word symbols within a single dynamic path`\n )\n }\n })\n\n slugNames.push(nextSlug)\n }\n\n if (isCatchAll) {\n if (isOptional) {\n if (this.restSlugName != null) {\n throw new Error(\n `You cannot use both an required and optional catch-all route at the same level (\"[...${this.restSlugName}]\" and \"${urlPaths[0]}\" ).`\n )\n }\n\n handleSlug(this.optionalRestSlugName, segmentName)\n // slugName is kept as it can only be one particular slugName\n this.optionalRestSlugName = segmentName\n // nextSegment is overwritten to [[...]] so that it can later be sorted specifically\n nextSegment = '[[...]]'\n } else {\n if (this.optionalRestSlugName != null) {\n throw new Error(\n `You cannot use both an optional and required catch-all route at the same level (\"[[...${this.optionalRestSlugName}]]\" and \"${urlPaths[0]}\").`\n )\n }\n\n handleSlug(this.restSlugName, segmentName)\n // slugName is kept as it can only be one particular slugName\n this.restSlugName = segmentName\n // nextSegment is overwritten to [...] so that it can later be sorted specifically\n nextSegment = '[...]'\n }\n } else {\n if (isOptional) {\n throw new Error(\n `Optional route parameters are not yet supported (\"${urlPaths[0]}\").`\n )\n }\n handleSlug(this.slugName, segmentName)\n // slugName is kept as it can only be one particular slugName\n this.slugName = segmentName\n // nextSegment is overwritten to [] so that it can later be sorted specifically\n nextSegment = '[]'\n }\n }\n\n // If this UrlNode doesn't have the nextSegment yet we create a new child UrlNode\n if (!this.children.has(nextSegment)) {\n this.children.set(nextSegment, new UrlNode())\n }\n\n this.children\n .get(nextSegment)!\n ._insert(urlPaths.slice(1), slugNames, isCatchAll)\n }\n}\n\n/**\n * @deprecated Use `sortSortableRoutes` or `sortPages` instead.\n */\nexport function getSortedRoutes(\n normalizedPages: ReadonlyArray<string>\n): string[] {\n // First the UrlNode is created, and every UrlNode can have only 1 dynamic segment\n // Eg you can't have pages/[post]/abc.js and pages/[hello]/something-else.js\n // Only 1 dynamic segment per nesting level\n\n // So in the case that is test/integration/dynamic-routing it'll be this:\n // pages/[post]/comments.js\n // pages/blog/[post]/comment/[id].js\n // Both are fine because `pages/[post]` and `pages/blog` are on the same level\n // So in this case `UrlNode` created here has `this.slugName === 'post'`\n // And since your PR passed through `slugName` as an array basically it'd including it in too many possibilities\n // Instead what has to be passed through is the upwards path's dynamic names\n const root = new UrlNode()\n\n // Here the `root` gets injected multiple paths, and insert will break them up into sublevels\n normalizedPages.forEach((pagePath) => root.insert(pagePath))\n // Smoosh will then sort those sublevels up to the point where you get the correct route definition priority\n return root.smoosh()\n}\n\n/**\n * @deprecated Use `sortSortableRouteObjects` or `sortPageObjects` instead.\n */\nexport function getSortedRouteObjects<T>(\n objects: T[],\n getter: (obj: T) => string\n): T[] {\n // We're assuming here that all the pathnames are unique, that way we can\n // sort the list and use the index as the key.\n const indexes: Record<string, number> = {}\n const pathnames: string[] = []\n for (let i = 0; i < objects.length; i++) {\n const pathname = getter(objects[i])\n indexes[pathname] = i\n pathnames[i] = pathname\n }\n\n // Sort the pathnames.\n const sorted = getSortedRoutes(pathnames)\n\n // Map the sorted pathnames back to the original objects using the new sorted\n // index.\n return sorted.map((pathname) => objects[indexes[pathname]])\n}\n","/**\n * For a given page path, this function ensures that there is a leading slash.\n * If there is not a leading slash, one is added, otherwise it is noop.\n */\nexport function ensureLeadingSlash(path: string) {\n return path.startsWith('/') ? path : `/${path}`\n}\n","import type { FlightRouterState, Segment } from './app-router-types'\n\nexport function getSegmentValue(segment: Segment) {\n return Array.isArray(segment) ? segment[1] : segment\n}\n\nexport function isGroupSegment(segment: string) {\n // Use array[0] for performant purpose\n return segment[0] === '(' && segment.endsWith(')')\n}\n\nexport function isParallelRouteSegment(segment: string) {\n return segment.startsWith('@') && segment !== '@children'\n}\n\nexport function addSearchParamsIfPageSegment(\n segment: Segment,\n searchParams: Record<string, string | string[] | undefined>\n) {\n const isPageSegment = segment.includes(PAGE_SEGMENT_KEY)\n\n if (isPageSegment) {\n const stringifiedQuery = JSON.stringify(searchParams)\n return stringifiedQuery !== '{}'\n ? PAGE_SEGMENT_KEY + '?' + stringifiedQuery\n : PAGE_SEGMENT_KEY\n }\n\n return segment\n}\n\nexport function computeSelectedLayoutSegment(\n segments: string[] | null,\n parallelRouteKey: string\n): string | null {\n if (!segments || segments.length === 0) {\n return null\n }\n\n // For 'children', use first segment; for other parallel routes, use last segment\n const rawSegment =\n parallelRouteKey === 'children'\n ? segments[0]\n : segments[segments.length - 1]\n\n // If the default slot is showing, return null since it's not technically \"selected\" (it's a fallback)\n // Returning an internal value like `__DEFAULT__` would be confusing\n return rawSegment === DEFAULT_SEGMENT_KEY ? null : rawSegment\n}\n\n/** Get the canonical parameters from the current level to the leaf node. */\nexport function getSelectedLayoutSegmentPath(\n tree: FlightRouterState,\n parallelRouteKey: string,\n first = true,\n segmentPath: string[] = []\n): string[] {\n let node: FlightRouterState\n if (first) {\n // Use the provided parallel route key on the first parallel route\n node = tree[1][parallelRouteKey]\n } else {\n // After first parallel route prefer children, if there's no children pick the first parallel route.\n const parallelRoutes = tree[1]\n node = parallelRoutes.children ?? Object.values(parallelRoutes)[0]\n }\n\n if (!node) return segmentPath\n const segment = node[0]\n\n let segmentValue = getSegmentValue(segment)\n\n if (!segmentValue || segmentValue.startsWith(PAGE_SEGMENT_KEY)) {\n return segmentPath\n }\n\n segmentPath.push(segmentValue)\n\n return getSelectedLayoutSegmentPath(\n node,\n parallelRouteKey,\n false,\n segmentPath\n )\n}\n\nexport const PAGE_SEGMENT_KEY = '__PAGE__'\nexport const DEFAULT_SEGMENT_KEY = '__DEFAULT__'\nexport const NOT_FOUND_SEGMENT_KEY = '/_not-found'\n","import { ensureLeadingSlash } from '../../page-path/ensure-leading-slash'\nimport { isGroupSegment } from '../../segment'\n\n/**\n * Normalizes an app route so it represents the actual request path. Essentially\n * performing the following transformations:\n *\n * - `/(dashboard)/user/[id]/page` to `/user/[id]`\n * - `/(dashboard)/account/page` to `/account`\n * - `/user/[id]/page` to `/user/[id]`\n * - `/account/page` to `/account`\n * - `/page` to `/`\n * - `/(dashboard)/user/[id]/route` to `/user/[id]`\n * - `/(dashboard)/account/route` to `/account`\n * - `/user/[id]/route` to `/user/[id]`\n * - `/account/route` to `/account`\n * - `/route` to `/`\n * - `/` to `/`\n *\n * @param route the app route to normalize\n * @returns the normalized pathname\n */\nexport function normalizeAppPath(route: string) {\n return ensureLeadingSlash(\n route.split('/').reduce((pathname, segment, index, segments) => {\n // Empty segments are ignored.\n if (!segment) {\n return pathname\n }\n\n // Groups are ignored.\n if (isGroupSegment(segment)) {\n return pathname\n }\n\n // Parallel segments are ignored.\n if (segment[0] === '@') {\n return pathname\n }\n\n // The last segment (if it's a leaf) should be ignored.\n if (\n (segment === 'page' || segment === 'route') &&\n index === segments.length - 1\n ) {\n return pathname\n }\n\n return `${pathname}/${segment}`\n }, '')\n )\n}\n\n/**\n * Strips the `.rsc` extension if it's in the pathname.\n * Since this function is used on full urls it checks `?` for searchParams handling.\n */\nexport function normalizeRscURL(url: string) {\n return url.replace(\n /\\.rsc($|\\?)/,\n // $1 ensures `?` is preserved\n '$1'\n )\n}\n","import { normalizeAppPath } from './app-paths'\n\n// order matters here, the first match will be used\nexport const INTERCEPTION_ROUTE_MARKERS = [\n '(..)(..)',\n '(.)',\n '(..)',\n '(...)',\n] as const\n\nexport type InterceptionMarker = (typeof INTERCEPTION_ROUTE_MARKERS)[number]\n\nexport function isInterceptionRouteAppPath(path: string): boolean {\n // TODO-APP: add more serious validation\n return (\n path\n .split('/')\n .find((segment) =>\n INTERCEPTION_ROUTE_MARKERS.find((m) => segment.startsWith(m))\n ) !== undefined\n )\n}\n\ntype InterceptionRouteInformation = {\n /**\n * The intercepting route. This is the route that is being intercepted or the\n * route that the user was coming from. This is matched by the Next-Url\n * header.\n */\n interceptingRoute: string\n\n /**\n * The intercepted route. This is the route that is being intercepted or the\n * route that the user is going to. This is matched by the request pathname.\n */\n interceptedRoute: string\n}\n\nexport function extractInterceptionRouteInformation(\n path: string\n): InterceptionRouteInformation {\n let interceptingRoute: string | undefined\n let marker: (typeof INTERCEPTION_ROUTE_MARKERS)[number] | undefined\n let interceptedRoute: string | undefined\n\n for (const segment of path.split('/')) {\n marker = INTERCEPTION_ROUTE_MARKERS.find((m) => segment.startsWith(m))\n if (marker) {\n ;[interceptingRoute, interceptedRoute] = path.split(marker, 2)\n break\n }\n }\n\n if (!interceptingRoute || !marker || !interceptedRoute) {\n throw new Error(\n `Invalid interception route: ${path}. Must be in the format /<intercepting route>/(..|...|..)(..)/<intercepted route>`\n )\n }\n\n interceptingRoute = normalizeAppPath(interceptingRoute) // normalize the path, e.g. /(blog)/feed -> /feed\n\n switch (marker) {\n case '(.)':\n // (.) indicates that we should match with sibling routes, so we just need to append the intercepted route to the intercepting route\n if (interceptingRoute === '/') {\n interceptedRoute = `/${interceptedRoute}`\n } else {\n interceptedRoute = interceptingRoute + '/' + interceptedRoute\n }\n break\n case '(..)':\n // (..) indicates that we should match at one level up, so we need to remove the last segment of the intercepting route\n if (interceptingRoute === '/') {\n throw new Error(\n `Invalid interception route: ${path}. Cannot use (..) marker at the root level, use (.) instead.`\n )\n }\n interceptedRoute = interceptingRoute\n .split('/')\n .slice(0, -1)\n .concat(interceptedRoute)\n .join('/')\n break\n case '(...)':\n // (...) will match the route segment in the root directory, so we need to use the root directory to prepend the intercepted route\n interceptedRoute = '/' + interceptedRoute\n break\n case '(..)(..)':\n // (..)(..) indicates that we should match at two levels up, so we need to remove the last two segments of the intercepting route\n\n const splitInterceptingRoute = interceptingRoute.split('/')\n if (splitInterceptingRoute.length <= 2) {\n throw new Error(\n `Invalid interception route: ${path}. Cannot use (..)(..) marker at the root level or one level up.`\n )\n }\n\n interceptedRoute = splitInterceptingRoute\n .slice(0, -2)\n .concat(interceptedRoute)\n .join('/')\n break\n default:\n throw new Error('Invariant: unexpected marker')\n }\n\n return { interceptingRoute, interceptedRoute }\n}\n","import {\n extractInterceptionRouteInformation,\n isInterceptionRouteAppPath,\n} from './interception-routes'\n\n// Identify /.*[param].*/ in route string\nconst TEST_ROUTE = /\\/[^/]*\\[[^/]+\\][^/]*(?=\\/|$)/\n\n// Identify /[param]/ in route string\nconst TEST_STRICT_ROUTE = /\\/\\[[^/]+\\](?=\\/|$)/\n\n/**\n * Check if a route is dynamic.\n *\n * @param route - The route to check.\n * @param strict - Whether to use strict mode which prohibits segments with prefixes/suffixes (default: true).\n * @returns Whether the route is dynamic.\n */\nexport function isDynamicRoute(route: string, strict: boolean = true): boolean {\n if (isInterceptionRouteAppPath(route)) {\n route = extractInterceptionRouteInformation(route).interceptedRoute\n }\n\n if (strict) {\n return TEST_STRICT_ROUTE.test(route)\n }\n\n return TEST_ROUTE.test(route)\n}\n","export { getSortedRoutes, getSortedRouteObjects } from './sorted-routes'\nexport { isDynamicRoute } from './is-dynamic'\n","import {\n abortAndThrowOnSynchronousRequestDataAccess,\n postponeWithTracking,\n} from '../../app-render/dynamic-rendering'\nimport { isDynamicRoute } from '../../../shared/lib/router/utils'\nimport {\n NEXT_CACHE_IMPLICIT_TAG_ID,\n NEXT_CACHE_SOFT_TAG_MAX_LENGTH,\n} from '../../../lib/constants'\nimport { workAsyncStorage } from '../../app-render/work-async-storage.external'\nimport { workUnitAsyncStorage } from '../../app-render/work-unit-async-storage.external'\nimport { DynamicServerError } from '../../../client/components/hooks-server-context'\nimport { InvariantError } from '../../../shared/lib/invariant-error'\nimport {\n ActionDidRevalidateDynamicOnly,\n ActionDidRevalidateStaticAndDynamic as ActionDidRevalidate,\n} from '../../../shared/lib/action-revalidation-kind'\n\ntype CacheLifeConfig = {\n expire?: number\n}\n\n/**\n * This function allows you to purge [cached data](https://nextjs.org/docs/app/building-your-application/caching) on-demand for a specific cache tag.\n *\n * Read more: [Next.js Docs: `revalidateTag`](https://nextjs.org/docs/app/api-reference/functions/revalidateTag)\n */\nexport function revalidateTag(tag: string, profile: string | CacheLifeConfig) {\n if (!profile) {\n console.warn(\n '\"revalidateTag\" without the second argument is now deprecated, add second argument of \"max\" or use \"updateTag\". See more info here: https://nextjs.org/docs/messages/revalidate-tag-single-arg'\n )\n }\n return revalidate([tag], `revalidateTag ${tag}`, profile)\n}\n\n/**\n * This function allows you to update [cached data](https://nextjs.org/docs/app/building-your-application/caching) on-demand for a specific cache tag.\n * This can only be called from within a Server Action to enable read-your-own-writes semantics.\n *\n * Read more: [Next.js Docs: `updateTag`](https://nextjs.org/docs/app/api-reference/functions/updateTag)\n */\nexport function updateTag(tag: string) {\n const workStore = workAsyncStorage.getStore()\n\n // TODO: change this after investigating why phase: 'action' is\n // set for route handlers\n if (!workStore || workStore.page.endsWith('/route')) {\n throw new Error(\n 'updateTag can only be called from within a Server Action. ' +\n 'To invalidate cache tags in Route Handlers or other contexts, use revalidateTag instead. ' +\n 'See more info here: https://nextjs.org/docs/app/api-reference/functions/updateTag'\n )\n }\n // updateTag uses immediate expiration (no profile) without deprecation warning\n return revalidate([tag], `updateTag ${tag}`, undefined)\n}\n\n/**\n * This function allows you to refresh client cache from server actions.\n * It's useful as dynamic data can be cached on the client which won't\n * be refreshed by updateTag\n */\nexport function refresh() {\n const workStore = workAsyncStorage.getStore()\n const workUnitStore = workUnitAsyncStorage.getStore()\n\n if (\n !workStore ||\n workStore.page.endsWith('/route') ||\n workUnitStore?.phase !== 'action'\n ) {\n throw new Error(\n 'refresh can only be called from within a Server Action. ' +\n 'See more info here: https://nextjs.org/docs/app/api-reference/functions/refresh'\n )\n }\n\n if (workStore) {\n // The Server Action version of refresh() only revalidates the dynamic data\n // on the client. It doesn't affect cached data.\n workStore.pathWasRevalidated = ActionDidRevalidateDynamicOnly\n }\n}\n\n/**\n * This function allows you to purge [cached data](https://nextjs.org/docs/app/building-your-application/caching) on-demand for a specific path.\n *\n * Read more: [Next.js Docs: `revalidatePath`](https://nextjs.org/docs/app/api-reference/functions/revalidatePath)\n */\nexport function revalidatePath(originalPath: string, type?: 'layout' | 'page') {\n if (originalPath.length > NEXT_CACHE_SOFT_TAG_MAX_LENGTH) {\n console.warn(\n `Warning: revalidatePath received \"${originalPath}\" which exceeded max length of ${NEXT_CACHE_SOFT_TAG_MAX_LENGTH}. See more info here https://nextjs.org/docs/app/api-reference/functions/revalidatePath`\n )\n return\n }\n\n let normalizedPath = `${NEXT_CACHE_IMPLICIT_TAG_ID}${originalPath || '/'}`\n\n if (type) {\n normalizedPath += `${normalizedPath.endsWith('/') ? '' : '/'}${type}`\n } else if (isDynamicRoute(originalPath)) {\n console.warn(\n `Warning: a dynamic page path \"${originalPath}\" was passed to \"revalidatePath\", but the \"type\" parameter is missing. This has no effect by default, see more info here https://nextjs.org/docs/app/api-reference/functions/revalidatePath`\n )\n }\n\n const tags = [normalizedPath]\n if (normalizedPath === `${NEXT_CACHE_IMPLICIT_TAG_ID}/`) {\n tags.push(`${NEXT_CACHE_IMPLICIT_TAG_ID}/index`)\n } else if (normalizedPath === `${NEXT_CACHE_IMPLICIT_TAG_ID}/index`) {\n tags.push(`${NEXT_CACHE_IMPLICIT_TAG_ID}/`)\n }\n\n return revalidate(tags, `revalidatePath ${originalPath}`)\n}\n\nfunction revalidate(\n tags: string[],\n expression: string,\n profile?: string | CacheLifeConfig\n) {\n const store = workAsyncStorage.getStore()\n if (!store || !store.incrementalCache) {\n throw new Error(\n `Invariant: static generation store missing in ${expression}`\n )\n }\n\n const workUnitStore = workUnitAsyncStorage.getStore()\n if (workUnitStore) {\n if (workUnitStore.phase === 'render') {\n throw new Error(\n `Route ${store.route} used \"${expression}\" during render which is unsupported. To ensure revalidation is performed consistently it must always happen outside of renders and cached functions. See more info here: https://nextjs.org/docs/app/building-your-application/rendering/static-and-dynamic#dynamic-rendering`\n )\n }\n\n switch (workUnitStore.type) {\n case 'cache':\n case 'private-cache':\n throw new Error(\n `Route ${store.route} used \"${expression}\" inside a \"use cache\" which is unsupported. To ensure revalidation is performed consistently it must always happen outside of renders and cached functions. See more info here: https://nextjs.org/docs/app/building-your-application/rendering/static-and-dynamic#dynamic-rendering`\n )\n case 'unstable-cache':\n throw new Error(\n `Route ${store.route} used \"${expression}\" inside a function cached with \"unstable_cache(...)\" which is unsupported. To ensure revalidation is performed consistently it must always happen outside of renders and cached functions. See more info here: https://nextjs.org/docs/app/building-your-application/rendering/static-and-dynamic#dynamic-rendering`\n )\n case 'prerender':\n case 'prerender-runtime':\n // cacheComponents Prerender\n const error = new Error(\n `Route ${store.route} used ${expression} without first calling \\`await connection()\\`.`\n )\n return abortAndThrowOnSynchronousRequestDataAccess(\n store.route,\n expression,\n error,\n workUnitStore\n )\n case 'prerender-client':\n throw new InvariantError(\n `${expression} must not be used within a client component. Next.js should be preventing ${expression} from being included in client components statically, but did not in this case.`\n )\n case 'prerender-ppr':\n return postponeWithTracking(\n store.route,\n expression,\n workUnitStore.dynamicTracking\n )\n case 'prerender-legacy':\n workUnitStore.revalidate = 0\n\n const err = new DynamicServerError(\n `Route ${store.route} couldn't be rendered statically because it used \\`${expression}\\`. See more info here: https://nextjs.org/docs/messages/dynamic-server-error`\n )\n store.dynamicUsageDescription = expression\n store.dynamicUsageStack = err.stack\n\n throw err\n case 'request':\n if (process.env.NODE_ENV !== 'production') {\n // TODO: This is most likely incorrect. It would lead to the ISR\n // status being flipped when revalidating a static page with a server\n // action.\n workUnitStore.usedDynamic = true\n // TODO(restart-on-cache-miss): we should do a sync IO error here in dev\n // to match prerender behavior\n }\n break\n default:\n workUnitStore satisfies never\n }\n }\n\n if (!store.pendingRevalidatedTags) {\n store.pendingRevalidatedTags = []\n }\n\n for (const tag of tags) {\n const existingIndex = store.pendingRevalidatedTags.findIndex((item) => {\n if (item.tag !== tag) return false\n // Compare profiles: both strings, both objects, or both undefined\n if (typeof item.profile === 'string' && typeof profile === 'string') {\n return item.profile === profile\n }\n if (typeof item.profile === 'object' && typeof profile === 'object') {\n return JSON.stringify(item.profile) === JSON.stringify(profile)\n }\n return item.profile === profile\n })\n if (existingIndex === -1) {\n store.pendingRevalidatedTags.push({\n tag,\n profile,\n })\n }\n }\n\n // if profile is provided and this is a stale-while-revalidate\n // update we do not mark the path as revalidated so that server\n // actions don't pull their own writes\n const cacheLife =\n profile && typeof profile === 'object'\n ? profile\n : profile &&\n typeof profile === 'string' &&\n store?.cacheLifeProfiles?.[profile]\n ? store.cacheLifeProfiles[profile]\n : undefined\n\n if (!profile || cacheLife?.expire === 0) {\n // TODO: only revalidate if the path matches\n store.pathWasRevalidated = ActionDidRevalidate\n }\n}\n","import { workAsyncStorage } from '../../app-render/work-async-storage.external'\nimport { workUnitAsyncStorage } from '../../app-render/work-unit-async-storage.external'\nimport { markCurrentScopeAsDynamic } from '../../app-render/dynamic-rendering'\n\n/**\n * This function can be used to declaratively opt out of static rendering and indicate a particular component should not be cached.\n *\n * It marks the current scope as dynamic.\n *\n * - In [non-PPR](https://nextjs.org/docs/app/api-reference/next-config-js/partial-prerendering) cases this will make a static render\n * halt and mark the page as dynamic.\n * - In PPR cases this will postpone the render at this location.\n *\n * If we are inside a cache scope then this function does nothing.\n *\n * @note It expects to be called within App Router and will error otherwise.\n *\n * Read more: [Next.js Docs: `unstable_noStore`](https://nextjs.org/docs/app/api-reference/functions/unstable_noStore)\n */\nexport function unstable_noStore() {\n const callingExpression = 'unstable_noStore()'\n const store = workAsyncStorage.getStore()\n const workUnitStore = workUnitAsyncStorage.getStore()\n if (!store) {\n // This generally implies we are being called in Pages router. We should probably not support\n // unstable_noStore in contexts outside of `react-server` condition but since we historically\n // have not errored here previously, we maintain that behavior for now.\n return\n } else if (store.forceStatic) {\n return\n } else {\n store.isUnstableNoStore = true\n if (workUnitStore) {\n switch (workUnitStore.type) {\n case 'prerender':\n case 'prerender-client':\n case 'prerender-runtime':\n // unstable_noStore() is a noop in Dynamic I/O.\n return\n case 'prerender-ppr':\n case 'prerender-legacy':\n case 'request':\n case 'cache':\n case 'private-cache':\n case 'unstable-cache':\n break\n default:\n workUnitStore satisfies never\n }\n }\n markCurrentScopeAsDynamic(store, workUnitStore, callingExpression)\n }\n}\n","import { InvariantError } from '../../shared/lib/invariant-error'\nimport { workAsyncStorage } from '../app-render/work-async-storage.external'\nimport { workUnitAsyncStorage } from '../app-render/work-unit-async-storage.external'\n\nexport type CacheLife = {\n // How long the client can cache a value without checking with the server.\n stale?: number\n // How frequently you want the cache to refresh on the server.\n // Stale values may be served while revalidating.\n revalidate?: number\n // In the worst case scenario, where you haven't had traffic in a while,\n // how stale can a value be until you prefer deopting to dynamic.\n // Must be longer than revalidate.\n expire?: number\n}\n// The equivalent header is kind of like:\n// Cache-Control: max-age=[stale],s-max-age=[revalidate],stale-while-revalidate=[expire-revalidate],stale-if-error=[expire-revalidate]\n// Except that stale-while-revalidate/stale-if-error only applies to shared caches - not private caches.\n\n// The default revalidates relatively frequently but doesn't expire to ensure it's always\n// able to serve fast results but by default doesn't hang.\n\n// This gets overridden by the next-types-plugin\ntype CacheLifeProfiles =\n | 'default'\n | 'seconds'\n | 'minutes'\n | 'hours'\n | 'days'\n | 'weeks'\n | 'max'\n | (string & {})\n\nfunction validateCacheLife(profile: CacheLife) {\n if (profile.stale !== undefined) {\n if ((profile.stale as any) === false) {\n throw new Error(\n 'Pass `Infinity` instead of `false` if you want to cache on the client forever ' +\n 'without checking with the server.'\n )\n } else if (typeof profile.stale !== 'number') {\n throw new Error('The stale option must be a number of seconds.')\n }\n }\n if (profile.revalidate !== undefined) {\n if ((profile.revalidate as any) === false) {\n throw new Error(\n 'Pass `Infinity` instead of `false` if you do not want to revalidate by time.'\n )\n } else if (typeof profile.revalidate !== 'number') {\n throw new Error('The revalidate option must be a number of seconds.')\n }\n }\n if (profile.expire !== undefined) {\n if ((profile.expire as any) === false) {\n throw new Error(\n 'Pass `Infinity` instead of `false` if you want to cache on the server forever ' +\n 'without checking with the origin.'\n )\n } else if (typeof profile.expire !== 'number') {\n throw new Error('The expire option must be a number of seconds.')\n }\n }\n\n if (profile.revalidate !== undefined && profile.expire !== undefined) {\n if (profile.revalidate > profile.expire) {\n throw new Error(\n 'If providing both the revalidate and expire options, ' +\n 'the expire option must be greater than the revalidate option. ' +\n 'The expire option indicates how many seconds from the start ' +\n 'until it can no longer be used.'\n )\n }\n }\n}\n\nexport function cacheLife(profile: CacheLifeProfiles | CacheLife): void {\n if (!process.env.__NEXT_USE_CACHE) {\n throw new Error(\n '`cacheLife()` is only available with the `cacheComponents` config.'\n )\n }\n\n const workUnitStore = workUnitAsyncStorage.getStore()\n\n switch (workUnitStore?.type) {\n case 'prerender':\n case 'prerender-client':\n case 'prerender-runtime':\n case 'prerender-ppr':\n case 'prerender-legacy':\n case 'request':\n case 'unstable-cache':\n case undefined:\n throw new Error(\n '`cacheLife()` can only be called inside a \"use cache\" function.'\n )\n case 'cache':\n case 'private-cache':\n break\n default:\n workUnitStore satisfies never\n }\n\n if (typeof profile === 'string') {\n const workStore = workAsyncStorage.getStore()\n if (!workStore) {\n throw new Error(\n '`cacheLife()` can only be called during App Router rendering at the moment.'\n )\n }\n if (!workStore.cacheLifeProfiles) {\n throw new InvariantError('`cacheLifeProfiles` should always be provided.')\n }\n\n // TODO: This should be globally available and not require an AsyncLocalStorage.\n const configuredProfile = workStore.cacheLifeProfiles[profile]\n if (configuredProfile === undefined) {\n if (workStore.cacheLifeProfiles[profile.trim()]) {\n throw new Error(\n `Unknown \\`cacheLife()\\` profile \"${profile}\" is not configured in next.config.js\\n` +\n `Did you mean \"${profile.trim()}\" without the spaces?`\n )\n }\n throw new Error(\n `Unknown \\`cacheLife()\\` profile \"${profile}\" is not configured in next.config.js\\n` +\n 'module.exports = {\\n' +\n ' cacheLife: {\\n' +\n ` \"${profile}\": ...\\n` +\n ' }\\n' +\n '}'\n )\n }\n profile = configuredProfile\n } else if (\n typeof profile !== 'object' ||\n profile === null ||\n Array.isArray(profile)\n ) {\n throw new Error(\n 'Invalid `cacheLife()` option. Either pass a profile name or object.'\n )\n } else {\n validateCacheLife(profile)\n }\n\n if (profile.revalidate !== undefined) {\n // Track the explicit revalidate time.\n if (\n workUnitStore.explicitRevalidate === undefined ||\n workUnitStore.explicitRevalidate > profile.revalidate\n ) {\n workUnitStore.explicitRevalidate = profile.revalidate\n }\n }\n if (profile.expire !== undefined) {\n // Track the explicit expire time.\n if (\n workUnitStore.explicitExpire === undefined ||\n workUnitStore.explicitExpire > profile.expire\n ) {\n workUnitStore.explicitExpire = profile.expire\n }\n }\n if (profile.stale !== undefined) {\n // Track the explicit stale time.\n if (\n workUnitStore.explicitStale === undefined ||\n workUnitStore.explicitStale > profile.stale\n ) {\n workUnitStore.explicitStale = profile.stale\n }\n }\n}\n","import { workUnitAsyncStorage } from '../app-render/work-unit-async-storage.external'\nimport { validateTags } from '../lib/patch-fetch'\n\nexport function cacheTag(...tags: string[]): void {\n if (!process.env.__NEXT_USE_CACHE) {\n throw new Error(\n '`cacheTag()` is only available with the `cacheComponents` config.'\n )\n }\n\n const workUnitStore = workUnitAsyncStorage.getStore()\n\n switch (workUnitStore?.type) {\n case 'prerender':\n case 'prerender-client':\n case 'prerender-runtime':\n case 'prerender-ppr':\n case 'prerender-legacy':\n case 'request':\n case 'unstable-cache':\n case undefined:\n throw new Error(\n '`cacheTag()` can only be called inside a \"use cache\" function.'\n )\n case 'cache':\n case 'private-cache':\n break\n default:\n workUnitStore satisfies never\n }\n\n const validTags = validateTags(tags, '`cacheTag()`')\n\n if (!workUnitStore.tags) {\n workUnitStore.tags = validTags\n } else {\n workUnitStore.tags.push(...validTags)\n }\n}\n","const cacheExports = {\n unstable_cache: require('next/dist/server/web/spec-extension/unstable-cache')\n .unstable_cache,\n\n updateTag: require('next/dist/server/web/spec-extension/revalidate')\n .updateTag,\n\n revalidateTag: require('next/dist/server/web/spec-extension/revalidate')\n .revalidateTag,\n revalidatePath: require('next/dist/server/web/spec-extension/revalidate')\n .revalidatePath,\n\n refresh: require('next/dist/server/web/spec-extension/revalidate').refresh,\n\n unstable_noStore:\n require('next/dist/server/web/spec-extension/unstable-no-store')\n .unstable_noStore,\n cacheLife: require('next/dist/server/use-cache/cache-life').cacheLife,\n cacheTag: require('next/dist/server/use-cache/cache-tag').cacheTag,\n}\n\nlet didWarnCacheLife = false\nfunction unstable_cacheLife() {\n if (!didWarnCacheLife) {\n didWarnCacheLife = true\n const error = new Error(\n '`unstable_cacheLife` was recently stabilized and should be imported as `cacheLife`. The `unstable` prefixed form will be removed in a future version of Next.js.'\n )\n console.error(error)\n }\n return cacheExports.cacheLife.apply(this, arguments)\n}\n\nlet didWarnCacheTag = false\nfunction unstable_cacheTag() {\n if (!didWarnCacheTag) {\n didWarnCacheTag = true\n const error = new Error(\n '`unstable_cacheTag` was recently stabilized and should be imported as `cacheTag`. The `unstable` prefixed form will be removed in a future version of Next.js.'\n )\n console.error(error)\n }\n return cacheExports.cacheTag.apply(this, arguments)\n}\n\ncacheExports.unstable_cacheLife = unstable_cacheLife\ncacheExports.unstable_cacheTag = unstable_cacheTag\n\n// https://nodejs.org/api/esm.html#commonjs-namespaces\n// When importing CommonJS modules, the module.exports object is provided as the default export\nmodule.exports = cacheExports\n\n// make import { xxx } from 'next/cache' work\nexports.unstable_cache = cacheExports.unstable_cache\nexports.revalidatePath = cacheExports.revalidatePath\nexports.revalidateTag = cacheExports.revalidateTag\nexports.updateTag = cacheExports.updateTag\nexports.unstable_noStore = cacheExports.unstable_noStore\nexports.cacheLife = cacheExports.cacheLife\nexports.unstable_cacheLife = cacheExports.unstable_cacheLife\nexports.cacheTag = cacheExports.cacheTag\nexports.unstable_cacheTag = cacheExports.unstable_cacheTag\nexports.refresh = cacheExports.refresh\n","export {pickFolder as '002c259d14e5dea756d8cacc998905117d1891f7f6'} from 'ACTIONS_MODULE0'\nexport {listGitHubRepositories as '401aa9e5f410d3e8d0d271ba76b725f2f68c8b79ff'} from 'ACTIONS_MODULE1'\nexport {importGitHubRepository as '4073120aff0f37bc553f78030ce30a4a04f637c1de'} from 'ACTIONS_MODULE2'\nexport {loadSettings as '001eccde9e3fa7da29c0abd8eb5b4c2225b5199a69'} from 'ACTIONS_MODULE3'\nexport {getAvailableTerminals as '00326a6bfbbca378c4b56417c09621b0d2fa7ec8ea'} from 'ACTIONS_MODULE4'\nexport {updateSettingsAction as '4005786540384444b85a680f731e980f4d605482be'} from 'ACTIONS_MODULE5'\nexport {getAllAgentModels as '006923a42bfe826df919d060ebe6aa55f994d90d43'} from 'ACTIONS_MODULE6'\nexport {updateAgentAndModel as '60ca12662e17cb9dbe9532b3a93515d0da9391f55e'} from 'ACTIONS_MODULE7'\n","'use server';\n\nimport { revalidatePath } from 'next/cache';\nimport { resolve } from '@/lib/server-container';\nimport type { LoadSettingsUseCase } from '@shepai/core/application/use-cases/settings/load-settings.use-case';\nimport type { UpdateSettingsUseCase } from '@shepai/core/application/use-cases/settings/update-settings.use-case';\nimport { updateSettings as updateSettingsSingleton } from '@shepai/core/infrastructure/services/settings.service';\nimport type { Settings } from '@shepai/core/domain/generated/output';\n\ntype DeepPartial<T> = {\n [K in keyof T]?: T[K] extends object ? DeepPartial<T[K]> : T[K];\n};\n\nfunction deepMerge<T extends Record<string, unknown>>(target: T, source: DeepPartial<T>): T {\n const result = { ...target };\n for (const key of Object.keys(source) as (keyof T)[]) {\n const sourceVal = source[key];\n if (sourceVal === undefined) continue;\n\n const targetVal = target[key];\n if (\n targetVal !== null &&\n targetVal !== undefined &&\n typeof targetVal === 'object' &&\n !Array.isArray(targetVal) &&\n !(targetVal instanceof Date) &&\n sourceVal !== null &&\n typeof sourceVal === 'object' &&\n !Array.isArray(sourceVal) &&\n !(sourceVal instanceof Date)\n ) {\n result[key] = deepMerge(\n targetVal as Record<string, unknown>,\n sourceVal as DeepPartial<Record<string, unknown>>\n ) as T[keyof T];\n } else {\n result[key] = sourceVal as T[keyof T];\n }\n }\n return result;\n}\n\nexport interface UpdateSettingsResult {\n success: boolean;\n error?: string;\n}\n\nexport async function updateSettingsAction(\n partial: DeepPartial<Settings>\n): Promise<UpdateSettingsResult> {\n try {\n const loadUseCase = resolve<LoadSettingsUseCase>('LoadSettingsUseCase');\n const current = await loadUseCase.execute();\n\n const merged = deepMerge(\n current as unknown as Record<string, unknown>,\n partial as DeepPartial<Record<string, unknown>>\n ) as Settings;\n merged.updatedAt = new Date();\n\n const updateUseCase = resolve<UpdateSettingsUseCase>('UpdateSettingsUseCase');\n await updateUseCase.execute(merged);\n\n updateSettingsSingleton(merged);\n\n revalidatePath('/', 'layout');\n\n return { success: true };\n } catch (error: unknown) {\n const message = error instanceof Error ? error.message : 'Failed to update settings';\n return { success: false, error: message };\n }\n}\n"],"names":["ACTION_SUFFIX","APP_DIR_ALIAS","CACHE_ONE_YEAR","DOT_NEXT_ALIAS","ESLINT_DEFAULT_DIRS","GSP_NO_RETURNED_VALUE","GSSP_COMPONENT_MEMBER_ERROR","GSSP_NO_RETURNED_VALUE","HTML_CONTENT_TYPE_HEADER","INFINITE_CACHE","INSTRUMENTATION_HOOK_FILENAME","JSON_CONTENT_TYPE_HEADER","MATCHED_PATH_HEADER","MIDDLEWARE_FILENAME","MIDDLEWARE_LOCATION_REGEXP","NEXT_BODY_SUFFIX","NEXT_CACHE_IMPLICIT_TAG_ID","NEXT_CACHE_REVALIDATED_TAGS_HEADER","NEXT_CACHE_REVALIDATE_TAG_TOKEN_HEADER","NEXT_CACHE_SOFT_TAG_MAX_LENGTH","NEXT_CACHE_TAGS_HEADER","NEXT_CACHE_TAG_MAX_ITEMS","NEXT_CACHE_TAG_MAX_LENGTH","NEXT_DATA_SUFFIX","NEXT_INTERCEPTION_MARKER_PREFIX","NEXT_META_SUFFIX","NEXT_QUERY_PARAM_PREFIX","NEXT_RESUME_HEADER","NON_STANDARD_NODE_ENV","PAGES_DIR_ALIAS","PRERENDER_REVALIDATE_HEADER","PRERENDER_REVALIDATE_ONLY_GENERATED_HEADER","PROXY_FILENAME","PROXY_LOCATION_REGEXP","PUBLIC_DIR_MIDDLEWARE_CONFLICT","ROOT_DIR_ALIAS","RSC_ACTION_CLIENT_WRAPPER_ALIAS","RSC_ACTION_ENCRYPTION_ALIAS","RSC_ACTION_PROXY_ALIAS","RSC_ACTION_VALIDATE_ALIAS","RSC_CACHE_WRAPPER_ALIAS","RSC_DYNAMIC_IMPORT_WRAPPER_ALIAS","RSC_MOD_REF_PROXY_ALIAS","RSC_SEGMENTS_DIR_SUFFIX","RSC_SEGMENT_SUFFIX","RSC_SUFFIX","SERVER_PROPS_EXPORT_ERROR","SERVER_PROPS_GET_INIT_PROPS_CONFLICT","SERVER_PROPS_SSG_CONFLICT","SERVER_RUNTIME","SSG_FALLBACK_EXPORT_ERROR","SSG_GET_INITIAL_PROPS_CONFLICT","STATIC_STATUS_PAGE_GET_INITIAL_PROPS_ERROR","TEXT_PLAIN_CONTENT_TYPE_HEADER","UNSTABLE_REVALIDATE_RENAME_ERROR","WEBPACK_LAYERS","WEBPACK_RESOURCE_QUERIES","WEB_SOCKET_MAX_RECONNECTIONS","edge","experimentalEdge","nodejs","WEBPACK_LAYERS_NAMES","shared","reactServerComponents","serverSideRendering","actionBrowser","apiNode","apiEdge","middleware","instrument","edgeAsset","appPagesBrowser","pagesDirBrowser","pagesDirEdge","pagesDirNode","GROUP","builtinReact","serverOnly","neutralTarget","clientOnly","bundled","appPages","edgeSSREntry","metadata","metadataRoute","metadataImageMeta","AppRenderSpan","AppRouteRouteHandlersSpan","BaseServerSpan","LoadComponentsSpan","LogSpanAllowList","MiddlewareSpan","NextNodeServerSpan","NextServerSpan","NextVanillaSpanAllowlist","NodeSpan","RenderSpan","ResolveMetadataSpan","RouterSpan","StartServerSpan","Set","isThenable","promise","then","BubbledError","SpanKind","SpanStatusCode","getTracer","isBubbledError","NEXT_OTEL_PERFORMANCE_PREFIX","process","env","api","NEXT_RUNTIME","require","err","context","propagation","trace","ROOT_CONTEXT","Error","constructor","bubble","result","error","closeSpanWithError","span","setAttribute","recordException","name","setStatus","code","ERROR","message","end","rootSpanAttributesStore","Map","rootSpanIdKey","createContextKey","lastSpanId","getSpanId","clientTraceDataSetter","set","carrier","key","value","push","NextTracerImpl","getTracerInstance","getContext","getTracePropagationData","activeContext","active","entries","inject","getActiveScopeSpan","getSpan","withPropagatedContext","fn","getter","getSpanContext","remoteContext","extract","with","args","type","fnOrOptions","fnOrEmpty","options","spanName","has","NEXT_OTEL_VERBOSE","hideSpan","spanContext","parentSpan","existingRootSpanId","getValue","isRootSpan","spanId","attributes","setValue","startActiveSpan","startTime","globalThis","performance","now","undefined","cleanedUp","onCleanup","delete","measure","split","pop","replace","match","toLowerCase","start","Object","length","res","catch","finally","wrap","tracer","optionsObj","apply","arguments","lastArgId","cb","scopeBoundCb","bind","_span","done","startSpan","setSpan","getRootSpanAttributes","get","setRootSpanAttribute","withSpan","cloneResponse","noop","registry","FinalizationRegistry","weakRef","stream","deref","locked","cancel","original","body","body1","body2","tee","cloned1","Response","status","statusText","headers","defineProperty","url","configurable","enumerable","writable","register","WeakRef","cloned2","createDedupeFetch","simpleCacheKey","headersToExcludeInCacheKey","generateCacheKey","request","filteredHeaders","Array","from","filter","JSON","stringify","method","mode","redirect","credentials","referrer","referrerPolicy","integrity","originalFetch","getCacheEntries","React","cache","dedupeFetch","resource","signal","cacheKey","URL","Request","keepalive","cacheEntries","i","j","response","InvariantError","entry","CachedRouteKind","IncrementalCacheKind","DetachedPromise","resolve","reject","Promise","rej","Batcher","cacheKeyFn","schedulerFn","pending","create","batch","LRUCache","LRUNode","data","size","prev","next","SentinelNode","maxSize","calculateSize","onEvict","totalSize","head","tail","addToHead","node","removeNode","moveToHead","removeTail","lastNode","console","warn","existing","newNode","Symbol","iterator","current","remove","currentSize","bgBlack","bgBlue","bgCyan","bgGreen","bgMagenta","bgRed","bgWhite","bgYellow","black","blue","bold","cyan","dim","gray","green","hidden","inverse","italic","magenta","purple","red","reset","strikethrough","underline","white","yellow","stdout","enabled","NO_COLOR","FORCE_COLOR","isTTY","CI","TERM","replaceClose","str","close","index","substring","nextIndex","indexOf","formatter","open","String","input","string","s","bootstrap","errorOnce","event","info","prefixes","ready","wait","warnOnce","LOGGING_METHOD","log","prefixedLog","prefixType","shift","consoleMethod","prefix","warnOnceCache","join","errorOnceCache","ENCODED_TAGS","OPENING","HTML","Uint8Array","BODY","CLOSED","HEAD","BODY_AND_HTML","META","ICON_MARK","indexOfUint8Array","isEquivalentUint8Arrays","removeFromUint8Array","a","b","completeMatch","tagIndex","subarray","removed","slice","MISSING_ROOT_TAGS_ERROR","insertBuildIdComment","DOCTYPE_PREFIX","MAX_BUILD_ID_LENGTH","escapeBuildId","buildId","truncated","originalHtml","includes","startsWith","ACTION_HEADER","FLIGHT_HEADERS","NEXT_ACTION_NOT_FOUND_HEADER","NEXT_ACTION_REVALIDATED_HEADER","NEXT_DID_POSTPONE_HEADER","NEXT_HMR_REFRESH_HASH_COOKIE","NEXT_HMR_REFRESH_HEADER","NEXT_HTML_REQUEST_ID_HEADER","NEXT_IS_PRERENDER_HEADER","NEXT_REQUEST_ID_HEADER","NEXT_REWRITTEN_PATH_HEADER","NEXT_REWRITTEN_QUERY_HEADER","NEXT_ROUTER_PREFETCH_HEADER","NEXT_ROUTER_SEGMENT_PREFETCH_HEADER","NEXT_ROUTER_STALE_TIME_HEADER","NEXT_ROUTER_STATE_TREE_HEADER","NEXT_RSC_UNION_QUERY","NEXT_URL","RSC_CONTENT_TYPE_HEADER","RSC_HEADER","djb2Hash","hexHash","hash","char","charCodeAt","toString","computeCacheBustingSearchParam","prefetchHeader","segmentPrefetchHeader","stateTreeHeader","nextUrlHeader","chainStreams","continueDynamicHTMLResume","continueDynamicPrerender","continueFizzStream","continueStaticFallbackPrerender","continueStaticPrerender","createBufferedTransformStream","createDocumentClosingStream","createRootLayoutValidatorStream","renderToInitialFizzStream","streamFromBuffer","streamFromString","streamToBuffer","streamToString","streamToUint8Array","voidCatch","encoder","TextEncoder","streams","ReadableStream","controller","readable","TransformStream","pipeTo","preventClose","nextStream","lastStream","enqueue","encode","chunk","streamToChunks","reader","getReader","chunks","read","concatUint8Arrays","totalLength","reduce","sum","offset","Buffer","concat","decoder","TextDecoder","fatal","aborted","decode","maxBufferByteLength","Infinity","bufferedChunks","bufferByteLength","flush","copiedBytes","bufferedChunk","byteLength","scheduleFlush","detached","scheduleImmediate","transform","createPrefetchCommentStream","isBuildTimePrerendering","didTransformFirstChunk","chunkStr","updatedChunkStr","ReactDOMServer","element","streamOptions","renderToReadableStream","createMetadataTransformStream","insert","chunkIndex","isMarkRemoved","iconMarkIndex","closedHeadIndex","iconMarkLength","replaced","insertion","encodedInsertion","insertionLength","createHeadInsertionTransformStream","inserted","hasBytes","insertedHeadContent","createClientResumeScriptInsertionTransformStream","segmentPath","cacheBustingHeader","searchStr","NEXT_CLIENT_RESUME_SCRIPT","didAlreadyInsert","headClosingTagIndex","createDeferredSuffixStream","suffix","flushed","createFlightDataInjectionTransformStream","delayDataUntilFirstHtmlChunk","htmlStreamFinished","pull","donePulling","startOrContinuePulling","startPulling","atLeastOneTask","CLOSE_TAG","createMoveSuffixStream","foundSuffix","before","after","createStripDocumentClosingTagsTransform","foundHtml","foundBody","missingTags","map","c","chainTransformers","transformers","transformer","pipeThrough","renderStream","inlinedDataStream","isStaticGeneration","getServerInsertedHTML","getServerInsertedMetadata","validateRootLayout","suffixUnclosed","allReady","waitAtLeastOneReactRenderTask","prerenderStream","NEXT_REQUEST_META","addRequestMeta","getRequestMeta","removeRequestMeta","setRequestMeta","for","req","meta","fromNodeOutgoingHttpHeaders","normalizeNextQueryParam","splitCookiesString","toNodeOutgoingHttpHeaders","validateURL","nodeHeaders","Headers","values","isArray","v","append","cookiesString","cookiesStrings","pos","ch","lastComma","nextStart","cookiesSeparatorFound","skipWhitespace","test","charAt","notSpecialChar","cookies","cause","detectDomainLocale","domainItems","hostname","detectedLocale","item","domainHostname","domain","defaultLocale","locales","some","locale","removeTrailingSlash","route","parsePath","path","hashIndex","queryIndex","hasQuery","pathname","query","addPathPrefix","addPathSuffix","pathHasPrefix","addLocale","ignorePrefix","lower","formatNextPathnameInfo","trailingSlash","basePath","endsWith","getHostname","parsed","host","normalizeLocalePath","WeakMap","lowercasedLocales","segments","segment","removePathPrefix","withoutPrefix","getNextPathnameInfo","i18n","nextConfig","pathnameNoDataPrefix","paths","parseData","i18nProvider","analyze","NextURL","REGEX_LOCALHOST_HOSTNAME","parseURL","base","Internal","baseOrOpts","opts","__NEXT_NO_MIDDLEWARE_URL_NORMALIZE","domainLocale","domains","formatPathname","forceLocale","formatSearch","search","TypeError","searchParams","port","protocol","href","origin","password","username","toJSON","clone","PageSignatureError","RemovedPageError","RemovedUAError","page","INTERNALS","NextRequest","init","duplex","nextUrl","RequestCookies","bodyUsed","destination","fromEntries","ua","isNodeNextRequest","isNodeNextResponse","isWebNextRequest","isWebNextResponse","NextRequestAdapter","ResponseAborted","ResponseAbortedName","createAbortController","signalFromNodeResponse","AbortController","once","writableFinished","abort","errored","destroyed","AbortSignal","fromBaseNextRequest","fromWebNextRequest","fromNodeNextRequest","getClientComponentLoaderMetrics","wrapClientComponentLoader","clientComponentLoadStart","clientComponentLoadTimes","clientComponentLoadCount","ComponentMod","__next_app__","loadChunk","metrics","isAbortError","pipeToNodeResponse","e","createWriterFromResponse","waitUntilForEnd","started","drained","onDrain","on","off","finished","WritableStream","write","flushHeaders","startResponse","ok","destroy","writer","RenderResult","EMPTY","contentType","fromStatic","waitUntil","assignMetadata","assign","isNull","isDynamic","toUnchunkedString","isBuffer","coerce","unshift","RouteKind","fromResponseCacheEntry","routeKindToIncrementalCacheKind","toResponseCacheEntry","cacheEntry","kind","PAGES","html","pageData","APP_PAGE","postponed","rscData","segmentData","isMiss","isStale","cacheControl","routeKind","IMAGE","APP_ROUTE","PAGES_API","ResponseCache","parsePositiveInt","envValue","fallback","parseInt","Number","isFinite","DEFAULT_TTL_MS","NEXT_PRIVATE_RESPONSE_CACHE_TTL","DEFAULT_MAX_SIZE","NEXT_PRIVATE_RESPONSE_CACHE_MAX_SIZE","KEY_SEPARATOR","TTL_SENTINEL","createCacheKey","invocationID","extractInvocationID","compoundKey","separatorIndex","lastIndexOf","minimal_mode","ttl","getBatcher","isOnDemandRevalidate","scheduleOnNextTick","revalidateBatcher","evictedInvocationIDs","first","add","responseGenerator","hasResolved","previousCacheEntry","cachedItem","Date","expiresAt","incrementalCache","isFallback","isRoutePPREnabled","isPrefetch","handleGet","previousIncrementalCacheEntry","resolved","incrementalResponseCacheEntry","revalidate","handleRevalidate","responseCacheEntry","isRevalidating","Math","min","max","expire","NEXT_PATCH_SYMBOL","createPatchedFetcher","patchFetch","validateRevalidate","validateTags","isEdgeRuntime","isFetchPatched","revalidateVal","normalizedRevalidate","isNaN","tags","description","validTags","invalidTags","tag","reason","trackFetchMetric","workStore","ctx","shouldTrackFetchMetrics","fetchMetrics","timeOrigin","idx","nextFetchId","createCachedPrerenderResponse","incrementalCacheContext","handleUnlock","bodyBuffer","arrayBuffer","fetchedData","FETCH","createCachedDynamicResponse","serverComponentsHmrCache","cacheSetPromise","pendingRevalidateKey","pendingRevalidates","pendingRevalidatePromise","originFetch","workAsyncStorage","workUnitAsyncStorage","patched","fetch","fetchUrl","toUpperCase","isInternal","internal","NEXT_OTEL_FETCH_DISABLED","fetchStart","getStore","workUnitStore","cacheSignal","getCacheSignal","beginRead","internalFetch","CLIENT","Boolean","isDraftMode","isRequestInput","field","finalRevalidate","getNextField","originalFetchRevalidate","currentFetchRevalidate","revalidateStore","collectedTags","implicitTags","pageFetchCacheMode","fetchCache","isUsingNoStore","isUnstableNoStore","currentFetchCacheConfig","cacheReason","cacheWarning","isConflictingRevalidate","hasExplicitFetchCacheOptOut","noFetchConfigAndForceDynamic","forceDynamic","_headers","initHeaders","hasUnCacheableHeader","isUnCacheableMethod","hasNoExplicitCacheConfig","autoNoCache","isImplicitBuildTimeCache","endRead","makeHangingPromise","renderSignal","NODE_ENV","stagedRendering","waitForStage","RenderStage","Dynamic","forceStatic","markCurrentScopeAsDynamic","isCacheableRevalidate","isHmrRefresh","fetchIdx","doOriginalFetch","cacheReasonOverride","requestInputFields","reqInput","reqOptions","_ogBody","otherInput","clonedInit","fetchType","cacheStatus","incrementalCacheConfig","isForegroundRevalidate","isHmrRefreshCache","cachedFetchData","lock","softTags","getTimeoutBoundary","pendingRevalidate","__NEXT_CACHE_COMPONENTS","hasNextConfig","revalidatedResult","pendingResponse","responses","__nextPatched","__nextGetStaticStore","_nextOriginalFetch","currentTimeoutBoundary","r","setTimeout","unstable_cache","noStoreFetchIdx","cacheNewResult","keyParts","fixedKey","cachedCb","maybeIncrementalCache","__incrementalCache","fetchUrlPrefix","getFetchUrlPrefix","invocationKey","innerCacheStore","phase","draftMode","getDraftModeProviderForCacheScope","isNestedUnstableCache","cachedResponse","parse","revalidationPromise","run","URLSearchParams","sortedSearch","keys","sort","localeCompare","getSortedRouteObjects","getSortedRoutes","UrlNode","urlPath","_insert","smoosh","_smoosh","childrenPaths","children","slugName","splice","restSlugName","optionalRestSlugName","routes","curr","placeholder","urlPaths","slugNames","isCatchAll","nextSegment","segmentName","isOptional","handleSlug","previousSlug","nextSlug","forEach","slug","normalizedPages","root","pagePath","objects","indexes","pathnames","sorted","ensureLeadingSlash","DEFAULT_SEGMENT_KEY","NOT_FOUND_SEGMENT_KEY","PAGE_SEGMENT_KEY","addSearchParamsIfPageSegment","computeSelectedLayoutSegment","getSegmentValue","getSelectedLayoutSegmentPath","isGroupSegment","isParallelRouteSegment","isPageSegment","stringifiedQuery","parallelRouteKey","rawSegment","tree","parallelRoutes","segmentValue","normalizeAppPath","normalizeRscURL","INTERCEPTION_ROUTE_MARKERS","extractInterceptionRouteInformation","isInterceptionRouteAppPath","find","m","interceptingRoute","marker","interceptedRoute","splitInterceptingRoute","isDynamicRoute","TEST_ROUTE","TEST_STRICT_ROUTE","strict","refresh","revalidatePath","revalidateTag","updateTag","profile","pathWasRevalidated","ActionDidRevalidateDynamicOnly","originalPath","normalizedPath","expression","store","abortAndThrowOnSynchronousRequestDataAccess","postponeWithTracking","dynamicTracking","DynamicServerError","dynamicUsageDescription","dynamicUsageStack","stack","usedDynamic","pendingRevalidatedTags","existingIndex","findIndex","cacheLife","cacheLifeProfiles","ActionDidRevalidate","unstable_noStore","callingExpression","validateCacheLife","stale","__NEXT_USE_CACHE","configuredProfile","trim","explicitRevalidate","explicitExpire","explicitStale","cacheTag"],"mappings":"qGAgBaA,aAAa,CAAA,kBAAbA,GA2CAC,aAAa,CAAA,kBAAbA,GAvBAC,cAAc,CAAA,kBAAdA,GAqBAC,cAAc,CAAA,kBAAdA,GAwCAC,mBAAmB,CAAA,kBAAnBA,IAfAC,qBAAqB,CAAA,kBAArBA,GASAC,2BAA2B,CAAA,kBAA3BA,IAPAC,sBAAsB,CAAA,kBAAtBA,GAjFAC,wBAAwB,CAAA,kBAAxBA,GAsCAC,cAAc,CAAA,kBAAdA,GAWAC,6BAA6B,CAAA,kBAA7BA,GAhDAC,wBAAwB,CAAA,kBAAxBA,GAIAC,mBAAmB,CAAA,kBAAnBA,GAoCAC,mBAAmB,CAAA,kBAAnBA,GACAC,0BAA0B,CAAA,kBAA1BA,GA1BAC,gBAAgB,CAAA,kBAAhBA,GAcAC,0BAA0B,CAAA,kBAA1BA,GAXAC,kCAAkC,CAAA,kBAAlCA,GACAC,sCAAsC,CAAA,kBAAtCA,GASAC,8BAA8B,CAAA,kBAA9BA,GAXAC,sBAAsB,CAAA,kBAAtBA,GASAC,wBAAwB,CAAA,kBAAxBA,GACAC,yBAAyB,CAAA,kBAAzBA,GAdAC,gBAAgB,CAAA,kBA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K,CACzB,CAAE,MAAO,EAAgB,CAEvB,MAAO,CAAE,SAAS,EAAO,MADT,CACgB,YADC,MAAQ,EAAM,OAAO,CAAG,2BACjB,CAC1C,CACF,0CAzBsB,IAAA,CAAA,EAAA,EAAA,uBAAA,EAAA,EAAA,6CAAA,MDzCtB,IAAA,EAAA,EAAA,CAAA,CAAA,OACA,EAAA,EAAA,CAAA,CAAA","ignoreList":[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58]}
|
|
1
|
+
{"version":3,"sources":["../../../../../../../node_modules/.pnpm/next%4016.1.6_%40babel%2Bcore%407.29.0_%40playwright%2Btest%401.58.1_react-dom%4019.2.4_react%4019.2.4__react%4019.2.4/node_modules/next/src/lib/constants.ts","../../../../../../../node_modules/.pnpm/next%4016.1.6_%40babel%2Bcore%407.29.0_%40playwright%2Btest%401.58.1_react-dom%4019.2.4_react%4019.2.4__react%4019.2.4/node_modules/next/src/server/lib/trace/constants.ts","../../../../../../../node_modules/.pnpm/next%4016.1.6_%40babel%2Bcore%407.29.0_%40playwright%2Btest%401.58.1_react-dom%4019.2.4_react%4019.2.4__react%4019.2.4/node_modules/next/src/shared/lib/is-thenable.ts","../../../../../../../node_modules/.pnpm/next%4016.1.6_%40babel%2Bcore%407.29.0_%40playwright%2Btest%401.58.1_react-dom%4019.2.4_react%4019.2.4__react%4019.2.4/node_modules/next/src/server/lib/trace/tracer.ts","../../../../../../../node_modules/.pnpm/next%4016.1.6_%40babel%2Bcore%407.29.0_%40playwright%2Btest%401.58.1_react-dom%4019.2.4_react%4019.2.4__react%4019.2.4/node_modules/next/src/server/lib/clone-response.ts","../../../../../../../node_modules/.pnpm/next%4016.1.6_%40babel%2Bcore%407.29.0_%40playwright%2Btest%401.58.1_react-dom%4019.2.4_react%4019.2.4__react%4019.2.4/node_modules/next/src/server/lib/dedupe-fetch.ts","../../../../../../../node_modules/.pnpm/next%4016.1.6_%40babel%2Bcore%407.29.0_%40playwright%2Btest%401.58.1_react-dom%4019.2.4_react%4019.2.4__react%4019.2.4/node_modules/next/src/server/response-cache/types.ts","../../../../../../../node_modules/.pnpm/next%4016.1.6_%40babel%2Bcore%407.29.0_%40playwright%2Btest%401.58.1_react-dom%4019.2.4_react%4019.2.4__react%4019.2.4/node_modules/next/src/lib/detached-promise.ts","../../../../../../../node_modules/.pnpm/next%4016.1.6_%40babel%2Bcore%407.29.0_%40playwright%2Btest%401.58.1_react-dom%4019.2.4_react%4019.2.4__react%4019.2.4/node_modules/next/src/lib/batcher.ts","../../../../../../../node_modules/.pnpm/next%4016.1.6_%40babel%2Bcore%407.29.0_%40playwright%2Btest%401.58.1_react-dom%4019.2.4_react%4019.2.4__react%4019.2.4/node_modules/next/src/server/lib/lru-cache.ts","../../../../../../../node_modules/.pnpm/next%4016.1.6_%40babel%2Bcore%407.29.0_%40playwright%2Btest%401.58.1_react-dom%4019.2.4_react%4019.2.4__react%4019.2.4/node_modules/next/src/lib/picocolors.ts","../../../../../../../node_modules/.pnpm/next%4016.1.6_%40babel%2Bcore%407.29.0_%40playwright%2Btest%401.58.1_react-dom%4019.2.4_react%4019.2.4__react%4019.2.4/node_modules/next/src/build/output/log.ts","../../../../../../../node_modules/.pnpm/next%4016.1.6_%40babel%2Bcore%407.29.0_%40playwright%2Btest%401.58.1_react-dom%4019.2.4_react%4019.2.4__react%4019.2.4/node_modules/next/src/server/stream-utils/encoded-tags.ts","../../../../../../../node_modules/.pnpm/next%4016.1.6_%40babel%2Bcore%407.29.0_%40playwright%2Btest%401.58.1_react-dom%4019.2.4_react%4019.2.4__react%4019.2.4/node_modules/next/src/server/stream-utils/uint8array-helpers.ts","../../../../../../../node_modules/.pnpm/next%4016.1.6_%40babel%2Bcore%407.29.0_%40playwright%2Btest%401.58.1_react-dom%4019.2.4_react%4019.2.4__react%4019.2.4/node_modules/next/src/shared/lib/errors/constants.ts","../../../../../../../node_modules/.pnpm/next%4016.1.6_%40babel%2Bcore%407.29.0_%40playwright%2Btest%401.58.1_react-dom%4019.2.4_react%4019.2.4__react%4019.2.4/node_modules/next/src/shared/lib/segment-cache/output-export-prefetch-encoding.ts","../../../../../../../node_modules/.pnpm/next%4016.1.6_%40babel%2Bcore%407.29.0_%40playwright%2Btest%401.58.1_react-dom%4019.2.4_react%4019.2.4__react%4019.2.4/node_modules/next/src/client/components/app-router-headers.ts","../../../../../../../node_modules/.pnpm/next%4016.1.6_%40babel%2Bcore%407.29.0_%40playwright%2Btest%401.58.1_react-dom%4019.2.4_react%4019.2.4__react%4019.2.4/node_modules/next/src/shared/lib/hash.ts","../../../../../../../node_modules/.pnpm/next%4016.1.6_%40babel%2Bcore%407.29.0_%40playwright%2Btest%401.58.1_react-dom%4019.2.4_react%4019.2.4__react%4019.2.4/node_modules/next/src/shared/lib/router/utils/cache-busting-search-param.ts","../../../../../../../node_modules/.pnpm/next%4016.1.6_%40babel%2Bcore%407.29.0_%40playwright%2Btest%401.58.1_react-dom%4019.2.4_react%4019.2.4__react%4019.2.4/node_modules/next/src/server/stream-utils/node-web-streams-helper.ts","../../../../../../../node_modules/.pnpm/next%4016.1.6_%40babel%2Bcore%407.29.0_%40playwright%2Btest%401.58.1_react-dom%4019.2.4_react%4019.2.4__react%4019.2.4/node_modules/next/src/server/request-meta.ts","../../../../../../../node_modules/.pnpm/next%4016.1.6_%40babel%2Bcore%407.29.0_%40playwright%2Btest%401.58.1_react-dom%4019.2.4_react%4019.2.4__react%4019.2.4/node_modules/next/src/server/web/utils.ts","../../../../../../../node_modules/.pnpm/next%4016.1.6_%40babel%2Bcore%407.29.0_%40playwright%2Btest%401.58.1_react-dom%4019.2.4_react%4019.2.4__react%4019.2.4/node_modules/next/src/shared/lib/i18n/detect-domain-locale.ts","../../../../../../../node_modules/.pnpm/next%4016.1.6_%40babel%2Bcore%407.29.0_%40playwright%2Btest%401.58.1_react-dom%4019.2.4_react%4019.2.4__react%4019.2.4/node_modules/next/src/shared/lib/router/utils/remove-trailing-slash.ts","../../../../../../../node_modules/.pnpm/next%4016.1.6_%40babel%2Bcore%407.29.0_%40playwright%2Btest%401.58.1_react-dom%4019.2.4_react%4019.2.4__react%4019.2.4/node_modules/next/src/shared/lib/router/utils/parse-path.ts","../../../../../../../node_modules/.pnpm/next%4016.1.6_%40babel%2Bcore%407.29.0_%40playwright%2Btest%401.58.1_react-dom%4019.2.4_react%4019.2.4__react%4019.2.4/node_modules/next/src/shared/lib/router/utils/add-path-prefix.ts","../../../../../../../node_modules/.pnpm/next%4016.1.6_%40babel%2Bcore%407.29.0_%40playwright%2Btest%401.58.1_react-dom%4019.2.4_react%4019.2.4__react%4019.2.4/node_modules/next/src/shared/lib/router/utils/add-path-suffix.ts","../../../../../../../node_modules/.pnpm/next%4016.1.6_%40babel%2Bcore%407.29.0_%40playwright%2Btest%401.58.1_react-dom%4019.2.4_react%4019.2.4__react%4019.2.4/node_modules/next/src/shared/lib/router/utils/path-has-prefix.ts","../../../../../../../node_modules/.pnpm/next%4016.1.6_%40babel%2Bcore%407.29.0_%40playwright%2Btest%401.58.1_react-dom%4019.2.4_react%4019.2.4__react%4019.2.4/node_modules/next/src/shared/lib/router/utils/add-locale.ts","../../../../../../../node_modules/.pnpm/next%4016.1.6_%40babel%2Bcore%407.29.0_%40playwright%2Btest%401.58.1_react-dom%4019.2.4_react%4019.2.4__react%4019.2.4/node_modules/next/src/shared/lib/router/utils/format-next-pathname-info.ts","../../../../../../../node_modules/.pnpm/next%4016.1.6_%40babel%2Bcore%407.29.0_%40playwright%2Btest%401.58.1_react-dom%4019.2.4_react%4019.2.4__react%4019.2.4/node_modules/next/src/shared/lib/get-hostname.ts","../../../../../../../node_modules/.pnpm/next%4016.1.6_%40babel%2Bcore%407.29.0_%40playwright%2Btest%401.58.1_react-dom%4019.2.4_react%4019.2.4__react%4019.2.4/node_modules/next/src/shared/lib/i18n/normalize-locale-path.ts","../../../../../../../node_modules/.pnpm/next%4016.1.6_%40babel%2Bcore%407.29.0_%40playwright%2Btest%401.58.1_react-dom%4019.2.4_react%4019.2.4__react%4019.2.4/node_modules/next/src/shared/lib/router/utils/remove-path-prefix.ts","../../../../../../../node_modules/.pnpm/next%4016.1.6_%40babel%2Bcore%407.29.0_%40playwright%2Btest%401.58.1_react-dom%4019.2.4_react%4019.2.4__react%4019.2.4/node_modules/next/src/shared/lib/router/utils/get-next-pathname-info.ts","../../../../../../../node_modules/.pnpm/next%4016.1.6_%40babel%2Bcore%407.29.0_%40playwright%2Btest%401.58.1_react-dom%4019.2.4_react%4019.2.4__react%4019.2.4/node_modules/next/src/server/web/next-url.ts","../../../../../../../node_modules/.pnpm/next%4016.1.6_%40babel%2Bcore%407.29.0_%40playwright%2Btest%401.58.1_react-dom%4019.2.4_react%4019.2.4__react%4019.2.4/node_modules/next/src/server/web/error.ts","../../../../../../../node_modules/.pnpm/next%4016.1.6_%40babel%2Bcore%407.29.0_%40playwright%2Btest%401.58.1_react-dom%4019.2.4_react%4019.2.4__react%4019.2.4/node_modules/next/src/server/web/spec-extension/request.ts","../../../../../../../node_modules/.pnpm/next%4016.1.6_%40babel%2Bcore%407.29.0_%40playwright%2Btest%401.58.1_react-dom%4019.2.4_react%4019.2.4__react%4019.2.4/node_modules/next/src/server/base-http/helpers.ts","../../../../../../../node_modules/.pnpm/next%4016.1.6_%40babel%2Bcore%407.29.0_%40playwright%2Btest%401.58.1_react-dom%4019.2.4_react%4019.2.4__react%4019.2.4/node_modules/next/src/server/web/spec-extension/adapters/next-request.ts","../../../../../../../node_modules/.pnpm/next%4016.1.6_%40babel%2Bcore%407.29.0_%40playwright%2Btest%401.58.1_react-dom%4019.2.4_react%4019.2.4__react%4019.2.4/node_modules/next/src/server/client-component-renderer-logger.ts","../../../../../../../node_modules/.pnpm/next%4016.1.6_%40babel%2Bcore%407.29.0_%40playwright%2Btest%401.58.1_react-dom%4019.2.4_react%4019.2.4__react%4019.2.4/node_modules/next/src/server/pipe-readable.ts","../../../../../../../node_modules/.pnpm/next%4016.1.6_%40babel%2Bcore%407.29.0_%40playwright%2Btest%401.58.1_react-dom%4019.2.4_react%4019.2.4__react%4019.2.4/node_modules/next/src/server/render-result.ts","../../../../../../../node_modules/.pnpm/next%4016.1.6_%40babel%2Bcore%407.29.0_%40playwright%2Btest%401.58.1_react-dom%4019.2.4_react%4019.2.4__react%4019.2.4/node_modules/next/src/server/route-kind.ts","../../../../../../../node_modules/.pnpm/next%4016.1.6_%40babel%2Bcore%407.29.0_%40playwright%2Btest%401.58.1_react-dom%4019.2.4_react%4019.2.4__react%4019.2.4/node_modules/next/src/server/response-cache/utils.ts","../../../../../../../node_modules/.pnpm/next%4016.1.6_%40babel%2Bcore%407.29.0_%40playwright%2Btest%401.58.1_react-dom%4019.2.4_react%4019.2.4__react%4019.2.4/node_modules/next/src/server/response-cache/index.ts","../../../../../../../node_modules/.pnpm/next%4016.1.6_%40babel%2Bcore%407.29.0_%40playwright%2Btest%401.58.1_react-dom%4019.2.4_react%4019.2.4__react%4019.2.4/node_modules/next/src/server/lib/patch-fetch.ts","../../../../../../../node_modules/.pnpm/next%4016.1.6_%40babel%2Bcore%407.29.0_%40playwright%2Btest%401.58.1_react-dom%4019.2.4_react%4019.2.4__react%4019.2.4/node_modules/next/src/server/web/spec-extension/unstable-cache.ts","../../../../../../../node_modules/.pnpm/next%4016.1.6_%40babel%2Bcore%407.29.0_%40playwright%2Btest%401.58.1_react-dom%4019.2.4_react%4019.2.4__react%4019.2.4/node_modules/next/src/shared/lib/router/utils/sorted-routes.ts","../../../../../../../node_modules/.pnpm/next%4016.1.6_%40babel%2Bcore%407.29.0_%40playwright%2Btest%401.58.1_react-dom%4019.2.4_react%4019.2.4__react%4019.2.4/node_modules/next/src/shared/lib/page-path/ensure-leading-slash.ts","../../../../../../../node_modules/.pnpm/next%4016.1.6_%40babel%2Bcore%407.29.0_%40playwright%2Btest%401.58.1_react-dom%4019.2.4_react%4019.2.4__react%4019.2.4/node_modules/next/src/shared/lib/segment.ts","../../../../../../../node_modules/.pnpm/next%4016.1.6_%40babel%2Bcore%407.29.0_%40playwright%2Btest%401.58.1_react-dom%4019.2.4_react%4019.2.4__react%4019.2.4/node_modules/next/src/shared/lib/router/utils/app-paths.ts","../../../../../../../node_modules/.pnpm/next%4016.1.6_%40babel%2Bcore%407.29.0_%40playwright%2Btest%401.58.1_react-dom%4019.2.4_react%4019.2.4__react%4019.2.4/node_modules/next/src/shared/lib/router/utils/interception-routes.ts","../../../../../../../node_modules/.pnpm/next%4016.1.6_%40babel%2Bcore%407.29.0_%40playwright%2Btest%401.58.1_react-dom%4019.2.4_react%4019.2.4__react%4019.2.4/node_modules/next/src/shared/lib/router/utils/is-dynamic.ts","../../../../../../../node_modules/.pnpm/next%4016.1.6_%40babel%2Bcore%407.29.0_%40playwright%2Btest%401.58.1_react-dom%4019.2.4_react%4019.2.4__react%4019.2.4/node_modules/next/src/shared/lib/router/utils/index.ts","../../../../../../../node_modules/.pnpm/next%4016.1.6_%40babel%2Bcore%407.29.0_%40playwright%2Btest%401.58.1_react-dom%4019.2.4_react%4019.2.4__react%4019.2.4/node_modules/next/src/server/web/spec-extension/revalidate.ts","../../../../../../../node_modules/.pnpm/next%4016.1.6_%40babel%2Bcore%407.29.0_%40playwright%2Btest%401.58.1_react-dom%4019.2.4_react%4019.2.4__react%4019.2.4/node_modules/next/src/server/web/spec-extension/unstable-no-store.ts","../../../../../../../node_modules/.pnpm/next%4016.1.6_%40babel%2Bcore%407.29.0_%40playwright%2Btest%401.58.1_react-dom%4019.2.4_react%4019.2.4__react%4019.2.4/node_modules/next/src/server/use-cache/cache-life.ts","../../../../../../../node_modules/.pnpm/next%4016.1.6_%40babel%2Bcore%407.29.0_%40playwright%2Btest%401.58.1_react-dom%4019.2.4_react%4019.2.4__react%4019.2.4/node_modules/next/src/server/use-cache/cache-tag.ts","../../../../../../../node_modules/.pnpm/next%4016.1.6_%40babel%2Bcore%407.29.0_%40playwright%2Btest%401.58.1_react-dom%4019.2.4_react%4019.2.4__react%4019.2.4/node_modules/next/cache.js","../../../../../../../src/presentation/web/.next-internal/server/app/settings/page/actions.js%20%28server%20actions%20loader%29","../../../../../../../src/presentation/web/app/actions/update-settings.ts"],"sourcesContent":["import type { ServerRuntime } from '../types'\n\nexport const TEXT_PLAIN_CONTENT_TYPE_HEADER = 'text/plain'\nexport const HTML_CONTENT_TYPE_HEADER = 'text/html; charset=utf-8'\nexport const JSON_CONTENT_TYPE_HEADER = 'application/json; charset=utf-8'\nexport const NEXT_QUERY_PARAM_PREFIX = 'nxtP'\nexport const NEXT_INTERCEPTION_MARKER_PREFIX = 'nxtI'\n\nexport const MATCHED_PATH_HEADER = 'x-matched-path'\nexport const PRERENDER_REVALIDATE_HEADER = 'x-prerender-revalidate'\nexport const PRERENDER_REVALIDATE_ONLY_GENERATED_HEADER =\n 'x-prerender-revalidate-if-generated'\n\nexport const RSC_SEGMENTS_DIR_SUFFIX = '.segments'\nexport const RSC_SEGMENT_SUFFIX = '.segment.rsc'\nexport const RSC_SUFFIX = '.rsc'\nexport const ACTION_SUFFIX = '.action'\nexport const NEXT_DATA_SUFFIX = '.json'\nexport const NEXT_META_SUFFIX = '.meta'\nexport const NEXT_BODY_SUFFIX = '.body'\n\nexport const NEXT_CACHE_TAGS_HEADER = 'x-next-cache-tags'\nexport const NEXT_CACHE_REVALIDATED_TAGS_HEADER = 'x-next-revalidated-tags'\nexport const NEXT_CACHE_REVALIDATE_TAG_TOKEN_HEADER =\n 'x-next-revalidate-tag-token'\n\nexport const NEXT_RESUME_HEADER = 'next-resume'\n\n// if these change make sure we update the related\n// documentation as well\nexport const NEXT_CACHE_TAG_MAX_ITEMS = 128\nexport const NEXT_CACHE_TAG_MAX_LENGTH = 256\nexport const NEXT_CACHE_SOFT_TAG_MAX_LENGTH = 1024\nexport const NEXT_CACHE_IMPLICIT_TAG_ID = '_N_T_'\n\n// in seconds\nexport const CACHE_ONE_YEAR = 31536000\n\n// in seconds, represents revalidate=false. I.e. never revaliate.\n// We use this value since it can be represented as a V8 SMI for optimal performance.\n// It can also be serialized as JSON if it ever leaks accidentally as an actual value.\nexport const INFINITE_CACHE = 0xfffffffe\n\n// Patterns to detect middleware files\nexport const MIDDLEWARE_FILENAME = 'middleware'\nexport const MIDDLEWARE_LOCATION_REGEXP = `(?:src/)?${MIDDLEWARE_FILENAME}`\n\n// Patterns to detect proxy files (replacement for middleware)\nexport const PROXY_FILENAME = 'proxy'\nexport const PROXY_LOCATION_REGEXP = `(?:src/)?${PROXY_FILENAME}`\n\n// Pattern to detect instrumentation hooks file\nexport const INSTRUMENTATION_HOOK_FILENAME = 'instrumentation'\n\n// Because on Windows absolute paths in the generated code can break because of numbers, eg 1 in the path,\n// we have to use a private alias\nexport const PAGES_DIR_ALIAS = 'private-next-pages'\nexport const DOT_NEXT_ALIAS = 'private-dot-next'\nexport const ROOT_DIR_ALIAS = 'private-next-root-dir'\nexport const APP_DIR_ALIAS = 'private-next-app-dir'\nexport const RSC_MOD_REF_PROXY_ALIAS = 'private-next-rsc-mod-ref-proxy'\nexport const RSC_ACTION_VALIDATE_ALIAS = 'private-next-rsc-action-validate'\nexport const RSC_ACTION_PROXY_ALIAS = 'private-next-rsc-server-reference'\nexport const RSC_CACHE_WRAPPER_ALIAS = 'private-next-rsc-cache-wrapper'\nexport const RSC_DYNAMIC_IMPORT_WRAPPER_ALIAS =\n 'private-next-rsc-track-dynamic-import'\nexport const RSC_ACTION_ENCRYPTION_ALIAS = 'private-next-rsc-action-encryption'\nexport const RSC_ACTION_CLIENT_WRAPPER_ALIAS =\n 'private-next-rsc-action-client-wrapper'\n\nexport const PUBLIC_DIR_MIDDLEWARE_CONFLICT = `You can not have a '_next' folder inside of your public folder. This conflicts with the internal '/_next' route. https://nextjs.org/docs/messages/public-next-folder-conflict`\n\nexport const SSG_GET_INITIAL_PROPS_CONFLICT = `You can not use getInitialProps with getStaticProps. To use SSG, please remove your getInitialProps`\n\nexport const SERVER_PROPS_GET_INIT_PROPS_CONFLICT = `You can not use getInitialProps with getServerSideProps. Please remove getInitialProps.`\n\nexport const SERVER_PROPS_SSG_CONFLICT = `You can not use getStaticProps or getStaticPaths with getServerSideProps. To use SSG, please remove getServerSideProps`\n\nexport const STATIC_STATUS_PAGE_GET_INITIAL_PROPS_ERROR = `can not have getInitialProps/getServerSideProps, https://nextjs.org/docs/messages/404-get-initial-props`\n\nexport const SERVER_PROPS_EXPORT_ERROR = `pages with \\`getServerSideProps\\` can not be exported. See more info here: https://nextjs.org/docs/messages/gssp-export`\n\nexport const GSP_NO_RETURNED_VALUE =\n 'Your `getStaticProps` function did not return an object. Did you forget to add a `return`?'\nexport const GSSP_NO_RETURNED_VALUE =\n 'Your `getServerSideProps` function did not return an object. Did you forget to add a `return`?'\n\nexport const UNSTABLE_REVALIDATE_RENAME_ERROR =\n 'The `unstable_revalidate` property is available for general use.\\n' +\n 'Please use `revalidate` instead.'\n\nexport const GSSP_COMPONENT_MEMBER_ERROR = `can not be attached to a page's component and must be exported from the page. See more info here: https://nextjs.org/docs/messages/gssp-component-member`\n\nexport const NON_STANDARD_NODE_ENV = `You are using a non-standard \"NODE_ENV\" value in your environment. This creates inconsistencies in the project and is strongly advised against. Read more: https://nextjs.org/docs/messages/non-standard-node-env`\n\nexport const SSG_FALLBACK_EXPORT_ERROR = `Pages with \\`fallback\\` enabled in \\`getStaticPaths\\` can not be exported. See more info here: https://nextjs.org/docs/messages/ssg-fallback-true-export`\n\nexport const ESLINT_DEFAULT_DIRS = ['app', 'pages', 'components', 'lib', 'src']\n\nexport const SERVER_RUNTIME: Record<string, ServerRuntime> = {\n edge: 'edge',\n experimentalEdge: 'experimental-edge',\n nodejs: 'nodejs',\n}\n\nexport const WEB_SOCKET_MAX_RECONNECTIONS = 12\n\n/**\n * The names of the webpack layers. These layers are the primitives for the\n * webpack chunks.\n */\nconst WEBPACK_LAYERS_NAMES = {\n /**\n * The layer for the shared code between the client and server bundles.\n */\n shared: 'shared',\n /**\n * The layer for server-only runtime and picking up `react-server` export conditions.\n * Including app router RSC pages and app router custom routes and metadata routes.\n */\n reactServerComponents: 'rsc',\n /**\n * Server Side Rendering layer for app (ssr).\n */\n serverSideRendering: 'ssr',\n /**\n * The browser client bundle layer for actions.\n */\n actionBrowser: 'action-browser',\n /**\n * The Node.js bundle layer for the API routes.\n */\n apiNode: 'api-node',\n /**\n * The Edge Lite bundle layer for the API routes.\n */\n apiEdge: 'api-edge',\n /**\n * The layer for the middleware code.\n */\n middleware: 'middleware',\n /**\n * The layer for the instrumentation hooks.\n */\n instrument: 'instrument',\n /**\n * The layer for assets on the edge.\n */\n edgeAsset: 'edge-asset',\n /**\n * The browser client bundle layer for App directory.\n */\n appPagesBrowser: 'app-pages-browser',\n /**\n * The browser client bundle layer for Pages directory.\n */\n pagesDirBrowser: 'pages-dir-browser',\n /**\n * The Edge Lite bundle layer for Pages directory.\n */\n pagesDirEdge: 'pages-dir-edge',\n /**\n * The Node.js bundle layer for Pages directory.\n */\n pagesDirNode: 'pages-dir-node',\n} as const\n\nexport type WebpackLayerName =\n (typeof WEBPACK_LAYERS_NAMES)[keyof typeof WEBPACK_LAYERS_NAMES]\n\nconst WEBPACK_LAYERS = {\n ...WEBPACK_LAYERS_NAMES,\n GROUP: {\n builtinReact: [\n WEBPACK_LAYERS_NAMES.reactServerComponents,\n WEBPACK_LAYERS_NAMES.actionBrowser,\n ],\n serverOnly: [\n WEBPACK_LAYERS_NAMES.reactServerComponents,\n WEBPACK_LAYERS_NAMES.actionBrowser,\n WEBPACK_LAYERS_NAMES.instrument,\n WEBPACK_LAYERS_NAMES.middleware,\n ],\n neutralTarget: [\n // pages api\n WEBPACK_LAYERS_NAMES.apiNode,\n WEBPACK_LAYERS_NAMES.apiEdge,\n ],\n clientOnly: [\n WEBPACK_LAYERS_NAMES.serverSideRendering,\n WEBPACK_LAYERS_NAMES.appPagesBrowser,\n ],\n bundled: [\n WEBPACK_LAYERS_NAMES.reactServerComponents,\n WEBPACK_LAYERS_NAMES.actionBrowser,\n WEBPACK_LAYERS_NAMES.serverSideRendering,\n WEBPACK_LAYERS_NAMES.appPagesBrowser,\n WEBPACK_LAYERS_NAMES.shared,\n WEBPACK_LAYERS_NAMES.instrument,\n WEBPACK_LAYERS_NAMES.middleware,\n ],\n appPages: [\n // app router pages and layouts\n WEBPACK_LAYERS_NAMES.reactServerComponents,\n WEBPACK_LAYERS_NAMES.serverSideRendering,\n WEBPACK_LAYERS_NAMES.appPagesBrowser,\n WEBPACK_LAYERS_NAMES.actionBrowser,\n ],\n },\n}\n\nconst WEBPACK_RESOURCE_QUERIES = {\n edgeSSREntry: '__next_edge_ssr_entry__',\n metadata: '__next_metadata__',\n metadataRoute: '__next_metadata_route__',\n metadataImageMeta: '__next_metadata_image_meta__',\n}\n\nexport { WEBPACK_LAYERS, WEBPACK_RESOURCE_QUERIES }\n","/**\n * Contains predefined constants for the trace span name in next/server.\n *\n * Currently, next/server/tracer is internal implementation only for tracking\n * next.js's implementation only with known span names defined here.\n **/\n\n// eslint typescript has a bug with TS enums\n\nenum BaseServerSpan {\n handleRequest = 'BaseServer.handleRequest',\n run = 'BaseServer.run',\n pipe = 'BaseServer.pipe',\n getStaticHTML = 'BaseServer.getStaticHTML',\n render = 'BaseServer.render',\n renderToResponseWithComponents = 'BaseServer.renderToResponseWithComponents',\n renderToResponse = 'BaseServer.renderToResponse',\n renderToHTML = 'BaseServer.renderToHTML',\n renderError = 'BaseServer.renderError',\n renderErrorToResponse = 'BaseServer.renderErrorToResponse',\n renderErrorToHTML = 'BaseServer.renderErrorToHTML',\n render404 = 'BaseServer.render404',\n}\n\nenum LoadComponentsSpan {\n loadDefaultErrorComponents = 'LoadComponents.loadDefaultErrorComponents',\n loadComponents = 'LoadComponents.loadComponents',\n}\n\nenum NextServerSpan {\n getRequestHandler = 'NextServer.getRequestHandler',\n getRequestHandlerWithMetadata = 'NextServer.getRequestHandlerWithMetadata',\n getServer = 'NextServer.getServer',\n getServerRequestHandler = 'NextServer.getServerRequestHandler',\n createServer = 'createServer.createServer',\n}\n\nenum NextNodeServerSpan {\n compression = 'NextNodeServer.compression',\n getBuildId = 'NextNodeServer.getBuildId',\n createComponentTree = 'NextNodeServer.createComponentTree',\n clientComponentLoading = 'NextNodeServer.clientComponentLoading',\n getLayoutOrPageModule = 'NextNodeServer.getLayoutOrPageModule',\n generateStaticRoutes = 'NextNodeServer.generateStaticRoutes',\n generateFsStaticRoutes = 'NextNodeServer.generateFsStaticRoutes',\n generatePublicRoutes = 'NextNodeServer.generatePublicRoutes',\n generateImageRoutes = 'NextNodeServer.generateImageRoutes.route',\n sendRenderResult = 'NextNodeServer.sendRenderResult',\n proxyRequest = 'NextNodeServer.proxyRequest',\n runApi = 'NextNodeServer.runApi',\n render = 'NextNodeServer.render',\n renderHTML = 'NextNodeServer.renderHTML',\n imageOptimizer = 'NextNodeServer.imageOptimizer',\n getPagePath = 'NextNodeServer.getPagePath',\n getRoutesManifest = 'NextNodeServer.getRoutesManifest',\n findPageComponents = 'NextNodeServer.findPageComponents',\n getFontManifest = 'NextNodeServer.getFontManifest',\n getServerComponentManifest = 'NextNodeServer.getServerComponentManifest',\n getRequestHandler = 'NextNodeServer.getRequestHandler',\n renderToHTML = 'NextNodeServer.renderToHTML',\n renderError = 'NextNodeServer.renderError',\n renderErrorToHTML = 'NextNodeServer.renderErrorToHTML',\n render404 = 'NextNodeServer.render404',\n startResponse = 'NextNodeServer.startResponse',\n\n // nested inner span, does not require parent scope name\n route = 'route',\n onProxyReq = 'onProxyReq',\n apiResolver = 'apiResolver',\n internalFetch = 'internalFetch',\n}\n\nenum StartServerSpan {\n startServer = 'startServer.startServer',\n}\n\nenum RenderSpan {\n getServerSideProps = 'Render.getServerSideProps',\n getStaticProps = 'Render.getStaticProps',\n renderToString = 'Render.renderToString',\n renderDocument = 'Render.renderDocument',\n createBodyResult = 'Render.createBodyResult',\n}\n\nenum AppRenderSpan {\n renderToString = 'AppRender.renderToString',\n renderToReadableStream = 'AppRender.renderToReadableStream',\n getBodyResult = 'AppRender.getBodyResult',\n fetch = 'AppRender.fetch',\n}\n\nenum RouterSpan {\n executeRoute = 'Router.executeRoute',\n}\n\nenum NodeSpan {\n runHandler = 'Node.runHandler',\n}\n\nenum AppRouteRouteHandlersSpan {\n runHandler = 'AppRouteRouteHandlers.runHandler',\n}\n\nenum ResolveMetadataSpan {\n generateMetadata = 'ResolveMetadata.generateMetadata',\n generateViewport = 'ResolveMetadata.generateViewport',\n}\n\nenum MiddlewareSpan {\n execute = 'Middleware.execute',\n}\n\ntype SpanTypes =\n | `${BaseServerSpan}`\n | `${LoadComponentsSpan}`\n | `${NextServerSpan}`\n | `${StartServerSpan}`\n | `${NextNodeServerSpan}`\n | `${RenderSpan}`\n | `${RouterSpan}`\n | `${AppRenderSpan}`\n | `${NodeSpan}`\n | `${AppRouteRouteHandlersSpan}`\n | `${ResolveMetadataSpan}`\n | `${MiddlewareSpan}`\n\n// This list is used to filter out spans that are not relevant to the user\nexport const NextVanillaSpanAllowlist = new Set([\n MiddlewareSpan.execute,\n BaseServerSpan.handleRequest,\n RenderSpan.getServerSideProps,\n RenderSpan.getStaticProps,\n AppRenderSpan.fetch,\n AppRenderSpan.getBodyResult,\n RenderSpan.renderDocument,\n NodeSpan.runHandler,\n AppRouteRouteHandlersSpan.runHandler,\n ResolveMetadataSpan.generateMetadata,\n ResolveMetadataSpan.generateViewport,\n NextNodeServerSpan.createComponentTree,\n NextNodeServerSpan.findPageComponents,\n NextNodeServerSpan.getLayoutOrPageModule,\n NextNodeServerSpan.startResponse,\n NextNodeServerSpan.clientComponentLoading,\n])\n\n// These Spans are allowed to be always logged\n// when the otel log prefix env is set\nexport const LogSpanAllowList = new Set([\n NextNodeServerSpan.findPageComponents,\n NextNodeServerSpan.createComponentTree,\n NextNodeServerSpan.clientComponentLoading,\n])\n\nexport {\n BaseServerSpan,\n LoadComponentsSpan,\n NextServerSpan,\n NextNodeServerSpan,\n StartServerSpan,\n RenderSpan,\n RouterSpan,\n AppRenderSpan,\n NodeSpan,\n AppRouteRouteHandlersSpan,\n ResolveMetadataSpan,\n MiddlewareSpan,\n}\n\nexport type { SpanTypes }\n","/**\n * Check to see if a value is Thenable.\n *\n * @param promise the maybe-thenable value\n * @returns true if the value is thenable\n */\nexport function isThenable<T = unknown>(\n promise: Promise<T> | T\n): promise is Promise<T> {\n return (\n promise !== null &&\n typeof promise === 'object' &&\n 'then' in promise &&\n typeof promise.then === 'function'\n )\n}\n","import type { FetchEventResult } from '../../web/types'\nimport type { TextMapSetter } from '@opentelemetry/api'\nimport type { SpanTypes } from './constants'\nimport { LogSpanAllowList, NextVanillaSpanAllowlist } from './constants'\n\nimport type {\n ContextAPI,\n Span,\n SpanOptions,\n Tracer,\n AttributeValue,\n TextMapGetter,\n} from 'next/dist/compiled/@opentelemetry/api'\nimport { isThenable } from '../../../shared/lib/is-thenable'\n\nconst NEXT_OTEL_PERFORMANCE_PREFIX = process.env.NEXT_OTEL_PERFORMANCE_PREFIX\n\nlet api: typeof import('next/dist/compiled/@opentelemetry/api')\n\n// we want to allow users to use their own version of @opentelemetry/api if they\n// want to, so we try to require it first, and if it fails we fall back to the\n// version that is bundled with Next.js\n// this is because @opentelemetry/api has to be synced with the version of\n// @opentelemetry/tracing that is used, and we don't want to force users to use\n// the version that is bundled with Next.js.\n// the API is ~stable, so this should be fine\nif (process.env.NEXT_RUNTIME === 'edge') {\n api = require('@opentelemetry/api') as typeof import('@opentelemetry/api')\n} else {\n try {\n api = require('@opentelemetry/api') as typeof import('@opentelemetry/api')\n } catch (err) {\n api =\n require('next/dist/compiled/@opentelemetry/api') as typeof import('next/dist/compiled/@opentelemetry/api')\n }\n}\n\nconst { context, propagation, trace, SpanStatusCode, SpanKind, ROOT_CONTEXT } =\n api\n\nexport class BubbledError extends Error {\n constructor(\n public readonly bubble?: boolean,\n public readonly result?: FetchEventResult\n ) {\n super()\n }\n}\n\nexport function isBubbledError(error: unknown): error is BubbledError {\n if (typeof error !== 'object' || error === null) return false\n return error instanceof BubbledError\n}\n\nconst closeSpanWithError = (span: Span, error?: Error) => {\n if (isBubbledError(error) && error.bubble) {\n span.setAttribute('next.bubble', true)\n } else {\n if (error) {\n span.recordException(error)\n span.setAttribute('error.type', error.name)\n }\n span.setStatus({ code: SpanStatusCode.ERROR, message: error?.message })\n }\n span.end()\n}\n\ntype TracerSpanOptions = Omit<SpanOptions, 'attributes'> & {\n parentSpan?: Span\n spanName?: string\n attributes?: Partial<Record<AttributeNames, AttributeValue | undefined>>\n hideSpan?: boolean\n}\n\ninterface NextTracer {\n getContext(): ContextAPI\n\n /**\n * Instruments a function by automatically creating a span activated on its\n * scope.\n *\n * The span will automatically be finished when one of these conditions is\n * met:\n *\n * * The function returns a promise, in which case the span will finish when\n * the promise is resolved or rejected.\n * * The function takes a callback as its second parameter, in which case the\n * span will finish when that callback is called.\n * * The function doesn't accept a callback and doesn't return a promise, in\n * which case the span will finish at the end of the function execution.\n *\n */\n trace<T>(\n type: SpanTypes,\n fn: (span?: Span, done?: (error?: Error) => any) => Promise<T>\n ): Promise<T>\n trace<T>(\n type: SpanTypes,\n fn: (span?: Span, done?: (error?: Error) => any) => T\n ): T\n trace<T>(\n type: SpanTypes,\n options: TracerSpanOptions,\n fn: (span?: Span, done?: (error?: Error) => any) => Promise<T>\n ): Promise<T>\n trace<T>(\n type: SpanTypes,\n options: TracerSpanOptions,\n fn: (span?: Span, done?: (error?: Error) => any) => T\n ): T\n\n /**\n * Wrap a function to automatically create a span activated on its\n * scope when it's called.\n *\n * The span will automatically be finished when one of these conditions is\n * met:\n *\n * * The function returns a promise, in which case the span will finish when\n * the promise is resolved or rejected.\n * * The function takes a callback as its last parameter, in which case the\n * span will finish when that callback is called.\n * * The function doesn't accept a callback and doesn't return a promise, in\n * which case the span will finish at the end of the function execution.\n */\n wrap<T = (...args: Array<any>) => any>(type: SpanTypes, fn: T): T\n wrap<T = (...args: Array<any>) => any>(\n type: SpanTypes,\n options: TracerSpanOptions,\n fn: T\n ): T\n wrap<T = (...args: Array<any>) => any>(\n type: SpanTypes,\n options: (...args: any[]) => TracerSpanOptions,\n fn: T\n ): T\n\n /**\n * Starts and returns a new Span representing a logical unit of work.\n *\n * This method do NOT modify the current Context by default. In result, any inner span will not\n * automatically set its parent context to the span created by this method unless manually activate\n * context via `tracer.getContext().with`. `trace`, or `wrap` is generally recommended as it gracefully\n * handles context activation. (ref: https://github.com/open-telemetry/opentelemetry-js/issues/1923)\n */\n startSpan(type: SpanTypes): Span\n startSpan(type: SpanTypes, options: TracerSpanOptions): Span\n\n /**\n * Returns currently activated span if current context is in the scope of the span.\n * Returns undefined otherwise.\n */\n getActiveScopeSpan(): Span | undefined\n\n /**\n * Returns trace propagation data for the currently active context. The format is equal to data provided\n * through the OpenTelemetry propagator API.\n */\n getTracePropagationData(): ClientTraceDataEntry[]\n\n /**\n * Executes a function with the given span set as the active span in the context.\n * This allows child spans created within the function to automatically parent to this span.\n */\n withSpan<T>(span: Span, fn: () => T): T\n}\n\ntype NextAttributeNames =\n | 'next.route'\n | 'next.page'\n | 'next.rsc'\n | 'next.segment'\n | 'next.span_name'\n | 'next.span_type'\n | 'next.clientComponentLoadCount'\ntype OTELAttributeNames = `http.${string}` | `net.${string}`\ntype AttributeNames = NextAttributeNames | OTELAttributeNames\n\n/** we use this map to propagate attributes from nested spans to the top span */\nconst rootSpanAttributesStore = new Map<\n number,\n Map<AttributeNames, AttributeValue | undefined>\n>()\nconst rootSpanIdKey = api.createContextKey('next.rootSpanId')\nlet lastSpanId = 0\nconst getSpanId = () => lastSpanId++\n\nexport interface ClientTraceDataEntry {\n key: string\n value: string\n}\n\nconst clientTraceDataSetter: TextMapSetter<ClientTraceDataEntry[]> = {\n set(carrier, key, value) {\n carrier.push({\n key,\n value,\n })\n },\n}\n\nclass NextTracerImpl implements NextTracer {\n /**\n * Returns an instance to the trace with configured name.\n * Since wrap / trace can be defined in any place prior to actual trace subscriber initialization,\n * This should be lazily evaluated.\n */\n private getTracerInstance(): Tracer {\n return trace.getTracer('next.js', '0.0.1')\n }\n\n public getContext(): ContextAPI {\n return context\n }\n\n public getTracePropagationData(): ClientTraceDataEntry[] {\n const activeContext = context.active()\n const entries: ClientTraceDataEntry[] = []\n propagation.inject(activeContext, entries, clientTraceDataSetter)\n return entries\n }\n\n public getActiveScopeSpan(): Span | undefined {\n return trace.getSpan(context?.active())\n }\n\n public withPropagatedContext<T, C>(\n carrier: C,\n fn: () => T,\n getter?: TextMapGetter<C>\n ): T {\n const activeContext = context.active()\n if (trace.getSpanContext(activeContext)) {\n // Active span is already set, too late to propagate.\n return fn()\n }\n const remoteContext = propagation.extract(activeContext, carrier, getter)\n return context.with(remoteContext, fn)\n }\n\n // Trace, wrap implementation is inspired by datadog trace implementation\n // (https://datadoghq.dev/dd-trace-js/interfaces/tracer.html#trace).\n public trace<T>(\n type: SpanTypes,\n fn: (span?: Span, done?: (error?: Error) => any) => Promise<T>\n ): Promise<T>\n public trace<T>(\n type: SpanTypes,\n fn: (span?: Span, done?: (error?: Error) => any) => T\n ): T\n public trace<T>(\n type: SpanTypes,\n options: TracerSpanOptions,\n fn: (span?: Span, done?: (error?: Error) => any) => Promise<T>\n ): Promise<T>\n public trace<T>(\n type: SpanTypes,\n options: TracerSpanOptions,\n fn: (span?: Span, done?: (error?: Error) => any) => T\n ): T\n public trace<T>(...args: Array<any>) {\n const [type, fnOrOptions, fnOrEmpty] = args\n\n // coerce options form overload\n const {\n fn,\n options,\n }: {\n fn: (span?: Span, done?: (error?: Error) => any) => T | Promise<T>\n options: TracerSpanOptions\n } =\n typeof fnOrOptions === 'function'\n ? {\n fn: fnOrOptions,\n options: {},\n }\n : {\n fn: fnOrEmpty,\n options: { ...fnOrOptions },\n }\n\n const spanName = options.spanName ?? type\n\n if (\n (!NextVanillaSpanAllowlist.has(type) &&\n process.env.NEXT_OTEL_VERBOSE !== '1') ||\n options.hideSpan\n ) {\n return fn()\n }\n\n // Trying to get active scoped span to assign parent. If option specifies parent span manually, will try to use it.\n let spanContext = this.getSpanContext(\n options?.parentSpan ?? this.getActiveScopeSpan()\n )\n\n if (!spanContext) {\n spanContext = context?.active() ?? ROOT_CONTEXT\n }\n // Check if there's already a root span in the store for this trace\n // We are intentionally not checking whether there is an active context\n // from outside of nextjs to ensure that we can provide the same level\n // of telemetry when using a custom server\n const existingRootSpanId = spanContext.getValue(rootSpanIdKey)\n const isRootSpan =\n typeof existingRootSpanId !== 'number' ||\n !rootSpanAttributesStore.has(existingRootSpanId)\n\n const spanId = getSpanId()\n\n options.attributes = {\n 'next.span_name': spanName,\n 'next.span_type': type,\n ...options.attributes,\n }\n\n return context.with(spanContext.setValue(rootSpanIdKey, spanId), () =>\n this.getTracerInstance().startActiveSpan(\n spanName,\n options,\n (span: Span) => {\n let startTime: number | undefined\n if (\n NEXT_OTEL_PERFORMANCE_PREFIX &&\n type &&\n LogSpanAllowList.has(type)\n ) {\n startTime =\n 'performance' in globalThis && 'measure' in performance\n ? globalThis.performance.now()\n : undefined\n }\n\n let cleanedUp = false\n const onCleanup = () => {\n if (cleanedUp) return\n cleanedUp = true\n rootSpanAttributesStore.delete(spanId)\n if (startTime) {\n performance.measure(\n `${NEXT_OTEL_PERFORMANCE_PREFIX}:next-${(\n type.split('.').pop() || ''\n ).replace(\n /[A-Z]/g,\n (match: string) => '-' + match.toLowerCase()\n )}`,\n {\n start: startTime,\n end: performance.now(),\n }\n )\n }\n }\n\n if (isRootSpan) {\n rootSpanAttributesStore.set(\n spanId,\n new Map(\n Object.entries(options.attributes ?? {}) as [\n AttributeNames,\n AttributeValue | undefined,\n ][]\n )\n )\n }\n if (fn.length > 1) {\n try {\n return fn(span, (err) => closeSpanWithError(span, err))\n } catch (err: any) {\n closeSpanWithError(span, err)\n throw err\n } finally {\n onCleanup()\n }\n }\n\n try {\n const result = fn(span)\n if (isThenable(result)) {\n // If there's error make sure it throws\n return result\n .then((res) => {\n span.end()\n // Need to pass down the promise result,\n // it could be react stream response with error { error, stream }\n return res\n })\n .catch((err) => {\n closeSpanWithError(span, err)\n throw err\n })\n .finally(onCleanup)\n } else {\n span.end()\n onCleanup()\n }\n\n return result\n } catch (err: any) {\n closeSpanWithError(span, err)\n onCleanup()\n throw err\n }\n }\n )\n )\n }\n\n public wrap<T = (...args: Array<any>) => any>(type: SpanTypes, fn: T): T\n public wrap<T = (...args: Array<any>) => any>(\n type: SpanTypes,\n options: TracerSpanOptions,\n fn: T\n ): T\n public wrap<T = (...args: Array<any>) => any>(\n type: SpanTypes,\n options: (...args: any[]) => TracerSpanOptions,\n fn: T\n ): T\n public wrap(...args: Array<any>) {\n const tracer = this\n const [name, options, fn] =\n args.length === 3 ? args : [args[0], {}, args[1]]\n\n if (\n !NextVanillaSpanAllowlist.has(name) &&\n process.env.NEXT_OTEL_VERBOSE !== '1'\n ) {\n return fn\n }\n\n return function (this: any) {\n let optionsObj = options\n if (typeof optionsObj === 'function' && typeof fn === 'function') {\n optionsObj = optionsObj.apply(this, arguments)\n }\n\n const lastArgId = arguments.length - 1\n const cb = arguments[lastArgId]\n\n if (typeof cb === 'function') {\n const scopeBoundCb = tracer.getContext().bind(context.active(), cb)\n return tracer.trace(name, optionsObj, (_span, done) => {\n arguments[lastArgId] = function (err: any) {\n done?.(err)\n return scopeBoundCb.apply(this, arguments)\n }\n\n return fn.apply(this, arguments)\n })\n } else {\n return tracer.trace(name, optionsObj, () => fn.apply(this, arguments))\n }\n }\n }\n\n public startSpan(type: SpanTypes): Span\n public startSpan(type: SpanTypes, options: TracerSpanOptions): Span\n public startSpan(...args: Array<any>): Span {\n const [type, options]: [string, TracerSpanOptions | undefined] = args as any\n\n const spanContext = this.getSpanContext(\n options?.parentSpan ?? this.getActiveScopeSpan()\n )\n return this.getTracerInstance().startSpan(type, options, spanContext)\n }\n\n private getSpanContext(parentSpan?: Span) {\n const spanContext = parentSpan\n ? trace.setSpan(context.active(), parentSpan)\n : undefined\n\n return spanContext\n }\n\n public getRootSpanAttributes() {\n const spanId = context.active().getValue(rootSpanIdKey) as number\n return rootSpanAttributesStore.get(spanId)\n }\n\n public setRootSpanAttribute(key: AttributeNames, value: AttributeValue) {\n const spanId = context.active().getValue(rootSpanIdKey) as number\n const attributes = rootSpanAttributesStore.get(spanId)\n if (attributes && !attributes.has(key)) {\n attributes.set(key, value)\n }\n }\n\n public withSpan<T>(span: Span, fn: () => T): T {\n const spanContext = trace.setSpan(context.active(), span)\n return context.with(spanContext, fn)\n }\n}\n\nconst getTracer = (() => {\n const tracer = new NextTracerImpl()\n\n return () => tracer\n})()\n\nexport { getTracer, SpanStatusCode, SpanKind }\nexport type { NextTracer, Span, SpanOptions, ContextAPI, TracerSpanOptions }\n","const noop = () => {}\n\nlet registry: FinalizationRegistry<WeakRef<ReadableStream>> | undefined\n\nif (globalThis.FinalizationRegistry) {\n registry = new FinalizationRegistry((weakRef: WeakRef<ReadableStream>) => {\n const stream = weakRef.deref()\n if (stream && !stream.locked) {\n stream.cancel('Response object has been garbage collected').then(noop)\n }\n })\n}\n\n/**\n * Clones a response by teeing the body so we can return two independent\n * ReadableStreams from it. This avoids the bug in the undici library around\n * response cloning.\n *\n * After cloning, the original response's body will be consumed and closed.\n *\n * @see https://github.com/vercel/next.js/pull/73274\n *\n * @param original - The original response to clone.\n * @returns A tuple containing two independent clones of the original response.\n */\nexport function cloneResponse(original: Response): [Response, Response] {\n // If the response has no body, then we can just return the original response\n // twice because it's immutable.\n if (!original.body) {\n return [original, original]\n }\n\n const [body1, body2] = original.body.tee()\n\n const cloned1 = new Response(body1, {\n status: original.status,\n statusText: original.statusText,\n headers: original.headers,\n })\n\n Object.defineProperty(cloned1, 'url', {\n value: original.url,\n // How the original response.url behaves\n configurable: true,\n enumerable: true,\n writable: false,\n })\n\n // The Fetch Standard allows users to skip consuming the response body by\n // relying on garbage collection to release connection resources.\n // https://github.com/nodejs/undici?tab=readme-ov-file#garbage-collection\n //\n // To cancel the stream you then need to cancel both resulting branches.\n // Teeing a stream will generally lock it for the duration, preventing other\n // readers from locking it.\n // https://developer.mozilla.org/en-US/docs/Web/API/ReadableStream/tee\n\n // cloned2 is stored in a react cache and cloned for subsequent requests.\n // It is the original request, and is is garbage collected by a\n // FinalizationRegistry in Undici, but since we're tee-ing the stream\n // ourselves, we need to cancel clone1's stream (the response returned from\n // our dedupe fetch) when clone1 is reclaimed, otherwise we leak memory.\n if (registry && cloned1.body) {\n registry.register(cloned1, new WeakRef(cloned1.body))\n }\n\n const cloned2 = new Response(body2, {\n status: original.status,\n statusText: original.statusText,\n headers: original.headers,\n })\n\n Object.defineProperty(cloned2, 'url', {\n value: original.url,\n // How the original response.url behaves\n configurable: true,\n enumerable: true,\n writable: false,\n })\n\n return [cloned1, cloned2]\n}\n","/**\n * Based on https://github.com/facebook/react/blob/d4e78c42a94be027b4dc7ed2659a5fddfbf9bd4e/packages/react/src/ReactFetch.js\n */\nimport * as React from 'react'\nimport { cloneResponse } from './clone-response'\nimport { InvariantError } from '../../shared/lib/invariant-error'\n\nconst simpleCacheKey = '[\"GET\",[],null,\"follow\",null,null,null,null]' // generateCacheKey(new Request('https://blank'));\n\n// Headers that should not affect deduplication\n// traceparent and tracestate are used for distributed tracing and should not affect cache keys\nconst headersToExcludeInCacheKey = new Set(['traceparent', 'tracestate'])\n\nfunction generateCacheKey(request: Request): string {\n // We pick the fields that goes into the key used to dedupe requests.\n // We don't include the `cache` field, because we end up using whatever\n // caching resulted from the first request.\n // Notably we currently don't consider non-standard (or future) options.\n // This might not be safe. TODO: warn for non-standard extensions differing.\n // IF YOU CHANGE THIS UPDATE THE simpleCacheKey ABOVE.\n\n const filteredHeaders = Array.from(request.headers.entries()).filter(\n ([key]) => !headersToExcludeInCacheKey.has(key.toLowerCase())\n )\n\n return JSON.stringify([\n request.method,\n filteredHeaders,\n request.mode,\n request.redirect,\n request.credentials,\n request.referrer,\n request.referrerPolicy,\n request.integrity,\n ])\n}\n\ntype CacheEntry = [\n key: string,\n promise: Promise<Response>,\n response: Response | null,\n]\n\nexport function createDedupeFetch(originalFetch: typeof fetch) {\n const getCacheEntries = React.cache(\n // eslint-disable-next-line @typescript-eslint/no-unused-vars -- url is the cache key\n (url: string): CacheEntry[] => []\n )\n\n return function dedupeFetch(\n resource: URL | RequestInfo,\n options?: RequestInit\n ): Promise<Response> {\n if (options && options.signal) {\n // If we're passed a signal, then we assume that\n // someone else controls the lifetime of this object and opts out of\n // caching. It's effectively the opt-out mechanism.\n // Ideally we should be able to check this on the Request but\n // it always gets initialized with its own signal so we don't\n // know if it's supposed to override - unless we also override the\n // Request constructor.\n return originalFetch(resource, options)\n }\n // Normalize the Request\n let url: string\n let cacheKey: string\n if (typeof resource === 'string' && !options) {\n // Fast path.\n cacheKey = simpleCacheKey\n url = resource\n } else {\n // Normalize the request.\n // if resource is not a string or a URL (its an instance of Request)\n // then do not instantiate a new Request but instead\n // reuse the request as to not disturb the body in the event it's a ReadableStream.\n const request =\n typeof resource === 'string' || resource instanceof URL\n ? new Request(resource, options)\n : resource\n if (\n (request.method !== 'GET' && request.method !== 'HEAD') ||\n request.keepalive\n ) {\n // We currently don't dedupe requests that might have side-effects. Those\n // have to be explicitly cached. We assume that the request doesn't have a\n // body if it's GET or HEAD.\n // keepalive gets treated the same as if you passed a custom cache signal.\n return originalFetch(resource, options)\n }\n cacheKey = generateCacheKey(request)\n url = request.url\n }\n\n const cacheEntries = getCacheEntries(url)\n for (let i = 0, j = cacheEntries.length; i < j; i += 1) {\n const [key, promise] = cacheEntries[i]\n if (key === cacheKey) {\n return promise.then(() => {\n const response = cacheEntries[i][2]\n if (!response) throw new InvariantError('No cached response')\n\n // We're cloning the response using this utility because there exists\n // a bug in the undici library around response cloning. See the\n // following pull request for more details:\n // https://github.com/vercel/next.js/pull/73274\n const [cloned1, cloned2] = cloneResponse(response)\n cacheEntries[i][2] = cloned2\n return cloned1\n })\n }\n }\n\n // We pass the original arguments here in case normalizing the Request\n // doesn't include all the options in this environment.\n const promise = originalFetch(resource, options)\n const entry: CacheEntry = [cacheKey, promise, null]\n cacheEntries.push(entry)\n\n return promise.then((response) => {\n // We're cloning the response using this utility because there exists\n // a bug in the undici library around response cloning. See the\n // following pull request for more details:\n // https://github.com/vercel/next.js/pull/73274\n const [cloned1, cloned2] = cloneResponse(response)\n entry[2] = cloned2\n return cloned1\n })\n }\n}\n","import type { OutgoingHttpHeaders } from 'http'\nimport type RenderResult from '../render-result'\nimport type { CacheControl, Revalidate } from '../lib/cache-control'\nimport type { RouteKind } from '../route-kind'\n\nexport interface ResponseCacheBase {\n get(\n key: string | null,\n responseGenerator: ResponseGenerator,\n context: {\n isOnDemandRevalidate?: boolean\n isPrefetch?: boolean\n incrementalCache: IncrementalCache\n /**\n * This is a hint to the cache to help it determine what kind of route\n * this is so it knows where to look up the cache entry from. If not\n * provided it will test the filesystem to check.\n */\n routeKind: RouteKind\n\n /**\n * True if this is a fallback request.\n */\n isFallback?: boolean\n\n /**\n * True if the route is enabled for PPR.\n */\n isRoutePPREnabled?: boolean\n }\n ): Promise<ResponseCacheEntry | null>\n}\n\n// The server components HMR cache might store other data as well in the future,\n// at which point this should be refactored to a discriminated union type.\nexport interface ServerComponentsHmrCache {\n get(key: string): CachedFetchData | undefined\n set(key: string, data: CachedFetchData): void\n}\n\nexport type CachedFetchData = {\n headers: Record<string, string>\n body: string\n url: string\n status?: number\n}\n\nexport const enum CachedRouteKind {\n APP_PAGE = 'APP_PAGE',\n APP_ROUTE = 'APP_ROUTE',\n PAGES = 'PAGES',\n FETCH = 'FETCH',\n REDIRECT = 'REDIRECT',\n IMAGE = 'IMAGE',\n}\n\nexport interface CachedFetchValue {\n kind: CachedRouteKind.FETCH\n data: CachedFetchData\n // tags are only present with file-system-cache\n // fetch cache stores tags outside of cache entry\n tags?: string[]\n revalidate: number\n}\n\nexport interface CachedRedirectValue {\n kind: CachedRouteKind.REDIRECT\n props: Object\n}\n\nexport interface CachedAppPageValue {\n kind: CachedRouteKind.APP_PAGE\n // this needs to be a RenderResult so since renderResponse\n // expects that type instead of a string\n html: RenderResult\n rscData: Buffer | undefined\n status: number | undefined\n postponed: string | undefined\n headers: OutgoingHttpHeaders | undefined\n segmentData: Map<string, Buffer> | undefined\n}\n\nexport interface CachedPageValue {\n kind: CachedRouteKind.PAGES\n // this needs to be a RenderResult so since renderResponse\n // expects that type instead of a string\n html: RenderResult\n pageData: Object\n status: number | undefined\n headers: OutgoingHttpHeaders | undefined\n}\n\nexport interface CachedRouteValue {\n kind: CachedRouteKind.APP_ROUTE\n // this needs to be a RenderResult so since renderResponse\n // expects that type instead of a string\n body: Buffer\n status: number\n headers: OutgoingHttpHeaders\n}\n\nexport interface CachedImageValue {\n kind: CachedRouteKind.IMAGE\n etag: string\n upstreamEtag: string\n buffer: Buffer\n extension: string\n isMiss?: boolean\n isStale?: boolean\n}\n\nexport interface IncrementalCachedAppPageValue {\n kind: CachedRouteKind.APP_PAGE\n // this needs to be a string since the cache expects to store\n // the string value\n html: string\n rscData: Buffer | undefined\n headers: OutgoingHttpHeaders | undefined\n postponed: string | undefined\n status: number | undefined\n segmentData: Map<string, Buffer> | undefined\n}\n\nexport interface IncrementalCachedPageValue {\n kind: CachedRouteKind.PAGES\n // this needs to be a string since the cache expects to store\n // the string value\n html: string\n pageData: Object\n headers: OutgoingHttpHeaders | undefined\n status: number | undefined\n}\n\nexport interface IncrementalResponseCacheEntry {\n cacheControl?: CacheControl\n /**\n * timestamp in milliseconds to revalidate after\n */\n revalidateAfter?: Revalidate\n /**\n * `-1` here dictates a blocking revalidate should be used\n */\n isStale?: boolean | -1\n isMiss?: boolean\n value: Exclude<IncrementalCacheValue, CachedFetchValue> | null\n}\n\nexport interface IncrementalFetchCacheEntry {\n /**\n * `-1` here dictates a blocking revalidate should be used\n */\n isStale?: boolean | -1\n value: CachedFetchValue\n}\n\nexport type IncrementalCacheEntry =\n | IncrementalResponseCacheEntry\n | IncrementalFetchCacheEntry\n\nexport type IncrementalCacheValue =\n | CachedRedirectValue\n | IncrementalCachedPageValue\n | IncrementalCachedAppPageValue\n | CachedImageValue\n | CachedFetchValue\n | CachedRouteValue\n\nexport type ResponseCacheValue =\n | CachedRedirectValue\n | CachedPageValue\n | CachedAppPageValue\n | CachedImageValue\n | CachedRouteValue\n\nexport type ResponseCacheEntry = {\n cacheControl?: CacheControl\n value: ResponseCacheValue | null\n isStale?: boolean | -1\n isMiss?: boolean\n}\n\n/**\n * @param hasResolved whether the responseGenerator has resolved it's promise\n * @param previousCacheEntry the previous cache entry if it exists or the current\n */\nexport type ResponseGenerator = (state: {\n hasResolved: boolean\n previousCacheEntry?: IncrementalResponseCacheEntry | null\n isRevalidating?: boolean\n span?: any\n\n /**\n * When true, this indicates that the response generator is being called in a\n * context where the response must be generated statically.\n *\n * CRITICAL: This should only currently be used when revalidating due to a\n * dynamic RSC request.\n */\n forceStaticRender?: boolean\n}) => Promise<ResponseCacheEntry | null>\n\nexport const enum IncrementalCacheKind {\n APP_PAGE = 'APP_PAGE',\n APP_ROUTE = 'APP_ROUTE',\n PAGES = 'PAGES',\n FETCH = 'FETCH',\n IMAGE = 'IMAGE',\n}\n\nexport interface GetIncrementalFetchCacheContext {\n kind: IncrementalCacheKind.FETCH\n revalidate?: Revalidate\n fetchUrl?: string\n fetchIdx?: number\n tags?: string[]\n softTags?: string[]\n}\n\nexport interface GetIncrementalResponseCacheContext {\n kind: Exclude<IncrementalCacheKind, IncrementalCacheKind.FETCH>\n\n /**\n * True if the route is enabled for PPR.\n */\n isRoutePPREnabled?: boolean\n\n /**\n * True if this is a fallback request.\n */\n isFallback: boolean\n}\n\nexport interface SetIncrementalFetchCacheContext {\n fetchCache: true\n fetchUrl?: string\n fetchIdx?: number\n tags?: string[]\n isImplicitBuildTimeCache?: boolean\n}\n\nexport interface SetIncrementalResponseCacheContext {\n fetchCache?: false\n cacheControl?: CacheControl\n\n /**\n * True if the route is enabled for PPR.\n */\n isRoutePPREnabled?: boolean\n\n /**\n * True if this is a fallback request.\n */\n isFallback?: boolean\n}\n\nexport interface IncrementalResponseCache {\n get(\n cacheKey: string,\n ctx: GetIncrementalResponseCacheContext\n ): Promise<IncrementalResponseCacheEntry | null>\n set(\n key: string,\n data: Exclude<IncrementalCacheValue, CachedFetchValue> | null,\n ctx: SetIncrementalResponseCacheContext\n ): Promise<void>\n}\n\nexport interface IncrementalCache extends IncrementalResponseCache {\n get(\n cacheKey: string,\n ctx: GetIncrementalFetchCacheContext\n ): Promise<IncrementalFetchCacheEntry | null>\n get(\n cacheKey: string,\n ctx: GetIncrementalResponseCacheContext\n ): Promise<IncrementalResponseCacheEntry | null>\n set(\n key: string,\n data: CachedFetchValue | null,\n ctx: SetIncrementalFetchCacheContext\n ): Promise<void>\n set(\n key: string,\n data: Exclude<IncrementalCacheValue, CachedFetchValue> | null,\n ctx: SetIncrementalResponseCacheContext\n ): Promise<void>\n revalidateTag(\n tags: string | string[],\n durations?: { expire?: number }\n ): Promise<void>\n}\n","/**\n * A `Promise.withResolvers` implementation that exposes the `resolve` and\n * `reject` functions on a `Promise`.\n *\n * @see https://tc39.es/proposal-promise-with-resolvers/\n */\nexport class DetachedPromise<T = any> {\n public readonly resolve: (value: T | PromiseLike<T>) => void\n public readonly reject: (reason: any) => void\n public readonly promise: Promise<T>\n\n constructor() {\n let resolve: (value: T | PromiseLike<T>) => void\n let reject: (reason: any) => void\n\n // Create the promise and assign the resolvers to the object.\n this.promise = new Promise<T>((res, rej) => {\n resolve = res\n reject = rej\n })\n\n // We know that resolvers is defined because the Promise constructor runs\n // synchronously.\n this.resolve = resolve!\n this.reject = reject!\n }\n}\n","import type { SchedulerFn } from './scheduler'\n\nimport { DetachedPromise } from './detached-promise'\n\ntype CacheKeyFn<K, C extends string | number | null> = (\n key: K\n) => PromiseLike<C> | C\n\ntype BatcherOptions<K, C extends string | number | null> = {\n cacheKeyFn?: CacheKeyFn<K, C>\n schedulerFn?: SchedulerFn<void>\n}\n\ntype WorkFnContext<V, K> = {\n resolve: (value: V | PromiseLike<V>) => void\n key: K\n}\n\ntype WorkFn<V, K> = (context: WorkFnContext<V, K>) => Promise<V>\n\n/**\n * A wrapper for a function that will only allow one call to the function to\n * execute at a time.\n */\nexport class Batcher<K, V, C extends string | number | null> {\n private readonly pending = new Map<C, Promise<V>>()\n\n protected constructor(\n private readonly cacheKeyFn?: CacheKeyFn<K, C>,\n /**\n * A function that will be called to schedule the wrapped function to be\n * executed. This defaults to a function that will execute the function\n * immediately.\n */\n private readonly schedulerFn: SchedulerFn<void> = (fn) => fn()\n ) {}\n\n /**\n * Creates a new instance of PendingWrapper. If the key extends a string or\n * number, the key will be used as the cache key. If the key is an object, a\n * cache key function must be provided.\n */\n public static create<K extends string | number | null, V>(\n options?: BatcherOptions<K, K>\n ): Batcher<K, V, K>\n public static create<K, V, C extends string | number | null>(\n options: BatcherOptions<K, C> &\n Required<Pick<BatcherOptions<K, C>, 'cacheKeyFn'>>\n ): Batcher<K, V, C>\n public static create<K, V, C extends string | number | null>(\n options?: BatcherOptions<K, C>\n ): Batcher<K, V, C> {\n return new Batcher<K, V, C>(options?.cacheKeyFn, options?.schedulerFn)\n }\n\n /**\n * Wraps a function in a promise that will be resolved or rejected only once\n * for a given key. This will allow multiple calls to the function to be\n * made, but only one will be executed at a time. The result of the first\n * call will be returned to all callers.\n *\n * @param key the key to use for the cache\n * @param fn the function to wrap\n * @returns a promise that resolves to the result of the function\n */\n public async batch(key: K, fn: WorkFn<V, K>): Promise<V> {\n const cacheKey = (this.cacheKeyFn ? await this.cacheKeyFn(key) : key) as C\n if (cacheKey === null) {\n return fn({ resolve: (value) => Promise.resolve(value), key })\n }\n\n const pending = this.pending.get(cacheKey)\n if (pending) return pending\n\n const { promise, resolve, reject } = new DetachedPromise<V>()\n this.pending.set(cacheKey, promise)\n\n this.schedulerFn(async () => {\n try {\n const result = await fn({ resolve, key })\n\n // Resolving a promise multiple times is a no-op, so we can safely\n // resolve all pending promises with the same result.\n resolve(result)\n } catch (err) {\n reject(err)\n } finally {\n this.pending.delete(cacheKey)\n }\n })\n\n return promise\n }\n}\n","/**\n * Node in the doubly-linked list used for LRU tracking.\n * Each node represents a cache entry with bidirectional pointers.\n */\nclass LRUNode<T> {\n public readonly key: string\n public data: T\n public size: number\n public prev: LRUNode<T> | SentinelNode<T> | null = null\n public next: LRUNode<T> | SentinelNode<T> | null = null\n\n constructor(key: string, data: T, size: number) {\n this.key = key\n this.data = data\n this.size = size\n }\n}\n\n/**\n * Sentinel node used for head/tail boundaries.\n * These nodes don't contain actual cache data but simplify list operations.\n */\nclass SentinelNode<T> {\n public prev: LRUNode<T> | SentinelNode<T> | null = null\n public next: LRUNode<T> | SentinelNode<T> | null = null\n}\n\n/**\n * LRU (Least Recently Used) Cache implementation using a doubly-linked list\n * and hash map for O(1) operations.\n *\n * Algorithm:\n * - Uses a doubly-linked list to maintain access order (most recent at head)\n * - Hash map provides O(1) key-to-node lookup\n * - Sentinel head/tail nodes simplify edge case handling\n * - Size-based eviction supports custom size calculation functions\n *\n * Data Structure Layout:\n * HEAD <-> [most recent] <-> ... <-> [least recent] <-> TAIL\n *\n * Operations:\n * - get(): Move accessed node to head (mark as most recent)\n * - set(): Add new node at head, evict from tail if over capacity\n * - Eviction: Remove least recent node (tail.prev) when size exceeds limit\n */\nexport class LRUCache<T> {\n private readonly cache: Map<string, LRUNode<T>> = new Map()\n private readonly head: SentinelNode<T>\n private readonly tail: SentinelNode<T>\n private totalSize: number = 0\n private readonly maxSize: number\n private readonly calculateSize: ((value: T) => number) | undefined\n private readonly onEvict: ((key: string, value: T) => void) | undefined\n\n constructor(\n maxSize: number,\n calculateSize?: (value: T) => number,\n onEvict?: (key: string, value: T) => void\n ) {\n this.maxSize = maxSize\n this.calculateSize = calculateSize\n this.onEvict = onEvict\n\n // Create sentinel nodes to simplify doubly-linked list operations\n // HEAD <-> TAIL (empty list)\n this.head = new SentinelNode<T>()\n this.tail = new SentinelNode<T>()\n this.head.next = this.tail\n this.tail.prev = this.head\n }\n\n /**\n * Adds a node immediately after the head (marks as most recently used).\n * Used when inserting new items or when an item is accessed.\n * PRECONDITION: node must be disconnected (prev/next should be null)\n */\n private addToHead(node: LRUNode<T>): void {\n node.prev = this.head\n node.next = this.head.next\n // head.next is always non-null (points to tail or another node)\n this.head.next!.prev = node\n this.head.next = node\n }\n\n /**\n * Removes a node from its current position in the doubly-linked list.\n * Updates the prev/next pointers of adjacent nodes to maintain list integrity.\n * PRECONDITION: node must be connected (prev/next are non-null)\n */\n private removeNode(node: LRUNode<T>): void {\n // Connected nodes always have non-null prev/next\n node.prev!.next = node.next\n node.next!.prev = node.prev\n }\n\n /**\n * Moves an existing node to the head position (marks as most recently used).\n * This is the core LRU operation - accessed items become most recent.\n */\n private moveToHead(node: LRUNode<T>): void {\n this.removeNode(node)\n this.addToHead(node)\n }\n\n /**\n * Removes and returns the least recently used node (the one before tail).\n * This is called during eviction when the cache exceeds capacity.\n * PRECONDITION: cache is not empty (ensured by caller)\n */\n private removeTail(): LRUNode<T> {\n const lastNode = this.tail.prev as LRUNode<T>\n // tail.prev is always non-null and always LRUNode when cache is not empty\n this.removeNode(lastNode)\n return lastNode\n }\n\n /**\n * Sets a key-value pair in the cache.\n * If the key exists, updates the value and moves to head.\n * If new, adds at head and evicts from tail if necessary.\n *\n * Time Complexity:\n * - O(1) for uniform item sizes\n * - O(k) where k is the number of items evicted (can be O(N) for variable sizes)\n */\n public set(key: string, value: T): void {\n const size = this.calculateSize?.(value) ?? 1\n if (size > this.maxSize) {\n console.warn('Single item size exceeds maxSize')\n return\n }\n\n const existing = this.cache.get(key)\n if (existing) {\n // Update existing node: adjust size and move to head (most recent)\n existing.data = value\n this.totalSize = this.totalSize - existing.size + size\n existing.size = size\n this.moveToHead(existing)\n } else {\n // Add new node at head (most recent position)\n const newNode = new LRUNode(key, value, size)\n this.cache.set(key, newNode)\n this.addToHead(newNode)\n this.totalSize += size\n }\n\n // Evict least recently used items until under capacity\n while (this.totalSize > this.maxSize && this.cache.size > 0) {\n const tail = this.removeTail()\n this.cache.delete(tail.key)\n this.totalSize -= tail.size\n this.onEvict?.(tail.key, tail.data)\n }\n }\n\n /**\n * Checks if a key exists in the cache.\n * This is a pure query operation - does NOT update LRU order.\n *\n * Time Complexity: O(1)\n */\n public has(key: string): boolean {\n return this.cache.has(key)\n }\n\n /**\n * Retrieves a value by key and marks it as most recently used.\n * Moving to head maintains the LRU property for future evictions.\n *\n * Time Complexity: O(1)\n */\n public get(key: string): T | undefined {\n const node = this.cache.get(key)\n if (!node) return undefined\n\n // Mark as most recently used by moving to head\n this.moveToHead(node)\n\n return node.data\n }\n\n /**\n * Returns an iterator over the cache entries. The order is outputted in the\n * order of most recently used to least recently used.\n */\n public *[Symbol.iterator](): IterableIterator<[string, T]> {\n let current = this.head.next\n while (current && current !== this.tail) {\n // Between head and tail, current is always LRUNode\n const node = current as LRUNode<T>\n yield [node.key, node.data]\n current = current.next\n }\n }\n\n /**\n * Removes a specific key from the cache.\n * Updates both the hash map and doubly-linked list.\n *\n * Note: This is an explicit removal and does NOT trigger the `onEvict`\n * callback. Use this for intentional deletions where eviction tracking\n * is not needed.\n *\n * Time Complexity: O(1)\n */\n public remove(key: string): void {\n const node = this.cache.get(key)\n if (!node) return\n\n this.removeNode(node)\n this.cache.delete(key)\n this.totalSize -= node.size\n }\n\n /**\n * Returns the number of items in the cache.\n */\n public get size(): number {\n return this.cache.size\n }\n\n /**\n * Returns the current total size of all cached items.\n * This uses the custom size calculation if provided.\n */\n public get currentSize(): number {\n return this.totalSize\n }\n}\n","// ISC License\n\n// Copyright (c) 2021 Alexey Raspopov, Kostiantyn Denysov, Anton Verinov\n\n// Permission to use, copy, modify, and/or distribute this software for any\n// purpose with or without fee is hereby granted, provided that the above\n// copyright notice and this permission notice appear in all copies.\n\n// THE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES\n// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF\n// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR\n// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES\n// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN\n// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF\n// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.\n//\n// https://github.com/alexeyraspopov/picocolors/blob/b6261487e7b81aaab2440e397a356732cad9e342/picocolors.js#L1\n\nconst { env, stdout } = globalThis?.process ?? {}\n\nconst enabled =\n env &&\n !env.NO_COLOR &&\n (env.FORCE_COLOR || (stdout?.isTTY && !env.CI && env.TERM !== 'dumb'))\n\nconst replaceClose = (\n str: string,\n close: string,\n replace: string,\n index: number\n): string => {\n const start = str.substring(0, index) + replace\n const end = str.substring(index + close.length)\n const nextIndex = end.indexOf(close)\n return ~nextIndex\n ? start + replaceClose(end, close, replace, nextIndex)\n : start + end\n}\n\nconst formatter = (open: string, close: string, replace = open) => {\n if (!enabled) return String\n return (input: string) => {\n const string = '' + input\n const index = string.indexOf(close, open.length)\n return ~index\n ? open + replaceClose(string, close, replace, index) + close\n : open + string + close\n }\n}\n\nexport const reset = enabled ? (s: string) => `\\x1b[0m${s}\\x1b[0m` : String\nexport const bold = formatter('\\x1b[1m', '\\x1b[22m', '\\x1b[22m\\x1b[1m')\nexport const dim = formatter('\\x1b[2m', '\\x1b[22m', '\\x1b[22m\\x1b[2m')\nexport const italic = formatter('\\x1b[3m', '\\x1b[23m')\nexport const underline = formatter('\\x1b[4m', '\\x1b[24m')\nexport const inverse = formatter('\\x1b[7m', '\\x1b[27m')\nexport const hidden = formatter('\\x1b[8m', '\\x1b[28m')\nexport const strikethrough = formatter('\\x1b[9m', '\\x1b[29m')\nexport const black = formatter('\\x1b[30m', '\\x1b[39m')\nexport const red = formatter('\\x1b[31m', '\\x1b[39m')\nexport const green = formatter('\\x1b[32m', '\\x1b[39m')\nexport const yellow = formatter('\\x1b[33m', '\\x1b[39m')\nexport const blue = formatter('\\x1b[34m', '\\x1b[39m')\nexport const magenta = formatter('\\x1b[35m', '\\x1b[39m')\nexport const purple = formatter('\\x1b[38;2;173;127;168m', '\\x1b[39m')\nexport const cyan = formatter('\\x1b[36m', '\\x1b[39m')\nexport const white = formatter('\\x1b[37m', '\\x1b[39m')\nexport const gray = formatter('\\x1b[90m', '\\x1b[39m')\nexport const bgBlack = formatter('\\x1b[40m', '\\x1b[49m')\nexport const bgRed = formatter('\\x1b[41m', '\\x1b[49m')\nexport const bgGreen = formatter('\\x1b[42m', '\\x1b[49m')\nexport const bgYellow = formatter('\\x1b[43m', '\\x1b[49m')\nexport const bgBlue = formatter('\\x1b[44m', '\\x1b[49m')\nexport const bgMagenta = formatter('\\x1b[45m', '\\x1b[49m')\nexport const bgCyan = formatter('\\x1b[46m', '\\x1b[49m')\nexport const bgWhite = formatter('\\x1b[47m', '\\x1b[49m')\n","import { bold, green, magenta, red, yellow, white } from '../../lib/picocolors'\nimport { LRUCache } from '../../server/lib/lru-cache'\n\nexport const prefixes = {\n wait: white(bold('○')),\n error: red(bold('⨯')),\n warn: yellow(bold('⚠')),\n ready: '▲', // no color\n info: white(bold(' ')),\n event: green(bold('✓')),\n trace: magenta(bold('»')),\n} as const\n\nconst LOGGING_METHOD = {\n log: 'log',\n warn: 'warn',\n error: 'error',\n} as const\n\nfunction prefixedLog(prefixType: keyof typeof prefixes, ...message: any[]) {\n if ((message[0] === '' || message[0] === undefined) && message.length === 1) {\n message.shift()\n }\n\n const consoleMethod: keyof typeof LOGGING_METHOD =\n prefixType in LOGGING_METHOD\n ? LOGGING_METHOD[prefixType as keyof typeof LOGGING_METHOD]\n : 'log'\n\n const prefix = prefixes[prefixType]\n // If there's no message, don't print the prefix but a new line\n if (message.length === 0) {\n console[consoleMethod]('')\n } else {\n // Ensure if there's ANSI escape codes it's concatenated into one string.\n // Chrome DevTool can only handle color if it's in one string.\n if (message.length === 1 && typeof message[0] === 'string') {\n console[consoleMethod](prefix + ' ' + message[0])\n } else {\n console[consoleMethod](prefix, ...message)\n }\n }\n}\n\nexport function bootstrap(message: string) {\n console.log(message)\n}\n\nexport function wait(...message: any[]) {\n prefixedLog('wait', ...message)\n}\n\nexport function error(...message: any[]) {\n prefixedLog('error', ...message)\n}\n\nexport function warn(...message: any[]) {\n prefixedLog('warn', ...message)\n}\n\nexport function ready(...message: any[]) {\n prefixedLog('ready', ...message)\n}\n\nexport function info(...message: any[]) {\n prefixedLog('info', ...message)\n}\n\nexport function event(...message: any[]) {\n prefixedLog('event', ...message)\n}\n\nexport function trace(...message: any[]) {\n prefixedLog('trace', ...message)\n}\n\nconst warnOnceCache = new LRUCache<string>(10_000, (value) => value.length)\nexport function warnOnce(...message: any[]) {\n const key = message.join(' ')\n if (!warnOnceCache.has(key)) {\n warnOnceCache.set(key, key)\n warn(...message)\n }\n}\n\nconst errorOnceCache = new LRUCache<string>(10_000, (value) => value.length)\nexport function errorOnce(...message: any[]) {\n const key = message.join(' ')\n if (!errorOnceCache.has(key)) {\n errorOnceCache.set(key, key)\n error(...message)\n }\n}\n","export const ENCODED_TAGS = {\n // opening tags do not have the closing `>` since they can contain other attributes such as `<body className=''>`\n OPENING: {\n // <html\n HTML: new Uint8Array([60, 104, 116, 109, 108]),\n // <body\n BODY: new Uint8Array([60, 98, 111, 100, 121]),\n },\n CLOSED: {\n // </head>\n HEAD: new Uint8Array([60, 47, 104, 101, 97, 100, 62]),\n // </body>\n BODY: new Uint8Array([60, 47, 98, 111, 100, 121, 62]),\n // </html>\n HTML: new Uint8Array([60, 47, 104, 116, 109, 108, 62]),\n // </body></html>\n BODY_AND_HTML: new Uint8Array([\n 60, 47, 98, 111, 100, 121, 62, 60, 47, 104, 116, 109, 108, 62,\n ]),\n },\n META: {\n // Only the match the prefix cause the suffix can be different wether it's xml compatible or not \">\" or \"/>\"\n // <meta name=\"«nxt-icon»\"\n // This is a special mark that will be replaced by the icon insertion script tag.\n ICON_MARK: new Uint8Array([\n 60, 109, 101, 116, 97, 32, 110, 97, 109, 101, 61, 34, 194, 171, 110, 120,\n 116, 45, 105, 99, 111, 110, 194, 187, 34,\n ]),\n },\n} as const\n","/**\n * Find the starting index of Uint8Array `b` within Uint8Array `a`.\n */\nexport function indexOfUint8Array(a: Uint8Array, b: Uint8Array) {\n if (b.length === 0) return 0\n if (a.length === 0 || b.length > a.length) return -1\n\n // start iterating through `a`\n for (let i = 0; i <= a.length - b.length; i++) {\n let completeMatch = true\n // from index `i`, iterate through `b` and check for mismatch\n for (let j = 0; j < b.length; j++) {\n // if the values do not match, then this isn't a complete match, exit `b` iteration early and iterate to next index of `a`.\n if (a[i + j] !== b[j]) {\n completeMatch = false\n break\n }\n }\n\n if (completeMatch) {\n return i\n }\n }\n\n return -1\n}\n\n/**\n * Check if two Uint8Arrays are strictly equivalent.\n */\nexport function isEquivalentUint8Arrays(a: Uint8Array, b: Uint8Array) {\n if (a.length !== b.length) return false\n\n for (let i = 0; i < a.length; i++) {\n if (a[i] !== b[i]) return false\n }\n\n return true\n}\n\n/**\n * Remove Uint8Array `b` from Uint8Array `a`.\n *\n * If `b` is not in `a`, `a` is returned unchanged.\n *\n * Otherwise, the function returns a new Uint8Array instance with size `a.length - b.length`\n */\nexport function removeFromUint8Array(a: Uint8Array, b: Uint8Array) {\n const tagIndex = indexOfUint8Array(a, b)\n if (tagIndex === 0) return a.subarray(b.length)\n if (tagIndex > -1) {\n const removed = new Uint8Array(a.length - b.length)\n removed.set(a.slice(0, tagIndex))\n removed.set(a.slice(tagIndex + b.length), tagIndex)\n return removed\n } else {\n return a\n }\n}\n","export const MISSING_ROOT_TAGS_ERROR = 'NEXT_MISSING_ROOT_TAGS'\n","// In output: export mode, the build id is added to the start of the HTML\n// document, directly after the doctype declaration. During a prefetch, the\n// client performs a range request to get the build id, so it can check whether\n// the target page belongs to the same build.\n//\n// The first 64 bytes of the document are requested. The exact number isn't\n// too important; it must be larger than the build id + doctype + closing and\n// ending comment markers, but it doesn't need to match the end of the\n// comment exactly.\n//\n// Build ids are 21 bytes long in the default implementation, though this\n// can be overridden in the Next.js config. For the purposes of this check,\n// it's OK to only match the start of the id, so we'll truncate it if exceeds\n// a certain length.\n\nconst DOCTYPE_PREFIX = '<!DOCTYPE html>' // 15 bytes\nconst MAX_BUILD_ID_LENGTH = 24\n\nfunction escapeBuildId(buildId: string) {\n // If the build id is longer than the given limit, it's OK for our purposes\n // to only match the beginning.\n const truncated = buildId.slice(0, MAX_BUILD_ID_LENGTH)\n // Replace hyphens with underscores so it doesn't break the HTML comment.\n // (Unlikely, but if this did happen it would break the whole document.)\n return truncated.replace(/-/g, '_')\n}\n\nexport function insertBuildIdComment(originalHtml: string, buildId: string) {\n if (\n // Skip if the build id contains a closing comment marker.\n buildId.includes('-->') ||\n // React always inserts a doctype at the start of the document. Skip if it\n // isn't present. Shouldn't happen; suggests an issue elsewhere.\n !originalHtml.startsWith(DOCTYPE_PREFIX)\n ) {\n // Return the original HTML unchanged. This means the document will not\n // be prefetched.\n // TODO: The build id comment is currently only used during prefetches, but\n // if we eventually use this mechanism for regular navigations, we may need\n // to error during build if we fail to insert it for some reason.\n return originalHtml\n }\n // The comment must be inserted after the doctype.\n return originalHtml.replace(\n DOCTYPE_PREFIX,\n DOCTYPE_PREFIX + '<!--' + escapeBuildId(buildId) + '-->'\n )\n}\n","export const RSC_HEADER = 'rsc' as const\nexport const ACTION_HEADER = 'next-action' as const\n// TODO: Instead of sending the full router state, we only need to send the\n// segment path. Saves bytes. Then we could also use this field for segment\n// prefetches, which also need to specify a particular segment.\nexport const NEXT_ROUTER_STATE_TREE_HEADER = 'next-router-state-tree' as const\nexport const NEXT_ROUTER_PREFETCH_HEADER = 'next-router-prefetch' as const\n// This contains the path to the segment being prefetched.\n// TODO: If we change next-router-state-tree to be a segment path, we can use\n// that instead. Then next-router-prefetch and next-router-segment-prefetch can\n// be merged into a single enum.\nexport const NEXT_ROUTER_SEGMENT_PREFETCH_HEADER =\n 'next-router-segment-prefetch' as const\nexport const NEXT_HMR_REFRESH_HEADER = 'next-hmr-refresh' as const\nexport const NEXT_HMR_REFRESH_HASH_COOKIE = '__next_hmr_refresh_hash__' as const\nexport const NEXT_URL = 'next-url' as const\nexport const RSC_CONTENT_TYPE_HEADER = 'text/x-component' as const\n\nexport const FLIGHT_HEADERS = [\n RSC_HEADER,\n NEXT_ROUTER_STATE_TREE_HEADER,\n NEXT_ROUTER_PREFETCH_HEADER,\n NEXT_HMR_REFRESH_HEADER,\n NEXT_ROUTER_SEGMENT_PREFETCH_HEADER,\n] as const\n\nexport const NEXT_RSC_UNION_QUERY = '_rsc' as const\n\nexport const NEXT_ROUTER_STALE_TIME_HEADER = 'x-nextjs-stale-time' as const\nexport const NEXT_DID_POSTPONE_HEADER = 'x-nextjs-postponed' as const\nexport const NEXT_REWRITTEN_PATH_HEADER = 'x-nextjs-rewritten-path' as const\nexport const NEXT_REWRITTEN_QUERY_HEADER = 'x-nextjs-rewritten-query' as const\nexport const NEXT_IS_PRERENDER_HEADER = 'x-nextjs-prerender' as const\nexport const NEXT_ACTION_NOT_FOUND_HEADER = 'x-nextjs-action-not-found' as const\nexport const NEXT_REQUEST_ID_HEADER = 'x-nextjs-request-id' as const\nexport const NEXT_HTML_REQUEST_ID_HEADER = 'x-nextjs-html-request-id' as const\n\n// TODO: Should this include nextjs in the name, like the others?\nexport const NEXT_ACTION_REVALIDATED_HEADER = 'x-action-revalidated' as const\n","// http://www.cse.yorku.ca/~oz/hash.html\n// More specifically, 32-bit hash via djbxor\n// (ref: https://gist.github.com/eplawless/52813b1d8ad9af510d85?permalink_comment_id=3367765#gistcomment-3367765)\n// This is due to number type differences between rust for turbopack to js number types,\n// where rust does not have easy way to repreesnt js's 53-bit float number type for the matching\n// overflow behavior. This is more `correct` in terms of having canonical hash across different runtime / implementation\n// as can gaurantee determinstic output from 32bit hash.\nexport function djb2Hash(str: string) {\n let hash = 5381\n for (let i = 0; i < str.length; i++) {\n const char = str.charCodeAt(i)\n hash = ((hash << 5) + hash + char) & 0xffffffff\n }\n return hash >>> 0\n}\n\nexport function hexHash(str: string) {\n return djb2Hash(str).toString(36).slice(0, 5)\n}\n","import { hexHash } from '../../hash'\n\nexport function computeCacheBustingSearchParam(\n prefetchHeader: '1' | '2' | '0' | undefined,\n segmentPrefetchHeader: string | string[] | undefined,\n stateTreeHeader: string | string[] | undefined,\n nextUrlHeader: string | string[] | undefined\n): string {\n if (\n (prefetchHeader === undefined || prefetchHeader === '0') &&\n segmentPrefetchHeader === undefined &&\n stateTreeHeader === undefined &&\n nextUrlHeader === undefined\n ) {\n return ''\n }\n return hexHash(\n [\n prefetchHeader || '0',\n segmentPrefetchHeader || '0',\n stateTreeHeader || '0',\n nextUrlHeader || '0',\n ].join(',')\n )\n}\n","import type { ReactDOMServerReadableStream } from 'react-dom/server'\nimport { getTracer } from '../lib/trace/tracer'\nimport { AppRenderSpan } from '../lib/trace/constants'\nimport { DetachedPromise } from '../../lib/detached-promise'\nimport {\n scheduleImmediate,\n atLeastOneTask,\n waitAtLeastOneReactRenderTask,\n} from '../../lib/scheduler'\nimport { ENCODED_TAGS } from './encoded-tags'\nimport {\n indexOfUint8Array,\n isEquivalentUint8Arrays,\n removeFromUint8Array,\n} from './uint8array-helpers'\nimport { MISSING_ROOT_TAGS_ERROR } from '../../shared/lib/errors/constants'\nimport { insertBuildIdComment } from '../../shared/lib/segment-cache/output-export-prefetch-encoding'\nimport {\n RSC_HEADER,\n NEXT_ROUTER_PREFETCH_HEADER,\n NEXT_ROUTER_SEGMENT_PREFETCH_HEADER,\n NEXT_RSC_UNION_QUERY,\n} from '../../client/components/app-router-headers'\nimport { computeCacheBustingSearchParam } from '../../shared/lib/router/utils/cache-busting-search-param'\n\nfunction voidCatch() {\n // this catcher is designed to be used with pipeTo where we expect the underlying\n // pipe implementation to forward errors but we don't want the pipeTo promise to reject\n // and be unhandled\n}\n\n// We can share the same encoder instance everywhere\n// Notably we cannot do the same for TextDecoder because it is stateful\n// when handling streaming data\nconst encoder = new TextEncoder()\n\nexport function chainStreams<T>(\n ...streams: ReadableStream<T>[]\n): ReadableStream<T> {\n // If we have no streams, return an empty stream. This behavior is\n // intentional as we're now providing the `RenderResult.EMPTY` value.\n if (streams.length === 0) {\n return new ReadableStream<T>({\n start(controller) {\n controller.close()\n },\n })\n }\n\n // If we only have 1 stream we fast path it by returning just this stream\n if (streams.length === 1) {\n return streams[0]\n }\n\n const { readable, writable } = new TransformStream()\n\n // We always initiate pipeTo immediately. We know we have at least 2 streams\n // so we need to avoid closing the writable when this one finishes.\n let promise = streams[0].pipeTo(writable, { preventClose: true })\n\n let i = 1\n for (; i < streams.length - 1; i++) {\n const nextStream = streams[i]\n promise = promise.then(() =>\n nextStream.pipeTo(writable, { preventClose: true })\n )\n }\n\n // We can omit the length check because we halted before the last stream and there\n // is at least two streams so the lastStream here will always be defined\n const lastStream = streams[i]\n promise = promise.then(() => lastStream.pipeTo(writable))\n\n // Catch any errors from the streams and ignore them, they will be handled\n // by whatever is consuming the readable stream.\n promise.catch(voidCatch)\n\n return readable\n}\n\nexport function streamFromString(str: string): ReadableStream<Uint8Array> {\n return new ReadableStream({\n start(controller) {\n controller.enqueue(encoder.encode(str))\n controller.close()\n },\n })\n}\n\nexport function streamFromBuffer(chunk: Buffer): ReadableStream<Uint8Array> {\n return new ReadableStream({\n start(controller) {\n controller.enqueue(chunk)\n controller.close()\n },\n })\n}\n\nasync function streamToChunks(\n stream: ReadableStream<Uint8Array>\n): Promise<Array<Uint8Array>> {\n const reader = stream.getReader()\n const chunks: Array<Uint8Array> = []\n\n while (true) {\n const { done, value } = await reader.read()\n if (done) {\n break\n }\n\n chunks.push(value)\n }\n\n return chunks\n}\n\nfunction concatUint8Arrays(chunks: Array<Uint8Array>): Uint8Array {\n const totalLength = chunks.reduce((sum, chunk) => sum + chunk.length, 0)\n const result = new Uint8Array(totalLength)\n let offset = 0\n for (const chunk of chunks) {\n result.set(chunk, offset)\n offset += chunk.length\n }\n return result\n}\n\nexport async function streamToUint8Array(\n stream: ReadableStream<Uint8Array>\n): Promise<Uint8Array> {\n return concatUint8Arrays(await streamToChunks(stream))\n}\n\nexport async function streamToBuffer(\n stream: ReadableStream<Uint8Array>\n): Promise<Buffer> {\n return Buffer.concat(await streamToChunks(stream))\n}\n\nexport async function streamToString(\n stream: ReadableStream<Uint8Array>,\n signal?: AbortSignal\n): Promise<string> {\n const decoder = new TextDecoder('utf-8', { fatal: true })\n let string = ''\n\n for await (const chunk of stream) {\n if (signal?.aborted) {\n return string\n }\n\n string += decoder.decode(chunk, { stream: true })\n }\n\n string += decoder.decode()\n\n return string\n}\n\nexport type BufferedTransformOptions = {\n /**\n * Flush synchronously once the buffer reaches this many bytes.\n */\n readonly maxBufferByteLength?: number\n}\n\nexport function createBufferedTransformStream(\n options: BufferedTransformOptions = {}\n): TransformStream<Uint8Array, Uint8Array> {\n const { maxBufferByteLength = Infinity } = options\n\n let bufferedChunks: Array<Uint8Array> = []\n let bufferByteLength: number = 0\n let pending: DetachedPromise<void> | undefined\n\n const flush = (controller: TransformStreamDefaultController) => {\n try {\n if (bufferedChunks.length === 0) {\n return\n }\n\n const chunk = new Uint8Array(bufferByteLength)\n let copiedBytes = 0\n\n for (let i = 0; i < bufferedChunks.length; i++) {\n const bufferedChunk = bufferedChunks[i]\n chunk.set(bufferedChunk, copiedBytes)\n copiedBytes += bufferedChunk.byteLength\n }\n // We just wrote all the buffered chunks so we need to reset the bufferedChunks array\n // and our bufferByteLength to prepare for the next round of buffered chunks\n bufferedChunks.length = 0\n bufferByteLength = 0\n controller.enqueue(chunk)\n } catch {\n // If an error occurs while enqueuing, it can't be due to this\n // transformer. It's most likely caused by the controller having been\n // errored (for example, if the stream was cancelled).\n }\n }\n\n const scheduleFlush = (controller: TransformStreamDefaultController) => {\n if (pending) {\n return\n }\n\n const detached = new DetachedPromise<void>()\n pending = detached\n\n scheduleImmediate(() => {\n try {\n flush(controller)\n } finally {\n pending = undefined\n detached.resolve()\n }\n })\n }\n\n return new TransformStream({\n transform(chunk, controller) {\n // Combine the previous buffer with the new chunk.\n bufferedChunks.push(chunk)\n bufferByteLength += chunk.byteLength\n\n if (bufferByteLength >= maxBufferByteLength) {\n flush(controller)\n } else {\n scheduleFlush(controller)\n }\n },\n flush() {\n return pending?.promise\n },\n })\n}\n\nfunction createPrefetchCommentStream(\n isBuildTimePrerendering: boolean,\n buildId: string\n): TransformStream<Uint8Array, Uint8Array> {\n // Insert an extra comment at the beginning of the HTML document. This must\n // come after the DOCTYPE, which is inserted by React.\n //\n // The first chunk sent by React will contain the doctype. After that, we can\n // pass through the rest of the chunks as-is.\n let didTransformFirstChunk = false\n return new TransformStream({\n transform(chunk, controller) {\n if (isBuildTimePrerendering && !didTransformFirstChunk) {\n didTransformFirstChunk = true\n const decoder = new TextDecoder('utf-8', { fatal: true })\n const chunkStr = decoder.decode(chunk, {\n stream: true,\n })\n const updatedChunkStr = insertBuildIdComment(chunkStr, buildId)\n controller.enqueue(encoder.encode(updatedChunkStr))\n return\n }\n controller.enqueue(chunk)\n },\n })\n}\n\nexport function renderToInitialFizzStream({\n ReactDOMServer,\n element,\n streamOptions,\n}: {\n ReactDOMServer: {\n renderToReadableStream: typeof import('react-dom/server').renderToReadableStream\n }\n element: React.ReactElement\n streamOptions?: Parameters<typeof ReactDOMServer.renderToReadableStream>[1]\n}): Promise<ReactDOMServerReadableStream> {\n return getTracer().trace(AppRenderSpan.renderToReadableStream, async () =>\n ReactDOMServer.renderToReadableStream(element, streamOptions)\n )\n}\n\nfunction createMetadataTransformStream(\n insert: () => Promise<string> | string\n): TransformStream<Uint8Array, Uint8Array> {\n let chunkIndex = -1\n let isMarkRemoved = false\n\n return new TransformStream({\n async transform(chunk, controller) {\n let iconMarkIndex = -1\n let closedHeadIndex = -1\n chunkIndex++\n\n if (isMarkRemoved) {\n controller.enqueue(chunk)\n return\n }\n let iconMarkLength = 0\n // Only search for the closed head tag once\n if (iconMarkIndex === -1) {\n iconMarkIndex = indexOfUint8Array(chunk, ENCODED_TAGS.META.ICON_MARK)\n if (iconMarkIndex === -1) {\n controller.enqueue(chunk)\n return\n } else {\n // When we found the `<meta name=\"«nxt-icon»\"` tag prefix, we will remove it from the chunk.\n // Its close tag could either be `/>` or `>`, checking the next char to ensure we cover both cases.\n iconMarkLength = ENCODED_TAGS.META.ICON_MARK.length\n // Check if next char is /, this is for xml mode.\n if (chunk[iconMarkIndex + iconMarkLength] === 47) {\n iconMarkLength += 2\n } else {\n // The last char is `>`\n iconMarkLength++\n }\n }\n }\n\n // Check if icon mark is inside <head> tag in the first chunk.\n if (chunkIndex === 0) {\n closedHeadIndex = indexOfUint8Array(chunk, ENCODED_TAGS.CLOSED.HEAD)\n if (iconMarkIndex !== -1) {\n // The mark icon is located in the 1st chunk before the head tag.\n // We do not need to insert the script tag in this case because it's in the head.\n // Just remove the icon mark from the chunk.\n if (iconMarkIndex < closedHeadIndex) {\n const replaced = new Uint8Array(chunk.length - iconMarkLength)\n\n // Remove the icon mark from the chunk.\n replaced.set(chunk.subarray(0, iconMarkIndex))\n replaced.set(\n chunk.subarray(iconMarkIndex + iconMarkLength),\n iconMarkIndex\n )\n chunk = replaced\n } else {\n // The icon mark is after the head tag, replace and insert the script tag at that position.\n const insertion = await insert()\n const encodedInsertion = encoder.encode(insertion)\n const insertionLength = encodedInsertion.length\n const replaced = new Uint8Array(\n chunk.length - iconMarkLength + insertionLength\n )\n replaced.set(chunk.subarray(0, iconMarkIndex))\n replaced.set(encodedInsertion, iconMarkIndex)\n replaced.set(\n chunk.subarray(iconMarkIndex + iconMarkLength),\n iconMarkIndex + insertionLength\n )\n chunk = replaced\n }\n isMarkRemoved = true\n }\n // If there's no icon mark located, it will be handled later when if present in the following chunks.\n } else {\n // When it's appeared in the following chunks, we'll need to\n // remove the mark and then insert the script tag at that position.\n const insertion = await insert()\n const encodedInsertion = encoder.encode(insertion)\n const insertionLength = encodedInsertion.length\n // Replace the icon mark with the hoist script or empty string.\n const replaced = new Uint8Array(\n chunk.length - iconMarkLength + insertionLength\n )\n // Set the first part of the chunk, before the icon mark.\n replaced.set(chunk.subarray(0, iconMarkIndex))\n // Set the insertion after the icon mark.\n replaced.set(encodedInsertion, iconMarkIndex)\n\n // Set the rest of the chunk after the icon mark.\n replaced.set(\n chunk.subarray(iconMarkIndex + iconMarkLength),\n iconMarkIndex + insertionLength\n )\n chunk = replaced\n isMarkRemoved = true\n }\n controller.enqueue(chunk)\n },\n })\n}\n\nfunction createHeadInsertionTransformStream(\n insert: () => Promise<string>\n): TransformStream<Uint8Array, Uint8Array> {\n let inserted = false\n\n // We need to track if this transform saw any bytes because if it didn't\n // we won't want to insert any server HTML at all\n let hasBytes = false\n\n return new TransformStream({\n async transform(chunk, controller) {\n hasBytes = true\n\n const insertion = await insert()\n if (inserted) {\n if (insertion) {\n const encodedInsertion = encoder.encode(insertion)\n controller.enqueue(encodedInsertion)\n }\n controller.enqueue(chunk)\n } else {\n // TODO (@Ethan-Arrowood): Replace the generic `indexOfUint8Array` method with something finely tuned for the subset of things actually being checked for.\n const index = indexOfUint8Array(chunk, ENCODED_TAGS.CLOSED.HEAD)\n // In fully static rendering or non PPR rendering cases:\n // `/head>` will always be found in the chunk in first chunk rendering.\n if (index !== -1) {\n if (insertion) {\n const encodedInsertion = encoder.encode(insertion)\n // Get the total count of the bytes in the chunk and the insertion\n // e.g.\n // chunk = <head><meta charset=\"utf-8\"></head>\n // insertion = <script>...</script>\n // output = <head><meta charset=\"utf-8\"> [ <script>...</script> ] </head>\n const insertedHeadContent = new Uint8Array(\n chunk.length + encodedInsertion.length\n )\n // Append the first part of the chunk, before the head tag\n insertedHeadContent.set(chunk.slice(0, index))\n // Append the server inserted content\n insertedHeadContent.set(encodedInsertion, index)\n // Append the rest of the chunk\n insertedHeadContent.set(\n chunk.slice(index),\n index + encodedInsertion.length\n )\n controller.enqueue(insertedHeadContent)\n } else {\n controller.enqueue(chunk)\n }\n inserted = true\n } else {\n // This will happens in PPR rendering during next start, when the page is partially rendered.\n // When the page resumes, the head tag will be found in the middle of the chunk.\n // Where we just need to append the insertion and chunk to the current stream.\n // e.g.\n // PPR-static: <head>...</head><body> [ resume content ] </body>\n // PPR-resume: [ insertion ] [ rest content ]\n if (insertion) {\n controller.enqueue(encoder.encode(insertion))\n }\n controller.enqueue(chunk)\n inserted = true\n }\n }\n },\n async flush(controller) {\n // Check before closing if there's anything remaining to insert.\n if (hasBytes) {\n const insertion = await insert()\n if (insertion) {\n controller.enqueue(encoder.encode(insertion))\n }\n }\n },\n })\n}\n\nfunction createClientResumeScriptInsertionTransformStream(): TransformStream<\n Uint8Array,\n Uint8Array\n> {\n const segmentPath = '/_full'\n const cacheBustingHeader = computeCacheBustingSearchParam(\n '1', // headers[NEXT_ROUTER_PREFETCH_HEADER]\n '/_full', // headers[NEXT_ROUTER_SEGMENT_PREFETCH_HEADER]\n undefined, // headers[NEXT_ROUTER_STATE_TREE_HEADER]\n undefined // headers[NEXT_URL]\n )\n const searchStr = `${NEXT_RSC_UNION_QUERY}=${cacheBustingHeader}`\n const NEXT_CLIENT_RESUME_SCRIPT = `<script>__NEXT_CLIENT_RESUME=fetch(location.pathname+'?${searchStr}',{credentials:'same-origin',headers:{'${RSC_HEADER}': '1','${NEXT_ROUTER_PREFETCH_HEADER}': '1','${NEXT_ROUTER_SEGMENT_PREFETCH_HEADER}': '${segmentPath}'}})</script>`\n\n let didAlreadyInsert = false\n return new TransformStream({\n transform(chunk, controller) {\n if (didAlreadyInsert) {\n // Already inserted the script into the head. Pass through.\n controller.enqueue(chunk)\n return\n }\n // TODO (@Ethan-Arrowood): Replace the generic `indexOfUint8Array` method with something finely tuned for the subset of things actually being checked for.\n const headClosingTagIndex = indexOfUint8Array(\n chunk,\n ENCODED_TAGS.CLOSED.HEAD\n )\n\n if (headClosingTagIndex === -1) {\n // In fully static rendering or non PPR rendering cases:\n // `/head>` will always be found in the chunk in first chunk rendering.\n controller.enqueue(chunk)\n return\n }\n\n const encodedInsertion = encoder.encode(NEXT_CLIENT_RESUME_SCRIPT)\n // Get the total count of the bytes in the chunk and the insertion\n // e.g.\n // chunk = <head><meta charset=\"utf-8\"></head>\n // insertion = <script>...</script>\n // output = <head><meta charset=\"utf-8\"> [ <script>...</script> ] </head>\n const insertedHeadContent = new Uint8Array(\n chunk.length + encodedInsertion.length\n )\n // Append the first part of the chunk, before the head tag\n insertedHeadContent.set(chunk.slice(0, headClosingTagIndex))\n // Append the server inserted content\n insertedHeadContent.set(encodedInsertion, headClosingTagIndex)\n // Append the rest of the chunk\n insertedHeadContent.set(\n chunk.slice(headClosingTagIndex),\n headClosingTagIndex + encodedInsertion.length\n )\n\n controller.enqueue(insertedHeadContent)\n didAlreadyInsert = true\n },\n })\n}\n\n// Suffix after main body content - scripts before </body>,\n// but wait for the major chunks to be enqueued.\nfunction createDeferredSuffixStream(\n suffix: string\n): TransformStream<Uint8Array, Uint8Array> {\n let flushed = false\n let pending: DetachedPromise<void> | undefined\n\n const flush = (controller: TransformStreamDefaultController) => {\n const detached = new DetachedPromise<void>()\n pending = detached\n\n scheduleImmediate(() => {\n try {\n controller.enqueue(encoder.encode(suffix))\n } catch {\n // If an error occurs while enqueuing it can't be due to this\n // transformers fault. It's likely due to the controller being\n // errored due to the stream being cancelled.\n } finally {\n pending = undefined\n detached.resolve()\n }\n })\n }\n\n return new TransformStream({\n transform(chunk, controller) {\n controller.enqueue(chunk)\n\n // If we've already flushed, we're done.\n if (flushed) return\n\n // Schedule the flush to happen.\n flushed = true\n flush(controller)\n },\n flush(controller) {\n if (pending) return pending.promise\n if (flushed) return\n\n // Flush now.\n controller.enqueue(encoder.encode(suffix))\n },\n })\n}\n\nfunction createFlightDataInjectionTransformStream(\n stream: ReadableStream<Uint8Array>,\n delayDataUntilFirstHtmlChunk: boolean\n): TransformStream<Uint8Array, Uint8Array> {\n let htmlStreamFinished = false\n\n let pull: Promise<void> | null = null\n let donePulling = false\n\n function startOrContinuePulling(\n controller: TransformStreamDefaultController\n ) {\n if (!pull) {\n pull = startPulling(controller)\n }\n return pull\n }\n\n async function startPulling(controller: TransformStreamDefaultController) {\n const reader = stream.getReader()\n\n if (delayDataUntilFirstHtmlChunk) {\n // NOTE: streaming flush\n // We are buffering here for the inlined data stream because the\n // \"shell\" stream might be chunkenized again by the underlying stream\n // implementation, e.g. with a specific high-water mark. To ensure it's\n // the safe timing to pipe the data stream, this extra tick is\n // necessary.\n\n // We don't start reading until we've left the current Task to ensure\n // that it's inserted after flushing the shell. Note that this implementation\n // might get stale if impl details of Fizz change in the future.\n await atLeastOneTask()\n }\n\n try {\n while (true) {\n const { done, value } = await reader.read()\n if (done) {\n donePulling = true\n return\n }\n\n // We want to prioritize HTML over RSC data.\n // The SSR render is based on the same RSC stream, so when we get a new RSC chunk,\n // we're likely to produce an HTML chunk as well, so give it a chance to flush first.\n if (!delayDataUntilFirstHtmlChunk && !htmlStreamFinished) {\n await atLeastOneTask()\n }\n controller.enqueue(value)\n }\n } catch (err) {\n controller.error(err)\n }\n }\n\n return new TransformStream({\n start(controller) {\n if (!delayDataUntilFirstHtmlChunk) {\n startOrContinuePulling(controller)\n }\n },\n transform(chunk, controller) {\n controller.enqueue(chunk)\n\n // Start the streaming if it hasn't already been started yet.\n if (delayDataUntilFirstHtmlChunk) {\n startOrContinuePulling(controller)\n }\n },\n flush(controller) {\n htmlStreamFinished = true\n if (donePulling) {\n return\n }\n return startOrContinuePulling(controller)\n },\n })\n}\n\nconst CLOSE_TAG = '</body></html>'\n\n/**\n * This transform stream moves the suffix to the end of the stream, so results\n * like `</body></html><script>...</script>` will be transformed to\n * `<script>...</script></body></html>`.\n */\nfunction createMoveSuffixStream(): TransformStream<Uint8Array, Uint8Array> {\n let foundSuffix = false\n\n return new TransformStream({\n transform(chunk, controller) {\n if (foundSuffix) {\n return controller.enqueue(chunk)\n }\n\n const index = indexOfUint8Array(chunk, ENCODED_TAGS.CLOSED.BODY_AND_HTML)\n if (index > -1) {\n foundSuffix = true\n\n // If the whole chunk is the suffix, then don't write anything, it will\n // be written in the flush.\n if (chunk.length === ENCODED_TAGS.CLOSED.BODY_AND_HTML.length) {\n return\n }\n\n // Write out the part before the suffix.\n const before = chunk.slice(0, index)\n controller.enqueue(before)\n\n // In the case where the suffix is in the middle of the chunk, we need\n // to split the chunk into two parts.\n if (chunk.length > ENCODED_TAGS.CLOSED.BODY_AND_HTML.length + index) {\n // Write out the part after the suffix.\n const after = chunk.slice(\n index + ENCODED_TAGS.CLOSED.BODY_AND_HTML.length\n )\n controller.enqueue(after)\n }\n } else {\n controller.enqueue(chunk)\n }\n },\n flush(controller) {\n // Even if we didn't find the suffix, the HTML is not valid if we don't\n // add it, so insert it at the end.\n controller.enqueue(ENCODED_TAGS.CLOSED.BODY_AND_HTML)\n },\n })\n}\n\nfunction createStripDocumentClosingTagsTransform(): TransformStream<\n Uint8Array,\n Uint8Array\n> {\n return new TransformStream({\n transform(chunk, controller) {\n // We rely on the assumption that chunks will never break across a code unit.\n // This is reasonable because we currently concat all of React's output from a single\n // flush into one chunk before streaming it forward which means the chunk will represent\n // a single coherent utf-8 string. This is not safe to use if we change our streaming to no\n // longer do this large buffered chunk\n if (\n isEquivalentUint8Arrays(chunk, ENCODED_TAGS.CLOSED.BODY_AND_HTML) ||\n isEquivalentUint8Arrays(chunk, ENCODED_TAGS.CLOSED.BODY) ||\n isEquivalentUint8Arrays(chunk, ENCODED_TAGS.CLOSED.HTML)\n ) {\n // the entire chunk is the closing tags; return without enqueueing anything.\n return\n }\n\n // We assume these tags will go at together at the end of the document and that\n // they won't appear anywhere else in the document. This is not really a safe assumption\n // but until we revamp our streaming infra this is a performant way to string the tags\n chunk = removeFromUint8Array(chunk, ENCODED_TAGS.CLOSED.BODY)\n chunk = removeFromUint8Array(chunk, ENCODED_TAGS.CLOSED.HTML)\n\n controller.enqueue(chunk)\n },\n })\n}\n\n/*\n * Checks if the root layout is missing the html or body tags\n * and if so, it will inject a script tag to throw an error in the browser, showing the user\n * the error message in the error overlay.\n */\nexport function createRootLayoutValidatorStream(): TransformStream<\n Uint8Array,\n Uint8Array\n> {\n let foundHtml = false\n let foundBody = false\n return new TransformStream({\n async transform(chunk, controller) {\n // Peek into the streamed chunk to see if the tags are present.\n if (\n !foundHtml &&\n indexOfUint8Array(chunk, ENCODED_TAGS.OPENING.HTML) > -1\n ) {\n foundHtml = true\n }\n\n if (\n !foundBody &&\n indexOfUint8Array(chunk, ENCODED_TAGS.OPENING.BODY) > -1\n ) {\n foundBody = true\n }\n\n controller.enqueue(chunk)\n },\n flush(controller) {\n const missingTags: ('html' | 'body')[] = []\n if (!foundHtml) missingTags.push('html')\n if (!foundBody) missingTags.push('body')\n\n if (!missingTags.length) return\n\n controller.enqueue(\n encoder.encode(\n `<html id=\"__next_error__\">\n <template\n data-next-error-message=\"Missing ${missingTags\n .map((c) => `<${c}>`)\n .join(\n missingTags.length > 1 ? ' and ' : ''\n )} tags in the root layout.\\nRead more at https://nextjs.org/docs/messages/missing-root-layout-tags\"\n data-next-error-digest=\"${MISSING_ROOT_TAGS_ERROR}\"\n data-next-error-stack=\"\"\n ></template>\n `\n )\n )\n },\n })\n}\n\nfunction chainTransformers<T>(\n readable: ReadableStream<T>,\n transformers: ReadonlyArray<TransformStream<T, T> | null>\n): ReadableStream<T> {\n let stream = readable\n for (const transformer of transformers) {\n if (!transformer) continue\n\n stream = stream.pipeThrough(transformer)\n }\n return stream\n}\n\nexport type ContinueStreamOptions = {\n inlinedDataStream: ReadableStream<Uint8Array> | undefined\n isStaticGeneration: boolean\n isBuildTimePrerendering: boolean\n buildId: string\n getServerInsertedHTML: () => Promise<string>\n getServerInsertedMetadata: () => Promise<string>\n validateRootLayout?: boolean\n /**\n * Suffix to inject after the buffered data, but before the close tags.\n */\n suffix?: string | undefined\n}\n\nexport async function continueFizzStream(\n renderStream: ReactDOMServerReadableStream,\n {\n suffix,\n inlinedDataStream,\n isStaticGeneration,\n isBuildTimePrerendering,\n buildId,\n getServerInsertedHTML,\n getServerInsertedMetadata,\n validateRootLayout,\n }: ContinueStreamOptions\n): Promise<ReadableStream<Uint8Array>> {\n // Suffix itself might contain close tags at the end, so we need to split it.\n const suffixUnclosed = suffix ? suffix.split(CLOSE_TAG, 1)[0] : null\n\n if (isStaticGeneration) {\n // If we're generating static HTML we need to wait for it to resolve before continuing.\n await renderStream.allReady\n } else {\n // Otherwise, we want to make sure Fizz is done with all microtasky work\n // before we start pulling the stream and cause a flush.\n await waitAtLeastOneReactRenderTask()\n }\n\n return chainTransformers(renderStream, [\n // Buffer everything to avoid flushing too frequently\n createBufferedTransformStream(),\n\n // Add build id comment to start of the HTML document (in export mode)\n createPrefetchCommentStream(isBuildTimePrerendering, buildId),\n\n // Transform metadata\n createMetadataTransformStream(getServerInsertedMetadata),\n\n // Insert suffix content\n suffixUnclosed != null && suffixUnclosed.length > 0\n ? createDeferredSuffixStream(suffixUnclosed)\n : null,\n\n // Insert the inlined data (Flight data, form state, etc.) stream into the HTML\n inlinedDataStream\n ? createFlightDataInjectionTransformStream(inlinedDataStream, true)\n : null,\n\n // Validate the root layout for missing html or body tags\n validateRootLayout ? createRootLayoutValidatorStream() : null,\n\n // Close tags should always be deferred to the end\n createMoveSuffixStream(),\n\n // Special head insertions\n // TODO-APP: Insert server side html to end of head in app layout rendering, to avoid\n // hydration errors. Remove this once it's ready to be handled by react itself.\n createHeadInsertionTransformStream(getServerInsertedHTML),\n ])\n}\n\ntype ContinueDynamicPrerenderOptions = {\n getServerInsertedHTML: () => Promise<string>\n getServerInsertedMetadata: () => Promise<string>\n}\n\nexport async function continueDynamicPrerender(\n prerenderStream: ReadableStream<Uint8Array>,\n {\n getServerInsertedHTML,\n getServerInsertedMetadata,\n }: ContinueDynamicPrerenderOptions\n) {\n return (\n prerenderStream\n // Buffer everything to avoid flushing too frequently\n .pipeThrough(createBufferedTransformStream())\n .pipeThrough(createStripDocumentClosingTagsTransform())\n // Insert generated tags to head\n .pipeThrough(createHeadInsertionTransformStream(getServerInsertedHTML))\n // Transform metadata\n .pipeThrough(createMetadataTransformStream(getServerInsertedMetadata))\n )\n}\n\ntype ContinueStaticPrerenderOptions = {\n inlinedDataStream: ReadableStream<Uint8Array>\n getServerInsertedHTML: () => Promise<string>\n getServerInsertedMetadata: () => Promise<string>\n isBuildTimePrerendering: boolean\n buildId: string\n}\n\nexport async function continueStaticPrerender(\n prerenderStream: ReadableStream<Uint8Array>,\n {\n inlinedDataStream,\n getServerInsertedHTML,\n getServerInsertedMetadata,\n isBuildTimePrerendering,\n buildId,\n }: ContinueStaticPrerenderOptions\n) {\n return (\n prerenderStream\n // Buffer everything to avoid flushing too frequently\n .pipeThrough(createBufferedTransformStream())\n // Add build id comment to start of the HTML document (in export mode)\n .pipeThrough(\n createPrefetchCommentStream(isBuildTimePrerendering, buildId)\n )\n // Insert generated tags to head\n .pipeThrough(createHeadInsertionTransformStream(getServerInsertedHTML))\n // Transform metadata\n .pipeThrough(createMetadataTransformStream(getServerInsertedMetadata))\n // Insert the inlined data (Flight data, form state, etc.) stream into the HTML\n .pipeThrough(\n createFlightDataInjectionTransformStream(inlinedDataStream, true)\n )\n // Close tags should always be deferred to the end\n .pipeThrough(createMoveSuffixStream())\n )\n}\n\nexport async function continueStaticFallbackPrerender(\n prerenderStream: ReadableStream<Uint8Array>,\n {\n inlinedDataStream,\n getServerInsertedHTML,\n getServerInsertedMetadata,\n isBuildTimePrerendering,\n buildId,\n }: ContinueStaticPrerenderOptions\n) {\n // Same as `continueStaticPrerender`, but also inserts an additional script\n // to instruct the client to start fetching the hydration data as early\n // as possible.\n return (\n prerenderStream\n // Buffer everything to avoid flushing too frequently\n .pipeThrough(createBufferedTransformStream())\n // Add build id comment to start of the HTML document (in export mode)\n .pipeThrough(\n createPrefetchCommentStream(isBuildTimePrerendering, buildId)\n )\n // Insert generated tags to head\n .pipeThrough(createHeadInsertionTransformStream(getServerInsertedHTML))\n // Insert the client resume script into the head\n .pipeThrough(createClientResumeScriptInsertionTransformStream())\n // Transform metadata\n .pipeThrough(createMetadataTransformStream(getServerInsertedMetadata))\n // Insert the inlined data (Flight data, form state, etc.) stream into the HTML\n .pipeThrough(\n createFlightDataInjectionTransformStream(inlinedDataStream, true)\n )\n // Close tags should always be deferred to the end\n .pipeThrough(createMoveSuffixStream())\n )\n}\n\ntype ContinueResumeOptions = {\n inlinedDataStream: ReadableStream<Uint8Array>\n getServerInsertedHTML: () => Promise<string>\n getServerInsertedMetadata: () => Promise<string>\n delayDataUntilFirstHtmlChunk: boolean\n}\n\nexport async function continueDynamicHTMLResume(\n renderStream: ReadableStream<Uint8Array>,\n {\n delayDataUntilFirstHtmlChunk,\n inlinedDataStream,\n getServerInsertedHTML,\n getServerInsertedMetadata,\n }: ContinueResumeOptions\n) {\n return (\n renderStream\n // Buffer everything to avoid flushing too frequently\n .pipeThrough(createBufferedTransformStream())\n // Insert generated tags to head\n .pipeThrough(createHeadInsertionTransformStream(getServerInsertedHTML))\n // Transform metadata\n .pipeThrough(createMetadataTransformStream(getServerInsertedMetadata))\n // Insert the inlined data (Flight data, form state, etc.) stream into the HTML\n .pipeThrough(\n createFlightDataInjectionTransformStream(\n inlinedDataStream,\n delayDataUntilFirstHtmlChunk\n )\n )\n // Close tags should always be deferred to the end\n .pipeThrough(createMoveSuffixStream())\n )\n}\n\nexport function createDocumentClosingStream(): ReadableStream<Uint8Array> {\n return streamFromString(CLOSE_TAG)\n}\n","import type { IncomingMessage } from 'http'\nimport type { ParsedUrlQuery } from 'querystring'\nimport type { UrlWithParsedQuery } from 'url'\nimport type { BaseNextRequest } from './base-http'\nimport type { CloneableBody } from './body-streams'\nimport type { RouteMatch } from './route-matches/route-match'\nimport type { NEXT_RSC_UNION_QUERY } from '../client/components/app-router-headers'\nimport type {\n ResponseCacheEntry,\n ServerComponentsHmrCache,\n} from './response-cache'\nimport type { PagesDevOverlayBridgeType } from '../next-devtools/userspace/pages/pages-dev-overlay-setup'\nimport type { OpaqueFallbackRouteParams } from './request/fallback-params'\nimport type { IncrementalCache } from './lib/incremental-cache'\n\n// FIXME: (wyattjoh) this is a temporary solution to allow us to pass data between bundled modules\nexport const NEXT_REQUEST_META = Symbol.for('NextInternalRequestMeta')\n\nexport type NextIncomingMessage = (BaseNextRequest | IncomingMessage) & {\n [NEXT_REQUEST_META]?: RequestMeta\n}\n\n/**\n * The callback function to call when a response cache entry was generated or\n * looked up in the cache. When it returns true, the server assumes that the\n * handler has already responded to the request and will not do so itself.\n */\nexport type OnCacheEntryHandler = (\n /**\n * The response cache entry that was generated or looked up in the cache.\n */\n cacheEntry: ResponseCacheEntry,\n\n /**\n * The request metadata.\n */\n requestMeta: {\n /**\n * The URL that was used to make the request.\n */\n url: string | undefined\n }\n) => Promise<boolean | void> | boolean | void\n\nexport interface RequestMeta {\n /**\n * The query that was used to make the request.\n */\n initQuery?: ParsedUrlQuery\n\n /**\n * The URL that was used to make the request.\n */\n initURL?: string\n\n /**\n * The protocol that was used to make the request.\n */\n initProtocol?: string\n\n /**\n * The body that was read from the request. This is used to allow the body to\n * be read multiple times.\n */\n clonableBody?: CloneableBody\n\n /**\n * True when the request matched a locale domain that was configured in the\n * next.config.js file.\n */\n isLocaleDomain?: boolean\n\n /**\n * True when the request had locale information stripped from the pathname\n * part of the URL.\n */\n didStripLocale?: boolean\n\n /**\n * If the request had it's URL rewritten, this is the URL it was rewritten to.\n */\n rewroteURL?: string\n\n /**\n * The cookies that were added by middleware and were added to the response.\n */\n middlewareCookie?: string[]\n\n /**\n * The match on the request for a given route.\n */\n match?: RouteMatch\n\n /**\n * The incremental cache to use for the request.\n */\n incrementalCache?: IncrementalCache\n\n /**\n * The server components HMR cache, only for dev.\n */\n serverComponentsHmrCache?: ServerComponentsHmrCache\n\n /**\n * Equals the segment path that was used for the prefetch RSC request.\n */\n segmentPrefetchRSCRequest?: string\n\n /**\n * True when the request is for the prefetch flight data.\n */\n isPrefetchRSCRequest?: true\n\n /**\n * True when the request is for the flight data.\n */\n isRSCRequest?: true\n\n /**\n * A search param set by the Next.js client when performing RSC requests.\n * Because some CDNs do not vary their cache entries on our custom headers,\n * this search param represents a hash of the header values. For any cached\n * RSC request, we should verify that the hash matches before responding.\n * Otherwise this can lead to cache poisoning.\n * TODO: Consider not using custom request headers at all, and instead encode\n * everything into the search param.\n */\n cacheBustingSearchParam?: string\n\n /**\n * True when the request is for the `/_next/data` route using the pages\n * router.\n */\n isNextDataReq?: true\n\n /**\n * Postponed state to use for resumption. If present it's assumed that the\n * request is for a page that has postponed (there are no guarantees that the\n * page actually has postponed though as it would incur an additional cache\n * lookup).\n */\n postponed?: string\n\n /**\n * If provided, this will be called when a response cache entry was generated\n * or looked up in the cache.\n *\n * @deprecated Use `onCacheEntryV2` instead.\n */\n onCacheEntry?: OnCacheEntryHandler\n\n /**\n * If provided, this will be called when a response cache entry was generated\n * or looked up in the cache.\n */\n onCacheEntryV2?: OnCacheEntryHandler\n\n /**\n * The previous revalidate before rendering 404 page for notFound: true\n */\n notFoundRevalidate?: number | false\n\n /**\n * In development, the original source page that returned a 404.\n */\n developmentNotFoundSourcePage?: string\n\n /**\n * The path we routed to and should be invoked\n */\n invokePath?: string\n\n /**\n * The specific page output we should be matching\n */\n invokeOutput?: string\n\n /**\n * The status we are invoking the request with from routing\n */\n invokeStatus?: number\n\n /**\n * The routing error we are invoking with\n */\n invokeError?: Error\n\n /**\n * The query parsed for the invocation\n */\n invokeQuery?: Record<string, undefined | string | string[]>\n\n /**\n * Whether the request is a middleware invocation\n */\n middlewareInvoke?: boolean\n\n /**\n * Whether the request should render the fallback shell or not.\n */\n renderFallbackShell?: boolean\n\n /**\n * Whether the request is for the custom error page.\n */\n customErrorRender?: true\n\n /**\n * Whether to bubble up the NoFallbackError to the caller when a 404 is\n * returned.\n */\n bubbleNoFallback?: true\n\n /**\n * True when the request had locale information inferred from the default\n * locale.\n */\n localeInferredFromDefault?: true\n\n /**\n * The locale that was inferred or explicitly set for the request.\n */\n locale?: string\n\n /**\n * The default locale that was inferred or explicitly set for the request.\n */\n defaultLocale?: string\n\n /**\n * The relative project dir the server is running in from project root\n */\n relativeProjectDir?: string\n\n /**\n * The dist directory the server is currently using\n */\n distDir?: string\n\n /**\n * The query after resolving routes\n */\n query?: ParsedUrlQuery\n\n /**\n * The params after resolving routes\n */\n params?: ParsedUrlQuery\n\n /**\n * ErrorOverlay component to use in development for pages router\n */\n PagesErrorDebug?: PagesDevOverlayBridgeType\n\n /**\n * Whether server is in minimal mode (this will be replaced with more\n * specific flags in future)\n */\n minimalMode?: boolean\n\n /**\n * DEV only: The fallback params that should be used when validating prerenders during dev\n */\n devFallbackParams?: OpaqueFallbackRouteParams\n\n /**\n * DEV only: Request timings in process.hrtime.bigint()\n */\n devRequestTimingStart?: bigint\n devRequestTimingMiddlewareStart?: bigint\n devRequestTimingMiddlewareEnd?: bigint\n devRequestTimingInternalsEnd?: bigint\n\n /**\n * DEV only: The duration of getStaticPaths/generateStaticParams in process.hrtime.bigint()\n */\n devGenerateStaticParamsDuration?: bigint\n}\n\n/**\n * Gets the request metadata. If no key is provided, the entire metadata object\n * is returned.\n *\n * @param req the request to get the metadata from\n * @param key the key to get from the metadata (optional)\n * @returns the value for the key or the entire metadata object\n */\nexport function getRequestMeta(\n req: NextIncomingMessage,\n key?: undefined\n): RequestMeta\nexport function getRequestMeta<K extends keyof RequestMeta>(\n req: NextIncomingMessage,\n key: K\n): RequestMeta[K]\nexport function getRequestMeta<K extends keyof RequestMeta>(\n req: NextIncomingMessage,\n key?: K\n): RequestMeta | RequestMeta[K] {\n const meta = req[NEXT_REQUEST_META] || {}\n return typeof key === 'string' ? meta[key] : meta\n}\n\n/**\n * Sets the request metadata.\n *\n * @param req the request to set the metadata on\n * @param meta the metadata to set\n * @returns the mutated request metadata\n */\nexport function setRequestMeta(req: NextIncomingMessage, meta: RequestMeta) {\n req[NEXT_REQUEST_META] = meta\n return meta\n}\n\n/**\n * Adds a value to the request metadata.\n *\n * @param request the request to mutate\n * @param key the key to set\n * @param value the value to set\n * @returns the mutated request metadata\n */\nexport function addRequestMeta<K extends keyof RequestMeta>(\n request: NextIncomingMessage,\n key: K,\n value: RequestMeta[K]\n) {\n const meta = getRequestMeta(request)\n meta[key] = value\n return setRequestMeta(request, meta)\n}\n\n/**\n * Removes a key from the request metadata.\n *\n * @param request the request to mutate\n * @param key the key to remove\n * @returns the mutated request metadata\n */\nexport function removeRequestMeta<K extends keyof RequestMeta>(\n request: NextIncomingMessage,\n key: K\n) {\n const meta = getRequestMeta(request)\n delete meta[key]\n return setRequestMeta(request, meta)\n}\n\ntype NextQueryMetadata = {\n /**\n * The `_rsc` query parameter used for cache busting to ensure that the RSC\n * requests do not get cached by the browser explicitly.\n */\n [NEXT_RSC_UNION_QUERY]?: string\n}\n\nexport type NextParsedUrlQuery = ParsedUrlQuery & NextQueryMetadata\n\nexport interface NextUrlWithParsedQuery extends UrlWithParsedQuery {\n query: NextParsedUrlQuery\n}\n","import type { OutgoingHttpHeaders } from 'http'\nimport {\n NEXT_INTERCEPTION_MARKER_PREFIX,\n NEXT_QUERY_PARAM_PREFIX,\n} from '../../lib/constants'\n\n/**\n * Converts a Node.js IncomingHttpHeaders object to a Headers object. Any\n * headers with multiple values will be joined with a comma and space. Any\n * headers that have an undefined value will be ignored and others will be\n * coerced to strings.\n *\n * @param nodeHeaders the headers object to convert\n * @returns the converted headers object\n */\nexport function fromNodeOutgoingHttpHeaders(\n nodeHeaders: OutgoingHttpHeaders\n): Headers {\n const headers = new Headers()\n for (let [key, value] of Object.entries(nodeHeaders)) {\n const values = Array.isArray(value) ? value : [value]\n for (let v of values) {\n if (typeof v === 'undefined') continue\n if (typeof v === 'number') {\n v = v.toString()\n }\n\n headers.append(key, v)\n }\n }\n return headers\n}\n\n/*\n Set-Cookie header field-values are sometimes comma joined in one string. This splits them without choking on commas\n that are within a single set-cookie field-value, such as in the Expires portion.\n This is uncommon, but explicitly allowed - see https://tools.ietf.org/html/rfc2616#section-4.2\n Node.js does this for every header *except* set-cookie - see https://github.com/nodejs/node/blob/d5e363b77ebaf1caf67cd7528224b651c86815c1/lib/_http_incoming.js#L128\n React Native's fetch does this for *every* header, including set-cookie.\n \n Based on: https://github.com/google/j2objc/commit/16820fdbc8f76ca0c33472810ce0cb03d20efe25\n Credits to: https://github.com/tomball for original and https://github.com/chrusart for JavaScript implementation\n*/\nexport function splitCookiesString(cookiesString: string) {\n var cookiesStrings = []\n var pos = 0\n var start\n var ch\n var lastComma\n var nextStart\n var cookiesSeparatorFound\n\n function skipWhitespace() {\n while (pos < cookiesString.length && /\\s/.test(cookiesString.charAt(pos))) {\n pos += 1\n }\n return pos < cookiesString.length\n }\n\n function notSpecialChar() {\n ch = cookiesString.charAt(pos)\n\n return ch !== '=' && ch !== ';' && ch !== ','\n }\n\n while (pos < cookiesString.length) {\n start = pos\n cookiesSeparatorFound = false\n\n while (skipWhitespace()) {\n ch = cookiesString.charAt(pos)\n if (ch === ',') {\n // ',' is a cookie separator if we have later first '=', not ';' or ','\n lastComma = pos\n pos += 1\n\n skipWhitespace()\n nextStart = pos\n\n while (pos < cookiesString.length && notSpecialChar()) {\n pos += 1\n }\n\n // currently special character\n if (pos < cookiesString.length && cookiesString.charAt(pos) === '=') {\n // we found cookies separator\n cookiesSeparatorFound = true\n // pos is inside the next cookie, so back up and return it.\n pos = nextStart\n cookiesStrings.push(cookiesString.substring(start, lastComma))\n start = pos\n } else {\n // in param ',' or param separator ';',\n // we continue from that comma\n pos = lastComma + 1\n }\n } else {\n pos += 1\n }\n }\n\n if (!cookiesSeparatorFound || pos >= cookiesString.length) {\n cookiesStrings.push(cookiesString.substring(start, cookiesString.length))\n }\n }\n\n return cookiesStrings\n}\n\n/**\n * Converts a Headers object to a Node.js OutgoingHttpHeaders object. This is\n * required to support the set-cookie header, which may have multiple values.\n *\n * @param headers the headers object to convert\n * @returns the converted headers object\n */\nexport function toNodeOutgoingHttpHeaders(\n headers: Headers\n): OutgoingHttpHeaders {\n const nodeHeaders: OutgoingHttpHeaders = {}\n const cookies: string[] = []\n if (headers) {\n for (const [key, value] of headers.entries()) {\n if (key.toLowerCase() === 'set-cookie') {\n // We may have gotten a comma joined string of cookies, or multiple\n // set-cookie headers. We need to merge them into one header array\n // to represent all the cookies.\n cookies.push(...splitCookiesString(value))\n nodeHeaders[key] = cookies.length === 1 ? cookies[0] : cookies\n } else {\n nodeHeaders[key] = value\n }\n }\n }\n return nodeHeaders\n}\n\n/**\n * Validate the correctness of a user-provided URL.\n */\nexport function validateURL(url: string | URL): string {\n try {\n return String(new URL(String(url)))\n } catch (error: any) {\n throw new Error(\n `URL is malformed \"${String(\n url\n )}\". Please use only absolute URLs - https://nextjs.org/docs/messages/middleware-relative-urls`,\n { cause: error }\n )\n }\n}\n\n/**\n * Normalizes `nxtP` and `nxtI` query param values to remove the prefix.\n * This function does not mutate the input key.\n */\nexport function normalizeNextQueryParam(key: string): null | string {\n const prefixes = [NEXT_QUERY_PARAM_PREFIX, NEXT_INTERCEPTION_MARKER_PREFIX]\n for (const prefix of prefixes) {\n if (key !== prefix && key.startsWith(prefix)) {\n return key.substring(prefix.length)\n }\n }\n return null\n}\n","import type { DomainLocale } from '../../../server/config-shared'\n\nexport function detectDomainLocale(\n domainItems?: readonly DomainLocale[],\n hostname?: string,\n detectedLocale?: string\n) {\n if (!domainItems) return\n\n if (detectedLocale) {\n detectedLocale = detectedLocale.toLowerCase()\n }\n\n for (const item of domainItems) {\n // remove port if present\n const domainHostname = item.domain?.split(':', 1)[0].toLowerCase()\n if (\n hostname === domainHostname ||\n detectedLocale === item.defaultLocale.toLowerCase() ||\n item.locales?.some((locale) => locale.toLowerCase() === detectedLocale)\n ) {\n return item\n }\n }\n}\n","/**\n * Removes the trailing slash for a given route or page path. Preserves the\n * root page. Examples:\n * - `/foo/bar/` -> `/foo/bar`\n * - `/foo/bar` -> `/foo/bar`\n * - `/` -> `/`\n */\nexport function removeTrailingSlash(route: string) {\n return route.replace(/\\/$/, '') || '/'\n}\n","/**\n * Given a path this function will find the pathname, query and hash and return\n * them. This is useful to parse full paths on the client side.\n * @param path A path to parse e.g. /foo/bar?id=1#hash\n */\nexport function parsePath(path: string) {\n const hashIndex = path.indexOf('#')\n const queryIndex = path.indexOf('?')\n const hasQuery = queryIndex > -1 && (hashIndex < 0 || queryIndex < hashIndex)\n\n if (hasQuery || hashIndex > -1) {\n return {\n pathname: path.substring(0, hasQuery ? queryIndex : hashIndex),\n query: hasQuery\n ? path.substring(queryIndex, hashIndex > -1 ? hashIndex : undefined)\n : '',\n hash: hashIndex > -1 ? path.slice(hashIndex) : '',\n }\n }\n\n return { pathname: path, query: '', hash: '' }\n}\n","import { parsePath } from './parse-path'\n\n/**\n * Adds the provided prefix to the given path. It first ensures that the path\n * is indeed starting with a slash.\n */\nexport function addPathPrefix(path: string, prefix?: string) {\n if (!path.startsWith('/') || !prefix) {\n return path\n }\n\n const { pathname, query, hash } = parsePath(path)\n return `${prefix}${pathname}${query}${hash}`\n}\n","import { parsePath } from './parse-path'\n\n/**\n * Similarly to `addPathPrefix`, this function adds a suffix at the end on the\n * provided path. It also works only for paths ensuring the argument starts\n * with a slash.\n */\nexport function addPathSuffix(path: string, suffix?: string) {\n if (!path.startsWith('/') || !suffix) {\n return path\n }\n\n const { pathname, query, hash } = parsePath(path)\n return `${pathname}${suffix}${query}${hash}`\n}\n","import { parsePath } from './parse-path'\n\n/**\n * Checks if a given path starts with a given prefix. It ensures it matches\n * exactly without containing extra chars. e.g. prefix /docs should replace\n * for /docs, /docs/, /docs/a but not /docsss\n * @param path The path to check.\n * @param prefix The prefix to check against.\n */\nexport function pathHasPrefix(path: string, prefix: string) {\n if (typeof path !== 'string') {\n return false\n }\n\n const { pathname } = parsePath(path)\n return pathname === prefix || pathname.startsWith(prefix + '/')\n}\n","import { addPathPrefix } from './add-path-prefix'\nimport { pathHasPrefix } from './path-has-prefix'\n\n/**\n * For a given path and a locale, if the locale is given, it will prefix the\n * locale. The path shouldn't be an API path. If a default locale is given the\n * prefix will be omitted if the locale is already the default locale.\n */\nexport function addLocale(\n path: string,\n locale?: string | false,\n defaultLocale?: string,\n ignorePrefix?: boolean\n) {\n // If no locale was given or the locale is the default locale, we don't need\n // to prefix the path.\n if (!locale || locale === defaultLocale) return path\n\n const lower = path.toLowerCase()\n\n // If the path is an API path or the path already has the locale prefix, we\n // don't need to prefix the path.\n if (!ignorePrefix) {\n if (pathHasPrefix(lower, '/api')) return path\n if (pathHasPrefix(lower, `/${locale.toLowerCase()}`)) return path\n }\n\n // Add the locale prefix to the path.\n return addPathPrefix(path, `/${locale}`)\n}\n","import type { NextPathnameInfo } from './get-next-pathname-info'\nimport { removeTrailingSlash } from './remove-trailing-slash'\nimport { addPathPrefix } from './add-path-prefix'\nimport { addPathSuffix } from './add-path-suffix'\nimport { addLocale } from './add-locale'\n\ninterface ExtendedInfo extends NextPathnameInfo {\n defaultLocale?: string\n ignorePrefix?: boolean\n}\n\nexport function formatNextPathnameInfo(info: ExtendedInfo) {\n let pathname = addLocale(\n info.pathname,\n info.locale,\n info.buildId ? undefined : info.defaultLocale,\n info.ignorePrefix\n )\n\n if (info.buildId || !info.trailingSlash) {\n pathname = removeTrailingSlash(pathname)\n }\n\n if (info.buildId) {\n pathname = addPathSuffix(\n addPathPrefix(pathname, `/_next/data/${info.buildId}`),\n info.pathname === '/' ? 'index.json' : '.json'\n )\n }\n\n pathname = addPathPrefix(pathname, info.basePath)\n return !info.buildId && info.trailingSlash\n ? !pathname.endsWith('/')\n ? addPathSuffix(pathname, '/')\n : pathname\n : removeTrailingSlash(pathname)\n}\n","import type { OutgoingHttpHeaders } from 'http'\n\n/**\n * Takes an object with a hostname property (like a parsed URL) and some\n * headers that may contain Host and returns the preferred hostname.\n * @param parsed An object containing a hostname property.\n * @param headers A dictionary with headers containing a `host`.\n */\nexport function getHostname(\n parsed: { hostname?: string | null },\n headers?: OutgoingHttpHeaders\n): string | undefined {\n // Get the hostname from the headers if it exists, otherwise use the parsed\n // hostname.\n let hostname: string\n if (headers?.host && !Array.isArray(headers.host)) {\n hostname = headers.host.toString().split(':', 1)[0]\n } else if (parsed.hostname) {\n hostname = parsed.hostname\n } else return\n\n return hostname.toLowerCase()\n}\n","export interface PathLocale {\n detectedLocale?: string\n pathname: string\n}\n\n/**\n * A cache of lowercased locales for each list of locales. This is stored as a\n * WeakMap so if the locales are garbage collected, the cache entry will be\n * removed as well.\n */\nconst cache = new WeakMap<readonly string[], readonly string[]>()\n\n/**\n * For a pathname that may include a locale from a list of locales, it\n * removes the locale from the pathname returning it alongside with the\n * detected locale.\n *\n * @param pathname A pathname that may include a locale.\n * @param locales A list of locales.\n * @returns The detected locale and pathname without locale\n */\nexport function normalizeLocalePath(\n pathname: string,\n locales?: readonly string[]\n): PathLocale {\n // If locales is undefined, return the pathname as is.\n if (!locales) return { pathname }\n\n // Get the cached lowercased locales or create a new cache entry.\n let lowercasedLocales = cache.get(locales)\n if (!lowercasedLocales) {\n lowercasedLocales = locales.map((locale) => locale.toLowerCase())\n cache.set(locales, lowercasedLocales)\n }\n\n let detectedLocale: string | undefined\n\n // The first segment will be empty, because it has a leading `/`. If\n // there is no further segment, there is no locale (or it's the default).\n const segments = pathname.split('/', 2)\n\n // If there's no second segment (ie, the pathname is just `/`), there's no\n // locale.\n if (!segments[1]) return { pathname }\n\n // The second segment will contain the locale part if any.\n const segment = segments[1].toLowerCase()\n\n // See if the segment matches one of the locales. If it doesn't, there is\n // no locale (or it's the default).\n const index = lowercasedLocales.indexOf(segment)\n if (index < 0) return { pathname }\n\n // Return the case-sensitive locale.\n detectedLocale = locales[index]\n\n // Remove the `/${locale}` part of the pathname.\n pathname = pathname.slice(detectedLocale.length + 1) || '/'\n\n return { pathname, detectedLocale }\n}\n","import { pathHasPrefix } from './path-has-prefix'\n\n/**\n * Given a path and a prefix it will remove the prefix when it exists in the\n * given path. It ensures it matches exactly without containing extra chars\n * and if the prefix is not there it will be noop.\n *\n * @param path The path to remove the prefix from.\n * @param prefix The prefix to be removed.\n */\nexport function removePathPrefix(path: string, prefix: string): string {\n // If the path doesn't start with the prefix we can return it as is. This\n // protects us from situations where the prefix is a substring of the path\n // prefix such as:\n //\n // For prefix: /blog\n //\n // /blog -> true\n // /blog/ -> true\n // /blog/1 -> true\n // /blogging -> false\n // /blogging/ -> false\n // /blogging/1 -> false\n if (!pathHasPrefix(path, prefix)) {\n return path\n }\n\n // Remove the prefix from the path via slicing.\n const withoutPrefix = path.slice(prefix.length)\n\n // If the path without the prefix starts with a `/` we can return it as is.\n if (withoutPrefix.startsWith('/')) {\n return withoutPrefix\n }\n\n // If the path without the prefix doesn't start with a `/` we need to add it\n // back to the path to make sure it's a valid path.\n return `/${withoutPrefix}`\n}\n","import { normalizeLocalePath } from '../../i18n/normalize-locale-path'\nimport { removePathPrefix } from './remove-path-prefix'\nimport { pathHasPrefix } from './path-has-prefix'\nimport type { I18NProvider } from '../../../../server/lib/i18n-provider'\n\nexport interface NextPathnameInfo {\n /**\n * The base path in case the pathname included it.\n */\n basePath?: string\n /**\n * The buildId for when the parsed URL is a data URL. Parsing it can be\n * disabled with the `parseData` option.\n */\n buildId?: string\n /**\n * If there was a locale in the pathname, this will hold its value.\n */\n locale?: string\n /**\n * The processed pathname without a base path, locale, or data URL elements\n * when parsing it is enabled.\n */\n pathname: string\n /**\n * A boolean telling if the pathname had a trailingSlash. This can be only\n * true if trailingSlash is enabled.\n */\n trailingSlash?: boolean\n}\n\ninterface Options {\n /**\n * When passed to true, this function will also parse Nextjs data URLs.\n */\n parseData?: boolean\n /**\n * A partial of the Next.js configuration to parse the URL.\n */\n nextConfig?: {\n basePath?: string\n i18n?: { locales?: readonly string[] } | null\n trailingSlash?: boolean\n }\n\n /**\n * If provided, this normalizer will be used to detect the locale instead of\n * the default locale detection.\n */\n i18nProvider?: I18NProvider\n}\n\nexport function getNextPathnameInfo(\n pathname: string,\n options: Options\n): NextPathnameInfo {\n const { basePath, i18n, trailingSlash } = options.nextConfig ?? {}\n const info: NextPathnameInfo = {\n pathname,\n trailingSlash: pathname !== '/' ? pathname.endsWith('/') : trailingSlash,\n }\n\n if (basePath && pathHasPrefix(info.pathname, basePath)) {\n info.pathname = removePathPrefix(info.pathname, basePath)\n info.basePath = basePath\n }\n let pathnameNoDataPrefix = info.pathname\n\n if (\n info.pathname.startsWith('/_next/data/') &&\n info.pathname.endsWith('.json')\n ) {\n const paths = info.pathname\n .replace(/^\\/_next\\/data\\//, '')\n .replace(/\\.json$/, '')\n .split('/')\n\n const buildId = paths[0]\n info.buildId = buildId\n pathnameNoDataPrefix =\n paths[1] !== 'index' ? `/${paths.slice(1).join('/')}` : '/'\n\n // update pathname with normalized if enabled although\n // we use normalized to populate locale info still\n if (options.parseData === true) {\n info.pathname = pathnameNoDataPrefix\n }\n }\n\n // If provided, use the locale route normalizer to detect the locale instead\n // of the function below.\n if (i18n) {\n let result = options.i18nProvider\n ? options.i18nProvider.analyze(info.pathname)\n : normalizeLocalePath(info.pathname, i18n.locales)\n\n info.locale = result.detectedLocale\n info.pathname = result.pathname ?? info.pathname\n\n if (!result.detectedLocale && info.buildId) {\n result = options.i18nProvider\n ? options.i18nProvider.analyze(pathnameNoDataPrefix)\n : normalizeLocalePath(pathnameNoDataPrefix, i18n.locales)\n\n if (result.detectedLocale) {\n info.locale = result.detectedLocale\n }\n }\n }\n return info\n}\n","import type { OutgoingHttpHeaders } from 'http'\nimport type { DomainLocale, I18NConfig } from '../config-shared'\nimport type { I18NProvider } from '../lib/i18n-provider'\n\nimport { detectDomainLocale } from '../../shared/lib/i18n/detect-domain-locale'\nimport { formatNextPathnameInfo } from '../../shared/lib/router/utils/format-next-pathname-info'\nimport { getHostname } from '../../shared/lib/get-hostname'\nimport { getNextPathnameInfo } from '../../shared/lib/router/utils/get-next-pathname-info'\n\ninterface Options {\n base?: string | URL\n headers?: OutgoingHttpHeaders\n forceLocale?: boolean\n nextConfig?: {\n basePath?: string\n i18n?: I18NConfig | null\n trailingSlash?: boolean\n }\n i18nProvider?: I18NProvider\n}\n\nconst REGEX_LOCALHOST_HOSTNAME =\n /(?!^https?:\\/\\/)(127(?:\\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}|\\[::1\\]|localhost)/\n\nfunction parseURL(url: string | URL, base?: string | URL) {\n return new URL(\n String(url).replace(REGEX_LOCALHOST_HOSTNAME, 'localhost'),\n base && String(base).replace(REGEX_LOCALHOST_HOSTNAME, 'localhost')\n )\n}\n\nconst Internal = Symbol('NextURLInternal')\n\nexport class NextURL {\n private [Internal]: {\n basePath: string\n buildId?: string\n flightSearchParameters?: Record<string, string>\n defaultLocale?: string\n domainLocale?: DomainLocale\n locale?: string\n options: Options\n trailingSlash?: boolean\n url: URL\n }\n\n constructor(input: string | URL, base?: string | URL, opts?: Options)\n constructor(input: string | URL, opts?: Options)\n constructor(\n input: string | URL,\n baseOrOpts?: string | URL | Options,\n opts?: Options\n ) {\n let base: undefined | string | URL\n let options: Options\n\n if (\n (typeof baseOrOpts === 'object' && 'pathname' in baseOrOpts) ||\n typeof baseOrOpts === 'string'\n ) {\n base = baseOrOpts\n options = opts || {}\n } else {\n options = opts || baseOrOpts || {}\n }\n\n this[Internal] = {\n url: parseURL(input, base ?? options.base),\n options: options,\n basePath: '',\n }\n\n this.analyze()\n }\n\n private analyze() {\n const info = getNextPathnameInfo(this[Internal].url.pathname, {\n nextConfig: this[Internal].options.nextConfig,\n parseData: !process.env.__NEXT_NO_MIDDLEWARE_URL_NORMALIZE,\n i18nProvider: this[Internal].options.i18nProvider,\n })\n\n const hostname = getHostname(\n this[Internal].url,\n this[Internal].options.headers\n )\n this[Internal].domainLocale = this[Internal].options.i18nProvider\n ? this[Internal].options.i18nProvider.detectDomainLocale(hostname)\n : detectDomainLocale(\n this[Internal].options.nextConfig?.i18n?.domains,\n hostname\n )\n\n const defaultLocale =\n this[Internal].domainLocale?.defaultLocale ||\n this[Internal].options.nextConfig?.i18n?.defaultLocale\n\n this[Internal].url.pathname = info.pathname\n this[Internal].defaultLocale = defaultLocale\n this[Internal].basePath = info.basePath ?? ''\n this[Internal].buildId = info.buildId\n this[Internal].locale = info.locale ?? defaultLocale\n this[Internal].trailingSlash = info.trailingSlash\n }\n\n private formatPathname() {\n return formatNextPathnameInfo({\n basePath: this[Internal].basePath,\n buildId: this[Internal].buildId,\n defaultLocale: !this[Internal].options.forceLocale\n ? this[Internal].defaultLocale\n : undefined,\n locale: this[Internal].locale,\n pathname: this[Internal].url.pathname,\n trailingSlash: this[Internal].trailingSlash,\n })\n }\n\n private formatSearch() {\n return this[Internal].url.search\n }\n\n public get buildId() {\n return this[Internal].buildId\n }\n\n public set buildId(buildId: string | undefined) {\n this[Internal].buildId = buildId\n }\n\n public get locale() {\n return this[Internal].locale ?? ''\n }\n\n public set locale(locale: string) {\n if (\n !this[Internal].locale ||\n !this[Internal].options.nextConfig?.i18n?.locales.includes(locale)\n ) {\n throw new TypeError(\n `The NextURL configuration includes no locale \"${locale}\"`\n )\n }\n\n this[Internal].locale = locale\n }\n\n get defaultLocale() {\n return this[Internal].defaultLocale\n }\n\n get domainLocale() {\n return this[Internal].domainLocale\n }\n\n get searchParams() {\n return this[Internal].url.searchParams\n }\n\n get host() {\n return this[Internal].url.host\n }\n\n set host(value: string) {\n this[Internal].url.host = value\n }\n\n get hostname() {\n return this[Internal].url.hostname\n }\n\n set hostname(value: string) {\n this[Internal].url.hostname = value\n }\n\n get port() {\n return this[Internal].url.port\n }\n\n set port(value: string) {\n this[Internal].url.port = value\n }\n\n get protocol() {\n return this[Internal].url.protocol\n }\n\n set protocol(value: string) {\n this[Internal].url.protocol = value\n }\n\n get href() {\n const pathname = this.formatPathname()\n const search = this.formatSearch()\n return `${this.protocol}//${this.host}${pathname}${search}${this.hash}`\n }\n\n set href(url: string) {\n this[Internal].url = parseURL(url)\n this.analyze()\n }\n\n get origin() {\n return this[Internal].url.origin\n }\n\n get pathname() {\n return this[Internal].url.pathname\n }\n\n set pathname(value: string) {\n this[Internal].url.pathname = value\n }\n\n get hash() {\n return this[Internal].url.hash\n }\n\n set hash(value: string) {\n this[Internal].url.hash = value\n }\n\n get search() {\n return this[Internal].url.search\n }\n\n set search(value: string) {\n this[Internal].url.search = value\n }\n\n get password() {\n return this[Internal].url.password\n }\n\n set password(value: string) {\n this[Internal].url.password = value\n }\n\n get username() {\n return this[Internal].url.username\n }\n\n set username(value: string) {\n this[Internal].url.username = value\n }\n\n get basePath() {\n return this[Internal].basePath\n }\n\n set basePath(value: string) {\n this[Internal].basePath = value.startsWith('/') ? value : `/${value}`\n }\n\n toString() {\n return this.href\n }\n\n toJSON() {\n return this.href\n }\n\n [Symbol.for('edge-runtime.inspect.custom')]() {\n return {\n href: this.href,\n origin: this.origin,\n protocol: this.protocol,\n username: this.username,\n password: this.password,\n host: this.host,\n hostname: this.hostname,\n port: this.port,\n pathname: this.pathname,\n search: this.search,\n searchParams: this.searchParams,\n hash: this.hash,\n }\n }\n\n clone() {\n return new NextURL(String(this), this[Internal].options)\n }\n}\n","export class PageSignatureError extends Error {\n constructor({ page }: { page: string }) {\n super(`The middleware \"${page}\" accepts an async API directly with the form:\n \n export function middleware(request, event) {\n return NextResponse.redirect('/new-location')\n }\n \n Read more: https://nextjs.org/docs/messages/middleware-new-signature\n `)\n }\n}\n\nexport class RemovedPageError extends Error {\n constructor() {\n super(`The request.page has been deprecated in favour of \\`URLPattern\\`.\n Read more: https://nextjs.org/docs/messages/middleware-request-page\n `)\n }\n}\n\nexport class RemovedUAError extends Error {\n constructor() {\n super(`The request.ua has been removed in favour of \\`userAgent\\` function.\n Read more: https://nextjs.org/docs/messages/middleware-parse-user-agent\n `)\n }\n}\n","import type { I18NConfig } from '../../config-shared'\nimport { NextURL } from '../next-url'\nimport { toNodeOutgoingHttpHeaders, validateURL } from '../utils'\nimport { RemovedUAError, RemovedPageError } from '../error'\nimport { RequestCookies } from './cookies'\n\nexport const INTERNALS = Symbol('internal request')\n\n/**\n * This class extends the [Web `Request` API](https://developer.mozilla.org/docs/Web/API/Request) with additional convenience methods.\n *\n * Read more: [Next.js Docs: `NextRequest`](https://nextjs.org/docs/app/api-reference/functions/next-request)\n */\nexport class NextRequest extends Request {\n /** @internal */\n [INTERNALS]: {\n cookies: RequestCookies\n url: string\n nextUrl: NextURL\n }\n\n constructor(input: URL | RequestInfo, init: RequestInit = {}) {\n const url =\n typeof input !== 'string' && 'url' in input ? input.url : String(input)\n\n validateURL(url)\n\n // node Request instance requires duplex option when a body\n // is present or it errors, we don't handle this for\n // Request being passed in since it would have already\n // errored if this wasn't configured\n if (process.env.NEXT_RUNTIME !== 'edge') {\n if (init.body && init.duplex !== 'half') {\n init.duplex = 'half'\n }\n }\n\n if (input instanceof Request) super(input, init)\n else super(url, init)\n\n const nextUrl = new NextURL(url, {\n headers: toNodeOutgoingHttpHeaders(this.headers),\n nextConfig: init.nextConfig,\n })\n this[INTERNALS] = {\n cookies: new RequestCookies(this.headers),\n nextUrl,\n url: process.env.__NEXT_NO_MIDDLEWARE_URL_NORMALIZE\n ? url\n : nextUrl.toString(),\n }\n }\n\n [Symbol.for('edge-runtime.inspect.custom')]() {\n return {\n cookies: this.cookies,\n nextUrl: this.nextUrl,\n url: this.url,\n // rest of props come from Request\n bodyUsed: this.bodyUsed,\n cache: this.cache,\n credentials: this.credentials,\n destination: this.destination,\n headers: Object.fromEntries(this.headers),\n integrity: this.integrity,\n keepalive: this.keepalive,\n method: this.method,\n mode: this.mode,\n redirect: this.redirect,\n referrer: this.referrer,\n referrerPolicy: this.referrerPolicy,\n signal: this.signal,\n }\n }\n\n public get cookies() {\n return this[INTERNALS].cookies\n }\n\n public get nextUrl() {\n return this[INTERNALS].nextUrl\n }\n\n /**\n * @deprecated\n * `page` has been deprecated in favour of `URLPattern`.\n * Read more: https://nextjs.org/docs/messages/middleware-request-page\n */\n public get page() {\n throw new RemovedPageError()\n }\n\n /**\n * @deprecated\n * `ua` has been removed in favour of \\`userAgent\\` function.\n * Read more: https://nextjs.org/docs/messages/middleware-parse-user-agent\n */\n public get ua() {\n throw new RemovedUAError()\n }\n\n public get url() {\n return this[INTERNALS].url\n }\n}\n\nexport interface RequestInit extends globalThis.RequestInit {\n nextConfig?: {\n basePath?: string\n i18n?: I18NConfig | null\n trailingSlash?: boolean\n }\n signal?: AbortSignal\n // see https://github.com/whatwg/fetch/pull/1457\n duplex?: 'half'\n}\n","import type { BaseNextRequest, BaseNextResponse } from './'\nimport type { NodeNextRequest, NodeNextResponse } from './node'\nimport type { WebNextRequest, WebNextResponse } from './web'\n\n/**\n * This file provides some helpers that should be used in conjunction with\n * explicit environment checks. When combined with the environment checks, it\n * will ensure that the correct typings are used as well as enable code\n * elimination.\n */\n\n/**\n * Type guard to determine if a request is a WebNextRequest. This does not\n * actually check the type of the request, but rather the runtime environment.\n * It's expected that when the runtime environment is the edge runtime, that any\n * base request is a WebNextRequest.\n */\nexport const isWebNextRequest = (req: BaseNextRequest): req is WebNextRequest =>\n process.env.NEXT_RUNTIME === 'edge'\n\n/**\n * Type guard to determine if a response is a WebNextResponse. This does not\n * actually check the type of the response, but rather the runtime environment.\n * It's expected that when the runtime environment is the edge runtime, that any\n * base response is a WebNextResponse.\n */\nexport const isWebNextResponse = (\n res: BaseNextResponse\n): res is WebNextResponse => process.env.NEXT_RUNTIME === 'edge'\n\n/**\n * Type guard to determine if a request is a NodeNextRequest. This does not\n * actually check the type of the request, but rather the runtime environment.\n * It's expected that when the runtime environment is the node runtime, that any\n * base request is a NodeNextRequest.\n */\nexport const isNodeNextRequest = (\n req: BaseNextRequest\n): req is NodeNextRequest => process.env.NEXT_RUNTIME !== 'edge'\n\n/**\n * Type guard to determine if a response is a NodeNextResponse. This does not\n * actually check the type of the response, but rather the runtime environment.\n * It's expected that when the runtime environment is the node runtime, that any\n * base response is a NodeNextResponse.\n */\nexport const isNodeNextResponse = (\n res: BaseNextResponse\n): res is NodeNextResponse => process.env.NEXT_RUNTIME !== 'edge'\n","import type { BaseNextRequest } from '../../../base-http'\nimport type { NodeNextRequest } from '../../../base-http/node'\nimport type { WebNextRequest } from '../../../base-http/web'\nimport type { Writable } from 'node:stream'\n\nimport { getRequestMeta } from '../../../request-meta'\nimport { fromNodeOutgoingHttpHeaders } from '../../utils'\nimport { NextRequest } from '../request'\nimport { isNodeNextRequest, isWebNextRequest } from '../../../base-http/helpers'\n\nexport const ResponseAbortedName = 'ResponseAborted'\nexport class ResponseAborted extends Error {\n public readonly name = ResponseAbortedName\n}\n\n/**\n * Creates an AbortController tied to the closing of a ServerResponse (or other\n * appropriate Writable).\n *\n * If the `close` event is fired before the `finish` event, then we'll send the\n * `abort` signal.\n */\nexport function createAbortController(response: Writable): AbortController {\n const controller = new AbortController()\n\n // If `finish` fires first, then `res.end()` has been called and the close is\n // just us finishing the stream on our side. If `close` fires first, then we\n // know the client disconnected before we finished.\n response.once('close', () => {\n if (response.writableFinished) return\n\n controller.abort(new ResponseAborted())\n })\n\n return controller\n}\n\n/**\n * Creates an AbortSignal tied to the closing of a ServerResponse (or other\n * appropriate Writable).\n *\n * This cannot be done with the request (IncomingMessage or Readable) because\n * the `abort` event will not fire if to data has been fully read (because that\n * will \"close\" the readable stream and nothing fires after that).\n */\nexport function signalFromNodeResponse(response: Writable): AbortSignal {\n const { errored, destroyed } = response\n if (errored || destroyed) {\n return AbortSignal.abort(errored ?? new ResponseAborted())\n }\n\n const { signal } = createAbortController(response)\n return signal\n}\n\nexport class NextRequestAdapter {\n public static fromBaseNextRequest(\n request: BaseNextRequest,\n signal: AbortSignal\n ): NextRequest {\n if (\n // The type check here ensures that `req` is correctly typed, and the\n // environment variable check provides dead code elimination.\n process.env.NEXT_RUNTIME === 'edge' &&\n isWebNextRequest(request)\n ) {\n return NextRequestAdapter.fromWebNextRequest(request)\n } else if (\n // The type check here ensures that `req` is correctly typed, and the\n // environment variable check provides dead code elimination.\n process.env.NEXT_RUNTIME !== 'edge' &&\n isNodeNextRequest(request)\n ) {\n return NextRequestAdapter.fromNodeNextRequest(request, signal)\n } else {\n throw new Error('Invariant: Unsupported NextRequest type')\n }\n }\n\n public static fromNodeNextRequest(\n request: NodeNextRequest,\n signal: AbortSignal\n ): NextRequest {\n // HEAD and GET requests can not have a body.\n let body: BodyInit | null = null\n if (request.method !== 'GET' && request.method !== 'HEAD' && request.body) {\n // @ts-expect-error - this is handled by undici, when streams/web land use it instead\n body = request.body\n }\n\n let url: URL\n if (request.url.startsWith('http')) {\n url = new URL(request.url)\n } else {\n // Grab the full URL from the request metadata.\n const base = getRequestMeta(request, 'initURL')\n if (!base || !base.startsWith('http')) {\n // Because the URL construction relies on the fact that the URL provided\n // is absolute, we need to provide a base URL. We can't use the request\n // URL because it's relative, so we use a dummy URL instead.\n url = new URL(request.url, 'http://n')\n } else {\n url = new URL(request.url, base)\n }\n }\n\n return new NextRequest(url, {\n method: request.method,\n headers: fromNodeOutgoingHttpHeaders(request.headers),\n duplex: 'half',\n signal,\n // geo\n // ip\n // nextConfig\n\n // body can not be passed if request was aborted\n // or we get a Request body was disturbed error\n ...(signal.aborted\n ? {}\n : {\n body,\n }),\n })\n }\n\n public static fromWebNextRequest(request: WebNextRequest): NextRequest {\n // HEAD and GET requests can not have a body.\n let body: ReadableStream | null = null\n if (request.method !== 'GET' && request.method !== 'HEAD') {\n body = request.body\n }\n\n return new NextRequest(request.url, {\n method: request.method,\n headers: fromNodeOutgoingHttpHeaders(request.headers),\n duplex: 'half',\n signal: request.request.signal,\n // geo\n // ip\n // nextConfig\n\n // body can not be passed if request was aborted\n // or we get a Request body was disturbed error\n ...(request.request.signal.aborted\n ? {}\n : {\n body,\n }),\n })\n }\n}\n","import type { AppPageModule } from './route-modules/app-page/module'\n\n// Combined load times for loading client components\nlet clientComponentLoadStart = 0\nlet clientComponentLoadTimes = 0\nlet clientComponentLoadCount = 0\n\nexport function wrapClientComponentLoader(\n ComponentMod: AppPageModule\n): AppPageModule['__next_app__'] {\n if (!('performance' in globalThis)) {\n return ComponentMod.__next_app__\n }\n\n return {\n require: (...args) => {\n const startTime = performance.now()\n\n if (clientComponentLoadStart === 0) {\n clientComponentLoadStart = startTime\n }\n\n try {\n clientComponentLoadCount += 1\n return ComponentMod.__next_app__.require(...args)\n } finally {\n clientComponentLoadTimes += performance.now() - startTime\n }\n },\n loadChunk: (...args) => {\n const startTime = performance.now()\n const result = ComponentMod.__next_app__.loadChunk(...args)\n // Avoid wrapping `loadChunk`'s result in an extra promise in case something like React depends on its identity.\n // We only need to know when it's settled.\n result.finally(() => {\n clientComponentLoadTimes += performance.now() - startTime\n })\n return result\n },\n }\n}\n\nexport function getClientComponentLoaderMetrics(\n options: { reset?: boolean } = {}\n) {\n const metrics =\n clientComponentLoadStart === 0\n ? undefined\n : {\n clientComponentLoadStart,\n clientComponentLoadTimes,\n clientComponentLoadCount,\n }\n\n if (options.reset) {\n clientComponentLoadStart = 0\n clientComponentLoadTimes = 0\n clientComponentLoadCount = 0\n }\n\n return metrics\n}\n","import type { ServerResponse } from 'node:http'\n\nimport {\n ResponseAbortedName,\n createAbortController,\n} from './web/spec-extension/adapters/next-request'\nimport { DetachedPromise } from '../lib/detached-promise'\nimport { getTracer } from './lib/trace/tracer'\nimport { NextNodeServerSpan } from './lib/trace/constants'\nimport { getClientComponentLoaderMetrics } from './client-component-renderer-logger'\n\nexport function isAbortError(e: any): e is Error & { name: 'AbortError' } {\n return e?.name === 'AbortError' || e?.name === ResponseAbortedName\n}\n\nfunction createWriterFromResponse(\n res: ServerResponse,\n waitUntilForEnd?: Promise<unknown>\n): WritableStream<Uint8Array> {\n let started = false\n\n // Create a promise that will resolve once the response has drained. See\n // https://nodejs.org/api/stream.html#stream_event_drain\n let drained = new DetachedPromise<void>()\n function onDrain() {\n drained.resolve()\n }\n res.on('drain', onDrain)\n\n // If the finish event fires, it means we shouldn't block and wait for the\n // drain event.\n res.once('close', () => {\n res.off('drain', onDrain)\n drained.resolve()\n })\n\n // Create a promise that will resolve once the response has finished. See\n // https://nodejs.org/api/http.html#event-finish_1\n const finished = new DetachedPromise<void>()\n res.once('finish', () => {\n finished.resolve()\n })\n\n // Create a writable stream that will write to the response.\n return new WritableStream<Uint8Array>({\n write: async (chunk) => {\n // You'd think we'd want to use `start` instead of placing this in `write`\n // but this ensures that we don't actually flush the headers until we've\n // started writing chunks.\n if (!started) {\n started = true\n\n if (\n 'performance' in globalThis &&\n process.env.NEXT_OTEL_PERFORMANCE_PREFIX\n ) {\n const metrics = getClientComponentLoaderMetrics()\n if (metrics) {\n performance.measure(\n `${process.env.NEXT_OTEL_PERFORMANCE_PREFIX}:next-client-component-loading`,\n {\n start: metrics.clientComponentLoadStart,\n end:\n metrics.clientComponentLoadStart +\n metrics.clientComponentLoadTimes,\n }\n )\n }\n }\n\n res.flushHeaders()\n getTracer().trace(\n NextNodeServerSpan.startResponse,\n {\n spanName: 'start response',\n },\n () => undefined\n )\n }\n\n try {\n const ok = res.write(chunk)\n\n // Added by the `compression` middleware, this is a function that will\n // flush the partially-compressed response to the client.\n if ('flush' in res && typeof res.flush === 'function') {\n res.flush()\n }\n\n // If the write returns false, it means there's some backpressure, so\n // wait until it's streamed before continuing.\n if (!ok) {\n await drained.promise\n\n // Reset the drained promise so that we can wait for the next drain event.\n drained = new DetachedPromise<void>()\n }\n } catch (err) {\n res.end()\n throw new Error('failed to write chunk to response', { cause: err })\n }\n },\n abort: (err) => {\n if (res.writableFinished) return\n\n res.destroy(err)\n },\n close: async () => {\n // if a waitUntil promise was passed, wait for it to resolve before\n // ending the response.\n if (waitUntilForEnd) {\n await waitUntilForEnd\n }\n\n if (res.writableFinished) return\n\n res.end()\n return finished.promise\n },\n })\n}\n\nexport async function pipeToNodeResponse(\n readable: ReadableStream<Uint8Array>,\n res: ServerResponse,\n waitUntilForEnd?: Promise<unknown>\n) {\n try {\n // If the response has already errored, then just return now.\n const { errored, destroyed } = res\n if (errored || destroyed) return\n\n // Create a new AbortController so that we can abort the readable if the\n // client disconnects.\n const controller = createAbortController(res)\n\n const writer = createWriterFromResponse(res, waitUntilForEnd)\n\n await readable.pipeTo(writer, { signal: controller.signal })\n } catch (err: any) {\n // If this isn't related to an abort error, re-throw it.\n if (isAbortError(err)) return\n\n throw new Error('failed to pipe response', { cause: err })\n }\n}\n","import type { OutgoingHttpHeaders, ServerResponse } from 'http'\nimport type { CacheControl } from './lib/cache-control'\nimport type { FetchMetrics } from './base-http'\n\nimport {\n chainStreams,\n streamFromBuffer,\n streamFromString,\n streamToString,\n} from './stream-utils/node-web-streams-helper'\nimport { isAbortError, pipeToNodeResponse } from './pipe-readable'\nimport type { RenderResumeDataCache } from './resume-data-cache/resume-data-cache'\nimport { InvariantError } from '../shared/lib/invariant-error'\nimport type {\n HTML_CONTENT_TYPE_HEADER,\n JSON_CONTENT_TYPE_HEADER,\n TEXT_PLAIN_CONTENT_TYPE_HEADER,\n} from '../lib/constants'\nimport type { RSC_CONTENT_TYPE_HEADER } from '../client/components/app-router-headers'\n\ntype ContentTypeOption =\n | typeof RSC_CONTENT_TYPE_HEADER // For App Page RSC responses\n | typeof HTML_CONTENT_TYPE_HEADER // For App Page, Pages HTML responses\n | typeof JSON_CONTENT_TYPE_HEADER // For API routes, Next.js data requests\n | typeof TEXT_PLAIN_CONTENT_TYPE_HEADER // For simplified errors\n\nexport type AppPageRenderResultMetadata = {\n flightData?: Buffer\n cacheControl?: CacheControl\n staticBailoutInfo?: {\n stack?: string\n description?: string\n }\n\n /**\n * The postponed state if the render had postponed and needs to be resumed.\n */\n postponed?: string\n\n /**\n * The headers to set on the response that were added by the render.\n */\n headers?: OutgoingHttpHeaders\n statusCode?: number\n fetchTags?: string\n fetchMetrics?: FetchMetrics\n\n segmentData?: Map<string, Buffer>\n\n /**\n * In development, the resume data cache is warmed up before the render. This\n * is attached to the metadata so that it can be used during the render. When\n * prerendering, the filled resume data cache is also attached to the metadata\n * so that it can be used when prerendering matching fallback shells.\n */\n renderResumeDataCache?: RenderResumeDataCache\n}\n\nexport type PagesRenderResultMetadata = {\n pageData?: any\n cacheControl?: CacheControl\n assetQueryString?: string\n isNotFound?: boolean\n isRedirect?: boolean\n}\n\nexport type StaticRenderResultMetadata = {}\n\nexport type RenderResultMetadata = AppPageRenderResultMetadata &\n PagesRenderResultMetadata &\n StaticRenderResultMetadata\n\nexport type RenderResultResponse =\n | ReadableStream<Uint8Array>[]\n | ReadableStream<Uint8Array>\n | string\n | Buffer\n | null\n\nexport type RenderResultOptions<\n Metadata extends RenderResultMetadata = RenderResultMetadata,\n> = {\n contentType: ContentTypeOption | null\n waitUntil?: Promise<unknown>\n metadata: Metadata\n}\n\nexport default class RenderResult<\n Metadata extends RenderResultMetadata = RenderResultMetadata,\n> {\n /**\n * The detected content type for the response. This is used to set the\n * `Content-Type` header.\n */\n public readonly contentType: ContentTypeOption | null\n\n /**\n * The metadata for the response. This is used to set the revalidation times\n * and other metadata.\n */\n public readonly metadata: Readonly<Metadata>\n\n /**\n * The response itself. This can be a string, a stream, or null. If it's a\n * string, then it's a static response. If it's a stream, then it's a\n * dynamic response. If it's null, then the response was not found or was\n * already sent.\n */\n private response: RenderResultResponse\n\n /**\n * A render result that represents an empty response. This is used to\n * represent a response that was not found or was already sent.\n */\n public static readonly EMPTY = new RenderResult<StaticRenderResultMetadata>(\n null,\n { metadata: {}, contentType: null }\n )\n\n /**\n * Creates a new RenderResult instance from a static response.\n *\n * @param value the static response value\n * @param contentType the content type of the response\n * @returns a new RenderResult instance\n */\n public static fromStatic(\n value: string | Buffer,\n contentType: ContentTypeOption\n ) {\n return new RenderResult<StaticRenderResultMetadata>(value, {\n metadata: {},\n contentType,\n })\n }\n\n private readonly waitUntil?: Promise<unknown>\n\n constructor(\n response: RenderResultResponse,\n { contentType, waitUntil, metadata }: RenderResultOptions<Metadata>\n ) {\n this.response = response\n this.contentType = contentType\n this.metadata = metadata\n this.waitUntil = waitUntil\n }\n\n public assignMetadata(metadata: Metadata) {\n Object.assign(this.metadata, metadata)\n }\n\n /**\n * Returns true if the response is null. It can be null if the response was\n * not found or was already sent.\n */\n public get isNull(): boolean {\n return this.response === null\n }\n\n /**\n * Returns false if the response is a string. It can be a string if the page\n * was prerendered. If it's not, then it was generated dynamically.\n */\n public get isDynamic(): boolean {\n return typeof this.response !== 'string'\n }\n\n /**\n * Returns the response if it is a string. If the page was dynamic, this will\n * return a promise if the `stream` option is true, or it will throw an error.\n *\n * @param stream Whether or not to return a promise if the response is dynamic\n * @returns The response as a string\n */\n public toUnchunkedString(stream?: false): string\n public toUnchunkedString(stream: true): Promise<string>\n public toUnchunkedString(stream = false): Promise<string> | string {\n if (this.response === null) {\n // If the response is null, return an empty string. This behavior is\n // intentional as we're now providing the `RenderResult.EMPTY` value.\n return ''\n }\n\n if (typeof this.response !== 'string') {\n if (!stream) {\n throw new InvariantError(\n 'dynamic responses cannot be unchunked. This is a bug in Next.js'\n )\n }\n\n return streamToString(this.readable)\n }\n\n return this.response\n }\n\n /**\n * Returns a readable stream of the response.\n */\n private get readable(): ReadableStream<Uint8Array> {\n if (this.response === null) {\n // If the response is null, return an empty stream. This behavior is\n // intentional as we're now providing the `RenderResult.EMPTY` value.\n return new ReadableStream<Uint8Array>({\n start(controller) {\n controller.close()\n },\n })\n }\n\n if (typeof this.response === 'string') {\n return streamFromString(this.response)\n }\n\n if (Buffer.isBuffer(this.response)) {\n return streamFromBuffer(this.response)\n }\n\n // If the response is an array of streams, then chain them together.\n if (Array.isArray(this.response)) {\n return chainStreams(...this.response)\n }\n\n return this.response\n }\n\n /**\n * Coerces the response to an array of streams. This will convert the response\n * to an array of streams if it is not already one.\n *\n * @returns An array of streams\n */\n private coerce(): ReadableStream<Uint8Array>[] {\n if (this.response === null) {\n // If the response is null, return an empty stream. This behavior is\n // intentional as we're now providing the `RenderResult.EMPTY` value.\n return []\n }\n\n if (typeof this.response === 'string') {\n return [streamFromString(this.response)]\n } else if (Array.isArray(this.response)) {\n return this.response\n } else if (Buffer.isBuffer(this.response)) {\n return [streamFromBuffer(this.response)]\n } else {\n return [this.response]\n }\n }\n\n /**\n * Unshifts a new stream to the response. This will convert the response to an\n * array of streams if it is not already one and will add the new stream to\n * the start of the array. When this response is piped, all of the streams\n * will be piped one after the other.\n *\n * @param readable The new stream to unshift\n */\n public unshift(readable: ReadableStream<Uint8Array>): void {\n // Coerce the response to an array of streams.\n this.response = this.coerce()\n\n // Add the new stream to the start of the array.\n this.response.unshift(readable)\n }\n\n /**\n * Chains a new stream to the response. This will convert the response to an\n * array of streams if it is not already one and will add the new stream to\n * the end. When this response is piped, all of the streams will be piped\n * one after the other.\n *\n * @param readable The new stream to chain\n */\n public push(readable: ReadableStream<Uint8Array>): void {\n // Coerce the response to an array of streams.\n this.response = this.coerce()\n\n // Add the new stream to the end of the array.\n this.response.push(readable)\n }\n\n /**\n * Pipes the response to a writable stream. This will close/cancel the\n * writable stream if an error is encountered. If this doesn't throw, then\n * the writable stream will be closed or aborted.\n *\n * @param writable Writable stream to pipe the response to\n */\n public async pipeTo(writable: WritableStream<Uint8Array>): Promise<void> {\n try {\n await this.readable.pipeTo(writable, {\n // We want to close the writable stream ourselves so that we can wait\n // for the waitUntil promise to resolve before closing it. If an error\n // is encountered, we'll abort the writable stream if we swallowed the\n // error.\n preventClose: true,\n })\n\n // If there is a waitUntil promise, wait for it to resolve before\n // closing the writable stream.\n if (this.waitUntil) await this.waitUntil\n\n // Close the writable stream.\n await writable.close()\n } catch (err) {\n // If this is an abort error, we should abort the writable stream (as we\n // took ownership of it when we started piping). We don't need to re-throw\n // because we handled the error.\n if (isAbortError(err)) {\n // Abort the writable stream if an error is encountered.\n await writable.abort(err)\n\n return\n }\n\n // We're not aborting the writer here as when this method throws it's not\n // clear as to how so the caller should assume it's their responsibility\n // to clean up the writer.\n throw err\n }\n }\n\n /**\n * Pipes the response to a node response. This will close/cancel the node\n * response if an error is encountered.\n *\n * @param res\n */\n public async pipeToNodeResponse(res: ServerResponse) {\n await pipeToNodeResponse(this.readable, res, this.waitUntil)\n }\n}\n","export const enum RouteKind {\n /**\n * `PAGES` represents all the React pages that are under `pages/`.\n */\n PAGES = 'PAGES',\n /**\n * `PAGES_API` represents all the API routes under `pages/api/`.\n */\n PAGES_API = 'PAGES_API',\n /**\n * `APP_PAGE` represents all the React pages that are under `app/` with the\n * filename of `page.{j,t}s{,x}`.\n */\n APP_PAGE = 'APP_PAGE',\n /**\n * `APP_ROUTE` represents all the API routes and metadata routes that are under `app/` with the\n * filename of `route.{j,t}s{,x}`.\n */\n APP_ROUTE = 'APP_ROUTE',\n\n /**\n * `IMAGE` represents all the images that are generated by `next/image`.\n */\n IMAGE = 'IMAGE',\n}\n","import {\n CachedRouteKind,\n IncrementalCacheKind,\n type CachedAppPageValue,\n type CachedPageValue,\n type IncrementalResponseCacheEntry,\n type ResponseCacheEntry,\n} from './types'\n\nimport RenderResult from '../render-result'\nimport { RouteKind } from '../route-kind'\nimport { HTML_CONTENT_TYPE_HEADER } from '../../lib/constants'\n\nexport async function fromResponseCacheEntry(\n cacheEntry: ResponseCacheEntry\n): Promise<IncrementalResponseCacheEntry> {\n return {\n ...cacheEntry,\n value:\n cacheEntry.value?.kind === CachedRouteKind.PAGES\n ? {\n kind: CachedRouteKind.PAGES,\n html: await cacheEntry.value.html.toUnchunkedString(true),\n pageData: cacheEntry.value.pageData,\n headers: cacheEntry.value.headers,\n status: cacheEntry.value.status,\n }\n : cacheEntry.value?.kind === CachedRouteKind.APP_PAGE\n ? {\n kind: CachedRouteKind.APP_PAGE,\n html: await cacheEntry.value.html.toUnchunkedString(true),\n postponed: cacheEntry.value.postponed,\n rscData: cacheEntry.value.rscData,\n headers: cacheEntry.value.headers,\n status: cacheEntry.value.status,\n segmentData: cacheEntry.value.segmentData,\n }\n : cacheEntry.value,\n }\n}\n\nexport async function toResponseCacheEntry(\n response: IncrementalResponseCacheEntry | null\n): Promise<ResponseCacheEntry | null> {\n if (!response) return null\n\n return {\n isMiss: response.isMiss,\n isStale: response.isStale,\n cacheControl: response.cacheControl,\n value:\n response.value?.kind === CachedRouteKind.PAGES\n ? ({\n kind: CachedRouteKind.PAGES,\n html: RenderResult.fromStatic(\n response.value.html,\n HTML_CONTENT_TYPE_HEADER\n ),\n pageData: response.value.pageData,\n headers: response.value.headers,\n status: response.value.status,\n } satisfies CachedPageValue)\n : response.value?.kind === CachedRouteKind.APP_PAGE\n ? ({\n kind: CachedRouteKind.APP_PAGE,\n html: RenderResult.fromStatic(\n response.value.html,\n HTML_CONTENT_TYPE_HEADER\n ),\n rscData: response.value.rscData,\n headers: response.value.headers,\n status: response.value.status,\n postponed: response.value.postponed,\n segmentData: response.value.segmentData,\n } satisfies CachedAppPageValue)\n : response.value,\n }\n}\n\nexport function routeKindToIncrementalCacheKind(\n routeKind: RouteKind\n): Exclude<IncrementalCacheKind, IncrementalCacheKind.FETCH> {\n switch (routeKind) {\n case RouteKind.PAGES:\n return IncrementalCacheKind.PAGES\n case RouteKind.APP_PAGE:\n return IncrementalCacheKind.APP_PAGE\n case RouteKind.IMAGE:\n return IncrementalCacheKind.IMAGE\n case RouteKind.APP_ROUTE:\n return IncrementalCacheKind.APP_ROUTE\n case RouteKind.PAGES_API:\n // Pages Router API routes are not cached in the incremental cache.\n throw new Error(`Unexpected route kind ${routeKind}`)\n default:\n return routeKind satisfies never\n }\n}\n","import type {\n ResponseCacheEntry,\n ResponseGenerator,\n ResponseCacheBase,\n IncrementalResponseCacheEntry,\n IncrementalResponseCache,\n} from './types'\n\nimport { Batcher } from '../../lib/batcher'\nimport { LRUCache } from '../lib/lru-cache'\nimport { warnOnce } from '../../build/output/log'\nimport { scheduleOnNextTick } from '../../lib/scheduler'\nimport {\n fromResponseCacheEntry,\n routeKindToIncrementalCacheKind,\n toResponseCacheEntry,\n} from './utils'\nimport type { RouteKind } from '../route-kind'\n\n/**\n * Parses an environment variable as a positive integer, returning the fallback\n * if the value is missing, not a number, or not positive.\n */\nfunction parsePositiveInt(\n envValue: string | undefined,\n fallback: number\n): number {\n if (!envValue) return fallback\n const parsed = parseInt(envValue, 10)\n return Number.isFinite(parsed) && parsed > 0 ? parsed : fallback\n}\n\n/**\n * Default TTL (in milliseconds) for minimal mode response cache entries.\n * Used for cache hit validation as a fallback for providers that don't\n * send the x-invocation-id header yet.\n *\n * 10 seconds chosen because:\n * - Long enough to dedupe rapid successive requests (e.g., page + data)\n * - Short enough to not serve stale data across unrelated requests\n *\n * Can be configured via `NEXT_PRIVATE_RESPONSE_CACHE_TTL` environment variable.\n */\nconst DEFAULT_TTL_MS = parsePositiveInt(\n process.env.NEXT_PRIVATE_RESPONSE_CACHE_TTL,\n 10_000\n)\n\n/**\n * Default maximum number of entries in the response cache.\n * Can be configured via `NEXT_PRIVATE_RESPONSE_CACHE_MAX_SIZE` environment variable.\n */\nconst DEFAULT_MAX_SIZE = parsePositiveInt(\n process.env.NEXT_PRIVATE_RESPONSE_CACHE_MAX_SIZE,\n 150\n)\n\n/**\n * Separator used in compound cache keys to join pathname and invocationID.\n * Using null byte (\\0) since it cannot appear in valid URL paths or UUIDs.\n */\nconst KEY_SEPARATOR = '\\0'\n\n/**\n * Sentinel value used for TTL-based cache entries (when invocationID is undefined).\n * Chosen to be a clearly reserved marker for internal cache keys.\n */\nconst TTL_SENTINEL = '__ttl_sentinel__'\n\n/**\n * Entry stored in the LRU cache.\n */\ntype CacheEntry = {\n entry: IncrementalResponseCacheEntry | null\n /**\n * TTL expiration timestamp in milliseconds. Used as a fallback for\n * cache hit validation when providers don't send x-invocation-id.\n * Memory pressure is managed by LRU eviction rather than timers.\n */\n expiresAt: number\n}\n\n/**\n * Creates a compound cache key from pathname and invocationID.\n */\nfunction createCacheKey(\n pathname: string,\n invocationID: string | undefined\n): string {\n return `${pathname}${KEY_SEPARATOR}${invocationID ?? TTL_SENTINEL}`\n}\n\n/**\n * Extracts the invocationID from a compound cache key.\n * Returns undefined if the key used TTL_SENTINEL.\n */\nfunction extractInvocationID(compoundKey: string): string | undefined {\n const separatorIndex = compoundKey.lastIndexOf(KEY_SEPARATOR)\n if (separatorIndex === -1) return undefined\n\n const invocationID = compoundKey.slice(separatorIndex + 1)\n return invocationID === TTL_SENTINEL ? undefined : invocationID\n}\n\nexport * from './types'\n\nexport default class ResponseCache implements ResponseCacheBase {\n private readonly getBatcher = Batcher.create<\n { key: string; isOnDemandRevalidate: boolean },\n IncrementalResponseCacheEntry | null,\n string\n >({\n // Ensure on-demand revalidate doesn't block normal requests, it should be\n // safe to run an on-demand revalidate for the same key as a normal request.\n cacheKeyFn: ({ key, isOnDemandRevalidate }) =>\n `${key}-${isOnDemandRevalidate ? '1' : '0'}`,\n // We wait to do any async work until after we've added our promise to\n // `pendingResponses` to ensure that any any other calls will reuse the\n // same promise until we've fully finished our work.\n schedulerFn: scheduleOnNextTick,\n })\n\n private readonly revalidateBatcher = Batcher.create<\n string,\n IncrementalResponseCacheEntry | null\n >({\n // We wait to do any async work until after we've added our promise to\n // `pendingResponses` to ensure that any any other calls will reuse the\n // same promise until we've fully finished our work.\n schedulerFn: scheduleOnNextTick,\n })\n\n /**\n * LRU cache for minimal mode using compound keys (pathname + invocationID).\n * This allows multiple invocations to cache the same pathname without\n * overwriting each other's entries.\n */\n private readonly cache: LRUCache<CacheEntry>\n\n /**\n * Set of invocation IDs that have had cache entries evicted.\n * Used to detect when the cache size may be too small.\n * Bounded to prevent memory growth.\n */\n private readonly evictedInvocationIDs: Set<string> = new Set()\n\n /**\n * The configured max size, stored for logging.\n */\n private readonly maxSize: number\n\n /**\n * The configured TTL for cache entries in milliseconds.\n */\n private readonly ttl: number\n\n // we don't use minimal_mode name here as this.minimal_mode is\n // statically replace for server runtimes but we need it to\n // be dynamic here\n private minimal_mode?: boolean\n\n constructor(\n minimal_mode: boolean,\n maxSize: number = DEFAULT_MAX_SIZE,\n ttl: number = DEFAULT_TTL_MS\n ) {\n this.minimal_mode = minimal_mode\n this.maxSize = maxSize\n this.ttl = ttl\n\n // Create the LRU cache with eviction tracking\n this.cache = new LRUCache(maxSize, undefined, (compoundKey) => {\n const invocationID = extractInvocationID(compoundKey)\n if (invocationID) {\n // Bound to 100 entries to prevent unbounded memory growth.\n // FIFO eviction is acceptable here because:\n // 1. Invocations are short-lived (single request lifecycle), so older\n // invocations are unlikely to still be active after 100 newer ones\n // 2. This warning mechanism is best-effort for developer guidance—\n // missing occasional eviction warnings doesn't affect correctness\n // 3. If a long-running invocation is somehow evicted and then has\n // another cache entry evicted, it will simply be re-added\n if (this.evictedInvocationIDs.size >= 100) {\n const first = this.evictedInvocationIDs.values().next().value\n if (first) this.evictedInvocationIDs.delete(first)\n }\n this.evictedInvocationIDs.add(invocationID)\n }\n })\n }\n\n /**\n * Gets the response cache entry for the given key.\n *\n * @param key - The key to get the response cache entry for.\n * @param responseGenerator - The response generator to use to generate the response cache entry.\n * @param context - The context for the get request.\n * @returns The response cache entry.\n */\n public async get(\n key: string | null,\n responseGenerator: ResponseGenerator,\n context: {\n routeKind: RouteKind\n isOnDemandRevalidate?: boolean\n isPrefetch?: boolean\n incrementalCache: IncrementalResponseCache\n isRoutePPREnabled?: boolean\n isFallback?: boolean\n waitUntil?: (prom: Promise<any>) => void\n\n /**\n * The invocation ID from the infrastructure. Used to scope the\n * in-memory cache to a single revalidation request in minimal mode.\n */\n invocationID?: string\n }\n ): Promise<ResponseCacheEntry | null> {\n // If there is no key for the cache, we can't possibly look this up in the\n // cache so just return the result of the response generator.\n if (!key) {\n return responseGenerator({\n hasResolved: false,\n previousCacheEntry: null,\n })\n }\n\n // Check minimal mode cache before doing any other work.\n if (this.minimal_mode) {\n const cacheKey = createCacheKey(key, context.invocationID)\n const cachedItem = this.cache.get(cacheKey)\n\n if (cachedItem) {\n // With invocationID: exact match found - always a hit\n // With TTL mode: must check expiration\n if (context.invocationID !== undefined) {\n return toResponseCacheEntry(cachedItem.entry)\n }\n\n // TTL mode: check expiration\n const now = Date.now()\n if (cachedItem.expiresAt > now) {\n return toResponseCacheEntry(cachedItem.entry)\n }\n\n // TTL expired - clean up\n this.cache.remove(cacheKey)\n }\n\n // Warn if this invocation had entries evicted - indicates cache may be too small.\n if (\n context.invocationID &&\n this.evictedInvocationIDs.has(context.invocationID)\n ) {\n warnOnce(\n `Response cache entry was evicted for invocation ${context.invocationID}. ` +\n `Consider increasing NEXT_PRIVATE_RESPONSE_CACHE_MAX_SIZE (current: ${this.maxSize}).`\n )\n }\n }\n\n const {\n incrementalCache,\n isOnDemandRevalidate = false,\n isFallback = false,\n isRoutePPREnabled = false,\n isPrefetch = false,\n waitUntil,\n routeKind,\n invocationID,\n } = context\n\n const response = await this.getBatcher.batch(\n { key, isOnDemandRevalidate },\n ({ resolve }) => {\n const promise = this.handleGet(\n key,\n responseGenerator,\n {\n incrementalCache,\n isOnDemandRevalidate,\n isFallback,\n isRoutePPREnabled,\n isPrefetch,\n routeKind,\n invocationID,\n },\n resolve\n )\n\n // We need to ensure background revalidates are passed to waitUntil.\n if (waitUntil) waitUntil(promise)\n\n return promise\n }\n )\n\n return toResponseCacheEntry(response)\n }\n\n /**\n * Handles the get request for the response cache.\n *\n * @param key - The key to get the response cache entry for.\n * @param responseGenerator - The response generator to use to generate the response cache entry.\n * @param context - The context for the get request.\n * @param resolve - The resolve function to use to resolve the response cache entry.\n * @returns The response cache entry.\n */\n private async handleGet(\n key: string,\n responseGenerator: ResponseGenerator,\n context: {\n incrementalCache: IncrementalResponseCache\n isOnDemandRevalidate: boolean\n isFallback: boolean\n isRoutePPREnabled: boolean\n isPrefetch: boolean\n routeKind: RouteKind\n invocationID: string | undefined\n },\n resolve: (value: IncrementalResponseCacheEntry | null) => void\n ): Promise<IncrementalResponseCacheEntry | null> {\n let previousIncrementalCacheEntry: IncrementalResponseCacheEntry | null =\n null\n let resolved = false\n\n try {\n // Get the previous cache entry if not in minimal mode\n previousIncrementalCacheEntry = !this.minimal_mode\n ? await context.incrementalCache.get(key, {\n kind: routeKindToIncrementalCacheKind(context.routeKind),\n isRoutePPREnabled: context.isRoutePPREnabled,\n isFallback: context.isFallback,\n })\n : null\n\n if (previousIncrementalCacheEntry && !context.isOnDemandRevalidate) {\n resolve(previousIncrementalCacheEntry)\n resolved = true\n\n if (!previousIncrementalCacheEntry.isStale || context.isPrefetch) {\n // The cached value is still valid, so we don't need to update it yet.\n return previousIncrementalCacheEntry\n }\n }\n\n // Revalidate the cache entry\n const incrementalResponseCacheEntry = await this.revalidate(\n key,\n context.incrementalCache,\n context.isRoutePPREnabled,\n context.isFallback,\n responseGenerator,\n previousIncrementalCacheEntry,\n previousIncrementalCacheEntry !== null && !context.isOnDemandRevalidate,\n undefined,\n context.invocationID\n )\n\n // Handle null response\n if (!incrementalResponseCacheEntry) {\n // Remove the cache item if it was set so we don't use it again.\n if (this.minimal_mode) {\n const cacheKey = createCacheKey(key, context.invocationID)\n this.cache.remove(cacheKey)\n }\n return null\n }\n\n // Resolve for on-demand revalidation or if not already resolved\n if (context.isOnDemandRevalidate && !resolved) {\n return incrementalResponseCacheEntry\n }\n\n return incrementalResponseCacheEntry\n } catch (err) {\n // If we've already resolved the cache entry, we can't reject as we\n // already resolved the cache entry so log the error here.\n if (resolved) {\n console.error(err)\n return null\n }\n\n throw err\n }\n }\n\n /**\n * Revalidates the cache entry for the given key.\n *\n * @param key - The key to revalidate the cache entry for.\n * @param incrementalCache - The incremental cache to use to revalidate the cache entry.\n * @param isRoutePPREnabled - Whether the route is PPR enabled.\n * @param isFallback - Whether the route is a fallback.\n * @param responseGenerator - The response generator to use to generate the response cache entry.\n * @param previousIncrementalCacheEntry - The previous cache entry to use to revalidate the cache entry.\n * @param hasResolved - Whether the response has been resolved.\n * @param waitUntil - Optional function to register background work.\n * @param invocationID - The invocation ID for cache key scoping.\n * @returns The revalidated cache entry.\n */\n public async revalidate(\n key: string,\n incrementalCache: IncrementalResponseCache,\n isRoutePPREnabled: boolean,\n isFallback: boolean,\n responseGenerator: ResponseGenerator,\n previousIncrementalCacheEntry: IncrementalResponseCacheEntry | null,\n hasResolved: boolean,\n waitUntil?: (prom: Promise<any>) => void,\n invocationID?: string\n ) {\n return this.revalidateBatcher.batch(key, () => {\n const promise = this.handleRevalidate(\n key,\n incrementalCache,\n isRoutePPREnabled,\n isFallback,\n responseGenerator,\n previousIncrementalCacheEntry,\n hasResolved,\n invocationID\n )\n\n // We need to ensure background revalidates are passed to waitUntil.\n if (waitUntil) waitUntil(promise)\n\n return promise\n })\n }\n\n private async handleRevalidate(\n key: string,\n incrementalCache: IncrementalResponseCache,\n isRoutePPREnabled: boolean,\n isFallback: boolean,\n responseGenerator: ResponseGenerator,\n previousIncrementalCacheEntry: IncrementalResponseCacheEntry | null,\n hasResolved: boolean,\n invocationID: string | undefined\n ) {\n try {\n // Generate the response cache entry using the response generator.\n const responseCacheEntry = await responseGenerator({\n hasResolved,\n previousCacheEntry: previousIncrementalCacheEntry,\n isRevalidating: true,\n })\n if (!responseCacheEntry) {\n return null\n }\n\n // Convert the response cache entry to an incremental response cache entry.\n const incrementalResponseCacheEntry = await fromResponseCacheEntry({\n ...responseCacheEntry,\n isMiss: !previousIncrementalCacheEntry,\n })\n\n // We want to persist the result only if it has a cache control value\n // defined.\n if (incrementalResponseCacheEntry.cacheControl) {\n if (this.minimal_mode) {\n // Set TTL expiration for cache hit validation. Entries are validated\n // by invocationID when available, with TTL as a fallback for providers\n // that don't send x-invocation-id. Memory is managed by LRU eviction.\n const cacheKey = createCacheKey(key, invocationID)\n this.cache.set(cacheKey, {\n entry: incrementalResponseCacheEntry,\n expiresAt: Date.now() + this.ttl,\n })\n } else {\n await incrementalCache.set(key, incrementalResponseCacheEntry.value, {\n cacheControl: incrementalResponseCacheEntry.cacheControl,\n isRoutePPREnabled,\n isFallback,\n })\n }\n }\n\n return incrementalResponseCacheEntry\n } catch (err) {\n // When a path is erroring we automatically re-set the existing cache\n // with new revalidate and expire times to prevent non-stop retrying.\n if (previousIncrementalCacheEntry?.cacheControl) {\n const revalidate = Math.min(\n Math.max(\n previousIncrementalCacheEntry.cacheControl.revalidate || 3,\n 3\n ),\n 30\n )\n const expire =\n previousIncrementalCacheEntry.cacheControl.expire === undefined\n ? undefined\n : Math.max(\n revalidate + 3,\n previousIncrementalCacheEntry.cacheControl.expire\n )\n\n await incrementalCache.set(key, previousIncrementalCacheEntry.value, {\n cacheControl: { revalidate: revalidate, expire: expire },\n isRoutePPREnabled,\n isFallback,\n })\n }\n\n // We haven't resolved yet, so let's throw to indicate an error.\n throw err\n }\n }\n}\n","import type {\n WorkAsyncStorage,\n WorkStore,\n} from '../app-render/work-async-storage.external'\n\nimport { AppRenderSpan, NextNodeServerSpan } from './trace/constants'\nimport { getTracer, SpanKind } from './trace/tracer'\nimport {\n CACHE_ONE_YEAR,\n INFINITE_CACHE,\n NEXT_CACHE_TAG_MAX_ITEMS,\n NEXT_CACHE_TAG_MAX_LENGTH,\n} from '../../lib/constants'\nimport { markCurrentScopeAsDynamic } from '../app-render/dynamic-rendering'\nimport { makeHangingPromise } from '../dynamic-rendering-utils'\nimport type { FetchMetric } from '../base-http'\nimport { createDedupeFetch } from './dedupe-fetch'\nimport {\n getCacheSignal,\n type RevalidateStore,\n type WorkUnitAsyncStorage,\n} from '../app-render/work-unit-async-storage.external'\nimport {\n CachedRouteKind,\n IncrementalCacheKind,\n type CachedFetchData,\n type ServerComponentsHmrCache,\n type SetIncrementalFetchCacheContext,\n} from '../response-cache'\nimport { cloneResponse } from './clone-response'\nimport type { IncrementalCache } from './incremental-cache'\nimport { RenderStage } from '../app-render/staged-rendering'\n\nconst isEdgeRuntime = process.env.NEXT_RUNTIME === 'edge'\n\ntype Fetcher = typeof fetch\n\ntype PatchedFetcher = Fetcher & {\n readonly __nextPatched: true\n readonly __nextGetStaticStore: () => WorkAsyncStorage\n readonly _nextOriginalFetch: Fetcher\n}\n\nexport const NEXT_PATCH_SYMBOL = Symbol.for('next-patch')\n\nfunction isFetchPatched() {\n return (globalThis as Record<symbol, unknown>)[NEXT_PATCH_SYMBOL] === true\n}\n\nexport function validateRevalidate(\n revalidateVal: unknown,\n route: string\n): undefined | number {\n try {\n let normalizedRevalidate: number | undefined = undefined\n\n if (revalidateVal === false) {\n normalizedRevalidate = INFINITE_CACHE\n } else if (\n typeof revalidateVal === 'number' &&\n !isNaN(revalidateVal) &&\n revalidateVal > -1\n ) {\n normalizedRevalidate = revalidateVal\n } else if (typeof revalidateVal !== 'undefined') {\n throw new Error(\n `Invalid revalidate value \"${revalidateVal}\" on \"${route}\", must be a non-negative number or false`\n )\n }\n return normalizedRevalidate\n } catch (err: any) {\n // handle client component error from attempting to check revalidate value\n if (err instanceof Error && err.message.includes('Invalid revalidate')) {\n throw err\n }\n return undefined\n }\n}\n\nexport function validateTags(tags: any[], description: string) {\n const validTags: string[] = []\n const invalidTags: Array<{\n tag: any\n reason: string\n }> = []\n\n for (let i = 0; i < tags.length; i++) {\n const tag = tags[i]\n\n if (typeof tag !== 'string') {\n invalidTags.push({ tag, reason: 'invalid type, must be a string' })\n } else if (tag.length > NEXT_CACHE_TAG_MAX_LENGTH) {\n invalidTags.push({\n tag,\n reason: `exceeded max length of ${NEXT_CACHE_TAG_MAX_LENGTH}`,\n })\n } else {\n validTags.push(tag)\n }\n\n if (validTags.length > NEXT_CACHE_TAG_MAX_ITEMS) {\n console.warn(\n `Warning: exceeded max tag count for ${description}, dropped tags:`,\n tags.slice(i).join(', ')\n )\n break\n }\n }\n\n if (invalidTags.length > 0) {\n console.warn(`Warning: invalid tags passed to ${description}: `)\n\n for (const { tag, reason } of invalidTags) {\n console.log(`tag: \"${tag}\" ${reason}`)\n }\n }\n return validTags\n}\n\nfunction trackFetchMetric(\n workStore: WorkStore,\n ctx: Omit<FetchMetric, 'end' | 'idx'>\n) {\n if (!workStore.shouldTrackFetchMetrics) {\n return\n }\n\n workStore.fetchMetrics ??= []\n\n workStore.fetchMetrics.push({\n ...ctx,\n end: performance.timeOrigin + performance.now(),\n idx: workStore.nextFetchId || 0,\n })\n}\n\nasync function createCachedPrerenderResponse(\n res: Response,\n cacheKey: string,\n incrementalCacheContext: SetIncrementalFetchCacheContext | undefined,\n incrementalCache: IncrementalCache,\n revalidate: number,\n handleUnlock: () => Promise<void> | void\n): Promise<Response> {\n // We are prerendering at build time or revalidate time with cacheComponents so we\n // need to buffer the response so we can guarantee it can be read in a\n // microtask.\n const bodyBuffer = await res.arrayBuffer()\n\n const fetchedData = {\n headers: Object.fromEntries(res.headers.entries()),\n body: Buffer.from(bodyBuffer).toString('base64'),\n status: res.status,\n url: res.url,\n }\n\n // We can skip setting the serverComponentsHmrCache because we aren't in dev\n // mode.\n\n if (incrementalCacheContext) {\n await incrementalCache.set(\n cacheKey,\n { kind: CachedRouteKind.FETCH, data: fetchedData, revalidate },\n incrementalCacheContext\n )\n }\n\n await handleUnlock()\n\n // We return a new Response to the caller.\n return new Response(bodyBuffer, {\n headers: res.headers,\n status: res.status,\n statusText: res.statusText,\n })\n}\n\nasync function createCachedDynamicResponse(\n workStore: WorkStore,\n res: Response,\n cacheKey: string,\n incrementalCacheContext: SetIncrementalFetchCacheContext | undefined,\n incrementalCache: IncrementalCache,\n serverComponentsHmrCache: ServerComponentsHmrCache | undefined,\n revalidate: number,\n input: RequestInfo | URL,\n handleUnlock: () => Promise<void> | void\n): Promise<Response> {\n // We're cloning the response using this utility because there exists a bug in\n // the undici library around response cloning. See the following pull request\n // for more details: https://github.com/vercel/next.js/pull/73274\n const [cloned1, cloned2] = cloneResponse(res)\n\n // We are dynamically rendering including dev mode. We want to return the\n // response to the caller as soon as possible because it might stream over a\n // very long time.\n const cacheSetPromise = cloned1\n .arrayBuffer()\n .then(async (arrayBuffer) => {\n const bodyBuffer = Buffer.from(arrayBuffer)\n\n const fetchedData = {\n headers: Object.fromEntries(cloned1.headers.entries()),\n body: bodyBuffer.toString('base64'),\n status: cloned1.status,\n url: cloned1.url,\n }\n\n serverComponentsHmrCache?.set(cacheKey, fetchedData)\n\n if (incrementalCacheContext) {\n await incrementalCache.set(\n cacheKey,\n { kind: CachedRouteKind.FETCH, data: fetchedData, revalidate },\n incrementalCacheContext\n )\n }\n })\n .catch((error) => console.warn(`Failed to set fetch cache`, input, error))\n .finally(handleUnlock)\n\n const pendingRevalidateKey = `cache-set-${cacheKey}`\n const pendingRevalidates = (workStore.pendingRevalidates ??= {})\n\n let pendingRevalidatePromise = Promise.resolve()\n if (pendingRevalidateKey in pendingRevalidates) {\n // There is already a pending revalidate entry that we need to await to\n // avoid race conditions.\n pendingRevalidatePromise = pendingRevalidates[pendingRevalidateKey]\n }\n\n pendingRevalidates[pendingRevalidateKey] = pendingRevalidatePromise\n .then(() => cacheSetPromise)\n .finally(() => {\n // If the pending revalidate is not present in the store, then we have\n // nothing to delete.\n if (!pendingRevalidates?.[pendingRevalidateKey]) {\n return\n }\n\n delete pendingRevalidates[pendingRevalidateKey]\n })\n\n return cloned2\n}\n\ninterface PatchableModule {\n workAsyncStorage: WorkAsyncStorage\n workUnitAsyncStorage: WorkUnitAsyncStorage\n}\n\nexport function createPatchedFetcher(\n originFetch: Fetcher,\n { workAsyncStorage, workUnitAsyncStorage }: PatchableModule\n): PatchedFetcher {\n // Create the patched fetch function.\n const patched = async function fetch(\n input: RequestInfo | URL,\n init: RequestInit | undefined\n ): Promise<Response> {\n let url: URL | undefined\n try {\n url = new URL(input instanceof Request ? input.url : input)\n url.username = ''\n url.password = ''\n } catch {\n // Error caused by malformed URL should be handled by native fetch\n url = undefined\n }\n const fetchUrl = url?.href ?? ''\n const method = init?.method?.toUpperCase() || 'GET'\n\n // Do create a new span trace for internal fetches in the\n // non-verbose mode.\n const isInternal = (init?.next as any)?.internal === true\n const hideSpan = process.env.NEXT_OTEL_FETCH_DISABLED === '1'\n // We don't track fetch metrics for internal fetches\n // so it's not critical that we have a start time, as it won't be recorded.\n // This is to workaround a flaky issue where performance APIs might\n // not be available and will require follow-up investigation.\n const fetchStart: number | undefined = isInternal\n ? undefined\n : performance.timeOrigin + performance.now()\n\n const workStore = workAsyncStorage.getStore()\n const workUnitStore = workUnitAsyncStorage.getStore()\n\n let cacheSignal = workUnitStore ? getCacheSignal(workUnitStore) : null\n if (cacheSignal) {\n cacheSignal.beginRead()\n }\n\n const result = getTracer().trace(\n isInternal ? NextNodeServerSpan.internalFetch : AppRenderSpan.fetch,\n {\n hideSpan,\n kind: SpanKind.CLIENT,\n spanName: ['fetch', method, fetchUrl].filter(Boolean).join(' '),\n attributes: {\n 'http.url': fetchUrl,\n 'http.method': method,\n 'net.peer.name': url?.hostname,\n 'net.peer.port': url?.port || undefined,\n },\n },\n async () => {\n // If this is an internal fetch, we should not do any special treatment.\n if (isInternal) {\n return originFetch(input, init)\n }\n\n // If the workStore is not available, we can't do any\n // special treatment of fetch, therefore fallback to the original\n // fetch implementation.\n if (!workStore) {\n return originFetch(input, init)\n }\n\n // We should also fallback to the original fetch implementation if we\n // are in draft mode, it does not constitute a static generation.\n if (workStore.isDraftMode) {\n return originFetch(input, init)\n }\n\n const isRequestInput =\n input &&\n typeof input === 'object' &&\n typeof (input as Request).method === 'string'\n\n const getRequestMeta = (field: string) => {\n // If request input is present but init is not, retrieve from input first.\n const value = (init as any)?.[field]\n return value || (isRequestInput ? (input as any)[field] : null)\n }\n\n let finalRevalidate: number | undefined = undefined\n const getNextField = (field: 'revalidate' | 'tags') => {\n return typeof init?.next?.[field] !== 'undefined'\n ? init?.next?.[field]\n : isRequestInput\n ? (input as any).next?.[field]\n : undefined\n }\n // RequestInit doesn't keep extra fields e.g. next so it's\n // only available if init is used separate\n const originalFetchRevalidate = getNextField('revalidate')\n let currentFetchRevalidate = originalFetchRevalidate\n const tags: string[] = validateTags(\n getNextField('tags') || [],\n `fetch ${input.toString()}`\n )\n\n let revalidateStore: RevalidateStore | undefined\n\n if (workUnitStore) {\n switch (workUnitStore.type) {\n case 'prerender':\n case 'prerender-runtime':\n // TODO: Stop accumulating tags in client prerender. (fallthrough)\n case 'prerender-client':\n case 'prerender-ppr':\n case 'prerender-legacy':\n case 'cache':\n case 'private-cache':\n revalidateStore = workUnitStore\n break\n case 'request':\n case 'unstable-cache':\n break\n default:\n workUnitStore satisfies never\n }\n }\n\n if (revalidateStore) {\n if (Array.isArray(tags)) {\n // Collect tags onto parent caches or parent prerenders.\n const collectedTags =\n revalidateStore.tags ?? (revalidateStore.tags = [])\n for (const tag of tags) {\n if (!collectedTags.includes(tag)) {\n collectedTags.push(tag)\n }\n }\n }\n }\n\n const implicitTags = workUnitStore?.implicitTags\n\n let pageFetchCacheMode = workStore.fetchCache\n\n if (workUnitStore) {\n switch (workUnitStore.type) {\n case 'unstable-cache':\n // Inside unstable-cache we treat it the same as force-no-store on\n // the page.\n pageFetchCacheMode = 'force-no-store'\n break\n case 'prerender':\n case 'prerender-client':\n case 'prerender-runtime':\n case 'prerender-ppr':\n case 'prerender-legacy':\n case 'request':\n case 'cache':\n case 'private-cache':\n break\n default:\n workUnitStore satisfies never\n }\n }\n\n const isUsingNoStore = !!workStore.isUnstableNoStore\n\n let currentFetchCacheConfig = getRequestMeta('cache')\n let cacheReason = ''\n let cacheWarning: string | undefined\n\n if (\n typeof currentFetchCacheConfig === 'string' &&\n typeof currentFetchRevalidate !== 'undefined'\n ) {\n // If the revalidate value conflicts with the cache value, we should warn the user and unset the conflicting values.\n const isConflictingRevalidate =\n // revalidate: 0 and cache: force-cache\n (currentFetchCacheConfig === 'force-cache' &&\n currentFetchRevalidate === 0) ||\n // revalidate: >0 or revalidate: false and cache: no-store\n (currentFetchCacheConfig === 'no-store' &&\n (currentFetchRevalidate > 0 || currentFetchRevalidate === false))\n\n if (isConflictingRevalidate) {\n cacheWarning = `Specified \"cache: ${currentFetchCacheConfig}\" and \"revalidate: ${currentFetchRevalidate}\", only one should be specified.`\n currentFetchCacheConfig = undefined\n currentFetchRevalidate = undefined\n }\n }\n\n const hasExplicitFetchCacheOptOut =\n // fetch config itself signals not to cache\n currentFetchCacheConfig === 'no-cache' ||\n currentFetchCacheConfig === 'no-store' ||\n // the fetch isn't explicitly caching and the segment level cache config signals not to cache\n // note: `pageFetchCacheMode` is also set by being in an unstable_cache context.\n pageFetchCacheMode === 'force-no-store' ||\n pageFetchCacheMode === 'only-no-store'\n\n // If no explicit fetch cache mode is set, but dynamic = `force-dynamic` is set,\n // we shouldn't consider caching the fetch. This is because the `dynamic` cache\n // is considered a \"top-level\" cache mode, whereas something like `fetchCache` is more\n // fine-grained. Top-level modes are responsible for setting reasonable defaults for the\n // other configurations.\n const noFetchConfigAndForceDynamic =\n !pageFetchCacheMode &&\n !currentFetchCacheConfig &&\n !currentFetchRevalidate &&\n workStore.forceDynamic\n\n if (\n // force-cache was specified without a revalidate value. We set the revalidate value to false\n // which will signal the cache to not revalidate\n currentFetchCacheConfig === 'force-cache' &&\n typeof currentFetchRevalidate === 'undefined'\n ) {\n currentFetchRevalidate = false\n } else if (\n hasExplicitFetchCacheOptOut ||\n noFetchConfigAndForceDynamic\n ) {\n currentFetchRevalidate = 0\n }\n\n if (\n currentFetchCacheConfig === 'no-cache' ||\n currentFetchCacheConfig === 'no-store'\n ) {\n cacheReason = `cache: ${currentFetchCacheConfig}`\n }\n\n finalRevalidate = validateRevalidate(\n currentFetchRevalidate,\n workStore.route\n )\n\n const _headers = getRequestMeta('headers')\n const initHeaders: Headers =\n typeof _headers?.get === 'function'\n ? _headers\n : new Headers(_headers || {})\n\n const hasUnCacheableHeader =\n initHeaders.get('authorization') || initHeaders.get('cookie')\n\n const isUnCacheableMethod = !['get', 'head'].includes(\n getRequestMeta('method')?.toLowerCase() || 'get'\n )\n\n /**\n * We automatically disable fetch caching under the following conditions:\n * - Fetch cache configs are not set. Specifically:\n * - A page fetch cache mode is not set (export const fetchCache=...)\n * - A fetch cache mode is not set in the fetch call (fetch(url, { cache: ... }))\n * or the fetch cache mode is set to 'default'\n * - A fetch revalidate value is not set in the fetch call (fetch(url, { revalidate: ... }))\n * - OR the fetch comes after a configuration that triggered dynamic rendering (e.g., reading cookies())\n * and the fetch was considered uncacheable (e.g., POST method or has authorization headers)\n */\n const hasNoExplicitCacheConfig =\n // eslint-disable-next-line eqeqeq\n pageFetchCacheMode == undefined &&\n // eslint-disable-next-line eqeqeq\n (currentFetchCacheConfig == undefined ||\n // when considering whether to opt into the default \"no-cache\" fetch semantics,\n // a \"default\" cache config should be treated the same as no cache config\n currentFetchCacheConfig === 'default') &&\n // eslint-disable-next-line eqeqeq\n currentFetchRevalidate == undefined\n\n let autoNoCache = Boolean(\n (hasUnCacheableHeader || isUnCacheableMethod) &&\n revalidateStore?.revalidate === 0\n )\n\n let isImplicitBuildTimeCache = false\n\n if (!autoNoCache && hasNoExplicitCacheConfig) {\n // We don't enable automatic no-cache behavior during build-time\n // prerendering so that we can still leverage the fetch cache between\n // export workers.\n if (workStore.isBuildTimePrerendering) {\n isImplicitBuildTimeCache = true\n } else {\n autoNoCache = true\n }\n }\n\n // If we have no cache config, and we're in Dynamic I/O prerendering,\n // it'll be a dynamic call. We don't have to issue that dynamic call.\n if (hasNoExplicitCacheConfig && workUnitStore !== undefined) {\n switch (workUnitStore.type) {\n case 'prerender':\n case 'prerender-runtime':\n // While we don't want to do caching in the client scope we know the\n // fetch will be dynamic for cacheComponents so we may as well avoid the\n // call here. (fallthrough)\n case 'prerender-client':\n if (cacheSignal) {\n cacheSignal.endRead()\n cacheSignal = null\n }\n\n return makeHangingPromise<Response>(\n workUnitStore.renderSignal,\n workStore.route,\n 'fetch()'\n )\n case 'request':\n if (\n process.env.NODE_ENV === 'development' &&\n workUnitStore.stagedRendering\n ) {\n if (cacheSignal) {\n cacheSignal.endRead()\n cacheSignal = null\n }\n await workUnitStore.stagedRendering.waitForStage(\n RenderStage.Dynamic\n )\n }\n break\n case 'prerender-ppr':\n case 'prerender-legacy':\n case 'cache':\n case 'private-cache':\n case 'unstable-cache':\n break\n default:\n workUnitStore satisfies never\n }\n }\n\n switch (pageFetchCacheMode) {\n case 'force-no-store': {\n cacheReason = 'fetchCache = force-no-store'\n break\n }\n case 'only-no-store': {\n if (\n currentFetchCacheConfig === 'force-cache' ||\n (typeof finalRevalidate !== 'undefined' && finalRevalidate > 0)\n ) {\n throw new Error(\n `cache: 'force-cache' used on fetch for ${fetchUrl} with 'export const fetchCache = 'only-no-store'`\n )\n }\n cacheReason = 'fetchCache = only-no-store'\n break\n }\n case 'only-cache': {\n if (currentFetchCacheConfig === 'no-store') {\n throw new Error(\n `cache: 'no-store' used on fetch for ${fetchUrl} with 'export const fetchCache = 'only-cache'`\n )\n }\n break\n }\n case 'force-cache': {\n if (\n typeof currentFetchRevalidate === 'undefined' ||\n currentFetchRevalidate === 0\n ) {\n cacheReason = 'fetchCache = force-cache'\n finalRevalidate = INFINITE_CACHE\n }\n break\n }\n case 'default-cache':\n case 'default-no-store':\n case 'auto':\n case undefined:\n // sometimes we won't match the above cases. the reason we don't move\n // everything to this switch is the use of autoNoCache which is not a fetchCacheMode\n // I suspect this could be unified with fetchCacheMode however in which case we could\n // simplify the switch case and ensure we have an exhaustive switch handling all modes\n break\n default:\n pageFetchCacheMode satisfies never\n }\n\n if (typeof finalRevalidate === 'undefined') {\n if (pageFetchCacheMode === 'default-cache' && !isUsingNoStore) {\n finalRevalidate = INFINITE_CACHE\n cacheReason = 'fetchCache = default-cache'\n } else if (pageFetchCacheMode === 'default-no-store') {\n finalRevalidate = 0\n cacheReason = 'fetchCache = default-no-store'\n } else if (isUsingNoStore) {\n finalRevalidate = 0\n cacheReason = 'noStore call'\n } else if (autoNoCache) {\n finalRevalidate = 0\n cacheReason = 'auto no cache'\n } else {\n // TODO: should we consider this case an invariant?\n cacheReason = 'auto cache'\n finalRevalidate = revalidateStore\n ? revalidateStore.revalidate\n : INFINITE_CACHE\n }\n } else if (!cacheReason) {\n cacheReason = `revalidate: ${finalRevalidate}`\n }\n\n if (\n // when force static is configured we don't bail from\n // `revalidate: 0` values\n !(workStore.forceStatic && finalRevalidate === 0) &&\n // we don't consider autoNoCache to switch to dynamic for ISR\n !autoNoCache &&\n // If the revalidate value isn't currently set or the value is less\n // than the current revalidate value, we should update the revalidate\n // value.\n revalidateStore &&\n finalRevalidate < revalidateStore.revalidate\n ) {\n // If we were setting the revalidate value to 0, we should try to\n // postpone instead first.\n if (finalRevalidate === 0) {\n if (workUnitStore) {\n switch (workUnitStore.type) {\n case 'prerender':\n case 'prerender-client':\n case 'prerender-runtime':\n if (cacheSignal) {\n cacheSignal.endRead()\n cacheSignal = null\n }\n return makeHangingPromise<Response>(\n workUnitStore.renderSignal,\n workStore.route,\n 'fetch()'\n )\n case 'request':\n if (\n process.env.NODE_ENV === 'development' &&\n workUnitStore.stagedRendering\n ) {\n if (cacheSignal) {\n cacheSignal.endRead()\n cacheSignal = null\n }\n await workUnitStore.stagedRendering.waitForStage(\n RenderStage.Dynamic\n )\n }\n break\n case 'prerender-ppr':\n case 'prerender-legacy':\n case 'cache':\n case 'private-cache':\n case 'unstable-cache':\n break\n default:\n workUnitStore satisfies never\n }\n }\n\n markCurrentScopeAsDynamic(\n workStore,\n workUnitStore,\n `revalidate: 0 fetch ${input} ${workStore.route}`\n )\n }\n\n // We only want to set the revalidate store's revalidate time if it\n // was explicitly set for the fetch call, i.e.\n // originalFetchRevalidate.\n if (revalidateStore && originalFetchRevalidate === finalRevalidate) {\n revalidateStore.revalidate = finalRevalidate\n }\n }\n\n const isCacheableRevalidate =\n typeof finalRevalidate === 'number' && finalRevalidate > 0\n\n let cacheKey: string | undefined\n const { incrementalCache } = workStore\n let isHmrRefresh = false\n let serverComponentsHmrCache: ServerComponentsHmrCache | undefined\n\n if (workUnitStore) {\n switch (workUnitStore.type) {\n case 'request':\n case 'cache':\n case 'private-cache':\n isHmrRefresh = workUnitStore.isHmrRefresh ?? false\n serverComponentsHmrCache = workUnitStore.serverComponentsHmrCache\n break\n case 'prerender':\n case 'prerender-client':\n case 'prerender-runtime':\n case 'prerender-ppr':\n case 'prerender-legacy':\n case 'unstable-cache':\n break\n default:\n workUnitStore satisfies never\n }\n }\n\n if (\n incrementalCache &&\n (isCacheableRevalidate || serverComponentsHmrCache)\n ) {\n try {\n cacheKey = await incrementalCache.generateCacheKey(\n fetchUrl,\n isRequestInput ? (input as RequestInit) : init\n )\n } catch (err) {\n console.error(`Failed to generate cache key for`, input)\n }\n }\n\n const fetchIdx = workStore.nextFetchId ?? 1\n workStore.nextFetchId = fetchIdx + 1\n\n let handleUnlock: () => Promise<void> | void = () => {}\n\n const doOriginalFetch = async (\n isStale?: boolean,\n cacheReasonOverride?: string\n ) => {\n const requestInputFields = [\n 'cache',\n 'credentials',\n 'headers',\n 'integrity',\n 'keepalive',\n 'method',\n 'mode',\n 'redirect',\n 'referrer',\n 'referrerPolicy',\n 'window',\n 'duplex',\n\n // don't pass through signal when revalidating\n ...(isStale ? [] : ['signal']),\n ]\n\n if (isRequestInput) {\n const reqInput: Request = input as any\n const reqOptions: RequestInit = {\n body: (reqInput as any)._ogBody || reqInput.body,\n }\n\n for (const field of requestInputFields) {\n // @ts-expect-error custom fields\n reqOptions[field] = reqInput[field]\n }\n input = new Request(reqInput.url, reqOptions)\n } else if (init) {\n const { _ogBody, body, signal, ...otherInput } =\n init as RequestInit & { _ogBody?: any }\n init = {\n ...otherInput,\n body: _ogBody || body,\n signal: isStale ? undefined : signal,\n }\n }\n\n // add metadata to init without editing the original\n const clonedInit = {\n ...init,\n next: { ...init?.next, fetchType: 'origin', fetchIdx },\n }\n\n return originFetch(input, clonedInit)\n .then(async (res) => {\n if (!isStale && fetchStart) {\n trackFetchMetric(workStore, {\n start: fetchStart,\n url: fetchUrl,\n cacheReason: cacheReasonOverride || cacheReason,\n cacheStatus:\n finalRevalidate === 0 || cacheReasonOverride\n ? 'skip'\n : 'miss',\n cacheWarning,\n status: res.status,\n method: clonedInit.method || 'GET',\n })\n }\n if (\n res.status === 200 &&\n incrementalCache &&\n cacheKey &&\n (isCacheableRevalidate || serverComponentsHmrCache)\n ) {\n const normalizedRevalidate =\n finalRevalidate >= INFINITE_CACHE\n ? CACHE_ONE_YEAR\n : finalRevalidate\n\n const incrementalCacheConfig:\n | SetIncrementalFetchCacheContext\n | undefined = isCacheableRevalidate\n ? {\n fetchCache: true,\n fetchUrl,\n fetchIdx,\n tags,\n isImplicitBuildTimeCache,\n }\n : undefined\n\n switch (workUnitStore?.type) {\n case 'prerender':\n case 'prerender-client':\n case 'prerender-runtime':\n return createCachedPrerenderResponse(\n res,\n cacheKey,\n incrementalCacheConfig,\n incrementalCache,\n normalizedRevalidate,\n handleUnlock\n )\n case 'request':\n if (\n process.env.NODE_ENV === 'development' &&\n workUnitStore.stagedRendering &&\n workUnitStore.cacheSignal\n ) {\n // We're filling caches for a staged render,\n // so we need to wait for the response to finish instead of streaming.\n return createCachedPrerenderResponse(\n res,\n cacheKey,\n incrementalCacheConfig,\n incrementalCache,\n normalizedRevalidate,\n handleUnlock\n )\n }\n // fallthrough\n case 'prerender-ppr':\n case 'prerender-legacy':\n case 'cache':\n case 'private-cache':\n case 'unstable-cache':\n case undefined:\n return createCachedDynamicResponse(\n workStore,\n res,\n cacheKey,\n incrementalCacheConfig,\n incrementalCache,\n serverComponentsHmrCache,\n normalizedRevalidate,\n input,\n handleUnlock\n )\n default:\n workUnitStore satisfies never\n }\n }\n\n // we had response that we determined shouldn't be cached so we return it\n // and don't cache it. This also needs to unlock the cache lock we acquired.\n await handleUnlock()\n\n return res\n })\n .catch((error) => {\n handleUnlock()\n throw error\n })\n }\n\n let cacheReasonOverride\n let isForegroundRevalidate = false\n let isHmrRefreshCache = false\n\n if (cacheKey && incrementalCache) {\n let cachedFetchData: CachedFetchData | undefined\n\n if (isHmrRefresh && serverComponentsHmrCache) {\n cachedFetchData = serverComponentsHmrCache.get(cacheKey)\n isHmrRefreshCache = true\n }\n\n if (isCacheableRevalidate && !cachedFetchData) {\n handleUnlock = await incrementalCache.lock(cacheKey)\n const entry = workStore.isOnDemandRevalidate\n ? null\n : await incrementalCache.get(cacheKey, {\n kind: IncrementalCacheKind.FETCH,\n revalidate: finalRevalidate,\n fetchUrl,\n fetchIdx,\n tags,\n softTags: implicitTags?.tags,\n })\n\n if (hasNoExplicitCacheConfig && workUnitStore) {\n switch (workUnitStore.type) {\n case 'prerender':\n case 'prerender-client':\n case 'prerender-runtime':\n // We sometimes use the cache to dedupe fetches that do not\n // specify a cache configuration. In these cases we want to\n // make sure we still exclude them from prerenders if\n // cacheComponents is on so we introduce an artificial task boundary\n // here.\n await getTimeoutBoundary()\n break\n case 'request':\n if (\n process.env.NODE_ENV === 'development' &&\n workUnitStore.stagedRendering\n ) {\n await workUnitStore.stagedRendering.waitForStage(\n RenderStage.Dynamic\n )\n }\n break\n case 'prerender-ppr':\n case 'prerender-legacy':\n case 'cache':\n case 'private-cache':\n case 'unstable-cache':\n break\n default:\n workUnitStore satisfies never\n }\n }\n\n if (entry) {\n await handleUnlock()\n } else {\n // in dev, incremental cache response will be null in case the browser adds `cache-control: no-cache` in the request headers\n // TODO: it seems like we also hit this after revalidates in dev?\n cacheReasonOverride = 'cache-control: no-cache (hard refresh)'\n }\n\n if (entry?.value && entry.value.kind === CachedRouteKind.FETCH) {\n // when stale and is revalidating we wait for fresh data\n // so the revalidated entry has the updated data\n if (workStore.isStaticGeneration && entry.isStale) {\n isForegroundRevalidate = true\n } else {\n if (entry.isStale) {\n workStore.pendingRevalidates ??= {}\n if (!workStore.pendingRevalidates[cacheKey]) {\n const pendingRevalidate = doOriginalFetch(true)\n .then(async (response) => ({\n body: await response.arrayBuffer(),\n headers: response.headers,\n status: response.status,\n statusText: response.statusText,\n }))\n .finally(() => {\n workStore.pendingRevalidates ??= {}\n delete workStore.pendingRevalidates[cacheKey || '']\n })\n\n // Attach the empty catch here so we don't get a \"unhandled\n // promise rejection\" warning.\n pendingRevalidate.catch(console.error)\n\n workStore.pendingRevalidates[cacheKey] = pendingRevalidate\n }\n }\n\n cachedFetchData = entry.value.data\n }\n }\n }\n\n if (cachedFetchData) {\n if (fetchStart) {\n trackFetchMetric(workStore, {\n start: fetchStart,\n url: fetchUrl,\n cacheReason,\n cacheStatus: isHmrRefreshCache ? 'hmr' : 'hit',\n cacheWarning,\n status: cachedFetchData.status || 200,\n method: init?.method || 'GET',\n })\n }\n\n const response = new Response(\n Buffer.from(cachedFetchData.body, 'base64'),\n {\n headers: cachedFetchData.headers,\n status: cachedFetchData.status,\n }\n )\n\n Object.defineProperty(response, 'url', {\n value: cachedFetchData.url,\n })\n\n return response\n }\n }\n\n if (\n (workStore.isStaticGeneration ||\n (process.env.NODE_ENV === 'development' &&\n process.env.__NEXT_CACHE_COMPONENTS &&\n workUnitStore &&\n // eslint-disable-next-line no-restricted-syntax\n workUnitStore.type === 'request' &&\n workUnitStore.stagedRendering)) &&\n init &&\n typeof init === 'object'\n ) {\n const { cache } = init\n\n // Delete `cache` property as Cloudflare Workers will throw an error\n if (isEdgeRuntime) delete init.cache\n\n if (cache === 'no-store') {\n // If enabled, we should bail out of static generation.\n if (workUnitStore) {\n switch (workUnitStore.type) {\n case 'prerender':\n case 'prerender-client':\n case 'prerender-runtime':\n if (cacheSignal) {\n cacheSignal.endRead()\n cacheSignal = null\n }\n return makeHangingPromise<Response>(\n workUnitStore.renderSignal,\n workStore.route,\n 'fetch()'\n )\n case 'request':\n if (\n process.env.NODE_ENV === 'development' &&\n workUnitStore.stagedRendering\n ) {\n if (cacheSignal) {\n cacheSignal.endRead()\n cacheSignal = null\n }\n await workUnitStore.stagedRendering.waitForStage(\n RenderStage.Dynamic\n )\n }\n break\n case 'prerender-ppr':\n case 'prerender-legacy':\n case 'cache':\n case 'private-cache':\n case 'unstable-cache':\n break\n default:\n workUnitStore satisfies never\n }\n }\n markCurrentScopeAsDynamic(\n workStore,\n workUnitStore,\n `no-store fetch ${input} ${workStore.route}`\n )\n }\n\n const hasNextConfig = 'next' in init\n const { next = {} } = init\n if (\n typeof next.revalidate === 'number' &&\n revalidateStore &&\n next.revalidate < revalidateStore.revalidate\n ) {\n if (next.revalidate === 0) {\n // If enabled, we should bail out of static generation.\n if (workUnitStore) {\n switch (workUnitStore.type) {\n case 'prerender':\n case 'prerender-client':\n case 'prerender-runtime':\n return makeHangingPromise<Response>(\n workUnitStore.renderSignal,\n workStore.route,\n 'fetch()'\n )\n case 'request':\n if (\n process.env.NODE_ENV === 'development' &&\n workUnitStore.stagedRendering\n ) {\n await workUnitStore.stagedRendering.waitForStage(\n RenderStage.Dynamic\n )\n }\n break\n case 'cache':\n case 'private-cache':\n case 'unstable-cache':\n case 'prerender-legacy':\n case 'prerender-ppr':\n break\n default:\n workUnitStore satisfies never\n }\n }\n markCurrentScopeAsDynamic(\n workStore,\n workUnitStore,\n `revalidate: 0 fetch ${input} ${workStore.route}`\n )\n }\n\n if (!workStore.forceStatic || next.revalidate !== 0) {\n revalidateStore.revalidate = next.revalidate\n }\n }\n if (hasNextConfig) delete init.next\n }\n\n // if we are revalidating the whole page via time or on-demand and\n // the fetch cache entry is stale we should still de-dupe the\n // origin hit if it's a cache-able entry\n if (cacheKey && isForegroundRevalidate) {\n const pendingRevalidateKey = cacheKey\n workStore.pendingRevalidates ??= {}\n let pendingRevalidate =\n workStore.pendingRevalidates[pendingRevalidateKey]\n\n if (pendingRevalidate) {\n const revalidatedResult: {\n body: ArrayBuffer\n headers: Headers\n status: number\n statusText: string\n } = await pendingRevalidate\n return new Response(revalidatedResult.body, {\n headers: revalidatedResult.headers,\n status: revalidatedResult.status,\n statusText: revalidatedResult.statusText,\n })\n }\n\n // We used to just resolve the Response and clone it however for\n // static generation with cacheComponents we need the response to be able to\n // be resolved in a microtask and cloning the response will never have\n // a body that can resolve in a microtask in node (as observed through\n // experimentation) So instead we await the body and then when it is\n // available we construct manually cloned Response objects with the\n // body as an ArrayBuffer. This will be resolvable in a microtask\n // making it compatible with cacheComponents.\n const pendingResponse = doOriginalFetch(true, cacheReasonOverride)\n // We're cloning the response using this utility because there\n // exists a bug in the undici library around response cloning.\n // See the following pull request for more details:\n // https://github.com/vercel/next.js/pull/73274\n .then(cloneResponse)\n\n pendingRevalidate = pendingResponse\n .then(async (responses) => {\n const response = responses[0]\n return {\n body: await response.arrayBuffer(),\n headers: response.headers,\n status: response.status,\n statusText: response.statusText,\n }\n })\n .finally(() => {\n // If the pending revalidate is not present in the store, then\n // we have nothing to delete.\n if (!workStore.pendingRevalidates?.[pendingRevalidateKey]) {\n return\n }\n\n delete workStore.pendingRevalidates[pendingRevalidateKey]\n })\n\n // Attach the empty catch here so we don't get a \"unhandled promise\n // rejection\" warning\n pendingRevalidate.catch(() => {})\n\n workStore.pendingRevalidates[pendingRevalidateKey] = pendingRevalidate\n\n return pendingResponse.then((responses) => responses[1])\n } else {\n return doOriginalFetch(false, cacheReasonOverride)\n }\n }\n )\n\n if (cacheSignal) {\n try {\n return await result\n } finally {\n if (cacheSignal) {\n cacheSignal.endRead()\n }\n }\n }\n return result\n }\n\n // Attach the necessary properties to the patched fetch function.\n // We don't use this to determine if the fetch function has been patched,\n // but for external consumers to determine if the fetch function has been\n // patched.\n patched.__nextPatched = true as const\n patched.__nextGetStaticStore = () => workAsyncStorage\n patched._nextOriginalFetch = originFetch\n ;(globalThis as Record<symbol, unknown>)[NEXT_PATCH_SYMBOL] = true\n\n // Assign the function name also as a name property, so that it's preserved\n // even when mangling is enabled.\n Object.defineProperty(patched, 'name', { value: 'fetch', writable: false })\n\n return patched\n}\n\n// we patch fetch to collect cache information used for\n// determining if a page is static or not\nexport function patchFetch(options: PatchableModule) {\n // If we've already patched fetch, we should not patch it again.\n if (isFetchPatched()) return\n\n // Grab the original fetch function. We'll attach this so we can use it in\n // the patched fetch function.\n const original = createDedupeFetch(globalThis.fetch)\n\n // Set the global fetch to the patched fetch.\n globalThis.fetch = createPatchedFetcher(original, options)\n}\n\nlet currentTimeoutBoundary: null | Promise<void> = null\nfunction getTimeoutBoundary() {\n if (!currentTimeoutBoundary) {\n currentTimeoutBoundary = new Promise((r) => {\n setTimeout(() => {\n currentTimeoutBoundary = null\n r()\n }, 0)\n })\n }\n return currentTimeoutBoundary\n}\n","import type { IncrementalCache } from '../../lib/incremental-cache'\n\nimport { CACHE_ONE_YEAR } from '../../../lib/constants'\nimport { validateRevalidate, validateTags } from '../../lib/patch-fetch'\nimport {\n workAsyncStorage,\n type WorkStore,\n} from '../../app-render/work-async-storage.external'\nimport {\n getCacheSignal,\n getDraftModeProviderForCacheScope,\n workUnitAsyncStorage,\n} from '../../app-render/work-unit-async-storage.external'\nimport {\n CachedRouteKind,\n IncrementalCacheKind,\n type CachedFetchData,\n} from '../../response-cache'\nimport type {\n UnstableCacheStore,\n WorkUnitStore,\n} from '../../app-render/work-unit-async-storage.external'\n\ntype Callback = (...args: any[]) => Promise<any>\n\nlet noStoreFetchIdx = 0\n\nasync function cacheNewResult<T>(\n result: T,\n incrementalCache: IncrementalCache,\n cacheKey: string,\n tags: string[],\n revalidate: number | false | undefined,\n fetchIdx: number,\n fetchUrl: string\n): Promise<unknown> {\n await incrementalCache.set(\n cacheKey,\n {\n kind: CachedRouteKind.FETCH,\n data: {\n headers: {},\n // TODO: handle non-JSON values?\n body: JSON.stringify(result),\n status: 200,\n url: '',\n } satisfies CachedFetchData,\n revalidate: typeof revalidate !== 'number' ? CACHE_ONE_YEAR : revalidate,\n },\n { fetchCache: true, tags, fetchIdx, fetchUrl }\n )\n return\n}\n\n/**\n * This function allows you to cache the results of expensive operations, like database queries, and reuse them across multiple requests.\n *\n * Read more: [Next.js Docs: `unstable_cache`](https://nextjs.org/docs/app/api-reference/functions/unstable_cache)\n */\nexport function unstable_cache<T extends Callback>(\n cb: T,\n keyParts?: string[],\n options: {\n /**\n * The revalidation interval in seconds.\n */\n revalidate?: number | false\n tags?: string[]\n } = {}\n): T {\n if (options.revalidate === 0) {\n throw new Error(\n `Invariant revalidate: 0 can not be passed to unstable_cache(), must be \"false\" or \"> 0\" ${cb.toString()}`\n )\n }\n\n // Validate the tags provided are valid\n const tags = options.tags\n ? validateTags(options.tags, `unstable_cache ${cb.toString()}`)\n : []\n\n // Validate the revalidate options\n validateRevalidate(\n options.revalidate,\n `unstable_cache ${cb.name || cb.toString()}`\n )\n\n // Stash the fixed part of the key at construction time. The invocation key will combine\n // the fixed key with the arguments when actually called\n // @TODO if cb.toString() is long we should hash it\n // @TODO come up with a collision-free way to combine keyParts\n // @TODO consider validating the keyParts are all strings. TS can't provide runtime guarantees\n // and the error produced by accidentally using something that cannot be safely coerced is likely\n // hard to debug\n const fixedKey = `${cb.toString()}-${\n Array.isArray(keyParts) && keyParts.join(',')\n }`\n\n const cachedCb = async (...args: any[]) => {\n const workStore = workAsyncStorage.getStore()\n const workUnitStore = workUnitAsyncStorage.getStore()\n\n // We must be able to find the incremental cache otherwise we throw\n const maybeIncrementalCache:\n | import('../../lib/incremental-cache').IncrementalCache\n | undefined =\n workStore?.incrementalCache || (globalThis as any).__incrementalCache\n\n if (!maybeIncrementalCache) {\n throw new Error(\n `Invariant: incrementalCache missing in unstable_cache ${cb.toString()}`\n )\n }\n const incrementalCache = maybeIncrementalCache\n\n const cacheSignal = workUnitStore ? getCacheSignal(workUnitStore) : null\n if (cacheSignal) {\n cacheSignal.beginRead()\n }\n try {\n // If there's no request store, we aren't in a request (or we're not in\n // app router) and if there's no static generation store, we aren't in app\n // router. Default to an empty pathname and search params when there's no\n // request store or static generation store available.\n const fetchUrlPrefix =\n workStore && workUnitStore\n ? getFetchUrlPrefix(workStore, workUnitStore)\n : ''\n\n // Construct the complete cache key for this function invocation\n // @TODO stringify is likely not safe here. We will coerce undefined to null which will make\n // the keyspace smaller than the execution space\n const invocationKey = `${fixedKey}-${JSON.stringify(args)}`\n const cacheKey = await incrementalCache.generateCacheKey(invocationKey)\n // $urlWithPath,$sortedQueryStringKeys,$hashOfEveryThingElse\n const fetchUrl = `unstable_cache ${fetchUrlPrefix} ${cb.name ? ` ${cb.name}` : cacheKey}`\n const fetchIdx =\n (workStore ? workStore.nextFetchId : noStoreFetchIdx) ?? 1\n\n const implicitTags = workUnitStore?.implicitTags\n\n const innerCacheStore: UnstableCacheStore = {\n type: 'unstable-cache',\n phase: 'render',\n implicitTags,\n draftMode:\n workUnitStore &&\n workStore &&\n getDraftModeProviderForCacheScope(workStore, workUnitStore),\n }\n\n if (workStore) {\n workStore.nextFetchId = fetchIdx + 1\n\n // We are in an App Router context. We try to return the cached entry if it exists and is valid\n // If the entry is fresh we return it. If the entry is stale we return it but revalidate the entry in\n // the background. If the entry is missing or invalid we generate a new entry and return it.\n\n let isNestedUnstableCache = false\n\n if (workUnitStore) {\n switch (workUnitStore.type) {\n case 'cache':\n case 'private-cache':\n case 'prerender':\n case 'prerender-runtime':\n case 'prerender-ppr':\n case 'prerender-legacy':\n // We update the store's revalidate property if the option.revalidate is a higher precedence\n // options.revalidate === undefined doesn't affect timing.\n // options.revalidate === false doesn't shrink timing. it stays at the maximum.\n if (typeof options.revalidate === 'number') {\n if (workUnitStore.revalidate < options.revalidate) {\n // The store is already revalidating on a shorter time interval, leave it alone\n } else {\n workUnitStore.revalidate = options.revalidate\n }\n }\n\n // We need to accumulate the tags for this invocation within the store\n const collectedTags = workUnitStore.tags\n if (collectedTags === null) {\n workUnitStore.tags = tags.slice()\n } else {\n for (const tag of tags) {\n // @TODO refactor tags to be a set to avoid this O(n) lookup\n if (!collectedTags.includes(tag)) {\n collectedTags.push(tag)\n }\n }\n }\n break\n case 'unstable-cache':\n isNestedUnstableCache = true\n break\n case 'prerender-client':\n case 'request':\n break\n default:\n workUnitStore satisfies never\n }\n }\n\n if (\n // when we are nested inside of other unstable_cache's\n // we should bypass cache similar to fetches\n !isNestedUnstableCache &&\n workStore.fetchCache !== 'force-no-store' &&\n !workStore.isOnDemandRevalidate &&\n !incrementalCache.isOnDemandRevalidate &&\n !workStore.isDraftMode\n ) {\n // We attempt to get the current cache entry from the incremental cache.\n const cacheEntry = await incrementalCache.get(cacheKey, {\n kind: IncrementalCacheKind.FETCH,\n revalidate: options.revalidate,\n tags,\n softTags: implicitTags?.tags,\n fetchIdx,\n fetchUrl,\n })\n\n if (cacheEntry && cacheEntry.value) {\n // The entry exists and has a value\n if (cacheEntry.value.kind !== CachedRouteKind.FETCH) {\n // The entry is invalid and we need a special warning\n // @TODO why do we warn this way? Should this just be an error? How are these errors surfaced\n // so bugs can be reported\n // @TODO the invocation key can have sensitive data in it. we should not log this entire object\n console.error(\n `Invariant invalid cacheEntry returned for ${invocationKey}`\n )\n // will fall through to generating a new cache entry below\n } else {\n // We have a valid cache entry so we will be returning it. We also check to see if we need\n // to background revalidate it by checking if it is stale.\n const cachedResponse =\n cacheEntry.value.data.body !== undefined\n ? JSON.parse(cacheEntry.value.data.body)\n : undefined\n\n if (cacheEntry.isStale) {\n if (!workStore.pendingRevalidates) {\n workStore.pendingRevalidates = {}\n }\n\n // Check if there's already a pending revalidation to avoid duplicate work\n if (!workStore.pendingRevalidates[invocationKey]) {\n // Create the revalidation promise\n const revalidationPromise = workUnitAsyncStorage\n .run(innerCacheStore, cb, ...args)\n .then(async (result) => {\n await cacheNewResult(\n result,\n incrementalCache,\n cacheKey,\n tags,\n options.revalidate,\n fetchIdx,\n fetchUrl\n )\n return result\n })\n .catch((err) => {\n // @TODO This error handling seems wrong. We swallow the error?\n console.error(\n `revalidating cache with key: ${invocationKey}`,\n err\n )\n // Return the stale value on error for foreground revalidation\n return cachedResponse\n })\n\n // Attach the empty catch here so we don't get a \"unhandled promise\n // rejection\" warning. (Behavior is matched with patch-fetch)\n if (workStore.isStaticGeneration) {\n revalidationPromise.catch(() => {})\n }\n\n workStore.pendingRevalidates[invocationKey] =\n revalidationPromise\n }\n\n // Check if we need to do foreground revalidation\n if (workStore.isStaticGeneration) {\n // When the page is revalidating and the cache entry is stale,\n // we need to wait for fresh data (blocking revalidate)\n return workStore.pendingRevalidates[invocationKey]\n }\n // Otherwise, we're doing background revalidation - return stale immediately\n }\n\n // We had a valid cache entry so we return it here\n return cachedResponse\n }\n }\n }\n\n // If we got this far then we had an invalid cache entry and need to generate a new one\n const result = await workUnitAsyncStorage.run(\n innerCacheStore,\n cb,\n ...args\n )\n\n if (!workStore.isDraftMode) {\n if (!workStore.pendingRevalidates) {\n workStore.pendingRevalidates = {}\n }\n\n // We need to push the cache result promise to pending\n // revalidates otherwise it won't be awaited and is just\n // dangling\n workStore.pendingRevalidates[invocationKey] = cacheNewResult(\n result,\n incrementalCache,\n cacheKey,\n tags,\n options.revalidate,\n fetchIdx,\n fetchUrl\n )\n }\n\n return result\n } else {\n noStoreFetchIdx += 1\n // We are in Pages Router or were called outside of a render. We don't have a store\n // so we just call the callback directly when it needs to run.\n // If the entry is fresh we return it. If the entry is stale we return it but revalidate the entry in\n // the background. If the entry is missing or invalid we generate a new entry and return it.\n\n if (!incrementalCache.isOnDemandRevalidate) {\n // We aren't doing an on demand revalidation so we check use the cache if valid\n const cacheEntry = await incrementalCache.get(cacheKey, {\n kind: IncrementalCacheKind.FETCH,\n revalidate: options.revalidate,\n tags,\n fetchIdx,\n fetchUrl,\n softTags: implicitTags?.tags,\n })\n\n if (cacheEntry && cacheEntry.value) {\n // The entry exists and has a value\n if (cacheEntry.value.kind !== CachedRouteKind.FETCH) {\n // The entry is invalid and we need a special warning\n // @TODO why do we warn this way? Should this just be an error? How are these errors surfaced\n // so bugs can be reported\n console.error(\n `Invariant invalid cacheEntry returned for ${invocationKey}`\n )\n // will fall through to generating a new cache entry below\n } else if (!cacheEntry.isStale) {\n // We have a valid cache entry and it is fresh so we return it\n return cacheEntry.value.data.body !== undefined\n ? JSON.parse(cacheEntry.value.data.body)\n : undefined\n }\n }\n }\n\n // If we got this far then we had an invalid cache entry and need to generate a new one\n const result = await workUnitAsyncStorage.run(\n innerCacheStore,\n cb,\n ...args\n )\n\n // we need to wait setting the new cache result here as\n // we don't have pending revalidates on workStore to\n // push to and we can't have a dangling promise\n await cacheNewResult(\n result,\n incrementalCache,\n cacheKey,\n tags,\n options.revalidate,\n fetchIdx,\n fetchUrl\n )\n return result\n }\n } finally {\n if (cacheSignal) {\n cacheSignal.endRead()\n }\n }\n }\n // TODO: once AsyncLocalStorage.run() returns the correct types this override will no longer be necessary\n return cachedCb as unknown as T\n}\n\nfunction getFetchUrlPrefix(\n workStore: WorkStore,\n workUnitStore: WorkUnitStore\n): string {\n switch (workUnitStore.type) {\n case 'request':\n const pathname = workUnitStore.url.pathname\n const searchParams = new URLSearchParams(workUnitStore.url.search)\n\n const sortedSearch = [...searchParams.keys()]\n .sort((a, b) => a.localeCompare(b))\n .map((key) => `${key}=${searchParams.get(key)}`)\n .join('&')\n\n return `${pathname}${sortedSearch.length ? '?' : ''}${sortedSearch}`\n case 'prerender':\n case 'prerender-client':\n case 'prerender-runtime':\n case 'prerender-ppr':\n case 'prerender-legacy':\n case 'cache':\n case 'private-cache':\n case 'unstable-cache':\n return workStore.route\n default:\n return workUnitStore satisfies never\n }\n}\n","class UrlNode {\n placeholder: boolean = true\n children: Map<string, UrlNode> = new Map()\n slugName: string | null = null\n restSlugName: string | null = null\n optionalRestSlugName: string | null = null\n\n insert(urlPath: string): void {\n this._insert(urlPath.split('/').filter(Boolean), [], false)\n }\n\n smoosh(): string[] {\n return this._smoosh()\n }\n\n private _smoosh(prefix: string = '/'): string[] {\n const childrenPaths = [...this.children.keys()].sort()\n if (this.slugName !== null) {\n childrenPaths.splice(childrenPaths.indexOf('[]'), 1)\n }\n if (this.restSlugName !== null) {\n childrenPaths.splice(childrenPaths.indexOf('[...]'), 1)\n }\n if (this.optionalRestSlugName !== null) {\n childrenPaths.splice(childrenPaths.indexOf('[[...]]'), 1)\n }\n\n const routes = childrenPaths\n .map((c) => this.children.get(c)!._smoosh(`${prefix}${c}/`))\n .reduce((prev, curr) => [...prev, ...curr], [])\n\n if (this.slugName !== null) {\n routes.push(\n ...this.children.get('[]')!._smoosh(`${prefix}[${this.slugName}]/`)\n )\n }\n\n if (!this.placeholder) {\n const r = prefix === '/' ? '/' : prefix.slice(0, -1)\n if (this.optionalRestSlugName != null) {\n throw new Error(\n `You cannot define a route with the same specificity as a optional catch-all route (\"${r}\" and \"${r}[[...${this.optionalRestSlugName}]]\").`\n )\n }\n\n routes.unshift(r)\n }\n\n if (this.restSlugName !== null) {\n routes.push(\n ...this.children\n .get('[...]')!\n ._smoosh(`${prefix}[...${this.restSlugName}]/`)\n )\n }\n\n if (this.optionalRestSlugName !== null) {\n routes.push(\n ...this.children\n .get('[[...]]')!\n ._smoosh(`${prefix}[[...${this.optionalRestSlugName}]]/`)\n )\n }\n\n return routes\n }\n\n private _insert(\n urlPaths: string[],\n slugNames: string[],\n isCatchAll: boolean\n ): void {\n if (urlPaths.length === 0) {\n this.placeholder = false\n return\n }\n\n if (isCatchAll) {\n throw new Error(`Catch-all must be the last part of the URL.`)\n }\n\n // The next segment in the urlPaths list\n let nextSegment = urlPaths[0]\n\n // Check if the segment matches `[something]`\n if (nextSegment.startsWith('[') && nextSegment.endsWith(']')) {\n // Strip `[` and `]`, leaving only `something`\n let segmentName = nextSegment.slice(1, -1)\n\n let isOptional = false\n if (segmentName.startsWith('[') && segmentName.endsWith(']')) {\n // Strip optional `[` and `]`, leaving only `something`\n segmentName = segmentName.slice(1, -1)\n isOptional = true\n }\n\n if (segmentName.startsWith('…')) {\n throw new Error(\n `Detected a three-dot character ('…') at ('${segmentName}'). Did you mean ('...')?`\n )\n }\n\n if (segmentName.startsWith('...')) {\n // Strip `...`, leaving only `something`\n segmentName = segmentName.substring(3)\n isCatchAll = true\n }\n\n if (segmentName.startsWith('[') || segmentName.endsWith(']')) {\n throw new Error(\n `Segment names may not start or end with extra brackets ('${segmentName}').`\n )\n }\n\n if (segmentName.startsWith('.')) {\n throw new Error(\n `Segment names may not start with erroneous periods ('${segmentName}').`\n )\n }\n\n function handleSlug(previousSlug: string | null, nextSlug: string) {\n if (previousSlug !== null) {\n // If the specific segment already has a slug but the slug is not `something`\n // This prevents collisions like:\n // pages/[post]/index.js\n // pages/[id]/index.js\n // Because currently multiple dynamic params on the same segment level are not supported\n if (previousSlug !== nextSlug) {\n // TODO: This error seems to be confusing for users, needs an error link, the description can be based on above comment.\n throw new Error(\n `You cannot use different slug names for the same dynamic path ('${previousSlug}' !== '${nextSlug}').`\n )\n }\n }\n\n slugNames.forEach((slug) => {\n if (slug === nextSlug) {\n throw new Error(\n `You cannot have the same slug name \"${nextSlug}\" repeat within a single dynamic path`\n )\n }\n\n if (slug.replace(/\\W/g, '') === nextSegment.replace(/\\W/g, '')) {\n throw new Error(\n `You cannot have the slug names \"${slug}\" and \"${nextSlug}\" differ only by non-word symbols within a single dynamic path`\n )\n }\n })\n\n slugNames.push(nextSlug)\n }\n\n if (isCatchAll) {\n if (isOptional) {\n if (this.restSlugName != null) {\n throw new Error(\n `You cannot use both an required and optional catch-all route at the same level (\"[...${this.restSlugName}]\" and \"${urlPaths[0]}\" ).`\n )\n }\n\n handleSlug(this.optionalRestSlugName, segmentName)\n // slugName is kept as it can only be one particular slugName\n this.optionalRestSlugName = segmentName\n // nextSegment is overwritten to [[...]] so that it can later be sorted specifically\n nextSegment = '[[...]]'\n } else {\n if (this.optionalRestSlugName != null) {\n throw new Error(\n `You cannot use both an optional and required catch-all route at the same level (\"[[...${this.optionalRestSlugName}]]\" and \"${urlPaths[0]}\").`\n )\n }\n\n handleSlug(this.restSlugName, segmentName)\n // slugName is kept as it can only be one particular slugName\n this.restSlugName = segmentName\n // nextSegment is overwritten to [...] so that it can later be sorted specifically\n nextSegment = '[...]'\n }\n } else {\n if (isOptional) {\n throw new Error(\n `Optional route parameters are not yet supported (\"${urlPaths[0]}\").`\n )\n }\n handleSlug(this.slugName, segmentName)\n // slugName is kept as it can only be one particular slugName\n this.slugName = segmentName\n // nextSegment is overwritten to [] so that it can later be sorted specifically\n nextSegment = '[]'\n }\n }\n\n // If this UrlNode doesn't have the nextSegment yet we create a new child UrlNode\n if (!this.children.has(nextSegment)) {\n this.children.set(nextSegment, new UrlNode())\n }\n\n this.children\n .get(nextSegment)!\n ._insert(urlPaths.slice(1), slugNames, isCatchAll)\n }\n}\n\n/**\n * @deprecated Use `sortSortableRoutes` or `sortPages` instead.\n */\nexport function getSortedRoutes(\n normalizedPages: ReadonlyArray<string>\n): string[] {\n // First the UrlNode is created, and every UrlNode can have only 1 dynamic segment\n // Eg you can't have pages/[post]/abc.js and pages/[hello]/something-else.js\n // Only 1 dynamic segment per nesting level\n\n // So in the case that is test/integration/dynamic-routing it'll be this:\n // pages/[post]/comments.js\n // pages/blog/[post]/comment/[id].js\n // Both are fine because `pages/[post]` and `pages/blog` are on the same level\n // So in this case `UrlNode` created here has `this.slugName === 'post'`\n // And since your PR passed through `slugName` as an array basically it'd including it in too many possibilities\n // Instead what has to be passed through is the upwards path's dynamic names\n const root = new UrlNode()\n\n // Here the `root` gets injected multiple paths, and insert will break them up into sublevels\n normalizedPages.forEach((pagePath) => root.insert(pagePath))\n // Smoosh will then sort those sublevels up to the point where you get the correct route definition priority\n return root.smoosh()\n}\n\n/**\n * @deprecated Use `sortSortableRouteObjects` or `sortPageObjects` instead.\n */\nexport function getSortedRouteObjects<T>(\n objects: T[],\n getter: (obj: T) => string\n): T[] {\n // We're assuming here that all the pathnames are unique, that way we can\n // sort the list and use the index as the key.\n const indexes: Record<string, number> = {}\n const pathnames: string[] = []\n for (let i = 0; i < objects.length; i++) {\n const pathname = getter(objects[i])\n indexes[pathname] = i\n pathnames[i] = pathname\n }\n\n // Sort the pathnames.\n const sorted = getSortedRoutes(pathnames)\n\n // Map the sorted pathnames back to the original objects using the new sorted\n // index.\n return sorted.map((pathname) => objects[indexes[pathname]])\n}\n","/**\n * For a given page path, this function ensures that there is a leading slash.\n * If there is not a leading slash, one is added, otherwise it is noop.\n */\nexport function ensureLeadingSlash(path: string) {\n return path.startsWith('/') ? path : `/${path}`\n}\n","import type { FlightRouterState, Segment } from './app-router-types'\n\nexport function getSegmentValue(segment: Segment) {\n return Array.isArray(segment) ? segment[1] : segment\n}\n\nexport function isGroupSegment(segment: string) {\n // Use array[0] for performant purpose\n return segment[0] === '(' && segment.endsWith(')')\n}\n\nexport function isParallelRouteSegment(segment: string) {\n return segment.startsWith('@') && segment !== '@children'\n}\n\nexport function addSearchParamsIfPageSegment(\n segment: Segment,\n searchParams: Record<string, string | string[] | undefined>\n) {\n const isPageSegment = segment.includes(PAGE_SEGMENT_KEY)\n\n if (isPageSegment) {\n const stringifiedQuery = JSON.stringify(searchParams)\n return stringifiedQuery !== '{}'\n ? PAGE_SEGMENT_KEY + '?' + stringifiedQuery\n : PAGE_SEGMENT_KEY\n }\n\n return segment\n}\n\nexport function computeSelectedLayoutSegment(\n segments: string[] | null,\n parallelRouteKey: string\n): string | null {\n if (!segments || segments.length === 0) {\n return null\n }\n\n // For 'children', use first segment; for other parallel routes, use last segment\n const rawSegment =\n parallelRouteKey === 'children'\n ? segments[0]\n : segments[segments.length - 1]\n\n // If the default slot is showing, return null since it's not technically \"selected\" (it's a fallback)\n // Returning an internal value like `__DEFAULT__` would be confusing\n return rawSegment === DEFAULT_SEGMENT_KEY ? null : rawSegment\n}\n\n/** Get the canonical parameters from the current level to the leaf node. */\nexport function getSelectedLayoutSegmentPath(\n tree: FlightRouterState,\n parallelRouteKey: string,\n first = true,\n segmentPath: string[] = []\n): string[] {\n let node: FlightRouterState\n if (first) {\n // Use the provided parallel route key on the first parallel route\n node = tree[1][parallelRouteKey]\n } else {\n // After first parallel route prefer children, if there's no children pick the first parallel route.\n const parallelRoutes = tree[1]\n node = parallelRoutes.children ?? Object.values(parallelRoutes)[0]\n }\n\n if (!node) return segmentPath\n const segment = node[0]\n\n let segmentValue = getSegmentValue(segment)\n\n if (!segmentValue || segmentValue.startsWith(PAGE_SEGMENT_KEY)) {\n return segmentPath\n }\n\n segmentPath.push(segmentValue)\n\n return getSelectedLayoutSegmentPath(\n node,\n parallelRouteKey,\n false,\n segmentPath\n )\n}\n\nexport const PAGE_SEGMENT_KEY = '__PAGE__'\nexport const DEFAULT_SEGMENT_KEY = '__DEFAULT__'\nexport const NOT_FOUND_SEGMENT_KEY = '/_not-found'\n","import { ensureLeadingSlash } from '../../page-path/ensure-leading-slash'\nimport { isGroupSegment } from '../../segment'\n\n/**\n * Normalizes an app route so it represents the actual request path. Essentially\n * performing the following transformations:\n *\n * - `/(dashboard)/user/[id]/page` to `/user/[id]`\n * - `/(dashboard)/account/page` to `/account`\n * - `/user/[id]/page` to `/user/[id]`\n * - `/account/page` to `/account`\n * - `/page` to `/`\n * - `/(dashboard)/user/[id]/route` to `/user/[id]`\n * - `/(dashboard)/account/route` to `/account`\n * - `/user/[id]/route` to `/user/[id]`\n * - `/account/route` to `/account`\n * - `/route` to `/`\n * - `/` to `/`\n *\n * @param route the app route to normalize\n * @returns the normalized pathname\n */\nexport function normalizeAppPath(route: string) {\n return ensureLeadingSlash(\n route.split('/').reduce((pathname, segment, index, segments) => {\n // Empty segments are ignored.\n if (!segment) {\n return pathname\n }\n\n // Groups are ignored.\n if (isGroupSegment(segment)) {\n return pathname\n }\n\n // Parallel segments are ignored.\n if (segment[0] === '@') {\n return pathname\n }\n\n // The last segment (if it's a leaf) should be ignored.\n if (\n (segment === 'page' || segment === 'route') &&\n index === segments.length - 1\n ) {\n return pathname\n }\n\n return `${pathname}/${segment}`\n }, '')\n )\n}\n\n/**\n * Strips the `.rsc` extension if it's in the pathname.\n * Since this function is used on full urls it checks `?` for searchParams handling.\n */\nexport function normalizeRscURL(url: string) {\n return url.replace(\n /\\.rsc($|\\?)/,\n // $1 ensures `?` is preserved\n '$1'\n )\n}\n","import { normalizeAppPath } from './app-paths'\n\n// order matters here, the first match will be used\nexport const INTERCEPTION_ROUTE_MARKERS = [\n '(..)(..)',\n '(.)',\n '(..)',\n '(...)',\n] as const\n\nexport type InterceptionMarker = (typeof INTERCEPTION_ROUTE_MARKERS)[number]\n\nexport function isInterceptionRouteAppPath(path: string): boolean {\n // TODO-APP: add more serious validation\n return (\n path\n .split('/')\n .find((segment) =>\n INTERCEPTION_ROUTE_MARKERS.find((m) => segment.startsWith(m))\n ) !== undefined\n )\n}\n\ntype InterceptionRouteInformation = {\n /**\n * The intercepting route. This is the route that is being intercepted or the\n * route that the user was coming from. This is matched by the Next-Url\n * header.\n */\n interceptingRoute: string\n\n /**\n * The intercepted route. This is the route that is being intercepted or the\n * route that the user is going to. This is matched by the request pathname.\n */\n interceptedRoute: string\n}\n\nexport function extractInterceptionRouteInformation(\n path: string\n): InterceptionRouteInformation {\n let interceptingRoute: string | undefined\n let marker: (typeof INTERCEPTION_ROUTE_MARKERS)[number] | undefined\n let interceptedRoute: string | undefined\n\n for (const segment of path.split('/')) {\n marker = INTERCEPTION_ROUTE_MARKERS.find((m) => segment.startsWith(m))\n if (marker) {\n ;[interceptingRoute, interceptedRoute] = path.split(marker, 2)\n break\n }\n }\n\n if (!interceptingRoute || !marker || !interceptedRoute) {\n throw new Error(\n `Invalid interception route: ${path}. Must be in the format /<intercepting route>/(..|...|..)(..)/<intercepted route>`\n )\n }\n\n interceptingRoute = normalizeAppPath(interceptingRoute) // normalize the path, e.g. /(blog)/feed -> /feed\n\n switch (marker) {\n case '(.)':\n // (.) indicates that we should match with sibling routes, so we just need to append the intercepted route to the intercepting route\n if (interceptingRoute === '/') {\n interceptedRoute = `/${interceptedRoute}`\n } else {\n interceptedRoute = interceptingRoute + '/' + interceptedRoute\n }\n break\n case '(..)':\n // (..) indicates that we should match at one level up, so we need to remove the last segment of the intercepting route\n if (interceptingRoute === '/') {\n throw new Error(\n `Invalid interception route: ${path}. Cannot use (..) marker at the root level, use (.) instead.`\n )\n }\n interceptedRoute = interceptingRoute\n .split('/')\n .slice(0, -1)\n .concat(interceptedRoute)\n .join('/')\n break\n case '(...)':\n // (...) will match the route segment in the root directory, so we need to use the root directory to prepend the intercepted route\n interceptedRoute = '/' + interceptedRoute\n break\n case '(..)(..)':\n // (..)(..) indicates that we should match at two levels up, so we need to remove the last two segments of the intercepting route\n\n const splitInterceptingRoute = interceptingRoute.split('/')\n if (splitInterceptingRoute.length <= 2) {\n throw new Error(\n `Invalid interception route: ${path}. Cannot use (..)(..) marker at the root level or one level up.`\n )\n }\n\n interceptedRoute = splitInterceptingRoute\n .slice(0, -2)\n .concat(interceptedRoute)\n .join('/')\n break\n default:\n throw new Error('Invariant: unexpected marker')\n }\n\n return { interceptingRoute, interceptedRoute }\n}\n","import {\n extractInterceptionRouteInformation,\n isInterceptionRouteAppPath,\n} from './interception-routes'\n\n// Identify /.*[param].*/ in route string\nconst TEST_ROUTE = /\\/[^/]*\\[[^/]+\\][^/]*(?=\\/|$)/\n\n// Identify /[param]/ in route string\nconst TEST_STRICT_ROUTE = /\\/\\[[^/]+\\](?=\\/|$)/\n\n/**\n * Check if a route is dynamic.\n *\n * @param route - The route to check.\n * @param strict - Whether to use strict mode which prohibits segments with prefixes/suffixes (default: true).\n * @returns Whether the route is dynamic.\n */\nexport function isDynamicRoute(route: string, strict: boolean = true): boolean {\n if (isInterceptionRouteAppPath(route)) {\n route = extractInterceptionRouteInformation(route).interceptedRoute\n }\n\n if (strict) {\n return TEST_STRICT_ROUTE.test(route)\n }\n\n return TEST_ROUTE.test(route)\n}\n","export { getSortedRoutes, getSortedRouteObjects } from './sorted-routes'\nexport { isDynamicRoute } from './is-dynamic'\n","import {\n abortAndThrowOnSynchronousRequestDataAccess,\n postponeWithTracking,\n} from '../../app-render/dynamic-rendering'\nimport { isDynamicRoute } from '../../../shared/lib/router/utils'\nimport {\n NEXT_CACHE_IMPLICIT_TAG_ID,\n NEXT_CACHE_SOFT_TAG_MAX_LENGTH,\n} from '../../../lib/constants'\nimport { workAsyncStorage } from '../../app-render/work-async-storage.external'\nimport { workUnitAsyncStorage } from '../../app-render/work-unit-async-storage.external'\nimport { DynamicServerError } from '../../../client/components/hooks-server-context'\nimport { InvariantError } from '../../../shared/lib/invariant-error'\nimport {\n ActionDidRevalidateDynamicOnly,\n ActionDidRevalidateStaticAndDynamic as ActionDidRevalidate,\n} from '../../../shared/lib/action-revalidation-kind'\n\ntype CacheLifeConfig = {\n expire?: number\n}\n\n/**\n * This function allows you to purge [cached data](https://nextjs.org/docs/app/building-your-application/caching) on-demand for a specific cache tag.\n *\n * Read more: [Next.js Docs: `revalidateTag`](https://nextjs.org/docs/app/api-reference/functions/revalidateTag)\n */\nexport function revalidateTag(tag: string, profile: string | CacheLifeConfig) {\n if (!profile) {\n console.warn(\n '\"revalidateTag\" without the second argument is now deprecated, add second argument of \"max\" or use \"updateTag\". See more info here: https://nextjs.org/docs/messages/revalidate-tag-single-arg'\n )\n }\n return revalidate([tag], `revalidateTag ${tag}`, profile)\n}\n\n/**\n * This function allows you to update [cached data](https://nextjs.org/docs/app/building-your-application/caching) on-demand for a specific cache tag.\n * This can only be called from within a Server Action to enable read-your-own-writes semantics.\n *\n * Read more: [Next.js Docs: `updateTag`](https://nextjs.org/docs/app/api-reference/functions/updateTag)\n */\nexport function updateTag(tag: string) {\n const workStore = workAsyncStorage.getStore()\n\n // TODO: change this after investigating why phase: 'action' is\n // set for route handlers\n if (!workStore || workStore.page.endsWith('/route')) {\n throw new Error(\n 'updateTag can only be called from within a Server Action. ' +\n 'To invalidate cache tags in Route Handlers or other contexts, use revalidateTag instead. ' +\n 'See more info here: https://nextjs.org/docs/app/api-reference/functions/updateTag'\n )\n }\n // updateTag uses immediate expiration (no profile) without deprecation warning\n return revalidate([tag], `updateTag ${tag}`, undefined)\n}\n\n/**\n * This function allows you to refresh client cache from server actions.\n * It's useful as dynamic data can be cached on the client which won't\n * be refreshed by updateTag\n */\nexport function refresh() {\n const workStore = workAsyncStorage.getStore()\n const workUnitStore = workUnitAsyncStorage.getStore()\n\n if (\n !workStore ||\n workStore.page.endsWith('/route') ||\n workUnitStore?.phase !== 'action'\n ) {\n throw new Error(\n 'refresh can only be called from within a Server Action. ' +\n 'See more info here: https://nextjs.org/docs/app/api-reference/functions/refresh'\n )\n }\n\n if (workStore) {\n // The Server Action version of refresh() only revalidates the dynamic data\n // on the client. It doesn't affect cached data.\n workStore.pathWasRevalidated = ActionDidRevalidateDynamicOnly\n }\n}\n\n/**\n * This function allows you to purge [cached data](https://nextjs.org/docs/app/building-your-application/caching) on-demand for a specific path.\n *\n * Read more: [Next.js Docs: `revalidatePath`](https://nextjs.org/docs/app/api-reference/functions/revalidatePath)\n */\nexport function revalidatePath(originalPath: string, type?: 'layout' | 'page') {\n if (originalPath.length > NEXT_CACHE_SOFT_TAG_MAX_LENGTH) {\n console.warn(\n `Warning: revalidatePath received \"${originalPath}\" which exceeded max length of ${NEXT_CACHE_SOFT_TAG_MAX_LENGTH}. See more info here https://nextjs.org/docs/app/api-reference/functions/revalidatePath`\n )\n return\n }\n\n let normalizedPath = `${NEXT_CACHE_IMPLICIT_TAG_ID}${originalPath || '/'}`\n\n if (type) {\n normalizedPath += `${normalizedPath.endsWith('/') ? '' : '/'}${type}`\n } else if (isDynamicRoute(originalPath)) {\n console.warn(\n `Warning: a dynamic page path \"${originalPath}\" was passed to \"revalidatePath\", but the \"type\" parameter is missing. This has no effect by default, see more info here https://nextjs.org/docs/app/api-reference/functions/revalidatePath`\n )\n }\n\n const tags = [normalizedPath]\n if (normalizedPath === `${NEXT_CACHE_IMPLICIT_TAG_ID}/`) {\n tags.push(`${NEXT_CACHE_IMPLICIT_TAG_ID}/index`)\n } else if (normalizedPath === `${NEXT_CACHE_IMPLICIT_TAG_ID}/index`) {\n tags.push(`${NEXT_CACHE_IMPLICIT_TAG_ID}/`)\n }\n\n return revalidate(tags, `revalidatePath ${originalPath}`)\n}\n\nfunction revalidate(\n tags: string[],\n expression: string,\n profile?: string | CacheLifeConfig\n) {\n const store = workAsyncStorage.getStore()\n if (!store || !store.incrementalCache) {\n throw new Error(\n `Invariant: static generation store missing in ${expression}`\n )\n }\n\n const workUnitStore = workUnitAsyncStorage.getStore()\n if (workUnitStore) {\n if (workUnitStore.phase === 'render') {\n throw new Error(\n `Route ${store.route} used \"${expression}\" during render which is unsupported. To ensure revalidation is performed consistently it must always happen outside of renders and cached functions. See more info here: https://nextjs.org/docs/app/building-your-application/rendering/static-and-dynamic#dynamic-rendering`\n )\n }\n\n switch (workUnitStore.type) {\n case 'cache':\n case 'private-cache':\n throw new Error(\n `Route ${store.route} used \"${expression}\" inside a \"use cache\" which is unsupported. To ensure revalidation is performed consistently it must always happen outside of renders and cached functions. See more info here: https://nextjs.org/docs/app/building-your-application/rendering/static-and-dynamic#dynamic-rendering`\n )\n case 'unstable-cache':\n throw new Error(\n `Route ${store.route} used \"${expression}\" inside a function cached with \"unstable_cache(...)\" which is unsupported. To ensure revalidation is performed consistently it must always happen outside of renders and cached functions. See more info here: https://nextjs.org/docs/app/building-your-application/rendering/static-and-dynamic#dynamic-rendering`\n )\n case 'prerender':\n case 'prerender-runtime':\n // cacheComponents Prerender\n const error = new Error(\n `Route ${store.route} used ${expression} without first calling \\`await connection()\\`.`\n )\n return abortAndThrowOnSynchronousRequestDataAccess(\n store.route,\n expression,\n error,\n workUnitStore\n )\n case 'prerender-client':\n throw new InvariantError(\n `${expression} must not be used within a client component. Next.js should be preventing ${expression} from being included in client components statically, but did not in this case.`\n )\n case 'prerender-ppr':\n return postponeWithTracking(\n store.route,\n expression,\n workUnitStore.dynamicTracking\n )\n case 'prerender-legacy':\n workUnitStore.revalidate = 0\n\n const err = new DynamicServerError(\n `Route ${store.route} couldn't be rendered statically because it used \\`${expression}\\`. See more info here: https://nextjs.org/docs/messages/dynamic-server-error`\n )\n store.dynamicUsageDescription = expression\n store.dynamicUsageStack = err.stack\n\n throw err\n case 'request':\n if (process.env.NODE_ENV !== 'production') {\n // TODO: This is most likely incorrect. It would lead to the ISR\n // status being flipped when revalidating a static page with a server\n // action.\n workUnitStore.usedDynamic = true\n // TODO(restart-on-cache-miss): we should do a sync IO error here in dev\n // to match prerender behavior\n }\n break\n default:\n workUnitStore satisfies never\n }\n }\n\n if (!store.pendingRevalidatedTags) {\n store.pendingRevalidatedTags = []\n }\n\n for (const tag of tags) {\n const existingIndex = store.pendingRevalidatedTags.findIndex((item) => {\n if (item.tag !== tag) return false\n // Compare profiles: both strings, both objects, or both undefined\n if (typeof item.profile === 'string' && typeof profile === 'string') {\n return item.profile === profile\n }\n if (typeof item.profile === 'object' && typeof profile === 'object') {\n return JSON.stringify(item.profile) === JSON.stringify(profile)\n }\n return item.profile === profile\n })\n if (existingIndex === -1) {\n store.pendingRevalidatedTags.push({\n tag,\n profile,\n })\n }\n }\n\n // if profile is provided and this is a stale-while-revalidate\n // update we do not mark the path as revalidated so that server\n // actions don't pull their own writes\n const cacheLife =\n profile && typeof profile === 'object'\n ? profile\n : profile &&\n typeof profile === 'string' &&\n store?.cacheLifeProfiles?.[profile]\n ? store.cacheLifeProfiles[profile]\n : undefined\n\n if (!profile || cacheLife?.expire === 0) {\n // TODO: only revalidate if the path matches\n store.pathWasRevalidated = ActionDidRevalidate\n }\n}\n","import { workAsyncStorage } from '../../app-render/work-async-storage.external'\nimport { workUnitAsyncStorage } from '../../app-render/work-unit-async-storage.external'\nimport { markCurrentScopeAsDynamic } from '../../app-render/dynamic-rendering'\n\n/**\n * This function can be used to declaratively opt out of static rendering and indicate a particular component should not be cached.\n *\n * It marks the current scope as dynamic.\n *\n * - In [non-PPR](https://nextjs.org/docs/app/api-reference/next-config-js/partial-prerendering) cases this will make a static render\n * halt and mark the page as dynamic.\n * - In PPR cases this will postpone the render at this location.\n *\n * If we are inside a cache scope then this function does nothing.\n *\n * @note It expects to be called within App Router and will error otherwise.\n *\n * Read more: [Next.js Docs: `unstable_noStore`](https://nextjs.org/docs/app/api-reference/functions/unstable_noStore)\n */\nexport function unstable_noStore() {\n const callingExpression = 'unstable_noStore()'\n const store = workAsyncStorage.getStore()\n const workUnitStore = workUnitAsyncStorage.getStore()\n if (!store) {\n // This generally implies we are being called in Pages router. We should probably not support\n // unstable_noStore in contexts outside of `react-server` condition but since we historically\n // have not errored here previously, we maintain that behavior for now.\n return\n } else if (store.forceStatic) {\n return\n } else {\n store.isUnstableNoStore = true\n if (workUnitStore) {\n switch (workUnitStore.type) {\n case 'prerender':\n case 'prerender-client':\n case 'prerender-runtime':\n // unstable_noStore() is a noop in Dynamic I/O.\n return\n case 'prerender-ppr':\n case 'prerender-legacy':\n case 'request':\n case 'cache':\n case 'private-cache':\n case 'unstable-cache':\n break\n default:\n workUnitStore satisfies never\n }\n }\n markCurrentScopeAsDynamic(store, workUnitStore, callingExpression)\n }\n}\n","import { InvariantError } from '../../shared/lib/invariant-error'\nimport { workAsyncStorage } from '../app-render/work-async-storage.external'\nimport { workUnitAsyncStorage } from '../app-render/work-unit-async-storage.external'\n\nexport type CacheLife = {\n // How long the client can cache a value without checking with the server.\n stale?: number\n // How frequently you want the cache to refresh on the server.\n // Stale values may be served while revalidating.\n revalidate?: number\n // In the worst case scenario, where you haven't had traffic in a while,\n // how stale can a value be until you prefer deopting to dynamic.\n // Must be longer than revalidate.\n expire?: number\n}\n// The equivalent header is kind of like:\n// Cache-Control: max-age=[stale],s-max-age=[revalidate],stale-while-revalidate=[expire-revalidate],stale-if-error=[expire-revalidate]\n// Except that stale-while-revalidate/stale-if-error only applies to shared caches - not private caches.\n\n// The default revalidates relatively frequently but doesn't expire to ensure it's always\n// able to serve fast results but by default doesn't hang.\n\n// This gets overridden by the next-types-plugin\ntype CacheLifeProfiles =\n | 'default'\n | 'seconds'\n | 'minutes'\n | 'hours'\n | 'days'\n | 'weeks'\n | 'max'\n | (string & {})\n\nfunction validateCacheLife(profile: CacheLife) {\n if (profile.stale !== undefined) {\n if ((profile.stale as any) === false) {\n throw new Error(\n 'Pass `Infinity` instead of `false` if you want to cache on the client forever ' +\n 'without checking with the server.'\n )\n } else if (typeof profile.stale !== 'number') {\n throw new Error('The stale option must be a number of seconds.')\n }\n }\n if (profile.revalidate !== undefined) {\n if ((profile.revalidate as any) === false) {\n throw new Error(\n 'Pass `Infinity` instead of `false` if you do not want to revalidate by time.'\n )\n } else if (typeof profile.revalidate !== 'number') {\n throw new Error('The revalidate option must be a number of seconds.')\n }\n }\n if (profile.expire !== undefined) {\n if ((profile.expire as any) === false) {\n throw new Error(\n 'Pass `Infinity` instead of `false` if you want to cache on the server forever ' +\n 'without checking with the origin.'\n )\n } else if (typeof profile.expire !== 'number') {\n throw new Error('The expire option must be a number of seconds.')\n }\n }\n\n if (profile.revalidate !== undefined && profile.expire !== undefined) {\n if (profile.revalidate > profile.expire) {\n throw new Error(\n 'If providing both the revalidate and expire options, ' +\n 'the expire option must be greater than the revalidate option. ' +\n 'The expire option indicates how many seconds from the start ' +\n 'until it can no longer be used.'\n )\n }\n }\n}\n\nexport function cacheLife(profile: CacheLifeProfiles | CacheLife): void {\n if (!process.env.__NEXT_USE_CACHE) {\n throw new Error(\n '`cacheLife()` is only available with the `cacheComponents` config.'\n )\n }\n\n const workUnitStore = workUnitAsyncStorage.getStore()\n\n switch (workUnitStore?.type) {\n case 'prerender':\n case 'prerender-client':\n case 'prerender-runtime':\n case 'prerender-ppr':\n case 'prerender-legacy':\n case 'request':\n case 'unstable-cache':\n case undefined:\n throw new Error(\n '`cacheLife()` can only be called inside a \"use cache\" function.'\n )\n case 'cache':\n case 'private-cache':\n break\n default:\n workUnitStore satisfies never\n }\n\n if (typeof profile === 'string') {\n const workStore = workAsyncStorage.getStore()\n if (!workStore) {\n throw new Error(\n '`cacheLife()` can only be called during App Router rendering at the moment.'\n )\n }\n if (!workStore.cacheLifeProfiles) {\n throw new InvariantError('`cacheLifeProfiles` should always be provided.')\n }\n\n // TODO: This should be globally available and not require an AsyncLocalStorage.\n const configuredProfile = workStore.cacheLifeProfiles[profile]\n if (configuredProfile === undefined) {\n if (workStore.cacheLifeProfiles[profile.trim()]) {\n throw new Error(\n `Unknown \\`cacheLife()\\` profile \"${profile}\" is not configured in next.config.js\\n` +\n `Did you mean \"${profile.trim()}\" without the spaces?`\n )\n }\n throw new Error(\n `Unknown \\`cacheLife()\\` profile \"${profile}\" is not configured in next.config.js\\n` +\n 'module.exports = {\\n' +\n ' cacheLife: {\\n' +\n ` \"${profile}\": ...\\n` +\n ' }\\n' +\n '}'\n )\n }\n profile = configuredProfile\n } else if (\n typeof profile !== 'object' ||\n profile === null ||\n Array.isArray(profile)\n ) {\n throw new Error(\n 'Invalid `cacheLife()` option. Either pass a profile name or object.'\n )\n } else {\n validateCacheLife(profile)\n }\n\n if (profile.revalidate !== undefined) {\n // Track the explicit revalidate time.\n if (\n workUnitStore.explicitRevalidate === undefined ||\n workUnitStore.explicitRevalidate > profile.revalidate\n ) {\n workUnitStore.explicitRevalidate = profile.revalidate\n }\n }\n if (profile.expire !== undefined) {\n // Track the explicit expire time.\n if (\n workUnitStore.explicitExpire === undefined ||\n workUnitStore.explicitExpire > profile.expire\n ) {\n workUnitStore.explicitExpire = profile.expire\n }\n }\n if (profile.stale !== undefined) {\n // Track the explicit stale time.\n if (\n workUnitStore.explicitStale === undefined ||\n workUnitStore.explicitStale > profile.stale\n ) {\n workUnitStore.explicitStale = profile.stale\n }\n }\n}\n","import { workUnitAsyncStorage } from '../app-render/work-unit-async-storage.external'\nimport { validateTags } from '../lib/patch-fetch'\n\nexport function cacheTag(...tags: string[]): void {\n if (!process.env.__NEXT_USE_CACHE) {\n throw new Error(\n '`cacheTag()` is only available with the `cacheComponents` config.'\n )\n }\n\n const workUnitStore = workUnitAsyncStorage.getStore()\n\n switch (workUnitStore?.type) {\n case 'prerender':\n case 'prerender-client':\n case 'prerender-runtime':\n case 'prerender-ppr':\n case 'prerender-legacy':\n case 'request':\n case 'unstable-cache':\n case undefined:\n throw new Error(\n '`cacheTag()` can only be called inside a \"use cache\" function.'\n )\n case 'cache':\n case 'private-cache':\n break\n default:\n workUnitStore satisfies never\n }\n\n const validTags = validateTags(tags, '`cacheTag()`')\n\n if (!workUnitStore.tags) {\n workUnitStore.tags = validTags\n } else {\n workUnitStore.tags.push(...validTags)\n }\n}\n","const cacheExports = {\n unstable_cache: require('next/dist/server/web/spec-extension/unstable-cache')\n .unstable_cache,\n\n updateTag: require('next/dist/server/web/spec-extension/revalidate')\n .updateTag,\n\n revalidateTag: require('next/dist/server/web/spec-extension/revalidate')\n .revalidateTag,\n revalidatePath: require('next/dist/server/web/spec-extension/revalidate')\n .revalidatePath,\n\n refresh: require('next/dist/server/web/spec-extension/revalidate').refresh,\n\n unstable_noStore:\n require('next/dist/server/web/spec-extension/unstable-no-store')\n .unstable_noStore,\n cacheLife: require('next/dist/server/use-cache/cache-life').cacheLife,\n cacheTag: require('next/dist/server/use-cache/cache-tag').cacheTag,\n}\n\nlet didWarnCacheLife = false\nfunction unstable_cacheLife() {\n if (!didWarnCacheLife) {\n didWarnCacheLife = true\n const error = new Error(\n '`unstable_cacheLife` was recently stabilized and should be imported as `cacheLife`. The `unstable` prefixed form will be removed in a future version of Next.js.'\n )\n console.error(error)\n }\n return cacheExports.cacheLife.apply(this, arguments)\n}\n\nlet didWarnCacheTag = false\nfunction unstable_cacheTag() {\n if (!didWarnCacheTag) {\n didWarnCacheTag = true\n const error = new Error(\n '`unstable_cacheTag` was recently stabilized and should be imported as `cacheTag`. The `unstable` prefixed form will be removed in a future version of Next.js.'\n )\n console.error(error)\n }\n return cacheExports.cacheTag.apply(this, arguments)\n}\n\ncacheExports.unstable_cacheLife = unstable_cacheLife\ncacheExports.unstable_cacheTag = unstable_cacheTag\n\n// https://nodejs.org/api/esm.html#commonjs-namespaces\n// When importing CommonJS modules, the module.exports object is provided as the default export\nmodule.exports = cacheExports\n\n// make import { xxx } from 'next/cache' work\nexports.unstable_cache = cacheExports.unstable_cache\nexports.revalidatePath = cacheExports.revalidatePath\nexports.revalidateTag = cacheExports.revalidateTag\nexports.updateTag = cacheExports.updateTag\nexports.unstable_noStore = cacheExports.unstable_noStore\nexports.cacheLife = cacheExports.cacheLife\nexports.unstable_cacheLife = cacheExports.unstable_cacheLife\nexports.cacheTag = cacheExports.cacheTag\nexports.unstable_cacheTag = cacheExports.unstable_cacheTag\nexports.refresh = cacheExports.refresh\n","export {pickFolder as '0078a6c4a94b6c11932d9891cb3e033b153e53f741'} from 'ACTIONS_MODULE0'\nexport {listGitHubRepositories as '40c8daccf6fd712e278ed7a2b897db0b52697e11a7'} from 'ACTIONS_MODULE1'\nexport {importGitHubRepository as '408a911977ed31ce34aebc3a067ec3329e22bc458c'} from 'ACTIONS_MODULE2'\nexport {loadSettings as '00a3267766137548e7bc4c4fc2cd82d96c7f6bf292'} from 'ACTIONS_MODULE3'\nexport {getAvailableTerminals as '00e7e5c961151a095fae7dcc185da8176ef08df82b'} from 'ACTIONS_MODULE4'\nexport {updateSettingsAction as '40a42248485dc9a49daf53ab9f5f907f7203ed0f81'} from 'ACTIONS_MODULE5'\nexport {getAllAgentModels as '005405e33a575fd7fef0856afab08d6908b311c095'} from 'ACTIONS_MODULE6'\nexport {updateAgentAndModel as '60010c6015fae17dab78f4eaedcd652d8a425311c4'} from 'ACTIONS_MODULE7'\n","'use server';\n\nimport { revalidatePath } from 'next/cache';\nimport { resolve } from '@/lib/server-container';\nimport type { LoadSettingsUseCase } from '@shepai/core/application/use-cases/settings/load-settings.use-case';\nimport type { UpdateSettingsUseCase } from '@shepai/core/application/use-cases/settings/update-settings.use-case';\nimport { updateSettings as updateSettingsSingleton } from '@shepai/core/infrastructure/services/settings.service';\nimport type { Settings } from '@shepai/core/domain/generated/output';\n\ntype DeepPartial<T> = {\n [K in keyof T]?: T[K] extends object ? DeepPartial<T[K]> : T[K];\n};\n\nfunction deepMerge<T extends Record<string, unknown>>(target: T, source: DeepPartial<T>): T {\n const result = { ...target };\n for (const key of Object.keys(source) as (keyof T)[]) {\n const sourceVal = source[key];\n if (sourceVal === undefined) continue;\n\n const targetVal = target[key];\n if (\n targetVal !== null &&\n targetVal !== undefined &&\n typeof targetVal === 'object' &&\n !Array.isArray(targetVal) &&\n !(targetVal instanceof Date) &&\n sourceVal !== null &&\n typeof sourceVal === 'object' &&\n !Array.isArray(sourceVal) &&\n !(sourceVal instanceof Date)\n ) {\n result[key] = deepMerge(\n targetVal as Record<string, unknown>,\n sourceVal as DeepPartial<Record<string, unknown>>\n ) as T[keyof T];\n } else {\n result[key] = sourceVal as T[keyof T];\n }\n }\n return result;\n}\n\nexport interface UpdateSettingsResult {\n success: boolean;\n error?: string;\n}\n\nexport async function updateSettingsAction(\n partial: DeepPartial<Settings>\n): Promise<UpdateSettingsResult> {\n try {\n const loadUseCase = resolve<LoadSettingsUseCase>('LoadSettingsUseCase');\n const current = await loadUseCase.execute();\n\n const merged = deepMerge(\n current as unknown as Record<string, unknown>,\n partial as DeepPartial<Record<string, unknown>>\n ) as Settings;\n merged.updatedAt = new Date();\n\n const updateUseCase = resolve<UpdateSettingsUseCase>('UpdateSettingsUseCase');\n await updateUseCase.execute(merged);\n\n updateSettingsSingleton(merged);\n\n revalidatePath('/', 'layout');\n\n return { success: true };\n } catch (error: unknown) {\n const message = error instanceof Error ? error.message : 'Failed to update settings';\n return { success: false, error: message };\n }\n}\n"],"names":["ACTION_SUFFIX","APP_DIR_ALIAS","CACHE_ONE_YEAR","DOT_NEXT_ALIAS","ESLINT_DEFAULT_DIRS","GSP_NO_RETURNED_VALUE","GSSP_COMPONENT_MEMBER_ERROR","GSSP_NO_RETURNED_VALUE","HTML_CONTENT_TYPE_HEADER","INFINITE_CACHE","INSTRUMENTATION_HOOK_FILENAME","JSON_CONTENT_TYPE_HEADER","MATCHED_PATH_HEADER","MIDDLEWARE_FILENAME","MIDDLEWARE_LOCATION_REGEXP","NEXT_BODY_SUFFIX","NEXT_CACHE_IMPLICIT_TAG_ID","NEXT_CACHE_REVALIDATED_TAGS_HEADER","NEXT_CACHE_REVALIDATE_TAG_TOKEN_HEADER","NEXT_CACHE_SOFT_TAG_MAX_LENGTH","NEXT_CACHE_TAGS_HEADER","NEXT_CACHE_TAG_MAX_ITEMS","NEXT_CACHE_TAG_MAX_LENGTH","NEXT_DATA_SUFFIX","NEXT_INTERCEPTION_MARKER_PREFIX","NEXT_META_SUFFIX","NEXT_QUERY_PARAM_PREFIX","NEXT_RESUME_HEADER","NON_STANDARD_NODE_ENV","PAGES_DIR_ALIAS","PRERENDER_REVALIDATE_HEADER","PRERENDER_REVALIDATE_ONLY_GENERATED_HEADER","PROXY_FILENAME","PROXY_LOCATION_REGEXP","PUBLIC_DIR_MIDDLEWARE_CONFLICT","ROOT_DIR_ALIAS","RSC_ACTION_CLIENT_WRAPPER_ALIAS","RSC_ACTION_ENCRYPTION_ALIAS","RSC_ACTION_PROXY_ALIAS","RSC_ACTION_VALIDATE_ALIAS","RSC_CACHE_WRAPPER_ALIAS","RSC_DYNAMIC_IMPORT_WRAPPER_ALIAS","RSC_MOD_REF_PROXY_ALIAS","RSC_SEGMENTS_DIR_SUFFIX","RSC_SEGMENT_SUFFIX","RSC_SUFFIX","SERVER_PROPS_EXPORT_ERROR","SERVER_PROPS_GET_INIT_PROPS_CONFLICT","SERVER_PROPS_SSG_CONFLICT","SERVER_RUNTIME","SSG_FALLBACK_EXPORT_ERROR","SSG_GET_INITIAL_PROPS_CONFLICT","STATIC_STATUS_PAGE_GET_INITIAL_PROPS_ERROR","TEXT_PLAIN_CONTENT_TYPE_HEADER","UNSTABLE_REVALIDATE_RENAME_ERROR","WEBPACK_LAYERS","WEBPACK_RESOURCE_QUERIES","WEB_SOCKET_MAX_RECONNECTIONS","edge","experimentalEdge","nodejs","WEBPACK_LAYERS_NAMES","shared","reactServerComponents","serverSideRendering","actionBrowser","apiNode","apiEdge","middleware","instrument","edgeAsset","appPagesBrowser","pagesDirBrowser","pagesDirEdge","pagesDirNode","GROUP","builtinReact","serverOnly","neutralTarget","clientOnly","bundled","appPages","edgeSSREntry","metadata","metadataRoute","metadataImageMeta","AppRenderSpan","AppRouteRouteHandlersSpan","BaseServerSpan","LoadComponentsSpan","LogSpanAllowList","MiddlewareSpan","NextNodeServerSpan","NextServerSpan","NextVanillaSpanAllowlist","NodeSpan","RenderSpan","ResolveMetadataSpan","RouterSpan","StartServerSpan","Set","isThenable","promise","then","BubbledError","SpanKind","SpanStatusCode","getTracer","isBubbledError","NEXT_OTEL_PERFORMANCE_PREFIX","process","env","api","NEXT_RUNTIME","require","err","context","propagation","trace","ROOT_CONTEXT","Error","constructor","bubble","result","error","closeSpanWithError","span","setAttribute","recordException","name","setStatus","code","ERROR","message","end","rootSpanAttributesStore","Map","rootSpanIdKey","createContextKey","lastSpanId","getSpanId","clientTraceDataSetter","set","carrier","key","value","push","NextTracerImpl","getTracerInstance","getContext","getTracePropagationData","activeContext","active","entries","inject","getActiveScopeSpan","getSpan","withPropagatedContext","fn","getter","getSpanContext","remoteContext","extract","with","args","type","fnOrOptions","fnOrEmpty","options","spanName","has","NEXT_OTEL_VERBOSE","hideSpan","spanContext","parentSpan","existingRootSpanId","getValue","isRootSpan","spanId","attributes","setValue","startActiveSpan","startTime","globalThis","performance","now","undefined","cleanedUp","onCleanup","delete","measure","split","pop","replace","match","toLowerCase","start","Object","length","res","catch","finally","wrap","tracer","optionsObj","apply","arguments","lastArgId","cb","scopeBoundCb","bind","_span","done","startSpan","setSpan","getRootSpanAttributes","get","setRootSpanAttribute","withSpan","cloneResponse","noop","registry","FinalizationRegistry","weakRef","stream","deref","locked","cancel","original","body","body1","body2","tee","cloned1","Response","status","statusText","headers","defineProperty","url","configurable","enumerable","writable","register","WeakRef","cloned2","createDedupeFetch","simpleCacheKey","headersToExcludeInCacheKey","generateCacheKey","request","filteredHeaders","Array","from","filter","JSON","stringify","method","mode","redirect","credentials","referrer","referrerPolicy","integrity","originalFetch","getCacheEntries","React","cache","dedupeFetch","resource","signal","cacheKey","URL","Request","keepalive","cacheEntries","i","j","response","InvariantError","entry","CachedRouteKind","IncrementalCacheKind","DetachedPromise","resolve","reject","Promise","rej","Batcher","cacheKeyFn","schedulerFn","pending","create","batch","LRUCache","LRUNode","data","size","prev","next","SentinelNode","maxSize","calculateSize","onEvict","totalSize","head","tail","addToHead","node","removeNode","moveToHead","removeTail","lastNode","console","warn","existing","newNode","Symbol","iterator","current","remove","currentSize","bgBlack","bgBlue","bgCyan","bgGreen","bgMagenta","bgRed","bgWhite","bgYellow","black","blue","bold","cyan","dim","gray","green","hidden","inverse","italic","magenta","purple","red","reset","strikethrough","underline","white","yellow","stdout","enabled","NO_COLOR","FORCE_COLOR","isTTY","CI","TERM","replaceClose","str","close","index","substring","nextIndex","indexOf","formatter","open","String","input","string","s","bootstrap","errorOnce","event","info","prefixes","ready","wait","warnOnce","LOGGING_METHOD","log","prefixedLog","prefixType","shift","consoleMethod","prefix","warnOnceCache","join","errorOnceCache","ENCODED_TAGS","OPENING","HTML","Uint8Array","BODY","CLOSED","HEAD","BODY_AND_HTML","META","ICON_MARK","indexOfUint8Array","isEquivalentUint8Arrays","removeFromUint8Array","a","b","completeMatch","tagIndex","subarray","removed","slice","MISSING_ROOT_TAGS_ERROR","insertBuildIdComment","DOCTYPE_PREFIX","MAX_BUILD_ID_LENGTH","escapeBuildId","buildId","truncated","originalHtml","includes","startsWith","ACTION_HEADER","FLIGHT_HEADERS","NEXT_ACTION_NOT_FOUND_HEADER","NEXT_ACTION_REVALIDATED_HEADER","NEXT_DID_POSTPONE_HEADER","NEXT_HMR_REFRESH_HASH_COOKIE","NEXT_HMR_REFRESH_HEADER","NEXT_HTML_REQUEST_ID_HEADER","NEXT_IS_PRERENDER_HEADER","NEXT_REQUEST_ID_HEADER","NEXT_REWRITTEN_PATH_HEADER","NEXT_REWRITTEN_QUERY_HEADER","NEXT_ROUTER_PREFETCH_HEADER","NEXT_ROUTER_SEGMENT_PREFETCH_HEADER","NEXT_ROUTER_STALE_TIME_HEADER","NEXT_ROUTER_STATE_TREE_HEADER","NEXT_RSC_UNION_QUERY","NEXT_URL","RSC_CONTENT_TYPE_HEADER","RSC_HEADER","djb2Hash","hexHash","hash","char","charCodeAt","toString","computeCacheBustingSearchParam","prefetchHeader","segmentPrefetchHeader","stateTreeHeader","nextUrlHeader","chainStreams","continueDynamicHTMLResume","continueDynamicPrerender","continueFizzStream","continueStaticFallbackPrerender","continueStaticPrerender","createBufferedTransformStream","createDocumentClosingStream","createRootLayoutValidatorStream","renderToInitialFizzStream","streamFromBuffer","streamFromString","streamToBuffer","streamToString","streamToUint8Array","voidCatch","encoder","TextEncoder","streams","ReadableStream","controller","readable","TransformStream","pipeTo","preventClose","nextStream","lastStream","enqueue","encode","chunk","streamToChunks","reader","getReader","chunks","read","concatUint8Arrays","totalLength","reduce","sum","offset","Buffer","concat","decoder","TextDecoder","fatal","aborted","decode","maxBufferByteLength","Infinity","bufferedChunks","bufferByteLength","flush","copiedBytes","bufferedChunk","byteLength","scheduleFlush","detached","scheduleImmediate","transform","createPrefetchCommentStream","isBuildTimePrerendering","didTransformFirstChunk","chunkStr","updatedChunkStr","ReactDOMServer","element","streamOptions","renderToReadableStream","createMetadataTransformStream","insert","chunkIndex","isMarkRemoved","iconMarkIndex","closedHeadIndex","iconMarkLength","replaced","insertion","encodedInsertion","insertionLength","createHeadInsertionTransformStream","inserted","hasBytes","insertedHeadContent","createClientResumeScriptInsertionTransformStream","segmentPath","cacheBustingHeader","searchStr","NEXT_CLIENT_RESUME_SCRIPT","didAlreadyInsert","headClosingTagIndex","createDeferredSuffixStream","suffix","flushed","createFlightDataInjectionTransformStream","delayDataUntilFirstHtmlChunk","htmlStreamFinished","pull","donePulling","startOrContinuePulling","startPulling","atLeastOneTask","CLOSE_TAG","createMoveSuffixStream","foundSuffix","before","after","createStripDocumentClosingTagsTransform","foundHtml","foundBody","missingTags","map","c","chainTransformers","transformers","transformer","pipeThrough","renderStream","inlinedDataStream","isStaticGeneration","getServerInsertedHTML","getServerInsertedMetadata","validateRootLayout","suffixUnclosed","allReady","waitAtLeastOneReactRenderTask","prerenderStream","NEXT_REQUEST_META","addRequestMeta","getRequestMeta","removeRequestMeta","setRequestMeta","for","req","meta","fromNodeOutgoingHttpHeaders","normalizeNextQueryParam","splitCookiesString","toNodeOutgoingHttpHeaders","validateURL","nodeHeaders","Headers","values","isArray","v","append","cookiesString","cookiesStrings","pos","ch","lastComma","nextStart","cookiesSeparatorFound","skipWhitespace","test","charAt","notSpecialChar","cookies","cause","detectDomainLocale","domainItems","hostname","detectedLocale","item","domainHostname","domain","defaultLocale","locales","some","locale","removeTrailingSlash","route","parsePath","path","hashIndex","queryIndex","hasQuery","pathname","query","addPathPrefix","addPathSuffix","pathHasPrefix","addLocale","ignorePrefix","lower","formatNextPathnameInfo","trailingSlash","basePath","endsWith","getHostname","parsed","host","normalizeLocalePath","WeakMap","lowercasedLocales","segments","segment","removePathPrefix","withoutPrefix","getNextPathnameInfo","i18n","nextConfig","pathnameNoDataPrefix","paths","parseData","i18nProvider","analyze","NextURL","REGEX_LOCALHOST_HOSTNAME","parseURL","base","Internal","baseOrOpts","opts","__NEXT_NO_MIDDLEWARE_URL_NORMALIZE","domainLocale","domains","formatPathname","forceLocale","formatSearch","search","TypeError","searchParams","port","protocol","href","origin","password","username","toJSON","clone","PageSignatureError","RemovedPageError","RemovedUAError","page","INTERNALS","NextRequest","init","duplex","nextUrl","RequestCookies","bodyUsed","destination","fromEntries","ua","isNodeNextRequest","isNodeNextResponse","isWebNextRequest","isWebNextResponse","NextRequestAdapter","ResponseAborted","ResponseAbortedName","createAbortController","signalFromNodeResponse","AbortController","once","writableFinished","abort","errored","destroyed","AbortSignal","fromBaseNextRequest","fromWebNextRequest","fromNodeNextRequest","getClientComponentLoaderMetrics","wrapClientComponentLoader","clientComponentLoadStart","clientComponentLoadTimes","clientComponentLoadCount","ComponentMod","__next_app__","loadChunk","metrics","isAbortError","pipeToNodeResponse","e","createWriterFromResponse","waitUntilForEnd","started","drained","onDrain","on","off","finished","WritableStream","write","flushHeaders","startResponse","ok","destroy","writer","RenderResult","EMPTY","contentType","fromStatic","waitUntil","assignMetadata","assign","isNull","isDynamic","toUnchunkedString","isBuffer","coerce","unshift","RouteKind","fromResponseCacheEntry","routeKindToIncrementalCacheKind","toResponseCacheEntry","cacheEntry","kind","PAGES","html","pageData","APP_PAGE","postponed","rscData","segmentData","isMiss","isStale","cacheControl","routeKind","IMAGE","APP_ROUTE","PAGES_API","ResponseCache","parsePositiveInt","envValue","fallback","parseInt","Number","isFinite","DEFAULT_TTL_MS","NEXT_PRIVATE_RESPONSE_CACHE_TTL","DEFAULT_MAX_SIZE","NEXT_PRIVATE_RESPONSE_CACHE_MAX_SIZE","KEY_SEPARATOR","TTL_SENTINEL","createCacheKey","invocationID","extractInvocationID","compoundKey","separatorIndex","lastIndexOf","minimal_mode","ttl","getBatcher","isOnDemandRevalidate","scheduleOnNextTick","revalidateBatcher","evictedInvocationIDs","first","add","responseGenerator","hasResolved","previousCacheEntry","cachedItem","Date","expiresAt","incrementalCache","isFallback","isRoutePPREnabled","isPrefetch","handleGet","previousIncrementalCacheEntry","resolved","incrementalResponseCacheEntry","revalidate","handleRevalidate","responseCacheEntry","isRevalidating","Math","min","max","expire","NEXT_PATCH_SYMBOL","createPatchedFetcher","patchFetch","validateRevalidate","validateTags","isEdgeRuntime","isFetchPatched","revalidateVal","normalizedRevalidate","isNaN","tags","description","validTags","invalidTags","tag","reason","trackFetchMetric","workStore","ctx","shouldTrackFetchMetrics","fetchMetrics","timeOrigin","idx","nextFetchId","createCachedPrerenderResponse","incrementalCacheContext","handleUnlock","bodyBuffer","arrayBuffer","fetchedData","FETCH","createCachedDynamicResponse","serverComponentsHmrCache","cacheSetPromise","pendingRevalidateKey","pendingRevalidates","pendingRevalidatePromise","originFetch","workAsyncStorage","workUnitAsyncStorage","patched","fetch","fetchUrl","toUpperCase","isInternal","internal","NEXT_OTEL_FETCH_DISABLED","fetchStart","getStore","workUnitStore","cacheSignal","getCacheSignal","beginRead","internalFetch","CLIENT","Boolean","isDraftMode","isRequestInput","field","finalRevalidate","getNextField","originalFetchRevalidate","currentFetchRevalidate","revalidateStore","collectedTags","implicitTags","pageFetchCacheMode","fetchCache","isUsingNoStore","isUnstableNoStore","currentFetchCacheConfig","cacheReason","cacheWarning","isConflictingRevalidate","hasExplicitFetchCacheOptOut","noFetchConfigAndForceDynamic","forceDynamic","_headers","initHeaders","hasUnCacheableHeader","isUnCacheableMethod","hasNoExplicitCacheConfig","autoNoCache","isImplicitBuildTimeCache","endRead","makeHangingPromise","renderSignal","NODE_ENV","stagedRendering","waitForStage","RenderStage","Dynamic","forceStatic","markCurrentScopeAsDynamic","isCacheableRevalidate","isHmrRefresh","fetchIdx","doOriginalFetch","cacheReasonOverride","requestInputFields","reqInput","reqOptions","_ogBody","otherInput","clonedInit","fetchType","cacheStatus","incrementalCacheConfig","isForegroundRevalidate","isHmrRefreshCache","cachedFetchData","lock","softTags","getTimeoutBoundary","pendingRevalidate","__NEXT_CACHE_COMPONENTS","hasNextConfig","revalidatedResult","pendingResponse","responses","__nextPatched","__nextGetStaticStore","_nextOriginalFetch","currentTimeoutBoundary","r","setTimeout","unstable_cache","noStoreFetchIdx","cacheNewResult","keyParts","fixedKey","cachedCb","maybeIncrementalCache","__incrementalCache","fetchUrlPrefix","getFetchUrlPrefix","invocationKey","innerCacheStore","phase","draftMode","getDraftModeProviderForCacheScope","isNestedUnstableCache","cachedResponse","parse","revalidationPromise","run","URLSearchParams","sortedSearch","keys","sort","localeCompare","getSortedRouteObjects","getSortedRoutes","UrlNode","urlPath","_insert","smoosh","_smoosh","childrenPaths","children","slugName","splice","restSlugName","optionalRestSlugName","routes","curr","placeholder","urlPaths","slugNames","isCatchAll","nextSegment","segmentName","isOptional","handleSlug","previousSlug","nextSlug","forEach","slug","normalizedPages","root","pagePath","objects","indexes","pathnames","sorted","ensureLeadingSlash","DEFAULT_SEGMENT_KEY","NOT_FOUND_SEGMENT_KEY","PAGE_SEGMENT_KEY","addSearchParamsIfPageSegment","computeSelectedLayoutSegment","getSegmentValue","getSelectedLayoutSegmentPath","isGroupSegment","isParallelRouteSegment","isPageSegment","stringifiedQuery","parallelRouteKey","rawSegment","tree","parallelRoutes","segmentValue","normalizeAppPath","normalizeRscURL","INTERCEPTION_ROUTE_MARKERS","extractInterceptionRouteInformation","isInterceptionRouteAppPath","find","m","interceptingRoute","marker","interceptedRoute","splitInterceptingRoute","isDynamicRoute","TEST_ROUTE","TEST_STRICT_ROUTE","strict","refresh","revalidatePath","revalidateTag","updateTag","profile","pathWasRevalidated","ActionDidRevalidateDynamicOnly","originalPath","normalizedPath","expression","store","abortAndThrowOnSynchronousRequestDataAccess","postponeWithTracking","dynamicTracking","DynamicServerError","dynamicUsageDescription","dynamicUsageStack","stack","usedDynamic","pendingRevalidatedTags","existingIndex","findIndex","cacheLife","cacheLifeProfiles","ActionDidRevalidate","unstable_noStore","callingExpression","validateCacheLife","stale","__NEXT_USE_CACHE","configuredProfile","trim","explicitRevalidate","explicitExpire","explicitStale","cacheTag"],"mappings":"qGAgBaA,aAAa,CAAA,kBAAbA,GA2CAC,aAAa,CAAA,kBAAbA,GAvBAC,cAAc,CAAA,kBAAdA,GAqBAC,cAAc,CAAA,kBAAdA,GAwCAC,mBAAmB,CAAA,kBAAnBA,IAfAC,qBAAqB,CAAA,kBAArBA,GASAC,2BAA2B,CAAA,kBAA3BA,IAPAC,sBAAsB,CAAA,kBAAtBA,GAjFAC,wBAAwB,CAAA,kBAAxBA,GAsCAC,cAAc,CAAA,kBAAdA,GAWAC,6BAA6B,CAAA,kBAA7BA,GAhDAC,wBAAwB,CAAA,kBAAxBA,GAIAC,mBAAmB,CAAA,kBAAnBA,GAo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