-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathssr.mjs.map
More file actions
1 lines (1 loc) · 178 KB
/
Copy pathssr.mjs.map
File metadata and controls
1 lines (1 loc) · 178 KB
1
{"version":3,"file":"ssr.mjs","sources":["../../../../../../k8-fastbuild-ST-fdfa778d11ba/bin/packages/angular/ssr/src/assets.ts","../../../../../../k8-fastbuild-ST-fdfa778d11ba/bin/packages/angular/ssr/src/console.ts","../../../../../../k8-fastbuild-ST-fdfa778d11ba/bin/packages/angular/ssr/src/manifest.ts","../../../../../../k8-fastbuild-ST-fdfa778d11ba/bin/packages/angular/ssr/src/utils/url.ts","../../../../../../k8-fastbuild-ST-fdfa778d11ba/bin/packages/angular/ssr/src/utils/ng.ts","../../../../../../k8-fastbuild-ST-fdfa778d11ba/bin/packages/angular/ssr/src/utils/promise.ts","../../../../../../k8-fastbuild-ST-fdfa778d11ba/bin/packages/angular/ssr/src/utils/redirect.ts","../../../../../../k8-fastbuild-ST-fdfa778d11ba/bin/packages/angular/ssr/src/routes/route-config.ts","../../../../../../k8-fastbuild-ST-fdfa778d11ba/bin/packages/angular/ssr/src/routes/route-tree.ts","../../../../../../k8-fastbuild-ST-fdfa778d11ba/bin/packages/angular/ssr/src/routes/ng-routes.ts","../../../../../../k8-fastbuild-ST-fdfa778d11ba/bin/packages/angular/ssr/src/hooks.ts","../../../../../../k8-fastbuild-ST-fdfa778d11ba/bin/packages/angular/ssr/src/routes/router.ts","../../../../../../k8-fastbuild-ST-fdfa778d11ba/bin/packages/angular/ssr/src/app.ts","../../../../../../k8-fastbuild-ST-fdfa778d11ba/bin/packages/angular/ssr/src/i18n.ts","../../../../../../k8-fastbuild-ST-fdfa778d11ba/bin/packages/angular/ssr/src/app-engine.ts","../../../../../../k8-fastbuild-ST-fdfa778d11ba/bin/packages/angular/ssr/src/handler.ts"],"sourcesContent":["/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n\nimport { AngularAppManifest, ServerAsset } from './manifest';\n\n/**\n * Manages server-side assets.\n */\nexport class ServerAssets {\n /**\n * Creates an instance of ServerAsset.\n *\n * @param manifest - The manifest containing the server assets.\n */\n constructor(private readonly manifest: AngularAppManifest) {}\n\n /**\n * Retrieves the content of a server-side asset using its path.\n *\n * @param path - The path to the server asset within the manifest.\n * @returns The server asset associated with the provided path, as a `ServerAsset` object.\n * @throws Error - Throws an error if the asset does not exist.\n */\n getServerAsset(path: string): ServerAsset {\n const asset = this.manifest.assets[path];\n if (!asset) {\n throw new Error(`Server asset '${path}' does not exist.`);\n }\n\n return asset;\n }\n\n /**\n * Checks if a specific server-side asset exists.\n *\n * @param path - The path to the server asset.\n * @returns A boolean indicating whether the asset exists.\n */\n hasServerAsset(path: string): boolean {\n return !!this.manifest.assets[path];\n }\n\n /**\n * Retrieves the asset for 'index.server.html'.\n *\n * @returns The `ServerAsset` object for 'index.server.html'.\n * @throws Error - Throws an error if 'index.server.html' does not exist.\n */\n getIndexServerHtml(): ServerAsset {\n return this.getServerAsset('index.server.html');\n }\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n\nimport { ɵConsole } from '@angular/core';\n\n/**\n * A set of log messages that should be ignored and not printed to the console.\n */\nconst IGNORED_LOGS = new Set(['Angular is running in development mode.']);\n\n/**\n * Custom implementation of the Angular Console service that filters out specific log messages.\n *\n * This class extends the internal Angular `ɵConsole` class to provide customized logging behavior.\n * It overrides the `log` method to suppress logs that match certain predefined messages.\n */\nexport class Console extends ɵConsole {\n /**\n * Logs a message to the console if it is not in the set of ignored messages.\n *\n * @param message - The message to log to the console.\n *\n * This method overrides the `log` method of the `ɵConsole` class. It checks if the\n * message is in the `IGNORED_LOGS` set. If it is not, it delegates the logging to\n * the parent class's `log` method. Otherwise, the message is suppressed.\n */\n override log(message: string): void {\n if (!IGNORED_LOGS.has(message)) {\n super.log(message);\n }\n }\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n\nimport type { CompactPlan } from 'beasties/runtime';\nimport type { SerializableRouteTreeNode } from './routes/route-tree';\nimport { AngularBootstrap } from './utils/ng';\n\n/**\n * Represents a server asset stored in the manifest.\n */\nexport interface ServerAsset {\n /**\n * Retrieves the text content of the asset.\n *\n * @returns A promise that resolves to the asset's content as a string.\n */\n text: () => Promise<string>;\n\n /**\n * A hash string representing the asset's content.\n */\n hash: string;\n\n /**\n * The size of the asset's content in bytes.\n */\n size: number;\n}\n\n/**\n * Represents the exports of an Angular server application entry point.\n */\nexport interface EntryPointExports {\n /**\n * A reference to the function that creates an Angular server application instance.\n *\n * @remarks The return type is `unknown` to prevent circular dependency issues.\n */\n ɵgetOrCreateAngularServerApp: () => unknown;\n\n /**\n * A reference to the function that destroys the `AngularServerApp` instance.\n */\n ɵdestroyAngularServerApp: () => void;\n}\n\n/**\n * Manifest for the Angular server application engine, defining entry points.\n */\nexport interface AngularAppEngineManifest {\n /**\n * A readonly record of entry points for the server application.\n * Each entry consists of:\n * - `key`: The url segment for the entry point.\n * - `value`: A function that returns a promise resolving to an object of type `EntryPointExports`.\n */\n readonly entryPoints: Readonly<Record<string, (() => Promise<EntryPointExports>) | undefined>>;\n\n /**\n * The base path for the server application.\n * This is used to determine the root path of the application.\n */\n readonly basePath: string;\n\n /**\n * A readonly record mapping supported locales to their respective entry-point paths.\n * Each entry consists of:\n * - `key`: The locale identifier (e.g., 'en', 'fr').\n * - `value`: The url segment associated with that locale.\n */\n readonly supportedLocales: Readonly<Record<string, string>>;\n\n /**\n * A readonly array of allowed hostnames.\n */\n readonly allowedHosts: Readonly<string[]>;\n}\n\n/**\n * Manifest for a specific Angular server application, defining assets and bootstrap logic.\n */\nexport interface AngularAppManifest {\n /**\n * The base href for the application.\n * This is used to determine the root path of the application.\n */\n readonly baseHref: string;\n\n /**\n * A readonly record of assets required by the server application.\n * Each entry consists of:\n * - `key`: The path of the asset.\n * - `value`: An object of type `ServerAsset`.\n */\n readonly assets: Readonly<Record<string, ServerAsset | undefined>>;\n\n /**\n * The bootstrap mechanism for the server application.\n * A function that returns a promise that resolves to an `NgModule` or a function\n * returning a promise that resolves to an `ApplicationRef`.\n */\n readonly bootstrap: () => Promise<AngularBootstrap>;\n\n /**\n * Pre-compiled critical CSS plans generated at build time.\n */\n readonly criticalCssPlans?: readonly CompactPlan[];\n\n /**\n * Content Security Policy (CSP) nonce to be used for inlined critical CSS.\n */\n readonly nonce?: string;\n\n /**\n * The route tree representation for the routing configuration of the application.\n * This represents the routing information of the application, mapping route paths to their corresponding metadata.\n * It is used for route matching and navigation within the server application.\n */\n readonly routes?: SerializableRouteTreeNode;\n\n /**\n * An optional string representing the locale or language code to be used for\n * the application, aiding with localization and rendering content specific to the locale.\n */\n readonly locale?: string;\n\n /**\n * Maps entry-point names to their corresponding browser bundles and loading strategies.\n *\n * - **Key**: The entry-point name, typically the value of `ɵentryName`.\n * - **Value**: A readonly array of JavaScript bundle paths or `undefined` if no bundles are associated.\n *\n * ### Example\n * ```ts\n * {\n * 'src/app/lazy/lazy.ts': ['src/app/lazy/lazy.js']\n * }\n * ```\n */\n readonly entryPointToBrowserMapping?: Readonly<Record<string, readonly string[] | undefined>>;\n}\n\n/**\n * The Angular app manifest object.\n * This is used internally to store the current Angular app manifest.\n */\nlet angularAppManifest: AngularAppManifest | undefined;\n\n/**\n * Sets the Angular app manifest.\n *\n * @param manifest - The manifest object to set for the Angular application.\n */\nexport function setAngularAppManifest(manifest: AngularAppManifest): void {\n angularAppManifest = manifest;\n}\n\n/**\n * Gets the Angular app manifest.\n *\n * @returns The Angular app manifest.\n * @throws Will throw an error if the Angular app manifest is not set.\n */\nexport function getAngularAppManifest(): AngularAppManifest {\n if (!angularAppManifest) {\n throw new Error(\n 'Angular app manifest is not set. ' +\n `Please ensure you are using the '@angular/build:application' builder to build your server application.`,\n );\n }\n\n return angularAppManifest;\n}\n\n/**\n * The Angular app engine manifest object.\n * This is used internally to store the current Angular app engine manifest.\n */\nlet angularAppEngineManifest: AngularAppEngineManifest | undefined;\n\n/**\n * Sets the Angular app engine manifest.\n *\n * @param manifest - The engine manifest object to set.\n */\nexport function setAngularAppEngineManifest(manifest: AngularAppEngineManifest): void {\n angularAppEngineManifest = manifest;\n}\n\n/**\n * Gets the Angular app engine manifest.\n *\n * @returns The Angular app engine manifest.\n * @throws Will throw an error if the Angular app engine manifest is not set.\n */\nexport function getAngularAppEngineManifest(): AngularAppEngineManifest {\n if (!angularAppEngineManifest) {\n throw new Error(\n 'Angular app engine manifest is not set. ' +\n `Please ensure you are using the '@angular/build:application' builder to build your server application.`,\n );\n }\n\n return angularAppEngineManifest;\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n\n/**\n * Removes the trailing slash from a URL if it exists.\n *\n * @param url - The URL string from which to remove the trailing slash.\n * @returns The URL string without a trailing slash.\n *\n * @example\n * ```js\n * stripTrailingSlash('path/'); // 'path'\n * stripTrailingSlash('/path'); // '/path'\n * stripTrailingSlash('/'); // '/'\n * stripTrailingSlash(''); // ''\n * ```\n */\nexport function stripTrailingSlash(url: string): string {\n // Check if the last character of the URL is a slash\n return url.length > 1 && url.at(-1) === '/' ? url.slice(0, -1) : url;\n}\n\n/**\n * Removes the leading slash from a URL if it exists.\n *\n * @param url - The URL string from which to remove the leading slash.\n * @returns The URL string without a leading slash.\n *\n * @example\n * ```js\n * stripLeadingSlash('/path'); // 'path'\n * stripLeadingSlash('/path/'); // 'path/'\n * stripLeadingSlash('/'); // '/'\n * stripLeadingSlash(''); // ''\n * ```\n */\nexport function stripLeadingSlash(url: string): string {\n // Check if the first character of the URL is a slash\n return url.length > 1 && url[0] === '/' ? url.slice(1) : url;\n}\n\n/**\n * Adds a leading slash to a URL if it does not already have one.\n *\n * @param url - The URL string to which the leading slash will be added.\n * @returns The URL string with a leading slash.\n *\n * @example\n * ```js\n * addLeadingSlash('path'); // '/path'\n * addLeadingSlash('/path'); // '/path'\n * ```\n */\nexport function addLeadingSlash(url: string): string {\n // Check if the URL already starts with a slash\n return url[0] === '/' ? url : `/${url}`;\n}\n\n/**\n * Adds a trailing slash to a URL if it does not already have one.\n *\n * @param url - The URL string to which the trailing slash will be added.\n * @returns The URL string with a trailing slash.\n *\n * @example\n * ```js\n * addTrailingSlash('path'); // 'path/'\n * addTrailingSlash('path/'); // 'path/'\n * ```\n */\nexport function addTrailingSlash(url: string): string {\n // Check if the URL already end with a slash\n return url.at(-1) === '/' ? url : `${url}/`;\n}\n\n/**\n * Joins URL parts into a single URL string.\n *\n * This function takes multiple URL segments, normalizes them by removing leading\n * and trailing slashes where appropriate, and then joins them into a single URL.\n *\n * @param parts - The parts of the URL to join. Each part can be a string with or without slashes.\n * @returns The joined URL string, with normalized slashes.\n *\n * @example\n * ```js\n * joinUrlParts('path/', '/to/resource'); // '/path/to/resource'\n * joinUrlParts('/path/', 'to/resource'); // '/path/to/resource'\n * joinUrlParts('', ''); // '/'\n * ```\n */\nexport function joinUrlParts(...parts: string[]): string {\n const normalizedParts: string[] = [];\n\n for (const part of parts) {\n if (part === '') {\n // Skip any empty parts\n continue;\n }\n\n let start = 0;\n let end = part.length;\n\n // Use \"Pointers\" to avoid intermediate slices\n while (start < end && part[start] === '/') {\n start++;\n }\n\n while (end > start && part[end - 1] === '/') {\n end--;\n }\n\n if (start < end) {\n normalizedParts.push(part.slice(start, end));\n }\n }\n\n return addLeadingSlash(normalizedParts.join('/'));\n}\n\n/**\n * Strips `/index.html` from the end of a URL's path, if present.\n *\n * This function is used to convert URLs pointing to an `index.html` file into their directory\n * equivalents. For example, it transforms a URL like `http://www.example.com/page/index.html`\n * into `http://www.example.com/page`.\n *\n * @param url - The URL object to process.\n * @returns A new URL object with `/index.html` removed from the path, if it was present.\n *\n * @example\n * ```typescript\n * const originalUrl = new URL('http://www.example.com/page/index.html');\n * const cleanedUrl = stripIndexHtmlFromURL(originalUrl);\n * console.log(cleanedUrl.href); // Output: 'http://www.example.com/page'\n * ```\n */\nexport function stripIndexHtmlFromURL(url: URL): URL {\n if (url.pathname.endsWith('/index.html')) {\n const modifiedURL = new URL(url);\n // Remove '/index.html' from the pathname\n modifiedURL.pathname = modifiedURL.pathname.slice(0, /** '/index.html'.length */ -11);\n\n return modifiedURL;\n }\n\n return url;\n}\n\n/**\n * Resolves `*` placeholders in a path template by mapping them to corresponding segments\n * from a base path. This is useful for constructing paths dynamically based on a given base path.\n *\n * The function processes the `toPath` string, replacing each `*` placeholder with\n * the corresponding segment from the `fromPath`. If the `toPath` contains no placeholders,\n * it is returned as-is. Invalid `toPath` formats (not starting with `/`) will throw an error.\n *\n * @param toPath - A path template string that may contain `*` placeholders. Each `*` is replaced\n * by the corresponding segment from the `fromPath`. Static paths (e.g., `/static/path`) are returned\n * directly without placeholder replacement.\n * @param fromPath - A base path string, split into segments, that provides values for\n * replacing `*` placeholders in the `toPath`.\n * @returns A resolved path string with `*` placeholders replaced by segments from the `fromPath`,\n * or the `toPath` returned unchanged if it contains no placeholders.\n *\n * @throws If the `toPath` does not start with a `/`, indicating an invalid path format.\n *\n * @example\n * ```typescript\n * // Example with placeholders resolved\n * const resolvedPath = buildPathWithParams('/*\\/details', '/123/abc');\n * console.log(resolvedPath); // Outputs: '/123/details'\n *\n * // Example with a static path\n * const staticPath = buildPathWithParams('/static/path', '/base/unused');\n * console.log(staticPath); // Outputs: '/static/path'\n * ```\n */\nexport function buildPathWithParams(toPath: string, fromPath: string): string {\n if (toPath[0] !== '/') {\n throw new Error(`Invalid toPath: The string must start with a '/'. Received: '${toPath}'`);\n }\n\n if (fromPath[0] !== '/') {\n throw new Error(`Invalid fromPath: The string must start with a '/'. Received: '${fromPath}'`);\n }\n\n if (!toPath.includes('/*')) {\n return toPath;\n }\n\n const fromPathParts = fromPath.split('/');\n const toPathParts = toPath.split('/');\n const resolvedParts = toPathParts.map((part, index) =>\n toPathParts[index] === '*' ? fromPathParts[index] : part,\n );\n\n return joinUrlParts(...resolvedParts);\n}\n\nconst MATRIX_PARAMS_REGEX = /;[^/]+/g;\n\n/**\n * Removes Angular matrix parameters from a given URL path.\n *\n * This function takes a URL path string and removes any matrix parameters.\n * Matrix parameters are parts of a URL segment that start with a semicolon `;`.\n *\n * @param pathname - The URL path to remove matrix parameters from.\n * @returns The URL path with matrix parameters removed.\n *\n * @example\n * ```ts\n * stripMatrixParams('/path;param=value'); // returns '/path'\n * stripMatrixParams('/path;param=value/to;p=1/resource'); // returns '/path/to/resource'\n * stripMatrixParams('/path/to/resource'); // returns '/path/to/resource'\n * ```\n */\nexport function stripMatrixParams(pathname: string): string {\n // Use a regular expression to remove matrix parameters.\n // This regex finds all occurrences of a semicolon followed by any characters\n return pathname.includes(';') ? pathname.replace(MATRIX_PARAMS_REGEX, '') : pathname;\n}\n\n/**\n * Constructs a decoded URL string from its components.\n *\n * This function joins the pathname (with trailing slash removed), search, and hash,\n * and then decodes the result.\n *\n * @param pathname - The path of the URL.\n * @param search - The query string of the URL (including '?').\n * @param hash - The hash fragment of the URL (including '#').\n * @returns The constructed and decoded URL string.\n */\nexport function constructUrl(pathname: string, search: string, hash: string): string {\n return decodeURIComponent([stripTrailingSlash(pathname), search, hash].join(''));\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n\nimport { APP_BASE_HREF, PlatformLocation } from '@angular/common';\nimport {\n ApplicationRef,\n type PlatformRef,\n REQUEST,\n type StaticProvider,\n type Type,\n ɵConsole,\n} from '@angular/core';\nimport { BootstrapContext } from '@angular/platform-browser';\nimport {\n INITIAL_CONFIG,\n ɵSERVER_CONTEXT as SERVER_CONTEXT,\n platformServer,\n ɵrenderInternal as renderInternal,\n} from '@angular/platform-server';\nimport { ActivatedRoute, Router } from '@angular/router';\nimport { Console } from '../console';\nimport { addTrailingSlash, joinUrlParts, stripIndexHtmlFromURL, stripTrailingSlash } from './url';\n\n/**\n * Represents the bootstrap mechanism for an Angular application.\n *\n * This type can either be:\n * - A reference to an Angular component or module (`Type<unknown>`) that serves as the root of the application.\n * - A function that returns a `Promise<ApplicationRef>`, which resolves with the root application reference.\n */\nexport type AngularBootstrap =\n Type<unknown> | ((context: BootstrapContext) => Promise<ApplicationRef>);\n\n/**\n * Renders an Angular application or module to an HTML string.\n *\n * This function supports both Angular modules and bootstrap functions for application initialization.\n *\n * @param html - The initial HTML document content.\n * @param bootstrap - An Angular module type or a function returning a promise that resolves to an `ApplicationRef`.\n * @param url - The application URL, used for route-based rendering in SSR.\n * @param platformProviders - An array of platform providers for the rendering process.\n * @param serverContext - A string representing the server context, providing additional metadata for SSR.\n * @returns A promise resolving to an object containing:\n * - `hasNavigationError`: Indicates if a navigation error occurred.\n * - `redirectTo`: (Optional) The redirect URL if a navigation redirect occurred.\n * - `content`: A function returning a promise that resolves to the rendered HTML string.\n */\nexport async function renderAngular(\n html: string,\n bootstrap: AngularBootstrap,\n url: URL,\n platformProviders: StaticProvider[],\n serverContext: string,\n): Promise<\n | { hasNavigationError: true }\n | {\n hasNavigationError: boolean;\n redirectTo?: string;\n content: () => Promise<string>;\n destroy: () => void;\n }\n> {\n // A request to `http://www.example.com/page/index.html` will render the Angular route corresponding to `http://www.example.com/page`.\n const urlToRender = stripIndexHtmlFromURL(url);\n const platformRef = platformServer([\n {\n provide: INITIAL_CONFIG,\n useValue: {\n url: urlToRender.href,\n document: html,\n },\n },\n {\n provide: SERVER_CONTEXT,\n useValue: serverContext,\n },\n {\n // An Angular Console Provider that does not print a set of predefined logs.\n provide: ɵConsole,\n // Using `useClass` would necessitate decorating `Console` with `@Injectable`,\n // which would require switching from `ts_library` to `ng_module`. This change\n // would also necessitate various patches of `@angular/bazel` to support ESM.\n useFactory: () => new Console(),\n },\n ...platformProviders,\n ]);\n\n let redirectTo: string | undefined;\n let hasNavigationError = true;\n\n try {\n let applicationRef: ApplicationRef;\n if (isNgModule(bootstrap)) {\n const moduleRef = await platformRef.bootstrapModule(bootstrap);\n applicationRef = moduleRef.injector.get(ApplicationRef);\n } else {\n applicationRef = await bootstrap({ platformRef });\n }\n\n // Block until application is stable.\n await applicationRef.whenStable();\n\n // This code protect against app destruction during bootstrapping which is a\n // valid case. We should not assume the `applicationRef` is not in destroyed state.\n // Calling `envInjector.get` would throw `NG0205: Injector has already been destroyed`.\n if (applicationRef.destroyed) {\n return { hasNavigationError: true };\n }\n\n // TODO(alanagius): Find a way to avoid rendering here especially for redirects as any output will be discarded.\n const envInjector = applicationRef.injector;\n const routerIsProvided = !!envInjector.get(ActivatedRoute, null);\n const router = envInjector.get(Router);\n const lastSuccessfulNavigation = router.lastSuccessfulNavigation();\n\n if (!routerIsProvided) {\n hasNavigationError = false;\n } else if (lastSuccessfulNavigation?.finalUrl) {\n hasNavigationError = false;\n\n const requestPrefix =\n envInjector.get(APP_BASE_HREF, null, { optional: true }) ??\n envInjector.get(REQUEST, null, { optional: true })?.headers.get('X-Forwarded-Prefix');\n\n const { pathname, search, hash } = envInjector.get(PlatformLocation);\n const finalUrl = constructSerializedUrl(router, { pathname, search, hash }, requestPrefix);\n const urlToRenderString = constructSerializedUrl(router, urlToRender, requestPrefix);\n\n if (urlToRenderString !== finalUrl) {\n redirectTo = [pathname, search, hash].join('');\n }\n }\n\n return {\n destroy: () => void asyncDestroyPlatform(platformRef),\n hasNavigationError,\n redirectTo,\n content: () =>\n new Promise<string>((resolve, reject) => {\n // Defer rendering to the next event loop iteration to avoid blocking, as most operations in `renderInternal` are synchronous.\n setTimeout(() => {\n renderInternal(platformRef, applicationRef)\n .then(resolve)\n .catch(reject)\n .finally(() => void asyncDestroyPlatform(platformRef));\n }, 0);\n }),\n };\n } catch (error) {\n await asyncDestroyPlatform(platformRef);\n\n throw error;\n } finally {\n if (hasNavigationError || redirectTo) {\n void asyncDestroyPlatform(platformRef);\n }\n }\n}\n\n/**\n * Type guard to determine if a given value is an Angular module.\n * Angular modules are identified by the presence of the `ɵmod` static property.\n * This function helps distinguish between Angular modules and bootstrap functions.\n *\n * @param value - The value to be checked.\n * @returns True if the value is an Angular module (i.e., it has the `ɵmod` property), false otherwise.\n */\nexport function isNgModule(value: AngularBootstrap): value is Type<unknown> {\n return 'ɵmod' in value;\n}\n\n/**\n * Gracefully destroys the application in a macrotask, allowing pending promises to resolve\n * and surfacing any potential errors to the user.\n *\n * @param platformRef - The platform reference to be destroyed.\n */\nfunction asyncDestroyPlatform(platformRef: PlatformRef): Promise<void> {\n if (platformRef.destroyed) {\n return Promise.resolve();\n }\n\n return new Promise((resolve) => {\n setTimeout(() => {\n if (!platformRef.destroyed) {\n platformRef.destroy();\n }\n\n resolve();\n }, 0);\n });\n}\n\n/**\n * Constructs a normalized and serialized URL string from its components.\n *\n * This function uses the provided `Router` instance to parse and serialize the URL,\n * ensuring that the resulting string is consistent with the router's configuration.\n * It also handles the optional `prefix` parameter to ensure proper URL construction.\n *\n * @param router - The `Router` instance to use for parsing and serializing the URL.\n * @param url - An object containing the URL components:\n * - `pathname`: The path of the URL.\n * - `search`: The query string of the URL (including '?').\n * - `hash`: The hash fragment of the URL (including '#').\n * @param prefix - An optional prefix (e.g., `APP_BASE_HREF`) to prepend to the pathname\n * if it is not already present.\n * @returns The normalized and serialized URL string.\n *\n * @note\n * We use the Angular `Router` to construct the URL, so that the URL is consistent with the router's configuration.\n * This is important for the URL to be correctly parsed and serialized by the router as it might have different encodings.\n */\nfunction constructSerializedUrl(\n router: Router,\n url: { pathname: string; search: string; hash: string },\n prefix?: string | null,\n): string {\n const { pathname, hash, search } = url;\n const urlParts: string[] = [];\n if (prefix && !addTrailingSlash(pathname).startsWith(addTrailingSlash(prefix))) {\n urlParts.push(joinUrlParts(prefix, pathname));\n } else {\n urlParts.push(stripTrailingSlash(pathname));\n }\n\n urlParts.push(search, hash);\n\n const urlTree = router.parseUrl(urlParts.join(''));\n\n return router.serializeUrl(urlTree);\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n\n/**\n * Creates a promise that resolves with the result of the provided `promise` or rejects with an\n * `AbortError` if the `AbortSignal` is triggered before the promise resolves.\n *\n * @param promise - The promise to monitor for completion.\n * @param signal - An `AbortSignal` used to monitor for an abort event. If the signal is aborted,\n * the returned promise will reject.\n * @param errorMessagePrefix - A custom message prefix to include in the error message when the operation is aborted.\n * @returns A promise that either resolves with the value of the provided `promise` or rejects with\n * an `AbortError` if the `AbortSignal` is triggered.\n *\n * @throws {AbortError} If the `AbortSignal` is triggered before the `promise` resolves.\n */\nexport function promiseWithAbort<T>(\n promise: Promise<T>,\n signal: AbortSignal,\n errorMessagePrefix: string,\n): Promise<T> {\n return new Promise<T>((resolve, reject) => {\n const abortHandler = () => {\n reject(\n new DOMException(`${errorMessagePrefix} was aborted.\\n${signal.reason}`, 'AbortError'),\n );\n };\n\n // Check for abort signal\n if (signal.aborted) {\n abortHandler();\n\n return;\n }\n\n signal.addEventListener('abort', abortHandler, { once: true });\n\n promise\n .then(resolve)\n .catch(reject)\n .finally(() => {\n signal.removeEventListener('abort', abortHandler);\n });\n });\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n\n/**\n * An set of HTTP status codes that are considered valid for redirect responses.\n */\nexport const VALID_REDIRECT_RESPONSE_CODES: ReadonlySet<number> = new Set([\n 301, 302, 303, 307, 308,\n]);\n\n/**\n * Checks if the given HTTP status code is a valid redirect response code.\n *\n * @param code The HTTP status code to check.\n * @returns `true` if the code is a valid redirect response code, `false` otherwise.\n */\nexport function isValidRedirectResponseCode(code: number): boolean {\n return VALID_REDIRECT_RESPONSE_CODES.has(code);\n}\n\n/**\n * Creates an HTTP redirect response with a specified location and status code.\n *\n * @param location - The URL to which the response should redirect.\n * @param status - The HTTP status code for the redirection. Defaults to 302 (Found).\n * See: https://developer.mozilla.org/en-US/docs/Web/API/Response/redirect_static#status\n * @param headers - Additional headers to include in the response.\n * @returns A `Response` object representing the HTTP redirect.\n */\nexport function createRedirectResponse(\n location: string,\n status = 302,\n headers?: Record<string, string> | Headers,\n): Response {\n if (ngDevMode && !isValidRedirectResponseCode(status)) {\n throw new Error(\n `Invalid redirect status code: ${status}. ` +\n `Please use one of the following redirect response codes: ${[...VALID_REDIRECT_RESPONSE_CODES.values()].join(', ')}.`,\n );\n }\n\n const resHeaders = headers instanceof Headers ? headers : new Headers(headers);\n if (ngDevMode && resHeaders.has('location')) {\n // eslint-disable-next-line no-console\n console.warn(\n `Location header \"${resHeaders.get('location')}\" will be ignored and set to \"${location}\".`,\n );\n }\n\n // Ensure unique values for Vary header\n const varyArray = resHeaders.get('Vary')?.split(',') ?? [];\n const varySet = new Set(['X-Forwarded-Prefix']);\n for (const vary of varyArray) {\n const value = vary.trim();\n\n if (value) {\n varySet.add(value);\n }\n }\n\n resHeaders.set('Vary', [...varySet].join(', '));\n resHeaders.set('Location', location);\n\n return new Response(null, {\n status,\n headers: resHeaders,\n });\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n\nimport {\n EnvironmentProviders,\n InjectionToken,\n Provider,\n Type,\n inject,\n makeEnvironmentProviders,\n provideEnvironmentInitializer,\n} from '@angular/core';\nimport { provideServerRendering as provideServerRenderingPlatformServer } from '@angular/platform-server';\nimport { type DefaultExport, ROUTES, type Route } from '@angular/router';\n\n/**\n * The internal path used for the app shell route.\n * @internal\n */\nconst APP_SHELL_ROUTE = 'ng-app-shell';\n\n/**\n * Identifies a particular kind of `ServerRenderingFeatureKind`.\n * @see {@link ServerRenderingFeature}\n */\nenum ServerRenderingFeatureKind {\n AppShell,\n ServerRoutes,\n}\n\n/**\n * Helper type to represent a server routes feature.\n * @see {@link ServerRenderingFeatureKind}\n */\ninterface ServerRenderingFeature<FeatureKind extends ServerRenderingFeatureKind> {\n ɵkind: FeatureKind;\n ɵproviders: (Provider | EnvironmentProviders)[];\n}\n\n/**\n * Different rendering modes for server routes.\n * @see {@link withRoutes}\n * @see {@link ServerRoute}\n */\nexport enum RenderMode {\n /** Server-Side Rendering (SSR) mode, where content is rendered on the server for each request. */\n Server,\n\n /** Client-Side Rendering (CSR) mode, where content is rendered on the client side in the browser. */\n Client,\n\n /** Static Site Generation (SSG) mode, where content is pre-rendered at build time and served as static files. */\n Prerender,\n}\n\n/**\n * Defines the fallback strategies for Static Site Generation (SSG) routes when a pre-rendered path is not available.\n * This is particularly relevant for routes with parameterized URLs where some paths might not be pre-rendered at build time.\n * @see {@link ServerRoutePrerenderWithParams}\n */\nexport enum PrerenderFallback {\n /**\n * Fallback to Server-Side Rendering (SSR) if the pre-rendered path is not available.\n * This strategy dynamically generates the page on the server at request time.\n */\n Server,\n\n /**\n * Fallback to Client-Side Rendering (CSR) if the pre-rendered path is not available.\n * This strategy allows the page to be rendered on the client side.\n */\n Client,\n\n /**\n * No fallback; if the path is not pre-rendered, the server will not handle the request.\n * This means the application will not provide any response for paths that are not pre-rendered.\n */\n None,\n}\n\n/**\n * Common interface for server routes, providing shared properties.\n */\nexport interface ServerRouteCommon {\n /** The path associated with this route. */\n path: string;\n\n /** Optional additional headers to include in the response for this route. */\n headers?: Record<string, string>;\n\n /** Optional status code to return for this route. */\n status?: number;\n}\n\n/**\n * A server route that uses Client-Side Rendering (CSR) mode.\n * @see {@link RenderMode}\n */\nexport interface ServerRouteClient extends ServerRouteCommon {\n /** Specifies that the route uses Client-Side Rendering (CSR) mode. */\n renderMode: RenderMode.Client;\n}\n\n/**\n * A server route that uses Static Site Generation (SSG) mode.\n * @see {@link RenderMode}\n */\nexport interface ServerRoutePrerender extends Omit<ServerRouteCommon, 'status'> {\n /** Specifies that the route uses Static Site Generation (SSG) mode. */\n renderMode: RenderMode.Prerender;\n\n /** Fallback cannot be specified unless `getPrerenderParams` is used. */\n fallback?: never;\n}\n\n/**\n * A server route configuration that uses Static Site Generation (SSG) mode, including support for routes with parameters.\n * @see {@link RenderMode}\n * @see {@link ServerRoutePrerender}\n * @see {@link PrerenderFallback}\n */\nexport interface ServerRoutePrerenderWithParams extends Omit<ServerRoutePrerender, 'fallback'> {\n /**\n * Optional strategy to use if the SSG path is not pre-rendered.\n * This is especially relevant for routes with parameterized URLs, where some paths may not be pre-rendered at build time.\n *\n * This property determines how to handle requests for paths that are not pre-rendered:\n * - `PrerenderFallback.Server`: Use Server-Side Rendering (SSR) to dynamically generate the page at request time.\n * - `PrerenderFallback.Client`: Use Client-Side Rendering (CSR) to fetch and render the page on the client side.\n * - `PrerenderFallback.None`: No fallback; if the path is not pre-rendered, the server will not handle the request.\n *\n * @default `PrerenderFallback.Server` if not provided.\n */\n fallback?: PrerenderFallback;\n\n /**\n * A function that returns a Promise resolving to an array of objects, each representing a route path with URL parameters.\n * This function runs in the injector context, allowing access to Angular services and dependencies.\n *\n * It also works for catch-all routes (e.g., `/**`), where the parameter name will be `**` and the return value will be\n * the segments of the path, such as `/foo/bar`. These routes can also be combined, e.g., `/product/:id/**`,\n * where both a parameterized segment (`:id`) and a catch-all segment (`**`) can be used together to handle more complex paths.\n *\n * @returns A Promise resolving to an array where each element is an object with string keys (representing URL parameter names)\n * and string values (representing the corresponding values for those parameters in the route path).\n *\n * @example\n * ```typescript\n * export const serverRouteConfig: ServerRoutes[] = [\n * {\n * path: '/product/:id',\n * renderMode: RenderMode.Prerender,\n * async getPrerenderParams() {\n * const productService = inject(ProductService);\n * const ids = await productService.getIds(); // Assuming this returns ['1', '2', '3']\n *\n * return ids.map(id => ({ id })); // Generates paths like: ['product/1', 'product/2', 'product/3']\n * },\n * },\n * {\n * path: '/product/:id/**',\n * renderMode: RenderMode.Prerender,\n * async getPrerenderParams() {\n * return [\n * { id: '1', '**': 'laptop/3' },\n * { id: '2', '**': 'laptop/4' }\n * ]; // Generates paths like: ['product/1/laptop/3', 'product/2/laptop/4']\n * },\n * },\n * ];\n * ```\n */\n getPrerenderParams: () => Promise<Record<string, string>[]>;\n}\n\n/**\n * A server route that uses Server-Side Rendering (SSR) mode.\n * @see {@link RenderMode}\n */\nexport interface ServerRouteServer extends ServerRouteCommon {\n /** Specifies that the route uses Server-Side Rendering (SSR) mode. */\n renderMode: RenderMode.Server;\n}\n\n/**\n * Server route configuration.\n * @see {@link withRoutes}\n */\nexport type ServerRoute =\n | ServerRouteClient\n | ServerRoutePrerender\n | ServerRoutePrerenderWithParams\n | ServerRouteServer;\n\n/**\n * Configuration value for server routes configuration.\n * @internal\n */\nexport interface ServerRoutesConfig {\n /**\n * Defines the route to be used as the app shell.\n */\n appShellRoute?: string;\n\n /** List of server routes for the application. */\n routes: ServerRoute[];\n}\n\n/**\n * Token for providing the server routes configuration.\n * @internal\n */\nexport const SERVER_ROUTES_CONFIG = new InjectionToken<ServerRoutesConfig>('SERVER_ROUTES_CONFIG');\n\n/**\n * Configures server-side routing for the application.\n *\n * This function registers an array of `ServerRoute` definitions, enabling server-side rendering\n * for specific URL paths. These routes are used to pre-render content on the server, improving\n * initial load performance and SEO.\n *\n * @param routes - An array of `ServerRoute` objects, each defining a server-rendered route.\n * @returns A `ServerRenderingFeature` object configuring server-side routes.\n *\n * @example\n * ```ts\n * import { provideServerRendering, withRoutes, ServerRoute, RenderMode } from '@angular/ssr';\n *\n * const serverRoutes: ServerRoute[] = [\n * {\n * path: '', // This renders the \"/\" route on the client (CSR)\n * renderMode: RenderMode.Client,\n * },\n * {\n * path: 'about', // This page is static, so we prerender it (SSG)\n * renderMode: RenderMode.Prerender,\n * },\n * {\n * path: 'profile', // This page requires user-specific data, so we use SSR\n * renderMode: RenderMode.Server,\n * },\n * {\n * path: '**', // All other routes will be rendered on the server (SSR)\n * renderMode: RenderMode.Server,\n * },\n * ];\n *\n * provideServerRendering(withRoutes(serverRoutes));\n * ```\n *\n * @see {@link provideServerRendering}\n * @see {@link ServerRoute}\n */\nexport function withRoutes(\n routes: ServerRoute[],\n): ServerRenderingFeature<ServerRenderingFeatureKind.ServerRoutes> {\n const config: ServerRoutesConfig = { routes };\n\n return {\n ɵkind: ServerRenderingFeatureKind.ServerRoutes,\n ɵproviders: [\n {\n provide: SERVER_ROUTES_CONFIG,\n useValue: config,\n },\n ],\n };\n}\n\n/**\n * Configures the shell of the application.\n *\n * The app shell is a minimal, static HTML page that is served immediately, while the\n * full Angular application loads in the background. This improves perceived performance\n * by providing instant feedback to the user.\n *\n * This function configures the app shell route, which serves the provided component for\n * requests that do not match any defined server routes.\n *\n * @param component - The Angular component to render for the app shell. Can be a direct\n * component type or a dynamic import function.\n * @returns A `ServerRenderingFeature` object configuring the app shell.\n *\n * @example\n * ```ts\n * import { provideServerRendering, withAppShell, withRoutes } from '@angular/ssr';\n * import { AppShellComponent } from './app-shell.component';\n *\n * provideServerRendering(\n * withRoutes(serverRoutes),\n * withAppShell(AppShellComponent)\n * );\n * ```\n *\n * @example\n * ```ts\n * import { provideServerRendering, withAppShell, withRoutes } from '@angular/ssr';\n *\n * provideServerRendering(\n * withRoutes(serverRoutes),\n * withAppShell(() =>\n * import('./app-shell.component').then((m) => m.AppShellComponent)\n * )\n * );\n * ```\n *\n * @see {@link provideServerRendering}\n * @see {@link https://angular.dev/ecosystem/service-workers/app-shell App shell pattern on Angular.dev}\n */\nexport function withAppShell(\n component: Type<unknown> | (() => Promise<Type<unknown> | DefaultExport<Type<unknown>>>),\n): ServerRenderingFeature<ServerRenderingFeatureKind.AppShell> {\n const routeConfig: Route = {\n path: APP_SHELL_ROUTE,\n };\n\n if ('ɵcmp' in component) {\n routeConfig.component = component as Type<unknown>;\n } else {\n routeConfig.loadComponent = component as () => Promise<Type<unknown>>;\n }\n\n return {\n ɵkind: ServerRenderingFeatureKind.AppShell,\n ɵproviders: [\n {\n provide: ROUTES,\n useValue: routeConfig,\n multi: true,\n },\n provideEnvironmentInitializer(() => {\n const config = inject(SERVER_ROUTES_CONFIG);\n config.appShellRoute = APP_SHELL_ROUTE;\n }),\n ],\n };\n}\n\n/**\n * Options for configuring server-side rendering.\n */\nexport interface ServerRenderingOptions {\n /**\n * The maximum allowed response body size when using the Fetch API.\n * @default 1MB\n */\n maxResponseBodySize: number;\n}\n\n/**\n * Configures server-side rendering for an Angular application.\n *\n * This function sets up the necessary providers for server-side rendering, including\n * support for server routes and app shell. It combines features configured using\n * `withRoutes` and `withAppShell` to provide a comprehensive server-side rendering setup.\n *\n * @param features - Optional features to configure additional server rendering behaviors.\n * @returns An `EnvironmentProviders` instance with the server-side rendering configuration.\n *\n * @example\n * Basic example of how you can enable server-side rendering in your application\n * when using the `bootstrapApplication` function:\n *\n * ```ts\n * import { bootstrapApplication, BootstrapContext } from '@angular/platform-browser';\n * import { provideServerRendering, withRoutes, withAppShell } from '@angular/ssr';\n * import { AppComponent } from './app/app.component';\n * import { SERVER_ROUTES } from './app/app.server.routes';\n * import { AppShellComponent } from './app/app-shell.component';\n *\n * const bootstrap = (context: BootstrapContext) =>\n * bootstrapApplication(AppComponent, {\n * providers: [\n * provideServerRendering(\n * withRoutes(SERVER_ROUTES),\n * withAppShell(AppShellComponent),\n * ),\n * ],\n * }, context);\n *\n * export default bootstrap;\n * ```\n * @see {@link withRoutes} configures server-side routing\n * @see {@link withAppShell} configures the application shell\n */\nexport function provideServerRendering(\n ...features: ServerRenderingFeature<ServerRenderingFeatureKind>[]\n): EnvironmentProviders;\n\n/**\n * Configures server-side rendering for an Angular application with additional options.\n *\n * This function sets up the necessary providers for server-side rendering, including\n * support for server routes and app shell. It combines features configured using\n * `withRoutes` and `withAppShell` to provide a comprehensive server-side rendering setup.\n *\n * @param options - Configuration options for server-side rendering.\n * @param features - Optional features to configure additional server rendering behaviors.\n * @returns An `EnvironmentProviders` instance with the server-side rendering configuration.\n *\n * @example\n * Basic example of how you can enable server-side rendering with options in your application\n * when using the `bootstrapApplication` function:\n *\n * ```ts\n * import { bootstrapApplication, BootstrapContext } from '@angular/platform-browser';\n * import { provideServerRendering, withRoutes, withAppShell } from '@angular/ssr';\n * import { AppComponent } from './app/app.component';\n * import { SERVER_ROUTES } from './app/app.server.routes';\n * import { AppShellComponent } from './app/app-shell.component';\n *\n * const bootstrap = (context: BootstrapContext) =>\n * bootstrapApplication(AppComponent, {\n * providers: [\n * provideServerRendering(\n * { maxResponseBodySize: 1024 * 1024 }, // 1MB limit\n * withRoutes(SERVER_ROUTES),\n * withAppShell(AppShellComponent),\n * ),\n * ],\n * }, context);\n *\n * export default bootstrap;\n * ```\n * @see {@link withRoutes} configures server-side routing\n * @see {@link withAppShell} configures the application shell\n */\nexport function provideServerRendering(\n options: ServerRenderingOptions,\n ...features: ServerRenderingFeature<ServerRenderingFeatureKind>[]\n): EnvironmentProviders;\nexport function provideServerRendering(\n ...args:\n | ServerRenderingFeature<ServerRenderingFeatureKind>[]\n | [ServerRenderingOptions, ...ServerRenderingFeature<ServerRenderingFeatureKind>[]]\n): EnvironmentProviders {\n let options: ServerRenderingOptions | undefined;\n let features: ServerRenderingFeature<ServerRenderingFeatureKind>[];\n if (hasOptions(args)) {\n const [first, ...rest] = args;\n options = first;\n features = rest;\n } else {\n features = args;\n }\n\n const providers: (Provider | EnvironmentProviders)[] = [\n provideServerRenderingPlatformServer(options),\n ];\n\n let hasAppShell = false;\n let hasServerRoutes = false;\n\n for (const { ɵkind, ɵproviders } of features) {\n hasAppShell ||= ɵkind === ServerRenderingFeatureKind.AppShell;\n hasServerRoutes ||= ɵkind === ServerRenderingFeatureKind.ServerRoutes;\n providers.push(...ɵproviders);\n }\n\n if (!hasServerRoutes && hasAppShell) {\n throw new Error(\n `Configuration error: found 'withAppShell()' without 'withRoutes()' in the same call to 'provideServerRendering()'.` +\n `The 'withAppShell()' function requires 'withRoutes()' to be used.`,\n );\n }\n\n return makeEnvironmentProviders(providers);\n}\n\n/**\n * Checks if the first element of args is a `ServerRenderingOptions` object.\n */\nfunction hasOptions(\n args:\n | ServerRenderingFeature<ServerRenderingFeatureKind>[]\n | [ServerRenderingOptions, ...ServerRenderingFeature<ServerRenderingFeatureKind>[]],\n): args is [ServerRenderingOptions, ...ServerRenderingFeature<ServerRenderingFeatureKind>[]] {\n const value = args[0];\n\n return !!value && typeof value === 'object' && !('ɵkind' in value);\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n\nimport { addLeadingSlash } from '../utils/url';\nimport { RenderMode } from './route-config';\n\n/**\n * Represents the serialized format of a route tree as an array of node metadata objects.\n * Each entry in the array corresponds to a specific node's metadata within the route tree.\n */\nexport type SerializableRouteTreeNode = ReadonlyArray<RouteTreeNodeMetadata>;\n\n/**\n * Represents metadata for a route tree node, excluding the 'route' path segment.\n */\nexport type RouteTreeNodeMetadataWithoutRoute = Omit<RouteTreeNodeMetadata, 'route'>;\n\n/**\n * Describes metadata associated with a node in the route tree.\n * This metadata includes information such as the route path and optional redirect instructions.\n */\nexport interface RouteTreeNodeMetadata {\n /**\n * Optional redirect path associated with this node.\n * This defines where to redirect if this route is matched.\n */\n redirectTo?: string;\n\n /**\n * The route path for this node.\n *\n * A \"route\" is a URL path or pattern that is used to navigate to different parts of a web application.\n * It is made up of one or more segments separated by slashes `/`. For instance, in the URL `/products/details/42`,\n * the full route is `/products/details/42`, with segments `products`, `details`, and `42`.\n *\n * Routes define how URLs map to views or components in an application. Each route segment contributes to\n * the overall path that determines which view or component is displayed.\n *\n * - **Static Routes**: These routes have fixed segments. For example, `/about` or `/contact`.\n * - **Parameterized Routes**: These include dynamic segments that act as placeholders, such as `/users/:id`,\n * where `:id` could be any user ID.\n *\n * In the context of `RouteTreeNodeMetadata`, the `route` property represents the complete path that this node\n * in the route tree corresponds to. This path is used to determine how a specific URL in the browser maps to the\n * structure and content of the application.\n */\n route: string;\n\n /**\n * Optional status code to return for this route.\n */\n status?: number;\n\n /**\n * Optional additional headers to include in the response for this route.\n */\n headers?: Record<string, string>;\n\n /**\n * Specifies the rendering mode used for this route.\n */\n renderMode: RenderMode;\n\n /**\n * A list of resource that should be preloaded by the browser.\n */\n preload?: readonly string[];\n}\n\n/**\n * Represents a node within the route tree structure.\n * Each node corresponds to a route segment and may have associated metadata and child nodes.\n * The `AdditionalMetadata` type parameter allows for extending the node metadata with custom data.\n */\ninterface RouteTreeNode<AdditionalMetadata extends Record<string, unknown>> {\n /**\n * A map of child nodes, keyed by their corresponding route segment or wildcard.\n */\n children: Map<string, RouteTreeNode<AdditionalMetadata>>;\n\n /**\n * Optional metadata associated with this node, providing additional information such as redirects.\n */\n metadata?: RouteTreeNodeMetadata & AdditionalMetadata;\n}\n\n/**\n * A route tree implementation that supports efficient route matching, including support for wildcard routes.\n * This structure is useful for organizing and retrieving routes in a hierarchical manner,\n * enabling complex routing scenarios with nested paths.\n *\n * @typeParam AdditionalMetadata - Type of additional metadata that can be associated with route nodes.\n */\nexport class RouteTree<AdditionalMetadata extends Record<string, unknown> = {}> {\n /**\n * The root node of the route tree.\n * All routes are stored and accessed relative to this root node.\n */\n private readonly root = this.createEmptyRouteTreeNode();\n\n /**\n * Inserts a new route into the route tree.\n * The route is broken down into segments, and each segment is added to the tree.\n * Parameterized segments (e.g., :id) are normalized to wildcards (*) for matching purposes.\n *\n * @param route - The route path to insert into the tree.\n * @param metadata - Metadata associated with the route, excluding the route path itself.\n */\n insert(route: string, metadata: RouteTreeNodeMetadataWithoutRoute & AdditionalMetadata): void {\n let node = this.root;\n const segments = this.getPathSegments(route);\n const normalizedSegments: string[] = [];\n\n for (const segment of segments) {\n // Replace parameterized segments (e.g., :id) with a wildcard (*) for matching\n const normalizedSegment = segment[0] === ':' ? '*' : segment;\n let childNode = node.children.get(normalizedSegment);\n if (!childNode) {\n childNode = this.createEmptyRouteTreeNode();\n node.children.set(normalizedSegment, childNode);\n }\n\n node = childNode;\n normalizedSegments.push(normalizedSegment);\n }\n\n // At the leaf node, store the full route and its associated metadata\n node.metadata = {\n ...metadata,\n route: addLeadingSlash(normalizedSegments.join('/')),\n };\n }\n\n /**\n * Matches a given route against the route tree and returns the best matching route's metadata.\n * The best match is determined by the lowest insertion index, meaning the earliest defined route\n * takes precedence.\n *\n * @param route - The route path to match against the route tree.\n * @returns The metadata of the best matching route or `undefined` if no match is found.\n */\n match(route: string): (RouteTreeNodeMetadata & AdditionalMetadata) | undefined {\n const segments = this.getPathSegments(route);\n\n return this.traverseBySegments(segments)?.metadata;\n }\n\n /**\n * Converts the route tree into a serialized format representation.\n * This method converts the route tree into an array of metadata objects that describe the structure of the tree.\n * The array represents the routes in a nested manner where each entry includes the route and its associated metadata.\n *\n * @returns An array of `RouteTreeNodeMetadata` objects representing the route tree structure.\n * Each object includes the `route` and associated metadata of a route.\n */\n toObject(): SerializableRouteTreeNode {\n return Array.from(this.traverse());\n }\n\n /**\n * Constructs a `RouteTree` from an object representation.\n * This method is used to recreate a `RouteTree` instance from an array of metadata objects.\n * The array should be in the format produced by `toObject`, allowing for the reconstruction of the route tree\n * with the same routes and metadata.\n *\n * @param value - An array of `RouteTreeNodeMetadata` objects that represent the serialized format of the route tree.\n * Each object should include a `route` and its associated metadata.\n * @returns A new `RouteTree` instance constructed from the provided metadata objects.\n */\n static fromObject(value: SerializableRouteTreeNode): RouteTree {\n const tree = new RouteTree();\n\n for (const { route, ...metadata } of value) {\n tree.insert(route, metadata);\n }\n\n return tree;\n }\n\n /**\n * A generator function that recursively traverses the route tree and yields the metadata of each node.\n * This allows for easy and efficient iteration over all nodes in the tree.\n *\n * @param node - The current node to start the traversal from. Defaults to the root node of the tree.\n */\n *traverse(\n node: RouteTreeNode<AdditionalMetadata> = this.root,\n ): Generator<RouteTreeNodeMetadata & AdditionalMetadata> {\n if (node.metadata) {\n yield node.metadata;\n }\n\n for (const childNode of node.children.values()) {\n yield* this.traverse(childNode);\n }\n }\n\n /**\n * Extracts the path segments from a given route string.\n *\n * @param route - The route string from which to extract segments.\n * @returns An array of path segments.\n */\n private getPathSegments(route: string): string[] {\n return route.split('/').filter(Boolean).map(decodeURIComponent);\n }\n\n /**\n * Recursively traverses the route tree from a given node, attempting to match the remaining route segments.\n * If the node is a leaf node (no more segments to match) and contains metadata, the node is yielded.\n *\n * This function prioritizes exact segment matches first, followed by wildcard matches (`*`),\n * and finally deep wildcard matches (`**`) that consume all segments.\n *\n * @param segments - The array of route path segments to match against the route tree.\n * @param node - The current node in the route tree to start traversal from. Defaults to the root node.\n * @param currentIndex - The index of the segment in `remainingSegments` currently being matched.\n * Defaults to `0` (the first segment).\n *\n * @returns The node that best matches the remaining segments or `undefined` if no match is found.\n */\n private traverseBySegments(\n segments: string[],\n node = this.root,\n currentIndex = 0,\n ): RouteTreeNode<AdditionalMetadata> | undefined {\n if (currentIndex >= segments.length) {\n return node.metadata ? node : node.children.get('**');\n }\n\n if (!node.children.size) {\n return undefined;\n }\n\n const segment = segments[currentIndex];\n\n // 1. Attempt exact match with the current segment.\n const exactMatch = node.children.get(segment);\n if (exactMatch) {\n const match = this.traverseBySegments(segments, exactMatch, currentIndex + 1);\n if (match) {\n return match;\n }\n }\n\n // 2. Attempt wildcard match ('*').\n const wildcardMatch = node.children.get('*');\n if (wildcardMatch) {\n const match = this.traverseBySegments(segments, wildcardMatch, currentIndex + 1);\n if (match) {\n return match;\n }\n }\n\n // 3. Attempt double wildcard match ('**').\n return node.children.get('**');\n }\n\n /**\n * Creates an empty route tree node.\n * This helper function is used during the tree construction.\n *\n * @returns A new, empty route tree node.\n */\n private createEmptyRouteTreeNode(): RouteTreeNode<AdditionalMetadata> {\n return {\n children: new Map(),\n };\n }\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n\nimport { APP_BASE_HREF, PlatformLocation } from '@angular/common';\nimport {\n ApplicationRef,\n Compiler,\n EnvironmentInjector,\n InjectionToken,\n Injector,\n createEnvironmentInjector,\n runInInjectionContext,\n ɵConsole,\n ɵENABLE_ROOT_COMPONENT_BOOTSTRAP,\n} from '@angular/core';\nimport { INITIAL_CONFIG, platformServer } from '@angular/platform-server';\nimport {\n Route as AngularRoute,\n Router,\n ɵloadChildren as loadChildrenHelper,\n} from '@angular/router';\n\nimport { ServerAssets } from '../assets';\nimport { Console } from '../console';\nimport { AngularAppManifest, getAngularAppManifest } from '../manifest';\nimport { AngularBootstrap, isNgModule } from '../utils/ng';\nimport { promiseWithAbort } from '../utils/promise';\nimport { VALID_REDIRECT_RESPONSE_CODES, isValidRedirectResponseCode } from '../utils/redirect';\nimport { addTrailingSlash, joinUrlParts, stripLeadingSlash } from '../utils/url';\nimport {\n PrerenderFallback,\n RenderMode,\n SERVER_ROUTES_CONFIG,\n ServerRoute,\n ServerRoutesConfig,\n} from './route-config';\nimport { RouteTree, RouteTreeNodeMetadata } from './route-tree';\n\n/**\n * A DI token that indicates whether the application is in the process of discovering routes.\n *\n * This token is provided with the value `true` when route discovery is active, allowing other\n * parts of the application to conditionally execute logic. For example, it can be used to\n * disable features or behaviors that are not necessary or might interfere with the route\n * discovery process.\n */\nexport const IS_DISCOVERING_ROUTES = new InjectionToken<boolean>(\n typeof ngDevMode === 'undefined' || ngDevMode ? 'IS_DISCOVERING_ROUTES' : '',\n {\n providedIn: 'platform',\n factory: () => false,\n },\n);\n\ninterface Route extends AngularRoute {\n ɵentryName?: string;\n}\n\n/**\n * The maximum number of module preload link elements that should be added for\n * initial scripts.\n */\nconst MODULE_PRELOAD_MAX = 10;\n\n/**\n * Regular expression to match a catch-all route pattern in a URL path,\n * specifically one that ends with '/**'.\n */\nconst CATCH_ALL_REGEXP = /\\/(\\*\\*)$/;\n\n/**\n * Regular expression to match a segment preceded by a colon in a string.\n */\nconst URL_PARAMETER_REGEXP = /(?<!\\\\):([^/]+)/;\n\n/**\n * Regular expression to match all segments preceded by a colon in a string.\n */\nconst URL_PARAMETER_GLOBAL_REGEXP = new RegExp(URL_PARAMETER_REGEXP, 'g');\n\n/**\n * Additional metadata for a server configuration route tree.\n */\ntype ServerConfigRouteTreeAdditionalMetadata = Partial<ServerRoute> & {\n /** Indicates if the route has been matched with the Angular router routes. */\n presentInClientRouter?: boolean;\n};\n\n/**\n * Metadata for a server configuration route tree node.\n */\ntype ServerConfigRouteTreeNodeMetadata = RouteTreeNodeMetadata &\n ServerConfigRouteTreeAdditionalMetadata;\n\n/**\n * Result of extracting routes from an Angular application.\n */\ninterface AngularRouterConfigResult {\n /**\n * The base URL for the application.\n * This is the base href that is used for resolving relative paths within the application.\n */\n baseHref: string;\n\n /**\n * An array of `RouteTreeNodeMetadata` objects representing the application's routes.\n *\n * Each `RouteTreeNodeMetadata` contains details about a specific route, such as its path and any\n * associated redirection targets. This array is asynchronously generated and\n * provides information on how routes are structured and resolved.\n */\n routes: RouteTreeNodeMetadata[];\n\n /**\n * Optional configuration for server routes.\n *\n * This property allows you to specify an array of server routes for configuration.\n * If not provided, the default configuration or behavior will be used.\n */\n serverRoutesConfig?: ServerRoute[] | null;\n\n /**\n * A list of errors encountered during the route extraction process.\n */\n errors: string[];\n\n /**\n * The specified route for the app-shell, if configured.\n */\n appShellRoute?: string;\n}\n\ntype EntryPointToBrowserMapping = AngularAppManifest['entryPointToBrowserMapping'];\n\n/**\n * Handles a single route within the route tree and yields metadata or errors.\n *\n * @param options - Configuration options for handling the route.\n * @returns An async iterable iterator yielding `RouteTreeNodeMetadata` or an error object.\n */\nasync function* handleRoute(options: {\n metadata: ServerConfigRouteTreeNodeMetadata;\n currentRoutePath: string;\n route: Route;\n compiler: Compiler;\n parentInjector: Injector;\n serverConfigRouteTree?: RouteTree<ServerConfigRouteTreeAdditionalMetadata>;\n invokeGetPrerenderParams: boolean;\n includePrerenderFallbackRoutes: boolean;\n entryPointToBrowserMapping?: EntryPointToBrowserMapping;\n}): AsyncIterableIterator<RouteTreeNodeMetadata | { error: string }> {\n try {\n const {\n metadata,\n currentRoutePath,\n route,\n compiler,\n parentInjector,\n serverConfigRouteTree,\n entryPointToBrowserMapping,\n invokeGetPrerenderParams,\n includePrerenderFallbackRoutes,\n } = options;\n\n const { redirectTo, loadChildren, loadComponent, children, ɵentryName } = route;\n if (ɵentryName && loadComponent) {\n appendPreloadToMetadata(ɵentryName, entryPointToBrowserMapping, metadata);\n }\n\n if (metadata.renderMode === RenderMode.Prerender) {\n yield* handleSSGRoute(\n serverConfigRouteTree,\n typeof redirectTo === 'string' ? redirectTo : undefined,\n metadata,\n parentInjector,\n invokeGetPrerenderParams,\n includePrerenderFallbackRoutes,\n );\n } else if (redirectTo !== undefined) {\n if (metadata.status && !isValidRedirectResponseCode(metadata.status)) {\n yield {\n error:\n `The '${metadata.status}' status code is not a valid redirect response code. ` +\n `Please use one of the following redirect response codes: ${[...VALID_REDIRECT_RESPONSE_CODES.values()].join(', ')}.`,\n };\n } else if (typeof redirectTo === 'string') {\n yield {\n ...metadata,\n redirectTo: resolveRedirectTo(metadata.route, redirectTo),\n };\n } else {\n yield metadata;\n }\n } else {\n yield metadata;\n }\n\n // Recursively process child routes\n if (children?.length) {\n yield* traverseRoutesConfig({\n ...options,\n routes: children,\n parentRoute: currentRoutePath,\n parentPreloads: metadata.preload,\n });\n }\n\n // Load and process lazy-loaded child routes\n if (loadChildren) {\n if (ɵentryName) {\n appendPreloadToMetadata(ɵentryName, entryPointToBrowserMapping, metadata);\n }\n\n const routeInjector = route.providers\n ? createEnvironmentInjector(\n route.providers,\n parentInjector.get(EnvironmentInjector),\n `Route: ${route.path}`,\n )\n : parentInjector;\n\n const loadedChildRoutes = await loadChildrenHelper(route, compiler, routeInjector);\n if (loadedChildRoutes) {\n const { routes: childRoutes, injector = routeInjector } = loadedChildRoutes;\n yield* traverseRoutesConfig({\n ...options,\n routes: childRoutes,\n parentInjector: injector,\n parentRoute: currentRoutePath,\n parentPreloads: metadata.preload,\n });\n }\n }\n } catch (error) {\n yield {\n error: `Error in handleRoute for '${options.currentRoutePath}': ${(error as Error).message}`,\n };\n }\n}\n\n/**\n * Traverses an array of route configurations to generate route tree node metadata.\n *\n * This function processes each route and its children, handling redirects, SSG (Static Site Generation) settings,\n * and lazy-loaded routes. It yields route metadata for each route and its potential variants.\n *\n * @param options - The configuration options for traversing routes.\n * @returns An async iterable iterator yielding either route tree node metadata or an error object with an error message.\n */\nasync function* traverseRoutesConfig(options: {\n routes: Route[];\n compiler: Compiler;\n parentInjector: Injector;\n parentRoute: string;\n serverConfigRouteTree?: RouteTree<ServerConfigRouteTreeAdditionalMetadata>;\n invokeGetPrerenderParams: boolean;\n includePrerenderFallbackRoutes: boolean;\n entryPointToBrowserMapping?: EntryPointToBrowserMapping;\n parentPreloads?: readonly string[];\n}): AsyncIterableIterator<RouteTreeNodeMetadata | { error: string }> {\n const { routes: routeConfigs, parentPreloads, parentRoute, serverConfigRouteTree } = options;\n\n for (const route of routeConfigs) {\n const { matcher, path = matcher ? '**' : '' } = route;\n const currentRoutePath = joinUrlParts(parentRoute, path);\n\n if (matcher && serverConfigRouteTree) {\n const matches: (RouteTreeNodeMetadata & ServerConfigRouteTreeAdditionalMetadata)[] = [];\n for (const matchedMetaData of serverConfigRouteTree.traverse()) {\n if (matchedMetaData.route.startsWith(currentRoutePath)) {\n matches.push(matchedMetaData);\n }\n }\n\n if (!matches.length) {\n const matchedMetaData = serverConfigRouteTree.match(currentRoutePath);\n if (matchedMetaData) {\n matches.push(matchedMetaData);\n }\n }\n\n for (const matchedMetaData of matches) {\n matchedMetaData.presentInClientRouter = true;\n if (matchedMetaData.renderMode === RenderMode.Prerender) {\n yield {\n error:\n `The route '${stripLeadingSlash(currentRoutePath)}' is set for prerendering but has a defined matcher. ` +\n `Routes with matchers cannot use prerendering. Please specify a different 'renderMode'.`,\n };\n continue;\n }\n\n yield* handleRoute({\n ...options,\n currentRoutePath,\n route,\n metadata: {\n ...matchedMetaData,\n preload: parentPreloads,\n route: matchedMetaData.route,\n presentInClientRouter: undefined,\n },\n });\n }\n\n if (!matches.length) {\n yield {\n error:\n `The route '${stripLeadingSlash(currentRoutePath)}' has a defined matcher but does not ` +\n 'match any route in the server routing configuration. Please ensure this route is added to the server routing configuration.',\n };\n }\n\n continue;\n }\n\n let matchedMetaData: ServerConfigRouteTreeNodeMetadata | undefined;\n if (serverConfigRouteTree) {\n matchedMetaData = serverConfigRouteTree.match(currentRoutePath);\n if (!matchedMetaData) {\n yield {\n error:\n `The '${stripLeadingSlash(currentRoutePath)}' route does not match any route defined in the server routing configuration. ` +\n 'Please ensure this route is added to the server routing configuration.',\n };\n continue;\n }\n\n matchedMetaData.presentInClientRouter = true;\n }\n\n yield* handleRoute({\n ...options,\n metadata: {\n renderMode: RenderMode.Prerender,\n ...matchedMetaData,\n preload: parentPreloads,\n // Match Angular router behavior\n // ['one', 'two', ''] -> 'one/two/'\n // ['one', 'two', 'three'] -> 'one/two/three'\n route: path === '' ? addTrailingSlash(currentRoutePath) : currentRoutePath,\n presentInClientRouter: undefined,\n },\n currentRoutePath,\n route,\n });\n }\n}\n\n/**\n * Appends preload information to the metadata object based on the specified entry-point and chunk mappings.\n *\n * This function extracts preload data for a given entry-point from the provided chunk mappings. It adds the\n * corresponding browser bundles to the metadata's preload list, ensuring no duplicates and limiting the total\n * preloads to a predefined maximum.\n */\nfunction appendPreloadToMetadata(\n entryName: string,\n entryPointToBrowserMapping: EntryPointToBrowserMapping,\n metadata: ServerConfigRouteTreeNodeMetadata,\n): void {\n const existingPreloads = metadata.preload ?? [];\n if (!entryPointToBrowserMapping || existingPreloads.length >= MODULE_PRELOAD_MAX) {\n return;\n }\n\n const preload = entryPointToBrowserMapping[entryName];\n if (!preload?.length) {\n return;\n }\n\n // Merge existing preloads with new ones, ensuring uniqueness and limiting the total to the maximum allowed.\n const combinedPreloads: Set<string> = new Set(existingPreloads);\n for (const href of preload) {\n combinedPreloads.add(href);\n if (combinedPreloads.size === MODULE_PRELOAD_MAX) {\n break;\n }\n }\n\n metadata.preload = Array.from(combinedPreloads);\n}\n\n/**\n * Handles SSG (Static Site Generation) routes by invoking `getPrerenderParams` and yielding\n * all parameterized paths, returning any errors encountered.\n *\n * @param serverConfigRouteTree - The tree representing the server's routing setup.\n * @param redirectTo - Optional path to redirect to, if specified.\n * @param metadata - The metadata associated with the route tree node.\n * @param parentInjector - The dependency injection container for the parent route.\n * @param invokeGetPrerenderParams - A flag indicating whether to invoke the `getPrerenderParams` function.\n * @param includePrerenderFallbackRoutes - A flag indicating whether to include fallback routes in the result.\n * @returns An async iterable iterator that yields route tree node metadata for each SSG path or errors.\n */\nasync function* handleSSGRoute(\n serverConfigRouteTree: RouteTree<ServerConfigRouteTreeAdditionalMetadata> | undefined,\n redirectTo: string | undefined,\n metadata: ServerConfigRouteTreeNodeMetadata,\n parentInjector: Injector,\n invokeGetPrerenderParams: boolean,\n includePrerenderFallbackRoutes: boolean,\n): AsyncIterableIterator<RouteTreeNodeMetadata | { error: string }> {\n if (metadata.renderMode !== RenderMode.Prerender) {\n throw new Error(\n `'handleSSGRoute' was called for a route which rendering mode is not prerender.`,\n );\n }\n\n const { route: currentRoutePath, fallback, ...meta } = metadata;\n const getPrerenderParams = 'getPrerenderParams' in meta ? meta.getPrerenderParams : undefined;\n\n if ('getPrerenderParams' in meta) {\n delete meta['getPrerenderParams'];\n }\n\n if (redirectTo !== undefined) {\n meta.redirectTo = resolveRedirectTo(currentRoutePath, redirectTo);\n }\n\n const isCatchAllRoute = CATCH_ALL_REGEXP.test(currentRoutePath);\n if (\n (isCatchAllRoute && !getPrerenderParams) ||\n (!isCatchAllRoute && !URL_PARAMETER_REGEXP.test(currentRoutePath))\n ) {\n // Route has no parameters\n yield {\n ...meta,\n route: currentRoutePath,\n };\n\n return;\n }\n\n if (invokeGetPrerenderParams) {\n if (!getPrerenderParams) {\n yield {\n error:\n `The '${stripLeadingSlash(currentRoutePath)}' route uses prerendering and includes parameters, but 'getPrerenderParams' ` +\n `is missing. Please define 'getPrerenderParams' function for this route in your server routing configuration ` +\n `or specify a different 'renderMode'.`,\n };\n\n return;\n }\n\n if (serverConfigRouteTree) {\n // Automatically resolve dynamic parameters for nested routes.\n const catchAllRoutePath = isCatchAllRoute\n ? currentRoutePath\n : joinUrlParts(currentRoutePath, '**');\n const match = serverConfigRouteTree.match(catchAllRoutePath);\n if (match && match.renderMode === RenderMode.Prerender && !('getPrerenderParams' in match)) {\n serverConfigRouteTree.insert(catchAllRoutePath, {\n ...match,\n presentInClientRouter: true,\n getPrerenderParams,\n });\n }\n }\n\n const parameters = await runInInjectionContext(parentInjector, () => getPrerenderParams());\n try {\n for (const params of parameters) {\n const replacer = handlePrerenderParamsReplacement(params, currentRoutePath);\n const routeWithResolvedParams = currentRoutePath\n .replace(URL_PARAMETER_GLOBAL_REGEXP, replacer)\n .replace(CATCH_ALL_REGEXP, replacer);\n\n yield {\n ...meta,\n route: routeWithResolvedParams,\n redirectTo:\n redirectTo === undefined\n ? undefined\n : resolveRedirectTo(routeWithResolvedParams, redirectTo),\n };\n }\n } catch (error) {\n yield { error: `${(error as Error).message}` };\n\n return;\n }\n }\n\n // Handle fallback render modes\n if (\n includePrerenderFallbackRoutes &&\n (fallback !== PrerenderFallback.None || !invokeGetPrerenderParams)\n ) {\n yield {\n ...meta,\n route: currentRoutePath,\n renderMode: fallback === PrerenderFallback.Client ? RenderMode.Client : RenderMode.Server,\n };\n }\n}\n\n/**\n * Creates a replacer function used for substituting parameter placeholders in a route path\n * with their corresponding values provided in the `params` object.\n *\n * @param params - An object mapping parameter names to their string values.\n * @param currentRoutePath - The current route path, used for constructing error messages.\n * @returns A function that replaces a matched parameter placeholder (e.g., ':id') with its corresponding value.\n */\nfunction handlePrerenderParamsReplacement(\n params: Record<string, string>,\n currentRoutePath: string,\n): (substring: string, ...args: unknown[]) => string {\n return (match) => {\n const parameterName = match.slice(1);\n const value = params[parameterName];\n if (typeof value !== 'string') {\n throw new Error(\n `The 'getPrerenderParams' function defined for the '${stripLeadingSlash(currentRoutePath)}' route ` +\n `returned a non-string value for parameter '${parameterName}'. ` +\n `Please make sure the 'getPrerenderParams' function returns values for all parameters ` +\n 'specified in this route.',\n );\n }\n\n return parameterName === '**' ? `/${value}` : value;\n };\n}\n\n/**\n * Resolves the `redirectTo` property for a given route.\n *\n * This function processes the `redirectTo` property to ensure that it correctly\n * resolves relative to the current route path. If `redirectTo` is an absolute path,\n * it is returned as is. If it is a relative path, it is resolved based on the current route path.\n *\n * @param routePath - The current route path.\n * @param redirectTo - The target path for redirection.\n * @returns The resolved redirect path as a string.\n */\nfunction resolveRedirectTo(routePath: string, redirectTo: string): string {\n if (redirectTo[0] === '/') {\n // If the redirectTo path is absolute, return it as is.\n return redirectTo;\n }\n\n // Resolve relative redirectTo based on the current route path.\n const segments = routePath.replace(URL_PARAMETER_GLOBAL_REGEXP, '*').split('/');\n segments.pop(); // Remove the last segment to make it relative.\n\n return joinUrlParts(...segments, redirectTo);\n}\n\n/**\n * Builds a server configuration route tree from the given server routes configuration.\n *\n * @param serverRoutesConfig - The server routes to be used for configuration.\n\n * @returns An object containing:\n * - `serverConfigRouteTree`: A populated `RouteTree` instance, which organizes the server routes\n * along with their additional metadata.\n * - `errors`: An array of strings that list any errors encountered during the route tree construction\n * process, such as invalid paths.\n */\nfunction buildServerConfigRouteTree({ routes, appShellRoute }: ServerRoutesConfig): {\n errors: string[];\n serverConfigRouteTree: RouteTree<ServerConfigRouteTreeAdditionalMetadata>;\n} {\n const serverRoutes: ServerRoute[] = [...routes];\n if (appShellRoute !== undefined) {\n serverRoutes.unshift({\n path: appShellRoute,\n renderMode: RenderMode.Prerender,\n });\n }\n\n const serverConfigRouteTree = new RouteTree<ServerConfigRouteTreeAdditionalMetadata>();\n const errors: string[] = [];\n\n for (const { path, ...metadata } of serverRoutes) {\n if (path[0] === '/') {\n errors.push(`Invalid '${path}' route configuration: the path cannot start with a slash.`);\n\n continue;\n }\n\n if ('getPrerenderParams' in metadata && (path.includes('/*/') || path.endsWith('/*'))) {\n errors.push(\n `Invalid '${path}' route configuration: 'getPrerenderParams' cannot be used with a '*' route.`,\n );\n continue;\n }\n\n serverConfigRouteTree.insert(path, metadata);\n }\n\n return { serverConfigRouteTree, errors };\n}\n\n/**\n * Retrieves routes from the given Angular application.\n *\n * This function initializes an Angular platform, bootstraps the application or module,\n * and retrieves routes from the Angular router configuration. It handles both module-based\n * and function-based bootstrapping. It yields the resulting routes as `RouteTreeNodeMetadata` objects or errors.\n *\n * @param bootstrap - A function that returns a promise resolving to an `ApplicationRef` or an Angular module to bootstrap.\n * @param document - The initial HTML document used for server-side rendering.\n * This document is necessary to render the application on the server.\n * @param url - The URL for server-side rendering. The URL is used to configure `ServerPlatformLocation`. This configuration is crucial\n * for ensuring that API requests for relative paths succeed, which is essential for accurate route extraction.\n * @param invokeGetPrerenderParams - A boolean flag indicating whether to invoke `getPrerenderParams` for parameterized SSG routes\n * to handle prerendering paths. Defaults to `false`.\n * @param includePrerenderFallbackRoutes - A flag indicating whether to include fallback routes in the result. Defaults to `true`.\n * @param entryPointToBrowserMapping - Maps the entry-point name to the associated JavaScript browser bundles.\n *\n * @returns A promise that resolves to an object of type `AngularRouterConfigResult` or errors.\n */\nexport async function getRoutesFromAngularRouterConfig(\n bootstrap: AngularBootstrap,\n document: string,\n url: URL,\n invokeGetPrerenderParams = false,\n includePrerenderFallbackRoutes = true,\n entryPointToBrowserMapping: EntryPointToBrowserMapping | undefined = undefined,\n): Promise<AngularRouterConfigResult> {\n const { protocol, host } = url;\n\n // Create and initialize the Angular platform for server-side rendering.\n const platformRef = platformServer([\n {\n provide: INITIAL_CONFIG,\n useValue: { document, url: `${protocol}//${host}/` },\n },\n {\n // An Angular Console Provider that does not print a set of predefined logs.\n provide: ɵConsole,\n // Using `useClass` would necessitate decorating `Console` with `@Injectable`,\n // which would require switching from `ts_library` to `ng_module`. This change\n // would also necessitate various patches of `@angular/bazel` to support ESM.\n useFactory: () => new Console(),\n },\n {\n provide: ɵENABLE_ROOT_COMPONENT_BOOTSTRAP,\n useValue: false,\n },\n {\n provide: IS_DISCOVERING_ROUTES,\n useValue: true,\n },\n ]);\n\n try {\n let applicationRef: ApplicationRef;\n\n if (isNgModule(bootstrap)) {\n const moduleRef = await platformRef.bootstrapModule(bootstrap);\n applicationRef = moduleRef.injector.get(ApplicationRef);\n } else {\n applicationRef = await bootstrap({ platformRef });\n }\n\n const injector = applicationRef.injector;\n const router = injector.get(Router);\n\n // Workaround to unblock navigation when `withEnabledBlockingInitialNavigation()` is used.\n // This is necessary because route extraction disables component bootstrapping.\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n (router as any).navigationTransitions.afterPreactivation()?.next?.();\n\n // Wait until the application is stable.\n await applicationRef.whenStable();\n\n const errors: string[] = [];\n\n const rawBaseHref =\n injector.get(APP_BASE_HREF, null, { optional: true }) ??\n injector.get(PlatformLocation).getBaseHrefFromDOM();\n const { pathname: baseHref } = new URL(rawBaseHref, 'http://localhost');\n\n const compiler = injector.get(Compiler);\n const serverRoutesConfig = injector.get(SERVER_ROUTES_CONFIG, null, { optional: true });\n let serverConfigRouteTree: RouteTree<ServerConfigRouteTreeAdditionalMetadata> | undefined;\n\n if (serverRoutesConfig) {\n const result = buildServerConfigRouteTree(serverRoutesConfig);\n serverConfigRouteTree = result.serverConfigRouteTree;\n errors.push(...result.errors);\n }\n\n if (errors.length) {\n return {\n baseHref,\n routes: [],\n errors,\n };\n }\n\n const routesResults: RouteTreeNodeMetadata[] = [];\n if (router.config.length) {\n // Retrieve all routes from the Angular router configuration.\n const traverseRoutes = traverseRoutesConfig({\n routes: router.config,\n compiler,\n parentInjector: injector,\n parentRoute: '',\n serverConfigRouteTree,\n invokeGetPrerenderParams,\n includePrerenderFallbackRoutes,\n entryPointToBrowserMapping,\n });\n\n const seenRoutes: Set<string> = new Set();\n for await (const routeMetadata of traverseRoutes) {\n if ('error' in routeMetadata) {\n errors.push(routeMetadata.error);\n continue;\n }\n\n // If a result already exists for the exact same route, subsequent matches should be ignored.\n // This aligns with Angular's app router behavior, which prioritizes the first route.\n const routePath = routeMetadata.route;\n if (!seenRoutes.has(routePath)) {\n routesResults.push(routeMetadata);\n seenRoutes.add(routePath);\n }\n }\n\n // This timeout is necessary to prevent 'adev' from hanging in production builds.\n // The exact cause is unclear, but removing it leads to the issue.\n await new Promise((resolve) => setTimeout(resolve, 0));\n\n if (serverConfigRouteTree) {\n for (const { route, presentInClientRouter } of serverConfigRouteTree.traverse()) {\n if (presentInClientRouter || route.endsWith('/**')) {\n // Skip if matched or it's the catch-all route.\n continue;\n }\n\n errors.push(\n `The '${stripLeadingSlash(route)}' server route does not match any routes defined in the Angular ` +\n `routing configuration (typically provided as a part of the 'provideRouter' call). ` +\n 'Please make sure that the mentioned server route is present in the Angular routing configuration.',\n );\n }\n }\n } else {\n const rootRouteMetadata = serverConfigRouteTree?.match('') ?? {\n route: '',\n renderMode: RenderMode.Prerender,\n };\n\n routesResults.push({\n ...rootRouteMetadata,\n // Matched route might be `/*` or `/**`, which would make Angular serve all routes rather than just `/`.\n // So we limit to just `/` for the empty app router case.\n route: '',\n });\n }\n\n return {\n baseHref,\n routes: routesResults,\n errors,\n appShellRoute: serverRoutesConfig?.appShellRoute,\n };\n } finally {\n platformRef.destroy();\n }\n}\n\n/**\n * Asynchronously extracts routes from the Angular application configuration\n * and creates a `RouteTree` to manage server-side routing.\n *\n * @param options - An object containing the following options:\n * - `url`: The URL for server-side rendering. The URL is used to configure `ServerPlatformLocation`. This configuration is crucial\n * for ensuring that API requests for relative paths succeed, which is essential for accurate route extraction.\n * See:\n * - https://github.com/angular/angular/blob/d608b857c689d17a7ffa33bbb510301014d24a17/packages/platform-server/src/location.ts#L51\n * - https://github.com/angular/angular/blob/6882cc7d9eed26d3caeedca027452367ba25f2b9/packages/platform-server/src/http.ts#L44\n * - `manifest`: An optional `AngularAppManifest` that contains the application's routing and configuration details.\n * If not provided, the default manifest is retrieved using `getAngularAppManifest()`.\n * - `invokeGetPrerenderParams`: A boolean flag indicating whether to invoke `getPrerenderParams` for parameterized SSG routes\n * to handle prerendering paths. Defaults to `false`.\n * - `includePrerenderFallbackRoutes`: A flag indicating whether to include fallback routes in the result. Defaults to `true`.\n * - `signal`: An optional `AbortSignal` that can be used to abort the operation.\n *\n * @returns A promise that resolves to an object containing:\n * - `routeTree`: A populated `RouteTree` containing all extracted routes from the Angular application.\n * - `appShellRoute`: The specified route for the app-shell, if configured.\n * - `errors`: An array of strings representing any errors encountered during the route extraction process.\n */\nexport function extractRoutesAndCreateRouteTree(options: {\n url: URL;\n manifest?: AngularAppManifest;\n invokeGetPrerenderParams?: boolean;\n includePrerenderFallbackRoutes?: boolean;\n signal?: AbortSignal;\n}): Promise<{ routeTree: RouteTree; appShellRoute?: string; errors: string[] }> {\n const {\n url,\n manifest = getAngularAppManifest(),\n invokeGetPrerenderParams = false,\n includePrerenderFallbackRoutes = true,\n signal,\n } = options;\n\n async function extract(): Promise<{\n appShellRoute: string | undefined;\n routeTree: RouteTree<{}>;\n errors: string[];\n }> {\n const routeTree = new RouteTree();\n const document = await new ServerAssets(manifest).getIndexServerHtml().text();\n const bootstrap = await manifest.bootstrap();\n const { baseHref, appShellRoute, routes, errors } = await getRoutesFromAngularRouterConfig(\n bootstrap,\n document,\n url,\n invokeGetPrerenderParams,\n includePrerenderFallbackRoutes,\n manifest.entryPointToBrowserMapping,\n );\n\n for (const { route, ...metadata } of routes) {\n if (metadata.redirectTo !== undefined) {\n metadata.redirectTo = joinUrlParts(baseHref, metadata.redirectTo);\n }\n\n // Remove undefined fields\n // Helps avoid unnecessary test updates\n for (const [key, value] of Object.entries(metadata)) {\n if (value === undefined) {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n delete (metadata as any)[key];\n }\n }\n\n const fullRoute = joinUrlParts(baseHref, route);\n routeTree.insert(fullRoute, metadata);\n }\n\n return {\n appShellRoute,\n routeTree,\n errors,\n };\n }\n\n return signal ? promiseWithAbort(extract(), signal, 'Routes extraction') : extract();\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n\n/**\n * Defines a handler function type for transforming HTML content.\n * This function receives an object with the HTML to be processed.\n *\n * @param ctx - An object containing the URL and HTML content to be transformed.\n * @returns The transformed HTML as a string or a promise that resolves to the transformed HTML.\n */\ntype HtmlTransformHandler = (ctx: { url: URL; html: string }) => string | Promise<string>;\n\n/**\n * Defines the names of available hooks for registering and triggering custom logic within the application.\n */\ntype HookName = keyof HooksMapping;\n\n/**\n * Mapping of hook names to their corresponding handler types.\n */\ninterface HooksMapping {\n 'html:transform:pre': HtmlTransformHandler;\n}\n\n/**\n * Manages a collection of hooks and provides methods to register and execute them.\n * Hooks are functions that can be invoked with specific arguments to allow modifications or enhancements.\n */\nexport class Hooks {\n /**\n * A map of hook names to arrays of hook functions.\n * Each hook name can have multiple associated functions, which are executed in sequence.\n */\n private readonly store = new Map<HookName, Function[]>();\n\n /**\n * Executes all hooks associated with the specified name, passing the given argument to each hook function.\n * The hooks are invoked sequentially, and the argument may be modified by each hook.\n *\n * @template Hook - The type of the hook name. It should be one of the keys of `HooksMapping`.\n * @param name - The name of the hook whose functions will be executed.\n * @param context - The input value to be passed to each hook function. The value is mutated by each hook function.\n * @returns A promise that resolves once all hook functions have been executed.\n *\n * @example\n * ```typescript\n * const hooks = new Hooks();\n * hooks.on('html:transform:pre', async (ctx) => {\n * ctx.html = ctx.html.replace(/foo/g, 'bar');\n * return ctx.html;\n * });\n * const result = await hooks.run('html:transform:pre', { html: '<div>foo</div>' });\n * console.log(result); // '<div>bar</div>'\n * ```\n * @internal\n */\n async run<Hook extends keyof HooksMapping>(\n name: Hook,\n context: Parameters<HooksMapping[Hook]>[0],\n ): Promise<Awaited<ReturnType<HooksMapping[Hook]>>> {\n const hooks = this.store.get(name);\n switch (name) {\n case 'html:transform:pre': {\n if (!hooks) {\n return context.html as Awaited<ReturnType<HooksMapping[Hook]>>;\n }\n\n const ctx = { ...context };\n for (const hook of hooks) {\n ctx.html = await hook(ctx);\n }\n\n return ctx.html as Awaited<ReturnType<HooksMapping[Hook]>>;\n }\n default:\n throw new Error(`Running hook \"${name}\" is not supported.`);\n }\n }\n\n /**\n * Registers a new hook function under the specified hook name.\n * This function should be a function that takes an argument of type `T` and returns a `string` or `Promise<string>`.\n *\n * @template Hook - The type of the hook name. It should be one of the keys of `HooksMapping`.\n * @param name - The name of the hook under which the function will be registered.\n * @param handler - A function to be executed when the hook is triggered. The handler will be called with an argument\n * that may be modified by the hook functions.\n *\n * @remarks\n * - If there are existing handlers registered under the given hook name, the new handler will be added to the list.\n * - If no handlers are registered under the given hook name, a new list will be created with the handler as its first element.\n *\n * @example\n * ```typescript\n * hooks.on('html:transform:pre', async (ctx) => {\n * return ctx.html.replace(/foo/g, 'bar');\n * });\n * ```\n */\n on<Hook extends HookName>(name: Hook, handler: HooksMapping[Hook]): void {\n const hooks = this.store.get(name);\n if (hooks) {\n hooks.push(handler);\n } else {\n this.store.set(name, [handler]);\n }\n }\n\n /**\n * Checks if there are any hooks registered under the specified name.\n *\n * @param name - The name of the hook to check.\n * @returns `true` if there are hooks registered under the specified name, otherwise `false`.\n */\n has(name: HookName): boolean {\n return !!this.store.get(name)?.length;\n }\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n\nimport { AngularAppManifest } from '../manifest';\nimport { stripIndexHtmlFromURL, stripMatrixParams } from '../utils/url';\nimport { extractRoutesAndCreateRouteTree } from './ng-routes';\nimport { RouteTree, RouteTreeNodeMetadata } from './route-tree';\n\n/**\n * Manages the application's server routing logic by building and maintaining a route tree.\n *\n * This class is responsible for constructing the route tree from the Angular application\n * configuration and using it to match incoming requests to the appropriate routes.\n */\nexport class ServerRouter {\n /**\n * Creates an instance of the `ServerRouter`.\n *\n * @param routeTree - An instance of `RouteTree` that holds the routing information.\n * The `RouteTree` is used to match request URLs to the appropriate route metadata.\n */\n private constructor(private readonly routeTree: RouteTree) {}\n\n /**\n * Static property to track the ongoing build promise.\n */\n static #extractionPromise: Promise<ServerRouter> | undefined;\n\n /**\n * Creates or retrieves a `ServerRouter` instance based on the provided manifest and URL.\n *\n * If the manifest contains pre-built routes, a new `ServerRouter` is immediately created.\n * Otherwise, it builds the router by extracting routes from the Angular configuration\n * asynchronously. This method ensures that concurrent builds are prevented by re-using\n * the same promise.\n *\n * @param manifest - An instance of `AngularAppManifest` that contains the route information.\n * @param url - The URL for server-side rendering. The URL is needed to configure `ServerPlatformLocation`.\n * This is necessary to ensure that API requests for relative paths succeed, which is crucial for correct route extraction.\n * [Reference](https://github.com/angular/angular/blob/d608b857c689d17a7ffa33bbb510301014d24a17/packages/platform-server/src/location.ts#L51)\n * @returns A promise resolving to a `ServerRouter` instance.\n */\n static from(manifest: AngularAppManifest, url: URL): Promise<ServerRouter> {\n if (manifest.routes) {\n const routeTree = RouteTree.fromObject(manifest.routes);\n\n return Promise.resolve(new ServerRouter(routeTree));\n }\n\n // Create and store a new promise for the build process.\n // This prevents concurrent builds by re-using the same promise.\n ServerRouter.#extractionPromise ??= extractRoutesAndCreateRouteTree({ url, manifest })\n .then(({ routeTree, errors }) => {\n if (errors.length > 0) {\n throw new Error(\n 'Error(s) occurred while extracting routes:\\n' +\n errors.map((error) => `- ${error}`).join('\\n'),\n );\n }\n\n return new ServerRouter(routeTree);\n })\n .finally(() => {\n ServerRouter.#extractionPromise = undefined;\n });\n\n return ServerRouter.#extractionPromise;\n }\n\n /**\n * Matches a request URL against the route tree to retrieve route metadata.\n *\n * This method strips 'index.html' from the URL if it is present and then attempts\n * to find a match in the route tree. If a match is found, it returns the associated\n * route metadata; otherwise, it returns `undefined`.\n *\n * @param url - The URL to be matched against the route tree.\n * @returns The metadata for the matched route or `undefined` if no match is found.\n */\n match(url: URL): RouteTreeNodeMetadata | undefined {\n // Strip 'index.html' from URL if present.\n // A request to `http://www.example.com/page/index.html` will render the Angular route corresponding to `http://www.example.com/page`.\n let { pathname } = stripIndexHtmlFromURL(url);\n pathname = stripMatrixParams(pathname);\n\n return this.routeTree.match(pathname);\n }\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n\nimport {\n LOCALE_ID,\n REQUEST,\n REQUEST_CONTEXT,\n RESPONSE_INIT,\n StaticProvider,\n ɵresetCompiledComponents,\n} from '@angular/core';\nimport { createProcessor } from 'beasties/runtime';\nimport { ServerAssets } from './assets';\nimport { Hooks } from './hooks';\nimport { getAngularAppManifest } from './manifest';\nimport { RenderMode } from './routes/route-config';\nimport { RouteTreeNodeMetadata } from './routes/route-tree';\nimport { ServerRouter } from './routes/router';\nimport { AngularBootstrap, renderAngular } from './utils/ng';\nimport { promiseWithAbort } from './utils/promise';\nimport { createRedirectResponse } from './utils/redirect';\nimport { buildPathWithParams, joinUrlParts, stripLeadingSlash } from './utils/url';\n\n/**\n * A set of well-known URLs that are not handled by Angular.\n *\n * These URLs are typically for static assets or endpoints that should\n * bypass the Angular routing and rendering process.\n */\nconst WELL_KNOWN_NON_ANGULAR_URLS: ReadonlySet<string> = new Set<string>([\n '/favicon.ico',\n '/.well-known/appspecific/com.chrome.devtools.json',\n]);\n\n/**\n * A mapping of `RenderMode` enum values to corresponding string representations.\n *\n * This record is used to map each `RenderMode` to a specific string value that represents\n * the server context. The string values are used internally to differentiate\n * between various rendering strategies when processing routes.\n *\n * - `RenderMode.Prerender` maps to `'ssg'` (Static Site Generation).\n * - `RenderMode.Server` maps to `'ssr'` (Server-Side Rendering).\n * - `RenderMode.Client` maps to an empty string `''` (Client-Side Rendering, no server context needed).\n */\nconst SERVER_CONTEXT_VALUE: Record<RenderMode, string> = {\n [RenderMode.Prerender]: 'ssg',\n [RenderMode.Server]: 'ssr',\n [RenderMode.Client]: '',\n};\n\n/**\n * Options for configuring an `AngularServerApp`.\n */\ninterface AngularServerAppOptions {\n /**\n * Whether to allow rendering of prerendered routes.\n *\n * When enabled, prerendered routes will be served directly. When disabled, they will be\n * rendered on demand.\n *\n * Defaults to `false`.\n */\n allowStaticRouteRender?: boolean;\n\n /**\n * Hooks for extending or modifying server behavior.\n *\n * This allows customization of the server's rendering process and other lifecycle events.\n *\n * If not provided, a new `Hooks` instance is created.\n */\n hooks?: Hooks;\n}\n\n/**\n * Represents a locale-specific Angular server application managed by the server application engine.\n *\n * The `AngularServerApp` class handles server-side rendering and asset management for a specific locale.\n */\nexport class AngularServerApp {\n /**\n * Whether prerendered routes should be rendered on demand or served directly.\n *\n * @see {@link AngularServerAppOptions.allowStaticRouteRender} for more details.\n */\n private readonly allowStaticRouteRender: boolean;\n\n /**\n * Hooks for extending or modifying server behavior.\n *\n * @see {@link AngularServerAppOptions.hooks} for more details.\n */\n readonly hooks: Hooks;\n\n /**\n * Constructs an instance of `AngularServerApp`.\n *\n * @param options Optional configuration options for the server application.\n */\n constructor(private readonly options: Readonly<AngularServerAppOptions> = {}) {\n this.allowStaticRouteRender = this.options.allowStaticRouteRender ?? false;\n this.hooks = options.hooks ?? new Hooks();\n }\n\n /**\n * The manifest associated with this server application.\n */\n private readonly manifest = getAngularAppManifest();\n\n /**\n * An instance of ServerAsset that handles server-side asset.\n */\n private readonly assets = new ServerAssets(this.manifest);\n\n /**\n * The router instance used for route matching and handling.\n */\n private router: ServerRouter | undefined;\n\n /**\n * The `inlineCriticalCssProcessor` is responsible for handling critical CSS inlining.\n */\n private inlineCriticalCssProcessor?: (html: string) => string;\n\n /**\n * The bootstrap mechanism for the server application.\n */\n private boostrap: AngularBootstrap | undefined;\n\n /**\n * Encoder used to convert a string to a Uint8Array.\n */\n private readonly textEncoder = new TextEncoder();\n\n /**\n * Handles an incoming HTTP request by serving prerendered content, performing server-side rendering,\n * or delivering a static file for client-side rendered routes based on the `RenderMode` setting.\n *\n * @param request - The HTTP request to handle.\n * @param requestContext - Optional context for rendering, such as metadata associated with the request.\n * @returns A promise that resolves to the resulting HTTP response object, or `null` if no matching Angular route is found.\n *\n * @remarks A request to `https://www.example.com/page/index.html` will serve or render the Angular route\n * corresponding to `https://www.example.com/page`.\n */\n async handle(request: Request, requestContext?: unknown): Promise<Response | null> {\n const url = new URL(request.url);\n if (WELL_KNOWN_NON_ANGULAR_URLS.has(url.pathname)) {\n return null;\n }\n\n this.router ??= await ServerRouter.from(this.manifest, url);\n const matchedRoute = this.router.match(url);\n\n if (!matchedRoute) {\n // Not a known Angular route.\n return null;\n }\n\n const { redirectTo, status, renderMode, headers } = matchedRoute;\n\n if (redirectTo !== undefined) {\n return createRedirectResponse(\n joinUrlParts(\n request.headers.get('X-Forwarded-Prefix') ?? '',\n buildPathWithParams(redirectTo, url.pathname),\n ),\n status,\n headers,\n );\n }\n\n if (renderMode === RenderMode.Prerender) {\n const response = await this.handleServe(request, matchedRoute);\n if (response) {\n return response;\n }\n }\n\n return promiseWithAbort(\n this.handleRendering(request, matchedRoute, requestContext),\n request.signal,\n `Request for: ${request.url}`,\n );\n }\n\n /**\n * Handles serving a prerendered static asset if available for the matched route.\n *\n * This method only supports `GET` and `HEAD` requests.\n *\n * @param request - The incoming HTTP request for serving a static page.\n * @param matchedRoute - The metadata of the matched route for rendering.\n * @returns A promise that resolves to a `Response` object if the prerendered page is found, or `null`.\n */\n private async handleServe(\n request: Request,\n matchedRoute: RouteTreeNodeMetadata,\n ): Promise<Response | null> {\n const { headers, renderMode } = matchedRoute;\n if (renderMode !== RenderMode.Prerender) {\n return null;\n }\n\n const { method } = request;\n if (method !== 'GET' && method !== 'HEAD') {\n return null;\n }\n\n const assetPath = this.buildServerAssetPathFromRequest(request);\n const {\n manifest: { locale },\n assets,\n } = this;\n\n if (!assets.hasServerAsset(assetPath)) {\n return null;\n }\n\n const { text, hash, size } = assets.getServerAsset(assetPath);\n const etag = `\"${hash}\"`;\n\n return request.headers.get('if-none-match') === etag\n ? new Response(undefined, { status: 304, statusText: 'Not Modified' })\n : new Response(await text(), {\n headers: {\n 'Content-Length': size.toString(),\n 'ETag': etag,\n 'Content-Type': 'text/html;charset=UTF-8',\n ...(locale !== undefined ? { 'Content-Language': locale } : {}),\n ...headers,\n },\n });\n }\n\n /**\n * Handles the server-side rendering process for the given HTTP request.\n * This method matches the request URL to a route and performs rendering if a matching route is found.\n *\n * @param request - The incoming HTTP request to be processed.\n * @param matchedRoute - The metadata of the matched route for rendering.\n * @param requestContext - Optional additional context for rendering, such as request metadata.\n *\n * @returns A promise that resolves to the rendered response, or null if no matching route is found.\n */\n private async handleRendering(\n request: Request,\n matchedRoute: RouteTreeNodeMetadata,\n requestContext?: unknown,\n ): Promise<Response | null> {\n const { renderMode, headers, status, preload } = matchedRoute;\n\n if (!this.allowStaticRouteRender && renderMode === RenderMode.Prerender) {\n return null;\n }\n\n const url = new URL(request.url);\n const platformProviders: StaticProvider[] = [];\n\n const {\n manifest: { bootstrap, locale },\n assets,\n } = this;\n\n // Initialize the response with status and headers if available.\n const responseInit = {\n status,\n headers: new Headers({\n 'Content-Type': 'text/html;charset=UTF-8',\n ...(locale !== undefined ? { 'Content-Language': locale } : {}),\n ...headers,\n }),\n };\n\n if (renderMode === RenderMode.Server) {\n // Configure platform providers for request and response only for SSR.\n platformProviders.push(\n {\n provide: REQUEST,\n useValue: request,\n },\n {\n provide: REQUEST_CONTEXT,\n useValue: requestContext,\n },\n {\n provide: RESPONSE_INIT,\n useValue: responseInit,\n },\n );\n } else if (renderMode === RenderMode.Client) {\n // Serve the client-side rendered version if the route is configured for CSR.\n let html = await this.assets.getServerAsset('index.csr.html').text();\n html = await this.runTransformsOnHtml(html, url, preload);\n\n return new Response(html, responseInit);\n }\n\n if (locale !== undefined) {\n platformProviders.push({\n provide: LOCALE_ID,\n useValue: locale,\n });\n }\n\n this.boostrap ??= await bootstrap();\n let html = await assets.getIndexServerHtml().text();\n html = await this.runTransformsOnHtml(html, url, preload);\n\n const result = await renderAngular(\n html,\n this.boostrap,\n url,\n platformProviders,\n SERVER_CONTEXT_VALUE[renderMode],\n );\n\n if (result.hasNavigationError) {\n return null;\n }\n\n if (result.redirectTo) {\n return createRedirectResponse(result.redirectTo, responseInit.status, responseInit.headers);\n }\n\n if (renderMode === RenderMode.Prerender) {\n const renderedHtml = await result.content();\n const finalHtml = this.inlineCriticalCss(renderedHtml);\n\n return new Response(finalHtml, responseInit);\n }\n\n // Use a stream to send the response before finishing rendering and inling critical CSS, improving performance via header flushing.\n const stream = new ReadableStream({\n start: async (controller) => {\n try {\n let renderedHtml = await result.content();\n renderedHtml = this.inlineCriticalCss(renderedHtml);\n controller.enqueue(this.textEncoder.encode(renderedHtml));\n controller.close();\n } catch (error) {\n result.destroy();\n controller.error(error);\n }\n },\n cancel: () => {\n result.destroy();\n },\n });\n\n return new Response(stream, responseInit);\n }\n\n /**\n * Inlines critical CSS into the given HTML content.\n *\n * @param html The HTML content to process.\n * @returns The HTML with inlined critical CSS.\n */\n private inlineCriticalCss(html: string): string {\n const { criticalCssPlans, nonce } = this.manifest;\n if (!criticalCssPlans?.length) {\n return html;\n }\n\n try {\n this.inlineCriticalCssProcessor ??= createProcessor([...criticalCssPlans], {\n preload: 'media-script',\n nonce,\n preloadFonts: true,\n inlineFonts: true,\n noscriptFallback: true,\n cache: true,\n logger: {\n // eslint-disable-next-line no-console\n warn: console.warn,\n },\n }).process;\n\n return this.inlineCriticalCssProcessor(html);\n } catch (error) {\n // eslint-disable-next-line no-console\n console.error('An error occurred while inlining critical CSS.', error);\n\n return html;\n }\n }\n\n /**\n * Constructs the asset path on the server based on the provided HTTP request.\n *\n * This method processes the incoming request URL to derive a path corresponding\n * to the requested asset. It ensures the path points to the correct file (e.g.,\n * `index.html`) and removes any base href if it is not part of the asset path.\n *\n * @param request - The incoming HTTP request object.\n * @returns The server-relative asset path derived from the request.\n */\n private buildServerAssetPathFromRequest(request: Request): string {\n let { pathname: assetPath } = new URL(request.url);\n try {\n assetPath = decodeURIComponent(assetPath);\n } catch {\n // In case of malformed URI component, keep assetPath as is.\n }\n\n if (!assetPath.endsWith('/index.html')) {\n // Append \"index.html\" to build the default asset path.\n assetPath = joinUrlParts(assetPath, 'index.html');\n }\n\n const { baseHref } = this.manifest;\n\n // Check if the asset path starts with the base href and the base href is not (`/` or ``).\n if (baseHref.length > 1 && assetPath.startsWith(baseHref)) {\n // Remove the base href from the start of the asset path to align with server-asset expectations.\n assetPath = assetPath.slice(baseHref.length);\n }\n\n return stripLeadingSlash(assetPath);\n }\n\n /**\n * Runs the registered transform hooks on the given HTML content.\n *\n * @param html - The raw HTML content to be transformed.\n * @param url - The URL associated with the HTML content, used for context during transformations.\n * @param preload - An array of URLs representing the JavaScript resources to preload.\n * @returns A promise that resolves to the transformed HTML string.\n */\n private async runTransformsOnHtml(\n html: string,\n url: URL,\n preload: readonly string[] | undefined,\n ): Promise<string> {\n if (this.hooks.has('html:transform:pre')) {\n html = await this.hooks.run('html:transform:pre', { html, url });\n }\n\n if (preload?.length) {\n html = appendPreloadHintsToHtml(html, preload);\n }\n\n return html;\n }\n}\n\nlet angularServerApp: AngularServerApp | undefined;\n\n/**\n * Retrieves or creates an instance of `AngularServerApp`.\n * - If an instance of `AngularServerApp` already exists, it will return the existing one.\n * - If no instance exists, it will create a new one with the provided options.\n *\n * @param options Optional configuration options for the server application.\n *\n * @returns The existing or newly created instance of `AngularServerApp`.\n */\nexport function getOrCreateAngularServerApp(\n options?: Readonly<AngularServerAppOptions>,\n): AngularServerApp {\n return (angularServerApp ??= new AngularServerApp(options));\n}\n\n/**\n * Destroys the existing `AngularServerApp` instance, releasing associated resources and resetting the\n * reference to `undefined`.\n *\n * This function is primarily used to enable the recreation of the `AngularServerApp` instance,\n * typically when server configuration or application state needs to be refreshed.\n */\nexport function destroyAngularServerApp(): void {\n if (typeof ngDevMode === 'undefined' || ngDevMode) {\n // Need to clean up GENERATED_COMP_IDS map in `@angular/core`.\n // Otherwise an incorrect component ID generation collision detected warning will be displayed in development.\n // See: https://github.com/angular/angular-cli/issues/25924\n ɵresetCompiledComponents();\n }\n\n angularServerApp = undefined;\n}\n\n/**\n * Appends module preload hints to an HTML string for specified JavaScript resources.\n * This function enhances the HTML by injecting `<link rel=\"modulepreload\">` elements\n * for each provided resource, allowing browsers to preload the specified JavaScript\n * modules for better performance.\n *\n * @param html - The original HTML string to which preload hints will be added.\n * @param preload - An array of URLs representing the JavaScript resources to preload.\n * @returns The modified HTML string with the preload hints injected before the closing `</body>` tag.\n * If `</body>` is not found, the links are not added.\n */\nfunction appendPreloadHintsToHtml(html: string, preload: readonly string[]): string {\n const bodyCloseIdx = html.lastIndexOf('</body>');\n if (bodyCloseIdx === -1) {\n return html;\n }\n\n // Note: Module preloads should be placed at the end before the closing body tag to avoid a performance penalty.\n // Placing them earlier can cause the browser to prioritize downloading these modules\n // over other critical page resources like images, CSS, and fonts.\n return [\n html.slice(0, bodyCloseIdx),\n ...preload.map((val) => `<link rel=\"modulepreload\" href=\"${val}\">`),\n html.slice(bodyCloseIdx),\n ].join('\\n');\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n\n/**\n * Extracts a potential locale ID from a given URL based on the specified base path.\n *\n * This function parses the URL to locate a potential locale identifier that immediately\n * follows the base path segment in the URL's pathname. If the URL does not contain a valid\n * locale ID, an empty string is returned.\n *\n * @param url - The full URL from which to extract the locale ID.\n * @param basePath - The base path used as the reference point for extracting the locale ID.\n * @returns The extracted locale ID if present, or an empty string if no valid locale ID is found.\n *\n * @example\n * ```js\n * const url = new URL('https://example.com/base/en/page');\n * const basePath = '/base';\n * const localeId = getPotentialLocaleIdFromUrl(url, basePath);\n * console.log(localeId); // Output: 'en'\n * ```\n */\nexport function getPotentialLocaleIdFromUrl(url: URL, basePath: string): string {\n const { pathname } = url;\n\n // Move forward of the base path section.\n let start = basePath.length;\n if (pathname[start] === '/') {\n start++;\n }\n\n // Find the next forward slash.\n let end = pathname.indexOf('/', start);\n if (end === -1) {\n end = pathname.length;\n }\n\n // Extract the potential locale id.\n return pathname.slice(start, end);\n}\n\n/**\n * Parses the `Accept-Language` header and returns a list of locale preferences with their respective quality values.\n *\n * The `Accept-Language` header is typically a comma-separated list of locales, with optional quality values\n * in the form of `q=<value>`. If no quality value is specified, a default quality of `1` is assumed.\n * Special case: if the header is `*`, it returns the default locale with a quality of `1`.\n *\n * @param header - The value of the `Accept-Language` header, typically a comma-separated list of locales\n * with optional quality values (e.g., `en-US;q=0.8,fr-FR;q=0.9`). If the header is `*`,\n * it represents a wildcard for any language, returning the default locale.\n *\n * @returns A `ReadonlyMap` where the key is the locale (e.g., `en-US`, `fr-FR`), and the value is\n * the associated quality value (a number between 0 and 1). If no quality value is provided,\n * a default of `1` is used.\n *\n * @example\n * ```js\n * parseLanguageHeader('en-US;q=0.8,fr-FR;q=0.9')\n * // returns new Map([['en-US', 0.8], ['fr-FR', 0.9]])\n\n * parseLanguageHeader('*')\n * // returns new Map([['*', 1]])\n * ```\n */\nfunction parseLanguageHeader(header: string): ReadonlyMap<string, number> {\n if (header === '*') {\n return new Map([['*', 1]]);\n }\n\n const parsedValues = header\n .split(',')\n .map((item) => {\n const [locale, qualityValue] = item.split(';', 2).map((v) => v.trim());\n\n let quality = qualityValue?.startsWith('q=') ? parseFloat(qualityValue.slice(2)) : undefined;\n if (typeof quality !== 'number' || isNaN(quality) || quality < 0 || quality > 1) {\n quality = 1; // Invalid quality value defaults to 1\n }\n\n return [locale, quality] as const;\n })\n .sort(([_localeA, qualityA], [_localeB, qualityB]) => qualityB - qualityA);\n\n return new Map(parsedValues);\n}\n\n/**\n * Gets the preferred locale based on the highest quality value from the provided `Accept-Language` header\n * and the set of available locales.\n *\n * This function adheres to the HTTP `Accept-Language` header specification as defined in\n * [RFC 7231](https://datatracker.ietf.org/doc/html/rfc7231#section-5.3.5), including:\n * - Case-insensitive matching of language tags.\n * - Quality value handling (e.g., `q=1`, `q=0.8`). If no quality value is provided, it defaults to `q=1`.\n * - Prefix matching (e.g., `en` matching `en-US` or `en-GB`).\n *\n * @param header - The `Accept-Language` header string to parse and evaluate. It may contain multiple\n * locales with optional quality values, for example: `'en-US;q=0.8,fr-FR;q=0.9'`.\n * @param supportedLocales - An array of supported locales (e.g., `['en-US', 'fr-FR']`),\n * representing the locales available in the application.\n * @returns The best matching locale from the supported languages, or `undefined` if no match is found.\n *\n * @example\n * ```js\n * getPreferredLocale('en-US;q=0.8,fr-FR;q=0.9', ['en-US', 'fr-FR', 'de-DE'])\n * // returns 'fr-FR'\n *\n * getPreferredLocale('en;q=0.9,fr-FR;q=0.8', ['en-US', 'fr-FR', 'de-DE'])\n * // returns 'en-US'\n *\n * getPreferredLocale('es-ES;q=0.7', ['en-US', 'fr-FR', 'de-DE'])\n * // returns undefined\n * ```\n */\nexport function getPreferredLocale(\n header: string,\n supportedLocales: ReadonlyArray<string>,\n): string | undefined {\n if (supportedLocales.length < 2) {\n return supportedLocales[0];\n }\n\n const parsedLocales = parseLanguageHeader(header);\n\n // Handle edge cases:\n // - No preferred locales provided.\n // - Only one supported locale.\n // - Wildcard preference.\n if (parsedLocales.size === 0 || (parsedLocales.size === 1 && parsedLocales.has('*'))) {\n return supportedLocales[0];\n }\n\n // Create a map for case-insensitive lookup of supported locales.\n // Keys are normalized (lowercase) locale values, values are original casing.\n const normalizedSupportedLocales = new Map<string, string>();\n for (const locale of supportedLocales) {\n normalizedSupportedLocales.set(normalizeLocale(locale), locale);\n }\n\n // Iterate through parsed locales in descending order of quality.\n let bestMatch: string | undefined;\n const qualityZeroNormalizedLocales = new Set<string>();\n for (const [locale, quality] of parsedLocales) {\n const normalizedLocale = normalizeLocale(locale);\n if (quality === 0) {\n qualityZeroNormalizedLocales.add(normalizedLocale);\n continue; // Skip locales with quality value of 0.\n }\n\n // Exact match found.\n if (normalizedSupportedLocales.has(normalizedLocale)) {\n return normalizedSupportedLocales.get(normalizedLocale);\n }\n\n // If an exact match is not found, try prefix matching (e.g., \"en\" matches \"en-US\").\n // Store the first prefix match encountered, as it has the highest quality value.\n if (bestMatch !== undefined) {\n continue;\n }\n\n const [languagePrefix] = normalizedLocale.split('-', 1);\n for (const supportedLocale of normalizedSupportedLocales.keys()) {\n if (supportedLocale.startsWith(languagePrefix)) {\n bestMatch = normalizedSupportedLocales.get(supportedLocale);\n break; // No need to continue searching for this locale.\n }\n }\n }\n\n if (bestMatch !== undefined) {\n return bestMatch;\n }\n\n // Return the first locale that is not quality zero.\n for (const [normalizedLocale, locale] of normalizedSupportedLocales) {\n if (!qualityZeroNormalizedLocales.has(normalizedLocale)) {\n return locale;\n }\n }\n}\n\n/**\n * Normalizes a locale string by converting it to lowercase.\n *\n * @param locale - The locale string to normalize.\n * @returns The normalized locale string in lowercase.\n *\n * @example\n * ```ts\n * const normalized = normalizeLocale('EN-US');\n * console.log(normalized); // Output: \"en-us\"\n * ```\n */\nfunction normalizeLocale(locale: string): string {\n return locale.toLowerCase();\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n\nimport type { AngularServerApp, getOrCreateAngularServerApp } from './app';\nimport { Hooks } from './hooks';\nimport { getPotentialLocaleIdFromUrl, getPreferredLocale } from './i18n';\nimport { EntryPointExports, getAngularAppEngineManifest } from './manifest';\nimport { createRedirectResponse } from './utils/redirect';\nimport { joinUrlParts } from './utils/url';\nimport {\n normalizeTrustProxyHeaders,\n sanitizeRequestHeaders,\n validateRequest,\n} from './utils/validation';\n\n/**\n * Options for the Angular server application engine.\n */\nexport interface AngularAppEngineOptions {\n /**\n * A set of allowed hostnames for the server application.\n */\n allowedHosts?: readonly string[];\n\n /**\n * Extends the scope of trusted proxy headers (`Forwarded` or `X-Forwarded-*`).\n *\n * @remarks\n * **This is a security-sensitive option!**\n *\n * When `trustProxyHeaders` is enabled, request headers such as `Forwarded`, `X-Forwarded-Host`, and\n * `X-Forwarded-Prefix` are trusted by the server and used for routing. These\n * headers must be strictly validated and provided by a trusted client (e.g., at a reverse proxy, load\n * balancer, or API gateway) and must *not* be provided by untrusted end users.\n *\n * If a `string[]` is provided, only those proxy headers are allowed.\n * If `true`, all proxy headers are allowed.\n * If `false` or not provided, proxy headers are ignored.\n *\n * @default false\n */\n trustProxyHeaders?: boolean | readonly string[];\n}\n\n/**\n * Angular server application engine.\n * Manages Angular server applications (including localized ones), handles rendering requests,\n * and optionally transforms index HTML before rendering.\n *\n * @remarks This class should be instantiated once and used as a singleton across the server-side\n * application to ensure consistent handling of rendering requests and resource management.\n */\nexport class AngularAppEngine {\n /**\n * A flag to enable or disable the rendering of prerendered routes.\n *\n * Typically used during development to avoid prerendering all routes ahead of time,\n * allowing them to be rendered on the fly as requested.\n *\n * @private\n */\n static ɵallowStaticRouteRender = false;\n\n /**\n * A flag to enable or disable the allowed hosts check.\n *\n * Typically used during development to avoid the allowed hosts check.\n *\n * @private\n */\n static ɵdisableAllowedHostsCheck = false;\n\n /**\n * Hooks for extending or modifying the behavior of the server application.\n * These hooks are used by the Angular CLI when running the development server and\n * provide extensibility points for the application lifecycle.\n *\n * @private\n */\n static ɵhooks: Hooks = /* #__PURE__*/ new Hooks();\n\n /**\n * The manifest for the server application.\n */\n private readonly manifest = getAngularAppEngineManifest();\n\n /**\n * A set of allowed hostnames for the server application.\n */\n private readonly allowedHosts: ReadonlySet<string>;\n\n /**\n * A map of supported locales from the server application's manifest.\n */\n private readonly supportedLocales: ReadonlyArray<string> = Object.keys(\n this.manifest.supportedLocales,\n );\n\n /**\n * The normalized allowed proxy headers.\n */\n private readonly trustProxyHeaders: ReadonlySet<string>;\n\n /**\n * A cache that holds entry points, keyed by their potential locale string.\n */\n private readonly entryPointsCache = new Map<string, Promise<EntryPointExports>>();\n\n /**\n * Creates a new instance of the Angular server application engine.\n * @param options Options for the Angular server application engine.\n */\n constructor(options?: AngularAppEngineOptions) {\n this.allowedHosts = this.getAllowedHosts(options);\n this.trustProxyHeaders = normalizeTrustProxyHeaders(options?.trustProxyHeaders);\n }\n\n private getAllowedHosts(options: AngularAppEngineOptions | undefined): ReadonlySet<string> {\n const allowedHosts = new Set([...(options?.allowedHosts ?? []), ...this.manifest.allowedHosts]);\n\n if (allowedHosts.has('*')) {\n // eslint-disable-next-line no-console\n console.warn(\n 'Allowing all hosts via \"*\" is a security risk. This configuration should only be used when ' +\n 'validation for \"Host\" and \"X-Forwarded-Host\" headers is performed in another layer, such as a load balancer or reverse proxy. ' +\n 'For more information see: https://angular.dev/best-practices/security#preventing-server-side-request-forgery-ssrf',\n );\n }\n\n return allowedHosts;\n }\n\n /**\n * Handles an incoming HTTP request by serving prerendered content, performing server-side rendering,\n * or delivering a static file for client-side rendered routes based on the `RenderMode` setting.\n *\n * @param request - The HTTP request to handle.\n * @param requestContext - Optional context for rendering, such as metadata associated with the request.\n * @returns A promise that resolves to the resulting HTTP response object, or `null` if no matching Angular route is found.\n *\n * @remarks A request to `https://www.example.com/page/index.html` will serve or render the Angular route\n * corresponding to `https://www.example.com/page`.\n *\n * @remarks\n * To prevent potential Server-Side Request Forgery (SSRF), this function verifies the hostname\n * of the `request.url` against a list of authorized hosts.\n * If the hostname is not recognized a 400 Bad Request is returned.\n *\n * Resolution:\n * Authorize your hostname by configuring `allowedHosts` in `angular.json` in:\n * `projects.[project-name].architect.build.options.security.allowedHosts`.\n * Alternatively, you pass it directly through the configuration options of `AngularAppEngine`.\n *\n * For more information see: https://angular.dev/best-practices/security#preventing-server-side-request-forgery-ssrf\n */\n async handle(request: Request, requestContext?: unknown): Promise<Response | null> {\n const allowedHost = this.allowedHosts;\n const securedRequest = sanitizeRequestHeaders(request, this.trustProxyHeaders);\n\n try {\n validateRequest(securedRequest, allowedHost, AngularAppEngine.ɵdisableAllowedHostsCheck);\n } catch (error) {\n return this.handleValidationError(securedRequest.url, error as Error);\n }\n\n const serverApp = await this.getAngularServerAppForRequest(securedRequest);\n if (serverApp) {\n return serverApp.handle(securedRequest, requestContext);\n }\n\n if (this.supportedLocales.length > 1) {\n // Redirect to the preferred language if i18n is enabled.\n return this.redirectBasedOnAcceptLanguage(securedRequest);\n }\n\n return null;\n }\n\n /**\n * Handles requests for the base path when i18n is enabled.\n * Redirects the user to a locale-specific path based on the `Accept-Language` header.\n *\n * @param request The incoming request.\n * @returns A `Response` object with a 302 redirect, or `null` if i18n is not enabled\n * or the request is not for the base path.\n */\n private redirectBasedOnAcceptLanguage(request: Request): Response | null {\n const { basePath, supportedLocales } = this.manifest;\n\n // If the request is not for the base path, it's not our responsibility to handle it.\n const { pathname } = new URL(request.url);\n if (pathname !== basePath) {\n return null;\n }\n\n // For requests to the base path (typically '/'), attempt to extract the preferred locale\n // from the 'Accept-Language' header.\n const preferredLocale = getPreferredLocale(\n request.headers.get('Accept-Language') || '*',\n this.supportedLocales,\n );\n\n if (preferredLocale) {\n const subPath = supportedLocales[preferredLocale];\n if (subPath !== undefined) {\n const prefix = request.headers.get('X-Forwarded-Prefix') ?? '';\n\n return createRedirectResponse(\n joinUrlParts(prefix, pathname, subPath),\n 302,\n // Use a 302 redirect as language preference may change.\n { 'Vary': 'Accept-Language' },\n );\n }\n }\n\n return null;\n }\n\n /**\n * Retrieves the Angular server application instance for a given request.\n *\n * This method checks if the request URL corresponds to an Angular application entry point.\n * If so, it initializes or retrieves an instance of the Angular server application for that entry point.\n * Requests that resemble file requests (except for `/index.html`) are skipped.\n *\n * @param request - The incoming HTTP request object.\n * @returns A promise that resolves to an `AngularServerApp` instance if a valid entry point is found,\n * or `null` if no entry point matches the request URL.\n */\n private async getAngularServerAppForRequest(request: Request): Promise<AngularServerApp | null> {\n // Skip if the request looks like a file but not `/index.html`.\n const url = new URL(request.url);\n const entryPoint = await this.getEntryPointExportsForUrl(url);\n if (!entryPoint) {\n return null;\n }\n\n // Note: Using `instanceof` is not feasible here because `AngularServerApp` will\n // be located in separate bundles, making `instanceof` checks unreliable.\n const ɵgetOrCreateAngularServerApp =\n entryPoint.ɵgetOrCreateAngularServerApp as typeof getOrCreateAngularServerApp;\n\n const serverApp = ɵgetOrCreateAngularServerApp({\n allowStaticRouteRender: AngularAppEngine.ɵallowStaticRouteRender,\n hooks: AngularAppEngine.ɵhooks,\n });\n\n return serverApp;\n }\n\n /**\n * Retrieves the exports for a specific entry point, caching the result.\n *\n * @param potentialLocale - The locale string used to find the corresponding entry point.\n * @returns A promise that resolves to the entry point exports or `undefined` if not found.\n */\n private getEntryPointExports(potentialLocale: string): Promise<EntryPointExports> | undefined {\n const cachedEntryPoint = this.entryPointsCache.get(potentialLocale);\n if (cachedEntryPoint) {\n return cachedEntryPoint;\n }\n\n const { entryPoints } = this.manifest;\n const entryPoint = entryPoints[potentialLocale];\n if (!entryPoint) {\n return undefined;\n }\n\n const entryPointExports = entryPoint();\n this.entryPointsCache.set(potentialLocale, entryPointExports);\n\n return entryPointExports;\n }\n\n /**\n * Retrieves the entry point for a given URL by determining the locale and mapping it to\n * the appropriate application bundle.\n *\n * This method determines the appropriate entry point and locale for rendering the application by examining the URL.\n * If there is only one entry point available, it is returned regardless of the URL.\n * Otherwise, the method extracts a potential locale identifier from the URL and looks up the corresponding entry point.\n *\n * @param url - The URL of the request.\n * @returns A promise that resolves to the entry point exports or `undefined` if not found.\n */\n private getEntryPointExportsForUrl(url: URL): Promise<EntryPointExports> | undefined {\n const { basePath, supportedLocales } = this.manifest;\n\n if (this.supportedLocales.length === 1) {\n return this.getEntryPointExports(supportedLocales[this.supportedLocales[0]]);\n }\n\n const potentialLocale = getPotentialLocaleIdFromUrl(url, basePath);\n\n return this.getEntryPointExports(potentialLocale) ?? this.getEntryPointExports('');\n }\n\n /**\n * Handles validation errors by logging the error and returning an appropriate response.\n *\n * @param url - The URL of the request.\n * @param error - The validation error to handle.\n * @returns A `Response` object with a 400 status code.\n */\n private handleValidationError(url: string, error: Error): Response {\n const errorMessage = error.message;\n // eslint-disable-next-line no-console\n console.error(\n `ERROR: Bad Request (\"${url}\").\\n` +\n errorMessage +\n '\\n\\nFor more information, see https://angular.dev/best-practices/security#preventing-server-side-request-forgery-ssrf',\n );\n\n return new Response(errorMessage, {\n status: 400,\n statusText: 'Bad Request',\n headers: { 'Content-Type': 'text/plain' },\n });\n }\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n\n/**\n * Function for handling HTTP requests in a web environment.\n *\n * @param request - The incoming HTTP request object.\n * @returns A Promise resolving to a `Response` object, `null`, or directly a `Response`,\n * supporting both synchronous and asynchronous handling.\n */\nexport type RequestHandlerFunction = (\n request: Request,\n) => Promise<Response | null> | null | Response;\n\n/**\n * Annotates a request handler function with metadata, marking it as a special\n * handler.\n *\n * @param handler - The request handler function to be annotated.\n * @returns The same handler function passed in, with metadata attached.\n *\n * @example\n * Example usage in a Hono application:\n * ```ts\n * const app = new Hono();\n * export default createRequestHandler(app.fetch);\n * ```\n *\n * @example\n * Example usage in a H3 application:\n * ```ts\n * const app = createApp();\n * const handler = toWebHandler(app);\n * export default createRequestHandler(handler);\n * ```\n */\nexport function createRequestHandler(handler: RequestHandlerFunction): RequestHandlerFunction {\n (handler as RequestHandlerFunction & { __ng_request_handler__?: boolean })[\n '__ng_request_handler__'\n ] = true;\n\n return handler;\n}\n"],"names":["ɵConsole","SERVER_CONTEXT","renderInternal","provideServerRenderingPlatformServer","loadChildrenHelper","ɵENABLE_ROOT_COMPONENT_BOOTSTRAP","ɵresetCompiledComponents"],"mappings":";;;;;;;MAaa,YAAY,CAAA;EAMM,QAAA;EAA7B,WAAA,CAA6B,QAA4B,EAAA;IAA5B,IAAA,CAAA,QAAQ,GAAR,QAAQ;AAAuB,EAAA;EAS5D,cAAc,CAAC,IAAY,EAAA;IACzB,MAAM,KAAK,GAAG,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,IAAI,CAAC;IACxC,IAAI,CAAC,KAAK,EAAE;AACV,MAAA,MAAM,IAAI,KAAK,CAAC,CAAA,cAAA,EAAiB,IAAI,mBAAmB,CAAC;AAC3D,IAAA;AAEA,IAAA,OAAO,KAAK;AACd,EAAA;EAQA,cAAc,CAAC,IAAY,EAAA;IACzB,OAAO,CAAC,CA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