@frontile/forms 0.18.0-alpha.10 → 0.18.0-alpha.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +0,0 @@
1
- {"version":3,"file":"form-CVuJDJUq.js","sources":["../src/utils/nested-data.ts","../src/utils/standard-validator.ts","../src/components/form.gts"],"sourcesContent":["/**\n * Utility functions for working with nested data structures in forms.\n * These functions convert between nested objects and flat dotted-path notation.\n */\n\n/**\n * Type guard to check if a value is a plain object (not an array, Date, File, etc.)\n */\nfunction isPlainObject(value: unknown): value is Record<string, unknown> {\n return (\n value !== null &&\n typeof value === 'object' &&\n !Array.isArray(value) &&\n !(value instanceof Date) &&\n !(value instanceof File) &&\n !(value instanceof FileList)\n );\n}\n\n/**\n * Flattens a nested object into a flat object with dotted-path keys.\n *\n * @example\n * flattenData({name: {first: 'John', last: 'Doe'}, email: 'john@example.com'})\n * // Returns: {'name.first': 'John', 'name.last': 'Doe', 'email': 'john@example.com'}\n *\n * @param data - The nested data object to flatten\n * @param prefix - Internal parameter for recursion (parent path)\n * @returns A flat object with dotted-path keys\n */\nexport function flattenData<T = unknown>(\n data: Record<string, unknown>,\n prefix = ''\n): Record<string, T> {\n const result: Record<string, T> = {};\n\n for (const key in data) {\n if (!Object.prototype.hasOwnProperty.call(data, key)) {\n continue;\n }\n\n const value = data[key];\n const fullPath = prefix ? `${prefix}.${key}` : key;\n\n if (isPlainObject(value)) {\n // Recursively flatten nested objects\n Object.assign(result, flattenData(value, fullPath));\n } else {\n // Store primitive values, arrays, and special objects as-is\n result[fullPath] = value as T;\n }\n }\n\n return result;\n}\n\n/**\n * Unflattens a flat object with dotted-path keys into a nested object structure.\n *\n * @example\n * unflattenData({'name.first': 'John', 'name.last': 'Doe', 'email': 'john@example.com'})\n * // Returns: {name: {first: 'John', last: 'Doe'}, email: 'john@example.com'}\n *\n * @param data - The flat data object with dotted-path keys\n * @returns A nested object structure\n */\nexport function unflattenData<T = unknown>(\n data: Record<string, unknown>\n): Record<string, T> {\n const result: Record<string, unknown> = {};\n\n for (const path in data) {\n if (!Object.prototype.hasOwnProperty.call(data, path)) {\n continue;\n }\n\n const value = data[path];\n const keys = path.split('.');\n let current = result;\n\n // Navigate/create nested structure\n for (let i = 0; i < keys.length - 1; i++) {\n const key = keys[i];\n if (!key) continue;\n\n if (!isPlainObject(current[key])) {\n current[key] = {};\n }\n current = current[key] as Record<string, unknown>;\n }\n\n // Set the final value\n const lastKey = keys[keys.length - 1];\n if (lastKey) {\n current[lastKey] = value;\n }\n }\n\n return result as Record<string, T>;\n}\n\n/**\n * Checks if the data structure contains any nested objects.\n * If true, we need to handle it as nested data.\n *\n * @param data - The data object to check\n * @returns True if the data contains nested plain objects\n */\nexport function hasNestedData(data: Record<string, unknown>): boolean {\n for (const key in data) {\n if (Object.prototype.hasOwnProperty.call(data, key)) {\n if (isPlainObject(data[key])) {\n return true;\n }\n }\n }\n return false;\n}\n\n/**\n * Deep equality comparison for nested objects.\n * Handles primitives, arrays, and nested objects.\n *\n * @param a - First value to compare\n * @param b - Second value to compare\n * @returns True if values are deeply equal\n */\nexport function deepEqual(a: unknown, b: unknown): boolean {\n // Handle primitives and same reference\n if (a === b) return true;\n\n // Handle null/undefined\n if (a == null || b == null) return a === b;\n\n // Handle different types\n if (typeof a !== typeof b) return false;\n\n // Handle arrays\n if (Array.isArray(a) && Array.isArray(b)) {\n if (a.length !== b.length) return false;\n return a.every((item, index) => deepEqual(item, b[index]));\n }\n\n // Handle plain objects\n if (isPlainObject(a) && isPlainObject(b)) {\n const keysA = Object.keys(a);\n const keysB = Object.keys(b);\n\n if (keysA.length !== keysB.length) return false;\n\n return keysA.every((key) => deepEqual(a[key], b[key]));\n }\n\n // Handle special objects (Date, File, etc.) - compare by reference\n return a === b;\n}\n","import type { StandardSchemaV1 } from '@standard-schema/spec';\n\n/**\n * The issues collection returned by a Standard Schema validation failure.\n */\nexport type Issues = readonly StandardSchemaV1.Issue[];\n\n/**\n * The return type of a validator function.\n * Resolves to the issues (when validation fails) or undefined\n * (when it succeeds).\n */\nexport type ValidatorReturn = Promise<Issues | undefined>;\n\n/**\n * StandardSchemaV1 issues as either a promise or synchronous. If there are\n * no issues, `undefined` is returned.\n */\nexport type CustomValidatorReturn = ValidatorReturn | Issues | undefined;\n\n/**\n * A custom validator function.\n * If there are errors, they are returned by the validator as\n * StandardSchemaV1 issues. If there are no errors, nothing is returned.\n */\nexport type CustomValidatorFn<Input = unknown> = (\n input: Input\n) => CustomValidatorReturn;\n\n/**\n * Provides convenience methods for validating data using Standard Schema.\n * Also supports custom validator functions that return issues in the\n * Standard Schema format.\n *\n * Most of the time you should use `validateAll` or `validateFieldAll` to\n * validate data. Schema and custom validation are optional arguments\n * to these methods. This is useful because schema and custom validation\n * must both be optional in the form component, which is the primary use\n * case for this class.\n *\n * Note: all methods are static, so you do not need to instantiate\n * this class.\n *\n * @see https://standardschema.dev/\n */\nclass StandardValidator {\n private constructor() {\n throw new Error('StandardValidator is static and cannot be instantiated');\n }\n\n /**\n * Validates data against the provided standard schema.\n * If there are errors, they are returned. Otherwise, nothing is returned.\n * This provides a boolean indication of outcome: if there is a return\n * value, validation failed. Otherwise, validation succeeded.\n * @see https://standardschema.dev/\n *\n * @example\n * const input = …; // your data to validate\n * const schema = …; // your standard schema\n * const issues = await StandardValidator.validate(input, schema);\n *\n * @param input The input to validate.\n * @param schema The standard schema to validate against.\n * @return The issues if validation failed, otherwise undefined.\n */\n static async validate<I, O>(\n input: I,\n schema: StandardSchemaV1<I, O>\n ): ValidatorReturn {\n const result = await schema['~standard'].validate(input);\n return result.issues;\n }\n\n /**\n * Validates a single field within the input data using the provided\n * standard schema. If there are issues related to the specified field,\n * they are returned. Otherwise, nothing is returned.\n *\n * Note: because standard schema does not provide a way to validate\n * individual fields, this method filters the issues returned by the\n * schema validation to find those related to the specified field.\n * @see https://standardschema.dev/\n *\n * @param input The input data to validate.\n * @param fieldName The name of the field to validate.\n * @param schema The standard schema to validate against.\n * @returns The issues related to the specified field if validation failed,\n * otherwise undefined.\n */\n static async validateField<I, O>(\n input: I,\n fieldName: string,\n schema: StandardSchemaV1<I, O>\n ): ValidatorReturn {\n const issues = await StandardValidator.validate(input, schema);\n if (issues) {\n return StandardValidator.filterFieldIssues(issues, fieldName);\n }\n }\n\n /**\n * Validates input using a custom validator function.\n * If there are errors, they are returned by the validator as\n * StandardSchemaV1 issues. If there are no errors, nothing is returned.\n * @see https://standardschema.dev/\n *\n * @param input The input data to validate.\n * @param customValidator The custom validator function to use.\n * @returns The issues if validation failed, otherwise undefined.\n */\n static async validateCustom<I>(\n input: I,\n customValidator: CustomValidatorFn<I>\n ): ValidatorReturn {\n return await customValidator(input);\n }\n\n /**\n * Validates a single field within the input data using a custom validator\n * function. If there are issues related to the specified field, they are\n * returned. Otherwise, nothing is returned.\n *\n * Note: because custom validators may return issues for multiple fields,\n * this method filters the issues returned by the custom validator to find\n * those related to the specified field.\n * @see https://standardschema.dev/\n *\n * @param input The input data to validate.\n * @param fieldName The name of the field to validate.\n * @param customValidator The custom validator function to use.\n * @returns The issues related to the specified field if validation failed,\n * otherwise undefined.\n */\n static async validateFieldCustom<I>(\n input: I,\n fieldName: string,\n customValidator: CustomValidatorFn<I>\n ): ValidatorReturn {\n const issues = await StandardValidator.validateCustom(\n input,\n customValidator\n );\n if (issues) {\n return StandardValidator.filterFieldIssues(issues, fieldName);\n }\n }\n\n /**\n * Validates input data using both a standard schema and a custom validator\n * function, merging any issues found by either method. If there are issues,\n * they are returned. Otherwise, nothing is returned. This method runs both\n * validations in parallel.\n *\n * Note: `schema` and `customValidator` are both optional. If either the\n * schema or custom validator is not provided, that validation is skipped.\n * @see https://standardschema.dev/\n *\n * @param input The input data to validate.\n * @param schema Optional standard schema to validate against.\n * @param customValidator Optional custom validator function to use.\n * @returns issues if validation failed, otherwise undefined.\n */\n static async validateAll<I, O>(\n input: I,\n schema?: StandardSchemaV1<I, O>,\n customValidator?: CustomValidatorFn<I>\n ): ValidatorReturn {\n const standardIssues = schema && StandardValidator.validate(input, schema);\n const customIssues =\n customValidator &&\n StandardValidator.validateCustom(input, customValidator);\n const [s, c] = await Promise.all([standardIssues, customIssues]);\n if (s || c) {\n return [...(s ?? []), ...(c ?? [])];\n }\n }\n\n /**\n * Validates a single field within the input data using both a standard\n * schema and a custom validator function, merging any issues found by\n * either method. If there are issues related to the specified field,\n * they are returned. Otherwise, nothing is returned. This method runs\n * both validations in parallel.\n *\n * Note: `schema` and `customValidator` are both optional. If either the\n * schema or custom validator is not provided, that validation is skipped.\n * @see https://standardschema.dev/\n *\n * @param input The input data to validate.\n * @param fieldName The name of the field to validate.\n * @param schema Optional standard schema to validate against.\n * @param customValidator Optional custom validator function to use.\n * @returns The issues related to the specified field if validation failed,\n * otherwise undefined.\n */\n static async validateFieldAll<I, O>(\n input: I,\n fieldName: string,\n schema?: StandardSchemaV1<I, O>,\n customValidator?: CustomValidatorFn<I>\n ): ValidatorReturn {\n const standardIssues =\n schema && StandardValidator.validateField(input, fieldName, schema);\n const customIssues =\n customValidator &&\n StandardValidator.validateFieldCustom(input, fieldName, customValidator);\n const [s, c] = await Promise.all([standardIssues, customIssues]);\n if (s || c) {\n return [...(s ?? []), ...(c ?? [])];\n }\n }\n\n /**\n * Filters issues to those related to the specified field name.\n * Supports both simple field names and dotted notation for nested fields.\n *\n * @param issues The issues to filter.\n * @param fieldName The name of the field to filter by (e.g., \"email\" or\n * \"profile.contact.email\").\n * @returns The issues related to the specified field, or undefined if\n * there are none.\n */\n static filterFieldIssues(\n issues: Issues,\n fieldName: string\n ): Issues | undefined {\n const fieldParts = fieldName.split('.');\n\n const fieldIssues = issues.filter((issue) => {\n if (!issue.path) return false;\n\n // Extract keys from path segments\n const pathKeys = issue.path\n .map((s) => (typeof s === 'object' && 'key' in s ? s.key : s))\n .filter(Boolean);\n\n // For exact path matching:\n // The paths must be the same length and match exactly\n return (\n pathKeys.length === fieldParts.length &&\n pathKeys.every((key, i) => key === fieldParts[i])\n );\n });\n\n return fieldIssues.length > 0 ? fieldIssues : undefined;\n }\n}\n\nexport { StandardValidator };\nexport default StandardValidator;\n","import Component from '@glimmer/component';\nimport { tracked } from '@glimmer/tracking';\nimport { action } from '@ember/object';\nimport { hash } from '@ember/helper';\nimport { on } from '@ember/modifier';\nimport { ref } from '@frontile/utilities';\nimport { dataFrom } from 'form-data-utils';\nimport { StandardValidator } from '../utils/standard-validator';\nimport { flattenData, unflattenData, deepEqual } from '../utils/nested-data';\nimport { Field } from './field';\n\nimport type { WithBoundArgs } from '@glint/template';\nimport type { StandardSchemaV1 } from '@standard-schema/spec';\nimport type { Issues, CustomValidatorFn } from '../utils/standard-validator';\nimport type Owner from '@ember/owner';\n\n/** The form data as key/value pairs. */\ntype FormDataCompiled = ReturnType<typeof dataFrom>;\n/** The validation errors for the form, keyed by field name. */\ntype FormErrors = Record<string, string | string[] | undefined>;\n\n/**\n * The data passed to `onChange` and `onSubmit` callbacks, which is similar\n * to `FormContext` but also includes the form data.\n */\ntype FormResultData<T = FormDataCompiled> = {\n /** The form data as key/value pairs. */\n data: T;\n /** Whether the form is valid (i.e. has no validation errors). */\n isValid: boolean;\n /** Whether the form is invalid (i.e. has validation errors). */\n isInvalid: boolean;\n /** The current form validation errors. */\n errors: FormErrors;\n /**\n * The set of fields that have changed from their initial values.\n * For flat data structures: contains top-level keys (e.g., \"firstName\", \"email\")\n * For nested data structures: contains dotted paths (e.g., \"user.name.first\", \"profile.email\")\n */\n dirty: Set<string>;\n};\n\n/**\n * The context yielded to the default block of the `Form` component.\n */\ninterface FormContext<T = FormDataCompiled> {\n /** The form data as key/value pairs. */\n data?: T;\n /** Whether the form is currently submitting. */\n isLoading: boolean;\n /** Whether the form is valid (i.e. has no validation errors). */\n isValid: boolean;\n /** Whether the form is invalid (i.e. has validation errors). */\n isInvalid: boolean;\n /** The current form validation errors. */\n errors: FormErrors;\n /**\n * The set of fields that have changed from their initial values.\n * For flat data structures: contains top-level keys (e.g., \"firstName\", \"email\")\n * For nested data structures: contains dotted paths (e.g., \"user.name.first\", \"profile.email\")\n */\n dirty: Set<string>;\n /**\n * Resets the form to its initial state.\n * Clears all form fields, validation errors, and dirty tracking.\n */\n reset: () => void;\n /** The `Field` component, with args bound. */\n Field: WithBoundArgs<\n typeof Field,\n 'errors' | 'formData' | 'disabled' | 'validateOn' | 'validateField'\n >;\n}\n\ninterface FormSignature<T = FormDataCompiled> {\n Element: HTMLFormElement;\n Args: {\n /**\n * The standard schema to validate form data against.\n */\n schema?: StandardSchemaV1<T>;\n /**\n * Optional custom validation function. A custom validator should return\n * an array of Standard Schema issues, or `undefined` if there are none.\n * This function may be async or sync.\n */\n validate?: CustomValidatorFn<T>;\n /**\n * When to run validation.\n */\n validateOn?: ('change' | 'input' | 'blur' | 'submit')[];\n /**\n * The initial form data as key/value pairs.\n * This is primarily useful for setting default values in the form.\n * This object receives changes as the user interacts with the form.\n */\n data?: T;\n /**\n * Whether the entire form and all its fields should be disabled. This only\n * applies when using the yielded `Field` component.\n */\n disabled?: boolean;\n /**\n * Optional callback invoked on input changes within the form.\n * @param result - The current form result data.\n * @param event - The input event that triggered the change.\n * @returns A promise or void.\n */\n onChange?: (\n result: FormResultData<T>,\n event: Event\n ) => Promise<void> | void;\n /**\n * Callback invoked on form submission. If `onSubmit` returns a promise,\n * the form will be marked as `isLoading` until the promise resolves.\n * @param result - The current form result data.\n * @param event - The submit event that triggered the submission.\n * @returns A promise or void.\n */\n onSubmit: (\n result: FormResultData<T>,\n event: SubmitEvent\n ) => Promise<void> | void;\n /**\n * Optional callback invoked when validation errors occur on form submission.\n * @param errors - The validation errors found.\n * @param data - The form data that was validated.\n * @param event - The submit event that triggered the validation.\n * @returns A promise or void.\n */\n onError?: (\n errors: FormErrors,\n data: T,\n event: SubmitEvent\n ) => Promise<void> | void;\n };\n Blocks: {\n default: [FormContext<T>];\n };\n}\n\n/**\n * A form component that handles form submissions and input changes.\n *\n * @example\n * ```hbs\n * <Form\n * @data={{this.formData}}\n * @schema={{this.schema}}\n * @validate={{this.customValidator}}\n * @onSubmit={{this.onSubmit}}\n * @onChange={{this.onChange}}\n * as |form|\n * >\n * <form.Field name=\"firstName\" as |field|>\n * <field.Input />\n * </form.Field>\n * <form.Field name=\"lastName\" as |field|>\n * <field.Input />\n * </form.Field>\n * <button type=\"submit\" disabled={{form.isLoading}}>\n * {{#if form.isLoading}}Submitting...{{else}}Submit{{/if}}\n * </button>\n * </Form>\n * ```\n */\nclass Form<T = FormDataCompiled> extends Component<FormSignature<T>> {\n /** Whether the form is currently submitting. */\n @tracked isLoading = false;\n\n /** The current form validation errors. */\n @tracked errors: FormErrors = {};\n\n /** The current uncontrolled form data. */\n @tracked uncontrolledData?: T;\n\n /**\n * Flattened snapshot of initial data for dirty field comparison.\n * Stored in flattened form regardless of whether source data is nested or flat.\n */\n @tracked initialDataSnapshot?: Record<string, unknown>;\n\n /**\n * The set of fields that have changed from their initial values.\n * For flat data structures: contains top-level keys (e.g., \"firstName\", \"email\")\n * For nested data structures: contains dotted paths (e.g., \"user.name.first\", \"profile.email\")\n */\n @tracked dirty: Set<string> = new Set();\n\n /** Reference to the form element. */\n element = ref<HTMLFormElement>();\n\n /**\n * Creates a new instance of the Form component.\n * Initializes internal state based on provided args.\n * @param owner - The owner of the component.\n * @param args - The arguments passed to the component.\n */\n constructor(owner: Owner, args: FormSignature<T>['Args']) {\n super(owner, args);\n // Create copy of initial data\n if (args.data) {\n // Always store flattened snapshot for dirty tracking\n // This ensures consistent comparison regardless of initial structure\n this.initialDataSnapshot = flattenData(\n args.data as Record<string, unknown>\n );\n\n // Keep uncontrolled data in original structure\n this.uncontrolledData = { ...args.data };\n }\n }\n\n /** Whether the form is valid (i.e. has no validation errors). */\n get isValid() {\n return Object.keys(this.errors).length === 0;\n }\n\n /** Whether the form is invalid (i.e. has validation errors). */\n get isInvalid() {\n return !this.isValid;\n }\n\n /** Whether the form is controlled (`onChange` is provided). */\n get isControlled(): boolean {\n return !!this.args.onChange;\n }\n\n /** The events on which validation should run. */\n get validateOn(): ('change' | 'input' | 'blur' | 'submit')[] {\n return this.args.validateOn ?? ['change', 'blur', 'submit'];\n }\n\n /** The events on which field-level validation should run. */\n get fieldValidateOn(): ('change' | 'input' | 'blur')[] {\n return this.validateOn.filter((e) => e !== 'submit');\n }\n\n /** The current form data, from args if controlled, or internal state if uncontrolled. */\n get currentData(): T | undefined {\n if (this.isControlled) {\n return this.args.data;\n }\n return this.uncontrolledData;\n }\n\n /**\n * Validates data against the provided schema using StandardValidator.\n * Updates the `errors` property with any validation errors found.\n *\n * @param data - The form data to validate.\n * @returns A promise that resolves to the validation errors, if any.\n */\n async validate(data: T): Promise<FormErrors | undefined> {\n // Run validator and get issues\n const errors = await StandardValidator.validateAll(\n data,\n this.args.schema,\n this.args.validate\n );\n // Convert validator errors to FormErrors\n if (errors) {\n const formErrors = validatorToFormErrors(errors);\n this.errors = formErrors;\n return formErrors;\n }\n // Clear errors if no issues\n this.errors = {};\n }\n\n /**\n * Validates a single field against the provided schema using\n * StandardValidator. Updates the `errors` property with any validation\n * errors found for the field. If the field had previous errors but\n * is now valid, those errors are cleared.\n *\n * @param data - The form data to validate against.\n * @param name - The name of the field to validate.\n * @returns A promise that resolves to errors for the field, if any.\n */\n @action\n async validateField(data: T, name: string): Promise<FormErrors | undefined> {\n if (!this.args.schema && !this.args.validate) {\n return;\n }\n // Run validator and get issues\n const errors = await StandardValidator.validateFieldAll(\n data,\n name,\n this.args.schema,\n this.args.validate\n );\n // Convert validator errors to FormErrors\n if (errors) {\n const formErrors = validatorToFormErrors(errors);\n if (formErrors[name]) {\n // Merge with existing errors immutably\n this.errors = { ...this.errors, [name]: formErrors[name] };\n }\n return { [name]: formErrors[name] };\n }\n // Clear field error if no issues\n // Remove field error using immutable pattern:\n // 1. Use destructuring to extract the field we want to remove\n // (assigned to '_' since unused)\n // 2. Capture all remaining fields in 'rest' using the spread operator\n // 3. Reassign this.errors to the 'rest' object, effectively removing\n // the field\n // This approach maintains immutability by creating a new object rather than\n // mutating the existing errors object with 'delete'\n if (this.errors[name]) {\n const { [name]: _, ...rest } = this.errors;\n this.errors = rest;\n }\n }\n\n /**\n * Computes which fields have changed from their initial values.\n * Uses deep comparison for consistency across flat and nested structures.\n * This is a pure function with no side effects.\n *\n * @param data - The current form data.\n * @returns A set of field names that have changed.\n */\n computeDirtyFields(data: T): Set<string> {\n const dirty = new Set<string>();\n\n if (!this.initialDataSnapshot) {\n return dirty;\n }\n\n // Flatten current data to same representation as snapshot\n const currentFlat = flattenData(data as Record<string, unknown>);\n\n // Compare all keys in current data\n for (const key in currentFlat) {\n if (!deepEqual(currentFlat[key], this.initialDataSnapshot[key])) {\n dirty.add(key);\n }\n }\n\n // Check for keys in initial data that are missing in current data\n for (const key in this.initialDataSnapshot) {\n if (\n !(key in currentFlat) &&\n this.initialDataSnapshot[key] !== undefined\n ) {\n dirty.add(key);\n }\n }\n\n return dirty;\n }\n\n /**\n * Builds the form result data object to pass to callbacks.\n * Also updates the dirty state as a side effect.\n *\n * @param data - The current form data.\n * @returns The form result data object.\n */\n buildFormResultData(data: T): FormResultData<T> {\n const { isValid, isInvalid, errors } = this;\n const dirty = this.computeDirtyFields(data);\n this.dirty = dirty; // Update tracked state\n return {\n data,\n isValid,\n isInvalid,\n errors,\n dirty\n };\n }\n\n /**\n * Handles the `input` event on the form element.\n * Calls the `onChange` callback with the current form data if provided.\n * Automatically unflattens dotted field names to nested structure.\n */\n @action\n handleInput(event: Event) {\n const form = event.currentTarget;\n if (form instanceof HTMLFormElement) {\n let data = dataFrom(event) as T;\n\n // Always unflatten form data to handle dotted field names\n // This is safe for flat data too - keys without dots remain unchanged\n data = unflattenData(data as Record<string, unknown>) as T;\n\n const resultData = this.buildFormResultData(data);\n this.uncontrolledData = data;\n this.args.onChange?.(resultData, event);\n }\n }\n\n /**\n * Handles the `submit` event on the form element.\n * Prevents the default form submission and calls the `onSubmit` callback\n * with the current form data. Manages the `isLoading` state during the\n * submission process. Automatically unflattens dotted field names to nested structure.\n */\n @action\n async handleSubmit(event: SubmitEvent) {\n event.preventDefault();\n const form = event.currentTarget;\n if (form instanceof HTMLFormElement) {\n this.isLoading = true;\n let data = dataFrom(event) as T;\n\n // Always unflatten form data to handle dotted field names\n // This is safe for flat data too - keys without dots remain unchanged\n data = unflattenData(data as Record<string, unknown>) as T;\n\n let errors: FormErrors | undefined;\n if (this.validateOn.includes('submit')) {\n errors = await this.validate(data);\n }\n\n const resultData = this.buildFormResultData(data);\n this.uncontrolledData = data;\n try {\n if (errors && this.args.onError) {\n // Call onError handler when there are validation errors\n await this.args.onError(errors, data, event);\n } else if (!errors && this.args.onSubmit) {\n // Run `onSubmit` if validation was skipped OR if validation passed\n await this.args.onSubmit(resultData, event);\n // Update snapshot on successful submit (new baseline)\n this.initialDataSnapshot = flattenData(\n data as Record<string, unknown>\n );\n // Clear dirty state since we've updated the baseline\n this.dirty = new Set();\n }\n } finally {\n this.isLoading = false;\n }\n }\n }\n\n /**\n * Handles the `reset` event on the form element.\n * Clears validation errors and dirty tracking.\n * Restores the form data to its initial state.\n * Calls `onChange` if the form is controlled to let parent update state.\n */\n @action\n handleReset(event: Event) {\n // Clear state\n this.errors = {};\n this.dirty = new Set();\n\n // Restore initial data\n if (this.initialDataSnapshot) {\n // Unflatten data if it was nested\n const restoredData = unflattenData(this.initialDataSnapshot) as T;\n\n // For controlled forms, call onChange to let parent update state\n if (this.isControlled && this.args.onChange) {\n const resultData = this.buildFormResultData(restoredData);\n\n this.args.onChange(resultData, event);\n } else {\n // For uncontrolled forms, update internal state\n this.uncontrolledData = restoredData;\n }\n } else {\n // No initial data, just clear uncontrolled data\n this.uncontrolledData = undefined;\n }\n }\n\n /**\n * Resets the form to its initial state.\n * This method calls the native form reset() to clear all form controls,\n * triggering a `reset` event that is handled in `handleReset`.\n */\n @action\n reset() {\n this.element?.current?.reset();\n }\n\n <template>\n {{! @glint-nocheck component generics (field) trigger: type instantiation is excessively deep and possibly infinite }}\n <form\n {{this.element.setup}}\n {{on \"input\" this.handleInput}}\n {{on \"submit\" this.handleSubmit}}\n {{on \"reset\" this.handleReset}}\n ...attributes\n >\n {{yield\n (hash\n data=this.currentData\n isLoading=this.isLoading\n isValid=this.isValid\n isInvalid=this.isInvalid\n errors=this.errors\n dirty=this.dirty\n reset=this.reset\n Field=(component\n Field\n errors=this.errors\n formData=this.currentData\n disabled=@disabled\n validateOn=this.fieldValidateOn\n validateField=this.validateField\n )\n )\n to=\"default\"\n }}\n </form>\n </template>\n}\n\n/**\n * Helper function.\n * Converts validation type `Issues` from StandardValidator into a format\n * suitable for the form component, type `FormErrors`.\n *\n * For example, an issue with path `['email']` will be converted\n * to a form error for the field `email`, `{\"email\": \"error message\" }`.\n *\n * @param errors - The validation issues to convert.\n * @returns A mapping of field names to their validation error messages.\n */\nfunction validatorToFormErrors(errors: Issues): FormErrors {\n const formErrors: FormErrors = {};\n\n for (const issue of errors) {\n if (!issue.path || issue.path.length === 0) continue;\n\n // Extract keys from path segments to build field name\n const pathKeys = issue.path\n .map((s) => (typeof s === 'object' && 'key' in s ? s.key : s))\n .filter(Boolean) as string[];\n\n const fieldName = pathKeys.join('.');\n const message = issue.message;\n\n // Add message to the field's errors\n const existing = formErrors[fieldName];\n if (existing === undefined) {\n formErrors[fieldName] = message;\n } else if (Array.isArray(existing)) {\n existing.push(message);\n } else {\n formErrors[fieldName] = [existing, message];\n }\n }\n\n return formErrors;\n}\n\nexport {\n Form,\n type FormContext,\n type FormSignature,\n type FormDataCompiled,\n type FormResultData,\n type FormErrors\n};\nexport default Form;\n"],"names":["isPlainObject","value","Array","isArray","Date","File","FileList","flattenData","data","prefix","result","key","Object","prototype","hasOwnProperty","call","fullPath","assign","unflattenData","path","keys","split","current","i","length","lastKey","hasNestedData","deepEqual","a","b","every","item","index","keysA","keysB","StandardValidator","constructor","Error","validate","input","schema","issues","validateField","fieldName","filterFieldIssues","validateCustom","customValidator","validateFieldCustom","validateAll","standardIssues","customIssues","s","c","Promise","all","validateFieldAll","fieldParts","fieldIssues","filter","issue","pathKeys","map","Boolean","undefined","Form","Component","g","tracked","void 0","Set","element","ref","owner","args","initialDataSnapshot","uncontrolledData","isValid","errors","isInvalid","isControlled","onChange","validateOn","fieldValidateOn","e","currentData","formErrors","validatorToFormErrors","name","_","rest","n","action","computeDirtyFields","dirty","currentFlat","add","buildFormResultData","handleInput","event","form","currentTarget","HTMLFormElement","dataFrom","resultData","handleSubmit","preventDefault","isLoading","includes","onError","onSubmit","handleReset","restoredData","reset","setComponentTemplate","precompileTemplate","strictMode","scope","on","hash","Field","join","message","existing","push"],"mappings":";;;;;;;;;;;;AAAA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,SAASA,aAAaA,CAACC,KAAc,EAAoC;AACvE,EAAA,OACEA,KAAK,KAAK,IAAI,IACd,OAAOA,KAAK,KAAK,QAAQ,IACzB,CAACC,KAAK,CAACC,OAAO,CAACF,KAAK,CAAC,IACrB,EAAEA,KAAK,YAAYG,IAAI,CAAC,IACxB,EAAEH,KAAK,YAAYI,IAAI,CAAC,IACxB,EAAEJ,KAAK,YAAYK,QAAQ,CAAC;AAEhC;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASC,WAAWA,CACzBC,IAA6B,EAC7BC,MAAM,GAAG,EAAE,EACQ;EACnB,MAAMC,MAAyB,GAAG,EAAE;AAEpC,EAAA,KAAK,MAAMC,GAAG,IAAIH,IAAI,EAAE;AACtB,IAAA,IAAI,CAACI,MAAM,CAACC,SAAS,CAACC,cAAc,CAACC,IAAI,CAACP,IAAI,EAAEG,GAAG,CAAC,EAAE;AACpD,MAAA;AACF,IAAA;AAEA,IAAA,MAAMV,KAAK,GAAGO,IAAI,CAACG,GAAG,CAAC;IACvB,MAAMK,QAAQ,GAAGP,MAAM,GAAG,CAAA,EAAGA,MAAM,CAAA,CAAA,EAAIE,GAAG,CAAA,CAAE,GAAGA,GAAG;AAElD,IAAA,IAAIX,aAAa,CAACC,KAAK,CAAC,EAAE;A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C,MAAMxC,IAAI,CAACK,MAAM,KAAK,CAAA,EAAG;AAE5C;AACA,IAAA,MAAMoC,QAAA,GAAWD,MAAMxC,IAAI,CACxB0C,GAAG,CAAEV,CAAA,IAAO,OAAOA,CAAA,KAAM,YAAY,KAAA,IAASA,CAAA,GAAIA,EAAExC,GAAG,GAAGwC,CAAC,CAAA,CAC3DO,MAAM,CAACI,OAAA,CAAkB;AAE5B,IAAA,MAAMnB,SAAA,GAAYiB,QAAA,CAAS4D,IAAI,CAAC,GAAA,CAAA;AAChC,IAAA,MAAMC,OAAA,GAAU9D,MAAM8D,OAAO;AAE7B;AACA,IAAA,MAAMC,QAAA,GAAWrC,UAAU,CAAC1C,SAAA,CAAU;IACtC,IAAI+E,aAAa3D,SAAA,EAAW;AAC1BsB,MAAAA,UAAU,CAAC1C,UAAU,GAAG8E,OAAA;IAC1B,CAAA,MAAO,IAAIvH,KAAA,CAAMC,OAAO,CAACuH,QAAA,CAAA,EAAW;AAClCA,MAAAA,QAAA,CAASC,IAAI,CAACF,OAAA,CAAA;AAChB,IAAA,CAAA,MAAO;MACLpC,UAAU,CAAC1C,UAAU,GAAG,CAAC+E,QAAA,EAAUD,OAAA,CAAQ;AAC7C,IAAA;AACF,EAAA;AAEA,EAAA,OAAOpC,UAAA;AACT;;;;"}
@@ -1,23 +0,0 @@
1
- import { buildWaiter } from '@ember/test-waiters';
2
-
3
- const waiter = buildWaiter('@frontile/forms:triggerFormInputEvent)');
4
- function triggerFormInputEvent(element) {
5
- if (!element) return;
6
- const waiterToken = waiter.beginAsync();
7
- setTimeout(() => {
8
- let parent = element.parentElement;
9
- while (parent) {
10
- if (parent.tagName === 'FORM') {
11
- parent.dispatchEvent(new Event('input', {
12
- bubbles: true
13
- }));
14
- break;
15
- }
16
- parent = parent.parentElement;
17
- }
18
- waiter.endAsync(waiterToken);
19
- }, 0);
20
- }
21
-
22
- export { triggerFormInputEvent as t };
23
- //# sourceMappingURL=index-6gTa9ocT.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index-6gTa9ocT.js","sources":["../src/utils/index.ts"],"sourcesContent":["import { buildWaiter } from '@ember/test-waiters';\nconst waiter = buildWaiter('@frontile/forms:triggerFormInputEvent)');\n\nfunction triggerFormInputEvent(element?: HTMLElement | null): void {\n if (!element) return;\n const waiterToken = waiter.beginAsync();\n\n setTimeout(() => {\n let parent = element.parentElement;\n while (parent) {\n if (parent.tagName === 'FORM') {\n (parent as HTMLFormElement).dispatchEvent(\n new Event('input', { bubbles: true })\n );\n break;\n }\n parent = parent.parentElement;\n }\n\n waiter.endAsync(waiterToken);\n }, 0);\n}\n\nexport { triggerFormInputEvent };\nexport {\n flattenData,\n unflattenData,\n hasNestedData,\n deepEqual\n} from './nested-data';\n"],"names":["waiter","buildWaiter","triggerFormInputEvent","element","waiterToken","beginAsync","setTimeout","parent","parentElement","tagName","dispatchEvent","Event","bubbles","endAsync"],"mappings":";;AACA,MAAMA,MAAM,GAAGC,WAAW,CAAC,wCAAwC,CAAC;AAEpE,SAASC,qBAAqBA,CAACC,OAA4B,EAAQ;EACjE,IAAI,CAACA,OAAO,EAAE;AACd,EAAA,MAAMC,WAAW,GAAGJ,MAAM,CAACK,UAAU,EAAE;AAEvCC,EAAAA,UAAU,CAAC,MAAM;AACf,IAAA,IAAIC,MAAM,GAAGJ,OAAO,CAACK,aAAa;AAClC,IAAA,OAAOD,MAAM,EAAE;AACb,MAAA,IAAIA,MAAM,CAACE,OAAO,KAAK,MAAM,EAAE;AAC5BF,QAAAA,MAAM,CAAqBG,aAAa,CACvC,IAAIC,KAAK,CAAC,OAAO,EAAE;AAAEC,UAAAA,OAAO,EAAE;AAAK,SAAC,CACtC,CAAC;AACD,QAAA;AACF,MAAA;MACAL,MAAM,GAAGA,MAAM,CAACC,aAAa;AAC/B,IAAA;AAEAR,IAAAA,MAAM,CAACa,QAAQ,CAACT,WAAW,CAAC;EAC9B,CAAC,EAAE,CAAC,CAAC;AACP;;;;"}
@@ -1,23 +0,0 @@
1
- import { buildWaiter } from '@ember/test-waiters';
2
-
3
- const waiter = buildWaiter('@frontile/forms:triggerFormInputEvent)');
4
- function triggerFormInputEvent(element) {
5
- if (!element) return;
6
- const waiterToken = waiter.beginAsync();
7
- requestAnimationFrame(() => {
8
- let parent = element.parentElement;
9
- while (parent) {
10
- if (parent.tagName === 'FORM') {
11
- parent.dispatchEvent(new Event('input', {
12
- bubbles: true
13
- }));
14
- break;
15
- }
16
- parent = parent.parentElement;
17
- }
18
- waiter.endAsync(waiterToken);
19
- });
20
- }
21
-
22
- export { triggerFormInputEvent as t };
23
- //# sourceMappingURL=index-CeaQc-U7.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index-CeaQc-U7.js","sources":["../src/utils/index.ts"],"sourcesContent":["import { buildWaiter } from '@ember/test-waiters';\nconst waiter = buildWaiter('@frontile/forms:triggerFormInputEvent)');\n\nfunction triggerFormInputEvent(element?: HTMLElement | null): void {\n if (!element) return;\n const waiterToken = waiter.beginAsync();\n\n requestAnimationFrame(() => {\n let parent = element.parentElement;\n while (parent) {\n if (parent.tagName === 'FORM') {\n (parent as HTMLFormElement).dispatchEvent(\n new Event('input', { bubbles: true })\n );\n break;\n }\n parent = parent.parentElement;\n }\n\n waiter.endAsync(waiterToken);\n });\n}\n\nexport { triggerFormInputEvent };\nexport {\n flattenData,\n unflattenData,\n hasNestedData,\n deepEqual\n} from './nested-data';\n"],"names":["waiter","buildWaiter","triggerFormInputEvent","element","waiterToken","beginAsync","requestAnimationFrame","parent","parentElement","tagName","dispatchEvent","Event","bubbles","endAsync"],"mappings":";;AACA,MAAMA,MAAM,GAAGC,WAAW,CAAC,wCAAwC,CAAC;AAEpE,SAASC,qBAAqBA,CAACC,OAA4B,EAAQ;EACjE,IAAI,CAACA,OAAO,EAAE;AACd,EAAA,MAAMC,WAAW,GAAGJ,MAAM,CAACK,UAAU,EAAE;AAEvCC,EAAAA,qBAAqB,CAAC,MAAM;AAC1B,IAAA,IAAIC,MAAM,GAAGJ,OAAO,CAACK,aAAa;AAClC,IAAA,OAAOD,MAAM,EAAE;AACb,MAAA,IAAIA,MAAM,CAACE,OAAO,KAAK,MAAM,EAAE;AAC5BF,QAAAA,MAAM,CAAqBG,aAAa,CACvC,IAAIC,KAAK,CAAC,OAAO,EAAE;AAAEC,UAAAA,OAAO,EAAE;AAAK,SAAC,CACtC,CAAC;AACD,QAAA;AACF,MAAA;MACAL,MAAM,GAAGA,MAAM,CAACC,aAAa;AAC/B,IAAA;AAEAR,IAAAA,MAAM,CAACa,QAAQ,CAACT,WAAW,CAAC;AAC9B,EAAA,CAAC,CAAC;AACJ;;;;"}
@@ -1,67 +0,0 @@
1
- const deferred = /* @__PURE__ */new WeakMap();
2
- function deferDecorator(proto, prop, desc) {
3
- let map = deferred.get(proto);
4
- if (!map) {
5
- map = /* @__PURE__ */new Map();
6
- deferred.set(proto, map);
7
- }
8
- map.set(prop, desc);
9
- }
10
- function findDeferredDecorator(target, prop) {
11
- var _a;
12
- let cursor = target.prototype;
13
- while (cursor) {
14
- let desc = (_a = deferred.get(cursor)) == null ? void 0 : _a.get(prop);
15
- if (desc) {
16
- return desc;
17
- }
18
- cursor = cursor.prototype;
19
- }
20
- }
21
- function decorateFieldV2(prototype, prop, decorators, initializer) {
22
- let desc = {
23
- configurable: true,
24
- enumerable: true,
25
- writable: true,
26
- initializer: null
27
- };
28
- if (initializer) {
29
- desc.initializer = initializer;
30
- }
31
- for (let decorator of decorators) {
32
- desc = decorator(prototype, prop, desc) || desc;
33
- }
34
- if (desc.initializer === void 0) {
35
- Object.defineProperty(prototype, prop, desc);
36
- } else {
37
- deferDecorator(prototype, prop, desc);
38
- }
39
- }
40
- function decorateMethodV2(prototype, prop, decorators) {
41
- const origDesc = Object.getOwnPropertyDescriptor(prototype, prop);
42
- let desc = {
43
- ...origDesc
44
- };
45
- for (let decorator of decorators) {
46
- desc = decorator(prototype, prop, desc) || desc;
47
- }
48
- if (desc.initializer !== void 0) {
49
- desc.value = desc.initializer ? desc.initializer.call(prototype) : void 0;
50
- desc.initializer = void 0;
51
- }
52
- Object.defineProperty(prototype, prop, desc);
53
- }
54
- function initializeDeferredDecorator(target, prop) {
55
- let desc = findDeferredDecorator(target.constructor, prop);
56
- if (desc) {
57
- Object.defineProperty(target, prop, {
58
- enumerable: desc.enumerable,
59
- configurable: desc.configurable,
60
- writable: desc.writable,
61
- value: desc.initializer ? desc.initializer.call(target) : void 0
62
- });
63
- }
64
- }
65
-
66
- export { decorateMethodV2 as a, decorateFieldV2 as d, initializeDeferredDecorator as i };
67
- //# sourceMappingURL=runtime-BPCpkOf1-B5Lbloj7.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"runtime-BPCpkOf1-B5Lbloj7.js","sources":["../../../node_modules/.pnpm/decorator-transforms@2.3.0_@babel+core@7.26.7/node_modules/decorator-transforms/dist/runtime-BPCpkOf1.js"],"sourcesContent":["const deferred = /* @__PURE__ */ new WeakMap();\nfunction deferDecorator(proto, prop, desc) {\n let map = deferred.get(proto);\n if (!map) {\n map = /* @__PURE__ */ new Map();\n deferred.set(proto, map);\n }\n map.set(prop, desc);\n}\nfunction findDeferredDecorator(target, prop) {\n var _a;\n let cursor = target.prototype;\n while (cursor) {\n let desc = (_a = deferred.get(cursor)) == null ? void 0 : _a.get(prop);\n if (desc) {\n return desc;\n }\n cursor = cursor.prototype;\n }\n}\nfunction decorateFieldV1(target, prop, decorators, initializer) {\n return decorateFieldV2(target.prototype, prop, decorators, initializer);\n}\nfunction decorateFieldV2(prototype, prop, decorators, initializer) {\n let desc = {\n configurable: true,\n enumerable: true,\n writable: true,\n initializer: null\n };\n if (initializer) {\n desc.initializer = initializer;\n }\n for (let decorator of decorators) {\n desc = decorator(prototype, prop, desc) || desc;\n }\n if (desc.initializer === void 0) {\n Object.defineProperty(prototype, prop, desc);\n } else {\n deferDecorator(prototype, prop, desc);\n }\n}\nfunction decorateMethodV1({ prototype }, prop, decorators) {\n return decorateMethodV2(prototype, prop, decorators);\n}\nfunction decorateMethodV2(prototype, prop, decorators) {\n const origDesc = Object.getOwnPropertyDescriptor(prototype, prop);\n let desc = { ...origDesc };\n for (let decorator of decorators) {\n desc = decorator(prototype, prop, desc) || desc;\n }\n if (desc.initializer !== void 0) {\n desc.value = desc.initializer ? desc.initializer.call(prototype) : void 0;\n desc.initializer = void 0;\n }\n Object.defineProperty(prototype, prop, desc);\n}\nfunction initializeDeferredDecorator(target, prop) {\n let desc = findDeferredDecorator(target.constructor, prop);\n if (desc) {\n Object.defineProperty(target, prop, {\n enumerable: desc.enumerable,\n configurable: desc.configurable,\n writable: desc.writable,\n value: desc.initializer ? desc.initializer.call(target) : void 0\n });\n }\n}\nfunction decorateClass(target, decorators) {\n return decorators.reduce(\n (accum, decorator) => decorator(accum) || accum,\n target\n );\n}\nfunction decoratePOJO(pojo, decorated) {\n for (let [type, prop, decorators] of decorated) {\n if (type === \"field\") {\n decoratePojoField(pojo, prop, decorators);\n } else {\n decorateMethodV2(pojo, prop, decorators);\n }\n }\n return pojo;\n}\nfunction decoratePojoField(pojo, prop, decorators) {\n let desc = {\n configurable: true,\n enumerable: true,\n writable: true,\n initializer: () => {\n var _a;\n return (_a = Object.getOwnPropertyDescriptor(pojo, prop)) == null ? void 0 : _a.value;\n }\n };\n for (let decorator of decorators) {\n desc = decorator(pojo, prop, desc) || desc;\n }\n if (desc.initializer) {\n desc.value = desc.initializer.call(pojo);\n delete desc.initializer;\n }\n Object.defineProperty(pojo, prop, desc);\n}\nconst runtime = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({\n __proto__: null,\n c: decorateClass,\n f: decorateFieldV1,\n g: decorateFieldV2,\n i: initializeDeferredDecorator,\n m: decorateMethodV1,\n n: decorateMethodV2,\n p: decoratePOJO\n}, Symbol.toStringTag, { value: \"Module\" }));\nexport {\n decorateFieldV2 as a,\n decorateMethodV1 as b,\n decorateMethodV2 as c,\n decorateFieldV1 as d,\n decorateClass as e,\n decoratePOJO as f,\n initializeDeferredDecorator as i,\n runtime as r\n};\n//# sourceMappingURL=runtime-BPCpkOf1.js.map\n"],"names":["deferred","WeakMap","deferDecorator","proto","prop","desc","map","get","Map","set","findDeferredDecorator","target","_a","cursor","prototype","decorateFieldV2","decorators","initializer","configurable","enumerable","writable","decorator","Object","defineProperty","decorateMethodV2","origDesc","getOwnPropertyDescriptor","value","call","initializeDeferredDecorator","constructor"],"mappings":"AAuBA,MAAMA,QAAA,sBAGEC,OAAA,EAAA;AAER,SAASC,eACPC,KAAA,EACAC,IAAA,EACAC,IAAA,EACM;AACF,EAAA,IAAAC,GAAA,GAAMN,QAAA,CAASO,GAAA,CAAIJ,KAAK,CAAA;EAC5B,IAAI,CAACG,GAAA,EAAK;AACRA,IAAAA,GAAA,sBAAUE,GAAA,EAAA;AACDR,IAAAA,QAAA,CAAAS,GAAA,CAAIN,KAAA,EAAOG,GAAG,CAAA;AACzB,EAAA;AACIA,EAAAA,GAAA,CAAAG,GAAA,CAAIL,IAAA,EAAMC,IAAI,CAAA;AACpB;AAEA,SAASK,qBAAAA,CACPC,MAAA,EACAP,IAAA,EACwB;AArB1B,EAAA,IAAAQ,EAAA;AAsBE,EAAA,IAAIC,MAAA,GAAkBF,MAAA,CAAeG,SAAA;AACrC,EAAA,OAAOD,MAAA,EAAQ;AACb,IAAA,IAAIR,IAAA,GAAA,CAAOO,EAAA,GAAAZ,QAAA,CAASO,GAAA,CAAIM,MAAM,MAAnB,IAAA,GAAA,MAAA,GAAAD,EAAA,CAAsBL,GAAA,CAAIH,IAAA,CAAA;AACrC,IAAA,IAAIC,IAAA,EAAM;AACD,MAAA,OAAAA,IAAA;AACT,IAAA;IACAQ,MAAA,GAAUA,MAAA,CAAeC,SAAA;AAC3B,EAAA;AACF;AAWA,SAASC,eAAAA,CACPD,SAAA,EACAV,IAAA,EACAY,UAAA,EACAC,WAAA,EACM;AACN,EAAA,IAAIZ,IAAA,GAAmB;AACrBa,IAAAA,YAAA,EAAc,IAAA;AACdC,IAAAA,UAAA,EAAY,IAAA;A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