{"version":3,"file":"signals.mjs","sources":["../../../../../k8-fastbuild-ST-fdfa778d11ba/bin/packages/forms/signals/src/field/di.ts","../../../../../k8-fastbuild-ST-fdfa778d11ba/bin/packages/forms/signals/src/api/di.ts","../../../../../k8-fastbuild-ST-fdfa778d11ba/bin/packages/forms/signals/src/api/rules/disabled.ts","../../../../../k8-fastbuild-ST-fdfa778d11ba/bin/packages/forms/signals/src/api/rules/hidden.ts","../../../../../k8-fastbuild-ST-fdfa778d11ba/bin/packages/forms/signals/src/api/rules/readonly.ts","../../../../../k8-fastbuild-ST-fdfa778d11ba/bin/packages/forms/signals/src/api/rules/validation/util.ts","../../../../../k8-fastbuild-ST-fdfa778d11ba/bin/packages/forms/signals/src/api/rules/validation/validate.ts","../../../../../k8-fastbuild-ST-fdfa778d11ba/bin/packages/forms/signals/src/api/rules/validation/validation_errors.ts","../../../../../k8-fastbuild-ST-fdfa778d11ba/bin/packages/forms/signals/src/api/rules/validation/email.ts","../../../../../k8-fastbuild-ST-fdfa778d11ba/bin/packages/forms/signals/src/api/rules/validation/max.ts","../../../../../k8-fastbuild-ST-fdfa778d11ba/bin/packages/forms/signals/src/api/rules/validation/max_date.ts","../../../../../k8-fastbuild-ST-fdfa778d11ba/bin/packages/forms/signals/src/api/rules/validation/max_length.ts","../../../../../k8-fastbuild-ST-fdfa778d11ba/bin/packages/forms/signals/src/api/rules/validation/min.ts","../../../../../k8-fastbuild-ST-fdfa778d11ba/bin/packages/forms/signals/src/api/rules/validation/min_date.ts","../../../../../k8-fastbuild-ST-fdfa778d11ba/bin/packages/forms/signals/src/api/rules/validation/min_length.ts","../../../../../k8-fastbuild-ST-fdfa778d11ba/bin/packages/forms/signals/src/api/rules/validation/pattern.ts","../../../../../k8-fastbuild-ST-fdfa778d11ba/bin/packages/forms/signals/src/api/rules/validation/required.ts","../../../../../k8-fastbuild-ST-fdfa778d11ba/bin/packages/forms/signals/src/api/rules/validation/validate_async.ts","../../../../../k8-fastbuild-ST-fdfa778d11ba/bin/packages/forms/signals/src/api/rules/validation/validate_tree.ts","../../../../../k8-fastbuild-ST-fdfa778d11ba/bin/packages/forms/signals/src/api/rules/validation/standard_schema.ts","../../../../../k8-fastbuild-ST-fdfa778d11ba/bin/packages/forms/signals/src/api/rules/validation/validate_http.ts","../../../../../k8-fastbuild-ST-fdfa778d11ba/bin/packages/forms/signals/src/api/rules/debounce.ts","../../../../../k8-fastbuild-ST-fdfa778d11ba/bin/packages/forms/signals/src/util/parser.ts","../../../../../k8-fastbuild-ST-fdfa778d11ba/bin/packages/forms/signals/src/api/transformed_value.ts","../../../../../k8-fastbuild-ST-fdfa778d11ba/bin/packages/forms/signals/src/controls/interop_ng_control.ts","../../../../../k8-fastbuild-ST-fdfa778d11ba/bin/packages/forms/signals/src/directive/bindings.ts","../../../../../k8-fastbuild-ST-fdfa778d11ba/bin/packages/forms/signals/src/directive/native.ts","../../../../../k8-fastbuild-ST-fdfa778d11ba/bin/packages/forms/signals/src/directive/control_custom.ts","../../../../../k8-fastbuild-ST-fdfa778d11ba/bin/packages/forms/signals/src/directive/control_cva.ts","../../../../../k8-fastbuild-ST-fdfa778d11ba/bin/packages/forms/signals/src/directive/select.ts","../../../../../k8-fastbuild-ST-fdfa778d11ba/bin/packages/forms/signals/src/directive/control_native.ts","../../../../../k8-fastbuild-ST-fdfa778d11ba/bin/packages/forms/signals/src/directive/input_validity_monitor.ts","../../../../../k8-fastbuild-ST-fdfa778d11ba/bin/packages/forms/signals/src/directive/form_field.ts","../../../../../k8-fastbuild-ST-fdfa778d11ba/bin/packages/forms/signals/src/directive/form_root.ts","../../../../../k8-fastbuild-ST-fdfa778d11ba/bin/packages/forms/signals/src/webmcp/registration.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 {InjectionToken} from '@angular/core';\nimport type {SignalFormsConfig} from '../api/di';\n\n/** Injection token for the signal forms configuration. */\nexport const SIGNAL_FORMS_CONFIG = new InjectionToken<SignalFormsConfig>(\n  typeof ngDevMode !== 'undefined' && ngDevMode ? 'SIGNAL_FORMS_CONFIG' : '',\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 Provider} from '@angular/core';\nimport type {FormFieldBinding} from '../api/types';\nimport {SIGNAL_FORMS_CONFIG} from '../field/di';\n\n/**\n * Configuration options for signal forms.\n *\n * @publicApi 22.0\n */\nexport interface SignalFormsConfig {\n  /** A map of CSS class names to predicate functions that determine when to apply them. */\n  classes?: {\n    [className: string]: (formField: FormFieldBinding) => boolean;\n  };\n}\n\n/**\n * Provides configuration options for signal forms.\n *\n * @publicApi 22.0\n */\nexport function provideSignalFormsConfig(config: SignalFormsConfig): Provider[] {\n  return [{provide: SIGNAL_FORMS_CONFIG, useValue: config}];\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 {FieldPathNode} from '../../schema/path_node';\nimport {assertPathIsCurrent} from '../../schema/schema';\nimport type {FieldContext, LogicFn, PathKind, SchemaPath, SchemaPathRules} from '../types';\n\n/**\n * Adds logic to a field to conditionally disable it. A disabled field does not contribute to the\n * validation, touched/dirty, or other state of its parent field.\n *\n * @param path The target path to add the disabled logic to.\n * @param config Optional configuration object.\n *  - `when`: A reactive function that returns `true` (or a string reason) when the field is disabled,\n *    and `false` when it is not disabled. Can also be a static string reason.\n * @template TValue The type of value stored in the field the logic is bound to.\n * @template TPathKind The kind of path the logic is bound to (a root path, child path, or item of an array)\n *\n * @category logic\n * @publicApi 22.0\n */\nexport function disabled<TValue, TPathKind extends PathKind = PathKind.Root>(\n  path: SchemaPath<TValue, SchemaPathRules.Supported, TPathKind>,\n  config?: {when?: string | NoInfer<LogicFn<TValue, boolean | string, TPathKind>>},\n): void;\n\n/**\n * Adds logic to a field to conditionally disable it.\n *\n * @deprecated Passing a function or string directly to `disabled` is deprecated. Use `{ when: ... }` instead.\n */\nexport function disabled<TValue, TPathKind extends PathKind = PathKind.Root>(\n  path: SchemaPath<TValue, SchemaPathRules.Supported, TPathKind>,\n  logic?: string | NoInfer<LogicFn<TValue, boolean | string, TPathKind>>,\n): void;\n\nexport function disabled<TValue, TPathKind extends PathKind = PathKind.Root>(\n  path: SchemaPath<TValue, SchemaPathRules.Supported, TPathKind>,\n  configOrLogic?:\n    | {when?: string | NoInfer<LogicFn<TValue, boolean | string, TPathKind>>}\n    | string\n    | NoInfer<LogicFn<TValue, boolean | string, TPathKind>>,\n): void {\n  assertPathIsCurrent(path);\n\n  const pathNode = FieldPathNode.unwrapFieldPath(path);\n\n  let logic: string | LogicFn<TValue, boolean | string, TPathKind> | undefined;\n  if (typeof configOrLogic === 'function' || typeof configOrLogic === 'string') {\n    logic = configOrLogic;\n  } else {\n    logic = configOrLogic?.when;\n  }\n\n  pathNode.builder.addDisabledReasonRule((ctx) => {\n    let result: boolean | string = true;\n    if (typeof logic === 'string') {\n      result = logic;\n    } else if (logic) {\n      result = logic(ctx as FieldContext<TValue, TPathKind>);\n    }\n    if (typeof result === 'string') {\n      return {fieldTree: ctx.fieldTree, message: result};\n    }\n    return result ? {fieldTree: ctx.fieldTree} : undefined;\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 {FieldPathNode} from '../../schema/path_node';\nimport {assertPathIsCurrent} from '../../schema/schema';\nimport type {LogicFn, PathKind, SchemaPath, SchemaPathRules} from '../types';\n\n/**\n * Adds logic to a field to conditionally hide it. A hidden field does not contribute to the\n * validation, touched/dirty, or other state of its parent field.\n *\n * If a field may be hidden it is recommended to guard it with an `@if` in the template:\n * ```\n * @if (!email().hidden()) {\n *   <label for=\"email\">Email</label>\n *   <input id=\"email\" type=\"email\" [control]=\"email\" />\n * }\n * ```\n *\n * @param path The target path to add the hidden logic to.\n * @param config Options object containing the `when` condition.\n *  - `when`: A reactive function that returns `true` when the field is hidden.\n * @template TValue The type of value stored in the field the logic is bound to.\n * @template TPathKind The kind of path the logic is bound to (a root path, child path, or item of an array)\n *\n * @category logic\n * @publicApi 22.0\n */\nexport function hidden<TValue, TPathKind extends PathKind = PathKind.Root>(\n  path: SchemaPath<TValue, SchemaPathRules.Supported, TPathKind>,\n  config: {when: NoInfer<LogicFn<TValue, boolean, TPathKind>>},\n): void;\n\n/**\n * Adds logic to a field to conditionally hide it.\n *\n * @deprecated Passing a function directly to `hidden` is deprecated. Use `{ when: ... }` instead.\n */\nexport function hidden<TValue, TPathKind extends PathKind = PathKind.Root>(\n  path: SchemaPath<TValue, SchemaPathRules.Supported, TPathKind>,\n  logic: NoInfer<LogicFn<TValue, boolean, TPathKind>>,\n): void;\n\nexport function hidden<TValue, TPathKind extends PathKind = PathKind.Root>(\n  path: SchemaPath<TValue, SchemaPathRules.Supported, TPathKind>,\n  configOrLogic:\n    | {when: NoInfer<LogicFn<TValue, boolean, TPathKind>>}\n    | NoInfer<LogicFn<TValue, boolean, TPathKind>>,\n): void {\n  assertPathIsCurrent(path);\n\n  const pathNode = FieldPathNode.unwrapFieldPath(path);\n\n  const logic = typeof configOrLogic === 'function' ? configOrLogic : configOrLogic.when;\n\n  pathNode.builder.addHiddenRule(logic);\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 {FieldPathNode} from '../../schema/path_node';\nimport {assertPathIsCurrent} from '../../schema/schema';\nimport type {LogicFn, PathKind, SchemaPath, SchemaPathRules} from '../types';\n\n/**\n * Adds logic to a field to conditionally make it readonly. A readonly field does not contribute to\n * the validation, touched/dirty, or other state of its parent field.\n *\n * @param path The target path to make readonly.\n * @param config Optional configuration object.\n *  - `when`: A reactive function that returns `true` when the field is readonly.\n * @template TValue The type of value stored in the field the logic is bound to.\n * @template TPathKind The kind of path the logic is bound to (a root path, child path, or item of an array)\n *\n * @category logic\n * @publicApi 22.0\n */\nexport function readonly<TValue, TPathKind extends PathKind = PathKind.Root>(\n  path: SchemaPath<TValue, SchemaPathRules.Supported, TPathKind>,\n  config?: {when?: NoInfer<LogicFn<TValue, boolean, TPathKind>>},\n): void;\n\n/**\n * Adds logic to a field to conditionally make it readonly.\n *\n * @deprecated Passing a function directly to `readonly` is deprecated. Use `{ when: ... }` instead.\n */\nexport function readonly<TValue, TPathKind extends PathKind = PathKind.Root>(\n  path: SchemaPath<TValue, SchemaPathRules.Supported, TPathKind>,\n  logic?: NoInfer<LogicFn<TValue, boolean, TPathKind>>,\n): void;\n\nexport function readonly<TValue, TPathKind extends PathKind = PathKind.Root>(\n  path: SchemaPath<TValue, SchemaPathRules.Supported, TPathKind>,\n  configOrLogic?:\n    | {when?: NoInfer<LogicFn<TValue, boolean, TPathKind>>}\n    | NoInfer<LogicFn<TValue, boolean, TPathKind>>,\n) {\n  assertPathIsCurrent(path);\n\n  const pathNode = FieldPathNode.unwrapFieldPath(path);\n\n  let logic: LogicFn<TValue, boolean, TPathKind>;\n  if (typeof configOrLogic === 'object' && configOrLogic !== null && 'when' in configOrLogic) {\n    logic = configOrLogic.when ?? (() => true);\n  } else if (typeof configOrLogic === 'function') {\n    logic = configOrLogic;\n  } else {\n    logic = () => true;\n  }\n\n  pathNode.builder.addReadonlyRule(logic);\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 {LogicFn, OneOrMany, PathKind, type FieldContext} from '../../types';\nimport {ValidationError} from './validation_errors';\n\n/** Represents a value that has a length or size, such as an array or string, or set. */\nexport type ValueWithLengthOrSize = {length: number} | {size: number};\n\n/** Common options available on the standard validators. */\nexport type BaseValidatorConfig<TValue, TPathKind extends PathKind = PathKind.Root> =\n  | {\n      /** A user-facing error message to include with the error. */\n      message?: string | LogicFn<TValue, string, TPathKind>;\n      error?: never;\n      /** A function that receives the `FieldContext` and returns true if the validator should be applied. */\n      when?: NoInfer<LogicFn<TValue, boolean, TPathKind>>;\n    }\n  | {\n      /**\n       * Custom validation error(s) to report instead of the default,\n       * or a function that receives the `FieldContext` and returns custom validation error(s).\n       */\n      error?: OneOrMany<ValidationError> | LogicFn<TValue, OneOrMany<ValidationError>, TPathKind>;\n      message?: never;\n      /** A function that receives the `FieldContext` and returns true if the validator should be applied. */\n      when?: NoInfer<LogicFn<TValue, boolean, TPathKind>>;\n    };\n\n/** Gets the length or size of the given value. */\nexport function getLengthOrSize(value: ValueWithLengthOrSize) {\n  const v = value as {length: number; size: number};\n  return typeof v.length === 'number' ? v.length : v.size;\n}\n\n/**\n * Gets the value for an option that may be either a static value or a logic function that produces\n * the option value.\n *\n * @param opt The option from BaseValidatorConfig.\n * @param ctx The current FieldContext.\n * @returns The value for the option.\n */\nexport function getOption<TOption, TValue, TPathKind extends PathKind = PathKind.Root>(\n  opt: Exclude<TOption, Function> | LogicFn<TValue, TOption, TPathKind> | undefined,\n  ctx: FieldContext<TValue, TPathKind>,\n): TOption | undefined {\n  return opt instanceof Function ? opt(ctx) : opt;\n}\n\n/**\n * Checks if the given value is considered empty. Empty values are: null, undefined, '', false, NaN.\n */\nexport function isEmpty(value: unknown): boolean {\n  if (typeof value === 'number') {\n    return isNaN(value);\n  }\n  return value === '' || value === false || value == null;\n}\n\n/**\n * Normalizes validation errors (which can be a single error, an array of errors, or undefined)\n * into a list of errors.\n */\nexport function normalizeErrors<T>(error: OneOrMany<T> | undefined): readonly T[] {\n  if (error === undefined) {\n    return [];\n  }\n  if (Array.isArray(error)) {\n    return error as readonly T[];\n  }\n  return [error as 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 {addDefaultField} from '../../../field/validation';\nimport {FieldPathNode} from '../../../schema/path_node';\nimport {assertPathIsCurrent} from '../../../schema/schema';\nimport type {\n  FieldContext,\n  FieldValidator,\n  PathKind,\n  SchemaPath,\n  SchemaPathRules,\n} from '../../types';\n\n/**\n * Adds logic to a field to determine if the field has validation errors.\n *\n * @param path The target path to add the validation logic to.\n * @param logic A `Validator` that returns the current validation errors.\n * @template TValue The type of value stored in the field the logic is bound to.\n * @template TPathKind The kind of path the logic is bound to (a root path, child path, or item of an array)\n *\n * @category logic\n * @publicApi 22.0\n */\nexport function validate<TValue, TPathKind extends PathKind = PathKind.Root>(\n  path: SchemaPath<TValue, SchemaPathRules.Supported, TPathKind>,\n  logic: NoInfer<FieldValidator<TValue, TPathKind>>,\n): void {\n  assertPathIsCurrent(path);\n\n  const pathNode = FieldPathNode.unwrapFieldPath(path);\n  pathNode.builder.addSyncErrorRule((ctx) => {\n    return addDefaultField(logic(ctx as FieldContext<TValue, TPathKind>), ctx.fieldTree);\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 {FormField} from '../../../directive/form_field';\nimport type {ReadonlyFieldTree} from '../../types';\nimport type {StandardSchemaValidationError} from './standard_schema';\n\n/**\n * Options used to create a `ValidationError`.\n */\nexport interface ValidationErrorOptions {\n  /** Human readable error message. */\n  message?: string;\n}\n\n/**\n * A type that requires the given type `T` to have a `field` property.\n * @template T The type to add a `field` to.\n *\n * @publicApi 22.0\n */\nexport type WithFieldTree<T> = T & {fieldTree: ReadonlyFieldTree<unknown>};\n\n/**\n * A type that allows the given type `T` to optionally have a `field` property.\n * @template T The type to optionally add a `field` to.\n *\n * @publicApi 22.0\n */\nexport type WithOptionalFieldTree<T> = Omit<T, 'fieldTree'> & {\n  fieldTree?: ReadonlyFieldTree<unknown>;\n};\n\n/**\n * A type that ensures the given type `T` does not have a `field` property.\n * @template T The type to remove the `field` from.\n *\n * @publicApi 22.0\n */\nexport type WithoutFieldTree<T> = T & {fieldTree: never};\n\n/**\n * Create a required error associated with the target field\n * @param options The validation error options\n *\n * @publicApi 22.0\n */\nexport function requiredError(\n  options: WithFieldTree<ValidationErrorOptions>,\n): RequiredValidationError;\n/**\n * Create a required error\n * @param options The optional validation error options\n *\n * @category validation\n * @publicApi 22.0\n */\nexport function requiredError(\n  options?: ValidationErrorOptions,\n): WithoutFieldTree<RequiredValidationError>;\nexport function requiredError(\n  options?: ValidationErrorOptions,\n): WithOptionalFieldTree<RequiredValidationError> {\n  return new RequiredValidationError(options);\n}\n\n/**\n * Create a min value error associated with the target field\n * @param min The min value constraint\n * @param options The validation error options\n *\n * @category validation\n * @publicApi 22.0\n */\nexport function minError(\n  min: number,\n  options: WithFieldTree<ValidationErrorOptions>,\n): MinValidationError;\n/**\n * Create a min value error\n * @param min The min value constraint\n * @param options The optional validation error options\n *\n * @category validation\n * @publicApi 22.0\n */\nexport function minError(\n  min: number,\n  options?: ValidationErrorOptions,\n): WithoutFieldTree<MinValidationError>;\nexport function minError(\n  min: number,\n  options?: ValidationErrorOptions,\n): WithOptionalFieldTree<MinValidationError> {\n  return new MinValidationError(min, options);\n}\n\n/**\n * Create a minDate error associated with the target field\n * @param minDate The min date constraint\n * @param options The validation error options\n *\n * @category validation\n * @publicApi 22.0\n */\nexport function minDateError(\n  minDate: Date,\n  options: WithFieldTree<ValidationErrorOptions>,\n): MinDateValidationError;\n/**\n * Create a minDate error\n * @param minDate The min date constraint\n * @param options The optional validation error options\n *\n * @category validation\n * @publicApi 22.0\n */\nexport function minDateError(\n  minDate: Date,\n  options?: ValidationErrorOptions,\n): WithoutFieldTree<MinDateValidationError>;\nexport function minDateError(\n  minDate: Date,\n  options?: ValidationErrorOptions,\n): WithOptionalFieldTree<MinDateValidationError> {\n  return new MinDateValidationError(minDate, options);\n}\n\n/**\n * Create a max value error associated with the target field\n * @param max The max value constraint\n * @param options The validation error options\n *\n * @category validation\n * @publicApi 22.0\n */\nexport function maxError(\n  max: number,\n  options: WithFieldTree<ValidationErrorOptions>,\n): MaxValidationError;\n/**\n * Create a max value error\n * @param max The max value constraint\n * @param options The optional validation error options\n *\n * @category validation\n * @publicApi 22.0\n */\nexport function maxError(\n  max: number,\n  options?: ValidationErrorOptions,\n): WithoutFieldTree<MaxValidationError>;\nexport function maxError(\n  max: number,\n  options?: ValidationErrorOptions,\n): WithOptionalFieldTree<MaxValidationError> {\n  return new MaxValidationError(max, options);\n}\n\n/**\n * Create a maxDate error associated with the target field\n * @param maxDate The max date constraint\n * @param options The validation error options\n *\n * @category validation\n * @publicApi 22.0\n */\nexport function maxDateError(\n  maxDate: Date,\n  options: WithFieldTree<ValidationErrorOptions>,\n): MaxDateValidationError;\n/**\n * Create a maxDate error\n * @param maxDate The max date constraint\n * @param options The optional validation error options\n *\n * @category validation\n * @publicApi 22.0\n */\nexport function maxDateError(\n  maxDate: Date,\n  options?: ValidationErrorOptions,\n): WithoutFieldTree<MaxDateValidationError>;\nexport function maxDateError(\n  maxDate: Date,\n  options?: ValidationErrorOptions,\n): WithOptionalFieldTree<MaxDateValidationError> {\n  return new MaxDateValidationError(maxDate, options);\n}\n\n/**\n * Create a minLength error associated with the target field\n * @param minLength The minLength constraint\n * @param options The validation error options\n *\n * @category validation\n * @publicApi 22.0\n */\nexport function minLengthError(\n  minLength: number,\n  options: WithFieldTree<ValidationErrorOptions>,\n): MinLengthValidationError;\n/**\n * Create a minLength error\n * @param minLength The minLength constraint\n * @param options The optional validation error options\n *\n * @category validation\n * @publicApi 22.0\n */\nexport function minLengthError(\n  minLength: number,\n  options?: ValidationErrorOptions,\n): WithoutFieldTree<MinLengthValidationError>;\nexport function minLengthError(\n  minLength: number,\n  options?: ValidationErrorOptions,\n): WithOptionalFieldTree<MinLengthValidationError> {\n  return new MinLengthValidationError(minLength, options);\n}\n\n/**\n * Create a maxLength error associated with the target field\n * @param maxLength The maxLength constraint\n * @param options The validation error options\n *\n * @category validation\n * @publicApi 22.0\n */\nexport function maxLengthError(\n  maxLength: number,\n  options: WithFieldTree<ValidationErrorOptions>,\n): MaxLengthValidationError;\n/**\n * Create a maxLength error\n * @param maxLength The maxLength constraint\n * @param options The optional validation error options\n *\n * @category validation\n * @publicApi 22.0\n */\nexport function maxLengthError(\n  maxLength: number,\n  options?: ValidationErrorOptions,\n): WithoutFieldTree<MaxLengthValidationError>;\nexport function maxLengthError(\n  maxLength: number,\n  options?: ValidationErrorOptions,\n): WithOptionalFieldTree<MaxLengthValidationError> {\n  return new MaxLengthValidationError(maxLength, options);\n}\n\n/**\n * Create a pattern matching error associated with the target field\n * @param pattern The violated pattern\n * @param options The validation error options\n *\n * @category validation\n * @publicApi 22.0\n */\nexport function patternError(\n  pattern: RegExp,\n  options: WithFieldTree<ValidationErrorOptions>,\n): PatternValidationError;\n/**\n * Create a pattern matching error\n * @param pattern The violated pattern\n * @param options The optional validation error options\n *\n * @category validation\n * @publicApi 22.0\n */\nexport function patternError(\n  pattern: RegExp,\n  options?: ValidationErrorOptions,\n): WithoutFieldTree<PatternValidationError>;\nexport function patternError(\n  pattern: RegExp,\n  options?: ValidationErrorOptions,\n): WithOptionalFieldTree<PatternValidationError> {\n  return new PatternValidationError(pattern, options);\n}\n\n/**\n * Create an email format error associated with the target field\n * @param options The validation error options\n *\n * @category validation\n * @publicApi 22.0\n */\nexport function emailError(options: WithFieldTree<ValidationErrorOptions>): EmailValidationError;\n/**\n * Create an email format error\n * @param options The optional validation error options\n *\n * @category validation\n * @publicApi 22.0\n */\nexport function emailError(\n  options?: ValidationErrorOptions,\n): WithoutFieldTree<EmailValidationError>;\nexport function emailError(\n  options?: ValidationErrorOptions,\n): WithOptionalFieldTree<EmailValidationError> {\n  return new EmailValidationError(options);\n}\n\n/**\n * Common interface for all validation errors.\n *\n * This can be returned from validators.\n *\n * It's also used by the creation functions to create an instance\n * (e.g. `requiredError`, `minError`, etc.).\n *\n * @see [Signal Form Validation](guide/forms/signals/validation)\n * @see [Signal Form Validation Errors](guide/forms/signals/validation#validation-errors)\n * @category validation\n * @publicApi 22.0\n */\nexport interface ValidationError {\n  /** Identifies the kind of error. */\n  readonly kind: string;\n  /** Human readable error message. */\n  readonly message?: string;\n}\n\nexport declare namespace ValidationError {\n  /**\n   * Validation error with an associated field tree.\n   *\n   * This is returned from field state, e.g., catField.errors() would be of a list of errors with\n   * `field: catField` bound to state.\n   */\n  export interface WithFieldTree extends ValidationError {\n    /** The field associated with this error. */\n    readonly fieldTree: ReadonlyFieldTree<unknown>;\n    readonly formField?: FormField<unknown>;\n  }\n  /** @deprecated Use `ValidationError.WithFieldTree` instead  */\n  export type WithField = WithFieldTree;\n\n  /**\n   * Validation error with an associated field tree and specific form field binding.\n   */\n  export interface WithFormField extends WithFieldTree {\n    readonly formField: FormField<unknown>;\n  }\n\n  /**\n   * Validation error with optional field.\n   *\n   * This is generally used in places where the result might have a field.\n   * e.g., as a result of a `validateTree`, or when handling form submission.\n   */\n  export interface WithOptionalFieldTree extends ValidationError {\n    /** The field associated with this error. */\n    readonly fieldTree?: ReadonlyFieldTree<unknown>;\n  }\n  /** @deprecated Use `ValidationError.WithOptionalFieldTree` instead  */\n  export type WithOptionalField = WithOptionalFieldTree;\n\n  /**\n   * Validation error with no field.\n   *\n   * This is used to strongly enforce that fields are not allowed in validation result.\n   */\n  export interface WithoutFieldTree extends ValidationError {\n    /** The field associated with this error. */\n    readonly fieldTree?: never;\n    readonly formField?: never;\n  }\n  /** @deprecated Use `ValidationError.WithoutFieldTree` instead  */\n  export type WithoutField = WithoutFieldTree;\n}\n\n/**\n * Internal version of `NgValidationError`, we create this separately so we can change its type on\n * the exported version to a type union of the possible sub-classes.\n *\n * @publicApi 22.0\n */\nexport abstract class BaseNgValidationError implements ValidationError {\n  /** Brand the class to avoid Typescript structural matching */\n  private __brand = undefined;\n\n  /** Identifies the kind of error. */\n  readonly kind: string = '';\n\n  /** The field associated with this error. */\n  readonly fieldTree!: ReadonlyFieldTree<unknown>;\n\n  /** Human readable error message. */\n  readonly message?: string;\n\n  constructor(options?: ValidationErrorOptions) {\n    if (options) {\n      Object.assign(this, options);\n    }\n  }\n}\n\n/**\n * An error used to indicate that a required field is empty.\n *\n * @category validation\n * @publicApi 22.0\n */\nexport class RequiredValidationError extends BaseNgValidationError {\n  override readonly kind = 'required';\n}\n\n/**\n * An error used to indicate that a value is lower than the minimum allowed.\n *\n * @category validation\n * @publicApi 22.0\n */\nexport class MinValidationError extends BaseNgValidationError {\n  override readonly kind = 'min';\n\n  constructor(\n    readonly min: number,\n    options?: ValidationErrorOptions,\n  ) {\n    super(options);\n  }\n}\n\n/**\n * An error used to indicate that a date value is earlier than the minimum allowed.\n *\n * @category validation\n * @publicApi 22.0\n */\nexport class MinDateValidationError extends BaseNgValidationError {\n  override readonly kind = 'minDate';\n\n  constructor(\n    readonly minDate: Date,\n    options?: ValidationErrorOptions,\n  ) {\n    super(options);\n  }\n}\n\n/**\n * An error used to indicate that a value is higher than the maximum allowed.\n *\n * @category validation\n * @publicApi 22.0\n */\nexport class MaxValidationError extends BaseNgValidationError {\n  override readonly kind = 'max';\n\n  constructor(\n    readonly max: number,\n    options?: ValidationErrorOptions,\n  ) {\n    super(options);\n  }\n}\n\n/**\n * An error used to indicate that a date value is later than the maximum allowed.\n *\n * @category validation\n * @publicApi 22.0\n */\nexport class MaxDateValidationError extends BaseNgValidationError {\n  override readonly kind = 'maxDate';\n\n  constructor(\n    readonly maxDate: Date,\n    options?: ValidationErrorOptions,\n  ) {\n    super(options);\n  }\n}\n\n/**\n * An error used to indicate that a value is shorter than the minimum allowed length.\n *\n * @category validation\n * @publicApi 22.0\n */\nexport class MinLengthValidationError extends BaseNgValidationError {\n  override readonly kind = 'minLength';\n\n  constructor(\n    readonly minLength: number,\n    options?: ValidationErrorOptions,\n  ) {\n    super(options);\n  }\n}\n\n/**\n * An error used to indicate that a value is longer than the maximum allowed length.\n *\n * @category validation\n * @publicApi 22.0\n */\nexport class MaxLengthValidationError extends BaseNgValidationError {\n  override readonly kind = 'maxLength';\n\n  constructor(\n    readonly maxLength: number,\n    options?: ValidationErrorOptions,\n  ) {\n    super(options);\n  }\n}\n\n/**\n * An error used to indicate that a value does not match the required pattern.\n *\n * @category validation\n * @publicApi 22.0\n */\nexport class PatternValidationError extends BaseNgValidationError {\n  override readonly kind = 'pattern';\n\n  constructor(\n    readonly pattern: RegExp,\n    options?: ValidationErrorOptions,\n  ) {\n    super(options);\n  }\n}\n\n/**\n * An error used to indicate that a value is not a valid email.\n *\n * @category validation\n * @publicApi 22.0\n */\nexport class EmailValidationError extends BaseNgValidationError {\n  override readonly kind = 'email';\n}\n\n/**\n * An error used to indicate that a value entered in a native input does not parse.\n *\n * @category validation\n * @publicApi 22.0\n */\nexport class NativeInputParseError extends BaseNgValidationError {\n  override readonly kind = 'parse';\n}\n\n/**\n * The base class for all built-in, non-custom errors. This class can be used to check if an error\n * is one of the standard kinds, allowing you to switch on the kind to further narrow the type.\n *\n * @example\n * ```ts\n * const f = form(...);\n * for (const e of form().errors()) {\n *   if (e instanceof NgValidationError) {\n *     switch(e.kind) {\n *       case 'required':\n *         console.log('This is required!');\n *         break;\n *       case 'min':\n *         console.log(`Must be at least ${e.min}`);\n *         break;\n *       ...\n *     }\n *   }\n * }\n * ```\n *\n * @category validation\n * @publicApi 22.0\n */\nexport const NgValidationError: abstract new () => NgValidationError = BaseNgValidationError as any;\nexport type NgValidationError =\n  | RequiredValidationError\n  | MinValidationError\n  | MinDateValidationError\n  | MaxValidationError\n  | MaxDateValidationError\n  | MinLengthValidationError\n  | MaxLengthValidationError\n  | PatternValidationError\n  | EmailValidationError\n  | StandardSchemaValidationError\n  | NativeInputParseError;\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 {PathKind, SchemaPath, SchemaPathRules} from '../../types';\nimport {BaseValidatorConfig, getOption, isEmpty} from './util';\nimport {validate} from './validate';\nimport {emailError} from './validation_errors';\n\n/**\n * A regular expression that matches valid e-mail addresses.\n *\n * At a high level, this regexp matches e-mail addresses of the format `local-part@tld`, where:\n * - `local-part` consists of one or more of the allowed characters (alphanumeric and some\n *   punctuation symbols).\n * - `local-part` cannot begin or end with a period (`.`).\n * - `local-part` cannot be longer than 64 characters.\n * - `tld` consists of one or more `labels` separated by periods (`.`). For example `localhost` or\n *   `foo.com`.\n * - A `label` consists of one or more of the allowed characters (alphanumeric, dashes (`-`) and\n *   periods (`.`)).\n * - A `label` cannot begin or end with a dash (`-`) or a period (`.`).\n * - A `label` cannot be longer than 63 characters.\n * - The whole address cannot be longer than 254 characters.\n *\n * ## Implementation background\n *\n * This regexp was ported over from AngularJS (see there for git history):\n * https://github.com/angular/angular.js/blob/c133ef836/src/ng/directive/input.js#L27\n * It is based on the\n * [WHATWG version](https://html.spec.whatwg.org/multipage/input.html#valid-e-mail-address) with\n * some enhancements to incorporate more RFC rules (such as rules related to domain names and the\n * lengths of different parts of the address). The main differences from the WHATWG version are:\n *   - Disallow `local-part` to begin or end with a period (`.`).\n *   - Disallow `local-part` length to exceed 64 characters.\n *   - Disallow total address length to exceed 254 characters.\n *\n * See [this commit](https://github.com/angular/angular.js/commit/f3f5cf72e) for more details.\n */\nconst EMAIL_REGEXP =\n  /^(?=.{1,254}$)(?=.{1,64}@)[a-zA-Z0-9!#$%&'*+/=?^_`{|}~-]+(?:\\.[a-zA-Z0-9!#$%&'*+/=?^_`{|}~-]+)*@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/;\n\n/**\n * Binds a validator to the given path that requires the value to match the standard email format.\n * This function can only be called on string paths.\n *\n * @param path Path of the field to validate\n * @param config Optional, allows providing any of the following options:\n *  - `error`: Custom validation error(s) to be used instead of the default `ValidationError.email()`\n *    or a function that receives the `FieldContext` and returns custom validation error(s).\n * @template TPathKind The kind of path the logic is bound to (a root path, child path, or item of an array)\n *\n * @see [Signal Form Email Validation](guide/forms/signals/validation#email)\n * @category validation\n * @publicApi 22.0\n */\nexport function email<TPathKind extends PathKind = PathKind.Root>(\n  path: SchemaPath<string, SchemaPathRules.Supported, TPathKind>,\n  config?: BaseValidatorConfig<string, TPathKind>,\n) {\n  validate(path, (ctx) => {\n    if (config?.when && !config.when(ctx)) {\n      return undefined;\n    }\n    if (isEmpty(ctx.value())) {\n      return undefined;\n    }\n    if (!EMAIL_REGEXP.test(ctx.value())) {\n      if (config?.error) {\n        return getOption(config.error, ctx);\n      } else {\n        return emailError({message: getOption(config?.message, ctx)});\n      }\n    }\n\n    return undefined;\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 {LogicFn, PathKind, SchemaPath, SchemaPathRules} from '../../types';\nimport {createMetadataKey, MAX, MAX_NUMBER, metadata, LimitKey} from '../metadata';\nimport {BaseValidatorConfig, getOption} from './util';\nimport {validate} from './validate';\nimport {maxError} from './validation_errors';\n\n/**\n * Binds a validator to the given path that requires the value to be less than or equal to the\n * given `maxValue`.\n * This function can only be called on number paths.\n * This function can only be called on number paths.\n * In addition to binding a validator, this function adds `MAX` property to the field.\n *\n * @param path Path of the field to validate\n * @param maxValue The maximum value, or a LogicFn that returns the maximum value.\n * @param config Optional, allows providing any of the following options:\n *  - `error`: Custom validation error(s) to be used instead of the default `ValidationError.max(maxValue)`\n *    or a function that receives the `FieldContext` and returns custom validation error(s).\n * @template TPathKind The kind of path the logic is bound to (a root path, child path, or item of an array)\n *\n * @see [Signal Form Max Validation](guide/forms/signals/validation#min-and-max)\n * @category validation\n * @publicApi 22.0\n */\nexport function max<TValue extends number | null, TPathKind extends PathKind = PathKind.Root>(\n  path: SchemaPath<TValue, SchemaPathRules.Supported, TPathKind>,\n  maxValue: number | LogicFn<TValue, number | undefined, TPathKind>,\n  config?: BaseValidatorConfig<TValue, TPathKind>,\n): void {\n  const MAX_MEMO = createMetadataKey<number | undefined>();\n\n  // Memoize the maximum valid value.\n  metadata(path, MAX_MEMO, (ctx) => {\n    if (config?.when && !config.when(ctx)) {\n      return undefined;\n    }\n    return typeof maxValue === 'function' ? maxValue(ctx) : maxValue;\n  });\n\n  // Publish the memoized maximum value for aggregation.\n  metadata(path, MAX_NUMBER, ({state}) => state.metadata(MAX_MEMO)!());\n\n  // Use `MAX_NUMBER` to define the `max` property of the field.\n  metadata(path, MAX, () => MAX_NUMBER as LimitKey<TValue>);\n  validate(path, (ctx) => {\n    const value = ctx.value();\n    if (value === null || Number.isNaN(value)) {\n      return undefined;\n    }\n    const max = ctx.state.metadata(MAX_MEMO)!();\n    if (max === undefined || Number.isNaN(max)) {\n      return undefined;\n    }\n    if (value > max) {\n      if (config?.error) {\n        return getOption(config.error, ctx);\n      } else {\n        return maxError(max, {message: getOption(config?.message, ctx)});\n      }\n    }\n    return undefined;\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 {LogicFn, PathKind, SchemaPath, SchemaPathRules} from '../../types';\nimport {createMetadataKey, LimitKey, MAX, MAX_DATE, metadata} from '../metadata';\nimport {BaseValidatorConfig, getOption} from './util';\nimport {validate} from './validate';\nimport {maxDateError} from './validation_errors';\n\n/**\n * Binds a validator to the given path that requires the value to be less than or equal to the\n * given `maxDate`.\n * This function can only be called on date paths.\n * In addition to binding a validator, this function adds `MAX` property to the field.\n *\n * @param path Path of the field to validate\n * @param maxDate The maximum date, or a LogicFn that returns the maximum date.\n * @param config Optional, allows providing any of the following options:\n *  - `error`: Custom validation error(s) to be used instead of the default `ValidationError.max(maxDate)`\n *    or a function that receives the `FieldContext` and returns custom validation error(s).\n * @template TPathKind The kind of path the logic is bound to (a root path, child path, or item of an array)\n *\n * @see [Signal Form Max Validation](guide/forms/signals/validation#min-and-max)\n * @category validation\n * @publicApi 22.0\n */\nexport function maxDate<TValue extends Date | null, TPathKind extends PathKind = PathKind.Root>(\n  path: SchemaPath<TValue, SchemaPathRules.Supported, TPathKind>,\n  maxDateValue: Date | LogicFn<TValue, Date | undefined, TPathKind>,\n  config?: BaseValidatorConfig<TValue, TPathKind>,\n): void {\n  const MAX_MEMO = createMetadataKey<Date | undefined>();\n\n  // Memoize the maximum valid date.\n  metadata(path, MAX_MEMO, (ctx) => {\n    if (config?.when && !config.when(ctx)) {\n      return undefined;\n    }\n    return typeof maxDateValue === 'function' ? maxDateValue(ctx) : maxDateValue;\n  });\n\n  // Publish the memoized maximum date for aggregation.\n  metadata(path, MAX_DATE, ({state}) => state.metadata(MAX_MEMO)!());\n\n  // Use `MAX_DATE` to define the `max` property of the field.\n  metadata(path, MAX, () => MAX_DATE as LimitKey<TValue>);\n\n  // Validate that the field value is not greater than the maximum date.\n  validate(path, (ctx) => {\n    const value = ctx.value();\n    if (value === null || Number.isNaN(value.getTime())) {\n      return undefined;\n    }\n    const max = ctx.state.metadata(MAX_MEMO)!();\n    if (max === undefined || Number.isNaN(max.getTime())) {\n      return undefined;\n    }\n    if (value > max) {\n      if (config?.error) {\n        return getOption(config.error, ctx);\n      } else {\n        return maxDateError(max, {message: getOption(config?.message, ctx)});\n      }\n    }\n    return undefined;\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 {LogicFn, PathKind, SchemaPath, SchemaPathRules} from '../../types';\nimport {createMetadataKey, MAX_LENGTH, metadata} from '../metadata';\nimport {\n  BaseValidatorConfig,\n  getLengthOrSize,\n  getOption,\n  isEmpty,\n  ValueWithLengthOrSize,\n} from './util';\nimport {validate} from './validate';\nimport {maxLengthError} from './validation_errors';\n\n/**\n * Binds a validator to the given path that requires the length of the value to be less than or\n * equal to the given `maxLength`.\n * This function can only be called on string or array paths.\n * In addition to binding a validator, this function adds `MAX_LENGTH` property to the field.\n *\n * @param path Path of the field to validate\n * @param maxLength The maximum length, or a LogicFn that returns the maximum length.\n * @param config Optional, allows providing any of the following options:\n *  - `error`: Custom validation error(s) to be used instead of the default `ValidationError.maxLength(maxLength)`\n *    or a function that receives the `FieldContext` and returns custom validation error(s).\n * @template TValue The type of value stored in the field the logic is bound to.\n * @template TPathKind The kind of path the logic is bound to (a root path, child path, or item of an array)\n *\n * @see [Signal Form Max Length Validation](guide/forms/signals/validation#minlength-and-maxlength)\n * @category validation\n * @publicApi 22.0\n */\nexport function maxLength<\n  TValue extends ValueWithLengthOrSize,\n  TPathKind extends PathKind = PathKind.Root,\n>(\n  path: SchemaPath<TValue, SchemaPathRules.Supported, TPathKind>,\n  maxLength: number | LogicFn<TValue, number | undefined, TPathKind>,\n  config?: BaseValidatorConfig<TValue, TPathKind>,\n) {\n  const MAX_LENGTH_MEMO = metadata(path, createMetadataKey<number | undefined>(), (ctx) => {\n    if (config?.when && !config.when(ctx)) {\n      return undefined;\n    }\n    return typeof maxLength === 'number' ? maxLength : maxLength(ctx);\n  });\n  metadata(path, MAX_LENGTH, ({state}) => state.metadata(MAX_LENGTH_MEMO)!());\n  validate(path, (ctx) => {\n    if (isEmpty(ctx.value())) {\n      return undefined;\n    }\n    const maxLength = ctx.state.metadata(MAX_LENGTH_MEMO)!();\n    if (maxLength === undefined) {\n      return undefined;\n    }\n    if (getLengthOrSize(ctx.value()) > maxLength) {\n      if (config?.error) {\n        return getOption(config.error, ctx);\n      } else {\n        return maxLengthError(maxLength, {message: getOption(config?.message, ctx)});\n      }\n    }\n    return undefined;\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 {LogicFn, PathKind, SchemaPath, SchemaPathRules} from '../../types';\nimport {createMetadataKey, metadata, LimitKey, MIN, MIN_NUMBER} from '../metadata';\nimport {BaseValidatorConfig, getOption} from './util';\nimport {validate} from './validate';\nimport {minError} from './validation_errors';\n\n/**\n * Binds a validator to the given path that requires the value to be greater than or equal to\n * the given `minValue`.\n * This function can only be called on number paths.\n * This function can only be called on number paths.\n * In addition to binding a validator, this function adds `MIN` property to the field.\n *\n * @param path Path of the field to validate\n * @param minValue The minimum value, or a LogicFn that returns the minimum value.\n * @param config Optional, allows providing any of the following options:\n *  - `error`: Custom validation error(s) to be used instead of the default `ValidationError.min(minValue)`\n *    or a function that receives the `FieldContext` and returns custom validation error(s).\n * @template TPathKind The kind of path the logic is bound to (a root path, child path, or item of an array)\n *\n * @see [Signal Form Min Validation](guide/forms/signals/validation#min-and-max)\n * @category validation\n * @publicApi 22.0\n */\nexport function min<TValue extends number | null, TPathKind extends PathKind = PathKind.Root>(\n  path: SchemaPath<TValue, SchemaPathRules.Supported, TPathKind>,\n  minValue: number | LogicFn<TValue, number | undefined, TPathKind>,\n  config?: BaseValidatorConfig<TValue, TPathKind>,\n): void {\n  const MIN_MEMO = createMetadataKey<number | undefined>();\n\n  // Memomize the minimum valid.\n  metadata(path, MIN_MEMO, (ctx) => {\n    if (config?.when && !config.when(ctx)) {\n      return undefined;\n    }\n    return typeof minValue === 'function' ? minValue(ctx) : minValue;\n  });\n\n  // Publish the memoized mininum value for aggregation.\n  metadata(path, MIN_NUMBER, ({state}) => state.metadata(MIN_MEMO)!());\n\n  // Use `MIN_NUMBER` to define the `min` property of the field.\n  metadata(path, MIN, () => MIN_NUMBER as LimitKey<TValue>);\n  validate(path, (ctx) => {\n    const value = ctx.value();\n    if (value === null || Number.isNaN(value)) {\n      return undefined;\n    }\n    const min = ctx.state.metadata(MIN_MEMO)!();\n    if (min === undefined || Number.isNaN(min)) {\n      return undefined;\n    }\n    if (value < min) {\n      if (config?.error) {\n        return getOption(config.error, ctx);\n      } else {\n        return minError(min, {message: getOption(config?.message, ctx)});\n      }\n    }\n    return undefined;\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 {LogicFn, PathKind, SchemaPath, SchemaPathRules} from '../../types';\nimport {createMetadataKey, LimitKey, metadata, MIN, MIN_DATE} from '../metadata';\nimport {BaseValidatorConfig, getOption} from './util';\nimport {validate} from './validate';\nimport {minDateError} from './validation_errors';\n\n/**\n * Binds a validator to the given path that requires the value to be greater than or equal to\n * the given `minDate`.\n * This function can only be called on date paths.\n * In addition to binding a validator, this function adds `MIN` property to the field.\n *\n * @param path Path of the field to validate\n * @param minDate The minimum date, or a LogicFn that returns the minimum date.\n * @param config Optional, allows providing any of the following options:\n *  - `error`: Custom validation error(s) to be used instead of the default `ValidationError.min(minDate)`\n *    or a function that receives the `FieldContext` and returns custom validation error(s).\n * @template TPathKind The kind of path the logic is bound to (a root path, child path, or item of an array)\n *\n * @see [Signal Form Min Validation](guide/forms/signals/validation#min-and-max)\n * @category validation\n * @publicApi 22.0\n */\nexport function minDate<TValue extends Date | null, TPathKind extends PathKind = PathKind.Root>(\n  path: SchemaPath<TValue, SchemaPathRules.Supported, TPathKind>,\n  minDateValue: Date | LogicFn<TValue, Date | undefined, TPathKind>,\n  config?: BaseValidatorConfig<TValue, TPathKind>,\n): void {\n  const MIN_MEMO = createMetadataKey<Date | undefined>();\n\n  // Memoize the minimum valid date.\n  metadata(path, MIN_MEMO, (ctx) => {\n    if (config?.when && !config.when(ctx)) {\n      return undefined;\n    }\n    return typeof minDateValue === 'function' ? minDateValue(ctx) : minDateValue;\n  });\n\n  // Publish the memoized minimum date for aggregation.\n  metadata(path, MIN_DATE, ({state}) => state.metadata(MIN_MEMO)!());\n\n  // Use `MIN_DATE` to define the `min` property of the field.\n  metadata(path, MIN, () => MIN_DATE as LimitKey<TValue>);\n\n  // Validate that the field value is not less than the minimum date.\n  validate(path, (ctx) => {\n    const value = ctx.value();\n    if (value === null || Number.isNaN(value.getTime())) {\n      return undefined;\n    }\n    const min = ctx.state.metadata(MIN_MEMO)!();\n    if (min === undefined || Number.isNaN(min.getTime())) {\n      return undefined;\n    }\n    if (value < min) {\n      if (config?.error) {\n        return getOption(config.error, ctx);\n      } else {\n        return minDateError(min, {message: getOption(config?.message, ctx)});\n      }\n    }\n    return undefined;\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 {LogicFn, PathKind, SchemaPath, SchemaPathRules} from '../../types';\nimport {createMetadataKey, metadata, MIN_LENGTH} from '../metadata';\nimport {\n  BaseValidatorConfig,\n  getLengthOrSize,\n  getOption,\n  isEmpty,\n  ValueWithLengthOrSize,\n} from './util';\nimport {validate} from './validate';\nimport {minLengthError} from './validation_errors';\n\n/**\n * Binds a validator to the given path that requires the length of the value to be greater than or\n * equal to the given `minLength`.\n * This function can only be called on string or array paths.\n * In addition to binding a validator, this function adds `MIN_LENGTH` property to the field.\n *\n * @param path Path of the field to validate\n * @param minLength The minimum length, or a LogicFn that returns the minimum length.\n * @param config Optional, allows providing any of the following options:\n *  - `error`: Custom validation error(s) to be used instead of the default `ValidationError.minLength(minLength)`\n *    or a function that receives the `FieldContext` and returns custom validation error(s).\n * @template TValue The type of value stored in the field the logic is bound to.\n * @template TPathKind The kind of path the logic is bound to (a root path, child path, or item of an array)\n *\n * @see [Signal Form Min Length Validation](guide/forms/signals/validation#minlength-and-maxlength)\n * @category validation\n * @publicApi 22.0\n */\nexport function minLength<\n  TValue extends ValueWithLengthOrSize,\n  TPathKind extends PathKind = PathKind.Root,\n>(\n  path: SchemaPath<TValue, SchemaPathRules.Supported, TPathKind>,\n  minLength: number | LogicFn<TValue, number | undefined, TPathKind>,\n  config?: BaseValidatorConfig<TValue, TPathKind>,\n) {\n  const MIN_LENGTH_MEMO = metadata(path, createMetadataKey<number | undefined>(), (ctx) => {\n    if (config?.when && !config.when(ctx)) {\n      return undefined;\n    }\n    return typeof minLength === 'number' ? minLength : minLength(ctx);\n  });\n  metadata(path, MIN_LENGTH, ({state}) => state.metadata(MIN_LENGTH_MEMO)!());\n  validate(path, (ctx) => {\n    if (isEmpty(ctx.value())) {\n      return undefined;\n    }\n    const minLength = ctx.state.metadata(MIN_LENGTH_MEMO)!();\n    if (minLength === undefined) {\n      return undefined;\n    }\n    if (getLengthOrSize(ctx.value()) < minLength) {\n      if (config?.error) {\n        return getOption(config.error, ctx);\n      } else {\n        return minLengthError(minLength, {message: getOption(config?.message, ctx)});\n      }\n    }\n    return undefined;\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 {LogicFn, PathKind, SchemaPath, SchemaPathRules} from '../../types';\nimport {createMetadataKey, metadata, PATTERN} from '../metadata';\nimport {BaseValidatorConfig, getOption, isEmpty} from './util';\nimport {validate} from './validate';\nimport {patternError} from './validation_errors';\n\n/**\n * Binds a validator to the given path that requires the value to match a specific regex pattern.\n * This function can only be called on string paths.\n * In addition to binding a validator, this function adds `PATTERN` property to the field.\n *\n * @param path Path of the field to validate\n * @param pattern The RegExp pattern to match, or a LogicFn that returns the RegExp pattern.\n * @param config Optional, allows providing any of the following options:\n *  - `error`: Custom validation error(s) to be used instead of the default `ValidationError.pattern(pattern)`\n *    or a function that receives the `FieldContext` and returns custom validation error(s).\n * @template TPathKind The kind of path the logic is bound to (a root path, child path, or item of an array)\n *\n * @see [Signal Form Pattern Validation](guide/forms/signals/validation#pattern)\n * @category validation\n * @publicApi 22.0\n */\nexport function pattern<TPathKind extends PathKind = PathKind.Root>(\n  path: SchemaPath<string, SchemaPathRules.Supported, TPathKind>,\n  pattern: RegExp | LogicFn<string | undefined, RegExp | undefined, TPathKind>,\n  config?: BaseValidatorConfig<string, TPathKind>,\n) {\n  const PATTERN_MEMO = metadata(path, createMetadataKey<RegExp | undefined>(), (ctx) => {\n    if (config?.when && !config.when(ctx)) {\n      return undefined;\n    }\n    return pattern instanceof RegExp ? pattern : pattern(ctx);\n  });\n  metadata(path, PATTERN, ({state}) => state.metadata(PATTERN_MEMO)!());\n  validate(path, (ctx) => {\n    if (isEmpty(ctx.value())) {\n      return undefined;\n    }\n    const pattern = ctx.state.metadata(PATTERN_MEMO)!();\n    if (pattern === undefined) {\n      return undefined;\n    }\n    if (!pattern.test(ctx.value())) {\n      if (config?.error) {\n        return getOption(config.error, ctx);\n      } else {\n        return patternError(pattern, {message: getOption(config?.message, ctx)});\n      }\n    }\n    return undefined;\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 {LogicFn, PathKind, SchemaPath, SchemaPathRules} from '../../types';\nimport {createMetadataKey, metadata, REQUIRED} from '../metadata';\nimport {BaseValidatorConfig, getOption, isEmpty} from './util';\nimport {validate} from './validate';\nimport {requiredError} from './validation_errors';\n\n/**\n * Binds a validator to the given path that requires the value to be non-empty.\n * This function can only be called on any type of path.\n * In addition to binding a validator, this function adds `REQUIRED` property to the field.\n *\n * @param path Path of the field to validate\n * @param config Optional, allows providing any of the following options:\n *  - `message`: A user-facing message for the error.\n *  - `error`: Custom validation error(s) to be used instead of the default `ValidationError.required()`\n *    or a function that receives the `FieldContext` and returns custom validation error(s).\n *  - `when`: A function that receives the `FieldContext` and returns true if the field is required\n * @template TValue The type of value stored in the field the logic is bound to.\n * @template TPathKind The kind of path the logic is bound to (a root path, child path, or item of an array)\n *\n * @see [Signal Form Required Validation](guide/forms/signals/validation#required)\n * @category validation\n * @publicApi 22.0\n */\nexport function required<TValue, TPathKind extends PathKind = PathKind.Root>(\n  path: SchemaPath<TValue, SchemaPathRules.Supported, TPathKind>,\n  config?: BaseValidatorConfig<TValue, TPathKind> & {\n    when?: NoInfer<LogicFn<TValue, boolean, TPathKind>>;\n  },\n): void {\n  const REQUIRED_MEMO = metadata(path, createMetadataKey<boolean>(), (ctx) =>\n    config?.when ? config.when(ctx) : true,\n  );\n  metadata(path, REQUIRED, ({state}) => state.metadata(REQUIRED_MEMO)!()!);\n  validate(path, (ctx) => {\n    if (ctx.state.metadata(REQUIRED_MEMO)!() && isEmpty(ctx.value())) {\n      if (config?.error) {\n        return getOption(config.error, ctx);\n      } else {\n        return requiredError({message: getOption(config?.message, ctx)});\n      }\n    }\n    return undefined;\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  computed,\n  DebounceTimer,\n  ResourceRef,\n  ResourceSnapshot,\n  Signal,\n  debounced,\n  ɵchain,\n} from '@angular/core';\nimport {FieldNode} from '../../../field/node';\nimport {addDefaultField} from '../../../field/validation';\nimport {FieldPathNode} from '../../../schema/path_node';\nimport {assertPathIsCurrent} from '../../../schema/schema';\nimport {\n  FieldContext,\n  LogicFn,\n  PathKind,\n  SchemaPath,\n  SchemaPathRules,\n  TreeValidationResult,\n} from '../../types';\nimport {IS_ASYNC_VALIDATION_RESOURCE, createManagedMetadataKey, metadata} from '../metadata';\n\n/**\n * A function that takes the result of an async operation and the current field context, and maps it\n * to a list of validation errors.\n *\n * @param result The result of the async operation.\n * @param ctx The context for the field the validator is attached to.\n * @return A validation error, or list of validation errors to report based on the result of the async operation.\n *   The returned errors can optionally specify a field that the error should be targeted to.\n *   A targeted error will show up as an error on its target field rather than the field being validated.\n *   If a field is not given, the error is assumed to apply to the field being validated.\n * @template TValue The type of value stored in the field being validated.\n * @template TResult The type of result returned by the async operation\n * @template TPathKind The kind of path being validated (a root path, child path, or item of an array)\n *\n * @publicApi 22.0\n */\nexport type MapToErrorsFn<TValue, TResult, TPathKind extends PathKind = PathKind.Root> = (\n  result: TResult,\n  ctx: FieldContext<TValue, TPathKind>,\n) => TreeValidationResult;\n\n/**\n * Options that indicate how to create a resource for async validation for a field,\n * and map its result to validation errors.\n *\n * @template TValue The type of value stored in the field being validated.\n * @template TParams The type of parameters to the resource.\n * @template TResult The type of result returned by the resource\n * @template TPathKind The kind of path being validated (a root path, child path, or item of an array)\n * @see [Signal Form Async Validation](guide/forms/signals/validation#async-validation)\n * @category validation\n * @publicApi 22.0\n */\nexport interface AsyncValidatorOptions<\n  TValue,\n  TParams,\n  TResult,\n  TPathKind extends PathKind = PathKind.Root,\n> {\n  /**\n   * A function that receives the field context and returns the params for the resource.\n   *\n   * @param ctx The field context for the field being validated.\n   * @returns The params for the resource.\n   */\n  readonly params: (ctx: FieldContext<TValue, TPathKind>) => TParams;\n\n  /**\n   * Duration in milliseconds to wait before triggering the async operation, or a function that\n   * returns a promise that resolves when the update should proceed.\n   */\n  readonly debounce?: DebounceTimer<TParams | undefined>;\n\n  /**\n   * A function that receives the resource params and returns a resource of the given params.\n   * The given params should be used as is to create the resource.\n   * The forms system will report the params as `undefined` when this validation doesn't need to be run.\n   *\n   * @param params The params to use for constructing the resource\n   * @returns A reference to the constructed resource.\n   */\n  readonly factory: (params: Signal<TParams | undefined>) => ResourceRef<TResult | undefined>;\n  /**\n   * A function to handle errors thrown by httpResource (HTTP errors, network errors, etc.).\n   * Receives the error and the field context, returns a list of validation errors.\n   */\n  readonly onError: (error: unknown, ctx: FieldContext<TValue, TPathKind>) => TreeValidationResult;\n  /**\n   * A function that takes the resource result, and the current field context and maps it to a list\n   * of validation errors.\n   *\n   * @param result The resource result.\n   * @param ctx The context for the field the validator is attached to.\n   * @return A validation error, or list of validation errors to report based on the resource result.\n   *   The returned errors can optionally specify a field that the error should be targeted to.\n   *   A targeted error will show up as an error on its target field rather than the field being validated.\n   *   If a field is not given, the error is assumed to apply to the field being validated.\n   */\n  readonly onSuccess: MapToErrorsFn<TValue, TResult, TPathKind>;\n  /**\n   * A function that receives the field context and returns true if the async validation should be run.\n   */\n  readonly when?: NoInfer<LogicFn<TValue, boolean, TPathKind>>;\n}\n\n/**\n * Adds async validation to the field corresponding to the given path based on a resource.\n * Async validation for a field only runs once all synchronous validation is passing.\n *\n * @param path A path indicating the field to bind the async validation logic to.\n * @param opts The async validation options.\n * @template TValue The type of value stored in the field being validated.\n * @template TParams The type of parameters to the resource.\n * @template TResult The type of result returned by the resource\n * @template TPathKind The kind of path being validated (a root path, child path, or item of an array)\n *\n * @see [Signal Form Async Validation](guide/forms/signals/validation#async-validation)\n * @category validation\n * @publicApi 22.0\n */\nexport function validateAsync<TValue, TParams, TResult, TPathKind extends PathKind = PathKind.Root>(\n  path: SchemaPath<TValue, SchemaPathRules.Supported, TPathKind>,\n  opts: AsyncValidatorOptions<TValue, TParams, TResult, TPathKind>,\n): void {\n  assertPathIsCurrent(path);\n  const pathNode = FieldPathNode.unwrapFieldPath(path);\n\n  const RESOURCE = createManagedMetadataKey<ReturnType<typeof opts.factory>, TParams | undefined>(\n    (_state, params) => {\n      if (opts.debounce !== undefined) {\n        const debouncedResource = debounced(() => params(), opts.debounce);\n        const wrappedParams = computed(() => ɵchain(debouncedResource));\n        return opts.factory(wrappedParams);\n      }\n      return opts.factory(params);\n    },\n  );\n  RESOURCE[IS_ASYNC_VALIDATION_RESOURCE] = true;\n\n  metadata(path, RESOURCE, (ctx) => {\n    const node = ctx.stateOf(path) as FieldNode;\n    const validationState = node.validationState;\n    if (validationState.shouldSkipValidation() || !validationState.syncValid()) {\n      return undefined;\n    }\n    if (opts.when && !opts.when(ctx)) {\n      return undefined;\n    }\n    return opts.params(ctx);\n  });\n\n  pathNode.builder.addAsyncErrorRule((ctx) => {\n    const res = ctx.state.metadata(RESOURCE)!;\n    let errors;\n    switch (res.status()) {\n      case 'idle':\n        return undefined;\n      case 'loading':\n      case 'reloading':\n        return 'pending';\n      case 'resolved':\n      case 'local':\n        if (!res.hasValue()) {\n          return undefined;\n        }\n        errors = opts.onSuccess(res.value()!, ctx as FieldContext<TValue, TPathKind>);\n        return addDefaultField(errors, ctx.fieldTree);\n      case 'error':\n        errors = opts.onError(res.error(), ctx as FieldContext<TValue, TPathKind>);\n        return addDefaultField(errors, ctx.fieldTree);\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 {addDefaultField} from '../../../field/validation';\nimport {FieldPathNode} from '../../../schema/path_node';\nimport {assertPathIsCurrent} from '../../../schema/schema';\nimport type {FieldContext, PathKind, SchemaPath, SchemaPathRules, TreeValidator} from '../../types';\n\n/**\n * Adds logic to a field to determine if the field or any of its child fields has validation errors.\n *\n * @param path The target path to add the validation logic to.\n * @param logic A `TreeValidator` that returns the current validation errors.\n *   Errors returned by the validator may specify a target field to indicate an error on a child field.\n * @template TValue The type of value stored in the field the logic is bound to.\n * @template TPathKind The kind of path the logic is bound to (a root path, child path, or item of an array)\n *\n * @category logic\n * @publicApi 22.0\n */\nexport function validateTree<TValue, TPathKind extends PathKind = PathKind.Root>(\n  path: SchemaPath<TValue, SchemaPathRules.Supported, TPathKind>,\n  logic: NoInfer<TreeValidator<TValue, TPathKind>>,\n): void {\n  assertPathIsCurrent(path);\n\n  const pathNode = FieldPathNode.unwrapFieldPath(path);\n  pathNode.builder.addSyncTreeErrorRule((ctx) =>\n    addDefaultField(logic(ctx as FieldContext<TValue, TPathKind>), ctx.fieldTree),\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 {resource, ɵisPromise} from '@angular/core';\nimport type {StandardSchemaV1} from '@standard-schema/spec';\nimport {addDefaultField} from '../../../field/validation';\nimport type {LogicFn, ReadonlyFieldTree, SchemaPath, SchemaPathTree} from '../../types';\nimport {createMetadataKey, metadata} from '../metadata';\nimport {validateAsync} from './validate_async';\nimport {validateTree} from './validate_tree';\nimport {\n  BaseNgValidationError,\n  type ValidationErrorOptions,\n  type WithFieldTree,\n  type WithOptionalFieldTree,\n  type WithoutFieldTree,\n} from './validation_errors';\n\n/**\n * Utility type that removes a string index key when its value is `unknown`,\n * i.e. `{[key: string]: unknown}`. It allows specific string keys to pass through, even if their\n * value is `unknown`, e.g. `{key: unknown}`.\n *\n * @publicApi 22.0\n */\nexport type RemoveStringIndexUnknownKey<K, V> = string extends K\n  ? unknown extends V\n    ? never\n    : K\n  : K;\n\n/**\n * Utility type that recursively ignores unknown string index properties on the given object.\n * We use this on the `TSchema` type in `validateStandardSchema` in order to accommodate Zod's\n * `looseObject` which includes `{[key: string]: unknown}` as part of the type.\n *\n * @publicApi 22.0\n */\nexport type IgnoreUnknownProperties<T> =\n  T extends Record<PropertyKey, unknown>\n    ? {\n        [K in keyof T as RemoveStringIndexUnknownKey<K, T[K]>]: IgnoreUnknownProperties<T[K]>;\n      }\n    : T;\n\n/**\n * Validates a field using a `StandardSchemaV1` compatible validator (e.g. a Zod validator).\n *\n * See https://github.com/standard-schema/standard-schema for more about standard schema.\n *\n * @param path The `FieldPath` to the field to validate.\n * @param schema The standard schema compatible validator to use for validation, or a LogicFn that returns the schema.\n * @template TSchema The type validated by the schema. This may be either the full `TValue` type,\n *   or a partial of it.\n * @template TValue The type of value stored in the field being validated.\n *\n * @see [Signal Form Schema Validation](guide/forms/signals/validation#integration-with-schema-validation-libraries)\n * @category validation\n * @publicApi 22.0\n */\nexport function validateStandardSchema<TSchema, TModel extends IgnoreUnknownProperties<TSchema>>(\n  path: SchemaPath<TModel> & SchemaPathTree<TModel>,\n  schema: StandardSchemaV1<TSchema> | LogicFn<TModel, StandardSchemaV1<unknown> | undefined>,\n) {\n  // We create both a sync and async validator because the standard schema validator can return\n  // either a sync result or a Promise, and we need to handle both cases. The sync validator\n  // handles the sync result, and the async validator handles the Promise.\n  // We memoize the result of the validation function here, so that it is only run once for both\n  // validators, it can then be passed through both sync & async validation.\n  type Result = StandardSchemaV1.Result<TSchema> | Promise<StandardSchemaV1.Result<TSchema>>;\n  const VALIDATOR_MEMO = metadata(\n    path as SchemaPath<TModel>,\n    createMetadataKey<Result | undefined>(),\n    (ctx) => {\n      const resolvedSchema = typeof schema === 'function' ? schema(ctx) : schema;\n      return resolvedSchema\n        ? (resolvedSchema['~standard'].validate(ctx.value()) as Result)\n        : undefined;\n    },\n  );\n\n  validateTree<TModel>(path, ({state, fieldTreeOf}) => {\n    // Skip sync validation if the result is a Promise or undefined.\n    const result = state.metadata(VALIDATOR_MEMO)!();\n    if (!result || ɵisPromise(result)) {\n      return [];\n    }\n    return (\n      result?.issues?.map((issue) =>\n        standardIssueToFormTreeError(fieldTreeOf<TModel>(path), issue),\n      ) ?? []\n    );\n  });\n\n  validateAsync<\n    TModel,\n    Promise<StandardSchemaV1.Result<TSchema>> | undefined,\n    readonly StandardSchemaV1.Issue[]\n  >(path, {\n    params: ({state}) => {\n      // Skip async validation if the result is *not* a Promise.\n      const result = state.metadata(VALIDATOR_MEMO)!();\n      return result && ɵisPromise(result) ? result : undefined;\n    },\n    factory: (params) => {\n      return resource({\n        params,\n        loader: async ({params}) => (await params)?.issues ?? [],\n      });\n    },\n    onSuccess: (issues, {fieldTreeOf}) => {\n      return issues.map((issue) => standardIssueToFormTreeError(fieldTreeOf<TModel>(path), issue));\n    },\n    onError: () => {},\n  });\n}\n\n/**\n * Create a standard schema issue error associated with the target field\n * @param issue The standard schema issue\n * @param options The validation error options\n *\n * @category validation\n * @publicApi 22.0\n */\nexport function standardSchemaError(\n  issue: StandardSchemaV1.Issue,\n  options: WithFieldTree<ValidationErrorOptions>,\n): StandardSchemaValidationError;\n/**\n * Create a standard schema issue error\n * @param issue The standard schema issue\n * @param options The optional validation error options\n *\n * @category validation\n * @publicApi 22.0\n */\nexport function standardSchemaError(\n  issue: StandardSchemaV1.Issue,\n  options?: ValidationErrorOptions,\n): WithoutFieldTree<StandardSchemaValidationError>;\nexport function standardSchemaError(\n  issue: StandardSchemaV1.Issue,\n  options?: ValidationErrorOptions,\n): WithOptionalFieldTree<StandardSchemaValidationError> {\n  return new StandardSchemaValidationError(issue, options);\n}\n\n/**\n * Converts a `StandardSchemaV1.Issue` to a `FormTreeError`.\n *\n * @param fieldTree The root field to which the issue's path is relative.\n * @param issue The `StandardSchemaV1.Issue` to convert.\n * @returns A `ValidationError` representing the issue.\n */\nfunction standardIssueToFormTreeError(\n  fieldTree: ReadonlyFieldTree<unknown>,\n  issue: StandardSchemaV1.Issue,\n): StandardSchemaValidationError {\n  let target = fieldTree as ReadonlyFieldTree<Record<PropertyKey, unknown>>;\n  for (const pathPart of issue.path ?? []) {\n    const pathKey = typeof pathPart === 'object' ? pathPart.key : pathPart;\n    target = target[pathKey] as ReadonlyFieldTree<Record<PropertyKey, unknown>>;\n  }\n  return addDefaultField(standardSchemaError(issue, {message: issue.message}), target);\n}\n\n/**\n * An error used to indicate an issue validating against a standard schema.\n *\n * @category validation\n * @publicApi 22.0\n */\nexport class StandardSchemaValidationError extends BaseNgValidationError {\n  override readonly kind = 'standardSchema';\n\n  constructor(\n    readonly issue: StandardSchemaV1.Issue,\n    options?: ValidationErrorOptions,\n  ) {\n    super(options);\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 {httpResource, HttpResourceOptions, HttpResourceRequest} from '@angular/common/http';\nimport {DebounceTimer, ResourceSnapshot, Signal} from '@angular/core';\nimport {\n  FieldContext,\n  LogicFn,\n  PathKind,\n  SchemaPath,\n  SchemaPathRules,\n  TreeValidationResult,\n} from '../../types';\nimport {MapToErrorsFn, validateAsync} from './validate_async';\n\n/**\n * Options that indicate how to create an httpResource for async validation for a field,\n * and map its result to validation errors.\n *\n * @template TValue The type of value stored in the field being validated.\n * @template TResult The type of result returned by the httpResource\n * @template TPathKind The kind of path being validated (a root path, child path, or item of an array)\n *\n * @category validation\n * @publicApi 22.0\n */\nexport interface HttpValidatorOptions<TValue, TResult, TPathKind extends PathKind = PathKind.Root> {\n  /**\n   * A function that receives the field context and returns the url or request for the httpResource.\n   * If given a URL, the underlying httpResource will perform an HTTP GET on it.\n   *\n   * @param ctx The field context for the field being validated.\n   * @returns The URL or request for creating the httpResource.\n   */\n  readonly request:\n    | ((ctx: FieldContext<TValue, TPathKind>) => string | undefined)\n    | ((ctx: FieldContext<TValue, TPathKind>) => HttpResourceRequest | undefined);\n\n  /**\n   * A function that takes the httpResource result, and the current field context and maps it to a\n   * list of validation errors.\n   *\n   * @param result The httpResource result.\n   * @param ctx The context for the field the validator is attached to.\n   * @return A validation error, or list of validation errors to report based on the httpResource result.\n   *   The returned errors can optionally specify a field that the error should be targeted to.\n   *   A targeted error will show up as an error on its target field rather than the field being validated.\n   *   If a field is not given, the error is assumed to apply to the field being validated.\n   */\n  readonly onSuccess: MapToErrorsFn<TValue, TResult, TPathKind>;\n\n  /**\n   * A function to handle errors thrown by httpResource (HTTP errors, network errors, etc.).\n   * Receives the error and the field context, returns a list of validation errors.\n   */\n  readonly onError: (error: unknown, ctx: FieldContext<TValue, TPathKind>) => TreeValidationResult;\n  /**\n   * The options to use when creating the httpResource.\n   */\n  readonly options?: HttpResourceOptions<TResult, unknown>;\n\n  /**\n   * Duration in milliseconds to wait before triggering the async operation, or a function that\n   * returns a promise that resolves when the update should proceed.\n   */\n  readonly debounce?: DebounceTimer<string | HttpResourceRequest | undefined>;\n  /**\n   * A function that receives the field context and returns true if the async validation should be run.\n   */\n  readonly when?: NoInfer<LogicFn<TValue, boolean, TPathKind>>;\n}\n\n/**\n * Adds async validation to the field corresponding to the given path based on an httpResource.\n * Async validation for a field only runs once all synchronous validation is passing.\n *\n * @param path A path indicating the field to bind the async validation logic to.\n * @param opts The http validation options.\n * @template TValue The type of value stored in the field being validated.\n * @template TResult The type of result returned by the httpResource\n * @template TPathKind The kind of path being validated (a root path, child path, or item of an array)\n *\n * @see [Signal Form Async Validation](guide/forms/signals/validation#async-validation)\n * @category validation\n * @publicApi 22.0\n */\nexport function validateHttp<TValue, TResult = unknown, TPathKind extends PathKind = PathKind.Root>(\n  path: SchemaPath<TValue, SchemaPathRules.Supported, TPathKind>,\n  opts: HttpValidatorOptions<TValue, TResult, TPathKind>,\n) {\n  validateAsync(path, {\n    params: opts.request as (\n      ctx: FieldContext<TValue, TPathKind>,\n    ) => string | HttpResourceRequest | undefined,\n    debounce: opts.debounce,\n    factory: (request: Signal<any>) => httpResource(request, opts.options),\n    onSuccess: opts.onSuccess,\n    onError: opts.onError,\n    when: opts.when,\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 {DEBOUNCER} from '../../field/debounce';\nimport {FieldPathNode} from '../../schema/path_node';\nimport {assertPathIsCurrent} from '../../schema/schema';\nimport type {Debouncer, PathKind, SchemaPath, SchemaPathRules} from '../types';\n\n/**\n * Configures the frequency at which a form field is updated by UI events.\n *\n * When this rule is applied, updates from the UI to the form model will be delayed until either\n * the field is touched, or the most recently debounced update resolves.\n *\n * @param path The target path to debounce.\n * @param config A debounce configuration, which can be either a debounce duration in milliseconds,\n *     `'blur'` to debounce until the field is blurred, or a custom {@link Debouncer} function.\n *\n * @publicApi 22.0\n */\nexport function debounce<TValue, TPathKind extends PathKind = PathKind.Root>(\n  path: SchemaPath<TValue, SchemaPathRules.Supported, TPathKind>,\n  config: number | 'blur' | Debouncer<TValue, TPathKind>,\n): void {\n  assertPathIsCurrent(path);\n\n  const pathNode = FieldPathNode.unwrapFieldPath(path);\n  const debouncer = normalizeDebouncer(config);\n  pathNode.builder.addMetadataRule(DEBOUNCER, () => debouncer);\n}\n\nfunction normalizeDebouncer<TValue, TPathKind extends PathKind>(\n  debouncer: number | 'blur' | Debouncer<TValue, TPathKind>,\n) {\n  // If it's already a debounce function, return it as-is.\n  if (typeof debouncer === 'function') {\n    return debouncer;\n  }\n  // If it's 'blur', return a debouncer that never resolves. The field will still be updated when\n  // the control is blurred.\n  if (debouncer === 'blur') {\n    return debounceUntilBlur();\n  }\n  // If it's a non-zero number, return a timer-based debouncer.\n  if (debouncer > 0) {\n    return debounceForDuration(debouncer);\n  }\n  // Otherwise it's 0, so we return a function that will synchronize the model without delay.\n  return immediate;\n}\n\n/**\n * Creates a debouncer that will wait for the given duration before resolving.\n */\nfunction debounceForDuration(durationInMilliseconds: number): Debouncer<unknown> {\n  return (_context, abortSignal) => {\n    return new Promise((resolve) => {\n      let timeoutId: ReturnType<typeof setTimeout> | undefined;\n\n      const onAbort = () => {\n        clearTimeout(timeoutId);\n        resolve();\n      };\n\n      timeoutId = setTimeout(() => {\n        abortSignal.removeEventListener('abort', onAbort);\n        resolve();\n      }, durationInMilliseconds);\n\n      abortSignal.addEventListener('abort', onAbort, {once: true});\n    });\n  };\n}\n\n/**\n * Creates a debouncer that will wait indefinitely, relying on the node to synchronize pending\n * updates when blurred.\n */\nfunction debounceUntilBlur(): Debouncer<unknown> {\n  return (_context, abortSignal) => {\n    return new Promise((resolve) => {\n      abortSignal.addEventListener('abort', () => resolve(), {once: true});\n    });\n  };\n}\n\nfunction immediate(): void {}\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 Signal, linkedSignal} from '@angular/core';\nimport type {ValidationError} from '../api/rules';\nimport {normalizeErrors} from '../api/rules/validation/util';\nimport type {ParseResult} from '../api/transformed_value';\nimport {shallowArrayEquals} from './array';\n\n/**\n * An object that handles parsing raw UI values into model values.\n */\nexport interface Parser<TRaw> {\n  /**\n   * Errors encountered during the last parse attempt.\n   */\n  errors: Signal<readonly ValidationError.WithoutFieldTree[]>;\n  /**\n   * Parses the given raw value and updates the underlying model value if successful.\n   */\n  setRawValue: (rawValue: TRaw) => void;\n  /**\n   * Resets the parser errors.\n   */\n  readonly reset: () => void;\n}\n\n/**\n * Creates a {@link Parser} that synchronizes a raw value with an underlying model value.\n *\n * @param getValue Function to get the current model value.\n * @param setValue Function to update the model value.\n * @param parse Function to parse the raw value into a {@link ParseResult}.\n * @returns A {@link Parser} instance.\n */\nexport function createParser<TValue, TRaw>(\n  getValue: () => TValue,\n  setValue: (value: TValue) => void,\n  parse: (raw: TRaw) => ParseResult<TValue>,\n): Parser<TRaw> {\n  const errors = linkedSignal({\n    source: getValue,\n    computation: () => [] as readonly ValidationError.WithoutFieldTree[],\n    equal: shallowArrayEquals,\n  });\n\n  const setRawValue = (rawValue: TRaw) => {\n    const result = parse(rawValue);\n    errors.set(normalizeErrors(result.error));\n    if (result.value !== undefined) {\n      setValue(result.value);\n    }\n    // `errors` is a linked signal sourced from the model value; write parse errors after\n    // model updates so `{value, errors}` results do not get reset by the recomputation.\n    errors.set(normalizeErrors(result.error));\n  };\n\n  const reset = () => {\n    errors.set([]);\n  };\n\n  return {errors: errors.asReadonly(), setRawValue, reset};\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  inject,\n  linkedSignal,\n  type ModelSignal,\n  type Signal,\n  type WritableSignal,\n} from '@angular/core';\nimport {createParser} from '../util/parser';\nimport type {ValidationError} from './rules';\nimport type {OneOrMany} from './types';\nimport {ɵFORM_CONTROL_INTEGRATION as FORM_CONTROL_INTEGRATION} from '@angular/forms';\n\n/**\n * Result of parsing a raw value into a model value.\n */\nexport interface ParseResult<TValue> {\n  /**\n   * The parsed value. If omitted, the model is not updated.\n   */\n  readonly value?: TValue;\n  /**\n   * Errors encountered during parsing, if any.\n   */\n  readonly error?: OneOrMany<ValidationError.WithoutFieldTree>;\n}\n\n/**\n * Options for `transformedValue`.\n *\n * @publicApi 22.0\n */\nexport interface TransformedValueOptions<TValue, TRaw> {\n  /**\n   * Parse the raw value into the model value.\n   *\n   * Should return an object containing the parsed result, which may contain:\n   *   - `value`: The parsed model value. If `undefined`, the model will not be updated.\n   *   - `error`: Any parse errors encountered. If `undefined`, no errors are reported.\n   */\n  parse: (rawValue: TRaw) => ParseResult<TValue>;\n\n  /**\n   * Format the model value into the raw value.\n   */\n  format: (value: TValue) => TRaw;\n}\n\n/**\n * A writable signal representing a \"raw\" UI value that is synchronized with a model signal\n * via parse/format transformations.\n *\n * @category control\n * @publicApi 22.0\n */\nexport interface TransformedValueSignal<TRaw> extends WritableSignal<TRaw> {\n  /**\n   * The current parse errors resulting from the last transformation.\n   */\n  readonly parseErrors: Signal<readonly ValidationError.WithoutFieldTree[]>;\n}\n\n/**\n * Creates a writable signal representing a \"raw\" UI value that is transformed to/from a model\n * value via `parse` and `format` functions.\n *\n * This utility simplifies the creation of custom form controls that parse a user-facing value\n * representation into an underlying model value. For example, a numeric input that displays and\n * accepts string values but stores a number.\n *\n * Parse errors are exposed via the returned signal’s `parseErrors()` property.\n * When `transformedValue` is used within a Signal Forms field context, parse errors are also\n * reported to the nearest field automatically. When no field context is present, no automatic\n * reporting occurs and `parseErrors` can be consumed directly.\n *\n * Note: `parse` may return both a `value` and an `error`. Returning `value` updates the model;\n * omitting it leaves the model unchanged.\n *\n * @param value The model signal to synchronize with.\n * @param options Configuration including `parse` and `format` functions.\n * @returns A `TransformedValueSignal` representing the raw value with parse error tracking.\n * @publicApi 22.0\n *\n * @example\n * ```ts\n * @Component({\n *   selector: 'number-input',\n *   template: `<input [value]=\"rawValue()\" (input)=\"rawValue.set($event.target.value)\" />`,\n * })\n * export class NumberInput implements FormValueControl<number | null> {\n *   readonly value = model.required<number | null>();\n *\n *   protected readonly rawValue = transformedValue(this.value, {\n *     parse: (val) => {\n *       if (val === '') return {value: null};\n *       const num = Number(val);\n *       if (Number.isNaN(num)) {\n *         return {error: {kind: 'parse', message: `${val} is not numeric`}};\n *       }\n *       return {value: num};\n *     },\n *     format: (val) => val?.toString() ?? '',\n *   });\n * }\n * ```\n */\nexport function transformedValue<TValue, TRaw>(\n  value: ModelSignal<TValue>,\n  options: TransformedValueOptions<TValue, TRaw>,\n): TransformedValueSignal<TRaw> {\n  const {parse, format} = options;\n  const parser = createParser(value, value.set, parse);\n\n  // Create the result signal with overridden set/update and a `parseErrors` property.\n  const rawValue = linkedSignal(() => format(value()));\n  const result = rawValue as WritableSignal<TRaw> & {\n    parseErrors: Signal<readonly ValidationError.WithoutFieldTree[]>;\n  };\n  result.parseErrors = parser.errors;\n  const originalSet = result.set.bind(result);\n\n  // Wire up the integration with the form control (parse errors and reset handling).\n  const integration = inject(FORM_CONTROL_INTEGRATION, {self: true, optional: true});\n  if (integration) {\n    integration.setParseErrors(parser.errors);\n    integration.onReset = (resetValue) => {\n      parser.reset();\n      const modelValue = resetValue !== undefined ? resetValue : value();\n      originalSet(format(modelValue));\n    };\n  }\n\n  // Notify the parser when `set` or `update` is called on the raw value\n  result.set = (newRawValue: TRaw) => {\n    parser.setRawValue(newRawValue);\n    originalSet(newRawValue);\n  };\n  result.update = (updateFn: (value: TRaw) => TRaw) => {\n    result.set(updateFn(rawValue()));\n  };\n\n  return result;\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 as RuntimeError} from '@angular/core';\nimport {RuntimeErrorCode} from '../errors';\nimport {signalErrorsToValidationErrors} from '../compat/validation_errors';\n\nimport {\n  ControlValueAccessor,\n  Validators,\n  type AbstractControl,\n  type FormControlStatus,\n  type ValidationErrors,\n  type ValidatorFn,\n} from '@angular/forms';\nimport type {ReadonlyFieldState} from '../api/types';\n\n// TODO: Also consider supporting (if possible):\n// - hasError\n// - getError\n// - reset\n// - name\n// - path\n// - markAs[Touched,Dirty,etc.]\n\n/**\n * Represents a combination of `NgControl` and `AbstractControl`.\n *\n * Note: We have this separate interface, rather than implementing the relevant parts of the two\n * controls with something like `InteropNgControl implements Pick<NgControl, ...>, Pick<AbstractControl, ...>`\n * because it confuses the internal JS minifier which can cause collisions in field names.\n */\ninterface CombinedControl {\n  value: unknown;\n  valid: boolean;\n  invalid: boolean;\n  touched: boolean;\n  untouched: boolean;\n  disabled: boolean;\n  enabled: boolean;\n  errors: ValidationErrors | null;\n  pristine: boolean;\n  dirty: boolean;\n  status: FormControlStatus;\n  control: AbstractControl<any, any>;\n  valueAccessor: ControlValueAccessor | null;\n  hasValidator(validator: ValidatorFn): boolean;\n  updateValueAndValidity(): void;\n}\n\n/**\n * A fake version of `NgControl` provided by the `Field` directive. This allows interoperability\n * with a wider range of components designed to work with reactive forms, in particular ones that\n * inject the `NgControl`. The interop control does not implement *all* properties and methods of\n * the real `NgControl`, but does implement some of the most commonly used ones that have a clear\n * equivalent in signal forms.\n */\nexport class InteropNgControl implements CombinedControl {\n  constructor(protected field: () => ReadonlyFieldState<unknown>) {}\n\n  readonly control: AbstractControl<any, any> = this as unknown as AbstractControl<any, any>;\n\n  get value(): unknown {\n    // CVA controls are not aware of user debouncing and will expect `NgControl.value` to reflect their latest writes.\n    return this.field().controlValue();\n  }\n\n  get valid(): boolean {\n    return this.field().valid();\n  }\n\n  get invalid(): boolean {\n    return this.field().invalid();\n  }\n\n  get pending(): boolean | null {\n    return this.field().pending();\n  }\n\n  get disabled(): boolean {\n    return this.field().disabled();\n  }\n\n  get enabled(): boolean {\n    return !this.field().disabled();\n  }\n\n  get errors(): ValidationErrors | null {\n    return signalErrorsToValidationErrors(this.field().errors());\n  }\n\n  get pristine(): boolean {\n    return !this.field().dirty();\n  }\n\n  get dirty(): boolean {\n    return this.field().dirty();\n  }\n\n  get touched(): boolean {\n    return this.field().touched();\n  }\n\n  get untouched(): boolean {\n    return !this.field().touched();\n  }\n\n  get status(): FormControlStatus {\n    if (this.field().disabled()) {\n      return 'DISABLED';\n    }\n    if (this.field().valid()) {\n      return 'VALID';\n    }\n    if (this.field().invalid()) {\n      return 'INVALID';\n    }\n    if (this.field().pending()) {\n      return 'PENDING';\n    }\n    throw new RuntimeError(\n      RuntimeErrorCode.UNKNOWN_STATUS,\n      ngDevMode && 'Unknown form control status',\n    );\n  }\n\n  valueAccessor: ControlValueAccessor | null = null;\n\n  hasValidator(validator: ValidatorFn): boolean {\n    // This addresses a common case where users look for the presence of `Validators.required` to\n    // determine whether or not to show a required \"*\" indicator in the UI.\n    if (validator === Validators.required) {\n      return this.field().required();\n    }\n    return false;\n  }\n\n  updateValueAndValidity() {\n    // No-op since value and validity are always up to date in signal forms.\n    // We offer this method so that reactive forms code attempting to call it doesn't error.\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 {ReadonlyFieldState} from '../api/types';\n\n/**\n * Branded type for the public name of an input we bind on control components or DOM elements.\n */\nexport type ControlBindingKey = string & {__brand: 'ControlBindingKey'};\n\n/**\n * A map of field state properties to control binding name.\n *\n * This excludes `controlValue` whose corresponding control binding name differs between control\n * types.\n *\n * The control binding name can be used for inputs or attributes (since DOM attributes are case\n * insensitive).\n */\nconst FIELD_STATE_KEY_TO_CONTROL_BINDING = {\n  disabled: 'disabled' as ControlBindingKey,\n  disabledReasons: 'disabledReasons' as ControlBindingKey,\n  dirty: 'dirty' as ControlBindingKey,\n  errors: 'errors' as ControlBindingKey,\n  hidden: 'hidden' as ControlBindingKey,\n  invalid: 'invalid' as ControlBindingKey,\n  max: 'max' as ControlBindingKey,\n  maxLength: 'maxLength' as ControlBindingKey,\n  min: 'min' as ControlBindingKey,\n  minLength: 'minLength' as ControlBindingKey,\n  name: 'name' as ControlBindingKey,\n  pattern: 'pattern' as ControlBindingKey,\n  pending: 'pending' as ControlBindingKey,\n  readonly: 'readonly' as ControlBindingKey,\n  required: 'required' as ControlBindingKey,\n  touched: 'touched' as ControlBindingKey,\n} as const satisfies {[K in keyof ReadonlyFieldState<unknown>]?: ControlBindingKey};\n\n/**\n * Inverts `FIELD_STATE_KEY_TO_CONTROL_BINDING` to look up the minified name of the corresponding\n * field state property from its control binding name.\n */\nconst CONTROL_BINDING_TO_FIELD_STATE_KEY = /* @__PURE__ */ (() => {\n  const map = {} as Record<ControlBindingKey, keyof typeof FIELD_STATE_KEY_TO_CONTROL_BINDING>;\n  for (const key of Object.keys(FIELD_STATE_KEY_TO_CONTROL_BINDING) as Array<\n    keyof typeof FIELD_STATE_KEY_TO_CONTROL_BINDING\n  >) {\n    map[FIELD_STATE_KEY_TO_CONTROL_BINDING[key]] = key;\n  }\n  return map;\n})();\n\nexport function readFieldStateBindingValue(\n  fieldState: ReadonlyFieldState<unknown>,\n  key: ControlBindingKey,\n): unknown {\n  const property = CONTROL_BINDING_TO_FIELD_STATE_KEY[key];\n  return fieldState[property]?.();\n}\n\n/** The keys of {@link FIELD_STATE_KEY_TO_CONTROL_BINDING} */\nexport const CONTROL_BINDING_NAMES = /* @__PURE__ */ (() =>\n  Object.values(FIELD_STATE_KEY_TO_CONTROL_BINDING))() as Array<ControlBindingKey>;\n\nexport function createBindings<TKey extends string>(): {[K in TKey]?: unknown} {\n  return {};\n}\n\nexport function bindingUpdated<TKey extends string>(\n  bindings: {[K in TKey]?: unknown},\n  key: TKey,\n  value: unknown,\n) {\n  if (bindings[key] !== value) {\n    bindings[key] = value;\n    return true;\n  }\n  return false;\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 {untracked} from '@angular/core';\nimport {NativeInputParseError, WithoutFieldTree} from '../api/rules';\nimport type {ParseResult} from '../api/transformed_value';\nimport type {InputValidityMonitor} from './input_validity_monitor';\n\n// Re-export shared native utilities from main forms package\nexport {\n  ɵisNativeFormElement as isNativeFormElement,\n  ɵelementAcceptsMinMax as elementAcceptsMinMax,\n  ɵisTextualFormElement as isTextualFormElement,\n  ɵsetNativeDomProperty as setNativeDomProperty,\n  type ɵNativeFormControl as NativeFormControl,\n} from '@angular/forms';\n\nimport type {ɵNativeFormControl as NativeFormControl} from '@angular/forms';\n\n/**\n * Returns the value from a native control element.\n *\n * @param element The native control element.\n * @param currentValue A function that returns the current value from the control's corresponding\n *   field state.\n *\n * The type of the returned value depends on the `type` property of the control, and will attempt to\n * match the current value's type. For example, the value of `<input type=\"number\">` can be read as\n * a `string` or a `number`. If the current value is a `number`, then this will return a `number`.\n * Otherwise, this will return the value as a `string`.\n */\nexport function getNativeControlValue(\n  element: NativeFormControl,\n  currentValue: () => unknown,\n  validityMonitor: InputValidityMonitor,\n): ParseResult<unknown> {\n  let modelValue: unknown;\n\n  if (isInput(element) && validityMonitor.isBadInput(element)) {\n    return {\n      error: new NativeInputParseError() as WithoutFieldTree<NativeInputParseError>,\n    };\n  }\n\n  // Special cases for specific input types.\n  switch (element.type) {\n    case 'checkbox':\n      return {value: element.checked};\n    case 'number':\n    case 'range':\n    case 'datetime-local':\n      // We can read a `number` or a `string` from this input type. Prefer whichever is consistent\n      // with the current type.\n      modelValue = untracked(currentValue);\n      if (typeof modelValue === 'number' || modelValue === null) {\n        return {value: element.value === '' ? null : element.valueAsNumber};\n      }\n      break;\n    case 'date':\n    case 'month':\n    case 'time':\n    case 'week':\n      // We can read a `Date | null`, `number`, or `string` from this input type. Prefer whichever\n      // is consistent with the current type.\n      modelValue = untracked(currentValue);\n      if (modelValue === null || modelValue instanceof Date) {\n        return {value: element.valueAsDate};\n      } else if (typeof modelValue === 'number') {\n        return {value: element.valueAsNumber};\n      }\n      break;\n  }\n\n  // For text-like <input> elements, parse numeric values if the model is numeric.\n  if (element.tagName === 'INPUT' && element.type === 'text') {\n    modelValue ??= untracked(currentValue);\n    if (typeof modelValue === 'number' || modelValue === null) {\n      if (element.value === '') {\n        return {value: null};\n      }\n      const parsed = Number(element.value);\n      if (Number.isNaN(parsed)) {\n        return {error: new NativeInputParseError() as WithoutFieldTree<NativeInputParseError>};\n      }\n      return {value: parsed};\n    }\n  }\n\n  // Default to reading the value as a string.\n  return {value: element.value};\n}\n\n/**\n * Sets a native control element's value.\n *\n * @param element The native control element.\n * @param value The new value to set.\n */\nexport function setNativeControlValue(element: NativeFormControl, value: unknown) {\n  // Special cases for specific input types.\n  switch (element.type) {\n    case 'checkbox':\n      element.checked = value as boolean;\n      return;\n    case 'radio':\n      // Although HTML behavior is to clear the input already, we do this just in case. It seems\n      // like it might be necessary in certain environments (e.g. Domino).\n      element.checked = value === element.value;\n      return;\n    case 'number':\n    case 'range':\n    case 'datetime-local':\n      // This input type can receive a `number` or a `string`.\n      if (typeof value === 'number') {\n        setNativeNumberControlValue(element, value);\n        return;\n      } else if (value === null) {\n        element.value = '';\n        return;\n      }\n      break;\n    case 'date':\n    case 'month':\n    case 'time':\n    case 'week':\n      // This input type can receive a `Date | null` or a `number` or a `string`.\n      if (value === null || value instanceof Date) {\n        element.valueAsDate = value;\n        return;\n      } else if (typeof value === 'number') {\n        setNativeNumberControlValue(element, value);\n        return;\n      }\n  }\n\n  // For text-like <input> elements, handle numeric and null values.\n  if (element.tagName === 'INPUT' && element.type === 'text') {\n    if (typeof value === 'number') {\n      element.value = isNaN(value) ? '' : String(value);\n      return;\n    }\n    if (value === null) {\n      element.value = '';\n      return;\n    }\n  }\n\n  // Default to setting the value as a string.\n  element.value = value as string;\n}\n\n/** Writes a value to a native <input type=\"number\">. */\nexport function setNativeNumberControlValue(element: HTMLInputElement, value: number) {\n  // Writing `NaN` causes a warning in the console, so we instead write `''`.\n  // This allows the user to safely use `NaN` as a number value that means \"clear the input\".\n  if (isNaN(value)) {\n    element.value = '';\n  } else {\n    element.valueAsNumber = value;\n  }\n}\nexport function isInput(element: HTMLElement): element is HTMLInputElement {\n  return element.tagName === 'INPUT';\n}\n\nexport function inputRequiresValidityTracking(input: HTMLInputElement): boolean {\n  return (\n    input.type === 'date' ||\n    input.type === 'datetime-local' ||\n    input.type === 'month' ||\n    input.type === 'time' ||\n    input.type === 'week'\n  );\n}\n\nfunction formatDateForInput(date: Date, type: 'date' | 'month'): string {\n  const year = date.getUTCFullYear();\n  const month = String(date.getUTCMonth() + 1).padStart(2, '0');\n\n  if (type === 'month') {\n    return `${year}-${month}`;\n  }\n  const day = String(date.getUTCDate()).padStart(2, '0');\n  return `${year}-${month}-${day}`;\n}\n\nexport function formatDateForMinMax(name: string, value: unknown, type: string): unknown {\n  if (\n    value instanceof Date &&\n    (name === 'min' || name === 'max') &&\n    (type === 'date' || type === 'month')\n  ) {\n    return formatDateForInput(value, type);\n  }\n  return 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 type {ɵControlDirectiveHost as ControlDirectiveHost} from '@angular/core';\nimport type {FormField, FormFieldBindingOptions} from './form_field';\nimport {\n  bindingUpdated,\n  CONTROL_BINDING_NAMES,\n  type ControlBindingKey,\n  createBindings,\n  readFieldStateBindingValue,\n} from './bindings';\nimport {formatDateForMinMax, setNativeDomProperty} from './native';\n\nexport function customControlCreate(\n  host: ControlDirectiveHost,\n  parent: FormField<unknown>,\n): () => void {\n  host.listenToCustomControlModel((value) => parent.state().controlValue.set(value));\n  host.listenToCustomControlOutput('touch', () => parent.state().markAsTouched());\n\n  parent.registerAsBinding(host.customControl as FormFieldBindingOptions);\n\n  const bindings = createBindings<ControlBindingKey | 'controlValue'>();\n  return () => {\n    const state = parent.state();\n    // Bind custom form control model ('value' or 'checked').\n    const controlValue = state.controlValue();\n    if (bindingUpdated(bindings, 'controlValue', controlValue)) {\n      host.setCustomControlModelInput(controlValue);\n    }\n\n    // Bind remaining field state properties.\n    for (const name of CONTROL_BINDING_NAMES) {\n      let value: unknown;\n      if (name === 'errors') {\n        value = parent.errors();\n      } else {\n        value = readFieldStateBindingValue(state, name);\n      }\n      if (bindingUpdated(bindings, name, value)) {\n        host.setInputOnDirectives(name, value);\n\n        // If the host node is a native control, we can bind field state properties to native\n        // properties for any that weren't defined as inputs on the custom control.\n        if (parent.elementAcceptsNativeProperty(name) && !host.customControlHasInput(name)) {\n          const domValue = formatDateForMinMax(name, value, parent.nativeFormElement.type);\n          setNativeDomProperty(\n            parent.renderer,\n            parent.nativeFormElement,\n            name,\n            domValue as string | number | boolean | undefined,\n          );\n        }\n      }\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 {\n  computed,\n  signal,\n  untracked,\n  type Signal,\n  type WritableSignal,\n  type ɵControlDirectiveHost as ControlDirectiveHost,\n} from '@angular/core';\nimport {NG_VALIDATORS, type Validator, Validators, type ValidatorFn} from '@angular/forms';\nimport {reactiveErrorsToSignalErrors} from '../compat/validation_errors';\nimport {type ValidationError} from '../api/rules';\nimport {\n  bindingUpdated,\n  CONTROL_BINDING_NAMES,\n  type ControlBindingKey,\n  createBindings,\n  readFieldStateBindingValue,\n} from './bindings';\nimport {setNativeDomProperty} from './native';\nimport type {FormField} from './form_field';\n\nfunction isValidatorObject(v: Function | Validator): v is Validator {\n  return typeof v === 'object' && v !== null;\n}\n\nexport function cvaControlCreate(\n  host: ControlDirectiveHost,\n  parent: FormField<unknown>,\n): () => void {\n  const bindings = createBindings<ControlBindingKey | 'controlValue'>();\n\n  parent.controlValueAccessor!.registerOnChange((value: unknown) => {\n    // Update tracking for 'controlValue' here so that when the effect runs,\n    // `bindingUpdated` sees that the model value matches the last seen view value.\n    // This prevents the framework from writing the same value back to the CVA (CVA loopback).\n    bindings['controlValue'] = value;\n    parent.state().controlValue.set(value);\n  });\n  parent.controlValueAccessor!.registerOnTouched(() => parent.state().markAsTouched());\n\n  const legacyValidators = parent.injector.get(NG_VALIDATORS, null, {optional: true, self: true});\n  if (legacyValidators) {\n    let version: WritableSignal<number> | undefined;\n\n    for (const v of legacyValidators) {\n      if (isValidatorObject(v) && v.registerOnValidatorChange) {\n        version ??= signal(0);\n        v.registerOnValidatorChange(() => {\n          version!.update((n) => n + 1);\n        });\n      }\n    }\n\n    const validatorFns = legacyValidators.map((v) =>\n      typeof v === 'function' ? (v as ValidatorFn) : v.validate.bind(v),\n    );\n    const mergedValidator = Validators.compose(validatorFns);\n\n    const parseErrors = computed(() => {\n      // Read the `version` signal to re-run the validator when legacy validators trigger their change callbacks.\n      version?.();\n      const errors = mergedValidator ? mergedValidator(parent.interopNgControl.control) : null;\n      return reactiveErrorsToSignalErrors(errors, parent.interopNgControl.control);\n    });\n    // We must cast here because `CompatValidationError` claims to have `fieldTree` statically (to\n    // satisfy `ValidationState` elsewhere), but at construction it is created without it and acts as\n    // `WithoutFieldTree` initially.\n    parent.parseErrorsSource.set(\n      parseErrors as unknown as Signal<readonly ValidationError.WithoutFieldTree[]>,\n    );\n  }\n\n  parent.registerAsBinding({\n    reset: () => {\n      const value = parent.state().value();\n      bindings['controlValue'] = value;\n      untracked(() => parent.controlValueAccessor!.writeValue(value));\n    },\n  });\n\n  return () => {\n    const fieldState = parent.state();\n    const value = fieldState.value();\n\n    if (bindingUpdated(bindings, 'controlValue', value)) {\n      // We don't know if the interop control has underlying signals, so we must use `untracked` to\n      // prevent writing to a signal in a reactive context.\n      untracked(() => parent.controlValueAccessor!.writeValue(value));\n    }\n\n    for (const name of CONTROL_BINDING_NAMES) {\n      const value = readFieldStateBindingValue(fieldState, name);\n      if (bindingUpdated(bindings, name, value)) {\n        const propertyWasSet = host.setInputOnDirectives(name, value);\n        if (name === 'disabled' && parent.controlValueAccessor!.setDisabledState) {\n          untracked(() => parent.controlValueAccessor!.setDisabledState!(value as boolean));\n        } else if (!propertyWasSet && parent.elementAcceptsNativeProperty(name)) {\n          // Fall back to native DOM properties.\n          setNativeDomProperty(\n            parent.renderer,\n            parent.nativeFormElement,\n            name,\n            value as string | number | undefined,\n          );\n        }\n      }\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 {DestroyRef} from '@angular/core';\n\n/**\n * Creates a `MutationObserver` to observe changes to the available `<option>`s for this select.\n *\n * @param select The native `<select>` element to observe.\n * @param lView The `LView` that contains the native form control.\n * @param tNode The `TNode` of the native form control.\n * @return The newly created `MutationObserver`.\n */\nexport function observeSelectMutations(\n  select: HTMLSelectElement,\n  onMutation: () => void,\n  destroyRef: DestroyRef,\n): void {\n  if (typeof MutationObserver !== 'function') {\n    // Observing mutations is best-effort.\n    return;\n  }\n\n  const observer = new MutationObserver((mutations) => {\n    if (mutations.some((m) => isRelevantSelectMutation(m))) {\n      onMutation();\n    }\n  });\n  observer.observe(select, {\n    attributes: true,\n    attributeFilter: ['value'],\n    // We watch the character data, because an `<option>` with no explicit `value` property set uses\n    // its text content as its value.\n    // (See https://developer.mozilla.org/en-US/docs/Web/API/HTMLOptionElement/value)\n    characterData: true,\n    childList: true,\n    subtree: true,\n  });\n  destroyRef.onDestroy(() => observer.disconnect());\n}\n\n/**\n * Checks if a given mutation record is relevant for resyncing a <select>.\n * In general its relevant if:\n * - Non comment content of the select changed\n * - The value attribute of an option changed.\n */\nfunction isRelevantSelectMutation(mutation: MutationRecord) {\n  // Consider changes that may add / remove options, or change their text content.\n  if (mutation.type === 'childList' || mutation.type === 'characterData') {\n    // If the target element is a comment it's not relevant.\n    if (mutation.target instanceof Comment) {\n      return false;\n    }\n    // Otherwise if any non-comment nodes were added / removed it is relevant.\n    for (const node of mutation.addedNodes) {\n      if (!(node instanceof Comment)) {\n        return true;\n      }\n    }\n    for (const node of mutation.removedNodes) {\n      if (!(node instanceof Comment)) {\n        return true;\n      }\n    }\n    // Otherwise it's not relevant.\n    return false;\n  }\n  // If the value attribute of an option changed, it's relevant.\n  if (mutation.type === 'attributes' && mutation.target instanceof HTMLOptionElement) {\n    return true;\n  }\n  // Everything else is not relevant.\n  return false;\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 */\nimport {\n  type ɵControlDirectiveHost as ControlDirectiveHost,\n  type Signal,\n  type WritableSignal,\n} from '@angular/core';\nimport type {ValidationError} from '../api/rules';\nimport {createParser} from '../util/parser';\nimport {\n  bindingUpdated,\n  CONTROL_BINDING_NAMES,\n  createBindings,\n  readFieldStateBindingValue,\n  type ControlBindingKey,\n} from './bindings';\nimport type {FormField} from './form_field';\nimport {InputValidityMonitor} from './input_validity_monitor';\nimport {\n  formatDateForMinMax,\n  getNativeControlValue,\n  inputRequiresValidityTracking,\n  isInput,\n  setNativeControlValue,\n  setNativeDomProperty,\n} from './native';\nimport {observeSelectMutations} from './select';\n\nexport function nativeControlCreate(\n  host: ControlDirectiveHost,\n  parent: FormField<unknown>,\n  parseErrorsSource: WritableSignal<\n    Signal<readonly ValidationError.WithoutFieldTree[]> | undefined\n  >,\n  validityMonitor: InputValidityMonitor,\n): () => void {\n  let updateMode = false;\n  const input = parent.nativeFormElement;\n\n  // TODO: (perf) ok to always create this?\n  const parser = createParser(\n    // Read from the model value\n    () => parent.state().value(),\n    // Write to the buffered \"control value\"\n    (rawValue: unknown) => parent.state().controlValue.set(rawValue),\n    // Our parse function doesn't care about the raw value that gets passed in,\n    // It just reads the newly parsed value directly off the input element.\n    (_rawValue: unknown) => getNativeControlValue(input, parent.state().value, validityMonitor),\n  );\n\n  parseErrorsSource.set(parser.errors);\n  parent.onReset = () => {\n    parser.reset();\n    const value = parent.state().value();\n    bindings['controlValue'] = value;\n    setNativeControlValue(input, value);\n  };\n  // Pass undefined as the raw value since the parse function doesn't care about it.\n  host.listenToDom('input', () => parser.setRawValue(undefined));\n  host.listenToDom('blur', () => parent.state().markAsTouched());\n\n  // TODO: move extraction to first update pass?\n  if (isInput(input) && inputRequiresValidityTracking(input)) {\n    validityMonitor.watchValidity(parent.destroyRef, input, () => parser.setRawValue(undefined));\n  }\n\n  parent.registerAsBinding();\n\n  // The native `<select>` tracks its `value` by keeping track of the selected `<option>`.\n  // Therefore if we set the value to an arbitrary string *before* the corresponding option has been\n  // created, the `<select>` will ignore it.\n  //\n  // This means that we need to know when an `<option>` is created, destroyed, or has its `value`\n  // changed so that we can re-sync the `<select>` to the field state's value. We implement this\n  // using a `MutationObserver` that we create to observe `<option>` changes.\n  if (input.tagName === 'SELECT') {\n    observeSelectMutations(\n      input as HTMLSelectElement,\n      () => {\n        // It's not legal to access `parent.state()` until update mode has run, but\n        // `observeSelectMutations` may fire earlier. It's okay to ignore these early notifications\n        // because we'll write `input.value` in that first update pass anyway.\n        if (!updateMode) {\n          return;\n        }\n        input.value = parent.state().controlValue() as string;\n      },\n      parent.destroyRef,\n    );\n  }\n\n  const bindings = createBindings<ControlBindingKey | 'controlValue'>();\n\n  return () => {\n    const state = parent.state();\n\n    for (const name of CONTROL_BINDING_NAMES) {\n      const value = readFieldStateBindingValue(state, name);\n      if (bindingUpdated(bindings, name, value)) {\n        host.setInputOnDirectives(name, value);\n        if (parent.elementAcceptsNativeProperty(name)) {\n          const domValue = formatDateForMinMax(name, value, input.type);\n          setNativeDomProperty(\n            parent.renderer,\n            input,\n            name,\n            domValue as string | number | boolean | undefined,\n          );\n        }\n      }\n    }\n\n    // We need to update the value after setting the attributes as some attributes like min/max might prevent from setting the value\n    const controlValue = state.controlValue();\n    if (bindingUpdated(bindings, 'controlValue', controlValue)) {\n      setNativeControlValue(input, controlValue);\n    }\n\n    updateMode = true;\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 {DOCUMENT} from '@angular/common';\nimport {\n  Injectable,\n  CSP_NONCE,\n  inject,\n  type OnDestroy,\n  forwardRef,\n  type DestroyRef,\n} from '@angular/core';\n\n/**\n * Service that monitors validity state changes on native form elements.\n *\n * It works by dynamically installing a CSS transition on `input, textarea` `:valid`\n * and `:invalid` states, which allows us to intercept a `transitionstart` event\n * whenever the native validity state changes without an `input` event (e.g. clearing a date input).\n */\n@Injectable({providedIn: 'root', useClass: forwardRef(() => AnimationInputValidityMonitor)})\nexport abstract class InputValidityMonitor {\n  abstract watchValidity(\n    destroyRef: DestroyRef,\n    element: HTMLInputElement,\n    callback: () => void,\n  ): void;\n  abstract isBadInput(element: HTMLInputElement): boolean;\n}\n\n@Injectable()\nexport class AnimationInputValidityMonitor extends InputValidityMonitor implements OnDestroy {\n  private readonly document = inject(DOCUMENT);\n  private readonly cspNonce = inject(CSP_NONCE, {optional: true});\n  private readonly injectedStyles = new WeakMap<Document | ShadowRoot, HTMLStyleElement>();\n\n  /** Starts watching the given element for validity state changes. */\n  override watchValidity(\n    destroyRef: DestroyRef,\n    element: HTMLInputElement,\n    callback: () => void,\n  ): void {\n    if (typeof ngServerMode !== 'undefined' && ngServerMode) {\n      return;\n    }\n\n    const rootNode = element.getRootNode() as Document | ShadowRoot;\n    if (!this.injectedStyles.has(rootNode)) {\n      this.injectedStyles.set(rootNode, this.createTransitionStyle(rootNode));\n    }\n\n    const onAnimationStart = (event: Event) => {\n      const animationEvent = event as AnimationEvent;\n      if (\n        animationEvent.animationName === 'ng-valid' ||\n        animationEvent.animationName === 'ng-invalid'\n      ) {\n        callback();\n      }\n    };\n    element.addEventListener('animationstart', onAnimationStart);\n    destroyRef.onDestroy(() => {\n      element.removeEventListener('animationstart', onAnimationStart);\n    });\n  }\n\n  override isBadInput(element: HTMLInputElement): boolean {\n    return element.validity?.badInput ?? false;\n  }\n\n  private createTransitionStyle(rootNode: Document | ShadowRoot): HTMLStyleElement {\n    const element = this.document.createElement('style');\n    if (this.cspNonce) {\n      element.nonce = this.cspNonce;\n    }\n    element.textContent = `\n      @keyframes ng-valid {}\n      @keyframes ng-invalid {}\n      input:valid, textarea:valid {\n        animation: ng-valid 0.001s;\n      }\n      input:invalid, textarea:invalid {\n        animation: ng-invalid 0.001s;\n      }\n    `;\n    if (rootNode.nodeType === 9 /* Node.DOCUMENT_NODE */) {\n      (rootNode as Document).head?.appendChild(element);\n    } else {\n      rootNode.appendChild(element);\n    }\n    return element;\n  }\n\n  ngOnDestroy(): void {\n    // We explicitly clean up the main document's injected style wrapper.\n    this.injectedStyles.get(this.document)?.remove();\n\n    // We do not need to iterate over ShadowRoots to clean them up.\n    // The WeakMap drops the reference when the ShadowRoot is destroyed,\n    // and the DOM subtree takes care of its own garbage collection.\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  afterRenderEffect,\n  computed,\n  type ɵControlDirectiveHost as ControlDirectiveHost,\n  DestroyRef,\n  Directive,\n  effect,\n  ElementRef,\n  ɵformatRuntimeError as formatRuntimeError,\n  inject,\n  InjectionToken,\n  Injector,\n  input,\n  Renderer2,\n  ɵRuntimeError as RuntimeError,\n  type Signal,\n  signal,\n  untracked,\n} from '@angular/core';\nimport {\n  type ControlValueAccessor,\n  NG_VALUE_ACCESSOR,\n  NgControl,\n  ɵFORM_CONTROL_INTEGRATION as FORM_CONTROL_INTEGRATION,\n  ɵselectValueAccessor as selectValueAccessor,\n} from '@angular/forms';\nimport {type ValidationError} from '../api/rules';\nimport type {Field, FieldState} from '../api/types';\nimport {InteropNgControl} from '../controls/interop_ng_control';\nimport {RuntimeErrorCode} from '../errors';\nimport {SIGNAL_FORMS_CONFIG} from '../field/di';\nimport type {FieldNode} from '../field/node';\nimport type {FormUiControl} from '../api/control';\nimport {shallowArrayEquals} from '../util/array';\nimport {bindingUpdated, type ControlBindingKey, createBindings} from './bindings';\nimport {customControlCreate} from './control_custom';\nimport {cvaControlCreate} from './control_cva';\nimport {nativeControlCreate} from './control_native';\nimport {\n  elementAcceptsMinMax,\n  isNativeFormElement,\n  isTextualFormElement,\n  type NativeFormControl,\n} from './native';\nimport {InputValidityMonitor} from './input_validity_monitor';\n\nexport const ɵNgFieldDirective: unique symbol = Symbol();\n\nexport interface FormFieldBindingOptions {\n  /**\n   * Focuses the binding.\n   *\n   * If not specified, Signal Forms will attempt to focus the host element of the `FormField` when\n   * asked to focus this binding.\n   */\n  readonly focus?: (focusOptions?: FocusOptions) => void;\n  /**\n   * Resets the binding.\n   */\n  readonly reset?: () => void;\n}\n\n/**\n * Lightweight DI token provided by the {@link FormField} directive.\n *\n * @category control\n * @publicApi 22.0\n */\nexport const FORM_FIELD = new InjectionToken<FormField<unknown>>(\n  typeof ngDevMode !== 'undefined' && ngDevMode ? 'FORM_FIELD' : '',\n);\n\n/**\n * Binds a form `FieldTree` to a UI control that edits it. A UI control can be one of several things:\n * 1. A native HTML input or textarea\n * 2. A signal forms custom control that implements `FormValueControl` or `FormCheckboxControl`\n * 3. A component that provides a `ControlValueAccessor`. This should only be used for backwards\n *    compatibility with reactive forms. Prefer options (1) and (2).\n *\n * This directive has several responsibilities:\n * 1. Two-way binds the field state's value with the UI control's value\n * 2. Binds additional forms related state on the field state to the UI control (disabled, required, etc.)\n * 3. Relays relevant events on the control to the field state (e.g. marks touched on blur)\n * 4. Provides a fake `NgControl` that implements a subset of the features available on the\n *    reactive forms `NgControl`. This is provided to improve interoperability with controls\n *    designed to work with reactive forms. It should not be used by controls written for signal\n *    forms.\n *\n * @category control\n * @publicApi 22.0\n */\n@Directive({\n  selector: '[formField]',\n  exportAs: 'formField',\n  providers: [\n    {provide: FORM_FIELD, useExisting: FormField},\n    {provide: NgControl, useFactory: () => inject(FormField).interopNgControl},\n    {\n      provide: FORM_CONTROL_INTEGRATION,\n      useFactory: () => inject(FORM_FIELD, {self: true}),\n    },\n  ],\n})\nexport class FormField<T> {\n  /**\n   * The field to bind to the underlying form control.\n   */\n  readonly field = input.required<Field<T>>({alias: 'formField'});\n\n  /**\n   * `FieldState` for the currently bound field.\n   */\n  readonly state = computed<FieldState<T>>(() => this.field()());\n\n  /** @internal */\n  readonly renderer = inject(Renderer2);\n\n  /** @internal */\n  readonly destroyRef = inject(DestroyRef);\n\n  /**\n   * The node injector for the DOM element hosting this field binding.\n   */\n  readonly injector = inject(Injector);\n\n  /**\n   * The DOM element hosting this field binding.\n   */\n  readonly element = inject<ElementRef<HTMLElement>>(ElementRef).nativeElement;\n\n  // Compute some helper booleans about the type of element we're sitting on.\n  private readonly elementIsNativeFormElement = isNativeFormElement(this.element);\n  private readonly elementAcceptsTextualValues = isTextualFormElement(this.element);\n  private _elementAcceptsMinMax: boolean | undefined;\n\n  /**\n   * Utility that casts `this.element` to `NativeFormControl` to avoid repeated type guards. Only\n   * safe to access when `elementIsNativeFormElement` is true.\n   *\n   * @internal\n   */\n  readonly nativeFormElement: NativeFormControl = (this.elementIsNativeFormElement\n    ? this.element\n    : undefined) as NativeFormControl;\n\n  /**\n   * Current focus implementation, set by `registerAsBinding`.\n   */\n  private focuser = (options?: FocusOptions) => this.element.focus(options);\n\n  /** Any `ControlValueAccessor` instances provided on the host element. */\n  private readonly controlValueAccessors = inject(NG_VALUE_ACCESSOR, {optional: true, self: true});\n\n  private readonly config = inject(SIGNAL_FORMS_CONFIG, {optional: true});\n  private readonly validityMonitor = inject(InputValidityMonitor);\n\n  /** @internal */\n  readonly parseErrorsSource = signal<\n    Signal<readonly ValidationError.WithoutFieldTree[]> | undefined\n  >(undefined);\n\n  /** A lazily instantiated fake `NgControl`. */\n  private _interopNgControl: InteropNgControl | undefined;\n\n  /** Lazily instantiates a fake `NgControl` for this form field. */\n  /** @internal */\n  get interopNgControl(): InteropNgControl {\n    return (this._interopNgControl ??= new InteropNgControl(this.state));\n  }\n\n  /** @internal */\n  readonly parseErrors = computed<ValidationError.WithFormField[]>(\n    () =>\n      this.parseErrorsSource()?.().map((err) => ({\n        ...err,\n        fieldTree: untracked(this.state).fieldTree,\n        formField: this as FormField<unknown>,\n      })) ?? [],\n    {equal: shallowArrayEquals},\n  );\n\n  /** Errors associated with this form field. */\n  readonly errors = computed(\n    () =>\n      this.state()\n        .errors()\n        .filter((err) => !err.formField || err.formField === this),\n    {equal: shallowArrayEquals},\n  );\n\n  /** Whether this `FormField` has been registered as a binding on its associated `FieldState`. */\n  private isFieldBinding = false;\n\n  /**\n   * Current reset implementation, set by `registerAsBinding`.\n   */\n  private resetter = () => {};\n\n  private parseErrorsResetCallback?: (value?: unknown) => void;\n\n  /** @internal */\n  setParseErrors(source: Signal<ReadonlyArray<{readonly kind: string}>> | undefined): void {\n    this.parseErrorsSource.set(source);\n  }\n\n  /** @internal */\n  set onReset(callback: ((value?: unknown) => void) | undefined) {\n    this.parseErrorsResetCallback = callback;\n  }\n\n  /** @internal */\n  get onReset(): ((value?: unknown) => void) | undefined {\n    return this.parseErrorsResetCallback;\n  }\n\n  /**\n   * A `ControlValueAccessor`, if configured, for the host component.\n   *\n   * @internal\n   */\n  get controlValueAccessor(): ControlValueAccessor | undefined {\n    if (!this.controlValueAccessors || this.controlValueAccessors.length === 0) {\n      return this.interopNgControl?.valueAccessor ?? undefined;\n    }\n\n    // Rely on the exact logic in `@angular/forms` to pick the accessors with correct priority,\n    // passing our fake `InteropNgControl` to fulfill its first parameter requirement.\n    return (\n      selectValueAccessor(\n        this.interopNgControl as unknown as NgControl,\n        this.controlValueAccessors,\n      ) ?? undefined\n    );\n  }\n\n  /**\n   * Creates an `afterRenderEffect` that applies the configured class bindings to the host element\n   * if needed.\n   */\n  private installClassBindingEffect(): void {\n    const classes = Object.entries(this.config?.classes ?? {}).map(\n      ([className, computation]) => [className, computed(() => computation(this))] as const,\n    );\n    if (classes.length === 0) {\n      return;\n    }\n\n    // If we have class bindings to apply, set up an afterRenderEffect to apply them.\n    const bindings = createBindings<string>();\n    afterRenderEffect(\n      {\n        write: () => {\n          for (const [className, computation] of classes) {\n            const active = computation();\n            if (bindingUpdated(bindings, className, active)) {\n              if (active) {\n                this.renderer.addClass(this.element, className);\n              } else {\n                this.renderer.removeClass(this.element, className);\n              }\n            }\n          }\n        },\n      },\n      {injector: this.injector},\n    );\n  }\n\n  /**\n   * Focuses this field binding.\n   *\n   * By default, this will focus the host DOM element. However, custom `FormUiControl`s can\n   * implement custom focusing behavior.\n   */\n  focus(options?: FocusOptions): void {\n    this.focuser(options);\n  }\n\n  /**\n   * Resets the bound control.\n   */\n  reset(): void {\n    this.resetter();\n    this.parseErrorsResetCallback?.(this.state().value());\n  }\n\n  /**\n   * Registers this `FormField` as a binding on its associated `FieldState`.\n   *\n   * This method should be called at most once for a given `FormField`. A `FormField` placed on a\n   * custom control (`FormUiControl`) automatically registers that custom control as a binding.\n   */\n  registerAsBinding(bindingOptions?: FormFieldBindingOptions): void {\n    if (this.isFieldBinding) {\n      throw new RuntimeError(\n        RuntimeErrorCode.BINDING_ALREADY_REGISTERED,\n        typeof ngDevMode !== 'undefined' &&\n          ngDevMode &&\n          'FormField already registered as a binding',\n      );\n    }\n    this.isFieldBinding = true;\n\n    this.installClassBindingEffect();\n\n    if (bindingOptions?.focus) {\n      this.focuser = (focusOptions?: FocusOptions) => bindingOptions.focus!(focusOptions);\n    }\n\n    if (bindingOptions?.reset) {\n      this.resetter = () => bindingOptions.reset!();\n    }\n\n    // Register this control on the field state it is currently bound to. We do this at the end of\n    // initialization so that it only runs if we are actually syncing with this control\n    // (as opposed to just passing the field state through to its `formField` input).\n    effect(\n      (onCleanup) => {\n        const fieldNode = this.state() as unknown as FieldNode;\n        fieldNode.nodeState.formFieldBindings.update((controls) => [\n          ...controls,\n          this as FormField<unknown>,\n        ]);\n        onCleanup(() => {\n          fieldNode.nodeState.formFieldBindings.update((controls) =>\n            controls.filter((c) => c !== this),\n          );\n        });\n      },\n      {injector: this.injector},\n    );\n\n    if (typeof ngDevMode !== 'undefined' && ngDevMode) {\n      effect(\n        () => {\n          const fieldNode = this.state() as unknown as FieldNode;\n          if (fieldNode.hidden()) {\n            const path = fieldNode.structure.pathKeys().join('.') || '<root>';\n            console.warn(\n              formatRuntimeError(\n                RuntimeErrorCode.RENDERED_HIDDEN_FIELD,\n                `Field '${path}' is hidden but is being rendered. ` +\n                  `Hidden fields should be removed from the DOM using @if.`,\n              ),\n            );\n          }\n        },\n        {injector: this.injector},\n      );\n    }\n  }\n\n  /**\n   * The presence of this symbol tells the template type-checker that this directive is a control\n   * directive and should be type-checked as such. We don't use the `ɵngControlCreate` method below\n   * as it's marked internal and removed from the public API. A symbol is used instead to avoid\n   * polluting the public API with the marker.\n   */\n  readonly [ɵNgFieldDirective]!: true;\n\n  /**\n   * Internal control directive creation lifecycle hook.\n   *\n   * The presence of this method tells the compiler to install `ɵɵControlFeature`, which will\n   * cause this directive to be recognized as a control directive by the `ɵcontrolCreate` and\n   * `ɵcontrol` instructions.\n   *\n   * @internal */\n  ɵngControlCreate(host: ControlDirectiveHost<'formField'>): void {\n    if (host.hasPassThrough) {\n      return;\n    }\n\n    if (this.controlValueAccessor) {\n      this.ɵngControlUpdate = cvaControlCreate(host, this as FormField<unknown>);\n    } else if (host.customControl) {\n      this.ɵngControlUpdate = customControlCreate(host, this as FormField<unknown>);\n    } else if (this.elementIsNativeFormElement) {\n      this.ɵngControlUpdate = nativeControlCreate(\n        host,\n        this as FormField<unknown>,\n        this.parseErrorsSource,\n        this.validityMonitor,\n      );\n    } else {\n      throw new RuntimeError(\n        RuntimeErrorCode.INVALID_FIELD_DIRECTIVE_HOST,\n        typeof ngDevMode !== 'undefined' &&\n          ngDevMode &&\n          `${host.descriptor} is an invalid [formField] directive host. The host must be a native form control ` +\n            `(such as <input>', '<select>', or '<textarea>') or a custom form control with a 'value' or ` +\n            `'checked' model.`,\n      );\n    }\n  }\n\n  /** @internal */\n  ɵngControlUpdate: (() => void) | undefined;\n\n  /** @internal */\n  elementAcceptsNativeProperty<K extends ControlBindingKey>(\n    key: K,\n  ): key is K &\n    ('min' | 'max' | 'minLength' | 'maxLength' | 'disabled' | 'required' | 'readonly' | 'name') {\n    if (!this.elementIsNativeFormElement) {\n      return false;\n    }\n\n    switch (key) {\n      case 'min':\n      case 'max':\n        return (this._elementAcceptsMinMax ??= elementAcceptsMinMax(this.element));\n      case 'minLength':\n      case 'maxLength':\n        return this.elementAcceptsTextualValues;\n      case 'disabled':\n      case 'required':\n      case 'readonly':\n      case 'name':\n        return true;\n      default:\n        return false;\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 {Directive, input, untracked} from '@angular/core';\n\nimport {submit} from '../api/structure';\nimport {FieldState, FieldTree} from '../api/types';\nimport {FieldNode} from '../field/node';\n\n/**\n * A directive that binds a `FieldTree` to a `<form>` element.\n *\n * It automatically:\n * 1. Sets `novalidate` on the form element to disable browser validation.\n * 2. Listens for the `submit` event, prevents the default behavior, and calls `submit()` on the\n * `FieldTree` if it defines its own submission options.\n *\n * @usageNotes\n *\n * ```html\n * <form [formRoot]=\"myFieldTree\">\n *   ...\n * </form>\n * ```\n *\n * @publicApi 22.0\n */\n@Directive({\n  selector: 'form[formRoot]',\n  host: {\n    'novalidate': '',\n    '(submit)': 'onSubmit($event)',\n  },\n})\nexport class FormRoot<T> {\n  readonly fieldTree = input.required<FieldTree<T>>({alias: 'formRoot'});\n\n  protected onSubmit(event: Event): void {\n    event.preventDefault();\n\n    untracked(() => {\n      const fieldTree = this.fieldTree();\n      const node = fieldTree() as FieldState<unknown> as FieldNode;\n\n      if (node.structure.fieldManager.submitOptions) {\n        submit(fieldTree);\n      }\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 {\n  declareExperimentalWebMcpTool,\n  effect,\n  EnvironmentProviders,\n  inject,\n  Injector,\n  makeEnvironmentProviders,\n  untracked,\n} from '@angular/core';\nimport type {JsonSchemaForInference} from '@mcp-b/webmcp-types';\nimport {submit} from '../api/structure';\nimport {FieldTree} from '../api/types';\nimport {FieldNode} from '../field/node';\nimport {REGISTER_WEBMCP_FORM, RegisterWebMcpForm} from './tokens';\n\nconst registerWebMcpForm: RegisterWebMcpForm = async (formTree, options) => {\n  const injector = inject(Injector);\n\n  // we want to defer the registration until the context is fully initialized,\n  // This is especially useful if the form model is a derivation of a required input\n  effect(() => {\n    untracked(() => {\n      initWebMcpForm(formTree, options, injector);\n    });\n  });\n};\n\nfunction initWebMcpForm(\n  formTree: FieldTree<unknown>,\n  options: {name: string; description: string},\n  injector: Injector,\n) {\n  const node = formTree() as FieldNode;\n  const inputSchema = inferSchemaFromFieldNode(node);\n\n  if (!inputSchema) {\n    throw new Error(\n      `Could not accurately infer WebMCP schema for form \"${options.name}\". ` +\n        `Ensure that the form model does not contain null, undefined, empty arrays, or unsupported types.`,\n    );\n  }\n\n  declareExperimentalWebMcpTool(\n    {\n      name: options.name,\n      description: options.description,\n      inputSchema,\n      execute: async (args: Record<string, unknown>) => {\n        // Populate the form with changes from the agent.\n        node.value.set(args);\n\n        // Trigger form submission.\n        const success = await submit(formTree);\n\n        // Report the result to the agent.\n        if (success) {\n          return {content: [{type: 'text', text: 'Form submitted successfully.'}]};\n        } else {\n          const errorMessages = node\n            .errorSummary()\n            .map((err) => {\n              const fieldName = (err.fieldTree() as FieldNode).structure.pathKeys().join('.');\n              return `${fieldName ? `${fieldName}: ` : ''}${err.message || err.kind}`;\n            })\n            .join('\\n');\n          return {content: [{type: 'text', text: `Form submission failed:\\n${errorMessages}`}]};\n        }\n      },\n    },\n    injector,\n  );\n}\n\n/** Infers the JSON schema from a specific form field. */\nfunction inferSchemaFromFieldNode(node: FieldNode): JsonSchemaForInference | undefined {\n  const value = node.value();\n\n  // Primitive types.\n  if (typeof value === 'string') return {type: 'string'};\n  if (typeof value === 'number') return {type: 'number'};\n  if (typeof value === 'boolean') return {type: 'boolean'};\n\n  // `null` or `undefined` does not hint at the underlying type.\n  if (value === null || value === undefined) return undefined;\n\n  // Use the type of the first value of an array.\n  if (Array.isArray(value)) {\n    if (value.length === 0) return undefined;\n\n    const firstChild = node.structure.getChild('0');\n    if (!firstChild) return undefined;\n\n    const itemSchema = inferSchemaFromFieldNode(firstChild);\n    if (!itemSchema) return undefined;\n\n    return {\n      type: 'array',\n      items: itemSchema,\n    };\n  }\n\n  // Recursively infer the types of all object properties.\n  if (typeof value === 'object') {\n    const properties: Record<string, JsonSchemaForInference> = {};\n    const required: string[] = [];\n    const children = node.structure.children();\n    for (const child of children) {\n      const key = child.keyInParent();\n      const childSchema = inferSchemaFromFieldNode(child);\n      if (!childSchema) return undefined;\n\n      properties[key] = childSchema;\n\n      if (child.required()) required.push(key.toString());\n    }\n\n    return {\n      type: 'object',\n      properties,\n      required,\n      additionalProperties: false,\n    };\n  }\n\n  return undefined; // Unknown type.\n}\n\n/**\n * Creates a provider that configures all signal forms with `experimentalWebMcpTool`\n * to be registered as WebMCP tools.\n *\n * @experimental\n */\nexport function provideExperimentalWebMcpForms(): EnvironmentProviders {\n  return makeEnvironmentProviders([\n    {\n      provide: REGISTER_WEBMCP_FORM,\n      useValue: registerWebMcpForm,\n    },\n  ]);\n}\n"],"names":["SIGNAL_FORMS_CONFIG","InjectionToken","ngDevMode","provideSignalFormsConfig","config","provide","useValue","disabled","path","configOrLogic","assertPathIsCurrent","pathNode","FieldPathNode","unwrapFieldPath","logic","when","builder","addDisabledReasonRule","ctx","result","fieldTree","message","undefined","hidden","addHiddenRule","readonly","addReadonlyRule","getLengthOrSize","value","v","length","size","getOption","opt","Function","isEmpty","isNaN","normalizeErrors","error","Array","isArray","validate","addSyncErrorRule","addDefaultField","requiredError","options","RequiredValidationError","minError","min","MinValidationError","minDateError","minDate","MinDateValidationError","maxError","max","MaxValidationError","maxDateError","maxDate","MaxDateValidationError","minLengthError","minLength","MinLengthValidationError","maxLengthError","maxLength","MaxLengthValidationError","patternError","pattern","PatternValidationError","emailError","EmailValidationError","BaseNgValidationError","__brand","kind","constructor","Object","assign","NativeInputParseError","NgValidationError","EMAIL_REGEXP","email","test","maxValue","MAX_MEMO","createMetadataKey","metadata","MAX_NUMBER","state","MAX","Number","maxDateValue","MAX_DATE","getTime","MAX_LENGTH_MEMO","MAX_LENGTH","minValue","MIN_MEMO","MIN_NUMBER","MIN","minDateValue","MIN_DATE","MIN_LENGTH_MEMO","MIN_LENGTH","PATTERN_MEMO","RegExp","PATTERN","required","REQUIRED_MEMO","REQUIRED","validateAsync","opts","RESOURCE","createManagedMetadataKey","_state","params","debounce","debouncedResource","debounced","wrappedParams","computed","ɵchain","factory","IS_ASYNC_VALIDATION_RESOURCE","node","stateOf","validationState","shouldSkipValidation","syncValid","addAsyncErrorRule","res","errors","status","hasValue","onSuccess","onError","validateTree","addSyncTreeErrorRule","validateStandardSchema","schema","VALIDATOR_MEMO","resolvedSchema","fieldTreeOf","ɵisPromise","issues","map","issue","standardIssueToFormTreeError","resource","loader","standardSchemaError","StandardSchemaValidationError","target","pathPart","pathKey","key","validateHttp","request","httpResource","debouncer","normalizeDebouncer","addMetadataRule","DEBOUNCER","debounceUntilBlur","debounceForDuration","immediate","durationInMilliseconds","_context","abortSignal","Promise","resolve","timeoutId","onAbort","clearTimeout","setTimeout","removeEventListener","addEventListener","once","createParser","getValue","setValue","parse","linkedSignal","debugName","source","computation","equal","shallowArrayEquals","setRawValue","rawValue","set","reset","asReadonly","transformedValue","format","parser","parseErrors","originalSet","bind","integration","inject","FORM_CONTROL_INTEGRATION","self","optional","setParseErrors","onReset","resetValue","modelValue","newRawValue","update","updateFn","InteropNgControl","field","control","controlValue","valid","invalid","pending","enabled","signalErrorsToValidationErrors","pristine","dirty","touched","untouched","RuntimeError","valueAccessor","hasValidator","validator","Validators","updateValueAndValidity","FIELD_STATE_KEY_TO_CONTROL_BINDING","disabledReasons","name","CONTROL_BINDING_TO_FIELD_STATE_KEY","keys","readFieldStateBindingValue","fieldState","property","CONTROL_BINDING_NAMES","values","createBindings","bindingUpdated","bindings","getNativeControlValue","element","currentValue","validityMonitor","isInput","isBadInput","type","checked","untracked","valueAsNumber","Date","valueAsDate","tagName","parsed","setNativeControlValue","setNativeNumberControlValue","String","inputRequiresValidityTracking","input","formatDateForInput","date","year","getUTCFullYear","month","getUTCMonth","padStart","day","getUTCDate","formatDateForMinMax","customControlCreate","host","parent","listenToCustomControlModel","listenToCustomControlOutput","markAsTouched","registerAsBinding","customControl","setCustomControlModelInput","setInputOnDirectives","elementAcceptsNativeProperty","customControlHasInput","domValue","nativeFormElement","setNativeDomProperty","renderer","isValidatorObject","cvaControlCreate","controlValueAccessor","registerOnChange","registerOnTouched","legacyValidators","injector","get","NG_VALIDATORS","version","registerOnValidatorChange","signal","n","validatorFns","mergedValidator","compose","interopNgControl","reactiveErrorsToSignalErrors","parseErrorsSource","writeValue","propertyWasSet","setDisabledState","observeSelectMutations","select","onMutation","destroyRef","MutationObserver","observer","mutations","some","m","isRelevantSelectMutation","observe","attributes","attributeFilter","characterData","childList","subtree","onDestroy","disconnect","mutation","Comment","addedNodes","removedNodes","HTMLOptionElement","nativeControlCreate","updateMode","_rawValue","listenToDom","watchValidity","InputValidityMonitor","deps","i0","ɵɵFactoryTarget","Injectable","providedIn","useClass","forwardRef","AnimationInputValidityMonitor","decorators","args","document","DOCUMENT","cspNonce","CSP_NONCE","injectedStyles","WeakMap","callback","ngServerMode","rootNode","getRootNode","has","createTransitionStyle","onAnimationStart","event","animationEvent","animationName","validity","badInput","createElement","nonce","textContent","nodeType","head","appendChild","ngOnDestroy","remove","ɵNgFieldDirective","Symbol","FORM_FIELD","FormField","alias","Renderer2","DestroyRef","Injector","ElementRef","nativeElement","elementIsNativeFormElement","isNativeFormElement","elementAcceptsTextualValues","isTextualFormElement","_elementAcceptsMinMax","focuser","focus","controlValueAccessors","NG_VALUE_ACCESSOR","_interopNgControl","err","formField","filter","isFieldBinding","resetter","parseErrorsResetCallback","selectValueAccessor","installClassBindingEffect","classes","entries","className","afterRenderEffect","write","active","addClass","removeClass","bindingOptions","focusOptions","effect","onCleanup","fieldNode","nodeState","formFieldBindings","controls","c","structure","pathKeys","join","console","warn","formatRuntimeError","ɵngControlCreate","hasPassThrough","ɵngControlUpdate","descriptor","elementAcceptsMinMax","Directive","ɵdir","ɵɵngDeclareDirective","minVersion","isStandalone","selector","inputs","classPropertyName","publicName","isSignal","isRequired","transformFunction","providers","useExisting","NgControl","useFactory","exportAs","controlCreate","passThroughInput","ngImport","FormRoot","onSubmit","preventDefault","fieldManager","submitOptions","submit","listeners","registerWebMcpForm","formTree","initWebMcpForm","inputSchema","inferSchemaFromFieldNode","Error","declareExperimentalWebMcpTool","description","execute","success","content","text","errorMessages","errorSummary","fieldName","firstChild","getChild","itemSchema","items","properties","children","child","keyInParent","childSchema","push","toString","additionalProperties","provideExperimentalWebMcpForms","makeEnvironmentProviders","REGISTER_WEBMCP_FORM"],"mappings":";;;;;;;;;;;;;;;AAYO,MAAMA,mBAAmB,GAAG,IAAIC,cAAc,CACnD,OAAOC,SAAS,KAAK,WAAW,IAAIA,SAAS,GAAG,qBAAqB,GAAG,EAAE,CAC3E;;ACeK,SAAUC,wBAAwBA,CAACC,MAAyB,EAAA;AAChE,EAAA,OAAO,CAAC;AAACC,IAAAA,OAAO,EAAEL,mBAAmB;AAAEM,IAAAA,QAAQ,EAAEF;AAAM,GAAC,CAAC;AAC3D;;ACUM,SAAUG,QAAQA,CACtBC,IAA8D,EAC9DC,aAGyD,EAAA;EAEzDC,mBAAmB,CAACF,IAAI,CAAC;AAEzB,EAAA,MAAMG,QAAQ,GAAGC,aAAa,CAACC,eAAe,CAACL,IAAI,CAAC;AAEpD,EAAA,IAAIM,KAAwE;EAC5E,IAAI,OAAOL,aAAa,KAAK,UAAU,IAAI,OAAOA,aAAa,KAAK,QAAQ,EAAE;AAC5EK,IAAAA,KAAK,GAAGL,aAAa;AACvB,EAAA,CAAA,MAAO;IACLK,KAAK,GAAGL,aAAa,EAAEM,IAAI;AAC7B,EAAA;AAEAJ,EAAAA,QAAQ,CAACK,OAAO,CAACC,qBAAqB,CAAEC,GAAG,IAAI;IAC7C,IAAIC,MAAM,GAAqB,IAAI;AACnC,IAAA,IAAI,OAAOL,KAAK,KAAK,QAAQ,EAAE;AAC7BK,MAAAA,MAAM,GAAGL,KAAK;IAChB,CAAA,MAAO,IAAIA,KAAK,EAAE;AAChBK,MAAAA,MAAM,GAAGL,KAAK,CAACI,GAAsC,CAAC;AACxD,IAAA;AACA,IAAA,IAAI,OAAOC,MAAM,KAAK,QAAQ,EAAE;MAC9B,OAAO;QAACC,SAAS,EAAEF,GAAG,CA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