@bolttech/form-engine 0.13.0 → 0.14.1

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.
@@ -133,7 +133,7 @@ declare type TPathError = Omit<TSchemaValidation, 'path'> & {
133
133
  preventUnMountValidation?: boolean;
134
134
  };
135
135
  export declare type TValidationDateFormats = 'MMDDYYYY' | 'DDMMYYYY' | 'YYYYMMDD' | 'YYYYDDMM' | 'timestamp';
136
- export declare type TValidationDateOperators = '<' | '>' | '===' | '>=' | '<=' | '!==';
136
+ export declare type TValidationDateOperators = '<' | '>' | '===' | '>=' | '<=' | '!==' | '!!origin';
137
137
  export declare type TVAvailableValidationConditionsSet = {
138
138
  forceDefinedOrigin?: boolean;
139
139
  forceDefinedTarget?: boolean;
package/src/index.d.ts CHANGED
@@ -1,3 +1,3 @@
1
1
  export type { TComponent, TField, TSchema, TFormRefActions, TFormValues, THookPayload, TEventsKeys, TObserverData, TScope, } from './core/types';
2
- export { TAvailableHooks, CoreEvents, ALL_NAMESPACE_EVENTS, BUILD_EVENT } from '@core';
2
+ export { TAvailableHooks, CoreEvents, ALL_NAMESPACE_EVENTS, BUILD_EVENT, } from './core';
3
3
  export { Form, FormProvider, useForm, asFormField } from './adapters/react';
package/types.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sources":["../../../libs/form-engine/src/core/types/index.ts"],"sourcesContent":["import { ICustomValidationValue } from '@core/apis/validations';\nimport { EEVents } from '@core/constants';\nimport { TEventInformation } from '@core/events';\nimport Field from \"@core/managers/Field\";\n\nexport type TObserverData<T> = {\n data: any;\n event: TEventsKeys;\n namespace: string;\n payload: T;\n};\n\nexport type TObservable = (data: any, unsubscribe: () => void) => any;\n\nexport type TEvents = Record<string, TObservable[]>;\n\nexport interface IObservable {\n events: TEvents;\n}\n\nexport type TScopeNamespaces =\n | 'global'\n | 'api'\n | 'hooks'\n | 'fields'\n | 'configs';\n\nexport type TSetGlobalScope = {\n namespace: TScopeNamespaces;\n key?: string;\n data: any;\n merge?: boolean;\n};\nexport type TScope = {\n global?: any;\n api?: any;\n hooks?: any;\n configs?: TConfigs & {\n disable?: boolean;\n enableLogging?: boolean;\n };\n fields?: any;\n};\n\nexport type TFactoryOptions = {\n schema?: TSchema;\n initialScope?: TScope;\n initialValues?: Record<string, any>;\n newInstance?: boolean;\n group?: string;\n};\n\nexport type TMapper = Record<string, Record<string, unknown>>;\n\nexport type TMaskGeneric = {\n to: number;\n from: number;\n mask: string;\n}[];\n\ntype TCurrencyMask = {\n locale: string;\n currency: string;\n};\n\nexport type TComponentMasks = {\n generic?: TMaskGeneric;\n cardNumber?: boolean;\n hideCardNumber?: boolean;\n cardMask?: boolean;\n cardDate?: boolean;\n currencyMask?: TCurrencyMask;\n feinMask?: boolean;\n replaceAll?: string | number;\n callback?(value: string | number): string | number;\n};\n\ntype TFormMessages = Record<\n string,\n { name: string; value?: any; values?: string[]; required?: boolean }\n>;\n\nexport type TChildrenOptions = {\n childrenScope?: string[];\n blurredChildren?: string[];\n changedChildren?: string[];\n scopeBlurredChildren?: boolean;\n scopeChangedChildren?: boolean;\n};\n\nexport type TFieldData = Record<string, TField>;\nexport type TFields = { [x in string]: Field };\n\nexport type TSubmitValueData = Record<string, {\n value?: unknown,\n props?: Record<string,unknown>,\n}>\n\nexport type TFormRefActions = {\n submit(): void;\n step(index: number | string): TFormValues;\n stepForward(index?: number | string): TFormValues;\n stepBack(index?: number | string): TFormValues;\n validateForm(opts?: TChildrenOptions): Promise<TFormValues>;\n bindFields(payload: TSubmitValueData): void;\n values(\n opts: Pick<\n TChildrenOptions,\n 'scopeBlurredChildren' | 'scopeChangedChildren' | 'childrenScope'\n >,\n ): TFormValues;\n};\n\nexport type THookPayload = {\n setScope(data: TSetGlobalScope): void;\n};\n\nexport type THooks = {\n preMount?: () => Record<string, unknown>;\n preUnmount?: () => Record<string, unknown>;\n preSubmit?: (formData: TFormValues) => Record<string, unknown>;\n posSubmit?: (formData: TFormValues) => Record<string, unknown>;\n};\n\nexport type TIVars = Record<string, unknown>;\n\nexport type TEventsKeys = keyof typeof EEVents;\nexport enum TAvailableHooks {\n 'preMount' = 'preMount',\n 'preUnmount' = 'preUnmount',\n 'preSubmit' = 'preSubmit',\n 'postSubmit' = 'postSubmit',\n}\nexport type TField = {\n value?: string | number | boolean;\n errors?: TErrors;\n visible?: boolean;\n failedErrorMessages?: string[];\n mask?: string;\n changed?: boolean;\n keyup?: boolean;\n keydown?: boolean;\n blured?: boolean;\n focused?: boolean;\n name: string;\n mounted: boolean;\n metadata?: any;\n ignore?: boolean;\n schemaLocation?: {\n step: number;\n depth: number;\n index: number;\n };\n};\n\ntype TPathError = Omit<TSchemaValidation, 'path'> & {\n path?: string;\n paths?: string[];\n preventUnMountValidation?: boolean;\n};\n\nexport type TValidationDateFormats =\n | 'MMDDYYYY'\n | 'DDMMYYYY'\n | 'YYYYMMDD'\n | 'YYYYDDMM'\n | 'timestamp';\nexport type TValidationDateOperators = '<' | '>' | '===' | '>=' | '<=' | '!==';\n\nexport type TVAvailableValidationConditionsSet = {\n forceDefinedOrigin?: boolean;\n forceDefinedTarget?: boolean;\n origin?: string | number | boolean;\n condition: TValidationDateOperators;\n target?: string | number | boolean;\n};\n\nexport type TVAvailableValidationConditions = {\n rule: 'and' | 'or';\n set: TVAvailableValidationConditionsSet[];\n conditions?: TVAvailableValidationConditions;\n};\n\nexport type TVAvailableValidationMultipleValidations = {\n rule: 'AND' | 'OR' | 'NOT';\n validations: TVAvailableValidations;\n};\n\nexport type TVAvailableValidations = {\n /**\n * The bool function is a validation function that checks if a given value indicating whether the validation has failed or not.\n *\n * @example - in a test environment\n * ```\n * const result = bool({\n * validationValue: false,\n * });\n * console.log(result); // { fail: false }\n * ```\n *\n * @example - real json usage with field value\n * ```\n * {\n * validations: {\n * bool: '${fields.input.value}'\n * },\n * },\n * ```\n *\n * @example - real json usage with iVar value\n * ```\n * {\n * validations: {\n * bool: '${global.validation}'\n * },\n * },\n * ```\n */\n bool?: string | boolean;\n /**\n * Validation based on conditions\n *\n * @example - Compare own field to two. Origin and target default to field value\n * ```\n * conditions: {\n * rule: 'and',\n * set: [\n * {\n * condition: '===',\n * target: '2',\n * },\n * {\n * origin: '2',\n * condition: '===',\n * },\n * ],\n * },\n * ```\n * @example - Binded to Postcode field value. Must be greater than or equal two\n * ```\n * conditions: {\n * rule: 'or',\n * set: [\n * {\n * origin: '${fields.postcode.value}',\n * condition: '>',\n * target: '2',\n * },\n * {\n * origin: '${fields.postcode.value}',\n * condition: '===',\n * target: '2',\n * },\n * ],\n * },\n * ```\n * @example - Binded to Postcode field value. Must be equal to two\n * ```\n * conditions: {\n * rule: 'or',\n * set: [\n * {\n * origin: '${fields.postcode.value}',\n * condition: '===',\n * target: '2',\n * },\n * ],\n * },\n * ```\n */\n conditions?: TVAvailableValidationConditions;\n /**\n * Applies multiple validations on the given value based on the specified truth table rule.\n *\n * @param {Object} TVAvailableValidationMultipleValidations - The multiple validations object param.\n * @param {'AND' | 'OR' | 'NOT'} TVAvailableValidationMultipleValidations.rule - The rule to be applied based of truth table ('AND', 'OR', or 'NOT').\n * @param {Object} TVAvailableValidationMultipleValidations.validations - Object containing validation rules.\n *\n * @example - Validating with the expression AND where current field must have a value of 'yes' and input 2 must have a value of 'no'\n * ```\n * multipleValidations: {\n * rule: 'AND',\n * validations: {\n * value: 'yes',\n * conditions: {\n * rule: 'and',\n * set: [\n * {\n * origin: '${fields.input2.value}',\n * condition: '===',\n * target: 'no'\n * },\n * ],\n * },\n * },\n * },\n * ```\n * @example - Validating with the expression OR where current field must have a value of '1995-12-12' or be a valid date with regex\n * ```\n * multipleValidations: {\n * rule: 'OR',\n * validations: {\n * value: '1995-12-12',\n * regex: '^\\d{4}-\\d{2}-\\d{2}$',\n * },\n * },\n * ```\n * @example - Validating with the expression NOT where current field doesn't have a value of '1995-12-12' and not be a valid date with regex\n * ```\n * multipleValidations: {\n * rule: 'NOT',\n * validations: {\n * value: '1995-12-12',\n * regex: '^\\d{4}-\\d{2}-\\d{2}$',\n * },\n * },\n * ```\n */\n multipleValidations?: TVAvailableValidationMultipleValidations;\n /**\n * Between validations\n *\n * @example - Between ages\n * ``` type teste = Pick<TVAvailableValidations, 'date'>\n * between: {\n * dates: [\n * {\n * operator: '>=',\n * origin: {\n * format: 'YYYYMMDD',\n * intervals: {\n * years: 18,\n * },\n * },\n * },\n * {\n * operator: '<=',\n * origin: {\n * format: 'YYYYMMDD',\n * intervals: {\n * years: 75,\n * },\n * },\n * }\n * ]\n * }\n * ```\n *\n * @example - Between numbers\n * ```\n * between: {\n * start: '3',\n * end: '4',\n * isIncludedBoundaries: true\n * },\n * ```\n *\n */\n between?: {\n /**\n * Array of date validations. To make it possible, ensure that the conditions is > and < in both date validations.\n */\n dates?: TVAvailableValidations['date'][];\n /**\n * The first number of the validation. If the current value is grater than this number, the validation will pass.\n */\n start?: number;\n /**\n * The second number of the validation. If the current value is lower than this number, the validation will pass.\n */\n end?: number;\n /**\n * If it's true, the comparision is transformed to >= and <=. So, the numbers that were passed are included in the validation.\n */\n isIncludedBoundaries?: boolean;\n };\n /**\n * Dates validations\n *\n * @example - Dates should be different\n * ```\n * date: {\n * operator: '!==',\n * origin: {\n * format: 'DDMMYYYY',\n * },\n * target: {\n * format: 'DDMMYYYY',\n * value: '10/10/2001',\n * },\n * },*\n * ```\n *\n * @example - Compare only valid dates using intervals\n * ```\n * date: {\n * onlyValidDate: true,\n * operator: '<',\n * origin: {\n * format: 'DD/MM/YYYY',\n * intervals: {\n * years: 1,\n * },\n * },\n * },\n * ```\n *\n * @example - Should have at max 85 years\n * ```\n * {\n * operator: '>',\n * origin: {\n * format: 'DDMMYYYY',\n * value: eightyFiveYearsDate,\n * intervals: {\n * years: 85,\n * },\n * },\n * }\n * }\n *\n * ```\n */\n date?: {\n /**\n * Flag to force only valid dates. Valid dates must be of min length of 8\n */\n onlyValidDate?: boolean;\n /**\n * List of operations you can do\n * - between origin and target dates\n * - between origin and intervals\n */\n operator: TValidationDateOperators;\n /**\n * The origin configurations\n */\n origin: {\n /**\n * Origin date value\n */\n value?: string | number;\n /**\n * The available date formats\n */\n format: TValidationDateFormats;\n /**\n * Intervals to compare with the original date.\n *\n * It will use todays date for comparison.\n *\n * @example\n *\n * origin date = 10/10/2022\n * interval.year = 1\n * operator = '==='\n *\n * It will compare (10/10/2022 + 1) with the current date and check if they are the same\n */\n intervals?: {\n years?: number;\n months?: number;\n days?: number;\n };\n };\n target?: {\n value: string | number;\n format: TValidationDateFormats;\n };\n };\n\n /**\n * Allow to validate if the input string is a valid date format\n */\n validDate?: TValidationDateFormats;\n\n /**\n * Allow to define a maximum length for the input to have no error\n */\n length?: number;\n\n /**\n * Will look into the input length and send an error if is not greater than this value\n */\n greaterThan?: number | string;\n\n /**\n * Specifies a regular expression pattern that the value should match.\n */\n regex?: string;\n\n /**\n * Specifies the maximum length of the value (if it's a string).\n */\n maxLength?: number;\n\n /**\n * Specifies the minimum length of the value (if it's a string).\n */\n minLength?: number;\n\n /**\n * Specifies whether the field is required.\n */\n required?: boolean;\n\n /**\n * Specifies that the value should contain only letters.\n */\n onlyLetters?: boolean;\n\n /**\n * Specifies a value that the field should match.\n */\n value?: string | number | boolean;\n\n /**\n * Specifies that the field should not be empty.\n */\n notEmpty?: boolean;\n\n /**\n * A callback function that performs custom validation on the value.\n * @param value - The value to be validated.\n * @returns An object with validation results.\n */\n callback?(value: string | number): { fail: boolean; errorMessage?: string };\n\n /**\n * Specifies a numeric range for the value.\n */\n numericRange?: { start: number | string; end: number | string };\n\n /**\n * Specifies whether the value should be a number.\n */\n isNumber?: boolean;\n\n /**\n * Specifies that the field should not have extra spaces.\n */\n hasNoExtraSpaces?: boolean;\n\n /**\n * Specifies that the value should be an email address.\n */\n email?: boolean;\n\n /**\n * Specifies that the value should be less than a given number or string.\n */\n lessThan?: number | string;\n\n /**\n * Specifies that the value should be a sequential number.\n */\n sequentialNumber?: boolean;\n\n /**\n * Specifies that the value should not contain repeated numbers.\n */\n repeatedNumbers?: boolean;\n\n /**\n * Specifies that the value should be a URL.\n */\n url?: boolean;\n\n /**\n * Specifies a path error type.\n */\n path?: TPathError;\n\n /**\n * Specifies that the value should be a valid credit card number.\n */\n isCreditCard?: string[];\n\n /**\n * Specifies that the value should be a valid credit card number with a specific length.\n */\n isCreditCardAndLength?: string[];\n\n /**\n * Specifies that the value should match a credit card code with available options.\n */\n isCreditCodeMatch?: { numberCard: string; availableOptions: string[] };\n\n /**\n * Specifies custom validation options for the field.\n */\n customValidation?: ICustomValidationValue[];\n\n /**\n * Specifies that spaces are not allowed in the field.\n */\n notAllowSpaces?: true;\n\n /**\n * Specifies that the value should be in a predefined list of values.\n */\n isInTheList?: string[] | number[] | string;\n\n /**\n * Specifies field validation rules for nested fields.\n */\n fields?: {\n /**\n * The rule for validating nested fields (e.g., 'every').\n */\n rule: 'every';\n\n /**\n * An array of nested field validation configurations.\n */\n set: {\n /**\n * The binding for the nested field.\n */\n bind: string;\n\n /**\n * The field name for the nested field.\n */\n fieldName: string;\n\n /**\n * Validation options for the nested field, excluding the 'fields' property.\n */\n validations: Omit<TVAvailableValidations, 'fields'>;\n }[];\n };\n\n /**\n * Specifies that the value should be existed.\n */\n exists?: string | number;\n};\n\nexport type TGenericValidationRule = {\n [key: string]: TVAvailableValidations;\n};\n\nexport type TSchemaValidation = TVAvailableValidations | TGenericValidationRule;\n\nexport type TStepData = {\n navigated: boolean;\n index: number;\n data: Record<\n number,\n Pick<\n TFormValues,\n 'fields' | 'erroredFields' | 'formatted' | 'filteredFields'\n >\n >;\n currentStepSchema?: TComponent;\n isValid: boolean;\n numSteps?: number;\n};\n\nexport type TFormValues = {\n predictableErroredFields: string[];\n erroredFields: string[];\n fields: TFieldData;\n formatted: Record<string, unknown>;\n filteredFields?: Record<string, unknown>;\n form: {\n steps: TStepData;\n isValid: boolean;\n messages: string[];\n scope: TScope;\n };\n};\n\nexport type TError = {\n value: unknown;\n message?: string;\n fail: boolean;\n};\n\nexport type TErrors = Record<string, TError> | undefined;\n\n// TODO - object with the available errors has props\nexport type TErrorMessages = Record<string, string>;\n\nexport type TSchemaValidations = TSchemaHandler<TSchemaValidation>;\n\ntype TFormLevelSchemaHandler<T> = Partial<\n Record<\n | EEVents.AFTER_FIELD_API_CALL\n | EEVents.ON_FIELD_CHANGE\n | EEVents.ON_FIELD_KEYUP\n | EEVents.ON_FIELD_KEYDOWN\n | EEVents.ON_FORM_REHYDRATE\n | EEVents.ON_FORM_MOUNT\n | EEVents.ON_SCOPE_CHANGE,\n T\n >\n>;\n\ntype TSchemaHandler<T> = Partial<\n Record<\n | EEVents.AFTER_FIELD_API_CALL\n | EEVents.ON_FIELD_REHYDRATE\n | EEVents.ON_FIELD_CLEARED\n | EEVents.ON_FIELD_BINDED\n | EEVents.ON_FIELD_CHANGE\n | EEVents.ON_FIELD_KEYUP\n | EEVents.ON_FIELD_KEYDOWN\n | EEVents.ON_FIELD_BLUR\n | EEVents.ON_FIELD_MOUNT\n | EEVents.ON_FIELD_FOCUS\n | EEVents.ON_FIELD_CLICK,\n T\n >\n>;\n\nexport type TSchemaVisibilityConditions = {\n /**\n * Enables visibility of fields only if any or all validation conditions are positive.\n *\n * The default is false, so if all validations are false, the field will display, if any are positive,\n * the field will hide, as well as if all are positive.\n */\n showOnlyIfTrue?: boolean;\n /**\n * Allows you to choose the type of chain for validations.\n *\n * The default is OR, where at least one validation needs to be true to work. In the case of AND,\n * all validations must be true.\n */\n rule?: 'or' | 'and';\n /**\n * The validations that will say if the target field will be visible or not\n *\n * Those validations will run against your field (the one that has this directive)\n */\n validations: TSchemaValidation;\n /**\n * Target field that will have the visibility toggled\n */\n fieldName?: string;\n /**\n * Target fields that will have the visibility toggled\n */\n fieldNames?: string[];\n}[];\n\nexport type TClearFieldValue = string | number | boolean;\n\nexport type TClearField = {\n /**\n * The clearValues runs validations on the target field and not on the field it is declaring.\n * Therefore, set this prop with true if you want validations to be performed on the current field.\n */\n useCurrentFieldValidation?: boolean;\n /**\n * Validations to run for the target field\n */\n validations?: TSchemaValidation | TSchemaValidation[];\n /**\n * target fields that will be used in the validation specified\n */\n fields: string[];\n /**\n * The cleared values on the fields in case they do not pass the validation\n */\n clearedValue: TClearFieldValue | TClearFieldValue[];\n /**\n * The cleared props from each component field on target fields array\n */\n clearedProps?: Record<string, unknown> | Record<string, unknown>[];\n /**\n * The cleared values on the fields in case they do pass the validation\n */\n defaultClearedValue?: TClearFieldValue | TClearFieldValue[];\n /**\n * The cleared props from each component field on target fields array if they pass validation\n */\n defaultClearedProps?: Record<string, unknown> | Record<string, unknown>[];\n};\n\nexport type TSchemaClearFields = TClearField[];\n\nexport type TSchemaApi = {\n /**\n * Specify a debounce time in miliseconds for your call\n */\n debounceTime?: number;\n method: 'GET' | 'POST' | 'PUT' | 'PATCH';\n url: string;\n headers?: HeadersInit | undefined;\n body?: Record<string, any>;\n fieldValueAsParams?: Record<string, string>;\n fieldValueAsPathParams?: string[];\n scope?: string;\n blockRequestWhenInvalid?: boolean;\n preConditions?: TSchemaValidation;\n}[];\n\nexport type TSchemaMasks = { cleanMask?: boolean } & TComponentMasks;\n\nexport type TFormEventDirectives = {\n visibilityConditions: TSchemaVisibilityConditions;\n};\n\nexport type TComponent = {\n /**\n * This name will be used later to correlate the field with the value, and you will be able to read it.\n *\n * You can also mount here complex objects like\n *\n * name={a.b.c}\n *\n * that will result in\n * a: {\n * b: {\n * c: 'field_value'\n * }\n * }\n */\n name: string;\n /**\n * A component name that should map to the one you gave in the form mappings\n *\n * @example - For React\n * ```\n * const mappings: TMapper = {\n * input: { component: Input },\n * formGroup: { component: FormGroup },\n * };\n * ```\n *\n * The component name for the Input element will be \"input\" ending up like\n * ```\n * {\n * component: 'input'\n * }\n * ```\n */\n component: string;\n /**\n * You can attach metadata to your component that will be forwarded to you after on your frontend\n * callback methods link `onData`, `onBlur` etc\n */\n metadata?: Record<string, any>;\n /**\n * This property allows you to specify a virtual fieldName that can be in several fields\n *\n * USAGE - You have two fields but you want to have the value stored only under one name\n *\n */\n group?: string;\n wrapper?: new () => React.Component;\n children?: TComponent[];\n /**\n * Field error messages in case any validation fails\n *\n * @example - Set a default error message for all the validations\n *\n * ```\n * {\n * errorMessages: {\n * default: 'default error message'\n * }\n * }\n * ```\n *\n * @example - Set error message for a given validation\n *\n * ```\n * {\n * validations: {\n * ON_FIELD_CHANGE: {\n * required: true\n * }\n * },\n * errorMessages: {\n * required: 'This field is required'\n * }\n * }\n * ```\n *\n */\n errorMessages?: TErrorMessages;\n type?: 'text' | 'number' | string;\n /**\n * Allow you to set a initial state for this field\n */\n state?: {\n /**\n * Hide the field\n */\n hidden?: boolean;\n /**\n * Ignore value from field\n */\n ignoreValue?: boolean;\n };\n /**\n * This key lets you inject props directly into the component\n */\n props?: Record<string, unknown>;\n /**\n * Setup validations to be used in the field.\n *\n * You can setup validations in several life-cycle methods\n *\n * @example - Required validation\n * ```\n * validations: {\n ON_FIELD_CHANGE: {\n required: true,\n },\n },\n * ```\n */\n validations?: TSchemaHandler<\n Pick<TEventReducedSchema, 'validations'>['validations']\n >;\n /**\n * Filters the component value based on a validation.\n */\n filter?: Pick<TEventReducedSchema, 'validations'>['validations'];\n /**\n * Allows you to specify the conditions a given field will be visible\n * what will run when this field meets the specified life-cycle\n */\n visibilityConditions?: Omit<\n TSchemaHandler<\n Pick<TEventReducedSchema, 'visibilityConditions'>['visibilityConditions']\n >,\n 'ON_FIELD_REHYDRATE' | 'ON_FIELD_CLEARED' | 'ON_FIELD_FOCUS'\n >;\n /**\n * Will clear target fields in case they do not pass with the specified validations\n */\n clearFields?: Omit<\n TSchemaHandler<Pick<TEventReducedSchema, 'clearFields'>['clearFields']>,\n 'ON_FIELD_REHYDRATE' | 'ON_FIELD_CLEARED' | 'ON_FIELD_FOCUS'\n >;\n /**\n * Allows you to make api calls using events emitted by the component.\n */\n api?: Omit<\n TSchemaHandler<Pick<TEventReducedSchema, 'api'>['api']>,\n 'ON_FIELD_REHYDRATE' | 'ON_FIELD_FOCUS' | 'AFTER_FIELD_API_CALL'\n >;\n /**\n * Allows you to display the value of the masked component by events\n */\n masks?: Partial<\n Record<\n | EEVents.ON_FIELD_BLUR\n | EEVents.ON_FIELD_MOUNT\n | EEVents.ON_FIELD_FOCUS\n | EEVents.ON_FIELD_CHANGE\n | EEVents.ON_FIELD_KEYUP\n | EEVents.ON_FIELD_KEYDOWN,\n Pick<TEventReducedSchema, 'masks'>['masks']\n >\n >;\n /**\n * Allows you to format the value that the field will receive for each event issuance\n */\n formatters?: Omit<\n TSchemaHandler<Pick<TEventReducedSchema, 'formatters'>['formatters']>,\n 'ON_FIELD_REHYDRATE' | 'ON_FIELD_FOCUS'\n >;\n};\n\nexport type TEventReducedSchema = {\n api: TSchemaApi;\n clearFields: TSchemaClearFields;\n formatters: TSchemaFormatters;\n masks: TSchemaMasks;\n validations: TSchemaValidation;\n visibilityConditions: TSchemaVisibilityConditions;\n};\n\nexport type TStep = {\n component: string;\n name: string;\n children: TComponent[];\n props?: Record<string, string>;\n};\n\nexport type TComponentPropsMapping = {\n getValue?: string;\n setValue?: string;\n onBlur?: string;\n onClick?: string;\n onFocus?: string;\n onKeyUp?: string;\n onKeyDown?: string;\n setErrorMessage?: string;\n setErrorState?: string;\n};\n\nexport type TPropsMapping = Record<string, TComponentPropsMapping>;\n\nexport type TSchema = {\n /**\n * Used to disable form submit input and prevent to submit form using enter event.\n * Default is false.\n */\n disableFormSubmit?: boolean;\n action?: string;\n method?: string;\n /**\n * Give some configurations to the form\n */\n configs?: TConfigs;\n /**\n * Allows you to expose some messages to the outside world when something happen\n */\n messages?: TFormMessages;\n /**\n * Specify some static field defaults before rendereing the form.\n *\n * If you have initialValues in the frontend setted, those will ovewride this\n */\n formattedDataDefaults?: Record<string, unknown>;\n /**\n * Form level props mapping\n */\n propsMapping?: TPropsMapping;\n visibilityConditions?: TFormLevelSchemaHandler<TSchemaVisibilityConditions>;\n /**\n * Entry point for the form should be a step (even if you have only one)\n */\n components: TStep[];\n /**\n * You can have many fields in the form, but be interested only in some\n *\n * You can put here the fields you want to read onSubmit for example\n *\n * You will receive those in TFormValues.filteredFields\n */\n filteredFields?: string[];\n /**\n * Schema level iVars.\n *\n * These iVars will go to the global scope namespace\n */\n iVars?: TIVars;\n};\n\nexport type TSplitterFormatterValue = {\n value: string;\n position: number;\n}[];\n\nexport type TSchemaFormatters = {\n splitter?: TSplitterFormatterValue;\n capitalize?: boolean;\n upperCase?: boolean;\n gapsCreditCard?: string[];\n onlyNumbers?: boolean;\n onlyLetters?: boolean;\n regex?: string;\n callback?(value: string | number): string | number;\n};\n\nexport type TConfigs = {\n observables?: { templates?: { exclude?: string[] } };\n};\n\nexport type TFlowType = {\n [x: string]: {\n events: (component?: TComponent) => EEVents[];\n handler: (args: TEventInformation<unknown>) => void;\n }[];\n};\n"],"names":["TAvailableHooks"],"mappings":"aA+HA,IAAYA,yDAAAA,QAKXA,qBAAA,GALWA,EAAAA,QAAeA,kBAAfA,wBAKX,CAAA,IAJC,SAAA,WACAA,EAAA,WAAA,aACAA,EAAA,UAAA,YACAA,EAAA,WAAA"}
1
+ {"version":3,"file":"types.js","sources":["../../../libs/form-engine/src/core/types/index.ts"],"sourcesContent":["import { ICustomValidationValue } from '@core/apis/validations';\nimport { EEVents } from '@core/constants';\nimport { TEventInformation } from '@core/events';\nimport Field from \"@core/managers/Field\";\n\nexport type TObserverData<T> = {\n data: any;\n event: TEventsKeys;\n namespace: string;\n payload: T;\n};\n\nexport type TObservable = (data: any, unsubscribe: () => void) => any;\n\nexport type TEvents = Record<string, TObservable[]>;\n\nexport interface IObservable {\n events: TEvents;\n}\n\nexport type TScopeNamespaces =\n | 'global'\n | 'api'\n | 'hooks'\n | 'fields'\n | 'configs';\n\nexport type TSetGlobalScope = {\n namespace: TScopeNamespaces;\n key?: string;\n data: any;\n merge?: boolean;\n};\nexport type TScope = {\n global?: any;\n api?: any;\n hooks?: any;\n configs?: TConfigs & {\n disable?: boolean;\n enableLogging?: boolean;\n };\n fields?: any;\n};\n\nexport type TFactoryOptions = {\n schema?: TSchema;\n initialScope?: TScope;\n initialValues?: Record<string, any>;\n newInstance?: boolean;\n group?: string;\n};\n\nexport type TMapper = Record<string, Record<string, unknown>>;\n\nexport type TMaskGeneric = {\n to: number;\n from: number;\n mask: string;\n}[];\n\ntype TCurrencyMask = {\n locale: string;\n currency: string;\n};\n\nexport type TComponentMasks = {\n generic?: TMaskGeneric;\n cardNumber?: boolean;\n hideCardNumber?: boolean;\n cardMask?: boolean;\n cardDate?: boolean;\n currencyMask?: TCurrencyMask;\n feinMask?: boolean;\n replaceAll?: string | number;\n callback?(value: string | number): string | number;\n};\n\ntype TFormMessages = Record<\n string,\n { name: string; value?: any; values?: string[]; required?: boolean }\n>;\n\nexport type TChildrenOptions = {\n childrenScope?: string[];\n blurredChildren?: string[];\n changedChildren?: string[];\n scopeBlurredChildren?: boolean;\n scopeChangedChildren?: boolean;\n};\n\nexport type TFieldData = Record<string, TField>;\nexport type TFields = { [x in string]: Field };\n\nexport type TSubmitValueData = Record<string, {\n value?: unknown,\n props?: Record<string,unknown>,\n}>\n\nexport type TFormRefActions = {\n submit(): void;\n step(index: number | string): TFormValues;\n stepForward(index?: number | string): TFormValues;\n stepBack(index?: number | string): TFormValues;\n validateForm(opts?: TChildrenOptions): Promise<TFormValues>;\n bindFields(payload: TSubmitValueData): void;\n values(\n opts: Pick<\n TChildrenOptions,\n 'scopeBlurredChildren' | 'scopeChangedChildren' | 'childrenScope'\n >,\n ): TFormValues;\n};\n\nexport type THookPayload = {\n setScope(data: TSetGlobalScope): void;\n};\n\nexport type THooks = {\n preMount?: () => Record<string, unknown>;\n preUnmount?: () => Record<string, unknown>;\n preSubmit?: (formData: TFormValues) => Record<string, unknown>;\n posSubmit?: (formData: TFormValues) => Record<string, unknown>;\n};\n\nexport type TIVars = Record<string, unknown>;\n\nexport type TEventsKeys = keyof typeof EEVents;\nexport enum TAvailableHooks {\n 'preMount' = 'preMount',\n 'preUnmount' = 'preUnmount',\n 'preSubmit' = 'preSubmit',\n 'postSubmit' = 'postSubmit',\n}\nexport type TField = {\n value?: string | number | boolean;\n errors?: TErrors;\n visible?: boolean;\n failedErrorMessages?: string[];\n mask?: string;\n changed?: boolean;\n keyup?: boolean;\n keydown?: boolean;\n blured?: boolean;\n focused?: boolean;\n name: string;\n mounted: boolean;\n metadata?: any;\n ignore?: boolean;\n schemaLocation?: {\n step: number;\n depth: number;\n index: number;\n };\n};\n\ntype TPathError = Omit<TSchemaValidation, 'path'> & {\n path?: string;\n paths?: string[];\n preventUnMountValidation?: boolean;\n};\n\nexport type TValidationDateFormats =\n | 'MMDDYYYY'\n | 'DDMMYYYY'\n | 'YYYYMMDD'\n | 'YYYYDDMM'\n | 'timestamp';\nexport type TValidationDateOperators = '<' | '>' | '===' | '>=' | '<=' | '!==' | '!!origin';\n\nexport type TVAvailableValidationConditionsSet = {\n forceDefinedOrigin?: boolean;\n forceDefinedTarget?: boolean;\n origin?: string | number | boolean;\n condition: TValidationDateOperators;\n target?: string | number | boolean;\n};\n\nexport type TVAvailableValidationConditions = {\n rule: 'and' | 'or';\n set: TVAvailableValidationConditionsSet[];\n conditions?: TVAvailableValidationConditions;\n};\n\nexport type TVAvailableValidationMultipleValidations = {\n rule: 'AND' | 'OR' | 'NOT';\n validations: TVAvailableValidations;\n};\n\nexport type TVAvailableValidations = {\n /**\n * The bool function is a validation function that checks if a given value indicating whether the validation has failed or not.\n *\n * @example - in a test environment\n * ```\n * const result = bool({\n * validationValue: false,\n * });\n * console.log(result); // { fail: false }\n * ```\n *\n * @example - real json usage with field value\n * ```\n * {\n * validations: {\n * bool: '${fields.input.value}'\n * },\n * },\n * ```\n *\n * @example - real json usage with iVar value\n * ```\n * {\n * validations: {\n * bool: '${global.validation}'\n * },\n * },\n * ```\n */\n bool?: string | boolean;\n /**\n * Validation based on conditions\n *\n * @example - Compare own field to two. Origin and target default to field value\n * ```\n * conditions: {\n * rule: 'and',\n * set: [\n * {\n * condition: '===',\n * target: '2',\n * },\n * {\n * origin: '2',\n * condition: '===',\n * },\n * ],\n * },\n * ```\n * @example - Binded to Postcode field value. Must be greater than or equal two\n * ```\n * conditions: {\n * rule: 'or',\n * set: [\n * {\n * origin: '${fields.postcode.value}',\n * condition: '>',\n * target: '2',\n * },\n * {\n * origin: '${fields.postcode.value}',\n * condition: '===',\n * target: '2',\n * },\n * ],\n * },\n * ```\n * @example - Binded to Postcode field value. Must be equal to two\n * ```\n * conditions: {\n * rule: 'or',\n * set: [\n * {\n * origin: '${fields.postcode.value}',\n * condition: '===',\n * target: '2',\n * },\n * ],\n * },\n * ```\n */\n conditions?: TVAvailableValidationConditions;\n /**\n * Applies multiple validations on the given value based on the specified truth table rule.\n *\n * @param {Object} TVAvailableValidationMultipleValidations - The multiple validations object param.\n * @param {'AND' | 'OR' | 'NOT'} TVAvailableValidationMultipleValidations.rule - The rule to be applied based of truth table ('AND', 'OR', or 'NOT').\n * @param {Object} TVAvailableValidationMultipleValidations.validations - Object containing validation rules.\n *\n * @example - Validating with the expression AND where current field must have a value of 'yes' and input 2 must have a value of 'no'\n * ```\n * multipleValidations: {\n * rule: 'AND',\n * validations: {\n * value: 'yes',\n * conditions: {\n * rule: 'and',\n * set: [\n * {\n * origin: '${fields.input2.value}',\n * condition: '===',\n * target: 'no'\n * },\n * ],\n * },\n * },\n * },\n * ```\n * @example - Validating with the expression OR where current field must have a value of '1995-12-12' or be a valid date with regex\n * ```\n * multipleValidations: {\n * rule: 'OR',\n * validations: {\n * value: '1995-12-12',\n * regex: '^\\d{4}-\\d{2}-\\d{2}$',\n * },\n * },\n * ```\n * @example - Validating with the expression NOT where current field doesn't have a value of '1995-12-12' and not be a valid date with regex\n * ```\n * multipleValidations: {\n * rule: 'NOT',\n * validations: {\n * value: '1995-12-12',\n * regex: '^\\d{4}-\\d{2}-\\d{2}$',\n * },\n * },\n * ```\n */\n multipleValidations?: TVAvailableValidationMultipleValidations;\n /**\n * Between validations\n *\n * @example - Between ages\n * ``` type teste = Pick<TVAvailableValidations, 'date'>\n * between: {\n * dates: [\n * {\n * operator: '>=',\n * origin: {\n * format: 'YYYYMMDD',\n * intervals: {\n * years: 18,\n * },\n * },\n * },\n * {\n * operator: '<=',\n * origin: {\n * format: 'YYYYMMDD',\n * intervals: {\n * years: 75,\n * },\n * },\n * }\n * ]\n * }\n * ```\n *\n * @example - Between numbers\n * ```\n * between: {\n * start: '3',\n * end: '4',\n * isIncludedBoundaries: true\n * },\n * ```\n *\n */\n between?: {\n /**\n * Array of date validations. To make it possible, ensure that the conditions is > and < in both date validations.\n */\n dates?: TVAvailableValidations['date'][];\n /**\n * The first number of the validation. If the current value is grater than this number, the validation will pass.\n */\n start?: number;\n /**\n * The second number of the validation. If the current value is lower than this number, the validation will pass.\n */\n end?: number;\n /**\n * If it's true, the comparision is transformed to >= and <=. So, the numbers that were passed are included in the validation.\n */\n isIncludedBoundaries?: boolean;\n };\n /**\n * Dates validations\n *\n * @example - Dates should be different\n * ```\n * date: {\n * operator: '!==',\n * origin: {\n * format: 'DDMMYYYY',\n * },\n * target: {\n * format: 'DDMMYYYY',\n * value: '10/10/2001',\n * },\n * },*\n * ```\n *\n * @example - Compare only valid dates using intervals\n * ```\n * date: {\n * onlyValidDate: true,\n * operator: '<',\n * origin: {\n * format: 'DD/MM/YYYY',\n * intervals: {\n * years: 1,\n * },\n * },\n * },\n * ```\n *\n * @example - Should have at max 85 years\n * ```\n * {\n * operator: '>',\n * origin: {\n * format: 'DDMMYYYY',\n * value: eightyFiveYearsDate,\n * intervals: {\n * years: 85,\n * },\n * },\n * }\n * }\n *\n * ```\n */\n date?: {\n /**\n * Flag to force only valid dates. Valid dates must be of min length of 8\n */\n onlyValidDate?: boolean;\n /**\n * List of operations you can do\n * - between origin and target dates\n * - between origin and intervals\n */\n operator: TValidationDateOperators;\n /**\n * The origin configurations\n */\n origin: {\n /**\n * Origin date value\n */\n value?: string | number;\n /**\n * The available date formats\n */\n format: TValidationDateFormats;\n /**\n * Intervals to compare with the original date.\n *\n * It will use todays date for comparison.\n *\n * @example\n *\n * origin date = 10/10/2022\n * interval.year = 1\n * operator = '==='\n *\n * It will compare (10/10/2022 + 1) with the current date and check if they are the same\n */\n intervals?: {\n years?: number;\n months?: number;\n days?: number;\n };\n };\n target?: {\n value: string | number;\n format: TValidationDateFormats;\n };\n };\n\n /**\n * Allow to validate if the input string is a valid date format\n */\n validDate?: TValidationDateFormats;\n\n /**\n * Allow to define a maximum length for the input to have no error\n */\n length?: number;\n\n /**\n * Will look into the input length and send an error if is not greater than this value\n */\n greaterThan?: number | string;\n\n /**\n * Specifies a regular expression pattern that the value should match.\n */\n regex?: string;\n\n /**\n * Specifies the maximum length of the value (if it's a string).\n */\n maxLength?: number;\n\n /**\n * Specifies the minimum length of the value (if it's a string).\n */\n minLength?: number;\n\n /**\n * Specifies whether the field is required.\n */\n required?: boolean;\n\n /**\n * Specifies that the value should contain only letters.\n */\n onlyLetters?: boolean;\n\n /**\n * Specifies a value that the field should match.\n */\n value?: string | number | boolean;\n\n /**\n * Specifies that the field should not be empty.\n */\n notEmpty?: boolean;\n\n /**\n * A callback function that performs custom validation on the value.\n * @param value - The value to be validated.\n * @returns An object with validation results.\n */\n callback?(value: string | number): { fail: boolean; errorMessage?: string };\n\n /**\n * Specifies a numeric range for the value.\n */\n numericRange?: { start: number | string; end: number | string };\n\n /**\n * Specifies whether the value should be a number.\n */\n isNumber?: boolean;\n\n /**\n * Specifies that the field should not have extra spaces.\n */\n hasNoExtraSpaces?: boolean;\n\n /**\n * Specifies that the value should be an email address.\n */\n email?: boolean;\n\n /**\n * Specifies that the value should be less than a given number or string.\n */\n lessThan?: number | string;\n\n /**\n * Specifies that the value should be a sequential number.\n */\n sequentialNumber?: boolean;\n\n /**\n * Specifies that the value should not contain repeated numbers.\n */\n repeatedNumbers?: boolean;\n\n /**\n * Specifies that the value should be a URL.\n */\n url?: boolean;\n\n /**\n * Specifies a path error type.\n */\n path?: TPathError;\n\n /**\n * Specifies that the value should be a valid credit card number.\n */\n isCreditCard?: string[];\n\n /**\n * Specifies that the value should be a valid credit card number with a specific length.\n */\n isCreditCardAndLength?: string[];\n\n /**\n * Specifies that the value should match a credit card code with available options.\n */\n isCreditCodeMatch?: { numberCard: string; availableOptions: string[] };\n\n /**\n * Specifies custom validation options for the field.\n */\n customValidation?: ICustomValidationValue[];\n\n /**\n * Specifies that spaces are not allowed in the field.\n */\n notAllowSpaces?: true;\n\n /**\n * Specifies that the value should be in a predefined list of values.\n */\n isInTheList?: string[] | number[] | string;\n\n /**\n * Specifies field validation rules for nested fields.\n */\n fields?: {\n /**\n * The rule for validating nested fields (e.g., 'every').\n */\n rule: 'every';\n\n /**\n * An array of nested field validation configurations.\n */\n set: {\n /**\n * The binding for the nested field.\n */\n bind: string;\n\n /**\n * The field name for the nested field.\n */\n fieldName: string;\n\n /**\n * Validation options for the nested field, excluding the 'fields' property.\n */\n validations: Omit<TVAvailableValidations, 'fields'>;\n }[];\n };\n\n /**\n * Specifies that the value should be existed.\n */\n exists?: string | number;\n};\n\nexport type TGenericValidationRule = {\n [key: string]: TVAvailableValidations;\n};\n\nexport type TSchemaValidation = TVAvailableValidations | TGenericValidationRule;\n\nexport type TStepData = {\n navigated: boolean;\n index: number;\n data: Record<\n number,\n Pick<\n TFormValues,\n 'fields' | 'erroredFields' | 'formatted' | 'filteredFields'\n >\n >;\n currentStepSchema?: TComponent;\n isValid: boolean;\n numSteps?: number;\n};\n\nexport type TFormValues = {\n predictableErroredFields: string[];\n erroredFields: string[];\n fields: TFieldData;\n formatted: Record<string, unknown>;\n filteredFields?: Record<string, unknown>;\n form: {\n steps: TStepData;\n isValid: boolean;\n messages: string[];\n scope: TScope;\n };\n};\n\nexport type TError = {\n value: unknown;\n message?: string;\n fail: boolean;\n};\n\nexport type TErrors = Record<string, TError> | undefined;\n\n// TODO - object with the available errors has props\nexport type TErrorMessages = Record<string, string>;\n\nexport type TSchemaValidations = TSchemaHandler<TSchemaValidation>;\n\ntype TFormLevelSchemaHandler<T> = Partial<\n Record<\n | EEVents.AFTER_FIELD_API_CALL\n | EEVents.ON_FIELD_CHANGE\n | EEVents.ON_FIELD_KEYUP\n | EEVents.ON_FIELD_KEYDOWN\n | EEVents.ON_FORM_REHYDRATE\n | EEVents.ON_FORM_MOUNT\n | EEVents.ON_SCOPE_CHANGE,\n T\n >\n>;\n\ntype TSchemaHandler<T> = Partial<\n Record<\n | EEVents.AFTER_FIELD_API_CALL\n | EEVents.ON_FIELD_REHYDRATE\n | EEVents.ON_FIELD_CLEARED\n | EEVents.ON_FIELD_BINDED\n | EEVents.ON_FIELD_CHANGE\n | EEVents.ON_FIELD_KEYUP\n | EEVents.ON_FIELD_KEYDOWN\n | EEVents.ON_FIELD_BLUR\n | EEVents.ON_FIELD_MOUNT\n | EEVents.ON_FIELD_FOCUS\n | EEVents.ON_FIELD_CLICK,\n T\n >\n>;\n\nexport type TSchemaVisibilityConditions = {\n /**\n * Enables visibility of fields only if any or all validation conditions are positive.\n *\n * The default is false, so if all validations are false, the field will display, if any are positive,\n * the field will hide, as well as if all are positive.\n */\n showOnlyIfTrue?: boolean;\n /**\n * Allows you to choose the type of chain for validations.\n *\n * The default is OR, where at least one validation needs to be true to work. In the case of AND,\n * all validations must be true.\n */\n rule?: 'or' | 'and';\n /**\n * The validations that will say if the target field will be visible or not\n *\n * Those validations will run against your field (the one that has this directive)\n */\n validations: TSchemaValidation;\n /**\n * Target field that will have the visibility toggled\n */\n fieldName?: string;\n /**\n * Target fields that will have the visibility toggled\n */\n fieldNames?: string[];\n}[];\n\nexport type TClearFieldValue = string | number | boolean;\n\nexport type TClearField = {\n /**\n * The clearValues runs validations on the target field and not on the field it is declaring.\n * Therefore, set this prop with true if you want validations to be performed on the current field.\n */\n useCurrentFieldValidation?: boolean;\n /**\n * Validations to run for the target field\n */\n validations?: TSchemaValidation | TSchemaValidation[];\n /**\n * target fields that will be used in the validation specified\n */\n fields: string[];\n /**\n * The cleared values on the fields in case they do not pass the validation\n */\n clearedValue: TClearFieldValue | TClearFieldValue[];\n /**\n * The cleared props from each component field on target fields array\n */\n clearedProps?: Record<string, unknown> | Record<string, unknown>[];\n /**\n * The cleared values on the fields in case they do pass the validation\n */\n defaultClearedValue?: TClearFieldValue | TClearFieldValue[];\n /**\n * The cleared props from each component field on target fields array if they pass validation\n */\n defaultClearedProps?: Record<string, unknown> | Record<string, unknown>[];\n};\n\nexport type TSchemaClearFields = TClearField[];\n\nexport type TSchemaApi = {\n /**\n * Specify a debounce time in miliseconds for your call\n */\n debounceTime?: number;\n method: 'GET' | 'POST' | 'PUT' | 'PATCH';\n url: string;\n headers?: HeadersInit | undefined;\n body?: Record<string, any>;\n fieldValueAsParams?: Record<string, string>;\n fieldValueAsPathParams?: string[];\n scope?: string;\n blockRequestWhenInvalid?: boolean;\n preConditions?: TSchemaValidation;\n}[];\n\nexport type TSchemaMasks = { cleanMask?: boolean } & TComponentMasks;\n\nexport type TFormEventDirectives = {\n visibilityConditions: TSchemaVisibilityConditions;\n};\n\nexport type TComponent = {\n /**\n * This name will be used later to correlate the field with the value, and you will be able to read it.\n *\n * You can also mount here complex objects like\n *\n * name={a.b.c}\n *\n * that will result in\n * a: {\n * b: {\n * c: 'field_value'\n * }\n * }\n */\n name: string;\n /**\n * A component name that should map to the one you gave in the form mappings\n *\n * @example - For React\n * ```\n * const mappings: TMapper = {\n * input: { component: Input },\n * formGroup: { component: FormGroup },\n * };\n * ```\n *\n * The component name for the Input element will be \"input\" ending up like\n * ```\n * {\n * component: 'input'\n * }\n * ```\n */\n component: string;\n /**\n * You can attach metadata to your component that will be forwarded to you after on your frontend\n * callback methods link `onData`, `onBlur` etc\n */\n metadata?: Record<string, any>;\n /**\n * This property allows you to specify a virtual fieldName that can be in several fields\n *\n * USAGE - You have two fields but you want to have the value stored only under one name\n *\n */\n group?: string;\n wrapper?: new () => React.Component;\n children?: TComponent[];\n /**\n * Field error messages in case any validation fails\n *\n * @example - Set a default error message for all the validations\n *\n * ```\n * {\n * errorMessages: {\n * default: 'default error message'\n * }\n * }\n * ```\n *\n * @example - Set error message for a given validation\n *\n * ```\n * {\n * validations: {\n * ON_FIELD_CHANGE: {\n * required: true\n * }\n * },\n * errorMessages: {\n * required: 'This field is required'\n * }\n * }\n * ```\n *\n */\n errorMessages?: TErrorMessages;\n type?: 'text' | 'number' | string;\n /**\n * Allow you to set a initial state for this field\n */\n state?: {\n /**\n * Hide the field\n */\n hidden?: boolean;\n /**\n * Ignore value from field\n */\n ignoreValue?: boolean;\n };\n /**\n * This key lets you inject props directly into the component\n */\n props?: Record<string, unknown>;\n /**\n * Setup validations to be used in the field.\n *\n * You can setup validations in several life-cycle methods\n *\n * @example - Required validation\n * ```\n * validations: {\n ON_FIELD_CHANGE: {\n required: true,\n },\n },\n * ```\n */\n validations?: TSchemaHandler<\n Pick<TEventReducedSchema, 'validations'>['validations']\n >;\n /**\n * Filters the component value based on a validation.\n */\n filter?: Pick<TEventReducedSchema, 'validations'>['validations'];\n /**\n * Allows you to specify the conditions a given field will be visible\n * what will run when this field meets the specified life-cycle\n */\n visibilityConditions?: Omit<\n TSchemaHandler<\n Pick<TEventReducedSchema, 'visibilityConditions'>['visibilityConditions']\n >,\n 'ON_FIELD_REHYDRATE' | 'ON_FIELD_CLEARED' | 'ON_FIELD_FOCUS'\n >;\n /**\n * Will clear target fields in case they do not pass with the specified validations\n */\n clearFields?: Omit<\n TSchemaHandler<Pick<TEventReducedSchema, 'clearFields'>['clearFields']>,\n 'ON_FIELD_REHYDRATE' | 'ON_FIELD_CLEARED' | 'ON_FIELD_FOCUS'\n >;\n /**\n * Allows you to make api calls using events emitted by the component.\n */\n api?: Omit<\n TSchemaHandler<Pick<TEventReducedSchema, 'api'>['api']>,\n 'ON_FIELD_REHYDRATE' | 'ON_FIELD_FOCUS' | 'AFTER_FIELD_API_CALL'\n >;\n /**\n * Allows you to display the value of the masked component by events\n */\n masks?: Partial<\n Record<\n | EEVents.ON_FIELD_BLUR\n | EEVents.ON_FIELD_MOUNT\n | EEVents.ON_FIELD_FOCUS\n | EEVents.ON_FIELD_CHANGE\n | EEVents.ON_FIELD_KEYUP\n | EEVents.ON_FIELD_KEYDOWN,\n Pick<TEventReducedSchema, 'masks'>['masks']\n >\n >;\n /**\n * Allows you to format the value that the field will receive for each event issuance\n */\n formatters?: Omit<\n TSchemaHandler<Pick<TEventReducedSchema, 'formatters'>['formatters']>,\n 'ON_FIELD_REHYDRATE' | 'ON_FIELD_FOCUS'\n >;\n};\n\nexport type TEventReducedSchema = {\n api: TSchemaApi;\n clearFields: TSchemaClearFields;\n formatters: TSchemaFormatters;\n masks: TSchemaMasks;\n validations: TSchemaValidation;\n visibilityConditions: TSchemaVisibilityConditions;\n};\n\nexport type TStep = {\n component: string;\n name: string;\n children: TComponent[];\n props?: Record<string, string>;\n};\n\nexport type TComponentPropsMapping = {\n getValue?: string;\n setValue?: string;\n onBlur?: string;\n onClick?: string;\n onFocus?: string;\n onKeyUp?: string;\n onKeyDown?: string;\n setErrorMessage?: string;\n setErrorState?: string;\n};\n\nexport type TPropsMapping = Record<string, TComponentPropsMapping>;\n\nexport type TSchema = {\n /**\n * Used to disable form submit input and prevent to submit form using enter event.\n * Default is false.\n */\n disableFormSubmit?: boolean;\n action?: string;\n method?: string;\n /**\n * Give some configurations to the form\n */\n configs?: TConfigs;\n /**\n * Allows you to expose some messages to the outside world when something happen\n */\n messages?: TFormMessages;\n /**\n * Specify some static field defaults before rendereing the form.\n *\n * If you have initialValues in the frontend setted, those will ovewride this\n */\n formattedDataDefaults?: Record<string, unknown>;\n /**\n * Form level props mapping\n */\n propsMapping?: TPropsMapping;\n visibilityConditions?: TFormLevelSchemaHandler<TSchemaVisibilityConditions>;\n /**\n * Entry point for the form should be a step (even if you have only one)\n */\n components: TStep[];\n /**\n * You can have many fields in the form, but be interested only in some\n *\n * You can put here the fields you want to read onSubmit for example\n *\n * You will receive those in TFormValues.filteredFields\n */\n filteredFields?: string[];\n /**\n * Schema level iVars.\n *\n * These iVars will go to the global scope namespace\n */\n iVars?: TIVars;\n};\n\nexport type TSplitterFormatterValue = {\n value: string;\n position: number;\n}[];\n\nexport type TSchemaFormatters = {\n splitter?: TSplitterFormatterValue;\n capitalize?: boolean;\n upperCase?: boolean;\n gapsCreditCard?: string[];\n onlyNumbers?: boolean;\n onlyLetters?: boolean;\n regex?: string;\n callback?(value: string | number): string | number;\n};\n\nexport type TConfigs = {\n observables?: { templates?: { exclude?: string[] } };\n};\n\nexport type TFlowType = {\n [x: string]: {\n events: (component?: TComponent) => EEVents[];\n handler: (args: TEventInformation<unknown>) => void;\n }[];\n};\n"],"names":["TAvailableHooks"],"mappings":"aA+HA,IAAYA,yDAAAA,QAKXA,qBAAA,GALWA,EAAAA,QAAeA,kBAAfA,wBAKX,CAAA,IAJC,SAAA,WACAA,EAAA,WAAA,aACAA,EAAA,UAAA,YACAA,EAAA,WAAA"}
@@ -1,2 +0,0 @@
1
- "use strict";var e=require("react/jsx-runtime"),t=require("react");require("./types.js");var r=require("credit-card-type");function n(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var o=n(t),i=n(r),a=function(e,t,r){return t?e+"/"+t+(r?"/"+r:""):e},u=function(e){return new RegExp("^(".concat(e,").*$"),"g")},c={ON_FIELD_VALIDATION_TOGGLE:"ON_FIELD_VALIDATION_TOGGLE",ON_FIELD_MOUNT:"ON_FIELD_MOUNT",ON_FIELD_CHANGE:"ON_FIELD_CHANGE",ON_FIELD_BLUR:"ON_FIELD_BLUR",ON_FIELD_FOCUS:"ON_FIELD_FOCUS",ON_FIELD_REHYDRATE:"ON_FIELD_REHYDRATE",ON_FIELD_CLEARED:"ON_FIELD_CLEARED",ON_FIELD_CLICK:"ON_FIELD_CLICK",ON_FIELD_KEYUP:"ON_FIELD_KEYUP",ON_FIELD_KEYDOWN:"ON_FIELD_KEYDOWN",ON_FIELD_BINDED:"ON_FIELD_BINDED",AFTER_FIELD_API_CALL:"AFTER_FIELD_API_CALL",RUN_FIELD_VALIDATIONS:"RUN_FIELD_VALIDATIONS",RUN_FIELD_FORMATTERS:"RUN_FIELD_FORMATTERS",RUN_FIELD_MASKS:"RUN_FIELD_MASKS",ON_SCOPE_CHANGE:"ON_SCOPE_CHANGE",ON_FORM_REHYDRATE:"ON_FORM_REHYDRATE",ON_FORM_SUBMIT:"ON_FORM_SUBMIT",ON_FORM_MOUNT:"ON_FORM_MOUNT",ON_FORM_UN_MOUNT:"ON_FORM_UN_MOUNT",ON_FORM_DATA:"ON_FORM_DATA",ON_FORM_DESTROY_FIELD:"ON_FORM_DESTROY_FIELD",NAVIGATE_STEP:"NAVIGATE_STEP",NAVIGATE_STEP_FORWARD:"NAVIGATE_STEP_FORWARD",NAVIGATE_STEP_BACK:"NAVIGATE_STEP_BACK",VALIDATE_FORM:"VALIDATE_FORM",BIND_FIELDS:"BIND_FIELDS",LOG:"LOG"},l="default_form_id",s="default_form_hook_id";function f(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,o,i,a,u=[],c=!0,l=!1;try{if(i=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;c=!1}else for(;!(c=(n=i.call(r)).done)&&(u.push(n.value),u.length!==t);c=!0);}catch(e){l=!0,o=e}finally{try{if(!c&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(l)throw o}}return u}}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return d(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);"Object"===r&&e.constructor&&(r=e.constructor.name);if("Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return d(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function d(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}var p,v,h=function(){var e=f(t.useState(0),2),r=e[0],n=e[1];return[r,function(){return n((function(e){return e+1}))}]};function y(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(n=Object.getOwnPropertySymbols(e);o<n.length;o++)t.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(e,n[o])&&(r[n[o]]=e[n[o]])}return r}function b(e,t,r,n){return new(r||(r=Promise))((function(o,i){function a(e){try{c(n.next(e))}catch(e){i(e)}}function u(e){try{c(n.throw(e))}catch(e){i(e)}}function c(e){e.done?o(e.value):function(e){return e instanceof r?e:new r((function(t){t(e)}))}(e.value).then(a,u)}c((n=n.apply(e,t||[])).next())}))}function m(e,t,r,n){if("a"===r&&!n)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?n:"a"===r?n.call(e):n?n.value:t.get(e)}function g(e,t,r,n,o){if("m"===n)throw new TypeError("Private method is not writable");if("a"===n&&!o)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!o:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===n?o.call(e,r):o?o.value=r:t.set(e,r),r}function O(e){return O="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},O(e)}function E(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */E=function(){return e};var e={},t=Object.prototype,r=t.hasOwnProperty,n=Object.defineProperty||function(e,t,r){e[t]=r.value},o="function"==typeof Symbol?Symbol:{},i=o.iterator||"@@iterator",a=o.asyncIterator||"@@asyncIterator",u=o.toStringTag||"@@toStringTag";function c(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{c({},"")}catch(e){c=function(e,t,r){return e[t]=r}}function l(e,t,r,o){var i=t&&t.prototype instanceof d?t:d,a=Object.create(i.prototype),u=new N(o||[]);return n(a,"_invoke",{value:S(e,r,u)}),a}function s(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}e.wrap=l;var f={};function d(){}function p(){}function v(){}var h={};c(h,i,(function(){return this}));var y=Object.getPrototypeOf,b=y&&y(y(I([])));b&&b!==t&&r.call(b,i)&&(h=b);var m=v.prototype=d.prototype=Object.create(h);function g(e){["next","throw","return"].forEach((function(t){c(e,t,(function(e){return this._invoke(t,e)}))}))}function _(e,t){function o(n,i,a,u){var c=s(e[n],e,i);if("throw"!==c.type){var l=c.arg,f=l.value;return f&&"object"==O(f)&&r.call(f,"__await")?t.resolve(f.__await).then((function(e){o("next",e,a,u)}),(function(e){o("throw",e,a,u)})):t.resolve(f).then((function(e){l.value=e,a(l)}),(function(e){return o("throw",e,a,u)}))}u(c.arg)}var i;n(this,"_invoke",{value:function(e,r){function n(){return new t((function(t,n){o(e,r,t,n)}))}return i=i?i.then(n,n):n()}})}function S(e,t,r){var n="suspendedStart";return function(o,i){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===o)throw i;return F()}for(r.method=o,r.arg=i;;){var a=r.delegate;if(a){var u=j(a,r);if(u){if(u===f)continue;return u}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var c=s(e,t,r);if("normal"===c.type){if(n=r.done?"completed":"suspendedYield",c.arg===f)continue;return{value:c.arg,done:r.done}}"throw"===c.type&&(n="completed",r.method="throw",r.arg=c.arg)}}}function j(e,t){var r=t.method,n=e.iterator[r];if(void 0===n)return t.delegate=null,"throw"===r&&e.iterator.return&&(t.method="return",t.arg=void 0,j(e,t),"throw"===t.method)||"return"!==r&&(t.method="throw",t.arg=new TypeError("The iterator does not provide a '"+r+"' method")),f;var o=s(n,e.iterator,t.arg);if("throw"===o.type)return t.method="throw",t.arg=o.arg,t.delegate=null,f;var i=o.arg;return i?i.done?(t[e.resultName]=i.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,f):i:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,f)}function w(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function A(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function N(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(w,this),this.reset(!0)}function I(e){if(e){var t=e[i];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var n=-1,o=function t(){for(;++n<e.length;)if(r.call(e,n))return t.value=e[n],t.done=!1,t;return t.value=void 0,t.done=!0,t};return o.next=o}}return{next:F}}function F(){return{value:void 0,done:!0}}return p.prototype=v,n(m,"constructor",{value:v,configurable:!0}),n(v,"constructor",{value:p,configurable:!0}),p.displayName=c(v,u,"GeneratorFunction"),e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===p||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,v):(e.__proto__=v,c(e,u,"GeneratorFunction")),e.prototype=Object.create(m),e},e.awrap=function(e){return{__await:e}},g(_.prototype),c(_.prototype,a,(function(){return this})),e.AsyncIterator=_,e.async=function(t,r,n,o,i){void 0===i&&(i=Promise);var a=new _(l(t,r,n,o),i);return e.isGeneratorFunction(r)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},g(m),c(m,u,"Generator"),c(m,i,(function(){return this})),c(m,"toString",(function(){return"[object Generator]"})),e.keys=function(e){var t=Object(e),r=[];for(var n in t)r.push(n);return r.reverse(),function e(){for(;r.length;){var n=r.pop();if(n in t)return e.value=n,e.done=!1,e}return e.done=!0,e}},e.values=I,N.prototype={constructor:N,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(A),!e)for(var t in this)"t"===t.charAt(0)&&r.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=void 0)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function n(r,n){return a.type="throw",a.arg=e,t.next=r,n&&(t.method="next",t.arg=void 0),!!n}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],a=i.completion;if("root"===i.tryLoc)return n("end");if(i.tryLoc<=this.prev){var u=r.call(i,"catchLoc"),c=r.call(i,"finallyLoc");if(u&&c){if(this.prev<i.catchLoc)return n(i.catchLoc,!0);if(this.prev<i.finallyLoc)return n(i.finallyLoc)}else if(u){if(this.prev<i.catchLoc)return n(i.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return n(i.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===e||"continue"===e)&&i.tryLoc<=t&&t<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=e,a.arg=t,i?(this.method="next",this.next=i.finallyLoc,f):this.complete(a)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),f},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),A(r),f}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var o=n.arg;A(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,r){return this.delegate={iterator:I(e),resultName:t,nextLoc:r},"next"===this.method&&(this.arg=void 0),f}},e}function _(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,(o=n.key,i=void 0,i=function(e,t){if("object"!==O(e)||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!==O(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(o,"string"),"symbol"===O(i)?i:String(i)),n)}var o,i}var S,j=function(){function e(t){var r=this;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),p.set(this,void 0),v.set(this,{}),this.debounceTime=50,this.debounce=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:r.debounceTime;return b(r,void 0,void 0,E().mark((function r(){var n=this;return E().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return r.abrupt("return",new Promise((function(r){m(n,v,"f")[e]&&clearTimeout(m(n,v,"f")[e]),m(n,v,"f")[e]=setTimeout((function(){clearTimeout(m(n,v,"f")[e]),r(e())}),t)})));case 1:case"end":return r.stop()}}),r)})))},g(this,p,t,"f"),this.publish=this.publish.bind(this),this.subscribe=this.subscribe.bind(this),this.debounce=this.debounce.bind(this),this.subscribeBulk=this.subscribeBulk.bind(this),this.subscriptions={}}var t,r,n;return t=e,r=[{key:"subscribe",value:function(e,t){this.subscriptions[e]&&this.subscriptions[e](),this.subscriptions[e]=m(this,p,"f").subscribe(e,t)}},{key:"subscribeBulk",value:function(e,t){var r=this;e.forEach((function(e){return r.subscribe(e,t)}))}},{key:"publish",value:function(e,t){m(this,p,"f").publish(e,t)}},{key:"publishFor",value:function(e){var t=this;return function(){var r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return b(t,void 0,void 0,E().mark((function t(){return E().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,m(this,p,"f").publish(e,r);case 2:return t.abrupt("return",t.sent);case 3:case"end":return t.stop()}}),t,this)})))}}},{key:"logError",value:function(e,t,r,n){m(this,p,"f").logError(e,t,r,n)}},{key:"logInfo",value:function(e,t,r,n){m(this,p,"f").logInfo(e,t,r,n)}}],r&&_(t.prototype,r),n&&_(t,n),Object.defineProperty(t,"prototype",{writable:!1}),e}();function w(e){return w="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},w(e)}function A(e,t,r){return(t=I(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function N(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,I(n.key),n)}}function I(e){var t=function(e,t){if("object"!==w(e)||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!==w(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"===w(t)?t:String(t)}function F(e,t){return F=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},F(e,t)}function L(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=k(e);if(t){var o=k(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return function(e,t){if(t&&("object"===w(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return D(e)}(this,r)}}function D(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function k(e){return k=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},k(e)}p=new WeakMap,v=new WeakMap;var x=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&F(e,t)}(i,j);var t,r,n,o=L(i);function i(e){var t;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,i),t=o.call(this,e),S.set(D(t),{global:{},api:{},hooks:{},configs:{},fields:{}}),t}return t=i,r=[{key:"scope",get:function(){return m(this,S,"f")||{}}},{key:"getGlobalScope",value:function(e,t){return e&&!t&&this.scope[e]?this.scope[e]:e&&t&&this.scope[e]?this.scope[e][t]:m(this,S,"f")}},{key:"initialScope",set:function(e){g(this,S,e||m(this,S,"f"),"f")}},{key:"globalScope",set:function(e){var t=e.namespace,r=e.key,n=e.data;r||(m(this,S,"f")[t]=n),r&&!m(this,S,"f")[t]&&(m(this,S,"f")[t]=A({},r,n)),m(this,S,"f")[t]&&r&&(m(this,S,"f")[t]=Object.assign(Object.assign({},m(this,S,"f")[t]),A({},r,n)));var o=r?a("ON_SCOPE_CHANGE",t,r):u(a("ON_SCOPE_CHANGE",t,r));this.publish(o,{scope:this.scope,namespace:t,key:r}),this.publish("ON_SCOPE_CHANGE")}}],r&&N(t.prototype,r),n&&N(t,n),Object.defineProperty(t,"prototype",{writable:!1}),i}();S=new WeakMap;var T=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return(arguments.length>1&&void 0!==arguments[1]?arguments[1]:"").split(".").reduce((function(e,t){return(e||{})[t]}),e)};function C(e){return C="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},C(e)}function P(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=function(e,t){if(!e)return;if("string"==typeof e)return R(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);"Object"===r&&e.constructor&&(r=e.constructor.name);if("Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return R(e,t)}(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,o=function(){};return{s:o,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,u=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return a=e.done,e},e:function(e){u=!0,i=e},f:function(){try{a||null==r.return||r.return()}finally{if(u)throw i}}}}function R(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function M(e,t,r){return(t=function(e){var t=function(e,t){if("object"!==C(e)||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!==C(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"===C(t)?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var V="${",G="}",U="||",B=function(e,t){return t?Object.keys(e).reduce((function(r,n){return t.includes(n)?Object.assign(Object.assign({},r),M({},n,e[n])):r}),{}):e},Y=function(e,t,r){var n=(e=e.toString()).lastIndexOf(V);if(-1===n)return e;var o=e.substring(n+V.length,e.length),i=o.substring(0,o.indexOf(G)),a=i.length,u="",c=i.split(U);if(c.length>1){i=c[0];var l,s=P(c);try{for(s.s();!(l=s.n()).done;){var f=l.value;if(f.includes("api")||f.includes("global")||f.includes("fields")||f.includes("hooks")||f.includes("configs")){var d=T(r.getGlobalScope(),f);d&&(u=d)}else u=f}}catch(e){s.e(e)}finally{s.f()}}var p=T(t.getGlobalScope(),i),v=void 0===p?u:p;if("string"!=typeof v&&0===n)return v;try{v=JSON.stringify(v).replace(/^"(.*)"$/,"$1")}catch(e){}return e.substring(0,n)+v+e.substring(n+a+V.length+G.length,e.length)};function H(e){return H="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},H(e)}function z(e){return function(e){if(Array.isArray(e))return $(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(!e)return;if("string"==typeof e)return $(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);"Object"===r&&e.constructor&&(r=e.constructor.name);if("Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return $(e,t)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function $(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function K(e,t,r){return(t=function(e){var t=function(e,t){if("object"!==H(e)||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!==H(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"===H(t)?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var W=function(e,t,r,n,o){var i=function(e){return"boolean"==typeof r&&"string"==typeof e?/true/.test(e):r.constructor(e)},a=t.split(".");if(1===a.length)return Object.assign(Object.assign({},e),K({},t,i(Y(r,n.scope,o.scope))));return function e(t,a){var u=z(t);u.splice(0,1);var c=1!==t.length?e(u,a?a[t[0]]:{}):i(Y(r,n.scope,o.scope));return Object.assign(Object.assign({},a),K({},t[0],c))}(a,e)};function J(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,o,i,a,u=[],c=!0,l=!1;try{if(i=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;c=!1}else for(;!(c=(n=i.call(r)).done)&&(u.push(n.value),u.length!==t);c=!0);}catch(e){l=!0,o=e}finally{try{if(!c&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(l)throw o}}return u}}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return q(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);"Object"===r&&e.constructor&&(r=e.constructor.name);if("Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return q(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function q(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}var Z=function(e,t){var r=Q(e.toString()),n=i.default(r);return[(null==t?void 0:t.length)?null==n?void 0:n.filter((function(e){var r=e.type;return t.some((function(e){return e===r}))}))[0]:n[0],r]},Q=function(e){return null==e?void 0:e.replace(/ /g,"")},X=function(e,t){return t?function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],r=t.reduce((function(e,r,n){var o=J(e,2),i=o[0],a=o[1],u=r-(t[n-1]||0);return["".concat(i,"([0-9]{0,").concat(u,"})"),"".concat(a,"$").concat(n+1," ")]}),["",""]),n=J(r,2),o=n[0],i=n[1];return e.replace(new RegExp(o),i).trim()}(e.slice(0,null==t?void 0:t.lengths[0]),t.gaps):e.slice(0,19)};function ee(e){if("string"!=typeof e)return!1;try{var t=JSON.parse(e),r=Object.prototype.toString.call(t);return"[object Object]"===r||"[object Array]"===r}catch(e){return!1}}function te(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,o,i,a,u=[],c=!0,l=!1;try{if(i=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;c=!1}else for(;!(c=(n=i.call(r)).done)&&(u.push(n.value),u.length!==t);c=!0);}catch(e){l=!0,o=e}finally{try{if(!c&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(l)throw o}}return u}}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return re(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);"Object"===r&&e.constructor&&(r=e.constructor.name);if("Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return re(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function re(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}var ne=function(e){var t=e.value,r=e.formatterValue;if(!t)return t;var n="",o=0;return r.forEach((function(e,i){var a=0===i?i:r[i-1].position+1;t[e.position]==e.value&&o++,n+=t.slice(a,e.position)})),n+=t.slice(n.length+o)},oe={splitter:function(e){var t=e.value,r=e.formatterValue;if(!t)return t;var n=ne({value:t,formatterValue:r});return r.forEach((function(e){e.position>=t.length||(n=n.slice(0,e.position)+e.value+n.slice(e.position,null==n?void 0:n.length))})),n},undo_splitter:ne,capitalize:function(e){var t=e.value;return t?t.charAt(0).toUpperCase()+t.slice(1):t},upperCase:function(e){var t=e.value;return t?t.toUpperCase():t},gapsCreditCard:function(e){var t=e.value,r=e.formatterValue;if(t){var n=te(Z(t,r),2),o=n[0],i=n[1];return X(i,o)}},onlyNumbers:function(e){return e.value.replace(/([^\d])+/gim,"")},onlyLetters:function(e){return e.value.replace(/([0-9:\s/-])+/g,"")},regex:function(e){var t=e.value,r=e.formatterValue;return t.replace(new RegExp(r,"g"),"")},callback:function(e){var t=e.value;return(0,e.formatterValue)(t)}},ie=function(e,t,r){var n=e;return Object.keys(t).forEach((function(e){var o=t[e],i=oe[r?"undo_".concat(e):e];i&&(n=i({value:n,formatterValue:o}))})),n},ae=function(e){var t=e.value,r=void 0===t?"":t,n=e.maskValue,o=r;return n.forEach((function(e){var t=e.to,n=void 0===t?o.length:t,i=e.mask,a=e.from;if(!(n>r.length-1)){0===a&&(a=1);var u=new Array(n-a+2).join(i);o=o.slice(0,a-1)+u+o.slice(n)}})),o},ue={generic:ae,cardNumber:function(e){var t=e.value;return ae({value:t,maskValue:[{from:1,to:4,mask:"x"},{from:6,to:9,mask:"x"},{from:11,to:14,mask:"x"},{from:16,to:19,mask:"x"}]})},hideCardNumber:function(e){var t=e.value;return ae({value:t,maskValue:[{from:1,to:4,mask:"x"},{from:6,to:9,mask:"x"},{from:11,to:14,mask:"x"},{from:16,to:19,mask:"x"}]})},cardMask:function(e){return e.value.replace(/[^\dA-Z]/g,"").replace(/(.{4})/g,"$1 ").trim()},cardDate:function(e){var t=e.value.replace(/\D/g,""),r=t.slice(0,2);return t.length>=5?"".concat(r,"/").concat(t.slice(2,4)):t.length>=3?"".concat(r,"/").concat(t.slice(2)):t},currencyMask:function(e){var t=e.value,r=void 0===t?"":t,n=e.maskValue,o=r.replace(/[^0-9]/g,"");return new Intl.NumberFormat(n.locale,{minimumFractionDigits:0,maximumFractionDigits:0,style:"currency",currency:n.currency}).format(+o)},feinMask:function(e){var t=e.value.replace(/\D/g,""),r=t.slice(0,2);return t.length>=5?"".concat(r,"-").concat(t.slice(2,9)):t.length>=3?"".concat(r,"-").concat(t.slice(2)):t},replaceAll:function(e){var t=e.value,r=void 0===t?"":t,n=e.maskValue;return n&&"string"==typeof r?("number"==typeof n&&(n=null==n?void 0:n.toString()),new Array(r.length+1).join(n)):r},callback:function(e){var t=e.value;return(0,e.maskValue)(t)}};function ce(e,t,r){return(t=function(e){var t=function(e,t){if("object"!==le(e)||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!==le(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"===le(t)?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function le(e){return le="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},le(e)}function se(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,o,i,a,u=[],c=!0,l=!1;try{if(i=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;c=!1}else for(;!(c=(n=i.call(r)).done)&&(u.push(n.value),u.length!==t);c=!0);}catch(e){l=!0,o=e}finally{try{if(!c&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(l)throw o}}return u}}(e,t)||fe(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function fe(e,t){if(e){if("string"==typeof e)return de(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?de(e,t):void 0}}function de(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}var pe={DDMMYYYY:function(e){var t=e.split(e.includes("/")?"/":"-");return"".concat(t[1],"/").concat(t[0],"/").concat(t[2])},YYYYMMDD:function(e){var t=e.split(e.includes("/")?"/":"-");return"".concat(t[1],"/").concat(t[2],"/").concat(t[0])},YYYYDDMM:function(e){var t=e.split(e.includes("/")?"/":"-");return"".concat(t[2],"/").concat(t[1],"/").concat(t[0])},MMDDYYYY:function(e){return e},timestamp:function(e){return new Date(e).toString()}},ve=function(e){var t=e.value,r=e.validationValue,n=new RegExp(r);return{fail:!n.test(t)}},he=function(e){var t=e.value,r=void 0===t?"":t,n=e.validationValue.some((function(e){var t=e.to,n=e.from,o=e.validations,i=r.substring(t,n);return ge(me(i,o))}));return{fail:n}},ye=function(e){var t,r,n,o,i,a=e.value,u=void 0===a?"":a,c=e.validationValue;if(!(null===(t=null==c?void 0:c.target)||void 0===t?void 0:t.value)&&!(null===(r=null==c?void 0:c.origin)||void 0===r?void 0:r.intervals))return{fail:!1};var l,s=c.origin.value||u,f=new Date(pe[null==c?void 0:c.origin.format](s).toString()),d=new Date;if((null===(n=null==c?void 0:c.target)||void 0===n?void 0:n.format)&&(d=l=new Date(pe[null===(o=null==c?void 0:c.target)||void 0===o?void 0:o.format](c.target.value).toString())),c.origin.intervals){d=function(e,t){var r={years:function(e,t){return new Date(e.setUTCFullYear(e.getUTCFullYear()+t))},months:function(e,t){return new Date(e.setUTCMonth(e.getUTCMonth()+t))},days:function(e,t){return new Date(e.setDate(e.getUTCDate()+t))}};return Object.keys(t).reduce((function(e,n){return r[n](e,t[n])}),new Date(e))}(f,c.origin.intervals);var p=new Date;(null===(i=c.target)||void 0===i?void 0:i.value)&&l&&(p.setDate(l.getDate()),p.setMonth(l.getMonth())),f=new Date("".concat(p.getUTCMonth()+1,"/").concat(p.getUTCDate(),"/").concat(p.getUTCFullYear()))}if(c.onlyValidDate&&(!(d instanceof Date&&isFinite(d))||!(d instanceof Date&&isFinite(f))||s.length<8))return{fail:!0};var v=f.getTime(),h=d.getTime();return{fail:{">":v>h,">=":v>=h,"<":v<h,"<=":v<=h,"===":v===h,"!==":v!==h}[null==c?void 0:c.operator]}},be={between:function(e){var t,r=e.value,n=e.validationValue,o=!1;if(!(2==(null===(t=null==n?void 0:n.dates)||void 0===t?void 0:t.length)||(null==n?void 0:n.start)&&(null==n?void 0:n.end)))return{fail:!1};if(n.dates){var i,a=function(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=fe(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,o=function(){};return{s:o,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,u=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return a=e.done,e},e:function(e){u=!0,i=e},f:function(){try{a||null==r.return||r.return()}finally{if(u)throw i}}}}(n.dates);try{for(a.s();!(i=a.n()).done;){var u=i.value;if(ye({value:r,validationValue:u}).fail){o=!0;break}}}catch(e){a.e(e)}finally{a.f()}}else{var c=parseInt(r);n.isIncludedBoundaries?(c<n.start||c>n.end)&&(o=!0):(c<=n.start||c>=n.end)&&(o=!0)}return{fail:o}},conditions:function e(t){var r=t.value,n=void 0===r?"":r,o=t.validationValue;if(!o)return{fail:!1};var i=function(e){if(e.forceDefinedOrigin&&void 0===e.origin||e.forceDefinedTarget&&void 0===e.target)return{fail:!1};var t=void 0===e.origin?n:e.origin,r=void 0===e.target?n:e.target;return{"!==":(t||n)!==(r||n),"===":(t||n)===(r||n),"<":(t||n)<(r||n),">":(t||n)>(r||n),"<=":(t||n)<=(r||n),">=":(t||n)>=(r||n)}[e.condition]},a={and:function(){return!!o.set.every(i)},or:function(){return!!o.set.some(i)}}[o.rule]();return o.conditions&&(a="and"===o.rule?a&&e({value:n,validationValue:o.conditions}).fail:a||e({value:n,validationValue:o.conditions}).fail),{fail:a}},multipleValidations:function(e){var t=e.value,r=void 0===t?"":t,n=e.validationValue;if(!n)return{fail:!1};var o=Object.values(me(r,n.validations));return{fail:{AND:function(){return!!o.every((function(e){return e.fail}))},OR:function(){return!!o.some((function(e){return e.fail}))},NOT:function(){return!o.every((function(e){return e.fail}))}}[n.rule]()}},date:ye,validDate:function(e){var t=e.value,r=void 0===t?"":t,n=e.validationValue;if(!n)return{fail:!1};var o=pe[n](r).toString().split(/[/-]/),i=parseInt(o[2],10),a=parseInt(o[0],10)-1,u=parseInt(o[1],10),c=new Date(i,a,u);return{fail:!(c.getFullYear()===i&&c.getMonth()===a&&c.getDate()===u)}},length:function(e){var t=e.value,r=e.validationValue,n=t;return"string"!=typeof n&&(n=null==t?void 0:t.toString()),{fail:!t||(null==n?void 0:n.length)===r}},greaterThan:function(e){var t=e.value,r=e.validationValue;return{fail:!t||parseInt(t)<=parseInt(r)}},maxLength:function(e){var t=e.value,r=void 0===t?"":t,n=e.validationValue,o=r;return Number.isInteger(o)&&(o=r.toString()),{fail:o.length>n}},minLength:function(e){var t=e.value,r=void 0===t?"":t,n=e.validationValue,o=r;return Number.isInteger(o)&&(o=r.toString()),{fail:o.length<n}},required:function(e){var t=e.value;return{fail:e.validationValue&&!t}},value:function(e){var t=e.value;return{fail:t!==e.validationValue}},bool:function(e){var t=e.validationValue,r=!1;return"boolean"==typeof t&&(r=t),{fail:r}},regex:ve,hasNoExtraSpaces:function(e){var t=e.value;return{fail:ve({value:t,validationValue:"^[A-Za-z0-9.-]+(?: +[A-Za-z0-9.-]+)*$",errorMessage:""}).fail}},isCreditCard:function(e){var t,r,n=e.value,o=e.validationValue;if(!n)return{fail:!0};var i=se(Z(n,o),1)[0];return{fail:!i,metadata:{typeCard:null==i?void 0:i.type,creditCardCC:null===(t=null==i?void 0:i.code)||void 0===t?void 0:t.name,creditCardCCSize:null===(r=null==i?void 0:i.code)||void 0===r?void 0:r.size}}},isCreditCardAndLength:function(e){var t=e.value,r=e.validationValue;if(!t)return{fail:!0};var n=se(Z(t,r),2),o=n[0],i=n[1];return{fail:o&&!o.lengths.includes(i.length)}},isCreditCodeMatch:function(e){var t,r=e.value,n=e.validationValue;if(!r)return{fail:!0};var o=se(Z(n.numberCard,n.availableOptions),1)[0];return{fail:(null===(t=null==o?void 0:o.code)||void 0===t?void 0:t.size)!==r.length}},onlyLetters:function(e){var t=e.value;return{fail:!/^[a-zA-Z\s]*$/.test(t)}},notAllowSpaces:function(e){var t=e.value;return{fail:/\s/.test(t)}},callback:function(e){var t=e.value,r=(0,e.validationValue)(t);return{message:r.errorMessage,fail:r.fail}},isNumber:function(e){var t=e.value;return{fail:!!t&&!/^[0-9\s]*$/.test(t)}},customValidation:function(e){var t=e.value,r=e.validationValue;return he({value:t,validationValue:r})},notEmpty:function(e){return{fail:!e.value.trim().length}},numericRange:function(e){var t=e.value,r=e.validationValue,n=String(t).replace(/[^0-9]/g,"");return{fail:!n||!Number.isInteger(parseInt(n.toString()))||+n>r.end||+n<r.start}},email:function(e){var t=e.value;return{fail:!/^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/.test(t)}},lessThan:function(e){var t=e.value,r=e.validationValue;return{fail:!t||parseInt(t)>=parseInt(r)}},sequentialNumber:function(e){var t=e.value,r=String(t).replace(/[^0-9]/g,"");return{fail:!(-1==="0123456789".indexOf(r)&&-1==="9876543210".indexOf(r))}},repeatedNumbers:function(e){var t=e.value,r=String(t).replace(/[^0-9]/g,"");return{fail:/\b(\d)\1+\b/gm.test(r)}},url:function(e){var t=e.value;return{fail:!/[(http(s)?)://(www.)?a-zA-Z0-9@:%._+~#=]{2,256}\.[a-z]{2,6}\b([-a-zA-Z0-9@:%_+.~#?&//=]*)/gi.test(t)}},path:function(e){var t=e.value,r=e.validationValue,n=function(e){var n=T(t,e);if(r.preventUnMountValidation&&!(e in t))return{fail:!1};var o,i,a=me(n,r);return i={fail:!1},(o=a)?Object.keys(o).reduce((function(e,t){return o[t].fail?o[t]:e}),i):i};return Array.isArray(r.paths)?r.paths.reduce((function(e,t){var r=n(t);return r.fail?r:e}),{}):n(r.path)},isInTheList:function(e){var t=e.value,r=e.validationValue;return t&&Array.isArray(r)?{fail:!r.some((function(e){return e===t||JSON.stringify(e)===t}))}:{fail:!0}},fields:function(e){var t=e.values,r=e.validationValue;return{fail:null==r?void 0:r.set[r.rule]((function(e){var r;return ge(me(null===(r=t[e.fieldName])||void 0===r?void 0:r.value,e.validations))}))}},customNameRule:function(e){var t=e.value,r=e.validationValue;return"object"!==le(r)?{fail:!1}:{fail:ge(me(t,r))}},exists:function(e){return{fail:!e.validationValue}}},me=function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},o={};return Object.keys(t).forEach((function(i){var a=t[i],u=be[i];u||(u=be.customNameRule);var c=r[i]||r.default,l=u({value:e,validationValue:a,errorMessage:c,values:n});o=Object.assign(Object.assign({},o),ce({},i,Object.assign(Object.assign({},l),{validationValue:a,message:c})))})),o},ge=function(e){return!!e&&!!Object.keys(e).find((function(t){return e&&e[t].fail}),[])},Oe=Object.freeze({__proto__:null,concatenate:function(e,t){return e+t},add:function(e,t){return((parseInt(e)||0)+(parseInt(t)||0)).toString()},subtract:function(e,t){return parseInt(e)-parseInt(t)},replaceAll:function(e,t,r){return e.replace(new RegExp(t,"g"),r)}}),Ee=Object.freeze({__proto__:null,handler:function(e){var t=e.field,r=e.data;t.data.changed=!0,t.data.metadata=r.metadata,t.value=r.parsedEventValue}}),_e=Object.freeze({__proto__:null,handler:function(e){var t,r,n,o,i,u,c,l,s=e.form,f=e.field;f.subscribe(a("ON_SCOPE_CHANGE","configs","disable"),(function(){return f.rehydrate()}));var d=f.component.props,p=(void 0===d?{}:d)[null===(t=f.mappings)||void 0===t?void 0:t.setValue],v=f.component.group&&T(s.initialValues,f.component.group),h=T(s.initialValues,v===(null===(r=f.component.props)||void 0===r?void 0:r.value)&&v?f.component.group:f.component.name)||p;f.value=(null===(l=null===(o=null===(n=s.formData.form)||void 0===n?void 0:n.steps)||void 0===o?void 0:o.data[null===(c=null===(u=null===(i=s.formData)||void 0===i?void 0:i.form)||void 0===u?void 0:u.steps)||void 0===c?void 0:c.index])||void 0===l?void 0:l.formatted[f.component.name])||(f.data.mounted?void 0:h),f.data.mounted=!0}}),Se=Object.freeze({__proto__:null,handler:function(e){e.field.data.blured=!0}}),je=Object.freeze({__proto__:null,handler:function(e){var t=e.field;t.data=Object.assign(Object.assign({},t.data),{focused:!0})}});function we(e){return we="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},we(e)}function Ae(e,t,r){return(t=function(e){var t=function(e,t){if("object"!==we(e)||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!==we(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"===we(t)?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Ne(e){return function(e){if(Array.isArray(e))return Fe(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||Ie(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Ie(e,t){if(e){if("string"==typeof e)return Fe(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?Fe(e,t):void 0}}function Fe(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}var Le=function(e){return/\$\{(.*)\}.*/g.test(e)},De="varOps.",ke=")",xe="(",Te=",",Ce=function(e){return e.includes(De)},Pe=Object.freeze({__proto__:null,handler:function(e){var t=e.field,r=e.form,n=function(){if(t){var e=t.component,r=e.children,n=e.wrapper,o=y(e,["children","wrapper"]),a=Object.assign({},i(o));t.scopedComponent=Object.assign(Object.assign(Object.assign({},o),a),{children:r,wrapper:n})}},o=function e(o){var i=(o=o.toString()).lastIndexOf(V);if(-1===i)return o;var u=o.substring(i+V.length,o.length),c=u.substring(0,u.indexOf(G)),l=c.length,s="",f=c.split(U);if(f.length>1){c=f[0];var d,p=function(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=Ie(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,o=function(){};return{s:o,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,u=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return a=e.done,e},e:function(e){u=!0,i=e},f:function(){try{a||null==r.return||r.return()}finally{if(u)throw i}}}}(f);try{for(p.s();!(d=p.n()).done;){var v=d.value;if(v.includes("api")||v.includes("global")||v.includes("fields")||v.includes("hooks")||v.includes("configs")){var h=T(t.scope.getGlobalScope(),v);h&&(s=h)}else s=v}}catch(e){p.e(e)}finally{p.f()}}t&&function(e){var r,o,i,u,c=!(null===(u=null===(i=null===(o=null===(r=t.scope.scope.configs)||void 0===r?void 0:r.observables)||void 0===o?void 0:o.templates)||void 0===i?void 0:i.exclude)||void 0===u?void 0:u.includes(t.component.name)),l=e[0].split(".");c&&t.subscribe(a("ON_SCOPE_CHANGE",l[0],l[1]),(function(){n(),t.rehydrate()}))}(f);var y=T(r.scope.getGlobalScope(),c),b=void 0===y?s:y;if("string"!=typeof b&&0===i)return b;if(!b&&!/^\$\{.*\}$/.test(o))return o.substring(0,i)+o.substring(o.indexOf(V),o.lastIndexOf(G)+1);try{b=JSON.stringify(b).replace(/^"(.*)"$/,"$1")}catch(e){}var m=o.substring(0,i)+b+o.substring(i+l+V.length+G.length,o.length);return Ce(m)&&!Le(m)?m.replace(/([^\s]+)/g,(function(e){if(!Ce(e))return e;var t=function(e){return Oe[e.split(De)[1].split(xe)[0]]}(e);return t?t.apply(void 0,Ne(function(e){return e.split(De)[1].split(xe)[1].split(ke)[0].split(Te)}(e))):void 0})):e(m)},i=function e(t){if("string"==typeof t)return o(t);if("number"==typeof t)return t;var r=Object.assign({},t);return Object.keys(r).reduce((function(t,n){if(null===r[n])return t;if(Array.isArray(r[n]))return Object.assign(Object.assign({},t),Ae({},n,r[n].map(e)));if("object"===we(r[n]))return Object.assign(Object.assign({},t),Ae({},n,Object.assign({},e(Object.assign({},r[n])))));if("string"!=typeof r[n])return Object.assign(Object.assign({},t),Ae({},n,r[n]));if(!Le(r[n]))return Object.assign(Object.assign({},t),Ae({},n,r[n]));var i=o(r[n]);try{ee(i)&&(i=JSON.parse(i))}catch(e){}return Object.assign(Object.assign({},t),Ae({},n,i))}),{})};n(),function(){var e=r.schema||{};e.components;var t=y(e,["components"]),n=i(t);r.scopedSchema=n,r.rehydrate()}()}});function Re(e){return Re="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Re(e)}function Me(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */Me=function(){return e};var e={},t=Object.prototype,r=t.hasOwnProperty,n=Object.defineProperty||function(e,t,r){e[t]=r.value},o="function"==typeof Symbol?Symbol:{},i=o.iterator||"@@iterator",a=o.asyncIterator||"@@asyncIterator",u=o.toStringTag||"@@toStringTag";function c(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{c({},"")}catch(e){c=function(e,t,r){return e[t]=r}}function l(e,t,r,o){var i=t&&t.prototype instanceof d?t:d,a=Object.create(i.prototype),u=new w(o||[]);return n(a,"_invoke",{value:E(e,r,u)}),a}function s(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}e.wrap=l;var f={};function d(){}function p(){}function v(){}var h={};c(h,i,(function(){return this}));var y=Object.getPrototypeOf,b=y&&y(y(A([])));b&&b!==t&&r.call(b,i)&&(h=b);var m=v.prototype=d.prototype=Object.create(h);function g(e){["next","throw","return"].forEach((function(t){c(e,t,(function(e){return this._invoke(t,e)}))}))}function O(e,t){function o(n,i,a,u){var c=s(e[n],e,i);if("throw"!==c.type){var l=c.arg,f=l.value;return f&&"object"==Re(f)&&r.call(f,"__await")?t.resolve(f.__await).then((function(e){o("next",e,a,u)}),(function(e){o("throw",e,a,u)})):t.resolve(f).then((function(e){l.value=e,a(l)}),(function(e){return o("throw",e,a,u)}))}u(c.arg)}var i;n(this,"_invoke",{value:function(e,r){function n(){return new t((function(t,n){o(e,r,t,n)}))}return i=i?i.then(n,n):n()}})}function E(e,t,r){var n="suspendedStart";return function(o,i){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===o)throw i;return N()}for(r.method=o,r.arg=i;;){var a=r.delegate;if(a){var u=_(a,r);if(u){if(u===f)continue;return u}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var c=s(e,t,r);if("normal"===c.type){if(n=r.done?"completed":"suspendedYield",c.arg===f)continue;return{value:c.arg,done:r.done}}"throw"===c.type&&(n="completed",r.method="throw",r.arg=c.arg)}}}function _(e,t){var r=t.method,n=e.iterator[r];if(void 0===n)return t.delegate=null,"throw"===r&&e.iterator.return&&(t.method="return",t.arg=void 0,_(e,t),"throw"===t.method)||"return"!==r&&(t.method="throw",t.arg=new TypeError("The iterator does not provide a '"+r+"' method")),f;var o=s(n,e.iterator,t.arg);if("throw"===o.type)return t.method="throw",t.arg=o.arg,t.delegate=null,f;var i=o.arg;return i?i.done?(t[e.resultName]=i.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,f):i:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,f)}function S(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function j(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function w(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(S,this),this.reset(!0)}function A(e){if(e){var t=e[i];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var n=-1,o=function t(){for(;++n<e.length;)if(r.call(e,n))return t.value=e[n],t.done=!1,t;return t.value=void 0,t.done=!0,t};return o.next=o}}return{next:N}}function N(){return{value:void 0,done:!0}}return p.prototype=v,n(m,"constructor",{value:v,configurable:!0}),n(v,"constructor",{value:p,configurable:!0}),p.displayName=c(v,u,"GeneratorFunction"),e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===p||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,v):(e.__proto__=v,c(e,u,"GeneratorFunction")),e.prototype=Object.create(m),e},e.awrap=function(e){return{__await:e}},g(O.prototype),c(O.prototype,a,(function(){return this})),e.AsyncIterator=O,e.async=function(t,r,n,o,i){void 0===i&&(i=Promise);var a=new O(l(t,r,n,o),i);return e.isGeneratorFunction(r)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},g(m),c(m,u,"Generator"),c(m,i,(function(){return this})),c(m,"toString",(function(){return"[object Generator]"})),e.keys=function(e){var t=Object(e),r=[];for(var n in t)r.push(n);return r.reverse(),function e(){for(;r.length;){var n=r.pop();if(n in t)return e.value=n,e.done=!1,e}return e.done=!0,e}},e.values=A,w.prototype={constructor:w,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(j),!e)for(var t in this)"t"===t.charAt(0)&&r.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=void 0)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function n(r,n){return a.type="throw",a.arg=e,t.next=r,n&&(t.method="next",t.arg=void 0),!!n}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],a=i.completion;if("root"===i.tryLoc)return n("end");if(i.tryLoc<=this.prev){var u=r.call(i,"catchLoc"),c=r.call(i,"finallyLoc");if(u&&c){if(this.prev<i.catchLoc)return n(i.catchLoc,!0);if(this.prev<i.finallyLoc)return n(i.finallyLoc)}else if(u){if(this.prev<i.catchLoc)return n(i.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return n(i.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===e||"continue"===e)&&i.tryLoc<=t&&t<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=e,a.arg=t,i?(this.method="next",this.next=i.finallyLoc,f):this.complete(a)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),f},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),j(r),f}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var o=n.arg;j(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,r){return this.delegate={iterator:A(e),resultName:t,nextLoc:r},"next"===this.method&&(this.arg=void 0),f}},e}function Ve(e,t,r){return(t=function(e){var t=function(e,t){if("object"!==Re(e)||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!==Re(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"===Re(t)?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Ge(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=function(e,t){if(!e)return;if("string"==typeof e)return Ue(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);"Object"===r&&e.constructor&&(r=e.constructor.name);if("Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Ue(e,t)}(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,o=function(){};return{s:o,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,u=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return a=e.done,e},e:function(e){u=!0,i=e},f:function(){try{a||null==r.return||r.return()}finally{if(u)throw i}}}}function Ue(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}var Be=Object.freeze({__proto__:null,handler:function(e){var t=e.field,r=e.form;return e.eventReducedSchema.api.forEach((function(e){var n,o=t.scope,i=me(t.data.value,e.preConditions||{},t.scopedComponent.errorMessages,null===(n=null==r?void 0:r.formData)||void 0===n?void 0:n.fields);if(!(t.fieldHasError(i)||e.blockRequestWhenInvalid&&t.fieldValidationsHaveError(!1))){e.url.includes(V)&&(e.url=Y(e.url,r.scope,t.scope));var u={},c=e.url;if(e.fieldValueAsPathParams){var l,s=Ge(e.fieldValueAsPathParams);try{for(s.s();!(l=s.n()).done;){var f=l.value;Object.prototype.hasOwnProperty.call(r.fields,f)&&(c="".concat(c,"/").concat(r.fields[f].data.value))}}catch(e){s.e(e)}finally{s.f()}}if(e.fieldValueAsParams){for(var d in e.fieldValueAsParams)if(Object.prototype.hasOwnProperty.call(r.fields,d)){var p=e.fieldValueAsParams[d]||d;u=Object.assign(Object.assign({},u),Ve({},p,r.fields[d].data.value))}if(c.includes("?")){var v=c.split("?"),h=v.at(1).split("&");if(c=v.at(0),h.length>1){var y,m=Ge(h);try{for(m.s();!(y=m.n()).done;){var g=y.value.split("=");u=Object.assign(Object.assign({},u),Ve({},g.at(0),g.at(1)))}}catch(e){m.e(e)}finally{m.f()}}else{var O=h.at(0).split("=");u=Object.assign(Object.assign({},u),Ve({},O.at(0),O.at(1)))}}var E=new URLSearchParams(u);c="".concat(c,"?").concat(E.toString())}o.globalScope={namespace:"api",key:e.scope,data:{loading:!0}},t.debounce((function(){return fetch(c,Object.assign(Object.assign({method:e.method},e.body&&{body:JSON.stringify(e.body)}),{headers:e.headers||{"Content-type":"application/json; charset=UTF-8"}})).then((function(e){var t=e.json();if(e.status>=400)throw t;return t})).then((function(t){o.globalScope={namespace:"api",key:e.scope,data:Object.assign({loading:!1,response:t},t)}})).catch((function(t){return b(void 0,void 0,void 0,Me().mark((function r(){var n;return Me().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return r.next=2,t;case 2:n=r.sent,o.globalScope={namespace:"api",key:e.scope,data:{loading:!1,error:!0,err:n}};case 4:case"end":return r.stop()}}),r)})))})).finally((function(){return t.publish(a("AFTER_FIELD_API_CALL",t.component.name))}))}),e.debounceTime||200)}}))},events:function(e){return Object.keys(e.api||{})}});function Ye(e){return Ye="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Ye(e)}function He(e,t,r){return(t=function(e){var t=function(e,t){if("object"!==Ye(e)||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!==Ye(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"===Ye(t)?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function ze(e){return function(e){if(Array.isArray(e))return $e(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(!e)return;if("string"==typeof e)return $e(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);"Object"===r&&e.constructor&&(r=e.constructor.name);if("Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return $e(e,t)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function $e(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}var Ke,We,Je=Object.freeze({__proto__:null,handler:function(e){var t=e.form,r=e.field,n=function(e){var n;return Object.keys(e).reduce((function(e,n){var o,i,a,u,c,l=t.fields[n],s=l.data;if(!l||!l.data.visible||!l.data.name)return e;var f="";(null===(o=l.component)||void 0===o?void 0:o.group)&&(r&&r.component.name===l.component.name||!r&&!t.formData.formatted[l.component.group])&&(f=l.component.group);var d=f||n,p=void 0===s.value?t.initialValues[n]||(null===(i=t.schema)||void 0===i?void 0:i.formattedDataDefaults)&&(null===(a=t.schema)||void 0===a?void 0:a.formattedDataDefaults[n]):s.value;return{erroredFields:l.fieldHasError()?[].concat(ze(e.erroredFields),[n]):e.erroredFields,predictableErroredFields:l.fieldValidationsHaveError()?[].concat(ze(e.predictableErroredFields),[n]):e.predictableErroredFields,fields:Object.assign(Object.assign({},e.fields),He({},n,s)),filteredFields:(null===(c=null===(u=t.schema)||void 0===u?void 0:u.filteredFields)||void 0===c?void 0:c.includes(d))?Object.assign(Object.assign(Object.assign({},e.filteredFields),void 0===p?{}:He({},d,p)),f?He({},f,p||e.formatted[f]):{}):e.filteredFields,formatted:Object.assign(Object.assign(Object.assign({},e.formatted),void 0===(null==s?void 0:s.value)||s.ignore?{}:W(e.formatted,n,null==s?void 0:s.value,t,l)||He({},n,p)),f?He({},f,p||e.formatted[f]):{})}}),{predictableErroredFields:[],erroredFields:[],fields:{},formatted:Object.assign({},null===(n=t.schema)||void 0===n?void 0:n.formattedDataDefaults),filteredFields:{}})},o=n(t.fields),i=n(t.steps[t.step.index]||{}),a=Object.assign(Object.assign({},o),{form:{scope:t.scope.getGlobalScope(),steps:Object.assign(Object.assign({},t.step),{data:He({},t.step.index,i),isValid:!i.predictableErroredFields.length}),isValid:!o.predictableErroredFields.length,messages:function(e){var r;return(null===(r=t.schema)||void 0===r?void 0:r.messages)?Object.keys(t.schema.messages).reduce((function(r,n){var o,i,a,u=T(e,n);return(null===(o=t.schema)||void 0===o?void 0:o.messages)&&(null===(i=t.schema)||void 0===i?void 0:i.messages[n])&&((null===(a=t.schema.messages[n].values)||void 0===a?void 0:a.includes(u))||t.schema.messages[n].value===u||t.schema.messages[n].required&&!u)?[].concat(ze(r),[t.schema.messages[n].name]):r}),[]):[]}(Object.assign(Object.assign({},t.initialValues),o.formatted))}});return t.formData=a,a}}),qe=function(e,t,r){var n=!t||t!==e.data.value;e.value=t,e.componentProps=Object.assign(Object.assign({},e.componentProps),r),n&&e.publish(a("ON_FIELD_CLEARED",e.component.name)),e.rehydrate()},Ze=Object.freeze({__proto__:null,handler:function(e){var t=e.field,r=e.form,n=e.eventReducedSchema;null==n||n.clearFields.forEach((function(e){e.fields.forEach((function(n,o){var i=r.fields[n],a=Array.isArray(e.clearedProps)?e.clearedProps[o]:e.clearedProps||{},u=Array.isArray(e.clearedValue)?e.clearedValue[o]:e.clearedValue,c=Array.isArray(e.validations)?e.validations[o]:e.validations,l=Array.isArray(e.defaultClearedValue)?e.defaultClearedValue[o]:e.defaultClearedValue,s=Array.isArray(e.defaultClearedProps)?e.defaultClearedProps[o]:e.defaultClearedProps;if(i){if(!e.validations)return qe(i,u,a);var f=me(e.useCurrentFieldValidation?t.data.value:i.value,c);i.fieldHasError(f)?qe(i,u,a):(l||s)&&qe(i,l,s)}}))}))},events:function(e){return Object.keys(e.clearFields||{})}});function Qe(e){return Qe="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Qe(e)}function Xe(e){return function(e){if(Array.isArray(e))return et(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(!e)return;if("string"==typeof e)return et(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);"Object"===r&&e.constructor&&(r=e.constructor.name);if("Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return et(e,t)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function et(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function tt(e,t,r){return(t=function(e){var t=function(e,t){if("object"!==Qe(e)||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!==Qe(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"===Qe(t)?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}!function(e){e.AND="and",e.OR="or"}(We||(We={}));var rt=(tt(Ke={},We.OR,(function(e,t){return e.fieldHasError(me(e.value,t))})),tt(Ke,We.AND,(function(e,t){var r=[];for(var n in t)r.push(e.fieldHasError(me(e.value,tt({},n,t[n]))));return r.every((function(e){return e}))})),Ke),nt=function(e,t){e.visibility=t,e.rehydrate(),e.visibility||(e.errors={})},ot=Object.freeze({__proto__:null,handler:function(e){var t,r=e.form,n=e.field;null===(t=e.eventReducedSchema.visibilityConditions)||void 0===t||t.forEach((function(e){var t=e.validations,o=e.fieldName,i=e.fieldNames,u=e.rule,c=e.showOnlyIfTrue,l=Xe(i||[o]),s=u||"or";l.forEach((function(e){if(e){var o=rt[s](n,t),i=c?!0===rt[s](n,t):!o;r.fields[e]?nt(r.fields[e],i):n.subscribe(a("ON_FIELD_MOUNT",e),(function(){return nt(r.fields[e],i)}))}}))}))},events:function(e){return Object.keys(e.visibilityConditions||{})}});function it(e){return it="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},it(e)}var at=Object.freeze({__proto__:null,handler:function(e){var t,r,n,o,i,a,u=e.field,c=e.data.event,l=void 0,s=void 0,f={number:function(){var e;return parseInt(null===(e=null==c?void 0:c.target)||void 0===e?void 0:e.value)},checkbox:function(){var e;return!!(null===(e=null==c?void 0:c.target)||void 0===e?void 0:e.checked)}};l=f[null===(t=null==c?void 0:c.target)||void 0===t?void 0:t.type]?f[null===(r=null==c?void 0:c.target)||void 0===r?void 0:r.type]():null===(n=null==c?void 0:c.target)||void 0===n?void 0:n.value,(Array.isArray(c)||"object"!==it(c)||"string"==typeof c||"number"==typeof c)&&(l=c),(null==c?void 0:c.id)&&(l=null==c?void 0:c.id,s=c),(null==c?void 0:c.options)&&(l=null==c?void 0:c.options);var d=(null==l?void 0:l.toString().length)<((null===(a=null===(i=null===(o=u.data)||void 0===o?void 0:o.value)||void 0===i?void 0:i.toString())||void 0===a?void 0:a.length)||0);return{parsedEventValue:l,metadata:s,isDeletingValue:d}}}),ut=Object.freeze({__proto__:null,handler:function(e){var t=e.data,r=e.field,n=e.eventReducedSchema.formatters;n&&!t.isDeletingValue&&(r.data.value=ie(r.data.value,n))},events:function(e){return Object.keys((null==e?void 0:e.formatters)||[])}});function ct(e){return ct="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},ct(e)}function lt(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,(o=n.key,i=void 0,i=function(e,t){if("object"!==ct(e)||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!==ct(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(o,"string"),"symbol"===ct(i)?i:String(i)),n)}var o,i}function st(e){var t=pt();return function(){var r,n=ht(e);if(t){var o=ht(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return function(e,t){if(t&&("object"===ct(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(this,r)}}function ft(e){var t="function"==typeof Map?new Map:void 0;return ft=function(e){if(null===e||(r=e,-1===Function.toString.call(r).indexOf("[native code]")))return e;var r;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,n)}function n(){return dt(e,arguments,ht(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),vt(n,e)},ft(e)}function dt(e,t,r){return dt=pt()?Reflect.construct.bind():function(e,t,r){var n=[null];n.push.apply(n,t);var o=new(Function.bind.apply(e,n));return r&&vt(o,r.prototype),o},dt.apply(null,arguments)}function pt(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}function vt(e,t){return vt=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},vt(e,t)}function ht(e){return ht=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},ht(e)}var yt=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&vt(e,t)}(i,ft(Error));var t,r,n,o=st(i);function i(e,t){var r,n=t.breaksObservingChain;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,i),(r=o.call(this)).breaksObservingChain=!1,r.message=e,r.breaksObservingChain=n,r}return t=i,r&&lt(t.prototype,r),n&&lt(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(),bt=Object.freeze({__proto__:null,handler:function(e){var t=e.field,r=e.data,n=e.eventReducedSchema.formatters,o=t.scopedComponent,i=o.errorMessages,a=o.filter;if(a&&r.parsedEventValue&&!r.isDeletingValue){var u=n&&ie(r.parsedEventValue,n,!0)||r.parsedEventValue,c=me(u,a,i);if(t.fieldHasError(c))throw new yt("Filter applied ".concat(JSON.stringify(a)),{breaksObservingChain:!0})}}}),mt=Object.freeze({__proto__:null,handler:function(e){var t=e.field,r=e.eventReducedSchema.masks;r&&(t.data.mask=(null==r?void 0:r.cleanMask)?void 0:function(e,t){var r=e;return Object.keys(t).forEach((function(e){var n=t[e],o=ue[e];o&&(r=o({value:r,maskValue:n}))})),r}(t.data.value,r))},events:function(e){return Object.keys(e.masks||{})}}),gt=function(e){var t=e.field,r=e.eventReducedSchema.validations,n=e.form;if(r){var o=me(t.data.value,r,t.scopedComponent.errorMessages,n.formData.fields);t.fieldHasError(o)!==t.fieldHasError()&&t.publish("ON_FIELD_VALIDATION_TOGGLE",{field:t.data}),t.errors=t.data.visible?o:{},t.data.failedErrorMessages=t.getFieldErrorMessages(t.data)}},Ot=Object.freeze({__proto__:null,handler:gt,events:function(e){return Object.keys(e.validations||{})}}),Et=Object.freeze({__proto__:null,handler:function(e){var t=e.field,r=e.data;t.data.keyup=!0,t.value=r.parsedEventValue}}),_t=Object.freeze({__proto__:null,handler:function(e){var t=e.field,r=e.data;t.data.keydown=!0,t.value=r.parsedEventValue}}),St=Object.freeze({__proto__:null,handler:function(e){var t=e.form;return{setScope:function(e){return t.scope.globalScope=e}}}});function jt(e){return jt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},jt(e)}function wt(e,t,r){return(t=function(e){var t=function(e,t){if("object"!==jt(e)||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!==jt(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"===jt(t)?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var At=Object.freeze({__proto__:null,handler:function(e){var t,r=e.form,n=e.event,o=e.payload,i=(wt(t={},c.NAVIGATE_STEP_BACK,r.step.index-1),wt(t,c.NAVIGATE_STEP_FORWARD,r.step.index+1),t),a=r.schema.components,u=i[n],l=o.constructor===Object?a[i[n]]:"string"==typeof o?(u=a.findIndex((function(e){return e.name===o})),a.find((function(e){return e.name===o}))):"number"==typeof o?(u=o,a[o]):void 0;r.step=l?Object.assign(Object.assign({},r.step),{numSteps:a.length,navigated:!!l,index:l?u:r.step.index,currentStepSchema:l||r.step.currentStepSchema}):Object.assign(Object.assign({},r.step),{navigated:!1})}}),Nt=Object.freeze({__proto__:null,handler:function(e){var t=e.form,r=e.payload,n=B(t.fields,function(e){if(e&&Object.keys(e).length&&(e.scopeBlurredChildren||e.scopeChangedChildren||e.childrenScope))return Object.keys(t.fields).filter((function(r){var n;return(null==e?void 0:e.scopeBlurredChildren)&&t.fields[r].data.blured||(null==e?void 0:e.scopeChangedChildren)&&t.fields[r].data.changed||(null===(n=null==e?void 0:e.childrenScope)||void 0===n?void 0:n.includes(r))}))}(r));Object.keys(n).forEach((function(e){n[e].fieldValidationsHaveError(!0)&&n[e].rehydrate()}))}}),It=Object.freeze({__proto__:null,handler:function(e){var t=e.form,r=e.payload,n=B(t.fields,Object.keys(r));Object.keys(n).forEach((function(e){var o,i=null===(o=null==r?void 0:r[e])||void 0===o?void 0:o.value,u=n[e];u.value=i||"",u.componentProps=Object.assign(Object.assign({},u.componentProps),r[e].props);var c=Object.keys(u.scopedComponent.validations).reduce((function(e,t){return Object.assign(Object.assign({},e),u.eventReducedSchema(t).validations)}),{});gt({field:u,eventReducedSchema:{validations:c},form:t}),u.publish(a("ON_FIELD_BINDED",u.component.name)),u.rehydrate()}))}});function Ft(e){return function(e){if(Array.isArray(e))return Lt(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(!e)return;if("string"==typeof e)return Lt(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);"Object"===r&&e.constructor&&(r=e.constructor.name);if("Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Lt(e,t)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Lt(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}var Dt=Object.freeze({__proto__:null,handler:function(e){var t,r=e.form,n=e.formEventDirectives;null===(t=null==n?void 0:n.visibilityConditions)||void 0===t||t.forEach((function(e){Ft(e.fieldNames||[e.fieldName]).forEach((function(t){if(t){var n=r.fields[t];r.fields[t].visibility=null==n?void 0:n.fieldHasError(me(n.value,e.validations)),r.fields[t].rehydrate()}}))}))},events:function(e){return Object.keys((null==e?void 0:e.visibilityConditions)||{})}});function kt(e){return kt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},kt(e)}function xt(e,t,r){return(t=function(e){var t=function(e,t){if("object"!==kt(e)||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!==kt(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"===kt(t)?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var Tt=Object.freeze({__proto__:null,handler:function(e){var t,r=e.form,n=function e(t){return e(Y(t,r.scope,r.scope))};r.scopedSchema=Object.assign(Object.assign({},r.schema),function e(t){if("string"==typeof t)return n(t);if("number"==typeof t)return t;var r=Object.assign({},t);return Object.keys(r).reduce((function(t,o){if(null===r[o])return t;if(Array.isArray(r[o]))return Object.assign(Object.assign({},t),xt({},o,r[o].map(e)));if("object"===kt(r[o]))return Object.assign(Object.assign({},t),xt({},o,Object.assign({},e(Object.assign({},r[o])))));if("string"!=typeof r[o])return Object.assign(Object.assign({},t),xt({},o,r[o]));if(!function(e){return/\$\{(.*)\}.*/g.test(e)}(r[o]))return Object.assign(Object.assign({},t),xt({},o,r[o]));var i=n(r[o]);try{ee(i)&&(i=JSON.parse(i))}catch(e){}return Object.assign(Object.assign({},t),xt({},o,i))}),{})}({visibilityConditions:null===(t=null==r?void 0:r.schema)||void 0===t?void 0:t.visibilityConditions}))}});function Ct(e){return Ct="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Ct(e)}function Pt(e,t,r){return(t=function(e){var t=function(e,t){if("object"!==Ct(e)||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!==Ct(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"===Ct(t)?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var Rt,Mt,Vt,Gt,Ut=function(e,t,r){var n=t();Object.keys(n).forEach((function(t){n[t].forEach((function(n){if(n.events){var o=n.events(r);if(Array.isArray(o)&&!o.includes(t))return}e.subscribe(a(t,null==r?void 0:r.name),n.handler)}))}))},Bt=function(){var e;return Pt(e={},"ON_FIELD_MOUNT",[Pe,_e,Be,Ot,ut,ot,Ze,mt,Je]),Pt(e,"ON_FIELD_CHANGE",[at,bt,Ee,Ot,ut,ot,Ze,Be,Je,mt]),Pt(e,"ON_FIELD_KEYUP",[at,bt,Et,Ot,ut,ot,Ze,Be,Je,mt]),Pt(e,"ON_FIELD_KEYDOWN",[at,bt,_t,Ot,ut,ot,Ze,Be,Je,mt]),Pt(e,"ON_FIELD_REHYDRATE",[Ot]),Pt(e,"ON_FIELD_CLEARED",[ut,mt,bt,Ot,ot,Be,Je]),Pt(e,"ON_FIELD_BINDED",[Je,ut,mt,bt,Ot,Be,ot,Ze]),Pt(e,"ON_FIELD_CLICK",[Ot,Be,ot,Ze]),Pt(e,"ON_FIELD_BLUR",[Se,ut,mt,Ot,Be,ot,Ze,Je]),Pt(e,"ON_FIELD_FOCUS",[je,mt]),Pt(e,"AFTER_FIELD_API_CALL",[at,bt,Ot,ut,mt,Je,ot,Ze]),e},Yt=function(){var e;return Pt(e={},"ON_SCOPE_CHANGE",[Tt,Dt]),Pt(e,"ON_FORM_MOUNT",[Pe,St,At,Dt]),Pt(e,"VALIDATE_FORM",[Nt]),Pt(e,"ON_FORM_SUBMIT",[St]),Pt(e,"ON_FORM_UN_MOUNT",[St]),Pt(e,"NAVIGATE_STEP",[At]),Pt(e,"NAVIGATE_STEP_BACK",[At]),Pt(e,"NAVIGATE_STEP_FORWARD",[At]),Pt(e,u("ON_SCOPE_CHANGE"),[Dt,Pe]),Pt(e,"ON_FORM_REHYDRATE",[Dt]),Pt(e,"ON_FIELD_CHANGE",[Dt]),Pt(e,"BIND_FIELDS",[It]),Pt(e,"ON_FORM_DESTROY_FIELD",[Je]),e};function Ht(e){return Ht="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Ht(e)}function zt(e){return function(e){if(Array.isArray(e))return $t(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(!e)return;if("string"==typeof e)return $t(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);"Object"===r&&e.constructor&&(r=e.constructor.name);if("Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return $t(e,t)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function $t(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function Kt(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,Wt(n.key),n)}}function Wt(e){var t=function(e,t){if("object"!==Ht(e)||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!==Ht(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"===Ht(t)?t:String(t)}function Jt(e,t){return Jt=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},Jt(e,t)}function qt(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=Qt(e);if(t){var o=Qt(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return function(e,t){if(t&&("object"===Ht(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return Zt(e)}(this,r)}}function Zt(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Qt(e){return Qt=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},Qt(e)}var Xt,er,tr,rr=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&Jt(e,t)}(i,j);var t,r,n,o=qt(i);function i(e,t,r,n){var a,u,c;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,i),a=o.call(this,e),Rt.set(Zt(a),void 0),Mt.set(Zt(a),void 0),Vt.set(Zt(a),void 0),Gt.set(Zt(a),void 0),a.scopedComponent=t,g(Zt(a),Mt,t,"f"),g(Zt(a),Gt,r,"f"),a.scope=n,g(Zt(a),Rt,{blured:!1,changed:!1,mounted:!1,focused:!1,errors:{},failedErrorMessages:[],visible:!(null===(u=t.state)||void 0===u?void 0:u.hidden),ignore:null===(c=t.state)||void 0===c?void 0:c.ignoreValue,name:t.name},"f"),Ut(e,Bt,t),a}return t=i,r=[{key:"value",get:function(){return m(this,Gt,"f").setValue&&m(this,Mt,"f").props&&this.scopedComponent.props&&void 0!==this.scopedComponent.props[m(this,Gt,"f").setValue]&&this.scopedComponent.props[m(this,Gt,"f").setValue]!==m(this,Mt,"f").props[m(this,Gt,"f").setValue]?void 0!==m(this,Rt,"f").value&&m(this,Mt,"f").props[m(this,Gt,"f").setValue]!==m(this,Rt,"f").value?m(this,Rt,"f").value:this.scopedComponent.props[m(this,Gt,"f").setValue]:m(this,Rt,"f").mask||m(this,Rt,"f").value},set:function(e){m(this,Rt,"f").value=e,this.scope.globalScope={namespace:"fields",key:m(this,Mt,"f").name,data:m(this,Rt,"f")}}},{key:"component",get:function(){return m(this,Mt,"f")}},{key:"componentProps",get:function(){return m(this,Mt,"f").props},set:function(e){m(this,Mt,"f").props=e,m(this,Vt,"f").props=e}},{key:"data",get:function(){return m(this,Rt,"f")},set:function(e){g(this,Rt,Object.assign(Object.assign({},m(this,Rt,"f")),e),"f"),this.scope.globalScope={namespace:"fields",key:m(this,Mt,"f").name,data:m(this,Rt,"f")}}},{key:"visibility",set:function(e){m(this,Rt,"f").visible=e}},{key:"scopedComponent",get:function(){return m(this,Vt,"f")},set:function(e){g(this,Vt,e,"f")}},{key:"errors",get:function(){return m(this,Rt,"f").errors},set:function(e){m(this,Rt,"f").errors=e,this.scope.globalScope={namespace:"fields",key:m(this,Mt,"f").name,data:m(this,Rt,"f")}}},{key:"props",get:function(){var e,t=this;if(!this.scopedComponent.name||!m(this,Gt,"f"))return this.scopedComponent.props;var r={getValue:function(e){t.publish(a("ON_FIELD_CHANGE",t.component.name),{event:e}),t.publish("ON_FIELD_CHANGE",{component:t.component.name,event:e})},onBlur:function(e){return t.publish(a("ON_FIELD_BLUR",t.component.name),{event:e})},onClick:function(e){return t.publish(a("ON_FIELD_CLICK",t.component.name),{event:e})},onFocus:function(e){return t.publish(a("ON_FIELD_FOCUS",t.component.name),{event:e})},onKeyUp:function(e){return t.publish(a("ON_FIELD_KEYUP",t.component.name),{event:e})},onKeyDown:function(e){return t.publish(a("ON_FIELD_KEYDOWN",t.component.name),{event:e})},setValue:this.value,setErrorMessage:this.getFieldErrorMessages()[0],setErrorState:this.fieldHasError()};return Object.keys(m(this,Gt,"f")).reduce((function(e,n){return void 0===r[n]?e:Object.assign(Object.assign({},e),function(e,t,r){return(t=Wt(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}({},m(t,Gt,"f")[n],r[n]))}),Object.assign({disabled:null===(e=this.scope.scope.configs)||void 0===e?void 0:e.disable},m(this,Vt,"f").props))}},{key:"mappings",get:function(){return m(this,Gt,"f")}},{key:"getFieldErrorMessages",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:m(this,Rt,"f");return t.errors?Object.keys(t.errors).reduce((function(r,n){var o=t.errors;return(void 0===o?{}:o)[n].fail&&e.scopedComponent.errorMessages?[].concat(zt(r),[e.scopedComponent.errorMessages[n]||e.scopedComponent.errorMessages.default]):r}),[]):[]}},{key:"fieldHasError",value:function(e){return e||(e=m(this,Rt,"f").errors||{}),!!Object.keys(e).find((function(t){return e&&e[t].fail}),[])}},{key:"fieldValidationsHaveError",value:function(e,t){var r=this;return!(!m(this,Vt,"f").validations||!m(this,Rt,"f").visible||!Object.keys(m(this,Vt,"f").validations).find((function(n){var o=m(r,Vt,"f"),i=o.validations,a=void 0===i?{}:i,u=o.errorMessages,c=me(m(r,Rt,"f").value,a[t||n],u);return e&&(r.errors=c),r.fieldHasError(c)})))}},{key:"eventReducedSchema",value:function(e){return{api:m(this,Vt,"f").api&&m(this,Vt,"f").api[e],clearFields:m(this,Vt,"f").clearFields&&m(this,Vt,"f").clearFields[e],formatters:m(this,Vt,"f").formatters&&m(this,Vt,"f").formatters[e],masks:m(this,Vt,"f").masks&&m(this,Vt,"f").masks[e],validations:m(this,Vt,"f").validations&&m(this,Vt,"f").validations[e],visibilityConditions:m(this,Vt,"f").visibilityConditions&&m(this,Vt,"f").visibilityConditions[e]}}},{key:"rehydrate",value:function(){this.publish(a("ON_FIELD_REHYDRATE",m(this,Mt,"f").name),{checksum:JSON.stringify(this.data)+JSON.stringify(this.scopedComponent)})}}],r&&Kt(t.prototype,r),n&&Kt(t,n),Object.defineProperty(t,"prototype",{writable:!1}),i}();function nr(e){return nr="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},nr(e)}function or(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,ir(n.key),n)}}function ir(e){var t=function(e,t){if("object"!==nr(e)||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!==nr(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"===nr(t)?t:String(t)}function ar(e,t){return ar=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},ar(e,t)}function ur(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=lr(e);if(t){var o=lr(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return function(e,t){if(t&&("object"===nr(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return cr(e)}(this,r)}}function cr(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function lr(e){return lr=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},lr(e)}Rt=new WeakMap,Mt=new WeakMap,Vt=new WeakMap,Gt=new WeakMap;var sr,fr,dr=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&ar(e,t)}(i,j);var t,r,n,o=ur(i);function i(e,t,r,n,a,u){var c;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,i),c=o.call(this,t),Xt.set(cr(c),{}),er.set(cr(c),void 0),tr.set(cr(c),void 0),c.steps={},g(cr(c),er,t,"f"),c.schema=n,c.scopedSchema=n,c.scope=r,c.formId=e,c.initialValues=null==a?void 0:a.initialValues,c.group=u,g(cr(c),tr,{numSteps:null==n?void 0:n.components.length,navigated:!1,index:0,currentStepSchema:null==n?void 0:n.components[0],isValid:!1,data:{}},"f"),c.formData={predictableErroredFields:[],erroredFields:[],fields:{},formatted:{},form:{scope:r.getGlobalScope(),steps:m(cr(c),tr,"f"),isValid:!1,messages:[]}},Ut(t,Yt,n),c}return t=i,r=[{key:"step",get:function(){return m(this,tr,"f")},set:function(e){g(this,tr,e,"f")}},{key:"fields",get:function(){return m(this,Xt,"f")||{}}},{key:"eventReducedSchema",value:function(e){var t=this;return this.scopedSchema?Object.keys(this.scopedSchema).reduce((function(r,n){return t.scopedSchema[n]?Object.assign(Object.assign({},r),function(e,t,r){return(t=ir(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}({},n,t.scopedSchema[n][e])):r}),{}):{}}},{key:"getFieldInstance",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return e.name=e.name||e.component+"_"+JSON.stringify(e.props),this.steps[m(this,tr,"f").index]||(this.steps[m(this,tr,"f").index]={}),this.fields[e.name]||(this.fields[e.name]=new rr(m(this,er,"f"),e,t,this.scope),this.steps[m(this,tr,"f").index][e.name]=this.fields[e.name]),this.fields[e.name]}},{key:"rehydrate",value:function(){var e=this.scopedSchema;e.components;var t=y(e,["components"]);this.publish("ON_FORM_REHYDRATE",{checksum:JSON.stringify(t)})}},{key:"destroyField",value:function(e){m(this,Xt,"f")[e]&&(delete m(this,Xt,"f")[e],delete this.steps[m(this,tr,"f").index][e],this.publish("ON_FORM_DESTROY_FIELD",{checksum:e}))}}],r&&or(t.prototype,r),n&&or(t,n),Object.defineProperty(t,"prototype",{writable:!1}),i}();function pr(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=br(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,o=function(){};return{s:o,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,u=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return a=e.done,e},e:function(e){u=!0,i=e},f:function(){try{a||null==r.return||r.return()}finally{if(u)throw i}}}}function vr(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */vr=function(){return e};var e={},t=Object.prototype,r=t.hasOwnProperty,n=Object.defineProperty||function(e,t,r){e[t]=r.value},o="function"==typeof Symbol?Symbol:{},i=o.iterator||"@@iterator",a=o.asyncIterator||"@@asyncIterator",u=o.toStringTag||"@@toStringTag";function c(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{c({},"")}catch(e){c=function(e,t,r){return e[t]=r}}function l(e,t,r,o){var i=t&&t.prototype instanceof d?t:d,a=Object.create(i.prototype),u=new w(o||[]);return n(a,"_invoke",{value:E(e,r,u)}),a}function s(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}e.wrap=l;var f={};function d(){}function p(){}function v(){}var h={};c(h,i,(function(){return this}));var y=Object.getPrototypeOf,b=y&&y(y(A([])));b&&b!==t&&r.call(b,i)&&(h=b);var m=v.prototype=d.prototype=Object.create(h);function g(e){["next","throw","return"].forEach((function(t){c(e,t,(function(e){return this._invoke(t,e)}))}))}function O(e,t){function o(n,i,a,u){var c=s(e[n],e,i);if("throw"!==c.type){var l=c.arg,f=l.value;return f&&"object"==gr(f)&&r.call(f,"__await")?t.resolve(f.__await).then((function(e){o("next",e,a,u)}),(function(e){o("throw",e,a,u)})):t.resolve(f).then((function(e){l.value=e,a(l)}),(function(e){return o("throw",e,a,u)}))}u(c.arg)}var i;n(this,"_invoke",{value:function(e,r){function n(){return new t((function(t,n){o(e,r,t,n)}))}return i=i?i.then(n,n):n()}})}function E(e,t,r){var n="suspendedStart";return function(o,i){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===o)throw i;return N()}for(r.method=o,r.arg=i;;){var a=r.delegate;if(a){var u=_(a,r);if(u){if(u===f)continue;return u}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var c=s(e,t,r);if("normal"===c.type){if(n=r.done?"completed":"suspendedYield",c.arg===f)continue;return{value:c.arg,done:r.done}}"throw"===c.type&&(n="completed",r.method="throw",r.arg=c.arg)}}}function _(e,t){var r=t.method,n=e.iterator[r];if(void 0===n)return t.delegate=null,"throw"===r&&e.iterator.return&&(t.method="return",t.arg=void 0,_(e,t),"throw"===t.method)||"return"!==r&&(t.method="throw",t.arg=new TypeError("The iterator does not provide a '"+r+"' method")),f;var o=s(n,e.iterator,t.arg);if("throw"===o.type)return t.method="throw",t.arg=o.arg,t.delegate=null,f;var i=o.arg;return i?i.done?(t[e.resultName]=i.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,f):i:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,f)}function S(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function j(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function w(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(S,this),this.reset(!0)}function A(e){if(e){var t=e[i];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var n=-1,o=function t(){for(;++n<e.length;)if(r.call(e,n))return t.value=e[n],t.done=!1,t;return t.value=void 0,t.done=!0,t};return o.next=o}}return{next:N}}function N(){return{value:void 0,done:!0}}return p.prototype=v,n(m,"constructor",{value:v,configurable:!0}),n(v,"constructor",{value:p,configurable:!0}),p.displayName=c(v,u,"GeneratorFunction"),e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===p||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,v):(e.__proto__=v,c(e,u,"GeneratorFunction")),e.prototype=Object.create(m),e},e.awrap=function(e){return{__await:e}},g(O.prototype),c(O.prototype,a,(function(){return this})),e.AsyncIterator=O,e.async=function(t,r,n,o,i){void 0===i&&(i=Promise);var a=new O(l(t,r,n,o),i);return e.isGeneratorFunction(r)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},g(m),c(m,u,"Generator"),c(m,i,(function(){return this})),c(m,"toString",(function(){return"[object Generator]"})),e.keys=function(e){var t=Object(e),r=[];for(var n in t)r.push(n);return r.reverse(),function e(){for(;r.length;){var n=r.pop();if(n in t)return e.value=n,e.done=!1,e}return e.done=!0,e}},e.values=A,w.prototype={constructor:w,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(j),!e)for(var t in this)"t"===t.charAt(0)&&r.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=void 0)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function n(r,n){return a.type="throw",a.arg=e,t.next=r,n&&(t.method="next",t.arg=void 0),!!n}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],a=i.completion;if("root"===i.tryLoc)return n("end");if(i.tryLoc<=this.prev){var u=r.call(i,"catchLoc"),c=r.call(i,"finallyLoc");if(u&&c){if(this.prev<i.catchLoc)return n(i.catchLoc,!0);if(this.prev<i.finallyLoc)return n(i.finallyLoc)}else if(u){if(this.prev<i.catchLoc)return n(i.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return n(i.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===e||"continue"===e)&&i.tryLoc<=t&&t<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=e,a.arg=t,i?(this.method="next",this.next=i.finallyLoc,f):this.complete(a)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),f},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),j(r),f}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var o=n.arg;j(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,r){return this.delegate={iterator:A(e),resultName:t,nextLoc:r},"next"===this.method&&(this.arg=void 0),f}},e}function hr(e,t,r){return(t=Sr(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function yr(e){return function(e){if(Array.isArray(e))return mr(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||br(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function br(e,t){if(e){if("string"==typeof e)return mr(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?mr(e,t):void 0}}function mr(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function gr(e){return gr="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},gr(e)}function Or(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Er(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,Sr(n.key),n)}}function _r(e,t,r){return t&&Er(e.prototype,t),r&&Er(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function Sr(e){var t=function(e,t){if("object"!==gr(e)||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!==gr(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"===gr(t)?t:String(t)}Xt=new WeakMap,er=new WeakMap,tr=new WeakMap,function(e){e.OBSERVER="OBSERVER",e.REACT_FIELD_ADAPTER="REACT FIELD ADAPTER",e.FIELD_HANDLER="FIELD HANDLER"}(sr||(sr={}));var jr=function(){function e(){Or(this,e),this.workers={},this.getFormInstance=this.getFormInstance.bind(this),this.getGroupFormsIds=this.getGroupFormsIds.bind(this)}return _r(e,[{key:"getGroupFormsIds",value:function(e){var t=this;return Object.keys(this.workers||{}).filter((function(r){return t.workers[r].group===e}),[])}},{key:"getFormInstance",value:function(){var e,t,r,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:l,o=arguments.length>1?arguments[1]:void 0;if(this.workers[n]&&!(null==o?void 0:o.newInstance))return this.workers[n];var i=new wr(n,null===(t=null===(e=null==o?void 0:o.initialScope)||void 0===e?void 0:e.configs)||void 0===t?void 0:t.enableLogging),a=new x(i);return a.initialScope=Object.assign(Object.assign({},null==o?void 0:o.initialScope),null===(r=null==o?void 0:o.schema)||void 0===r?void 0:r.iVars),this.workers[n]=new dr(n,i,a,null==o?void 0:o.schema,{initialValues:(null==o?void 0:o.initialValues)||{}},null==o?void 0:o.group),this.workers[n]}}]),e}(),wr=function(){function e(t){var r=this,n=arguments.length>1&&void 0!==arguments[1]&&arguments[1];Or(this,e),this.regexBasedEvents={},this.events={},this.history={},fr.set(this,(function(e){var t=e.event,n=e.data,o=e.payload,i=function(e){return e.split("/")[1]||""}(t),a=Nr(r.namespace,null==n?void 0:n.opts),u=a.fields[i],c=function(e){return Array.isArray(e.split("/"))?e.split("/")[0]:e}(t);return{eventReducedSchema:u&&u.eventReducedSchema(c),formEventDirectives:a&&a.eventReducedSchema(c),namespace:r.namespace,coreEvent:c,form:a,field:u,event:t,data:n,payload:o}})),this.namespace=t,this.enableLogging=n}return _r(e,[{key:"runForRegexBasedEvent",value:function(e,t){for(var r=!1,n=0,o=Object.keys(this.events);n<o.length;n++){var i=o[n];(r=e.test(i))&&t(i)}return r}},{key:"handleRegexSubscription",value:function(e,t){var r=this;this.runForRegexBasedEvent(e,(function(e){return r.subscribe(e,t)}))||(this.regexBasedEvents[e]={regex:e,handlers:Array.isArray(this.events[e])?[].concat(yr(this.events[e]),[t]):[t]})}},{key:"subscribe",value:function(e,t){var r=this;return"object"===gr(e)?(this.handleRegexSubscription(e,t),function(){}):(this.events=Object.assign(Object.assign({},this.events),hr({},e,Array.isArray(this.events[e])?[].concat(yr(this.events[e]),[t]):[t])),function(){r.unsubscribe(e,t)})}},{key:"unsubscribe",value:function(e,t){this.events=Object.assign(Object.assign({},this.events),hr({},e,this.events[e].filter((function(e){return e!==t}))))}},{key:"isAsyncFunction",value:function(e){var t=e.toString().trim();return!!("AsyncFunction"===e[Symbol.toStringTag]||"AsyncFunction"==e.constructor.name||t.match(/^async /)||t.match(/return _ref[^\\.]*\.apply/)||e instanceof Promise)}},{key:"publish",value:function(e,t){return b(this,void 0,void 0,vr().mark((function r(){var n,o,i,a=this;return vr().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:if(!(null==t?void 0:t.checksum)||this.history[e]!==(null==t?void 0:t.checksum)){r.next=2;break}return r.abrupt("return");case 2:if(this.history[e]=null==t?void 0:t.checksum,"object"!==gr(e)){r.next=6;break}return this.runForRegexBasedEvent(e,(function(e){return a.publish(e,t)})),r.abrupt("return");case 6:n=0,o=Object.keys(this.regexBasedEvents);case 7:if(!(n<o.length)){r.next=16;break}if(i=o[n],!new RegExp(this.regexBasedEvents[i].regex).test(e)){r.next=13;break}return r.next=13,this.publishForEvents(e,t,hr({},e,this.regexBasedEvents[i].handlers));case 13:n++,r.next=7;break;case 16:return r.abrupt("return",this.publishForEvents(e,t,this.events));case 17:case"end":return r.stop()}}),r,this)})))}},{key:"publishForEvents",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=arguments.length>2?arguments[2]:void 0;return b(this,void 0,void 0,vr().mark((function n(){var o,i,a,u,c,l=this;return vr().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(r[e]){n.next=2;break}return n.abrupt("return",{});case 2:o={},i=pr(r[e]),n.prev=4,u=vr().mark((function r(){var n,i,u;return vr().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:if(n=a.value,r.prev=1,n){r.next=4;break}return r.abrupt("return",{v:void 0});case 4:if(i=m(l,fr,"f").call(l,{data:Object.assign(Object.assign({},t),o),payload:t,event:e,namespace:l.namespace}),!l.isAsyncFunction(n)){r.next=12;break}return r.next=9,n(i,(function(){return l.unsubscribe(e,n)}));case 9:r.t0=r.sent,r.next=13;break;case 12:r.t0=n(i,(function(){return l.unsubscribe(e,n)}));case 13:u=r.t0,o=Object.assign(Object.assign({},o),u),r.next=23;break;case 17:if(r.prev=17,r.t1=r.catch(1),!(r.t1 instanceof yt&&r.t1.breaksObservingChain)){r.next=22;break}return l.logError(sr.OBSERVER,e,"publish",r.t1),r.abrupt("return",{v:{}});case 22:throw r.t1;case 23:case"end":return r.stop()}}),r,null,[[1,17]])})),i.s();case 7:if((a=i.n()).done){n.next=14;break}return n.delegateYield(u(),"t0",9);case 9:if("object"!==gr(c=n.t0)){n.next=12;break}return n.abrupt("return",c.v);case 12:n.next=7;break;case 14:n.next=19;break;case 16:n.prev=16,n.t1=n.catch(4),i.e(n.t1);case 19:return n.prev=19,i.f(),n.finish(19);case 22:return n.abrupt("return",Object.assign(Object.assign({},o),Nr(this.namespace).formData));case 23:case"end":return n.stop()}}),n,this,[[4,16,19,22]])})))}},{key:"logError",value:function(e,t,r,n){this.enableLogging&&"LOG"!==t&&this.publish("LOG",{level:"error",data:{event:t,error:n},action:r,flow:e})}},{key:"logInfo",value:function(e,t,r,n){this.enableLogging&&"LOG"!==t&&this.publish("LOG",{level:"info",data:Object.assign({event:t},n),action:r,flow:e})}}]),e}();fr=new WeakMap;var Ar=new jr,Nr=Ar.getFormInstance,Ir=Ar.getGroupFormsIds;const Fr=({children:r,component:n,wrapper:o,propsMapping:i={},formId:u,onMount:c,onChange:l,onFocus:s,onBlur:f,onClick:d,onRehydrate:p,afterApiCall:v})=>{const[y,b]=h(),[m,g]=h(),[O,E]=h(),[_,S]=h(),[j,w]=h(),[A,N]=h(),I=t.useMemo((()=>Nr(u).getFieldInstance(n,i)),[]),F=t.useMemo((()=>o),[o]);return t.useMemo((()=>{I.publish(a("ON_FIELD_MOUNT",n.name)),c(I.data)}),[]),t.useEffect((()=>{m&&p(I.data)}),[m]),t.useEffect((()=>{y&&l(I.data)}),[y]),t.useEffect((()=>{O&&f(I.data)}),[O]),t.useEffect((()=>{_&&s(I.data)}),[_]),t.useEffect((()=>{j&&d(I.data)}),[j]),t.useEffect((()=>{A&&v(I.data)}),[A]),t.useEffect((()=>I.subscribe(a("ON_FIELD_REHYDRATE",n.name),(()=>g()))),[]),t.useEffect((()=>I.subscribe(a("ON_FIELD_BLUR",n.name),(()=>E()))),[]),t.useEffect((()=>I.subscribe(a("ON_FIELD_CHANGE",n.name),(()=>b()))),[]),t.useEffect((()=>I.subscribe(a("ON_FIELD_FOCUS",n.name),(()=>S()))),[]),t.useEffect((()=>I.subscribe(a("ON_FIELD_CLICK",n.name),(()=>w()))),[]),t.useEffect((()=>I.subscribe(a("AFTER_FIELD_API_CALL",n.name),(()=>N()))),[]),I.data.visible&&I.data.mounted?e.jsx(F,Object.assign({},I.props,{children:r})):null},Lr=t.forwardRef(((t,r)=>e.jsx("input",{ref:r,type:"submit",style:{display:"none"}})));Lr.displayName="Submit";const Dr=t.createContext({});Dr.displayName="FormContext";const kr=o.default.forwardRef((({autoComplete:r,hooks:n,iVars:i,id:a=l,submitOnValidOnly:s=!0,initialValues:f={},className:d,schema:p,group:v,onData:h,onSubmit:y,onBlur:b,onClick:m,afterApiCall:g,onFormMount:O,onFieldMount:E,onStep:_,onFocus:S,onLog:j,onScopeChange:w,onFieldRehydrate:A,renderFieldWrapper:N,disable:I},F)=>{var L;const[,D]=t.useReducer((e=>e+1),0),k=t.useRef(null),x=t.useRef(null),{mapper:T,propsMapping:C}=t.useContext(Dr),P=t.useMemo((()=>Nr(a,{group:v,schema:p,newInstance:!0,initialScope:{configs:Object.assign(Object.assign({},null==p?void 0:p.configs),{enableLogging:!!j,disable:I}),global:Object.assign(Object.assign({},null==p?void 0:p.iVars),i)},initialValues:f})),[]);t.useEffect((()=>{P.publish("ON_FORM_MOUNT")}),[]);const R=t.useMemo((()=>T.step?T.step.component:o.default.Fragment),[]),M=t.useMemo((()=>{if(!P.step.currentStepSchema)return;const t=(r,n=0)=>{var o;return null===(o=r.children)||void 0===o?void 0:o.map(((r,o)=>{var i;const u=null===(i=T[r.component])||void 0===i?void 0:i.component,c=e.jsx(Fr,Object.assign({component:r,wrapper:u,propsMapping:C[r.component]||C.__default__,formId:a,onMount:e=>{E&&E(P.formData,r,e)},onRehydrate:e=>{A&&A(P.formData,r,e)},onChange:e=>{h&&h(P.formData,r,e)},onBlur:e=>{b&&b(P.formData,r,e)},onClick:e=>{m&&m(P.formData,e)},afterApiCall:e=>{g&&g(P.formData,r,e)},onFocus:e=>{S&&S(P.formData,r,Object.assign(Object.assign({},e),{schemaLocation:{step:P.step.index,depth:n,index:o}}))}},{children:Array.isArray(r.children)?t(r,n++):r.children}),`${P.step.index}_${n}_${r.name}_${r.component}_${o}`);return N?N(r,c):c}))};return t(P.step.currentStepSchema)}),[P.step.index,a]);return t.useEffect((()=>{P.scope.globalScope={namespace:"configs",data:{disable:I}}}),[I]),t.useEffect((()=>{O&&O(P.formData)}),[]),t.useEffect((()=>{P.scope.globalScope={namespace:"configs",data:{disable:I}}}),[I]),t.useEffect((()=>{P.scope.globalScope={namespace:"global",data:Object.assign(Object.assign({},null==p?void 0:p.iVars),i)}}),[JSON.stringify(i)]),t.useEffect((()=>P.subscribe("ON_FORM_REHYDRATE",(()=>{D()}))),[]),t.useEffect((()=>P.subscribe("LOG",(({data:e})=>j&&j(e)))),[]),t.useMemo((()=>P.subscribe(u("ON_SCOPE_CHANGE"),(e=>w&&w(P.scope.scope,e.data.namespace,e.data.key)))),[]),t.useEffect((()=>P.subscribe("ON_FORM_SUBMIT",(({data:e})=>{const t=(null==n?void 0:n.preSubmit)&&(null==n?void 0:n.preSubmit(P.formData));!P.formData.form.isValid&&s||y&&y(e.event,Object.assign(Object.assign({},P.formData),{formatted:Object.assign(Object.assign({},P.formData.formatted),t)}))}))),[]),t.useEffect((()=>P.subscribeBulk([c.NAVIGATE_STEP_BACK,c.NAVIGATE_STEP_FORWARD,c.NAVIGATE_STEP],(()=>{_&&_(P.formData),D()}))),[]),t.useImperativeHandle(F,(()=>({values:()=>P.formData,step:P.publishFor(c.NAVIGATE_STEP),stepForward:P.publishFor(c.NAVIGATE_STEP_FORWARD),bindFields:P.publishFor(c.BIND_FIELDS),stepBack:P.publishFor(c.NAVIGATE_STEP_BACK),validateForm:P.publishFor(c.VALIDATE_FORM),submit:()=>{var e;return null===(e=x.current)||void 0===e?void 0:e.click()},schema:p})),[]),e.jsxs("form",Object.assign({action:P.scopedSchema.action,method:P.scopedSchema.method,className:d,ref:k,autoComplete:r,onSubmit:e=>{P.publish(c.ON_FORM_SUBMIT,{event:e})}},{children:[e.jsx(R,Object.assign({},null===(L=P.step.currentStepSchema)||void 0===L?void 0:L.props,{children:M})),!P.scopedSchema.disableFormSubmit&&e.jsx(Lr,{ref:x})]}))})),xr=o.default.forwardRef(((t,r)=>t.schema?e.jsx(kr,Object.assign({},t,{ref:r})):t.renderLoading?t.renderLoading():e.jsx(e.Fragment,{})));exports.ALL_NAMESPACE_EVENTS=u,exports.BUILD_EVENT=a,exports.CoreEvents=c,exports.FormProvider=({children:t,mapper:r,propsMapping:n})=>e.jsx(Dr.Provider,Object.assign({value:{mapper:r,propsMapping:n}},{children:t})),exports.SchemaGuard=xr,exports.asFormField=({Comp:r,propsMapping:n})=>o=>{var{name:i,validations:u,errorMessages:c,masks:l,clearFields:f,api:d,filter:p,formatters:v,visibilityConditions:b,formId:m=s,visibility:g=!0,value:O,disabled:E=!1,optionList:_=[],onSelected:S}=o,j=y(o,["name","validations","errorMessages","masks","clearFields","api","filter","formatters","visibilityConditions","formId","visibility","value","disabled","optionList","onSelected"]);const[,w]=h(),A=t.useMemo((()=>({state:{hidden:!g},component:"",name:i,validations:u,errorMessages:c,masks:l,filter:p,visibilityConditions:b,formatters:v,clearFields:f,api:d})),[c,i,p,v,l,u,b,f,d]),N=t.useMemo((()=>Nr(m).getFieldInstance(A,n)),[]),I=t.useMemo((()=>j[n.getValue]),[j]),F=t.useMemo((()=>j[n.onBlur]),[j]),L=t.useMemo((()=>j[n.onClick]),[j]),D=t.useMemo((()=>j[n.onFocus]),[j]),k=t.useMemo((()=>j[n.onKeyUp]),[j]),x=t.useMemo((()=>j[n.onKeyDown]),[j]);return t.useMemo((()=>{N.publish(a("ON_FIELD_MOUNT",A.name))}),[]),t.useMemo((()=>{N.subscribeBulk([a("ON_FIELD_MOUNT",A.name),a("ON_FIELD_REHYDRATE",A.name)],(()=>{w(),S&&S(N.data)}))}),[]),t.useMemo((()=>{N.subscribe(a("ON_FIELD_CHANGE",A.name),(({data:e})=>{w(),I&&I(e.event,N.data),S&&S(N.data)}))}),[I]),t.useMemo((()=>{N.subscribe(a("ON_FIELD_BLUR",A.name),(({data:e})=>{w(),F&&F(e.event)}))}),[F]),t.useMemo((()=>{N.subscribe(a("ON_FIELD_CLICK",A.name),(({data:e})=>{w(),L&&L(e.event)}))}),[L]),t.useMemo((()=>{N.subscribe(a("ON_FIELD_FOCUS",A.name),(({data:e})=>{w(),D&&D(e.event)}))}),[D]),t.useMemo((()=>{N.subscribe(a("ON_FIELD_KEYUP",A.name),(({data:e})=>{w(),k&&k(e.event)}))}),[k]),t.useMemo((()=>{N.subscribe(a("ON_FIELD_KEYDOWN",A.name),(({data:e})=>{w(),x&&x(e.event)}))}),[x]),t.useEffect((()=>{void 0!==O&&(N.value=O,N.rehydrate())}),[O]),t.useEffect((()=>{N.visibility=g,N.rehydrate()}),[g]),t.useEffect((()=>{N.componentProps=Object.assign(Object.assign({},N.componentProps),{disabled:E})}),[E]),t.useEffect((()=>{N.componentProps=Object.assign(Object.assign({},N.componentProps),{optionList:_}),N.rehydrate()}),[_]),t.useEffect((()=>()=>Nr(m).destroyField(i)),[]),N.data.visible?e.jsx(r,Object.assign({},j,N.props)):e.jsx(e.Fragment,{})},exports.getFormInstance=Nr,exports.getGroupFormsIds=Ir,exports.useForm=({onValid:e,onData:r,onClick:n,onSubmit:o,id:i=s,ids:a})=>{const l=(e,t)=>{t&&(a?a.map((r=>Nr(r).subscribe(e,(({data:e})=>t(Nr(r).formData,{field:e.field}))))):Nr(i).subscribe(e,t))},f=e=>{const t=a?a.reduce(((e,t)=>Object.keys(e).reduce(((r,n)=>Object.assign(Object.assign({},r),{[n]:Object.assign(Object.assign({},e[n]),Nr(t).formData[n])})),{})),{formatted:{},erroredFields:{},fields:{},form:{},predictableErroredFields:{},filteredFields:{}}):Nr(i).formData;if(e&&Object.keys(e).length&&(e.scopeBlurredChildren||e.scopeChangedChildren||e.childrenScope)){const r=Object.keys(t.formatted).filter((r=>{var n;return(null==e?void 0:e.scopeBlurredChildren)&&t.fields[r].blured||(null==e?void 0:e.scopeChangedChildren)&&t.fields[r].changed||(null===(n=null==e?void 0:e.childrenScope)||void 0===n?void 0:n.includes(r))}));t.formatted=B(t.formatted,r)}return t},d=t.useCallback((()=>{let e=Nr(i).formData;a&&(e=a.reduce(((e,t)=>Object.assign(Object.assign({},e),{[t]:Nr(t).formData})),{})),r&&r(e)}),[r,e]);t.useEffect((()=>l("ON_FIELD_VALIDATION_TOGGLE",e)),[e]),t.useEffect((()=>l("ON_FIELD_CHANGE",d)),[r,e]),t.useEffect((()=>l(u(c.ON_FIELD_REHYDRATE),d)),[r,e]),t.useEffect((()=>l(c.ON_FORM_DESTROY_FIELD,d)),[r,e]),t.useEffect((()=>l(u(c.ON_FIELD_CLICK),(()=>n&&n(f())))),[n]),t.useEffect((()=>l(c.ON_FORM_SUBMIT,(()=>{o&&o(f())}))),[o]);return{submitForm:()=>Nr(a?a[0]:i).publish(c.ON_FORM_SUBMIT),formData:f}};
2
- //# sourceMappingURL=asFormField-41217c51.js.map