From 8e4cfc50627cd3e321ef2db4f798e46698a2fbb8 Mon Sep 17 00:00:00 2001
From: Hendrik Liebau
Date: Wed, 29 Apr 2026 10:20:37 +0200
Subject: [PATCH 1/9] Honor the route-level `expire` value with blocking
revalidation (#93211)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
A prerendered route's `expire` — set via `cacheLife({ expire })` inside
`'use cache'` or via the `expireTime` config fallback — lands in the
prerender manifest as `initialExpireSeconds` / `fallbackExpire`
(#76207), but the runtime never read it: `IncrementalCache.get` only
considered `revalidate`. So past expire, Next.js served stale with a
background refresh instead of the blocking regeneration the `cacheLife`
`expire` docs describe.
The fix is three coordinated changes. The render-time
`responseGenerator` in `app-page.ts`, `app-route.ts`, and
`pages-handler.ts` now applies the `expireTime` fallback as soon as it
has the render's `cacheControl`, so every downstream consumer (the cache
stored via `IncrementalCache.set`, the response `Cache-Control` header,
the entry returned to `handleResponse`) sees a finalized `cacheControl`
with a populated `expire` — mirroring the build-time fallback.
`IncrementalCache.get` then returns `isStale = -1` when `lastModified +
expire * 1000 < now`, and `response-cache.handleGet` skips its early
`resolve(previousEntry)` for `isStale === -1` so the blocking
revalidation inside `responseGenerator` (which already picks
`BLOCKING_STATIC_RENDER` on that signal) can return its fresh output to
the user. Previously the early resolve committed the stale value to the
response first, so even though `responseGenerator` still ran a fresh
render its output only warmed the cache for the next request. As a side
effect this also closes the same early-resolve hole on the existing
tag-expired `isStale = -1` path.
On Vercel, ISR cache decisions live at the Proxy and the Proxy currently
ignores `staleExpiration` (using a hard-coded one-year value instead).
It is also expected, once it starts honoring `staleExpiration`, to pick
up updated values from the `stale-while-revalidate` response header.
Until that lands this change is only observable on `next start` —
deploy-mode behavior is tracked independently of Next.js.
Two test suites cover the new behavior.
`test/production/app-dir/use-cache-expire` uses `cacheComponents` +
`cacheLife({ expire: 300 })` with a custom cache handler that shifts
`lastModified` via an `x-test-cache-age-offset-ms` header, exercising
the fully-static shell, the partially-static route shell for a known
param, and the partially-static fallback shell for unknown params.
`test/e2e/app-dir/expire-time` covers classic ISR (`revalidate = 1`,
`expireTime: 2`) with a real three-second wait and is `it.failing` on
deploy, so it will flip the moment the Proxy honors the expire value.
fixes #78269
---
packages/next/src/build/templates/app-page.ts | 19 +++++-
.../next/src/build/templates/app-route.ts | 12 +++-
.../src/server/lib/incremental-cache/index.ts | 53 ++++++++++------
.../next/src/server/response-cache/index.ts | 13 +++-
.../route-modules/pages/pages-handler.ts | 20 +++++-
test/cache-components-tests-manifest.json | 1 +
test/e2e/app-dir/expire-time/app/layout.tsx | 11 ++++
test/e2e/app-dir/expire-time/app/page.tsx | 5 ++
.../app-dir/expire-time/expire-time.test.ts | 63 +++++++++++++++++++
test/e2e/app-dir/expire-time/next.config.js | 10 +++
.../app-dir/use-cache-expire/app/layout.tsx | 11 ++++
.../app/partially-static/[id]/page.tsx | 38 +++++++++++
.../use-cache-expire/app/static/page.tsx | 11 ++++
.../incremental-cache-handler.js | 30 +++++++++
.../app-dir/use-cache-expire/next.config.js | 7 +++
.../use-cache-expire/use-cache-expire.test.ts | 52 +++++++++++++++
16 files changed, 331 insertions(+), 25 deletions(-)
create mode 100644 test/e2e/app-dir/expire-time/app/layout.tsx
create mode 100644 test/e2e/app-dir/expire-time/app/page.tsx
create mode 100644 test/e2e/app-dir/expire-time/expire-time.test.ts
create mode 100644 test/e2e/app-dir/expire-time/next.config.js
create mode 100644 test/production/app-dir/use-cache-expire/app/layout.tsx
create mode 100644 test/production/app-dir/use-cache-expire/app/partially-static/[id]/page.tsx
create mode 100644 test/production/app-dir/use-cache-expire/app/static/page.tsx
create mode 100644 test/production/app-dir/use-cache-expire/incremental-cache-handler.js
create mode 100644 test/production/app-dir/use-cache-expire/next.config.js
create mode 100644 test/production/app-dir/use-cache-expire/use-cache-expire.test.ts
diff --git a/packages/next/src/build/templates/app-page.ts b/packages/next/src/build/templates/app-page.ts
index a333aa84acc1..a31a0b382d2e 100644
--- a/packages/next/src/build/templates/app-page.ts
+++ b/packages/next/src/build/templates/app-page.ts
@@ -943,6 +943,23 @@ export async function handler(
fetchMetrics,
} = metadata
+ // Apply the `expireTime` fallback as soon as we have the render's
+ // `cacheControl`, so every downstream consumer (the cache stored via
+ // `incrementalCache.set`, the response Cache-Control header, the outgoing
+ // entry returned to `handleResponse`) sees a finalized `cacheControl`
+ // with a populated `expire`. This mirrors the build-time fallback in
+ // `build/index.ts` so we don't apply an expire to routes that opt out of
+ // revalidation entirely (`revalidate: false`) or that are dynamic
+ // (`revalidate: 0`).
+ if (
+ cacheControl &&
+ cacheControl.revalidate !== false &&
+ cacheControl.revalidate > 0 &&
+ cacheControl.expire === undefined
+ ) {
+ cacheControl.expire = nextConfig.expireTime
+ }
+
if (cacheTags) {
headers[NEXT_CACHE_TAGS_HEADER] = cacheTags
}
@@ -1605,7 +1622,7 @@ export async function handler(
cacheControl = {
revalidate: cacheEntry.cacheControl.revalidate,
- expire: cacheEntry.cacheControl?.expire ?? nextConfig.expireTime,
+ expire: cacheEntry.cacheControl.expire,
}
}
// Otherwise if the revalidate value is false, then we should use the
diff --git a/packages/next/src/build/templates/app-route.ts b/packages/next/src/build/templates/app-route.ts
index 9d0599202428..0c9ec49dc59e 100644
--- a/packages/next/src/build/templates/app-route.ts
+++ b/packages/next/src/build/templates/app-route.ts
@@ -387,7 +387,17 @@ export async function handler(
const expire =
typeof context.renderOpts.collectedExpire === 'undefined' ||
context.renderOpts.collectedExpire >= INFINITE_CACHE
- ? undefined
+ ? // Fall back to the global `expireTime` config when the
+ // route has a numeric `revalidate` but didn't declare an
+ // explicit `expire` (e.g. via `cacheLife`). This mirrors the
+ // build-time fallback in `build/index.ts` so cache entries
+ // and the response Cache-Control header agree on the route's
+ // effective expire. Routes that opt out of revalidation
+ // (`revalidate: false`) or that are dynamic (`revalidate: 0`)
+ // keep `expire: undefined`.
+ revalidate !== false && revalidate > 0
+ ? nextConfig.expireTime
+ : undefined
: context.renderOpts.collectedExpire
// Create the cache entry for the response.
diff --git a/packages/next/src/server/lib/incremental-cache/index.ts b/packages/next/src/server/lib/incremental-cache/index.ts
index 16fcd8e2ad66..b75d862a07eb 100644
--- a/packages/next/src/server/lib/incremental-cache/index.ts
+++ b/packages/next/src/server/lib/incremental-cache/index.ts
@@ -590,26 +590,39 @@ export class IncrementalCache implements IncrementalCacheType {
ctx.isFallback
)
- isStale =
- revalidateAfter !== false && revalidateAfter < now ? true : undefined
-
- // If the stale time couldn't be determined based on the revalidation
- // time, we check if the tags are expired or stale.
- if (
- isStale === undefined &&
- (cacheData?.value?.kind === CachedRouteKind.APP_PAGE ||
- cacheData?.value?.kind === CachedRouteKind.APP_ROUTE)
- ) {
- const tagsHeader = cacheData.value.headers?.[NEXT_CACHE_TAGS_HEADER]
-
- if (typeof tagsHeader === 'string') {
- const cacheTags = tagsHeader.split(',')
-
- if (cacheTags.length > 0) {
- if (areTagsExpired(cacheTags, lastModified)) {
- isStale = -1
- } else if (areTagsStale(cacheTags, lastModified)) {
- isStale = true
+ // If the route's `expire` time has passed, force a blocking revalidation
+ // by signalling `isStale = -1`. The response cache treats `-1` as "skip
+ // the early SWR resolve" and awaits a fresh render before the user sees a
+ // response.
+ const expireAfter =
+ typeof cacheControl?.expire === 'number'
+ ? cacheControl.expire * 1000 + lastModified
+ : undefined
+
+ if (expireAfter !== undefined && expireAfter < now) {
+ isStale = -1
+ } else {
+ isStale =
+ revalidateAfter !== false && revalidateAfter < now ? true : undefined
+
+ // If the stale time couldn't be determined based on the revalidation
+ // time, we check if the tags are expired or stale.
+ if (
+ isStale === undefined &&
+ (cacheData?.value?.kind === CachedRouteKind.APP_PAGE ||
+ cacheData?.value?.kind === CachedRouteKind.APP_ROUTE)
+ ) {
+ const tagsHeader = cacheData.value.headers?.[NEXT_CACHE_TAGS_HEADER]
+
+ if (typeof tagsHeader === 'string') {
+ const cacheTags = tagsHeader.split(',')
+
+ if (cacheTags.length > 0) {
+ if (areTagsExpired(cacheTags, lastModified)) {
+ isStale = -1
+ } else if (areTagsStale(cacheTags, lastModified)) {
+ isStale = true
+ }
}
}
}
diff --git a/packages/next/src/server/response-cache/index.ts b/packages/next/src/server/response-cache/index.ts
index 4981741e6c31..a29c9cf74c0f 100644
--- a/packages/next/src/server/response-cache/index.ts
+++ b/packages/next/src/server/response-cache/index.ts
@@ -335,7 +335,16 @@ export default class ResponseCache implements ResponseCacheBase {
})
: null
- if (previousIncrementalCacheEntry && !context.isOnDemandRevalidate) {
+ // `isStale === -1` signals that the entry is past its `expire` (either
+ // via an expired tag or, with `cacheLife({ expire })`, past the route's
+ // expire time in the prerender manifest). In that case we must NOT
+ // early-resolve with the stale value — instead we fall through to a
+ // blocking revalidation so the response returned to the user is fresh.
+ if (
+ previousIncrementalCacheEntry &&
+ !context.isOnDemandRevalidate &&
+ previousIncrementalCacheEntry.isStale !== -1
+ ) {
resolve(previousIncrementalCacheEntry)
resolved = true
@@ -353,7 +362,7 @@ export default class ResponseCache implements ResponseCacheBase {
context.isFallback,
responseGenerator,
previousIncrementalCacheEntry,
- previousIncrementalCacheEntry !== null && !context.isOnDemandRevalidate,
+ resolved,
undefined,
context.invocationID
)
diff --git a/packages/next/src/server/route-modules/pages/pages-handler.ts b/packages/next/src/server/route-modules/pages/pages-handler.ts
index 2c6b62c1a80f..564c46827cb9 100644
--- a/packages/next/src/server/route-modules/pages/pages-handler.ts
+++ b/packages/next/src/server/route-modules/pages/pages-handler.ts
@@ -361,6 +361,24 @@ export const getHandler = ({
let cacheControl: CacheControl | undefined =
metadata.cacheControl
+ // Apply the `expireTime` fallback as soon as we have the
+ // render's `cacheControl`, so every downstream consumer (the
+ // cache stored via `incrementalCache.set`, the response
+ // Cache-Control header, the outgoing entry returned from this
+ // responseGenerator) sees a finalized `cacheControl` with a
+ // populated `expire`. This mirrors the build-time fallback in
+ // `build/index.ts` so we don't apply an expire to routes that
+ // opt out of revalidation entirely (`revalidate: false`) or
+ // that are dynamic (`revalidate: 0`).
+ if (
+ cacheControl &&
+ cacheControl.revalidate !== false &&
+ cacheControl.revalidate > 0 &&
+ cacheControl.expire === undefined
+ ) {
+ cacheControl.expire = nextConfig.expireTime
+ }
+
if ('isNotFound' in metadata && metadata.isNotFound) {
return {
value: null,
@@ -609,7 +627,7 @@ export const getHandler = ({
}
cacheControl = {
revalidate: result.cacheControl.revalidate,
- expire: result.cacheControl?.expire ?? nextConfig.expireTime,
+ expire: result.cacheControl.expire,
}
} else {
// revalidate: false
diff --git a/test/cache-components-tests-manifest.json b/test/cache-components-tests-manifest.json
index 215b6029f175..0470ac161e51 100644
--- a/test/cache-components-tests-manifest.json
+++ b/test/cache-components-tests-manifest.json
@@ -169,6 +169,7 @@
"test/e2e/app-dir/error-boundary-navigation/index.test.ts",
"test/e2e/app-dir/error-boundary-navigation/override-node-env.test.ts",
"test/e2e/app-dir/errors/index.test.ts",
+ "test/e2e/app-dir/expire-time/**/*",
"test/e2e/app-dir/fallback-prefetch/fallback-prefetch.test.ts",
"test/e2e/app-dir/fallback-shells/**/*",
"test/e2e/app-dir/forbidden/basic/forbidden-basic.test.ts",
diff --git a/test/e2e/app-dir/expire-time/app/layout.tsx b/test/e2e/app-dir/expire-time/app/layout.tsx
new file mode 100644
index 000000000000..08eaa94fdc88
--- /dev/null
+++ b/test/e2e/app-dir/expire-time/app/layout.tsx
@@ -0,0 +1,11 @@
+export default function RootLayout({
+ children,
+}: {
+ children: React.ReactNode
+}) {
+ return (
+
+ {children}
+
+ )
+}
diff --git a/test/e2e/app-dir/expire-time/app/page.tsx b/test/e2e/app-dir/expire-time/app/page.tsx
new file mode 100644
index 000000000000..5189a46d28f7
--- /dev/null
+++ b/test/e2e/app-dir/expire-time/app/page.tsx
@@ -0,0 +1,5 @@
+export const revalidate = 2
+
+export default async function Page() {
+ return {new Date().toISOString()}
+}
diff --git a/test/e2e/app-dir/expire-time/expire-time.test.ts b/test/e2e/app-dir/expire-time/expire-time.test.ts
new file mode 100644
index 000000000000..a80dfb5fe702
--- /dev/null
+++ b/test/e2e/app-dir/expire-time/expire-time.test.ts
@@ -0,0 +1,63 @@
+import { nextTestSetup } from 'e2e-utils'
+import { retry } from 'next-test-utils'
+
+describe('expire-time', () => {
+ const { next, isNextDeploy } = nextTestSetup({
+ files: __dirname,
+ })
+
+ // On Vercel, ISR cache decisions happen at the Proxy layer. The Vercel
+ // builder reads the route's `expire` value (Next.js's `initialExpireSeconds`
+ // in the prerender manifest, which the build derives from `expireTime` when
+ // no explicit `cacheLife` expire is set) and passes it to the Proxy as
+ // `staleExpiration`. The Proxy is also expected, once implemented, to read
+ // updated values from Next.js's `stale-while-revalidate` response header on
+ // subsequent revalidations. Today the Proxy ignores the expire value entirely
+ // and treats it as one year. Past `expireTime` it serves stale with a
+ // background revalidation instead of a blocking prerender. When Proxy is
+ // updated to honor the expire value, this test will start passing in deploy
+ // mode and `it.failing` will itself fail. That's the signal to flip it back
+ // to `it`.
+ const itFailsWhenDeployed = isNextDeploy ? it.failing : it
+
+ /* eslint-disable jest/no-standalone-expect */
+ itFailsWhenDeployed(
+ 'should do a blocking revalidation when the cache entry has expired',
+ async () => {
+ const $first = await next.render$('/')
+ const v1 = $first('#value').text()
+ expect(v1).toBeDateString()
+
+ // The first request might trigger a background revalidation if the
+ // prerender document is already older than the configured revalidate
+ // time. So we refetch until we get a different value than the first one.
+ let v2: string
+ await retry(
+ async () => {
+ const $second = await next.render$('/')
+ v2 = $second('#value').text()
+ expect(v2).toBeDateString()
+ expect(v2).not.toBe(v1)
+ },
+ 4_000,
+ 200
+ )
+
+ // Wait past the `expireTime` (10 s). The next request must trigger a
+ // blocking prerender, not stale-while-revalidate — so the response
+ // returned right here carries a freshly-computed value.
+ await new Promise((resolve) => setTimeout(resolve, 10_000))
+
+ const $third = await next.render$('/')
+ const v3 = $third('#value').text()
+ expect(v3).toBeDateString()
+
+ // This should be a new value, not the expired previous one, and
+ // especially not the expired prerendered one.
+ expect(v3).not.toBe(v2)
+ expect(v3).not.toBe(v1)
+ console.log({ v1, v2, v3 })
+ }
+ )
+ /* eslint-enable jest/no-standalone-expect */
+})
diff --git a/test/e2e/app-dir/expire-time/next.config.js b/test/e2e/app-dir/expire-time/next.config.js
new file mode 100644
index 000000000000..e92f6ebf41ba
--- /dev/null
+++ b/test/e2e/app-dir/expire-time/next.config.js
@@ -0,0 +1,10 @@
+/** @type {import('next').NextConfig} */
+const nextConfig = {
+ // When a route has `export const revalidate = N` but no explicit `expire`
+ // (e.g. no `cacheLife`), the build falls back to `expireTime` for the route's
+ // `initialExpireSeconds` in the prerender manifest. Keep this low so the test
+ // can wait past it without slowing CI down.
+ expireTime: 10,
+}
+
+module.exports = nextConfig
diff --git a/test/production/app-dir/use-cache-expire/app/layout.tsx b/test/production/app-dir/use-cache-expire/app/layout.tsx
new file mode 100644
index 000000000000..08eaa94fdc88
--- /dev/null
+++ b/test/production/app-dir/use-cache-expire/app/layout.tsx
@@ -0,0 +1,11 @@
+export default function RootLayout({
+ children,
+}: {
+ children: React.ReactNode
+}) {
+ return (
+
+ {children}
+
+ )
+}
diff --git a/test/production/app-dir/use-cache-expire/app/partially-static/[id]/page.tsx b/test/production/app-dir/use-cache-expire/app/partially-static/[id]/page.tsx
new file mode 100644
index 000000000000..7467bf69f930
--- /dev/null
+++ b/test/production/app-dir/use-cache-expire/app/partially-static/[id]/page.tsx
@@ -0,0 +1,38 @@
+import { cacheLife } from 'next/cache'
+import { connection } from 'next/server'
+import { Suspense } from 'react'
+
+async function getValue() {
+ 'use cache'
+ cacheLife({ revalidate: 60, expire: 300 })
+ return new Date().toISOString()
+}
+
+export function generateStaticParams() {
+ return [{ id: 'known' }]
+}
+
+export default async function Page({
+ params,
+}: {
+ params: Promise<{ id: string }>
+}) {
+ return (
+ <>
+ {await getValue()}
+ loading
}>
+
+
+ >
+ )
+}
+
+async function DynamicPart({ params }: { params: Promise<{ id: string }> }) {
+ const { id } = await params
+ await connection()
+ return (
+
+ {id} - {new Date().toISOString()}
+
+ )
+}
diff --git a/test/production/app-dir/use-cache-expire/app/static/page.tsx b/test/production/app-dir/use-cache-expire/app/static/page.tsx
new file mode 100644
index 000000000000..e2a0db13ec7d
--- /dev/null
+++ b/test/production/app-dir/use-cache-expire/app/static/page.tsx
@@ -0,0 +1,11 @@
+import { cacheLife } from 'next/cache'
+
+async function getValue() {
+ 'use cache'
+ cacheLife({ revalidate: 60, expire: 300 })
+ return new Date().toISOString()
+}
+
+export default async function Page() {
+ return {await getValue()}
+}
diff --git a/test/production/app-dir/use-cache-expire/incremental-cache-handler.js b/test/production/app-dir/use-cache-expire/incremental-cache-handler.js
new file mode 100644
index 000000000000..a2acf46af731
--- /dev/null
+++ b/test/production/app-dir/use-cache-expire/incremental-cache-handler.js
@@ -0,0 +1,30 @@
+const {
+ default: FileSystemCache,
+} = require('next/dist/server/lib/incremental-cache/file-system-cache')
+
+/**
+ * A FileSystemCache variant that lets a test simulate the passage of time by
+ * shifting the `lastModified` timestamp of a cached entry into the past. The
+ * offset is controlled per-request via the `x-test-cache-age-offset-ms` header
+ * so tests can skip over `expire` windows (e.g. 5 minutes) without actually
+ * waiting.
+ */
+module.exports = class IncrementalCacheHandler extends FileSystemCache {
+ constructor(ctx) {
+ super(ctx)
+ this.requestHeaders = ctx._requestHeaders
+ }
+
+ async get(key, ctx) {
+ const result = await super.get(key, ctx)
+
+ const offsetHeader = this.requestHeaders?.['x-test-cache-age-offset-ms']
+ const offsetMs = typeof offsetHeader === 'string' ? Number(offsetHeader) : 0
+
+ if (result && offsetMs > 0 && !ctx.fetchCache) {
+ return { ...result, lastModified: result.lastModified - offsetMs }
+ }
+
+ return result
+ }
+}
diff --git a/test/production/app-dir/use-cache-expire/next.config.js b/test/production/app-dir/use-cache-expire/next.config.js
new file mode 100644
index 000000000000..99fe6353de3a
--- /dev/null
+++ b/test/production/app-dir/use-cache-expire/next.config.js
@@ -0,0 +1,7 @@
+/** @type {import('next').NextConfig} */
+const nextConfig = {
+ cacheComponents: true,
+ cacheHandler: require.resolve('./incremental-cache-handler'),
+}
+
+module.exports = nextConfig
diff --git a/test/production/app-dir/use-cache-expire/use-cache-expire.test.ts b/test/production/app-dir/use-cache-expire/use-cache-expire.test.ts
new file mode 100644
index 000000000000..d9cf8fa92469
--- /dev/null
+++ b/test/production/app-dir/use-cache-expire/use-cache-expire.test.ts
@@ -0,0 +1,52 @@
+import { nextTestSetup } from 'e2e-utils'
+
+// Lives under `test/production` so it only runs in `next start` mode. In dev
+// mode the default in-memory `'use cache'` handler would return the cached
+// function value on re-render (we don't fake time for the function-level
+// cache), so the observable wouldn't change even when the ISR layer does a
+// blocking revalidation. Deploy mode is also out of scope: on Vercel the ISR
+// cache decision is made at the Proxy layer before the lambda runs, and
+// Proxy-side behavior is covered by Proxy's own tests. The companion suite
+// `test/e2e/app-dir/expire-time` covers the same `IncrementalCache` /
+// response-cache change via classic ISR (no `use cache`, no custom handler,
+// short `expireTime`) and runs in deploy mode.
+describe('use-cache-expire', () => {
+ const { next } = nextTestSetup({
+ files: __dirname,
+ })
+
+ async function expectBlockingRevalidation(path: string) {
+ const $first = await next.render$(path)
+ const v0 = $first('#value').text()
+ expect(v0).toBeTruthy()
+
+ const $second = await next.render$(path, undefined, {
+ // Shift the ISR entry's `lastModified` past `expire` (301 s). Once past
+ // `expire`, the next request must trigger a blocking prerender — not
+ // stale-while-revalidate — so the response carries a freshly-computed
+ // value rather than the previous cached one.
+ headers: { 'x-test-cache-age-offset-ms': String(301 * 1000) },
+ })
+ const v1 = $second('#value').text()
+
+ expect(v1).not.toBe(v0)
+ }
+
+ it('should blocking-revalidate a fully static shell past expire', async () => {
+ await expectBlockingRevalidation('/static')
+ })
+
+ it('should blocking-revalidate a partially-static route shell past expire', async () => {
+ // Hits the prerendered route shell for the known `generateStaticParams`
+ // entry, whose static portion contains the cached `getValue()`.
+ await expectBlockingRevalidation('/partially-static/known')
+ })
+
+ it('should blocking-revalidate a partially-static fallback shell past expire', async () => {
+ // Hits the fallback shell for an unknown param (not in
+ // `generateStaticParams`). The cached `getValue()` lives above the Suspense
+ // boundary in the fallback shell itself, so the same past-expire blocking
+ // behavior must apply there too.
+ await expectBlockingRevalidation('/partially-static/unknown')
+ })
+})
From 668094edce26ce888e59e0f5a81966bd68d991ec Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=BC=A0=E6=98=8A?=
<45807027+GuinsooRocky@users.noreply.github.com>
Date: Wed, 29 Apr 2026 17:05:11 +0800
Subject: [PATCH 2/9] Turbopack: add `experimental.turbopackWorkerAssetPrefix`
to keep Workers same-origin when `assetPrefix` is a CDN (#93271)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
### What?
Adds `experimental.turbopackWorkerAssetPrefix` — a Turbopack counterpart
to webpack's
[`output.workerPublicPath`](https://webpack.js.org/configuration/output/#outputworkerpublicpath).
Opt-in, off by default, fully backward compatible.
```js
// next.config.js
module.exports = {
assetPrefix: 'https://cdn.example.com',
experimental: {
// Same shape as `assetPrefix`: bare prefix, no trailing slash, no `/_next`.
// `/_next/` is appended automatically. `''` → same-origin `/_next/...`.
turbopackWorkerAssetPrefix: '',
},
}
```
### Why?
When `assetPrefix` points to a cross-origin CDN (common production
setup), Turbopack emits Worker URLs under that CDN origin. Browsers
reject cross-origin `new Worker(url)` with `SecurityError`, breaking
every feature that uses `new Worker(new URL('./worker.ts',
import.meta.url))` — image decoders, WebP/GIF renderers, compression,
OffscreenCanvas, etc.
webpack solved this with `output.workerPublicPath`. Turbopack ignores
the `webpack()` callback in `next.config.js`, so the existing
same-origin workaround silently breaks when projects switch to
Turbopack.
Full design doc, alternatives considered, related issues (#88602,
#92676, #74621, #29468): **#93044**
Repro repo (`pnpm dev` reproduces, `pnpm dev:webpack` works):
https://github.com/GuinsooRocky/next-turbopack-worker-cdn-repro
### How?
Threads a new optional `turbopack_worker_asset_prefix: Option`
from `ExperimentalConfig` → `BrowserChunkingContext` → the JS runtime,
where `createWorker` reads it via a new `WORKER_BASE_PATH` global
emitted alongside the existing `CHUNK_BASE_PATH`. When unset, behavior
is identical to today.
Semantics, modeled on `assetPrefix`:
- **Bare prefix.** `/_next/` is appended automatically (same as
`computed_asset_prefix`); the user supplies just the origin (or empty
string for same-origin).
- **`undefined` vs `''`.** `undefined` falls back to the regular chunk
base path; `''` is a literal empty prefix that resolves to same-origin
`/_next/...`. The runtime distinguishes the two by injecting a JS `null`
literal vs a quoted string, and uses `WORKER_BASE_PATH ??
CHUNK_BASE_PATH` (not `||`).
- **Applies to entrypoint and module chunks.** The Turbopack worker
bootstrap rejects cross-origin module chunks (`Refusing to load script
from foreign origin`), so the override has to cover both — overriding
only the entrypoint would leave the worker unable to load any chunks
under a cross-origin `assetPrefix`.
Touchpoints:
- `packages/next/src/server/config-{shared,schema}.ts` — public option +
zod under `experimental`
- `crates/next-{api,core}/...` — wiring through to
`ClientChunkingContextOptions`;
`NextConfig::turbopack_worker_asset_prefix()` resolves to
`Some("/_next/")` or `None`
- `turbopack/crates/turbopack-browser/src/chunking_context.rs` — new
field + builder + getter
- `turbopack/crates/turbopack-ecmascript-runtime/src/browser_runtime.rs`
— emit `WORKER_BASE_PATH` declaration as `null` or a quoted string
- `turbopack/.../runtime-base.ts` — `createWorker` resolves
`workerBasePath` and uses it for both the entrypoint URL and
module-chunk URLs delivered via params
- `test/e2e/turbopack-worker-asset-prefix/` — e2e fixture using real
cross-origin (`localhost` page, `127.0.0.1` `assetPrefix`); intercepts
`new Worker()` to assert on the URL the runtime helper resolved. Three
cases: no override (cross-origin URL → `SecurityError`), explicit
override origin, and `''` (relative `/_next/...`).
- `docs/01-app/03-api-reference/08-turbopack.mdx` — option reference
- `telemetry/events/version.ts` — `useTurbopackWorkerAssetPrefix:
boolean` (set on any explicit value, including empty string)
### Notes
- Opening as **Draft** to invite API-shape feedback before going to
review. Per the contributing guide, the design discussion is at #93044.
- All checklist items the PR template requires for a feature are
covered: e2e tests, docs, telemetry, no error-link path applies.
cc @sokra
Closes #93044
---------
Co-authored-by: Tobias Koppers
---
crates/next-api/src/project.rs | 1 +
crates/next-core/src/next_client/context.rs | 3 +
crates/next-core/src/next_config.rs | 23 +++
docs/01-app/03-api-reference/08-turbopack.mdx | 39 ++---
packages/next/src/server/config-schema.ts | 1 +
packages/next/src/server/config-shared.ts | 31 ++++
packages/next/src/telemetry/events/version.ts | 4 +
.../app/client.tsx | 56 +++++++
.../app/layout.tsx | 11 ++
.../app/page.tsx | 5 +
.../app/worker.ts | 3 +
.../turbopack-worker-asset-prefix.test.ts | 148 ++++++++++++++++++
.../turbopack-browser/src/chunking_context.rs | 22 +++
.../src/ecmascript/evaluate/chunk.rs | 1 +
.../src/browser/runtime/base/runtime-base.ts | 32 +++-
.../src/browser_runtime.rs | 11 ++
...bug-ids_browser_input_index_19boa0e.js.map | 14 +-
...t_debug-ids_browser_input_index_19boa0e.js | 18 ++-
...ult_dev_runtime_input_index_17smy-b.js.map | 12 +-
...default_dev_runtime_input_index_17smy-b.js | 14 +-
...orms_preset_env_input_index_04jskxh.js.map | 8 +-
...ansforms_preset_env_input_index_04jskxh.js | 13 +-
...t_workers_basic_input_index_09-gc7x.js.map | 12 +-
..._workers_basic_input_worker_0yr5fg0.js.map | 12 +-
...pshot_workers_basic_input_index_09-gc7x.js | 14 +-
...shot_workers_basic_input_worker_0yr5fg0.js | 14 +-
..._workers_shared_input_index_0arnewp.js.map | 12 +-
...workers_shared_input_worker_1xw116u.js.map | 12 +-
...shot_workers_shared_input_index_0arnewp.js | 14 +-
...hot_workers_shared_input_worker_1xw116u.js | 14 +-
30 files changed, 481 insertions(+), 93 deletions(-)
create mode 100644 test/e2e/turbopack-worker-asset-prefix/app/client.tsx
create mode 100644 test/e2e/turbopack-worker-asset-prefix/app/layout.tsx
create mode 100644 test/e2e/turbopack-worker-asset-prefix/app/page.tsx
create mode 100644 test/e2e/turbopack-worker-asset-prefix/app/worker.ts
create mode 100644 test/e2e/turbopack-worker-asset-prefix/turbopack-worker-asset-prefix.test.ts
diff --git a/crates/next-api/src/project.rs b/crates/next-api/src/project.rs
index 611251d188c8..92ad18d04549 100644
--- a/crates/next-api/src/project.rs
+++ b/crates/next-api/src/project.rs
@@ -1589,6 +1589,7 @@ impl Project {
.next_config()
.turbo_nested_async_chunking(self.next_mode(), true),
debug_ids: self.next_config().turbopack_debug_ids(),
+ worker_asset_prefix: self.next_config().turbopack_worker_asset_prefix(),
should_use_absolute_url_references: self.next_config().inline_css(),
css_url_suffix,
hash_salt: self.next_config().output_hash_salt().to_resolved().await?,
diff --git a/crates/next-core/src/next_client/context.rs b/crates/next-core/src/next_client/context.rs
index 9892fa9858a9..0b60f88bbbae 100644
--- a/crates/next-core/src/next_client/context.rs
+++ b/crates/next-core/src/next_client/context.rs
@@ -477,6 +477,7 @@ pub struct ClientChunkingContextOptions {
pub scope_hoisting: Vc,
pub nested_async_chunking: Vc,
pub debug_ids: Vc,
+ pub worker_asset_prefix: Vc>,
pub should_use_absolute_url_references: Vc,
pub css_url_suffix: Vc>,
pub hash_salt: ResolvedVc,
@@ -504,6 +505,7 @@ pub async fn get_client_chunking_context(
scope_hoisting,
nested_async_chunking,
debug_ids,
+ worker_asset_prefix,
should_use_absolute_url_references,
css_url_suffix,
hash_salt,
@@ -544,6 +546,7 @@ pub async fn get_client_chunking_context(
.unused_references(unused_references.to_resolved().await?)
.module_id_strategy(module_id_strategy.to_resolved().await?)
.debug_ids(*debug_ids.await?)
+ .worker_asset_prefix(worker_asset_prefix.owned().await?)
.should_use_absolute_url_references(*should_use_absolute_url_references.await?)
.nested_async_availability(*nested_async_chunking.await?)
.worker_forwarded_globals(worker_forwarded_globals())
diff --git a/crates/next-core/src/next_config.rs b/crates/next-core/src/next_config.rs
index 195b19751d22..623baf673678 100644
--- a/crates/next-core/src/next_config.rs
+++ b/crates/next-core/src/next_config.rs
@@ -1157,6 +1157,17 @@ pub struct ExperimentalConfig {
turbopack_input_source_maps: Option,
turbopack_tree_shaking: Option,
turbopack_scope_hoisting: Option,
+ /// Custom URL prefix for Web Worker URLs (the entrypoint and the module
+ /// chunks loaded inside the worker) produced by
+ /// `new Worker(new URL(..., import.meta.url))`. Mirrors webpack's
+ /// `output.workerPublicPath`. When unset, Worker URLs use the regular
+ /// chunk base path (i.e. `assetPrefix` + `/_next/`).
+ ///
+ /// Like `assetPrefix`, the value is a prefix without a trailing slash
+ /// and without `/_next` — `/_next/` is appended automatically. An empty
+ /// string is a literal empty prefix; only `None` falls back to
+ /// `assetPrefix`.
+ turbopack_worker_asset_prefix: Option,
turbopack_client_side_nested_async_chunking: Option,
turbopack_server_side_nested_async_chunking: Option,
turbopack_import_type_bytes: Option,
@@ -2273,6 +2284,18 @@ impl NextConfig {
)
}
+ /// Returns the resolved worker chunk base path with `/_next/` appended,
+ /// or `None` to fall back to the regular chunk base path.
+ #[turbo_tasks::function]
+ pub fn turbopack_worker_asset_prefix(&self) -> Vc> {
+ Vc::cell(
+ self.experimental
+ .turbopack_worker_asset_prefix
+ .as_ref()
+ .map(|prefix| format!("{}/_next/", prefix.trim_end_matches('/')).into()),
+ )
+ }
+
#[turbo_tasks::function]
pub fn typescript_tsconfig_path(&self) -> Result>> {
Ok(Vc::cell(
diff --git a/docs/01-app/03-api-reference/08-turbopack.mdx b/docs/01-app/03-api-reference/08-turbopack.mdx
index 854407db3bee..c9b93ab0e8ac 100644
--- a/docs/01-app/03-api-reference/08-turbopack.mdx
+++ b/docs/01-app/03-api-reference/08-turbopack.mdx
@@ -369,25 +369,26 @@ Turbopack can be configured via `next.config.js` (or `next.config.ts`) under the
Additionally, the following experimental options are available under `experimental` in `next.config.js`:
-| Option | Description | Default (dev) | Default (build) |
-| ------------------------------------------------------------------------------------------------------------ | --------------------------------------------------------------------------------------- | ------------- | ----------------------------- |
-| [`turbopackFileSystemCacheForDev`](/docs/app/api-reference/config/next-config-js/turbopackFileSystemCache) | Enable filesystem cache for the dev server. | `true` | N/A |
-| [`turbopackFileSystemCacheForBuild`](/docs/app/api-reference/config/next-config-js/turbopackFileSystemCache) | Enable filesystem cache for builds. | N/A | `false` |
-| `turbopackMinify` | Enable minification. | `false` | `true` |
-| `turbopackSourceMaps` | Enable source maps. | `true` | `productionBrowserSourceMaps` |
-| `turbopackInputSourceMaps` | Enable extraction of source maps from input files. | `true` | `true` |
-| `turbopackTreeShaking` | Use advanced module-fragments tree shaking instead of the default reexports-only mode. | `false` | `false` |
-| `turbopackRemoveUnusedImports` | Enable removing unused imports. Requires `turbopackRemoveUnusedExports`. | `false` | `true` |
-| `turbopackRemoveUnusedExports` | Enable removing unused exports. | `false` | `true` |
-| `turbopackInferModuleSideEffects` | Enable local analysis to infer side-effect-free modules for better tree shaking. | `true` | `true` |
-| `turbopackScopeHoisting` | Enable scope hoisting. Always disabled in dev mode. | `false` | `true` |
-| `turbopackClientSideNestedAsyncChunking` | Enable nested async chunking for client-side assets. | `false` | `true` |
-| `turbopackServerSideNestedAsyncChunking` | Enable nested async chunking for server-side assets. | `false` | `false` |
-| `turbopackImportTypeBytes` | Enable support for `with {type: "bytes"}` for ESM imports. | `false` | `false` |
-| `turbopackUseBuiltinBabel` | Enable automatic Babel loader configuration when a Babel config file is present. | `true` | `true` |
-| `turbopackUseBuiltinSass` | Enable automatic Sass loader configuration. | `true` | `true` |
-| `turbopackModuleIds` | Module ID strategy: `'named'` or `'deterministic'`. | `'named'` | `'deterministic'` |
-| [`turbopackLocalPostcssConfig`](/docs/app/api-reference/config/next-config-js/turbopackLocalPostcssConfig) | Resolve `postcss.config.js` from the CSS file's directory first, then the project root. | `false` | `false` |
+| Option | Description | Default (dev) | Default (build) |
+| ------------------------------------------------------------------------------------------------------------ | -------------------------------------------------------------------------------------------------------------------------------------------- | ------------- | ----------------------------- |
+| [`turbopackFileSystemCacheForDev`](/docs/app/api-reference/config/next-config-js/turbopackFileSystemCache) | Enable filesystem cache for the dev server. | `true` | N/A |
+| [`turbopackFileSystemCacheForBuild`](/docs/app/api-reference/config/next-config-js/turbopackFileSystemCache) | Enable filesystem cache for builds. | N/A | `false` |
+| `turbopackMinify` | Enable minification. | `false` | `true` |
+| `turbopackSourceMaps` | Enable source maps. | `true` | `productionBrowserSourceMaps` |
+| `turbopackInputSourceMaps` | Enable extraction of source maps from input files. | `true` | `true` |
+| `turbopackTreeShaking` | Use advanced module-fragments tree shaking instead of the default reexports-only mode. | `false` | `false` |
+| `turbopackRemoveUnusedImports` | Enable removing unused imports. Requires `turbopackRemoveUnusedExports`. | `false` | `true` |
+| `turbopackRemoveUnusedExports` | Enable removing unused exports. | `false` | `true` |
+| `turbopackInferModuleSideEffects` | Enable local analysis to infer side-effect-free modules for better tree shaking. | `true` | `true` |
+| `turbopackScopeHoisting` | Enable scope hoisting. Always disabled in dev mode. | `false` | `true` |
+| `turbopackClientSideNestedAsyncChunking` | Enable nested async chunking for client-side assets. | `false` | `true` |
+| `turbopackServerSideNestedAsyncChunking` | Enable nested async chunking for server-side assets. | `false` | `false` |
+| `turbopackImportTypeBytes` | Enable support for `with {type: "bytes"}` for ESM imports. | `false` | `false` |
+| `turbopackUseBuiltinBabel` | Enable automatic Babel loader configuration when a Babel config file is present. | `true` | `true` |
+| `turbopackUseBuiltinSass` | Enable automatic Sass loader configuration. | `true` | `true` |
+| `turbopackModuleIds` | Module ID strategy: `'named'` or `'deterministic'`. | `'named'` | `'deterministic'` |
+| [`turbopackLocalPostcssConfig`](/docs/app/api-reference/config/next-config-js/turbopackLocalPostcssConfig) | Resolve `postcss.config.js` from the CSS file's directory first, then the project root. | `false` | `false` |
+| `turbopackWorkerAssetPrefix` | Custom asset prefix for Web Worker URLs (entrypoint + module chunks), overriding `assetPrefix`. Mirrors webpack's `output.workerPublicPath`. | `undefined` | `undefined` |
```js filename="next.config.js"
module.exports = {
diff --git a/packages/next/src/server/config-schema.ts b/packages/next/src/server/config-schema.ts
index 98c9fa788fe7..dd81aa12c619 100644
--- a/packages/next/src/server/config-schema.ts
+++ b/packages/next/src/server/config-schema.ts
@@ -362,6 +362,7 @@ export const experimentalSchema = {
turbopackRemoveUnusedImports: z.boolean().optional(),
turbopackRemoveUnusedExports: z.boolean().optional(),
turbopackScopeHoisting: z.boolean().optional(),
+ turbopackWorkerAssetPrefix: z.string().optional(),
turbopackClientSideNestedAsyncChunking: z.boolean().optional(),
turbopackServerSideNestedAsyncChunking: z.boolean().optional(),
turbopackImportTypeBytes: z.boolean().optional(),
diff --git a/packages/next/src/server/config-shared.ts b/packages/next/src/server/config-shared.ts
index 9f61694f4804..6bfc0919201f 100644
--- a/packages/next/src/server/config-shared.ts
+++ b/packages/next/src/server/config-shared.ts
@@ -674,6 +674,37 @@ export interface ExperimentalConfig {
*/
turbopackScopeHoisting?: boolean
+ /**
+ * (`next --turbopack` only) A custom URL prefix for Web Worker URLs
+ * produced by `new Worker(new URL(..., import.meta.url))` — both the
+ * entrypoint URL and the module chunks loaded inside the worker —
+ * overriding `assetPrefix` for those URLs.
+ *
+ * Use this when `assetPrefix` points to a cross-origin CDN: browsers
+ * reject cross-origin Worker construction, so the entrypoint must stay
+ * same-origin. Module chunks loaded inside the worker are also routed
+ * through this prefix because the worker bootstrap requires them to be
+ * same-origin with the entrypoint. Mirrors webpack's
+ * `output.workerPublicPath`.
+ *
+ * Like `assetPrefix`, the value is a prefix without a trailing slash and
+ * without `/_next` — `/_next/` is appended automatically. An empty
+ * string is treated as a literal empty prefix (resulting in same-origin
+ * `/_next/...` URLs); only `undefined` falls back to `assetPrefix`.
+ *
+ * @example
+ * ```js
+ * // next.config.js
+ * module.exports = {
+ * assetPrefix: 'https://cdn.example.com',
+ * experimental: {
+ * turbopackWorkerAssetPrefix: '',
+ * },
+ * }
+ * ```
+ */
+ turbopackWorkerAssetPrefix?: string
+
/**
* Enable nested async chunking for client side assets. Defaults to true in build mode and false in dev mode.
* This optimization computes all possible paths through dynamic imports in the applications to figure out the modules needed at dynamic imports for every path.
diff --git a/packages/next/src/telemetry/events/version.ts b/packages/next/src/telemetry/events/version.ts
index 1d755f8335c1..ac93ef53a018 100644
--- a/packages/next/src/telemetry/events/version.ts
+++ b/packages/next/src/telemetry/events/version.ts
@@ -32,6 +32,7 @@ type EventCliSessionStarted = {
reactStrictMode: boolean
webpackVersion: number | null
turboFlag: boolean
+ useTurbopackWorkerAssetPrefix: boolean
isRspack: boolean
appDir: boolean | null
pagesDir: boolean | null
@@ -77,6 +78,7 @@ export function eventCliSession(
| 'reactCompilerPanicThreshold'
| 'isRspack'
| 'adapterPath'
+ | 'useTurbopackWorkerAssetPrefix'
>
): { eventName: string; payload: EventCliSessionStarted }[] {
// This should be an invariant, if it fails our build tooling is broken.
@@ -120,6 +122,8 @@ export function eventCliSession(
reactStrictMode: !!nextConfig?.reactStrictMode,
webpackVersion: event.webpackVersion || null,
turboFlag: event.turboFlag || false,
+ useTurbopackWorkerAssetPrefix:
+ nextConfig?.experimental?.turbopackWorkerAssetPrefix !== undefined,
isRspack: process.env.NEXT_RSPACK !== undefined,
appDir: event.appDir,
pagesDir: event.pagesDir,
diff --git a/test/e2e/turbopack-worker-asset-prefix/app/client.tsx b/test/e2e/turbopack-worker-asset-prefix/app/client.tsx
new file mode 100644
index 000000000000..f2f67b5bfee7
--- /dev/null
+++ b/test/e2e/turbopack-worker-asset-prefix/app/client.tsx
@@ -0,0 +1,56 @@
+'use client'
+
+import { useEffect, useState } from 'react'
+
+const NONE = '(none)'
+
+export default function ClientComponent() {
+ const [pageOrigin, setPageOrigin] = useState(NONE)
+ const [workerCtorUrl, setWorkerCtorUrl] = useState(NONE)
+ const [workerCtorError, setWorkerCtorError] = useState(NONE)
+
+ useEffect(() => {
+ setPageOrigin(window.location.origin)
+
+ // Capture the URL the Worker constructor receives (computed by the
+ // turbopack runtime helper from `turbopackWorkerAssetPrefix`), so the
+ // test can assert on it. Browsers reject cross-origin Worker URLs
+ // synchronously, so we surface that too.
+ const OriginalWorker = window.Worker
+ ;(window as any).Worker = function PatchedWorker(
+ url: URL | string,
+ options?: object
+ ) {
+ const urlString = typeof url === 'string' ? url : url.toString()
+ setWorkerCtorUrl(urlString)
+ try {
+ return new OriginalWorker(url, options)
+ } catch (err) {
+ setWorkerCtorError(err instanceof Error ? err.name : String(err))
+ throw err
+ }
+ }
+
+ try {
+ // Trigger the turbopack `new Worker(new URL(..., import.meta.url))`
+ // pattern. Result is intercepted by the patched Worker above.
+
+ new Worker(new URL('./worker.ts', import.meta.url))
+ } catch {
+ // Already captured by the patched constructor; React state will
+ // reflect it on the next render.
+ }
+ ;(window as any).Worker = OriginalWorker
+ }, [])
+
+ return (
+ <>
+ page origin:
+ {pageOrigin}
+ URL passed to the Worker constructor (from runtime helper):
+ {workerCtorUrl}
+ Worker constructor error (if any):
+ {workerCtorError}
+ >
+ )
+}
diff --git a/test/e2e/turbopack-worker-asset-prefix/app/layout.tsx b/test/e2e/turbopack-worker-asset-prefix/app/layout.tsx
new file mode 100644
index 000000000000..08eaa94fdc88
--- /dev/null
+++ b/test/e2e/turbopack-worker-asset-prefix/app/layout.tsx
@@ -0,0 +1,11 @@
+export default function RootLayout({
+ children,
+}: {
+ children: React.ReactNode
+}) {
+ return (
+
+ {children}
+
+ )
+}
diff --git a/test/e2e/turbopack-worker-asset-prefix/app/page.tsx b/test/e2e/turbopack-worker-asset-prefix/app/page.tsx
new file mode 100644
index 000000000000..0fe3d266b263
--- /dev/null
+++ b/test/e2e/turbopack-worker-asset-prefix/app/page.tsx
@@ -0,0 +1,5 @@
+import ClientComponent from './client'
+
+export default function Page() {
+ return
+}
diff --git a/test/e2e/turbopack-worker-asset-prefix/app/worker.ts b/test/e2e/turbopack-worker-asset-prefix/app/worker.ts
new file mode 100644
index 000000000000..e46c97e20267
--- /dev/null
+++ b/test/e2e/turbopack-worker-asset-prefix/app/worker.ts
@@ -0,0 +1,3 @@
+// Post back the worker's own origin so the main thread can verify whether the
+// worker entrypoint was loaded same-origin or cross-origin.
+self.postMessage(self.location.origin)
diff --git a/test/e2e/turbopack-worker-asset-prefix/turbopack-worker-asset-prefix.test.ts b/test/e2e/turbopack-worker-asset-prefix/turbopack-worker-asset-prefix.test.ts
new file mode 100644
index 000000000000..3eb92f5d21a3
--- /dev/null
+++ b/test/e2e/turbopack-worker-asset-prefix/turbopack-worker-asset-prefix.test.ts
@@ -0,0 +1,148 @@
+import { createNext, isNextDeploy } from 'e2e-utils'
+import type { NextInstance } from 'e2e-utils'
+import { findPort, retry } from 'next-test-utils'
+
+// `experimental.turbopackWorkerAssetPrefix` is turbopack-only.
+const isTurbopack = !process.env.IS_WEBPACK_TEST
+const describeTurbopack =
+ isTurbopack && !isNextDeploy ? describe : describe.skip
+
+// CORS so cross-origin script tags from `assetPrefix` can be fetched. Workers
+// are NOT covered by CORS — `new Worker(crossOriginUrl)` is rejected
+// regardless — so this only unblocks regular script loading.
+const corsHeaders = () => ({
+ async headers() {
+ return [
+ {
+ source: '/:path*',
+ headers: [{ key: 'Access-Control-Allow-Origin', value: '*' }],
+ },
+ ]
+ },
+})
+
+/**
+ * Real cross-origin setup: the page is served at `http://localhost:PORT/`,
+ * `assetPrefix` points to `http://127.0.0.1:PORT` (different origin —
+ * browsers treat `localhost` and `127.0.0.1` as distinct origins). Both
+ * resolve to the same Next.js server bound to all interfaces.
+ *
+ * The fixture intercepts `new Worker()` to capture the URL the turbopack
+ * runtime helper resolved from `turbopackWorkerAssetPrefix`, so each test
+ * can assert on that URL directly.
+ */
+describeTurbopack('turbopack-worker-asset-prefix', () => {
+ describe('without turbopackWorkerAssetPrefix (cross-origin assetPrefix)', () => {
+ let next: NextInstance
+ let forcedPort: string
+
+ beforeAll(async () => {
+ forcedPort = String((await findPort()) ?? '54321')
+ next = await createNext({
+ files: __dirname,
+ forcedPort,
+ nextConfig: {
+ assetPrefix: `http://127.0.0.1:${forcedPort}`,
+ ...corsHeaders(),
+ },
+ })
+ })
+ afterAll(() => next.destroy())
+
+ it('Worker URL inherits assetPrefix and the browser rejects construction', async () => {
+ const browser = await next.browser('/')
+
+ await retry(async () => {
+ const url = await browser.elementByCss('#worker-ctor-url').text()
+ expect(url).toContain('http://127.0.0.1:')
+ expect(url).toContain(`:${forcedPort}/`)
+ })
+
+ // Cross-origin Worker construction throws SecurityError synchronously.
+ await retry(async () => {
+ const error = await browser.elementByCss('#worker-ctor-error').text()
+ expect(error).toBe('SecurityError')
+ })
+ })
+ })
+
+ describe('with turbopackWorkerAssetPrefix overriding assetPrefix', () => {
+ let next: NextInstance
+ let forcedPort: string
+
+ beforeAll(async () => {
+ forcedPort = String((await findPort()) ?? '54322')
+ next = await createNext({
+ files: __dirname,
+ forcedPort,
+ nextConfig: {
+ assetPrefix: `http://127.0.0.1:${forcedPort}`,
+ experimental: {
+ // Route Worker URLs through the page's own origin
+ // (`http://localhost:PORT`) instead of the cross-origin assetPrefix.
+ turbopackWorkerAssetPrefix: `http://localhost:${forcedPort}`,
+ },
+ ...corsHeaders(),
+ },
+ })
+ })
+ afterAll(() => next.destroy())
+
+ it('Worker URL uses the override origin and construction succeeds', async () => {
+ const browser = await next.browser('/')
+
+ await retry(async () => {
+ const pageOrigin = await browser.elementByCss('#page-origin').text()
+ const url = await browser.elementByCss('#worker-ctor-url').text()
+ expect(pageOrigin).toBe(`http://localhost:${forcedPort}`)
+ expect(url.startsWith(pageOrigin)).toBe(true)
+ expect(url).not.toContain('127.0.0.1')
+ })
+
+ const error = await browser.elementByCss('#worker-ctor-error').text()
+ expect(error).toBe('(none)')
+ })
+ })
+
+ describe('with turbopackWorkerAssetPrefix: "" (literal empty prefix)', () => {
+ let next: NextInstance
+ let forcedPort: string
+
+ beforeAll(async () => {
+ forcedPort = String((await findPort()) ?? '54323')
+ next = await createNext({
+ files: __dirname,
+ forcedPort,
+ nextConfig: {
+ assetPrefix: `http://127.0.0.1:${forcedPort}`,
+ experimental: {
+ // Empty string is a literal empty prefix (only `/_next/` is
+ // appended). It does NOT fall back to assetPrefix — only
+ // `undefined` does.
+ turbopackWorkerAssetPrefix: '',
+ },
+ ...corsHeaders(),
+ },
+ })
+ })
+ afterAll(() => next.destroy())
+
+ it('Worker URL is a relative /_next/ URL (resolved same-origin)', async () => {
+ const browser = await next.browser('/')
+
+ await retry(async () => {
+ const pageOrigin = await browser.elementByCss('#page-origin').text()
+ const url = await browser.elementByCss('#worker-ctor-url').text()
+ expect(pageOrigin).toBe(`http://localhost:${forcedPort}`)
+ // URL passed to `new Worker(...)` lives on the page's origin, not
+ // assetPrefix. (Internally the runtime resolves the relative
+ // `/_next/...` against `location.origin`.)
+ expect(url.startsWith(pageOrigin)).toBe(true)
+ expect(url).not.toContain('127.0.0.1')
+ })
+
+ const error = await browser.elementByCss('#worker-ctor-error').text()
+ expect(error).toBe('(none)')
+ })
+ })
+})
diff --git a/turbopack/crates/turbopack-browser/src/chunking_context.rs b/turbopack/crates/turbopack-browser/src/chunking_context.rs
index 5942b6bc70ff..20de86d13aef 100644
--- a/turbopack/crates/turbopack-browser/src/chunking_context.rs
+++ b/turbopack/crates/turbopack-browser/src/chunking_context.rs
@@ -103,6 +103,11 @@ impl BrowserChunkingContextBuilder {
self
}
+ pub fn worker_asset_prefix(mut self, worker_asset_prefix: Option) -> Self {
+ self.chunking_context.worker_asset_prefix = worker_asset_prefix;
+ self
+ }
+
pub fn asset_suffix(mut self, asset_suffix: ResolvedVc) -> Self {
self.chunking_context.asset_suffix = Some(asset_suffix);
self
@@ -267,6 +272,14 @@ pub struct BrowserChunkingContext {
/// Base path that will be prepended to all chunk URLs when loading them.
/// This path will not appear in chunk paths or chunk data.
chunk_base_path: Option,
+ /// Base path for Web Worker URLs (the entrypoint and the module chunks
+ /// loaded inside the worker). When `Some`, overrides `chunk_base_path`
+ /// for those URLs. Mirrors webpack's `output.workerPublicPath`. Primary
+ /// use case: keep Worker URLs same-origin when
+ /// `chunk_base_path`/`assetPrefix` points to a cross-origin CDN
+ /// (browsers reject cross-origin Worker construction, and the worker
+ /// bootstrap rejects cross-origin module chunks).
+ worker_asset_prefix: Option,
/// Suffix that will be appended to all chunk URLs when loading them.
/// This path will not appear in chunk paths or chunk data.
asset_suffix: Option>,
@@ -355,6 +368,7 @@ impl BrowserChunkingContext {
asset_root_path,
asset_root_paths: Default::default(),
chunk_base_path: None,
+ worker_asset_prefix: None,
asset_suffix: None,
asset_base_path: None,
asset_base_paths: Default::default(),
@@ -469,6 +483,14 @@ impl BrowserChunkingContext {
Vc::cell(self.chunk_base_path.clone())
}
+ /// Returns the worker base-path override. When `Some`, takes precedence
+ /// over `chunk_base_path` for the entrypoint URL and the module chunks
+ /// loaded inside the worker.
+ #[turbo_tasks::function]
+ pub fn worker_asset_prefix(&self) -> Vc> {
+ Vc::cell(self.worker_asset_prefix.clone())
+ }
+
/// Returns the asset suffix path.
#[turbo_tasks::function]
pub fn asset_suffix(&self) -> Vc {
diff --git a/turbopack/crates/turbopack-browser/src/ecmascript/evaluate/chunk.rs b/turbopack/crates/turbopack-browser/src/ecmascript/evaluate/chunk.rs
index bbe6d4688e0a..5cbf274732d4 100644
--- a/turbopack/crates/turbopack-browser/src/ecmascript/evaluate/chunk.rs
+++ b/turbopack/crates/turbopack-browser/src/ecmascript/evaluate/chunk.rs
@@ -179,6 +179,7 @@ impl EcmascriptBrowserEvaluateChunk {
let runtime_code = turbopack_ecmascript_runtime::get_browser_runtime_code(
asset_context,
this.chunking_context.chunk_base_path(),
+ this.chunking_context.worker_asset_prefix(),
this.chunking_context.asset_suffix(),
this.chunking_context.worker_forwarded_globals(),
runtime_type,
diff --git a/turbopack/crates/turbopack-ecmascript-runtime/js/src/browser/runtime/base/runtime-base.ts b/turbopack/crates/turbopack-ecmascript-runtime/js/src/browser/runtime/base/runtime-base.ts
index bf220dd1b602..3cee71db878f 100644
--- a/turbopack/crates/turbopack-ecmascript-runtime/js/src/browser/runtime/base/runtime-base.ts
+++ b/turbopack/crates/turbopack-ecmascript-runtime/js/src/browser/runtime/base/runtime-base.ts
@@ -20,6 +20,18 @@ declare var TURBOPACK_NEXT_CHUNK_URLS: ChunkUrl[] | undefined
// Injected by rust code
declare var CHUNK_BASE_PATH: string
+/**
+ * Custom base path for Web Worker URLs (the entrypoint and the module
+ * chunks loaded inside the worker). Mirrors webpack's
+ * `output.workerPublicPath`. `null` means "use CHUNK_BASE_PATH"; an empty
+ * string is a literal empty prefix (not a fallback).
+ *
+ * The worker's bootstrap rejects module chunks whose origin differs from
+ * the worker's own origin, so the override has to apply to both — using
+ * `WORKER_BASE_PATH` only for the entrypoint would leave the worker unable
+ * to load any chunks when `CHUNK_BASE_PATH` is on a different origin.
+ */
+declare var WORKER_BASE_PATH: string | null
declare var ASSET_SUFFIX: string
declare var CROSS_ORIGIN: 'anonymous' | 'use-credentials' | null
declare var WORKER_FORWARDED_GLOBALS: string[]
@@ -312,15 +324,24 @@ function createWorker(
): Worker {
const isSharedWorker = WorkerConstructor.name === 'SharedWorker'
+ // `WORKER_BASE_PATH` overrides `CHUNK_BASE_PATH` for the entrypoint and the
+ // module chunks loaded inside the worker, keeping them same-origin to each
+ // other when `CHUNK_BASE_PATH` (= `assetPrefix`) is a cross-origin CDN.
+ // `null` falls back; an empty string is treated as a literal empty prefix.
+ const workerBasePath = WORKER_BASE_PATH ?? CHUNK_BASE_PATH
+
const chunkUrls = moduleChunks
- .map((chunk) => getChunkRelativeUrl(chunk))
+ .map((chunk) => getChunkRelativeUrl(chunk, workerBasePath))
.reverse()
const params: unknown[] = [chunkUrls, ASSET_SUFFIX]
for (const globalName of WORKER_FORWARDED_GLOBALS) {
params.push((globalThis as Record)[globalName])
}
- const url = new URL(getChunkRelativeUrl(entrypoint), location.origin)
+ const url = new URL(
+ getChunkRelativeUrl(entrypoint, workerBasePath),
+ location.origin
+ )
const paramsJson = JSON.stringify(params)
if (isSharedWorker) {
url.searchParams.set('params', paramsJson)
@@ -348,8 +369,11 @@ function instantiateRuntimeModule(
/**
* Returns the URL relative to the origin where a chunk can be fetched from.
*/
-function getChunkRelativeUrl(chunkPath: ChunkPath | ChunkListPath): ChunkUrl {
- return `${CHUNK_BASE_PATH}${chunkPath
+function getChunkRelativeUrl(
+ chunkPath: ChunkPath | ChunkListPath,
+ basePath: string = CHUNK_BASE_PATH
+): ChunkUrl {
+ return `${basePath}${chunkPath
.split('/')
.map((p) => encodeURIComponent(p))
.join('/')}${ASSET_SUFFIX}` as ChunkUrl
diff --git a/turbopack/crates/turbopack-ecmascript-runtime/src/browser_runtime.rs b/turbopack/crates/turbopack-ecmascript-runtime/src/browser_runtime.rs
index 283e2809a491..aebb0928d6c0 100644
--- a/turbopack/crates/turbopack-ecmascript-runtime/src/browser_runtime.rs
+++ b/turbopack/crates/turbopack-ecmascript-runtime/src/browser_runtime.rs
@@ -19,6 +19,7 @@ use crate::{RuntimeType, embed_js::embed_static_code};
pub async fn get_browser_runtime_code(
asset_context: ResolvedVc>,
chunk_base_path: Vc>,
+ worker_asset_prefix: Vc >,
asset_suffix: Vc,
worker_forwarded_globals: Vc>,
runtime_type: RuntimeType,
@@ -86,6 +87,14 @@ pub async fn get_browser_runtime_code(
let relative_root_path = output_root_to_root_path;
let chunk_base_path = chunk_base_path.await?;
let chunk_base_path = chunk_base_path.as_ref().map_or_else(|| "", |f| f.as_str());
+ // `null` (no override) and `Some("")` (empty-string prefix) are distinct
+ // states, so inject as a JS literal — `null` for None and a quoted string
+ // for Some — instead of collapsing both to "".
+ let worker_asset_prefix = worker_asset_prefix.await?;
+ let worker_asset_prefix_js: String = worker_asset_prefix.as_ref().map_or_else(
+ || "null".to_string(),
+ |f| format!("{}", StringifyJs(f.as_str())),
+ );
let asset_suffix = asset_suffix.await?;
let chunk_loading_global = chunk_loading_global.await?;
let cross_origin = *cross_origin.await?;
@@ -109,11 +118,13 @@ pub async fn get_browser_runtime_code(
}}
var CHUNK_BASE_PATH = {};
+ var WORKER_BASE_PATH = {};
var RELATIVE_ROOT_PATH = {};
var RUNTIME_PUBLIC_PATH = {};
"#,
StringifyJs(&chunk_loading_global),
StringifyJs(chunk_base_path),
+ worker_asset_prefix_js,
StringifyJs(relative_root_path.as_str()),
StringifyJs(chunk_base_path),
)?;
diff --git a/turbopack/crates/turbopack-tests/tests/snapshot/debug-ids/browser/output/1do3_crates_turbopack-tests_tests_snapshot_debug-ids_browser_input_index_19boa0e.js.map b/turbopack/crates/turbopack-tests/tests/snapshot/debug-ids/browser/output/1do3_crates_turbopack-tests_tests_snapshot_debug-ids_browser_input_index_19boa0e.js.map
index f280589929f2..8883bf0ecbb2 100644
--- a/turbopack/crates/turbopack-tests/tests/snapshot/debug-ids/browser/output/1do3_crates_turbopack-tests_tests_snapshot_debug-ids_browser_input_index_19boa0e.js.map
+++ b/turbopack/crates/turbopack-tests/tests/snapshot/debug-ids/browser/output/1do3_crates_turbopack-tests_tests_snapshot_debug-ids_browser_input_index_19boa0e.js.map
@@ -1,12 +1,12 @@
{
"version": 3,
"sources": [],
- "debugId": "6a138f62-859e-e13c-84a0-d111b048d46a",
+ "debugId": "63d3116b-6e4c-29e3-253a-989477151583",
"sections": [
- {"offset": {"line": 16, "column": 0}, "map": {"version":3,"sources":["turbopack:///[turbopack]/shared/runtime/runtime-utils.ts"],"sourcesContent":["/**\n * This file contains runtime types and functions that are shared between all\n * TurboPack ECMAScript runtimes.\n *\n * It will be prepended to the runtime code of each runtime.\n */\n\n/* eslint-disable @typescript-eslint/no-unused-vars */\n\n/// \n\ntype EsmNamespaceObject = Record\n\n/**\n * Describes why a module was instantiated.\n * Shared between browser and Node.js runtimes.\n */\nenum SourceType {\n /**\n * The module was instantiated because it was included in an evaluated chunk's\n * runtime.\n * SourceData is a ChunkPath.\n */\n Runtime = 0,\n /**\n * The module was instantiated because a parent module imported it.\n * SourceData is a ModuleId.\n */\n Parent = 1,\n /**\n * The module was instantiated because it was included in a chunk's hot module\n * update.\n * SourceData is an array of ModuleIds or undefined.\n */\n Update = 2,\n}\n\ntype SourceData = ChunkPath | ModuleId | ModuleId[] | undefined\n\n// @ts-ignore Defined in `dev-base.ts`\ndeclare function getOrInstantiateModuleFromParent(\n id: ModuleId,\n sourceModule: M\n): M\n\n// @ts-ignore Defined in `hmr-runtime.ts` (dev mode only)\ndeclare let devModuleCache: Record | undefined\n\n/**\n * Flag indicating which module object type to create when a module is merged. Set to `true`\n * by each runtime that uses ModuleWithDirection (browser dev-base.ts, nodejs dev-base.ts,\n * nodejs build-base.ts). Browser production (build-base.ts) leaves it as `false` since it\n * uses plain Module objects.\n */\nlet createModuleWithDirectionFlag = false\n\nconst REEXPORTED_OBJECTS = new WeakMap()\n\n/**\n * Constructs the `__turbopack_context__` object for a module.\n */\nfunction Context(\n this: TurbopackBaseContext,\n module: Module,\n exports: Exports\n) {\n this.m = module\n // We need to store this here instead of accessing it from the module object to:\n // 1. Make it available to factories directly, since we rewrite `this` to\n // `__turbopack_context__.e` in CJS modules.\n // 2. Support async modules which rewrite `module.exports` to a promise, so we\n // can still access the original exports object from functions like\n // `esmExport`\n // Ideally we could find a new approach for async modules and drop this property altogether.\n this.e = exports\n}\nconst contextPrototype = Context.prototype as TurbopackBaseContext\n\ntype ModuleContextMap = Record\n\ninterface ModuleContextEntry {\n id: () => ModuleId\n module: () => any\n}\n\ninterface ModuleContext {\n // require call\n (moduleId: string): Exports | EsmNamespaceObject\n\n // async import call\n import(moduleId: string): Promise\n\n keys(): ModuleId[]\n\n resolve(moduleId: string): ModuleId\n}\n\ntype GetOrInstantiateModuleFromParent = (\n moduleId: M['id'],\n parentModule: M\n) => M\n\ndeclare function getOrInstantiateRuntimeModule(\n chunkPath: ChunkPath,\n moduleId: ModuleId\n): Module\n\nconst hasOwnProperty = Object.prototype.hasOwnProperty\nconst toStringTag = typeof Symbol !== 'undefined' && Symbol.toStringTag\n\nfunction defineProp(\n obj: any,\n name: PropertyKey,\n options: PropertyDescriptor & ThisType\n) {\n if (!hasOwnProperty.call(obj, name)) Object.defineProperty(obj, name, options)\n}\n\nfunction getOverwrittenModule(\n moduleCache: ModuleCache,\n id: ModuleId\n): Module {\n let module = moduleCache[id]\n if (!module) {\n if (createModuleWithDirectionFlag) {\n // set in development modes for hmr support\n module = createModuleWithDirection(id)\n } else {\n module = createModuleObject(id)\n }\n moduleCache[id] = module\n }\n return module\n}\n\n/**\n * Creates the module object. Only done here to ensure all module objects have the same shape.\n */\nfunction createModuleObject(id: ModuleId): Module {\n return {\n exports: {},\n error: undefined,\n id,\n namespaceObject: undefined,\n }\n}\n\nfunction createModuleWithDirection(id: ModuleId): ModuleWithDirection {\n return {\n exports: {},\n error: undefined,\n id,\n namespaceObject: undefined,\n parents: [],\n children: [],\n }\n}\n\ntype BindingTag = 0\nconst BindingTag_Value = 0 as BindingTag\n\n// an arbitrary sequence of bindings as\n// - a prop name\n// - BindingTag_Value, a value to be bound directly, or\n// - 1 or 2 functions to bind as getters and sdetters\ntype EsmBindings = Array<\n string | BindingTag | (() => unknown) | ((v: unknown) => void) | unknown\n>\n\n/**\n * Adds the getters to the exports object.\n */\nfunction esm(exports: Exports, bindings: EsmBindings) {\n defineProp(exports, '__esModule', { value: true })\n if (toStringTag) defineProp(exports, toStringTag, { value: 'Module' })\n let i = 0\n while (i < bindings.length) {\n const propName = bindings[i++] as string\n const tagOrFunction = bindings[i++]\n if (typeof tagOrFunction === 'number') {\n if (tagOrFunction === BindingTag_Value) {\n defineProp(exports, propName, {\n value: bindings[i++],\n enumerable: true,\n writable: false,\n })\n } else {\n throw new Error(`unexpected tag: ${tagOrFunction}`)\n }\n } else {\n const getterFn = tagOrFunction as () => unknown\n if (typeof bindings[i] === 'function') {\n const setterFn = bindings[i++] as (v: unknown) => void\n defineProp(exports, propName, {\n get: getterFn,\n set: setterFn,\n enumerable: true,\n })\n } else {\n defineProp(exports, propName, {\n get: getterFn,\n enumerable: true,\n })\n }\n }\n }\n Object.seal(exports)\n}\n\n/**\n * Makes the module an ESM with exports\n */\nfunction esmExport(\n this: TurbopackBaseContext,\n bindings: EsmBindings,\n id: ModuleId | undefined\n) {\n let module: Module\n let exports: Module['exports']\n if (id != null) {\n module = getOverwrittenModule(this.c, id)\n exports = module.exports\n } else {\n module = this.m\n exports = this.e\n }\n module.namespaceObject = exports\n esm(exports, bindings)\n}\ncontextPrototype.s = esmExport\n\ntype ReexportedObjects = Record[]\nfunction ensureDynamicExports(\n module: Module,\n exports: Exports\n): ReexportedObjects {\n let reexportedObjects: ReexportedObjects | undefined =\n REEXPORTED_OBJECTS.get(module)\n\n if (!reexportedObjects) {\n REEXPORTED_OBJECTS.set(module, (reexportedObjects = []))\n module.exports = module.namespaceObject = new Proxy(exports, {\n get(target, prop) {\n if (\n hasOwnProperty.call(target, prop) ||\n prop === 'default' ||\n prop === '__esModule'\n ) {\n return Reflect.get(target, prop)\n }\n for (const obj of reexportedObjects!) {\n const value = Reflect.get(obj, prop)\n if (value !== undefined) return value\n }\n return undefined\n },\n ownKeys(target) {\n const keys = Reflect.ownKeys(target)\n for (const obj of reexportedObjects!) {\n for (const key of Reflect.ownKeys(obj)) {\n if (key !== 'default' && !keys.includes(key)) keys.push(key)\n }\n }\n return keys\n },\n })\n }\n return reexportedObjects\n}\n\n/**\n * Dynamically exports properties from an object\n */\nfunction dynamicExport(\n this: TurbopackBaseContext,\n object: Record,\n id: ModuleId | undefined\n) {\n let module: Module\n let exports: Exports\n if (id != null) {\n module = getOverwrittenModule(this.c, id)\n exports = module.exports\n } else {\n module = this.m\n exports = this.e\n }\n const reexportedObjects = ensureDynamicExports(module, exports)\n\n if (typeof object === 'object' && object !== null) {\n reexportedObjects.push(object)\n }\n}\ncontextPrototype.j = dynamicExport\n\nfunction exportValue(\n this: TurbopackBaseContext,\n value: any,\n id: ModuleId | undefined\n) {\n let module: Module\n if (id != null) {\n module = getOverwrittenModule(this.c, id)\n } else {\n module = this.m\n }\n module.exports = value\n}\ncontextPrototype.v = exportValue\n\nfunction exportNamespace(\n this: TurbopackBaseContext,\n namespace: any,\n id: ModuleId | undefined\n) {\n let module: Module\n if (id != null) {\n module = getOverwrittenModule(this.c, id)\n } else {\n module = this.m\n }\n module.exports = module.namespaceObject = namespace\n}\ncontextPrototype.n = exportNamespace\n\nfunction createGetter(obj: Record, key: string | symbol) {\n return () => obj[key]\n}\n\n/**\n * @returns prototype of the object\n */\nconst getProto: (obj: any) => any = Object.getPrototypeOf\n ? (obj) => Object.getPrototypeOf(obj)\n : (obj) => obj.__proto__\n\n/** Prototypes that are not expanded for exports */\nconst LEAF_PROTOTYPES = [null, getProto({}), getProto([]), getProto(getProto)]\n\n/**\n * @param raw\n * @param ns\n * @param allowExportDefault\n * * `false`: will have the raw module as default export\n * * `true`: will have the default property as default export\n */\nfunction interopEsm(\n raw: Exports,\n ns: EsmNamespaceObject,\n allowExportDefault?: boolean\n) {\n const bindings: EsmBindings = []\n let defaultLocation = -1\n for (\n let current = raw;\n (typeof current === 'object' || typeof current === 'function') &&\n !LEAF_PROTOTYPES.includes(current);\n current = getProto(current)\n ) {\n for (const key of Object.getOwnPropertyNames(current)) {\n bindings.push(key, createGetter(raw, key))\n if (defaultLocation === -1 && key === 'default') {\n defaultLocation = bindings.length - 1\n }\n }\n }\n\n // this is not really correct\n // we should set the `default` getter if the imported module is a `.cjs file`\n if (!(allowExportDefault && defaultLocation >= 0)) {\n // Replace the binding with one for the namespace itself in order to preserve iteration order.\n if (defaultLocation >= 0) {\n // Replace the getter with the value\n bindings.splice(defaultLocation, 1, BindingTag_Value, raw)\n } else {\n bindings.push('default', BindingTag_Value, raw)\n }\n }\n\n esm(ns, bindings)\n return ns\n}\n\nfunction createNS(raw: Module['exports']): EsmNamespaceObject {\n if (typeof raw === 'function') {\n return function (this: any, ...args: any[]) {\n return raw.apply(this, args)\n }\n } else {\n return Object.create(null)\n }\n}\n\nfunction esmImport(\n this: TurbopackBaseContext,\n id: ModuleId\n): Exclude {\n const module = getOrInstantiateModuleFromParent(id, this.m)\n\n // any ES module has to have `module.namespaceObject` defined.\n if (module.namespaceObject) return module.namespaceObject\n\n // only ESM can be an async module, so we don't need to worry about exports being a promise here.\n const raw = module.exports\n return (module.namespaceObject = interopEsm(\n raw,\n createNS(raw),\n raw && (raw as any).__esModule\n ))\n}\ncontextPrototype.i = esmImport\n\nfunction asyncLoader(\n this: TurbopackBaseContext,\n moduleId: ModuleId\n): Promise {\n const loader = this.r(moduleId) as (\n importFunction: EsmImport\n ) => Promise\n return loader(esmImport.bind(this))\n}\ncontextPrototype.A = asyncLoader\n\n// Add a simple runtime require so that environments without one can still pass\n// `typeof require` CommonJS checks so that exports are correctly registered.\nconst runtimeRequire =\n // @ts-ignore\n typeof require === 'function'\n ? // @ts-ignore\n require\n : function require() {\n throw new Error('Unexpected use of runtime require')\n }\ncontextPrototype.t = runtimeRequire\n\nfunction commonJsRequire(\n this: TurbopackBaseContext,\n id: ModuleId\n): Exports {\n return getOrInstantiateModuleFromParent(id, this.m).exports\n}\ncontextPrototype.r = commonJsRequire\n\n/**\n * Remove fragments and query parameters since they are never part of the context map keys\n *\n * This matches how we parse patterns at resolving time. Arguably we should only do this for\n * strings passed to `import` but the resolve does it for `import` and `require` and so we do\n * here as well.\n */\nfunction parseRequest(request: string): string {\n // Per the URI spec fragments can contain `?` characters, so we should trim it off first\n // https://datatracker.ietf.org/doc/html/rfc3986#section-3.5\n const hashIndex = request.indexOf('#')\n if (hashIndex !== -1) {\n request = request.substring(0, hashIndex)\n }\n\n const queryIndex = request.indexOf('?')\n if (queryIndex !== -1) {\n request = request.substring(0, queryIndex)\n }\n\n return request\n}\n/**\n * `require.context` and require/import expression runtime.\n */\nfunction moduleContext(map: ModuleContextMap): ModuleContext {\n function moduleContext(id: string): Exports {\n id = parseRequest(id)\n if (hasOwnProperty.call(map, id)) {\n return map[id].module()\n }\n\n const e = new Error(`Cannot find module '${id}'`)\n ;(e as any).code = 'MODULE_NOT_FOUND'\n throw e\n }\n\n moduleContext.keys = (): string[] => {\n return Object.keys(map)\n }\n\n moduleContext.resolve = (id: string): ModuleId => {\n id = parseRequest(id)\n if (hasOwnProperty.call(map, id)) {\n return map[id].id()\n }\n\n const e = new Error(`Cannot find module '${id}'`)\n ;(e as any).code = 'MODULE_NOT_FOUND'\n throw e\n }\n\n moduleContext.import = async (id: string) => {\n return await (moduleContext(id) as Promise)\n }\n\n return moduleContext\n}\ncontextPrototype.f = moduleContext\n\n/**\n * Returns the path of a chunk defined by its data.\n */\nfunction getChunkPath(chunkData: ChunkData): ChunkPath {\n return typeof chunkData === 'string' ? chunkData : chunkData.path\n}\n\nfunction isPromise(maybePromise: any): maybePromise is Promise {\n return (\n maybePromise != null &&\n typeof maybePromise === 'object' &&\n 'then' in maybePromise &&\n typeof maybePromise.then === 'function'\n )\n}\n\nfunction isAsyncModuleExt(obj: T): obj is AsyncModuleExt & T {\n return turbopackQueues in obj\n}\n\nfunction createPromise() {\n let resolve: (value: T | PromiseLike) => void\n let reject: (reason?: any) => void\n\n const promise = new Promise((res, rej) => {\n reject = rej\n resolve = res\n })\n\n return {\n promise,\n resolve: resolve!,\n reject: reject!,\n }\n}\n\n// Load the CompressedmoduleFactories of a chunk into the `moduleFactories` Map.\n// The CompressedModuleFactories format is\n// - 1 or more module ids\n// - a module factory function\n// So walking this is a little complex but the flat structure is also fast to\n// traverse, we can use `typeof` operators to distinguish the two cases.\nfunction installCompressedModuleFactories(\n chunkModules: CompressedModuleFactories,\n offset: number,\n moduleFactories: ModuleFactories,\n newModuleId?: (id: ModuleId) => void\n) {\n let i = offset\n while (i < chunkModules.length) {\n let end = i + 1\n // Find our factory function\n while (\n end < chunkModules.length &&\n typeof chunkModules[end] !== 'function'\n ) {\n end++\n }\n if (end === chunkModules.length) {\n throw new Error('malformed chunk format, expected a factory function')\n }\n\n // Install the factory for each module ID that doesn't already have one.\n // When some IDs in this group already have a factory, reuse that existing\n // group factory for the missing IDs to keep all IDs in the group consistent.\n // Otherwise, install the factory from this chunk.\n const moduleFactoryFn = chunkModules[end] as Function\n let existingGroupFactory: Function | undefined = undefined\n for (let j = i; j < end; j++) {\n const id = chunkModules[j] as ModuleId\n const existingFactory = moduleFactories.get(id)\n if (existingFactory) {\n existingGroupFactory = existingFactory\n break\n }\n }\n const factoryToInstall = existingGroupFactory ?? moduleFactoryFn\n\n let didInstallFactory = false\n for (let j = i; j < end; j++) {\n const id = chunkModules[j] as ModuleId\n if (!moduleFactories.has(id)) {\n if (!didInstallFactory) {\n if (factoryToInstall === moduleFactoryFn) {\n applyModuleFactoryName(moduleFactoryFn)\n }\n didInstallFactory = true\n }\n moduleFactories.set(id, factoryToInstall)\n newModuleId?.(id)\n }\n }\n i = end + 1 // end is pointing at the last factory advance to the next id or the end of the array.\n }\n}\n\n// everything below is adapted from webpack\n// https://github.com/webpack/webpack/blob/6be4065ade1e252c1d8dcba4af0f43e32af1bdc1/lib/runtime/AsyncModuleRuntimeModule.js#L13\n\nconst turbopackQueues = Symbol('turbopack queues')\nconst turbopackExports = Symbol('turbopack exports')\nconst turbopackError = Symbol('turbopack error')\n\nconst enum QueueStatus {\n Unknown = -1,\n Unresolved = 0,\n Resolved = 1,\n}\n\ntype AsyncQueueFn = (() => void) & { queueCount: number }\ntype AsyncQueue = AsyncQueueFn[] & {\n status: QueueStatus\n}\n\nfunction resolveQueue(queue?: AsyncQueue) {\n if (queue && queue.status !== QueueStatus.Resolved) {\n queue.status = QueueStatus.Resolved\n queue.forEach((fn) => fn.queueCount--)\n queue.forEach((fn) => (fn.queueCount-- ? fn.queueCount++ : fn()))\n }\n}\n\ntype Dep = Exports | AsyncModulePromise | Promise\n\ntype AsyncModuleExt = {\n [turbopackQueues]: (fn: (queue: AsyncQueue) => void) => void\n [turbopackExports]: Exports\n [turbopackError]?: any\n}\n\ntype AsyncModulePromise = Promise & AsyncModuleExt\n\nfunction wrapDeps(deps: Dep[]): AsyncModuleExt[] {\n return deps.map((dep): AsyncModuleExt => {\n if (dep !== null && typeof dep === 'object') {\n if (isAsyncModuleExt(dep)) return dep\n if (isPromise(dep)) {\n const queue: AsyncQueue = Object.assign([], {\n status: QueueStatus.Unresolved,\n })\n\n const obj: AsyncModuleExt = {\n [turbopackExports]: {},\n [turbopackQueues]: (fn: (queue: AsyncQueue) => void) => fn(queue),\n }\n\n dep.then(\n (res) => {\n obj[turbopackExports] = res\n resolveQueue(queue)\n },\n (err) => {\n obj[turbopackError] = err\n resolveQueue(queue)\n }\n )\n\n return obj\n }\n }\n\n return {\n [turbopackExports]: dep,\n [turbopackQueues]: () => {},\n }\n })\n}\n\nfunction asyncModule(\n this: TurbopackBaseContext,\n body: (\n handleAsyncDependencies: (\n deps: Dep[]\n ) => Exports[] | Promise<() => Exports[]>,\n asyncResult: (err?: any) => void\n ) => void,\n hasAwait: boolean\n) {\n const module = this.m\n const queue: AsyncQueue | undefined = hasAwait\n ? Object.assign([], { status: QueueStatus.Unknown })\n : undefined\n\n const depQueues: Set = new Set()\n\n const { resolve, reject, promise: rawPromise } = createPromise()\n\n const promise: AsyncModulePromise = Object.assign(rawPromise, {\n [turbopackExports]: module.exports,\n [turbopackQueues]: (fn) => {\n queue && fn(queue)\n depQueues.forEach(fn)\n promise['catch'](() => {})\n },\n } satisfies AsyncModuleExt)\n\n const attributes: PropertyDescriptor = {\n get(): any {\n return promise\n },\n set(v: any) {\n // Calling `esmExport` leads to this.\n if (v !== promise) {\n promise[turbopackExports] = v\n }\n },\n }\n\n Object.defineProperty(module, 'exports', attributes)\n Object.defineProperty(module, 'namespaceObject', attributes)\n\n function handleAsyncDependencies(deps: Dep[]) {\n const currentDeps = wrapDeps(deps)\n\n const getResult = () =>\n currentDeps.map((d) => {\n if (d[turbopackError]) throw d[turbopackError]\n return d[turbopackExports]\n })\n\n const { promise, resolve } = createPromise<() => Exports[]>()\n\n const fn: AsyncQueueFn = Object.assign(() => resolve(getResult), {\n queueCount: 0,\n })\n\n function fnQueue(q: AsyncQueue) {\n if (q !== queue && !depQueues.has(q)) {\n depQueues.add(q)\n if (q && q.status === QueueStatus.Unresolved) {\n fn.queueCount++\n q.push(fn)\n }\n }\n }\n\n currentDeps.map((dep) => dep[turbopackQueues](fnQueue))\n\n return fn.queueCount ? promise : getResult()\n }\n\n function asyncResult(err?: any) {\n if (err) {\n reject((promise[turbopackError] = err))\n } else {\n resolve(promise[turbopackExports])\n }\n\n resolveQueue(queue)\n }\n\n body(handleAsyncDependencies, asyncResult)\n\n if (queue && queue.status === QueueStatus.Unknown) {\n queue.status = QueueStatus.Unresolved\n }\n}\ncontextPrototype.a = asyncModule\n\n/**\n * A pseudo \"fake\" URL object to resolve to its relative path.\n *\n * When UrlRewriteBehavior is set to relative, calls to the `new URL()` will construct url without base using this\n * runtime function to generate context-agnostic urls between different rendering context, i.e ssr / client to avoid\n * hydration mismatch.\n *\n * This is based on webpack's existing implementation:\n * https://github.com/webpack/webpack/blob/87660921808566ef3b8796f8df61bd79fc026108/lib/runtime/RelativeUrlRuntimeModule.js\n */\nconst relativeURL = function relativeURL(this: any, inputUrl: string) {\n const realUrl = new URL(inputUrl, 'x:/')\n const values: Record = {}\n for (const key in realUrl) values[key] = (realUrl as any)[key]\n values.href = inputUrl\n values.pathname = inputUrl.replace(/[?#].*/, '')\n values.origin = values.protocol = ''\n values.toString = values.toJSON = (..._args: Array) => inputUrl\n for (const key in values)\n Object.defineProperty(this, key, {\n enumerable: true,\n configurable: true,\n value: values[key],\n })\n}\nrelativeURL.prototype = URL.prototype\ncontextPrototype.U = relativeURL\n\n/**\n * Utility function to ensure all variants of an enum are handled.\n */\nfunction invariant(never: never, computeMessage: (arg: any) => string): never {\n throw new Error(`Invariant: ${computeMessage(never)}`)\n}\n\n/**\n * Constructs an error message for when a module factory is not available.\n */\nfunction factoryNotAvailableMessage(\n moduleId: ModuleId,\n sourceType: SourceType,\n sourceData: SourceData\n): string {\n let instantiationReason: string\n switch (sourceType) {\n case SourceType.Runtime:\n instantiationReason = `as a runtime entry of chunk ${sourceData}`\n break\n case SourceType.Parent:\n instantiationReason = `because it was required from module ${sourceData}`\n break\n case SourceType.Update:\n instantiationReason = 'because of an HMR update'\n break\n default:\n invariant(\n sourceType,\n (sourceType) => `Unknown source type: ${sourceType}`\n )\n }\n return `Module ${moduleId} was instantiated ${instantiationReason}, but the module factory is not available.`\n}\n\n/**\n * A stub function to make `require` available but non-functional in ESM.\n */\nfunction requireStub(_moduleId: ModuleId): never {\n throw new Error('dynamic usage of require is not supported')\n}\ncontextPrototype.z = requireStub\n\n// Make `globalThis` available to the module in a way that cannot be shadowed by a local variable.\ncontextPrototype.g = globalThis\n\ntype ContextConstructor = {\n new (module: Module, exports: Exports): TurbopackBaseContext\n}\n\nfunction applyModuleFactoryName(factory: Function) {\n // Give the module factory a nice name to improve stack traces.\n Object.defineProperty(factory, 'name', {\n value: 'module evaluation',\n })\n}\n"],"names":["SourceType","createModuleWithDirectionFlag","REEXPORTED_OBJECTS","WeakMap","Context","module","exports","m","e","contextPrototype","prototype","hasOwnProperty","Object","toStringTag","Symbol","defineProp","obj","name","options","call","defineProperty","getOverwrittenModule","moduleCache","id","createModuleWithDirection","createModuleObject","error","undefined","namespaceObject","parents","children","BindingTag_Value","esm","bindings","value","i","length","propName","tagOrFunction","enumerable","writable","Error","getterFn","setterFn","get","set","seal","esmExport","c","s","ensureDynamicExports","reexportedObjects","Proxy","target","prop","Reflect","ownKeys","keys","key","includes","push","dynamicExport","object","j","exportValue","v","exportNamespace","namespace","n","createGetter","getProto","getPrototypeOf","__proto__","LEAF_PROTOTYPES","interopEsm","raw","ns","allowExportDefault","defaultLocation","current","getOwnPropertyNames","splice","createNS","args","apply","create","esmImport","getOrInstantiateModuleFromParent","__esModule","asyncLoader","moduleId","loader","r","bind","A","runtimeRequire","require","require1","t","commonJsRequire","parseRequest","request","hashIndex","indexOf","substring","queryIndex","moduleContext","map","code","resolve","import","f","getChunkPath","chunkData","path","isPromise","maybePromise","then","isAsyncModuleExt","turbopackQueues","createPromise","reject","promise","Promise","res","rej","installCompressedModuleFactories","chunkModules","offset","moduleFactories","newModuleId","end","moduleFactoryFn","existingGroupFactory","existingFactory","factoryToInstall","didInstallFactory","has","applyModuleFactoryName","turbopackExports","turbopackError","resolveQueue","queue","status","forEach","fn","queueCount","wrapDeps","deps","dep","assign","err","asyncModule","body","hasAwait","depQueues","Set","rawPromise","attributes","handleAsyncDependencies","currentDeps","getResult","d","fnQueue","q","add","asyncResult","a","relativeURL","inputUrl","realUrl","URL","values","href","pathname","replace","origin","protocol","toString","toJSON","_args","configurable","U","invariant","never","computeMessage","factoryNotAvailableMessage","sourceType","sourceData","instantiationReason","requireStub","_moduleId","z","g","globalThis","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AAQ,GAAG;IAClCL,OAAOM,QAAQ,GAAGN,OAAOO,MAAM,GAAG,CAAC,GAAGC,QAAsBX;IAC5D,IAAK,MAAM/G,OAAOkH,OAChBhK,OAAOQ,cAAc,CAAC,IAAI,EAAEsC,KAAK;QAC/BnB,YAAY;QACZ8I,cAAc;QACdnJ,OAAO0I,MAAM,CAAClH,IAAI;IACpB;AACJ;AACA8G,YAAY9J,SAAS,GAAGiK,IAAIjK,SAAS;AACrCD,iBAAiB6K,CAAC,GAAGd;AAErB;;CAEC,GACD,SAASe,UAAUC,KAAY,EAAEC,cAAoC;IACnE,MAAM,IAAIhJ,MAAM,CAAC,WAAW,EAAEgJ,eAAeD,QAAQ;AACvD;AAEA;;CAEC,GACD,SAASE,2BACPhG,QAAkB,EAClBiG,UAAsB,EACtBC,UAAsB;IAEtB,IAAIC;IACJ,OAAQF;QACN;YACEE,sBAAsB,CAAC,4BAA4B,EAAED,YAAY;YACjE;QACF;YACEC,sBAAsB,CAAC,oCAAoC,EAAED,YAAY;YACzE;QACF;YACEC,sBAAsB;YACtB;QACF;YACEN,UACEI,YACA,CAACA,aAAe,CAAC,qBAAqB,EAAEA,YAAY;IAE1D;IACA,OAAO,CAAC,OAAO,EAAEjG,SAAS,kBAAkB,EAAEmG,oBAAoB,0CAA0C,CAAC;AAC/G;AAEA;;CAEC,GACD,SAASC,YAAYC,SAAmB;IACtC,MAAM,IAAItJ,MAAM;AAClB;AACAhC,iBAAiBuL,CAAC,GAAGF;AAErB,kGAAkG;AAClGrL,iBAAiBwL,CAAC,GAAGC;AAMrB,SAASxD,uBAAuByD,OAAiB;IAC/C,+DAA+D;IAC/DvL,OAAOQ,cAAc,CAAC+K,SAAS,QAAQ;QACrCjK,OAAO;IACT;AACF","ignoreList":[0]}},
- {"offset": {"line": 592, "column": 0}, "map": {"version":3,"sources":["turbopack:///[turbopack]/browser/runtime/base/runtime-base.ts"],"sourcesContent":["/**\n * This file contains runtime types and functions that are shared between all\n * Turbopack *browser* ECMAScript runtimes.\n *\n * It will be appended to the runtime code of each runtime right after the\n * shared runtime utils.\n */\n\n/* eslint-disable @typescript-eslint/no-unused-vars */\n\n/// \n/// \n\n// Used in WebWorkers to tell the runtime about the chunk suffix\ndeclare var TURBOPACK_ASSET_SUFFIX: string\n// Used in WebWorkers to tell the runtime about the current chunk url since it\n// can't be detected via `document.currentScript`. Note it's stored in reversed\n// order to use `push` and `pop`\ndeclare var TURBOPACK_NEXT_CHUNK_URLS: ChunkUrl[] | undefined\n\n// Injected by rust code\ndeclare var CHUNK_BASE_PATH: string\ndeclare var ASSET_SUFFIX: string\ndeclare var CROSS_ORIGIN: 'anonymous' | 'use-credentials' | null\ndeclare var WORKER_FORWARDED_GLOBALS: string[]\n\ninterface TurbopackBrowserBaseContext extends TurbopackBaseContext {\n R: ResolvePathFromModule\n}\n\nconst browserContextPrototype =\n Context.prototype as TurbopackBrowserBaseContext\n\n// Provided by build or dev base\ndeclare function instantiateModule(\n id: ModuleId,\n sourceType: SourceType,\n sourceData: SourceData\n): Module\n\ntype RuntimeParams = {\n otherChunks: ChunkData[]\n runtimeModuleIds: ModuleId[]\n}\n\ntype ChunkRegistrationChunk =\n | ChunkPath\n | { getAttribute: (name: string) => string | null }\n | undefined\n\ntype ChunkRegistration = [\n chunkPath: ChunkRegistrationChunk,\n ...([RuntimeParams] | CompressedModuleFactories),\n]\n\ntype ChunkList = {\n script: ChunkRegistrationChunk\n chunks: ChunkData[]\n source: 'entry' | 'dynamic'\n}\n\ninterface RuntimeBackend {\n registerChunk: (\n chunkPath: ChunkPath | ChunkScript,\n params?: RuntimeParams\n ) => void\n /**\n * Returns the same Promise for the same chunk URL.\n */\n loadChunkCached: (sourceType: SourceType, chunkUrl: ChunkUrl) => Promise\n loadWebAssembly: (\n sourceType: SourceType,\n sourceData: SourceData,\n wasmChunkPath: ChunkPath,\n edgeModule: () => WebAssembly.Module,\n importsObj: WebAssembly.Imports\n ) => Promise\n loadWebAssemblyModule: (\n sourceType: SourceType,\n sourceData: SourceData,\n wasmChunkPath: ChunkPath,\n edgeModule: () => WebAssembly.Module\n ) => Promise\n}\n\ninterface DevRuntimeBackend {\n reloadChunk?: (chunkUrl: ChunkUrl) => Promise\n unloadChunk?: (chunkUrl: ChunkUrl) => void\n restart: () => void\n}\n\nconst moduleFactories: ModuleFactories = new Map()\ncontextPrototype.M = moduleFactories\n\nconst availableModules: Map | true> = new Map()\n\nconst availableModuleChunks: Map | true> = new Map()\n\nfunction loadChunk(\n this: TurbopackBrowserBaseContext,\n chunkData: ChunkData\n): Promise {\n return loadChunkInternal(SourceType.Parent, this.m.id, chunkData)\n}\nbrowserContextPrototype.l = loadChunk\n\nfunction loadInitialChunk(chunkPath: ChunkPath, chunkData: ChunkData) {\n return loadChunkInternal(SourceType.Runtime, chunkPath, chunkData)\n}\n\nasync function loadChunkInternal(\n sourceType: SourceType,\n sourceData: SourceData,\n chunkData: ChunkData\n): Promise {\n if (typeof chunkData === 'string') {\n return loadChunkPath(sourceType, sourceData, chunkData)\n }\n\n const includedList = chunkData.included || []\n const modulesPromises = includedList.map((included) => {\n if (moduleFactories.has(included)) return true\n return availableModules.get(included)\n })\n if (modulesPromises.length > 0 && modulesPromises.every((p) => p)) {\n // When all included items are already loaded or loading, we can skip loading ourselves\n await Promise.all(modulesPromises)\n return\n }\n\n const includedModuleChunksList = chunkData.moduleChunks || []\n const moduleChunksPromises = includedModuleChunksList\n .map((included) => {\n // TODO(alexkirsz) Do we need this check?\n // if (moduleFactories[included]) return true;\n return availableModuleChunks.get(included)\n })\n .filter((p) => p)\n\n let promise: Promise\n if (moduleChunksPromises.length > 0) {\n // Some module chunks are already loaded or loading.\n\n if (moduleChunksPromises.length === includedModuleChunksList.length) {\n // When all included module chunks are already loaded or loading, we can skip loading ourselves\n await Promise.all(moduleChunksPromises)\n return\n }\n\n const moduleChunksToLoad: Set = new Set()\n for (const moduleChunk of includedModuleChunksList) {\n if (!availableModuleChunks.has(moduleChunk)) {\n moduleChunksToLoad.add(moduleChunk)\n }\n }\n\n for (const moduleChunkToLoad of moduleChunksToLoad) {\n const promise = loadChunkPath(sourceType, sourceData, moduleChunkToLoad)\n\n availableModuleChunks.set(moduleChunkToLoad, promise)\n\n moduleChunksPromises.push(promise)\n }\n\n promise = Promise.all(moduleChunksPromises)\n } else {\n promise = loadChunkPath(sourceType, sourceData, chunkData.path)\n\n // Mark all included module chunks as loading if they are not already loaded or loading.\n for (const includedModuleChunk of includedModuleChunksList) {\n if (!availableModuleChunks.has(includedModuleChunk)) {\n availableModuleChunks.set(includedModuleChunk, promise)\n }\n }\n }\n\n for (const included of includedList) {\n if (!availableModules.has(included)) {\n // It might be better to race old and new promises, but it's rare that the new promise will be faster than a request started earlier.\n // In production it's even more rare, because the chunk optimization tries to deduplicate modules anyway.\n availableModules.set(included, promise)\n }\n }\n\n await promise\n}\n\nconst loadedChunk = Promise.resolve(undefined)\nconst instrumentedBackendLoadChunks = new WeakMap<\n Promise,\n Promise | typeof loadedChunk\n>()\n// Do not make this async. React relies on referential equality of the returned Promise.\nfunction loadChunkByUrl(\n this: TurbopackBrowserBaseContext,\n chunkUrl: ChunkUrl\n) {\n return loadChunkByUrlInternal(SourceType.Parent, this.m.id, chunkUrl)\n}\nbrowserContextPrototype.L = loadChunkByUrl\n\n// Do not make this async. React relies on referential equality of the returned Promise.\nfunction loadChunkByUrlInternal(\n sourceType: SourceType,\n sourceData: SourceData,\n chunkUrl: ChunkUrl\n): Promise {\n const thenable = BACKEND.loadChunkCached(sourceType, chunkUrl)\n let entry = instrumentedBackendLoadChunks.get(thenable)\n if (entry === undefined) {\n const resolve = instrumentedBackendLoadChunks.set.bind(\n instrumentedBackendLoadChunks,\n thenable,\n loadedChunk\n )\n entry = thenable.then(resolve).catch((cause) => {\n let loadReason: string\n switch (sourceType) {\n case SourceType.Runtime:\n loadReason = `as a runtime dependency of chunk ${sourceData}`\n break\n case SourceType.Parent:\n loadReason = `from module ${sourceData}`\n break\n case SourceType.Update:\n loadReason = 'from an HMR update'\n break\n default:\n invariant(\n sourceType,\n (sourceType) => `Unknown source type: ${sourceType}`\n )\n }\n let error = new Error(\n `Failed to load chunk ${chunkUrl} ${loadReason}${\n cause ? `: ${cause}` : ''\n }`,\n cause ? { cause } : undefined\n )\n error.name = 'ChunkLoadError'\n throw error\n })\n instrumentedBackendLoadChunks.set(thenable, entry)\n }\n\n return entry\n}\n\n// Do not make this async. React relies on referential equality of the returned Promise.\nfunction loadChunkPath(\n sourceType: SourceType,\n sourceData: SourceData,\n chunkPath: ChunkPath\n): Promise {\n const url = getChunkRelativeUrl(chunkPath)\n return loadChunkByUrlInternal(sourceType, sourceData, url)\n}\n\n/**\n * Returns an absolute url to an asset.\n */\nfunction resolvePathFromModule(\n this: TurbopackBaseContext,\n moduleId: string\n): string {\n const exported = this.r(moduleId)\n return exported?.default ?? exported\n}\nbrowserContextPrototype.R = resolvePathFromModule\n\n/**\n * no-op for browser\n * @param modulePath\n */\nfunction resolveAbsolutePath(modulePath?: string): string {\n return `/ROOT/${modulePath ?? ''}`\n}\nbrowserContextPrototype.P = resolveAbsolutePath\n\n/**\n * Exports a URL with the static suffix appended.\n */\nfunction exportUrl(\n this: TurbopackBrowserBaseContext,\n url: string,\n id: ModuleId | undefined\n) {\n exportValue.call(this, `${url}${ASSET_SUFFIX}`, id)\n}\nbrowserContextPrototype.q = exportUrl\n\n/**\n * Creates a worker by instantiating the given WorkerConstructor with the\n * appropriate URL and options.\n *\n * The entrypoint is a pre-compiled worker runtime file. The params configure\n * which module chunks to load and which module to run as the entry point.\n *\n * The params are a JSON array of the following structure:\n * `[TURBOPACK_NEXT_CHUNK_URLS, ASSET_SUFFIX, ...WORKER_FORWARDED_GLOBALS values]`\n *\n * @param WorkerConstructor The Worker or SharedWorker constructor\n * @param entrypoint URL path to the worker entrypoint chunk\n * @param moduleChunks list of module chunk paths to load\n * @param workerOptions options to pass to the Worker constructor (optional)\n */\nfunction createWorker(\n WorkerConstructor: { new (url: URL, options?: object): Worker },\n entrypoint: ChunkPath,\n moduleChunks: ChunkPath[],\n workerOptions?: object\n): Worker {\n const isSharedWorker = WorkerConstructor.name === 'SharedWorker'\n\n const chunkUrls = moduleChunks\n .map((chunk) => getChunkRelativeUrl(chunk))\n .reverse()\n const params: unknown[] = [chunkUrls, ASSET_SUFFIX]\n for (const globalName of WORKER_FORWARDED_GLOBALS) {\n params.push((globalThis as Record)[globalName])\n }\n\n const url = new URL(getChunkRelativeUrl(entrypoint), location.origin)\n const paramsJson = JSON.stringify(params)\n if (isSharedWorker) {\n url.searchParams.set('params', paramsJson)\n } else {\n url.hash = '#params=' + encodeURIComponent(paramsJson)\n }\n\n // Remove type: \"module\" from options since our worker entrypoint is not a module\n const options = workerOptions\n ? { ...workerOptions, type: undefined }\n : undefined\n return new WorkerConstructor(url, options)\n}\nbrowserContextPrototype.b = createWorker\n\n/**\n * Instantiates a runtime module.\n */\nfunction instantiateRuntimeModule(\n moduleId: ModuleId,\n chunkPath: ChunkPath\n): Module {\n return instantiateModule(moduleId, SourceType.Runtime, chunkPath)\n}\n/**\n * Returns the URL relative to the origin where a chunk can be fetched from.\n */\nfunction getChunkRelativeUrl(chunkPath: ChunkPath | ChunkListPath): ChunkUrl {\n return `${CHUNK_BASE_PATH}${chunkPath\n .split('/')\n .map((p) => encodeURIComponent(p))\n .join('/')}${ASSET_SUFFIX}` as ChunkUrl\n}\n\n/**\n * Return the ChunkPath from a ChunkScript.\n */\nfunction getPathFromScript(chunkScript: ChunkPath | ChunkScript): ChunkPath\nfunction getPathFromScript(\n chunkScript: ChunkListPath | ChunkListScript\n): ChunkListPath\nfunction getPathFromScript(\n chunkScript: ChunkPath | ChunkListPath | ChunkScript | ChunkListScript\n): ChunkPath | ChunkListPath {\n if (typeof chunkScript === 'string') {\n return chunkScript as ChunkPath | ChunkListPath\n }\n const chunkUrl = chunkScript.src!\n const src = decodeURIComponent(chunkUrl.replace(/[?#].*$/, ''))\n const path = src.startsWith(CHUNK_BASE_PATH)\n ? src.slice(CHUNK_BASE_PATH.length)\n : src\n return path as ChunkPath | ChunkListPath\n}\n\n/**\n * Return the ChunkUrl from a ChunkScript.\n */\nfunction getUrlFromScript(chunk: ChunkPath | ChunkScript): ChunkUrl {\n if (typeof chunk === 'string') {\n return getChunkRelativeUrl(chunk)\n } else {\n // This is already exactly what we want\n return chunk.src! as ChunkUrl\n }\n}\n\n/**\n * Determine the chunk to register. Note that this function has side-effects!\n */\nfunction getChunkFromRegistration(\n chunk: ChunkRegistrationChunk\n): ChunkPath | CurrentScript {\n if (typeof chunk === 'string') {\n return chunk\n } else if (!chunk) {\n if (typeof TURBOPACK_NEXT_CHUNK_URLS !== 'undefined') {\n return { src: TURBOPACK_NEXT_CHUNK_URLS.pop()! } as CurrentScript\n } else {\n throw new Error('chunk path empty but not in a worker')\n }\n } else {\n return { src: chunk.getAttribute('src')! } as CurrentScript\n }\n}\n\n/**\n * Checks if a given path/URL ends with the given extension,\n * optionally followed by ?query or #fragment.\n */\nfunction endsWithExtension(\n chunkUrlOrPath: ChunkUrl | ChunkPath,\n ext: string\n): boolean {\n // Find where the path ends (before query or fragment)\n const q = chunkUrlOrPath.indexOf('?')\n let end: number\n if (q !== -1) {\n end = q\n } else {\n const h = chunkUrlOrPath.indexOf('#')\n end = h !== -1 ? h : chunkUrlOrPath.length\n }\n // Check if the path portion ends with the extension\n return end >= ext.length && chunkUrlOrPath.startsWith(ext, end - ext.length)\n}\n\nfunction isJs(chunkUrlOrPath: ChunkUrl | ChunkPath): boolean {\n return endsWithExtension(chunkUrlOrPath, '.js')\n}\n\nfunction isCss(chunkUrl: ChunkUrl): boolean {\n return endsWithExtension(chunkUrl, '.css')\n}\n\nfunction loadWebAssembly(\n this: TurbopackBaseContext,\n chunkPath: ChunkPath,\n edgeModule: () => WebAssembly.Module,\n importsObj: WebAssembly.Imports\n): Promise {\n return BACKEND.loadWebAssembly(\n SourceType.Parent,\n this.m.id,\n chunkPath,\n edgeModule,\n importsObj\n )\n}\ncontextPrototype.w = loadWebAssembly\n\nfunction loadWebAssemblyModule(\n this: TurbopackBaseContext,\n chunkPath: ChunkPath,\n edgeModule: () => WebAssembly.Module\n): Promise {\n return BACKEND.loadWebAssemblyModule(\n SourceType.Parent,\n this.m.id,\n chunkPath,\n edgeModule\n )\n}\ncontextPrototype.u = loadWebAssemblyModule\n"],"names":["browserContextPrototype","Context","prototype","moduleFactories","Map","contextPrototype","M","availableModules","availableModuleChunks","loadChunk","chunkData","loadChunkInternal","SourceType","Parent","m","id","l","loadInitialChunk","chunkPath","Runtime","sourceType","sourceData","loadChunkPath","includedList","included","modulesPromises","map","has","get","length","every","p","Promise","all","includedModuleChunksList","moduleChunks","moduleChunksPromises","filter","promise","moduleChunksToLoad","Set","moduleChunk","add","moduleChunkToLoad","set","push","path","includedModuleChunk","loadedChunk","resolve","undefined","instrumentedBackendLoadChunks","WeakMap","loadChunkByUrl","chunkUrl","loadChunkByUrlInternal","L","thenable","BACKEND","loadChunkCached","entry","bind","then","catch","cause","loadReason","Update","invariant","error","Error","name","url","getChunkRelativeUrl","resolvePathFromModule","moduleId","exported","r","default","R","resolveAbsolutePath","modulePath","P","exportUrl","exportValue","call","ASSET_SUFFIX","q","createWorker","WorkerConstructor","entrypoint","workerOptions","isSharedWorker","chunkUrls","chunk","reverse","params","globalName","WORKER_FORWARDED_GLOBALS","globalThis","URL","location","origin","paramsJson","JSON","stringify","searchParams","hash","encodeURIComponent","options","type","b","instantiateRuntimeModule","instantiateModule","CHUNK_BASE_PATH","split","join","getPathFromScript","chunkScript","src","decodeURIComponent","replace","startsWith","slice","getUrlFromScript","getChunkFromRegistration","TURBOPACK_NEXT_CHUNK_URLS","pop","getAttribute","endsWithExtension","chunkUrlOrPath","ext","indexOf","end","h","isJs","isCss","loadWebAssembly","edgeModule","importsObj","w","loadWebAssemblyModule","u"],"mappings":"AAAA;;;;;;CAMC,GAED,oDAAoD,GAEpD,6CAA6C;AAC7C,iEAAiE;AAEjE,gEAAgE;AAiBhE,MAAMA,0BACJC,QAAQC,SAA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Q8E,eAAe,CAC5B5H,WAAWC,MAAM,EACjB,IAAI,CAACC,CAAC,CAACC,EAAE,EACTG,WACAuH,YACAC;AAEJ;AACArI,iBAAiBsI,CAAC,GAAGH;AAErB,SAASI,sBAEP1H,SAAoB,EACpBuH,UAAoC;IAEpC,OAAO/E,QAAQkF,qBAAqB,CAClChI,WAAWC,MAAM,EACjB,IAAI,CAACC,CAAC,CAACC,EAAE,EACTG,WACAuH;AAEJ;AACApI,iBAAiBwI,CAAC,GAAGD","ignoreList":[0]}},
- {"offset": {"line": 851, "column": 0}, "map": {"version":3,"sources":["turbopack:///[turbopack]/shared/runtime/hmr-runtime.ts"],"sourcesContent":["/// \n/// \n/// \n/// \n\ntype HotModuleFactoryFunction = ModuleFactoryFunction<\n HotModule,\n TurbopackBaseContext\n>\n\n/**\n * Shared HMR (Hot Module Replacement) implementation.\n *\n * This file contains the complete HMR implementation that's shared between\n * browser and Node.js runtimes. It manages module hot state, dependency\n * tracking, the module.hot API, and the full HMR update flow.\n */\n\n/**\n * The development module cache shared across the runtime.\n * Browser runtime declares this directly.\n * Node.js runtime assigns globalThis.__turbopack_module_cache__ to this.\n */\nlet devModuleCache: Record\n\n/**\n * Module IDs that are instantiated as part of the runtime of a chunk.\n */\nlet runtimeModules: Set\n\n/**\n * Maps module IDs to persisted data between executions of their hot module\n * implementation (`hot.data`).\n */\nconst moduleHotData: Map = new Map()\n\n/**\n * Maps module instances to their hot module state.\n * Uses WeakMap so it works with both HotModule and ModuleWithDirection.\n */\nconst moduleHotState: WeakMap = new WeakMap()\n\n/**\n * Modules that call `module.hot.invalidate()` (while being updated).\n */\nconst queuedInvalidatedModules: Set = new Set()\n\nclass UpdateApplyError extends Error {\n name = 'UpdateApplyError'\n\n dependencyChain: ModuleId[]\n\n constructor(message: string, dependencyChain: ModuleId[]) {\n super(message)\n this.dependencyChain = dependencyChain\n }\n}\n\ntype ModuleEffect =\n | {\n type: 'unaccepted'\n dependencyChain: ModuleId[]\n }\n | {\n type: 'self-declined'\n dependencyChain: ModuleId[]\n moduleId: ModuleId\n }\n | {\n type: 'declined'\n dependencyChain: ModuleId[]\n moduleId: ModuleId\n parentId: ModuleId\n }\n | {\n type: 'accepted'\n moduleId: ModuleId\n outdatedModules: Set\n outdatedDependencies: Map>\n }\n\n/**\n * Records parent-child relationship when a module imports another.\n * Should be called during module instantiation.\n */\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nfunction trackModuleImport(\n parentModule: ModuleWithDirection,\n childModuleId: ModuleId,\n childModule: ModuleWithDirection | undefined\n): void {\n // Record that parent imports child\n if (parentModule.children.indexOf(childModuleId) === -1) {\n parentModule.children.push(childModuleId)\n }\n\n // Record that child is imported by parent\n if (childModule && childModule.parents.indexOf(parentModule.id) === -1) {\n childModule.parents.push(parentModule.id)\n }\n}\n\nfunction formatDependencyChain(dependencyChain: ModuleId[]): string {\n return `Dependency chain: ${dependencyChain.join(' -> ')}`\n}\n\n/**\n * Walks the dependency tree to find all modules affected by a change.\n * Returns information about whether the update can be accepted and which\n * modules need to be invalidated.\n *\n * @param moduleId - The module that changed\n * @param autoAcceptRootModules - If true, root modules auto-accept updates without explicit module.hot.accept().\n * This is used for server-side HMR where pages auto-accept at the top level.\n */\nfunction getAffectedModuleEffects(\n moduleId: ModuleId,\n autoAcceptRootModules: boolean\n): ModuleEffect {\n const outdatedModules: Set = new Set()\n const outdatedDependencies: Map> = new Map()\n\n type QueueItem = { moduleId?: ModuleId; dependencyChain: ModuleId[] }\n\n const queue: QueueItem[] = [\n {\n moduleId,\n dependencyChain: [],\n },\n ]\n\n let nextItem\n while ((nextItem = queue.shift())) {\n const { moduleId, dependencyChain } = nextItem\n\n if (moduleId != null) {\n if (outdatedModules.has(moduleId)) {\n // Avoid infinite loops caused by cycles between modules in the dependency chain.\n continue\n }\n\n outdatedModules.add(moduleId)\n }\n\n // We've arrived at the runtime of the chunk, which means that nothing\n // else above can accept this update.\n if (moduleId === undefined) {\n if (autoAcceptRootModules) {\n return {\n type: 'accepted',\n moduleId,\n outdatedModules,\n outdatedDependencies,\n }\n }\n return {\n type: 'unaccepted',\n dependencyChain,\n }\n }\n\n const module = devModuleCache[moduleId]\n const hotState = moduleHotState.get(module)!\n\n if (\n // The module is not in the cache. Since this is a \"modified\" update,\n // it means that the module was never instantiated before.\n !module || // The module accepted itself without invalidating globalThis.\n // TODO is that right?\n (hotState.selfAccepted && !hotState.selfInvalidated)\n ) {\n continue\n }\n\n if (hotState.selfDeclined) {\n return {\n type: 'self-declined',\n dependencyChain,\n moduleId,\n }\n }\n\n if (runtimeModules.has(moduleId)) {\n if (autoAcceptRootModules) {\n continue\n }\n queue.push({\n moduleId: undefined,\n dependencyChain: [...dependencyChain, moduleId],\n })\n continue\n }\n\n for (const parentId of module.parents) {\n const parent = devModuleCache[parentId]\n\n if (!parent) {\n continue\n }\n\n const parentHotState = moduleHotState.get(parent)\n\n // Check if parent declined this dependency\n if (parentHotState?.declinedDependencies[moduleId]) {\n return {\n type: 'declined',\n dependencyChain: [...dependencyChain, moduleId],\n moduleId,\n parentId,\n }\n }\n\n // Skip if parent is already outdated\n if (outdatedModules.has(parentId)) {\n continue\n }\n\n // Check if parent accepts this dependency\n if (parentHotState?.acceptedDependencies[moduleId]) {\n if (!outdatedDependencies.has(parentId)) {\n outdatedDependencies.set(parentId, new Set())\n }\n outdatedDependencies.get(parentId)!.add(moduleId)\n continue\n }\n\n // Neither accepted nor declined — propagate to parent\n queue.push({\n moduleId: parentId,\n dependencyChain: [...dependencyChain, moduleId],\n })\n }\n\n // If no parents and we're at a root module, auto-accept if configured\n if (module.parents.length === 0 && autoAcceptRootModules) {\n continue\n }\n }\n\n return {\n type: 'accepted',\n moduleId,\n outdatedModules,\n outdatedDependencies,\n }\n}\n\n/**\n * Merges source dependency map into target dependency map.\n */\nfunction mergeDependencies(\n target: Map>,\n source: Map>\n): void {\n for (const [parentId, deps] of source) {\n const existing = target.get(parentId)\n if (existing) {\n for (const dep of deps) {\n existing.add(dep)\n }\n } else {\n target.set(parentId, new Set(deps))\n }\n }\n}\n\n/**\n * Computes all modules that need to be invalidated based on which modules changed.\n *\n * @param invalidated - The modules that have been invalidated\n * @param autoAcceptRootModules - If true, root modules auto-accept updates without explicit module.hot.accept()\n */\nfunction computedInvalidatedModules(\n invalidated: Iterable,\n autoAcceptRootModules: boolean\n): {\n outdatedModules: Set\n outdatedDependencies: Map>\n} {\n const outdatedModules = new Set()\n const outdatedDependencies = new Map>()\n\n for (const moduleId of invalidated) {\n const effect = getAffectedModuleEffects(moduleId, autoAcceptRootModules)\n\n switch (effect.type) {\n case 'unaccepted':\n throw new UpdateApplyError(\n `cannot apply update: unaccepted module. ${formatDependencyChain(\n effect.dependencyChain\n )}.`,\n effect.dependencyChain\n )\n case 'self-declined':\n throw new UpdateApplyError(\n `cannot apply update: self-declined module. ${formatDependencyChain(\n effect.dependencyChain\n )}.`,\n effect.dependencyChain\n )\n case 'declined':\n throw new UpdateApplyError(\n `cannot apply update: declined dependency. ${formatDependencyChain(\n effect.dependencyChain\n )}. Declined by ${effect.parentId}.`,\n effect.dependencyChain\n )\n case 'accepted':\n for (const outdatedModuleId of effect.outdatedModules) {\n outdatedModules.add(outdatedModuleId)\n }\n mergeDependencies(outdatedDependencies, effect.outdatedDependencies)\n break\n default:\n invariant(effect, (effect) => `Unknown effect type: ${effect?.type}`)\n }\n }\n\n return { outdatedModules, outdatedDependencies }\n}\n\n/**\n * Creates the module.hot API object and its internal state.\n * This provides the HMR API that user code calls (module.hot.accept(), etc.)\n */\n\nfunction createModuleHot(\n moduleId: ModuleId,\n hotData: HotData\n): { hot: Hot; hotState: HotState } {\n const hotState: HotState = {\n selfAccepted: false,\n selfDeclined: false,\n selfInvalidated: false,\n disposeHandlers: [],\n acceptedDependencies: {},\n acceptedErrorHandlers: {},\n declinedDependencies: {},\n }\n\n const hot: Hot = {\n // TODO(alexkirsz) This is not defined in the HMR API. It was used to\n // decide whether to warn whenever an HMR-disposed module required other\n // modules. We might want to remove it.\n active: true,\n\n data: hotData ?? {},\n\n accept: (\n modules?: string | string[] | AcceptErrorHandler,\n callback?: AcceptCallback,\n errorHandler?: AcceptErrorHandler\n ) => {\n if (modules === undefined) {\n hotState.selfAccepted = true\n } else if (typeof modules === 'function') {\n hotState.selfAccepted = modules\n } else if (typeof modules === 'object' && modules !== null) {\n for (let i = 0; i < modules.length; i++) {\n hotState.acceptedDependencies[modules[i]] = callback || function () {}\n hotState.acceptedErrorHandlers[modules[i]] = errorHandler\n }\n } else {\n hotState.acceptedDependencies[modules] = callback || function () {}\n hotState.acceptedErrorHandlers[modules] = errorHandler\n }\n },\n\n decline: (dep?: string | string[]) => {\n if (dep === undefined) {\n hotState.selfDeclined = true\n } else if (typeof dep === 'object' && dep !== null) {\n for (let i = 0; i < dep.length; i++) {\n hotState.declinedDependencies[dep[i]] = true\n }\n } else {\n hotState.declinedDependencies[dep] = true\n }\n },\n\n dispose: (callback) => {\n hotState.disposeHandlers.push(callback)\n },\n\n addDisposeHandler: (callback) => {\n hotState.disposeHandlers.push(callback)\n },\n\n removeDisposeHandler: (callback) => {\n const idx = hotState.disposeHandlers.indexOf(callback)\n if (idx >= 0) {\n hotState.disposeHandlers.splice(idx, 1)\n }\n },\n\n invalidate: () => {\n hotState.selfInvalidated = true\n queuedInvalidatedModules.add(moduleId)\n },\n\n // NOTE(alexkirsz) This is part of the management API, which we don't\n // implement, but the Next.js React Refresh runtime uses this to decide\n // whether to schedule an update.\n status: () => 'idle',\n\n // NOTE(alexkirsz) Since we always return \"idle\" for now, these are no-ops.\n addStatusHandler: (_handler) => {},\n removeStatusHandler: (_handler) => {},\n\n // NOTE(jridgewell) Check returns the list of updated modules, but we don't\n // want the webpack code paths to ever update (the turbopack paths handle\n // this already).\n check: () => Promise.resolve(null),\n }\n\n return { hot, hotState }\n}\n\n/**\n * Processes queued invalidated modules and adds them to the outdated modules set.\n * Modules that call module.hot.invalidate() are queued and processed here.\n *\n * @param outdatedModules - The current set of outdated modules\n * @param autoAcceptRootModules - If true, root modules auto-accept updates without explicit module.hot.accept()\n */\nfunction applyInvalidatedModules(\n outdatedModules: Set,\n outdatedDependencies: Map>,\n autoAcceptRootModules: boolean\n): {\n outdatedModules: Set\n outdatedDependencies: Map>\n} {\n if (queuedInvalidatedModules.size > 0) {\n const result = computedInvalidatedModules(\n queuedInvalidatedModules,\n autoAcceptRootModules\n )\n for (const moduleId of result.outdatedModules) {\n outdatedModules.add(moduleId)\n }\n mergeDependencies(outdatedDependencies, result.outdatedDependencies)\n\n queuedInvalidatedModules.clear()\n }\n\n return { outdatedModules, outdatedDependencies }\n}\n\n/**\n * Computes which outdated modules have self-accepted and can be hot reloaded.\n */\n\nfunction computeOutdatedSelfAcceptedModules(\n outdatedModules: Iterable\n): { moduleId: ModuleId; errorHandler: true | Function }[] {\n const outdatedSelfAcceptedModules: {\n moduleId: ModuleId\n errorHandler: true | Function\n }[] = []\n for (const moduleId of outdatedModules) {\n const module = devModuleCache[moduleId]\n const hotState = moduleHotState.get(module)\n if (module && hotState?.selfAccepted && !hotState.selfInvalidated) {\n outdatedSelfAcceptedModules.push({\n moduleId,\n errorHandler: hotState.selfAccepted,\n })\n }\n }\n return outdatedSelfAcceptedModules\n}\n\n/**\n * Disposes of an instance of a module.\n * Runs hot.dispose handlers and manages persistent hot data.\n *\n * NOTE: mode = \"replace\" will not remove modules from devModuleCache.\n * This must be done in a separate step afterwards.\n */\nfunction disposeModule(moduleId: ModuleId, mode: 'clear' | 'replace') {\n const module = devModuleCache[moduleId]\n if (!module) {\n return\n }\n\n const hotState = moduleHotState.get(module)\n if (!hotState) {\n return\n }\n\n const data: HotData = {}\n\n // Run the `hot.dispose` handler, if any, passing in the persistent\n // `hot.data` object.\n for (const disposeHandler of hotState.disposeHandlers) {\n disposeHandler(data)\n }\n\n // This used to warn in `getOrInstantiateModuleFromParent` when a disposed\n // module is still importing other modules.\n if (module.hot) {\n module.hot.active = false\n }\n\n moduleHotState.delete(module)\n\n // Remove the disposed module from its children's parent list.\n // It will be added back once the module re-instantiates and imports its\n // children again.\n for (const childId of module.children) {\n const child = devModuleCache[childId]\n if (!child) {\n continue\n }\n\n const idx = child.parents.indexOf(module.id)\n if (idx >= 0) {\n child.parents.splice(idx, 1)\n }\n }\n\n switch (mode) {\n case 'clear':\n delete devModuleCache[module.id]\n moduleHotData.delete(module.id)\n break\n case 'replace':\n moduleHotData.set(module.id, data)\n break\n default:\n invariant(mode, (mode) => `invalid mode: ${mode}`)\n }\n}\n\n/**\n * Dispose phase: runs dispose handlers and cleans up outdated/disposed modules.\n * Returns the parent modules of outdated modules for use in the apply phase.\n */\n\nfunction disposePhase(\n outdatedModules: Iterable,\n disposedModules: Iterable,\n outdatedDependencies: Map>\n): { outdatedModuleParents: Map> } {\n for (const moduleId of outdatedModules) {\n disposeModule(moduleId, 'replace')\n }\n\n for (const moduleId of disposedModules) {\n disposeModule(moduleId, 'clear')\n }\n\n // Removing modules from the module cache is a separate step.\n // We also want to keep track of previous parents of the outdated modules.\n const outdatedModuleParents = new Map>()\n for (const moduleId of outdatedModules) {\n const oldModule = devModuleCache[moduleId]\n outdatedModuleParents.set(moduleId, oldModule?.parents)\n delete devModuleCache[moduleId]\n }\n\n // Remove outdated dependencies from parent module's children list.\n // When a parent accepts a child's update, the child is re-instantiated\n // but the parent stays alive. We remove the old child reference so it\n // gets re-added when the child re-imports.\n for (const [parentId, deps] of outdatedDependencies) {\n const module = devModuleCache[parentId]\n if (module) {\n for (const dep of deps) {\n const idx = module.children.indexOf(dep)\n if (idx >= 0) {\n module.children.splice(idx, 1)\n }\n }\n }\n }\n\n return { outdatedModuleParents }\n}\n\n/* eslint-disable @typescript-eslint/no-unused-vars */\n\n/**\n * Shared module instantiation logic.\n * This handles the full module instantiation flow for both browser and Node.js.\n * Only React Refresh hooks differ between platforms (passed as callback).\n */\nfunction instantiateModuleShared(\n moduleId: ModuleId,\n sourceType: SourceType,\n sourceData: SourceData,\n moduleFactories: ModuleFactories,\n devModuleCache: ModuleCache,\n runtimeModules: Set,\n createModuleObjectFn: (id: ModuleId) => HotModule,\n createContextFn: (module: HotModule, exports: Exports, refresh?: any) => any,\n runModuleExecutionHooksFn: (\n module: HotModule,\n exec: (refresh: any) => void\n ) => void\n): HotModule {\n // 1. Factory validation (same in both browser and Node.js)\n const id = moduleId\n const moduleFactory = moduleFactories.get(id)\n if (typeof moduleFactory !== 'function') {\n throw new Error(\n factoryNotAvailableMessage(moduleId, sourceType, sourceData) +\n `\\nThis is often caused by a stale browser cache, misconfigured Cache-Control headers, or a service worker serving outdated responses.` +\n `\\nTo fix this, make sure your Cache-Control headers allow revalidation of chunks and review your service worker configuration. ` +\n `As an immediate workaround, try hard-reloading the page, clearing the browser cache, or unregistering any service workers.`\n )\n }\n\n // 2. Hot API setup (same in both - works for browser, included for Node.js)\n const hotData = moduleHotData.get(id)!\n const { hot, hotState } = createModuleHot(id, hotData)\n\n // 3. Parent assignment logic (same in both)\n let parents: ModuleId[]\n switch (sourceType) {\n case SourceType.Runtime:\n runtimeModules.add(id)\n parents = []\n break\n case SourceType.Parent:\n parents = [sourceData as ModuleId]\n break\n case SourceType.Update:\n parents = (sourceData as ModuleId[]) || []\n break\n default:\n throw new Error(`Unknown source type: ${sourceType}`)\n }\n\n // 4. Module creation (platform creates base module object)\n const module = createModuleObjectFn(id)\n const exports = module.exports\n module.parents = parents\n module.children = []\n module.hot = hot\n\n devModuleCache[id] = module\n moduleHotState.set(module, hotState)\n\n // 5. Module execution (React Refresh hooks are platform-specific)\n try {\n runModuleExecutionHooksFn(module, (refresh) => {\n const context = createContextFn(module, exports, refresh)\n moduleFactory.call(exports, context, module, exports)\n })\n } catch (error) {\n module.error = error as any\n throw error\n }\n\n // 6. ESM interop (same in both)\n if (module.namespaceObject && module.exports !== module.namespaceObject) {\n // in case of a circular dependency: cjs1 -> esm2 -> cjs1\n interopEsm(module.exports, module.namespaceObject)\n }\n\n return module\n}\n\n/**\n * Analyzes update entries and chunks to determine which modules were added, modified, or deleted.\n * This is pure logic that doesn't depend on the runtime environment.\n */\nfunction computeChangedModules(\n entries: Record,\n updates: Record,\n chunkModulesMap?: Map>\n): {\n added: Map\n modified: Map\n deleted: Set\n chunksAdded: Map>\n chunksDeleted: Map>\n} {\n const chunksAdded = new Map()\n const chunksDeleted = new Map()\n const added: Map = new Map()\n const modified = new Map()\n const deleted: Set = new Set()\n\n for (const [chunkPath, mergedChunkUpdate] of Object.entries(updates) as Array<\n [ChunkPath, EcmascriptMergedChunkUpdate]\n >) {\n switch (mergedChunkUpdate.type) {\n case 'added': {\n const updateAdded = new Set(mergedChunkUpdate.modules)\n for (const moduleId of updateAdded) {\n added.set(moduleId, entries[moduleId])\n }\n chunksAdded.set(chunkPath, updateAdded)\n break\n }\n case 'deleted': {\n const updateDeleted = chunkModulesMap\n ? new Set(chunkModulesMap.get(chunkPath))\n : new Set()\n for (const moduleId of updateDeleted) {\n deleted.add(moduleId)\n }\n chunksDeleted.set(chunkPath, updateDeleted)\n break\n }\n case 'partial': {\n const updateAdded = new Set(mergedChunkUpdate.added)\n const updateDeleted = new Set(mergedChunkUpdate.deleted)\n for (const moduleId of updateAdded) {\n added.set(moduleId, entries[moduleId])\n }\n for (const moduleId of updateDeleted) {\n deleted.add(moduleId)\n }\n chunksAdded.set(chunkPath, updateAdded)\n chunksDeleted.set(chunkPath, updateDeleted)\n break\n }\n default:\n throw new Error('Unknown merged chunk update type')\n }\n }\n\n // If a module was added from one chunk and deleted from another in the same update,\n // consider it to be modified, as it means the module was moved from one chunk to another\n // AND has new code in a single update.\n for (const moduleId of added.keys()) {\n if (deleted.has(moduleId)) {\n added.delete(moduleId)\n deleted.delete(moduleId)\n }\n }\n\n for (const [moduleId, entry] of Object.entries(entries)) {\n // Modules that haven't been added to any chunk but have new code are considered\n // to be modified.\n // This needs to be under the previous loop, as we need it to get rid of modules\n // that were added and deleted in the same update.\n if (!added.has(moduleId)) {\n modified.set(moduleId, entry)\n }\n }\n\n return { added, deleted, modified, chunksAdded, chunksDeleted }\n}\n\n/**\n * Compiles new module code and walks the dependency tree to find all outdated modules.\n * Uses the evalModuleEntry function to compile code (platform-specific).\n *\n * @param added - Map of added modules\n * @param modified - Map of modified modules\n * @param evalModuleEntry - Function to compile module code\n * @param autoAcceptRootModules - If true, root modules auto-accept updates without explicit module.hot.accept()\n */\nfunction computeOutdatedModules(\n added: Map,\n modified: Map,\n evalModuleEntry: (entry: EcmascriptModuleEntry) => HotModuleFactoryFunction,\n autoAcceptRootModules: boolean\n): {\n outdatedModules: Set\n outdatedDependencies: Map>\n newModuleFactories: Map\n} {\n const newModuleFactories = new Map()\n\n // Compile added modules\n for (const [moduleId, entry] of added) {\n if (entry != null) {\n newModuleFactories.set(moduleId, evalModuleEntry(entry))\n }\n }\n\n // Walk dependency tree to find all modules affected by modifications\n const { outdatedModules, outdatedDependencies } = computedInvalidatedModules(\n modified.keys(),\n autoAcceptRootModules\n )\n\n // Compile modified modules\n for (const [moduleId, entry] of modified) {\n newModuleFactories.set(moduleId, evalModuleEntry(entry))\n }\n\n return { outdatedModules, outdatedDependencies, newModuleFactories }\n}\n\n/**\n * Updates module factories and re-instantiates self-accepted modules.\n * Uses the instantiateModule function (platform-specific via callback).\n */\nfunction applyPhase(\n outdatedSelfAcceptedModules: {\n moduleId: ModuleId\n errorHandler: true | Function\n }[],\n newModuleFactories: Map,\n outdatedModuleParents: Map>,\n outdatedDependencies: Map>,\n moduleFactories: ModuleFactories,\n devModuleCache: ModuleCache,\n instantiateModuleFn: (\n moduleId: ModuleId,\n sourceType: SourceType,\n sourceData: SourceData\n ) => HotModule,\n applyModuleFactoryNameFn: (factory: HotModuleFactoryFunction) => void,\n reportError: (err: any) => void\n) {\n // Update module factories\n for (const [moduleId, factory] of newModuleFactories.entries()) {\n applyModuleFactoryNameFn(factory)\n moduleFactories.set(moduleId, factory)\n }\n\n // TODO(alexkirsz) Run new runtime entries here.\n\n // Call accept handlers for outdated dependencies.\n // This runs BEFORE re-instantiating self-accepted modules, matching\n // webpack's behavior.\n for (const [parentId, deps] of outdatedDependencies) {\n const module = devModuleCache[parentId]\n if (!module) continue\n\n const hotState = moduleHotState.get(module)\n if (!hotState) continue\n\n // Group deps by callback, deduplicating callbacks that handle multiple deps.\n // Each callback receives only the deps it was registered for.\n const callbackDeps = new Map void), ModuleId[]>()\n const callbackErrorHandlers = new Map<\n AcceptCallback | (() => void),\n AcceptErrorHandler | undefined\n >()\n\n for (const dep of deps) {\n const acceptCallback = hotState.acceptedDependencies[dep]\n if (acceptCallback) {\n let depList = callbackDeps.get(acceptCallback)\n if (!depList) {\n depList = []\n callbackDeps.set(acceptCallback, depList)\n callbackErrorHandlers.set(\n acceptCallback,\n hotState.acceptedErrorHandlers[dep]\n )\n }\n depList.push(dep)\n }\n }\n\n for (const [callback, cbDeps] of callbackDeps) {\n try {\n callback.call(null, cbDeps)\n } catch (err: any) {\n const errorHandler = callbackErrorHandlers.get(callback)\n if (typeof errorHandler === 'function') {\n try {\n errorHandler(err, {\n moduleId: parentId,\n dependencyId: cbDeps[0],\n })\n } catch (err2) {\n reportError(err2)\n reportError(err)\n }\n } else {\n reportError(err)\n }\n }\n }\n }\n\n // Re-instantiate all outdated self-accepted modules\n for (const { moduleId, errorHandler } of outdatedSelfAcceptedModules) {\n try {\n instantiateModuleFn(\n moduleId,\n SourceType.Update,\n outdatedModuleParents.get(moduleId)\n )\n } catch (err) {\n if (typeof errorHandler === 'function') {\n try {\n errorHandler(err, { moduleId, module: devModuleCache[moduleId] })\n } catch (err2) {\n reportError(err2)\n reportError(err)\n }\n } else {\n reportError(err)\n }\n }\n }\n}\n\n/**\n * Internal implementation that orchestrates the full HMR update flow:\n * invalidation, disposal, and application of new modules.\n *\n * @param autoAcceptRootModules - If true, root modules auto-accept updates without explicit module.hot.accept()\n */\nfunction applyInternal(\n outdatedModules: Set,\n outdatedDependencies: Map>,\n disposedModules: Iterable,\n newModuleFactories: Map,\n moduleFactories: ModuleFactories,\n devModuleCache: ModuleCache,\n instantiateModuleFn: (\n moduleId: ModuleId,\n sourceType: SourceType,\n sourceData: SourceData\n ) => HotModule,\n applyModuleFactoryNameFn: (factory: HotModuleFactoryFunction) => void,\n autoAcceptRootModules: boolean\n) {\n ;({ outdatedModules, outdatedDependencies } = applyInvalidatedModules(\n outdatedModules,\n outdatedDependencies,\n autoAcceptRootModules\n ))\n\n // Find self-accepted modules to re-instantiate\n const outdatedSelfAcceptedModules =\n computeOutdatedSelfAcceptedModules(outdatedModules)\n\n // Run dispose handlers, save hot.data, clear caches\n const { outdatedModuleParents } = disposePhase(\n outdatedModules,\n disposedModules,\n outdatedDependencies\n )\n\n let error: any\n\n function reportError(err: any) {\n if (!error) error = err // Keep first error\n }\n\n applyPhase(\n outdatedSelfAcceptedModules,\n newModuleFactories,\n outdatedModuleParents,\n outdatedDependencies,\n moduleFactories,\n devModuleCache,\n instantiateModuleFn,\n applyModuleFactoryNameFn,\n reportError\n )\n\n if (error) {\n throw error\n }\n\n // Recursively apply any queued invalidations from new module execution\n if (queuedInvalidatedModules.size > 0) {\n applyInternal(\n new Set(),\n new Map(),\n [],\n new Map(),\n moduleFactories,\n devModuleCache,\n instantiateModuleFn,\n applyModuleFactoryNameFn,\n autoAcceptRootModules\n )\n }\n}\n\n/**\n * Main entry point for applying an ECMAScript merged update.\n * This is called by both browser and Node.js runtimes with platform-specific callbacks.\n *\n * @param options.autoAcceptRootModules - If true, root modules auto-accept updates without explicit\n * module.hot.accept(). Used for server-side HMR where pages\n * auto-accept at the top level.\n */\nfunction applyEcmascriptMergedUpdateShared(options: {\n added: Map\n modified: Map\n disposedModules: Iterable\n evalModuleEntry: (entry: EcmascriptModuleEntry) => HotModuleFactoryFunction\n instantiateModule: (\n moduleId: ModuleId,\n sourceType: SourceType,\n sourceData: SourceData\n ) => HotModule\n applyModuleFactoryName: (factory: HotModuleFactoryFunction) => void\n moduleFactories: ModuleFactories\n devModuleCache: ModuleCache\n autoAcceptRootModules: boolean\n}) {\n const {\n added,\n modified,\n disposedModules,\n evalModuleEntry,\n instantiateModule,\n applyModuleFactoryName,\n moduleFactories,\n devModuleCache,\n autoAcceptRootModules,\n } = options\n\n const { outdatedModules, outdatedDependencies, newModuleFactories } =\n computeOutdatedModules(\n added,\n modified,\n evalModuleEntry,\n autoAcceptRootModules\n )\n\n applyInternal(\n outdatedModules,\n outdatedDependencies,\n disposedModules,\n newModuleFactories,\n moduleFactories,\n devModuleCache,\n instantiateModule,\n applyModuleFactoryName,\n autoAcceptRootModules\n )\n}\n"],"names":["devModuleCache","runtimeModules","moduleHotData","Map","moduleHotState","WeakMap","queuedInvalidatedModules","Set","UpdateApplyError","Error","name","dependencyChain","message","trackModuleImport","parentModule","childModuleId","childModule","children","indexOf","push","parents","id","formatDependencyChain","join","getAffectedModuleEffects","moduleId","autoAcceptRootModules","outdatedModules","outdatedDependencies","queue","nextItem","shift","has","add","undefined","type","module","hotState","get","selfAccepted","selfInvalidated","selfDeclined","parentId","parent","parentHotState","declinedDependencies","acceptedDependencies","set","length","mergeDependencies","target","source","deps","existing","dep","computedInvalidatedModules","invalidated","effect","outdatedModuleId","invariant","createModuleHot","hotData","disposeHandlers","acceptedErrorHandlers","hot","active","data","accept","modules","callback","errorHandler","i","decline","dispose","addDisposeHandler","removeDisposeHandler","idx","splice","invalidate","status","addStatusHandler","_handler","removeStatusHandler","check","Promise","resolve","applyInvalidatedModules","size","result","clear","computeOutdatedSelfAcceptedModules","outdatedSelfAcceptedModules","disposeModule","mode","disposeHandler","delete","childId","child","disposePhase","disposedModules","outdatedModuleParents","oldModule","instantiateModuleShared","sourceType","sourceData","moduleFactories","createModuleObjectFn","createContextFn","runModuleExecutionHooksFn","moduleFactory","factoryNotAvailableMessage","SourceType","Runtime","Parent","Update","exports","refresh","context","call","error","namespaceObject","interopEsm","computeChangedModules","entries","updates","chunkModulesMap","chunksAdded","chunksDeleted","added","modified","deleted","chunkPath","mergedChunkUpdate","Object","updateAdded","updateDeleted","keys","entry","computeOutdatedModules","evalModuleEntry","newModuleFactories","applyPhase","instantiateModuleFn","applyModuleFactoryNameFn","reportError","factory","callbackDeps","callbackErrorHandlers","acceptCallback","depList","cbDeps","err","dependencyId","err2","applyInternal","applyEcmascriptMergedUpdateShared","options","instantiateModule","applyModuleFactoryName"],"mappings":"AAAA,2CAA2C;AAC3C,6CAA6C;AAC7C,4CAA4C;AAC5C,4CAA4C;AAO5C;;;;;;CAMC,GAED;;;;CAIC,GACD,IAAIA;AAEJ;;CAEC,GACD,IAAIC;AAEJ;;;CAGC,GACD,MAAMC,gBAAwC,IAAIC;AAElD;;;CAGC,GACD,MAAMC,iBAAyC,IAAIC;AAEnD;;CAEC,GACD,MAAMC,2BAA0C,IAAIC;AAEpD,MAAMC,yBAAyBC;IAC7BC,OAAO,mBAAkB;IAEzBC,gBAA2B;IAE3BH,YAAYI,OAAe,EAAED,eAA2B,CAAE;QACxD,KAAK,CAACC;QACN,IAAI,CAACD,eAAe,GAAGA;IACzB;AACF;AAyBA;;;CAGC,GACD,6DAA6D;AAC7D,SAASE,kBACPC,YAAiC,EACjCC,aAAuB,EACvBC,WAA4C;IAE5C,mCAAmC;IACnC,IAAIF,aAAaG,QAAQ,CAACC,OAAO,CAACH,mBAAmB,CAAC,GAAG;QACvDD,aAAaG,QAAQ,CAACE,IAAI,CAACJ;IAC7B;IAEA,0CAA0C;IAC1C,IAAIC,eAAeA,YAAYI,OAAO,CAACF,OAAO,CAACJ,aAAaO,EAAE,MAAM,CAAC,GAAG;QACtEL,YAAYI,OAAO,CAACD,IAAI,CAACL,aAAaO,EAAE;IAC1C;AACF;AAEA,SAASC,sBAAsBX,eAA2B;IACxD,OAAO,CAAC,kBAAkB,EAAEA,gBAAgBY,IAAI,CAAC,SAAS;AAC5D;AAEA;;;;;;;;CAQC,GACD,SAASC,yBACPC,QAAkB,EAClBC,qBAA8B;IAE9B,MAAMC,kBAAiC,IAAIpB;IAC3C,MAAMqB,uBAAqD,IAAIzB;IAI/D,MAAM0B,QAAqB;QACzB;YACEJ;YACAd,iBAAiB,EAAE;QACrB;KACD;IAED,IAAImB;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A,QAAQgC,KAAI,mBAAmB;IAC7C;IAEAV,WACElD,6BACAiD,oBACAxC,uBACAxE,sBACA6E,iBACAzG,gBACA8I,qBACAC,0BACAC;IAGF,IAAIzB,OAAO;QACT,MAAMA;IACR;IAEA,uEAAuE;IACvE,IAAIjH,yBAAyBiF,IAAI,GAAG,GAAG;QACrCmE,cACE,IAAInJ,OACJ,IAAIJ,OACJ,EAAE,EACF,IAAIA,OACJsG,iBACAzG,gBACA8I,qBACAC,0BACArH;IAEJ;AACF;AAEA;;;;;;;CAOC,GACD,SAASiI,kCAAkCC,OAc1C;IACC,MAAM,EACJ5B,KAAK,EACLC,QAAQ,EACR9B,eAAe,EACfwC,eAAe,EACfkB,iBAAiB,EACjBC,sBAAsB,EACtBrD,eAAe,EACfzG,cAAc,EACd0B,qBAAqB,EACtB,GAAGkI;IAEJ,MAAM,EAAEjI,eAAe,EAAEC,oBAAoB,EAAEgH,kBAAkB,EAAE,GACjEF,uBACEV,OACAC,UACAU,iBACAjH;IAGJgI,cACE/H,iBACAC,sBACAuE,iBACAyC,oBACAnC,iBACAzG,gBACA6J,mBACAC,wBACApI;AAEJ","ignoreList":[0]}},
- {"offset": {"line": 1545, "column": 0}, "map": {"version":3,"sources":["turbopack:///[turbopack]/browser/runtime/base/dev-base.ts"],"sourcesContent":["/// \n/// \n\ninterface TurbopackDevContext extends TurbopackBrowserBaseContext {\n k: RefreshContext\n}\n\nconst devContextPrototype = Context.prototype as TurbopackDevContext\n\n/**\n * This file contains runtime types and functions that are shared between all\n * Turbopack *development* ECMAScript runtimes.\n *\n * It will be appended to the runtime code of each runtime right after the\n * shared runtime utils.\n */\n/* eslint-disable @typescript-eslint/no-unused-vars */\n\n// Assign browser's module cache and runtime modules to shared HMR state\ndevModuleCache = Object.create(null)\ndevContextPrototype.c = devModuleCache\nruntimeModules = new Set()\n\n// Set flag to indicate we use ModuleWithDirection\ncreateModuleWithDirectionFlag = true\n\n// This file must not use `import` and `export` statements. Otherwise, it\n// becomes impossible to augment interfaces declared in ``d files\n// (e.g. `Module`). Hence, the need for `import()` here.\ntype RefreshRuntimeGlobals =\n import('@next/react-refresh-utils/dist/runtime').RefreshRuntimeGlobals\n\ndeclare var $RefreshHelpers$: RefreshRuntimeGlobals['$RefreshHelpers$']\ndeclare var $RefreshReg$: RefreshRuntimeGlobals['$RefreshReg$']\ndeclare var $RefreshSig$: RefreshRuntimeGlobals['$RefreshSig$']\ndeclare var $RefreshInterceptModuleExecution$: RefreshRuntimeGlobals['$RefreshInterceptModuleExecution$']\n\ntype RefreshContext = {\n register: RefreshRuntimeGlobals['$RefreshReg$']\n signature: RefreshRuntimeGlobals['$RefreshSig$']\n registerExports: typeof registerExportsAndSetupBoundaryForReactRefresh\n}\n\ntype RefreshHelpers = RefreshRuntimeGlobals['$RefreshHelpers$']\n\ntype ModuleFactory = (\n this: Module['exports'],\n context: TurbopackDevContext\n) => unknown\n\ninterface DevRuntimeBackend {\n reloadChunk?: (chunkUrl: ChunkUrl) => Promise\n unloadChunk?: (chunkUrl: ChunkUrl) => void\n restart: () => void\n}\n\n/**\n * Map from module ID to the chunks that contain this module.\n *\n * In HMR, we need to keep track of which modules are contained in which so\n * chunks. This is so we don't eagerly dispose of a module when it is removed\n * from chunk A, but still exists in chunk B.\n */\nconst moduleChunksMap: Map> = new Map()\n/**\n * Map from a chunk path to all modules it contains.\n */\nconst chunkModulesMap: Map> = new Map()\n/**\n * Chunk lists that contain a runtime. When these chunk lists receive an update\n * that can't be reconciled with the current state of the page, we need to\n * reload the runtime entirely.\n */\nconst runtimeChunkLists: Set = new Set()\n/**\n * Map from a chunk list to the chunk paths it contains.\n */\nconst chunkListChunksMap: Map> = new Map()\n/**\n * Map from a chunk path to the chunk lists it belongs to.\n */\nconst chunkChunkListsMap: Map> = new Map()\n\n/**\n * Gets or instantiates a runtime module.\n */\n// @ts-ignore\nfunction getOrInstantiateRuntimeModule(\n chunkPath: ChunkPath,\n moduleId: ModuleId\n): Module {\n const module = devModuleCache[moduleId]\n if (module) {\n if (module.error) {\n throw module.error\n }\n return module\n }\n\n // @ts-ignore\n return instantiateModule(moduleId, SourceType.Runtime, chunkPath)\n}\n\n/**\n * Retrieves a module from the cache, or instantiate it if it is not cached.\n */\n// @ts-ignore Defined in `runtime-utils.ts`\nconst getOrInstantiateModuleFromParent: GetOrInstantiateModuleFromParent<\n HotModule\n> = (id, sourceModule) => {\n if (!sourceModule.hot.active) {\n console.warn(\n `Unexpected import of module ${id} from module ${sourceModule.id}, which was deleted by an HMR update`\n )\n }\n\n const module = devModuleCache[id]\n\n if (sourceModule.children.indexOf(id) === -1) {\n sourceModule.children.push(id)\n }\n\n if (module) {\n if (module.error) {\n throw module.error\n }\n\n if (module.parents.indexOf(sourceModule.id) === -1) {\n module.parents.push(sourceModule.id)\n }\n\n return module\n }\n\n return instantiateModule(id, SourceType.Parent, sourceModule.id)\n}\n\nfunction DevContext(\n this: TurbopackDevContext,\n module: HotModule,\n exports: Exports,\n refresh: RefreshContext\n) {\n Context.call(this, module, exports)\n this.k = refresh\n}\nDevContext.prototype = Context.prototype\n\ntype DevContextConstructor = {\n new (\n module: HotModule,\n exports: Exports,\n refresh: RefreshContext\n ): TurbopackDevContext\n}\n\nfunction instantiateModule(\n moduleId: ModuleId,\n sourceType: SourceType,\n sourceData: SourceData\n): Module {\n // Browser: creates base HotModule object (hot API added by shared code)\n const createModuleObjectFn = (id: ModuleId) => {\n return createModuleObject(id) as HotModule\n }\n\n // Browser: creates DevContext with refresh\n const createContext = (\n module: HotModule,\n exports: Exports,\n refresh: RefreshContext\n ) => {\n return new (DevContext as any as DevContextConstructor)(\n module,\n exports,\n refresh\n )\n }\n\n // Use shared instantiation logic (includes hot API setup)\n return instantiateModuleShared(\n moduleId,\n sourceType,\n sourceData,\n moduleFactories,\n devModuleCache,\n runtimeModules,\n createModuleObjectFn,\n createContext,\n runModuleExecutionHooks\n )\n}\n\nconst DUMMY_REFRESH_CONTEXT = {\n register: (_type: unknown, _id: unknown) => {},\n signature: () => (_type: unknown) => {},\n registerExports: (_module: unknown, _helpers: unknown) => {},\n}\n\n/**\n * NOTE(alexkirsz) Webpack has a \"module execution\" interception hook that\n * Next.js' React Refresh runtime hooks into to add module context to the\n * refresh registry.\n */\nfunction runModuleExecutionHooks(\n module: HotModule,\n executeModule: (ctx: RefreshContext) => void\n) {\n if (typeof globalThis.$RefreshInterceptModuleExecution$ === 'function') {\n const cleanupReactRefreshIntercept =\n globalThis.$RefreshInterceptModuleExecution$(module.id)\n try {\n executeModule({\n register: globalThis.$RefreshReg$,\n signature: globalThis.$RefreshSig$,\n registerExports: registerExportsAndSetupBoundaryForReactRefresh,\n })\n } finally {\n // Always cleanup the intercept, even if module execution failed.\n cleanupReactRefreshIntercept()\n }\n } else {\n // If the react refresh hooks are not installed we need to bind dummy functions.\n // This is expected when running in a Web Worker. It is also common in some of\n // our test environments.\n executeModule(DUMMY_REFRESH_CONTEXT)\n }\n}\n\n/**\n * This is adapted from https://github.com/vercel/next.js/blob/3466862d9dc9c8bb3131712134d38757b918d1c0/packages/react-refresh-utils/internal/ReactRefreshModule.runtime.ts\n */\nfunction registerExportsAndSetupBoundaryForReactRefresh(\n module: HotModule,\n helpers: RefreshHelpers\n) {\n const currentExports = module.exports\n const prevExports = module.hot.data.prevExports ?? null\n\n helpers.registerExportsForReactRefresh(currentExports, module.id)\n\n // A module can be accepted automatically based on its exports, e.g. when\n // it is a Refresh Boundary.\n if (helpers.isReactRefreshBoundary(currentExports)) {\n // Save the previous exports on update, so we can compare the boundary\n // signatures.\n module.hot.dispose((data) => {\n data.prevExports = currentExports\n })\n // Unconditionally accept an update to this module, we'll check if it's\n // still a Refresh Boundary later.\n module.hot.accept()\n\n // This field is set when the previous version of this module was a\n // Refresh Boundary, letting us know we need to check for invalidation or\n // enqueue an update.\n if (prevExports !== null) {\n // A boundary can become ineligible if its exports are incompatible\n // with the previous exports.\n //\n // For example, if you add/remove/change exports, we'll want to\n // re-execute the importing modules, and force those components to\n // re-render. Similarly, if you convert a class component to a\n // function, we want to invalidate the boundary.\n if (\n helpers.shouldInvalidateReactRefreshBoundary(\n helpers.getRefreshBoundarySignature(prevExports),\n helpers.getRefreshBoundarySignature(currentExports)\n )\n ) {\n module.hot.invalidate()\n } else {\n helpers.scheduleUpdate()\n }\n }\n } else {\n // Since we just executed the code for the module, it's possible that the\n // new exports made it ineligible for being a boundary.\n // We only care about the case when we were _previously_ a boundary,\n // because we already accepted this update (accidental side effect).\n const isNoLongerABoundary = prevExports !== null\n if (isNoLongerABoundary) {\n module.hot.invalidate()\n }\n }\n}\n\n/**\n * Adds, deletes, and moves modules between chunks. This must happen before the\n * dispose phase as it needs to know which modules were removed from all chunks,\n * which we can only compute *after* taking care of added and moved modules.\n */\nfunction updateChunksPhase(\n chunksAddedModules: Map>,\n chunksDeletedModules: Map>\n): { disposedModules: Set } {\n for (const [chunkPath, addedModuleIds] of chunksAddedModules) {\n for (const moduleId of addedModuleIds) {\n addModuleToChunk(moduleId, chunkPath)\n }\n }\n\n const disposedModules: Set = new Set()\n for (const [chunkPath, addedModuleIds] of chunksDeletedModules) {\n for (const moduleId of addedModuleIds) {\n if (removeModuleFromChunk(moduleId, chunkPath)) {\n disposedModules.add(moduleId)\n }\n }\n }\n\n return { disposedModules }\n}\n\nfunction applyUpdate(update: PartialUpdate) {\n switch (update.type) {\n case 'ChunkListUpdate':\n applyChunkListUpdate(update)\n break\n default:\n invariant(update, (update) => `Unknown update type: ${update.type}`)\n }\n}\n\nfunction applyChunkListUpdate(update: ChunkListUpdate) {\n if (update.merged != null) {\n for (const merged of update.merged) {\n switch (merged.type) {\n case 'EcmascriptMergedUpdate':\n applyEcmascriptMergedUpdate(merged)\n break\n default:\n invariant(merged, (merged) => `Unknown merged type: ${merged.type}`)\n }\n }\n }\n\n if (update.chunks != null) {\n for (const [chunkPath, chunkUpdate] of Object.entries(\n update.chunks\n ) as Array<[ChunkPath, ChunkUpdate]>) {\n const chunkUrl = getChunkRelativeUrl(chunkPath)\n\n switch (chunkUpdate.type) {\n case 'added':\n BACKEND.loadChunkCached(SourceType.Update, chunkUrl)\n break\n case 'total':\n DEV_BACKEND.reloadChunk?.(chunkUrl)\n break\n case 'deleted':\n DEV_BACKEND.unloadChunk?.(chunkUrl)\n break\n case 'partial':\n invariant(\n chunkUpdate.instruction,\n (instruction) =>\n `Unknown partial instruction: ${JSON.stringify(instruction)}.`\n )\n break\n default:\n invariant(\n chunkUpdate,\n (chunkUpdate) => `Unknown chunk update type: ${chunkUpdate.type}`\n )\n }\n }\n }\n}\n\nfunction applyEcmascriptMergedUpdate(update: EcmascriptMergedUpdate) {\n // Browser-specific chunk management phase\n const { entries = {}, chunks = {} } = update\n const { added, modified, chunksAdded, chunksDeleted } = computeChangedModules(\n entries,\n chunks,\n chunkModulesMap\n )\n const { disposedModules } = updateChunksPhase(chunksAdded, chunksDeleted)\n\n // Use shared HMR update implementation\n applyEcmascriptMergedUpdateShared({\n added,\n modified,\n disposedModules,\n evalModuleEntry: _eval, // browser's eval with source maps\n instantiateModule, // now wraps shared logic\n applyModuleFactoryName,\n moduleFactories,\n devModuleCache,\n autoAcceptRootModules: false,\n })\n}\n\nfunction handleApply(chunkListPath: ChunkListPath, update: ServerMessage) {\n switch (update.type) {\n case 'partial': {\n // This indicates that the update is can be applied to the current state of the application.\n applyUpdate(update.instruction)\n break\n }\n case 'restart': {\n // This indicates that there is no way to apply the update to the\n // current state of the application, and that the application must be\n // restarted.\n DEV_BACKEND.restart()\n break\n }\n case 'notFound': {\n // This indicates that the chunk list no longer exists: either the dynamic import which created it was removed,\n // or the page itself was deleted.\n // If it is a dynamic import, we simply discard all modules that the chunk has exclusive access to.\n // If it is a runtime chunk list, we restart the application.\n if (runtimeChunkLists.has(chunkListPath)) {\n DEV_BACKEND.restart()\n } else {\n disposeChunkList(chunkListPath)\n }\n break\n }\n default:\n throw new Error(`Unknown update type: ${update.type}`)\n }\n}\n\n/**\n * Removes a module from a chunk.\n * Returns `true` if there are no remaining chunks including this module.\n */\nfunction removeModuleFromChunk(\n moduleId: ModuleId,\n chunkPath: ChunkPath\n): boolean {\n const moduleChunks = moduleChunksMap.get(moduleId)!\n moduleChunks.delete(chunkPath)\n\n const chunkModules = chunkModulesMap.get(chunkPath)!\n chunkModules.delete(moduleId)\n\n const noRemainingModules = chunkModules.size === 0\n if (noRemainingModules) {\n chunkModulesMap.delete(chunkPath)\n }\n\n const noRemainingChunks = moduleChunks.size === 0\n if (noRemainingChunks) {\n moduleChunksMap.delete(moduleId)\n }\n\n return noRemainingChunks\n}\n\n/**\n * Disposes of a chunk list and its corresponding exclusive chunks.\n */\nfunction disposeChunkList(chunkListPath: ChunkListPath): boolean {\n const chunkPaths = chunkListChunksMap.get(chunkListPath)\n if (chunkPaths == null) {\n return false\n }\n chunkListChunksMap.delete(chunkListPath)\n\n for (const chunkPath of chunkPaths) {\n const chunkChunkLists = chunkChunkListsMap.get(chunkPath)!\n chunkChunkLists.delete(chunkListPath)\n\n if (chunkChunkLists.size === 0) {\n chunkChunkListsMap.delete(chunkPath)\n disposeChunk(chunkPath)\n }\n }\n\n // We must also dispose of the chunk list's chunk itself to ensure it may\n // be reloaded properly in the future.\n const chunkListUrl = getChunkRelativeUrl(chunkListPath)\n\n DEV_BACKEND.unloadChunk?.(chunkListUrl)\n\n return true\n}\n\n/**\n * Disposes of a chunk and its corresponding exclusive modules.\n *\n * @returns Whether the chunk was disposed of.\n */\nfunction disposeChunk(chunkPath: ChunkPath): boolean {\n const chunkUrl = getChunkRelativeUrl(chunkPath)\n // This should happen whether the chunk has any modules in it or not.\n // For instance, CSS chunks have no modules in them, but they still need to be unloaded.\n DEV_BACKEND.unloadChunk?.(chunkUrl)\n\n const chunkModules = chunkModulesMap.get(chunkPath)\n if (chunkModules == null) {\n return false\n }\n chunkModules.delete(chunkPath)\n\n for (const moduleId of chunkModules) {\n const moduleChunks = moduleChunksMap.get(moduleId)!\n moduleChunks.delete(chunkPath)\n\n const noRemainingChunks = moduleChunks.size === 0\n if (noRemainingChunks) {\n moduleChunksMap.delete(moduleId)\n disposeModule(moduleId, 'clear')\n availableModules.delete(moduleId)\n }\n }\n\n return true\n}\n\n/**\n * Adds a module to a chunk.\n */\nfunction addModuleToChunk(moduleId: ModuleId, chunkPath: ChunkPath) {\n let moduleChunks = moduleChunksMap.get(moduleId)\n if (!moduleChunks) {\n moduleChunks = new Set([chunkPath])\n moduleChunksMap.set(moduleId, moduleChunks)\n } else {\n moduleChunks.add(chunkPath)\n }\n\n let chunkModules = chunkModulesMap.get(chunkPath)\n if (!chunkModules) {\n chunkModules = new Set([moduleId])\n chunkModulesMap.set(chunkPath, chunkModules)\n } else {\n chunkModules.add(moduleId)\n }\n}\n\n/**\n * Marks a chunk list as a runtime chunk list. There can be more than one\n * runtime chunk list. For instance, integration tests can have multiple chunk\n * groups loaded at runtime, each with its own chunk list.\n */\nfunction markChunkListAsRuntime(chunkListPath: ChunkListPath) {\n runtimeChunkLists.add(chunkListPath)\n}\n\nfunction registerChunk(registration: ChunkRegistration) {\n const chunk = getChunkFromRegistration(registration[0]) as\n | ChunkPath\n | ChunkScript\n let runtimeParams: RuntimeParams | undefined\n // When bootstrapping we are passed a single runtimeParams object so we can distinguish purely based on length\n if (registration.length === 2) {\n runtimeParams = registration[1] as RuntimeParams\n } else {\n let chunkPath = getPathFromScript(chunk)\n runtimeParams = undefined\n installCompressedModuleFactories(\n registration as CompressedModuleFactories,\n /* offset= */ 1,\n moduleFactories,\n (id: ModuleId) => addModuleToChunk(id, chunkPath)\n )\n }\n return BACKEND.registerChunk(chunk, runtimeParams)\n}\n\n/**\n * Subscribes to chunk list updates from the update server and applies them.\n */\nfunction registerChunkList(chunkList: ChunkList) {\n const chunkListScript = getChunkFromRegistration(chunkList.script) as\n | ChunkListPath\n | ChunkListScript\n const chunkListPath = getPathFromScript(chunkListScript)\n // The \"chunk\" is also registered to finish the loading in the backend\n BACKEND.registerChunk(chunkListPath as string as ChunkPath)\n globalThis.TURBOPACK_CHUNK_UPDATE_LISTENERS!.push([\n chunkListPath,\n handleApply.bind(null, chunkListPath),\n ])\n\n // Adding chunks to chunk lists and vice versa.\n const chunkPaths = new Set(chunkList.chunks.map(getChunkPath))\n chunkListChunksMap.set(chunkListPath, chunkPaths)\n for (const chunkPath of chunkPaths) {\n let chunkChunkLists = chunkChunkListsMap.get(chunkPath)\n if (!chunkChunkLists) {\n chunkChunkLists = new Set([chunkListPath])\n chunkChunkListsMap.set(chunkPath, chunkChunkLists)\n } else {\n chunkChunkLists.add(chunkListPath)\n }\n }\n\n if (chunkList.source === 'entry') {\n markChunkListAsRuntime(chunkListPath)\n }\n}\n\nglobalThis.TURBOPACK_CHUNK_UPDATE_LISTENERS ??= []\n"],"names":["devContextPrototype","Context","prototype","devModuleCache","Object","create","c","runtimeModules","Set","createModuleWithDirectionFlag","moduleChunksMap","Map","chunkModulesMap","runtimeChunkLists","chunkListChunksMap","chunkChunkListsMap","getOrInstantiateRuntimeModule","chunkPath","moduleId","module","error","instantiateModule","SourceType","Runtime","getOrInstantiateModuleFromParent","id","sourceModule","hot","active","console","warn","children","indexOf","push","parents","Parent","DevContext","exports","refresh","call","k","sourceType","sourceData","createModuleObjectFn","createModuleObject","createContext","instantiateModuleShared","moduleFactories","runModuleExecutionHooks","DUMMY_REFRESH_CONTEXT","register","_type","_id","signature","registerExports","_module","_helpers","executeModule","globalThis","$RefreshInterceptModuleExecution$","cleanupReactRefreshIntercept","$RefreshReg$","$RefreshSig$","registerExportsAndSetupBoundaryForReactRefresh","helpers","currentExports","prevExports","data","registerExportsForReactRefresh","isReactRefreshBoundary","dispose","accept","shouldInvalidateReactRefreshBoundary","getRefreshBoundarySignature","invalidate","scheduleUpdate","isNoLongerABoundary","updateChunksPhase","chunksAddedModules","chunksDeletedModules","addedModuleIds","addModuleToChunk","disposedModules","removeModuleFromChunk","add","applyUpdate","update","type","applyChunkListUpdate","invariant","merged","applyEcmascriptMergedUpdate","chunks","chunkUpdate","entries","chunkUrl","getChunkRelativeUrl","BACKEND","loadChunkCached","Update","DEV_BACKEND","reloadChunk","unloadChunk","instruction","JSON","stringify","added","modified","chunksAdded","chunksDeleted","computeChangedModules","applyEcmascriptMergedUpdateShared","evalModuleEntry","_eval","applyModuleFactoryName","autoAcceptRootModules","handleApply","chunkListPath","restart","has","disposeChunkList","Error","moduleChunks","get","delete","chunkModules","noRemainingModules","size","noRemainingChunks","chunkPaths","chunkChunkLists","disposeChunk","chunkListUrl","disposeModule","availableModules","set","markChunkListAsRuntime","registerChunk","registration","chunk","getChunkFromRegistration","runtimeParams","length","getPathFromScript","undefined","installCompressedModuleFactories","registerChunkList","chunkList","chunkListScript","script","TURBOPACK_CHUNK_UPDATE_LISTENERS","bind","map","getChunkPath","source"],"mappings":"AAAA,iEAAiE;AACjE,kEAAkE;AAMlE,MAAMA,sBAAsBC,QAAQC,SAAS;AAE7C;;;;;;CAMC,GACD,oDAAoD,GAEpD,wEAAwE;AACxEC,iBAAiBC,OAAOC,MAAM,CAAC;AAC/BL,oBAAoBM,CAAC,GAAGH;AACxBI,iBAAiB,IAAIC;AAErB,kDAAkD;AAClDC,gCAAgC;AAgChC;;;;;;CAMC,GACD,MAAMC,kBAAiD,IAAIC;AAC3D;;CAEC,GACD,MAAMC,kBAAiD,IAAID;AAC3D;;;;CAIC,GACD,MAAME,oBAAwC,IAAIL;AAClD;;CAEC,GACD,MAAMM,qBAAyD,IAAIH;AACnE;;CAEC,GACD,MAAMI,qBAAyD,IAAIJ;AAEnE;;CAEC,GACD,aAAa;AACb,SAASK,8BACPC,SAAoB,EACpBC,QAAkB;IAElB,MAAMC,SAAShB,cAAc,CAACe,SAAS;IACvC,IAAIC,QAAQ;QACV,IAAIA,OAAOC,KAAK,EAAE;YAChB,MAAMD,OAAOC,KAAK;QACpB;QACA,OAAOD;IACT;IAEA,aAAa;IACb,OAAOE,kBAAkBH,UAAUI,WAAWC,OAAO,EAAEN;AACzD;AAEA;;CAEC,GACD,2CAA2C;AAC3C,MAAMO,mCAEF,CAACC,IAAIC;IACP,IAAI,CA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F,QAAQwC,aAAa,CAACE,OAAOE;AACtC;AAEA;;CAEC,GACD,SAASK,kBAAkBC,SAAoB;IAC7C,MAAMC,kBAAkBR,yBAAyBO,UAAUE,MAAM;IAGjE,MAAMhC,gBAAgB0B,kBAAkBK;IACxC,sEAAsE;IACtEnD,QAAQwC,aAAa,CAACpB;IACtB3D,WAAW4F,gCAAgC,CAAErH,IAAI,CAAC;QAChDoF;QACAD,YAAYmC,IAAI,CAAC,MAAMlC;KACxB;IAED,+CAA+C;IAC/C,MAAMY,aAAa,IAAIzH,IAAI2I,UAAUvD,MAAM,CAAC4D,GAAG,CAACC;IAChD3I,mBAAmByH,GAAG,CAAClB,eAAeY;IACtC,KAAK,MAAMhH,aAAagH,WAAY;QAClC,IAAIC,kBAAkBnH,mBAAmB4G,GAAG,CAAC1G;QAC7C,IAAI,CAACiH,iBAAiB;YACpBA,kBAAkB,IAAI1H,IAAI;gBAAC6G;aAAc;YACzCtG,mBAAmBwH,GAAG,CAACtH,WAAWiH;QACpC,OAAO;YACLA,gBAAgB9C,GAAG,CAACiC;QACtB;IACF;IAEA,IAAI8B,UAAUO,MAAM,KAAK,SAAS;QAChClB,uBAAuBnB;IACzB;AACF;AAEA3D,WAAW4F,gCAAgC,KAAK,EAAE","ignoreList":[0]}},
- {"offset": {"line": 1962, "column": 0}, "map": {"version":3,"sources":["turbopack:///[turbopack]/browser/runtime/dom/runtime-backend-dom.ts"],"sourcesContent":["/**\n * This file contains the runtime code specific to the Turbopack ECMAScript DOM runtime.\n *\n * It will be appended to the base runtime code.\n */\n\n/* eslint-disable @typescript-eslint/no-unused-vars */\n\n/// \n/// \n\nfunction getAssetSuffixFromScriptSrc() {\n // TURBOPACK_ASSET_SUFFIX is set in web workers\n if (self.TURBOPACK_ASSET_SUFFIX != null) return self.TURBOPACK_ASSET_SUFFIX\n const src = document?.currentScript?.getAttribute?.('src') ?? ''\n const qi = src.indexOf('?')\n return qi >= 0 ? src.slice(qi) : ''\n}\n\ntype ChunkResolver = {\n resolved: boolean\n loadingStarted: boolean\n resolve: () => void\n reject: (error?: Error) => void\n promise: Promise\n}\n\nlet BACKEND: RuntimeBackend\n\n/**\n * Maps chunk paths to the corresponding resolver.\n */\nconst chunkResolvers: Map = new Map()\n\n;(() => {\n BACKEND = {\n async registerChunk(chunk, params) {\n let chunkPath = getPathFromScript(chunk)\n let chunkUrl = getUrlFromScript(chunk)\n\n const resolver = getOrCreateResolver(chunkUrl)\n resolver.resolve()\n\n if (params == null) {\n return\n }\n\n for (const otherChunkData of params.otherChunks) {\n const otherChunkPath = getChunkPath(otherChunkData)\n const otherChunkUrl = getChunkRelativeUrl(otherChunkPath)\n\n // Chunk might have started loading, so we want to avoid triggering another load.\n getOrCreateResolver(otherChunkUrl)\n }\n\n // This waits for chunks to be loaded, but also marks included items as available.\n await Promise.all(\n params.otherChunks.map((otherChunkData) =>\n loadInitialChunk(chunkPath, otherChunkData)\n )\n )\n\n if (params.runtimeModuleIds.length > 0) {\n for (const moduleId of params.runtimeModuleIds) {\n getOrInstantiateRuntimeModule(chunkPath, moduleId)\n }\n }\n },\n\n /**\n * Loads the given chunk, and returns a promise that resolves once the chunk\n * has been loaded.\n */\n loadChunkCached(sourceType: SourceType, chunkUrl: ChunkUrl) {\n return doLoadChunk(sourceType, chunkUrl)\n },\n\n async loadWebAssembly(\n _sourceType: SourceType,\n _sourceData: SourceData,\n wasmChunkPath: ChunkPath,\n _edgeModule: () => WebAssembly.Module,\n importsObj: WebAssembly.Imports\n ): Promise {\n const req = fetchWebAssembly(wasmChunkPath)\n\n const { instance } = await WebAssembly.instantiateStreaming(\n req,\n importsObj\n )\n\n return instance.exports\n },\n\n async loadWebAssemblyModule(\n _sourceType: SourceType,\n _sourceData: SourceData,\n wasmChunkPath: ChunkPath,\n _edgeModule: () => WebAssembly.Module\n ): Promise {\n const req = fetchWebAssembly(wasmChunkPath)\n\n return await WebAssembly.compileStreaming(req)\n },\n }\n\n function getOrCreateResolver(chunkUrl: ChunkUrl): ChunkResolver {\n let resolver = chunkResolvers.get(chunkUrl)\n if (!resolver) {\n let resolve: () => void\n let reject: (error?: Error) => void\n const promise = new Promise((innerResolve, innerReject) => {\n resolve = innerResolve\n reject = innerReject\n })\n resolver = {\n resolved: false,\n loadingStarted: false,\n promise,\n resolve: () => {\n resolver!.resolved = true\n resolve()\n },\n reject: reject!,\n }\n chunkResolvers.set(chunkUrl, resolver)\n }\n return resolver\n }\n\n /**\n * Loads the given chunk, and returns a promise that resolves once the chunk\n * has been loaded.\n */\n function doLoadChunk(sourceType: SourceType, chunkUrl: ChunkUrl) {\n const resolver = getOrCreateResolver(chunkUrl)\n if (resolver.loadingStarted) {\n return resolver.promise\n }\n\n if (sourceType === SourceType.Runtime) {\n // We don't need to load chunks references from runtime code, as they're already\n // present in the DOM.\n resolver.loadingStarted = true\n\n if (isCss(chunkUrl)) {\n // CSS chunks do not register themselves, and as such must be marked as\n // loaded instantly.\n resolver.resolve()\n }\n\n // We need to wait for JS chunks to register themselves within `registerChunk`\n // before we can start instantiating runtime modules, hence the absence of\n // `resolver.resolve()` in this branch.\n\n return resolver.promise\n }\n\n if (typeof importScripts === 'function') {\n // We're in a web worker\n if (isCss(chunkUrl)) {\n // ignore\n } else if (isJs(chunkUrl)) {\n self.TURBOPACK_NEXT_CHUNK_URLS!.push(chunkUrl)\n importScripts(chunkUrl)\n } else {\n throw new Error(\n `can't infer type of chunk from URL ${chunkUrl} in worker`\n )\n }\n } else {\n // TODO(PACK-2140): remove this once all filenames are guaranteed to be escaped.\n const decodedChunkUrl = decodeURI(chunkUrl)\n\n if (isCss(chunkUrl)) {\n const previousLinks = document.querySelectorAll(\n `link[rel=stylesheet][href=\"${chunkUrl}\"],link[rel=stylesheet][href^=\"${chunkUrl}?\"],link[rel=stylesheet][href=\"${decodedChunkUrl}\"],link[rel=stylesheet][href^=\"${decodedChunkUrl}?\"]`\n )\n if (previousLinks.length > 0) {\n // CSS chunks do not register themselves, and as such must be marked as\n // loaded instantly.\n resolver.resolve()\n } else {\n const link = document.createElement('link')\n link.rel = 'stylesheet'\n link.crossOrigin = CROSS_ORIGIN\n link.href = chunkUrl\n link.onerror = () => {\n resolver.reject()\n }\n link.onload = () => {\n // CSS chunks do not register themselves, and as such must be marked as\n // loaded instantly.\n resolver.resolve()\n }\n // Append to the `head` for webpack compatibility.\n document.head.appendChild(link)\n }\n } else if (isJs(chunkUrl)) {\n const previousScripts = document.querySelectorAll(\n `script[src=\"${chunkUrl}\"],script[src^=\"${chunkUrl}?\"],script[src=\"${decodedChunkUrl}\"],script[src^=\"${decodedChunkUrl}?\"]`\n )\n if (previousScripts.length > 0) {\n // There is this edge where the script already failed loading, but we\n // can't detect that. The Promise will never resolve in this case.\n for (const script of Array.from(previousScripts)) {\n script.addEventListener('error', () => {\n resolver.reject()\n })\n }\n } else {\n const script = document.createElement('script')\n script.crossOrigin = CROSS_ORIGIN\n script.src = chunkUrl\n // We'll only mark the chunk as loaded once the script has been executed,\n // which happens in `registerChunk`. Hence the absence of `resolve()` in\n // this branch.\n script.onerror = () => {\n resolver.reject()\n }\n // Append to the `head` for webpack compatibility.\n document.head.appendChild(script)\n }\n } else {\n throw new Error(`can't infer type of chunk from URL ${chunkUrl}`)\n }\n }\n\n resolver.loadingStarted = true\n return resolver.promise\n }\n\n function fetchWebAssembly(wasmChunkPath: ChunkPath) {\n return fetch(getChunkRelativeUrl(wasmChunkPath))\n }\n})()\n"],"names":["getAssetSuffixFromScriptSrc","self","TURBOPACK_ASSET_SUFFIX","src","document","currentScript","getAttribute","qi","indexOf","slice","BACKEND","chunkResolvers","Map","registerChunk","chunk","params","chunkPath","getPathFromScript","chunkUrl","getUrlFromScript","resolver","getOrCreateResolver","resolve","otherChunkData","otherChunks","otherChunkPath","getChunkPath","otherChunkUrl","getChunkRelativeUrl","Promise","all","map","loadInitialChunk","runtimeModuleIds","length","moduleId","getOrInstantiateRuntimeModule","loadChunkCached","sourceType","doLoadChunk","loadWebAssembly","_sourceType","_sourceData","wasmChunkPath","_edgeModule","importsObj","req","fetchWebAssembly","instance","WebAssembly","instantiateStreaming","exports","loadWebAssemblyModule","compileStreaming","get","reject","promise","innerResolve","innerReject","resolved","loadingStarted","set","SourceType","Runtime","isCss","importScripts","isJs","TURBOPACK_NEXT_CHUNK_URLS","push","Error","decodedChunkUrl","decodeURI","previousLinks","querySelectorAll","link","createElement","rel","crossOrigin","CROSS_ORIGIN","href","onerror","onload","head","appendChild","previousScripts","script","Array","from","addEventListener","fetch"],"mappings":"AAAA;;;;CAIC,GAED,oDAAoD,GAEpD,sEAAsE;AACtE,mEAAmE;AAEnE,SAASA;IACP,+CAA+C;IAC/C,IAAIC,KAAKC,sBAAsB,IAAI,MAAM,OAAOD,KAAKC,sBAAsB;IAC3E,MAAMC,MAAMC,UAAUC,eAAeC,eAAe,UAAU;IAC9D,MAAMC,KAAKJ,IAAIK,OAAO,CAAC;IACvB,OAAOD,MAAM,IAAIJ,IAAIM,KAAK,CAACF,MAAM;AACnC;AAUA,IAAIG;AAEJ;;CAEC,GACD,MAAMC,iBAA+C,IAAIC;AAExD,CAAC;IACAF,UAAU;QACR,MAAMG,eAAcC,KAAK,EAAEC,MAAM;YAC/B,IAAIC,YAAYC,kBAAkBH;YAClC,IAAII,WAAWC,iBAAiBL;YAEhC,MAAMM,WAAWC,oBAAoBH;YACrCE,SAASE,OAAO;YAEhB,IAAIP,UAAU,MAAM;gBAClB;YACF;YAEA,KAAK,MAAMQ,kBAAkBR,OAAOS,WAAW,CAAE;gBAC/C,MAAMC,iBAAiBC,aAAaH;gBACpC,MAAMI,gBAAgBC,oBAAoBH;gBAE1C,iFAAiF;gBACjFJ,oBAAoBM;YACtB;YAEA,kFAAkF;YAClF,MAAME,QAAQC,GAAG,CACff,OAAOS,WAAW,CAACO,GAAG,CAAC,CAACR,iBACtBS,iBAAiBhB,WAAWO;YAIhC,IAAIR,OAAOkB,gBAAgB,CAACC,MAAM,GAAG,GAAG;gBACtC,KAAK,MAAMC,YAAYpB,OAAOkB,gBAAgB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AgB,EAAEA,gBAAgB,GAAG,CAAC;gBAE7H,IAAIc,gBAAgBlD,MAAM,GAAG,GAAG;oBAC9B,qEAAqE;oBACrE,kEAAkE;oBAClE,KAAK,MAAMmD,UAAUC,MAAMC,IAAI,CAACH,iBAAkB;wBAChDC,OAAOG,gBAAgB,CAAC,SAAS;4BAC/BpE,SAASmC,MAAM;wBACjB;oBACF;gBACF,OAAO;oBACL,MAAM8B,SAASjF,SAASuE,aAAa,CAAC;oBACtCU,OAAOR,WAAW,GAAGC;oBACrBO,OAAOlF,GAAG,GAAGe;oBACb,yEAAyE;oBACzE,wEAAwE;oBACxE,eAAe;oBACfmE,OAAOL,OAAO,GAAG;wBACf5D,SAASmC,MAAM;oBACjB;oBACA,kDAAkD;oBAClDnD,SAAS8E,IAAI,CAACC,WAAW,CAACE;gBAC5B;YACF,OAAO;gBACL,MAAM,IAAIhB,MAAM,CAAC,mCAAmC,EAAEnD,UAAU;YAClE;QACF;QAEAE,SAASwC,cAAc,GAAG;QAC1B,OAAOxC,SAASoC,OAAO;IACzB;IAEA,SAAST,iBAAiBJ,aAAwB;QAChD,OAAO8C,MAAM7D,oBAAoBe;IACnC;AACF,CAAC","ignoreList":[0]}},
- {"offset": {"line": 2133, "column": 0}, "map": {"version":3,"sources":["turbopack:///[turbopack]/browser/runtime/dom/dev-backend-dom.ts"],"sourcesContent":["/**\n * This file contains the runtime code specific to the Turbopack development\n * ECMAScript DOM runtime.\n *\n * It will be appended to the base development runtime code.\n */\n\n/* eslint-disable @typescript-eslint/no-unused-vars */\n\n/// \n/// \n/// \n/// \n\nlet DEV_BACKEND: DevRuntimeBackend\n;(() => {\n DEV_BACKEND = {\n unloadChunk(chunkUrl) {\n deleteResolver(chunkUrl)\n\n // Strip query string so we match links regardless of cache-busting\n // params (e.g. ?ts=) that may differ between HMR updates.\n const baseChunkUrl = chunkUrl.split('?')[0]\n // TODO(PACK-2140): remove this once all filenames are guaranteed to be escaped.\n const decodedBaseChunkUrl = decodeURI(baseChunkUrl)\n\n if (isCss(chunkUrl)) {\n const links = document.querySelectorAll(\n `link[href=\"${baseChunkUrl}\"],link[href^=\"${baseChunkUrl}?\"],link[href=\"${decodedBaseChunkUrl}\"],link[href^=\"${decodedBaseChunkUrl}?\"]`\n )\n for (const link of Array.from(links)) {\n link.remove()\n }\n } else if (isJs(chunkUrl)) {\n // Unloading a JS chunk would have no effect, as it lives in the JS\n // runtime once evaluated.\n // However, we still want to remove the script tag from the DOM to keep\n // the HTML somewhat consistent from the user's perspective.\n const scripts = document.querySelectorAll(\n `script[src=\"${baseChunkUrl}\"],script[src^=\"${baseChunkUrl}?\"],script[src=\"${decodedBaseChunkUrl}\"],script[src^=\"${decodedBaseChunkUrl}?\"]`\n )\n for (const script of Array.from(scripts)) {\n script.remove()\n }\n } else {\n throw new Error(`can't infer type of chunk from URL ${chunkUrl}`)\n }\n },\n\n reloadChunk(chunkUrl) {\n return new Promise((resolve, reject) => {\n if (!isCss(chunkUrl)) {\n reject(new Error('The DOM backend can only reload CSS chunks'))\n return\n }\n\n // Strip query string so we match links regardless of cache-busting\n // params (e.g. ?ts=) that may differ between HMR updates.\n const baseChunkUrl = chunkUrl.split('?')[0]\n const decodedBaseChunkUrl = decodeURI(baseChunkUrl)\n const previousLinks = document.querySelectorAll(\n `link[rel=stylesheet][href=\"${baseChunkUrl}\"],link[rel=stylesheet][href^=\"${baseChunkUrl}?\"],link[rel=stylesheet][href=\"${decodedBaseChunkUrl}\"],link[rel=stylesheet][href^=\"${decodedBaseChunkUrl}?\"]`\n )\n\n if (previousLinks.length === 0) {\n reject(new Error(`No link element found for chunk ${chunkUrl}`))\n return\n }\n\n const link = document.createElement('link')\n link.rel = 'stylesheet'\n link.crossOrigin = CROSS_ORIGIN\n\n if (\n navigator.userAgent.includes('Firefox') ||\n (navigator.userAgent.includes('Safari') &&\n !navigator.userAgent.includes('Chrome') &&\n !navigator.userAgent.includes('Chromium'))\n ) {\n // Firefox won't reload CSS files that were previously loaded on the\n // current page: https://bugzilla.mozilla.org/show_bug.cgi?id=1037506\n //\n // Safari serves cached CSS when a exists for the\n // same URL: https://bugs.webkit.org/show_bug.cgi?id=187726\n //\n // Replace or add a fresh `ts` cache-busting param without\n // discarding other query parameters that may already be present.\n const url = new URL(chunkUrl, location.origin)\n // Reduced timer precision in some browers could lead to an update getting dropped\n // in Firefox if it happens fast enough (in firefox precision is sometimes 100ms!).\n // So trust that the server is only updating us when it is important and use a\n // random number to bust the cache.\n url.searchParams.set('ts', `${Date.now()}.${Math.random()}`)\n link.href = url.pathname + url.search\n } else {\n link.href = chunkUrl\n }\n\n link.onerror = () => {\n reject()\n }\n link.onload = () => {\n // First load the new CSS, then remove the old ones. This prevents visible\n // flickering that would happen in-between removing the previous CSS and\n // loading the new one.\n for (const previousLink of Array.from(previousLinks))\n previousLink.remove()\n\n // CSS chunks do not register themselves, and as such must be marked as\n // loaded instantly.\n resolve()\n }\n\n // Make sure to insert the new CSS right after the previous one, so that\n // its precedence is higher.\n previousLinks[0].parentElement!.insertBefore(\n link,\n previousLinks[0].nextSibling\n )\n })\n },\n\n restart: () => self.location.reload(),\n }\n\n function deleteResolver(chunkUrl: ChunkUrl) {\n chunkResolvers.delete(chunkUrl)\n }\n})()\n\nfunction _eval({ code, url, map }: EcmascriptModuleEntry): ModuleFactory {\n code += `\\n\\n//# sourceURL=${encodeURI(\n location.origin + CHUNK_BASE_PATH + url + ASSET_SUFFIX\n )}`\n if (map) {\n code += `\\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,${btoa(\n // btoa doesn't handle nonlatin characters, so escape them as \\x sequences\n // See https://stackoverflow.com/a/26603875\n unescape(encodeURIComponent(map))\n )}`\n }\n\n // eslint-disable-next-line no-eval\n return eval(code)\n}\n"],"names":["DEV_BACKEND","unloadChunk","chunkUrl","deleteResolver","baseChunkUrl","split","decodedBaseChunkUrl","decodeURI","isCss","links","document","querySelectorAll","link","Array","from","remove","isJs","scripts","script","Error","reloadChunk","Promise","resolve","reject","previousLinks","length","createElement","rel","crossOrigin","CROSS_ORIGIN","navigator","userAgent","includes","url","URL","location","origin","searchParams","set","Date","now","Math","random","href","pathname","search","onerror","onload","previousLink","parentElement","insertBefore","nextSibling","restart","self","reload","chunkResolvers","delete","_eval","code","map","encodeURI","CHUNK_BASE_PATH","ASSET_SUFFIX","btoa","unescape","encodeURIComponent","eval"],"mappings":"AAAA;;;;;CAKC,GAED,oDAAoD,GAEpD,gDAAgD;AAChD,4CAA4C;AAC5C,iDAAiD;AACjD,0DAA0D;AAE1D,IAAIA;AACH,CAAC;IACAA,cAAc;QACZC,aAAYC,QAAQ;YAClBC,eAAeD;YAEf,mEAAmE;YACnE,0DAA0D;YAC1D,MAAME,eAAeF,SAASG,KAAK,CAAC,IAAI,CAAC,EAAE;YAC3C,gFAAgF;YAChF,MAAMC,sBAAsBC,UAAUH;YAEtC,IAAII,MAAMN,WAAW;gBACnB,MAAMO,QAAQC,SAASC,gBAAgB,CACrC,CAAC,WAAW,EAAEP,aAAa,eAAe,EAAEA,aAAa,eAAe,EAAEE,oBAAoB,eAAe,EAAEA,oBAAoB,GAAG,CAAC;gBAEzI,KAAK,MAAMM,QAAQC,MAAMC,IAAI,CAACL,OAAQ;oBACpCG,KAAKG,MAAM;gBACb;YACF,OAAO,IAAIC,KAAKd,WAAW;gBACzB,mEAAmE;gBACnE,0BAA0B;gBAC1B,uEAAuE;gBACvE,4DAA4D;gBAC5D,MAAMe,UAAUP,SAASC,gBAAgB,CACvC,CAAC,YAAY,EAAEP,aAAa,gBAAgB,EAAEA,aAAa,gBAAgB,EAAEE,oBAAoB,gBAAgB,EAAEA,oBAAoB,GAAG,CAAC;gBAE7I,KAAK,MAAMY,UAAUL,MAAMC,IAAI,CAACG,SAAU;oBACxCC,OAAOH,MAAM;gBACf;YACF,OAAO;gBACL,MAAM,IAAII,MAAM,CAAC,mCAAmC,EAAEjB,UAAU;YAClE;QACF;QAEAkB,aAAYlB,QAAQ;YAClB,OAAO,IAAImB,QAAc,CAACC,SAASC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,OAAO,GAAG;oBACbvB;gBACF;gBACAX,KAAKmC,MAAM,GAAG;oBACZ,0EAA0E;oBAC1E,wEAAwE;oBACxE,uBAAuB;oBACvB,KAAK,MAAMC,gBAAgBnC,MAAMC,IAAI,CAACU,eACpCwB,aAAajC,MAAM;oBAErB,uEAAuE;oBACvE,oBAAoB;oBACpBO;gBACF;gBAEA,wEAAwE;gBACxE,4BAA4B;gBAC5BE,aAAa,CAAC,EAAE,CAACyB,aAAa,CAAEC,YAAY,CAC1CtC,MACAY,aAAa,CAAC,EAAE,CAAC2B,WAAW;YAEhC;QACF;QAEAC,SAAS,IAAMC,KAAKlB,QAAQ,CAACmB,MAAM;IACrC;IAEA,SAASnD,eAAeD,QAAkB;QACxCqD,eAAeC,MAAM,CAACtD;IACxB;AACF,CAAC;AAED,SAASuD,MAAM,EAAEC,IAAI,EAAEzB,GAAG,EAAE0B,GAAG,EAAyB;IACtDD,QAAQ,CAAC,kBAAkB,EAAEE,UAC3BzB,SAASC,MAAM,GAAGyB,kBAAkB5B,MAAM6B,eACzC;IACH,IAAIH,KAAK;QACPD,QAAQ,CAAC,kEAAkE,EAAEK,KAC3E,0EAA0E;QAC1E,2CAA2C;QAC3CC,SAASC,mBAAmBN,QAC3B;IACL;IAEA,mCAAmC;IACnC,OAAOO,KAAKR;AACd","ignoreList":[0]}}]
+ {"offset": {"line": 17, "column": 0}, "map": {"version":3,"sources":["turbopack:///[turbopack]/shared/runtime/runtime-utils.ts"],"sourcesContent":["/**\n * This file contains runtime types and functions that are shared between all\n * TurboPack ECMAScript runtimes.\n *\n * It will be prepended to the runtime code of each runtime.\n */\n\n/* eslint-disable @typescript-eslint/no-unused-vars */\n\n/// \n\ntype EsmNamespaceObject = Record\n\n/**\n * Describes why a module was instantiated.\n * Shared between browser and Node.js runtimes.\n */\nenum SourceType {\n /**\n * The module was instantiated because it was included in an evaluated chunk's\n * runtime.\n * SourceData is a ChunkPath.\n */\n Runtime = 0,\n /**\n * The module was instantiated because a parent module imported it.\n * SourceData is a ModuleId.\n */\n Parent = 1,\n /**\n * The module was instantiated because it was included in a chunk's hot module\n * update.\n * SourceData is an array of ModuleIds or undefined.\n */\n Update = 2,\n}\n\ntype SourceData = ChunkPath | ModuleId | ModuleId[] | undefined\n\n// @ts-ignore Defined in `dev-base.ts`\ndeclare function getOrInstantiateModuleFromParent(\n id: ModuleId,\n sourceModule: M\n): M\n\n// @ts-ignore Defined in `hmr-runtime.ts` (dev mode only)\ndeclare let devModuleCache: Record | undefined\n\n/**\n * Flag indicating which module object type to create when a module is merged. Set to `true`\n * by each runtime that uses ModuleWithDirection (browser dev-base.ts, nodejs dev-base.ts,\n * nodejs build-base.ts). Browser production (build-base.ts) leaves it as `false` since it\n * uses plain Module objects.\n */\nlet createModuleWithDirectionFlag = false\n\nconst REEXPORTED_OBJECTS = new WeakMap()\n\n/**\n * Constructs the `__turbopack_context__` object for a module.\n */\nfunction Context(\n this: TurbopackBaseContext,\n module: Module,\n exports: Exports\n) {\n this.m = module\n // We need to store this here instead of accessing it from the module object to:\n // 1. Make it available to factories directly, since we rewrite `this` to\n // `__turbopack_context__.e` in CJS modules.\n // 2. Support async modules which rewrite `module.exports` to a promise, so we\n // can still access the original exports object from functions like\n // `esmExport`\n // Ideally we could find a new approach for async modules and drop this property altogether.\n this.e = exports\n}\nconst contextPrototype = Context.prototype as TurbopackBaseContext\n\ntype ModuleContextMap = Record\n\ninterface ModuleContextEntry {\n id: () => ModuleId\n module: () => any\n}\n\ninterface ModuleContext {\n // require call\n (moduleId: string): Exports | EsmNamespaceObject\n\n // async import call\n import(moduleId: string): Promise\n\n keys(): ModuleId[]\n\n resolve(moduleId: string): ModuleId\n}\n\ntype GetOrInstantiateModuleFromParent = (\n moduleId: M['id'],\n parentModule: M\n) => M\n\ndeclare function getOrInstantiateRuntimeModule(\n chunkPath: ChunkPath,\n moduleId: ModuleId\n): Module\n\nconst hasOwnProperty = Object.prototype.hasOwnProperty\nconst toStringTag = typeof Symbol !== 'undefined' && Symbol.toStringTag\n\nfunction defineProp(\n obj: any,\n name: PropertyKey,\n options: PropertyDescriptor & ThisType\n) {\n if (!hasOwnProperty.call(obj, name)) Object.defineProperty(obj, name, options)\n}\n\nfunction getOverwrittenModule(\n moduleCache: ModuleCache,\n id: ModuleId\n): Module {\n let module = moduleCache[id]\n if (!module) {\n if (createModuleWithDirectionFlag) {\n // set in development modes for hmr support\n module = createModuleWithDirection(id)\n } else {\n module = createModuleObject(id)\n }\n moduleCache[id] = module\n }\n return module\n}\n\n/**\n * Creates the module object. Only done here to ensure all module objects have the same shape.\n */\nfunction createModuleObject(id: ModuleId): Module {\n return {\n exports: {},\n error: undefined,\n id,\n namespaceObject: undefined,\n }\n}\n\nfunction createModuleWithDirection(id: ModuleId): ModuleWithDirection {\n return {\n exports: {},\n error: undefined,\n id,\n namespaceObject: undefined,\n parents: [],\n children: [],\n }\n}\n\ntype BindingTag = 0\nconst BindingTag_Value = 0 as BindingTag\n\n// an arbitrary sequence of bindings as\n// - a prop name\n// - BindingTag_Value, a value to be bound directly, or\n// - 1 or 2 functions to bind as getters and sdetters\ntype EsmBindings = Array<\n string | BindingTag | (() => unknown) | ((v: unknown) => void) | unknown\n>\n\n/**\n * Adds the getters to the exports object.\n */\nfunction esm(exports: Exports, bindings: EsmBindings) {\n defineProp(exports, '__esModule', { value: true })\n if (toStringTag) defineProp(exports, toStringTag, { value: 'Module' })\n let i = 0\n while (i < bindings.length) {\n const propName = bindings[i++] as string\n const tagOrFunction = bindings[i++]\n if (typeof tagOrFunction === 'number') {\n if (tagOrFunction === BindingTag_Value) {\n defineProp(exports, propName, {\n value: bindings[i++],\n enumerable: true,\n writable: false,\n })\n } else {\n throw new Error(`unexpected tag: ${tagOrFunction}`)\n }\n } else {\n const getterFn = tagOrFunction as () => unknown\n if (typeof bindings[i] === 'function') {\n const setterFn = bindings[i++] as (v: unknown) => void\n defineProp(exports, propName, {\n get: getterFn,\n set: setterFn,\n enumerable: true,\n })\n } else {\n defineProp(exports, propName, {\n get: getterFn,\n enumerable: true,\n })\n }\n }\n }\n Object.seal(exports)\n}\n\n/**\n * Makes the module an ESM with exports\n */\nfunction esmExport(\n this: TurbopackBaseContext,\n bindings: EsmBindings,\n id: ModuleId | undefined\n) {\n let module: Module\n let exports: Module['exports']\n if (id != null) {\n module = getOverwrittenModule(this.c, id)\n exports = module.exports\n } else {\n module = this.m\n exports = this.e\n }\n module.namespaceObject = exports\n esm(exports, bindings)\n}\ncontextPrototype.s = esmExport\n\ntype ReexportedObjects = Record[]\nfunction ensureDynamicExports(\n module: Module,\n exports: Exports\n): ReexportedObjects {\n let reexportedObjects: ReexportedObjects | undefined =\n REEXPORTED_OBJECTS.get(module)\n\n if (!reexportedObjects) {\n REEXPORTED_OBJECTS.set(module, (reexportedObjects = []))\n module.exports = module.namespaceObject = new Proxy(exports, {\n get(target, prop) {\n if (\n hasOwnProperty.call(target, prop) ||\n prop === 'default' ||\n prop === '__esModule'\n ) {\n return Reflect.get(target, prop)\n }\n for (const obj of reexportedObjects!) {\n const value = Reflect.get(obj, prop)\n if (value !== undefined) return value\n }\n return undefined\n },\n ownKeys(target) {\n const keys = Reflect.ownKeys(target)\n for (const obj of reexportedObjects!) {\n for (const key of Reflect.ownKeys(obj)) {\n if (key !== 'default' && !keys.includes(key)) keys.push(key)\n }\n }\n return keys\n },\n })\n }\n return reexportedObjects\n}\n\n/**\n * Dynamically exports properties from an object\n */\nfunction dynamicExport(\n this: TurbopackBaseContext,\n object: Record,\n id: ModuleId | undefined\n) {\n let module: Module\n let exports: Exports\n if (id != null) {\n module = getOverwrittenModule(this.c, id)\n exports = module.exports\n } else {\n module = this.m\n exports = this.e\n }\n const reexportedObjects = ensureDynamicExports(module, exports)\n\n if (typeof object === 'object' && object !== null) {\n reexportedObjects.push(object)\n }\n}\ncontextPrototype.j = dynamicExport\n\nfunction exportValue(\n this: TurbopackBaseContext,\n value: any,\n id: ModuleId | undefined\n) {\n let module: Module\n if (id != null) {\n module = getOverwrittenModule(this.c, id)\n } else {\n module = this.m\n }\n module.exports = value\n}\ncontextPrototype.v = exportValue\n\nfunction exportNamespace(\n this: TurbopackBaseContext,\n namespace: any,\n id: ModuleId | undefined\n) {\n let module: Module\n if (id != null) {\n module = getOverwrittenModule(this.c, id)\n } else {\n module = this.m\n }\n module.exports = module.namespaceObject = namespace\n}\ncontextPrototype.n = exportNamespace\n\nfunction createGetter(obj: Record, key: string | symbol) {\n return () => obj[key]\n}\n\n/**\n * @returns prototype of the object\n */\nconst getProto: (obj: any) => any = Object.getPrototypeOf\n ? (obj) => Object.getPrototypeOf(obj)\n : (obj) => obj.__proto__\n\n/** Prototypes that are not expanded for exports */\nconst LEAF_PROTOTYPES = [null, getProto({}), getProto([]), getProto(getProto)]\n\n/**\n * @param raw\n * @param ns\n * @param allowExportDefault\n * * `false`: will have the raw module as default export\n * * `true`: will have the default property as default export\n */\nfunction interopEsm(\n raw: Exports,\n ns: EsmNamespaceObject,\n allowExportDefault?: boolean\n) {\n const bindings: EsmBindings = []\n let defaultLocation = -1\n for (\n let current = raw;\n (typeof current === 'object' || typeof current === 'function') &&\n !LEAF_PROTOTYPES.includes(current);\n current = getProto(current)\n ) {\n for (const key of Object.getOwnPropertyNames(current)) {\n bindings.push(key, createGetter(raw, key))\n if (defaultLocation === -1 && key === 'default') {\n defaultLocation = bindings.length - 1\n }\n }\n }\n\n // this is not really correct\n // we should set the `default` getter if the imported module is a `.cjs file`\n if (!(allowExportDefault && defaultLocation >= 0)) {\n // Replace the binding with one for the namespace itself in order to preserve iteration order.\n if (defaultLocation >= 0) {\n // Replace the getter with the value\n bindings.splice(defaultLocation, 1, BindingTag_Value, raw)\n } else {\n bindings.push('default', BindingTag_Value, raw)\n }\n }\n\n esm(ns, bindings)\n return ns\n}\n\nfunction createNS(raw: Module['exports']): EsmNamespaceObject {\n if (typeof raw === 'function') {\n return function (this: any, ...args: any[]) {\n return raw.apply(this, args)\n }\n } else {\n return Object.create(null)\n }\n}\n\nfunction esmImport(\n this: TurbopackBaseContext,\n id: ModuleId\n): Exclude {\n const module = getOrInstantiateModuleFromParent(id, this.m)\n\n // any ES module has to have `module.namespaceObject` defined.\n if (module.namespaceObject) return module.namespaceObject\n\n // only ESM can be an async module, so we don't need to worry about exports being a promise here.\n const raw = module.exports\n return (module.namespaceObject = interopEsm(\n raw,\n createNS(raw),\n raw && (raw as any).__esModule\n ))\n}\ncontextPrototype.i = esmImport\n\nfunction asyncLoader(\n this: TurbopackBaseContext,\n moduleId: ModuleId\n): Promise {\n const loader = this.r(moduleId) as (\n importFunction: EsmImport\n ) => Promise\n return loader(esmImport.bind(this))\n}\ncontextPrototype.A = asyncLoader\n\n// Add a simple runtime require so that environments without one can still pass\n// `typeof require` CommonJS checks so that exports are correctly registered.\nconst runtimeRequire =\n // @ts-ignore\n typeof require === 'function'\n ? // @ts-ignore\n require\n : function require() {\n throw new Error('Unexpected use of runtime require')\n }\ncontextPrototype.t = runtimeRequire\n\nfunction commonJsRequire(\n this: TurbopackBaseContext,\n id: ModuleId\n): Exports {\n return getOrInstantiateModuleFromParent(id, this.m).exports\n}\ncontextPrototype.r = commonJsRequire\n\n/**\n * Remove fragments and query parameters since they are never part of the context map keys\n *\n * This matches how we parse patterns at resolving time. Arguably we should only do this for\n * strings passed to `import` but the resolve does it for `import` and `require` and so we do\n * here as well.\n */\nfunction parseRequest(request: string): string {\n // Per the URI spec fragments can contain `?` characters, so we should trim it off first\n // https://datatracker.ietf.org/doc/html/rfc3986#section-3.5\n const hashIndex = request.indexOf('#')\n if (hashIndex !== -1) {\n request = request.substring(0, hashIndex)\n }\n\n const queryIndex = request.indexOf('?')\n if (queryIndex !== -1) {\n request = request.substring(0, queryIndex)\n }\n\n return request\n}\n/**\n * `require.context` and require/import expression runtime.\n */\nfunction moduleContext(map: ModuleContextMap): ModuleContext {\n function moduleContext(id: string): Exports {\n id = parseRequest(id)\n if (hasOwnProperty.call(map, id)) {\n return map[id].module()\n }\n\n const e = new Error(`Cannot find module '${id}'`)\n ;(e as any).code = 'MODULE_NOT_FOUND'\n throw e\n }\n\n moduleContext.keys = (): string[] => {\n return Object.keys(map)\n }\n\n moduleContext.resolve = (id: string): ModuleId => {\n id = parseRequest(id)\n if (hasOwnProperty.call(map, id)) {\n return map[id].id()\n }\n\n const e = new Error(`Cannot find module '${id}'`)\n ;(e as any).code = 'MODULE_NOT_FOUND'\n throw e\n }\n\n moduleContext.import = async (id: string) => {\n return await (moduleContext(id) as Promise)\n }\n\n return moduleContext\n}\ncontextPrototype.f = moduleContext\n\n/**\n * Returns the path of a chunk defined by its data.\n */\nfunction getChunkPath(chunkData: ChunkData): ChunkPath {\n return typeof chunkData === 'string' ? chunkData : chunkData.path\n}\n\nfunction isPromise(maybePromise: any): maybePromise is Promise {\n return (\n maybePromise != null &&\n typeof maybePromise === 'object' &&\n 'then' in maybePromise &&\n typeof maybePromise.then === 'function'\n )\n}\n\nfunction isAsyncModuleExt(obj: T): obj is AsyncModuleExt & T {\n return turbopackQueues in obj\n}\n\nfunction createPromise() {\n let resolve: (value: T | PromiseLike) => void\n let reject: (reason?: any) => void\n\n const promise = new Promise((res, rej) => {\n reject = rej\n resolve = res\n })\n\n return {\n promise,\n resolve: resolve!,\n reject: reject!,\n }\n}\n\n// Load the CompressedmoduleFactories of a chunk into the `moduleFactories` Map.\n// The CompressedModuleFactories format is\n// - 1 or more module ids\n// - a module factory function\n// So walking this is a little complex but the flat structure is also fast to\n// traverse, we can use `typeof` operators to distinguish the two cases.\nfunction installCompressedModuleFactories(\n chunkModules: CompressedModuleFactories,\n offset: number,\n moduleFactories: ModuleFactories,\n newModuleId?: (id: ModuleId) => void\n) {\n let i = offset\n while (i < chunkModules.length) {\n let end = i + 1\n // Find our factory function\n while (\n end < chunkModules.length &&\n typeof chunkModules[end] !== 'function'\n ) {\n end++\n }\n if (end === chunkModules.length) {\n throw new Error('malformed chunk format, expected a factory function')\n }\n\n // Install the factory for each module ID that doesn't already have one.\n // When some IDs in this group already have a factory, reuse that existing\n // group factory for the missing IDs to keep all IDs in the group consistent.\n // Otherwise, install the factory from this chunk.\n const moduleFactoryFn = chunkModules[end] as Function\n let existingGroupFactory: Function | undefined = undefined\n for (let j = i; j < end; j++) {\n const id = chunkModules[j] as ModuleId\n const existingFactory = moduleFactories.get(id)\n if (existingFactory) {\n existingGroupFactory = existingFactory\n break\n }\n }\n const factoryToInstall = existingGroupFactory ?? moduleFactoryFn\n\n let didInstallFactory = false\n for (let j = i; j < end; j++) {\n const id = chunkModules[j] as ModuleId\n if (!moduleFactories.has(id)) {\n if (!didInstallFactory) {\n if (factoryToInstall === moduleFactoryFn) {\n applyModuleFactoryName(moduleFactoryFn)\n }\n didInstallFactory = true\n }\n moduleFactories.set(id, factoryToInstall)\n newModuleId?.(id)\n }\n }\n i = end + 1 // end is pointing at the last factory advance to the next id or the end of the array.\n }\n}\n\n// everything below is adapted from webpack\n// https://github.com/webpack/webpack/blob/6be4065ade1e252c1d8dcba4af0f43e32af1bdc1/lib/runtime/AsyncModuleRuntimeModule.js#L13\n\nconst turbopackQueues = Symbol('turbopack queues')\nconst turbopackExports = Symbol('turbopack exports')\nconst turbopackError = Symbol('turbopack error')\n\nconst enum QueueStatus {\n Unknown = -1,\n Unresolved = 0,\n Resolved = 1,\n}\n\ntype AsyncQueueFn = (() => void) & { queueCount: number }\ntype AsyncQueue = AsyncQueueFn[] & {\n status: QueueStatus\n}\n\nfunction resolveQueue(queue?: AsyncQueue) {\n if (queue && queue.status !== QueueStatus.Resolved) {\n queue.status = QueueStatus.Resolved\n queue.forEach((fn) => fn.queueCount--)\n queue.forEach((fn) => (fn.queueCount-- ? fn.queueCount++ : fn()))\n }\n}\n\ntype Dep = Exports | AsyncModulePromise | Promise\n\ntype AsyncModuleExt = {\n [turbopackQueues]: (fn: (queue: AsyncQueue) => void) => void\n [turbopackExports]: Exports\n [turbopackError]?: any\n}\n\ntype AsyncModulePromise = Promise & AsyncModuleExt\n\nfunction wrapDeps(deps: Dep[]): AsyncModuleExt[] {\n return deps.map((dep): AsyncModuleExt => {\n if (dep !== null && typeof dep === 'object') {\n if (isAsyncModuleExt(dep)) return dep\n if (isPromise(dep)) {\n const queue: AsyncQueue = Object.assign([], {\n status: QueueStatus.Unresolved,\n })\n\n const obj: AsyncModuleExt = {\n [turbopackExports]: {},\n [turbopackQueues]: (fn: (queue: AsyncQueue) => void) => fn(queue),\n }\n\n dep.then(\n (res) => {\n obj[turbopackExports] = res\n resolveQueue(queue)\n },\n (err) => {\n obj[turbopackError] = err\n resolveQueue(queue)\n }\n )\n\n return obj\n }\n }\n\n return {\n [turbopackExports]: dep,\n [turbopackQueues]: () => {},\n }\n })\n}\n\nfunction asyncModule(\n this: TurbopackBaseContext,\n body: (\n handleAsyncDependencies: (\n deps: Dep[]\n ) => Exports[] | Promise<() => Exports[]>,\n asyncResult: (err?: any) => void\n ) => void,\n hasAwait: boolean\n) {\n const module = this.m\n const queue: AsyncQueue | undefined = hasAwait\n ? Object.assign([], { status: QueueStatus.Unknown })\n : undefined\n\n const depQueues: Set = new Set()\n\n const { resolve, reject, promise: rawPromise } = createPromise()\n\n const promise: AsyncModulePromise = Object.assign(rawPromise, {\n [turbopackExports]: module.exports,\n [turbopackQueues]: (fn) => {\n queue && fn(queue)\n depQueues.forEach(fn)\n promise['catch'](() => {})\n },\n } satisfies AsyncModuleExt)\n\n const attributes: PropertyDescriptor = {\n get(): any {\n return promise\n },\n set(v: any) {\n // Calling `esmExport` leads to this.\n if (v !== promise) {\n promise[turbopackExports] = v\n }\n },\n }\n\n Object.defineProperty(module, 'exports', attributes)\n Object.defineProperty(module, 'namespaceObject', attributes)\n\n function handleAsyncDependencies(deps: Dep[]) {\n const currentDeps = wrapDeps(deps)\n\n const getResult = () =>\n currentDeps.map((d) => {\n if (d[turbopackError]) throw d[turbopackError]\n return d[turbopackExports]\n })\n\n const { promise, resolve } = createPromise<() => Exports[]>()\n\n const fn: AsyncQueueFn = Object.assign(() => resolve(getResult), {\n queueCount: 0,\n })\n\n function fnQueue(q: AsyncQueue) {\n if (q !== queue && !depQueues.has(q)) {\n depQueues.add(q)\n if (q && q.status === QueueStatus.Unresolved) {\n fn.queueCount++\n q.push(fn)\n }\n }\n }\n\n currentDeps.map((dep) => dep[turbopackQueues](fnQueue))\n\n return fn.queueCount ? promise : getResult()\n }\n\n function asyncResult(err?: any) {\n if (err) {\n reject((promise[turbopackError] = err))\n } else {\n resolve(promise[turbopackExports])\n }\n\n resolveQueue(queue)\n }\n\n body(handleAsyncDependencies, asyncResult)\n\n if (queue && queue.status === QueueStatus.Unknown) {\n queue.status = QueueStatus.Unresolved\n }\n}\ncontextPrototype.a = asyncModule\n\n/**\n * A pseudo \"fake\" URL object to resolve to its relative path.\n *\n * When UrlRewriteBehavior is set to relative, calls to the `new URL()` will construct url without base using this\n * runtime function to generate context-agnostic urls between different rendering context, i.e ssr / client to avoid\n * hydration mismatch.\n *\n * This is based on webpack's existing implementation:\n * https://github.com/webpack/webpack/blob/87660921808566ef3b8796f8df61bd79fc026108/lib/runtime/RelativeUrlRuntimeModule.js\n */\nconst relativeURL = function relativeURL(this: any, inputUrl: string) {\n const realUrl = new URL(inputUrl, 'x:/')\n const values: Record = {}\n for (const key in realUrl) values[key] = (realUrl as any)[key]\n values.href = inputUrl\n values.pathname = inputUrl.replace(/[?#].*/, '')\n values.origin = values.protocol = ''\n values.toString = values.toJSON = (..._args: Array) => inputUrl\n for (const key in values)\n Object.defineProperty(this, key, {\n enumerable: true,\n configurable: true,\n value: values[key],\n })\n}\nrelativeURL.prototype = URL.prototype\ncontextPrototype.U = relativeURL\n\n/**\n * Utility function to ensure all variants of an enum are handled.\n */\nfunction invariant(never: never, computeMessage: (arg: any) => string): never {\n throw new Error(`Invariant: ${computeMessage(never)}`)\n}\n\n/**\n * Constructs an error message for when a module factory is not available.\n */\nfunction factoryNotAvailableMessage(\n moduleId: ModuleId,\n sourceType: SourceType,\n sourceData: SourceData\n): string {\n let instantiationReason: string\n switch (sourceType) {\n case SourceType.Runtime:\n instantiationReason = `as a runtime entry of chunk ${sourceData}`\n break\n case SourceType.Parent:\n instantiationReason = `because it was required from module ${sourceData}`\n break\n case SourceType.Update:\n instantiationReason = 'because of an HMR update'\n break\n default:\n invariant(\n sourceType,\n (sourceType) => `Unknown source type: ${sourceType}`\n )\n }\n return `Module ${moduleId} was instantiated ${instantiationReason}, but the module factory is not available.`\n}\n\n/**\n * A stub function to make `require` available but non-functional in ESM.\n */\nfunction requireStub(_moduleId: ModuleId): never {\n throw new Error('dynamic usage of require is not supported')\n}\ncontextPrototype.z = requireStub\n\n// Make `globalThis` available to the module in a way that cannot be shadowed by a local variable.\ncontextPrototype.g = globalThis\n\ntype ContextConstructor = {\n new (module: Module, exports: Exports): TurbopackBaseContext\n}\n\nfunction applyModuleFactoryName(factory: Function) {\n // Give the module factory a nice name to improve stack traces.\n Object.defineProperty(factory, 'name', {\n value: 'module evaluation',\n })\n}\n"],"names":["SourceType","createModuleWithDirectionFlag","REEXPORTED_OBJECTS","WeakMap","Context","module","exports","m","e","contextPrototype","prototype","hasOwnProperty","Object","toStringTag","Symbol","defineProp","obj","name","options","call","defineProperty","getOverwrittenModule","moduleCache","id","createModuleWithDirection","createModuleObject","error","undefined","namespaceObject","parents","children","BindingTag_Value","esm","bindings","value","i","length","propName","tagOrFunction","enumerable","writable","Error","getterFn","setterFn","get","set","seal","esmExport","c","s","ensureDynamicExports","reexportedObjects","Proxy","target","prop","Reflect","ownKeys","keys","key","includes","push","dynamicExport","object","j","exportValue","v","exportNamespace","namespace","n","createGetter","getProto","getPrototypeOf","__proto__","LEAF_PROTOTYPES","interopEsm","raw","ns","allowExportDefault","defaultLocation","current","getOwnPropertyNames","splice","createNS","args","apply","create","esmImport","getOrInstantiateModuleFromParent","__esModule","asyncLoader","moduleId","loader","r","bind","A","runtimeRequire","require","require1","t","commonJsRequire","parseRequest","request","hashIndex","indexOf","substring","queryIndex","moduleContext","map","code","resolve","import","f","getChunkPath","chunkData","path","isPromise","maybePromise","then","isAsyncModuleExt","turbopackQueues","createPromise","reject","promise","Promise","res","rej","installCompressedModuleFactories","chunkModules","offset","moduleFactories","newModuleId","end","moduleFactoryFn","existingGroupFactory","existingFactory","factoryToInstall","didInstallFactory","has","applyModuleFactoryName","turbopackExports","turbopackError","resolveQueue","queue","status","forEach","fn","queueCount","wrapDeps","deps","dep","assign","err","asyncModule","body","hasAwait","depQueues","Set","rawPromise","attributes","handleAsyncDependencies","currentDeps","getResult","d","fnQueue","q","add","asyncResult","a","relativeURL","inputUrl","realUrl","URL","values","href","pathname","replace","origin","protocol","toString","toJSON","_args","configurable","U","invariant","never","computeMessage","factoryNotAvailableMessage","sourceType","sourceData","instantiationReason","requireStub","_moduleId","z","g","globalThis","factory"],"mappings":"AAAA;;;;;CAKC,GAED,oDAAoD,GAEpD,6CAA6C;AAI7C;;;CAGC,GACD,IAAA,AAAKA,oCAAAA;IACH;;;;GAIC;IAED;;;GAGC;IAED;;;;GAIC;WAhBEA;EAAAA;AA+BL;;;;;CAKC,GACD,IAAIC,gCAAgC;AAEpC,MAAMC,qBAAqB,IAAIC;AAE/B;;CAEC,GACD,SAASC,QAEPC,MAAc,EACdC,OAAgB;IAEhB,IAAI,CAACC,CAAC,GAAGF;IACT,gFAAgF;IAChF,yEAAyE;IACzE,+CAA+C;IAC/C,8EAA8E;IAC9E,sEAAsE;IACtE,iBAAiB;IACjB,4FAA4F;IAC5F,IAAI,CAACG,CAAC,GAAGF;AACX;AACA,MAAMG,mBAAmBL,QAAQM,SAAS;AA+B1C,MAAMC,iBAAiBC,OAAOF,SAAS,CAACC,cAAc;AACtD,MAAME,cAAc,OAAOC,WAAW,eAAeA,OAAOD,WAAW;AAEvE,SAASE,WACPC,GAAQ,EACRC,IAAiB,EACjBC,OAA2C;IAE3C,IAAI,CAACP,eAAeQ,IAAI,CAACH,KAAKC,OAAOL,OAAOQ,cAAc,CAACJ,KAAKC,MAAMC;AACxE;AAEA,SAASG,qBACPC,WAAgC,EAChCC,EAAY;IAEZ,IAAIlB,SAASiB,WAAW,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C;AAC/G;AAEA;;CAEC,GACD,SAASC,YAAYC,SAAmB;IACtC,MAAM,IAAItJ,MAAM;AAClB;AACAhC,iBAAiBuL,CAAC,GAAGF;AAErB,kGAAkG;AAClGrL,iBAAiBwL,CAAC,GAAGC;AAMrB,SAASxD,uBAAuByD,OAAiB;IAC/C,+DAA+D;IAC/DvL,OAAOQ,cAAc,CAAC+K,SAAS,QAAQ;QACrCjK,OAAO;IACT;AACF","ignoreList":[0]}},
+ {"offset": {"line": 593, "column": 0}, "map": {"version":3,"sources":["turbopack:///[turbopack]/browser/runtime/base/runtime-base.ts"],"sourcesContent":["/**\n * This file contains runtime types and functions that are shared between all\n * Turbopack *browser* ECMAScript runtimes.\n *\n * It will be appended to the runtime code of each runtime right after the\n * shared runtime utils.\n */\n\n/* eslint-disable @typescript-eslint/no-unused-vars */\n\n/// \n/// \n\n// Used in WebWorkers to tell the runtime about the chunk suffix\ndeclare var TURBOPACK_ASSET_SUFFIX: string\n// Used in WebWorkers to tell the runtime about the current chunk url since it\n// can't be detected via `document.currentScript`. Note it's stored in reversed\n// order to use `push` and `pop`\ndeclare var TURBOPACK_NEXT_CHUNK_URLS: ChunkUrl[] | undefined\n\n// Injected by rust code\ndeclare var CHUNK_BASE_PATH: string\n/**\n * Custom base path for Web Worker URLs (the entrypoint and the module\n * chunks loaded inside the worker). Mirrors webpack's\n * `output.workerPublicPath`. `null` means \"use CHUNK_BASE_PATH\"; an empty\n * string is a literal empty prefix (not a fallback).\n *\n * The worker's bootstrap rejects module chunks whose origin differs from\n * the worker's own origin, so the override has to apply to both — using\n * `WORKER_BASE_PATH` only for the entrypoint would leave the worker unable\n * to load any chunks when `CHUNK_BASE_PATH` is on a different origin.\n */\ndeclare var WORKER_BASE_PATH: string | null\ndeclare var ASSET_SUFFIX: string\ndeclare var CROSS_ORIGIN: 'anonymous' | 'use-credentials' | null\ndeclare var WORKER_FORWARDED_GLOBALS: string[]\n\ninterface TurbopackBrowserBaseContext extends TurbopackBaseContext {\n R: ResolvePathFromModule\n}\n\nconst browserContextPrototype =\n Context.prototype as TurbopackBrowserBaseContext\n\n// Provided by build or dev base\ndeclare function instantiateModule(\n id: ModuleId,\n sourceType: SourceType,\n sourceData: SourceData\n): Module\n\ntype RuntimeParams = {\n otherChunks: ChunkData[]\n runtimeModuleIds: ModuleId[]\n}\n\ntype ChunkRegistrationChunk =\n | ChunkPath\n | { getAttribute: (name: string) => string | null }\n | undefined\n\ntype ChunkRegistration = [\n chunkPath: ChunkRegistrationChunk,\n ...([RuntimeParams] | CompressedModuleFactories),\n]\n\ntype ChunkList = {\n script: ChunkRegistrationChunk\n chunks: ChunkData[]\n source: 'entry' | 'dynamic'\n}\n\ninterface RuntimeBackend {\n registerChunk: (\n chunkPath: ChunkPath | ChunkScript,\n params?: RuntimeParams\n ) => void\n /**\n * Returns the same Promise for the same chunk URL.\n */\n loadChunkCached: (sourceType: SourceType, chunkUrl: ChunkUrl) => Promise\n loadWebAssembly: (\n sourceType: SourceType,\n sourceData: SourceData,\n wasmChunkPath: ChunkPath,\n edgeModule: () => WebAssembly.Module,\n importsObj: WebAssembly.Imports\n ) => Promise\n loadWebAssemblyModule: (\n sourceType: SourceType,\n sourceData: SourceData,\n wasmChunkPath: ChunkPath,\n edgeModule: () => WebAssembly.Module\n ) => Promise\n}\n\ninterface DevRuntimeBackend {\n reloadChunk?: (chunkUrl: ChunkUrl) => Promise\n unloadChunk?: (chunkUrl: ChunkUrl) => void\n restart: () => void\n}\n\nconst moduleFactories: ModuleFactories = new Map()\ncontextPrototype.M = moduleFactories\n\nconst availableModules: Map | true> = new Map()\n\nconst availableModuleChunks: Map | true> = new Map()\n\nfunction loadChunk(\n this: TurbopackBrowserBaseContext,\n chunkData: ChunkData\n): Promise {\n return loadChunkInternal(SourceType.Parent, this.m.id, chunkData)\n}\nbrowserContextPrototype.l = loadChunk\n\nfunction loadInitialChunk(chunkPath: ChunkPath, chunkData: ChunkData) {\n return loadChunkInternal(SourceType.Runtime, chunkPath, chunkData)\n}\n\nasync function loadChunkInternal(\n sourceType: SourceType,\n sourceData: SourceData,\n chunkData: ChunkData\n): Promise {\n if (typeof chunkData === 'string') {\n return loadChunkPath(sourceType, sourceData, chunkData)\n }\n\n const includedList = chunkData.included || []\n const modulesPromises = includedList.map((included) => {\n if (moduleFactories.has(included)) return true\n return availableModules.get(included)\n })\n if (modulesPromises.length > 0 && modulesPromises.every((p) => p)) {\n // When all included items are already loaded or loading, we can skip loading ourselves\n await Promise.all(modulesPromises)\n return\n }\n\n const includedModuleChunksList = chunkData.moduleChunks || []\n const moduleChunksPromises = includedModuleChunksList\n .map((included) => {\n // TODO(alexkirsz) Do we need this check?\n // if (moduleFactories[included]) return true;\n return availableModuleChunks.get(included)\n })\n .filter((p) => p)\n\n let promise: Promise\n if (moduleChunksPromises.length > 0) {\n // Some module chunks are already loaded or loading.\n\n if (moduleChunksPromises.length === includedModuleChunksList.length) {\n // When all included module chunks are already loaded or loading, we can skip loading ourselves\n await Promise.all(moduleChunksPromises)\n return\n }\n\n const moduleChunksToLoad: Set = new Set()\n for (const moduleChunk of includedModuleChunksList) {\n if (!availableModuleChunks.has(moduleChunk)) {\n moduleChunksToLoad.add(moduleChunk)\n }\n }\n\n for (const moduleChunkToLoad of moduleChunksToLoad) {\n const promise = loadChunkPath(sourceType, sourceData, moduleChunkToLoad)\n\n availableModuleChunks.set(moduleChunkToLoad, promise)\n\n moduleChunksPromises.push(promise)\n }\n\n promise = Promise.all(moduleChunksPromises)\n } else {\n promise = loadChunkPath(sourceType, sourceData, chunkData.path)\n\n // Mark all included module chunks as loading if they are not already loaded or loading.\n for (const includedModuleChunk of includedModuleChunksList) {\n if (!availableModuleChunks.has(includedModuleChunk)) {\n availableModuleChunks.set(includedModuleChunk, promise)\n }\n }\n }\n\n for (const included of includedList) {\n if (!availableModules.has(included)) {\n // It might be better to race old and new promises, but it's rare that the new promise will be faster than a request started earlier.\n // In production it's even more rare, because the chunk optimization tries to deduplicate modules anyway.\n availableModules.set(included, promise)\n }\n }\n\n await promise\n}\n\nconst loadedChunk = Promise.resolve(undefined)\nconst instrumentedBackendLoadChunks = new WeakMap<\n Promise,\n Promise | typeof loadedChunk\n>()\n// Do not make this async. React relies on referential equality of the returned Promise.\nfunction loadChunkByUrl(\n this: TurbopackBrowserBaseContext,\n chunkUrl: ChunkUrl\n) {\n return loadChunkByUrlInternal(SourceType.Parent, this.m.id, chunkUrl)\n}\nbrowserContextPrototype.L = loadChunkByUrl\n\n// Do not make this async. React relies on referential equality of the returned Promise.\nfunction loadChunkByUrlInternal(\n sourceType: SourceType,\n sourceData: SourceData,\n chunkUrl: ChunkUrl\n): Promise {\n const thenable = BACKEND.loadChunkCached(sourceType, chunkUrl)\n let entry = instrumentedBackendLoadChunks.get(thenable)\n if (entry === undefined) {\n const resolve = instrumentedBackendLoadChunks.set.bind(\n instrumentedBackendLoadChunks,\n thenable,\n loadedChunk\n )\n entry = thenable.then(resolve).catch((cause) => {\n let loadReason: string\n switch (sourceType) {\n case SourceType.Runtime:\n loadReason = `as a runtime dependency of chunk ${sourceData}`\n break\n case SourceType.Parent:\n loadReason = `from module ${sourceData}`\n break\n case SourceType.Update:\n loadReason = 'from an HMR update'\n break\n default:\n invariant(\n sourceType,\n (sourceType) => `Unknown source type: ${sourceType}`\n )\n }\n let error = new Error(\n `Failed to load chunk ${chunkUrl} ${loadReason}${\n cause ? `: ${cause}` : ''\n }`,\n cause ? { cause } : undefined\n )\n error.name = 'ChunkLoadError'\n throw error\n })\n instrumentedBackendLoadChunks.set(thenable, entry)\n }\n\n return entry\n}\n\n// Do not make this async. React relies on referential equality of the returned Promise.\nfunction loadChunkPath(\n sourceType: SourceType,\n sourceData: SourceData,\n chunkPath: ChunkPath\n): Promise {\n const url = getChunkRelativeUrl(chunkPath)\n return loadChunkByUrlInternal(sourceType, sourceData, url)\n}\n\n/**\n * Returns an absolute url to an asset.\n */\nfunction resolvePathFromModule(\n this: TurbopackBaseContext,\n moduleId: string\n): string {\n const exported = this.r(moduleId)\n return exported?.default ?? exported\n}\nbrowserContextPrototype.R = resolvePathFromModule\n\n/**\n * no-op for browser\n * @param modulePath\n */\nfunction resolveAbsolutePath(modulePath?: string): string {\n return `/ROOT/${modulePath ?? ''}`\n}\nbrowserContextPrototype.P = resolveAbsolutePath\n\n/**\n * Exports a URL with the static suffix appended.\n */\nfunction exportUrl(\n this: TurbopackBrowserBaseContext,\n url: string,\n id: ModuleId | undefined\n) {\n exportValue.call(this, `${url}${ASSET_SUFFIX}`, id)\n}\nbrowserContextPrototype.q = exportUrl\n\n/**\n * Creates a worker by instantiating the given WorkerConstructor with the\n * appropriate URL and options.\n *\n * The entrypoint is a pre-compiled worker runtime file. The params configure\n * which module chunks to load and which module to run as the entry point.\n *\n * The params are a JSON array of the following structure:\n * `[TURBOPACK_NEXT_CHUNK_URLS, ASSET_SUFFIX, ...WORKER_FORWARDED_GLOBALS values]`\n *\n * @param WorkerConstructor The Worker or SharedWorker constructor\n * @param entrypoint URL path to the worker entrypoint chunk\n * @param moduleChunks list of module chunk paths to load\n * @param workerOptions options to pass to the Worker constructor (optional)\n */\nfunction createWorker(\n WorkerConstructor: { new (url: URL, options?: object): Worker },\n entrypoint: ChunkPath,\n moduleChunks: ChunkPath[],\n workerOptions?: object\n): Worker {\n const isSharedWorker = WorkerConstructor.name === 'SharedWorker'\n\n // `WORKER_BASE_PATH` overrides `CHUNK_BASE_PATH` for the entrypoint and the\n // module chunks loaded inside the worker, keeping them same-origin to each\n // other when `CHUNK_BASE_PATH` (= `assetPrefix`) is a cross-origin CDN.\n // `null` falls back; an empty string is treated as a literal empty prefix.\n const workerBasePath = WORKER_BASE_PATH ?? CHUNK_BASE_PATH\n\n const chunkUrls = moduleChunks\n .map((chunk) => getChunkRelativeUrl(chunk, workerBasePath))\n .reverse()\n const params: unknown[] = [chunkUrls, ASSET_SUFFIX]\n for (const globalName of WORKER_FORWARDED_GLOBALS) {\n params.push((globalThis as Record)[globalName])\n }\n\n const url = new URL(\n getChunkRelativeUrl(entrypoint, workerBasePath),\n location.origin\n )\n const paramsJson = JSON.stringify(params)\n if (isSharedWorker) {\n url.searchParams.set('params', paramsJson)\n } else {\n url.hash = '#params=' + encodeURIComponent(paramsJson)\n }\n\n // Remove type: \"module\" from options since our worker entrypoint is not a module\n const options = workerOptions\n ? { ...workerOptions, type: undefined }\n : undefined\n return new WorkerConstructor(url, options)\n}\nbrowserContextPrototype.b = createWorker\n\n/**\n * Instantiates a runtime module.\n */\nfunction instantiateRuntimeModule(\n moduleId: ModuleId,\n chunkPath: ChunkPath\n): Module {\n return instantiateModule(moduleId, SourceType.Runtime, chunkPath)\n}\n/**\n * Returns the URL relative to the origin where a chunk can be fetched from.\n */\nfunction getChunkRelativeUrl(\n chunkPath: ChunkPath | ChunkListPath,\n basePath: string = CHUNK_BASE_PATH\n): ChunkUrl {\n return `${basePath}${chunkPath\n .split('/')\n .map((p) => encodeURIComponent(p))\n .join('/')}${ASSET_SUFFIX}` as ChunkUrl\n}\n\n/**\n * Return the ChunkPath from a ChunkScript.\n */\nfunction getPathFromScript(chunkScript: ChunkPath | ChunkScript): ChunkPath\nfunction getPathFromScript(\n chunkScript: ChunkListPath | ChunkListScript\n): ChunkListPath\nfunction getPathFromScript(\n chunkScript: ChunkPath | ChunkListPath | ChunkScript | ChunkListScript\n): ChunkPath | ChunkListPath {\n if (typeof chunkScript === 'string') {\n return chunkScript as ChunkPath | ChunkListPath\n }\n const chunkUrl = chunkScript.src!\n const src = decodeURIComponent(chunkUrl.replace(/[?#].*$/, ''))\n const path = src.startsWith(CHUNK_BASE_PATH)\n ? src.slice(CHUNK_BASE_PATH.length)\n : src\n return path as ChunkPath | ChunkListPath\n}\n\n/**\n * Return the ChunkUrl from a ChunkScript.\n */\nfunction getUrlFromScript(chunk: ChunkPath | ChunkScript): ChunkUrl {\n if (typeof chunk === 'string') {\n return getChunkRelativeUrl(chunk)\n } else {\n // This is already exactly what we want\n return chunk.src! as ChunkUrl\n }\n}\n\n/**\n * Determine the chunk to register. Note that this function has side-effects!\n */\nfunction getChunkFromRegistration(\n chunk: ChunkRegistrationChunk\n): ChunkPath | CurrentScript {\n if (typeof chunk === 'string') {\n return chunk\n } else if (!chunk) {\n if (typeof TURBOPACK_NEXT_CHUNK_URLS !== 'undefined') {\n return { src: TURBOPACK_NEXT_CHUNK_URLS.pop()! } as CurrentScript\n } else {\n throw new Error('chunk path empty but not in a worker')\n }\n } else {\n return { src: chunk.getAttribute('src')! } as CurrentScript\n }\n}\n\n/**\n * Checks if a given path/URL ends with the given extension,\n * optionally followed by ?query or #fragment.\n */\nfunction endsWithExtension(\n chunkUrlOrPath: ChunkUrl | ChunkPath,\n ext: string\n): boolean {\n // Find where the path ends (before query or fragment)\n const q = chunkUrlOrPath.indexOf('?')\n let end: number\n if (q !== -1) {\n end = q\n } else {\n const h = chunkUrlOrPath.indexOf('#')\n end = h !== -1 ? h : chunkUrlOrPath.length\n }\n // Check if the path portion ends with the extension\n return end >= ext.length && chunkUrlOrPath.startsWith(ext, end - ext.length)\n}\n\nfunction isJs(chunkUrlOrPath: ChunkUrl | ChunkPath): boolean {\n return endsWithExtension(chunkUrlOrPath, '.js')\n}\n\nfunction isCss(chunkUrl: ChunkUrl): boolean {\n return endsWithExtension(chunkUrl, '.css')\n}\n\nfunction loadWebAssembly(\n this: TurbopackBaseContext,\n chunkPath: ChunkPath,\n edgeModule: () => WebAssembly.Module,\n importsObj: WebAssembly.Imports\n): Promise {\n return BACKEND.loadWebAssembly(\n SourceType.Parent,\n this.m.id,\n chunkPath,\n edgeModule,\n importsObj\n )\n}\ncontextPrototype.w = loadWebAssembly\n\nfunction loadWebAssemblyModule(\n this: TurbopackBaseContext,\n chunkPath: ChunkPath,\n edgeModule: () => WebAssembly.Module\n): Promise {\n return BACKEND.loadWebAssemblyModule(\n SourceType.Parent,\n this.m.id,\n chunkPath,\n edgeModule\n )\n}\ncontextPrototype.u = loadWebAssemblyModule\n"],"names":["browserContextPrototype","Context","prototype","moduleFactories","Map","contextPrototype","M","availableModules","availableModuleChunks","loadChunk","chunkData","loadChunkInternal","SourceType","Parent","m","id","l","loadInitialChunk","chunkPath","Runtime","sourceType","sourceData","loadChunkPath","includedList","included","modulesPromises","map","has","get","length","every","p","Promise","all","includedModuleChunksList","moduleChunks","moduleChunksPromises","filter","promise","moduleChunksToLoad","Set","moduleChunk","add","moduleChunkToLoad","set","push","path","includedModuleChunk","loadedChunk","resolve","undefined","instrumentedBackendLoadChunks","WeakMap","loadChunkByUrl","chunkUrl","loadChunkByUrlInternal","L","thenable","BACKEND","loadChunkCached","entry","bind","then","catch","cause","loadReason","Update","invariant","error","Error","name","url","getChunkRelativeUrl","resolvePathFromModule","moduleId","exported","r","default","R","resolveAbsolutePath","modulePath","P","exportUrl","exportValue","call","ASSET_SUFFIX","q","createWorker","WorkerConstructor","entrypoint","workerOptions","isSharedWorker","workerBasePath","WORKER_BASE_PATH","CHUNK_BASE_PATH","chunkUrls","chunk","reverse","params","globalName","WORKER_FORWARDED_GLOBALS","globalThis","URL","location","origin","paramsJson","JSON","stringify","searchParams","hash","encodeURIComponent","options","type","b","instantiateRuntimeModule","instantiateModule","basePath","split","join","getPathFromScript","chunkScript","src","decodeURIComponent","replace","startsWith","slice","getUrlFromScript","getChunkFromRegistration","TURBOPACK_NEXT_CHUNK_URLS","pop","getAttribute","endsWithExtension","chunkUrlOrPath","ext","indexOf","end","h","isJs","isCss","loadWebAssembly","edgeModule","importsObj","w","loadWebAssemblyModule","u"],"mappings":"AAAA;;;;;;CAMC,GAED,oDAAoD,GAEpD,6CAA6C;AAC7C,iEAAiE;AAEjE,gEAAgE;AA6BhE,MAAMA,0BACJC,QAAQC,SAAS;AA4DnB,MAAMC,kBAAmC,IAAIC;AAC7CC,iBAAiBC,CAAC,GAAGH;AAErB,MAAMI,mBAAuD,IAAIH;AAEjE,MAAMI,wBAA6D,IAAIJ;AAEvE,SAASK,UAEPC,SAAoB;IAEpB,OAAOC,kBAAkBC,WAAWC,MAAM,EAAE,IAAI,CAACC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ACTG,WACA0H,YACAC;AAEJ;AACAxI,iBAAiByI,CAAC,GAAGH;AAErB,SAASI,sBAEP7H,SAAoB,EACpB0H,UAAoC;IAEpC,OAAOlF,QAAQqF,qBAAqB,CAClCnI,WAAWC,MAAM,EACjB,IAAI,CAACC,CAAC,CAACC,EAAE,EACTG,WACA0H;AAEJ;AACAvI,iBAAiB2I,CAAC,GAAGD","ignoreList":[0]}},
+ {"offset": {"line": 857, "column": 0}, "map": {"version":3,"sources":["turbopack:///[turbopack]/shared/runtime/hmr-runtime.ts"],"sourcesContent":["/// \n/// \n/// \n/// \n\ntype HotModuleFactoryFunction = ModuleFactoryFunction<\n HotModule,\n TurbopackBaseContext\n>\n\n/**\n * Shared HMR (Hot Module Replacement) implementation.\n *\n * This file contains the complete HMR implementation that's shared between\n * browser and Node.js runtimes. It manages module hot state, dependency\n * tracking, the module.hot API, and the full HMR update flow.\n */\n\n/**\n * The development module cache shared across the runtime.\n * Browser runtime declares this directly.\n * Node.js runtime assigns globalThis.__turbopack_module_cache__ to this.\n */\nlet devModuleCache: Record\n\n/**\n * Module IDs that are instantiated as part of the runtime of a chunk.\n */\nlet runtimeModules: Set\n\n/**\n * Maps module IDs to persisted data between executions of their hot module\n * implementation (`hot.data`).\n */\nconst moduleHotData: Map = new Map()\n\n/**\n * Maps module instances to their hot module state.\n * Uses WeakMap so it works with both HotModule and ModuleWithDirection.\n */\nconst moduleHotState: WeakMap = new WeakMap()\n\n/**\n * Modules that call `module.hot.invalidate()` (while being updated).\n */\nconst queuedInvalidatedModules: Set = new Set()\n\nclass UpdateApplyError extends Error {\n name = 'UpdateApplyError'\n\n dependencyChain: ModuleId[]\n\n constructor(message: string, dependencyChain: ModuleId[]) {\n super(message)\n this.dependencyChain = dependencyChain\n }\n}\n\ntype ModuleEffect =\n | {\n type: 'unaccepted'\n dependencyChain: ModuleId[]\n }\n | {\n type: 'self-declined'\n dependencyChain: ModuleId[]\n moduleId: ModuleId\n }\n | {\n type: 'declined'\n dependencyChain: ModuleId[]\n moduleId: ModuleId\n parentId: ModuleId\n }\n | {\n type: 'accepted'\n moduleId: ModuleId\n outdatedModules: Set\n outdatedDependencies: Map