@workflow/web 4.0.1-beta.13 → 4.0.1-beta.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (141) hide show
  1. package/.next/BUILD_ID +1 -1
  2. package/.next/app-path-routes-manifest.json +1 -2
  3. package/.next/build-manifest.json +4 -4
  4. package/.next/fallback-build-manifest.json +2 -2
  5. package/.next/prerender-manifest.json +3 -3
  6. package/.next/routes-manifest.json +0 -9
  7. package/.next/server/app/_global-error/page/build-manifest.json +2 -2
  8. package/.next/server/app/_global-error.html +2 -2
  9. package/.next/server/app/_global-error.rsc +1 -1
  10. package/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
  11. package/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  12. package/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
  13. package/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
  14. package/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  15. package/.next/server/app/_not-found/page/build-manifest.json +2 -2
  16. package/.next/server/app/_not-found/page/server-reference-manifest.json +184 -4
  17. package/.next/server/app/_not-found/page.js +3 -2
  18. package/.next/server/app/_not-found/page.js.nft.json +1 -1
  19. package/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  20. package/.next/server/app/page/build-manifest.json +2 -2
  21. package/.next/server/app/page/server-reference-manifest.json +67 -52
  22. package/.next/server/app/page.js +3 -3
  23. package/.next/server/app/page.js.nft.json +1 -1
  24. package/.next/server/app/page_client-reference-manifest.js +1 -1
  25. package/.next/server/app/run/[runId]/page/build-manifest.json +2 -2
  26. package/.next/server/app/run/[runId]/page/server-reference-manifest.json +67 -52
  27. package/.next/server/app/run/[runId]/page.js +3 -3
  28. package/.next/server/app/run/[runId]/page.js.nft.json +1 -1
  29. package/.next/server/app/run/[runId]/page_client-reference-manifest.js +1 -1
  30. package/.next/server/app-paths-manifest.json +1 -2
  31. package/.next/server/chunks/ssr/[root-of-the-server]__357a9046._.js +3 -0
  32. package/.next/server/chunks/ssr/[root-of-the-server]__357a9046._.js.map +1 -0
  33. package/.next/server/chunks/ssr/[root-of-the-server]__747eb15e._.js +72 -0
  34. package/.next/server/chunks/ssr/[root-of-the-server]__747eb15e._.js.map +1 -0
  35. package/.next/server/chunks/ssr/[root-of-the-server]__c8f35667._.js +3 -0
  36. package/.next/server/chunks/ssr/[root-of-the-server]__c8f35667._.js.map +1 -0
  37. package/.next/server/chunks/ssr/{[root-of-the-server]__5601d14d._.js → [root-of-the-server]__d67ccd55._.js} +2 -2
  38. package/.next/server/chunks/ssr/{[root-of-the-server]__5601d14d._.js.map → [root-of-the-server]__d67ccd55._.js.map} +1 -1
  39. package/.next/server/chunks/ssr/{[root-of-the-server]__ef8720b3._.js → [root-of-the-server]__e8641565._.js} +2 -2
  40. package/.next/server/chunks/ssr/[root-of-the-server]__e8641565._.js.map +1 -0
  41. package/.next/server/chunks/ssr/[root-of-the-server]__ef9c7ec7._.js +3 -0
  42. package/.next/server/chunks/ssr/[root-of-the-server]__ef9c7ec7._.js.map +1 -0
  43. package/.next/server/chunks/ssr/_2d77ccc1._.js +3 -0
  44. package/.next/server/chunks/ssr/_2d77ccc1._.js.map +1 -0
  45. package/.next/server/chunks/ssr/_30abd234._.js +8 -0
  46. package/.next/server/chunks/ssr/_30abd234._.js.map +1 -0
  47. package/.next/server/chunks/ssr/_6e6035a6._.js +3 -0
  48. package/.next/server/chunks/ssr/_6e6035a6._.js.map +1 -0
  49. package/.next/server/chunks/ssr/_b3bb46c8._.js +3 -0
  50. package/.next/server/chunks/ssr/_b3bb46c8._.js.map +1 -0
  51. package/.next/server/chunks/ssr/packages_web_src_app_page_tsx_cd282e82._.js +1 -1
  52. package/.next/server/chunks/ssr/packages_web_src_app_page_tsx_cd282e82._.js.map +1 -1
  53. package/.next/server/chunks/ssr/packages_web_src_app_run_[runId]_page_tsx_c7d0b139._.js +6 -6
  54. package/.next/server/chunks/ssr/packages_web_src_app_run_[runId]_page_tsx_c7d0b139._.js.map +1 -1
  55. package/.next/server/chunks/ssr/packages_web_src_components_ui_dropdown-menu_tsx_5a66d33b._.js +3 -0
  56. package/.next/server/chunks/ssr/packages_web_src_components_ui_dropdown-menu_tsx_5a66d33b._.js.map +1 -0
  57. package/.next/server/middleware-build-manifest.js +2 -2
  58. package/.next/server/next-font-manifest.js +1 -1
  59. package/.next/server/next-font-manifest.json +0 -4
  60. package/.next/server/pages/500.html +2 -2
  61. package/.next/server/server-reference-manifest.js +1 -1
  62. package/.next/server/server-reference-manifest.json +185 -170
  63. package/.next/static/chunks/4cd756ce08329aa0.js +1 -0
  64. package/.next/static/chunks/9413ec2d2c03a23f.js +1 -0
  65. package/.next/static/chunks/a085c02be6d1c0fa.js +1 -0
  66. package/.next/static/chunks/{22122fa69a524cdf.js → b7c7c49bc91f0883.js} +1 -1
  67. package/.next/static/chunks/cac98b3aeb18c389.css +3 -0
  68. package/.next/static/chunks/cb2a4b461d8e3581.js +1 -0
  69. package/.next/static/chunks/cf77de8f2f364dfe.js +3 -0
  70. package/.next/static/chunks/e5fe8b0871852c0c.js +1 -0
  71. package/.next/static/chunks/e815e2c1cb31fa75.css +1 -0
  72. package/.next/static/chunks/eca703efa10d6b73.js +1 -0
  73. package/.next/static/chunks/f6b74fa7a23429f6.js +14 -0
  74. package/.next/static/chunks/fa8d0e694695293d.js +1 -0
  75. package/.next/static/chunks/turbopack-3e37ac8ac11d9492.js +3 -0
  76. package/.next/static/chunks/{turbopack-453c53e2accaa935.js → turbopack-c46db9a9d9103ea9.js} +1 -1
  77. package/.next/trace +1 -1
  78. package/.next/trace-build +1 -1
  79. package/.next/types/routes.d.ts +1 -2
  80. package/.next/types/validator.ts +0 -9
  81. package/package.json +10 -5
  82. package/.next/server/app/run/[runId]/streams/[streamId]/page/app-paths-manifest.json +0 -3
  83. package/.next/server/app/run/[runId]/streams/[streamId]/page/build-manifest.json +0 -17
  84. package/.next/server/app/run/[runId]/streams/[streamId]/page/next-font-manifest.json +0 -11
  85. package/.next/server/app/run/[runId]/streams/[streamId]/page/react-loadable-manifest.json +0 -1
  86. package/.next/server/app/run/[runId]/streams/[streamId]/page/server-reference-manifest.json +0 -200
  87. package/.next/server/app/run/[runId]/streams/[streamId]/page.js +0 -22
  88. package/.next/server/app/run/[runId]/streams/[streamId]/page.js.map +0 -5
  89. package/.next/server/app/run/[runId]/streams/[streamId]/page.js.nft.json +0 -1
  90. package/.next/server/app/run/[runId]/streams/[streamId]/page_client-reference-manifest.js +0 -2
  91. package/.next/server/chunks/ssr/[root-of-the-server]__072d3021._.js +0 -70
  92. package/.next/server/chunks/ssr/[root-of-the-server]__072d3021._.js.map +0 -1
  93. package/.next/server/chunks/ssr/[root-of-the-server]__0e8b8fa9._.js +0 -3
  94. package/.next/server/chunks/ssr/[root-of-the-server]__0e8b8fa9._.js.map +0 -1
  95. package/.next/server/chunks/ssr/[root-of-the-server]__6e56cd25._.js +0 -4
  96. package/.next/server/chunks/ssr/[root-of-the-server]__6e56cd25._.js.map +0 -1
  97. package/.next/server/chunks/ssr/[root-of-the-server]__cd719c14._.js +0 -4
  98. package/.next/server/chunks/ssr/[root-of-the-server]__cd719c14._.js.map +0 -1
  99. package/.next/server/chunks/ssr/[root-of-the-server]__d4909843._.js +0 -4
  100. package/.next/server/chunks/ssr/[root-of-the-server]__d4909843._.js.map +0 -1
  101. package/.next/server/chunks/ssr/[root-of-the-server]__ef8720b3._.js.map +0 -1
  102. package/.next/server/chunks/ssr/[root-of-the-server]__fb5d0d13._.js +0 -4
  103. package/.next/server/chunks/ssr/[root-of-the-server]__fb5d0d13._.js.map +0 -1
  104. package/.next/server/chunks/ssr/_631c662c._.js +0 -4
  105. package/.next/server/chunks/ssr/_631c662c._.js.map +0 -1
  106. package/.next/server/chunks/ssr/_65c9c827._.js +0 -6
  107. package/.next/server/chunks/ssr/_65c9c827._.js.map +0 -1
  108. package/.next/server/chunks/ssr/_e9cd0664._.js +0 -3
  109. package/.next/server/chunks/ssr/_e9cd0664._.js.map +0 -1
  110. package/.next/server/chunks/ssr/packages_30c0733e._.js +0 -4
  111. package/.next/server/chunks/ssr/packages_30c0733e._.js.map +0 -1
  112. package/.next/server/chunks/ssr/packages_906ab70b._.js +0 -3
  113. package/.next/server/chunks/ssr/packages_906ab70b._.js.map +0 -1
  114. package/.next/server/chunks/ssr/packages_9f053af5._.js +0 -3
  115. package/.next/server/chunks/ssr/packages_9f053af5._.js.map +0 -1
  116. package/.next/server/chunks/ssr/packages_web-shared_dist_trace-viewer_worker_f98ba72c.js +0 -3
  117. package/.next/server/chunks/ssr/packages_web-shared_dist_trace-viewer_worker_f98ba72c.js.map +0 -1
  118. package/.next/server/chunks/ssr/packages_web_src_app_layout-client_tsx_7f30673c._.js +0 -3
  119. package/.next/server/chunks/ssr/packages_web_src_app_layout-client_tsx_7f30673c._.js.map +0 -1
  120. package/.next/server/chunks/ssr/packages_web_src_components_5b4f203e._.js +0 -3
  121. package/.next/server/chunks/ssr/packages_web_src_components_5b4f203e._.js.map +0 -1
  122. package/.next/server/chunks/ssr/packages_web_src_components_d1065930._.js +0 -3
  123. package/.next/server/chunks/ssr/packages_web_src_components_d1065930._.js.map +0 -1
  124. package/.next/server/chunks/ssr/packages_web_src_components_ui_select_tsx_7c5238ef._.js +0 -3
  125. package/.next/server/chunks/ssr/packages_web_src_components_ui_select_tsx_7c5238ef._.js.map +0 -1
  126. package/.next/static/chunks/125dc6396d8c7614.js +0 -1
  127. package/.next/static/chunks/12738c56605f94bd.js +0 -1
  128. package/.next/static/chunks/1b2c32764beea8c6.js +0 -1
  129. package/.next/static/chunks/2677e69032fce46e.js +0 -1
  130. package/.next/static/chunks/33539167f963017b.js +0 -14
  131. package/.next/static/chunks/46d8d17fb5e804aa.js +0 -1
  132. package/.next/static/chunks/5bfebbf730bb3cdc.js +0 -1
  133. package/.next/static/chunks/7d15ec806ba18b85.css +0 -3
  134. package/.next/static/chunks/8f0576d510d06c4c.js +0 -1
  135. package/.next/static/chunks/971151b2a72b5f24.css +0 -1
  136. package/.next/static/chunks/d5f104e0113bd49b.js +0 -2
  137. package/.next/static/chunks/e5b69a828ea58204.js +0 -1
  138. package/.next/static/chunks/turbopack-511fe75cd918d1a5.js +0 -3
  139. /package/.next/static/{dqfnmYEq_BK3Cb_-i5jnc → 8L07V3BgO4DySkjO3mfTV}/_buildManifest.js +0 -0
  140. /package/.next/static/{dqfnmYEq_BK3Cb_-i5jnc → 8L07V3BgO4DySkjO3mfTV}/_clientMiddlewareManifest.json +0 -0
  141. /package/.next/static/{dqfnmYEq_BK3Cb_-i5jnc → 8L07V3BgO4DySkjO3mfTV}/_ssgManifest.js +0 -0
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../../../../node_modules/.pnpm/%40swc%2Bhelpers%400.5.15/node_modules/%40swc/helpers/cjs/_interop_require_wildcard.cjs","../../../../../../node_modules/.pnpm/next%4016.0.7_%40opentelemetry%2Bapi%401.9.0_react-dom%4019.1.0_react%4019.1.0__react%4019.1.0/node_modules/next/src/shared/lib/router/utils/querystring.ts","../../../../../../node_modules/.pnpm/next%4016.0.7_%40opentelemetry%2Bapi%401.9.0_react-dom%4019.1.0_react%4019.1.0__react%4019.1.0/node_modules/next/src/shared/lib/router/utils/format-url.ts","../../../../../../node_modules/.pnpm/next%4016.0.7_%40opentelemetry%2Bapi%401.9.0_react-dom%4019.1.0_react%4019.1.0__react%4019.1.0/node_modules/next/src/client/use-merged-ref.ts","../../../../../../node_modules/.pnpm/next%4016.0.7_%40opentelemetry%2Bapi%401.9.0_react-dom%4019.1.0_react%4019.1.0__react%4019.1.0/node_modules/next/src/shared/lib/utils.ts","../../../../../../node_modules/.pnpm/next%4016.0.7_%40opentelemetry%2Bapi%401.9.0_react-dom%4019.1.0_react%4019.1.0__react%4019.1.0/node_modules/next/src/shared/lib/router/utils/parse-path.ts","../../../../../../node_modules/.pnpm/next%4016.0.7_%40opentelemetry%2Bapi%401.9.0_react-dom%4019.1.0_react%4019.1.0__react%4019.1.0/node_modules/next/src/shared/lib/router/utils/add-path-prefix.ts","../../../../../../node_modules/.pnpm/next%4016.0.7_%40opentelemetry%2Bapi%401.9.0_react-dom%4019.1.0_react%4019.1.0__react%4019.1.0/node_modules/next/src/shared/lib/router/utils/remove-trailing-slash.ts","../../../../../../node_modules/.pnpm/next%4016.0.7_%40opentelemetry%2Bapi%401.9.0_react-dom%4019.1.0_react%4019.1.0__react%4019.1.0/node_modules/next/src/client/normalize-trailing-slash.ts","../../../../../../node_modules/.pnpm/next%4016.0.7_%40opentelemetry%2Bapi%401.9.0_react-dom%4019.1.0_react%4019.1.0__react%4019.1.0/node_modules/next/src/client/add-base-path.ts","../../../../../../node_modules/.pnpm/next%4016.0.7_%40opentelemetry%2Bapi%401.9.0_react-dom%4019.1.0_react%4019.1.0__react%4019.1.0/node_modules/next/src/shared/lib/utils/warn-once.ts","../../../../../../node_modules/.pnpm/next%4016.0.7_%40opentelemetry%2Bapi%401.9.0_react-dom%4019.1.0_react%4019.1.0__react%4019.1.0/node_modules/next/src/client/components/segment-cache/types.ts","../../../../../../node_modules/.pnpm/next%4016.0.7_%40opentelemetry%2Bapi%401.9.0_react-dom%4019.1.0_react%4019.1.0__react%4019.1.0/node_modules/next/src/client/components/segment-cache/cache-key.ts","../../../../../../node_modules/.pnpm/next%4016.0.7_%40opentelemetry%2Bapi%401.9.0_react-dom%4019.1.0_react%4019.1.0__react%4019.1.0/node_modules/next/src/shared/lib/app-router-types.ts","../../../../../../node_modules/.pnpm/next%4016.0.7_%40opentelemetry%2Bapi%401.9.0_react-dom%4019.1.0_react%4019.1.0__react%4019.1.0/node_modules/next/src/client/components/match-segments.ts","../../../../../../node_modules/.pnpm/next%4016.0.7_%40opentelemetry%2Bapi%401.9.0_react-dom%4019.1.0_react%4019.1.0__react%4019.1.0/node_modules/next/src/client/components/app-router-headers.ts","../../../../../../node_modules/.pnpm/next%4016.0.7_%40opentelemetry%2Bapi%401.9.0_react-dom%4019.1.0_react%4019.1.0__react%4019.1.0/node_modules/next/src/client/components/router-reducer/router-reducer-types.ts","../../../../../../node_modules/.pnpm/next%4016.0.7_%40opentelemetry%2Bapi%401.9.0_react-dom%4019.1.0_react%4019.1.0__react%4019.1.0/node_modules/next/src/shared/lib/is-thenable.ts","../../../../../../node_modules/.pnpm/next%4016.0.7_%40opentelemetry%2Bapi%401.9.0_react-dom%4019.1.0_react%4019.1.0__react%4019.1.0/node_modules/next/src/client/components/use-action-queue.ts","../../../../../../node_modules/.pnpm/next%4016.0.7_%40opentelemetry%2Bapi%401.9.0_react-dom%4019.1.0_react%4019.1.0__react%4019.1.0/node_modules/next/src/client/app-call-server.ts","../../../../../../node_modules/.pnpm/next%4016.0.7_%40opentelemetry%2Bapi%401.9.0_react-dom%4019.1.0_react%4019.1.0__react%4019.1.0/node_modules/next/src/client/app-find-source-map-url.ts","../../../../../../node_modules/.pnpm/next%4016.0.7_%40opentelemetry%2Bapi%401.9.0_react-dom%4019.1.0_react%4019.1.0__react%4019.1.0/node_modules/next/src/shared/lib/segment.ts","../../../../../../node_modules/.pnpm/next%4016.0.7_%40opentelemetry%2Bapi%401.9.0_react-dom%4019.1.0_react%4019.1.0__react%4019.1.0/node_modules/next/src/shared/lib/segment-cache/segment-value-encoding.ts","../../../../../../node_modules/.pnpm/next%4016.0.7_%40opentelemetry%2Bapi%401.9.0_react-dom%4019.1.0_react%4019.1.0__react%4019.1.0/node_modules/next/src/client/route-params.ts","../../../../../../node_modules/.pnpm/next%4016.0.7_%40opentelemetry%2Bapi%401.9.0_react-dom%4019.1.0_react%4019.1.0__react%4019.1.0/node_modules/next/src/client/components/router-reducer/create-href-from-url.ts","../../../../../../node_modules/.pnpm/next%4016.0.7_%40opentelemetry%2Bapi%401.9.0_react-dom%4019.1.0_react%4019.1.0__react%4019.1.0/node_modules/next/src/client/flight-data-helpers.ts","../../../../../../node_modules/.pnpm/next%4016.0.7_%40opentelemetry%2Bapi%401.9.0_react-dom%4019.1.0_react%4019.1.0__react%4019.1.0/node_modules/next/src/client/app-build-id.ts","../../../../../../node_modules/.pnpm/next%4016.0.7_%40opentelemetry%2Bapi%401.9.0_react-dom%4019.1.0_react%4019.1.0__react%4019.1.0/node_modules/next/src/shared/lib/hash.ts","../../../../../../node_modules/.pnpm/next%4016.0.7_%40opentelemetry%2Bapi%401.9.0_react-dom%4019.1.0_react%4019.1.0__react%4019.1.0/node_modules/next/src/shared/lib/router/utils/cache-busting-search-param.ts","../../../../../../node_modules/.pnpm/next%4016.0.7_%40opentelemetry%2Bapi%401.9.0_react-dom%4019.1.0_react%4019.1.0__react%4019.1.0/node_modules/next/src/client/components/router-reducer/set-cache-busting-search-param.ts","../../../../../../node_modules/.pnpm/next%4016.0.7_%40opentelemetry%2Bapi%401.9.0_react-dom%4019.1.0_react%4019.1.0__react%4019.1.0/node_modules/next/src/client/components/router-reducer/fetch-server-response.ts","../../../../../../node_modules/.pnpm/next%4016.0.7_%40opentelemetry%2Bapi%401.9.0_react-dom%4019.1.0_react%4019.1.0__react%4019.1.0/node_modules/next/src/client/components/segment-cache/lru.ts","../../../../../../node_modules/.pnpm/next%4016.0.7_%40opentelemetry%2Bapi%401.9.0_react-dom%4019.1.0_react%4019.1.0__react%4019.1.0/node_modules/next/src/client/components/segment-cache/cache-map.ts","../../../../../../node_modules/.pnpm/next%4016.0.7_%40opentelemetry%2Bapi%401.9.0_react-dom%4019.1.0_react%4019.1.0__react%4019.1.0/node_modules/next/src/client/components/segment-cache/vary-path.ts","../../../../../../node_modules/.pnpm/next%4016.0.7_%40opentelemetry%2Bapi%401.9.0_react-dom%4019.1.0_react%4019.1.0__react%4019.1.0/node_modules/next/src/shared/lib/page-path/ensure-leading-slash.ts","../../../../../../node_modules/.pnpm/next%4016.0.7_%40opentelemetry%2Bapi%401.9.0_react-dom%4019.1.0_react%4019.1.0__react%4019.1.0/node_modules/next/src/shared/lib/router/utils/app-paths.ts","../../../../../../node_modules/.pnpm/next%4016.0.7_%40opentelemetry%2Bapi%401.9.0_react-dom%4019.1.0_react%4019.1.0__react%4019.1.0/node_modules/next/src/shared/lib/router/utils/interception-routes.ts","../../../../../../node_modules/.pnpm/next%4016.0.7_%40opentelemetry%2Bapi%401.9.0_react-dom%4019.1.0_react%4019.1.0__react%4019.1.0/node_modules/next/src/client/components/router-reducer/compute-changed-path.ts","../../../../../../node_modules/.pnpm/next%4016.0.7_%40opentelemetry%2Bapi%401.9.0_react-dom%4019.1.0_react%4019.1.0__react%4019.1.0/node_modules/next/src/client/components/router-reducer/handle-mutable.ts","../../../../../../node_modules/.pnpm/next%4016.0.7_%40opentelemetry%2Bapi%401.9.0_react-dom%4019.1.0_react%4019.1.0__react%4019.1.0/node_modules/next/src/client/components/router-reducer/create-router-cache-key.ts","../../../../../../node_modules/.pnpm/next%4016.0.7_%40opentelemetry%2Bapi%401.9.0_react-dom%4019.1.0_react%4019.1.0__react%4019.1.0/node_modules/next/src/client/components/router-reducer/is-navigating-to-new-root-layout.ts","../../../../../../node_modules/.pnpm/next%4016.0.7_%40opentelemetry%2Bapi%401.9.0_react-dom%4019.1.0_react%4019.1.0__react%4019.1.0/node_modules/next/src/client/components/router-reducer/ppr-navigations.ts","../../../../../../node_modules/.pnpm/next%4016.0.7_%40opentelemetry%2Bapi%401.9.0_react-dom%4019.1.0_react%4019.1.0__react%4019.1.0/node_modules/next/src/client/components/segment-cache/navigation.ts","../../../../../../node_modules/.pnpm/next%4016.0.7_%40opentelemetry%2Bapi%401.9.0_react-dom%4019.1.0_react%4019.1.0__react%4019.1.0/node_modules/next/src/client/components/router-reducer/reducers/navigate-reducer.ts","../../../../../../node_modules/.pnpm/next%4016.0.7_%40opentelemetry%2Bapi%401.9.0_react-dom%4019.1.0_react%4019.1.0__react%4019.1.0/node_modules/next/src/shared/lib/segment-cache/output-export-prefetch-encoding.ts","../../../../../../node_modules/.pnpm/next%4016.0.7_%40opentelemetry%2Bapi%401.9.0_react-dom%4019.1.0_react%4019.1.0__react%4019.1.0/node_modules/next/src/shared/lib/promise-with-resolvers.ts","../../../../../../node_modules/.pnpm/next%4016.0.7_%40opentelemetry%2Bapi%401.9.0_react-dom%4019.1.0_react%4019.1.0__react%4019.1.0/node_modules/next/src/client/components/segment-cache/cache.ts","../../../../../../node_modules/.pnpm/next%4016.0.7_%40opentelemetry%2Bapi%401.9.0_react-dom%4019.1.0_react%4019.1.0__react%4019.1.0/node_modules/next/src/client/components/segment-cache/scheduler.ts","../../../../../../node_modules/.pnpm/next%4016.0.7_%40opentelemetry%2Bapi%401.9.0_react-dom%4019.1.0_react%4019.1.0__react%4019.1.0/node_modules/next/src/client/components/links.ts","../../../../../../node_modules/.pnpm/next%4016.0.7_%40opentelemetry%2Bapi%401.9.0_react-dom%4019.1.0_react%4019.1.0__react%4019.1.0/node_modules/next/src/shared/lib/router/utils/path-has-prefix.ts","../../../../../../node_modules/.pnpm/next%4016.0.7_%40opentelemetry%2Bapi%401.9.0_react-dom%4019.1.0_react%4019.1.0__react%4019.1.0/node_modules/next/src/client/has-base-path.ts","../../../../../../node_modules/.pnpm/next%4016.0.7_%40opentelemetry%2Bapi%401.9.0_react-dom%4019.1.0_react%4019.1.0__react%4019.1.0/node_modules/next/src/shared/lib/router/utils/is-local-url.ts","../../../../../../node_modules/.pnpm/next%4016.0.7_%40opentelemetry%2Bapi%401.9.0_react-dom%4019.1.0_react%4019.1.0__react%4019.1.0/node_modules/next/src/shared/lib/utils/error-once.ts","../../../../../../node_modules/.pnpm/next%4016.0.7_%40opentelemetry%2Bapi%401.9.0_react-dom%4019.1.0_react%4019.1.0__react%4019.1.0/node_modules/next/src/client/app-dir/link.tsx","../../../../../../node_modules/.pnpm/next%4016.0.7_%40opentelemetry%2Bapi%401.9.0_react-dom%4019.1.0_react%4019.1.0__react%4019.1.0/node_modules/next/src/client/components/readonly-url-search-params.ts","../../../../../../node_modules/.pnpm/next%4016.0.7_%40opentelemetry%2Bapi%401.9.0_react-dom%4019.1.0_react%4019.1.0__react%4019.1.0/node_modules/next/src/client/components/unrecognized-action-error.ts","../../../../../../node_modules/.pnpm/next%4016.0.7_%40opentelemetry%2Bapi%401.9.0_react-dom%4019.1.0_react%4019.1.0__react%4019.1.0/node_modules/next/src/client/components/redirect-status-code.ts","../../../../../../node_modules/.pnpm/next%4016.0.7_%40opentelemetry%2Bapi%401.9.0_react-dom%4019.1.0_react%4019.1.0__react%4019.1.0/node_modules/next/src/client/components/redirect-error.ts","../../../../../../node_modules/.pnpm/next%4016.0.7_%40opentelemetry%2Bapi%401.9.0_react-dom%4019.1.0_react%4019.1.0__react%4019.1.0/node_modules/next/src/client/components/redirect.ts","../../../../../../node_modules/.pnpm/next%4016.0.7_%40opentelemetry%2Bapi%401.9.0_react-dom%4019.1.0_react%4019.1.0__react%4019.1.0/node_modules/next/src/client/components/http-access-fallback/http-access-fallback.ts","../../../../../../node_modules/.pnpm/next%4016.0.7_%40opentelemetry%2Bapi%401.9.0_react-dom%4019.1.0_react%4019.1.0__react%4019.1.0/node_modules/next/src/client/components/not-found.ts","../../../../../../node_modules/.pnpm/next%4016.0.7_%40opentelemetry%2Bapi%401.9.0_react-dom%4019.1.0_react%4019.1.0__react%4019.1.0/node_modules/next/src/client/components/forbidden.ts","../../../../../../node_modules/.pnpm/next%4016.0.7_%40opentelemetry%2Bapi%401.9.0_react-dom%4019.1.0_react%4019.1.0__react%4019.1.0/node_modules/next/src/client/components/unauthorized.ts","../../../../../../node_modules/.pnpm/next%4016.0.7_%40opentelemetry%2Bapi%401.9.0_react-dom%4019.1.0_react%4019.1.0__react%4019.1.0/node_modules/next/src/server/dynamic-rendering-utils.ts","../../../../../../node_modules/.pnpm/next%4016.0.7_%40opentelemetry%2Bapi%401.9.0_react-dom%4019.1.0_react%4019.1.0__react%4019.1.0/node_modules/next/src/server/lib/router-utils/is-postpone.ts","../../../../../../node_modules/.pnpm/next%4016.0.7_%40opentelemetry%2Bapi%401.9.0_react-dom%4019.1.0_react%4019.1.0__react%4019.1.0/node_modules/next/src/shared/lib/lazy-dynamic/bailout-to-csr.ts","../../../../../../node_modules/.pnpm/next%4016.0.7_%40opentelemetry%2Bapi%401.9.0_react-dom%4019.1.0_react%4019.1.0__react%4019.1.0/node_modules/next/src/client/components/is-next-router-error.ts","../../../../../../node_modules/.pnpm/next%4016.0.7_%40opentelemetry%2Bapi%401.9.0_react-dom%4019.1.0_react%4019.1.0__react%4019.1.0/node_modules/next/src/client/components/hooks-server-context.ts","../../../../../../node_modules/.pnpm/next%4016.0.7_%40opentelemetry%2Bapi%401.9.0_react-dom%4019.1.0_react%4019.1.0__react%4019.1.0/node_modules/next/src/client/components/static-generation-bailout.ts","../../../../../../node_modules/.pnpm/next%4016.0.7_%40opentelemetry%2Bapi%401.9.0_react-dom%4019.1.0_react%4019.1.0__react%4019.1.0/node_modules/next/src/lib/framework/boundary-constants.tsx","../../../../../../node_modules/.pnpm/next%4016.0.7_%40opentelemetry%2Bapi%401.9.0_react-dom%4019.1.0_react%4019.1.0__react%4019.1.0/node_modules/next/src/lib/scheduler.ts","../../../../../../node_modules/.pnpm/next%4016.0.7_%40opentelemetry%2Bapi%401.9.0_react-dom%4019.1.0_react%4019.1.0__react%4019.1.0/node_modules/next/src/shared/lib/invariant-error.ts","../../../../../../node_modules/.pnpm/next%4016.0.7_%40opentelemetry%2Bapi%401.9.0_react-dom%4019.1.0_react%4019.1.0__react%4019.1.0/node_modules/next/src/server/app-render/staged-rendering.ts","../../../../../../node_modules/.pnpm/next%4016.0.7_%40opentelemetry%2Bapi%401.9.0_react-dom%4019.1.0_react%4019.1.0__react%4019.1.0/node_modules/next/src/server/app-render/dynamic-rendering.ts","../../../../../../node_modules/.pnpm/next%4016.0.7_%40opentelemetry%2Bapi%401.9.0_react-dom%4019.1.0_react%4019.1.0__react%4019.1.0/node_modules/next/src/client/components/unstable-rethrow.server.ts","../../../../../../node_modules/.pnpm/next%4016.0.7_%40opentelemetry%2Bapi%401.9.0_react-dom%4019.1.0_react%4019.1.0__react%4019.1.0/node_modules/next/src/client/components/unstable-rethrow.ts","../../../../../../node_modules/.pnpm/next%4016.0.7_%40opentelemetry%2Bapi%401.9.0_react-dom%4019.1.0_react%4019.1.0__react%4019.1.0/node_modules/next/src/client/components/navigation.react-server.ts","../../../../../../node_modules/.pnpm/next%4016.0.7_%40opentelemetry%2Bapi%401.9.0_react-dom%4019.1.0_react%4019.1.0__react%4019.1.0/node_modules/next/src/client/components/navigation.ts","../../../../../../node_modules/.pnpm/next%4016.0.7_%40opentelemetry%2Bapi%401.9.0_react-dom%4019.1.0_react%4019.1.0__react%4019.1.0/node_modules/next/navigation.js","../../../../../../node_modules/.pnpm/lucide-react%400.469.0_react%4019.1.0/node_modules/shared/src/utils.ts","../../../../../../node_modules/.pnpm/lucide-react%400.469.0_react%4019.1.0/node_modules/lucide-react/src/defaultAttributes.ts","../../../../../../node_modules/.pnpm/lucide-react%400.469.0_react%4019.1.0/node_modules/lucide-react/src/createLucideIcon.ts","../../../../../../node_modules/.pnpm/lucide-react%400.469.0_react%4019.1.0/node_modules/lucide-react/src/Icon.ts","../../../../../../node_modules/.pnpm/clsx%402.1.1/node_modules/clsx/dist/clsx.mjs","../../../../../../node_modules/.pnpm/date-fns%404.1.0/node_modules/date-fns/locale/en-US/_lib/formatRelative.js","../../../../../../node_modules/.pnpm/date-fns%404.1.0/node_modules/date-fns/_lib/defaultOptions.js","../../../../../../node_modules/.pnpm/date-fns%404.1.0/node_modules/date-fns/locale/en-US/_lib/formatDistance.js","../../../../../../packages/web/src/lib/utils.ts","../../../../../../node_modules/.pnpm/tailwind-merge%402.5.5/node_modules/tailwind-merge/src/lib/class-group-utils.ts","../../../../../../node_modules/.pnpm/date-fns%404.1.0/node_modules/date-fns/locale/_lib/buildFormatLongFn.js","../../../../../../node_modules/.pnpm/date-fns%404.1.0/node_modules/date-fns/locale/_lib/buildMatchFn.js","../../../../../../node_modules/.pnpm/date-fns%404.1.0/node_modules/date-fns/locale/_lib/buildMatchPatternFn.js","../../../../../../node_modules/.pnpm/date-fns%404.1.0/node_modules/date-fns/_lib/getRoundingMethod.js","../../../../../../node_modules/.pnpm/date-fns%404.1.0/node_modules/date-fns/locale/en-US/_lib/formatLong.js","../../../../../../node_modules/.pnpm/date-fns%404.1.0/node_modules/date-fns/locale/en-US/_lib/localize.js","../../../../../../node_modules/.pnpm/date-fns%404.1.0/node_modules/date-fns/_lib/normalizeDates.js","../../../../../../node_modules/.pnpm/date-fns%404.1.0/node_modules/date-fns/locale/en-US/_lib/match.js","../../../../../../node_modules/.pnpm/date-fns%404.1.0/node_modules/date-fns/_lib/getTimezoneOffsetInMilliseconds.js","../../../../../../node_modules/.pnpm/date-fns%404.1.0/node_modules/date-fns/locale/en-US.js","../../../../../../node_modules/.pnpm/date-fns%404.1.0/node_modules/date-fns/constants.js","../../../../../../node_modules/.pnpm/date-fns%404.1.0/node_modules/date-fns/compareAsc.js","../../../../../../node_modules/.pnpm/date-fns%404.1.0/node_modules/date-fns/constructFrom.js","../../../../../../node_modules/.pnpm/date-fns%404.1.0/node_modules/date-fns/locale/_lib/buildLocalizeFn.js","../../../../../../node_modules/.pnpm/date-fns%404.1.0/node_modules/date-fns/toDate.js","../../../../../../node_modules/.pnpm/date-fns%404.1.0/node_modules/date-fns/formatDistanceStrict.js","../../../../../../node_modules/.pnpm/tailwind-merge%402.5.5/node_modules/tailwind-merge/src/lib/lru-cache.ts","../../../../../../node_modules/.pnpm/tailwind-merge%402.5.5/node_modules/tailwind-merge/src/lib/parse-class-name.ts","../../../../../../node_modules/.pnpm/tailwind-merge%402.5.5/node_modules/tailwind-merge/src/lib/config-utils.ts","../../../../../../node_modules/.pnpm/tailwind-merge%402.5.5/node_modules/tailwind-merge/src/lib/merge-classlist.ts","../../../../../../node_modules/.pnpm/tailwind-merge%402.5.5/node_modules/tailwind-merge/src/lib/tw-join.ts","../../../../../../node_modules/.pnpm/tailwind-merge%402.5.5/node_modules/tailwind-merge/src/lib/create-tailwind-merge.ts","../../../../../../node_modules/.pnpm/tailwind-merge%402.5.5/node_modules/tailwind-merge/src/lib/from-theme.ts","../../../../../../node_modules/.pnpm/tailwind-merge%402.5.5/node_modules/tailwind-merge/src/lib/validators.ts","../../../../../../node_modules/.pnpm/tailwind-merge%402.5.5/node_modules/tailwind-merge/src/lib/default-config.ts","../../../../../../node_modules/.pnpm/tailwind-merge%402.5.5/node_modules/tailwind-merge/src/lib/merge-configs.ts","../../../../../../node_modules/.pnpm/tailwind-merge%402.5.5/node_modules/tailwind-merge/src/lib/extend-tailwind-merge.ts","../../../../../../node_modules/.pnpm/tailwind-merge%402.5.5/node_modules/tailwind-merge/src/lib/tw-merge.ts","../../../../../../node_modules/.pnpm/lucide-react%400.469.0_react%4019.1.0/node_modules/lucide-react/src/icons/circle-alert.ts","../../../../../../node_modules/.pnpm/class-variance-authority%400.7.1/node_modules/class-variance-authority/dist/index.mjs","../../../../../../packages/web/src/components/ui/alert.tsx","../../../../../../node_modules/.pnpm/%40radix-ui%2Breact-compose-refs%401.1.1_%40types%2Breact%4019.1.13_react%4019.1.0/node_modules/%40radix-ui/react-compose-refs/dist/index.mjs","../../../../../../node_modules/.pnpm/%40radix-ui%2Breact-slot%401.1.1_%40types%2Breact%4019.1.13_react%4019.1.0/node_modules/%40radix-ui/react-slot/dist/index.mjs","../../../../../../packages/web/src/components/ui/button.tsx","../../../../../../packages/web/src/lib/config.ts","../../../../../../node_modules/.pnpm/next%4016.0.7_%40opentelemetry%2Bapi%401.9.0_react-dom%4019.1.0_react%4019.1.0__react%4019.1.0/node_modules/next/src/build/webpack/loaders/next-flight-loader/action-client-wrapper.ts","../../../../../../node_modules/.pnpm/use-sync-external-store%401.5.0_react%4019.1.0/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.production.js","../../../../../../node_modules/.pnpm/use-sync-external-store%401.5.0_react%4019.1.0/node_modules/use-sync-external-store/shim/index.js","../../../../../../node_modules/.pnpm/swr%402.3.6_react%4019.1.0/node_modules/swr/dist/index/index.mjs","../../../../../../node_modules/.pnpm/swr%402.3.6_react%4019.1.0/node_modules/swr/dist/_internal/events.mjs","../../../../../../node_modules/.pnpm/dequal%402.0.3/node_modules/dequal/lite/index.mjs","../../../../../../node_modules/.pnpm/swr%402.3.6_react%4019.1.0/node_modules/swr/dist/_internal/config-context-client-BoS53ST9.mjs","../../../../../../node_modules/.pnpm/swr%402.3.6_react%4019.1.0/node_modules/swr/dist/_internal/index.mjs","../../../../../../node_modules/.pnpm/swr%402.3.6_react%4019.1.0/node_modules/swr/dist/_internal/constants.mjs","../../../../../../node_modules/.pnpm/sonner%402.0.7_react-dom%4019.1.0_react%4019.1.0__react%4019.1.0/node_modules/sonner/dist/index.mjs"],"sourcesContent":["\"use strict\";\n\nfunction _getRequireWildcardCache(nodeInterop) {\n if (typeof WeakMap !== \"function\") return null;\n\n var cacheBabelInterop = new WeakMap();\n var cacheNodeInterop = new WeakMap();\n\n return (_getRequireWildcardCache = function(nodeInterop) {\n return nodeInterop ? cacheNodeInterop : cacheBabelInterop;\n })(nodeInterop);\n}\nfunction _interop_require_wildcard(obj, nodeInterop) {\n if (!nodeInterop && obj && obj.__esModule) return obj;\n if (obj === null || typeof obj !== \"object\" && typeof obj !== \"function\") return { default: obj };\n\n var cache = _getRequireWildcardCache(nodeInterop);\n\n if (cache && cache.has(obj)) return cache.get(obj);\n\n var newObj = { __proto__: null };\n var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;\n\n for (var key in obj) {\n if (key !== \"default\" && Object.prototype.hasOwnProperty.call(obj, key)) {\n var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;\n if (desc && (desc.get || desc.set)) Object.defineProperty(newObj, key, desc);\n else newObj[key] = obj[key];\n }\n }\n\n newObj.default = obj;\n\n if (cache) cache.set(obj, newObj);\n\n return newObj;\n}\nexports._ = _interop_require_wildcard;\n","import type { ParsedUrlQuery } from 'querystring'\n\nexport function searchParamsToUrlQuery(\n searchParams: URLSearchParams\n): ParsedUrlQuery {\n const query: ParsedUrlQuery = {}\n for (const [key, value] of searchParams.entries()) {\n const existing = query[key]\n if (typeof existing === 'undefined') {\n query[key] = value\n } else if (Array.isArray(existing)) {\n existing.push(value)\n } else {\n query[key] = [existing, value]\n }\n }\n return query\n}\n\nfunction stringifyUrlQueryParam(param: unknown): string {\n if (typeof param === 'string') {\n return param\n }\n\n if (\n (typeof param === 'number' && !isNaN(param)) ||\n typeof param === 'boolean'\n ) {\n return String(param)\n } else {\n return ''\n }\n}\n\nexport function urlQueryToSearchParams(query: ParsedUrlQuery): URLSearchParams {\n const searchParams = new URLSearchParams()\n for (const [key, value] of Object.entries(query)) {\n if (Array.isArray(value)) {\n for (const item of value) {\n searchParams.append(key, stringifyUrlQueryParam(item))\n }\n } else {\n searchParams.set(key, stringifyUrlQueryParam(value))\n }\n }\n return searchParams\n}\n\nexport function assign(\n target: URLSearchParams,\n ...searchParamsList: URLSearchParams[]\n): URLSearchParams {\n for (const searchParams of searchParamsList) {\n for (const key of searchParams.keys()) {\n target.delete(key)\n }\n\n for (const [key, value] of searchParams.entries()) {\n target.append(key, value)\n }\n }\n\n return target\n}\n","// Format function modified from nodejs\n// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\nimport type { UrlObject } from 'url'\nimport type { ParsedUrlQuery } from 'querystring'\nimport * as querystring from './querystring'\n\nconst slashedProtocols = /https?|ftp|gopher|file/\n\nexport function formatUrl(urlObj: UrlObject) {\n let { auth, hostname } = urlObj\n let protocol = urlObj.protocol || ''\n let pathname = urlObj.pathname || ''\n let hash = urlObj.hash || ''\n let query = urlObj.query || ''\n let host: string | false = false\n\n auth = auth ? encodeURIComponent(auth).replace(/%3A/i, ':') + '@' : ''\n\n if (urlObj.host) {\n host = auth + urlObj.host\n } else if (hostname) {\n host = auth + (~hostname.indexOf(':') ? `[${hostname}]` : hostname)\n if (urlObj.port) {\n host += ':' + urlObj.port\n }\n }\n\n if (query && typeof query === 'object') {\n query = String(querystring.urlQueryToSearchParams(query as ParsedUrlQuery))\n }\n\n let search = urlObj.search || (query && `?${query}`) || ''\n\n if (protocol && !protocol.endsWith(':')) protocol += ':'\n\n if (\n urlObj.slashes ||\n ((!protocol || slashedProtocols.test(protocol)) && host !== false)\n ) {\n host = '//' + (host || '')\n if (pathname && pathname[0] !== '/') pathname = '/' + pathname\n } else if (!host) {\n host = ''\n }\n\n if (hash && hash[0] !== '#') hash = '#' + hash\n if (search && search[0] !== '?') search = '?' + search\n\n pathname = pathname.replace(/[?#]/g, encodeURIComponent)\n search = search.replace('#', '%23')\n\n return `${protocol}${host}${pathname}${search}${hash}`\n}\n\nexport const urlObjectKeys = [\n 'auth',\n 'hash',\n 'host',\n 'hostname',\n 'href',\n 'path',\n 'pathname',\n 'port',\n 'protocol',\n 'query',\n 'search',\n 'slashes',\n]\n\nexport function formatWithValidation(url: UrlObject): string {\n if (process.env.NODE_ENV === 'development') {\n if (url !== null && typeof url === 'object') {\n Object.keys(url).forEach((key) => {\n if (!urlObjectKeys.includes(key)) {\n console.warn(\n `Unknown key passed via urlObject into url.format: ${key}`\n )\n }\n })\n }\n }\n\n return formatUrl(url)\n}\n","import { useCallback, useRef, type Ref } from 'react'\n\n// This is a compatibility hook to support React 18 and 19 refs.\n// In 19, a cleanup function from refs may be returned.\n// In 18, returning a cleanup function creates a warning.\n// Since we take userspace refs, we don't know ahead of time if a cleanup function will be returned.\n// This implements cleanup functions with the old behavior in 18.\n// We know refs are always called alternating with `null` and then `T`.\n// So a call with `null` means we need to call the previous cleanup functions.\nexport function useMergedRef<TElement>(\n refA: Ref<TElement>,\n refB: Ref<TElement>\n): Ref<TElement> {\n const cleanupA = useRef<(() => void) | null>(null)\n const cleanupB = useRef<(() => void) | null>(null)\n\n // NOTE: In theory, we could skip the wrapping if only one of the refs is non-null.\n // (this happens often if the user doesn't pass a ref to Link/Form/Image)\n // But this can cause us to leak a cleanup-ref into user code (previously via `<Link legacyBehavior>`),\n // and the user might pass that ref into ref-merging library that doesn't support cleanup refs\n // (because it hasn't been updated for React 19)\n // which can then cause things to blow up, because a cleanup-returning ref gets called with `null`.\n // So in practice, it's safer to be defensive and always wrap the ref, even on React 19.\n return useCallback(\n (current: TElement | null): void => {\n if (current === null) {\n const cleanupFnA = cleanupA.current\n if (cleanupFnA) {\n cleanupA.current = null\n cleanupFnA()\n }\n const cleanupFnB = cleanupB.current\n if (cleanupFnB) {\n cleanupB.current = null\n cleanupFnB()\n }\n } else {\n if (refA) {\n cleanupA.current = applyRef(refA, current)\n }\n if (refB) {\n cleanupB.current = applyRef(refB, current)\n }\n }\n },\n [refA, refB]\n )\n}\n\nfunction applyRef<TElement>(\n refA: NonNullable<Ref<TElement>>,\n current: TElement\n) {\n if (typeof refA === 'function') {\n const cleanup = refA(current)\n if (typeof cleanup === 'function') {\n return cleanup\n } else {\n return () => refA(null)\n }\n } else {\n refA.current = current\n return () => {\n refA.current = null\n }\n }\n}\n","import type { HtmlProps } from './html-context.shared-runtime'\nimport type { ComponentType, JSX } from 'react'\nimport type { DomainLocale } from '../../server/config'\nimport type { Env } from '@next/env'\nimport type { IncomingMessage, ServerResponse } from 'http'\nimport type { NextRouter } from './router/router'\nimport type { ParsedUrlQuery } from 'querystring'\nimport type { PreviewData } from '../../types'\nimport type { COMPILER_NAMES } from './constants'\nimport type fs from 'fs'\n\nexport type NextComponentType<\n Context extends BaseContext = NextPageContext,\n InitialProps = {},\n Props = {},\n> = ComponentType<Props> & {\n /**\n * Used for initial page load data population. Data returned from `getInitialProps` is serialized when server rendered.\n * Make sure to return plain `Object` without using `Date`, `Map`, `Set`.\n * @param context Context of `page`\n */\n getInitialProps?(context: Context): InitialProps | Promise<InitialProps>\n}\n\nexport type DocumentType = NextComponentType<\n DocumentContext,\n DocumentInitialProps,\n DocumentProps\n>\n\nexport type AppType<P = {}> = NextComponentType<\n AppContextType,\n P,\n AppPropsType<any, P>\n>\n\nexport type AppTreeType = ComponentType<\n AppInitialProps & { [name: string]: any }\n>\n\n/**\n * Web vitals provided to _app.reportWebVitals by Core Web Vitals plugin developed by Google Chrome team.\n * https://nextjs.org/blog/next-9-4#integrated-web-vitals-reporting\n */\nexport const WEB_VITALS = ['CLS', 'FCP', 'FID', 'INP', 'LCP', 'TTFB'] as const\nexport type NextWebVitalsMetric = {\n id: string\n startTime: number\n value: number\n attribution?: { [key: string]: unknown }\n} & (\n | {\n label: 'web-vital'\n name: (typeof WEB_VITALS)[number]\n }\n | {\n label: 'custom'\n name:\n | 'Next.js-hydration'\n | 'Next.js-route-change-to-render'\n | 'Next.js-render'\n }\n)\n\nexport type Enhancer<C> = (Component: C) => C\n\nexport type ComponentsEnhancer =\n | {\n enhanceApp?: Enhancer<AppType>\n enhanceComponent?: Enhancer<NextComponentType>\n }\n | Enhancer<NextComponentType>\n\nexport type RenderPageResult = {\n html: string\n head?: Array<JSX.Element | null>\n}\n\nexport type RenderPage = (\n options?: ComponentsEnhancer\n) => DocumentInitialProps | Promise<DocumentInitialProps>\n\nexport type BaseContext = {\n res?: ServerResponse\n [k: string]: any\n}\n\nexport type NEXT_DATA = {\n props: Record<string, any>\n page: string\n query: ParsedUrlQuery\n buildId: string\n assetPrefix?: string\n nextExport?: boolean\n autoExport?: boolean\n isFallback?: boolean\n isExperimentalCompile?: boolean\n dynamicIds?: (string | number)[]\n err?: Error & {\n statusCode?: number\n source?: typeof COMPILER_NAMES.server | typeof COMPILER_NAMES.edgeServer\n }\n gsp?: boolean\n gssp?: boolean\n customServer?: boolean\n gip?: boolean\n appGip?: boolean\n locale?: string\n locales?: readonly string[]\n defaultLocale?: string\n domainLocales?: readonly DomainLocale[]\n scriptLoader?: any[]\n isPreview?: boolean\n notFoundSrcPage?: string\n}\n\n/**\n * `Next` context\n */\nexport interface NextPageContext {\n /**\n * Error object if encountered during rendering\n */\n err?: (Error & { statusCode?: number }) | null\n /**\n * `HTTP` request object.\n */\n req?: IncomingMessage\n /**\n * `HTTP` response object.\n */\n res?: ServerResponse\n /**\n * Path section of `URL`.\n */\n pathname: string\n /**\n * Query string section of `URL` parsed as an object.\n */\n query: ParsedUrlQuery\n /**\n * `String` of the actual path including query.\n */\n asPath?: string\n /**\n * The currently active locale\n */\n locale?: string\n /**\n * All configured locales\n */\n locales?: readonly string[]\n /**\n * The configured default locale\n */\n defaultLocale?: string\n /**\n * `Component` the tree of the App to use if needing to render separately\n */\n AppTree: AppTreeType\n}\n\nexport type AppContextType<Router extends NextRouter = NextRouter> = {\n Component: NextComponentType<NextPageContext>\n AppTree: AppTreeType\n ctx: NextPageContext\n router: Router\n}\n\nexport type AppInitialProps<PageProps = any> = {\n pageProps: PageProps\n}\n\nexport type AppPropsType<\n Router extends NextRouter = NextRouter,\n PageProps = {},\n> = AppInitialProps<PageProps> & {\n Component: NextComponentType<NextPageContext, any, any>\n router: Router\n __N_SSG?: boolean\n __N_SSP?: boolean\n}\n\nexport type DocumentContext = NextPageContext & {\n renderPage: RenderPage\n defaultGetInitialProps(\n ctx: DocumentContext,\n options?: { nonce?: string }\n ): Promise<DocumentInitialProps>\n}\n\nexport type DocumentInitialProps = RenderPageResult & {\n styles?: React.ReactElement[] | Iterable<React.ReactNode> | JSX.Element\n}\n\nexport type DocumentProps = DocumentInitialProps & HtmlProps\n\n/**\n * Next `API` route request\n */\nexport interface NextApiRequest extends IncomingMessage {\n /**\n * Object of `query` values from url\n */\n query: Partial<{\n [key: string]: string | string[]\n }>\n /**\n * Object of `cookies` from header\n */\n cookies: Partial<{\n [key: string]: string\n }>\n\n body: any\n\n env: Env\n\n draftMode?: boolean\n\n preview?: boolean\n /**\n * Preview data set on the request, if any\n * */\n previewData?: PreviewData\n}\n\n/**\n * Send body of response\n */\ntype Send<T> = (body: T) => void\n\n/**\n * Next `API` route response\n */\nexport type NextApiResponse<Data = any> = ServerResponse & {\n /**\n * Send data `any` data in response\n */\n send: Send<Data>\n /**\n * Send data `json` data in response\n */\n json: Send<Data>\n status: (statusCode: number) => NextApiResponse<Data>\n redirect(url: string): NextApiResponse<Data>\n redirect(status: number, url: string): NextApiResponse<Data>\n\n /**\n * Set draft mode\n */\n setDraftMode: (options: { enable: boolean }) => NextApiResponse<Data>\n\n /**\n * Set preview data for Next.js' prerender mode\n */\n setPreviewData: (\n data: object | string,\n options?: {\n /**\n * Specifies the number (in seconds) for the preview session to last for.\n * The given number will be converted to an integer by rounding down.\n * By default, no maximum age is set and the preview session finishes\n * when the client shuts down (browser is closed).\n */\n maxAge?: number\n /**\n * Specifies the path for the preview session to work under. By default,\n * the path is considered the \"default path\", i.e., any pages under \"/\".\n */\n path?: string\n }\n ) => NextApiResponse<Data>\n\n /**\n * Clear preview data for Next.js' prerender mode\n */\n clearPreviewData: (options?: { path?: string }) => NextApiResponse<Data>\n\n /**\n * Revalidate a specific page and regenerate it using On-Demand Incremental\n * Static Regeneration.\n * The path should be an actual path, not a rewritten path. E.g. for\n * \"/blog/[slug]\" this should be \"/blog/post-1\".\n * @link https://nextjs.org/docs/app/building-your-application/data-fetching/incremental-static-regeneration#on-demand-revalidation-with-revalidatepath\n */\n revalidate: (\n urlPath: string,\n opts?: {\n unstable_onlyGenerated?: boolean\n }\n ) => Promise<void>\n}\n\n/**\n * Next `API` route handler\n */\nexport type NextApiHandler<T = any> = (\n req: NextApiRequest,\n res: NextApiResponse<T>\n) => unknown | Promise<unknown>\n\n/**\n * Utils\n */\nexport function execOnce<T extends (...args: any[]) => ReturnType<T>>(\n fn: T\n): T {\n let used = false\n let result: ReturnType<T>\n\n return ((...args: any[]) => {\n if (!used) {\n used = true\n result = fn(...args)\n }\n return result\n }) as T\n}\n\n// Scheme: https://tools.ietf.org/html/rfc3986#section-3.1\n// Absolute URL: https://tools.ietf.org/html/rfc3986#section-4.3\nconst ABSOLUTE_URL_REGEX = /^[a-zA-Z][a-zA-Z\\d+\\-.]*?:/\nexport const isAbsoluteUrl = (url: string) => ABSOLUTE_URL_REGEX.test(url)\n\nexport function getLocationOrigin() {\n const { protocol, hostname, port } = window.location\n return `${protocol}//${hostname}${port ? ':' + port : ''}`\n}\n\nexport function getURL() {\n const { href } = window.location\n const origin = getLocationOrigin()\n return href.substring(origin.length)\n}\n\nexport function getDisplayName<P>(Component: ComponentType<P>) {\n return typeof Component === 'string'\n ? Component\n : Component.displayName || Component.name || 'Unknown'\n}\n\nexport function isResSent(res: ServerResponse) {\n return res.finished || res.headersSent\n}\n\nexport function normalizeRepeatedSlashes(url: string) {\n const urlParts = url.split('?')\n const urlNoQuery = urlParts[0]\n\n return (\n urlNoQuery\n // first we replace any non-encoded backslashes with forward\n // then normalize repeated forward slashes\n .replace(/\\\\/g, '/')\n .replace(/\\/\\/+/g, '/') +\n (urlParts[1] ? `?${urlParts.slice(1).join('?')}` : '')\n )\n}\n\nexport async function loadGetInitialProps<\n C extends BaseContext,\n IP = {},\n P = {},\n>(App: NextComponentType<C, IP, P>, ctx: C): Promise<IP> {\n if (process.env.NODE_ENV !== 'production') {\n if (App.prototype?.getInitialProps) {\n const message = `\"${getDisplayName(\n App\n )}.getInitialProps()\" is defined as an instance method - visit https://nextjs.org/docs/messages/get-initial-props-as-an-instance-method for more information.`\n throw new Error(message)\n }\n }\n // when called from _app `ctx` is nested in `ctx`\n const res = ctx.res || (ctx.ctx && ctx.ctx.res)\n\n if (!App.getInitialProps) {\n if (ctx.ctx && ctx.Component) {\n // @ts-ignore pageProps default\n return {\n pageProps: await loadGetInitialProps(ctx.Component, ctx.ctx),\n }\n }\n return {} as IP\n }\n\n const props = await App.getInitialProps(ctx)\n\n if (res && isResSent(res)) {\n return props\n }\n\n if (!props) {\n const message = `\"${getDisplayName(\n App\n )}.getInitialProps()\" should resolve to an object. But found \"${props}\" instead.`\n throw new Error(message)\n }\n\n if (process.env.NODE_ENV !== 'production') {\n if (Object.keys(props).length === 0 && !ctx.ctx) {\n console.warn(\n `${getDisplayName(\n App\n )} returned an empty object from \\`getInitialProps\\`. This de-optimizes and prevents automatic static optimization. https://nextjs.org/docs/messages/empty-object-getInitialProps`\n )\n }\n }\n\n return props\n}\n\nexport const SP = typeof performance !== 'undefined'\nexport const ST =\n SP &&\n (['mark', 'measure', 'getEntriesByName'] as const).every(\n (method) => typeof performance[method] === 'function'\n )\n\nexport class DecodeError extends Error {}\nexport class NormalizeError extends Error {}\nexport class PageNotFoundError extends Error {\n code: string\n\n constructor(page: string) {\n super()\n this.code = 'ENOENT'\n this.name = 'PageNotFoundError'\n this.message = `Cannot find module for page: ${page}`\n }\n}\n\nexport class MissingStaticPage extends Error {\n constructor(page: string, message: string) {\n super()\n this.message = `Failed to load static file for page: ${page} ${message}`\n }\n}\n\nexport class MiddlewareNotFoundError extends Error {\n code: string\n constructor() {\n super()\n this.code = 'ENOENT'\n this.message = `Cannot find the middleware module`\n }\n}\n\nexport interface CacheFs {\n existsSync: typeof fs.existsSync\n readFile: typeof fs.promises.readFile\n readFileSync: typeof fs.readFileSync\n writeFile(f: string, d: any): Promise<void>\n mkdir(dir: string): Promise<void | string>\n stat(f: string): Promise<{ mtime: Date }>\n}\n\nexport function stringifyError(error: Error) {\n return JSON.stringify({ message: error.message, stack: error.stack })\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","/**\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","import { removeTrailingSlash } from '../shared/lib/router/utils/remove-trailing-slash'\nimport { parsePath } from '../shared/lib/router/utils/parse-path'\n\n/**\n * Normalizes the trailing slash of a path according to the `trailingSlash` option\n * in `next.config.js`.\n */\nexport const normalizePathTrailingSlash = (path: string) => {\n if (!path.startsWith('/') || process.env.__NEXT_MANUAL_TRAILING_SLASH) {\n return path\n }\n\n const { pathname, query, hash } = parsePath(path)\n if (process.env.__NEXT_TRAILING_SLASH) {\n if (/\\.[^/]+\\/?$/.test(pathname)) {\n return `${removeTrailingSlash(pathname)}${query}${hash}`\n } else if (pathname.endsWith('/')) {\n return `${pathname}${query}${hash}`\n } else {\n return `${pathname}/${query}${hash}`\n }\n }\n\n return `${removeTrailingSlash(pathname)}${query}${hash}`\n}\n","import { addPathPrefix } from '../shared/lib/router/utils/add-path-prefix'\nimport { normalizePathTrailingSlash } from './normalize-trailing-slash'\n\nconst basePath = (process.env.__NEXT_ROUTER_BASEPATH as string) || ''\n\nexport function addBasePath(path: string, required?: boolean): string {\n return normalizePathTrailingSlash(\n process.env.__NEXT_MANUAL_CLIENT_BASE_PATH && !required\n ? path\n : addPathPrefix(path, basePath)\n )\n}\n","let warnOnce = (_: string) => {}\nif (process.env.NODE_ENV !== 'production') {\n const warnings = new Set<string>()\n warnOnce = (msg: string) => {\n if (!warnings.has(msg)) {\n console.warn(msg)\n }\n warnings.add(msg)\n }\n}\n\nexport { warnOnce }\n","/**\n * Shared types and constants for the Segment Cache.\n */\n\nexport const enum NavigationResultTag {\n MPA,\n Success,\n NoOp,\n Async,\n}\n\n/**\n * The priority of the prefetch task. Higher numbers are higher priority.\n */\nexport const enum PrefetchPriority {\n /**\n * Assigned to the most recently hovered/touched link. Special network\n * bandwidth is reserved for this task only. There's only ever one Intent-\n * priority task at a time; when a new Intent task is scheduled, the previous\n * one is bumped down to Default.\n */\n Intent = 2,\n /**\n * The default priority for prefetch tasks.\n */\n Default = 1,\n /**\n * Assigned to tasks when they spawn non-blocking background work, like\n * revalidating a partially cached entry to see if more data is available.\n */\n Background = 0,\n}\n\nexport const enum FetchStrategy {\n // Deliberately ordered so we can easily compare two segments\n // and determine if one segment is \"more specific\" than another\n // (i.e. if it's likely that it contains more data)\n LoadingBoundary = 0,\n PPR = 1,\n PPRRuntime = 2,\n Full = 3,\n}\n\n/**\n * A subset of fetch strategies used for prefetch tasks.\n * A prefetch task can't know if it should use `PPR` or `LoadingBoundary`\n * until we complete the initial tree prefetch request, so we use `PPR` to signal both cases\n * and adjust it based on the route when actually fetching.\n * */\nexport type PrefetchTaskFetchStrategy =\n | FetchStrategy.PPR\n | FetchStrategy.PPRRuntime\n | FetchStrategy.Full\n","// TypeScript trick to simulate opaque types, like in Flow.\ntype Opaque<K, T> = T & { __brand: K }\n\n// Only functions in this module should be allowed to create CacheKeys.\nexport type NormalizedPathname = Opaque<'NormalizedPathname', string>\nexport type NormalizedSearch = Opaque<'NormalizedSearch', string>\nexport type NormalizedNextUrl = Opaque<'NormalizedNextUrl', string>\n\nexport type RouteCacheKey = Opaque<\n 'RouteCacheKey',\n {\n pathname: NormalizedPathname\n search: NormalizedSearch\n nextUrl: NormalizedNextUrl | null\n\n // TODO: Eventually the dynamic params will be added here, too.\n }\n>\n\nexport function createCacheKey(\n originalHref: string,\n nextUrl: string | null\n): RouteCacheKey {\n const originalUrl = new URL(originalHref)\n const cacheKey = {\n pathname: originalUrl.pathname as NormalizedPathname,\n search: originalUrl.search as NormalizedSearch,\n nextUrl: nextUrl as NormalizedNextUrl | null,\n } as RouteCacheKey\n return cacheKey\n}\n","/**\n * App Router types - Client-safe types for the Next.js App Router\n *\n * This file contains type definitions that can be safely imported\n * by both client-side and server-side code without circular dependencies.\n */\nimport type { FetchServerResponseResult } from '../../client/components/router-reducer/fetch-server-response'\nimport type React from 'react'\n\nexport type LoadingModuleData =\n | [React.JSX.Element, React.ReactNode, React.ReactNode]\n | null\n\n/** viewport metadata node */\nexport type HeadData = React.ReactNode\n\nexport type ChildSegmentMap = Map<string, CacheNode>\n\n/**\n * Cache node used in app-router / layout-router.\n */\nexport type CacheNode = ReadyCacheNode | LazyCacheNode\n\nexport type LazyCacheNode = {\n /**\n * When rsc is null, this is a lazily-initialized cache node.\n *\n * If the app attempts to render it, it triggers a lazy data fetch,\n * postpones the render, and schedules an update to a new tree.\n *\n * TODO: This mechanism should not be used when PPR is enabled, though it\n * currently is in some cases until we've implemented partial\n * segment fetching.\n */\n rsc: null\n\n /**\n * A prefetched version of the segment data. See explanation in corresponding\n * field of ReadyCacheNode (below).\n *\n * Since LazyCacheNode mostly only exists in the non-PPR implementation, this\n * will usually be null, but it could have been cloned from a previous\n * CacheNode that was created by the PPR implementation. Eventually we want\n * to migrate everything away from LazyCacheNode entirely.\n */\n prefetchRsc: React.ReactNode\n\n /**\n * A pending response for the lazy data fetch. If this is not present\n * during render, it is lazily created.\n */\n lazyData: Promise<FetchServerResponseResult> | null\n\n prefetchHead: HeadData | null\n\n head: HeadData\n\n loading: LoadingModuleData | Promise<LoadingModuleData>\n\n /**\n * Child parallel routes.\n */\n parallelRoutes: Map<string, ChildSegmentMap>\n\n /**\n * The timestamp of the navigation that last updated the CacheNode's data. If\n * a CacheNode is reused from a previous navigation, this value is not\n * updated. Used to track the staleness of the data.\n */\n navigatedAt: number\n}\n\nexport type ReadyCacheNode = {\n /**\n * When rsc is not null, it represents the RSC data for the\n * corresponding segment.\n *\n * `null` is a valid React Node but because segment data is always a\n * <LayoutRouter> component, we can use `null` to represent empty.\n *\n * TODO: For additional type safety, update this type to\n * Exclude<React.ReactNode, null>. Need to update createEmptyCacheNode to\n * accept rsc as an argument, or just inline the callers.\n */\n rsc: React.ReactNode\n\n /**\n * Represents a static version of the segment that can be shown immediately,\n * and may or may not contain dynamic holes. It's prefetched before a\n * navigation occurs.\n *\n * During rendering, we will choose whether to render `rsc` or `prefetchRsc`\n * with `useDeferredValue`. As with the `rsc` field, a value of `null` means\n * no value was provided. In this case, the LayoutRouter will go straight to\n * rendering the `rsc` value; if that one is also missing, it will suspend and\n * trigger a lazy fetch.\n */\n prefetchRsc: React.ReactNode\n\n /**\n * There should never be a lazy data request in this case.\n */\n lazyData: null\n prefetchHead: HeadData | null\n\n head: HeadData\n\n loading: LoadingModuleData | Promise<LoadingModuleData>\n\n parallelRoutes: Map<string, ChildSegmentMap>\n\n navigatedAt: number\n}\n\nexport type DynamicParamTypes =\n | 'catchall'\n | 'catchall-intercepted-(..)(..)'\n | 'catchall-intercepted-(.)'\n | 'catchall-intercepted-(..)'\n | 'catchall-intercepted-(...)'\n | 'optional-catchall'\n | 'dynamic'\n | 'dynamic-intercepted-(..)(..)'\n | 'dynamic-intercepted-(.)'\n | 'dynamic-intercepted-(..)'\n | 'dynamic-intercepted-(...)'\n\nexport type DynamicParamTypesShort =\n | 'c'\n | 'ci(..)(..)'\n | 'ci(.)'\n | 'ci(..)'\n | 'ci(...)'\n | 'oc'\n | 'd'\n | 'di(..)(..)'\n | 'di(.)'\n | 'di(..)'\n | 'di(...)'\n\nexport type Segment =\n | string\n | [\n // Param name\n paramName: string,\n // Param cache key (almost the same as the value, but arrays are\n // concatenated into strings)\n // TODO: We should change this to just be the value. Currently we convert\n // it back to a value when passing to useParams. It only needs to be\n // a string when converted to a a cache key, but that doesn't mean we\n // need to store it as that representation.\n paramCacheKey: string,\n // Dynamic param type\n dynamicParamType: DynamicParamTypesShort,\n ]\n\n/**\n * Router state\n */\nexport type FlightRouterState = [\n segment: Segment,\n parallelRoutes: { [parallelRouterKey: string]: FlightRouterState },\n url?: string | null,\n /**\n * \"refresh\" and \"refetch\", despite being similarly named, have different\n * semantics:\n * - \"refetch\" is used during a request to inform the server where rendering\n * should start from.\n *\n * - \"refresh\" is used by the client to mark that a segment should re-fetch the\n * data from the server for the current segment. It uses the \"url\" property\n * above to determine where to fetch from.\n *\n * - \"inside-shared-layout\" is used during a prefetch request to inform the\n * server that even if the segment matches, it should be treated as if it's\n * within the \"new\" part of a navigation — inside the shared layout. If\n * the segment doesn't match, then it has no effect, since it would be\n * treated as new regardless. If it does match, though, the server does not\n * need to render it, because the client already has it.\n *\n * - \"metadata-only\" instructs the server to skip rendering the segments and\n * only send the head data.\n *\n * A bit confusing, but that's because it has only one extremely narrow use\n * case — during a non-PPR prefetch, the server uses it to find the first\n * loading boundary beneath a shared layout.\n *\n * TODO: We should rethink the protocol for dynamic requests. It might not\n * make sense for the client to send a FlightRouterState, since this type is\n * overloaded with concerns.\n */\n refresh?:\n | 'refetch'\n | 'refresh'\n | 'inside-shared-layout'\n | 'metadata-only'\n | null,\n isRootLayout?: boolean,\n /**\n * Only present when responding to a tree prefetch request. Indicates whether\n * there is a loading boundary somewhere in the tree. The client cache uses\n * this to determine if it can skip the data prefetch request.\n */\n hasLoadingBoundary?: HasLoadingBoundary,\n]\n\nexport const enum HasLoadingBoundary {\n // There is a loading boundary in this particular segment\n SegmentHasLoadingBoundary = 1,\n // There is a loading boundary somewhere in the subtree (but not in\n // this segment)\n SubtreeHasLoadingBoundary = 2,\n // There is no loading boundary in this segment or any of its descendants\n SubtreeHasNoLoadingBoundary = 3,\n}\n\n/**\n * Individual Flight response path\n */\nexport type FlightSegmentPath =\n // Uses `any` as repeating pattern can't be typed.\n | any[]\n // Looks somewhat like this\n | [\n segment: Segment,\n parallelRouterKey: string,\n segment: Segment,\n parallelRouterKey: string,\n segment: Segment,\n parallelRouterKey: string,\n ]\n\n/**\n * Represents a tree of segments and the Flight data (i.e. React nodes) that\n * correspond to each one. The tree is isomorphic to the FlightRouterState;\n * however in the future we want to be able to fetch arbitrary partial segments\n * without having to fetch all its children. So this response format will\n * likely change.\n */\nexport type CacheNodeSeedData = [\n node: React.ReactNode | null,\n parallelRoutes: {\n [parallelRouterKey: string]: CacheNodeSeedData | null\n },\n loading: LoadingModuleData | Promise<LoadingModuleData>,\n isPartial: boolean,\n /** TODO: this doesn't feel like it belongs here, because it's only used during build, in `collectSegmentData` */\n hasRuntimePrefetch: boolean,\n]\n\nexport type FlightDataSegment = [\n /* segment of the rendered slice: */ Segment,\n /* treePatch */ FlightRouterState,\n /* cacheNodeSeedData */ CacheNodeSeedData | null, // Can be null during prefetch if there's no loading component\n /* head: viewport */ HeadData,\n /* isHeadPartial */ boolean,\n]\n\nexport type FlightDataPath =\n // Uses `any` as repeating pattern can't be typed.\n | any[]\n // Looks somewhat like this\n | [\n // Holds full path to the segment.\n ...FlightSegmentPath[],\n ...FlightDataSegment,\n ]\n\n/**\n * The Flight response data\n */\nexport type FlightData = Array<FlightDataPath> | string\n\nexport type ActionResult = Promise<any>\n\nexport type InitialRSCPayload = {\n /** buildId */\n b: string\n /** initialCanonicalUrlParts */\n c: string[]\n /** initialRenderedSearch */\n q: string\n /** couldBeIntercepted */\n i: boolean\n /** initialFlightData */\n f: FlightDataPath[]\n /** missingSlots */\n m: Set<string> | undefined\n /** GlobalError */\n G: [React.ComponentType<any>, React.ReactNode | undefined]\n /** prerendered */\n S: boolean\n}\n\n// Response from `createFromFetch` for normal rendering\nexport type NavigationFlightResponse = {\n /** buildId */\n b: string\n /** flightData */\n f: FlightData\n /** prerendered */\n S: boolean\n /** runtimePrefetch - [isPartial, staleTime]. Only present in runtime prefetch responses. */\n rp?: [boolean, number]\n}\n\n// Response from `createFromFetch` for server actions. Action's flight data can be null\nexport type ActionFlightResponse = {\n /** actionResult */\n a: ActionResult\n /** buildId */\n b: string\n /** flightData */\n f: FlightData\n}\n\nexport type RSCPayload =\n | InitialRSCPayload\n | NavigationFlightResponse\n | ActionFlightResponse\n","import type { Segment } from '../../shared/lib/app-router-types'\n\nexport const matchSegment = (\n existingSegment: Segment,\n segment: Segment\n): boolean => {\n // segment is either Array or string\n if (typeof existingSegment === 'string') {\n if (typeof segment === 'string') {\n // Common case: segment is just a string\n return existingSegment === segment\n }\n return false\n }\n\n if (typeof segment === 'string') {\n return false\n }\n return existingSegment[0] === segment[0] && existingSegment[1] === segment[1]\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","import type { CacheNode } from '../../../shared/lib/app-router-types'\nimport type {\n FlightRouterState,\n FlightSegmentPath,\n} from '../../../shared/lib/app-router-types'\nimport type { FetchServerResponseResult } from './fetch-server-response'\n\nexport const ACTION_REFRESH = 'refresh'\nexport const ACTION_NAVIGATE = 'navigate'\nexport const ACTION_RESTORE = 'restore'\nexport const ACTION_SERVER_PATCH = 'server-patch'\nexport const ACTION_HMR_REFRESH = 'hmr-refresh'\nexport const ACTION_SERVER_ACTION = 'server-action'\n\nexport type RouterChangeByServerResponse = ({\n navigatedAt,\n previousTree,\n serverResponse,\n}: {\n navigatedAt: number\n previousTree: FlightRouterState\n serverResponse: FetchServerResponseResult\n}) => void\n\nexport interface Mutable {\n mpaNavigation?: boolean\n patchedTree?: FlightRouterState\n renderedSearch?: string\n canonicalUrl?: string\n scrollableSegments?: FlightSegmentPath[]\n pendingPush?: boolean\n cache?: CacheNode\n hashFragment?: string\n shouldScroll?: boolean\n preserveCustomHistoryState?: boolean\n onlyHashChange?: boolean\n collectedDebugInfo?: Array<unknown>\n}\n\nexport interface ServerActionMutable extends Mutable {\n inFlightServerAction?: Promise<any> | null\n}\n\n/**\n * Refresh triggers a refresh of the full page data.\n * - fetches the Flight data and fills rsc at the root of the cache.\n * - The router state is updated at the root.\n */\nexport interface RefreshAction {\n type: typeof ACTION_REFRESH\n origin: Location['origin']\n}\n\nexport interface HmrRefreshAction {\n type: typeof ACTION_HMR_REFRESH\n origin: Location['origin']\n}\n\nexport type ServerActionDispatcher = (\n args: Omit<\n ServerActionAction,\n 'type' | 'mutable' | 'navigate' | 'changeByServerResponse' | 'cache'\n >\n) => void\n\nexport interface ServerActionAction {\n type: typeof ACTION_SERVER_ACTION\n actionId: string\n actionArgs: any[]\n resolve: (value: any) => void\n reject: (reason?: any) => void\n didRevalidate?: boolean\n}\n\n/**\n * Navigate triggers a navigation to the provided url. It supports two types: `push` and `replace`.\n *\n * `navigateType`:\n * - `push` - pushes a new history entry in the browser history\n * - `replace` - replaces the current history entry in the browser history\n *\n * Navigate has multiple cache heuristics:\n * - page was prefetched\n * - Apply router state tree from prefetch\n * - Apply Flight data from prefetch to the cache\n * - If Flight data is a string, it's a redirect and the state is updated to trigger a redirect\n * - Check if hard navigation is needed\n * - Hard navigation happens when a dynamic parameter below the common layout changed\n * - When hard navigation is needed the cache is invalidated below the flightSegmentPath\n * - The missing cache nodes of the page will be fetched in layout-router and trigger the SERVER_PATCH action\n * - If hard navigation is not needed\n * - The cache is reused\n * - If any cache nodes are missing they'll be fetched in layout-router and trigger the SERVER_PATCH action\n * - page was not prefetched\n * - The navigate was called from `next/router` (`router.push()` / `router.replace()`) / `next/link` without prefetched data available (e.g. the prefetch didn't come back from the server before clicking the link)\n * - Flight data is fetched in the reducer (suspends the reducer)\n * - Router state tree is created based on Flight data\n * - Cache is filled based on the Flight data\n *\n * Above steps explain 3 cases:\n * - `soft` - Reuses the existing cache and fetches missing nodes in layout-router.\n * - `hard` - Creates a new cache where cache nodes are removed below the common layout and fetches missing nodes in layout-router.\n * - `optimistic` (explicit no prefetch) - Creates a new cache and kicks off the data fetch in the reducer. The data fetch is awaited in the layout-router.\n */\nexport interface NavigateAction {\n type: typeof ACTION_NAVIGATE\n url: URL\n isExternalUrl: boolean\n locationSearch: Location['search']\n navigateType: 'push' | 'replace'\n shouldScroll: boolean\n}\n\n/**\n * Restore applies the provided router state.\n * - Used for `popstate` (back/forward navigation) where a known router state has to be applied.\n * - Also used when syncing the router state with `pushState`/`replaceState` calls.\n * - Router state is applied as-is from the history state, if available.\n * - If the history state does not contain the router state, the existing router state is used.\n * - If any cache node is missing it will be fetched in layout-router during rendering and the server-patch case.\n * - If existing cache nodes match these are used.\n */\nexport interface RestoreAction {\n type: typeof ACTION_RESTORE\n url: URL\n historyState: AppHistoryState | undefined\n}\n\nexport type AppHistoryState = {\n tree: FlightRouterState\n renderedSearch: string\n}\n\n/**\n * Server-patch applies the provided Flight data to the cache and router tree.\n * - Only triggered in layout-router.\n * - Creates a new cache and router state with the Flight data applied.\n */\nexport interface ServerPatchAction {\n type: typeof ACTION_SERVER_PATCH\n navigatedAt: number\n serverResponse: FetchServerResponseResult\n previousTree: FlightRouterState\n}\n\n/**\n * PrefetchKind defines the type of prefetching that should be done.\n * - `auto` - if the page is dynamic, prefetch the page data partially, if static prefetch the page data fully.\n * - `full` - prefetch the page data fully.\n * - `temporary` - a temporary prefetch entry is added to the cache, this is used when prefetch={false} is used in next/link or when you push a route programmatically.\n */\n\nexport enum PrefetchKind {\n AUTO = 'auto',\n FULL = 'full',\n TEMPORARY = 'temporary',\n}\n\n/**\n * Prefetch adds the provided FlightData to the prefetch cache\n * - Creates the router state tree based on the patch in FlightData\n * - Adds the FlightData to the prefetch cache\n * - In ACTION_NAVIGATE the prefetch cache is checked and the router state tree and FlightData are applied.\n */\n\nexport interface PushRef {\n /**\n * If the app-router should push a new history entry in app-router's useEffect()\n */\n pendingPush: boolean\n /**\n * Multi-page navigation through location.href.\n */\n mpaNavigation: boolean\n /**\n * Skip applying the router state to the browser history state.\n */\n preserveCustomHistoryState: boolean\n}\n\nexport type FocusAndScrollRef = {\n /**\n * If focus and scroll should be set in the layout-router's useEffect()\n */\n apply: boolean\n /**\n * The hash fragment that should be scrolled to.\n */\n hashFragment: string | null\n /**\n * The paths of the segments that should be focused.\n */\n segmentPaths: FlightSegmentPath[]\n /**\n * If only the URLs hash fragment changed\n */\n onlyHashChange: boolean\n}\n\n/**\n * Handles keeping the state of app-router.\n */\nexport type AppRouterState = {\n /**\n * The router state, this is written into the history state in app-router using replaceState/pushState.\n * - Has to be serializable as it is written into the history state.\n * - Holds which segments and parallel routes are shown on the screen.\n */\n tree: FlightRouterState\n /**\n * The cache holds React nodes for every segment that is shown on screen as well as previously shown segments.\n * It also holds in-progress data requests.\n */\n cache: CacheNode\n /**\n * Decides if the update should create a new history entry and if the navigation has to trigger a browser navigation.\n */\n pushRef: PushRef\n /**\n * Decides if the update should apply scroll and focus management.\n */\n focusAndScrollRef: FocusAndScrollRef\n /**\n * The canonical url that is pushed/replaced.\n * - This is the url you see in the browser.\n */\n canonicalUrl: string\n renderedSearch: string\n /**\n * The underlying \"url\" representing the UI state, which is used for intercepting routes.\n */\n nextUrl: string | null\n\n /**\n * The previous next-url that was used previous to a dynamic navigation.\n */\n previousNextUrl: string | null\n\n debugInfo: Array<unknown> | null\n}\n\nexport type ReadonlyReducerState = Readonly<AppRouterState>\nexport type ReducerState =\n | (Promise<AppRouterState> & { _debugInfo?: Array<unknown> })\n | AppRouterState\nexport type ReducerActions = Readonly<\n | RefreshAction\n | NavigateAction\n | RestoreAction\n | ServerPatchAction\n | HmrRefreshAction\n | ServerActionAction\n>\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 { Dispatch } from 'react'\nimport React, { use, useMemo } from 'react'\nimport { isThenable } from '../../shared/lib/is-thenable'\nimport type { AppRouterActionQueue } from './app-router-instance'\nimport type {\n AppRouterState,\n ReducerActions,\n ReducerState,\n} from './router-reducer/router-reducer-types'\n\n// The app router state lives outside of React, so we can import the dispatch\n// method directly wherever we need it, rather than passing it around via props\n// or context.\nlet dispatch: Dispatch<ReducerActions> | null = null\n\nexport function dispatchAppRouterAction(action: ReducerActions) {\n if (dispatch === null) {\n throw new Error(\n 'Internal Next.js error: Router action dispatched before initialization.'\n )\n }\n dispatch(action)\n}\n\nconst __DEV__ = process.env.NODE_ENV !== 'production'\nconst promisesWithDebugInfo: WeakMap<\n Promise<AppRouterState>,\n Promise<AppRouterState> & { _debugInfo?: Array<unknown> }\n> = __DEV__ ? new WeakMap() : (null as any)\n\nexport function useActionQueue(\n actionQueue: AppRouterActionQueue\n): AppRouterState {\n const [state, setState] = React.useState<ReducerState>(actionQueue.state)\n\n // Because of a known issue that requires to decode Flight streams inside the\n // render phase, we have to be a bit clever and assign the dispatch method to\n // a module-level variable upon initialization. The useState hook in this\n // module only exists to synchronize state that lives outside of React.\n // Ideally, what we'd do instead is pass the state as a prop to root.render;\n // this is conceptually how we're modeling the app router state, despite the\n // weird implementation details.\n if (process.env.NODE_ENV !== 'production') {\n const { useAppDevRenderingIndicator } =\n require('../../next-devtools/userspace/use-app-dev-rendering-indicator') as typeof import('../../next-devtools/userspace/use-app-dev-rendering-indicator')\n // eslint-disable-next-line react-hooks/rules-of-hooks\n const appDevRenderingIndicator = useAppDevRenderingIndicator()\n\n dispatch = (action: ReducerActions) => {\n appDevRenderingIndicator(() => {\n actionQueue.dispatch(action, setState)\n })\n }\n } else {\n dispatch = (action: ReducerActions) =>\n actionQueue.dispatch(action, setState)\n }\n\n // When navigating to a non-prefetched route, then App Router state will be\n // blocked until the server responds. We need to transfer the `_debugInfo`\n // from the underlying Flight response onto the top-level promise that is\n // passed to React (via `use`) so that the latency is accurately represented\n // in the React DevTools.\n const stateWithDebugInfo = useMemo(() => {\n if (!__DEV__) {\n return state\n }\n\n if (isThenable(state)) {\n // useMemo can't be used to cache a Promise since the memoized value is thrown\n // away when we suspend. So we use a WeakMap to cache the Promise with debug info.\n let promiseWithDebugInfo = promisesWithDebugInfo.get(state)\n if (promiseWithDebugInfo === undefined) {\n const debugInfo: Array<unknown> = []\n promiseWithDebugInfo = Promise.resolve(state).then((asyncState) => {\n if (asyncState.debugInfo !== null) {\n debugInfo.push(...asyncState.debugInfo)\n }\n return asyncState\n }) as Promise<AppRouterState> & { _debugInfo?: Array<unknown> }\n promiseWithDebugInfo._debugInfo = debugInfo\n\n promisesWithDebugInfo.set(state, promiseWithDebugInfo)\n }\n\n return promiseWithDebugInfo\n }\n return state\n }, [state])\n\n return isThenable(stateWithDebugInfo)\n ? use(stateWithDebugInfo)\n : stateWithDebugInfo\n}\n","import { startTransition } from 'react'\nimport { ACTION_SERVER_ACTION } from './components/router-reducer/router-reducer-types'\nimport { dispatchAppRouterAction } from './components/use-action-queue'\n\nexport async function callServer(actionId: string, actionArgs: any[]) {\n return new Promise((resolve, reject) => {\n startTransition(() => {\n dispatchAppRouterAction({\n type: ACTION_SERVER_ACTION,\n actionId,\n actionArgs,\n resolve,\n reject,\n })\n })\n })\n}\n","const basePath = process.env.__NEXT_ROUTER_BASEPATH || ''\nconst pathname = `${basePath}/__nextjs_source-map`\n\nexport const findSourceMapURL =\n process.env.NODE_ENV === 'development'\n ? function findSourceMapURL(filename: string): string | null {\n if (filename === '') {\n return null\n }\n\n if (\n filename.startsWith(document.location.origin) &&\n filename.includes('/_next/static')\n ) {\n // This is a request for a client chunk. This can only happen when\n // using Turbopack. In this case, since we control how those source\n // maps are generated, we can safely assume that the sourceMappingURL\n // is relative to the filename, with an added `.map` extension. The\n // browser can just request this file, and it gets served through the\n // normal dev server, without the need to route this through\n // the `/__nextjs_source-map` dev middleware.\n return `${filename}.map`\n }\n\n const url = new URL(pathname, document.location.origin)\n url.searchParams.set('filename', filename)\n\n return url.href\n }\n : undefined\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__'\n","import { PAGE_SEGMENT_KEY } from '../segment'\nimport type { Segment as FlightRouterStateSegment } from '../app-router-types'\n\n// TypeScript trick to simulate opaque types, like in Flow.\ntype Opaque<K, T> = T & { __brand: K }\n\nexport type SegmentRequestKeyPart = Opaque<'SegmentRequestKeyPart', string>\nexport type SegmentRequestKey = Opaque<'SegmentRequestKey', string>\n\nexport const ROOT_SEGMENT_REQUEST_KEY = '' as SegmentRequestKey\n\nexport const HEAD_REQUEST_KEY = '/_head' as SegmentRequestKey\n\nexport function createSegmentRequestKeyPart(\n segment: FlightRouterStateSegment\n): SegmentRequestKeyPart {\n if (typeof segment === 'string') {\n if (segment.startsWith(PAGE_SEGMENT_KEY)) {\n // The Flight Router State type sometimes includes the search params in\n // the page segment. However, the Segment Cache tracks this as a separate\n // key. So, we strip the search params here, and then add them back when\n // the cache entry is turned back into a FlightRouterState. This is an\n // unfortunate consequence of the FlightRouteState being used both as a\n // transport type and as a cache key; we'll address this once more of the\n // Segment Cache implementation has settled.\n // TODO: We should hoist the search params out of the FlightRouterState\n // type entirely, This is our plan for dynamic route params, too.\n return PAGE_SEGMENT_KEY as SegmentRequestKeyPart\n }\n const safeName =\n // TODO: FlightRouterState encodes Not Found routes as \"/_not-found\".\n // But params typically don't include the leading slash. We should use\n // a different encoding to avoid this special case.\n segment === '/_not-found'\n ? '_not-found'\n : encodeToFilesystemAndURLSafeString(segment)\n // Since this is not a dynamic segment, it's fully encoded. It does not\n // need to be \"hydrated\" with a param value.\n return safeName as SegmentRequestKeyPart\n }\n\n const name = segment[0]\n const paramType = segment[2]\n const safeName = encodeToFilesystemAndURLSafeString(name)\n\n const encodedName = '$' + paramType + '$' + safeName\n return encodedName as SegmentRequestKeyPart\n}\n\nexport function appendSegmentRequestKeyPart(\n parentRequestKey: SegmentRequestKey,\n parallelRouteKey: string,\n childRequestKeyPart: SegmentRequestKeyPart\n): SegmentRequestKey {\n // Aside from being filesystem safe, segment keys are also designed so that\n // each segment and parallel route creates its own subdirectory. Roughly in\n // the same shape as the source app directory. This is mostly just for easier\n // debugging (you can open up the build folder and navigate the output); if\n // we wanted to do we could just use a flat structure.\n\n // Omit the parallel route key for children, since this is the most\n // common case. Saves some bytes (and it's what the app directory does).\n const slotKey =\n parallelRouteKey === 'children'\n ? childRequestKeyPart\n : `@${encodeToFilesystemAndURLSafeString(parallelRouteKey)}/${childRequestKeyPart}`\n return (parentRequestKey + '/' + slotKey) as SegmentRequestKey\n}\n\n// Define a regex pattern to match the most common characters found in a route\n// param. It excludes anything that might not be cross-platform filesystem\n// compatible, like |. It does not need to be precise because the fallback is to\n// just base64url-encode the whole parameter, which is fine; we just don't do it\n// by default for compactness, and for easier debugging.\nconst simpleParamValueRegex = /^[a-zA-Z0-9\\-_@]+$/\n\nfunction encodeToFilesystemAndURLSafeString(value: string) {\n if (simpleParamValueRegex.test(value)) {\n return value\n }\n // If there are any unsafe characters, base64url-encode the entire value.\n // We also add a ! prefix so it doesn't collide with the simple case.\n const base64url = btoa(value)\n .replace(/\\+/g, '-') // Replace '+' with '-'\n .replace(/\\//g, '_') // Replace '/' with '_'\n .replace(/=+$/, '') // Remove trailing '='\n return '!' + base64url\n}\n\nexport function convertSegmentPathToStaticExportFilename(\n segmentPath: string\n): string {\n return `__next${segmentPath.replace(/\\//g, '.')}.txt`\n}\n","import type { DynamicParamTypesShort } from '../shared/lib/app-router-types'\nimport {\n addSearchParamsIfPageSegment,\n DEFAULT_SEGMENT_KEY,\n PAGE_SEGMENT_KEY,\n} from '../shared/lib/segment'\nimport { ROOT_SEGMENT_REQUEST_KEY } from '../shared/lib/segment-cache/segment-value-encoding'\nimport {\n NEXT_REWRITTEN_PATH_HEADER,\n NEXT_REWRITTEN_QUERY_HEADER,\n NEXT_RSC_UNION_QUERY,\n} from './components/app-router-headers'\nimport type {\n NormalizedPathname,\n NormalizedSearch,\n} from './components/segment-cache/cache-key'\nimport type { RSCResponse } from './components/router-reducer/fetch-server-response'\nimport type { ParsedUrlQuery } from 'querystring'\n\nexport type RouteParamValue = string | Array<string> | null\n\nexport function getRenderedSearch(\n response: RSCResponse<unknown> | Response\n): NormalizedSearch {\n // If the server performed a rewrite, the search params used to render the\n // page will be different from the params in the request URL. In this case,\n // the response will include a header that gives the rewritten search query.\n const rewrittenQuery = response.headers.get(NEXT_REWRITTEN_QUERY_HEADER)\n if (rewrittenQuery !== null) {\n return (\n rewrittenQuery === '' ? '' : '?' + rewrittenQuery\n ) as NormalizedSearch\n }\n // If the header is not present, there was no rewrite, so we use the search\n // query of the response URL.\n return urlToUrlWithoutFlightMarker(new URL(response.url))\n .search as NormalizedSearch\n}\n\nexport function getRenderedPathname(\n response: RSCResponse<unknown> | Response\n): NormalizedPathname {\n // If the server performed a rewrite, the pathname used to render the\n // page will be different from the pathname in the request URL. In this case,\n // the response will include a header that gives the rewritten pathname.\n const rewrittenPath = response.headers.get(NEXT_REWRITTEN_PATH_HEADER)\n return (rewrittenPath ??\n urlToUrlWithoutFlightMarker(new URL(response.url))\n .pathname) as NormalizedPathname\n}\n\nexport function parseDynamicParamFromURLPart(\n paramType: DynamicParamTypesShort,\n pathnameParts: Array<string>,\n partIndex: number\n): RouteParamValue {\n // This needs to match the behavior in get-dynamic-param.ts.\n switch (paramType) {\n // Catchalls\n case 'c': {\n // Catchalls receive all the remaining URL parts. If there are no\n // remaining pathname parts, return an empty array.\n return partIndex < pathnameParts.length\n ? pathnameParts.slice(partIndex).map((s) => encodeURIComponent(s))\n : []\n }\n // Catchall intercepted\n case 'ci(..)(..)':\n case 'ci(.)':\n case 'ci(..)':\n case 'ci(...)': {\n const prefix = paramType.length - 2\n return partIndex < pathnameParts.length\n ? pathnameParts.slice(partIndex).map((s, i) => {\n if (i === 0) {\n return encodeURIComponent(s.slice(prefix))\n }\n\n return encodeURIComponent(s)\n })\n : []\n }\n // Optional catchalls\n case 'oc': {\n // Optional catchalls receive all the remaining URL parts, unless this is\n // the end of the pathname, in which case they return null.\n return partIndex < pathnameParts.length\n ? pathnameParts.slice(partIndex).map((s) => encodeURIComponent(s))\n : null\n }\n // Dynamic\n case 'd': {\n if (partIndex >= pathnameParts.length) {\n // The route tree expected there to be more parts in the URL than there\n // actually are. This could happen if the x-nextjs-rewritten-path header\n // is incorrectly set, or potentially due to bug in Next.js. TODO:\n // Should this be a hard error? During a prefetch, we can just abort.\n // During a client navigation, we could trigger a hard refresh. But if\n // it happens during initial render, we don't really have any\n // recovery options.\n return ''\n }\n return encodeURIComponent(pathnameParts[partIndex])\n }\n // Dynamic intercepted\n case 'di(..)(..)':\n case 'di(.)':\n case 'di(..)':\n case 'di(...)': {\n const prefix = paramType.length - 2\n if (partIndex >= pathnameParts.length) {\n // The route tree expected there to be more parts in the URL than there\n // actually are. This could happen if the x-nextjs-rewritten-path header\n // is incorrectly set, or potentially due to bug in Next.js. TODO:\n // Should this be a hard error? During a prefetch, we can just abort.\n // During a client navigation, we could trigger a hard refresh. But if\n // it happens during initial render, we don't really have any\n // recovery options.\n return ''\n }\n\n return encodeURIComponent(pathnameParts[partIndex].slice(prefix))\n }\n default:\n paramType satisfies never\n return ''\n }\n}\n\nexport function doesStaticSegmentAppearInURL(segment: string): boolean {\n // This is not a parameterized segment; however, we need to determine\n // whether or not this segment appears in the URL. For example, this route\n // groups do not appear in the URL, so they should be skipped. Any other\n // special cases must be handled here.\n // TODO: Consider encoding this directly into the router tree instead of\n // inferring it on the client based on the segment type. Something like\n // a `doesAppearInURL` flag in FlightRouterState.\n if (\n segment === ROOT_SEGMENT_REQUEST_KEY ||\n // For some reason, the loader tree sometimes includes extra __PAGE__\n // \"layouts\" when part of a parallel route. But it's not a leaf node.\n // Otherwise, we wouldn't need this special case because pages are\n // always leaf nodes.\n // TODO: Investigate why the loader produces these fake page segments.\n segment.startsWith(PAGE_SEGMENT_KEY) ||\n // Route groups.\n (segment[0] === '(' && segment.endsWith(')')) ||\n segment === DEFAULT_SEGMENT_KEY ||\n segment === '/_not-found'\n ) {\n return false\n } else {\n // All other segment types appear in the URL\n return true\n }\n}\n\nexport function getCacheKeyForDynamicParam(\n paramValue: RouteParamValue,\n renderedSearch: NormalizedSearch\n): string {\n // This needs to match the logic in get-dynamic-param.ts, until we're able to\n // unify the various implementations so that these are always computed on\n // the client.\n if (typeof paramValue === 'string') {\n // TODO: Refactor or remove this helper function to accept a string rather\n // than the whole segment type. Also we can probably just append the\n // search string instead of turning it into JSON.\n const pageSegmentWithSearchParams = addSearchParamsIfPageSegment(\n paramValue,\n Object.fromEntries(new URLSearchParams(renderedSearch))\n ) as string\n return pageSegmentWithSearchParams\n } else if (paramValue === null) {\n return ''\n } else {\n return paramValue.join('/')\n }\n}\n\nexport function urlToUrlWithoutFlightMarker(url: URL): URL {\n const urlWithoutFlightParameters = new URL(url)\n urlWithoutFlightParameters.searchParams.delete(NEXT_RSC_UNION_QUERY)\n if (process.env.NODE_ENV === 'production') {\n if (\n process.env.__NEXT_CONFIG_OUTPUT === 'export' &&\n urlWithoutFlightParameters.pathname.endsWith('.txt')\n ) {\n const { pathname } = urlWithoutFlightParameters\n const length = pathname.endsWith('/index.txt') ? 10 : 4\n // Slice off `/index.txt` or `.txt` from the end of the pathname\n urlWithoutFlightParameters.pathname = pathname.slice(0, -length)\n }\n }\n return urlWithoutFlightParameters\n}\n\nexport function getParamValueFromCacheKey(\n paramCacheKey: string,\n paramType: DynamicParamTypesShort\n) {\n // Turn the cache key string sent by the server (as part of FlightRouterState)\n // into a value that can be passed to `useParams` and client components.\n const isCatchAll = paramType === 'c' || paramType === 'oc'\n if (isCatchAll) {\n // Catch-all param keys are a concatenation of the path segments.\n // See equivalent logic in `getSelectedParams`.\n // TODO: We should just pass the array directly, rather than concatenate\n // it to a string and then split it back to an array. It needs to be an\n // array in some places, like when passing a key React, but we can convert\n // it at runtime in those places.\n return paramCacheKey.split('/')\n }\n return paramCacheKey\n}\n\nexport function urlSearchParamsToParsedUrlQuery(\n searchParams: URLSearchParams\n): ParsedUrlQuery {\n // Converts a URLSearchParams object to the same type used by the server when\n // creating search params props, i.e. the type returned by Node's\n // \"querystring\" module.\n const result: ParsedUrlQuery = {}\n for (const [key, value] of searchParams.entries()) {\n if (result[key] === undefined) {\n result[key] = value\n } else if (Array.isArray(result[key])) {\n result[key].push(value)\n } else {\n result[key] = [result[key], value]\n }\n }\n return result\n}\n","export function createHrefFromUrl(\n url: Pick<URL, 'pathname' | 'search' | 'hash'>,\n includeHash: boolean = true\n): string {\n return url.pathname + url.search + (includeHash ? url.hash : '')\n}\n","import type {\n CacheNodeSeedData,\n FlightData,\n FlightDataPath,\n FlightRouterState,\n FlightSegmentPath,\n Segment,\n HeadData,\n InitialRSCPayload,\n} from '../shared/lib/app-router-types'\nimport { PAGE_SEGMENT_KEY } from '../shared/lib/segment'\nimport type { NormalizedSearch } from './components/segment-cache/cache-key'\nimport {\n getCacheKeyForDynamicParam,\n parseDynamicParamFromURLPart,\n doesStaticSegmentAppearInURL,\n getRenderedPathname,\n getRenderedSearch,\n} from './route-params'\nimport { createHrefFromUrl } from './components/router-reducer/create-href-from-url'\n\nexport type NormalizedFlightData = {\n /**\n * The full `FlightSegmentPath` inclusive of the final `Segment`\n */\n segmentPath: FlightSegmentPath\n /**\n * The `FlightSegmentPath` exclusive of the final `Segment`\n */\n pathToSegment: FlightSegmentPath\n segment: Segment\n tree: FlightRouterState\n seedData: CacheNodeSeedData | null\n head: HeadData\n isHeadPartial: boolean\n isRootRender: boolean\n}\n\n// TODO: We should only have to export `normalizeFlightData`, however because the initial flight data\n// that gets passed to `createInitialRouterState` doesn't conform to the `FlightDataPath` type (it's missing the root segment)\n// we're currently exporting it so we can use it directly. This should be fixed as part of the unification of\n// the different ways we express `FlightSegmentPath`.\nexport function getFlightDataPartsFromPath(\n flightDataPath: FlightDataPath\n): NormalizedFlightData {\n // Pick the last 4 items from the `FlightDataPath` to get the [tree, seedData, viewport, isHeadPartial].\n const flightDataPathLength = 4\n // tree, seedData, and head are *always* the last three items in the `FlightDataPath`.\n const [tree, seedData, head, isHeadPartial] =\n flightDataPath.slice(-flightDataPathLength)\n // The `FlightSegmentPath` is everything except the last three items. For a root render, it won't be present.\n const segmentPath = flightDataPath.slice(0, -flightDataPathLength)\n\n return {\n // TODO: Unify these two segment path helpers. We are inconsistently pushing an empty segment (\"\")\n // to the start of the segment path in some places which makes it hard to use solely the segment path.\n // Look for \"// TODO-APP: remove ''\" in the codebase.\n pathToSegment: segmentPath.slice(0, -1),\n segmentPath,\n // if the `FlightDataPath` corresponds with the root, there'll be no segment path,\n // in which case we default to ''.\n segment: segmentPath[segmentPath.length - 1] ?? '',\n tree,\n seedData,\n head,\n isHeadPartial,\n isRootRender: flightDataPath.length === flightDataPathLength,\n }\n}\n\nexport function createInitialRSCPayloadFromFallbackPrerender(\n response: Response,\n fallbackInitialRSCPayload: InitialRSCPayload\n): InitialRSCPayload {\n // This is a static fallback page. In order to hydrate the page, we need to\n // parse the client params from the URL, but to account for the possibility\n // that the page was rewritten, we need to check the response headers\n // for x-nextjs-rewritten-path or x-nextjs-rewritten-query headers. Since\n // we can't access the headers of the initial document response, the client\n // performs a fetch request to the current location. Since it's possible that\n // the fetch request will be dynamically rewritten to a different path than\n // the initial document, this fetch request delivers _all_ the hydration data\n // for the page; it was not inlined into the document, like it normally\n // would be.\n //\n // TODO: Consider treating the case where fetch is rewritten to a different\n // path from the document as a special deopt case. We should optimistically\n // assume this won't happen, inline the data into the document, and perform\n // a minimal request (like a HEAD or range request) to verify that the\n // response matches. Tricky to get right because we need to account for\n // all the different deployment environments we support, like output:\n // \"export\" mode, where we currently don't assume that custom response\n // headers are present.\n\n // Patch the Flight data sent by the server with the correct params parsed\n // from the URL + response object.\n const renderedPathname = getRenderedPathname(response)\n const renderedSearch = getRenderedSearch(response)\n const canonicalUrl = createHrefFromUrl(new URL(location.href))\n const originalFlightDataPath = fallbackInitialRSCPayload.f[0]\n const originalFlightRouterState = originalFlightDataPath[0]\n return {\n b: fallbackInitialRSCPayload.b,\n c: canonicalUrl.split('/'),\n q: renderedSearch,\n i: fallbackInitialRSCPayload.i,\n f: [\n [\n fillInFallbackFlightRouterState(\n originalFlightRouterState,\n renderedPathname,\n renderedSearch as NormalizedSearch\n ),\n originalFlightDataPath[1],\n originalFlightDataPath[2],\n originalFlightDataPath[2],\n ],\n ],\n m: fallbackInitialRSCPayload.m,\n G: fallbackInitialRSCPayload.G,\n S: fallbackInitialRSCPayload.S,\n }\n}\n\nfunction fillInFallbackFlightRouterState(\n flightRouterState: FlightRouterState,\n renderedPathname: string,\n renderedSearch: NormalizedSearch\n): FlightRouterState {\n const pathnameParts = renderedPathname.split('/').filter((p) => p !== '')\n const index = 0\n return fillInFallbackFlightRouterStateImpl(\n flightRouterState,\n renderedSearch,\n pathnameParts,\n index\n )\n}\n\nfunction fillInFallbackFlightRouterStateImpl(\n flightRouterState: FlightRouterState,\n renderedSearch: NormalizedSearch,\n pathnameParts: Array<string>,\n pathnamePartsIndex: number\n): FlightRouterState {\n const originalSegment = flightRouterState[0]\n let newSegment: Segment\n let doesAppearInURL: boolean\n if (typeof originalSegment === 'string') {\n newSegment = originalSegment\n doesAppearInURL = doesStaticSegmentAppearInURL(originalSegment)\n } else {\n const paramName = originalSegment[0]\n const paramType = originalSegment[2]\n const paramValue = parseDynamicParamFromURLPart(\n paramType,\n pathnameParts,\n pathnamePartsIndex\n )\n const cacheKey = getCacheKeyForDynamicParam(paramValue, renderedSearch)\n newSegment = [paramName, cacheKey, paramType]\n doesAppearInURL = true\n }\n\n // Only increment the index if the segment appears in the URL. If it's a\n // \"virtual\" segment, like a route group, it remains the same.\n const childPathnamePartsIndex = doesAppearInURL\n ? pathnamePartsIndex + 1\n : pathnamePartsIndex\n\n const children = flightRouterState[1]\n const newChildren: { [key: string]: FlightRouterState } = {}\n for (let key in children) {\n const childFlightRouterState = children[key]\n newChildren[key] = fillInFallbackFlightRouterStateImpl(\n childFlightRouterState,\n renderedSearch,\n pathnameParts,\n childPathnamePartsIndex\n )\n }\n\n const newState: FlightRouterState = [\n newSegment,\n newChildren,\n null,\n flightRouterState[3],\n flightRouterState[4],\n ]\n return newState\n}\n\nexport function getNextFlightSegmentPath(\n flightSegmentPath: FlightSegmentPath\n): FlightSegmentPath {\n // Since `FlightSegmentPath` is a repeated tuple of `Segment` and `ParallelRouteKey`, we slice off two items\n // to get the next segment path.\n return flightSegmentPath.slice(2)\n}\n\nexport function normalizeFlightData(\n flightData: FlightData\n): NormalizedFlightData[] | string {\n // FlightData can be a string when the server didn't respond with a proper flight response,\n // or when a redirect happens, to signal to the client that it needs to perform an MPA navigation.\n if (typeof flightData === 'string') {\n return flightData\n }\n\n return flightData.map((flightDataPath) =>\n getFlightDataPartsFromPath(flightDataPath)\n )\n}\n\n/**\n * This function is used to prepare the flight router state for the request.\n * It removes markers that are not needed by the server, and are purely used\n * for stashing state on the client.\n * @param flightRouterState - The flight router state to prepare.\n * @param isHmrRefresh - Whether this is an HMR refresh request.\n * @returns The prepared flight router state.\n */\nexport function prepareFlightRouterStateForRequest(\n flightRouterState: FlightRouterState,\n isHmrRefresh?: boolean\n): string {\n // HMR requests need the complete, unmodified state for proper functionality\n if (isHmrRefresh) {\n return encodeURIComponent(JSON.stringify(flightRouterState))\n }\n\n return encodeURIComponent(\n JSON.stringify(stripClientOnlyDataFromFlightRouterState(flightRouterState))\n )\n}\n\n/**\n * Recursively strips client-only data from FlightRouterState while preserving\n * server-needed information for proper rendering decisions.\n */\nfunction stripClientOnlyDataFromFlightRouterState(\n flightRouterState: FlightRouterState\n): FlightRouterState {\n const [\n segment,\n parallelRoutes,\n _url, // Intentionally unused - URLs are client-only\n refreshMarker,\n isRootLayout,\n hasLoadingBoundary,\n ] = flightRouterState\n\n // __PAGE__ segments are always fetched from the server, so there's\n // no need to send them up\n const cleanedSegment = stripSearchParamsFromPageSegment(segment)\n\n // Recursively process parallel routes\n const cleanedParallelRoutes: { [key: string]: FlightRouterState } = {}\n for (const [key, childState] of Object.entries(parallelRoutes)) {\n cleanedParallelRoutes[key] =\n stripClientOnlyDataFromFlightRouterState(childState)\n }\n\n const result: FlightRouterState = [\n cleanedSegment,\n cleanedParallelRoutes,\n null, // URLs omitted - server reconstructs paths from segments\n shouldPreserveRefreshMarker(refreshMarker) ? refreshMarker : null,\n ]\n\n // Append optional fields if present\n if (isRootLayout !== undefined) {\n result[4] = isRootLayout\n }\n if (hasLoadingBoundary !== undefined) {\n result[5] = hasLoadingBoundary\n }\n\n return result\n}\n\n/**\n * Strips search parameters from __PAGE__ segments to prevent sensitive\n * client-side data from being sent to the server.\n */\nfunction stripSearchParamsFromPageSegment(segment: Segment): Segment {\n if (\n typeof segment === 'string' &&\n segment.startsWith(PAGE_SEGMENT_KEY + '?')\n ) {\n return PAGE_SEGMENT_KEY\n }\n return segment\n}\n\n/**\n * Determines whether the refresh marker should be sent to the server\n * Client-only markers like 'refresh' are stripped, while server-needed markers\n * like 'refetch' and 'inside-shared-layout' are preserved.\n */\nfunction shouldPreserveRefreshMarker(\n refreshMarker: FlightRouterState[3]\n): boolean {\n return Boolean(refreshMarker && refreshMarker !== 'refresh')\n}\n","// This gets assigned as a side-effect during app initialization. Because it\n// represents the build used to create the JS bundle, it should never change\n// after being set, so we store it in a global variable.\n//\n// When performing RSC requests, if the incoming data has a different build ID,\n// we perform an MPA navigation/refresh to load the updated build and ensure\n// that the client and server in sync.\n\n// Starts as an empty string. In practice, because setAppBuildId is called\n// during initialization before hydration starts, this will always get\n// reassigned to the actual build ID before it's ever needed by a navigation.\n// If for some reasons it didn't, due to a bug or race condition, then on\n// navigation the build comparision would fail and trigger an MPA navigation.\nlet globalBuildId: string = ''\n\nexport function setAppBuildId(buildId: string) {\n globalBuildId = buildId\n}\n\nexport function getAppBuildId(): string {\n return globalBuildId\n}\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","'use client'\n\nimport { computeCacheBustingSearchParam } from '../../../shared/lib/router/utils/cache-busting-search-param'\nimport {\n NEXT_ROUTER_PREFETCH_HEADER,\n NEXT_ROUTER_SEGMENT_PREFETCH_HEADER,\n NEXT_ROUTER_STATE_TREE_HEADER,\n NEXT_URL,\n NEXT_RSC_UNION_QUERY,\n} from '../app-router-headers'\nimport type { RequestHeaders } from './fetch-server-response'\n\n/**\n * Mutates the provided URL by adding a cache-busting search parameter for CDNs that don't\n * support custom headers. This helps avoid caching conflicts by making each request unique.\n *\n * Rather than relying on the Vary header which some CDNs ignore, we append a search param\n * to create a unique URL that forces a fresh request.\n *\n * Example:\n * URL before: https://example.com/path?query=1\n * URL after: https://example.com/path?query=1&_rsc=abc123\n *\n * Note: This function mutates the input URL directly and does not return anything.\n *\n * TODO: Since we need to use a search param anyway, we could simplify by removing the custom\n * headers approach entirely and just use search params.\n */\nexport const setCacheBustingSearchParam = (\n url: URL,\n headers: RequestHeaders\n): void => {\n const uniqueCacheKey = computeCacheBustingSearchParam(\n headers[NEXT_ROUTER_PREFETCH_HEADER],\n headers[NEXT_ROUTER_SEGMENT_PREFETCH_HEADER],\n headers[NEXT_ROUTER_STATE_TREE_HEADER],\n headers[NEXT_URL]\n )\n setCacheBustingSearchParamWithHash(url, uniqueCacheKey)\n}\n\n/**\n * Sets a cache-busting search parameter on a URL using a provided hash value.\n *\n * This function performs the same logic as `setCacheBustingSearchParam` but accepts\n * a pre-computed hash instead of computing it from headers.\n *\n * Example:\n * URL before: https://example.com/path?query=1\n * hash: \"abc123\"\n * URL after: https://example.com/path?query=1&_rsc=abc123\n *\n * If the hash is null, we will set `_rsc` search param without a value.\n * Like this: https://example.com/path?query=1&_rsc\n *\n * Note: This function mutates the input URL directly and does not return anything.\n */\nexport const setCacheBustingSearchParamWithHash = (\n url: URL,\n hash: string\n): void => {\n /**\n * Note that we intentionally do not use `url.searchParams.set` here:\n *\n * const url = new URL('https://example.com/search?q=custom%20spacing');\n * url.searchParams.set('_rsc', 'abc123');\n * console.log(url.toString()); // Outputs: https://example.com/search?q=custom+spacing&_rsc=abc123\n * ^ <--- this is causing confusion\n * This is in fact intended based on https://url.spec.whatwg.org/#interface-urlsearchparams, but\n * we want to preserve the %20 as %20 if that's what the user passed in, hence the custom\n * logic below.\n */\n const existingSearch = url.search\n const rawQuery = existingSearch.startsWith('?')\n ? existingSearch.slice(1)\n : existingSearch\n\n // Always remove any existing cache busting param and add a fresh one to ensure\n // we have the correct value based on current request headers\n const pairs = rawQuery\n .split('&')\n .filter((pair) => pair && !pair.startsWith(`${NEXT_RSC_UNION_QUERY}=`))\n\n if (hash.length > 0) {\n pairs.push(`${NEXT_RSC_UNION_QUERY}=${hash}`)\n } else {\n pairs.push(`${NEXT_RSC_UNION_QUERY}`)\n }\n url.search = pairs.length ? `?${pairs.join('&')}` : ''\n}\n","'use client'\n\n// TODO: Explicitly import from client.browser\n// eslint-disable-next-line import/no-extraneous-dependencies\nimport {\n createFromReadableStream as createFromReadableStreamBrowser,\n createFromFetch as createFromFetchBrowser,\n} from 'react-server-dom-webpack/client'\n\nimport type {\n FlightRouterState,\n NavigationFlightResponse,\n} from '../../../shared/lib/app-router-types'\n\nimport type { NEXT_ROUTER_SEGMENT_PREFETCH_HEADER } from '../app-router-headers'\nimport {\n NEXT_ROUTER_PREFETCH_HEADER,\n NEXT_ROUTER_STATE_TREE_HEADER,\n NEXT_RSC_UNION_QUERY,\n NEXT_URL,\n RSC_HEADER,\n RSC_CONTENT_TYPE_HEADER,\n NEXT_HMR_REFRESH_HEADER,\n NEXT_DID_POSTPONE_HEADER,\n NEXT_ROUTER_STALE_TIME_HEADER,\n NEXT_HTML_REQUEST_ID_HEADER,\n NEXT_REQUEST_ID_HEADER,\n} from '../app-router-headers'\nimport { callServer } from '../../app-call-server'\nimport { findSourceMapURL } from '../../app-find-source-map-url'\nimport { PrefetchKind } from './router-reducer-types'\nimport {\n normalizeFlightData,\n prepareFlightRouterStateForRequest,\n type NormalizedFlightData,\n} from '../../flight-data-helpers'\nimport { getAppBuildId } from '../../app-build-id'\nimport { setCacheBustingSearchParam } from './set-cache-busting-search-param'\nimport {\n getRenderedSearch,\n urlToUrlWithoutFlightMarker,\n} from '../../route-params'\nimport type { NormalizedSearch } from '../segment-cache/cache-key'\n\nconst createFromReadableStream =\n createFromReadableStreamBrowser as (typeof import('react-server-dom-webpack/client.browser'))['createFromReadableStream']\nconst createFromFetch =\n createFromFetchBrowser as (typeof import('react-server-dom-webpack/client.browser'))['createFromFetch']\n\nlet createDebugChannel:\n | typeof import('../../dev/debug-channel').createDebugChannel\n | undefined\n\nif (\n process.env.NODE_ENV !== 'production' &&\n process.env.__NEXT_REACT_DEBUG_CHANNEL\n) {\n createDebugChannel = (\n require('../../dev/debug-channel') as typeof import('../../dev/debug-channel')\n ).createDebugChannel\n}\n\nexport interface FetchServerResponseOptions {\n readonly flightRouterState: FlightRouterState\n readonly nextUrl: string | null\n readonly prefetchKind?: PrefetchKind\n readonly isHmrRefresh?: boolean\n}\n\ntype SpaFetchServerResponseResult = {\n flightData: NormalizedFlightData[]\n canonicalUrl: URL\n renderedSearch: NormalizedSearch\n couldBeIntercepted: boolean\n prerendered: boolean\n postponed: boolean\n staleTime: number\n debugInfo: Array<any> | null\n}\n\ntype MpaFetchServerResponseResult = string\n\nexport type FetchServerResponseResult =\n | MpaFetchServerResponseResult\n | SpaFetchServerResponseResult\n\nexport type RequestHeaders = {\n [RSC_HEADER]?: '1'\n [NEXT_ROUTER_STATE_TREE_HEADER]?: string\n [NEXT_URL]?: string\n [NEXT_ROUTER_PREFETCH_HEADER]?: '1' | '2'\n [NEXT_ROUTER_SEGMENT_PREFETCH_HEADER]?: string\n 'x-deployment-id'?: string\n [NEXT_HMR_REFRESH_HEADER]?: '1'\n // A header that is only added in test mode to assert on fetch priority\n 'Next-Test-Fetch-Priority'?: RequestInit['priority']\n [NEXT_HTML_REQUEST_ID_HEADER]?: string // dev-only\n [NEXT_REQUEST_ID_HEADER]?: string // dev-only\n}\n\nfunction doMpaNavigation(url: string): FetchServerResponseResult {\n return urlToUrlWithoutFlightMarker(new URL(url, location.origin)).toString()\n}\n\nlet isPageUnloading = false\n\nif (typeof window !== 'undefined') {\n // Track when the page is unloading, e.g. due to reloading the page or\n // performing hard navigations. This allows us to suppress error logging when\n // the browser cancels in-flight requests during page unload.\n window.addEventListener('pagehide', () => {\n isPageUnloading = true\n })\n\n // Reset the flag on pageshow, e.g. when navigating back and the JavaScript\n // execution context is restored by the browser.\n window.addEventListener('pageshow', () => {\n isPageUnloading = false\n })\n}\n\n/**\n * Fetch the flight data for the provided url. Takes in the current router state\n * to decide what to render server-side.\n */\nexport async function fetchServerResponse(\n url: URL,\n options: FetchServerResponseOptions\n): Promise<FetchServerResponseResult> {\n const { flightRouterState, nextUrl, prefetchKind } = options\n\n const headers: RequestHeaders = {\n // Enable flight response\n [RSC_HEADER]: '1',\n // Provide the current router state\n [NEXT_ROUTER_STATE_TREE_HEADER]: prepareFlightRouterStateForRequest(\n flightRouterState,\n options.isHmrRefresh\n ),\n }\n\n /**\n * Three cases:\n * - `prefetchKind` is `undefined`, it means it's a normal navigation, so we want to prefetch the page data fully\n * - `prefetchKind` is `full` - we want to prefetch the whole page so same as above\n * - `prefetchKind` is `auto` - if the page is dynamic, prefetch the page data partially, if static prefetch the page data fully\n */\n if (prefetchKind === PrefetchKind.AUTO) {\n headers[NEXT_ROUTER_PREFETCH_HEADER] = '1'\n }\n\n if (process.env.NODE_ENV === 'development' && options.isHmrRefresh) {\n headers[NEXT_HMR_REFRESH_HEADER] = '1'\n }\n\n if (nextUrl) {\n headers[NEXT_URL] = nextUrl\n }\n\n // In static export mode, we need to modify the URL to request the .txt file,\n // but we should preserve the original URL for the canonical URL and error handling.\n const originalUrl = url\n\n try {\n // When creating a \"temporary\" prefetch (the \"on-demand\" prefetch that gets created on navigation, if one doesn't exist)\n // we send the request with a \"high\" priority as it's in response to a user interaction that could be blocking a transition.\n // Otherwise, all other prefetches are sent with a \"low\" priority.\n // We use \"auto\" for in all other cases to match the existing default, as this function is shared outside of prefetching.\n const fetchPriority = prefetchKind\n ? prefetchKind === PrefetchKind.TEMPORARY\n ? 'high'\n : 'low'\n : 'auto'\n\n if (process.env.NODE_ENV === 'production') {\n if (process.env.__NEXT_CONFIG_OUTPUT === 'export') {\n // In \"output: export\" mode, we can't rely on headers to distinguish\n // between HTML and RSC requests. Instead, we append an extra prefix\n // to the request.\n url = new URL(url)\n if (url.pathname.endsWith('/')) {\n url.pathname += 'index.txt'\n } else {\n url.pathname += '.txt'\n }\n }\n }\n\n // Typically, during a navigation, we decode the response using Flight's\n // `createFromFetch` API, which accepts a `fetch` promise.\n // TODO: Remove this check once the old PPR flag is removed\n const isLegacyPPR =\n process.env.__NEXT_PPR && !process.env.__NEXT_CACHE_COMPONENTS\n const shouldImmediatelyDecode = !isLegacyPPR\n const res = await createFetch<NavigationFlightResponse>(\n url,\n headers,\n fetchPriority,\n shouldImmediatelyDecode\n )\n\n const responseUrl = urlToUrlWithoutFlightMarker(new URL(res.url))\n const canonicalUrl = res.redirected ? responseUrl : originalUrl\n\n const contentType = res.headers.get('content-type') || ''\n const interception = !!res.headers.get('vary')?.includes(NEXT_URL)\n const postponed = !!res.headers.get(NEXT_DID_POSTPONE_HEADER)\n const staleTimeHeaderSeconds = res.headers.get(\n NEXT_ROUTER_STALE_TIME_HEADER\n )\n const staleTime =\n staleTimeHeaderSeconds !== null\n ? parseInt(staleTimeHeaderSeconds, 10) * 1000\n : -1\n let isFlightResponse = contentType.startsWith(RSC_CONTENT_TYPE_HEADER)\n\n if (process.env.NODE_ENV === 'production') {\n if (process.env.__NEXT_CONFIG_OUTPUT === 'export') {\n if (!isFlightResponse) {\n isFlightResponse = contentType.startsWith('text/plain')\n }\n }\n }\n\n // If fetch returns something different than flight response handle it like a mpa navigation\n // If the fetch was not 200, we also handle it like a mpa navigation\n if (!isFlightResponse || !res.ok || !res.body) {\n // in case the original URL came with a hash, preserve it before redirecting to the new URL\n if (url.hash) {\n responseUrl.hash = url.hash\n }\n\n return doMpaNavigation(responseUrl.toString())\n }\n\n // We may navigate to a page that requires a different Webpack runtime.\n // In prod, every page will have the same Webpack runtime.\n // In dev, the Webpack runtime is minimal for each page.\n // We need to ensure the Webpack runtime is updated before executing client-side JS of the new page.\n // TODO: This needs to happen in the Flight Client.\n // Or Webpack needs to include the runtime update in the Flight response as\n // a blocking script.\n if (process.env.NODE_ENV !== 'production' && !process.env.TURBOPACK) {\n await (\n require('../../dev/hot-reloader/app/hot-reloader-app') as typeof import('../../dev/hot-reloader/app/hot-reloader-app')\n ).waitForWebpackRuntimeHotUpdate()\n }\n\n let flightResponsePromise = res.flightResponse\n if (flightResponsePromise === null) {\n // Typically, `createFetch` would have already started decoding the\n // Flight response. If it hasn't, though, we need to decode it now.\n // TODO: This should only be reachable if legacy PPR is enabled (i.e. PPR\n // without Cache Components). Remove this branch once legacy PPR\n // is deleted.\n const flightStream = postponed\n ? createUnclosingPrefetchStream(res.body)\n : res.body\n flightResponsePromise =\n createFromNextReadableStream<NavigationFlightResponse>(\n flightStream,\n headers\n )\n }\n\n const flightResponse = await flightResponsePromise\n\n if (getAppBuildId() !== flightResponse.b) {\n return doMpaNavigation(res.url)\n }\n\n const normalizedFlightData = normalizeFlightData(flightResponse.f)\n if (typeof normalizedFlightData === 'string') {\n return doMpaNavigation(normalizedFlightData)\n }\n\n return {\n flightData: normalizedFlightData,\n canonicalUrl: canonicalUrl,\n renderedSearch: getRenderedSearch(res),\n couldBeIntercepted: interception,\n prerendered: flightResponse.S,\n postponed,\n staleTime,\n debugInfo: flightResponsePromise._debugInfo ?? null,\n }\n } catch (err) {\n if (!isPageUnloading) {\n console.error(\n `Failed to fetch RSC payload for ${originalUrl}. Falling back to browser navigation.`,\n err\n )\n }\n\n // If fetch fails handle it like a mpa navigation\n // TODO-APP: Add a test for the case where a CORS request fails, e.g. external url redirect coming from the response.\n // See https://github.com/vercel/next.js/issues/43605#issuecomment-1451617521 for a reproduction.\n return originalUrl.toString()\n }\n}\n\n// This is a subset of the standard Response type. We use a custom type for\n// this so we can limit which details about the response leak into the rest of\n// the codebase. For example, there's some custom logic for manually following\n// redirects, so \"redirected\" in this type could be a composite of multiple\n// browser fetch calls; however, this fact should not leak to the caller.\nexport type RSCResponse<T> = {\n ok: boolean\n redirected: boolean\n headers: Headers\n body: ReadableStream<Uint8Array> | null\n status: number\n url: string\n flightResponse: (Promise<T> & { _debugInfo?: Array<any> }) | null\n}\n\nexport async function createFetch<T>(\n url: URL,\n headers: RequestHeaders,\n fetchPriority: 'auto' | 'high' | 'low' | null,\n shouldImmediatelyDecode: boolean,\n signal?: AbortSignal\n): Promise<RSCResponse<T>> {\n // TODO: In output: \"export\" mode, the headers do nothing. Omit them (and the\n // cache busting search param) from the request so they're\n // maximally cacheable.\n\n if (process.env.__NEXT_TEST_MODE && fetchPriority !== null) {\n headers['Next-Test-Fetch-Priority'] = fetchPriority\n }\n\n if (process.env.NEXT_DEPLOYMENT_ID) {\n headers['x-deployment-id'] = process.env.NEXT_DEPLOYMENT_ID\n }\n\n if (process.env.NODE_ENV !== 'production') {\n if (self.__next_r) {\n headers[NEXT_HTML_REQUEST_ID_HEADER] = self.__next_r\n }\n\n // Create a new request ID for the server action request. The server uses\n // this to tag debug information sent via WebSocket to the client, which\n // then routes those chunks to the debug channel associated with this ID.\n headers[NEXT_REQUEST_ID_HEADER] = crypto\n .getRandomValues(new Uint32Array(1))[0]\n .toString(16)\n }\n\n const fetchOptions: RequestInit = {\n // Backwards compat for older browsers. `same-origin` is the default in modern browsers.\n credentials: 'same-origin',\n headers,\n priority: fetchPriority || undefined,\n signal,\n }\n // `fetchUrl` is slightly different from `url` because we add a cache-busting\n // search param to it. This should not leak outside of this function, so we\n // track them separately.\n let fetchUrl = new URL(url)\n setCacheBustingSearchParam(fetchUrl, headers)\n let fetchPromise = fetch(fetchUrl, fetchOptions)\n // Immediately pass the fetch promise to the Flight client so that the debug\n // info includes the latency from the client to the server. The internal timer\n // in React starts as soon as `createFromFetch` is called.\n //\n // The only case where we don't do this is during a prefetch, because we have\n // to do some extra processing of the response stream (see\n // `createUnclosingPrefetchStream`). But this is fine, because a top-level\n // prefetch response never blocks a navigation; if it hasn't already been\n // written into the cache by the time the navigation happens, the router will\n // go straight to a dynamic request.\n let flightResponsePromise = shouldImmediatelyDecode\n ? createFromNextFetch<T>(fetchPromise, headers)\n : null\n let browserResponse = await fetchPromise\n\n // If the server responds with a redirect (e.g. 307), and the redirected\n // location does not contain the cache busting search param set in the\n // original request, the response is likely invalid — when following the\n // redirect, the browser forwards the request headers, but since the cache\n // busting search param is missing, the server will reject the request due to\n // a mismatch.\n //\n // Ideally, we would be able to intercept the redirect response and perform it\n // manually, instead of letting the browser automatically follow it, but this\n // is not allowed by the fetch API.\n //\n // So instead, we must \"replay\" the redirect by fetching the new location\n // again, but this time we'll append the cache busting search param to prevent\n // a mismatch.\n //\n // TODO: We can optimize Next.js's built-in middleware APIs by returning a\n // custom status code, to prevent the browser from automatically following it.\n //\n // This does not affect Server Action-based redirects; those are encoded\n // differently, as part of the Flight body. It only affects redirects that\n // occur in a middleware or a third-party proxy.\n\n let redirected = browserResponse.redirected\n if (process.env.__NEXT_CLIENT_VALIDATE_RSC_REQUEST_HEADERS) {\n // This is to prevent a redirect loop. Same limit used by Chrome.\n const MAX_REDIRECTS = 20\n for (let n = 0; n < MAX_REDIRECTS; n++) {\n if (!browserResponse.redirected) {\n // The server did not perform a redirect.\n break\n }\n const responseUrl = new URL(browserResponse.url, fetchUrl)\n if (responseUrl.origin !== fetchUrl.origin) {\n // The server redirected to an external URL. The rest of the logic below\n // is not relevant, because it only applies to internal redirects.\n break\n }\n if (\n responseUrl.searchParams.get(NEXT_RSC_UNION_QUERY) ===\n fetchUrl.searchParams.get(NEXT_RSC_UNION_QUERY)\n ) {\n // The redirected URL already includes the cache busting search param.\n // This was probably intentional. Regardless, there's no reason to\n // issue another request to this URL because it already has the param\n // value that we would have added below.\n break\n }\n // The RSC request was redirected. Assume the response is invalid.\n //\n // Append the cache busting search param to the redirected URL and\n // fetch again.\n // TODO: We should abort the previous request.\n fetchUrl = new URL(responseUrl)\n setCacheBustingSearchParam(fetchUrl, headers)\n fetchPromise = fetch(fetchUrl, fetchOptions)\n flightResponsePromise = shouldImmediatelyDecode\n ? createFromNextFetch<T>(fetchPromise, headers)\n : null\n browserResponse = await fetchPromise\n // We just performed a manual redirect, so this is now true.\n redirected = true\n }\n }\n\n // Remove the cache busting search param from the response URL, to prevent it\n // from leaking outside of this function.\n const responseUrl = new URL(browserResponse.url, fetchUrl)\n responseUrl.searchParams.delete(NEXT_RSC_UNION_QUERY)\n\n const rscResponse: RSCResponse<T> = {\n url: responseUrl.href,\n\n // This is true if any redirects occurred, either automatically by the\n // browser, or manually by us. So it's different from\n // `browserResponse.redirected`, which only tells us whether the browser\n // followed a redirect, and only for the last response in the chain.\n redirected,\n\n // These can be copied from the last browser response we received. We\n // intentionally only expose the subset of fields that are actually used\n // elsewhere in the codebase.\n ok: browserResponse.ok,\n headers: browserResponse.headers,\n body: browserResponse.body,\n status: browserResponse.status,\n\n // This is the exact promise returned by `createFromFetch`. It contains\n // debug information that we need to transfer to any derived promises that\n // are later rendered by React.\n flightResponse: flightResponsePromise,\n }\n\n return rscResponse\n}\n\nexport function createFromNextReadableStream<T>(\n flightStream: ReadableStream<Uint8Array>,\n requestHeaders: RequestHeaders\n): Promise<T> {\n return createFromReadableStream(flightStream, {\n callServer,\n findSourceMapURL,\n debugChannel: createDebugChannel && createDebugChannel(requestHeaders),\n })\n}\n\nfunction createFromNextFetch<T>(\n promiseForResponse: Promise<Response>,\n requestHeaders: RequestHeaders\n): Promise<T> & { _debugInfo?: Array<any> } {\n return createFromFetch(promiseForResponse, {\n callServer,\n findSourceMapURL,\n debugChannel: createDebugChannel && createDebugChannel(requestHeaders),\n })\n}\n\nfunction createUnclosingPrefetchStream(\n originalFlightStream: ReadableStream<Uint8Array>\n): ReadableStream<Uint8Array> {\n // When PPR is enabled, prefetch streams may contain references that never\n // resolve, because that's how we encode dynamic data access. In the decoded\n // object returned by the Flight client, these are reified into hanging\n // promises that suspend during render, which is effectively what we want.\n // The UI resolves when it switches to the dynamic data stream\n // (via useDeferredValue(dynamic, static)).\n //\n // However, the Flight implementation currently errors if the server closes\n // the response before all the references are resolved. As a cheat to work\n // around this, we wrap the original stream in a new stream that never closes,\n // and therefore doesn't error.\n const reader = originalFlightStream.getReader()\n return new ReadableStream({\n async pull(controller) {\n while (true) {\n const { done, value } = await reader.read()\n if (!done) {\n // Pass to the target stream and keep consuming the Flight response\n // from the server.\n controller.enqueue(value)\n continue\n }\n // The server stream has closed. Exit, but intentionally do not close\n // the target stream.\n return\n }\n },\n })\n}\n","import type { MapEntry } from './cache-map'\nimport { deleteFromCacheMap } from './cache-map'\n\n// We use an LRU for memory management. We must update this whenever we add or\n// remove a new cache entry, or when an entry changes size.\n\n// The MapEntry type is used as an LRU node, too. We choose this one instead of\n// the inner cache entry type (RouteCacheEntry, SegmentCacheEntry) because it's\n// monomorphic and can be optimized by the VM.\ntype LRUNode = MapEntry<any>\n\nlet head: LRUNode | null = null\nlet didScheduleCleanup: boolean = false\nlet lruSize: number = 0\n\n// TODO: I chose the max size somewhat arbitrarily. Consider setting this based\n// on navigator.deviceMemory, or some other heuristic. We should make this\n// customizable via the Next.js config, too.\nconst maxLruSize = 50 * 1024 * 1024 // 50 MB\n\nexport function lruPut(node: LRUNode) {\n if (head === node) {\n // Already at the head\n return\n }\n const prev = node.prev\n const next = node.next\n if (next === null || prev === null) {\n // This is an insertion\n lruSize += node.size\n // Whenever we add an entry, we need to check if we've exceeded the\n // max size. We don't evict entries immediately; they're evicted later in\n // an asynchronous task.\n ensureCleanupIsScheduled()\n } else {\n // This is a move. Remove from its current position.\n prev.next = next\n next.prev = prev\n }\n\n // Move to the front of the list\n if (head === null) {\n // This is the first entry\n node.prev = node\n node.next = node\n } else {\n // Add to the front of the list\n const tail = head.prev\n node.prev = tail\n // In practice, this is never null, but that isn't encoded in the type\n if (tail !== null) {\n tail.next = node\n }\n node.next = head\n head.prev = node\n }\n head = node\n}\n\nexport function updateLruSize(node: LRUNode, newNodeSize: number) {\n // This is a separate function from `put` so that we can resize the entry\n // regardless of whether it's currently being tracked by the LRU.\n const prevNodeSize = node.size\n node.size = newNodeSize\n if (node.next === null) {\n // This entry is not currently being tracked by the LRU.\n return\n }\n // Update the total LRU size\n lruSize = lruSize - prevNodeSize + newNodeSize\n ensureCleanupIsScheduled()\n}\n\nexport function deleteFromLru(deleted: LRUNode) {\n const next = deleted.next\n const prev = deleted.prev\n if (next !== null && prev !== null) {\n lruSize -= deleted.size\n\n deleted.next = null\n deleted.prev = null\n\n // Remove from the list\n if (head === deleted) {\n // Update the head\n if (next === head) {\n // This was the last entry\n head = null\n } else {\n head = next\n }\n } else {\n prev.next = next\n next.prev = prev\n }\n } else {\n // Already deleted\n }\n}\n\nfunction ensureCleanupIsScheduled() {\n if (didScheduleCleanup || lruSize <= maxLruSize) {\n return\n }\n didScheduleCleanup = true\n requestCleanupCallback(cleanup)\n}\n\nfunction cleanup() {\n didScheduleCleanup = false\n\n // Evict entries until we're at 90% capacity. We can assume this won't\n // infinite loop because even if `maxLruSize` were 0, eventually\n // `deleteFromLru` sets `head` to `null` when we run out entries.\n const ninetyPercentMax = maxLruSize * 0.9\n while (lruSize > ninetyPercentMax && head !== null) {\n const tail = head.prev\n // In practice, this is never null, but that isn't encoded in the type\n if (tail !== null) {\n // Delete the entry from the map. In turn, this will remove it from\n // the LRU.\n deleteFromCacheMap(tail.value)\n }\n }\n}\n\nconst requestCleanupCallback =\n typeof requestIdleCallback === 'function'\n ? requestIdleCallback\n : (cb: () => void) => setTimeout(cb, 0)\n","import type { VaryPath } from './vary-path'\nimport { lruPut, updateLruSize, deleteFromLru } from './lru'\n\n/**\n * A specialized data type for storing multi-key cache entries.\n *\n * The basic structure is a map whose keys are tuples, called the keypath.\n * When querying the cache, keypaths are compared per-element.\n *\n * Example:\n * set(map, ['https://localhost', 'foo/bar/baz'], 'yay');\n * get(map, ['https://localhost', 'foo/bar/baz']) -> 'yay'\n *\n * NOTE: Array syntax is used in these examples for illustration purposes, but\n * in reality the paths are lists.\n * \n * The parts of the keypath represent the different inputs that contribute\n * to the entry value. To illustrate, if you were to use this data type to store\n * HTTP responses, the keypath would include the URL and everything listed by\n * the Vary header.\n * \n * See vary-path.ts for more details.\n *\n * The order of elements in a keypath must be consistent between lookups to\n * be considered the same, but besides that, the order of the keys is not\n * semantically meaningful.\n *\n * Keypaths may include a special kind of key called Fallback. When an entry is\n * stored with Fallback as part of its keypath, it means that the entry does not\n * vary by that key. When querying the cache, if an exact match is not found for\n * a keypath, the cache will check for a Fallback match instead. Each element of\n * the keypath may have a Fallback, so retrieval is an O(n ^ 2) operation, but\n * it's expected that keypaths are relatively short.\n *\n * Example:\n * set(cacheMap, ['store', 'product', 1], PRODUCT_PAGE_1);\n * set(cacheMap, ['store', 'product', Fallback], GENERIC_PRODUCT_PAGE);\n *\n * // Exact match\n * get(cacheMap, ['store', 'product', 1]) -> PRODUCT_PAGE_1\n *\n * // Fallback match\n * get(cacheMap, ['store', 'product', 2]) -> GENERIC_PRODUCT_PAGE\n *\n * Because we have the Fallback mechanism, we can impose a constraint that\n * regular JS maps do not have: a value cannot be stored at multiple keypaths\n * simultaneously. These cases should be expressed with Fallback keys instead.\n *\n * Additionally, because values only exist at a single keypath at a time, we\n * can optimize successive lookups by caching the internal map entry on the\n * value itself, using the `ref` field. This is especially useful because it\n * lets us skip the O(n ^ 2) lookup that occurs when Fallback entries\n * are present.\n *\n\n * How to decide if stuff belongs in here, or in cache.ts?\n * -------------------------------------------------------\n * \n * Anything to do with retrival, lifetimes, or eviction needs to go in this\n * module because it affects the fallback algorithm. For example, when\n * performing a lookup, if an entry is stale, it needs to be treated as\n * semantically equivalent to if the entry was not present at all.\n * \n * If there's logic that's not related to the fallback algorithm, though, we\n * should prefer to put it in cache.ts.\n */\n\ntype MapEntryShared<V extends MapValue> = {\n parent: MapEntry<V> | null\n key: any\n map: Map<any, MapEntry<V>> | null\n\n // LRU-related fields\n prev: MapEntry<any> | null\n next: MapEntry<any> | null\n size: number\n}\n\ntype EmptyMapEntry<V extends MapValue> = MapEntryShared<V> & {\n value: null\n}\n\ntype FullMapEntry<V extends MapValue> = MapEntryShared<V> & {\n value: V\n}\n\nexport type MapEntry<V extends MapValue> = EmptyMapEntry<V> | FullMapEntry<V>\n\n// The CacheMap type is just the root entry of the map.\nexport type CacheMap<V extends MapValue> = MapEntry<V>\n\n// The protocol that values must implement. In practice, the only two types that\n// we ever actually deal with in this module are RouteCacheEntry and\n// SegmentCacheEntry; this is just to keep track of the coupling so we don't\n// leak concerns between the modules unnecessarily.\nexport interface MapValue {\n ref: MapEntry<any> | null\n size: number\n staleAt: number\n version: number\n}\n\nexport type FallbackType = { __brand: 'Fallback' }\nexport const Fallback = {} as FallbackType\n\n// This is a special internal key that is used for \"revalidation\" entries. It's\n// an implementation detail that shouldn't leak outside of this module.\nconst Revalidation = {}\n\nexport function createCacheMap<V extends MapValue>(): CacheMap<V> {\n const cacheMap: MapEntry<V> = {\n parent: null,\n key: null,\n value: null,\n map: null,\n\n // LRU-related fields\n prev: null,\n next: null,\n size: 0,\n }\n return cacheMap\n}\n\nfunction getOrInitialize<V extends MapValue>(\n cacheMap: CacheMap<V>,\n keys: VaryPath,\n isRevalidation: boolean\n): MapEntry<V> {\n // Go through each level of keys until we find the entry that matches, or\n // create a new entry if one doesn't exist.\n //\n // This function will only return entries that match the keypath _exactly_.\n // Unlike getWithFallback, it will not access fallback entries unless it's\n // explicitly part of the keypath.\n let entry = cacheMap\n let remainingKeys: VaryPath | null = keys\n let key: unknown | null = null\n while (true) {\n const previousKey = key\n if (remainingKeys !== null) {\n key = remainingKeys.value\n remainingKeys = remainingKeys.parent\n } else if (isRevalidation && previousKey !== Revalidation) {\n // During a revalidation, we append an internal \"Revalidation\" key to\n // the end of the keypath. The \"normal\" entry is its parent.\n\n // However, if the parent entry is currently empty, we don't need to store\n // this as a revalidation entry. Just insert the revalidation into the\n // normal slot.\n if (entry.value === null) {\n return entry\n }\n\n // Otheriwse, create a child entry.\n key = Revalidation\n } else {\n // There are no more keys. This is the terminal entry.\n break\n }\n\n let map = entry.map\n if (map !== null) {\n const existingEntry = map.get(key)\n if (existingEntry !== undefined) {\n // Found a match. Keep going.\n entry = existingEntry\n continue\n }\n } else {\n map = new Map()\n entry.map = map\n }\n // No entry exists yet at this level. Create a new one.\n const newEntry: EmptyMapEntry<V> = {\n parent: entry,\n key,\n value: null,\n map: null,\n\n // LRU-related fields\n prev: null,\n next: null,\n size: 0,\n }\n map.set(key, newEntry)\n entry = newEntry\n }\n\n return entry\n}\n\nexport function getFromCacheMap<V extends MapValue>(\n now: number,\n currentCacheVersion: number,\n rootEntry: CacheMap<V>,\n keys: VaryPath,\n isRevalidation: boolean\n): V | null {\n const entry = getEntryWithFallbackImpl(\n now,\n currentCacheVersion,\n rootEntry,\n keys,\n isRevalidation,\n 0\n )\n if (entry === null || entry.value === null) {\n return null\n }\n // This is an LRU access. Move the entry to the front of the list.\n lruPut(entry)\n return entry.value\n}\n\nexport function isValueExpired<V extends MapValue>(\n now: number,\n currentCacheVersion: number,\n value: V\n): boolean {\n return value.staleAt <= now || value.version < currentCacheVersion\n}\n\nfunction lazilyEvictIfNeeded<V extends MapValue>(\n now: number,\n currentCacheVersion: number,\n entry: MapEntry<V>\n) {\n // We have a matching entry, but before we can return it, we need to check if\n // it's still fresh. Otherwise it should be treated the same as a cache miss.\n\n if (entry.value === null) {\n // This entry has no value, so there's nothing to evict.\n return entry\n }\n\n const value = entry.value\n if (isValueExpired(now, currentCacheVersion, value)) {\n // The value expired. Lazily evict it from the cache, and return null. This\n // is conceptually the same as a cache miss.\n deleteMapEntry(entry)\n return null\n }\n\n // The matched entry has not expired. Return it.\n return entry\n}\n\nfunction getEntryWithFallbackImpl<V extends MapValue>(\n now: number,\n currentCacheVersion: number,\n entry: MapEntry<V>,\n keys: VaryPath | null,\n isRevalidation: boolean,\n previousKey: unknown | null\n): MapEntry<V> | null {\n // This is similar to getExactEntry, but if an exact match is not found for\n // a key, it will return the fallback entry instead. This is recursive at\n // every level, e.g. an entry with keypath [a, Fallback, c, Fallback] is\n // valid match for [a, b, c, d].\n //\n // It will return the most specific match available.\n let key\n let remainingKeys: VaryPath | null\n if (keys !== null) {\n key = keys.value\n remainingKeys = keys.parent\n } else if (isRevalidation && previousKey !== Revalidation) {\n // During a revalidation, we append an internal \"Revalidation\" key to\n // the end of the keypath.\n key = Revalidation\n remainingKeys = null\n } else {\n // There are no more keys. This is the terminal entry.\n\n // TODO: When performing a lookup during a navigation, as opposed to a\n // prefetch, we may want to skip entries that are Pending if there's also\n // a Fulfilled fallback entry. Tricky to say, though, since if it's\n // already pending, it's likely to stream in soon. Maybe we could do this\n // just on slow connections and offline mode.\n\n return lazilyEvictIfNeeded(now, currentCacheVersion, entry)\n }\n const map = entry.map\n if (map !== null) {\n const existingEntry = map.get(key)\n if (existingEntry !== undefined) {\n // Found an exact match for this key. Keep searching.\n const result = getEntryWithFallbackImpl<V>(\n now,\n currentCacheVersion,\n existingEntry,\n remainingKeys,\n isRevalidation,\n key\n )\n if (result !== null) {\n return result\n }\n }\n // No match found for this key. Check if there's a fallback.\n const fallbackEntry = map.get(Fallback)\n if (fallbackEntry !== undefined) {\n // Found a fallback for this key. Keep searching.\n return getEntryWithFallbackImpl(\n now,\n currentCacheVersion,\n fallbackEntry,\n remainingKeys,\n isRevalidation,\n key\n )\n }\n }\n return null\n}\n\nexport function setInCacheMap<V extends MapValue>(\n cacheMap: CacheMap<V>,\n keys: VaryPath,\n value: V,\n isRevalidation: boolean\n): void {\n // Add a value to the map at the given keypath. If the value is already\n // part of the map, it's removed from its previous keypath. (NOTE: This is\n // unlike a regular JS map, but the behavior is intentional.)\n const entry = getOrInitialize(cacheMap, keys, isRevalidation)\n setMapEntryValue(entry, value)\n\n // This is an LRU access. Move the entry to the front of the list.\n lruPut(entry)\n updateLruSize(entry, value.size)\n}\n\nfunction setMapEntryValue<V extends MapValue>(\n entry: MapEntry<V>,\n value: V\n): void {\n if (entry.value !== null) {\n // There's already a value at the given keypath. Disconnect the old value\n // from the map. We're not calling `deleteMapEntry` here because the\n // entry itself is still in the map. We just want to overwrite its value.\n dropRef(entry.value)\n\n // Fill the entry with the updated value.\n const emptyEntry: EmptyMapEntry<V> = entry as any\n emptyEntry.value = null\n fillEmptyReference(emptyEntry, value)\n } else {\n fillEmptyReference(entry as any, value)\n }\n}\n\nfunction fillEmptyReference<V extends MapValue>(\n entry: EmptyMapEntry<V>,\n value: V\n): void {\n // This value may already be in the map at a different keypath.\n // Grab a reference before we overwrite it.\n const oldEntry = value.ref\n\n const fullEntry: FullMapEntry<V> = entry as any\n fullEntry.value = value\n value.ref = fullEntry\n\n updateLruSize(fullEntry, value.size)\n\n if (oldEntry !== null && oldEntry !== entry && oldEntry.value === value) {\n // This value is already in the map at a different keypath in the map.\n // Values only exist at a single keypath at a time. Remove it from the\n // previous keypath.\n //\n // Note that only the internal map entry is garbage collected; we don't\n // call `dropRef` here because it's still in the map, just\n // at a new keypath (the one we just set, above).\n deleteMapEntry(oldEntry)\n }\n}\n\nexport function deleteFromCacheMap<V extends MapValue>(value: V): void {\n const entry = value.ref\n if (entry === null) {\n // This value is not a member of any map.\n return\n }\n\n dropRef(value)\n deleteMapEntry(entry)\n}\n\nfunction dropRef<V extends MapValue>(value: V): void {\n // Drop the value from the map by setting its `ref` backpointer to\n // null. This is a separate operation from `deleteMapEntry` because when\n // re-keying a value we need to be able to delete the old, internal map\n // entry without garbage collecting the value itself.\n value.ref = null\n}\n\nfunction deleteMapEntry<V extends MapValue>(entry: MapEntry<V>): void {\n // Delete the entry from the cache.\n const emptyEntry: EmptyMapEntry<V> = entry as any\n emptyEntry.value = null\n\n deleteFromLru(entry)\n\n // Check if we can garbage collect the entry.\n const map = emptyEntry.map\n if (map === null) {\n // Since this entry has no value, and also no child entries, we can\n // garbage collect it. Remove it from its parent, and keep garbage\n // collecting the parents until we reach a non-empty entry.\n let parent = emptyEntry.parent\n let key = emptyEntry.key\n while (parent !== null) {\n const parentMap = parent.map\n if (parentMap !== null) {\n parentMap.delete(key)\n if (parentMap.size === 0) {\n // We just removed the last entry in the parent map.\n parent.map = null\n if (parent.value === null) {\n // The parent node has no child entries, nor does it have a value\n // on itself. It can be garbage collected. Keep going.\n key = parent.key\n parent = parent.parent\n continue\n }\n }\n }\n // The parent is not empty. Stop garbage collecting.\n break\n }\n } else {\n // Check if there's a revalidating entry. If so, promote it to a\n // \"normal\" entry, since the normal one was just deleted.\n const revalidatingEntry = map.get(Revalidation)\n if (revalidatingEntry !== undefined && revalidatingEntry.value !== null) {\n setMapEntryValue(emptyEntry, revalidatingEntry.value)\n }\n }\n}\n\nexport function setSizeInCacheMap<V extends MapValue>(\n value: V,\n size: number\n): void {\n const entry = value.ref\n if (entry === null) {\n // This value is not a member of any map.\n return\n }\n // Except during initialization (when the size is set to 0), this is the only\n // place the `size` field should be updated, to ensure it's in sync with the\n // the LRU.\n value.size = size\n updateLruSize(entry, size)\n}\n","import { FetchStrategy } from './types'\nimport type {\n NormalizedPathname,\n NormalizedSearch,\n NormalizedNextUrl,\n} from './cache-key'\nimport type { RouteTree } from './cache'\nimport { Fallback, type FallbackType } from './cache-map'\nimport { HEAD_REQUEST_KEY } from '../../../shared/lib/segment-cache/segment-value-encoding'\n\ntype Opaque<T, K> = T & { __brand: K }\n\n/**\n * A linked-list of all the params (or other param-like) inputs that a cache\n * entry may vary by. This is used by the CacheMap module to reuse cache entries\n * across different param values. If a param has a value of Fallback, it means\n * the cache entry is reusable for all possible values of that param. See\n * cache-map.ts for details.\n *\n * A segment's vary path is a pure function of a segment's position in a\n * particular route tree and the (post-rewrite) URL that is being queried. More\n * concretely, successive queries of the cache for the same segment always use\n * the same vary path.\n *\n * A route's vary path is simpler: it's comprised of the pathname, search\n * string, and Next-URL header.\n */\nexport type VaryPath = {\n value: string | null | FallbackType\n parent: VaryPath | null\n}\n\n// Because it's so important for vary paths to line up across cache accesses,\n// we use opaque type aliases to ensure these are only created within\n// this module.\n\n// requestKey -> searchParams -> nextUrl\nexport type RouteVaryPath = Opaque<\n {\n value: NormalizedPathname\n parent: {\n value: NormalizedSearch\n parent: {\n value: NormalizedNextUrl | null | FallbackType\n parent: null\n }\n }\n },\n 'RouteVaryPath'\n>\n\n// requestKey -> pathParams\nexport type LayoutVaryPath = Opaque<\n {\n value: string\n parent: PartialSegmentVaryPath | null\n },\n 'LayoutVaryPath'\n>\n\n// requestKey -> searchParams -> pathParams\nexport type PageVaryPath = Opaque<\n {\n value: string\n parent: {\n value: NormalizedSearch | FallbackType\n parent: PartialSegmentVaryPath | null\n }\n },\n 'PageVaryPath'\n>\n\nexport type SegmentVaryPath = LayoutVaryPath | PageVaryPath\n\n// Intermediate type used when building a vary path during a recursive traversal\n// of the route tree.\nexport type PartialSegmentVaryPath = Opaque<VaryPath, 'PartialSegmentVaryPath'>\n\nexport function getRouteVaryPath(\n pathname: NormalizedPathname,\n search: NormalizedSearch,\n nextUrl: NormalizedNextUrl | null\n): RouteVaryPath {\n // requestKey -> searchParams -> nextUrl\n const varyPath: VaryPath = {\n value: pathname,\n parent: {\n value: search,\n parent: {\n value: nextUrl,\n parent: null,\n },\n },\n }\n return varyPath as RouteVaryPath\n}\n\nexport function getFulfilledRouteVaryPath(\n pathname: NormalizedPathname,\n search: NormalizedSearch,\n nextUrl: NormalizedNextUrl | null,\n couldBeIntercepted: boolean\n): RouteVaryPath {\n // This is called when a route's data is fulfilled. The cache entry will be\n // re-keyed based on which inputs the response varies by.\n // requestKey -> searchParams -> nextUrl\n const varyPath: VaryPath = {\n value: pathname,\n parent: {\n value: search,\n parent: {\n value: couldBeIntercepted ? nextUrl : Fallback,\n parent: null,\n },\n },\n }\n return varyPath as RouteVaryPath\n}\n\nexport function appendLayoutVaryPath(\n parentPath: PartialSegmentVaryPath | null,\n cacheKey: string\n): PartialSegmentVaryPath {\n const varyPathPart: VaryPath = {\n value: cacheKey,\n parent: parentPath,\n }\n return varyPathPart as PartialSegmentVaryPath\n}\n\nexport function finalizeLayoutVaryPath(\n requestKey: string,\n varyPath: PartialSegmentVaryPath | null\n): LayoutVaryPath {\n const layoutVaryPath: VaryPath = {\n value: requestKey,\n parent: varyPath,\n }\n return layoutVaryPath as LayoutVaryPath\n}\n\nexport function finalizePageVaryPath(\n requestKey: string,\n renderedSearch: NormalizedSearch,\n varyPath: PartialSegmentVaryPath | null\n): PageVaryPath {\n // Unlike layouts, a page segment's vary path also includes the search string.\n // requestKey -> searchParams -> pathParams\n const pageVaryPath: VaryPath = {\n value: requestKey,\n parent: {\n value: renderedSearch,\n parent: varyPath,\n },\n }\n return pageVaryPath as PageVaryPath\n}\n\nexport function finalizeMetadataVaryPath(\n pageRequestKey: string,\n renderedSearch: NormalizedSearch,\n varyPath: PartialSegmentVaryPath | null\n): PageVaryPath {\n // The metadata \"segment\" is not a real segment because it doesn't exist in\n // the normal structure of the route tree, but in terms of caching, it\n // behaves like a page segment because it varies by all the same params as\n // a page.\n //\n // To keep the protocol for querying the server simple, the request key for\n // the metadata does not include any path information. It's unnecessary from\n // the server's perspective, because unlike page segments, there's only one\n // metadata response per URL, i.e. there's no need to distinguish multiple\n // parallel pages.\n //\n // However, this means the metadata request key is insufficient for\n // caching the the metadata in the client cache, because on the client we\n // use the request key to distinguish the metadata entry from all other\n // page's metadata entries.\n //\n // So instead we create a simulated request key based on the page segment.\n // Conceptually this is equivalent to the request key the server would have\n // assigned the metadata segment if it treated it as part of the actual\n // route structure.\n\n // If there are multiple parallel pages, we use whichever is the first one.\n // This is fine because the only difference between request keys for\n // different parallel pages are things like route groups and parallel\n // route slots. As long as it's always the same one, it doesn't matter.\n const pageVaryPath: VaryPath = {\n // Append the actual metadata request key to the page request key. Note\n // that we're not using a separate vary path part; it's unnecessary because\n // these are not conceptually separate inputs.\n value: pageRequestKey + HEAD_REQUEST_KEY,\n parent: {\n value: renderedSearch,\n parent: varyPath,\n },\n }\n return pageVaryPath as PageVaryPath\n}\n\nexport function getSegmentVaryPathForRequest(\n fetchStrategy: FetchStrategy,\n tree: RouteTree\n): SegmentVaryPath {\n // This is used for storing pending requests in the cache. We want to choose\n // the most generic vary path based on the strategy used to fetch it, i.e.\n // static/PPR versus runtime prefetching, so that it can be reused as much\n // as possible.\n //\n // We may be able to re-key the response to something even more generic once\n // we receive it — for example, if the server tells us that the response\n // doesn't vary on a particular param — but even before we send the request,\n // we know some params are reusable based on the fetch strategy alone. For\n // example, a static prefetch will never vary on search params.\n //\n // The original vary path with all the params filled in is stored on the\n // route tree object. We will clone this one to create a new vary path\n // where certain params are replaced with Fallback.\n //\n // This result of this function is not stored anywhere. It's only used to\n // access the cache a single time.\n //\n // TODO: Rather than create a new list object just to access the cache, the\n // plan is to add the concept of a \"vary mask\". This will represent all the\n // params that can be treated as Fallback. (Or perhaps the inverse.)\n const originalVaryPath = tree.varyPath\n\n // Only page segments (and the special \"metadata\" segment, which is treated\n // like a page segment for the purposes of caching) may contain search\n // params. There's no reason to include them in the vary path otherwise.\n if (tree.isPage) {\n // Only a runtime prefetch will include search params in the vary path.\n // Static prefetches never include search params, so they can be reused\n // across all possible search param values.\n const doesVaryOnSearchParams =\n fetchStrategy === FetchStrategy.Full ||\n fetchStrategy === FetchStrategy.PPRRuntime\n\n if (!doesVaryOnSearchParams) {\n // The response from the the server will not vary on search params. Clone\n // the end of the original vary path to replace the search params\n // with Fallback.\n //\n // requestKey -> searchParams -> pathParams\n // ^ This part gets replaced with Fallback\n const searchParamsVaryPath = (originalVaryPath as PageVaryPath).parent\n const pathParamsVaryPath = searchParamsVaryPath.parent\n const patchedVaryPath: VaryPath = {\n value: originalVaryPath.value,\n parent: {\n value: Fallback,\n parent: pathParamsVaryPath,\n },\n }\n return patchedVaryPath as SegmentVaryPath\n }\n }\n\n // The request does vary on search params. We don't need to modify anything.\n return originalVaryPath as SegmentVaryPath\n}\n\nexport function clonePageVaryPathWithNewSearchParams(\n originalVaryPath: PageVaryPath,\n newSearch: NormalizedSearch\n): PageVaryPath {\n // requestKey -> searchParams -> pathParams\n // ^ This part gets replaced with newSearch\n const searchParamsVaryPath = originalVaryPath.parent\n const clonedVaryPath: VaryPath = {\n value: originalVaryPath.value,\n parent: {\n value: newSearch,\n parent: searchParamsVaryPath.parent,\n },\n }\n return clonedVaryPath as PageVaryPath\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 { 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 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 type {\n FlightRouterState,\n Segment,\n} from '../../../shared/lib/app-router-types'\nimport { INTERCEPTION_ROUTE_MARKERS } from '../../../shared/lib/router/utils/interception-routes'\nimport type { Params } from '../../../server/request/params'\nimport {\n isGroupSegment,\n DEFAULT_SEGMENT_KEY,\n PAGE_SEGMENT_KEY,\n} from '../../../shared/lib/segment'\nimport { matchSegment } from '../match-segments'\n\nconst removeLeadingSlash = (segment: string): string => {\n return segment[0] === '/' ? segment.slice(1) : segment\n}\n\nconst segmentToPathname = (segment: Segment): string => {\n if (typeof segment === 'string') {\n // 'children' is not a valid path -- it's technically a parallel route that corresponds with the current segment's page\n // if we don't skip it, then the computed pathname might be something like `/children` which doesn't make sense.\n if (segment === 'children') return ''\n\n return segment\n }\n\n return segment[1]\n}\n\nfunction normalizeSegments(segments: string[]): string {\n return (\n segments.reduce((acc, segment) => {\n segment = removeLeadingSlash(segment)\n if (segment === '' || isGroupSegment(segment)) {\n return acc\n }\n\n return `${acc}/${segment}`\n }, '') || '/'\n )\n}\n\nexport function extractPathFromFlightRouterState(\n flightRouterState: FlightRouterState\n): string | undefined {\n const segment = Array.isArray(flightRouterState[0])\n ? flightRouterState[0][1]\n : flightRouterState[0]\n\n if (\n segment === DEFAULT_SEGMENT_KEY ||\n INTERCEPTION_ROUTE_MARKERS.some((m) => segment.startsWith(m))\n )\n return undefined\n\n if (segment.startsWith(PAGE_SEGMENT_KEY)) return ''\n\n const segments = [segmentToPathname(segment)]\n const parallelRoutes = flightRouterState[1] ?? {}\n\n const childrenPath = parallelRoutes.children\n ? extractPathFromFlightRouterState(parallelRoutes.children)\n : undefined\n\n if (childrenPath !== undefined) {\n segments.push(childrenPath)\n } else {\n for (const [key, value] of Object.entries(parallelRoutes)) {\n if (key === 'children') continue\n\n const childPath = extractPathFromFlightRouterState(value)\n\n if (childPath !== undefined) {\n segments.push(childPath)\n }\n }\n }\n\n return normalizeSegments(segments)\n}\n\nfunction computeChangedPathImpl(\n treeA: FlightRouterState,\n treeB: FlightRouterState\n): string | null {\n const [segmentA, parallelRoutesA] = treeA\n const [segmentB, parallelRoutesB] = treeB\n\n const normalizedSegmentA = segmentToPathname(segmentA)\n const normalizedSegmentB = segmentToPathname(segmentB)\n\n if (\n INTERCEPTION_ROUTE_MARKERS.some(\n (m) =>\n normalizedSegmentA.startsWith(m) || normalizedSegmentB.startsWith(m)\n )\n ) {\n return ''\n }\n\n if (!matchSegment(segmentA, segmentB)) {\n // once we find where the tree changed, we compute the rest of the path by traversing the tree\n return extractPathFromFlightRouterState(treeB) ?? ''\n }\n\n for (const parallelRouterKey in parallelRoutesA) {\n if (parallelRoutesB[parallelRouterKey]) {\n const changedPath = computeChangedPathImpl(\n parallelRoutesA[parallelRouterKey],\n parallelRoutesB[parallelRouterKey]\n )\n if (changedPath !== null) {\n return `${segmentToPathname(segmentB)}/${changedPath}`\n }\n }\n }\n\n return null\n}\n\nexport function computeChangedPath(\n treeA: FlightRouterState,\n treeB: FlightRouterState\n): string | null {\n const changedPath = computeChangedPathImpl(treeA, treeB)\n\n if (changedPath == null || changedPath === '/') {\n return changedPath\n }\n\n // lightweight normalization to remove route groups\n return normalizeSegments(changedPath.split('/'))\n}\n\n/**\n * Recursively extracts dynamic parameters from FlightRouterState.\n */\nexport function getSelectedParams(\n currentTree: FlightRouterState,\n params: Params = {}\n): Params {\n const parallelRoutes = currentTree[1]\n\n for (const parallelRoute of Object.values(parallelRoutes)) {\n const segment = parallelRoute[0]\n const isDynamicParameter = Array.isArray(segment)\n const segmentValue = isDynamicParameter ? segment[1] : segment\n if (!segmentValue || segmentValue.startsWith(PAGE_SEGMENT_KEY)) continue\n\n // Ensure catchAll and optional catchall are turned into an array\n const isCatchAll =\n isDynamicParameter && (segment[2] === 'c' || segment[2] === 'oc')\n\n if (isCatchAll) {\n params[segment[0]] = segment[1].split('/')\n } else if (isDynamicParameter) {\n params[segment[0]] = segment[1]\n }\n\n params = getSelectedParams(parallelRoute, params)\n }\n\n return params\n}\n","import { computeChangedPath } from './compute-changed-path'\nimport type {\n Mutable,\n ReadonlyReducerState,\n ReducerState,\n} from './router-reducer-types'\n\nfunction isNotUndefined<T>(value: T): value is Exclude<T, undefined> {\n return typeof value !== 'undefined'\n}\n\nexport function handleMutable(\n state: ReadonlyReducerState,\n mutable: Mutable\n): ReducerState {\n // shouldScroll is true by default, can override to false.\n const shouldScroll = mutable.shouldScroll ?? true\n\n let previousNextUrl = state.previousNextUrl\n let nextUrl = state.nextUrl\n\n if (isNotUndefined(mutable.patchedTree)) {\n // If we received a patched tree, we need to compute the changed path.\n const changedPath = computeChangedPath(state.tree, mutable.patchedTree)\n if (changedPath) {\n // If the tree changed, we need to update the nextUrl\n previousNextUrl = nextUrl\n nextUrl = changedPath\n } else if (!nextUrl) {\n // if the tree ends up being the same (ie, no changed path), and we don't have a nextUrl, then we should use the canonicalUrl\n nextUrl = state.canonicalUrl\n }\n // otherwise this will be a no-op and continue to use the existing nextUrl\n }\n\n return {\n // Set href.\n canonicalUrl: mutable.canonicalUrl ?? state.canonicalUrl,\n renderedSearch: mutable.renderedSearch ?? state.renderedSearch,\n pushRef: {\n pendingPush: isNotUndefined(mutable.pendingPush)\n ? mutable.pendingPush\n : state.pushRef.pendingPush,\n mpaNavigation: isNotUndefined(mutable.mpaNavigation)\n ? mutable.mpaNavigation\n : state.pushRef.mpaNavigation,\n preserveCustomHistoryState: isNotUndefined(\n mutable.preserveCustomHistoryState\n )\n ? mutable.preserveCustomHistoryState\n : state.pushRef.preserveCustomHistoryState,\n },\n // All navigation requires scroll and focus management to trigger.\n focusAndScrollRef: {\n apply: shouldScroll\n ? isNotUndefined(mutable?.scrollableSegments)\n ? true\n : state.focusAndScrollRef.apply\n : // If shouldScroll is false then we should not apply scroll and focus management.\n false,\n onlyHashChange: mutable.onlyHashChange || false,\n hashFragment: shouldScroll\n ? // Empty hash should trigger default behavior of scrolling layout into view.\n // #top is handled in layout-router.\n mutable.hashFragment && mutable.hashFragment !== ''\n ? // Remove leading # and decode hash to make non-latin hashes work.\n decodeURIComponent(mutable.hashFragment.slice(1))\n : state.focusAndScrollRef.hashFragment\n : // If shouldScroll is false then we should not apply scroll and focus management.\n null,\n segmentPaths: shouldScroll\n ? (mutable?.scrollableSegments ?? state.focusAndScrollRef.segmentPaths)\n : // If shouldScroll is false then we should not apply scroll and focus management.\n [],\n },\n // Apply cache.\n cache: mutable.cache ? mutable.cache : state.cache,\n // Apply patched router state.\n tree: isNotUndefined(mutable.patchedTree)\n ? mutable.patchedTree\n : state.tree,\n nextUrl,\n previousNextUrl: previousNextUrl,\n debugInfo: mutable.collectedDebugInfo ?? null,\n }\n}\n","import type { Segment } from '../../../shared/lib/app-router-types'\nimport { PAGE_SEGMENT_KEY } from '../../../shared/lib/segment'\n\nexport function createRouterCacheKey(\n segment: Segment,\n withoutSearchParameters: boolean = false\n) {\n // if the segment is an array, it means it's a dynamic segment\n // for example, ['lang', 'en', 'd']. We need to convert it to a string to store it as a cache node key.\n if (Array.isArray(segment)) {\n return `${segment[0]}|${segment[1]}|${segment[2]}`\n }\n\n // Page segments might have search parameters, ie __PAGE__?foo=bar\n // When `withoutSearchParameters` is true, we only want to return the page segment\n if (withoutSearchParameters && segment.startsWith(PAGE_SEGMENT_KEY)) {\n return PAGE_SEGMENT_KEY\n }\n\n return segment\n}\n","import type { FlightRouterState } from '../../../shared/lib/app-router-types'\n\nexport function isNavigatingToNewRootLayout(\n currentTree: FlightRouterState,\n nextTree: FlightRouterState\n): boolean {\n // Compare segments\n const currentTreeSegment = currentTree[0]\n const nextTreeSegment = nextTree[0]\n\n // If any segment is different before we find the root layout, the root layout has changed.\n // E.g. /same/(group1)/layout.js -> /same/(group2)/layout.js\n // First segment is 'same' for both, keep looking. (group1) changed to (group2) before the root layout was found, it must have changed.\n if (Array.isArray(currentTreeSegment) && Array.isArray(nextTreeSegment)) {\n // Compare dynamic param name and type but ignore the value, different values would not affect the current root layout\n // /[name] - /slug1 and /slug2, both values (slug1 & slug2) still has the same layout /[name]/layout.js\n if (\n currentTreeSegment[0] !== nextTreeSegment[0] ||\n currentTreeSegment[2] !== nextTreeSegment[2]\n ) {\n return true\n }\n } else if (currentTreeSegment !== nextTreeSegment) {\n return true\n }\n\n // Current tree root layout found\n if (currentTree[4]) {\n // If the next tree doesn't have the root layout flag, it must have changed.\n return !nextTree[4]\n }\n // Current tree didn't have its root layout here, must have changed.\n if (nextTree[4]) {\n return true\n }\n // We can't assume it's `parallelRoutes.children` here in case the root layout is `app/@something/layout.js`\n // But it's not possible to be more than one parallelRoutes before the root layout is found\n // TODO-APP: change to traverse all parallel routes\n const currentTreeChild = Object.values(currentTree[1])[0]\n const nextTreeChild = Object.values(nextTree[1])[0]\n if (!currentTreeChild || !nextTreeChild) return true\n return isNavigatingToNewRootLayout(currentTreeChild, nextTreeChild)\n}\n","import type {\n CacheNodeSeedData,\n FlightRouterState,\n FlightSegmentPath,\n Segment,\n} from '../../../shared/lib/app-router-types'\nimport type {\n CacheNode,\n ChildSegmentMap,\n ReadyCacheNode,\n} from '../../../shared/lib/app-router-types'\nimport type {\n HeadData,\n LoadingModuleData,\n} from '../../../shared/lib/app-router-types'\nimport { DEFAULT_SEGMENT_KEY } from '../../../shared/lib/segment'\nimport { matchSegment } from '../match-segments'\nimport { createHrefFromUrl } from './create-href-from-url'\nimport { createRouterCacheKey } from './create-router-cache-key'\nimport type { FetchServerResponseResult } from './fetch-server-response'\nimport { isNavigatingToNewRootLayout } from './is-navigating-to-new-root-layout'\nimport { DYNAMIC_STALETIME_MS } from './reducers/navigate-reducer'\n\n// This is yet another tree type that is used to track pending promises that\n// need to be fulfilled once the dynamic data is received. The terminal nodes of\n// this tree represent the new Cache Node trees that were created during this\n// request. We can't use the Cache Node tree or Route State tree directly\n// because those include reused nodes, too. This tree is discarded as soon as\n// the navigation response is received.\ntype SPANavigationTask = {\n // The router state that corresponds to the tree that this Task represents.\n route: FlightRouterState\n // The CacheNode that corresponds to the tree that this Task represents. If\n // `children` is null (i.e. if this is a terminal task node), then `node`\n // represents a brand new Cache Node tree, which way or may not need to be\n // filled with dynamic data from the server.\n node: CacheNode | null\n // The tree sent to the server during the dynamic request. This is the\n // same as `route`, except with the `refetch` marker set on dynamic segments.\n // If all the segments are static, then this will be null, and no server\n // request is required.\n dynamicRequestTree: FlightRouterState | null\n children: Map<string, SPANavigationTask> | null\n}\n\n// A special type used to bail out and trigger a full-page navigation.\ntype MPANavigationTask = {\n // MPA tasks are distinguised from SPA tasks by having a null `route`.\n route: null\n node: null\n dynamicRequestTree: null\n children: null\n}\n\nconst MPA_NAVIGATION_TASK: MPANavigationTask = {\n route: null,\n node: null,\n dynamicRequestTree: null,\n children: null,\n}\n\nexport type Task = SPANavigationTask | MPANavigationTask\n\n// Creates a new Cache Node tree (i.e. copy-on-write) that represents the\n// optimistic result of a navigation, using both the current Cache Node tree and\n// data that was prefetched prior to navigation.\n//\n// At the moment we call this function, we haven't yet received the navigation\n// response from the server. It could send back something completely different\n// from the tree that was prefetched — due to rewrites, default routes, parallel\n// routes, etc.\n//\n// But in most cases, it will return the same tree that we prefetched, just with\n// the dynamic holes filled in. So we optimistically assume this will happen,\n// and accept that the real result could be arbitrarily different.\n//\n// We'll reuse anything that was already in the previous tree, since that's what\n// the server does.\n//\n// New segments (ones that don't appear in the old tree) are assigned an\n// unresolved promise. The data for these promises will be fulfilled later, when\n// the navigation response is received.\n//\n// The tree can be rendered immediately after it is created (that's why this is\n// a synchronous function). Any new trees that do not have prefetch data will\n// suspend during rendering, until the dynamic data streams in.\n//\n// Returns a Task object, which contains both the updated Cache Node and a path\n// to the pending subtrees that need to be resolved by the navigation response.\n//\n// A return value of `null` means there were no changes, and the previous tree\n// can be reused without initiating a server request.\nexport function startPPRNavigation(\n navigatedAt: number,\n oldUrl: URL,\n oldCacheNode: CacheNode,\n oldRouterState: FlightRouterState,\n newRouterState: FlightRouterState,\n prefetchData: CacheNodeSeedData | null,\n prefetchHead: HeadData | null,\n isPrefetchHeadPartial: boolean,\n isSamePageNavigation: boolean,\n scrollableSegmentsResult: Array<FlightSegmentPath>\n): Task | null {\n const segmentPath: Array<FlightSegmentPath> = []\n return updateCacheNodeOnNavigation(\n navigatedAt,\n oldUrl,\n oldCacheNode,\n oldRouterState,\n newRouterState,\n false,\n prefetchData,\n prefetchHead,\n isPrefetchHeadPartial,\n isSamePageNavigation,\n segmentPath,\n scrollableSegmentsResult\n )\n}\n\nfunction updateCacheNodeOnNavigation(\n navigatedAt: number,\n oldUrl: URL,\n oldCacheNode: CacheNode,\n oldRouterState: FlightRouterState,\n newRouterState: FlightRouterState,\n didFindRootLayout: boolean,\n prefetchData: CacheNodeSeedData | null,\n prefetchHead: HeadData | null,\n isPrefetchHeadPartial: boolean,\n isSamePageNavigation: boolean,\n segmentPath: FlightSegmentPath,\n scrollableSegmentsResult: Array<FlightSegmentPath>\n): Task | null {\n // Diff the old and new trees to reuse the shared layouts.\n const oldRouterStateChildren = oldRouterState[1]\n const newRouterStateChildren = newRouterState[1]\n const prefetchDataChildren = prefetchData !== null ? prefetchData[1] : null\n\n if (!didFindRootLayout) {\n // We're currently traversing the part of the tree that was also part of\n // the previous route. If we discover a root layout, then we don't need to\n // trigger an MPA navigation. See beginRenderingNewRouteTree for context.\n const isRootLayout = newRouterState[4] === true\n if (isRootLayout) {\n // Found a matching root layout.\n didFindRootLayout = true\n }\n }\n\n const oldParallelRoutes = oldCacheNode.parallelRoutes\n\n // Clone the current set of segment children, even if they aren't active in\n // the new tree.\n // TODO: We currently retain all the inactive segments indefinitely, until\n // there's an explicit refresh, or a parent layout is lazily refreshed. We\n // rely on this for popstate navigations, which update the Router State Tree\n // but do not eagerly perform a data fetch, because they expect the segment\n // data to already be in the Cache Node tree. For highly static sites that\n // are mostly read-only, this may happen only rarely, causing memory to\n // leak. We should figure out a better model for the lifetime of inactive\n // segments, so we can maintain instant back/forward navigations without\n // leaking memory indefinitely.\n const prefetchParallelRoutes = new Map(oldParallelRoutes)\n\n // As we diff the trees, we may sometimes modify (copy-on-write, not mutate)\n // the Route Tree that was returned by the server — for example, in the case\n // of default parallel routes, we preserve the currently active segment. To\n // avoid mutating the original tree, we clone the router state children along\n // the return path.\n let patchedRouterStateChildren: {\n [parallelRouteKey: string]: FlightRouterState\n } = {}\n let taskChildren = null\n\n // Most navigations require a request to fetch additional data from the\n // server, either because the data was not already prefetched, or because the\n // target route contains dynamic data that cannot be prefetched.\n //\n // However, if the target route is fully static, and it's already completely\n // loaded into the segment cache, then we can skip the server request.\n //\n // This starts off as `false`, and is set to `true` if any of the child\n // routes requires a dynamic request.\n let needsDynamicRequest = false\n // As we traverse the children, we'll construct a FlightRouterState that can\n // be sent to the server to request the dynamic data. If it turns out that\n // nothing in the subtree is dynamic (i.e. needsDynamicRequest is false at the\n // end), then this will be discarded.\n // TODO: We can probably optimize the format of this data structure to only\n // include paths that are dynamic. Instead of reusing the\n // FlightRouterState type.\n let dynamicRequestTreeChildren: {\n [parallelRouteKey: string]: FlightRouterState\n } = {}\n\n for (let parallelRouteKey in newRouterStateChildren) {\n const newRouterStateChild: FlightRouterState =\n newRouterStateChildren[parallelRouteKey]\n const oldRouterStateChild: FlightRouterState | void =\n oldRouterStateChildren[parallelRouteKey]\n const oldSegmentMapChild = oldParallelRoutes.get(parallelRouteKey)\n const prefetchDataChild: CacheNodeSeedData | void | null =\n prefetchDataChildren !== null\n ? prefetchDataChildren[parallelRouteKey]\n : null\n\n const newSegmentChild = newRouterStateChild[0]\n const newSegmentPathChild = segmentPath.concat([\n parallelRouteKey,\n newSegmentChild,\n ])\n const newSegmentKeyChild = createRouterCacheKey(newSegmentChild)\n\n const oldSegmentChild =\n oldRouterStateChild !== undefined ? oldRouterStateChild[0] : undefined\n\n const oldCacheNodeChild =\n oldSegmentMapChild !== undefined\n ? oldSegmentMapChild.get(newSegmentKeyChild)\n : undefined\n\n let taskChild: Task | null\n if (newSegmentChild === DEFAULT_SEGMENT_KEY) {\n // This is another kind of leaf segment — a default route.\n //\n // Default routes have special behavior. When there's no matching segment\n // for a parallel route, Next.js preserves the currently active segment\n // during a client navigation — but not for initial render. The server\n // leaves it to the client to account for this. So we need to handle\n // it here.\n if (oldRouterStateChild !== undefined) {\n // Reuse the existing Router State for this segment. We spawn a \"task\"\n // just to keep track of the updated router state; unlike most, it's\n // already fulfilled and won't be affected by the dynamic response.\n taskChild = reuseActiveSegmentInDefaultSlot(oldUrl, oldRouterStateChild)\n } else {\n // There's no currently active segment. Switch to the \"create\" path.\n taskChild = beginRenderingNewRouteTree(\n navigatedAt,\n oldRouterStateChild,\n newRouterStateChild,\n oldCacheNodeChild,\n didFindRootLayout,\n prefetchDataChild !== undefined ? prefetchDataChild : null,\n prefetchHead,\n isPrefetchHeadPartial,\n newSegmentPathChild,\n scrollableSegmentsResult\n )\n }\n } else if (\n isSamePageNavigation &&\n // Check if this is a page segment.\n // TODO: We're not consistent about how we do this check. Some places\n // check if the segment starts with PAGE_SEGMENT_KEY, but most seem to\n // check if there any any children, which is why I'm doing it here. We\n // should probably encode an empty children set as `null` though. Either\n // way, we should update all the checks to be consistent.\n Object.keys(newRouterStateChild[1]).length === 0\n ) {\n // We special case navigations to the exact same URL as the current\n // location. It's a common UI pattern for apps to refresh when you click a\n // link to the current page. So when this happens, we refresh the dynamic\n // data in the page segments.\n //\n // Note that this does not apply if the any part of the hash or search\n // query has changed. This might feel a bit weird but it makes more sense\n // when you consider that the way to trigger this behavior is to click\n // the same link multiple times.\n //\n // TODO: We should probably refresh the *entire* route when this case\n // occurs, not just the page segments. Essentially treating it the same as\n // a refresh() triggered by an action, which is the more explicit way of\n // modeling the UI pattern described above.\n //\n // Also note that this only refreshes the dynamic data, not static/\n // cached data. If the page segment is fully static and prefetched, the\n // request is skipped. (This is also how refresh() works.)\n taskChild = beginRenderingNewRouteTree(\n navigatedAt,\n oldRouterStateChild,\n newRouterStateChild,\n oldCacheNodeChild,\n didFindRootLayout,\n prefetchDataChild !== undefined ? prefetchDataChild : null,\n prefetchHead,\n isPrefetchHeadPartial,\n newSegmentPathChild,\n scrollableSegmentsResult\n )\n } else if (\n oldRouterStateChild !== undefined &&\n oldSegmentChild !== undefined &&\n matchSegment(newSegmentChild, oldSegmentChild)\n ) {\n if (\n oldCacheNodeChild !== undefined &&\n oldRouterStateChild !== undefined\n ) {\n // This segment exists in both the old and new trees. Recursively update\n // the children.\n taskChild = updateCacheNodeOnNavigation(\n navigatedAt,\n oldUrl,\n oldCacheNodeChild,\n oldRouterStateChild,\n newRouterStateChild,\n didFindRootLayout,\n prefetchDataChild,\n prefetchHead,\n isPrefetchHeadPartial,\n isSamePageNavigation,\n newSegmentPathChild,\n scrollableSegmentsResult\n )\n } else {\n // There's no existing Cache Node for this segment. Switch to the\n // \"create\" path.\n taskChild = beginRenderingNewRouteTree(\n navigatedAt,\n oldRouterStateChild,\n newRouterStateChild,\n oldCacheNodeChild,\n didFindRootLayout,\n prefetchDataChild !== undefined ? prefetchDataChild : null,\n prefetchHead,\n isPrefetchHeadPartial,\n newSegmentPathChild,\n scrollableSegmentsResult\n )\n }\n } else {\n // This is a new tree. Switch to the \"create\" path.\n taskChild = beginRenderingNewRouteTree(\n navigatedAt,\n oldRouterStateChild,\n newRouterStateChild,\n oldCacheNodeChild,\n didFindRootLayout,\n prefetchDataChild !== undefined ? prefetchDataChild : null,\n prefetchHead,\n isPrefetchHeadPartial,\n newSegmentPathChild,\n scrollableSegmentsResult\n )\n }\n\n if (taskChild !== null) {\n // Recursively propagate up the child tasks.\n\n if (taskChild.route === null) {\n // One of the child tasks discovered a change to the root layout.\n // Immediately unwind from this recursive traversal.\n return MPA_NAVIGATION_TASK\n }\n\n if (taskChildren === null) {\n taskChildren = new Map()\n }\n taskChildren.set(parallelRouteKey, taskChild)\n const newCacheNodeChild = taskChild.node\n if (newCacheNodeChild !== null) {\n const newSegmentMapChild: ChildSegmentMap = new Map(oldSegmentMapChild)\n newSegmentMapChild.set(newSegmentKeyChild, newCacheNodeChild)\n prefetchParallelRoutes.set(parallelRouteKey, newSegmentMapChild)\n }\n\n // The child tree's route state may be different from the prefetched\n // route sent by the server. We need to clone it as we traverse back up\n // the tree.\n const taskChildRoute = taskChild.route\n patchedRouterStateChildren[parallelRouteKey] = taskChildRoute\n\n const dynamicRequestTreeChild = taskChild.dynamicRequestTree\n if (dynamicRequestTreeChild !== null) {\n // Something in the child tree is dynamic.\n needsDynamicRequest = true\n dynamicRequestTreeChildren[parallelRouteKey] = dynamicRequestTreeChild\n } else {\n dynamicRequestTreeChildren[parallelRouteKey] = taskChildRoute\n }\n } else {\n // The child didn't change. We can use the prefetched router state.\n patchedRouterStateChildren[parallelRouteKey] = newRouterStateChild\n dynamicRequestTreeChildren[parallelRouteKey] = newRouterStateChild\n }\n }\n\n if (taskChildren === null) {\n // No new tasks were spawned.\n return null\n }\n\n const newCacheNode: ReadyCacheNode = {\n lazyData: null,\n rsc: oldCacheNode.rsc,\n // We intentionally aren't updating the prefetchRsc field, since this node\n // is already part of the current tree, because it would be weird for\n // prefetch data to be newer than the final data. It probably won't ever be\n // observable anyway, but it could happen if the segment is unmounted then\n // mounted again, because LayoutRouter will momentarily switch to rendering\n // prefetchRsc, via useDeferredValue.\n prefetchRsc: oldCacheNode.prefetchRsc,\n head: oldCacheNode.head,\n prefetchHead: oldCacheNode.prefetchHead,\n loading: oldCacheNode.loading,\n\n // Everything is cloned except for the children, which we computed above.\n parallelRoutes: prefetchParallelRoutes,\n\n navigatedAt,\n }\n\n return {\n // Return a cloned copy of the router state with updated children.\n route: patchRouterStateWithNewChildren(\n newRouterState,\n patchedRouterStateChildren\n ),\n node: newCacheNode,\n dynamicRequestTree: needsDynamicRequest\n ? patchRouterStateWithNewChildren(\n newRouterState,\n dynamicRequestTreeChildren\n )\n : null,\n children: taskChildren,\n }\n}\n\nfunction beginRenderingNewRouteTree(\n navigatedAt: number,\n oldRouterState: FlightRouterState | void,\n newRouterState: FlightRouterState,\n existingCacheNode: CacheNode | void,\n didFindRootLayout: boolean,\n prefetchData: CacheNodeSeedData | null,\n possiblyPartialPrefetchHead: HeadData | null,\n isPrefetchHeadPartial: boolean,\n segmentPath: FlightSegmentPath,\n scrollableSegmentsResult: Array<FlightSegmentPath>\n): Task {\n if (!didFindRootLayout) {\n // The route tree changed before we reached a layout. (The highest-level\n // layout in a route tree is referred to as the \"root\" layout.) This could\n // mean that we're navigating between two different root layouts. When this\n // happens, we perform a full-page (MPA-style) navigation.\n //\n // However, the algorithm for deciding where to start rendering a route\n // (i.e. the one performed in order to reach this function) is stricter\n // than the one used to detect a change in the root layout. So just because\n // we're re-rendering a segment outside of the root layout does not mean we\n // should trigger a full-page navigation.\n //\n // Specifically, we handle dynamic parameters differently: two segments are\n // considered the same even if their parameter values are different.\n //\n // Refer to isNavigatingToNewRootLayout for details.\n //\n // Note that we only have to perform this extra traversal if we didn't\n // already discover a root layout in the part of the tree that is unchanged.\n // In the common case, this branch is skipped completely.\n if (\n oldRouterState === undefined ||\n isNavigatingToNewRootLayout(oldRouterState, newRouterState)\n ) {\n // The root layout changed. Perform a full-page navigation.\n return MPA_NAVIGATION_TASK\n }\n }\n return createCacheNodeOnNavigation(\n navigatedAt,\n newRouterState,\n existingCacheNode,\n prefetchData,\n possiblyPartialPrefetchHead,\n isPrefetchHeadPartial,\n segmentPath,\n scrollableSegmentsResult\n )\n}\n\nfunction createCacheNodeOnNavigation(\n navigatedAt: number,\n routerState: FlightRouterState,\n existingCacheNode: CacheNode | void,\n prefetchData: CacheNodeSeedData | null,\n possiblyPartialPrefetchHead: HeadData | null,\n isPrefetchHeadPartial: boolean,\n segmentPath: FlightSegmentPath,\n scrollableSegmentsResult: Array<FlightSegmentPath>\n): SPANavigationTask {\n // Same traversal as updateCacheNodeNavigation, but we switch to this path\n // once we reach the part of the tree that was not in the previous route. We\n // don't need to diff against the old tree, we just need to create a new one.\n\n // The head is assigned to every leaf segment delivered by the server. Based\n // on corresponding logic in fill-lazy-items-till-leaf-with-head.ts\n const routerStateChildren = routerState[1]\n const isLeafSegment = Object.keys(routerStateChildren).length === 0\n\n // Even we're rendering inside the \"new\" part of the target tree, we may have\n // a locally cached segment that we can reuse. This may come from either 1)\n // the CacheNode tree, which lives in React state and is populated by previous\n // navigations; or 2) the prefetch cache, which is a separate cache that is\n // populated by prefetches.\n let rsc: React.ReactNode\n let loading: LoadingModuleData | Promise<LoadingModuleData>\n let head: HeadData | null\n let cacheNodeNavigatedAt: number\n if (\n existingCacheNode !== undefined &&\n // DYNAMIC_STALETIME_MS defaults to 0, but it can be increased using\n // the experimental.staleTimes.dynamic config. When set, we'll avoid\n // refetching dynamic data if it was fetched within the given threshold.\n existingCacheNode.navigatedAt + DYNAMIC_STALETIME_MS > navigatedAt\n ) {\n // We have an existing CacheNode for this segment, and it's not stale. We\n // should reuse it rather than request a new one.\n rsc = existingCacheNode.rsc\n loading = existingCacheNode.loading\n head = existingCacheNode.head\n\n // Don't update the navigatedAt timestamp, since we're reusing stale data.\n cacheNodeNavigatedAt = existingCacheNode.navigatedAt\n } else if (prefetchData !== null) {\n // There's no existing CacheNode for this segment, but we do have prefetch\n // data. If the prefetch data is fully static (i.e. does not contain any\n // dynamic holes), we don't need to request it from the server.\n rsc = prefetchData[0]\n loading = prefetchData[2]\n head = isLeafSegment ? possiblyPartialPrefetchHead : null\n // Even though we're accessing the data from the prefetch cache, this is\n // conceptually a new segment, not a reused one. So we should update the\n // navigatedAt timestamp.\n cacheNodeNavigatedAt = navigatedAt\n const isPrefetchRscPartial = prefetchData[3]\n if (\n // Check if the segment data is partial\n isPrefetchRscPartial ||\n // Check if the head is partial (only relevant if this is a leaf segment)\n (isPrefetchHeadPartial && isLeafSegment)\n ) {\n // We only have partial data from this segment. Like missing segments, we\n // must request the full data from the server.\n return spawnPendingTask(\n navigatedAt,\n routerState,\n prefetchData,\n possiblyPartialPrefetchHead,\n isPrefetchHeadPartial,\n segmentPath,\n scrollableSegmentsResult\n )\n } else {\n // The prefetch data is fully static, so we can omit it from the\n // navigation request.\n }\n } else {\n // There's no prefetch for this segment. Everything from this point will be\n // requested from the server, even if there are static children below it.\n // Create a terminal task node that will later be fulfilled by\n // server response.\n return spawnPendingTask(\n navigatedAt,\n routerState,\n null,\n possiblyPartialPrefetchHead,\n isPrefetchHeadPartial,\n segmentPath,\n scrollableSegmentsResult\n )\n }\n\n // We already have a full segment we can render, so we don't need to request a\n // new one from the server. Keep traversing down the tree until we reach\n // something that requires a dynamic request.\n const prefetchDataChildren = prefetchData !== null ? prefetchData[1] : null\n const taskChildren = new Map()\n const existingCacheNodeChildren =\n existingCacheNode !== undefined ? existingCacheNode.parallelRoutes : null\n const cacheNodeChildren = new Map(existingCacheNodeChildren)\n let dynamicRequestTreeChildren: {\n [parallelRouteKey: string]: FlightRouterState\n } = {}\n let needsDynamicRequest = false\n if (isLeafSegment) {\n // The segment path of every leaf segment (i.e. page) is collected into\n // a result array. This is used by the LayoutRouter to scroll to ensure that\n // new pages are visible after a navigation.\n // TODO: We should use a string to represent the segment path instead of\n // an array. We already use a string representation for the path when\n // accessing the Segment Cache, so we can use the same one.\n scrollableSegmentsResult.push(segmentPath)\n } else {\n for (let parallelRouteKey in routerStateChildren) {\n const routerStateChild: FlightRouterState =\n routerStateChildren[parallelRouteKey]\n const prefetchDataChild: CacheNodeSeedData | void | null =\n prefetchDataChildren !== null\n ? prefetchDataChildren[parallelRouteKey]\n : null\n const existingSegmentMapChild =\n existingCacheNodeChildren !== null\n ? existingCacheNodeChildren.get(parallelRouteKey)\n : undefined\n const segmentChild = routerStateChild[0]\n const segmentPathChild = segmentPath.concat([\n parallelRouteKey,\n segmentChild,\n ])\n const segmentKeyChild = createRouterCacheKey(segmentChild)\n\n const existingCacheNodeChild =\n existingSegmentMapChild !== undefined\n ? existingSegmentMapChild.get(segmentKeyChild)\n : undefined\n\n const taskChild = createCacheNodeOnNavigation(\n navigatedAt,\n routerStateChild,\n existingCacheNodeChild,\n prefetchDataChild,\n possiblyPartialPrefetchHead,\n isPrefetchHeadPartial,\n segmentPathChild,\n scrollableSegmentsResult\n )\n taskChildren.set(parallelRouteKey, taskChild)\n const dynamicRequestTreeChild = taskChild.dynamicRequestTree\n if (dynamicRequestTreeChild !== null) {\n // Something in the child tree is dynamic.\n needsDynamicRequest = true\n dynamicRequestTreeChildren[parallelRouteKey] = dynamicRequestTreeChild\n } else {\n dynamicRequestTreeChildren[parallelRouteKey] = routerStateChild\n }\n const newCacheNodeChild = taskChild.node\n if (newCacheNodeChild !== null) {\n const newSegmentMapChild: ChildSegmentMap = new Map()\n newSegmentMapChild.set(segmentKeyChild, newCacheNodeChild)\n cacheNodeChildren.set(parallelRouteKey, newSegmentMapChild)\n }\n }\n }\n\n return {\n // Since we're inside a new route tree, unlike the\n // `updateCacheNodeOnNavigation` path, the router state on the children\n // tasks is always the same as the router state we pass in. So we don't need\n // to clone/modify it.\n route: routerState,\n node: {\n lazyData: null,\n // Since this segment is already full, we don't need to use the\n // `prefetchRsc` field.\n rsc,\n prefetchRsc: null,\n head,\n prefetchHead: null,\n loading,\n parallelRoutes: cacheNodeChildren,\n navigatedAt: cacheNodeNavigatedAt,\n },\n dynamicRequestTree: needsDynamicRequest\n ? patchRouterStateWithNewChildren(routerState, dynamicRequestTreeChildren)\n : null,\n children: taskChildren,\n }\n}\n\nfunction patchRouterStateWithNewChildren(\n baseRouterState: FlightRouterState,\n newChildren: { [parallelRouteKey: string]: FlightRouterState }\n): FlightRouterState {\n const clone: FlightRouterState = [baseRouterState[0], newChildren]\n // Based on equivalent logic in apply-router-state-patch-to-tree, but should\n // confirm whether we need to copy all of these fields. Not sure the server\n // ever sends, e.g. the refetch marker.\n if (2 in baseRouterState) {\n clone[2] = baseRouterState[2]\n }\n if (3 in baseRouterState) {\n clone[3] = baseRouterState[3]\n }\n if (4 in baseRouterState) {\n clone[4] = baseRouterState[4]\n }\n return clone\n}\n\nfunction spawnPendingTask(\n navigatedAt: number,\n routerState: FlightRouterState,\n prefetchData: CacheNodeSeedData | null,\n prefetchHead: HeadData | null,\n isPrefetchHeadPartial: boolean,\n segmentPath: FlightSegmentPath,\n scrollableSegmentsResult: Array<FlightSegmentPath>\n): SPANavigationTask {\n // Create a task that will later be fulfilled by data from the server.\n\n // Clone the prefetched route tree and the `refetch` marker to it. We'll send\n // this to the server so it knows where to start rendering.\n const dynamicRequestTree = patchRouterStateWithNewChildren(\n routerState,\n routerState[1]\n )\n dynamicRequestTree[3] = 'refetch'\n\n const newTask: Task = {\n route: routerState,\n\n // Corresponds to the part of the route that will be rendered on the server.\n node: createPendingCacheNode(\n navigatedAt,\n routerState,\n prefetchData,\n prefetchHead,\n isPrefetchHeadPartial,\n segmentPath,\n scrollableSegmentsResult\n ),\n // Because this is non-null, and it gets propagated up through the parent\n // tasks, the root task will know that it needs to perform a server request.\n dynamicRequestTree,\n children: null,\n }\n return newTask\n}\n\nfunction reuseActiveSegmentInDefaultSlot(\n oldUrl: URL,\n oldRouterState: FlightRouterState\n): Task {\n // This is a \"default\" segment. These are never sent by the server during a\n // soft navigation; instead, the client reuses whatever segment was already\n // active in that slot on the previous route. This means if we later need to\n // refresh the segment, it will have to be refetched from the previous route's\n // URL. We store it in the Flight Router State.\n //\n // TODO: We also mark the segment with a \"refresh\" marker but I think we can\n // get rid of that eventually by making sure we only add URLs to page segments\n // that are reused. Then the presence of the URL alone is enough.\n let reusedRouterState\n\n const oldRefreshMarker = oldRouterState[3]\n if (oldRefreshMarker === 'refresh') {\n // This segment was already reused from an even older route. Keep its\n // existing URL and refresh marker.\n reusedRouterState = oldRouterState\n } else {\n // This segment was not previously reused, and it's not on the new route.\n // So it must have been delivered in the old route.\n reusedRouterState = patchRouterStateWithNewChildren(\n oldRouterState,\n oldRouterState[1]\n )\n reusedRouterState[2] = createHrefFromUrl(oldUrl)\n reusedRouterState[3] = 'refresh'\n }\n\n return {\n route: reusedRouterState,\n node: null,\n dynamicRequestTree: null,\n children: null,\n }\n}\n\n// Writes a dynamic server response into the tree created by\n// updateCacheNodeOnNavigation. All pending promises that were spawned by the\n// navigation will be resolved, either with dynamic data from the server, or\n// `null` to indicate that the data is missing.\n//\n// A `null` value will trigger a lazy fetch during render, which will then patch\n// up the tree using the same mechanism as the non-PPR implementation\n// (serverPatchReducer).\n//\n// Usually, the server will respond with exactly the subset of data that we're\n// waiting for — everything below the nearest shared layout. But technically,\n// the server can return anything it wants.\n//\n// This does _not_ create a new tree; it modifies the existing one in place.\n// Which means it must follow the Suspense rules of cache safety.\nexport function listenForDynamicRequest(\n task: SPANavigationTask,\n responsePromise: Promise<FetchServerResponseResult>\n) {\n responsePromise.then(\n (result: FetchServerResponseResult) => {\n if (typeof result === 'string') {\n // Happens when navigating to page in `pages` from `app`. We shouldn't\n // get here because should have already handled this during\n // the prefetch.\n return\n }\n const { flightData, debugInfo } = result\n for (const normalizedFlightData of flightData) {\n const {\n segmentPath,\n tree: serverRouterState,\n seedData: dynamicData,\n head: dynamicHead,\n } = normalizedFlightData\n\n if (!dynamicData) {\n // This shouldn't happen. PPR should always send back a response.\n // However, `FlightDataPath` is a shared type and the pre-PPR handling of\n // this might return null.\n continue\n }\n\n writeDynamicDataIntoPendingTask(\n task,\n segmentPath,\n serverRouterState,\n dynamicData,\n dynamicHead,\n debugInfo\n )\n }\n\n // Now that we've exhausted all the data we received from the server, if\n // there are any remaining pending tasks in the tree, abort them now.\n // If there's any missing data, it will trigger a lazy fetch.\n abortTask(task, null, debugInfo)\n },\n (error: any) => {\n // This will trigger an error during render\n abortTask(task, error, null)\n }\n )\n}\n\nfunction writeDynamicDataIntoPendingTask(\n rootTask: SPANavigationTask,\n segmentPath: FlightSegmentPath,\n serverRouterState: FlightRouterState,\n dynamicData: CacheNodeSeedData,\n dynamicHead: HeadData,\n debugInfo: Array<any> | null\n) {\n // The data sent by the server represents only a subtree of the app. We need\n // to find the part of the task tree that matches the server response, and\n // fulfill it using the dynamic data.\n //\n // segmentPath represents the parent path of subtree. It's a repeating pattern\n // of parallel route key and segment:\n //\n // [string, Segment, string, Segment, string, Segment, ...]\n //\n // Iterate through the path and finish any tasks that match this payload.\n let task = rootTask\n for (let i = 0; i < segmentPath.length; i += 2) {\n const parallelRouteKey: string = segmentPath[i]\n const segment: Segment = segmentPath[i + 1]\n const taskChildren = task.children\n if (taskChildren !== null) {\n const taskChild = taskChildren.get(parallelRouteKey)\n if (taskChild !== undefined) {\n const taskSegment = taskChild.route[0]\n if (matchSegment(segment, taskSegment)) {\n // Found a match for this task. Keep traversing down the task tree.\n task = taskChild\n continue\n }\n }\n }\n // We didn't find a child task that matches the server data. Exit. We won't\n // abort the task, though, because a different FlightDataPath may be able to\n // fulfill it (see loop in listenForDynamicRequest). We only abort tasks\n // once we've run out of data.\n return\n }\n\n finishTaskUsingDynamicDataPayload(\n task,\n serverRouterState,\n dynamicData,\n dynamicHead,\n debugInfo\n )\n}\n\nfunction finishTaskUsingDynamicDataPayload(\n task: SPANavigationTask,\n serverRouterState: FlightRouterState,\n dynamicData: CacheNodeSeedData,\n dynamicHead: HeadData,\n debugInfo: Array<any> | null\n) {\n if (task.dynamicRequestTree === null) {\n // Everything in this subtree is already complete. Bail out.\n return\n }\n\n // dynamicData may represent a larger subtree than the task. Before we can\n // finish the task, we need to line them up.\n const taskChildren = task.children\n const taskNode = task.node\n if (taskChildren === null) {\n // We've reached the leaf node of the pending task. The server data tree\n // lines up the pending Cache Node tree. We can now switch to the\n // normal algorithm.\n if (taskNode !== null) {\n finishPendingCacheNode(\n taskNode,\n task.route,\n serverRouterState,\n dynamicData,\n dynamicHead,\n debugInfo\n )\n // Set this to null to indicate that this task is now complete.\n task.dynamicRequestTree = null\n }\n return\n }\n // The server returned more data than we need to finish the task. Skip over\n // the extra segments until we reach the leaf task node.\n const serverChildren = serverRouterState[1]\n const dynamicDataChildren = dynamicData[1]\n\n for (const parallelRouteKey in serverRouterState) {\n const serverRouterStateChild: FlightRouterState =\n serverChildren[parallelRouteKey]\n const dynamicDataChild: CacheNodeSeedData | null | void =\n dynamicDataChildren[parallelRouteKey]\n\n const taskChild = taskChildren.get(parallelRouteKey)\n if (taskChild !== undefined) {\n const taskSegment = taskChild.route[0]\n if (\n matchSegment(serverRouterStateChild[0], taskSegment) &&\n dynamicDataChild !== null &&\n dynamicDataChild !== undefined\n ) {\n // Found a match for this task. Keep traversing down the task tree.\n return finishTaskUsingDynamicDataPayload(\n taskChild,\n serverRouterStateChild,\n dynamicDataChild,\n dynamicHead,\n debugInfo\n )\n }\n }\n // We didn't find a child task that matches the server data. We won't abort\n // the task, though, because a different FlightDataPath may be able to\n // fulfill it (see loop in listenForDynamicRequest). We only abort tasks\n // once we've run out of data.\n }\n}\n\nfunction createPendingCacheNode(\n navigatedAt: number,\n routerState: FlightRouterState,\n prefetchData: CacheNodeSeedData | null,\n prefetchHead: HeadData | null,\n isPrefetchHeadPartial: boolean,\n segmentPath: FlightSegmentPath,\n scrollableSegmentsResult: Array<FlightSegmentPath>\n): ReadyCacheNode {\n const routerStateChildren = routerState[1]\n const prefetchDataChildren = prefetchData !== null ? prefetchData[1] : null\n\n const parallelRoutes = new Map()\n for (let parallelRouteKey in routerStateChildren) {\n const routerStateChild: FlightRouterState =\n routerStateChildren[parallelRouteKey]\n const prefetchDataChild: CacheNodeSeedData | null | void =\n prefetchDataChildren !== null\n ? prefetchDataChildren[parallelRouteKey]\n : null\n\n const segmentChild = routerStateChild[0]\n const segmentPathChild = segmentPath.concat([\n parallelRouteKey,\n segmentChild,\n ])\n const segmentKeyChild = createRouterCacheKey(segmentChild)\n\n const newCacheNodeChild = createPendingCacheNode(\n navigatedAt,\n routerStateChild,\n prefetchDataChild === undefined ? null : prefetchDataChild,\n prefetchHead,\n isPrefetchHeadPartial,\n segmentPathChild,\n scrollableSegmentsResult\n )\n\n const newSegmentMapChild: ChildSegmentMap = new Map()\n newSegmentMapChild.set(segmentKeyChild, newCacheNodeChild)\n parallelRoutes.set(parallelRouteKey, newSegmentMapChild)\n }\n\n // The head is assigned to every leaf segment delivered by the server. Based\n // on corresponding logic in fill-lazy-items-till-leaf-with-head.ts\n const isLeafSegment = parallelRoutes.size === 0\n\n if (isLeafSegment) {\n // The segment path of every leaf segment (i.e. page) is collected into\n // a result array. This is used by the LayoutRouter to scroll to ensure that\n // new pages are visible after a navigation.\n // TODO: We should use a string to represent the segment path instead of\n // an array. We already use a string representation for the path when\n // accessing the Segment Cache, so we can use the same one.\n scrollableSegmentsResult.push(segmentPath)\n }\n\n const maybePrefetchRsc = prefetchData !== null ? prefetchData[0] : null\n return {\n lazyData: null,\n parallelRoutes: parallelRoutes,\n\n prefetchRsc: maybePrefetchRsc !== undefined ? maybePrefetchRsc : null,\n prefetchHead: isLeafSegment ? prefetchHead : [null, null],\n\n // Create a deferred promise. This will be fulfilled once the dynamic\n // response is received from the server.\n rsc: createDeferredRsc() as React.ReactNode,\n head: isLeafSegment ? (createDeferredRsc() as React.ReactNode) : null,\n\n // TODO: Technically, a loading boundary could contain dynamic data. We must\n // have separate `loading` and `prefetchLoading` fields to handle this, like\n // we do for the segment data and head.\n loading:\n prefetchData !== null\n ? (prefetchData[2] ?? null)\n : // If we don't have a prefetch, then we don't know if there's a loading component.\n // We'll fulfill it based on the dynamic response, just like `rsc` and `head`.\n createDeferredRsc<LoadingModuleData>(),\n\n navigatedAt,\n }\n}\n\nfunction finishPendingCacheNode(\n cacheNode: CacheNode,\n taskState: FlightRouterState,\n serverState: FlightRouterState,\n dynamicData: CacheNodeSeedData,\n dynamicHead: HeadData,\n debugInfo: Array<any> | null\n): void {\n // Writes a dynamic response into an existing Cache Node tree. This does _not_\n // create a new tree, it updates the existing tree in-place. So it must follow\n // the Suspense rules of cache safety — it can resolve pending promises, but\n // it cannot overwrite existing data. It can add segments to the tree (because\n // a missing segment will cause the layout router to suspend).\n // but it cannot delete them.\n //\n // We must resolve every promise in the tree, or else it will suspend\n // indefinitely. If we did not receive data for a segment, we will resolve its\n // data promise to `null` to trigger a lazy fetch during render.\n const taskStateChildren = taskState[1]\n const serverStateChildren = serverState[1]\n const dataChildren = dynamicData[1]\n\n // The router state that we traverse the tree with (taskState) is the same one\n // that we used to construct the pending Cache Node tree. That way we're sure\n // to resolve all the pending promises.\n const parallelRoutes = cacheNode.parallelRoutes\n for (let parallelRouteKey in taskStateChildren) {\n const taskStateChild: FlightRouterState =\n taskStateChildren[parallelRouteKey]\n const serverStateChild: FlightRouterState | void =\n serverStateChildren[parallelRouteKey]\n const dataChild: CacheNodeSeedData | null | void =\n dataChildren[parallelRouteKey]\n\n const segmentMapChild = parallelRoutes.get(parallelRouteKey)\n const taskSegmentChild = taskStateChild[0]\n const taskSegmentKeyChild = createRouterCacheKey(taskSegmentChild)\n\n const cacheNodeChild =\n segmentMapChild !== undefined\n ? segmentMapChild.get(taskSegmentKeyChild)\n : undefined\n\n if (cacheNodeChild !== undefined) {\n if (\n serverStateChild !== undefined &&\n matchSegment(taskSegmentChild, serverStateChild[0])\n ) {\n if (dataChild !== undefined && dataChild !== null) {\n // This is the happy path. Recursively update all the children.\n finishPendingCacheNode(\n cacheNodeChild,\n taskStateChild,\n serverStateChild,\n dataChild,\n dynamicHead,\n debugInfo\n )\n } else {\n // The server never returned data for this segment. Trigger a lazy\n // fetch during render. This shouldn't happen because the Route Tree\n // and the Seed Data tree sent by the server should always be the same\n // shape when part of the same server response.\n abortPendingCacheNode(taskStateChild, cacheNodeChild, null, debugInfo)\n }\n } else {\n // The server never returned data for this segment. Trigger a lazy\n // fetch during render.\n abortPendingCacheNode(taskStateChild, cacheNodeChild, null, debugInfo)\n }\n } else {\n // The server response matches what was expected to receive, but there's\n // no matching Cache Node in the task tree. This is a bug in the\n // implementation because we should have created a node for every\n // segment in the tree that's associated with this task.\n }\n }\n\n // Use the dynamic data from the server to fulfill the deferred RSC promise\n // on the Cache Node.\n const rsc = cacheNode.rsc\n const dynamicSegmentData = dynamicData[0]\n if (rsc === null) {\n // This is a lazy cache node. We can overwrite it. This is only safe\n // because we know that the LayoutRouter suspends if `rsc` is `null`.\n cacheNode.rsc = dynamicSegmentData\n } else if (isDeferredRsc(rsc)) {\n // This is a deferred RSC promise. We can fulfill it with the data we just\n // received from the server. If it was already resolved by a different\n // navigation, then this does nothing because we can't overwrite data.\n rsc.resolve(dynamicSegmentData, debugInfo)\n } else {\n // This is not a deferred RSC promise, nor is it empty, so it must have\n // been populated by a different navigation. We must not overwrite it.\n }\n\n // If we navigated without a prefetch, then `loading` will be a deferred promise too.\n // Fulfill it using the dynamic response so that we can display the loading boundary.\n const loading = cacheNode.loading\n if (isDeferredRsc(loading)) {\n const dynamicLoading = dynamicData[2]\n loading.resolve(dynamicLoading, debugInfo)\n }\n\n // Check if this is a leaf segment. If so, it will have a `head` property with\n // a pending promise that needs to be resolved with the dynamic head from\n // the server.\n const head = cacheNode.head\n if (isDeferredRsc(head)) {\n head.resolve(dynamicHead, debugInfo)\n }\n}\n\nexport function abortTask(\n task: SPANavigationTask,\n error: any,\n debugInfo: Array<any> | null\n): void {\n const cacheNode = task.node\n if (cacheNode === null) {\n // This indicates the task is already complete.\n return\n }\n\n const taskChildren = task.children\n if (taskChildren === null) {\n // Reached the leaf task node. This is the root of a pending cache\n // node tree.\n abortPendingCacheNode(task.route, cacheNode, error, debugInfo)\n } else {\n // This is an intermediate task node. Keep traversing until we reach a\n // task node with no children. That will be the root of the cache node tree\n // that needs to be resolved.\n for (const taskChild of taskChildren.values()) {\n abortTask(taskChild, error, debugInfo)\n }\n }\n\n // Set this to null to indicate that this task is now complete.\n task.dynamicRequestTree = null\n}\n\nfunction abortPendingCacheNode(\n routerState: FlightRouterState,\n cacheNode: CacheNode,\n error: any,\n debugInfo: Array<any> | null\n): void {\n // For every pending segment in the tree, resolve its `rsc` promise to `null`\n // to trigger a lazy fetch during render.\n //\n // Or, if an error object is provided, it will error instead.\n const routerStateChildren = routerState[1]\n const parallelRoutes = cacheNode.parallelRoutes\n for (let parallelRouteKey in routerStateChildren) {\n const routerStateChild: FlightRouterState =\n routerStateChildren[parallelRouteKey]\n const segmentMapChild = parallelRoutes.get(parallelRouteKey)\n if (segmentMapChild === undefined) {\n // This shouldn't happen because we're traversing the same tree that was\n // used to construct the cache nodes in the first place.\n continue\n }\n const segmentChild = routerStateChild[0]\n const segmentKeyChild = createRouterCacheKey(segmentChild)\n const cacheNodeChild = segmentMapChild.get(segmentKeyChild)\n if (cacheNodeChild !== undefined) {\n abortPendingCacheNode(routerStateChild, cacheNodeChild, error, debugInfo)\n } else {\n // This shouldn't happen because we're traversing the same tree that was\n // used to construct the cache nodes in the first place.\n }\n }\n\n const rsc = cacheNode.rsc\n if (isDeferredRsc(rsc)) {\n if (error === null) {\n // This will trigger a lazy fetch during render.\n rsc.resolve(null, debugInfo)\n } else {\n // This will trigger an error during rendering.\n rsc.reject(error, debugInfo)\n }\n }\n\n const loading = cacheNode.loading\n if (isDeferredRsc(loading)) {\n loading.resolve(null, debugInfo)\n }\n\n // Check if this is a leaf segment. If so, it will have a `head` property with\n // a pending promise that needs to be resolved. If an error was provided, we\n // will not resolve it with an error, since this is rendered at the root of\n // the app. We want the segment to error, not the entire app.\n const head = cacheNode.head\n if (isDeferredRsc(head)) {\n head.resolve(null, debugInfo)\n }\n}\n\nexport function updateCacheNodeOnPopstateRestoration(\n oldCacheNode: CacheNode,\n routerState: FlightRouterState\n): ReadyCacheNode {\n // A popstate navigation reads data from the local cache. It does not issue\n // new network requests (unless the cache entries have been evicted). So, we\n // update the cache to drop the prefetch data for any segment whose dynamic\n // data was already received. This prevents an unnecessary flash back to PPR\n // state during a back/forward navigation.\n //\n // This function clones the entire cache node tree and sets the `prefetchRsc`\n // field to `null` to prevent it from being rendered. We can't mutate the node\n // in place because this is a concurrent data structure.\n\n const routerStateChildren = routerState[1]\n const oldParallelRoutes = oldCacheNode.parallelRoutes\n const newParallelRoutes = new Map(oldParallelRoutes)\n for (let parallelRouteKey in routerStateChildren) {\n const routerStateChild: FlightRouterState =\n routerStateChildren[parallelRouteKey]\n const segmentChild = routerStateChild[0]\n const segmentKeyChild = createRouterCacheKey(segmentChild)\n const oldSegmentMapChild = oldParallelRoutes.get(parallelRouteKey)\n if (oldSegmentMapChild !== undefined) {\n const oldCacheNodeChild = oldSegmentMapChild.get(segmentKeyChild)\n if (oldCacheNodeChild !== undefined) {\n const newCacheNodeChild = updateCacheNodeOnPopstateRestoration(\n oldCacheNodeChild,\n routerStateChild\n )\n const newSegmentMapChild = new Map(oldSegmentMapChild)\n newSegmentMapChild.set(segmentKeyChild, newCacheNodeChild)\n newParallelRoutes.set(parallelRouteKey, newSegmentMapChild)\n }\n }\n }\n\n // Only show prefetched data if the dynamic data is still pending.\n //\n // Tehnically, what we're actually checking is whether the dynamic network\n // response was received. But since it's a streaming response, this does not\n // mean that all the dynamic data has fully streamed in. It just means that\n // _some_ of the dynamic data was received. But as a heuristic, we assume that\n // the rest dynamic data will stream in quickly, so it's still better to skip\n // the prefetch state.\n const rsc = oldCacheNode.rsc\n const shouldUsePrefetch = isDeferredRsc(rsc) && rsc.status === 'pending'\n\n return {\n lazyData: null,\n rsc,\n head: oldCacheNode.head,\n\n prefetchHead: shouldUsePrefetch ? oldCacheNode.prefetchHead : [null, null],\n prefetchRsc: shouldUsePrefetch ? oldCacheNode.prefetchRsc : null,\n loading: oldCacheNode.loading,\n\n // These are the cloned children we computed above\n parallelRoutes: newParallelRoutes,\n\n navigatedAt: oldCacheNode.navigatedAt,\n }\n}\n\nconst DEFERRED = Symbol()\n\ntype PendingDeferredRsc<T> = Promise<T> & {\n status: 'pending'\n resolve: (value: T, debugInfo: Array<any> | null) => void\n reject: (error: any, debugInfo: Array<any> | null) => void\n tag: Symbol\n _debugInfo: Array<any>\n}\n\ntype FulfilledDeferredRsc<T> = Promise<T> & {\n status: 'fulfilled'\n value: T\n resolve: (value: T, debugInfo: Array<any> | null) => void\n reject: (error: any, debugInfo: Array<any> | null) => void\n tag: Symbol\n _debugInfo: Array<any>\n}\n\ntype RejectedDeferredRsc<T> = Promise<T> & {\n status: 'rejected'\n reason: any\n resolve: (value: T, debugInfo: Array<any> | null) => void\n reject: (error: any, debugInfo: Array<any> | null) => void\n tag: Symbol\n _debugInfo: Array<any>\n}\n\ntype DeferredRsc<T extends React.ReactNode = React.ReactNode> =\n | PendingDeferredRsc<T>\n | FulfilledDeferredRsc<T>\n | RejectedDeferredRsc<T>\n\n// This type exists to distinguish a DeferredRsc from a Flight promise. It's a\n// compromise to avoid adding an extra field on every Cache Node, which would be\n// awkward because the pre-PPR parts of codebase would need to account for it,\n// too. We can remove it once type Cache Node type is more settled.\nfunction isDeferredRsc(value: any): value is DeferredRsc {\n return value && typeof value === 'object' && value.tag === DEFERRED\n}\n\nfunction createDeferredRsc<\n T extends React.ReactNode = React.ReactNode,\n>(): PendingDeferredRsc<T> {\n // Create an unresolved promise that represents data derived from a Flight\n // response. The promise will be resolved later as soon as we start receiving\n // data from the server, i.e. as soon as the Flight client decodes and returns\n // the top-level response object.\n\n // The `_debugInfo` field contains profiling information. Promises that are\n // created by Flight already have this info added by React; for any derived\n // promise created by the router, we need to transfer the Flight debug info\n // onto the derived promise.\n //\n // The debug info represents the latency between the start of the navigation\n // and the start of rendering. (It does not represent the time it takes for\n // whole stream to finish.)\n const debugInfo: Array<any> = []\n\n let resolve: any\n let reject: any\n const pendingRsc = new Promise<T>((res, rej) => {\n resolve = res\n reject = rej\n }) as PendingDeferredRsc<T>\n pendingRsc.status = 'pending'\n pendingRsc.resolve = (value: T, responseDebugInfo: Array<any> | null) => {\n if (pendingRsc.status === 'pending') {\n const fulfilledRsc: FulfilledDeferredRsc<T> = pendingRsc as any\n fulfilledRsc.status = 'fulfilled'\n fulfilledRsc.value = value\n if (responseDebugInfo !== null) {\n // Transfer the debug info to the derived promise.\n debugInfo.push.apply(debugInfo, responseDebugInfo)\n }\n resolve(value)\n }\n }\n pendingRsc.reject = (error: any, responseDebugInfo: Array<any> | null) => {\n if (pendingRsc.status === 'pending') {\n const rejectedRsc: RejectedDeferredRsc<T> = pendingRsc as any\n rejectedRsc.status = 'rejected'\n rejectedRsc.reason = error\n if (responseDebugInfo !== null) {\n // Transfer the debug info to the derived promise.\n debugInfo.push.apply(debugInfo, responseDebugInfo)\n }\n reject(error)\n }\n }\n pendingRsc.tag = DEFERRED\n pendingRsc._debugInfo = debugInfo\n\n return pendingRsc\n}\n","import type {\n CacheNodeSeedData,\n FlightRouterState,\n FlightSegmentPath,\n} from '../../../shared/lib/app-router-types'\nimport type { CacheNode } from '../../../shared/lib/app-router-types'\nimport type {\n HeadData,\n LoadingModuleData,\n} from '../../../shared/lib/app-router-types'\nimport type { NormalizedFlightData } from '../../flight-data-helpers'\nimport { fetchServerResponse } from '../router-reducer/fetch-server-response'\nimport {\n startPPRNavigation,\n listenForDynamicRequest,\n type Task as PPRNavigationTask,\n} from '../router-reducer/ppr-navigations'\nimport { createHrefFromUrl } from '../router-reducer/create-href-from-url'\nimport {\n EntryStatus,\n readRouteCacheEntry,\n readSegmentCacheEntry,\n waitForSegmentCacheEntry,\n requestOptimisticRouteCacheEntry,\n type RouteTree,\n type FulfilledRouteCacheEntry,\n} from './cache'\nimport { createCacheKey } from './cache-key'\nimport { addSearchParamsIfPageSegment } from '../../../shared/lib/segment'\nimport { NavigationResultTag } from './types'\n\ntype MPANavigationResult = {\n tag: NavigationResultTag.MPA\n data: string\n}\n\ntype NoOpNavigationResult = {\n tag: NavigationResultTag.NoOp\n data: {\n canonicalUrl: string\n shouldScroll: boolean\n }\n}\n\ntype SuccessfulNavigationResult = {\n tag: NavigationResultTag.Success\n data: {\n flightRouterState: FlightRouterState\n cacheNode: CacheNode\n canonicalUrl: string\n renderedSearch: string\n scrollableSegments: Array<FlightSegmentPath>\n shouldScroll: boolean\n hash: string\n }\n}\n\ntype AsyncNavigationResult = {\n tag: NavigationResultTag.Async\n data: Promise<\n MPANavigationResult | NoOpNavigationResult | SuccessfulNavigationResult\n >\n}\n\nexport type NavigationResult =\n | MPANavigationResult\n | SuccessfulNavigationResult\n | NoOpNavigationResult\n | AsyncNavigationResult\n\n/**\n * Navigate to a new URL, using the Segment Cache to construct a response.\n *\n * To allow for synchronous navigations whenever possible, this is not an async\n * function. It returns a promise only if there's no matching prefetch in\n * the cache. Otherwise it returns an immediate result and uses Suspense/RSC to\n * stream in any missing data.\n */\nexport function navigate(\n url: URL,\n currentUrl: URL,\n currentCacheNode: CacheNode,\n currentFlightRouterState: FlightRouterState,\n nextUrl: string | null,\n shouldScroll: boolean,\n accumulation: { collectedDebugInfo?: Array<unknown> }\n): NavigationResult {\n const now = Date.now()\n const href = url.href\n\n // We special case navigations to the exact same URL as the current location.\n // It's a common UI pattern for apps to refresh when you click a link to the\n // current page. So when this happens, we refresh the dynamic data in the page\n // segments.\n //\n // Note that this does not apply if the any part of the hash or search query\n // has changed. This might feel a bit weird but it makes more sense when you\n // consider that the way to trigger this behavior is to click the same link\n // multiple times.\n //\n // TODO: We should probably refresh the *entire* route when this case occurs,\n // not just the page segments. Essentially treating it the same as a refresh()\n // triggered by an action, which is the more explicit way of modeling the UI\n // pattern described above.\n //\n // Also note that this only refreshes the dynamic data, not static/ cached\n // data. If the page segment is fully static and prefetched, the request is\n // skipped. (This is also how refresh() works.)\n const isSamePageNavigation =\n // TODO: This is not the only place we read from the location, but we should\n // consider storing the current URL in the router state instead of reading\n // from the location object. In practice I don't think this matters much\n // since we keep them in sync anyway, but having two sources of truth can\n // lead to subtle bugs and race conditions.\n href === window.location.href\n\n const cacheKey = createCacheKey(href, nextUrl)\n const route = readRouteCacheEntry(now, cacheKey)\n if (route !== null && route.status === EntryStatus.Fulfilled) {\n // We have a matching prefetch.\n const snapshot = readRenderSnapshotFromCache(now, route, route.tree)\n const prefetchFlightRouterState = snapshot.flightRouterState\n const prefetchSeedData = snapshot.seedData\n const headSnapshot = readHeadSnapshotFromCache(now, route)\n const prefetchHead = headSnapshot.rsc\n const isPrefetchHeadPartial = headSnapshot.isPartial\n // TODO: The \"canonicalUrl\" stored in the cache doesn't include the hash,\n // because hash entries do not vary by hash fragment. However, the one\n // we set in the router state *does* include the hash, and it's used to\n // sync with the actual browser location. To make this less of a refactor\n // hazard, we should always track the hash separately from the rest of\n // the URL.\n const newCanonicalUrl = route.canonicalUrl + url.hash\n const renderedSearch = route.renderedSearch\n return navigateUsingPrefetchedRouteTree(\n now,\n url,\n currentUrl,\n nextUrl,\n isSamePageNavigation,\n currentCacheNode,\n currentFlightRouterState,\n prefetchFlightRouterState,\n prefetchSeedData,\n prefetchHead,\n isPrefetchHeadPartial,\n newCanonicalUrl,\n renderedSearch,\n shouldScroll,\n url.hash\n )\n }\n\n // There was no matching route tree in the cache. Let's see if we can\n // construct an \"optimistic\" route tree.\n //\n // Do not construct an optimistic route tree if there was a cache hit, but\n // the entry has a rejected status, since it may have been rejected due to a\n // rewrite or redirect based on the search params.\n //\n // TODO: There are multiple reasons a prefetch might be rejected; we should\n // track them explicitly and choose what to do here based on that.\n if (route === null || route.status !== EntryStatus.Rejected) {\n const optimisticRoute = requestOptimisticRouteCacheEntry(now, url, nextUrl)\n if (optimisticRoute !== null) {\n // We have an optimistic route tree. Proceed with the normal flow.\n const snapshot = readRenderSnapshotFromCache(\n now,\n optimisticRoute,\n optimisticRoute.tree\n )\n const prefetchFlightRouterState = snapshot.flightRouterState\n const prefetchSeedData = snapshot.seedData\n const headSnapshot = readHeadSnapshotFromCache(now, optimisticRoute)\n const prefetchHead = headSnapshot.rsc\n const isPrefetchHeadPartial = headSnapshot.isPartial\n const newCanonicalUrl = optimisticRoute.canonicalUrl + url.hash\n const newRenderedSearch = optimisticRoute.renderedSearch\n return navigateUsingPrefetchedRouteTree(\n now,\n url,\n currentUrl,\n nextUrl,\n isSamePageNavigation,\n currentCacheNode,\n currentFlightRouterState,\n prefetchFlightRouterState,\n prefetchSeedData,\n prefetchHead,\n isPrefetchHeadPartial,\n newCanonicalUrl,\n newRenderedSearch,\n shouldScroll,\n url.hash\n )\n }\n }\n\n // There's no matching prefetch for this route in the cache.\n let collectedDebugInfo = accumulation.collectedDebugInfo ?? []\n if (accumulation.collectedDebugInfo === undefined) {\n collectedDebugInfo = accumulation.collectedDebugInfo = []\n }\n return {\n tag: NavigationResultTag.Async,\n data: navigateDynamicallyWithNoPrefetch(\n now,\n url,\n currentUrl,\n nextUrl,\n isSamePageNavigation,\n currentCacheNode,\n currentFlightRouterState,\n shouldScroll,\n url.hash,\n collectedDebugInfo\n ),\n }\n}\n\nfunction navigateUsingPrefetchedRouteTree(\n now: number,\n url: URL,\n currentUrl: URL,\n nextUrl: string | null,\n isSamePageNavigation: boolean,\n currentCacheNode: CacheNode,\n currentFlightRouterState: FlightRouterState,\n prefetchFlightRouterState: FlightRouterState,\n prefetchSeedData: CacheNodeSeedData | null,\n prefetchHead: HeadData | null,\n isPrefetchHeadPartial: boolean,\n canonicalUrl: string,\n renderedSearch: string,\n shouldScroll: boolean,\n hash: string\n): SuccessfulNavigationResult | NoOpNavigationResult | MPANavigationResult {\n // Recursively construct a prefetch tree by reading from the Segment Cache. To\n // maintain compatibility, we output the same data structures as the old\n // prefetching implementation: FlightRouterState and CacheNodeSeedData.\n // TODO: Eventually updateCacheNodeOnNavigation (or the equivalent) should\n // read from the Segment Cache directly. It's only structured this way for now\n // so we can share code with the old prefetching implementation.\n const scrollableSegments: Array<FlightSegmentPath> = []\n const task = startPPRNavigation(\n now,\n currentUrl,\n currentCacheNode,\n currentFlightRouterState,\n prefetchFlightRouterState,\n prefetchSeedData,\n prefetchHead,\n isPrefetchHeadPartial,\n isSamePageNavigation,\n scrollableSegments\n )\n if (task !== null) {\n const dynamicRequestTree = task.dynamicRequestTree\n if (dynamicRequestTree !== null) {\n const promiseForDynamicServerResponse = fetchServerResponse(\n new URL(canonicalUrl, url.origin),\n {\n flightRouterState: dynamicRequestTree,\n nextUrl,\n }\n )\n listenForDynamicRequest(task, promiseForDynamicServerResponse)\n } else {\n // The prefetched tree does not contain dynamic holes — it's\n // fully static. We can skip the dynamic request.\n }\n return navigationTaskToResult(\n task,\n currentCacheNode,\n canonicalUrl,\n renderedSearch,\n scrollableSegments,\n shouldScroll,\n hash\n )\n }\n // The server sent back an empty tree patch. There's nothing to update, except\n // possibly the URL.\n return {\n tag: NavigationResultTag.NoOp,\n data: {\n canonicalUrl,\n shouldScroll,\n },\n }\n}\n\nfunction navigationTaskToResult(\n task: PPRNavigationTask,\n currentCacheNode: CacheNode,\n canonicalUrl: string,\n renderedSearch: string,\n scrollableSegments: Array<FlightSegmentPath>,\n shouldScroll: boolean,\n hash: string\n): SuccessfulNavigationResult | MPANavigationResult {\n const flightRouterState = task.route\n if (flightRouterState === null) {\n // When no router state is provided, it signals that we should perform an\n // MPA navigation.\n return {\n tag: NavigationResultTag.MPA,\n data: canonicalUrl,\n }\n }\n const newCacheNode = task.node\n return {\n tag: NavigationResultTag.Success,\n data: {\n flightRouterState,\n cacheNode: newCacheNode !== null ? newCacheNode : currentCacheNode,\n canonicalUrl,\n renderedSearch,\n scrollableSegments,\n shouldScroll,\n hash,\n },\n }\n}\n\nfunction readRenderSnapshotFromCache(\n now: number,\n route: FulfilledRouteCacheEntry,\n tree: RouteTree\n): { flightRouterState: FlightRouterState; seedData: CacheNodeSeedData } {\n let childRouterStates: { [parallelRouteKey: string]: FlightRouterState } = {}\n let childSeedDatas: {\n [parallelRouteKey: string]: CacheNodeSeedData | null\n } = {}\n const slots = tree.slots\n if (slots !== null) {\n for (const parallelRouteKey in slots) {\n const childTree = slots[parallelRouteKey]\n const childResult = readRenderSnapshotFromCache(now, route, childTree)\n childRouterStates[parallelRouteKey] = childResult.flightRouterState\n childSeedDatas[parallelRouteKey] = childResult.seedData\n }\n }\n\n let rsc: React.ReactNode | null = null\n let loading: LoadingModuleData | Promise<LoadingModuleData> = null\n let isPartial: boolean = true\n\n const segmentEntry = readSegmentCacheEntry(now, tree.varyPath)\n if (segmentEntry !== null) {\n switch (segmentEntry.status) {\n case EntryStatus.Fulfilled: {\n // Happy path: a cache hit\n rsc = segmentEntry.rsc\n loading = segmentEntry.loading\n isPartial = segmentEntry.isPartial\n break\n }\n case EntryStatus.Pending: {\n // We haven't received data for this segment yet, but there's already\n // an in-progress request. Since it's extremely likely to arrive\n // before the dynamic data response, we might as well use it.\n const promiseForFulfilledEntry = waitForSegmentCacheEntry(segmentEntry)\n rsc = promiseForFulfilledEntry.then((entry) =>\n entry !== null ? entry.rsc : null\n )\n loading = promiseForFulfilledEntry.then((entry) =>\n entry !== null ? entry.loading : null\n )\n // Since we don't know yet whether the segment is partial or fully\n // static, we must assume it's partial; we can't skip the\n // dynamic request.\n isPartial = true\n break\n }\n case EntryStatus.Empty:\n case EntryStatus.Rejected:\n break\n default:\n segmentEntry satisfies never\n }\n }\n\n // The navigation implementation expects the search params to be\n // included in the segment. However, the Segment Cache tracks search\n // params separately from the rest of the segment key. So we need to\n // add them back here.\n //\n // See corresponding comment in convertFlightRouterStateToTree.\n //\n // TODO: What we should do instead is update the navigation diffing\n // logic to compare search params explicitly. This is a temporary\n // solution until more of the Segment Cache implementation has settled.\n const segment = addSearchParamsIfPageSegment(\n tree.segment,\n Object.fromEntries(new URLSearchParams(route.renderedSearch))\n )\n\n // We don't need this information in a render snapshot, so this can just be a placeholder.\n const hasRuntimePrefetch = false\n\n return {\n flightRouterState: [\n segment,\n childRouterStates,\n null,\n null,\n tree.isRootLayout,\n ],\n seedData: [rsc, childSeedDatas, loading, isPartial, hasRuntimePrefetch],\n }\n}\n\nfunction readHeadSnapshotFromCache(\n now: number,\n route: FulfilledRouteCacheEntry\n): { rsc: HeadData; isPartial: boolean } {\n // Same as readRenderSnapshotFromCache, but for the head\n let rsc: React.ReactNode | null = null\n let isPartial: boolean = true\n const segmentEntry = readSegmentCacheEntry(now, route.metadata.varyPath)\n if (segmentEntry !== null) {\n switch (segmentEntry.status) {\n case EntryStatus.Fulfilled: {\n rsc = segmentEntry.rsc\n isPartial = segmentEntry.isPartial\n break\n }\n case EntryStatus.Pending: {\n const promiseForFulfilledEntry = waitForSegmentCacheEntry(segmentEntry)\n rsc = promiseForFulfilledEntry.then((entry) =>\n entry !== null ? entry.rsc : null\n )\n isPartial = true\n break\n }\n case EntryStatus.Empty:\n case EntryStatus.Rejected:\n break\n default:\n segmentEntry satisfies never\n }\n }\n return { rsc, isPartial }\n}\n\nasync function navigateDynamicallyWithNoPrefetch(\n now: number,\n url: URL,\n currentUrl: URL,\n nextUrl: string | null,\n isSamePageNavigation: boolean,\n currentCacheNode: CacheNode,\n currentFlightRouterState: FlightRouterState,\n shouldScroll: boolean,\n hash: string,\n collectedDebugInfo: Array<unknown>\n): Promise<\n MPANavigationResult | SuccessfulNavigationResult | NoOpNavigationResult\n> {\n // Runs when a navigation happens but there's no cached prefetch we can use.\n // Don't bother to wait for a prefetch response; go straight to a full\n // navigation that contains both static and dynamic data in a single stream.\n // (This is unlike the old navigation implementation, which instead blocks\n // the dynamic request until a prefetch request is received.)\n //\n // To avoid duplication of logic, we're going to pretend that the tree\n // returned by the dynamic request is, in fact, a prefetch tree. Then we can\n // use the same server response to write the actual data into the CacheNode\n // tree. So it's the same flow as the \"happy path\" (prefetch, then\n // navigation), except we use a single server response for both stages.\n\n const promiseForDynamicServerResponse = fetchServerResponse(url, {\n flightRouterState: currentFlightRouterState,\n nextUrl,\n })\n const result = await promiseForDynamicServerResponse\n if (typeof result === 'string') {\n // This is an MPA navigation.\n const newUrl = result\n return {\n tag: NavigationResultTag.MPA,\n data: newUrl,\n }\n }\n\n const {\n flightData,\n canonicalUrl,\n renderedSearch,\n debugInfo: debugInfoFromResponse,\n } = result\n if (debugInfoFromResponse !== null) {\n collectedDebugInfo.push(...debugInfoFromResponse)\n }\n\n // Since the response format of dynamic requests and prefetches is slightly\n // different, we'll need to massage the data a bit. Create FlightRouterState\n // tree that simulates what we'd receive as the result of a prefetch.\n const prefetchFlightRouterState = simulatePrefetchTreeUsingDynamicTreePatch(\n currentFlightRouterState,\n flightData\n )\n\n // In our simulated prefetch payload, we pretend that there's no seed data\n // nor a prefetch head.\n const prefetchSeedData = null\n const prefetchHead = null\n const isPrefetchHeadPartial = true\n\n // Now we proceed exactly as we would for normal navigation.\n const scrollableSegments: Array<FlightSegmentPath> = []\n const task = startPPRNavigation(\n now,\n currentUrl,\n currentCacheNode,\n currentFlightRouterState,\n prefetchFlightRouterState,\n prefetchSeedData,\n prefetchHead,\n isPrefetchHeadPartial,\n isSamePageNavigation,\n scrollableSegments\n )\n if (task !== null) {\n // In this case, we've already sent the dynamic request, so we don't\n // actually use the request tree created by `startPPRNavigation`,\n // except to check if it contains dynamic holes.\n //\n // This is almost always true, but it could be false if all the segment data\n // was present in the cache, but the route tree was not. E.g. navigating\n // to a URL that was not prefetched but rewrites to a different URL\n // that was.\n const hasDynamicHoles = task.dynamicRequestTree !== null\n if (hasDynamicHoles) {\n listenForDynamicRequest(task, promiseForDynamicServerResponse)\n } else {\n // The prefetched tree does not contain dynamic holes — it's\n // fully static. We don't need to process the server response further.\n }\n return navigationTaskToResult(\n task,\n currentCacheNode,\n createHrefFromUrl(canonicalUrl),\n renderedSearch,\n scrollableSegments,\n shouldScroll,\n hash\n )\n }\n // The server sent back an empty tree patch. There's nothing to update, except\n // possibly the URL.\n return {\n tag: NavigationResultTag.NoOp,\n data: {\n canonicalUrl: createHrefFromUrl(canonicalUrl),\n shouldScroll,\n },\n }\n}\n\nfunction simulatePrefetchTreeUsingDynamicTreePatch(\n currentTree: FlightRouterState,\n flightData: Array<NormalizedFlightData>\n): FlightRouterState {\n // Takes the current FlightRouterState and applies the router state patch\n // received from the server, to create a full FlightRouterState tree that we\n // can pretend was returned by a prefetch.\n //\n // (It sounds similar to what applyRouterStatePatch does, but it doesn't need\n // to handle stuff like interception routes or diffing since that will be\n // handled later.)\n let baseTree = currentTree\n for (const { segmentPath, tree: treePatch } of flightData) {\n // If the server sends us multiple tree patches, we only need to clone the\n // base tree when applying the first patch. After the first patch, we can\n // apply the remaining patches in place without copying.\n const canMutateInPlace = baseTree !== currentTree\n baseTree = simulatePrefetchTreeUsingDynamicTreePatchImpl(\n baseTree,\n treePatch,\n segmentPath,\n canMutateInPlace,\n 0\n )\n }\n\n return baseTree\n}\n\nfunction simulatePrefetchTreeUsingDynamicTreePatchImpl(\n baseRouterState: FlightRouterState,\n patch: FlightRouterState,\n segmentPath: FlightSegmentPath,\n canMutateInPlace: boolean,\n index: number\n) {\n if (index === segmentPath.length) {\n // We reached the part of the tree that we need to patch.\n return patch\n }\n\n // segmentPath represents the parent path of subtree. It's a repeating\n // pattern of parallel route key and segment:\n //\n // [string, Segment, string, Segment, string, Segment, ...]\n //\n // This path tells us which part of the base tree to apply the tree patch.\n //\n // NOTE: In the case of a fully dynamic request with no prefetch, we receive\n // the FlightRouterState patch in the same request as the dynamic data.\n // Therefore we don't need to worry about diffing the segment values; we can\n // assume the server sent us a correct result.\n const updatedParallelRouteKey: string = segmentPath[index]\n // const segment: Segment = segmentPath[index + 1] <-- Not used, see note above\n\n const baseChildren = baseRouterState[1]\n const newChildren: { [parallelRouteKey: string]: FlightRouterState } = {}\n for (const parallelRouteKey in baseChildren) {\n if (parallelRouteKey === updatedParallelRouteKey) {\n const childBaseRouterState = baseChildren[parallelRouteKey]\n newChildren[parallelRouteKey] =\n simulatePrefetchTreeUsingDynamicTreePatchImpl(\n childBaseRouterState,\n patch,\n segmentPath,\n canMutateInPlace,\n // Advance the index by two and keep cloning until we reach\n // the end of the segment path.\n index + 2\n )\n } else {\n // This child is not being patched. Copy it over as-is.\n newChildren[parallelRouteKey] = baseChildren[parallelRouteKey]\n }\n }\n\n if (canMutateInPlace) {\n // We can mutate the base tree in place, because the base tree is already\n // a clone.\n baseRouterState[1] = newChildren\n return baseRouterState\n }\n\n // Clone all the fields except the children.\n //\n // Based on equivalent logic in apply-router-state-patch-to-tree, but should\n // confirm whether we need to copy all of these fields. Not sure the server\n // ever sends, e.g. the refetch marker.\n const clone: FlightRouterState = [baseRouterState[0], newChildren]\n if (2 in baseRouterState) {\n clone[2] = baseRouterState[2]\n }\n if (3 in baseRouterState) {\n clone[3] = baseRouterState[3]\n }\n if (4 in baseRouterState) {\n clone[4] = baseRouterState[4]\n }\n return clone\n}\n","import type {\n FlightRouterState,\n FlightSegmentPath,\n} from '../../../../shared/lib/app-router-types'\nimport { createHrefFromUrl } from '../create-href-from-url'\nimport type {\n Mutable,\n NavigateAction,\n ReadonlyReducerState,\n ReducerState,\n} from '../router-reducer-types'\nimport { handleMutable } from '../handle-mutable'\n\nimport {\n navigate as navigateUsingSegmentCache,\n type NavigationResult,\n} from '../../segment-cache/navigation'\nimport { NavigationResultTag } from '../../segment-cache/types'\nimport { getStaleTimeMs } from '../../segment-cache/cache'\n\n// These values are set by `define-env-plugin` (based on `nextConfig.experimental.staleTimes`)\n// and default to 5 minutes (static) / 0 seconds (dynamic)\nexport const DYNAMIC_STALETIME_MS =\n Number(process.env.__NEXT_CLIENT_ROUTER_DYNAMIC_STALETIME) * 1000\n\nexport const STATIC_STALETIME_MS = getStaleTimeMs(\n Number(process.env.__NEXT_CLIENT_ROUTER_STATIC_STALETIME)\n)\n\nexport function handleExternalUrl(\n state: ReadonlyReducerState,\n mutable: Mutable,\n url: string,\n pendingPush: boolean\n) {\n mutable.mpaNavigation = true\n mutable.canonicalUrl = url\n mutable.pendingPush = pendingPush\n mutable.scrollableSegments = undefined\n\n return handleMutable(state, mutable)\n}\n\nexport function generateSegmentsFromPatch(\n flightRouterPatch: FlightRouterState\n): FlightSegmentPath[] {\n const segments: FlightSegmentPath[] = []\n const [segment, parallelRoutes] = flightRouterPatch\n\n if (Object.keys(parallelRoutes).length === 0) {\n return [[segment]]\n }\n\n for (const [parallelRouteKey, parallelRoute] of Object.entries(\n parallelRoutes\n )) {\n for (const childSegment of generateSegmentsFromPatch(parallelRoute)) {\n // If the segment is empty, it means we are at the root of the tree\n if (segment === '') {\n segments.push([parallelRouteKey, ...childSegment])\n } else {\n segments.push([segment, parallelRouteKey, ...childSegment])\n }\n }\n }\n\n return segments\n}\n\nfunction handleNavigationResult(\n url: URL,\n state: ReadonlyReducerState,\n mutable: Mutable,\n pendingPush: boolean,\n result: NavigationResult\n): ReducerState {\n switch (result.tag) {\n case NavigationResultTag.MPA: {\n // Perform an MPA navigation.\n const newUrl = result.data\n return handleExternalUrl(state, mutable, newUrl, pendingPush)\n }\n case NavigationResultTag.NoOp: {\n // The server responded with no change to the current page. However, if\n // the URL changed, we still need to update that.\n const newCanonicalUrl = result.data.canonicalUrl\n mutable.canonicalUrl = newCanonicalUrl\n\n // Check if the only thing that changed was the hash fragment.\n const oldUrl = new URL(state.canonicalUrl, url)\n const onlyHashChange =\n // We don't need to compare the origins, because client-driven\n // navigations are always same-origin.\n url.pathname === oldUrl.pathname &&\n url.search === oldUrl.search &&\n url.hash !== oldUrl.hash\n if (onlyHashChange) {\n // The only updated part of the URL is the hash.\n mutable.onlyHashChange = true\n mutable.shouldScroll = result.data.shouldScroll\n mutable.hashFragment = url.hash\n // Setting this to an empty array triggers a scroll for all new and\n // updated segments. See `ScrollAndFocusHandler` for more details.\n mutable.scrollableSegments = []\n }\n\n return handleMutable(state, mutable)\n }\n case NavigationResultTag.Success: {\n // Received a new result.\n mutable.cache = result.data.cacheNode\n mutable.patchedTree = result.data.flightRouterState\n mutable.renderedSearch = result.data.renderedSearch\n mutable.canonicalUrl = result.data.canonicalUrl\n mutable.scrollableSegments = result.data.scrollableSegments\n mutable.shouldScroll = result.data.shouldScroll\n mutable.hashFragment = result.data.hash\n return handleMutable(state, mutable)\n }\n case NavigationResultTag.Async: {\n return result.data.then(\n (asyncResult) =>\n handleNavigationResult(url, state, mutable, pendingPush, asyncResult),\n // If the navigation failed, return the current state.\n // TODO: This matches the current behavior but we need to do something\n // better here if the network fails.\n () => {\n return state\n }\n )\n }\n default: {\n result satisfies never\n return state\n }\n }\n}\n\nexport function navigateReducer(\n state: ReadonlyReducerState,\n action: NavigateAction\n): ReducerState {\n const { url, isExternalUrl, navigateType, shouldScroll } = action\n const mutable: Mutable = {}\n const href = createHrefFromUrl(url)\n const pendingPush = navigateType === 'push'\n\n mutable.preserveCustomHistoryState = false\n mutable.pendingPush = pendingPush\n\n if (isExternalUrl) {\n return handleExternalUrl(state, mutable, url.toString(), pendingPush)\n }\n\n // Handles case where `<meta http-equiv=\"refresh\">` tag is present,\n // which will trigger an MPA navigation.\n if (document.getElementById('__next-page-redirect')) {\n return handleExternalUrl(state, mutable, href, pendingPush)\n }\n\n // Temporary glue code between the router reducer and the new navigation\n // implementation. Eventually we'll rewrite the router reducer to a\n // state machine.\n const currentUrl = new URL(state.canonicalUrl, location.origin)\n const result = navigateUsingSegmentCache(\n url,\n currentUrl,\n state.cache,\n state.tree,\n state.nextUrl,\n shouldScroll,\n mutable\n )\n return handleNavigationResult(url, state, mutable, pendingPush, result)\n}\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\n// Request the first 64 bytes. The Range header is inclusive of the end value.\nexport const DOC_PREFETCH_RANGE_HEADER_VALUE = 'bytes=0-63'\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\nexport function doesExportedHtmlMatchBuildId(\n partialHtmlDocument: string,\n buildId: string\n) {\n // Check whether the document starts with the expected buildId.\n return partialHtmlDocument.startsWith(\n DOCTYPE_PREFIX + '<!--' + escapeBuildId(buildId) + '-->'\n )\n}\n","export function createPromiseWithResolvers<T>(): PromiseWithResolvers<T> {\n // Shim of Stage 4 Promise.withResolvers proposal\n let resolve: (value: T | PromiseLike<T>) => void\n let reject: (reason: any) => void\n const promise = new Promise<T>((res, rej) => {\n resolve = res\n reject = rej\n })\n return { resolve: resolve!, reject: reject!, promise }\n}\n","import type {\n TreePrefetch,\n RootTreePrefetch,\n SegmentPrefetch,\n} from '../../../server/app-render/collect-segment-data'\nimport type { LoadingModuleData } from '../../../shared/lib/app-router-types'\nimport type {\n CacheNodeSeedData,\n Segment as FlightRouterStateSegment,\n} from '../../../shared/lib/app-router-types'\nimport { HasLoadingBoundary } from '../../../shared/lib/app-router-types'\nimport {\n NEXT_DID_POSTPONE_HEADER,\n NEXT_ROUTER_PREFETCH_HEADER,\n NEXT_ROUTER_SEGMENT_PREFETCH_HEADER,\n NEXT_ROUTER_STALE_TIME_HEADER,\n NEXT_ROUTER_STATE_TREE_HEADER,\n NEXT_URL,\n RSC_CONTENT_TYPE_HEADER,\n RSC_HEADER,\n} from '../app-router-headers'\nimport {\n createFetch,\n createFromNextReadableStream,\n type RSCResponse,\n type RequestHeaders,\n} from '../router-reducer/fetch-server-response'\nimport {\n pingPrefetchTask,\n isPrefetchTaskDirty,\n type PrefetchTask,\n type PrefetchSubtaskResult,\n startRevalidationCooldown,\n} from './scheduler'\nimport {\n type RouteVaryPath,\n type SegmentVaryPath,\n type PartialSegmentVaryPath,\n getRouteVaryPath,\n getFulfilledRouteVaryPath,\n getSegmentVaryPathForRequest,\n appendLayoutVaryPath,\n finalizeLayoutVaryPath,\n finalizePageVaryPath,\n clonePageVaryPathWithNewSearchParams,\n type PageVaryPath,\n finalizeMetadataVaryPath,\n} from './vary-path'\nimport { getAppBuildId } from '../../app-build-id'\nimport { createHrefFromUrl } from '../router-reducer/create-href-from-url'\nimport type { NormalizedSearch, RouteCacheKey } from './cache-key'\n// TODO: Rename this module to avoid confusion with other types of cache keys\nimport { createCacheKey as createPrefetchRequestKey } from './cache-key'\nimport {\n doesStaticSegmentAppearInURL,\n getCacheKeyForDynamicParam,\n getRenderedPathname,\n getRenderedSearch,\n parseDynamicParamFromURLPart,\n} from '../../route-params'\nimport {\n createCacheMap,\n getFromCacheMap,\n setInCacheMap,\n setSizeInCacheMap,\n deleteFromCacheMap,\n isValueExpired,\n type CacheMap,\n type MapEntry,\n} from './cache-map'\nimport {\n appendSegmentRequestKeyPart,\n convertSegmentPathToStaticExportFilename,\n createSegmentRequestKeyPart,\n HEAD_REQUEST_KEY,\n ROOT_SEGMENT_REQUEST_KEY,\n type SegmentRequestKey,\n} from '../../../shared/lib/segment-cache/segment-value-encoding'\nimport type {\n FlightRouterState,\n NavigationFlightResponse,\n} from '../../../shared/lib/app-router-types'\nimport {\n normalizeFlightData,\n prepareFlightRouterStateForRequest,\n} from '../../flight-data-helpers'\nimport { STATIC_STALETIME_MS } from '../router-reducer/reducers/navigate-reducer'\nimport { pingVisibleLinks } from '../links'\nimport { PAGE_SEGMENT_KEY } from '../../../shared/lib/segment'\nimport {\n DOC_PREFETCH_RANGE_HEADER_VALUE,\n doesExportedHtmlMatchBuildId,\n} from '../../../shared/lib/segment-cache/output-export-prefetch-encoding'\nimport { FetchStrategy } from './types'\nimport { createPromiseWithResolvers } from '../../../shared/lib/promise-with-resolvers'\n\n/**\n * Ensures a minimum stale time of 30s to avoid issues where the server sends a too\n * short-lived stale time, which would prevent anything from being prefetched.\n */\nexport function getStaleTimeMs(staleTimeSeconds: number): number {\n return Math.max(staleTimeSeconds, 30) * 1000\n}\n\n// A note on async/await when working in the prefetch cache:\n//\n// Most async operations in the prefetch cache should *not* use async/await,\n// Instead, spawn a subtask that writes the results to a cache entry, and attach\n// a \"ping\" listener to notify the prefetch queue to try again.\n//\n// The reason is we need to be able to access the segment cache and traverse its\n// data structures synchronously. For example, if there's a synchronous update\n// we can take an immediate snapshot of the cache to produce something we can\n// render. Limiting the use of async/await also makes it easier to avoid race\n// conditions, which is especially important because is cache is mutable.\n//\n// Another reason is that while we're performing async work, it's possible for\n// existing entries to become stale, or for Link prefetches to be removed from\n// the queue. For optimal scheduling, we need to be able to \"cancel\" subtasks\n// that are no longer needed. So, when a segment is received from the server, we\n// restart from the root of the tree that's being prefetched, to confirm all the\n// parent segments are still cached. If the segment is no longer reachable from\n// the root, then it's effectively canceled. This is similar to the design of\n// Rust Futures, or React Suspense.\n\ntype RouteTreeShared = {\n requestKey: SegmentRequestKey\n // TODO: Remove the `segment` field, now that it can be reconstructed\n // from `param`.\n segment: FlightRouterStateSegment\n slots: null | {\n [parallelRouteKey: string]: RouteTree\n }\n isRootLayout: boolean\n\n // If this is a dynamic route, indicates whether there is a loading boundary\n // somewhere in the tree. If not, we can skip the prefetch for the data,\n // because we know it would be an empty response. (For a static/PPR route,\n // this value is disregarded, because in that model `loading.tsx` is treated\n // like any other Suspense boundary.)\n hasLoadingBoundary: HasLoadingBoundary\n\n // Indicates whether this route has a runtime prefetch that we can request.\n // This is determined by the server; it's not purely a user configuration\n // because the server may determine that a route is fully static and doesn't\n // need runtime prefetching regardless of the configuration.\n hasRuntimePrefetch: boolean\n}\n\ntype LayoutRouteTree = RouteTreeShared & {\n isPage: false\n varyPath: SegmentVaryPath\n}\n\ntype PageRouteTree = RouteTreeShared & {\n isPage: true\n varyPath: PageVaryPath\n}\n\nexport type RouteTree = LayoutRouteTree | PageRouteTree\n\ntype RouteCacheEntryShared = {\n // This is false only if we're certain the route cannot be intercepted. It's\n // true in all other cases, including on initialization when we haven't yet\n // received a response from the server.\n couldBeIntercepted: boolean\n\n // Map-related fields.\n ref: null | MapEntry<RouteCacheEntry>\n size: number\n staleAt: number\n version: number\n}\n\n/**\n * Tracks the status of a cache entry as it progresses from no data (Empty),\n * waiting for server data (Pending), and finished (either Fulfilled or\n * Rejected depending on the response from the server.\n */\nexport const enum EntryStatus {\n Empty = 0,\n Pending = 1,\n Fulfilled = 2,\n Rejected = 3,\n}\n\ntype PendingRouteCacheEntry = RouteCacheEntryShared & {\n status: EntryStatus.Empty | EntryStatus.Pending\n blockedTasks: Set<PrefetchTask> | null\n canonicalUrl: null\n renderedSearch: null\n tree: null\n metadata: null\n isPPREnabled: false\n}\n\ntype RejectedRouteCacheEntry = RouteCacheEntryShared & {\n status: EntryStatus.Rejected\n blockedTasks: Set<PrefetchTask> | null\n canonicalUrl: null\n renderedSearch: null\n tree: null\n metadata: null\n isPPREnabled: boolean\n}\n\nexport type FulfilledRouteCacheEntry = RouteCacheEntryShared & {\n status: EntryStatus.Fulfilled\n blockedTasks: null\n canonicalUrl: string\n renderedSearch: NormalizedSearch\n tree: RouteTree\n metadata: RouteTree\n isPPREnabled: boolean\n}\n\nexport type RouteCacheEntry =\n | PendingRouteCacheEntry\n | FulfilledRouteCacheEntry\n | RejectedRouteCacheEntry\n\ntype SegmentCacheEntryShared = {\n fetchStrategy: FetchStrategy\n\n // Map-related fields.\n ref: null | MapEntry<SegmentCacheEntry>\n size: number\n staleAt: number\n version: number\n}\n\nexport type EmptySegmentCacheEntry = SegmentCacheEntryShared & {\n status: EntryStatus.Empty\n rsc: null\n loading: null\n isPartial: true\n promise: null\n}\n\nexport type PendingSegmentCacheEntry = SegmentCacheEntryShared & {\n status: EntryStatus.Pending\n rsc: null\n loading: null\n isPartial: true\n promise: null | PromiseWithResolvers<FulfilledSegmentCacheEntry | null>\n}\n\ntype RejectedSegmentCacheEntry = SegmentCacheEntryShared & {\n status: EntryStatus.Rejected\n rsc: null\n loading: null\n isPartial: true\n promise: null\n}\n\nexport type FulfilledSegmentCacheEntry = SegmentCacheEntryShared & {\n status: EntryStatus.Fulfilled\n rsc: React.ReactNode | null\n loading: LoadingModuleData | Promise<LoadingModuleData>\n isPartial: boolean\n promise: null\n}\n\nexport type SegmentCacheEntry =\n | EmptySegmentCacheEntry\n | PendingSegmentCacheEntry\n | RejectedSegmentCacheEntry\n | FulfilledSegmentCacheEntry\n\nexport type NonEmptySegmentCacheEntry = Exclude<\n SegmentCacheEntry,\n EmptySegmentCacheEntry\n>\n\nconst isOutputExportMode =\n process.env.NODE_ENV === 'production' &&\n process.env.__NEXT_CONFIG_OUTPUT === 'export'\n\nconst MetadataOnlyRequestTree: FlightRouterState = [\n '',\n {},\n null,\n 'metadata-only',\n]\n\nlet routeCacheMap: CacheMap<RouteCacheEntry> = createCacheMap()\nlet segmentCacheMap: CacheMap<SegmentCacheEntry> = createCacheMap()\n\n// All invalidation listeners for the whole cache are tracked in single set.\n// Since we don't yet support tag or path-based invalidation, there's no point\n// tracking them any more granularly than this. Once we add granular\n// invalidation, that may change, though generally the model is to just notify\n// the listeners and allow the caller to poll the prefetch cache with a new\n// prefetch task if desired.\nlet invalidationListeners: Set<PrefetchTask> | null = null\n\n// Incrementing counter used to track cache invalidations.\nlet currentCacheVersion = 0\n\nexport function getCurrentCacheVersion(): number {\n return currentCacheVersion\n}\n\n/**\n * Used to clear the client prefetch cache when a server action calls\n * revalidatePath or revalidateTag. Eventually we will support only clearing the\n * segments that were actually affected, but there's more work to be done on the\n * server before the client is able to do this correctly.\n */\nexport function revalidateEntireCache(\n nextUrl: string | null,\n tree: FlightRouterState\n) {\n // Increment the current cache version. This does not eagerly evict anything\n // from the cache, but because all the entries are versioned, and we check\n // the version when reading from the cache, this effectively causes all\n // entries to be evicted lazily. We do it lazily because in the future,\n // actions like revalidateTag or refresh will not evict the entire cache,\n // but rather some subset of the entries.\n currentCacheVersion++\n\n // Start a cooldown before re-prefetching to allow CDN cache propagation.\n startRevalidationCooldown()\n\n // Prefetch all the currently visible links again, to re-fill the cache.\n pingVisibleLinks(nextUrl, tree)\n\n // Similarly, notify all invalidation listeners (i.e. those passed to\n // `router.prefetch(onInvalidate)`), so they can trigger a new prefetch\n // if needed.\n pingInvalidationListeners(nextUrl, tree)\n}\n\nfunction attachInvalidationListener(task: PrefetchTask): void {\n // This function is called whenever a prefetch task reads a cache entry. If\n // the task has an onInvalidate function associated with it — i.e. the one\n // optionally passed to router.prefetch(onInvalidate) — then we attach that\n // listener to the every cache entry that the task reads. Then, if an entry\n // is invalidated, we call the function.\n if (task.onInvalidate !== null) {\n if (invalidationListeners === null) {\n invalidationListeners = new Set([task])\n } else {\n invalidationListeners.add(task)\n }\n }\n}\n\nfunction notifyInvalidationListener(task: PrefetchTask): void {\n const onInvalidate = task.onInvalidate\n if (onInvalidate !== null) {\n // Clear the callback from the task object to guarantee it's not called more\n // than once.\n task.onInvalidate = null\n\n // This is a user-space function, so we must wrap in try/catch.\n try {\n onInvalidate()\n } catch (error) {\n if (typeof reportError === 'function') {\n reportError(error)\n } else {\n console.error(error)\n }\n }\n }\n}\n\nexport function pingInvalidationListeners(\n nextUrl: string | null,\n tree: FlightRouterState\n): void {\n // The rough equivalent of pingVisibleLinks, but for onInvalidate callbacks.\n // This is called when the Next-Url or the base tree changes, since those\n // may affect the result of a prefetch task. It's also called after a\n // cache invalidation.\n if (invalidationListeners !== null) {\n const tasks = invalidationListeners\n invalidationListeners = null\n for (const task of tasks) {\n if (isPrefetchTaskDirty(task, nextUrl, tree)) {\n notifyInvalidationListener(task)\n }\n }\n }\n}\n\nexport function readRouteCacheEntry(\n now: number,\n key: RouteCacheKey\n): RouteCacheEntry | null {\n const varyPath: RouteVaryPath = getRouteVaryPath(\n key.pathname,\n key.search,\n key.nextUrl\n )\n const isRevalidation = false\n return getFromCacheMap(\n now,\n getCurrentCacheVersion(),\n routeCacheMap,\n varyPath,\n isRevalidation\n )\n}\n\nexport function readSegmentCacheEntry(\n now: number,\n varyPath: SegmentVaryPath\n): SegmentCacheEntry | null {\n const isRevalidation = false\n return getFromCacheMap(\n now,\n getCurrentCacheVersion(),\n segmentCacheMap,\n varyPath,\n isRevalidation\n )\n}\n\nfunction readRevalidatingSegmentCacheEntry(\n now: number,\n varyPath: SegmentVaryPath\n): SegmentCacheEntry | null {\n const isRevalidation = true\n return getFromCacheMap(\n now,\n getCurrentCacheVersion(),\n segmentCacheMap,\n varyPath,\n isRevalidation\n )\n}\n\nexport function waitForSegmentCacheEntry(\n pendingEntry: PendingSegmentCacheEntry\n): Promise<FulfilledSegmentCacheEntry | null> {\n // Because the entry is pending, there's already a in-progress request.\n // Attach a promise to the entry that will resolve when the server responds.\n let promiseWithResolvers = pendingEntry.promise\n if (promiseWithResolvers === null) {\n promiseWithResolvers = pendingEntry.promise =\n createPromiseWithResolvers<FulfilledSegmentCacheEntry | null>()\n } else {\n // There's already a promise we can use\n }\n return promiseWithResolvers.promise\n}\n\n/**\n * Checks if an entry for a route exists in the cache. If so, it returns the\n * entry, If not, it adds an empty entry to the cache and returns it.\n */\nexport function readOrCreateRouteCacheEntry(\n now: number,\n task: PrefetchTask,\n key: RouteCacheKey\n): RouteCacheEntry {\n attachInvalidationListener(task)\n\n const existingEntry = readRouteCacheEntry(now, key)\n if (existingEntry !== null) {\n return existingEntry\n }\n // Create a pending entry and add it to the cache.\n const pendingEntry: PendingRouteCacheEntry = {\n canonicalUrl: null,\n status: EntryStatus.Empty,\n blockedTasks: null,\n tree: null,\n metadata: null,\n // This is initialized to true because we don't know yet whether the route\n // could be intercepted. It's only set to false once we receive a response\n // from the server.\n couldBeIntercepted: true,\n // Similarly, we don't yet know if the route supports PPR.\n isPPREnabled: false,\n renderedSearch: null,\n\n // Map-related fields\n ref: null,\n size: 0,\n // Since this is an empty entry, there's no reason to ever evict it. It will\n // be updated when the data is populated.\n staleAt: Infinity,\n version: getCurrentCacheVersion(),\n }\n const varyPath: RouteVaryPath = getRouteVaryPath(\n key.pathname,\n key.search,\n key.nextUrl\n )\n const isRevalidation = false\n setInCacheMap(routeCacheMap, varyPath, pendingEntry, isRevalidation)\n return pendingEntry\n}\n\nexport function requestOptimisticRouteCacheEntry(\n now: number,\n requestedUrl: URL,\n nextUrl: string | null\n): FulfilledRouteCacheEntry | null {\n // This function is called during a navigation when there was no matching\n // route tree in the prefetch cache. Before de-opting to a blocking,\n // unprefetched navigation, we will first attempt to construct an \"optimistic\"\n // route tree by checking the cache for similar routes.\n //\n // Check if there's a route with the same pathname, but with different\n // search params. We can then base our optimistic route tree on this entry.\n //\n // Conceptually, we are simulating what would happen if we did perform a\n // prefetch the requested URL, under the assumption that the server will\n // not redirect or rewrite the request in a different manner than the\n // base route tree. This assumption might not hold, in which case we'll have\n // to recover when we perform the dynamic navigation request. However, this\n // is what would happen if a route were dynamically rewritten/redirected\n // in between the prefetch and the navigation. So the logic needs to exist\n // to handle this case regardless.\n\n // Look for a route with the same pathname, but with an empty search string.\n // TODO: There's nothing inherently special about the empty search string;\n // it's chosen somewhat arbitrarily, with the rationale that it's the most\n // likely one to exist. But we should update this to match _any_ search\n // string. The plan is to generalize this logic alongside other improvements\n // related to \"fallback\" cache entries.\n const requestedSearch = requestedUrl.search as NormalizedSearch\n if (requestedSearch === '') {\n // The caller would have already checked if a route with an empty search\n // string is in the cache. So we can bail out here.\n return null\n }\n const urlWithoutSearchParams = new URL(requestedUrl)\n urlWithoutSearchParams.search = ''\n const routeWithNoSearchParams = readRouteCacheEntry(\n now,\n createPrefetchRequestKey(urlWithoutSearchParams.href, nextUrl)\n )\n\n if (\n routeWithNoSearchParams === null ||\n routeWithNoSearchParams.status !== EntryStatus.Fulfilled\n ) {\n // Bail out of constructing an optimistic route tree. This will result in\n // a blocking, unprefetched navigation.\n return null\n }\n\n // Now we have a base route tree we can \"patch\" with our optimistic values.\n\n // Optimistically assume that redirects for the requested pathname do\n // not vary on the search string. Therefore, if the base route was\n // redirected to a different search string, then the optimistic route\n // should be redirected to the same search string. Otherwise, we use\n // the requested search string.\n const canonicalUrlForRouteWithNoSearchParams = new URL(\n routeWithNoSearchParams.canonicalUrl,\n requestedUrl.origin\n )\n const optimisticCanonicalSearch =\n canonicalUrlForRouteWithNoSearchParams.search !== ''\n ? // Base route was redirected. Reuse the same redirected search string.\n canonicalUrlForRouteWithNoSearchParams.search\n : requestedSearch\n\n // Similarly, optimistically assume that rewrites for the requested\n // pathname do not vary on the search string. Therefore, if the base\n // route was rewritten to a different search string, then the optimistic\n // route should be rewritten to the same search string. Otherwise, we use\n // the requested search string.\n const optimisticRenderedSearch =\n routeWithNoSearchParams.renderedSearch !== ''\n ? // Base route was rewritten. Reuse the same rewritten search string.\n routeWithNoSearchParams.renderedSearch\n : requestedSearch\n\n const optimisticUrl = new URL(\n routeWithNoSearchParams.canonicalUrl,\n location.origin\n )\n optimisticUrl.search = optimisticCanonicalSearch\n const optimisticCanonicalUrl = createHrefFromUrl(optimisticUrl)\n\n const optimisticRouteTree = createOptimisticRouteTree(\n routeWithNoSearchParams.tree,\n optimisticRenderedSearch\n )\n const optimisticMetadataTree = createOptimisticRouteTree(\n routeWithNoSearchParams.metadata,\n optimisticRenderedSearch\n )\n\n // Clone the base route tree, and override the relevant fields with our\n // optimistic values.\n const optimisticEntry: FulfilledRouteCacheEntry = {\n canonicalUrl: optimisticCanonicalUrl,\n\n status: EntryStatus.Fulfilled,\n // This isn't cloned because it's instance-specific\n blockedTasks: null,\n tree: optimisticRouteTree,\n metadata: optimisticMetadataTree,\n couldBeIntercepted: routeWithNoSearchParams.couldBeIntercepted,\n isPPREnabled: routeWithNoSearchParams.isPPREnabled,\n\n // Override the rendered search with the optimistic value.\n renderedSearch: optimisticRenderedSearch,\n\n // Map-related fields\n ref: null,\n size: 0,\n staleAt: routeWithNoSearchParams.staleAt,\n version: routeWithNoSearchParams.version,\n }\n\n // Do not insert this entry into the cache. It only exists so we can\n // perform the current navigation. Just return it to the caller.\n return optimisticEntry\n}\n\nfunction createOptimisticRouteTree(\n tree: RouteTree,\n newRenderedSearch: NormalizedSearch\n): RouteTree {\n // Create a new route tree that identical to the original one except for\n // the rendered search string, which is contained in the vary path.\n\n let clonedSlots: Record<string, RouteTree> | null = null\n const originalSlots = tree.slots\n if (originalSlots !== null) {\n clonedSlots = {}\n for (const parallelRouteKey in originalSlots) {\n const childTree = originalSlots[parallelRouteKey]\n clonedSlots[parallelRouteKey] = createOptimisticRouteTree(\n childTree,\n newRenderedSearch\n )\n }\n }\n\n // We only need to clone the vary path if the route is a page.\n if (tree.isPage) {\n return {\n requestKey: tree.requestKey,\n segment: tree.segment,\n varyPath: clonePageVaryPathWithNewSearchParams(\n tree.varyPath,\n newRenderedSearch\n ),\n isPage: true,\n slots: clonedSlots,\n isRootLayout: tree.isRootLayout,\n hasLoadingBoundary: tree.hasLoadingBoundary,\n hasRuntimePrefetch: tree.hasRuntimePrefetch,\n }\n }\n\n return {\n requestKey: tree.requestKey,\n segment: tree.segment,\n varyPath: tree.varyPath,\n isPage: false,\n slots: clonedSlots,\n isRootLayout: tree.isRootLayout,\n hasLoadingBoundary: tree.hasLoadingBoundary,\n hasRuntimePrefetch: tree.hasRuntimePrefetch,\n }\n}\n\n/**\n * Checks if an entry for a segment exists in the cache. If so, it returns the\n * entry, If not, it adds an empty entry to the cache and returns it.\n */\nexport function readOrCreateSegmentCacheEntry(\n now: number,\n fetchStrategy: FetchStrategy,\n route: FulfilledRouteCacheEntry,\n tree: RouteTree\n): SegmentCacheEntry {\n const existingEntry = readSegmentCacheEntry(now, tree.varyPath)\n if (existingEntry !== null) {\n return existingEntry\n }\n // Create a pending entry and add it to the cache.\n const varyPathForRequest = getSegmentVaryPathForRequest(fetchStrategy, tree)\n const pendingEntry = createDetachedSegmentCacheEntry(route.staleAt)\n const isRevalidation = false\n setInCacheMap(\n segmentCacheMap,\n varyPathForRequest,\n pendingEntry,\n isRevalidation\n )\n return pendingEntry\n}\n\nexport function readOrCreateRevalidatingSegmentEntry(\n now: number,\n fetchStrategy: FetchStrategy,\n route: FulfilledRouteCacheEntry,\n tree: RouteTree\n): SegmentCacheEntry {\n // This function is called when we've already confirmed that a particular\n // segment is cached, but we want to perform another request anyway in case it\n // returns more complete and/or fresher data than we already have. The logic\n // for deciding whether to replace the existing entry is handled elsewhere;\n // this function just handles retrieving a cache entry that we can use to\n // track the revalidation.\n //\n // The reason revalidations are stored in the cache is because we need to be\n // able to dedupe multiple revalidation requests. The reason they have to be\n // handled specially is because we shouldn't overwrite a \"normal\" entry if\n // one exists at the same keypath. So, for each internal cache location, there\n // is a special \"revalidation\" slot that is used solely for this purpose.\n //\n // You can think of it as if all the revalidation entries were stored in a\n // separate cache map from the canonical entries, and then transfered to the\n // canonical cache map once the request is complete — this isn't how it's\n // actually implemented, since it's more efficient to store them in the same\n // data structure as the normal entries, but that's how it's modeled\n // conceptually.\n\n // TODO: Once we implement Fallback behavior for params, where an entry is\n // re-keyed based on response information, we'll need to account for the\n // possibility that the keypath of the previous entry is more generic than\n // the keypath of the revalidating entry. In other words, the server could\n // return a less generic entry upon revalidation. For now, though, this isn't\n // a concern because the keypath is based solely on the prefetch strategy,\n // not on data contained in the response.\n const existingEntry = readRevalidatingSegmentCacheEntry(now, tree.varyPath)\n if (existingEntry !== null) {\n return existingEntry\n }\n // Create a pending entry and add it to the cache.\n const varyPathForRequest = getSegmentVaryPathForRequest(fetchStrategy, tree)\n const pendingEntry = createDetachedSegmentCacheEntry(route.staleAt)\n const isRevalidation = true\n setInCacheMap(\n segmentCacheMap,\n varyPathForRequest,\n pendingEntry,\n isRevalidation\n )\n return pendingEntry\n}\n\nexport function overwriteRevalidatingSegmentCacheEntry(\n fetchStrategy: FetchStrategy,\n route: FulfilledRouteCacheEntry,\n tree: RouteTree\n) {\n // This function is called when we've already decided to replace an existing\n // revalidation entry. Create a new entry and write it into the cache,\n // overwriting the previous value.\n const varyPathForRequest = getSegmentVaryPathForRequest(fetchStrategy, tree)\n const pendingEntry = createDetachedSegmentCacheEntry(route.staleAt)\n const isRevalidation = true\n setInCacheMap(\n segmentCacheMap,\n varyPathForRequest,\n pendingEntry,\n isRevalidation\n )\n return pendingEntry\n}\n\nexport function upsertSegmentEntry(\n now: number,\n varyPath: SegmentVaryPath,\n candidateEntry: SegmentCacheEntry\n): SegmentCacheEntry | null {\n // We have a new entry that has not yet been inserted into the cache. Before\n // we do so, we need to confirm whether it takes precedence over the existing\n // entry (if one exists).\n // TODO: We should not upsert an entry if its key was invalidated in the time\n // since the request was made. We can do that by passing the \"owner\" entry to\n // this function and confirming it's the same as `existingEntry`.\n\n if (isValueExpired(now, getCurrentCacheVersion(), candidateEntry)) {\n // The entry is expired. We cannot upsert it.\n return null\n }\n\n const existingEntry = readSegmentCacheEntry(now, varyPath)\n if (existingEntry !== null) {\n // Don't replace a more specific segment with a less-specific one. A case where this\n // might happen is if the existing segment was fetched via\n // `<Link prefetch={true}>`.\n if (\n // We fetched the new segment using a different, less specific fetch strategy\n // than the segment we already have in the cache, so it can't have more content.\n (candidateEntry.fetchStrategy !== existingEntry.fetchStrategy &&\n !canNewFetchStrategyProvideMoreContent(\n existingEntry.fetchStrategy,\n candidateEntry.fetchStrategy\n )) ||\n // The existing entry isn't partial, but the new one is.\n // (TODO: can this be true if `candidateEntry.fetchStrategy >= existingEntry.fetchStrategy`?)\n (!existingEntry.isPartial && candidateEntry.isPartial)\n ) {\n // We're going to leave revalidating entry in the cache so that it doesn't\n // get revalidated again unnecessarily. Downgrade the Fulfilled entry to\n // Rejected and null out the data so it can be garbage collected. We leave\n // `staleAt` intact to prevent subsequent revalidation attempts only until\n // the entry expires.\n const rejectedEntry: RejectedSegmentCacheEntry = candidateEntry as any\n rejectedEntry.status = EntryStatus.Rejected\n rejectedEntry.loading = null\n rejectedEntry.rsc = null\n return null\n }\n\n // Evict the existing entry from the cache.\n deleteFromCacheMap(existingEntry)\n }\n\n const isRevalidation = false\n setInCacheMap(segmentCacheMap, varyPath, candidateEntry, isRevalidation)\n return candidateEntry\n}\n\nexport function createDetachedSegmentCacheEntry(\n staleAt: number\n): EmptySegmentCacheEntry {\n const emptyEntry: EmptySegmentCacheEntry = {\n status: EntryStatus.Empty,\n // Default to assuming the fetch strategy will be PPR. This will be updated\n // when a fetch is actually initiated.\n fetchStrategy: FetchStrategy.PPR,\n rsc: null,\n loading: null,\n isPartial: true,\n promise: null,\n\n // Map-related fields\n ref: null,\n size: 0,\n staleAt,\n version: 0,\n }\n return emptyEntry\n}\n\nexport function upgradeToPendingSegment(\n emptyEntry: EmptySegmentCacheEntry,\n fetchStrategy: FetchStrategy\n): PendingSegmentCacheEntry {\n const pendingEntry: PendingSegmentCacheEntry = emptyEntry as any\n pendingEntry.status = EntryStatus.Pending\n pendingEntry.fetchStrategy = fetchStrategy\n // Set the version here, since this is right before the request is initiated.\n // The next time the global cache version is incremented, the entry will\n // effectively be evicted. This happens before initiating the request, rather\n // than when receiving the response, because it's guaranteed to happen\n // before the data is read on the server.\n pendingEntry.version = getCurrentCacheVersion()\n return pendingEntry\n}\n\nfunction pingBlockedTasks(entry: {\n blockedTasks: Set<PrefetchTask> | null\n}): void {\n const blockedTasks = entry.blockedTasks\n if (blockedTasks !== null) {\n for (const task of blockedTasks) {\n pingPrefetchTask(task)\n }\n entry.blockedTasks = null\n }\n}\n\nfunction fulfillRouteCacheEntry(\n entry: RouteCacheEntry,\n tree: RouteTree,\n metadataVaryPath: PageVaryPath,\n staleAt: number,\n couldBeIntercepted: boolean,\n canonicalUrl: string,\n renderedSearch: NormalizedSearch,\n isPPREnabled: boolean\n): FulfilledRouteCacheEntry {\n // The Head is not actually part of the route tree, but other than that, it's\n // fetched and cached like a segment. Some functions expect a RouteTree\n // object, so rather than fork the logic in all those places, we use this\n // \"fake\" one.\n const metadata: RouteTree = {\n requestKey: HEAD_REQUEST_KEY,\n segment: HEAD_REQUEST_KEY,\n varyPath: metadataVaryPath,\n // The metadata isn't really a \"page\" (though it isn't really a \"segment\"\n // either) but for the purposes of how this field is used, it behaves like\n // one. If this logic ever gets more complex we can change this to an enum.\n isPage: true,\n slots: null,\n isRootLayout: false,\n hasLoadingBoundary: HasLoadingBoundary.SubtreeHasNoLoadingBoundary,\n hasRuntimePrefetch: false,\n }\n const fulfilledEntry: FulfilledRouteCacheEntry = entry as any\n fulfilledEntry.status = EntryStatus.Fulfilled\n fulfilledEntry.tree = tree\n fulfilledEntry.metadata = metadata\n fulfilledEntry.staleAt = staleAt\n fulfilledEntry.couldBeIntercepted = couldBeIntercepted\n fulfilledEntry.canonicalUrl = canonicalUrl\n fulfilledEntry.renderedSearch = renderedSearch\n fulfilledEntry.isPPREnabled = isPPREnabled\n pingBlockedTasks(entry)\n return fulfilledEntry\n}\n\nfunction fulfillSegmentCacheEntry(\n segmentCacheEntry: PendingSegmentCacheEntry,\n rsc: React.ReactNode,\n loading: LoadingModuleData | Promise<LoadingModuleData>,\n staleAt: number,\n isPartial: boolean\n): FulfilledSegmentCacheEntry {\n const fulfilledEntry: FulfilledSegmentCacheEntry = segmentCacheEntry as any\n fulfilledEntry.status = EntryStatus.Fulfilled\n fulfilledEntry.rsc = rsc\n fulfilledEntry.loading = loading\n fulfilledEntry.staleAt = staleAt\n fulfilledEntry.isPartial = isPartial\n // Resolve any listeners that were waiting for this data.\n if (segmentCacheEntry.promise !== null) {\n segmentCacheEntry.promise.resolve(fulfilledEntry)\n // Free the promise for garbage collection.\n fulfilledEntry.promise = null\n }\n return fulfilledEntry\n}\n\nfunction rejectRouteCacheEntry(\n entry: PendingRouteCacheEntry,\n staleAt: number\n): void {\n const rejectedEntry: RejectedRouteCacheEntry = entry as any\n rejectedEntry.status = EntryStatus.Rejected\n rejectedEntry.staleAt = staleAt\n pingBlockedTasks(entry)\n}\n\nfunction rejectSegmentCacheEntry(\n entry: PendingSegmentCacheEntry,\n staleAt: number\n): void {\n const rejectedEntry: RejectedSegmentCacheEntry = entry as any\n rejectedEntry.status = EntryStatus.Rejected\n rejectedEntry.staleAt = staleAt\n if (entry.promise !== null) {\n // NOTE: We don't currently propagate the reason the prefetch was canceled\n // but we could by accepting a `reason` argument.\n entry.promise.resolve(null)\n entry.promise = null\n }\n}\n\ntype RouteTreeAccumulator = {\n metadataVaryPath: PageVaryPath | null\n}\n\nfunction convertRootTreePrefetchToRouteTree(\n rootTree: RootTreePrefetch,\n renderedPathname: string,\n renderedSearch: NormalizedSearch,\n acc: RouteTreeAccumulator\n) {\n // Remove trailing and leading slashes\n const pathnameParts = renderedPathname.split('/').filter((p) => p !== '')\n const index = 0\n const rootSegment = ROOT_SEGMENT_REQUEST_KEY\n return convertTreePrefetchToRouteTree(\n rootTree.tree,\n rootSegment,\n null,\n ROOT_SEGMENT_REQUEST_KEY,\n pathnameParts,\n index,\n renderedSearch,\n acc\n )\n}\n\nfunction convertTreePrefetchToRouteTree(\n prefetch: TreePrefetch,\n segment: FlightRouterStateSegment,\n partialVaryPath: PartialSegmentVaryPath | null,\n requestKey: SegmentRequestKey,\n pathnameParts: Array<string>,\n pathnamePartsIndex: number,\n renderedSearch: NormalizedSearch,\n acc: RouteTreeAccumulator\n): RouteTree {\n // Converts the route tree sent by the server into the format used by the\n // cache. The cached version of the tree includes additional fields, such as a\n // cache key for each segment. Since this is frequently accessed, we compute\n // it once instead of on every access. This same cache key is also used to\n // request the segment from the server.\n\n let slots: { [parallelRouteKey: string]: RouteTree } | null = null\n let isPage: boolean\n let varyPath: SegmentVaryPath\n const prefetchSlots = prefetch.slots\n if (prefetchSlots !== null) {\n isPage = false\n varyPath = finalizeLayoutVaryPath(requestKey, partialVaryPath)\n\n slots = {}\n for (let parallelRouteKey in prefetchSlots) {\n const childPrefetch = prefetchSlots[parallelRouteKey]\n const childParamName = childPrefetch.name\n const childParamType = childPrefetch.paramType\n const childServerSentParamKey = childPrefetch.paramKey\n\n let childDoesAppearInURL: boolean\n let childSegment: FlightRouterStateSegment\n let childPartialVaryPath: PartialSegmentVaryPath | null\n if (childParamType !== null) {\n // This segment is parameterized. Get the param from the pathname.\n const childParamValue = parseDynamicParamFromURLPart(\n childParamType,\n pathnameParts,\n pathnamePartsIndex\n )\n\n // Assign a cache key to the segment, based on the param value. In the\n // pre-Segment Cache implementation, the server computes this and sends\n // it in the body of the response. In the Segment Cache implementation,\n // the server sends an empty string and we fill it in here.\n\n // TODO: We're intentionally not adding the search param to page\n // segments here; it's tracked separately and added back during a read.\n // This would clearer if we waited to construct the segment until it's\n // read from the cache, since that's effectively what we're\n // doing anyway.\n const childParamKey =\n // The server omits this field from the prefetch response when\n // cacheComponents is enabled.\n childServerSentParamKey !== null\n ? childServerSentParamKey\n : // If no param key was sent, use the value parsed on the client.\n getCacheKeyForDynamicParam(\n childParamValue,\n '' as NormalizedSearch\n )\n\n childPartialVaryPath = appendLayoutVaryPath(\n partialVaryPath,\n childParamKey\n )\n childSegment = [childParamName, childParamKey, childParamType]\n childDoesAppearInURL = true\n } else {\n // This segment does not have a param. Inherit the partial vary path of\n // the parent.\n childPartialVaryPath = partialVaryPath\n childSegment = childParamName\n childDoesAppearInURL = doesStaticSegmentAppearInURL(childParamName)\n }\n\n // Only increment the index if the segment appears in the URL. If it's a\n // \"virtual\" segment, like a route group, it remains the same.\n const childPathnamePartsIndex = childDoesAppearInURL\n ? pathnamePartsIndex + 1\n : pathnamePartsIndex\n\n const childRequestKeyPart = createSegmentRequestKeyPart(childSegment)\n const childRequestKey = appendSegmentRequestKeyPart(\n requestKey,\n parallelRouteKey,\n childRequestKeyPart\n )\n slots[parallelRouteKey] = convertTreePrefetchToRouteTree(\n childPrefetch,\n childSegment,\n childPartialVaryPath,\n childRequestKey,\n pathnameParts,\n childPathnamePartsIndex,\n renderedSearch,\n acc\n )\n }\n } else {\n if (requestKey.endsWith(PAGE_SEGMENT_KEY)) {\n // This is a page segment.\n isPage = true\n varyPath = finalizePageVaryPath(\n requestKey,\n renderedSearch,\n partialVaryPath\n )\n // The metadata \"segment\" is not part the route tree, but it has the same\n // conceptual params as a page segment. Write the vary path into the\n // accumulator object. If there are multiple parallel pages, we use the\n // first one. Which page we choose is arbitrary as long as it's\n // consistently the same one every time every time. See\n // finalizeMetadataVaryPath for more details.\n if (acc.metadataVaryPath === null) {\n acc.metadataVaryPath = finalizeMetadataVaryPath(\n requestKey,\n renderedSearch,\n partialVaryPath\n )\n }\n } else {\n // This is a layout segment.\n isPage = false\n varyPath = finalizeLayoutVaryPath(requestKey, partialVaryPath)\n }\n }\n\n return {\n requestKey,\n segment,\n varyPath,\n // TODO: Cheating the type system here a bit because TypeScript can't tell\n // that the type of isPage and varyPath are consistent. The fix would be to\n // create separate constructors and call the appropriate one from each of\n // the branches above. Just seems a bit overkill only for one field so I'll\n // leave it as-is for now. If isPage were wrong it would break the behavior\n // and we'd catch it quickly, anyway.\n isPage: isPage as boolean as any,\n slots,\n isRootLayout: prefetch.isRootLayout,\n // This field is only relevant to dynamic routes. For a PPR/static route,\n // there's always some partial loading state we can fetch.\n hasLoadingBoundary: HasLoadingBoundary.SegmentHasLoadingBoundary,\n hasRuntimePrefetch: prefetch.hasRuntimePrefetch,\n }\n}\n\nfunction convertRootFlightRouterStateToRouteTree(\n flightRouterState: FlightRouterState,\n renderedSearch: NormalizedSearch,\n acc: RouteTreeAccumulator\n): RouteTree {\n return convertFlightRouterStateToRouteTree(\n flightRouterState,\n ROOT_SEGMENT_REQUEST_KEY,\n null,\n renderedSearch,\n acc\n )\n}\n\nfunction convertFlightRouterStateToRouteTree(\n flightRouterState: FlightRouterState,\n requestKey: SegmentRequestKey,\n parentPartialVaryPath: PartialSegmentVaryPath | null,\n renderedSearch: NormalizedSearch,\n acc: RouteTreeAccumulator\n): RouteTree {\n const originalSegment = flightRouterState[0]\n\n let segment: FlightRouterStateSegment\n let partialVaryPath: PartialSegmentVaryPath | null\n let isPage: boolean\n let varyPath: SegmentVaryPath\n if (Array.isArray(originalSegment)) {\n isPage = false\n const paramCacheKey = originalSegment[1]\n partialVaryPath = appendLayoutVaryPath(parentPartialVaryPath, paramCacheKey)\n varyPath = finalizeLayoutVaryPath(requestKey, partialVaryPath)\n segment = originalSegment\n } else {\n // This segment does not have a param. Inherit the partial vary path of\n // the parent.\n partialVaryPath = parentPartialVaryPath\n if (requestKey.endsWith(PAGE_SEGMENT_KEY)) {\n // This is a page segment.\n isPage = true\n\n // The navigation implementation expects the search params to be included\n // in the segment. However, in the case of a static response, the search\n // params are omitted. So the client needs to add them back in when reading\n // from the Segment Cache.\n //\n // For consistency, we'll do this for dynamic responses, too.\n //\n // TODO: We should move search params out of FlightRouterState and handle\n // them entirely on the client, similar to our plan for dynamic params.\n segment = PAGE_SEGMENT_KEY\n varyPath = finalizePageVaryPath(\n requestKey,\n renderedSearch,\n partialVaryPath\n )\n // The metadata \"segment\" is not part the route tree, but it has the same\n // conceptual params as a page segment. Write the vary path into the\n // accumulator object. If there are multiple parallel pages, we use the\n // first one. Which page we choose is arbitrary as long as it's\n // consistently the same one every time every time. See\n // finalizeMetadataVaryPath for more details.\n if (acc.metadataVaryPath === null) {\n acc.metadataVaryPath = finalizeMetadataVaryPath(\n requestKey,\n renderedSearch,\n partialVaryPath\n )\n }\n } else {\n // This is a layout segment.\n isPage = false\n segment = originalSegment\n varyPath = finalizeLayoutVaryPath(requestKey, partialVaryPath)\n }\n }\n\n let slots: { [parallelRouteKey: string]: RouteTree } | null = null\n\n const parallelRoutes = flightRouterState[1]\n for (let parallelRouteKey in parallelRoutes) {\n const childRouterState = parallelRoutes[parallelRouteKey]\n const childSegment = childRouterState[0]\n // TODO: Eventually, the param values will not be included in the response\n // from the server. We'll instead fill them in on the client by parsing\n // the URL. This is where we'll do that.\n const childRequestKeyPart = createSegmentRequestKeyPart(childSegment)\n const childRequestKey = appendSegmentRequestKeyPart(\n requestKey,\n parallelRouteKey,\n childRequestKeyPart\n )\n const childTree = convertFlightRouterStateToRouteTree(\n childRouterState,\n childRequestKey,\n partialVaryPath,\n renderedSearch,\n acc\n )\n if (slots === null) {\n slots = {\n [parallelRouteKey]: childTree,\n }\n } else {\n slots[parallelRouteKey] = childTree\n }\n }\n\n return {\n requestKey,\n segment,\n varyPath,\n // TODO: Cheating the type system here a bit because TypeScript can't tell\n // that the type of isPage and varyPath are consistent. The fix would be to\n // create separate constructors and call the appropriate one from each of\n // the branches above. Just seems a bit overkill only for one field so I'll\n // leave it as-is for now. If isPage were wrong it would break the behavior\n // and we'd catch it quickly, anyway.\n isPage: isPage as boolean as any,\n slots,\n isRootLayout: flightRouterState[4] === true,\n hasLoadingBoundary:\n flightRouterState[5] !== undefined\n ? flightRouterState[5]\n : HasLoadingBoundary.SubtreeHasNoLoadingBoundary,\n\n // Non-static tree responses are only used by apps that haven't adopted\n // Cache Components. So this is always false.\n hasRuntimePrefetch: false,\n }\n}\n\nexport function convertRouteTreeToFlightRouterState(\n routeTree: RouteTree\n): FlightRouterState {\n const parallelRoutes: Record<string, FlightRouterState> = {}\n if (routeTree.slots !== null) {\n for (const parallelRouteKey in routeTree.slots) {\n parallelRoutes[parallelRouteKey] = convertRouteTreeToFlightRouterState(\n routeTree.slots[parallelRouteKey]\n )\n }\n }\n const flightRouterState: FlightRouterState = [\n routeTree.segment,\n parallelRoutes,\n null,\n null,\n routeTree.isRootLayout,\n ]\n return flightRouterState\n}\n\nexport async function fetchRouteOnCacheMiss(\n entry: PendingRouteCacheEntry,\n task: PrefetchTask,\n key: RouteCacheKey\n): Promise<PrefetchSubtaskResult<null> | null> {\n // This function is allowed to use async/await because it contains the actual\n // fetch that gets issued on a cache miss. Notice it writes the result to the\n // cache entry directly, rather than return data that is then written by\n // the caller.\n const pathname = key.pathname\n const search = key.search\n const nextUrl = key.nextUrl\n const segmentPath = '/_tree' as SegmentRequestKey\n\n const headers: RequestHeaders = {\n [RSC_HEADER]: '1',\n [NEXT_ROUTER_PREFETCH_HEADER]: '1',\n [NEXT_ROUTER_SEGMENT_PREFETCH_HEADER]: segmentPath,\n }\n if (nextUrl !== null) {\n headers[NEXT_URL] = nextUrl\n }\n\n try {\n const url = new URL(pathname + search, location.origin)\n let response\n let urlAfterRedirects\n if (isOutputExportMode) {\n // In output: \"export\" mode, we can't use headers to request a particular\n // segment. Instead, we encode the extra request information into the URL.\n // This is not part of the \"public\" interface of the app; it's an internal\n // Next.js implementation detail that the app developer should not need to\n // concern themselves with.\n //\n // For example, to request a segment:\n //\n // Path passed to <Link>: /path/to/page\n // Path passed to fetch: /path/to/page/__next-segments/_tree\n //\n // (This is not the exact protocol, just an illustration.)\n //\n // Before we do that, though, we need to account for redirects. Even in\n // output: \"export\" mode, a proxy might redirect the page to a different\n // location, but we shouldn't assume or expect that they also redirect all\n // the segment files, too.\n //\n // To check whether the page is redirected, we perform a range request of\n // the first N bytes of the HTML document. The canonical URL is determined\n // from the response.\n //\n // Then we can use the canonical URL to request the route tree.\n //\n // NOTE: We could embed the route tree into the HTML document, to avoid\n // a second request. We're not doing that currently because it would make\n // the HTML document larger and affect normal page loads.\n const htmlResponse = await fetch(url, {\n headers: {\n Range: DOC_PREFETCH_RANGE_HEADER_VALUE,\n },\n })\n const partialHtml = await htmlResponse.text()\n if (!doesExportedHtmlMatchBuildId(partialHtml, getAppBuildId())) {\n // The target page is not part of this app, or it belongs to a\n // different build.\n rejectRouteCacheEntry(entry, Date.now() + 10 * 1000)\n return null\n }\n urlAfterRedirects = htmlResponse.redirected\n ? new URL(htmlResponse.url)\n : url\n response = await fetchPrefetchResponse(\n addSegmentPathToUrlInOutputExportMode(urlAfterRedirects, segmentPath),\n headers\n )\n } else {\n // \"Server\" mode. We can use request headers instead of the pathname.\n // TODO: The eventual plan is to get rid of our custom request headers and\n // encode everything into the URL, using a similar strategy to the\n // \"output: export\" block above.\n response = await fetchPrefetchResponse(url, headers)\n urlAfterRedirects =\n response !== null && response.redirected ? new URL(response.url) : url\n }\n\n if (\n !response ||\n !response.ok ||\n // 204 is a Cache miss. Though theoretically this shouldn't happen when\n // PPR is enabled, because we always respond to route tree requests, even\n // if it needs to be blockingly generated on demand.\n response.status === 204 ||\n !response.body\n ) {\n // Server responded with an error, or with a miss. We should still cache\n // the response, but we can try again after 10 seconds.\n rejectRouteCacheEntry(entry, Date.now() + 10 * 1000)\n return null\n }\n\n // TODO: The canonical URL is the href without the origin. I think\n // historically the reason for this is because the initial canonical URL\n // gets passed as a prop to the top-level React component, which means it\n // needs to be computed during SSR. If it were to include the origin, it\n // would need to always be same as location.origin on the client, to prevent\n // a hydration mismatch. To sidestep this complexity, we omit the origin.\n //\n // However, since this is neither a native URL object nor a fully qualified\n // URL string, we need to be careful about how we use it. To prevent subtle\n // mistakes, we should create a special type for it, instead of just string.\n // Or, we should just use a (readonly) URL object instead. The type of the\n // prop that we pass to seed the initial state does not need to be the same\n // type as the state itself.\n const canonicalUrl = createHrefFromUrl(urlAfterRedirects)\n\n // Check whether the response varies based on the Next-Url header.\n const varyHeader = response.headers.get('vary')\n const couldBeIntercepted =\n varyHeader !== null && varyHeader.includes(NEXT_URL)\n\n // Track when the network connection closes.\n const closed = createPromiseWithResolvers<void>()\n\n // This checks whether the response was served from the per-segment cache,\n // rather than the old prefetching flow. If it fails, it implies that PPR\n // is disabled on this route.\n const routeIsPPREnabled =\n response.headers.get(NEXT_DID_POSTPONE_HEADER) === '2' ||\n // In output: \"export\" mode, we can't rely on response headers. But if we\n // receive a well-formed response, we can assume it's a static response,\n // because all data is static in this mode.\n isOutputExportMode\n\n if (routeIsPPREnabled) {\n const prefetchStream = createPrefetchResponseStream(\n response.body,\n closed.resolve,\n function onResponseSizeUpdate(size) {\n setSizeInCacheMap(entry, size)\n }\n )\n const serverData = await createFromNextReadableStream<RootTreePrefetch>(\n prefetchStream,\n headers\n )\n if (serverData.buildId !== getAppBuildId()) {\n // The server build does not match the client. Treat as a 404. During\n // an actual navigation, the router will trigger an MPA navigation.\n // TODO: Consider moving the build ID to a response header so we can check\n // it before decoding the response, and so there's one way of checking\n // across all response types.\n // TODO: We should cache the fact that this is an MPA navigation.\n rejectRouteCacheEntry(entry, Date.now() + 10 * 1000)\n return null\n }\n\n // Get the params that were used to render the target page. These may\n // be different from the params in the request URL, if the page\n // was rewritten.\n const renderedPathname = getRenderedPathname(response)\n const renderedSearch = getRenderedSearch(response)\n\n // Convert the server-sent data into the RouteTree format used by the\n // client cache.\n //\n // During this traversal, we accumulate additional data into this\n // \"accumulator\" object.\n const acc: RouteTreeAccumulator = { metadataVaryPath: null }\n const routeTree = convertRootTreePrefetchToRouteTree(\n serverData,\n renderedPathname,\n renderedSearch,\n acc\n )\n const metadataVaryPath = acc.metadataVaryPath\n if (metadataVaryPath === null) {\n rejectRouteCacheEntry(entry, Date.now() + 10 * 1000)\n return null\n }\n\n const staleTimeMs = getStaleTimeMs(serverData.staleTime)\n fulfillRouteCacheEntry(\n entry,\n routeTree,\n metadataVaryPath,\n Date.now() + staleTimeMs,\n couldBeIntercepted,\n canonicalUrl,\n renderedSearch,\n routeIsPPREnabled\n )\n } else {\n // PPR is not enabled for this route. The server responds with a\n // different format (FlightRouterState) that we need to convert.\n // TODO: We will unify the responses eventually. I'm keeping the types\n // separate for now because FlightRouterState has so many\n // overloaded concerns.\n const prefetchStream = createPrefetchResponseStream(\n response.body,\n closed.resolve,\n function onResponseSizeUpdate(size) {\n setSizeInCacheMap(entry, size)\n }\n )\n const serverData =\n await createFromNextReadableStream<NavigationFlightResponse>(\n prefetchStream,\n headers\n )\n if (serverData.b !== getAppBuildId()) {\n // The server build does not match the client. Treat as a 404. During\n // an actual navigation, the router will trigger an MPA navigation.\n // TODO: Consider moving the build ID to a response header so we can check\n // it before decoding the response, and so there's one way of checking\n // across all response types.\n // TODO: We should cache the fact that this is an MPA navigation.\n rejectRouteCacheEntry(entry, Date.now() + 10 * 1000)\n return null\n }\n\n writeDynamicTreeResponseIntoCache(\n Date.now(),\n task,\n // The non-PPR response format is what we'd get if we prefetched these segments\n // using the LoadingBoundary fetch strategy, so mark their cache entries accordingly.\n FetchStrategy.LoadingBoundary,\n response as RSCResponse<NavigationFlightResponse>,\n serverData,\n entry,\n couldBeIntercepted,\n canonicalUrl,\n routeIsPPREnabled\n )\n }\n\n if (!couldBeIntercepted) {\n // This route will never be intercepted. So we can use this entry for all\n // requests to this route, regardless of the Next-Url header. This works\n // because when reading the cache we always check for a valid\n // non-intercepted entry first.\n\n // Re-key the entry. The `set` implementation handles removing it from\n // its previous position in the cache. We don't need to do anything to\n // update the LRU, because the entry is already in it.\n // TODO: Treat this as an upsert — should check if an entry already\n // exists at the new keypath, and if so, whether we should keep that\n // one instead.\n const fulfilledVaryPath: RouteVaryPath = getFulfilledRouteVaryPath(\n pathname,\n search,\n nextUrl,\n couldBeIntercepted\n )\n const isRevalidation = false\n setInCacheMap(routeCacheMap, fulfilledVaryPath, entry, isRevalidation)\n }\n // Return a promise that resolves when the network connection closes, so\n // the scheduler can track the number of concurrent network connections.\n return { value: null, closed: closed.promise }\n } catch (error) {\n // Either the connection itself failed, or something bad happened while\n // decoding the response.\n rejectRouteCacheEntry(entry, Date.now() + 10 * 1000)\n return null\n }\n}\n\nexport async function fetchSegmentOnCacheMiss(\n route: FulfilledRouteCacheEntry,\n segmentCacheEntry: PendingSegmentCacheEntry,\n routeKey: RouteCacheKey,\n tree: RouteTree\n): Promise<PrefetchSubtaskResult<FulfilledSegmentCacheEntry> | null> {\n // This function is allowed to use async/await because it contains the actual\n // fetch that gets issued on a cache miss. Notice it writes the result to the\n // cache entry directly, rather than return data that is then written by\n // the caller.\n //\n // Segment fetches are non-blocking so we don't need to ping the scheduler\n // on completion.\n\n // Use the canonical URL to request the segment, not the original URL. These\n // are usually the same, but the canonical URL will be different if the route\n // tree response was redirected. To avoid an extra waterfall on every segment\n // request, we pass the redirected URL instead of the original one.\n const url = new URL(route.canonicalUrl, location.origin)\n const nextUrl = routeKey.nextUrl\n\n const requestKey = tree.requestKey\n const normalizedRequestKey =\n requestKey === ROOT_SEGMENT_REQUEST_KEY\n ? // The root segment is a special case. To simplify the server-side\n // handling of these requests, we encode the root segment path as\n // `_index` instead of as an empty string. This should be treated as\n // an implementation detail and not as a stable part of the protocol.\n // It just needs to match the equivalent logic that happens when\n // prerendering the responses. It should not leak outside of Next.js.\n ('/_index' as SegmentRequestKey)\n : requestKey\n\n const headers: RequestHeaders = {\n [RSC_HEADER]: '1',\n [NEXT_ROUTER_PREFETCH_HEADER]: '1',\n [NEXT_ROUTER_SEGMENT_PREFETCH_HEADER]: normalizedRequestKey,\n }\n if (nextUrl !== null) {\n headers[NEXT_URL] = nextUrl\n }\n\n const requestUrl = isOutputExportMode\n ? // In output: \"export\" mode, we need to add the segment path to the URL.\n addSegmentPathToUrlInOutputExportMode(url, normalizedRequestKey)\n : url\n try {\n const response = await fetchPrefetchResponse(requestUrl, headers)\n if (\n !response ||\n !response.ok ||\n response.status === 204 || // Cache miss\n // This checks whether the response was served from the per-segment cache,\n // rather than the old prefetching flow. If it fails, it implies that PPR\n // is disabled on this route. Theoretically this should never happen\n // because we only issue requests for segments once we've verified that\n // the route supports PPR.\n (response.headers.get(NEXT_DID_POSTPONE_HEADER) !== '2' &&\n // In output: \"export\" mode, we can't rely on response headers. But if\n // we receive a well-formed response, we can assume it's a static\n // response, because all data is static in this mode.\n !isOutputExportMode) ||\n !response.body\n ) {\n // Server responded with an error, or with a miss. We should still cache\n // the response, but we can try again after 10 seconds.\n rejectSegmentCacheEntry(segmentCacheEntry, Date.now() + 10 * 1000)\n return null\n }\n\n // Track when the network connection closes.\n const closed = createPromiseWithResolvers<void>()\n\n // Wrap the original stream in a new stream that never closes. That way the\n // Flight client doesn't error if there's a hanging promise.\n const prefetchStream = createPrefetchResponseStream(\n response.body,\n closed.resolve,\n function onResponseSizeUpdate(size) {\n setSizeInCacheMap(segmentCacheEntry, size)\n }\n )\n const serverData = await (createFromNextReadableStream(\n prefetchStream,\n headers\n ) as Promise<SegmentPrefetch>)\n if (serverData.buildId !== getAppBuildId()) {\n // The server build does not match the client. Treat as a 404. During\n // an actual navigation, the router will trigger an MPA navigation.\n // TODO: Consider moving the build ID to a response header so we can check\n // it before decoding the response, and so there's one way of checking\n // across all response types.\n rejectSegmentCacheEntry(segmentCacheEntry, Date.now() + 10 * 1000)\n return null\n }\n return {\n value: fulfillSegmentCacheEntry(\n segmentCacheEntry,\n serverData.rsc,\n serverData.loading,\n // TODO: The server does not currently provide per-segment stale time.\n // So we use the stale time of the route.\n route.staleAt,\n serverData.isPartial\n ),\n // Return a promise that resolves when the network connection closes, so\n // the scheduler can track the number of concurrent network connections.\n closed: closed.promise,\n }\n } catch (error) {\n // Either the connection itself failed, or something bad happened while\n // decoding the response.\n rejectSegmentCacheEntry(segmentCacheEntry, Date.now() + 10 * 1000)\n return null\n }\n}\n\nexport async function fetchSegmentPrefetchesUsingDynamicRequest(\n task: PrefetchTask,\n route: FulfilledRouteCacheEntry,\n fetchStrategy:\n | FetchStrategy.LoadingBoundary\n | FetchStrategy.PPRRuntime\n | FetchStrategy.Full,\n dynamicRequestTree: FlightRouterState,\n spawnedEntries: Map<SegmentRequestKey, PendingSegmentCacheEntry>\n): Promise<PrefetchSubtaskResult<null> | null> {\n const key = task.key\n const url = new URL(route.canonicalUrl, location.origin)\n const nextUrl = key.nextUrl\n\n if (\n spawnedEntries.size === 1 &&\n spawnedEntries.has(route.metadata.requestKey)\n ) {\n // The only thing pending is the head. Instruct the server to\n // skip over everything else.\n dynamicRequestTree = MetadataOnlyRequestTree\n }\n\n const headers: RequestHeaders = {\n [RSC_HEADER]: '1',\n [NEXT_ROUTER_STATE_TREE_HEADER]:\n prepareFlightRouterStateForRequest(dynamicRequestTree),\n }\n if (nextUrl !== null) {\n headers[NEXT_URL] = nextUrl\n }\n switch (fetchStrategy) {\n case FetchStrategy.Full: {\n // We omit the prefetch header from a full prefetch because it's essentially\n // just a navigation request that happens ahead of time — it should include\n // all the same data in the response.\n break\n }\n case FetchStrategy.PPRRuntime: {\n headers[NEXT_ROUTER_PREFETCH_HEADER] = '2'\n break\n }\n case FetchStrategy.LoadingBoundary: {\n headers[NEXT_ROUTER_PREFETCH_HEADER] = '1'\n break\n }\n default: {\n fetchStrategy satisfies never\n }\n }\n\n try {\n const response = await fetchPrefetchResponse(url, headers)\n if (!response || !response.ok || !response.body) {\n // Server responded with an error, or with a miss. We should still cache\n // the response, but we can try again after 10 seconds.\n rejectSegmentEntriesIfStillPending(spawnedEntries, Date.now() + 10 * 1000)\n return null\n }\n\n const renderedSearch = getRenderedSearch(response)\n if (renderedSearch !== route.renderedSearch) {\n // The search params that were used to render the target page are\n // different from the search params in the request URL. This only happens\n // when there's a dynamic rewrite in between the tree prefetch and the\n // data prefetch.\n // TODO: For now, since this is an edge case, we reject the prefetch, but\n // the proper way to handle this is to evict the stale route tree entry\n // then fill the cache with the new response.\n rejectSegmentEntriesIfStillPending(spawnedEntries, Date.now() + 10 * 1000)\n return null\n }\n\n // Track when the network connection closes.\n const closed = createPromiseWithResolvers<void>()\n\n let fulfilledEntries: Array<FulfilledSegmentCacheEntry> | null = null\n const prefetchStream = createPrefetchResponseStream(\n response.body,\n closed.resolve,\n function onResponseSizeUpdate(totalBytesReceivedSoFar) {\n // When processing a dynamic response, we don't know how large each\n // individual segment is, so approximate by assiging each segment\n // the average of the total response size.\n if (fulfilledEntries === null) {\n // Haven't received enough data yet to know which segments\n // were included.\n return\n }\n const averageSize = totalBytesReceivedSoFar / fulfilledEntries.length\n for (const entry of fulfilledEntries) {\n setSizeInCacheMap(entry, averageSize)\n }\n }\n )\n const serverData = await (createFromNextReadableStream(\n prefetchStream,\n headers\n ) as Promise<NavigationFlightResponse>)\n\n const isResponsePartial =\n fetchStrategy === FetchStrategy.PPRRuntime\n ? // A runtime prefetch may have holes.\n serverData.rp?.[0] === true\n : // Full and LoadingBoundary prefetches cannot have holes.\n // (even if we did set the prefetch header, we only use this codepath for non-PPR-enabled routes)\n false\n\n // Aside from writing the data into the cache, this function also returns\n // the entries that were fulfilled, so we can streamingly update their sizes\n // in the LRU as more data comes in.\n fulfilledEntries = writeDynamicRenderResponseIntoCache(\n Date.now(),\n task,\n fetchStrategy,\n response as RSCResponse<NavigationFlightResponse>,\n serverData,\n isResponsePartial,\n route,\n spawnedEntries\n )\n\n // Return a promise that resolves when the network connection closes, so\n // the scheduler can track the number of concurrent network connections.\n return { value: null, closed: closed.promise }\n } catch (error) {\n rejectSegmentEntriesIfStillPending(spawnedEntries, Date.now() + 10 * 1000)\n return null\n }\n}\n\nfunction writeDynamicTreeResponseIntoCache(\n now: number,\n task: PrefetchTask,\n fetchStrategy:\n | FetchStrategy.LoadingBoundary\n | FetchStrategy.PPRRuntime\n | FetchStrategy.Full,\n response: RSCResponse<NavigationFlightResponse>,\n serverData: NavigationFlightResponse,\n entry: PendingRouteCacheEntry,\n couldBeIntercepted: boolean,\n canonicalUrl: string,\n routeIsPPREnabled: boolean\n) {\n // Get the URL that was used to render the target page. This may be different\n // from the URL in the request URL, if the page was rewritten.\n const renderedSearch = getRenderedSearch(response)\n\n const normalizedFlightDataResult = normalizeFlightData(serverData.f)\n if (\n // A string result means navigating to this route will result in an\n // MPA navigation.\n typeof normalizedFlightDataResult === 'string' ||\n normalizedFlightDataResult.length !== 1\n ) {\n rejectRouteCacheEntry(entry, now + 10 * 1000)\n return\n }\n const flightData = normalizedFlightDataResult[0]\n if (!flightData.isRootRender) {\n // Unexpected response format.\n rejectRouteCacheEntry(entry, now + 10 * 1000)\n return\n }\n\n const flightRouterState = flightData.tree\n // For runtime prefetches, stale time is in the payload at rp[1].\n // For other responses, fall back to the header.\n const staleTimeSeconds =\n typeof serverData.rp?.[1] === 'number'\n ? serverData.rp[1]\n : parseInt(response.headers.get(NEXT_ROUTER_STALE_TIME_HEADER) ?? '', 10)\n const staleTimeMs = !isNaN(staleTimeSeconds)\n ? getStaleTimeMs(staleTimeSeconds)\n : STATIC_STALETIME_MS\n\n // If the response contains dynamic holes, then we must conservatively assume\n // that any individual segment might contain dynamic holes, and also the\n // head. If it did not contain dynamic holes, then we can assume every segment\n // and the head is completely static.\n const isResponsePartial =\n response.headers.get(NEXT_DID_POSTPONE_HEADER) === '1'\n\n // Convert the server-sent data into the RouteTree format used by the\n // client cache.\n //\n // During this traversal, we accumulate additional data into this\n // \"accumulator\" object.\n const acc: RouteTreeAccumulator = { metadataVaryPath: null }\n const routeTree = convertRootFlightRouterStateToRouteTree(\n flightRouterState,\n renderedSearch,\n acc\n )\n const metadataVaryPath = acc.metadataVaryPath\n if (metadataVaryPath === null) {\n rejectRouteCacheEntry(entry, now + 10 * 1000)\n return\n }\n\n const fulfilledEntry = fulfillRouteCacheEntry(\n entry,\n routeTree,\n metadataVaryPath,\n now + staleTimeMs,\n couldBeIntercepted,\n canonicalUrl,\n renderedSearch,\n routeIsPPREnabled\n )\n\n // If the server sent segment data as part of the response, we should write\n // it into the cache to prevent a second, redundant prefetch request.\n //\n // TODO: When `clientSegmentCache` is enabled, the server does not include\n // segment data when responding to a route tree prefetch request. However,\n // when `clientSegmentCache` is set to \"client-only\", and PPR is enabled (or\n // the page is fully static), the normal check is bypassed and the server\n // responds with the full page. This is a temporary situation until we can\n // remove the \"client-only\" option. Then, we can delete this function call.\n writeDynamicRenderResponseIntoCache(\n now,\n task,\n fetchStrategy,\n response,\n serverData,\n isResponsePartial,\n fulfilledEntry,\n null\n )\n}\n\nfunction rejectSegmentEntriesIfStillPending(\n entries: Map<SegmentRequestKey, SegmentCacheEntry>,\n staleAt: number\n): Array<FulfilledSegmentCacheEntry> {\n const fulfilledEntries = []\n for (const entry of entries.values()) {\n if (entry.status === EntryStatus.Pending) {\n rejectSegmentCacheEntry(entry, staleAt)\n } else if (entry.status === EntryStatus.Fulfilled) {\n fulfilledEntries.push(entry)\n }\n }\n return fulfilledEntries\n}\n\nfunction writeDynamicRenderResponseIntoCache(\n now: number,\n task: PrefetchTask,\n fetchStrategy:\n | FetchStrategy.LoadingBoundary\n | FetchStrategy.PPRRuntime\n | FetchStrategy.Full,\n response: RSCResponse<NavigationFlightResponse>,\n serverData: NavigationFlightResponse,\n isResponsePartial: boolean,\n route: FulfilledRouteCacheEntry,\n spawnedEntries: Map<SegmentRequestKey, PendingSegmentCacheEntry> | null\n): Array<FulfilledSegmentCacheEntry> | null {\n if (serverData.b !== getAppBuildId()) {\n // The server build does not match the client. Treat as a 404. During\n // an actual navigation, the router will trigger an MPA navigation.\n // TODO: Consider moving the build ID to a response header so we can check\n // it before decoding the response, and so there's one way of checking\n // across all response types.\n if (spawnedEntries !== null) {\n rejectSegmentEntriesIfStillPending(spawnedEntries, now + 10 * 1000)\n }\n return null\n }\n\n const flightDatas = normalizeFlightData(serverData.f)\n if (typeof flightDatas === 'string') {\n // This means navigating to this route will result in an MPA navigation.\n // TODO: We should cache this, too, so that the MPA navigation is immediate.\n return null\n }\n\n // For runtime prefetches, stale time is in the payload at rp[1].\n // For other responses, fall back to the header.\n const staleTimeSeconds =\n typeof serverData.rp?.[1] === 'number'\n ? serverData.rp[1]\n : parseInt(response.headers.get(NEXT_ROUTER_STALE_TIME_HEADER) ?? '', 10)\n const staleTimeMs = !isNaN(staleTimeSeconds)\n ? getStaleTimeMs(staleTimeSeconds)\n : STATIC_STALETIME_MS\n const staleAt = now + staleTimeMs\n\n for (const flightData of flightDatas) {\n const seedData = flightData.seedData\n if (seedData !== null) {\n // The data sent by the server represents only a subtree of the app. We\n // need to find the part of the task tree that matches the response.\n //\n // segmentPath represents the parent path of subtree. It's a repeating\n // pattern of parallel route key and segment:\n //\n // [string, Segment, string, Segment, string, Segment, ...]\n const segmentPath = flightData.segmentPath\n let tree = route.tree\n for (let i = 0; i < segmentPath.length; i += 2) {\n const parallelRouteKey: string = segmentPath[i]\n if (tree?.slots?.[parallelRouteKey] !== undefined) {\n tree = tree.slots[parallelRouteKey]\n } else {\n if (spawnedEntries !== null) {\n rejectSegmentEntriesIfStillPending(spawnedEntries, now + 10 * 1000)\n }\n return null\n }\n }\n\n writeSeedDataIntoCache(\n now,\n task,\n fetchStrategy,\n route,\n tree,\n staleAt,\n seedData,\n isResponsePartial,\n spawnedEntries\n )\n }\n\n const head = flightData.head\n if (head !== null) {\n fulfillEntrySpawnedByRuntimePrefetch(\n now,\n fetchStrategy,\n route,\n head,\n null,\n flightData.isHeadPartial,\n staleAt,\n route.metadata,\n spawnedEntries\n )\n }\n }\n // Any entry that's still pending was intentionally not rendered by the\n // server, because it was inside the loading boundary. Mark them as rejected\n // so we know not to fetch them again.\n // TODO: If PPR is enabled on some routes but not others, then it's possible\n // that a different page is able to do a per-segment prefetch of one of the\n // segments we're marking as rejected here. We should mark on the segment\n // somehow that the reason for the rejection is because of a non-PPR prefetch.\n // That way a per-segment prefetch knows to disregard the rejection.\n if (spawnedEntries !== null) {\n const fulfilledEntries = rejectSegmentEntriesIfStillPending(\n spawnedEntries,\n now + 10 * 1000\n )\n return fulfilledEntries\n }\n return null\n}\n\nfunction writeSeedDataIntoCache(\n now: number,\n task: PrefetchTask,\n fetchStrategy:\n | FetchStrategy.LoadingBoundary\n | FetchStrategy.PPRRuntime\n | FetchStrategy.Full,\n route: FulfilledRouteCacheEntry,\n tree: RouteTree,\n staleAt: number,\n seedData: CacheNodeSeedData,\n isResponsePartial: boolean,\n entriesOwnedByCurrentTask: Map<\n SegmentRequestKey,\n PendingSegmentCacheEntry\n > | null\n) {\n // This function is used to write the result of a runtime server request\n // (CacheNodeSeedData) into the prefetch cache.\n const rsc = seedData[0]\n const loading = seedData[2]\n const isPartial = rsc === null || isResponsePartial\n fulfillEntrySpawnedByRuntimePrefetch(\n now,\n fetchStrategy,\n route,\n rsc,\n loading,\n isPartial,\n staleAt,\n tree,\n entriesOwnedByCurrentTask\n )\n\n // Recursively write the child data into the cache.\n const slots = tree.slots\n if (slots !== null) {\n const seedDataChildren = seedData[1]\n for (const parallelRouteKey in slots) {\n const childTree = slots[parallelRouteKey]\n const childSeedData: CacheNodeSeedData | null | void =\n seedDataChildren[parallelRouteKey]\n if (childSeedData !== null && childSeedData !== undefined) {\n writeSeedDataIntoCache(\n now,\n task,\n fetchStrategy,\n route,\n childTree,\n staleAt,\n childSeedData,\n isResponsePartial,\n entriesOwnedByCurrentTask\n )\n }\n }\n }\n}\n\nfunction fulfillEntrySpawnedByRuntimePrefetch(\n now: number,\n fetchStrategy:\n | FetchStrategy.LoadingBoundary\n | FetchStrategy.PPRRuntime\n | FetchStrategy.Full,\n route: FulfilledRouteCacheEntry,\n rsc: React.ReactNode,\n loading: LoadingModuleData | Promise<LoadingModuleData>,\n isPartial: boolean,\n staleAt: number,\n tree: RouteTree,\n entriesOwnedByCurrentTask: Map<\n SegmentRequestKey,\n PendingSegmentCacheEntry\n > | null\n) {\n // We should only write into cache entries that are owned by us. Or create\n // a new one and write into that. We must never write over an entry that was\n // created by a different task, because that causes data races.\n const ownedEntry =\n entriesOwnedByCurrentTask !== null\n ? entriesOwnedByCurrentTask.get(tree.requestKey)\n : undefined\n if (ownedEntry !== undefined) {\n fulfillSegmentCacheEntry(ownedEntry, rsc, loading, staleAt, isPartial)\n } else {\n // There's no matching entry. Attempt to create a new one.\n const possiblyNewEntry = readOrCreateSegmentCacheEntry(\n now,\n fetchStrategy,\n route,\n tree\n )\n if (possiblyNewEntry.status === EntryStatus.Empty) {\n // Confirmed this is a new entry. We can fulfill it.\n const newEntry = possiblyNewEntry\n fulfillSegmentCacheEntry(\n upgradeToPendingSegment(newEntry, fetchStrategy),\n rsc,\n loading,\n staleAt,\n isPartial\n )\n } else {\n // There was already an entry in the cache. But we may be able to\n // replace it with the new one from the server.\n const newEntry = fulfillSegmentCacheEntry(\n upgradeToPendingSegment(\n createDetachedSegmentCacheEntry(staleAt),\n fetchStrategy\n ),\n rsc,\n loading,\n staleAt,\n isPartial\n )\n upsertSegmentEntry(\n now,\n getSegmentVaryPathForRequest(fetchStrategy, tree),\n newEntry\n )\n }\n }\n}\n\nasync function fetchPrefetchResponse<T>(\n url: URL,\n headers: RequestHeaders\n): Promise<RSCResponse<T> | null> {\n const fetchPriority = 'low'\n // When issuing a prefetch request, don't immediately decode the response; we\n // use the lower level `createFromResponse` API instead because we need to do\n // some extra processing of the response stream. See\n // `createPrefetchResponseStream` for more details.\n const shouldImmediatelyDecode = false\n const response = await createFetch<T>(\n url,\n headers,\n fetchPriority,\n shouldImmediatelyDecode\n )\n if (!response.ok) {\n return null\n }\n\n // Check the content type\n if (isOutputExportMode) {\n // In output: \"export\" mode, we relaxed about the content type, since it's\n // not Next.js that's serving the response. If the status is OK, assume the\n // response is valid. If it's not a valid response, the Flight client won't\n // be able to decode it, and we'll treat it as a miss.\n } else {\n const contentType = response.headers.get('content-type')\n const isFlightResponse =\n contentType && contentType.startsWith(RSC_CONTENT_TYPE_HEADER)\n if (!isFlightResponse) {\n return null\n }\n }\n return response\n}\n\nfunction createPrefetchResponseStream(\n originalFlightStream: ReadableStream<Uint8Array>,\n onStreamClose: () => void,\n onResponseSizeUpdate: (size: number) => void\n): ReadableStream<Uint8Array> {\n // When PPR is enabled, prefetch streams may contain references that never\n // resolve, because that's how we encode dynamic data access. In the decoded\n // object returned by the Flight client, these are reified into hanging\n // promises that suspend during render, which is effectively what we want.\n // The UI resolves when it switches to the dynamic data stream\n // (via useDeferredValue(dynamic, static)).\n //\n // However, the Flight implementation currently errors if the server closes\n // the response before all the references are resolved. As a cheat to work\n // around this, we wrap the original stream in a new stream that never closes,\n // and therefore doesn't error.\n //\n // While processing the original stream, we also incrementally update the size\n // of the cache entry in the LRU.\n let totalByteLength = 0\n const reader = originalFlightStream.getReader()\n return new ReadableStream({\n async pull(controller) {\n while (true) {\n const { done, value } = await reader.read()\n if (!done) {\n // Pass to the target stream and keep consuming the Flight response\n // from the server.\n controller.enqueue(value)\n\n // Incrementally update the size of the cache entry in the LRU.\n // NOTE: Since prefetch responses are delivered in a single chunk,\n // it's not really necessary to do this streamingly, but I'm doing it\n // anyway in case this changes in the future.\n totalByteLength += value.byteLength\n onResponseSizeUpdate(totalByteLength)\n continue\n }\n // The server stream has closed. Exit, but intentionally do not close\n // the target stream. We do notify the caller, though.\n onStreamClose()\n return\n }\n },\n })\n}\n\nfunction addSegmentPathToUrlInOutputExportMode(\n url: URL,\n segmentPath: SegmentRequestKey\n): URL {\n if (isOutputExportMode) {\n // In output: \"export\" mode, we cannot use a header to encode the segment\n // path. Instead, we append it to the end of the pathname.\n const staticUrl = new URL(url)\n const routeDir = staticUrl.pathname.endsWith('/')\n ? staticUrl.pathname.slice(0, -1)\n : staticUrl.pathname\n const staticExportFilename =\n convertSegmentPathToStaticExportFilename(segmentPath)\n staticUrl.pathname = `${routeDir}/${staticExportFilename}`\n return staticUrl\n }\n return url\n}\n\n/**\n * Checks whether the new fetch strategy is likely to provide more content than the old one.\n *\n * Generally, when an app uses dynamic data, a \"more specific\" fetch strategy is expected to provide more content:\n * - `LoadingBoundary` only provides static layouts\n * - `PPR` can provide shells for each segment (even for segments that use dynamic data)\n * - `PPRRuntime` can additionally include content that uses searchParams, params, or cookies\n * - `Full` includes all the content, even if it uses dynamic data\n *\n * However, it's possible that a more specific fetch strategy *won't* give us more content if:\n * - a segment is fully static\n * (then, `PPR`/`PPRRuntime`/`Full` will all yield equivalent results)\n * - providing searchParams/params/cookies doesn't reveal any more content, e.g. because of an `await connection()`\n * (then, `PPR` and `PPRRuntime` will yield equivalent results, only `Full` will give us more)\n * Because of this, when comparing two segments, we should also check if the existing segment is partial.\n * If it's not partial, then there's no need to prefetch it again, even using a \"more specific\" strategy.\n * There's currently no way to know if `PPRRuntime` will yield more data that `PPR`, so we have to assume it will.\n *\n * Also note that, in practice, we don't expect to be comparing `LoadingBoundary` to `PPR`/`PPRRuntime`,\n * because a non-PPR-enabled route wouldn't ever use the latter strategies. It might however use `Full`.\n */\nexport function canNewFetchStrategyProvideMoreContent(\n currentStrategy: FetchStrategy,\n newStrategy: FetchStrategy\n): boolean {\n return currentStrategy < newStrategy\n}\n","import type {\n FlightRouterState,\n Segment as FlightRouterStateSegment,\n Segment,\n} from '../../../shared/lib/app-router-types'\nimport { HasLoadingBoundary } from '../../../shared/lib/app-router-types'\nimport { matchSegment } from '../match-segments'\nimport {\n readOrCreateRouteCacheEntry,\n readOrCreateSegmentCacheEntry,\n fetchRouteOnCacheMiss,\n fetchSegmentOnCacheMiss,\n EntryStatus,\n type FulfilledRouteCacheEntry,\n type RouteCacheEntry,\n type SegmentCacheEntry,\n type RouteTree,\n fetchSegmentPrefetchesUsingDynamicRequest,\n type PendingSegmentCacheEntry,\n convertRouteTreeToFlightRouterState,\n readOrCreateRevalidatingSegmentEntry,\n upsertSegmentEntry,\n type FulfilledSegmentCacheEntry,\n upgradeToPendingSegment,\n waitForSegmentCacheEntry,\n overwriteRevalidatingSegmentCacheEntry,\n canNewFetchStrategyProvideMoreContent,\n} from './cache'\nimport { getSegmentVaryPathForRequest, type SegmentVaryPath } from './vary-path'\nimport type { RouteCacheKey } from './cache-key'\nimport { createCacheKey } from './cache-key'\nimport {\n FetchStrategy,\n type PrefetchTaskFetchStrategy,\n PrefetchPriority,\n} from './types'\nimport { getCurrentCacheVersion } from './cache'\nimport {\n addSearchParamsIfPageSegment,\n PAGE_SEGMENT_KEY,\n} from '../../../shared/lib/segment'\nimport type { SegmentRequestKey } from '../../../shared/lib/segment-cache/segment-value-encoding'\n\nconst scheduleMicrotask =\n typeof queueMicrotask === 'function'\n ? queueMicrotask\n : (fn: () => unknown) =>\n Promise.resolve()\n .then(fn)\n .catch((error) =>\n setTimeout(() => {\n throw error\n })\n )\n\nexport type PrefetchTask = {\n key: RouteCacheKey\n\n /**\n * The FlightRouterState at the time the task was initiated. This is needed\n * when falling back to the non-PPR behavior, which only prefetches up to\n * the first loading boundary.\n */\n treeAtTimeOfPrefetch: FlightRouterState\n\n /**\n * The cache version at the time the task was initiated. This is used to\n * determine if the cache was invalidated since the task was initiated.\n */\n cacheVersion: number\n\n /**\n * Whether to prefetch dynamic data, in addition to static data. This is\n * used by `<Link prefetch={true}>`.\n *\n * Note that a task with `FetchStrategy.PPR` might need to use\n * `FetchStrategy.LoadingBoundary` instead if we find out that a route\n * does not support PPR after doing the initial route prefetch.\n */\n fetchStrategy: PrefetchTaskFetchStrategy\n\n /**\n * sortId is an incrementing counter\n *\n * Newer prefetches are prioritized over older ones, so that as new links\n * enter the viewport, they are not starved by older links that are no\n * longer relevant. In the future, we can add additional prioritization\n * heuristics, like removing prefetches once a link leaves the viewport.\n *\n * The sortId is assigned when the prefetch is initiated, and reassigned if\n * the same task is prefetched again (effectively bumping it to the top of\n * the queue).\n *\n * TODO: We can add additional fields here to indicate what kind of prefetch\n * it is. For example, was it initiated by a link? Or was it an imperative\n * call? If it was initiated by a link, we can remove it from the queue when\n * the link leaves the viewport, but if it was an imperative call, then we\n * should keep it in the queue until it's fulfilled.\n *\n * We can also add priority levels. For example, hovering over a link could\n * increase the priority of its prefetch.\n */\n sortId: number\n\n /**\n * The priority of the task. Like sortId, this affects the task's position in\n * the queue, so it must never be updated without resifting the heap.\n */\n priority: PrefetchPriority\n\n /**\n * The phase of the task. Tasks are split into multiple phases so that their\n * priority can be adjusted based on what kind of work they're doing.\n * Concretely, prefetching the route tree is higher priority than prefetching\n * segment data.\n */\n phase: PrefetchPhase\n\n /**\n * These fields are temporary state for tracking the currently running task.\n * They are reset after each iteration of the task queue.\n */\n hasBackgroundWork: boolean\n spawnedRuntimePrefetches: Set<SegmentRequestKey> | null\n\n /**\n * True if the prefetch was cancelled.\n */\n isCanceled: boolean\n\n /**\n * The callback passed to `router.prefetch`, if given.\n */\n onInvalidate: null | (() => void)\n\n /**\n * The index of the task in the heap's backing array. Used to efficiently\n * change the priority of a task by re-sifting it, which requires knowing\n * where it is in the array. This is only used internally by the heap\n * algorithm. The naive alternative is indexOf every time a task is queued,\n * which has O(n) complexity.\n *\n * We also use this field to check whether a task is currently in the queue.\n */\n _heapIndex: number\n}\n\nconst enum PrefetchTaskExitStatus {\n /**\n * The task yielded because there are too many requests in progress.\n */\n InProgress,\n\n /**\n * The task is blocked. It needs more data before it can proceed.\n *\n * Currently the only reason this happens is we're still waiting to receive a\n * route tree from the server, because we can't start prefetching the segments\n * until we know what to prefetch.\n */\n Blocked,\n\n /**\n * There's nothing left to prefetch.\n */\n Done,\n}\n\n/**\n * Prefetch tasks are processed in two phases: first the route tree is fetched,\n * then the segments. We use this to priortize tasks that have not yet fetched\n * the route tree.\n */\nconst enum PrefetchPhase {\n RouteTree = 1,\n Segments = 0,\n}\n\nexport type PrefetchSubtaskResult<T> = {\n /**\n * A promise that resolves when the network connection is closed.\n */\n closed: Promise<void>\n value: T\n}\n\nconst taskHeap: Array<PrefetchTask> = []\n\nlet inProgressRequests = 0\n\nlet sortIdCounter = 0\nlet didScheduleMicrotask = false\n\n// The most recently hovered (or touched, etc) link, i.e. the most recent task\n// scheduled at Intent priority. There's only ever a single task at Intent\n// priority at a time. We reserve special network bandwidth for this task only.\nlet mostRecentlyHoveredLink: PrefetchTask | null = null\n\n// CDN cache propagation delay after revalidation (in milliseconds)\nconst REVALIDATION_COOLDOWN_MS = 300\n\n// Timeout handle for the revalidation cooldown. When non-null, prefetch\n// requests are blocked to allow CDN cache propagation.\nlet revalidationCooldownTimeoutHandle: ReturnType<typeof setTimeout> | null =\n null\n\n/**\n * Called by the cache when revalidation occurs. Starts a cooldown period\n * during which prefetch requests are blocked to allow CDN cache propagation.\n */\nexport function startRevalidationCooldown(): void {\n // Clear any existing timeout in case multiple revalidations happen\n // in quick succession.\n if (revalidationCooldownTimeoutHandle !== null) {\n clearTimeout(revalidationCooldownTimeoutHandle)\n }\n\n // Schedule the cooldown to expire after the delay.\n revalidationCooldownTimeoutHandle = setTimeout(() => {\n revalidationCooldownTimeoutHandle = null\n // Retry the prefetch queue now that the cooldown has expired.\n ensureWorkIsScheduled()\n }, REVALIDATION_COOLDOWN_MS)\n}\n\nexport type IncludeDynamicData = null | 'full' | 'dynamic'\n\n/**\n * Initiates a prefetch task for the given URL. If a prefetch for the same URL\n * is already in progress, this will bump it to the top of the queue.\n *\n * This is not a user-facing function. By the time this is called, the href is\n * expected to be validated and normalized.\n *\n * @param key The RouteCacheKey to prefetch.\n * @param treeAtTimeOfPrefetch The app's current FlightRouterState\n * @param fetchStrategy Whether to prefetch dynamic data, in addition to\n * static data. This is used by `<Link prefetch={true}>`.\n */\nexport function schedulePrefetchTask(\n key: RouteCacheKey,\n treeAtTimeOfPrefetch: FlightRouterState,\n fetchStrategy: PrefetchTaskFetchStrategy,\n priority: PrefetchPriority,\n onInvalidate: null | (() => void)\n): PrefetchTask {\n // Spawn a new prefetch task\n const task: PrefetchTask = {\n key,\n treeAtTimeOfPrefetch,\n cacheVersion: getCurrentCacheVersion(),\n priority,\n phase: PrefetchPhase.RouteTree,\n hasBackgroundWork: false,\n spawnedRuntimePrefetches: null,\n fetchStrategy,\n sortId: sortIdCounter++,\n isCanceled: false,\n onInvalidate,\n _heapIndex: -1,\n }\n\n trackMostRecentlyHoveredLink(task)\n\n heapPush(taskHeap, task)\n\n // Schedule an async task to process the queue.\n //\n // The main reason we process the queue in an async task is for batching.\n // It's common for a single JS task/event to trigger multiple prefetches.\n // By deferring to a microtask, we only process the queue once per JS task.\n // If they have different priorities, it also ensures they are processed in\n // the optimal order.\n ensureWorkIsScheduled()\n\n return task\n}\n\nexport function cancelPrefetchTask(task: PrefetchTask): void {\n // Remove the prefetch task from the queue. If the task already completed,\n // then this is a no-op.\n //\n // We must also explicitly mark the task as canceled so that a blocked task\n // does not get added back to the queue when it's pinged by the network.\n task.isCanceled = true\n heapDelete(taskHeap, task)\n}\n\nexport function reschedulePrefetchTask(\n task: PrefetchTask,\n treeAtTimeOfPrefetch: FlightRouterState,\n fetchStrategy: PrefetchTaskFetchStrategy,\n priority: PrefetchPriority\n): void {\n // Bump the prefetch task to the top of the queue, as if it were a fresh\n // task. This is essentially the same as canceling the task and scheduling\n // a new one, except it reuses the original object.\n //\n // The primary use case is to increase the priority of a Link-initated\n // prefetch on hover.\n\n // Un-cancel the task, in case it was previously canceled.\n task.isCanceled = false\n task.phase = PrefetchPhase.RouteTree\n\n // Assign a new sort ID to move it ahead of all other tasks at the same\n // priority level. (Higher sort IDs are processed first.)\n task.sortId = sortIdCounter++\n task.priority =\n // If this task is the most recently hovered link, maintain its\n // Intent priority, even if the rescheduled priority is lower.\n task === mostRecentlyHoveredLink ? PrefetchPriority.Intent : priority\n\n task.treeAtTimeOfPrefetch = treeAtTimeOfPrefetch\n task.fetchStrategy = fetchStrategy\n\n trackMostRecentlyHoveredLink(task)\n\n if (task._heapIndex !== -1) {\n // The task is already in the queue.\n heapResift(taskHeap, task)\n } else {\n heapPush(taskHeap, task)\n }\n ensureWorkIsScheduled()\n}\n\nexport function isPrefetchTaskDirty(\n task: PrefetchTask,\n nextUrl: string | null,\n tree: FlightRouterState\n): boolean {\n // This is used to quickly bail out of a prefetch task if the result is\n // guaranteed to not have changed since the task was initiated. This is\n // strictly an optimization — theoretically, if it always returned true, no\n // behavior should change because a full prefetch task will effectively\n // perform the same checks.\n const currentCacheVersion = getCurrentCacheVersion()\n return (\n task.cacheVersion !== currentCacheVersion ||\n task.treeAtTimeOfPrefetch !== tree ||\n task.key.nextUrl !== nextUrl\n )\n}\n\nfunction trackMostRecentlyHoveredLink(task: PrefetchTask) {\n // Track the mostly recently hovered link, i.e. the most recently scheduled\n // task at Intent priority. There must only be one such task at a time.\n if (\n task.priority === PrefetchPriority.Intent &&\n task !== mostRecentlyHoveredLink\n ) {\n if (mostRecentlyHoveredLink !== null) {\n // Bump the previously hovered link's priority down to Default.\n if (mostRecentlyHoveredLink.priority !== PrefetchPriority.Background) {\n mostRecentlyHoveredLink.priority = PrefetchPriority.Default\n heapResift(taskHeap, mostRecentlyHoveredLink)\n }\n }\n mostRecentlyHoveredLink = task\n }\n}\n\nfunction ensureWorkIsScheduled() {\n if (didScheduleMicrotask) {\n // Already scheduled a task to process the queue\n return\n }\n didScheduleMicrotask = true\n scheduleMicrotask(processQueueInMicrotask)\n}\n\n/**\n * Checks if we've exceeded the maximum number of concurrent prefetch requests,\n * to avoid saturating the browser's internal network queue. This is a\n * cooperative limit — prefetch tasks should check this before issuing\n * new requests.\n *\n * Also checks if we're within the revalidation cooldown window, during which\n * prefetch requests are delayed to allow CDN cache propagation.\n */\nfunction hasNetworkBandwidth(task: PrefetchTask): boolean {\n // Check if we're within the revalidation cooldown window\n if (revalidationCooldownTimeoutHandle !== null) {\n // We're within the cooldown window. Return false to prevent prefetching.\n // When the cooldown expires, the timeout will call ensureWorkIsScheduled()\n // to retry the queue.\n return false\n }\n\n // TODO: Also check if there's an in-progress navigation. We should never\n // add prefetch requests to the network queue if an actual navigation is\n // taking place, to ensure there's sufficient bandwidth for render-blocking\n // data and resources.\n\n // TODO: Consider reserving some amount of bandwidth for static prefetches.\n\n if (task.priority === PrefetchPriority.Intent) {\n // The most recently hovered link is allowed to exceed the default limit.\n //\n // The goal is to always have enough bandwidth to start a new prefetch\n // request when hovering over a link.\n //\n // However, because we don't abort in-progress requests, it's still possible\n // we'll run out of bandwidth. When links are hovered in quick succession,\n // there could be multiple hover requests running simultaneously.\n return inProgressRequests < 12\n }\n\n // The default limit is lower than the limit for a hovered link.\n return inProgressRequests < 4\n}\n\nfunction spawnPrefetchSubtask<T>(\n prefetchSubtask: Promise<PrefetchSubtaskResult<T> | null>\n): Promise<T | null> {\n // When the scheduler spawns an async task, we don't await its result.\n // Instead, the async task writes its result directly into the cache, then\n // pings the scheduler to continue.\n //\n // We process server responses streamingly, so the prefetch subtask will\n // likely resolve before we're finished receiving all the data. The subtask\n // result includes a promise that resolves once the network connection is\n // closed. The scheduler uses this to control network bandwidth by tracking\n // and limiting the number of concurrent requests.\n inProgressRequests++\n return prefetchSubtask.then((result) => {\n if (result === null) {\n // The prefetch task errored before it could start processing the\n // network stream. Assume the connection is closed.\n onPrefetchConnectionClosed()\n return null\n }\n // Wait for the connection to close before freeing up more bandwidth.\n result.closed.then(onPrefetchConnectionClosed)\n return result.value\n })\n}\n\nfunction onPrefetchConnectionClosed(): void {\n inProgressRequests--\n\n // Notify the scheduler that we have more bandwidth, and can continue\n // processing tasks.\n ensureWorkIsScheduled()\n}\n\n/**\n * Notify the scheduler that we've received new data for an in-progress\n * prefetch. The corresponding task will be added back to the queue (unless the\n * task has been canceled in the meantime).\n */\nexport function pingPrefetchTask(task: PrefetchTask) {\n // \"Ping\" a prefetch that's already in progress to notify it of new data.\n if (\n // Check if prefetch was canceled.\n task.isCanceled ||\n // Check if prefetch is already queued.\n task._heapIndex !== -1\n ) {\n return\n }\n // Add the task back to the queue.\n heapPush(taskHeap, task)\n ensureWorkIsScheduled()\n}\n\nfunction processQueueInMicrotask() {\n didScheduleMicrotask = false\n\n // We aim to minimize how often we read the current time. Since nearly all\n // functions in the prefetch scheduler are synchronous, we can read the time\n // once and pass it as an argument wherever it's needed.\n const now = Date.now()\n\n // Process the task queue until we run out of network bandwidth.\n let task = heapPeek(taskHeap)\n while (task !== null && hasNetworkBandwidth(task)) {\n task.cacheVersion = getCurrentCacheVersion()\n\n const exitStatus = pingRoute(now, task)\n\n // These fields are only valid for a single attempt. Reset them after each\n // iteration of the task queue.\n const hasBackgroundWork = task.hasBackgroundWork\n task.hasBackgroundWork = false\n task.spawnedRuntimePrefetches = null\n\n switch (exitStatus) {\n case PrefetchTaskExitStatus.InProgress:\n // The task yielded because there are too many requests in progress.\n // Stop processing tasks until we have more bandwidth.\n return\n case PrefetchTaskExitStatus.Blocked:\n // The task is blocked. It needs more data before it can proceed.\n // Keep the task out of the queue until the server responds.\n heapPop(taskHeap)\n // Continue to the next task\n task = heapPeek(taskHeap)\n continue\n case PrefetchTaskExitStatus.Done:\n if (task.phase === PrefetchPhase.RouteTree) {\n // Finished prefetching the route tree. Proceed to prefetching\n // the segments.\n task.phase = PrefetchPhase.Segments\n heapResift(taskHeap, task)\n } else if (hasBackgroundWork) {\n // The task spawned additional background work. Reschedule the task\n // at background priority.\n task.priority = PrefetchPriority.Background\n heapResift(taskHeap, task)\n } else {\n // The prefetch is complete. Continue to the next task.\n heapPop(taskHeap)\n }\n task = heapPeek(taskHeap)\n continue\n default:\n exitStatus satisfies never\n }\n }\n}\n\n/**\n * Check this during a prefetch task to determine if background work can be\n * performed. If so, it evaluates to `true`. Otherwise, it returns `false`,\n * while also scheduling a background task to run later. Usage:\n *\n * @example\n * if (background(task)) {\n * // Perform background-pri work\n * }\n */\nfunction background(task: PrefetchTask): boolean {\n if (task.priority === PrefetchPriority.Background) {\n return true\n }\n task.hasBackgroundWork = true\n return false\n}\n\nfunction pingRoute(now: number, task: PrefetchTask): PrefetchTaskExitStatus {\n const key = task.key\n const route = readOrCreateRouteCacheEntry(now, task, key)\n const exitStatus = pingRootRouteTree(now, task, route)\n\n if (exitStatus !== PrefetchTaskExitStatus.InProgress && key.search !== '') {\n // If the URL has a non-empty search string, also prefetch the pathname\n // without the search string. We use the searchless route tree as a base for\n // optimistic routing; see requestOptimisticRouteCacheEntry for details.\n //\n // Note that we don't need to prefetch any of the segment data. Just the\n // route tree.\n //\n // TODO: This is a temporary solution; the plan is to replace this by adding\n // a wildcard lookup method to the TupleMap implementation. This is\n // non-trivial to implement because it needs to account for things like\n // fallback route entries, hence this temporary workaround.\n const url = new URL(key.pathname, location.origin)\n const keyWithoutSearch = createCacheKey(url.href, key.nextUrl)\n const routeWithoutSearch = readOrCreateRouteCacheEntry(\n now,\n task,\n keyWithoutSearch\n )\n switch (routeWithoutSearch.status) {\n case EntryStatus.Empty: {\n if (background(task)) {\n routeWithoutSearch.status = EntryStatus.Pending\n spawnPrefetchSubtask(\n fetchRouteOnCacheMiss(routeWithoutSearch, task, keyWithoutSearch)\n )\n }\n break\n }\n case EntryStatus.Pending:\n case EntryStatus.Fulfilled:\n case EntryStatus.Rejected: {\n // Either the route tree is already cached, or there's already a\n // request in progress. Since we don't need to fetch any segment data\n // for this route, there's nothing left to do.\n break\n }\n default:\n routeWithoutSearch satisfies never\n }\n }\n\n return exitStatus\n}\n\nfunction pingRootRouteTree(\n now: number,\n task: PrefetchTask,\n route: RouteCacheEntry\n): PrefetchTaskExitStatus {\n switch (route.status) {\n case EntryStatus.Empty: {\n // Route is not yet cached, and there's no request already in progress.\n // Spawn a task to request the route, load it into the cache, and ping\n // the task to continue.\n\n // TODO: There are multiple strategies in the <Link> API for prefetching\n // a route. Currently we've only implemented the main one: per-segment,\n // static-data only.\n //\n // There's also `<Link prefetch={true}>`\n // which prefetch both static *and* dynamic data.\n // Similarly, we need to fallback to the old, per-page\n // behavior if PPR is disabled for a route (via the incremental opt-in).\n //\n // Those cases will be handled here.\n spawnPrefetchSubtask(fetchRouteOnCacheMiss(route, task, task.key))\n\n // If the request takes longer than a minute, a subsequent request should\n // retry instead of waiting for this one. When the response is received,\n // this value will be replaced by a new value based on the stale time sent\n // from the server.\n // TODO: We should probably also manually abort the fetch task, to reclaim\n // server bandwidth.\n route.staleAt = now + 60 * 1000\n\n // Upgrade to Pending so we know there's already a request in progress\n route.status = EntryStatus.Pending\n\n // Intentional fallthrough to the Pending branch\n }\n case EntryStatus.Pending: {\n // Still pending. We can't start prefetching the segments until the route\n // tree has loaded. Add the task to the set of blocked tasks so that it\n // is notified when the route tree is ready.\n const blockedTasks = route.blockedTasks\n if (blockedTasks === null) {\n route.blockedTasks = new Set([task])\n } else {\n blockedTasks.add(task)\n }\n return PrefetchTaskExitStatus.Blocked\n }\n case EntryStatus.Rejected: {\n // Route tree failed to load. Treat as a 404.\n return PrefetchTaskExitStatus.Done\n }\n case EntryStatus.Fulfilled: {\n if (task.phase !== PrefetchPhase.Segments) {\n // Do not prefetch segment data until we've entered the segment phase.\n return PrefetchTaskExitStatus.Done\n }\n // Recursively fill in the segment tree.\n if (!hasNetworkBandwidth(task)) {\n // Stop prefetching segments until there's more bandwidth.\n return PrefetchTaskExitStatus.InProgress\n }\n const tree = route.tree\n\n // A task's fetch strategy gets set to `PPR` for any \"auto\" prefetch.\n // If it turned out that the route isn't PPR-enabled, we need to use `LoadingBoundary` instead.\n // We don't need to do this for runtime prefetches, because those are only available in\n // `cacheComponents`, where every route is PPR.\n const fetchStrategy =\n task.fetchStrategy === FetchStrategy.PPR\n ? route.isPPREnabled\n ? FetchStrategy.PPR\n : FetchStrategy.LoadingBoundary\n : task.fetchStrategy\n\n switch (fetchStrategy) {\n case FetchStrategy.PPR: {\n // For Cache Components pages, each segment may be prefetched\n // statically or using a runtime request, based on various\n // configurations and heuristics. We'll do this in two passes: first\n // traverse the tree and perform all the static prefetches.\n //\n // Then, if there are any segments that need a runtime request,\n // do another pass to perform a runtime prefetch.\n pingStaticHead(now, task, route)\n const exitStatus = pingSharedPartOfCacheComponentsTree(\n now,\n task,\n route,\n task.treeAtTimeOfPrefetch,\n tree\n )\n if (exitStatus === PrefetchTaskExitStatus.InProgress) {\n // Child yielded without finishing.\n return PrefetchTaskExitStatus.InProgress\n }\n const spawnedRuntimePrefetches = task.spawnedRuntimePrefetches\n if (spawnedRuntimePrefetches !== null) {\n // During the first pass, we discovered segments that require a\n // runtime prefetch. Do a second pass to construct a request tree.\n const spawnedEntries = new Map<\n SegmentRequestKey,\n PendingSegmentCacheEntry\n >()\n pingRuntimeHead(\n now,\n task,\n route,\n spawnedEntries,\n FetchStrategy.PPRRuntime\n )\n const requestTree = pingRuntimePrefetches(\n now,\n task,\n route,\n tree,\n spawnedRuntimePrefetches,\n spawnedEntries\n )\n let needsDynamicRequest = spawnedEntries.size > 0\n if (needsDynamicRequest) {\n // Perform a dynamic prefetch request and populate the cache with\n // the result.\n spawnPrefetchSubtask(\n fetchSegmentPrefetchesUsingDynamicRequest(\n task,\n route,\n FetchStrategy.PPRRuntime,\n requestTree,\n spawnedEntries\n )\n )\n }\n }\n return PrefetchTaskExitStatus.Done\n }\n case FetchStrategy.Full:\n case FetchStrategy.PPRRuntime:\n case FetchStrategy.LoadingBoundary: {\n // Prefetch multiple segments using a single dynamic request.\n // TODO: We can consolidate this branch with previous one by modeling\n // it as if the first segment in the new tree has runtime prefetching\n // enabled. Will do this as a follow-up refactor. Might want to remove\n // the special metatdata case below first. In the meantime, it's not\n // really that much duplication, just would be nice to remove one of\n // these codepaths.\n const spawnedEntries = new Map<\n SegmentRequestKey,\n PendingSegmentCacheEntry\n >()\n pingRuntimeHead(now, task, route, spawnedEntries, fetchStrategy)\n const dynamicRequestTree = diffRouteTreeAgainstCurrent(\n now,\n task,\n route,\n task.treeAtTimeOfPrefetch,\n tree,\n spawnedEntries,\n fetchStrategy\n )\n let needsDynamicRequest = spawnedEntries.size > 0\n if (needsDynamicRequest) {\n spawnPrefetchSubtask(\n fetchSegmentPrefetchesUsingDynamicRequest(\n task,\n route,\n fetchStrategy,\n dynamicRequestTree,\n spawnedEntries\n )\n )\n }\n return PrefetchTaskExitStatus.Done\n }\n default:\n fetchStrategy satisfies never\n }\n break\n }\n default: {\n route satisfies never\n }\n }\n return PrefetchTaskExitStatus.Done\n}\n\nfunction pingStaticHead(\n now: number,\n task: PrefetchTask,\n route: FulfilledRouteCacheEntry\n): void {\n // The Head data for a page (metadata, viewport) is not really a route\n // segment, in the sense that it doesn't appear in the route tree. But we\n // store it in the cache as if it were, using a special key.\n pingStaticSegmentData(\n now,\n task,\n route,\n readOrCreateSegmentCacheEntry(\n now,\n FetchStrategy.PPR,\n route,\n route.metadata\n ),\n task.key,\n route.metadata\n )\n}\n\nfunction pingRuntimeHead(\n now: number,\n task: PrefetchTask,\n route: FulfilledRouteCacheEntry,\n spawnedEntries: Map<SegmentRequestKey, PendingSegmentCacheEntry>,\n fetchStrategy:\n | FetchStrategy.Full\n | FetchStrategy.PPRRuntime\n | FetchStrategy.LoadingBoundary\n): void {\n pingRouteTreeAndIncludeDynamicData(\n now,\n task,\n route,\n route.metadata,\n false,\n spawnedEntries,\n // When prefetching the head, there's no difference between Full\n // and LoadingBoundary\n fetchStrategy === FetchStrategy.LoadingBoundary\n ? FetchStrategy.Full\n : fetchStrategy\n )\n}\n\n// TODO: Rename dynamic -> runtime throughout this module\n\nfunction pingSharedPartOfCacheComponentsTree(\n now: number,\n task: PrefetchTask,\n route: FulfilledRouteCacheEntry,\n oldTree: FlightRouterState,\n newTree: RouteTree\n): PrefetchTaskExitStatus {\n // When Cache Components is enabled (or PPR, or a fully static route when PPR\n // is disabled; those cases are treated equivalently to Cache Components), we\n // start by prefetching each segment individually. Once we reach the \"new\"\n // part of the tree — the part that doesn't exist on the current page — we\n // may choose to switch to a runtime prefetch instead, based on the\n // information sent by the server in the route tree.\n //\n // The traversal starts in the \"shared\" part of the tree. Once we reach the\n // \"new\" part of the tree, we switch to a different traversal,\n // pingNewPartOfCacheComponentsTree.\n\n // Prefetch this segment's static data.\n const segment = readOrCreateSegmentCacheEntry(\n now,\n task.fetchStrategy,\n route,\n newTree\n )\n pingStaticSegmentData(now, task, route, segment, task.key, newTree)\n\n // Recursively ping the children.\n const oldTreeChildren = oldTree[1]\n const newTreeChildren = newTree.slots\n if (newTreeChildren !== null) {\n for (const parallelRouteKey in newTreeChildren) {\n if (!hasNetworkBandwidth(task)) {\n // Stop prefetching segments until there's more bandwidth.\n return PrefetchTaskExitStatus.InProgress\n }\n const newTreeChild = newTreeChildren[parallelRouteKey]\n const newTreeChildSegment = newTreeChild.segment\n const oldTreeChild: FlightRouterState | void =\n oldTreeChildren[parallelRouteKey]\n const oldTreeChildSegment: FlightRouterStateSegment | void =\n oldTreeChild?.[0]\n let childExitStatus\n if (\n oldTreeChildSegment !== undefined &&\n doesCurrentSegmentMatchCachedSegment(\n route,\n newTreeChildSegment,\n oldTreeChildSegment\n )\n ) {\n // We're still in the \"shared\" part of the tree.\n childExitStatus = pingSharedPartOfCacheComponentsTree(\n now,\n task,\n route,\n oldTreeChild,\n newTreeChild\n )\n } else {\n // We've entered the \"new\" part of the tree. Switch\n // traversal functions.\n childExitStatus = pingNewPartOfCacheComponentsTree(\n now,\n task,\n route,\n newTreeChild\n )\n }\n if (childExitStatus === PrefetchTaskExitStatus.InProgress) {\n // Child yielded without finishing.\n return PrefetchTaskExitStatus.InProgress\n }\n }\n }\n\n return PrefetchTaskExitStatus.Done\n}\n\nfunction pingNewPartOfCacheComponentsTree(\n now: number,\n task: PrefetchTask,\n route: FulfilledRouteCacheEntry,\n tree: RouteTree\n): PrefetchTaskExitStatus.InProgress | PrefetchTaskExitStatus.Done {\n // We're now prefetching in the \"new\" part of the tree, the part that doesn't\n // exist on the current page. (In other words, we're deeper than the\n // shared layouts.) Segments in here default to being prefetched statically.\n // However, if the server instructs us to, we may switch to a runtime\n // prefetch instead. Traverse the tree and check at each segment.\n if (tree.hasRuntimePrefetch) {\n // This route has a runtime prefetch response. Since we're below the shared\n // layout, everything from this point should be prefetched using a single,\n // combined runtime request, rather than using per-segment static requests.\n // This is true even if some of the child segments are known to be fully\n // static — once we've decided to perform a runtime prefetch, we might as\n // well respond with the static segments in the same roundtrip. (That's how\n // regular navigations work, too.) We'll still skip over segments that are\n // already cached, though.\n //\n // It's the server's responsibility to set a reasonable value of\n // `hasRuntimePrefetch`. Currently it's user-defined, but eventually, the\n // server may send a value of `false` even if the user opts in, if it\n // determines during build that the route is always fully static. There are\n // more optimizations we can do once we implement fallback param\n // tracking, too.\n //\n // Use the task object to collect the segments that need a runtime prefetch.\n // This will signal to the outer task queue that a second traversal is\n // required to construct a request tree.\n if (task.spawnedRuntimePrefetches === null) {\n task.spawnedRuntimePrefetches = new Set([tree.requestKey])\n } else {\n task.spawnedRuntimePrefetches.add(tree.requestKey)\n }\n // Then exit the traversal without prefetching anything further.\n return PrefetchTaskExitStatus.Done\n }\n\n // This segment should not be runtime prefetched. Prefetch its static data.\n const segment = readOrCreateSegmentCacheEntry(\n now,\n task.fetchStrategy,\n route,\n tree\n )\n pingStaticSegmentData(now, task, route, segment, task.key, tree)\n if (tree.slots !== null) {\n if (!hasNetworkBandwidth(task)) {\n // Stop prefetching segments until there's more bandwidth.\n return PrefetchTaskExitStatus.InProgress\n }\n // Recursively ping the children.\n for (const parallelRouteKey in tree.slots) {\n const childTree = tree.slots[parallelRouteKey]\n const childExitStatus = pingNewPartOfCacheComponentsTree(\n now,\n task,\n route,\n childTree\n )\n if (childExitStatus === PrefetchTaskExitStatus.InProgress) {\n // Child yielded without finishing.\n return PrefetchTaskExitStatus.InProgress\n }\n }\n }\n // This segment and all its children have finished prefetching.\n return PrefetchTaskExitStatus.Done\n}\n\nfunction diffRouteTreeAgainstCurrent(\n now: number,\n task: PrefetchTask,\n route: FulfilledRouteCacheEntry,\n oldTree: FlightRouterState,\n newTree: RouteTree,\n spawnedEntries: Map<SegmentRequestKey, PendingSegmentCacheEntry>,\n fetchStrategy:\n | FetchStrategy.Full\n | FetchStrategy.PPRRuntime\n | FetchStrategy.LoadingBoundary\n): FlightRouterState {\n // This is a single recursive traversal that does multiple things:\n // - Finds the parts of the target route (newTree) that are not part of\n // of the current page (oldTree) by diffing them, using the same algorithm\n // as a real navigation.\n // - Constructs a request tree (FlightRouterState) that describes which\n // segments need to be prefetched and which ones are already cached.\n // - Creates a set of pending cache entries for the segments that need to\n // be prefetched, so that a subsequent prefetch task does not request the\n // same segments again.\n const oldTreeChildren = oldTree[1]\n const newTreeChildren = newTree.slots\n let requestTreeChildren: Record<string, FlightRouterState> = {}\n if (newTreeChildren !== null) {\n for (const parallelRouteKey in newTreeChildren) {\n const newTreeChild = newTreeChildren[parallelRouteKey]\n const newTreeChildSegment = newTreeChild.segment\n const oldTreeChild: FlightRouterState | void =\n oldTreeChildren[parallelRouteKey]\n const oldTreeChildSegment: FlightRouterStateSegment | void =\n oldTreeChild?.[0]\n if (\n oldTreeChildSegment !== undefined &&\n doesCurrentSegmentMatchCachedSegment(\n route,\n newTreeChildSegment,\n oldTreeChildSegment\n )\n ) {\n // This segment is already part of the current route. Keep traversing.\n const requestTreeChild = diffRouteTreeAgainstCurrent(\n now,\n task,\n route,\n oldTreeChild,\n newTreeChild,\n spawnedEntries,\n fetchStrategy\n )\n requestTreeChildren[parallelRouteKey] = requestTreeChild\n } else {\n // This segment is not part of the current route. We're entering a\n // part of the tree that we need to prefetch (unless everything is\n // already cached).\n switch (fetchStrategy) {\n case FetchStrategy.LoadingBoundary: {\n // When PPR is disabled, we can't prefetch per segment. We must\n // fallback to the old prefetch behavior and send a dynamic request.\n // Only routes that include a loading boundary can be prefetched in\n // this way.\n //\n // This is simlar to a \"full\" prefetch, but we're much more\n // conservative about which segments to include in the request.\n //\n // The server will only render up to the first loading boundary\n // inside new part of the tree. If there's no loading boundary\n // anywhere in the tree, the server will never return any data, so\n // we can skip the request.\n const subtreeHasLoadingBoundary =\n newTreeChild.hasLoadingBoundary !==\n HasLoadingBoundary.SubtreeHasNoLoadingBoundary\n const requestTreeChild = subtreeHasLoadingBoundary\n ? pingPPRDisabledRouteTreeUpToLoadingBoundary(\n now,\n task,\n route,\n newTreeChild,\n null,\n spawnedEntries\n )\n : // There's no loading boundary within this tree. Bail out.\n convertRouteTreeToFlightRouterState(newTreeChild)\n requestTreeChildren[parallelRouteKey] = requestTreeChild\n break\n }\n case FetchStrategy.PPRRuntime: {\n // This is a runtime prefetch. Fetch all cacheable data in the tree,\n // not just the static PPR shell.\n const requestTreeChild = pingRouteTreeAndIncludeDynamicData(\n now,\n task,\n route,\n newTreeChild,\n false,\n spawnedEntries,\n fetchStrategy\n )\n requestTreeChildren[parallelRouteKey] = requestTreeChild\n break\n }\n case FetchStrategy.Full: {\n // This is a \"full\" prefetch. Fetch all the data in the tree, both\n // static and dynamic. We issue roughly the same request that we\n // would during a real navigation. The goal is that once the\n // navigation occurs, the router should not have to fetch any\n // additional data.\n //\n // Although the response will include dynamic data, opting into a\n // Full prefetch — via <Link prefetch={true}> — implicitly\n // instructs the cache to treat the response as \"static\", or non-\n // dynamic, since the whole point is to cache it for\n // future navigations.\n //\n // Construct a tree (currently a FlightRouterState) that represents\n // which segments need to be prefetched and which ones are already\n // cached. If the tree is empty, then we can exit. Otherwise, we'll\n // send the request tree to the server and use the response to\n // populate the segment cache.\n const requestTreeChild = pingRouteTreeAndIncludeDynamicData(\n now,\n task,\n route,\n newTreeChild,\n false,\n spawnedEntries,\n fetchStrategy\n )\n requestTreeChildren[parallelRouteKey] = requestTreeChild\n break\n }\n default:\n fetchStrategy satisfies never\n }\n }\n }\n }\n const requestTree: FlightRouterState = [\n newTree.segment,\n requestTreeChildren,\n null,\n null,\n newTree.isRootLayout,\n ]\n return requestTree\n}\n\nfunction pingPPRDisabledRouteTreeUpToLoadingBoundary(\n now: number,\n task: PrefetchTask,\n route: FulfilledRouteCacheEntry,\n tree: RouteTree,\n refetchMarkerContext: 'refetch' | 'inside-shared-layout' | null,\n spawnedEntries: Map<SegmentRequestKey, PendingSegmentCacheEntry>\n): FlightRouterState {\n // This function is similar to pingRouteTreeAndIncludeDynamicData, except the\n // server is only going to return a minimal loading state — it will stop\n // rendering at the first loading boundary. Whereas a Full prefetch is\n // intentionally aggressive and tries to pretfetch all the data that will be\n // needed for a navigation, a LoadingBoundary prefetch is much more\n // conservative. For example, it will omit from the request tree any segment\n // that is already cached, regardles of whether it's partial or full. By\n // contrast, a Full prefetch will refetch partial segments.\n\n // \"inside-shared-layout\" tells the server where to start looking for a\n // loading boundary.\n let refetchMarker: 'refetch' | 'inside-shared-layout' | null =\n refetchMarkerContext === null ? 'inside-shared-layout' : null\n\n const segment = readOrCreateSegmentCacheEntry(\n now,\n task.fetchStrategy,\n route,\n tree\n )\n switch (segment.status) {\n case EntryStatus.Empty: {\n // This segment is not cached. Add a refetch marker so the server knows\n // to start rendering here.\n // TODO: Instead of a \"refetch\" marker, we could just omit this subtree's\n // FlightRouterState from the request tree. I think this would probably\n // already work even without any updates to the server. For consistency,\n // though, I'll send the full tree and we'll look into this later as part\n // of a larger redesign of the request protocol.\n\n // Add the pending cache entry to the result map.\n spawnedEntries.set(\n tree.requestKey,\n upgradeToPendingSegment(\n segment,\n // Set the fetch strategy to LoadingBoundary to indicate that the server\n // might not include it in the pending response. If another route is able\n // to issue a per-segment request, we'll do that in the background.\n FetchStrategy.LoadingBoundary\n )\n )\n if (refetchMarkerContext !== 'refetch') {\n refetchMarker = refetchMarkerContext = 'refetch'\n } else {\n // There's already a parent with a refetch marker, so we don't need\n // to add another one.\n }\n break\n }\n case EntryStatus.Fulfilled: {\n // The segment is already cached.\n const segmentHasLoadingBoundary =\n tree.hasLoadingBoundary === HasLoadingBoundary.SegmentHasLoadingBoundary\n if (segmentHasLoadingBoundary) {\n // This segment has a loading boundary, which means the server won't\n // render its children. So there's nothing left to prefetch along this\n // path. We can bail out.\n return convertRouteTreeToFlightRouterState(tree)\n }\n // NOTE: If the cached segment were fetched using PPR, then it might be\n // partial. We could get a more complete version of the segment by\n // including it in this non-PPR request.\n //\n // We're intentionally choosing not to, though, because it's generally\n // better to avoid doing a full prefetch whenever possible.\n break\n }\n case EntryStatus.Pending: {\n // There's another prefetch currently in progress. Don't add the refetch\n // marker yet, so the server knows it can skip rendering this segment.\n break\n }\n case EntryStatus.Rejected: {\n // The segment failed to load. We shouldn't issue another request until\n // the stale time has elapsed.\n break\n }\n default:\n segment satisfies never\n }\n const requestTreeChildren: Record<string, FlightRouterState> = {}\n if (tree.slots !== null) {\n for (const parallelRouteKey in tree.slots) {\n const childTree = tree.slots[parallelRouteKey]\n requestTreeChildren[parallelRouteKey] =\n pingPPRDisabledRouteTreeUpToLoadingBoundary(\n now,\n task,\n route,\n childTree,\n refetchMarkerContext,\n spawnedEntries\n )\n }\n }\n const requestTree: FlightRouterState = [\n tree.segment,\n requestTreeChildren,\n null,\n refetchMarker,\n tree.isRootLayout,\n ]\n return requestTree\n}\n\nfunction pingRouteTreeAndIncludeDynamicData(\n now: number,\n task: PrefetchTask,\n route: FulfilledRouteCacheEntry,\n tree: RouteTree,\n isInsideRefetchingParent: boolean,\n spawnedEntries: Map<SegmentRequestKey, PendingSegmentCacheEntry>,\n fetchStrategy: FetchStrategy.Full | FetchStrategy.PPRRuntime\n): FlightRouterState {\n // The tree we're constructing is the same shape as the tree we're navigating\n // to. But even though this is a \"new\" tree, some of the individual segments\n // may be cached as a result of other route prefetches.\n //\n // So we need to find the first uncached segment along each path add an\n // explicit \"refetch\" marker so the server knows where to start rendering.\n // Once the server starts rendering along a path, it keeps rendering the\n // entire subtree.\n const segment = readOrCreateSegmentCacheEntry(\n now,\n // Note that `fetchStrategy` might be different from `task.fetchStrategy`,\n // and we have to use the former here.\n // We can have a task with `FetchStrategy.PPR` where some of its segments are configured to\n // always use runtime prefetching (via `export const prefetch`), and those should check for\n // entries that include search params.\n fetchStrategy,\n route,\n tree\n )\n\n let spawnedSegment: PendingSegmentCacheEntry | null = null\n\n switch (segment.status) {\n case EntryStatus.Empty: {\n // This segment is not cached. Include it in the request.\n spawnedSegment = upgradeToPendingSegment(segment, fetchStrategy)\n break\n }\n case EntryStatus.Fulfilled: {\n // The segment is already cached.\n if (\n segment.isPartial &&\n canNewFetchStrategyProvideMoreContent(\n segment.fetchStrategy,\n fetchStrategy\n )\n ) {\n // The cached segment contains dynamic holes, and was prefetched using a less specific strategy than the current one.\n // This means we're in one of these cases:\n // - we have a static prefetch, and we're doing a runtime prefetch\n // - we have a static or runtime prefetch, and we're doing a Full prefetch (or a navigation).\n // In either case, we need to include it in the request to get a more specific (or full) version.\n spawnedSegment = pingFullSegmentRevalidation(\n now,\n route,\n tree,\n fetchStrategy\n )\n }\n break\n }\n case EntryStatus.Pending:\n case EntryStatus.Rejected: {\n // There's either another prefetch currently in progress, or the previous\n // attempt failed. If the new strategy can provide more content, fetch it again.\n if (\n canNewFetchStrategyProvideMoreContent(\n segment.fetchStrategy,\n fetchStrategy\n )\n ) {\n spawnedSegment = pingFullSegmentRevalidation(\n now,\n route,\n tree,\n fetchStrategy\n )\n }\n break\n }\n default:\n segment satisfies never\n }\n const requestTreeChildren: Record<string, FlightRouterState> = {}\n if (tree.slots !== null) {\n for (const parallelRouteKey in tree.slots) {\n const childTree = tree.slots[parallelRouteKey]\n requestTreeChildren[parallelRouteKey] =\n pingRouteTreeAndIncludeDynamicData(\n now,\n task,\n route,\n childTree,\n isInsideRefetchingParent || spawnedSegment !== null,\n spawnedEntries,\n fetchStrategy\n )\n }\n }\n\n if (spawnedSegment !== null) {\n // Add the pending entry to the result map.\n spawnedEntries.set(tree.requestKey, spawnedSegment)\n }\n\n // Don't bother to add a refetch marker if one is already present in a parent.\n const refetchMarker =\n !isInsideRefetchingParent && spawnedSegment !== null ? 'refetch' : null\n\n const requestTree: FlightRouterState = [\n tree.segment,\n requestTreeChildren,\n null,\n refetchMarker,\n tree.isRootLayout,\n ]\n return requestTree\n}\n\nfunction pingRuntimePrefetches(\n now: number,\n task: PrefetchTask,\n route: FulfilledRouteCacheEntry,\n tree: RouteTree,\n spawnedRuntimePrefetches: Set<SegmentRequestKey>,\n spawnedEntries: Map<SegmentRequestKey, PendingSegmentCacheEntry>\n): FlightRouterState {\n // Construct a request tree (FlightRouterState) for a runtime prefetch. If\n // a segment is part of the runtime prefetch, the tree is constructed by\n // diffing against what's already in the prefetch cache. Otherwise, we send\n // a regular FlightRouterState with no special markers.\n //\n // See pingRouteTreeAndIncludeDynamicData for details.\n if (spawnedRuntimePrefetches.has(tree.requestKey)) {\n // This segment needs a runtime prefetch.\n return pingRouteTreeAndIncludeDynamicData(\n now,\n task,\n route,\n tree,\n false,\n spawnedEntries,\n FetchStrategy.PPRRuntime\n )\n }\n let requestTreeChildren: Record<string, FlightRouterState> = {}\n const slots = tree.slots\n if (slots !== null) {\n for (const parallelRouteKey in slots) {\n const childTree = slots[parallelRouteKey]\n requestTreeChildren[parallelRouteKey] = pingRuntimePrefetches(\n now,\n task,\n route,\n childTree,\n spawnedRuntimePrefetches,\n spawnedEntries\n )\n }\n }\n\n // This segment is not part of the runtime prefetch. Clone the base tree.\n const requestTree: FlightRouterState = [\n tree.segment,\n requestTreeChildren,\n null,\n null,\n ]\n return requestTree\n}\n\nfunction pingStaticSegmentData(\n now: number,\n task: PrefetchTask,\n route: FulfilledRouteCacheEntry,\n segment: SegmentCacheEntry,\n routeKey: RouteCacheKey,\n tree: RouteTree\n): void {\n switch (segment.status) {\n case EntryStatus.Empty:\n // Upgrade to Pending so we know there's already a request in progress\n spawnPrefetchSubtask(\n fetchSegmentOnCacheMiss(\n route,\n upgradeToPendingSegment(segment, FetchStrategy.PPR),\n routeKey,\n tree\n )\n )\n break\n case EntryStatus.Pending: {\n // There's already a request in progress. Depending on what kind of\n // request it is, we may want to revalidate it.\n switch (segment.fetchStrategy) {\n case FetchStrategy.PPR:\n case FetchStrategy.PPRRuntime:\n case FetchStrategy.Full:\n // There's already a request in progress. Don't do anything.\n break\n case FetchStrategy.LoadingBoundary:\n // There's a pending request, but because it's using the old\n // prefetching strategy, we can't be sure if it will be fulfilled by\n // the response — it might be inside the loading boundary. Perform\n // a revalidation, but because it's speculative, wait to do it at\n // background priority.\n if (background(task)) {\n // TODO: Instead of speculatively revalidating, consider including\n // `hasLoading` in the route tree prefetch response.\n pingPPRSegmentRevalidation(now, route, routeKey, tree)\n }\n break\n default:\n segment.fetchStrategy satisfies never\n }\n break\n }\n case EntryStatus.Rejected: {\n // The existing entry in the cache was rejected. Depending on how it\n // was originally fetched, we may or may not want to revalidate it.\n switch (segment.fetchStrategy) {\n case FetchStrategy.PPR:\n case FetchStrategy.PPRRuntime:\n case FetchStrategy.Full:\n // The previous attempt to fetch this entry failed. Don't attempt to\n // fetch it again until the entry expires.\n break\n case FetchStrategy.LoadingBoundary:\n // There's a rejected entry, but it was fetched using the loading\n // boundary strategy. So the reason it wasn't returned by the server\n // might just be because it was inside a loading boundary. Or because\n // there was a dynamic rewrite. Revalidate it using the per-\n // segment strategy.\n //\n // Because a rejected segment will definitely prevent the segment (and\n // all of its children) from rendering, we perform this revalidation\n // immediately instead of deferring it to a background task.\n pingPPRSegmentRevalidation(now, route, routeKey, tree)\n break\n default:\n segment.fetchStrategy satisfies never\n }\n break\n }\n case EntryStatus.Fulfilled:\n // Segment is already cached. There's nothing left to prefetch.\n break\n default:\n segment satisfies never\n }\n\n // Segments do not have dependent tasks, so once the prefetch is initiated,\n // there's nothing else for us to do (except write the server data into the\n // entry, which is handled by `fetchSegmentOnCacheMiss`).\n}\n\nfunction pingPPRSegmentRevalidation(\n now: number,\n route: FulfilledRouteCacheEntry,\n routeKey: RouteCacheKey,\n tree: RouteTree\n): void {\n const revalidatingSegment = readOrCreateRevalidatingSegmentEntry(\n now,\n FetchStrategy.PPR,\n route,\n tree\n )\n switch (revalidatingSegment.status) {\n case EntryStatus.Empty:\n // Spawn a prefetch request and upsert the segment into the cache\n // upon completion.\n upsertSegmentOnCompletion(\n spawnPrefetchSubtask(\n fetchSegmentOnCacheMiss(\n route,\n upgradeToPendingSegment(revalidatingSegment, FetchStrategy.PPR),\n routeKey,\n tree\n )\n ),\n getSegmentVaryPathForRequest(FetchStrategy.PPR, tree)\n )\n break\n case EntryStatus.Pending:\n // There's already a revalidation in progress.\n break\n case EntryStatus.Fulfilled:\n case EntryStatus.Rejected:\n // A previous revalidation attempt finished, but we chose not to replace\n // the existing entry in the cache. Don't try again until or unless the\n // revalidation entry expires.\n break\n default:\n revalidatingSegment satisfies never\n }\n}\n\nfunction pingFullSegmentRevalidation(\n now: number,\n route: FulfilledRouteCacheEntry,\n tree: RouteTree,\n fetchStrategy: FetchStrategy.Full | FetchStrategy.PPRRuntime\n): PendingSegmentCacheEntry | null {\n const revalidatingSegment = readOrCreateRevalidatingSegmentEntry(\n now,\n fetchStrategy,\n route,\n tree\n )\n if (revalidatingSegment.status === EntryStatus.Empty) {\n // During a Full/PPRRuntime prefetch, a single dynamic request is made for all the\n // segments that we need. So we don't initiate a request here directly. By\n // returning a pending entry from this function, it signals to the caller\n // that this segment should be included in the request that's sent to\n // the server.\n const pendingSegment = upgradeToPendingSegment(\n revalidatingSegment,\n fetchStrategy\n )\n upsertSegmentOnCompletion(\n waitForSegmentCacheEntry(pendingSegment),\n getSegmentVaryPathForRequest(fetchStrategy, tree)\n )\n return pendingSegment\n } else {\n // There's already a revalidation in progress.\n const nonEmptyRevalidatingSegment = revalidatingSegment\n if (\n canNewFetchStrategyProvideMoreContent(\n nonEmptyRevalidatingSegment.fetchStrategy,\n fetchStrategy\n )\n ) {\n // The existing revalidation was fetched using a less specific strategy.\n // Reset it and start a new revalidation.\n const emptySegment = overwriteRevalidatingSegmentCacheEntry(\n fetchStrategy,\n route,\n tree\n )\n const pendingSegment = upgradeToPendingSegment(\n emptySegment,\n fetchStrategy\n )\n upsertSegmentOnCompletion(\n waitForSegmentCacheEntry(pendingSegment),\n getSegmentVaryPathForRequest(fetchStrategy, tree)\n )\n return pendingSegment\n }\n switch (nonEmptyRevalidatingSegment.status) {\n case EntryStatus.Pending:\n // There's already an in-progress prefetch that includes this segment.\n return null\n case EntryStatus.Fulfilled:\n case EntryStatus.Rejected:\n // A previous revalidation attempt finished, but we chose not to replace\n // the existing entry in the cache. Don't try again until or unless the\n // revalidation entry expires.\n return null\n default:\n nonEmptyRevalidatingSegment satisfies never\n return null\n }\n }\n}\n\nconst noop = () => {}\n\nfunction upsertSegmentOnCompletion(\n promise: Promise<FulfilledSegmentCacheEntry | null>,\n varyPath: SegmentVaryPath\n) {\n // Wait for a segment to finish loading, then upsert it into the cache\n promise.then((fulfilled) => {\n if (fulfilled !== null) {\n // Received new data. Attempt to replace the existing entry in the cache.\n upsertSegmentEntry(Date.now(), varyPath, fulfilled)\n }\n }, noop)\n}\n\nfunction doesCurrentSegmentMatchCachedSegment(\n route: FulfilledRouteCacheEntry,\n currentSegment: Segment,\n cachedSegment: Segment\n): boolean {\n if (cachedSegment === PAGE_SEGMENT_KEY) {\n // In the FlightRouterState stored by the router, the page segment has the\n // rendered search params appended to the name of the segment. In the\n // prefetch cache, however, this is stored separately. So, when comparing\n // the router's current FlightRouterState to the cached FlightRouterState,\n // we need to make sure we compare both parts of the segment.\n // TODO: This is not modeled clearly. We use the same type,\n // FlightRouterState, for both the CacheNode tree _and_ the prefetch cache\n // _and_ the server response format, when conceptually those are three\n // different things and treated in different ways. We should encode more of\n // this information into the type design so mistakes are less likely.\n return (\n currentSegment ===\n addSearchParamsIfPageSegment(\n PAGE_SEGMENT_KEY,\n Object.fromEntries(new URLSearchParams(route.renderedSearch))\n )\n )\n }\n // Non-page segments are compared using the same function as the server\n return matchSegment(cachedSegment, currentSegment)\n}\n\n// -----------------------------------------------------------------------------\n// The remainder of the module is a MinHeap implementation. Try not to put any\n// logic below here unless it's related to the heap algorithm. We can extract\n// this to a separate module if/when we need multiple kinds of heaps.\n// -----------------------------------------------------------------------------\n\nfunction compareQueuePriority(a: PrefetchTask, b: PrefetchTask) {\n // Since the queue is a MinHeap, this should return a positive number if b is\n // higher priority than a, and a negative number if a is higher priority\n // than b.\n\n // `priority` is an integer, where higher numbers are higher priority.\n const priorityDiff = b.priority - a.priority\n if (priorityDiff !== 0) {\n return priorityDiff\n }\n\n // If the priority is the same, check which phase the prefetch is in — is it\n // prefetching the route tree, or the segments? Route trees are prioritized.\n const phaseDiff = b.phase - a.phase\n if (phaseDiff !== 0) {\n return phaseDiff\n }\n\n // Finally, check the insertion order. `sortId` is an incrementing counter\n // assigned to prefetches. We want to process the newest prefetches first.\n return b.sortId - a.sortId\n}\n\nfunction heapPush(heap: Array<PrefetchTask>, node: PrefetchTask): void {\n const index = heap.length\n heap.push(node)\n node._heapIndex = index\n heapSiftUp(heap, node, index)\n}\n\nfunction heapPeek(heap: Array<PrefetchTask>): PrefetchTask | null {\n return heap.length === 0 ? null : heap[0]\n}\n\nfunction heapPop(heap: Array<PrefetchTask>): PrefetchTask | null {\n if (heap.length === 0) {\n return null\n }\n const first = heap[0]\n first._heapIndex = -1\n const last = heap.pop() as PrefetchTask\n if (last !== first) {\n heap[0] = last\n last._heapIndex = 0\n heapSiftDown(heap, last, 0)\n }\n return first\n}\n\nfunction heapDelete(heap: Array<PrefetchTask>, node: PrefetchTask): void {\n const index = node._heapIndex\n if (index !== -1) {\n node._heapIndex = -1\n if (heap.length !== 0) {\n const last = heap.pop() as PrefetchTask\n if (last !== node) {\n heap[index] = last\n last._heapIndex = index\n heapSiftDown(heap, last, index)\n }\n }\n }\n}\n\nfunction heapResift(heap: Array<PrefetchTask>, node: PrefetchTask): void {\n const index = node._heapIndex\n if (index !== -1) {\n if (index === 0) {\n heapSiftDown(heap, node, 0)\n } else {\n const parentIndex = (index - 1) >>> 1\n const parent = heap[parentIndex]\n if (compareQueuePriority(parent, node) > 0) {\n // The parent is larger. Sift up.\n heapSiftUp(heap, node, index)\n } else {\n // The parent is smaller (or equal). Sift down.\n heapSiftDown(heap, node, index)\n }\n }\n }\n}\n\nfunction heapSiftUp(\n heap: Array<PrefetchTask>,\n node: PrefetchTask,\n i: number\n): void {\n let index = i\n while (index > 0) {\n const parentIndex = (index - 1) >>> 1\n const parent = heap[parentIndex]\n if (compareQueuePriority(parent, node) > 0) {\n // The parent is larger. Swap positions.\n heap[parentIndex] = node\n node._heapIndex = parentIndex\n heap[index] = parent\n parent._heapIndex = index\n\n index = parentIndex\n } else {\n // The parent is smaller. Exit.\n return\n }\n }\n}\n\nfunction heapSiftDown(\n heap: Array<PrefetchTask>,\n node: PrefetchTask,\n i: number\n): void {\n let index = i\n const length = heap.length\n const halfLength = length >>> 1\n while (index < halfLength) {\n const leftIndex = (index + 1) * 2 - 1\n const left = heap[leftIndex]\n const rightIndex = leftIndex + 1\n const right = heap[rightIndex]\n\n // If the left or right node is smaller, swap with the smaller of those.\n if (compareQueuePriority(left, node) < 0) {\n if (rightIndex < length && compareQueuePriority(right, left) < 0) {\n heap[index] = right\n right._heapIndex = index\n heap[rightIndex] = node\n node._heapIndex = rightIndex\n\n index = rightIndex\n } else {\n heap[index] = left\n left._heapIndex = index\n heap[leftIndex] = node\n node._heapIndex = leftIndex\n\n index = leftIndex\n }\n } else if (rightIndex < length && compareQueuePriority(right, node) < 0) {\n heap[index] = right\n right._heapIndex = index\n heap[rightIndex] = node\n node._heapIndex = rightIndex\n\n index = rightIndex\n } else {\n // Neither child is smaller. Exit.\n return\n }\n }\n}\n","import type { FlightRouterState } from '../../shared/lib/app-router-types'\nimport type { AppRouterInstance } from '../../shared/lib/app-router-context.shared-runtime'\nimport {\n FetchStrategy,\n type PrefetchTaskFetchStrategy,\n PrefetchPriority,\n} from './segment-cache/types'\nimport { createCacheKey } from './segment-cache/cache-key'\nimport {\n type PrefetchTask,\n schedulePrefetchTask as scheduleSegmentPrefetchTask,\n cancelPrefetchTask,\n reschedulePrefetchTask,\n isPrefetchTaskDirty,\n} from './segment-cache/scheduler'\nimport { startTransition } from 'react'\n\ntype LinkElement = HTMLAnchorElement | SVGAElement\n\ntype Element = LinkElement | HTMLFormElement\n\n// Properties that are shared between Link and Form instances. We use the same\n// shape for both to prevent a polymorphic de-opt in the VM.\ntype LinkOrFormInstanceShared = {\n router: AppRouterInstance\n fetchStrategy: PrefetchTaskFetchStrategy\n\n isVisible: boolean\n\n // The most recently initiated prefetch task. It may or may not have\n // already completed. The same prefetch task object can be reused across\n // multiple prefetches of the same link.\n prefetchTask: PrefetchTask | null\n}\n\nexport type FormInstance = LinkOrFormInstanceShared & {\n prefetchHref: string\n setOptimisticLinkStatus: null\n}\n\ntype PrefetchableLinkInstance = LinkOrFormInstanceShared & {\n prefetchHref: string\n setOptimisticLinkStatus: (status: { pending: boolean }) => void\n}\n\ntype NonPrefetchableLinkInstance = LinkOrFormInstanceShared & {\n prefetchHref: null\n setOptimisticLinkStatus: (status: { pending: boolean }) => void\n}\n\ntype PrefetchableInstance = PrefetchableLinkInstance | FormInstance\n\nexport type LinkInstance =\n | PrefetchableLinkInstance\n | NonPrefetchableLinkInstance\n\n// Tracks the most recently navigated link instance. When null, indicates\n// the current navigation was not initiated by a link click.\nlet linkForMostRecentNavigation: LinkInstance | null = null\n\n// Status object indicating link is pending\nexport const PENDING_LINK_STATUS = { pending: true }\n\n// Status object indicating link is idle\nexport const IDLE_LINK_STATUS = { pending: false }\n\n// Updates the loading state when navigating between links\n// - Resets the previous link's loading state\n// - Sets the new link's loading state\n// - Updates tracking of current navigation\nexport function setLinkForCurrentNavigation(link: LinkInstance | null) {\n startTransition(() => {\n linkForMostRecentNavigation?.setOptimisticLinkStatus(IDLE_LINK_STATUS)\n link?.setOptimisticLinkStatus(PENDING_LINK_STATUS)\n linkForMostRecentNavigation = link\n })\n}\n\n// Unmounts the current link instance from navigation tracking\nexport function unmountLinkForCurrentNavigation(link: LinkInstance) {\n if (linkForMostRecentNavigation === link) {\n linkForMostRecentNavigation = null\n }\n}\n\n// Use a WeakMap to associate a Link instance with its DOM element. This is\n// used by the IntersectionObserver to track the link's visibility.\nconst prefetchable:\n | WeakMap<Element, PrefetchableInstance>\n | Map<Element, PrefetchableInstance> =\n typeof WeakMap === 'function' ? new WeakMap() : new Map()\n\n// A Set of the currently visible links. We re-prefetch visible links after a\n// cache invalidation, or when the current URL changes. It's a separate data\n// structure from the WeakMap above because only the visible links need to\n// be enumerated.\nconst prefetchableAndVisible: Set<PrefetchableInstance> = new Set()\n\n// A single IntersectionObserver instance shared by all <Link> components.\nconst observer: IntersectionObserver | null =\n typeof IntersectionObserver === 'function'\n ? new IntersectionObserver(handleIntersect, {\n rootMargin: '200px',\n })\n : null\n\nfunction observeVisibility(element: Element, instance: PrefetchableInstance) {\n const existingInstance = prefetchable.get(element)\n if (existingInstance !== undefined) {\n // This shouldn't happen because each <Link> component should have its own\n // anchor tag instance, but it's defensive coding to avoid a memory leak in\n // case there's a logical error somewhere else.\n unmountPrefetchableInstance(element)\n }\n // Only track prefetchable links that have a valid prefetch URL\n prefetchable.set(element, instance)\n if (observer !== null) {\n observer.observe(element)\n }\n}\n\nfunction coercePrefetchableUrl(href: string): URL | null {\n if (typeof window !== 'undefined') {\n const { createPrefetchURL } =\n require('./app-router-utils') as typeof import('./app-router-utils')\n\n try {\n return createPrefetchURL(href)\n } catch {\n // createPrefetchURL sometimes throws an error if an invalid URL is\n // provided, though I'm not sure if it's actually necessary.\n // TODO: Consider removing the throw from the inner function, or change it\n // to reportError. Or maybe the error isn't even necessary for automatic\n // prefetches, just navigations.\n const reportErrorFn =\n typeof reportError === 'function' ? reportError : console.error\n reportErrorFn(\n `Cannot prefetch '${href}' because it cannot be converted to a URL.`\n )\n return null\n }\n } else {\n return null\n }\n}\n\nexport function mountLinkInstance(\n element: LinkElement,\n href: string,\n router: AppRouterInstance,\n fetchStrategy: PrefetchTaskFetchStrategy,\n prefetchEnabled: boolean,\n setOptimisticLinkStatus: (status: { pending: boolean }) => void\n): LinkInstance {\n if (prefetchEnabled) {\n const prefetchURL = coercePrefetchableUrl(href)\n if (prefetchURL !== null) {\n const instance: PrefetchableLinkInstance = {\n router,\n fetchStrategy,\n isVisible: false,\n prefetchTask: null,\n prefetchHref: prefetchURL.href,\n setOptimisticLinkStatus,\n }\n // We only observe the link's visibility if it's prefetchable. For\n // example, this excludes links to external URLs.\n observeVisibility(element, instance)\n return instance\n }\n }\n // If the link is not prefetchable, we still create an instance so we can\n // track its optimistic state (i.e. useLinkStatus).\n const instance: NonPrefetchableLinkInstance = {\n router,\n fetchStrategy,\n isVisible: false,\n prefetchTask: null,\n prefetchHref: null,\n setOptimisticLinkStatus,\n }\n return instance\n}\n\nexport function mountFormInstance(\n element: HTMLFormElement,\n href: string,\n router: AppRouterInstance,\n fetchStrategy: PrefetchTaskFetchStrategy\n): void {\n const prefetchURL = coercePrefetchableUrl(href)\n if (prefetchURL === null) {\n // This href is not prefetchable, so we don't track it.\n // TODO: We currently observe/unobserve a form every time its href changes.\n // For Links, this isn't a big deal because the href doesn't usually change,\n // but for forms it's extremely common. We should optimize this.\n return\n }\n const instance: FormInstance = {\n router,\n fetchStrategy,\n isVisible: false,\n prefetchTask: null,\n prefetchHref: prefetchURL.href,\n setOptimisticLinkStatus: null,\n }\n observeVisibility(element, instance)\n}\n\nexport function unmountPrefetchableInstance(element: Element) {\n const instance = prefetchable.get(element)\n if (instance !== undefined) {\n prefetchable.delete(element)\n prefetchableAndVisible.delete(instance)\n const prefetchTask = instance.prefetchTask\n if (prefetchTask !== null) {\n cancelPrefetchTask(prefetchTask)\n }\n }\n if (observer !== null) {\n observer.unobserve(element)\n }\n}\n\nfunction handleIntersect(entries: Array<IntersectionObserverEntry>) {\n for (const entry of entries) {\n // Some extremely old browsers or polyfills don't reliably support\n // isIntersecting so we check intersectionRatio instead. (Do we care? Not\n // really. But whatever this is fine.)\n const isVisible = entry.intersectionRatio > 0\n onLinkVisibilityChanged(entry.target as HTMLAnchorElement, isVisible)\n }\n}\n\nexport function onLinkVisibilityChanged(element: Element, isVisible: boolean) {\n if (process.env.NODE_ENV !== 'production') {\n // Prefetching on viewport is disabled in development for performance\n // reasons, because it requires compiling the target page.\n // TODO: Investigate re-enabling this.\n return\n }\n\n const instance = prefetchable.get(element)\n if (instance === undefined) {\n return\n }\n\n instance.isVisible = isVisible\n if (isVisible) {\n prefetchableAndVisible.add(instance)\n } else {\n prefetchableAndVisible.delete(instance)\n }\n rescheduleLinkPrefetch(instance, PrefetchPriority.Default)\n}\n\nexport function onNavigationIntent(\n element: HTMLAnchorElement | SVGAElement,\n unstable_upgradeToDynamicPrefetch: boolean\n) {\n const instance = prefetchable.get(element)\n if (instance === undefined) {\n return\n }\n // Prefetch the link on hover/touchstart.\n if (instance !== undefined) {\n if (\n process.env.__NEXT_DYNAMIC_ON_HOVER &&\n unstable_upgradeToDynamicPrefetch\n ) {\n // Switch to a full prefetch\n instance.fetchStrategy = FetchStrategy.Full\n }\n rescheduleLinkPrefetch(instance, PrefetchPriority.Intent)\n }\n}\n\nfunction rescheduleLinkPrefetch(\n instance: PrefetchableInstance,\n priority: PrefetchPriority.Default | PrefetchPriority.Intent\n) {\n // Ensures that app-router-instance is not compiled in the server bundle\n if (typeof window !== 'undefined') {\n const existingPrefetchTask = instance.prefetchTask\n\n if (!instance.isVisible) {\n // Cancel any in-progress prefetch task. (If it already finished then this\n // is a no-op.)\n if (existingPrefetchTask !== null) {\n cancelPrefetchTask(existingPrefetchTask)\n }\n // We don't need to reset the prefetchTask to null upon cancellation; an\n // old task object can be rescheduled with reschedulePrefetchTask. This is a\n // micro-optimization but also makes the code simpler (don't need to\n // worry about whether an old task object is stale).\n return\n }\n\n const { getCurrentAppRouterState } =\n require('./app-router-instance') as typeof import('./app-router-instance')\n\n const appRouterState = getCurrentAppRouterState()\n if (appRouterState !== null) {\n const treeAtTimeOfPrefetch = appRouterState.tree\n if (existingPrefetchTask === null) {\n // Initiate a prefetch task.\n const nextUrl = appRouterState.nextUrl\n const cacheKey = createCacheKey(instance.prefetchHref, nextUrl)\n instance.prefetchTask = scheduleSegmentPrefetchTask(\n cacheKey,\n treeAtTimeOfPrefetch,\n instance.fetchStrategy,\n priority,\n null\n )\n } else {\n // We already have an old task object that we can reschedule. This is\n // effectively the same as canceling the old task and creating a new one.\n reschedulePrefetchTask(\n existingPrefetchTask,\n treeAtTimeOfPrefetch,\n instance.fetchStrategy,\n priority\n )\n }\n }\n }\n}\n\nexport function pingVisibleLinks(\n nextUrl: string | null,\n tree: FlightRouterState\n) {\n // For each currently visible link, cancel the existing prefetch task (if it\n // exists) and schedule a new one. This is effectively the same as if all the\n // visible links left and then re-entered the viewport.\n //\n // This is called when the Next-Url or the base tree changes, since those\n // may affect the result of a prefetch task. It's also called after a\n // cache invalidation.\n for (const instance of prefetchableAndVisible) {\n const task = instance.prefetchTask\n if (task !== null && !isPrefetchTaskDirty(task, nextUrl, tree)) {\n // The cache has not been invalidated, and none of the inputs have\n // changed. Bail out.\n continue\n }\n // Something changed. Cancel the existing prefetch task and schedule a\n // new one.\n if (task !== null) {\n cancelPrefetchTask(task)\n }\n const cacheKey = createCacheKey(instance.prefetchHref, nextUrl)\n instance.prefetchTask = scheduleSegmentPrefetchTask(\n cacheKey,\n tree,\n instance.fetchStrategy,\n PrefetchPriority.Default,\n null\n )\n }\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 { pathHasPrefix } from '../shared/lib/router/utils/path-has-prefix'\n\nconst basePath = (process.env.__NEXT_ROUTER_BASEPATH as string) || ''\n\nexport function hasBasePath(path: string): boolean {\n return pathHasPrefix(path, basePath)\n}\n","import { isAbsoluteUrl, getLocationOrigin } from '../../utils'\nimport { hasBasePath } from '../../../../client/has-base-path'\n\n/**\n * Detects whether a given url is routable by the Next.js router (browser only).\n */\nexport function isLocalURL(url: string): boolean {\n // prevent a hydration mismatch on href for url with anchor refs\n if (!isAbsoluteUrl(url)) return true\n try {\n // absolute urls can be local if they are on the same origin\n const locationOrigin = getLocationOrigin()\n const resolved = new URL(url, locationOrigin)\n return resolved.origin === locationOrigin && hasBasePath(resolved.pathname)\n } catch (_) {\n return false\n }\n}\n","let errorOnce = (_: string) => {}\nif (process.env.NODE_ENV !== 'production') {\n const errors = new Set<string>()\n errorOnce = (msg: string) => {\n if (!errors.has(msg)) {\n console.error(msg)\n }\n errors.add(msg)\n }\n}\n\nexport { errorOnce }\n","'use client'\n\nimport React, { createContext, useContext, useOptimistic, useRef } from 'react'\nimport type { UrlObject } from 'url'\nimport { formatUrl } from '../../shared/lib/router/utils/format-url'\nimport { AppRouterContext } from '../../shared/lib/app-router-context.shared-runtime'\nimport { useMergedRef } from '../use-merged-ref'\nimport { isAbsoluteUrl } from '../../shared/lib/utils'\nimport { addBasePath } from '../add-base-path'\nimport { warnOnce } from '../../shared/lib/utils/warn-once'\nimport type { PENDING_LINK_STATUS } from '../components/links'\nimport {\n IDLE_LINK_STATUS,\n mountLinkInstance,\n onNavigationIntent,\n unmountLinkForCurrentNavigation,\n unmountPrefetchableInstance,\n type LinkInstance,\n} from '../components/links'\nimport { isLocalURL } from '../../shared/lib/router/utils/is-local-url'\nimport {\n FetchStrategy,\n type PrefetchTaskFetchStrategy,\n} from '../components/segment-cache/types'\nimport { errorOnce } from '../../shared/lib/utils/error-once'\n\ntype Url = string | UrlObject\ntype RequiredKeys<T> = {\n [K in keyof T]-?: {} extends Pick<T, K> ? never : K\n}[keyof T]\ntype OptionalKeys<T> = {\n [K in keyof T]-?: {} extends Pick<T, K> ? K : never\n}[keyof T]\n\ntype OnNavigateEventHandler = (event: { preventDefault: () => void }) => void\n\ntype InternalLinkProps = {\n /**\n * **Required**. The path or URL to navigate to. It can also be an object (similar to `URL`).\n *\n * @example\n * ```tsx\n * // Navigate to /dashboard:\n * <Link href=\"/dashboard\">Dashboard</Link>\n *\n * // Navigate to /about?name=test:\n * <Link href={{ pathname: '/about', query: { name: 'test' } }}>\n * About\n * </Link>\n * ```\n *\n * @remarks\n * - For external URLs, use a fully qualified URL such as `https://...`.\n * - In the App Router, dynamic routes must not include bracketed segments in `href`.\n */\n href: Url\n\n /**\n * @deprecated v10.0.0: `href` props pointing to a dynamic route are\n * automatically resolved and no longer require the `as` prop.\n */\n as?: Url\n\n /**\n * Replace the current `history` state instead of adding a new URL into the stack.\n *\n * @defaultValue `false`\n *\n * @example\n * ```tsx\n * <Link href=\"/about\" replace>\n * About (replaces the history state)\n * </Link>\n * ```\n */\n replace?: boolean\n\n /**\n * Whether to override the default scroll behavior. If `true`, Next.js attempts to maintain\n * the scroll position if the newly navigated page is still visible. If not, it scrolls to the top.\n *\n * If `false`, Next.js will not modify the scroll behavior at all.\n *\n * @defaultValue `true`\n *\n * @example\n * ```tsx\n * <Link href=\"/dashboard\" scroll={false}>\n * No auto scroll\n * </Link>\n * ```\n */\n scroll?: boolean\n\n /**\n * Update the path of the current page without rerunning data fetching methods\n * like `getStaticProps`, `getServerSideProps`, or `getInitialProps`.\n *\n * @remarks\n * `shallow` only applies to the Pages Router. For the App Router, see the\n * [following documentation](https://nextjs.org/docs/app/building-your-application/routing/linking-and-navigating#using-the-native-history-api).\n *\n * @defaultValue `false`\n *\n * @example\n * ```tsx\n * <Link href=\"/blog\" shallow>\n * Shallow navigation\n * </Link>\n * ```\n */\n shallow?: boolean\n\n /**\n * Forces `Link` to pass its `href` to the child component. Useful if the child is a custom\n * component that wraps an `<a>` tag, or if you're using certain styling libraries.\n *\n * @defaultValue `false`\n *\n * @example\n * ```tsx\n * <Link href=\"/dashboard\" passHref legacyBehavior>\n * <MyStyledAnchor>Dashboard</MyStyledAnchor>\n * </Link>\n * ```\n */\n passHref?: boolean\n\n /**\n * Prefetch the page in the background.\n * Any `<Link />` that is in the viewport (initially or through scroll) will be prefetched.\n * Prefetch can be disabled by passing `prefetch={false}`.\n *\n * @remarks\n * Prefetching is only enabled in production.\n *\n * - In the **App Router**:\n * - `\"auto\"`, `null`, `undefined` (default): Prefetch behavior depends on static vs dynamic routes:\n * - Static routes: fully prefetched\n * - Dynamic routes: partial prefetch to the nearest segment with a `loading.js`\n * - `true`: Always prefetch the full route and data.\n * - `false`: Disable prefetching on both viewport and hover.\n * - In the **Pages Router**:\n * - `true` (default): Prefetches the route and data in the background on viewport or hover.\n * - `false`: Prefetch only on hover, not on viewport.\n *\n * @defaultValue `true` (Pages Router) or `null` (App Router)\n *\n * @example\n * ```tsx\n * <Link href=\"/dashboard\" prefetch={false}>\n * Dashboard\n * </Link>\n * ```\n */\n prefetch?: boolean | 'auto' | null\n\n /**\n * (unstable) Switch to a full prefetch on hover. Effectively the same as\n * updating the prefetch prop to `true` in a mouse event.\n */\n unstable_dynamicOnHover?: boolean\n\n /**\n * The active locale is automatically prepended in the Pages Router. `locale` allows for providing\n * a different locale, or can be set to `false` to opt out of automatic locale behavior.\n *\n * @remarks\n * Note: locale only applies in the Pages Router and is ignored in the App Router.\n *\n * @example\n * ```tsx\n * // Use the 'fr' locale:\n * <Link href=\"/about\" locale=\"fr\">\n * About (French)\n * </Link>\n *\n * // Disable locale prefix:\n * <Link href=\"/about\" locale={false}>\n * About (no locale prefix)\n * </Link>\n * ```\n */\n locale?: string | false\n\n /**\n * Enable legacy link behavior.\n *\n * @deprecated This will be removed in a future version\n * @defaultValue `false`\n * @see https://github.com/vercel/next.js/commit/489e65ed98544e69b0afd7e0cfc3f9f6c2b803b7\n */\n legacyBehavior?: boolean\n\n /**\n * Optional event handler for when the mouse pointer is moved onto the `<Link>`.\n */\n onMouseEnter?: React.MouseEventHandler<HTMLAnchorElement>\n\n /**\n * Optional event handler for when the `<Link>` is touched.\n */\n onTouchStart?: React.TouchEventHandler<HTMLAnchorElement>\n\n /**\n * Optional event handler for when the `<Link>` is clicked.\n */\n onClick?: React.MouseEventHandler<HTMLAnchorElement>\n\n /**\n * Optional event handler for when the `<Link>` is navigated.\n */\n onNavigate?: OnNavigateEventHandler\n}\n\n// TODO-APP: Include the full set of Anchor props\n// adding this to the publicly exported type currently breaks existing apps\n\n// `RouteInferType` is a stub here to avoid breaking `typedRoutes` when the type\n// isn't generated yet. It will be replaced when type generation runs.\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nexport type LinkProps<RouteInferType = any> = InternalLinkProps\ntype LinkPropsRequired = RequiredKeys<LinkProps>\ntype LinkPropsOptional = OptionalKeys<Omit<InternalLinkProps, 'locale'>>\n\nfunction isModifiedEvent(event: React.MouseEvent): boolean {\n const eventTarget = event.currentTarget as HTMLAnchorElement | SVGAElement\n const target = eventTarget.getAttribute('target')\n return (\n (target && target !== '_self') ||\n event.metaKey ||\n event.ctrlKey ||\n event.shiftKey ||\n event.altKey || // triggers resource download\n (event.nativeEvent && event.nativeEvent.which === 2)\n )\n}\n\nfunction linkClicked(\n e: React.MouseEvent,\n href: string,\n as: string,\n linkInstanceRef: React.RefObject<LinkInstance | null>,\n replace?: boolean,\n scroll?: boolean,\n onNavigate?: OnNavigateEventHandler\n): void {\n if (typeof window !== 'undefined') {\n const { nodeName } = e.currentTarget\n\n // anchors inside an svg have a lowercase nodeName\n const isAnchorNodeName = nodeName.toUpperCase() === 'A'\n if (\n (isAnchorNodeName && isModifiedEvent(e)) ||\n e.currentTarget.hasAttribute('download')\n ) {\n // ignore click for browser’s default behavior\n return\n }\n\n if (!isLocalURL(href)) {\n if (replace) {\n // browser default behavior does not replace the history state\n // so we need to do it manually\n e.preventDefault()\n location.replace(href)\n }\n\n // ignore click for browser’s default behavior\n return\n }\n\n e.preventDefault()\n\n if (onNavigate) {\n let isDefaultPrevented = false\n\n onNavigate({\n preventDefault: () => {\n isDefaultPrevented = true\n },\n })\n\n if (isDefaultPrevented) {\n return\n }\n }\n\n const { dispatchNavigateAction } =\n require('../components/app-router-instance') as typeof import('../components/app-router-instance')\n\n React.startTransition(() => {\n dispatchNavigateAction(\n as || href,\n replace ? 'replace' : 'push',\n scroll ?? true,\n linkInstanceRef.current\n )\n })\n }\n}\n\nfunction formatStringOrUrl(urlObjOrString: UrlObject | string): string {\n if (typeof urlObjOrString === 'string') {\n return urlObjOrString\n }\n\n return formatUrl(urlObjOrString)\n}\n\n/**\n * A React component that extends the HTML `<a>` element to provide\n * [prefetching](https://nextjs.org/docs/app/building-your-application/routing/linking-and-navigating#2-prefetching)\n * and client-side navigation. This is the primary way to navigate between routes in Next.js.\n *\n * @remarks\n * - Prefetching is only enabled in production.\n *\n * @see https://nextjs.org/docs/app/api-reference/components/link\n */\nexport default function LinkComponent(\n props: LinkProps & {\n children: React.ReactNode\n ref: React.Ref<HTMLAnchorElement>\n }\n) {\n const [linkStatus, setOptimisticLinkStatus] = useOptimistic(IDLE_LINK_STATUS)\n\n let children: React.ReactNode\n\n const linkInstanceRef = useRef<LinkInstance | null>(null)\n\n const {\n href: hrefProp,\n as: asProp,\n children: childrenProp,\n prefetch: prefetchProp = null,\n passHref,\n replace,\n shallow,\n scroll,\n onClick,\n onMouseEnter: onMouseEnterProp,\n onTouchStart: onTouchStartProp,\n legacyBehavior = false,\n onNavigate,\n ref: forwardedRef,\n unstable_dynamicOnHover,\n ...restProps\n } = props\n\n children = childrenProp\n\n if (\n legacyBehavior &&\n (typeof children === 'string' || typeof children === 'number')\n ) {\n children = <a>{children}</a>\n }\n\n const router = React.useContext(AppRouterContext)\n\n const prefetchEnabled = prefetchProp !== false\n\n const fetchStrategy =\n prefetchProp !== false\n ? getFetchStrategyFromPrefetchProp(prefetchProp)\n : // TODO: it makes no sense to assign a fetchStrategy when prefetching is disabled.\n FetchStrategy.PPR\n\n if (process.env.NODE_ENV !== 'production') {\n function createPropError(args: {\n key: string\n expected: string\n actual: string\n }) {\n return new Error(\n `Failed prop type: The prop \\`${args.key}\\` expects a ${args.expected} in \\`<Link>\\`, but got \\`${args.actual}\\` instead.` +\n (typeof window !== 'undefined'\n ? \"\\nOpen your browser's console to view the Component stack trace.\"\n : '')\n )\n }\n\n // TypeScript trick for type-guarding:\n const requiredPropsGuard: Record<LinkPropsRequired, true> = {\n href: true,\n } as const\n const requiredProps: LinkPropsRequired[] = Object.keys(\n requiredPropsGuard\n ) as LinkPropsRequired[]\n requiredProps.forEach((key: LinkPropsRequired) => {\n if (key === 'href') {\n if (\n props[key] == null ||\n (typeof props[key] !== 'string' && typeof props[key] !== 'object')\n ) {\n throw createPropError({\n key,\n expected: '`string` or `object`',\n actual: props[key] === null ? 'null' : typeof props[key],\n })\n }\n } else {\n // TypeScript trick for type-guarding:\n const _: never = key\n }\n })\n\n // TypeScript trick for type-guarding:\n const optionalPropsGuard: Record<LinkPropsOptional, true> = {\n as: true,\n replace: true,\n scroll: true,\n shallow: true,\n passHref: true,\n prefetch: true,\n unstable_dynamicOnHover: true,\n onClick: true,\n onMouseEnter: true,\n onTouchStart: true,\n legacyBehavior: true,\n onNavigate: true,\n } as const\n const optionalProps: LinkPropsOptional[] = Object.keys(\n optionalPropsGuard\n ) as LinkPropsOptional[]\n optionalProps.forEach((key: LinkPropsOptional) => {\n const valType = typeof props[key]\n\n if (key === 'as') {\n if (props[key] && valType !== 'string' && valType !== 'object') {\n throw createPropError({\n key,\n expected: '`string` or `object`',\n actual: valType,\n })\n }\n } else if (\n key === 'onClick' ||\n key === 'onMouseEnter' ||\n key === 'onTouchStart' ||\n key === 'onNavigate'\n ) {\n if (props[key] && valType !== 'function') {\n throw createPropError({\n key,\n expected: '`function`',\n actual: valType,\n })\n }\n } else if (\n key === 'replace' ||\n key === 'scroll' ||\n key === 'shallow' ||\n key === 'passHref' ||\n key === 'legacyBehavior' ||\n key === 'unstable_dynamicOnHover'\n ) {\n if (props[key] != null && valType !== 'boolean') {\n throw createPropError({\n key,\n expected: '`boolean`',\n actual: valType,\n })\n }\n } else if (key === 'prefetch') {\n if (\n props[key] != null &&\n valType !== 'boolean' &&\n props[key] !== 'auto'\n ) {\n throw createPropError({\n key,\n expected: '`boolean | \"auto\"`',\n actual: valType,\n })\n }\n } else {\n // TypeScript trick for type-guarding:\n const _: never = key\n }\n })\n }\n\n if (process.env.NODE_ENV !== 'production') {\n if (props.locale) {\n warnOnce(\n 'The `locale` prop is not supported in `next/link` while using the `app` router. Read more about app router internalization: https://nextjs.org/docs/app/building-your-application/routing/internationalization'\n )\n }\n if (!asProp) {\n let href: string | undefined\n if (typeof hrefProp === 'string') {\n href = hrefProp\n } else if (\n typeof hrefProp === 'object' &&\n typeof hrefProp.pathname === 'string'\n ) {\n href = hrefProp.pathname\n }\n\n if (href) {\n const hasDynamicSegment = href\n .split('/')\n .some((segment) => segment.startsWith('[') && segment.endsWith(']'))\n\n if (hasDynamicSegment) {\n throw new Error(\n `Dynamic href \\`${href}\\` found in <Link> while using the \\`/app\\` router, this is not supported. Read more: https://nextjs.org/docs/messages/app-dir-dynamic-href`\n )\n }\n }\n }\n }\n\n const { href, as } = React.useMemo(() => {\n const resolvedHref = formatStringOrUrl(hrefProp)\n return {\n href: resolvedHref,\n as: asProp ? formatStringOrUrl(asProp) : resolvedHref,\n }\n }, [hrefProp, asProp])\n\n // This will return the first child, if multiple are provided it will throw an error\n let child: any\n if (legacyBehavior) {\n if ((children as any)?.$$typeof === Symbol.for('react.lazy')) {\n throw new Error(\n `\\`<Link legacyBehavior>\\` received a direct child that is either a Server Component, or JSX that was loaded with React.lazy(). This is not supported. Either remove legacyBehavior, or make the direct child a Client Component that renders the Link's \\`<a>\\` tag.`\n )\n }\n\n if (process.env.NODE_ENV === 'development') {\n if (onClick) {\n console.warn(\n `\"onClick\" was passed to <Link> with \\`href\\` of \\`${hrefProp}\\` but \"legacyBehavior\" was set. The legacy behavior requires onClick be set on the child of next/link`\n )\n }\n if (onMouseEnterProp) {\n console.warn(\n `\"onMouseEnter\" was passed to <Link> with \\`href\\` of \\`${hrefProp}\\` but \"legacyBehavior\" was set. The legacy behavior requires onMouseEnter be set on the child of next/link`\n )\n }\n try {\n child = React.Children.only(children)\n } catch (err) {\n if (!children) {\n throw new Error(\n `No children were passed to <Link> with \\`href\\` of \\`${hrefProp}\\` but one child is required https://nextjs.org/docs/messages/link-no-children`\n )\n }\n throw new Error(\n `Multiple children were passed to <Link> with \\`href\\` of \\`${hrefProp}\\` but only one child is supported https://nextjs.org/docs/messages/link-multiple-children` +\n (typeof window !== 'undefined'\n ? \" \\nOpen your browser's console to view the Component stack trace.\"\n : '')\n )\n }\n } else {\n child = React.Children.only(children)\n }\n } else {\n if (process.env.NODE_ENV === 'development') {\n if ((children as any)?.type === 'a') {\n throw new Error(\n 'Invalid <Link> with <a> child. Please remove <a> or use <Link legacyBehavior>.\\nLearn more: https://nextjs.org/docs/messages/invalid-new-link-with-extra-anchor'\n )\n }\n }\n }\n\n const childRef: any = legacyBehavior\n ? child && typeof child === 'object' && child.ref\n : forwardedRef\n\n // Use a callback ref to attach an IntersectionObserver to the anchor tag on\n // mount. In the future we will also use this to keep track of all the\n // currently mounted <Link> instances, e.g. so we can re-prefetch them after\n // a revalidation or refresh.\n const observeLinkVisibilityOnMount = React.useCallback(\n (element: HTMLAnchorElement | SVGAElement) => {\n if (router !== null) {\n linkInstanceRef.current = mountLinkInstance(\n element,\n href,\n router,\n fetchStrategy,\n prefetchEnabled,\n setOptimisticLinkStatus\n )\n }\n\n return () => {\n if (linkInstanceRef.current) {\n unmountLinkForCurrentNavigation(linkInstanceRef.current)\n linkInstanceRef.current = null\n }\n unmountPrefetchableInstance(element)\n }\n },\n [prefetchEnabled, href, router, fetchStrategy, setOptimisticLinkStatus]\n )\n\n const mergedRef = useMergedRef(observeLinkVisibilityOnMount, childRef)\n\n const childProps: {\n onTouchStart?: React.TouchEventHandler<HTMLAnchorElement>\n onMouseEnter: React.MouseEventHandler<HTMLAnchorElement>\n onClick: React.MouseEventHandler<HTMLAnchorElement>\n href?: string\n ref?: any\n } = {\n ref: mergedRef,\n onClick(e) {\n if (process.env.NODE_ENV !== 'production') {\n if (!e) {\n throw new Error(\n `Component rendered inside next/link has to pass click event to \"onClick\" prop.`\n )\n }\n }\n\n if (!legacyBehavior && typeof onClick === 'function') {\n onClick(e)\n }\n\n if (\n legacyBehavior &&\n child.props &&\n typeof child.props.onClick === 'function'\n ) {\n child.props.onClick(e)\n }\n\n if (!router) {\n return\n }\n if (e.defaultPrevented) {\n return\n }\n linkClicked(e, href, as, linkInstanceRef, replace, scroll, onNavigate)\n },\n onMouseEnter(e) {\n if (!legacyBehavior && typeof onMouseEnterProp === 'function') {\n onMouseEnterProp(e)\n }\n\n if (\n legacyBehavior &&\n child.props &&\n typeof child.props.onMouseEnter === 'function'\n ) {\n child.props.onMouseEnter(e)\n }\n\n if (!router) {\n return\n }\n if (!prefetchEnabled || process.env.NODE_ENV === 'development') {\n return\n }\n\n const upgradeToDynamicPrefetch = unstable_dynamicOnHover === true\n onNavigationIntent(\n e.currentTarget as HTMLAnchorElement | SVGAElement,\n upgradeToDynamicPrefetch\n )\n },\n onTouchStart: process.env.__NEXT_LINK_NO_TOUCH_START\n ? undefined\n : function onTouchStart(e) {\n if (!legacyBehavior && typeof onTouchStartProp === 'function') {\n onTouchStartProp(e)\n }\n\n if (\n legacyBehavior &&\n child.props &&\n typeof child.props.onTouchStart === 'function'\n ) {\n child.props.onTouchStart(e)\n }\n\n if (!router) {\n return\n }\n if (!prefetchEnabled) {\n return\n }\n\n const upgradeToDynamicPrefetch = unstable_dynamicOnHover === true\n onNavigationIntent(\n e.currentTarget as HTMLAnchorElement | SVGAElement,\n upgradeToDynamicPrefetch\n )\n },\n }\n\n // If the url is absolute, we can bypass the logic to prepend the basePath.\n if (isAbsoluteUrl(as)) {\n childProps.href = as\n } else if (\n !legacyBehavior ||\n passHref ||\n (child.type === 'a' && !('href' in child.props))\n ) {\n childProps.href = addBasePath(as)\n }\n\n let link: React.ReactNode\n\n if (legacyBehavior) {\n if (process.env.NODE_ENV === 'development') {\n errorOnce(\n '`legacyBehavior` is deprecated and will be removed in a future ' +\n 'release. A codemod is available to upgrade your components:\\n\\n' +\n 'npx @next/codemod@latest new-link .\\n\\n' +\n 'Learn more: https://nextjs.org/docs/app/building-your-application/upgrading/codemods#remove-a-tags-from-link-components'\n )\n }\n link = React.cloneElement(child, childProps)\n } else {\n link = (\n <a {...restProps} {...childProps}>\n {children}\n </a>\n )\n }\n\n return (\n <LinkStatusContext.Provider value={linkStatus}>\n {link}\n </LinkStatusContext.Provider>\n )\n}\n\nconst LinkStatusContext = createContext<\n typeof PENDING_LINK_STATUS | typeof IDLE_LINK_STATUS\n>(IDLE_LINK_STATUS)\n\nexport const useLinkStatus = () => {\n return useContext(LinkStatusContext)\n}\n\nfunction getFetchStrategyFromPrefetchProp(\n prefetchProp: Exclude<LinkProps['prefetch'], undefined | false>\n): PrefetchTaskFetchStrategy {\n if (process.env.__NEXT_CACHE_COMPONENTS) {\n if (prefetchProp === true) {\n return FetchStrategy.Full\n }\n\n // `null` or `\"auto\"`: this is the default \"auto\" mode, where we will prefetch partially if the link is in the viewport.\n // This will also include invalid prop values that don't match the types specified here.\n // (although those should've been filtered out by prop validation in dev)\n prefetchProp satisfies null | 'auto'\n return FetchStrategy.PPR\n } else {\n return prefetchProp === null || prefetchProp === 'auto'\n ? // We default to PPR, and we'll discover whether or not the route supports it with the initial prefetch.\n FetchStrategy.PPR\n : // In the old implementation without runtime prefetches, `prefetch={true}` forces all dynamic data to be prefetched.\n // To preserve backwards-compatibility, anything other than `false`, `null`, or `\"auto\"` results in a full prefetch.\n // (although invalid values should've been filtered out by prop validation in dev)\n FetchStrategy.Full\n }\n}\n","/**\n * ReadonlyURLSearchParams implementation shared between client and server.\n * This file is intentionally not marked as 'use client' or 'use server'\n * so it can be imported by both environments.\n */\n\n/** @internal */\nclass ReadonlyURLSearchParamsError extends Error {\n constructor() {\n super(\n 'Method unavailable on `ReadonlyURLSearchParams`. Read more: https://nextjs.org/docs/app/api-reference/functions/use-search-params#updating-searchparams'\n )\n }\n}\n\n/**\n * A read-only version of URLSearchParams that throws errors when mutation methods are called.\n * This ensures that the URLSearchParams returned by useSearchParams() cannot be mutated.\n */\nexport class ReadonlyURLSearchParams extends URLSearchParams {\n /** @deprecated Method unavailable on `ReadonlyURLSearchParams`. Read more: https://nextjs.org/docs/app/api-reference/functions/use-search-params#updating-searchparams */\n append() {\n throw new ReadonlyURLSearchParamsError()\n }\n /** @deprecated Method unavailable on `ReadonlyURLSearchParams`. Read more: https://nextjs.org/docs/app/api-reference/functions/use-search-params#updating-searchparams */\n delete() {\n throw new ReadonlyURLSearchParamsError()\n }\n /** @deprecated Method unavailable on `ReadonlyURLSearchParams`. Read more: https://nextjs.org/docs/app/api-reference/functions/use-search-params#updating-searchparams */\n set() {\n throw new ReadonlyURLSearchParamsError()\n }\n /** @deprecated Method unavailable on `ReadonlyURLSearchParams`. Read more: https://nextjs.org/docs/app/api-reference/functions/use-search-params#updating-searchparams */\n sort() {\n throw new ReadonlyURLSearchParamsError()\n }\n}\n","export class UnrecognizedActionError extends Error {\n constructor(...args: ConstructorParameters<typeof Error>) {\n super(...args)\n this.name = 'UnrecognizedActionError'\n }\n}\n\n/**\n * Check whether a server action call failed because the server action was not recognized by the server.\n * This can happen if the client and the server are not from the same deployment.\n *\n * Example usage:\n * ```ts\n * try {\n * await myServerAction();\n * } catch (err) {\n * if (unstable_isUnrecognizedActionError(err)) {\n * // The client is from a different deployment than the server.\n * // Reloading the page will fix this mismatch.\n * window.alert(\"Please refresh the page and try again\");\n * return;\n * }\n * }\n * ```\n * */\nexport function unstable_isUnrecognizedActionError(\n error: unknown\n): error is UnrecognizedActionError {\n return !!(\n error &&\n typeof error === 'object' &&\n error instanceof UnrecognizedActionError\n )\n}\n","export enum RedirectStatusCode {\n SeeOther = 303,\n TemporaryRedirect = 307,\n PermanentRedirect = 308,\n}\n","import { RedirectStatusCode } from './redirect-status-code'\n\nexport const REDIRECT_ERROR_CODE = 'NEXT_REDIRECT'\n\nexport enum RedirectType {\n push = 'push',\n replace = 'replace',\n}\n\nexport type RedirectError = Error & {\n digest: `${typeof REDIRECT_ERROR_CODE};${RedirectType};${string};${RedirectStatusCode};`\n}\n\n/**\n * Checks an error to determine if it's an error generated by the\n * `redirect(url)` helper.\n *\n * @param error the error that may reference a redirect error\n * @returns true if the error is a redirect error\n */\nexport function isRedirectError(error: unknown): error is RedirectError {\n if (\n typeof error !== 'object' ||\n error === null ||\n !('digest' in error) ||\n typeof error.digest !== 'string'\n ) {\n return false\n }\n\n const digest = error.digest.split(';')\n const [errorCode, type] = digest\n const destination = digest.slice(2, -2).join(';')\n const status = digest.at(-2)\n\n const statusCode = Number(status)\n\n return (\n errorCode === REDIRECT_ERROR_CODE &&\n (type === 'replace' || type === 'push') &&\n typeof destination === 'string' &&\n !isNaN(statusCode) &&\n statusCode in RedirectStatusCode\n )\n}\n","import { RedirectStatusCode } from './redirect-status-code'\nimport {\n RedirectType,\n type RedirectError,\n isRedirectError,\n REDIRECT_ERROR_CODE,\n} from './redirect-error'\n\nconst actionAsyncStorage =\n typeof window === 'undefined'\n ? (\n require('../../server/app-render/action-async-storage.external') as typeof import('../../server/app-render/action-async-storage.external')\n ).actionAsyncStorage\n : undefined\n\nexport function getRedirectError(\n url: string,\n type: RedirectType,\n statusCode: RedirectStatusCode = RedirectStatusCode.TemporaryRedirect\n): RedirectError {\n const error = new Error(REDIRECT_ERROR_CODE) as RedirectError\n error.digest = `${REDIRECT_ERROR_CODE};${type};${url};${statusCode};`\n return error\n}\n\n/**\n * This function allows you to redirect the user to another URL. It can be used in\n * [Server Components](https://nextjs.org/docs/app/building-your-application/rendering/server-components),\n * [Route Handlers](https://nextjs.org/docs/app/building-your-application/routing/route-handlers), and\n * [Server Actions](https://nextjs.org/docs/app/building-your-application/data-fetching/server-actions-and-mutations).\n *\n * - In a Server Component, this will insert a meta tag to redirect the user to the target page.\n * - In a Route Handler or Server Action, it will serve a 307/303 to the caller.\n * - In a Server Action, type defaults to 'push' and 'replace' elsewhere.\n *\n * Read more: [Next.js Docs: `redirect`](https://nextjs.org/docs/app/api-reference/functions/redirect)\n */\nexport function redirect(\n /** The URL to redirect to */\n url: string,\n type?: RedirectType\n): never {\n type ??= actionAsyncStorage?.getStore()?.isAction\n ? RedirectType.push\n : RedirectType.replace\n\n throw getRedirectError(url, type, RedirectStatusCode.TemporaryRedirect)\n}\n\n/**\n * This function allows you to redirect the user to another URL. It can be used in\n * [Server Components](https://nextjs.org/docs/app/building-your-application/rendering/server-components),\n * [Route Handlers](https://nextjs.org/docs/app/building-your-application/routing/route-handlers), and\n * [Server Actions](https://nextjs.org/docs/app/building-your-application/data-fetching/server-actions-and-mutations).\n *\n * - In a Server Component, this will insert a meta tag to redirect the user to the target page.\n * - In a Route Handler or Server Action, it will serve a 308/303 to the caller.\n *\n * Read more: [Next.js Docs: `redirect`](https://nextjs.org/docs/app/api-reference/functions/redirect)\n */\nexport function permanentRedirect(\n /** The URL to redirect to */\n url: string,\n type: RedirectType = RedirectType.replace\n): never {\n throw getRedirectError(url, type, RedirectStatusCode.PermanentRedirect)\n}\n\n/**\n * Returns the encoded URL from the error if it's a RedirectError, null\n * otherwise. Note that this does not validate the URL returned.\n *\n * @param error the error that may be a redirect error\n * @return the url if the error was a redirect error\n */\nexport function getURLFromRedirectError(error: RedirectError): string\nexport function getURLFromRedirectError(error: unknown): string | null {\n if (!isRedirectError(error)) return null\n\n // Slices off the beginning of the digest that contains the code and the\n // separating ';'.\n return error.digest.split(';').slice(2, -2).join(';')\n}\n\nexport function getRedirectTypeFromError(error: RedirectError): RedirectType {\n if (!isRedirectError(error)) {\n throw new Error('Not a redirect error')\n }\n\n return error.digest.split(';', 2)[1] as RedirectType\n}\n\nexport function getRedirectStatusCodeFromError(error: RedirectError): number {\n if (!isRedirectError(error)) {\n throw new Error('Not a redirect error')\n }\n\n return Number(error.digest.split(';').at(-2))\n}\n","export const HTTPAccessErrorStatus = {\n NOT_FOUND: 404,\n FORBIDDEN: 403,\n UNAUTHORIZED: 401,\n}\n\nconst ALLOWED_CODES = new Set(Object.values(HTTPAccessErrorStatus))\n\nexport const HTTP_ERROR_FALLBACK_ERROR_CODE = 'NEXT_HTTP_ERROR_FALLBACK'\n\nexport type HTTPAccessFallbackError = Error & {\n digest: `${typeof HTTP_ERROR_FALLBACK_ERROR_CODE};${string}`\n}\n\n/**\n * Checks an error to determine if it's an error generated by\n * the HTTP navigation APIs `notFound()`, `forbidden()` or `unauthorized()`.\n *\n * @param error the error that may reference a HTTP access error\n * @returns true if the error is a HTTP access error\n */\nexport function isHTTPAccessFallbackError(\n error: unknown\n): error is HTTPAccessFallbackError {\n if (\n typeof error !== 'object' ||\n error === null ||\n !('digest' in error) ||\n typeof error.digest !== 'string'\n ) {\n return false\n }\n const [prefix, httpStatus] = error.digest.split(';')\n\n return (\n prefix === HTTP_ERROR_FALLBACK_ERROR_CODE &&\n ALLOWED_CODES.has(Number(httpStatus))\n )\n}\n\nexport function getAccessFallbackHTTPStatus(\n error: HTTPAccessFallbackError\n): number {\n const httpStatus = error.digest.split(';')[1]\n return Number(httpStatus)\n}\n\nexport function getAccessFallbackErrorTypeByStatus(\n status: number\n): 'not-found' | 'forbidden' | 'unauthorized' | undefined {\n switch (status) {\n case 401:\n return 'unauthorized'\n case 403:\n return 'forbidden'\n case 404:\n return 'not-found'\n default:\n return\n }\n}\n","import {\n HTTP_ERROR_FALLBACK_ERROR_CODE,\n type HTTPAccessFallbackError,\n} from './http-access-fallback/http-access-fallback'\n\n/**\n * This function allows you to render the [not-found.js file](https://nextjs.org/docs/app/api-reference/file-conventions/not-found)\n * within a route segment as well as inject a tag.\n *\n * `notFound()` can be used in\n * [Server Components](https://nextjs.org/docs/app/building-your-application/rendering/server-components),\n * [Route Handlers](https://nextjs.org/docs/app/building-your-application/routing/route-handlers), and\n * [Server Actions](https://nextjs.org/docs/app/building-your-application/data-fetching/server-actions-and-mutations).\n *\n * - In a Server Component, this will insert a `<meta name=\"robots\" content=\"noindex\" />` meta tag and set the status code to 404.\n * - In a Route Handler or Server Action, it will serve a 404 to the caller.\n *\n * Read more: [Next.js Docs: `notFound`](https://nextjs.org/docs/app/api-reference/functions/not-found)\n */\n\nconst DIGEST = `${HTTP_ERROR_FALLBACK_ERROR_CODE};404`\n\nexport function notFound(): never {\n const error = new Error(DIGEST) as HTTPAccessFallbackError\n ;(error as HTTPAccessFallbackError).digest = DIGEST\n\n throw error\n}\n","import {\n HTTP_ERROR_FALLBACK_ERROR_CODE,\n type HTTPAccessFallbackError,\n} from './http-access-fallback/http-access-fallback'\n\n// TODO: Add `forbidden` docs\n/**\n * @experimental\n * This function allows you to render the [forbidden.js file](https://nextjs.org/docs/app/api-reference/file-conventions/forbidden)\n * within a route segment as well as inject a tag.\n *\n * `forbidden()` can be used in\n * [Server Components](https://nextjs.org/docs/app/building-your-application/rendering/server-components),\n * [Route Handlers](https://nextjs.org/docs/app/building-your-application/routing/route-handlers), and\n * [Server Actions](https://nextjs.org/docs/app/building-your-application/data-fetching/server-actions-and-mutations).\n *\n * Read more: [Next.js Docs: `forbidden`](https://nextjs.org/docs/app/api-reference/functions/forbidden)\n */\n\nconst DIGEST = `${HTTP_ERROR_FALLBACK_ERROR_CODE};403`\n\nexport function forbidden(): never {\n if (!process.env.__NEXT_EXPERIMENTAL_AUTH_INTERRUPTS) {\n throw new Error(\n `\\`forbidden()\\` is experimental and only allowed to be enabled when \\`experimental.authInterrupts\\` is enabled.`\n )\n }\n\n const error = new Error(DIGEST) as HTTPAccessFallbackError\n ;(error as HTTPAccessFallbackError).digest = DIGEST\n throw error\n}\n","import {\n HTTP_ERROR_FALLBACK_ERROR_CODE,\n type HTTPAccessFallbackError,\n} from './http-access-fallback/http-access-fallback'\n\n// TODO: Add `unauthorized` docs\n/**\n * @experimental\n * This function allows you to render the [unauthorized.js file](https://nextjs.org/docs/app/api-reference/file-conventions/unauthorized)\n * within a route segment as well as inject a tag.\n *\n * `unauthorized()` can be used in\n * [Server Components](https://nextjs.org/docs/app/building-your-application/rendering/server-components),\n * [Route Handlers](https://nextjs.org/docs/app/building-your-application/routing/route-handlers), and\n * [Server Actions](https://nextjs.org/docs/app/building-your-application/data-fetching/server-actions-and-mutations).\n *\n *\n * Read more: [Next.js Docs: `unauthorized`](https://nextjs.org/docs/app/api-reference/functions/unauthorized)\n */\n\nconst DIGEST = `${HTTP_ERROR_FALLBACK_ERROR_CODE};401`\n\nexport function unauthorized(): never {\n if (!process.env.__NEXT_EXPERIMENTAL_AUTH_INTERRUPTS) {\n throw new Error(\n `\\`unauthorized()\\` is experimental and only allowed to be used when \\`experimental.authInterrupts\\` is enabled.`\n )\n }\n\n const error = new Error(DIGEST) as HTTPAccessFallbackError\n ;(error as HTTPAccessFallbackError).digest = DIGEST\n throw error\n}\n","import type { NonStaticRenderStage } from './app-render/staged-rendering'\nimport type { RequestStore } from './app-render/work-unit-async-storage.external'\n\nexport function isHangingPromiseRejectionError(\n err: unknown\n): err is HangingPromiseRejectionError {\n if (typeof err !== 'object' || err === null || !('digest' in err)) {\n return false\n }\n\n return err.digest === HANGING_PROMISE_REJECTION\n}\n\nconst HANGING_PROMISE_REJECTION = 'HANGING_PROMISE_REJECTION'\n\nclass HangingPromiseRejectionError extends Error {\n public readonly digest = HANGING_PROMISE_REJECTION\n\n constructor(\n public readonly route: string,\n public readonly expression: string\n ) {\n super(\n `During prerendering, ${expression} rejects when the prerender is complete. Typically these errors are handled by React but if you move ${expression} to a different context by using \\`setTimeout\\`, \\`after\\`, or similar functions you may observe this error and you should handle it in that context. This occurred at route \"${route}\".`\n )\n }\n}\n\ntype AbortListeners = Array<(err: unknown) => void>\nconst abortListenersBySignal = new WeakMap<AbortSignal, AbortListeners>()\n\n/**\n * This function constructs a promise that will never resolve. This is primarily\n * useful for cacheComponents where we use promise resolution timing to determine which\n * parts of a render can be included in a prerender.\n *\n * @internal\n */\nexport function makeHangingPromise<T>(\n signal: AbortSignal,\n route: string,\n expression: string\n): Promise<T> {\n if (signal.aborted) {\n return Promise.reject(new HangingPromiseRejectionError(route, expression))\n } else {\n const hangingPromise = new Promise<T>((_, reject) => {\n const boundRejection = reject.bind(\n null,\n new HangingPromiseRejectionError(route, expression)\n )\n let currentListeners = abortListenersBySignal.get(signal)\n if (currentListeners) {\n currentListeners.push(boundRejection)\n } else {\n const listeners = [boundRejection]\n abortListenersBySignal.set(signal, listeners)\n signal.addEventListener(\n 'abort',\n () => {\n for (let i = 0; i < listeners.length; i++) {\n listeners[i]()\n }\n },\n { once: true }\n )\n }\n })\n // We are fine if no one actually awaits this promise. We shouldn't consider this an unhandled rejection so\n // we attach a noop catch handler here to suppress this warning. If you actually await somewhere or construct\n // your own promise out of it you'll need to ensure you handle the error when it rejects.\n hangingPromise.catch(ignoreReject)\n return hangingPromise\n }\n}\n\nfunction ignoreReject() {}\n\nexport function makeDevtoolsIOAwarePromise<T>(\n underlying: T,\n requestStore: RequestStore,\n stage: NonStaticRenderStage\n): Promise<T> {\n if (requestStore.stagedRendering) {\n // We resolve each stage in a timeout, so React DevTools will pick this up as IO.\n return requestStore.stagedRendering.delayUntilStage(\n stage,\n undefined,\n underlying\n )\n }\n // in React DevTools if we resolve in a setTimeout we will observe\n // the promise resolution as something that can suspend a boundary or root.\n return new Promise<T>((resolve) => {\n // Must use setTimeout to be considered IO React DevTools. setImmediate will not work.\n setTimeout(() => {\n resolve(underlying)\n }, 0)\n })\n}\n","const REACT_POSTPONE_TYPE: symbol = Symbol.for('react.postpone')\n\nexport function isPostpone(error: any): boolean {\n return (\n typeof error === 'object' &&\n error !== null &&\n error.$$typeof === REACT_POSTPONE_TYPE\n )\n}\n","// This has to be a shared module which is shared between client component error boundary and dynamic component\nconst BAILOUT_TO_CSR = 'BAILOUT_TO_CLIENT_SIDE_RENDERING'\n\n/** An error that should be thrown when we want to bail out to client-side rendering. */\nexport class BailoutToCSRError extends Error {\n public readonly digest = BAILOUT_TO_CSR\n\n constructor(public readonly reason: string) {\n super(`Bail out to client-side rendering: ${reason}`)\n }\n}\n\n/** Checks if a passed argument is an error that is thrown if we want to bail out to client-side rendering. */\nexport function isBailoutToCSRError(err: unknown): err is BailoutToCSRError {\n if (typeof err !== 'object' || err === null || !('digest' in err)) {\n return false\n }\n\n return err.digest === BAILOUT_TO_CSR\n}\n","import {\n isHTTPAccessFallbackError,\n type HTTPAccessFallbackError,\n} from './http-access-fallback/http-access-fallback'\nimport { isRedirectError, type RedirectError } from './redirect-error'\n\n/**\n * Returns true if the error is a navigation signal error. These errors are\n * thrown by user code to perform navigation operations and interrupt the React\n * render.\n */\nexport function isNextRouterError(\n error: unknown\n): error is RedirectError | HTTPAccessFallbackError {\n return isRedirectError(error) || isHTTPAccessFallbackError(error)\n}\n","const DYNAMIC_ERROR_CODE = 'DYNAMIC_SERVER_USAGE'\n\nexport class DynamicServerError extends Error {\n digest: typeof DYNAMIC_ERROR_CODE = DYNAMIC_ERROR_CODE\n\n constructor(public readonly description: string) {\n super(`Dynamic server usage: ${description}`)\n }\n}\n\nexport function isDynamicServerError(err: unknown): err is DynamicServerError {\n if (\n typeof err !== 'object' ||\n err === null ||\n !('digest' in err) ||\n typeof err.digest !== 'string'\n ) {\n return false\n }\n\n return err.digest === DYNAMIC_ERROR_CODE\n}\n","const NEXT_STATIC_GEN_BAILOUT = 'NEXT_STATIC_GEN_BAILOUT'\n\nexport class StaticGenBailoutError extends Error {\n public readonly code = NEXT_STATIC_GEN_BAILOUT\n}\n\nexport function isStaticGenBailoutError(\n error: unknown\n): error is StaticGenBailoutError {\n if (typeof error !== 'object' || error === null || !('code' in error)) {\n return false\n }\n\n return error.code === NEXT_STATIC_GEN_BAILOUT\n}\n","export const METADATA_BOUNDARY_NAME = '__next_metadata_boundary__'\nexport const VIEWPORT_BOUNDARY_NAME = '__next_viewport_boundary__'\nexport const OUTLET_BOUNDARY_NAME = '__next_outlet_boundary__'\nexport const ROOT_LAYOUT_BOUNDARY_NAME = '__next_root_layout_boundary__'\n","export type ScheduledFn<T = void> = () => T | PromiseLike<T>\nexport type SchedulerFn<T = void> = (cb: ScheduledFn<T>) => void\n\n/**\n * Schedules a function to be called on the next tick after the other promises\n * have been resolved.\n *\n * @param cb the function to schedule\n */\nexport const scheduleOnNextTick = (cb: ScheduledFn<void>) => {\n // We use Promise.resolve().then() here so that the operation is scheduled at\n // the end of the promise job queue, we then add it to the next process tick\n // to ensure it's evaluated afterwards.\n //\n // This was inspired by the implementation of the DataLoader interface: https://github.com/graphql/dataloader/blob/d336bd15282664e0be4b4a657cb796f09bafbc6b/src/index.js#L213-L255\n //\n Promise.resolve().then(() => {\n if (process.env.NEXT_RUNTIME === 'edge') {\n setTimeout(cb, 0)\n } else {\n process.nextTick(cb)\n }\n })\n}\n\n/**\n * Schedules a function to be called using `setImmediate` or `setTimeout` if\n * `setImmediate` is not available (like in the Edge runtime).\n *\n * @param cb the function to schedule\n */\nexport const scheduleImmediate = (cb: ScheduledFn<void>): void => {\n if (process.env.NEXT_RUNTIME === 'edge') {\n setTimeout(cb, 0)\n } else {\n setImmediate(cb)\n }\n}\n\n/**\n * returns a promise than resolves in a future task. There is no guarantee that the task it resolves in\n * will be the next task but if you await it you can at least be sure that the current task is over and\n * most usefully that the entire microtask queue of the current task has been emptied.\n */\nexport function atLeastOneTask() {\n return new Promise<void>((resolve) => scheduleImmediate(resolve))\n}\n\n/**\n * This utility function is extracted to make it easier to find places where we are doing\n * specific timing tricks to try to schedule work after React has rendered. This is especially\n * important at the moment because Next.js uses the edge builds of React which use setTimeout to\n * schedule work when you might expect that something like setImmediate would do the trick.\n *\n * Long term we should switch to the node versions of React rendering when possible and then\n * update this to use setImmediate rather than setTimeout\n */\nexport function waitAtLeastOneReactRenderTask(): Promise<void> {\n if (process.env.NEXT_RUNTIME === 'edge') {\n return new Promise((r) => setTimeout(r, 0))\n } else {\n return new Promise((r) => setImmediate(r))\n }\n}\n","export class InvariantError extends Error {\n constructor(message: string, options?: ErrorOptions) {\n super(\n `Invariant: ${message.endsWith('.') ? message : message + '.'} This is a bug in Next.js.`,\n options\n )\n this.name = 'InvariantError'\n }\n}\n","import { InvariantError } from '../../shared/lib/invariant-error'\nimport { createPromiseWithResolvers } from '../../shared/lib/promise-with-resolvers'\n\nexport enum RenderStage {\n Static = 1,\n Runtime = 2,\n Dynamic = 3,\n}\n\nexport type NonStaticRenderStage = RenderStage.Runtime | RenderStage.Dynamic\n\nexport class StagedRenderingController {\n currentStage: RenderStage = RenderStage.Static\n\n private runtimeStagePromise = createPromiseWithResolvers<void>()\n private dynamicStagePromise = createPromiseWithResolvers<void>()\n\n constructor(private abortSignal: AbortSignal | null = null) {\n if (abortSignal) {\n abortSignal.addEventListener(\n 'abort',\n () => {\n const { reason } = abortSignal\n if (this.currentStage < RenderStage.Runtime) {\n this.runtimeStagePromise.promise.catch(ignoreReject) // avoid unhandled rejections\n this.runtimeStagePromise.reject(reason)\n }\n if (this.currentStage < RenderStage.Dynamic) {\n this.dynamicStagePromise.promise.catch(ignoreReject) // avoid unhandled rejections\n this.dynamicStagePromise.reject(reason)\n }\n },\n { once: true }\n )\n }\n }\n\n advanceStage(stage: NonStaticRenderStage) {\n // If we're already at the target stage or beyond, do nothing.\n // (this can happen e.g. if sync IO advanced us to the dynamic stage)\n if (this.currentStage >= stage) {\n return\n }\n this.currentStage = stage\n // Note that we might be going directly from Static to Dynamic,\n // so we need to resolve the runtime stage as well.\n if (stage >= RenderStage.Runtime) {\n this.runtimeStagePromise.resolve()\n }\n if (stage >= RenderStage.Dynamic) {\n this.dynamicStagePromise.resolve()\n }\n }\n\n private getStagePromise(stage: NonStaticRenderStage): Promise<void> {\n switch (stage) {\n case RenderStage.Runtime: {\n return this.runtimeStagePromise.promise\n }\n case RenderStage.Dynamic: {\n return this.dynamicStagePromise.promise\n }\n default: {\n stage satisfies never\n throw new InvariantError(`Invalid render stage: ${stage}`)\n }\n }\n }\n\n waitForStage(stage: NonStaticRenderStage) {\n return this.getStagePromise(stage)\n }\n\n delayUntilStage<T>(\n stage: NonStaticRenderStage,\n displayName: string | undefined,\n resolvedValue: T\n ) {\n const ioTriggerPromise = this.getStagePromise(stage)\n\n const promise = makeDevtoolsIOPromiseFromIOTrigger(\n ioTriggerPromise,\n displayName,\n resolvedValue\n )\n\n // Analogously to `makeHangingPromise`, we might reject this promise if the signal is invoked.\n // (e.g. in the case where we don't want want the render to proceed to the dynamic stage and abort it).\n // We shouldn't consider this an unhandled rejection, so we attach a noop catch handler here to suppress this warning.\n if (this.abortSignal) {\n promise.catch(ignoreReject)\n }\n return promise\n }\n}\n\nfunction ignoreReject() {}\n\n// TODO(restart-on-cache-miss): the layering of `delayUntilStage`,\n// `makeDevtoolsIOPromiseFromIOTrigger` and and `makeDevtoolsIOAwarePromise`\n// is confusing, we should clean it up.\nfunction makeDevtoolsIOPromiseFromIOTrigger<T>(\n ioTrigger: Promise<any>,\n displayName: string | undefined,\n resolvedValue: T\n): Promise<T> {\n // If we create a `new Promise` and give it a displayName\n // (with no userspace code above us in the stack)\n // React Devtools will use it as the IO cause when determining \"suspended by\".\n // In particular, it should shadow any inner IO that resolved/rejected the promise\n // (in case of staged rendering, this will be the `setTimeout` that triggers the relevant stage)\n const promise = new Promise<T>((resolve, reject) => {\n ioTrigger.then(resolve.bind(null, resolvedValue), reject)\n })\n if (displayName !== undefined) {\n // @ts-expect-error\n promise.displayName = displayName\n }\n return promise\n}\n","/**\n * The functions provided by this module are used to communicate certain properties\n * about the currently running code so that Next.js can make decisions on how to handle\n * the current execution in different rendering modes such as pre-rendering, resuming, and SSR.\n *\n * Today Next.js treats all code as potentially static. Certain APIs may only make sense when dynamically rendering.\n * Traditionally this meant deopting the entire render to dynamic however with PPR we can now deopt parts\n * of a React tree as dynamic while still keeping other parts static. There are really two different kinds of\n * Dynamic indications.\n *\n * The first is simply an intention to be dynamic. unstable_noStore is an example of this where\n * the currently executing code simply declares that the current scope is dynamic but if you use it\n * inside unstable_cache it can still be cached. This type of indication can be removed if we ever\n * make the default dynamic to begin with because the only way you would ever be static is inside\n * a cache scope which this indication does not affect.\n *\n * The second is an indication that a dynamic data source was read. This is a stronger form of dynamic\n * because it means that it is inappropriate to cache this at all. using a dynamic data source inside\n * unstable_cache should error. If you want to use some dynamic data inside unstable_cache you should\n * read that data outside the cache and pass it in as an argument to the cached function.\n */\n\nimport type { WorkStore } from '../app-render/work-async-storage.external'\nimport type {\n WorkUnitStore,\n RequestStore,\n PrerenderStoreLegacy,\n PrerenderStoreModern,\n PrerenderStoreModernRuntime,\n} from '../app-render/work-unit-async-storage.external'\n\n// Once postpone is in stable we should switch to importing the postpone export directly\nimport React from 'react'\n\nimport { DynamicServerError } from '../../client/components/hooks-server-context'\nimport { StaticGenBailoutError } from '../../client/components/static-generation-bailout'\nimport {\n getRuntimeStagePromise,\n throwForMissingRequestStore,\n workUnitAsyncStorage,\n} from './work-unit-async-storage.external'\nimport { workAsyncStorage } from '../app-render/work-async-storage.external'\nimport { makeHangingPromise } from '../dynamic-rendering-utils'\nimport {\n METADATA_BOUNDARY_NAME,\n VIEWPORT_BOUNDARY_NAME,\n OUTLET_BOUNDARY_NAME,\n ROOT_LAYOUT_BOUNDARY_NAME,\n} from '../../lib/framework/boundary-constants'\nimport { scheduleOnNextTick } from '../../lib/scheduler'\nimport { BailoutToCSRError } from '../../shared/lib/lazy-dynamic/bailout-to-csr'\nimport { InvariantError } from '../../shared/lib/invariant-error'\nimport { RenderStage } from './staged-rendering'\n\nconst hasPostpone = typeof React.unstable_postpone === 'function'\n\nexport type DynamicAccess = {\n /**\n * If debugging, this will contain the stack trace of where the dynamic access\n * occurred. This is used to provide more information to the user about why\n * their page is being rendered dynamically.\n */\n stack?: string\n\n /**\n * The expression that was accessed dynamically.\n */\n expression: string\n}\n\n// Stores dynamic reasons used during an RSC render.\nexport type DynamicTrackingState = {\n /**\n * When true, stack information will also be tracked during dynamic access.\n */\n readonly isDebugDynamicAccesses: boolean | undefined\n\n /**\n * The dynamic accesses that occurred during the render.\n */\n readonly dynamicAccesses: Array<DynamicAccess>\n\n syncDynamicErrorWithStack: null | Error\n}\n\n// Stores dynamic reasons used during an SSR render.\nexport type DynamicValidationState = {\n hasSuspenseAboveBody: boolean\n hasDynamicMetadata: boolean\n hasDynamicViewport: boolean\n hasAllowedDynamic: boolean\n dynamicErrors: Array<Error>\n}\n\nexport function createDynamicTrackingState(\n isDebugDynamicAccesses: boolean | undefined\n): DynamicTrackingState {\n return {\n isDebugDynamicAccesses,\n dynamicAccesses: [],\n syncDynamicErrorWithStack: null,\n }\n}\n\nexport function createDynamicValidationState(): DynamicValidationState {\n return {\n hasSuspenseAboveBody: false,\n hasDynamicMetadata: false,\n hasDynamicViewport: false,\n hasAllowedDynamic: false,\n dynamicErrors: [],\n }\n}\n\nexport function getFirstDynamicReason(\n trackingState: DynamicTrackingState\n): undefined | string {\n return trackingState.dynamicAccesses[0]?.expression\n}\n\n/**\n * This function communicates that the current scope should be treated as dynamic.\n *\n * In most cases this function is a no-op but if called during\n * a PPR prerender it will postpone the current sub-tree and calling\n * it during a normal prerender will cause the entire prerender to abort\n */\nexport function markCurrentScopeAsDynamic(\n store: WorkStore,\n workUnitStore: undefined | Exclude<WorkUnitStore, PrerenderStoreModern>,\n expression: string\n): void {\n if (workUnitStore) {\n switch (workUnitStore.type) {\n case 'cache':\n case 'unstable-cache':\n // Inside cache scopes, marking a scope as dynamic has no effect,\n // because the outer cache scope creates a cache boundary. This is\n // subtly different from reading a dynamic data source, which is\n // forbidden inside a cache scope.\n return\n case 'private-cache':\n // A private cache scope is already dynamic by definition.\n return\n case 'prerender-legacy':\n case 'prerender-ppr':\n case 'request':\n break\n default:\n workUnitStore satisfies never\n }\n }\n\n // If we're forcing dynamic rendering or we're forcing static rendering, we\n // don't need to do anything here because the entire page is already dynamic\n // or it's static and it should not throw or postpone here.\n if (store.forceDynamic || store.forceStatic) return\n\n if (store.dynamicShouldError) {\n throw new StaticGenBailoutError(\n `Route ${store.route} with \\`dynamic = \"error\"\\` couldn't be rendered statically because it used \\`${expression}\\`. See more info here: https://nextjs.org/docs/app/building-your-application/rendering/static-and-dynamic#dynamic-rendering`\n )\n }\n\n if (workUnitStore) {\n switch (workUnitStore.type) {\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 // We aren't prerendering, but we are generating a static page. We need\n // to bail out of static generation.\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 workUnitStore.usedDynamic = true\n }\n break\n default:\n workUnitStore satisfies never\n }\n }\n}\n\n/**\n * This function is meant to be used when prerendering without cacheComponents or PPR.\n * When called during a build it will cause Next.js to consider the route as dynamic.\n *\n * @internal\n */\nexport function throwToInterruptStaticGeneration(\n expression: string,\n store: WorkStore,\n prerenderStore: PrerenderStoreLegacy\n): never {\n // We aren't prerendering but we are generating a static page. We need to bail out of static generation\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\n prerenderStore.revalidate = 0\n\n store.dynamicUsageDescription = expression\n store.dynamicUsageStack = err.stack\n\n throw err\n}\n\n/**\n * This function should be used to track whether something dynamic happened even when\n * we are in a dynamic render. This is useful for Dev where all renders are dynamic but\n * we still track whether dynamic APIs were accessed for helpful messaging\n *\n * @internal\n */\nexport function trackDynamicDataInDynamicRender(workUnitStore: WorkUnitStore) {\n switch (workUnitStore.type) {\n case 'cache':\n case 'unstable-cache':\n // Inside cache scopes, marking a scope as dynamic has no effect,\n // because the outer cache scope creates a cache boundary. This is\n // subtly different from reading a dynamic data source, which is\n // forbidden inside a cache scope.\n return\n case 'private-cache':\n // A private cache scope is already dynamic by definition.\n return\n case 'prerender':\n case 'prerender-runtime':\n case 'prerender-legacy':\n case 'prerender-ppr':\n case 'prerender-client':\n break\n case 'request':\n if (process.env.NODE_ENV !== 'production') {\n workUnitStore.usedDynamic = true\n }\n break\n default:\n workUnitStore satisfies never\n }\n}\n\nfunction abortOnSynchronousDynamicDataAccess(\n route: string,\n expression: string,\n prerenderStore: PrerenderStoreModern\n): void {\n const reason = `Route ${route} needs to bail out of prerendering at this point because it used ${expression}.`\n\n const error = createPrerenderInterruptedError(reason)\n\n prerenderStore.controller.abort(error)\n\n const dynamicTracking = prerenderStore.dynamicTracking\n if (dynamicTracking) {\n dynamicTracking.dynamicAccesses.push({\n // When we aren't debugging, we don't need to create another error for the\n // stack trace.\n stack: dynamicTracking.isDebugDynamicAccesses\n ? new Error().stack\n : undefined,\n expression,\n })\n }\n}\n\nexport function abortOnSynchronousPlatformIOAccess(\n route: string,\n expression: string,\n errorWithStack: Error,\n prerenderStore: PrerenderStoreModern\n): void {\n const dynamicTracking = prerenderStore.dynamicTracking\n abortOnSynchronousDynamicDataAccess(route, expression, prerenderStore)\n // It is important that we set this tracking value after aborting. Aborts are executed\n // synchronously except for the case where you abort during render itself. By setting this\n // value late we can use it to determine if any of the aborted tasks are the task that\n // called the sync IO expression in the first place.\n if (dynamicTracking) {\n if (dynamicTracking.syncDynamicErrorWithStack === null) {\n dynamicTracking.syncDynamicErrorWithStack = errorWithStack\n }\n }\n}\n\nexport function trackSynchronousPlatformIOAccessInDev(\n requestStore: RequestStore\n): void {\n // We don't actually have a controller to abort but we do the semantic equivalent by\n // advancing the request store out of the prerender stage\n if (requestStore.stagedRendering) {\n // TODO: error for sync IO in the runtime stage\n // (which is not currently covered by the validation render in `spawnDynamicValidationInDev`)\n requestStore.stagedRendering.advanceStage(RenderStage.Dynamic)\n }\n}\n\n/**\n * use this function when prerendering with cacheComponents. If we are doing a\n * prospective prerender we don't actually abort because we want to discover\n * all caches for the shell. If this is the actual prerender we do abort.\n *\n * This function accepts a prerenderStore but the caller should ensure we're\n * actually running in cacheComponents mode.\n *\n * @internal\n */\nexport function abortAndThrowOnSynchronousRequestDataAccess(\n route: string,\n expression: string,\n errorWithStack: Error,\n prerenderStore: PrerenderStoreModern\n): never {\n const prerenderSignal = prerenderStore.controller.signal\n if (prerenderSignal.aborted === false) {\n // TODO it would be better to move this aborted check into the callsite so we can avoid making\n // the error object when it isn't relevant to the aborting of the prerender however\n // since we need the throw semantics regardless of whether we abort it is easier to land\n // this way. See how this was handled with `abortOnSynchronousPlatformIOAccess` for a closer\n // to ideal implementation\n abortOnSynchronousDynamicDataAccess(route, expression, prerenderStore)\n // It is important that we set this tracking value after aborting. Aborts are executed\n // synchronously except for the case where you abort during render itself. By setting this\n // value late we can use it to determine if any of the aborted tasks are the task that\n // called the sync IO expression in the first place.\n const dynamicTracking = prerenderStore.dynamicTracking\n if (dynamicTracking) {\n if (dynamicTracking.syncDynamicErrorWithStack === null) {\n dynamicTracking.syncDynamicErrorWithStack = errorWithStack\n }\n }\n }\n throw createPrerenderInterruptedError(\n `Route ${route} needs to bail out of prerendering at this point because it used ${expression}.`\n )\n}\n\n/**\n * This component will call `React.postpone` that throws the postponed error.\n */\ntype PostponeProps = {\n reason: string\n route: string\n}\nexport function Postpone({ reason, route }: PostponeProps): never {\n const prerenderStore = workUnitAsyncStorage.getStore()\n const dynamicTracking =\n prerenderStore && prerenderStore.type === 'prerender-ppr'\n ? prerenderStore.dynamicTracking\n : null\n postponeWithTracking(route, reason, dynamicTracking)\n}\n\nexport function postponeWithTracking(\n route: string,\n expression: string,\n dynamicTracking: null | DynamicTrackingState\n): never {\n assertPostpone()\n if (dynamicTracking) {\n dynamicTracking.dynamicAccesses.push({\n // When we aren't debugging, we don't need to create another error for the\n // stack trace.\n stack: dynamicTracking.isDebugDynamicAccesses\n ? new Error().stack\n : undefined,\n expression,\n })\n }\n\n React.unstable_postpone(createPostponeReason(route, expression))\n}\n\nfunction createPostponeReason(route: string, expression: string) {\n return (\n `Route ${route} needs to bail out of prerendering at this point because it used ${expression}. ` +\n `React throws this special object to indicate where. It should not be caught by ` +\n `your own try/catch. Learn more: https://nextjs.org/docs/messages/ppr-caught-error`\n )\n}\n\nexport function isDynamicPostpone(err: unknown) {\n if (\n typeof err === 'object' &&\n err !== null &&\n typeof (err as any).message === 'string'\n ) {\n return isDynamicPostponeReason((err as any).message)\n }\n return false\n}\n\nfunction isDynamicPostponeReason(reason: string) {\n return (\n reason.includes(\n 'needs to bail out of prerendering at this point because it used'\n ) &&\n reason.includes(\n 'Learn more: https://nextjs.org/docs/messages/ppr-caught-error'\n )\n )\n}\n\nif (isDynamicPostponeReason(createPostponeReason('%%%', '^^^')) === false) {\n throw new Error(\n 'Invariant: isDynamicPostpone misidentified a postpone reason. This is a bug in Next.js'\n )\n}\n\nconst NEXT_PRERENDER_INTERRUPTED = 'NEXT_PRERENDER_INTERRUPTED'\n\nfunction createPrerenderInterruptedError(message: string): Error {\n const error = new Error(message)\n ;(error as any).digest = NEXT_PRERENDER_INTERRUPTED\n return error\n}\n\ntype DigestError = Error & {\n digest: string\n}\n\nexport function isPrerenderInterruptedError(\n error: unknown\n): error is DigestError {\n return (\n typeof error === 'object' &&\n error !== null &&\n (error as any).digest === NEXT_PRERENDER_INTERRUPTED &&\n 'name' in error &&\n 'message' in error &&\n error instanceof Error\n )\n}\n\nexport function accessedDynamicData(\n dynamicAccesses: Array<DynamicAccess>\n): boolean {\n return dynamicAccesses.length > 0\n}\n\nexport function consumeDynamicAccess(\n serverDynamic: DynamicTrackingState,\n clientDynamic: DynamicTrackingState\n): DynamicTrackingState['dynamicAccesses'] {\n // We mutate because we only call this once we are no longer writing\n // to the dynamicTrackingState and it's more efficient than creating a new\n // array.\n serverDynamic.dynamicAccesses.push(...clientDynamic.dynamicAccesses)\n return serverDynamic.dynamicAccesses\n}\n\nexport function formatDynamicAPIAccesses(\n dynamicAccesses: Array<DynamicAccess>\n): string[] {\n return dynamicAccesses\n .filter(\n (access): access is Required<DynamicAccess> =>\n typeof access.stack === 'string' && access.stack.length > 0\n )\n .map(({ expression, stack }) => {\n stack = stack\n .split('\\n')\n // Remove the \"Error: \" prefix from the first line of the stack trace as\n // well as the first 4 lines of the stack trace which is the distance\n // from the user code and the `new Error().stack` call.\n .slice(4)\n .filter((line) => {\n // Exclude Next.js internals from the stack trace.\n if (line.includes('node_modules/next/')) {\n return false\n }\n\n // Exclude anonymous functions from the stack trace.\n if (line.includes(' (<anonymous>)')) {\n return false\n }\n\n // Exclude Node.js internals from the stack trace.\n if (line.includes(' (node:')) {\n return false\n }\n\n return true\n })\n .join('\\n')\n return `Dynamic API Usage Debug - ${expression}:\\n${stack}`\n })\n}\n\nfunction assertPostpone() {\n if (!hasPostpone) {\n throw new Error(\n `Invariant: React.unstable_postpone is not defined. This suggests the wrong version of React was loaded. This is a bug in Next.js`\n )\n }\n}\n\n/**\n * This is a bit of a hack to allow us to abort a render using a Postpone instance instead of an Error which changes React's\n * abort semantics slightly.\n */\nexport function createRenderInBrowserAbortSignal(): AbortSignal {\n const controller = new AbortController()\n controller.abort(new BailoutToCSRError('Render in Browser'))\n return controller.signal\n}\n\n/**\n * In a prerender, we may end up with hanging Promises as inputs due them\n * stalling on connection() or because they're loading dynamic data. In that\n * case we need to abort the encoding of arguments since they'll never complete.\n */\nexport function createHangingInputAbortSignal(\n workUnitStore: WorkUnitStore\n): AbortSignal | undefined {\n switch (workUnitStore.type) {\n case 'prerender':\n case 'prerender-runtime':\n const controller = new AbortController()\n\n if (workUnitStore.cacheSignal) {\n // If we have a cacheSignal it means we're in a prospective render. If\n // the input we're waiting on is coming from another cache, we do want\n // to wait for it so that we can resolve this cache entry too.\n workUnitStore.cacheSignal.inputReady().then(() => {\n controller.abort()\n })\n } else {\n // Otherwise we're in the final render and we should already have all\n // our caches filled.\n // If the prerender uses stages, we have wait until the runtime stage,\n // at which point all runtime inputs will be resolved.\n // (otherwise, a runtime prerender might consider `cookies()` hanging\n // even though they'd resolve in the next task.)\n //\n // We might still be waiting on some microtasks so we\n // wait one tick before giving up. When we give up, we still want to\n // render the content of this cache as deeply as we can so that we can\n // suspend as deeply as possible in the tree or not at all if we don't\n // end up waiting for the input.\n const runtimeStagePromise = getRuntimeStagePromise(workUnitStore)\n if (runtimeStagePromise) {\n runtimeStagePromise.then(() =>\n scheduleOnNextTick(() => controller.abort())\n )\n } else {\n scheduleOnNextTick(() => controller.abort())\n }\n }\n\n return controller.signal\n case 'prerender-client':\n case 'prerender-ppr':\n case 'prerender-legacy':\n case 'request':\n case 'cache':\n case 'private-cache':\n case 'unstable-cache':\n return undefined\n default:\n workUnitStore satisfies never\n }\n}\n\nexport function annotateDynamicAccess(\n expression: string,\n prerenderStore: PrerenderStoreModern\n) {\n const dynamicTracking = prerenderStore.dynamicTracking\n if (dynamicTracking) {\n dynamicTracking.dynamicAccesses.push({\n stack: dynamicTracking.isDebugDynamicAccesses\n ? new Error().stack\n : undefined,\n expression,\n })\n }\n}\n\nexport function useDynamicRouteParams(expression: string) {\n const workStore = workAsyncStorage.getStore()\n const workUnitStore = workUnitAsyncStorage.getStore()\n if (workStore && workUnitStore) {\n switch (workUnitStore.type) {\n case 'prerender-client':\n case 'prerender': {\n const fallbackParams = workUnitStore.fallbackRouteParams\n\n if (fallbackParams && fallbackParams.size > 0) {\n // We are in a prerender with cacheComponents semantics. We are going to\n // hang here and never resolve. This will cause the currently\n // rendering component to effectively be a dynamic hole.\n React.use(\n makeHangingPromise(\n workUnitStore.renderSignal,\n workStore.route,\n expression\n )\n )\n }\n break\n }\n case 'prerender-ppr': {\n const fallbackParams = workUnitStore.fallbackRouteParams\n if (fallbackParams && fallbackParams.size > 0) {\n return postponeWithTracking(\n workStore.route,\n expression,\n workUnitStore.dynamicTracking\n )\n }\n break\n }\n case 'prerender-runtime':\n throw new InvariantError(\n `\\`${expression}\\` was called during a runtime prerender. Next.js should be preventing ${expression} from being included in server components statically, but did not in this case.`\n )\n case 'cache':\n case 'private-cache':\n throw new InvariantError(\n `\\`${expression}\\` was called inside a cache scope. Next.js should be preventing ${expression} from being included in server components statically, but did not in this case.`\n )\n case 'prerender-legacy':\n case 'request':\n case 'unstable-cache':\n break\n default:\n workUnitStore satisfies never\n }\n }\n}\n\nexport function useDynamicSearchParams(expression: string) {\n const workStore = workAsyncStorage.getStore()\n const workUnitStore = workUnitAsyncStorage.getStore()\n\n if (!workStore) {\n // We assume pages router context and just return\n return\n }\n\n if (!workUnitStore) {\n throwForMissingRequestStore(expression)\n }\n\n switch (workUnitStore.type) {\n case 'prerender-client': {\n React.use(\n makeHangingPromise(\n workUnitStore.renderSignal,\n workStore.route,\n expression\n )\n )\n break\n }\n case 'prerender-legacy':\n case 'prerender-ppr': {\n if (workStore.forceStatic) {\n return\n }\n throw new BailoutToCSRError(expression)\n }\n case 'prerender':\n case 'prerender-runtime':\n throw new InvariantError(\n `\\`${expression}\\` was called from a Server Component. Next.js should be preventing ${expression} from being included in server components statically, but did not in this case.`\n )\n case 'cache':\n case 'unstable-cache':\n case 'private-cache':\n throw new InvariantError(\n `\\`${expression}\\` was called inside a cache scope. Next.js should be preventing ${expression} from being included in server components statically, but did not in this case.`\n )\n case 'request':\n return\n default:\n workUnitStore satisfies never\n }\n}\n\nconst hasSuspenseRegex = /\\n\\s+at Suspense \\(<anonymous>\\)/\n\n// Common implicit body tags that React will treat as body when placed directly in html\nconst bodyAndImplicitTags =\n 'body|div|main|section|article|aside|header|footer|nav|form|p|span|h1|h2|h3|h4|h5|h6'\n\n// Detects when RootLayoutBoundary (our framework marker component) appears\n// after Suspense in the component stack, indicating the root layout is wrapped\n// within a Suspense boundary. Ensures no body/html/implicit-body components are in between.\n//\n// Example matches:\n// at Suspense (<anonymous>)\n// at __next_root_layout_boundary__ (<anonymous>)\n//\n// Or with other components in between (but not body/html/implicit-body):\n// at Suspense (<anonymous>)\n// at SomeComponent (<anonymous>)\n// at __next_root_layout_boundary__ (<anonymous>)\nconst hasSuspenseBeforeRootLayoutWithoutBodyOrImplicitBodyRegex = new RegExp(\n `\\\\n\\\\s+at Suspense \\\\(<anonymous>\\\\)(?:(?!\\\\n\\\\s+at (?:${bodyAndImplicitTags}) \\\\(<anonymous>\\\\))[\\\\s\\\\S])*?\\\\n\\\\s+at ${ROOT_LAYOUT_BOUNDARY_NAME} \\\\([^\\\\n]*\\\\)`\n)\n\nconst hasMetadataRegex = new RegExp(\n `\\\\n\\\\s+at ${METADATA_BOUNDARY_NAME}[\\\\n\\\\s]`\n)\nconst hasViewportRegex = new RegExp(\n `\\\\n\\\\s+at ${VIEWPORT_BOUNDARY_NAME}[\\\\n\\\\s]`\n)\nconst hasOutletRegex = new RegExp(`\\\\n\\\\s+at ${OUTLET_BOUNDARY_NAME}[\\\\n\\\\s]`)\n\nexport function trackAllowedDynamicAccess(\n workStore: WorkStore,\n componentStack: string,\n dynamicValidation: DynamicValidationState,\n clientDynamic: DynamicTrackingState\n) {\n if (hasOutletRegex.test(componentStack)) {\n // We don't need to track that this is dynamic. It is only so when something else is also dynamic.\n return\n } else if (hasMetadataRegex.test(componentStack)) {\n dynamicValidation.hasDynamicMetadata = true\n return\n } else if (hasViewportRegex.test(componentStack)) {\n dynamicValidation.hasDynamicViewport = true\n return\n } else if (\n hasSuspenseBeforeRootLayoutWithoutBodyOrImplicitBodyRegex.test(\n componentStack\n )\n ) {\n // For Suspense within body, the prelude wouldn't be empty so it wouldn't violate the empty static shells rule.\n // But if you have Suspense above body, the prelude is empty but we allow that because having Suspense\n // is an explicit signal from the user that they acknowledge the empty shell and want dynamic rendering.\n dynamicValidation.hasAllowedDynamic = true\n dynamicValidation.hasSuspenseAboveBody = true\n return\n } else if (hasSuspenseRegex.test(componentStack)) {\n // this error had a Suspense boundary above it so we don't need to report it as a source\n // of disallowed\n dynamicValidation.hasAllowedDynamic = true\n return\n } else if (clientDynamic.syncDynamicErrorWithStack) {\n // This task was the task that called the sync error.\n dynamicValidation.dynamicErrors.push(\n clientDynamic.syncDynamicErrorWithStack\n )\n return\n } else {\n const message =\n `Route \"${workStore.route}\": Uncached data was accessed outside of ` +\n '<Suspense>. This delays the entire page from rendering, resulting in a ' +\n 'slow user experience. Learn more: ' +\n 'https://nextjs.org/docs/messages/blocking-route'\n const error = createErrorWithComponentOrOwnerStack(message, componentStack)\n dynamicValidation.dynamicErrors.push(error)\n return\n }\n}\n\n/**\n * In dev mode, we prefer using the owner stack, otherwise the provided\n * component stack is used.\n */\nfunction createErrorWithComponentOrOwnerStack(\n message: string,\n componentStack: string\n) {\n const ownerStack =\n process.env.NODE_ENV !== 'production' && React.captureOwnerStack\n ? React.captureOwnerStack()\n : null\n\n const error = new Error(message)\n error.stack = error.name + ': ' + message + (ownerStack ?? componentStack)\n return error\n}\n\nexport enum PreludeState {\n Full = 0,\n Empty = 1,\n Errored = 2,\n}\n\nexport function logDisallowedDynamicError(\n workStore: WorkStore,\n error: Error\n): void {\n console.error(error)\n\n if (!workStore.dev) {\n if (workStore.hasReadableErrorStacks) {\n console.error(\n `To get a more detailed stack trace and pinpoint the issue, start the app in development mode by running \\`next dev\\`, then open \"${workStore.route}\" in your browser to investigate the error.`\n )\n } else {\n console.error(`To get a more detailed stack trace and pinpoint the issue, try one of the following:\n - Start the app in development mode by running \\`next dev\\`, then open \"${workStore.route}\" in your browser to investigate the error.\n - Rerun the production build with \\`next build --debug-prerender\\` to generate better stack traces.`)\n }\n }\n}\n\nexport function throwIfDisallowedDynamic(\n workStore: WorkStore,\n prelude: PreludeState,\n dynamicValidation: DynamicValidationState,\n serverDynamic: DynamicTrackingState\n): void {\n if (serverDynamic.syncDynamicErrorWithStack) {\n logDisallowedDynamicError(\n workStore,\n serverDynamic.syncDynamicErrorWithStack\n )\n throw new StaticGenBailoutError()\n }\n\n if (prelude !== PreludeState.Full) {\n if (dynamicValidation.hasSuspenseAboveBody) {\n // This route has opted into allowing fully dynamic rendering\n // by including a Suspense boundary above the body. In this case\n // a lack of a shell is not considered disallowed so we simply return\n return\n }\n\n // We didn't have any sync bailouts but there may be user code which\n // blocked the root. We would have captured these during the prerender\n // and can log them here and then terminate the build/validating render\n const dynamicErrors = dynamicValidation.dynamicErrors\n if (dynamicErrors.length > 0) {\n for (let i = 0; i < dynamicErrors.length; i++) {\n logDisallowedDynamicError(workStore, dynamicErrors[i])\n }\n\n throw new StaticGenBailoutError()\n }\n\n // If we got this far then the only other thing that could be blocking\n // the root is dynamic Viewport. If this is dynamic then\n // you need to opt into that by adding a Suspense boundary above the body\n // to indicate your are ok with fully dynamic rendering.\n if (dynamicValidation.hasDynamicViewport) {\n console.error(\n `Route \"${workStore.route}\" has a \\`generateViewport\\` that depends on Request data (\\`cookies()\\`, etc...) or uncached external data (\\`fetch(...)\\`, etc...) without explicitly allowing fully dynamic rendering. See more info here: https://nextjs.org/docs/messages/next-prerender-dynamic-viewport`\n )\n throw new StaticGenBailoutError()\n }\n\n if (prelude === PreludeState.Empty) {\n // If we ever get this far then we messed up the tracking of invalid dynamic.\n // We still adhere to the constraint that you must produce a shell but invite the\n // user to report this as a bug in Next.js.\n console.error(\n `Route \"${workStore.route}\" did not produce a static shell and Next.js was unable to determine a reason. This is a bug in Next.js.`\n )\n throw new StaticGenBailoutError()\n }\n } else {\n if (\n dynamicValidation.hasAllowedDynamic === false &&\n dynamicValidation.hasDynamicMetadata\n ) {\n console.error(\n `Route \"${workStore.route}\" has a \\`generateMetadata\\` that depends on Request data (\\`cookies()\\`, etc...) or uncached external data (\\`fetch(...)\\`, etc...) when the rest of the route does not. See more info here: https://nextjs.org/docs/messages/next-prerender-dynamic-metadata`\n )\n throw new StaticGenBailoutError()\n }\n }\n}\n\nexport function delayUntilRuntimeStage<T>(\n prerenderStore: PrerenderStoreModernRuntime,\n result: Promise<T>\n): Promise<T> {\n if (prerenderStore.runtimeStagePromise) {\n return prerenderStore.runtimeStagePromise.then(() => result)\n }\n return result\n}\n","import { isHangingPromiseRejectionError } from '../../server/dynamic-rendering-utils'\nimport { isPostpone } from '../../server/lib/router-utils/is-postpone'\nimport { isBailoutToCSRError } from '../../shared/lib/lazy-dynamic/bailout-to-csr'\nimport { isNextRouterError } from './is-next-router-error'\nimport {\n isDynamicPostpone,\n isPrerenderInterruptedError,\n} from '../../server/app-render/dynamic-rendering'\nimport { isDynamicServerError } from './hooks-server-context'\n\nexport function unstable_rethrow(error: unknown): void {\n if (\n isNextRouterError(error) ||\n isBailoutToCSRError(error) ||\n isDynamicServerError(error) ||\n isDynamicPostpone(error) ||\n isPostpone(error) ||\n isHangingPromiseRejectionError(error) ||\n isPrerenderInterruptedError(error)\n ) {\n throw error\n }\n\n if (error instanceof Error && 'cause' in error) {\n unstable_rethrow(error.cause)\n }\n}\n","/**\n * This function should be used to rethrow internal Next.js errors so that they can be handled by the framework.\n * When wrapping an API that uses errors to interrupt control flow, you should use this function before you do any error handling.\n * This function will rethrow the error if it is a Next.js error so it can be handled, otherwise it will do nothing.\n *\n * Read more: [Next.js Docs: `unstable_rethrow`](https://nextjs.org/docs/app/api-reference/functions/unstable_rethrow)\n */\nexport const unstable_rethrow =\n typeof window === 'undefined'\n ? (\n require('./unstable-rethrow.server') as typeof import('./unstable-rethrow.server')\n ).unstable_rethrow\n : (\n require('./unstable-rethrow.browser') as typeof import('./unstable-rethrow.browser')\n ).unstable_rethrow\n","import { ReadonlyURLSearchParams } from './readonly-url-search-params'\n\nexport function unstable_isUnrecognizedActionError(): boolean {\n throw new Error(\n '`unstable_isUnrecognizedActionError` can only be used on the client.'\n )\n}\n\nexport { redirect, permanentRedirect } from './redirect'\nexport { RedirectType } from './redirect-error'\nexport { notFound } from './not-found'\nexport { forbidden } from './forbidden'\nexport { unauthorized } from './unauthorized'\nexport { unstable_rethrow } from './unstable-rethrow'\nexport { ReadonlyURLSearchParams }\n","import type { Params } from '../../server/request/params'\n\nimport React, { useContext, useMemo, use } from 'react'\nimport {\n AppRouterContext,\n LayoutRouterContext,\n type AppRouterInstance,\n} from '../../shared/lib/app-router-context.shared-runtime'\nimport {\n SearchParamsContext,\n PathnameContext,\n PathParamsContext,\n NavigationPromisesContext,\n} from '../../shared/lib/hooks-client-context.shared-runtime'\nimport {\n computeSelectedLayoutSegment,\n getSelectedLayoutSegmentPath,\n} from '../../shared/lib/segment'\nimport { ReadonlyURLSearchParams } from './readonly-url-search-params'\n\nconst useDynamicRouteParams =\n typeof window === 'undefined'\n ? (\n require('../../server/app-render/dynamic-rendering') as typeof import('../../server/app-render/dynamic-rendering')\n ).useDynamicRouteParams\n : undefined\n\nconst useDynamicSearchParams =\n typeof window === 'undefined'\n ? (\n require('../../server/app-render/dynamic-rendering') as typeof import('../../server/app-render/dynamic-rendering')\n ).useDynamicSearchParams\n : undefined\n\n/**\n * A [Client Component](https://nextjs.org/docs/app/building-your-application/rendering/client-components) hook\n * that lets you *read* the current URL's search parameters.\n *\n * Learn more about [`URLSearchParams` on MDN](https://developer.mozilla.org/docs/Web/API/URLSearchParams)\n *\n * @example\n * ```ts\n * \"use client\"\n * import { useSearchParams } from 'next/navigation'\n *\n * export default function Page() {\n * const searchParams = useSearchParams()\n * searchParams.get('foo') // returns 'bar' when ?foo=bar\n * // ...\n * }\n * ```\n *\n * Read more: [Next.js Docs: `useSearchParams`](https://nextjs.org/docs/app/api-reference/functions/use-search-params)\n */\n// Client components API\nexport function useSearchParams(): ReadonlyURLSearchParams {\n useDynamicSearchParams?.('useSearchParams()')\n\n const searchParams = useContext(SearchParamsContext)\n\n // In the case where this is `null`, the compat types added in\n // `next-env.d.ts` will add a new overload that changes the return type to\n // include `null`.\n const readonlySearchParams = useMemo(() => {\n if (!searchParams) {\n // When the router is not ready in pages, we won't have the search params\n // available.\n return null\n }\n\n return new ReadonlyURLSearchParams(searchParams)\n }, [searchParams]) as ReadonlyURLSearchParams\n\n // Instrument with Suspense DevTools (dev-only)\n if (process.env.NODE_ENV !== 'production' && 'use' in React) {\n const navigationPromises = use(NavigationPromisesContext)\n if (navigationPromises) {\n return use(navigationPromises.searchParams)\n }\n }\n\n return readonlySearchParams\n}\n\n/**\n * A [Client Component](https://nextjs.org/docs/app/building-your-application/rendering/client-components) hook\n * that lets you read the current URL's pathname.\n *\n * @example\n * ```ts\n * \"use client\"\n * import { usePathname } from 'next/navigation'\n *\n * export default function Page() {\n * const pathname = usePathname() // returns \"/dashboard\" on /dashboard?foo=bar\n * // ...\n * }\n * ```\n *\n * Read more: [Next.js Docs: `usePathname`](https://nextjs.org/docs/app/api-reference/functions/use-pathname)\n */\n// Client components API\nexport function usePathname(): string {\n useDynamicRouteParams?.('usePathname()')\n\n // In the case where this is `null`, the compat types added in `next-env.d.ts`\n // will add a new overload that changes the return type to include `null`.\n const pathname = useContext(PathnameContext) as string\n\n // Instrument with Suspense DevTools (dev-only)\n if (process.env.NODE_ENV !== 'production' && 'use' in React) {\n const navigationPromises = use(NavigationPromisesContext)\n if (navigationPromises) {\n return use(navigationPromises.pathname)\n }\n }\n\n return pathname\n}\n\n// Client components API\nexport {\n ServerInsertedHTMLContext,\n useServerInsertedHTML,\n} from '../../shared/lib/server-inserted-html.shared-runtime'\n\n/**\n *\n * This hook allows you to programmatically change routes inside [Client Component](https://nextjs.org/docs/app/building-your-application/rendering/client-components).\n *\n * @example\n * ```ts\n * \"use client\"\n * import { useRouter } from 'next/navigation'\n *\n * export default function Page() {\n * const router = useRouter()\n * // ...\n * router.push('/dashboard') // Navigate to /dashboard\n * }\n * ```\n *\n * Read more: [Next.js Docs: `useRouter`](https://nextjs.org/docs/app/api-reference/functions/use-router)\n */\n// Client components API\nexport function useRouter(): AppRouterInstance {\n const router = useContext(AppRouterContext)\n if (router === null) {\n throw new Error('invariant expected app router to be mounted')\n }\n\n return router\n}\n\n/**\n * A [Client Component](https://nextjs.org/docs/app/building-your-application/rendering/client-components) hook\n * that lets you read a route's dynamic params filled in by the current URL.\n *\n * @example\n * ```ts\n * \"use client\"\n * import { useParams } from 'next/navigation'\n *\n * export default function Page() {\n * // on /dashboard/[team] where pathname is /dashboard/nextjs\n * const { team } = useParams() // team === \"nextjs\"\n * }\n * ```\n *\n * Read more: [Next.js Docs: `useParams`](https://nextjs.org/docs/app/api-reference/functions/use-params)\n */\n// Client components API\nexport function useParams<T extends Params = Params>(): T {\n useDynamicRouteParams?.('useParams()')\n\n const params = useContext(PathParamsContext) as T\n\n // Instrument with Suspense DevTools (dev-only)\n if (process.env.NODE_ENV !== 'production' && 'use' in React) {\n const navigationPromises = use(NavigationPromisesContext)\n if (navigationPromises) {\n return use(navigationPromises.params) as T\n }\n }\n\n return params\n}\n\n/**\n * A [Client Component](https://nextjs.org/docs/app/building-your-application/rendering/client-components) hook\n * that lets you read the active route segments **below** the Layout it is called from.\n *\n * @example\n * ```ts\n * 'use client'\n *\n * import { useSelectedLayoutSegments } from 'next/navigation'\n *\n * export default function ExampleClientComponent() {\n * const segments = useSelectedLayoutSegments()\n *\n * return (\n * <ul>\n * {segments.map((segment, index) => (\n * <li key={index}>{segment}</li>\n * ))}\n * </ul>\n * )\n * }\n * ```\n *\n * Read more: [Next.js Docs: `useSelectedLayoutSegments`](https://nextjs.org/docs/app/api-reference/functions/use-selected-layout-segments)\n */\n// Client components API\nexport function useSelectedLayoutSegments(\n parallelRouteKey: string = 'children'\n): string[] {\n useDynamicRouteParams?.('useSelectedLayoutSegments()')\n\n const context = useContext(LayoutRouterContext)\n // @ts-expect-error This only happens in `pages`. Type is overwritten in navigation.d.ts\n if (!context) return null\n\n // Instrument with Suspense DevTools (dev-only)\n if (process.env.NODE_ENV !== 'production' && 'use' in React) {\n const navigationPromises = use(NavigationPromisesContext)\n if (navigationPromises) {\n const promise =\n navigationPromises.selectedLayoutSegmentsPromises?.get(parallelRouteKey)\n if (promise) {\n // We should always have a promise here, but if we don't, it's not worth erroring over.\n // We just won't be able to instrument it, but can still provide the value.\n return use(promise)\n }\n }\n }\n\n return getSelectedLayoutSegmentPath(context.parentTree, parallelRouteKey)\n}\n\n/**\n * A [Client Component](https://nextjs.org/docs/app/building-your-application/rendering/client-components) hook\n * that lets you read the active route segment **one level below** the Layout it is called from.\n *\n * @example\n * ```ts\n * 'use client'\n * import { useSelectedLayoutSegment } from 'next/navigation'\n *\n * export default function ExampleClientComponent() {\n * const segment = useSelectedLayoutSegment()\n *\n * return <p>Active segment: {segment}</p>\n * }\n * ```\n *\n * Read more: [Next.js Docs: `useSelectedLayoutSegment`](https://nextjs.org/docs/app/api-reference/functions/use-selected-layout-segment)\n */\n// Client components API\nexport function useSelectedLayoutSegment(\n parallelRouteKey: string = 'children'\n): string | null {\n useDynamicRouteParams?.('useSelectedLayoutSegment()')\n const navigationPromises = useContext(NavigationPromisesContext)\n const selectedLayoutSegments = useSelectedLayoutSegments(parallelRouteKey)\n\n // Instrument with Suspense DevTools (dev-only)\n if (\n process.env.NODE_ENV !== 'production' &&\n navigationPromises &&\n 'use' in React\n ) {\n const promise =\n navigationPromises.selectedLayoutSegmentPromises?.get(parallelRouteKey)\n if (promise) {\n // We should always have a promise here, but if we don't, it's not worth erroring over.\n // We just won't be able to instrument it, but can still provide the value.\n return use(promise)\n }\n }\n\n return computeSelectedLayoutSegment(selectedLayoutSegments, parallelRouteKey)\n}\n\nexport { unstable_isUnrecognizedActionError } from './unrecognized-action-error'\n\n// Shared components APIs\nexport {\n notFound,\n forbidden,\n unauthorized,\n redirect,\n permanentRedirect,\n RedirectType,\n ReadonlyURLSearchParams,\n unstable_rethrow,\n} from './navigation.react-server'\n","module.exports = require('./dist/client/components/navigation')\n","import { CamelToPascal } from './utility-types';\n\n/**\n * Converts string to kebab case\n *\n * @param {string} string\n * @returns {string} A kebabized string\n */\nexport const toKebabCase = (string: string) =>\n string.replace(/([a-z0-9])([A-Z])/g, '$1-$2').toLowerCase();\n\n/**\n * Converts string to camel case\n *\n * @param {string} string\n * @returns {string} A camelized string\n */\nexport const toCamelCase = <T extends string>(string: T) =>\n string.replace(/^([A-Z])|[\\s-_]+(\\w)/g, (match, p1, p2) =>\n p2 ? p2.toUpperCase() : p1.toLowerCase(),\n );\n\n/**\n * Converts string to pascal case\n *\n * @param {string} string\n * @returns {string} A pascalized string\n */\nexport const toPascalCase = <T extends string>(string: T): CamelToPascal<T> => {\n const camelCase = toCamelCase(string);\n\n return (camelCase.charAt(0).toUpperCase() + camelCase.slice(1)) as CamelToPascal<T>;\n};\n\n/**\n * Merges classes into a single string\n *\n * @param {array} classes\n * @returns {string} A string of classes\n */\nexport const mergeClasses = <ClassType = string | undefined | null>(...classes: ClassType[]) =>\n classes\n .filter((className, index, array) => {\n return (\n Boolean(className) &&\n (className as string).trim() !== '' &&\n array.indexOf(className) === index\n );\n })\n .join(' ')\n .trim();\n","export default {\n xmlns: 'http://www.w3.org/2000/svg',\n width: 24,\n height: 24,\n viewBox: '0 0 24 24',\n fill: 'none',\n stroke: 'currentColor',\n strokeWidth: 2,\n strokeLinecap: 'round',\n strokeLinejoin: 'round',\n};\n","import { createElement, forwardRef } from 'react';\nimport { mergeClasses, toKebabCase } from '@lucide/shared';\nimport { IconNode, LucideProps } from './types';\nimport Icon from './Icon';\n\n/**\n * Create a Lucide icon component\n * @param {string} iconName\n * @param {array} iconNode\n * @returns {ForwardRefExoticComponent} LucideIcon\n */\nconst createLucideIcon = (iconName: string, iconNode: IconNode) => {\n const Component = forwardRef<SVGSVGElement, LucideProps>(({ className, ...props }, ref) =>\n createElement(Icon, {\n ref,\n iconNode,\n className: mergeClasses(`lucide-${toKebabCase(iconName)}`, className),\n ...props,\n }),\n );\n\n Component.displayName = `${iconName}`;\n\n return Component;\n};\n\nexport default createLucideIcon;\n","import { createElement, forwardRef } from 'react';\nimport defaultAttributes from './defaultAttributes';\nimport { IconNode, LucideProps } from './types';\nimport { mergeClasses } from '@lucide/shared';\n\ninterface IconComponentProps extends LucideProps {\n iconNode: IconNode;\n}\n\n/**\n * Lucide icon component\n *\n * @component Icon\n * @param {object} props\n * @param {string} props.color - The color of the icon\n * @param {number} props.size - The size of the icon\n * @param {number} props.strokeWidth - The stroke width of the icon\n * @param {boolean} props.absoluteStrokeWidth - Whether to use absolute stroke width\n * @param {string} props.className - The class name of the icon\n * @param {IconNode} props.children - The children of the icon\n * @param {IconNode} props.iconNode - The icon node of the icon\n *\n * @returns {ForwardRefExoticComponent} LucideIcon\n */\nconst Icon = forwardRef<SVGSVGElement, IconComponentProps>(\n (\n {\n color = 'currentColor',\n size = 24,\n strokeWidth = 2,\n absoluteStrokeWidth,\n className = '',\n children,\n iconNode,\n ...rest\n },\n ref,\n ) => {\n return createElement(\n 'svg',\n {\n ref,\n ...defaultAttributes,\n width: size,\n height: size,\n stroke: color,\n strokeWidth: absoluteStrokeWidth ? (Number(strokeWidth) * 24) / Number(size) : strokeWidth,\n className: mergeClasses('lucide', className),\n ...rest,\n },\n [\n ...iconNode.map(([tag, attrs]) => createElement(tag, attrs)),\n ...(Array.isArray(children) ? children : [children]),\n ],\n );\n },\n);\n\nexport default Icon;\n","function r(e){var t,f,n=\"\";if(\"string\"==typeof e||\"number\"==typeof e)n+=e;else if(\"object\"==typeof e)if(Array.isArray(e)){var o=e.length;for(t=0;t<o;t++)e[t]&&(f=r(e[t]))&&(n&&(n+=\" \"),n+=f)}else for(f in e)e[f]&&(n&&(n+=\" \"),n+=f);return n}export function clsx(){for(var e,t,f=0,n=\"\",o=arguments.length;f<o;f++)(e=arguments[f])&&(t=r(e))&&(n&&(n+=\" \"),n+=t);return n}export default clsx;","const formatRelativeLocale = {\n lastWeek: \"'last' eeee 'at' p\",\n yesterday: \"'yesterday at' p\",\n today: \"'today at' p\",\n tomorrow: \"'tomorrow at' p\",\n nextWeek: \"eeee 'at' p\",\n other: \"P\",\n};\n\nexport const formatRelative = (token, _date, _baseDate, _options) =>\n formatRelativeLocale[token];\n","let defaultOptions = {};\n\nexport function getDefaultOptions() {\n return defaultOptions;\n}\n\nexport function setDefaultOptions(newOptions) {\n defaultOptions = newOptions;\n}\n","const formatDistanceLocale = {\n lessThanXSeconds: {\n one: \"less than a second\",\n other: \"less than {{count}} seconds\",\n },\n\n xSeconds: {\n one: \"1 second\",\n other: \"{{count}} seconds\",\n },\n\n halfAMinute: \"half a minute\",\n\n lessThanXMinutes: {\n one: \"less than a minute\",\n other: \"less than {{count}} minutes\",\n },\n\n xMinutes: {\n one: \"1 minute\",\n other: \"{{count}} minutes\",\n },\n\n aboutXHours: {\n one: \"about 1 hour\",\n other: \"about {{count}} hours\",\n },\n\n xHours: {\n one: \"1 hour\",\n other: \"{{count}} hours\",\n },\n\n xDays: {\n one: \"1 day\",\n other: \"{{count}} days\",\n },\n\n aboutXWeeks: {\n one: \"about 1 week\",\n other: \"about {{count}} weeks\",\n },\n\n xWeeks: {\n one: \"1 week\",\n other: \"{{count}} weeks\",\n },\n\n aboutXMonths: {\n one: \"about 1 month\",\n other: \"about {{count}} months\",\n },\n\n xMonths: {\n one: \"1 month\",\n other: \"{{count}} months\",\n },\n\n aboutXYears: {\n one: \"about 1 year\",\n other: \"about {{count}} years\",\n },\n\n xYears: {\n one: \"1 year\",\n other: \"{{count}} years\",\n },\n\n overXYears: {\n one: \"over 1 year\",\n other: \"over {{count}} years\",\n },\n\n almostXYears: {\n one: \"almost 1 year\",\n other: \"almost {{count}} years\",\n },\n};\n\nexport const formatDistance = (token, count, options) => {\n let result;\n\n const tokenValue = formatDistanceLocale[token];\n if (typeof tokenValue === \"string\") {\n result = tokenValue;\n } else if (count === 1) {\n result = tokenValue.one;\n } else {\n result = tokenValue.other.replace(\"{{count}}\", count.toString());\n }\n\n if (options?.addSuffix) {\n if (options.comparison && options.comparison > 0) {\n return \"in \" + result;\n } else {\n return result + \" ago\";\n }\n }\n\n return result;\n};\n","import { type ClassValue, clsx } from 'clsx';\nimport { formatDistanceStrict } from 'date-fns';\nimport { twMerge } from 'tailwind-merge';\n\nexport const DEFAULT_PAGE_SIZE = 10;\n\nexport function cn(...inputs: ClassValue[]) {\n return twMerge(clsx(inputs));\n}\n\nexport const LIVE_UPDATE_INTERVAL_MS = 5000;\n\n/**\n * Returns a formatted pagination display string\n * @param currentPage - The current page number\n * @param totalPages - The total number of pages visited so far\n * @param hasMore - Whether there are more pages available\n * @returns Formatted string like \"Page 1 of 3+\" or \"Page 2 of 2\"\n */\nexport function getPaginationDisplay(\n currentPage: number,\n totalPages: number,\n hasMore: boolean\n): string {\n if (hasMore) {\n return `Page ${currentPage} of ${totalPages}+`;\n }\n return `Page ${currentPage} of ${totalPages}`;\n}\n\nexport const formatDuration = (\n start: number | string | Date | undefined,\n end: number | string | Date | undefined\n): string | null => {\n if (!start || !end) return null;\n return formatDistanceStrict(new Date(start), new Date(end));\n};\n","import {\n ClassGroup,\n ClassValidator,\n Config,\n GenericClassGroupIds,\n GenericConfig,\n GenericThemeGroupIds,\n ThemeGetter,\n ThemeObject,\n} from './types'\n\nexport interface ClassPartObject {\n nextPart: Map<string, ClassPartObject>\n validators: ClassValidatorObject[]\n classGroupId?: GenericClassGroupIds\n}\n\ninterface ClassValidatorObject {\n classGroupId: GenericClassGroupIds\n validator: ClassValidator\n}\n\nconst CLASS_PART_SEPARATOR = '-'\n\nexport const createClassGroupUtils = (config: GenericConfig) => {\n const classMap = createClassMap(config)\n const { conflictingClassGroups, conflictingClassGroupModifiers } = config\n\n const getClassGroupId = (className: string) => {\n const classParts = className.split(CLASS_PART_SEPARATOR)\n\n // Classes like `-inset-1` produce an empty string as first classPart. We assume that classes for negative values are used correctly and remove it from classParts.\n if (classParts[0] === '' && classParts.length !== 1) {\n classParts.shift()\n }\n\n return getGroupRecursive(classParts, classMap) || getGroupIdForArbitraryProperty(className)\n }\n\n const getConflictingClassGroupIds = (\n classGroupId: GenericClassGroupIds,\n hasPostfixModifier: boolean,\n ) => {\n const conflicts = conflictingClassGroups[classGroupId] || []\n\n if (hasPostfixModifier && conflictingClassGroupModifiers[classGroupId]) {\n return [...conflicts, ...conflictingClassGroupModifiers[classGroupId]!]\n }\n\n return conflicts\n }\n\n return {\n getClassGroupId,\n getConflictingClassGroupIds,\n }\n}\n\nconst getGroupRecursive = (\n classParts: string[],\n classPartObject: ClassPartObject,\n): GenericClassGroupIds | undefined => {\n if (classParts.length === 0) {\n return classPartObject.classGroupId\n }\n\n const currentClassPart = classParts[0]!\n const nextClassPartObject = classPartObject.nextPart.get(currentClassPart)\n const classGroupFromNextClassPart = nextClassPartObject\n ? getGroupRecursive(classParts.slice(1), nextClassPartObject)\n : undefined\n\n if (classGroupFromNextClassPart) {\n return classGroupFromNextClassPart\n }\n\n if (classPartObject.validators.length === 0) {\n return undefined\n }\n\n const classRest = classParts.join(CLASS_PART_SEPARATOR)\n\n return classPartObject.validators.find(({ validator }) => validator(classRest))?.classGroupId\n}\n\nconst arbitraryPropertyRegex = /^\\[(.+)\\]$/\n\nconst getGroupIdForArbitraryProperty = (className: string) => {\n if (arbitraryPropertyRegex.test(className)) {\n const arbitraryPropertyClassName = arbitraryPropertyRegex.exec(className)![1]\n const property = arbitraryPropertyClassName?.substring(\n 0,\n arbitraryPropertyClassName.indexOf(':'),\n )\n\n if (property) {\n // I use two dots here because one dot is used as prefix for class groups in plugins\n return 'arbitrary..' + property\n }\n }\n}\n\n/**\n * Exported for testing only\n */\nexport const createClassMap = (config: Config<GenericClassGroupIds, GenericThemeGroupIds>) => {\n const { theme, prefix } = config\n const classMap: ClassPartObject = {\n nextPart: new Map<string, ClassPartObject>(),\n validators: [],\n }\n\n const prefixedClassGroupEntries = getPrefixedClassGroupEntries(\n Object.entries(config.classGroups),\n prefix,\n )\n\n prefixedClassGroupEntries.forEach(([classGroupId, classGroup]) => {\n processClassesRecursively(classGroup, classMap, classGroupId, theme)\n })\n\n return classMap\n}\n\nconst processClassesRecursively = (\n classGroup: ClassGroup<GenericThemeGroupIds>,\n classPartObject: ClassPartObject,\n classGroupId: GenericClassGroupIds,\n theme: ThemeObject<GenericThemeGroupIds>,\n) => {\n classGroup.forEach((classDefinition) => {\n if (typeof classDefinition === 'string') {\n const classPartObjectToEdit =\n classDefinition === '' ? classPartObject : getPart(classPartObject, classDefinition)\n classPartObjectToEdit.classGroupId = classGroupId\n return\n }\n\n if (typeof classDefinition === 'function') {\n if (isThemeGetter(classDefinition)) {\n processClassesRecursively(\n classDefinition(theme),\n classPartObject,\n classGroupId,\n theme,\n )\n return\n }\n\n classPartObject.validators.push({\n validator: classDefinition,\n classGroupId,\n })\n\n return\n }\n\n Object.entries(classDefinition).forEach(([key, classGroup]) => {\n processClassesRecursively(\n classGroup,\n getPart(classPartObject, key),\n classGroupId,\n theme,\n )\n })\n })\n}\n\nconst getPart = (classPartObject: ClassPartObject, path: string) => {\n let currentClassPartObject = classPartObject\n\n path.split(CLASS_PART_SEPARATOR).forEach((pathPart) => {\n if (!currentClassPartObject.nextPart.has(pathPart)) {\n currentClassPartObject.nextPart.set(pathPart, {\n nextPart: new Map(),\n validators: [],\n })\n }\n\n currentClassPartObject = currentClassPartObject.nextPart.get(pathPart)!\n })\n\n return currentClassPartObject\n}\n\nconst isThemeGetter = (func: ClassValidator | ThemeGetter): func is ThemeGetter =>\n (func as ThemeGetter).isThemeGetter\n\nconst getPrefixedClassGroupEntries = (\n classGroupEntries: Array<[classGroupId: string, classGroup: ClassGroup<GenericThemeGroupIds>]>,\n prefix: string | undefined,\n): Array<[classGroupId: string, classGroup: ClassGroup<GenericThemeGroupIds>]> => {\n if (!prefix) {\n return classGroupEntries\n }\n\n return classGroupEntries.map(([classGroupId, classGroup]) => {\n const prefixedClassGroup = classGroup.map((classDefinition) => {\n if (typeof classDefinition === 'string') {\n return prefix + classDefinition\n }\n\n if (typeof classDefinition === 'object') {\n return Object.fromEntries(\n Object.entries(classDefinition).map(([key, value]) => [prefix + key, value]),\n )\n }\n\n return classDefinition\n })\n\n return [classGroupId, prefixedClassGroup]\n })\n}\n","export function buildFormatLongFn(args) {\n return (options = {}) => {\n // TODO: Remove String()\n const width = options.width ? String(options.width) : args.defaultWidth;\n const format = args.formats[width] || args.formats[args.defaultWidth];\n return format;\n };\n}\n","export function buildMatchFn(args) {\n return (string, options = {}) => {\n const width = options.width;\n\n const matchPattern =\n (width && args.matchPatterns[width]) ||\n args.matchPatterns[args.defaultMatchWidth];\n const matchResult = string.match(matchPattern);\n\n if (!matchResult) {\n return null;\n }\n const matchedString = matchResult[0];\n\n const parsePatterns =\n (width && args.parsePatterns[width]) ||\n args.parsePatterns[args.defaultParseWidth];\n\n const key = Array.isArray(parsePatterns)\n ? findIndex(parsePatterns, (pattern) => pattern.test(matchedString))\n : // [TODO] -- I challenge you to fix the type\n findKey(parsePatterns, (pattern) => pattern.test(matchedString));\n\n let value;\n\n value = args.valueCallback ? args.valueCallback(key) : key;\n value = options.valueCallback\n ? // [TODO] -- I challenge you to fix the type\n options.valueCallback(value)\n : value;\n\n const rest = string.slice(matchedString.length);\n\n return { value, rest };\n };\n}\n\nfunction findKey(object, predicate) {\n for (const key in object) {\n if (\n Object.prototype.hasOwnProperty.call(object, key) &&\n predicate(object[key])\n ) {\n return key;\n }\n }\n return undefined;\n}\n\nfunction findIndex(array, predicate) {\n for (let key = 0; key < array.length; key++) {\n if (predicate(array[key])) {\n return key;\n }\n }\n return undefined;\n}\n","export function buildMatchPatternFn(args) {\n return (string, options = {}) => {\n const matchResult = string.match(args.matchPattern);\n if (!matchResult) return null;\n const matchedString = matchResult[0];\n\n const parseResult = string.match(args.parsePattern);\n if (!parseResult) return null;\n let value = args.valueCallback\n ? args.valueCallback(parseResult[0])\n : parseResult[0];\n\n // [TODO] I challenge you to fix the type\n value = options.valueCallback ? options.valueCallback(value) : value;\n\n const rest = string.slice(matchedString.length);\n\n return { value, rest };\n };\n}\n","export function getRoundingMethod(method) {\n return (number) => {\n const round = method ? Math[method] : Math.trunc;\n const result = round(number);\n // Prevent negative zero\n return result === 0 ? 0 : result;\n };\n}\n","import { buildFormatLongFn } from \"../../_lib/buildFormatLongFn.js\";\n\nconst dateFormats = {\n full: \"EEEE, MMMM do, y\",\n long: \"MMMM do, y\",\n medium: \"MMM d, y\",\n short: \"MM/dd/yyyy\",\n};\n\nconst timeFormats = {\n full: \"h:mm:ss a zzzz\",\n long: \"h:mm:ss a z\",\n medium: \"h:mm:ss a\",\n short: \"h:mm a\",\n};\n\nconst dateTimeFormats = {\n full: \"{{date}} 'at' {{time}}\",\n long: \"{{date}} 'at' {{time}}\",\n medium: \"{{date}}, {{time}}\",\n short: \"{{date}}, {{time}}\",\n};\n\nexport const formatLong = {\n date: buildFormatLongFn({\n formats: dateFormats,\n defaultWidth: \"full\",\n }),\n\n time: buildFormatLongFn({\n formats: timeFormats,\n defaultWidth: \"full\",\n }),\n\n dateTime: buildFormatLongFn({\n formats: dateTimeFormats,\n defaultWidth: \"full\",\n }),\n};\n","import { buildLocalizeFn } from \"../../_lib/buildLocalizeFn.js\";\n\nconst eraValues = {\n narrow: [\"B\", \"A\"],\n abbreviated: [\"BC\", \"AD\"],\n wide: [\"Before Christ\", \"Anno Domini\"],\n};\n\nconst quarterValues = {\n narrow: [\"1\", \"2\", \"3\", \"4\"],\n abbreviated: [\"Q1\", \"Q2\", \"Q3\", \"Q4\"],\n wide: [\"1st quarter\", \"2nd quarter\", \"3rd quarter\", \"4th quarter\"],\n};\n\n// Note: in English, the names of days of the week and months are capitalized.\n// If you are making a new locale based on this one, check if the same is true for the language you're working on.\n// Generally, formatted dates should look like they are in the middle of a sentence,\n// e.g. in Spanish language the weekdays and months should be in the lowercase.\nconst monthValues = {\n narrow: [\"J\", \"F\", \"M\", \"A\", \"M\", \"J\", \"J\", \"A\", \"S\", \"O\", \"N\", \"D\"],\n abbreviated: [\n \"Jan\",\n \"Feb\",\n \"Mar\",\n \"Apr\",\n \"May\",\n \"Jun\",\n \"Jul\",\n \"Aug\",\n \"Sep\",\n \"Oct\",\n \"Nov\",\n \"Dec\",\n ],\n\n wide: [\n \"January\",\n \"February\",\n \"March\",\n \"April\",\n \"May\",\n \"June\",\n \"July\",\n \"August\",\n \"September\",\n \"October\",\n \"November\",\n \"December\",\n ],\n};\n\nconst dayValues = {\n narrow: [\"S\", \"M\", \"T\", \"W\", \"T\", \"F\", \"S\"],\n short: [\"Su\", \"Mo\", \"Tu\", \"We\", \"Th\", \"Fr\", \"Sa\"],\n abbreviated: [\"Sun\", \"Mon\", \"Tue\", \"Wed\", \"Thu\", \"Fri\", \"Sat\"],\n wide: [\n \"Sunday\",\n \"Monday\",\n \"Tuesday\",\n \"Wednesday\",\n \"Thursday\",\n \"Friday\",\n \"Saturday\",\n ],\n};\n\nconst dayPeriodValues = {\n narrow: {\n am: \"a\",\n pm: \"p\",\n midnight: \"mi\",\n noon: \"n\",\n morning: \"morning\",\n afternoon: \"afternoon\",\n evening: \"evening\",\n night: \"night\",\n },\n abbreviated: {\n am: \"AM\",\n pm: \"PM\",\n midnight: \"midnight\",\n noon: \"noon\",\n morning: \"morning\",\n afternoon: \"afternoon\",\n evening: \"evening\",\n night: \"night\",\n },\n wide: {\n am: \"a.m.\",\n pm: \"p.m.\",\n midnight: \"midnight\",\n noon: \"noon\",\n morning: \"morning\",\n afternoon: \"afternoon\",\n evening: \"evening\",\n night: \"night\",\n },\n};\n\nconst formattingDayPeriodValues = {\n narrow: {\n am: \"a\",\n pm: \"p\",\n midnight: \"mi\",\n noon: \"n\",\n morning: \"in the morning\",\n afternoon: \"in the afternoon\",\n evening: \"in the evening\",\n night: \"at night\",\n },\n abbreviated: {\n am: \"AM\",\n pm: \"PM\",\n midnight: \"midnight\",\n noon: \"noon\",\n morning: \"in the morning\",\n afternoon: \"in the afternoon\",\n evening: \"in the evening\",\n night: \"at night\",\n },\n wide: {\n am: \"a.m.\",\n pm: \"p.m.\",\n midnight: \"midnight\",\n noon: \"noon\",\n morning: \"in the morning\",\n afternoon: \"in the afternoon\",\n evening: \"in the evening\",\n night: \"at night\",\n },\n};\n\nconst ordinalNumber = (dirtyNumber, _options) => {\n const number = Number(dirtyNumber);\n\n // If ordinal numbers depend on context, for example,\n // if they are different for different grammatical genders,\n // use `options.unit`.\n //\n // `unit` can be 'year', 'quarter', 'month', 'week', 'date', 'dayOfYear',\n // 'day', 'hour', 'minute', 'second'.\n\n const rem100 = number % 100;\n if (rem100 > 20 || rem100 < 10) {\n switch (rem100 % 10) {\n case 1:\n return number + \"st\";\n case 2:\n return number + \"nd\";\n case 3:\n return number + \"rd\";\n }\n }\n return number + \"th\";\n};\n\nexport const localize = {\n ordinalNumber,\n\n era: buildLocalizeFn({\n values: eraValues,\n defaultWidth: \"wide\",\n }),\n\n quarter: buildLocalizeFn({\n values: quarterValues,\n defaultWidth: \"wide\",\n argumentCallback: (quarter) => quarter - 1,\n }),\n\n month: buildLocalizeFn({\n values: monthValues,\n defaultWidth: \"wide\",\n }),\n\n day: buildLocalizeFn({\n values: dayValues,\n defaultWidth: \"wide\",\n }),\n\n dayPeriod: buildLocalizeFn({\n values: dayPeriodValues,\n defaultWidth: \"wide\",\n formattingValues: formattingDayPeriodValues,\n defaultFormattingWidth: \"wide\",\n }),\n};\n","import { constructFrom } from \"../constructFrom.js\";\n\nexport function normalizeDates(context, ...dates) {\n const normalize = constructFrom.bind(\n null,\n context || dates.find((date) => typeof date === \"object\"),\n );\n return dates.map(normalize);\n}\n","import { buildMatchFn } from \"../../_lib/buildMatchFn.js\";\nimport { buildMatchPatternFn } from \"../../_lib/buildMatchPatternFn.js\";\n\nconst matchOrdinalNumberPattern = /^(\\d+)(th|st|nd|rd)?/i;\nconst parseOrdinalNumberPattern = /\\d+/i;\n\nconst matchEraPatterns = {\n narrow: /^(b|a)/i,\n abbreviated: /^(b\\.?\\s?c\\.?|b\\.?\\s?c\\.?\\s?e\\.?|a\\.?\\s?d\\.?|c\\.?\\s?e\\.?)/i,\n wide: /^(before christ|before common era|anno domini|common era)/i,\n};\nconst parseEraPatterns = {\n any: [/^b/i, /^(a|c)/i],\n};\n\nconst matchQuarterPatterns = {\n narrow: /^[1234]/i,\n abbreviated: /^q[1234]/i,\n wide: /^[1234](th|st|nd|rd)? quarter/i,\n};\nconst parseQuarterPatterns = {\n any: [/1/i, /2/i, /3/i, /4/i],\n};\n\nconst matchMonthPatterns = {\n narrow: /^[jfmasond]/i,\n abbreviated: /^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,\n wide: /^(january|february|march|april|may|june|july|august|september|october|november|december)/i,\n};\nconst parseMonthPatterns = {\n narrow: [\n /^j/i,\n /^f/i,\n /^m/i,\n /^a/i,\n /^m/i,\n /^j/i,\n /^j/i,\n /^a/i,\n /^s/i,\n /^o/i,\n /^n/i,\n /^d/i,\n ],\n\n any: [\n /^ja/i,\n /^f/i,\n /^mar/i,\n /^ap/i,\n /^may/i,\n /^jun/i,\n /^jul/i,\n /^au/i,\n /^s/i,\n /^o/i,\n /^n/i,\n /^d/i,\n ],\n};\n\nconst matchDayPatterns = {\n narrow: /^[smtwf]/i,\n short: /^(su|mo|tu|we|th|fr|sa)/i,\n abbreviated: /^(sun|mon|tue|wed|thu|fri|sat)/i,\n wide: /^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i,\n};\nconst parseDayPatterns = {\n narrow: [/^s/i, /^m/i, /^t/i, /^w/i, /^t/i, /^f/i, /^s/i],\n any: [/^su/i, /^m/i, /^tu/i, /^w/i, /^th/i, /^f/i, /^sa/i],\n};\n\nconst matchDayPeriodPatterns = {\n narrow: /^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,\n any: /^([ap]\\.?\\s?m\\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i,\n};\nconst parseDayPeriodPatterns = {\n any: {\n am: /^a/i,\n pm: /^p/i,\n midnight: /^mi/i,\n noon: /^no/i,\n morning: /morning/i,\n afternoon: /afternoon/i,\n evening: /evening/i,\n night: /night/i,\n },\n};\n\nexport const match = {\n ordinalNumber: buildMatchPatternFn({\n matchPattern: matchOrdinalNumberPattern,\n parsePattern: parseOrdinalNumberPattern,\n valueCallback: (value) => parseInt(value, 10),\n }),\n\n era: buildMatchFn({\n matchPatterns: matchEraPatterns,\n defaultMatchWidth: \"wide\",\n parsePatterns: parseEraPatterns,\n defaultParseWidth: \"any\",\n }),\n\n quarter: buildMatchFn({\n matchPatterns: matchQuarterPatterns,\n defaultMatchWidth: \"wide\",\n parsePatterns: parseQuarterPatterns,\n defaultParseWidth: \"any\",\n valueCallback: (index) => index + 1,\n }),\n\n month: buildMatchFn({\n matchPatterns: matchMonthPatterns,\n defaultMatchWidth: \"wide\",\n parsePatterns: parseMonthPatterns,\n defaultParseWidth: \"any\",\n }),\n\n day: buildMatchFn({\n matchPatterns: matchDayPatterns,\n defaultMatchWidth: \"wide\",\n parsePatterns: parseDayPatterns,\n defaultParseWidth: \"any\",\n }),\n\n dayPeriod: buildMatchFn({\n matchPatterns: matchDayPeriodPatterns,\n defaultMatchWidth: \"any\",\n parsePatterns: parseDayPeriodPatterns,\n defaultParseWidth: \"any\",\n }),\n};\n","import { toDate } from \"../toDate.js\";\n\n/**\n * Google Chrome as of 67.0.3396.87 introduced timezones with offset that includes seconds.\n * They usually appear for dates that denote time before the timezones were introduced\n * (e.g. for 'Europe/Prague' timezone the offset is GMT+00:57:44 before 1 October 1891\n * and GMT+01:00:00 after that date)\n *\n * Date#getTimezoneOffset returns the offset in minutes and would return 57 for the example above,\n * which would lead to incorrect calculations.\n *\n * This function returns the timezone offset in milliseconds that takes seconds in account.\n */\nexport function getTimezoneOffsetInMilliseconds(date) {\n const _date = toDate(date);\n const utcDate = new Date(\n Date.UTC(\n _date.getFullYear(),\n _date.getMonth(),\n _date.getDate(),\n _date.getHours(),\n _date.getMinutes(),\n _date.getSeconds(),\n _date.getMilliseconds(),\n ),\n );\n utcDate.setUTCFullYear(_date.getFullYear());\n return +date - +utcDate;\n}\n","import { formatDistance } from \"./en-US/_lib/formatDistance.js\";\nimport { formatLong } from \"./en-US/_lib/formatLong.js\";\nimport { formatRelative } from \"./en-US/_lib/formatRelative.js\";\nimport { localize } from \"./en-US/_lib/localize.js\";\nimport { match } from \"./en-US/_lib/match.js\";\n\n/**\n * @category Locales\n * @summary English locale (United States).\n * @language English\n * @iso-639-2 eng\n * @author Sasha Koss [@kossnocorp](https://github.com/kossnocorp)\n * @author Lesha Koss [@leshakoss](https://github.com/leshakoss)\n */\nexport const enUS = {\n code: \"en-US\",\n formatDistance: formatDistance,\n formatLong: formatLong,\n formatRelative: formatRelative,\n localize: localize,\n match: match,\n options: {\n weekStartsOn: 0 /* Sunday */,\n firstWeekContainsDate: 1,\n },\n};\n\n// Fallback for modularized imports:\nexport default enUS;\n","/**\n * @module constants\n * @summary Useful constants\n * @description\n * Collection of useful date constants.\n *\n * The constants could be imported from `date-fns/constants`:\n *\n * ```ts\n * import { maxTime, minTime } from \"./constants/date-fns/constants\";\n *\n * function isAllowedTime(time) {\n * return time <= maxTime && time >= minTime;\n * }\n * ```\n */\n\n/**\n * @constant\n * @name daysInWeek\n * @summary Days in 1 week.\n */\nexport const daysInWeek = 7;\n\n/**\n * @constant\n * @name daysInYear\n * @summary Days in 1 year.\n *\n * @description\n * How many days in a year.\n *\n * One years equals 365.2425 days according to the formula:\n *\n * > Leap year occurs every 4 years, except for years that are divisible by 100 and not divisible by 400.\n * > 1 mean year = (365+1/4-1/100+1/400) days = 365.2425 days\n */\nexport const daysInYear = 365.2425;\n\n/**\n * @constant\n * @name maxTime\n * @summary Maximum allowed time.\n *\n * @example\n * import { maxTime } from \"./constants/date-fns/constants\";\n *\n * const isValid = 8640000000000001 <= maxTime;\n * //=> false\n *\n * new Date(8640000000000001);\n * //=> Invalid Date\n */\nexport const maxTime = Math.pow(10, 8) * 24 * 60 * 60 * 1000;\n\n/**\n * @constant\n * @name minTime\n * @summary Minimum allowed time.\n *\n * @example\n * import { minTime } from \"./constants/date-fns/constants\";\n *\n * const isValid = -8640000000000001 >= minTime;\n * //=> false\n *\n * new Date(-8640000000000001)\n * //=> Invalid Date\n */\nexport const minTime = -maxTime;\n\n/**\n * @constant\n * @name millisecondsInWeek\n * @summary Milliseconds in 1 week.\n */\nexport const millisecondsInWeek = 604800000;\n\n/**\n * @constant\n * @name millisecondsInDay\n * @summary Milliseconds in 1 day.\n */\nexport const millisecondsInDay = 86400000;\n\n/**\n * @constant\n * @name millisecondsInMinute\n * @summary Milliseconds in 1 minute\n */\nexport const millisecondsInMinute = 60000;\n\n/**\n * @constant\n * @name millisecondsInHour\n * @summary Milliseconds in 1 hour\n */\nexport const millisecondsInHour = 3600000;\n\n/**\n * @constant\n * @name millisecondsInSecond\n * @summary Milliseconds in 1 second\n */\nexport const millisecondsInSecond = 1000;\n\n/**\n * @constant\n * @name minutesInYear\n * @summary Minutes in 1 year.\n */\nexport const minutesInYear = 525600;\n\n/**\n * @constant\n * @name minutesInMonth\n * @summary Minutes in 1 month.\n */\nexport const minutesInMonth = 43200;\n\n/**\n * @constant\n * @name minutesInDay\n * @summary Minutes in 1 day.\n */\nexport const minutesInDay = 1440;\n\n/**\n * @constant\n * @name minutesInHour\n * @summary Minutes in 1 hour.\n */\nexport const minutesInHour = 60;\n\n/**\n * @constant\n * @name monthsInQuarter\n * @summary Months in 1 quarter.\n */\nexport const monthsInQuarter = 3;\n\n/**\n * @constant\n * @name monthsInYear\n * @summary Months in 1 year.\n */\nexport const monthsInYear = 12;\n\n/**\n * @constant\n * @name quartersInYear\n * @summary Quarters in 1 year\n */\nexport const quartersInYear = 4;\n\n/**\n * @constant\n * @name secondsInHour\n * @summary Seconds in 1 hour.\n */\nexport const secondsInHour = 3600;\n\n/**\n * @constant\n * @name secondsInMinute\n * @summary Seconds in 1 minute.\n */\nexport const secondsInMinute = 60;\n\n/**\n * @constant\n * @name secondsInDay\n * @summary Seconds in 1 day.\n */\nexport const secondsInDay = secondsInHour * 24;\n\n/**\n * @constant\n * @name secondsInWeek\n * @summary Seconds in 1 week.\n */\nexport const secondsInWeek = secondsInDay * 7;\n\n/**\n * @constant\n * @name secondsInYear\n * @summary Seconds in 1 year.\n */\nexport const secondsInYear = secondsInDay * daysInYear;\n\n/**\n * @constant\n * @name secondsInMonth\n * @summary Seconds in 1 month\n */\nexport const secondsInMonth = secondsInYear / 12;\n\n/**\n * @constant\n * @name secondsInQuarter\n * @summary Seconds in 1 quarter.\n */\nexport const secondsInQuarter = secondsInMonth * 3;\n\n/**\n * @constant\n * @name constructFromSymbol\n * @summary Symbol enabling Date extensions to inherit properties from the reference date.\n *\n * The symbol is used to enable the `constructFrom` function to construct a date\n * using a reference date and a value. It allows to transfer extra properties\n * from the reference date to the new date. It's useful for extensions like\n * [`TZDate`](https://github.com/date-fns/tz) that accept a time zone as\n * a constructor argument.\n */\nexport const constructFromSymbol = Symbol.for(\"constructDateFrom\");\n","import { toDate } from \"./toDate.js\";\n\n/**\n * @name compareAsc\n * @category Common Helpers\n * @summary Compare the two dates and return -1, 0 or 1.\n *\n * @description\n * Compare the two dates and return 1 if the first date is after the second,\n * -1 if the first date is before the second or 0 if dates are equal.\n *\n * @param dateLeft - The first date to compare\n * @param dateRight - The second date to compare\n *\n * @returns The result of the comparison\n *\n * @example\n * // Compare 11 February 1987 and 10 July 1989:\n * const result = compareAsc(new Date(1987, 1, 11), new Date(1989, 6, 10))\n * //=> -1\n *\n * @example\n * // Sort the array of dates:\n * const result = [\n * new Date(1995, 6, 2),\n * new Date(1987, 1, 11),\n * new Date(1989, 6, 10)\n * ].sort(compareAsc)\n * //=> [\n * // Wed Feb 11 1987 00:00:00,\n * // Mon Jul 10 1989 00:00:00,\n * // Sun Jul 02 1995 00:00:00\n * // ]\n */\nexport function compareAsc(dateLeft, dateRight) {\n const diff = +toDate(dateLeft) - +toDate(dateRight);\n\n if (diff < 0) return -1;\n else if (diff > 0) return 1;\n\n // Return 0 if diff is 0; return NaN if diff is NaN\n return diff;\n}\n\n// Fallback for modularized imports:\nexport default compareAsc;\n","import { constructFromSymbol } from \"./constants.js\";\n\n/**\n * @name constructFrom\n * @category Generic Helpers\n * @summary Constructs a date using the reference date and the value\n *\n * @description\n * The function constructs a new date using the constructor from the reference\n * date and the given value. It helps to build generic functions that accept\n * date extensions.\n *\n * It defaults to `Date` if the passed reference date is a number or a string.\n *\n * Starting from v3.7.0, it allows to construct a date using `[Symbol.for(\"constructDateFrom\")]`\n * enabling to transfer extra properties from the reference date to the new date.\n * It's useful for extensions like [`TZDate`](https://github.com/date-fns/tz)\n * that accept a time zone as a constructor argument.\n *\n * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).\n *\n * @param date - The reference date to take constructor from\n * @param value - The value to create the date\n *\n * @returns Date initialized using the given date and value\n *\n * @example\n * import { constructFrom } from \"./constructFrom/date-fns\";\n *\n * // A function that clones a date preserving the original type\n * function cloneDate<DateType extends Date>(date: DateType): DateType {\n * return constructFrom(\n * date, // Use constructor from the given date\n * date.getTime() // Use the date value to create a new date\n * );\n * }\n */\nexport function constructFrom(date, value) {\n if (typeof date === \"function\") return date(value);\n\n if (date && typeof date === \"object\" && constructFromSymbol in date)\n return date[constructFromSymbol](value);\n\n if (date instanceof Date) return new date.constructor(value);\n\n return new Date(value);\n}\n\n// Fallback for modularized imports:\nexport default constructFrom;\n","/**\n * The localize function argument callback which allows to convert raw value to\n * the actual type.\n *\n * @param value - The value to convert\n *\n * @returns The converted value\n */\n\n/**\n * The map of localized values for each width.\n */\n\n/**\n * The index type of the locale unit value. It types conversion of units of\n * values that don't start at 0 (i.e. quarters).\n */\n\n/**\n * Converts the unit value to the tuple of values.\n */\n\n/**\n * The tuple of localized era values. The first element represents BC,\n * the second element represents AD.\n */\n\n/**\n * The tuple of localized quarter values. The first element represents Q1.\n */\n\n/**\n * The tuple of localized day values. The first element represents Sunday.\n */\n\n/**\n * The tuple of localized month values. The first element represents January.\n */\n\nexport function buildLocalizeFn(args) {\n return (value, options) => {\n const context = options?.context ? String(options.context) : \"standalone\";\n\n let valuesArray;\n if (context === \"formatting\" && args.formattingValues) {\n const defaultWidth = args.defaultFormattingWidth || args.defaultWidth;\n const width = options?.width ? String(options.width) : defaultWidth;\n\n valuesArray =\n args.formattingValues[width] || args.formattingValues[defaultWidth];\n } else {\n const defaultWidth = args.defaultWidth;\n const width = options?.width ? String(options.width) : args.defaultWidth;\n\n valuesArray = args.values[width] || args.values[defaultWidth];\n }\n const index = args.argumentCallback ? args.argumentCallback(value) : value;\n\n // @ts-expect-error - For some reason TypeScript just don't want to match it, no matter how hard we try. I challenge you to try to remove it!\n return valuesArray[index];\n };\n}\n","import { constructFrom } from \"./constructFrom.js\";\n\n/**\n * @name toDate\n * @category Common Helpers\n * @summary Convert the given argument to an instance of Date.\n *\n * @description\n * Convert the given argument to an instance of Date.\n *\n * If the argument is an instance of Date, the function returns its clone.\n *\n * If the argument is a number, it is treated as a timestamp.\n *\n * If the argument is none of the above, the function returns Invalid Date.\n *\n * Starting from v3.7.0, it clones a date using `[Symbol.for(\"constructDateFrom\")]`\n * enabling to transfer extra properties from the reference date to the new date.\n * It's useful for extensions like [`TZDate`](https://github.com/date-fns/tz)\n * that accept a time zone as a constructor argument.\n *\n * **Note**: *all* Date arguments passed to any *date-fns* function is processed by `toDate`.\n *\n * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).\n * @typeParam ResultDate - The result `Date` type, it is the type returned from the context function if it is passed, or inferred from the arguments.\n *\n * @param argument - The value to convert\n *\n * @returns The parsed date in the local time zone\n *\n * @example\n * // Clone the date:\n * const result = toDate(new Date(2014, 1, 11, 11, 30, 30))\n * //=> Tue Feb 11 2014 11:30:30\n *\n * @example\n * // Convert the timestamp to date:\n * const result = toDate(1392098430000)\n * //=> Tue Feb 11 2014 11:30:30\n */\nexport function toDate(argument, context) {\n // [TODO] Get rid of `toDate` or `constructFrom`?\n return constructFrom(context || argument, argument);\n}\n\n// Fallback for modularized imports:\nexport default toDate;\n","import { defaultLocale } from \"./_lib/defaultLocale.js\";\nimport { getDefaultOptions } from \"./_lib/defaultOptions.js\";\nimport { getRoundingMethod } from \"./_lib/getRoundingMethod.js\";\nimport { getTimezoneOffsetInMilliseconds } from \"./_lib/getTimezoneOffsetInMilliseconds.js\";\nimport { normalizeDates } from \"./_lib/normalizeDates.js\";\nimport { compareAsc } from \"./compareAsc.js\";\nimport {\n millisecondsInMinute,\n minutesInDay,\n minutesInMonth,\n minutesInYear,\n} from \"./constants.js\";\n\n/**\n * The {@link formatDistanceStrict} function options.\n */\n\n/**\n * The unit used to format the distance in {@link formatDistanceStrict}.\n */\n\n/**\n * @name formatDistanceStrict\n * @category Common Helpers\n * @summary Return the distance between the given dates in words.\n *\n * @description\n * Return the distance between the given dates in words, using strict units.\n * This is like `formatDistance`, but does not use helpers like 'almost', 'over',\n * 'less than' and the like.\n *\n * | Distance between dates | Result |\n * |------------------------|---------------------|\n * | 0 ... 59 secs | [0..59] seconds |\n * | 1 ... 59 mins | [1..59] minutes |\n * | 1 ... 23 hrs | [1..23] hours |\n * | 1 ... 29 days | [1..29] days |\n * | 1 ... 11 months | [1..11] months |\n * | 1 ... N years | [1..N] years |\n *\n * @param laterDate - The date\n * @param earlierDate - The date to compare with\n * @param options - An object with options\n *\n * @returns The distance in words\n *\n * @throws `date` must not be Invalid Date\n * @throws `baseDate` must not be Invalid Date\n * @throws `options.unit` must be 'second', 'minute', 'hour', 'day', 'month' or 'year'\n * @throws `options.locale` must contain `formatDistance` property\n *\n * @example\n * // What is the distance between 2 July 2014 and 1 January 2015?\n * const result = formatDistanceStrict(new Date(2014, 6, 2), new Date(2015, 0, 2))\n * //=> '6 months'\n *\n * @example\n * // What is the distance between 1 January 2015 00:00:15\n * // and 1 January 2015 00:00:00?\n * const result = formatDistanceStrict(\n * new Date(2015, 0, 1, 0, 0, 15),\n * new Date(2015, 0, 1, 0, 0, 0)\n * )\n * //=> '15 seconds'\n *\n * @example\n * // What is the distance from 1 January 2016\n * // to 1 January 2015, with a suffix?\n * const result = formatDistanceStrict(new Date(2015, 0, 1), new Date(2016, 0, 1), {\n * addSuffix: true\n * })\n * //=> '1 year ago'\n *\n * @example\n * // What is the distance from 1 January 2016\n * // to 1 January 2015, in minutes?\n * const result = formatDistanceStrict(new Date(2016, 0, 1), new Date(2015, 0, 1), {\n * unit: 'minute'\n * })\n * //=> '525600 minutes'\n *\n * @example\n * // What is the distance from 1 January 2015\n * // to 28 January 2015, in months, rounded up?\n * const result = formatDistanceStrict(new Date(2015, 0, 28), new Date(2015, 0, 1), {\n * unit: 'month',\n * roundingMethod: 'ceil'\n * })\n * //=> '1 month'\n *\n * @example\n * // What is the distance between 1 August 2016 and 1 January 2015 in Esperanto?\n * import { eoLocale } from 'date-fns/locale/eo'\n * const result = formatDistanceStrict(new Date(2016, 7, 1), new Date(2015, 0, 1), {\n * locale: eoLocale\n * })\n * //=> '1 jaro'\n */\n\nexport function formatDistanceStrict(laterDate, earlierDate, options) {\n const defaultOptions = getDefaultOptions();\n const locale = options?.locale ?? defaultOptions.locale ?? defaultLocale;\n\n const comparison = compareAsc(laterDate, earlierDate);\n\n if (isNaN(comparison)) {\n throw new RangeError(\"Invalid time value\");\n }\n\n const localizeOptions = Object.assign({}, options, {\n addSuffix: options?.addSuffix,\n comparison: comparison,\n });\n\n const [laterDate_, earlierDate_] = normalizeDates(\n options?.in,\n ...(comparison > 0 ? [earlierDate, laterDate] : [laterDate, earlierDate]),\n );\n\n const roundingMethod = getRoundingMethod(options?.roundingMethod ?? \"round\");\n\n const milliseconds = earlierDate_.getTime() - laterDate_.getTime();\n const minutes = milliseconds / millisecondsInMinute;\n\n const timezoneOffset =\n getTimezoneOffsetInMilliseconds(earlierDate_) -\n getTimezoneOffsetInMilliseconds(laterDate_);\n\n // Use DST-normalized difference in minutes for years, months and days;\n // use regular difference in minutes for hours, minutes and seconds.\n const dstNormalizedMinutes =\n (milliseconds - timezoneOffset) / millisecondsInMinute;\n\n const defaultUnit = options?.unit;\n let unit;\n if (!defaultUnit) {\n if (minutes < 1) {\n unit = \"second\";\n } else if (minutes < 60) {\n unit = \"minute\";\n } else if (minutes < minutesInDay) {\n unit = \"hour\";\n } else if (dstNormalizedMinutes < minutesInMonth) {\n unit = \"day\";\n } else if (dstNormalizedMinutes < minutesInYear) {\n unit = \"month\";\n } else {\n unit = \"year\";\n }\n } else {\n unit = defaultUnit;\n }\n\n // 0 up to 60 seconds\n if (unit === \"second\") {\n const seconds = roundingMethod(milliseconds / 1000);\n return locale.formatDistance(\"xSeconds\", seconds, localizeOptions);\n\n // 1 up to 60 mins\n } else if (unit === \"minute\") {\n const roundedMinutes = roundingMethod(minutes);\n return locale.formatDistance(\"xMinutes\", roundedMinutes, localizeOptions);\n\n // 1 up to 24 hours\n } else if (unit === \"hour\") {\n const hours = roundingMethod(minutes / 60);\n return locale.formatDistance(\"xHours\", hours, localizeOptions);\n\n // 1 up to 30 days\n } else if (unit === \"day\") {\n const days = roundingMethod(dstNormalizedMinutes / minutesInDay);\n return locale.formatDistance(\"xDays\", days, localizeOptions);\n\n // 1 up to 12 months\n } else if (unit === \"month\") {\n const months = roundingMethod(dstNormalizedMinutes / minutesInMonth);\n return months === 12 && defaultUnit !== \"month\"\n ? locale.formatDistance(\"xYears\", 1, localizeOptions)\n : locale.formatDistance(\"xMonths\", months, localizeOptions);\n\n // 1 year up to max Date\n } else {\n const years = roundingMethod(dstNormalizedMinutes / minutesInYear);\n return locale.formatDistance(\"xYears\", years, localizeOptions);\n }\n}\n\n// Fallback for modularized imports:\nexport default formatDistanceStrict;\n","// Export is needed because TypeScript complains about an error otherwise:\n// Error: …/tailwind-merge/src/config-utils.ts(8,17): semantic error TS4058: Return type of exported function has or is using name 'LruCache' from external module \"…/tailwind-merge/src/lru-cache\" but cannot be named.\nexport interface LruCache<Key, Value> {\n get(key: Key): Value | undefined\n set(key: Key, value: Value): void\n}\n\n// LRU cache inspired from hashlru (https://github.com/dominictarr/hashlru/blob/v1.0.4/index.js) but object replaced with Map to improve performance\nexport const createLruCache = <Key, Value>(maxCacheSize: number): LruCache<Key, Value> => {\n if (maxCacheSize < 1) {\n return {\n get: () => undefined,\n set: () => {},\n }\n }\n\n let cacheSize = 0\n let cache = new Map<Key, Value>()\n let previousCache = new Map<Key, Value>()\n\n const update = (key: Key, value: Value) => {\n cache.set(key, value)\n cacheSize++\n\n if (cacheSize > maxCacheSize) {\n cacheSize = 0\n previousCache = cache\n cache = new Map()\n }\n }\n\n return {\n get(key) {\n let value = cache.get(key)\n\n if (value !== undefined) {\n return value\n }\n if ((value = previousCache.get(key)) !== undefined) {\n update(key, value)\n return value\n }\n },\n set(key, value) {\n if (cache.has(key)) {\n cache.set(key, value)\n } else {\n update(key, value)\n }\n },\n }\n}\n","import { GenericConfig } from './types'\n\nexport const IMPORTANT_MODIFIER = '!'\n\nexport const createParseClassName = (config: GenericConfig) => {\n const { separator, experimentalParseClassName } = config\n const isSeparatorSingleCharacter = separator.length === 1\n const firstSeparatorCharacter = separator[0]\n const separatorLength = separator.length\n\n // parseClassName inspired by https://github.com/tailwindlabs/tailwindcss/blob/v3.2.2/src/util/splitAtTopLevelOnly.js\n const parseClassName = (className: string) => {\n const modifiers = []\n\n let bracketDepth = 0\n let modifierStart = 0\n let postfixModifierPosition: number | undefined\n\n for (let index = 0; index < className.length; index++) {\n let currentCharacter = className[index]\n\n if (bracketDepth === 0) {\n if (\n currentCharacter === firstSeparatorCharacter &&\n (isSeparatorSingleCharacter ||\n className.slice(index, index + separatorLength) === separator)\n ) {\n modifiers.push(className.slice(modifierStart, index))\n modifierStart = index + separatorLength\n continue\n }\n\n if (currentCharacter === '/') {\n postfixModifierPosition = index\n continue\n }\n }\n\n if (currentCharacter === '[') {\n bracketDepth++\n } else if (currentCharacter === ']') {\n bracketDepth--\n }\n }\n\n const baseClassNameWithImportantModifier =\n modifiers.length === 0 ? className : className.substring(modifierStart)\n const hasImportantModifier =\n baseClassNameWithImportantModifier.startsWith(IMPORTANT_MODIFIER)\n const baseClassName = hasImportantModifier\n ? baseClassNameWithImportantModifier.substring(1)\n : baseClassNameWithImportantModifier\n\n const maybePostfixModifierPosition =\n postfixModifierPosition && postfixModifierPosition > modifierStart\n ? postfixModifierPosition - modifierStart\n : undefined\n\n return {\n modifiers,\n hasImportantModifier,\n baseClassName,\n maybePostfixModifierPosition,\n }\n }\n\n if (experimentalParseClassName) {\n return (className: string) => experimentalParseClassName({ className, parseClassName })\n }\n\n return parseClassName\n}\n\n/**\n * Sorts modifiers according to following schema:\n * - Predefined modifiers are sorted alphabetically\n * - When an arbitrary variant appears, it must be preserved which modifiers are before and after it\n */\nexport const sortModifiers = (modifiers: string[]) => {\n if (modifiers.length <= 1) {\n return modifiers\n }\n\n const sortedModifiers: string[] = []\n let unsortedModifiers: string[] = []\n\n modifiers.forEach((modifier) => {\n const isArbitraryVariant = modifier[0] === '['\n\n if (isArbitraryVariant) {\n sortedModifiers.push(...unsortedModifiers.sort(), modifier)\n unsortedModifiers = []\n } else {\n unsortedModifiers.push(modifier)\n }\n })\n\n sortedModifiers.push(...unsortedModifiers.sort())\n\n return sortedModifiers\n}\n","import { createClassGroupUtils } from './class-group-utils'\nimport { createLruCache } from './lru-cache'\nimport { createParseClassName } from './parse-class-name'\nimport { GenericConfig } from './types'\n\nexport type ConfigUtils = ReturnType<typeof createConfigUtils>\n\nexport const createConfigUtils = (config: GenericConfig) => ({\n cache: createLruCache<string, string>(config.cacheSize),\n parseClassName: createParseClassName(config),\n ...createClassGroupUtils(config),\n})\n","import { ConfigUtils } from './config-utils'\nimport { IMPORTANT_MODIFIER, sortModifiers } from './parse-class-name'\n\nconst SPLIT_CLASSES_REGEX = /\\s+/\n\nexport const mergeClassList = (classList: string, configUtils: ConfigUtils) => {\n const { parseClassName, getClassGroupId, getConflictingClassGroupIds } = configUtils\n\n /**\n * Set of classGroupIds in following format:\n * `{importantModifier}{variantModifiers}{classGroupId}`\n * @example 'float'\n * @example 'hover:focus:bg-color'\n * @example 'md:!pr'\n */\n const classGroupsInConflict: string[] = []\n const classNames = classList.trim().split(SPLIT_CLASSES_REGEX)\n\n let result = ''\n\n for (let index = classNames.length - 1; index >= 0; index -= 1) {\n const originalClassName = classNames[index]!\n\n const { modifiers, hasImportantModifier, baseClassName, maybePostfixModifierPosition } =\n parseClassName(originalClassName)\n\n let hasPostfixModifier = Boolean(maybePostfixModifierPosition)\n let classGroupId = getClassGroupId(\n hasPostfixModifier\n ? baseClassName.substring(0, maybePostfixModifierPosition)\n : baseClassName,\n )\n\n if (!classGroupId) {\n if (!hasPostfixModifier) {\n // Not a Tailwind class\n result = originalClassName + (result.length > 0 ? ' ' + result : result)\n continue\n }\n\n classGroupId = getClassGroupId(baseClassName)\n\n if (!classGroupId) {\n // Not a Tailwind class\n result = originalClassName + (result.length > 0 ? ' ' + result : result)\n continue\n }\n\n hasPostfixModifier = false\n }\n\n const variantModifier = sortModifiers(modifiers).join(':')\n\n const modifierId = hasImportantModifier\n ? variantModifier + IMPORTANT_MODIFIER\n : variantModifier\n\n const classId = modifierId + classGroupId\n\n if (classGroupsInConflict.includes(classId)) {\n // Tailwind class omitted due to conflict\n continue\n }\n\n classGroupsInConflict.push(classId)\n\n const conflictGroups = getConflictingClassGroupIds(classGroupId, hasPostfixModifier)\n for (let i = 0; i < conflictGroups.length; ++i) {\n const group = conflictGroups[i]!\n classGroupsInConflict.push(modifierId + group)\n }\n\n // Tailwind class not in conflict\n result = originalClassName + (result.length > 0 ? ' ' + result : result)\n }\n\n return result\n}\n","/**\n * The code in this file is copied from https://github.com/lukeed/clsx and modified to suit the needs of tailwind-merge better.\n *\n * Specifically:\n * - Runtime code from https://github.com/lukeed/clsx/blob/v1.2.1/src/index.js\n * - TypeScript types from https://github.com/lukeed/clsx/blob/v1.2.1/clsx.d.ts\n *\n * Original code has MIT license: Copyright (c) Luke Edwards <luke.edwards05@gmail.com> (lukeed.com)\n */\n\nexport type ClassNameValue = ClassNameArray | string | null | undefined | 0 | 0n | false\ntype ClassNameArray = ClassNameValue[]\n\nexport function twJoin(...classLists: ClassNameValue[]): string\nexport function twJoin() {\n let index = 0\n let argument: ClassNameValue\n let resolvedValue: string\n let string = ''\n\n while (index < arguments.length) {\n if ((argument = arguments[index++])) {\n if ((resolvedValue = toValue(argument))) {\n string && (string += ' ')\n string += resolvedValue\n }\n }\n }\n return string\n}\n\nconst toValue = (mix: ClassNameArray | string) => {\n if (typeof mix === 'string') {\n return mix\n }\n\n let resolvedValue: string\n let string = ''\n\n for (let k = 0; k < mix.length; k++) {\n if (mix[k]) {\n if ((resolvedValue = toValue(mix[k] as ClassNameArray | string))) {\n string && (string += ' ')\n string += resolvedValue\n }\n }\n }\n\n return string\n}\n","import { createConfigUtils } from './config-utils'\nimport { mergeClassList } from './merge-classlist'\nimport { ClassNameValue, twJoin } from './tw-join'\nimport { GenericConfig } from './types'\n\ntype CreateConfigFirst = () => GenericConfig\ntype CreateConfigSubsequent = (config: GenericConfig) => GenericConfig\ntype TailwindMerge = (...classLists: ClassNameValue[]) => string\ntype ConfigUtils = ReturnType<typeof createConfigUtils>\n\nexport function createTailwindMerge(\n createConfigFirst: CreateConfigFirst,\n ...createConfigRest: CreateConfigSubsequent[]\n): TailwindMerge {\n let configUtils: ConfigUtils\n let cacheGet: ConfigUtils['cache']['get']\n let cacheSet: ConfigUtils['cache']['set']\n let functionToCall = initTailwindMerge\n\n function initTailwindMerge(classList: string) {\n const config = createConfigRest.reduce(\n (previousConfig, createConfigCurrent) => createConfigCurrent(previousConfig),\n createConfigFirst() as GenericConfig,\n )\n\n configUtils = createConfigUtils(config)\n cacheGet = configUtils.cache.get\n cacheSet = configUtils.cache.set\n functionToCall = tailwindMerge\n\n return tailwindMerge(classList)\n }\n\n function tailwindMerge(classList: string) {\n const cachedResult = cacheGet(classList)\n\n if (cachedResult) {\n return cachedResult\n }\n\n const result = mergeClassList(classList, configUtils)\n cacheSet(classList, result)\n\n return result\n }\n\n return function callTailwindMerge() {\n return functionToCall(twJoin.apply(null, arguments as any))\n }\n}\n","import { DefaultThemeGroupIds, NoInfer, ThemeGetter, ThemeObject } from './types'\n\nexport const fromTheme = <\n AdditionalThemeGroupIds extends string = never,\n DefaultThemeGroupIdsInner extends string = DefaultThemeGroupIds,\n>(key: NoInfer<DefaultThemeGroupIdsInner | AdditionalThemeGroupIds>): ThemeGetter => {\n const themeGetter = (theme: ThemeObject<DefaultThemeGroupIdsInner | AdditionalThemeGroupIds>) =>\n theme[key] || []\n\n themeGetter.isThemeGetter = true as const\n\n return themeGetter\n}\n","const arbitraryValueRegex = /^\\[(?:([a-z-]+):)?(.+)\\]$/i\nconst fractionRegex = /^\\d+\\/\\d+$/\nconst stringLengths = new Set(['px', 'full', 'screen'])\nconst tshirtUnitRegex = /^(\\d+(\\.\\d+)?)?(xs|sm|md|lg|xl)$/\nconst lengthUnitRegex =\n /\\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\\b(calc|min|max|clamp)\\(.+\\)|^0$/\nconst colorFunctionRegex = /^(rgba?|hsla?|hwb|(ok)?(lab|lch))\\(.+\\)$/\n// Shadow always begins with x and y offset separated by underscore optionally prepended by inset\nconst shadowRegex = /^(inset_)?-?((\\d+)?\\.?(\\d+)[a-z]+|0)_-?((\\d+)?\\.?(\\d+)[a-z]+|0)/\nconst imageRegex =\n /^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\\(.+\\)$/\n\nexport const isLength = (value: string) =>\n isNumber(value) || stringLengths.has(value) || fractionRegex.test(value)\n\nexport const isArbitraryLength = (value: string) =>\n getIsArbitraryValue(value, 'length', isLengthOnly)\n\nexport const isNumber = (value: string) => Boolean(value) && !Number.isNaN(Number(value))\n\nexport const isArbitraryNumber = (value: string) => getIsArbitraryValue(value, 'number', isNumber)\n\nexport const isInteger = (value: string) => Boolean(value) && Number.isInteger(Number(value))\n\nexport const isPercent = (value: string) => value.endsWith('%') && isNumber(value.slice(0, -1))\n\nexport const isArbitraryValue = (value: string) => arbitraryValueRegex.test(value)\n\nexport const isTshirtSize = (value: string) => tshirtUnitRegex.test(value)\n\nconst sizeLabels = new Set(['length', 'size', 'percentage'])\n\nexport const isArbitrarySize = (value: string) => getIsArbitraryValue(value, sizeLabels, isNever)\n\nexport const isArbitraryPosition = (value: string) =>\n getIsArbitraryValue(value, 'position', isNever)\n\nconst imageLabels = new Set(['image', 'url'])\n\nexport const isArbitraryImage = (value: string) => getIsArbitraryValue(value, imageLabels, isImage)\n\nexport const isArbitraryShadow = (value: string) => getIsArbitraryValue(value, '', isShadow)\n\nexport const isAny = () => true\n\nconst getIsArbitraryValue = (\n value: string,\n label: string | Set<string>,\n testValue: (value: string) => boolean,\n) => {\n const result = arbitraryValueRegex.exec(value)\n\n if (result) {\n if (result[1]) {\n return typeof label === 'string' ? result[1] === label : label.has(result[1])\n }\n\n return testValue(result[2]!)\n }\n\n return false\n}\n\nconst isLengthOnly = (value: string) =>\n // `colorFunctionRegex` check is necessary because color functions can have percentages in them which which would be incorrectly classified as lengths.\n // For example, `hsl(0 0% 0%)` would be classified as a length without this check.\n // I could also use lookbehind assertion in `lengthUnitRegex` but that isn't supported widely enough.\n lengthUnitRegex.test(value) && !colorFunctionRegex.test(value)\n\nconst isNever = () => false\n\nconst isShadow = (value: string) => shadowRegex.test(value)\n\nconst isImage = (value: string) => imageRegex.test(value)\n","import { fromTheme } from './from-theme'\nimport { Config, DefaultClassGroupIds, DefaultThemeGroupIds } from './types'\nimport {\n isAny,\n isArbitraryImage,\n isArbitraryLength,\n isArbitraryNumber,\n isArbitraryPosition,\n isArbitraryShadow,\n isArbitrarySize,\n isArbitraryValue,\n isInteger,\n isLength,\n isNumber,\n isPercent,\n isTshirtSize,\n} from './validators'\n\nexport const getDefaultConfig = () => {\n const colors = fromTheme('colors')\n const spacing = fromTheme('spacing')\n const blur = fromTheme('blur')\n const brightness = fromTheme('brightness')\n const borderColor = fromTheme('borderColor')\n const borderRadius = fromTheme('borderRadius')\n const borderSpacing = fromTheme('borderSpacing')\n const borderWidth = fromTheme('borderWidth')\n const contrast = fromTheme('contrast')\n const grayscale = fromTheme('grayscale')\n const hueRotate = fromTheme('hueRotate')\n const invert = fromTheme('invert')\n const gap = fromTheme('gap')\n const gradientColorStops = fromTheme('gradientColorStops')\n const gradientColorStopPositions = fromTheme('gradientColorStopPositions')\n const inset = fromTheme('inset')\n const margin = fromTheme('margin')\n const opacity = fromTheme('opacity')\n const padding = fromTheme('padding')\n const saturate = fromTheme('saturate')\n const scale = fromTheme('scale')\n const sepia = fromTheme('sepia')\n const skew = fromTheme('skew')\n const space = fromTheme('space')\n const translate = fromTheme('translate')\n\n const getOverscroll = () => ['auto', 'contain', 'none'] as const\n const getOverflow = () => ['auto', 'hidden', 'clip', 'visible', 'scroll'] as const\n const getSpacingWithAutoAndArbitrary = () => ['auto', isArbitraryValue, spacing] as const\n const getSpacingWithArbitrary = () => [isArbitraryValue, spacing] as const\n const getLengthWithEmptyAndArbitrary = () => ['', isLength, isArbitraryLength] as const\n const getNumberWithAutoAndArbitrary = () => ['auto', isNumber, isArbitraryValue] as const\n const getPositions = () =>\n [\n 'bottom',\n 'center',\n 'left',\n 'left-bottom',\n 'left-top',\n 'right',\n 'right-bottom',\n 'right-top',\n 'top',\n ] as const\n const getLineStyles = () => ['solid', 'dashed', 'dotted', 'double', 'none'] as const\n const getBlendModes = () =>\n [\n 'normal',\n 'multiply',\n 'screen',\n 'overlay',\n 'darken',\n 'lighten',\n 'color-dodge',\n 'color-burn',\n 'hard-light',\n 'soft-light',\n 'difference',\n 'exclusion',\n 'hue',\n 'saturation',\n 'color',\n 'luminosity',\n ] as const\n const getAlign = () =>\n ['start', 'end', 'center', 'between', 'around', 'evenly', 'stretch'] as const\n const getZeroAndEmpty = () => ['', '0', isArbitraryValue] as const\n const getBreaks = () =>\n ['auto', 'avoid', 'all', 'avoid-page', 'page', 'left', 'right', 'column'] as const\n const getNumberAndArbitrary = () => [isNumber, isArbitraryValue]\n\n return {\n cacheSize: 500,\n separator: ':',\n theme: {\n colors: [isAny],\n spacing: [isLength, isArbitraryLength],\n blur: ['none', '', isTshirtSize, isArbitraryValue],\n brightness: getNumberAndArbitrary(),\n borderColor: [colors],\n borderRadius: ['none', '', 'full', isTshirtSize, isArbitraryValue],\n borderSpacing: getSpacingWithArbitrary(),\n borderWidth: getLengthWithEmptyAndArbitrary(),\n contrast: getNumberAndArbitrary(),\n grayscale: getZeroAndEmpty(),\n hueRotate: getNumberAndArbitrary(),\n invert: getZeroAndEmpty(),\n gap: getSpacingWithArbitrary(),\n gradientColorStops: [colors],\n gradientColorStopPositions: [isPercent, isArbitraryLength],\n inset: getSpacingWithAutoAndArbitrary(),\n margin: getSpacingWithAutoAndArbitrary(),\n opacity: getNumberAndArbitrary(),\n padding: getSpacingWithArbitrary(),\n saturate: getNumberAndArbitrary(),\n scale: getNumberAndArbitrary(),\n sepia: getZeroAndEmpty(),\n skew: getNumberAndArbitrary(),\n space: getSpacingWithArbitrary(),\n translate: getSpacingWithArbitrary(),\n },\n classGroups: {\n // Layout\n /**\n * Aspect Ratio\n * @see https://tailwindcss.com/docs/aspect-ratio\n */\n aspect: [{ aspect: ['auto', 'square', 'video', isArbitraryValue] }],\n /**\n * Container\n * @see https://tailwindcss.com/docs/container\n */\n container: ['container'],\n /**\n * Columns\n * @see https://tailwindcss.com/docs/columns\n */\n columns: [{ columns: [isTshirtSize] }],\n /**\n * Break After\n * @see https://tailwindcss.com/docs/break-after\n */\n 'break-after': [{ 'break-after': getBreaks() }],\n /**\n * Break Before\n * @see https://tailwindcss.com/docs/break-before\n */\n 'break-before': [{ 'break-before': getBreaks() }],\n /**\n * Break Inside\n * @see https://tailwindcss.com/docs/break-inside\n */\n 'break-inside': [{ 'break-inside': ['auto', 'avoid', 'avoid-page', 'avoid-column'] }],\n /**\n * Box Decoration Break\n * @see https://tailwindcss.com/docs/box-decoration-break\n */\n 'box-decoration': [{ 'box-decoration': ['slice', 'clone'] }],\n /**\n * Box Sizing\n * @see https://tailwindcss.com/docs/box-sizing\n */\n box: [{ box: ['border', 'content'] }],\n /**\n * Display\n * @see https://tailwindcss.com/docs/display\n */\n display: [\n 'block',\n 'inline-block',\n 'inline',\n 'flex',\n 'inline-flex',\n 'table',\n 'inline-table',\n 'table-caption',\n 'table-cell',\n 'table-column',\n 'table-column-group',\n 'table-footer-group',\n 'table-header-group',\n 'table-row-group',\n 'table-row',\n 'flow-root',\n 'grid',\n 'inline-grid',\n 'contents',\n 'list-item',\n 'hidden',\n ],\n /**\n * Floats\n * @see https://tailwindcss.com/docs/float\n */\n float: [{ float: ['right', 'left', 'none', 'start', 'end'] }],\n /**\n * Clear\n * @see https://tailwindcss.com/docs/clear\n */\n clear: [{ clear: ['left', 'right', 'both', 'none', 'start', 'end'] }],\n /**\n * Isolation\n * @see https://tailwindcss.com/docs/isolation\n */\n isolation: ['isolate', 'isolation-auto'],\n /**\n * Object Fit\n * @see https://tailwindcss.com/docs/object-fit\n */\n 'object-fit': [{ object: ['contain', 'cover', 'fill', 'none', 'scale-down'] }],\n /**\n * Object Position\n * @see https://tailwindcss.com/docs/object-position\n */\n 'object-position': [{ object: [...getPositions(), isArbitraryValue] }],\n /**\n * Overflow\n * @see https://tailwindcss.com/docs/overflow\n */\n overflow: [{ overflow: getOverflow() }],\n /**\n * Overflow X\n * @see https://tailwindcss.com/docs/overflow\n */\n 'overflow-x': [{ 'overflow-x': getOverflow() }],\n /**\n * Overflow Y\n * @see https://tailwindcss.com/docs/overflow\n */\n 'overflow-y': [{ 'overflow-y': getOverflow() }],\n /**\n * Overscroll Behavior\n * @see https://tailwindcss.com/docs/overscroll-behavior\n */\n overscroll: [{ overscroll: getOverscroll() }],\n /**\n * Overscroll Behavior X\n * @see https://tailwindcss.com/docs/overscroll-behavior\n */\n 'overscroll-x': [{ 'overscroll-x': getOverscroll() }],\n /**\n * Overscroll Behavior Y\n * @see https://tailwindcss.com/docs/overscroll-behavior\n */\n 'overscroll-y': [{ 'overscroll-y': getOverscroll() }],\n /**\n * Position\n * @see https://tailwindcss.com/docs/position\n */\n position: ['static', 'fixed', 'absolute', 'relative', 'sticky'],\n /**\n * Top / Right / Bottom / Left\n * @see https://tailwindcss.com/docs/top-right-bottom-left\n */\n inset: [{ inset: [inset] }],\n /**\n * Right / Left\n * @see https://tailwindcss.com/docs/top-right-bottom-left\n */\n 'inset-x': [{ 'inset-x': [inset] }],\n /**\n * Top / Bottom\n * @see https://tailwindcss.com/docs/top-right-bottom-left\n */\n 'inset-y': [{ 'inset-y': [inset] }],\n /**\n * Start\n * @see https://tailwindcss.com/docs/top-right-bottom-left\n */\n start: [{ start: [inset] }],\n /**\n * End\n * @see https://tailwindcss.com/docs/top-right-bottom-left\n */\n end: [{ end: [inset] }],\n /**\n * Top\n * @see https://tailwindcss.com/docs/top-right-bottom-left\n */\n top: [{ top: [inset] }],\n /**\n * Right\n * @see https://tailwindcss.com/docs/top-right-bottom-left\n */\n right: [{ right: [inset] }],\n /**\n * Bottom\n * @see https://tailwindcss.com/docs/top-right-bottom-left\n */\n bottom: [{ bottom: [inset] }],\n /**\n * Left\n * @see https://tailwindcss.com/docs/top-right-bottom-left\n */\n left: [{ left: [inset] }],\n /**\n * Visibility\n * @see https://tailwindcss.com/docs/visibility\n */\n visibility: ['visible', 'invisible', 'collapse'],\n /**\n * Z-Index\n * @see https://tailwindcss.com/docs/z-index\n */\n z: [{ z: ['auto', isInteger, isArbitraryValue] }],\n // Flexbox and Grid\n /**\n * Flex Basis\n * @see https://tailwindcss.com/docs/flex-basis\n */\n basis: [{ basis: getSpacingWithAutoAndArbitrary() }],\n /**\n * Flex Direction\n * @see https://tailwindcss.com/docs/flex-direction\n */\n 'flex-direction': [{ flex: ['row', 'row-reverse', 'col', 'col-reverse'] }],\n /**\n * Flex Wrap\n * @see https://tailwindcss.com/docs/flex-wrap\n */\n 'flex-wrap': [{ flex: ['wrap', 'wrap-reverse', 'nowrap'] }],\n /**\n * Flex\n * @see https://tailwindcss.com/docs/flex\n */\n flex: [{ flex: ['1', 'auto', 'initial', 'none', isArbitraryValue] }],\n /**\n * Flex Grow\n * @see https://tailwindcss.com/docs/flex-grow\n */\n grow: [{ grow: getZeroAndEmpty() }],\n /**\n * Flex Shrink\n * @see https://tailwindcss.com/docs/flex-shrink\n */\n shrink: [{ shrink: getZeroAndEmpty() }],\n /**\n * Order\n * @see https://tailwindcss.com/docs/order\n */\n order: [{ order: ['first', 'last', 'none', isInteger, isArbitraryValue] }],\n /**\n * Grid Template Columns\n * @see https://tailwindcss.com/docs/grid-template-columns\n */\n 'grid-cols': [{ 'grid-cols': [isAny] }],\n /**\n * Grid Column Start / End\n * @see https://tailwindcss.com/docs/grid-column\n */\n 'col-start-end': [\n {\n col: [\n 'auto',\n { span: ['full', isInteger, isArbitraryValue] },\n isArbitraryValue,\n ],\n },\n ],\n /**\n * Grid Column Start\n * @see https://tailwindcss.com/docs/grid-column\n */\n 'col-start': [{ 'col-start': getNumberWithAutoAndArbitrary() }],\n /**\n * Grid Column End\n * @see https://tailwindcss.com/docs/grid-column\n */\n 'col-end': [{ 'col-end': getNumberWithAutoAndArbitrary() }],\n /**\n * Grid Template Rows\n * @see https://tailwindcss.com/docs/grid-template-rows\n */\n 'grid-rows': [{ 'grid-rows': [isAny] }],\n /**\n * Grid Row Start / End\n * @see https://tailwindcss.com/docs/grid-row\n */\n 'row-start-end': [\n { row: ['auto', { span: [isInteger, isArbitraryValue] }, isArbitraryValue] },\n ],\n /**\n * Grid Row Start\n * @see https://tailwindcss.com/docs/grid-row\n */\n 'row-start': [{ 'row-start': getNumberWithAutoAndArbitrary() }],\n /**\n * Grid Row End\n * @see https://tailwindcss.com/docs/grid-row\n */\n 'row-end': [{ 'row-end': getNumberWithAutoAndArbitrary() }],\n /**\n * Grid Auto Flow\n * @see https://tailwindcss.com/docs/grid-auto-flow\n */\n 'grid-flow': [{ 'grid-flow': ['row', 'col', 'dense', 'row-dense', 'col-dense'] }],\n /**\n * Grid Auto Columns\n * @see https://tailwindcss.com/docs/grid-auto-columns\n */\n 'auto-cols': [{ 'auto-cols': ['auto', 'min', 'max', 'fr', isArbitraryValue] }],\n /**\n * Grid Auto Rows\n * @see https://tailwindcss.com/docs/grid-auto-rows\n */\n 'auto-rows': [{ 'auto-rows': ['auto', 'min', 'max', 'fr', isArbitraryValue] }],\n /**\n * Gap\n * @see https://tailwindcss.com/docs/gap\n */\n gap: [{ gap: [gap] }],\n /**\n * Gap X\n * @see https://tailwindcss.com/docs/gap\n */\n 'gap-x': [{ 'gap-x': [gap] }],\n /**\n * Gap Y\n * @see https://tailwindcss.com/docs/gap\n */\n 'gap-y': [{ 'gap-y': [gap] }],\n /**\n * Justify Content\n * @see https://tailwindcss.com/docs/justify-content\n */\n 'justify-content': [{ justify: ['normal', ...getAlign()] }],\n /**\n * Justify Items\n * @see https://tailwindcss.com/docs/justify-items\n */\n 'justify-items': [{ 'justify-items': ['start', 'end', 'center', 'stretch'] }],\n /**\n * Justify Self\n * @see https://tailwindcss.com/docs/justify-self\n */\n 'justify-self': [{ 'justify-self': ['auto', 'start', 'end', 'center', 'stretch'] }],\n /**\n * Align Content\n * @see https://tailwindcss.com/docs/align-content\n */\n 'align-content': [{ content: ['normal', ...getAlign(), 'baseline'] }],\n /**\n * Align Items\n * @see https://tailwindcss.com/docs/align-items\n */\n 'align-items': [{ items: ['start', 'end', 'center', 'baseline', 'stretch'] }],\n /**\n * Align Self\n * @see https://tailwindcss.com/docs/align-self\n */\n 'align-self': [{ self: ['auto', 'start', 'end', 'center', 'stretch', 'baseline'] }],\n /**\n * Place Content\n * @see https://tailwindcss.com/docs/place-content\n */\n 'place-content': [{ 'place-content': [...getAlign(), 'baseline'] }],\n /**\n * Place Items\n * @see https://tailwindcss.com/docs/place-items\n */\n 'place-items': [{ 'place-items': ['start', 'end', 'center', 'baseline', 'stretch'] }],\n /**\n * Place Self\n * @see https://tailwindcss.com/docs/place-self\n */\n 'place-self': [{ 'place-self': ['auto', 'start', 'end', 'center', 'stretch'] }],\n // Spacing\n /**\n * Padding\n * @see https://tailwindcss.com/docs/padding\n */\n p: [{ p: [padding] }],\n /**\n * Padding X\n * @see https://tailwindcss.com/docs/padding\n */\n px: [{ px: [padding] }],\n /**\n * Padding Y\n * @see https://tailwindcss.com/docs/padding\n */\n py: [{ py: [padding] }],\n /**\n * Padding Start\n * @see https://tailwindcss.com/docs/padding\n */\n ps: [{ ps: [padding] }],\n /**\n * Padding End\n * @see https://tailwindcss.com/docs/padding\n */\n pe: [{ pe: [padding] }],\n /**\n * Padding Top\n * @see https://tailwindcss.com/docs/padding\n */\n pt: [{ pt: [padding] }],\n /**\n * Padding Right\n * @see https://tailwindcss.com/docs/padding\n */\n pr: [{ pr: [padding] }],\n /**\n * Padding Bottom\n * @see https://tailwindcss.com/docs/padding\n */\n pb: [{ pb: [padding] }],\n /**\n * Padding Left\n * @see https://tailwindcss.com/docs/padding\n */\n pl: [{ pl: [padding] }],\n /**\n * Margin\n * @see https://tailwindcss.com/docs/margin\n */\n m: [{ m: [margin] }],\n /**\n * Margin X\n * @see https://tailwindcss.com/docs/margin\n */\n mx: [{ mx: [margin] }],\n /**\n * Margin Y\n * @see https://tailwindcss.com/docs/margin\n */\n my: [{ my: [margin] }],\n /**\n * Margin Start\n * @see https://tailwindcss.com/docs/margin\n */\n ms: [{ ms: [margin] }],\n /**\n * Margin End\n * @see https://tailwindcss.com/docs/margin\n */\n me: [{ me: [margin] }],\n /**\n * Margin Top\n * @see https://tailwindcss.com/docs/margin\n */\n mt: [{ mt: [margin] }],\n /**\n * Margin Right\n * @see https://tailwindcss.com/docs/margin\n */\n mr: [{ mr: [margin] }],\n /**\n * Margin Bottom\n * @see https://tailwindcss.com/docs/margin\n */\n mb: [{ mb: [margin] }],\n /**\n * Margin Left\n * @see https://tailwindcss.com/docs/margin\n */\n ml: [{ ml: [margin] }],\n /**\n * Space Between X\n * @see https://tailwindcss.com/docs/space\n */\n 'space-x': [{ 'space-x': [space] }],\n /**\n * Space Between X Reverse\n * @see https://tailwindcss.com/docs/space\n */\n 'space-x-reverse': ['space-x-reverse'],\n /**\n * Space Between Y\n * @see https://tailwindcss.com/docs/space\n */\n 'space-y': [{ 'space-y': [space] }],\n /**\n * Space Between Y Reverse\n * @see https://tailwindcss.com/docs/space\n */\n 'space-y-reverse': ['space-y-reverse'],\n // Sizing\n /**\n * Width\n * @see https://tailwindcss.com/docs/width\n */\n w: [\n {\n w: [\n 'auto',\n 'min',\n 'max',\n 'fit',\n 'svw',\n 'lvw',\n 'dvw',\n isArbitraryValue,\n spacing,\n ],\n },\n ],\n /**\n * Min-Width\n * @see https://tailwindcss.com/docs/min-width\n */\n 'min-w': [{ 'min-w': [isArbitraryValue, spacing, 'min', 'max', 'fit'] }],\n /**\n * Max-Width\n * @see https://tailwindcss.com/docs/max-width\n */\n 'max-w': [\n {\n 'max-w': [\n isArbitraryValue,\n spacing,\n 'none',\n 'full',\n 'min',\n 'max',\n 'fit',\n 'prose',\n { screen: [isTshirtSize] },\n isTshirtSize,\n ],\n },\n ],\n /**\n * Height\n * @see https://tailwindcss.com/docs/height\n */\n h: [\n {\n h: [\n isArbitraryValue,\n spacing,\n 'auto',\n 'min',\n 'max',\n 'fit',\n 'svh',\n 'lvh',\n 'dvh',\n ],\n },\n ],\n /**\n * Min-Height\n * @see https://tailwindcss.com/docs/min-height\n */\n 'min-h': [\n { 'min-h': [isArbitraryValue, spacing, 'min', 'max', 'fit', 'svh', 'lvh', 'dvh'] },\n ],\n /**\n * Max-Height\n * @see https://tailwindcss.com/docs/max-height\n */\n 'max-h': [\n { 'max-h': [isArbitraryValue, spacing, 'min', 'max', 'fit', 'svh', 'lvh', 'dvh'] },\n ],\n /**\n * Size\n * @see https://tailwindcss.com/docs/size\n */\n size: [{ size: [isArbitraryValue, spacing, 'auto', 'min', 'max', 'fit'] }],\n // Typography\n /**\n * Font Size\n * @see https://tailwindcss.com/docs/font-size\n */\n 'font-size': [{ text: ['base', isTshirtSize, isArbitraryLength] }],\n /**\n * Font Smoothing\n * @see https://tailwindcss.com/docs/font-smoothing\n */\n 'font-smoothing': ['antialiased', 'subpixel-antialiased'],\n /**\n * Font Style\n * @see https://tailwindcss.com/docs/font-style\n */\n 'font-style': ['italic', 'not-italic'],\n /**\n * Font Weight\n * @see https://tailwindcss.com/docs/font-weight\n */\n 'font-weight': [\n {\n font: [\n 'thin',\n 'extralight',\n 'light',\n 'normal',\n 'medium',\n 'semibold',\n 'bold',\n 'extrabold',\n 'black',\n isArbitraryNumber,\n ],\n },\n ],\n /**\n * Font Family\n * @see https://tailwindcss.com/docs/font-family\n */\n 'font-family': [{ font: [isAny] }],\n /**\n * Font Variant Numeric\n * @see https://tailwindcss.com/docs/font-variant-numeric\n */\n 'fvn-normal': ['normal-nums'],\n /**\n * Font Variant Numeric\n * @see https://tailwindcss.com/docs/font-variant-numeric\n */\n 'fvn-ordinal': ['ordinal'],\n /**\n * Font Variant Numeric\n * @see https://tailwindcss.com/docs/font-variant-numeric\n */\n 'fvn-slashed-zero': ['slashed-zero'],\n /**\n * Font Variant Numeric\n * @see https://tailwindcss.com/docs/font-variant-numeric\n */\n 'fvn-figure': ['lining-nums', 'oldstyle-nums'],\n /**\n * Font Variant Numeric\n * @see https://tailwindcss.com/docs/font-variant-numeric\n */\n 'fvn-spacing': ['proportional-nums', 'tabular-nums'],\n /**\n * Font Variant Numeric\n * @see https://tailwindcss.com/docs/font-variant-numeric\n */\n 'fvn-fraction': ['diagonal-fractions', 'stacked-fractions'],\n /**\n * Letter Spacing\n * @see https://tailwindcss.com/docs/letter-spacing\n */\n tracking: [\n {\n tracking: [\n 'tighter',\n 'tight',\n 'normal',\n 'wide',\n 'wider',\n 'widest',\n isArbitraryValue,\n ],\n },\n ],\n /**\n * Line Clamp\n * @see https://tailwindcss.com/docs/line-clamp\n */\n 'line-clamp': [{ 'line-clamp': ['none', isNumber, isArbitraryNumber] }],\n /**\n * Line Height\n * @see https://tailwindcss.com/docs/line-height\n */\n leading: [\n {\n leading: [\n 'none',\n 'tight',\n 'snug',\n 'normal',\n 'relaxed',\n 'loose',\n isLength,\n isArbitraryValue,\n ],\n },\n ],\n /**\n * List Style Image\n * @see https://tailwindcss.com/docs/list-style-image\n */\n 'list-image': [{ 'list-image': ['none', isArbitraryValue] }],\n /**\n * List Style Type\n * @see https://tailwindcss.com/docs/list-style-type\n */\n 'list-style-type': [{ list: ['none', 'disc', 'decimal', isArbitraryValue] }],\n /**\n * List Style Position\n * @see https://tailwindcss.com/docs/list-style-position\n */\n 'list-style-position': [{ list: ['inside', 'outside'] }],\n /**\n * Placeholder Color\n * @deprecated since Tailwind CSS v3.0.0\n * @see https://tailwindcss.com/docs/placeholder-color\n */\n 'placeholder-color': [{ placeholder: [colors] }],\n /**\n * Placeholder Opacity\n * @see https://tailwindcss.com/docs/placeholder-opacity\n */\n 'placeholder-opacity': [{ 'placeholder-opacity': [opacity] }],\n /**\n * Text Alignment\n * @see https://tailwindcss.com/docs/text-align\n */\n 'text-alignment': [{ text: ['left', 'center', 'right', 'justify', 'start', 'end'] }],\n /**\n * Text Color\n * @see https://tailwindcss.com/docs/text-color\n */\n 'text-color': [{ text: [colors] }],\n /**\n * Text Opacity\n * @see https://tailwindcss.com/docs/text-opacity\n */\n 'text-opacity': [{ 'text-opacity': [opacity] }],\n /**\n * Text Decoration\n * @see https://tailwindcss.com/docs/text-decoration\n */\n 'text-decoration': ['underline', 'overline', 'line-through', 'no-underline'],\n /**\n * Text Decoration Style\n * @see https://tailwindcss.com/docs/text-decoration-style\n */\n 'text-decoration-style': [{ decoration: [...getLineStyles(), 'wavy'] }],\n /**\n * Text Decoration Thickness\n * @see https://tailwindcss.com/docs/text-decoration-thickness\n */\n 'text-decoration-thickness': [\n { decoration: ['auto', 'from-font', isLength, isArbitraryLength] },\n ],\n /**\n * Text Underline Offset\n * @see https://tailwindcss.com/docs/text-underline-offset\n */\n 'underline-offset': [{ 'underline-offset': ['auto', isLength, isArbitraryValue] }],\n /**\n * Text Decoration Color\n * @see https://tailwindcss.com/docs/text-decoration-color\n */\n 'text-decoration-color': [{ decoration: [colors] }],\n /**\n * Text Transform\n * @see https://tailwindcss.com/docs/text-transform\n */\n 'text-transform': ['uppercase', 'lowercase', 'capitalize', 'normal-case'],\n /**\n * Text Overflow\n * @see https://tailwindcss.com/docs/text-overflow\n */\n 'text-overflow': ['truncate', 'text-ellipsis', 'text-clip'],\n /**\n * Text Wrap\n * @see https://tailwindcss.com/docs/text-wrap\n */\n 'text-wrap': [{ text: ['wrap', 'nowrap', 'balance', 'pretty'] }],\n /**\n * Text Indent\n * @see https://tailwindcss.com/docs/text-indent\n */\n indent: [{ indent: getSpacingWithArbitrary() }],\n /**\n * Vertical Alignment\n * @see https://tailwindcss.com/docs/vertical-align\n */\n 'vertical-align': [\n {\n align: [\n 'baseline',\n 'top',\n 'middle',\n 'bottom',\n 'text-top',\n 'text-bottom',\n 'sub',\n 'super',\n isArbitraryValue,\n ],\n },\n ],\n /**\n * Whitespace\n * @see https://tailwindcss.com/docs/whitespace\n */\n whitespace: [\n { whitespace: ['normal', 'nowrap', 'pre', 'pre-line', 'pre-wrap', 'break-spaces'] },\n ],\n /**\n * Word Break\n * @see https://tailwindcss.com/docs/word-break\n */\n break: [{ break: ['normal', 'words', 'all', 'keep'] }],\n /**\n * Hyphens\n * @see https://tailwindcss.com/docs/hyphens\n */\n hyphens: [{ hyphens: ['none', 'manual', 'auto'] }],\n /**\n * Content\n * @see https://tailwindcss.com/docs/content\n */\n content: [{ content: ['none', isArbitraryValue] }],\n // Backgrounds\n /**\n * Background Attachment\n * @see https://tailwindcss.com/docs/background-attachment\n */\n 'bg-attachment': [{ bg: ['fixed', 'local', 'scroll'] }],\n /**\n * Background Clip\n * @see https://tailwindcss.com/docs/background-clip\n */\n 'bg-clip': [{ 'bg-clip': ['border', 'padding', 'content', 'text'] }],\n /**\n * Background Opacity\n * @deprecated since Tailwind CSS v3.0.0\n * @see https://tailwindcss.com/docs/background-opacity\n */\n 'bg-opacity': [{ 'bg-opacity': [opacity] }],\n /**\n * Background Origin\n * @see https://tailwindcss.com/docs/background-origin\n */\n 'bg-origin': [{ 'bg-origin': ['border', 'padding', 'content'] }],\n /**\n * Background Position\n * @see https://tailwindcss.com/docs/background-position\n */\n 'bg-position': [{ bg: [...getPositions(), isArbitraryPosition] }],\n /**\n * Background Repeat\n * @see https://tailwindcss.com/docs/background-repeat\n */\n 'bg-repeat': [{ bg: ['no-repeat', { repeat: ['', 'x', 'y', 'round', 'space'] }] }],\n /**\n * Background Size\n * @see https://tailwindcss.com/docs/background-size\n */\n 'bg-size': [{ bg: ['auto', 'cover', 'contain', isArbitrarySize] }],\n /**\n * Background Image\n * @see https://tailwindcss.com/docs/background-image\n */\n 'bg-image': [\n {\n bg: [\n 'none',\n { 'gradient-to': ['t', 'tr', 'r', 'br', 'b', 'bl', 'l', 'tl'] },\n isArbitraryImage,\n ],\n },\n ],\n /**\n * Background Color\n * @see https://tailwindcss.com/docs/background-color\n */\n 'bg-color': [{ bg: [colors] }],\n /**\n * Gradient Color Stops From Position\n * @see https://tailwindcss.com/docs/gradient-color-stops\n */\n 'gradient-from-pos': [{ from: [gradientColorStopPositions] }],\n /**\n * Gradient Color Stops Via Position\n * @see https://tailwindcss.com/docs/gradient-color-stops\n */\n 'gradient-via-pos': [{ via: [gradientColorStopPositions] }],\n /**\n * Gradient Color Stops To Position\n * @see https://tailwindcss.com/docs/gradient-color-stops\n */\n 'gradient-to-pos': [{ to: [gradientColorStopPositions] }],\n /**\n * Gradient Color Stops From\n * @see https://tailwindcss.com/docs/gradient-color-stops\n */\n 'gradient-from': [{ from: [gradientColorStops] }],\n /**\n * Gradient Color Stops Via\n * @see https://tailwindcss.com/docs/gradient-color-stops\n */\n 'gradient-via': [{ via: [gradientColorStops] }],\n /**\n * Gradient Color Stops To\n * @see https://tailwindcss.com/docs/gradient-color-stops\n */\n 'gradient-to': [{ to: [gradientColorStops] }],\n // Borders\n /**\n * Border Radius\n * @see https://tailwindcss.com/docs/border-radius\n */\n rounded: [{ rounded: [borderRadius] }],\n /**\n * Border Radius Start\n * @see https://tailwindcss.com/docs/border-radius\n */\n 'rounded-s': [{ 'rounded-s': [borderRadius] }],\n /**\n * Border Radius End\n * @see https://tailwindcss.com/docs/border-radius\n */\n 'rounded-e': [{ 'rounded-e': [borderRadius] }],\n /**\n * Border Radius Top\n * @see https://tailwindcss.com/docs/border-radius\n */\n 'rounded-t': [{ 'rounded-t': [borderRadius] }],\n /**\n * Border Radius Right\n * @see https://tailwindcss.com/docs/border-radius\n */\n 'rounded-r': [{ 'rounded-r': [borderRadius] }],\n /**\n * Border Radius Bottom\n * @see https://tailwindcss.com/docs/border-radius\n */\n 'rounded-b': [{ 'rounded-b': [borderRadius] }],\n /**\n * Border Radius Left\n * @see https://tailwindcss.com/docs/border-radius\n */\n 'rounded-l': [{ 'rounded-l': [borderRadius] }],\n /**\n * Border Radius Start Start\n * @see https://tailwindcss.com/docs/border-radius\n */\n 'rounded-ss': [{ 'rounded-ss': [borderRadius] }],\n /**\n * Border Radius Start End\n * @see https://tailwindcss.com/docs/border-radius\n */\n 'rounded-se': [{ 'rounded-se': [borderRadius] }],\n /**\n * Border Radius End End\n * @see https://tailwindcss.com/docs/border-radius\n */\n 'rounded-ee': [{ 'rounded-ee': [borderRadius] }],\n /**\n * Border Radius End Start\n * @see https://tailwindcss.com/docs/border-radius\n */\n 'rounded-es': [{ 'rounded-es': [borderRadius] }],\n /**\n * Border Radius Top Left\n * @see https://tailwindcss.com/docs/border-radius\n */\n 'rounded-tl': [{ 'rounded-tl': [borderRadius] }],\n /**\n * Border Radius Top Right\n * @see https://tailwindcss.com/docs/border-radius\n */\n 'rounded-tr': [{ 'rounded-tr': [borderRadius] }],\n /**\n * Border Radius Bottom Right\n * @see https://tailwindcss.com/docs/border-radius\n */\n 'rounded-br': [{ 'rounded-br': [borderRadius] }],\n /**\n * Border Radius Bottom Left\n * @see https://tailwindcss.com/docs/border-radius\n */\n 'rounded-bl': [{ 'rounded-bl': [borderRadius] }],\n /**\n * Border Width\n * @see https://tailwindcss.com/docs/border-width\n */\n 'border-w': [{ border: [borderWidth] }],\n /**\n * Border Width X\n * @see https://tailwindcss.com/docs/border-width\n */\n 'border-w-x': [{ 'border-x': [borderWidth] }],\n /**\n * Border Width Y\n * @see https://tailwindcss.com/docs/border-width\n */\n 'border-w-y': [{ 'border-y': [borderWidth] }],\n /**\n * Border Width Start\n * @see https://tailwindcss.com/docs/border-width\n */\n 'border-w-s': [{ 'border-s': [borderWidth] }],\n /**\n * Border Width End\n * @see https://tailwindcss.com/docs/border-width\n */\n 'border-w-e': [{ 'border-e': [borderWidth] }],\n /**\n * Border Width Top\n * @see https://tailwindcss.com/docs/border-width\n */\n 'border-w-t': [{ 'border-t': [borderWidth] }],\n /**\n * Border Width Right\n * @see https://tailwindcss.com/docs/border-width\n */\n 'border-w-r': [{ 'border-r': [borderWidth] }],\n /**\n * Border Width Bottom\n * @see https://tailwindcss.com/docs/border-width\n */\n 'border-w-b': [{ 'border-b': [borderWidth] }],\n /**\n * Border Width Left\n * @see https://tailwindcss.com/docs/border-width\n */\n 'border-w-l': [{ 'border-l': [borderWidth] }],\n /**\n * Border Opacity\n * @see https://tailwindcss.com/docs/border-opacity\n */\n 'border-opacity': [{ 'border-opacity': [opacity] }],\n /**\n * Border Style\n * @see https://tailwindcss.com/docs/border-style\n */\n 'border-style': [{ border: [...getLineStyles(), 'hidden'] }],\n /**\n * Divide Width X\n * @see https://tailwindcss.com/docs/divide-width\n */\n 'divide-x': [{ 'divide-x': [borderWidth] }],\n /**\n * Divide Width X Reverse\n * @see https://tailwindcss.com/docs/divide-width\n */\n 'divide-x-reverse': ['divide-x-reverse'],\n /**\n * Divide Width Y\n * @see https://tailwindcss.com/docs/divide-width\n */\n 'divide-y': [{ 'divide-y': [borderWidth] }],\n /**\n * Divide Width Y Reverse\n * @see https://tailwindcss.com/docs/divide-width\n */\n 'divide-y-reverse': ['divide-y-reverse'],\n /**\n * Divide Opacity\n * @see https://tailwindcss.com/docs/divide-opacity\n */\n 'divide-opacity': [{ 'divide-opacity': [opacity] }],\n /**\n * Divide Style\n * @see https://tailwindcss.com/docs/divide-style\n */\n 'divide-style': [{ divide: getLineStyles() }],\n /**\n * Border Color\n * @see https://tailwindcss.com/docs/border-color\n */\n 'border-color': [{ border: [borderColor] }],\n /**\n * Border Color X\n * @see https://tailwindcss.com/docs/border-color\n */\n 'border-color-x': [{ 'border-x': [borderColor] }],\n /**\n * Border Color Y\n * @see https://tailwindcss.com/docs/border-color\n */\n 'border-color-y': [{ 'border-y': [borderColor] }],\n /**\n * Border Color S\n * @see https://tailwindcss.com/docs/border-color\n */\n 'border-color-s': [{ 'border-s': [borderColor] }],\n /**\n * Border Color E\n * @see https://tailwindcss.com/docs/border-color\n */\n 'border-color-e': [{ 'border-e': [borderColor] }],\n /**\n * Border Color Top\n * @see https://tailwindcss.com/docs/border-color\n */\n 'border-color-t': [{ 'border-t': [borderColor] }],\n /**\n * Border Color Right\n * @see https://tailwindcss.com/docs/border-color\n */\n 'border-color-r': [{ 'border-r': [borderColor] }],\n /**\n * Border Color Bottom\n * @see https://tailwindcss.com/docs/border-color\n */\n 'border-color-b': [{ 'border-b': [borderColor] }],\n /**\n * Border Color Left\n * @see https://tailwindcss.com/docs/border-color\n */\n 'border-color-l': [{ 'border-l': [borderColor] }],\n /**\n * Divide Color\n * @see https://tailwindcss.com/docs/divide-color\n */\n 'divide-color': [{ divide: [borderColor] }],\n /**\n * Outline Style\n * @see https://tailwindcss.com/docs/outline-style\n */\n 'outline-style': [{ outline: ['', ...getLineStyles()] }],\n /**\n * Outline Offset\n * @see https://tailwindcss.com/docs/outline-offset\n */\n 'outline-offset': [{ 'outline-offset': [isLength, isArbitraryValue] }],\n /**\n * Outline Width\n * @see https://tailwindcss.com/docs/outline-width\n */\n 'outline-w': [{ outline: [isLength, isArbitraryLength] }],\n /**\n * Outline Color\n * @see https://tailwindcss.com/docs/outline-color\n */\n 'outline-color': [{ outline: [colors] }],\n /**\n * Ring Width\n * @see https://tailwindcss.com/docs/ring-width\n */\n 'ring-w': [{ ring: getLengthWithEmptyAndArbitrary() }],\n /**\n * Ring Width Inset\n * @see https://tailwindcss.com/docs/ring-width\n */\n 'ring-w-inset': ['ring-inset'],\n /**\n * Ring Color\n * @see https://tailwindcss.com/docs/ring-color\n */\n 'ring-color': [{ ring: [colors] }],\n /**\n * Ring Opacity\n * @see https://tailwindcss.com/docs/ring-opacity\n */\n 'ring-opacity': [{ 'ring-opacity': [opacity] }],\n /**\n * Ring Offset Width\n * @see https://tailwindcss.com/docs/ring-offset-width\n */\n 'ring-offset-w': [{ 'ring-offset': [isLength, isArbitraryLength] }],\n /**\n * Ring Offset Color\n * @see https://tailwindcss.com/docs/ring-offset-color\n */\n 'ring-offset-color': [{ 'ring-offset': [colors] }],\n // Effects\n /**\n * Box Shadow\n * @see https://tailwindcss.com/docs/box-shadow\n */\n shadow: [{ shadow: ['', 'inner', 'none', isTshirtSize, isArbitraryShadow] }],\n /**\n * Box Shadow Color\n * @see https://tailwindcss.com/docs/box-shadow-color\n */\n 'shadow-color': [{ shadow: [isAny] }],\n /**\n * Opacity\n * @see https://tailwindcss.com/docs/opacity\n */\n opacity: [{ opacity: [opacity] }],\n /**\n * Mix Blend Mode\n * @see https://tailwindcss.com/docs/mix-blend-mode\n */\n 'mix-blend': [{ 'mix-blend': [...getBlendModes(), 'plus-lighter', 'plus-darker'] }],\n /**\n * Background Blend Mode\n * @see https://tailwindcss.com/docs/background-blend-mode\n */\n 'bg-blend': [{ 'bg-blend': getBlendModes() }],\n // Filters\n /**\n * Filter\n * @deprecated since Tailwind CSS v3.0.0\n * @see https://tailwindcss.com/docs/filter\n */\n filter: [{ filter: ['', 'none'] }],\n /**\n * Blur\n * @see https://tailwindcss.com/docs/blur\n */\n blur: [{ blur: [blur] }],\n /**\n * Brightness\n * @see https://tailwindcss.com/docs/brightness\n */\n brightness: [{ brightness: [brightness] }],\n /**\n * Contrast\n * @see https://tailwindcss.com/docs/contrast\n */\n contrast: [{ contrast: [contrast] }],\n /**\n * Drop Shadow\n * @see https://tailwindcss.com/docs/drop-shadow\n */\n 'drop-shadow': [{ 'drop-shadow': ['', 'none', isTshirtSize, isArbitraryValue] }],\n /**\n * Grayscale\n * @see https://tailwindcss.com/docs/grayscale\n */\n grayscale: [{ grayscale: [grayscale] }],\n /**\n * Hue Rotate\n * @see https://tailwindcss.com/docs/hue-rotate\n */\n 'hue-rotate': [{ 'hue-rotate': [hueRotate] }],\n /**\n * Invert\n * @see https://tailwindcss.com/docs/invert\n */\n invert: [{ invert: [invert] }],\n /**\n * Saturate\n * @see https://tailwindcss.com/docs/saturate\n */\n saturate: [{ saturate: [saturate] }],\n /**\n * Sepia\n * @see https://tailwindcss.com/docs/sepia\n */\n sepia: [{ sepia: [sepia] }],\n /**\n * Backdrop Filter\n * @deprecated since Tailwind CSS v3.0.0\n * @see https://tailwindcss.com/docs/backdrop-filter\n */\n 'backdrop-filter': [{ 'backdrop-filter': ['', 'none'] }],\n /**\n * Backdrop Blur\n * @see https://tailwindcss.com/docs/backdrop-blur\n */\n 'backdrop-blur': [{ 'backdrop-blur': [blur] }],\n /**\n * Backdrop Brightness\n * @see https://tailwindcss.com/docs/backdrop-brightness\n */\n 'backdrop-brightness': [{ 'backdrop-brightness': [brightness] }],\n /**\n * Backdrop Contrast\n * @see https://tailwindcss.com/docs/backdrop-contrast\n */\n 'backdrop-contrast': [{ 'backdrop-contrast': [contrast] }],\n /**\n * Backdrop Grayscale\n * @see https://tailwindcss.com/docs/backdrop-grayscale\n */\n 'backdrop-grayscale': [{ 'backdrop-grayscale': [grayscale] }],\n /**\n * Backdrop Hue Rotate\n * @see https://tailwindcss.com/docs/backdrop-hue-rotate\n */\n 'backdrop-hue-rotate': [{ 'backdrop-hue-rotate': [hueRotate] }],\n /**\n * Backdrop Invert\n * @see https://tailwindcss.com/docs/backdrop-invert\n */\n 'backdrop-invert': [{ 'backdrop-invert': [invert] }],\n /**\n * Backdrop Opacity\n * @see https://tailwindcss.com/docs/backdrop-opacity\n */\n 'backdrop-opacity': [{ 'backdrop-opacity': [opacity] }],\n /**\n * Backdrop Saturate\n * @see https://tailwindcss.com/docs/backdrop-saturate\n */\n 'backdrop-saturate': [{ 'backdrop-saturate': [saturate] }],\n /**\n * Backdrop Sepia\n * @see https://tailwindcss.com/docs/backdrop-sepia\n */\n 'backdrop-sepia': [{ 'backdrop-sepia': [sepia] }],\n // Tables\n /**\n * Border Collapse\n * @see https://tailwindcss.com/docs/border-collapse\n */\n 'border-collapse': [{ border: ['collapse', 'separate'] }],\n /**\n * Border Spacing\n * @see https://tailwindcss.com/docs/border-spacing\n */\n 'border-spacing': [{ 'border-spacing': [borderSpacing] }],\n /**\n * Border Spacing X\n * @see https://tailwindcss.com/docs/border-spacing\n */\n 'border-spacing-x': [{ 'border-spacing-x': [borderSpacing] }],\n /**\n * Border Spacing Y\n * @see https://tailwindcss.com/docs/border-spacing\n */\n 'border-spacing-y': [{ 'border-spacing-y': [borderSpacing] }],\n /**\n * Table Layout\n * @see https://tailwindcss.com/docs/table-layout\n */\n 'table-layout': [{ table: ['auto', 'fixed'] }],\n /**\n * Caption Side\n * @see https://tailwindcss.com/docs/caption-side\n */\n caption: [{ caption: ['top', 'bottom'] }],\n // Transitions and Animation\n /**\n * Tranisition Property\n * @see https://tailwindcss.com/docs/transition-property\n */\n transition: [\n {\n transition: [\n 'none',\n 'all',\n '',\n 'colors',\n 'opacity',\n 'shadow',\n 'transform',\n isArbitraryValue,\n ],\n },\n ],\n /**\n * Transition Duration\n * @see https://tailwindcss.com/docs/transition-duration\n */\n duration: [{ duration: getNumberAndArbitrary() }],\n /**\n * Transition Timing Function\n * @see https://tailwindcss.com/docs/transition-timing-function\n */\n ease: [{ ease: ['linear', 'in', 'out', 'in-out', isArbitraryValue] }],\n /**\n * Transition Delay\n * @see https://tailwindcss.com/docs/transition-delay\n */\n delay: [{ delay: getNumberAndArbitrary() }],\n /**\n * Animation\n * @see https://tailwindcss.com/docs/animation\n */\n animate: [{ animate: ['none', 'spin', 'ping', 'pulse', 'bounce', isArbitraryValue] }],\n // Transforms\n /**\n * Transform\n * @see https://tailwindcss.com/docs/transform\n */\n transform: [{ transform: ['', 'gpu', 'none'] }],\n /**\n * Scale\n * @see https://tailwindcss.com/docs/scale\n */\n scale: [{ scale: [scale] }],\n /**\n * Scale X\n * @see https://tailwindcss.com/docs/scale\n */\n 'scale-x': [{ 'scale-x': [scale] }],\n /**\n * Scale Y\n * @see https://tailwindcss.com/docs/scale\n */\n 'scale-y': [{ 'scale-y': [scale] }],\n /**\n * Rotate\n * @see https://tailwindcss.com/docs/rotate\n */\n rotate: [{ rotate: [isInteger, isArbitraryValue] }],\n /**\n * Translate X\n * @see https://tailwindcss.com/docs/translate\n */\n 'translate-x': [{ 'translate-x': [translate] }],\n /**\n * Translate Y\n * @see https://tailwindcss.com/docs/translate\n */\n 'translate-y': [{ 'translate-y': [translate] }],\n /**\n * Skew X\n * @see https://tailwindcss.com/docs/skew\n */\n 'skew-x': [{ 'skew-x': [skew] }],\n /**\n * Skew Y\n * @see https://tailwindcss.com/docs/skew\n */\n 'skew-y': [{ 'skew-y': [skew] }],\n /**\n * Transform Origin\n * @see https://tailwindcss.com/docs/transform-origin\n */\n 'transform-origin': [\n {\n origin: [\n 'center',\n 'top',\n 'top-right',\n 'right',\n 'bottom-right',\n 'bottom',\n 'bottom-left',\n 'left',\n 'top-left',\n isArbitraryValue,\n ],\n },\n ],\n // Interactivity\n /**\n * Accent Color\n * @see https://tailwindcss.com/docs/accent-color\n */\n accent: [{ accent: ['auto', colors] }],\n /**\n * Appearance\n * @see https://tailwindcss.com/docs/appearance\n */\n appearance: [{ appearance: ['none', 'auto'] }],\n /**\n * Cursor\n * @see https://tailwindcss.com/docs/cursor\n */\n cursor: [\n {\n cursor: [\n 'auto',\n 'default',\n 'pointer',\n 'wait',\n 'text',\n 'move',\n 'help',\n 'not-allowed',\n 'none',\n 'context-menu',\n 'progress',\n 'cell',\n 'crosshair',\n 'vertical-text',\n 'alias',\n 'copy',\n 'no-drop',\n 'grab',\n 'grabbing',\n 'all-scroll',\n 'col-resize',\n 'row-resize',\n 'n-resize',\n 'e-resize',\n 's-resize',\n 'w-resize',\n 'ne-resize',\n 'nw-resize',\n 'se-resize',\n 'sw-resize',\n 'ew-resize',\n 'ns-resize',\n 'nesw-resize',\n 'nwse-resize',\n 'zoom-in',\n 'zoom-out',\n isArbitraryValue,\n ],\n },\n ],\n /**\n * Caret Color\n * @see https://tailwindcss.com/docs/just-in-time-mode#caret-color-utilities\n */\n 'caret-color': [{ caret: [colors] }],\n /**\n * Pointer Events\n * @see https://tailwindcss.com/docs/pointer-events\n */\n 'pointer-events': [{ 'pointer-events': ['none', 'auto'] }],\n /**\n * Resize\n * @see https://tailwindcss.com/docs/resize\n */\n resize: [{ resize: ['none', 'y', 'x', ''] }],\n /**\n * Scroll Behavior\n * @see https://tailwindcss.com/docs/scroll-behavior\n */\n 'scroll-behavior': [{ scroll: ['auto', 'smooth'] }],\n /**\n * Scroll Margin\n * @see https://tailwindcss.com/docs/scroll-margin\n */\n 'scroll-m': [{ 'scroll-m': getSpacingWithArbitrary() }],\n /**\n * Scroll Margin X\n * @see https://tailwindcss.com/docs/scroll-margin\n */\n 'scroll-mx': [{ 'scroll-mx': getSpacingWithArbitrary() }],\n /**\n * Scroll Margin Y\n * @see https://tailwindcss.com/docs/scroll-margin\n */\n 'scroll-my': [{ 'scroll-my': getSpacingWithArbitrary() }],\n /**\n * Scroll Margin Start\n * @see https://tailwindcss.com/docs/scroll-margin\n */\n 'scroll-ms': [{ 'scroll-ms': getSpacingWithArbitrary() }],\n /**\n * Scroll Margin End\n * @see https://tailwindcss.com/docs/scroll-margin\n */\n 'scroll-me': [{ 'scroll-me': getSpacingWithArbitrary() }],\n /**\n * Scroll Margin Top\n * @see https://tailwindcss.com/docs/scroll-margin\n */\n 'scroll-mt': [{ 'scroll-mt': getSpacingWithArbitrary() }],\n /**\n * Scroll Margin Right\n * @see https://tailwindcss.com/docs/scroll-margin\n */\n 'scroll-mr': [{ 'scroll-mr': getSpacingWithArbitrary() }],\n /**\n * Scroll Margin Bottom\n * @see https://tailwindcss.com/docs/scroll-margin\n */\n 'scroll-mb': [{ 'scroll-mb': getSpacingWithArbitrary() }],\n /**\n * Scroll Margin Left\n * @see https://tailwindcss.com/docs/scroll-margin\n */\n 'scroll-ml': [{ 'scroll-ml': getSpacingWithArbitrary() }],\n /**\n * Scroll Padding\n * @see https://tailwindcss.com/docs/scroll-padding\n */\n 'scroll-p': [{ 'scroll-p': getSpacingWithArbitrary() }],\n /**\n * Scroll Padding X\n * @see https://tailwindcss.com/docs/scroll-padding\n */\n 'scroll-px': [{ 'scroll-px': getSpacingWithArbitrary() }],\n /**\n * Scroll Padding Y\n * @see https://tailwindcss.com/docs/scroll-padding\n */\n 'scroll-py': [{ 'scroll-py': getSpacingWithArbitrary() }],\n /**\n * Scroll Padding Start\n * @see https://tailwindcss.com/docs/scroll-padding\n */\n 'scroll-ps': [{ 'scroll-ps': getSpacingWithArbitrary() }],\n /**\n * Scroll Padding End\n * @see https://tailwindcss.com/docs/scroll-padding\n */\n 'scroll-pe': [{ 'scroll-pe': getSpacingWithArbitrary() }],\n /**\n * Scroll Padding Top\n * @see https://tailwindcss.com/docs/scroll-padding\n */\n 'scroll-pt': [{ 'scroll-pt': getSpacingWithArbitrary() }],\n /**\n * Scroll Padding Right\n * @see https://tailwindcss.com/docs/scroll-padding\n */\n 'scroll-pr': [{ 'scroll-pr': getSpacingWithArbitrary() }],\n /**\n * Scroll Padding Bottom\n * @see https://tailwindcss.com/docs/scroll-padding\n */\n 'scroll-pb': [{ 'scroll-pb': getSpacingWithArbitrary() }],\n /**\n * Scroll Padding Left\n * @see https://tailwindcss.com/docs/scroll-padding\n */\n 'scroll-pl': [{ 'scroll-pl': getSpacingWithArbitrary() }],\n /**\n * Scroll Snap Align\n * @see https://tailwindcss.com/docs/scroll-snap-align\n */\n 'snap-align': [{ snap: ['start', 'end', 'center', 'align-none'] }],\n /**\n * Scroll Snap Stop\n * @see https://tailwindcss.com/docs/scroll-snap-stop\n */\n 'snap-stop': [{ snap: ['normal', 'always'] }],\n /**\n * Scroll Snap Type\n * @see https://tailwindcss.com/docs/scroll-snap-type\n */\n 'snap-type': [{ snap: ['none', 'x', 'y', 'both'] }],\n /**\n * Scroll Snap Type Strictness\n * @see https://tailwindcss.com/docs/scroll-snap-type\n */\n 'snap-strictness': [{ snap: ['mandatory', 'proximity'] }],\n /**\n * Touch Action\n * @see https://tailwindcss.com/docs/touch-action\n */\n touch: [\n {\n touch: ['auto', 'none', 'manipulation'],\n },\n ],\n /**\n * Touch Action X\n * @see https://tailwindcss.com/docs/touch-action\n */\n 'touch-x': [\n {\n 'touch-pan': ['x', 'left', 'right'],\n },\n ],\n /**\n * Touch Action Y\n * @see https://tailwindcss.com/docs/touch-action\n */\n 'touch-y': [\n {\n 'touch-pan': ['y', 'up', 'down'],\n },\n ],\n /**\n * Touch Action Pinch Zoom\n * @see https://tailwindcss.com/docs/touch-action\n */\n 'touch-pz': ['touch-pinch-zoom'],\n /**\n * User Select\n * @see https://tailwindcss.com/docs/user-select\n */\n select: [{ select: ['none', 'text', 'all', 'auto'] }],\n /**\n * Will Change\n * @see https://tailwindcss.com/docs/will-change\n */\n 'will-change': [\n { 'will-change': ['auto', 'scroll', 'contents', 'transform', isArbitraryValue] },\n ],\n // SVG\n /**\n * Fill\n * @see https://tailwindcss.com/docs/fill\n */\n fill: [{ fill: [colors, 'none'] }],\n /**\n * Stroke Width\n * @see https://tailwindcss.com/docs/stroke-width\n */\n 'stroke-w': [{ stroke: [isLength, isArbitraryLength, isArbitraryNumber] }],\n /**\n * Stroke\n * @see https://tailwindcss.com/docs/stroke\n */\n stroke: [{ stroke: [colors, 'none'] }],\n // Accessibility\n /**\n * Screen Readers\n * @see https://tailwindcss.com/docs/screen-readers\n */\n sr: ['sr-only', 'not-sr-only'],\n /**\n * Forced Color Adjust\n * @see https://tailwindcss.com/docs/forced-color-adjust\n */\n 'forced-color-adjust': [{ 'forced-color-adjust': ['auto', 'none'] }],\n },\n conflictingClassGroups: {\n overflow: ['overflow-x', 'overflow-y'],\n overscroll: ['overscroll-x', 'overscroll-y'],\n inset: ['inset-x', 'inset-y', 'start', 'end', 'top', 'right', 'bottom', 'left'],\n 'inset-x': ['right', 'left'],\n 'inset-y': ['top', 'bottom'],\n flex: ['basis', 'grow', 'shrink'],\n gap: ['gap-x', 'gap-y'],\n p: ['px', 'py', 'ps', 'pe', 'pt', 'pr', 'pb', 'pl'],\n px: ['pr', 'pl'],\n py: ['pt', 'pb'],\n m: ['mx', 'my', 'ms', 'me', 'mt', 'mr', 'mb', 'ml'],\n mx: ['mr', 'ml'],\n my: ['mt', 'mb'],\n size: ['w', 'h'],\n 'font-size': ['leading'],\n 'fvn-normal': [\n 'fvn-ordinal',\n 'fvn-slashed-zero',\n 'fvn-figure',\n 'fvn-spacing',\n 'fvn-fraction',\n ],\n 'fvn-ordinal': ['fvn-normal'],\n 'fvn-slashed-zero': ['fvn-normal'],\n 'fvn-figure': ['fvn-normal'],\n 'fvn-spacing': ['fvn-normal'],\n 'fvn-fraction': ['fvn-normal'],\n 'line-clamp': ['display', 'overflow'],\n rounded: [\n 'rounded-s',\n 'rounded-e',\n 'rounded-t',\n 'rounded-r',\n 'rounded-b',\n 'rounded-l',\n 'rounded-ss',\n 'rounded-se',\n 'rounded-ee',\n 'rounded-es',\n 'rounded-tl',\n 'rounded-tr',\n 'rounded-br',\n 'rounded-bl',\n ],\n 'rounded-s': ['rounded-ss', 'rounded-es'],\n 'rounded-e': ['rounded-se', 'rounded-ee'],\n 'rounded-t': ['rounded-tl', 'rounded-tr'],\n 'rounded-r': ['rounded-tr', 'rounded-br'],\n 'rounded-b': ['rounded-br', 'rounded-bl'],\n 'rounded-l': ['rounded-tl', 'rounded-bl'],\n 'border-spacing': ['border-spacing-x', 'border-spacing-y'],\n 'border-w': [\n 'border-w-s',\n 'border-w-e',\n 'border-w-t',\n 'border-w-r',\n 'border-w-b',\n 'border-w-l',\n ],\n 'border-w-x': ['border-w-r', 'border-w-l'],\n 'border-w-y': ['border-w-t', 'border-w-b'],\n 'border-color': [\n 'border-color-s',\n 'border-color-e',\n 'border-color-t',\n 'border-color-r',\n 'border-color-b',\n 'border-color-l',\n ],\n 'border-color-x': ['border-color-r', 'border-color-l'],\n 'border-color-y': ['border-color-t', 'border-color-b'],\n 'scroll-m': [\n 'scroll-mx',\n 'scroll-my',\n 'scroll-ms',\n 'scroll-me',\n 'scroll-mt',\n 'scroll-mr',\n 'scroll-mb',\n 'scroll-ml',\n ],\n 'scroll-mx': ['scroll-mr', 'scroll-ml'],\n 'scroll-my': ['scroll-mt', 'scroll-mb'],\n 'scroll-p': [\n 'scroll-px',\n 'scroll-py',\n 'scroll-ps',\n 'scroll-pe',\n 'scroll-pt',\n 'scroll-pr',\n 'scroll-pb',\n 'scroll-pl',\n ],\n 'scroll-px': ['scroll-pr', 'scroll-pl'],\n 'scroll-py': ['scroll-pt', 'scroll-pb'],\n touch: ['touch-x', 'touch-y', 'touch-pz'],\n 'touch-x': ['touch'],\n 'touch-y': ['touch'],\n 'touch-pz': ['touch'],\n },\n conflictingClassGroupModifiers: {\n 'font-size': ['leading'],\n },\n } as const satisfies Config<DefaultClassGroupIds, DefaultThemeGroupIds>\n}\n","import { ConfigExtension, GenericConfig } from './types'\n\n/**\n * @param baseConfig Config where other config will be merged into. This object will be mutated.\n * @param configExtension Partial config to merge into the `baseConfig`.\n */\nexport const mergeConfigs = <ClassGroupIds extends string, ThemeGroupIds extends string = never>(\n baseConfig: GenericConfig,\n {\n cacheSize,\n prefix,\n separator,\n experimentalParseClassName,\n extend = {},\n override = {},\n }: ConfigExtension<ClassGroupIds, ThemeGroupIds>,\n) => {\n overrideProperty(baseConfig, 'cacheSize', cacheSize)\n overrideProperty(baseConfig, 'prefix', prefix)\n overrideProperty(baseConfig, 'separator', separator)\n overrideProperty(baseConfig, 'experimentalParseClassName', experimentalParseClassName)\n\n for (const configKey in override) {\n overrideConfigProperties(\n baseConfig[configKey as keyof typeof override],\n override[configKey as keyof typeof override],\n )\n }\n\n for (const key in extend) {\n mergeConfigProperties(\n baseConfig[key as keyof typeof extend],\n extend[key as keyof typeof extend],\n )\n }\n\n return baseConfig\n}\n\nconst overrideProperty = <T extends object, K extends keyof T>(\n baseObject: T,\n overrideKey: K,\n overrideValue: T[K] | undefined,\n) => {\n if (overrideValue !== undefined) {\n baseObject[overrideKey] = overrideValue\n }\n}\n\nconst overrideConfigProperties = (\n baseObject: Partial<Record<string, readonly unknown[]>>,\n overrideObject: Partial<Record<string, readonly unknown[]>> | undefined,\n) => {\n if (overrideObject) {\n for (const key in overrideObject) {\n overrideProperty(baseObject, key, overrideObject[key])\n }\n }\n}\n\nconst mergeConfigProperties = (\n baseObject: Partial<Record<string, readonly unknown[]>>,\n mergeObject: Partial<Record<string, readonly unknown[]>> | undefined,\n) => {\n if (mergeObject) {\n for (const key in mergeObject) {\n const mergeValue = mergeObject[key]\n\n if (mergeValue !== undefined) {\n baseObject[key] = (baseObject[key] || []).concat(mergeValue)\n }\n }\n }\n}\n","import { createTailwindMerge } from './create-tailwind-merge'\nimport { getDefaultConfig } from './default-config'\nimport { mergeConfigs } from './merge-configs'\nimport { ConfigExtension, DefaultClassGroupIds, DefaultThemeGroupIds, GenericConfig } from './types'\n\ntype CreateConfigSubsequent = (config: GenericConfig) => GenericConfig\n\nexport const extendTailwindMerge = <\n AdditionalClassGroupIds extends string = never,\n AdditionalThemeGroupIds extends string = never,\n>(\n configExtension:\n | ConfigExtension<\n DefaultClassGroupIds | AdditionalClassGroupIds,\n DefaultThemeGroupIds | AdditionalThemeGroupIds\n >\n | CreateConfigSubsequent,\n ...createConfig: CreateConfigSubsequent[]\n) =>\n typeof configExtension === 'function'\n ? createTailwindMerge(getDefaultConfig, configExtension, ...createConfig)\n : createTailwindMerge(\n () => mergeConfigs(getDefaultConfig(), configExtension),\n ...createConfig,\n )\n","import { createTailwindMerge } from './create-tailwind-merge'\nimport { getDefaultConfig } from './default-config'\n\nexport const twMerge = createTailwindMerge(getDefaultConfig)\n","import createLucideIcon from '../createLucideIcon';\n\n/**\n * @component @name CircleAlert\n * @description Lucide SVG icon component, renders SVG Element with children.\n *\n * @preview ![img](data:image/svg+xml;base64,PHN2ZyAgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIgogIHdpZHRoPSIyNCIKICBoZWlnaHQ9IjI0IgogIHZpZXdCb3g9IjAgMCAyNCAyNCIKICBmaWxsPSJub25lIgogIHN0cm9rZT0iIzAwMCIgc3R5bGU9ImJhY2tncm91bmQtY29sb3I6ICNmZmY7IGJvcmRlci1yYWRpdXM6IDJweCIKICBzdHJva2Utd2lkdGg9IjIiCiAgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIgogIHN0cm9rZS1saW5lam9pbj0icm91bmQiCj4KICA8Y2lyY2xlIGN4PSIxMiIgY3k9IjEyIiByPSIxMCIgLz4KICA8bGluZSB4MT0iMTIiIHgyPSIxMiIgeTE9IjgiIHkyPSIxMiIgLz4KICA8bGluZSB4MT0iMTIiIHgyPSIxMi4wMSIgeTE9IjE2IiB5Mj0iMTYiIC8+Cjwvc3ZnPgo=) - https://lucide.dev/icons/circle-alert\n * @see https://lucide.dev/guide/packages/lucide-react - Documentation\n *\n * @param {Object} props - Lucide icons props and any valid SVG attribute\n * @returns {JSX.Element} JSX Element\n *\n */\nconst CircleAlert = createLucideIcon('CircleAlert', [\n ['circle', { cx: '12', cy: '12', r: '10', key: '1mglay' }],\n ['line', { x1: '12', x2: '12', y1: '8', y2: '12', key: '1pkeuh' }],\n ['line', { x1: '12', x2: '12.01', y1: '16', y2: '16', key: '4dfq90' }],\n]);\n\nexport default CircleAlert;\n","/**\n * Copyright 2022 Joe Bell. All rights reserved.\n *\n * This file is licensed to you under the Apache License, Version 2.0\n * (the \"License\"); you may not use this file except in compliance with the\n * License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the\n * License for the specific language governing permissions and limitations under\n * the License.\n */ import { clsx } from \"clsx\";\nconst falsyToString = (value)=>typeof value === \"boolean\" ? `${value}` : value === 0 ? \"0\" : value;\nexport const cx = clsx;\nexport const cva = (base, config)=>(props)=>{\n var _config_compoundVariants;\n if ((config === null || config === void 0 ? void 0 : config.variants) == null) return cx(base, props === null || props === void 0 ? void 0 : props.class, props === null || props === void 0 ? void 0 : props.className);\n const { variants, defaultVariants } = config;\n const getVariantClassNames = Object.keys(variants).map((variant)=>{\n const variantProp = props === null || props === void 0 ? void 0 : props[variant];\n const defaultVariantProp = defaultVariants === null || defaultVariants === void 0 ? void 0 : defaultVariants[variant];\n if (variantProp === null) return null;\n const variantKey = falsyToString(variantProp) || falsyToString(defaultVariantProp);\n return variants[variant][variantKey];\n });\n const propsWithoutUndefined = props && Object.entries(props).reduce((acc, param)=>{\n let [key, value] = param;\n if (value === undefined) {\n return acc;\n }\n acc[key] = value;\n return acc;\n }, {});\n const getCompoundVariantClassNames = config === null || config === void 0 ? void 0 : (_config_compoundVariants = config.compoundVariants) === null || _config_compoundVariants === void 0 ? void 0 : _config_compoundVariants.reduce((acc, param)=>{\n let { class: cvClass, className: cvClassName, ...compoundVariantOptions } = param;\n return Object.entries(compoundVariantOptions).every((param)=>{\n let [key, value] = param;\n return Array.isArray(value) ? value.includes({\n ...defaultVariants,\n ...propsWithoutUndefined\n }[key]) : ({\n ...defaultVariants,\n ...propsWithoutUndefined\n })[key] === value;\n }) ? [\n ...acc,\n cvClass,\n cvClassName\n ] : acc;\n }, []);\n return cx(base, getVariantClassNames, getCompoundVariantClassNames, props === null || props === void 0 ? void 0 : props.class, props === null || props === void 0 ? void 0 : props.className);\n };\n\n","import { cva, type VariantProps } from 'class-variance-authority';\nimport * as React from 'react';\n\nimport { cn } from '@/lib/utils';\n\nconst alertVariants = cva(\n 'relative w-full rounded-lg border p-4 [&>svg~*]:pl-7 [&>svg+div]:translate-y-[-3px] [&>svg]:absolute [&>svg]:left-4 [&>svg]:top-4 [&>svg]:text-foreground',\n {\n variants: {\n variant: {\n default: 'bg-background text-foreground',\n destructive:\n 'border-destructive/50 text-destructive dark:border-destructive [&>svg]:text-destructive',\n },\n },\n defaultVariants: {\n variant: 'default',\n },\n }\n);\n\nconst Alert = React.forwardRef<\n HTMLDivElement,\n React.HTMLAttributes<HTMLDivElement> & VariantProps<typeof alertVariants>\n>(({ className, variant, ...props }, ref) => (\n <div\n ref={ref}\n role=\"alert\"\n className={cn(alertVariants({ variant }), className)}\n {...props}\n />\n));\nAlert.displayName = 'Alert';\n\nconst AlertTitle = React.forwardRef<\n HTMLParagraphElement,\n React.HTMLAttributes<HTMLHeadingElement>\n>(({ className, ...props }, ref) => (\n <h5\n ref={ref}\n className={cn('mb-1 font-medium leading-none tracking-tight', className)}\n {...props}\n />\n));\nAlertTitle.displayName = 'AlertTitle';\n\nconst AlertDescription = React.forwardRef<\n HTMLParagraphElement,\n React.HTMLAttributes<HTMLParagraphElement>\n>(({ className, ...props }, ref) => (\n <div\n ref={ref}\n className={cn('text-sm [&_p]:leading-relaxed', className)}\n {...props}\n />\n));\nAlertDescription.displayName = 'AlertDescription';\n\nexport { Alert, AlertTitle, AlertDescription };\n","// packages/react/compose-refs/src/composeRefs.tsx\nimport * as React from \"react\";\nfunction setRef(ref, value) {\n if (typeof ref === \"function\") {\n return ref(value);\n } else if (ref !== null && ref !== void 0) {\n ref.current = value;\n }\n}\nfunction composeRefs(...refs) {\n return (node) => {\n let hasCleanup = false;\n const cleanups = refs.map((ref) => {\n const cleanup = setRef(ref, node);\n if (!hasCleanup && typeof cleanup == \"function\") {\n hasCleanup = true;\n }\n return cleanup;\n });\n if (hasCleanup) {\n return () => {\n for (let i = 0; i < cleanups.length; i++) {\n const cleanup = cleanups[i];\n if (typeof cleanup == \"function\") {\n cleanup();\n } else {\n setRef(refs[i], null);\n }\n }\n };\n }\n };\n}\nfunction useComposedRefs(...refs) {\n return React.useCallback(composeRefs(...refs), refs);\n}\nexport {\n composeRefs,\n useComposedRefs\n};\n//# sourceMappingURL=index.mjs.map\n","// packages/react/slot/src/Slot.tsx\nimport * as React from \"react\";\nimport { composeRefs } from \"@radix-ui/react-compose-refs\";\nimport { Fragment, jsx } from \"react/jsx-runtime\";\nvar Slot = React.forwardRef((props, forwardedRef) => {\n const { children, ...slotProps } = props;\n const childrenArray = React.Children.toArray(children);\n const slottable = childrenArray.find(isSlottable);\n if (slottable) {\n const newElement = slottable.props.children;\n const newChildren = childrenArray.map((child) => {\n if (child === slottable) {\n if (React.Children.count(newElement) > 1) return React.Children.only(null);\n return React.isValidElement(newElement) ? newElement.props.children : null;\n } else {\n return child;\n }\n });\n return /* @__PURE__ */ jsx(SlotClone, { ...slotProps, ref: forwardedRef, children: React.isValidElement(newElement) ? React.cloneElement(newElement, void 0, newChildren) : null });\n }\n return /* @__PURE__ */ jsx(SlotClone, { ...slotProps, ref: forwardedRef, children });\n});\nSlot.displayName = \"Slot\";\nvar SlotClone = React.forwardRef((props, forwardedRef) => {\n const { children, ...slotProps } = props;\n if (React.isValidElement(children)) {\n const childrenRef = getElementRef(children);\n return React.cloneElement(children, {\n ...mergeProps(slotProps, children.props),\n // @ts-ignore\n ref: forwardedRef ? composeRefs(forwardedRef, childrenRef) : childrenRef\n });\n }\n return React.Children.count(children) > 1 ? React.Children.only(null) : null;\n});\nSlotClone.displayName = \"SlotClone\";\nvar Slottable = ({ children }) => {\n return /* @__PURE__ */ jsx(Fragment, { children });\n};\nfunction isSlottable(child) {\n return React.isValidElement(child) && child.type === Slottable;\n}\nfunction mergeProps(slotProps, childProps) {\n const overrideProps = { ...childProps };\n for (const propName in childProps) {\n const slotPropValue = slotProps[propName];\n const childPropValue = childProps[propName];\n const isHandler = /^on[A-Z]/.test(propName);\n if (isHandler) {\n if (slotPropValue && childPropValue) {\n overrideProps[propName] = (...args) => {\n childPropValue(...args);\n slotPropValue(...args);\n };\n } else if (slotPropValue) {\n overrideProps[propName] = slotPropValue;\n }\n } else if (propName === \"style\") {\n overrideProps[propName] = { ...slotPropValue, ...childPropValue };\n } else if (propName === \"className\") {\n overrideProps[propName] = [slotPropValue, childPropValue].filter(Boolean).join(\" \");\n }\n }\n return { ...slotProps, ...overrideProps };\n}\nfunction getElementRef(element) {\n let getter = Object.getOwnPropertyDescriptor(element.props, \"ref\")?.get;\n let mayWarn = getter && \"isReactWarning\" in getter && getter.isReactWarning;\n if (mayWarn) {\n return element.ref;\n }\n getter = Object.getOwnPropertyDescriptor(element, \"ref\")?.get;\n mayWarn = getter && \"isReactWarning\" in getter && getter.isReactWarning;\n if (mayWarn) {\n return element.props.ref;\n }\n return element.props.ref || element.ref;\n}\nvar Root = Slot;\nexport {\n Root,\n Slot,\n Slottable\n};\n//# sourceMappingURL=index.mjs.map\n","import { Slot } from '@radix-ui/react-slot';\nimport { cva, type VariantProps } from 'class-variance-authority';\nimport * as React from 'react';\n\nimport { cn } from '@/lib/utils';\n\nconst buttonVariants = cva(\n 'inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0',\n {\n variants: {\n variant: {\n default: 'bg-primary text-primary-foreground hover:bg-primary/90',\n destructive:\n 'bg-destructive text-destructive-foreground hover:bg-destructive/90',\n outline:\n 'border border-input bg-background hover:bg-accent hover:text-accent-foreground',\n secondary:\n 'bg-secondary text-secondary-foreground hover:bg-secondary/80',\n ghost: 'hover:bg-accent hover:text-accent-foreground',\n link: 'text-primary underline-offset-4 hover:underline',\n },\n size: {\n default: 'h-10 px-4 py-2',\n sm: 'h-9 rounded-md px-3',\n lg: 'h-11 rounded-md px-8',\n icon: 'h-10 w-10',\n },\n },\n defaultVariants: {\n variant: 'default',\n size: 'default',\n },\n }\n);\n\nexport interface ButtonProps\n extends React.ButtonHTMLAttributes<HTMLButtonElement>,\n VariantProps<typeof buttonVariants> {\n asChild?: boolean;\n}\n\nconst Button = React.forwardRef<HTMLButtonElement, ButtonProps>(\n ({ className, variant, size, asChild = false, ...props }, ref) => {\n const Comp = asChild ? Slot : 'button';\n return (\n <Comp\n className={cn(buttonVariants({ variant, size, className }))}\n ref={ref}\n {...props}\n />\n );\n }\n);\nButton.displayName = 'Button';\n\nexport { Button, buttonVariants };\n","'use client';\n\nimport type { EnvMap } from '@workflow/web-shared/server';\nimport { usePathname, useRouter, useSearchParams } from 'next/navigation';\nimport { useMemo } from 'react';\nimport type { WorldConfig } from '@/lib/config-world';\n\n// Default configuration\nconst DEFAULT_CONFIG: WorldConfig = {\n backend: 'local',\n dataDir: './.next/workflow-data',\n port: '3000',\n env: 'production',\n};\n\nexport const resolveTargetWorld = (backend?: string) => {\n switch (backend) {\n case 'postgres':\n return '@workflow/world-postgres';\n default:\n return backend;\n }\n};\n\n// Config query param keys\nconst CONFIG_PARAM_KEYS = [\n 'backend',\n 'env',\n 'authToken',\n 'project',\n 'team',\n 'port',\n 'dataDir',\n 'postgresUrl',\n] as const;\n\n/**\n * Hook that reads query params and returns the current config\n * Config is derived from default config + query params\n */\nexport function useQueryParamConfig(): WorldConfig {\n const searchParams = useSearchParams();\n\n const config = useMemo(() => {\n const configFromParams: WorldConfig = { ...DEFAULT_CONFIG };\n\n // Override with query parameters\n for (const key of CONFIG_PARAM_KEYS) {\n const value = searchParams.get(key);\n if (value) {\n configFromParams[key] = value;\n }\n }\n\n return configFromParams;\n }, [searchParams]);\n\n return config;\n}\n\n/**\n * Hook that returns a function to update config query params\n * Preserves all other query params while updating config params\n */\nexport function useUpdateConfigQueryParams() {\n const router = useRouter();\n const pathname = usePathname();\n const searchParams = useSearchParams();\n\n const updateConfig = useMemo(\n () => (newConfig: WorldConfig) => {\n const params = new URLSearchParams(searchParams.toString());\n\n // Update config params\n for (const key of CONFIG_PARAM_KEYS) {\n const value = newConfig[key];\n if (value !== undefined && value !== null && value !== '') {\n // Only set if it differs from default or if it was already set\n if (value !== DEFAULT_CONFIG[key] || searchParams.has(key)) {\n params.set(key, value);\n }\n } else {\n // Remove param if it's undefined/null/empty\n params.delete(key);\n }\n }\n\n // Navigate with updated params\n const queryString = params.toString();\n const newUrl = queryString ? `${pathname}?${queryString}` : pathname;\n router.push(newUrl);\n },\n [router, pathname, searchParams]\n );\n\n return updateConfig;\n}\n\n/**\n * Helper to get config params from a URLSearchParams object\n * Useful for building URLs with config params\n */\nexport function getConfigParams(config: WorldConfig): URLSearchParams {\n const params = new URLSearchParams();\n\n for (const key of CONFIG_PARAM_KEYS) {\n const value = config[key];\n if (\n value !== undefined &&\n value !== null &&\n value !== '' &&\n value !== DEFAULT_CONFIG[key]\n ) {\n params.set(key, value);\n }\n }\n\n return params;\n}\n\n/**\n * Helper to build a URL with config params while preserving other params\n */\nexport function buildUrlWithConfig(\n path: string,\n config: WorldConfig,\n additionalParams?: Record<string, string>\n): string {\n const params = getConfigParams(config);\n\n // Add additional params\n if (additionalParams) {\n for (const [key, value] of Object.entries(additionalParams)) {\n if (value !== undefined && value !== null && value !== '') {\n params.set(key, value);\n }\n }\n }\n\n const queryString = params.toString();\n return queryString ? `${path}?${queryString}` : path;\n}\n\nexport const worldConfigToEnvMap = (config: WorldConfig): EnvMap => {\n return {\n WORKFLOW_TARGET_WORLD: resolveTargetWorld(config.backend),\n WORKFLOW_VERCEL_ENV: config.env,\n WORKFLOW_VERCEL_AUTH_TOKEN: config.authToken,\n WORKFLOW_VERCEL_PROJECT: config.project,\n WORKFLOW_VERCEL_TEAM: config.team,\n PORT: config.port,\n WORKFLOW_LOCAL_DATA_DIR: config.dataDir,\n // Postgres env vars\n WORKFLOW_POSTGRES_URL: config.postgresUrl,\n };\n};\n","// This file must be bundled in the app's client layer, it shouldn't be directly\n// imported by the server.\n\nexport { callServer } from 'next/dist/client/app-call-server'\nexport { findSourceMapURL } from 'next/dist/client/app-find-source-map-url'\n\n// A noop wrapper to let the Flight client create the server reference.\n// See also: https://github.com/facebook/react/pull/26632\n// eslint-disable-next-line import/no-extraneous-dependencies\nexport { createServerReference } from 'react-server-dom-webpack/client'\n","/**\n * @license React\n * use-sync-external-store-shim.production.js\n *\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n\"use strict\";\nvar React = require(\"react\");\nfunction is(x, y) {\n return (x === y && (0 !== x || 1 / x === 1 / y)) || (x !== x && y !== y);\n}\nvar objectIs = \"function\" === typeof Object.is ? Object.is : is,\n useState = React.useState,\n useEffect = React.useEffect,\n useLayoutEffect = React.useLayoutEffect,\n useDebugValue = React.useDebugValue;\nfunction useSyncExternalStore$2(subscribe, getSnapshot) {\n var value = getSnapshot(),\n _useState = useState({ inst: { value: value, getSnapshot: getSnapshot } }),\n inst = _useState[0].inst,\n forceUpdate = _useState[1];\n useLayoutEffect(\n function () {\n inst.value = value;\n inst.getSnapshot = getSnapshot;\n checkIfSnapshotChanged(inst) && forceUpdate({ inst: inst });\n },\n [subscribe, value, getSnapshot]\n );\n useEffect(\n function () {\n checkIfSnapshotChanged(inst) && forceUpdate({ inst: inst });\n return subscribe(function () {\n checkIfSnapshotChanged(inst) && forceUpdate({ inst: inst });\n });\n },\n [subscribe]\n );\n useDebugValue(value);\n return value;\n}\nfunction checkIfSnapshotChanged(inst) {\n var latestGetSnapshot = inst.getSnapshot;\n inst = inst.value;\n try {\n var nextValue = latestGetSnapshot();\n return !objectIs(inst, nextValue);\n } catch (error) {\n return !0;\n }\n}\nfunction useSyncExternalStore$1(subscribe, getSnapshot) {\n return getSnapshot();\n}\nvar shim =\n \"undefined\" === typeof window ||\n \"undefined\" === typeof window.document ||\n \"undefined\" === typeof window.document.createElement\n ? useSyncExternalStore$1\n : useSyncExternalStore$2;\nexports.useSyncExternalStore =\n void 0 !== React.useSyncExternalStore ? React.useSyncExternalStore : shim;\n","'use strict';\n\nif (process.env.NODE_ENV === 'production') {\n module.exports = require('../cjs/use-sync-external-store-shim.production.js');\n} else {\n module.exports = require('../cjs/use-sync-external-store-shim.development.js');\n}\n","import React, { useRef, useMemo, useCallback, useDebugValue } from 'react';\nimport { useSyncExternalStore } from 'use-sync-external-store/shim/index.js';\nimport { UNDEFINED as UNDEFINED$1, OBJECT as OBJECT$1, SWRConfig as SWRConfig$1, defaultConfig, withArgs, SWRGlobalState, serialize as serialize$1, createCacheHelper, isUndefined as isUndefined$1, isPromiseLike, getTimestamp, isFunction as isFunction$1, revalidateEvents, internalMutate, useIsomorphicLayoutEffect, subscribeCallback, IS_SERVER, rAF, IS_REACT_LEGACY, mergeObjects } from '../_internal/index.mjs';\nexport { mutate, preload, useSWRConfig } from '../_internal/index.mjs';\n\n// Shared state between server components and client components\nconst noop = ()=>{};\n// Using noop() as the undefined value as undefined can be replaced\n// by something else. Prettier ignore and extra parentheses are necessary here\n// to ensure that tsc doesn't remove the __NOINLINE__ comment.\n// prettier-ignore\nconst UNDEFINED = /*#__NOINLINE__*/ noop();\nconst OBJECT = Object;\nconst isUndefined = (v)=>v === UNDEFINED;\nconst isFunction = (v)=>typeof v == 'function';\n\n// use WeakMap to store the object->key mapping\n// so the objects can be garbage collected.\n// WeakMap uses a hashtable under the hood, so the lookup\n// complexity is almost O(1).\nconst table = new WeakMap();\nconst getTypeName = (value)=>OBJECT.prototype.toString.call(value);\nconst isObjectTypeName = (typeName, type)=>typeName === `[object ${type}]`;\n// counter of the key\nlet counter = 0;\n// A stable hash implementation that supports:\n// - Fast and ensures unique hash properties\n// - Handles unserializable values\n// - Handles object key ordering\n// - Generates short results\n//\n// This is not a serialization function, and the result is not guaranteed to be\n// parsable.\nconst stableHash = (arg)=>{\n const type = typeof arg;\n const typeName = getTypeName(arg);\n const isDate = isObjectTypeName(typeName, 'Date');\n const isRegex = isObjectTypeName(typeName, 'RegExp');\n const isPlainObject = isObjectTypeName(typeName, 'Object');\n let result;\n let index;\n if (OBJECT(arg) === arg && !isDate && !isRegex) {\n // Object/function, not null/date/regexp. Use WeakMap to store the id first.\n // If it's already hashed, directly return the result.\n result = table.get(arg);\n if (result) return result;\n // Store the hash first for circular reference detection before entering the\n // recursive `stableHash` calls.\n // For other objects like set and map, we use this id directly as the hash.\n result = ++counter + '~';\n table.set(arg, result);\n if (Array.isArray(arg)) {\n // Array.\n result = '@';\n for(index = 0; index < arg.length; index++){\n result += stableHash(arg[index]) + ',';\n }\n table.set(arg, result);\n }\n if (isPlainObject) {\n // Object, sort keys.\n result = '#';\n const keys = OBJECT.keys(arg).sort();\n while(!isUndefined(index = keys.pop())){\n if (!isUndefined(arg[index])) {\n result += index + ':' + stableHash(arg[index]) + ',';\n }\n }\n table.set(arg, result);\n }\n } else {\n result = isDate ? arg.toJSON() : type == 'symbol' ? arg.toString() : type == 'string' ? JSON.stringify(arg) : '' + arg;\n }\n return result;\n};\n\nconst serialize = (key)=>{\n if (isFunction(key)) {\n try {\n key = key();\n } catch (err) {\n // dependencies not ready\n key = '';\n }\n }\n // Use the original key as the argument of fetcher. This can be a string or an\n // array of values.\n const args = key;\n // If key is not falsy, or not an empty array, hash it.\n key = typeof key == 'string' ? key : (Array.isArray(key) ? key.length : key) ? stableHash(key) : '';\n return [\n key,\n args\n ];\n};\n\nconst unstable_serialize = (key)=>serialize(key)[0];\n\n/// <reference types=\"react/experimental\" />\nconst use = React.use || // This extra generic is to avoid TypeScript mixing up the generic and JSX sytax\n// and emitting an error.\n// We assume that this is only for the `use(thenable)` case, not `use(context)`.\n// https://github.com/facebook/react/blob/aed00dacfb79d17c53218404c52b1c7aa59c4a89/packages/react-server/src/ReactFizzThenable.js#L45\n((thenable)=>{\n switch(thenable.status){\n case 'pending':\n throw thenable;\n case 'fulfilled':\n return thenable.value;\n case 'rejected':\n throw thenable.reason;\n default:\n thenable.status = 'pending';\n thenable.then((v)=>{\n thenable.status = 'fulfilled';\n thenable.value = v;\n }, (e)=>{\n thenable.status = 'rejected';\n thenable.reason = e;\n });\n throw thenable;\n }\n});\nconst WITH_DEDUPE = {\n dedupe: true\n};\nconst resolvedUndef = Promise.resolve(UNDEFINED$1);\nconst useSWRHandler = (_key, fetcher, config)=>{\n const { cache, compare, suspense, fallbackData, revalidateOnMount, revalidateIfStale, refreshInterval, refreshWhenHidden, refreshWhenOffline, keepPreviousData } = config;\n const [EVENT_REVALIDATORS, MUTATION, FETCH, PRELOAD] = SWRGlobalState.get(cache);\n // `key` is the identifier of the SWR internal state,\n // `fnArg` is the argument/arguments parsed from the key, which will be passed\n // to the fetcher.\n // All of them are derived from `_key`.\n const [key, fnArg] = serialize$1(_key);\n // If it's the initial render of this hook.\n const initialMountedRef = useRef(false);\n // If the hook is unmounted already. This will be used to prevent some effects\n // to be called after unmounting.\n const unmountedRef = useRef(false);\n // Refs to keep the key and config.\n const keyRef = useRef(key);\n const fetcherRef = useRef(fetcher);\n const configRef = useRef(config);\n const getConfig = ()=>configRef.current;\n const isActive = ()=>getConfig().isVisible() && getConfig().isOnline();\n const [getCache, setCache, subscribeCache, getInitialCache] = createCacheHelper(cache, key);\n const stateDependencies = useRef({}).current;\n // Resolve the fallback data from either the inline option, or the global provider.\n // If it's a promise, we simply let React suspend and resolve it for us.\n const fallback = isUndefined$1(fallbackData) ? isUndefined$1(config.fallback) ? UNDEFINED$1 : config.fallback[key] : fallbackData;\n const isEqual = (prev, current)=>{\n for(const _ in stateDependencies){\n const t = _;\n if (t === 'data') {\n if (!compare(prev[t], current[t])) {\n if (!isUndefined$1(prev[t])) {\n return false;\n }\n if (!compare(returnedData, current[t])) {\n return false;\n }\n }\n } else {\n if (current[t] !== prev[t]) {\n return false;\n }\n }\n }\n return true;\n };\n const getSnapshot = useMemo(()=>{\n const shouldStartRequest = (()=>{\n if (!key) return false;\n if (!fetcher) return false;\n // If `revalidateOnMount` is set, we take the value directly.\n if (!isUndefined$1(revalidateOnMount)) return revalidateOnMount;\n // If it's paused, we skip revalidation.\n if (getConfig().isPaused()) return false;\n if (suspense) return false;\n return revalidateIfStale !== false;\n })();\n // Get the cache and merge it with expected states.\n const getSelectedCache = (state)=>{\n // We only select the needed fields from the state.\n const snapshot = mergeObjects(state);\n delete snapshot._k;\n if (!shouldStartRequest) {\n return snapshot;\n }\n return {\n isValidating: true,\n isLoading: true,\n ...snapshot\n };\n };\n const cachedData = getCache();\n const initialData = getInitialCache();\n const clientSnapshot = getSelectedCache(cachedData);\n const serverSnapshot = cachedData === initialData ? clientSnapshot : getSelectedCache(initialData);\n // To make sure that we are returning the same object reference to avoid\n // unnecessary re-renders, we keep the previous snapshot and use deep\n // comparison to check if we need to return a new one.\n let memorizedSnapshot = clientSnapshot;\n return [\n ()=>{\n const newSnapshot = getSelectedCache(getCache());\n const compareResult = isEqual(newSnapshot, memorizedSnapshot);\n if (compareResult) {\n // Mentally, we should always return the `memorizedSnapshot` here\n // as there's no change between the new and old snapshots.\n // However, since the `isEqual` function only compares selected fields,\n // the values of the unselected fields might be changed. That's\n // simply because we didn't track them.\n // To support the case in https://github.com/vercel/swr/pull/2576,\n // we need to update these fields in the `memorizedSnapshot` too\n // with direct mutations to ensure the snapshot is always up-to-date\n // even for the unselected fields, but only trigger re-renders when\n // the selected fields are changed.\n memorizedSnapshot.data = newSnapshot.data;\n memorizedSnapshot.isLoading = newSnapshot.isLoading;\n memorizedSnapshot.isValidating = newSnapshot.isValidating;\n memorizedSnapshot.error = newSnapshot.error;\n return memorizedSnapshot;\n } else {\n memorizedSnapshot = newSnapshot;\n return newSnapshot;\n }\n },\n ()=>serverSnapshot\n ];\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [\n cache,\n key\n ]);\n // Get the current state that SWR should return.\n const cached = useSyncExternalStore(useCallback((callback)=>subscribeCache(key, (current, prev)=>{\n if (!isEqual(prev, current)) callback();\n }), // eslint-disable-next-line react-hooks/exhaustive-deps\n [\n cache,\n key\n ]), getSnapshot[0], getSnapshot[1]);\n const isInitialMount = !initialMountedRef.current;\n const hasRevalidator = EVENT_REVALIDATORS[key] && EVENT_REVALIDATORS[key].length > 0;\n const cachedData = cached.data;\n const data = isUndefined$1(cachedData) ? fallback && isPromiseLike(fallback) ? use(fallback) : fallback : cachedData;\n const error = cached.error;\n // Use a ref to store previously returned data. Use the initial data as its initial value.\n const laggyDataRef = useRef(data);\n const returnedData = keepPreviousData ? isUndefined$1(cachedData) ? isUndefined$1(laggyDataRef.current) ? data : laggyDataRef.current : cachedData : data;\n // - Suspense mode and there's stale data for the initial render.\n // - Not suspense mode and there is no fallback data and `revalidateIfStale` is enabled.\n // - `revalidateIfStale` is enabled but `data` is not defined.\n const shouldDoInitialRevalidation = (()=>{\n // if a key already has revalidators and also has error, we should not trigger revalidation\n if (hasRevalidator && !isUndefined$1(error)) return false;\n // If `revalidateOnMount` is set, we take the value directly.\n if (isInitialMount && !isUndefined$1(revalidateOnMount)) return revalidateOnMount;\n // If it's paused, we skip revalidation.\n if (getConfig().isPaused()) return false;\n // Under suspense mode, it will always fetch on render if there is no\n // stale data so no need to revalidate immediately mount it again.\n // If data exists, only revalidate if `revalidateIfStale` is true.\n if (suspense) return isUndefined$1(data) ? false : revalidateIfStale;\n // If there is no stale data, we need to revalidate when mount;\n // If `revalidateIfStale` is set to true, we will always revalidate.\n return isUndefined$1(data) || revalidateIfStale;\n })();\n // Resolve the default validating state:\n // If it's able to validate, and it should revalidate when mount, this will be true.\n const defaultValidatingState = !!(key && fetcher && isInitialMount && shouldDoInitialRevalidation);\n const isValidating = isUndefined$1(cached.isValidating) ? defaultValidatingState : cached.isValidating;\n const isLoading = isUndefined$1(cached.isLoading) ? defaultValidatingState : cached.isLoading;\n // The revalidation function is a carefully crafted wrapper of the original\n // `fetcher`, to correctly handle the many edge cases.\n const revalidate = useCallback(async (revalidateOpts)=>{\n const currentFetcher = fetcherRef.current;\n if (!key || !currentFetcher || unmountedRef.current || getConfig().isPaused()) {\n return false;\n }\n let newData;\n let startAt;\n let loading = true;\n const opts = revalidateOpts || {};\n // If there is no ongoing concurrent request, or `dedupe` is not set, a\n // new request should be initiated.\n const shouldStartNewRequest = !FETCH[key] || !opts.dedupe;\n /*\n For React 17\n Do unmount check for calls:\n If key has changed during the revalidation, or the component has been\n unmounted, old dispatch and old event callbacks should not take any\n effect\n\n For React 18\n only check if key has changed\n https://github.com/reactwg/react-18/discussions/82\n */ const callbackSafeguard = ()=>{\n if (IS_REACT_LEGACY) {\n return !unmountedRef.current && key === keyRef.current && initialMountedRef.current;\n }\n return key === keyRef.current;\n };\n // The final state object when the request finishes.\n const finalState = {\n isValidating: false,\n isLoading: false\n };\n const finishRequestAndUpdateState = ()=>{\n setCache(finalState);\n };\n const cleanupState = ()=>{\n // Check if it's still the same request before deleting it.\n const requestInfo = FETCH[key];\n if (requestInfo && requestInfo[1] === startAt) {\n delete FETCH[key];\n }\n };\n // Start fetching. Change the `isValidating` state, update the cache.\n const initialState = {\n isValidating: true\n };\n // It is in the `isLoading` state, if and only if there is no cached data.\n // This bypasses fallback data and laggy data.\n if (isUndefined$1(getCache().data)) {\n initialState.isLoading = true;\n }\n try {\n if (shouldStartNewRequest) {\n setCache(initialState);\n // If no cache is being rendered currently (it shows a blank page),\n // we trigger the loading slow event.\n if (config.loadingTimeout && isUndefined$1(getCache().data)) {\n setTimeout(()=>{\n if (loading && callbackSafeguard()) {\n getConfig().onLoadingSlow(key, config);\n }\n }, config.loadingTimeout);\n }\n // Start the request and save the timestamp.\n // Key must be truthy if entering here.\n FETCH[key] = [\n currentFetcher(fnArg),\n getTimestamp()\n ];\n }\n // Wait until the ongoing request is done. Deduplication is also\n // considered here.\n ;\n [newData, startAt] = FETCH[key];\n newData = await newData;\n if (shouldStartNewRequest) {\n // If the request isn't interrupted, clean it up after the\n // deduplication interval.\n setTimeout(cleanupState, config.dedupingInterval);\n }\n // If there're other ongoing request(s), started after the current one,\n // we need to ignore the current one to avoid possible race conditions:\n // req1------------------>res1 (current one)\n // req2---------------->res2\n // the request that fired later will always be kept.\n // The timestamp maybe be `undefined` or a number\n if (!FETCH[key] || FETCH[key][1] !== startAt) {\n if (shouldStartNewRequest) {\n if (callbackSafeguard()) {\n getConfig().onDiscarded(key);\n }\n }\n return false;\n }\n // Clear error.\n finalState.error = UNDEFINED$1;\n // If there're other mutations(s), that overlapped with the current revalidation:\n // case 1:\n // req------------------>res\n // mutate------>end\n // case 2:\n // req------------>res\n // mutate------>end\n // case 3:\n // req------------------>res\n // mutate-------...---------->\n // we have to ignore the revalidation result (res) because it's no longer fresh.\n // meanwhile, a new revalidation should be triggered when the mutation ends.\n const mutationInfo = MUTATION[key];\n if (!isUndefined$1(mutationInfo) && // case 1\n (startAt <= mutationInfo[0] || // case 2\n startAt <= mutationInfo[1] || // case 3\n mutationInfo[1] === 0)) {\n finishRequestAndUpdateState();\n if (shouldStartNewRequest) {\n if (callbackSafeguard()) {\n getConfig().onDiscarded(key);\n }\n }\n return false;\n }\n // Deep compare with the latest state to avoid extra re-renders.\n // For local state, compare and assign.\n const cacheData = getCache().data;\n // Since the compare fn could be custom fn\n // cacheData might be different from newData even when compare fn returns True\n finalState.data = compare(cacheData, newData) ? cacheData : newData;\n // Trigger the successful callback if it's the original request.\n if (shouldStartNewRequest) {\n if (callbackSafeguard()) {\n getConfig().onSuccess(newData, key, config);\n }\n }\n } catch (err) {\n cleanupState();\n const currentConfig = getConfig();\n const { shouldRetryOnError } = currentConfig;\n // Not paused, we continue handling the error. Otherwise, discard it.\n if (!currentConfig.isPaused()) {\n // Get a new error, don't use deep comparison for errors.\n finalState.error = err;\n // Error event and retry logic. Only for the actual request, not\n // deduped ones.\n if (shouldStartNewRequest && callbackSafeguard()) {\n currentConfig.onError(err, key, currentConfig);\n if (shouldRetryOnError === true || isFunction$1(shouldRetryOnError) && shouldRetryOnError(err)) {\n if (!getConfig().revalidateOnFocus || !getConfig().revalidateOnReconnect || isActive()) {\n // If it's inactive, stop. It will auto-revalidate when\n // refocusing or reconnecting.\n // When retrying, deduplication is always enabled.\n currentConfig.onErrorRetry(err, key, currentConfig, (_opts)=>{\n const revalidators = EVENT_REVALIDATORS[key];\n if (revalidators && revalidators[0]) {\n revalidators[0](revalidateEvents.ERROR_REVALIDATE_EVENT, _opts);\n }\n }, {\n retryCount: (opts.retryCount || 0) + 1,\n dedupe: true\n });\n }\n }\n }\n }\n }\n // Mark loading as stopped.\n loading = false;\n // Update the current hook's state.\n finishRequestAndUpdateState();\n return true;\n }, // `setState` is immutable, and `eventsCallback`, `fnArg`, and\n // `keyValidating` are depending on `key`, so we can exclude them from\n // the deps array.\n //\n // FIXME:\n // `fn` and `config` might be changed during the lifecycle,\n // but they might be changed every render like this.\n // `useSWR('key', () => fetch('/api/'), { suspense: true })`\n // So we omit the values from the deps array\n // even though it might cause unexpected behaviors.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [\n key,\n cache\n ]);\n // Similar to the global mutate but bound to the current cache and key.\n // `cache` isn't allowed to change during the lifecycle.\n const boundMutate = useCallback(// Use callback to make sure `keyRef.current` returns latest result every time\n (...args)=>{\n return internalMutate(cache, keyRef.current, ...args);\n }, // eslint-disable-next-line react-hooks/exhaustive-deps\n []);\n // The logic for updating refs.\n useIsomorphicLayoutEffect(()=>{\n fetcherRef.current = fetcher;\n configRef.current = config;\n // Handle laggy data updates. If there's cached data of the current key,\n // it'll be the correct reference.\n if (!isUndefined$1(cachedData)) {\n laggyDataRef.current = cachedData;\n }\n });\n // After mounted or key changed.\n useIsomorphicLayoutEffect(()=>{\n if (!key) return;\n const softRevalidate = revalidate.bind(UNDEFINED$1, WITH_DEDUPE);\n let nextFocusRevalidatedAt = 0;\n if (getConfig().revalidateOnFocus) {\n const initNow = Date.now();\n nextFocusRevalidatedAt = initNow + getConfig().focusThrottleInterval;\n }\n // Expose revalidators to global event listeners. So we can trigger\n // revalidation from the outside.\n const onRevalidate = (type, opts = {})=>{\n if (type == revalidateEvents.FOCUS_EVENT) {\n const now = Date.now();\n if (getConfig().revalidateOnFocus && now > nextFocusRevalidatedAt && isActive()) {\n nextFocusRevalidatedAt = now + getConfig().focusThrottleInterval;\n softRevalidate();\n }\n } else if (type == revalidateEvents.RECONNECT_EVENT) {\n if (getConfig().revalidateOnReconnect && isActive()) {\n softRevalidate();\n }\n } else if (type == revalidateEvents.MUTATE_EVENT) {\n return revalidate();\n } else if (type == revalidateEvents.ERROR_REVALIDATE_EVENT) {\n return revalidate(opts);\n }\n return;\n };\n const unsubEvents = subscribeCallback(key, EVENT_REVALIDATORS, onRevalidate);\n // Mark the component as mounted and update corresponding refs.\n unmountedRef.current = false;\n keyRef.current = key;\n initialMountedRef.current = true;\n // Keep the original key in the cache.\n setCache({\n _k: fnArg\n });\n // Trigger a revalidation\n if (shouldDoInitialRevalidation) {\n // Performance optimization: if a request is already in progress for this key,\n // skip the revalidation to avoid redundant work\n if (!FETCH[key]) {\n if (isUndefined$1(data) || IS_SERVER) {\n // Revalidate immediately.\n softRevalidate();\n } else {\n // Delay the revalidate if we have data to return so we won't block\n // rendering.\n rAF(softRevalidate);\n }\n }\n }\n return ()=>{\n // Mark it as unmounted.\n unmountedRef.current = true;\n unsubEvents();\n };\n }, [\n key\n ]);\n // Polling\n useIsomorphicLayoutEffect(()=>{\n let timer;\n function next() {\n // Use the passed interval\n // ...or invoke the function with the updated data to get the interval\n const interval = isFunction$1(refreshInterval) ? refreshInterval(getCache().data) : refreshInterval;\n // We only start the next interval if `refreshInterval` is not 0, and:\n // - `force` is true, which is the start of polling\n // - or `timer` is not 0, which means the effect wasn't canceled\n if (interval && timer !== -1) {\n timer = setTimeout(execute, interval);\n }\n }\n function execute() {\n // Check if it's OK to execute:\n // Only revalidate when the page is visible, online, and not errored.\n if (!getCache().error && (refreshWhenHidden || getConfig().isVisible()) && (refreshWhenOffline || getConfig().isOnline())) {\n revalidate(WITH_DEDUPE).then(next);\n } else {\n // Schedule the next interval to check again.\n next();\n }\n }\n next();\n return ()=>{\n if (timer) {\n clearTimeout(timer);\n timer = -1;\n }\n };\n }, [\n refreshInterval,\n refreshWhenHidden,\n refreshWhenOffline,\n key\n ]);\n // Display debug info in React DevTools.\n useDebugValue(returnedData);\n // In Suspense mode, we can't return the empty `data` state.\n // If there is an `error`, the `error` needs to be thrown to the error boundary.\n // If there is no `error`, the `revalidation` promise needs to be thrown to\n // the suspense boundary.\n if (suspense) {\n const hasKeyButNoData = key && isUndefined$1(data);\n // SWR should throw when trying to use Suspense on the server with React 18,\n // without providing any fallback data. This causes hydration errors. See:\n // https://github.com/vercel/swr/issues/1832\n if (!IS_REACT_LEGACY && IS_SERVER && hasKeyButNoData) {\n throw new Error('Fallback data is required when using Suspense in SSR.');\n }\n // Always update fetcher and config refs even with the Suspense mode.\n if (hasKeyButNoData) {\n fetcherRef.current = fetcher;\n configRef.current = config;\n unmountedRef.current = false;\n }\n const req = PRELOAD[key];\n const mutateReq = !isUndefined$1(req) && hasKeyButNoData ? boundMutate(req) : resolvedUndef;\n use(mutateReq);\n if (!isUndefined$1(error) && hasKeyButNoData) {\n throw error;\n }\n const revalidation = hasKeyButNoData ? revalidate(WITH_DEDUPE) : resolvedUndef;\n if (!isUndefined$1(returnedData) && hasKeyButNoData) {\n // @ts-ignore modify react promise status\n revalidation.status = 'fulfilled';\n // @ts-ignore modify react promise value\n revalidation.value = true;\n }\n use(revalidation);\n }\n const swrResponse = {\n mutate: boundMutate,\n get data () {\n stateDependencies.data = true;\n return returnedData;\n },\n get error () {\n stateDependencies.error = true;\n return error;\n },\n get isValidating () {\n stateDependencies.isValidating = true;\n return isValidating;\n },\n get isLoading () {\n stateDependencies.isLoading = true;\n return isLoading;\n }\n };\n return swrResponse;\n};\nconst SWRConfig = OBJECT$1.defineProperty(SWRConfig$1, 'defaultValue', {\n value: defaultConfig\n});\n/**\n * A hook to fetch data.\n *\n * @link https://swr.vercel.app\n * @example\n * ```jsx\n * import useSWR from 'swr'\n * function Profile() {\n * const { data, error, isLoading } = useSWR('/api/user', fetcher)\n * if (error) return <div>failed to load</div>\n * if (isLoading) return <div>loading...</div>\n * return <div>hello {data.name}!</div>\n * }\n * ```\n */ const useSWR = withArgs(useSWRHandler);\n\n// useSWR\n\nexport { SWRConfig, useSWR as default, unstable_serialize };\n","const FOCUS_EVENT = 0;\nconst RECONNECT_EVENT = 1;\nconst MUTATE_EVENT = 2;\nconst ERROR_REVALIDATE_EVENT = 3;\n\nexport { ERROR_REVALIDATE_EVENT, FOCUS_EVENT, MUTATE_EVENT, RECONNECT_EVENT };\n","var has = Object.prototype.hasOwnProperty;\n\nexport function dequal(foo, bar) {\n\tvar ctor, len;\n\tif (foo === bar) return true;\n\n\tif (foo && bar && (ctor=foo.constructor) === bar.constructor) {\n\t\tif (ctor === Date) return foo.getTime() === bar.getTime();\n\t\tif (ctor === RegExp) return foo.toString() === bar.toString();\n\n\t\tif (ctor === Array) {\n\t\t\tif ((len=foo.length) === bar.length) {\n\t\t\t\twhile (len-- && dequal(foo[len], bar[len]));\n\t\t\t}\n\t\t\treturn len === -1;\n\t\t}\n\n\t\tif (!ctor || typeof foo === 'object') {\n\t\t\tlen = 0;\n\t\t\tfor (ctor in foo) {\n\t\t\t\tif (has.call(foo, ctor) && ++len && !has.call(bar, ctor)) return false;\n\t\t\t\tif (!(ctor in bar) || !dequal(foo[ctor], bar[ctor])) return false;\n\t\t\t}\n\t\t\treturn Object.keys(bar).length === len;\n\t\t}\n\t}\n\n\treturn foo !== foo && bar !== bar;\n}\n","'use client';\nimport React, { useEffect, useLayoutEffect, createContext, useContext, useMemo, useRef, createElement } from 'react';\nimport * as revalidateEvents from './events.mjs';\nimport { dequal } from 'dequal/lite';\n\n// Global state used to deduplicate requests and store listeners\nconst SWRGlobalState = new WeakMap();\n\n// Shared state between server components and client components\nconst noop = ()=>{};\n// Using noop() as the undefined value as undefined can be replaced\n// by something else. Prettier ignore and extra parentheses are necessary here\n// to ensure that tsc doesn't remove the __NOINLINE__ comment.\n// prettier-ignore\nconst UNDEFINED = /*#__NOINLINE__*/ noop();\nconst OBJECT = Object;\nconst isUndefined = (v)=>v === UNDEFINED;\nconst isFunction = (v)=>typeof v == 'function';\nconst mergeObjects = (a, b)=>({\n ...a,\n ...b\n });\nconst isPromiseLike = (x)=>isFunction(x.then);\n\nconst EMPTY_CACHE = {};\nconst INITIAL_CACHE = {};\nconst STR_UNDEFINED = 'undefined';\n// NOTE: Use the function to guarantee it's re-evaluated between jsdom and node runtime for tests.\nconst isWindowDefined = typeof window != STR_UNDEFINED;\nconst isDocumentDefined = typeof document != STR_UNDEFINED;\nconst isLegacyDeno = isWindowDefined && 'Deno' in window;\nconst hasRequestAnimationFrame = ()=>isWindowDefined && typeof window['requestAnimationFrame'] != STR_UNDEFINED;\nconst createCacheHelper = (cache, key)=>{\n const state = SWRGlobalState.get(cache);\n return [\n // Getter\n ()=>!isUndefined(key) && cache.get(key) || EMPTY_CACHE,\n // Setter\n (info)=>{\n if (!isUndefined(key)) {\n const prev = cache.get(key);\n // Before writing to the store, we keep the value in the initial cache\n // if it's not there yet.\n if (!(key in INITIAL_CACHE)) {\n INITIAL_CACHE[key] = prev;\n }\n state[5](key, mergeObjects(prev, info), prev || EMPTY_CACHE);\n }\n },\n // Subscriber\n state[6],\n // Get server cache snapshot\n ()=>{\n if (!isUndefined(key)) {\n // If the cache was updated on the client, we return the stored initial value.\n if (key in INITIAL_CACHE) return INITIAL_CACHE[key];\n }\n // If we haven't done any client-side updates, we return the current value.\n return !isUndefined(key) && cache.get(key) || EMPTY_CACHE;\n }\n ];\n} // export { UNDEFINED, OBJECT, isUndefined, isFunction, mergeObjects, isPromiseLike }\n;\n\n/**\n * Due to the bug https://bugs.chromium.org/p/chromium/issues/detail?id=678075,\n * it's not reliable to detect if the browser is currently online or offline\n * based on `navigator.onLine`.\n * As a workaround, we always assume it's online on the first load, and change\n * the status upon `online` or `offline` events.\n */ let online = true;\nconst isOnline = ()=>online;\n// For node and React Native, `add/removeEventListener` doesn't exist on window.\nconst [onWindowEvent, offWindowEvent] = isWindowDefined && window.addEventListener ? [\n window.addEventListener.bind(window),\n window.removeEventListener.bind(window)\n] : [\n noop,\n noop\n];\nconst isVisible = ()=>{\n const visibilityState = isDocumentDefined && document.visibilityState;\n return isUndefined(visibilityState) || visibilityState !== 'hidden';\n};\nconst initFocus = (callback)=>{\n // focus revalidate\n if (isDocumentDefined) {\n document.addEventListener('visibilitychange', callback);\n }\n onWindowEvent('focus', callback);\n return ()=>{\n if (isDocumentDefined) {\n document.removeEventListener('visibilitychange', callback);\n }\n offWindowEvent('focus', callback);\n };\n};\nconst initReconnect = (callback)=>{\n // revalidate on reconnected\n const onOnline = ()=>{\n online = true;\n callback();\n };\n // nothing to revalidate, just update the status\n const onOffline = ()=>{\n online = false;\n };\n onWindowEvent('online', onOnline);\n onWindowEvent('offline', onOffline);\n return ()=>{\n offWindowEvent('online', onOnline);\n offWindowEvent('offline', onOffline);\n };\n};\nconst preset = {\n isOnline,\n isVisible\n};\nconst defaultConfigOptions = {\n initFocus,\n initReconnect\n};\n\nconst IS_REACT_LEGACY = !React.useId;\nconst IS_SERVER = !isWindowDefined || isLegacyDeno;\n// Polyfill requestAnimationFrame\nconst rAF = (f)=>hasRequestAnimationFrame() ? window['requestAnimationFrame'](f) : setTimeout(f, 1);\n// React currently throws a warning when using useLayoutEffect on the server.\n// To get around it, we can conditionally useEffect on the server (no-op) and\n// useLayoutEffect in the browser.\nconst useIsomorphicLayoutEffect = IS_SERVER ? useEffect : useLayoutEffect;\n// This assignment is to extend the Navigator type to use effectiveType.\nconst navigatorConnection = typeof navigator !== 'undefined' && navigator.connection;\n// Adjust the config based on slow connection status (<= 70Kbps).\nconst slowConnection = !IS_SERVER && navigatorConnection && ([\n 'slow-2g',\n '2g'\n].includes(navigatorConnection.effectiveType) || navigatorConnection.saveData);\n\n// use WeakMap to store the object->key mapping\n// so the objects can be garbage collected.\n// WeakMap uses a hashtable under the hood, so the lookup\n// complexity is almost O(1).\nconst table = new WeakMap();\nconst getTypeName = (value)=>OBJECT.prototype.toString.call(value);\nconst isObjectTypeName = (typeName, type)=>typeName === `[object ${type}]`;\n// counter of the key\nlet counter = 0;\n// A stable hash implementation that supports:\n// - Fast and ensures unique hash properties\n// - Handles unserializable values\n// - Handles object key ordering\n// - Generates short results\n//\n// This is not a serialization function, and the result is not guaranteed to be\n// parsable.\nconst stableHash = (arg)=>{\n const type = typeof arg;\n const typeName = getTypeName(arg);\n const isDate = isObjectTypeName(typeName, 'Date');\n const isRegex = isObjectTypeName(typeName, 'RegExp');\n const isPlainObject = isObjectTypeName(typeName, 'Object');\n let result;\n let index;\n if (OBJECT(arg) === arg && !isDate && !isRegex) {\n // Object/function, not null/date/regexp. Use WeakMap to store the id first.\n // If it's already hashed, directly return the result.\n result = table.get(arg);\n if (result) return result;\n // Store the hash first for circular reference detection before entering the\n // recursive `stableHash` calls.\n // For other objects like set and map, we use this id directly as the hash.\n result = ++counter + '~';\n table.set(arg, result);\n if (Array.isArray(arg)) {\n // Array.\n result = '@';\n for(index = 0; index < arg.length; index++){\n result += stableHash(arg[index]) + ',';\n }\n table.set(arg, result);\n }\n if (isPlainObject) {\n // Object, sort keys.\n result = '#';\n const keys = OBJECT.keys(arg).sort();\n while(!isUndefined(index = keys.pop())){\n if (!isUndefined(arg[index])) {\n result += index + ':' + stableHash(arg[index]) + ',';\n }\n }\n table.set(arg, result);\n }\n } else {\n result = isDate ? arg.toJSON() : type == 'symbol' ? arg.toString() : type == 'string' ? JSON.stringify(arg) : '' + arg;\n }\n return result;\n};\n\nconst serialize = (key)=>{\n if (isFunction(key)) {\n try {\n key = key();\n } catch (err) {\n // dependencies not ready\n key = '';\n }\n }\n // Use the original key as the argument of fetcher. This can be a string or an\n // array of values.\n const args = key;\n // If key is not falsy, or not an empty array, hash it.\n key = typeof key == 'string' ? key : (Array.isArray(key) ? key.length : key) ? stableHash(key) : '';\n return [\n key,\n args\n ];\n};\n\n// Global timestamp.\nlet __timestamp = 0;\nconst getTimestamp = ()=>++__timestamp;\n\nasync function internalMutate(...args) {\n const [cache, _key, _data, _opts] = args;\n // When passing as a boolean, it's explicitly used to disable/enable\n // revalidation.\n const options = mergeObjects({\n populateCache: true,\n throwOnError: true\n }, typeof _opts === 'boolean' ? {\n revalidate: _opts\n } : _opts || {});\n let populateCache = options.populateCache;\n const rollbackOnErrorOption = options.rollbackOnError;\n let optimisticData = options.optimisticData;\n const rollbackOnError = (error)=>{\n return typeof rollbackOnErrorOption === 'function' ? rollbackOnErrorOption(error) : rollbackOnErrorOption !== false;\n };\n const throwOnError = options.throwOnError;\n // If the second argument is a key filter, return the mutation results for all\n // filtered keys.\n if (isFunction(_key)) {\n const keyFilter = _key;\n const matchedKeys = [];\n const it = cache.keys();\n for (const key of it){\n if (// Skip the special useSWRInfinite and useSWRSubscription keys.\n !/^\\$(inf|sub)\\$/.test(key) && keyFilter(cache.get(key)._k)) {\n matchedKeys.push(key);\n }\n }\n return Promise.all(matchedKeys.map(mutateByKey));\n }\n return mutateByKey(_key);\n async function mutateByKey(_k) {\n // Serialize key\n const [key] = serialize(_k);\n if (!key) return;\n const [get, set] = createCacheHelper(cache, key);\n const [EVENT_REVALIDATORS, MUTATION, FETCH, PRELOAD] = SWRGlobalState.get(cache);\n const startRevalidate = ()=>{\n const revalidators = EVENT_REVALIDATORS[key];\n const revalidate = isFunction(options.revalidate) ? options.revalidate(get().data, _k) : options.revalidate !== false;\n if (revalidate) {\n // Invalidate the key by deleting the concurrent request markers so new\n // requests will not be deduped.\n delete FETCH[key];\n delete PRELOAD[key];\n if (revalidators && revalidators[0]) {\n return revalidators[0](revalidateEvents.MUTATE_EVENT).then(()=>get().data);\n }\n }\n return get().data;\n };\n // If there is no new data provided, revalidate the key with current state.\n if (args.length < 3) {\n // Revalidate and broadcast state.\n return startRevalidate();\n }\n let data = _data;\n let error;\n let isError = false;\n // Update global timestamps.\n const beforeMutationTs = getTimestamp();\n MUTATION[key] = [\n beforeMutationTs,\n 0\n ];\n const hasOptimisticData = !isUndefined(optimisticData);\n const state = get();\n // `displayedData` is the current value on screen. It could be the optimistic value\n // that is going to be overridden by a `committedData`, or get reverted back.\n // `committedData` is the validated value that comes from a fetch or mutation.\n const displayedData = state.data;\n const currentData = state._c;\n const committedData = isUndefined(currentData) ? displayedData : currentData;\n // Do optimistic data update.\n if (hasOptimisticData) {\n optimisticData = isFunction(optimisticData) ? optimisticData(committedData, displayedData) : optimisticData;\n // When we set optimistic data, backup the current committedData data in `_c`.\n set({\n data: optimisticData,\n _c: committedData\n });\n }\n if (isFunction(data)) {\n // `data` is a function, call it passing current cache value.\n try {\n data = data(committedData);\n } catch (err) {\n // If it throws an error synchronously, we shouldn't update the cache.\n error = err;\n isError = true;\n }\n }\n // `data` is a promise/thenable, resolve the final data first.\n if (data && isPromiseLike(data)) {\n // This means that the mutation is async, we need to check timestamps to\n // avoid race conditions.\n data = await data.catch((err)=>{\n error = err;\n isError = true;\n });\n // Check if other mutations have occurred since we've started this mutation.\n // If there's a race we don't update cache or broadcast the change,\n // just return the data.\n if (beforeMutationTs !== MUTATION[key][0]) {\n if (isError) throw error;\n return data;\n } else if (isError && hasOptimisticData && rollbackOnError(error)) {\n // Rollback. Always populate the cache in this case but without\n // transforming the data.\n populateCache = true;\n // Reset data to be the latest committed data, and clear the `_c` value.\n set({\n data: committedData,\n _c: UNDEFINED\n });\n }\n }\n // If we should write back the cache after request.\n if (populateCache) {\n if (!isError) {\n // Transform the result into data.\n if (isFunction(populateCache)) {\n const populateCachedData = populateCache(data, committedData);\n set({\n data: populateCachedData,\n error: UNDEFINED,\n _c: UNDEFINED\n });\n } else {\n // Only update cached data and reset the error if there's no error. Data can be `undefined` here.\n set({\n data,\n error: UNDEFINED,\n _c: UNDEFINED\n });\n }\n }\n }\n // Reset the timestamp to mark the mutation has ended.\n MUTATION[key][1] = getTimestamp();\n // Update existing SWR Hooks' internal states:\n Promise.resolve(startRevalidate()).then(()=>{\n // The mutation and revalidation are ended, we can clear it since the data is\n // not an optimistic value anymore.\n set({\n _c: UNDEFINED\n });\n });\n // Throw error or return data\n if (isError) {\n if (throwOnError) throw error;\n return;\n }\n return data;\n }\n}\n\nconst revalidateAllKeys = (revalidators, type)=>{\n for(const key in revalidators){\n if (revalidators[key][0]) revalidators[key][0](type);\n }\n};\nconst initCache = (provider, options)=>{\n // The global state for a specific provider will be used to deduplicate\n // requests and store listeners. As well as a mutate function that is bound to\n // the cache.\n // The provider's global state might be already initialized. Let's try to get the\n // global state associated with the provider first.\n if (!SWRGlobalState.has(provider)) {\n const opts = mergeObjects(defaultConfigOptions, options);\n // If there's no global state bound to the provider, create a new one with the\n // new mutate function.\n const EVENT_REVALIDATORS = Object.create(null);\n const mutate = internalMutate.bind(UNDEFINED, provider);\n let unmount = noop;\n const subscriptions = Object.create(null);\n const subscribe = (key, callback)=>{\n const subs = subscriptions[key] || [];\n subscriptions[key] = subs;\n subs.push(callback);\n return ()=>subs.splice(subs.indexOf(callback), 1);\n };\n const setter = (key, value, prev)=>{\n provider.set(key, value);\n const subs = subscriptions[key];\n if (subs) {\n for (const fn of subs){\n fn(value, prev);\n }\n }\n };\n const initProvider = ()=>{\n if (!SWRGlobalState.has(provider)) {\n // Update the state if it's new, or if the provider has been extended.\n SWRGlobalState.set(provider, [\n EVENT_REVALIDATORS,\n Object.create(null),\n Object.create(null),\n Object.create(null),\n mutate,\n setter,\n subscribe\n ]);\n if (!IS_SERVER) {\n // When listening to the native events for auto revalidations,\n // we intentionally put a delay (setTimeout) here to make sure they are\n // fired after immediate JavaScript executions, which can be\n // React's state updates.\n // This avoids some unnecessary revalidations such as\n // https://github.com/vercel/swr/issues/1680.\n const releaseFocus = opts.initFocus(setTimeout.bind(UNDEFINED, revalidateAllKeys.bind(UNDEFINED, EVENT_REVALIDATORS, revalidateEvents.FOCUS_EVENT)));\n const releaseReconnect = opts.initReconnect(setTimeout.bind(UNDEFINED, revalidateAllKeys.bind(UNDEFINED, EVENT_REVALIDATORS, revalidateEvents.RECONNECT_EVENT)));\n unmount = ()=>{\n releaseFocus && releaseFocus();\n releaseReconnect && releaseReconnect();\n // When un-mounting, we need to remove the cache provider from the state\n // storage too because it's a side-effect. Otherwise, when re-mounting we\n // will not re-register those event listeners.\n SWRGlobalState.delete(provider);\n };\n }\n }\n };\n initProvider();\n // This is a new provider, we need to initialize it and setup DOM events\n // listeners for `focus` and `reconnect` actions.\n // We might want to inject an extra layer on top of `provider` in the future,\n // such as key serialization, auto GC, etc.\n // For now, it's just a `Map` interface without any modifications.\n return [\n provider,\n mutate,\n initProvider,\n unmount\n ];\n }\n return [\n provider,\n SWRGlobalState.get(provider)[4]\n ];\n};\n\n// error retry\nconst onErrorRetry = (_, __, config, revalidate, opts)=>{\n const maxRetryCount = config.errorRetryCount;\n const currentRetryCount = opts.retryCount;\n // Exponential backoff\n const timeout = ~~((Math.random() + 0.5) * (1 << (currentRetryCount < 8 ? currentRetryCount : 8))) * config.errorRetryInterval;\n if (!isUndefined(maxRetryCount) && currentRetryCount > maxRetryCount) {\n return;\n }\n setTimeout(revalidate, timeout, opts);\n};\nconst compare = dequal;\n// Default cache provider\nconst [cache, mutate] = initCache(new Map());\n// Default config\nconst defaultConfig = mergeObjects({\n // events\n onLoadingSlow: noop,\n onSuccess: noop,\n onError: noop,\n onErrorRetry,\n onDiscarded: noop,\n // switches\n revalidateOnFocus: true,\n revalidateOnReconnect: true,\n revalidateIfStale: true,\n shouldRetryOnError: true,\n // timeouts\n errorRetryInterval: slowConnection ? 10000 : 5000,\n focusThrottleInterval: 5 * 1000,\n dedupingInterval: 2 * 1000,\n loadingTimeout: slowConnection ? 5000 : 3000,\n // providers\n compare,\n isPaused: ()=>false,\n cache,\n mutate,\n fallback: {}\n}, // use web preset by default\npreset);\n\nconst mergeConfigs = (a, b)=>{\n // Need to create a new object to avoid mutating the original here.\n const v = mergeObjects(a, b);\n // If two configs are provided, merge their `use` and `fallback` options.\n if (b) {\n const { use: u1, fallback: f1 } = a;\n const { use: u2, fallback: f2 } = b;\n if (u1 && u2) {\n v.use = u1.concat(u2);\n }\n if (f1 && f2) {\n v.fallback = mergeObjects(f1, f2);\n }\n }\n return v;\n};\n\nconst SWRConfigContext = createContext({});\nconst SWRConfig = (props)=>{\n const { value } = props;\n const parentConfig = useContext(SWRConfigContext);\n const isFunctionalConfig = isFunction(value);\n const config = useMemo(()=>isFunctionalConfig ? value(parentConfig) : value, [\n isFunctionalConfig,\n parentConfig,\n value\n ]);\n // Extend parent context values and middleware.\n const extendedConfig = useMemo(()=>isFunctionalConfig ? config : mergeConfigs(parentConfig, config), [\n isFunctionalConfig,\n parentConfig,\n config\n ]);\n // Should not use the inherited provider.\n const provider = config && config.provider;\n // initialize the cache only on first access.\n const cacheContextRef = useRef(UNDEFINED);\n if (provider && !cacheContextRef.current) {\n cacheContextRef.current = initCache(provider(extendedConfig.cache || cache), config);\n }\n const cacheContext = cacheContextRef.current;\n // Override the cache if a new provider is given.\n if (cacheContext) {\n extendedConfig.cache = cacheContext[0];\n extendedConfig.mutate = cacheContext[1];\n }\n // Unsubscribe events.\n useIsomorphicLayoutEffect(()=>{\n if (cacheContext) {\n cacheContext[2] && cacheContext[2]();\n return cacheContext[3];\n }\n }, []);\n return createElement(SWRConfigContext.Provider, mergeObjects(props, {\n value: extendedConfig\n }));\n};\n\nexport { noop as A, isPromiseLike as B, IS_REACT_LEGACY as I, OBJECT as O, SWRConfigContext as S, UNDEFINED as U, isFunction as a, SWRGlobalState as b, cache as c, defaultConfig as d, isUndefined as e, mergeConfigs as f, SWRConfig as g, initCache as h, isWindowDefined as i, mutate as j, compare as k, stableHash as l, mergeObjects as m, internalMutate as n, getTimestamp as o, preset as p, defaultConfigOptions as q, IS_SERVER as r, serialize as s, rAF as t, useIsomorphicLayoutEffect as u, slowConnection as v, isDocumentDefined as w, isLegacyDeno as x, hasRequestAnimationFrame as y, createCacheHelper as z };\n","import { i as isWindowDefined, a as isFunction, S as SWRConfigContext, m as mergeObjects, d as defaultConfig, s as serialize, b as SWRGlobalState, c as cache, e as isUndefined, f as mergeConfigs } from './config-context-client-BoS53ST9.mjs';\nexport { I as IS_REACT_LEGACY, r as IS_SERVER, O as OBJECT, g as SWRConfig, U as UNDEFINED, k as compare, z as createCacheHelper, q as defaultConfigOptions, o as getTimestamp, y as hasRequestAnimationFrame, h as initCache, n as internalMutate, w as isDocumentDefined, x as isLegacyDeno, B as isPromiseLike, j as mutate, A as noop, p as preset, t as rAF, v as slowConnection, l as stableHash, u as useIsomorphicLayoutEffect } from './config-context-client-BoS53ST9.mjs';\nimport * as revalidateEvents from './events.mjs';\nexport { revalidateEvents };\nimport { INFINITE_PREFIX } from './constants.mjs';\nexport { INFINITE_PREFIX } from './constants.mjs';\nimport React, { useContext, useMemo } from 'react';\nexport * from './types.mjs';\n\n// @ts-expect-error\nconst enableDevtools = isWindowDefined && window.__SWR_DEVTOOLS_USE__;\nconst use = enableDevtools ? window.__SWR_DEVTOOLS_USE__ : [];\nconst setupDevTools = ()=>{\n if (enableDevtools) {\n // @ts-expect-error\n window.__SWR_DEVTOOLS_REACT__ = React;\n }\n};\n\nconst normalize = (args)=>{\n return isFunction(args[1]) ? [\n args[0],\n args[1],\n args[2] || {}\n ] : [\n args[0],\n null,\n (args[1] === null ? args[2] : args[1]) || {}\n ];\n};\n\nconst useSWRConfig = ()=>{\n const parentConfig = useContext(SWRConfigContext);\n const mergedConfig = useMemo(()=>mergeObjects(defaultConfig, parentConfig), [\n parentConfig\n ]);\n return mergedConfig;\n};\n\nconst preload = (key_, fetcher)=>{\n const [key, fnArg] = serialize(key_);\n const [, , , PRELOAD] = SWRGlobalState.get(cache);\n // Prevent preload to be called multiple times before used.\n if (PRELOAD[key]) return PRELOAD[key];\n const req = fetcher(fnArg);\n PRELOAD[key] = req;\n return req;\n};\nconst middleware = (useSWRNext)=>(key_, fetcher_, config)=>{\n // fetcher might be a sync function, so this should not be an async function\n const fetcher = fetcher_ && ((...args)=>{\n const [key] = serialize(key_);\n const [, , , PRELOAD] = SWRGlobalState.get(cache);\n if (key.startsWith(INFINITE_PREFIX)) {\n // we want the infinite fetcher to be called.\n // handling of the PRELOAD cache happens there.\n return fetcher_(...args);\n }\n const req = PRELOAD[key];\n if (isUndefined(req)) return fetcher_(...args);\n delete PRELOAD[key];\n return req;\n });\n return useSWRNext(key_, fetcher, config);\n };\n\nconst BUILT_IN_MIDDLEWARE = use.concat(middleware);\n\n// It's tricky to pass generic types as parameters, so we just directly override\n// the types here.\nconst withArgs = (hook)=>{\n return function useSWRArgs(...args) {\n // Get the default and inherited configuration.\n const fallbackConfig = useSWRConfig();\n // Normalize arguments.\n const [key, fn, _config] = normalize(args);\n // Merge configurations.\n const config = mergeConfigs(fallbackConfig, _config);\n // Apply middleware\n let next = hook;\n const { use } = config;\n const middleware = (use || []).concat(BUILT_IN_MIDDLEWARE);\n for(let i = middleware.length; i--;){\n next = middleware[i](next);\n }\n return next(key, fn || config.fetcher || null, config);\n };\n};\n\n// Add a callback function to a list of keyed callback functions and return\n// the unsubscribe function.\nconst subscribeCallback = (key, callbacks, callback)=>{\n const keyedRevalidators = callbacks[key] || (callbacks[key] = []);\n keyedRevalidators.push(callback);\n return ()=>{\n const index = keyedRevalidators.indexOf(callback);\n if (index >= 0) {\n // O(1): faster than splice\n keyedRevalidators[index] = keyedRevalidators[keyedRevalidators.length - 1];\n keyedRevalidators.pop();\n }\n };\n};\n\n// Create a custom hook with a middleware\nconst withMiddleware = (useSWR, middleware)=>{\n return (...args)=>{\n const [key, fn, config] = normalize(args);\n const uses = (config.use || []).concat(middleware);\n return useSWR(key, fn, {\n ...config,\n use: uses\n });\n };\n};\n\nsetupDevTools();\n\nexport { SWRGlobalState, cache, defaultConfig, isFunction, isUndefined, isWindowDefined, mergeConfigs, mergeObjects, normalize, preload, serialize, subscribeCallback, useSWRConfig, withArgs, withMiddleware };\n","const INFINITE_PREFIX = '$inf$';\n\nexport { INFINITE_PREFIX };\n","'use client';\nfunction __insertCSS(code) {\n if (!code || typeof document == 'undefined') return\n let head = document.head || document.getElementsByTagName('head')[0]\n let style = document.createElement('style')\n style.type = 'text/css'\n head.appendChild(style)\n ;style.styleSheet ? (style.styleSheet.cssText = code) : style.appendChild(document.createTextNode(code))\n}\n\nimport React from 'react';\nimport ReactDOM from 'react-dom';\n\nconst getAsset = (type)=>{\n switch(type){\n case 'success':\n return SuccessIcon;\n case 'info':\n return InfoIcon;\n case 'warning':\n return WarningIcon;\n case 'error':\n return ErrorIcon;\n default:\n return null;\n }\n};\nconst bars = Array(12).fill(0);\nconst Loader = ({ visible, className })=>{\n return /*#__PURE__*/ React.createElement(\"div\", {\n className: [\n 'sonner-loading-wrapper',\n className\n ].filter(Boolean).join(' '),\n \"data-visible\": visible\n }, /*#__PURE__*/ React.createElement(\"div\", {\n className: \"sonner-spinner\"\n }, bars.map((_, i)=>/*#__PURE__*/ React.createElement(\"div\", {\n className: \"sonner-loading-bar\",\n key: `spinner-bar-${i}`\n }))));\n};\nconst SuccessIcon = /*#__PURE__*/ React.createElement(\"svg\", {\n xmlns: \"http://www.w3.org/2000/svg\",\n viewBox: \"0 0 20 20\",\n fill: \"currentColor\",\n height: \"20\",\n width: \"20\"\n}, /*#__PURE__*/ React.createElement(\"path\", {\n fillRule: \"evenodd\",\n d: \"M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z\",\n clipRule: \"evenodd\"\n}));\nconst WarningIcon = /*#__PURE__*/ React.createElement(\"svg\", {\n xmlns: \"http://www.w3.org/2000/svg\",\n viewBox: \"0 0 24 24\",\n fill: \"currentColor\",\n height: \"20\",\n width: \"20\"\n}, /*#__PURE__*/ React.createElement(\"path\", {\n fillRule: \"evenodd\",\n d: \"M9.401 3.003c1.155-2 4.043-2 5.197 0l7.355 12.748c1.154 2-.29 4.5-2.599 4.5H4.645c-2.309 0-3.752-2.5-2.598-4.5L9.4 3.003zM12 8.25a.75.75 0 01.75.75v3.75a.75.75 0 01-1.5 0V9a.75.75 0 01.75-.75zm0 8.25a.75.75 0 100-1.5.75.75 0 000 1.5z\",\n clipRule: \"evenodd\"\n}));\nconst InfoIcon = /*#__PURE__*/ React.createElement(\"svg\", {\n xmlns: \"http://www.w3.org/2000/svg\",\n viewBox: \"0 0 20 20\",\n fill: \"currentColor\",\n height: \"20\",\n width: \"20\"\n}, /*#__PURE__*/ React.createElement(\"path\", {\n fillRule: \"evenodd\",\n d: \"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a.75.75 0 000 1.5h.253a.25.25 0 01.244.304l-.459 2.066A1.75 1.75 0 0010.747 15H11a.75.75 0 000-1.5h-.253a.25.25 0 01-.244-.304l.459-2.066A1.75 1.75 0 009.253 9H9z\",\n clipRule: \"evenodd\"\n}));\nconst ErrorIcon = /*#__PURE__*/ React.createElement(\"svg\", {\n xmlns: \"http://www.w3.org/2000/svg\",\n viewBox: \"0 0 20 20\",\n fill: \"currentColor\",\n height: \"20\",\n width: \"20\"\n}, /*#__PURE__*/ React.createElement(\"path\", {\n fillRule: \"evenodd\",\n d: \"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z\",\n clipRule: \"evenodd\"\n}));\nconst CloseIcon = /*#__PURE__*/ React.createElement(\"svg\", {\n xmlns: \"http://www.w3.org/2000/svg\",\n width: \"12\",\n height: \"12\",\n viewBox: \"0 0 24 24\",\n fill: \"none\",\n stroke: \"currentColor\",\n strokeWidth: \"1.5\",\n strokeLinecap: \"round\",\n strokeLinejoin: \"round\"\n}, /*#__PURE__*/ React.createElement(\"line\", {\n x1: \"18\",\n y1: \"6\",\n x2: \"6\",\n y2: \"18\"\n}), /*#__PURE__*/ React.createElement(\"line\", {\n x1: \"6\",\n y1: \"6\",\n x2: \"18\",\n y2: \"18\"\n}));\n\nconst useIsDocumentHidden = ()=>{\n const [isDocumentHidden, setIsDocumentHidden] = React.useState(document.hidden);\n React.useEffect(()=>{\n const callback = ()=>{\n setIsDocumentHidden(document.hidden);\n };\n document.addEventListener('visibilitychange', callback);\n return ()=>window.removeEventListener('visibilitychange', callback);\n }, []);\n return isDocumentHidden;\n};\n\nlet toastsCounter = 1;\nclass Observer {\n constructor(){\n // We use arrow functions to maintain the correct `this` reference\n this.subscribe = (subscriber)=>{\n this.subscribers.push(subscriber);\n return ()=>{\n const index = this.subscribers.indexOf(subscriber);\n this.subscribers.splice(index, 1);\n };\n };\n this.publish = (data)=>{\n this.subscribers.forEach((subscriber)=>subscriber(data));\n };\n this.addToast = (data)=>{\n this.publish(data);\n this.toasts = [\n ...this.toasts,\n data\n ];\n };\n this.create = (data)=>{\n var _data_id;\n const { message, ...rest } = data;\n const id = typeof (data == null ? void 0 : data.id) === 'number' || ((_data_id = data.id) == null ? void 0 : _data_id.length) > 0 ? data.id : toastsCounter++;\n const alreadyExists = this.toasts.find((toast)=>{\n return toast.id === id;\n });\n const dismissible = data.dismissible === undefined ? true : data.dismissible;\n if (this.dismissedToasts.has(id)) {\n this.dismissedToasts.delete(id);\n }\n if (alreadyExists) {\n this.toasts = this.toasts.map((toast)=>{\n if (toast.id === id) {\n this.publish({\n ...toast,\n ...data,\n id,\n title: message\n });\n return {\n ...toast,\n ...data,\n id,\n dismissible,\n title: message\n };\n }\n return toast;\n });\n } else {\n this.addToast({\n title: message,\n ...rest,\n dismissible,\n id\n });\n }\n return id;\n };\n this.dismiss = (id)=>{\n if (id) {\n this.dismissedToasts.add(id);\n requestAnimationFrame(()=>this.subscribers.forEach((subscriber)=>subscriber({\n id,\n dismiss: true\n })));\n } else {\n this.toasts.forEach((toast)=>{\n this.subscribers.forEach((subscriber)=>subscriber({\n id: toast.id,\n dismiss: true\n }));\n });\n }\n return id;\n };\n this.message = (message, data)=>{\n return this.create({\n ...data,\n message\n });\n };\n this.error = (message, data)=>{\n return this.create({\n ...data,\n message,\n type: 'error'\n });\n };\n this.success = (message, data)=>{\n return this.create({\n ...data,\n type: 'success',\n message\n });\n };\n this.info = (message, data)=>{\n return this.create({\n ...data,\n type: 'info',\n message\n });\n };\n this.warning = (message, data)=>{\n return this.create({\n ...data,\n type: 'warning',\n message\n });\n };\n this.loading = (message, data)=>{\n return this.create({\n ...data,\n type: 'loading',\n message\n });\n };\n this.promise = (promise, data)=>{\n if (!data) {\n // Nothing to show\n return;\n }\n let id = undefined;\n if (data.loading !== undefined) {\n id = this.create({\n ...data,\n promise,\n type: 'loading',\n message: data.loading,\n description: typeof data.description !== 'function' ? data.description : undefined\n });\n }\n const p = Promise.resolve(promise instanceof Function ? promise() : promise);\n let shouldDismiss = id !== undefined;\n let result;\n const originalPromise = p.then(async (response)=>{\n result = [\n 'resolve',\n response\n ];\n const isReactElementResponse = React.isValidElement(response);\n if (isReactElementResponse) {\n shouldDismiss = false;\n this.create({\n id,\n type: 'default',\n message: response\n });\n } else if (isHttpResponse(response) && !response.ok) {\n shouldDismiss = false;\n const promiseData = typeof data.error === 'function' ? await data.error(`HTTP error! status: ${response.status}`) : data.error;\n const description = typeof data.description === 'function' ? await data.description(`HTTP error! status: ${response.status}`) : data.description;\n const isExtendedResult = typeof promiseData === 'object' && !React.isValidElement(promiseData);\n const toastSettings = isExtendedResult ? promiseData : {\n message: promiseData\n };\n this.create({\n id,\n type: 'error',\n description,\n ...toastSettings\n });\n } else if (response instanceof Error) {\n shouldDismiss = false;\n const promiseData = typeof data.error === 'function' ? await data.error(response) : data.error;\n const description = typeof data.description === 'function' ? await data.description(response) : data.description;\n const isExtendedResult = typeof promiseData === 'object' && !React.isValidElement(promiseData);\n const toastSettings = isExtendedResult ? promiseData : {\n message: promiseData\n };\n this.create({\n id,\n type: 'error',\n description,\n ...toastSettings\n });\n } else if (data.success !== undefined) {\n shouldDismiss = false;\n const promiseData = typeof data.success === 'function' ? await data.success(response) : data.success;\n const description = typeof data.description === 'function' ? await data.description(response) : data.description;\n const isExtendedResult = typeof promiseData === 'object' && !React.isValidElement(promiseData);\n const toastSettings = isExtendedResult ? promiseData : {\n message: promiseData\n };\n this.create({\n id,\n type: 'success',\n description,\n ...toastSettings\n });\n }\n }).catch(async (error)=>{\n result = [\n 'reject',\n error\n ];\n if (data.error !== undefined) {\n shouldDismiss = false;\n const promiseData = typeof data.error === 'function' ? await data.error(error) : data.error;\n const description = typeof data.description === 'function' ? await data.description(error) : data.description;\n const isExtendedResult = typeof promiseData === 'object' && !React.isValidElement(promiseData);\n const toastSettings = isExtendedResult ? promiseData : {\n message: promiseData\n };\n this.create({\n id,\n type: 'error',\n description,\n ...toastSettings\n });\n }\n }).finally(()=>{\n if (shouldDismiss) {\n // Toast is still in load state (and will be indefinitely — dismiss it)\n this.dismiss(id);\n id = undefined;\n }\n data.finally == null ? void 0 : data.finally.call(data);\n });\n const unwrap = ()=>new Promise((resolve, reject)=>originalPromise.then(()=>result[0] === 'reject' ? reject(result[1]) : resolve(result[1])).catch(reject));\n if (typeof id !== 'string' && typeof id !== 'number') {\n // cannot Object.assign on undefined\n return {\n unwrap\n };\n } else {\n return Object.assign(id, {\n unwrap\n });\n }\n };\n this.custom = (jsx, data)=>{\n const id = (data == null ? void 0 : data.id) || toastsCounter++;\n this.create({\n jsx: jsx(id),\n id,\n ...data\n });\n return id;\n };\n this.getActiveToasts = ()=>{\n return this.toasts.filter((toast)=>!this.dismissedToasts.has(toast.id));\n };\n this.subscribers = [];\n this.toasts = [];\n this.dismissedToasts = new Set();\n }\n}\nconst ToastState = new Observer();\n// bind this to the toast function\nconst toastFunction = (message, data)=>{\n const id = (data == null ? void 0 : data.id) || toastsCounter++;\n ToastState.addToast({\n title: message,\n ...data,\n id\n });\n return id;\n};\nconst isHttpResponse = (data)=>{\n return data && typeof data === 'object' && 'ok' in data && typeof data.ok === 'boolean' && 'status' in data && typeof data.status === 'number';\n};\nconst basicToast = toastFunction;\nconst getHistory = ()=>ToastState.toasts;\nconst getToasts = ()=>ToastState.getActiveToasts();\n// We use `Object.assign` to maintain the correct types as we would lose them otherwise\nconst toast = Object.assign(basicToast, {\n success: ToastState.success,\n info: ToastState.info,\n warning: ToastState.warning,\n error: ToastState.error,\n custom: ToastState.custom,\n message: ToastState.message,\n promise: ToastState.promise,\n dismiss: ToastState.dismiss,\n loading: ToastState.loading\n}, {\n getHistory,\n getToasts\n});\n\n__insertCSS(\"[data-sonner-toaster][dir=ltr],html[dir=ltr]{--toast-icon-margin-start:-3px;--toast-icon-margin-end:4px;--toast-svg-margin-start:-1px;--toast-svg-margin-end:0px;--toast-button-margin-start:auto;--toast-button-margin-end:0;--toast-close-button-start:0;--toast-close-button-end:unset;--toast-close-button-transform:translate(-35%, -35%)}[data-sonner-toaster][dir=rtl],html[dir=rtl]{--toast-icon-margin-start:4px;--toast-icon-margin-end:-3px;--toast-svg-margin-start:0px;--toast-svg-margin-end:-1px;--toast-button-margin-start:0;--toast-button-margin-end:auto;--toast-close-button-start:unset;--toast-close-button-end:0;--toast-close-button-transform:translate(35%, -35%)}[data-sonner-toaster]{position:fixed;width:var(--width);font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;--gray1:hsl(0, 0%, 99%);--gray2:hsl(0, 0%, 97.3%);--gray3:hsl(0, 0%, 95.1%);--gray4:hsl(0, 0%, 93%);--gray5:hsl(0, 0%, 90.9%);--gray6:hsl(0, 0%, 88.7%);--gray7:hsl(0, 0%, 85.8%);--gray8:hsl(0, 0%, 78%);--gray9:hsl(0, 0%, 56.1%);--gray10:hsl(0, 0%, 52.3%);--gray11:hsl(0, 0%, 43.5%);--gray12:hsl(0, 0%, 9%);--border-radius:8px;box-sizing:border-box;padding:0;margin:0;list-style:none;outline:0;z-index:999999999;transition:transform .4s ease}@media (hover:none) and (pointer:coarse){[data-sonner-toaster][data-lifted=true]{transform:none}}[data-sonner-toaster][data-x-position=right]{right:var(--offset-right)}[data-sonner-toaster][data-x-position=left]{left:var(--offset-left)}[data-sonner-toaster][data-x-position=center]{left:50%;transform:translateX(-50%)}[data-sonner-toaster][data-y-position=top]{top:var(--offset-top)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--offset-bottom)}[data-sonner-toast]{--y:translateY(100%);--lift-amount:calc(var(--lift) * var(--gap));z-index:var(--z-index);position:absolute;opacity:0;transform:var(--y);touch-action:none;transition:transform .4s,opacity .4s,height .4s,box-shadow .2s;box-sizing:border-box;outline:0;overflow-wrap:anywhere}[data-sonner-toast][data-styled=true]{padding:16px;background:var(--normal-bg);border:1px solid var(--normal-border);color:var(--normal-text);border-radius:var(--border-radius);box-shadow:0 4px 12px rgba(0,0,0,.1);width:var(--width);font-size:13px;display:flex;align-items:center;gap:6px}[data-sonner-toast]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-y-position=top]{top:0;--y:translateY(-100%);--lift:1;--lift-amount:calc(1 * var(--gap))}[data-sonner-toast][data-y-position=bottom]{bottom:0;--y:translateY(100%);--lift:-1;--lift-amount:calc(var(--lift) * var(--gap))}[data-sonner-toast][data-styled=true] [data-description]{font-weight:400;line-height:1.4;color:#3f3f3f}[data-rich-colors=true][data-sonner-toast][data-styled=true] [data-description]{color:inherit}[data-sonner-toaster][data-sonner-theme=dark] [data-description]{color:#e8e8e8}[data-sonner-toast][data-styled=true] [data-title]{font-weight:500;line-height:1.5;color:inherit}[data-sonner-toast][data-styled=true] [data-icon]{display:flex;height:16px;width:16px;position:relative;justify-content:flex-start;align-items:center;flex-shrink:0;margin-left:var(--toast-icon-margin-start);margin-right:var(--toast-icon-margin-end)}[data-sonner-toast][data-promise=true] [data-icon]>svg{opacity:0;transform:scale(.8);transform-origin:center;animation:sonner-fade-in .3s ease forwards}[data-sonner-toast][data-styled=true] [data-icon]>*{flex-shrink:0}[data-sonner-toast][data-styled=true] [data-icon] svg{margin-left:var(--toast-svg-margin-start);margin-right:var(--toast-svg-margin-end)}[data-sonner-toast][data-styled=true] [data-content]{display:flex;flex-direction:column;gap:2px}[data-sonner-toast][data-styled=true] [data-button]{border-radius:4px;padding-left:8px;padding-right:8px;height:24px;font-size:12px;color:var(--normal-bg);background:var(--normal-text);margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end);border:none;font-weight:500;cursor:pointer;outline:0;display:flex;align-items:center;flex-shrink:0;transition:opacity .4s,box-shadow .2s}[data-sonner-toast][data-styled=true] [data-button]:focus-visible{box-shadow:0 0 0 2px rgba(0,0,0,.4)}[data-sonner-toast][data-styled=true] [data-button]:first-of-type{margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end)}[data-sonner-toast][data-styled=true] [data-cancel]{color:var(--normal-text);background:rgba(0,0,0,.08)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-styled=true] [data-cancel]{background:rgba(255,255,255,.3)}[data-sonner-toast][data-styled=true] [data-close-button]{position:absolute;left:var(--toast-close-button-start);right:var(--toast-close-button-end);top:0;height:20px;width:20px;display:flex;justify-content:center;align-items:center;padding:0;color:var(--gray12);background:var(--normal-bg);border:1px solid var(--gray4);transform:var(--toast-close-button-transform);border-radius:50%;cursor:pointer;z-index:1;transition:opacity .1s,background .2s,border-color .2s}[data-sonner-toast][data-styled=true] [data-close-button]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-styled=true] [data-disabled=true]{cursor:not-allowed}[data-sonner-toast][data-styled=true]:hover [data-close-button]:hover{background:var(--gray2);border-color:var(--gray5)}[data-sonner-toast][data-swiping=true]::before{content:'';position:absolute;left:-100%;right:-100%;height:100%;z-index:-1}[data-sonner-toast][data-y-position=top][data-swiping=true]::before{bottom:50%;transform:scaleY(3) translateY(50%)}[data-sonner-toast][data-y-position=bottom][data-swiping=true]::before{top:50%;transform:scaleY(3) translateY(-50%)}[data-sonner-toast][data-swiping=false][data-removed=true]::before{content:'';position:absolute;inset:0;transform:scaleY(2)}[data-sonner-toast][data-expanded=true]::after{content:'';position:absolute;left:0;height:calc(var(--gap) + 1px);bottom:100%;width:100%}[data-sonner-toast][data-mounted=true]{--y:translateY(0);opacity:1}[data-sonner-toast][data-expanded=false][data-front=false]{--scale:var(--toasts-before) * 0.05 + 1;--y:translateY(calc(var(--lift-amount) * var(--toasts-before))) scale(calc(-1 * var(--scale)));height:var(--front-toast-height)}[data-sonner-toast]>*{transition:opacity .4s}[data-sonner-toast][data-x-position=right]{right:0}[data-sonner-toast][data-x-position=left]{left:0}[data-sonner-toast][data-expanded=false][data-front=false][data-styled=true]>*{opacity:0}[data-sonner-toast][data-visible=false]{opacity:0;pointer-events:none}[data-sonner-toast][data-mounted=true][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset)));height:var(--initial-height)}[data-sonner-toast][data-removed=true][data-front=true][data-swipe-out=false]{--y:translateY(calc(var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset) + var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=false]{--y:translateY(40%);opacity:0;transition:transform .5s,opacity .2s}[data-sonner-toast][data-removed=true][data-front=false]::before{height:calc(var(--initial-height) + 20%)}[data-sonner-toast][data-swiping=true]{transform:var(--y) translateY(var(--swipe-amount-y,0)) translateX(var(--swipe-amount-x,0));transition:none}[data-sonner-toast][data-swiped=true]{user-select:none}[data-sonner-toast][data-swipe-out=true][data-y-position=bottom],[data-sonner-toast][data-swipe-out=true][data-y-position=top]{animation-duration:.2s;animation-timing-function:ease-out;animation-fill-mode:forwards}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=left]{animation-name:swipe-out-left}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=right]{animation-name:swipe-out-right}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=up]{animation-name:swipe-out-up}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=down]{animation-name:swipe-out-down}@keyframes swipe-out-left{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) - 100%));opacity:0}}@keyframes swipe-out-right{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) + 100%));opacity:0}}@keyframes swipe-out-up{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) - 100%));opacity:0}}@keyframes swipe-out-down{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) + 100%));opacity:0}}@media (max-width:600px){[data-sonner-toaster]{position:fixed;right:var(--mobile-offset-right);left:var(--mobile-offset-left);width:100%}[data-sonner-toaster][dir=rtl]{left:calc(var(--mobile-offset-left) * -1)}[data-sonner-toaster] [data-sonner-toast]{left:0;right:0;width:calc(100% - var(--mobile-offset-left) * 2)}[data-sonner-toaster][data-x-position=left]{left:var(--mobile-offset-left)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--mobile-offset-bottom)}[data-sonner-toaster][data-y-position=top]{top:var(--mobile-offset-top)}[data-sonner-toaster][data-x-position=center]{left:var(--mobile-offset-left);right:var(--mobile-offset-right);transform:none}}[data-sonner-toaster][data-sonner-theme=light]{--normal-bg:#fff;--normal-border:var(--gray4);--normal-text:var(--gray12);--success-bg:hsl(143, 85%, 96%);--success-border:hsl(145, 92%, 87%);--success-text:hsl(140, 100%, 27%);--info-bg:hsl(208, 100%, 97%);--info-border:hsl(221, 91%, 93%);--info-text:hsl(210, 92%, 45%);--warning-bg:hsl(49, 100%, 97%);--warning-border:hsl(49, 91%, 84%);--warning-text:hsl(31, 92%, 45%);--error-bg:hsl(359, 100%, 97%);--error-border:hsl(359, 100%, 94%);--error-text:hsl(360, 100%, 45%)}[data-sonner-toaster][data-sonner-theme=light] [data-sonner-toast][data-invert=true]{--normal-bg:#000;--normal-border:hsl(0, 0%, 20%);--normal-text:var(--gray1)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-invert=true]{--normal-bg:#fff;--normal-border:var(--gray3);--normal-text:var(--gray12)}[data-sonner-toaster][data-sonner-theme=dark]{--normal-bg:#000;--normal-bg-hover:hsl(0, 0%, 12%);--normal-border:hsl(0, 0%, 20%);--normal-border-hover:hsl(0, 0%, 25%);--normal-text:var(--gray1);--success-bg:hsl(150, 100%, 6%);--success-border:hsl(147, 100%, 12%);--success-text:hsl(150, 86%, 65%);--info-bg:hsl(215, 100%, 6%);--info-border:hsl(223, 43%, 17%);--info-text:hsl(216, 87%, 65%);--warning-bg:hsl(64, 100%, 6%);--warning-border:hsl(60, 100%, 9%);--warning-text:hsl(46, 87%, 65%);--error-bg:hsl(358, 76%, 10%);--error-border:hsl(357, 89%, 16%);--error-text:hsl(358, 100%, 81%)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]{background:var(--normal-bg);border-color:var(--normal-border);color:var(--normal-text)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]:hover{background:var(--normal-bg-hover);border-color:var(--normal-border-hover)}[data-rich-colors=true][data-sonner-toast][data-type=success]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=success] [data-close-button]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=info]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=info] [data-close-button]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning] [data-close-button]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=error]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}[data-rich-colors=true][data-sonner-toast][data-type=error] [data-close-button]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}.sonner-loading-wrapper{--size:16px;height:var(--size);width:var(--size);position:absolute;inset:0;z-index:10}.sonner-loading-wrapper[data-visible=false]{transform-origin:center;animation:sonner-fade-out .2s ease forwards}.sonner-spinner{position:relative;top:50%;left:50%;height:var(--size);width:var(--size)}.sonner-loading-bar{animation:sonner-spin 1.2s linear infinite;background:var(--gray11);border-radius:6px;height:8%;left:-10%;position:absolute;top:-3.9%;width:24%}.sonner-loading-bar:first-child{animation-delay:-1.2s;transform:rotate(.0001deg) translate(146%)}.sonner-loading-bar:nth-child(2){animation-delay:-1.1s;transform:rotate(30deg) translate(146%)}.sonner-loading-bar:nth-child(3){animation-delay:-1s;transform:rotate(60deg) translate(146%)}.sonner-loading-bar:nth-child(4){animation-delay:-.9s;transform:rotate(90deg) translate(146%)}.sonner-loading-bar:nth-child(5){animation-delay:-.8s;transform:rotate(120deg) translate(146%)}.sonner-loading-bar:nth-child(6){animation-delay:-.7s;transform:rotate(150deg) translate(146%)}.sonner-loading-bar:nth-child(7){animation-delay:-.6s;transform:rotate(180deg) translate(146%)}.sonner-loading-bar:nth-child(8){animation-delay:-.5s;transform:rotate(210deg) translate(146%)}.sonner-loading-bar:nth-child(9){animation-delay:-.4s;transform:rotate(240deg) translate(146%)}.sonner-loading-bar:nth-child(10){animation-delay:-.3s;transform:rotate(270deg) translate(146%)}.sonner-loading-bar:nth-child(11){animation-delay:-.2s;transform:rotate(300deg) translate(146%)}.sonner-loading-bar:nth-child(12){animation-delay:-.1s;transform:rotate(330deg) translate(146%)}@keyframes sonner-fade-in{0%{opacity:0;transform:scale(.8)}100%{opacity:1;transform:scale(1)}}@keyframes sonner-fade-out{0%{opacity:1;transform:scale(1)}100%{opacity:0;transform:scale(.8)}}@keyframes sonner-spin{0%{opacity:1}100%{opacity:.15}}@media (prefers-reduced-motion){.sonner-loading-bar,[data-sonner-toast],[data-sonner-toast]>*{transition:none!important;animation:none!important}}.sonner-loader{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);transform-origin:center;transition:opacity .2s,transform .2s}.sonner-loader[data-visible=false]{opacity:0;transform:scale(.8) translate(-50%,-50%)}\");\n\nfunction isAction(action) {\n return action.label !== undefined;\n}\n\n// Visible toasts amount\nconst VISIBLE_TOASTS_AMOUNT = 3;\n// Viewport padding\nconst VIEWPORT_OFFSET = '24px';\n// Mobile viewport padding\nconst MOBILE_VIEWPORT_OFFSET = '16px';\n// Default lifetime of a toasts (in ms)\nconst TOAST_LIFETIME = 4000;\n// Default toast width\nconst TOAST_WIDTH = 356;\n// Default gap between toasts\nconst GAP = 14;\n// Threshold to dismiss a toast\nconst SWIPE_THRESHOLD = 45;\n// Equal to exit animation duration\nconst TIME_BEFORE_UNMOUNT = 200;\nfunction cn(...classes) {\n return classes.filter(Boolean).join(' ');\n}\nfunction getDefaultSwipeDirections(position) {\n const [y, x] = position.split('-');\n const directions = [];\n if (y) {\n directions.push(y);\n }\n if (x) {\n directions.push(x);\n }\n return directions;\n}\nconst Toast = (props)=>{\n var _toast_classNames, _toast_classNames1, _toast_classNames2, _toast_classNames3, _toast_classNames4, _toast_classNames5, _toast_classNames6, _toast_classNames7, _toast_classNames8;\n const { invert: ToasterInvert, toast, unstyled, interacting, setHeights, visibleToasts, heights, index, toasts, expanded, removeToast, defaultRichColors, closeButton: closeButtonFromToaster, style, cancelButtonStyle, actionButtonStyle, className = '', descriptionClassName = '', duration: durationFromToaster, position, gap, expandByDefault, classNames, icons, closeButtonAriaLabel = 'Close toast' } = props;\n const [swipeDirection, setSwipeDirection] = React.useState(null);\n const [swipeOutDirection, setSwipeOutDirection] = React.useState(null);\n const [mounted, setMounted] = React.useState(false);\n const [removed, setRemoved] = React.useState(false);\n const [swiping, setSwiping] = React.useState(false);\n const [swipeOut, setSwipeOut] = React.useState(false);\n const [isSwiped, setIsSwiped] = React.useState(false);\n const [offsetBeforeRemove, setOffsetBeforeRemove] = React.useState(0);\n const [initialHeight, setInitialHeight] = React.useState(0);\n const remainingTime = React.useRef(toast.duration || durationFromToaster || TOAST_LIFETIME);\n const dragStartTime = React.useRef(null);\n const toastRef = React.useRef(null);\n const isFront = index === 0;\n const isVisible = index + 1 <= visibleToasts;\n const toastType = toast.type;\n const dismissible = toast.dismissible !== false;\n const toastClassname = toast.className || '';\n const toastDescriptionClassname = toast.descriptionClassName || '';\n // Height index is used to calculate the offset as it gets updated before the toast array, which means we can calculate the new layout faster.\n const heightIndex = React.useMemo(()=>heights.findIndex((height)=>height.toastId === toast.id) || 0, [\n heights,\n toast.id\n ]);\n const closeButton = React.useMemo(()=>{\n var _toast_closeButton;\n return (_toast_closeButton = toast.closeButton) != null ? _toast_closeButton : closeButtonFromToaster;\n }, [\n toast.closeButton,\n closeButtonFromToaster\n ]);\n const duration = React.useMemo(()=>toast.duration || durationFromToaster || TOAST_LIFETIME, [\n toast.duration,\n durationFromToaster\n ]);\n const closeTimerStartTimeRef = React.useRef(0);\n const offset = React.useRef(0);\n const lastCloseTimerStartTimeRef = React.useRef(0);\n const pointerStartRef = React.useRef(null);\n const [y, x] = position.split('-');\n const toastsHeightBefore = React.useMemo(()=>{\n return heights.reduce((prev, curr, reducerIndex)=>{\n // Calculate offset up until current toast\n if (reducerIndex >= heightIndex) {\n return prev;\n }\n return prev + curr.height;\n }, 0);\n }, [\n heights,\n heightIndex\n ]);\n const isDocumentHidden = useIsDocumentHidden();\n const invert = toast.invert || ToasterInvert;\n const disabled = toastType === 'loading';\n offset.current = React.useMemo(()=>heightIndex * gap + toastsHeightBefore, [\n heightIndex,\n toastsHeightBefore\n ]);\n React.useEffect(()=>{\n remainingTime.current = duration;\n }, [\n duration\n ]);\n React.useEffect(()=>{\n // Trigger enter animation without using CSS animation\n setMounted(true);\n }, []);\n React.useEffect(()=>{\n const toastNode = toastRef.current;\n if (toastNode) {\n const height = toastNode.getBoundingClientRect().height;\n // Add toast height to heights array after the toast is mounted\n setInitialHeight(height);\n setHeights((h)=>[\n {\n toastId: toast.id,\n height,\n position: toast.position\n },\n ...h\n ]);\n return ()=>setHeights((h)=>h.filter((height)=>height.toastId !== toast.id));\n }\n }, [\n setHeights,\n toast.id\n ]);\n React.useLayoutEffect(()=>{\n // Keep height up to date with the content in case it updates\n if (!mounted) return;\n const toastNode = toastRef.current;\n const originalHeight = toastNode.style.height;\n toastNode.style.height = 'auto';\n const newHeight = toastNode.getBoundingClientRect().height;\n toastNode.style.height = originalHeight;\n setInitialHeight(newHeight);\n setHeights((heights)=>{\n const alreadyExists = heights.find((height)=>height.toastId === toast.id);\n if (!alreadyExists) {\n return [\n {\n toastId: toast.id,\n height: newHeight,\n position: toast.position\n },\n ...heights\n ];\n } else {\n return heights.map((height)=>height.toastId === toast.id ? {\n ...height,\n height: newHeight\n } : height);\n }\n });\n }, [\n mounted,\n toast.title,\n toast.description,\n setHeights,\n toast.id,\n toast.jsx,\n toast.action,\n toast.cancel\n ]);\n const deleteToast = React.useCallback(()=>{\n // Save the offset for the exit swipe animation\n setRemoved(true);\n setOffsetBeforeRemove(offset.current);\n setHeights((h)=>h.filter((height)=>height.toastId !== toast.id));\n setTimeout(()=>{\n removeToast(toast);\n }, TIME_BEFORE_UNMOUNT);\n }, [\n toast,\n removeToast,\n setHeights,\n offset\n ]);\n React.useEffect(()=>{\n if (toast.promise && toastType === 'loading' || toast.duration === Infinity || toast.type === 'loading') return;\n let timeoutId;\n // Pause the timer on each hover\n const pauseTimer = ()=>{\n if (lastCloseTimerStartTimeRef.current < closeTimerStartTimeRef.current) {\n // Get the elapsed time since the timer started\n const elapsedTime = new Date().getTime() - closeTimerStartTimeRef.current;\n remainingTime.current = remainingTime.current - elapsedTime;\n }\n lastCloseTimerStartTimeRef.current = new Date().getTime();\n };\n const startTimer = ()=>{\n // setTimeout(, Infinity) behaves as if the delay is 0.\n // As a result, the toast would be closed immediately, giving the appearance that it was never rendered.\n // See: https://github.com/denysdovhan/wtfjs?tab=readme-ov-file#an-infinite-timeout\n if (remainingTime.current === Infinity) return;\n closeTimerStartTimeRef.current = new Date().getTime();\n // Let the toast know it has started\n timeoutId = setTimeout(()=>{\n toast.onAutoClose == null ? void 0 : toast.onAutoClose.call(toast, toast);\n deleteToast();\n }, remainingTime.current);\n };\n if (expanded || interacting || isDocumentHidden) {\n pauseTimer();\n } else {\n startTimer();\n }\n return ()=>clearTimeout(timeoutId);\n }, [\n expanded,\n interacting,\n toast,\n toastType,\n isDocumentHidden,\n deleteToast\n ]);\n React.useEffect(()=>{\n if (toast.delete) {\n deleteToast();\n toast.onDismiss == null ? void 0 : toast.onDismiss.call(toast, toast);\n }\n }, [\n deleteToast,\n toast.delete\n ]);\n function getLoadingIcon() {\n var _toast_classNames;\n if (icons == null ? void 0 : icons.loading) {\n var _toast_classNames1;\n return /*#__PURE__*/ React.createElement(\"div\", {\n className: cn(classNames == null ? void 0 : classNames.loader, toast == null ? void 0 : (_toast_classNames1 = toast.classNames) == null ? void 0 : _toast_classNames1.loader, 'sonner-loader'),\n \"data-visible\": toastType === 'loading'\n }, icons.loading);\n }\n return /*#__PURE__*/ React.createElement(Loader, {\n className: cn(classNames == null ? void 0 : classNames.loader, toast == null ? void 0 : (_toast_classNames = toast.classNames) == null ? void 0 : _toast_classNames.loader),\n visible: toastType === 'loading'\n });\n }\n const icon = toast.icon || (icons == null ? void 0 : icons[toastType]) || getAsset(toastType);\n var _toast_richColors, _icons_close;\n return /*#__PURE__*/ React.createElement(\"li\", {\n tabIndex: 0,\n ref: toastRef,\n className: cn(className, toastClassname, classNames == null ? void 0 : classNames.toast, toast == null ? void 0 : (_toast_classNames = toast.classNames) == null ? void 0 : _toast_classNames.toast, classNames == null ? void 0 : classNames.default, classNames == null ? void 0 : classNames[toastType], toast == null ? void 0 : (_toast_classNames1 = toast.classNames) == null ? void 0 : _toast_classNames1[toastType]),\n \"data-sonner-toast\": \"\",\n \"data-rich-colors\": (_toast_richColors = toast.richColors) != null ? _toast_richColors : defaultRichColors,\n \"data-styled\": !Boolean(toast.jsx || toast.unstyled || unstyled),\n \"data-mounted\": mounted,\n \"data-promise\": Boolean(toast.promise),\n \"data-swiped\": isSwiped,\n \"data-removed\": removed,\n \"data-visible\": isVisible,\n \"data-y-position\": y,\n \"data-x-position\": x,\n \"data-index\": index,\n \"data-front\": isFront,\n \"data-swiping\": swiping,\n \"data-dismissible\": dismissible,\n \"data-type\": toastType,\n \"data-invert\": invert,\n \"data-swipe-out\": swipeOut,\n \"data-swipe-direction\": swipeOutDirection,\n \"data-expanded\": Boolean(expanded || expandByDefault && mounted),\n \"data-testid\": toast.testId,\n style: {\n '--index': index,\n '--toasts-before': index,\n '--z-index': toasts.length - index,\n '--offset': `${removed ? offsetBeforeRemove : offset.current}px`,\n '--initial-height': expandByDefault ? 'auto' : `${initialHeight}px`,\n ...style,\n ...toast.style\n },\n onDragEnd: ()=>{\n setSwiping(false);\n setSwipeDirection(null);\n pointerStartRef.current = null;\n },\n onPointerDown: (event)=>{\n if (event.button === 2) return; // Return early on right click\n if (disabled || !dismissible) return;\n dragStartTime.current = new Date();\n setOffsetBeforeRemove(offset.current);\n // Ensure we maintain correct pointer capture even when going outside of the toast (e.g. when swiping)\n event.target.setPointerCapture(event.pointerId);\n if (event.target.tagName === 'BUTTON') return;\n setSwiping(true);\n pointerStartRef.current = {\n x: event.clientX,\n y: event.clientY\n };\n },\n onPointerUp: ()=>{\n var _toastRef_current, _toastRef_current1, _dragStartTime_current;\n if (swipeOut || !dismissible) return;\n pointerStartRef.current = null;\n const swipeAmountX = Number(((_toastRef_current = toastRef.current) == null ? void 0 : _toastRef_current.style.getPropertyValue('--swipe-amount-x').replace('px', '')) || 0);\n const swipeAmountY = Number(((_toastRef_current1 = toastRef.current) == null ? void 0 : _toastRef_current1.style.getPropertyValue('--swipe-amount-y').replace('px', '')) || 0);\n const timeTaken = new Date().getTime() - ((_dragStartTime_current = dragStartTime.current) == null ? void 0 : _dragStartTime_current.getTime());\n const swipeAmount = swipeDirection === 'x' ? swipeAmountX : swipeAmountY;\n const velocity = Math.abs(swipeAmount) / timeTaken;\n if (Math.abs(swipeAmount) >= SWIPE_THRESHOLD || velocity > 0.11) {\n setOffsetBeforeRemove(offset.current);\n toast.onDismiss == null ? void 0 : toast.onDismiss.call(toast, toast);\n if (swipeDirection === 'x') {\n setSwipeOutDirection(swipeAmountX > 0 ? 'right' : 'left');\n } else {\n setSwipeOutDirection(swipeAmountY > 0 ? 'down' : 'up');\n }\n deleteToast();\n setSwipeOut(true);\n return;\n } else {\n var _toastRef_current2, _toastRef_current3;\n (_toastRef_current2 = toastRef.current) == null ? void 0 : _toastRef_current2.style.setProperty('--swipe-amount-x', `0px`);\n (_toastRef_current3 = toastRef.current) == null ? void 0 : _toastRef_current3.style.setProperty('--swipe-amount-y', `0px`);\n }\n setIsSwiped(false);\n setSwiping(false);\n setSwipeDirection(null);\n },\n onPointerMove: (event)=>{\n var _window_getSelection, // Apply transform using both x and y values\n _toastRef_current, _toastRef_current1;\n if (!pointerStartRef.current || !dismissible) return;\n const isHighlighted = ((_window_getSelection = window.getSelection()) == null ? void 0 : _window_getSelection.toString().length) > 0;\n if (isHighlighted) return;\n const yDelta = event.clientY - pointerStartRef.current.y;\n const xDelta = event.clientX - pointerStartRef.current.x;\n var _props_swipeDirections;\n const swipeDirections = (_props_swipeDirections = props.swipeDirections) != null ? _props_swipeDirections : getDefaultSwipeDirections(position);\n // Determine swipe direction if not already locked\n if (!swipeDirection && (Math.abs(xDelta) > 1 || Math.abs(yDelta) > 1)) {\n setSwipeDirection(Math.abs(xDelta) > Math.abs(yDelta) ? 'x' : 'y');\n }\n let swipeAmount = {\n x: 0,\n y: 0\n };\n const getDampening = (delta)=>{\n const factor = Math.abs(delta) / 20;\n return 1 / (1.5 + factor);\n };\n // Only apply swipe in the locked direction\n if (swipeDirection === 'y') {\n // Handle vertical swipes\n if (swipeDirections.includes('top') || swipeDirections.includes('bottom')) {\n if (swipeDirections.includes('top') && yDelta < 0 || swipeDirections.includes('bottom') && yDelta > 0) {\n swipeAmount.y = yDelta;\n } else {\n // Smoothly transition to dampened movement\n const dampenedDelta = yDelta * getDampening(yDelta);\n // Ensure we don't jump when transitioning to dampened movement\n swipeAmount.y = Math.abs(dampenedDelta) < Math.abs(yDelta) ? dampenedDelta : yDelta;\n }\n }\n } else if (swipeDirection === 'x') {\n // Handle horizontal swipes\n if (swipeDirections.includes('left') || swipeDirections.includes('right')) {\n if (swipeDirections.includes('left') && xDelta < 0 || swipeDirections.includes('right') && xDelta > 0) {\n swipeAmount.x = xDelta;\n } else {\n // Smoothly transition to dampened movement\n const dampenedDelta = xDelta * getDampening(xDelta);\n // Ensure we don't jump when transitioning to dampened movement\n swipeAmount.x = Math.abs(dampenedDelta) < Math.abs(xDelta) ? dampenedDelta : xDelta;\n }\n }\n }\n if (Math.abs(swipeAmount.x) > 0 || Math.abs(swipeAmount.y) > 0) {\n setIsSwiped(true);\n }\n (_toastRef_current = toastRef.current) == null ? void 0 : _toastRef_current.style.setProperty('--swipe-amount-x', `${swipeAmount.x}px`);\n (_toastRef_current1 = toastRef.current) == null ? void 0 : _toastRef_current1.style.setProperty('--swipe-amount-y', `${swipeAmount.y}px`);\n }\n }, closeButton && !toast.jsx && toastType !== 'loading' ? /*#__PURE__*/ React.createElement(\"button\", {\n \"aria-label\": closeButtonAriaLabel,\n \"data-disabled\": disabled,\n \"data-close-button\": true,\n onClick: disabled || !dismissible ? ()=>{} : ()=>{\n deleteToast();\n toast.onDismiss == null ? void 0 : toast.onDismiss.call(toast, toast);\n },\n className: cn(classNames == null ? void 0 : classNames.closeButton, toast == null ? void 0 : (_toast_classNames2 = toast.classNames) == null ? void 0 : _toast_classNames2.closeButton)\n }, (_icons_close = icons == null ? void 0 : icons.close) != null ? _icons_close : CloseIcon) : null, (toastType || toast.icon || toast.promise) && toast.icon !== null && ((icons == null ? void 0 : icons[toastType]) !== null || toast.icon) ? /*#__PURE__*/ React.createElement(\"div\", {\n \"data-icon\": \"\",\n className: cn(classNames == null ? void 0 : classNames.icon, toast == null ? void 0 : (_toast_classNames3 = toast.classNames) == null ? void 0 : _toast_classNames3.icon)\n }, toast.promise || toast.type === 'loading' && !toast.icon ? toast.icon || getLoadingIcon() : null, toast.type !== 'loading' ? icon : null) : null, /*#__PURE__*/ React.createElement(\"div\", {\n \"data-content\": \"\",\n className: cn(classNames == null ? void 0 : classNames.content, toast == null ? void 0 : (_toast_classNames4 = toast.classNames) == null ? void 0 : _toast_classNames4.content)\n }, /*#__PURE__*/ React.createElement(\"div\", {\n \"data-title\": \"\",\n className: cn(classNames == null ? void 0 : classNames.title, toast == null ? void 0 : (_toast_classNames5 = toast.classNames) == null ? void 0 : _toast_classNames5.title)\n }, toast.jsx ? toast.jsx : typeof toast.title === 'function' ? toast.title() : toast.title), toast.description ? /*#__PURE__*/ React.createElement(\"div\", {\n \"data-description\": \"\",\n className: cn(descriptionClassName, toastDescriptionClassname, classNames == null ? void 0 : classNames.description, toast == null ? void 0 : (_toast_classNames6 = toast.classNames) == null ? void 0 : _toast_classNames6.description)\n }, typeof toast.description === 'function' ? toast.description() : toast.description) : null), /*#__PURE__*/ React.isValidElement(toast.cancel) ? toast.cancel : toast.cancel && isAction(toast.cancel) ? /*#__PURE__*/ React.createElement(\"button\", {\n \"data-button\": true,\n \"data-cancel\": true,\n style: toast.cancelButtonStyle || cancelButtonStyle,\n onClick: (event)=>{\n // We need to check twice because typescript\n if (!isAction(toast.cancel)) return;\n if (!dismissible) return;\n toast.cancel.onClick == null ? void 0 : toast.cancel.onClick.call(toast.cancel, event);\n deleteToast();\n },\n className: cn(classNames == null ? void 0 : classNames.cancelButton, toast == null ? void 0 : (_toast_classNames7 = toast.classNames) == null ? void 0 : _toast_classNames7.cancelButton)\n }, toast.cancel.label) : null, /*#__PURE__*/ React.isValidElement(toast.action) ? toast.action : toast.action && isAction(toast.action) ? /*#__PURE__*/ React.createElement(\"button\", {\n \"data-button\": true,\n \"data-action\": true,\n style: toast.actionButtonStyle || actionButtonStyle,\n onClick: (event)=>{\n // We need to check twice because typescript\n if (!isAction(toast.action)) return;\n toast.action.onClick == null ? void 0 : toast.action.onClick.call(toast.action, event);\n if (event.defaultPrevented) return;\n deleteToast();\n },\n className: cn(classNames == null ? void 0 : classNames.actionButton, toast == null ? void 0 : (_toast_classNames8 = toast.classNames) == null ? void 0 : _toast_classNames8.actionButton)\n }, toast.action.label) : null);\n};\nfunction getDocumentDirection() {\n if (typeof window === 'undefined') return 'ltr';\n if (typeof document === 'undefined') return 'ltr'; // For Fresh purpose\n const dirAttribute = document.documentElement.getAttribute('dir');\n if (dirAttribute === 'auto' || !dirAttribute) {\n return window.getComputedStyle(document.documentElement).direction;\n }\n return dirAttribute;\n}\nfunction assignOffset(defaultOffset, mobileOffset) {\n const styles = {};\n [\n defaultOffset,\n mobileOffset\n ].forEach((offset, index)=>{\n const isMobile = index === 1;\n const prefix = isMobile ? '--mobile-offset' : '--offset';\n const defaultValue = isMobile ? MOBILE_VIEWPORT_OFFSET : VIEWPORT_OFFSET;\n function assignAll(offset) {\n [\n 'top',\n 'right',\n 'bottom',\n 'left'\n ].forEach((key)=>{\n styles[`${prefix}-${key}`] = typeof offset === 'number' ? `${offset}px` : offset;\n });\n }\n if (typeof offset === 'number' || typeof offset === 'string') {\n assignAll(offset);\n } else if (typeof offset === 'object') {\n [\n 'top',\n 'right',\n 'bottom',\n 'left'\n ].forEach((key)=>{\n if (offset[key] === undefined) {\n styles[`${prefix}-${key}`] = defaultValue;\n } else {\n styles[`${prefix}-${key}`] = typeof offset[key] === 'number' ? `${offset[key]}px` : offset[key];\n }\n });\n } else {\n assignAll(defaultValue);\n }\n });\n return styles;\n}\nfunction useSonner() {\n const [activeToasts, setActiveToasts] = React.useState([]);\n React.useEffect(()=>{\n return ToastState.subscribe((toast)=>{\n if (toast.dismiss) {\n setTimeout(()=>{\n ReactDOM.flushSync(()=>{\n setActiveToasts((toasts)=>toasts.filter((t)=>t.id !== toast.id));\n });\n });\n return;\n }\n // Prevent batching, temp solution.\n setTimeout(()=>{\n ReactDOM.flushSync(()=>{\n setActiveToasts((toasts)=>{\n const indexOfExistingToast = toasts.findIndex((t)=>t.id === toast.id);\n // Update the toast if it already exists\n if (indexOfExistingToast !== -1) {\n return [\n ...toasts.slice(0, indexOfExistingToast),\n {\n ...toasts[indexOfExistingToast],\n ...toast\n },\n ...toasts.slice(indexOfExistingToast + 1)\n ];\n }\n return [\n toast,\n ...toasts\n ];\n });\n });\n });\n });\n }, []);\n return {\n toasts: activeToasts\n };\n}\nconst Toaster = /*#__PURE__*/ React.forwardRef(function Toaster(props, ref) {\n const { id, invert, position = 'bottom-right', hotkey = [\n 'altKey',\n 'KeyT'\n ], expand, closeButton, className, offset, mobileOffset, theme = 'light', richColors, duration, style, visibleToasts = VISIBLE_TOASTS_AMOUNT, toastOptions, dir = getDocumentDirection(), gap = GAP, icons, containerAriaLabel = 'Notifications' } = props;\n const [toasts, setToasts] = React.useState([]);\n const filteredToasts = React.useMemo(()=>{\n if (id) {\n return toasts.filter((toast)=>toast.toasterId === id);\n }\n return toasts.filter((toast)=>!toast.toasterId);\n }, [\n toasts,\n id\n ]);\n const possiblePositions = React.useMemo(()=>{\n return Array.from(new Set([\n position\n ].concat(filteredToasts.filter((toast)=>toast.position).map((toast)=>toast.position))));\n }, [\n filteredToasts,\n position\n ]);\n const [heights, setHeights] = React.useState([]);\n const [expanded, setExpanded] = React.useState(false);\n const [interacting, setInteracting] = React.useState(false);\n const [actualTheme, setActualTheme] = React.useState(theme !== 'system' ? theme : typeof window !== 'undefined' ? window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light' : 'light');\n const listRef = React.useRef(null);\n const hotkeyLabel = hotkey.join('+').replace(/Key/g, '').replace(/Digit/g, '');\n const lastFocusedElementRef = React.useRef(null);\n const isFocusWithinRef = React.useRef(false);\n const removeToast = React.useCallback((toastToRemove)=>{\n setToasts((toasts)=>{\n var _toasts_find;\n if (!((_toasts_find = toasts.find((toast)=>toast.id === toastToRemove.id)) == null ? void 0 : _toasts_find.delete)) {\n ToastState.dismiss(toastToRemove.id);\n }\n return toasts.filter(({ id })=>id !== toastToRemove.id);\n });\n }, []);\n React.useEffect(()=>{\n return ToastState.subscribe((toast)=>{\n if (toast.dismiss) {\n // Prevent batching of other state updates\n requestAnimationFrame(()=>{\n setToasts((toasts)=>toasts.map((t)=>t.id === toast.id ? {\n ...t,\n delete: true\n } : t));\n });\n return;\n }\n // Prevent batching, temp solution.\n setTimeout(()=>{\n ReactDOM.flushSync(()=>{\n setToasts((toasts)=>{\n const indexOfExistingToast = toasts.findIndex((t)=>t.id === toast.id);\n // Update the toast if it already exists\n if (indexOfExistingToast !== -1) {\n return [\n ...toasts.slice(0, indexOfExistingToast),\n {\n ...toasts[indexOfExistingToast],\n ...toast\n },\n ...toasts.slice(indexOfExistingToast + 1)\n ];\n }\n return [\n toast,\n ...toasts\n ];\n });\n });\n });\n });\n }, [\n toasts\n ]);\n React.useEffect(()=>{\n if (theme !== 'system') {\n setActualTheme(theme);\n return;\n }\n if (theme === 'system') {\n // check if current preference is dark\n if (window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches) {\n // it's currently dark\n setActualTheme('dark');\n } else {\n // it's not dark\n setActualTheme('light');\n }\n }\n if (typeof window === 'undefined') return;\n const darkMediaQuery = window.matchMedia('(prefers-color-scheme: dark)');\n try {\n // Chrome & Firefox\n darkMediaQuery.addEventListener('change', ({ matches })=>{\n if (matches) {\n setActualTheme('dark');\n } else {\n setActualTheme('light');\n }\n });\n } catch (error) {\n // Safari < 14\n darkMediaQuery.addListener(({ matches })=>{\n try {\n if (matches) {\n setActualTheme('dark');\n } else {\n setActualTheme('light');\n }\n } catch (e) {\n console.error(e);\n }\n });\n }\n }, [\n theme\n ]);\n React.useEffect(()=>{\n // Ensure expanded is always false when no toasts are present / only one left\n if (toasts.length <= 1) {\n setExpanded(false);\n }\n }, [\n toasts\n ]);\n React.useEffect(()=>{\n const handleKeyDown = (event)=>{\n var _listRef_current;\n const isHotkeyPressed = hotkey.every((key)=>event[key] || event.code === key);\n if (isHotkeyPressed) {\n var _listRef_current1;\n setExpanded(true);\n (_listRef_current1 = listRef.current) == null ? void 0 : _listRef_current1.focus();\n }\n if (event.code === 'Escape' && (document.activeElement === listRef.current || ((_listRef_current = listRef.current) == null ? void 0 : _listRef_current.contains(document.activeElement)))) {\n setExpanded(false);\n }\n };\n document.addEventListener('keydown', handleKeyDown);\n return ()=>document.removeEventListener('keydown', handleKeyDown);\n }, [\n hotkey\n ]);\n React.useEffect(()=>{\n if (listRef.current) {\n return ()=>{\n if (lastFocusedElementRef.current) {\n lastFocusedElementRef.current.focus({\n preventScroll: true\n });\n lastFocusedElementRef.current = null;\n isFocusWithinRef.current = false;\n }\n };\n }\n }, [\n listRef.current\n ]);\n return(// Remove item from normal navigation flow, only available via hotkey\n /*#__PURE__*/ React.createElement(\"section\", {\n ref: ref,\n \"aria-label\": `${containerAriaLabel} ${hotkeyLabel}`,\n tabIndex: -1,\n \"aria-live\": \"polite\",\n \"aria-relevant\": \"additions text\",\n \"aria-atomic\": \"false\",\n suppressHydrationWarning: true\n }, possiblePositions.map((position, index)=>{\n var _heights_;\n const [y, x] = position.split('-');\n if (!filteredToasts.length) return null;\n return /*#__PURE__*/ React.createElement(\"ol\", {\n key: position,\n dir: dir === 'auto' ? getDocumentDirection() : dir,\n tabIndex: -1,\n ref: listRef,\n className: className,\n \"data-sonner-toaster\": true,\n \"data-sonner-theme\": actualTheme,\n \"data-y-position\": y,\n \"data-x-position\": x,\n style: {\n '--front-toast-height': `${((_heights_ = heights[0]) == null ? void 0 : _heights_.height) || 0}px`,\n '--width': `${TOAST_WIDTH}px`,\n '--gap': `${gap}px`,\n ...style,\n ...assignOffset(offset, mobileOffset)\n },\n onBlur: (event)=>{\n if (isFocusWithinRef.current && !event.currentTarget.contains(event.relatedTarget)) {\n isFocusWithinRef.current = false;\n if (lastFocusedElementRef.current) {\n lastFocusedElementRef.current.focus({\n preventScroll: true\n });\n lastFocusedElementRef.current = null;\n }\n }\n },\n onFocus: (event)=>{\n const isNotDismissible = event.target instanceof HTMLElement && event.target.dataset.dismissible === 'false';\n if (isNotDismissible) return;\n if (!isFocusWithinRef.current) {\n isFocusWithinRef.current = true;\n lastFocusedElementRef.current = event.relatedTarget;\n }\n },\n onMouseEnter: ()=>setExpanded(true),\n onMouseMove: ()=>setExpanded(true),\n onMouseLeave: ()=>{\n // Avoid setting expanded to false when interacting with a toast, e.g. swiping\n if (!interacting) {\n setExpanded(false);\n }\n },\n onDragEnd: ()=>setExpanded(false),\n onPointerDown: (event)=>{\n const isNotDismissible = event.target instanceof HTMLElement && event.target.dataset.dismissible === 'false';\n if (isNotDismissible) return;\n setInteracting(true);\n },\n onPointerUp: ()=>setInteracting(false)\n }, filteredToasts.filter((toast)=>!toast.position && index === 0 || toast.position === position).map((toast, index)=>{\n var _toastOptions_duration, _toastOptions_closeButton;\n return /*#__PURE__*/ React.createElement(Toast, {\n key: toast.id,\n icons: icons,\n index: index,\n toast: toast,\n defaultRichColors: richColors,\n duration: (_toastOptions_duration = toastOptions == null ? void 0 : toastOptions.duration) != null ? _toastOptions_duration : duration,\n className: toastOptions == null ? void 0 : toastOptions.className,\n descriptionClassName: toastOptions == null ? void 0 : toastOptions.descriptionClassName,\n invert: invert,\n visibleToasts: visibleToasts,\n closeButton: (_toastOptions_closeButton = toastOptions == null ? void 0 : toastOptions.closeButton) != null ? _toastOptions_closeButton : closeButton,\n interacting: interacting,\n position: position,\n style: toastOptions == null ? void 0 : toastOptions.style,\n unstyled: toastOptions == null ? void 0 : toastOptions.unstyled,\n classNames: toastOptions == null ? void 0 : toastOptions.classNames,\n cancelButtonStyle: toastOptions == null ? void 0 : toastOptions.cancelButtonStyle,\n actionButtonStyle: toastOptions == null ? void 0 : toastOptions.actionButtonStyle,\n closeButtonAriaLabel: toastOptions == null ? void 0 : toastOptions.closeButtonAriaLabel,\n removeToast: removeToast,\n toasts: filteredToasts.filter((t)=>t.position == toast.position),\n heights: heights.filter((h)=>h.position == toast.position),\n setHeights: setHeights,\n expandByDefault: expand,\n gap: gap,\n expanded: expanded,\n swipeDirections: props.swipeDirections\n });\n }));\n })));\n});\n\nexport { Toaster, toast, useSonner };\n"],"names":["assign","searchParamsToUrlQuery","urlQueryToSearchParams","searchParams","query","key","value","entries","existing","Array","isArray","push","stringifyUrlQueryParam","param","isNaN","String","URLSearchParams","Object","item","append","set","target","searchParamsList","keys","delete","formatUrl","formatWithValidation","urlObjectKeys","slashedProtocols","urlObj","auth","hostname","protocol","pathname","hash","host","encodeURIComponent","replace","indexOf","port","querystring","search","endsWith","slashes","test","url","process","env","NODE_ENV","forEach","includes","console","warn","useMergedRef","refA","refB","cleanupA","useRef","cleanupB","useCallback","current","cleanupFnA","cleanupFnB","applyRef","cleanup","DecodeError","MiddlewareNotFoundError","MissingStaticPage","NormalizeError","PageNotFoundError","SP","ST","WEB_VITALS","execOnce","getDisplayName","getLocationOrigin","getURL","isAbsoluteUrl","isResSent","loadGetInitialProps","normalizeRepeatedSlashes","stringifyError","fn","used","result","args","ABSOLUTE_URL_REGEX","window","location","href","origin","substring","length","Component","displayName","name","res","finished","headersSent","urlParts","split","urlNoQuery","slice","join","App","ctx","prototype","getInitialProps","message","Error","pageProps","props","performance","every","method","constructor","page","code","error","JSON","stringify","stack","parsePath","path","hashIndex","queryIndex","hasQuery","undefined","addPathPrefix","prefix","startsWith","removeTrailingSlash","route","normalizePathTrailingSlash","__NEXT_MANUAL_TRAILING_SLASH","__NEXT_TRAILING_SLASH","addBasePath","basePath","__NEXT_ROUTER_BASEPATH","required","__NEXT_MANUAL_CLIENT_BASE_PATH","warnOnce","_","warnings","Set","msg","has","add","FetchStrategy","NavigationResultTag","PrefetchPriority","createCacheKey","originalHref","nextUrl","originalUrl","URL","cacheKey","HasLoadingBoundary","matchSegment","existingSegment","segment","ACTION_HEADER","FLIGHT_HEADERS","NEXT_ACTION_NOT_FOUND_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","ACTION_HMR_REFRESH","ACTION_NAVIGATE","ACTION_REFRESH","ACTION_RESTORE","ACTION_SERVER_ACTION","ACTION_SERVER_PATCH","PrefetchKind","isThenable","promise","then","dispatchAppRouterAction","useActionQueue","dispatch","action","__DEV__","promisesWithDebugInfo","WeakMap","actionQueue","state","setState","React","useState","useAppDevRenderingIndicator","require","appDevRenderingIndicator","stateWithDebugInfo","useMemo","promiseWithDebugInfo","get","debugInfo","Promise","resolve","asyncState","_debugInfo","use","callServer","actionId","actionArgs","reject","startTransition","type","findSourceMapURL","filename","document","DEFAULT_SEGMENT_KEY","PAGE_SEGMENT_KEY","addSearchParamsIfPageSegment","computeSelectedLayoutSegment","getSegmentValue","getSelectedLayoutSegmentPath","isGroupSegment","isParallelRouteSegment","isPageSegment","stringifiedQuery","segments","parallelRouteKey","rawSegment","tree","first","segmentPath","node","parallelRoutes","children","values","segmentValue","HEAD_REQUEST_KEY","ROOT_SEGMENT_REQUEST_KEY","appendSegmentRequestKeyPart","convertSegmentPathToStaticExportFilename","createSegmentRequestKeyPart","safeName","encodeToFilesystemAndURLSafeString","paramType","encodedName","parentRequestKey","childRequestKeyPart","slotKey","simpleParamValueRegex","base64url","btoa","doesStaticSegmentAppearInURL","getCacheKeyForDynamicParam","getParamValueFromCacheKey","getRenderedPathname","getRenderedSearch","parseDynamicParamFromURLPart","urlSearchParamsToParsedUrlQuery","urlToUrlWithoutFlightMarker","response","rewrittenQuery","headers","rewrittenPath","pathnameParts","partIndex","map","s","i","paramValue","renderedSearch","pageSegmentWithSearchParams","fromEntries","urlWithoutFlightParameters","__NEXT_CONFIG_OUTPUT","paramCacheKey","isCatchAll","createHrefFromUrl","includeHash","createInitialRSCPayloadFromFallbackPrerender","getFlightDataPartsFromPath","getNextFlightSegmentPath","normalizeFlightData","prepareFlightRouterStateForRequest","flightDataPath","flightDataPathLength","seedData","head","isHeadPartial","pathToSegment","isRootRender","fallbackInitialRSCPayload","renderedPathname","canonicalUrl","originalFlightDataPath","f","originalFlightRouterState","b","c","q","fillInFallbackFlightRouterState","m","G","S","flightRouterState","filter","p","index","fillInFallbackFlightRouterStateImpl","pathnamePartsIndex","originalSegment","newSegment","doesAppearInURL","paramName","childPathnamePartsIndex","newChildren","childFlightRouterState","newState","flightSegmentPath","flightData","isHmrRefresh","stripClientOnlyDataFromFlightRouterState","_url","refreshMarker","isRootLayout","hasLoadingBoundary","cleanedSegment","stripSearchParamsFromPageSegment","cleanedParallelRoutes","childState","shouldPreserveRefreshMarker","Boolean","getAppBuildId","setAppBuildId","globalBuildId","buildId","djb2Hash","hexHash","str","char","charCodeAt","toString","computeCacheBustingSearchParam","prefetchHeader","segmentPrefetchHeader","stateTreeHeader","nextUrlHeader","setCacheBustingSearchParam","setCacheBustingSearchParamWithHash","uniqueCacheKey","existingSearch","rawQuery","pairs","pair","createFetch","createFromNextReadableStream","fetchServerResponse","createFromReadableStream","createFromReadableStreamBrowser","createFromFetch","createFromFetchBrowser","createDebugChannel","__NEXT_REACT_DEBUG_CHANNEL","doMpaNavigation","isPageUnloading","addEventListener","options","prefetchKind","AUTO","fetchPriority","TEMPORARY","isLegacyPPR","__NEXT_PPR","__NEXT_CACHE_COMPONENTS","shouldImmediatelyDecode","responseUrl","redirected","contentType","interception","postponed","staleTimeHeaderSeconds","staleTime","parseInt","isFlightResponse","ok","body","TURBOPACK","waitForWebpackRuntimeHotUpdate","flightResponsePromise","flightResponse","flightStream","createUnclosingPrefetchStream","normalizedFlightData","couldBeIntercepted","prerendered","err","signal","__NEXT_TEST_MODE","NEXT_DEPLOYMENT_ID","self","__next_r","crypto","getRandomValues","Uint32Array","fetchOptions","credentials","priority","fetchUrl","fetchPromise","fetch","createFromNextFetch","browserResponse","__NEXT_CLIENT_VALIDATE_RSC_REQUEST_HEADERS","MAX_REDIRECTS","n","rscResponse","status","requestHeaders","debugChannel","promiseForResponse","originalFlightStream","reader","getReader","ReadableStream","pull","controller","done","read","enqueue","deleteFromLru","lruPut","updateLruSize","didScheduleCleanup","lruSize","maxLruSize","prev","next","size","ensureCleanupIsScheduled","tail","newNodeSize","prevNodeSize","deleted","requestCleanupCallback","ninetyPercentMax","deleteFromCacheMap","requestIdleCallback","cb","setTimeout","Fallback","createCacheMap","getFromCacheMap","isValueExpired","setInCacheMap","setSizeInCacheMap","Revalidation","cacheMap","parent","getOrInitialize","isRevalidation","entry","remainingKeys","previousKey","existingEntry","Map","newEntry","now","currentCacheVersion","rootEntry","getEntryWithFallbackImpl","staleAt","version","lazilyEvictIfNeeded","deleteMapEntry","fallbackEntry","setMapEntryValue","dropRef","emptyEntry","fillEmptyReference","oldEntry","ref","fullEntry","parentMap","revalidatingEntry","appendLayoutVaryPath","clonePageVaryPathWithNewSearchParams","finalizeLayoutVaryPath","finalizeMetadataVaryPath","finalizePageVaryPath","getFulfilledRouteVaryPath","getRouteVaryPath","getSegmentVaryPathForRequest","varyPath","parentPath","varyPathPart","requestKey","layoutVaryPath","pageVaryPath","pageRequestKey","fetchStrategy","originalVaryPath","isPage","doesVaryOnSearchParams","Full","PPRRuntime","searchParamsVaryPath","pathParamsVaryPath","patchedVaryPath","newSearch","clonedVaryPath","ensureLeadingSlash","normalizeAppPath","normalizeRscURL","reduce","INTERCEPTION_ROUTE_MARKERS","extractInterceptionRouteInformation","isInterceptionRouteAppPath","find","interceptingRoute","marker","interceptedRoute","concat","splitInterceptingRoute","computeChangedPath","extractPathFromFlightRouterState","getSelectedParams","removeLeadingSlash","segmentToPathname","normalizeSegments","acc","some","childrenPath","childPath","computeChangedPathImpl","treeA","treeB","segmentA","parallelRoutesA","segmentB","parallelRoutesB","normalizedSegmentA","normalizedSegmentB","parallelRouterKey","changedPath","currentTree","params","parallelRoute","isDynamicParameter","handleMutable","isNotUndefined","mutable","shouldScroll","previousNextUrl","patchedTree","pushRef","pendingPush","mpaNavigation","preserveCustomHistoryState","focusAndScrollRef","apply","scrollableSegments","onlyHashChange","hashFragment","decodeURIComponent","segmentPaths","cache","collectedDebugInfo","createRouterCacheKey","withoutSearchParameters","isNavigatingToNewRootLayout","nextTree","currentTreeSegment","nextTreeSegment","currentTreeChild","nextTreeChild","abortTask","listenForDynamicRequest","startPPRNavigation","updateCacheNodeOnPopstateRestoration","MPA_NAVIGATION_TASK","dynamicRequestTree","navigatedAt","oldUrl","oldCacheNode","oldRouterState","newRouterState","prefetchData","prefetchHead","isPrefetchHeadPartial","isSamePageNavigation","scrollableSegmentsResult","updateCacheNodeOnNavigation","didFindRootLayout","oldRouterStateChildren","newRouterStateChildren","prefetchDataChildren","oldParallelRoutes","prefetchParallelRoutes","patchedRouterStateChildren","taskChildren","needsDynamicRequest","dynamicRequestTreeChildren","newRouterStateChild","oldRouterStateChild","oldSegmentMapChild","prefetchDataChild","newSegmentChild","newSegmentPathChild","newSegmentKeyChild","oldSegmentChild","oldCacheNodeChild","taskChild","reuseActiveSegmentInDefaultSlot","beginRenderingNewRouteTree","newCacheNodeChild","newSegmentMapChild","taskChildRoute","dynamicRequestTreeChild","newCacheNode","lazyData","rsc","prefetchRsc","loading","patchRouterStateWithNewChildren","existingCacheNode","possiblyPartialPrefetchHead","createCacheNodeOnNavigation","routerState","routerStateChildren","isLeafSegment","cacheNodeNavigatedAt","DYNAMIC_STALETIME_MS","isPrefetchRscPartial","spawnPendingTask","existingCacheNodeChildren","cacheNodeChildren","routerStateChild","existingSegmentMapChild","segmentChild","segmentPathChild","segmentKeyChild","existingCacheNodeChild","baseRouterState","clone","newTask","createPendingCacheNode","reusedRouterState","oldRefreshMarker","task","responsePromise","serverRouterState","dynamicData","dynamicHead","writeDynamicDataIntoPendingTask","rootTask","taskSegment","finishTaskUsingDynamicDataPayload","taskNode","finishPendingCacheNode","serverChildren","dynamicDataChildren","serverRouterStateChild","dynamicDataChild","maybePrefetchRsc","createDeferredRsc","cacheNode","taskState","serverState","taskStateChildren","serverStateChildren","dataChildren","taskStateChild","serverStateChild","dataChild","segmentMapChild","taskSegmentChild","taskSegmentKeyChild","cacheNodeChild","abortPendingCacheNode","dynamicSegmentData","isDeferredRsc","dynamicLoading","newParallelRoutes","shouldUsePrefetch","DEFERRED","Symbol","tag","pendingRsc","rej","responseDebugInfo","fulfilledRsc","rejectedRsc","reason","navigate","currentUrl","currentCacheNode","currentFlightRouterState","accumulation","Date","readRouteCacheEntry","EntryStatus","Fulfilled","snapshot","readRenderSnapshotFromCache","prefetchFlightRouterState","prefetchSeedData","headSnapshot","readHeadSnapshotFromCache","isPartial","newCanonicalUrl","navigateUsingPrefetchedRouteTree","Rejected","optimisticRoute","requestOptimisticRouteCacheEntry","newRenderedSearch","Async","data","navigateDynamicallyWithNoPrefetch","promiseForDynamicServerResponse","navigationTaskToResult","NoOp","MPA","Success","childRouterStates","childSeedDatas","slots","childTree","childResult","segmentEntry","readSegmentCacheEntry","Pending","promiseForFulfilledEntry","waitForSegmentCacheEntry","Empty","hasRuntimePrefetch","metadata","newUrl","debugInfoFromResponse","simulatePrefetchTreeUsingDynamicTreePatch","hasDynamicHoles","baseTree","treePatch","canMutateInPlace","simulatePrefetchTreeUsingDynamicTreePatchImpl","patch","updatedParallelRouteKey","baseChildren","childBaseRouterState","STATIC_STALETIME_MS","generateSegmentsFromPatch","handleExternalUrl","navigateReducer","Number","__NEXT_CLIENT_ROUTER_DYNAMIC_STALETIME","getStaleTimeMs","__NEXT_CLIENT_ROUTER_STATIC_STALETIME","flightRouterPatch","childSegment","handleNavigationResult","asyncResult","isExternalUrl","navigateType","getElementById","navigateUsingSegmentCache","DOC_PREFETCH_RANGE_HEADER_VALUE","doesExportedHtmlMatchBuildId","insertBuildIdComment","DOCTYPE_PREFIX","MAX_BUILD_ID_LENGTH","escapeBuildId","truncated","originalHtml","partialHtmlDocument","createPromiseWithResolvers","canNewFetchStrategyProvideMoreContent","convertRouteTreeToFlightRouterState","createDetachedSegmentCacheEntry","fetchRouteOnCacheMiss","fetchSegmentOnCacheMiss","fetchSegmentPrefetchesUsingDynamicRequest","getCurrentCacheVersion","overwriteRevalidatingSegmentCacheEntry","pingInvalidationListeners","readOrCreateRevalidatingSegmentEntry","readOrCreateRouteCacheEntry","readOrCreateSegmentCacheEntry","revalidateEntireCache","upgradeToPendingSegment","upsertSegmentEntry","staleTimeSeconds","Math","max","isOutputExportMode","MetadataOnlyRequestTree","routeCacheMap","segmentCacheMap","invalidationListeners","startRevalidationCooldown","pingVisibleLinks","attachInvalidationListener","onInvalidate","notifyInvalidationListener","reportError","tasks","isPrefetchTaskDirty","readRevalidatingSegmentCacheEntry","pendingEntry","promiseWithResolvers","blockedTasks","isPPREnabled","Infinity","requestedUrl","requestedSearch","urlWithoutSearchParams","routeWithNoSearchParams","createPrefetchRequestKey","canonicalUrlForRouteWithNoSearchParams","optimisticCanonicalSearch","optimisticRenderedSearch","optimisticUrl","optimisticCanonicalUrl","optimisticRouteTree","createOptimisticRouteTree","optimisticMetadataTree","optimisticEntry","clonedSlots","originalSlots","varyPathForRequest","candidateEntry","rejectedEntry","PPR","pingBlockedTasks","pingPrefetchTask","fulfillRouteCacheEntry","metadataVaryPath","SubtreeHasNoLoadingBoundary","fulfilledEntry","fulfillSegmentCacheEntry","segmentCacheEntry","rejectRouteCacheEntry","rejectSegmentCacheEntry","convertRootTreePrefetchToRouteTree","rootTree","rootSegment","convertTreePrefetchToRouteTree","prefetch","partialVaryPath","prefetchSlots","childPrefetch","childParamName","childParamType","childServerSentParamKey","paramKey","childDoesAppearInURL","childPartialVaryPath","childParamValue","childParamKey","childRequestKey","SegmentHasLoadingBoundary","convertRootFlightRouterStateToRouteTree","convertFlightRouterStateToRouteTree","parentPartialVaryPath","childRouterState","routeTree","urlAfterRedirects","htmlResponse","Range","partialHtml","text","fetchPrefetchResponse","addSegmentPathToUrlInOutputExportMode","varyHeader","closed","routeIsPPREnabled","prefetchStream","createPrefetchResponseStream","onResponseSizeUpdate","serverData","staleTimeMs","writeDynamicTreeResponseIntoCache","LoadingBoundary","fulfilledVaryPath","routeKey","normalizedRequestKey","requestUrl","spawnedEntries","rejectSegmentEntriesIfStillPending","fulfilledEntries","totalBytesReceivedSoFar","averageSize","isResponsePartial","rp","writeDynamicRenderResponseIntoCache","normalizedFlightDataResult","flightDatas","writeSeedDataIntoCache","fulfillEntrySpawnedByRuntimePrefetch","entriesOwnedByCurrentTask","seedDataChildren","childSeedData","ownedEntry","possiblyNewEntry","onStreamClose","totalByteLength","byteLength","staticUrl","routeDir","staticExportFilename","currentStrategy","newStrategy","cancelPrefetchTask","reschedulePrefetchTask","schedulePrefetchTask","scheduleMicrotask","queueMicrotask","catch","taskHeap","inProgressRequests","sortIdCounter","didScheduleMicrotask","mostRecentlyHoveredLink","REVALIDATION_COOLDOWN_MS","revalidationCooldownTimeoutHandle","clearTimeout","ensureWorkIsScheduled","treeAtTimeOfPrefetch","cacheVersion","phase","hasBackgroundWork","spawnedRuntimePrefetches","sortId","isCanceled","_heapIndex","trackMostRecentlyHoveredLink","heapPush","heapDelete","Intent","heapResift","Background","Default","processQueueInMicrotask","hasNetworkBandwidth","spawnPrefetchSubtask","prefetchSubtask","onPrefetchConnectionClosed","heapPeek","exitStatus","pingRoute","heapPop","background","pingRootRouteTree","keyWithoutSearch","routeWithoutSearch","pingStaticHead","pingSharedPartOfCacheComponentsTree","pingRuntimeHead","requestTree","pingRuntimePrefetches","diffRouteTreeAgainstCurrent","pingStaticSegmentData","pingRouteTreeAndIncludeDynamicData","oldTree","newTree","oldTreeChildren","newTreeChildren","newTreeChild","newTreeChildSegment","oldTreeChild","oldTreeChildSegment","childExitStatus","doesCurrentSegmentMatchCachedSegment","pingNewPartOfCacheComponentsTree","requestTreeChildren","requestTreeChild","subtreeHasLoadingBoundary","pingPPRDisabledRouteTreeUpToLoadingBoundary","refetchMarkerContext","refetchMarker","segmentHasLoadingBoundary","isInsideRefetchingParent","spawnedSegment","pingFullSegmentRevalidation","pingPPRSegmentRevalidation","revalidatingSegment","upsertSegmentOnCompletion","pendingSegment","nonEmptyRevalidatingSegment","emptySegment","noop","fulfilled","currentSegment","cachedSegment","compareQueuePriority","a","priorityDiff","phaseDiff","heap","heapSiftUp","last","pop","heapSiftDown","parentIndex","halfLength","leftIndex","left","rightIndex","right","IDLE_LINK_STATUS","PENDING_LINK_STATUS","mountFormInstance","mountLinkInstance","onLinkVisibilityChanged","onNavigationIntent","setLinkForCurrentNavigation","unmountLinkForCurrentNavigation","unmountPrefetchableInstance","linkForMostRecentNavigation","pending","link","setOptimisticLinkStatus","prefetchable","prefetchableAndVisible","observer","IntersectionObserver","handleIntersect","rootMargin","observeVisibility","element","instance","existingInstance","observe","coercePrefetchableUrl","createPrefetchURL","reportErrorFn","router","prefetchEnabled","prefetchURL","isVisible","prefetchTask","prefetchHref","unobserve","intersectionRatio","rescheduleLinkPrefetch","unstable_upgradeToDynamicPrefetch","__NEXT_DYNAMIC_ON_HOVER","existingPrefetchTask","getCurrentAppRouterState","appRouterState","scheduleSegmentPrefetchTask","pathHasPrefix","hasBasePath","isLocalURL","locationOrigin","resolved","errorOnce","errors","LinkComponent","useLinkStatus","isModifiedEvent","event","eventTarget","currentTarget","getAttribute","metaKey","ctrlKey","shiftKey","altKey","nativeEvent","which","linkClicked","e","as","linkInstanceRef","scroll","onNavigate","nodeName","isAnchorNodeName","toUpperCase","hasAttribute","preventDefault","isDefaultPrevented","dispatchNavigateAction","formatStringOrUrl","urlObjOrString","linkStatus","useOptimistic","hrefProp","asProp","childrenProp","prefetchProp","passHref","shallow","onClick","onMouseEnter","onMouseEnterProp","onTouchStart","onTouchStartProp","legacyBehavior","forwardedRef","unstable_dynamicOnHover","restProps","useContext","AppRouterContext","getFetchStrategyFromPrefetchProp","createPropError","expected","actual","requiredPropsGuard","requiredProps","optionalPropsGuard","optionalProps","valType","locale","hasDynamicSegment","resolvedHref","child","$$typeof","for","Children","only","childRef","observeLinkVisibilityOnMount","mergedRef","childProps","defaultPrevented","upgradeToDynamicPrefetch","__NEXT_LINK_NO_TOUCH_START","cloneElement","LinkStatusContext","Provider","createContext","ReadonlyURLSearchParams","ReadonlyURLSearchParamsError","sort","UnrecognizedActionError","unstable_isUnrecognizedActionError","RedirectStatusCode","REDIRECT_ERROR_CODE","RedirectType","isRedirectError","digest","errorCode","destination","at","statusCode","getRedirectError","getRedirectStatusCodeFromError","getRedirectTypeFromError","getURLFromRedirectError","permanentRedirect","redirect","actionAsyncStorage","TemporaryRedirect","getStore","isAction","PermanentRedirect","HTTPAccessErrorStatus","HTTP_ERROR_FALLBACK_ERROR_CODE","getAccessFallbackErrorTypeByStatus","getAccessFallbackHTTPStatus","isHTTPAccessFallbackError","NOT_FOUND","FORBIDDEN","UNAUTHORIZED","ALLOWED_CODES","httpStatus","notFound","DIGEST","forbidden","__NEXT_EXPERIMENTAL_AUTH_INTERRUPTS","unauthorized","isHangingPromiseRejectionError","makeDevtoolsIOAwarePromise","makeHangingPromise","HANGING_PROMISE_REJECTION","HangingPromiseRejectionError","expression","abortListenersBySignal","aborted","hangingPromise","boundRejection","bind","currentListeners","listeners","once","ignoreReject","underlying","requestStore","stage","stagedRendering","delayUntilStage","isPostpone","REACT_POSTPONE_TYPE","BailoutToCSRError","isBailoutToCSRError","BAILOUT_TO_CSR","isNextRouterError","DynamicServerError","isDynamicServerError","DYNAMIC_ERROR_CODE","description","StaticGenBailoutError","isStaticGenBailoutError","NEXT_STATIC_GEN_BAILOUT","METADATA_BOUNDARY_NAME","OUTLET_BOUNDARY_NAME","ROOT_LAYOUT_BOUNDARY_NAME","VIEWPORT_BOUNDARY_NAME","atLeastOneTask","scheduleImmediate","scheduleOnNextTick","waitAtLeastOneReactRenderTask","NEXT_RUNTIME","nextTick","setImmediate","r","InvariantError","RenderStage","StagedRenderingController","abortSignal","currentStage","runtimeStagePromise","dynamicStagePromise","advanceStage","getStagePromise","waitForStage","resolvedValue","ioTriggerPromise","makeDevtoolsIOPromiseFromIOTrigger","ioTrigger","Postpone","PreludeState","abortAndThrowOnSynchronousRequestDataAccess","abortOnSynchronousPlatformIOAccess","accessedDynamicData","annotateDynamicAccess","consumeDynamicAccess","createDynamicTrackingState","createDynamicValidationState","createHangingInputAbortSignal","createRenderInBrowserAbortSignal","delayUntilRuntimeStage","formatDynamicAPIAccesses","getFirstDynamicReason","isDynamicPostpone","isPrerenderInterruptedError","logDisallowedDynamicError","markCurrentScopeAsDynamic","postponeWithTracking","throwIfDisallowedDynamic","throwToInterruptStaticGeneration","trackAllowedDynamicAccess","trackDynamicDataInDynamicRender","trackSynchronousPlatformIOAccessInDev","useDynamicRouteParams","useDynamicSearchParams","hasPostpone","unstable_postpone","isDebugDynamicAccesses","dynamicAccesses","syncDynamicErrorWithStack","hasSuspenseAboveBody","hasDynamicMetadata","hasDynamicViewport","hasAllowedDynamic","dynamicErrors","trackingState","store","workUnitStore","forceDynamic","forceStatic","dynamicShouldError","dynamicTracking","revalidate","dynamicUsageDescription","dynamicUsageStack","usedDynamic","prerenderStore","abortOnSynchronousDynamicDataAccess","createPrerenderInterruptedError","abort","errorWithStack","Dynamic","prerenderSignal","workUnitAsyncStorage","assertPostpone","createPostponeReason","isDynamicPostponeReason","NEXT_PRERENDER_INTERRUPTED","serverDynamic","clientDynamic","access","line","AbortController","cacheSignal","inputReady","getRuntimeStagePromise","workStore","workAsyncStorage","fallbackParams","fallbackRouteParams","renderSignal","throwForMissingRequestStore","hasSuspenseRegex","bodyAndImplicitTags","hasSuspenseBeforeRootLayoutWithoutBodyOrImplicitBodyRegex","RegExp","hasMetadataRegex","hasViewportRegex","hasOutletRegex","componentStack","dynamicValidation","createErrorWithComponentOrOwnerStack","ownerStack","captureOwnerStack","dev","hasReadableErrorStacks","prelude","unstable_rethrow","cause","ServerInsertedHTMLContext","useParams","usePathname","useRouter","useSearchParams","useSelectedLayoutSegment","useSelectedLayoutSegments","useServerInsertedHTML","SearchParamsContext","readonlySearchParams","navigationPromises","NavigationPromisesContext","PathnameContext","PathParamsContext","context","LayoutRouterContext","selectedLayoutSegmentsPromises","parentTree","selectedLayoutSegments","selectedLayoutSegmentPromises","CLASS_PART_SEPARATOR","createClassGroupUtils","config","classMap","createClassMap","conflictingClassGroupModifiers","getClassGroupId","className","classParts","shift","getGroupRecursive","getGroupIdForArbitraryProperty","getConflictingClassGroupIds","classGroupId","hasPostfixModifier","conflicts","conflictingClassGroups","classPartObject","currentClassPart","nextClassPartObject","nextPart","classGroupFromNextClassPart","validators","classRest","validator","arbitraryPropertyRegex","arbitraryPropertyClassName","exec","property","prefixedClassGroupEntries","getPrefixedClassGroupEntries","classGroups","classGroup","processClassesRecursively","theme","classDefinition","classPartObjectToEdit","getPart","isThemeGetter","currentClassPartObject","pathPart","func","classGroupEntries","prefixedClassGroup","createLruCache","maxCacheSize","cacheSize","previousCache","update","IMPORTANT_MODIFIER","createParseClassName","experimentalParseClassName","isSeparatorSingleCharacter","separator","firstSeparatorCharacter","separatorLength","parseClassName","modifiers","bracketDepth","modifierStart","postfixModifierPosition","currentCharacter","baseClassNameWithImportantModifier","hasImportantModifier","baseClassName","maybePostfixModifierPosition","sortModifiers","sortedModifiers","unsortedModifiers","modifier","isArbitraryVariant","createConfigUtils","SPLIT_CLASSES_REGEX","mergeClassList","classList","configUtils","classGroupsInConflict","classNames","trim","originalClassName","variantModifier","modifierId","classId","conflictGroups","group","twJoin","argument","string","arguments","toValue","mix","k","createTailwindMerge","createConfigFirst","createConfigRest","cacheGet","cacheSet","functionToCall","initTailwindMerge","previousConfig","createConfigCurrent","tailwindMerge","cachedResult","callTailwindMerge","fromTheme","themeGetter","arbitraryValueRegex","fractionRegex","stringLengths","tshirtUnitRegex","lengthUnitRegex","colorFunctionRegex","shadowRegex","imageRegex","isLength","isNumber","isArbitraryLength","getIsArbitraryValue","isLengthOnly","isArbitraryNumber","isInteger","isPercent","isArbitraryValue","isTshirtSize","sizeLabels","isArbitrarySize","isNever","isArbitraryPosition","imageLabels","isArbitraryImage","isImage","isArbitraryShadow","isShadow","isAny","label","testValue","getDefaultConfig","colors","spacing","blur","brightness","borderColor","borderRadius","borderSpacing","borderWidth","contrast","grayscale","hueRotate","invert","gap","gradientColorStops","gradientColorStopPositions","inset","margin","opacity","padding","saturate","scale","sepia","skew","space","translate","getOverscroll","getOverflow","getSpacingWithAutoAndArbitrary","getSpacingWithArbitrary","getLengthWithEmptyAndArbitrary","getNumberWithAutoAndArbitrary","getPositions","getLineStyles","getBlendModes","getAlign","getZeroAndEmpty","getBreaks","getNumberAndArbitrary","aspect","container","columns","box","display","float","clear","isolation","object","overflow","overscroll","position","start","end","top","bottom","visibility","z","basis","flex","grow","shrink","order","col","span","row","justify","content","items","px","py","ps","pe","pt","pr","pb","pl","mx","my","ms","me","mt","mr","mb","ml","w","screen","h","font","tracking","leading","list","placeholder","decoration","indent","align","whitespace","break","hyphens","bg","repeat","from","via","to","rounded","border","divide","outline","ring","shadow","table","caption","transition","duration","ease","delay","animate","transform","rotate","accent","appearance","cursor","caret","resize","snap","touch","select","fill","stroke","sr","mergeConfigs","baseConfig","extend","override","overrideProperty","configKey","overrideConfigProperties","mergeConfigProperties","baseObject","overrideKey","overrideValue","overrideObject","mergeObject","mergeValue","extendTailwindMerge","configExtension","createConfig","twMerge","createServerReference"],"mappings":"4CAEA,SAAS,EAAyB,CAAW,EACzC,GAAuB,YAAnB,OAAO,QAAwB,OAAO,KAE1C,IAAI,EAAoB,IAAI,QACxB,EAAmB,IAAI,QAE3B,MAAO,AAAC,GAA2B,SAAS,CAAW,EACnD,OAAO,EAAc,EAAmB,EAC5C,CAAC,CAAE,EACP,CA0BA,EAAQ,CAAC,CAzBT,EAyBY,OAzBH,AAA0B,CAAG,CAAE,CAAW,EAC/C,GAAI,CAAC,GAAe,GAAO,EAAI,UAAU,CAAE,OAAO,EAClD,GAAY,OAAR,GAA+B,UAAf,OAAO,GAAmC,YAAf,OAAO,EAAoB,MAAO,CAAE,QAAS,CAAI,EAEhG,IAAI,EAAQ,EAAyB,GAErC,GAAI,GAAS,EAAM,GAAG,CAAC,GAAM,OAAO,EAAM,GAAG,CAAC,GAE9C,IAAI,EAAS,CAAE,UAAW,IAAK,EAC3B,EAAwB,OAAO,cAAc,EAAI,OAAO,wBAAwB,CAEpF,IAAK,IAAI,KAAO,EACZ,EADiB,CACb,AAAQ,eAAa,OAAO,SAAS,CAAC,cAAc,CAAC,IAAI,CAAC,EAAK,GAAM,CACrE,IAAI,EAAO,EAAwB,OAAO,wBAAwB,CAAC,EAAK,GAAO,KAC3E,IAAS,EAAK,EAAN,CAAS,EAAI,EAAK,GAAA,AAAG,EAAG,OAAO,cAAc,CAAC,EAAQ,EAAK,GAClE,CAAM,CAAC,EAAI,CAAG,CAAG,CAAC,EAAI,AAC/B,CAOJ,OAJA,EAAO,OAAO,CAAG,EAEb,GAAO,EAAM,GAAG,CAAC,EAAK,GAEnB,CACX,wFCYgBA,MAAM,CAAA,kBAANA,GA9CAC,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ACV,gBAAiB,EAAM,eAAe,AAC1C,EACJ,IAnFmC,IAoFvC,GACJ","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,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,120,121,124,125,126,127,128,129,130,131,132,133]}