@angular/core
Version:
Angular - the core framework
1 lines • 471 kB
Source Map (JSON)
{"version":3,"file":"core.mjs","sources":["../../../../../darwin_arm64-fastbuild-ST-fdfa778d11ba/bin/packages/core/src/authoring/input/input_signal_node.ts","../../../../../darwin_arm64-fastbuild-ST-fdfa778d11ba/bin/packages/core/src/authoring/input/input_signal.ts","../../../../../darwin_arm64-fastbuild-ST-fdfa778d11ba/bin/packages/core/primitives/devtools/src/framework.ts","../../../../../darwin_arm64-fastbuild-ST-fdfa778d11ba/bin/packages/core/src/di/host_attribute_token.ts","../../../../../darwin_arm64-fastbuild-ST-fdfa778d11ba/bin/packages/core/src/di/host_tag_name_token.ts","../../../../../darwin_arm64-fastbuild-ST-fdfa778d11ba/bin/packages/core/src/util/default_export.ts","../../../../../darwin_arm64-fastbuild-ST-fdfa778d11ba/bin/packages/core/src/di/inject_async.ts","../../../../../darwin_arm64-fastbuild-ST-fdfa778d11ba/bin/packages/core/src/compiler/compiler_facade_interface.ts","../../../../../darwin_arm64-fastbuild-ST-fdfa778d11ba/bin/packages/core/src/authoring/output/output.ts","../../../../../darwin_arm64-fastbuild-ST-fdfa778d11ba/bin/packages/core/src/authoring/input/input.ts","../../../../../darwin_arm64-fastbuild-ST-fdfa778d11ba/bin/packages/core/src/authoring/model/model_signal.ts","../../../../../darwin_arm64-fastbuild-ST-fdfa778d11ba/bin/packages/core/src/authoring/model/model.ts","../../../../../darwin_arm64-fastbuild-ST-fdfa778d11ba/bin/packages/core/src/authoring/queries.ts","../../../../../darwin_arm64-fastbuild-ST-fdfa778d11ba/bin/packages/core/src/application/application_config.ts","../../../../../darwin_arm64-fastbuild-ST-fdfa778d11ba/bin/packages/core/src/metadata/di.ts","../../../../../darwin_arm64-fastbuild-ST-fdfa778d11ba/bin/packages/core/src/application/application_module.ts","../../../../../darwin_arm64-fastbuild-ST-fdfa778d11ba/bin/packages/core/src/application/platform_tokens.ts","../../../../../darwin_arm64-fastbuild-ST-fdfa778d11ba/bin/packages/core/src/hydration/event_replay.ts","../../../../../darwin_arm64-fastbuild-ST-fdfa778d11ba/bin/packages/core/src/hydration/api.ts","../../../../../darwin_arm64-fastbuild-ST-fdfa778d11ba/bin/packages/core/src/application/stability_debug_impl.ts","../../../../../darwin_arm64-fastbuild-ST-fdfa778d11ba/bin/packages/core/src/change_detection/differs/default_iterable_differ.ts","../../../../../darwin_arm64-fastbuild-ST-fdfa778d11ba/bin/packages/core/src/change_detection/differs/default_keyvalue_differ.ts","../../../../../darwin_arm64-fastbuild-ST-fdfa778d11ba/bin/packages/core/src/change_detection/differs/iterable_differs.ts","../../../../../darwin_arm64-fastbuild-ST-fdfa778d11ba/bin/packages/core/src/change_detection/differs/keyvalue_differs.ts","../../../../../darwin_arm64-fastbuild-ST-fdfa778d11ba/bin/packages/core/src/change_detection/change_detector_ref.ts","../../../../../darwin_arm64-fastbuild-ST-fdfa778d11ba/bin/packages/core/src/change_detection/change_detection.ts","../../../../../darwin_arm64-fastbuild-ST-fdfa778d11ba/bin/packages/core/src/change_detection/scheduling/exhaustive_check_no_changes.ts","../../../../../darwin_arm64-fastbuild-ST-fdfa778d11ba/bin/packages/core/src/change_detection/provide_check_no_changes_config.ts","../../../../../darwin_arm64-fastbuild-ST-fdfa778d11ba/bin/packages/core/src/change_detection/scheduling/ng_zone_scheduling.ts","../../../../../darwin_arm64-fastbuild-ST-fdfa778d11ba/bin/packages/core/src/application/application_ngmodule_factory_compiler.ts","../../../../../darwin_arm64-fastbuild-ST-fdfa778d11ba/bin/packages/core/src/image_performance_warning.ts","../../../../../darwin_arm64-fastbuild-ST-fdfa778d11ba/bin/packages/core/src/platform/platform_destroy_listeners.ts","../../../../../darwin_arm64-fastbuild-ST-fdfa778d11ba/bin/packages/core/src/platform/bootstrap.ts","../../../../../darwin_arm64-fastbuild-ST-fdfa778d11ba/bin/packages/core/src/platform/platform_ref.ts","../../../../../darwin_arm64-fastbuild-ST-fdfa778d11ba/bin/packages/core/src/debug/ai/serialized_di_graph.ts","../../../../../darwin_arm64-fastbuild-ST-fdfa778d11ba/bin/packages/core/src/debug/ai/di_graph.ts","../../../../../darwin_arm64-fastbuild-ST-fdfa778d11ba/bin/packages/core/src/debug/ai/signal_graph.ts","../../../../../darwin_arm64-fastbuild-ST-fdfa778d11ba/bin/packages/core/src/debug/ai/registration.ts","../../../../../darwin_arm64-fastbuild-ST-fdfa778d11ba/bin/packages/core/src/platform/platform.ts","../../../../../darwin_arm64-fastbuild-ST-fdfa778d11ba/bin/packages/core/src/application/create_application.ts","../../../../../darwin_arm64-fastbuild-ST-fdfa778d11ba/bin/packages/core/src/hydration/annotate.ts","../../../../../darwin_arm64-fastbuild-ST-fdfa778d11ba/bin/packages/core/src/profiler.ts","../../../../../darwin_arm64-fastbuild-ST-fdfa778d11ba/bin/packages/core/src/type_checking.ts","../../../../../darwin_arm64-fastbuild-ST-fdfa778d11ba/bin/packages/core/src/util/coercion.ts","../../../../../darwin_arm64-fastbuild-ST-fdfa778d11ba/bin/packages/core/src/render3/reactivity/after_render_effect.ts","../../../../../darwin_arm64-fastbuild-ST-fdfa778d11ba/bin/packages/core/src/render3/jit/partial.ts","../../../../../darwin_arm64-fastbuild-ST-fdfa778d11ba/bin/packages/core/src/linker/ng_module_factory_loader.ts","../../../../../darwin_arm64-fastbuild-ST-fdfa778d11ba/bin/packages/core/src/linker/view_ref.ts","../../../../../darwin_arm64-fastbuild-ST-fdfa778d11ba/bin/packages/core/src/platform/platform_core_providers.ts","../../../../../darwin_arm64-fastbuild-ST-fdfa778d11ba/bin/packages/core/src/render3/component.ts","../../../../../darwin_arm64-fastbuild-ST-fdfa778d11ba/bin/packages/core/src/resource/from_snapshots.ts","../../../../../darwin_arm64-fastbuild-ST-fdfa778d11ba/bin/packages/core/src/resource/debounce.ts","../../../../../darwin_arm64-fastbuild-ST-fdfa778d11ba/bin/packages/core/src/util/is_dev_mode.ts","../../../../../darwin_arm64-fastbuild-ST-fdfa778d11ba/bin/packages/core/src/webmcp/declare_tool.ts","../../../../../darwin_arm64-fastbuild-ST-fdfa778d11ba/bin/packages/core/src/webmcp/provide_tools.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 {SIGNAL_NODE, SignalNode, signalSetFn} from '../../../primitives/signals';\n\nexport const REQUIRED_UNSET_VALUE: unique symbol = /* @__PURE__ */ Symbol('InputSignalNode#UNSET');\n\n/**\n * Reactive node type for an input signal. An input signal extends a signal.\n * There are special properties to enable transforms and required inputs.\n */\nexport interface InputSignalNode<T, TransformT> extends SignalNode<T> {\n /**\n * User-configured transform that will run whenever a new value is applied\n * to the input signal node.\n */\n transformFn: ((value: TransformT) => T) | undefined;\n\n /**\n * Applies a new value to the input signal. Expects transforms to be run\n * manually before.\n *\n * This function is called by the framework runtime code whenever a binding\n * changes. The value can in practice be anything at runtime, but for typing\n * purposes we assume it's a valid `T` value. Type-checking will enforce that.\n */\n applyValueToInputSignal<T, TransformT>(node: InputSignalNode<T, TransformT>, value: T): void;\n\n /**\n * A debug name for the input signal. Used in Angular DevTools to identify the signal.\n */\n debugName?: string;\n}\n\n// Note: Using an IIFE here to ensure that the spread assignment is not considered\n// a side-effect, ending up preserving `COMPUTED_NODE` and `REACTIVE_NODE`.\nexport const INPUT_SIGNAL_NODE: InputSignalNode<unknown, unknown> = /* @__PURE__ */ (() => {\n return {\n ...SIGNAL_NODE,\n transformFn: undefined,\n\n applyValueToInputSignal<T, TransformT>(node: InputSignalNode<T, TransformT>, value: T) {\n signalSetFn(node, value);\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 {producerAccessed, SIGNAL} from '../../../primitives/signals';\n\nimport {RuntimeError, RuntimeErrorCode} from '../../errors';\nimport {Signal} from '../../render3/reactivity/api';\n\nimport {INPUT_SIGNAL_NODE, InputSignalNode, REQUIRED_UNSET_VALUE} from './input_signal_node';\n\n/**\n * @publicAPI\n * @see [Input aliases](guide/components/inputs#input-aliases)\n * @see [Input transforms](guide/components/inputs#input-transforms)\n *\n * Options for signal inputs.\n */\nexport interface InputOptions<T, TransformT> {\n /** Optional public name for the input. By default, the class field name is used. */\n alias?: string;\n /**\n * Optional transform that runs whenever a new value is bound. Can be used to\n * transform the input value before the input is updated.\n *\n * The transform function can widen the type of the input. For example, consider\n * an input for `disabled`. In practice, as the component author, you want to only\n * deal with a boolean, but users may want to bind a string if they just use the\n * attribute form to bind to the input via `<my-dir input>`. A transform can then\n * handle such string values and convert them to `boolean`. See: {@link booleanAttribute}.\n */\n transform?: (v: TransformT) => T;\n\n /**\n * A debug name for the input signal. Used in Angular DevTools to identify the signal.\n */\n debugName?: string;\n}\n\n/**\n * Signal input options without the transform option.\n *\n * @publicApi 19.0\n */\nexport type InputOptionsWithoutTransform<T> =\n // Note: We still keep a notion of `transform` for auto-completion.\n Omit<InputOptions<T, T>, 'transform'> & {transform?: undefined};\n/**\n * Signal input options with the transform option required.\n *\n * @publicAPI\n */\nexport type InputOptionsWithTransform<T, TransformT> = Required<\n Pick<InputOptions<T, TransformT>, 'transform'>\n> &\n InputOptions<T, TransformT>;\n\nexport const ɵINPUT_SIGNAL_BRAND_READ_TYPE: unique symbol = /* @__PURE__ */ Symbol();\nexport const ɵINPUT_SIGNAL_BRAND_WRITE_TYPE: unique symbol = /* @__PURE__ */ Symbol();\n\n/**\n * `InputSignalWithTransform` represents a special `Signal` for a\n * directive/component input with a `transform` function.\n *\n * Signal inputs with transforms capture an extra generic for their transform write\n * type. Transforms can expand the accepted bound values for an input while ensuring\n * value retrievals of the signal input are still matching the generic input type.\n *\n * ```ts\n * class MyDir {\n * disabled = input(false, {\n * transform: (v: string|boolean) => convertToBoolean(v),\n * }); // InputSignalWithTransform<boolean, string|boolean>\n *\n * click() {\n * this.disabled() // always returns a `boolean`.\n * }\n * }\n * ```\n *\n * @see {@link InputSignal} for additional information.\n *\n * @publicApi 19.0\n */\nexport interface InputSignalWithTransform<T, TransformT> extends Signal<T> {\n [SIGNAL]: InputSignalNode<T, TransformT>;\n [ɵINPUT_SIGNAL_BRAND_READ_TYPE]: T;\n [ɵINPUT_SIGNAL_BRAND_WRITE_TYPE]: TransformT;\n}\n\n/**\n * `InputSignal` represents a special `Signal` for a directive/component input.\n *\n * An input signal is similar to a non-writable signal except that it also\n * carries additional type-information for transforms, and that Angular internally\n * updates the signal whenever a new value is bound.\n *\n * @see {@link InputOptionsWithTransform} for inputs with transforms.\n *\n * @publicApi 19.0\n */\nexport interface InputSignal<T> extends InputSignalWithTransform<T, T> {}\n\n/**\n * Creates an input signal.\n *\n * @param initialValue The initial value.\n * Can be set to {@link REQUIRED_UNSET_VALUE} for required inputs.\n * @param options Additional options for the input. e.g. a transform, or an alias.\n */\nexport function createInputSignal<T, TransformT>(\n initialValue: T,\n options?: InputOptions<T, TransformT>,\n): InputSignalWithTransform<T, TransformT> {\n const node: InputSignalNode<T, TransformT> = Object.create(INPUT_SIGNAL_NODE);\n\n node.value = initialValue;\n\n // Perf note: Always set `transformFn` here to ensure that `node` always\n // has the same v8 class shape, allowing monomorphic reads on input signals.\n node.transformFn = options?.transform;\n\n function inputValueFn() {\n // Record that someone looked at this signal.\n producerAccessed(node);\n\n if (node.value === REQUIRED_UNSET_VALUE) {\n let message: string | null = null;\n if (ngDevMode) {\n const name = options?.debugName ?? options?.alias;\n message = `Input${name ? ` \"${name}\"` : ''} is required but no value is available yet.`;\n }\n throw new RuntimeError(RuntimeErrorCode.REQUIRED_INPUT_NO_VALUE, message);\n }\n\n return node.value;\n }\n\n (inputValueFn as any)[SIGNAL] = node;\n\n if (ngDevMode) {\n inputValueFn.toString = () => `[Input Signal: ${inputValueFn()}]`;\n node.debugName = options?.debugName;\n }\n\n return inputValueFn as InputSignalWithTransform<T, TransformT>;\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/** The framework used to author a particular application or component. */\nexport enum Framework {\n Angular = 'angular',\n ACX = 'acx',\n Wiz = 'wiz',\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 {ɵɵinjectAttribute} from '../render3/instructions/di_attr';\n\n/**\n * Creates a token that can be used to inject static attributes of the host node.\n *\n * @usageNotes\n * ### Injecting an attribute that is known to exist\n * ```ts\n * @Directive()\n * class MyDir {\n * attr: string = inject(new HostAttributeToken('some-attr'));\n * }\n * ```\n *\n * ### Optionally injecting an attribute\n * ```ts\n * @Directive()\n * class MyDir {\n * attr: string | null = inject(new HostAttributeToken('some-attr'), {optional: true});\n * }\n * ```\n * @see [Injecting host element attributes](guide/components/host-elements#injecting-host-element-attributes)\n * @publicApi\n */\nexport class HostAttributeToken {\n constructor(private attributeName: string) {}\n\n /** @internal */\n __NG_ELEMENT_ID__ = () => ɵɵinjectAttribute(this.attributeName);\n\n toString(): string {\n return `HostAttributeToken ${this.attributeName}`;\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 {RuntimeError, RuntimeErrorCode} from '../errors';\nimport {TNode, TNodeType} from '../render3/interfaces/node';\nimport {getCurrentTNode} from '../render3/state';\n\nimport {InjectionToken} from './injection_token';\nimport {InternalInjectFlags} from './interface/injector';\n\n/**\n * A token that can be used to inject the tag name of the host node.\n *\n * @usageNotes\n * ### Injecting a tag name that is known to exist\n * ```ts\n * @Directive()\n * class MyDir {\n * tagName: string = inject(HOST_TAG_NAME);\n * }\n * ```\n *\n * ### Optionally injecting a tag name\n * ```ts\n * @Directive()\n * class MyDir {\n * tagName: string | null = inject(HOST_TAG_NAME, {optional: true});\n * }\n * ```\n * @publicApi\n *\n * @see [Inject the host element's tag name](guide/di/di-in-action#inject-the-host-elements-tag-name)\n *\n */\nexport const HOST_TAG_NAME: InjectionToken<string> = /* @__PURE__ */ (() => {\n // Wrapped in a `@__PURE__` IIFE so this token stays tree-shakable.\n // If nothing ever injects `HOST_TAG_NAME`, the IIFE result is unused and\n // the bundler can drop the whole block. If we set `__NG_ELEMENT_ID__` at\n // the top level instead, the mutation would look like a side effect,\n // forcing the bundler to keep it even when unused.\n const HOST_TAG_NAME_TOKEN = new InjectionToken<string>(\n typeof ngDevMode !== 'undefined' && ngDevMode ? 'HOST_TAG_NAME' : '',\n );\n\n // HOST_TAG_NAME should be resolved at the current node, similar to e.g. ElementRef,\n // so we manually specify __NG_ELEMENT_ID__ here, instead of using a factory.\n // tslint:disable-next-line:no-toplevel-property-access\n (HOST_TAG_NAME_TOKEN as any).__NG_ELEMENT_ID__ = (flags: InternalInjectFlags) => {\n const tNode = getCurrentTNode();\n if (tNode === null) {\n throw new RuntimeError(\n RuntimeErrorCode.INVALID_INJECTION_TOKEN,\n ngDevMode &&\n 'HOST_TAG_NAME can only be injected in directives and components ' +\n 'during construction time (in a class constructor or as a class field initializer)',\n );\n }\n if (tNode.type & TNodeType.Element) {\n return tNode.value;\n }\n if (flags & InternalInjectFlags.Optional) {\n return null;\n }\n throw new RuntimeError(\n RuntimeErrorCode.INVALID_INJECTION_TOKEN,\n ngDevMode &&\n `HOST_TAG_NAME was used on ${getDevModeNodeName(\n tNode,\n )} which doesn't have an underlying element in the DOM. ` +\n `This is invalid, and so the dependency should be marked as optional.`,\n );\n };\n\n return HOST_TAG_NAME_TOKEN;\n})();\n\nfunction getDevModeNodeName(tNode: TNode) {\n if (tNode.type & TNodeType.ElementContainer) {\n return 'an <ng-container>';\n } else if (tNode.type & TNodeType.Container) {\n return 'an <ng-template>';\n } else if (tNode.type & TNodeType.LetDeclaration) {\n return 'an @let declaration';\n } else {\n return 'a node';\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 ES Module object with a default export of the given type.\n *\n * @see {@link injectAsync}\n * @see [Route#loadComponent](/api/router/Route#loadComponent)\n * @see [LoadChildrenCallback](/api/router/LoadChildrenCallback)\n *\n * @publicApi\n */\nexport interface DefaultExport<T> {\n /**\n * Default exports are bound under the name `\"default\"`, per the ES Module spec:\n * https://tc39.es/ecma262/#table-export-forms-mapping-to-exportentry-records\n */\n default: T;\n}\n\nexport function maybeUnwrapDefaultExport<T>(input: T | DefaultExport<T>): T {\n // As per `isWrappedDefaultExport`, the `default` key here is generated by the browser and not\n // subject to property renaming, so we reference it with bracket access.\n return isWrappedDefaultExport(input) ? input['default'] : input;\n}\n\nfunction isWrappedDefaultExport<T>(value: T | DefaultExport<T>): value is DefaultExport<T> {\n // We use `in` here with a string key `'default'`, because we expect `DefaultExport` objects to be\n // dynamically imported ES modules with a spec-mandated `default` key. Thus we don't expect that\n // `default` will be a renamed property.\n return value && typeof value === 'object' && 'default' 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 {IDLE_SERVICE} from '../defer/idle_service';\nimport {DefaultExport, maybeUnwrapDefaultExport} from '../util/default_export';\nimport {promiseWithResolvers} from '../util/promise_with_resolvers';\nimport {assertInInjectionContext} from './contextual';\nimport {Injector} from './injector';\nimport {inject} from './injector_compatibility';\nimport {ProviderToken} from './provider_token';\n\ntype InjectAsyncLoaderResult<T> = ProviderToken<T> | DefaultExport<ProviderToken<T>>;\n\n/**\n * A helper function that allows to inject dependencies asynchronously,\n * which can be useful in cases when the dependency is not needed immediately and can be loaded lazily.\n *\n * NOTE: To enable lazy loading, the injected service must be auto-provided. This means it should be decorated with either `@Injectable({providedIn: 'root'})` or `@Service()`.\n *\n * @param loader A function that returns a promise resolving to the injectable service\n * @param options Configuration options for the async injection\n *\n * @returns A function that returns a promise resolving to the requested service instance.\n *\n * @usageNotes\n *\n * ```ts\n * class MyCmp {\n * someSvc = injectAsync(() => import('..'));\n *\n * async onClick() {\n * (await this.someSvc()).handleClick();\n * }\n * }\n *\n * // we can also configure prefetching:\n * injectAsync(.., {prefetch: onIdle})\n * ```\n *\n * @see [Lazy loading services](guide/di/lazy-loading-services)\n * @see [Injection context](guide/di/dependency-injection-context)\n *\n * @publicApi 22.0\n */\nexport function injectAsync<T>(\n loader: () => Promise<ProviderToken<T>>,\n options?: InjectAsyncOptions,\n): () => Promise<T>;\nexport function injectAsync<T>(\n loader: () => Promise<DefaultExport<ProviderToken<T>>>,\n options?: InjectAsyncOptions,\n): () => Promise<T>;\nexport function injectAsync<T>(\n loader: () => Promise<InjectAsyncLoaderResult<T>>,\n options?: InjectAsyncOptions,\n): () => Promise<T> {\n if (ngDevMode) {\n assertInInjectionContext(injectAsync);\n }\n\n const injector = inject(Injector);\n\n let loadedPromise: Promise<InjectAsyncLoaderResult<T>> | null = null;\n const load = () => {\n if (!loadedPromise) {\n loadedPromise = loader();\n }\n return loadedPromise;\n };\n\n if (options?.prefetch) {\n options.prefetch().then(() => load());\n }\n\n // We can't use `inject` later on because of the async nature of the loader\n return () => load().then((loadedToken) => injector.get(maybeUnwrapDefaultExport(loadedToken))!);\n}\n\n/**\n * Interface for `options` argument used within `injectAsync` call.\n *\n * @see [Prefetching the dependency](guide/di/lazy-loading-services#prefetching-the-dependency)\n *\n * @publicApi 22.0\n */\nexport interface InjectAsyncOptions {\n /**\n * A trigger to eagerly prefetch the lazy-loaded dependency before it is requested.\n *\n */\n prefetch?: PrefetchTrigger;\n}\n\n/**\n * A function that returns a promise which, when resolved, will trigger the prefetching of\n * the lazy-loaded dependency.\n *\n * @see {@link onIdle}\n * @see [Prefetching the dependency](guide/di/lazy-loading-services#prefetching-the-dependency)\n *\n * @publicApi 22.0\n */\nexport type PrefetchTrigger = () => Promise<void>;\n\n/**\n * A `PrefetchTrigger` helper function to provide the logic of triggering dependency loading\n * when the browser becomes idle.\n *\n * Internally delegates to the configured {@link IdleService}, whose default implementation uses\n * [`requestIdleCallback`](https://developer.mozilla.org/docs/Web/API/Window/requestIdleCallback)\n * when available and falls back to `setTimeout` otherwise. The default behavior can be replaced\n * with `provideIdleServiceWith`.\n *\n * @usageNotes\n *\n * ```ts\n * injectAsync(import(...), {prefetch: onIdle})\n *\n * // or with custom idle options:\n * injectAsync(import(...), {prefetch: () => onIdle({timeout: 100})})\n * ```\n *\n * @see [Prefetching the dependency](guide/di/lazy-loading-services#prefetching-the-dependency)\n *\n * @publicApi 22.0\n */\nexport function onIdle(options?: {timeout?: number}): Promise<void> {\n if (ngDevMode) {\n assertInInjectionContext(injectAsync);\n }\n\n const idleService = inject(IDLE_SERVICE);\n const {promise, resolve} = promiseWithResolvers<void>();\n idleService.requestOnIdle(() => resolve(), options);\n\n return promise;\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 * A set of interfaces which are shared between `@angular/core` and `@angular/compiler` to allow\n * for late binding of `@angular/compiler` for JIT purposes.\n *\n * This file has two copies. Please ensure that they are in sync:\n * - packages/compiler/src/compiler_facade_interface.ts (main)\n * - packages/core/src/compiler/compiler_facade_interface.ts (replica)\n *\n * Please ensure that the two files are in sync using this command:\n * ```shell\n * cp packages/compiler/src/compiler_facade_interface.ts \\\n * packages/core/src/compiler/compiler_facade_interface.ts\n * ```\n */\n\nexport interface ExportedCompilerFacade {\n ɵcompilerFacade: CompilerFacade;\n}\n\nexport interface CompilerFacade {\n compilePipe(\n angularCoreEnv: CoreEnvironment,\n sourceMapUrl: string,\n meta: R3PipeMetadataFacade,\n ): any;\n compilePipeDeclaration(\n angularCoreEnv: CoreEnvironment,\n sourceMapUrl: string,\n declaration: R3DeclarePipeFacade,\n ): any;\n compileInjectable(\n angularCoreEnv: CoreEnvironment,\n sourceMapUrl: string,\n meta: R3InjectableMetadataFacade,\n ): any;\n compileInjectableDeclaration(\n angularCoreEnv: CoreEnvironment,\n sourceMapUrl: string,\n meta: R3DeclareInjectableFacade,\n ): any;\n compileInjector(\n angularCoreEnv: CoreEnvironment,\n sourceMapUrl: string,\n meta: R3InjectorMetadataFacade,\n ): any;\n compileInjectorDeclaration(\n angularCoreEnv: CoreEnvironment,\n sourceMapUrl: string,\n declaration: R3DeclareInjectorFacade,\n ): any;\n compileNgModule(\n angularCoreEnv: CoreEnvironment,\n sourceMapUrl: string,\n meta: R3NgModuleMetadataFacade,\n ): any;\n compileNgModuleDeclaration(\n angularCoreEnv: CoreEnvironment,\n sourceMapUrl: string,\n declaration: R3DeclareNgModuleFacade,\n ): any;\n compileDirective(\n angularCoreEnv: CoreEnvironment,\n sourceMapUrl: string,\n meta: R3DirectiveMetadataFacade,\n ): any;\n compileDirectiveDeclaration(\n angularCoreEnv: CoreEnvironment,\n sourceMapUrl: string,\n declaration: R3DeclareDirectiveFacade,\n ): any;\n compileComponent(\n angularCoreEnv: CoreEnvironment,\n sourceMapUrl: string,\n meta: R3ComponentMetadataFacade,\n ): any;\n compileComponentDeclaration(\n angularCoreEnv: CoreEnvironment,\n sourceMapUrl: string,\n declaration: R3DeclareComponentFacade,\n ): any;\n compileFactory(\n angularCoreEnv: CoreEnvironment,\n sourceMapUrl: string,\n meta: R3FactoryDefMetadataFacade,\n ): any;\n compileFactoryDeclaration(\n angularCoreEnv: CoreEnvironment,\n sourceMapUrl: string,\n meta: R3DeclareFactoryFacade,\n ): any;\n compileService(\n angularCoreEnv: CoreEnvironment,\n sourceMapUrl: string,\n meta: R3ServiceMetadataFacade,\n ): any;\n compileServiceDeclaration(\n angularCoreEnv: CoreEnvironment,\n sourceMapUrl: string,\n meta: R3DeclareServiceFacade,\n ): any;\n\n createParseSourceSpan(kind: string, typeName: string, sourceUrl: string): ParseSourceSpan;\n\n FactoryTarget: typeof FactoryTarget;\n // Note that we do not use `{new(): ResourceLoader}` here because\n // the resource loader class is abstract and not constructable.\n ResourceLoader: Function & {prototype: ResourceLoader};\n}\n\nexport interface CoreEnvironment {\n [name: string]: unknown;\n}\n\nexport type ResourceLoader = {\n get(url: string): Promise<string> | string;\n};\n\nexport type Provider = unknown;\nexport type Type = Function;\nexport type OpaqueValue = unknown;\n\nexport enum FactoryTarget {\n Directive = 0,\n Component = 1,\n Injectable = 2,\n Pipe = 3,\n NgModule = 4,\n Service = 5,\n}\n\nexport interface R3DependencyMetadataFacade {\n token: OpaqueValue;\n attribute: string | null;\n host: boolean;\n optional: boolean;\n self: boolean;\n skipSelf: boolean;\n}\n\nexport interface R3DeclareDependencyMetadataFacade {\n token: OpaqueValue;\n attribute?: boolean;\n host?: boolean;\n optional?: boolean;\n self?: boolean;\n skipSelf?: boolean;\n}\n\nexport interface R3PipeMetadataFacade {\n name: string;\n type: Type;\n pipeName: string | null;\n pure: boolean;\n isStandalone: boolean;\n}\n\nexport interface R3InjectableMetadataFacade {\n name: string;\n type: Type;\n typeArgumentCount: number;\n providedIn?: Type | 'root' | 'platform' | 'any' | null;\n useClass?: OpaqueValue;\n useFactory?: OpaqueValue;\n useExisting?: OpaqueValue;\n useValue?: OpaqueValue;\n deps?: R3DependencyMetadataFacade[];\n}\n\nexport interface R3ServiceMetadataFacade {\n name: string;\n type: Type;\n typeArgumentCount: number;\n autoProvided?: boolean;\n factory?: OpaqueValue;\n}\n\nexport interface R3NgModuleMetadataFacade {\n type: Type;\n bootstrap: Function[];\n declarations: Function[];\n imports: Function[];\n exports: Function[];\n schemas: {name: string}[] | null;\n id: string | null;\n}\n\nexport interface R3InjectorMetadataFacade {\n name: string;\n type: Type;\n providers: Provider[];\n imports: OpaqueValue[];\n}\n\nexport interface R3HostDirectiveMetadataFacade {\n directive: Type;\n inputs?: string[];\n outputs?: string[];\n}\n\nexport interface R3DirectiveMetadataFacade {\n name: string;\n type: Type;\n typeSourceSpan: ParseSourceSpan;\n selector: string | null;\n queries: R3QueryMetadataFacade[];\n host: {[key: string]: string};\n propMetadata: {[key: string]: OpaqueValue[]};\n lifecycle: {usesOnChanges: boolean};\n inputs: (string | {name: string; alias?: string; required?: boolean})[];\n outputs: string[];\n usesInheritance: boolean;\n controlCreate: {passThroughInput: string | null} | null;\n exportAs: string[] | null;\n providers: Provider[] | null;\n viewQueries: R3QueryMetadataFacade[];\n isStandalone: boolean;\n hostDirectives: R3HostDirectiveMetadataFacade[] | null;\n isSignal: boolean;\n legacyOptionalChaining: boolean;\n}\n\nexport interface R3ComponentMetadataFacade extends R3DirectiveMetadataFacade {\n template: string;\n preserveWhitespaces: boolean;\n animations: OpaqueValue[] | undefined;\n declarations: R3TemplateDependencyFacade[];\n styles: string[];\n encapsulation: ViewEncapsulation;\n viewProviders: Provider[] | null;\n changeDetection?: ChangeDetectionStrategy;\n hasDirectiveDependencies: boolean;\n}\n\n// TODO(legacy-partial-output-inputs): Remove in v18.\n// https://github.com/angular/angular/blob/d4b423690210872b5c32a322a6090beda30b05a3/packages/core/src/compiler/compiler_facade_interface.ts#L197-L199\nexport type LegacyInputPartialMapping =\n | string\n | [bindingPropertyName: string, classPropertyName: string, transformFunction?: Function];\n\nexport interface R3DeclareDirectiveFacade {\n selector?: string;\n type: Type;\n version: string;\n inputs?: {\n [fieldName: string]:\n | {\n classPropertyName: string;\n publicName: string;\n isSignal: boolean;\n isRequired: boolean;\n transformFunction: Function | null;\n }\n | LegacyInputPartialMapping;\n };\n outputs?: {[classPropertyName: string]: string};\n host?: {\n attributes?: {[key: string]: OpaqueValue};\n listeners?: {[key: string]: string};\n properties?: {[key: string]: string};\n classAttribute?: string;\n styleAttribute?: string;\n };\n queries?: R3DeclareQueryMetadataFacade[];\n viewQueries?: R3DeclareQueryMetadataFacade[];\n providers?: OpaqueValue;\n exportAs?: string[];\n usesInheritance?: boolean;\n usesOnChanges?: boolean;\n controlCreate?: {passThroughInput: string | null};\n isStandalone?: boolean;\n isSignal?: boolean;\n hostDirectives?: R3HostDirectiveMetadataFacade[] | null;\n legacyOptionalChaining?: boolean;\n}\n\nexport interface R3DeclareComponentFacade extends R3DeclareDirectiveFacade {\n template: string;\n isInline?: boolean;\n styles?: string[];\n\n // Post-standalone libraries use a unified dependencies field.\n dependencies?: R3DeclareTemplateDependencyFacade[];\n\n // Pre-standalone libraries have separate component/directive/pipe fields:\n components?: R3DeclareDirectiveDependencyFacade[];\n directives?: R3DeclareDirectiveDependencyFacade[];\n pipes?: {[pipeName: string]: OpaqueValue | (() => OpaqueValue)};\n\n deferBlockDependencies?: (() => Promise<Type> | null)[];\n viewProviders?: OpaqueValue;\n animations?: OpaqueValue;\n changeDetection?: ChangeDetectionStrategy;\n encapsulation?: ViewEncapsulation;\n preserveWhitespaces?: boolean;\n}\n\nexport type R3DeclareTemplateDependencyFacade = {\n kind: string;\n} & (\n | R3DeclareDirectiveDependencyFacade\n | R3DeclarePipeDependencyFacade\n | R3DeclareNgModuleDependencyFacade\n);\n\nexport interface R3DeclareDirectiveDependencyFacade {\n kind?: 'directive' | 'component';\n selector: string;\n type: OpaqueValue | (() => OpaqueValue);\n inputs?: string[];\n outputs?: string[];\n exportAs?: string[];\n}\n\nexport interface R3DeclarePipeDependencyFacade {\n kind?: 'pipe';\n name: string;\n type: OpaqueValue | (() => OpaqueValue);\n}\n\nexport interface R3DeclareNgModuleDependencyFacade {\n kind: 'ngmodule';\n type: OpaqueValue | (() => OpaqueValue);\n}\n\nexport enum R3TemplateDependencyKind {\n Directive = 0,\n Pipe = 1,\n NgModule = 2,\n}\n\nexport interface R3TemplateDependencyFacade {\n kind: R3TemplateDependencyKind;\n type: OpaqueValue | (() => OpaqueValue);\n}\nexport interface R3FactoryDefMetadataFacade {\n name: string;\n type: Type;\n typeArgumentCount: number;\n deps: R3DependencyMetadataFacade[] | null;\n target: FactoryTarget;\n}\n\nexport interface R3DeclareFactoryFacade {\n type: Type;\n deps: R3DeclareDependencyMetadataFacade[] | 'invalid' | null;\n target: FactoryTarget;\n}\n\nexport interface R3DeclareInjectableFacade {\n type: Type;\n providedIn?: Type | 'root' | 'platform' | 'any' | null;\n useClass?: OpaqueValue;\n useFactory?: OpaqueValue;\n useExisting?: OpaqueValue;\n useValue?: OpaqueValue;\n deps?: R3DeclareDependencyMetadataFacade[];\n}\n\nexport interface R3DeclareServiceFacade {\n type: Type;\n autoProvided?: boolean;\n factory?: OpaqueValue;\n}\n\nexport enum ViewEncapsulation {\n Emulated = 0,\n // Historically the 1 value was for `Native` encapsulation which has been removed as of v11.\n None = 2,\n ShadowDom = 3,\n ExperimentalIsolatedShadowDom = 4,\n}\n\nexport type ChangeDetectionStrategy = number;\n\nexport interface R3QueryMetadataFacade {\n propertyName: string;\n first: boolean;\n predicate: OpaqueValue | string[];\n descendants: boolean;\n emitDistinctChangesOnly: boolean;\n read: OpaqueValue | null;\n static: boolean;\n isSignal: boolean;\n}\n\nexport interface R3DeclareQueryMetadataFacade {\n propertyName: string;\n first?: boolean;\n predicate: OpaqueValue | string[];\n descendants?: boolean;\n read?: OpaqueValue;\n static?: boolean;\n emitDistinctChangesOnly?: boolean;\n isSignal?: boolean;\n}\n\nexport interface R3DeclareInjectorFacade {\n type: Type;\n imports?: OpaqueValue[];\n providers?: OpaqueValue[];\n}\n\nexport interface R3DeclareNgModuleFacade {\n type: Type;\n bootstrap?: OpaqueValue[] | (() => OpaqueValue[]);\n declarations?: OpaqueValue[] | (() => OpaqueValue[]);\n imports?: OpaqueValue[] | (() => OpaqueValue[]);\n exports?: OpaqueValue[] | (() => OpaqueValue[]);\n schemas?: OpaqueValue[];\n id?: OpaqueValue;\n}\n\nexport interface R3DeclarePipeFacade {\n type: Type;\n version: string;\n name: string;\n pure?: boolean;\n isStandalone?: boolean;\n}\n\nexport interface ParseSourceSpan {\n start: any;\n end: any;\n details: any;\n fullStart: any;\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 {assertInInjectionContext} from '../../di';\n\nimport {OutputEmitterRef} from './output_emitter_ref';\n\n/**\n * Options for declaring an output.\n *\n * @see [Customizing output names](guide/components/outputs#customizing-output-names)\n *\n * @publicApi 19.0\n */\nexport interface OutputOptions {\n alias?: string;\n}\n\n/**\n * The `output` function allows declaration of Angular outputs in\n * directives and components.\n *\n * You can use outputs to emit values to parent directives and component.\n * Parents can subscribe to changes via:\n *\n * - template event bindings. For example, `(myOutput)=\"doSomething($event)\"`\n * - programmatic subscription by using `OutputRef#subscribe`.\n *\n * @usageNotes\n *\n * To use `output()`, import the function from `@angular/core`.\n *\n * ```ts\n * import {output} from '@angular/core';\n * ```\n *\n * Inside your component, introduce a new class member and initialize\n * it with a call to `output`.\n *\n * ```ts\n * @Directive({\n * ...\n * })\n * export class MyDir {\n * nameChange = output<string>(); // OutputEmitterRef<string>\n * onClick = output(); // OutputEmitterRef<void>\n * }\n * ```\n *\n * You can emit values to consumers of your directive, by using\n * the `emit` method from `OutputEmitterRef`.\n *\n * ```ts\n * updateName(newName: string): void {\n * this.nameChange.emit(newName);\n * }\n * ```\n *\n * @see [Custom events with outputs](guide/components/outputs#customizing-output-names)\n *\n * @initializerApiFunction {\"showTypesInSignaturePreview\": true}\n * @publicApi 19.0\n */\nexport function output<T = void>(opts?: OutputOptions): OutputEmitterRef<T> {\n ngDevMode && assertInInjectionContext(output);\n return new OutputEmitterRef<T>();\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 {assertInInjectionContext} from '../../di';\n\nimport {\n createInputSignal,\n InputOptions,\n InputOptionsWithoutTransform,\n InputOptionsWithTransform,\n InputSignal,\n InputSignalWithTransform,\n} from './input_signal';\nimport {REQUIRED_UNSET_VALUE} from './input_signal_node';\n\nexport function inputFunction<ReadT, WriteT>(\n initialValue?: ReadT,\n opts?: InputOptions<ReadT, WriteT>,\n): InputSignalWithTransform<ReadT | undefined, WriteT> {\n ngDevMode && assertInInjectionContext(input);\n return createInputSignal(initialValue, opts);\n}\n\nexport function inputRequiredFunction<ReadT, WriteT = ReadT>(\n opts?: InputOptions<ReadT, WriteT>,\n): InputSignalWithTransform<ReadT, WriteT> {\n ngDevMode && assertInInjectionContext(input);\n return createInputSignal(REQUIRED_UNSET_VALUE as never, opts);\n}\n\n/**\n * The `input` function allows declaration of inputs in directives and\n * components.\n *\n * The function exposes an API for also declaring required inputs via the\n * `input.required` function.\n *\n * @see [Accepting data with input properties](guide/components/inputs)\n * @see [Required inputs](guide/components/inputs#required-inputs)\n * @see [Input transforms](guide/components/inputs#input-transforms)\n * @publicAPI\n * @docsPrivate Ignored because `input` is the canonical API entry.\n */\nexport interface InputFunction {\n /**\n * Initializes an input of type `T` with an initial value of `undefined`.\n * Angular will implicitly use `undefined` as initial value.\n */\n <T>(): InputSignal<T | undefined>;\n /** Declares an input of type `T` with an explicit initial value. */\n <T>(initialValue: T, opts?: InputOptionsWithoutTransform<T>): InputSignal<T>;\n /** Declares an input of type `T|undefined` without an initial value, but with input options */\n <T>(initialValue: undefined, opts: InputOptionsWithoutTransform<T>): InputSignal<T | undefined>;\n /**\n * Declares an input of type `T` with an initial value and a transform\n * function.\n *\n * The input accepts values of type `TransformT` and the given\n * transform function will transform the value to type `T`.\n */\n <T, TransformT>(\n initialValue: T,\n opts: InputOptionsWithTransform<T, TransformT>,\n ): InputSignalWithTransform<T, TransformT>;\n /**\n * Declares an input of type `T|undefined` without an initial value and with a transform\n * function.\n *\n * The input accepts values of type `TransformT` and the given\n * transform function will transform the value to type `T|undefined`.\n */ <T, TransformT>(\n initialValue: undefined,\n opts: InputOptionsWithTransform<T | undefined, TransformT>,\n ): InputSignalWithTransform<T | undefined, TransformT>;\n /**\n * Declares an input of type `T` with an initial value and a transform function\n * that accepts values of the same type.\n */\n <T>(initialValue: T, opts: InputOptionsWithTransform<T, unknown>): InputSignalWithTransform<T, T>;\n /**\n * Declares an input of type `T|undefined` without an initial value and with a transform\n * function that accepts values of the same type.\n */\n <T>(\n initialValue: undefined,\n opts: InputOptionsWithTransform<T | undefined, unknown>,\n ): InputSignalWithTransform<T | undefined, T | undefined>;\n\n /**\n * Initializes a required input.\n *\n * Consumers of your directive/component need to bind to this\n * input. If unset, a compile time error will be reported.\n *\n * @publicAPI\n */\n required: {\n /** Declares a required input of type `T`. */\n\n <T>(opts?: InputOptionsWithoutTransform<T>): InputSignal<T>;\n /**\n * Declares a required input of type `T` with a transform function.\n *\n * The input accepts values of type `TransformT` and the given\n * transform function will transform the value to type `T`.\n */\n <T, TransformT>(\n opts: InputOptionsWithTransform<T, TransformT>,\n ): InputSignalWithTransform<T, TransformT>;\n };\n}\n\n/**\n * The `input` function allows declaration of Angular inputs in directives\n * and components.\n *\n * There are two variants of inputs that can be declared:\n *\n * 1. **Optional inputs** with an initial value.\n * 2. **Required inputs** that consumers need to set.\n *\n * By default, the `input` function will declare optional inputs that\n * always have an initial value. Required inputs can be declared\n * using the `input.required()` function.\n *\n * Inputs are signals. The values of an input are exposed as a `Signal`.\n * The signal always holds the latest value of the input that is bound\n * from the parent.\n *\n * @usageNotes\n * To use signal-based inputs, import `input` from `@angular/core`.\n *\n * ```ts\n * import {input} from '@angular/core';\n * ```\n *\n * Inside your component, introduce a new class member and initialize\n * it with a call to `input` or `input.required`.\n *\n * ```ts\n * @Component({\n * ...\n * })\n * export class UserProfileComponent {\n * firstName = input<string>(); // Signal<string|undefined>\n * lastName = input.required<string>(); // Signal<string>\n * age = input(0) // Signal<number>\n * }\n * ```\n *\n * Inside your component template, you can display values of the inputs\n * by calling the signal.\n *\n * ```html\n * <span>{{firstName()}}</span>\n * ```\n *\n * @publicAPI\n * @initializerApiFunction\n *\n * @see [Accepting data with input properties](guide/components/inputs)\n */\nexport const input: InputFunction = (() => {\n // Note: This may be considered a side-effect, but nothing will depend on\n // this assignment, unless this `input` constant export is accessed. It's a\n // self-contained side effect that is local to the user facing`input` export.\n (inputFunction as any).required = inputRequiredFunction;\n return inputFunction as typeof inputFunction & {required: typeof inputRequiredFunction};\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 {producerAccessed, SIGNAL, signalSetFn} from '../../../primitives/signals';\n\nimport {RuntimeError, RuntimeErrorCode} from '../../errors';\nimport {Signal} from '../../render3/reactivity/api';\nimport {\n signalAsReadonlyFn,\n WritableSignal,\n ɵWRITABLE_SIGNAL,\n} from '../../render3/reactivity/signal';\nimport {\n InputSignal,\n ɵINPUT_SIGNAL_BRAND_READ_TYPE,\n ɵINPUT_SIGNAL_BRAND_WRITE_TYPE,\n} from '../input/input_signal';\nimport {INPUT_SIGNAL_NODE, InputSignalNode, REQUIRED_UNSET_VALUE} from '../input/input_signal_node';\nimport {OutputEmitterRef} from '../output/output_emitter_ref';\nimport {OutputRef} from '../output/output_ref';\n\n/**\n * @publicAPI\n *\n * Options for model signals.\n */\nexport interface ModelOptions {\n /**\n * Optional public name of the input side of the model. The output side will have the same\n * name as the input, but suffixed with `Change`. By default, the class field name is used.\n */\n alias?: string;\n\n /**\n * A debug name for the model signal. Used in Angular DevTools to identify the signal.\n */\n debugName?: string;\n}\n\n/**\n * `ModelSignal` represents a special `Signal` for a directive/component model field.\n *\n * A model signal is a writeable signal that can be exposed as an output.\n * Whenever its value is updated, it emits to the output.\n *\n * @publicAPI\n */\nexport interface ModelSignal<T> extends WritableSignal<T>, InputSignal<T>, OutputRef<T> {\n [SIGNAL]: InputSignalNode<T, T>;\n}\n\n/**\n * Creates a model signal.\n *\n * @param initialValue The initial value.\n * Can be set to {@link REQUIRED_UNSET_VALUE} for required model signals.\n * @param options Additional options for the model.\n */\nexport function createModelSignal<T>(initialValue: T, opts?: ModelOptions): ModelSignal<T> {\n const node: InputSignalNode<T, T> = Object.create(INPUT_SIGNAL_NODE);\n const emitterRef = new OutputEmitterRef<T>();\n\n node.value = initialValue;\n\n function getter(): T {\n producerAccessed(node);\n assertModelSet(node.value);\n return node.value;\n }\n\n getter[SIGNAL] = node;\n getter.asReadonly = signalAsReadonlyFn.bind(getter as any) as () => Signal<T>;\n\n // TODO: Should we throw an error when updating a destroyed model?\n getter.set = (newValue: T) => {\n if (!node.equal(node.value, newValue)) {\n signalSetFn(node, newValue);\n emitterRef.emit(newValue);\n }\n };\n\n getter.update = (updateFn: (value: T) => T) => {\n assertModelSet(node.value);\n getter.set(updateFn(node.value));\n };\n\n getter.subscribe = emitterRef.subscribe.bind(emitterRef);\n getter.destroyRef = emitterRef.destroyRef;\n\n if (ngDevMode) {\n getter.toString = () => `[Model Signal: ${getter()}]`;\n node.debugName = opts?.debugName;\n }\n\n return getter as typeof getter &\n Pick<\n ModelSignal<T>,\n | typeof ɵINPUT_SIGNAL_BRAND_READ_TYPE\n | typeof ɵINPUT_SIGNAL_BRAND_WRITE_TYPE\n | typeof ɵWRITABLE_SIGNAL\n >;\n}\n\n/** Asserts that a model's value is set. */\nfunction assertModelSet(value: unknown): void {\n if (value === REQUIRED_UNSET_VALUE) {\n throw new RuntimeError(\n RuntimeErrorCode.REQUIRED_MODEL_NO_VALUE,\n ngDevMode && 'Model is required but no value is available yet.',\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 {assertInInjectionContext} from '../../di';\nimport {REQUIRED_UNSET_VALUE} from '../input/input_signal_node';\n\nimport {createModelSignal, ModelOptions, ModelSignal} from './model_signal';\n\nexport function modelFunction<T>(\n initialValue?: T,\n opts?: ModelOptions,\n): ModelSignal<T | undefined> {\n ngDevMode && assertInInjectionContext(model);\n\n return createModelSignal(initialValue, opts);\n}\n\nexport function modelRequiredFunction<T>(opts?: ModelOptions): ModelSignal<T> {\n ngDevMode && assertInInjectionContext(model);\n\n return createModelSignal(REQUIRED_UNSET_VALUE as T, opts);\n}\n\n/**\n * `model` declares a writeable signal that is exposed as an input/output pair on the containing\n * directive. The input name is taken either from the class member or from the `alias` option.\n * The output name is generated by taking the input name and appending `Change`.\n *\n * The function exposes an API for also declaring required models via the\n * `model.required` function.\n *\n * @see [Two-way binding between components](guide/templates/two-way-binding#two-way-binding-between-components)\n * @see [Model inputs](guide/components/inputs#model-inputs)\n * @see [Customizing model inputs](guide/components/inputs#customizing-model-inputs)\n *\n * @publicAPI\n * @docsPrivate Ignored because `model` is the canonical API entry.\n */\nexport interface ModelFunction {\n /**\n * Initializes a model of type `T` with an initial value of `undefined`.\n * Angular will implicitly use `undefined` as initial value.\n */\n <T>(): ModelSignal<T | undefined>;\n /** Initializes a model of type `T` with the given initial value. */\n <T>(initialValue: T, opts?: ModelOptions): ModelSignal<T>;\n\n required: {\n /**\n * Initializes a required model.\n *\n * Users of your directive/component need to bind to the input side of the model.\n * If unset, a compile time error will be reported.\n */\n <T>(opts?: ModelOptions): ModelSignal<T>;\n };\n}\n\n/**\n * `model` declares a writeable signal that is exposed as an input/output\n * pair on the containing directive.\n *\n * The input name is taken either from the class member or from the `alias` option.\n * The output name is generated by taking the input